From 1efcc29cfde270c482e6d75ec8a070da085aa9e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 07:47:26 +0000 Subject: [PATCH 001/592] chore: configure new SDK language --- .devcontainer/Dockerfile | 9 + .devcontainer/devcontainer.json | 43 + .github/workflows/ci.yml | 52 + .gitignore | 16 + .python-version | 1 + .stats.yml | 4 + Brewfile | 2 + CONTRIBUTING.md | 129 ++ LICENSE | 201 ++ README.md | 349 ++- SECURITY.md | 27 + api.md | 19 + bin/publish-pypi | 6 + examples/.keep | 4 + mypy.ini | 50 + noxfile.py | 9 + pyproject.toml | 206 ++ requirements-dev.lock | 104 + requirements.lock | 45 + scripts/bootstrap | 19 + scripts/format | 8 + scripts/lint | 11 + scripts/mock | 41 + scripts/test | 61 + scripts/utils/ruffen-docs.py | 167 ++ src/gcore/__init__.py | 84 + src/gcore/_base_client.py | 1969 +++++++++++++++++ src/gcore/_client.py | 472 ++++ src/gcore/_compat.py | 219 ++ src/gcore/_constants.py | 14 + src/gcore/_exceptions.py | 108 + src/gcore/_files.py | 123 + src/gcore/_models.py | 804 +++++++ src/gcore/_qs.py | 150 ++ src/gcore/_resource.py | 43 + src/gcore/_response.py | 830 +++++++ src/gcore/_streaming.py | 333 +++ src/gcore/_types.py | 217 ++ src/gcore/_utils/__init__.py | 57 + src/gcore/_utils/_logs.py | 25 + src/gcore/_utils/_proxy.py | 62 + src/gcore/_utils/_reflection.py | 42 + src/gcore/_utils/_streams.py | 12 + src/gcore/_utils/_sync.py | 86 + src/gcore/_utils/_transform.py | 402 ++++ src/gcore/_utils/_typing.py | 149 ++ src/gcore/_utils/_utils.py | 414 ++++ src/gcore/_version.py | 4 + src/gcore/lib/.keep | 4 + src/gcore/pagination.py | 70 + src/gcore/py.typed | 0 src/gcore/resources/__init__.py | 19 + src/gcore/resources/cloud/__init__.py | 19 + src/gcore/resources/cloud/cloud.py | 102 + .../resources/cloud/projects/__init__.py | 33 + .../resources/cloud/projects/projects.py | 102 + src/gcore/resources/cloud/projects/v1.py | 595 +++++ src/gcore/types/__init__.py | 3 + src/gcore/types/cloud/__init__.py | 3 + src/gcore/types/cloud/projects/__init__.py | 10 + src/gcore/types/cloud/projects/project.py | 43 + .../types/cloud/projects/v1_create_params.py | 22 + .../cloud/projects/v1_delete_response.py | 12 + .../types/cloud/projects/v1_list_params.py | 22 + .../types/cloud/projects/v1_list_response.py | 16 + .../types/cloud/projects/v1_update_params.py | 18 + tests/__init__.py | 1 + tests/api_resources/__init__.py | 1 + tests/api_resources/cloud/__init__.py | 1 + .../api_resources/cloud/projects/__init__.py | 1 + tests/api_resources/cloud/projects/test_v1.py | 388 ++++ tests/conftest.py | 51 + tests/sample_file.txt | 1 + tests/test_client.py | 1662 ++++++++++++++ tests/test_deepcopy.py | 58 + tests/test_extract_files.py | 64 + tests/test_files.py | 51 + tests/test_models.py | 888 ++++++++ tests/test_qs.py | 78 + tests/test_required_args.py | 111 + tests/test_response.py | 277 +++ tests/test_streaming.py | 248 +++ tests/test_transform.py | 434 ++++ tests/test_utils/test_proxy.py | 23 + tests/test_utils/test_typing.py | 73 + tests/utils.py | 159 ++ 86 files changed, 13864 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 .python-version create mode 100644 .stats.yml create mode 100644 Brewfile create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 SECURITY.md create mode 100644 api.md create mode 100644 bin/publish-pypi create mode 100644 examples/.keep create mode 100644 mypy.ini create mode 100644 noxfile.py create mode 100644 pyproject.toml create mode 100644 requirements-dev.lock create mode 100644 requirements.lock create mode 100755 scripts/bootstrap create mode 100755 scripts/format create mode 100755 scripts/lint create mode 100755 scripts/mock create mode 100755 scripts/test create mode 100644 scripts/utils/ruffen-docs.py create mode 100644 src/gcore/__init__.py create mode 100644 src/gcore/_base_client.py create mode 100644 src/gcore/_client.py create mode 100644 src/gcore/_compat.py create mode 100644 src/gcore/_constants.py create mode 100644 src/gcore/_exceptions.py create mode 100644 src/gcore/_files.py create mode 100644 src/gcore/_models.py create mode 100644 src/gcore/_qs.py create mode 100644 src/gcore/_resource.py create mode 100644 src/gcore/_response.py create mode 100644 src/gcore/_streaming.py create mode 100644 src/gcore/_types.py create mode 100644 src/gcore/_utils/__init__.py create mode 100644 src/gcore/_utils/_logs.py create mode 100644 src/gcore/_utils/_proxy.py create mode 100644 src/gcore/_utils/_reflection.py create mode 100644 src/gcore/_utils/_streams.py create mode 100644 src/gcore/_utils/_sync.py create mode 100644 src/gcore/_utils/_transform.py create mode 100644 src/gcore/_utils/_typing.py create mode 100644 src/gcore/_utils/_utils.py create mode 100644 src/gcore/_version.py create mode 100644 src/gcore/lib/.keep create mode 100644 src/gcore/pagination.py create mode 100644 src/gcore/py.typed create mode 100644 src/gcore/resources/__init__.py create mode 100644 src/gcore/resources/cloud/__init__.py create mode 100644 src/gcore/resources/cloud/cloud.py create mode 100644 src/gcore/resources/cloud/projects/__init__.py create mode 100644 src/gcore/resources/cloud/projects/projects.py create mode 100644 src/gcore/resources/cloud/projects/v1.py create mode 100644 src/gcore/types/__init__.py create mode 100644 src/gcore/types/cloud/__init__.py create mode 100644 src/gcore/types/cloud/projects/__init__.py create mode 100644 src/gcore/types/cloud/projects/project.py create mode 100644 src/gcore/types/cloud/projects/v1_create_params.py create mode 100644 src/gcore/types/cloud/projects/v1_delete_response.py create mode 100644 src/gcore/types/cloud/projects/v1_list_params.py create mode 100644 src/gcore/types/cloud/projects/v1_list_response.py create mode 100644 src/gcore/types/cloud/projects/v1_update_params.py create mode 100644 tests/__init__.py create mode 100644 tests/api_resources/__init__.py create mode 100644 tests/api_resources/cloud/__init__.py create mode 100644 tests/api_resources/cloud/projects/__init__.py create mode 100644 tests/api_resources/cloud/projects/test_v1.py create mode 100644 tests/conftest.py create mode 100644 tests/sample_file.txt create mode 100644 tests/test_client.py create mode 100644 tests/test_deepcopy.py create mode 100644 tests/test_extract_files.py create mode 100644 tests/test_files.py create mode 100644 tests/test_models.py create mode 100644 tests/test_qs.py create mode 100644 tests/test_required_args.py create mode 100644 tests/test_response.py create mode 100644 tests/test_streaming.py create mode 100644 tests/test_transform.py create mode 100644 tests/test_utils/test_proxy.py create mode 100644 tests/test_utils/test_typing.py create mode 100644 tests/utils.py diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..ff261bad --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,9 @@ +ARG VARIANT="3.9" +FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} + +USER vscode + +RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash +ENV PATH=/home/vscode/.rye/shims:$PATH + +RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..c17fdc16 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,43 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "Debian", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + + "postStartCommand": "rye sync --all-features", + + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python" + ], + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "python.pythonPath": ".venv/bin/python", + "python.defaultInterpreterPath": ".venv/bin/python", + "python.typeChecking": "basic", + "terminal.integrated.env.linux": { + "PATH": "/home/vscode/.rye/shims:${env:PATH}" + } + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": {} + } + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..3b286e5a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: CI +on: + push: + branches: + - main + pull_request: + branches: + - main + - next + +jobs: + lint: + name: lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Install dependencies + run: rye sync --all-features + + - name: Run lints + run: ./scripts/lint + + test: + name: test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Bootstrap + run: ./scripts/bootstrap + + - name: Run tests + run: ./scripts/test diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..87797408 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +.prism.log +.vscode +_dev + +__pycache__ +.mypy_cache + +dist + +.venv +.idea + +.env +.envrc +codegen.log +Brewfile.lock.json diff --git a/.python-version b/.python-version new file mode 100644 index 00000000..43077b24 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.9.18 diff --git a/.stats.yml b/.stats.yml new file mode 100644 index 00000000..14063489 --- /dev/null +++ b/.stats.yml @@ -0,0 +1,4 @@ +configured_endpoints: 5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c1c67b7326d84207f233f2bd8c7d0b3c1ed0f263f81344fbd870819755e153ec.yml +openapi_spec_hash: 1c861e8bc6b94f1581dda1cbee26b993 +config_hash: 4b4b836542416f7495a04af8937cc7fa diff --git a/Brewfile b/Brewfile new file mode 100644 index 00000000..492ca37b --- /dev/null +++ b/Brewfile @@ -0,0 +1,2 @@ +brew "rye" + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..cfcb4570 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,129 @@ +## Setting up the environment + +### With Rye + +We use [Rye](https://rye.astral.sh/) to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run: + +```sh +$ ./scripts/bootstrap +``` + +Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run: + +```sh +$ rye sync --all-features +``` + +You can then run scripts using `rye run python script.py` or by activating the virtual environment: + +```sh +$ rye shell +# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work +$ source .venv/bin/activate + +# now you can omit the `rye run` prefix +$ python script.py +``` + +### Without Rye + +Alternatively if you don't want to install `Rye`, you can stick with the standard `pip` setup by ensuring you have the Python version specified in `.python-version`, create a virtual environment however you desire and then install dependencies using this command: + +```sh +$ pip install -r requirements-dev.lock +``` + +## Modifying/Adding code + +Most of the SDK is generated code. Modifications to code will be persisted between generations, but may +result in merge conflicts between manual patches and changes from the generator. The generator will never +modify the contents of the `src/gcore/lib/` and `examples/` directories. + +## Adding and running examples + +All files in the `examples/` directory are not modified by the generator and can be freely edited or added to. + +```py +# add an example to examples/.py + +#!/usr/bin/env -S rye run python +… +``` + +```sh +$ chmod +x examples/.py +# run the example against your api +$ ./examples/.py +``` + +## Using the repository from source + +If you’d like to use the repository from source, you can either install from git or link to a cloned repository: + +To install via git: + +```sh +$ pip install git+ssh://git@github.com/stainless-sdks/gcore-python.git +``` + +Alternatively, you can build from source and install the wheel file: + +Building this package will create two files in the `dist/` directory, a `.tar.gz` containing the source files and a `.whl` that can be used to install the package efficiently. + +To create a distributable version of the library, all you have to do is run this command: + +```sh +$ rye build +# or +$ python -m build +``` + +Then to install: + +```sh +$ pip install ./path-to-wheel-file.whl +``` + +## Running tests + +Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. + +```sh +# you will need npm installed +$ npx prism mock path/to/your/openapi.yml +``` + +```sh +$ ./scripts/test +``` + +## Linting and formatting + +This repository uses [ruff](https://github.com/astral-sh/ruff) and +[black](https://github.com/psf/black) to format the code in the repository. + +To lint: + +```sh +$ ./scripts/lint +``` + +To format and fix all ruff issues automatically: + +```sh +$ ./scripts/format +``` + +## Publishing and releases + +Changes made to this repository via the automated release PR pipeline should publish to PyPI automatically. If +the changes aren't made through the automated pipeline, you may want to make releases manually. + +### Publish with a GitHub workflow + +You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/stainless-sdks/gcore-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. + +### Publish manually + +If you need to manually release a package, you can run the `bin/publish-pypi` script with a `PYPI_TOKEN` set on +the environment. diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..b28d04ff --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2025 Gcore + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 6043a36e..185ee503 100644 --- a/README.md +++ b/README.md @@ -1 +1,348 @@ -# gcore-python \ No newline at end of file +# Gcore Python API library + +[![PyPI version](https://img.shields.io/pypi/v/gcore.svg)](https://pypi.org/project/gcore/) + +The Gcore Python library provides convenient access to the Gcore REST API from any Python 3.8+ +application. The library includes type definitions for all request params and response fields, +and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). + +It is generated with [Stainless](https://www.stainless.com/). + +## Documentation + +The REST API documentation can be found on [docs.gcore.com](https://docs.gcore.com). The full API of this library can be found in [api.md](api.md). + +## Installation + +```sh +# install from this staging repo +pip install git+ssh://git@github.com/stainless-sdks/gcore-python.git +``` + +> [!NOTE] +> Once this package is [published to PyPI](https://app.stainless.com/docs/guides/publish), this will become: `pip install --pre gcore` + +## Usage + +The full API of this library can be found in [api.md](api.md). + +```python +import os +from gcore import Gcore + +client = Gcore( + api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted +) + +project = client.cloud.projects.v1.create( + name="New Project", +) +print(project.id) +``` + +While you can provide an `api_key` keyword argument, +we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/) +to add `GCORE_API_KEY="My API Key"` to your `.env` file +so that your API Key is not stored in source control. + +## Async usage + +Simply import `AsyncGcore` instead of `Gcore` and use `await` with each API call: + +```python +import os +import asyncio +from gcore import AsyncGcore + +client = AsyncGcore( + api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted +) + + +async def main() -> None: + project = await client.cloud.projects.v1.create( + name="New Project", + ) + print(project.id) + + +asyncio.run(main()) +``` + +Functionality between the synchronous and asynchronous clients is otherwise identical. + +## Using types + +Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like: + +- Serializing back into JSON, `model.to_json()` +- Converting to a dictionary, `model.to_dict()` + +Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`. + +## Handling errors + +When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `gcore.APIConnectionError` is raised. + +When the API returns a non-success status code (that is, 4xx or 5xx +response), a subclass of `gcore.APIStatusError` is raised, containing `status_code` and `response` properties. + +All errors inherit from `gcore.APIError`. + +```python +import gcore +from gcore import Gcore + +client = Gcore() + +try: + client.cloud.projects.v1.create( + name="New Project", + ) +except gcore.APIConnectionError as e: + print("The server could not be reached") + print(e.__cause__) # an underlying Exception, likely raised within httpx. +except gcore.RateLimitError as e: + print("A 429 status code was received; we should back off a bit.") +except gcore.APIStatusError as e: + print("Another non-200-range status code was received") + print(e.status_code) + print(e.response) +``` + +Error codes are as follows: + +| Status Code | Error Type | +| ----------- | -------------------------- | +| 400 | `BadRequestError` | +| 401 | `AuthenticationError` | +| 403 | `PermissionDeniedError` | +| 404 | `NotFoundError` | +| 422 | `UnprocessableEntityError` | +| 429 | `RateLimitError` | +| >=500 | `InternalServerError` | +| N/A | `APIConnectionError` | + +### Retries + +Certain errors are automatically retried 2 times by default, with a short exponential backoff. +Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, +429 Rate Limit, and >=500 Internal errors are all retried by default. + +You can use the `max_retries` option to configure or disable retry settings: + +```python +from gcore import Gcore + +# Configure the default for all requests: +client = Gcore( + # default is 2 + max_retries=0, +) + +# Or, configure per-request: +client.with_options(max_retries=5).cloud.projects.v1.create( + name="New Project", +) +``` + +### Timeouts + +By default requests time out after 1 minute. You can configure this with a `timeout` option, +which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object: + +```python +from gcore import Gcore + +# Configure the default for all requests: +client = Gcore( + # 20 seconds (default is 1 minute) + timeout=20.0, +) + +# More granular control: +client = Gcore( + timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0), +) + +# Override per-request: +client.with_options(timeout=5.0).cloud.projects.v1.create( + name="New Project", +) +``` + +On timeout, an `APITimeoutError` is thrown. + +Note that requests that time out are [retried twice by default](#retries). + +## Advanced + +### Logging + +We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module. + +You can enable logging by setting the environment variable `GCORE_LOG` to `info`. + +```shell +$ export GCORE_LOG=info +``` + +Or to `debug` for more verbose logging. + +### How to tell whether `None` means `null` or missing + +In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`: + +```py +if response.my_field is None: + if 'my_field' not in response.model_fields_set: + print('Got json like {}, without a "my_field" key present at all.') + else: + print('Got json like {"my_field": null}.') +``` + +### Accessing raw response data (e.g. headers) + +The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g., + +```py +from gcore import Gcore + +client = Gcore() +response = client.cloud.projects.v1.with_raw_response.create( + name="New Project", +) +print(response.headers.get('X-My-Header')) + +v1 = response.parse() # get the object that `cloud.projects.v1.create()` would have returned +print(v1.id) +``` + +These methods return an [`APIResponse`](https://github.com/stainless-sdks/gcore-python/tree/main/src/gcore/_response.py) object. + +The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/gcore-python/tree/main/src/gcore/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. + +#### `.with_streaming_response` + +The above interface eagerly reads the full response body when you make the request, which may not always be what you want. + +To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods. + +```python +with client.cloud.projects.v1.with_streaming_response.create( + name="New Project", +) as response: + print(response.headers.get("X-My-Header")) + + for line in response.iter_lines(): + print(line) +``` + +The context manager is required so that the response will reliably be closed. + +### Making custom/undocumented requests + +This library is typed for convenient access to the documented API. + +If you need to access undocumented endpoints, params, or response properties, the library can still be used. + +#### Undocumented endpoints + +To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other +http verbs. Options on the client will be respected (such as retries) when making this request. + +```py +import httpx + +response = client.post( + "/foo", + cast_to=httpx.Response, + body={"my_param": True}, +) + +print(response.headers.get("x-foo")) +``` + +#### Undocumented request params + +If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request +options. + +#### Undocumented response properties + +To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You +can also get all the extra fields on the Pydantic model as a dict with +[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra). + +### Configuring the HTTP client + +You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including: + +- Support for [proxies](https://www.python-httpx.org/advanced/proxies/) +- Custom [transports](https://www.python-httpx.org/advanced/transports/) +- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality + +```python +import httpx +from gcore import Gcore, DefaultHttpxClient + +client = Gcore( + # Or use the `GCORE_BASE_URL` env var + base_url="http://my.test.server.example.com:8083", + http_client=DefaultHttpxClient( + proxy="http://my.test.proxy.example.com", + transport=httpx.HTTPTransport(local_address="0.0.0.0"), + ), +) +``` + +You can also customize the client on a per-request basis by using `with_options()`: + +```python +client.with_options(http_client=DefaultHttpxClient(...)) +``` + +### Managing HTTP resources + +By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting. + +```py +from gcore import Gcore + +with Gcore() as client: + # make requests here + ... + +# HTTP client is now closed +``` + +## Versioning + +This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: + +1. Changes that only affect static types, without breaking runtime behavior. +2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_ +3. Changes that we do not expect to impact the vast majority of users in practice. + +We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. + +We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/gcore-python/issues) with questions, bugs, or suggestions. + +### Determining the installed version + +If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version. + +You can determine the version that is being used at runtime with: + +```py +import gcore +print(gcore.__version__) +``` + +## Requirements + +Python 3.8 or higher. + +## Contributing + +See [the contributing documentation](./CONTRIBUTING.md). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..a3db2db2 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,27 @@ +# Security Policy + +## Reporting Security Issues + +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. + +To report a security issue, please contact the Stainless team at security@stainless.com. + +## Responsible Disclosure + +We appreciate the efforts of security researchers and individuals who help us maintain the security of +SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible +disclosure practices by allowing us a reasonable amount of time to investigate and address the issue +before making any information public. + +## Reporting Non-SDK Related Security Issues + +If you encounter security issues that are not directly related to SDKs but pertain to the services +or products provided by Gcore please follow the respective company's security reporting guidelines. + +### Gcore Terms and Policies + +Please contact dev-feedback@gcore.com for any questions or concerns regarding security of our services. + +--- + +Thank you for helping us keep the SDKs and systems they interact with secure. diff --git a/api.md b/api.md new file mode 100644 index 00000000..ad30033d --- /dev/null +++ b/api.md @@ -0,0 +1,19 @@ +# Cloud + +## Projects + +### V1 + +Types: + +```python +from gcore.types.cloud.projects import Project, V1ListResponse, V1DeleteResponse +``` + +Methods: + +- client.cloud.projects.v1.create(\*\*params) -> Project +- client.cloud.projects.v1.retrieve(\*, project_id) -> Project +- client.cloud.projects.v1.update(\*, project_id, \*\*params) -> Project +- client.cloud.projects.v1.list(\*\*params) -> V1ListResponse +- client.cloud.projects.v1.delete(\*, project_id) -> V1DeleteResponse diff --git a/bin/publish-pypi b/bin/publish-pypi new file mode 100644 index 00000000..826054e9 --- /dev/null +++ b/bin/publish-pypi @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -eux +mkdir -p dist +rye build --clean +rye publish --yes --token=$PYPI_TOKEN diff --git a/examples/.keep b/examples/.keep new file mode 100644 index 00000000..d8c73e93 --- /dev/null +++ b/examples/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store example files demonstrating usage of this SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 00000000..1ee5b556 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,50 @@ +[mypy] +pretty = True +show_error_codes = True + +# Exclude _files.py because mypy isn't smart enough to apply +# the correct type narrowing and as this is an internal module +# it's fine to just use Pyright. +# +# We also exclude our `tests` as mypy doesn't always infer +# types correctly and Pyright will still catch any type errors. +exclude = ^(src/gcore/_files\.py|_dev/.*\.py|tests/.*)$ + +strict_equality = True +implicit_reexport = True +check_untyped_defs = True +no_implicit_optional = True + +warn_return_any = True +warn_unreachable = True +warn_unused_configs = True + +# Turn these options off as it could cause conflicts +# with the Pyright options. +warn_unused_ignores = False +warn_redundant_casts = False + +disallow_any_generics = True +disallow_untyped_defs = True +disallow_untyped_calls = True +disallow_subclassing_any = True +disallow_incomplete_defs = True +disallow_untyped_decorators = True +cache_fine_grained = True + +# By default, mypy reports an error if you assign a value to the result +# of a function call that doesn't return anything. We do this in our test +# cases: +# ``` +# result = ... +# assert result is None +# ``` +# Changing this codegen to make mypy happy would increase complexity +# and would not be worth it. +disable_error_code = func-returns-value,overload-cannot-match + +# https://github.com/python/mypy/issues/12162 +[mypy.overrides] +module = "black.files.*" +ignore_errors = true +ignore_missing_imports = true diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 00000000..53bca7ff --- /dev/null +++ b/noxfile.py @@ -0,0 +1,9 @@ +import nox + + +@nox.session(reuse_venv=True, name="test-pydantic-v1") +def test_pydantic_v1(session: nox.Session) -> None: + session.install("-r", "requirements-dev.lock") + session.install("pydantic<2") + + session.run("pytest", "--showlocals", "--ignore=tests/functional", *session.posargs) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e5401579 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,206 @@ +[project] +name = "gcore" +version = "0.0.1-alpha.0" +description = "The official Python library for the gcore API" +dynamic = ["readme"] +license = "Apache-2.0" +authors = [ +{ name = "Gcore", email = "dev-feedback@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", +] +requires-python = ">= 3.8" +classifiers = [ + "Typing :: Typed", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Operating System :: OS Independent", + "Operating System :: POSIX", + "Operating System :: MacOS", + "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", + "Topic :: Software Development :: Libraries :: Python Modules", + "License :: OSI Approved :: Apache Software License" +] + +[project.urls] +Homepage = "https://github.com/stainless-sdks/gcore-python" +Repository = "https://github.com/stainless-sdks/gcore-python" + + +[tool.rye] +managed = true +# version pins are in requirements-dev.lock +dev-dependencies = [ + "pyright>=1.1.359", + "mypy", + "respx", + "pytest", + "pytest-asyncio", + "ruff", + "time-machine", + "nox", + "dirty-equals>=0.6.0", + "importlib-metadata>=6.7.0", + "rich>=13.7.1", + "nest_asyncio==1.6.0", +] + +[tool.rye.scripts] +format = { chain = [ + "format:ruff", + "format:docs", + "fix:ruff", + # run formatting again to fix any inconsistencies when imports are stripped + "format:ruff", +]} +"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md" +"format:ruff" = "ruff format" + +"lint" = { chain = [ + "check:ruff", + "typecheck", + "check:importable", +]} +"check:ruff" = "ruff check ." +"fix:ruff" = "ruff check --fix ." + +"check:importable" = "python -c 'import gcore'" + +typecheck = { chain = [ + "typecheck:pyright", + "typecheck:mypy" +]} +"typecheck:pyright" = "pyright" +"typecheck:verify-types" = "pyright --verifytypes gcore --ignoreexternal" +"typecheck:mypy" = "mypy ." + +[build-system] +requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"] +build-backend = "hatchling.build" + +[tool.hatch.build] +include = [ + "src/*" +] + +[tool.hatch.build.targets.wheel] +packages = ["src/gcore"] + +[tool.hatch.build.targets.sdist] +# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc) +include = [ + "/*.toml", + "/*.json", + "/*.lock", + "/*.md", + "/mypy.ini", + "/noxfile.py", + "bin/*", + "examples/*", + "src/*", + "tests/*", +] + +[tool.hatch.metadata.hooks.fancy-pypi-readme] +content-type = "text/markdown" + +[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]] +path = "README.md" + +[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] +# replace relative links with absolute links +pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' +replacement = '[\1](https://github.com/stainless-sdks/gcore-python/tree/main/\g<2>)' + +[tool.pytest.ini_options] +testpaths = ["tests"] +addopts = "--tb=short" +xfail_strict = true +asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "session" +filterwarnings = [ + "error" +] + +[tool.pyright] +# this enables practically every flag given by pyright. +# there are a couple of flags that are still disabled by +# default in strict mode as they are experimental and niche. +typeCheckingMode = "strict" +pythonVersion = "3.8" + +exclude = [ + "_dev", + ".venv", + ".nox", +] + +reportImplicitOverride = true + +reportImportCycles = false +reportPrivateUsage = false + +[tool.ruff] +line-length = 120 +output-format = "grouped" +target-version = "py37" + +[tool.ruff.format] +docstring-code-format = true + +[tool.ruff.lint] +select = [ + # isort + "I", + # bugbear rules + "B", + # remove unused imports + "F401", + # bare except statements + "E722", + # unused arguments + "ARG", + # print statements + "T201", + "T203", + # misuse of typing.TYPE_CHECKING + "TC004", + # import rules + "TID251", +] +ignore = [ + # mutable defaults + "B006", +] +unfixable = [ + # disable auto fix for print statements + "T201", + "T203", +] + +[tool.ruff.lint.flake8-tidy-imports.banned-api] +"functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead" + +[tool.ruff.lint.isort] +length-sort = true +length-sort-straight = true +combine-as-imports = true +extra-standard-library = ["typing_extensions"] +known-first-party = ["gcore", "tests"] + +[tool.ruff.lint.per-file-ignores] +"bin/**.py" = ["T201", "T203"] +"scripts/**.py" = ["T201", "T203"] +"tests/**.py" = ["T201", "T203"] +"examples/**.py" = ["T201", "T203"] diff --git a/requirements-dev.lock b/requirements-dev.lock new file mode 100644 index 00000000..0af8b6aa --- /dev/null +++ b/requirements-dev.lock @@ -0,0 +1,104 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: true +# with-sources: false +# generate-hashes: false +# universal: false + +-e file:. +annotated-types==0.6.0 + # via pydantic +anyio==4.4.0 + # via gcore + # via httpx +argcomplete==3.1.2 + # via nox +certifi==2023.7.22 + # via httpcore + # via httpx +colorlog==6.7.0 + # via nox +dirty-equals==0.6.0 +distlib==0.3.7 + # via virtualenv +distro==1.8.0 + # via gcore +exceptiongroup==1.2.2 + # via anyio + # via pytest +filelock==3.12.4 + # via virtualenv +h11==0.14.0 + # via httpcore +httpcore==1.0.2 + # via httpx +httpx==0.28.1 + # via gcore + # via respx +idna==3.4 + # via anyio + # via httpx +importlib-metadata==7.0.0 +iniconfig==2.0.0 + # via pytest +markdown-it-py==3.0.0 + # via rich +mdurl==0.1.2 + # via markdown-it-py +mypy==1.14.1 +mypy-extensions==1.0.0 + # via mypy +nest-asyncio==1.6.0 +nodeenv==1.8.0 + # via pyright +nox==2023.4.22 +packaging==23.2 + # via nox + # via pytest +platformdirs==3.11.0 + # via virtualenv +pluggy==1.5.0 + # via pytest +pydantic==2.10.3 + # via gcore +pydantic-core==2.27.1 + # via pydantic +pygments==2.18.0 + # via rich +pyright==1.1.392.post0 +pytest==8.3.3 + # via pytest-asyncio +pytest-asyncio==0.24.0 +python-dateutil==2.8.2 + # via time-machine +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 + # via python-dateutil +sniffio==1.3.0 + # via anyio + # via gcore +time-machine==2.9.0 +tomli==2.0.2 + # via mypy + # via pytest +typing-extensions==4.12.2 + # via anyio + # via gcore + # via mypy + # via pydantic + # via pydantic-core + # via pyright +virtualenv==20.24.5 + # via nox +zipp==3.17.0 + # via importlib-metadata diff --git a/requirements.lock b/requirements.lock new file mode 100644 index 00000000..97422010 --- /dev/null +++ b/requirements.lock @@ -0,0 +1,45 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: true +# with-sources: false +# generate-hashes: false +# universal: false + +-e file:. +annotated-types==0.6.0 + # via pydantic +anyio==4.4.0 + # via gcore + # via httpx +certifi==2023.7.22 + # via httpcore + # via httpx +distro==1.8.0 + # via gcore +exceptiongroup==1.2.2 + # via anyio +h11==0.14.0 + # via httpcore +httpcore==1.0.2 + # via httpx +httpx==0.28.1 + # via gcore +idna==3.4 + # via anyio + # via httpx +pydantic==2.10.3 + # via gcore +pydantic-core==2.27.1 + # via pydantic +sniffio==1.3.0 + # via anyio + # via gcore +typing-extensions==4.12.2 + # via anyio + # via gcore + # via pydantic + # via pydantic-core diff --git a/scripts/bootstrap b/scripts/bootstrap new file mode 100755 index 00000000..e84fe62c --- /dev/null +++ b/scripts/bootstrap @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then + brew bundle check >/dev/null 2>&1 || { + echo "==> Installing Homebrew dependencies…" + brew bundle + } +fi + +echo "==> Installing Python dependencies…" + +# experimental uv support makes installations significantly faster +rye config --set-bool behavior.use-uv=true + +rye sync --all-features diff --git a/scripts/format b/scripts/format new file mode 100755 index 00000000..667ec2d7 --- /dev/null +++ b/scripts/format @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +echo "==> Running formatters" +rye run format diff --git a/scripts/lint b/scripts/lint new file mode 100755 index 00000000..3bb2d385 --- /dev/null +++ b/scripts/lint @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +echo "==> Running lints" +rye run lint + +echo "==> Making sure it imports" +rye run python -c 'import gcore' diff --git a/scripts/mock b/scripts/mock new file mode 100755 index 00000000..d2814ae6 --- /dev/null +++ b/scripts/mock @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if [[ -n "$1" && "$1" != '--'* ]]; then + URL="$1" + shift +else + URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" +fi + +# Check if the URL is empty +if [ -z "$URL" ]; then + echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" + exit 1 +fi + +echo "==> Starting mock server with URL ${URL}" + +# Run prism mock on the given spec +if [ "$1" == "--daemon" ]; then + npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & + + # Wait for server to come online + echo -n "Waiting for server" + while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + echo -n "." + sleep 0.1 + done + + if grep -q "✖ fatal" ".prism.log"; then + cat .prism.log + exit 1 + fi + + echo +else + npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" +fi diff --git a/scripts/test b/scripts/test new file mode 100755 index 00000000..2b878456 --- /dev/null +++ b/scripts/test @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +function prism_is_running() { + curl --silent "http://localhost:4010" >/dev/null 2>&1 +} + +kill_server_on_port() { + pids=$(lsof -t -i tcp:"$1" || echo "") + if [ "$pids" != "" ]; then + kill "$pids" + echo "Stopped $pids." + fi +} + +function is_overriding_api_base_url() { + [ -n "$TEST_API_BASE_URL" ] +} + +if ! is_overriding_api_base_url && ! prism_is_running ; then + # When we exit this script, make sure to kill the background mock server process + trap 'kill_server_on_port 4010' EXIT + + # Start the dev server + ./scripts/mock --daemon +fi + +if is_overriding_api_base_url ; then + echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" + echo +elif ! prism_is_running ; then + echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" + echo -e "running against your OpenAPI spec." + echo + echo -e "To run the server, pass in the path or url of your OpenAPI" + echo -e "spec to the prism command:" + echo + echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}" + echo + + exit 1 +else + echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" + echo +fi + +export DEFER_PYDANTIC_BUILD=false + +echo "==> Running tests" +rye run pytest "$@" + +echo "==> Running Pydantic v1 tests" +rye run nox -s test-pydantic-v1 -- "$@" diff --git a/scripts/utils/ruffen-docs.py b/scripts/utils/ruffen-docs.py new file mode 100644 index 00000000..0cf2bd2f --- /dev/null +++ b/scripts/utils/ruffen-docs.py @@ -0,0 +1,167 @@ +# fork of https://github.com/asottile/blacken-docs adapted for ruff +from __future__ import annotations + +import re +import sys +import argparse +import textwrap +import contextlib +import subprocess +from typing import Match, Optional, Sequence, Generator, NamedTuple, cast + +MD_RE = re.compile( + r"(?P^(?P *)```\s*python\n)" r"(?P.*?)" r"(?P^(?P=indent)```\s*$)", + re.DOTALL | re.MULTILINE, +) +MD_PYCON_RE = re.compile( + r"(?P^(?P *)```\s*pycon\n)" r"(?P.*?)" r"(?P^(?P=indent)```.*$)", + re.DOTALL | re.MULTILINE, +) +PYCON_PREFIX = ">>> " +PYCON_CONTINUATION_PREFIX = "..." +PYCON_CONTINUATION_RE = re.compile( + rf"^{re.escape(PYCON_CONTINUATION_PREFIX)}( |$)", +) +DEFAULT_LINE_LENGTH = 100 + + +class CodeBlockError(NamedTuple): + offset: int + exc: Exception + + +def format_str( + src: str, +) -> tuple[str, Sequence[CodeBlockError]]: + errors: list[CodeBlockError] = [] + + @contextlib.contextmanager + def _collect_error(match: Match[str]) -> Generator[None, None, None]: + try: + yield + except Exception as e: + errors.append(CodeBlockError(match.start(), e)) + + def _md_match(match: Match[str]) -> str: + code = textwrap.dedent(match["code"]) + with _collect_error(match): + code = format_code_block(code) + code = textwrap.indent(code, match["indent"]) + return f"{match['before']}{code}{match['after']}" + + def _pycon_match(match: Match[str]) -> str: + code = "" + fragment = cast(Optional[str], None) + + def finish_fragment() -> None: + nonlocal code + nonlocal fragment + + if fragment is not None: + with _collect_error(match): + fragment = format_code_block(fragment) + fragment_lines = fragment.splitlines() + code += f"{PYCON_PREFIX}{fragment_lines[0]}\n" + for line in fragment_lines[1:]: + # Skip blank lines to handle Black adding a blank above + # functions within blocks. A blank line would end the REPL + # continuation prompt. + # + # >>> if True: + # ... def f(): + # ... pass + # ... + if line: + code += f"{PYCON_CONTINUATION_PREFIX} {line}\n" + if fragment_lines[-1].startswith(" "): + code += f"{PYCON_CONTINUATION_PREFIX}\n" + fragment = None + + indentation = None + for line in match["code"].splitlines(): + orig_line, line = line, line.lstrip() + if indentation is None and line: + indentation = len(orig_line) - len(line) + continuation_match = PYCON_CONTINUATION_RE.match(line) + if continuation_match and fragment is not None: + fragment += line[continuation_match.end() :] + "\n" + else: + finish_fragment() + if line.startswith(PYCON_PREFIX): + fragment = line[len(PYCON_PREFIX) :] + "\n" + else: + code += orig_line[indentation:] + "\n" + finish_fragment() + return code + + def _md_pycon_match(match: Match[str]) -> str: + code = _pycon_match(match) + code = textwrap.indent(code, match["indent"]) + return f"{match['before']}{code}{match['after']}" + + src = MD_RE.sub(_md_match, src) + src = MD_PYCON_RE.sub(_md_pycon_match, src) + return src, errors + + +def format_code_block(code: str) -> str: + return subprocess.check_output( + [ + sys.executable, + "-m", + "ruff", + "format", + "--stdin-filename=script.py", + f"--line-length={DEFAULT_LINE_LENGTH}", + ], + encoding="utf-8", + input=code, + ) + + +def format_file( + filename: str, + skip_errors: bool, +) -> int: + with open(filename, encoding="UTF-8") as f: + contents = f.read() + new_contents, errors = format_str(contents) + for error in errors: + lineno = contents[: error.offset].count("\n") + 1 + print(f"{filename}:{lineno}: code block parse error {error.exc}") + if errors and not skip_errors: + return 1 + if contents != new_contents: + print(f"{filename}: Rewriting...") + with open(filename, "w", encoding="UTF-8") as f: + f.write(new_contents) + return 0 + else: + return 0 + + +def main(argv: Sequence[str] | None = None) -> int: + parser = argparse.ArgumentParser() + parser.add_argument( + "-l", + "--line-length", + type=int, + default=DEFAULT_LINE_LENGTH, + ) + parser.add_argument( + "-S", + "--skip-string-normalization", + action="store_true", + ) + parser.add_argument("-E", "--skip-errors", action="store_true") + parser.add_argument("filenames", nargs="*") + args = parser.parse_args(argv) + + retv = 0 + for filename in args.filenames: + retv |= format_file(filename, skip_errors=args.skip_errors) + return retv + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/src/gcore/__init__.py b/src/gcore/__init__.py new file mode 100644 index 00000000..1cfb892f --- /dev/null +++ b/src/gcore/__init__.py @@ -0,0 +1,84 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from . import types +from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes +from ._utils import file_from_path +from ._client import Gcore, Client, Stream, Timeout, Transport, AsyncGcore, AsyncClient, AsyncStream, RequestOptions +from ._models import BaseModel +from ._version import __title__, __version__ +from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse +from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS +from ._exceptions import ( + APIError, + GcoreError, + ConflictError, + NotFoundError, + APIStatusError, + RateLimitError, + APITimeoutError, + BadRequestError, + APIConnectionError, + AuthenticationError, + InternalServerError, + PermissionDeniedError, + UnprocessableEntityError, + APIResponseValidationError, +) +from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient +from ._utils._logs import setup_logging as _setup_logging + +__all__ = [ + "types", + "__version__", + "__title__", + "NoneType", + "Transport", + "ProxiesTypes", + "NotGiven", + "NOT_GIVEN", + "Omit", + "GcoreError", + "APIError", + "APIStatusError", + "APITimeoutError", + "APIConnectionError", + "APIResponseValidationError", + "BadRequestError", + "AuthenticationError", + "PermissionDeniedError", + "NotFoundError", + "ConflictError", + "UnprocessableEntityError", + "RateLimitError", + "InternalServerError", + "Timeout", + "RequestOptions", + "Client", + "AsyncClient", + "Stream", + "AsyncStream", + "Gcore", + "AsyncGcore", + "file_from_path", + "BaseModel", + "DEFAULT_TIMEOUT", + "DEFAULT_MAX_RETRIES", + "DEFAULT_CONNECTION_LIMITS", + "DefaultHttpxClient", + "DefaultAsyncHttpxClient", +] + +_setup_logging() + +# Update the __module__ attribute for exported symbols so that +# error messages point to this module instead of the module +# it was originally defined in, e.g. +# gcore._exceptions.NotFoundError -> gcore.NotFoundError +__locals = locals() +for __name in __all__: + if not __name.startswith("__"): + try: + __locals[__name].__module__ = "gcore" + except (TypeError, AttributeError): + # Some of our exported symbols are builtins which we can't set attributes for. + pass diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py new file mode 100644 index 00000000..129fc3eb --- /dev/null +++ b/src/gcore/_base_client.py @@ -0,0 +1,1969 @@ +from __future__ import annotations + +import sys +import json +import time +import uuid +import email +import asyncio +import inspect +import logging +import platform +import email.utils +from types import TracebackType +from random import random +from typing import ( + TYPE_CHECKING, + Any, + Dict, + Type, + Union, + Generic, + Mapping, + TypeVar, + Iterable, + Iterator, + Optional, + Generator, + AsyncIterator, + cast, + overload, +) +from typing_extensions import Literal, override, get_origin + +import anyio +import httpx +import distro +import pydantic +from httpx import URL +from pydantic import PrivateAttr + +from . import _exceptions +from ._qs import Querystring +from ._files import to_httpx_files, async_to_httpx_files +from ._types import ( + NOT_GIVEN, + Body, + Omit, + Query, + Headers, + Timeout, + NotGiven, + ResponseT, + AnyMapping, + PostParser, + RequestFiles, + HttpxSendArgs, + RequestOptions, + HttpxRequestFiles, + ModelBuilderProtocol, +) +from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping +from ._compat import PYDANTIC_V2, model_copy, model_dump +from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type +from ._response import ( + APIResponse, + BaseAPIResponse, + AsyncAPIResponse, + extract_response_type, +) +from ._constants import ( + DEFAULT_TIMEOUT, + MAX_RETRY_DELAY, + DEFAULT_MAX_RETRIES, + INITIAL_RETRY_DELAY, + RAW_RESPONSE_HEADER, + OVERRIDE_CAST_TO_HEADER, + DEFAULT_CONNECTION_LIMITS, +) +from ._streaming import Stream, SSEDecoder, AsyncStream, SSEBytesDecoder +from ._exceptions import ( + APIStatusError, + APITimeoutError, + APIConnectionError, + APIResponseValidationError, +) + +log: logging.Logger = logging.getLogger(__name__) + +# TODO: make base page type vars covariant +SyncPageT = TypeVar("SyncPageT", bound="BaseSyncPage[Any]") +AsyncPageT = TypeVar("AsyncPageT", bound="BaseAsyncPage[Any]") + + +_T = TypeVar("_T") +_T_co = TypeVar("_T_co", covariant=True) + +_StreamT = TypeVar("_StreamT", bound=Stream[Any]) +_AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any]) + +if TYPE_CHECKING: + from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT +else: + try: + from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT + except ImportError: + # taken from https://github.com/encode/httpx/blob/3ba5fe0d7ac70222590e759c31442b1cab263791/httpx/_config.py#L366 + HTTPX_DEFAULT_TIMEOUT = Timeout(5.0) + + +class PageInfo: + """Stores the necessary information to build the request to retrieve the next page. + + Either `url` or `params` must be set. + """ + + url: URL | NotGiven + params: Query | NotGiven + + @overload + def __init__( + self, + *, + url: URL, + ) -> None: ... + + @overload + def __init__( + self, + *, + params: Query, + ) -> None: ... + + def __init__( + self, + *, + url: URL | NotGiven = NOT_GIVEN, + params: Query | NotGiven = NOT_GIVEN, + ) -> None: + self.url = url + self.params = params + + @override + def __repr__(self) -> str: + if self.url: + return f"{self.__class__.__name__}(url={self.url})" + return f"{self.__class__.__name__}(params={self.params})" + + +class BasePage(GenericModel, Generic[_T]): + """ + Defines the core interface for pagination. + + Type Args: + ModelT: The pydantic model that represents an item in the response. + + Methods: + has_next_page(): Check if there is another page available + next_page_info(): Get the necessary information to make a request for the next page + """ + + _options: FinalRequestOptions = PrivateAttr() + _model: Type[_T] = PrivateAttr() + + def has_next_page(self) -> bool: + items = self._get_page_items() + if not items: + return False + return self.next_page_info() is not None + + def next_page_info(self) -> Optional[PageInfo]: ... + + def _get_page_items(self) -> Iterable[_T]: # type: ignore[empty-body] + ... + + def _params_from_url(self, url: URL) -> httpx.QueryParams: + # TODO: do we have to preprocess params here? + return httpx.QueryParams(cast(Any, self._options.params)).merge(url.params) + + def _info_to_options(self, info: PageInfo) -> FinalRequestOptions: + options = model_copy(self._options) + options._strip_raw_response_header() + + if not isinstance(info.params, NotGiven): + options.params = {**options.params, **info.params} + return options + + if not isinstance(info.url, NotGiven): + params = self._params_from_url(info.url) + url = info.url.copy_with(params=params) + options.params = dict(url.params) + options.url = str(url) + return options + + raise ValueError("Unexpected PageInfo state") + + +class BaseSyncPage(BasePage[_T], Generic[_T]): + _client: SyncAPIClient = pydantic.PrivateAttr() + + def _set_private_attributes( + self, + client: SyncAPIClient, + model: Type[_T], + options: FinalRequestOptions, + ) -> None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + + self._model = model + self._client = client + self._options = options + + # Pydantic uses a custom `__iter__` method to support casting BaseModels + # to dictionaries. e.g. dict(model). + # As we want to support `for item in page`, this is inherently incompatible + # with the default pydantic behaviour. It is not possible to support both + # use cases at once. Fortunately, this is not a big deal as all other pydantic + # methods should continue to work as expected as there is an alternative method + # to cast a model to a dictionary, model.dict(), which is used internally + # by pydantic. + def __iter__(self) -> Iterator[_T]: # type: ignore + for page in self.iter_pages(): + for item in page._get_page_items(): + yield item + + def iter_pages(self: SyncPageT) -> Iterator[SyncPageT]: + page = self + while True: + yield page + if page.has_next_page(): + page = page.get_next_page() + else: + return + + def get_next_page(self: SyncPageT) -> SyncPageT: + info = self.next_page_info() + if not info: + raise RuntimeError( + "No next page expected; please check `.has_next_page()` before calling `.get_next_page()`." + ) + + options = self._info_to_options(info) + return self._client._request_api_list(self._model, page=self.__class__, options=options) + + +class AsyncPaginator(Generic[_T, AsyncPageT]): + def __init__( + self, + client: AsyncAPIClient, + options: FinalRequestOptions, + page_cls: Type[AsyncPageT], + model: Type[_T], + ) -> None: + self._model = model + self._client = client + self._options = options + self._page_cls = page_cls + + def __await__(self) -> Generator[Any, None, AsyncPageT]: + return self._get_page().__await__() + + async def _get_page(self) -> AsyncPageT: + def _parser(resp: AsyncPageT) -> AsyncPageT: + resp._set_private_attributes( + model=self._model, + options=self._options, + client=self._client, + ) + return resp + + self._options.post_parser = _parser + + return await self._client.request(self._page_cls, self._options) + + async def __aiter__(self) -> AsyncIterator[_T]: + # https://github.com/microsoft/pyright/issues/3464 + page = cast( + AsyncPageT, + await self, # type: ignore + ) + async for item in page: + yield item + + +class BaseAsyncPage(BasePage[_T], Generic[_T]): + _client: AsyncAPIClient = pydantic.PrivateAttr() + + def _set_private_attributes( + self, + model: Type[_T], + client: AsyncAPIClient, + options: FinalRequestOptions, + ) -> None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + + self._model = model + self._client = client + self._options = options + + async def __aiter__(self) -> AsyncIterator[_T]: + async for page in self.iter_pages(): + for item in page._get_page_items(): + yield item + + async def iter_pages(self: AsyncPageT) -> AsyncIterator[AsyncPageT]: + page = self + while True: + yield page + if page.has_next_page(): + page = await page.get_next_page() + else: + return + + async def get_next_page(self: AsyncPageT) -> AsyncPageT: + info = self.next_page_info() + if not info: + raise RuntimeError( + "No next page expected; please check `.has_next_page()` before calling `.get_next_page()`." + ) + + options = self._info_to_options(info) + return await self._client._request_api_list(self._model, page=self.__class__, options=options) + + +_HttpxClientT = TypeVar("_HttpxClientT", bound=Union[httpx.Client, httpx.AsyncClient]) +_DefaultStreamT = TypeVar("_DefaultStreamT", bound=Union[Stream[Any], AsyncStream[Any]]) + + +class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]): + _client: _HttpxClientT + _version: str + _base_url: URL + max_retries: int + timeout: Union[float, Timeout, None] + _strict_response_validation: bool + _idempotency_header: str | None + _default_stream_cls: type[_DefaultStreamT] | None = None + + def __init__( + self, + *, + version: str, + base_url: str | URL, + _strict_response_validation: bool, + max_retries: int = DEFAULT_MAX_RETRIES, + timeout: float | Timeout | None = DEFAULT_TIMEOUT, + custom_headers: Mapping[str, str] | None = None, + custom_query: Mapping[str, object] | None = None, + ) -> None: + self._version = version + self._base_url = self._enforce_trailing_slash(URL(base_url)) + self.max_retries = max_retries + self.timeout = timeout + self._custom_headers = custom_headers or {} + self._custom_query = custom_query or {} + self._strict_response_validation = _strict_response_validation + self._idempotency_header = None + self._platform: Platform | None = None + + if max_retries is None: # pyright: ignore[reportUnnecessaryComparison] + raise TypeError( + "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `gcore.DEFAULT_MAX_RETRIES`" + ) + + def _enforce_trailing_slash(self, url: URL) -> URL: + if url.raw_path.endswith(b"/"): + return url + return url.copy_with(raw_path=url.raw_path + b"/") + + def _make_status_error_from_response( + self, + response: httpx.Response, + ) -> APIStatusError: + if response.is_closed and not response.is_stream_consumed: + # We can't read the response body as it has been closed + # before it was read. This can happen if an event hook + # raises a status error. + body = None + err_msg = f"Error code: {response.status_code}" + else: + err_text = response.text.strip() + body = err_text + + try: + body = json.loads(err_text) + err_msg = f"Error code: {response.status_code} - {body}" + except Exception: + err_msg = err_text or f"Error code: {response.status_code}" + + return self._make_status_error(err_msg, body=body, response=response) + + def _make_status_error( + self, + err_msg: str, + *, + body: object, + response: httpx.Response, + ) -> _exceptions.APIStatusError: + raise NotImplementedError() + + def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0) -> httpx.Headers: + custom_headers = options.headers or {} + headers_dict = _merge_mappings(self.default_headers, custom_headers) + self._validate_headers(headers_dict, custom_headers) + + # headers are case-insensitive while dictionaries are not. + headers = httpx.Headers(headers_dict) + + idempotency_header = self._idempotency_header + if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: + headers[idempotency_header] = options.idempotency_key or self._idempotency_key() + + # Don't set these headers if they were already set or removed by the caller. We check + # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. + lower_custom_headers = [header.lower() for header in custom_headers] + if "x-stainless-retry-count" not in lower_custom_headers: + headers["x-stainless-retry-count"] = str(retries_taken) + if "x-stainless-read-timeout" not in lower_custom_headers: + timeout = self.timeout if isinstance(options.timeout, NotGiven) else options.timeout + if isinstance(timeout, Timeout): + timeout = timeout.read + if timeout is not None: + headers["x-stainless-read-timeout"] = str(timeout) + + return headers + + def _prepare_url(self, url: str) -> URL: + """ + Merge a URL argument together with any 'base_url' on the client, + to create the URL used for the outgoing request. + """ + # Copied from httpx's `_merge_url` method. + merge_url = URL(url) + if merge_url.is_relative_url: + merge_raw_path = self.base_url.raw_path + merge_url.raw_path.lstrip(b"/") + return self.base_url.copy_with(raw_path=merge_raw_path) + + return merge_url + + def _make_sse_decoder(self) -> SSEDecoder | SSEBytesDecoder: + return SSEDecoder() + + def _build_request( + self, + options: FinalRequestOptions, + *, + retries_taken: int = 0, + ) -> httpx.Request: + if log.isEnabledFor(logging.DEBUG): + log.debug("Request options: %s", model_dump(options, exclude_unset=True)) + + kwargs: dict[str, Any] = {} + + json_data = options.json_data + if options.extra_json is not None: + if json_data is None: + json_data = cast(Body, options.extra_json) + elif is_mapping(json_data): + json_data = _merge_mappings(json_data, options.extra_json) + else: + raise RuntimeError(f"Unexpected JSON data type, {type(json_data)}, cannot merge with `extra_body`") + + headers = self._build_headers(options, retries_taken=retries_taken) + params = _merge_mappings(self.default_query, options.params) + content_type = headers.get("Content-Type") + files = options.files + + # If the given Content-Type header is multipart/form-data then it + # has to be removed so that httpx can generate the header with + # additional information for us as it has to be in this form + # for the server to be able to correctly parse the request: + # multipart/form-data; boundary=---abc-- + if content_type is not None and content_type.startswith("multipart/form-data"): + if "boundary" not in content_type: + # only remove the header if the boundary hasn't been explicitly set + # as the caller doesn't want httpx to come up with their own boundary + headers.pop("Content-Type") + + # As we are now sending multipart/form-data instead of application/json + # we need to tell httpx to use it, https://www.python-httpx.org/advanced/clients/#multipart-file-encoding + if json_data: + if not is_dict(json_data): + raise TypeError( + f"Expected query input to be a dictionary for multipart requests but got {type(json_data)} instead." + ) + kwargs["data"] = self._serialize_multipartform(json_data) + + # httpx determines whether or not to send a "multipart/form-data" + # request based on the truthiness of the "files" argument. + # This gets around that issue by generating a dict value that + # evaluates to true. + # + # https://github.com/encode/httpx/discussions/2399#discussioncomment-3814186 + if not files: + files = cast(HttpxRequestFiles, ForceMultipartDict()) + + prepared_url = self._prepare_url(options.url) + if "_" in prepared_url.host: + # work around https://github.com/encode/httpx/discussions/2880 + kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")} + + # TODO: report this error to httpx + return self._client.build_request( # pyright: ignore[reportUnknownMemberType] + headers=headers, + timeout=self.timeout if isinstance(options.timeout, NotGiven) else options.timeout, + method=options.method, + url=prepared_url, + # the `Query` type that we use is incompatible with qs' + # `Params` type as it needs to be typed as `Mapping[str, object]` + # so that passing a `TypedDict` doesn't cause an error. + # https://github.com/microsoft/pyright/issues/3526#event-6715453066 + params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None, + json=json_data if is_given(json_data) else None, + files=files, + **kwargs, + ) + + def _serialize_multipartform(self, data: Mapping[object, object]) -> dict[str, object]: + items = self.qs.stringify_items( + # TODO: type ignore is required as stringify_items is well typed but we can't be + # well typed without heavy validation. + data, # type: ignore + array_format="brackets", + ) + serialized: dict[str, object] = {} + for key, value in items: + existing = serialized.get(key) + + if not existing: + serialized[key] = value + continue + + # If a value has already been set for this key then that + # means we're sending data like `array[]=[1, 2, 3]` and we + # need to tell httpx that we want to send multiple values with + # the same key which is done by using a list or a tuple. + # + # Note: 2d arrays should never result in the same key at both + # levels so it's safe to assume that if the value is a list, + # it was because we changed it to be a list. + if is_list(existing): + existing.append(value) + else: + serialized[key] = [existing, value] + + return serialized + + def _maybe_override_cast_to(self, cast_to: type[ResponseT], options: FinalRequestOptions) -> type[ResponseT]: + if not is_given(options.headers): + return cast_to + + # make a copy of the headers so we don't mutate user-input + headers = dict(options.headers) + + # we internally support defining a temporary header to override the + # default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response` + # see _response.py for implementation details + override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, NOT_GIVEN) + if is_given(override_cast_to): + options.headers = headers + return cast(Type[ResponseT], override_cast_to) + + return cast_to + + def _should_stream_response_body(self, request: httpx.Request) -> bool: + return request.headers.get(RAW_RESPONSE_HEADER) == "stream" # type: ignore[no-any-return] + + def _process_response_data( + self, + *, + data: object, + cast_to: type[ResponseT], + response: httpx.Response, + ) -> ResponseT: + if data is None: + return cast(ResponseT, None) + + if cast_to is object: + return cast(ResponseT, data) + + try: + if inspect.isclass(cast_to) and issubclass(cast_to, ModelBuilderProtocol): + return cast(ResponseT, cast_to.build(response=response, data=data)) + + if self._strict_response_validation: + return cast(ResponseT, validate_type(type_=cast_to, value=data)) + + return cast(ResponseT, construct_type(type_=cast_to, value=data)) + except pydantic.ValidationError as err: + raise APIResponseValidationError(response=response, body=data) from err + + @property + def qs(self) -> Querystring: + return Querystring() + + @property + def custom_auth(self) -> httpx.Auth | None: + return None + + @property + def auth_headers(self) -> dict[str, str]: + return {} + + @property + def default_headers(self) -> dict[str, str | Omit]: + return { + "Accept": "application/json", + "Content-Type": "application/json", + "User-Agent": self.user_agent, + **self.platform_headers(), + **self.auth_headers, + **self._custom_headers, + } + + @property + def default_query(self) -> dict[str, object]: + return { + **self._custom_query, + } + + def _validate_headers( + self, + headers: Headers, # noqa: ARG002 + custom_headers: Headers, # noqa: ARG002 + ) -> None: + """Validate the given default headers and custom headers. + + Does nothing by default. + """ + return + + @property + def user_agent(self) -> str: + return f"{self.__class__.__name__}/Python {self._version}" + + @property + def base_url(self) -> URL: + return self._base_url + + @base_url.setter + def base_url(self, url: URL | str) -> None: + self._base_url = self._enforce_trailing_slash(url if isinstance(url, URL) else URL(url)) + + def platform_headers(self) -> Dict[str, str]: + # the actual implementation is in a separate `lru_cache` decorated + # function because adding `lru_cache` to methods will leak memory + # https://github.com/python/cpython/issues/88476 + return platform_headers(self._version, platform=self._platform) + + def _parse_retry_after_header(self, response_headers: Optional[httpx.Headers] = None) -> float | None: + """Returns a float of the number of seconds (not milliseconds) to wait after retrying, or None if unspecified. + + About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After + See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After#syntax + """ + if response_headers is None: + return None + + # First, try the non-standard `retry-after-ms` header for milliseconds, + # which is more precise than integer-seconds `retry-after` + try: + retry_ms_header = response_headers.get("retry-after-ms", None) + return float(retry_ms_header) / 1000 + except (TypeError, ValueError): + pass + + # Next, try parsing `retry-after` header as seconds (allowing nonstandard floats). + retry_header = response_headers.get("retry-after") + try: + # note: the spec indicates that this should only ever be an integer + # but if someone sends a float there's no reason for us to not respect it + return float(retry_header) + except (TypeError, ValueError): + pass + + # Last, try parsing `retry-after` as a date. + retry_date_tuple = email.utils.parsedate_tz(retry_header) + if retry_date_tuple is None: + return None + + retry_date = email.utils.mktime_tz(retry_date_tuple) + return float(retry_date - time.time()) + + def _calculate_retry_timeout( + self, + remaining_retries: int, + options: FinalRequestOptions, + response_headers: Optional[httpx.Headers] = None, + ) -> float: + max_retries = options.get_max_retries(self.max_retries) + + # If the API asks us to wait a certain amount of time (and it's a reasonable amount), just do what it says. + retry_after = self._parse_retry_after_header(response_headers) + if retry_after is not None and 0 < retry_after <= 60: + return retry_after + + # Also cap retry count to 1000 to avoid any potential overflows with `pow` + nb_retries = min(max_retries - remaining_retries, 1000) + + # Apply exponential backoff, but not more than the max. + sleep_seconds = min(INITIAL_RETRY_DELAY * pow(2.0, nb_retries), MAX_RETRY_DELAY) + + # Apply some jitter, plus-or-minus half a second. + jitter = 1 - 0.25 * random() + timeout = sleep_seconds * jitter + return timeout if timeout >= 0 else 0 + + def _should_retry(self, response: httpx.Response) -> bool: + # Note: this is not a standard header + should_retry_header = response.headers.get("x-should-retry") + + # If the server explicitly says whether or not to retry, obey. + if should_retry_header == "true": + log.debug("Retrying as header `x-should-retry` is set to `true`") + return True + if should_retry_header == "false": + log.debug("Not retrying as header `x-should-retry` is set to `false`") + return False + + # Retry on request timeouts. + if response.status_code == 408: + log.debug("Retrying due to status code %i", response.status_code) + return True + + # Retry on lock timeouts. + if response.status_code == 409: + log.debug("Retrying due to status code %i", response.status_code) + return True + + # Retry on rate limits. + if response.status_code == 429: + log.debug("Retrying due to status code %i", response.status_code) + return True + + # Retry internal errors. + if response.status_code >= 500: + log.debug("Retrying due to status code %i", response.status_code) + return True + + log.debug("Not retrying") + return False + + def _idempotency_key(self) -> str: + return f"stainless-python-retry-{uuid.uuid4()}" + + +class _DefaultHttpxClient(httpx.Client): + def __init__(self, **kwargs: Any) -> None: + kwargs.setdefault("timeout", DEFAULT_TIMEOUT) + kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) + kwargs.setdefault("follow_redirects", True) + super().__init__(**kwargs) + + +if TYPE_CHECKING: + DefaultHttpxClient = httpx.Client + """An alias to `httpx.Client` that provides the same defaults that this SDK + uses internally. + + This is useful because overriding the `http_client` with your own instance of + `httpx.Client` will result in httpx's defaults being used, not ours. + """ +else: + DefaultHttpxClient = _DefaultHttpxClient + + +class SyncHttpxClientWrapper(DefaultHttpxClient): + def __del__(self) -> None: + if self.is_closed: + return + + try: + self.close() + except Exception: + pass + + +class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]): + _client: httpx.Client + _default_stream_cls: type[Stream[Any]] | None = None + + def __init__( + self, + *, + version: str, + base_url: str | URL, + max_retries: int = DEFAULT_MAX_RETRIES, + timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + http_client: httpx.Client | None = None, + custom_headers: Mapping[str, str] | None = None, + custom_query: Mapping[str, object] | None = None, + _strict_response_validation: bool, + ) -> None: + if not is_given(timeout): + # if the user passed in a custom http client with a non-default + # timeout set then we use that timeout. + # + # note: there is an edge case here where the user passes in a client + # where they've explicitly set the timeout to match the default timeout + # as this check is structural, meaning that we'll think they didn't + # pass in a timeout and will ignore it + if http_client and http_client.timeout != HTTPX_DEFAULT_TIMEOUT: + timeout = http_client.timeout + else: + timeout = DEFAULT_TIMEOUT + + if http_client is not None and not isinstance(http_client, httpx.Client): # pyright: ignore[reportUnnecessaryIsInstance] + raise TypeError( + f"Invalid `http_client` argument; Expected an instance of `httpx.Client` but got {type(http_client)}" + ) + + super().__init__( + version=version, + # cast to a valid type because mypy doesn't understand our type narrowing + timeout=cast(Timeout, timeout), + base_url=base_url, + max_retries=max_retries, + custom_query=custom_query, + custom_headers=custom_headers, + _strict_response_validation=_strict_response_validation, + ) + self._client = http_client or SyncHttpxClientWrapper( + base_url=base_url, + # cast to a valid type because mypy doesn't understand our type narrowing + timeout=cast(Timeout, timeout), + ) + + def is_closed(self) -> bool: + return self._client.is_closed + + def close(self) -> None: + """Close the underlying HTTPX client. + + The client will *not* be usable after this. + """ + # If an error is thrown while constructing a client, self._client + # may not be present + if hasattr(self, "_client"): + self._client.close() + + def __enter__(self: _T) -> _T: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + self.close() + + def _prepare_options( + self, + options: FinalRequestOptions, # noqa: ARG002 + ) -> FinalRequestOptions: + """Hook for mutating the given options""" + return options + + def _prepare_request( + self, + request: httpx.Request, # noqa: ARG002 + ) -> None: + """This method is used as a callback for mutating the `Request` object + after it has been constructed. + This is useful for cases where you want to add certain headers based off of + the request properties, e.g. `url`, `method` etc. + """ + return None + + @overload + def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + remaining_retries: Optional[int] = None, + *, + stream: Literal[True], + stream_cls: Type[_StreamT], + ) -> _StreamT: ... + + @overload + def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + remaining_retries: Optional[int] = None, + *, + stream: Literal[False] = False, + ) -> ResponseT: ... + + @overload + def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + remaining_retries: Optional[int] = None, + *, + stream: bool = False, + stream_cls: Type[_StreamT] | None = None, + ) -> ResponseT | _StreamT: ... + + def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + remaining_retries: Optional[int] = None, + *, + stream: bool = False, + stream_cls: type[_StreamT] | None = None, + ) -> ResponseT | _StreamT: + if remaining_retries is not None: + retries_taken = options.get_max_retries(self.max_retries) - remaining_retries + else: + retries_taken = 0 + + return self._request( + cast_to=cast_to, + options=options, + stream=stream, + stream_cls=stream_cls, + retries_taken=retries_taken, + ) + + def _request( + self, + *, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + retries_taken: int, + stream: bool, + stream_cls: type[_StreamT] | None, + ) -> ResponseT | _StreamT: + # create a copy of the options we were given so that if the + # options are mutated later & we then retry, the retries are + # given the original options + input_options = model_copy(options) + + cast_to = self._maybe_override_cast_to(cast_to, options) + options = self._prepare_options(options) + + remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + self._prepare_request(request) + + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth + + log.debug("Sending HTTP Request: %s %s", request.method, request.url) + + try: + response = self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, + ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + return self._retry_request( + input_options, + cast_to, + retries_taken=retries_taken, + stream=stream, + stream_cls=stream_cls, + response_headers=None, + ) + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + return self._retry_request( + input_options, + cast_to, + retries_taken=retries_taken, + stream=stream, + stream_cls=stream_cls, + response_headers=None, + ) + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) + + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + err.response.close() + return self._retry_request( + input_options, + cast_to, + retries_taken=retries_taken, + response_headers=err.response.headers, + stream=stream, + stream_cls=stream_cls, + ) + + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + err.response.read() + + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None + + return self._process_response( + cast_to=cast_to, + options=options, + response=response, + stream=stream, + stream_cls=stream_cls, + retries_taken=retries_taken, + ) + + def _retry_request( + self, + options: FinalRequestOptions, + cast_to: Type[ResponseT], + *, + retries_taken: int, + response_headers: httpx.Headers | None, + stream: bool, + stream_cls: type[_StreamT] | None, + ) -> ResponseT | _StreamT: + remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + if remaining_retries == 1: + log.debug("1 retry left") + else: + log.debug("%i retries left", remaining_retries) + + timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers) + log.info("Retrying request to %s in %f seconds", options.url, timeout) + + # In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a + # different thread if necessary. + time.sleep(timeout) + + return self._request( + options=options, + cast_to=cast_to, + retries_taken=retries_taken + 1, + stream=stream, + stream_cls=stream_cls, + ) + + def _process_response( + self, + *, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + response: httpx.Response, + stream: bool, + stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, + retries_taken: int = 0, + ) -> ResponseT: + origin = get_origin(cast_to) or cast_to + + if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): + if not issubclass(origin, APIResponse): + raise TypeError(f"API Response types must subclass {APIResponse}; Received {origin}") + + response_cls = cast("type[BaseAPIResponse[Any]]", cast_to) + return cast( + ResponseT, + response_cls( + raw=response, + client=self, + cast_to=extract_response_type(response_cls), + stream=stream, + stream_cls=stream_cls, + options=options, + retries_taken=retries_taken, + ), + ) + + if cast_to == httpx.Response: + return cast(ResponseT, response) + + api_response = APIResponse( + raw=response, + client=self, + cast_to=cast("type[ResponseT]", cast_to), # pyright: ignore[reportUnnecessaryCast] + stream=stream, + stream_cls=stream_cls, + options=options, + retries_taken=retries_taken, + ) + if bool(response.request.headers.get(RAW_RESPONSE_HEADER)): + return cast(ResponseT, api_response) + + return api_response.parse() + + def _request_api_list( + self, + model: Type[object], + page: Type[SyncPageT], + options: FinalRequestOptions, + ) -> SyncPageT: + def _parser(resp: SyncPageT) -> SyncPageT: + resp._set_private_attributes( + client=self, + model=model, + options=options, + ) + return resp + + options.post_parser = _parser + + return self.request(page, options, stream=False) + + @overload + def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: Literal[False] = False, + ) -> ResponseT: ... + + @overload + def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: Literal[True], + stream_cls: type[_StreamT], + ) -> _StreamT: ... + + @overload + def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: bool, + stream_cls: type[_StreamT] | None = None, + ) -> ResponseT | _StreamT: ... + + def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: bool = False, + stream_cls: type[_StreamT] | None = None, + ) -> ResponseT | _StreamT: + opts = FinalRequestOptions.construct(method="get", url=path, **options) + # cast is required because mypy complains about returning Any even though + # it understands the type variables + return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) + + @overload + def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + files: RequestFiles | None = None, + stream: Literal[False] = False, + ) -> ResponseT: ... + + @overload + def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + files: RequestFiles | None = None, + stream: Literal[True], + stream_cls: type[_StreamT], + ) -> _StreamT: ... + + @overload + def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + files: RequestFiles | None = None, + stream: bool, + stream_cls: type[_StreamT] | None = None, + ) -> ResponseT | _StreamT: ... + + def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + files: RequestFiles | None = None, + stream: bool = False, + stream_cls: type[_StreamT] | None = None, + ) -> ResponseT | _StreamT: + opts = FinalRequestOptions.construct( + method="post", url=path, json_data=body, files=to_httpx_files(files), **options + ) + return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) + + def patch( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + ) -> ResponseT: + opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + return self.request(cast_to, opts) + + def put( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + files: RequestFiles | None = None, + options: RequestOptions = {}, + ) -> ResponseT: + opts = FinalRequestOptions.construct( + method="put", url=path, json_data=body, files=to_httpx_files(files), **options + ) + return self.request(cast_to, opts) + + def delete( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + ) -> ResponseT: + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + return self.request(cast_to, opts) + + def get_api_list( + self, + path: str, + *, + model: Type[object], + page: Type[SyncPageT], + body: Body | None = None, + options: RequestOptions = {}, + method: str = "get", + ) -> SyncPageT: + opts = FinalRequestOptions.construct(method=method, url=path, json_data=body, **options) + return self._request_api_list(model, page, opts) + + +class _DefaultAsyncHttpxClient(httpx.AsyncClient): + def __init__(self, **kwargs: Any) -> None: + kwargs.setdefault("timeout", DEFAULT_TIMEOUT) + kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) + kwargs.setdefault("follow_redirects", True) + super().__init__(**kwargs) + + +if TYPE_CHECKING: + DefaultAsyncHttpxClient = httpx.AsyncClient + """An alias to `httpx.AsyncClient` that provides the same defaults that this SDK + uses internally. + + This is useful because overriding the `http_client` with your own instance of + `httpx.AsyncClient` will result in httpx's defaults being used, not ours. + """ +else: + DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient + + +class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient): + def __del__(self) -> None: + if self.is_closed: + return + + try: + # TODO(someday): support non asyncio runtimes here + asyncio.get_running_loop().create_task(self.aclose()) + except Exception: + pass + + +class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]): + _client: httpx.AsyncClient + _default_stream_cls: type[AsyncStream[Any]] | None = None + + def __init__( + self, + *, + version: str, + base_url: str | URL, + _strict_response_validation: bool, + max_retries: int = DEFAULT_MAX_RETRIES, + timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + http_client: httpx.AsyncClient | None = None, + custom_headers: Mapping[str, str] | None = None, + custom_query: Mapping[str, object] | None = None, + ) -> None: + if not is_given(timeout): + # if the user passed in a custom http client with a non-default + # timeout set then we use that timeout. + # + # note: there is an edge case here where the user passes in a client + # where they've explicitly set the timeout to match the default timeout + # as this check is structural, meaning that we'll think they didn't + # pass in a timeout and will ignore it + if http_client and http_client.timeout != HTTPX_DEFAULT_TIMEOUT: + timeout = http_client.timeout + else: + timeout = DEFAULT_TIMEOUT + + if http_client is not None and not isinstance(http_client, httpx.AsyncClient): # pyright: ignore[reportUnnecessaryIsInstance] + raise TypeError( + f"Invalid `http_client` argument; Expected an instance of `httpx.AsyncClient` but got {type(http_client)}" + ) + + super().__init__( + version=version, + base_url=base_url, + # cast to a valid type because mypy doesn't understand our type narrowing + timeout=cast(Timeout, timeout), + max_retries=max_retries, + custom_query=custom_query, + custom_headers=custom_headers, + _strict_response_validation=_strict_response_validation, + ) + self._client = http_client or AsyncHttpxClientWrapper( + base_url=base_url, + # cast to a valid type because mypy doesn't understand our type narrowing + timeout=cast(Timeout, timeout), + ) + + def is_closed(self) -> bool: + return self._client.is_closed + + async def close(self) -> None: + """Close the underlying HTTPX client. + + The client will *not* be usable after this. + """ + await self._client.aclose() + + async def __aenter__(self: _T) -> _T: + return self + + async def __aexit__( + self, + exc_type: type[BaseException] | None, + exc: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + await self.close() + + async def _prepare_options( + self, + options: FinalRequestOptions, # noqa: ARG002 + ) -> FinalRequestOptions: + """Hook for mutating the given options""" + return options + + async def _prepare_request( + self, + request: httpx.Request, # noqa: ARG002 + ) -> None: + """This method is used as a callback for mutating the `Request` object + after it has been constructed. + This is useful for cases where you want to add certain headers based off of + the request properties, e.g. `url`, `method` etc. + """ + return None + + @overload + async def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: Literal[False] = False, + remaining_retries: Optional[int] = None, + ) -> ResponseT: ... + + @overload + async def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: Literal[True], + stream_cls: type[_AsyncStreamT], + remaining_retries: Optional[int] = None, + ) -> _AsyncStreamT: ... + + @overload + async def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: bool, + stream_cls: type[_AsyncStreamT] | None = None, + remaining_retries: Optional[int] = None, + ) -> ResponseT | _AsyncStreamT: ... + + async def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: bool = False, + stream_cls: type[_AsyncStreamT] | None = None, + remaining_retries: Optional[int] = None, + ) -> ResponseT | _AsyncStreamT: + if remaining_retries is not None: + retries_taken = options.get_max_retries(self.max_retries) - remaining_retries + else: + retries_taken = 0 + + return await self._request( + cast_to=cast_to, + options=options, + stream=stream, + stream_cls=stream_cls, + retries_taken=retries_taken, + ) + + async def _request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: bool, + stream_cls: type[_AsyncStreamT] | None, + retries_taken: int, + ) -> ResponseT | _AsyncStreamT: + if self._platform is None: + # `get_platform` can make blocking IO calls so we + # execute it earlier while we are in an async context + self._platform = await asyncify(get_platform)() + + # create a copy of the options we were given so that if the + # options are mutated later & we then retry, the retries are + # given the original options + input_options = model_copy(options) + + cast_to = self._maybe_override_cast_to(cast_to, options) + options = await self._prepare_options(options) + + remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + await self._prepare_request(request) + + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth + + try: + response = await self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, + ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + return await self._retry_request( + input_options, + cast_to, + retries_taken=retries_taken, + stream=stream, + stream_cls=stream_cls, + response_headers=None, + ) + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + return await self._retry_request( + input_options, + cast_to, + retries_taken=retries_taken, + stream=stream, + stream_cls=stream_cls, + response_headers=None, + ) + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase + ) + + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + await err.response.aclose() + return await self._retry_request( + input_options, + cast_to, + retries_taken=retries_taken, + response_headers=err.response.headers, + stream=stream, + stream_cls=stream_cls, + ) + + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + await err.response.aread() + + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None + + return await self._process_response( + cast_to=cast_to, + options=options, + response=response, + stream=stream, + stream_cls=stream_cls, + retries_taken=retries_taken, + ) + + async def _retry_request( + self, + options: FinalRequestOptions, + cast_to: Type[ResponseT], + *, + retries_taken: int, + response_headers: httpx.Headers | None, + stream: bool, + stream_cls: type[_AsyncStreamT] | None, + ) -> ResponseT | _AsyncStreamT: + remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + if remaining_retries == 1: + log.debug("1 retry left") + else: + log.debug("%i retries left", remaining_retries) + + timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers) + log.info("Retrying request to %s in %f seconds", options.url, timeout) + + await anyio.sleep(timeout) + + return await self._request( + options=options, + cast_to=cast_to, + retries_taken=retries_taken + 1, + stream=stream, + stream_cls=stream_cls, + ) + + async def _process_response( + self, + *, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + response: httpx.Response, + stream: bool, + stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, + retries_taken: int = 0, + ) -> ResponseT: + origin = get_origin(cast_to) or cast_to + + if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): + if not issubclass(origin, AsyncAPIResponse): + raise TypeError(f"API Response types must subclass {AsyncAPIResponse}; Received {origin}") + + response_cls = cast("type[BaseAPIResponse[Any]]", cast_to) + return cast( + "ResponseT", + response_cls( + raw=response, + client=self, + cast_to=extract_response_type(response_cls), + stream=stream, + stream_cls=stream_cls, + options=options, + retries_taken=retries_taken, + ), + ) + + if cast_to == httpx.Response: + return cast(ResponseT, response) + + api_response = AsyncAPIResponse( + raw=response, + client=self, + cast_to=cast("type[ResponseT]", cast_to), # pyright: ignore[reportUnnecessaryCast] + stream=stream, + stream_cls=stream_cls, + options=options, + retries_taken=retries_taken, + ) + if bool(response.request.headers.get(RAW_RESPONSE_HEADER)): + return cast(ResponseT, api_response) + + return await api_response.parse() + + def _request_api_list( + self, + model: Type[_T], + page: Type[AsyncPageT], + options: FinalRequestOptions, + ) -> AsyncPaginator[_T, AsyncPageT]: + return AsyncPaginator(client=self, options=options, page_cls=page, model=model) + + @overload + async def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: Literal[False] = False, + ) -> ResponseT: ... + + @overload + async def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: Literal[True], + stream_cls: type[_AsyncStreamT], + ) -> _AsyncStreamT: ... + + @overload + async def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: bool, + stream_cls: type[_AsyncStreamT] | None = None, + ) -> ResponseT | _AsyncStreamT: ... + + async def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: bool = False, + stream_cls: type[_AsyncStreamT] | None = None, + ) -> ResponseT | _AsyncStreamT: + opts = FinalRequestOptions.construct(method="get", url=path, **options) + return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) + + @overload + async def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + files: RequestFiles | None = None, + options: RequestOptions = {}, + stream: Literal[False] = False, + ) -> ResponseT: ... + + @overload + async def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + files: RequestFiles | None = None, + options: RequestOptions = {}, + stream: Literal[True], + stream_cls: type[_AsyncStreamT], + ) -> _AsyncStreamT: ... + + @overload + async def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + files: RequestFiles | None = None, + options: RequestOptions = {}, + stream: bool, + stream_cls: type[_AsyncStreamT] | None = None, + ) -> ResponseT | _AsyncStreamT: ... + + async def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + files: RequestFiles | None = None, + options: RequestOptions = {}, + stream: bool = False, + stream_cls: type[_AsyncStreamT] | None = None, + ) -> ResponseT | _AsyncStreamT: + opts = FinalRequestOptions.construct( + method="post", url=path, json_data=body, files=await async_to_httpx_files(files), **options + ) + return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) + + async def patch( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + ) -> ResponseT: + opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + return await self.request(cast_to, opts) + + async def put( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + files: RequestFiles | None = None, + options: RequestOptions = {}, + ) -> ResponseT: + opts = FinalRequestOptions.construct( + method="put", url=path, json_data=body, files=await async_to_httpx_files(files), **options + ) + return await self.request(cast_to, opts) + + async def delete( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + ) -> ResponseT: + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + return await self.request(cast_to, opts) + + def get_api_list( + self, + path: str, + *, + model: Type[_T], + page: Type[AsyncPageT], + body: Body | None = None, + options: RequestOptions = {}, + method: str = "get", + ) -> AsyncPaginator[_T, AsyncPageT]: + opts = FinalRequestOptions.construct(method=method, url=path, json_data=body, **options) + return self._request_api_list(model, page, opts) + + +def make_request_options( + *, + query: Query | None = None, + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + idempotency_key: str | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + post_parser: PostParser | NotGiven = NOT_GIVEN, +) -> RequestOptions: + """Create a dict of type RequestOptions without keys of NotGiven values.""" + options: RequestOptions = {} + if extra_headers is not None: + options["headers"] = extra_headers + + if extra_body is not None: + options["extra_json"] = cast(AnyMapping, extra_body) + + if query is not None: + options["params"] = query + + if extra_query is not None: + options["params"] = {**options.get("params", {}), **extra_query} + + if not isinstance(timeout, NotGiven): + options["timeout"] = timeout + + if idempotency_key is not None: + options["idempotency_key"] = idempotency_key + + if is_given(post_parser): + # internal + options["post_parser"] = post_parser # type: ignore + + return options + + +class ForceMultipartDict(Dict[str, None]): + def __bool__(self) -> bool: + return True + + +class OtherPlatform: + def __init__(self, name: str) -> None: + self.name = name + + @override + def __str__(self) -> str: + return f"Other:{self.name}" + + +Platform = Union[ + OtherPlatform, + Literal[ + "MacOS", + "Linux", + "Windows", + "FreeBSD", + "OpenBSD", + "iOS", + "Android", + "Unknown", + ], +] + + +def get_platform() -> Platform: + try: + system = platform.system().lower() + platform_name = platform.platform().lower() + except Exception: + return "Unknown" + + if "iphone" in platform_name or "ipad" in platform_name: + # Tested using Python3IDE on an iPhone 11 and Pythonista on an iPad 7 + # system is Darwin and platform_name is a string like: + # - Darwin-21.6.0-iPhone12,1-64bit + # - Darwin-21.6.0-iPad7,11-64bit + return "iOS" + + if system == "darwin": + return "MacOS" + + if system == "windows": + return "Windows" + + if "android" in platform_name: + # Tested using Pydroid 3 + # system is Linux and platform_name is a string like 'Linux-5.10.81-android12-9-00001-geba40aecb3b7-ab8534902-aarch64-with-libc' + return "Android" + + if system == "linux": + # https://distro.readthedocs.io/en/latest/#distro.id + distro_id = distro.id() + if distro_id == "freebsd": + return "FreeBSD" + + if distro_id == "openbsd": + return "OpenBSD" + + return "Linux" + + if platform_name: + return OtherPlatform(platform_name) + + return "Unknown" + + +@lru_cache(maxsize=None) +def platform_headers(version: str, *, platform: Platform | None) -> Dict[str, str]: + return { + "X-Stainless-Lang": "python", + "X-Stainless-Package-Version": version, + "X-Stainless-OS": str(platform or get_platform()), + "X-Stainless-Arch": str(get_architecture()), + "X-Stainless-Runtime": get_python_runtime(), + "X-Stainless-Runtime-Version": get_python_version(), + } + + +class OtherArch: + def __init__(self, name: str) -> None: + self.name = name + + @override + def __str__(self) -> str: + return f"other:{self.name}" + + +Arch = Union[OtherArch, Literal["x32", "x64", "arm", "arm64", "unknown"]] + + +def get_python_runtime() -> str: + try: + return platform.python_implementation() + except Exception: + return "unknown" + + +def get_python_version() -> str: + try: + return platform.python_version() + except Exception: + return "unknown" + + +def get_architecture() -> Arch: + try: + machine = platform.machine().lower() + except Exception: + return "unknown" + + if machine in ("arm64", "aarch64"): + return "arm64" + + # TODO: untested + if machine == "arm": + return "arm" + + if machine == "x86_64": + return "x64" + + # TODO: untested + if sys.maxsize <= 2**32: + return "x32" + + if machine: + return OtherArch(machine) + + return "unknown" + + +def _merge_mappings( + obj1: Mapping[_T_co, Union[_T, Omit]], + obj2: Mapping[_T_co, Union[_T, Omit]], +) -> Dict[_T_co, _T]: + """Merge two mappings of the same type, removing any values that are instances of `Omit`. + + In cases with duplicate keys the second mapping takes precedence. + """ + merged = {**obj1, **obj2} + return {key: value for key, value in merged.items() if not isinstance(value, Omit)} diff --git a/src/gcore/_client.py b/src/gcore/_client.py new file mode 100644 index 00000000..f993ffb5 --- /dev/null +++ b/src/gcore/_client.py @@ -0,0 +1,472 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Union, Mapping +from typing_extensions import Self, override + +import httpx + +from . import _exceptions +from ._qs import Querystring +from ._types import ( + NOT_GIVEN, + Omit, + Timeout, + NotGiven, + Transport, + ProxiesTypes, + RequestOptions, +) +from ._utils import ( + is_given, + get_async_library, + maybe_coerce_integer, +) +from ._version import __version__ +from ._streaming import Stream as Stream, AsyncStream as AsyncStream +from ._exceptions import GcoreError, APIStatusError +from ._base_client import ( + DEFAULT_MAX_RETRIES, + SyncAPIClient, + AsyncAPIClient, +) +from .resources.cloud import cloud + +__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Gcore", "AsyncGcore", "Client", "AsyncClient"] + + +class Gcore(SyncAPIClient): + cloud: cloud.CloudResource + with_raw_response: GcoreWithRawResponse + with_streaming_response: GcoreWithStreamedResponse + + # client options + api_key: str + project_id: int | None + region_id: int | None + + def __init__( + self, + *, + api_key: str | None = None, + project_id: int | None = None, + region_id: int | None = None, + base_url: str | httpx.URL | None = None, + timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + max_retries: int = DEFAULT_MAX_RETRIES, + default_headers: Mapping[str, str] | None = None, + default_query: Mapping[str, object] | None = None, + # Configure a custom httpx client. + # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details. + http_client: httpx.Client | None = None, + # Enable or disable schema validation for data returned by the API. + # When enabled an error APIResponseValidationError is raised + # if the API responds with invalid data for the expected schema. + # + # This parameter may be removed or changed in the future. + # If you rely on this feature, please open a GitHub issue + # outlining your use-case to help us decide if it should be + # part of our public interface in the future. + _strict_response_validation: bool = False, + ) -> None: + """Construct a new synchronous Gcore client instance. + + This automatically infers the following arguments from their corresponding environment variables if they are not provided: + - `api_key` from `GCORE_API_KEY` + - `project_id` from `GCORE_PROJECT_ID` + - `region_id` from `GCORE_REGION_ID` + """ + if api_key is None: + api_key = os.environ.get("GCORE_API_KEY") + if api_key is None: + raise GcoreError( + "The api_key client option must be set either by passing api_key to the client or by setting the GCORE_API_KEY environment variable" + ) + self.api_key = api_key + + if project_id is None: + project_id = maybe_coerce_integer(os.environ.get("GCORE_PROJECT_ID")) + self.project_id = project_id + + if region_id is None: + region_id = maybe_coerce_integer(os.environ.get("GCORE_REGION_ID")) + self.region_id = region_id + + if base_url is None: + base_url = os.environ.get("GCORE_BASE_URL") + if base_url is None: + base_url = f"https://api.gcore.com" + + super().__init__( + version=__version__, + base_url=base_url, + max_retries=max_retries, + timeout=timeout, + http_client=http_client, + custom_headers=default_headers, + custom_query=default_query, + _strict_response_validation=_strict_response_validation, + ) + + self.cloud = cloud.CloudResource(self) + self.with_raw_response = GcoreWithRawResponse(self) + self.with_streaming_response = GcoreWithStreamedResponse(self) + + @property + @override + def qs(self) -> Querystring: + return Querystring(nested_format="dots", array_format="repeat") + + @property + @override + def auth_headers(self) -> dict[str, str]: + api_key = self.api_key + return {"Authorization": f"APIKey {api_key}"} + + @property + @override + def default_headers(self) -> dict[str, str | Omit]: + return { + **super().default_headers, + "X-Stainless-Async": "false", + **self._custom_headers, + } + + def copy( + self, + *, + api_key: str | None = None, + project_id: int | None = None, + region_id: int | None = None, + base_url: str | httpx.URL | None = None, + timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + http_client: httpx.Client | None = None, + max_retries: int | NotGiven = NOT_GIVEN, + default_headers: Mapping[str, str] | None = None, + set_default_headers: Mapping[str, str] | None = None, + default_query: Mapping[str, object] | None = None, + set_default_query: Mapping[str, object] | None = None, + _extra_kwargs: Mapping[str, Any] = {}, + ) -> Self: + """ + Create a new client instance re-using the same options given to the current client with optional overriding. + """ + if default_headers is not None and set_default_headers is not None: + raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive") + + if default_query is not None and set_default_query is not None: + raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive") + + headers = self._custom_headers + if default_headers is not None: + headers = {**headers, **default_headers} + elif set_default_headers is not None: + headers = set_default_headers + + params = self._custom_query + if default_query is not None: + params = {**params, **default_query} + elif set_default_query is not None: + params = set_default_query + + http_client = http_client or self._client + return self.__class__( + api_key=api_key or self.api_key, + project_id=project_id or self.project_id, + region_id=region_id or self.region_id, + base_url=base_url or self.base_url, + timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, + http_client=http_client, + max_retries=max_retries if is_given(max_retries) else self.max_retries, + default_headers=headers, + default_query=params, + **_extra_kwargs, + ) + + # Alias for `copy` for nicer inline usage, e.g. + # client.with_options(timeout=10).foo.create(...) + with_options = copy + + def _get_project_id_path_param(self) -> str: + from_client = self.project_id + if from_client is not None: + return from_client + + raise ValueError( + "Missing project_id argument; Please provide it at the client level, e.g. Gcore(project_id='abcd') or per method." + ) + + def _get_region_id_path_param(self) -> str: + from_client = self.region_id + if from_client is not None: + return from_client + + raise ValueError( + "Missing region_id argument; Please provide it at the client level, e.g. Gcore(region_id='abcd') or per method." + ) + + @override + def _make_status_error( + self, + err_msg: str, + *, + body: object, + response: httpx.Response, + ) -> APIStatusError: + if response.status_code == 400: + return _exceptions.BadRequestError(err_msg, response=response, body=body) + + if response.status_code == 401: + return _exceptions.AuthenticationError(err_msg, response=response, body=body) + + if response.status_code == 403: + return _exceptions.PermissionDeniedError(err_msg, response=response, body=body) + + if response.status_code == 404: + return _exceptions.NotFoundError(err_msg, response=response, body=body) + + if response.status_code == 409: + return _exceptions.ConflictError(err_msg, response=response, body=body) + + if response.status_code == 422: + return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body) + + if response.status_code == 429: + return _exceptions.RateLimitError(err_msg, response=response, body=body) + + if response.status_code >= 500: + return _exceptions.InternalServerError(err_msg, response=response, body=body) + return APIStatusError(err_msg, response=response, body=body) + + +class AsyncGcore(AsyncAPIClient): + cloud: cloud.AsyncCloudResource + with_raw_response: AsyncGcoreWithRawResponse + with_streaming_response: AsyncGcoreWithStreamedResponse + + # client options + api_key: str + project_id: int | None + region_id: int | None + + def __init__( + self, + *, + api_key: str | None = None, + project_id: int | None = None, + region_id: int | None = None, + base_url: str | httpx.URL | None = None, + timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + max_retries: int = DEFAULT_MAX_RETRIES, + default_headers: Mapping[str, str] | None = None, + default_query: Mapping[str, object] | None = None, + # Configure a custom httpx client. + # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details. + http_client: httpx.AsyncClient | None = None, + # Enable or disable schema validation for data returned by the API. + # When enabled an error APIResponseValidationError is raised + # if the API responds with invalid data for the expected schema. + # + # This parameter may be removed or changed in the future. + # If you rely on this feature, please open a GitHub issue + # outlining your use-case to help us decide if it should be + # part of our public interface in the future. + _strict_response_validation: bool = False, + ) -> None: + """Construct a new async AsyncGcore client instance. + + This automatically infers the following arguments from their corresponding environment variables if they are not provided: + - `api_key` from `GCORE_API_KEY` + - `project_id` from `GCORE_PROJECT_ID` + - `region_id` from `GCORE_REGION_ID` + """ + if api_key is None: + api_key = os.environ.get("GCORE_API_KEY") + if api_key is None: + raise GcoreError( + "The api_key client option must be set either by passing api_key to the client or by setting the GCORE_API_KEY environment variable" + ) + self.api_key = api_key + + if project_id is None: + project_id = maybe_coerce_integer(os.environ.get("GCORE_PROJECT_ID")) + self.project_id = project_id + + if region_id is None: + region_id = maybe_coerce_integer(os.environ.get("GCORE_REGION_ID")) + self.region_id = region_id + + if base_url is None: + base_url = os.environ.get("GCORE_BASE_URL") + if base_url is None: + base_url = f"https://api.gcore.com" + + super().__init__( + version=__version__, + base_url=base_url, + max_retries=max_retries, + timeout=timeout, + http_client=http_client, + custom_headers=default_headers, + custom_query=default_query, + _strict_response_validation=_strict_response_validation, + ) + + self.cloud = cloud.AsyncCloudResource(self) + self.with_raw_response = AsyncGcoreWithRawResponse(self) + self.with_streaming_response = AsyncGcoreWithStreamedResponse(self) + + @property + @override + def qs(self) -> Querystring: + return Querystring(nested_format="dots", array_format="repeat") + + @property + @override + def auth_headers(self) -> dict[str, str]: + api_key = self.api_key + return {"Authorization": f"APIKey {api_key}"} + + @property + @override + def default_headers(self) -> dict[str, str | Omit]: + return { + **super().default_headers, + "X-Stainless-Async": f"async:{get_async_library()}", + **self._custom_headers, + } + + def copy( + self, + *, + api_key: str | None = None, + project_id: int | None = None, + region_id: int | None = None, + base_url: str | httpx.URL | None = None, + timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + http_client: httpx.AsyncClient | None = None, + max_retries: int | NotGiven = NOT_GIVEN, + default_headers: Mapping[str, str] | None = None, + set_default_headers: Mapping[str, str] | None = None, + default_query: Mapping[str, object] | None = None, + set_default_query: Mapping[str, object] | None = None, + _extra_kwargs: Mapping[str, Any] = {}, + ) -> Self: + """ + Create a new client instance re-using the same options given to the current client with optional overriding. + """ + if default_headers is not None and set_default_headers is not None: + raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive") + + if default_query is not None and set_default_query is not None: + raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive") + + headers = self._custom_headers + if default_headers is not None: + headers = {**headers, **default_headers} + elif set_default_headers is not None: + headers = set_default_headers + + params = self._custom_query + if default_query is not None: + params = {**params, **default_query} + elif set_default_query is not None: + params = set_default_query + + http_client = http_client or self._client + return self.__class__( + api_key=api_key or self.api_key, + project_id=project_id or self.project_id, + region_id=region_id or self.region_id, + base_url=base_url or self.base_url, + timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, + http_client=http_client, + max_retries=max_retries if is_given(max_retries) else self.max_retries, + default_headers=headers, + default_query=params, + **_extra_kwargs, + ) + + # Alias for `copy` for nicer inline usage, e.g. + # client.with_options(timeout=10).foo.create(...) + with_options = copy + + def _get_project_id_path_param(self) -> str: + from_client = self.project_id + if from_client is not None: + return from_client + + raise ValueError( + "Missing project_id argument; Please provide it at the client level, e.g. AsyncGcore(project_id='abcd') or per method." + ) + + def _get_region_id_path_param(self) -> str: + from_client = self.region_id + if from_client is not None: + return from_client + + raise ValueError( + "Missing region_id argument; Please provide it at the client level, e.g. AsyncGcore(region_id='abcd') or per method." + ) + + @override + def _make_status_error( + self, + err_msg: str, + *, + body: object, + response: httpx.Response, + ) -> APIStatusError: + if response.status_code == 400: + return _exceptions.BadRequestError(err_msg, response=response, body=body) + + if response.status_code == 401: + return _exceptions.AuthenticationError(err_msg, response=response, body=body) + + if response.status_code == 403: + return _exceptions.PermissionDeniedError(err_msg, response=response, body=body) + + if response.status_code == 404: + return _exceptions.NotFoundError(err_msg, response=response, body=body) + + if response.status_code == 409: + return _exceptions.ConflictError(err_msg, response=response, body=body) + + if response.status_code == 422: + return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body) + + if response.status_code == 429: + return _exceptions.RateLimitError(err_msg, response=response, body=body) + + if response.status_code >= 500: + return _exceptions.InternalServerError(err_msg, response=response, body=body) + return APIStatusError(err_msg, response=response, body=body) + + +class GcoreWithRawResponse: + def __init__(self, client: Gcore) -> None: + self.cloud = cloud.CloudResourceWithRawResponse(client.cloud) + + +class AsyncGcoreWithRawResponse: + def __init__(self, client: AsyncGcore) -> None: + self.cloud = cloud.AsyncCloudResourceWithRawResponse(client.cloud) + + +class GcoreWithStreamedResponse: + def __init__(self, client: Gcore) -> None: + self.cloud = cloud.CloudResourceWithStreamingResponse(client.cloud) + + +class AsyncGcoreWithStreamedResponse: + def __init__(self, client: AsyncGcore) -> None: + self.cloud = cloud.AsyncCloudResourceWithStreamingResponse(client.cloud) + + +Client = Gcore + +AsyncClient = AsyncGcore diff --git a/src/gcore/_compat.py b/src/gcore/_compat.py new file mode 100644 index 00000000..92d9ee61 --- /dev/null +++ b/src/gcore/_compat.py @@ -0,0 +1,219 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload +from datetime import date, datetime +from typing_extensions import Self, Literal + +import pydantic +from pydantic.fields import FieldInfo + +from ._types import IncEx, StrBytesIntFloat + +_T = TypeVar("_T") +_ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel) + +# --------------- Pydantic v2 compatibility --------------- + +# Pyright incorrectly reports some of our functions as overriding a method when they don't +# pyright: reportIncompatibleMethodOverride=false + +PYDANTIC_V2 = pydantic.VERSION.startswith("2.") + +# v1 re-exports +if TYPE_CHECKING: + + def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001 + ... + + def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: # noqa: ARG001 + ... + + def get_args(t: type[Any]) -> tuple[Any, ...]: # noqa: ARG001 + ... + + def is_union(tp: type[Any] | None) -> bool: # noqa: ARG001 + ... + + def get_origin(t: type[Any]) -> type[Any] | None: # noqa: ARG001 + ... + + def is_literal_type(type_: type[Any]) -> bool: # noqa: ARG001 + ... + + def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001 + ... + +else: + if PYDANTIC_V2: + from pydantic.v1.typing import ( + get_args as get_args, + is_union as is_union, + get_origin as get_origin, + is_typeddict as is_typeddict, + is_literal_type as is_literal_type, + ) + from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime + else: + from pydantic.typing import ( + get_args as get_args, + is_union as is_union, + get_origin as get_origin, + is_typeddict as is_typeddict, + is_literal_type as is_literal_type, + ) + from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime + + +# refactored config +if TYPE_CHECKING: + from pydantic import ConfigDict as ConfigDict +else: + if PYDANTIC_V2: + from pydantic import ConfigDict + else: + # TODO: provide an error message here? + ConfigDict = None + + +# renamed methods / properties +def parse_obj(model: type[_ModelT], value: object) -> _ModelT: + if PYDANTIC_V2: + return model.model_validate(value) + else: + return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + + +def field_is_required(field: FieldInfo) -> bool: + if PYDANTIC_V2: + return field.is_required() + return field.required # type: ignore + + +def field_get_default(field: FieldInfo) -> Any: + value = field.get_default() + if PYDANTIC_V2: + from pydantic_core import PydanticUndefined + + if value == PydanticUndefined: + return None + return value + return value + + +def field_outer_type(field: FieldInfo) -> Any: + if PYDANTIC_V2: + return field.annotation + return field.outer_type_ # type: ignore + + +def get_model_config(model: type[pydantic.BaseModel]) -> Any: + if PYDANTIC_V2: + return model.model_config + return model.__config__ # type: ignore + + +def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]: + if PYDANTIC_V2: + return model.model_fields + return model.__fields__ # type: ignore + + +def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT: + if PYDANTIC_V2: + return model.model_copy(deep=deep) + return model.copy(deep=deep) # type: ignore + + +def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: + if PYDANTIC_V2: + return model.model_dump_json(indent=indent) + return model.json(indent=indent) # type: ignore + + +def model_dump( + model: pydantic.BaseModel, + *, + exclude: IncEx | None = None, + exclude_unset: bool = False, + exclude_defaults: bool = False, + warnings: bool = True, + mode: Literal["json", "python"] = "python", +) -> dict[str, Any]: + if PYDANTIC_V2 or hasattr(model, "model_dump"): + return model.model_dump( + mode=mode, + exclude=exclude, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + # warnings are not supported in Pydantic v1 + warnings=warnings if PYDANTIC_V2 else True, + ) + return cast( + "dict[str, Any]", + model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + exclude=exclude, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + ), + ) + + +def model_parse(model: type[_ModelT], data: Any) -> _ModelT: + if PYDANTIC_V2: + return model.model_validate(data) + return model.parse_obj(data) # pyright: ignore[reportDeprecated] + + +# generic models +if TYPE_CHECKING: + + class GenericModel(pydantic.BaseModel): ... + +else: + if PYDANTIC_V2: + # there no longer needs to be a distinction in v2 but + # we still have to create our own subclass to avoid + # inconsistent MRO ordering errors + class GenericModel(pydantic.BaseModel): ... + + else: + import pydantic.generics + + class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... + + +# cached properties +if TYPE_CHECKING: + cached_property = property + + # we define a separate type (copied from typeshed) + # that represents that `cached_property` is `set`able + # at runtime, which differs from `@property`. + # + # this is a separate type as editors likely special case + # `@property` and we don't want to cause issues just to have + # more helpful internal types. + + class typed_cached_property(Generic[_T]): + func: Callable[[Any], _T] + attrname: str | None + + def __init__(self, func: Callable[[Any], _T]) -> None: ... + + @overload + def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ... + + @overload + def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ... + + def __get__(self, instance: object, owner: type[Any] | None = None) -> _T | Self: + raise NotImplementedError() + + def __set_name__(self, owner: type[Any], name: str) -> None: ... + + # __set__ is not defined at runtime, but @cached_property is designed to be settable + def __set__(self, instance: object, value: _T) -> None: ... +else: + from functools import cached_property as cached_property + + typed_cached_property = cached_property diff --git a/src/gcore/_constants.py b/src/gcore/_constants.py new file mode 100644 index 00000000..6ddf2c71 --- /dev/null +++ b/src/gcore/_constants.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import httpx + +RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response" +OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to" + +# default timeout is 1 minute +DEFAULT_TIMEOUT = httpx.Timeout(timeout=60, connect=5.0) +DEFAULT_MAX_RETRIES = 2 +DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) + +INITIAL_RETRY_DELAY = 0.5 +MAX_RETRY_DELAY = 8.0 diff --git a/src/gcore/_exceptions.py b/src/gcore/_exceptions.py new file mode 100644 index 00000000..ed737b61 --- /dev/null +++ b/src/gcore/_exceptions.py @@ -0,0 +1,108 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +__all__ = [ + "BadRequestError", + "AuthenticationError", + "PermissionDeniedError", + "NotFoundError", + "ConflictError", + "UnprocessableEntityError", + "RateLimitError", + "InternalServerError", +] + + +class GcoreError(Exception): + pass + + +class APIError(GcoreError): + message: str + request: httpx.Request + + body: object | None + """The API response body. + + If the API responded with a valid JSON structure then this property will be the + decoded result. + + If it isn't a valid JSON structure then this will be the raw response. + + If there was no response associated with this error then it will be `None`. + """ + + def __init__(self, message: str, request: httpx.Request, *, body: object | None) -> None: # noqa: ARG002 + super().__init__(message) + self.request = request + self.message = message + self.body = body + + +class APIResponseValidationError(APIError): + response: httpx.Response + status_code: int + + def __init__(self, response: httpx.Response, body: object | None, *, message: str | None = None) -> None: + super().__init__(message or "Data returned by API invalid for expected schema.", response.request, body=body) + self.response = response + self.status_code = response.status_code + + +class APIStatusError(APIError): + """Raised when an API response has a status code of 4xx or 5xx.""" + + response: httpx.Response + status_code: int + + def __init__(self, message: str, *, response: httpx.Response, body: object | None) -> None: + super().__init__(message, response.request, body=body) + self.response = response + self.status_code = response.status_code + + +class APIConnectionError(APIError): + def __init__(self, *, message: str = "Connection error.", request: httpx.Request) -> None: + super().__init__(message, request, body=None) + + +class APITimeoutError(APIConnectionError): + def __init__(self, request: httpx.Request) -> None: + super().__init__(message="Request timed out.", request=request) + + +class BadRequestError(APIStatusError): + status_code: Literal[400] = 400 # pyright: ignore[reportIncompatibleVariableOverride] + + +class AuthenticationError(APIStatusError): + status_code: Literal[401] = 401 # pyright: ignore[reportIncompatibleVariableOverride] + + +class PermissionDeniedError(APIStatusError): + status_code: Literal[403] = 403 # pyright: ignore[reportIncompatibleVariableOverride] + + +class NotFoundError(APIStatusError): + status_code: Literal[404] = 404 # pyright: ignore[reportIncompatibleVariableOverride] + + +class ConflictError(APIStatusError): + status_code: Literal[409] = 409 # pyright: ignore[reportIncompatibleVariableOverride] + + +class UnprocessableEntityError(APIStatusError): + status_code: Literal[422] = 422 # pyright: ignore[reportIncompatibleVariableOverride] + + +class RateLimitError(APIStatusError): + status_code: Literal[429] = 429 # pyright: ignore[reportIncompatibleVariableOverride] + + +class InternalServerError(APIStatusError): + pass diff --git a/src/gcore/_files.py b/src/gcore/_files.py new file mode 100644 index 00000000..715cc207 --- /dev/null +++ b/src/gcore/_files.py @@ -0,0 +1,123 @@ +from __future__ import annotations + +import io +import os +import pathlib +from typing import overload +from typing_extensions import TypeGuard + +import anyio + +from ._types import ( + FileTypes, + FileContent, + RequestFiles, + HttpxFileTypes, + Base64FileInput, + HttpxFileContent, + HttpxRequestFiles, +) +from ._utils import is_tuple_t, is_mapping_t, is_sequence_t + + +def is_base64_file_input(obj: object) -> TypeGuard[Base64FileInput]: + return isinstance(obj, io.IOBase) or isinstance(obj, os.PathLike) + + +def is_file_content(obj: object) -> TypeGuard[FileContent]: + return ( + isinstance(obj, bytes) or isinstance(obj, tuple) or isinstance(obj, io.IOBase) or isinstance(obj, os.PathLike) + ) + + +def assert_is_file_content(obj: object, *, key: str | None = None) -> None: + if not is_file_content(obj): + prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`" + raise RuntimeError( + f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead." + ) from None + + +@overload +def to_httpx_files(files: None) -> None: ... + + +@overload +def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... + + +def to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: + if files is None: + return None + + if is_mapping_t(files): + files = {key: _transform_file(file) for key, file in files.items()} + elif is_sequence_t(files): + files = [(key, _transform_file(file)) for key, file in files] + else: + raise TypeError(f"Unexpected file type input {type(files)}, expected mapping or sequence") + + return files + + +def _transform_file(file: FileTypes) -> HttpxFileTypes: + if is_file_content(file): + if isinstance(file, os.PathLike): + path = pathlib.Path(file) + return (path.name, path.read_bytes()) + + return file + + if is_tuple_t(file): + return (file[0], _read_file_content(file[1]), *file[2:]) + + raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") + + +def _read_file_content(file: FileContent) -> HttpxFileContent: + if isinstance(file, os.PathLike): + return pathlib.Path(file).read_bytes() + return file + + +@overload +async def async_to_httpx_files(files: None) -> None: ... + + +@overload +async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... + + +async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: + if files is None: + return None + + if is_mapping_t(files): + files = {key: await _async_transform_file(file) for key, file in files.items()} + elif is_sequence_t(files): + files = [(key, await _async_transform_file(file)) for key, file in files] + else: + raise TypeError("Unexpected file type input {type(files)}, expected mapping or sequence") + + return files + + +async def _async_transform_file(file: FileTypes) -> HttpxFileTypes: + if is_file_content(file): + if isinstance(file, os.PathLike): + path = anyio.Path(file) + return (path.name, await path.read_bytes()) + + return file + + if is_tuple_t(file): + return (file[0], await _async_read_file_content(file[1]), *file[2:]) + + raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") + + +async def _async_read_file_content(file: FileContent) -> HttpxFileContent: + if isinstance(file, os.PathLike): + return await anyio.Path(file).read_bytes() + + return file diff --git a/src/gcore/_models.py b/src/gcore/_models.py new file mode 100644 index 00000000..34935716 --- /dev/null +++ b/src/gcore/_models.py @@ -0,0 +1,804 @@ +from __future__ import annotations + +import os +import inspect +from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast +from datetime import date, datetime +from typing_extensions import ( + Unpack, + Literal, + ClassVar, + Protocol, + Required, + ParamSpec, + TypedDict, + TypeGuard, + final, + override, + runtime_checkable, +) + +import pydantic +import pydantic.generics +from pydantic.fields import FieldInfo + +from ._types import ( + Body, + IncEx, + Query, + ModelT, + Headers, + Timeout, + NotGiven, + AnyMapping, + HttpxRequestFiles, +) +from ._utils import ( + PropertyInfo, + is_list, + is_given, + json_safe, + lru_cache, + is_mapping, + parse_date, + coerce_boolean, + parse_datetime, + strip_not_given, + extract_type_arg, + is_annotated_type, + is_type_alias_type, + strip_annotated_type, +) +from ._compat import ( + PYDANTIC_V2, + ConfigDict, + GenericModel as BaseGenericModel, + get_args, + is_union, + parse_obj, + get_origin, + is_literal_type, + get_model_config, + get_model_fields, + field_get_default, +) +from ._constants import RAW_RESPONSE_HEADER + +if TYPE_CHECKING: + from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema + +__all__ = ["BaseModel", "GenericModel"] + +_T = TypeVar("_T") +_BaseModelT = TypeVar("_BaseModelT", bound="BaseModel") + +P = ParamSpec("P") + + +@runtime_checkable +class _ConfigProtocol(Protocol): + allow_population_by_field_name: bool + + +class BaseModel(pydantic.BaseModel): + if PYDANTIC_V2: + model_config: ClassVar[ConfigDict] = ConfigDict( + extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) + ) + else: + + @property + @override + def model_fields_set(self) -> set[str]: + # a forwards-compat shim for pydantic v2 + return self.__fields_set__ # type: ignore + + class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] + extra: Any = pydantic.Extra.allow # type: ignore + + def to_dict( + self, + *, + mode: Literal["json", "python"] = "python", + use_api_names: bool = True, + exclude_unset: bool = True, + exclude_defaults: bool = False, + exclude_none: bool = False, + warnings: bool = True, + ) -> dict[str, object]: + """Recursively generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + + By default, fields that were not set by the API will not be included, + and keys will match the API response, *not* the property names from the model. + + For example, if the API responds with `"fooBar": true` but we've defined a `foo_bar: bool` property, + the output will use the `"fooBar"` key (unless `use_api_names=False` is passed). + + Args: + mode: + If mode is 'json', the dictionary will only contain JSON serializable types. e.g. `datetime` will be turned into a string, `"2024-3-22T18:11:19.117000Z"`. + If mode is 'python', the dictionary may contain any Python objects. e.g. `datetime(2024, 3, 22)` + + use_api_names: Whether to use the key that the API responded with or the property name. Defaults to `True`. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that are set to their default value from the output. + exclude_none: Whether to exclude fields that have a value of `None` from the output. + warnings: Whether to log warnings when invalid fields are encountered. This is only supported in Pydantic v2. + """ + return self.model_dump( + mode=mode, + by_alias=use_api_names, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + warnings=warnings, + ) + + def to_json( + self, + *, + indent: int | None = 2, + use_api_names: bool = True, + exclude_unset: bool = True, + exclude_defaults: bool = False, + exclude_none: bool = False, + warnings: bool = True, + ) -> str: + """Generates a JSON string representing this model as it would be received from or sent to the API (but with indentation). + + By default, fields that were not set by the API will not be included, + and keys will match the API response, *not* the property names from the model. + + For example, if the API responds with `"fooBar": true` but we've defined a `foo_bar: bool` property, + the output will use the `"fooBar"` key (unless `use_api_names=False` is passed). + + Args: + indent: Indentation to use in the JSON output. If `None` is passed, the output will be compact. Defaults to `2` + use_api_names: Whether to use the key that the API responded with or the property name. Defaults to `True`. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that have the default value. + exclude_none: Whether to exclude fields that have a value of `None`. + warnings: Whether to show any warnings that occurred during serialization. This is only supported in Pydantic v2. + """ + return self.model_dump_json( + indent=indent, + by_alias=use_api_names, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + warnings=warnings, + ) + + @override + def __str__(self) -> str: + # mypy complains about an invalid self arg + return f"{self.__repr_name__()}({self.__repr_str__(', ')})" # type: ignore[misc] + + # Override the 'construct' method in a way that supports recursive parsing without validation. + # Based on https://github.com/samuelcolvin/pydantic/issues/1168#issuecomment-817742836. + @classmethod + @override + def construct( # pyright: ignore[reportIncompatibleMethodOverride] + __cls: Type[ModelT], + _fields_set: set[str] | None = None, + **values: object, + ) -> ModelT: + m = __cls.__new__(__cls) + fields_values: dict[str, object] = {} + + config = get_model_config(__cls) + populate_by_name = ( + config.allow_population_by_field_name + if isinstance(config, _ConfigProtocol) + else config.get("populate_by_name") + ) + + if _fields_set is None: + _fields_set = set() + + model_fields = get_model_fields(__cls) + for name, field in model_fields.items(): + key = field.alias + if key is None or (key not in values and populate_by_name): + key = name + + if key in values: + fields_values[name] = _construct_field(value=values[key], field=field, key=key) + _fields_set.add(name) + else: + fields_values[name] = field_get_default(field) + + _extra = {} + for key, value in values.items(): + if key not in model_fields: + if PYDANTIC_V2: + _extra[key] = value + else: + _fields_set.add(key) + fields_values[key] = value + + object.__setattr__(m, "__dict__", fields_values) + + if PYDANTIC_V2: + # these properties are copied from Pydantic's `model_construct()` method + object.__setattr__(m, "__pydantic_private__", None) + object.__setattr__(m, "__pydantic_extra__", _extra) + object.__setattr__(m, "__pydantic_fields_set__", _fields_set) + else: + # init_private_attributes() does not exist in v2 + m._init_private_attributes() # type: ignore + + # copied from Pydantic v1's `construct()` method + object.__setattr__(m, "__fields_set__", _fields_set) + + return m + + if not TYPE_CHECKING: + # type checkers incorrectly complain about this assignment + # because the type signatures are technically different + # although not in practice + model_construct = construct + + if not PYDANTIC_V2: + # we define aliases for some of the new pydantic v2 methods so + # that we can just document these methods without having to specify + # a specific pydantic version as some users may not know which + # pydantic version they are currently using + + @override + def model_dump( + self, + *, + mode: Literal["json", "python"] | str = "python", + include: IncEx | None = None, + exclude: IncEx | None = None, + by_alias: bool = False, + exclude_unset: bool = False, + exclude_defaults: bool = False, + exclude_none: bool = False, + round_trip: bool = False, + warnings: bool | Literal["none", "warn", "error"] = True, + context: dict[str, Any] | None = None, + serialize_as_any: bool = False, + ) -> dict[str, Any]: + """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump + + Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + + Args: + mode: The mode in which `to_python` should run. + If mode is 'json', the dictionary will only contain JSON serializable types. + If mode is 'python', the dictionary may contain any Python objects. + include: A list of fields to include in the output. + exclude: A list of fields to exclude from the output. + by_alias: Whether to use the field's alias in the dictionary key if defined. + exclude_unset: Whether to exclude fields that are unset or None from the output. + exclude_defaults: Whether to exclude fields that are set to their default value from the output. + exclude_none: Whether to exclude fields that have a value of `None` from the output. + round_trip: Whether to enable serialization and deserialization round-trip support. + warnings: Whether to log warnings when invalid fields are encountered. + + Returns: + A dictionary representation of the model. + """ + if mode not in {"json", "python"}: + raise ValueError("mode must be either 'json' or 'python'") + if round_trip != False: + raise ValueError("round_trip is only supported in Pydantic v2") + if warnings != True: + raise ValueError("warnings is only supported in Pydantic v2") + if context is not None: + raise ValueError("context is only supported in Pydantic v2") + if serialize_as_any != False: + raise ValueError("serialize_as_any is only supported in Pydantic v2") + dumped = super().dict( # pyright: ignore[reportDeprecated] + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + ) + + return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped + + @override + def model_dump_json( + self, + *, + indent: int | None = None, + include: IncEx | None = None, + exclude: IncEx | None = None, + by_alias: bool = False, + exclude_unset: bool = False, + exclude_defaults: bool = False, + exclude_none: bool = False, + round_trip: bool = False, + warnings: bool | Literal["none", "warn", "error"] = True, + context: dict[str, Any] | None = None, + serialize_as_any: bool = False, + ) -> str: + """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json + + Generates a JSON representation of the model using Pydantic's `to_json` method. + + Args: + indent: Indentation to use in the JSON output. If None is passed, the output will be compact. + include: Field(s) to include in the JSON output. Can take either a string or set of strings. + exclude: Field(s) to exclude from the JSON output. Can take either a string or set of strings. + by_alias: Whether to serialize using field aliases. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that have the default value. + exclude_none: Whether to exclude fields that have a value of `None`. + round_trip: Whether to use serialization/deserialization between JSON and class instance. + warnings: Whether to show any warnings that occurred during serialization. + + Returns: + A JSON string representation of the model. + """ + if round_trip != False: + raise ValueError("round_trip is only supported in Pydantic v2") + if warnings != True: + raise ValueError("warnings is only supported in Pydantic v2") + if context is not None: + raise ValueError("context is only supported in Pydantic v2") + if serialize_as_any != False: + raise ValueError("serialize_as_any is only supported in Pydantic v2") + return super().json( # type: ignore[reportDeprecated] + indent=indent, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + ) + + +def _construct_field(value: object, field: FieldInfo, key: str) -> object: + if value is None: + return field_get_default(field) + + if PYDANTIC_V2: + type_ = field.annotation + else: + type_ = cast(type, field.outer_type_) # type: ignore + + if type_ is None: + raise RuntimeError(f"Unexpected field type is None for {key}") + + return construct_type(value=value, type_=type_) + + +def is_basemodel(type_: type) -> bool: + """Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`""" + if is_union(type_): + for variant in get_args(type_): + if is_basemodel(variant): + return True + + return False + + return is_basemodel_type(type_) + + +def is_basemodel_type(type_: type) -> TypeGuard[type[BaseModel] | type[GenericModel]]: + origin = get_origin(type_) or type_ + if not inspect.isclass(origin): + return False + return issubclass(origin, BaseModel) or issubclass(origin, GenericModel) + + +def build( + base_model_cls: Callable[P, _BaseModelT], + *args: P.args, + **kwargs: P.kwargs, +) -> _BaseModelT: + """Construct a BaseModel class without validation. + + This is useful for cases where you need to instantiate a `BaseModel` + from an API response as this provides type-safe params which isn't supported + by helpers like `construct_type()`. + + ```py + build(MyModel, my_field_a="foo", my_field_b=123) + ``` + """ + if args: + raise TypeError( + "Received positional arguments which are not supported; Keyword arguments must be used instead", + ) + + return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs)) + + +def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T: + """Loose coercion to the expected type with construction of nested values. + + Note: the returned value from this function is not guaranteed to match the + given type. + """ + return cast(_T, construct_type(value=value, type_=type_)) + + +def construct_type(*, value: object, type_: object) -> object: + """Loose coercion to the expected type with construction of nested values. + + If the given value does not match the expected type then it is returned as-is. + """ + + # store a reference to the original type we were given before we extract any inner + # types so that we can properly resolve forward references in `TypeAliasType` annotations + original_type = None + + # we allow `object` as the input type because otherwise, passing things like + # `Literal['value']` will be reported as a type error by type checkers + type_ = cast("type[object]", type_) + if is_type_alias_type(type_): + original_type = type_ # type: ignore[unreachable] + type_ = type_.__value__ # type: ignore[unreachable] + + # unwrap `Annotated[T, ...]` -> `T` + if is_annotated_type(type_): + meta: tuple[Any, ...] = get_args(type_)[1:] + type_ = extract_type_arg(type_, 0) + else: + meta = tuple() + + # we need to use the origin class for any types that are subscripted generics + # e.g. Dict[str, object] + origin = get_origin(type_) or type_ + args = get_args(type_) + + if is_union(origin): + try: + return validate_type(type_=cast("type[object]", original_type or type_), value=value) + except Exception: + pass + + # if the type is a discriminated union then we want to construct the right variant + # in the union, even if the data doesn't match exactly, otherwise we'd break code + # that relies on the constructed class types, e.g. + # + # class FooType: + # kind: Literal['foo'] + # value: str + # + # class BarType: + # kind: Literal['bar'] + # value: int + # + # without this block, if the data we get is something like `{'kind': 'bar', 'value': 'foo'}` then + # we'd end up constructing `FooType` when it should be `BarType`. + discriminator = _build_discriminated_union_meta(union=type_, meta_annotations=meta) + if discriminator and is_mapping(value): + variant_value = value.get(discriminator.field_alias_from or discriminator.field_name) + if variant_value and isinstance(variant_value, str): + variant_type = discriminator.mapping.get(variant_value) + if variant_type: + return construct_type(type_=variant_type, value=value) + + # if the data is not valid, use the first variant that doesn't fail while deserializing + for variant in args: + try: + return construct_type(value=value, type_=variant) + except Exception: + continue + + raise RuntimeError(f"Could not convert data into a valid instance of {type_}") + + if origin == dict: + if not is_mapping(value): + return value + + _, items_type = get_args(type_) # Dict[_, items_type] + return {key: construct_type(value=item, type_=items_type) for key, item in value.items()} + + if ( + not is_literal_type(type_) + and inspect.isclass(origin) + and (issubclass(origin, BaseModel) or issubclass(origin, GenericModel)) + ): + if is_list(value): + return [cast(Any, type_).construct(**entry) if is_mapping(entry) else entry for entry in value] + + if is_mapping(value): + if issubclass(type_, BaseModel): + return type_.construct(**value) # type: ignore[arg-type] + + return cast(Any, type_).construct(**value) + + if origin == list: + if not is_list(value): + return value + + inner_type = args[0] # List[inner_type] + return [construct_type(value=entry, type_=inner_type) for entry in value] + + if origin == float: + if isinstance(value, int): + coerced = float(value) + if coerced != value: + return value + return coerced + + return value + + if type_ == datetime: + try: + return parse_datetime(value) # type: ignore + except Exception: + return value + + if type_ == date: + try: + return parse_date(value) # type: ignore + except Exception: + return value + + return value + + +@runtime_checkable +class CachedDiscriminatorType(Protocol): + __discriminator__: DiscriminatorDetails + + +class DiscriminatorDetails: + field_name: str + """The name of the discriminator field in the variant class, e.g. + + ```py + class Foo(BaseModel): + type: Literal['foo'] + ``` + + Will result in field_name='type' + """ + + field_alias_from: str | None + """The name of the discriminator field in the API response, e.g. + + ```py + class Foo(BaseModel): + type: Literal['foo'] = Field(alias='type_from_api') + ``` + + Will result in field_alias_from='type_from_api' + """ + + mapping: dict[str, type] + """Mapping of discriminator value to variant type, e.g. + + {'foo': FooVariant, 'bar': BarVariant} + """ + + def __init__( + self, + *, + mapping: dict[str, type], + discriminator_field: str, + discriminator_alias: str | None, + ) -> None: + self.mapping = mapping + self.field_name = discriminator_field + self.field_alias_from = discriminator_alias + + +def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None: + if isinstance(union, CachedDiscriminatorType): + return union.__discriminator__ + + discriminator_field_name: str | None = None + + for annotation in meta_annotations: + if isinstance(annotation, PropertyInfo) and annotation.discriminator is not None: + discriminator_field_name = annotation.discriminator + break + + if not discriminator_field_name: + return None + + mapping: dict[str, type] = {} + discriminator_alias: str | None = None + + for variant in get_args(union): + variant = strip_annotated_type(variant) + if is_basemodel_type(variant): + if PYDANTIC_V2: + field = _extract_field_schema_pv2(variant, discriminator_field_name) + if not field: + continue + + # Note: if one variant defines an alias then they all should + discriminator_alias = field.get("serialization_alias") + + field_schema = field["schema"] + + if field_schema["type"] == "literal": + for entry in cast("LiteralSchema", field_schema)["expected"]: + if isinstance(entry, str): + mapping[entry] = variant + else: + field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + if not field_info: + continue + + # Note: if one variant defines an alias then they all should + discriminator_alias = field_info.alias + + if field_info.annotation and is_literal_type(field_info.annotation): + for entry in get_args(field_info.annotation): + if isinstance(entry, str): + mapping[entry] = variant + + if not mapping: + return None + + details = DiscriminatorDetails( + mapping=mapping, + discriminator_field=discriminator_field_name, + discriminator_alias=discriminator_alias, + ) + cast(CachedDiscriminatorType, union).__discriminator__ = details + return details + + +def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None: + schema = model.__pydantic_core_schema__ + if schema["type"] == "definitions": + schema = schema["schema"] + + if schema["type"] != "model": + return None + + schema = cast("ModelSchema", schema) + fields_schema = schema["schema"] + if fields_schema["type"] != "model-fields": + return None + + fields_schema = cast("ModelFieldsSchema", fields_schema) + field = fields_schema["fields"].get(field_name) + if not field: + return None + + return cast("ModelField", field) # pyright: ignore[reportUnnecessaryCast] + + +def validate_type(*, type_: type[_T], value: object) -> _T: + """Strict validation that the given value matches the expected type""" + if inspect.isclass(type_) and issubclass(type_, pydantic.BaseModel): + return cast(_T, parse_obj(type_, value)) + + return cast(_T, _validate_non_model_type(type_=type_, value=value)) + + +def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None: + """Add a pydantic config for the given type. + + Note: this is a no-op on Pydantic v1. + """ + setattr(typ, "__pydantic_config__", config) # noqa: B010 + + +# our use of subclassing here causes weirdness for type checkers, +# so we just pretend that we don't subclass +if TYPE_CHECKING: + GenericModel = BaseModel +else: + + class GenericModel(BaseGenericModel, BaseModel): + pass + + +if PYDANTIC_V2: + from pydantic import TypeAdapter as _TypeAdapter + + _CachedTypeAdapter = cast("TypeAdapter[object]", lru_cache(maxsize=None)(_TypeAdapter)) + + if TYPE_CHECKING: + from pydantic import TypeAdapter + else: + TypeAdapter = _CachedTypeAdapter + + def _validate_non_model_type(*, type_: type[_T], value: object) -> _T: + return TypeAdapter(type_).validate_python(value) + +elif not TYPE_CHECKING: # TODO: condition is weird + + class RootModel(GenericModel, Generic[_T]): + """Used as a placeholder to easily convert runtime types to a Pydantic format + to provide validation. + + For example: + ```py + validated = RootModel[int](__root__="5").__root__ + # validated: 5 + ``` + """ + + __root__: _T + + def _validate_non_model_type(*, type_: type[_T], value: object) -> _T: + model = _create_pydantic_model(type_).validate(value) + return cast(_T, model.__root__) + + def _create_pydantic_model(type_: _T) -> Type[RootModel[_T]]: + return RootModel[type_] # type: ignore + + +class FinalRequestOptionsInput(TypedDict, total=False): + method: Required[str] + url: Required[str] + params: Query + headers: Headers + max_retries: int + timeout: float | Timeout | None + files: HttpxRequestFiles | None + idempotency_key: str + json_data: Body + extra_json: AnyMapping + + +@final +class FinalRequestOptions(pydantic.BaseModel): + method: str + url: str + params: Query = {} + headers: Union[Headers, NotGiven] = NotGiven() + max_retries: Union[int, NotGiven] = NotGiven() + timeout: Union[float, Timeout, None, NotGiven] = NotGiven() + files: Union[HttpxRequestFiles, None] = None + idempotency_key: Union[str, None] = None + post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() + + # It should be noted that we cannot use `json` here as that would override + # a BaseModel method in an incompatible fashion. + json_data: Union[Body, None] = None + extra_json: Union[AnyMapping, None] = None + + if PYDANTIC_V2: + model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) + else: + + class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] + arbitrary_types_allowed: bool = True + + def get_max_retries(self, max_retries: int) -> int: + if isinstance(self.max_retries, NotGiven): + return max_retries + return self.max_retries + + def _strip_raw_response_header(self) -> None: + if not is_given(self.headers): + return + + if self.headers.get(RAW_RESPONSE_HEADER): + self.headers = {**self.headers} + self.headers.pop(RAW_RESPONSE_HEADER) + + # override the `construct` method so that we can run custom transformations. + # this is necessary as we don't want to do any actual runtime type checking + # (which means we can't use validators) but we do want to ensure that `NotGiven` + # values are not present + # + # type ignore required because we're adding explicit types to `**values` + @classmethod + def construct( # type: ignore + cls, + _fields_set: set[str] | None = None, + **values: Unpack[FinalRequestOptionsInput], + ) -> FinalRequestOptions: + kwargs: dict[str, Any] = { + # we unconditionally call `strip_not_given` on any value + # as it will just ignore any non-mapping types + key: strip_not_given(value) + for key, value in values.items() + } + if PYDANTIC_V2: + return super().model_construct(_fields_set, **kwargs) + return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated] + + if not TYPE_CHECKING: + # type checkers incorrectly complain about this assignment + model_construct = construct diff --git a/src/gcore/_qs.py b/src/gcore/_qs.py new file mode 100644 index 00000000..274320ca --- /dev/null +++ b/src/gcore/_qs.py @@ -0,0 +1,150 @@ +from __future__ import annotations + +from typing import Any, List, Tuple, Union, Mapping, TypeVar +from urllib.parse import parse_qs, urlencode +from typing_extensions import Literal, get_args + +from ._types import NOT_GIVEN, NotGiven, NotGivenOr +from ._utils import flatten + +_T = TypeVar("_T") + + +ArrayFormat = Literal["comma", "repeat", "indices", "brackets"] +NestedFormat = Literal["dots", "brackets"] + +PrimitiveData = Union[str, int, float, bool, None] +# this should be Data = Union[PrimitiveData, "List[Data]", "Tuple[Data]", "Mapping[str, Data]"] +# https://github.com/microsoft/pyright/issues/3555 +Data = Union[PrimitiveData, List[Any], Tuple[Any], "Mapping[str, Any]"] +Params = Mapping[str, Data] + + +class Querystring: + array_format: ArrayFormat + nested_format: NestedFormat + + def __init__( + self, + *, + array_format: ArrayFormat = "repeat", + nested_format: NestedFormat = "brackets", + ) -> None: + self.array_format = array_format + self.nested_format = nested_format + + def parse(self, query: str) -> Mapping[str, object]: + # Note: custom format syntax is not supported yet + return parse_qs(query) + + def stringify( + self, + params: Params, + *, + array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, + nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + ) -> str: + return urlencode( + self.stringify_items( + params, + array_format=array_format, + nested_format=nested_format, + ) + ) + + def stringify_items( + self, + params: Params, + *, + array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, + nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + ) -> list[tuple[str, str]]: + opts = Options( + qs=self, + array_format=array_format, + nested_format=nested_format, + ) + return flatten([self._stringify_item(key, value, opts) for key, value in params.items()]) + + def _stringify_item( + self, + key: str, + value: Data, + opts: Options, + ) -> list[tuple[str, str]]: + if isinstance(value, Mapping): + items: list[tuple[str, str]] = [] + nested_format = opts.nested_format + for subkey, subvalue in value.items(): + items.extend( + self._stringify_item( + # TODO: error if unknown format + f"{key}.{subkey}" if nested_format == "dots" else f"{key}[{subkey}]", + subvalue, + opts, + ) + ) + return items + + if isinstance(value, (list, tuple)): + array_format = opts.array_format + if array_format == "comma": + return [ + ( + key, + ",".join(self._primitive_value_to_str(item) for item in value if item is not None), + ), + ] + elif array_format == "repeat": + items = [] + for item in value: + items.extend(self._stringify_item(key, item, opts)) + return items + elif array_format == "indices": + raise NotImplementedError("The array indices format is not supported yet") + elif array_format == "brackets": + items = [] + key = key + "[]" + for item in value: + items.extend(self._stringify_item(key, item, opts)) + return items + else: + raise NotImplementedError( + f"Unknown array_format value: {array_format}, choose from {', '.join(get_args(ArrayFormat))}" + ) + + serialised = self._primitive_value_to_str(value) + if not serialised: + return [] + return [(key, serialised)] + + def _primitive_value_to_str(self, value: PrimitiveData) -> str: + # copied from httpx + if value is True: + return "true" + elif value is False: + return "false" + elif value is None: + return "" + return str(value) + + +_qs = Querystring() +parse = _qs.parse +stringify = _qs.stringify +stringify_items = _qs.stringify_items + + +class Options: + array_format: ArrayFormat + nested_format: NestedFormat + + def __init__( + self, + qs: Querystring = _qs, + *, + array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, + nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + ) -> None: + self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format + self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format diff --git a/src/gcore/_resource.py b/src/gcore/_resource.py new file mode 100644 index 00000000..4bfc5b68 --- /dev/null +++ b/src/gcore/_resource.py @@ -0,0 +1,43 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import time +from typing import TYPE_CHECKING + +import anyio + +if TYPE_CHECKING: + from ._client import Gcore, AsyncGcore + + +class SyncAPIResource: + _client: Gcore + + def __init__(self, client: Gcore) -> None: + self._client = client + self._get = client.get + self._post = client.post + self._patch = client.patch + self._put = client.put + self._delete = client.delete + self._get_api_list = client.get_api_list + + def _sleep(self, seconds: float) -> None: + time.sleep(seconds) + + +class AsyncAPIResource: + _client: AsyncGcore + + def __init__(self, client: AsyncGcore) -> None: + self._client = client + self._get = client.get + self._post = client.post + self._patch = client.patch + self._put = client.put + self._delete = client.delete + self._get_api_list = client.get_api_list + + async def _sleep(self, seconds: float) -> None: + await anyio.sleep(seconds) diff --git a/src/gcore/_response.py b/src/gcore/_response.py new file mode 100644 index 00000000..ddab201d --- /dev/null +++ b/src/gcore/_response.py @@ -0,0 +1,830 @@ +from __future__ import annotations + +import os +import inspect +import logging +import datetime +import functools +from types import TracebackType +from typing import ( + TYPE_CHECKING, + Any, + Union, + Generic, + TypeVar, + Callable, + Iterator, + AsyncIterator, + cast, + overload, +) +from typing_extensions import Awaitable, ParamSpec, override, get_origin + +import anyio +import httpx +import pydantic + +from ._types import NoneType +from ._utils import is_given, extract_type_arg, is_annotated_type, is_type_alias_type, extract_type_var_from_base +from ._models import BaseModel, is_basemodel +from ._constants import RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER +from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type +from ._exceptions import GcoreError, APIResponseValidationError + +if TYPE_CHECKING: + from ._models import FinalRequestOptions + from ._base_client import BaseClient + + +P = ParamSpec("P") +R = TypeVar("R") +_T = TypeVar("_T") +_APIResponseT = TypeVar("_APIResponseT", bound="APIResponse[Any]") +_AsyncAPIResponseT = TypeVar("_AsyncAPIResponseT", bound="AsyncAPIResponse[Any]") + +log: logging.Logger = logging.getLogger(__name__) + + +class BaseAPIResponse(Generic[R]): + _cast_to: type[R] + _client: BaseClient[Any, Any] + _parsed_by_type: dict[type[Any], Any] + _is_sse_stream: bool + _stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None + _options: FinalRequestOptions + + http_response: httpx.Response + + retries_taken: int + """The number of retries made. If no retries happened this will be `0`""" + + def __init__( + self, + *, + raw: httpx.Response, + cast_to: type[R], + client: BaseClient[Any, Any], + stream: bool, + stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, + options: FinalRequestOptions, + retries_taken: int = 0, + ) -> None: + self._cast_to = cast_to + self._client = client + self._parsed_by_type = {} + self._is_sse_stream = stream + self._stream_cls = stream_cls + self._options = options + self.http_response = raw + self.retries_taken = retries_taken + + @property + def headers(self) -> httpx.Headers: + return self.http_response.headers + + @property + def http_request(self) -> httpx.Request: + """Returns the httpx Request instance associated with the current response.""" + return self.http_response.request + + @property + def status_code(self) -> int: + return self.http_response.status_code + + @property + def url(self) -> httpx.URL: + """Returns the URL for which the request was made.""" + return self.http_response.url + + @property + def method(self) -> str: + return self.http_request.method + + @property + def http_version(self) -> str: + return self.http_response.http_version + + @property + def elapsed(self) -> datetime.timedelta: + """The time taken for the complete request/response cycle to complete.""" + return self.http_response.elapsed + + @property + def is_closed(self) -> bool: + """Whether or not the response body has been closed. + + If this is False then there is response data that has not been read yet. + You must either fully consume the response body or call `.close()` + before discarding the response to prevent resource leaks. + """ + return self.http_response.is_closed + + @override + def __repr__(self) -> str: + return ( + f"<{self.__class__.__name__} [{self.status_code} {self.http_response.reason_phrase}] type={self._cast_to}>" + ) + + def _parse(self, *, to: type[_T] | None = None) -> R | _T: + cast_to = to if to is not None else self._cast_to + + # unwrap `TypeAlias('Name', T)` -> `T` + if is_type_alias_type(cast_to): + cast_to = cast_to.__value__ # type: ignore[unreachable] + + # unwrap `Annotated[T, ...]` -> `T` + if cast_to and is_annotated_type(cast_to): + cast_to = extract_type_arg(cast_to, 0) + + origin = get_origin(cast_to) or cast_to + + if self._is_sse_stream: + if to: + if not is_stream_class_type(to): + raise TypeError(f"Expected custom parse type to be a subclass of {Stream} or {AsyncStream}") + + return cast( + _T, + to( + cast_to=extract_stream_chunk_type( + to, + failure_message="Expected custom stream type to be passed with a type argument, e.g. Stream[ChunkType]", + ), + response=self.http_response, + client=cast(Any, self._client), + ), + ) + + if self._stream_cls: + return cast( + R, + self._stream_cls( + cast_to=extract_stream_chunk_type(self._stream_cls), + response=self.http_response, + client=cast(Any, self._client), + ), + ) + + stream_cls = cast("type[Stream[Any]] | type[AsyncStream[Any]] | None", self._client._default_stream_cls) + if stream_cls is None: + raise MissingStreamClassError() + + return cast( + R, + stream_cls( + cast_to=cast_to, + response=self.http_response, + client=cast(Any, self._client), + ), + ) + + if cast_to is NoneType: + return cast(R, None) + + response = self.http_response + if cast_to == str: + return cast(R, response.text) + + if cast_to == bytes: + return cast(R, response.content) + + if cast_to == int: + return cast(R, int(response.text)) + + if cast_to == float: + return cast(R, float(response.text)) + + if cast_to == bool: + return cast(R, response.text.lower() == "true") + + if origin == APIResponse: + raise RuntimeError("Unexpected state - cast_to is `APIResponse`") + + if inspect.isclass(origin) and issubclass(origin, httpx.Response): + # Because of the invariance of our ResponseT TypeVar, users can subclass httpx.Response + # and pass that class to our request functions. We cannot change the variance to be either + # covariant or contravariant as that makes our usage of ResponseT illegal. We could construct + # the response class ourselves but that is something that should be supported directly in httpx + # as it would be easy to incorrectly construct the Response object due to the multitude of arguments. + if cast_to != httpx.Response: + raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`") + return cast(R, response) + + if ( + inspect.isclass( + origin # pyright: ignore[reportUnknownArgumentType] + ) + and not issubclass(origin, BaseModel) + and issubclass(origin, pydantic.BaseModel) + ): + raise TypeError("Pydantic models must subclass our base model type, e.g. `from gcore import BaseModel`") + + if ( + cast_to is not object + and not origin is list + and not origin is dict + and not origin is Union + and not issubclass(origin, BaseModel) + ): + raise RuntimeError( + f"Unsupported type, expected {cast_to} to be a subclass of {BaseModel}, {dict}, {list}, {Union}, {NoneType}, {str} or {httpx.Response}." + ) + + # split is required to handle cases where additional information is included + # in the response, e.g. application/json; charset=utf-8 + content_type, *_ = response.headers.get("content-type", "*").split(";") + if content_type != "application/json": + if is_basemodel(cast_to): + try: + data = response.json() + except Exception as exc: + log.debug("Could not read JSON from response data due to %s - %s", type(exc), exc) + else: + return self._client._process_response_data( + data=data, + cast_to=cast_to, # type: ignore + response=response, + ) + + if self._client._strict_response_validation: + raise APIResponseValidationError( + response=response, + message=f"Expected Content-Type response header to be `application/json` but received `{content_type}` instead.", + body=response.text, + ) + + # If the API responds with content that isn't JSON then we just return + # the (decoded) text without performing any parsing so that you can still + # handle the response however you need to. + return response.text # type: ignore + + data = response.json() + + return self._client._process_response_data( + data=data, + cast_to=cast_to, # type: ignore + response=response, + ) + + +class APIResponse(BaseAPIResponse[R]): + @overload + def parse(self, *, to: type[_T]) -> _T: ... + + @overload + def parse(self) -> R: ... + + def parse(self, *, to: type[_T] | None = None) -> R | _T: + """Returns the rich python representation of this response's data. + + For lower-level control, see `.read()`, `.json()`, `.iter_bytes()`. + + You can customise the type that the response is parsed into through + the `to` argument, e.g. + + ```py + from gcore import BaseModel + + + class MyModel(BaseModel): + foo: str + + + obj = response.parse(to=MyModel) + print(obj.foo) + ``` + + We support parsing: + - `BaseModel` + - `dict` + - `list` + - `Union` + - `str` + - `int` + - `float` + - `httpx.Response` + """ + cache_key = to if to is not None else self._cast_to + cached = self._parsed_by_type.get(cache_key) + if cached is not None: + return cached # type: ignore[no-any-return] + + if not self._is_sse_stream: + self.read() + + parsed = self._parse(to=to) + if is_given(self._options.post_parser): + parsed = self._options.post_parser(parsed) + + self._parsed_by_type[cache_key] = parsed + return parsed + + def read(self) -> bytes: + """Read and return the binary response content.""" + try: + return self.http_response.read() + except httpx.StreamConsumed as exc: + # The default error raised by httpx isn't very + # helpful in our case so we re-raise it with + # a different error message. + raise StreamAlreadyConsumed() from exc + + def text(self) -> str: + """Read and decode the response content into a string.""" + self.read() + return self.http_response.text + + def json(self) -> object: + """Read and decode the JSON response content.""" + self.read() + return self.http_response.json() + + def close(self) -> None: + """Close the response and release the connection. + + Automatically called if the response body is read to completion. + """ + self.http_response.close() + + def iter_bytes(self, chunk_size: int | None = None) -> Iterator[bytes]: + """ + A byte-iterator over the decoded response content. + + This automatically handles gzip, deflate and brotli encoded responses. + """ + for chunk in self.http_response.iter_bytes(chunk_size): + yield chunk + + def iter_text(self, chunk_size: int | None = None) -> Iterator[str]: + """A str-iterator over the decoded response content + that handles both gzip, deflate, etc but also detects the content's + string encoding. + """ + for chunk in self.http_response.iter_text(chunk_size): + yield chunk + + def iter_lines(self) -> Iterator[str]: + """Like `iter_text()` but will only yield chunks for each line""" + for chunk in self.http_response.iter_lines(): + yield chunk + + +class AsyncAPIResponse(BaseAPIResponse[R]): + @overload + async def parse(self, *, to: type[_T]) -> _T: ... + + @overload + async def parse(self) -> R: ... + + async def parse(self, *, to: type[_T] | None = None) -> R | _T: + """Returns the rich python representation of this response's data. + + For lower-level control, see `.read()`, `.json()`, `.iter_bytes()`. + + You can customise the type that the response is parsed into through + the `to` argument, e.g. + + ```py + from gcore import BaseModel + + + class MyModel(BaseModel): + foo: str + + + obj = response.parse(to=MyModel) + print(obj.foo) + ``` + + We support parsing: + - `BaseModel` + - `dict` + - `list` + - `Union` + - `str` + - `httpx.Response` + """ + cache_key = to if to is not None else self._cast_to + cached = self._parsed_by_type.get(cache_key) + if cached is not None: + return cached # type: ignore[no-any-return] + + if not self._is_sse_stream: + await self.read() + + parsed = self._parse(to=to) + if is_given(self._options.post_parser): + parsed = self._options.post_parser(parsed) + + self._parsed_by_type[cache_key] = parsed + return parsed + + async def read(self) -> bytes: + """Read and return the binary response content.""" + try: + return await self.http_response.aread() + except httpx.StreamConsumed as exc: + # the default error raised by httpx isn't very + # helpful in our case so we re-raise it with + # a different error message + raise StreamAlreadyConsumed() from exc + + async def text(self) -> str: + """Read and decode the response content into a string.""" + await self.read() + return self.http_response.text + + async def json(self) -> object: + """Read and decode the JSON response content.""" + await self.read() + return self.http_response.json() + + async def close(self) -> None: + """Close the response and release the connection. + + Automatically called if the response body is read to completion. + """ + await self.http_response.aclose() + + async def iter_bytes(self, chunk_size: int | None = None) -> AsyncIterator[bytes]: + """ + A byte-iterator over the decoded response content. + + This automatically handles gzip, deflate and brotli encoded responses. + """ + async for chunk in self.http_response.aiter_bytes(chunk_size): + yield chunk + + async def iter_text(self, chunk_size: int | None = None) -> AsyncIterator[str]: + """A str-iterator over the decoded response content + that handles both gzip, deflate, etc but also detects the content's + string encoding. + """ + async for chunk in self.http_response.aiter_text(chunk_size): + yield chunk + + async def iter_lines(self) -> AsyncIterator[str]: + """Like `iter_text()` but will only yield chunks for each line""" + async for chunk in self.http_response.aiter_lines(): + yield chunk + + +class BinaryAPIResponse(APIResponse[bytes]): + """Subclass of APIResponse providing helpers for dealing with binary data. + + Note: If you want to stream the response data instead of eagerly reading it + all at once then you should use `.with_streaming_response` when making + the API request, e.g. `.with_streaming_response.get_binary_response()` + """ + + def write_to_file( + self, + file: str | os.PathLike[str], + ) -> None: + """Write the output to the given file. + + Accepts a filename or any path-like object, e.g. pathlib.Path + + Note: if you want to stream the data to the file instead of writing + all at once then you should use `.with_streaming_response` when making + the API request, e.g. `.with_streaming_response.get_binary_response()` + """ + with open(file, mode="wb") as f: + for data in self.iter_bytes(): + f.write(data) + + +class AsyncBinaryAPIResponse(AsyncAPIResponse[bytes]): + """Subclass of APIResponse providing helpers for dealing with binary data. + + Note: If you want to stream the response data instead of eagerly reading it + all at once then you should use `.with_streaming_response` when making + the API request, e.g. `.with_streaming_response.get_binary_response()` + """ + + async def write_to_file( + self, + file: str | os.PathLike[str], + ) -> None: + """Write the output to the given file. + + Accepts a filename or any path-like object, e.g. pathlib.Path + + Note: if you want to stream the data to the file instead of writing + all at once then you should use `.with_streaming_response` when making + the API request, e.g. `.with_streaming_response.get_binary_response()` + """ + path = anyio.Path(file) + async with await path.open(mode="wb") as f: + async for data in self.iter_bytes(): + await f.write(data) + + +class StreamedBinaryAPIResponse(APIResponse[bytes]): + def stream_to_file( + self, + file: str | os.PathLike[str], + *, + chunk_size: int | None = None, + ) -> None: + """Streams the output to the given file. + + Accepts a filename or any path-like object, e.g. pathlib.Path + """ + with open(file, mode="wb") as f: + for data in self.iter_bytes(chunk_size): + f.write(data) + + +class AsyncStreamedBinaryAPIResponse(AsyncAPIResponse[bytes]): + async def stream_to_file( + self, + file: str | os.PathLike[str], + *, + chunk_size: int | None = None, + ) -> None: + """Streams the output to the given file. + + Accepts a filename or any path-like object, e.g. pathlib.Path + """ + path = anyio.Path(file) + async with await path.open(mode="wb") as f: + async for data in self.iter_bytes(chunk_size): + await f.write(data) + + +class MissingStreamClassError(TypeError): + def __init__(self) -> None: + super().__init__( + "The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `gcore._streaming` for reference", + ) + + +class StreamAlreadyConsumed(GcoreError): + """ + Attempted to read or stream content, but the content has already + been streamed. + + This can happen if you use a method like `.iter_lines()` and then attempt + to read th entire response body afterwards, e.g. + + ```py + response = await client.post(...) + async for line in response.iter_lines(): + ... # do something with `line` + + content = await response.read() + # ^ error + ``` + + If you want this behaviour you'll need to either manually accumulate the response + content or call `await response.read()` before iterating over the stream. + """ + + def __init__(self) -> None: + message = ( + "Attempted to read or stream some content, but the content has " + "already been streamed. " + "This could be due to attempting to stream the response " + "content more than once." + "\n\n" + "You can fix this by manually accumulating the response content while streaming " + "or by calling `.read()` before starting to stream." + ) + super().__init__(message) + + +class ResponseContextManager(Generic[_APIResponseT]): + """Context manager for ensuring that a request is not made + until it is entered and that the response will always be closed + when the context manager exits + """ + + def __init__(self, request_func: Callable[[], _APIResponseT]) -> None: + self._request_func = request_func + self.__response: _APIResponseT | None = None + + def __enter__(self) -> _APIResponseT: + self.__response = self._request_func() + return self.__response + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + if self.__response is not None: + self.__response.close() + + +class AsyncResponseContextManager(Generic[_AsyncAPIResponseT]): + """Context manager for ensuring that a request is not made + until it is entered and that the response will always be closed + when the context manager exits + """ + + def __init__(self, api_request: Awaitable[_AsyncAPIResponseT]) -> None: + self._api_request = api_request + self.__response: _AsyncAPIResponseT | None = None + + async def __aenter__(self) -> _AsyncAPIResponseT: + self.__response = await self._api_request + return self.__response + + async def __aexit__( + self, + exc_type: type[BaseException] | None, + exc: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + if self.__response is not None: + await self.__response.close() + + +def to_streamed_response_wrapper(func: Callable[P, R]) -> Callable[P, ResponseContextManager[APIResponse[R]]]: + """Higher order function that takes one of our bound API methods and wraps it + to support streaming and returning the raw `APIResponse` object directly. + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> ResponseContextManager[APIResponse[R]]: + extra_headers: dict[str, str] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "stream" + + kwargs["extra_headers"] = extra_headers + + make_request = functools.partial(func, *args, **kwargs) + + return ResponseContextManager(cast(Callable[[], APIResponse[R]], make_request)) + + return wrapped + + +def async_to_streamed_response_wrapper( + func: Callable[P, Awaitable[R]], +) -> Callable[P, AsyncResponseContextManager[AsyncAPIResponse[R]]]: + """Higher order function that takes one of our bound API methods and wraps it + to support streaming and returning the raw `APIResponse` object directly. + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> AsyncResponseContextManager[AsyncAPIResponse[R]]: + extra_headers: dict[str, str] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "stream" + + kwargs["extra_headers"] = extra_headers + + make_request = func(*args, **kwargs) + + return AsyncResponseContextManager(cast(Awaitable[AsyncAPIResponse[R]], make_request)) + + return wrapped + + +def to_custom_streamed_response_wrapper( + func: Callable[P, object], + response_cls: type[_APIResponseT], +) -> Callable[P, ResponseContextManager[_APIResponseT]]: + """Higher order function that takes one of our bound API methods and an `APIResponse` class + and wraps the method to support streaming and returning the given response class directly. + + Note: the given `response_cls` *must* be concrete, e.g. `class BinaryAPIResponse(APIResponse[bytes])` + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> ResponseContextManager[_APIResponseT]: + extra_headers: dict[str, Any] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "stream" + extra_headers[OVERRIDE_CAST_TO_HEADER] = response_cls + + kwargs["extra_headers"] = extra_headers + + make_request = functools.partial(func, *args, **kwargs) + + return ResponseContextManager(cast(Callable[[], _APIResponseT], make_request)) + + return wrapped + + +def async_to_custom_streamed_response_wrapper( + func: Callable[P, Awaitable[object]], + response_cls: type[_AsyncAPIResponseT], +) -> Callable[P, AsyncResponseContextManager[_AsyncAPIResponseT]]: + """Higher order function that takes one of our bound API methods and an `APIResponse` class + and wraps the method to support streaming and returning the given response class directly. + + Note: the given `response_cls` *must* be concrete, e.g. `class BinaryAPIResponse(APIResponse[bytes])` + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> AsyncResponseContextManager[_AsyncAPIResponseT]: + extra_headers: dict[str, Any] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "stream" + extra_headers[OVERRIDE_CAST_TO_HEADER] = response_cls + + kwargs["extra_headers"] = extra_headers + + make_request = func(*args, **kwargs) + + return AsyncResponseContextManager(cast(Awaitable[_AsyncAPIResponseT], make_request)) + + return wrapped + + +def to_raw_response_wrapper(func: Callable[P, R]) -> Callable[P, APIResponse[R]]: + """Higher order function that takes one of our bound API methods and wraps it + to support returning the raw `APIResponse` object directly. + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> APIResponse[R]: + extra_headers: dict[str, str] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "raw" + + kwargs["extra_headers"] = extra_headers + + return cast(APIResponse[R], func(*args, **kwargs)) + + return wrapped + + +def async_to_raw_response_wrapper(func: Callable[P, Awaitable[R]]) -> Callable[P, Awaitable[AsyncAPIResponse[R]]]: + """Higher order function that takes one of our bound API methods and wraps it + to support returning the raw `APIResponse` object directly. + """ + + @functools.wraps(func) + async def wrapped(*args: P.args, **kwargs: P.kwargs) -> AsyncAPIResponse[R]: + extra_headers: dict[str, str] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "raw" + + kwargs["extra_headers"] = extra_headers + + return cast(AsyncAPIResponse[R], await func(*args, **kwargs)) + + return wrapped + + +def to_custom_raw_response_wrapper( + func: Callable[P, object], + response_cls: type[_APIResponseT], +) -> Callable[P, _APIResponseT]: + """Higher order function that takes one of our bound API methods and an `APIResponse` class + and wraps the method to support returning the given response class directly. + + Note: the given `response_cls` *must* be concrete, e.g. `class BinaryAPIResponse(APIResponse[bytes])` + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> _APIResponseT: + extra_headers: dict[str, Any] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "raw" + extra_headers[OVERRIDE_CAST_TO_HEADER] = response_cls + + kwargs["extra_headers"] = extra_headers + + return cast(_APIResponseT, func(*args, **kwargs)) + + return wrapped + + +def async_to_custom_raw_response_wrapper( + func: Callable[P, Awaitable[object]], + response_cls: type[_AsyncAPIResponseT], +) -> Callable[P, Awaitable[_AsyncAPIResponseT]]: + """Higher order function that takes one of our bound API methods and an `APIResponse` class + and wraps the method to support returning the given response class directly. + + Note: the given `response_cls` *must* be concrete, e.g. `class BinaryAPIResponse(APIResponse[bytes])` + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> Awaitable[_AsyncAPIResponseT]: + extra_headers: dict[str, Any] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "raw" + extra_headers[OVERRIDE_CAST_TO_HEADER] = response_cls + + kwargs["extra_headers"] = extra_headers + + return cast(Awaitable[_AsyncAPIResponseT], func(*args, **kwargs)) + + return wrapped + + +def extract_response_type(typ: type[BaseAPIResponse[Any]]) -> type: + """Given a type like `APIResponse[T]`, returns the generic type variable `T`. + + This also handles the case where a concrete subclass is given, e.g. + ```py + class MyResponse(APIResponse[bytes]): + ... + + extract_response_type(MyResponse) -> bytes + ``` + """ + return extract_type_var_from_base( + typ, + generic_bases=cast("tuple[type, ...]", (BaseAPIResponse, APIResponse, AsyncAPIResponse)), + index=0, + ) diff --git a/src/gcore/_streaming.py b/src/gcore/_streaming.py new file mode 100644 index 00000000..bf3046cf --- /dev/null +++ b/src/gcore/_streaming.py @@ -0,0 +1,333 @@ +# Note: initially copied from https://github.com/florimondmanca/httpx-sse/blob/master/src/httpx_sse/_decoders.py +from __future__ import annotations + +import json +import inspect +from types import TracebackType +from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, AsyncIterator, cast +from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable + +import httpx + +from ._utils import extract_type_var_from_base + +if TYPE_CHECKING: + from ._client import Gcore, AsyncGcore + + +_T = TypeVar("_T") + + +class Stream(Generic[_T]): + """Provides the core interface to iterate over a synchronous stream response.""" + + response: httpx.Response + + _decoder: SSEBytesDecoder + + def __init__( + self, + *, + cast_to: type[_T], + response: httpx.Response, + client: Gcore, + ) -> None: + self.response = response + self._cast_to = cast_to + self._client = client + self._decoder = client._make_sse_decoder() + self._iterator = self.__stream__() + + def __next__(self) -> _T: + return self._iterator.__next__() + + def __iter__(self) -> Iterator[_T]: + for item in self._iterator: + yield item + + def _iter_events(self) -> Iterator[ServerSentEvent]: + yield from self._decoder.iter_bytes(self.response.iter_bytes()) + + def __stream__(self) -> Iterator[_T]: + cast_to = cast(Any, self._cast_to) + response = self.response + process_data = self._client._process_response_data + iterator = self._iter_events() + + for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + + # Ensure the entire stream is consumed + for _sse in iterator: + ... + + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + self.close() + + def close(self) -> None: + """ + Close the response and release the connection. + + Automatically called if the response body is read to completion. + """ + self.response.close() + + +class AsyncStream(Generic[_T]): + """Provides the core interface to iterate over an asynchronous stream response.""" + + response: httpx.Response + + _decoder: SSEDecoder | SSEBytesDecoder + + def __init__( + self, + *, + cast_to: type[_T], + response: httpx.Response, + client: AsyncGcore, + ) -> None: + self.response = response + self._cast_to = cast_to + self._client = client + self._decoder = client._make_sse_decoder() + self._iterator = self.__stream__() + + async def __anext__(self) -> _T: + return await self._iterator.__anext__() + + async def __aiter__(self) -> AsyncIterator[_T]: + async for item in self._iterator: + yield item + + async def _iter_events(self) -> AsyncIterator[ServerSentEvent]: + async for sse in self._decoder.aiter_bytes(self.response.aiter_bytes()): + yield sse + + async def __stream__(self) -> AsyncIterator[_T]: + cast_to = cast(Any, self._cast_to) + response = self.response + process_data = self._client._process_response_data + iterator = self._iter_events() + + async for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + + # Ensure the entire stream is consumed + async for _sse in iterator: + ... + + async def __aenter__(self) -> Self: + return self + + async def __aexit__( + self, + exc_type: type[BaseException] | None, + exc: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + await self.close() + + async def close(self) -> None: + """ + Close the response and release the connection. + + Automatically called if the response body is read to completion. + """ + await self.response.aclose() + + +class ServerSentEvent: + def __init__( + self, + *, + event: str | None = None, + data: str | None = None, + id: str | None = None, + retry: int | None = None, + ) -> None: + if data is None: + data = "" + + self._id = id + self._data = data + self._event = event or None + self._retry = retry + + @property + def event(self) -> str | None: + return self._event + + @property + def id(self) -> str | None: + return self._id + + @property + def retry(self) -> int | None: + return self._retry + + @property + def data(self) -> str: + return self._data + + def json(self) -> Any: + return json.loads(self.data) + + @override + def __repr__(self) -> str: + return f"ServerSentEvent(event={self.event}, data={self.data}, id={self.id}, retry={self.retry})" + + +class SSEDecoder: + _data: list[str] + _event: str | None + _retry: int | None + _last_event_id: str | None + + def __init__(self) -> None: + self._event = None + self._data = [] + self._last_event_id = None + self._retry = None + + def iter_bytes(self, iterator: Iterator[bytes]) -> Iterator[ServerSentEvent]: + """Given an iterator that yields raw binary data, iterate over it & yield every event encountered""" + for chunk in self._iter_chunks(iterator): + # Split before decoding so splitlines() only uses \r and \n + for raw_line in chunk.splitlines(): + line = raw_line.decode("utf-8") + sse = self.decode(line) + if sse: + yield sse + + def _iter_chunks(self, iterator: Iterator[bytes]) -> Iterator[bytes]: + """Given an iterator that yields raw binary data, iterate over it and yield individual SSE chunks""" + data = b"" + for chunk in iterator: + for line in chunk.splitlines(keepends=True): + data += line + if data.endswith((b"\r\r", b"\n\n", b"\r\n\r\n")): + yield data + data = b"" + if data: + yield data + + async def aiter_bytes(self, iterator: AsyncIterator[bytes]) -> AsyncIterator[ServerSentEvent]: + """Given an iterator that yields raw binary data, iterate over it & yield every event encountered""" + async for chunk in self._aiter_chunks(iterator): + # Split before decoding so splitlines() only uses \r and \n + for raw_line in chunk.splitlines(): + line = raw_line.decode("utf-8") + sse = self.decode(line) + if sse: + yield sse + + async def _aiter_chunks(self, iterator: AsyncIterator[bytes]) -> AsyncIterator[bytes]: + """Given an iterator that yields raw binary data, iterate over it and yield individual SSE chunks""" + data = b"" + async for chunk in iterator: + for line in chunk.splitlines(keepends=True): + data += line + if data.endswith((b"\r\r", b"\n\n", b"\r\n\r\n")): + yield data + data = b"" + if data: + yield data + + def decode(self, line: str) -> ServerSentEvent | None: + # See: https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation # noqa: E501 + + if not line: + if not self._event and not self._data and not self._last_event_id and self._retry is None: + return None + + sse = ServerSentEvent( + event=self._event, + data="\n".join(self._data), + id=self._last_event_id, + retry=self._retry, + ) + + # NOTE: as per the SSE spec, do not reset last_event_id. + self._event = None + self._data = [] + self._retry = None + + return sse + + if line.startswith(":"): + return None + + fieldname, _, value = line.partition(":") + + if value.startswith(" "): + value = value[1:] + + if fieldname == "event": + self._event = value + elif fieldname == "data": + self._data.append(value) + elif fieldname == "id": + if "\0" in value: + pass + else: + self._last_event_id = value + elif fieldname == "retry": + try: + self._retry = int(value) + except (TypeError, ValueError): + pass + else: + pass # Field is ignored. + + return None + + +@runtime_checkable +class SSEBytesDecoder(Protocol): + def iter_bytes(self, iterator: Iterator[bytes]) -> Iterator[ServerSentEvent]: + """Given an iterator that yields raw binary data, iterate over it & yield every event encountered""" + ... + + def aiter_bytes(self, iterator: AsyncIterator[bytes]) -> AsyncIterator[ServerSentEvent]: + """Given an async iterator that yields raw binary data, iterate over it & yield every event encountered""" + ... + + +def is_stream_class_type(typ: type) -> TypeGuard[type[Stream[object]] | type[AsyncStream[object]]]: + """TypeGuard for determining whether or not the given type is a subclass of `Stream` / `AsyncStream`""" + origin = get_origin(typ) or typ + return inspect.isclass(origin) and issubclass(origin, (Stream, AsyncStream)) + + +def extract_stream_chunk_type( + stream_cls: type, + *, + failure_message: str | None = None, +) -> type: + """Given a type like `Stream[T]`, returns the generic type variable `T`. + + This also handles the case where a concrete subclass is given, e.g. + ```py + class MyStream(Stream[bytes]): + ... + + extract_stream_chunk_type(MyStream) -> bytes + ``` + """ + from ._base_client import Stream, AsyncStream + + return extract_type_var_from_base( + stream_cls, + index=0, + generic_bases=cast("tuple[type, ...]", (Stream, AsyncStream)), + failure_message=failure_message, + ) diff --git a/src/gcore/_types.py b/src/gcore/_types.py new file mode 100644 index 00000000..7a34e342 --- /dev/null +++ b/src/gcore/_types.py @@ -0,0 +1,217 @@ +from __future__ import annotations + +from os import PathLike +from typing import ( + IO, + TYPE_CHECKING, + Any, + Dict, + List, + Type, + Tuple, + Union, + Mapping, + TypeVar, + Callable, + Optional, + Sequence, +) +from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable + +import httpx +import pydantic +from httpx import URL, Proxy, Timeout, Response, BaseTransport, AsyncBaseTransport + +if TYPE_CHECKING: + from ._models import BaseModel + from ._response import APIResponse, AsyncAPIResponse + +Transport = BaseTransport +AsyncTransport = AsyncBaseTransport +Query = Mapping[str, object] +Body = object +AnyMapping = Mapping[str, object] +ModelT = TypeVar("ModelT", bound=pydantic.BaseModel) +_T = TypeVar("_T") + + +# Approximates httpx internal ProxiesTypes and RequestFiles types +# while adding support for `PathLike` instances +ProxiesDict = Dict["str | URL", Union[None, str, URL, Proxy]] +ProxiesTypes = Union[str, Proxy, ProxiesDict] +if TYPE_CHECKING: + Base64FileInput = Union[IO[bytes], PathLike[str]] + FileContent = Union[IO[bytes], bytes, PathLike[str]] +else: + Base64FileInput = Union[IO[bytes], PathLike] + FileContent = Union[IO[bytes], bytes, PathLike] # PathLike is not subscriptable in Python 3.8. +FileTypes = Union[ + # file (or bytes) + FileContent, + # (filename, file (or bytes)) + Tuple[Optional[str], FileContent], + # (filename, file (or bytes), content_type) + Tuple[Optional[str], FileContent, Optional[str]], + # (filename, file (or bytes), content_type, headers) + Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], +] +RequestFiles = Union[Mapping[str, FileTypes], Sequence[Tuple[str, FileTypes]]] + +# duplicate of the above but without our custom file support +HttpxFileContent = Union[IO[bytes], bytes] +HttpxFileTypes = Union[ + # file (or bytes) + HttpxFileContent, + # (filename, file (or bytes)) + Tuple[Optional[str], HttpxFileContent], + # (filename, file (or bytes), content_type) + Tuple[Optional[str], HttpxFileContent, Optional[str]], + # (filename, file (or bytes), content_type, headers) + Tuple[Optional[str], HttpxFileContent, Optional[str], Mapping[str, str]], +] +HttpxRequestFiles = Union[Mapping[str, HttpxFileTypes], Sequence[Tuple[str, HttpxFileTypes]]] + +# Workaround to support (cast_to: Type[ResponseT]) -> ResponseT +# where ResponseT includes `None`. In order to support directly +# passing `None`, overloads would have to be defined for every +# method that uses `ResponseT` which would lead to an unacceptable +# amount of code duplication and make it unreadable. See _base_client.py +# for example usage. +# +# This unfortunately means that you will either have +# to import this type and pass it explicitly: +# +# from gcore import NoneType +# client.get('/foo', cast_to=NoneType) +# +# or build it yourself: +# +# client.get('/foo', cast_to=type(None)) +if TYPE_CHECKING: + NoneType: Type[None] +else: + NoneType = type(None) + + +class RequestOptions(TypedDict, total=False): + headers: Headers + max_retries: int + timeout: float | Timeout | None + params: Query + extra_json: AnyMapping + idempotency_key: str + + +# Sentinel class used until PEP 0661 is accepted +class NotGiven: + """ + A sentinel singleton class used to distinguish omitted keyword arguments + from those passed in with the value None (which may have different behavior). + + For example: + + ```py + def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... + + + get(timeout=1) # 1s timeout + get(timeout=None) # No timeout + get() # Default timeout behavior, which may not be statically known at the method definition. + ``` + """ + + def __bool__(self) -> Literal[False]: + return False + + @override + def __repr__(self) -> str: + return "NOT_GIVEN" + + +NotGivenOr = Union[_T, NotGiven] +NOT_GIVEN = NotGiven() + + +class Omit: + """In certain situations you need to be able to represent a case where a default value has + to be explicitly removed and `None` is not an appropriate substitute, for example: + + ```py + # as the default `Content-Type` header is `application/json` that will be sent + client.post("/upload/files", files={"file": b"my raw file content"}) + + # you can't explicitly override the header as it has to be dynamically generated + # to look something like: 'multipart/form-data; boundary=0d8382fcf5f8c3be01ca2e11002d2983' + client.post(..., headers={"Content-Type": "multipart/form-data"}) + + # instead you can remove the default `application/json` header by passing Omit + client.post(..., headers={"Content-Type": Omit()}) + ``` + """ + + def __bool__(self) -> Literal[False]: + return False + + +@runtime_checkable +class ModelBuilderProtocol(Protocol): + @classmethod + def build( + cls: type[_T], + *, + response: Response, + data: object, + ) -> _T: ... + + +Headers = Mapping[str, Union[str, Omit]] + + +class HeadersLikeProtocol(Protocol): + def get(self, __key: str) -> str | None: ... + + +HeadersLike = Union[Headers, HeadersLikeProtocol] + +ResponseT = TypeVar( + "ResponseT", + bound=Union[ + object, + str, + None, + "BaseModel", + List[Any], + Dict[str, Any], + Response, + ModelBuilderProtocol, + "APIResponse[Any]", + "AsyncAPIResponse[Any]", + ], +) + +StrBytesIntFloat = Union[str, bytes, int, float] + +# Note: copied from Pydantic +# https://github.com/pydantic/pydantic/blob/6f31f8f68ef011f84357330186f603ff295312fd/pydantic/main.py#L79 +IncEx: TypeAlias = Union[Set[int], Set[str], Mapping[int, Union["IncEx", bool]], Mapping[str, Union["IncEx", bool]]] + +PostParser = Callable[[Any], Any] + + +@runtime_checkable +class InheritsGeneric(Protocol): + """Represents a type that has inherited from `Generic` + + The `__orig_bases__` property can be used to determine the resolved + type variable for a given base class. + """ + + __orig_bases__: tuple[_GenericAlias] + + +class _GenericAlias(Protocol): + __origin__: type[object] + + +class HttpxSendArgs(TypedDict, total=False): + auth: httpx.Auth diff --git a/src/gcore/_utils/__init__.py b/src/gcore/_utils/__init__.py new file mode 100644 index 00000000..d4fda26f --- /dev/null +++ b/src/gcore/_utils/__init__.py @@ -0,0 +1,57 @@ +from ._sync import asyncify as asyncify +from ._proxy import LazyProxy as LazyProxy +from ._utils import ( + flatten as flatten, + is_dict as is_dict, + is_list as is_list, + is_given as is_given, + is_tuple as is_tuple, + json_safe as json_safe, + lru_cache as lru_cache, + is_mapping as is_mapping, + is_tuple_t as is_tuple_t, + parse_date as parse_date, + is_iterable as is_iterable, + is_sequence as is_sequence, + coerce_float as coerce_float, + is_mapping_t as is_mapping_t, + removeprefix as removeprefix, + removesuffix as removesuffix, + extract_files as extract_files, + is_sequence_t as is_sequence_t, + required_args as required_args, + coerce_boolean as coerce_boolean, + coerce_integer as coerce_integer, + file_from_path as file_from_path, + parse_datetime as parse_datetime, + strip_not_given as strip_not_given, + deepcopy_minimal as deepcopy_minimal, + get_async_library as get_async_library, + maybe_coerce_float as maybe_coerce_float, + get_required_header as get_required_header, + maybe_coerce_boolean as maybe_coerce_boolean, + maybe_coerce_integer as maybe_coerce_integer, +) +from ._typing import ( + is_list_type as is_list_type, + is_union_type as is_union_type, + extract_type_arg as extract_type_arg, + is_iterable_type as is_iterable_type, + is_required_type as is_required_type, + is_annotated_type as is_annotated_type, + is_type_alias_type as is_type_alias_type, + strip_annotated_type as strip_annotated_type, + extract_type_var_from_base as extract_type_var_from_base, +) +from ._streams import consume_sync_iterator as consume_sync_iterator, consume_async_iterator as consume_async_iterator +from ._transform import ( + PropertyInfo as PropertyInfo, + transform as transform, + async_transform as async_transform, + maybe_transform as maybe_transform, + async_maybe_transform as async_maybe_transform, +) +from ._reflection import ( + function_has_argument as function_has_argument, + assert_signatures_in_sync as assert_signatures_in_sync, +) diff --git a/src/gcore/_utils/_logs.py b/src/gcore/_utils/_logs.py new file mode 100644 index 00000000..9a53146b --- /dev/null +++ b/src/gcore/_utils/_logs.py @@ -0,0 +1,25 @@ +import os +import logging + +logger: logging.Logger = logging.getLogger("gcore") +httpx_logger: logging.Logger = logging.getLogger("httpx") + + +def _basic_config() -> None: + # e.g. [2023-10-05 14:12:26 - gcore._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK" + logging.basicConfig( + format="[%(asctime)s - %(name)s:%(lineno)d - %(levelname)s] %(message)s", + datefmt="%Y-%m-%d %H:%M:%S", + ) + + +def setup_logging() -> None: + env = os.environ.get("GCORE_LOG") + if env == "debug": + _basic_config() + logger.setLevel(logging.DEBUG) + httpx_logger.setLevel(logging.DEBUG) + elif env == "info": + _basic_config() + logger.setLevel(logging.INFO) + httpx_logger.setLevel(logging.INFO) diff --git a/src/gcore/_utils/_proxy.py b/src/gcore/_utils/_proxy.py new file mode 100644 index 00000000..ffd883e9 --- /dev/null +++ b/src/gcore/_utils/_proxy.py @@ -0,0 +1,62 @@ +from __future__ import annotations + +from abc import ABC, abstractmethod +from typing import Generic, TypeVar, Iterable, cast +from typing_extensions import override + +T = TypeVar("T") + + +class LazyProxy(Generic[T], ABC): + """Implements data methods to pretend that an instance is another instance. + + This includes forwarding attribute access and other methods. + """ + + # Note: we have to special case proxies that themselves return proxies + # to support using a proxy as a catch-all for any random access, e.g. `proxy.foo.bar.baz` + + def __getattr__(self, attr: str) -> object: + proxied = self.__get_proxied__() + if isinstance(proxied, LazyProxy): + return proxied # pyright: ignore + return getattr(proxied, attr) + + @override + def __repr__(self) -> str: + proxied = self.__get_proxied__() + if isinstance(proxied, LazyProxy): + return proxied.__class__.__name__ + return repr(self.__get_proxied__()) + + @override + def __str__(self) -> str: + proxied = self.__get_proxied__() + if isinstance(proxied, LazyProxy): + return proxied.__class__.__name__ + return str(proxied) + + @override + def __dir__(self) -> Iterable[str]: + proxied = self.__get_proxied__() + if isinstance(proxied, LazyProxy): + return [] + return proxied.__dir__() + + @property # type: ignore + @override + def __class__(self) -> type: # pyright: ignore + proxied = self.__get_proxied__() + if issubclass(type(proxied), LazyProxy): + return type(proxied) + return proxied.__class__ + + def __get_proxied__(self) -> T: + return self.__load__() + + def __as_proxied__(self) -> T: + """Helper method that returns the current proxy, typed as the loaded object""" + return cast(T, self) + + @abstractmethod + def __load__(self) -> T: ... diff --git a/src/gcore/_utils/_reflection.py b/src/gcore/_utils/_reflection.py new file mode 100644 index 00000000..89aa712a --- /dev/null +++ b/src/gcore/_utils/_reflection.py @@ -0,0 +1,42 @@ +from __future__ import annotations + +import inspect +from typing import Any, Callable + + +def function_has_argument(func: Callable[..., Any], arg_name: str) -> bool: + """Returns whether or not the given function has a specific parameter""" + sig = inspect.signature(func) + return arg_name in sig.parameters + + +def assert_signatures_in_sync( + source_func: Callable[..., Any], + check_func: Callable[..., Any], + *, + exclude_params: set[str] = set(), +) -> None: + """Ensure that the signature of the second function matches the first.""" + + check_sig = inspect.signature(check_func) + source_sig = inspect.signature(source_func) + + errors: list[str] = [] + + for name, source_param in source_sig.parameters.items(): + if name in exclude_params: + continue + + custom_param = check_sig.parameters.get(name) + if not custom_param: + errors.append(f"the `{name}` param is missing") + continue + + if custom_param.annotation != source_param.annotation: + errors.append( + f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(custom_param.annotation)}" + ) + continue + + if errors: + raise AssertionError(f"{len(errors)} errors encountered when comparing signatures:\n\n" + "\n\n".join(errors)) diff --git a/src/gcore/_utils/_streams.py b/src/gcore/_utils/_streams.py new file mode 100644 index 00000000..f4a0208f --- /dev/null +++ b/src/gcore/_utils/_streams.py @@ -0,0 +1,12 @@ +from typing import Any +from typing_extensions import Iterator, AsyncIterator + + +def consume_sync_iterator(iterator: Iterator[Any]) -> None: + for _ in iterator: + ... + + +async def consume_async_iterator(iterator: AsyncIterator[Any]) -> None: + async for _ in iterator: + ... diff --git a/src/gcore/_utils/_sync.py b/src/gcore/_utils/_sync.py new file mode 100644 index 00000000..ad7ec71b --- /dev/null +++ b/src/gcore/_utils/_sync.py @@ -0,0 +1,86 @@ +from __future__ import annotations + +import sys +import asyncio +import functools +import contextvars +from typing import Any, TypeVar, Callable, Awaitable +from typing_extensions import ParamSpec + +import anyio +import sniffio +import anyio.to_thread + +T_Retval = TypeVar("T_Retval") +T_ParamSpec = ParamSpec("T_ParamSpec") + + +if sys.version_info >= (3, 9): + _asyncio_to_thread = asyncio.to_thread +else: + # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread + # for Python 3.8 support + async def _asyncio_to_thread( + func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs + ) -> Any: + """Asynchronously run function *func* in a separate thread. + + Any *args and **kwargs supplied for this function are directly passed + to *func*. Also, the current :class:`contextvars.Context` is propagated, + allowing context variables from the main thread to be accessed in the + separate thread. + + Returns a coroutine that can be awaited to get the eventual result of *func*. + """ + loop = asyncio.events.get_running_loop() + ctx = contextvars.copy_context() + func_call = functools.partial(ctx.run, func, *args, **kwargs) + return await loop.run_in_executor(None, func_call) + + +async def to_thread( + func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs +) -> T_Retval: + if sniffio.current_async_library() == "asyncio": + return await _asyncio_to_thread(func, *args, **kwargs) + + return await anyio.to_thread.run_sync( + functools.partial(func, *args, **kwargs), + ) + + +# inspired by `asyncer`, https://github.com/tiangolo/asyncer +def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: + """ + Take a blocking function and create an async one that receives the same + positional and keyword arguments. For python version 3.9 and above, it uses + asyncio.to_thread to run the function in a separate thread. For python version + 3.8, it uses locally defined copy of the asyncio.to_thread function which was + introduced in python 3.9. + + Usage: + + ```python + def blocking_func(arg1, arg2, kwarg1=None): + # blocking code + return result + + + result = asyncify(blocking_function)(arg1, arg2, kwarg1=value1) + ``` + + ## Arguments + + `function`: a blocking regular callable (e.g. a function) + + ## Return + + An async function that takes the same positional and keyword arguments as the + original one, that when called runs the same original function in a thread worker + and returns the result. + """ + + async def wrapper(*args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs) -> T_Retval: + return await to_thread(function, *args, **kwargs) + + return wrapper diff --git a/src/gcore/_utils/_transform.py b/src/gcore/_utils/_transform.py new file mode 100644 index 00000000..7ac2e17f --- /dev/null +++ b/src/gcore/_utils/_transform.py @@ -0,0 +1,402 @@ +from __future__ import annotations + +import io +import base64 +import pathlib +from typing import Any, Mapping, TypeVar, cast +from datetime import date, datetime +from typing_extensions import Literal, get_args, override, get_type_hints + +import anyio +import pydantic + +from ._utils import ( + is_list, + is_mapping, + is_iterable, +) +from .._files import is_base64_file_input +from ._typing import ( + is_list_type, + is_union_type, + extract_type_arg, + is_iterable_type, + is_required_type, + is_annotated_type, + strip_annotated_type, +) +from .._compat import get_origin, model_dump, is_typeddict + +_T = TypeVar("_T") + + +# TODO: support for drilling globals() and locals() +# TODO: ensure works correctly with forward references in all cases + + +PropertyFormat = Literal["iso8601", "base64", "custom"] + + +class PropertyInfo: + """Metadata class to be used in Annotated types to provide information about a given type. + + For example: + + class MyParams(TypedDict): + account_holder_name: Annotated[str, PropertyInfo(alias='accountHolderName')] + + This means that {'account_holder_name': 'Robert'} will be transformed to {'accountHolderName': 'Robert'} before being sent to the API. + """ + + alias: str | None + format: PropertyFormat | None + format_template: str | None + discriminator: str | None + + def __init__( + self, + *, + alias: str | None = None, + format: PropertyFormat | None = None, + format_template: str | None = None, + discriminator: str | None = None, + ) -> None: + self.alias = alias + self.format = format + self.format_template = format_template + self.discriminator = discriminator + + @override + def __repr__(self) -> str: + return f"{self.__class__.__name__}(alias='{self.alias}', format={self.format}, format_template='{self.format_template}', discriminator='{self.discriminator}')" + + +def maybe_transform( + data: object, + expected_type: object, +) -> Any | None: + """Wrapper over `transform()` that allows `None` to be passed. + + See `transform()` for more details. + """ + if data is None: + return None + return transform(data, expected_type) + + +# Wrapper over _transform_recursive providing fake types +def transform( + data: _T, + expected_type: object, +) -> _T: + """Transform dictionaries based off of type information from the given type, for example: + + ```py + class Params(TypedDict, total=False): + card_id: Required[Annotated[str, PropertyInfo(alias="cardID")]] + + + transformed = transform({"card_id": ""}, Params) + # {'cardID': ''} + ``` + + Any keys / data that does not have type information given will be included as is. + + It should be noted that the transformations that this function does are not represented in the type system. + """ + transformed = _transform_recursive(data, annotation=cast(type, expected_type)) + return cast(_T, transformed) + + +def _get_annotated_type(type_: type) -> type | None: + """If the given type is an `Annotated` type then it is returned, if not `None` is returned. + + This also unwraps the type when applicable, e.g. `Required[Annotated[T, ...]]` + """ + if is_required_type(type_): + # Unwrap `Required[Annotated[T, ...]]` to `Annotated[T, ...]` + type_ = get_args(type_)[0] + + if is_annotated_type(type_): + return type_ + + return None + + +def _maybe_transform_key(key: str, type_: type) -> str: + """Transform the given `data` based on the annotations provided in `type_`. + + Note: this function only looks at `Annotated` types that contain `PropertyInfo` metadata. + """ + annotated_type = _get_annotated_type(type_) + if annotated_type is None: + # no `Annotated` definition for this type, no transformation needed + return key + + # ignore the first argument as it is the actual type + annotations = get_args(annotated_type)[1:] + for annotation in annotations: + if isinstance(annotation, PropertyInfo) and annotation.alias is not None: + return annotation.alias + + return key + + +def _transform_recursive( + data: object, + *, + annotation: type, + inner_type: type | None = None, +) -> object: + """Transform the given data against the expected type. + + Args: + annotation: The direct type annotation given to the particular piece of data. + This may or may not be wrapped in metadata types, e.g. `Required[T]`, `Annotated[T, ...]` etc + + inner_type: If applicable, this is the "inside" type. This is useful in certain cases where the outside type + is a container type such as `List[T]`. In that case `inner_type` should be set to `T` so that each entry in + the list can be transformed using the metadata from the container type. + + Defaults to the same value as the `annotation` argument. + """ + if inner_type is None: + inner_type = annotation + + stripped_type = strip_annotated_type(inner_type) + origin = get_origin(stripped_type) or stripped_type + if is_typeddict(stripped_type) and is_mapping(data): + return _transform_typeddict(data, stripped_type) + + if origin == dict and is_mapping(data): + items_type = get_args(stripped_type)[1] + return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()} + + if ( + # List[T] + (is_list_type(stripped_type) and is_list(data)) + # Iterable[T] + or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) + ): + # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually + # intended as an iterable, so we don't transform it. + if isinstance(data, dict): + return cast(object, data) + + inner_type = extract_type_arg(stripped_type, 0) + return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] + + if is_union_type(stripped_type): + # For union types we run the transformation against all subtypes to ensure that everything is transformed. + # + # TODO: there may be edge cases where the same normalized field name will transform to two different names + # in different subtypes. + for subtype in get_args(stripped_type): + data = _transform_recursive(data, annotation=annotation, inner_type=subtype) + return data + + if isinstance(data, pydantic.BaseModel): + return model_dump(data, exclude_unset=True, mode="json") + + annotated_type = _get_annotated_type(annotation) + if annotated_type is None: + return data + + # ignore the first argument as it is the actual type + annotations = get_args(annotated_type)[1:] + for annotation in annotations: + if isinstance(annotation, PropertyInfo) and annotation.format is not None: + return _format_data(data, annotation.format, annotation.format_template) + + return data + + +def _format_data(data: object, format_: PropertyFormat, format_template: str | None) -> object: + if isinstance(data, (date, datetime)): + if format_ == "iso8601": + return data.isoformat() + + if format_ == "custom" and format_template is not None: + return data.strftime(format_template) + + if format_ == "base64" and is_base64_file_input(data): + binary: str | bytes | None = None + + if isinstance(data, pathlib.Path): + binary = data.read_bytes() + elif isinstance(data, io.IOBase): + binary = data.read() + + if isinstance(binary, str): # type: ignore[unreachable] + binary = binary.encode() + + if not isinstance(binary, bytes): + raise RuntimeError(f"Could not read bytes from {data}; Received {type(binary)}") + + return base64.b64encode(binary).decode("ascii") + + return data + + +def _transform_typeddict( + data: Mapping[str, object], + expected_type: type, +) -> Mapping[str, object]: + result: dict[str, object] = {} + annotations = get_type_hints(expected_type, include_extras=True) + for key, value in data.items(): + type_ = annotations.get(key) + if type_ is None: + # we do not have a type annotation for this field, leave it as is + result[key] = value + else: + result[_maybe_transform_key(key, type_)] = _transform_recursive(value, annotation=type_) + return result + + +async def async_maybe_transform( + data: object, + expected_type: object, +) -> Any | None: + """Wrapper over `async_transform()` that allows `None` to be passed. + + See `async_transform()` for more details. + """ + if data is None: + return None + return await async_transform(data, expected_type) + + +async def async_transform( + data: _T, + expected_type: object, +) -> _T: + """Transform dictionaries based off of type information from the given type, for example: + + ```py + class Params(TypedDict, total=False): + card_id: Required[Annotated[str, PropertyInfo(alias="cardID")]] + + + transformed = transform({"card_id": ""}, Params) + # {'cardID': ''} + ``` + + Any keys / data that does not have type information given will be included as is. + + It should be noted that the transformations that this function does are not represented in the type system. + """ + transformed = await _async_transform_recursive(data, annotation=cast(type, expected_type)) + return cast(_T, transformed) + + +async def _async_transform_recursive( + data: object, + *, + annotation: type, + inner_type: type | None = None, +) -> object: + """Transform the given data against the expected type. + + Args: + annotation: The direct type annotation given to the particular piece of data. + This may or may not be wrapped in metadata types, e.g. `Required[T]`, `Annotated[T, ...]` etc + + inner_type: If applicable, this is the "inside" type. This is useful in certain cases where the outside type + is a container type such as `List[T]`. In that case `inner_type` should be set to `T` so that each entry in + the list can be transformed using the metadata from the container type. + + Defaults to the same value as the `annotation` argument. + """ + if inner_type is None: + inner_type = annotation + + stripped_type = strip_annotated_type(inner_type) + origin = get_origin(stripped_type) or stripped_type + if is_typeddict(stripped_type) and is_mapping(data): + return await _async_transform_typeddict(data, stripped_type) + + if origin == dict and is_mapping(data): + items_type = get_args(stripped_type)[1] + return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()} + + if ( + # List[T] + (is_list_type(stripped_type) and is_list(data)) + # Iterable[T] + or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) + ): + # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually + # intended as an iterable, so we don't transform it. + if isinstance(data, dict): + return cast(object, data) + + inner_type = extract_type_arg(stripped_type, 0) + return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] + + if is_union_type(stripped_type): + # For union types we run the transformation against all subtypes to ensure that everything is transformed. + # + # TODO: there may be edge cases where the same normalized field name will transform to two different names + # in different subtypes. + for subtype in get_args(stripped_type): + data = await _async_transform_recursive(data, annotation=annotation, inner_type=subtype) + return data + + if isinstance(data, pydantic.BaseModel): + return model_dump(data, exclude_unset=True, mode="json") + + annotated_type = _get_annotated_type(annotation) + if annotated_type is None: + return data + + # ignore the first argument as it is the actual type + annotations = get_args(annotated_type)[1:] + for annotation in annotations: + if isinstance(annotation, PropertyInfo) and annotation.format is not None: + return await _async_format_data(data, annotation.format, annotation.format_template) + + return data + + +async def _async_format_data(data: object, format_: PropertyFormat, format_template: str | None) -> object: + if isinstance(data, (date, datetime)): + if format_ == "iso8601": + return data.isoformat() + + if format_ == "custom" and format_template is not None: + return data.strftime(format_template) + + if format_ == "base64" and is_base64_file_input(data): + binary: str | bytes | None = None + + if isinstance(data, pathlib.Path): + binary = await anyio.Path(data).read_bytes() + elif isinstance(data, io.IOBase): + binary = data.read() + + if isinstance(binary, str): # type: ignore[unreachable] + binary = binary.encode() + + if not isinstance(binary, bytes): + raise RuntimeError(f"Could not read bytes from {data}; Received {type(binary)}") + + return base64.b64encode(binary).decode("ascii") + + return data + + +async def _async_transform_typeddict( + data: Mapping[str, object], + expected_type: type, +) -> Mapping[str, object]: + result: dict[str, object] = {} + annotations = get_type_hints(expected_type, include_extras=True) + for key, value in data.items(): + type_ = annotations.get(key) + if type_ is None: + # we do not have a type annotation for this field, leave it as is + result[key] = value + else: + result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_) + return result diff --git a/src/gcore/_utils/_typing.py b/src/gcore/_utils/_typing.py new file mode 100644 index 00000000..278749b1 --- /dev/null +++ b/src/gcore/_utils/_typing.py @@ -0,0 +1,149 @@ +from __future__ import annotations + +import sys +import typing +import typing_extensions +from typing import Any, TypeVar, Iterable, cast +from collections import abc as _c_abc +from typing_extensions import ( + TypeIs, + Required, + Annotated, + get_args, + get_origin, +) + +from .._types import InheritsGeneric +from .._compat import is_union as _is_union + + +def is_annotated_type(typ: type) -> bool: + return get_origin(typ) == Annotated + + +def is_list_type(typ: type) -> bool: + return (get_origin(typ) or typ) == list + + +def is_iterable_type(typ: type) -> bool: + """If the given type is `typing.Iterable[T]`""" + origin = get_origin(typ) or typ + return origin == Iterable or origin == _c_abc.Iterable + + +def is_union_type(typ: type) -> bool: + return _is_union(get_origin(typ)) + + +def is_required_type(typ: type) -> bool: + return get_origin(typ) == Required + + +def is_typevar(typ: type) -> bool: + # type ignore is required because type checkers + # think this expression will always return False + return type(typ) == TypeVar # type: ignore + + +_TYPE_ALIAS_TYPES: tuple[type[typing_extensions.TypeAliasType], ...] = (typing_extensions.TypeAliasType,) +if sys.version_info >= (3, 12): + _TYPE_ALIAS_TYPES = (*_TYPE_ALIAS_TYPES, typing.TypeAliasType) + + +def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]: + """Return whether the provided argument is an instance of `TypeAliasType`. + + ```python + type Int = int + is_type_alias_type(Int) + # > True + Str = TypeAliasType("Str", str) + is_type_alias_type(Str) + # > True + ``` + """ + return isinstance(tp, _TYPE_ALIAS_TYPES) + + +# Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]] +def strip_annotated_type(typ: type) -> type: + if is_required_type(typ) or is_annotated_type(typ): + return strip_annotated_type(cast(type, get_args(typ)[0])) + + return typ + + +def extract_type_arg(typ: type, index: int) -> type: + args = get_args(typ) + try: + return cast(type, args[index]) + except IndexError as err: + raise RuntimeError(f"Expected type {typ} to have a type argument at index {index} but it did not") from err + + +def extract_type_var_from_base( + typ: type, + *, + generic_bases: tuple[type, ...], + index: int, + failure_message: str | None = None, +) -> type: + """Given a type like `Foo[T]`, returns the generic type variable `T`. + + This also handles the case where a concrete subclass is given, e.g. + ```py + class MyResponse(Foo[bytes]): + ... + + extract_type_var(MyResponse, bases=(Foo,), index=0) -> bytes + ``` + + And where a generic subclass is given: + ```py + _T = TypeVar('_T') + class MyResponse(Foo[_T]): + ... + + extract_type_var(MyResponse[bytes], bases=(Foo,), index=0) -> bytes + ``` + """ + cls = cast(object, get_origin(typ) or typ) + if cls in generic_bases: + # we're given the class directly + return extract_type_arg(typ, index) + + # if a subclass is given + # --- + # this is needed as __orig_bases__ is not present in the typeshed stubs + # because it is intended to be for internal use only, however there does + # not seem to be a way to resolve generic TypeVars for inherited subclasses + # without using it. + if isinstance(cls, InheritsGeneric): + target_base_class: Any | None = None + for base in cls.__orig_bases__: + if base.__origin__ in generic_bases: + target_base_class = base + break + + if target_base_class is None: + raise RuntimeError( + "Could not find the generic base class;\n" + "This should never happen;\n" + f"Does {cls} inherit from one of {generic_bases} ?" + ) + + extracted = extract_type_arg(target_base_class, index) + if is_typevar(extracted): + # If the extracted type argument is itself a type variable + # then that means the subclass itself is generic, so we have + # to resolve the type argument from the class itself, not + # the base class. + # + # Note: if there is more than 1 type argument, the subclass could + # change the ordering of the type arguments, this is not currently + # supported. + return extract_type_arg(typ, index) + + return extracted + + raise RuntimeError(failure_message or f"Could not resolve inner type variable at index {index} for {typ}") diff --git a/src/gcore/_utils/_utils.py b/src/gcore/_utils/_utils.py new file mode 100644 index 00000000..e5811bba --- /dev/null +++ b/src/gcore/_utils/_utils.py @@ -0,0 +1,414 @@ +from __future__ import annotations + +import os +import re +import inspect +import functools +from typing import ( + Any, + Tuple, + Mapping, + TypeVar, + Callable, + Iterable, + Sequence, + cast, + overload, +) +from pathlib import Path +from datetime import date, datetime +from typing_extensions import TypeGuard + +import sniffio + +from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike +from .._compat import parse_date as parse_date, parse_datetime as parse_datetime + +_T = TypeVar("_T") +_TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) +_MappingT = TypeVar("_MappingT", bound=Mapping[str, object]) +_SequenceT = TypeVar("_SequenceT", bound=Sequence[object]) +CallableT = TypeVar("CallableT", bound=Callable[..., Any]) + + +def flatten(t: Iterable[Iterable[_T]]) -> list[_T]: + return [item for sublist in t for item in sublist] + + +def extract_files( + # TODO: this needs to take Dict but variance issues..... + # create protocol type ? + query: Mapping[str, object], + *, + paths: Sequence[Sequence[str]], +) -> list[tuple[str, FileTypes]]: + """Recursively extract files from the given dictionary based on specified paths. + + A path may look like this ['foo', 'files', '', 'data']. + + Note: this mutates the given dictionary. + """ + files: list[tuple[str, FileTypes]] = [] + for path in paths: + files.extend(_extract_items(query, path, index=0, flattened_key=None)) + return files + + +def _extract_items( + obj: object, + path: Sequence[str], + *, + index: int, + flattened_key: str | None, +) -> list[tuple[str, FileTypes]]: + try: + key = path[index] + except IndexError: + if isinstance(obj, NotGiven): + # no value was provided - we can safely ignore + return [] + + # cyclical import + from .._files import assert_is_file_content + + # We have exhausted the path, return the entry we found. + assert_is_file_content(obj, key=flattened_key) + assert flattened_key is not None + return [(flattened_key, cast(FileTypes, obj))] + + index += 1 + if is_dict(obj): + try: + # We are at the last entry in the path so we must remove the field + if (len(path)) == index: + item = obj.pop(key) + else: + item = obj[key] + except KeyError: + # Key was not present in the dictionary, this is not indicative of an error + # as the given path may not point to a required field. We also do not want + # to enforce required fields as the API may differ from the spec in some cases. + return [] + if flattened_key is None: + flattened_key = key + else: + flattened_key += f"[{key}]" + return _extract_items( + item, + path, + index=index, + flattened_key=flattened_key, + ) + elif is_list(obj): + if key != "": + return [] + + return flatten( + [ + _extract_items( + item, + path, + index=index, + flattened_key=flattened_key + "[]" if flattened_key is not None else "[]", + ) + for item in obj + ] + ) + + # Something unexpected was passed, just ignore it. + return [] + + +def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]: + return not isinstance(obj, NotGiven) + + +# Type safe methods for narrowing types with TypeVars. +# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown], +# however this cause Pyright to rightfully report errors. As we know we don't +# care about the contained types we can safely use `object` in it's place. +# +# There are two separate functions defined, `is_*` and `is_*_t` for different use cases. +# `is_*` is for when you're dealing with an unknown input +# `is_*_t` is for when you're narrowing a known union type to a specific subset + + +def is_tuple(obj: object) -> TypeGuard[tuple[object, ...]]: + return isinstance(obj, tuple) + + +def is_tuple_t(obj: _TupleT | object) -> TypeGuard[_TupleT]: + return isinstance(obj, tuple) + + +def is_sequence(obj: object) -> TypeGuard[Sequence[object]]: + return isinstance(obj, Sequence) + + +def is_sequence_t(obj: _SequenceT | object) -> TypeGuard[_SequenceT]: + return isinstance(obj, Sequence) + + +def is_mapping(obj: object) -> TypeGuard[Mapping[str, object]]: + return isinstance(obj, Mapping) + + +def is_mapping_t(obj: _MappingT | object) -> TypeGuard[_MappingT]: + return isinstance(obj, Mapping) + + +def is_dict(obj: object) -> TypeGuard[dict[object, object]]: + return isinstance(obj, dict) + + +def is_list(obj: object) -> TypeGuard[list[object]]: + return isinstance(obj, list) + + +def is_iterable(obj: object) -> TypeGuard[Iterable[object]]: + return isinstance(obj, Iterable) + + +def deepcopy_minimal(item: _T) -> _T: + """Minimal reimplementation of copy.deepcopy() that will only copy certain object types: + + - mappings, e.g. `dict` + - list + + This is done for performance reasons. + """ + if is_mapping(item): + return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()}) + if is_list(item): + return cast(_T, [deepcopy_minimal(entry) for entry in item]) + return item + + +# copied from https://github.com/Rapptz/RoboDanny +def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str: + size = len(seq) + if size == 0: + return "" + + if size == 1: + return seq[0] + + if size == 2: + return f"{seq[0]} {final} {seq[1]}" + + return delim.join(seq[:-1]) + f" {final} {seq[-1]}" + + +def quote(string: str) -> str: + """Add single quotation marks around the given string. Does *not* do any escaping.""" + return f"'{string}'" + + +def required_args(*variants: Sequence[str]) -> Callable[[CallableT], CallableT]: + """Decorator to enforce a given set of arguments or variants of arguments are passed to the decorated function. + + Useful for enforcing runtime validation of overloaded functions. + + Example usage: + ```py + @overload + def foo(*, a: str) -> str: ... + + + @overload + def foo(*, b: bool) -> str: ... + + + # This enforces the same constraints that a static type checker would + # i.e. that either a or b must be passed to the function + @required_args(["a"], ["b"]) + def foo(*, a: str | None = None, b: bool | None = None) -> str: ... + ``` + """ + + def inner(func: CallableT) -> CallableT: + params = inspect.signature(func).parameters + positional = [ + name + for name, param in params.items() + if param.kind + in { + param.POSITIONAL_ONLY, + param.POSITIONAL_OR_KEYWORD, + } + ] + + @functools.wraps(func) + def wrapper(*args: object, **kwargs: object) -> object: + given_params: set[str] = set() + for i, _ in enumerate(args): + try: + given_params.add(positional[i]) + except IndexError: + raise TypeError( + f"{func.__name__}() takes {len(positional)} argument(s) but {len(args)} were given" + ) from None + + for key in kwargs.keys(): + given_params.add(key) + + for variant in variants: + matches = all((param in given_params for param in variant)) + if matches: + break + else: # no break + if len(variants) > 1: + variations = human_join( + ["(" + human_join([quote(arg) for arg in variant], final="and") + ")" for variant in variants] + ) + msg = f"Missing required arguments; Expected either {variations} arguments to be given" + else: + assert len(variants) > 0 + + # TODO: this error message is not deterministic + missing = list(set(variants[0]) - given_params) + if len(missing) > 1: + msg = f"Missing required arguments: {human_join([quote(arg) for arg in missing])}" + else: + msg = f"Missing required argument: {quote(missing[0])}" + raise TypeError(msg) + return func(*args, **kwargs) + + return wrapper # type: ignore + + return inner + + +_K = TypeVar("_K") +_V = TypeVar("_V") + + +@overload +def strip_not_given(obj: None) -> None: ... + + +@overload +def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: ... + + +@overload +def strip_not_given(obj: object) -> object: ... + + +def strip_not_given(obj: object | None) -> object: + """Remove all top-level keys where their values are instances of `NotGiven`""" + if obj is None: + return None + + if not is_mapping(obj): + return obj + + return {key: value for key, value in obj.items() if not isinstance(value, NotGiven)} + + +def coerce_integer(val: str) -> int: + return int(val, base=10) + + +def coerce_float(val: str) -> float: + return float(val) + + +def coerce_boolean(val: str) -> bool: + return val == "true" or val == "1" or val == "on" + + +def maybe_coerce_integer(val: str | None) -> int | None: + if val is None: + return None + return coerce_integer(val) + + +def maybe_coerce_float(val: str | None) -> float | None: + if val is None: + return None + return coerce_float(val) + + +def maybe_coerce_boolean(val: str | None) -> bool | None: + if val is None: + return None + return coerce_boolean(val) + + +def removeprefix(string: str, prefix: str) -> str: + """Remove a prefix from a string. + + Backport of `str.removeprefix` for Python < 3.9 + """ + if string.startswith(prefix): + return string[len(prefix) :] + return string + + +def removesuffix(string: str, suffix: str) -> str: + """Remove a suffix from a string. + + Backport of `str.removesuffix` for Python < 3.9 + """ + if string.endswith(suffix): + return string[: -len(suffix)] + return string + + +def file_from_path(path: str) -> FileTypes: + contents = Path(path).read_bytes() + file_name = os.path.basename(path) + return (file_name, contents) + + +def get_required_header(headers: HeadersLike, header: str) -> str: + lower_header = header.lower() + if is_mapping_t(headers): + # mypy doesn't understand the type narrowing here + for k, v in headers.items(): # type: ignore + if k.lower() == lower_header and isinstance(v, str): + return v + + # to deal with the case where the header looks like Stainless-Event-Id + intercaps_header = re.sub(r"([^\w])(\w)", lambda pat: pat.group(1) + pat.group(2).upper(), header.capitalize()) + + for normalized_header in [header, lower_header, header.upper(), intercaps_header]: + value = headers.get(normalized_header) + if value: + return value + + raise ValueError(f"Could not find {header} header") + + +def get_async_library() -> str: + try: + return sniffio.current_async_library() + except Exception: + return "false" + + +def lru_cache(*, maxsize: int | None = 128) -> Callable[[CallableT], CallableT]: + """A version of functools.lru_cache that retains the type signature + for the wrapped function arguments. + """ + wrapper = functools.lru_cache( # noqa: TID251 + maxsize=maxsize, + ) + return cast(Any, wrapper) # type: ignore[no-any-return] + + +def json_safe(data: object) -> object: + """Translates a mapping / sequence recursively in the same fashion + as `pydantic` v2's `model_dump(mode="json")`. + """ + if is_mapping(data): + return {json_safe(key): json_safe(value) for key, value in data.items()} + + if is_iterable(data) and not isinstance(data, (str, bytes, bytearray)): + return [json_safe(item) for item in data] + + if isinstance(data, (datetime, date)): + return data.isoformat() + + return data diff --git a/src/gcore/_version.py b/src/gcore/_version.py new file mode 100644 index 00000000..1acc1254 --- /dev/null +++ b/src/gcore/_version.py @@ -0,0 +1,4 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +__title__ = "gcore" +__version__ = "0.0.1-alpha.0" diff --git a/src/gcore/lib/.keep b/src/gcore/lib/.keep new file mode 100644 index 00000000..5e2c99fd --- /dev/null +++ b/src/gcore/lib/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store custom files to expand the SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/src/gcore/pagination.py b/src/gcore/pagination.py new file mode 100644 index 00000000..cf967212 --- /dev/null +++ b/src/gcore/pagination.py @@ -0,0 +1,70 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Generic, TypeVar, Optional +from typing_extensions import override + +from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage + +__all__ = ["SyncOffsetPage", "AsyncOffsetPage"] + +_T = TypeVar("_T") + + +class SyncOffsetPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + results: List[_T] + count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + results = self.results + if not results: + return [] + return results + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + count = self.count + if count is None: + return None + + if current_count < count: + return PageInfo(params={"offset": current_count}) + + return None + + +class AsyncOffsetPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + results: List[_T] + count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + results = self.results + if not results: + return [] + return results + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + count = self.count + if count is None: + return None + + if current_count < count: + return PageInfo(params={"offset": current_count}) + + return None diff --git a/src/gcore/py.typed b/src/gcore/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py new file mode 100644 index 00000000..628e0c1c --- /dev/null +++ b/src/gcore/resources/__init__.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .cloud import ( + CloudResource, + AsyncCloudResource, + CloudResourceWithRawResponse, + AsyncCloudResourceWithRawResponse, + CloudResourceWithStreamingResponse, + AsyncCloudResourceWithStreamingResponse, +) + +__all__ = [ + "CloudResource", + "AsyncCloudResource", + "CloudResourceWithRawResponse", + "AsyncCloudResourceWithRawResponse", + "CloudResourceWithStreamingResponse", + "AsyncCloudResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py new file mode 100644 index 00000000..628e0c1c --- /dev/null +++ b/src/gcore/resources/cloud/__init__.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .cloud import ( + CloudResource, + AsyncCloudResource, + CloudResourceWithRawResponse, + AsyncCloudResourceWithRawResponse, + CloudResourceWithStreamingResponse, + AsyncCloudResourceWithStreamingResponse, +) + +__all__ = [ + "CloudResource", + "AsyncCloudResource", + "CloudResourceWithRawResponse", + "AsyncCloudResourceWithRawResponse", + "CloudResourceWithStreamingResponse", + "AsyncCloudResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py new file mode 100644 index 00000000..abeacc6d --- /dev/null +++ b/src/gcore/resources/cloud/cloud.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from .projects.projects import ( + ProjectsResource, + AsyncProjectsResource, + ProjectsResourceWithRawResponse, + AsyncProjectsResourceWithRawResponse, + ProjectsResourceWithStreamingResponse, + AsyncProjectsResourceWithStreamingResponse, +) + +__all__ = ["CloudResource", "AsyncCloudResource"] + + +class CloudResource(SyncAPIResource): + @cached_property + def projects(self) -> ProjectsResource: + return ProjectsResource(self._client) + + @cached_property + def with_raw_response(self) -> CloudResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return CloudResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CloudResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return CloudResourceWithStreamingResponse(self) + + +class AsyncCloudResource(AsyncAPIResource): + @cached_property + def projects(self) -> AsyncProjectsResource: + return AsyncProjectsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncCloudResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCloudResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncCloudResourceWithStreamingResponse(self) + + +class CloudResourceWithRawResponse: + def __init__(self, cloud: CloudResource) -> None: + self._cloud = cloud + + @cached_property + def projects(self) -> ProjectsResourceWithRawResponse: + return ProjectsResourceWithRawResponse(self._cloud.projects) + + +class AsyncCloudResourceWithRawResponse: + def __init__(self, cloud: AsyncCloudResource) -> None: + self._cloud = cloud + + @cached_property + def projects(self) -> AsyncProjectsResourceWithRawResponse: + return AsyncProjectsResourceWithRawResponse(self._cloud.projects) + + +class CloudResourceWithStreamingResponse: + def __init__(self, cloud: CloudResource) -> None: + self._cloud = cloud + + @cached_property + def projects(self) -> ProjectsResourceWithStreamingResponse: + return ProjectsResourceWithStreamingResponse(self._cloud.projects) + + +class AsyncCloudResourceWithStreamingResponse: + def __init__(self, cloud: AsyncCloudResource) -> None: + self._cloud = cloud + + @cached_property + def projects(self) -> AsyncProjectsResourceWithStreamingResponse: + return AsyncProjectsResourceWithStreamingResponse(self._cloud.projects) diff --git a/src/gcore/resources/cloud/projects/__init__.py b/src/gcore/resources/cloud/projects/__init__.py new file mode 100644 index 00000000..dd6f2d33 --- /dev/null +++ b/src/gcore/resources/cloud/projects/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .v1 import ( + V1Resource, + AsyncV1Resource, + V1ResourceWithRawResponse, + AsyncV1ResourceWithRawResponse, + V1ResourceWithStreamingResponse, + AsyncV1ResourceWithStreamingResponse, +) +from .projects import ( + ProjectsResource, + AsyncProjectsResource, + ProjectsResourceWithRawResponse, + AsyncProjectsResourceWithRawResponse, + ProjectsResourceWithStreamingResponse, + AsyncProjectsResourceWithStreamingResponse, +) + +__all__ = [ + "V1Resource", + "AsyncV1Resource", + "V1ResourceWithRawResponse", + "AsyncV1ResourceWithRawResponse", + "V1ResourceWithStreamingResponse", + "AsyncV1ResourceWithStreamingResponse", + "ProjectsResource", + "AsyncProjectsResource", + "ProjectsResourceWithRawResponse", + "AsyncProjectsResourceWithRawResponse", + "ProjectsResourceWithStreamingResponse", + "AsyncProjectsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/projects/projects.py b/src/gcore/resources/cloud/projects/projects.py new file mode 100644 index 00000000..ddad2493 --- /dev/null +++ b/src/gcore/resources/cloud/projects/projects.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .v1 import ( + V1Resource, + AsyncV1Resource, + V1ResourceWithRawResponse, + AsyncV1ResourceWithRawResponse, + V1ResourceWithStreamingResponse, + AsyncV1ResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["ProjectsResource", "AsyncProjectsResource"] + + +class ProjectsResource(SyncAPIResource): + @cached_property + def v1(self) -> V1Resource: + return V1Resource(self._client) + + @cached_property + def with_raw_response(self) -> ProjectsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return ProjectsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ProjectsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return ProjectsResourceWithStreamingResponse(self) + + +class AsyncProjectsResource(AsyncAPIResource): + @cached_property + def v1(self) -> AsyncV1Resource: + return AsyncV1Resource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncProjectsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncProjectsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncProjectsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncProjectsResourceWithStreamingResponse(self) + + +class ProjectsResourceWithRawResponse: + def __init__(self, projects: ProjectsResource) -> None: + self._projects = projects + + @cached_property + def v1(self) -> V1ResourceWithRawResponse: + return V1ResourceWithRawResponse(self._projects.v1) + + +class AsyncProjectsResourceWithRawResponse: + def __init__(self, projects: AsyncProjectsResource) -> None: + self._projects = projects + + @cached_property + def v1(self) -> AsyncV1ResourceWithRawResponse: + return AsyncV1ResourceWithRawResponse(self._projects.v1) + + +class ProjectsResourceWithStreamingResponse: + def __init__(self, projects: ProjectsResource) -> None: + self._projects = projects + + @cached_property + def v1(self) -> V1ResourceWithStreamingResponse: + return V1ResourceWithStreamingResponse(self._projects.v1) + + +class AsyncProjectsResourceWithStreamingResponse: + def __init__(self, projects: AsyncProjectsResource) -> None: + self._projects = projects + + @cached_property + def v1(self) -> AsyncV1ResourceWithStreamingResponse: + return AsyncV1ResourceWithStreamingResponse(self._projects.v1) diff --git a/src/gcore/resources/cloud/projects/v1.py b/src/gcore/resources/cloud/projects/v1.py new file mode 100644 index 00000000..5df0a0cc --- /dev/null +++ b/src/gcore/resources/cloud/projects/v1.py @@ -0,0 +1,595 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.projects import v1_list_params, v1_create_params, v1_update_params +from ....types.cloud.projects.project import Project +from ....types.cloud.projects.v1_list_response import V1ListResponse +from ....types.cloud.projects.v1_delete_response import V1DeleteResponse + +__all__ = ["V1Resource", "AsyncV1Resource"] + + +class V1Resource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> V1ResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return V1ResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> V1ResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return V1ResourceWithStreamingResponse(self) + + def create( + self, + *, + name: str, + client_id: Optional[int] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + state: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Project: + """Create project + + Args: + name: Unique project name for a client. + + Each client always has one "default" project. + + client_id: ID associated with the client. + + description: Description of the project. + + state: State of the project. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/cloud/v1/projects", + body=maybe_transform( + { + "name": name, + "client_id": client_id, + "description": description, + "state": state, + }, + v1_create_params.V1CreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Project, + ) + + def retrieve( + self, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Project: + """ + Get Project + + 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 project_id is None: + project_id = self._client._get_project_id_path_param() + return self._get( + f"/cloud/v1/projects/{project_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Project, + ) + + def update( + self, + *, + project_id: int | None = None, + name: str, + description: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Project: + """ + Update Project + + Args: + name: Name of the entity, following a specific format. + + description: Description of the project. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + return self._put( + f"/cloud/v1/projects/{project_id}", + body=maybe_transform( + { + "name": name, + "description": description, + }, + v1_update_params.V1UpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Project, + ) + + def list( + self, + *, + client_id: Optional[int] | NotGiven = NOT_GIVEN, + include_deleted: bool | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + order_by: Optional[List[Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"]]] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> V1ListResponse: + """ + List projects + + Args: + client_id: Client ID filter for administrators. + + include_deleted: Whether to include deleted entries in the response. + + name: Name to filter the results by. + + order_by: Order by field and direction. Supports multiple values. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cloud/v1/projects", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "client_id": client_id, + "include_deleted": include_deleted, + "name": name, + "order_by": order_by, + }, + v1_list_params.V1ListParams, + ), + ), + cast_to=V1ListResponse, + ) + + def delete( + self, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> V1DeleteResponse: + """ + All cloud resources in all regions that belong to the project will be deleted + and will not be recoverable + + 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 project_id is None: + project_id = self._client._get_project_id_path_param() + return self._delete( + f"/cloud/v1/projects/{project_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=V1DeleteResponse, + ) + + +class AsyncV1Resource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncV1ResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncV1ResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncV1ResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncV1ResourceWithStreamingResponse(self) + + async def create( + self, + *, + name: str, + client_id: Optional[int] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + state: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Project: + """Create project + + Args: + name: Unique project name for a client. + + Each client always has one "default" project. + + client_id: ID associated with the client. + + description: Description of the project. + + state: State of the project. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/cloud/v1/projects", + body=await async_maybe_transform( + { + "name": name, + "client_id": client_id, + "description": description, + "state": state, + }, + v1_create_params.V1CreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Project, + ) + + async def retrieve( + self, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Project: + """ + Get Project + + 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 project_id is None: + project_id = self._client._get_project_id_path_param() + return await self._get( + f"/cloud/v1/projects/{project_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Project, + ) + + async def update( + self, + *, + project_id: int | None = None, + name: str, + description: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Project: + """ + Update Project + + Args: + name: Name of the entity, following a specific format. + + description: Description of the project. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + return await self._put( + f"/cloud/v1/projects/{project_id}", + body=await async_maybe_transform( + { + "name": name, + "description": description, + }, + v1_update_params.V1UpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Project, + ) + + async def list( + self, + *, + client_id: Optional[int] | NotGiven = NOT_GIVEN, + include_deleted: bool | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + order_by: Optional[List[Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"]]] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> V1ListResponse: + """ + List projects + + Args: + client_id: Client ID filter for administrators. + + include_deleted: Whether to include deleted entries in the response. + + name: Name to filter the results by. + + order_by: Order by field and direction. Supports multiple values. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cloud/v1/projects", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "client_id": client_id, + "include_deleted": include_deleted, + "name": name, + "order_by": order_by, + }, + v1_list_params.V1ListParams, + ), + ), + cast_to=V1ListResponse, + ) + + async def delete( + self, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> V1DeleteResponse: + """ + All cloud resources in all regions that belong to the project will be deleted + and will not be recoverable + + 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 project_id is None: + project_id = self._client._get_project_id_path_param() + return await self._delete( + f"/cloud/v1/projects/{project_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=V1DeleteResponse, + ) + + +class V1ResourceWithRawResponse: + def __init__(self, v1: V1Resource) -> None: + self._v1 = v1 + + self.create = to_raw_response_wrapper( + v1.create, + ) + self.retrieve = to_raw_response_wrapper( + v1.retrieve, + ) + self.update = to_raw_response_wrapper( + v1.update, + ) + self.list = to_raw_response_wrapper( + v1.list, + ) + self.delete = to_raw_response_wrapper( + v1.delete, + ) + + +class AsyncV1ResourceWithRawResponse: + def __init__(self, v1: AsyncV1Resource) -> None: + self._v1 = v1 + + self.create = async_to_raw_response_wrapper( + v1.create, + ) + self.retrieve = async_to_raw_response_wrapper( + v1.retrieve, + ) + self.update = async_to_raw_response_wrapper( + v1.update, + ) + self.list = async_to_raw_response_wrapper( + v1.list, + ) + self.delete = async_to_raw_response_wrapper( + v1.delete, + ) + + +class V1ResourceWithStreamingResponse: + def __init__(self, v1: V1Resource) -> None: + self._v1 = v1 + + self.create = to_streamed_response_wrapper( + v1.create, + ) + self.retrieve = to_streamed_response_wrapper( + v1.retrieve, + ) + self.update = to_streamed_response_wrapper( + v1.update, + ) + self.list = to_streamed_response_wrapper( + v1.list, + ) + self.delete = to_streamed_response_wrapper( + v1.delete, + ) + + +class AsyncV1ResourceWithStreamingResponse: + def __init__(self, v1: AsyncV1Resource) -> None: + self._v1 = v1 + + self.create = async_to_streamed_response_wrapper( + v1.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + v1.retrieve, + ) + self.update = async_to_streamed_response_wrapper( + v1.update, + ) + self.list = async_to_streamed_response_wrapper( + v1.list, + ) + self.delete = async_to_streamed_response_wrapper( + v1.delete, + ) diff --git a/src/gcore/types/__init__.py b/src/gcore/types/__init__.py new file mode 100644 index 00000000..f8ee8b14 --- /dev/null +++ b/src/gcore/types/__init__.py @@ -0,0 +1,3 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py new file mode 100644 index 00000000..f8ee8b14 --- /dev/null +++ b/src/gcore/types/cloud/__init__.py @@ -0,0 +1,3 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations diff --git a/src/gcore/types/cloud/projects/__init__.py b/src/gcore/types/cloud/projects/__init__.py new file mode 100644 index 00000000..8de994e9 --- /dev/null +++ b/src/gcore/types/cloud/projects/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .project import Project as Project +from .v1_list_params import V1ListParams as V1ListParams +from .v1_create_params import V1CreateParams as V1CreateParams +from .v1_list_response import V1ListResponse as V1ListResponse +from .v1_update_params import V1UpdateParams as V1UpdateParams +from .v1_delete_response import V1DeleteResponse as V1DeleteResponse diff --git a/src/gcore/types/cloud/projects/project.py b/src/gcore/types/cloud/projects/project.py new file mode 100644 index 00000000..db5ad394 --- /dev/null +++ b/src/gcore/types/cloud/projects/project.py @@ -0,0 +1,43 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["Project"] + + +class Project(BaseModel): + id: int + """Project ID, which is automatically generated upon creation.""" + + client_id: int + """ID associated with the client.""" + + created_at: datetime + """Datetime of creation, which is automatically generated.""" + + is_default: bool + """Indicates if the project is the default one. + + Each client always has one default project. + """ + + name: str + """Unique project name for a client.""" + + state: str + """The state of the project.""" + + deleted_at: Optional[datetime] = None + """ + Datetime of deletion, which is automatically generated if the project is + deleted. + """ + + description: Optional[str] = None + """Description of the project.""" + + task_id: Optional[str] = None + """ID of the Task entity responsible for handling the project's state transition.""" diff --git a/src/gcore/types/cloud/projects/v1_create_params.py b/src/gcore/types/cloud/projects/v1_create_params.py new file mode 100644 index 00000000..30270429 --- /dev/null +++ b/src/gcore/types/cloud/projects/v1_create_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +__all__ = ["V1CreateParams"] + + +class V1CreateParams(TypedDict, total=False): + name: Required[str] + """Unique project name for a client. Each client always has one "default" project.""" + + client_id: Optional[int] + """ID associated with the client.""" + + description: Optional[str] + """Description of the project.""" + + state: Optional[str] + """State of the project.""" diff --git a/src/gcore/types/cloud/projects/v1_delete_response.py b/src/gcore/types/cloud/projects/v1_delete_response.py new file mode 100644 index 00000000..3a54974c --- /dev/null +++ b/src/gcore/types/cloud/projects/v1_delete_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["V1DeleteResponse"] + + +class V1DeleteResponse(BaseModel): + tasks: Optional[List[str]] = None + """Task list""" diff --git a/src/gcore/types/cloud/projects/v1_list_params.py b/src/gcore/types/cloud/projects/v1_list_params.py new file mode 100644 index 00000000..9b79e6af --- /dev/null +++ b/src/gcore/types/cloud/projects/v1_list_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["V1ListParams"] + + +class V1ListParams(TypedDict, total=False): + client_id: Optional[int] + """Client ID filter for administrators.""" + + include_deleted: bool + """Whether to include deleted entries in the response.""" + + name: Optional[str] + """Name to filter the results by.""" + + order_by: Optional[List[Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"]]] + """Order by field and direction. Supports multiple values.""" diff --git a/src/gcore/types/cloud/projects/v1_list_response.py b/src/gcore/types/cloud/projects/v1_list_response.py new file mode 100644 index 00000000..e86a59ce --- /dev/null +++ b/src/gcore/types/cloud/projects/v1_list_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .project import Project +from ...._models import BaseModel + +__all__ = ["V1ListResponse"] + + +class V1ListResponse(BaseModel): + count: int + """Number of objects""" + + results: List[Project] + """Objects""" diff --git a/src/gcore/types/cloud/projects/v1_update_params.py b/src/gcore/types/cloud/projects/v1_update_params.py new file mode 100644 index 00000000..3219e0da --- /dev/null +++ b/src/gcore/types/cloud/projects/v1_update_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 Optional +from typing_extensions import Required, TypedDict + +__all__ = ["V1UpdateParams"] + + +class V1UpdateParams(TypedDict, total=False): + project_id: int + + name: Required[str] + """Name of the entity, following a specific format.""" + + description: Optional[str] + """Description of the project.""" diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/__init__.py b/tests/api_resources/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/__init__.py b/tests/api_resources/cloud/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/projects/__init__.py b/tests/api_resources/cloud/projects/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/projects/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/projects/test_v1.py b/tests/api_resources/cloud/projects/test_v1.py new file mode 100644 index 00000000..3936f021 --- /dev/null +++ b/tests/api_resources/cloud/projects/test_v1.py @@ -0,0 +1,388 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.projects import ( + Project, + V1ListResponse, + V1DeleteResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestV1: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + v1 = client.cloud.projects.v1.create( + name="New Project", + ) + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + v1 = client.cloud.projects.v1.create( + name="New Project", + client_id=3, + description="Project description", + state="ACTIVE", + ) + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.projects.v1.with_raw_response.create( + name="New Project", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + v1 = response.parse() + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.projects.v1.with_streaming_response.create( + name="New Project", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + v1 = response.parse() + assert_matches_type(Project, v1, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Gcore) -> None: + v1 = client.cloud.projects.v1.retrieve( + project_id=0, + ) + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Gcore) -> None: + response = client.cloud.projects.v1.with_raw_response.retrieve( + project_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + v1 = response.parse() + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Gcore) -> None: + with client.cloud.projects.v1.with_streaming_response.retrieve( + project_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + v1 = response.parse() + assert_matches_type(Project, v1, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + v1 = client.cloud.projects.v1.update( + project_id=0, + name="New Project", + ) + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + v1 = client.cloud.projects.v1.update( + project_id=0, + name="New Project", + description="Project description", + ) + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.projects.v1.with_raw_response.update( + project_id=0, + name="New Project", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + v1 = response.parse() + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.projects.v1.with_streaming_response.update( + project_id=0, + name="New Project", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + v1 = response.parse() + assert_matches_type(Project, v1, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + v1 = client.cloud.projects.v1.list() + assert_matches_type(V1ListResponse, v1, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + v1 = client.cloud.projects.v1.list( + client_id=123, + include_deleted=False, + name="my-project", + order_by=["created_at.asc"], + ) + assert_matches_type(V1ListResponse, v1, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.projects.v1.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + v1 = response.parse() + assert_matches_type(V1ListResponse, v1, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.projects.v1.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + v1 = response.parse() + assert_matches_type(V1ListResponse, v1, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + v1 = client.cloud.projects.v1.delete( + project_id=0, + ) + assert_matches_type(V1DeleteResponse, v1, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.projects.v1.with_raw_response.delete( + project_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + v1 = response.parse() + assert_matches_type(V1DeleteResponse, v1, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.projects.v1.with_streaming_response.delete( + project_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + v1 = response.parse() + assert_matches_type(V1DeleteResponse, v1, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncV1: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + v1 = await async_client.cloud.projects.v1.create( + name="New Project", + ) + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + v1 = await async_client.cloud.projects.v1.create( + name="New Project", + client_id=3, + description="Project description", + state="ACTIVE", + ) + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.projects.v1.with_raw_response.create( + name="New Project", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + v1 = await response.parse() + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.projects.v1.with_streaming_response.create( + name="New Project", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + v1 = await response.parse() + assert_matches_type(Project, v1, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncGcore) -> None: + v1 = await async_client.cloud.projects.v1.retrieve( + project_id=0, + ) + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.projects.v1.with_raw_response.retrieve( + project_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + v1 = await response.parse() + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.projects.v1.with_streaming_response.retrieve( + project_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + v1 = await response.parse() + assert_matches_type(Project, v1, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + v1 = await async_client.cloud.projects.v1.update( + project_id=0, + name="New Project", + ) + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + v1 = await async_client.cloud.projects.v1.update( + project_id=0, + name="New Project", + description="Project description", + ) + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.projects.v1.with_raw_response.update( + project_id=0, + name="New Project", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + v1 = await response.parse() + assert_matches_type(Project, v1, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.projects.v1.with_streaming_response.update( + project_id=0, + name="New Project", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + v1 = await response.parse() + assert_matches_type(Project, v1, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + v1 = await async_client.cloud.projects.v1.list() + assert_matches_type(V1ListResponse, v1, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + v1 = await async_client.cloud.projects.v1.list( + client_id=123, + include_deleted=False, + name="my-project", + order_by=["created_at.asc"], + ) + assert_matches_type(V1ListResponse, v1, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.projects.v1.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + v1 = await response.parse() + assert_matches_type(V1ListResponse, v1, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.projects.v1.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + v1 = await response.parse() + assert_matches_type(V1ListResponse, v1, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + v1 = await async_client.cloud.projects.v1.delete( + project_id=0, + ) + assert_matches_type(V1DeleteResponse, v1, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.projects.v1.with_raw_response.delete( + project_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + v1 = await response.parse() + assert_matches_type(V1DeleteResponse, v1, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.projects.v1.with_streaming_response.delete( + project_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + v1 = await response.parse() + assert_matches_type(V1DeleteResponse, v1, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 00000000..0a9a2b2e --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,51 @@ +from __future__ import annotations + +import os +import logging +from typing import TYPE_CHECKING, Iterator, AsyncIterator + +import pytest +from pytest_asyncio import is_async_test + +from gcore import Gcore, AsyncGcore + +if TYPE_CHECKING: + from _pytest.fixtures import FixtureRequest + +pytest.register_assert_rewrite("tests.utils") + +logging.getLogger("gcore").setLevel(logging.DEBUG) + + +# automatically add `pytest.mark.asyncio()` to all of our async tests +# so we don't have to add that boilerplate everywhere +def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: + pytest_asyncio_tests = (item for item in items if is_async_test(item)) + session_scope_marker = pytest.mark.asyncio(loop_scope="session") + for async_test in pytest_asyncio_tests: + async_test.add_marker(session_scope_marker, append=False) + + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + +api_key = "My API Key" + + +@pytest.fixture(scope="session") +def client(request: FixtureRequest) -> Iterator[Gcore]: + strict = getattr(request, "param", True) + if not isinstance(strict, bool): + raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") + + with Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: + yield client + + +@pytest.fixture(scope="session") +async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncGcore]: + strict = getattr(request, "param", True) + if not isinstance(strict, bool): + raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") + + async with AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: + yield client diff --git a/tests/sample_file.txt b/tests/sample_file.txt new file mode 100644 index 00000000..af5626b4 --- /dev/null +++ b/tests/sample_file.txt @@ -0,0 +1 @@ +Hello, world! diff --git a/tests/test_client.py b/tests/test_client.py new file mode 100644 index 00000000..70e31e48 --- /dev/null +++ b/tests/test_client.py @@ -0,0 +1,1662 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import gc +import os +import sys +import json +import time +import asyncio +import inspect +import subprocess +import tracemalloc +from typing import Any, Union, cast +from textwrap import dedent +from unittest import mock +from typing_extensions import Literal + +import httpx +import pytest +from respx import MockRouter +from pydantic import ValidationError + +from gcore import Gcore, AsyncGcore, APIResponseValidationError +from gcore._types import Omit +from gcore._utils import maybe_transform +from gcore._models import BaseModel, FinalRequestOptions +from gcore._constants import RAW_RESPONSE_HEADER +from gcore._exceptions import GcoreError, APIStatusError, APITimeoutError, APIResponseValidationError +from gcore._base_client import DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, make_request_options +from gcore.types.cloud.projects.v1_create_params import V1CreateParams + +from .utils import update_env + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") +api_key = "My API Key" + + +def _get_params(client: BaseClient[Any, Any]) -> dict[str, str]: + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + url = httpx.URL(request.url) + return dict(url.params) + + +def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float: + return 0.1 + + +def _get_open_connections(client: Gcore | AsyncGcore) -> int: + transport = client._client._transport + assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) + + pool = transport._pool + return len(pool._requests) + + +class TestGcore: + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + + @pytest.mark.respx(base_url=base_url) + def test_raw_response(self, respx_mock: MockRouter) -> None: + respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = self.client.post("/foo", cast_to=httpx.Response) + assert response.status_code == 200 + assert isinstance(response, httpx.Response) + assert response.json() == {"foo": "bar"} + + @pytest.mark.respx(base_url=base_url) + def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + respx_mock.post("/foo").mock( + return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') + ) + + response = self.client.post("/foo", cast_to=httpx.Response) + assert response.status_code == 200 + assert isinstance(response, httpx.Response) + assert response.json() == {"foo": "bar"} + + def test_copy(self) -> None: + copied = self.client.copy() + assert id(copied) != id(self.client) + + copied = self.client.copy(api_key="another My API Key") + assert copied.api_key == "another My API Key" + assert self.client.api_key == "My API Key" + + def test_copy_default_options(self) -> None: + # options that have a default are overridden correctly + copied = self.client.copy(max_retries=7) + assert copied.max_retries == 7 + assert self.client.max_retries == 2 + + copied2 = copied.copy(max_retries=6) + assert copied2.max_retries == 6 + assert copied.max_retries == 7 + + # timeout + assert isinstance(self.client.timeout, httpx.Timeout) + copied = self.client.copy(timeout=None) + assert copied.timeout is None + assert isinstance(self.client.timeout, httpx.Timeout) + + def test_copy_default_headers(self) -> None: + client = Gcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} + ) + assert client.default_headers["X-Foo"] == "bar" + + # does not override the already given value when not specified + copied = client.copy() + assert copied.default_headers["X-Foo"] == "bar" + + # merges already given headers + copied = client.copy(default_headers={"X-Bar": "stainless"}) + assert copied.default_headers["X-Foo"] == "bar" + assert copied.default_headers["X-Bar"] == "stainless" + + # uses new values for any already given headers + copied = client.copy(default_headers={"X-Foo": "stainless"}) + assert copied.default_headers["X-Foo"] == "stainless" + + # set_default_headers + + # completely overrides already set values + copied = client.copy(set_default_headers={}) + assert copied.default_headers.get("X-Foo") is None + + copied = client.copy(set_default_headers={"X-Bar": "Robert"}) + assert copied.default_headers["X-Bar"] == "Robert" + + with pytest.raises( + ValueError, + match="`default_headers` and `set_default_headers` arguments are mutually exclusive", + ): + client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + + def test_copy_default_query(self) -> None: + client = Gcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} + ) + assert _get_params(client)["foo"] == "bar" + + # does not override the already given value when not specified + copied = client.copy() + assert _get_params(copied)["foo"] == "bar" + + # merges already given params + copied = client.copy(default_query={"bar": "stainless"}) + params = _get_params(copied) + assert params["foo"] == "bar" + assert params["bar"] == "stainless" + + # uses new values for any already given headers + copied = client.copy(default_query={"foo": "stainless"}) + assert _get_params(copied)["foo"] == "stainless" + + # set_default_query + + # completely overrides already set values + copied = client.copy(set_default_query={}) + assert _get_params(copied) == {} + + copied = client.copy(set_default_query={"bar": "Robert"}) + assert _get_params(copied)["bar"] == "Robert" + + with pytest.raises( + ValueError, + # TODO: update + match="`default_query` and `set_default_query` arguments are mutually exclusive", + ): + client.copy(set_default_query={}, default_query={"foo": "Bar"}) + + def test_copy_signature(self) -> None: + # ensure the same parameters that can be passed to the client are defined in the `.copy()` method + init_signature = inspect.signature( + # mypy doesn't like that we access the `__init__` property. + self.client.__init__, # type: ignore[misc] + ) + copy_signature = inspect.signature(self.client.copy) + exclude_params = {"transport", "proxies", "_strict_response_validation"} + + for name in init_signature.parameters.keys(): + if name in exclude_params: + continue + + copy_param = copy_signature.parameters.get(name) + assert copy_param is not None, f"copy() signature is missing the {name} param" + + def test_copy_build_request(self) -> None: + options = FinalRequestOptions(method="get", url="/foo") + + def build_request(options: FinalRequestOptions) -> None: + client = self.client.copy() + client._build_request(options) + + # ensure that the machinery is warmed up before tracing starts. + build_request(options) + gc.collect() + + tracemalloc.start(1000) + + snapshot_before = tracemalloc.take_snapshot() + + ITERATIONS = 10 + for _ in range(ITERATIONS): + build_request(options) + + gc.collect() + snapshot_after = tracemalloc.take_snapshot() + + tracemalloc.stop() + + def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: + if diff.count == 0: + # Avoid false positives by considering only leaks (i.e. allocations that persist). + return + + if diff.count % ITERATIONS != 0: + # Avoid false positives by considering only leaks that appear per iteration. + return + + for frame in diff.traceback: + if any( + frame.filename.endswith(fragment) + for fragment in [ + # to_raw_response_wrapper leaks through the @functools.wraps() decorator. + # + # removing the decorator fixes the leak for reasons we don't understand. + "gcore/_legacy_response.py", + "gcore/_response.py", + # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. + "gcore/_compat.py", + # Standard library leaks we don't care about. + "/logging/__init__.py", + ] + ): + return + + leaks.append(diff) + + leaks: list[tracemalloc.StatisticDiff] = [] + for diff in snapshot_after.compare_to(snapshot_before, "traceback"): + add_leak(leaks, diff) + if leaks: + for leak in leaks: + print("MEMORY LEAK:", leak) + for frame in leak.traceback: + print(frame) + raise AssertionError() + + def test_request_timeout(self) -> None: + request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT + + request = self.client._build_request( + FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) + ) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(100.0) + + def test_client_timeout_option(self) -> None: + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0)) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(0) + + def test_http_client_timeout_option(self) -> None: + # custom timeout given to the httpx client should be used + with httpx.Client(timeout=None) as http_client: + client = Gcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(None) + + # no timeout given to the httpx client should not use the httpx default + with httpx.Client() as http_client: + client = Gcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT + + # explicitly passing the default timeout currently results in it being ignored + with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: + client = Gcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # our default + + async def test_invalid_http_client(self) -> None: + with pytest.raises(TypeError, match="Invalid `http_client` arg"): + async with httpx.AsyncClient() as http_client: + Gcore( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=cast(Any, http_client), + ) + + def test_default_headers_option(self) -> None: + client = Gcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("x-foo") == "bar" + assert request.headers.get("x-stainless-lang") == "python" + + client2 = Gcore( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + default_headers={ + "X-Foo": "stainless", + "X-Stainless-Lang": "my-overriding-header", + }, + ) + request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("x-foo") == "stainless" + assert request.headers.get("x-stainless-lang") == "my-overriding-header" + + def test_validate_headers(self) -> None: + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("Authorization") == f"APIKey {api_key}" + + with pytest.raises(GcoreError): + with update_env(**{"GCORE_API_KEY": Omit()}): + client2 = Gcore(base_url=base_url, api_key=None, _strict_response_validation=True) + _ = client2 + + def test_default_query_option(self) -> None: + client = Gcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + url = httpx.URL(request.url) + assert dict(url.params) == {"query_param": "bar"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/foo", + params={"foo": "baz", "query_param": "overridden"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} + + def test_project_id_client_params(self) -> None: + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + + with client as c2: + with pytest.raises(ValueError, match="Missing project_id argument;"): + c2.cloud.projects.v1.retrieve() + + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, project_id=0) + with client as c2: + c2.cloud.projects.v1.retrieve() + + def test_request_extra_json(self) -> None: + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar"}, + extra_json={"baz": False}, + ), + ) + data = json.loads(request.content.decode("utf-8")) + assert data == {"foo": "bar", "baz": False} + + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + extra_json={"baz": False}, + ), + ) + data = json.loads(request.content.decode("utf-8")) + assert data == {"baz": False} + + # `extra_json` takes priority over `json_data` when keys clash + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar", "baz": True}, + extra_json={"baz": None}, + ), + ) + data = json.loads(request.content.decode("utf-8")) + assert data == {"foo": "bar", "baz": None} + + def test_request_extra_headers(self) -> None: + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options(extra_headers={"X-Foo": "Foo"}), + ), + ) + assert request.headers.get("X-Foo") == "Foo" + + # `extra_headers` takes priority over `default_headers` when keys clash + request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + extra_headers={"X-Bar": "false"}, + ), + ), + ) + assert request.headers.get("X-Bar") == "false" + + def test_request_extra_query(self) -> None: + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + extra_query={"my_query_param": "Foo"}, + ), + ), + ) + params = dict(request.url.params) + assert params == {"my_query_param": "Foo"} + + # if both `query` and `extra_query` are given, they are merged + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + query={"bar": "1"}, + extra_query={"foo": "2"}, + ), + ), + ) + params = dict(request.url.params) + assert params == {"bar": "1", "foo": "2"} + + # `extra_query` takes priority over `query` when keys clash + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + query={"foo": "1"}, + extra_query={"foo": "2"}, + ), + ), + ) + params = dict(request.url.params) + assert params == {"foo": "2"} + + def test_multipart_repeating_array(self, client: Gcore) -> None: + request = client._build_request( + FinalRequestOptions.construct( + method="get", + url="/foo", + headers={"Content-Type": "multipart/form-data; boundary=6b7ba517decee4a450543ea6ae821c82"}, + json_data={"array": ["foo", "bar"]}, + files=[("foo.txt", b"hello world")], + ) + ) + + assert request.read().split(b"\r\n") == [ + b"--6b7ba517decee4a450543ea6ae821c82", + b'Content-Disposition: form-data; name="array[]"', + b"", + b"foo", + b"--6b7ba517decee4a450543ea6ae821c82", + b'Content-Disposition: form-data; name="array[]"', + b"", + b"bar", + b"--6b7ba517decee4a450543ea6ae821c82", + b'Content-Disposition: form-data; name="foo.txt"; filename="upload"', + b"Content-Type: application/octet-stream", + b"", + b"hello world", + b"--6b7ba517decee4a450543ea6ae821c82--", + b"", + ] + + @pytest.mark.respx(base_url=base_url) + def test_basic_union_response(self, respx_mock: MockRouter) -> None: + class Model1(BaseModel): + name: str + + class Model2(BaseModel): + foo: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + assert isinstance(response, Model2) + assert response.foo == "bar" + + @pytest.mark.respx(base_url=base_url) + def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + """Union of objects with the same field name using a different type""" + + class Model1(BaseModel): + foo: int + + class Model2(BaseModel): + foo: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + assert isinstance(response, Model2) + assert response.foo == "bar" + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) + + response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + assert isinstance(response, Model1) + assert response.foo == 1 + + @pytest.mark.respx(base_url=base_url) + def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + """ + Response that sets Content-Type to something other than application/json but returns json data + """ + + class Model(BaseModel): + foo: int + + respx_mock.get("/foo").mock( + return_value=httpx.Response( + 200, + content=json.dumps({"foo": 2}), + headers={"Content-Type": "application/text"}, + ) + ) + + response = self.client.get("/foo", cast_to=Model) + assert isinstance(response, Model) + assert response.foo == 2 + + def test_base_url_setter(self) -> None: + client = Gcore(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) + assert client.base_url == "https://example.com/from_init/" + + client.base_url = "https://example.com/from_setter" # type: ignore[assignment] + + assert client.base_url == "https://example.com/from_setter/" + + def test_base_url_env(self) -> None: + with update_env(GCORE_BASE_URL="http://localhost:5000/from/env"): + client = Gcore(api_key=api_key, _strict_response_validation=True) + assert client.base_url == "http://localhost:5000/from/env/" + + @pytest.mark.parametrize( + "client", + [ + Gcore(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), + Gcore( + base_url="http://localhost:5000/custom/path/", + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.Client(), + ), + ], + ids=["standard", "custom http client"], + ) + def test_base_url_trailing_slash(self, client: Gcore) -> None: + request = client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar"}, + ), + ) + assert request.url == "http://localhost:5000/custom/path/foo" + + @pytest.mark.parametrize( + "client", + [ + Gcore(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), + Gcore( + base_url="http://localhost:5000/custom/path/", + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.Client(), + ), + ], + ids=["standard", "custom http client"], + ) + def test_base_url_no_trailing_slash(self, client: Gcore) -> None: + request = client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar"}, + ), + ) + assert request.url == "http://localhost:5000/custom/path/foo" + + @pytest.mark.parametrize( + "client", + [ + Gcore(base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True), + Gcore( + base_url="http://localhost:5000/custom/path/", + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.Client(), + ), + ], + ids=["standard", "custom http client"], + ) + def test_absolute_request_url(self, client: Gcore) -> None: + request = client._build_request( + FinalRequestOptions( + method="post", + url="https://myapi.com/foo", + json_data={"foo": "bar"}, + ), + ) + assert request.url == "https://myapi.com/foo" + + def test_copied_client_does_not_close_http(self) -> None: + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + assert not client.is_closed() + + copied = client.copy() + assert copied is not client + + del copied + + assert not client.is_closed() + + def test_client_context_manager(self) -> None: + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + with client as c2: + assert c2 is client + assert not c2.is_closed() + assert not client.is_closed() + assert client.is_closed() + + @pytest.mark.respx(base_url=base_url) + def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + class Model(BaseModel): + foo: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) + + with pytest.raises(APIResponseValidationError) as exc: + self.client.get("/foo", cast_to=Model) + + assert isinstance(exc.value.__cause__, ValidationError) + + def test_client_max_retries_validation(self) -> None: + with pytest.raises(TypeError, match=r"max_retries cannot be None"): + Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None)) + + @pytest.mark.respx(base_url=base_url) + def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: + class Model(BaseModel): + name: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, text="my-custom-format")) + + strict_client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + + with pytest.raises(APIResponseValidationError): + strict_client.get("/foo", cast_to=Model) + + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=False) + + response = client.get("/foo", cast_to=Model) + assert isinstance(response, str) # type: ignore[unreachable] + + @pytest.mark.parametrize( + "remaining_retries,retry_after,timeout", + [ + [3, "20", 20], + [3, "0", 0.5], + [3, "-10", 0.5], + [3, "60", 60], + [3, "61", 0.5], + [3, "Fri, 29 Sep 2023 16:26:57 GMT", 20], + [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:27:37 GMT", 60], + [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5], + [3, "99999999999999999999999999999999999", 0.5], + [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "", 0.5], + [2, "", 0.5 * 2.0], + [1, "", 0.5 * 4.0], + [-1100, "", 8], # test large number potentially overflowing + ], + ) + @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) + def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + + headers = httpx.Headers({"retry-after": retry_after}) + options = FinalRequestOptions(method="get", url="/foo", max_retries=3) + calculated = client._calculate_retry_timeout(remaining_retries, options, headers) + assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + + @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + respx_mock.post("/cloud/v1/projects").mock(side_effect=httpx.TimeoutException("Test timeout error")) + + with pytest.raises(APITimeoutError): + self.client.post( + "/cloud/v1/projects", + body=cast(object, maybe_transform(dict(name="New Project"), V1CreateParams)), + cast_to=httpx.Response, + options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, + ) + + assert _get_open_connections(self.client) == 0 + + @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + respx_mock.post("/cloud/v1/projects").mock(return_value=httpx.Response(500)) + + with pytest.raises(APIStatusError): + self.client.post( + "/cloud/v1/projects", + body=cast(object, maybe_transform(dict(name="New Project"), V1CreateParams)), + cast_to=httpx.Response, + options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, + ) + + assert _get_open_connections(self.client) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.parametrize("failure_mode", ["status", "exception"]) + def test_retries_taken( + self, + client: Gcore, + failures_before_success: int, + failure_mode: Literal["status", "exception"], + respx_mock: MockRouter, + ) -> None: + client = client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + if failure_mode == "exception": + raise RuntimeError("oops") + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) + + response = client.cloud.projects.v1.with_raw_response.create(name="New Project") + + assert response.retries_taken == failures_before_success + assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_omit_retry_count_header(self, client: Gcore, failures_before_success: int, respx_mock: MockRouter) -> None: + client = client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) + + response = client.cloud.projects.v1.with_raw_response.create( + name="New Project", extra_headers={"x-stainless-retry-count": Omit()} + ) + + assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_overwrite_retry_count_header( + self, client: Gcore, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) + + response = client.cloud.projects.v1.with_raw_response.create( + name="New Project", extra_headers={"x-stainless-retry-count": "42"} + ) + + assert response.http_request.headers.get("x-stainless-retry-count") == "42" + + +class TestAsyncGcore: + client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_raw_response(self, respx_mock: MockRouter) -> None: + respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = await self.client.post("/foo", cast_to=httpx.Response) + assert response.status_code == 200 + assert isinstance(response, httpx.Response) + assert response.json() == {"foo": "bar"} + + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + respx_mock.post("/foo").mock( + return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') + ) + + response = await self.client.post("/foo", cast_to=httpx.Response) + assert response.status_code == 200 + assert isinstance(response, httpx.Response) + assert response.json() == {"foo": "bar"} + + def test_copy(self) -> None: + copied = self.client.copy() + assert id(copied) != id(self.client) + + copied = self.client.copy(api_key="another My API Key") + assert copied.api_key == "another My API Key" + assert self.client.api_key == "My API Key" + + def test_copy_default_options(self) -> None: + # options that have a default are overridden correctly + copied = self.client.copy(max_retries=7) + assert copied.max_retries == 7 + assert self.client.max_retries == 2 + + copied2 = copied.copy(max_retries=6) + assert copied2.max_retries == 6 + assert copied.max_retries == 7 + + # timeout + assert isinstance(self.client.timeout, httpx.Timeout) + copied = self.client.copy(timeout=None) + assert copied.timeout is None + assert isinstance(self.client.timeout, httpx.Timeout) + + def test_copy_default_headers(self) -> None: + client = AsyncGcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} + ) + assert client.default_headers["X-Foo"] == "bar" + + # does not override the already given value when not specified + copied = client.copy() + assert copied.default_headers["X-Foo"] == "bar" + + # merges already given headers + copied = client.copy(default_headers={"X-Bar": "stainless"}) + assert copied.default_headers["X-Foo"] == "bar" + assert copied.default_headers["X-Bar"] == "stainless" + + # uses new values for any already given headers + copied = client.copy(default_headers={"X-Foo": "stainless"}) + assert copied.default_headers["X-Foo"] == "stainless" + + # set_default_headers + + # completely overrides already set values + copied = client.copy(set_default_headers={}) + assert copied.default_headers.get("X-Foo") is None + + copied = client.copy(set_default_headers={"X-Bar": "Robert"}) + assert copied.default_headers["X-Bar"] == "Robert" + + with pytest.raises( + ValueError, + match="`default_headers` and `set_default_headers` arguments are mutually exclusive", + ): + client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + + def test_copy_default_query(self) -> None: + client = AsyncGcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} + ) + assert _get_params(client)["foo"] == "bar" + + # does not override the already given value when not specified + copied = client.copy() + assert _get_params(copied)["foo"] == "bar" + + # merges already given params + copied = client.copy(default_query={"bar": "stainless"}) + params = _get_params(copied) + assert params["foo"] == "bar" + assert params["bar"] == "stainless" + + # uses new values for any already given headers + copied = client.copy(default_query={"foo": "stainless"}) + assert _get_params(copied)["foo"] == "stainless" + + # set_default_query + + # completely overrides already set values + copied = client.copy(set_default_query={}) + assert _get_params(copied) == {} + + copied = client.copy(set_default_query={"bar": "Robert"}) + assert _get_params(copied)["bar"] == "Robert" + + with pytest.raises( + ValueError, + # TODO: update + match="`default_query` and `set_default_query` arguments are mutually exclusive", + ): + client.copy(set_default_query={}, default_query={"foo": "Bar"}) + + def test_copy_signature(self) -> None: + # ensure the same parameters that can be passed to the client are defined in the `.copy()` method + init_signature = inspect.signature( + # mypy doesn't like that we access the `__init__` property. + self.client.__init__, # type: ignore[misc] + ) + copy_signature = inspect.signature(self.client.copy) + exclude_params = {"transport", "proxies", "_strict_response_validation"} + + for name in init_signature.parameters.keys(): + if name in exclude_params: + continue + + copy_param = copy_signature.parameters.get(name) + assert copy_param is not None, f"copy() signature is missing the {name} param" + + def test_copy_build_request(self) -> None: + options = FinalRequestOptions(method="get", url="/foo") + + def build_request(options: FinalRequestOptions) -> None: + client = self.client.copy() + client._build_request(options) + + # ensure that the machinery is warmed up before tracing starts. + build_request(options) + gc.collect() + + tracemalloc.start(1000) + + snapshot_before = tracemalloc.take_snapshot() + + ITERATIONS = 10 + for _ in range(ITERATIONS): + build_request(options) + + gc.collect() + snapshot_after = tracemalloc.take_snapshot() + + tracemalloc.stop() + + def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: + if diff.count == 0: + # Avoid false positives by considering only leaks (i.e. allocations that persist). + return + + if diff.count % ITERATIONS != 0: + # Avoid false positives by considering only leaks that appear per iteration. + return + + for frame in diff.traceback: + if any( + frame.filename.endswith(fragment) + for fragment in [ + # to_raw_response_wrapper leaks through the @functools.wraps() decorator. + # + # removing the decorator fixes the leak for reasons we don't understand. + "gcore/_legacy_response.py", + "gcore/_response.py", + # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. + "gcore/_compat.py", + # Standard library leaks we don't care about. + "/logging/__init__.py", + ] + ): + return + + leaks.append(diff) + + leaks: list[tracemalloc.StatisticDiff] = [] + for diff in snapshot_after.compare_to(snapshot_before, "traceback"): + add_leak(leaks, diff) + if leaks: + for leak in leaks: + print("MEMORY LEAK:", leak) + for frame in leak.traceback: + print(frame) + raise AssertionError() + + async def test_request_timeout(self) -> None: + request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT + + request = self.client._build_request( + FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) + ) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(100.0) + + async def test_client_timeout_option(self) -> None: + client = AsyncGcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, timeout=httpx.Timeout(0) + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(0) + + async def test_http_client_timeout_option(self) -> None: + # custom timeout given to the httpx client should be used + async with httpx.AsyncClient(timeout=None) as http_client: + client = AsyncGcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(None) + + # no timeout given to the httpx client should not use the httpx default + async with httpx.AsyncClient() as http_client: + client = AsyncGcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT + + # explicitly passing the default timeout currently results in it being ignored + async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: + client = AsyncGcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, http_client=http_client + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # our default + + def test_invalid_http_client(self) -> None: + with pytest.raises(TypeError, match="Invalid `http_client` arg"): + with httpx.Client() as http_client: + AsyncGcore( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=cast(Any, http_client), + ) + + def test_default_headers_option(self) -> None: + client = AsyncGcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("x-foo") == "bar" + assert request.headers.get("x-stainless-lang") == "python" + + client2 = AsyncGcore( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + default_headers={ + "X-Foo": "stainless", + "X-Stainless-Lang": "my-overriding-header", + }, + ) + request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("x-foo") == "stainless" + assert request.headers.get("x-stainless-lang") == "my-overriding-header" + + def test_validate_headers(self) -> None: + client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("Authorization") == f"APIKey {api_key}" + + with pytest.raises(GcoreError): + with update_env(**{"GCORE_API_KEY": Omit()}): + client2 = AsyncGcore(base_url=base_url, api_key=None, _strict_response_validation=True) + _ = client2 + + def test_default_query_option(self) -> None: + client = AsyncGcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + url = httpx.URL(request.url) + assert dict(url.params) == {"query_param": "bar"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/foo", + params={"foo": "baz", "query_param": "overridden"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} + + async def test_project_id_client_params(self) -> None: + client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + + async with client as c2: + with pytest.raises(ValueError, match="Missing project_id argument;"): + await c2.cloud.projects.v1.retrieve() + + client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, project_id=0) + async with client as c2: + await c2.cloud.projects.v1.retrieve() + + def test_request_extra_json(self) -> None: + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar"}, + extra_json={"baz": False}, + ), + ) + data = json.loads(request.content.decode("utf-8")) + assert data == {"foo": "bar", "baz": False} + + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + extra_json={"baz": False}, + ), + ) + data = json.loads(request.content.decode("utf-8")) + assert data == {"baz": False} + + # `extra_json` takes priority over `json_data` when keys clash + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar", "baz": True}, + extra_json={"baz": None}, + ), + ) + data = json.loads(request.content.decode("utf-8")) + assert data == {"foo": "bar", "baz": None} + + def test_request_extra_headers(self) -> None: + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options(extra_headers={"X-Foo": "Foo"}), + ), + ) + assert request.headers.get("X-Foo") == "Foo" + + # `extra_headers` takes priority over `default_headers` when keys clash + request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + extra_headers={"X-Bar": "false"}, + ), + ), + ) + assert request.headers.get("X-Bar") == "false" + + def test_request_extra_query(self) -> None: + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + extra_query={"my_query_param": "Foo"}, + ), + ), + ) + params = dict(request.url.params) + assert params == {"my_query_param": "Foo"} + + # if both `query` and `extra_query` are given, they are merged + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + query={"bar": "1"}, + extra_query={"foo": "2"}, + ), + ), + ) + params = dict(request.url.params) + assert params == {"bar": "1", "foo": "2"} + + # `extra_query` takes priority over `query` when keys clash + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + query={"foo": "1"}, + extra_query={"foo": "2"}, + ), + ), + ) + params = dict(request.url.params) + assert params == {"foo": "2"} + + def test_multipart_repeating_array(self, async_client: AsyncGcore) -> None: + request = async_client._build_request( + FinalRequestOptions.construct( + method="get", + url="/foo", + headers={"Content-Type": "multipart/form-data; boundary=6b7ba517decee4a450543ea6ae821c82"}, + json_data={"array": ["foo", "bar"]}, + files=[("foo.txt", b"hello world")], + ) + ) + + assert request.read().split(b"\r\n") == [ + b"--6b7ba517decee4a450543ea6ae821c82", + b'Content-Disposition: form-data; name="array[]"', + b"", + b"foo", + b"--6b7ba517decee4a450543ea6ae821c82", + b'Content-Disposition: form-data; name="array[]"', + b"", + b"bar", + b"--6b7ba517decee4a450543ea6ae821c82", + b'Content-Disposition: form-data; name="foo.txt"; filename="upload"', + b"Content-Type: application/octet-stream", + b"", + b"hello world", + b"--6b7ba517decee4a450543ea6ae821c82--", + b"", + ] + + @pytest.mark.respx(base_url=base_url) + async def test_basic_union_response(self, respx_mock: MockRouter) -> None: + class Model1(BaseModel): + name: str + + class Model2(BaseModel): + foo: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + assert isinstance(response, Model2) + assert response.foo == "bar" + + @pytest.mark.respx(base_url=base_url) + async def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + """Union of objects with the same field name using a different type""" + + class Model1(BaseModel): + foo: int + + class Model2(BaseModel): + foo: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + assert isinstance(response, Model2) + assert response.foo == "bar" + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) + + response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + assert isinstance(response, Model1) + assert response.foo == 1 + + @pytest.mark.respx(base_url=base_url) + async def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + """ + Response that sets Content-Type to something other than application/json but returns json data + """ + + class Model(BaseModel): + foo: int + + respx_mock.get("/foo").mock( + return_value=httpx.Response( + 200, + content=json.dumps({"foo": 2}), + headers={"Content-Type": "application/text"}, + ) + ) + + response = await self.client.get("/foo", cast_to=Model) + assert isinstance(response, Model) + assert response.foo == 2 + + def test_base_url_setter(self) -> None: + client = AsyncGcore(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) + assert client.base_url == "https://example.com/from_init/" + + client.base_url = "https://example.com/from_setter" # type: ignore[assignment] + + assert client.base_url == "https://example.com/from_setter/" + + def test_base_url_env(self) -> None: + with update_env(GCORE_BASE_URL="http://localhost:5000/from/env"): + client = AsyncGcore(api_key=api_key, _strict_response_validation=True) + assert client.base_url == "http://localhost:5000/from/env/" + + @pytest.mark.parametrize( + "client", + [ + AsyncGcore( + base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True + ), + AsyncGcore( + base_url="http://localhost:5000/custom/path/", + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.AsyncClient(), + ), + ], + ids=["standard", "custom http client"], + ) + def test_base_url_trailing_slash(self, client: AsyncGcore) -> None: + request = client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar"}, + ), + ) + assert request.url == "http://localhost:5000/custom/path/foo" + + @pytest.mark.parametrize( + "client", + [ + AsyncGcore( + base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True + ), + AsyncGcore( + base_url="http://localhost:5000/custom/path/", + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.AsyncClient(), + ), + ], + ids=["standard", "custom http client"], + ) + def test_base_url_no_trailing_slash(self, client: AsyncGcore) -> None: + request = client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar"}, + ), + ) + assert request.url == "http://localhost:5000/custom/path/foo" + + @pytest.mark.parametrize( + "client", + [ + AsyncGcore( + base_url="http://localhost:5000/custom/path/", api_key=api_key, _strict_response_validation=True + ), + AsyncGcore( + base_url="http://localhost:5000/custom/path/", + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.AsyncClient(), + ), + ], + ids=["standard", "custom http client"], + ) + def test_absolute_request_url(self, client: AsyncGcore) -> None: + request = client._build_request( + FinalRequestOptions( + method="post", + url="https://myapi.com/foo", + json_data={"foo": "bar"}, + ), + ) + assert request.url == "https://myapi.com/foo" + + async def test_copied_client_does_not_close_http(self) -> None: + client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + assert not client.is_closed() + + copied = client.copy() + assert copied is not client + + del copied + + await asyncio.sleep(0.2) + assert not client.is_closed() + + async def test_client_context_manager(self) -> None: + client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + async with client as c2: + assert c2 is client + assert not c2.is_closed() + assert not client.is_closed() + assert client.is_closed() + + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + class Model(BaseModel): + foo: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) + + with pytest.raises(APIResponseValidationError) as exc: + await self.client.get("/foo", cast_to=Model) + + assert isinstance(exc.value.__cause__, ValidationError) + + async def test_client_max_retries_validation(self) -> None: + with pytest.raises(TypeError, match=r"max_retries cannot be None"): + AsyncGcore( + base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None) + ) + + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: + class Model(BaseModel): + name: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, text="my-custom-format")) + + strict_client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + + with pytest.raises(APIResponseValidationError): + await strict_client.get("/foo", cast_to=Model) + + client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=False) + + response = await client.get("/foo", cast_to=Model) + assert isinstance(response, str) # type: ignore[unreachable] + + @pytest.mark.parametrize( + "remaining_retries,retry_after,timeout", + [ + [3, "20", 20], + [3, "0", 0.5], + [3, "-10", 0.5], + [3, "60", 60], + [3, "61", 0.5], + [3, "Fri, 29 Sep 2023 16:26:57 GMT", 20], + [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:27:37 GMT", 60], + [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5], + [3, "99999999999999999999999999999999999", 0.5], + [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "", 0.5], + [2, "", 0.5 * 2.0], + [1, "", 0.5 * 4.0], + [-1100, "", 8], # test large number potentially overflowing + ], + ) + @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) + @pytest.mark.asyncio + async def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: + client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + + headers = httpx.Headers({"retry-after": retry_after}) + options = FinalRequestOptions(method="get", url="/foo", max_retries=3) + calculated = client._calculate_retry_timeout(remaining_retries, options, headers) + assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + + @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + respx_mock.post("/cloud/v1/projects").mock(side_effect=httpx.TimeoutException("Test timeout error")) + + with pytest.raises(APITimeoutError): + await self.client.post( + "/cloud/v1/projects", + body=cast(object, maybe_transform(dict(name="New Project"), V1CreateParams)), + cast_to=httpx.Response, + options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, + ) + + assert _get_open_connections(self.client) == 0 + + @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + respx_mock.post("/cloud/v1/projects").mock(return_value=httpx.Response(500)) + + with pytest.raises(APIStatusError): + await self.client.post( + "/cloud/v1/projects", + body=cast(object, maybe_transform(dict(name="New Project"), V1CreateParams)), + cast_to=httpx.Response, + options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, + ) + + assert _get_open_connections(self.client) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + @pytest.mark.parametrize("failure_mode", ["status", "exception"]) + async def test_retries_taken( + self, + async_client: AsyncGcore, + failures_before_success: int, + failure_mode: Literal["status", "exception"], + respx_mock: MockRouter, + ) -> None: + client = async_client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + if failure_mode == "exception": + raise RuntimeError("oops") + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) + + response = await client.cloud.projects.v1.with_raw_response.create(name="New Project") + + assert response.retries_taken == failures_before_success + assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_omit_retry_count_header( + self, async_client: AsyncGcore, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = async_client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) + + response = await client.cloud.projects.v1.with_raw_response.create( + name="New Project", extra_headers={"x-stainless-retry-count": Omit()} + ) + + assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_overwrite_retry_count_header( + self, async_client: AsyncGcore, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = async_client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) + + response = await client.cloud.projects.v1.with_raw_response.create( + name="New Project", extra_headers={"x-stainless-retry-count": "42"} + ) + + assert response.http_request.headers.get("x-stainless-retry-count") == "42" + + def test_get_platform(self) -> None: + # A previous implementation of asyncify could leave threads unterminated when + # used with nest_asyncio. + # + # Since nest_asyncio.apply() is global and cannot be un-applied, this + # test is run in a separate process to avoid affecting other tests. + test_code = dedent(""" + import asyncio + import nest_asyncio + import threading + + from gcore._utils import asyncify + from gcore._base_client import get_platform + + async def test_main() -> None: + result = await asyncify(get_platform)() + print(result) + for thread in threading.enumerate(): + print(thread.name) + + nest_asyncio.apply() + asyncio.run(test_main()) + """) + with subprocess.Popen( + [sys.executable, "-c", test_code], + text=True, + ) as process: + timeout = 10 # seconds + + start_time = time.monotonic() + while True: + return_code = process.poll() + if return_code is not None: + if return_code != 0: + raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") + + # success + break + + if time.monotonic() - start_time > timeout: + process.kill() + raise AssertionError("calling get_platform using asyncify resulted in a hung process") + + time.sleep(0.1) diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py new file mode 100644 index 00000000..fe51174e --- /dev/null +++ b/tests/test_deepcopy.py @@ -0,0 +1,58 @@ +from gcore._utils import deepcopy_minimal + + +def assert_different_identities(obj1: object, obj2: object) -> None: + assert obj1 == obj2 + assert id(obj1) != id(obj2) + + +def test_simple_dict() -> None: + obj1 = {"foo": "bar"} + obj2 = deepcopy_minimal(obj1) + assert_different_identities(obj1, obj2) + + +def test_nested_dict() -> None: + obj1 = {"foo": {"bar": True}} + obj2 = deepcopy_minimal(obj1) + assert_different_identities(obj1, obj2) + assert_different_identities(obj1["foo"], obj2["foo"]) + + +def test_complex_nested_dict() -> None: + obj1 = {"foo": {"bar": [{"hello": "world"}]}} + obj2 = deepcopy_minimal(obj1) + assert_different_identities(obj1, obj2) + assert_different_identities(obj1["foo"], obj2["foo"]) + assert_different_identities(obj1["foo"]["bar"], obj2["foo"]["bar"]) + assert_different_identities(obj1["foo"]["bar"][0], obj2["foo"]["bar"][0]) + + +def test_simple_list() -> None: + obj1 = ["a", "b", "c"] + obj2 = deepcopy_minimal(obj1) + assert_different_identities(obj1, obj2) + + +def test_nested_list() -> None: + obj1 = ["a", [1, 2, 3]] + obj2 = deepcopy_minimal(obj1) + assert_different_identities(obj1, obj2) + assert_different_identities(obj1[1], obj2[1]) + + +class MyObject: ... + + +def test_ignores_other_types() -> None: + # custom classes + my_obj = MyObject() + obj1 = {"foo": my_obj} + obj2 = deepcopy_minimal(obj1) + assert_different_identities(obj1, obj2) + assert obj1["foo"] is my_obj + + # tuples + obj3 = ("a", "b") + obj4 = deepcopy_minimal(obj3) + assert obj3 is obj4 diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py new file mode 100644 index 00000000..d67473bc --- /dev/null +++ b/tests/test_extract_files.py @@ -0,0 +1,64 @@ +from __future__ import annotations + +from typing import Sequence + +import pytest + +from gcore._types import FileTypes +from gcore._utils import extract_files + + +def test_removes_files_from_input() -> None: + query = {"foo": "bar"} + assert extract_files(query, paths=[]) == [] + assert query == {"foo": "bar"} + + query2 = {"foo": b"Bar", "hello": "world"} + assert extract_files(query2, paths=[["foo"]]) == [("foo", b"Bar")] + assert query2 == {"hello": "world"} + + query3 = {"foo": {"foo": {"bar": b"Bar"}}, "hello": "world"} + assert extract_files(query3, paths=[["foo", "foo", "bar"]]) == [("foo[foo][bar]", b"Bar")] + assert query3 == {"foo": {"foo": {}}, "hello": "world"} + + query4 = {"foo": {"bar": b"Bar", "baz": "foo"}, "hello": "world"} + assert extract_files(query4, paths=[["foo", "bar"]]) == [("foo[bar]", b"Bar")] + assert query4 == {"hello": "world", "foo": {"baz": "foo"}} + + +def test_multiple_files() -> None: + query = {"documents": [{"file": b"My first file"}, {"file": b"My second file"}]} + assert extract_files(query, paths=[["documents", "", "file"]]) == [ + ("documents[][file]", b"My first file"), + ("documents[][file]", b"My second file"), + ] + assert query == {"documents": [{}, {}]} + + +@pytest.mark.parametrize( + "query,paths,expected", + [ + [ + {"foo": {"bar": "baz"}}, + [["foo", "", "bar"]], + [], + ], + [ + {"foo": ["bar", "baz"]}, + [["foo", "bar"]], + [], + ], + [ + {"foo": {"bar": "baz"}}, + [["foo", "foo"]], + [], + ], + ], + ids=["dict expecting array", "array expecting dict", "unknown keys"], +) +def test_ignores_incorrect_paths( + query: dict[str, object], + paths: Sequence[Sequence[str]], + expected: list[tuple[str, FileTypes]], +) -> None: + assert extract_files(query, paths=paths) == expected diff --git a/tests/test_files.py b/tests/test_files.py new file mode 100644 index 00000000..d8e5a6f7 --- /dev/null +++ b/tests/test_files.py @@ -0,0 +1,51 @@ +from pathlib import Path + +import anyio +import pytest +from dirty_equals import IsDict, IsList, IsBytes, IsTuple + +from gcore._files import to_httpx_files, async_to_httpx_files + +readme_path = Path(__file__).parent.parent.joinpath("README.md") + + +def test_pathlib_includes_file_name() -> None: + result = to_httpx_files({"file": readme_path}) + print(result) + assert result == IsDict({"file": IsTuple("README.md", IsBytes())}) + + +def test_tuple_input() -> None: + result = to_httpx_files([("file", readme_path)]) + print(result) + assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes()))) + + +@pytest.mark.asyncio +async def test_async_pathlib_includes_file_name() -> None: + result = await async_to_httpx_files({"file": readme_path}) + print(result) + assert result == IsDict({"file": IsTuple("README.md", IsBytes())}) + + +@pytest.mark.asyncio +async def test_async_supports_anyio_path() -> None: + result = await async_to_httpx_files({"file": anyio.Path(readme_path)}) + print(result) + assert result == IsDict({"file": IsTuple("README.md", IsBytes())}) + + +@pytest.mark.asyncio +async def test_async_tuple_input() -> None: + result = await async_to_httpx_files([("file", readme_path)]) + print(result) + assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes()))) + + +def test_string_not_allowed() -> None: + with pytest.raises(TypeError, match="Expected file types input to be a FileContent type or to be a tuple"): + to_httpx_files( + { + "file": "foo", # type: ignore + } + ) diff --git a/tests/test_models.py b/tests/test_models.py new file mode 100644 index 00000000..ed447300 --- /dev/null +++ b/tests/test_models.py @@ -0,0 +1,888 @@ +import json +from typing import Any, Dict, List, Union, Optional, cast +from datetime import datetime, timezone +from typing_extensions import Literal, Annotated, TypeAliasType + +import pytest +import pydantic +from pydantic import Field + +from gcore._utils import PropertyInfo +from gcore._compat import PYDANTIC_V2, parse_obj, model_dump, model_json +from gcore._models import BaseModel, construct_type + + +class BasicModel(BaseModel): + foo: str + + +@pytest.mark.parametrize("value", ["hello", 1], ids=["correct type", "mismatched"]) +def test_basic(value: object) -> None: + m = BasicModel.construct(foo=value) + assert m.foo == value + + +def test_directly_nested_model() -> None: + class NestedModel(BaseModel): + nested: BasicModel + + m = NestedModel.construct(nested={"foo": "Foo!"}) + assert m.nested.foo == "Foo!" + + # mismatched types + m = NestedModel.construct(nested="hello!") + assert cast(Any, m.nested) == "hello!" + + +def test_optional_nested_model() -> None: + class NestedModel(BaseModel): + nested: Optional[BasicModel] + + m1 = NestedModel.construct(nested=None) + assert m1.nested is None + + m2 = NestedModel.construct(nested={"foo": "bar"}) + assert m2.nested is not None + assert m2.nested.foo == "bar" + + # mismatched types + m3 = NestedModel.construct(nested={"foo"}) + assert isinstance(cast(Any, m3.nested), set) + assert cast(Any, m3.nested) == {"foo"} + + +def test_list_nested_model() -> None: + class NestedModel(BaseModel): + nested: List[BasicModel] + + m = NestedModel.construct(nested=[{"foo": "bar"}, {"foo": "2"}]) + assert m.nested is not None + assert isinstance(m.nested, list) + assert len(m.nested) == 2 + assert m.nested[0].foo == "bar" + assert m.nested[1].foo == "2" + + # mismatched types + m = NestedModel.construct(nested=True) + assert cast(Any, m.nested) is True + + m = NestedModel.construct(nested=[False]) + assert cast(Any, m.nested) == [False] + + +def test_optional_list_nested_model() -> None: + class NestedModel(BaseModel): + nested: Optional[List[BasicModel]] + + m1 = NestedModel.construct(nested=[{"foo": "bar"}, {"foo": "2"}]) + assert m1.nested is not None + assert isinstance(m1.nested, list) + assert len(m1.nested) == 2 + assert m1.nested[0].foo == "bar" + assert m1.nested[1].foo == "2" + + m2 = NestedModel.construct(nested=None) + assert m2.nested is None + + # mismatched types + m3 = NestedModel.construct(nested={1}) + assert cast(Any, m3.nested) == {1} + + m4 = NestedModel.construct(nested=[False]) + assert cast(Any, m4.nested) == [False] + + +def test_list_optional_items_nested_model() -> None: + class NestedModel(BaseModel): + nested: List[Optional[BasicModel]] + + m = NestedModel.construct(nested=[None, {"foo": "bar"}]) + assert m.nested is not None + assert isinstance(m.nested, list) + assert len(m.nested) == 2 + assert m.nested[0] is None + assert m.nested[1] is not None + assert m.nested[1].foo == "bar" + + # mismatched types + m3 = NestedModel.construct(nested="foo") + assert cast(Any, m3.nested) == "foo" + + m4 = NestedModel.construct(nested=[False]) + assert cast(Any, m4.nested) == [False] + + +def test_list_mismatched_type() -> None: + class NestedModel(BaseModel): + nested: List[str] + + m = NestedModel.construct(nested=False) + assert cast(Any, m.nested) is False + + +def test_raw_dictionary() -> None: + class NestedModel(BaseModel): + nested: Dict[str, str] + + m = NestedModel.construct(nested={"hello": "world"}) + assert m.nested == {"hello": "world"} + + # mismatched types + m = NestedModel.construct(nested=False) + assert cast(Any, m.nested) is False + + +def test_nested_dictionary_model() -> None: + class NestedModel(BaseModel): + nested: Dict[str, BasicModel] + + m = NestedModel.construct(nested={"hello": {"foo": "bar"}}) + assert isinstance(m.nested, dict) + assert m.nested["hello"].foo == "bar" + + # mismatched types + m = NestedModel.construct(nested={"hello": False}) + assert cast(Any, m.nested["hello"]) is False + + +def test_unknown_fields() -> None: + m1 = BasicModel.construct(foo="foo", unknown=1) + assert m1.foo == "foo" + assert cast(Any, m1).unknown == 1 + + m2 = BasicModel.construct(foo="foo", unknown={"foo_bar": True}) + assert m2.foo == "foo" + assert cast(Any, m2).unknown == {"foo_bar": True} + + assert model_dump(m2) == {"foo": "foo", "unknown": {"foo_bar": True}} + + +def test_strict_validation_unknown_fields() -> None: + class Model(BaseModel): + foo: str + + model = parse_obj(Model, dict(foo="hello!", user="Robert")) + assert model.foo == "hello!" + assert cast(Any, model).user == "Robert" + + assert model_dump(model) == {"foo": "hello!", "user": "Robert"} + + +def test_aliases() -> None: + class Model(BaseModel): + my_field: int = Field(alias="myField") + + m = Model.construct(myField=1) + assert m.my_field == 1 + + # mismatched types + m = Model.construct(myField={"hello": False}) + assert cast(Any, m.my_field) == {"hello": False} + + +def test_repr() -> None: + model = BasicModel(foo="bar") + assert str(model) == "BasicModel(foo='bar')" + assert repr(model) == "BasicModel(foo='bar')" + + +def test_repr_nested_model() -> None: + class Child(BaseModel): + name: str + age: int + + class Parent(BaseModel): + name: str + child: Child + + model = Parent(name="Robert", child=Child(name="Foo", age=5)) + assert str(model) == "Parent(name='Robert', child=Child(name='Foo', age=5))" + assert repr(model) == "Parent(name='Robert', child=Child(name='Foo', age=5))" + + +def test_optional_list() -> None: + class Submodel(BaseModel): + name: str + + class Model(BaseModel): + items: Optional[List[Submodel]] + + m = Model.construct(items=None) + assert m.items is None + + m = Model.construct(items=[]) + assert m.items == [] + + m = Model.construct(items=[{"name": "Robert"}]) + assert m.items is not None + assert len(m.items) == 1 + assert m.items[0].name == "Robert" + + +def test_nested_union_of_models() -> None: + class Submodel1(BaseModel): + bar: bool + + class Submodel2(BaseModel): + thing: str + + class Model(BaseModel): + foo: Union[Submodel1, Submodel2] + + m = Model.construct(foo={"thing": "hello"}) + assert isinstance(m.foo, Submodel2) + assert m.foo.thing == "hello" + + +def test_nested_union_of_mixed_types() -> None: + class Submodel1(BaseModel): + bar: bool + + class Model(BaseModel): + foo: Union[Submodel1, Literal[True], Literal["CARD_HOLDER"]] + + m = Model.construct(foo=True) + assert m.foo is True + + m = Model.construct(foo="CARD_HOLDER") + assert m.foo == "CARD_HOLDER" + + m = Model.construct(foo={"bar": False}) + assert isinstance(m.foo, Submodel1) + assert m.foo.bar is False + + +def test_nested_union_multiple_variants() -> None: + class Submodel1(BaseModel): + bar: bool + + class Submodel2(BaseModel): + thing: str + + class Submodel3(BaseModel): + foo: int + + class Model(BaseModel): + foo: Union[Submodel1, Submodel2, None, Submodel3] + + m = Model.construct(foo={"thing": "hello"}) + assert isinstance(m.foo, Submodel2) + assert m.foo.thing == "hello" + + m = Model.construct(foo=None) + assert m.foo is None + + m = Model.construct() + assert m.foo is None + + m = Model.construct(foo={"foo": "1"}) + assert isinstance(m.foo, Submodel3) + assert m.foo.foo == 1 + + +def test_nested_union_invalid_data() -> None: + class Submodel1(BaseModel): + level: int + + class Submodel2(BaseModel): + name: str + + class Model(BaseModel): + foo: Union[Submodel1, Submodel2] + + m = Model.construct(foo=True) + assert cast(bool, m.foo) is True + + m = Model.construct(foo={"name": 3}) + if PYDANTIC_V2: + assert isinstance(m.foo, Submodel1) + assert m.foo.name == 3 # type: ignore + else: + assert isinstance(m.foo, Submodel2) + assert m.foo.name == "3" + + +def test_list_of_unions() -> None: + class Submodel1(BaseModel): + level: int + + class Submodel2(BaseModel): + name: str + + class Model(BaseModel): + items: List[Union[Submodel1, Submodel2]] + + m = Model.construct(items=[{"level": 1}, {"name": "Robert"}]) + assert len(m.items) == 2 + assert isinstance(m.items[0], Submodel1) + assert m.items[0].level == 1 + assert isinstance(m.items[1], Submodel2) + assert m.items[1].name == "Robert" + + m = Model.construct(items=[{"level": -1}, 156]) + assert len(m.items) == 2 + assert isinstance(m.items[0], Submodel1) + assert m.items[0].level == -1 + assert cast(Any, m.items[1]) == 156 + + +def test_union_of_lists() -> None: + class SubModel1(BaseModel): + level: int + + class SubModel2(BaseModel): + name: str + + class Model(BaseModel): + items: Union[List[SubModel1], List[SubModel2]] + + # with one valid entry + m = Model.construct(items=[{"name": "Robert"}]) + assert len(m.items) == 1 + assert isinstance(m.items[0], SubModel2) + assert m.items[0].name == "Robert" + + # with two entries pointing to different types + m = Model.construct(items=[{"level": 1}, {"name": "Robert"}]) + assert len(m.items) == 2 + assert isinstance(m.items[0], SubModel1) + assert m.items[0].level == 1 + assert isinstance(m.items[1], SubModel1) + assert cast(Any, m.items[1]).name == "Robert" + + # with two entries pointing to *completely* different types + m = Model.construct(items=[{"level": -1}, 156]) + assert len(m.items) == 2 + assert isinstance(m.items[0], SubModel1) + assert m.items[0].level == -1 + assert cast(Any, m.items[1]) == 156 + + +def test_dict_of_union() -> None: + class SubModel1(BaseModel): + name: str + + class SubModel2(BaseModel): + foo: str + + class Model(BaseModel): + data: Dict[str, Union[SubModel1, SubModel2]] + + m = Model.construct(data={"hello": {"name": "there"}, "foo": {"foo": "bar"}}) + assert len(list(m.data.keys())) == 2 + assert isinstance(m.data["hello"], SubModel1) + assert m.data["hello"].name == "there" + assert isinstance(m.data["foo"], SubModel2) + assert m.data["foo"].foo == "bar" + + # TODO: test mismatched type + + +def test_double_nested_union() -> None: + class SubModel1(BaseModel): + name: str + + class SubModel2(BaseModel): + bar: str + + class Model(BaseModel): + data: Dict[str, List[Union[SubModel1, SubModel2]]] + + m = Model.construct(data={"foo": [{"bar": "baz"}, {"name": "Robert"}]}) + assert len(m.data["foo"]) == 2 + + entry1 = m.data["foo"][0] + assert isinstance(entry1, SubModel2) + assert entry1.bar == "baz" + + entry2 = m.data["foo"][1] + assert isinstance(entry2, SubModel1) + assert entry2.name == "Robert" + + # TODO: test mismatched type + + +def test_union_of_dict() -> None: + class SubModel1(BaseModel): + name: str + + class SubModel2(BaseModel): + foo: str + + class Model(BaseModel): + data: Union[Dict[str, SubModel1], Dict[str, SubModel2]] + + m = Model.construct(data={"hello": {"name": "there"}, "foo": {"foo": "bar"}}) + assert len(list(m.data.keys())) == 2 + assert isinstance(m.data["hello"], SubModel1) + assert m.data["hello"].name == "there" + assert isinstance(m.data["foo"], SubModel1) + assert cast(Any, m.data["foo"]).foo == "bar" + + +def test_iso8601_datetime() -> None: + class Model(BaseModel): + created_at: datetime + + expected = datetime(2019, 12, 27, 18, 11, 19, 117000, tzinfo=timezone.utc) + + if PYDANTIC_V2: + expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' + else: + expected_json = '{"created_at": "2019-12-27T18:11:19.117000+00:00"}' + + model = Model.construct(created_at="2019-12-27T18:11:19.117Z") + assert model.created_at == expected + assert model_json(model) == expected_json + + model = parse_obj(Model, dict(created_at="2019-12-27T18:11:19.117Z")) + assert model.created_at == expected + assert model_json(model) == expected_json + + +def test_does_not_coerce_int() -> None: + class Model(BaseModel): + bar: int + + assert Model.construct(bar=1).bar == 1 + assert Model.construct(bar=10.9).bar == 10.9 + assert Model.construct(bar="19").bar == "19" # type: ignore[comparison-overlap] + assert Model.construct(bar=False).bar is False + + +def test_int_to_float_safe_conversion() -> None: + class Model(BaseModel): + float_field: float + + m = Model.construct(float_field=10) + assert m.float_field == 10.0 + assert isinstance(m.float_field, float) + + m = Model.construct(float_field=10.12) + assert m.float_field == 10.12 + assert isinstance(m.float_field, float) + + # number too big + m = Model.construct(float_field=2**53 + 1) + assert m.float_field == 2**53 + 1 + assert isinstance(m.float_field, int) + + +def test_deprecated_alias() -> None: + class Model(BaseModel): + resource_id: str = Field(alias="model_id") + + @property + def model_id(self) -> str: + return self.resource_id + + m = Model.construct(model_id="id") + assert m.model_id == "id" + assert m.resource_id == "id" + assert m.resource_id is m.model_id + + m = parse_obj(Model, {"model_id": "id"}) + assert m.model_id == "id" + assert m.resource_id == "id" + assert m.resource_id is m.model_id + + +def test_omitted_fields() -> None: + class Model(BaseModel): + resource_id: Optional[str] = None + + m = Model.construct() + assert "resource_id" not in m.model_fields_set + + m = Model.construct(resource_id=None) + assert "resource_id" in m.model_fields_set + + m = Model.construct(resource_id="foo") + assert "resource_id" in m.model_fields_set + + +def test_to_dict() -> None: + class Model(BaseModel): + foo: Optional[str] = Field(alias="FOO", default=None) + + m = Model(FOO="hello") + assert m.to_dict() == {"FOO": "hello"} + assert m.to_dict(use_api_names=False) == {"foo": "hello"} + + m2 = Model() + assert m2.to_dict() == {} + assert m2.to_dict(exclude_unset=False) == {"FOO": None} + assert m2.to_dict(exclude_unset=False, exclude_none=True) == {} + assert m2.to_dict(exclude_unset=False, exclude_defaults=True) == {} + + m3 = Model(FOO=None) + assert m3.to_dict() == {"FOO": None} + assert m3.to_dict(exclude_none=True) == {} + assert m3.to_dict(exclude_defaults=True) == {} + + class Model2(BaseModel): + created_at: datetime + + time_str = "2024-03-21T11:39:01.275859" + m4 = Model2.construct(created_at=time_str) + assert m4.to_dict(mode="python") == {"created_at": datetime.fromisoformat(time_str)} + assert m4.to_dict(mode="json") == {"created_at": time_str} + + if not PYDANTIC_V2: + with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): + m.to_dict(warnings=False) + + +def test_forwards_compat_model_dump_method() -> None: + class Model(BaseModel): + foo: Optional[str] = Field(alias="FOO", default=None) + + m = Model(FOO="hello") + assert m.model_dump() == {"foo": "hello"} + assert m.model_dump(include={"bar"}) == {} + assert m.model_dump(exclude={"foo"}) == {} + assert m.model_dump(by_alias=True) == {"FOO": "hello"} + + m2 = Model() + assert m2.model_dump() == {"foo": None} + assert m2.model_dump(exclude_unset=True) == {} + assert m2.model_dump(exclude_none=True) == {} + assert m2.model_dump(exclude_defaults=True) == {} + + m3 = Model(FOO=None) + assert m3.model_dump() == {"foo": None} + assert m3.model_dump(exclude_none=True) == {} + + if not PYDANTIC_V2: + with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): + m.model_dump(round_trip=True) + + with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): + m.model_dump(warnings=False) + + +def test_compat_method_no_error_for_warnings() -> None: + class Model(BaseModel): + foo: Optional[str] + + m = Model(foo="hello") + assert isinstance(model_dump(m, warnings=False), dict) + + +def test_to_json() -> None: + class Model(BaseModel): + foo: Optional[str] = Field(alias="FOO", default=None) + + m = Model(FOO="hello") + assert json.loads(m.to_json()) == {"FOO": "hello"} + assert json.loads(m.to_json(use_api_names=False)) == {"foo": "hello"} + + if PYDANTIC_V2: + assert m.to_json(indent=None) == '{"FOO":"hello"}' + else: + assert m.to_json(indent=None) == '{"FOO": "hello"}' + + m2 = Model() + assert json.loads(m2.to_json()) == {} + assert json.loads(m2.to_json(exclude_unset=False)) == {"FOO": None} + assert json.loads(m2.to_json(exclude_unset=False, exclude_none=True)) == {} + assert json.loads(m2.to_json(exclude_unset=False, exclude_defaults=True)) == {} + + m3 = Model(FOO=None) + assert json.loads(m3.to_json()) == {"FOO": None} + assert json.loads(m3.to_json(exclude_none=True)) == {} + + if not PYDANTIC_V2: + with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): + m.to_json(warnings=False) + + +def test_forwards_compat_model_dump_json_method() -> None: + class Model(BaseModel): + foo: Optional[str] = Field(alias="FOO", default=None) + + m = Model(FOO="hello") + assert json.loads(m.model_dump_json()) == {"foo": "hello"} + assert json.loads(m.model_dump_json(include={"bar"})) == {} + assert json.loads(m.model_dump_json(include={"foo"})) == {"foo": "hello"} + assert json.loads(m.model_dump_json(by_alias=True)) == {"FOO": "hello"} + + assert m.model_dump_json(indent=2) == '{\n "foo": "hello"\n}' + + m2 = Model() + assert json.loads(m2.model_dump_json()) == {"foo": None} + assert json.loads(m2.model_dump_json(exclude_unset=True)) == {} + assert json.loads(m2.model_dump_json(exclude_none=True)) == {} + assert json.loads(m2.model_dump_json(exclude_defaults=True)) == {} + + m3 = Model(FOO=None) + assert json.loads(m3.model_dump_json()) == {"foo": None} + assert json.loads(m3.model_dump_json(exclude_none=True)) == {} + + if not PYDANTIC_V2: + with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): + m.model_dump_json(round_trip=True) + + with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): + m.model_dump_json(warnings=False) + + +def test_type_compat() -> None: + # our model type can be assigned to Pydantic's model type + + def takes_pydantic(model: pydantic.BaseModel) -> None: # noqa: ARG001 + ... + + class OurModel(BaseModel): + foo: Optional[str] = None + + takes_pydantic(OurModel()) + + +def test_annotated_types() -> None: + class Model(BaseModel): + value: str + + m = construct_type( + value={"value": "foo"}, + type_=cast(Any, Annotated[Model, "random metadata"]), + ) + assert isinstance(m, Model) + assert m.value == "foo" + + +def test_discriminated_unions_invalid_data() -> None: + class A(BaseModel): + type: Literal["a"] + + data: str + + class B(BaseModel): + type: Literal["b"] + + data: int + + m = construct_type( + value={"type": "b", "data": "foo"}, + type_=cast(Any, Annotated[Union[A, B], PropertyInfo(discriminator="type")]), + ) + assert isinstance(m, B) + assert m.type == "b" + assert m.data == "foo" # type: ignore[comparison-overlap] + + m = construct_type( + value={"type": "a", "data": 100}, + type_=cast(Any, Annotated[Union[A, B], PropertyInfo(discriminator="type")]), + ) + assert isinstance(m, A) + assert m.type == "a" + if PYDANTIC_V2: + assert m.data == 100 # type: ignore[comparison-overlap] + else: + # pydantic v1 automatically converts inputs to strings + # if the expected type is a str + assert m.data == "100" + + +def test_discriminated_unions_unknown_variant() -> None: + class A(BaseModel): + type: Literal["a"] + + data: str + + class B(BaseModel): + type: Literal["b"] + + data: int + + m = construct_type( + value={"type": "c", "data": None, "new_thing": "bar"}, + type_=cast(Any, Annotated[Union[A, B], PropertyInfo(discriminator="type")]), + ) + + # just chooses the first variant + assert isinstance(m, A) + assert m.type == "c" # type: ignore[comparison-overlap] + assert m.data == None # type: ignore[unreachable] + assert m.new_thing == "bar" + + +def test_discriminated_unions_invalid_data_nested_unions() -> None: + class A(BaseModel): + type: Literal["a"] + + data: str + + class B(BaseModel): + type: Literal["b"] + + data: int + + class C(BaseModel): + type: Literal["c"] + + data: bool + + m = construct_type( + value={"type": "b", "data": "foo"}, + type_=cast(Any, Annotated[Union[Union[A, B], C], PropertyInfo(discriminator="type")]), + ) + assert isinstance(m, B) + assert m.type == "b" + assert m.data == "foo" # type: ignore[comparison-overlap] + + m = construct_type( + value={"type": "c", "data": "foo"}, + type_=cast(Any, Annotated[Union[Union[A, B], C], PropertyInfo(discriminator="type")]), + ) + assert isinstance(m, C) + assert m.type == "c" + assert m.data == "foo" # type: ignore[comparison-overlap] + + +def test_discriminated_unions_with_aliases_invalid_data() -> None: + class A(BaseModel): + foo_type: Literal["a"] = Field(alias="type") + + data: str + + class B(BaseModel): + foo_type: Literal["b"] = Field(alias="type") + + data: int + + m = construct_type( + value={"type": "b", "data": "foo"}, + type_=cast(Any, Annotated[Union[A, B], PropertyInfo(discriminator="foo_type")]), + ) + assert isinstance(m, B) + assert m.foo_type == "b" + assert m.data == "foo" # type: ignore[comparison-overlap] + + m = construct_type( + value={"type": "a", "data": 100}, + type_=cast(Any, Annotated[Union[A, B], PropertyInfo(discriminator="foo_type")]), + ) + assert isinstance(m, A) + assert m.foo_type == "a" + if PYDANTIC_V2: + assert m.data == 100 # type: ignore[comparison-overlap] + else: + # pydantic v1 automatically converts inputs to strings + # if the expected type is a str + assert m.data == "100" + + +def test_discriminated_unions_overlapping_discriminators_invalid_data() -> None: + class A(BaseModel): + type: Literal["a"] + + data: bool + + class B(BaseModel): + type: Literal["a"] + + data: int + + m = construct_type( + value={"type": "a", "data": "foo"}, + type_=cast(Any, Annotated[Union[A, B], PropertyInfo(discriminator="type")]), + ) + assert isinstance(m, B) + assert m.type == "a" + assert m.data == "foo" # type: ignore[comparison-overlap] + + +def test_discriminated_unions_invalid_data_uses_cache() -> None: + class A(BaseModel): + type: Literal["a"] + + data: str + + class B(BaseModel): + type: Literal["b"] + + data: int + + UnionType = cast(Any, Union[A, B]) + + assert not hasattr(UnionType, "__discriminator__") + + m = construct_type( + value={"type": "b", "data": "foo"}, type_=cast(Any, Annotated[UnionType, PropertyInfo(discriminator="type")]) + ) + assert isinstance(m, B) + assert m.type == "b" + assert m.data == "foo" # type: ignore[comparison-overlap] + + discriminator = UnionType.__discriminator__ + assert discriminator is not None + + m = construct_type( + value={"type": "b", "data": "foo"}, type_=cast(Any, Annotated[UnionType, PropertyInfo(discriminator="type")]) + ) + assert isinstance(m, B) + assert m.type == "b" + assert m.data == "foo" # type: ignore[comparison-overlap] + + # if the discriminator details object stays the same between invocations then + # we hit the cache + assert UnionType.__discriminator__ is discriminator + + +@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +def test_type_alias_type() -> None: + Alias = TypeAliasType("Alias", str) + + class Model(BaseModel): + alias: Alias + union: Union[int, Alias] + + m = construct_type(value={"alias": "foo", "union": "bar"}, type_=Model) + assert isinstance(m, Model) + assert isinstance(m.alias, str) + assert m.alias == "foo" + assert isinstance(m.union, str) + assert m.union == "bar" + + +@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +def test_field_named_cls() -> None: + class Model(BaseModel): + cls: str + + m = construct_type(value={"cls": "foo"}, type_=Model) + assert isinstance(m, Model) + assert isinstance(m.cls, str) + + +def test_discriminated_union_case() -> None: + class A(BaseModel): + type: Literal["a"] + + data: bool + + class B(BaseModel): + type: Literal["b"] + + data: List[Union[A, object]] + + class ModelA(BaseModel): + type: Literal["modelA"] + + data: int + + class ModelB(BaseModel): + type: Literal["modelB"] + + required: str + + data: Union[A, B] + + # when constructing ModelA | ModelB, value data doesn't match ModelB exactly - missing `required` + m = construct_type( + value={"type": "modelB", "data": {"type": "a", "data": True}}, + type_=cast(Any, Annotated[Union[ModelA, ModelB], PropertyInfo(discriminator="type")]), + ) + + assert isinstance(m, ModelB) diff --git a/tests/test_qs.py b/tests/test_qs.py new file mode 100644 index 00000000..bdf9aa76 --- /dev/null +++ b/tests/test_qs.py @@ -0,0 +1,78 @@ +from typing import Any, cast +from functools import partial +from urllib.parse import unquote + +import pytest + +from gcore._qs import Querystring, stringify + + +def test_empty() -> None: + assert stringify({}) == "" + assert stringify({"a": {}}) == "" + assert stringify({"a": {"b": {"c": {}}}}) == "" + + +def test_basic() -> None: + assert stringify({"a": 1}) == "a=1" + assert stringify({"a": "b"}) == "a=b" + assert stringify({"a": True}) == "a=true" + assert stringify({"a": False}) == "a=false" + assert stringify({"a": 1.23456}) == "a=1.23456" + assert stringify({"a": None}) == "" + + +@pytest.mark.parametrize("method", ["class", "function"]) +def test_nested_dotted(method: str) -> None: + if method == "class": + serialise = Querystring(nested_format="dots").stringify + else: + serialise = partial(stringify, nested_format="dots") + + assert unquote(serialise({"a": {"b": "c"}})) == "a.b=c" + assert unquote(serialise({"a": {"b": "c", "d": "e", "f": "g"}})) == "a.b=c&a.d=e&a.f=g" + assert unquote(serialise({"a": {"b": {"c": {"d": "e"}}}})) == "a.b.c.d=e" + assert unquote(serialise({"a": {"b": True}})) == "a.b=true" + + +def test_nested_brackets() -> None: + assert unquote(stringify({"a": {"b": "c"}})) == "a[b]=c" + assert unquote(stringify({"a": {"b": "c", "d": "e", "f": "g"}})) == "a[b]=c&a[d]=e&a[f]=g" + assert unquote(stringify({"a": {"b": {"c": {"d": "e"}}}})) == "a[b][c][d]=e" + assert unquote(stringify({"a": {"b": True}})) == "a[b]=true" + + +@pytest.mark.parametrize("method", ["class", "function"]) +def test_array_comma(method: str) -> None: + if method == "class": + serialise = Querystring(array_format="comma").stringify + else: + serialise = partial(stringify, array_format="comma") + + assert unquote(serialise({"in": ["foo", "bar"]})) == "in=foo,bar" + assert unquote(serialise({"a": {"b": [True, False]}})) == "a[b]=true,false" + assert unquote(serialise({"a": {"b": [True, False, None, True]}})) == "a[b]=true,false,true" + + +def test_array_repeat() -> None: + assert unquote(stringify({"in": ["foo", "bar"]})) == "in=foo&in=bar" + assert unquote(stringify({"a": {"b": [True, False]}})) == "a[b]=true&a[b]=false" + assert unquote(stringify({"a": {"b": [True, False, None, True]}})) == "a[b]=true&a[b]=false&a[b]=true" + assert unquote(stringify({"in": ["foo", {"b": {"c": ["d", "e"]}}]})) == "in=foo&in[b][c]=d&in[b][c]=e" + + +@pytest.mark.parametrize("method", ["class", "function"]) +def test_array_brackets(method: str) -> None: + if method == "class": + serialise = Querystring(array_format="brackets").stringify + else: + serialise = partial(stringify, array_format="brackets") + + assert unquote(serialise({"in": ["foo", "bar"]})) == "in[]=foo&in[]=bar" + assert unquote(serialise({"a": {"b": [True, False]}})) == "a[b][]=true&a[b][]=false" + assert unquote(serialise({"a": {"b": [True, False, None, True]}})) == "a[b][]=true&a[b][]=false&a[b][]=true" + + +def test_unknown_array_format() -> None: + with pytest.raises(NotImplementedError, match="Unknown array_format value: foo, choose from comma, repeat"): + stringify({"a": ["foo", "bar"]}, array_format=cast(Any, "foo")) diff --git a/tests/test_required_args.py b/tests/test_required_args.py new file mode 100644 index 00000000..3e6908fb --- /dev/null +++ b/tests/test_required_args.py @@ -0,0 +1,111 @@ +from __future__ import annotations + +import pytest + +from gcore._utils import required_args + + +def test_too_many_positional_params() -> None: + @required_args(["a"]) + def foo(a: str | None = None) -> str | None: + return a + + with pytest.raises(TypeError, match=r"foo\(\) takes 1 argument\(s\) but 2 were given"): + foo("a", "b") # type: ignore + + +def test_positional_param() -> None: + @required_args(["a"]) + def foo(a: str | None = None) -> str | None: + return a + + assert foo("a") == "a" + assert foo(None) is None + assert foo(a="b") == "b" + + with pytest.raises(TypeError, match="Missing required argument: 'a'"): + foo() + + +def test_keyword_only_param() -> None: + @required_args(["a"]) + def foo(*, a: str | None = None) -> str | None: + return a + + assert foo(a="a") == "a" + assert foo(a=None) is None + assert foo(a="b") == "b" + + with pytest.raises(TypeError, match="Missing required argument: 'a'"): + foo() + + +def test_multiple_params() -> None: + @required_args(["a", "b", "c"]) + def foo(a: str = "", *, b: str = "", c: str = "") -> str | None: + return f"{a} {b} {c}" + + assert foo(a="a", b="b", c="c") == "a b c" + + error_message = r"Missing required arguments.*" + + with pytest.raises(TypeError, match=error_message): + foo() + + with pytest.raises(TypeError, match=error_message): + foo(a="a") + + with pytest.raises(TypeError, match=error_message): + foo(b="b") + + with pytest.raises(TypeError, match=error_message): + foo(c="c") + + with pytest.raises(TypeError, match=r"Missing required argument: 'a'"): + foo(b="a", c="c") + + with pytest.raises(TypeError, match=r"Missing required argument: 'b'"): + foo("a", c="c") + + +def test_multiple_variants() -> None: + @required_args(["a"], ["b"]) + def foo(*, a: str | None = None, b: str | None = None) -> str | None: + return a if a is not None else b + + assert foo(a="foo") == "foo" + assert foo(b="bar") == "bar" + assert foo(a=None) is None + assert foo(b=None) is None + + # TODO: this error message could probably be improved + with pytest.raises( + TypeError, + match=r"Missing required arguments; Expected either \('a'\) or \('b'\) arguments to be given", + ): + foo() + + +def test_multiple_params_multiple_variants() -> None: + @required_args(["a", "b"], ["c"]) + def foo(*, a: str | None = None, b: str | None = None, c: str | None = None) -> str | None: + if a is not None: + return a + if b is not None: + return b + return c + + error_message = r"Missing required arguments; Expected either \('a' and 'b'\) or \('c'\) arguments to be given" + + with pytest.raises(TypeError, match=error_message): + foo(a="foo") + + with pytest.raises(TypeError, match=error_message): + foo(b="bar") + + with pytest.raises(TypeError, match=error_message): + foo() + + assert foo(a=None, b="bar") == "bar" + assert foo(c=None) is None + assert foo(c="foo") == "foo" diff --git a/tests/test_response.py b/tests/test_response.py new file mode 100644 index 00000000..adec42e5 --- /dev/null +++ b/tests/test_response.py @@ -0,0 +1,277 @@ +import json +from typing import Any, List, Union, cast +from typing_extensions import Annotated + +import httpx +import pytest +import pydantic + +from gcore import Gcore, BaseModel, AsyncGcore +from gcore._response import ( + APIResponse, + BaseAPIResponse, + AsyncAPIResponse, + BinaryAPIResponse, + AsyncBinaryAPIResponse, + extract_response_type, +) +from gcore._streaming import Stream +from gcore._base_client import FinalRequestOptions + + +class ConcreteBaseAPIResponse(APIResponse[bytes]): ... + + +class ConcreteAPIResponse(APIResponse[List[str]]): ... + + +class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): ... + + +def test_extract_response_type_direct_classes() -> None: + assert extract_response_type(BaseAPIResponse[str]) == str + assert extract_response_type(APIResponse[str]) == str + assert extract_response_type(AsyncAPIResponse[str]) == str + + +def test_extract_response_type_direct_class_missing_type_arg() -> None: + with pytest.raises( + RuntimeError, + match="Expected type to have a type argument at index 0 but it did not", + ): + extract_response_type(AsyncAPIResponse) + + +def test_extract_response_type_concrete_subclasses() -> None: + assert extract_response_type(ConcreteBaseAPIResponse) == bytes + assert extract_response_type(ConcreteAPIResponse) == List[str] + assert extract_response_type(ConcreteAsyncAPIResponse) == httpx.Response + + +def test_extract_response_type_binary_response() -> None: + assert extract_response_type(BinaryAPIResponse) == bytes + assert extract_response_type(AsyncBinaryAPIResponse) == bytes + + +class PydanticModel(pydantic.BaseModel): ... + + +def test_response_parse_mismatched_basemodel(client: Gcore) -> None: + response = APIResponse( + raw=httpx.Response(200, content=b"foo"), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + with pytest.raises( + TypeError, + match="Pydantic models must subclass our base model type, e.g. `from gcore import BaseModel`", + ): + response.parse(to=PydanticModel) + + +@pytest.mark.asyncio +async def test_async_response_parse_mismatched_basemodel(async_client: AsyncGcore) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=b"foo"), + client=async_client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + with pytest.raises( + TypeError, + match="Pydantic models must subclass our base model type, e.g. `from gcore import BaseModel`", + ): + await response.parse(to=PydanticModel) + + +def test_response_parse_custom_stream(client: Gcore) -> None: + response = APIResponse( + raw=httpx.Response(200, content=b"foo"), + client=client, + stream=True, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + stream = response.parse(to=Stream[int]) + assert stream._cast_to == int + + +@pytest.mark.asyncio +async def test_async_response_parse_custom_stream(async_client: AsyncGcore) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=b"foo"), + client=async_client, + stream=True, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + stream = await response.parse(to=Stream[int]) + assert stream._cast_to == int + + +class CustomModel(BaseModel): + foo: str + bar: int + + +def test_response_parse_custom_model(client: Gcore) -> None: + response = APIResponse( + raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = response.parse(to=CustomModel) + assert obj.foo == "hello!" + assert obj.bar == 2 + + +@pytest.mark.asyncio +async def test_async_response_parse_custom_model(async_client: AsyncGcore) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), + client=async_client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = await response.parse(to=CustomModel) + assert obj.foo == "hello!" + assert obj.bar == 2 + + +def test_response_parse_annotated_type(client: Gcore) -> None: + response = APIResponse( + raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = response.parse( + to=cast("type[CustomModel]", Annotated[CustomModel, "random metadata"]), + ) + assert obj.foo == "hello!" + assert obj.bar == 2 + + +async def test_async_response_parse_annotated_type(async_client: AsyncGcore) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), + client=async_client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = await response.parse( + to=cast("type[CustomModel]", Annotated[CustomModel, "random metadata"]), + ) + assert obj.foo == "hello!" + assert obj.bar == 2 + + +@pytest.mark.parametrize( + "content, expected", + [ + ("false", False), + ("true", True), + ("False", False), + ("True", True), + ("TrUe", True), + ("FalSe", False), + ], +) +def test_response_parse_bool(client: Gcore, content: str, expected: bool) -> None: + response = APIResponse( + raw=httpx.Response(200, content=content), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + result = response.parse(to=bool) + assert result is expected + + +@pytest.mark.parametrize( + "content, expected", + [ + ("false", False), + ("true", True), + ("False", False), + ("True", True), + ("TrUe", True), + ("FalSe", False), + ], +) +async def test_async_response_parse_bool(client: AsyncGcore, content: str, expected: bool) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=content), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + result = await response.parse(to=bool) + assert result is expected + + +class OtherModel(BaseModel): + a: str + + +@pytest.mark.parametrize("client", [False], indirect=True) # loose validation +def test_response_parse_expect_model_union_non_json_content(client: Gcore) -> None: + response = APIResponse( + raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = response.parse(to=cast(Any, Union[CustomModel, OtherModel])) + assert isinstance(obj, str) + assert obj == "foo" + + +@pytest.mark.asyncio +@pytest.mark.parametrize("async_client", [False], indirect=True) # loose validation +async def test_async_response_parse_expect_model_union_non_json_content(async_client: AsyncGcore) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), + client=async_client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = await response.parse(to=cast(Any, Union[CustomModel, OtherModel])) + assert isinstance(obj, str) + assert obj == "foo" diff --git a/tests/test_streaming.py b/tests/test_streaming.py new file mode 100644 index 00000000..54412add --- /dev/null +++ b/tests/test_streaming.py @@ -0,0 +1,248 @@ +from __future__ import annotations + +from typing import Iterator, AsyncIterator + +import httpx +import pytest + +from gcore import Gcore, AsyncGcore +from gcore._streaming import Stream, AsyncStream, ServerSentEvent + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_basic(sync: bool, client: Gcore, async_client: AsyncGcore) -> None: + def body() -> Iterator[bytes]: + yield b"event: completion\n" + yield b'data: {"foo":true}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "completion" + assert sse.json() == {"foo": True} + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_data_missing_event(sync: bool, client: Gcore, async_client: AsyncGcore) -> None: + def body() -> Iterator[bytes]: + yield b'data: {"foo":true}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"foo": True} + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_event_missing_data(sync: bool, client: Gcore, async_client: AsyncGcore) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.data == "" + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_events(sync: bool, client: Gcore, async_client: AsyncGcore) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"\n" + yield b"event: completion\n" + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.data == "" + + sse = await iter_next(iterator) + assert sse.event == "completion" + assert sse.data == "" + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_events_with_data(sync: bool, client: Gcore, async_client: AsyncGcore) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b'data: {"foo":true}\n' + yield b"\n" + yield b"event: completion\n" + yield b'data: {"bar":false}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": True} + + sse = await iter_next(iterator) + assert sse.event == "completion" + assert sse.json() == {"bar": False} + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_data_lines_with_empty_line(sync: bool, client: Gcore, async_client: AsyncGcore) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"data: {\n" + yield b'data: "foo":\n' + yield b"data: \n" + yield b"data:\n" + yield b"data: true}\n" + yield b"\n\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": True} + assert sse.data == '{\n"foo":\n\n\ntrue}' + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_data_json_escaped_double_new_line(sync: bool, client: Gcore, async_client: AsyncGcore) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b'data: {"foo": "my long\\n\\ncontent"}' + yield b"\n\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": "my long\n\ncontent"} + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_data_lines(sync: bool, client: Gcore, async_client: AsyncGcore) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"data: {\n" + yield b'data: "foo":\n' + yield b"data: true}\n" + yield b"\n\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": True} + + await assert_empty_iter(iterator) + + +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_special_new_line_character( + sync: bool, + client: Gcore, + async_client: AsyncGcore, +) -> None: + def body() -> Iterator[bytes]: + yield b'data: {"content":" culpa"}\n' + yield b"\n" + yield b'data: {"content":" \xe2\x80\xa8"}\n' + yield b"\n" + yield b'data: {"content":"foo"}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": " culpa"} + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": " 
"} + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": "foo"} + + await assert_empty_iter(iterator) + + +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multi_byte_character_multiple_chunks( + sync: bool, + client: Gcore, + async_client: AsyncGcore, +) -> None: + def body() -> Iterator[bytes]: + yield b'data: {"content":"' + # bytes taken from the string 'известни' and arbitrarily split + # so that some multi-byte characters span multiple chunks + yield b"\xd0" + yield b"\xb8\xd0\xb7\xd0" + yield b"\xb2\xd0\xb5\xd1\x81\xd1\x82\xd0\xbd\xd0\xb8" + yield b'"}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": "известни"} + + +async def to_aiter(iter: Iterator[bytes]) -> AsyncIterator[bytes]: + for chunk in iter: + yield chunk + + +async def iter_next(iter: Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]) -> ServerSentEvent: + if isinstance(iter, AsyncIterator): + return await iter.__anext__() + + return next(iter) + + +async def assert_empty_iter(iter: Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]) -> None: + with pytest.raises((StopAsyncIteration, RuntimeError)): + await iter_next(iter) + + +def make_event_iterator( + content: Iterator[bytes], + *, + sync: bool, + client: Gcore, + async_client: AsyncGcore, +) -> Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]: + if sync: + return Stream(cast_to=object, client=client, response=httpx.Response(200, content=content))._iter_events() + + return AsyncStream( + cast_to=object, client=async_client, response=httpx.Response(200, content=to_aiter(content)) + )._iter_events() diff --git a/tests/test_transform.py b/tests/test_transform.py new file mode 100644 index 00000000..b166c556 --- /dev/null +++ b/tests/test_transform.py @@ -0,0 +1,434 @@ +from __future__ import annotations + +import io +import pathlib +from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast +from datetime import date, datetime +from typing_extensions import Required, Annotated, TypedDict + +import pytest + +from gcore._types import Base64FileInput +from gcore._utils import ( + PropertyInfo, + transform as _transform, + parse_datetime, + async_transform as _async_transform, +) +from gcore._compat import PYDANTIC_V2 +from gcore._models import BaseModel + +_T = TypeVar("_T") + +SAMPLE_FILE_PATH = pathlib.Path(__file__).parent.joinpath("sample_file.txt") + + +async def transform( + data: _T, + expected_type: object, + use_async: bool, +) -> _T: + if use_async: + return await _async_transform(data, expected_type=expected_type) + + return _transform(data, expected_type=expected_type) + + +parametrize = pytest.mark.parametrize("use_async", [False, True], ids=["sync", "async"]) + + +class Foo1(TypedDict): + foo_bar: Annotated[str, PropertyInfo(alias="fooBar")] + + +@parametrize +@pytest.mark.asyncio +async def test_top_level_alias(use_async: bool) -> None: + assert await transform({"foo_bar": "hello"}, expected_type=Foo1, use_async=use_async) == {"fooBar": "hello"} + + +class Foo2(TypedDict): + bar: Bar2 + + +class Bar2(TypedDict): + this_thing: Annotated[int, PropertyInfo(alias="this__thing")] + baz: Annotated[Baz2, PropertyInfo(alias="Baz")] + + +class Baz2(TypedDict): + my_baz: Annotated[str, PropertyInfo(alias="myBaz")] + + +@parametrize +@pytest.mark.asyncio +async def test_recursive_typeddict(use_async: bool) -> None: + assert await transform({"bar": {"this_thing": 1}}, Foo2, use_async) == {"bar": {"this__thing": 1}} + assert await transform({"bar": {"baz": {"my_baz": "foo"}}}, Foo2, use_async) == {"bar": {"Baz": {"myBaz": "foo"}}} + + +class Foo3(TypedDict): + things: List[Bar3] + + +class Bar3(TypedDict): + my_field: Annotated[str, PropertyInfo(alias="myField")] + + +@parametrize +@pytest.mark.asyncio +async def test_list_of_typeddict(use_async: bool) -> None: + result = await transform({"things": [{"my_field": "foo"}, {"my_field": "foo2"}]}, Foo3, use_async) + assert result == {"things": [{"myField": "foo"}, {"myField": "foo2"}]} + + +class Foo4(TypedDict): + foo: Union[Bar4, Baz4] + + +class Bar4(TypedDict): + foo_bar: Annotated[str, PropertyInfo(alias="fooBar")] + + +class Baz4(TypedDict): + foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + + +@parametrize +@pytest.mark.asyncio +async def test_union_of_typeddict(use_async: bool) -> None: + assert await transform({"foo": {"foo_bar": "bar"}}, Foo4, use_async) == {"foo": {"fooBar": "bar"}} + assert await transform({"foo": {"foo_baz": "baz"}}, Foo4, use_async) == {"foo": {"fooBaz": "baz"}} + assert await transform({"foo": {"foo_baz": "baz", "foo_bar": "bar"}}, Foo4, use_async) == { + "foo": {"fooBaz": "baz", "fooBar": "bar"} + } + + +class Foo5(TypedDict): + foo: Annotated[Union[Bar4, List[Baz4]], PropertyInfo(alias="FOO")] + + +class Bar5(TypedDict): + foo_bar: Annotated[str, PropertyInfo(alias="fooBar")] + + +class Baz5(TypedDict): + foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + + +@parametrize +@pytest.mark.asyncio +async def test_union_of_list(use_async: bool) -> None: + assert await transform({"foo": {"foo_bar": "bar"}}, Foo5, use_async) == {"FOO": {"fooBar": "bar"}} + assert await transform( + { + "foo": [ + {"foo_baz": "baz"}, + {"foo_baz": "baz"}, + ] + }, + Foo5, + use_async, + ) == {"FOO": [{"fooBaz": "baz"}, {"fooBaz": "baz"}]} + + +class Foo6(TypedDict): + bar: Annotated[str, PropertyInfo(alias="Bar")] + + +@parametrize +@pytest.mark.asyncio +async def test_includes_unknown_keys(use_async: bool) -> None: + assert await transform({"bar": "bar", "baz_": {"FOO": 1}}, Foo6, use_async) == { + "Bar": "bar", + "baz_": {"FOO": 1}, + } + + +class Foo7(TypedDict): + bar: Annotated[List[Bar7], PropertyInfo(alias="bAr")] + foo: Bar7 + + +class Bar7(TypedDict): + foo: str + + +@parametrize +@pytest.mark.asyncio +async def test_ignores_invalid_input(use_async: bool) -> None: + assert await transform({"bar": ""}, Foo7, use_async) == {"bAr": ""} + assert await transform({"foo": ""}, Foo7, use_async) == {"foo": ""} + + +class DatetimeDict(TypedDict, total=False): + foo: Annotated[datetime, PropertyInfo(format="iso8601")] + + bar: Annotated[Optional[datetime], PropertyInfo(format="iso8601")] + + required: Required[Annotated[Optional[datetime], PropertyInfo(format="iso8601")]] + + list_: Required[Annotated[Optional[List[datetime]], PropertyInfo(format="iso8601")]] + + union: Annotated[Union[int, datetime], PropertyInfo(format="iso8601")] + + +class DateDict(TypedDict, total=False): + foo: Annotated[date, PropertyInfo(format="iso8601")] + + +class DatetimeModel(BaseModel): + foo: datetime + + +class DateModel(BaseModel): + foo: Optional[date] + + +@parametrize +@pytest.mark.asyncio +async def test_iso8601_format(use_async: bool) -> None: + dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + tz = "Z" if PYDANTIC_V2 else "+00:00" + assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] + + dt = dt.replace(tzinfo=None) + assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] + + assert await transform({"foo": None}, DateDict, use_async) == {"foo": None} # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=None), Any, use_async) == {"foo": None} # type: ignore + assert await transform({"foo": date.fromisoformat("2023-02-23")}, DateDict, use_async) == {"foo": "2023-02-23"} # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=date.fromisoformat("2023-02-23")), DateDict, use_async) == { + "foo": "2023-02-23" + } # type: ignore[comparison-overlap] + + +@parametrize +@pytest.mark.asyncio +async def test_optional_iso8601_format(use_async: bool) -> None: + dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + assert await transform({"bar": dt}, DatetimeDict, use_async) == {"bar": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] + + assert await transform({"bar": None}, DatetimeDict, use_async) == {"bar": None} + + +@parametrize +@pytest.mark.asyncio +async def test_required_iso8601_format(use_async: bool) -> None: + dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + assert await transform({"required": dt}, DatetimeDict, use_async) == { + "required": "2023-02-23T14:16:36.337692+00:00" + } # type: ignore[comparison-overlap] + + assert await transform({"required": None}, DatetimeDict, use_async) == {"required": None} + + +@parametrize +@pytest.mark.asyncio +async def test_union_datetime(use_async: bool) -> None: + dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + assert await transform({"union": dt}, DatetimeDict, use_async) == { # type: ignore[comparison-overlap] + "union": "2023-02-23T14:16:36.337692+00:00" + } + + assert await transform({"union": "foo"}, DatetimeDict, use_async) == {"union": "foo"} + + +@parametrize +@pytest.mark.asyncio +async def test_nested_list_iso6801_format(use_async: bool) -> None: + dt1 = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + dt2 = parse_datetime("2022-01-15T06:34:23Z") + assert await transform({"list_": [dt1, dt2]}, DatetimeDict, use_async) == { # type: ignore[comparison-overlap] + "list_": ["2023-02-23T14:16:36.337692+00:00", "2022-01-15T06:34:23+00:00"] + } + + +@parametrize +@pytest.mark.asyncio +async def test_datetime_custom_format(use_async: bool) -> None: + dt = parse_datetime("2022-01-15T06:34:23Z") + + result = await transform(dt, Annotated[datetime, PropertyInfo(format="custom", format_template="%H")], use_async) + assert result == "06" # type: ignore[comparison-overlap] + + +class DateDictWithRequiredAlias(TypedDict, total=False): + required_prop: Required[Annotated[date, PropertyInfo(format="iso8601", alias="prop")]] + + +@parametrize +@pytest.mark.asyncio +async def test_datetime_with_alias(use_async: bool) -> None: + assert await transform({"required_prop": None}, DateDictWithRequiredAlias, use_async) == {"prop": None} # type: ignore[comparison-overlap] + assert await transform( + {"required_prop": date.fromisoformat("2023-02-23")}, DateDictWithRequiredAlias, use_async + ) == {"prop": "2023-02-23"} # type: ignore[comparison-overlap] + + +class MyModel(BaseModel): + foo: str + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_model_to_dictionary(use_async: bool) -> None: + assert cast(Any, await transform(MyModel(foo="hi!"), Any, use_async)) == {"foo": "hi!"} + assert cast(Any, await transform(MyModel.construct(foo="hi!"), Any, use_async)) == {"foo": "hi!"} + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_empty_model(use_async: bool) -> None: + assert cast(Any, await transform(MyModel.construct(), Any, use_async)) == {} + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_unknown_field(use_async: bool) -> None: + assert cast(Any, await transform(MyModel.construct(my_untyped_field=True), Any, use_async)) == { + "my_untyped_field": True + } + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_mismatched_types(use_async: bool) -> None: + model = MyModel.construct(foo=True) + if PYDANTIC_V2: + with pytest.warns(UserWarning): + params = await transform(model, Any, use_async) + else: + params = await transform(model, Any, use_async) + assert cast(Any, params) == {"foo": True} + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_mismatched_object_type(use_async: bool) -> None: + model = MyModel.construct(foo=MyModel.construct(hello="world")) + if PYDANTIC_V2: + with pytest.warns(UserWarning): + params = await transform(model, Any, use_async) + else: + params = await transform(model, Any, use_async) + assert cast(Any, params) == {"foo": {"hello": "world"}} + + +class ModelNestedObjects(BaseModel): + nested: MyModel + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_nested_objects(use_async: bool) -> None: + model = ModelNestedObjects.construct(nested={"foo": "stainless"}) + assert isinstance(model.nested, MyModel) + assert cast(Any, await transform(model, Any, use_async)) == {"nested": {"foo": "stainless"}} + + +class ModelWithDefaultField(BaseModel): + foo: str + with_none_default: Union[str, None] = None + with_str_default: str = "foo" + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_default_field(use_async: bool) -> None: + # should be excluded when defaults are used + model = ModelWithDefaultField.construct() + assert model.with_none_default is None + assert model.with_str_default == "foo" + assert cast(Any, await transform(model, Any, use_async)) == {} + + # should be included when the default value is explicitly given + model = ModelWithDefaultField.construct(with_none_default=None, with_str_default="foo") + assert model.with_none_default is None + assert model.with_str_default == "foo" + assert cast(Any, await transform(model, Any, use_async)) == {"with_none_default": None, "with_str_default": "foo"} + + # should be included when a non-default value is explicitly given + model = ModelWithDefaultField.construct(with_none_default="bar", with_str_default="baz") + assert model.with_none_default == "bar" + assert model.with_str_default == "baz" + assert cast(Any, await transform(model, Any, use_async)) == {"with_none_default": "bar", "with_str_default": "baz"} + + +class TypedDictIterableUnion(TypedDict): + foo: Annotated[Union[Bar8, Iterable[Baz8]], PropertyInfo(alias="FOO")] + + +class Bar8(TypedDict): + foo_bar: Annotated[str, PropertyInfo(alias="fooBar")] + + +class Baz8(TypedDict): + foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + + +@parametrize +@pytest.mark.asyncio +async def test_iterable_of_dictionaries(use_async: bool) -> None: + assert await transform({"foo": [{"foo_baz": "bar"}]}, TypedDictIterableUnion, use_async) == { + "FOO": [{"fooBaz": "bar"}] + } + assert cast(Any, await transform({"foo": ({"foo_baz": "bar"},)}, TypedDictIterableUnion, use_async)) == { + "FOO": [{"fooBaz": "bar"}] + } + + def my_iter() -> Iterable[Baz8]: + yield {"foo_baz": "hello"} + yield {"foo_baz": "world"} + + assert await transform({"foo": my_iter()}, TypedDictIterableUnion, use_async) == { + "FOO": [{"fooBaz": "hello"}, {"fooBaz": "world"}] + } + + +@parametrize +@pytest.mark.asyncio +async def test_dictionary_items(use_async: bool) -> None: + class DictItems(TypedDict): + foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + + assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == {"foo": {"fooBaz": "bar"}} + + +class TypedDictIterableUnionStr(TypedDict): + foo: Annotated[Union[str, Iterable[Baz8]], PropertyInfo(alias="FOO")] + + +@parametrize +@pytest.mark.asyncio +async def test_iterable_union_str(use_async: bool) -> None: + assert await transform({"foo": "bar"}, TypedDictIterableUnionStr, use_async) == {"FOO": "bar"} + assert cast(Any, await transform(iter([{"foo_baz": "bar"}]), Union[str, Iterable[Baz8]], use_async)) == [ + {"fooBaz": "bar"} + ] + + +class TypedDictBase64Input(TypedDict): + foo: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + + +@parametrize +@pytest.mark.asyncio +async def test_base64_file_input(use_async: bool) -> None: + # strings are left as-is + assert await transform({"foo": "bar"}, TypedDictBase64Input, use_async) == {"foo": "bar"} + + # pathlib.Path is automatically converted to base64 + assert await transform({"foo": SAMPLE_FILE_PATH}, TypedDictBase64Input, use_async) == { + "foo": "SGVsbG8sIHdvcmxkIQo=" + } # type: ignore[comparison-overlap] + + # io instances are automatically converted to base64 + assert await transform({"foo": io.StringIO("Hello, world!")}, TypedDictBase64Input, use_async) == { + "foo": "SGVsbG8sIHdvcmxkIQ==" + } # type: ignore[comparison-overlap] + assert await transform({"foo": io.BytesIO(b"Hello, world!")}, TypedDictBase64Input, use_async) == { + "foo": "SGVsbG8sIHdvcmxkIQ==" + } # type: ignore[comparison-overlap] diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py new file mode 100644 index 00000000..1122b27d --- /dev/null +++ b/tests/test_utils/test_proxy.py @@ -0,0 +1,23 @@ +import operator +from typing import Any +from typing_extensions import override + +from gcore._utils import LazyProxy + + +class RecursiveLazyProxy(LazyProxy[Any]): + @override + def __load__(self) -> Any: + return self + + def __call__(self, *_args: Any, **_kwds: Any) -> Any: + raise RuntimeError("This should never be called!") + + +def test_recursive_proxy() -> None: + proxy = RecursiveLazyProxy() + assert repr(proxy) == "RecursiveLazyProxy" + assert str(proxy) == "RecursiveLazyProxy" + assert dir(proxy) == [] + assert type(proxy).__name__ == "RecursiveLazyProxy" + assert type(operator.attrgetter("name.foo.bar.baz")(proxy)).__name__ == "RecursiveLazyProxy" diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py new file mode 100644 index 00000000..b22bcc80 --- /dev/null +++ b/tests/test_utils/test_typing.py @@ -0,0 +1,73 @@ +from __future__ import annotations + +from typing import Generic, TypeVar, cast + +from gcore._utils import extract_type_var_from_base + +_T = TypeVar("_T") +_T2 = TypeVar("_T2") +_T3 = TypeVar("_T3") + + +class BaseGeneric(Generic[_T]): ... + + +class SubclassGeneric(BaseGeneric[_T]): ... + + +class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): ... + + +class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): ... + + +class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): ... + + +def test_extract_type_var() -> None: + assert ( + extract_type_var_from_base( + BaseGeneric[int], + index=0, + generic_bases=cast("tuple[type, ...]", (BaseGeneric,)), + ) + == int + ) + + +def test_extract_type_var_generic_subclass() -> None: + assert ( + extract_type_var_from_base( + SubclassGeneric[int], + index=0, + generic_bases=cast("tuple[type, ...]", (BaseGeneric,)), + ) + == int + ) + + +def test_extract_type_var_multiple() -> None: + typ = BaseGenericMultipleTypeArgs[int, str, None] + + generic_bases = cast("tuple[type, ...]", (BaseGenericMultipleTypeArgs,)) + assert extract_type_var_from_base(typ, index=0, generic_bases=generic_bases) == int + assert extract_type_var_from_base(typ, index=1, generic_bases=generic_bases) == str + assert extract_type_var_from_base(typ, index=2, generic_bases=generic_bases) == type(None) + + +def test_extract_type_var_generic_subclass_multiple() -> None: + typ = SubclassGenericMultipleTypeArgs[int, str, None] + + generic_bases = cast("tuple[type, ...]", (BaseGenericMultipleTypeArgs,)) + assert extract_type_var_from_base(typ, index=0, generic_bases=generic_bases) == int + assert extract_type_var_from_base(typ, index=1, generic_bases=generic_bases) == str + assert extract_type_var_from_base(typ, index=2, generic_bases=generic_bases) == type(None) + + +def test_extract_type_var_generic_subclass_different_ordering_multiple() -> None: + typ = SubclassDifferentOrderGenericMultipleTypeArgs[int, str, None] + + generic_bases = cast("tuple[type, ...]", (BaseGenericMultipleTypeArgs,)) + assert extract_type_var_from_base(typ, index=0, generic_bases=generic_bases) == int + assert extract_type_var_from_base(typ, index=1, generic_bases=generic_bases) == str + assert extract_type_var_from_base(typ, index=2, generic_bases=generic_bases) == type(None) diff --git a/tests/utils.py b/tests/utils.py new file mode 100644 index 00000000..6a13fa7d --- /dev/null +++ b/tests/utils.py @@ -0,0 +1,159 @@ +from __future__ import annotations + +import os +import inspect +import traceback +import contextlib +from typing import Any, TypeVar, Iterator, cast +from datetime import date, datetime +from typing_extensions import Literal, get_args, get_origin, assert_type + +from gcore._types import Omit, NoneType +from gcore._utils import ( + is_dict, + is_list, + is_list_type, + is_union_type, + extract_type_arg, + is_annotated_type, + is_type_alias_type, +) +from gcore._compat import PYDANTIC_V2, field_outer_type, get_model_fields +from gcore._models import BaseModel + +BaseModelT = TypeVar("BaseModelT", bound=BaseModel) + + +def assert_matches_model(model: type[BaseModelT], value: BaseModelT, *, path: list[str]) -> bool: + for name, field in get_model_fields(model).items(): + field_value = getattr(value, name) + if PYDANTIC_V2: + allow_none = False + else: + # in v1 nullability was structured differently + # https://docs.pydantic.dev/2.0/migration/#required-optional-and-nullable-fields + allow_none = getattr(field, "allow_none", False) + + assert_matches_type( + field_outer_type(field), + field_value, + path=[*path, name], + allow_none=allow_none, + ) + + return True + + +# Note: the `path` argument is only used to improve error messages when `--showlocals` is used +def assert_matches_type( + type_: Any, + value: object, + *, + path: list[str], + allow_none: bool = False, +) -> None: + if is_type_alias_type(type_): + type_ = type_.__value__ + + # unwrap `Annotated[T, ...]` -> `T` + if is_annotated_type(type_): + type_ = extract_type_arg(type_, 0) + + if allow_none and value is None: + return + + if type_ is None or type_ is NoneType: + assert value is None + return + + origin = get_origin(type_) or type_ + + if is_list_type(type_): + return _assert_list_type(type_, value) + + if origin == str: + assert isinstance(value, str) + elif origin == int: + assert isinstance(value, int) + elif origin == bool: + assert isinstance(value, bool) + elif origin == float: + assert isinstance(value, float) + elif origin == bytes: + assert isinstance(value, bytes) + elif origin == datetime: + assert isinstance(value, datetime) + elif origin == date: + assert isinstance(value, date) + elif origin == object: + # nothing to do here, the expected type is unknown + pass + elif origin == Literal: + assert value in get_args(type_) + elif origin == dict: + assert is_dict(value) + + args = get_args(type_) + key_type = args[0] + items_type = args[1] + + for key, item in value.items(): + assert_matches_type(key_type, key, path=[*path, ""]) + assert_matches_type(items_type, item, path=[*path, ""]) + elif is_union_type(type_): + variants = get_args(type_) + + try: + none_index = variants.index(type(None)) + except ValueError: + pass + else: + # special case Optional[T] for better error messages + if len(variants) == 2: + if value is None: + # valid + return + + return assert_matches_type(type_=variants[not none_index], value=value, path=path) + + for i, variant in enumerate(variants): + try: + assert_matches_type(variant, value, path=[*path, f"variant {i}"]) + return + except AssertionError: + traceback.print_exc() + continue + + raise AssertionError("Did not match any variants") + elif issubclass(origin, BaseModel): + assert isinstance(value, type_) + assert assert_matches_model(type_, cast(Any, value), path=path) + elif inspect.isclass(origin) and origin.__name__ == "HttpxBinaryResponseContent": + assert value.__class__.__name__ == "HttpxBinaryResponseContent" + else: + assert None, f"Unhandled field type: {type_}" + + +def _assert_list_type(type_: type[object], value: object) -> None: + assert is_list(value) + + inner_type = get_args(type_)[0] + for entry in value: + assert_type(inner_type, entry) # type: ignore + + +@contextlib.contextmanager +def update_env(**new_env: str | Omit) -> Iterator[None]: + old = os.environ.copy() + + try: + for name, value in new_env.items(): + if isinstance(value, Omit): + os.environ.pop(name, None) + else: + os.environ[name] = value + + yield None + finally: + os.environ.clear() + os.environ.update(old) From ec95c5fc922707278e9d0608bd040b1d4d1c7623 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 10:27:53 +0000 Subject: [PATCH 002/592] feat(api): manual updates --- .stats.yml | 2 +- README.md | 18 +- api.md | 14 +- src/gcore/resources/cloud/__init__.py | 14 ++ src/gcore/resources/cloud/cloud.py | 6 +- .../cloud/{projects/v1.py => projects.py} | 134 ++++++------ .../resources/cloud/projects/__init__.py | 33 --- .../resources/cloud/projects/projects.py | 102 --------- src/gcore/types/cloud/__init__.py | 7 + .../types/cloud/{projects => }/project.py | 2 +- ...ate_params.py => project_create_params.py} | 4 +- ...response.py => project_delete_response.py} | 6 +- ..._list_params.py => project_list_params.py} | 4 +- ...t_response.py => project_list_response.py} | 6 +- ...ate_params.py => project_update_params.py} | 4 +- src/gcore/types/cloud/projects/__init__.py | 10 - .../api_resources/cloud/projects/__init__.py | 1 - .../{projects/test_v1.py => test_projects.py} | 194 +++++++++--------- tests/test_client.py | 30 +-- 19 files changed, 232 insertions(+), 359 deletions(-) rename src/gcore/resources/cloud/{projects/v1.py => projects.py} (86%) delete mode 100644 src/gcore/resources/cloud/projects/__init__.py delete mode 100644 src/gcore/resources/cloud/projects/projects.py rename src/gcore/types/cloud/{projects => }/project.py (96%) rename src/gcore/types/cloud/{projects/v1_create_params.py => project_create_params.py} (85%) rename src/gcore/types/cloud/{projects/v1_delete_response.py => project_delete_response.py} (62%) rename src/gcore/types/cloud/{projects/v1_list_params.py => project_list_params.py} (88%) rename src/gcore/types/cloud/{projects/v1_list_response.py => project_list_response.py} (68%) rename src/gcore/types/cloud/{projects/v1_update_params.py => project_update_params.py} (81%) delete mode 100644 src/gcore/types/cloud/projects/__init__.py delete mode 100644 tests/api_resources/cloud/projects/__init__.py rename tests/api_resources/cloud/{projects/test_v1.py => test_projects.py} (60%) diff --git a/.stats.yml b/.stats.yml index 14063489..0beff5cb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 5 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c1c67b7326d84207f233f2bd8c7d0b3c1ed0f263f81344fbd870819755e153ec.yml openapi_spec_hash: 1c861e8bc6b94f1581dda1cbee26b993 -config_hash: 4b4b836542416f7495a04af8937cc7fa +config_hash: ec5944e3865f6debc0f6be17af8e5f41 diff --git a/README.md b/README.md index 185ee503..cdc443cb 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ client = Gcore( api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted ) -project = client.cloud.projects.v1.create( +project = client.cloud.projects.create( name="New Project", ) print(project.id) @@ -60,7 +60,7 @@ client = AsyncGcore( async def main() -> None: - project = await client.cloud.projects.v1.create( + project = await client.cloud.projects.create( name="New Project", ) print(project.id) @@ -96,7 +96,7 @@ from gcore import Gcore client = Gcore() try: - client.cloud.projects.v1.create( + client.cloud.projects.create( name="New Project", ) except gcore.APIConnectionError as e: @@ -141,7 +141,7 @@ client = Gcore( ) # Or, configure per-request: -client.with_options(max_retries=5).cloud.projects.v1.create( +client.with_options(max_retries=5).cloud.projects.create( name="New Project", ) ``` @@ -166,7 +166,7 @@ client = Gcore( ) # Override per-request: -client.with_options(timeout=5.0).cloud.projects.v1.create( +client.with_options(timeout=5.0).cloud.projects.create( name="New Project", ) ``` @@ -209,13 +209,13 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to from gcore import Gcore client = Gcore() -response = client.cloud.projects.v1.with_raw_response.create( +response = client.cloud.projects.with_raw_response.create( name="New Project", ) print(response.headers.get('X-My-Header')) -v1 = response.parse() # get the object that `cloud.projects.v1.create()` would have returned -print(v1.id) +project = response.parse() # get the object that `cloud.projects.create()` would have returned +print(project.id) ``` These methods return an [`APIResponse`](https://github.com/stainless-sdks/gcore-python/tree/main/src/gcore/_response.py) object. @@ -229,7 +229,7 @@ The above interface eagerly reads the full response body when you make the reque To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods. ```python -with client.cloud.projects.v1.with_streaming_response.create( +with client.cloud.projects.with_streaming_response.create( name="New Project", ) as response: print(response.headers.get("X-My-Header")) diff --git a/api.md b/api.md index ad30033d..8a18e2da 100644 --- a/api.md +++ b/api.md @@ -2,18 +2,16 @@ ## Projects -### V1 - Types: ```python -from gcore.types.cloud.projects import Project, V1ListResponse, V1DeleteResponse +from gcore.types.cloud import Project, ProjectListResponse, ProjectDeleteResponse ``` Methods: -- client.cloud.projects.v1.create(\*\*params) -> Project -- client.cloud.projects.v1.retrieve(\*, project_id) -> Project -- client.cloud.projects.v1.update(\*, project_id, \*\*params) -> Project -- client.cloud.projects.v1.list(\*\*params) -> V1ListResponse -- client.cloud.projects.v1.delete(\*, project_id) -> V1DeleteResponse +- client.cloud.projects.create(\*\*params) -> Project +- client.cloud.projects.retrieve(\*, project_id) -> Project +- client.cloud.projects.update(\*, project_id, \*\*params) -> Project +- client.cloud.projects.list(\*\*params) -> ProjectListResponse +- client.cloud.projects.delete(\*, project_id) -> ProjectDeleteResponse diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 628e0c1c..d2ea0fa3 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -8,8 +8,22 @@ CloudResourceWithStreamingResponse, AsyncCloudResourceWithStreamingResponse, ) +from .projects import ( + ProjectsResource, + AsyncProjectsResource, + ProjectsResourceWithRawResponse, + AsyncProjectsResourceWithRawResponse, + ProjectsResourceWithStreamingResponse, + AsyncProjectsResourceWithStreamingResponse, +) __all__ = [ + "ProjectsResource", + "AsyncProjectsResource", + "ProjectsResourceWithRawResponse", + "AsyncProjectsResourceWithRawResponse", + "ProjectsResourceWithStreamingResponse", + "AsyncProjectsResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index abeacc6d..91830e1c 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -2,9 +2,7 @@ from __future__ import annotations -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from .projects.projects import ( +from .projects import ( ProjectsResource, AsyncProjectsResource, ProjectsResourceWithRawResponse, @@ -12,6 +10,8 @@ ProjectsResourceWithStreamingResponse, AsyncProjectsResourceWithStreamingResponse, ) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource __all__ = ["CloudResource", "AsyncCloudResource"] diff --git a/src/gcore/resources/cloud/projects/v1.py b/src/gcore/resources/cloud/projects.py similarity index 86% rename from src/gcore/resources/cloud/projects/v1.py rename to src/gcore/resources/cloud/projects.py index 5df0a0cc..9fba17df 100644 --- a/src/gcore/resources/cloud/projects/v1.py +++ b/src/gcore/resources/cloud/projects.py @@ -7,47 +7,47 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( maybe_transform, async_maybe_transform, ) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.projects import v1_list_params, v1_create_params, v1_update_params -from ....types.cloud.projects.project import Project -from ....types.cloud.projects.v1_list_response import V1ListResponse -from ....types.cloud.projects.v1_delete_response import V1DeleteResponse +from ...types.cloud import project_list_params, project_create_params, project_update_params +from ..._base_client import make_request_options +from ...types.cloud.project import Project +from ...types.cloud.project_list_response import ProjectListResponse +from ...types.cloud.project_delete_response import ProjectDeleteResponse -__all__ = ["V1Resource", "AsyncV1Resource"] +__all__ = ["ProjectsResource", "AsyncProjectsResource"] -class V1Resource(SyncAPIResource): +class ProjectsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> V1ResourceWithRawResponse: + def with_raw_response(self) -> ProjectsResourceWithRawResponse: """ 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers """ - return V1ResourceWithRawResponse(self) + return ProjectsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> V1ResourceWithStreamingResponse: + def with_streaming_response(self) -> ProjectsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response """ - return V1ResourceWithStreamingResponse(self) + return ProjectsResourceWithStreamingResponse(self) def create( self, @@ -93,7 +93,7 @@ def create( "description": description, "state": state, }, - v1_create_params.V1CreateParams, + project_create_params.ProjectCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -172,7 +172,7 @@ def update( "name": name, "description": description, }, - v1_update_params.V1UpdateParams, + project_update_params.ProjectUpdateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -194,7 +194,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> V1ListResponse: + ) -> ProjectListResponse: """ List projects @@ -229,10 +229,10 @@ def list( "name": name, "order_by": order_by, }, - v1_list_params.V1ListParams, + project_list_params.ProjectListParams, ), ), - cast_to=V1ListResponse, + cast_to=ProjectListResponse, ) def delete( @@ -245,7 +245,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> V1DeleteResponse: + ) -> ProjectDeleteResponse: """ All cloud resources in all regions that belong to the project will be deleted and will not be recoverable @@ -266,29 +266,29 @@ def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=V1DeleteResponse, + cast_to=ProjectDeleteResponse, ) -class AsyncV1Resource(AsyncAPIResource): +class AsyncProjectsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncV1ResourceWithRawResponse: + def with_raw_response(self) -> AsyncProjectsResourceWithRawResponse: """ 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers """ - return AsyncV1ResourceWithRawResponse(self) + return AsyncProjectsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncV1ResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncProjectsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response """ - return AsyncV1ResourceWithStreamingResponse(self) + return AsyncProjectsResourceWithStreamingResponse(self) async def create( self, @@ -334,7 +334,7 @@ async def create( "description": description, "state": state, }, - v1_create_params.V1CreateParams, + project_create_params.ProjectCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -413,7 +413,7 @@ async def update( "name": name, "description": description, }, - v1_update_params.V1UpdateParams, + project_update_params.ProjectUpdateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -435,7 +435,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> V1ListResponse: + ) -> ProjectListResponse: """ List projects @@ -470,10 +470,10 @@ async def list( "name": name, "order_by": order_by, }, - v1_list_params.V1ListParams, + project_list_params.ProjectListParams, ), ), - cast_to=V1ListResponse, + cast_to=ProjectListResponse, ) async def delete( @@ -486,7 +486,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> V1DeleteResponse: + ) -> ProjectDeleteResponse: """ All cloud resources in all regions that belong to the project will be deleted and will not be recoverable @@ -507,89 +507,89 @@ async def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=V1DeleteResponse, + cast_to=ProjectDeleteResponse, ) -class V1ResourceWithRawResponse: - def __init__(self, v1: V1Resource) -> None: - self._v1 = v1 +class ProjectsResourceWithRawResponse: + def __init__(self, projects: ProjectsResource) -> None: + self._projects = projects self.create = to_raw_response_wrapper( - v1.create, + projects.create, ) self.retrieve = to_raw_response_wrapper( - v1.retrieve, + projects.retrieve, ) self.update = to_raw_response_wrapper( - v1.update, + projects.update, ) self.list = to_raw_response_wrapper( - v1.list, + projects.list, ) self.delete = to_raw_response_wrapper( - v1.delete, + projects.delete, ) -class AsyncV1ResourceWithRawResponse: - def __init__(self, v1: AsyncV1Resource) -> None: - self._v1 = v1 +class AsyncProjectsResourceWithRawResponse: + def __init__(self, projects: AsyncProjectsResource) -> None: + self._projects = projects self.create = async_to_raw_response_wrapper( - v1.create, + projects.create, ) self.retrieve = async_to_raw_response_wrapper( - v1.retrieve, + projects.retrieve, ) self.update = async_to_raw_response_wrapper( - v1.update, + projects.update, ) self.list = async_to_raw_response_wrapper( - v1.list, + projects.list, ) self.delete = async_to_raw_response_wrapper( - v1.delete, + projects.delete, ) -class V1ResourceWithStreamingResponse: - def __init__(self, v1: V1Resource) -> None: - self._v1 = v1 +class ProjectsResourceWithStreamingResponse: + def __init__(self, projects: ProjectsResource) -> None: + self._projects = projects self.create = to_streamed_response_wrapper( - v1.create, + projects.create, ) self.retrieve = to_streamed_response_wrapper( - v1.retrieve, + projects.retrieve, ) self.update = to_streamed_response_wrapper( - v1.update, + projects.update, ) self.list = to_streamed_response_wrapper( - v1.list, + projects.list, ) self.delete = to_streamed_response_wrapper( - v1.delete, + projects.delete, ) -class AsyncV1ResourceWithStreamingResponse: - def __init__(self, v1: AsyncV1Resource) -> None: - self._v1 = v1 +class AsyncProjectsResourceWithStreamingResponse: + def __init__(self, projects: AsyncProjectsResource) -> None: + self._projects = projects self.create = async_to_streamed_response_wrapper( - v1.create, + projects.create, ) self.retrieve = async_to_streamed_response_wrapper( - v1.retrieve, + projects.retrieve, ) self.update = async_to_streamed_response_wrapper( - v1.update, + projects.update, ) self.list = async_to_streamed_response_wrapper( - v1.list, + projects.list, ) self.delete = async_to_streamed_response_wrapper( - v1.delete, + projects.delete, ) diff --git a/src/gcore/resources/cloud/projects/__init__.py b/src/gcore/resources/cloud/projects/__init__.py deleted file mode 100644 index dd6f2d33..00000000 --- a/src/gcore/resources/cloud/projects/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .v1 import ( - V1Resource, - AsyncV1Resource, - V1ResourceWithRawResponse, - AsyncV1ResourceWithRawResponse, - V1ResourceWithStreamingResponse, - AsyncV1ResourceWithStreamingResponse, -) -from .projects import ( - ProjectsResource, - AsyncProjectsResource, - ProjectsResourceWithRawResponse, - AsyncProjectsResourceWithRawResponse, - ProjectsResourceWithStreamingResponse, - AsyncProjectsResourceWithStreamingResponse, -) - -__all__ = [ - "V1Resource", - "AsyncV1Resource", - "V1ResourceWithRawResponse", - "AsyncV1ResourceWithRawResponse", - "V1ResourceWithStreamingResponse", - "AsyncV1ResourceWithStreamingResponse", - "ProjectsResource", - "AsyncProjectsResource", - "ProjectsResourceWithRawResponse", - "AsyncProjectsResourceWithRawResponse", - "ProjectsResourceWithStreamingResponse", - "AsyncProjectsResourceWithStreamingResponse", -] diff --git a/src/gcore/resources/cloud/projects/projects.py b/src/gcore/resources/cloud/projects/projects.py deleted file mode 100644 index ddad2493..00000000 --- a/src/gcore/resources/cloud/projects/projects.py +++ /dev/null @@ -1,102 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .v1 import ( - V1Resource, - AsyncV1Resource, - V1ResourceWithRawResponse, - AsyncV1ResourceWithRawResponse, - V1ResourceWithStreamingResponse, - AsyncV1ResourceWithStreamingResponse, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["ProjectsResource", "AsyncProjectsResource"] - - -class ProjectsResource(SyncAPIResource): - @cached_property - def v1(self) -> V1Resource: - return V1Resource(self._client) - - @cached_property - def with_raw_response(self) -> ProjectsResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return ProjectsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ProjectsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return ProjectsResourceWithStreamingResponse(self) - - -class AsyncProjectsResource(AsyncAPIResource): - @cached_property - def v1(self) -> AsyncV1Resource: - return AsyncV1Resource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncProjectsResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return AsyncProjectsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncProjectsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return AsyncProjectsResourceWithStreamingResponse(self) - - -class ProjectsResourceWithRawResponse: - def __init__(self, projects: ProjectsResource) -> None: - self._projects = projects - - @cached_property - def v1(self) -> V1ResourceWithRawResponse: - return V1ResourceWithRawResponse(self._projects.v1) - - -class AsyncProjectsResourceWithRawResponse: - def __init__(self, projects: AsyncProjectsResource) -> None: - self._projects = projects - - @cached_property - def v1(self) -> AsyncV1ResourceWithRawResponse: - return AsyncV1ResourceWithRawResponse(self._projects.v1) - - -class ProjectsResourceWithStreamingResponse: - def __init__(self, projects: ProjectsResource) -> None: - self._projects = projects - - @cached_property - def v1(self) -> V1ResourceWithStreamingResponse: - return V1ResourceWithStreamingResponse(self._projects.v1) - - -class AsyncProjectsResourceWithStreamingResponse: - def __init__(self, projects: AsyncProjectsResource) -> None: - self._projects = projects - - @cached_property - def v1(self) -> AsyncV1ResourceWithStreamingResponse: - return AsyncV1ResourceWithStreamingResponse(self._projects.v1) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index f8ee8b14..ca07c895 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -1,3 +1,10 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .project import Project as Project +from .project_list_params import ProjectListParams as ProjectListParams +from .project_create_params import ProjectCreateParams as ProjectCreateParams +from .project_list_response import ProjectListResponse as ProjectListResponse +from .project_update_params import ProjectUpdateParams as ProjectUpdateParams +from .project_delete_response import ProjectDeleteResponse as ProjectDeleteResponse diff --git a/src/gcore/types/cloud/projects/project.py b/src/gcore/types/cloud/project.py similarity index 96% rename from src/gcore/types/cloud/projects/project.py rename to src/gcore/types/cloud/project.py index db5ad394..c3d7f6f4 100644 --- a/src/gcore/types/cloud/projects/project.py +++ b/src/gcore/types/cloud/project.py @@ -3,7 +3,7 @@ from typing import Optional from datetime import datetime -from ...._models import BaseModel +from ..._models import BaseModel __all__ = ["Project"] diff --git a/src/gcore/types/cloud/projects/v1_create_params.py b/src/gcore/types/cloud/project_create_params.py similarity index 85% rename from src/gcore/types/cloud/projects/v1_create_params.py rename to src/gcore/types/cloud/project_create_params.py index 30270429..9a9255be 100644 --- a/src/gcore/types/cloud/projects/v1_create_params.py +++ b/src/gcore/types/cloud/project_create_params.py @@ -5,10 +5,10 @@ from typing import Optional from typing_extensions import Required, TypedDict -__all__ = ["V1CreateParams"] +__all__ = ["ProjectCreateParams"] -class V1CreateParams(TypedDict, total=False): +class ProjectCreateParams(TypedDict, total=False): name: Required[str] """Unique project name for a client. Each client always has one "default" project.""" diff --git a/src/gcore/types/cloud/projects/v1_delete_response.py b/src/gcore/types/cloud/project_delete_response.py similarity index 62% rename from src/gcore/types/cloud/projects/v1_delete_response.py rename to src/gcore/types/cloud/project_delete_response.py index 3a54974c..1daebf63 100644 --- a/src/gcore/types/cloud/projects/v1_delete_response.py +++ b/src/gcore/types/cloud/project_delete_response.py @@ -2,11 +2,11 @@ from typing import List, Optional -from ...._models import BaseModel +from ..._models import BaseModel -__all__ = ["V1DeleteResponse"] +__all__ = ["ProjectDeleteResponse"] -class V1DeleteResponse(BaseModel): +class ProjectDeleteResponse(BaseModel): tasks: Optional[List[str]] = None """Task list""" diff --git a/src/gcore/types/cloud/projects/v1_list_params.py b/src/gcore/types/cloud/project_list_params.py similarity index 88% rename from src/gcore/types/cloud/projects/v1_list_params.py rename to src/gcore/types/cloud/project_list_params.py index 9b79e6af..feb64252 100644 --- a/src/gcore/types/cloud/projects/v1_list_params.py +++ b/src/gcore/types/cloud/project_list_params.py @@ -5,10 +5,10 @@ from typing import List, Optional from typing_extensions import Literal, TypedDict -__all__ = ["V1ListParams"] +__all__ = ["ProjectListParams"] -class V1ListParams(TypedDict, total=False): +class ProjectListParams(TypedDict, total=False): client_id: Optional[int] """Client ID filter for administrators.""" diff --git a/src/gcore/types/cloud/projects/v1_list_response.py b/src/gcore/types/cloud/project_list_response.py similarity index 68% rename from src/gcore/types/cloud/projects/v1_list_response.py rename to src/gcore/types/cloud/project_list_response.py index e86a59ce..cb5ec6e1 100644 --- a/src/gcore/types/cloud/projects/v1_list_response.py +++ b/src/gcore/types/cloud/project_list_response.py @@ -3,12 +3,12 @@ from typing import List from .project import Project -from ...._models import BaseModel +from ..._models import BaseModel -__all__ = ["V1ListResponse"] +__all__ = ["ProjectListResponse"] -class V1ListResponse(BaseModel): +class ProjectListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/projects/v1_update_params.py b/src/gcore/types/cloud/project_update_params.py similarity index 81% rename from src/gcore/types/cloud/projects/v1_update_params.py rename to src/gcore/types/cloud/project_update_params.py index 3219e0da..42489cb1 100644 --- a/src/gcore/types/cloud/projects/v1_update_params.py +++ b/src/gcore/types/cloud/project_update_params.py @@ -5,10 +5,10 @@ from typing import Optional from typing_extensions import Required, TypedDict -__all__ = ["V1UpdateParams"] +__all__ = ["ProjectUpdateParams"] -class V1UpdateParams(TypedDict, total=False): +class ProjectUpdateParams(TypedDict, total=False): project_id: int name: Required[str] diff --git a/src/gcore/types/cloud/projects/__init__.py b/src/gcore/types/cloud/projects/__init__.py deleted file mode 100644 index 8de994e9..00000000 --- a/src/gcore/types/cloud/projects/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .project import Project as Project -from .v1_list_params import V1ListParams as V1ListParams -from .v1_create_params import V1CreateParams as V1CreateParams -from .v1_list_response import V1ListResponse as V1ListResponse -from .v1_update_params import V1UpdateParams as V1UpdateParams -from .v1_delete_response import V1DeleteResponse as V1DeleteResponse diff --git a/tests/api_resources/cloud/projects/__init__.py b/tests/api_resources/cloud/projects/__init__.py deleted file mode 100644 index fd8019a9..00000000 --- a/tests/api_resources/cloud/projects/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/projects/test_v1.py b/tests/api_resources/cloud/test_projects.py similarity index 60% rename from tests/api_resources/cloud/projects/test_v1.py rename to tests/api_resources/cloud/test_projects.py index 3936f021..abccc861 100644 --- a/tests/api_resources/cloud/projects/test_v1.py +++ b/tests/api_resources/cloud/test_projects.py @@ -9,380 +9,380 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.projects import ( +from gcore.types.cloud import ( Project, - V1ListResponse, - V1DeleteResponse, + ProjectListResponse, + ProjectDeleteResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestV1: +class TestProjects: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_create(self, client: Gcore) -> None: - v1 = client.cloud.projects.v1.create( + project = client.cloud.projects.create( name="New Project", ) - assert_matches_type(Project, v1, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - v1 = client.cloud.projects.v1.create( + project = client.cloud.projects.create( name="New Project", client_id=3, description="Project description", state="ACTIVE", ) - assert_matches_type(Project, v1, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.cloud.projects.v1.with_raw_response.create( + response = client.cloud.projects.with_raw_response.create( name="New Project", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = response.parse() - assert_matches_type(Project, v1, path=["response"]) + project = response.parse() + assert_matches_type(Project, project, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.cloud.projects.v1.with_streaming_response.create( + with client.cloud.projects.with_streaming_response.create( name="New Project", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = response.parse() - assert_matches_type(Project, v1, path=["response"]) + project = response.parse() + assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_retrieve(self, client: Gcore) -> None: - v1 = client.cloud.projects.v1.retrieve( + project = client.cloud.projects.retrieve( project_id=0, ) - assert_matches_type(Project, v1, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Gcore) -> None: - response = client.cloud.projects.v1.with_raw_response.retrieve( + response = client.cloud.projects.with_raw_response.retrieve( project_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = response.parse() - assert_matches_type(Project, v1, path=["response"]) + project = response.parse() + assert_matches_type(Project, project, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: Gcore) -> None: - with client.cloud.projects.v1.with_streaming_response.retrieve( + with client.cloud.projects.with_streaming_response.retrieve( project_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = response.parse() - assert_matches_type(Project, v1, path=["response"]) + project = response.parse() + assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_update(self, client: Gcore) -> None: - v1 = client.cloud.projects.v1.update( + project = client.cloud.projects.update( project_id=0, name="New Project", ) - assert_matches_type(Project, v1, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - v1 = client.cloud.projects.v1.update( + project = client.cloud.projects.update( project_id=0, name="New Project", description="Project description", ) - assert_matches_type(Project, v1, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.projects.v1.with_raw_response.update( + response = client.cloud.projects.with_raw_response.update( project_id=0, name="New Project", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = response.parse() - assert_matches_type(Project, v1, path=["response"]) + project = response.parse() + assert_matches_type(Project, project, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.projects.v1.with_streaming_response.update( + with client.cloud.projects.with_streaming_response.update( project_id=0, name="New Project", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = response.parse() - assert_matches_type(Project, v1, path=["response"]) + project = response.parse() + assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_list(self, client: Gcore) -> None: - v1 = client.cloud.projects.v1.list() - assert_matches_type(V1ListResponse, v1, path=["response"]) + project = client.cloud.projects.list() + assert_matches_type(ProjectListResponse, project, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - v1 = client.cloud.projects.v1.list( + project = client.cloud.projects.list( client_id=123, include_deleted=False, name="my-project", order_by=["created_at.asc"], ) - assert_matches_type(V1ListResponse, v1, path=["response"]) + assert_matches_type(ProjectListResponse, project, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.projects.v1.with_raw_response.list() + response = client.cloud.projects.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = response.parse() - assert_matches_type(V1ListResponse, v1, path=["response"]) + project = response.parse() + assert_matches_type(ProjectListResponse, project, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.projects.v1.with_streaming_response.list() as response: + with client.cloud.projects.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = response.parse() - assert_matches_type(V1ListResponse, v1, path=["response"]) + project = response.parse() + assert_matches_type(ProjectListResponse, project, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: Gcore) -> None: - v1 = client.cloud.projects.v1.delete( + project = client.cloud.projects.delete( project_id=0, ) - assert_matches_type(V1DeleteResponse, v1, path=["response"]) + assert_matches_type(ProjectDeleteResponse, project, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.projects.v1.with_raw_response.delete( + response = client.cloud.projects.with_raw_response.delete( project_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = response.parse() - assert_matches_type(V1DeleteResponse, v1, path=["response"]) + project = response.parse() + assert_matches_type(ProjectDeleteResponse, project, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.projects.v1.with_streaming_response.delete( + with client.cloud.projects.with_streaming_response.delete( project_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = response.parse() - assert_matches_type(V1DeleteResponse, v1, path=["response"]) + project = response.parse() + assert_matches_type(ProjectDeleteResponse, project, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncV1: +class TestAsyncProjects: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - v1 = await async_client.cloud.projects.v1.create( + project = await async_client.cloud.projects.create( name="New Project", ) - assert_matches_type(Project, v1, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - v1 = await async_client.cloud.projects.v1.create( + project = await async_client.cloud.projects.create( name="New Project", client_id=3, description="Project description", state="ACTIVE", ) - assert_matches_type(Project, v1, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.projects.v1.with_raw_response.create( + response = await async_client.cloud.projects.with_raw_response.create( name="New Project", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = await response.parse() - assert_matches_type(Project, v1, path=["response"]) + project = await response.parse() + assert_matches_type(Project, project, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.projects.v1.with_streaming_response.create( + async with async_client.cloud.projects.with_streaming_response.create( name="New Project", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = await response.parse() - assert_matches_type(Project, v1, path=["response"]) + project = await response.parse() + assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_retrieve(self, async_client: AsyncGcore) -> None: - v1 = await async_client.cloud.projects.v1.retrieve( + project = await async_client.cloud.projects.retrieve( project_id=0, ) - assert_matches_type(Project, v1, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.projects.v1.with_raw_response.retrieve( + response = await async_client.cloud.projects.with_raw_response.retrieve( project_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = await response.parse() - assert_matches_type(Project, v1, path=["response"]) + project = await response.parse() + assert_matches_type(Project, project, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.projects.v1.with_streaming_response.retrieve( + async with async_client.cloud.projects.with_streaming_response.retrieve( project_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = await response.parse() - assert_matches_type(Project, v1, path=["response"]) + project = await response.parse() + assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - v1 = await async_client.cloud.projects.v1.update( + project = await async_client.cloud.projects.update( project_id=0, name="New Project", ) - assert_matches_type(Project, v1, path=["response"]) + assert_matches_type(Project, project, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - v1 = await async_client.cloud.projects.v1.update( + project = await async_client.cloud.projects.update( project_id=0, name="New Project", description="Project description", ) - assert_matches_type(Project, v1, path=["response"]) + 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.v1.with_raw_response.update( + response = await async_client.cloud.projects.with_raw_response.update( project_id=0, name="New Project", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = await response.parse() - assert_matches_type(Project, v1, path=["response"]) + project = await response.parse() + assert_matches_type(Project, project, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.projects.v1.with_streaming_response.update( + async with async_client.cloud.projects.with_streaming_response.update( project_id=0, name="New Project", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = await response.parse() - assert_matches_type(Project, v1, path=["response"]) + project = await response.parse() + assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - v1 = await async_client.cloud.projects.v1.list() - assert_matches_type(V1ListResponse, v1, path=["response"]) + project = await async_client.cloud.projects.list() + assert_matches_type(ProjectListResponse, project, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - v1 = await async_client.cloud.projects.v1.list( + project = await async_client.cloud.projects.list( client_id=123, include_deleted=False, name="my-project", order_by=["created_at.asc"], ) - assert_matches_type(V1ListResponse, v1, path=["response"]) + assert_matches_type(ProjectListResponse, project, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.projects.v1.with_raw_response.list() + response = await async_client.cloud.projects.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = await response.parse() - assert_matches_type(V1ListResponse, v1, path=["response"]) + project = await response.parse() + assert_matches_type(ProjectListResponse, project, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.projects.v1.with_streaming_response.list() as response: + async with async_client.cloud.projects.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = await response.parse() - assert_matches_type(V1ListResponse, v1, path=["response"]) + project = await response.parse() + assert_matches_type(ProjectListResponse, project, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - v1 = await async_client.cloud.projects.v1.delete( + project = await async_client.cloud.projects.delete( project_id=0, ) - assert_matches_type(V1DeleteResponse, v1, path=["response"]) + assert_matches_type(ProjectDeleteResponse, project, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.projects.v1.with_raw_response.delete( + response = await async_client.cloud.projects.with_raw_response.delete( project_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = await response.parse() - assert_matches_type(V1DeleteResponse, v1, path=["response"]) + project = await response.parse() + assert_matches_type(ProjectDeleteResponse, project, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.projects.v1.with_streaming_response.delete( + async with async_client.cloud.projects.with_streaming_response.delete( project_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - v1 = await response.parse() - assert_matches_type(V1DeleteResponse, v1, path=["response"]) + project = await response.parse() + assert_matches_type(ProjectDeleteResponse, project, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/test_client.py b/tests/test_client.py index 70e31e48..afc4ac1c 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -28,7 +28,7 @@ from gcore._constants import RAW_RESPONSE_HEADER from gcore._exceptions import GcoreError, APIStatusError, APITimeoutError, APIResponseValidationError from gcore._base_client import DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, make_request_options -from gcore.types.cloud.projects.v1_create_params import V1CreateParams +from gcore.types.cloud.project_create_params import ProjectCreateParams from .utils import update_env @@ -362,11 +362,11 @@ def test_project_id_client_params(self) -> None: with client as c2: with pytest.raises(ValueError, match="Missing project_id argument;"): - c2.cloud.projects.v1.retrieve() + c2.cloud.projects.retrieve() client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, project_id=0) with client as c2: - c2.cloud.projects.v1.retrieve() + c2.cloud.projects.retrieve() def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -723,7 +723,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No with pytest.raises(APITimeoutError): self.client.post( "/cloud/v1/projects", - body=cast(object, maybe_transform(dict(name="New Project"), V1CreateParams)), + body=cast(object, maybe_transform(dict(name="New Project"), ProjectCreateParams)), cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, ) @@ -738,7 +738,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non with pytest.raises(APIStatusError): self.client.post( "/cloud/v1/projects", - body=cast(object, maybe_transform(dict(name="New Project"), V1CreateParams)), + body=cast(object, maybe_transform(dict(name="New Project"), ProjectCreateParams)), cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, ) @@ -771,7 +771,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) - response = client.cloud.projects.v1.with_raw_response.create(name="New Project") + response = client.cloud.projects.with_raw_response.create(name="New Project") assert response.retries_taken == failures_before_success assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success @@ -793,7 +793,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) - response = client.cloud.projects.v1.with_raw_response.create( + response = client.cloud.projects.with_raw_response.create( name="New Project", extra_headers={"x-stainless-retry-count": Omit()} ) @@ -818,7 +818,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) - response = client.cloud.projects.v1.with_raw_response.create( + response = client.cloud.projects.with_raw_response.create( name="New Project", extra_headers={"x-stainless-retry-count": "42"} ) @@ -1137,11 +1137,11 @@ async def test_project_id_client_params(self) -> None: async with client as c2: with pytest.raises(ValueError, match="Missing project_id argument;"): - await c2.cloud.projects.v1.retrieve() + await c2.cloud.projects.retrieve() client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, project_id=0) async with client as c2: - await c2.cloud.projects.v1.retrieve() + await c2.cloud.projects.retrieve() def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1510,7 +1510,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) with pytest.raises(APITimeoutError): await self.client.post( "/cloud/v1/projects", - body=cast(object, maybe_transform(dict(name="New Project"), V1CreateParams)), + body=cast(object, maybe_transform(dict(name="New Project"), ProjectCreateParams)), cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, ) @@ -1525,7 +1525,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) with pytest.raises(APIStatusError): await self.client.post( "/cloud/v1/projects", - body=cast(object, maybe_transform(dict(name="New Project"), V1CreateParams)), + body=cast(object, maybe_transform(dict(name="New Project"), ProjectCreateParams)), cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, ) @@ -1559,7 +1559,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) - response = await client.cloud.projects.v1.with_raw_response.create(name="New Project") + response = await client.cloud.projects.with_raw_response.create(name="New Project") assert response.retries_taken == failures_before_success assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success @@ -1584,7 +1584,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) - response = await client.cloud.projects.v1.with_raw_response.create( + response = await client.cloud.projects.with_raw_response.create( name="New Project", extra_headers={"x-stainless-retry-count": Omit()} ) @@ -1610,7 +1610,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) - response = await client.cloud.projects.v1.with_raw_response.create( + response = await client.cloud.projects.with_raw_response.create( name="New Project", extra_headers={"x-stainless-retry-count": "42"} ) From bcc3472abe69117af59698bf49e1a1a8c88aaa9e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 10:37:59 +0000 Subject: [PATCH 003/592] feat(api): simplify env vars --- .stats.yml | 2 +- src/gcore/_client.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0beff5cb..577f2a23 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 5 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c1c67b7326d84207f233f2bd8c7d0b3c1ed0f263f81344fbd870819755e153ec.yml openapi_spec_hash: 1c861e8bc6b94f1581dda1cbee26b993 -config_hash: ec5944e3865f6debc0f6be17af8e5f41 +config_hash: 5b5b66e5df5abaf8f96e7741dd8b10de diff --git a/src/gcore/_client.py b/src/gcore/_client.py index f993ffb5..94ed27e3 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -76,8 +76,8 @@ def __init__( This automatically infers the following arguments from their corresponding environment variables if they are not provided: - `api_key` from `GCORE_API_KEY` - - `project_id` from `GCORE_PROJECT_ID` - - `region_id` from `GCORE_REGION_ID` + - `project_id` from `GCORE_PROJECT` + - `region_id` from `GCORE_REGION` """ if api_key is None: api_key = os.environ.get("GCORE_API_KEY") @@ -88,11 +88,11 @@ def __init__( self.api_key = api_key if project_id is None: - project_id = maybe_coerce_integer(os.environ.get("GCORE_PROJECT_ID")) + project_id = maybe_coerce_integer(os.environ.get("GCORE_PROJECT")) self.project_id = project_id if region_id is None: - region_id = maybe_coerce_integer(os.environ.get("GCORE_REGION_ID")) + region_id = maybe_coerce_integer(os.environ.get("GCORE_REGION")) self.region_id = region_id if base_url is None: @@ -281,8 +281,8 @@ def __init__( This automatically infers the following arguments from their corresponding environment variables if they are not provided: - `api_key` from `GCORE_API_KEY` - - `project_id` from `GCORE_PROJECT_ID` - - `region_id` from `GCORE_REGION_ID` + - `project_id` from `GCORE_PROJECT` + - `region_id` from `GCORE_REGION` """ if api_key is None: api_key = os.environ.get("GCORE_API_KEY") @@ -293,11 +293,11 @@ def __init__( self.api_key = api_key if project_id is None: - project_id = maybe_coerce_integer(os.environ.get("GCORE_PROJECT_ID")) + project_id = maybe_coerce_integer(os.environ.get("GCORE_PROJECT")) self.project_id = project_id if region_id is None: - region_id = maybe_coerce_integer(os.environ.get("GCORE_REGION_ID")) + region_id = maybe_coerce_integer(os.environ.get("GCORE_REGION")) self.region_id = region_id if base_url is None: From e221020fb989d04e32ba4d25572ab646cd8833f6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 17:02:12 +0000 Subject: [PATCH 004/592] feat(api): manual updates --- .stats.yml | 4 ++-- src/gcore/resources/cloud/projects.py | 24 +++++++++----------- src/gcore/types/cloud/project.py | 6 ++++- src/gcore/types/cloud/project_list_params.py | 11 ++++----- tests/api_resources/cloud/test_projects.py | 8 +++---- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/.stats.yml b/.stats.yml index 577f2a23..b4484dcd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 5 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c1c67b7326d84207f233f2bd8c7d0b3c1ed0f263f81344fbd870819755e153ec.yml -openapi_spec_hash: 1c861e8bc6b94f1581dda1cbee26b993 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3ad4b479c2f5ef082c85b8b6d740987688b8b5a4fded84db682eeb0743b5b185.yml +openapi_spec_hash: 82182a92ba1c4c66f5634eb1a0c6ba7b config_hash: 5b5b66e5df5abaf8f96e7741dd8b10de diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 9fba17df..05ecc31c 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import Literal import httpx @@ -183,11 +183,10 @@ def update( def list( self, *, - client_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: int | NotGiven = NOT_GIVEN, include_deleted: bool | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - order_by: Optional[List[Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"]]] - | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -201,11 +200,11 @@ def list( Args: client_id: Client ID filter for administrators. - include_deleted: Whether to include deleted entries in the response. + include_deleted: Whether to include deleted projects in the response. name: Name to filter the results by. - order_by: Order by field and direction. Supports multiple values. + order_by: Order by field and direction. extra_headers: Send extra headers @@ -424,11 +423,10 @@ async def update( async def list( self, *, - client_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: int | NotGiven = NOT_GIVEN, include_deleted: bool | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - order_by: Optional[List[Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"]]] - | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -442,11 +440,11 @@ async def list( Args: client_id: Client ID filter for administrators. - include_deleted: Whether to include deleted entries in the response. + include_deleted: Whether to include deleted projects in the response. name: Name to filter the results by. - order_by: Order by field and direction. Supports multiple values. + order_by: Order by field and direction. extra_headers: Send extra headers diff --git a/src/gcore/types/cloud/project.py b/src/gcore/types/cloud/project.py index c3d7f6f4..8d978657 100644 --- a/src/gcore/types/cloud/project.py +++ b/src/gcore/types/cloud/project.py @@ -40,4 +40,8 @@ class Project(BaseModel): """Description of the project.""" task_id: Optional[str] = None - """ID of the Task entity responsible for handling the project's state transition.""" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. + """ diff --git a/src/gcore/types/cloud/project_list_params.py b/src/gcore/types/cloud/project_list_params.py index feb64252..39ad1ec7 100644 --- a/src/gcore/types/cloud/project_list_params.py +++ b/src/gcore/types/cloud/project_list_params.py @@ -2,21 +2,20 @@ from __future__ import annotations -from typing import List, Optional from typing_extensions import Literal, TypedDict __all__ = ["ProjectListParams"] class ProjectListParams(TypedDict, total=False): - client_id: Optional[int] + client_id: int """Client ID filter for administrators.""" include_deleted: bool - """Whether to include deleted entries in the response.""" + """Whether to include deleted projects in the response.""" - name: Optional[str] + name: str """Name to filter the results by.""" - order_by: Optional[List[Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"]]] - """Order by field and direction. Supports multiple values.""" + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] + """Order by field and direction.""" diff --git a/tests/api_resources/cloud/test_projects.py b/tests/api_resources/cloud/test_projects.py index abccc861..0cf80a34 100644 --- a/tests/api_resources/cloud/test_projects.py +++ b/tests/api_resources/cloud/test_projects.py @@ -144,10 +144,10 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: project = client.cloud.projects.list( - client_id=123, + client_id=1, include_deleted=False, name="my-project", - order_by=["created_at.asc"], + order_by="created_at.asc", ) assert_matches_type(ProjectListResponse, project, path=["response"]) @@ -329,10 +329,10 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: project = await async_client.cloud.projects.list( - client_id=123, + client_id=1, include_deleted=False, name="my-project", - order_by=["created_at.asc"], + order_by="created_at.asc", ) assert_matches_type(ProjectListResponse, project, path=["response"]) From 8615be42f913e19f394ba8f5926c760bb4dccb9c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 14:40:07 +0000 Subject: [PATCH 005/592] chore(internal): slight transform perf improvement --- src/gcore/_utils/_transform.py | 22 ++++++++++++++++++++++ tests/test_transform.py | 12 ++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/gcore/_utils/_transform.py b/src/gcore/_utils/_transform.py index 7ac2e17f..3ec62081 100644 --- a/src/gcore/_utils/_transform.py +++ b/src/gcore/_utils/_transform.py @@ -142,6 +142,10 @@ def _maybe_transform_key(key: str, type_: type) -> str: return key +def _no_transform_needed(annotation: type) -> bool: + return annotation == float or annotation == int + + def _transform_recursive( data: object, *, @@ -184,6 +188,15 @@ def _transform_recursive( return cast(object, data) inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] if is_union_type(stripped_type): @@ -332,6 +345,15 @@ async def _async_transform_recursive( return cast(object, data) inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] if is_union_type(stripped_type): diff --git a/tests/test_transform.py b/tests/test_transform.py index b166c556..d699cab7 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -432,3 +432,15 @@ async def test_base64_file_input(use_async: bool) -> None: assert await transform({"foo": io.BytesIO(b"Hello, world!")}, TypedDictBase64Input, use_async) == { "foo": "SGVsbG8sIHdvcmxkIQ==" } # type: ignore[comparison-overlap] + + +@parametrize +@pytest.mark.asyncio +async def test_transform_skipping(use_async: bool) -> None: + # lists of ints are left as-is + data = [1, 2, 3] + assert await transform(data, List[int], use_async) is data + + # iterables of ints are converted to a list + data = iter([1, 2, 3]) + assert await transform(data, Iterable[int], use_async) == [1, 2, 3] From ea711529e4bed23299a81f067d1685a3b6d87f09 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 14:40:53 +0000 Subject: [PATCH 006/592] chore(tests): improve enum examples --- tests/api_resources/cloud/test_projects.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/api_resources/cloud/test_projects.py b/tests/api_resources/cloud/test_projects.py index 0cf80a34..e666537e 100644 --- a/tests/api_resources/cloud/test_projects.py +++ b/tests/api_resources/cloud/test_projects.py @@ -147,7 +147,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: client_id=1, include_deleted=False, name="my-project", - order_by="created_at.asc", + order_by="name.desc", ) assert_matches_type(ProjectListResponse, project, path=["response"]) @@ -332,7 +332,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No client_id=1, include_deleted=False, name="my-project", - order_by="created_at.asc", + order_by="name.desc", ) assert_matches_type(ProjectListResponse, project, path=["response"]) From 3842c89b449247a95316f38df19a7ca35db62cb7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 15:13:59 +0000 Subject: [PATCH 007/592] fix(client): correct path param return type --- src/gcore/_client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 94ed27e3..cfc1cd0a 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -190,7 +190,7 @@ def copy( # client.with_options(timeout=10).foo.create(...) with_options = copy - def _get_project_id_path_param(self) -> str: + def _get_project_id_path_param(self) -> int: from_client = self.project_id if from_client is not None: return from_client @@ -199,7 +199,7 @@ def _get_project_id_path_param(self) -> str: "Missing project_id argument; Please provide it at the client level, e.g. Gcore(project_id='abcd') or per method." ) - def _get_region_id_path_param(self) -> str: + def _get_region_id_path_param(self) -> int: from_client = self.region_id if from_client is not None: return from_client @@ -395,7 +395,7 @@ def copy( # client.with_options(timeout=10).foo.create(...) with_options = copy - def _get_project_id_path_param(self) -> str: + def _get_project_id_path_param(self) -> int: from_client = self.project_id if from_client is not None: return from_client @@ -404,7 +404,7 @@ def _get_project_id_path_param(self) -> str: "Missing project_id argument; Please provide it at the client level, e.g. AsyncGcore(project_id='abcd') or per method." ) - def _get_region_id_path_param(self) -> str: + def _get_region_id_path_param(self) -> int: from_client = self.region_id if from_client is not None: return from_client From c9d74db2aa876f93b156bd893eeca42fb6f4e78d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 09:46:55 +0000 Subject: [PATCH 008/592] GCLOUD2-18522 Add cloud regions --- .stats.yml | 4 +- api.md | 13 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 ++ src/gcore/resources/cloud/regions.py | 333 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 3 + src/gcore/types/cloud/region.py | 98 ++++++ src/gcore/types/cloud/region_list_params.py | 31 ++ .../types/cloud/region_retrieve_params.py | 18 + tests/api_resources/cloud/test_regions.py | 173 +++++++++ tests/test_client.py | 22 ++ 11 files changed, 739 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/regions.py create mode 100644 src/gcore/types/cloud/region.py create mode 100644 src/gcore/types/cloud/region_list_params.py create mode 100644 src/gcore/types/cloud/region_retrieve_params.py create mode 100644 tests/api_resources/cloud/test_regions.py diff --git a/.stats.yml b/.stats.yml index b4484dcd..c888fa4f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 5 +configured_endpoints: 7 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3ad4b479c2f5ef082c85b8b6d740987688b8b5a4fded84db682eeb0743b5b185.yml openapi_spec_hash: 82182a92ba1c4c66f5634eb1a0c6ba7b -config_hash: 5b5b66e5df5abaf8f96e7741dd8b10de +config_hash: a12d73d67942b05226126ec381161016 diff --git a/api.md b/api.md index 8a18e2da..a40f2949 100644 --- a/api.md +++ b/api.md @@ -15,3 +15,16 @@ Methods: - client.cloud.projects.update(\*, project_id, \*\*params) -> Project - client.cloud.projects.list(\*\*params) -> ProjectListResponse - client.cloud.projects.delete(\*, project_id) -> ProjectDeleteResponse + +## Regions + +Types: + +```python +from gcore.types.cloud import Region +``` + +Methods: + +- client.cloud.regions.retrieve(\*, region_id, \*\*params) -> Region +- client.cloud.regions.list(\*\*params) -> SyncOffsetPage[Region] diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index d2ea0fa3..21a9d255 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -8,6 +8,14 @@ CloudResourceWithStreamingResponse, AsyncCloudResourceWithStreamingResponse, ) +from .regions import ( + RegionsResource, + AsyncRegionsResource, + RegionsResourceWithRawResponse, + AsyncRegionsResourceWithRawResponse, + RegionsResourceWithStreamingResponse, + AsyncRegionsResourceWithStreamingResponse, +) from .projects import ( ProjectsResource, AsyncProjectsResource, @@ -24,6 +32,12 @@ "AsyncProjectsResourceWithRawResponse", "ProjectsResourceWithStreamingResponse", "AsyncProjectsResourceWithStreamingResponse", + "RegionsResource", + "AsyncRegionsResource", + "RegionsResourceWithRawResponse", + "AsyncRegionsResourceWithRawResponse", + "RegionsResourceWithStreamingResponse", + "AsyncRegionsResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 91830e1c..749a3a49 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -2,6 +2,14 @@ from __future__ import annotations +from .regions import ( + RegionsResource, + AsyncRegionsResource, + RegionsResourceWithRawResponse, + AsyncRegionsResourceWithRawResponse, + RegionsResourceWithStreamingResponse, + AsyncRegionsResourceWithStreamingResponse, +) from .projects import ( ProjectsResource, AsyncProjectsResource, @@ -21,6 +29,10 @@ class CloudResource(SyncAPIResource): def projects(self) -> ProjectsResource: return ProjectsResource(self._client) + @cached_property + def regions(self) -> RegionsResource: + return RegionsResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -46,6 +58,10 @@ class AsyncCloudResource(AsyncAPIResource): def projects(self) -> AsyncProjectsResource: return AsyncProjectsResource(self._client) + @cached_property + def regions(self) -> AsyncRegionsResource: + return AsyncRegionsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -74,6 +90,10 @@ def __init__(self, cloud: CloudResource) -> None: def projects(self) -> ProjectsResourceWithRawResponse: return ProjectsResourceWithRawResponse(self._cloud.projects) + @cached_property + def regions(self) -> RegionsResourceWithRawResponse: + return RegionsResourceWithRawResponse(self._cloud.regions) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -83,6 +103,10 @@ def __init__(self, cloud: AsyncCloudResource) -> None: def projects(self) -> AsyncProjectsResourceWithRawResponse: return AsyncProjectsResourceWithRawResponse(self._cloud.projects) + @cached_property + def regions(self) -> AsyncRegionsResourceWithRawResponse: + return AsyncRegionsResourceWithRawResponse(self._cloud.regions) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -92,6 +116,10 @@ def __init__(self, cloud: CloudResource) -> None: def projects(self) -> ProjectsResourceWithStreamingResponse: return ProjectsResourceWithStreamingResponse(self._cloud.projects) + @cached_property + def regions(self) -> RegionsResourceWithStreamingResponse: + return RegionsResourceWithStreamingResponse(self._cloud.regions) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -100,3 +128,7 @@ def __init__(self, cloud: AsyncCloudResource) -> None: @cached_property def projects(self) -> AsyncProjectsResourceWithStreamingResponse: return AsyncProjectsResourceWithStreamingResponse(self._cloud.projects) + + @cached_property + def regions(self) -> AsyncRegionsResourceWithStreamingResponse: + return AsyncRegionsResourceWithStreamingResponse(self._cloud.regions) diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py new file mode 100644 index 00000000..2c742581 --- /dev/null +++ b/src/gcore/resources/cloud/regions.py @@ -0,0 +1,333 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 ...pagination import SyncOffsetPage, AsyncOffsetPage +from ...types.cloud import region_list_params, region_retrieve_params +from ..._base_client import AsyncPaginator, make_request_options +from ...types.cloud.region import Region + +__all__ = ["RegionsResource", "AsyncRegionsResource"] + + +class RegionsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RegionsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return RegionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RegionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return RegionsResourceWithStreamingResponse(self) + + def retrieve( + self, + *, + region_id: int | None = None, + show_volume_types: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Region: + """ + Get region + + Args: + region_id: Region ID + + show_volume_types: If true, null `available_volume_type` is replaced with a list of available + volume types. + + 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 region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get( + f"/cloud/v1/regions/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"show_volume_types": show_volume_types}, region_retrieve_params.RegionRetrieveParams + ), + ), + cast_to=Region, + ) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] + | NotGiven = NOT_GIVEN, + product: Literal["containers", "inference"] | NotGiven = NOT_GIVEN, + show_volume_types: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[Region]: + """List regions + + Args: + limit: Limit the number of returned regions. + + Falls back to default of 100 if not + specified. Limited by max limit value of 1000 + + offset: Offset value is used to exclude the first set of records from the result + + order_by: Order by field and direction. + + product: If defined then return only regions that support given product. + + show_volume_types: If true, null `available_volume_type` is replaced with a list of available + volume types. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v1/regions", + page=SyncOffsetPage[Region], + 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, + "product": product, + "show_volume_types": show_volume_types, + }, + region_list_params.RegionListParams, + ), + ), + model=Region, + ) + + +class AsyncRegionsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRegionsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRegionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRegionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncRegionsResourceWithStreamingResponse(self) + + async def retrieve( + self, + *, + region_id: int | None = None, + show_volume_types: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Region: + """ + Get region + + Args: + region_id: Region ID + + show_volume_types: If true, null `available_volume_type` is replaced with a list of available + volume types. + + 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 region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._get( + f"/cloud/v1/regions/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"show_volume_types": show_volume_types}, region_retrieve_params.RegionRetrieveParams + ), + ), + cast_to=Region, + ) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] + | NotGiven = NOT_GIVEN, + product: Literal["containers", "inference"] | NotGiven = NOT_GIVEN, + show_volume_types: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Region, AsyncOffsetPage[Region]]: + """List regions + + Args: + limit: Limit the number of returned regions. + + Falls back to default of 100 if not + specified. Limited by max limit value of 1000 + + offset: Offset value is used to exclude the first set of records from the result + + order_by: Order by field and direction. + + product: If defined then return only regions that support given product. + + show_volume_types: If true, null `available_volume_type` is replaced with a list of available + volume types. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v1/regions", + page=AsyncOffsetPage[Region], + 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, + "product": product, + "show_volume_types": show_volume_types, + }, + region_list_params.RegionListParams, + ), + ), + model=Region, + ) + + +class RegionsResourceWithRawResponse: + def __init__(self, regions: RegionsResource) -> None: + self._regions = regions + + self.retrieve = to_raw_response_wrapper( + regions.retrieve, + ) + self.list = to_raw_response_wrapper( + regions.list, + ) + + +class AsyncRegionsResourceWithRawResponse: + def __init__(self, regions: AsyncRegionsResource) -> None: + self._regions = regions + + self.retrieve = async_to_raw_response_wrapper( + regions.retrieve, + ) + self.list = async_to_raw_response_wrapper( + regions.list, + ) + + +class RegionsResourceWithStreamingResponse: + def __init__(self, regions: RegionsResource) -> None: + self._regions = regions + + self.retrieve = to_streamed_response_wrapper( + regions.retrieve, + ) + self.list = to_streamed_response_wrapper( + regions.list, + ) + + +class AsyncRegionsResourceWithStreamingResponse: + def __init__(self, regions: AsyncRegionsResource) -> None: + self._regions = regions + + self.retrieve = async_to_streamed_response_wrapper( + regions.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + regions.list, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index ca07c895..ca2bc852 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -2,9 +2,12 @@ from __future__ import annotations +from .region import Region as Region from .project import Project as Project +from .region_list_params import RegionListParams as RegionListParams from .project_list_params import ProjectListParams as ProjectListParams from .project_create_params import ProjectCreateParams as ProjectCreateParams from .project_list_response import ProjectListResponse as ProjectListResponse from .project_update_params import ProjectUpdateParams as ProjectUpdateParams +from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams from .project_delete_response import ProjectDeleteResponse as ProjectDeleteResponse diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py new file mode 100644 index 00000000..ffac5082 --- /dev/null +++ b/src/gcore/types/cloud/region.py @@ -0,0 +1,98 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Region", "Coordinates"] + + +class Coordinates(BaseModel): + latitude: float + + longitude: float + + +class Region(BaseModel): + id: int + """Region ID""" + + access_level: Literal["core", "edge"] + """The access level of the region.""" + + ai_service_endpoint_id: Optional[int] = None + """AI service API endpoint ID""" + + available_volume_types: Optional[List[str]] = None + """List of available volume types, 'standard', 'ssd_hiiops', 'cold'].""" + + coordinates: Optional[Coordinates] = None + """Coordinates of the region""" + + country: Optional[str] = None + """Country""" + + created_at: datetime + """Region creation date and time""" + + created_on: datetime + """This field is deprecated. Use `created_at` instead.""" + + ddos_endpoint_id: Optional[int] = None + """DDoS endpoint ID""" + + display_name: str + """Human-readable region name""" + + endpoint_type: Literal["admin", "internal", "public"] + """Endpoint type""" + + external_network_id: Optional[str] = None + """External network ID for Neutron""" + + has_ai: bool + """Region has AI capability""" + + has_ai_gpu: bool + """Region has AI GPU capability""" + + has_baremetal: bool + """Region has bare metal capability""" + + has_basic_vm: bool + """Region has basic vm capability""" + + has_k8s: bool + """Region has managed kubernetes capability""" + + has_kvm: bool + """Region has KVM virtualization capability""" + + has_sfs: bool + """Region has SFS capability""" + + keystone_id: int + """Foreign key to Keystone entity""" + + keystone_name: str + """Technical region name""" + + metrics_database_id: Optional[int] = None + """Foreign key to Metrics database entity""" + + state: Literal["ACTIVE", "DELETED", "DELETING", "DELETION_FAILED", "INACTIVE", "MAINTENANCE", "NEW"] + """Region state""" + + task_id: Optional[str] = None + """This field is deprecated and can be ignored""" + + vlan_physical_network: str + """Physical network name to create vlan networks""" + + zone: Optional[Literal["AMERICAS", "APAC", "EMEA", "RUSSIA_AND_CIS"]] = None + """Geographical zone""" + + has_dbaas: Optional[bool] = None + """Region has DBAAS service""" diff --git a/src/gcore/types/cloud/region_list_params.py b/src/gcore/types/cloud/region_list_params.py new file mode 100644 index 00000000..ac7b106b --- /dev/null +++ b/src/gcore/types/cloud/region_list_params.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["RegionListParams"] + + +class RegionListParams(TypedDict, total=False): + limit: int + """Limit the number of returned regions. + + Falls back to default of 100 if not specified. Limited by max limit value of + 1000 + """ + + offset: int + """Offset value is used to exclude the first set of records from the result""" + + order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] + """Order by field and direction.""" + + product: Literal["containers", "inference"] + """If defined then return only regions that support given product.""" + + show_volume_types: bool + """ + If true, null `available_volume_type` is replaced with a list of available + volume types. + """ diff --git a/src/gcore/types/cloud/region_retrieve_params.py b/src/gcore/types/cloud/region_retrieve_params.py new file mode 100644 index 00000000..6dd33927 --- /dev/null +++ b/src/gcore/types/cloud/region_retrieve_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_extensions import TypedDict + +__all__ = ["RegionRetrieveParams"] + + +class RegionRetrieveParams(TypedDict, total=False): + region_id: int + """Region ID""" + + show_volume_types: bool + """ + If true, null `available_volume_type` is replaced with a list of available + volume types. + """ diff --git a/tests/api_resources/cloud/test_regions.py b/tests/api_resources/cloud/test_regions.py new file mode 100644 index 00000000..04d2cacb --- /dev/null +++ b/tests/api_resources/cloud/test_regions.py @@ -0,0 +1,173 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import Region + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRegions: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: Gcore) -> None: + region = client.cloud.regions.retrieve( + region_id=11, + ) + assert_matches_type(Region, region, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: Gcore) -> None: + region = client.cloud.regions.retrieve( + region_id=11, + show_volume_types=False, + ) + assert_matches_type(Region, region, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Gcore) -> None: + response = client.cloud.regions.with_raw_response.retrieve( + region_id=11, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + region = response.parse() + assert_matches_type(Region, region, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Gcore) -> None: + with client.cloud.regions.with_streaming_response.retrieve( + region_id=11, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + region = response.parse() + assert_matches_type(Region, region, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + region = client.cloud.regions.list() + assert_matches_type(SyncOffsetPage[Region], region, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + region = client.cloud.regions.list( + limit=100, + offset=0, + order_by="created_at.desc", + product="inference", + show_volume_types=False, + ) + assert_matches_type(SyncOffsetPage[Region], region, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.regions.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + region = response.parse() + assert_matches_type(SyncOffsetPage[Region], region, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.regions.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + region = response.parse() + assert_matches_type(SyncOffsetPage[Region], region, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRegions: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncGcore) -> None: + region = await async_client.cloud.regions.retrieve( + region_id=11, + ) + assert_matches_type(Region, region, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncGcore) -> None: + region = await async_client.cloud.regions.retrieve( + region_id=11, + show_volume_types=False, + ) + assert_matches_type(Region, region, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.regions.with_raw_response.retrieve( + region_id=11, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + region = await response.parse() + assert_matches_type(Region, region, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.regions.with_streaming_response.retrieve( + region_id=11, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + region = await response.parse() + assert_matches_type(Region, region, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + region = await async_client.cloud.regions.list() + assert_matches_type(AsyncOffsetPage[Region], region, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + region = await async_client.cloud.regions.list( + limit=100, + offset=0, + order_by="created_at.desc", + product="inference", + show_volume_types=False, + ) + assert_matches_type(AsyncOffsetPage[Region], region, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.regions.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + region = await response.parse() + assert_matches_type(AsyncOffsetPage[Region], region, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.regions.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + region = await response.parse() + assert_matches_type(AsyncOffsetPage[Region], region, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/test_client.py b/tests/test_client.py index afc4ac1c..7d46e3b4 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -368,6 +368,17 @@ def test_project_id_client_params(self) -> None: with client as c2: c2.cloud.projects.retrieve() + def test_region_id_client_params(self) -> None: + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + + with client as c2: + with pytest.raises(ValueError, match="Missing region_id argument;"): + c2.cloud.regions.retrieve() + + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, region_id=0) + with client as c2: + c2.cloud.regions.retrieve() + def test_request_extra_json(self) -> None: request = self.client._build_request( FinalRequestOptions( @@ -1143,6 +1154,17 @@ async def test_project_id_client_params(self) -> None: async with client as c2: await c2.cloud.projects.retrieve() + async def test_region_id_client_params(self) -> None: + client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + + async with client as c2: + with pytest.raises(ValueError, match="Missing region_id argument;"): + await c2.cloud.regions.retrieve() + + client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, region_id=0) + async with client as c2: + await c2.cloud.regions.retrieve() + def test_request_extra_json(self) -> None: request = self.client._build_request( FinalRequestOptions( From abb30f5d48ac522c5f350bd9c8dcec5bc9c16dcf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 10:14:01 +0000 Subject: [PATCH 009/592] feat(api): Config update for algis-dumbris/cloud-quotas --- .stats.yml | 4 +- README.md | 76 +++ api.md | 53 ++ src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 ++ src/gcore/resources/cloud/quotas/__init__.py | 75 +++ .../resources/cloud/quotas/client_quotas.py | 135 +++++ src/gcore/resources/cloud/quotas/global_.py | 163 ++++++ .../resources/cloud/quotas/limits_request.py | 483 ++++++++++++++++++ src/gcore/resources/cloud/quotas/quotas.py | 198 +++++++ src/gcore/resources/cloud/quotas/regional.py | 173 +++++++ src/gcore/types/cloud/quotas/__init__.py | 10 + .../types/cloud/quotas/all_client_quotas.py | 17 + src/gcore/types/cloud/quotas/global_quotas.py | 51 ++ .../types/cloud/quotas/limits_request.py | 205 ++++++++ .../quotas/limits_request_create_params.py | 198 +++++++ .../quotas/limits_request_list_params.py | 22 + .../types/cloud/quotas/regional_quotas.py | 288 +++++++++++ tests/api_resources/cloud/quotas/__init__.py | 1 + .../cloud/quotas/test_client_quotas.py | 72 +++ .../cloud/quotas/test_global_.py | 84 +++ .../cloud/quotas/test_limits_request.py | 450 ++++++++++++++++ .../cloud/quotas/test_regional.py | 90 ++++ tests/test_client.py | 8 +- 24 files changed, 2896 insertions(+), 6 deletions(-) create mode 100644 src/gcore/resources/cloud/quotas/__init__.py create mode 100644 src/gcore/resources/cloud/quotas/client_quotas.py create mode 100644 src/gcore/resources/cloud/quotas/global_.py create mode 100644 src/gcore/resources/cloud/quotas/limits_request.py create mode 100644 src/gcore/resources/cloud/quotas/quotas.py create mode 100644 src/gcore/resources/cloud/quotas/regional.py create mode 100644 src/gcore/types/cloud/quotas/__init__.py create mode 100644 src/gcore/types/cloud/quotas/all_client_quotas.py create mode 100644 src/gcore/types/cloud/quotas/global_quotas.py create mode 100644 src/gcore/types/cloud/quotas/limits_request.py create mode 100644 src/gcore/types/cloud/quotas/limits_request_create_params.py create mode 100644 src/gcore/types/cloud/quotas/limits_request_list_params.py create mode 100644 src/gcore/types/cloud/quotas/regional_quotas.py create mode 100644 tests/api_resources/cloud/quotas/__init__.py create mode 100644 tests/api_resources/cloud/quotas/test_client_quotas.py create mode 100644 tests/api_resources/cloud/quotas/test_global_.py create mode 100644 tests/api_resources/cloud/quotas/test_limits_request.py create mode 100644 tests/api_resources/cloud/quotas/test_regional.py diff --git a/.stats.yml b/.stats.yml index c888fa4f..1f5b3fb0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 7 +configured_endpoints: 14 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3ad4b479c2f5ef082c85b8b6d740987688b8b5a4fded84db682eeb0743b5b185.yml openapi_spec_hash: 82182a92ba1c4c66f5634eb1a0c6ba7b -config_hash: a12d73d67942b05226126ec381161016 +config_hash: ae30d43af40d45e2f3a5a0095c46f840 diff --git a/README.md b/README.md index cdc443cb..3db3c7ad 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,82 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`. +## Nested params + +Nested parameters are dictionaries, typed using `TypedDict`, for example: + +```python +from gcore import Gcore + +client = Gcore() + +client.cloud.quotas.limits_request.create( + description="Scale up mysql cluster", + requested_limits={ + "global_limits": { + "inference_cpu_millicore_count_limit": 0, + "inference_gpu_a100_count_limit": 0, + "inference_gpu_h100_count_limit": 0, + "inference_gpu_l40s_count_limit": 0, + "inference_instance_count_limit": 0, + "keypair_count_limit": 100, + "project_count_limit": 2, + }, + "regional_limits": [ + { + "baremetal_basic_count_limit": 0, + "baremetal_gpu_count_limit": 0, + "baremetal_hf_count_limit": 0, + "baremetal_infrastructure_count_limit": 0, + "baremetal_network_count_limit": 0, + "baremetal_storage_count_limit": 0, + "caas_container_count_limit": 0, + "caas_cpu_count_limit": 0, + "caas_gpu_count_limit": 0, + "caas_ram_size_limit": 0, + "cluster_count_limit": 0, + "cpu_count_limit": 0, + "dbaas_postgres_cluster_count_limit": 0, + "external_ip_count_limit": 0, + "faas_cpu_count_limit": 0, + "faas_function_count_limit": 0, + "faas_namespace_count_limit": 0, + "faas_ram_size_limit": 0, + "firewall_count_limit": 0, + "floating_count_limit": 0, + "gpu_count_limit": 0, + "gpu_virtual_a100_count_limit": 0, + "gpu_virtual_h100_count_limit": 0, + "gpu_virtual_l40s_count_limit": 0, + "image_count_limit": 0, + "image_size_limit": 0, + "ipu_count_limit": 0, + "laas_topic_count_limit": 0, + "loadbalancer_count_limit": 0, + "network_count_limit": 0, + "ram_limit": 0, + "region_id": 1, + "registry_count_limit": 0, + "registry_storage_limit": 0, + "router_count_limit": 0, + "secret_count_limit": 0, + "servergroup_count_limit": 0, + "sfs_count_limit": 0, + "sfs_size_limit": 0, + "shared_vm_count_limit": 0, + "snapshot_schedule_count_limit": 0, + "subnet_count_limit": 0, + "vm_count_limit": 0, + "volume_count_limit": 0, + "volume_size_limit": 0, + "volume_snapshots_count_limit": 0, + "volume_snapshots_size_limit": 0, + } + ], + }, +) +``` + ## Handling errors When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `gcore.APIConnectionError` is raised. diff --git a/api.md b/api.md index a40f2949..55043e24 100644 --- a/api.md +++ b/api.md @@ -16,6 +16,59 @@ Methods: - client.cloud.projects.list(\*\*params) -> ProjectListResponse - client.cloud.projects.delete(\*, project_id) -> ProjectDeleteResponse +## Quotas + +### ClientQuotas + +Types: + +```python +from gcore.types.cloud.quotas import AllClientQuotas, QuotaNotificationThreshold, QuotaThreshold +``` + +Methods: + +- client.cloud.quotas.client_quotas.retrieve() -> AllClientQuotas + +### Global + +Types: + +```python +from gcore.types.cloud.quotas import GlobalQuotas +``` + +Methods: + +- client.cloud.quotas.global*.retrieve(client_id) -> GlobalQuotas + +### Regional + +Types: + +```python +from gcore.types.cloud.quotas import RegionalQuotas +``` + +Methods: + +- client.cloud.quotas.regional.retrieve(\*, client_id, region_id) -> RegionalQuotas + +### LimitsRequest + +Types: + +```python +from gcore.types.cloud.quotas import LimitsRequest, LimitsRequestCreate +``` + +Methods: + +- client.cloud.quotas.limits_request.create(\*\*params) -> None +- client.cloud.quotas.limits_request.retrieve(request_id) -> LimitsRequest +- client.cloud.quotas.limits_request.list(\*\*params) -> None +- client.cloud.quotas.limits_request.delete(request_id) -> None + ## Regions Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 21a9d255..0b449a66 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -8,6 +8,14 @@ CloudResourceWithStreamingResponse, AsyncCloudResourceWithStreamingResponse, ) +from .quotas import ( + QuotasResource, + AsyncQuotasResource, + QuotasResourceWithRawResponse, + AsyncQuotasResourceWithRawResponse, + QuotasResourceWithStreamingResponse, + AsyncQuotasResourceWithStreamingResponse, +) from .regions import ( RegionsResource, AsyncRegionsResource, @@ -32,6 +40,12 @@ "AsyncProjectsResourceWithRawResponse", "ProjectsResourceWithStreamingResponse", "AsyncProjectsResourceWithStreamingResponse", + "QuotasResource", + "AsyncQuotasResource", + "QuotasResourceWithRawResponse", + "AsyncQuotasResourceWithRawResponse", + "QuotasResourceWithStreamingResponse", + "AsyncQuotasResourceWithStreamingResponse", "RegionsResource", "AsyncRegionsResource", "RegionsResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 749a3a49..55f615c6 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -20,6 +20,14 @@ ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource +from .quotas.quotas import ( + QuotasResource, + AsyncQuotasResource, + QuotasResourceWithRawResponse, + AsyncQuotasResourceWithRawResponse, + QuotasResourceWithStreamingResponse, + AsyncQuotasResourceWithStreamingResponse, +) __all__ = ["CloudResource", "AsyncCloudResource"] @@ -29,6 +37,10 @@ class CloudResource(SyncAPIResource): def projects(self) -> ProjectsResource: return ProjectsResource(self._client) + @cached_property + def quotas(self) -> QuotasResource: + return QuotasResource(self._client) + @cached_property def regions(self) -> RegionsResource: return RegionsResource(self._client) @@ -58,6 +70,10 @@ class AsyncCloudResource(AsyncAPIResource): def projects(self) -> AsyncProjectsResource: return AsyncProjectsResource(self._client) + @cached_property + def quotas(self) -> AsyncQuotasResource: + return AsyncQuotasResource(self._client) + @cached_property def regions(self) -> AsyncRegionsResource: return AsyncRegionsResource(self._client) @@ -90,6 +106,10 @@ def __init__(self, cloud: CloudResource) -> None: def projects(self) -> ProjectsResourceWithRawResponse: return ProjectsResourceWithRawResponse(self._cloud.projects) + @cached_property + def quotas(self) -> QuotasResourceWithRawResponse: + return QuotasResourceWithRawResponse(self._cloud.quotas) + @cached_property def regions(self) -> RegionsResourceWithRawResponse: return RegionsResourceWithRawResponse(self._cloud.regions) @@ -103,6 +123,10 @@ def __init__(self, cloud: AsyncCloudResource) -> None: def projects(self) -> AsyncProjectsResourceWithRawResponse: return AsyncProjectsResourceWithRawResponse(self._cloud.projects) + @cached_property + def quotas(self) -> AsyncQuotasResourceWithRawResponse: + return AsyncQuotasResourceWithRawResponse(self._cloud.quotas) + @cached_property def regions(self) -> AsyncRegionsResourceWithRawResponse: return AsyncRegionsResourceWithRawResponse(self._cloud.regions) @@ -116,6 +140,10 @@ def __init__(self, cloud: CloudResource) -> None: def projects(self) -> ProjectsResourceWithStreamingResponse: return ProjectsResourceWithStreamingResponse(self._cloud.projects) + @cached_property + def quotas(self) -> QuotasResourceWithStreamingResponse: + return QuotasResourceWithStreamingResponse(self._cloud.quotas) + @cached_property def regions(self) -> RegionsResourceWithStreamingResponse: return RegionsResourceWithStreamingResponse(self._cloud.regions) @@ -129,6 +157,10 @@ def __init__(self, cloud: AsyncCloudResource) -> None: def projects(self) -> AsyncProjectsResourceWithStreamingResponse: return AsyncProjectsResourceWithStreamingResponse(self._cloud.projects) + @cached_property + def quotas(self) -> AsyncQuotasResourceWithStreamingResponse: + return AsyncQuotasResourceWithStreamingResponse(self._cloud.quotas) + @cached_property def regions(self) -> AsyncRegionsResourceWithStreamingResponse: return AsyncRegionsResourceWithStreamingResponse(self._cloud.regions) diff --git a/src/gcore/resources/cloud/quotas/__init__.py b/src/gcore/resources/cloud/quotas/__init__.py new file mode 100644 index 00000000..d67068b1 --- /dev/null +++ b/src/gcore/resources/cloud/quotas/__init__.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .quotas import ( + QuotasResource, + AsyncQuotasResource, + QuotasResourceWithRawResponse, + AsyncQuotasResourceWithRawResponse, + QuotasResourceWithStreamingResponse, + AsyncQuotasResourceWithStreamingResponse, +) +from .global_ import ( + GlobalResource, + AsyncGlobalResource, + GlobalResourceWithRawResponse, + AsyncGlobalResourceWithRawResponse, + GlobalResourceWithStreamingResponse, + AsyncGlobalResourceWithStreamingResponse, +) +from .regional import ( + RegionalResource, + AsyncRegionalResource, + RegionalResourceWithRawResponse, + AsyncRegionalResourceWithRawResponse, + RegionalResourceWithStreamingResponse, + AsyncRegionalResourceWithStreamingResponse, +) +from .client_quotas import ( + ClientQuotasResource, + AsyncClientQuotasResource, + ClientQuotasResourceWithRawResponse, + AsyncClientQuotasResourceWithRawResponse, + ClientQuotasResourceWithStreamingResponse, + AsyncClientQuotasResourceWithStreamingResponse, +) +from .limits_request import ( + LimitsRequestResource, + AsyncLimitsRequestResource, + LimitsRequestResourceWithRawResponse, + AsyncLimitsRequestResourceWithRawResponse, + LimitsRequestResourceWithStreamingResponse, + AsyncLimitsRequestResourceWithStreamingResponse, +) + +__all__ = [ + "ClientQuotasResource", + "AsyncClientQuotasResource", + "ClientQuotasResourceWithRawResponse", + "AsyncClientQuotasResourceWithRawResponse", + "ClientQuotasResourceWithStreamingResponse", + "AsyncClientQuotasResourceWithStreamingResponse", + "GlobalResource", + "AsyncGlobalResource", + "GlobalResourceWithRawResponse", + "AsyncGlobalResourceWithRawResponse", + "GlobalResourceWithStreamingResponse", + "AsyncGlobalResourceWithStreamingResponse", + "RegionalResource", + "AsyncRegionalResource", + "RegionalResourceWithRawResponse", + "AsyncRegionalResourceWithRawResponse", + "RegionalResourceWithStreamingResponse", + "AsyncRegionalResourceWithStreamingResponse", + "LimitsRequestResource", + "AsyncLimitsRequestResource", + "LimitsRequestResourceWithRawResponse", + "AsyncLimitsRequestResourceWithRawResponse", + "LimitsRequestResourceWithStreamingResponse", + "AsyncLimitsRequestResourceWithStreamingResponse", + "QuotasResource", + "AsyncQuotasResource", + "QuotasResourceWithRawResponse", + "AsyncQuotasResourceWithRawResponse", + "QuotasResourceWithStreamingResponse", + "AsyncQuotasResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/quotas/client_quotas.py b/src/gcore/resources/cloud/quotas/client_quotas.py new file mode 100644 index 00000000..30ff18f0 --- /dev/null +++ b/src/gcore/resources/cloud/quotas/client_quotas.py @@ -0,0 +1,135 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.quotas.all_client_quotas import AllClientQuotas + +__all__ = ["ClientQuotasResource", "AsyncClientQuotasResource"] + + +class ClientQuotasResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ClientQuotasResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return ClientQuotasResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ClientQuotasResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return ClientQuotasResourceWithStreamingResponse(self) + + def retrieve( + 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, + ) -> AllClientQuotas: + """Get combined client quotas, regional and global.""" + return self._get( + "/cloud/v2/client_quotas", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AllClientQuotas, + ) + + +class AsyncClientQuotasResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncClientQuotasResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncClientQuotasResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncClientQuotasResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncClientQuotasResourceWithStreamingResponse(self) + + async def retrieve( + 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, + ) -> AllClientQuotas: + """Get combined client quotas, regional and global.""" + return await self._get( + "/cloud/v2/client_quotas", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AllClientQuotas, + ) + + +class ClientQuotasResourceWithRawResponse: + def __init__(self, client_quotas: ClientQuotasResource) -> None: + self._client_quotas = client_quotas + + self.retrieve = to_raw_response_wrapper( + client_quotas.retrieve, + ) + + +class AsyncClientQuotasResourceWithRawResponse: + def __init__(self, client_quotas: AsyncClientQuotasResource) -> None: + self._client_quotas = client_quotas + + self.retrieve = async_to_raw_response_wrapper( + client_quotas.retrieve, + ) + + +class ClientQuotasResourceWithStreamingResponse: + def __init__(self, client_quotas: ClientQuotasResource) -> None: + self._client_quotas = client_quotas + + self.retrieve = to_streamed_response_wrapper( + client_quotas.retrieve, + ) + + +class AsyncClientQuotasResourceWithStreamingResponse: + def __init__(self, client_quotas: AsyncClientQuotasResource) -> None: + self._client_quotas = client_quotas + + self.retrieve = async_to_streamed_response_wrapper( + client_quotas.retrieve, + ) diff --git a/src/gcore/resources/cloud/quotas/global_.py b/src/gcore/resources/cloud/quotas/global_.py new file mode 100644 index 00000000..e7b8ea27 --- /dev/null +++ b/src/gcore/resources/cloud/quotas/global_.py @@ -0,0 +1,163 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.quotas.global_quotas import GlobalQuotas + +__all__ = ["GlobalResource", "AsyncGlobalResource"] + + +class GlobalResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> GlobalResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return GlobalResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> GlobalResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return GlobalResourceWithStreamingResponse(self) + + def retrieve( + self, + client_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, + ) -> GlobalQuotas: + """ + Get global quota + + Args: + client_id: Client ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cloud/v2/global_quotas/{client_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GlobalQuotas, + ) + + +class AsyncGlobalResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncGlobalResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncGlobalResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncGlobalResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncGlobalResourceWithStreamingResponse(self) + + async def retrieve( + self, + client_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, + ) -> GlobalQuotas: + """ + Get global quota + + Args: + client_id: Client ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cloud/v2/global_quotas/{client_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GlobalQuotas, + ) + + +class GlobalResourceWithRawResponse: + def __init__(self, global_: GlobalResource) -> None: + self._global_ = global_ + + self.retrieve = to_raw_response_wrapper( + global_.retrieve, + ) + + +class AsyncGlobalResourceWithRawResponse: + def __init__(self, global_: AsyncGlobalResource) -> None: + self._global_ = global_ + + self.retrieve = async_to_raw_response_wrapper( + global_.retrieve, + ) + + +class GlobalResourceWithStreamingResponse: + def __init__(self, global_: GlobalResource) -> None: + self._global_ = global_ + + self.retrieve = to_streamed_response_wrapper( + global_.retrieve, + ) + + +class AsyncGlobalResourceWithStreamingResponse: + def __init__(self, global_: AsyncGlobalResource) -> None: + self._global_ = global_ + + self.retrieve = async_to_streamed_response_wrapper( + global_.retrieve, + ) diff --git a/src/gcore/resources/cloud/quotas/limits_request.py b/src/gcore/resources/cloud/quotas/limits_request.py new file mode 100644 index 00000000..9b56ad52 --- /dev/null +++ b/src/gcore/resources/cloud/quotas/limits_request.py @@ -0,0 +1,483 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.quotas import limits_request_list_params, limits_request_create_params +from ....types.cloud.quotas.limits_request import LimitsRequest + +__all__ = ["LimitsRequestResource", "AsyncLimitsRequestResource"] + + +class LimitsRequestResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> LimitsRequestResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return LimitsRequestResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LimitsRequestResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return LimitsRequestResourceWithStreamingResponse(self) + + def create( + self, + *, + description: str, + requested_limits: limits_request_create_params.RequestedLimits, + client_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Create request to change quotas + + Args: + description: Describe the reason, in general terms. + + requested_limits: Limits you want to increase. + + client_id: Client ID that requests the limit increase. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + "/cloud/v2/limits_request", + body=maybe_transform( + { + "description": description, + "requested_limits": requested_limits, + "client_id": client_id, + }, + limits_request_create_params.LimitsRequestCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def retrieve( + self, + request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LimitsRequest: + """ + Get request to change quota limits. + + Args: + request_id: LimitRequest ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + return self._get( + f"/cloud/v2/limits_request/{request_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LimitsRequest, + ) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + status: Optional[List[Literal["done", "in progress", "rejected"]]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Returns a list of sent requests to change current quotas and their statuses + + Args: + limit: Optional. Limit the number of returned items + + offset: Optional. Offset value is used to exclude the first set of records from the + result + + status: List of limit requests statuses for filtering + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._get( + "/cloud/v2/limits_request", + 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, + "status": status, + }, + limits_request_list_params.LimitsRequestListParams, + ), + ), + cast_to=NoneType, + ) + + def delete( + self, + request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete request to change quotas + + Args: + request_id: LimitRequest ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v2/limits_request/{request_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncLimitsRequestResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncLimitsRequestResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncLimitsRequestResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLimitsRequestResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncLimitsRequestResourceWithStreamingResponse(self) + + async def create( + self, + *, + description: str, + requested_limits: limits_request_create_params.RequestedLimits, + client_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Create request to change quotas + + Args: + description: Describe the reason, in general terms. + + requested_limits: Limits you want to increase. + + client_id: Client ID that requests the limit increase. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + "/cloud/v2/limits_request", + body=await async_maybe_transform( + { + "description": description, + "requested_limits": requested_limits, + "client_id": client_id, + }, + limits_request_create_params.LimitsRequestCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def retrieve( + self, + request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LimitsRequest: + """ + Get request to change quota limits. + + Args: + request_id: LimitRequest ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + return await self._get( + f"/cloud/v2/limits_request/{request_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LimitsRequest, + ) + + async def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + status: Optional[List[Literal["done", "in progress", "rejected"]]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Returns a list of sent requests to change current quotas and their statuses + + Args: + limit: Optional. Limit the number of returned items + + offset: Optional. Offset value is used to exclude the first set of records from the + result + + status: List of limit requests statuses for filtering + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._get( + "/cloud/v2/limits_request", + 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, + "status": status, + }, + limits_request_list_params.LimitsRequestListParams, + ), + ), + cast_to=NoneType, + ) + + async def delete( + self, + request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete request to change quotas + + Args: + request_id: LimitRequest ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v2/limits_request/{request_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class LimitsRequestResourceWithRawResponse: + def __init__(self, limits_request: LimitsRequestResource) -> None: + self._limits_request = limits_request + + self.create = to_raw_response_wrapper( + limits_request.create, + ) + self.retrieve = to_raw_response_wrapper( + limits_request.retrieve, + ) + self.list = to_raw_response_wrapper( + limits_request.list, + ) + self.delete = to_raw_response_wrapper( + limits_request.delete, + ) + + +class AsyncLimitsRequestResourceWithRawResponse: + def __init__(self, limits_request: AsyncLimitsRequestResource) -> None: + self._limits_request = limits_request + + self.create = async_to_raw_response_wrapper( + limits_request.create, + ) + self.retrieve = async_to_raw_response_wrapper( + limits_request.retrieve, + ) + self.list = async_to_raw_response_wrapper( + limits_request.list, + ) + self.delete = async_to_raw_response_wrapper( + limits_request.delete, + ) + + +class LimitsRequestResourceWithStreamingResponse: + def __init__(self, limits_request: LimitsRequestResource) -> None: + self._limits_request = limits_request + + self.create = to_streamed_response_wrapper( + limits_request.create, + ) + self.retrieve = to_streamed_response_wrapper( + limits_request.retrieve, + ) + self.list = to_streamed_response_wrapper( + limits_request.list, + ) + self.delete = to_streamed_response_wrapper( + limits_request.delete, + ) + + +class AsyncLimitsRequestResourceWithStreamingResponse: + def __init__(self, limits_request: AsyncLimitsRequestResource) -> None: + self._limits_request = limits_request + + self.create = async_to_streamed_response_wrapper( + limits_request.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + limits_request.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + limits_request.list, + ) + self.delete = async_to_streamed_response_wrapper( + limits_request.delete, + ) diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py new file mode 100644 index 00000000..8b388da9 --- /dev/null +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -0,0 +1,198 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .global_ import ( + GlobalResource, + AsyncGlobalResource, + GlobalResourceWithRawResponse, + AsyncGlobalResourceWithRawResponse, + GlobalResourceWithStreamingResponse, + AsyncGlobalResourceWithStreamingResponse, +) +from .regional import ( + RegionalResource, + AsyncRegionalResource, + RegionalResourceWithRawResponse, + AsyncRegionalResourceWithRawResponse, + RegionalResourceWithStreamingResponse, + AsyncRegionalResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from .client_quotas import ( + ClientQuotasResource, + AsyncClientQuotasResource, + ClientQuotasResourceWithRawResponse, + AsyncClientQuotasResourceWithRawResponse, + ClientQuotasResourceWithStreamingResponse, + AsyncClientQuotasResourceWithStreamingResponse, +) +from .limits_request import ( + LimitsRequestResource, + AsyncLimitsRequestResource, + LimitsRequestResourceWithRawResponse, + AsyncLimitsRequestResourceWithRawResponse, + LimitsRequestResourceWithStreamingResponse, + AsyncLimitsRequestResourceWithStreamingResponse, +) + +__all__ = ["QuotasResource", "AsyncQuotasResource"] + + +class QuotasResource(SyncAPIResource): + @cached_property + def client_quotas(self) -> ClientQuotasResource: + return ClientQuotasResource(self._client) + + @cached_property + def global_(self) -> GlobalResource: + return GlobalResource(self._client) + + @cached_property + def regional(self) -> RegionalResource: + return RegionalResource(self._client) + + @cached_property + def limits_request(self) -> LimitsRequestResource: + return LimitsRequestResource(self._client) + + @cached_property + def with_raw_response(self) -> QuotasResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return QuotasResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> QuotasResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return QuotasResourceWithStreamingResponse(self) + + +class AsyncQuotasResource(AsyncAPIResource): + @cached_property + def client_quotas(self) -> AsyncClientQuotasResource: + return AsyncClientQuotasResource(self._client) + + @cached_property + def global_(self) -> AsyncGlobalResource: + return AsyncGlobalResource(self._client) + + @cached_property + def regional(self) -> AsyncRegionalResource: + return AsyncRegionalResource(self._client) + + @cached_property + def limits_request(self) -> AsyncLimitsRequestResource: + return AsyncLimitsRequestResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncQuotasResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncQuotasResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncQuotasResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncQuotasResourceWithStreamingResponse(self) + + +class QuotasResourceWithRawResponse: + def __init__(self, quotas: QuotasResource) -> None: + self._quotas = quotas + + @cached_property + def client_quotas(self) -> ClientQuotasResourceWithRawResponse: + return ClientQuotasResourceWithRawResponse(self._quotas.client_quotas) + + @cached_property + def global_(self) -> GlobalResourceWithRawResponse: + return GlobalResourceWithRawResponse(self._quotas.global_) + + @cached_property + def regional(self) -> RegionalResourceWithRawResponse: + return RegionalResourceWithRawResponse(self._quotas.regional) + + @cached_property + def limits_request(self) -> LimitsRequestResourceWithRawResponse: + return LimitsRequestResourceWithRawResponse(self._quotas.limits_request) + + +class AsyncQuotasResourceWithRawResponse: + def __init__(self, quotas: AsyncQuotasResource) -> None: + self._quotas = quotas + + @cached_property + def client_quotas(self) -> AsyncClientQuotasResourceWithRawResponse: + return AsyncClientQuotasResourceWithRawResponse(self._quotas.client_quotas) + + @cached_property + def global_(self) -> AsyncGlobalResourceWithRawResponse: + return AsyncGlobalResourceWithRawResponse(self._quotas.global_) + + @cached_property + def regional(self) -> AsyncRegionalResourceWithRawResponse: + return AsyncRegionalResourceWithRawResponse(self._quotas.regional) + + @cached_property + def limits_request(self) -> AsyncLimitsRequestResourceWithRawResponse: + return AsyncLimitsRequestResourceWithRawResponse(self._quotas.limits_request) + + +class QuotasResourceWithStreamingResponse: + def __init__(self, quotas: QuotasResource) -> None: + self._quotas = quotas + + @cached_property + def client_quotas(self) -> ClientQuotasResourceWithStreamingResponse: + return ClientQuotasResourceWithStreamingResponse(self._quotas.client_quotas) + + @cached_property + def global_(self) -> GlobalResourceWithStreamingResponse: + return GlobalResourceWithStreamingResponse(self._quotas.global_) + + @cached_property + def regional(self) -> RegionalResourceWithStreamingResponse: + return RegionalResourceWithStreamingResponse(self._quotas.regional) + + @cached_property + def limits_request(self) -> LimitsRequestResourceWithStreamingResponse: + return LimitsRequestResourceWithStreamingResponse(self._quotas.limits_request) + + +class AsyncQuotasResourceWithStreamingResponse: + def __init__(self, quotas: AsyncQuotasResource) -> None: + self._quotas = quotas + + @cached_property + def client_quotas(self) -> AsyncClientQuotasResourceWithStreamingResponse: + return AsyncClientQuotasResourceWithStreamingResponse(self._quotas.client_quotas) + + @cached_property + def global_(self) -> AsyncGlobalResourceWithStreamingResponse: + return AsyncGlobalResourceWithStreamingResponse(self._quotas.global_) + + @cached_property + def regional(self) -> AsyncRegionalResourceWithStreamingResponse: + return AsyncRegionalResourceWithStreamingResponse(self._quotas.regional) + + @cached_property + def limits_request(self) -> AsyncLimitsRequestResourceWithStreamingResponse: + return AsyncLimitsRequestResourceWithStreamingResponse(self._quotas.limits_request) diff --git a/src/gcore/resources/cloud/quotas/regional.py b/src/gcore/resources/cloud/quotas/regional.py new file mode 100644 index 00000000..4f8a1aa4 --- /dev/null +++ b/src/gcore/resources/cloud/quotas/regional.py @@ -0,0 +1,173 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.quotas.regional_quotas import RegionalQuotas + +__all__ = ["RegionalResource", "AsyncRegionalResource"] + + +class RegionalResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RegionalResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return RegionalResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RegionalResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return RegionalResourceWithStreamingResponse(self) + + def retrieve( + self, + *, + client_id: int, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegionalQuotas: + """ + Get a quota by region + + Args: + client_id: Client ID + + region_id: Region ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get( + f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegionalQuotas, + ) + + +class AsyncRegionalResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRegionalResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRegionalResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRegionalResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncRegionalResourceWithStreamingResponse(self) + + async def retrieve( + self, + *, + client_id: int, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegionalQuotas: + """ + Get a quota by region + + Args: + client_id: Client ID + + region_id: Region ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._get( + f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegionalQuotas, + ) + + +class RegionalResourceWithRawResponse: + def __init__(self, regional: RegionalResource) -> None: + self._regional = regional + + self.retrieve = to_raw_response_wrapper( + regional.retrieve, + ) + + +class AsyncRegionalResourceWithRawResponse: + def __init__(self, regional: AsyncRegionalResource) -> None: + self._regional = regional + + self.retrieve = async_to_raw_response_wrapper( + regional.retrieve, + ) + + +class RegionalResourceWithStreamingResponse: + def __init__(self, regional: RegionalResource) -> None: + self._regional = regional + + self.retrieve = to_streamed_response_wrapper( + regional.retrieve, + ) + + +class AsyncRegionalResourceWithStreamingResponse: + def __init__(self, regional: AsyncRegionalResource) -> None: + self._regional = regional + + self.retrieve = async_to_streamed_response_wrapper( + regional.retrieve, + ) diff --git a/src/gcore/types/cloud/quotas/__init__.py b/src/gcore/types/cloud/quotas/__init__.py new file mode 100644 index 00000000..14a5ee3a --- /dev/null +++ b/src/gcore/types/cloud/quotas/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .global_quotas import GlobalQuotas as GlobalQuotas +from .limits_request import LimitsRequest as LimitsRequest +from .regional_quotas import RegionalQuotas as RegionalQuotas +from .all_client_quotas import AllClientQuotas as AllClientQuotas +from .limits_request_list_params import LimitsRequestListParams as LimitsRequestListParams +from .limits_request_create_params import LimitsRequestCreateParams as LimitsRequestCreateParams diff --git a/src/gcore/types/cloud/quotas/all_client_quotas.py b/src/gcore/types/cloud/quotas/all_client_quotas.py new file mode 100644 index 00000000..e19b1c9a --- /dev/null +++ b/src/gcore/types/cloud/quotas/all_client_quotas.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel +from .global_quotas import GlobalQuotas +from .regional_quotas import RegionalQuotas + +__all__ = ["AllClientQuotas"] + + +class AllClientQuotas(BaseModel): + global_quotas: Optional[GlobalQuotas] = None + """Global entity quotas""" + + regional_quotas: Optional[List[RegionalQuotas]] = None + """Regional entity quotas. Only contains initialized quotas.""" diff --git a/src/gcore/types/cloud/quotas/global_quotas.py b/src/gcore/types/cloud/quotas/global_quotas.py new file mode 100644 index 00000000..b554079e --- /dev/null +++ b/src/gcore/types/cloud/quotas/global_quotas.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["GlobalQuotas"] + + +class GlobalQuotas(BaseModel): + inference_cpu_millicore_count_limit: Optional[int] = None + """Inference CPU millicore count limit""" + + inference_cpu_millicore_count_usage: Optional[int] = None + """Inference CPU millicore count usage""" + + inference_gpu_a100_count_limit: Optional[int] = None + """Inference GPU A100 Count limit""" + + inference_gpu_a100_count_usage: Optional[int] = None + """Inference GPU A100 Count usage""" + + inference_gpu_h100_count_limit: Optional[int] = None + """Inference GPU H100 Count limit""" + + inference_gpu_h100_count_usage: Optional[int] = None + """Inference GPU H100 Count usage""" + + inference_gpu_l40s_count_limit: Optional[int] = None + """Inference GPU L40s Count limit""" + + inference_gpu_l40s_count_usage: Optional[int] = None + """Inference GPU L40s Count usage""" + + inference_instance_count_limit: Optional[int] = None + """Inference instance count limit""" + + inference_instance_count_usage: Optional[int] = None + """Inference instance count usage""" + + keypair_count_limit: Optional[int] = None + """SSH Keys Count limit""" + + keypair_count_usage: Optional[int] = None + """SSH Keys Count usage""" + + project_count_limit: Optional[int] = None + """Projects Count limit""" + + project_count_usage: Optional[int] = None + """Projects Count usage""" diff --git a/src/gcore/types/cloud/quotas/limits_request.py b/src/gcore/types/cloud/quotas/limits_request.py new file mode 100644 index 00000000..5c4e136d --- /dev/null +++ b/src/gcore/types/cloud/quotas/limits_request.py @@ -0,0 +1,205 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["LimitsRequest", "RequestedLimits", "RequestedLimitsGlobalLimits", "RequestedLimitsRegionalLimit"] + + +class RequestedLimitsGlobalLimits(BaseModel): + inference_cpu_millicore_count_limit: Optional[int] = None + """Inference CPU millicore count limit""" + + inference_gpu_a100_count_limit: Optional[int] = None + """Inference GPU A100 Count limit""" + + inference_gpu_h100_count_limit: Optional[int] = None + """Inference GPU H100 Count limit""" + + inference_gpu_l40s_count_limit: Optional[int] = None + """Inference GPU L40s Count limit""" + + inference_instance_count_limit: Optional[int] = None + """Inference instance count limit""" + + keypair_count_limit: Optional[int] = None + """SSH Keys Count limit""" + + project_count_limit: Optional[int] = None + """Projects Count limit""" + + +class RequestedLimitsRegionalLimit(BaseModel): + baremetal_basic_count_limit: Optional[int] = None + """Basic bare metal servers count limit""" + + baremetal_gpu_count_limit: Optional[int] = None + """AI GPU bare metal servers count limit""" + + baremetal_hf_count_limit: Optional[int] = None + """High-frequency bare metal servers count limit""" + + baremetal_infrastructure_count_limit: Optional[int] = None + """Infrastructure bare metal servers count limit""" + + baremetal_network_count_limit: Optional[int] = None + """Bare metal Network Count limit""" + + baremetal_storage_count_limit: Optional[int] = None + """Storage bare metal servers count limit""" + + caas_container_count_limit: Optional[int] = None + """Containers count limit""" + + caas_cpu_count_limit: Optional[int] = None + """mCPU count for containers limit""" + + caas_gpu_count_limit: Optional[int] = None + """Containers gpu count limit""" + + caas_ram_size_limit: Optional[int] = None + """MB memory count for containers limit""" + + cluster_count_limit: Optional[int] = None + """K8s clusters count limit""" + + cpu_count_limit: Optional[int] = None + """vCPU Count limit""" + + dbaas_postgres_cluster_count_limit: Optional[int] = None + """DBaaS cluster count limit""" + + external_ip_count_limit: Optional[int] = None + """External IP Count limit""" + + faas_cpu_count_limit: Optional[int] = None + """mCPU count for functions limit""" + + faas_function_count_limit: Optional[int] = None + """Functions count limit""" + + faas_namespace_count_limit: Optional[int] = None + """Functions namespace count limit""" + + faas_ram_size_limit: Optional[int] = None + """MB memory count for functions limit""" + + firewall_count_limit: Optional[int] = None + """Firewalls Count limit""" + + floating_count_limit: Optional[int] = None + """Floating IP Count limit""" + + gpu_count_limit: Optional[int] = None + """GPU Count limit""" + + gpu_virtual_a100_count_limit: Optional[int] = None + """Virtual A100 GPU card count limit""" + + gpu_virtual_h100_count_limit: Optional[int] = None + """Virtual H100 GPU card count limit""" + + gpu_virtual_l40s_count_limit: Optional[int] = None + """Virtual L40S GPU card count limit""" + + image_count_limit: Optional[int] = None + """Images Count limit""" + + image_size_limit: Optional[int] = None + """Images Size, GiB limit""" + + ipu_count_limit: Optional[int] = None + """IPU Count limit""" + + laas_topic_count_limit: Optional[int] = None + """LaaS Topics Count limit""" + + loadbalancer_count_limit: Optional[int] = None + """Load Balancers Count limit""" + + network_count_limit: Optional[int] = None + """Networks Count limit""" + + ram_limit: Optional[int] = None + """RAM Size, GiB limit""" + + region_id: Optional[int] = None + """Region ID""" + + registry_count_limit: Optional[int] = None + """Registries count limit""" + + registry_storage_limit: Optional[int] = None + """Registries volume usage, GiB limit""" + + router_count_limit: Optional[int] = None + """Routers Count limit""" + + secret_count_limit: Optional[int] = None + """Secret Count limit""" + + servergroup_count_limit: Optional[int] = None + """Placement Group Count limit""" + + sfs_count_limit: Optional[int] = None + """Shared file system Count limit""" + + sfs_size_limit: Optional[int] = None + """Shared file system Size, GiB limit""" + + shared_vm_count_limit: Optional[int] = None + """Basic VMs Count limit""" + + snapshot_schedule_count_limit: Optional[int] = None + """Snapshot Schedules Count limit""" + + subnet_count_limit: Optional[int] = None + """Subnets Count limit""" + + vm_count_limit: Optional[int] = None + """Instances Dedicated Count limit""" + + volume_count_limit: Optional[int] = None + """Volumes Count limit""" + + volume_size_limit: Optional[int] = None + """Volumes Size, GiB limit""" + + volume_snapshots_count_limit: Optional[int] = None + """Snapshots Count limit""" + + volume_snapshots_size_limit: Optional[int] = None + """Snapshots Size, GiB limit""" + + +class RequestedLimits(BaseModel): + global_limits: Optional[RequestedLimitsGlobalLimits] = None + """Global entity quota limits""" + + regional_limits: Optional[List[RequestedLimitsRegionalLimit]] = None + """Regions and their quota limits""" + + +class LimitsRequest(BaseModel): + id: int + """Request ID""" + + client_id: int + """Client ID""" + + requested_limits: RequestedLimits + """Requested limits.""" + + status: str + """Request status""" + + created_at: Optional[datetime] = None + """Datetime when the request was created.""" + + description: Optional[str] = None + """Describe the reason, in general terms.""" + + updated_at: Optional[datetime] = None + """Datetime when the request was updated.""" diff --git a/src/gcore/types/cloud/quotas/limits_request_create_params.py b/src/gcore/types/cloud/quotas/limits_request_create_params.py new file mode 100644 index 00000000..42a65e00 --- /dev/null +++ b/src/gcore/types/cloud/quotas/limits_request_create_params.py @@ -0,0 +1,198 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = [ + "LimitsRequestCreateParams", + "RequestedLimits", + "RequestedLimitsGlobalLimits", + "RequestedLimitsRegionalLimit", +] + + +class LimitsRequestCreateParams(TypedDict, total=False): + description: Required[str] + """Describe the reason, in general terms.""" + + requested_limits: Required[RequestedLimits] + """Limits you want to increase.""" + + client_id: int + """Client ID that requests the limit increase.""" + + +class RequestedLimitsGlobalLimits(TypedDict, total=False): + inference_cpu_millicore_count_limit: int + """Inference CPU millicore count limit""" + + inference_gpu_a100_count_limit: int + """Inference GPU A100 Count limit""" + + inference_gpu_h100_count_limit: int + """Inference GPU H100 Count limit""" + + inference_gpu_l40s_count_limit: int + """Inference GPU L40s Count limit""" + + inference_instance_count_limit: int + """Inference instance count limit""" + + keypair_count_limit: int + """SSH Keys Count limit""" + + project_count_limit: int + """Projects Count limit""" + + +class RequestedLimitsRegionalLimit(TypedDict, total=False): + baremetal_basic_count_limit: int + """Basic bare metal servers count limit""" + + baremetal_gpu_count_limit: int + """AI GPU bare metal servers count limit""" + + baremetal_hf_count_limit: int + """High-frequency bare metal servers count limit""" + + baremetal_infrastructure_count_limit: int + """Infrastructure bare metal servers count limit""" + + baremetal_network_count_limit: int + """Bare metal Network Count limit""" + + baremetal_storage_count_limit: int + """Storage bare metal servers count limit""" + + caas_container_count_limit: int + """Containers count limit""" + + caas_cpu_count_limit: int + """mCPU count for containers limit""" + + caas_gpu_count_limit: int + """Containers gpu count limit""" + + caas_ram_size_limit: int + """MB memory count for containers limit""" + + cluster_count_limit: int + """K8s clusters count limit""" + + cpu_count_limit: int + """vCPU Count limit""" + + dbaas_postgres_cluster_count_limit: int + """DBaaS cluster count limit""" + + external_ip_count_limit: int + """External IP Count limit""" + + faas_cpu_count_limit: int + """mCPU count for functions limit""" + + faas_function_count_limit: int + """Functions count limit""" + + faas_namespace_count_limit: int + """Functions namespace count limit""" + + faas_ram_size_limit: int + """MB memory count for functions limit""" + + firewall_count_limit: int + """Firewalls Count limit""" + + floating_count_limit: int + """Floating IP Count limit""" + + gpu_count_limit: int + """GPU Count limit""" + + gpu_virtual_a100_count_limit: int + """Virtual A100 GPU card count limit""" + + gpu_virtual_h100_count_limit: int + """Virtual H100 GPU card count limit""" + + gpu_virtual_l40s_count_limit: int + """Virtual L40S GPU card count limit""" + + image_count_limit: int + """Images Count limit""" + + image_size_limit: int + """Images Size, GiB limit""" + + ipu_count_limit: int + """IPU Count limit""" + + laas_topic_count_limit: int + """LaaS Topics Count limit""" + + loadbalancer_count_limit: int + """Load Balancers Count limit""" + + network_count_limit: int + """Networks Count limit""" + + ram_limit: int + """RAM Size, GiB limit""" + + region_id: int + """Region ID""" + + registry_count_limit: int + """Registries count limit""" + + registry_storage_limit: int + """Registries volume usage, GiB limit""" + + router_count_limit: int + """Routers Count limit""" + + secret_count_limit: int + """Secret Count limit""" + + servergroup_count_limit: int + """Placement Group Count limit""" + + sfs_count_limit: int + """Shared file system Count limit""" + + sfs_size_limit: int + """Shared file system Size, GiB limit""" + + shared_vm_count_limit: int + """Basic VMs Count limit""" + + snapshot_schedule_count_limit: int + """Snapshot Schedules Count limit""" + + subnet_count_limit: int + """Subnets Count limit""" + + vm_count_limit: int + """Instances Dedicated Count limit""" + + volume_count_limit: int + """Volumes Count limit""" + + volume_size_limit: int + """Volumes Size, GiB limit""" + + volume_snapshots_count_limit: int + """Snapshots Count limit""" + + volume_snapshots_size_limit: int + """Snapshots Size, GiB limit""" + + +class RequestedLimits(TypedDict, total=False): + global_limits: RequestedLimitsGlobalLimits + """Global entity quota limits""" + + regional_limits: Iterable[RequestedLimitsRegionalLimit] + """Regions and their quota limits""" diff --git a/src/gcore/types/cloud/quotas/limits_request_list_params.py b/src/gcore/types/cloud/quotas/limits_request_list_params.py new file mode 100644 index 00000000..0abb9671 --- /dev/null +++ b/src/gcore/types/cloud/quotas/limits_request_list_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["LimitsRequestListParams"] + + +class LimitsRequestListParams(TypedDict, total=False): + limit: int + """Optional. Limit the number of returned items""" + + offset: int + """Optional. + + Offset value is used to exclude the first set of records from the result + """ + + status: Optional[List[Literal["done", "in progress", "rejected"]]] + """List of limit requests statuses for filtering""" diff --git a/src/gcore/types/cloud/quotas/regional_quotas.py b/src/gcore/types/cloud/quotas/regional_quotas.py new file mode 100644 index 00000000..8527db53 --- /dev/null +++ b/src/gcore/types/cloud/quotas/regional_quotas.py @@ -0,0 +1,288 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["RegionalQuotas"] + + +class RegionalQuotas(BaseModel): + baremetal_basic_count_limit: Optional[int] = None + """Basic bare metal servers count limit""" + + baremetal_basic_count_usage: Optional[int] = None + """Basic bare metal servers count usage""" + + baremetal_gpu_count_limit: Optional[int] = None + """AI GPU bare metal servers count limit""" + + baremetal_gpu_count_usage: Optional[int] = None + """AI GPU bare metal servers count usage""" + + baremetal_hf_count_limit: Optional[int] = None + """High-frequency bare metal servers count limit""" + + baremetal_hf_count_usage: Optional[int] = None + """High-frequency bare metal servers count usage""" + + baremetal_infrastructure_count_limit: Optional[int] = None + """Infrastructure bare metal servers count limit""" + + baremetal_infrastructure_count_usage: Optional[int] = None + """Infrastructure bare metal servers count usage""" + + baremetal_network_count_limit: Optional[int] = None + """Bare metal Network Count limit""" + + baremetal_network_count_usage: Optional[int] = None + """Bare metal Network Count usage""" + + baremetal_storage_count_limit: Optional[int] = None + """Storage bare metal servers count limit""" + + baremetal_storage_count_usage: Optional[int] = None + """Storage bare metal servers count usage""" + + caas_container_count_limit: Optional[int] = None + """Containers count limit""" + + caas_container_count_usage: Optional[int] = None + """Containers count usage""" + + caas_cpu_count_limit: Optional[int] = None + """mCPU count for containers limit""" + + caas_cpu_count_usage: Optional[int] = None + """mCPU count for containers usage""" + + caas_gpu_count_limit: Optional[int] = None + """Containers gpu count limit""" + + caas_gpu_count_usage: Optional[int] = None + """Containers gpu count usage""" + + caas_ram_size_limit: Optional[int] = None + """MB memory count for containers limit""" + + caas_ram_size_usage: Optional[int] = None + """MB memory count for containers usage""" + + cluster_count_limit: Optional[int] = None + """K8s clusters count limit""" + + cluster_count_usage: Optional[int] = None + """K8s clusters count usage""" + + cpu_count_limit: Optional[int] = None + """vCPU Count limit""" + + cpu_count_usage: Optional[int] = None + """vCPU Count usage""" + + dbaas_postgres_cluster_count_limit: Optional[int] = None + """DBaaS cluster count limit""" + + dbaas_postgres_cluster_count_usage: Optional[int] = None + """DBaaS cluster count usage""" + + external_ip_count_limit: Optional[int] = None + """External IP Count limit""" + + external_ip_count_usage: Optional[int] = None + """External IP Count usage""" + + faas_cpu_count_limit: Optional[int] = None + """mCPU count for functions limit""" + + faas_cpu_count_usage: Optional[int] = None + """mCPU count for functions usage""" + + faas_function_count_limit: Optional[int] = None + """Functions count limit""" + + faas_function_count_usage: Optional[int] = None + """Functions count usage""" + + faas_namespace_count_limit: Optional[int] = None + """Functions namespace count limit""" + + faas_namespace_count_usage: Optional[int] = None + """Functions namespace count usage""" + + faas_ram_size_limit: Optional[int] = None + """MB memory count for functions limit""" + + faas_ram_size_usage: Optional[int] = None + """MB memory count for functions usage""" + + firewall_count_limit: Optional[int] = None + """Firewalls Count limit""" + + firewall_count_usage: Optional[int] = None + """Firewalls Count usage""" + + floating_count_limit: Optional[int] = None + """Floating IP Count limit""" + + floating_count_usage: Optional[int] = None + """Floating IP Count usage""" + + gpu_count_limit: Optional[int] = None + """GPU Count limit""" + + gpu_count_usage: Optional[int] = None + """GPU Count usage""" + + gpu_virtual_a100_count_limit: Optional[int] = None + """Virtual A100 GPU card count limit""" + + gpu_virtual_a100_count_usage: Optional[int] = None + """Virtual A100 GPU card count usage""" + + gpu_virtual_h100_count_limit: Optional[int] = None + """Virtual H100 GPU card count limit""" + + gpu_virtual_h100_count_usage: Optional[int] = None + """Virtual H100 GPU card count usage""" + + gpu_virtual_l40s_count_limit: Optional[int] = None + """Virtual L40S GPU card count limit""" + + gpu_virtual_l40s_count_usage: Optional[int] = None + """Virtual L40S GPU card count usage""" + + image_count_limit: Optional[int] = None + """Images Count limit""" + + image_count_usage: Optional[int] = None + """Images Count usage""" + + image_size_limit: Optional[int] = None + """Images Size, GiB limit""" + + image_size_usage: Optional[int] = None + """Images Size, GiB usage""" + + ipu_count_limit: Optional[int] = None + """IPU Count limit""" + + ipu_count_usage: Optional[int] = None + """IPU Count usage""" + + laas_topic_count_limit: Optional[int] = None + """LaaS Topics Count limit""" + + laas_topic_count_usage: Optional[int] = None + """LaaS Topics Count usage""" + + loadbalancer_count_limit: Optional[int] = None + """Load Balancers Count limit""" + + loadbalancer_count_usage: Optional[int] = None + """Load Balancers Count usage""" + + network_count_limit: Optional[int] = None + """Networks Count limit""" + + network_count_usage: Optional[int] = None + """Networks Count usage""" + + ram_limit: Optional[int] = None + """RAM Size, GiB limit""" + + ram_usage: Optional[int] = None + """RAM Size, GiB usage""" + + region_id: Optional[int] = None + """Region ID""" + + registry_count_limit: Optional[int] = None + """Registries count limit""" + + registry_count_usage: Optional[int] = None + """Registries count usage""" + + registry_storage_limit: Optional[int] = None + """Registries volume usage, GiB limit""" + + registry_storage_usage: Optional[int] = None + """Registries volume usage, GiB usage""" + + router_count_limit: Optional[int] = None + """Routers Count limit""" + + router_count_usage: Optional[int] = None + """Routers Count usage""" + + secret_count_limit: Optional[int] = None + """Secret Count limit""" + + secret_count_usage: Optional[int] = None + """Secret Count usage""" + + servergroup_count_limit: Optional[int] = None + """Placement Group Count limit""" + + servergroup_count_usage: Optional[int] = None + """Placement Group Count usage""" + + sfs_count_limit: Optional[int] = None + """Shared file system Count limit""" + + sfs_count_usage: Optional[int] = None + """Shared file system Count usage""" + + sfs_size_limit: Optional[int] = None + """Shared file system Size, GiB limit""" + + sfs_size_usage: Optional[int] = None + """Shared file system Size, GiB usage""" + + shared_vm_count_limit: Optional[int] = None + """Basic VMs Count limit""" + + shared_vm_count_usage: Optional[int] = None + """Basic VMs Count usage""" + + snapshot_schedule_count_limit: Optional[int] = None + """Snapshot Schedules Count limit""" + + snapshot_schedule_count_usage: Optional[int] = None + """Snapshot Schedules Count usage""" + + subnet_count_limit: Optional[int] = None + """Subnets Count limit""" + + subnet_count_usage: Optional[int] = None + """Subnets Count usage""" + + vm_count_limit: Optional[int] = None + """Instances Dedicated Count limit""" + + vm_count_usage: Optional[int] = None + """Instances Dedicated Count usage""" + + volume_count_limit: Optional[int] = None + """Volumes Count limit""" + + volume_count_usage: Optional[int] = None + """Volumes Count usage""" + + volume_size_limit: Optional[int] = None + """Volumes Size, GiB limit""" + + volume_size_usage: Optional[int] = None + """Volumes Size, GiB usage""" + + volume_snapshots_count_limit: Optional[int] = None + """Snapshots Count limit""" + + volume_snapshots_count_usage: Optional[int] = None + """Snapshots Count usage""" + + volume_snapshots_size_limit: Optional[int] = None + """Snapshots Size, GiB limit""" + + volume_snapshots_size_usage: Optional[int] = None + """Snapshots Size, GiB usage""" diff --git a/tests/api_resources/cloud/quotas/__init__.py b/tests/api_resources/cloud/quotas/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/quotas/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/quotas/test_client_quotas.py b/tests/api_resources/cloud/quotas/test_client_quotas.py new file mode 100644 index 00000000..7fb6e9d4 --- /dev/null +++ b/tests/api_resources/cloud/quotas/test_client_quotas.py @@ -0,0 +1,72 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.quotas import AllClientQuotas + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestClientQuotas: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: Gcore) -> None: + client_quota = client.cloud.quotas.client_quotas.retrieve() + assert_matches_type(AllClientQuotas, client_quota, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Gcore) -> None: + response = client.cloud.quotas.client_quotas.with_raw_response.retrieve() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client_quota = response.parse() + assert_matches_type(AllClientQuotas, client_quota, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Gcore) -> None: + with client.cloud.quotas.client_quotas.with_streaming_response.retrieve() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client_quota = response.parse() + assert_matches_type(AllClientQuotas, client_quota, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncClientQuotas: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncGcore) -> None: + client_quota = await async_client.cloud.quotas.client_quotas.retrieve() + assert_matches_type(AllClientQuotas, client_quota, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.client_quotas.with_raw_response.retrieve() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client_quota = await response.parse() + assert_matches_type(AllClientQuotas, client_quota, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.client_quotas.with_streaming_response.retrieve() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client_quota = await response.parse() + assert_matches_type(AllClientQuotas, client_quota, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/quotas/test_global_.py b/tests/api_resources/cloud/quotas/test_global_.py new file mode 100644 index 00000000..be88934d --- /dev/null +++ b/tests/api_resources/cloud/quotas/test_global_.py @@ -0,0 +1,84 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.quotas import GlobalQuotas + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestGlobal: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: Gcore) -> None: + global_ = client.cloud.quotas.global_.retrieve( + 3, + ) + assert_matches_type(GlobalQuotas, global_, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Gcore) -> None: + response = client.cloud.quotas.global_.with_raw_response.retrieve( + 3, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + global_ = response.parse() + assert_matches_type(GlobalQuotas, global_, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Gcore) -> None: + with client.cloud.quotas.global_.with_streaming_response.retrieve( + 3, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + global_ = response.parse() + assert_matches_type(GlobalQuotas, global_, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncGlobal: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncGcore) -> None: + global_ = await async_client.cloud.quotas.global_.retrieve( + 3, + ) + assert_matches_type(GlobalQuotas, global_, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.global_.with_raw_response.retrieve( + 3, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + global_ = await response.parse() + assert_matches_type(GlobalQuotas, global_, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.global_.with_streaming_response.retrieve( + 3, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + global_ = await response.parse() + assert_matches_type(GlobalQuotas, global_, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/quotas/test_limits_request.py b/tests/api_resources/cloud/quotas/test_limits_request.py new file mode 100644 index 00000000..45d438ed --- /dev/null +++ b/tests/api_resources/cloud/quotas/test_limits_request.py @@ -0,0 +1,450 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.quotas import LimitsRequest + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLimitsRequest: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + limits_request = client.cloud.quotas.limits_request.create( + description="Scale up mysql cluster", + requested_limits={}, + ) + assert limits_request is None + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + limits_request = client.cloud.quotas.limits_request.create( + description="Scale up mysql cluster", + requested_limits={ + "global_limits": { + "inference_cpu_millicore_count_limit": 0, + "inference_gpu_a100_count_limit": 0, + "inference_gpu_h100_count_limit": 0, + "inference_gpu_l40s_count_limit": 0, + "inference_instance_count_limit": 0, + "keypair_count_limit": 100, + "project_count_limit": 2, + }, + "regional_limits": [ + { + "baremetal_basic_count_limit": 0, + "baremetal_gpu_count_limit": 0, + "baremetal_hf_count_limit": 0, + "baremetal_infrastructure_count_limit": 0, + "baremetal_network_count_limit": 0, + "baremetal_storage_count_limit": 0, + "caas_container_count_limit": 0, + "caas_cpu_count_limit": 0, + "caas_gpu_count_limit": 0, + "caas_ram_size_limit": 0, + "cluster_count_limit": 0, + "cpu_count_limit": 0, + "dbaas_postgres_cluster_count_limit": 0, + "external_ip_count_limit": 0, + "faas_cpu_count_limit": 0, + "faas_function_count_limit": 0, + "faas_namespace_count_limit": 0, + "faas_ram_size_limit": 0, + "firewall_count_limit": 0, + "floating_count_limit": 0, + "gpu_count_limit": 0, + "gpu_virtual_a100_count_limit": 0, + "gpu_virtual_h100_count_limit": 0, + "gpu_virtual_l40s_count_limit": 0, + "image_count_limit": 0, + "image_size_limit": 0, + "ipu_count_limit": 0, + "laas_topic_count_limit": 0, + "loadbalancer_count_limit": 0, + "network_count_limit": 0, + "ram_limit": 0, + "region_id": 1, + "registry_count_limit": 0, + "registry_storage_limit": 0, + "router_count_limit": 0, + "secret_count_limit": 0, + "servergroup_count_limit": 0, + "sfs_count_limit": 0, + "sfs_size_limit": 0, + "shared_vm_count_limit": 0, + "snapshot_schedule_count_limit": 0, + "subnet_count_limit": 0, + "vm_count_limit": 0, + "volume_count_limit": 0, + "volume_size_limit": 0, + "volume_snapshots_count_limit": 0, + "volume_snapshots_size_limit": 0, + } + ], + }, + client_id=1, + ) + assert limits_request is None + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.quotas.limits_request.with_raw_response.create( + description="Scale up mysql cluster", + requested_limits={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + limits_request = response.parse() + assert limits_request is None + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.quotas.limits_request.with_streaming_response.create( + description="Scale up mysql cluster", + requested_limits={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + limits_request = response.parse() + assert limits_request is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Gcore) -> None: + limits_request = client.cloud.quotas.limits_request.retrieve( + "request_id", + ) + assert_matches_type(LimitsRequest, limits_request, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Gcore) -> None: + response = client.cloud.quotas.limits_request.with_raw_response.retrieve( + "request_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + limits_request = response.parse() + assert_matches_type(LimitsRequest, limits_request, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Gcore) -> None: + with client.cloud.quotas.limits_request.with_streaming_response.retrieve( + "request_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + limits_request = response.parse() + assert_matches_type(LimitsRequest, limits_request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + client.cloud.quotas.limits_request.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + limits_request = client.cloud.quotas.limits_request.list() + assert limits_request is None + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + limits_request = client.cloud.quotas.limits_request.list( + limit=1000, + offset=0, + status=["done", "in progress"], + ) + assert limits_request is None + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.quotas.limits_request.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + limits_request = response.parse() + assert limits_request is None + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.quotas.limits_request.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + limits_request = response.parse() + assert limits_request is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + limits_request = client.cloud.quotas.limits_request.delete( + "request_id", + ) + assert limits_request is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.quotas.limits_request.with_raw_response.delete( + "request_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + limits_request = response.parse() + assert limits_request is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.quotas.limits_request.with_streaming_response.delete( + "request_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + limits_request = response.parse() + assert limits_request is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + client.cloud.quotas.limits_request.with_raw_response.delete( + "", + ) + + +class TestAsyncLimitsRequest: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + limits_request = await async_client.cloud.quotas.limits_request.create( + description="Scale up mysql cluster", + requested_limits={}, + ) + assert limits_request is None + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + limits_request = await async_client.cloud.quotas.limits_request.create( + description="Scale up mysql cluster", + requested_limits={ + "global_limits": { + "inference_cpu_millicore_count_limit": 0, + "inference_gpu_a100_count_limit": 0, + "inference_gpu_h100_count_limit": 0, + "inference_gpu_l40s_count_limit": 0, + "inference_instance_count_limit": 0, + "keypair_count_limit": 100, + "project_count_limit": 2, + }, + "regional_limits": [ + { + "baremetal_basic_count_limit": 0, + "baremetal_gpu_count_limit": 0, + "baremetal_hf_count_limit": 0, + "baremetal_infrastructure_count_limit": 0, + "baremetal_network_count_limit": 0, + "baremetal_storage_count_limit": 0, + "caas_container_count_limit": 0, + "caas_cpu_count_limit": 0, + "caas_gpu_count_limit": 0, + "caas_ram_size_limit": 0, + "cluster_count_limit": 0, + "cpu_count_limit": 0, + "dbaas_postgres_cluster_count_limit": 0, + "external_ip_count_limit": 0, + "faas_cpu_count_limit": 0, + "faas_function_count_limit": 0, + "faas_namespace_count_limit": 0, + "faas_ram_size_limit": 0, + "firewall_count_limit": 0, + "floating_count_limit": 0, + "gpu_count_limit": 0, + "gpu_virtual_a100_count_limit": 0, + "gpu_virtual_h100_count_limit": 0, + "gpu_virtual_l40s_count_limit": 0, + "image_count_limit": 0, + "image_size_limit": 0, + "ipu_count_limit": 0, + "laas_topic_count_limit": 0, + "loadbalancer_count_limit": 0, + "network_count_limit": 0, + "ram_limit": 0, + "region_id": 1, + "registry_count_limit": 0, + "registry_storage_limit": 0, + "router_count_limit": 0, + "secret_count_limit": 0, + "servergroup_count_limit": 0, + "sfs_count_limit": 0, + "sfs_size_limit": 0, + "shared_vm_count_limit": 0, + "snapshot_schedule_count_limit": 0, + "subnet_count_limit": 0, + "vm_count_limit": 0, + "volume_count_limit": 0, + "volume_size_limit": 0, + "volume_snapshots_count_limit": 0, + "volume_snapshots_size_limit": 0, + } + ], + }, + client_id=1, + ) + assert limits_request is None + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.limits_request.with_raw_response.create( + description="Scale up mysql cluster", + requested_limits={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + limits_request = await response.parse() + assert limits_request is None + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.limits_request.with_streaming_response.create( + description="Scale up mysql cluster", + requested_limits={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + limits_request = await response.parse() + assert limits_request is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncGcore) -> None: + limits_request = await async_client.cloud.quotas.limits_request.retrieve( + "request_id", + ) + assert_matches_type(LimitsRequest, limits_request, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.limits_request.with_raw_response.retrieve( + "request_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + limits_request = await response.parse() + assert_matches_type(LimitsRequest, limits_request, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.limits_request.with_streaming_response.retrieve( + "request_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + limits_request = await response.parse() + assert_matches_type(LimitsRequest, limits_request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + await async_client.cloud.quotas.limits_request.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + limits_request = await async_client.cloud.quotas.limits_request.list() + assert limits_request is None + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + limits_request = await async_client.cloud.quotas.limits_request.list( + limit=1000, + offset=0, + status=["done", "in progress"], + ) + assert limits_request is None + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.limits_request.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + limits_request = await response.parse() + assert limits_request is None + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.limits_request.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + limits_request = await response.parse() + assert limits_request is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + limits_request = await async_client.cloud.quotas.limits_request.delete( + "request_id", + ) + assert limits_request is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.limits_request.with_raw_response.delete( + "request_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + limits_request = await response.parse() + assert limits_request is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.limits_request.with_streaming_response.delete( + "request_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + limits_request = await response.parse() + assert limits_request is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + await async_client.cloud.quotas.limits_request.with_raw_response.delete( + "", + ) diff --git a/tests/api_resources/cloud/quotas/test_regional.py b/tests/api_resources/cloud/quotas/test_regional.py new file mode 100644 index 00000000..c4467845 --- /dev/null +++ b/tests/api_resources/cloud/quotas/test_regional.py @@ -0,0 +1,90 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.quotas import RegionalQuotas + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRegional: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: Gcore) -> None: + regional = client.cloud.quotas.regional.retrieve( + client_id=3, + region_id=1, + ) + assert_matches_type(RegionalQuotas, regional, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Gcore) -> None: + response = client.cloud.quotas.regional.with_raw_response.retrieve( + client_id=3, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + regional = response.parse() + assert_matches_type(RegionalQuotas, regional, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Gcore) -> None: + with client.cloud.quotas.regional.with_streaming_response.retrieve( + client_id=3, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + regional = response.parse() + assert_matches_type(RegionalQuotas, regional, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRegional: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncGcore) -> None: + regional = await async_client.cloud.quotas.regional.retrieve( + client_id=3, + region_id=1, + ) + assert_matches_type(RegionalQuotas, regional, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.regional.with_raw_response.retrieve( + client_id=3, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + regional = await response.parse() + assert_matches_type(RegionalQuotas, regional, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.regional.with_streaming_response.retrieve( + client_id=3, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + regional = await response.parse() + assert_matches_type(RegionalQuotas, regional, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/test_client.py b/tests/test_client.py index 7d46e3b4..3486ea61 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -373,11 +373,11 @@ def test_region_id_client_params(self) -> None: with client as c2: with pytest.raises(ValueError, match="Missing region_id argument;"): - c2.cloud.regions.retrieve() + c2.cloud.quotas.regional.retrieve(client_id=3) client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, region_id=0) with client as c2: - c2.cloud.regions.retrieve() + c2.cloud.quotas.regional.retrieve(client_id=3) def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1159,11 +1159,11 @@ async def test_region_id_client_params(self) -> None: async with client as c2: with pytest.raises(ValueError, match="Missing region_id argument;"): - await c2.cloud.regions.retrieve() + await c2.cloud.quotas.regional.retrieve(client_id=3) client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, region_id=0) async with client as c2: - await c2.cloud.regions.retrieve() + await c2.cloud.quotas.regional.retrieve(client_id=3) def test_request_extra_json(self) -> None: request = self.client._build_request( From d6b4f4af93906e43f44224fe78c1a35b517d203f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 10:33:07 +0000 Subject: [PATCH 010/592] feat(api): remove quotas --- .stats.yml | 4 +- README.md | 76 --- api.md | 53 -- src/gcore/resources/cloud/__init__.py | 14 - src/gcore/resources/cloud/cloud.py | 32 -- src/gcore/resources/cloud/quotas/__init__.py | 75 --- .../resources/cloud/quotas/client_quotas.py | 135 ----- src/gcore/resources/cloud/quotas/global_.py | 163 ------ .../resources/cloud/quotas/limits_request.py | 483 ------------------ src/gcore/resources/cloud/quotas/quotas.py | 198 ------- src/gcore/resources/cloud/quotas/regional.py | 173 ------- src/gcore/types/cloud/quotas/__init__.py | 10 - .../types/cloud/quotas/all_client_quotas.py | 17 - src/gcore/types/cloud/quotas/global_quotas.py | 51 -- .../types/cloud/quotas/limits_request.py | 205 -------- .../quotas/limits_request_create_params.py | 198 ------- .../quotas/limits_request_list_params.py | 22 - .../types/cloud/quotas/regional_quotas.py | 288 ----------- tests/api_resources/cloud/quotas/__init__.py | 1 - .../cloud/quotas/test_client_quotas.py | 72 --- .../cloud/quotas/test_global_.py | 84 --- .../cloud/quotas/test_limits_request.py | 450 ---------------- .../cloud/quotas/test_regional.py | 90 ---- tests/test_client.py | 8 +- 24 files changed, 6 insertions(+), 2896 deletions(-) delete mode 100644 src/gcore/resources/cloud/quotas/__init__.py delete mode 100644 src/gcore/resources/cloud/quotas/client_quotas.py delete mode 100644 src/gcore/resources/cloud/quotas/global_.py delete mode 100644 src/gcore/resources/cloud/quotas/limits_request.py delete mode 100644 src/gcore/resources/cloud/quotas/quotas.py delete mode 100644 src/gcore/resources/cloud/quotas/regional.py delete mode 100644 src/gcore/types/cloud/quotas/__init__.py delete mode 100644 src/gcore/types/cloud/quotas/all_client_quotas.py delete mode 100644 src/gcore/types/cloud/quotas/global_quotas.py delete mode 100644 src/gcore/types/cloud/quotas/limits_request.py delete mode 100644 src/gcore/types/cloud/quotas/limits_request_create_params.py delete mode 100644 src/gcore/types/cloud/quotas/limits_request_list_params.py delete mode 100644 src/gcore/types/cloud/quotas/regional_quotas.py delete mode 100644 tests/api_resources/cloud/quotas/__init__.py delete mode 100644 tests/api_resources/cloud/quotas/test_client_quotas.py delete mode 100644 tests/api_resources/cloud/quotas/test_global_.py delete mode 100644 tests/api_resources/cloud/quotas/test_limits_request.py delete mode 100644 tests/api_resources/cloud/quotas/test_regional.py diff --git a/.stats.yml b/.stats.yml index 1f5b3fb0..c888fa4f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 14 +configured_endpoints: 7 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3ad4b479c2f5ef082c85b8b6d740987688b8b5a4fded84db682eeb0743b5b185.yml openapi_spec_hash: 82182a92ba1c4c66f5634eb1a0c6ba7b -config_hash: ae30d43af40d45e2f3a5a0095c46f840 +config_hash: a12d73d67942b05226126ec381161016 diff --git a/README.md b/README.md index 3db3c7ad..cdc443cb 100644 --- a/README.md +++ b/README.md @@ -80,82 +80,6 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`. -## Nested params - -Nested parameters are dictionaries, typed using `TypedDict`, for example: - -```python -from gcore import Gcore - -client = Gcore() - -client.cloud.quotas.limits_request.create( - description="Scale up mysql cluster", - requested_limits={ - "global_limits": { - "inference_cpu_millicore_count_limit": 0, - "inference_gpu_a100_count_limit": 0, - "inference_gpu_h100_count_limit": 0, - "inference_gpu_l40s_count_limit": 0, - "inference_instance_count_limit": 0, - "keypair_count_limit": 100, - "project_count_limit": 2, - }, - "regional_limits": [ - { - "baremetal_basic_count_limit": 0, - "baremetal_gpu_count_limit": 0, - "baremetal_hf_count_limit": 0, - "baremetal_infrastructure_count_limit": 0, - "baremetal_network_count_limit": 0, - "baremetal_storage_count_limit": 0, - "caas_container_count_limit": 0, - "caas_cpu_count_limit": 0, - "caas_gpu_count_limit": 0, - "caas_ram_size_limit": 0, - "cluster_count_limit": 0, - "cpu_count_limit": 0, - "dbaas_postgres_cluster_count_limit": 0, - "external_ip_count_limit": 0, - "faas_cpu_count_limit": 0, - "faas_function_count_limit": 0, - "faas_namespace_count_limit": 0, - "faas_ram_size_limit": 0, - "firewall_count_limit": 0, - "floating_count_limit": 0, - "gpu_count_limit": 0, - "gpu_virtual_a100_count_limit": 0, - "gpu_virtual_h100_count_limit": 0, - "gpu_virtual_l40s_count_limit": 0, - "image_count_limit": 0, - "image_size_limit": 0, - "ipu_count_limit": 0, - "laas_topic_count_limit": 0, - "loadbalancer_count_limit": 0, - "network_count_limit": 0, - "ram_limit": 0, - "region_id": 1, - "registry_count_limit": 0, - "registry_storage_limit": 0, - "router_count_limit": 0, - "secret_count_limit": 0, - "servergroup_count_limit": 0, - "sfs_count_limit": 0, - "sfs_size_limit": 0, - "shared_vm_count_limit": 0, - "snapshot_schedule_count_limit": 0, - "subnet_count_limit": 0, - "vm_count_limit": 0, - "volume_count_limit": 0, - "volume_size_limit": 0, - "volume_snapshots_count_limit": 0, - "volume_snapshots_size_limit": 0, - } - ], - }, -) -``` - ## Handling errors When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `gcore.APIConnectionError` is raised. diff --git a/api.md b/api.md index 55043e24..a40f2949 100644 --- a/api.md +++ b/api.md @@ -16,59 +16,6 @@ Methods: - client.cloud.projects.list(\*\*params) -> ProjectListResponse - client.cloud.projects.delete(\*, project_id) -> ProjectDeleteResponse -## Quotas - -### ClientQuotas - -Types: - -```python -from gcore.types.cloud.quotas import AllClientQuotas, QuotaNotificationThreshold, QuotaThreshold -``` - -Methods: - -- client.cloud.quotas.client_quotas.retrieve() -> AllClientQuotas - -### Global - -Types: - -```python -from gcore.types.cloud.quotas import GlobalQuotas -``` - -Methods: - -- client.cloud.quotas.global*.retrieve(client_id) -> GlobalQuotas - -### Regional - -Types: - -```python -from gcore.types.cloud.quotas import RegionalQuotas -``` - -Methods: - -- client.cloud.quotas.regional.retrieve(\*, client_id, region_id) -> RegionalQuotas - -### LimitsRequest - -Types: - -```python -from gcore.types.cloud.quotas import LimitsRequest, LimitsRequestCreate -``` - -Methods: - -- client.cloud.quotas.limits_request.create(\*\*params) -> None -- client.cloud.quotas.limits_request.retrieve(request_id) -> LimitsRequest -- client.cloud.quotas.limits_request.list(\*\*params) -> None -- client.cloud.quotas.limits_request.delete(request_id) -> None - ## Regions Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 0b449a66..21a9d255 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -8,14 +8,6 @@ CloudResourceWithStreamingResponse, AsyncCloudResourceWithStreamingResponse, ) -from .quotas import ( - QuotasResource, - AsyncQuotasResource, - QuotasResourceWithRawResponse, - AsyncQuotasResourceWithRawResponse, - QuotasResourceWithStreamingResponse, - AsyncQuotasResourceWithStreamingResponse, -) from .regions import ( RegionsResource, AsyncRegionsResource, @@ -40,12 +32,6 @@ "AsyncProjectsResourceWithRawResponse", "ProjectsResourceWithStreamingResponse", "AsyncProjectsResourceWithStreamingResponse", - "QuotasResource", - "AsyncQuotasResource", - "QuotasResourceWithRawResponse", - "AsyncQuotasResourceWithRawResponse", - "QuotasResourceWithStreamingResponse", - "AsyncQuotasResourceWithStreamingResponse", "RegionsResource", "AsyncRegionsResource", "RegionsResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 55f615c6..749a3a49 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -20,14 +20,6 @@ ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from .quotas.quotas import ( - QuotasResource, - AsyncQuotasResource, - QuotasResourceWithRawResponse, - AsyncQuotasResourceWithRawResponse, - QuotasResourceWithStreamingResponse, - AsyncQuotasResourceWithStreamingResponse, -) __all__ = ["CloudResource", "AsyncCloudResource"] @@ -37,10 +29,6 @@ class CloudResource(SyncAPIResource): def projects(self) -> ProjectsResource: return ProjectsResource(self._client) - @cached_property - def quotas(self) -> QuotasResource: - return QuotasResource(self._client) - @cached_property def regions(self) -> RegionsResource: return RegionsResource(self._client) @@ -70,10 +58,6 @@ class AsyncCloudResource(AsyncAPIResource): def projects(self) -> AsyncProjectsResource: return AsyncProjectsResource(self._client) - @cached_property - def quotas(self) -> AsyncQuotasResource: - return AsyncQuotasResource(self._client) - @cached_property def regions(self) -> AsyncRegionsResource: return AsyncRegionsResource(self._client) @@ -106,10 +90,6 @@ def __init__(self, cloud: CloudResource) -> None: def projects(self) -> ProjectsResourceWithRawResponse: return ProjectsResourceWithRawResponse(self._cloud.projects) - @cached_property - def quotas(self) -> QuotasResourceWithRawResponse: - return QuotasResourceWithRawResponse(self._cloud.quotas) - @cached_property def regions(self) -> RegionsResourceWithRawResponse: return RegionsResourceWithRawResponse(self._cloud.regions) @@ -123,10 +103,6 @@ def __init__(self, cloud: AsyncCloudResource) -> None: def projects(self) -> AsyncProjectsResourceWithRawResponse: return AsyncProjectsResourceWithRawResponse(self._cloud.projects) - @cached_property - def quotas(self) -> AsyncQuotasResourceWithRawResponse: - return AsyncQuotasResourceWithRawResponse(self._cloud.quotas) - @cached_property def regions(self) -> AsyncRegionsResourceWithRawResponse: return AsyncRegionsResourceWithRawResponse(self._cloud.regions) @@ -140,10 +116,6 @@ def __init__(self, cloud: CloudResource) -> None: def projects(self) -> ProjectsResourceWithStreamingResponse: return ProjectsResourceWithStreamingResponse(self._cloud.projects) - @cached_property - def quotas(self) -> QuotasResourceWithStreamingResponse: - return QuotasResourceWithStreamingResponse(self._cloud.quotas) - @cached_property def regions(self) -> RegionsResourceWithStreamingResponse: return RegionsResourceWithStreamingResponse(self._cloud.regions) @@ -157,10 +129,6 @@ def __init__(self, cloud: AsyncCloudResource) -> None: def projects(self) -> AsyncProjectsResourceWithStreamingResponse: return AsyncProjectsResourceWithStreamingResponse(self._cloud.projects) - @cached_property - def quotas(self) -> AsyncQuotasResourceWithStreamingResponse: - return AsyncQuotasResourceWithStreamingResponse(self._cloud.quotas) - @cached_property def regions(self) -> AsyncRegionsResourceWithStreamingResponse: return AsyncRegionsResourceWithStreamingResponse(self._cloud.regions) diff --git a/src/gcore/resources/cloud/quotas/__init__.py b/src/gcore/resources/cloud/quotas/__init__.py deleted file mode 100644 index d67068b1..00000000 --- a/src/gcore/resources/cloud/quotas/__init__.py +++ /dev/null @@ -1,75 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .quotas import ( - QuotasResource, - AsyncQuotasResource, - QuotasResourceWithRawResponse, - AsyncQuotasResourceWithRawResponse, - QuotasResourceWithStreamingResponse, - AsyncQuotasResourceWithStreamingResponse, -) -from .global_ import ( - GlobalResource, - AsyncGlobalResource, - GlobalResourceWithRawResponse, - AsyncGlobalResourceWithRawResponse, - GlobalResourceWithStreamingResponse, - AsyncGlobalResourceWithStreamingResponse, -) -from .regional import ( - RegionalResource, - AsyncRegionalResource, - RegionalResourceWithRawResponse, - AsyncRegionalResourceWithRawResponse, - RegionalResourceWithStreamingResponse, - AsyncRegionalResourceWithStreamingResponse, -) -from .client_quotas import ( - ClientQuotasResource, - AsyncClientQuotasResource, - ClientQuotasResourceWithRawResponse, - AsyncClientQuotasResourceWithRawResponse, - ClientQuotasResourceWithStreamingResponse, - AsyncClientQuotasResourceWithStreamingResponse, -) -from .limits_request import ( - LimitsRequestResource, - AsyncLimitsRequestResource, - LimitsRequestResourceWithRawResponse, - AsyncLimitsRequestResourceWithRawResponse, - LimitsRequestResourceWithStreamingResponse, - AsyncLimitsRequestResourceWithStreamingResponse, -) - -__all__ = [ - "ClientQuotasResource", - "AsyncClientQuotasResource", - "ClientQuotasResourceWithRawResponse", - "AsyncClientQuotasResourceWithRawResponse", - "ClientQuotasResourceWithStreamingResponse", - "AsyncClientQuotasResourceWithStreamingResponse", - "GlobalResource", - "AsyncGlobalResource", - "GlobalResourceWithRawResponse", - "AsyncGlobalResourceWithRawResponse", - "GlobalResourceWithStreamingResponse", - "AsyncGlobalResourceWithStreamingResponse", - "RegionalResource", - "AsyncRegionalResource", - "RegionalResourceWithRawResponse", - "AsyncRegionalResourceWithRawResponse", - "RegionalResourceWithStreamingResponse", - "AsyncRegionalResourceWithStreamingResponse", - "LimitsRequestResource", - "AsyncLimitsRequestResource", - "LimitsRequestResourceWithRawResponse", - "AsyncLimitsRequestResourceWithRawResponse", - "LimitsRequestResourceWithStreamingResponse", - "AsyncLimitsRequestResourceWithStreamingResponse", - "QuotasResource", - "AsyncQuotasResource", - "QuotasResourceWithRawResponse", - "AsyncQuotasResourceWithRawResponse", - "QuotasResourceWithStreamingResponse", - "AsyncQuotasResourceWithStreamingResponse", -] diff --git a/src/gcore/resources/cloud/quotas/client_quotas.py b/src/gcore/resources/cloud/quotas/client_quotas.py deleted file mode 100644 index 30ff18f0..00000000 --- a/src/gcore/resources/cloud/quotas/client_quotas.py +++ /dev/null @@ -1,135 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.cloud.quotas.all_client_quotas import AllClientQuotas - -__all__ = ["ClientQuotasResource", "AsyncClientQuotasResource"] - - -class ClientQuotasResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ClientQuotasResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return ClientQuotasResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ClientQuotasResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return ClientQuotasResourceWithStreamingResponse(self) - - def retrieve( - 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, - ) -> AllClientQuotas: - """Get combined client quotas, regional and global.""" - return self._get( - "/cloud/v2/client_quotas", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AllClientQuotas, - ) - - -class AsyncClientQuotasResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncClientQuotasResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return AsyncClientQuotasResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncClientQuotasResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return AsyncClientQuotasResourceWithStreamingResponse(self) - - async def retrieve( - 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, - ) -> AllClientQuotas: - """Get combined client quotas, regional and global.""" - return await self._get( - "/cloud/v2/client_quotas", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AllClientQuotas, - ) - - -class ClientQuotasResourceWithRawResponse: - def __init__(self, client_quotas: ClientQuotasResource) -> None: - self._client_quotas = client_quotas - - self.retrieve = to_raw_response_wrapper( - client_quotas.retrieve, - ) - - -class AsyncClientQuotasResourceWithRawResponse: - def __init__(self, client_quotas: AsyncClientQuotasResource) -> None: - self._client_quotas = client_quotas - - self.retrieve = async_to_raw_response_wrapper( - client_quotas.retrieve, - ) - - -class ClientQuotasResourceWithStreamingResponse: - def __init__(self, client_quotas: ClientQuotasResource) -> None: - self._client_quotas = client_quotas - - self.retrieve = to_streamed_response_wrapper( - client_quotas.retrieve, - ) - - -class AsyncClientQuotasResourceWithStreamingResponse: - def __init__(self, client_quotas: AsyncClientQuotasResource) -> None: - self._client_quotas = client_quotas - - self.retrieve = async_to_streamed_response_wrapper( - client_quotas.retrieve, - ) diff --git a/src/gcore/resources/cloud/quotas/global_.py b/src/gcore/resources/cloud/quotas/global_.py deleted file mode 100644 index e7b8ea27..00000000 --- a/src/gcore/resources/cloud/quotas/global_.py +++ /dev/null @@ -1,163 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.cloud.quotas.global_quotas import GlobalQuotas - -__all__ = ["GlobalResource", "AsyncGlobalResource"] - - -class GlobalResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> GlobalResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return GlobalResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> GlobalResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return GlobalResourceWithStreamingResponse(self) - - def retrieve( - self, - client_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, - ) -> GlobalQuotas: - """ - Get global quota - - Args: - client_id: Client ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - f"/cloud/v2/global_quotas/{client_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=GlobalQuotas, - ) - - -class AsyncGlobalResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncGlobalResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return AsyncGlobalResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncGlobalResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return AsyncGlobalResourceWithStreamingResponse(self) - - async def retrieve( - self, - client_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, - ) -> GlobalQuotas: - """ - Get global quota - - Args: - client_id: Client ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - f"/cloud/v2/global_quotas/{client_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=GlobalQuotas, - ) - - -class GlobalResourceWithRawResponse: - def __init__(self, global_: GlobalResource) -> None: - self._global_ = global_ - - self.retrieve = to_raw_response_wrapper( - global_.retrieve, - ) - - -class AsyncGlobalResourceWithRawResponse: - def __init__(self, global_: AsyncGlobalResource) -> None: - self._global_ = global_ - - self.retrieve = async_to_raw_response_wrapper( - global_.retrieve, - ) - - -class GlobalResourceWithStreamingResponse: - def __init__(self, global_: GlobalResource) -> None: - self._global_ = global_ - - self.retrieve = to_streamed_response_wrapper( - global_.retrieve, - ) - - -class AsyncGlobalResourceWithStreamingResponse: - def __init__(self, global_: AsyncGlobalResource) -> None: - self._global_ = global_ - - self.retrieve = async_to_streamed_response_wrapper( - global_.retrieve, - ) diff --git a/src/gcore/resources/cloud/quotas/limits_request.py b/src/gcore/resources/cloud/quotas/limits_request.py deleted file mode 100644 index 9b56ad52..00000000 --- a/src/gcore/resources/cloud/quotas/limits_request.py +++ /dev/null @@ -1,483 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import Literal - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.cloud.quotas import limits_request_list_params, limits_request_create_params -from ....types.cloud.quotas.limits_request import LimitsRequest - -__all__ = ["LimitsRequestResource", "AsyncLimitsRequestResource"] - - -class LimitsRequestResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> LimitsRequestResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return LimitsRequestResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> LimitsRequestResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return LimitsRequestResourceWithStreamingResponse(self) - - def create( - self, - *, - description: str, - requested_limits: limits_request_create_params.RequestedLimits, - client_id: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: - """ - Create request to change quotas - - Args: - description: Describe the reason, in general terms. - - requested_limits: Limits you want to increase. - - client_id: Client ID that requests the limit increase. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._post( - "/cloud/v2/limits_request", - body=maybe_transform( - { - "description": description, - "requested_limits": requested_limits, - "client_id": client_id, - }, - limits_request_create_params.LimitsRequestCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def retrieve( - self, - request_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LimitsRequest: - """ - Get request to change quota limits. - - Args: - request_id: LimitRequest ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not request_id: - raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") - return self._get( - f"/cloud/v2/limits_request/{request_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LimitsRequest, - ) - - def list( - self, - *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - status: Optional[List[Literal["done", "in progress", "rejected"]]] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: - """ - Returns a list of sent requests to change current quotas and their statuses - - Args: - limit: Optional. Limit the number of returned items - - offset: Optional. Offset value is used to exclude the first set of records from the - result - - status: List of limit requests statuses for filtering - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._get( - "/cloud/v2/limits_request", - 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, - "status": status, - }, - limits_request_list_params.LimitsRequestListParams, - ), - ), - cast_to=NoneType, - ) - - def delete( - self, - request_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: - """ - Delete request to change quotas - - Args: - request_id: LimitRequest ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not request_id: - raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._delete( - f"/cloud/v2/limits_request/{request_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AsyncLimitsRequestResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncLimitsRequestResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return AsyncLimitsRequestResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncLimitsRequestResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return AsyncLimitsRequestResourceWithStreamingResponse(self) - - async def create( - self, - *, - description: str, - requested_limits: limits_request_create_params.RequestedLimits, - client_id: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: - """ - Create request to change quotas - - Args: - description: Describe the reason, in general terms. - - requested_limits: Limits you want to increase. - - client_id: Client ID that requests the limit increase. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._post( - "/cloud/v2/limits_request", - body=await async_maybe_transform( - { - "description": description, - "requested_limits": requested_limits, - "client_id": client_id, - }, - limits_request_create_params.LimitsRequestCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def retrieve( - self, - request_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LimitsRequest: - """ - Get request to change quota limits. - - Args: - request_id: LimitRequest ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not request_id: - raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") - return await self._get( - f"/cloud/v2/limits_request/{request_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LimitsRequest, - ) - - async def list( - self, - *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - status: Optional[List[Literal["done", "in progress", "rejected"]]] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: - """ - Returns a list of sent requests to change current quotas and their statuses - - Args: - limit: Optional. Limit the number of returned items - - offset: Optional. Offset value is used to exclude the first set of records from the - result - - status: List of limit requests statuses for filtering - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._get( - "/cloud/v2/limits_request", - 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, - "status": status, - }, - limits_request_list_params.LimitsRequestListParams, - ), - ), - cast_to=NoneType, - ) - - async def delete( - self, - request_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: - """ - Delete request to change quotas - - Args: - request_id: LimitRequest ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not request_id: - raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._delete( - f"/cloud/v2/limits_request/{request_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class LimitsRequestResourceWithRawResponse: - def __init__(self, limits_request: LimitsRequestResource) -> None: - self._limits_request = limits_request - - self.create = to_raw_response_wrapper( - limits_request.create, - ) - self.retrieve = to_raw_response_wrapper( - limits_request.retrieve, - ) - self.list = to_raw_response_wrapper( - limits_request.list, - ) - self.delete = to_raw_response_wrapper( - limits_request.delete, - ) - - -class AsyncLimitsRequestResourceWithRawResponse: - def __init__(self, limits_request: AsyncLimitsRequestResource) -> None: - self._limits_request = limits_request - - self.create = async_to_raw_response_wrapper( - limits_request.create, - ) - self.retrieve = async_to_raw_response_wrapper( - limits_request.retrieve, - ) - self.list = async_to_raw_response_wrapper( - limits_request.list, - ) - self.delete = async_to_raw_response_wrapper( - limits_request.delete, - ) - - -class LimitsRequestResourceWithStreamingResponse: - def __init__(self, limits_request: LimitsRequestResource) -> None: - self._limits_request = limits_request - - self.create = to_streamed_response_wrapper( - limits_request.create, - ) - self.retrieve = to_streamed_response_wrapper( - limits_request.retrieve, - ) - self.list = to_streamed_response_wrapper( - limits_request.list, - ) - self.delete = to_streamed_response_wrapper( - limits_request.delete, - ) - - -class AsyncLimitsRequestResourceWithStreamingResponse: - def __init__(self, limits_request: AsyncLimitsRequestResource) -> None: - self._limits_request = limits_request - - self.create = async_to_streamed_response_wrapper( - limits_request.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - limits_request.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - limits_request.list, - ) - self.delete = async_to_streamed_response_wrapper( - limits_request.delete, - ) diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py deleted file mode 100644 index 8b388da9..00000000 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ /dev/null @@ -1,198 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .global_ import ( - GlobalResource, - AsyncGlobalResource, - GlobalResourceWithRawResponse, - AsyncGlobalResourceWithRawResponse, - GlobalResourceWithStreamingResponse, - AsyncGlobalResourceWithStreamingResponse, -) -from .regional import ( - RegionalResource, - AsyncRegionalResource, - RegionalResourceWithRawResponse, - AsyncRegionalResourceWithRawResponse, - RegionalResourceWithStreamingResponse, - AsyncRegionalResourceWithStreamingResponse, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from .client_quotas import ( - ClientQuotasResource, - AsyncClientQuotasResource, - ClientQuotasResourceWithRawResponse, - AsyncClientQuotasResourceWithRawResponse, - ClientQuotasResourceWithStreamingResponse, - AsyncClientQuotasResourceWithStreamingResponse, -) -from .limits_request import ( - LimitsRequestResource, - AsyncLimitsRequestResource, - LimitsRequestResourceWithRawResponse, - AsyncLimitsRequestResourceWithRawResponse, - LimitsRequestResourceWithStreamingResponse, - AsyncLimitsRequestResourceWithStreamingResponse, -) - -__all__ = ["QuotasResource", "AsyncQuotasResource"] - - -class QuotasResource(SyncAPIResource): - @cached_property - def client_quotas(self) -> ClientQuotasResource: - return ClientQuotasResource(self._client) - - @cached_property - def global_(self) -> GlobalResource: - return GlobalResource(self._client) - - @cached_property - def regional(self) -> RegionalResource: - return RegionalResource(self._client) - - @cached_property - def limits_request(self) -> LimitsRequestResource: - return LimitsRequestResource(self._client) - - @cached_property - def with_raw_response(self) -> QuotasResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return QuotasResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> QuotasResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return QuotasResourceWithStreamingResponse(self) - - -class AsyncQuotasResource(AsyncAPIResource): - @cached_property - def client_quotas(self) -> AsyncClientQuotasResource: - return AsyncClientQuotasResource(self._client) - - @cached_property - def global_(self) -> AsyncGlobalResource: - return AsyncGlobalResource(self._client) - - @cached_property - def regional(self) -> AsyncRegionalResource: - return AsyncRegionalResource(self._client) - - @cached_property - def limits_request(self) -> AsyncLimitsRequestResource: - return AsyncLimitsRequestResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncQuotasResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return AsyncQuotasResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncQuotasResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return AsyncQuotasResourceWithStreamingResponse(self) - - -class QuotasResourceWithRawResponse: - def __init__(self, quotas: QuotasResource) -> None: - self._quotas = quotas - - @cached_property - def client_quotas(self) -> ClientQuotasResourceWithRawResponse: - return ClientQuotasResourceWithRawResponse(self._quotas.client_quotas) - - @cached_property - def global_(self) -> GlobalResourceWithRawResponse: - return GlobalResourceWithRawResponse(self._quotas.global_) - - @cached_property - def regional(self) -> RegionalResourceWithRawResponse: - return RegionalResourceWithRawResponse(self._quotas.regional) - - @cached_property - def limits_request(self) -> LimitsRequestResourceWithRawResponse: - return LimitsRequestResourceWithRawResponse(self._quotas.limits_request) - - -class AsyncQuotasResourceWithRawResponse: - def __init__(self, quotas: AsyncQuotasResource) -> None: - self._quotas = quotas - - @cached_property - def client_quotas(self) -> AsyncClientQuotasResourceWithRawResponse: - return AsyncClientQuotasResourceWithRawResponse(self._quotas.client_quotas) - - @cached_property - def global_(self) -> AsyncGlobalResourceWithRawResponse: - return AsyncGlobalResourceWithRawResponse(self._quotas.global_) - - @cached_property - def regional(self) -> AsyncRegionalResourceWithRawResponse: - return AsyncRegionalResourceWithRawResponse(self._quotas.regional) - - @cached_property - def limits_request(self) -> AsyncLimitsRequestResourceWithRawResponse: - return AsyncLimitsRequestResourceWithRawResponse(self._quotas.limits_request) - - -class QuotasResourceWithStreamingResponse: - def __init__(self, quotas: QuotasResource) -> None: - self._quotas = quotas - - @cached_property - def client_quotas(self) -> ClientQuotasResourceWithStreamingResponse: - return ClientQuotasResourceWithStreamingResponse(self._quotas.client_quotas) - - @cached_property - def global_(self) -> GlobalResourceWithStreamingResponse: - return GlobalResourceWithStreamingResponse(self._quotas.global_) - - @cached_property - def regional(self) -> RegionalResourceWithStreamingResponse: - return RegionalResourceWithStreamingResponse(self._quotas.regional) - - @cached_property - def limits_request(self) -> LimitsRequestResourceWithStreamingResponse: - return LimitsRequestResourceWithStreamingResponse(self._quotas.limits_request) - - -class AsyncQuotasResourceWithStreamingResponse: - def __init__(self, quotas: AsyncQuotasResource) -> None: - self._quotas = quotas - - @cached_property - def client_quotas(self) -> AsyncClientQuotasResourceWithStreamingResponse: - return AsyncClientQuotasResourceWithStreamingResponse(self._quotas.client_quotas) - - @cached_property - def global_(self) -> AsyncGlobalResourceWithStreamingResponse: - return AsyncGlobalResourceWithStreamingResponse(self._quotas.global_) - - @cached_property - def regional(self) -> AsyncRegionalResourceWithStreamingResponse: - return AsyncRegionalResourceWithStreamingResponse(self._quotas.regional) - - @cached_property - def limits_request(self) -> AsyncLimitsRequestResourceWithStreamingResponse: - return AsyncLimitsRequestResourceWithStreamingResponse(self._quotas.limits_request) diff --git a/src/gcore/resources/cloud/quotas/regional.py b/src/gcore/resources/cloud/quotas/regional.py deleted file mode 100644 index 4f8a1aa4..00000000 --- a/src/gcore/resources/cloud/quotas/regional.py +++ /dev/null @@ -1,173 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.cloud.quotas.regional_quotas import RegionalQuotas - -__all__ = ["RegionalResource", "AsyncRegionalResource"] - - -class RegionalResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> RegionalResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return RegionalResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RegionalResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return RegionalResourceWithStreamingResponse(self) - - def retrieve( - self, - *, - client_id: int, - region_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegionalQuotas: - """ - Get a quota by region - - Args: - client_id: Client ID - - region_id: Region ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if region_id is None: - region_id = self._client._get_region_id_path_param() - return self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RegionalQuotas, - ) - - -class AsyncRegionalResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncRegionalResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return AsyncRegionalResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRegionalResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return AsyncRegionalResourceWithStreamingResponse(self) - - async def retrieve( - self, - *, - client_id: int, - region_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegionalQuotas: - """ - Get a quota by region - - Args: - client_id: Client ID - - region_id: Region ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if region_id is None: - region_id = self._client._get_region_id_path_param() - return await self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RegionalQuotas, - ) - - -class RegionalResourceWithRawResponse: - def __init__(self, regional: RegionalResource) -> None: - self._regional = regional - - self.retrieve = to_raw_response_wrapper( - regional.retrieve, - ) - - -class AsyncRegionalResourceWithRawResponse: - def __init__(self, regional: AsyncRegionalResource) -> None: - self._regional = regional - - self.retrieve = async_to_raw_response_wrapper( - regional.retrieve, - ) - - -class RegionalResourceWithStreamingResponse: - def __init__(self, regional: RegionalResource) -> None: - self._regional = regional - - self.retrieve = to_streamed_response_wrapper( - regional.retrieve, - ) - - -class AsyncRegionalResourceWithStreamingResponse: - def __init__(self, regional: AsyncRegionalResource) -> None: - self._regional = regional - - self.retrieve = async_to_streamed_response_wrapper( - regional.retrieve, - ) diff --git a/src/gcore/types/cloud/quotas/__init__.py b/src/gcore/types/cloud/quotas/__init__.py deleted file mode 100644 index 14a5ee3a..00000000 --- a/src/gcore/types/cloud/quotas/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .global_quotas import GlobalQuotas as GlobalQuotas -from .limits_request import LimitsRequest as LimitsRequest -from .regional_quotas import RegionalQuotas as RegionalQuotas -from .all_client_quotas import AllClientQuotas as AllClientQuotas -from .limits_request_list_params import LimitsRequestListParams as LimitsRequestListParams -from .limits_request_create_params import LimitsRequestCreateParams as LimitsRequestCreateParams diff --git a/src/gcore/types/cloud/quotas/all_client_quotas.py b/src/gcore/types/cloud/quotas/all_client_quotas.py deleted file mode 100644 index e19b1c9a..00000000 --- a/src/gcore/types/cloud/quotas/all_client_quotas.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel -from .global_quotas import GlobalQuotas -from .regional_quotas import RegionalQuotas - -__all__ = ["AllClientQuotas"] - - -class AllClientQuotas(BaseModel): - global_quotas: Optional[GlobalQuotas] = None - """Global entity quotas""" - - regional_quotas: Optional[List[RegionalQuotas]] = None - """Regional entity quotas. Only contains initialized quotas.""" diff --git a/src/gcore/types/cloud/quotas/global_quotas.py b/src/gcore/types/cloud/quotas/global_quotas.py deleted file mode 100644 index b554079e..00000000 --- a/src/gcore/types/cloud/quotas/global_quotas.py +++ /dev/null @@ -1,51 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["GlobalQuotas"] - - -class GlobalQuotas(BaseModel): - inference_cpu_millicore_count_limit: Optional[int] = None - """Inference CPU millicore count limit""" - - inference_cpu_millicore_count_usage: Optional[int] = None - """Inference CPU millicore count usage""" - - inference_gpu_a100_count_limit: Optional[int] = None - """Inference GPU A100 Count limit""" - - inference_gpu_a100_count_usage: Optional[int] = None - """Inference GPU A100 Count usage""" - - inference_gpu_h100_count_limit: Optional[int] = None - """Inference GPU H100 Count limit""" - - inference_gpu_h100_count_usage: Optional[int] = None - """Inference GPU H100 Count usage""" - - inference_gpu_l40s_count_limit: Optional[int] = None - """Inference GPU L40s Count limit""" - - inference_gpu_l40s_count_usage: Optional[int] = None - """Inference GPU L40s Count usage""" - - inference_instance_count_limit: Optional[int] = None - """Inference instance count limit""" - - inference_instance_count_usage: Optional[int] = None - """Inference instance count usage""" - - keypair_count_limit: Optional[int] = None - """SSH Keys Count limit""" - - keypair_count_usage: Optional[int] = None - """SSH Keys Count usage""" - - project_count_limit: Optional[int] = None - """Projects Count limit""" - - project_count_usage: Optional[int] = None - """Projects Count usage""" diff --git a/src/gcore/types/cloud/quotas/limits_request.py b/src/gcore/types/cloud/quotas/limits_request.py deleted file mode 100644 index 5c4e136d..00000000 --- a/src/gcore/types/cloud/quotas/limits_request.py +++ /dev/null @@ -1,205 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["LimitsRequest", "RequestedLimits", "RequestedLimitsGlobalLimits", "RequestedLimitsRegionalLimit"] - - -class RequestedLimitsGlobalLimits(BaseModel): - inference_cpu_millicore_count_limit: Optional[int] = None - """Inference CPU millicore count limit""" - - inference_gpu_a100_count_limit: Optional[int] = None - """Inference GPU A100 Count limit""" - - inference_gpu_h100_count_limit: Optional[int] = None - """Inference GPU H100 Count limit""" - - inference_gpu_l40s_count_limit: Optional[int] = None - """Inference GPU L40s Count limit""" - - inference_instance_count_limit: Optional[int] = None - """Inference instance count limit""" - - keypair_count_limit: Optional[int] = None - """SSH Keys Count limit""" - - project_count_limit: Optional[int] = None - """Projects Count limit""" - - -class RequestedLimitsRegionalLimit(BaseModel): - baremetal_basic_count_limit: Optional[int] = None - """Basic bare metal servers count limit""" - - baremetal_gpu_count_limit: Optional[int] = None - """AI GPU bare metal servers count limit""" - - baremetal_hf_count_limit: Optional[int] = None - """High-frequency bare metal servers count limit""" - - baremetal_infrastructure_count_limit: Optional[int] = None - """Infrastructure bare metal servers count limit""" - - baremetal_network_count_limit: Optional[int] = None - """Bare metal Network Count limit""" - - baremetal_storage_count_limit: Optional[int] = None - """Storage bare metal servers count limit""" - - caas_container_count_limit: Optional[int] = None - """Containers count limit""" - - caas_cpu_count_limit: Optional[int] = None - """mCPU count for containers limit""" - - caas_gpu_count_limit: Optional[int] = None - """Containers gpu count limit""" - - caas_ram_size_limit: Optional[int] = None - """MB memory count for containers limit""" - - cluster_count_limit: Optional[int] = None - """K8s clusters count limit""" - - cpu_count_limit: Optional[int] = None - """vCPU Count limit""" - - dbaas_postgres_cluster_count_limit: Optional[int] = None - """DBaaS cluster count limit""" - - external_ip_count_limit: Optional[int] = None - """External IP Count limit""" - - faas_cpu_count_limit: Optional[int] = None - """mCPU count for functions limit""" - - faas_function_count_limit: Optional[int] = None - """Functions count limit""" - - faas_namespace_count_limit: Optional[int] = None - """Functions namespace count limit""" - - faas_ram_size_limit: Optional[int] = None - """MB memory count for functions limit""" - - firewall_count_limit: Optional[int] = None - """Firewalls Count limit""" - - floating_count_limit: Optional[int] = None - """Floating IP Count limit""" - - gpu_count_limit: Optional[int] = None - """GPU Count limit""" - - gpu_virtual_a100_count_limit: Optional[int] = None - """Virtual A100 GPU card count limit""" - - gpu_virtual_h100_count_limit: Optional[int] = None - """Virtual H100 GPU card count limit""" - - gpu_virtual_l40s_count_limit: Optional[int] = None - """Virtual L40S GPU card count limit""" - - image_count_limit: Optional[int] = None - """Images Count limit""" - - image_size_limit: Optional[int] = None - """Images Size, GiB limit""" - - ipu_count_limit: Optional[int] = None - """IPU Count limit""" - - laas_topic_count_limit: Optional[int] = None - """LaaS Topics Count limit""" - - loadbalancer_count_limit: Optional[int] = None - """Load Balancers Count limit""" - - network_count_limit: Optional[int] = None - """Networks Count limit""" - - ram_limit: Optional[int] = None - """RAM Size, GiB limit""" - - region_id: Optional[int] = None - """Region ID""" - - registry_count_limit: Optional[int] = None - """Registries count limit""" - - registry_storage_limit: Optional[int] = None - """Registries volume usage, GiB limit""" - - router_count_limit: Optional[int] = None - """Routers Count limit""" - - secret_count_limit: Optional[int] = None - """Secret Count limit""" - - servergroup_count_limit: Optional[int] = None - """Placement Group Count limit""" - - sfs_count_limit: Optional[int] = None - """Shared file system Count limit""" - - sfs_size_limit: Optional[int] = None - """Shared file system Size, GiB limit""" - - shared_vm_count_limit: Optional[int] = None - """Basic VMs Count limit""" - - snapshot_schedule_count_limit: Optional[int] = None - """Snapshot Schedules Count limit""" - - subnet_count_limit: Optional[int] = None - """Subnets Count limit""" - - vm_count_limit: Optional[int] = None - """Instances Dedicated Count limit""" - - volume_count_limit: Optional[int] = None - """Volumes Count limit""" - - volume_size_limit: Optional[int] = None - """Volumes Size, GiB limit""" - - volume_snapshots_count_limit: Optional[int] = None - """Snapshots Count limit""" - - volume_snapshots_size_limit: Optional[int] = None - """Snapshots Size, GiB limit""" - - -class RequestedLimits(BaseModel): - global_limits: Optional[RequestedLimitsGlobalLimits] = None - """Global entity quota limits""" - - regional_limits: Optional[List[RequestedLimitsRegionalLimit]] = None - """Regions and their quota limits""" - - -class LimitsRequest(BaseModel): - id: int - """Request ID""" - - client_id: int - """Client ID""" - - requested_limits: RequestedLimits - """Requested limits.""" - - status: str - """Request status""" - - created_at: Optional[datetime] = None - """Datetime when the request was created.""" - - description: Optional[str] = None - """Describe the reason, in general terms.""" - - updated_at: Optional[datetime] = None - """Datetime when the request was updated.""" diff --git a/src/gcore/types/cloud/quotas/limits_request_create_params.py b/src/gcore/types/cloud/quotas/limits_request_create_params.py deleted file mode 100644 index 42a65e00..00000000 --- a/src/gcore/types/cloud/quotas/limits_request_create_params.py +++ /dev/null @@ -1,198 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import Required, TypedDict - -__all__ = [ - "LimitsRequestCreateParams", - "RequestedLimits", - "RequestedLimitsGlobalLimits", - "RequestedLimitsRegionalLimit", -] - - -class LimitsRequestCreateParams(TypedDict, total=False): - description: Required[str] - """Describe the reason, in general terms.""" - - requested_limits: Required[RequestedLimits] - """Limits you want to increase.""" - - client_id: int - """Client ID that requests the limit increase.""" - - -class RequestedLimitsGlobalLimits(TypedDict, total=False): - inference_cpu_millicore_count_limit: int - """Inference CPU millicore count limit""" - - inference_gpu_a100_count_limit: int - """Inference GPU A100 Count limit""" - - inference_gpu_h100_count_limit: int - """Inference GPU H100 Count limit""" - - inference_gpu_l40s_count_limit: int - """Inference GPU L40s Count limit""" - - inference_instance_count_limit: int - """Inference instance count limit""" - - keypair_count_limit: int - """SSH Keys Count limit""" - - project_count_limit: int - """Projects Count limit""" - - -class RequestedLimitsRegionalLimit(TypedDict, total=False): - baremetal_basic_count_limit: int - """Basic bare metal servers count limit""" - - baremetal_gpu_count_limit: int - """AI GPU bare metal servers count limit""" - - baremetal_hf_count_limit: int - """High-frequency bare metal servers count limit""" - - baremetal_infrastructure_count_limit: int - """Infrastructure bare metal servers count limit""" - - baremetal_network_count_limit: int - """Bare metal Network Count limit""" - - baremetal_storage_count_limit: int - """Storage bare metal servers count limit""" - - caas_container_count_limit: int - """Containers count limit""" - - caas_cpu_count_limit: int - """mCPU count for containers limit""" - - caas_gpu_count_limit: int - """Containers gpu count limit""" - - caas_ram_size_limit: int - """MB memory count for containers limit""" - - cluster_count_limit: int - """K8s clusters count limit""" - - cpu_count_limit: int - """vCPU Count limit""" - - dbaas_postgres_cluster_count_limit: int - """DBaaS cluster count limit""" - - external_ip_count_limit: int - """External IP Count limit""" - - faas_cpu_count_limit: int - """mCPU count for functions limit""" - - faas_function_count_limit: int - """Functions count limit""" - - faas_namespace_count_limit: int - """Functions namespace count limit""" - - faas_ram_size_limit: int - """MB memory count for functions limit""" - - firewall_count_limit: int - """Firewalls Count limit""" - - floating_count_limit: int - """Floating IP Count limit""" - - gpu_count_limit: int - """GPU Count limit""" - - gpu_virtual_a100_count_limit: int - """Virtual A100 GPU card count limit""" - - gpu_virtual_h100_count_limit: int - """Virtual H100 GPU card count limit""" - - gpu_virtual_l40s_count_limit: int - """Virtual L40S GPU card count limit""" - - image_count_limit: int - """Images Count limit""" - - image_size_limit: int - """Images Size, GiB limit""" - - ipu_count_limit: int - """IPU Count limit""" - - laas_topic_count_limit: int - """LaaS Topics Count limit""" - - loadbalancer_count_limit: int - """Load Balancers Count limit""" - - network_count_limit: int - """Networks Count limit""" - - ram_limit: int - """RAM Size, GiB limit""" - - region_id: int - """Region ID""" - - registry_count_limit: int - """Registries count limit""" - - registry_storage_limit: int - """Registries volume usage, GiB limit""" - - router_count_limit: int - """Routers Count limit""" - - secret_count_limit: int - """Secret Count limit""" - - servergroup_count_limit: int - """Placement Group Count limit""" - - sfs_count_limit: int - """Shared file system Count limit""" - - sfs_size_limit: int - """Shared file system Size, GiB limit""" - - shared_vm_count_limit: int - """Basic VMs Count limit""" - - snapshot_schedule_count_limit: int - """Snapshot Schedules Count limit""" - - subnet_count_limit: int - """Subnets Count limit""" - - vm_count_limit: int - """Instances Dedicated Count limit""" - - volume_count_limit: int - """Volumes Count limit""" - - volume_size_limit: int - """Volumes Size, GiB limit""" - - volume_snapshots_count_limit: int - """Snapshots Count limit""" - - volume_snapshots_size_limit: int - """Snapshots Size, GiB limit""" - - -class RequestedLimits(TypedDict, total=False): - global_limits: RequestedLimitsGlobalLimits - """Global entity quota limits""" - - regional_limits: Iterable[RequestedLimitsRegionalLimit] - """Regions and their quota limits""" diff --git a/src/gcore/types/cloud/quotas/limits_request_list_params.py b/src/gcore/types/cloud/quotas/limits_request_list_params.py deleted file mode 100644 index 0abb9671..00000000 --- a/src/gcore/types/cloud/quotas/limits_request_list_params.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import Literal, TypedDict - -__all__ = ["LimitsRequestListParams"] - - -class LimitsRequestListParams(TypedDict, total=False): - limit: int - """Optional. Limit the number of returned items""" - - offset: int - """Optional. - - Offset value is used to exclude the first set of records from the result - """ - - status: Optional[List[Literal["done", "in progress", "rejected"]]] - """List of limit requests statuses for filtering""" diff --git a/src/gcore/types/cloud/quotas/regional_quotas.py b/src/gcore/types/cloud/quotas/regional_quotas.py deleted file mode 100644 index 8527db53..00000000 --- a/src/gcore/types/cloud/quotas/regional_quotas.py +++ /dev/null @@ -1,288 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel - -__all__ = ["RegionalQuotas"] - - -class RegionalQuotas(BaseModel): - baremetal_basic_count_limit: Optional[int] = None - """Basic bare metal servers count limit""" - - baremetal_basic_count_usage: Optional[int] = None - """Basic bare metal servers count usage""" - - baremetal_gpu_count_limit: Optional[int] = None - """AI GPU bare metal servers count limit""" - - baremetal_gpu_count_usage: Optional[int] = None - """AI GPU bare metal servers count usage""" - - baremetal_hf_count_limit: Optional[int] = None - """High-frequency bare metal servers count limit""" - - baremetal_hf_count_usage: Optional[int] = None - """High-frequency bare metal servers count usage""" - - baremetal_infrastructure_count_limit: Optional[int] = None - """Infrastructure bare metal servers count limit""" - - baremetal_infrastructure_count_usage: Optional[int] = None - """Infrastructure bare metal servers count usage""" - - baremetal_network_count_limit: Optional[int] = None - """Bare metal Network Count limit""" - - baremetal_network_count_usage: Optional[int] = None - """Bare metal Network Count usage""" - - baremetal_storage_count_limit: Optional[int] = None - """Storage bare metal servers count limit""" - - baremetal_storage_count_usage: Optional[int] = None - """Storage bare metal servers count usage""" - - caas_container_count_limit: Optional[int] = None - """Containers count limit""" - - caas_container_count_usage: Optional[int] = None - """Containers count usage""" - - caas_cpu_count_limit: Optional[int] = None - """mCPU count for containers limit""" - - caas_cpu_count_usage: Optional[int] = None - """mCPU count for containers usage""" - - caas_gpu_count_limit: Optional[int] = None - """Containers gpu count limit""" - - caas_gpu_count_usage: Optional[int] = None - """Containers gpu count usage""" - - caas_ram_size_limit: Optional[int] = None - """MB memory count for containers limit""" - - caas_ram_size_usage: Optional[int] = None - """MB memory count for containers usage""" - - cluster_count_limit: Optional[int] = None - """K8s clusters count limit""" - - cluster_count_usage: Optional[int] = None - """K8s clusters count usage""" - - cpu_count_limit: Optional[int] = None - """vCPU Count limit""" - - cpu_count_usage: Optional[int] = None - """vCPU Count usage""" - - dbaas_postgres_cluster_count_limit: Optional[int] = None - """DBaaS cluster count limit""" - - dbaas_postgres_cluster_count_usage: Optional[int] = None - """DBaaS cluster count usage""" - - external_ip_count_limit: Optional[int] = None - """External IP Count limit""" - - external_ip_count_usage: Optional[int] = None - """External IP Count usage""" - - faas_cpu_count_limit: Optional[int] = None - """mCPU count for functions limit""" - - faas_cpu_count_usage: Optional[int] = None - """mCPU count for functions usage""" - - faas_function_count_limit: Optional[int] = None - """Functions count limit""" - - faas_function_count_usage: Optional[int] = None - """Functions count usage""" - - faas_namespace_count_limit: Optional[int] = None - """Functions namespace count limit""" - - faas_namespace_count_usage: Optional[int] = None - """Functions namespace count usage""" - - faas_ram_size_limit: Optional[int] = None - """MB memory count for functions limit""" - - faas_ram_size_usage: Optional[int] = None - """MB memory count for functions usage""" - - firewall_count_limit: Optional[int] = None - """Firewalls Count limit""" - - firewall_count_usage: Optional[int] = None - """Firewalls Count usage""" - - floating_count_limit: Optional[int] = None - """Floating IP Count limit""" - - floating_count_usage: Optional[int] = None - """Floating IP Count usage""" - - gpu_count_limit: Optional[int] = None - """GPU Count limit""" - - gpu_count_usage: Optional[int] = None - """GPU Count usage""" - - gpu_virtual_a100_count_limit: Optional[int] = None - """Virtual A100 GPU card count limit""" - - gpu_virtual_a100_count_usage: Optional[int] = None - """Virtual A100 GPU card count usage""" - - gpu_virtual_h100_count_limit: Optional[int] = None - """Virtual H100 GPU card count limit""" - - gpu_virtual_h100_count_usage: Optional[int] = None - """Virtual H100 GPU card count usage""" - - gpu_virtual_l40s_count_limit: Optional[int] = None - """Virtual L40S GPU card count limit""" - - gpu_virtual_l40s_count_usage: Optional[int] = None - """Virtual L40S GPU card count usage""" - - image_count_limit: Optional[int] = None - """Images Count limit""" - - image_count_usage: Optional[int] = None - """Images Count usage""" - - image_size_limit: Optional[int] = None - """Images Size, GiB limit""" - - image_size_usage: Optional[int] = None - """Images Size, GiB usage""" - - ipu_count_limit: Optional[int] = None - """IPU Count limit""" - - ipu_count_usage: Optional[int] = None - """IPU Count usage""" - - laas_topic_count_limit: Optional[int] = None - """LaaS Topics Count limit""" - - laas_topic_count_usage: Optional[int] = None - """LaaS Topics Count usage""" - - loadbalancer_count_limit: Optional[int] = None - """Load Balancers Count limit""" - - loadbalancer_count_usage: Optional[int] = None - """Load Balancers Count usage""" - - network_count_limit: Optional[int] = None - """Networks Count limit""" - - network_count_usage: Optional[int] = None - """Networks Count usage""" - - ram_limit: Optional[int] = None - """RAM Size, GiB limit""" - - ram_usage: Optional[int] = None - """RAM Size, GiB usage""" - - region_id: Optional[int] = None - """Region ID""" - - registry_count_limit: Optional[int] = None - """Registries count limit""" - - registry_count_usage: Optional[int] = None - """Registries count usage""" - - registry_storage_limit: Optional[int] = None - """Registries volume usage, GiB limit""" - - registry_storage_usage: Optional[int] = None - """Registries volume usage, GiB usage""" - - router_count_limit: Optional[int] = None - """Routers Count limit""" - - router_count_usage: Optional[int] = None - """Routers Count usage""" - - secret_count_limit: Optional[int] = None - """Secret Count limit""" - - secret_count_usage: Optional[int] = None - """Secret Count usage""" - - servergroup_count_limit: Optional[int] = None - """Placement Group Count limit""" - - servergroup_count_usage: Optional[int] = None - """Placement Group Count usage""" - - sfs_count_limit: Optional[int] = None - """Shared file system Count limit""" - - sfs_count_usage: Optional[int] = None - """Shared file system Count usage""" - - sfs_size_limit: Optional[int] = None - """Shared file system Size, GiB limit""" - - sfs_size_usage: Optional[int] = None - """Shared file system Size, GiB usage""" - - shared_vm_count_limit: Optional[int] = None - """Basic VMs Count limit""" - - shared_vm_count_usage: Optional[int] = None - """Basic VMs Count usage""" - - snapshot_schedule_count_limit: Optional[int] = None - """Snapshot Schedules Count limit""" - - snapshot_schedule_count_usage: Optional[int] = None - """Snapshot Schedules Count usage""" - - subnet_count_limit: Optional[int] = None - """Subnets Count limit""" - - subnet_count_usage: Optional[int] = None - """Subnets Count usage""" - - vm_count_limit: Optional[int] = None - """Instances Dedicated Count limit""" - - vm_count_usage: Optional[int] = None - """Instances Dedicated Count usage""" - - volume_count_limit: Optional[int] = None - """Volumes Count limit""" - - volume_count_usage: Optional[int] = None - """Volumes Count usage""" - - volume_size_limit: Optional[int] = None - """Volumes Size, GiB limit""" - - volume_size_usage: Optional[int] = None - """Volumes Size, GiB usage""" - - volume_snapshots_count_limit: Optional[int] = None - """Snapshots Count limit""" - - volume_snapshots_count_usage: Optional[int] = None - """Snapshots Count usage""" - - volume_snapshots_size_limit: Optional[int] = None - """Snapshots Size, GiB limit""" - - volume_snapshots_size_usage: Optional[int] = None - """Snapshots Size, GiB usage""" diff --git a/tests/api_resources/cloud/quotas/__init__.py b/tests/api_resources/cloud/quotas/__init__.py deleted file mode 100644 index fd8019a9..00000000 --- a/tests/api_resources/cloud/quotas/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/quotas/test_client_quotas.py b/tests/api_resources/cloud/quotas/test_client_quotas.py deleted file mode 100644 index 7fb6e9d4..00000000 --- a/tests/api_resources/cloud/quotas/test_client_quotas.py +++ /dev/null @@ -1,72 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from gcore import Gcore, AsyncGcore -from tests.utils import assert_matches_type -from gcore.types.cloud.quotas import AllClientQuotas - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestClientQuotas: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: Gcore) -> None: - client_quota = client.cloud.quotas.client_quotas.retrieve() - assert_matches_type(AllClientQuotas, client_quota, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Gcore) -> None: - response = client.cloud.quotas.client_quotas.with_raw_response.retrieve() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - client_quota = response.parse() - assert_matches_type(AllClientQuotas, client_quota, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Gcore) -> None: - with client.cloud.quotas.client_quotas.with_streaming_response.retrieve() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - client_quota = response.parse() - assert_matches_type(AllClientQuotas, client_quota, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncClientQuotas: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncGcore) -> None: - client_quota = await async_client.cloud.quotas.client_quotas.retrieve() - assert_matches_type(AllClientQuotas, client_quota, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.quotas.client_quotas.with_raw_response.retrieve() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - client_quota = await response.parse() - assert_matches_type(AllClientQuotas, client_quota, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.quotas.client_quotas.with_streaming_response.retrieve() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - client_quota = await response.parse() - assert_matches_type(AllClientQuotas, client_quota, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/quotas/test_global_.py b/tests/api_resources/cloud/quotas/test_global_.py deleted file mode 100644 index be88934d..00000000 --- a/tests/api_resources/cloud/quotas/test_global_.py +++ /dev/null @@ -1,84 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from gcore import Gcore, AsyncGcore -from tests.utils import assert_matches_type -from gcore.types.cloud.quotas import GlobalQuotas - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestGlobal: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: Gcore) -> None: - global_ = client.cloud.quotas.global_.retrieve( - 3, - ) - assert_matches_type(GlobalQuotas, global_, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Gcore) -> None: - response = client.cloud.quotas.global_.with_raw_response.retrieve( - 3, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - global_ = response.parse() - assert_matches_type(GlobalQuotas, global_, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Gcore) -> None: - with client.cloud.quotas.global_.with_streaming_response.retrieve( - 3, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - global_ = response.parse() - assert_matches_type(GlobalQuotas, global_, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncGlobal: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncGcore) -> None: - global_ = await async_client.cloud.quotas.global_.retrieve( - 3, - ) - assert_matches_type(GlobalQuotas, global_, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.quotas.global_.with_raw_response.retrieve( - 3, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - global_ = await response.parse() - assert_matches_type(GlobalQuotas, global_, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.quotas.global_.with_streaming_response.retrieve( - 3, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - global_ = await response.parse() - assert_matches_type(GlobalQuotas, global_, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/quotas/test_limits_request.py b/tests/api_resources/cloud/quotas/test_limits_request.py deleted file mode 100644 index 45d438ed..00000000 --- a/tests/api_resources/cloud/quotas/test_limits_request.py +++ /dev/null @@ -1,450 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from gcore import Gcore, AsyncGcore -from tests.utils import assert_matches_type -from gcore.types.cloud.quotas import LimitsRequest - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestLimitsRequest: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Gcore) -> None: - limits_request = client.cloud.quotas.limits_request.create( - description="Scale up mysql cluster", - requested_limits={}, - ) - assert limits_request is None - - @parametrize - def test_method_create_with_all_params(self, client: Gcore) -> None: - limits_request = client.cloud.quotas.limits_request.create( - description="Scale up mysql cluster", - requested_limits={ - "global_limits": { - "inference_cpu_millicore_count_limit": 0, - "inference_gpu_a100_count_limit": 0, - "inference_gpu_h100_count_limit": 0, - "inference_gpu_l40s_count_limit": 0, - "inference_instance_count_limit": 0, - "keypair_count_limit": 100, - "project_count_limit": 2, - }, - "regional_limits": [ - { - "baremetal_basic_count_limit": 0, - "baremetal_gpu_count_limit": 0, - "baremetal_hf_count_limit": 0, - "baremetal_infrastructure_count_limit": 0, - "baremetal_network_count_limit": 0, - "baremetal_storage_count_limit": 0, - "caas_container_count_limit": 0, - "caas_cpu_count_limit": 0, - "caas_gpu_count_limit": 0, - "caas_ram_size_limit": 0, - "cluster_count_limit": 0, - "cpu_count_limit": 0, - "dbaas_postgres_cluster_count_limit": 0, - "external_ip_count_limit": 0, - "faas_cpu_count_limit": 0, - "faas_function_count_limit": 0, - "faas_namespace_count_limit": 0, - "faas_ram_size_limit": 0, - "firewall_count_limit": 0, - "floating_count_limit": 0, - "gpu_count_limit": 0, - "gpu_virtual_a100_count_limit": 0, - "gpu_virtual_h100_count_limit": 0, - "gpu_virtual_l40s_count_limit": 0, - "image_count_limit": 0, - "image_size_limit": 0, - "ipu_count_limit": 0, - "laas_topic_count_limit": 0, - "loadbalancer_count_limit": 0, - "network_count_limit": 0, - "ram_limit": 0, - "region_id": 1, - "registry_count_limit": 0, - "registry_storage_limit": 0, - "router_count_limit": 0, - "secret_count_limit": 0, - "servergroup_count_limit": 0, - "sfs_count_limit": 0, - "sfs_size_limit": 0, - "shared_vm_count_limit": 0, - "snapshot_schedule_count_limit": 0, - "subnet_count_limit": 0, - "vm_count_limit": 0, - "volume_count_limit": 0, - "volume_size_limit": 0, - "volume_snapshots_count_limit": 0, - "volume_snapshots_size_limit": 0, - } - ], - }, - client_id=1, - ) - assert limits_request is None - - @parametrize - def test_raw_response_create(self, client: Gcore) -> None: - response = client.cloud.quotas.limits_request.with_raw_response.create( - description="Scale up mysql cluster", - requested_limits={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - limits_request = response.parse() - assert limits_request is None - - @parametrize - def test_streaming_response_create(self, client: Gcore) -> None: - with client.cloud.quotas.limits_request.with_streaming_response.create( - description="Scale up mysql cluster", - requested_limits={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - limits_request = response.parse() - assert limits_request is None - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_retrieve(self, client: Gcore) -> None: - limits_request = client.cloud.quotas.limits_request.retrieve( - "request_id", - ) - assert_matches_type(LimitsRequest, limits_request, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Gcore) -> None: - response = client.cloud.quotas.limits_request.with_raw_response.retrieve( - "request_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - limits_request = response.parse() - assert_matches_type(LimitsRequest, limits_request, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Gcore) -> None: - with client.cloud.quotas.limits_request.with_streaming_response.retrieve( - "request_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - limits_request = response.parse() - assert_matches_type(LimitsRequest, limits_request, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): - client.cloud.quotas.limits_request.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_list(self, client: Gcore) -> None: - limits_request = client.cloud.quotas.limits_request.list() - assert limits_request is None - - @parametrize - def test_method_list_with_all_params(self, client: Gcore) -> None: - limits_request = client.cloud.quotas.limits_request.list( - limit=1000, - offset=0, - status=["done", "in progress"], - ) - assert limits_request is None - - @parametrize - def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.quotas.limits_request.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - limits_request = response.parse() - assert limits_request is None - - @parametrize - def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.quotas.limits_request.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - limits_request = response.parse() - assert limits_request is None - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_delete(self, client: Gcore) -> None: - limits_request = client.cloud.quotas.limits_request.delete( - "request_id", - ) - assert limits_request is None - - @parametrize - def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.quotas.limits_request.with_raw_response.delete( - "request_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - limits_request = response.parse() - assert limits_request is None - - @parametrize - def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.quotas.limits_request.with_streaming_response.delete( - "request_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - limits_request = response.parse() - assert limits_request is None - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): - client.cloud.quotas.limits_request.with_raw_response.delete( - "", - ) - - -class TestAsyncLimitsRequest: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncGcore) -> None: - limits_request = await async_client.cloud.quotas.limits_request.create( - description="Scale up mysql cluster", - requested_limits={}, - ) - assert limits_request is None - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - limits_request = await async_client.cloud.quotas.limits_request.create( - description="Scale up mysql cluster", - requested_limits={ - "global_limits": { - "inference_cpu_millicore_count_limit": 0, - "inference_gpu_a100_count_limit": 0, - "inference_gpu_h100_count_limit": 0, - "inference_gpu_l40s_count_limit": 0, - "inference_instance_count_limit": 0, - "keypair_count_limit": 100, - "project_count_limit": 2, - }, - "regional_limits": [ - { - "baremetal_basic_count_limit": 0, - "baremetal_gpu_count_limit": 0, - "baremetal_hf_count_limit": 0, - "baremetal_infrastructure_count_limit": 0, - "baremetal_network_count_limit": 0, - "baremetal_storage_count_limit": 0, - "caas_container_count_limit": 0, - "caas_cpu_count_limit": 0, - "caas_gpu_count_limit": 0, - "caas_ram_size_limit": 0, - "cluster_count_limit": 0, - "cpu_count_limit": 0, - "dbaas_postgres_cluster_count_limit": 0, - "external_ip_count_limit": 0, - "faas_cpu_count_limit": 0, - "faas_function_count_limit": 0, - "faas_namespace_count_limit": 0, - "faas_ram_size_limit": 0, - "firewall_count_limit": 0, - "floating_count_limit": 0, - "gpu_count_limit": 0, - "gpu_virtual_a100_count_limit": 0, - "gpu_virtual_h100_count_limit": 0, - "gpu_virtual_l40s_count_limit": 0, - "image_count_limit": 0, - "image_size_limit": 0, - "ipu_count_limit": 0, - "laas_topic_count_limit": 0, - "loadbalancer_count_limit": 0, - "network_count_limit": 0, - "ram_limit": 0, - "region_id": 1, - "registry_count_limit": 0, - "registry_storage_limit": 0, - "router_count_limit": 0, - "secret_count_limit": 0, - "servergroup_count_limit": 0, - "sfs_count_limit": 0, - "sfs_size_limit": 0, - "shared_vm_count_limit": 0, - "snapshot_schedule_count_limit": 0, - "subnet_count_limit": 0, - "vm_count_limit": 0, - "volume_count_limit": 0, - "volume_size_limit": 0, - "volume_snapshots_count_limit": 0, - "volume_snapshots_size_limit": 0, - } - ], - }, - client_id=1, - ) - assert limits_request is None - - @parametrize - async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.quotas.limits_request.with_raw_response.create( - description="Scale up mysql cluster", - requested_limits={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - limits_request = await response.parse() - assert limits_request is None - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.quotas.limits_request.with_streaming_response.create( - description="Scale up mysql cluster", - requested_limits={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - limits_request = await response.parse() - assert limits_request is None - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_retrieve(self, async_client: AsyncGcore) -> None: - limits_request = await async_client.cloud.quotas.limits_request.retrieve( - "request_id", - ) - assert_matches_type(LimitsRequest, limits_request, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.quotas.limits_request.with_raw_response.retrieve( - "request_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - limits_request = await response.parse() - assert_matches_type(LimitsRequest, limits_request, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.quotas.limits_request.with_streaming_response.retrieve( - "request_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - limits_request = await response.parse() - assert_matches_type(LimitsRequest, limits_request, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): - await async_client.cloud.quotas.limits_request.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncGcore) -> None: - limits_request = await async_client.cloud.quotas.limits_request.list() - assert limits_request is None - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - limits_request = await async_client.cloud.quotas.limits_request.list( - limit=1000, - offset=0, - status=["done", "in progress"], - ) - assert limits_request is None - - @parametrize - async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.quotas.limits_request.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - limits_request = await response.parse() - assert limits_request is None - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.quotas.limits_request.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - limits_request = await response.parse() - assert limits_request is None - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncGcore) -> None: - limits_request = await async_client.cloud.quotas.limits_request.delete( - "request_id", - ) - assert limits_request is None - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.quotas.limits_request.with_raw_response.delete( - "request_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - limits_request = await response.parse() - assert limits_request is None - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.quotas.limits_request.with_streaming_response.delete( - "request_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - limits_request = await response.parse() - assert limits_request is None - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): - await async_client.cloud.quotas.limits_request.with_raw_response.delete( - "", - ) diff --git a/tests/api_resources/cloud/quotas/test_regional.py b/tests/api_resources/cloud/quotas/test_regional.py deleted file mode 100644 index c4467845..00000000 --- a/tests/api_resources/cloud/quotas/test_regional.py +++ /dev/null @@ -1,90 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from gcore import Gcore, AsyncGcore -from tests.utils import assert_matches_type -from gcore.types.cloud.quotas import RegionalQuotas - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestRegional: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: Gcore) -> None: - regional = client.cloud.quotas.regional.retrieve( - client_id=3, - region_id=1, - ) - assert_matches_type(RegionalQuotas, regional, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Gcore) -> None: - response = client.cloud.quotas.regional.with_raw_response.retrieve( - client_id=3, - region_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - regional = response.parse() - assert_matches_type(RegionalQuotas, regional, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Gcore) -> None: - with client.cloud.quotas.regional.with_streaming_response.retrieve( - client_id=3, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - regional = response.parse() - assert_matches_type(RegionalQuotas, regional, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncRegional: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncGcore) -> None: - regional = await async_client.cloud.quotas.regional.retrieve( - client_id=3, - region_id=1, - ) - assert_matches_type(RegionalQuotas, regional, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.quotas.regional.with_raw_response.retrieve( - client_id=3, - region_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - regional = await response.parse() - assert_matches_type(RegionalQuotas, regional, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.quotas.regional.with_streaming_response.retrieve( - client_id=3, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - regional = await response.parse() - assert_matches_type(RegionalQuotas, regional, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/test_client.py b/tests/test_client.py index 3486ea61..7d46e3b4 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -373,11 +373,11 @@ def test_region_id_client_params(self) -> None: with client as c2: with pytest.raises(ValueError, match="Missing region_id argument;"): - c2.cloud.quotas.regional.retrieve(client_id=3) + c2.cloud.regions.retrieve() client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, region_id=0) with client as c2: - c2.cloud.quotas.regional.retrieve(client_id=3) + c2.cloud.regions.retrieve() def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1159,11 +1159,11 @@ async def test_region_id_client_params(self) -> None: async with client as c2: with pytest.raises(ValueError, match="Missing region_id argument;"): - await c2.cloud.quotas.regional.retrieve(client_id=3) + await c2.cloud.regions.retrieve() client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, region_id=0) async with client as c2: - await c2.cloud.quotas.regional.retrieve(client_id=3) + await c2.cloud.regions.retrieve() def test_request_extra_json(self) -> None: request = self.client._build_request( From 121cad8f7c4b67322cd1d47c23fc745da20248a7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 13:31:11 +0000 Subject: [PATCH 011/592] GCLOUD2-18513 Use replace instead of update for projects --- .stats.yml | 2 +- api.md | 2 +- src/gcore/resources/cloud/projects.py | 210 +++++++++--------- src/gcore/types/cloud/__init__.py | 2 +- ...te_params.py => project_replace_params.py} | 4 +- tests/api_resources/cloud/test_projects.py | 172 +++++++------- 6 files changed, 196 insertions(+), 196 deletions(-) rename src/gcore/types/cloud/{project_update_params.py => project_replace_params.py} (81%) diff --git a/.stats.yml b/.stats.yml index c888fa4f..1ddce1ff 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 7 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3ad4b479c2f5ef082c85b8b6d740987688b8b5a4fded84db682eeb0743b5b185.yml openapi_spec_hash: 82182a92ba1c4c66f5634eb1a0c6ba7b -config_hash: a12d73d67942b05226126ec381161016 +config_hash: a2c91a4f5450a10489fecc9830425309 diff --git a/api.md b/api.md index a40f2949..042e27d0 100644 --- a/api.md +++ b/api.md @@ -12,9 +12,9 @@ Methods: - client.cloud.projects.create(\*\*params) -> Project - client.cloud.projects.retrieve(\*, project_id) -> Project -- client.cloud.projects.update(\*, project_id, \*\*params) -> Project - client.cloud.projects.list(\*\*params) -> ProjectListResponse - client.cloud.projects.delete(\*, project_id) -> ProjectDeleteResponse +- client.cloud.projects.replace(\*, project_id, \*\*params) -> Project ## Regions diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 05ecc31c..426fd7ca 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -20,7 +20,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...types.cloud import project_list_params, project_create_params, project_update_params +from ...types.cloud import project_list_params, project_create_params, project_replace_params from ..._base_client import make_request_options from ...types.cloud.project import Project from ...types.cloud.project_list_response import ProjectListResponse @@ -134,52 +134,6 @@ def retrieve( cast_to=Project, ) - def update( - self, - *, - project_id: int | None = None, - name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Project: - """ - Update Project - - Args: - name: Name of the entity, following a specific format. - - description: Description of the project. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_project_id_path_param() - return self._put( - f"/cloud/v1/projects/{project_id}", - body=maybe_transform( - { - "name": name, - "description": description, - }, - project_update_params.ProjectUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Project, - ) - def list( self, *, @@ -268,6 +222,52 @@ def delete( cast_to=ProjectDeleteResponse, ) + def replace( + self, + *, + project_id: int | None = None, + name: str, + description: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Project: + """ + Update Project + + Args: + name: Name of the entity, following a specific format. + + description: Description of the project. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + return self._put( + f"/cloud/v1/projects/{project_id}", + body=maybe_transform( + { + "name": name, + "description": description, + }, + project_replace_params.ProjectReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Project, + ) + class AsyncProjectsResource(AsyncAPIResource): @cached_property @@ -374,52 +374,6 @@ async def retrieve( cast_to=Project, ) - async def update( - self, - *, - project_id: int | None = None, - name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Project: - """ - Update Project - - Args: - name: Name of the entity, following a specific format. - - description: Description of the project. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_project_id_path_param() - return await self._put( - f"/cloud/v1/projects/{project_id}", - body=await async_maybe_transform( - { - "name": name, - "description": description, - }, - project_update_params.ProjectUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Project, - ) - async def list( self, *, @@ -508,6 +462,52 @@ async def delete( cast_to=ProjectDeleteResponse, ) + async def replace( + self, + *, + project_id: int | None = None, + name: str, + description: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Project: + """ + Update Project + + Args: + name: Name of the entity, following a specific format. + + description: Description of the project. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + return await self._put( + f"/cloud/v1/projects/{project_id}", + body=await async_maybe_transform( + { + "name": name, + "description": description, + }, + project_replace_params.ProjectReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Project, + ) + class ProjectsResourceWithRawResponse: def __init__(self, projects: ProjectsResource) -> None: @@ -519,15 +519,15 @@ def __init__(self, projects: ProjectsResource) -> None: self.retrieve = to_raw_response_wrapper( projects.retrieve, ) - self.update = to_raw_response_wrapper( - projects.update, - ) self.list = to_raw_response_wrapper( projects.list, ) self.delete = to_raw_response_wrapper( projects.delete, ) + self.replace = to_raw_response_wrapper( + projects.replace, + ) class AsyncProjectsResourceWithRawResponse: @@ -540,15 +540,15 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.retrieve = async_to_raw_response_wrapper( projects.retrieve, ) - self.update = async_to_raw_response_wrapper( - projects.update, - ) self.list = async_to_raw_response_wrapper( projects.list, ) self.delete = async_to_raw_response_wrapper( projects.delete, ) + self.replace = async_to_raw_response_wrapper( + projects.replace, + ) class ProjectsResourceWithStreamingResponse: @@ -561,15 +561,15 @@ def __init__(self, projects: ProjectsResource) -> None: self.retrieve = to_streamed_response_wrapper( projects.retrieve, ) - self.update = to_streamed_response_wrapper( - projects.update, - ) self.list = to_streamed_response_wrapper( projects.list, ) self.delete = to_streamed_response_wrapper( projects.delete, ) + self.replace = to_streamed_response_wrapper( + projects.replace, + ) class AsyncProjectsResourceWithStreamingResponse: @@ -582,12 +582,12 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.retrieve = async_to_streamed_response_wrapper( projects.retrieve, ) - self.update = async_to_streamed_response_wrapper( - projects.update, - ) self.list = async_to_streamed_response_wrapper( projects.list, ) self.delete = async_to_streamed_response_wrapper( projects.delete, ) + self.replace = async_to_streamed_response_wrapper( + projects.replace, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index ca2bc852..19b21695 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -8,6 +8,6 @@ from .project_list_params import ProjectListParams as ProjectListParams from .project_create_params import ProjectCreateParams as ProjectCreateParams from .project_list_response import ProjectListResponse as ProjectListResponse -from .project_update_params import ProjectUpdateParams as ProjectUpdateParams +from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams from .project_delete_response import ProjectDeleteResponse as ProjectDeleteResponse diff --git a/src/gcore/types/cloud/project_update_params.py b/src/gcore/types/cloud/project_replace_params.py similarity index 81% rename from src/gcore/types/cloud/project_update_params.py rename to src/gcore/types/cloud/project_replace_params.py index 42489cb1..c26f1c6f 100644 --- a/src/gcore/types/cloud/project_update_params.py +++ b/src/gcore/types/cloud/project_replace_params.py @@ -5,10 +5,10 @@ from typing import Optional from typing_extensions import Required, TypedDict -__all__ = ["ProjectUpdateParams"] +__all__ = ["ProjectReplaceParams"] -class ProjectUpdateParams(TypedDict, total=False): +class ProjectReplaceParams(TypedDict, total=False): project_id: int name: Required[str] diff --git a/tests/api_resources/cloud/test_projects.py b/tests/api_resources/cloud/test_projects.py index e666537e..21f6e362 100644 --- a/tests/api_resources/cloud/test_projects.py +++ b/tests/api_resources/cloud/test_projects.py @@ -93,49 +93,6 @@ def test_streaming_response_retrieve(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_update(self, client: Gcore) -> None: - project = client.cloud.projects.update( - project_id=0, - name="New Project", - ) - assert_matches_type(Project, project, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Gcore) -> None: - project = client.cloud.projects.update( - project_id=0, - name="New Project", - description="Project description", - ) - assert_matches_type(Project, project, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.projects.with_raw_response.update( - project_id=0, - name="New Project", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() - assert_matches_type(Project, project, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.projects.with_streaming_response.update( - project_id=0, - name="New Project", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = response.parse() - assert_matches_type(Project, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize def test_method_list(self, client: Gcore) -> None: project = client.cloud.projects.list() @@ -202,62 +159,74 @@ def test_streaming_response_delete(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - -class TestAsyncProjects: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - @parametrize - async def test_method_create(self, async_client: AsyncGcore) -> None: - project = await async_client.cloud.projects.create( + def test_method_replace(self, client: Gcore) -> None: + project = client.cloud.projects.replace( + project_id=0, name="New Project", ) assert_matches_type(Project, project, path=["response"]) @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - project = await async_client.cloud.projects.create( + def test_method_replace_with_all_params(self, client: Gcore) -> None: + project = client.cloud.projects.replace( + project_id=0, name="New Project", - client_id=3, description="Project description", - state="ACTIVE", ) assert_matches_type(Project, project, path=["response"]) @parametrize - async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.projects.with_raw_response.create( + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cloud.projects.with_raw_response.replace( + project_id=0, name="New Project", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() + project = response.parse() assert_matches_type(Project, project, path=["response"]) @parametrize - async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.projects.with_streaming_response.create( + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cloud.projects.with_streaming_response.replace( + project_id=0, name="New Project", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() + project = response.parse() assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True + +class TestAsyncProjects: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize - async def test_method_retrieve(self, async_client: AsyncGcore) -> None: - project = await async_client.cloud.projects.retrieve( - project_id=0, + async def test_method_create(self, async_client: AsyncGcore) -> None: + project = await async_client.cloud.projects.create( + name="New Project", ) assert_matches_type(Project, project, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.projects.with_raw_response.retrieve( - project_id=0, + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + project = await async_client.cloud.projects.create( + name="New Project", + client_id=3, + description="Project description", + state="ACTIVE", + ) + assert_matches_type(Project, project, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.projects.with_raw_response.create( + name="New Project", ) assert response.is_closed is True @@ -266,9 +235,9 @@ async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: assert_matches_type(Project, project, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.projects.with_streaming_response.retrieve( - project_id=0, + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.projects.with_streaming_response.create( + name="New Project", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -279,27 +248,16 @@ async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> No assert cast(Any, response.is_closed) is True @parametrize - async def test_method_update(self, async_client: AsyncGcore) -> None: - project = await async_client.cloud.projects.update( + async def test_method_retrieve(self, async_client: AsyncGcore) -> None: + project = await async_client.cloud.projects.retrieve( project_id=0, - name="New 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="New 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( + async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.projects.with_raw_response.retrieve( project_id=0, - name="New Project", ) assert response.is_closed is True @@ -308,10 +266,9 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: assert_matches_type(Project, project, path=["response"]) @parametrize - async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.projects.with_streaming_response.update( + async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.projects.with_streaming_response.retrieve( project_id=0, - name="New Project", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -386,3 +343,46 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None assert_matches_type(ProjectDeleteResponse, project, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + project = await async_client.cloud.projects.replace( + project_id=0, + name="New Project", + ) + assert_matches_type(Project, project, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + project = await async_client.cloud.projects.replace( + project_id=0, + name="New Project", + description="Project description", + ) + assert_matches_type(Project, project, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.projects.with_raw_response.replace( + project_id=0, + name="New Project", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + project = await response.parse() + assert_matches_type(Project, project, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.projects.with_streaming_response.replace( + project_id=0, + name="New Project", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + project = await response.parse() + assert_matches_type(Project, project, path=["response"]) + + assert cast(Any, response.is_closed) is True From f9441077ef1fda47ac5181780a9d0e11e0e99198 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 04:05:04 +0000 Subject: [PATCH 012/592] chore(internal): expand CI branch coverage --- .github/workflows/ci.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b286e5a..53a3a09c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,18 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'preview-head/**' + - 'preview-base/**' + - 'preview/**' jobs: lint: name: lint runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 @@ -33,7 +33,6 @@ jobs: test: name: test runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 From 94e23497eb18fc8f68d69f9ea475e021f56c39a4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 04:09:23 +0000 Subject: [PATCH 013/592] chore(internal): reduce CI branch coverage --- .github/workflows/ci.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53a3a09c..81f6dc20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,12 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'preview-head/**' - - 'preview-base/**' - - 'preview/**' + branches: + - main + pull_request: + branches: + - main + - next jobs: lint: From 35abd0b75e3c5da94795e9f37b7c19339cad6c22 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 11:07:08 +0000 Subject: [PATCH 014/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1ddce1ff..499aa081 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 7 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3ad4b479c2f5ef082c85b8b6d740987688b8b5a4fded84db682eeb0743b5b185.yml -openapi_spec_hash: 82182a92ba1c4c66f5634eb1a0c6ba7b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-438b138b39bd4fd83cf6c691b89f54b1140d9187784870471405809a05991bb9.yml +openapi_spec_hash: b9ed2cc78be81accc812b408ab694eef config_hash: a2c91a4f5450a10489fecc9830425309 From 42153a2492975bea8a076640e4d91ca509b45c29 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 12:24:19 +0000 Subject: [PATCH 015/592] GCLOUD2-18523 Add cloud tasks --- .stats.yml | 4 +- api.md | 13 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 ++ src/gcore/resources/cloud/tasks.py | 436 ++++++++++++++++++++++ src/gcore/types/cloud/__init__.py | 2 + src/gcore/types/cloud/task.py | 191 ++++++++++ src/gcore/types/cloud/task_list_params.py | 102 +++++ tests/api_resources/cloud/test_tasks.py | 182 +++++++++ 9 files changed, 974 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/tasks.py create mode 100644 src/gcore/types/cloud/task.py create mode 100644 src/gcore/types/cloud/task_list_params.py create mode 100644 tests/api_resources/cloud/test_tasks.py diff --git a/.stats.yml b/.stats.yml index 499aa081..2338ef4a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 7 +configured_endpoints: 9 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-438b138b39bd4fd83cf6c691b89f54b1140d9187784870471405809a05991bb9.yml openapi_spec_hash: b9ed2cc78be81accc812b408ab694eef -config_hash: a2c91a4f5450a10489fecc9830425309 +config_hash: 4357c616f6b736937074936b545083a0 diff --git a/api.md b/api.md index 042e27d0..8a680c76 100644 --- a/api.md +++ b/api.md @@ -16,6 +16,19 @@ Methods: - client.cloud.projects.delete(\*, project_id) -> ProjectDeleteResponse - client.cloud.projects.replace(\*, project_id, \*\*params) -> Project +## Tasks + +Types: + +```python +from gcore.types.cloud import Task +``` + +Methods: + +- client.cloud.tasks.retrieve(task_id) -> Task +- client.cloud.tasks.list(\*\*params) -> SyncOffsetPage[Task] + ## Regions Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 21a9d255..6720fdc0 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -8,6 +8,14 @@ CloudResourceWithStreamingResponse, AsyncCloudResourceWithStreamingResponse, ) +from .tasks import ( + TasksResource, + AsyncTasksResource, + TasksResourceWithRawResponse, + AsyncTasksResourceWithRawResponse, + TasksResourceWithStreamingResponse, + AsyncTasksResourceWithStreamingResponse, +) from .regions import ( RegionsResource, AsyncRegionsResource, @@ -32,6 +40,12 @@ "AsyncProjectsResourceWithRawResponse", "ProjectsResourceWithStreamingResponse", "AsyncProjectsResourceWithStreamingResponse", + "TasksResource", + "AsyncTasksResource", + "TasksResourceWithRawResponse", + "AsyncTasksResourceWithRawResponse", + "TasksResourceWithStreamingResponse", + "AsyncTasksResourceWithStreamingResponse", "RegionsResource", "AsyncRegionsResource", "RegionsResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 749a3a49..4133f69f 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -2,6 +2,14 @@ from __future__ import annotations +from .tasks import ( + TasksResource, + AsyncTasksResource, + TasksResourceWithRawResponse, + AsyncTasksResourceWithRawResponse, + TasksResourceWithStreamingResponse, + AsyncTasksResourceWithStreamingResponse, +) from .regions import ( RegionsResource, AsyncRegionsResource, @@ -29,6 +37,10 @@ class CloudResource(SyncAPIResource): def projects(self) -> ProjectsResource: return ProjectsResource(self._client) + @cached_property + def tasks(self) -> TasksResource: + return TasksResource(self._client) + @cached_property def regions(self) -> RegionsResource: return RegionsResource(self._client) @@ -58,6 +70,10 @@ class AsyncCloudResource(AsyncAPIResource): def projects(self) -> AsyncProjectsResource: return AsyncProjectsResource(self._client) + @cached_property + def tasks(self) -> AsyncTasksResource: + return AsyncTasksResource(self._client) + @cached_property def regions(self) -> AsyncRegionsResource: return AsyncRegionsResource(self._client) @@ -90,6 +106,10 @@ def __init__(self, cloud: CloudResource) -> None: def projects(self) -> ProjectsResourceWithRawResponse: return ProjectsResourceWithRawResponse(self._cloud.projects) + @cached_property + def tasks(self) -> TasksResourceWithRawResponse: + return TasksResourceWithRawResponse(self._cloud.tasks) + @cached_property def regions(self) -> RegionsResourceWithRawResponse: return RegionsResourceWithRawResponse(self._cloud.regions) @@ -103,6 +123,10 @@ def __init__(self, cloud: AsyncCloudResource) -> None: def projects(self) -> AsyncProjectsResourceWithRawResponse: return AsyncProjectsResourceWithRawResponse(self._cloud.projects) + @cached_property + def tasks(self) -> AsyncTasksResourceWithRawResponse: + return AsyncTasksResourceWithRawResponse(self._cloud.tasks) + @cached_property def regions(self) -> AsyncRegionsResourceWithRawResponse: return AsyncRegionsResourceWithRawResponse(self._cloud.regions) @@ -116,6 +140,10 @@ def __init__(self, cloud: CloudResource) -> None: def projects(self) -> ProjectsResourceWithStreamingResponse: return ProjectsResourceWithStreamingResponse(self._cloud.projects) + @cached_property + def tasks(self) -> TasksResourceWithStreamingResponse: + return TasksResourceWithStreamingResponse(self._cloud.tasks) + @cached_property def regions(self) -> RegionsResourceWithStreamingResponse: return RegionsResourceWithStreamingResponse(self._cloud.regions) @@ -129,6 +157,10 @@ def __init__(self, cloud: AsyncCloudResource) -> None: def projects(self) -> AsyncProjectsResourceWithStreamingResponse: return AsyncProjectsResourceWithStreamingResponse(self._cloud.projects) + @cached_property + def tasks(self) -> AsyncTasksResourceWithStreamingResponse: + return AsyncTasksResourceWithStreamingResponse(self._cloud.tasks) + @cached_property def regions(self) -> AsyncRegionsResourceWithStreamingResponse: return AsyncRegionsResourceWithStreamingResponse(self._cloud.regions) diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py new file mode 100644 index 00000000..59e1d76f --- /dev/null +++ b/src/gcore/resources/cloud/tasks.py @@ -0,0 +1,436 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable, Optional +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ...types.cloud import task_list_params +from ..._base_client import AsyncPaginator, make_request_options +from ...types.cloud.task import Task + +__all__ = ["TasksResource", "AsyncTasksResource"] + + +class TasksResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TasksResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return TasksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TasksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return TasksResourceWithStreamingResponse(self) + + def retrieve( + self, + task_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Task: + """ + Get task + + Args: + task_id: Task ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return self._get( + f"/cloud/v1/tasks/{task_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + def list( + self, + *, + from_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + is_acknowledged: Optional[bool] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + project_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, + region_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, + sorting: Optional[Literal["asc", "desc"]] | NotGiven = NOT_GIVEN, + state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] | NotGiven = NOT_GIVEN, + task_type: Optional[str] | NotGiven = NOT_GIVEN, + to_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[Task]: + """List tasks + + Args: + from_timestamp: ISO formatted datetime string. + + Filter the tasks by creation date greater than or + equal to from_timestamp + + is_acknowledged: Filter the tasks by their acknowledgement status + + limit: Limit the number of returned tasks. Falls back to default of 10 if not + specified. Limited by max limit value of 1000 + + offset: Offset value is used to exclude the first set of records from the result + + project_id: The project ID to filter the tasks by project. Supports multiple values of kind + key=value1&key=value2 + + region_id: The region ID to filter the tasks by region. Supports multiple values of kind + key=value1&key=value2 + + sorting: Sorting by creation date. Oldest first, or most recent first + + state: Filter the tasks by state. Supports multiple values of kind + key=value1&key=value2 + + task_type: Filter the tasks by their type one of ['activate_ddos_profile', + 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', + 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', + 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', + 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', + 'create_fip', 'create_gpu_virtual_cluster', 'create_image', + 'create_inference_instance', 'create_inference_instance_key', + 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', + 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', + 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', + 'create_reserved_fixed_ip', 'create_router', 'create_secret', + 'create_servergroup', 'create_sfs', 'create_snapshot', 'create_subnet', + 'create_vm', 'create_volume', 'deactivate_ddos_profile', + 'delete_ai_cluster_gpu', 'delete_caas_container', + 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', + 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', + 'delete_image', 'delete_inference_instance', 'delete_k8s_cluster_pool_v2', + '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', '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', + 'replace_lbmetadata', 'resize_k8s_cluster_v2', 'resize_loadbalancer', + 'resize_vm', 'resume_vm', 'revert_volume', 'soft_reboot_gpu_baremetal_server', + 'soft_reboot_gpu_virtual_cluster', 'soft_reboot_gpu_virtual_server', + 'soft_reboot_vm', 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', + 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', + 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', + 'sync_private_flavors', 'update_ddos_profile', 'update_inference_instance', + 'update_inference_instance_key', 'update_k8s_cluster_v2', 'update_lbmetadata', + 'update_port_allowed_address_pairs', 'update_tags_gpu_virtual_cluster', + 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu'] + + to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or + equal to to_timestamp + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v1/tasks", + page=SyncOffsetPage[Task], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_timestamp": from_timestamp, + "is_acknowledged": is_acknowledged, + "limit": limit, + "offset": offset, + "project_id": project_id, + "region_id": region_id, + "sorting": sorting, + "state": state, + "task_type": task_type, + "to_timestamp": to_timestamp, + }, + task_list_params.TaskListParams, + ), + ), + model=Task, + ) + + +class AsyncTasksResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTasksResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncTasksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTasksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncTasksResourceWithStreamingResponse(self) + + async def retrieve( + self, + task_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Task: + """ + Get task + + Args: + task_id: Task ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return await self._get( + f"/cloud/v1/tasks/{task_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + def list( + self, + *, + from_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + is_acknowledged: Optional[bool] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + project_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, + region_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, + sorting: Optional[Literal["asc", "desc"]] | NotGiven = NOT_GIVEN, + state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] | NotGiven = NOT_GIVEN, + task_type: Optional[str] | NotGiven = NOT_GIVEN, + to_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Task, AsyncOffsetPage[Task]]: + """List tasks + + Args: + from_timestamp: ISO formatted datetime string. + + Filter the tasks by creation date greater than or + equal to from_timestamp + + is_acknowledged: Filter the tasks by their acknowledgement status + + limit: Limit the number of returned tasks. Falls back to default of 10 if not + specified. Limited by max limit value of 1000 + + offset: Offset value is used to exclude the first set of records from the result + + project_id: The project ID to filter the tasks by project. Supports multiple values of kind + key=value1&key=value2 + + region_id: The region ID to filter the tasks by region. Supports multiple values of kind + key=value1&key=value2 + + sorting: Sorting by creation date. Oldest first, or most recent first + + state: Filter the tasks by state. Supports multiple values of kind + key=value1&key=value2 + + task_type: Filter the tasks by their type one of ['activate_ddos_profile', + 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', + 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', + 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', + 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', + 'create_fip', 'create_gpu_virtual_cluster', 'create_image', + 'create_inference_instance', 'create_inference_instance_key', + 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', + 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', + 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', + 'create_reserved_fixed_ip', 'create_router', 'create_secret', + 'create_servergroup', 'create_sfs', 'create_snapshot', 'create_subnet', + 'create_vm', 'create_volume', 'deactivate_ddos_profile', + 'delete_ai_cluster_gpu', 'delete_caas_container', + 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', + 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', + 'delete_image', 'delete_inference_instance', 'delete_k8s_cluster_pool_v2', + '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', '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', + 'replace_lbmetadata', 'resize_k8s_cluster_v2', 'resize_loadbalancer', + 'resize_vm', 'resume_vm', 'revert_volume', 'soft_reboot_gpu_baremetal_server', + 'soft_reboot_gpu_virtual_cluster', 'soft_reboot_gpu_virtual_server', + 'soft_reboot_vm', 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', + 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', + 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', + 'sync_private_flavors', 'update_ddos_profile', 'update_inference_instance', + 'update_inference_instance_key', 'update_k8s_cluster_v2', 'update_lbmetadata', + 'update_port_allowed_address_pairs', 'update_tags_gpu_virtual_cluster', + 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu'] + + to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or + equal to to_timestamp + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v1/tasks", + page=AsyncOffsetPage[Task], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_timestamp": from_timestamp, + "is_acknowledged": is_acknowledged, + "limit": limit, + "offset": offset, + "project_id": project_id, + "region_id": region_id, + "sorting": sorting, + "state": state, + "task_type": task_type, + "to_timestamp": to_timestamp, + }, + task_list_params.TaskListParams, + ), + ), + model=Task, + ) + + +class TasksResourceWithRawResponse: + def __init__(self, tasks: TasksResource) -> None: + self._tasks = tasks + + self.retrieve = to_raw_response_wrapper( + tasks.retrieve, + ) + self.list = to_raw_response_wrapper( + tasks.list, + ) + + +class AsyncTasksResourceWithRawResponse: + def __init__(self, tasks: AsyncTasksResource) -> None: + self._tasks = tasks + + self.retrieve = async_to_raw_response_wrapper( + tasks.retrieve, + ) + self.list = async_to_raw_response_wrapper( + tasks.list, + ) + + +class TasksResourceWithStreamingResponse: + def __init__(self, tasks: TasksResource) -> None: + self._tasks = tasks + + self.retrieve = to_streamed_response_wrapper( + tasks.retrieve, + ) + self.list = to_streamed_response_wrapper( + tasks.list, + ) + + +class AsyncTasksResourceWithStreamingResponse: + def __init__(self, tasks: AsyncTasksResource) -> None: + self._tasks = tasks + + self.retrieve = async_to_streamed_response_wrapper( + tasks.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + tasks.list, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 19b21695..2387c8e4 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -2,8 +2,10 @@ from __future__ import annotations +from .task import Task as Task from .region import Region as Region from .project import Project as Project +from .task_list_params import TaskListParams as TaskListParams from .region_list_params import RegionListParams as RegionListParams from .project_list_params import ProjectListParams as ProjectListParams from .project_create_params import ProjectCreateParams as ProjectCreateParams diff --git a/src/gcore/types/cloud/task.py b/src/gcore/types/cloud/task.py new file mode 100644 index 00000000..8248a3ef --- /dev/null +++ b/src/gcore/types/cloud/task.py @@ -0,0 +1,191 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Task", "CreatedResources"] + + +class CreatedResources(BaseModel): + ai_clusters: Optional[List[str]] = None + """IDs of created AI clusters""" + + api_keys: Optional[List[str]] = None + """IDs of created API keys""" + + caas_containers: Optional[List[str]] = None + """IDs of created CaaS containers""" + + ddos_profiles: Optional[List[int]] = None + """IDs of created ddos protection profiles""" + + faas_functions: Optional[List[str]] = None + """IDs of created FaaS functions""" + + faas_namespaces: Optional[List[str]] = None + """IDs of created FaaS namespaces""" + + file_shares: Optional[List[str]] = None + """IDs of created file shares""" + + floatingips: Optional[List[str]] = None + """IDs of created floating IPs""" + + healthmonitors: Optional[List[str]] = None + """IDs of created health monitors""" + + heat: Optional[List[str]] = None + """IDs of created heat resources""" + + images: Optional[List[str]] = None + """IDs of created images""" + + inference_instances: Optional[List[str]] = None + """IDs of created inference instances""" + + instances: Optional[List[str]] = None + """IDs of created instances""" + + k8s_clusters: Optional[List[str]] = None + """IDs of created Kubernetes clusters""" + + k8s_pools: Optional[List[str]] = None + """IDs of created Kubernetes pools""" + + l7polices: Optional[List[str]] = None + """IDs of created L7 policies""" + + l7rules: Optional[List[str]] = None + """IDs of created L7 rules""" + + laas_topic: Optional[List[str]] = None + """IDs of created LaaS topics""" + + listeners: Optional[List[str]] = None + """IDs of created load balancer listeners""" + + loadbalancers: Optional[List[str]] = None + """IDs of created load balancers""" + + members: Optional[List[str]] = None + """IDs of created pool members""" + + networks: Optional[List[str]] = None + """IDs of created networks""" + + pools: Optional[List[str]] = None + """IDs of created load balancer pools""" + + ports: Optional[List[str]] = None + """IDs of created ports""" + + postgresql_clusters: Optional[List[str]] = None + """IDs of created postgres clusters""" + + projects: Optional[List[int]] = None + """IDs of created projects""" + + registry_registries: Optional[List[str]] = None + """IDs of created registry registries""" + + registry_users: Optional[List[str]] = None + """IDs of created registry users""" + + routers: Optional[List[str]] = None + """IDs of created routers""" + + secrets: Optional[List[str]] = None + """IDs of created secrets""" + + servergroups: Optional[List[str]] = None + """IDs of created server groups""" + + snapshots: Optional[List[str]] = None + """IDs of created volume snapshots""" + + subnets: Optional[List[str]] = None + """IDs of created subnets""" + + volumes: Optional[List[str]] = None + """IDs of created volumes""" + + +class Task(BaseModel): + id: str + """The task ID""" + + created_on: Optional[str] = None + """Created timestamp""" + + state: str + """The task state""" + + task_type: str + """The task type""" + + user_id: int + """The user ID that initiated the task""" + + acknowledged_at: Optional[str] = None + """If task was acknowledged, this field stores acknowledge timestamp""" + + acknowledged_by: Optional[int] = None + """If task was acknowledged, this field stores user_id of the person""" + + client_id: Optional[int] = None + """The client ID""" + + created_resources: Optional[CreatedResources] = None + """If the task creates resources, this field will contain their IDs""" + + data: Optional[object] = None + """Task parameters""" + + detailed_state: Optional[ + Literal[ + "CLUSTER_CLEAN_UP", + "CLUSTER_RESIZE", + "CLUSTER_RESUME", + "CLUSTER_SUSPEND", + "ERROR", + "FINISHED", + "IPU_SERVERS", + "NETWORK", + "POPLAR_SERVERS", + "POST_DEPLOY_SETUP", + "VIPU_CONTROLLER", + ] + ] = None + """Task detailed state that is more specific to task type""" + + error: Optional[str] = None + """The error value""" + + finished_on: Optional[str] = None + """Finished timestamp""" + + job_id: Optional[str] = None + """Job ID""" + + lifecycle_policy_id: Optional[int] = None + """Lifecycle policy ID""" + + project_id: Optional[int] = None + """The project ID""" + + region_id: Optional[int] = None + """The region ID""" + + request_id: Optional[str] = None + """The request ID""" + + schedule_id: Optional[str] = None + """Schedule ID""" + + updated_on: Optional[str] = None + """Last updated timestamp""" + + user_client_id: Optional[int] = None + """Client, specified in user's JWT""" diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py new file mode 100644 index 00000000..51ed860d --- /dev/null +++ b/src/gcore/types/cloud/task_list_params.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable, Optional +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["TaskListParams"] + + +class TaskListParams(TypedDict, total=False): + from_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """ISO formatted datetime string. + + Filter the tasks by creation date greater than or equal to from_timestamp + """ + + is_acknowledged: Optional[bool] + """Filter the tasks by their acknowledgement status""" + + limit: int + """Limit the number of returned tasks. + + Falls back to default of 10 if not specified. Limited by max limit value of 1000 + """ + + offset: int + """Offset value is used to exclude the first set of records from the result""" + + project_id: Optional[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]] + """The region ID to filter the tasks by region. + + Supports multiple values of kind key=value1&key=value2 + """ + + sorting: Optional[Literal["asc", "desc"]] + """Sorting by creation date. Oldest first, or most recent first""" + + state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] + """Filter the tasks by state. + + Supports multiple values of kind key=value1&key=value2 + """ + + task_type: Optional[str] + """ + Filter the tasks by their type one of ['activate_ddos_profile', + 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', + 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', + 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', + 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', + 'create_fip', 'create_gpu_virtual_cluster', 'create_image', + 'create_inference_instance', 'create_inference_instance_key', + 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', + 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', + 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', + 'create_reserved_fixed_ip', 'create_router', 'create_secret', + 'create_servergroup', 'create_sfs', 'create_snapshot', 'create_subnet', + 'create_vm', 'create_volume', 'deactivate_ddos_profile', + 'delete_ai_cluster_gpu', 'delete_caas_container', + 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', + 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', + 'delete_image', 'delete_inference_instance', 'delete_k8s_cluster_pool_v2', + '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', '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', + 'replace_lbmetadata', 'resize_k8s_cluster_v2', 'resize_loadbalancer', + 'resize_vm', 'resume_vm', 'revert_volume', 'soft_reboot_gpu_baremetal_server', + 'soft_reboot_gpu_virtual_cluster', 'soft_reboot_gpu_virtual_server', + 'soft_reboot_vm', 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', + 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', + 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', + 'sync_private_flavors', 'update_ddos_profile', 'update_inference_instance', + 'update_inference_instance_key', 'update_k8s_cluster_v2', 'update_lbmetadata', + 'update_port_allowed_address_pairs', 'update_tags_gpu_virtual_cluster', + 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu'] + """ + + to_timestamp: Annotated[Union[str, datetime, None], 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/test_tasks.py b/tests/api_resources/cloud/test_tasks.py new file mode 100644 index 00000000..31d172df --- /dev/null +++ b/tests/api_resources/cloud/test_tasks.py @@ -0,0 +1,182 @@ +# 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._utils import parse_datetime +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import Task + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTasks: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: Gcore) -> None: + task = client.cloud.tasks.retrieve( + "task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Gcore) -> None: + response = client.cloud.tasks.with_raw_response.retrieve( + "task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Gcore) -> None: + with client.cloud.tasks.with_streaming_response.retrieve( + "task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + client.cloud.tasks.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + task = client.cloud.tasks.list() + assert_matches_type(SyncOffsetPage[Task], task, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + task = client.cloud.tasks.list( + from_timestamp=parse_datetime("2019-12-27T18:11:19.117Z"), + is_acknowledged=True, + limit=100, + offset=0, + project_id=[0, 0], + region_id=[0, 0], + sorting="asc", + state=["ERROR", "FINISHED"], + task_type="task_type", + to_timestamp=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(SyncOffsetPage[Task], task, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.tasks.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(SyncOffsetPage[Task], task, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.tasks.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert_matches_type(SyncOffsetPage[Task], task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncTasks: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncGcore) -> None: + task = await async_client.cloud.tasks.retrieve( + "task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.tasks.with_raw_response.retrieve( + "task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.tasks.with_streaming_response.retrieve( + "task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + await async_client.cloud.tasks.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + task = await async_client.cloud.tasks.list() + assert_matches_type(AsyncOffsetPage[Task], task, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + task = await async_client.cloud.tasks.list( + from_timestamp=parse_datetime("2019-12-27T18:11:19.117Z"), + is_acknowledged=True, + limit=100, + offset=0, + project_id=[0, 0], + region_id=[0, 0], + sorting="asc", + state=["ERROR", "FINISHED"], + task_type="task_type", + to_timestamp=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(AsyncOffsetPage[Task], task, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.tasks.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(AsyncOffsetPage[Task], task, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.tasks.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(AsyncOffsetPage[Task], task, path=["response"]) + + assert cast(Any, response.is_closed) is True From 20d6e2a98da7a8f43386d0aae903d732ca3aa5d5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 12 Apr 2025 03:42:37 +0000 Subject: [PATCH 016/592] fix(perf): skip traversing types for NotGiven values --- src/gcore/_utils/_transform.py | 11 +++++++++++ tests/test_transform.py | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/gcore/_utils/_transform.py b/src/gcore/_utils/_transform.py index 3ec62081..3b2b8e00 100644 --- a/src/gcore/_utils/_transform.py +++ b/src/gcore/_utils/_transform.py @@ -12,6 +12,7 @@ from ._utils import ( is_list, + is_given, is_mapping, is_iterable, ) @@ -258,6 +259,11 @@ def _transform_typeddict( result: dict[str, object] = {} annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): + if not is_given(value): + # we don't need to include `NotGiven` values here as they'll + # be stripped out before the request is sent anyway + continue + type_ = annotations.get(key) if type_ is None: # we do not have a type annotation for this field, leave it as is @@ -415,6 +421,11 @@ async def _async_transform_typeddict( result: dict[str, object] = {} annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): + if not is_given(value): + # we don't need to include `NotGiven` values here as they'll + # be stripped out before the request is sent anyway + continue + type_ = annotations.get(key) if type_ is None: # we do not have a type annotation for this field, leave it as is diff --git a/tests/test_transform.py b/tests/test_transform.py index d699cab7..987047c5 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,7 +8,7 @@ import pytest -from gcore._types import Base64FileInput +from gcore._types import NOT_GIVEN, Base64FileInput from gcore._utils import ( PropertyInfo, transform as _transform, @@ -444,3 +444,10 @@ async def test_transform_skipping(use_async: bool) -> None: # iterables of ints are converted to a list data = iter([1, 2, 3]) assert await transform(data, Iterable[int], use_async) == [1, 2, 3] + + +@parametrize +@pytest.mark.asyncio +async def test_strips_notgiven(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": NOT_GIVEN}, Foo1, use_async) == {} From 4f7145bf54b8cb4832a03988d6a39f595e22486d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 12 Apr 2025 03:43:53 +0000 Subject: [PATCH 017/592] fix(perf): optimize some hot paths --- src/gcore/_utils/_transform.py | 14 +++++++++++++- src/gcore/_utils/_typing.py | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gcore/_utils/_transform.py b/src/gcore/_utils/_transform.py index 3b2b8e00..b0cc20a7 100644 --- a/src/gcore/_utils/_transform.py +++ b/src/gcore/_utils/_transform.py @@ -5,7 +5,7 @@ import pathlib from typing import Any, Mapping, TypeVar, cast from datetime import date, datetime -from typing_extensions import Literal, get_args, override, get_type_hints +from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints import anyio import pydantic @@ -13,6 +13,7 @@ from ._utils import ( is_list, is_given, + lru_cache, is_mapping, is_iterable, ) @@ -109,6 +110,7 @@ class Params(TypedDict, total=False): return cast(_T, transformed) +@lru_cache(maxsize=8096) def _get_annotated_type(type_: type) -> type | None: """If the given type is an `Annotated` type then it is returned, if not `None` is returned. @@ -433,3 +435,13 @@ async def _async_transform_typeddict( else: result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_) return result + + +@lru_cache(maxsize=8096) +def get_type_hints( + obj: Any, + globalns: dict[str, Any] | None = None, + localns: Mapping[str, Any] | None = None, + include_extras: bool = False, +) -> dict[str, Any]: + return _get_type_hints(obj, globalns=globalns, localns=localns, include_extras=include_extras) diff --git a/src/gcore/_utils/_typing.py b/src/gcore/_utils/_typing.py index 278749b1..1958820f 100644 --- a/src/gcore/_utils/_typing.py +++ b/src/gcore/_utils/_typing.py @@ -13,6 +13,7 @@ get_origin, ) +from ._utils import lru_cache from .._types import InheritsGeneric from .._compat import is_union as _is_union @@ -66,6 +67,7 @@ def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]: # Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]] +@lru_cache(maxsize=8096) def strip_annotated_type(typ: type) -> type: if is_required_type(typ) or is_annotated_type(typ): return strip_annotated_type(cast(type, get_args(typ)[0])) From 83e8a6b89833480076c79231c445922776be1f9a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 04:01:09 +0000 Subject: [PATCH 018/592] chore(internal): update pyright settings --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index e5401579..60ba9dfc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -147,6 +147,7 @@ exclude = [ ] reportImplicitOverride = true +reportOverlappingOverload = false reportImportCycles = false reportPrivateUsage = false From 00acd333390eae11928992be9ad09becb87658c1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 04:02:33 +0000 Subject: [PATCH 019/592] chore(client): minor internal fixes --- src/gcore/_base_client.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index 129fc3eb..aec15259 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -409,7 +409,8 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 idempotency_header = self._idempotency_header if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: - headers[idempotency_header] = options.idempotency_key or self._idempotency_key() + options.idempotency_key = options.idempotency_key or self._idempotency_key() + headers[idempotency_header] = options.idempotency_key # Don't set these headers if they were already set or removed by the caller. We check # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. @@ -943,6 +944,10 @@ def _request( request = self._build_request(options, retries_taken=retries_taken) self._prepare_request(request) + if options.idempotency_key: + # ensure the idempotency key is reused between requests + input_options.idempotency_key = options.idempotency_key + kwargs: HttpxSendArgs = {} if self.custom_auth is not None: kwargs["auth"] = self.custom_auth @@ -1475,6 +1480,10 @@ async def _request( request = self._build_request(options, retries_taken=retries_taken) await self._prepare_request(request) + if options.idempotency_key: + # ensure the idempotency key is reused between requests + input_options.idempotency_key = options.idempotency_key + kwargs: HttpxSendArgs = {} if self.custom_auth is not None: kwargs["auth"] = self.custom_auth From 6520feff60edf0e4fc1b79a035ee70cc07b446e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 18:10:58 +0000 Subject: [PATCH 020/592] feat(oas): update to v14.150.0 --- .stats.yml | 4 ++-- src/gcore/resources/cloud/projects.py | 16 ++++++++++++++++ src/gcore/types/cloud/project_list_params.py | 6 ++++++ tests/api_resources/cloud/test_projects.py | 4 ++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2338ef4a..9b153d4e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 9 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-438b138b39bd4fd83cf6c691b89f54b1140d9187784870471405809a05991bb9.yml -openapi_spec_hash: b9ed2cc78be81accc812b408ab694eef +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2ec6c0a4c23d90066b6d34e15af4094fafe193eb46956357b1ca3847bac6c507.yml +openapi_spec_hash: 56b3cbcc85af6c14519af254ec75c4c3 config_hash: 4357c616f6b736937074936b545083a0 diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 426fd7ca..49e2f92c 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -139,7 +139,9 @@ def list( *, client_id: int | NotGiven = NOT_GIVEN, include_deleted: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -156,8 +158,12 @@ def list( include_deleted: Whether to include deleted projects in the response. + limit: Limit value is used to limit the number of records in the result + name: Name to filter the results by. + offset: Offset value is used to exclude the first set of records from the result + order_by: Order by field and direction. extra_headers: Send extra headers @@ -179,7 +185,9 @@ def list( { "client_id": client_id, "include_deleted": include_deleted, + "limit": limit, "name": name, + "offset": offset, "order_by": order_by, }, project_list_params.ProjectListParams, @@ -379,7 +387,9 @@ async def list( *, client_id: int | NotGiven = NOT_GIVEN, include_deleted: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -396,8 +406,12 @@ async def list( include_deleted: Whether to include deleted projects in the response. + limit: Limit value is used to limit the number of records in the result + name: Name to filter the results by. + offset: Offset value is used to exclude the first set of records from the result + order_by: Order by field and direction. extra_headers: Send extra headers @@ -419,7 +433,9 @@ async def list( { "client_id": client_id, "include_deleted": include_deleted, + "limit": limit, "name": name, + "offset": offset, "order_by": order_by, }, project_list_params.ProjectListParams, diff --git a/src/gcore/types/cloud/project_list_params.py b/src/gcore/types/cloud/project_list_params.py index 39ad1ec7..a469a6ed 100644 --- a/src/gcore/types/cloud/project_list_params.py +++ b/src/gcore/types/cloud/project_list_params.py @@ -14,8 +14,14 @@ class ProjectListParams(TypedDict, total=False): include_deleted: bool """Whether to include deleted projects in the response.""" + limit: int + """Limit value is used to limit the number of records in the result""" + name: str """Name to filter the results by.""" + offset: int + """Offset value is used to exclude the first set of records from the result""" + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] """Order by field and direction.""" diff --git a/tests/api_resources/cloud/test_projects.py b/tests/api_resources/cloud/test_projects.py index 21f6e362..e8fa5cbe 100644 --- a/tests/api_resources/cloud/test_projects.py +++ b/tests/api_resources/cloud/test_projects.py @@ -103,7 +103,9 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: project = client.cloud.projects.list( client_id=1, include_deleted=False, + limit=100, name="my-project", + offset=0, order_by="name.desc", ) assert_matches_type(ProjectListResponse, project, path=["response"]) @@ -288,7 +290,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No project = await async_client.cloud.projects.list( client_id=1, include_deleted=False, + limit=100, name="my-project", + offset=0, order_by="name.desc", ) assert_matches_type(ProjectListResponse, project, path=["response"]) From 588fe8b5904c8c8feb3e6c2afe6ec0d400a4d218 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 18:37:00 +0000 Subject: [PATCH 021/592] GCLOUD2-18513 Enable pagination and rename get for projects --- .stats.yml | 2 +- README.md | 73 +++++++ api.md | 6 +- src/gcore/resources/cloud/projects.py | 178 +++++++++--------- src/gcore/types/cloud/__init__.py | 1 - .../types/cloud/project_list_response.py | 16 -- tests/api_resources/cloud/test_projects.py | 142 +++++++------- tests/test_client.py | 8 +- 8 files changed, 242 insertions(+), 184 deletions(-) delete mode 100644 src/gcore/types/cloud/project_list_response.py diff --git a/.stats.yml b/.stats.yml index 9b153d4e..b93f34f9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 9 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2ec6c0a4c23d90066b6d34e15af4094fafe193eb46956357b1ca3847bac6c507.yml openapi_spec_hash: 56b3cbcc85af6c14519af254ec75c4c3 -config_hash: 4357c616f6b736937074936b545083a0 +config_hash: 5f68836571d4e23d2a5af5e84aa18313 diff --git a/README.md b/README.md index cdc443cb..a55dfe47 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,79 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`. +## Pagination + +List methods in the Gcore API are paginated. + +This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually: + +```python +from gcore import Gcore + +client = Gcore() + +all_projects = [] +# Automatically fetches more pages as needed. +for project in client.cloud.projects.list( + limit=10, + offset=0, +): + # Do something with project here + all_projects.append(project) +print(all_projects) +``` + +Or, asynchronously: + +```python +import asyncio +from gcore import AsyncGcore + +client = AsyncGcore() + + +async def main() -> None: + all_projects = [] + # Iterate through items across all pages, issuing requests as needed. + async for project in client.cloud.projects.list( + limit=10, + offset=0, + ): + all_projects.append(project) + print(all_projects) + + +asyncio.run(main()) +``` + +Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages: + +```python +first_page = await client.cloud.projects.list( + limit=10, + offset=0, +) +if first_page.has_next_page(): + print(f"will fetch next page using these details: {first_page.next_page_info()}") + next_page = await first_page.get_next_page() + print(f"number of items we just fetched: {len(next_page.results)}") + +# Remove `await` for non-async usage. +``` + +Or just work directly with the returned data: + +```python +first_page = await client.cloud.projects.list( + limit=10, + offset=0, +) +for project in first_page.results: + print(project.id) + +# Remove `await` for non-async usage. +``` + ## Handling errors When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `gcore.APIConnectionError` is raised. diff --git a/api.md b/api.md index 8a680c76..eaa6ca32 100644 --- a/api.md +++ b/api.md @@ -5,15 +5,15 @@ Types: ```python -from gcore.types.cloud import Project, ProjectListResponse, ProjectDeleteResponse +from gcore.types.cloud import Project, ProjectDeleteResponse ``` Methods: - client.cloud.projects.create(\*\*params) -> Project -- client.cloud.projects.retrieve(\*, project_id) -> Project -- client.cloud.projects.list(\*\*params) -> ProjectListResponse +- client.cloud.projects.list(\*\*params) -> SyncOffsetPage[Project] - client.cloud.projects.delete(\*, project_id) -> ProjectDeleteResponse +- client.cloud.projects.get(\*, project_id) -> Project - client.cloud.projects.replace(\*, project_id, \*\*params) -> Project ## Tasks diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 49e2f92c..b45235e3 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -20,10 +20,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) +from ...pagination import SyncOffsetPage, AsyncOffsetPage from ...types.cloud import project_list_params, project_create_params, project_replace_params -from ..._base_client import make_request_options +from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.project import Project -from ...types.cloud.project_list_response import ProjectListResponse from ...types.cloud.project_delete_response import ProjectDeleteResponse __all__ = ["ProjectsResource", "AsyncProjectsResource"] @@ -101,39 +101,6 @@ def create( cast_to=Project, ) - def retrieve( - self, - *, - project_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Project: - """ - Get Project - - 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 project_id is None: - project_id = self._client._get_project_id_path_param() - return self._get( - f"/cloud/v1/projects/{project_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Project, - ) - def list( self, *, @@ -149,7 +116,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectListResponse: + ) -> SyncOffsetPage[Project]: """ List projects @@ -174,8 +141,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/cloud/v1/projects", + page=SyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -193,7 +161,7 @@ def list( project_list_params.ProjectListParams, ), ), - cast_to=ProjectListResponse, + model=Project, ) def delete( @@ -230,6 +198,39 @@ def delete( cast_to=ProjectDeleteResponse, ) + def get( + self, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Project: + """ + Get Project + + 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 project_id is None: + project_id = self._client._get_project_id_path_param() + return self._get( + f"/cloud/v1/projects/{project_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Project, + ) + def replace( self, *, @@ -349,40 +350,7 @@ async def create( cast_to=Project, ) - async def retrieve( - self, - *, - project_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Project: - """ - Get Project - - 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 project_id is None: - project_id = self._client._get_project_id_path_param() - return await self._get( - f"/cloud/v1/projects/{project_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Project, - ) - - async def list( + def list( self, *, client_id: int | NotGiven = NOT_GIVEN, @@ -397,7 +365,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectListResponse: + ) -> AsyncPaginator[Project, AsyncOffsetPage[Project]]: """ List projects @@ -422,14 +390,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/cloud/v1/projects", + page=AsyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "client_id": client_id, "include_deleted": include_deleted, @@ -441,7 +410,7 @@ async def list( project_list_params.ProjectListParams, ), ), - cast_to=ProjectListResponse, + model=Project, ) async def delete( @@ -478,6 +447,39 @@ async def delete( cast_to=ProjectDeleteResponse, ) + async def get( + self, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Project: + """ + Get Project + + 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 project_id is None: + project_id = self._client._get_project_id_path_param() + return await self._get( + f"/cloud/v1/projects/{project_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Project, + ) + async def replace( self, *, @@ -532,15 +534,15 @@ def __init__(self, projects: ProjectsResource) -> None: self.create = to_raw_response_wrapper( projects.create, ) - self.retrieve = to_raw_response_wrapper( - projects.retrieve, - ) self.list = to_raw_response_wrapper( projects.list, ) self.delete = to_raw_response_wrapper( projects.delete, ) + self.get = to_raw_response_wrapper( + projects.get, + ) self.replace = to_raw_response_wrapper( projects.replace, ) @@ -553,15 +555,15 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.create = async_to_raw_response_wrapper( projects.create, ) - self.retrieve = async_to_raw_response_wrapper( - projects.retrieve, - ) self.list = async_to_raw_response_wrapper( projects.list, ) self.delete = async_to_raw_response_wrapper( projects.delete, ) + self.get = async_to_raw_response_wrapper( + projects.get, + ) self.replace = async_to_raw_response_wrapper( projects.replace, ) @@ -574,15 +576,15 @@ def __init__(self, projects: ProjectsResource) -> None: self.create = to_streamed_response_wrapper( projects.create, ) - self.retrieve = to_streamed_response_wrapper( - projects.retrieve, - ) self.list = to_streamed_response_wrapper( projects.list, ) self.delete = to_streamed_response_wrapper( projects.delete, ) + self.get = to_streamed_response_wrapper( + projects.get, + ) self.replace = to_streamed_response_wrapper( projects.replace, ) @@ -595,15 +597,15 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.create = async_to_streamed_response_wrapper( projects.create, ) - self.retrieve = async_to_streamed_response_wrapper( - projects.retrieve, - ) self.list = async_to_streamed_response_wrapper( projects.list, ) self.delete = async_to_streamed_response_wrapper( projects.delete, ) + self.get = async_to_streamed_response_wrapper( + projects.get, + ) self.replace = async_to_streamed_response_wrapper( projects.replace, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 2387c8e4..e19aed43 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -9,7 +9,6 @@ from .region_list_params import RegionListParams as RegionListParams from .project_list_params import ProjectListParams as ProjectListParams from .project_create_params import ProjectCreateParams as ProjectCreateParams -from .project_list_response import ProjectListResponse as ProjectListResponse from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams from .project_delete_response import ProjectDeleteResponse as ProjectDeleteResponse diff --git a/src/gcore/types/cloud/project_list_response.py b/src/gcore/types/cloud/project_list_response.py deleted file mode 100644 index cb5ec6e1..00000000 --- a/src/gcore/types/cloud/project_list_response.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .project import Project -from ..._models import BaseModel - -__all__ = ["ProjectListResponse"] - - -class ProjectListResponse(BaseModel): - count: int - """Number of objects""" - - results: List[Project] - """Objects""" diff --git a/tests/api_resources/cloud/test_projects.py b/tests/api_resources/cloud/test_projects.py index e8fa5cbe..abc01eaf 100644 --- a/tests/api_resources/cloud/test_projects.py +++ b/tests/api_resources/cloud/test_projects.py @@ -9,9 +9,9 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud import ( Project, - ProjectListResponse, ProjectDeleteResponse, ) @@ -62,41 +62,10 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_retrieve(self, client: Gcore) -> None: - project = client.cloud.projects.retrieve( - project_id=0, - ) - assert_matches_type(Project, project, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Gcore) -> None: - response = client.cloud.projects.with_raw_response.retrieve( - project_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() - assert_matches_type(Project, project, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Gcore) -> None: - with client.cloud.projects.with_streaming_response.retrieve( - project_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = response.parse() - assert_matches_type(Project, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize def test_method_list(self, client: Gcore) -> None: project = client.cloud.projects.list() - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(SyncOffsetPage[Project], project, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -108,7 +77,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: offset=0, order_by="name.desc", ) - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(SyncOffsetPage[Project], project, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -117,7 +86,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(SyncOffsetPage[Project], project, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -126,7 +95,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(SyncOffsetPage[Project], project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,6 +130,37 @@ def test_streaming_response_delete(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_get(self, client: Gcore) -> None: + project = client.cloud.projects.get( + project_id=0, + ) + 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, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + project = response.parse() + assert_matches_type(Project, project, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.projects.with_streaming_response.get( + project_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + project = response.parse() + assert_matches_type(Project, project, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_replace(self, client: Gcore) -> None: project = client.cloud.projects.replace( @@ -249,41 +249,10 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True - @parametrize - async def test_method_retrieve(self, async_client: AsyncGcore) -> None: - project = await async_client.cloud.projects.retrieve( - project_id=0, - ) - assert_matches_type(Project, project, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.projects.with_raw_response.retrieve( - project_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() - assert_matches_type(Project, project, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.projects.with_streaming_response.retrieve( - project_id=0, - ) 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 - @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: project = await async_client.cloud.projects.list() - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(AsyncOffsetPage[Project], project, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -295,7 +264,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No offset=0, order_by="name.desc", ) - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(AsyncOffsetPage[Project], project, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -304,7 +273,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(AsyncOffsetPage[Project], project, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -313,7 +282,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(AsyncOffsetPage[Project], project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -348,6 +317,37 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + project = await async_client.cloud.projects.get( + project_id=0, + ) + 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, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + project = await response.parse() + assert_matches_type(Project, project, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.projects.with_streaming_response.get( + project_id=0, + ) 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 + @parametrize async def test_method_replace(self, async_client: AsyncGcore) -> None: project = await async_client.cloud.projects.replace( diff --git a/tests/test_client.py b/tests/test_client.py index 7d46e3b4..ec259699 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -362,11 +362,11 @@ def test_project_id_client_params(self) -> None: with client as c2: with pytest.raises(ValueError, match="Missing project_id argument;"): - c2.cloud.projects.retrieve() + c2.cloud.projects.delete() client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, project_id=0) with client as c2: - c2.cloud.projects.retrieve() + c2.cloud.projects.delete() def test_region_id_client_params(self) -> None: client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -1148,11 +1148,11 @@ async def test_project_id_client_params(self) -> None: async with client as c2: with pytest.raises(ValueError, match="Missing project_id argument;"): - await c2.cloud.projects.retrieve() + await c2.cloud.projects.delete() client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, project_id=0) async with client as c2: - await c2.cloud.projects.retrieve() + await c2.cloud.projects.delete() async def test_region_id_client_params(self) -> None: client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) From 96ccc9730f54039fbcd49a8310195e36c1d86884 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 08:09:49 +0000 Subject: [PATCH 022/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index b93f34f9..4fabf4e1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 9 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2ec6c0a4c23d90066b6d34e15af4094fafe193eb46956357b1ca3847bac6c507.yml -openapi_spec_hash: 56b3cbcc85af6c14519af254ec75c4c3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-56f5a651f1dd5de3e7280ba41889f8dc31785f4471c79048ce2592b4a9bfff57.yml +openapi_spec_hash: 8ce0ed5752727114ce3a5b69e6423ef9 config_hash: 5f68836571d4e23d2a5af5e84aa18313 From 66ca8b1a427e4058d4f44aacd6ecb5d56f6741c7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 10:04:37 +0000 Subject: [PATCH 023/592] Add polling interval option --- .stats.yml | 2 +- src/gcore/_client.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 4fabf4e1..a323ebc4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 9 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-56f5a651f1dd5de3e7280ba41889f8dc31785f4471c79048ce2592b4a9bfff57.yml openapi_spec_hash: 8ce0ed5752727114ce3a5b69e6423ef9 -config_hash: 5f68836571d4e23d2a5af5e84aa18313 +config_hash: 7458c485c46c19ea2cb601c343d3845b diff --git a/src/gcore/_client.py b/src/gcore/_client.py index cfc1cd0a..f77caac1 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -46,6 +46,7 @@ class Gcore(SyncAPIClient): api_key: str project_id: int | None region_id: int | None + polling_interval_ms: int | None def __init__( self, @@ -53,6 +54,7 @@ def __init__( api_key: str | None = None, project_id: int | None = None, region_id: int | None = None, + polling_interval_ms: int | None = 1000, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, @@ -95,6 +97,10 @@ def __init__( region_id = maybe_coerce_integer(os.environ.get("GCORE_REGION")) self.region_id = region_id + if polling_interval_ms is None: + polling_interval_ms = 1000 + self.polling_interval_ms = polling_interval_ms + if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") if base_url is None: @@ -141,6 +147,7 @@ def copy( api_key: str | None = None, project_id: int | None = None, region_id: int | None = None, + polling_interval_ms: int | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.Client | None = None, @@ -177,6 +184,7 @@ def copy( api_key=api_key or self.api_key, project_id=project_id or self.project_id, region_id=region_id or self.region_id, + polling_interval_ms=polling_interval_ms or self.polling_interval_ms, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, @@ -251,6 +259,7 @@ class AsyncGcore(AsyncAPIClient): api_key: str project_id: int | None region_id: int | None + polling_interval_ms: int | None def __init__( self, @@ -258,6 +267,7 @@ def __init__( api_key: str | None = None, project_id: int | None = None, region_id: int | None = None, + polling_interval_ms: int | None = 1000, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, @@ -300,6 +310,10 @@ def __init__( region_id = maybe_coerce_integer(os.environ.get("GCORE_REGION")) self.region_id = region_id + if polling_interval_ms is None: + polling_interval_ms = 1000 + self.polling_interval_ms = polling_interval_ms + if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") if base_url is None: @@ -346,6 +360,7 @@ def copy( api_key: str | None = None, project_id: int | None = None, region_id: int | None = None, + polling_interval_ms: int | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.AsyncClient | None = None, @@ -382,6 +397,7 @@ def copy( api_key=api_key or self.api_key, project_id=project_id or self.project_id, region_id=region_id or self.region_id, + polling_interval_ms=polling_interval_ms or self.polling_interval_ms, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, From 52cfa72a46fd4bd4ca9ff9affb15f66bffb757d0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 13:51:11 +0000 Subject: [PATCH 024/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cloud/task.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index a323ebc4..3fa83bc7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 9 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-56f5a651f1dd5de3e7280ba41889f8dc31785f4471c79048ce2592b4a9bfff57.yml -openapi_spec_hash: 8ce0ed5752727114ce3a5b69e6423ef9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d04af2cbcfe6fac48c6fa7e72f8694129af5c16959ae8266e90be5e48b251fd8.yml +openapi_spec_hash: fe9e9877f223c4b537615b146bec2391 config_hash: 7458c485c46c19ea2cb601c343d3845b diff --git a/src/gcore/types/cloud/task.py b/src/gcore/types/cloud/task.py index 8248a3ef..a66a37a9 100644 --- a/src/gcore/types/cloud/task.py +++ b/src/gcore/types/cloud/task.py @@ -119,7 +119,7 @@ class Task(BaseModel): created_on: Optional[str] = None """Created timestamp""" - state: str + state: Literal["ERROR", "FINISHED", "NEW", "RUNNING"] """The task state""" task_type: str From e137db56907105189f594c8d9d42c46f7f8cbf16 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 14:13:16 +0000 Subject: [PATCH 025/592] GCLOUD2-18569 Add quotas --- .stats.yml | 4 +- README.md | 76 +++ api.md | 29 ++ src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 ++ src/gcore/resources/cloud/quotas/__init__.py | 33 ++ src/gcore/resources/cloud/quotas/quotas.py | 335 ++++++++++++ src/gcore/resources/cloud/quotas/requests.py | 483 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 3 + .../types/cloud/quota_get_all_response.py | 340 ++++++++++++ .../cloud/quota_get_by_region_response.py | 288 +++++++++++ .../types/cloud/quota_get_global_response.py | 51 ++ src/gcore/types/cloud/quotas/__init__.py | 7 + .../cloud/quotas/request_create_params.py | 193 +++++++ .../cloud/quotas/request_get_response.py | 205 ++++++++ .../types/cloud/quotas/request_list_params.py | 22 + tests/api_resources/cloud/quotas/__init__.py | 1 + .../cloud/quotas/test_requests.py | 450 ++++++++++++++++ tests/api_resources/cloud/test_quotas.py | 202 ++++++++ 19 files changed, 2766 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/quotas/__init__.py create mode 100644 src/gcore/resources/cloud/quotas/quotas.py create mode 100644 src/gcore/resources/cloud/quotas/requests.py create mode 100644 src/gcore/types/cloud/quota_get_all_response.py create mode 100644 src/gcore/types/cloud/quota_get_by_region_response.py create mode 100644 src/gcore/types/cloud/quota_get_global_response.py create mode 100644 src/gcore/types/cloud/quotas/__init__.py create mode 100644 src/gcore/types/cloud/quotas/request_create_params.py create mode 100644 src/gcore/types/cloud/quotas/request_get_response.py create mode 100644 src/gcore/types/cloud/quotas/request_list_params.py create mode 100644 tests/api_resources/cloud/quotas/__init__.py create mode 100644 tests/api_resources/cloud/quotas/test_requests.py create mode 100644 tests/api_resources/cloud/test_quotas.py diff --git a/.stats.yml b/.stats.yml index 3fa83bc7..e6df6d42 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 9 +configured_endpoints: 16 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d04af2cbcfe6fac48c6fa7e72f8694129af5c16959ae8266e90be5e48b251fd8.yml openapi_spec_hash: fe9e9877f223c4b537615b146bec2391 -config_hash: 7458c485c46c19ea2cb601c343d3845b +config_hash: 28b4e5e69c2f7b28102369554069ce78 diff --git a/README.md b/README.md index a55dfe47..6b197be3 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,82 @@ for project in first_page.results: # Remove `await` for non-async usage. ``` +## Nested params + +Nested parameters are dictionaries, typed using `TypedDict`, for example: + +```python +from gcore import Gcore + +client = Gcore() + +client.cloud.quotas.requests.create( + description="Scale up mysql cluster", + requested_limits={ + "global_limits": { + "inference_cpu_millicore_count_limit": 0, + "inference_gpu_a100_count_limit": 0, + "inference_gpu_h100_count_limit": 0, + "inference_gpu_l40s_count_limit": 0, + "inference_instance_count_limit": 0, + "keypair_count_limit": 100, + "project_count_limit": 2, + }, + "regional_limits": [ + { + "baremetal_basic_count_limit": 0, + "baremetal_gpu_count_limit": 0, + "baremetal_hf_count_limit": 0, + "baremetal_infrastructure_count_limit": 0, + "baremetal_network_count_limit": 0, + "baremetal_storage_count_limit": 0, + "caas_container_count_limit": 0, + "caas_cpu_count_limit": 0, + "caas_gpu_count_limit": 0, + "caas_ram_size_limit": 0, + "cluster_count_limit": 0, + "cpu_count_limit": 0, + "dbaas_postgres_cluster_count_limit": 0, + "external_ip_count_limit": 0, + "faas_cpu_count_limit": 0, + "faas_function_count_limit": 0, + "faas_namespace_count_limit": 0, + "faas_ram_size_limit": 0, + "firewall_count_limit": 0, + "floating_count_limit": 0, + "gpu_count_limit": 0, + "gpu_virtual_a100_count_limit": 0, + "gpu_virtual_h100_count_limit": 0, + "gpu_virtual_l40s_count_limit": 0, + "image_count_limit": 0, + "image_size_limit": 0, + "ipu_count_limit": 0, + "laas_topic_count_limit": 0, + "loadbalancer_count_limit": 0, + "network_count_limit": 0, + "ram_limit": 0, + "region_id": 1, + "registry_count_limit": 0, + "registry_storage_limit": 0, + "router_count_limit": 0, + "secret_count_limit": 0, + "servergroup_count_limit": 0, + "sfs_count_limit": 0, + "sfs_size_limit": 0, + "shared_vm_count_limit": 0, + "snapshot_schedule_count_limit": 0, + "subnet_count_limit": 0, + "vm_count_limit": 0, + "volume_count_limit": 0, + "volume_size_limit": 0, + "volume_snapshots_count_limit": 0, + "volume_snapshots_size_limit": 0, + } + ], + }, +) +``` + ## Handling errors When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `gcore.APIConnectionError` is raised. diff --git a/api.md b/api.md index eaa6ca32..c7c05ce1 100644 --- a/api.md +++ b/api.md @@ -41,3 +41,32 @@ Methods: - client.cloud.regions.retrieve(\*, region_id, \*\*params) -> Region - client.cloud.regions.list(\*\*params) -> SyncOffsetPage[Region] + +## Quotas + +Types: + +```python +from gcore.types.cloud import QuotaGetAllResponse, QuotaGetByRegionResponse, QuotaGetGlobalResponse +``` + +Methods: + +- client.cloud.quotas.get_all() -> QuotaGetAllResponse +- client.cloud.quotas.get_by_region(\*, client_id, region_id) -> QuotaGetByRegionResponse +- client.cloud.quotas.get_global(client_id) -> QuotaGetGlobalResponse + +### Requests + +Types: + +```python +from gcore.types.cloud.quotas import RequestGetResponse +``` + +Methods: + +- client.cloud.quotas.requests.create(\*\*params) -> None +- client.cloud.quotas.requests.list(\*\*params) -> None +- client.cloud.quotas.requests.delete(request_id) -> None +- client.cloud.quotas.requests.get(request_id) -> RequestGetResponse diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 6720fdc0..fe1fa084 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -16,6 +16,14 @@ TasksResourceWithStreamingResponse, AsyncTasksResourceWithStreamingResponse, ) +from .quotas import ( + QuotasResource, + AsyncQuotasResource, + QuotasResourceWithRawResponse, + AsyncQuotasResourceWithRawResponse, + QuotasResourceWithStreamingResponse, + AsyncQuotasResourceWithStreamingResponse, +) from .regions import ( RegionsResource, AsyncRegionsResource, @@ -52,6 +60,12 @@ "AsyncRegionsResourceWithRawResponse", "RegionsResourceWithStreamingResponse", "AsyncRegionsResourceWithStreamingResponse", + "QuotasResource", + "AsyncQuotasResource", + "QuotasResourceWithRawResponse", + "AsyncQuotasResourceWithRawResponse", + "QuotasResourceWithStreamingResponse", + "AsyncQuotasResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 4133f69f..18483ede 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -28,6 +28,14 @@ ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource +from .quotas.quotas import ( + QuotasResource, + AsyncQuotasResource, + QuotasResourceWithRawResponse, + AsyncQuotasResourceWithRawResponse, + QuotasResourceWithStreamingResponse, + AsyncQuotasResourceWithStreamingResponse, +) __all__ = ["CloudResource", "AsyncCloudResource"] @@ -45,6 +53,10 @@ def tasks(self) -> TasksResource: def regions(self) -> RegionsResource: return RegionsResource(self._client) + @cached_property + def quotas(self) -> QuotasResource: + return QuotasResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -78,6 +90,10 @@ def tasks(self) -> AsyncTasksResource: def regions(self) -> AsyncRegionsResource: return AsyncRegionsResource(self._client) + @cached_property + def quotas(self) -> AsyncQuotasResource: + return AsyncQuotasResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -114,6 +130,10 @@ def tasks(self) -> TasksResourceWithRawResponse: def regions(self) -> RegionsResourceWithRawResponse: return RegionsResourceWithRawResponse(self._cloud.regions) + @cached_property + def quotas(self) -> QuotasResourceWithRawResponse: + return QuotasResourceWithRawResponse(self._cloud.quotas) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -131,6 +151,10 @@ def tasks(self) -> AsyncTasksResourceWithRawResponse: def regions(self) -> AsyncRegionsResourceWithRawResponse: return AsyncRegionsResourceWithRawResponse(self._cloud.regions) + @cached_property + def quotas(self) -> AsyncQuotasResourceWithRawResponse: + return AsyncQuotasResourceWithRawResponse(self._cloud.quotas) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -148,6 +172,10 @@ def tasks(self) -> TasksResourceWithStreamingResponse: def regions(self) -> RegionsResourceWithStreamingResponse: return RegionsResourceWithStreamingResponse(self._cloud.regions) + @cached_property + def quotas(self) -> QuotasResourceWithStreamingResponse: + return QuotasResourceWithStreamingResponse(self._cloud.quotas) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -164,3 +192,7 @@ def tasks(self) -> AsyncTasksResourceWithStreamingResponse: @cached_property def regions(self) -> AsyncRegionsResourceWithStreamingResponse: return AsyncRegionsResourceWithStreamingResponse(self._cloud.regions) + + @cached_property + def quotas(self) -> AsyncQuotasResourceWithStreamingResponse: + return AsyncQuotasResourceWithStreamingResponse(self._cloud.quotas) diff --git a/src/gcore/resources/cloud/quotas/__init__.py b/src/gcore/resources/cloud/quotas/__init__.py new file mode 100644 index 00000000..5d09d00d --- /dev/null +++ b/src/gcore/resources/cloud/quotas/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .quotas import ( + QuotasResource, + AsyncQuotasResource, + QuotasResourceWithRawResponse, + AsyncQuotasResourceWithRawResponse, + QuotasResourceWithStreamingResponse, + AsyncQuotasResourceWithStreamingResponse, +) +from .requests import ( + RequestsResource, + AsyncRequestsResource, + RequestsResourceWithRawResponse, + AsyncRequestsResourceWithRawResponse, + RequestsResourceWithStreamingResponse, + AsyncRequestsResourceWithStreamingResponse, +) + +__all__ = [ + "RequestsResource", + "AsyncRequestsResource", + "RequestsResourceWithRawResponse", + "AsyncRequestsResourceWithRawResponse", + "RequestsResourceWithStreamingResponse", + "AsyncRequestsResourceWithStreamingResponse", + "QuotasResource", + "AsyncQuotasResource", + "QuotasResourceWithRawResponse", + "AsyncQuotasResourceWithRawResponse", + "QuotasResourceWithStreamingResponse", + "AsyncQuotasResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py new file mode 100644 index 00000000..a0a1f3cd --- /dev/null +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -0,0 +1,335 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .requests import ( + RequestsResource, + AsyncRequestsResource, + RequestsResourceWithRawResponse, + AsyncRequestsResourceWithRawResponse, + RequestsResourceWithStreamingResponse, + AsyncRequestsResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.quota_get_all_response import QuotaGetAllResponse +from ....types.cloud.quota_get_global_response import QuotaGetGlobalResponse +from ....types.cloud.quota_get_by_region_response import QuotaGetByRegionResponse + +__all__ = ["QuotasResource", "AsyncQuotasResource"] + + +class QuotasResource(SyncAPIResource): + @cached_property + def requests(self) -> RequestsResource: + return RequestsResource(self._client) + + @cached_property + def with_raw_response(self) -> QuotasResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return QuotasResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> QuotasResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return QuotasResourceWithStreamingResponse(self) + + def get_all( + 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, + ) -> QuotaGetAllResponse: + """Get combined client quotas, regional and global.""" + return self._get( + "/cloud/v2/client_quotas", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QuotaGetAllResponse, + ) + + def get_by_region( + self, + *, + client_id: int, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> QuotaGetByRegionResponse: + """ + Get a quota by region + + Args: + client_id: Client ID + + region_id: Region ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get( + f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QuotaGetByRegionResponse, + ) + + def get_global( + self, + client_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, + ) -> QuotaGetGlobalResponse: + """ + Get global quota + + Args: + client_id: Client ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cloud/v2/global_quotas/{client_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QuotaGetGlobalResponse, + ) + + +class AsyncQuotasResource(AsyncAPIResource): + @cached_property + def requests(self) -> AsyncRequestsResource: + return AsyncRequestsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncQuotasResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncQuotasResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncQuotasResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncQuotasResourceWithStreamingResponse(self) + + async def get_all( + 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, + ) -> QuotaGetAllResponse: + """Get combined client quotas, regional and global.""" + return await self._get( + "/cloud/v2/client_quotas", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QuotaGetAllResponse, + ) + + async def get_by_region( + self, + *, + client_id: int, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> QuotaGetByRegionResponse: + """ + Get a quota by region + + Args: + client_id: Client ID + + region_id: Region ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._get( + f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QuotaGetByRegionResponse, + ) + + async def get_global( + self, + client_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, + ) -> QuotaGetGlobalResponse: + """ + Get global quota + + Args: + client_id: Client ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cloud/v2/global_quotas/{client_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QuotaGetGlobalResponse, + ) + + +class QuotasResourceWithRawResponse: + def __init__(self, quotas: QuotasResource) -> None: + self._quotas = quotas + + self.get_all = to_raw_response_wrapper( + quotas.get_all, + ) + self.get_by_region = to_raw_response_wrapper( + quotas.get_by_region, + ) + self.get_global = to_raw_response_wrapper( + quotas.get_global, + ) + + @cached_property + def requests(self) -> RequestsResourceWithRawResponse: + return RequestsResourceWithRawResponse(self._quotas.requests) + + +class AsyncQuotasResourceWithRawResponse: + def __init__(self, quotas: AsyncQuotasResource) -> None: + self._quotas = quotas + + self.get_all = async_to_raw_response_wrapper( + quotas.get_all, + ) + self.get_by_region = async_to_raw_response_wrapper( + quotas.get_by_region, + ) + self.get_global = async_to_raw_response_wrapper( + quotas.get_global, + ) + + @cached_property + def requests(self) -> AsyncRequestsResourceWithRawResponse: + return AsyncRequestsResourceWithRawResponse(self._quotas.requests) + + +class QuotasResourceWithStreamingResponse: + def __init__(self, quotas: QuotasResource) -> None: + self._quotas = quotas + + self.get_all = to_streamed_response_wrapper( + quotas.get_all, + ) + self.get_by_region = to_streamed_response_wrapper( + quotas.get_by_region, + ) + self.get_global = to_streamed_response_wrapper( + quotas.get_global, + ) + + @cached_property + def requests(self) -> RequestsResourceWithStreamingResponse: + return RequestsResourceWithStreamingResponse(self._quotas.requests) + + +class AsyncQuotasResourceWithStreamingResponse: + def __init__(self, quotas: AsyncQuotasResource) -> None: + self._quotas = quotas + + self.get_all = async_to_streamed_response_wrapper( + quotas.get_all, + ) + self.get_by_region = async_to_streamed_response_wrapper( + quotas.get_by_region, + ) + self.get_global = async_to_streamed_response_wrapper( + quotas.get_global, + ) + + @cached_property + def requests(self) -> AsyncRequestsResourceWithStreamingResponse: + return AsyncRequestsResourceWithStreamingResponse(self._quotas.requests) diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py new file mode 100644 index 00000000..40ea3328 --- /dev/null +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -0,0 +1,483 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.quotas import request_list_params, request_create_params +from ....types.cloud.quotas.request_get_response import RequestGetResponse + +__all__ = ["RequestsResource", "AsyncRequestsResource"] + + +class RequestsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RequestsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return RequestsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return RequestsResourceWithStreamingResponse(self) + + def create( + self, + *, + description: str, + requested_limits: request_create_params.RequestedLimits, + client_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Create request to change quotas + + Args: + description: Describe the reason, in general terms. + + requested_limits: Limits you want to increase. + + client_id: Client ID that requests the limit increase. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + "/cloud/v2/limits_request", + body=maybe_transform( + { + "description": description, + "requested_limits": requested_limits, + "client_id": client_id, + }, + request_create_params.RequestCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + status: Optional[List[Literal["done", "in progress", "rejected"]]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Returns a list of sent requests to change current quotas and their statuses + + Args: + limit: Optional. Limit the number of returned items + + offset: Optional. Offset value is used to exclude the first set of records from the + result + + status: List of limit requests statuses for filtering + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._get( + "/cloud/v2/limits_request", + 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, + "status": status, + }, + request_list_params.RequestListParams, + ), + ), + cast_to=NoneType, + ) + + def delete( + self, + request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete request to change quotas + + Args: + request_id: LimitRequest ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v2/limits_request/{request_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RequestGetResponse: + """ + Get request to change quota limits. + + Args: + request_id: LimitRequest ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + return self._get( + f"/cloud/v2/limits_request/{request_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RequestGetResponse, + ) + + +class AsyncRequestsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRequestsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRequestsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncRequestsResourceWithStreamingResponse(self) + + async def create( + self, + *, + description: str, + requested_limits: request_create_params.RequestedLimits, + client_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Create request to change quotas + + Args: + description: Describe the reason, in general terms. + + requested_limits: Limits you want to increase. + + client_id: Client ID that requests the limit increase. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + "/cloud/v2/limits_request", + body=await async_maybe_transform( + { + "description": description, + "requested_limits": requested_limits, + "client_id": client_id, + }, + request_create_params.RequestCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + status: Optional[List[Literal["done", "in progress", "rejected"]]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Returns a list of sent requests to change current quotas and their statuses + + Args: + limit: Optional. Limit the number of returned items + + offset: Optional. Offset value is used to exclude the first set of records from the + result + + status: List of limit requests statuses for filtering + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._get( + "/cloud/v2/limits_request", + 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, + "status": status, + }, + request_list_params.RequestListParams, + ), + ), + cast_to=NoneType, + ) + + async def delete( + self, + request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete request to change quotas + + Args: + request_id: LimitRequest ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v2/limits_request/{request_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RequestGetResponse: + """ + Get request to change quota limits. + + Args: + request_id: LimitRequest ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + return await self._get( + f"/cloud/v2/limits_request/{request_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RequestGetResponse, + ) + + +class RequestsResourceWithRawResponse: + def __init__(self, requests: RequestsResource) -> None: + self._requests = requests + + self.create = to_raw_response_wrapper( + requests.create, + ) + self.list = to_raw_response_wrapper( + requests.list, + ) + self.delete = to_raw_response_wrapper( + requests.delete, + ) + self.get = to_raw_response_wrapper( + requests.get, + ) + + +class AsyncRequestsResourceWithRawResponse: + def __init__(self, requests: AsyncRequestsResource) -> None: + self._requests = requests + + self.create = async_to_raw_response_wrapper( + requests.create, + ) + self.list = async_to_raw_response_wrapper( + requests.list, + ) + self.delete = async_to_raw_response_wrapper( + requests.delete, + ) + self.get = async_to_raw_response_wrapper( + requests.get, + ) + + +class RequestsResourceWithStreamingResponse: + def __init__(self, requests: RequestsResource) -> None: + self._requests = requests + + self.create = to_streamed_response_wrapper( + requests.create, + ) + self.list = to_streamed_response_wrapper( + requests.list, + ) + self.delete = to_streamed_response_wrapper( + requests.delete, + ) + self.get = to_streamed_response_wrapper( + requests.get, + ) + + +class AsyncRequestsResourceWithStreamingResponse: + def __init__(self, requests: AsyncRequestsResource) -> None: + self._requests = requests + + self.create = async_to_streamed_response_wrapper( + requests.create, + ) + self.list = async_to_streamed_response_wrapper( + requests.list, + ) + self.delete = async_to_streamed_response_wrapper( + requests.delete, + ) + self.get = async_to_streamed_response_wrapper( + requests.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index e19aed43..dc558d0e 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -10,5 +10,8 @@ from .project_list_params import ProjectListParams as ProjectListParams from .project_create_params import ProjectCreateParams as ProjectCreateParams from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams +from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams from .project_delete_response import ProjectDeleteResponse as ProjectDeleteResponse +from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse +from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse diff --git a/src/gcore/types/cloud/quota_get_all_response.py b/src/gcore/types/cloud/quota_get_all_response.py new file mode 100644 index 00000000..c03ab710 --- /dev/null +++ b/src/gcore/types/cloud/quota_get_all_response.py @@ -0,0 +1,340 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["QuotaGetAllResponse", "GlobalQuotas", "RegionalQuota"] + + +class GlobalQuotas(BaseModel): + inference_cpu_millicore_count_limit: Optional[int] = None + """Inference CPU millicore count limit""" + + inference_cpu_millicore_count_usage: Optional[int] = None + """Inference CPU millicore count usage""" + + inference_gpu_a100_count_limit: Optional[int] = None + """Inference GPU A100 Count limit""" + + inference_gpu_a100_count_usage: Optional[int] = None + """Inference GPU A100 Count usage""" + + inference_gpu_h100_count_limit: Optional[int] = None + """Inference GPU H100 Count limit""" + + inference_gpu_h100_count_usage: Optional[int] = None + """Inference GPU H100 Count usage""" + + inference_gpu_l40s_count_limit: Optional[int] = None + """Inference GPU L40s Count limit""" + + inference_gpu_l40s_count_usage: Optional[int] = None + """Inference GPU L40s Count usage""" + + inference_instance_count_limit: Optional[int] = None + """Inference instance count limit""" + + inference_instance_count_usage: Optional[int] = None + """Inference instance count usage""" + + keypair_count_limit: Optional[int] = None + """SSH Keys Count limit""" + + keypair_count_usage: Optional[int] = None + """SSH Keys Count usage""" + + project_count_limit: Optional[int] = None + """Projects Count limit""" + + project_count_usage: Optional[int] = None + """Projects Count usage""" + + +class RegionalQuota(BaseModel): + baremetal_basic_count_limit: Optional[int] = None + """Basic bare metal servers count limit""" + + baremetal_basic_count_usage: Optional[int] = None + """Basic bare metal servers count usage""" + + baremetal_gpu_count_limit: Optional[int] = None + """AI GPU bare metal servers count limit""" + + baremetal_gpu_count_usage: Optional[int] = None + """AI GPU bare metal servers count usage""" + + baremetal_hf_count_limit: Optional[int] = None + """High-frequency bare metal servers count limit""" + + baremetal_hf_count_usage: Optional[int] = None + """High-frequency bare metal servers count usage""" + + baremetal_infrastructure_count_limit: Optional[int] = None + """Infrastructure bare metal servers count limit""" + + baremetal_infrastructure_count_usage: Optional[int] = None + """Infrastructure bare metal servers count usage""" + + baremetal_network_count_limit: Optional[int] = None + """Bare metal Network Count limit""" + + baremetal_network_count_usage: Optional[int] = None + """Bare metal Network Count usage""" + + baremetal_storage_count_limit: Optional[int] = None + """Storage bare metal servers count limit""" + + baremetal_storage_count_usage: Optional[int] = None + """Storage bare metal servers count usage""" + + caas_container_count_limit: Optional[int] = None + """Containers count limit""" + + caas_container_count_usage: Optional[int] = None + """Containers count usage""" + + caas_cpu_count_limit: Optional[int] = None + """mCPU count for containers limit""" + + caas_cpu_count_usage: Optional[int] = None + """mCPU count for containers usage""" + + caas_gpu_count_limit: Optional[int] = None + """Containers gpu count limit""" + + caas_gpu_count_usage: Optional[int] = None + """Containers gpu count usage""" + + caas_ram_size_limit: Optional[int] = None + """MB memory count for containers limit""" + + caas_ram_size_usage: Optional[int] = None + """MB memory count for containers usage""" + + cluster_count_limit: Optional[int] = None + """K8s clusters count limit""" + + cluster_count_usage: Optional[int] = None + """K8s clusters count usage""" + + cpu_count_limit: Optional[int] = None + """vCPU Count limit""" + + cpu_count_usage: Optional[int] = None + """vCPU Count usage""" + + dbaas_postgres_cluster_count_limit: Optional[int] = None + """DBaaS cluster count limit""" + + dbaas_postgres_cluster_count_usage: Optional[int] = None + """DBaaS cluster count usage""" + + external_ip_count_limit: Optional[int] = None + """External IP Count limit""" + + external_ip_count_usage: Optional[int] = None + """External IP Count usage""" + + faas_cpu_count_limit: Optional[int] = None + """mCPU count for functions limit""" + + faas_cpu_count_usage: Optional[int] = None + """mCPU count for functions usage""" + + faas_function_count_limit: Optional[int] = None + """Functions count limit""" + + faas_function_count_usage: Optional[int] = None + """Functions count usage""" + + faas_namespace_count_limit: Optional[int] = None + """Functions namespace count limit""" + + faas_namespace_count_usage: Optional[int] = None + """Functions namespace count usage""" + + faas_ram_size_limit: Optional[int] = None + """MB memory count for functions limit""" + + faas_ram_size_usage: Optional[int] = None + """MB memory count for functions usage""" + + firewall_count_limit: Optional[int] = None + """Firewalls Count limit""" + + firewall_count_usage: Optional[int] = None + """Firewalls Count usage""" + + floating_count_limit: Optional[int] = None + """Floating IP Count limit""" + + floating_count_usage: Optional[int] = None + """Floating IP Count usage""" + + gpu_count_limit: Optional[int] = None + """GPU Count limit""" + + gpu_count_usage: Optional[int] = None + """GPU Count usage""" + + gpu_virtual_a100_count_limit: Optional[int] = None + """Virtual A100 GPU card count limit""" + + gpu_virtual_a100_count_usage: Optional[int] = None + """Virtual A100 GPU card count usage""" + + gpu_virtual_h100_count_limit: Optional[int] = None + """Virtual H100 GPU card count limit""" + + gpu_virtual_h100_count_usage: Optional[int] = None + """Virtual H100 GPU card count usage""" + + gpu_virtual_l40s_count_limit: Optional[int] = None + """Virtual L40S GPU card count limit""" + + gpu_virtual_l40s_count_usage: Optional[int] = None + """Virtual L40S GPU card count usage""" + + image_count_limit: Optional[int] = None + """Images Count limit""" + + image_count_usage: Optional[int] = None + """Images Count usage""" + + image_size_limit: Optional[int] = None + """Images Size, GiB limit""" + + image_size_usage: Optional[int] = None + """Images Size, GiB usage""" + + ipu_count_limit: Optional[int] = None + """IPU Count limit""" + + ipu_count_usage: Optional[int] = None + """IPU Count usage""" + + laas_topic_count_limit: Optional[int] = None + """LaaS Topics Count limit""" + + laas_topic_count_usage: Optional[int] = None + """LaaS Topics Count usage""" + + loadbalancer_count_limit: Optional[int] = None + """Load Balancers Count limit""" + + loadbalancer_count_usage: Optional[int] = None + """Load Balancers Count usage""" + + network_count_limit: Optional[int] = None + """Networks Count limit""" + + network_count_usage: Optional[int] = None + """Networks Count usage""" + + ram_limit: Optional[int] = None + """RAM Size, GiB limit""" + + ram_usage: Optional[int] = None + """RAM Size, GiB usage""" + + region_id: Optional[int] = None + """Region ID""" + + registry_count_limit: Optional[int] = None + """Registries count limit""" + + registry_count_usage: Optional[int] = None + """Registries count usage""" + + registry_storage_limit: Optional[int] = None + """Registries volume usage, GiB limit""" + + registry_storage_usage: Optional[int] = None + """Registries volume usage, GiB usage""" + + router_count_limit: Optional[int] = None + """Routers Count limit""" + + router_count_usage: Optional[int] = None + """Routers Count usage""" + + secret_count_limit: Optional[int] = None + """Secret Count limit""" + + secret_count_usage: Optional[int] = None + """Secret Count usage""" + + servergroup_count_limit: Optional[int] = None + """Placement Group Count limit""" + + servergroup_count_usage: Optional[int] = None + """Placement Group Count usage""" + + sfs_count_limit: Optional[int] = None + """Shared file system Count limit""" + + sfs_count_usage: Optional[int] = None + """Shared file system Count usage""" + + sfs_size_limit: Optional[int] = None + """Shared file system Size, GiB limit""" + + sfs_size_usage: Optional[int] = None + """Shared file system Size, GiB usage""" + + shared_vm_count_limit: Optional[int] = None + """Basic VMs Count limit""" + + shared_vm_count_usage: Optional[int] = None + """Basic VMs Count usage""" + + snapshot_schedule_count_limit: Optional[int] = None + """Snapshot Schedules Count limit""" + + snapshot_schedule_count_usage: Optional[int] = None + """Snapshot Schedules Count usage""" + + subnet_count_limit: Optional[int] = None + """Subnets Count limit""" + + subnet_count_usage: Optional[int] = None + """Subnets Count usage""" + + vm_count_limit: Optional[int] = None + """Instances Dedicated Count limit""" + + vm_count_usage: Optional[int] = None + """Instances Dedicated Count usage""" + + volume_count_limit: Optional[int] = None + """Volumes Count limit""" + + volume_count_usage: Optional[int] = None + """Volumes Count usage""" + + volume_size_limit: Optional[int] = None + """Volumes Size, GiB limit""" + + volume_size_usage: Optional[int] = None + """Volumes Size, GiB usage""" + + volume_snapshots_count_limit: Optional[int] = None + """Snapshots Count limit""" + + volume_snapshots_count_usage: Optional[int] = None + """Snapshots Count usage""" + + volume_snapshots_size_limit: Optional[int] = None + """Snapshots Size, GiB limit""" + + volume_snapshots_size_usage: Optional[int] = None + """Snapshots Size, GiB usage""" + + +class QuotaGetAllResponse(BaseModel): + global_quotas: Optional[GlobalQuotas] = None + """Global entity quotas""" + + regional_quotas: Optional[List[RegionalQuota]] = None + """Regional entity quotas. Only contains initialized quotas.""" diff --git a/src/gcore/types/cloud/quota_get_by_region_response.py b/src/gcore/types/cloud/quota_get_by_region_response.py new file mode 100644 index 00000000..f34fa83c --- /dev/null +++ b/src/gcore/types/cloud/quota_get_by_region_response.py @@ -0,0 +1,288 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["QuotaGetByRegionResponse"] + + +class QuotaGetByRegionResponse(BaseModel): + baremetal_basic_count_limit: Optional[int] = None + """Basic bare metal servers count limit""" + + baremetal_basic_count_usage: Optional[int] = None + """Basic bare metal servers count usage""" + + baremetal_gpu_count_limit: Optional[int] = None + """AI GPU bare metal servers count limit""" + + baremetal_gpu_count_usage: Optional[int] = None + """AI GPU bare metal servers count usage""" + + baremetal_hf_count_limit: Optional[int] = None + """High-frequency bare metal servers count limit""" + + baremetal_hf_count_usage: Optional[int] = None + """High-frequency bare metal servers count usage""" + + baremetal_infrastructure_count_limit: Optional[int] = None + """Infrastructure bare metal servers count limit""" + + baremetal_infrastructure_count_usage: Optional[int] = None + """Infrastructure bare metal servers count usage""" + + baremetal_network_count_limit: Optional[int] = None + """Bare metal Network Count limit""" + + baremetal_network_count_usage: Optional[int] = None + """Bare metal Network Count usage""" + + baremetal_storage_count_limit: Optional[int] = None + """Storage bare metal servers count limit""" + + baremetal_storage_count_usage: Optional[int] = None + """Storage bare metal servers count usage""" + + caas_container_count_limit: Optional[int] = None + """Containers count limit""" + + caas_container_count_usage: Optional[int] = None + """Containers count usage""" + + caas_cpu_count_limit: Optional[int] = None + """mCPU count for containers limit""" + + caas_cpu_count_usage: Optional[int] = None + """mCPU count for containers usage""" + + caas_gpu_count_limit: Optional[int] = None + """Containers gpu count limit""" + + caas_gpu_count_usage: Optional[int] = None + """Containers gpu count usage""" + + caas_ram_size_limit: Optional[int] = None + """MB memory count for containers limit""" + + caas_ram_size_usage: Optional[int] = None + """MB memory count for containers usage""" + + cluster_count_limit: Optional[int] = None + """K8s clusters count limit""" + + cluster_count_usage: Optional[int] = None + """K8s clusters count usage""" + + cpu_count_limit: Optional[int] = None + """vCPU Count limit""" + + cpu_count_usage: Optional[int] = None + """vCPU Count usage""" + + dbaas_postgres_cluster_count_limit: Optional[int] = None + """DBaaS cluster count limit""" + + dbaas_postgres_cluster_count_usage: Optional[int] = None + """DBaaS cluster count usage""" + + external_ip_count_limit: Optional[int] = None + """External IP Count limit""" + + external_ip_count_usage: Optional[int] = None + """External IP Count usage""" + + faas_cpu_count_limit: Optional[int] = None + """mCPU count for functions limit""" + + faas_cpu_count_usage: Optional[int] = None + """mCPU count for functions usage""" + + faas_function_count_limit: Optional[int] = None + """Functions count limit""" + + faas_function_count_usage: Optional[int] = None + """Functions count usage""" + + faas_namespace_count_limit: Optional[int] = None + """Functions namespace count limit""" + + faas_namespace_count_usage: Optional[int] = None + """Functions namespace count usage""" + + faas_ram_size_limit: Optional[int] = None + """MB memory count for functions limit""" + + faas_ram_size_usage: Optional[int] = None + """MB memory count for functions usage""" + + firewall_count_limit: Optional[int] = None + """Firewalls Count limit""" + + firewall_count_usage: Optional[int] = None + """Firewalls Count usage""" + + floating_count_limit: Optional[int] = None + """Floating IP Count limit""" + + floating_count_usage: Optional[int] = None + """Floating IP Count usage""" + + gpu_count_limit: Optional[int] = None + """GPU Count limit""" + + gpu_count_usage: Optional[int] = None + """GPU Count usage""" + + gpu_virtual_a100_count_limit: Optional[int] = None + """Virtual A100 GPU card count limit""" + + gpu_virtual_a100_count_usage: Optional[int] = None + """Virtual A100 GPU card count usage""" + + gpu_virtual_h100_count_limit: Optional[int] = None + """Virtual H100 GPU card count limit""" + + gpu_virtual_h100_count_usage: Optional[int] = None + """Virtual H100 GPU card count usage""" + + gpu_virtual_l40s_count_limit: Optional[int] = None + """Virtual L40S GPU card count limit""" + + gpu_virtual_l40s_count_usage: Optional[int] = None + """Virtual L40S GPU card count usage""" + + image_count_limit: Optional[int] = None + """Images Count limit""" + + image_count_usage: Optional[int] = None + """Images Count usage""" + + image_size_limit: Optional[int] = None + """Images Size, GiB limit""" + + image_size_usage: Optional[int] = None + """Images Size, GiB usage""" + + ipu_count_limit: Optional[int] = None + """IPU Count limit""" + + ipu_count_usage: Optional[int] = None + """IPU Count usage""" + + laas_topic_count_limit: Optional[int] = None + """LaaS Topics Count limit""" + + laas_topic_count_usage: Optional[int] = None + """LaaS Topics Count usage""" + + loadbalancer_count_limit: Optional[int] = None + """Load Balancers Count limit""" + + loadbalancer_count_usage: Optional[int] = None + """Load Balancers Count usage""" + + network_count_limit: Optional[int] = None + """Networks Count limit""" + + network_count_usage: Optional[int] = None + """Networks Count usage""" + + ram_limit: Optional[int] = None + """RAM Size, GiB limit""" + + ram_usage: Optional[int] = None + """RAM Size, GiB usage""" + + region_id: Optional[int] = None + """Region ID""" + + registry_count_limit: Optional[int] = None + """Registries count limit""" + + registry_count_usage: Optional[int] = None + """Registries count usage""" + + registry_storage_limit: Optional[int] = None + """Registries volume usage, GiB limit""" + + registry_storage_usage: Optional[int] = None + """Registries volume usage, GiB usage""" + + router_count_limit: Optional[int] = None + """Routers Count limit""" + + router_count_usage: Optional[int] = None + """Routers Count usage""" + + secret_count_limit: Optional[int] = None + """Secret Count limit""" + + secret_count_usage: Optional[int] = None + """Secret Count usage""" + + servergroup_count_limit: Optional[int] = None + """Placement Group Count limit""" + + servergroup_count_usage: Optional[int] = None + """Placement Group Count usage""" + + sfs_count_limit: Optional[int] = None + """Shared file system Count limit""" + + sfs_count_usage: Optional[int] = None + """Shared file system Count usage""" + + sfs_size_limit: Optional[int] = None + """Shared file system Size, GiB limit""" + + sfs_size_usage: Optional[int] = None + """Shared file system Size, GiB usage""" + + shared_vm_count_limit: Optional[int] = None + """Basic VMs Count limit""" + + shared_vm_count_usage: Optional[int] = None + """Basic VMs Count usage""" + + snapshot_schedule_count_limit: Optional[int] = None + """Snapshot Schedules Count limit""" + + snapshot_schedule_count_usage: Optional[int] = None + """Snapshot Schedules Count usage""" + + subnet_count_limit: Optional[int] = None + """Subnets Count limit""" + + subnet_count_usage: Optional[int] = None + """Subnets Count usage""" + + vm_count_limit: Optional[int] = None + """Instances Dedicated Count limit""" + + vm_count_usage: Optional[int] = None + """Instances Dedicated Count usage""" + + volume_count_limit: Optional[int] = None + """Volumes Count limit""" + + volume_count_usage: Optional[int] = None + """Volumes Count usage""" + + volume_size_limit: Optional[int] = None + """Volumes Size, GiB limit""" + + volume_size_usage: Optional[int] = None + """Volumes Size, GiB usage""" + + volume_snapshots_count_limit: Optional[int] = None + """Snapshots Count limit""" + + volume_snapshots_count_usage: Optional[int] = None + """Snapshots Count usage""" + + volume_snapshots_size_limit: Optional[int] = None + """Snapshots Size, GiB limit""" + + volume_snapshots_size_usage: Optional[int] = None + """Snapshots Size, GiB usage""" diff --git a/src/gcore/types/cloud/quota_get_global_response.py b/src/gcore/types/cloud/quota_get_global_response.py new file mode 100644 index 00000000..39773e14 --- /dev/null +++ b/src/gcore/types/cloud/quota_get_global_response.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["QuotaGetGlobalResponse"] + + +class QuotaGetGlobalResponse(BaseModel): + inference_cpu_millicore_count_limit: Optional[int] = None + """Inference CPU millicore count limit""" + + inference_cpu_millicore_count_usage: Optional[int] = None + """Inference CPU millicore count usage""" + + inference_gpu_a100_count_limit: Optional[int] = None + """Inference GPU A100 Count limit""" + + inference_gpu_a100_count_usage: Optional[int] = None + """Inference GPU A100 Count usage""" + + inference_gpu_h100_count_limit: Optional[int] = None + """Inference GPU H100 Count limit""" + + inference_gpu_h100_count_usage: Optional[int] = None + """Inference GPU H100 Count usage""" + + inference_gpu_l40s_count_limit: Optional[int] = None + """Inference GPU L40s Count limit""" + + inference_gpu_l40s_count_usage: Optional[int] = None + """Inference GPU L40s Count usage""" + + inference_instance_count_limit: Optional[int] = None + """Inference instance count limit""" + + inference_instance_count_usage: Optional[int] = None + """Inference instance count usage""" + + keypair_count_limit: Optional[int] = None + """SSH Keys Count limit""" + + keypair_count_usage: Optional[int] = None + """SSH Keys Count usage""" + + project_count_limit: Optional[int] = None + """Projects Count limit""" + + project_count_usage: Optional[int] = None + """Projects Count usage""" diff --git a/src/gcore/types/cloud/quotas/__init__.py b/src/gcore/types/cloud/quotas/__init__.py new file mode 100644 index 00000000..8bf1b202 --- /dev/null +++ b/src/gcore/types/cloud/quotas/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .request_list_params import RequestListParams as RequestListParams +from .request_get_response import RequestGetResponse as RequestGetResponse +from .request_create_params import RequestCreateParams as RequestCreateParams diff --git a/src/gcore/types/cloud/quotas/request_create_params.py b/src/gcore/types/cloud/quotas/request_create_params.py new file mode 100644 index 00000000..1a7ac333 --- /dev/null +++ b/src/gcore/types/cloud/quotas/request_create_params.py @@ -0,0 +1,193 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["RequestCreateParams", "RequestedLimits", "RequestedLimitsGlobalLimits", "RequestedLimitsRegionalLimit"] + + +class RequestCreateParams(TypedDict, total=False): + description: Required[str] + """Describe the reason, in general terms.""" + + requested_limits: Required[RequestedLimits] + """Limits you want to increase.""" + + client_id: int + """Client ID that requests the limit increase.""" + + +class RequestedLimitsGlobalLimits(TypedDict, total=False): + inference_cpu_millicore_count_limit: int + """Inference CPU millicore count limit""" + + inference_gpu_a100_count_limit: int + """Inference GPU A100 Count limit""" + + inference_gpu_h100_count_limit: int + """Inference GPU H100 Count limit""" + + inference_gpu_l40s_count_limit: int + """Inference GPU L40s Count limit""" + + inference_instance_count_limit: int + """Inference instance count limit""" + + keypair_count_limit: int + """SSH Keys Count limit""" + + project_count_limit: int + """Projects Count limit""" + + +class RequestedLimitsRegionalLimit(TypedDict, total=False): + baremetal_basic_count_limit: int + """Basic bare metal servers count limit""" + + baremetal_gpu_count_limit: int + """AI GPU bare metal servers count limit""" + + baremetal_hf_count_limit: int + """High-frequency bare metal servers count limit""" + + baremetal_infrastructure_count_limit: int + """Infrastructure bare metal servers count limit""" + + baremetal_network_count_limit: int + """Bare metal Network Count limit""" + + baremetal_storage_count_limit: int + """Storage bare metal servers count limit""" + + caas_container_count_limit: int + """Containers count limit""" + + caas_cpu_count_limit: int + """mCPU count for containers limit""" + + caas_gpu_count_limit: int + """Containers gpu count limit""" + + caas_ram_size_limit: int + """MB memory count for containers limit""" + + cluster_count_limit: int + """K8s clusters count limit""" + + cpu_count_limit: int + """vCPU Count limit""" + + dbaas_postgres_cluster_count_limit: int + """DBaaS cluster count limit""" + + external_ip_count_limit: int + """External IP Count limit""" + + faas_cpu_count_limit: int + """mCPU count for functions limit""" + + faas_function_count_limit: int + """Functions count limit""" + + faas_namespace_count_limit: int + """Functions namespace count limit""" + + faas_ram_size_limit: int + """MB memory count for functions limit""" + + firewall_count_limit: int + """Firewalls Count limit""" + + floating_count_limit: int + """Floating IP Count limit""" + + gpu_count_limit: int + """GPU Count limit""" + + gpu_virtual_a100_count_limit: int + """Virtual A100 GPU card count limit""" + + gpu_virtual_h100_count_limit: int + """Virtual H100 GPU card count limit""" + + gpu_virtual_l40s_count_limit: int + """Virtual L40S GPU card count limit""" + + image_count_limit: int + """Images Count limit""" + + image_size_limit: int + """Images Size, GiB limit""" + + ipu_count_limit: int + """IPU Count limit""" + + laas_topic_count_limit: int + """LaaS Topics Count limit""" + + loadbalancer_count_limit: int + """Load Balancers Count limit""" + + network_count_limit: int + """Networks Count limit""" + + ram_limit: int + """RAM Size, GiB limit""" + + region_id: int + """Region ID""" + + registry_count_limit: int + """Registries count limit""" + + registry_storage_limit: int + """Registries volume usage, GiB limit""" + + router_count_limit: int + """Routers Count limit""" + + secret_count_limit: int + """Secret Count limit""" + + servergroup_count_limit: int + """Placement Group Count limit""" + + sfs_count_limit: int + """Shared file system Count limit""" + + sfs_size_limit: int + """Shared file system Size, GiB limit""" + + shared_vm_count_limit: int + """Basic VMs Count limit""" + + snapshot_schedule_count_limit: int + """Snapshot Schedules Count limit""" + + subnet_count_limit: int + """Subnets Count limit""" + + vm_count_limit: int + """Instances Dedicated Count limit""" + + volume_count_limit: int + """Volumes Count limit""" + + volume_size_limit: int + """Volumes Size, GiB limit""" + + volume_snapshots_count_limit: int + """Snapshots Count limit""" + + volume_snapshots_size_limit: int + """Snapshots Size, GiB limit""" + + +class RequestedLimits(TypedDict, total=False): + global_limits: RequestedLimitsGlobalLimits + """Global entity quota limits""" + + regional_limits: Iterable[RequestedLimitsRegionalLimit] + """Regions and their quota limits""" diff --git a/src/gcore/types/cloud/quotas/request_get_response.py b/src/gcore/types/cloud/quotas/request_get_response.py new file mode 100644 index 00000000..d01ceddc --- /dev/null +++ b/src/gcore/types/cloud/quotas/request_get_response.py @@ -0,0 +1,205 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["RequestGetResponse", "RequestedLimits", "RequestedLimitsGlobalLimits", "RequestedLimitsRegionalLimit"] + + +class RequestedLimitsGlobalLimits(BaseModel): + inference_cpu_millicore_count_limit: Optional[int] = None + """Inference CPU millicore count limit""" + + inference_gpu_a100_count_limit: Optional[int] = None + """Inference GPU A100 Count limit""" + + inference_gpu_h100_count_limit: Optional[int] = None + """Inference GPU H100 Count limit""" + + inference_gpu_l40s_count_limit: Optional[int] = None + """Inference GPU L40s Count limit""" + + inference_instance_count_limit: Optional[int] = None + """Inference instance count limit""" + + keypair_count_limit: Optional[int] = None + """SSH Keys Count limit""" + + project_count_limit: Optional[int] = None + """Projects Count limit""" + + +class RequestedLimitsRegionalLimit(BaseModel): + baremetal_basic_count_limit: Optional[int] = None + """Basic bare metal servers count limit""" + + baremetal_gpu_count_limit: Optional[int] = None + """AI GPU bare metal servers count limit""" + + baremetal_hf_count_limit: Optional[int] = None + """High-frequency bare metal servers count limit""" + + baremetal_infrastructure_count_limit: Optional[int] = None + """Infrastructure bare metal servers count limit""" + + baremetal_network_count_limit: Optional[int] = None + """Bare metal Network Count limit""" + + baremetal_storage_count_limit: Optional[int] = None + """Storage bare metal servers count limit""" + + caas_container_count_limit: Optional[int] = None + """Containers count limit""" + + caas_cpu_count_limit: Optional[int] = None + """mCPU count for containers limit""" + + caas_gpu_count_limit: Optional[int] = None + """Containers gpu count limit""" + + caas_ram_size_limit: Optional[int] = None + """MB memory count for containers limit""" + + cluster_count_limit: Optional[int] = None + """K8s clusters count limit""" + + cpu_count_limit: Optional[int] = None + """vCPU Count limit""" + + dbaas_postgres_cluster_count_limit: Optional[int] = None + """DBaaS cluster count limit""" + + external_ip_count_limit: Optional[int] = None + """External IP Count limit""" + + faas_cpu_count_limit: Optional[int] = None + """mCPU count for functions limit""" + + faas_function_count_limit: Optional[int] = None + """Functions count limit""" + + faas_namespace_count_limit: Optional[int] = None + """Functions namespace count limit""" + + faas_ram_size_limit: Optional[int] = None + """MB memory count for functions limit""" + + firewall_count_limit: Optional[int] = None + """Firewalls Count limit""" + + floating_count_limit: Optional[int] = None + """Floating IP Count limit""" + + gpu_count_limit: Optional[int] = None + """GPU Count limit""" + + gpu_virtual_a100_count_limit: Optional[int] = None + """Virtual A100 GPU card count limit""" + + gpu_virtual_h100_count_limit: Optional[int] = None + """Virtual H100 GPU card count limit""" + + gpu_virtual_l40s_count_limit: Optional[int] = None + """Virtual L40S GPU card count limit""" + + image_count_limit: Optional[int] = None + """Images Count limit""" + + image_size_limit: Optional[int] = None + """Images Size, GiB limit""" + + ipu_count_limit: Optional[int] = None + """IPU Count limit""" + + laas_topic_count_limit: Optional[int] = None + """LaaS Topics Count limit""" + + loadbalancer_count_limit: Optional[int] = None + """Load Balancers Count limit""" + + network_count_limit: Optional[int] = None + """Networks Count limit""" + + ram_limit: Optional[int] = None + """RAM Size, GiB limit""" + + region_id: Optional[int] = None + """Region ID""" + + registry_count_limit: Optional[int] = None + """Registries count limit""" + + registry_storage_limit: Optional[int] = None + """Registries volume usage, GiB limit""" + + router_count_limit: Optional[int] = None + """Routers Count limit""" + + secret_count_limit: Optional[int] = None + """Secret Count limit""" + + servergroup_count_limit: Optional[int] = None + """Placement Group Count limit""" + + sfs_count_limit: Optional[int] = None + """Shared file system Count limit""" + + sfs_size_limit: Optional[int] = None + """Shared file system Size, GiB limit""" + + shared_vm_count_limit: Optional[int] = None + """Basic VMs Count limit""" + + snapshot_schedule_count_limit: Optional[int] = None + """Snapshot Schedules Count limit""" + + subnet_count_limit: Optional[int] = None + """Subnets Count limit""" + + vm_count_limit: Optional[int] = None + """Instances Dedicated Count limit""" + + volume_count_limit: Optional[int] = None + """Volumes Count limit""" + + volume_size_limit: Optional[int] = None + """Volumes Size, GiB limit""" + + volume_snapshots_count_limit: Optional[int] = None + """Snapshots Count limit""" + + volume_snapshots_size_limit: Optional[int] = None + """Snapshots Size, GiB limit""" + + +class RequestedLimits(BaseModel): + global_limits: Optional[RequestedLimitsGlobalLimits] = None + """Global entity quota limits""" + + regional_limits: Optional[List[RequestedLimitsRegionalLimit]] = None + """Regions and their quota limits""" + + +class RequestGetResponse(BaseModel): + id: int + """Request ID""" + + client_id: int + """Client ID""" + + requested_limits: RequestedLimits + """Requested limits.""" + + status: str + """Request status""" + + created_at: Optional[datetime] = None + """Datetime when the request was created.""" + + description: Optional[str] = None + """Describe the reason, in general terms.""" + + updated_at: Optional[datetime] = None + """Datetime when the request was updated.""" diff --git a/src/gcore/types/cloud/quotas/request_list_params.py b/src/gcore/types/cloud/quotas/request_list_params.py new file mode 100644 index 00000000..556abaa1 --- /dev/null +++ b/src/gcore/types/cloud/quotas/request_list_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["RequestListParams"] + + +class RequestListParams(TypedDict, total=False): + limit: int + """Optional. Limit the number of returned items""" + + offset: int + """Optional. + + Offset value is used to exclude the first set of records from the result + """ + + status: Optional[List[Literal["done", "in progress", "rejected"]]] + """List of limit requests statuses for filtering""" diff --git a/tests/api_resources/cloud/quotas/__init__.py b/tests/api_resources/cloud/quotas/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/quotas/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/quotas/test_requests.py b/tests/api_resources/cloud/quotas/test_requests.py new file mode 100644 index 00000000..4cb9bf1b --- /dev/null +++ b/tests/api_resources/cloud/quotas/test_requests.py @@ -0,0 +1,450 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.quotas import RequestGetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRequests: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + request = client.cloud.quotas.requests.create( + description="Scale up mysql cluster", + requested_limits={}, + ) + assert request is None + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + request = client.cloud.quotas.requests.create( + description="Scale up mysql cluster", + requested_limits={ + "global_limits": { + "inference_cpu_millicore_count_limit": 0, + "inference_gpu_a100_count_limit": 0, + "inference_gpu_h100_count_limit": 0, + "inference_gpu_l40s_count_limit": 0, + "inference_instance_count_limit": 0, + "keypair_count_limit": 100, + "project_count_limit": 2, + }, + "regional_limits": [ + { + "baremetal_basic_count_limit": 0, + "baremetal_gpu_count_limit": 0, + "baremetal_hf_count_limit": 0, + "baremetal_infrastructure_count_limit": 0, + "baremetal_network_count_limit": 0, + "baremetal_storage_count_limit": 0, + "caas_container_count_limit": 0, + "caas_cpu_count_limit": 0, + "caas_gpu_count_limit": 0, + "caas_ram_size_limit": 0, + "cluster_count_limit": 0, + "cpu_count_limit": 0, + "dbaas_postgres_cluster_count_limit": 0, + "external_ip_count_limit": 0, + "faas_cpu_count_limit": 0, + "faas_function_count_limit": 0, + "faas_namespace_count_limit": 0, + "faas_ram_size_limit": 0, + "firewall_count_limit": 0, + "floating_count_limit": 0, + "gpu_count_limit": 0, + "gpu_virtual_a100_count_limit": 0, + "gpu_virtual_h100_count_limit": 0, + "gpu_virtual_l40s_count_limit": 0, + "image_count_limit": 0, + "image_size_limit": 0, + "ipu_count_limit": 0, + "laas_topic_count_limit": 0, + "loadbalancer_count_limit": 0, + "network_count_limit": 0, + "ram_limit": 0, + "region_id": 1, + "registry_count_limit": 0, + "registry_storage_limit": 0, + "router_count_limit": 0, + "secret_count_limit": 0, + "servergroup_count_limit": 0, + "sfs_count_limit": 0, + "sfs_size_limit": 0, + "shared_vm_count_limit": 0, + "snapshot_schedule_count_limit": 0, + "subnet_count_limit": 0, + "vm_count_limit": 0, + "volume_count_limit": 0, + "volume_size_limit": 0, + "volume_snapshots_count_limit": 0, + "volume_snapshots_size_limit": 0, + } + ], + }, + client_id=1, + ) + assert request is None + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.quotas.requests.with_raw_response.create( + description="Scale up mysql cluster", + requested_limits={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + request = response.parse() + assert request is None + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.quotas.requests.with_streaming_response.create( + description="Scale up mysql cluster", + requested_limits={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + request = response.parse() + assert request is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + request = client.cloud.quotas.requests.list() + assert request is None + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + request = client.cloud.quotas.requests.list( + limit=1000, + offset=0, + status=["done", "in progress"], + ) + assert request is None + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.quotas.requests.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + request = response.parse() + assert request is None + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.quotas.requests.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + request = response.parse() + assert request is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + request = client.cloud.quotas.requests.delete( + "request_id", + ) + assert request is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.quotas.requests.with_raw_response.delete( + "request_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + request = response.parse() + assert request is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.quotas.requests.with_streaming_response.delete( + "request_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + request = response.parse() + assert request is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + client.cloud.quotas.requests.with_raw_response.delete( + "", + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + request = client.cloud.quotas.requests.get( + "request_id", + ) + assert_matches_type(RequestGetResponse, request, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.quotas.requests.with_raw_response.get( + "request_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + request = response.parse() + assert_matches_type(RequestGetResponse, request, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.quotas.requests.with_streaming_response.get( + "request_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + request = response.parse() + assert_matches_type(RequestGetResponse, request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + client.cloud.quotas.requests.with_raw_response.get( + "", + ) + + +class TestAsyncRequests: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + request = await async_client.cloud.quotas.requests.create( + description="Scale up mysql cluster", + requested_limits={}, + ) + assert request is None + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + request = await async_client.cloud.quotas.requests.create( + description="Scale up mysql cluster", + requested_limits={ + "global_limits": { + "inference_cpu_millicore_count_limit": 0, + "inference_gpu_a100_count_limit": 0, + "inference_gpu_h100_count_limit": 0, + "inference_gpu_l40s_count_limit": 0, + "inference_instance_count_limit": 0, + "keypair_count_limit": 100, + "project_count_limit": 2, + }, + "regional_limits": [ + { + "baremetal_basic_count_limit": 0, + "baremetal_gpu_count_limit": 0, + "baremetal_hf_count_limit": 0, + "baremetal_infrastructure_count_limit": 0, + "baremetal_network_count_limit": 0, + "baremetal_storage_count_limit": 0, + "caas_container_count_limit": 0, + "caas_cpu_count_limit": 0, + "caas_gpu_count_limit": 0, + "caas_ram_size_limit": 0, + "cluster_count_limit": 0, + "cpu_count_limit": 0, + "dbaas_postgres_cluster_count_limit": 0, + "external_ip_count_limit": 0, + "faas_cpu_count_limit": 0, + "faas_function_count_limit": 0, + "faas_namespace_count_limit": 0, + "faas_ram_size_limit": 0, + "firewall_count_limit": 0, + "floating_count_limit": 0, + "gpu_count_limit": 0, + "gpu_virtual_a100_count_limit": 0, + "gpu_virtual_h100_count_limit": 0, + "gpu_virtual_l40s_count_limit": 0, + "image_count_limit": 0, + "image_size_limit": 0, + "ipu_count_limit": 0, + "laas_topic_count_limit": 0, + "loadbalancer_count_limit": 0, + "network_count_limit": 0, + "ram_limit": 0, + "region_id": 1, + "registry_count_limit": 0, + "registry_storage_limit": 0, + "router_count_limit": 0, + "secret_count_limit": 0, + "servergroup_count_limit": 0, + "sfs_count_limit": 0, + "sfs_size_limit": 0, + "shared_vm_count_limit": 0, + "snapshot_schedule_count_limit": 0, + "subnet_count_limit": 0, + "vm_count_limit": 0, + "volume_count_limit": 0, + "volume_size_limit": 0, + "volume_snapshots_count_limit": 0, + "volume_snapshots_size_limit": 0, + } + ], + }, + client_id=1, + ) + assert request is None + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.requests.with_raw_response.create( + description="Scale up mysql cluster", + requested_limits={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + request = await response.parse() + assert request is None + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.requests.with_streaming_response.create( + description="Scale up mysql cluster", + requested_limits={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + request = await response.parse() + assert request is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + request = await async_client.cloud.quotas.requests.list() + assert request is None + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + request = await async_client.cloud.quotas.requests.list( + limit=1000, + offset=0, + status=["done", "in progress"], + ) + assert request is None + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.requests.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + request = await response.parse() + assert request is None + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.requests.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + request = await response.parse() + assert request is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + request = await async_client.cloud.quotas.requests.delete( + "request_id", + ) + assert request is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.requests.with_raw_response.delete( + "request_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + request = await response.parse() + assert request is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.requests.with_streaming_response.delete( + "request_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + request = await response.parse() + assert request is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + await async_client.cloud.quotas.requests.with_raw_response.delete( + "", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + request = await async_client.cloud.quotas.requests.get( + "request_id", + ) + assert_matches_type(RequestGetResponse, request, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.requests.with_raw_response.get( + "request_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + request = await response.parse() + assert_matches_type(RequestGetResponse, request, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.requests.with_streaming_response.get( + "request_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + request = await response.parse() + assert_matches_type(RequestGetResponse, request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + await async_client.cloud.quotas.requests.with_raw_response.get( + "", + ) diff --git a/tests/api_resources/cloud/test_quotas.py b/tests/api_resources/cloud/test_quotas.py new file mode 100644 index 00000000..788423b7 --- /dev/null +++ b/tests/api_resources/cloud/test_quotas.py @@ -0,0 +1,202 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import QuotaGetAllResponse, QuotaGetGlobalResponse, QuotaGetByRegionResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestQuotas: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_all(self, client: Gcore) -> None: + quota = client.cloud.quotas.get_all() + assert_matches_type(QuotaGetAllResponse, quota, path=["response"]) + + @parametrize + def test_raw_response_get_all(self, client: Gcore) -> None: + response = client.cloud.quotas.with_raw_response.get_all() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + quota = response.parse() + assert_matches_type(QuotaGetAllResponse, quota, path=["response"]) + + @parametrize + def test_streaming_response_get_all(self, client: Gcore) -> None: + with client.cloud.quotas.with_streaming_response.get_all() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + quota = response.parse() + assert_matches_type(QuotaGetAllResponse, quota, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_by_region(self, client: Gcore) -> None: + quota = client.cloud.quotas.get_by_region( + client_id=3, + region_id=1, + ) + assert_matches_type(QuotaGetByRegionResponse, quota, path=["response"]) + + @parametrize + def test_raw_response_get_by_region(self, client: Gcore) -> None: + response = client.cloud.quotas.with_raw_response.get_by_region( + client_id=3, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + quota = response.parse() + assert_matches_type(QuotaGetByRegionResponse, quota, path=["response"]) + + @parametrize + def test_streaming_response_get_by_region(self, client: Gcore) -> None: + with client.cloud.quotas.with_streaming_response.get_by_region( + client_id=3, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + quota = response.parse() + assert_matches_type(QuotaGetByRegionResponse, quota, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_global(self, client: Gcore) -> None: + quota = client.cloud.quotas.get_global( + 3, + ) + assert_matches_type(QuotaGetGlobalResponse, quota, path=["response"]) + + @parametrize + def test_raw_response_get_global(self, client: Gcore) -> None: + response = client.cloud.quotas.with_raw_response.get_global( + 3, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + quota = response.parse() + assert_matches_type(QuotaGetGlobalResponse, quota, path=["response"]) + + @parametrize + def test_streaming_response_get_global(self, client: Gcore) -> None: + with client.cloud.quotas.with_streaming_response.get_global( + 3, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + quota = response.parse() + assert_matches_type(QuotaGetGlobalResponse, quota, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncQuotas: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_get_all(self, async_client: AsyncGcore) -> None: + quota = await async_client.cloud.quotas.get_all() + assert_matches_type(QuotaGetAllResponse, quota, path=["response"]) + + @parametrize + async def test_raw_response_get_all(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.with_raw_response.get_all() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + quota = await response.parse() + assert_matches_type(QuotaGetAllResponse, quota, path=["response"]) + + @parametrize + async def test_streaming_response_get_all(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.with_streaming_response.get_all() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + quota = await response.parse() + assert_matches_type(QuotaGetAllResponse, quota, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_by_region(self, async_client: AsyncGcore) -> None: + quota = await async_client.cloud.quotas.get_by_region( + client_id=3, + region_id=1, + ) + assert_matches_type(QuotaGetByRegionResponse, quota, path=["response"]) + + @parametrize + async def test_raw_response_get_by_region(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.with_raw_response.get_by_region( + client_id=3, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + quota = await response.parse() + assert_matches_type(QuotaGetByRegionResponse, quota, path=["response"]) + + @parametrize + async def test_streaming_response_get_by_region(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.with_streaming_response.get_by_region( + client_id=3, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + quota = await response.parse() + assert_matches_type(QuotaGetByRegionResponse, quota, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_global(self, async_client: AsyncGcore) -> None: + quota = await async_client.cloud.quotas.get_global( + 3, + ) + assert_matches_type(QuotaGetGlobalResponse, quota, path=["response"]) + + @parametrize + async def test_raw_response_get_global(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.quotas.with_raw_response.get_global( + 3, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + quota = await response.parse() + assert_matches_type(QuotaGetGlobalResponse, quota, path=["response"]) + + @parametrize + async def test_streaming_response_get_global(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.quotas.with_streaming_response.get_global( + 3, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + quota = await response.parse() + assert_matches_type(QuotaGetGlobalResponse, quota, path=["response"]) + + assert cast(Any, response.is_closed) is True From fabbadd0624d06678a13bed15f3dfb9605b35810 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 15:09:51 +0000 Subject: [PATCH 026/592] GCLOUD2-18568 Add cloud secrets --- .stats.yml | 4 +- api.md | 22 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + src/gcore/resources/cloud/secrets.py | 674 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 9 + src/gcore/types/cloud/secret.py | 64 ++ src/gcore/types/cloud/secret_create_params.py | 64 ++ .../types/cloud/secret_create_response.py | 12 + .../types/cloud/secret_delete_response.py | 12 + src/gcore/types/cloud/secret_list_response.py | 16 + .../secret_upload_tls_certificate_params.py | 37 + .../secret_upload_tls_certificate_response.py | 12 + tests/api_resources/cloud/test_secrets.py | 547 ++++++++++++++ 14 files changed, 1517 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/secrets.py create mode 100644 src/gcore/types/cloud/secret.py create mode 100644 src/gcore/types/cloud/secret_create_params.py create mode 100644 src/gcore/types/cloud/secret_create_response.py create mode 100644 src/gcore/types/cloud/secret_delete_response.py create mode 100644 src/gcore/types/cloud/secret_list_response.py create mode 100644 src/gcore/types/cloud/secret_upload_tls_certificate_params.py create mode 100644 src/gcore/types/cloud/secret_upload_tls_certificate_response.py create mode 100644 tests/api_resources/cloud/test_secrets.py diff --git a/.stats.yml b/.stats.yml index e6df6d42..f2cdcf4d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 16 +configured_endpoints: 21 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d04af2cbcfe6fac48c6fa7e72f8694129af5c16959ae8266e90be5e48b251fd8.yml openapi_spec_hash: fe9e9877f223c4b537615b146bec2391 -config_hash: 28b4e5e69c2f7b28102369554069ce78 +config_hash: 054ab9acfc5b1c5e2dfb25a2c7618863 diff --git a/api.md b/api.md index c7c05ce1..cf04b61f 100644 --- a/api.md +++ b/api.md @@ -70,3 +70,25 @@ Methods: - client.cloud.quotas.requests.list(\*\*params) -> None - client.cloud.quotas.requests.delete(request_id) -> None - client.cloud.quotas.requests.get(request_id) -> RequestGetResponse + +## Secrets + +Types: + +```python +from gcore.types.cloud import ( + Secret, + SecretCreateResponse, + SecretListResponse, + SecretDeleteResponse, + SecretUploadTlsCertificateResponse, +) +``` + +Methods: + +- client.cloud.secrets.create(\*, project_id, region_id, \*\*params) -> SecretCreateResponse +- client.cloud.secrets.list(\*, project_id, region_id) -> SecretListResponse +- client.cloud.secrets.delete(secret_id, \*, project_id, region_id) -> SecretDeleteResponse +- client.cloud.secrets.get(secret_id, \*, project_id, region_id) -> Secret +- client.cloud.secrets.upload_tls_certificate(\*, project_id, region_id, \*\*params) -> SecretUploadTlsCertificateResponse diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index fe1fa084..2308c9d9 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -32,6 +32,14 @@ RegionsResourceWithStreamingResponse, AsyncRegionsResourceWithStreamingResponse, ) +from .secrets import ( + SecretsResource, + AsyncSecretsResource, + SecretsResourceWithRawResponse, + AsyncSecretsResourceWithRawResponse, + SecretsResourceWithStreamingResponse, + AsyncSecretsResourceWithStreamingResponse, +) from .projects import ( ProjectsResource, AsyncProjectsResource, @@ -66,6 +74,12 @@ "AsyncQuotasResourceWithRawResponse", "QuotasResourceWithStreamingResponse", "AsyncQuotasResourceWithStreamingResponse", + "SecretsResource", + "AsyncSecretsResource", + "SecretsResourceWithRawResponse", + "AsyncSecretsResourceWithRawResponse", + "SecretsResourceWithStreamingResponse", + "AsyncSecretsResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 18483ede..4dfff591 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -18,6 +18,14 @@ RegionsResourceWithStreamingResponse, AsyncRegionsResourceWithStreamingResponse, ) +from .secrets import ( + SecretsResource, + AsyncSecretsResource, + SecretsResourceWithRawResponse, + AsyncSecretsResourceWithRawResponse, + SecretsResourceWithStreamingResponse, + AsyncSecretsResourceWithStreamingResponse, +) from .projects import ( ProjectsResource, AsyncProjectsResource, @@ -57,6 +65,10 @@ def regions(self) -> RegionsResource: def quotas(self) -> QuotasResource: return QuotasResource(self._client) + @cached_property + def secrets(self) -> SecretsResource: + return SecretsResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -94,6 +106,10 @@ def regions(self) -> AsyncRegionsResource: def quotas(self) -> AsyncQuotasResource: return AsyncQuotasResource(self._client) + @cached_property + def secrets(self) -> AsyncSecretsResource: + return AsyncSecretsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -134,6 +150,10 @@ def regions(self) -> RegionsResourceWithRawResponse: def quotas(self) -> QuotasResourceWithRawResponse: return QuotasResourceWithRawResponse(self._cloud.quotas) + @cached_property + def secrets(self) -> SecretsResourceWithRawResponse: + return SecretsResourceWithRawResponse(self._cloud.secrets) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -155,6 +175,10 @@ def regions(self) -> AsyncRegionsResourceWithRawResponse: def quotas(self) -> AsyncQuotasResourceWithRawResponse: return AsyncQuotasResourceWithRawResponse(self._cloud.quotas) + @cached_property + def secrets(self) -> AsyncSecretsResourceWithRawResponse: + return AsyncSecretsResourceWithRawResponse(self._cloud.secrets) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -176,6 +200,10 @@ def regions(self) -> RegionsResourceWithStreamingResponse: def quotas(self) -> QuotasResourceWithStreamingResponse: return QuotasResourceWithStreamingResponse(self._cloud.quotas) + @cached_property + def secrets(self) -> SecretsResourceWithStreamingResponse: + return SecretsResourceWithStreamingResponse(self._cloud.secrets) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -196,3 +224,7 @@ def regions(self) -> AsyncRegionsResourceWithStreamingResponse: @cached_property def quotas(self) -> AsyncQuotasResourceWithStreamingResponse: return AsyncQuotasResourceWithStreamingResponse(self._cloud.quotas) + + @cached_property + def secrets(self) -> AsyncSecretsResourceWithStreamingResponse: + return AsyncSecretsResourceWithStreamingResponse(self._cloud.secrets) diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py new file mode 100644 index 00000000..f07a58c0 --- /dev/null +++ b/src/gcore/resources/cloud/secrets.py @@ -0,0 +1,674 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( + maybe_transform, + async_maybe_transform, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cloud import secret_create_params, secret_upload_tls_certificate_params +from ..._base_client import make_request_options +from ...types.cloud.secret import Secret +from ...types.cloud.secret_list_response import SecretListResponse +from ...types.cloud.secret_create_response import SecretCreateResponse +from ...types.cloud.secret_delete_response import SecretDeleteResponse +from ...types.cloud.secret_upload_tls_certificate_response import SecretUploadTlsCertificateResponse + +__all__ = ["SecretsResource", "AsyncSecretsResource"] + + +class SecretsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SecretsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return SecretsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SecretsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return SecretsResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + payload: str, + payload_content_encoding: Literal["base64"], + payload_content_type: str, + secret_type: Literal["certificate", "opaque", "passphrase", "private", "public", "symmetric"], + algorithm: Optional[str] | NotGiven = NOT_GIVEN, + bit_length: Optional[int] | NotGiven = NOT_GIVEN, + expiration: Optional[str] | NotGiven = NOT_GIVEN, + mode: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecretCreateResponse: + """Create secret + + Args: + name: Secret name + + payload: Secret payload. + + For HTTPS-terminated load balancing, provide base64 encoded + conents of a PKCS12 file. The PKCS12 file is the combined TLS certificate, key, + and intermediate certificate chain obtained from an external certificate + authority. The file can be created via openssl, e.g.'openssl pkcs12 -export + -inkey server.key -in server.crt -certfile ca-chain.crt -passout pass: -out + server.p12'The key and certificate should be PEM-encoded, and the intermediate + certificate chain should be multiple PEM-encoded certs concatenated together + + payload_content_encoding: The encoding used for the payload to be able to include it in the JSON request. + Currently only base64 is supported + + payload_content_type: The media type for the content of the payload + + secret_type: Secret type. symmetric - Used for storing byte arrays such as keys suitable for + symmetric encryption; public - Used for storing the public key of an asymmetric + keypair; private - Used for storing the private key of an asymmetric keypair; + passphrase - Used for storing plain text passphrases; certificate - Used for + storing cryptographic certificates such as X.509 certificates; opaque - Used for + backwards compatibility with previous versions of the API + + algorithm: Metadata provided by a user or system for informational purposes. + + bit_length: Metadata provided by a user or system for informational purposes. Value must be + greater than zero. + + expiration: Datetime when the secret will expire. + + mode: Metadata provided by a user or system for informational purposes. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._post( + f"/cloud/v1/secrets/{project_id}/{region_id}", + body=maybe_transform( + { + "name": name, + "payload": payload, + "payload_content_encoding": payload_content_encoding, + "payload_content_type": payload_content_type, + "secret_type": secret_type, + "algorithm": algorithm, + "bit_length": bit_length, + "expiration": expiration, + "mode": mode, + }, + secret_create_params.SecretCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecretCreateResponse, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecretListResponse: + """ + List secrets + + 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 project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get( + f"/cloud/v1/secrets/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecretListResponse, + ) + + def delete( + self, + secret_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecretDeleteResponse: + """ + Delete secret + + 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 project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not secret_id: + raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") + return self._delete( + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecretDeleteResponse, + ) + + def get( + self, + secret_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Secret: + """ + Get secret + + 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 project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not secret_id: + raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") + return self._get( + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Secret, + ) + + def upload_tls_certificate( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + payload: secret_upload_tls_certificate_params.Payload, + expiration: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecretUploadTlsCertificateResponse: + """ + Create secret + + Args: + name: Secret name + + payload: Secret payload. + + expiration: Datetime when the secret will expire. Defaults to None + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._post( + f"/cloud/v2/secrets/{project_id}/{region_id}", + body=maybe_transform( + { + "name": name, + "payload": payload, + "expiration": expiration, + }, + secret_upload_tls_certificate_params.SecretUploadTlsCertificateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecretUploadTlsCertificateResponse, + ) + + +class AsyncSecretsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSecretsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncSecretsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSecretsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncSecretsResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + payload: str, + payload_content_encoding: Literal["base64"], + payload_content_type: str, + secret_type: Literal["certificate", "opaque", "passphrase", "private", "public", "symmetric"], + algorithm: Optional[str] | NotGiven = NOT_GIVEN, + bit_length: Optional[int] | NotGiven = NOT_GIVEN, + expiration: Optional[str] | NotGiven = NOT_GIVEN, + mode: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecretCreateResponse: + """Create secret + + Args: + name: Secret name + + payload: Secret payload. + + For HTTPS-terminated load balancing, provide base64 encoded + conents of a PKCS12 file. The PKCS12 file is the combined TLS certificate, key, + and intermediate certificate chain obtained from an external certificate + authority. The file can be created via openssl, e.g.'openssl pkcs12 -export + -inkey server.key -in server.crt -certfile ca-chain.crt -passout pass: -out + server.p12'The key and certificate should be PEM-encoded, and the intermediate + certificate chain should be multiple PEM-encoded certs concatenated together + + payload_content_encoding: The encoding used for the payload to be able to include it in the JSON request. + Currently only base64 is supported + + payload_content_type: The media type for the content of the payload + + secret_type: Secret type. symmetric - Used for storing byte arrays such as keys suitable for + symmetric encryption; public - Used for storing the public key of an asymmetric + keypair; private - Used for storing the private key of an asymmetric keypair; + passphrase - Used for storing plain text passphrases; certificate - Used for + storing cryptographic certificates such as X.509 certificates; opaque - Used for + backwards compatibility with previous versions of the API + + algorithm: Metadata provided by a user or system for informational purposes. + + bit_length: Metadata provided by a user or system for informational purposes. Value must be + greater than zero. + + expiration: Datetime when the secret will expire. + + mode: Metadata provided by a user or system for informational purposes. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._post( + f"/cloud/v1/secrets/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "name": name, + "payload": payload, + "payload_content_encoding": payload_content_encoding, + "payload_content_type": payload_content_type, + "secret_type": secret_type, + "algorithm": algorithm, + "bit_length": bit_length, + "expiration": expiration, + "mode": mode, + }, + secret_create_params.SecretCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecretCreateResponse, + ) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecretListResponse: + """ + List secrets + + 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 project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._get( + f"/cloud/v1/secrets/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecretListResponse, + ) + + async def delete( + self, + secret_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecretDeleteResponse: + """ + Delete secret + + 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 project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not secret_id: + raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") + return await self._delete( + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecretDeleteResponse, + ) + + async def get( + self, + secret_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Secret: + """ + Get secret + + 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 project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not secret_id: + raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") + return await self._get( + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Secret, + ) + + async def upload_tls_certificate( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + payload: secret_upload_tls_certificate_params.Payload, + expiration: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecretUploadTlsCertificateResponse: + """ + Create secret + + Args: + name: Secret name + + payload: Secret payload. + + expiration: Datetime when the secret will expire. Defaults to None + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._post( + f"/cloud/v2/secrets/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "name": name, + "payload": payload, + "expiration": expiration, + }, + secret_upload_tls_certificate_params.SecretUploadTlsCertificateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecretUploadTlsCertificateResponse, + ) + + +class SecretsResourceWithRawResponse: + def __init__(self, secrets: SecretsResource) -> None: + self._secrets = secrets + + self.create = to_raw_response_wrapper( + secrets.create, + ) + self.list = to_raw_response_wrapper( + secrets.list, + ) + self.delete = to_raw_response_wrapper( + secrets.delete, + ) + self.get = to_raw_response_wrapper( + secrets.get, + ) + self.upload_tls_certificate = to_raw_response_wrapper( + secrets.upload_tls_certificate, + ) + + +class AsyncSecretsResourceWithRawResponse: + def __init__(self, secrets: AsyncSecretsResource) -> None: + self._secrets = secrets + + self.create = async_to_raw_response_wrapper( + secrets.create, + ) + self.list = async_to_raw_response_wrapper( + secrets.list, + ) + self.delete = async_to_raw_response_wrapper( + secrets.delete, + ) + self.get = async_to_raw_response_wrapper( + secrets.get, + ) + self.upload_tls_certificate = async_to_raw_response_wrapper( + secrets.upload_tls_certificate, + ) + + +class SecretsResourceWithStreamingResponse: + def __init__(self, secrets: SecretsResource) -> None: + self._secrets = secrets + + self.create = to_streamed_response_wrapper( + secrets.create, + ) + self.list = to_streamed_response_wrapper( + secrets.list, + ) + self.delete = to_streamed_response_wrapper( + secrets.delete, + ) + self.get = to_streamed_response_wrapper( + secrets.get, + ) + self.upload_tls_certificate = to_streamed_response_wrapper( + secrets.upload_tls_certificate, + ) + + +class AsyncSecretsResourceWithStreamingResponse: + def __init__(self, secrets: AsyncSecretsResource) -> None: + self._secrets = secrets + + self.create = async_to_streamed_response_wrapper( + secrets.create, + ) + self.list = async_to_streamed_response_wrapper( + secrets.list, + ) + self.delete = async_to_streamed_response_wrapper( + secrets.delete, + ) + self.get = async_to_streamed_response_wrapper( + secrets.get, + ) + self.upload_tls_certificate = async_to_streamed_response_wrapper( + secrets.upload_tls_certificate, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index dc558d0e..acb07cec 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -4,14 +4,23 @@ from .task import Task as Task from .region import Region as Region +from .secret import Secret as Secret from .project import Project as Project from .task_list_params import TaskListParams as TaskListParams from .region_list_params import RegionListParams as RegionListParams from .project_list_params import ProjectListParams as ProjectListParams +from .secret_create_params import SecretCreateParams as SecretCreateParams +from .secret_list_response import SecretListResponse as SecretListResponse from .project_create_params import ProjectCreateParams as ProjectCreateParams from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams +from .secret_create_response import SecretCreateResponse as SecretCreateResponse +from .secret_delete_response import SecretDeleteResponse as SecretDeleteResponse from .project_delete_response import ProjectDeleteResponse as ProjectDeleteResponse from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse +from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams +from .secret_upload_tls_certificate_response import ( + SecretUploadTlsCertificateResponse as SecretUploadTlsCertificateResponse, +) diff --git a/src/gcore/types/cloud/secret.py b/src/gcore/types/cloud/secret.py new file mode 100644 index 00000000..e7eb5015 --- /dev/null +++ b/src/gcore/types/cloud/secret.py @@ -0,0 +1,64 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Secret"] + + +class Secret(BaseModel): + id: str + """Secret uuid""" + + name: str + """Secret name""" + + secret_type: Literal["certificate", "opaque", "passphrase", "private", "public", "symmetric"] + """Secret type, base64 encoded. + + symmetric - Used for storing byte arrays such as keys suitable for symmetric + encryption; public - Used for storing the public key of an asymmetric keypair; + private - Used for storing the private key of an asymmetric keypair; + passphrase - Used for storing plain text passphrases; certificate - Used for + storing cryptographic certificates such as X.509 certificates; opaque - Used for + backwards compatibility with previous versions of the API + """ + + status: str + """Status""" + + algorithm: Optional[str] = None + """Metadata provided by a user or system for informational purposes. + + Defaults to None + """ + + bit_length: Optional[int] = None + """Metadata provided by a user or system for informational purposes. + + Value must be greater than zero. Defaults to None + """ + + content_types: Optional[Dict[str, str]] = None + """Describes the content-types that can be used to retrieve the payload. + + The content-type used with symmetric secrets is application/octet-stream + """ + + created: Optional[datetime] = None + """Datetime when the secret was created. The format is 2020-01-01T12:00:00+00:00""" + + expiration: Optional[datetime] = None + """Datetime when the secret will expire. + + The format is 2020-01-01T12:00:00+00:00. Defaults to None + """ + + mode: Optional[str] = None + """Metadata provided by a user or system for informational purposes. + + Defaults to None + """ diff --git a/src/gcore/types/cloud/secret_create_params.py b/src/gcore/types/cloud/secret_create_params.py new file mode 100644 index 00000000..6b8d4e8f --- /dev/null +++ b/src/gcore/types/cloud/secret_create_params.py @@ -0,0 +1,64 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["SecretCreateParams"] + + +class SecretCreateParams(TypedDict, total=False): + project_id: int + + region_id: int + + name: Required[str] + """Secret name""" + + payload: Required[str] + """Secret payload. + + For HTTPS-terminated load balancing, provide base64 encoded conents of a PKCS12 + file. The PKCS12 file is the combined TLS certificate, key, and intermediate + certificate chain obtained from an external certificate authority. The file can + be created via openssl, e.g.'openssl pkcs12 -export -inkey server.key -in + server.crt -certfile ca-chain.crt -passout pass: -out server.p12'The key and + certificate should be PEM-encoded, and the intermediate certificate chain should + be multiple PEM-encoded certs concatenated together + """ + + payload_content_encoding: Required[Literal["base64"]] + """The encoding used for the payload to be able to include it in the JSON request. + + Currently only base64 is supported + """ + + payload_content_type: Required[str] + """The media type for the content of the payload""" + + secret_type: Required[Literal["certificate", "opaque", "passphrase", "private", "public", "symmetric"]] + """Secret type. + + symmetric - Used for storing byte arrays such as keys suitable for symmetric + encryption; public - Used for storing the public key of an asymmetric keypair; + private - Used for storing the private key of an asymmetric keypair; + passphrase - Used for storing plain text passphrases; certificate - Used for + storing cryptographic certificates such as X.509 certificates; opaque - Used for + backwards compatibility with previous versions of the API + """ + + algorithm: Optional[str] + """Metadata provided by a user or system for informational purposes.""" + + bit_length: Optional[int] + """Metadata provided by a user or system for informational purposes. + + Value must be greater than zero. + """ + + expiration: Optional[str] + """Datetime when the secret will expire.""" + + mode: Optional[str] + """Metadata provided by a user or system for informational purposes.""" diff --git a/src/gcore/types/cloud/secret_create_response.py b/src/gcore/types/cloud/secret_create_response.py new file mode 100644 index 00000000..c6fec048 --- /dev/null +++ b/src/gcore/types/cloud/secret_create_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["SecretCreateResponse"] + + +class SecretCreateResponse(BaseModel): + tasks: Optional[List[str]] = None + """Task list""" diff --git a/src/gcore/types/cloud/secret_delete_response.py b/src/gcore/types/cloud/secret_delete_response.py new file mode 100644 index 00000000..6af0c350 --- /dev/null +++ b/src/gcore/types/cloud/secret_delete_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["SecretDeleteResponse"] + + +class SecretDeleteResponse(BaseModel): + tasks: Optional[List[str]] = None + """Task list""" diff --git a/src/gcore/types/cloud/secret_list_response.py b/src/gcore/types/cloud/secret_list_response.py new file mode 100644 index 00000000..b6680c6c --- /dev/null +++ b/src/gcore/types/cloud/secret_list_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .secret import Secret +from ..._models import BaseModel + +__all__ = ["SecretListResponse"] + + +class SecretListResponse(BaseModel): + count: int + """Number of objects""" + + results: List[Secret] + """Objects""" diff --git a/src/gcore/types/cloud/secret_upload_tls_certificate_params.py b/src/gcore/types/cloud/secret_upload_tls_certificate_params.py new file mode 100644 index 00000000..4f394524 --- /dev/null +++ b/src/gcore/types/cloud/secret_upload_tls_certificate_params.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["SecretUploadTlsCertificateParams", "Payload"] + + +class SecretUploadTlsCertificateParams(TypedDict, total=False): + project_id: int + + region_id: int + + name: Required[str] + """Secret name""" + + payload: Required[Payload] + """Secret payload.""" + + expiration: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """Datetime when the secret will expire. Defaults to None""" + + +class Payload(TypedDict, total=False): + certificate: Required[str] + """SSL certificate in PEM format.""" + + certificate_chain: Required[str] + """SSL certificate chain of intermediates and root certificates in PEM format.""" + + private_key: Required[str] + """SSL private key in PEM format.""" diff --git a/src/gcore/types/cloud/secret_upload_tls_certificate_response.py b/src/gcore/types/cloud/secret_upload_tls_certificate_response.py new file mode 100644 index 00000000..ae5b1a98 --- /dev/null +++ b/src/gcore/types/cloud/secret_upload_tls_certificate_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["SecretUploadTlsCertificateResponse"] + + +class SecretUploadTlsCertificateResponse(BaseModel): + tasks: Optional[List[str]] = None + """Task list""" diff --git a/tests/api_resources/cloud/test_secrets.py b/tests/api_resources/cloud/test_secrets.py new file mode 100644 index 00000000..6a88c2b3 --- /dev/null +++ b/tests/api_resources/cloud/test_secrets.py @@ -0,0 +1,547 @@ +# 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._utils import parse_datetime +from gcore.types.cloud import ( + Secret, + SecretListResponse, + SecretCreateResponse, + SecretDeleteResponse, + SecretUploadTlsCertificateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSecrets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + secret = client.cloud.secrets.create( + project_id=0, + region_id=0, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + ) + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + secret = client.cloud.secrets.create( + project_id=0, + region_id=0, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + algorithm="aes", + bit_length=256, + expiration="2025-12-28T19:14:44.180394", + mode="cbc", + ) + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.secrets.with_raw_response.create( + project_id=0, + region_id=0, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.secrets.with_streaming_response.create( + project_id=0, + region_id=0, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + secret = client.cloud.secrets.list( + project_id=0, + region_id=0, + ) + assert_matches_type(SecretListResponse, secret, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.secrets.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(SecretListResponse, secret, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.secrets.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(SecretListResponse, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + secret = client.cloud.secrets.delete( + secret_id="secret_id", + project_id=0, + region_id=0, + ) + assert_matches_type(SecretDeleteResponse, secret, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.secrets.with_raw_response.delete( + secret_id="secret_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(SecretDeleteResponse, secret, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.secrets.with_streaming_response.delete( + secret_id="secret_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(SecretDeleteResponse, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_id` but received ''"): + client.cloud.secrets.with_raw_response.delete( + secret_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + secret = client.cloud.secrets.get( + secret_id="secret_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.secrets.with_raw_response.get( + secret_id="secret_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.secrets.with_streaming_response.get( + secret_id="secret_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_id` but received ''"): + client.cloud.secrets.with_raw_response.get( + secret_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_upload_tls_certificate(self, client: Gcore) -> None: + secret = client.cloud.secrets.upload_tls_certificate( + project_id=0, + region_id=0, + name="Load balancer certificate #1", + payload={ + "certificate": "", + "certificate_chain": "", + "private_key": "", + }, + ) + assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + + @parametrize + def test_method_upload_tls_certificate_with_all_params(self, client: Gcore) -> None: + secret = client.cloud.secrets.upload_tls_certificate( + project_id=0, + region_id=0, + name="Load balancer certificate #1", + payload={ + "certificate": "", + "certificate_chain": "", + "private_key": "", + }, + expiration=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + + @parametrize + def test_raw_response_upload_tls_certificate(self, client: Gcore) -> None: + response = client.cloud.secrets.with_raw_response.upload_tls_certificate( + project_id=0, + region_id=0, + name="Load balancer certificate #1", + payload={ + "certificate": "", + "certificate_chain": "", + "private_key": "", + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + + @parametrize + def test_streaming_response_upload_tls_certificate(self, client: Gcore) -> None: + with client.cloud.secrets.with_streaming_response.upload_tls_certificate( + project_id=0, + region_id=0, + name="Load balancer certificate #1", + payload={ + "certificate": "", + "certificate_chain": "", + "private_key": "", + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncSecrets: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.secrets.create( + project_id=0, + region_id=0, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + ) + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.secrets.create( + project_id=0, + region_id=0, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + algorithm="aes", + bit_length=256, + expiration="2025-12-28T19:14:44.180394", + mode="cbc", + ) + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.secrets.with_raw_response.create( + project_id=0, + region_id=0, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.secrets.with_streaming_response.create( + project_id=0, + region_id=0, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.secrets.list( + project_id=0, + region_id=0, + ) + assert_matches_type(SecretListResponse, secret, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.secrets.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(SecretListResponse, secret, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.secrets.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(SecretListResponse, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.secrets.delete( + secret_id="secret_id", + project_id=0, + region_id=0, + ) + assert_matches_type(SecretDeleteResponse, secret, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.secrets.with_raw_response.delete( + secret_id="secret_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(SecretDeleteResponse, secret, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.secrets.with_streaming_response.delete( + secret_id="secret_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(SecretDeleteResponse, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_id` but received ''"): + await async_client.cloud.secrets.with_raw_response.delete( + secret_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.secrets.get( + secret_id="secret_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.secrets.with_raw_response.get( + secret_id="secret_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.secrets.with_streaming_response.get( + secret_id="secret_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_id` but received ''"): + await async_client.cloud.secrets.with_raw_response.get( + secret_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_upload_tls_certificate(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.secrets.upload_tls_certificate( + project_id=0, + region_id=0, + name="Load balancer certificate #1", + payload={ + "certificate": "", + "certificate_chain": "", + "private_key": "", + }, + ) + assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + + @parametrize + async def test_method_upload_tls_certificate_with_all_params(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.secrets.upload_tls_certificate( + project_id=0, + region_id=0, + name="Load balancer certificate #1", + payload={ + "certificate": "", + "certificate_chain": "", + "private_key": "", + }, + expiration=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + + @parametrize + async def test_raw_response_upload_tls_certificate(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.secrets.with_raw_response.upload_tls_certificate( + project_id=0, + region_id=0, + name="Load balancer certificate #1", + payload={ + "certificate": "", + "certificate_chain": "", + "private_key": "", + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + + @parametrize + async def test_streaming_response_upload_tls_certificate(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.secrets.with_streaming_response.upload_tls_certificate( + project_id=0, + region_id=0, + name="Load balancer certificate #1", + payload={ + "certificate": "", + "certificate_chain": "", + "private_key": "", + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True From ecf01e4a583ab74a7c0cf4cd7cbb454756f98c60 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 19:04:59 +0000 Subject: [PATCH 027/592] GCLOUD2-18567 Add cloud ssh keys --- .stats.yml | 4 +- api.md | 16 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + src/gcore/resources/cloud/ssh_keys.py | 638 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 5 + src/gcore/types/cloud/created_ssh_key.py | 53 ++ src/gcore/types/cloud/ssh_key.py | 39 ++ .../types/cloud/ssh_key_create_params.py | 31 + src/gcore/types/cloud/ssh_key_list_params.py | 21 + .../types/cloud/ssh_key_update_params.py | 15 + tests/api_resources/cloud/test_ssh_keys.py | 453 +++++++++++++ 12 files changed, 1319 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/ssh_keys.py create mode 100644 src/gcore/types/cloud/created_ssh_key.py create mode 100644 src/gcore/types/cloud/ssh_key.py create mode 100644 src/gcore/types/cloud/ssh_key_create_params.py create mode 100644 src/gcore/types/cloud/ssh_key_list_params.py create mode 100644 src/gcore/types/cloud/ssh_key_update_params.py create mode 100644 tests/api_resources/cloud/test_ssh_keys.py diff --git a/.stats.yml b/.stats.yml index f2cdcf4d..2ea8307b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 21 +configured_endpoints: 26 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d04af2cbcfe6fac48c6fa7e72f8694129af5c16959ae8266e90be5e48b251fd8.yml openapi_spec_hash: fe9e9877f223c4b537615b146bec2391 -config_hash: 054ab9acfc5b1c5e2dfb25a2c7618863 +config_hash: b14923288ca3041ced21430452ca0a54 diff --git a/api.md b/api.md index cf04b61f..ce2162b6 100644 --- a/api.md +++ b/api.md @@ -92,3 +92,19 @@ Methods: - client.cloud.secrets.delete(secret_id, \*, project_id, region_id) -> SecretDeleteResponse - client.cloud.secrets.get(secret_id, \*, project_id, region_id) -> Secret - client.cloud.secrets.upload_tls_certificate(\*, project_id, region_id, \*\*params) -> SecretUploadTlsCertificateResponse + +## SSHKeys + +Types: + +```python +from gcore.types.cloud import CreatedSSHKey, SSHKey +``` + +Methods: + +- client.cloud.ssh_keys.create(\*, project_id, \*\*params) -> CreatedSSHKey +- 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 +- client.cloud.ssh_keys.get(ssh_key_id, \*, project_id) -> SSHKey diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 2308c9d9..c79d3f9d 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -48,6 +48,14 @@ ProjectsResourceWithStreamingResponse, AsyncProjectsResourceWithStreamingResponse, ) +from .ssh_keys import ( + SSHKeysResource, + AsyncSSHKeysResource, + SSHKeysResourceWithRawResponse, + AsyncSSHKeysResourceWithRawResponse, + SSHKeysResourceWithStreamingResponse, + AsyncSSHKeysResourceWithStreamingResponse, +) __all__ = [ "ProjectsResource", @@ -80,6 +88,12 @@ "AsyncSecretsResourceWithRawResponse", "SecretsResourceWithStreamingResponse", "AsyncSecretsResourceWithStreamingResponse", + "SSHKeysResource", + "AsyncSSHKeysResource", + "SSHKeysResourceWithRawResponse", + "AsyncSSHKeysResourceWithRawResponse", + "SSHKeysResourceWithStreamingResponse", + "AsyncSSHKeysResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 4dfff591..08ccd9da 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -34,6 +34,14 @@ ProjectsResourceWithStreamingResponse, AsyncProjectsResourceWithStreamingResponse, ) +from .ssh_keys import ( + SSHKeysResource, + AsyncSSHKeysResource, + SSHKeysResourceWithRawResponse, + AsyncSSHKeysResourceWithRawResponse, + SSHKeysResourceWithStreamingResponse, + AsyncSSHKeysResourceWithStreamingResponse, +) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from .quotas.quotas import ( @@ -69,6 +77,10 @@ def quotas(self) -> QuotasResource: def secrets(self) -> SecretsResource: return SecretsResource(self._client) + @cached_property + def ssh_keys(self) -> SSHKeysResource: + return SSHKeysResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -110,6 +122,10 @@ def quotas(self) -> AsyncQuotasResource: def secrets(self) -> AsyncSecretsResource: return AsyncSecretsResource(self._client) + @cached_property + def ssh_keys(self) -> AsyncSSHKeysResource: + return AsyncSSHKeysResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -154,6 +170,10 @@ def quotas(self) -> QuotasResourceWithRawResponse: def secrets(self) -> SecretsResourceWithRawResponse: return SecretsResourceWithRawResponse(self._cloud.secrets) + @cached_property + def ssh_keys(self) -> SSHKeysResourceWithRawResponse: + return SSHKeysResourceWithRawResponse(self._cloud.ssh_keys) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -179,6 +199,10 @@ def quotas(self) -> AsyncQuotasResourceWithRawResponse: def secrets(self) -> AsyncSecretsResourceWithRawResponse: return AsyncSecretsResourceWithRawResponse(self._cloud.secrets) + @cached_property + def ssh_keys(self) -> AsyncSSHKeysResourceWithRawResponse: + return AsyncSSHKeysResourceWithRawResponse(self._cloud.ssh_keys) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -204,6 +228,10 @@ def quotas(self) -> QuotasResourceWithStreamingResponse: def secrets(self) -> SecretsResourceWithStreamingResponse: return SecretsResourceWithStreamingResponse(self._cloud.secrets) + @cached_property + def ssh_keys(self) -> SSHKeysResourceWithStreamingResponse: + return SSHKeysResourceWithStreamingResponse(self._cloud.ssh_keys) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -228,3 +256,7 @@ def quotas(self) -> AsyncQuotasResourceWithStreamingResponse: @cached_property def secrets(self) -> AsyncSecretsResourceWithStreamingResponse: return AsyncSecretsResourceWithStreamingResponse(self._cloud.secrets) + + @cached_property + def ssh_keys(self) -> AsyncSSHKeysResourceWithStreamingResponse: + return AsyncSSHKeysResourceWithStreamingResponse(self._cloud.ssh_keys) diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py new file mode 100644 index 00000000..d587377d --- /dev/null +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -0,0 +1,638 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ...pagination import SyncOffsetPage, AsyncOffsetPage +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.created_ssh_key import CreatedSSHKey + +__all__ = ["SSHKeysResource", "AsyncSSHKeysResource"] + + +class SSHKeysResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SSHKeysResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return SSHKeysResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SSHKeysResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return SSHKeysResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + name: str, + public_key: str | NotGiven = NOT_GIVEN, + shared_in_project: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CreatedSSHKey: + """ + To generate a key, omit the public_key parameter from the request body + + Args: + project_id: Project ID + + name: SSH key name + + public_key: The public part of an SSH key is the shareable portion of an SSH key pair. It + can be safely sent to servers or services to grant access. It does not contain + sensitive information. + + - If you’re uploading your own key, provide the public part here (usually found + in a file like `id_ed25519.pub`). + - If you want the platform to generate an Ed25519 key pair for you, leave this + field empty — the system will return the private key in the response **once + only**. + + shared_in_project: SSH key is shared with all users in the project + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + return self._post( + f"/cloud/v1/ssh_keys/{project_id}", + body=maybe_transform( + { + "name": name, + "public_key": public_key, + "shared_in_project": shared_in_project, + }, + ssh_key_create_params.SSHKeyCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CreatedSSHKey, + ) + + def update( + self, + ssh_key_id: str, + *, + project_id: int | None = None, + shared_in_project: bool, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SSHKey: + """ + Share or unshare SSH key with users + + Args: + project_id: Project ID + + ssh_key_id: SSH key ID + + shared_in_project: Share your ssh key with all users in the project + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if not ssh_key_id: + raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") + return self._patch( + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + body=maybe_transform({"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SSHKey, + ) + + def list( + self, + *, + project_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[SSHKey]: + """ + List SSH keys + + Args: + project_id: Project ID + + limit: Maximum number of SSH keys to return + + offset: Offset for pagination + + order_by: Sort order for the SSH keys + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + return self._get_api_list( + f"/cloud/v1/ssh_keys/{project_id}", + page=SyncOffsetPage[SSHKey], + 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, + }, + ssh_key_list_params.SSHKeyListParams, + ), + ), + model=SSHKey, + ) + + def delete( + self, + ssh_key_id: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete SSH key + + Args: + project_id: Project ID + + ssh_key_id: SSH key ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if not ssh_key_id: + raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + ssh_key_id: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SSHKey: + """ + Get SSH key + + Args: + project_id: Project ID + + ssh_key_id: SSH key ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if not ssh_key_id: + raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") + return self._get( + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SSHKey, + ) + + +class AsyncSSHKeysResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSSHKeysResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncSSHKeysResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSSHKeysResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncSSHKeysResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + name: str, + public_key: str | NotGiven = NOT_GIVEN, + shared_in_project: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CreatedSSHKey: + """ + To generate a key, omit the public_key parameter from the request body + + Args: + project_id: Project ID + + name: SSH key name + + public_key: The public part of an SSH key is the shareable portion of an SSH key pair. It + can be safely sent to servers or services to grant access. It does not contain + sensitive information. + + - If you’re uploading your own key, provide the public part here (usually found + in a file like `id_ed25519.pub`). + - If you want the platform to generate an Ed25519 key pair for you, leave this + field empty — the system will return the private key in the response **once + only**. + + shared_in_project: SSH key is shared with all users in the project + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + return await self._post( + f"/cloud/v1/ssh_keys/{project_id}", + body=await async_maybe_transform( + { + "name": name, + "public_key": public_key, + "shared_in_project": shared_in_project, + }, + ssh_key_create_params.SSHKeyCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CreatedSSHKey, + ) + + async def update( + self, + ssh_key_id: str, + *, + project_id: int | None = None, + shared_in_project: bool, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SSHKey: + """ + Share or unshare SSH key with users + + Args: + project_id: Project ID + + ssh_key_id: SSH key ID + + shared_in_project: Share your ssh key with all users in the project + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if not ssh_key_id: + raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") + return await self._patch( + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + body=await async_maybe_transform( + {"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SSHKey, + ) + + def list( + self, + *, + project_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[SSHKey, AsyncOffsetPage[SSHKey]]: + """ + List SSH keys + + Args: + project_id: Project ID + + limit: Maximum number of SSH keys to return + + offset: Offset for pagination + + order_by: Sort order for the SSH keys + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + return self._get_api_list( + f"/cloud/v1/ssh_keys/{project_id}", + page=AsyncOffsetPage[SSHKey], + 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, + }, + ssh_key_list_params.SSHKeyListParams, + ), + ), + model=SSHKey, + ) + + async def delete( + self, + ssh_key_id: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete SSH key + + Args: + project_id: Project ID + + ssh_key_id: SSH key ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if not ssh_key_id: + raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + ssh_key_id: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SSHKey: + """ + Get SSH key + + Args: + project_id: Project ID + + ssh_key_id: SSH key ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if not ssh_key_id: + raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") + return await self._get( + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SSHKey, + ) + + +class SSHKeysResourceWithRawResponse: + def __init__(self, ssh_keys: SSHKeysResource) -> None: + self._ssh_keys = ssh_keys + + self.create = to_raw_response_wrapper( + ssh_keys.create, + ) + self.update = to_raw_response_wrapper( + ssh_keys.update, + ) + self.list = to_raw_response_wrapper( + ssh_keys.list, + ) + self.delete = to_raw_response_wrapper( + ssh_keys.delete, + ) + self.get = to_raw_response_wrapper( + ssh_keys.get, + ) + + +class AsyncSSHKeysResourceWithRawResponse: + def __init__(self, ssh_keys: AsyncSSHKeysResource) -> None: + self._ssh_keys = ssh_keys + + self.create = async_to_raw_response_wrapper( + ssh_keys.create, + ) + self.update = async_to_raw_response_wrapper( + ssh_keys.update, + ) + self.list = async_to_raw_response_wrapper( + ssh_keys.list, + ) + self.delete = async_to_raw_response_wrapper( + ssh_keys.delete, + ) + self.get = async_to_raw_response_wrapper( + ssh_keys.get, + ) + + +class SSHKeysResourceWithStreamingResponse: + def __init__(self, ssh_keys: SSHKeysResource) -> None: + self._ssh_keys = ssh_keys + + self.create = to_streamed_response_wrapper( + ssh_keys.create, + ) + self.update = to_streamed_response_wrapper( + ssh_keys.update, + ) + self.list = to_streamed_response_wrapper( + ssh_keys.list, + ) + self.delete = to_streamed_response_wrapper( + ssh_keys.delete, + ) + self.get = to_streamed_response_wrapper( + ssh_keys.get, + ) + + +class AsyncSSHKeysResourceWithStreamingResponse: + def __init__(self, ssh_keys: AsyncSSHKeysResource) -> None: + self._ssh_keys = ssh_keys + + self.create = async_to_streamed_response_wrapper( + ssh_keys.create, + ) + self.update = async_to_streamed_response_wrapper( + ssh_keys.update, + ) + self.list = async_to_streamed_response_wrapper( + ssh_keys.list, + ) + self.delete = async_to_streamed_response_wrapper( + ssh_keys.delete, + ) + self.get = async_to_streamed_response_wrapper( + ssh_keys.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index acb07cec..2eccd2fe 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -6,12 +6,17 @@ from .region import Region as Region from .secret import Secret as Secret from .project import Project as Project +from .ssh_key import SSHKey as SSHKey +from .created_ssh_key import CreatedSSHKey as CreatedSSHKey from .task_list_params import TaskListParams as TaskListParams from .region_list_params import RegionListParams as RegionListParams from .project_list_params import ProjectListParams as ProjectListParams +from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams from .secret_create_params import SecretCreateParams as SecretCreateParams from .secret_list_response import SecretListResponse as SecretListResponse from .project_create_params import ProjectCreateParams as ProjectCreateParams +from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams +from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams diff --git a/src/gcore/types/cloud/created_ssh_key.py b/src/gcore/types/cloud/created_ssh_key.py new file mode 100644 index 00000000..d31c4bf3 --- /dev/null +++ b/src/gcore/types/cloud/created_ssh_key.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["CreatedSSHKey"] + + +class CreatedSSHKey(BaseModel): + id: str + """SSH key ID""" + + created_at: datetime + """SSH key creation time""" + + fingerprint: str + """Fingerprint""" + + name: str + """SSH key name""" + + private_key: Optional[str] = None + """The private part of an SSH key is the confidential portion of the key pair. + + It should never be shared or exposed. This key is used to prove your identity + when connecting to a server. + + If you omit the `public_key`, the platform will generate a key for you. The + private_key will be returned **once** in the API response. Be sure to save it + securely, as it cannot be retrieved again later. + + Best practice: Save the private key to a secure location on your machine (e.g., + `~/.ssh/id_ed25519`) and set the file permissions to be readable only by you. + """ + + project_id: int + """Project ID""" + + public_key: str + """The public part of an SSH key is the shareable portion of an SSH key pair. + + It can be safely sent to servers or services to grant access. It does not + contain sensitive information. + """ + + shared_in_project: bool + """SSH key will be visible to all users in the project""" + + state: Literal["ACTIVE", "DELETING"] + """SSH key state""" diff --git a/src/gcore/types/cloud/ssh_key.py b/src/gcore/types/cloud/ssh_key.py new file mode 100644 index 00000000..1430a38d --- /dev/null +++ b/src/gcore/types/cloud/ssh_key.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["SSHKey"] + + +class SSHKey(BaseModel): + id: str + """SSH key ID""" + + created_at: Optional[datetime] = None + """SSH key creation time""" + + fingerprint: str + """Fingerprint""" + + name: str + """SSH key name""" + + project_id: Optional[int] = None + """Project ID""" + + public_key: str + """The public part of an SSH key is the shareable portion of an SSH key pair. + + It can be safely sent to servers or services to grant access. It does not + contain sensitive information. + """ + + shared_in_project: bool + """SSH key will be visible to all users in the project""" + + state: Literal["ACTIVE", "DELETING"] + """SSH key state""" diff --git a/src/gcore/types/cloud/ssh_key_create_params.py b/src/gcore/types/cloud/ssh_key_create_params.py new file mode 100644 index 00000000..65008f58 --- /dev/null +++ b/src/gcore/types/cloud/ssh_key_create_params.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["SSHKeyCreateParams"] + + +class SSHKeyCreateParams(TypedDict, total=False): + project_id: int + """Project ID""" + + name: Required[str] + """SSH key name""" + + public_key: str + """The public part of an SSH key is the shareable portion of an SSH key pair. + + It can be safely sent to servers or services to grant access. It does not + contain sensitive information. + + - If you’re uploading your own key, provide the public part here (usually found + in a file like `id_ed25519.pub`). + - If you want the platform to generate an Ed25519 key pair for you, leave this + field empty — the system will return the private key in the response **once + only**. + """ + + shared_in_project: bool + """SSH key is shared with all users in the project""" diff --git a/src/gcore/types/cloud/ssh_key_list_params.py b/src/gcore/types/cloud/ssh_key_list_params.py new file mode 100644 index 00000000..a3dea48f --- /dev/null +++ b/src/gcore/types/cloud/ssh_key_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__ = ["SSHKeyListParams"] + + +class SSHKeyListParams(TypedDict, total=False): + project_id: int + """Project ID""" + + limit: int + """Maximum number of SSH keys to return""" + + offset: int + """Offset for pagination""" + + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] + """Sort order for the SSH keys""" diff --git a/src/gcore/types/cloud/ssh_key_update_params.py b/src/gcore/types/cloud/ssh_key_update_params.py new file mode 100644 index 00000000..5efc271e --- /dev/null +++ b/src/gcore/types/cloud/ssh_key_update_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["SSHKeyUpdateParams"] + + +class SSHKeyUpdateParams(TypedDict, total=False): + project_id: int + """Project ID""" + + shared_in_project: Required[bool] + """Share your ssh key with all users in the project""" diff --git a/tests/api_resources/cloud/test_ssh_keys.py b/tests/api_resources/cloud/test_ssh_keys.py new file mode 100644 index 00000000..66bff585 --- /dev/null +++ b/tests/api_resources/cloud/test_ssh_keys.py @@ -0,0 +1,453 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import SSHKey, CreatedSSHKey + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSSHKeys: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + ssh_key = client.cloud.ssh_keys.create( + project_id=1, + name="my-ssh-key", + ) + assert_matches_type(CreatedSSHKey, ssh_key, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + ssh_key = client.cloud.ssh_keys.create( + project_id=1, + name="my-ssh-key", + public_key="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIjxL6g1II8NsO8odvBwGKvq2Dx/h/xrvsV9b9LVIYKm my-username@my-hostname", + shared_in_project=True, + ) + assert_matches_type(CreatedSSHKey, ssh_key, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.ssh_keys.with_raw_response.create( + project_id=1, + name="my-ssh-key", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ssh_key = response.parse() + assert_matches_type(CreatedSSHKey, ssh_key, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.ssh_keys.with_streaming_response.create( + project_id=1, + name="my-ssh-key", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ssh_key = response.parse() + assert_matches_type(CreatedSSHKey, ssh_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + ssh_key = client.cloud.ssh_keys.update( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + shared_in_project=True, + ) + assert_matches_type(SSHKey, ssh_key, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.ssh_keys.with_raw_response.update( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + shared_in_project=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ssh_key = response.parse() + assert_matches_type(SSHKey, ssh_key, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.ssh_keys.with_streaming_response.update( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + shared_in_project=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ssh_key = response.parse() + assert_matches_type(SSHKey, ssh_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ssh_key_id` but received ''"): + client.cloud.ssh_keys.with_raw_response.update( + ssh_key_id="", + project_id=1, + shared_in_project=True, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + ssh_key = client.cloud.ssh_keys.list( + project_id=1, + ) + assert_matches_type(SyncOffsetPage[SSHKey], ssh_key, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + ssh_key = client.cloud.ssh_keys.list( + project_id=1, + limit=100, + offset=0, + order_by="created_at.desc", + ) + assert_matches_type(SyncOffsetPage[SSHKey], ssh_key, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.ssh_keys.with_raw_response.list( + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ssh_key = response.parse() + assert_matches_type(SyncOffsetPage[SSHKey], ssh_key, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.ssh_keys.with_streaming_response.list( + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ssh_key = response.parse() + assert_matches_type(SyncOffsetPage[SSHKey], ssh_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + ssh_key = client.cloud.ssh_keys.delete( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + ) + assert ssh_key is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.ssh_keys.with_raw_response.delete( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ssh_key = response.parse() + assert ssh_key is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.ssh_keys.with_streaming_response.delete( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ssh_key = response.parse() + assert ssh_key is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ssh_key_id` but received ''"): + client.cloud.ssh_keys.with_raw_response.delete( + ssh_key_id="", + project_id=1, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + ssh_key = client.cloud.ssh_keys.get( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + ) + assert_matches_type(SSHKey, ssh_key, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.ssh_keys.with_raw_response.get( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ssh_key = response.parse() + assert_matches_type(SSHKey, ssh_key, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.ssh_keys.with_streaming_response.get( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ssh_key = response.parse() + assert_matches_type(SSHKey, ssh_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ssh_key_id` but received ''"): + client.cloud.ssh_keys.with_raw_response.get( + ssh_key_id="", + project_id=1, + ) + + +class TestAsyncSSHKeys: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + ssh_key = await async_client.cloud.ssh_keys.create( + project_id=1, + name="my-ssh-key", + ) + assert_matches_type(CreatedSSHKey, ssh_key, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + ssh_key = await async_client.cloud.ssh_keys.create( + project_id=1, + name="my-ssh-key", + public_key="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIjxL6g1II8NsO8odvBwGKvq2Dx/h/xrvsV9b9LVIYKm my-username@my-hostname", + shared_in_project=True, + ) + assert_matches_type(CreatedSSHKey, ssh_key, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.ssh_keys.with_raw_response.create( + project_id=1, + name="my-ssh-key", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ssh_key = await response.parse() + assert_matches_type(CreatedSSHKey, ssh_key, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.ssh_keys.with_streaming_response.create( + project_id=1, + name="my-ssh-key", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ssh_key = await response.parse() + assert_matches_type(CreatedSSHKey, ssh_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + ssh_key = await async_client.cloud.ssh_keys.update( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + shared_in_project=True, + ) + assert_matches_type(SSHKey, ssh_key, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.ssh_keys.with_raw_response.update( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + shared_in_project=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ssh_key = await response.parse() + assert_matches_type(SSHKey, ssh_key, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.ssh_keys.with_streaming_response.update( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + shared_in_project=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ssh_key = await response.parse() + assert_matches_type(SSHKey, ssh_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ssh_key_id` but received ''"): + await async_client.cloud.ssh_keys.with_raw_response.update( + ssh_key_id="", + project_id=1, + shared_in_project=True, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + ssh_key = await async_client.cloud.ssh_keys.list( + project_id=1, + ) + assert_matches_type(AsyncOffsetPage[SSHKey], ssh_key, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + ssh_key = await async_client.cloud.ssh_keys.list( + project_id=1, + limit=100, + offset=0, + order_by="created_at.desc", + ) + assert_matches_type(AsyncOffsetPage[SSHKey], ssh_key, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.ssh_keys.with_raw_response.list( + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ssh_key = await response.parse() + assert_matches_type(AsyncOffsetPage[SSHKey], ssh_key, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.ssh_keys.with_streaming_response.list( + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ssh_key = await response.parse() + assert_matches_type(AsyncOffsetPage[SSHKey], ssh_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + ssh_key = await async_client.cloud.ssh_keys.delete( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + ) + assert ssh_key is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.ssh_keys.with_raw_response.delete( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ssh_key = await response.parse() + assert ssh_key is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.ssh_keys.with_streaming_response.delete( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ssh_key = await response.parse() + assert ssh_key is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ssh_key_id` but received ''"): + await async_client.cloud.ssh_keys.with_raw_response.delete( + ssh_key_id="", + project_id=1, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + ssh_key = await async_client.cloud.ssh_keys.get( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + ) + assert_matches_type(SSHKey, ssh_key, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.ssh_keys.with_raw_response.get( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ssh_key = await response.parse() + assert_matches_type(SSHKey, ssh_key, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.ssh_keys.with_streaming_response.get( + ssh_key_id="36a7a97a-0672-4911-8f2b-92cd4e5b0d91", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ssh_key = await response.parse() + assert_matches_type(SSHKey, ssh_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ssh_key_id` but received ''"): + await async_client.cloud.ssh_keys.with_raw_response.get( + ssh_key_id="", + project_id=1, + ) From 9b7e653e13d42b347c35b8b69cc2364252dec731 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 03:29:16 +0000 Subject: [PATCH 028/592] chore(internal): bump pyright version --- pyproject.toml | 2 +- requirements-dev.lock | 2 +- src/gcore/_base_client.py | 6 +++++- src/gcore/_models.py | 1 - src/gcore/_utils/_typing.py | 2 +- tests/conftest.py | 2 +- tests/test_models.py | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 60ba9dfc..31d96d42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ Repository = "https://github.com/stainless-sdks/gcore-python" managed = true # version pins are in requirements-dev.lock dev-dependencies = [ - "pyright>=1.1.359", + "pyright==1.1.399", "mypy", "respx", "pytest", diff --git a/requirements-dev.lock b/requirements-dev.lock index 0af8b6aa..045eb8c6 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -69,7 +69,7 @@ pydantic-core==2.27.1 # via pydantic pygments==2.18.0 # via rich -pyright==1.1.392.post0 +pyright==1.1.399 pytest==8.3.3 # via pytest-asyncio pytest-asyncio==0.24.0 diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index aec15259..b6bdfda5 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -98,7 +98,11 @@ _AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any]) if TYPE_CHECKING: - from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT + from httpx._config import ( + DEFAULT_TIMEOUT_CONFIG, # pyright: ignore[reportPrivateImportUsage] + ) + + HTTPX_DEFAULT_TIMEOUT = DEFAULT_TIMEOUT_CONFIG else: try: from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT diff --git a/src/gcore/_models.py b/src/gcore/_models.py index 34935716..58b9263e 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -19,7 +19,6 @@ ) import pydantic -import pydantic.generics from pydantic.fields import FieldInfo from ._types import ( diff --git a/src/gcore/_utils/_typing.py b/src/gcore/_utils/_typing.py index 1958820f..1bac9542 100644 --- a/src/gcore/_utils/_typing.py +++ b/src/gcore/_utils/_typing.py @@ -110,7 +110,7 @@ class MyResponse(Foo[_T]): ``` """ cls = cast(object, get_origin(typ) or typ) - if cls in generic_bases: + if cls in generic_bases: # pyright: ignore[reportUnnecessaryContains] # we're given the class directly return extract_type_arg(typ, index) diff --git a/tests/conftest.py b/tests/conftest.py index 0a9a2b2e..c8b5577d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,7 +10,7 @@ from gcore import Gcore, AsyncGcore if TYPE_CHECKING: - from _pytest.fixtures import FixtureRequest + from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage] pytest.register_assert_rewrite("tests.utils") diff --git a/tests/test_models.py b/tests/test_models.py index ed447300..785477a0 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -832,7 +832,7 @@ class B(BaseModel): @pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") def test_type_alias_type() -> None: - Alias = TypeAliasType("Alias", str) + Alias = TypeAliasType("Alias", str) # pyright: ignore class Model(BaseModel): alias: Alias From e778bd6890b86ef23f5800b41abc6d7b5c820fba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 03:30:00 +0000 Subject: [PATCH 029/592] chore(internal): base client updates --- src/gcore/_base_client.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index b6bdfda5..cee1157f 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -119,6 +119,7 @@ class PageInfo: url: URL | NotGiven params: Query | NotGiven + json: Body | NotGiven @overload def __init__( @@ -134,19 +135,30 @@ def __init__( params: Query, ) -> None: ... + @overload + def __init__( + self, + *, + json: Body, + ) -> None: ... + def __init__( self, *, url: URL | NotGiven = NOT_GIVEN, + json: Body | NotGiven = NOT_GIVEN, params: Query | NotGiven = NOT_GIVEN, ) -> None: self.url = url + self.json = json self.params = params @override def __repr__(self) -> str: if self.url: return f"{self.__class__.__name__}(url={self.url})" + if self.json: + return f"{self.__class__.__name__}(json={self.json})" return f"{self.__class__.__name__}(params={self.params})" @@ -195,6 +207,19 @@ def _info_to_options(self, info: PageInfo) -> FinalRequestOptions: options.url = str(url) return options + if not isinstance(info.json, NotGiven): + if not is_mapping(info.json): + raise TypeError("Pagination is only supported with mappings") + + if not options.json_data: + options.json_data = {**info.json} + else: + if not is_mapping(options.json_data): + raise TypeError("Pagination is only supported with mappings") + + options.json_data = {**options.json_data, **info.json} + return options + raise ValueError("Unexpected PageInfo state") From 1e6853f61511bf04b443ed8e2fde6ce956d4c099 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 05:22:35 +0000 Subject: [PATCH 030/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2ea8307b..afb0ee42 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 26 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d04af2cbcfe6fac48c6fa7e72f8694129af5c16959ae8266e90be5e48b251fd8.yml -openapi_spec_hash: fe9e9877f223c4b537615b146bec2391 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7d8d94e0e56753be6a7b19649f22668d7056664890d9d4ceb3c3d9e2a9022612.yml +openapi_spec_hash: 5d350b4ef5a29e5722028394fd6e7d81 config_hash: b14923288ca3041ced21430452ca0a54 From 14e24435e77e37a3ccec081ac87923ced113b070 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 08:55:09 +0000 Subject: [PATCH 031/592] CGCLOUD2-18672 Add cloud ipranges --- .stats.yml | 4 +- api.md | 12 ++ src/gcore/resources/cloud/__init__.py | 14 ++ src/gcore/resources/cloud/cloud.py | 32 +++++ src/gcore/resources/cloud/ip_ranges.py | 135 ++++++++++++++++++++ src/gcore/types/cloud/__init__.py | 1 + src/gcore/types/cloud/ip_ranges.py | 12 ++ tests/api_resources/cloud/test_ip_ranges.py | 72 +++++++++++ 8 files changed, 280 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/ip_ranges.py create mode 100644 src/gcore/types/cloud/ip_ranges.py create mode 100644 tests/api_resources/cloud/test_ip_ranges.py diff --git a/.stats.yml b/.stats.yml index afb0ee42..f2126f69 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 26 +configured_endpoints: 27 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7d8d94e0e56753be6a7b19649f22668d7056664890d9d4ceb3c3d9e2a9022612.yml openapi_spec_hash: 5d350b4ef5a29e5722028394fd6e7d81 -config_hash: b14923288ca3041ced21430452ca0a54 +config_hash: f05a87a03319ec5c78bee15e848246e6 diff --git a/api.md b/api.md index ce2162b6..10c73b43 100644 --- a/api.md +++ b/api.md @@ -108,3 +108,15 @@ Methods: - client.cloud.ssh_keys.list(\*, project_id, \*\*params) -> SyncOffsetPage[SSHKey] - client.cloud.ssh_keys.delete(ssh_key_id, \*, project_id) -> None - client.cloud.ssh_keys.get(ssh_key_id, \*, project_id) -> SSHKey + +## IPRanges + +Types: + +```python +from gcore.types.cloud import IPRanges +``` + +Methods: + +- client.cloud.ip_ranges.list() -> IPRanges diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index c79d3f9d..0237d068 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -56,6 +56,14 @@ SSHKeysResourceWithStreamingResponse, AsyncSSHKeysResourceWithStreamingResponse, ) +from .ip_ranges import ( + IPRangesResource, + AsyncIPRangesResource, + IPRangesResourceWithRawResponse, + AsyncIPRangesResourceWithRawResponse, + IPRangesResourceWithStreamingResponse, + AsyncIPRangesResourceWithStreamingResponse, +) __all__ = [ "ProjectsResource", @@ -94,6 +102,12 @@ "AsyncSSHKeysResourceWithRawResponse", "SSHKeysResourceWithStreamingResponse", "AsyncSSHKeysResourceWithStreamingResponse", + "IPRangesResource", + "AsyncIPRangesResource", + "IPRangesResourceWithRawResponse", + "AsyncIPRangesResourceWithRawResponse", + "IPRangesResourceWithStreamingResponse", + "AsyncIPRangesResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 08ccd9da..4348b382 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -43,6 +43,14 @@ AsyncSSHKeysResourceWithStreamingResponse, ) from ..._compat import cached_property +from .ip_ranges import ( + IPRangesResource, + AsyncIPRangesResource, + IPRangesResourceWithRawResponse, + AsyncIPRangesResourceWithRawResponse, + IPRangesResourceWithStreamingResponse, + AsyncIPRangesResourceWithStreamingResponse, +) from ..._resource import SyncAPIResource, AsyncAPIResource from .quotas.quotas import ( QuotasResource, @@ -81,6 +89,10 @@ def secrets(self) -> SecretsResource: def ssh_keys(self) -> SSHKeysResource: return SSHKeysResource(self._client) + @cached_property + def ip_ranges(self) -> IPRangesResource: + return IPRangesResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -126,6 +138,10 @@ def secrets(self) -> AsyncSecretsResource: def ssh_keys(self) -> AsyncSSHKeysResource: return AsyncSSHKeysResource(self._client) + @cached_property + def ip_ranges(self) -> AsyncIPRangesResource: + return AsyncIPRangesResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -174,6 +190,10 @@ def secrets(self) -> SecretsResourceWithRawResponse: def ssh_keys(self) -> SSHKeysResourceWithRawResponse: return SSHKeysResourceWithRawResponse(self._cloud.ssh_keys) + @cached_property + def ip_ranges(self) -> IPRangesResourceWithRawResponse: + return IPRangesResourceWithRawResponse(self._cloud.ip_ranges) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -203,6 +223,10 @@ def secrets(self) -> AsyncSecretsResourceWithRawResponse: def ssh_keys(self) -> AsyncSSHKeysResourceWithRawResponse: return AsyncSSHKeysResourceWithRawResponse(self._cloud.ssh_keys) + @cached_property + def ip_ranges(self) -> AsyncIPRangesResourceWithRawResponse: + return AsyncIPRangesResourceWithRawResponse(self._cloud.ip_ranges) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -232,6 +256,10 @@ def secrets(self) -> SecretsResourceWithStreamingResponse: def ssh_keys(self) -> SSHKeysResourceWithStreamingResponse: return SSHKeysResourceWithStreamingResponse(self._cloud.ssh_keys) + @cached_property + def ip_ranges(self) -> IPRangesResourceWithStreamingResponse: + return IPRangesResourceWithStreamingResponse(self._cloud.ip_ranges) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -260,3 +288,7 @@ def secrets(self) -> AsyncSecretsResourceWithStreamingResponse: @cached_property def ssh_keys(self) -> AsyncSSHKeysResourceWithStreamingResponse: return AsyncSSHKeysResourceWithStreamingResponse(self._cloud.ssh_keys) + + @cached_property + def ip_ranges(self) -> AsyncIPRangesResourceWithStreamingResponse: + return AsyncIPRangesResourceWithStreamingResponse(self._cloud.ip_ranges) diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py new file mode 100644 index 00000000..e572c567 --- /dev/null +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -0,0 +1,135 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.cloud.ip_ranges import IPRanges + +__all__ = ["IPRangesResource", "AsyncIPRangesResource"] + + +class IPRangesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> IPRangesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return IPRangesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> IPRangesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return IPRangesResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> IPRanges: + """List of all Edge Cloud Egress Public IPs.""" + return self._get( + "/cloud/public/v1/ipranges/egress", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=IPRanges, + ) + + +class AsyncIPRangesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncIPRangesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncIPRangesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncIPRangesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncIPRangesResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> IPRanges: + """List of all Edge Cloud Egress Public IPs.""" + return await self._get( + "/cloud/public/v1/ipranges/egress", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=IPRanges, + ) + + +class IPRangesResourceWithRawResponse: + def __init__(self, ip_ranges: IPRangesResource) -> None: + self._ip_ranges = ip_ranges + + self.list = to_raw_response_wrapper( + ip_ranges.list, + ) + + +class AsyncIPRangesResourceWithRawResponse: + def __init__(self, ip_ranges: AsyncIPRangesResource) -> None: + self._ip_ranges = ip_ranges + + self.list = async_to_raw_response_wrapper( + ip_ranges.list, + ) + + +class IPRangesResourceWithStreamingResponse: + def __init__(self, ip_ranges: IPRangesResource) -> None: + self._ip_ranges = ip_ranges + + self.list = to_streamed_response_wrapper( + ip_ranges.list, + ) + + +class AsyncIPRangesResourceWithStreamingResponse: + def __init__(self, ip_ranges: AsyncIPRangesResource) -> None: + self._ip_ranges = ip_ranges + + self.list = async_to_streamed_response_wrapper( + ip_ranges.list, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 2eccd2fe..8a0dedf9 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -7,6 +7,7 @@ from .secret import Secret as Secret from .project import Project as Project from .ssh_key import SSHKey as SSHKey +from .ip_ranges import IPRanges as IPRanges from .created_ssh_key import CreatedSSHKey as CreatedSSHKey from .task_list_params import TaskListParams as TaskListParams from .region_list_params import RegionListParams as RegionListParams diff --git a/src/gcore/types/cloud/ip_ranges.py b/src/gcore/types/cloud/ip_ranges.py new file mode 100644 index 00000000..5c983ebe --- /dev/null +++ b/src/gcore/types/cloud/ip_ranges.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["IPRanges"] + + +class IPRanges(BaseModel): + ranges: List[str] + """IP ranges list""" diff --git a/tests/api_resources/cloud/test_ip_ranges.py b/tests/api_resources/cloud/test_ip_ranges.py new file mode 100644 index 00000000..c0545598 --- /dev/null +++ b/tests/api_resources/cloud/test_ip_ranges.py @@ -0,0 +1,72 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import IPRanges + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestIPRanges: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + ip_range = client.cloud.ip_ranges.list() + assert_matches_type(IPRanges, ip_range, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.ip_ranges.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_range = response.parse() + assert_matches_type(IPRanges, ip_range, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.ip_ranges.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_range = response.parse() + assert_matches_type(IPRanges, ip_range, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncIPRanges: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + ip_range = await async_client.cloud.ip_ranges.list() + assert_matches_type(IPRanges, ip_range, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.ip_ranges.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_range = await response.parse() + assert_matches_type(IPRanges, ip_range, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.ip_ranges.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_range = await response.parse() + assert_matches_type(IPRanges, ip_range, path=["response"]) + + assert cast(Any, response.is_closed) is True From ac7ddbafa725d4d6066f346fecd4cc142b8baabd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 10:07:46 +0000 Subject: [PATCH 032/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cloud/region.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f2126f69..f59f61a4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 27 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7d8d94e0e56753be6a7b19649f22668d7056664890d9d4ceb3c3d9e2a9022612.yml -openapi_spec_hash: 5d350b4ef5a29e5722028394fd6e7d81 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0d5b1ddcd4f2e267a296c43cc06e3c56269e1208b373d618474ece5d94cdd660.yml +openapi_spec_hash: d8bfa7dbe95900815ddaca9bdc0be836 config_hash: f05a87a03319ec5c78bee15e848246e6 diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py index ffac5082..343f0707 100644 --- a/src/gcore/types/cloud/region.py +++ b/src/gcore/types/cloud/region.py @@ -52,6 +52,9 @@ class Region(BaseModel): external_network_id: Optional[str] = None """External network ID for Neutron""" + file_share_types: Optional[List[Literal["standard", "vast"]]] = None + """List of available file share types""" + has_ai: bool """Region has AI capability""" From 3cd1cdc87ff58c1fecf9da856c35ce4a01c62458 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 10:51:08 +0000 Subject: [PATCH 033/592] GCLOUD2-18523 Update tasks --- .stats.yml | 4 +- api.md | 4 +- src/gcore/resources/cloud/tasks.py | 321 ++++++++++++++---- src/gcore/types/cloud/__init__.py | 1 + .../cloud/task_acknowledge_all_params.py | 16 + tests/api_resources/cloud/test_tasks.py | 242 ++++++++++--- 6 files changed, 470 insertions(+), 118 deletions(-) create mode 100644 src/gcore/types/cloud/task_acknowledge_all_params.py diff --git a/.stats.yml b/.stats.yml index f59f61a4..d975cf63 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 27 +configured_endpoints: 29 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0d5b1ddcd4f2e267a296c43cc06e3c56269e1208b373d618474ece5d94cdd660.yml openapi_spec_hash: d8bfa7dbe95900815ddaca9bdc0be836 -config_hash: f05a87a03319ec5c78bee15e848246e6 +config_hash: 59a24d9f0a258e2c9eea609a177681fe diff --git a/api.md b/api.md index 10c73b43..4b33b494 100644 --- a/api.md +++ b/api.md @@ -26,8 +26,10 @@ from gcore.types.cloud import Task Methods: -- client.cloud.tasks.retrieve(task_id) -> Task - client.cloud.tasks.list(\*\*params) -> SyncOffsetPage[Task] +- client.cloud.tasks.acknowledge_all(\*\*params) -> None +- client.cloud.tasks.acknowledge_one(task_id) -> Task +- client.cloud.tasks.get(task_id) -> Task ## Regions diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 59e1d76f..49ec4e09 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -8,8 +8,11 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import maybe_transform +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._utils import ( + maybe_transform, + async_maybe_transform, +) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -19,7 +22,7 @@ async_to_streamed_response_wrapper, ) from ...pagination import SyncOffsetPage, AsyncOffsetPage -from ...types.cloud import task_list_params +from ...types.cloud import task_list_params, task_acknowledge_all_params from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.task import Task @@ -46,41 +49,6 @@ def with_streaming_response(self) -> TasksResourceWithStreamingResponse: """ return TasksResourceWithStreamingResponse(self) - def retrieve( - self, - task_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Task: - """ - Get task - - Args: - task_id: Task ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not task_id: - raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") - return self._get( - f"/cloud/v1/tasks/{task_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Task, - ) - def list( self, *, @@ -206,28 +174,89 @@ def list( model=Task, ) - -class AsyncTasksResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTasksResourceWithRawResponse: + def acknowledge_all( + self, + *, + project_id: Optional[int] | NotGiven = NOT_GIVEN, + region_id: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. + Acknowledge all client tasks in project or region - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + Args: + project_id: Project ID + + region_id: Region ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds """ - return AsyncTasksResourceWithRawResponse(self) + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + "/cloud/v1/tasks/acknowledge_all", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "project_id": project_id, + "region_id": region_id, + }, + task_acknowledge_all_params.TaskAcknowledgeAllParams, + ), + ), + cast_to=NoneType, + ) - @cached_property - def with_streaming_response(self) -> AsyncTasksResourceWithStreamingResponse: + def acknowledge_one( + self, + task_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Task: """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. + Acknowledge one task on project scope - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + Args: + task_id: Task ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds """ - return AsyncTasksResourceWithStreamingResponse(self) + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return self._post( + f"/cloud/v1/tasks/{task_id}/acknowledge", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) - async def retrieve( + def get( self, task_id: str, *, @@ -254,7 +283,7 @@ async def retrieve( """ if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") - return await self._get( + return self._get( f"/cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -262,6 +291,27 @@ async def retrieve( cast_to=Task, ) + +class AsyncTasksResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTasksResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncTasksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTasksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncTasksResourceWithStreamingResponse(self) + def list( self, *, @@ -387,50 +437,191 @@ def list( model=Task, ) + async def acknowledge_all( + self, + *, + project_id: Optional[int] | NotGiven = NOT_GIVEN, + region_id: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Acknowledge all client tasks in project or region + + Args: + project_id: Project ID + + region_id: Region ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + "/cloud/v1/tasks/acknowledge_all", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "project_id": project_id, + "region_id": region_id, + }, + task_acknowledge_all_params.TaskAcknowledgeAllParams, + ), + ), + cast_to=NoneType, + ) + + async def acknowledge_one( + self, + task_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Task: + """ + Acknowledge one task on project scope + + Args: + task_id: Task ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return await self._post( + f"/cloud/v1/tasks/{task_id}/acknowledge", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + async def get( + self, + task_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Task: + """ + Get task + + Args: + task_id: Task ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return await self._get( + f"/cloud/v1/tasks/{task_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + class TasksResourceWithRawResponse: def __init__(self, tasks: TasksResource) -> None: self._tasks = tasks - self.retrieve = to_raw_response_wrapper( - tasks.retrieve, - ) self.list = to_raw_response_wrapper( tasks.list, ) + self.acknowledge_all = to_raw_response_wrapper( + tasks.acknowledge_all, + ) + self.acknowledge_one = to_raw_response_wrapper( + tasks.acknowledge_one, + ) + self.get = to_raw_response_wrapper( + tasks.get, + ) class AsyncTasksResourceWithRawResponse: def __init__(self, tasks: AsyncTasksResource) -> None: self._tasks = tasks - self.retrieve = async_to_raw_response_wrapper( - tasks.retrieve, - ) self.list = async_to_raw_response_wrapper( tasks.list, ) + self.acknowledge_all = async_to_raw_response_wrapper( + tasks.acknowledge_all, + ) + self.acknowledge_one = async_to_raw_response_wrapper( + tasks.acknowledge_one, + ) + self.get = async_to_raw_response_wrapper( + tasks.get, + ) class TasksResourceWithStreamingResponse: def __init__(self, tasks: TasksResource) -> None: self._tasks = tasks - self.retrieve = to_streamed_response_wrapper( - tasks.retrieve, - ) self.list = to_streamed_response_wrapper( tasks.list, ) + self.acknowledge_all = to_streamed_response_wrapper( + tasks.acknowledge_all, + ) + self.acknowledge_one = to_streamed_response_wrapper( + tasks.acknowledge_one, + ) + self.get = to_streamed_response_wrapper( + tasks.get, + ) class AsyncTasksResourceWithStreamingResponse: def __init__(self, tasks: AsyncTasksResource) -> None: self._tasks = tasks - self.retrieve = async_to_streamed_response_wrapper( - tasks.retrieve, - ) self.list = async_to_streamed_response_wrapper( tasks.list, ) + self.acknowledge_all = async_to_streamed_response_wrapper( + tasks.acknowledge_all, + ) + self.acknowledge_one = async_to_streamed_response_wrapper( + tasks.acknowledge_one, + ) + self.get = async_to_streamed_response_wrapper( + tasks.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 8a0dedf9..d2729178 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -25,6 +25,7 @@ from .secret_delete_response import SecretDeleteResponse as SecretDeleteResponse from .project_delete_response import ProjectDeleteResponse as ProjectDeleteResponse from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse +from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams from .secret_upload_tls_certificate_response import ( diff --git a/src/gcore/types/cloud/task_acknowledge_all_params.py b/src/gcore/types/cloud/task_acknowledge_all_params.py new file mode 100644 index 00000000..d35c39b7 --- /dev/null +++ b/src/gcore/types/cloud/task_acknowledge_all_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["TaskAcknowledgeAllParams"] + + +class TaskAcknowledgeAllParams(TypedDict, total=False): + project_id: Optional[int] + """Project ID""" + + region_id: Optional[int] + """Region ID""" diff --git a/tests/api_resources/cloud/test_tasks.py b/tests/api_resources/cloud/test_tasks.py index 31d172df..ad721d7c 100644 --- a/tests/api_resources/cloud/test_tasks.py +++ b/tests/api_resources/cloud/test_tasks.py @@ -19,44 +19,6 @@ class TestTasks: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @parametrize - def test_method_retrieve(self, client: Gcore) -> None: - task = client.cloud.tasks.retrieve( - "task_id", - ) - assert_matches_type(Task, task, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Gcore) -> None: - response = client.cloud.tasks.with_raw_response.retrieve( - "task_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - task = response.parse() - assert_matches_type(Task, task, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Gcore) -> None: - with client.cloud.tasks.with_streaming_response.retrieve( - "task_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - task = response.parse() - assert_matches_type(Task, task, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): - client.cloud.tasks.with_raw_response.retrieve( - "", - ) - @parametrize def test_method_list(self, client: Gcore) -> None: task = client.cloud.tasks.list() @@ -98,48 +60,119 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_acknowledge_all(self, client: Gcore) -> None: + task = client.cloud.tasks.acknowledge_all() + assert task is None -class TestAsyncTasks: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_acknowledge_all_with_all_params(self, client: Gcore) -> None: + task = client.cloud.tasks.acknowledge_all( + project_id=0, + region_id=0, + ) + assert task is None + + @parametrize + def test_raw_response_acknowledge_all(self, client: Gcore) -> None: + response = client.cloud.tasks.with_raw_response.acknowledge_all() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert task is None @parametrize - async def test_method_retrieve(self, async_client: AsyncGcore) -> None: - task = await async_client.cloud.tasks.retrieve( + def test_streaming_response_acknowledge_all(self, client: Gcore) -> None: + with client.cloud.tasks.with_streaming_response.acknowledge_all() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert task is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_acknowledge_one(self, client: Gcore) -> None: + task = client.cloud.tasks.acknowledge_one( "task_id", ) assert_matches_type(Task, task, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.tasks.with_raw_response.retrieve( + def test_raw_response_acknowledge_one(self, client: Gcore) -> None: + response = client.cloud.tasks.with_raw_response.acknowledge_one( "task_id", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - task = await response.parse() + task = response.parse() assert_matches_type(Task, task, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.tasks.with_streaming_response.retrieve( + def test_streaming_response_acknowledge_one(self, client: Gcore) -> None: + with client.cloud.tasks.with_streaming_response.acknowledge_one( "task_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - task = await response.parse() + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_acknowledge_one(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + client.cloud.tasks.with_raw_response.acknowledge_one( + "", + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + task = client.cloud.tasks.get( + "task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.tasks.with_raw_response.get( + "task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.tasks.with_streaming_response.get( + "task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() assert_matches_type(Task, task, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_retrieve(self, async_client: AsyncGcore) -> None: + def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): - await async_client.cloud.tasks.with_raw_response.retrieve( + client.cloud.tasks.with_raw_response.get( "", ) + +class TestAsyncTasks: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: task = await async_client.cloud.tasks.list() @@ -180,3 +213,112 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(AsyncOffsetPage[Task], task, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_acknowledge_all(self, async_client: AsyncGcore) -> None: + task = await async_client.cloud.tasks.acknowledge_all() + assert task is None + + @parametrize + async def test_method_acknowledge_all_with_all_params(self, async_client: AsyncGcore) -> None: + task = await async_client.cloud.tasks.acknowledge_all( + project_id=0, + region_id=0, + ) + assert task is None + + @parametrize + async def test_raw_response_acknowledge_all(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.tasks.with_raw_response.acknowledge_all() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert task is None + + @parametrize + async def test_streaming_response_acknowledge_all(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.tasks.with_streaming_response.acknowledge_all() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert task is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_acknowledge_one(self, async_client: AsyncGcore) -> None: + task = await async_client.cloud.tasks.acknowledge_one( + "task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @parametrize + async def test_raw_response_acknowledge_one(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.tasks.with_raw_response.acknowledge_one( + "task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + @parametrize + async def test_streaming_response_acknowledge_one(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.tasks.with_streaming_response.acknowledge_one( + "task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_acknowledge_one(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + await async_client.cloud.tasks.with_raw_response.acknowledge_one( + "", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + task = await async_client.cloud.tasks.get( + "task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.tasks.with_raw_response.get( + "task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.tasks.with_streaming_response.get( + "task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + await async_client.cloud.tasks.with_raw_response.get( + "", + ) From 674511b21389cf61257f2d81d87e0ae4cee3edfd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 13:32:58 +0000 Subject: [PATCH 034/592] Add cloud shared models for InterfaceIPFamily, Subnet and Network --- .stats.yml | 2 +- api.md | 6 ++++++ src/gcore/types/cloud/__init__.py | 1 + src/gcore/types/cloud/interface_ip_family.py | 7 +++++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/gcore/types/cloud/interface_ip_family.py diff --git a/.stats.yml b/.stats.yml index d975cf63..36e78034 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0d5b1ddcd4f2e267a296c43cc06e3c56269e1208b373d618474ece5d94cdd660.yml openapi_spec_hash: d8bfa7dbe95900815ddaca9bdc0be836 -config_hash: 59a24d9f0a258e2c9eea609a177681fe +config_hash: e2a8aa2903e022d88ad5d127d2b8ec28 diff --git a/api.md b/api.md index 4b33b494..0c46dbc0 100644 --- a/api.md +++ b/api.md @@ -1,5 +1,11 @@ # Cloud +Types: + +```python +from gcore.types.cloud import InterfaceIPFamily, Network, Subnet +``` + ## Projects Types: diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index d2729178..c435c375 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -11,6 +11,7 @@ from .created_ssh_key import CreatedSSHKey as CreatedSSHKey from .task_list_params import TaskListParams as TaskListParams from .region_list_params import RegionListParams as RegionListParams +from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .project_list_params import ProjectListParams as ProjectListParams from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams from .secret_create_params import SecretCreateParams as SecretCreateParams diff --git a/src/gcore/types/cloud/interface_ip_family.py b/src/gcore/types/cloud/interface_ip_family.py new file mode 100644 index 00000000..78a0696b --- /dev/null +++ b/src/gcore/types/cloud/interface_ip_family.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["InterfaceIPFamily"] + +InterfaceIPFamily: TypeAlias = Literal["dual", "ipv4", "ipv6"] From 058dc3f249c66283c87f6ea2045745adff8f5de3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 14:08:05 +0000 Subject: [PATCH 035/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 36e78034..48a84b5c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0d5b1ddcd4f2e267a296c43cc06e3c56269e1208b373d618474ece5d94cdd660.yml -openapi_spec_hash: d8bfa7dbe95900815ddaca9bdc0be836 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f4e84c76abd0fce075366c6a977b4dbc2f24b780a6b1920e484182a4df871b83.yml +openapi_spec_hash: dbe9a3596580d2c26788e0db01b5be34 config_hash: e2a8aa2903e022d88ad5d127d2b8ec28 From 5df8886dbf058254a63fd40917168707f2ab1ea3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 16:29:54 +0000 Subject: [PATCH 036/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 48a84b5c..c241ed3d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f4e84c76abd0fce075366c6a977b4dbc2f24b780a6b1920e484182a4df871b83.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-cb53c544588cced53f4ff3e2932dee711475fab9355745be836bfc45fbb1f49e.yml openapi_spec_hash: dbe9a3596580d2c26788e0db01b5be34 -config_hash: e2a8aa2903e022d88ad5d127d2b8ec28 +config_hash: 6d9c2e35c1183369faa35acbfc41997b From 8cca00d2199b5bdc85d0a5f3dea01231c0672130 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 18 Apr 2025 09:54:05 +0000 Subject: [PATCH 037/592] GCLOUD2-18675 Add shared models for load balancers --- .stats.yml | 2 +- api.md | 38 ++++++++++++++++++- src/gcore/types/cloud/__init__.py | 6 +++ src/gcore/types/cloud/floating_ip_status.py | 7 ++++ .../types/cloud/instance_metrics_time_unit.py | 7 ++++ .../cloud/load_balancer_instance_role.py | 7 ++++ src/gcore/types/cloud/member_connectivity.py | 7 ++++ src/gcore/types/cloud/operating_status.py | 7 ++++ src/gcore/types/cloud/provisioning_status.py | 9 +++++ 9 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 src/gcore/types/cloud/floating_ip_status.py create mode 100644 src/gcore/types/cloud/instance_metrics_time_unit.py create mode 100644 src/gcore/types/cloud/load_balancer_instance_role.py create mode 100644 src/gcore/types/cloud/member_connectivity.py create mode 100644 src/gcore/types/cloud/operating_status.py create mode 100644 src/gcore/types/cloud/provisioning_status.py diff --git a/.stats.yml b/.stats.yml index c241ed3d..35750131 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-cb53c544588cced53f4ff3e2932dee711475fab9355745be836bfc45fbb1f49e.yml openapi_spec_hash: dbe9a3596580d2c26788e0db01b5be34 -config_hash: 6d9c2e35c1183369faa35acbfc41997b +config_hash: 80b0bb06eebcba83303e160b1c19c499 diff --git a/api.md b/api.md index 0c46dbc0..7a653349 100644 --- a/api.md +++ b/api.md @@ -3,7 +3,43 @@ Types: ```python -from gcore.types.cloud import InterfaceIPFamily, Network, Subnet +from gcore.types.cloud import ( + ClientProfile, + ClientProfileField, + ClientProfileTemplate, + ClientProfileTemplateField, + DDOSProfileStatus, + FlavorHardwareDescription, + FloatingIP, + FloatingIPInterfaceNewInstance, + FloatingIPNewInterface, + FloatingIPStatus, + InstanceMetricsTimeUnit, + InterfaceIPFamily, + ItemPrice, + LaasIndexRetentionPolicy, + Listener, + LoadBalancer, + LoadBalancerFlavor, + LoadBalancerInstanceRole, + LoadBalancerLogging, + LoadBalancerStatList, + MandatoryID, + MemberConnectivity, + Name, + Network, + NetworkPortFixedIP, + OperatingStatus, + ProfileOptionList, + ProvisioningStatus, + RawMetadata, + Subnet, + Tag, + TagList, + TagUpdateList, + TaskIDList, + VrrpIP, +) ``` ## Projects diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index c435c375..49e7e1a5 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -9,10 +9,14 @@ from .ssh_key import SSHKey as SSHKey from .ip_ranges import IPRanges as IPRanges from .created_ssh_key import CreatedSSHKey as CreatedSSHKey +from .operating_status import OperatingStatus as OperatingStatus from .task_list_params import TaskListParams as TaskListParams +from .floating_ip_status import FloatingIPStatus as FloatingIPStatus from .region_list_params import RegionListParams as RegionListParams from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily +from .member_connectivity import MemberConnectivity as MemberConnectivity from .project_list_params import ProjectListParams as ProjectListParams +from .provisioning_status import ProvisioningStatus as ProvisioningStatus from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams from .secret_create_params import SecretCreateParams as SecretCreateParams from .secret_list_response import SecretListResponse as SecretListResponse @@ -26,6 +30,8 @@ from .secret_delete_response import SecretDeleteResponse as SecretDeleteResponse from .project_delete_response import ProjectDeleteResponse as ProjectDeleteResponse from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse +from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit +from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams diff --git a/src/gcore/types/cloud/floating_ip_status.py b/src/gcore/types/cloud/floating_ip_status.py new file mode 100644 index 00000000..4027641e --- /dev/null +++ b/src/gcore/types/cloud/floating_ip_status.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["FloatingIPStatus"] + +FloatingIPStatus: TypeAlias = Literal["ACTIVE", "DOWN", "ERROR"] diff --git a/src/gcore/types/cloud/instance_metrics_time_unit.py b/src/gcore/types/cloud/instance_metrics_time_unit.py new file mode 100644 index 00000000..63f2bcdd --- /dev/null +++ b/src/gcore/types/cloud/instance_metrics_time_unit.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["InstanceMetricsTimeUnit"] + +InstanceMetricsTimeUnit: TypeAlias = Literal["day", "hour"] diff --git a/src/gcore/types/cloud/load_balancer_instance_role.py b/src/gcore/types/cloud/load_balancer_instance_role.py new file mode 100644 index 00000000..351ed470 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_instance_role.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["LoadBalancerInstanceRole"] + +LoadBalancerInstanceRole: TypeAlias = Literal["BACKUP", "MASTER", "STANDALONE"] diff --git a/src/gcore/types/cloud/member_connectivity.py b/src/gcore/types/cloud/member_connectivity.py new file mode 100644 index 00000000..64e40b1c --- /dev/null +++ b/src/gcore/types/cloud/member_connectivity.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["MemberConnectivity"] + +MemberConnectivity: TypeAlias = Literal["L2", "L3"] diff --git a/src/gcore/types/cloud/operating_status.py b/src/gcore/types/cloud/operating_status.py new file mode 100644 index 00000000..9c2c10d2 --- /dev/null +++ b/src/gcore/types/cloud/operating_status.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["OperatingStatus"] + +OperatingStatus: TypeAlias = Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"] diff --git a/src/gcore/types/cloud/provisioning_status.py b/src/gcore/types/cloud/provisioning_status.py new file mode 100644 index 00000000..5b2977b3 --- /dev/null +++ b/src/gcore/types/cloud/provisioning_status.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["ProvisioningStatus"] + +ProvisioningStatus: TypeAlias = Literal[ + "ACTIVE", "DELETED", "ERROR", "PENDING_CREATE", "PENDING_DELETE", "PENDING_UPDATE" +] From a813e7cd478f95aec6d8a3e289fbfda75d814ca3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 18 Apr 2025 15:12:20 +0000 Subject: [PATCH 038/592] Add debug: true --- .github/workflows/ci.yml | 9 + .stats.yml | 2 +- api.md | 28 +- src/gcore/resources/cloud/projects.py | 100 +++- src/gcore/resources/cloud/quotas/quotas.py | 18 +- src/gcore/resources/cloud/quotas/requests.py | 50 +- src/gcore/resources/cloud/regions.py | 58 +- src/gcore/resources/cloud/secrets.py | 176 ++++-- src/gcore/resources/cloud/ssh_keys.py | 106 ++-- src/gcore/resources/cloud/tasks.py | 220 +++---- src/gcore/types/cloud/__init__.py | 4 +- src/gcore/types/cloud/created_ssh_key.py | 56 +- src/gcore/types/cloud/ip_ranges.py | 5 +- ...y => load_balancer_member_connectivity.py} | 4 +- .../cloud/load_balancer_operating_status.py | 7 + src/gcore/types/cloud/operating_status.py | 7 - src/gcore/types/cloud/project.py | 47 +- .../types/cloud/project_create_params.py | 20 +- .../types/cloud/project_delete_response.py | 5 +- src/gcore/types/cloud/project_list_params.py | 30 +- .../types/cloud/project_replace_params.py | 14 +- .../types/cloud/quota_get_all_response.py | 545 ++++++++++++++---- .../cloud/quota_get_by_region_response.py | 465 ++++++++++++--- .../types/cloud/quota_get_global_response.py | 70 ++- .../cloud/quotas/request_create_params.py | 295 ++++++++-- .../cloud/quotas/request_get_response.py | 315 ++++++++-- .../types/cloud/quotas/request_list_params.py | 16 +- src/gcore/types/cloud/region.py | 148 ++++- src/gcore/types/cloud/region_list_params.py | 26 +- .../types/cloud/region_retrieve_params.py | 9 +- src/gcore/types/cloud/secret.py | 61 +- src/gcore/types/cloud/secret_create_params.py | 68 ++- .../types/cloud/secret_create_response.py | 5 +- .../types/cloud/secret_delete_response.py | 5 +- src/gcore/types/cloud/secret_list_response.py | 10 +- .../secret_upload_tls_certificate_params.py | 38 +- .../secret_upload_tls_certificate_response.py | 5 +- src/gcore/types/cloud/ssh_key.py | 42 +- .../types/cloud/ssh_key_create_params.py | 28 +- src/gcore/types/cloud/ssh_key_list_params.py | 20 +- .../types/cloud/ssh_key_update_params.py | 10 +- src/gcore/types/cloud/task.py | 275 +++++++-- .../cloud/task_acknowledge_all_params.py | 10 +- src/gcore/types/cloud/task_list_params.py | 93 +-- 44 files changed, 2523 insertions(+), 1002 deletions(-) rename src/gcore/types/cloud/{member_connectivity.py => load_balancer_member_connectivity.py} (55%) create mode 100644 src/gcore/types/cloud/load_balancer_operating_status.py delete mode 100644 src/gcore/types/cloud/operating_status.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81f6dc20..e655e8eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,3 +48,12 @@ jobs: - name: Run tests run: ./scripts/test + + prevent-debug-release: + name: Prevent Debug SDK Release + runs-on: ubuntu-latest + steps: + - run: | + echo "This SDK was built in debug mode, this job is a failsafe to prevent releasing debug SDKs" + echo "Remove 'debug: true' from your Stainless config." + exit 1 diff --git a/.stats.yml b/.stats.yml index 35750131..8b49ba2a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-cb53c544588cced53f4ff3e2932dee711475fab9355745be836bfc45fbb1f49e.yml openapi_spec_hash: dbe9a3596580d2c26788e0db01b5be34 -config_hash: 80b0bb06eebcba83303e160b1c19c499 +config_hash: 457fab5c213972cb9fddf8ad6ed414cc diff --git a/api.md b/api.md index 7a653349..ca8c4cff 100644 --- a/api.md +++ b/api.md @@ -4,39 +4,27 @@ Types: ```python from gcore.types.cloud import ( - ClientProfile, - ClientProfileField, - ClientProfileTemplate, - ClientProfileTemplateField, + DDOSProfile, + DDOSProfileField, + DDOSProfileOptionList, DDOSProfileStatus, + DDOSProfileTemplate, + DDOSProfileTemplateField, FlavorHardwareDescription, FloatingIP, - FloatingIPInterfaceNewInstance, - FloatingIPNewInterface, FloatingIPStatus, InstanceMetricsTimeUnit, InterfaceIPFamily, - ItemPrice, - LaasIndexRetentionPolicy, - Listener, LoadBalancer, - LoadBalancerFlavor, LoadBalancerInstanceRole, - LoadBalancerLogging, - LoadBalancerStatList, - MandatoryID, - MemberConnectivity, - Name, + LoadBalancerMemberConnectivity, + LoadBalancerOperatingStatus, + LoadBalancerStatistics, Network, - NetworkPortFixedIP, - OperatingStatus, - ProfileOptionList, ProvisioningStatus, - RawMetadata, Subnet, Tag, TagList, - TagUpdateList, TaskIDList, VrrpIP, ) diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index b45235e3..d560cfbe 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -63,18 +63,21 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Project: - """Create project + """ + Create project Args: - name: Unique project name for a client. - - Each client always has one "default" project. + name: '#/components/schemas/CreateProjectSerializer/properties/name' + "$.components.schemas.CreateProjectSerializer.properties.name" - client_id: ID associated with the client. + client_id: '#/components/schemas/CreateProjectSerializer/properties/client_id/anyOf/0' + "$.components.schemas.CreateProjectSerializer.properties.client_id.anyOf[0]" - description: Description of the project. + description: '#/components/schemas/CreateProjectSerializer/properties/description/anyOf/0' + "$.components.schemas.CreateProjectSerializer.properties.description.anyOf[0]" - state: State of the project. + state: '#/components/schemas/CreateProjectSerializer/properties/state/anyOf/0' + "$.components.schemas.CreateProjectSerializer.properties.state.anyOf[0]" extra_headers: Send extra headers @@ -121,17 +124,23 @@ def list( List projects Args: - client_id: Client ID filter for administrators. + client_id: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/0' + "$.paths['/cloud/v1/projects'].get.parameters[0]" - include_deleted: Whether to include deleted projects in the response. + include_deleted: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/1' + "$.paths['/cloud/v1/projects'].get.parameters[1]" - limit: Limit value is used to limit the number of records in the result + limit: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/2' + "$.paths['/cloud/v1/projects'].get.parameters[2]" - name: Name to filter the results by. + name: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/3' + "$.paths['/cloud/v1/projects'].get.parameters[3]" - offset: Offset value is used to exclude the first set of records from the result + offset: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/4' + "$.paths['/cloud/v1/projects'].get.parameters[4]" - order_by: Order by field and direction. + order_by: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/5' + "$.paths['/cloud/v1/projects'].get.parameters[5]" extra_headers: Send extra headers @@ -180,6 +189,9 @@ def delete( and will not be recoverable Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/projects/{project_id}']['delete'].parameters[0].schema" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -213,6 +225,9 @@ def get( Get Project Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/projects/{project_id}'].get.parameters[0].schema" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -248,9 +263,14 @@ def replace( Update Project Args: - name: Name of the entity, following a specific format. + project_id: '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/put/parameters/0/schema' + "$.paths['/cloud/v1/projects/{project_id}'].put.parameters[0].schema" + + name: '#/components/schemas/NameDescriptionSerializer/properties/name' + "$.components.schemas.NameDescriptionSerializer.properties.name" - description: Description of the project. + description: '#/components/schemas/NameDescriptionSerializer/properties/description/anyOf/0' + "$.components.schemas.NameDescriptionSerializer.properties.description.anyOf[0]" extra_headers: Send extra headers @@ -312,18 +332,21 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Project: - """Create project + """ + Create project Args: - name: Unique project name for a client. - - Each client always has one "default" project. + name: '#/components/schemas/CreateProjectSerializer/properties/name' + "$.components.schemas.CreateProjectSerializer.properties.name" - client_id: ID associated with the client. + client_id: '#/components/schemas/CreateProjectSerializer/properties/client_id/anyOf/0' + "$.components.schemas.CreateProjectSerializer.properties.client_id.anyOf[0]" - description: Description of the project. + description: '#/components/schemas/CreateProjectSerializer/properties/description/anyOf/0' + "$.components.schemas.CreateProjectSerializer.properties.description.anyOf[0]" - state: State of the project. + state: '#/components/schemas/CreateProjectSerializer/properties/state/anyOf/0' + "$.components.schemas.CreateProjectSerializer.properties.state.anyOf[0]" extra_headers: Send extra headers @@ -370,17 +393,23 @@ def list( List projects Args: - client_id: Client ID filter for administrators. + client_id: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/0' + "$.paths['/cloud/v1/projects'].get.parameters[0]" - include_deleted: Whether to include deleted projects in the response. + include_deleted: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/1' + "$.paths['/cloud/v1/projects'].get.parameters[1]" - limit: Limit value is used to limit the number of records in the result + limit: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/2' + "$.paths['/cloud/v1/projects'].get.parameters[2]" - name: Name to filter the results by. + name: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/3' + "$.paths['/cloud/v1/projects'].get.parameters[3]" - offset: Offset value is used to exclude the first set of records from the result + offset: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/4' + "$.paths['/cloud/v1/projects'].get.parameters[4]" - order_by: Order by field and direction. + order_by: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/5' + "$.paths['/cloud/v1/projects'].get.parameters[5]" extra_headers: Send extra headers @@ -429,6 +458,9 @@ async def delete( and will not be recoverable Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/projects/{project_id}']['delete'].parameters[0].schema" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -462,6 +494,9 @@ async def get( Get Project Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/projects/{project_id}'].get.parameters[0].schema" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -497,9 +532,14 @@ async def replace( Update Project Args: - name: Name of the entity, following a specific format. + project_id: '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/put/parameters/0/schema' + "$.paths['/cloud/v1/projects/{project_id}'].put.parameters[0].schema" + + name: '#/components/schemas/NameDescriptionSerializer/properties/name' + "$.components.schemas.NameDescriptionSerializer.properties.name" - description: Description of the project. + description: '#/components/schemas/NameDescriptionSerializer/properties/description/anyOf/0' + "$.components.schemas.NameDescriptionSerializer.properties.description.anyOf[0]" extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index a0a1f3cd..514142de 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -88,9 +88,11 @@ def get_by_region( Get a quota by region Args: - client_id: Client ID + client_id: '#/paths/%2Fcloud%2Fv2%2Fregional_quotas%2F%7Bclient_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v2/regional_quotas/{client_id}/{region_id}'].get.parameters[0].schema" - region_id: Region ID + region_id: '#/paths/%2Fcloud%2Fv2%2Fregional_quotas%2F%7Bclient_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v2/regional_quotas/{client_id}/{region_id}'].get.parameters[1].schema" extra_headers: Send extra headers @@ -125,7 +127,8 @@ def get_global( Get global quota Args: - client_id: Client ID + client_id: '#/paths/%2Fcloud%2Fv2%2Fglobal_quotas%2F%7Bclient_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v2/global_quotas/{client_id}'].get.parameters[0].schema" extra_headers: Send extra headers @@ -203,9 +206,11 @@ async def get_by_region( Get a quota by region Args: - client_id: Client ID + client_id: '#/paths/%2Fcloud%2Fv2%2Fregional_quotas%2F%7Bclient_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v2/regional_quotas/{client_id}/{region_id}'].get.parameters[0].schema" - region_id: Region ID + region_id: '#/paths/%2Fcloud%2Fv2%2Fregional_quotas%2F%7Bclient_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v2/regional_quotas/{client_id}/{region_id}'].get.parameters[1].schema" extra_headers: Send extra headers @@ -240,7 +245,8 @@ async def get_global( Get global quota Args: - client_id: Client ID + client_id: '#/paths/%2Fcloud%2Fv2%2Fglobal_quotas%2F%7Bclient_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v2/global_quotas/{client_id}'].get.parameters[0].schema" extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 40ea3328..aa10dc96 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -64,11 +64,14 @@ def create( Create request to change quotas Args: - description: Describe the reason, in general terms. + description: '#/components/schemas/LimitsRequestCreateSerializer/properties/description' + "$.components.schemas.LimitsRequestCreateSerializer.properties.description" - requested_limits: Limits you want to increase. + requested_limits: '#/components/schemas/LimitsRequestCreateSerializer/properties/requested_limits' + "$.components.schemas.LimitsRequestCreateSerializer.properties.requested_limits" - client_id: Client ID that requests the limit increase. + client_id: '#/components/schemas/LimitsRequestCreateSerializer/properties/client_id' + "$.components.schemas.LimitsRequestCreateSerializer.properties.client_id" extra_headers: Send extra headers @@ -112,12 +115,14 @@ def list( Returns a list of sent requests to change current quotas and their statuses Args: - limit: Optional. Limit the number of returned items + limit: '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/0' + "$.paths['/cloud/v2/limits_request'].get.parameters[0]" - offset: Optional. Offset value is used to exclude the first set of records from the - result + offset: '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/1' + "$.paths['/cloud/v2/limits_request'].get.parameters[1]" - status: List of limit requests statuses for filtering + status: '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/2/schema/anyOf/0' + "$.paths['/cloud/v2/limits_request'].get.parameters[2].schema.anyOf[0]" extra_headers: Send extra headers @@ -162,7 +167,8 @@ def delete( Delete request to change quotas Args: - request_id: LimitRequest ID + request_id: '#/paths/%2Fcloud%2Fv2%2Flimits_request%2F%7Brequest_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v2/limits_request/{request_id}']['delete'].parameters[0].schema" extra_headers: Send extra headers @@ -198,7 +204,8 @@ def get( Get request to change quota limits. Args: - request_id: LimitRequest ID + request_id: '#/paths/%2Fcloud%2Fv2%2Flimits_request%2F%7Brequest_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v2/limits_request/{request_id}'].get.parameters[0].schema" extra_headers: Send extra headers @@ -256,11 +263,14 @@ async def create( Create request to change quotas Args: - description: Describe the reason, in general terms. + description: '#/components/schemas/LimitsRequestCreateSerializer/properties/description' + "$.components.schemas.LimitsRequestCreateSerializer.properties.description" - requested_limits: Limits you want to increase. + requested_limits: '#/components/schemas/LimitsRequestCreateSerializer/properties/requested_limits' + "$.components.schemas.LimitsRequestCreateSerializer.properties.requested_limits" - client_id: Client ID that requests the limit increase. + client_id: '#/components/schemas/LimitsRequestCreateSerializer/properties/client_id' + "$.components.schemas.LimitsRequestCreateSerializer.properties.client_id" extra_headers: Send extra headers @@ -304,12 +314,14 @@ async def list( Returns a list of sent requests to change current quotas and their statuses Args: - limit: Optional. Limit the number of returned items + limit: '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/0' + "$.paths['/cloud/v2/limits_request'].get.parameters[0]" - offset: Optional. Offset value is used to exclude the first set of records from the - result + offset: '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/1' + "$.paths['/cloud/v2/limits_request'].get.parameters[1]" - status: List of limit requests statuses for filtering + status: '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/2/schema/anyOf/0' + "$.paths['/cloud/v2/limits_request'].get.parameters[2].schema.anyOf[0]" extra_headers: Send extra headers @@ -354,7 +366,8 @@ async def delete( Delete request to change quotas Args: - request_id: LimitRequest ID + request_id: '#/paths/%2Fcloud%2Fv2%2Flimits_request%2F%7Brequest_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v2/limits_request/{request_id}']['delete'].parameters[0].schema" extra_headers: Send extra headers @@ -390,7 +403,8 @@ async def get( Get request to change quota limits. Args: - request_id: LimitRequest ID + request_id: '#/paths/%2Fcloud%2Fv2%2Flimits_request%2F%7Brequest_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v2/limits_request/{request_id}'].get.parameters[0].schema" extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index 2c742581..aa869795 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -63,10 +63,11 @@ def retrieve( Get region Args: - region_id: Region ID + region_id: '#/paths/%2Fcloud%2Fv1%2Fregions%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/regions/{region_id}'].get.parameters[0].schema" - show_volume_types: If true, null `available_volume_type` is replaced with a list of available - volume types. + show_volume_types: '#/paths/%2Fcloud%2Fv1%2Fregions%2F%7Bregion_id%7D/get/parameters/1' + "$.paths['/cloud/v1/regions/{region_id}'].get.parameters[1]" extra_headers: Send extra headers @@ -108,22 +109,24 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[Region]: - """List regions + """ + List regions Args: - limit: Limit the number of returned regions. - - Falls back to default of 100 if not - specified. Limited by max limit value of 1000 + limit: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/0' + "$.paths['/cloud/v1/regions'].get.parameters[0]" - offset: Offset value is used to exclude the first set of records from the result + offset: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/1' + "$.paths['/cloud/v1/regions'].get.parameters[1]" - order_by: Order by field and direction. + order_by: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/2' + "$.paths['/cloud/v1/regions'].get.parameters[2]" - product: If defined then return only regions that support given product. + product: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/3' + "$.paths['/cloud/v1/regions'].get.parameters[3]" - show_volume_types: If true, null `available_volume_type` is replaced with a list of available - volume types. + show_volume_types: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/4' + "$.paths['/cloud/v1/regions'].get.parameters[4]" extra_headers: Send extra headers @@ -192,10 +195,11 @@ async def retrieve( Get region Args: - region_id: Region ID + region_id: '#/paths/%2Fcloud%2Fv1%2Fregions%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/regions/{region_id}'].get.parameters[0].schema" - show_volume_types: If true, null `available_volume_type` is replaced with a list of available - volume types. + show_volume_types: '#/paths/%2Fcloud%2Fv1%2Fregions%2F%7Bregion_id%7D/get/parameters/1' + "$.paths['/cloud/v1/regions/{region_id}'].get.parameters[1]" extra_headers: Send extra headers @@ -237,22 +241,24 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Region, AsyncOffsetPage[Region]]: - """List regions + """ + List regions Args: - limit: Limit the number of returned regions. - - Falls back to default of 100 if not - specified. Limited by max limit value of 1000 + limit: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/0' + "$.paths['/cloud/v1/regions'].get.parameters[0]" - offset: Offset value is used to exclude the first set of records from the result + offset: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/1' + "$.paths['/cloud/v1/regions'].get.parameters[1]" - order_by: Order by field and direction. + order_by: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/2' + "$.paths['/cloud/v1/regions'].get.parameters[2]" - product: If defined then return only regions that support given product. + product: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/3' + "$.paths['/cloud/v1/regions'].get.parameters[3]" - show_volume_types: If true, null `available_volume_type` is replaced with a list of available - volume types. + show_volume_types: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/4' + "$.paths['/cloud/v1/regions'].get.parameters[4]" extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index f07a58c0..bab224b8 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -73,41 +73,42 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecretCreateResponse: - """Create secret + """ + Create secret Args: - name: Secret name + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].post.parameters[0].schema" - payload: Secret payload. + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].post.parameters[1].schema" - For HTTPS-terminated load balancing, provide base64 encoded - conents of a PKCS12 file. The PKCS12 file is the combined TLS certificate, key, - and intermediate certificate chain obtained from an external certificate - authority. The file can be created via openssl, e.g.'openssl pkcs12 -export - -inkey server.key -in server.crt -certfile ca-chain.crt -passout pass: -out - server.p12'The key and certificate should be PEM-encoded, and the intermediate - certificate chain should be multiple PEM-encoded certs concatenated together + name: '#/components/schemas/CreateSecretSerializer/properties/name' + "$.components.schemas.CreateSecretSerializer.properties.name" - payload_content_encoding: The encoding used for the payload to be able to include it in the JSON request. - Currently only base64 is supported + payload: '#/components/schemas/CreateSecretSerializer/properties/payload' + "$.components.schemas.CreateSecretSerializer.properties.payload" - payload_content_type: The media type for the content of the payload + payload_content_encoding: '#/components/schemas/CreateSecretSerializer/properties/payload_content_encoding' + "$.components.schemas.CreateSecretSerializer.properties.payload_content_encoding" - secret_type: Secret type. symmetric - Used for storing byte arrays such as keys suitable for - symmetric encryption; public - Used for storing the public key of an asymmetric - keypair; private - Used for storing the private key of an asymmetric keypair; - passphrase - Used for storing plain text passphrases; certificate - Used for - storing cryptographic certificates such as X.509 certificates; opaque - Used for - backwards compatibility with previous versions of the API + payload_content_type: '#/components/schemas/CreateSecretSerializer/properties/payload_content_type' + "$.components.schemas.CreateSecretSerializer.properties.payload_content_type" - algorithm: Metadata provided by a user or system for informational purposes. + secret_type: '#/components/schemas/CreateSecretSerializer/properties/secret_type' + "$.components.schemas.CreateSecretSerializer.properties.secret_type" - bit_length: Metadata provided by a user or system for informational purposes. Value must be - greater than zero. + algorithm: '#/components/schemas/CreateSecretSerializer/properties/algorithm/anyOf/0' + "$.components.schemas.CreateSecretSerializer.properties.algorithm.anyOf[0]" - expiration: Datetime when the secret will expire. + bit_length: '#/components/schemas/CreateSecretSerializer/properties/bit_length/anyOf/0' + "$.components.schemas.CreateSecretSerializer.properties.bit_length.anyOf[0]" - mode: Metadata provided by a user or system for informational purposes. + expiration: '#/components/schemas/CreateSecretSerializer/properties/expiration/anyOf/0' + "$.components.schemas.CreateSecretSerializer.properties.expiration.anyOf[0]" + + mode: '#/components/schemas/CreateSecretSerializer/properties/mode/anyOf/0' + "$.components.schemas.CreateSecretSerializer.properties.mode.anyOf[0]" extra_headers: Send extra headers @@ -159,6 +160,12 @@ def list( List secrets Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].get.parameters[1].schema" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -196,6 +203,15 @@ def delete( Delete secret Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}']['delete'].parameters[1].schema" + + secret_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}']['delete'].parameters[2].schema" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -235,6 +251,15 @@ def get( Get secret Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}'].get.parameters[1].schema" + + secret_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}'].get.parameters[2].schema" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -276,11 +301,20 @@ def upload_tls_certificate( Create secret Args: - name: Secret name + project_id: '#/paths/%2Fcloud%2Fv2%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v2/secrets/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v2/secrets/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateSecretSerializerV2/properties/name' + "$.components.schemas.CreateSecretSerializerV2.properties.name" - payload: Secret payload. + payload: '#/components/schemas/CreateSecretSerializerV2/properties/payload' + "$.components.schemas.CreateSecretSerializerV2.properties.payload" - expiration: Datetime when the secret will expire. Defaults to None + expiration: '#/components/schemas/CreateSecretSerializerV2/properties/expiration/anyOf/0' + "$.components.schemas.CreateSecretSerializerV2.properties.expiration.anyOf[0]" extra_headers: Send extra headers @@ -352,41 +386,42 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecretCreateResponse: - """Create secret + """ + Create secret Args: - name: Secret name + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].post.parameters[0].schema" - payload: Secret payload. + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].post.parameters[1].schema" - For HTTPS-terminated load balancing, provide base64 encoded - conents of a PKCS12 file. The PKCS12 file is the combined TLS certificate, key, - and intermediate certificate chain obtained from an external certificate - authority. The file can be created via openssl, e.g.'openssl pkcs12 -export - -inkey server.key -in server.crt -certfile ca-chain.crt -passout pass: -out - server.p12'The key and certificate should be PEM-encoded, and the intermediate - certificate chain should be multiple PEM-encoded certs concatenated together + name: '#/components/schemas/CreateSecretSerializer/properties/name' + "$.components.schemas.CreateSecretSerializer.properties.name" - payload_content_encoding: The encoding used for the payload to be able to include it in the JSON request. - Currently only base64 is supported + payload: '#/components/schemas/CreateSecretSerializer/properties/payload' + "$.components.schemas.CreateSecretSerializer.properties.payload" - payload_content_type: The media type for the content of the payload + payload_content_encoding: '#/components/schemas/CreateSecretSerializer/properties/payload_content_encoding' + "$.components.schemas.CreateSecretSerializer.properties.payload_content_encoding" - secret_type: Secret type. symmetric - Used for storing byte arrays such as keys suitable for - symmetric encryption; public - Used for storing the public key of an asymmetric - keypair; private - Used for storing the private key of an asymmetric keypair; - passphrase - Used for storing plain text passphrases; certificate - Used for - storing cryptographic certificates such as X.509 certificates; opaque - Used for - backwards compatibility with previous versions of the API + payload_content_type: '#/components/schemas/CreateSecretSerializer/properties/payload_content_type' + "$.components.schemas.CreateSecretSerializer.properties.payload_content_type" - algorithm: Metadata provided by a user or system for informational purposes. + secret_type: '#/components/schemas/CreateSecretSerializer/properties/secret_type' + "$.components.schemas.CreateSecretSerializer.properties.secret_type" - bit_length: Metadata provided by a user or system for informational purposes. Value must be - greater than zero. + algorithm: '#/components/schemas/CreateSecretSerializer/properties/algorithm/anyOf/0' + "$.components.schemas.CreateSecretSerializer.properties.algorithm.anyOf[0]" - expiration: Datetime when the secret will expire. + bit_length: '#/components/schemas/CreateSecretSerializer/properties/bit_length/anyOf/0' + "$.components.schemas.CreateSecretSerializer.properties.bit_length.anyOf[0]" - mode: Metadata provided by a user or system for informational purposes. + expiration: '#/components/schemas/CreateSecretSerializer/properties/expiration/anyOf/0' + "$.components.schemas.CreateSecretSerializer.properties.expiration.anyOf[0]" + + mode: '#/components/schemas/CreateSecretSerializer/properties/mode/anyOf/0' + "$.components.schemas.CreateSecretSerializer.properties.mode.anyOf[0]" extra_headers: Send extra headers @@ -438,6 +473,12 @@ async def list( List secrets Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].get.parameters[1].schema" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -475,6 +516,15 @@ async def delete( Delete secret Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}']['delete'].parameters[1].schema" + + secret_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}']['delete'].parameters[2].schema" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -514,6 +564,15 @@ async def get( Get secret Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}'].get.parameters[1].schema" + + secret_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}'].get.parameters[2].schema" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -555,11 +614,20 @@ async def upload_tls_certificate( Create secret Args: - name: Secret name + project_id: '#/paths/%2Fcloud%2Fv2%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v2/secrets/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v2/secrets/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateSecretSerializerV2/properties/name' + "$.components.schemas.CreateSecretSerializerV2.properties.name" - payload: Secret payload. + payload: '#/components/schemas/CreateSecretSerializerV2/properties/payload' + "$.components.schemas.CreateSecretSerializerV2.properties.payload" - expiration: Datetime when the secret will expire. Defaults to None + expiration: '#/components/schemas/CreateSecretSerializerV2/properties/expiration/anyOf/0' + "$.components.schemas.CreateSecretSerializerV2.properties.expiration.anyOf[0]" extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index d587377d..0ecb489f 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -66,21 +66,17 @@ def create( To generate a key, omit the public_key parameter from the request body Args: - project_id: Project ID + project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].post.parameters[0].schema" - name: SSH key name + name: '#/components/schemas/CreateSSHKeySerializer/properties/name' + "$.components.schemas.CreateSSHKeySerializer.properties.name" - public_key: The public part of an SSH key is the shareable portion of an SSH key pair. It - can be safely sent to servers or services to grant access. It does not contain - sensitive information. + public_key: '#/components/schemas/CreateSSHKeySerializer/properties/public_key' + "$.components.schemas.CreateSSHKeySerializer.properties.public_key" - - If you’re uploading your own key, provide the public part here (usually found - in a file like `id_ed25519.pub`). - - If you want the platform to generate an Ed25519 key pair for you, leave this - field empty — the system will return the private key in the response **once - only**. - - shared_in_project: SSH key is shared with all users in the project + shared_in_project: '#/components/schemas/CreateSSHKeySerializer/properties/shared_in_project' + "$.components.schemas.CreateSSHKeySerializer.properties.shared_in_project" extra_headers: Send extra headers @@ -125,11 +121,14 @@ def update( Share or unshare SSH key with users Args: - project_id: Project ID + project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].patch.parameters[0].schema" - ssh_key_id: SSH key ID + ssh_key_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].patch.parameters[1].schema" - shared_in_project: Share your ssh key with all users in the project + shared_in_project: '#/components/schemas/ShareSSHKeySerializer/properties/shared_in_project' + "$.components.schemas.ShareSSHKeySerializer.properties.shared_in_project" extra_headers: Send extra headers @@ -170,13 +169,17 @@ def list( List SSH keys Args: - project_id: Project ID + project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[0].schema" - limit: Maximum number of SSH keys to return + limit: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/1' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[1]" - offset: Offset for pagination + offset: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/2' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[2]" - order_by: Sort order for the SSH keys + order_by: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/3' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[3]" extra_headers: Send extra headers @@ -224,9 +227,11 @@ def delete( Delete SSH key Args: - project_id: Project ID + project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}']['delete'].parameters[0].schema" - ssh_key_id: SSH key ID + ssh_key_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}']['delete'].parameters[1].schema" extra_headers: Send extra headers @@ -265,9 +270,11 @@ def get( Get SSH key Args: - project_id: Project ID + project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].get.parameters[0].schema" - ssh_key_id: SSH key ID + ssh_key_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].get.parameters[1].schema" extra_headers: Send extra headers @@ -328,21 +335,17 @@ async def create( To generate a key, omit the public_key parameter from the request body Args: - project_id: Project ID - - name: SSH key name + project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].post.parameters[0].schema" - public_key: The public part of an SSH key is the shareable portion of an SSH key pair. It - can be safely sent to servers or services to grant access. It does not contain - sensitive information. + name: '#/components/schemas/CreateSSHKeySerializer/properties/name' + "$.components.schemas.CreateSSHKeySerializer.properties.name" - - If you’re uploading your own key, provide the public part here (usually found - in a file like `id_ed25519.pub`). - - If you want the platform to generate an Ed25519 key pair for you, leave this - field empty — the system will return the private key in the response **once - only**. + public_key: '#/components/schemas/CreateSSHKeySerializer/properties/public_key' + "$.components.schemas.CreateSSHKeySerializer.properties.public_key" - shared_in_project: SSH key is shared with all users in the project + shared_in_project: '#/components/schemas/CreateSSHKeySerializer/properties/shared_in_project' + "$.components.schemas.CreateSSHKeySerializer.properties.shared_in_project" extra_headers: Send extra headers @@ -387,11 +390,14 @@ async def update( Share or unshare SSH key with users Args: - project_id: Project ID + project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].patch.parameters[0].schema" - ssh_key_id: SSH key ID + ssh_key_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].patch.parameters[1].schema" - shared_in_project: Share your ssh key with all users in the project + shared_in_project: '#/components/schemas/ShareSSHKeySerializer/properties/shared_in_project' + "$.components.schemas.ShareSSHKeySerializer.properties.shared_in_project" extra_headers: Send extra headers @@ -434,13 +440,17 @@ def list( List SSH keys Args: - project_id: Project ID + project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[0].schema" - limit: Maximum number of SSH keys to return + limit: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/1' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[1]" - offset: Offset for pagination + offset: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/2' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[2]" - order_by: Sort order for the SSH keys + order_by: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/3' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[3]" extra_headers: Send extra headers @@ -488,9 +498,11 @@ async def delete( Delete SSH key Args: - project_id: Project ID + project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}']['delete'].parameters[0].schema" - ssh_key_id: SSH key ID + ssh_key_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}']['delete'].parameters[1].schema" extra_headers: Send extra headers @@ -529,9 +541,11 @@ async def get( Get SSH key Args: - project_id: Project ID + project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].get.parameters[0].schema" - ssh_key_id: SSH key ID + ssh_key_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].get.parameters[1].schema" extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 49ec4e09..c51ddeda 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -69,75 +69,39 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[Task]: - """List tasks + """ + List tasks Args: - from_timestamp: ISO formatted datetime string. - - Filter the tasks by creation date greater than or - equal to from_timestamp - - is_acknowledged: Filter the tasks by their acknowledgement status - - limit: Limit the number of returned tasks. Falls back to default of 10 if not - specified. Limited by max limit value of 1000 - - offset: Offset value is used to exclude the first set of records from the result - - project_id: The project ID to filter the tasks by project. Supports multiple values of kind - key=value1&key=value2 - - region_id: The region ID to filter the tasks by region. Supports multiple values of kind - key=value1&key=value2 - - sorting: Sorting by creation date. Oldest first, or most recent first - - state: Filter the tasks by state. Supports multiple values of kind - key=value1&key=value2 - - task_type: Filter the tasks by their type one of ['activate_ddos_profile', - 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', - 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', - 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', - 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', - 'create_fip', 'create_gpu_virtual_cluster', 'create_image', - 'create_inference_instance', 'create_inference_instance_key', - 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', - 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', - 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', - 'create_reserved_fixed_ip', 'create_router', 'create_secret', - 'create_servergroup', 'create_sfs', 'create_snapshot', 'create_subnet', - 'create_vm', 'create_volume', 'deactivate_ddos_profile', - 'delete_ai_cluster_gpu', 'delete_caas_container', - 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', - 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', - 'delete_image', 'delete_inference_instance', 'delete_k8s_cluster_pool_v2', - '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', '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', - 'replace_lbmetadata', 'resize_k8s_cluster_v2', 'resize_loadbalancer', - 'resize_vm', 'resume_vm', 'revert_volume', 'soft_reboot_gpu_baremetal_server', - 'soft_reboot_gpu_virtual_cluster', 'soft_reboot_gpu_virtual_server', - 'soft_reboot_vm', 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', - 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', - 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', - 'sync_private_flavors', 'update_ddos_profile', 'update_inference_instance', - 'update_inference_instance_key', 'update_k8s_cluster_v2', 'update_lbmetadata', - 'update_port_allowed_address_pairs', 'update_tags_gpu_virtual_cluster', - 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu'] - - to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or - equal to to_timestamp + from_timestamp: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/0/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[0].schema.anyOf[0]" + + is_acknowledged: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/1/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[1].schema.anyOf[0]" + + limit: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/2' + "$.paths['/cloud/v1/tasks'].get.parameters[2]" + + offset: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/3' + "$.paths['/cloud/v1/tasks'].get.parameters[3]" + + project_id: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/4/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[4].schema.anyOf[0]" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/5/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[5].schema.anyOf[0]" + + sorting: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/6/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[6].schema.anyOf[0]" + + state: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/7/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[7].schema.anyOf[0]" + + task_type: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/8/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[8].schema.anyOf[0]" + + to_timestamp: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/9/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[9].schema.anyOf[0]" extra_headers: Send extra headers @@ -190,9 +154,11 @@ def acknowledge_all( Acknowledge all client tasks in project or region Args: - project_id: Project ID + project_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2Facknowledge_all/post/parameters/0/schema/anyOf/0' + "$.paths['/cloud/v1/tasks/acknowledge_all'].post.parameters[0].schema.anyOf[0]" - region_id: Region ID + region_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2Facknowledge_all/post/parameters/1/schema/anyOf/0' + "$.paths['/cloud/v1/tasks/acknowledge_all'].post.parameters[1].schema.anyOf[0]" extra_headers: Send extra headers @@ -236,7 +202,8 @@ def acknowledge_one( Acknowledge one task on project scope Args: - task_id: Task ID + task_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2F%7Btask_id%7D%2Facknowledge/post/parameters/0/schema' + "$.paths['/cloud/v1/tasks/{task_id}/acknowledge'].post.parameters[0].schema" extra_headers: Send extra headers @@ -271,7 +238,8 @@ def get( Get task Args: - task_id: Task ID + task_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2F%7Btask_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/tasks/{task_id}'].get.parameters[0].schema" extra_headers: Send extra headers @@ -332,75 +300,39 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Task, AsyncOffsetPage[Task]]: - """List tasks + """ + List tasks Args: - from_timestamp: ISO formatted datetime string. - - Filter the tasks by creation date greater than or - equal to from_timestamp - - is_acknowledged: Filter the tasks by their acknowledgement status - - limit: Limit the number of returned tasks. Falls back to default of 10 if not - specified. Limited by max limit value of 1000 - - offset: Offset value is used to exclude the first set of records from the result - - project_id: The project ID to filter the tasks by project. Supports multiple values of kind - key=value1&key=value2 - - region_id: The region ID to filter the tasks by region. Supports multiple values of kind - key=value1&key=value2 - - sorting: Sorting by creation date. Oldest first, or most recent first - - state: Filter the tasks by state. Supports multiple values of kind - key=value1&key=value2 - - task_type: Filter the tasks by their type one of ['activate_ddos_profile', - 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', - 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', - 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', - 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', - 'create_fip', 'create_gpu_virtual_cluster', 'create_image', - 'create_inference_instance', 'create_inference_instance_key', - 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', - 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', - 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', - 'create_reserved_fixed_ip', 'create_router', 'create_secret', - 'create_servergroup', 'create_sfs', 'create_snapshot', 'create_subnet', - 'create_vm', 'create_volume', 'deactivate_ddos_profile', - 'delete_ai_cluster_gpu', 'delete_caas_container', - 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', - 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', - 'delete_image', 'delete_inference_instance', 'delete_k8s_cluster_pool_v2', - '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', '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', - 'replace_lbmetadata', 'resize_k8s_cluster_v2', 'resize_loadbalancer', - 'resize_vm', 'resume_vm', 'revert_volume', 'soft_reboot_gpu_baremetal_server', - 'soft_reboot_gpu_virtual_cluster', 'soft_reboot_gpu_virtual_server', - 'soft_reboot_vm', 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', - 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', - 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', - 'sync_private_flavors', 'update_ddos_profile', 'update_inference_instance', - 'update_inference_instance_key', 'update_k8s_cluster_v2', 'update_lbmetadata', - 'update_port_allowed_address_pairs', 'update_tags_gpu_virtual_cluster', - 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu'] - - to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or - equal to to_timestamp + from_timestamp: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/0/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[0].schema.anyOf[0]" + + is_acknowledged: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/1/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[1].schema.anyOf[0]" + + limit: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/2' + "$.paths['/cloud/v1/tasks'].get.parameters[2]" + + offset: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/3' + "$.paths['/cloud/v1/tasks'].get.parameters[3]" + + project_id: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/4/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[4].schema.anyOf[0]" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/5/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[5].schema.anyOf[0]" + + sorting: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/6/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[6].schema.anyOf[0]" + + state: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/7/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[7].schema.anyOf[0]" + + task_type: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/8/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[8].schema.anyOf[0]" + + to_timestamp: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/9/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[9].schema.anyOf[0]" extra_headers: Send extra headers @@ -453,9 +385,11 @@ async def acknowledge_all( Acknowledge all client tasks in project or region Args: - project_id: Project ID + project_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2Facknowledge_all/post/parameters/0/schema/anyOf/0' + "$.paths['/cloud/v1/tasks/acknowledge_all'].post.parameters[0].schema.anyOf[0]" - region_id: Region ID + region_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2Facknowledge_all/post/parameters/1/schema/anyOf/0' + "$.paths['/cloud/v1/tasks/acknowledge_all'].post.parameters[1].schema.anyOf[0]" extra_headers: Send extra headers @@ -499,7 +433,8 @@ async def acknowledge_one( Acknowledge one task on project scope Args: - task_id: Task ID + task_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2F%7Btask_id%7D%2Facknowledge/post/parameters/0/schema' + "$.paths['/cloud/v1/tasks/{task_id}/acknowledge'].post.parameters[0].schema" extra_headers: Send extra headers @@ -534,7 +469,8 @@ async def get( Get task Args: - task_id: Task ID + task_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2F%7Btask_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/tasks/{task_id}'].get.parameters[0].schema" extra_headers: Send extra headers diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 49e7e1a5..bd2add6e 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -9,12 +9,10 @@ from .ssh_key import SSHKey as SSHKey from .ip_ranges import IPRanges as IPRanges from .created_ssh_key import CreatedSSHKey as CreatedSSHKey -from .operating_status import OperatingStatus as OperatingStatus from .task_list_params import TaskListParams as TaskListParams from .floating_ip_status import FloatingIPStatus as FloatingIPStatus from .region_list_params import RegionListParams as RegionListParams from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily -from .member_connectivity import MemberConnectivity as MemberConnectivity from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams @@ -34,6 +32,8 @@ from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse +from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus +from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams from .secret_upload_tls_certificate_response import ( SecretUploadTlsCertificateResponse as SecretUploadTlsCertificateResponse, diff --git a/src/gcore/types/cloud/created_ssh_key.py b/src/gcore/types/cloud/created_ssh_key.py index d31c4bf3..70ff4c5c 100644 --- a/src/gcore/types/cloud/created_ssh_key.py +++ b/src/gcore/types/cloud/created_ssh_key.py @@ -11,43 +11,55 @@ class CreatedSSHKey(BaseModel): id: str - """SSH key ID""" + """ + '#/components/schemas/CreatedSSHKeySerializer/properties/id' + "$.components.schemas.CreatedSSHKeySerializer.properties.id" + """ created_at: datetime - """SSH key creation time""" + """ + '#/components/schemas/CreatedSSHKeySerializer/properties/created_at' + "$.components.schemas.CreatedSSHKeySerializer.properties.created_at" + """ fingerprint: str - """Fingerprint""" + """ + '#/components/schemas/CreatedSSHKeySerializer/properties/fingerprint' + "$.components.schemas.CreatedSSHKeySerializer.properties.fingerprint" + """ name: str - """SSH key name""" + """ + '#/components/schemas/CreatedSSHKeySerializer/properties/name' + "$.components.schemas.CreatedSSHKeySerializer.properties.name" + """ private_key: Optional[str] = None - """The private part of an SSH key is the confidential portion of the key pair. - - It should never be shared or exposed. This key is used to prove your identity - when connecting to a server. - - If you omit the `public_key`, the platform will generate a key for you. The - private_key will be returned **once** in the API response. Be sure to save it - securely, as it cannot be retrieved again later. - - Best practice: Save the private key to a secure location on your machine (e.g., - `~/.ssh/id_ed25519`) and set the file permissions to be readable only by you. + """ + '#/components/schemas/CreatedSSHKeySerializer/properties/private_key/anyOf/0' + "$.components.schemas.CreatedSSHKeySerializer.properties.private_key.anyOf[0]" """ project_id: int - """Project ID""" + """ + '#/components/schemas/CreatedSSHKeySerializer/properties/project_id' + "$.components.schemas.CreatedSSHKeySerializer.properties.project_id" + """ public_key: str - """The public part of an SSH key is the shareable portion of an SSH key pair. - - It can be safely sent to servers or services to grant access. It does not - contain sensitive information. + """ + '#/components/schemas/CreatedSSHKeySerializer/properties/public_key' + "$.components.schemas.CreatedSSHKeySerializer.properties.public_key" """ shared_in_project: bool - """SSH key will be visible to all users in the project""" + """ + '#/components/schemas/CreatedSSHKeySerializer/properties/shared_in_project' + "$.components.schemas.CreatedSSHKeySerializer.properties.shared_in_project" + """ state: Literal["ACTIVE", "DELETING"] - """SSH key state""" + """ + '#/components/schemas/CreatedSSHKeySerializer/properties/state' + "$.components.schemas.CreatedSSHKeySerializer.properties.state" + """ diff --git a/src/gcore/types/cloud/ip_ranges.py b/src/gcore/types/cloud/ip_ranges.py index 5c983ebe..0bfc21e8 100644 --- a/src/gcore/types/cloud/ip_ranges.py +++ b/src/gcore/types/cloud/ip_ranges.py @@ -9,4 +9,7 @@ class IPRanges(BaseModel): ranges: List[str] - """IP ranges list""" + """ + '#/components/schemas/IPRangesSerializer/properties/ranges' + "$.components.schemas.IPRangesSerializer.properties.ranges" + """ diff --git a/src/gcore/types/cloud/member_connectivity.py b/src/gcore/types/cloud/load_balancer_member_connectivity.py similarity index 55% rename from src/gcore/types/cloud/member_connectivity.py rename to src/gcore/types/cloud/load_balancer_member_connectivity.py index 64e40b1c..d33a72da 100644 --- a/src/gcore/types/cloud/member_connectivity.py +++ b/src/gcore/types/cloud/load_balancer_member_connectivity.py @@ -2,6 +2,6 @@ from typing_extensions import Literal, TypeAlias -__all__ = ["MemberConnectivity"] +__all__ = ["LoadBalancerMemberConnectivity"] -MemberConnectivity: TypeAlias = Literal["L2", "L3"] +LoadBalancerMemberConnectivity: TypeAlias = Literal["L2", "L3"] diff --git a/src/gcore/types/cloud/load_balancer_operating_status.py b/src/gcore/types/cloud/load_balancer_operating_status.py new file mode 100644 index 00000000..28dd7a7f --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_operating_status.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["LoadBalancerOperatingStatus"] + +LoadBalancerOperatingStatus: TypeAlias = Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"] diff --git a/src/gcore/types/cloud/operating_status.py b/src/gcore/types/cloud/operating_status.py deleted file mode 100644 index 9c2c10d2..00000000 --- a/src/gcore/types/cloud/operating_status.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["OperatingStatus"] - -OperatingStatus: TypeAlias = Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"] diff --git a/src/gcore/types/cloud/project.py b/src/gcore/types/cloud/project.py index 8d978657..c31c1474 100644 --- a/src/gcore/types/cloud/project.py +++ b/src/gcore/types/cloud/project.py @@ -10,38 +10,55 @@ class Project(BaseModel): id: int - """Project ID, which is automatically generated upon creation.""" + """ + '#/components/schemas/ProjectSerializer/properties/id' + "$.components.schemas.ProjectSerializer.properties.id" + """ client_id: int - """ID associated with the client.""" + """ + '#/components/schemas/ProjectSerializer/properties/client_id' + "$.components.schemas.ProjectSerializer.properties.client_id" + """ created_at: datetime - """Datetime of creation, which is automatically generated.""" + """ + '#/components/schemas/ProjectSerializer/properties/created_at' + "$.components.schemas.ProjectSerializer.properties.created_at" + """ is_default: bool - """Indicates if the project is the default one. - - Each client always has one default project. + """ + '#/components/schemas/ProjectSerializer/properties/is_default' + "$.components.schemas.ProjectSerializer.properties.is_default" """ name: str - """Unique project name for a client.""" + """ + '#/components/schemas/ProjectSerializer/properties/name' + "$.components.schemas.ProjectSerializer.properties.name" + """ state: str - """The state of the project.""" + """ + '#/components/schemas/ProjectSerializer/properties/state' + "$.components.schemas.ProjectSerializer.properties.state" + """ deleted_at: Optional[datetime] = None """ - Datetime of deletion, which is automatically generated if the project is - deleted. + '#/components/schemas/ProjectSerializer/properties/deleted_at/anyOf/0' + "$.components.schemas.ProjectSerializer.properties.deleted_at.anyOf[0]" """ description: Optional[str] = None - """Description of the project.""" + """ + '#/components/schemas/ProjectSerializer/properties/description/anyOf/0' + "$.components.schemas.ProjectSerializer.properties.description.anyOf[0]" + """ task_id: Optional[str] = None - """The UUID of the active task that currently holds a lock on the resource. - - This lock prevents concurrent modifications to ensure consistency. If `null`, - the resource is not locked. + """ + '#/components/schemas/ProjectSerializer/properties/task_id/anyOf/0' + "$.components.schemas.ProjectSerializer.properties.task_id.anyOf[0]" """ diff --git a/src/gcore/types/cloud/project_create_params.py b/src/gcore/types/cloud/project_create_params.py index 9a9255be..fd5ead0c 100644 --- a/src/gcore/types/cloud/project_create_params.py +++ b/src/gcore/types/cloud/project_create_params.py @@ -10,13 +10,25 @@ class ProjectCreateParams(TypedDict, total=False): name: Required[str] - """Unique project name for a client. Each client always has one "default" project.""" + """ + '#/components/schemas/CreateProjectSerializer/properties/name' + "$.components.schemas.CreateProjectSerializer.properties.name" + """ client_id: Optional[int] - """ID associated with the client.""" + """ + '#/components/schemas/CreateProjectSerializer/properties/client_id/anyOf/0' + "$.components.schemas.CreateProjectSerializer.properties.client_id.anyOf[0]" + """ description: Optional[str] - """Description of the project.""" + """ + '#/components/schemas/CreateProjectSerializer/properties/description/anyOf/0' + "$.components.schemas.CreateProjectSerializer.properties.description.anyOf[0]" + """ state: Optional[str] - """State of the project.""" + """ + '#/components/schemas/CreateProjectSerializer/properties/state/anyOf/0' + "$.components.schemas.CreateProjectSerializer.properties.state.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/project_delete_response.py b/src/gcore/types/cloud/project_delete_response.py index 1daebf63..f79413fd 100644 --- a/src/gcore/types/cloud/project_delete_response.py +++ b/src/gcore/types/cloud/project_delete_response.py @@ -9,4 +9,7 @@ class ProjectDeleteResponse(BaseModel): tasks: Optional[List[str]] = None - """Task list""" + """ + '#/components/schemas/TaskIdListSchema/properties/tasks' + "$.components.schemas.TaskIdListSchema.properties.tasks" + """ diff --git a/src/gcore/types/cloud/project_list_params.py b/src/gcore/types/cloud/project_list_params.py index a469a6ed..53753f9b 100644 --- a/src/gcore/types/cloud/project_list_params.py +++ b/src/gcore/types/cloud/project_list_params.py @@ -9,19 +9,37 @@ class ProjectListParams(TypedDict, total=False): client_id: int - """Client ID filter for administrators.""" + """ + '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/0' + "$.paths['/cloud/v1/projects'].get.parameters[0]" + """ include_deleted: bool - """Whether to include deleted projects in the response.""" + """ + '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/1' + "$.paths['/cloud/v1/projects'].get.parameters[1]" + """ limit: int - """Limit value is used to limit the number of records in the result""" + """ + '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/2' + "$.paths['/cloud/v1/projects'].get.parameters[2]" + """ name: str - """Name to filter the results by.""" + """ + '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/3' + "$.paths['/cloud/v1/projects'].get.parameters[3]" + """ offset: int - """Offset value is used to exclude the first set of records from the result""" + """ + '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/4' + "$.paths['/cloud/v1/projects'].get.parameters[4]" + """ order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] - """Order by field and direction.""" + """ + '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/5' + "$.paths['/cloud/v1/projects'].get.parameters[5]" + """ diff --git a/src/gcore/types/cloud/project_replace_params.py b/src/gcore/types/cloud/project_replace_params.py index c26f1c6f..f52748e5 100644 --- a/src/gcore/types/cloud/project_replace_params.py +++ b/src/gcore/types/cloud/project_replace_params.py @@ -10,9 +10,19 @@ class ProjectReplaceParams(TypedDict, total=False): project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/put/parameters/0/schema' + "$.paths['/cloud/v1/projects/{project_id}'].put.parameters[0].schema" + """ name: Required[str] - """Name of the entity, following a specific format.""" + """ + '#/components/schemas/NameDescriptionSerializer/properties/name' + "$.components.schemas.NameDescriptionSerializer.properties.name" + """ description: Optional[str] - """Description of the project.""" + """ + '#/components/schemas/NameDescriptionSerializer/properties/description/anyOf/0' + "$.components.schemas.NameDescriptionSerializer.properties.description.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/quota_get_all_response.py b/src/gcore/types/cloud/quota_get_all_response.py index c03ab710..738fb2b2 100644 --- a/src/gcore/types/cloud/quota_get_all_response.py +++ b/src/gcore/types/cloud/quota_get_all_response.py @@ -9,332 +9,659 @@ class GlobalQuotas(BaseModel): inference_cpu_millicore_count_limit: Optional[int] = None - """Inference CPU millicore count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_cpu_millicore_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_cpu_millicore_count_limit" + """ inference_cpu_millicore_count_usage: Optional[int] = None - """Inference CPU millicore count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_cpu_millicore_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_cpu_millicore_count_usage" + """ inference_gpu_a100_count_limit: Optional[int] = None - """Inference GPU A100 Count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_a100_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_a100_count_limit" + """ inference_gpu_a100_count_usage: Optional[int] = None - """Inference GPU A100 Count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_a100_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_a100_count_usage" + """ inference_gpu_h100_count_limit: Optional[int] = None - """Inference GPU H100 Count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_h100_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_h100_count_limit" + """ inference_gpu_h100_count_usage: Optional[int] = None - """Inference GPU H100 Count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_h100_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_h100_count_usage" + """ inference_gpu_l40s_count_limit: Optional[int] = None - """Inference GPU L40s Count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_l40s_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_l40s_count_limit" + """ inference_gpu_l40s_count_usage: Optional[int] = None - """Inference GPU L40s Count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_l40s_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_l40s_count_usage" + """ inference_instance_count_limit: Optional[int] = None - """Inference instance count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_instance_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_instance_count_limit" + """ inference_instance_count_usage: Optional[int] = None - """Inference instance count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_instance_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_instance_count_usage" + """ keypair_count_limit: Optional[int] = None - """SSH Keys Count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/keypair_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.keypair_count_limit" + """ keypair_count_usage: Optional[int] = None - """SSH Keys Count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/keypair_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.keypair_count_usage" + """ project_count_limit: Optional[int] = None - """Projects Count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/project_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.project_count_limit" + """ project_count_usage: Optional[int] = None - """Projects Count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/project_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.project_count_usage" + """ class RegionalQuota(BaseModel): baremetal_basic_count_limit: Optional[int] = None - """Basic bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_basic_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_basic_count_limit" + """ baremetal_basic_count_usage: Optional[int] = None - """Basic bare metal servers count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_basic_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_basic_count_usage" + """ baremetal_gpu_count_limit: Optional[int] = None - """AI GPU bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_gpu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_gpu_count_limit" + """ baremetal_gpu_count_usage: Optional[int] = None - """AI GPU bare metal servers count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_gpu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_gpu_count_usage" + """ baremetal_hf_count_limit: Optional[int] = None - """High-frequency bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_hf_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_hf_count_limit" + """ baremetal_hf_count_usage: Optional[int] = None - """High-frequency bare metal servers count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_hf_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_hf_count_usage" + """ baremetal_infrastructure_count_limit: Optional[int] = None - """Infrastructure bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_infrastructure_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_infrastructure_count_limit" + """ baremetal_infrastructure_count_usage: Optional[int] = None - """Infrastructure bare metal servers count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_infrastructure_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_infrastructure_count_usage" + """ baremetal_network_count_limit: Optional[int] = None - """Bare metal Network Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_network_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_network_count_limit" + """ baremetal_network_count_usage: Optional[int] = None - """Bare metal Network Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_network_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_network_count_usage" + """ baremetal_storage_count_limit: Optional[int] = None - """Storage bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_storage_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_storage_count_limit" + """ baremetal_storage_count_usage: Optional[int] = None - """Storage bare metal servers count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_storage_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_storage_count_usage" + """ caas_container_count_limit: Optional[int] = None - """Containers count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_container_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_container_count_limit" + """ caas_container_count_usage: Optional[int] = None - """Containers count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_container_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_container_count_usage" + """ caas_cpu_count_limit: Optional[int] = None - """mCPU count for containers limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_cpu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_cpu_count_limit" + """ caas_cpu_count_usage: Optional[int] = None - """mCPU count for containers usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_cpu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_cpu_count_usage" + """ caas_gpu_count_limit: Optional[int] = None - """Containers gpu count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_gpu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_gpu_count_limit" + """ caas_gpu_count_usage: Optional[int] = None - """Containers gpu count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_gpu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_gpu_count_usage" + """ caas_ram_size_limit: Optional[int] = None - """MB memory count for containers limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_ram_size_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_ram_size_limit" + """ caas_ram_size_usage: Optional[int] = None - """MB memory count for containers usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_ram_size_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_ram_size_usage" + """ cluster_count_limit: Optional[int] = None - """K8s clusters count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/cluster_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.cluster_count_limit" + """ cluster_count_usage: Optional[int] = None - """K8s clusters count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/cluster_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.cluster_count_usage" + """ cpu_count_limit: Optional[int] = None - """vCPU Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/cpu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.cpu_count_limit" + """ cpu_count_usage: Optional[int] = None - """vCPU Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/cpu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.cpu_count_usage" + """ dbaas_postgres_cluster_count_limit: Optional[int] = None - """DBaaS cluster count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/dbaas_postgres_cluster_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.dbaas_postgres_cluster_count_limit" + """ dbaas_postgres_cluster_count_usage: Optional[int] = None - """DBaaS cluster count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/dbaas_postgres_cluster_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.dbaas_postgres_cluster_count_usage" + """ external_ip_count_limit: Optional[int] = None - """External IP Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/external_ip_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.external_ip_count_limit" + """ external_ip_count_usage: Optional[int] = None - """External IP Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/external_ip_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.external_ip_count_usage" + """ faas_cpu_count_limit: Optional[int] = None - """mCPU count for functions limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_cpu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_cpu_count_limit" + """ faas_cpu_count_usage: Optional[int] = None - """mCPU count for functions usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_cpu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_cpu_count_usage" + """ faas_function_count_limit: Optional[int] = None - """Functions count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_function_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_function_count_limit" + """ faas_function_count_usage: Optional[int] = None - """Functions count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_function_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_function_count_usage" + """ faas_namespace_count_limit: Optional[int] = None - """Functions namespace count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_namespace_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_namespace_count_limit" + """ faas_namespace_count_usage: Optional[int] = None - """Functions namespace count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_namespace_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_namespace_count_usage" + """ faas_ram_size_limit: Optional[int] = None - """MB memory count for functions limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_ram_size_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_ram_size_limit" + """ faas_ram_size_usage: Optional[int] = None - """MB memory count for functions usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_ram_size_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_ram_size_usage" + """ firewall_count_limit: Optional[int] = None - """Firewalls Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/firewall_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.firewall_count_limit" + """ firewall_count_usage: Optional[int] = None - """Firewalls Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/firewall_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.firewall_count_usage" + """ floating_count_limit: Optional[int] = None - """Floating IP Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/floating_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.floating_count_limit" + """ floating_count_usage: Optional[int] = None - """Floating IP Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/floating_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.floating_count_usage" + """ gpu_count_limit: Optional[int] = None - """GPU Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_count_limit" + """ gpu_count_usage: Optional[int] = None - """GPU Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_count_usage" + """ gpu_virtual_a100_count_limit: Optional[int] = None - """Virtual A100 GPU card count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_a100_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_a100_count_limit" + """ gpu_virtual_a100_count_usage: Optional[int] = None - """Virtual A100 GPU card count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_a100_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_a100_count_usage" + """ gpu_virtual_h100_count_limit: Optional[int] = None - """Virtual H100 GPU card count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_h100_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_h100_count_limit" + """ gpu_virtual_h100_count_usage: Optional[int] = None - """Virtual H100 GPU card count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_h100_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_h100_count_usage" + """ gpu_virtual_l40s_count_limit: Optional[int] = None - """Virtual L40S GPU card count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_l40s_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_l40s_count_limit" + """ gpu_virtual_l40s_count_usage: Optional[int] = None - """Virtual L40S GPU card count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_l40s_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_l40s_count_usage" + """ image_count_limit: Optional[int] = None - """Images Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/image_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.image_count_limit" + """ image_count_usage: Optional[int] = None - """Images Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/image_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.image_count_usage" + """ image_size_limit: Optional[int] = None - """Images Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/image_size_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.image_size_limit" + """ image_size_usage: Optional[int] = None - """Images Size, GiB usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/image_size_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.image_size_usage" + """ ipu_count_limit: Optional[int] = None - """IPU Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/ipu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.ipu_count_limit" + """ ipu_count_usage: Optional[int] = None - """IPU Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/ipu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.ipu_count_usage" + """ laas_topic_count_limit: Optional[int] = None - """LaaS Topics Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/laas_topic_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.laas_topic_count_limit" + """ laas_topic_count_usage: Optional[int] = None - """LaaS Topics Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/laas_topic_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.laas_topic_count_usage" + """ loadbalancer_count_limit: Optional[int] = None - """Load Balancers Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/loadbalancer_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.loadbalancer_count_limit" + """ loadbalancer_count_usage: Optional[int] = None - """Load Balancers Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/loadbalancer_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.loadbalancer_count_usage" + """ network_count_limit: Optional[int] = None - """Networks Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/network_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.network_count_limit" + """ network_count_usage: Optional[int] = None - """Networks Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/network_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.network_count_usage" + """ ram_limit: Optional[int] = None - """RAM Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/ram_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.ram_limit" + """ ram_usage: Optional[int] = None - """RAM Size, GiB usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/ram_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.ram_usage" + """ region_id: Optional[int] = None - """Region ID""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/region_id' + "$.components.schemas.RegionalQuotasSerializer.properties.region_id" + """ registry_count_limit: Optional[int] = None - """Registries count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/registry_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.registry_count_limit" + """ registry_count_usage: Optional[int] = None - """Registries count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/registry_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.registry_count_usage" + """ registry_storage_limit: Optional[int] = None - """Registries volume usage, GiB limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/registry_storage_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.registry_storage_limit" + """ registry_storage_usage: Optional[int] = None - """Registries volume usage, GiB usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/registry_storage_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.registry_storage_usage" + """ router_count_limit: Optional[int] = None - """Routers Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/router_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.router_count_limit" + """ router_count_usage: Optional[int] = None - """Routers Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/router_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.router_count_usage" + """ secret_count_limit: Optional[int] = None - """Secret Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/secret_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.secret_count_limit" + """ secret_count_usage: Optional[int] = None - """Secret Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/secret_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.secret_count_usage" + """ servergroup_count_limit: Optional[int] = None - """Placement Group Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/servergroup_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.servergroup_count_limit" + """ servergroup_count_usage: Optional[int] = None - """Placement Group Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/servergroup_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.servergroup_count_usage" + """ sfs_count_limit: Optional[int] = None - """Shared file system Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/sfs_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.sfs_count_limit" + """ sfs_count_usage: Optional[int] = None - """Shared file system Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/sfs_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.sfs_count_usage" + """ sfs_size_limit: Optional[int] = None - """Shared file system Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/sfs_size_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.sfs_size_limit" + """ sfs_size_usage: Optional[int] = None - """Shared file system Size, GiB usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/sfs_size_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.sfs_size_usage" + """ shared_vm_count_limit: Optional[int] = None - """Basic VMs Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/shared_vm_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.shared_vm_count_limit" + """ shared_vm_count_usage: Optional[int] = None - """Basic VMs Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/shared_vm_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.shared_vm_count_usage" + """ snapshot_schedule_count_limit: Optional[int] = None - """Snapshot Schedules Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/snapshot_schedule_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.snapshot_schedule_count_limit" + """ snapshot_schedule_count_usage: Optional[int] = None - """Snapshot Schedules Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/snapshot_schedule_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.snapshot_schedule_count_usage" + """ subnet_count_limit: Optional[int] = None - """Subnets Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/subnet_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.subnet_count_limit" + """ subnet_count_usage: Optional[int] = None - """Subnets Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/subnet_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.subnet_count_usage" + """ vm_count_limit: Optional[int] = None - """Instances Dedicated Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/vm_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.vm_count_limit" + """ vm_count_usage: Optional[int] = None - """Instances Dedicated Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/vm_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.vm_count_usage" + """ volume_count_limit: Optional[int] = None - """Volumes Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_count_limit" + """ volume_count_usage: Optional[int] = None - """Volumes Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_count_usage" + """ volume_size_limit: Optional[int] = None - """Volumes Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_size_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_size_limit" + """ volume_size_usage: Optional[int] = None - """Volumes Size, GiB usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_size_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_size_usage" + """ volume_snapshots_count_limit: Optional[int] = None - """Snapshots Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_count_limit" + """ volume_snapshots_count_usage: Optional[int] = None - """Snapshots Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_count_usage" + """ volume_snapshots_size_limit: Optional[int] = None - """Snapshots Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_size_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_size_limit" + """ volume_snapshots_size_usage: Optional[int] = None - """Snapshots Size, GiB usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_size_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_size_usage" + """ class QuotaGetAllResponse(BaseModel): global_quotas: Optional[GlobalQuotas] = None - """Global entity quotas""" + """ + '#/components/schemas/AllClientQuotasSerializer/properties/global_quotas' + "$.components.schemas.AllClientQuotasSerializer.properties.global_quotas" + """ regional_quotas: Optional[List[RegionalQuota]] = None - """Regional entity quotas. Only contains initialized quotas.""" + """ + '#/components/schemas/AllClientQuotasSerializer/properties/regional_quotas' + "$.components.schemas.AllClientQuotasSerializer.properties.regional_quotas" + """ diff --git a/src/gcore/types/cloud/quota_get_by_region_response.py b/src/gcore/types/cloud/quota_get_by_region_response.py index f34fa83c..a523b610 100644 --- a/src/gcore/types/cloud/quota_get_by_region_response.py +++ b/src/gcore/types/cloud/quota_get_by_region_response.py @@ -9,280 +9,559 @@ class QuotaGetByRegionResponse(BaseModel): baremetal_basic_count_limit: Optional[int] = None - """Basic bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_basic_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_basic_count_limit" + """ baremetal_basic_count_usage: Optional[int] = None - """Basic bare metal servers count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_basic_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_basic_count_usage" + """ baremetal_gpu_count_limit: Optional[int] = None - """AI GPU bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_gpu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_gpu_count_limit" + """ baremetal_gpu_count_usage: Optional[int] = None - """AI GPU bare metal servers count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_gpu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_gpu_count_usage" + """ baremetal_hf_count_limit: Optional[int] = None - """High-frequency bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_hf_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_hf_count_limit" + """ baremetal_hf_count_usage: Optional[int] = None - """High-frequency bare metal servers count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_hf_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_hf_count_usage" + """ baremetal_infrastructure_count_limit: Optional[int] = None - """Infrastructure bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_infrastructure_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_infrastructure_count_limit" + """ baremetal_infrastructure_count_usage: Optional[int] = None - """Infrastructure bare metal servers count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_infrastructure_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_infrastructure_count_usage" + """ baremetal_network_count_limit: Optional[int] = None - """Bare metal Network Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_network_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_network_count_limit" + """ baremetal_network_count_usage: Optional[int] = None - """Bare metal Network Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_network_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_network_count_usage" + """ baremetal_storage_count_limit: Optional[int] = None - """Storage bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_storage_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_storage_count_limit" + """ baremetal_storage_count_usage: Optional[int] = None - """Storage bare metal servers count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_storage_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_storage_count_usage" + """ caas_container_count_limit: Optional[int] = None - """Containers count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_container_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_container_count_limit" + """ caas_container_count_usage: Optional[int] = None - """Containers count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_container_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_container_count_usage" + """ caas_cpu_count_limit: Optional[int] = None - """mCPU count for containers limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_cpu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_cpu_count_limit" + """ caas_cpu_count_usage: Optional[int] = None - """mCPU count for containers usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_cpu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_cpu_count_usage" + """ caas_gpu_count_limit: Optional[int] = None - """Containers gpu count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_gpu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_gpu_count_limit" + """ caas_gpu_count_usage: Optional[int] = None - """Containers gpu count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_gpu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_gpu_count_usage" + """ caas_ram_size_limit: Optional[int] = None - """MB memory count for containers limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_ram_size_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_ram_size_limit" + """ caas_ram_size_usage: Optional[int] = None - """MB memory count for containers usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/caas_ram_size_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.caas_ram_size_usage" + """ cluster_count_limit: Optional[int] = None - """K8s clusters count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/cluster_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.cluster_count_limit" + """ cluster_count_usage: Optional[int] = None - """K8s clusters count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/cluster_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.cluster_count_usage" + """ cpu_count_limit: Optional[int] = None - """vCPU Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/cpu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.cpu_count_limit" + """ cpu_count_usage: Optional[int] = None - """vCPU Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/cpu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.cpu_count_usage" + """ dbaas_postgres_cluster_count_limit: Optional[int] = None - """DBaaS cluster count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/dbaas_postgres_cluster_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.dbaas_postgres_cluster_count_limit" + """ dbaas_postgres_cluster_count_usage: Optional[int] = None - """DBaaS cluster count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/dbaas_postgres_cluster_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.dbaas_postgres_cluster_count_usage" + """ external_ip_count_limit: Optional[int] = None - """External IP Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/external_ip_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.external_ip_count_limit" + """ external_ip_count_usage: Optional[int] = None - """External IP Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/external_ip_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.external_ip_count_usage" + """ faas_cpu_count_limit: Optional[int] = None - """mCPU count for functions limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_cpu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_cpu_count_limit" + """ faas_cpu_count_usage: Optional[int] = None - """mCPU count for functions usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_cpu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_cpu_count_usage" + """ faas_function_count_limit: Optional[int] = None - """Functions count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_function_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_function_count_limit" + """ faas_function_count_usage: Optional[int] = None - """Functions count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_function_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_function_count_usage" + """ faas_namespace_count_limit: Optional[int] = None - """Functions namespace count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_namespace_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_namespace_count_limit" + """ faas_namespace_count_usage: Optional[int] = None - """Functions namespace count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_namespace_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_namespace_count_usage" + """ faas_ram_size_limit: Optional[int] = None - """MB memory count for functions limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_ram_size_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_ram_size_limit" + """ faas_ram_size_usage: Optional[int] = None - """MB memory count for functions usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/faas_ram_size_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.faas_ram_size_usage" + """ firewall_count_limit: Optional[int] = None - """Firewalls Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/firewall_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.firewall_count_limit" + """ firewall_count_usage: Optional[int] = None - """Firewalls Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/firewall_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.firewall_count_usage" + """ floating_count_limit: Optional[int] = None - """Floating IP Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/floating_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.floating_count_limit" + """ floating_count_usage: Optional[int] = None - """Floating IP Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/floating_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.floating_count_usage" + """ gpu_count_limit: Optional[int] = None - """GPU Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_count_limit" + """ gpu_count_usage: Optional[int] = None - """GPU Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_count_usage" + """ gpu_virtual_a100_count_limit: Optional[int] = None - """Virtual A100 GPU card count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_a100_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_a100_count_limit" + """ gpu_virtual_a100_count_usage: Optional[int] = None - """Virtual A100 GPU card count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_a100_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_a100_count_usage" + """ gpu_virtual_h100_count_limit: Optional[int] = None - """Virtual H100 GPU card count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_h100_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_h100_count_limit" + """ gpu_virtual_h100_count_usage: Optional[int] = None - """Virtual H100 GPU card count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_h100_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_h100_count_usage" + """ gpu_virtual_l40s_count_limit: Optional[int] = None - """Virtual L40S GPU card count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_l40s_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_l40s_count_limit" + """ gpu_virtual_l40s_count_usage: Optional[int] = None - """Virtual L40S GPU card count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_l40s_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_l40s_count_usage" + """ image_count_limit: Optional[int] = None - """Images Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/image_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.image_count_limit" + """ image_count_usage: Optional[int] = None - """Images Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/image_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.image_count_usage" + """ image_size_limit: Optional[int] = None - """Images Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/image_size_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.image_size_limit" + """ image_size_usage: Optional[int] = None - """Images Size, GiB usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/image_size_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.image_size_usage" + """ ipu_count_limit: Optional[int] = None - """IPU Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/ipu_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.ipu_count_limit" + """ ipu_count_usage: Optional[int] = None - """IPU Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/ipu_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.ipu_count_usage" + """ laas_topic_count_limit: Optional[int] = None - """LaaS Topics Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/laas_topic_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.laas_topic_count_limit" + """ laas_topic_count_usage: Optional[int] = None - """LaaS Topics Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/laas_topic_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.laas_topic_count_usage" + """ loadbalancer_count_limit: Optional[int] = None - """Load Balancers Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/loadbalancer_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.loadbalancer_count_limit" + """ loadbalancer_count_usage: Optional[int] = None - """Load Balancers Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/loadbalancer_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.loadbalancer_count_usage" + """ network_count_limit: Optional[int] = None - """Networks Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/network_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.network_count_limit" + """ network_count_usage: Optional[int] = None - """Networks Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/network_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.network_count_usage" + """ ram_limit: Optional[int] = None - """RAM Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/ram_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.ram_limit" + """ ram_usage: Optional[int] = None - """RAM Size, GiB usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/ram_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.ram_usage" + """ region_id: Optional[int] = None - """Region ID""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/region_id' + "$.components.schemas.RegionalQuotasSerializer.properties.region_id" + """ registry_count_limit: Optional[int] = None - """Registries count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/registry_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.registry_count_limit" + """ registry_count_usage: Optional[int] = None - """Registries count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/registry_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.registry_count_usage" + """ registry_storage_limit: Optional[int] = None - """Registries volume usage, GiB limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/registry_storage_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.registry_storage_limit" + """ registry_storage_usage: Optional[int] = None - """Registries volume usage, GiB usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/registry_storage_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.registry_storage_usage" + """ router_count_limit: Optional[int] = None - """Routers Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/router_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.router_count_limit" + """ router_count_usage: Optional[int] = None - """Routers Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/router_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.router_count_usage" + """ secret_count_limit: Optional[int] = None - """Secret Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/secret_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.secret_count_limit" + """ secret_count_usage: Optional[int] = None - """Secret Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/secret_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.secret_count_usage" + """ servergroup_count_limit: Optional[int] = None - """Placement Group Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/servergroup_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.servergroup_count_limit" + """ servergroup_count_usage: Optional[int] = None - """Placement Group Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/servergroup_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.servergroup_count_usage" + """ sfs_count_limit: Optional[int] = None - """Shared file system Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/sfs_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.sfs_count_limit" + """ sfs_count_usage: Optional[int] = None - """Shared file system Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/sfs_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.sfs_count_usage" + """ sfs_size_limit: Optional[int] = None - """Shared file system Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/sfs_size_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.sfs_size_limit" + """ sfs_size_usage: Optional[int] = None - """Shared file system Size, GiB usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/sfs_size_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.sfs_size_usage" + """ shared_vm_count_limit: Optional[int] = None - """Basic VMs Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/shared_vm_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.shared_vm_count_limit" + """ shared_vm_count_usage: Optional[int] = None - """Basic VMs Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/shared_vm_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.shared_vm_count_usage" + """ snapshot_schedule_count_limit: Optional[int] = None - """Snapshot Schedules Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/snapshot_schedule_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.snapshot_schedule_count_limit" + """ snapshot_schedule_count_usage: Optional[int] = None - """Snapshot Schedules Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/snapshot_schedule_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.snapshot_schedule_count_usage" + """ subnet_count_limit: Optional[int] = None - """Subnets Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/subnet_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.subnet_count_limit" + """ subnet_count_usage: Optional[int] = None - """Subnets Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/subnet_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.subnet_count_usage" + """ vm_count_limit: Optional[int] = None - """Instances Dedicated Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/vm_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.vm_count_limit" + """ vm_count_usage: Optional[int] = None - """Instances Dedicated Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/vm_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.vm_count_usage" + """ volume_count_limit: Optional[int] = None - """Volumes Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_count_limit" + """ volume_count_usage: Optional[int] = None - """Volumes Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_count_usage" + """ volume_size_limit: Optional[int] = None - """Volumes Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_size_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_size_limit" + """ volume_size_usage: Optional[int] = None - """Volumes Size, GiB usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_size_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_size_usage" + """ volume_snapshots_count_limit: Optional[int] = None - """Snapshots Count limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_count_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_count_limit" + """ volume_snapshots_count_usage: Optional[int] = None - """Snapshots Count usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_count_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_count_usage" + """ volume_snapshots_size_limit: Optional[int] = None - """Snapshots Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_size_limit' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_size_limit" + """ volume_snapshots_size_usage: Optional[int] = None - """Snapshots Size, GiB usage""" + """ + '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_size_usage' + "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_size_usage" + """ diff --git a/src/gcore/types/cloud/quota_get_global_response.py b/src/gcore/types/cloud/quota_get_global_response.py index 39773e14..02b4b236 100644 --- a/src/gcore/types/cloud/quota_get_global_response.py +++ b/src/gcore/types/cloud/quota_get_global_response.py @@ -9,43 +9,85 @@ class QuotaGetGlobalResponse(BaseModel): inference_cpu_millicore_count_limit: Optional[int] = None - """Inference CPU millicore count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_cpu_millicore_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_cpu_millicore_count_limit" + """ inference_cpu_millicore_count_usage: Optional[int] = None - """Inference CPU millicore count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_cpu_millicore_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_cpu_millicore_count_usage" + """ inference_gpu_a100_count_limit: Optional[int] = None - """Inference GPU A100 Count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_a100_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_a100_count_limit" + """ inference_gpu_a100_count_usage: Optional[int] = None - """Inference GPU A100 Count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_a100_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_a100_count_usage" + """ inference_gpu_h100_count_limit: Optional[int] = None - """Inference GPU H100 Count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_h100_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_h100_count_limit" + """ inference_gpu_h100_count_usage: Optional[int] = None - """Inference GPU H100 Count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_h100_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_h100_count_usage" + """ inference_gpu_l40s_count_limit: Optional[int] = None - """Inference GPU L40s Count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_l40s_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_l40s_count_limit" + """ inference_gpu_l40s_count_usage: Optional[int] = None - """Inference GPU L40s Count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_l40s_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_l40s_count_usage" + """ inference_instance_count_limit: Optional[int] = None - """Inference instance count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_instance_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_instance_count_limit" + """ inference_instance_count_usage: Optional[int] = None - """Inference instance count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/inference_instance_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.inference_instance_count_usage" + """ keypair_count_limit: Optional[int] = None - """SSH Keys Count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/keypair_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.keypair_count_limit" + """ keypair_count_usage: Optional[int] = None - """SSH Keys Count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/keypair_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.keypair_count_usage" + """ project_count_limit: Optional[int] = None - """Projects Count limit""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/project_count_limit' + "$.components.schemas.GlobalQuotasSerializer.properties.project_count_limit" + """ project_count_usage: Optional[int] = None - """Projects Count usage""" + """ + '#/components/schemas/GlobalQuotasSerializer/properties/project_count_usage' + "$.components.schemas.GlobalQuotasSerializer.properties.project_count_usage" + """ diff --git a/src/gcore/types/cloud/quotas/request_create_params.py b/src/gcore/types/cloud/quotas/request_create_params.py index 1a7ac333..8599dc94 100644 --- a/src/gcore/types/cloud/quotas/request_create_params.py +++ b/src/gcore/types/cloud/quotas/request_create_params.py @@ -10,184 +10,361 @@ class RequestCreateParams(TypedDict, total=False): description: Required[str] - """Describe the reason, in general terms.""" + """ + '#/components/schemas/LimitsRequestCreateSerializer/properties/description' + "$.components.schemas.LimitsRequestCreateSerializer.properties.description" + """ requested_limits: Required[RequestedLimits] - """Limits you want to increase.""" + """ + '#/components/schemas/LimitsRequestCreateSerializer/properties/requested_limits' + "$.components.schemas.LimitsRequestCreateSerializer.properties.requested_limits" + """ client_id: int - """Client ID that requests the limit increase.""" + """ + '#/components/schemas/LimitsRequestCreateSerializer/properties/client_id' + "$.components.schemas.LimitsRequestCreateSerializer.properties.client_id" + """ class RequestedLimitsGlobalLimits(TypedDict, total=False): inference_cpu_millicore_count_limit: int - """Inference CPU millicore count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_cpu_millicore_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_cpu_millicore_count_limit" + """ inference_gpu_a100_count_limit: int - """Inference GPU A100 Count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_a100_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_a100_count_limit" + """ inference_gpu_h100_count_limit: int - """Inference GPU H100 Count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_h100_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_h100_count_limit" + """ inference_gpu_l40s_count_limit: int - """Inference GPU L40s Count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_l40s_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_l40s_count_limit" + """ inference_instance_count_limit: int - """Inference instance count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_instance_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_instance_count_limit" + """ keypair_count_limit: int - """SSH Keys Count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/keypair_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.keypair_count_limit" + """ project_count_limit: int - """Projects Count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/project_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.project_count_limit" + """ class RequestedLimitsRegionalLimit(TypedDict, total=False): baremetal_basic_count_limit: int - """Basic bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_basic_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_basic_count_limit" + """ baremetal_gpu_count_limit: int - """AI GPU bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_gpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_gpu_count_limit" + """ baremetal_hf_count_limit: int - """High-frequency bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_hf_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_hf_count_limit" + """ baremetal_infrastructure_count_limit: int - """Infrastructure bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_infrastructure_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_infrastructure_count_limit" + """ baremetal_network_count_limit: int - """Bare metal Network Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_network_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_network_count_limit" + """ baremetal_storage_count_limit: int - """Storage bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_storage_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_storage_count_limit" + """ caas_container_count_limit: int - """Containers count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_container_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_container_count_limit" + """ caas_cpu_count_limit: int - """mCPU count for containers limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_cpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_cpu_count_limit" + """ caas_gpu_count_limit: int - """Containers gpu count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_gpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_gpu_count_limit" + """ caas_ram_size_limit: int - """MB memory count for containers limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_ram_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_ram_size_limit" + """ cluster_count_limit: int - """K8s clusters count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cluster_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cluster_count_limit" + """ cpu_count_limit: int - """vCPU Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cpu_count_limit" + """ dbaas_postgres_cluster_count_limit: int - """DBaaS cluster count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/dbaas_postgres_cluster_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.dbaas_postgres_cluster_count_limit" + """ external_ip_count_limit: int - """External IP Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/external_ip_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.external_ip_count_limit" + """ faas_cpu_count_limit: int - """mCPU count for functions limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_cpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_cpu_count_limit" + """ faas_function_count_limit: int - """Functions count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_function_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_function_count_limit" + """ faas_namespace_count_limit: int - """Functions namespace count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_namespace_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_namespace_count_limit" + """ faas_ram_size_limit: int - """MB memory count for functions limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_ram_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_ram_size_limit" + """ firewall_count_limit: int - """Firewalls Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/firewall_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.firewall_count_limit" + """ floating_count_limit: int - """Floating IP Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/floating_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.floating_count_limit" + """ gpu_count_limit: int - """GPU Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_count_limit" + """ gpu_virtual_a100_count_limit: int - """Virtual A100 GPU card count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_a100_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_a100_count_limit" + """ gpu_virtual_h100_count_limit: int - """Virtual H100 GPU card count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_h100_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_h100_count_limit" + """ gpu_virtual_l40s_count_limit: int - """Virtual L40S GPU card count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_l40s_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_l40s_count_limit" + """ image_count_limit: int - """Images Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_count_limit" + """ image_size_limit: int - """Images Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_size_limit" + """ ipu_count_limit: int - """IPU Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ipu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ipu_count_limit" + """ laas_topic_count_limit: int - """LaaS Topics Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/laas_topic_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.laas_topic_count_limit" + """ loadbalancer_count_limit: int - """Load Balancers Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/loadbalancer_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.loadbalancer_count_limit" + """ network_count_limit: int - """Networks Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/network_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.network_count_limit" + """ ram_limit: int - """RAM Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ram_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ram_limit" + """ region_id: int - """Region ID""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/region_id' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.region_id" + """ registry_count_limit: int - """Registries count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_count_limit" + """ registry_storage_limit: int - """Registries volume usage, GiB limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_storage_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_storage_limit" + """ router_count_limit: int - """Routers Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/router_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.router_count_limit" + """ secret_count_limit: int - """Secret Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/secret_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.secret_count_limit" + """ servergroup_count_limit: int - """Placement Group Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/servergroup_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.servergroup_count_limit" + """ sfs_count_limit: int - """Shared file system Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_count_limit" + """ sfs_size_limit: int - """Shared file system Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_size_limit" + """ shared_vm_count_limit: int - """Basic VMs Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/shared_vm_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.shared_vm_count_limit" + """ snapshot_schedule_count_limit: int - """Snapshot Schedules Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/snapshot_schedule_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.snapshot_schedule_count_limit" + """ subnet_count_limit: int - """Subnets Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/subnet_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.subnet_count_limit" + """ vm_count_limit: int - """Instances Dedicated Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/vm_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.vm_count_limit" + """ volume_count_limit: int - """Volumes Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_count_limit" + """ volume_size_limit: int - """Volumes Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_size_limit" + """ volume_snapshots_count_limit: int - """Snapshots Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_count_limit" + """ volume_snapshots_size_limit: int - """Snapshots Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_size_limit" + """ class RequestedLimits(TypedDict, total=False): global_limits: RequestedLimitsGlobalLimits - """Global entity quota limits""" + """ + '#/components/schemas/ClientMixedQuotasLimitsSerializer/properties/global_limits' + "$.components.schemas.ClientMixedQuotasLimitsSerializer.properties.global_limits" + """ regional_limits: Iterable[RequestedLimitsRegionalLimit] - """Regions and their quota limits""" + """ + '#/components/schemas/ClientMixedQuotasLimitsSerializer/properties/regional_limits' + "$.components.schemas.ClientMixedQuotasLimitsSerializer.properties.regional_limits" + """ diff --git a/src/gcore/types/cloud/quotas/request_get_response.py b/src/gcore/types/cloud/quotas/request_get_response.py index d01ceddc..3a85f8fb 100644 --- a/src/gcore/types/cloud/quotas/request_get_response.py +++ b/src/gcore/types/cloud/quotas/request_get_response.py @@ -10,196 +10,385 @@ class RequestedLimitsGlobalLimits(BaseModel): inference_cpu_millicore_count_limit: Optional[int] = None - """Inference CPU millicore count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_cpu_millicore_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_cpu_millicore_count_limit" + """ inference_gpu_a100_count_limit: Optional[int] = None - """Inference GPU A100 Count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_a100_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_a100_count_limit" + """ inference_gpu_h100_count_limit: Optional[int] = None - """Inference GPU H100 Count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_h100_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_h100_count_limit" + """ inference_gpu_l40s_count_limit: Optional[int] = None - """Inference GPU L40s Count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_l40s_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_l40s_count_limit" + """ inference_instance_count_limit: Optional[int] = None - """Inference instance count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_instance_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_instance_count_limit" + """ keypair_count_limit: Optional[int] = None - """SSH Keys Count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/keypair_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.keypair_count_limit" + """ project_count_limit: Optional[int] = None - """Projects Count limit""" + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/project_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.project_count_limit" + """ class RequestedLimitsRegionalLimit(BaseModel): baremetal_basic_count_limit: Optional[int] = None - """Basic bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_basic_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_basic_count_limit" + """ baremetal_gpu_count_limit: Optional[int] = None - """AI GPU bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_gpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_gpu_count_limit" + """ baremetal_hf_count_limit: Optional[int] = None - """High-frequency bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_hf_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_hf_count_limit" + """ baremetal_infrastructure_count_limit: Optional[int] = None - """Infrastructure bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_infrastructure_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_infrastructure_count_limit" + """ baremetal_network_count_limit: Optional[int] = None - """Bare metal Network Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_network_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_network_count_limit" + """ baremetal_storage_count_limit: Optional[int] = None - """Storage bare metal servers count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_storage_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_storage_count_limit" + """ caas_container_count_limit: Optional[int] = None - """Containers count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_container_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_container_count_limit" + """ caas_cpu_count_limit: Optional[int] = None - """mCPU count for containers limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_cpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_cpu_count_limit" + """ caas_gpu_count_limit: Optional[int] = None - """Containers gpu count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_gpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_gpu_count_limit" + """ caas_ram_size_limit: Optional[int] = None - """MB memory count for containers limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_ram_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_ram_size_limit" + """ cluster_count_limit: Optional[int] = None - """K8s clusters count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cluster_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cluster_count_limit" + """ cpu_count_limit: Optional[int] = None - """vCPU Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cpu_count_limit" + """ dbaas_postgres_cluster_count_limit: Optional[int] = None - """DBaaS cluster count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/dbaas_postgres_cluster_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.dbaas_postgres_cluster_count_limit" + """ external_ip_count_limit: Optional[int] = None - """External IP Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/external_ip_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.external_ip_count_limit" + """ faas_cpu_count_limit: Optional[int] = None - """mCPU count for functions limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_cpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_cpu_count_limit" + """ faas_function_count_limit: Optional[int] = None - """Functions count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_function_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_function_count_limit" + """ faas_namespace_count_limit: Optional[int] = None - """Functions namespace count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_namespace_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_namespace_count_limit" + """ faas_ram_size_limit: Optional[int] = None - """MB memory count for functions limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_ram_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_ram_size_limit" + """ firewall_count_limit: Optional[int] = None - """Firewalls Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/firewall_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.firewall_count_limit" + """ floating_count_limit: Optional[int] = None - """Floating IP Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/floating_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.floating_count_limit" + """ gpu_count_limit: Optional[int] = None - """GPU Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_count_limit" + """ gpu_virtual_a100_count_limit: Optional[int] = None - """Virtual A100 GPU card count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_a100_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_a100_count_limit" + """ gpu_virtual_h100_count_limit: Optional[int] = None - """Virtual H100 GPU card count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_h100_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_h100_count_limit" + """ gpu_virtual_l40s_count_limit: Optional[int] = None - """Virtual L40S GPU card count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_l40s_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_l40s_count_limit" + """ image_count_limit: Optional[int] = None - """Images Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_count_limit" + """ image_size_limit: Optional[int] = None - """Images Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_size_limit" + """ ipu_count_limit: Optional[int] = None - """IPU Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ipu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ipu_count_limit" + """ laas_topic_count_limit: Optional[int] = None - """LaaS Topics Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/laas_topic_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.laas_topic_count_limit" + """ loadbalancer_count_limit: Optional[int] = None - """Load Balancers Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/loadbalancer_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.loadbalancer_count_limit" + """ network_count_limit: Optional[int] = None - """Networks Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/network_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.network_count_limit" + """ ram_limit: Optional[int] = None - """RAM Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ram_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ram_limit" + """ region_id: Optional[int] = None - """Region ID""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/region_id' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.region_id" + """ registry_count_limit: Optional[int] = None - """Registries count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_count_limit" + """ registry_storage_limit: Optional[int] = None - """Registries volume usage, GiB limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_storage_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_storage_limit" + """ router_count_limit: Optional[int] = None - """Routers Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/router_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.router_count_limit" + """ secret_count_limit: Optional[int] = None - """Secret Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/secret_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.secret_count_limit" + """ servergroup_count_limit: Optional[int] = None - """Placement Group Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/servergroup_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.servergroup_count_limit" + """ sfs_count_limit: Optional[int] = None - """Shared file system Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_count_limit" + """ sfs_size_limit: Optional[int] = None - """Shared file system Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_size_limit" + """ shared_vm_count_limit: Optional[int] = None - """Basic VMs Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/shared_vm_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.shared_vm_count_limit" + """ snapshot_schedule_count_limit: Optional[int] = None - """Snapshot Schedules Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/snapshot_schedule_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.snapshot_schedule_count_limit" + """ subnet_count_limit: Optional[int] = None - """Subnets Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/subnet_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.subnet_count_limit" + """ vm_count_limit: Optional[int] = None - """Instances Dedicated Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/vm_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.vm_count_limit" + """ volume_count_limit: Optional[int] = None - """Volumes Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_count_limit" + """ volume_size_limit: Optional[int] = None - """Volumes Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_size_limit" + """ volume_snapshots_count_limit: Optional[int] = None - """Snapshots Count limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_count_limit" + """ volume_snapshots_size_limit: Optional[int] = None - """Snapshots Size, GiB limit""" + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_size_limit" + """ class RequestedLimits(BaseModel): global_limits: Optional[RequestedLimitsGlobalLimits] = None - """Global entity quota limits""" + """ + '#/components/schemas/AllClientQuotasLimitsSerializer/properties/global_limits' + "$.components.schemas.AllClientQuotasLimitsSerializer.properties.global_limits" + """ regional_limits: Optional[List[RequestedLimitsRegionalLimit]] = None - """Regions and their quota limits""" + """ + '#/components/schemas/AllClientQuotasLimitsSerializer/properties/regional_limits' + "$.components.schemas.AllClientQuotasLimitsSerializer.properties.regional_limits" + """ class RequestGetResponse(BaseModel): id: int - """Request ID""" + """ + '#/components/schemas/LimitsRequestSerializer/properties/id' + "$.components.schemas.LimitsRequestSerializer.properties.id" + """ client_id: int - """Client ID""" + """ + '#/components/schemas/LimitsRequestSerializer/properties/client_id' + "$.components.schemas.LimitsRequestSerializer.properties.client_id" + """ requested_limits: RequestedLimits - """Requested limits.""" + """ + '#/components/schemas/LimitsRequestSerializer/properties/requested_limits' + "$.components.schemas.LimitsRequestSerializer.properties.requested_limits" + """ status: str - """Request status""" + """ + '#/components/schemas/LimitsRequestSerializer/properties/status' + "$.components.schemas.LimitsRequestSerializer.properties.status" + """ created_at: Optional[datetime] = None - """Datetime when the request was created.""" + """ + '#/components/schemas/LimitsRequestSerializer/properties/created_at' + "$.components.schemas.LimitsRequestSerializer.properties.created_at" + """ description: Optional[str] = None - """Describe the reason, in general terms.""" + """ + '#/components/schemas/LimitsRequestSerializer/properties/description/anyOf/0' + "$.components.schemas.LimitsRequestSerializer.properties.description.anyOf[0]" + """ updated_at: Optional[datetime] = None - """Datetime when the request was updated.""" + """ + '#/components/schemas/LimitsRequestSerializer/properties/updated_at/anyOf/0' + "$.components.schemas.LimitsRequestSerializer.properties.updated_at.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/quotas/request_list_params.py b/src/gcore/types/cloud/quotas/request_list_params.py index 556abaa1..6449b0ec 100644 --- a/src/gcore/types/cloud/quotas/request_list_params.py +++ b/src/gcore/types/cloud/quotas/request_list_params.py @@ -10,13 +10,19 @@ class RequestListParams(TypedDict, total=False): limit: int - """Optional. Limit the number of returned items""" + """ + '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/0' + "$.paths['/cloud/v2/limits_request'].get.parameters[0]" + """ offset: int - """Optional. - - Offset value is used to exclude the first set of records from the result + """ + '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/1' + "$.paths['/cloud/v2/limits_request'].get.parameters[1]" """ status: Optional[List[Literal["done", "in progress", "rejected"]]] - """List of limit requests statuses for filtering""" + """ + '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/2/schema/anyOf/0' + "$.paths['/cloud/v2/limits_request'].get.parameters[2].schema.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py index 343f0707..0b596685 100644 --- a/src/gcore/types/cloud/region.py +++ b/src/gcore/types/cloud/region.py @@ -11,91 +11,183 @@ class Coordinates(BaseModel): latitude: float + """ + '#/components/schemas/Coordinate/properties/latitude' + "$.components.schemas.Coordinate.properties.latitude" + """ longitude: float + """ + '#/components/schemas/Coordinate/properties/longitude' + "$.components.schemas.Coordinate.properties.longitude" + """ class Region(BaseModel): id: int - """Region ID""" + """ + '#/components/schemas/RegionSerializer/properties/id' + "$.components.schemas.RegionSerializer.properties.id" + """ access_level: Literal["core", "edge"] - """The access level of the region.""" + """ + '#/components/schemas/RegionSerializer/properties/access_level' + "$.components.schemas.RegionSerializer.properties.access_level" + """ ai_service_endpoint_id: Optional[int] = None - """AI service API endpoint ID""" + """ + '#/components/schemas/RegionSerializer/properties/ai_service_endpoint_id/anyOf/0' + "$.components.schemas.RegionSerializer.properties.ai_service_endpoint_id.anyOf[0]" + """ available_volume_types: Optional[List[str]] = None - """List of available volume types, 'standard', 'ssd_hiiops', 'cold'].""" + """ + '#/components/schemas/RegionSerializer/properties/available_volume_types/anyOf/0' + "$.components.schemas.RegionSerializer.properties.available_volume_types.anyOf[0]" + """ coordinates: Optional[Coordinates] = None - """Coordinates of the region""" + """ + '#/components/schemas/RegionSerializer/properties/coordinates/anyOf/0' + "$.components.schemas.RegionSerializer.properties.coordinates.anyOf[0]" + """ country: Optional[str] = None - """Country""" + """ + '#/components/schemas/RegionSerializer/properties/country/anyOf/0' + "$.components.schemas.RegionSerializer.properties.country.anyOf[0]" + """ created_at: datetime - """Region creation date and time""" + """ + '#/components/schemas/RegionSerializer/properties/created_at' + "$.components.schemas.RegionSerializer.properties.created_at" + """ created_on: datetime - """This field is deprecated. Use `created_at` instead.""" + """ + '#/components/schemas/RegionSerializer/properties/created_on' + "$.components.schemas.RegionSerializer.properties.created_on" + """ ddos_endpoint_id: Optional[int] = None - """DDoS endpoint ID""" + """ + '#/components/schemas/RegionSerializer/properties/ddos_endpoint_id/anyOf/0' + "$.components.schemas.RegionSerializer.properties.ddos_endpoint_id.anyOf[0]" + """ display_name: str - """Human-readable region name""" + """ + '#/components/schemas/RegionSerializer/properties/display_name' + "$.components.schemas.RegionSerializer.properties.display_name" + """ endpoint_type: Literal["admin", "internal", "public"] - """Endpoint type""" + """ + '#/components/schemas/RegionSerializer/properties/endpoint_type' + "$.components.schemas.RegionSerializer.properties.endpoint_type" + """ external_network_id: Optional[str] = None - """External network ID for Neutron""" + """ + '#/components/schemas/RegionSerializer/properties/external_network_id/anyOf/0' + "$.components.schemas.RegionSerializer.properties.external_network_id.anyOf[0]" + """ file_share_types: Optional[List[Literal["standard", "vast"]]] = None - """List of available file share types""" + """ + '#/components/schemas/RegionSerializer/properties/file_share_types/anyOf/0' + "$.components.schemas.RegionSerializer.properties.file_share_types.anyOf[0]" + """ has_ai: bool - """Region has AI capability""" + """ + '#/components/schemas/RegionSerializer/properties/has_ai' + "$.components.schemas.RegionSerializer.properties.has_ai" + """ has_ai_gpu: bool - """Region has AI GPU capability""" + """ + '#/components/schemas/RegionSerializer/properties/has_ai_gpu' + "$.components.schemas.RegionSerializer.properties.has_ai_gpu" + """ has_baremetal: bool - """Region has bare metal capability""" + """ + '#/components/schemas/RegionSerializer/properties/has_baremetal' + "$.components.schemas.RegionSerializer.properties.has_baremetal" + """ has_basic_vm: bool - """Region has basic vm capability""" + """ + '#/components/schemas/RegionSerializer/properties/has_basic_vm' + "$.components.schemas.RegionSerializer.properties.has_basic_vm" + """ has_k8s: bool - """Region has managed kubernetes capability""" + """ + '#/components/schemas/RegionSerializer/properties/has_k8s' + "$.components.schemas.RegionSerializer.properties.has_k8s" + """ has_kvm: bool - """Region has KVM virtualization capability""" + """ + '#/components/schemas/RegionSerializer/properties/has_kvm' + "$.components.schemas.RegionSerializer.properties.has_kvm" + """ has_sfs: bool - """Region has SFS capability""" + """ + '#/components/schemas/RegionSerializer/properties/has_sfs' + "$.components.schemas.RegionSerializer.properties.has_sfs" + """ keystone_id: int - """Foreign key to Keystone entity""" + """ + '#/components/schemas/RegionSerializer/properties/keystone_id' + "$.components.schemas.RegionSerializer.properties.keystone_id" + """ keystone_name: str - """Technical region name""" + """ + '#/components/schemas/RegionSerializer/properties/keystone_name' + "$.components.schemas.RegionSerializer.properties.keystone_name" + """ metrics_database_id: Optional[int] = None - """Foreign key to Metrics database entity""" + """ + '#/components/schemas/RegionSerializer/properties/metrics_database_id/anyOf/0' + "$.components.schemas.RegionSerializer.properties.metrics_database_id.anyOf[0]" + """ state: Literal["ACTIVE", "DELETED", "DELETING", "DELETION_FAILED", "INACTIVE", "MAINTENANCE", "NEW"] - """Region state""" + """ + '#/components/schemas/RegionSerializer/properties/state' + "$.components.schemas.RegionSerializer.properties.state" + """ task_id: Optional[str] = None - """This field is deprecated and can be ignored""" + """ + '#/components/schemas/RegionSerializer/properties/task_id/anyOf/0' + "$.components.schemas.RegionSerializer.properties.task_id.anyOf[0]" + """ vlan_physical_network: str - """Physical network name to create vlan networks""" + """ + '#/components/schemas/RegionSerializer/properties/vlan_physical_network' + "$.components.schemas.RegionSerializer.properties.vlan_physical_network" + """ zone: Optional[Literal["AMERICAS", "APAC", "EMEA", "RUSSIA_AND_CIS"]] = None - """Geographical zone""" + """ + '#/components/schemas/RegionSerializer/properties/zone/anyOf/0' + "$.components.schemas.RegionSerializer.properties.zone.anyOf[0]" + """ has_dbaas: Optional[bool] = None - """Region has DBAAS service""" + """ + '#/components/schemas/RegionSerializer/properties/has_dbaas' + "$.components.schemas.RegionSerializer.properties.has_dbaas" + """ diff --git a/src/gcore/types/cloud/region_list_params.py b/src/gcore/types/cloud/region_list_params.py index ac7b106b..ac68f5da 100644 --- a/src/gcore/types/cloud/region_list_params.py +++ b/src/gcore/types/cloud/region_list_params.py @@ -9,23 +9,31 @@ class RegionListParams(TypedDict, total=False): limit: int - """Limit the number of returned regions. - - Falls back to default of 100 if not specified. Limited by max limit value of - 1000 + """ + '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/0' + "$.paths['/cloud/v1/regions'].get.parameters[0]" """ offset: int - """Offset value is used to exclude the first set of records from the result""" + """ + '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/1' + "$.paths['/cloud/v1/regions'].get.parameters[1]" + """ order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] - """Order by field and direction.""" + """ + '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/2' + "$.paths['/cloud/v1/regions'].get.parameters[2]" + """ product: Literal["containers", "inference"] - """If defined then return only regions that support given product.""" + """ + '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/3' + "$.paths['/cloud/v1/regions'].get.parameters[3]" + """ show_volume_types: bool """ - If true, null `available_volume_type` is replaced with a list of available - volume types. + '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/4' + "$.paths['/cloud/v1/regions'].get.parameters[4]" """ diff --git a/src/gcore/types/cloud/region_retrieve_params.py b/src/gcore/types/cloud/region_retrieve_params.py index 6dd33927..e124ebea 100644 --- a/src/gcore/types/cloud/region_retrieve_params.py +++ b/src/gcore/types/cloud/region_retrieve_params.py @@ -9,10 +9,13 @@ class RegionRetrieveParams(TypedDict, total=False): region_id: int - """Region ID""" + """ + '#/paths/%2Fcloud%2Fv1%2Fregions%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/regions/{region_id}'].get.parameters[0].schema" + """ show_volume_types: bool """ - If true, null `available_volume_type` is replaced with a list of available - volume types. + '#/paths/%2Fcloud%2Fv1%2Fregions%2F%7Bregion_id%7D/get/parameters/1' + "$.paths['/cloud/v1/regions/{region_id}'].get.parameters[1]" """ diff --git a/src/gcore/types/cloud/secret.py b/src/gcore/types/cloud/secret.py index e7eb5015..d094db5c 100644 --- a/src/gcore/types/cloud/secret.py +++ b/src/gcore/types/cloud/secret.py @@ -11,54 +11,61 @@ class Secret(BaseModel): id: str - """Secret uuid""" + """ + '#/components/schemas/SecretSerializer/properties/id' + "$.components.schemas.SecretSerializer.properties.id" + """ name: str - """Secret name""" + """ + '#/components/schemas/SecretSerializer/properties/name' + "$.components.schemas.SecretSerializer.properties.name" + """ secret_type: Literal["certificate", "opaque", "passphrase", "private", "public", "symmetric"] - """Secret type, base64 encoded. - - symmetric - Used for storing byte arrays such as keys suitable for symmetric - encryption; public - Used for storing the public key of an asymmetric keypair; - private - Used for storing the private key of an asymmetric keypair; - passphrase - Used for storing plain text passphrases; certificate - Used for - storing cryptographic certificates such as X.509 certificates; opaque - Used for - backwards compatibility with previous versions of the API + """ + '#/components/schemas/SecretSerializer/properties/secret_type' + "$.components.schemas.SecretSerializer.properties.secret_type" """ status: str - """Status""" + """ + '#/components/schemas/SecretSerializer/properties/status' + "$.components.schemas.SecretSerializer.properties.status" + """ algorithm: Optional[str] = None - """Metadata provided by a user or system for informational purposes. - - Defaults to None + """ + '#/components/schemas/SecretSerializer/properties/algorithm/anyOf/0' + "$.components.schemas.SecretSerializer.properties.algorithm.anyOf[0]" """ bit_length: Optional[int] = None - """Metadata provided by a user or system for informational purposes. - - Value must be greater than zero. Defaults to None + """ + '#/components/schemas/SecretSerializer/properties/bit_length/anyOf/0' + "$.components.schemas.SecretSerializer.properties.bit_length.anyOf[0]" """ content_types: Optional[Dict[str, str]] = None - """Describes the content-types that can be used to retrieve the payload. - - The content-type used with symmetric secrets is application/octet-stream + """ + '#/components/schemas/SecretSerializer/properties/content_types/anyOf/0' + "$.components.schemas.SecretSerializer.properties.content_types.anyOf[0]" """ created: Optional[datetime] = None - """Datetime when the secret was created. The format is 2020-01-01T12:00:00+00:00""" + """ + '#/components/schemas/SecretSerializer/properties/created/anyOf/0' + "$.components.schemas.SecretSerializer.properties.created.anyOf[0]" + """ expiration: Optional[datetime] = None - """Datetime when the secret will expire. - - The format is 2020-01-01T12:00:00+00:00. Defaults to None + """ + '#/components/schemas/SecretSerializer/properties/expiration/anyOf/0' + "$.components.schemas.SecretSerializer.properties.expiration.anyOf[0]" """ mode: Optional[str] = None - """Metadata provided by a user or system for informational purposes. - - Defaults to None + """ + '#/components/schemas/SecretSerializer/properties/mode/anyOf/0' + "$.components.schemas.SecretSerializer.properties.mode.anyOf[0]" """ diff --git a/src/gcore/types/cloud/secret_create_params.py b/src/gcore/types/cloud/secret_create_params.py index 6b8d4e8f..b7916a1f 100644 --- a/src/gcore/types/cloud/secret_create_params.py +++ b/src/gcore/types/cloud/secret_create_params.py @@ -10,55 +10,67 @@ class SecretCreateParams(TypedDict, total=False): project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].post.parameters[0].schema" + """ region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].post.parameters[1].schema" + """ name: Required[str] - """Secret name""" + """ + '#/components/schemas/CreateSecretSerializer/properties/name' + "$.components.schemas.CreateSecretSerializer.properties.name" + """ payload: Required[str] - """Secret payload. - - For HTTPS-terminated load balancing, provide base64 encoded conents of a PKCS12 - file. The PKCS12 file is the combined TLS certificate, key, and intermediate - certificate chain obtained from an external certificate authority. The file can - be created via openssl, e.g.'openssl pkcs12 -export -inkey server.key -in - server.crt -certfile ca-chain.crt -passout pass: -out server.p12'The key and - certificate should be PEM-encoded, and the intermediate certificate chain should - be multiple PEM-encoded certs concatenated together + """ + '#/components/schemas/CreateSecretSerializer/properties/payload' + "$.components.schemas.CreateSecretSerializer.properties.payload" """ payload_content_encoding: Required[Literal["base64"]] - """The encoding used for the payload to be able to include it in the JSON request. - - Currently only base64 is supported + """ + '#/components/schemas/CreateSecretSerializer/properties/payload_content_encoding' + "$.components.schemas.CreateSecretSerializer.properties.payload_content_encoding" """ payload_content_type: Required[str] - """The media type for the content of the payload""" + """ + '#/components/schemas/CreateSecretSerializer/properties/payload_content_type' + "$.components.schemas.CreateSecretSerializer.properties.payload_content_type" + """ secret_type: Required[Literal["certificate", "opaque", "passphrase", "private", "public", "symmetric"]] - """Secret type. - - symmetric - Used for storing byte arrays such as keys suitable for symmetric - encryption; public - Used for storing the public key of an asymmetric keypair; - private - Used for storing the private key of an asymmetric keypair; - passphrase - Used for storing plain text passphrases; certificate - Used for - storing cryptographic certificates such as X.509 certificates; opaque - Used for - backwards compatibility with previous versions of the API + """ + '#/components/schemas/CreateSecretSerializer/properties/secret_type' + "$.components.schemas.CreateSecretSerializer.properties.secret_type" """ algorithm: Optional[str] - """Metadata provided by a user or system for informational purposes.""" + """ + '#/components/schemas/CreateSecretSerializer/properties/algorithm/anyOf/0' + "$.components.schemas.CreateSecretSerializer.properties.algorithm.anyOf[0]" + """ bit_length: Optional[int] - """Metadata provided by a user or system for informational purposes. - - Value must be greater than zero. + """ + '#/components/schemas/CreateSecretSerializer/properties/bit_length/anyOf/0' + "$.components.schemas.CreateSecretSerializer.properties.bit_length.anyOf[0]" """ expiration: Optional[str] - """Datetime when the secret will expire.""" + """ + '#/components/schemas/CreateSecretSerializer/properties/expiration/anyOf/0' + "$.components.schemas.CreateSecretSerializer.properties.expiration.anyOf[0]" + """ mode: Optional[str] - """Metadata provided by a user or system for informational purposes.""" + """ + '#/components/schemas/CreateSecretSerializer/properties/mode/anyOf/0' + "$.components.schemas.CreateSecretSerializer.properties.mode.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/secret_create_response.py b/src/gcore/types/cloud/secret_create_response.py index c6fec048..4bb8f0ce 100644 --- a/src/gcore/types/cloud/secret_create_response.py +++ b/src/gcore/types/cloud/secret_create_response.py @@ -9,4 +9,7 @@ class SecretCreateResponse(BaseModel): tasks: Optional[List[str]] = None - """Task list""" + """ + '#/components/schemas/TaskIdListSchema/properties/tasks' + "$.components.schemas.TaskIdListSchema.properties.tasks" + """ diff --git a/src/gcore/types/cloud/secret_delete_response.py b/src/gcore/types/cloud/secret_delete_response.py index 6af0c350..df1c429d 100644 --- a/src/gcore/types/cloud/secret_delete_response.py +++ b/src/gcore/types/cloud/secret_delete_response.py @@ -9,4 +9,7 @@ class SecretDeleteResponse(BaseModel): tasks: Optional[List[str]] = None - """Task list""" + """ + '#/components/schemas/TaskIdListSchema/properties/tasks' + "$.components.schemas.TaskIdListSchema.properties.tasks" + """ diff --git a/src/gcore/types/cloud/secret_list_response.py b/src/gcore/types/cloud/secret_list_response.py index b6680c6c..4016c3c3 100644 --- a/src/gcore/types/cloud/secret_list_response.py +++ b/src/gcore/types/cloud/secret_list_response.py @@ -10,7 +10,13 @@ class SecretListResponse(BaseModel): count: int - """Number of objects""" + """ + '#/components/schemas/SecretSerializerList/properties/count' + "$.components.schemas.SecretSerializerList.properties.count" + """ results: List[Secret] - """Objects""" + """ + '#/components/schemas/SecretSerializerList/properties/results' + "$.components.schemas.SecretSerializerList.properties.results" + """ 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 4f394524..f8169cbc 100644 --- a/src/gcore/types/cloud/secret_upload_tls_certificate_params.py +++ b/src/gcore/types/cloud/secret_upload_tls_certificate_params.py @@ -13,25 +13,51 @@ class SecretUploadTlsCertificateParams(TypedDict, total=False): project_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v2/secrets/{project_id}/{region_id}'].post.parameters[0].schema" + """ region_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v2/secrets/{project_id}/{region_id}'].post.parameters[1].schema" + """ name: Required[str] - """Secret name""" + """ + '#/components/schemas/CreateSecretSerializerV2/properties/name' + "$.components.schemas.CreateSecretSerializerV2.properties.name" + """ payload: Required[Payload] - """Secret payload.""" + """ + '#/components/schemas/CreateSecretSerializerV2/properties/payload' + "$.components.schemas.CreateSecretSerializerV2.properties.payload" + """ expiration: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] - """Datetime when the secret will expire. Defaults to None""" + """ + '#/components/schemas/CreateSecretSerializerV2/properties/expiration/anyOf/0' + "$.components.schemas.CreateSecretSerializerV2.properties.expiration.anyOf[0]" + """ class Payload(TypedDict, total=False): certificate: Required[str] - """SSL certificate in PEM format.""" + """ + '#/components/schemas/CreateSecretPayloadSerializer/properties/certificate' + "$.components.schemas.CreateSecretPayloadSerializer.properties.certificate" + """ certificate_chain: Required[str] - """SSL certificate chain of intermediates and root certificates in PEM format.""" + """ + '#/components/schemas/CreateSecretPayloadSerializer/properties/certificate_chain' + "$.components.schemas.CreateSecretPayloadSerializer.properties.certificate_chain" + """ private_key: Required[str] - """SSL private key in PEM format.""" + """ + '#/components/schemas/CreateSecretPayloadSerializer/properties/private_key' + "$.components.schemas.CreateSecretPayloadSerializer.properties.private_key" + """ diff --git a/src/gcore/types/cloud/secret_upload_tls_certificate_response.py b/src/gcore/types/cloud/secret_upload_tls_certificate_response.py index ae5b1a98..8dd0f7f8 100644 --- a/src/gcore/types/cloud/secret_upload_tls_certificate_response.py +++ b/src/gcore/types/cloud/secret_upload_tls_certificate_response.py @@ -9,4 +9,7 @@ class SecretUploadTlsCertificateResponse(BaseModel): tasks: Optional[List[str]] = None - """Task list""" + """ + '#/components/schemas/TaskIdListSchema/properties/tasks' + "$.components.schemas.TaskIdListSchema.properties.tasks" + """ diff --git a/src/gcore/types/cloud/ssh_key.py b/src/gcore/types/cloud/ssh_key.py index 1430a38d..4b6f9c15 100644 --- a/src/gcore/types/cloud/ssh_key.py +++ b/src/gcore/types/cloud/ssh_key.py @@ -11,29 +11,49 @@ class SSHKey(BaseModel): id: str - """SSH key ID""" + """ + '#/components/schemas/SSHKeySerializer/properties/id' + "$.components.schemas.SSHKeySerializer.properties.id" + """ created_at: Optional[datetime] = None - """SSH key creation time""" + """ + '#/components/schemas/SSHKeySerializer/properties/created_at/anyOf/0' + "$.components.schemas.SSHKeySerializer.properties.created_at.anyOf[0]" + """ fingerprint: str - """Fingerprint""" + """ + '#/components/schemas/SSHKeySerializer/properties/fingerprint' + "$.components.schemas.SSHKeySerializer.properties.fingerprint" + """ name: str - """SSH key name""" + """ + '#/components/schemas/SSHKeySerializer/properties/name' + "$.components.schemas.SSHKeySerializer.properties.name" + """ project_id: Optional[int] = None - """Project ID""" + """ + '#/components/schemas/SSHKeySerializer/properties/project_id/anyOf/0' + "$.components.schemas.SSHKeySerializer.properties.project_id.anyOf[0]" + """ public_key: str - """The public part of an SSH key is the shareable portion of an SSH key pair. - - It can be safely sent to servers or services to grant access. It does not - contain sensitive information. + """ + '#/components/schemas/SSHKeySerializer/properties/public_key' + "$.components.schemas.SSHKeySerializer.properties.public_key" """ shared_in_project: bool - """SSH key will be visible to all users in the project""" + """ + '#/components/schemas/SSHKeySerializer/properties/shared_in_project' + "$.components.schemas.SSHKeySerializer.properties.shared_in_project" + """ state: Literal["ACTIVE", "DELETING"] - """SSH key state""" + """ + '#/components/schemas/SSHKeySerializer/properties/state' + "$.components.schemas.SSHKeySerializer.properties.state" + """ diff --git a/src/gcore/types/cloud/ssh_key_create_params.py b/src/gcore/types/cloud/ssh_key_create_params.py index 65008f58..53e04451 100644 --- a/src/gcore/types/cloud/ssh_key_create_params.py +++ b/src/gcore/types/cloud/ssh_key_create_params.py @@ -9,23 +9,25 @@ class SSHKeyCreateParams(TypedDict, total=False): project_id: int - """Project ID""" + """ + '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].post.parameters[0].schema" + """ name: Required[str] - """SSH key name""" + """ + '#/components/schemas/CreateSSHKeySerializer/properties/name' + "$.components.schemas.CreateSSHKeySerializer.properties.name" + """ public_key: str - """The public part of an SSH key is the shareable portion of an SSH key pair. - - It can be safely sent to servers or services to grant access. It does not - contain sensitive information. - - - If you’re uploading your own key, provide the public part here (usually found - in a file like `id_ed25519.pub`). - - If you want the platform to generate an Ed25519 key pair for you, leave this - field empty — the system will return the private key in the response **once - only**. + """ + '#/components/schemas/CreateSSHKeySerializer/properties/public_key' + "$.components.schemas.CreateSSHKeySerializer.properties.public_key" """ shared_in_project: bool - """SSH key is shared with all users in the project""" + """ + '#/components/schemas/CreateSSHKeySerializer/properties/shared_in_project' + "$.components.schemas.CreateSSHKeySerializer.properties.shared_in_project" + """ diff --git a/src/gcore/types/cloud/ssh_key_list_params.py b/src/gcore/types/cloud/ssh_key_list_params.py index a3dea48f..92591f91 100644 --- a/src/gcore/types/cloud/ssh_key_list_params.py +++ b/src/gcore/types/cloud/ssh_key_list_params.py @@ -9,13 +9,25 @@ class SSHKeyListParams(TypedDict, total=False): project_id: int - """Project ID""" + """ + '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[0].schema" + """ limit: int - """Maximum number of SSH keys to return""" + """ + '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/1' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[1]" + """ offset: int - """Offset for pagination""" + """ + '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/2' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[2]" + """ order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] - """Sort order for the SSH keys""" + """ + '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/3' + "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[3]" + """ diff --git a/src/gcore/types/cloud/ssh_key_update_params.py b/src/gcore/types/cloud/ssh_key_update_params.py index 5efc271e..bd67e3f0 100644 --- a/src/gcore/types/cloud/ssh_key_update_params.py +++ b/src/gcore/types/cloud/ssh_key_update_params.py @@ -9,7 +9,13 @@ class SSHKeyUpdateParams(TypedDict, total=False): project_id: int - """Project ID""" + """ + '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].patch.parameters[0].schema" + """ shared_in_project: Required[bool] - """Share your ssh key with all users in the project""" + """ + '#/components/schemas/ShareSSHKeySerializer/properties/shared_in_project' + "$.components.schemas.ShareSSHKeySerializer.properties.shared_in_project" + """ diff --git a/src/gcore/types/cloud/task.py b/src/gcore/types/cloud/task.py index a66a37a9..15cba566 100644 --- a/src/gcore/types/cloud/task.py +++ b/src/gcore/types/cloud/task.py @@ -10,138 +10,270 @@ class CreatedResources(BaseModel): ai_clusters: Optional[List[str]] = None - """IDs of created AI clusters""" + """ + '#/components/schemas/CreatedResources/properties/ai_clusters' + "$.components.schemas.CreatedResources.properties.ai_clusters" + """ api_keys: Optional[List[str]] = None - """IDs of created API keys""" + """ + '#/components/schemas/CreatedResources/properties/api_keys' + "$.components.schemas.CreatedResources.properties.api_keys" + """ caas_containers: Optional[List[str]] = None - """IDs of created CaaS containers""" + """ + '#/components/schemas/CreatedResources/properties/caas_containers' + "$.components.schemas.CreatedResources.properties.caas_containers" + """ ddos_profiles: Optional[List[int]] = None - """IDs of created ddos protection profiles""" + """ + '#/components/schemas/CreatedResources/properties/ddos_profiles' + "$.components.schemas.CreatedResources.properties.ddos_profiles" + """ faas_functions: Optional[List[str]] = None - """IDs of created FaaS functions""" + """ + '#/components/schemas/CreatedResources/properties/faas_functions' + "$.components.schemas.CreatedResources.properties.faas_functions" + """ faas_namespaces: Optional[List[str]] = None - """IDs of created FaaS namespaces""" + """ + '#/components/schemas/CreatedResources/properties/faas_namespaces' + "$.components.schemas.CreatedResources.properties.faas_namespaces" + """ file_shares: Optional[List[str]] = None - """IDs of created file shares""" + """ + '#/components/schemas/CreatedResources/properties/file_shares' + "$.components.schemas.CreatedResources.properties.file_shares" + """ floatingips: Optional[List[str]] = None - """IDs of created floating IPs""" + """ + '#/components/schemas/CreatedResources/properties/floatingips' + "$.components.schemas.CreatedResources.properties.floatingips" + """ healthmonitors: Optional[List[str]] = None - """IDs of created health monitors""" + """ + '#/components/schemas/CreatedResources/properties/healthmonitors' + "$.components.schemas.CreatedResources.properties.healthmonitors" + """ heat: Optional[List[str]] = None - """IDs of created heat resources""" + """ + '#/components/schemas/CreatedResources/properties/heat' + "$.components.schemas.CreatedResources.properties.heat" + """ images: Optional[List[str]] = None - """IDs of created images""" + """ + '#/components/schemas/CreatedResources/properties/images' + "$.components.schemas.CreatedResources.properties.images" + """ inference_instances: Optional[List[str]] = None - """IDs of created inference instances""" + """ + '#/components/schemas/CreatedResources/properties/inference_instances' + "$.components.schemas.CreatedResources.properties.inference_instances" + """ instances: Optional[List[str]] = None - """IDs of created instances""" + """ + '#/components/schemas/CreatedResources/properties/instances' + "$.components.schemas.CreatedResources.properties.instances" + """ k8s_clusters: Optional[List[str]] = None - """IDs of created Kubernetes clusters""" + """ + '#/components/schemas/CreatedResources/properties/k8s_clusters' + "$.components.schemas.CreatedResources.properties.k8s_clusters" + """ k8s_pools: Optional[List[str]] = None - """IDs of created Kubernetes pools""" + """ + '#/components/schemas/CreatedResources/properties/k8s_pools' + "$.components.schemas.CreatedResources.properties.k8s_pools" + """ l7polices: Optional[List[str]] = None - """IDs of created L7 policies""" + """ + '#/components/schemas/CreatedResources/properties/l7polices' + "$.components.schemas.CreatedResources.properties.l7polices" + """ l7rules: Optional[List[str]] = None - """IDs of created L7 rules""" + """ + '#/components/schemas/CreatedResources/properties/l7rules' + "$.components.schemas.CreatedResources.properties.l7rules" + """ laas_topic: Optional[List[str]] = None - """IDs of created LaaS topics""" + """ + '#/components/schemas/CreatedResources/properties/laas_topic' + "$.components.schemas.CreatedResources.properties.laas_topic" + """ listeners: Optional[List[str]] = None - """IDs of created load balancer listeners""" + """ + '#/components/schemas/CreatedResources/properties/listeners' + "$.components.schemas.CreatedResources.properties.listeners" + """ loadbalancers: Optional[List[str]] = None - """IDs of created load balancers""" + """ + '#/components/schemas/CreatedResources/properties/loadbalancers' + "$.components.schemas.CreatedResources.properties.loadbalancers" + """ members: Optional[List[str]] = None - """IDs of created pool members""" + """ + '#/components/schemas/CreatedResources/properties/members' + "$.components.schemas.CreatedResources.properties.members" + """ networks: Optional[List[str]] = None - """IDs of created networks""" + """ + '#/components/schemas/CreatedResources/properties/networks' + "$.components.schemas.CreatedResources.properties.networks" + """ pools: Optional[List[str]] = None - """IDs of created load balancer pools""" + """ + '#/components/schemas/CreatedResources/properties/pools' + "$.components.schemas.CreatedResources.properties.pools" + """ ports: Optional[List[str]] = None - """IDs of created ports""" + """ + '#/components/schemas/CreatedResources/properties/ports' + "$.components.schemas.CreatedResources.properties.ports" + """ postgresql_clusters: Optional[List[str]] = None - """IDs of created postgres clusters""" + """ + '#/components/schemas/CreatedResources/properties/postgresql_clusters' + "$.components.schemas.CreatedResources.properties.postgresql_clusters" + """ projects: Optional[List[int]] = None - """IDs of created projects""" + """ + '#/components/schemas/CreatedResources/properties/projects' + "$.components.schemas.CreatedResources.properties.projects" + """ registry_registries: Optional[List[str]] = None - """IDs of created registry registries""" + """ + '#/components/schemas/CreatedResources/properties/registry_registries' + "$.components.schemas.CreatedResources.properties.registry_registries" + """ registry_users: Optional[List[str]] = None - """IDs of created registry users""" + """ + '#/components/schemas/CreatedResources/properties/registry_users' + "$.components.schemas.CreatedResources.properties.registry_users" + """ routers: Optional[List[str]] = None - """IDs of created routers""" + """ + '#/components/schemas/CreatedResources/properties/routers' + "$.components.schemas.CreatedResources.properties.routers" + """ secrets: Optional[List[str]] = None - """IDs of created secrets""" + """ + '#/components/schemas/CreatedResources/properties/secrets' + "$.components.schemas.CreatedResources.properties.secrets" + """ servergroups: Optional[List[str]] = None - """IDs of created server groups""" + """ + '#/components/schemas/CreatedResources/properties/servergroups' + "$.components.schemas.CreatedResources.properties.servergroups" + """ snapshots: Optional[List[str]] = None - """IDs of created volume snapshots""" + """ + '#/components/schemas/CreatedResources/properties/snapshots' + "$.components.schemas.CreatedResources.properties.snapshots" + """ subnets: Optional[List[str]] = None - """IDs of created subnets""" + """ + '#/components/schemas/CreatedResources/properties/subnets' + "$.components.schemas.CreatedResources.properties.subnets" + """ volumes: Optional[List[str]] = None - """IDs of created volumes""" + """ + '#/components/schemas/CreatedResources/properties/volumes' + "$.components.schemas.CreatedResources.properties.volumes" + """ class Task(BaseModel): id: str - """The task ID""" + """ + '#/components/schemas/TaskSerializer/properties/id' + "$.components.schemas.TaskSerializer.properties.id" + """ created_on: Optional[str] = None - """Created timestamp""" + """ + '#/components/schemas/TaskSerializer/properties/created_on/anyOf/0' + "$.components.schemas.TaskSerializer.properties.created_on.anyOf[0]" + """ state: Literal["ERROR", "FINISHED", "NEW", "RUNNING"] - """The task state""" + """ + '#/components/schemas/TaskSerializer/properties/state' + "$.components.schemas.TaskSerializer.properties.state" + """ task_type: str - """The task type""" + """ + '#/components/schemas/TaskSerializer/properties/task_type' + "$.components.schemas.TaskSerializer.properties.task_type" + """ user_id: int - """The user ID that initiated the task""" + """ + '#/components/schemas/TaskSerializer/properties/user_id' + "$.components.schemas.TaskSerializer.properties.user_id" + """ acknowledged_at: Optional[str] = None - """If task was acknowledged, this field stores acknowledge timestamp""" + """ + '#/components/schemas/TaskSerializer/properties/acknowledged_at/anyOf/0' + "$.components.schemas.TaskSerializer.properties.acknowledged_at.anyOf[0]" + """ acknowledged_by: Optional[int] = None - """If task was acknowledged, this field stores user_id of the person""" + """ + '#/components/schemas/TaskSerializer/properties/acknowledged_by/anyOf/0' + "$.components.schemas.TaskSerializer.properties.acknowledged_by.anyOf[0]" + """ client_id: Optional[int] = None - """The client ID""" + """ + '#/components/schemas/TaskSerializer/properties/client_id/anyOf/0' + "$.components.schemas.TaskSerializer.properties.client_id.anyOf[0]" + """ created_resources: Optional[CreatedResources] = None - """If the task creates resources, this field will contain their IDs""" + """ + '#/components/schemas/TaskSerializer/properties/created_resources/anyOf/0' + "$.components.schemas.TaskSerializer.properties.created_resources.anyOf[0]" + """ data: Optional[object] = None - """Task parameters""" + """ + '#/components/schemas/TaskSerializer/properties/data/anyOf/0' + "$.components.schemas.TaskSerializer.properties.data.anyOf[0]" + """ detailed_state: Optional[ Literal[ @@ -158,34 +290,67 @@ class Task(BaseModel): "VIPU_CONTROLLER", ] ] = None - """Task detailed state that is more specific to task type""" + """ + '#/components/schemas/TaskSerializer/properties/detailed_state/anyOf/0' + "$.components.schemas.TaskSerializer.properties.detailed_state.anyOf[0]" + """ error: Optional[str] = None - """The error value""" + """ + '#/components/schemas/TaskSerializer/properties/error/anyOf/0' + "$.components.schemas.TaskSerializer.properties.error.anyOf[0]" + """ finished_on: Optional[str] = None - """Finished timestamp""" + """ + '#/components/schemas/TaskSerializer/properties/finished_on/anyOf/0' + "$.components.schemas.TaskSerializer.properties.finished_on.anyOf[0]" + """ job_id: Optional[str] = None - """Job ID""" + """ + '#/components/schemas/TaskSerializer/properties/job_id/anyOf/0' + "$.components.schemas.TaskSerializer.properties.job_id.anyOf[0]" + """ lifecycle_policy_id: Optional[int] = None - """Lifecycle policy ID""" + """ + '#/components/schemas/TaskSerializer/properties/lifecycle_policy_id/anyOf/0' + "$.components.schemas.TaskSerializer.properties.lifecycle_policy_id.anyOf[0]" + """ project_id: Optional[int] = None - """The project ID""" + """ + '#/components/schemas/TaskSerializer/properties/project_id/anyOf/0' + "$.components.schemas.TaskSerializer.properties.project_id.anyOf[0]" + """ region_id: Optional[int] = None - """The region ID""" + """ + '#/components/schemas/TaskSerializer/properties/region_id/anyOf/0' + "$.components.schemas.TaskSerializer.properties.region_id.anyOf[0]" + """ request_id: Optional[str] = None - """The request ID""" + """ + '#/components/schemas/TaskSerializer/properties/request_id/anyOf/0' + "$.components.schemas.TaskSerializer.properties.request_id.anyOf[0]" + """ schedule_id: Optional[str] = None - """Schedule ID""" + """ + '#/components/schemas/TaskSerializer/properties/schedule_id/anyOf/0' + "$.components.schemas.TaskSerializer.properties.schedule_id.anyOf[0]" + """ updated_on: Optional[str] = None - """Last updated timestamp""" + """ + '#/components/schemas/TaskSerializer/properties/updated_on/anyOf/0' + "$.components.schemas.TaskSerializer.properties.updated_on.anyOf[0]" + """ user_client_id: Optional[int] = None - """Client, specified in user's JWT""" + """ + '#/components/schemas/TaskSerializer/properties/user_client_id/anyOf/0' + "$.components.schemas.TaskSerializer.properties.user_client_id.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/task_acknowledge_all_params.py b/src/gcore/types/cloud/task_acknowledge_all_params.py index d35c39b7..4955d69a 100644 --- a/src/gcore/types/cloud/task_acknowledge_all_params.py +++ b/src/gcore/types/cloud/task_acknowledge_all_params.py @@ -10,7 +10,13 @@ class TaskAcknowledgeAllParams(TypedDict, total=False): project_id: Optional[int] - """Project ID""" + """ + '#/paths/%2Fcloud%2Fv1%2Ftasks%2Facknowledge_all/post/parameters/0/schema/anyOf/0' + "$.paths['/cloud/v1/tasks/acknowledge_all'].post.parameters[0].schema.anyOf[0]" + """ region_id: Optional[int] - """Region ID""" + """ + '#/paths/%2Fcloud%2Fv1%2Ftasks%2Facknowledge_all/post/parameters/1/schema/anyOf/0' + "$.paths['/cloud/v1/tasks/acknowledge_all'].post.parameters[1].schema.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index 51ed860d..54cf8776 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -13,90 +13,61 @@ class TaskListParams(TypedDict, total=False): from_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] - """ISO formatted datetime string. - - Filter the tasks by creation date greater than or equal to from_timestamp + """ + '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/0/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[0].schema.anyOf[0]" """ is_acknowledged: Optional[bool] - """Filter the tasks by their acknowledgement status""" + """ + '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/1/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[1].schema.anyOf[0]" + """ limit: int - """Limit the number of returned tasks. - - Falls back to default of 10 if not specified. Limited by max limit value of 1000 + """ + '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/2' + "$.paths['/cloud/v1/tasks'].get.parameters[2]" """ offset: int - """Offset value is used to exclude the first set of records from the result""" + """ + '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/3' + "$.paths['/cloud/v1/tasks'].get.parameters[3]" + """ project_id: Optional[Iterable[int]] - """The project ID to filter the tasks by project. - - Supports multiple values of kind key=value1&key=value2 + """ + '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/4/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[4].schema.anyOf[0]" """ region_id: Optional[Iterable[int]] - """The region ID to filter the tasks by region. - - Supports multiple values of kind key=value1&key=value2 + """ + '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/5/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[5].schema.anyOf[0]" """ sorting: Optional[Literal["asc", "desc"]] - """Sorting by creation date. Oldest first, or most recent first""" + """ + '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/6/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[6].schema.anyOf[0]" + """ state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] - """Filter the tasks by state. - - Supports multiple values of kind key=value1&key=value2 + """ + '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/7/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[7].schema.anyOf[0]" """ task_type: Optional[str] """ - Filter the tasks by their type one of ['activate_ddos_profile', - 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', - 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', - 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', - 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', - 'create_fip', 'create_gpu_virtual_cluster', 'create_image', - 'create_inference_instance', 'create_inference_instance_key', - 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', - 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', - 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', - 'create_reserved_fixed_ip', 'create_router', 'create_secret', - 'create_servergroup', 'create_sfs', 'create_snapshot', 'create_subnet', - 'create_vm', 'create_volume', 'deactivate_ddos_profile', - 'delete_ai_cluster_gpu', 'delete_caas_container', - 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', - 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', - 'delete_image', 'delete_inference_instance', 'delete_k8s_cluster_pool_v2', - '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', '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', - 'replace_lbmetadata', 'resize_k8s_cluster_v2', 'resize_loadbalancer', - 'resize_vm', 'resume_vm', 'revert_volume', 'soft_reboot_gpu_baremetal_server', - 'soft_reboot_gpu_virtual_cluster', 'soft_reboot_gpu_virtual_server', - 'soft_reboot_vm', 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', - 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', - 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', - 'sync_private_flavors', 'update_ddos_profile', 'update_inference_instance', - 'update_inference_instance_key', 'update_k8s_cluster_v2', 'update_lbmetadata', - 'update_port_allowed_address_pairs', 'update_tags_gpu_virtual_cluster', - 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu'] + '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/8/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[8].schema.anyOf[0]" """ to_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] - """ISO formatted datetime string. - - Filter the tasks by creation date less than or equal to to_timestamp + """ + '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/9/schema/anyOf/0' + "$.paths['/cloud/v1/tasks'].get.parameters[9].schema.anyOf[0]" """ From 97e1510f34277e873d717b19d5a07f11fea3cef9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 18 Apr 2025 20:05:14 +0000 Subject: [PATCH 039/592] chore(internal): update models test --- tests/test_models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_models.py b/tests/test_models.py index 785477a0..a153f19b 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -492,12 +492,15 @@ class Model(BaseModel): resource_id: Optional[str] = None m = Model.construct() + assert m.resource_id is None assert "resource_id" not in m.model_fields_set m = Model.construct(resource_id=None) + assert m.resource_id is None assert "resource_id" in m.model_fields_set m = Model.construct(resource_id="foo") + assert m.resource_id == "foo" assert "resource_id" in m.model_fields_set From 266e18b30bddefbe25e9b8f5fa97f179d8ea338c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 21 Apr 2025 09:50:03 +0000 Subject: [PATCH 040/592] feat(api): aggregated API specs update --- .stats.yml | 6 +-- api.md | 46 ++++++++++-------- src/gcore/resources/cloud/projects.py | 10 ++-- src/gcore/resources/cloud/secrets.py | 28 +++++------ src/gcore/types/cloud/__init__.py | 11 ++--- .../cloud/load_balancer_operating_status.py | 7 --- ...connectivity.py => member_connectivity.py} | 4 +- src/gcore/types/cloud/operating_status.py | 7 +++ .../types/cloud/project_delete_response.py | 15 ------ .../types/cloud/secret_create_response.py | 15 ------ .../types/cloud/secret_delete_response.py | 15 ------ .../secret_upload_tls_certificate_response.py | 15 ------ src/gcore/types/cloud/task_id_list.py | 15 ++++++ tests/api_resources/cloud/test_projects.py | 17 +++---- tests/api_resources/cloud/test_secrets.py | 48 +++++++++---------- 15 files changed, 104 insertions(+), 155 deletions(-) delete mode 100644 src/gcore/types/cloud/load_balancer_operating_status.py rename src/gcore/types/cloud/{load_balancer_member_connectivity.py => member_connectivity.py} (55%) create mode 100644 src/gcore/types/cloud/operating_status.py delete mode 100644 src/gcore/types/cloud/project_delete_response.py delete mode 100644 src/gcore/types/cloud/secret_create_response.py delete mode 100644 src/gcore/types/cloud/secret_delete_response.py delete mode 100644 src/gcore/types/cloud/secret_upload_tls_certificate_response.py create mode 100644 src/gcore/types/cloud/task_id_list.py diff --git a/.stats.yml b/.stats.yml index 8b49ba2a..ffa84640 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-cb53c544588cced53f4ff3e2932dee711475fab9355745be836bfc45fbb1f49e.yml -openapi_spec_hash: dbe9a3596580d2c26788e0db01b5be34 -config_hash: 457fab5c213972cb9fddf8ad6ed414cc +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7ea2e090a0751a81d5dac2bd5d8aeab5fac63679cfa076ebd4b8364ae4804406.yml +openapi_spec_hash: 63e301398fd531ad20a6f5fcaf9a7a0d +config_hash: 52648a674774029ef26278b4a9781495 diff --git a/api.md b/api.md index ca8c4cff..2c9bd925 100644 --- a/api.md +++ b/api.md @@ -4,27 +4,39 @@ Types: ```python from gcore.types.cloud import ( - DDOSProfile, - DDOSProfileField, - DDOSProfileOptionList, + ClientProfile, + ClientProfileField, + ClientProfileTemplate, + ClientProfileTemplateField, DDOSProfileStatus, - DDOSProfileTemplate, - DDOSProfileTemplateField, FlavorHardwareDescription, FloatingIP, + FloatingIPInterfaceNewInstance, + FloatingIPNewInterface, FloatingIPStatus, InstanceMetricsTimeUnit, InterfaceIPFamily, + ItemPrice, + LaasIndexRetentionPolicy, + Listener, LoadBalancer, + LoadBalancerFlavor, LoadBalancerInstanceRole, - LoadBalancerMemberConnectivity, - LoadBalancerOperatingStatus, - LoadBalancerStatistics, + LoadBalancerLogging, + LoadBalancerStatList, + MandatoryID, + MemberConnectivity, + Name, Network, + NetworkPortFixedIP, + OperatingStatus, + ProfileOptionList, ProvisioningStatus, + RawMetadata, Subnet, Tag, TagList, + TagUpdateList, TaskIDList, VrrpIP, ) @@ -35,14 +47,14 @@ from gcore.types.cloud import ( Types: ```python -from gcore.types.cloud import Project, ProjectDeleteResponse +from gcore.types.cloud import Project ``` Methods: - client.cloud.projects.create(\*\*params) -> Project - client.cloud.projects.list(\*\*params) -> SyncOffsetPage[Project] -- client.cloud.projects.delete(\*, project_id) -> ProjectDeleteResponse +- client.cloud.projects.delete(\*, project_id) -> TaskIDList - client.cloud.projects.get(\*, project_id) -> Project - client.cloud.projects.replace(\*, project_id, \*\*params) -> Project @@ -108,22 +120,16 @@ Methods: Types: ```python -from gcore.types.cloud import ( - Secret, - SecretCreateResponse, - SecretListResponse, - SecretDeleteResponse, - SecretUploadTlsCertificateResponse, -) +from gcore.types.cloud import Secret, SecretListResponse ``` Methods: -- client.cloud.secrets.create(\*, project_id, region_id, \*\*params) -> SecretCreateResponse +- client.cloud.secrets.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.secrets.list(\*, project_id, region_id) -> SecretListResponse -- client.cloud.secrets.delete(secret_id, \*, project_id, region_id) -> SecretDeleteResponse +- client.cloud.secrets.delete(secret_id, \*, project_id, region_id) -> TaskIDList - client.cloud.secrets.get(secret_id, \*, project_id, region_id) -> Secret -- client.cloud.secrets.upload_tls_certificate(\*, project_id, region_id, \*\*params) -> SecretUploadTlsCertificateResponse +- client.cloud.secrets.upload_tls_certificate(\*, project_id, region_id, \*\*params) -> TaskIDList ## SSHKeys diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index d560cfbe..42c2f05f 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -24,7 +24,7 @@ from ...types.cloud import project_list_params, project_create_params, project_replace_params from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.project import Project -from ...types.cloud.project_delete_response import ProjectDeleteResponse +from ...types.cloud.task_id_list import TaskIDList __all__ = ["ProjectsResource", "AsyncProjectsResource"] @@ -183,7 +183,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectDeleteResponse: + ) -> TaskIDList: """ All cloud resources in all regions that belong to the project will be deleted and will not be recoverable @@ -207,7 +207,7 @@ def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ProjectDeleteResponse, + cast_to=TaskIDList, ) def get( @@ -452,7 +452,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectDeleteResponse: + ) -> TaskIDList: """ All cloud resources in all regions that belong to the project will be deleted and will not be recoverable @@ -476,7 +476,7 @@ async def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ProjectDeleteResponse, + cast_to=TaskIDList, ) async def get( diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index bab224b8..2c697b85 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -24,10 +24,8 @@ from ...types.cloud import secret_create_params, secret_upload_tls_certificate_params from ..._base_client import make_request_options from ...types.cloud.secret import Secret +from ...types.cloud.task_id_list import TaskIDList from ...types.cloud.secret_list_response import SecretListResponse -from ...types.cloud.secret_create_response import SecretCreateResponse -from ...types.cloud.secret_delete_response import SecretDeleteResponse -from ...types.cloud.secret_upload_tls_certificate_response import SecretUploadTlsCertificateResponse __all__ = ["SecretsResource", "AsyncSecretsResource"] @@ -72,7 +70,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretCreateResponse: + ) -> TaskIDList: """ Create secret @@ -141,7 +139,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=SecretCreateResponse, + cast_to=TaskIDList, ) def list( @@ -198,7 +196,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretDeleteResponse: + ) -> TaskIDList: """ Delete secret @@ -231,7 +229,7 @@ def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=SecretDeleteResponse, + cast_to=TaskIDList, ) def get( @@ -296,7 +294,7 @@ def upload_tls_certificate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretUploadTlsCertificateResponse: + ) -> TaskIDList: """ Create secret @@ -341,7 +339,7 @@ def upload_tls_certificate( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=SecretUploadTlsCertificateResponse, + cast_to=TaskIDList, ) @@ -385,7 +383,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretCreateResponse: + ) -> TaskIDList: """ Create secret @@ -454,7 +452,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=SecretCreateResponse, + cast_to=TaskIDList, ) async def list( @@ -511,7 +509,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretDeleteResponse: + ) -> TaskIDList: """ Delete secret @@ -544,7 +542,7 @@ async def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=SecretDeleteResponse, + cast_to=TaskIDList, ) async def get( @@ -609,7 +607,7 @@ async def upload_tls_certificate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretUploadTlsCertificateResponse: + ) -> TaskIDList: """ Create secret @@ -654,7 +652,7 @@ async def upload_tls_certificate( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=SecretUploadTlsCertificateResponse, + cast_to=TaskIDList, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index bd2add6e..e3cfd5dc 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -8,11 +8,14 @@ from .project import Project as Project from .ssh_key import SSHKey as SSHKey from .ip_ranges import IPRanges as IPRanges +from .task_id_list import TaskIDList as TaskIDList from .created_ssh_key import CreatedSSHKey as CreatedSSHKey +from .operating_status import OperatingStatus as OperatingStatus from .task_list_params import TaskListParams as TaskListParams from .floating_ip_status import FloatingIPStatus as FloatingIPStatus from .region_list_params import RegionListParams as RegionListParams from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily +from .member_connectivity import MemberConnectivity as MemberConnectivity from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams @@ -24,17 +27,9 @@ from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams -from .secret_create_response import SecretCreateResponse as SecretCreateResponse -from .secret_delete_response import SecretDeleteResponse as SecretDeleteResponse -from .project_delete_response import ProjectDeleteResponse as ProjectDeleteResponse from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse -from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus -from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams -from .secret_upload_tls_certificate_response import ( - SecretUploadTlsCertificateResponse as SecretUploadTlsCertificateResponse, -) diff --git a/src/gcore/types/cloud/load_balancer_operating_status.py b/src/gcore/types/cloud/load_balancer_operating_status.py deleted file mode 100644 index 28dd7a7f..00000000 --- a/src/gcore/types/cloud/load_balancer_operating_status.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["LoadBalancerOperatingStatus"] - -LoadBalancerOperatingStatus: TypeAlias = Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"] diff --git a/src/gcore/types/cloud/load_balancer_member_connectivity.py b/src/gcore/types/cloud/member_connectivity.py similarity index 55% rename from src/gcore/types/cloud/load_balancer_member_connectivity.py rename to src/gcore/types/cloud/member_connectivity.py index d33a72da..64e40b1c 100644 --- a/src/gcore/types/cloud/load_balancer_member_connectivity.py +++ b/src/gcore/types/cloud/member_connectivity.py @@ -2,6 +2,6 @@ from typing_extensions import Literal, TypeAlias -__all__ = ["LoadBalancerMemberConnectivity"] +__all__ = ["MemberConnectivity"] -LoadBalancerMemberConnectivity: TypeAlias = Literal["L2", "L3"] +MemberConnectivity: TypeAlias = Literal["L2", "L3"] diff --git a/src/gcore/types/cloud/operating_status.py b/src/gcore/types/cloud/operating_status.py new file mode 100644 index 00000000..9c2c10d2 --- /dev/null +++ b/src/gcore/types/cloud/operating_status.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["OperatingStatus"] + +OperatingStatus: TypeAlias = Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"] diff --git a/src/gcore/types/cloud/project_delete_response.py b/src/gcore/types/cloud/project_delete_response.py deleted file mode 100644 index f79413fd..00000000 --- a/src/gcore/types/cloud/project_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["ProjectDeleteResponse"] - - -class ProjectDeleteResponse(BaseModel): - tasks: Optional[List[str]] = None - """ - '#/components/schemas/TaskIdListSchema/properties/tasks' - "$.components.schemas.TaskIdListSchema.properties.tasks" - """ diff --git a/src/gcore/types/cloud/secret_create_response.py b/src/gcore/types/cloud/secret_create_response.py deleted file mode 100644 index 4bb8f0ce..00000000 --- a/src/gcore/types/cloud/secret_create_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["SecretCreateResponse"] - - -class SecretCreateResponse(BaseModel): - tasks: Optional[List[str]] = None - """ - '#/components/schemas/TaskIdListSchema/properties/tasks' - "$.components.schemas.TaskIdListSchema.properties.tasks" - """ diff --git a/src/gcore/types/cloud/secret_delete_response.py b/src/gcore/types/cloud/secret_delete_response.py deleted file mode 100644 index df1c429d..00000000 --- a/src/gcore/types/cloud/secret_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["SecretDeleteResponse"] - - -class SecretDeleteResponse(BaseModel): - tasks: Optional[List[str]] = None - """ - '#/components/schemas/TaskIdListSchema/properties/tasks' - "$.components.schemas.TaskIdListSchema.properties.tasks" - """ diff --git a/src/gcore/types/cloud/secret_upload_tls_certificate_response.py b/src/gcore/types/cloud/secret_upload_tls_certificate_response.py deleted file mode 100644 index 8dd0f7f8..00000000 --- a/src/gcore/types/cloud/secret_upload_tls_certificate_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["SecretUploadTlsCertificateResponse"] - - -class SecretUploadTlsCertificateResponse(BaseModel): - tasks: Optional[List[str]] = None - """ - '#/components/schemas/TaskIdListSchema/properties/tasks' - "$.components.schemas.TaskIdListSchema.properties.tasks" - """ diff --git a/src/gcore/types/cloud/task_id_list.py b/src/gcore/types/cloud/task_id_list.py new file mode 100644 index 00000000..dbc058c3 --- /dev/null +++ b/src/gcore/types/cloud/task_id_list.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["TaskIDList"] + + +class TaskIDList(BaseModel): + tasks: List[str] + """ + '#/components/schemas/TaskIDsSerializer/properties/tasks' + "$.components.schemas.TaskIDsSerializer.properties.tasks" + """ diff --git a/tests/api_resources/cloud/test_projects.py b/tests/api_resources/cloud/test_projects.py index abc01eaf..9bbc7710 100644 --- a/tests/api_resources/cloud/test_projects.py +++ b/tests/api_resources/cloud/test_projects.py @@ -10,10 +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 ( - Project, - ProjectDeleteResponse, -) +from gcore.types.cloud import Project, TaskIDList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -104,7 +101,7 @@ def test_method_delete(self, client: Gcore) -> None: project = client.cloud.projects.delete( project_id=0, ) - assert_matches_type(ProjectDeleteResponse, project, path=["response"]) + assert_matches_type(TaskIDList, project, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: @@ -115,7 +112,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(ProjectDeleteResponse, project, path=["response"]) + assert_matches_type(TaskIDList, project, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: @@ -126,7 +123,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(ProjectDeleteResponse, project, path=["response"]) + assert_matches_type(TaskIDList, project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -291,7 +288,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: project = await async_client.cloud.projects.delete( project_id=0, ) - assert_matches_type(ProjectDeleteResponse, project, path=["response"]) + assert_matches_type(TaskIDList, project, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @@ -302,7 +299,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(ProjectDeleteResponse, project, path=["response"]) + assert_matches_type(TaskIDList, project, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: @@ -313,7 +310,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(ProjectDeleteResponse, project, path=["response"]) + assert_matches_type(TaskIDList, project, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_secrets.py b/tests/api_resources/cloud/test_secrets.py index 6a88c2b3..e3b328e3 100644 --- a/tests/api_resources/cloud/test_secrets.py +++ b/tests/api_resources/cloud/test_secrets.py @@ -12,10 +12,8 @@ from gcore._utils import parse_datetime from gcore.types.cloud import ( Secret, + TaskIDList, SecretListResponse, - SecretCreateResponse, - SecretDeleteResponse, - SecretUploadTlsCertificateResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -35,7 +33,7 @@ def test_method_create(self, client: Gcore) -> None: payload_content_type="application/octet-stream", secret_type="certificate", ) - assert_matches_type(SecretCreateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -52,7 +50,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: expiration="2025-12-28T19:14:44.180394", mode="cbc", ) - assert_matches_type(SecretCreateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -69,7 +67,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" secret = response.parse() - assert_matches_type(SecretCreateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -86,7 +84,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = response.parse() - assert_matches_type(SecretCreateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) assert cast(Any, response.is_closed) is True @@ -131,7 +129,7 @@ def test_method_delete(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(SecretDeleteResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: @@ -144,7 +142,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = response.parse() - assert_matches_type(SecretDeleteResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: @@ -157,7 +155,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = response.parse() - assert_matches_type(SecretDeleteResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) assert cast(Any, response.is_closed) is True @@ -228,7 +226,7 @@ def test_method_upload_tls_certificate(self, client: Gcore) -> None: "private_key": "", }, ) - assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize def test_method_upload_tls_certificate_with_all_params(self, client: Gcore) -> None: @@ -243,7 +241,7 @@ def test_method_upload_tls_certificate_with_all_params(self, client: Gcore) -> N }, expiration=parse_datetime("2019-12-27T18:11:19.117Z"), ) - assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize def test_raw_response_upload_tls_certificate(self, client: Gcore) -> None: @@ -261,7 +259,7 @@ def test_raw_response_upload_tls_certificate(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = response.parse() - assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize def test_streaming_response_upload_tls_certificate(self, client: Gcore) -> None: @@ -279,7 +277,7 @@ def test_streaming_response_upload_tls_certificate(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = response.parse() - assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) assert cast(Any, response.is_closed) is True @@ -298,7 +296,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: payload_content_type="application/octet-stream", secret_type="certificate", ) - assert_matches_type(SecretCreateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -315,7 +313,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> expiration="2025-12-28T19:14:44.180394", mode="cbc", ) - assert_matches_type(SecretCreateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -332,7 +330,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" secret = await response.parse() - assert_matches_type(SecretCreateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -349,7 +347,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = await response.parse() - assert_matches_type(SecretCreateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) assert cast(Any, response.is_closed) is True @@ -394,7 +392,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(SecretDeleteResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @@ -407,7 +405,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = await response.parse() - assert_matches_type(SecretDeleteResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: @@ -420,7 +418,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = await response.parse() - assert_matches_type(SecretDeleteResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) assert cast(Any, response.is_closed) is True @@ -491,7 +489,7 @@ async def test_method_upload_tls_certificate(self, async_client: AsyncGcore) -> "private_key": "", }, ) - assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize async def test_method_upload_tls_certificate_with_all_params(self, async_client: AsyncGcore) -> None: @@ -506,7 +504,7 @@ async def test_method_upload_tls_certificate_with_all_params(self, async_client: }, expiration=parse_datetime("2019-12-27T18:11:19.117Z"), ) - assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize async def test_raw_response_upload_tls_certificate(self, async_client: AsyncGcore) -> None: @@ -524,7 +522,7 @@ async def test_raw_response_upload_tls_certificate(self, async_client: AsyncGcor assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = await response.parse() - assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize async def test_streaming_response_upload_tls_certificate(self, async_client: AsyncGcore) -> None: @@ -542,6 +540,6 @@ async def test_streaming_response_upload_tls_certificate(self, async_client: Asy assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = await response.parse() - assert_matches_type(SecretUploadTlsCertificateResponse, secret, path=["response"]) + assert_matches_type(TaskIDList, secret, path=["response"]) assert cast(Any, response.is_closed) is True From 77598d4af9070ae299ff6770dd01f918d7d771f0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 21 Apr 2025 10:33:34 +0000 Subject: [PATCH 041/592] GCLOUD2-18673 Add cloud reserved fixed ips --- .stats.yml | 4 +- api.md | 37 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + .../cloud/reserved_fixed_ips/__init__.py | 33 + .../reserved_fixed_ips/reserved_fixed_ips.py | 1119 +++++++++++++++++ .../resources/cloud/reserved_fixed_ips/vip.py | 676 ++++++++++ src/gcore/types/cloud/__init__.py | 6 + src/gcore/types/cloud/network.py | 125 ++ src/gcore/types/cloud/reserved_fixed_ip.py | 185 +++ .../cloud/reserved_fixed_ip_create_params.py | 192 +++ .../cloud/reserved_fixed_ip_list_params.py | 75 ++ .../cloud/reserved_fixed_ips/__init__.py | 12 + .../reserved_fixed_ips/candidate_port.py | 41 + .../reserved_fixed_ips/candidate_port_list.py | 22 + .../reserved_fixed_ips/connected_port.py | 41 + .../reserved_fixed_ips/connected_port_list.py | 22 + .../cloud/reserved_fixed_ips/ip_assignment.py | 27 + .../vip_replace_connected_ports_params.py | 28 + .../reserved_fixed_ips/vip_toggle_params.py | 27 + .../vip_update_connected_ports_params.py | 28 + src/gcore/types/cloud/subnet.py | 152 +++ src/gcore/types/cloud/tag.py | 26 + .../cloud/reserved_fixed_ips/__init__.py | 1 + .../cloud/reserved_fixed_ips/test_vip.py | 534 ++++++++ .../cloud/test_reserved_fixed_ips.py | 804 ++++++++++++ 26 files changed, 4261 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/reserved_fixed_ips/__init__.py create mode 100644 src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py create mode 100644 src/gcore/resources/cloud/reserved_fixed_ips/vip.py create mode 100644 src/gcore/types/cloud/network.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ip.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ip_create_params.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ip_list_params.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/__init__.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/connected_port.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/connected_port_list.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/ip_assignment.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/vip_toggle_params.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py create mode 100644 src/gcore/types/cloud/subnet.py create mode 100644 src/gcore/types/cloud/tag.py create mode 100644 tests/api_resources/cloud/reserved_fixed_ips/__init__.py create mode 100644 tests/api_resources/cloud/reserved_fixed_ips/test_vip.py create mode 100644 tests/api_resources/cloud/test_reserved_fixed_ips.py diff --git a/.stats.yml b/.stats.yml index ffa84640..573ccdbf 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 29 +configured_endpoints: 38 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7ea2e090a0751a81d5dac2bd5d8aeab5fac63679cfa076ebd4b8364ae4804406.yml openapi_spec_hash: 63e301398fd531ad20a6f5fcaf9a7a0d -config_hash: 52648a674774029ef26278b4a9781495 +config_hash: 4e7c173b37b44c206aff9f6a90386bef diff --git a/api.md b/api.md index 2c9bd925..68f014f9 100644 --- a/api.md +++ b/api.md @@ -158,3 +158,40 @@ from gcore.types.cloud import IPRanges Methods: - client.cloud.ip_ranges.list() -> IPRanges + +## ReservedFixedIPs + +Types: + +```python +from gcore.types.cloud import ReservedFixedIP +``` + +Methods: + +- client.cloud.reserved_fixed_ips.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.reserved_fixed_ips.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[ReservedFixedIP] +- client.cloud.reserved_fixed_ips.delete(port_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.reserved_fixed_ips.get(port_id, \*, project_id, region_id) -> ReservedFixedIP + +### Vip + +Types: + +```python +from gcore.types.cloud.reserved_fixed_ips import ( + CandidatePort, + CandidatePortList, + ConnectedPort, + ConnectedPortList, + IPAssignment, +) +``` + +Methods: + +- client.cloud.reserved_fixed_ips.vip.list_candidate_ports(port_id, \*, project_id, region_id) -> CandidatePortList +- client.cloud.reserved_fixed_ips.vip.list_connected_ports(port_id, \*, project_id, region_id) -> ConnectedPortList +- client.cloud.reserved_fixed_ips.vip.replace_connected_ports(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList +- client.cloud.reserved_fixed_ips.vip.toggle(port_id, \*, project_id, region_id, \*\*params) -> ReservedFixedIP +- client.cloud.reserved_fixed_ips.vip.update_connected_ports(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 0237d068..e425b38a 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -64,6 +64,14 @@ IPRangesResourceWithStreamingResponse, AsyncIPRangesResourceWithStreamingResponse, ) +from .reserved_fixed_ips import ( + ReservedFixedIPsResource, + AsyncReservedFixedIPsResource, + ReservedFixedIPsResourceWithRawResponse, + AsyncReservedFixedIPsResourceWithRawResponse, + ReservedFixedIPsResourceWithStreamingResponse, + AsyncReservedFixedIPsResourceWithStreamingResponse, +) __all__ = [ "ProjectsResource", @@ -108,6 +116,12 @@ "AsyncIPRangesResourceWithRawResponse", "IPRangesResourceWithStreamingResponse", "AsyncIPRangesResourceWithStreamingResponse", + "ReservedFixedIPsResource", + "AsyncReservedFixedIPsResource", + "ReservedFixedIPsResourceWithRawResponse", + "AsyncReservedFixedIPsResourceWithRawResponse", + "ReservedFixedIPsResourceWithStreamingResponse", + "AsyncReservedFixedIPsResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 4348b382..1eb8db1c 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -60,6 +60,14 @@ QuotasResourceWithStreamingResponse, AsyncQuotasResourceWithStreamingResponse, ) +from .reserved_fixed_ips.reserved_fixed_ips import ( + ReservedFixedIPsResource, + AsyncReservedFixedIPsResource, + ReservedFixedIPsResourceWithRawResponse, + AsyncReservedFixedIPsResourceWithRawResponse, + ReservedFixedIPsResourceWithStreamingResponse, + AsyncReservedFixedIPsResourceWithStreamingResponse, +) __all__ = ["CloudResource", "AsyncCloudResource"] @@ -93,6 +101,10 @@ def ssh_keys(self) -> SSHKeysResource: def ip_ranges(self) -> IPRangesResource: return IPRangesResource(self._client) + @cached_property + def reserved_fixed_ips(self) -> ReservedFixedIPsResource: + return ReservedFixedIPsResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -142,6 +154,10 @@ def ssh_keys(self) -> AsyncSSHKeysResource: def ip_ranges(self) -> AsyncIPRangesResource: return AsyncIPRangesResource(self._client) + @cached_property + def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResource: + return AsyncReservedFixedIPsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -194,6 +210,10 @@ def ssh_keys(self) -> SSHKeysResourceWithRawResponse: def ip_ranges(self) -> IPRangesResourceWithRawResponse: return IPRangesResourceWithRawResponse(self._cloud.ip_ranges) + @cached_property + def reserved_fixed_ips(self) -> ReservedFixedIPsResourceWithRawResponse: + return ReservedFixedIPsResourceWithRawResponse(self._cloud.reserved_fixed_ips) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -227,6 +247,10 @@ def ssh_keys(self) -> AsyncSSHKeysResourceWithRawResponse: def ip_ranges(self) -> AsyncIPRangesResourceWithRawResponse: return AsyncIPRangesResourceWithRawResponse(self._cloud.ip_ranges) + @cached_property + def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResourceWithRawResponse: + return AsyncReservedFixedIPsResourceWithRawResponse(self._cloud.reserved_fixed_ips) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -260,6 +284,10 @@ def ssh_keys(self) -> SSHKeysResourceWithStreamingResponse: def ip_ranges(self) -> IPRangesResourceWithStreamingResponse: return IPRangesResourceWithStreamingResponse(self._cloud.ip_ranges) + @cached_property + def reserved_fixed_ips(self) -> ReservedFixedIPsResourceWithStreamingResponse: + return ReservedFixedIPsResourceWithStreamingResponse(self._cloud.reserved_fixed_ips) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -292,3 +320,7 @@ def ssh_keys(self) -> AsyncSSHKeysResourceWithStreamingResponse: @cached_property def ip_ranges(self) -> AsyncIPRangesResourceWithStreamingResponse: return AsyncIPRangesResourceWithStreamingResponse(self._cloud.ip_ranges) + + @cached_property + def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResourceWithStreamingResponse: + return AsyncReservedFixedIPsResourceWithStreamingResponse(self._cloud.reserved_fixed_ips) diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/__init__.py b/src/gcore/resources/cloud/reserved_fixed_ips/__init__.py new file mode 100644 index 00000000..efec3183 --- /dev/null +++ b/src/gcore/resources/cloud/reserved_fixed_ips/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .vip import ( + VipResource, + AsyncVipResource, + VipResourceWithRawResponse, + AsyncVipResourceWithRawResponse, + VipResourceWithStreamingResponse, + AsyncVipResourceWithStreamingResponse, +) +from .reserved_fixed_ips import ( + ReservedFixedIPsResource, + AsyncReservedFixedIPsResource, + ReservedFixedIPsResourceWithRawResponse, + AsyncReservedFixedIPsResourceWithRawResponse, + ReservedFixedIPsResourceWithStreamingResponse, + AsyncReservedFixedIPsResourceWithStreamingResponse, +) + +__all__ = [ + "VipResource", + "AsyncVipResource", + "VipResourceWithRawResponse", + "AsyncVipResourceWithRawResponse", + "VipResourceWithStreamingResponse", + "AsyncVipResourceWithStreamingResponse", + "ReservedFixedIPsResource", + "AsyncReservedFixedIPsResource", + "ReservedFixedIPsResourceWithRawResponse", + "AsyncReservedFixedIPsResourceWithRawResponse", + "ReservedFixedIPsResourceWithStreamingResponse", + "AsyncReservedFixedIPsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py new file mode 100644 index 00000000..fcc64852 --- /dev/null +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -0,0 +1,1119 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, overload + +import httpx + +from .vip import ( + VipResource, + AsyncVipResource, + VipResourceWithRawResponse, + AsyncVipResourceWithRawResponse, + VipResourceWithStreamingResponse, + AsyncVipResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( + required_args, + maybe_transform, + async_maybe_transform, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.cloud import InterfaceIPFamily, reserved_fixed_ip_list_params, reserved_fixed_ip_create_params +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.reserved_fixed_ip import ReservedFixedIP +from ....types.cloud.interface_ip_family import InterfaceIPFamily + +__all__ = ["ReservedFixedIPsResource", "AsyncReservedFixedIPsResource"] + + +class ReservedFixedIPsResource(SyncAPIResource): + @cached_property + def vip(self) -> VipResource: + return VipResource(self._client) + + @cached_property + def with_raw_response(self) -> ReservedFixedIPsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return ReservedFixedIPsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ReservedFixedIPsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return ReservedFixedIPsResourceWithStreamingResponse(self) + + @overload + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + type: Literal["external"], + ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, + is_vip: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + + type: '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.type" + + ip_family: '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/ip_family/anyOf/0' + "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.ip_family.anyOf[0]" + + is_vip: '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/is_vip' + "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.is_vip" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + type: Literal["subnet"], + is_vip: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + + subnet_id: '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/subnet_id' + "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.subnet_id" + + type: '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.type" + + is_vip: '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/is_vip' + "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.is_vip" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + network_id: str, + type: Literal["any_subnet"], + ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, + is_vip: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + + network_id: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/network_id' + "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.network_id" + + type: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.type" + + ip_family: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/ip_family/anyOf/0' + "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.ip_family.anyOf[0]" + + is_vip: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/is_vip' + "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.is_vip" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + ip_address: str, + network_id: str, + type: Literal["ip_address"], + is_vip: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + + ip_address: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/ip_address' + "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.ip_address" + + network_id: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/network_id' + "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.network_id" + + type: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.type" + + is_vip: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/is_vip' + "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.is_vip" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + port_id: str, + type: Literal["port"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + + port_id: '#/components/schemas/NewReservedFixedIpSpecificPortSerializer/properties/port_id' + "$.components.schemas.NewReservedFixedIpSpecificPortSerializer.properties.port_id" + + type: '#/components/schemas/NewReservedFixedIpSpecificPortSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpSpecificPortSerializer.properties.type" + + 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( + ["type"], + ["subnet_id", "type"], + ["network_id", "type"], + ["ip_address", "network_id", "type"], + ["port_id", "type"], + ) + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + type: Literal["external"] | Literal["subnet"] | Literal["any_subnet"] | Literal["ip_address"] | Literal["port"], + ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, + is_vip: bool | NotGiven = NOT_GIVEN, + subnet_id: str | NotGiven = NOT_GIVEN, + network_id: str | NotGiven = NOT_GIVEN, + ip_address: str | NotGiven = NOT_GIVEN, + port_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._post( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + body=maybe_transform( + { + "type": type, + "ip_family": ip_family, + "is_vip": is_vip, + "subnet_id": subnet_id, + "network_id": network_id, + "ip_address": ip_address, + "port_id": port_id, + }, + reserved_fixed_ip_create_params.ReservedFixedIPCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + available_only: bool | NotGiven = NOT_GIVEN, + device_id: str | NotGiven = NOT_GIVEN, + external_only: bool | NotGiven = NOT_GIVEN, + internal_only: bool | NotGiven = NOT_GIVEN, + ip_address: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: str | NotGiven = NOT_GIVEN, + vip_only: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[ReservedFixedIP]: + """ + List reserved fixed IPs + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[1].schema" + + available_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[2]" + + device_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[3]" + + external_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[4]" + + internal_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[5]" + + ip_address: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[6]" + + limit: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[7]" + + offset: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[8]" + + order_by: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[9]" + + vip_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[10]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + page=SyncOffsetPage[ReservedFixedIP], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "available_only": available_only, + "device_id": device_id, + "external_only": external_only, + "internal_only": internal_only, + "ip_address": ip_address, + "limit": limit, + "offset": offset, + "order_by": order_by, + "vip_only": vip_only, + }, + reserved_fixed_ip_list_params.ReservedFixedIPListParams, + ), + ), + model=ReservedFixedIP, + ) + + def delete( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete reserved fixed ip + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}']['delete'].parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return self._delete( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ReservedFixedIP: + """ + Get reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].get.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return self._get( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ReservedFixedIP, + ) + + +class AsyncReservedFixedIPsResource(AsyncAPIResource): + @cached_property + def vip(self) -> AsyncVipResource: + return AsyncVipResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncReservedFixedIPsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncReservedFixedIPsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncReservedFixedIPsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncReservedFixedIPsResourceWithStreamingResponse(self) + + @overload + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + type: Literal["external"], + ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, + is_vip: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + + type: '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.type" + + ip_family: '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/ip_family/anyOf/0' + "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.ip_family.anyOf[0]" + + is_vip: '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/is_vip' + "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.is_vip" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + type: Literal["subnet"], + is_vip: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + + subnet_id: '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/subnet_id' + "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.subnet_id" + + type: '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.type" + + is_vip: '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/is_vip' + "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.is_vip" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + network_id: str, + type: Literal["any_subnet"], + ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, + is_vip: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + + network_id: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/network_id' + "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.network_id" + + type: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.type" + + ip_family: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/ip_family/anyOf/0' + "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.ip_family.anyOf[0]" + + is_vip: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/is_vip' + "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.is_vip" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + ip_address: str, + network_id: str, + type: Literal["ip_address"], + is_vip: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + + ip_address: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/ip_address' + "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.ip_address" + + network_id: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/network_id' + "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.network_id" + + type: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.type" + + is_vip: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/is_vip' + "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.is_vip" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + port_id: str, + type: Literal["port"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + + port_id: '#/components/schemas/NewReservedFixedIpSpecificPortSerializer/properties/port_id' + "$.components.schemas.NewReservedFixedIpSpecificPortSerializer.properties.port_id" + + type: '#/components/schemas/NewReservedFixedIpSpecificPortSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpSpecificPortSerializer.properties.type" + + 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( + ["type"], + ["subnet_id", "type"], + ["network_id", "type"], + ["ip_address", "network_id", "type"], + ["port_id", "type"], + ) + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + type: Literal["external"] | Literal["subnet"] | Literal["any_subnet"] | Literal["ip_address"] | Literal["port"], + ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, + is_vip: bool | NotGiven = NOT_GIVEN, + subnet_id: str | NotGiven = NOT_GIVEN, + network_id: str | NotGiven = NOT_GIVEN, + ip_address: str | NotGiven = NOT_GIVEN, + port_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._post( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "type": type, + "ip_family": ip_family, + "is_vip": is_vip, + "subnet_id": subnet_id, + "network_id": network_id, + "ip_address": ip_address, + "port_id": port_id, + }, + reserved_fixed_ip_create_params.ReservedFixedIPCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + available_only: bool | NotGiven = NOT_GIVEN, + device_id: str | NotGiven = NOT_GIVEN, + external_only: bool | NotGiven = NOT_GIVEN, + internal_only: bool | NotGiven = NOT_GIVEN, + ip_address: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: str | NotGiven = NOT_GIVEN, + vip_only: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[ReservedFixedIP, AsyncOffsetPage[ReservedFixedIP]]: + """ + List reserved fixed IPs + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[1].schema" + + available_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[2]" + + device_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[3]" + + external_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[4]" + + internal_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[5]" + + ip_address: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[6]" + + limit: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[7]" + + offset: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[8]" + + order_by: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[9]" + + vip_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[10]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + page=AsyncOffsetPage[ReservedFixedIP], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "available_only": available_only, + "device_id": device_id, + "external_only": external_only, + "internal_only": internal_only, + "ip_address": ip_address, + "limit": limit, + "offset": offset, + "order_by": order_by, + "vip_only": vip_only, + }, + reserved_fixed_ip_list_params.ReservedFixedIPListParams, + ), + ), + model=ReservedFixedIP, + ) + + async def delete( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete reserved fixed ip + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}']['delete'].parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return await self._delete( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ReservedFixedIP: + """ + Get reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].get.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return await self._get( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ReservedFixedIP, + ) + + +class ReservedFixedIPsResourceWithRawResponse: + def __init__(self, reserved_fixed_ips: ReservedFixedIPsResource) -> None: + self._reserved_fixed_ips = reserved_fixed_ips + + self.create = to_raw_response_wrapper( + reserved_fixed_ips.create, + ) + self.list = to_raw_response_wrapper( + reserved_fixed_ips.list, + ) + self.delete = to_raw_response_wrapper( + reserved_fixed_ips.delete, + ) + self.get = to_raw_response_wrapper( + reserved_fixed_ips.get, + ) + + @cached_property + def vip(self) -> VipResourceWithRawResponse: + return VipResourceWithRawResponse(self._reserved_fixed_ips.vip) + + +class AsyncReservedFixedIPsResourceWithRawResponse: + def __init__(self, reserved_fixed_ips: AsyncReservedFixedIPsResource) -> None: + self._reserved_fixed_ips = reserved_fixed_ips + + self.create = async_to_raw_response_wrapper( + reserved_fixed_ips.create, + ) + self.list = async_to_raw_response_wrapper( + reserved_fixed_ips.list, + ) + self.delete = async_to_raw_response_wrapper( + reserved_fixed_ips.delete, + ) + self.get = async_to_raw_response_wrapper( + reserved_fixed_ips.get, + ) + + @cached_property + def vip(self) -> AsyncVipResourceWithRawResponse: + return AsyncVipResourceWithRawResponse(self._reserved_fixed_ips.vip) + + +class ReservedFixedIPsResourceWithStreamingResponse: + def __init__(self, reserved_fixed_ips: ReservedFixedIPsResource) -> None: + self._reserved_fixed_ips = reserved_fixed_ips + + self.create = to_streamed_response_wrapper( + reserved_fixed_ips.create, + ) + self.list = to_streamed_response_wrapper( + reserved_fixed_ips.list, + ) + self.delete = to_streamed_response_wrapper( + reserved_fixed_ips.delete, + ) + self.get = to_streamed_response_wrapper( + reserved_fixed_ips.get, + ) + + @cached_property + def vip(self) -> VipResourceWithStreamingResponse: + return VipResourceWithStreamingResponse(self._reserved_fixed_ips.vip) + + +class AsyncReservedFixedIPsResourceWithStreamingResponse: + def __init__(self, reserved_fixed_ips: AsyncReservedFixedIPsResource) -> None: + self._reserved_fixed_ips = reserved_fixed_ips + + self.create = async_to_streamed_response_wrapper( + reserved_fixed_ips.create, + ) + self.list = async_to_streamed_response_wrapper( + reserved_fixed_ips.list, + ) + self.delete = async_to_streamed_response_wrapper( + reserved_fixed_ips.delete, + ) + self.get = async_to_streamed_response_wrapper( + reserved_fixed_ips.get, + ) + + @cached_property + def vip(self) -> AsyncVipResourceWithStreamingResponse: + return AsyncVipResourceWithStreamingResponse(self._reserved_fixed_ips.vip) diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py new file mode 100644 index 00000000..2d8064b1 --- /dev/null +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -0,0 +1,676 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.reserved_fixed_ip import ReservedFixedIP +from ....types.cloud.reserved_fixed_ips import ( + vip_toggle_params, + vip_update_connected_ports_params, + vip_replace_connected_ports_params, +) +from ....types.cloud.reserved_fixed_ips.candidate_port_list import CandidatePortList +from ....types.cloud.reserved_fixed_ips.connected_port_list import ConnectedPortList + +__all__ = ["VipResource", "AsyncVipResource"] + + +class VipResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> VipResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return VipResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VipResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return VipResourceWithStreamingResponse(self) + + def list_candidate_ports( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CandidatePortList: + """ + List instance ports that are available for connecting to VIP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Favailable_devices/get/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Favailable_devices/get/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices'].get.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Favailable_devices/get/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return self._get( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CandidatePortList, + ) + + def list_connected_ports( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ConnectedPortList: + """ + List instance ports that share VIP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/get/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/get/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].get.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/get/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return self._get( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectedPortList, + ) + + def replace_connected_ports( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_ids: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ConnectedPortList: + """ + Replace ports that share VIP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[2].schema" + + port_ids: '#/components/schemas/PortIDsForVIPSerializer/properties/port_ids' + "$.components.schemas.PortIDsForVIPSerializer.properties.port_ids" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return self._put( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + body=maybe_transform( + {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectedPortList, + ) + + def toggle( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + is_vip: bool, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ReservedFixedIP: + """ + Switch VIP status of reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[2].schema" + + is_vip: '#/components/schemas/PatchReservedFixedIPSerializer/properties/is_vip' + "$.components.schemas.PatchReservedFixedIPSerializer.properties.is_vip" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return self._patch( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + body=maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ReservedFixedIP, + ) + + def update_connected_ports( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_ids: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ConnectedPortList: + """ + Add ports that share VIP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[2].schema" + + port_ids: '#/components/schemas/PortIDsForVIPSerializer/properties/port_ids' + "$.components.schemas.PortIDsForVIPSerializer.properties.port_ids" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return self._patch( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + body=maybe_transform( + {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectedPortList, + ) + + +class AsyncVipResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncVipResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncVipResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVipResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncVipResourceWithStreamingResponse(self) + + async def list_candidate_ports( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CandidatePortList: + """ + List instance ports that are available for connecting to VIP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Favailable_devices/get/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Favailable_devices/get/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices'].get.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Favailable_devices/get/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return await self._get( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CandidatePortList, + ) + + async def list_connected_ports( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ConnectedPortList: + """ + List instance ports that share VIP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/get/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/get/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].get.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/get/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return await self._get( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectedPortList, + ) + + async def replace_connected_ports( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_ids: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ConnectedPortList: + """ + Replace ports that share VIP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[2].schema" + + port_ids: '#/components/schemas/PortIDsForVIPSerializer/properties/port_ids' + "$.components.schemas.PortIDsForVIPSerializer.properties.port_ids" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return await self._put( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + body=await async_maybe_transform( + {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectedPortList, + ) + + async def toggle( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + is_vip: bool, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ReservedFixedIP: + """ + Switch VIP status of reserved fixed IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[2].schema" + + is_vip: '#/components/schemas/PatchReservedFixedIPSerializer/properties/is_vip' + "$.components.schemas.PatchReservedFixedIPSerializer.properties.is_vip" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return await self._patch( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + body=await async_maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ReservedFixedIP, + ) + + async def update_connected_ports( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_ids: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ConnectedPortList: + """ + Add ports that share VIP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/2/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[2].schema" + + port_ids: '#/components/schemas/PortIDsForVIPSerializer/properties/port_ids' + "$.components.schemas.PortIDsForVIPSerializer.properties.port_ids" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return await self._patch( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + body=await async_maybe_transform( + {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectedPortList, + ) + + +class VipResourceWithRawResponse: + def __init__(self, vip: VipResource) -> None: + self._vip = vip + + self.list_candidate_ports = to_raw_response_wrapper( + vip.list_candidate_ports, + ) + self.list_connected_ports = to_raw_response_wrapper( + vip.list_connected_ports, + ) + self.replace_connected_ports = to_raw_response_wrapper( + vip.replace_connected_ports, + ) + self.toggle = to_raw_response_wrapper( + vip.toggle, + ) + self.update_connected_ports = to_raw_response_wrapper( + vip.update_connected_ports, + ) + + +class AsyncVipResourceWithRawResponse: + def __init__(self, vip: AsyncVipResource) -> None: + self._vip = vip + + self.list_candidate_ports = async_to_raw_response_wrapper( + vip.list_candidate_ports, + ) + self.list_connected_ports = async_to_raw_response_wrapper( + vip.list_connected_ports, + ) + self.replace_connected_ports = async_to_raw_response_wrapper( + vip.replace_connected_ports, + ) + self.toggle = async_to_raw_response_wrapper( + vip.toggle, + ) + self.update_connected_ports = async_to_raw_response_wrapper( + vip.update_connected_ports, + ) + + +class VipResourceWithStreamingResponse: + def __init__(self, vip: VipResource) -> None: + self._vip = vip + + self.list_candidate_ports = to_streamed_response_wrapper( + vip.list_candidate_ports, + ) + self.list_connected_ports = to_streamed_response_wrapper( + vip.list_connected_ports, + ) + self.replace_connected_ports = to_streamed_response_wrapper( + vip.replace_connected_ports, + ) + self.toggle = to_streamed_response_wrapper( + vip.toggle, + ) + self.update_connected_ports = to_streamed_response_wrapper( + vip.update_connected_ports, + ) + + +class AsyncVipResourceWithStreamingResponse: + def __init__(self, vip: AsyncVipResource) -> None: + self._vip = vip + + self.list_candidate_ports = async_to_streamed_response_wrapper( + vip.list_candidate_ports, + ) + self.list_connected_ports = async_to_streamed_response_wrapper( + vip.list_connected_ports, + ) + self.replace_connected_ports = async_to_streamed_response_wrapper( + vip.replace_connected_ports, + ) + self.toggle = async_to_streamed_response_wrapper( + vip.toggle, + ) + self.update_connected_ports = async_to_streamed_response_wrapper( + vip.update_connected_ports, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index e3cfd5dc..8c45a2bb 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -2,9 +2,12 @@ from __future__ import annotations +from .tag import Tag as Tag from .task import Task as Task from .region import Region as Region from .secret import Secret as Secret +from .subnet import Subnet as Subnet +from .network import Network as Network from .project import Project as Project from .ssh_key import SSHKey as SSHKey from .ip_ranges import IPRanges as IPRanges @@ -12,6 +15,7 @@ from .created_ssh_key import CreatedSSHKey as CreatedSSHKey from .operating_status import OperatingStatus as OperatingStatus from .task_list_params import TaskListParams as TaskListParams +from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP from .floating_ip_status import FloatingIPStatus as FloatingIPStatus from .region_list_params import RegionListParams as RegionListParams from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily @@ -32,4 +36,6 @@ from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse +from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams +from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams diff --git a/src/gcore/types/cloud/network.py b/src/gcore/types/cloud/network.py new file mode 100644 index 00000000..51bde528 --- /dev/null +++ b/src/gcore/types/cloud/network.py @@ -0,0 +1,125 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .tag import Tag +from ..._models import BaseModel + +__all__ = ["Network"] + + +class Network(BaseModel): + id: str + """ + '#/components/schemas/NetworkSerializer/properties/id' + "$.components.schemas.NetworkSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/NetworkSerializer/properties/created_at' + "$.components.schemas.NetworkSerializer.properties.created_at" + """ + + external: bool + """ + '#/components/schemas/NetworkSerializer/properties/external' + "$.components.schemas.NetworkSerializer.properties.external" + """ + + metadata: List[Tag] + """ + '#/components/schemas/NetworkSerializer/properties/metadata' + "$.components.schemas.NetworkSerializer.properties.metadata" + """ + + name: str + """ + '#/components/schemas/NetworkSerializer/properties/name' + "$.components.schemas.NetworkSerializer.properties.name" + """ + + port_security_enabled: bool + """ + '#/components/schemas/NetworkSerializer/properties/port_security_enabled' + "$.components.schemas.NetworkSerializer.properties.port_security_enabled" + """ + + region: str + """ + '#/components/schemas/NetworkSerializer/properties/region' + "$.components.schemas.NetworkSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/NetworkSerializer/properties/region_id' + "$.components.schemas.NetworkSerializer.properties.region_id" + """ + + shared: bool + """ + '#/components/schemas/NetworkSerializer/properties/shared' + "$.components.schemas.NetworkSerializer.properties.shared" + """ + + subnets: List[str] + """ + '#/components/schemas/NetworkSerializer/properties/subnets' + "$.components.schemas.NetworkSerializer.properties.subnets" + """ + + tags: List[Tag] + """ + '#/components/schemas/NetworkSerializer/properties/tags' + "$.components.schemas.NetworkSerializer.properties.tags" + """ + + type: str + """ + '#/components/schemas/NetworkSerializer/properties/type' + "$.components.schemas.NetworkSerializer.properties.type" + """ + + updated_at: datetime + """ + '#/components/schemas/NetworkSerializer/properties/updated_at' + "$.components.schemas.NetworkSerializer.properties.updated_at" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/NetworkSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.NetworkSerializer.properties.creator_task_id.anyOf[0]" + """ + + default: Optional[bool] = None + """ + '#/components/schemas/NetworkSerializer/properties/default/anyOf/0' + "$.components.schemas.NetworkSerializer.properties['default'].anyOf[0]" + """ + + mtu: Optional[int] = None + """ + '#/components/schemas/NetworkSerializer/properties/mtu' + "$.components.schemas.NetworkSerializer.properties.mtu" + """ + + project_id: Optional[int] = None + """ + '#/components/schemas/NetworkSerializer/properties/project_id/anyOf/0' + "$.components.schemas.NetworkSerializer.properties.project_id.anyOf[0]" + """ + + segmentation_id: Optional[int] = None + """ + '#/components/schemas/NetworkSerializer/properties/segmentation_id/anyOf/0' + "$.components.schemas.NetworkSerializer.properties.segmentation_id.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/NetworkSerializer/properties/task_id/anyOf/0' + "$.components.schemas.NetworkSerializer.properties.task_id.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/reserved_fixed_ip.py b/src/gcore/types/cloud/reserved_fixed_ip.py new file mode 100644 index 00000000..be129da5 --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ip.py @@ -0,0 +1,185 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .network import Network +from ..._models import BaseModel + +__all__ = ["ReservedFixedIP", "AllowedAddressPair", "Attachment", "Reservation"] + + +class AllowedAddressPair(BaseModel): + ip_address: str + """ + '#/components/schemas/AllowedAddressPairsSerializer/properties/ip_address/anyOf/0' + "$.components.schemas.AllowedAddressPairsSerializer.properties.ip_address.anyOf[0]" + """ + + mac_address: Optional[str] = None + """ + '#/components/schemas/AllowedAddressPairsSerializer/properties/mac_address/anyOf/0' + "$.components.schemas.AllowedAddressPairsSerializer.properties.mac_address.anyOf[0]" + """ + + +class Attachment(BaseModel): + resource_id: Optional[str] = None + """ + '#/components/schemas/AttachmentSerializer/properties/resource_id/anyOf/0' + "$.components.schemas.AttachmentSerializer.properties.resource_id.anyOf[0]" + """ + + resource_type: Optional[str] = None + """ + '#/components/schemas/AttachmentSerializer/properties/resource_type/anyOf/0' + "$.components.schemas.AttachmentSerializer.properties.resource_type.anyOf[0]" + """ + + +class Reservation(BaseModel): + resource_id: Optional[str] = None + """ + '#/components/schemas/ReservationSerializer/properties/resource_id/anyOf/0' + "$.components.schemas.ReservationSerializer.properties.resource_id.anyOf[0]" + """ + + resource_type: Optional[str] = None + """ + '#/components/schemas/ReservationSerializer/properties/resource_type/anyOf/0' + "$.components.schemas.ReservationSerializer.properties.resource_type.anyOf[0]" + """ + + status: Optional[str] = None + """ + '#/components/schemas/ReservationSerializer/properties/status/anyOf/0' + "$.components.schemas.ReservationSerializer.properties.status.anyOf[0]" + """ + + +class ReservedFixedIP(BaseModel): + allowed_address_pairs: List[AllowedAddressPair] + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/allowed_address_pairs' + "$.components.schemas.ReservedFixedIPSerializer.properties.allowed_address_pairs" + """ + + attachments: List[Attachment] + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/attachments' + "$.components.schemas.ReservedFixedIPSerializer.properties.attachments" + """ + + created_at: datetime + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/created_at' + "$.components.schemas.ReservedFixedIPSerializer.properties.created_at" + """ + + is_external: bool + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/is_external' + "$.components.schemas.ReservedFixedIPSerializer.properties.is_external" + """ + + is_vip: bool + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/is_vip' + "$.components.schemas.ReservedFixedIPSerializer.properties.is_vip" + """ + + name: str + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/name' + "$.components.schemas.ReservedFixedIPSerializer.properties.name" + """ + + network: Network + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/network' + "$.components.schemas.ReservedFixedIPSerializer.properties.network" + """ + + network_id: str + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/network_id' + "$.components.schemas.ReservedFixedIPSerializer.properties.network_id" + """ + + port_id: str + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/port_id' + "$.components.schemas.ReservedFixedIPSerializer.properties.port_id" + """ + + region: str + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/region' + "$.components.schemas.ReservedFixedIPSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/region_id' + "$.components.schemas.ReservedFixedIPSerializer.properties.region_id" + """ + + reservation: Reservation + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/reservation' + "$.components.schemas.ReservedFixedIPSerializer.properties.reservation" + """ + + status: str + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/status' + "$.components.schemas.ReservedFixedIPSerializer.properties.status" + """ + + updated_at: datetime + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/updated_at' + "$.components.schemas.ReservedFixedIPSerializer.properties.updated_at" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.ReservedFixedIPSerializer.properties.creator_task_id.anyOf[0]" + """ + + fixed_ip_address: Optional[str] = None + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/fixed_ip_address/anyOf/0' + "$.components.schemas.ReservedFixedIPSerializer.properties.fixed_ip_address.anyOf[0]" + """ + + fixed_ipv6_address: Optional[str] = None + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/fixed_ipv6_address/anyOf/0' + "$.components.schemas.ReservedFixedIPSerializer.properties.fixed_ipv6_address.anyOf[0]" + """ + + project_id: Optional[int] = None + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/project_id/anyOf/0' + "$.components.schemas.ReservedFixedIPSerializer.properties.project_id.anyOf[0]" + """ + + subnet_id: Optional[str] = None + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/subnet_id/anyOf/0' + "$.components.schemas.ReservedFixedIPSerializer.properties.subnet_id.anyOf[0]" + """ + + subnet_v6_id: Optional[str] = None + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/subnet_v6_id/anyOf/0' + "$.components.schemas.ReservedFixedIPSerializer.properties.subnet_v6_id.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/ReservedFixedIPSerializer/properties/task_id/anyOf/0' + "$.components.schemas.ReservedFixedIPSerializer.properties.task_id.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/reserved_fixed_ip_create_params.py b/src/gcore/types/cloud/reserved_fixed_ip_create_params.py new file mode 100644 index 00000000..d512ebbf --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ip_create_params.py @@ -0,0 +1,192 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .interface_ip_family import InterfaceIPFamily + +__all__ = [ + "ReservedFixedIPCreateParams", + "NewReservedFixedIPExternalSerializer", + "NewReservedFixedIPSpecificSubnetSerializer", + "NewReservedFixedIPAnySubnetSerializer", + "NewReservedFixedIPSpecificIPAddressSerializer", + "NewReservedFixedIPSpecificPortSerializer", +] + + +class NewReservedFixedIPExternalSerializer(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + type: Required[Literal["external"]] + """ + '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.type" + """ + + ip_family: Optional[InterfaceIPFamily] + """ + '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/ip_family/anyOf/0' + "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.ip_family.anyOf[0]" + """ + + is_vip: bool + """ + '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/is_vip' + "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.is_vip" + """ + + +class NewReservedFixedIPSpecificSubnetSerializer(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + subnet_id: Required[str] + """ + '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/subnet_id' + "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.subnet_id" + """ + + type: Required[Literal["subnet"]] + """ + '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.type" + """ + + is_vip: bool + """ + '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/is_vip' + "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.is_vip" + """ + + +class NewReservedFixedIPAnySubnetSerializer(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + network_id: Required[str] + """ + '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/network_id' + "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.network_id" + """ + + type: Required[Literal["any_subnet"]] + """ + '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.type" + """ + + ip_family: Optional[InterfaceIPFamily] + """ + '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/ip_family/anyOf/0' + "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.ip_family.anyOf[0]" + """ + + is_vip: bool + """ + '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/is_vip' + "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.is_vip" + """ + + +class NewReservedFixedIPSpecificIPAddressSerializer(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + ip_address: Required[str] + """ + '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/ip_address' + "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.ip_address" + """ + + network_id: Required[str] + """ + '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/network_id' + "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.network_id" + """ + + type: Required[Literal["ip_address"]] + """ + '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.type" + """ + + is_vip: bool + """ + '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/is_vip' + "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.is_vip" + """ + + +class NewReservedFixedIPSpecificPortSerializer(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + port_id: Required[str] + """ + '#/components/schemas/NewReservedFixedIpSpecificPortSerializer/properties/port_id' + "$.components.schemas.NewReservedFixedIpSpecificPortSerializer.properties.port_id" + """ + + type: Required[Literal["port"]] + """ + '#/components/schemas/NewReservedFixedIpSpecificPortSerializer/properties/type' + "$.components.schemas.NewReservedFixedIpSpecificPortSerializer.properties.type" + """ + + +ReservedFixedIPCreateParams: TypeAlias = Union[ + NewReservedFixedIPExternalSerializer, + NewReservedFixedIPSpecificSubnetSerializer, + NewReservedFixedIPAnySubnetSerializer, + NewReservedFixedIPSpecificIPAddressSerializer, + NewReservedFixedIPSpecificPortSerializer, +] diff --git a/src/gcore/types/cloud/reserved_fixed_ip_list_params.py b/src/gcore/types/cloud/reserved_fixed_ip_list_params.py new file mode 100644 index 00000000..1c883b34 --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ip_list_params.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ReservedFixedIPListParams"] + + +class ReservedFixedIPListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + available_only: bool + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[2]" + """ + + device_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[3]" + """ + + external_only: bool + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[4]" + """ + + internal_only: bool + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[5]" + """ + + ip_address: str + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[6]" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[7]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[8]" + """ + + order_by: str + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[9]" + """ + + vip_only: bool + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[10]" + """ diff --git a/src/gcore/types/cloud/reserved_fixed_ips/__init__.py b/src/gcore/types/cloud/reserved_fixed_ips/__init__.py new file mode 100644 index 00000000..2c8fdba1 --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/__init__.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .ip_assignment import IPAssignment as IPAssignment +from .candidate_port import CandidatePort as CandidatePort +from .connected_port import ConnectedPort as ConnectedPort +from .vip_toggle_params import VipToggleParams as VipToggleParams +from .candidate_port_list import CandidatePortList as CandidatePortList +from .connected_port_list import ConnectedPortList as ConnectedPortList +from .vip_update_connected_ports_params import VipUpdateConnectedPortsParams as VipUpdateConnectedPortsParams +from .vip_replace_connected_ports_params import VipReplaceConnectedPortsParams as VipReplaceConnectedPortsParams diff --git a/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py b/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py new file mode 100644 index 00000000..088f1dd2 --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..network import Network +from ...._models import BaseModel +from .ip_assignment import IPAssignment + +__all__ = ["CandidatePort"] + + +class CandidatePort(BaseModel): + instance_id: str + """ + '#/components/schemas/VIPAttachCandidateSerializer/properties/instance_id' + "$.components.schemas.VIPAttachCandidateSerializer.properties.instance_id" + """ + + instance_name: str + """ + '#/components/schemas/VIPAttachCandidateSerializer/properties/instance_name' + "$.components.schemas.VIPAttachCandidateSerializer.properties.instance_name" + """ + + ip_assignments: List[IPAssignment] + """ + '#/components/schemas/VIPAttachCandidateSerializer/properties/ip_assignments' + "$.components.schemas.VIPAttachCandidateSerializer.properties.ip_assignments" + """ + + network: Network + """ + '#/components/schemas/VIPAttachCandidateSerializer/properties/network' + "$.components.schemas.VIPAttachCandidateSerializer.properties.network" + """ + + port_id: str + """ + '#/components/schemas/VIPAttachCandidateSerializer/properties/port_id' + "$.components.schemas.VIPAttachCandidateSerializer.properties.port_id" + """ diff --git a/src/gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py b/src/gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py new file mode 100644 index 00000000..6382b21f --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .candidate_port import CandidatePort + +__all__ = ["CandidatePortList"] + + +class CandidatePortList(BaseModel): + count: int + """ + '#/components/schemas/VIPAttachCandidateSerializerList/properties/count' + "$.components.schemas.VIPAttachCandidateSerializerList.properties.count" + """ + + results: List[CandidatePort] + """ + '#/components/schemas/VIPAttachCandidateSerializerList/properties/results' + "$.components.schemas.VIPAttachCandidateSerializerList.properties.results" + """ diff --git a/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py b/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py new file mode 100644 index 00000000..ec5bcb5c --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..network import Network +from ...._models import BaseModel +from .ip_assignment import IPAssignment + +__all__ = ["ConnectedPort"] + + +class ConnectedPort(BaseModel): + instance_id: str + """ + '#/components/schemas/ConnectedDevicesVIPSerializer/properties/instance_id' + "$.components.schemas.ConnectedDevicesVIPSerializer.properties.instance_id" + """ + + instance_name: str + """ + '#/components/schemas/ConnectedDevicesVIPSerializer/properties/instance_name' + "$.components.schemas.ConnectedDevicesVIPSerializer.properties.instance_name" + """ + + ip_assignments: List[IPAssignment] + """ + '#/components/schemas/ConnectedDevicesVIPSerializer/properties/ip_assignments' + "$.components.schemas.ConnectedDevicesVIPSerializer.properties.ip_assignments" + """ + + network: Network + """ + '#/components/schemas/ConnectedDevicesVIPSerializer/properties/network' + "$.components.schemas.ConnectedDevicesVIPSerializer.properties.network" + """ + + port_id: str + """ + '#/components/schemas/ConnectedDevicesVIPSerializer/properties/port_id' + "$.components.schemas.ConnectedDevicesVIPSerializer.properties.port_id" + """ diff --git a/src/gcore/types/cloud/reserved_fixed_ips/connected_port_list.py b/src/gcore/types/cloud/reserved_fixed_ips/connected_port_list.py new file mode 100644 index 00000000..1e20a503 --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/connected_port_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .connected_port import ConnectedPort + +__all__ = ["ConnectedPortList"] + + +class ConnectedPortList(BaseModel): + count: int + """ + '#/components/schemas/ConnectedDevicesVIPSerializerList/properties/count' + "$.components.schemas.ConnectedDevicesVIPSerializerList.properties.count" + """ + + results: List[ConnectedPort] + """ + '#/components/schemas/ConnectedDevicesVIPSerializerList/properties/results' + "$.components.schemas.ConnectedDevicesVIPSerializerList.properties.results" + """ diff --git a/src/gcore/types/cloud/reserved_fixed_ips/ip_assignment.py b/src/gcore/types/cloud/reserved_fixed_ips/ip_assignment.py new file mode 100644 index 00000000..211eefaf --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/ip_assignment.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..subnet import Subnet +from ...._models import BaseModel + +__all__ = ["IPAssignment"] + + +class IPAssignment(BaseModel): + ip_address: str + """ + '#/components/schemas/PortIpWithSubnetSerializer/properties/ip_address' + "$.components.schemas.PortIpWithSubnetSerializer.properties.ip_address" + """ + + subnet: Subnet + """ + '#/components/schemas/PortIpWithSubnetSerializer/properties/subnet' + "$.components.schemas.PortIpWithSubnetSerializer.properties.subnet" + """ + + subnet_id: str + """ + '#/components/schemas/PortIpWithSubnetSerializer/properties/subnet_id' + "$.components.schemas.PortIpWithSubnetSerializer.properties.subnet_id" + """ diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py b/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py new file mode 100644 index 00000000..636cea7d --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import TypedDict + +__all__ = ["VipReplaceConnectedPortsParams"] + + +class VipReplaceConnectedPortsParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[1].schema" + """ + + port_ids: List[str] + """ + '#/components/schemas/PortIDsForVIPSerializer/properties/port_ids' + "$.components.schemas.PortIDsForVIPSerializer.properties.port_ids" + """ diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip_toggle_params.py b/src/gcore/types/cloud/reserved_fixed_ips/vip_toggle_params.py new file mode 100644 index 00000000..09ed473d --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip_toggle_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["VipToggleParams"] + + +class VipToggleParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[1].schema" + """ + + is_vip: Required[bool] + """ + '#/components/schemas/PatchReservedFixedIPSerializer/properties/is_vip' + "$.components.schemas.PatchReservedFixedIPSerializer.properties.is_vip" + """ diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py b/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py new file mode 100644 index 00000000..541b8e3b --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import TypedDict + +__all__ = ["VipUpdateConnectedPortsParams"] + + +class VipUpdateConnectedPortsParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/0/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/1/schema' + "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[1].schema" + """ + + port_ids: List[str] + """ + '#/components/schemas/PortIDsForVIPSerializer/properties/port_ids' + "$.components.schemas.PortIDsForVIPSerializer.properties.port_ids" + """ diff --git a/src/gcore/types/cloud/subnet.py b/src/gcore/types/cloud/subnet.py new file mode 100644 index 00000000..1d2e4f1c --- /dev/null +++ b/src/gcore/types/cloud/subnet.py @@ -0,0 +1,152 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .tag import Tag +from ..._models import BaseModel + +__all__ = ["Subnet", "HostRoute"] + + +class HostRoute(BaseModel): + destination: str + """ + '#/components/schemas/NeutronRouteSerializer/properties/destination' + "$.components.schemas.NeutronRouteSerializer.properties.destination" + """ + + nexthop: str + """ + '#/components/schemas/NeutronRouteSerializer/properties/nexthop' + "$.components.schemas.NeutronRouteSerializer.properties.nexthop" + """ + + +class Subnet(BaseModel): + cidr: str + """ + '#/components/schemas/SubnetSerializer/properties/cidr' + "$.components.schemas.SubnetSerializer.properties.cidr" + """ + + created_at: datetime + """ + '#/components/schemas/SubnetSerializer/properties/created_at' + "$.components.schemas.SubnetSerializer.properties.created_at" + """ + + enable_dhcp: bool + """ + '#/components/schemas/SubnetSerializer/properties/enable_dhcp' + "$.components.schemas.SubnetSerializer.properties.enable_dhcp" + """ + + ip_version: Literal[4, 6] + """ + '#/components/schemas/SubnetSerializer/properties/ip_version' + "$.components.schemas.SubnetSerializer.properties.ip_version" + """ + + name: str + """ + '#/components/schemas/SubnetSerializer/properties/name' + "$.components.schemas.SubnetSerializer.properties.name" + """ + + network_id: str + """ + '#/components/schemas/SubnetSerializer/properties/network_id' + "$.components.schemas.SubnetSerializer.properties.network_id" + """ + + project_id: int + """ + '#/components/schemas/SubnetSerializer/properties/project_id' + "$.components.schemas.SubnetSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/SubnetSerializer/properties/region' + "$.components.schemas.SubnetSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/SubnetSerializer/properties/region_id' + "$.components.schemas.SubnetSerializer.properties.region_id" + """ + + tags: List[Tag] + """ + '#/components/schemas/SubnetSerializer/properties/tags' + "$.components.schemas.SubnetSerializer.properties.tags" + """ + + updated_at: datetime + """ + '#/components/schemas/SubnetSerializer/properties/updated_at' + "$.components.schemas.SubnetSerializer.properties.updated_at" + """ + + id: Optional[str] = None + """ + '#/components/schemas/SubnetSerializer/properties/id/anyOf/0' + "$.components.schemas.SubnetSerializer.properties.id.anyOf[0]" + """ + + available_ips: Optional[int] = None + """ + '#/components/schemas/SubnetSerializer/properties/available_ips/anyOf/0' + "$.components.schemas.SubnetSerializer.properties.available_ips.anyOf[0]" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/SubnetSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.SubnetSerializer.properties.creator_task_id.anyOf[0]" + """ + + dns_nameservers: Optional[List[str]] = None + """ + '#/components/schemas/SubnetSerializer/properties/dns_nameservers/anyOf/0' + "$.components.schemas.SubnetSerializer.properties.dns_nameservers.anyOf[0]" + """ + + gateway_ip: Optional[str] = None + """ + '#/components/schemas/SubnetSerializer/properties/gateway_ip/anyOf/0' + "$.components.schemas.SubnetSerializer.properties.gateway_ip.anyOf[0]" + """ + + has_router: Optional[bool] = None + """ + '#/components/schemas/SubnetSerializer/properties/has_router' + "$.components.schemas.SubnetSerializer.properties.has_router" + """ + + host_routes: Optional[List[HostRoute]] = None + """ + '#/components/schemas/SubnetSerializer/properties/host_routes/anyOf/0' + "$.components.schemas.SubnetSerializer.properties.host_routes.anyOf[0]" + """ + + metadata: Optional[List[Tag]] = None + """ + '#/components/schemas/SubnetSerializer/properties/metadata' + "$.components.schemas.SubnetSerializer.properties.metadata" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/SubnetSerializer/properties/task_id/anyOf/0' + "$.components.schemas.SubnetSerializer.properties.task_id.anyOf[0]" + """ + + total_ips: Optional[int] = None + """ + '#/components/schemas/SubnetSerializer/properties/total_ips/anyOf/0' + "$.components.schemas.SubnetSerializer.properties.total_ips.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/tag.py b/src/gcore/types/cloud/tag.py new file mode 100644 index 00000000..9299a626 --- /dev/null +++ b/src/gcore/types/cloud/tag.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["Tag"] + + +class Tag(BaseModel): + key: str + """ + '#/components/schemas/TagSerializer/properties/key' + "$.components.schemas.TagSerializer.properties.key" + """ + + read_only: bool + """ + '#/components/schemas/TagSerializer/properties/read_only' + "$.components.schemas.TagSerializer.properties.read_only" + """ + + value: str + """ + '#/components/schemas/TagSerializer/properties/value' + "$.components.schemas.TagSerializer.properties.value" + """ diff --git a/tests/api_resources/cloud/reserved_fixed_ips/__init__.py b/tests/api_resources/cloud/reserved_fixed_ips/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/reserved_fixed_ips/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/reserved_fixed_ips/test_vip.py b/tests/api_resources/cloud/reserved_fixed_ips/test_vip.py new file mode 100644 index 00000000..5970928c --- /dev/null +++ b/tests/api_resources/cloud/reserved_fixed_ips/test_vip.py @@ -0,0 +1,534 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import ReservedFixedIP +from gcore.types.cloud.reserved_fixed_ips import ( + CandidatePortList, + ConnectedPortList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestVip: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list_candidate_ports(self, client: Gcore) -> None: + vip = client.cloud.reserved_fixed_ips.vip.list_candidate_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(CandidatePortList, vip, path=["response"]) + + @parametrize + def test_raw_response_list_candidate_ports(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.vip.with_raw_response.list_candidate_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + vip = response.parse() + assert_matches_type(CandidatePortList, vip, path=["response"]) + + @parametrize + def test_streaming_response_list_candidate_ports(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.vip.with_streaming_response.list_candidate_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + vip = response.parse() + assert_matches_type(CandidatePortList, vip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list_candidate_ports(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.reserved_fixed_ips.vip.with_raw_response.list_candidate_ports( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_list_connected_ports(self, client: Gcore) -> None: + vip = client.cloud.reserved_fixed_ips.vip.list_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + def test_raw_response_list_connected_ports(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.vip.with_raw_response.list_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + vip = response.parse() + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + def test_streaming_response_list_connected_ports(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.vip.with_streaming_response.list_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + vip = response.parse() + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list_connected_ports(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.reserved_fixed_ips.vip.with_raw_response.list_connected_ports( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_replace_connected_ports(self, client: Gcore) -> None: + vip = client.cloud.reserved_fixed_ips.vip.replace_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + def test_method_replace_connected_ports_with_all_params(self, client: Gcore) -> None: + vip = client.cloud.reserved_fixed_ips.vip.replace_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], + ) + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + def test_raw_response_replace_connected_ports(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.vip.with_raw_response.replace_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + vip = response.parse() + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + def test_streaming_response_replace_connected_ports(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.vip.with_streaming_response.replace_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + vip = response.parse() + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_replace_connected_ports(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.reserved_fixed_ips.vip.with_raw_response.replace_connected_ports( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_toggle(self, client: Gcore) -> None: + vip = client.cloud.reserved_fixed_ips.vip.toggle( + port_id="port_id", + project_id=0, + region_id=0, + is_vip=True, + ) + assert_matches_type(ReservedFixedIP, vip, path=["response"]) + + @parametrize + def test_raw_response_toggle(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.vip.with_raw_response.toggle( + port_id="port_id", + project_id=0, + region_id=0, + is_vip=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + vip = response.parse() + assert_matches_type(ReservedFixedIP, vip, path=["response"]) + + @parametrize + def test_streaming_response_toggle(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.vip.with_streaming_response.toggle( + port_id="port_id", + project_id=0, + region_id=0, + is_vip=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + vip = response.parse() + assert_matches_type(ReservedFixedIP, vip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_toggle(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.reserved_fixed_ips.vip.with_raw_response.toggle( + port_id="", + project_id=0, + region_id=0, + is_vip=True, + ) + + @parametrize + def test_method_update_connected_ports(self, client: Gcore) -> None: + vip = client.cloud.reserved_fixed_ips.vip.update_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + def test_method_update_connected_ports_with_all_params(self, client: Gcore) -> None: + vip = client.cloud.reserved_fixed_ips.vip.update_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], + ) + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + def test_raw_response_update_connected_ports(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.vip.with_raw_response.update_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + vip = response.parse() + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + def test_streaming_response_update_connected_ports(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.vip.with_streaming_response.update_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + vip = response.parse() + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update_connected_ports(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.reserved_fixed_ips.vip.with_raw_response.update_connected_ports( + port_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncVip: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list_candidate_ports(self, async_client: AsyncGcore) -> None: + vip = await async_client.cloud.reserved_fixed_ips.vip.list_candidate_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(CandidatePortList, vip, path=["response"]) + + @parametrize + async def test_raw_response_list_candidate_ports(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.list_candidate_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + vip = await response.parse() + assert_matches_type(CandidatePortList, vip, path=["response"]) + + @parametrize + async def test_streaming_response_list_candidate_ports(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.vip.with_streaming_response.list_candidate_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + vip = await response.parse() + assert_matches_type(CandidatePortList, vip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list_candidate_ports(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.list_candidate_ports( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_list_connected_ports(self, async_client: AsyncGcore) -> None: + vip = await async_client.cloud.reserved_fixed_ips.vip.list_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + async def test_raw_response_list_connected_ports(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.list_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + vip = await response.parse() + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + async def test_streaming_response_list_connected_ports(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.vip.with_streaming_response.list_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + vip = await response.parse() + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list_connected_ports(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.list_connected_ports( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_replace_connected_ports(self, async_client: AsyncGcore) -> None: + vip = await async_client.cloud.reserved_fixed_ips.vip.replace_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + async def test_method_replace_connected_ports_with_all_params(self, async_client: AsyncGcore) -> None: + vip = await async_client.cloud.reserved_fixed_ips.vip.replace_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], + ) + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + async def test_raw_response_replace_connected_ports(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.replace_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + vip = await response.parse() + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + async def test_streaming_response_replace_connected_ports(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.vip.with_streaming_response.replace_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + vip = await response.parse() + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_replace_connected_ports(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.replace_connected_ports( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_toggle(self, async_client: AsyncGcore) -> None: + vip = await async_client.cloud.reserved_fixed_ips.vip.toggle( + port_id="port_id", + project_id=0, + region_id=0, + is_vip=True, + ) + assert_matches_type(ReservedFixedIP, vip, path=["response"]) + + @parametrize + async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.toggle( + port_id="port_id", + project_id=0, + region_id=0, + is_vip=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + vip = await response.parse() + assert_matches_type(ReservedFixedIP, vip, path=["response"]) + + @parametrize + async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.vip.with_streaming_response.toggle( + port_id="port_id", + project_id=0, + region_id=0, + is_vip=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + vip = await response.parse() + assert_matches_type(ReservedFixedIP, vip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_toggle(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.toggle( + port_id="", + project_id=0, + region_id=0, + is_vip=True, + ) + + @parametrize + async def test_method_update_connected_ports(self, async_client: AsyncGcore) -> None: + vip = await async_client.cloud.reserved_fixed_ips.vip.update_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + async def test_method_update_connected_ports_with_all_params(self, async_client: AsyncGcore) -> None: + vip = await async_client.cloud.reserved_fixed_ips.vip.update_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], + ) + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + async def test_raw_response_update_connected_ports(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.update_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + vip = await response.parse() + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + @parametrize + async def test_streaming_response_update_connected_ports(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.vip.with_streaming_response.update_connected_ports( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + vip = await response.parse() + assert_matches_type(ConnectedPortList, vip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update_connected_ports(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.update_connected_ports( + port_id="", + project_id=0, + region_id=0, + ) diff --git a/tests/api_resources/cloud/test_reserved_fixed_ips.py b/tests/api_resources/cloud/test_reserved_fixed_ips.py new file mode 100644 index 00000000..b4bf37d3 --- /dev/null +++ b/tests/api_resources/cloud/test_reserved_fixed_ips.py @@ -0,0 +1,804 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import ( + TaskIDList, + ReservedFixedIP, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestReservedFixedIPs: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create_overload_1(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + type="external", + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + type="external", + ip_family="dual", + is_vip=False, + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_raw_response_create_overload_1(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.with_raw_response.create( + project_id=0, + region_id=0, + type="external", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_1(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.with_streaming_response.create( + project_id=0, + region_id=0, + type="external", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_2(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="subnet", + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="subnet", + is_vip=False, + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_raw_response_create_overload_2(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.with_raw_response.create( + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="subnet", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_2(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.with_streaming_response.create( + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="subnet", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_3(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="any_subnet", + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_3(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="any_subnet", + ip_family="dual", + is_vip=False, + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_raw_response_create_overload_3(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.with_raw_response.create( + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="any_subnet", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_3(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.with_streaming_response.create( + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="any_subnet", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_4(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + ip_address="192.168.123.20", + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="ip_address", + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_4(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + ip_address="192.168.123.20", + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="ip_address", + is_vip=False, + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_raw_response_create_overload_4(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.with_raw_response.create( + project_id=0, + region_id=0, + ip_address="192.168.123.20", + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="ip_address", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_4(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.with_streaming_response.create( + project_id=0, + region_id=0, + ip_address="192.168.123.20", + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="ip_address", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_5(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + port_id="77f1394f-2a18-4686-a2eb-acea25146374", + type="port", + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_raw_response_create_overload_5(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.with_raw_response.create( + project_id=0, + region_id=0, + port_id="77f1394f-2a18-4686-a2eb-acea25146374", + type="port", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_5(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.with_streaming_response.create( + project_id=0, + region_id=0, + port_id="77f1394f-2a18-4686-a2eb-acea25146374", + type="port", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.list( + project_id=0, + region_id=0, + ) + assert_matches_type(SyncOffsetPage[ReservedFixedIP], reserved_fixed_ip, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.list( + project_id=0, + region_id=0, + available_only=True, + device_id="device_id", + external_only=True, + internal_only=True, + ip_address="ip_address", + limit=0, + offset=0, + order_by="order_by", + vip_only=True, + ) + assert_matches_type(SyncOffsetPage[ReservedFixedIP], reserved_fixed_ip, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = response.parse() + assert_matches_type(SyncOffsetPage[ReservedFixedIP], reserved_fixed_ip, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = response.parse() + assert_matches_type(SyncOffsetPage[ReservedFixedIP], reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.delete( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.with_raw_response.delete( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.with_streaming_response.delete( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.reserved_fixed_ips.with_raw_response.delete( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.get( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ReservedFixedIP, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.with_raw_response.get( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = response.parse() + assert_matches_type(ReservedFixedIP, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.with_streaming_response.get( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = response.parse() + assert_matches_type(ReservedFixedIP, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.reserved_fixed_ips.with_raw_response.get( + port_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncReservedFixedIPs: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create_overload_1(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + type="external", + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + type="external", + ip_family="dual", + is_vip=False, + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.with_raw_response.create( + project_id=0, + region_id=0, + type="external", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = await response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.with_streaming_response.create( + project_id=0, + region_id=0, + type="external", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = await response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_2(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="subnet", + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="subnet", + is_vip=False, + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.with_raw_response.create( + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="subnet", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = await response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.with_streaming_response.create( + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="subnet", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = await response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_3(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="any_subnet", + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="any_subnet", + ip_family="dual", + is_vip=False, + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_3(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.with_raw_response.create( + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="any_subnet", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = await response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_3(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.with_streaming_response.create( + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="any_subnet", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = await response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_4(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + ip_address="192.168.123.20", + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="ip_address", + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_4(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + ip_address="192.168.123.20", + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="ip_address", + is_vip=False, + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_4(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.with_raw_response.create( + project_id=0, + region_id=0, + ip_address="192.168.123.20", + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="ip_address", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = await response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_4(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.with_streaming_response.create( + project_id=0, + region_id=0, + ip_address="192.168.123.20", + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + type="ip_address", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = await response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_5(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.create( + project_id=0, + region_id=0, + port_id="77f1394f-2a18-4686-a2eb-acea25146374", + type="port", + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_5(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.with_raw_response.create( + project_id=0, + region_id=0, + port_id="77f1394f-2a18-4686-a2eb-acea25146374", + type="port", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = await response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_5(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.with_streaming_response.create( + project_id=0, + region_id=0, + port_id="77f1394f-2a18-4686-a2eb-acea25146374", + type="port", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = await response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.list( + project_id=0, + region_id=0, + ) + assert_matches_type(AsyncOffsetPage[ReservedFixedIP], reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.list( + project_id=0, + region_id=0, + available_only=True, + device_id="device_id", + external_only=True, + internal_only=True, + ip_address="ip_address", + limit=0, + offset=0, + order_by="order_by", + vip_only=True, + ) + assert_matches_type(AsyncOffsetPage[ReservedFixedIP], reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = await response.parse() + assert_matches_type(AsyncOffsetPage[ReservedFixedIP], reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = await response.parse() + assert_matches_type(AsyncOffsetPage[ReservedFixedIP], reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.delete( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.with_raw_response.delete( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = await response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.with_streaming_response.delete( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = await response.parse() + assert_matches_type(TaskIDList, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.reserved_fixed_ips.with_raw_response.delete( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.get( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ReservedFixedIP, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.with_raw_response.get( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = await response.parse() + assert_matches_type(ReservedFixedIP, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.with_streaming_response.get( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = await response.parse() + assert_matches_type(ReservedFixedIP, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.reserved_fixed_ips.with_raw_response.get( + port_id="", + project_id=0, + region_id=0, + ) From 387fa0a8949e1acdac5aa8cf5e71e6f419fd7771 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 21 Apr 2025 10:44:20 +0000 Subject: [PATCH 042/592] Rename SSH key model for consistency --- .stats.yml | 2 +- api.md | 4 ++-- src/gcore/resources/cloud/ssh_keys.py | 10 +++++----- src/gcore/types/cloud/__init__.py | 2 +- .../{created_ssh_key.py => ssh_key_created.py} | 4 ++-- tests/api_resources/cloud/test_ssh_keys.py | 18 +++++++++--------- 6 files changed, 20 insertions(+), 20 deletions(-) rename src/gcore/types/cloud/{created_ssh_key.py => ssh_key_created.py} (96%) diff --git a/.stats.yml b/.stats.yml index 573ccdbf..087bb149 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 38 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7ea2e090a0751a81d5dac2bd5d8aeab5fac63679cfa076ebd4b8364ae4804406.yml openapi_spec_hash: 63e301398fd531ad20a6f5fcaf9a7a0d -config_hash: 4e7c173b37b44c206aff9f6a90386bef +config_hash: 8f50025d32874755317740dcce522962 diff --git a/api.md b/api.md index 68f014f9..de17358d 100644 --- a/api.md +++ b/api.md @@ -136,12 +136,12 @@ Methods: Types: ```python -from gcore.types.cloud import CreatedSSHKey, SSHKey +from gcore.types.cloud import SSHKey, SSHKeyCreated ``` Methods: -- client.cloud.ssh_keys.create(\*, project_id, \*\*params) -> CreatedSSHKey +- client.cloud.ssh_keys.create(\*, project_id, \*\*params) -> SSHKeyCreated - 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 diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 0ecb489f..fdf98607 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -23,7 +23,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.created_ssh_key import CreatedSSHKey +from ...types.cloud.ssh_key_created import SSHKeyCreated __all__ = ["SSHKeysResource", "AsyncSSHKeysResource"] @@ -61,7 +61,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CreatedSSHKey: + ) -> SSHKeyCreated: """ To generate a key, omit the public_key parameter from the request body @@ -101,7 +101,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CreatedSSHKey, + cast_to=SSHKeyCreated, ) def update( @@ -330,7 +330,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CreatedSSHKey: + ) -> SSHKeyCreated: """ To generate a key, omit the public_key parameter from the request body @@ -370,7 +370,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CreatedSSHKey, + cast_to=SSHKeyCreated, ) async def update( diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 8c45a2bb..9c66b274 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -12,7 +12,7 @@ from .ssh_key import SSHKey as SSHKey from .ip_ranges import IPRanges as IPRanges from .task_id_list import TaskIDList as TaskIDList -from .created_ssh_key import CreatedSSHKey as CreatedSSHKey +from .ssh_key_created import SSHKeyCreated as SSHKeyCreated from .operating_status import OperatingStatus as OperatingStatus from .task_list_params import TaskListParams as TaskListParams from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP diff --git a/src/gcore/types/cloud/created_ssh_key.py b/src/gcore/types/cloud/ssh_key_created.py similarity index 96% rename from src/gcore/types/cloud/created_ssh_key.py rename to src/gcore/types/cloud/ssh_key_created.py index 70ff4c5c..ae4d3436 100644 --- a/src/gcore/types/cloud/created_ssh_key.py +++ b/src/gcore/types/cloud/ssh_key_created.py @@ -6,10 +6,10 @@ from ..._models import BaseModel -__all__ = ["CreatedSSHKey"] +__all__ = ["SSHKeyCreated"] -class CreatedSSHKey(BaseModel): +class SSHKeyCreated(BaseModel): id: str """ '#/components/schemas/CreatedSSHKeySerializer/properties/id' diff --git a/tests/api_resources/cloud/test_ssh_keys.py b/tests/api_resources/cloud/test_ssh_keys.py index 66bff585..606308f7 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, CreatedSSHKey +from gcore.types.cloud import SSHKey, SSHKeyCreated 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(CreatedSSHKey, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, 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(CreatedSSHKey, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, 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(CreatedSSHKey, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, 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(CreatedSSHKey, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -243,7 +243,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: project_id=1, name="my-ssh-key", ) - assert_matches_type(CreatedSSHKey, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -253,7 +253,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(CreatedSSHKey, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -265,7 +265,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(CreatedSSHKey, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -277,7 +277,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(CreatedSSHKey, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) assert cast(Any, response.is_closed) is True From 56de8493cd53591ff05939a069577313b65ed55e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 08:10:03 +0000 Subject: [PATCH 043/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 087bb149..a0c0967e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 38 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7ea2e090a0751a81d5dac2bd5d8aeab5fac63679cfa076ebd4b8364ae4804406.yml -openapi_spec_hash: 63e301398fd531ad20a6f5fcaf9a7a0d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-998a58446557c554357001c0ac6e332bee190b0c543459ee35fce91de40efb7d.yml +openapi_spec_hash: 50c6c06469f5fdbf07bf70cacba0fa5b config_hash: 8f50025d32874755317740dcce522962 From 846d20238cae0b1ca2864e1cf285706946c131ac Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 12:28:55 +0000 Subject: [PATCH 044/592] GCLOUD2-18675 Refined load balancer shared models --- .stats.yml | 2 +- api.md | 29 +++++-------------- src/gcore/types/cloud/__init__.py | 4 +-- ...y => load_balancer_member_connectivity.py} | 4 +-- .../cloud/load_balancer_operating_status.py | 7 +++++ src/gcore/types/cloud/operating_status.py | 7 ----- 6 files changed, 20 insertions(+), 33 deletions(-) rename src/gcore/types/cloud/{member_connectivity.py => load_balancer_member_connectivity.py} (55%) create mode 100644 src/gcore/types/cloud/load_balancer_operating_status.py delete mode 100644 src/gcore/types/cloud/operating_status.py diff --git a/.stats.yml b/.stats.yml index a0c0967e..52ce37ad 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 38 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-998a58446557c554357001c0ac6e332bee190b0c543459ee35fce91de40efb7d.yml openapi_spec_hash: 50c6c06469f5fdbf07bf70cacba0fa5b -config_hash: 8f50025d32874755317740dcce522962 +config_hash: e8913b2ee6ff7e9176a52b12fdef3403 diff --git a/api.md b/api.md index de17358d..0e8d6286 100644 --- a/api.md +++ b/api.md @@ -4,41 +4,28 @@ Types: ```python from gcore.types.cloud import ( - ClientProfile, - ClientProfileField, - ClientProfileTemplate, - ClientProfileTemplateField, + DDOSProfile, + DDOSProfileField, + DDOSProfileOptionList, DDOSProfileStatus, + DDOSProfileTemplate, + DDOSProfileTemplateField, FlavorHardwareDescription, FloatingIP, - FloatingIPInterfaceNewInstance, - FloatingIPNewInterface, FloatingIPStatus, InstanceMetricsTimeUnit, InterfaceIPFamily, - ItemPrice, - LaasIndexRetentionPolicy, - Listener, LoadBalancer, - LoadBalancerFlavor, LoadBalancerInstanceRole, - LoadBalancerLogging, - LoadBalancerStatList, - MandatoryID, - MemberConnectivity, - Name, + LoadBalancerMemberConnectivity, + LoadBalancerOperatingStatus, + LoadBalancerStatistics, Network, - NetworkPortFixedIP, - OperatingStatus, - ProfileOptionList, ProvisioningStatus, - RawMetadata, Subnet, Tag, TagList, - TagUpdateList, TaskIDList, - VrrpIP, ) ``` diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 9c66b274..4ecbbdcf 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -13,13 +13,11 @@ from .ip_ranges import IPRanges as IPRanges from .task_id_list import TaskIDList as TaskIDList from .ssh_key_created import SSHKeyCreated as SSHKeyCreated -from .operating_status import OperatingStatus as OperatingStatus from .task_list_params import TaskListParams as TaskListParams from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP from .floating_ip_status import FloatingIPStatus as FloatingIPStatus from .region_list_params import RegionListParams as RegionListParams from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily -from .member_connectivity import MemberConnectivity as MemberConnectivity from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams @@ -37,5 +35,7 @@ from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams +from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams +from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams diff --git a/src/gcore/types/cloud/member_connectivity.py b/src/gcore/types/cloud/load_balancer_member_connectivity.py similarity index 55% rename from src/gcore/types/cloud/member_connectivity.py rename to src/gcore/types/cloud/load_balancer_member_connectivity.py index 64e40b1c..d33a72da 100644 --- a/src/gcore/types/cloud/member_connectivity.py +++ b/src/gcore/types/cloud/load_balancer_member_connectivity.py @@ -2,6 +2,6 @@ from typing_extensions import Literal, TypeAlias -__all__ = ["MemberConnectivity"] +__all__ = ["LoadBalancerMemberConnectivity"] -MemberConnectivity: TypeAlias = Literal["L2", "L3"] +LoadBalancerMemberConnectivity: TypeAlias = Literal["L2", "L3"] diff --git a/src/gcore/types/cloud/load_balancer_operating_status.py b/src/gcore/types/cloud/load_balancer_operating_status.py new file mode 100644 index 00000000..28dd7a7f --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_operating_status.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["LoadBalancerOperatingStatus"] + +LoadBalancerOperatingStatus: TypeAlias = Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"] diff --git a/src/gcore/types/cloud/operating_status.py b/src/gcore/types/cloud/operating_status.py deleted file mode 100644 index 9c2c10d2..00000000 --- a/src/gcore/types/cloud/operating_status.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["OperatingStatus"] - -OperatingStatus: TypeAlias = Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"] From 08349f84c96fd824be2b69e3f418fd73a2040a54 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 13:55:10 +0000 Subject: [PATCH 045/592] GCLOUD2-18670 Add shared models for networks --- .stats.yml | 2 +- api.md | 5 +++++ src/gcore/types/cloud/__init__.py | 2 ++ src/gcore/types/cloud/ip_version.py | 7 +++++++ src/gcore/types/cloud/neutron_route.py | 20 ++++++++++++++++++++ src/gcore/types/cloud/subnet.py | 23 +++++------------------ 6 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 src/gcore/types/cloud/ip_version.py create mode 100644 src/gcore/types/cloud/neutron_route.py diff --git a/.stats.yml b/.stats.yml index 52ce37ad..9ad5f59a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 38 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-998a58446557c554357001c0ac6e332bee190b0c543459ee35fce91de40efb7d.yml openapi_spec_hash: 50c6c06469f5fdbf07bf70cacba0fa5b -config_hash: e8913b2ee6ff7e9176a52b12fdef3403 +config_hash: 1f41ab4aaca156b85583d25cff144570 diff --git a/api.md b/api.md index 0e8d6286..ae4c5413 100644 --- a/api.md +++ b/api.md @@ -15,16 +15,21 @@ from gcore.types.cloud import ( FloatingIPStatus, InstanceMetricsTimeUnit, InterfaceIPFamily, + IPVersion, LoadBalancer, LoadBalancerInstanceRole, LoadBalancerMemberConnectivity, LoadBalancerOperatingStatus, LoadBalancerStatistics, Network, + NetworkAnySubnetFip, + NetworkSubnetFip, + NeutronRoute, ProvisioningStatus, Subnet, Tag, TagList, + TagUpdateList, TaskIDList, ) ``` diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 4ecbbdcf..d4383ba2 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -11,7 +11,9 @@ from .project import Project as Project from .ssh_key import SSHKey as SSHKey from .ip_ranges import IPRanges as IPRanges +from .ip_version import IPVersion as IPVersion from .task_id_list import TaskIDList as TaskIDList +from .neutron_route import NeutronRoute as NeutronRoute from .ssh_key_created import SSHKeyCreated as SSHKeyCreated from .task_list_params import TaskListParams as TaskListParams from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP diff --git a/src/gcore/types/cloud/ip_version.py b/src/gcore/types/cloud/ip_version.py new file mode 100644 index 00000000..be9bb0fc --- /dev/null +++ b/src/gcore/types/cloud/ip_version.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["IPVersion"] + +IPVersion: TypeAlias = Literal[4, 6] diff --git a/src/gcore/types/cloud/neutron_route.py b/src/gcore/types/cloud/neutron_route.py new file mode 100644 index 00000000..3cb3370b --- /dev/null +++ b/src/gcore/types/cloud/neutron_route.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["NeutronRoute"] + + +class NeutronRoute(BaseModel): + destination: str + """ + '#/components/schemas/NeutronRouteSerializer/properties/destination' + "$.components.schemas.NeutronRouteSerializer.properties.destination" + """ + + nexthop: str + """ + '#/components/schemas/NeutronRouteSerializer/properties/nexthop' + "$.components.schemas.NeutronRouteSerializer.properties.nexthop" + """ diff --git a/src/gcore/types/cloud/subnet.py b/src/gcore/types/cloud/subnet.py index 1d2e4f1c..943cee49 100644 --- a/src/gcore/types/cloud/subnet.py +++ b/src/gcore/types/cloud/subnet.py @@ -2,26 +2,13 @@ from typing import List, Optional from datetime import datetime -from typing_extensions import Literal from .tag import Tag from ..._models import BaseModel +from .ip_version import IPVersion +from .neutron_route import NeutronRoute -__all__ = ["Subnet", "HostRoute"] - - -class HostRoute(BaseModel): - destination: str - """ - '#/components/schemas/NeutronRouteSerializer/properties/destination' - "$.components.schemas.NeutronRouteSerializer.properties.destination" - """ - - nexthop: str - """ - '#/components/schemas/NeutronRouteSerializer/properties/nexthop' - "$.components.schemas.NeutronRouteSerializer.properties.nexthop" - """ +__all__ = ["Subnet"] class Subnet(BaseModel): @@ -43,7 +30,7 @@ class Subnet(BaseModel): "$.components.schemas.SubnetSerializer.properties.enable_dhcp" """ - ip_version: Literal[4, 6] + ip_version: IPVersion """ '#/components/schemas/SubnetSerializer/properties/ip_version' "$.components.schemas.SubnetSerializer.properties.ip_version" @@ -127,7 +114,7 @@ class Subnet(BaseModel): "$.components.schemas.SubnetSerializer.properties.has_router" """ - host_routes: Optional[List[HostRoute]] = None + host_routes: Optional[List[NeutronRoute]] = None """ '#/components/schemas/SubnetSerializer/properties/host_routes/anyOf/0' "$.components.schemas.SubnetSerializer.properties.host_routes.anyOf[0]" From cc2926fa35c1a9859817a15ae9fd5c729c8db9af Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 14:40:33 +0000 Subject: [PATCH 046/592] GCLOUD2-18674 Add cloud floating ips resource --- .stats.yml | 4 +- api.md | 17 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + src/gcore/resources/cloud/floating_ips.py | 848 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 14 + src/gcore/types/cloud/ddos_profile.py | 61 ++ src/gcore/types/cloud/ddos_profile_field.py | 75 ++ .../types/cloud/ddos_profile_option_list.py | 21 + src/gcore/types/cloud/ddos_profile_status.py | 20 + .../types/cloud/ddos_profile_template.py | 34 + .../cloud/ddos_profile_template_field.py | 51 ++ src/gcore/types/cloud/floating_ip.py | 120 +++ .../types/cloud/floating_ip_assign_params.py | 34 + .../types/cloud/floating_ip_create_params.py | 42 + .../types/cloud/floating_ip_list_params.py | 46 + .../types/cloud/floating_ip_list_response.py | 421 +++++++++ src/gcore/types/cloud/load_balancer.py | 265 ++++++ .../types/cloud/load_balancer_statistics.py | 38 + .../types/cloud/tag_update_list_param.py | 10 + .../api_resources/cloud/test_floating_ips.py | 607 +++++++++++++ 21 files changed, 2772 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/floating_ips.py create mode 100644 src/gcore/types/cloud/ddos_profile.py create mode 100644 src/gcore/types/cloud/ddos_profile_field.py create mode 100644 src/gcore/types/cloud/ddos_profile_option_list.py create mode 100644 src/gcore/types/cloud/ddos_profile_status.py create mode 100644 src/gcore/types/cloud/ddos_profile_template.py create mode 100644 src/gcore/types/cloud/ddos_profile_template_field.py create mode 100644 src/gcore/types/cloud/floating_ip.py create mode 100644 src/gcore/types/cloud/floating_ip_assign_params.py create mode 100644 src/gcore/types/cloud/floating_ip_create_params.py create mode 100644 src/gcore/types/cloud/floating_ip_list_params.py create mode 100644 src/gcore/types/cloud/floating_ip_list_response.py create mode 100644 src/gcore/types/cloud/load_balancer.py create mode 100644 src/gcore/types/cloud/load_balancer_statistics.py create mode 100644 src/gcore/types/cloud/tag_update_list_param.py create mode 100644 tests/api_resources/cloud/test_floating_ips.py diff --git a/.stats.yml b/.stats.yml index 9ad5f59a..3f8c676b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 38 +configured_endpoints: 44 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-998a58446557c554357001c0ac6e332bee190b0c543459ee35fce91de40efb7d.yml openapi_spec_hash: 50c6c06469f5fdbf07bf70cacba0fa5b -config_hash: 1f41ab4aaca156b85583d25cff144570 +config_hash: 441bd3f8b04b2f3430ae96a6db6deefb diff --git a/api.md b/api.md index ae4c5413..0a08ce11 100644 --- a/api.md +++ b/api.md @@ -187,3 +187,20 @@ Methods: - client.cloud.reserved_fixed_ips.vip.replace_connected_ports(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList - client.cloud.reserved_fixed_ips.vip.toggle(port_id, \*, project_id, region_id, \*\*params) -> ReservedFixedIP - client.cloud.reserved_fixed_ips.vip.update_connected_ports(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList + +## FloatingIPs + +Types: + +```python +from gcore.types.cloud import FloatingIPListResponse +``` + +Methods: + +- client.cloud.floating_ips.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.floating_ips.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[FloatingIPListResponse] +- client.cloud.floating_ips.delete(floating_ip_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.floating_ips.assign(floating_ip_id, \*, project_id, region_id, \*\*params) -> FloatingIP +- client.cloud.floating_ips.get(floating_ip_id, \*, project_id, region_id) -> FloatingIP +- client.cloud.floating_ips.unassign(floating_ip_id, \*, project_id, region_id) -> FloatingIP diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index e425b38a..5f2d379f 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -64,6 +64,14 @@ IPRangesResourceWithStreamingResponse, AsyncIPRangesResourceWithStreamingResponse, ) +from .floating_ips import ( + FloatingIPsResource, + AsyncFloatingIPsResource, + FloatingIPsResourceWithRawResponse, + AsyncFloatingIPsResourceWithRawResponse, + FloatingIPsResourceWithStreamingResponse, + AsyncFloatingIPsResourceWithStreamingResponse, +) from .reserved_fixed_ips import ( ReservedFixedIPsResource, AsyncReservedFixedIPsResource, @@ -122,6 +130,12 @@ "AsyncReservedFixedIPsResourceWithRawResponse", "ReservedFixedIPsResourceWithStreamingResponse", "AsyncReservedFixedIPsResourceWithStreamingResponse", + "FloatingIPsResource", + "AsyncFloatingIPsResource", + "FloatingIPsResourceWithRawResponse", + "AsyncFloatingIPsResourceWithRawResponse", + "FloatingIPsResourceWithStreamingResponse", + "AsyncFloatingIPsResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 1eb8db1c..6202d60c 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -52,6 +52,14 @@ AsyncIPRangesResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource +from .floating_ips import ( + FloatingIPsResource, + AsyncFloatingIPsResource, + FloatingIPsResourceWithRawResponse, + AsyncFloatingIPsResourceWithRawResponse, + FloatingIPsResourceWithStreamingResponse, + AsyncFloatingIPsResourceWithStreamingResponse, +) from .quotas.quotas import ( QuotasResource, AsyncQuotasResource, @@ -105,6 +113,10 @@ def ip_ranges(self) -> IPRangesResource: def reserved_fixed_ips(self) -> ReservedFixedIPsResource: return ReservedFixedIPsResource(self._client) + @cached_property + def floating_ips(self) -> FloatingIPsResource: + return FloatingIPsResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -158,6 +170,10 @@ def ip_ranges(self) -> AsyncIPRangesResource: def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResource: return AsyncReservedFixedIPsResource(self._client) + @cached_property + def floating_ips(self) -> AsyncFloatingIPsResource: + return AsyncFloatingIPsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -214,6 +230,10 @@ def ip_ranges(self) -> IPRangesResourceWithRawResponse: def reserved_fixed_ips(self) -> ReservedFixedIPsResourceWithRawResponse: return ReservedFixedIPsResourceWithRawResponse(self._cloud.reserved_fixed_ips) + @cached_property + def floating_ips(self) -> FloatingIPsResourceWithRawResponse: + return FloatingIPsResourceWithRawResponse(self._cloud.floating_ips) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -251,6 +271,10 @@ def ip_ranges(self) -> AsyncIPRangesResourceWithRawResponse: def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResourceWithRawResponse: return AsyncReservedFixedIPsResourceWithRawResponse(self._cloud.reserved_fixed_ips) + @cached_property + def floating_ips(self) -> AsyncFloatingIPsResourceWithRawResponse: + return AsyncFloatingIPsResourceWithRawResponse(self._cloud.floating_ips) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -288,6 +312,10 @@ def ip_ranges(self) -> IPRangesResourceWithStreamingResponse: def reserved_fixed_ips(self) -> ReservedFixedIPsResourceWithStreamingResponse: return ReservedFixedIPsResourceWithStreamingResponse(self._cloud.reserved_fixed_ips) + @cached_property + def floating_ips(self) -> FloatingIPsResourceWithStreamingResponse: + return FloatingIPsResourceWithStreamingResponse(self._cloud.floating_ips) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -324,3 +352,7 @@ def ip_ranges(self) -> AsyncIPRangesResourceWithStreamingResponse: @cached_property def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResourceWithStreamingResponse: return AsyncReservedFixedIPsResourceWithStreamingResponse(self._cloud.reserved_fixed_ips) + + @cached_property + def floating_ips(self) -> AsyncFloatingIPsResourceWithStreamingResponse: + return AsyncFloatingIPsResourceWithStreamingResponse(self._cloud.floating_ips) diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py new file mode 100644 index 00000000..fb75fa42 --- /dev/null +++ b/src/gcore/resources/cloud/floating_ips.py @@ -0,0 +1,848 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 ...pagination import SyncOffsetPage, AsyncOffsetPage +from ...types.cloud import floating_ip_list_params, floating_ip_assign_params, floating_ip_create_params +from ..._base_client import AsyncPaginator, make_request_options +from ...types.cloud.floating_ip import FloatingIP +from ...types.cloud.task_id_list import TaskIDList +from ...types.cloud.tag_update_list_param import TagUpdateListParam +from ...types.cloud.floating_ip_list_response import FloatingIPListResponse + +__all__ = ["FloatingIPsResource", "AsyncFloatingIPsResource"] + + +class FloatingIPsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FloatingIPsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return FloatingIPsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FloatingIPsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return FloatingIPsResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, + metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + port_id: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create floating IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].post.parameters[1].schema" + + fixed_ip_address: '#/components/schemas/CreateFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' + "$.components.schemas.CreateFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" + + metadata: '#/components/schemas/CreateFloatingIPSerializer/properties/metadata' + "$.components.schemas.CreateFloatingIPSerializer.properties.metadata" + + port_id: '#/components/schemas/CreateFloatingIPSerializer/properties/port_id/anyOf/0' + "$.components.schemas.CreateFloatingIPSerializer.properties.port_id.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._post( + f"/cloud/v1/floatingips/{project_id}/{region_id}", + body=maybe_transform( + { + "fixed_ip_address": fixed_ip_address, + "metadata": metadata, + "port_id": port_id, + }, + floating_ip_create_params.FloatingIPCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + metadata_k: List[str] | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[FloatingIPListResponse]: + """ + List floating IPs + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[2]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[3]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[4]" + + offset: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[5]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/floatingips/{project_id}/{region_id}", + page=SyncOffsetPage[FloatingIPListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "offset": offset, + }, + floating_ip_list_params.FloatingIPListParams, + ), + ), + model=FloatingIPListResponse, + ) + + def delete( + self, + floating_ip_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete floating IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}']['delete'].parameters[1].schema" + + floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not floating_ip_id: + raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") + return self._delete( + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def assign( + self, + floating_ip_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_id: str, + fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FloatingIP: + """ + Assign floating IP to instance or loadbalancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[1].schema" + + floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/2/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[2].schema" + + port_id: '#/components/schemas/AssignFloatingIPSerializer/properties/port_id' + "$.components.schemas.AssignFloatingIPSerializer.properties.port_id" + + fixed_ip_address: '#/components/schemas/AssignFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' + "$.components.schemas.AssignFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not floating_ip_id: + raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") + return self._post( + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + body=maybe_transform( + { + "port_id": port_id, + "fixed_ip_address": fixed_ip_address, + }, + floating_ip_assign_params.FloatingIPAssignParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FloatingIP, + ) + + def get( + self, + floating_ip_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FloatingIP: + """ + Get floating IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}'].get.parameters[1].schema" + + floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not floating_ip_id: + raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") + return self._get( + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FloatingIP, + ) + + def unassign( + self, + floating_ip_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FloatingIP: + """ + Unassign floating IP from the instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Funassign/post/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Funassign/post/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign'].post.parameters[1].schema" + + floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Funassign/post/parameters/2/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not floating_ip_id: + raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") + return self._post( + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FloatingIP, + ) + + +class AsyncFloatingIPsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFloatingIPsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncFloatingIPsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFloatingIPsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncFloatingIPsResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, + metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + port_id: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create floating IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].post.parameters[1].schema" + + fixed_ip_address: '#/components/schemas/CreateFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' + "$.components.schemas.CreateFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" + + metadata: '#/components/schemas/CreateFloatingIPSerializer/properties/metadata' + "$.components.schemas.CreateFloatingIPSerializer.properties.metadata" + + port_id: '#/components/schemas/CreateFloatingIPSerializer/properties/port_id/anyOf/0' + "$.components.schemas.CreateFloatingIPSerializer.properties.port_id.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._post( + f"/cloud/v1/floatingips/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "fixed_ip_address": fixed_ip_address, + "metadata": metadata, + "port_id": port_id, + }, + floating_ip_create_params.FloatingIPCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + metadata_k: List[str] | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[FloatingIPListResponse, AsyncOffsetPage[FloatingIPListResponse]]: + """ + List floating IPs + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[2]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[3]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[4]" + + offset: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[5]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/floatingips/{project_id}/{region_id}", + page=AsyncOffsetPage[FloatingIPListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "offset": offset, + }, + floating_ip_list_params.FloatingIPListParams, + ), + ), + model=FloatingIPListResponse, + ) + + async def delete( + self, + floating_ip_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete floating IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}']['delete'].parameters[1].schema" + + floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not floating_ip_id: + raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") + return await self._delete( + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def assign( + self, + floating_ip_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_id: str, + fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FloatingIP: + """ + Assign floating IP to instance or loadbalancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[1].schema" + + floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/2/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[2].schema" + + port_id: '#/components/schemas/AssignFloatingIPSerializer/properties/port_id' + "$.components.schemas.AssignFloatingIPSerializer.properties.port_id" + + fixed_ip_address: '#/components/schemas/AssignFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' + "$.components.schemas.AssignFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not floating_ip_id: + raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") + return await self._post( + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + body=await async_maybe_transform( + { + "port_id": port_id, + "fixed_ip_address": fixed_ip_address, + }, + floating_ip_assign_params.FloatingIPAssignParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FloatingIP, + ) + + async def get( + self, + floating_ip_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FloatingIP: + """ + Get floating IP + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}'].get.parameters[1].schema" + + floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not floating_ip_id: + raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") + return await self._get( + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FloatingIP, + ) + + async def unassign( + self, + floating_ip_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FloatingIP: + """ + Unassign floating IP from the instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Funassign/post/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Funassign/post/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign'].post.parameters[1].schema" + + floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Funassign/post/parameters/2/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not floating_ip_id: + raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") + return await self._post( + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FloatingIP, + ) + + +class FloatingIPsResourceWithRawResponse: + def __init__(self, floating_ips: FloatingIPsResource) -> None: + self._floating_ips = floating_ips + + self.create = to_raw_response_wrapper( + floating_ips.create, + ) + self.list = to_raw_response_wrapper( + floating_ips.list, + ) + self.delete = to_raw_response_wrapper( + floating_ips.delete, + ) + self.assign = to_raw_response_wrapper( + floating_ips.assign, + ) + self.get = to_raw_response_wrapper( + floating_ips.get, + ) + self.unassign = to_raw_response_wrapper( + floating_ips.unassign, + ) + + +class AsyncFloatingIPsResourceWithRawResponse: + def __init__(self, floating_ips: AsyncFloatingIPsResource) -> None: + self._floating_ips = floating_ips + + self.create = async_to_raw_response_wrapper( + floating_ips.create, + ) + self.list = async_to_raw_response_wrapper( + floating_ips.list, + ) + self.delete = async_to_raw_response_wrapper( + floating_ips.delete, + ) + self.assign = async_to_raw_response_wrapper( + floating_ips.assign, + ) + self.get = async_to_raw_response_wrapper( + floating_ips.get, + ) + self.unassign = async_to_raw_response_wrapper( + floating_ips.unassign, + ) + + +class FloatingIPsResourceWithStreamingResponse: + def __init__(self, floating_ips: FloatingIPsResource) -> None: + self._floating_ips = floating_ips + + self.create = to_streamed_response_wrapper( + floating_ips.create, + ) + self.list = to_streamed_response_wrapper( + floating_ips.list, + ) + self.delete = to_streamed_response_wrapper( + floating_ips.delete, + ) + self.assign = to_streamed_response_wrapper( + floating_ips.assign, + ) + self.get = to_streamed_response_wrapper( + floating_ips.get, + ) + self.unassign = to_streamed_response_wrapper( + floating_ips.unassign, + ) + + +class AsyncFloatingIPsResourceWithStreamingResponse: + def __init__(self, floating_ips: AsyncFloatingIPsResource) -> None: + self._floating_ips = floating_ips + + self.create = async_to_streamed_response_wrapper( + floating_ips.create, + ) + self.list = async_to_streamed_response_wrapper( + floating_ips.list, + ) + self.delete = async_to_streamed_response_wrapper( + floating_ips.delete, + ) + self.assign = async_to_streamed_response_wrapper( + floating_ips.assign, + ) + self.get = async_to_streamed_response_wrapper( + floating_ips.get, + ) + self.unassign = async_to_streamed_response_wrapper( + floating_ips.unassign, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index d4383ba2..fe1e8228 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -12,27 +12,41 @@ from .ssh_key import SSHKey as SSHKey from .ip_ranges import IPRanges as IPRanges from .ip_version import IPVersion as IPVersion +from .floating_ip import FloatingIP as FloatingIP +from .ddos_profile import DDOSProfile as DDOSProfile from .task_id_list import TaskIDList as TaskIDList +from .load_balancer import LoadBalancer as LoadBalancer from .neutron_route import NeutronRoute as NeutronRoute from .ssh_key_created import SSHKeyCreated as SSHKeyCreated from .task_list_params import TaskListParams as TaskListParams from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP +from .ddos_profile_field import DDOSProfileField as DDOSProfileField from .floating_ip_status import FloatingIPStatus as FloatingIPStatus from .region_list_params import RegionListParams as RegionListParams +from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams from .secret_create_params import SecretCreateParams as SecretCreateParams from .secret_list_response import SecretListResponse as SecretListResponse +from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate from .project_create_params import ProjectCreateParams as ProjectCreateParams from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams +from .tag_update_list_param import TagUpdateListParam as TagUpdateListParam from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams +from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams +from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList +from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics +from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams +from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams +from .floating_ip_list_response import FloatingIPListResponse as FloatingIPListResponse from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit +from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse diff --git a/src/gcore/types/cloud/ddos_profile.py b/src/gcore/types/cloud/ddos_profile.py new file mode 100644 index 00000000..6efc8eb3 --- /dev/null +++ b/src/gcore/types/cloud/ddos_profile.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .ddos_profile_field import DDOSProfileField +from .ddos_profile_status import DDOSProfileStatus +from .ddos_profile_template import DDOSProfileTemplate +from .ddos_profile_option_list import DDOSProfileOptionList + +__all__ = ["DDOSProfile"] + + +class DDOSProfile(BaseModel): + id: int + """ + '#/components/schemas/GetClientProfileSerializer/properties/id' + "$.components.schemas.GetClientProfileSerializer.properties.id" + """ + + profile_template: DDOSProfileTemplate + """ + '#/components/schemas/GetClientProfileSerializer/properties/profile_template' + "$.components.schemas.GetClientProfileSerializer.properties.profile_template" + """ + + fields: Optional[List[DDOSProfileField]] = None + """ + '#/components/schemas/GetClientProfileSerializer/properties/fields' + "$.components.schemas.GetClientProfileSerializer.properties.fields" + """ + + options: Optional[DDOSProfileOptionList] = None + """ + '#/components/schemas/GetClientProfileSerializer/properties/options/anyOf/0' + "$.components.schemas.GetClientProfileSerializer.properties.options.anyOf[0]" + """ + + profile_template_description: Optional[str] = None + """ + '#/components/schemas/GetClientProfileSerializer/properties/profile_template_description/anyOf/0' + "$.components.schemas.GetClientProfileSerializer.properties.profile_template_description.anyOf[0]" + """ + + protocols: Optional[List[object]] = None + """ + '#/components/schemas/GetClientProfileSerializer/properties/protocols/anyOf/0' + "$.components.schemas.GetClientProfileSerializer.properties.protocols.anyOf[0]" + """ + + site: Optional[str] = None + """ + '#/components/schemas/GetClientProfileSerializer/properties/site/anyOf/0' + "$.components.schemas.GetClientProfileSerializer.properties.site.anyOf[0]" + """ + + status: Optional[DDOSProfileStatus] = None + """ + '#/components/schemas/GetClientProfileSerializer/properties/status/anyOf/0' + "$.components.schemas.GetClientProfileSerializer.properties.status.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/ddos_profile_field.py b/src/gcore/types/cloud/ddos_profile_field.py new file mode 100644 index 00000000..8d803d00 --- /dev/null +++ b/src/gcore/types/cloud/ddos_profile_field.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["DDOSProfileField"] + + +class DDOSProfileField(BaseModel): + id: int + """ + '#/components/schemas/ClientProfileFieldSerializer/properties/id' + "$.components.schemas.ClientProfileFieldSerializer.properties.id" + """ + + default: object + """ + '#/components/schemas/ClientProfileFieldSerializer/properties/default' + "$.components.schemas.ClientProfileFieldSerializer.properties['default']" + """ + + description: str + """ + '#/components/schemas/ClientProfileFieldSerializer/properties/description' + "$.components.schemas.ClientProfileFieldSerializer.properties.description" + """ + + field_value: object + """ + '#/components/schemas/ClientProfileFieldSerializer/properties/field_value' + "$.components.schemas.ClientProfileFieldSerializer.properties.field_value" + """ + + name: str + """ + '#/components/schemas/ClientProfileFieldSerializer/properties/name' + "$.components.schemas.ClientProfileFieldSerializer.properties.name" + """ + + base_field: Optional[int] = None + """ + '#/components/schemas/ClientProfileFieldSerializer/properties/base_field/anyOf/0' + "$.components.schemas.ClientProfileFieldSerializer.properties.base_field.anyOf[0]" + """ + + field_name: Optional[str] = None + """ + '#/components/schemas/ClientProfileFieldSerializer/properties/field_name/anyOf/0' + "$.components.schemas.ClientProfileFieldSerializer.properties.field_name.anyOf[0]" + """ + + field_type: Optional[str] = None + """ + '#/components/schemas/ClientProfileFieldSerializer/properties/field_type/anyOf/0' + "$.components.schemas.ClientProfileFieldSerializer.properties.field_type.anyOf[0]" + """ + + required: Optional[bool] = None + """ + '#/components/schemas/ClientProfileFieldSerializer/properties/required/anyOf/0' + "$.components.schemas.ClientProfileFieldSerializer.properties.required.anyOf[0]" + """ + + validation_schema: Optional[object] = None + """ + '#/components/schemas/ClientProfileFieldSerializer/properties/validation_schema' + "$.components.schemas.ClientProfileFieldSerializer.properties.validation_schema" + """ + + value: Optional[str] = None + """ + '#/components/schemas/ClientProfileFieldSerializer/properties/value/anyOf/0' + "$.components.schemas.ClientProfileFieldSerializer.properties.value.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/ddos_profile_option_list.py b/src/gcore/types/cloud/ddos_profile_option_list.py new file mode 100644 index 00000000..199aedc2 --- /dev/null +++ b/src/gcore/types/cloud/ddos_profile_option_list.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["DDOSProfileOptionList"] + + +class DDOSProfileOptionList(BaseModel): + active: Optional[bool] = None + """ + '#/components/schemas/ProfileOptionsSerializer/properties/active/anyOf/0' + "$.components.schemas.ProfileOptionsSerializer.properties.active.anyOf[0]" + """ + + bgp: Optional[bool] = None + """ + '#/components/schemas/ProfileOptionsSerializer/properties/bgp/anyOf/0' + "$.components.schemas.ProfileOptionsSerializer.properties.bgp.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/ddos_profile_status.py b/src/gcore/types/cloud/ddos_profile_status.py new file mode 100644 index 00000000..20abdced --- /dev/null +++ b/src/gcore/types/cloud/ddos_profile_status.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["DDOSProfileStatus"] + + +class DDOSProfileStatus(BaseModel): + error_description: str + """ + '#/components/schemas/DdosProfileStatusSerializer/properties/error_description' + "$.components.schemas.DdosProfileStatusSerializer.properties.error_description" + """ + + status: str + """ + '#/components/schemas/DdosProfileStatusSerializer/properties/status' + "$.components.schemas.DdosProfileStatusSerializer.properties.status" + """ diff --git a/src/gcore/types/cloud/ddos_profile_template.py b/src/gcore/types/cloud/ddos_profile_template.py new file mode 100644 index 00000000..5786e0db --- /dev/null +++ b/src/gcore/types/cloud/ddos_profile_template.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .ddos_profile_template_field import DDOSProfileTemplateField + +__all__ = ["DDOSProfileTemplate"] + + +class DDOSProfileTemplate(BaseModel): + id: int + """ + '#/components/schemas/ClientProfileTemplateSerializer/properties/id' + "$.components.schemas.ClientProfileTemplateSerializer.properties.id" + """ + + name: str + """ + '#/components/schemas/ClientProfileTemplateSerializer/properties/name' + "$.components.schemas.ClientProfileTemplateSerializer.properties.name" + """ + + description: Optional[str] = None + """ + '#/components/schemas/ClientProfileTemplateSerializer/properties/description/anyOf/0' + "$.components.schemas.ClientProfileTemplateSerializer.properties.description.anyOf[0]" + """ + + fields: Optional[List[DDOSProfileTemplateField]] = None + """ + '#/components/schemas/ClientProfileTemplateSerializer/properties/fields' + "$.components.schemas.ClientProfileTemplateSerializer.properties.fields" + """ diff --git a/src/gcore/types/cloud/ddos_profile_template_field.py b/src/gcore/types/cloud/ddos_profile_template_field.py new file mode 100644 index 00000000..34d590c2 --- /dev/null +++ b/src/gcore/types/cloud/ddos_profile_template_field.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["DDOSProfileTemplateField"] + + +class DDOSProfileTemplateField(BaseModel): + id: int + """ + '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/id' + "$.components.schemas.ClientProfileTemplateFieldSerializer.properties.id" + """ + + name: str + """ + '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/name' + "$.components.schemas.ClientProfileTemplateFieldSerializer.properties.name" + """ + + default: Optional[str] = None + """ + '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/default/anyOf/0' + "$.components.schemas.ClientProfileTemplateFieldSerializer.properties['default'].anyOf[0]" + """ + + description: Optional[str] = None + """ + '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/description/anyOf/0' + "$.components.schemas.ClientProfileTemplateFieldSerializer.properties.description.anyOf[0]" + """ + + field_type: Optional[str] = None + """ + '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/field_type/anyOf/0' + "$.components.schemas.ClientProfileTemplateFieldSerializer.properties.field_type.anyOf[0]" + """ + + required: Optional[bool] = None + """ + '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/required/anyOf/0' + "$.components.schemas.ClientProfileTemplateFieldSerializer.properties.required.anyOf[0]" + """ + + validation_schema: Optional[object] = None + """ + '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/validation_schema' + "$.components.schemas.ClientProfileTemplateFieldSerializer.properties.validation_schema" + """ diff --git a/src/gcore/types/cloud/floating_ip.py b/src/gcore/types/cloud/floating_ip.py new file mode 100644 index 00000000..3d6e7b9f --- /dev/null +++ b/src/gcore/types/cloud/floating_ip.py @@ -0,0 +1,120 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .tag import Tag +from ..._models import BaseModel +from .floating_ip_status import FloatingIPStatus + +__all__ = ["FloatingIP"] + + +class FloatingIP(BaseModel): + id: Optional[str] = None + """ + '#/components/schemas/FloatingIPSerializer/properties/id/anyOf/0' + "$.components.schemas.FloatingIPSerializer.properties.id.anyOf[0]" + """ + + created_at: datetime + """ + '#/components/schemas/FloatingIPSerializer/properties/created_at' + "$.components.schemas.FloatingIPSerializer.properties.created_at" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/FloatingIPSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.FloatingIPSerializer.properties.creator_task_id.anyOf[0]" + """ + + dns_domain: Optional[str] = None + """ + '#/components/schemas/FloatingIPSerializer/properties/dns_domain/anyOf/0' + "$.components.schemas.FloatingIPSerializer.properties.dns_domain.anyOf[0]" + """ + + dns_name: Optional[str] = None + """ + '#/components/schemas/FloatingIPSerializer/properties/dns_name/anyOf/0' + "$.components.schemas.FloatingIPSerializer.properties.dns_name.anyOf[0]" + """ + + fixed_ip_address: Optional[str] = None + """ + '#/components/schemas/FloatingIPSerializer/properties/fixed_ip_address/anyOf/0' + "$.components.schemas.FloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" + """ + + floating_ip_address: Optional[str] = None + """ + '#/components/schemas/FloatingIPSerializer/properties/floating_ip_address/anyOf/0' + "$.components.schemas.FloatingIPSerializer.properties.floating_ip_address.anyOf[0]" + """ + + metadata: List[Tag] + """ + '#/components/schemas/FloatingIPSerializer/properties/metadata' + "$.components.schemas.FloatingIPSerializer.properties.metadata" + """ + + port_id: Optional[str] = None + """ + '#/components/schemas/FloatingIPSerializer/properties/port_id/anyOf/0' + "$.components.schemas.FloatingIPSerializer.properties.port_id.anyOf[0]" + """ + + project_id: int + """ + '#/components/schemas/FloatingIPSerializer/properties/project_id' + "$.components.schemas.FloatingIPSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/FloatingIPSerializer/properties/region' + "$.components.schemas.FloatingIPSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/FloatingIPSerializer/properties/region_id' + "$.components.schemas.FloatingIPSerializer.properties.region_id" + """ + + router_id: Optional[str] = None + """ + '#/components/schemas/FloatingIPSerializer/properties/router_id/anyOf/0' + "$.components.schemas.FloatingIPSerializer.properties.router_id.anyOf[0]" + """ + + status: Optional[FloatingIPStatus] = None + """ + '#/components/schemas/FloatingIPSerializer/properties/status/anyOf/0' + "$.components.schemas.FloatingIPSerializer.properties.status.anyOf[0]" + """ + + subnet_id: Optional[str] = None + """ + '#/components/schemas/FloatingIPSerializer/properties/subnet_id/anyOf/0' + "$.components.schemas.FloatingIPSerializer.properties.subnet_id.anyOf[0]" + """ + + tags: List[Tag] + """ + '#/components/schemas/FloatingIPSerializer/properties/tags' + "$.components.schemas.FloatingIPSerializer.properties.tags" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/FloatingIPSerializer/properties/task_id/anyOf/0' + "$.components.schemas.FloatingIPSerializer.properties.task_id.anyOf[0]" + """ + + updated_at: datetime + """ + '#/components/schemas/FloatingIPSerializer/properties/updated_at' + "$.components.schemas.FloatingIPSerializer.properties.updated_at" + """ diff --git a/src/gcore/types/cloud/floating_ip_assign_params.py b/src/gcore/types/cloud/floating_ip_assign_params.py new file mode 100644 index 00000000..e43ebaf2 --- /dev/null +++ b/src/gcore/types/cloud/floating_ip_assign_params.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +__all__ = ["FloatingIPAssignParams"] + + +class FloatingIPAssignParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[1].schema" + """ + + port_id: Required[str] + """ + '#/components/schemas/AssignFloatingIPSerializer/properties/port_id' + "$.components.schemas.AssignFloatingIPSerializer.properties.port_id" + """ + + fixed_ip_address: Optional[str] + """ + '#/components/schemas/AssignFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' + "$.components.schemas.AssignFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/floating_ip_create_params.py b/src/gcore/types/cloud/floating_ip_create_params.py new file mode 100644 index 00000000..ff2252a3 --- /dev/null +++ b/src/gcore/types/cloud/floating_ip_create_params.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +from .tag_update_list_param import TagUpdateListParam + +__all__ = ["FloatingIPCreateParams"] + + +class FloatingIPCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + fixed_ip_address: Optional[str] + """ + '#/components/schemas/CreateFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' + "$.components.schemas.CreateFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" + """ + + metadata: TagUpdateListParam + """ + '#/components/schemas/CreateFloatingIPSerializer/properties/metadata' + "$.components.schemas.CreateFloatingIPSerializer.properties.metadata" + """ + + port_id: Optional[str] + """ + '#/components/schemas/CreateFloatingIPSerializer/properties/port_id/anyOf/0' + "$.components.schemas.CreateFloatingIPSerializer.properties.port_id.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/floating_ip_list_params.py b/src/gcore/types/cloud/floating_ip_list_params.py new file mode 100644 index 00000000..3a2f67b7 --- /dev/null +++ b/src/gcore/types/cloud/floating_ip_list_params.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import TypedDict + +__all__ = ["FloatingIPListParams"] + + +class FloatingIPListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[2]" + """ + + metadata_k: List[str] + """ + '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[3]" + """ + + metadata_kv: str + """ + '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[4]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[5]" + """ diff --git a/src/gcore/types/cloud/floating_ip_list_response.py b/src/gcore/types/cloud/floating_ip_list_response.py new file mode 100644 index 00000000..13c3620c --- /dev/null +++ b/src/gcore/types/cloud/floating_ip_list_response.py @@ -0,0 +1,421 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, TypeAlias + +from .tag import Tag +from ..._models import BaseModel +from .load_balancer import LoadBalancer +from .floating_ip_status import FloatingIPStatus + +__all__ = [ + "FloatingIPListResponse", + "Instance", + "InstanceAddress", + "InstanceAddressSimpleAddressSerializer", + "InstanceAddressAddressInterfaceSerializer", + "InstanceAddressAddressDetailedSerializer", + "InstanceFlavor", + "InstanceSecurityGroup", + "InstanceVolume", +] + + +class InstanceAddressSimpleAddressSerializer(BaseModel): + addr: str + """ + '#/components/schemas/SimpleAddressSerializer/properties/addr' + "$.components.schemas.SimpleAddressSerializer.properties.addr" + """ + + type: str + """ + '#/components/schemas/SimpleAddressSerializer/properties/type' + "$.components.schemas.SimpleAddressSerializer.properties.type" + """ + + +class InstanceAddressAddressInterfaceSerializer(BaseModel): + addr: str + """ + '#/components/schemas/AddressInterfaceSerializer/properties/addr' + "$.components.schemas.AddressInterfaceSerializer.properties.addr" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/AddressInterfaceSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.AddressInterfaceSerializer.properties.interface_name.anyOf[0]" + """ + + type: str + """ + '#/components/schemas/AddressInterfaceSerializer/properties/type' + "$.components.schemas.AddressInterfaceSerializer.properties.type" + """ + + +class InstanceAddressAddressDetailedSerializer(BaseModel): + addr: str + """ + '#/components/schemas/AddressDetailedSerializer/properties/addr' + "$.components.schemas.AddressDetailedSerializer.properties.addr" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/AddressDetailedSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.AddressDetailedSerializer.properties.interface_name.anyOf[0]" + """ + + subnet_id: str + """ + '#/components/schemas/AddressDetailedSerializer/properties/subnet_id' + "$.components.schemas.AddressDetailedSerializer.properties.subnet_id" + """ + + subnet_name: str + """ + '#/components/schemas/AddressDetailedSerializer/properties/subnet_name' + "$.components.schemas.AddressDetailedSerializer.properties.subnet_name" + """ + + type: str + """ + '#/components/schemas/AddressDetailedSerializer/properties/type' + "$.components.schemas.AddressDetailedSerializer.properties.type" + """ + + +InstanceAddress: TypeAlias = Union[ + InstanceAddressSimpleAddressSerializer, + InstanceAddressAddressInterfaceSerializer, + InstanceAddressAddressDetailedSerializer, +] + + +class InstanceFlavor(BaseModel): + flavor_id: str + """ + '#/components/schemas/BaseFlavorSerializer/properties/flavor_id' + "$.components.schemas.BaseFlavorSerializer.properties.flavor_id" + """ + + flavor_name: str + """ + '#/components/schemas/BaseFlavorSerializer/properties/flavor_name' + "$.components.schemas.BaseFlavorSerializer.properties.flavor_name" + """ + + ram: int + """ + '#/components/schemas/BaseFlavorSerializer/properties/ram' + "$.components.schemas.BaseFlavorSerializer.properties.ram" + """ + + vcpus: int + """ + '#/components/schemas/BaseFlavorSerializer/properties/vcpus' + "$.components.schemas.BaseFlavorSerializer.properties.vcpus" + """ + + +class InstanceSecurityGroup(BaseModel): + name: str + """ + '#/components/schemas/NameSerializerPydantic/properties/name' + "$.components.schemas.NameSerializerPydantic.properties.name" + """ + + +class InstanceVolume(BaseModel): + id: str + """ + '#/components/schemas/InstanceVolumeSerializer/properties/id' + "$.components.schemas.InstanceVolumeSerializer.properties.id" + """ + + delete_on_termination: bool + """ + '#/components/schemas/InstanceVolumeSerializer/properties/delete_on_termination' + "$.components.schemas.InstanceVolumeSerializer.properties.delete_on_termination" + """ + + +class Instance(BaseModel): + addresses: Dict[str, List[InstanceAddress]] + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/addresses' + "$.components.schemas.InstanceInFloatingSerializer.properties.addresses" + """ + + creator_task_id: str + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/creator_task_id' + "$.components.schemas.InstanceInFloatingSerializer.properties.creator_task_id" + """ + + flavor: InstanceFlavor + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/flavor' + "$.components.schemas.InstanceInFloatingSerializer.properties.flavor" + """ + + instance_created: datetime + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/instance_created' + "$.components.schemas.InstanceInFloatingSerializer.properties.instance_created" + """ + + instance_description: Optional[str] = None + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/instance_description/anyOf/0' + "$.components.schemas.InstanceInFloatingSerializer.properties.instance_description.anyOf[0]" + """ + + instance_id: str + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/instance_id' + "$.components.schemas.InstanceInFloatingSerializer.properties.instance_id" + """ + + instance_name: str + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/instance_name' + "$.components.schemas.InstanceInFloatingSerializer.properties.instance_name" + """ + + keypair_name: Optional[str] = None + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/keypair_name/anyOf/0' + "$.components.schemas.InstanceInFloatingSerializer.properties.keypair_name.anyOf[0]" + """ + + metadata: Dict[str, str] + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/metadata' + "$.components.schemas.InstanceInFloatingSerializer.properties.metadata" + """ + + metadata_detailed: List[Tag] + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/metadata_detailed' + "$.components.schemas.InstanceInFloatingSerializer.properties.metadata_detailed" + """ + + project_id: int + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/project_id' + "$.components.schemas.InstanceInFloatingSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/region' + "$.components.schemas.InstanceInFloatingSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/region_id' + "$.components.schemas.InstanceInFloatingSerializer.properties.region_id" + """ + + security_groups: List[InstanceSecurityGroup] + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/security_groups' + "$.components.schemas.InstanceInFloatingSerializer.properties.security_groups" + """ + + status: Literal[ + "ACTIVE", + "BUILD", + "DELETED", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PASSWORD", + "PAUSED", + "REBOOT", + "REBUILD", + "RESCUE", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "UNKNOWN", + "VERIFY_RESIZE", + ] + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/status' + "$.components.schemas.InstanceInFloatingSerializer.properties.status" + """ + + tags: List[Tag] + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/tags' + "$.components.schemas.InstanceInFloatingSerializer.properties.tags" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/task_id/anyOf/0' + "$.components.schemas.InstanceInFloatingSerializer.properties.task_id.anyOf[0]" + """ + + task_state: Optional[str] = None + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/task_state/anyOf/0' + "$.components.schemas.InstanceInFloatingSerializer.properties.task_state.anyOf[0]" + """ + + vm_state: Literal[ + "active", + "building", + "deleted", + "error", + "paused", + "rescued", + "resized", + "shelved", + "shelved_offloaded", + "soft-deleted", + "stopped", + "suspended", + ] + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/vm_state' + "$.components.schemas.InstanceInFloatingSerializer.properties.vm_state" + """ + + volumes: List[InstanceVolume] + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/volumes' + "$.components.schemas.InstanceInFloatingSerializer.properties.volumes" + """ + + +class FloatingIPListResponse(BaseModel): + id: Optional[str] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/id/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.id.anyOf[0]" + """ + + created_at: datetime + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/created_at' + "$.components.schemas.FloatingIPDetailedSerializer.properties.created_at" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.creator_task_id.anyOf[0]" + """ + + dns_domain: Optional[str] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/dns_domain/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.dns_domain.anyOf[0]" + """ + + dns_name: Optional[str] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/dns_name/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.dns_name.anyOf[0]" + """ + + fixed_ip_address: Optional[str] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/fixed_ip_address/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.fixed_ip_address.anyOf[0]" + """ + + floating_ip_address: Optional[str] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/floating_ip_address/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.floating_ip_address.anyOf[0]" + """ + + instance: Optional[Instance] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/instance/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.instance.anyOf[0]" + """ + + loadbalancer: Optional[LoadBalancer] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/loadbalancer/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.loadbalancer.anyOf[0]" + """ + + metadata: List[Tag] + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/metadata' + "$.components.schemas.FloatingIPDetailedSerializer.properties.metadata" + """ + + port_id: Optional[str] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/port_id/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.port_id.anyOf[0]" + """ + + project_id: int + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/project_id' + "$.components.schemas.FloatingIPDetailedSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/region' + "$.components.schemas.FloatingIPDetailedSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/region_id' + "$.components.schemas.FloatingIPDetailedSerializer.properties.region_id" + """ + + router_id: Optional[str] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/router_id/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.router_id.anyOf[0]" + """ + + status: Optional[FloatingIPStatus] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/status/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.status.anyOf[0]" + """ + + subnet_id: Optional[str] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/subnet_id/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.subnet_id.anyOf[0]" + """ + + tags: List[Tag] + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/tags' + "$.components.schemas.FloatingIPDetailedSerializer.properties.tags" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/task_id/anyOf/0' + "$.components.schemas.FloatingIPDetailedSerializer.properties.task_id.anyOf[0]" + """ + + updated_at: datetime + """ + '#/components/schemas/FloatingIPDetailedSerializer/properties/updated_at' + "$.components.schemas.FloatingIPDetailedSerializer.properties.updated_at" + """ diff --git a/src/gcore/types/cloud/load_balancer.py b/src/gcore/types/cloud/load_balancer.py new file mode 100644 index 00000000..58077913 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer.py @@ -0,0 +1,265 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .tag import Tag +from ..._models import BaseModel +from .floating_ip import FloatingIP +from .ddos_profile import DDOSProfile +from .interface_ip_family import InterfaceIPFamily +from .provisioning_status import ProvisioningStatus +from .load_balancer_statistics import LoadBalancerStatistics +from .load_balancer_instance_role import LoadBalancerInstanceRole +from .load_balancer_operating_status import LoadBalancerOperatingStatus +from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity + +__all__ = ["LoadBalancer", "AdditionalVip", "Flavor", "Listener", "Logging", "LoggingRetentionPolicy", "VrrpIP"] + + +class AdditionalVip(BaseModel): + ip_address: str + """ + '#/components/schemas/NetworkPortFixedIp/properties/ip_address' + "$.components.schemas.NetworkPortFixedIp.properties.ip_address" + """ + + subnet_id: str + """ + '#/components/schemas/NetworkPortFixedIp/properties/subnet_id' + "$.components.schemas.NetworkPortFixedIp.properties.subnet_id" + """ + + +class Flavor(BaseModel): + flavor_id: str + """ + '#/components/schemas/LbFlavorSerializer/properties/flavor_id' + "$.components.schemas.LbFlavorSerializer.properties.flavor_id" + """ + + flavor_name: str + """ + '#/components/schemas/LbFlavorSerializer/properties/flavor_name' + "$.components.schemas.LbFlavorSerializer.properties.flavor_name" + """ + + ram: int + """ + '#/components/schemas/LbFlavorSerializer/properties/ram' + "$.components.schemas.LbFlavorSerializer.properties.ram" + """ + + vcpus: int + """ + '#/components/schemas/LbFlavorSerializer/properties/vcpus' + "$.components.schemas.LbFlavorSerializer.properties.vcpus" + """ + + +class Listener(BaseModel): + id: str + """ + '#/components/schemas/ListenerSerializer/properties/id' + "$.components.schemas.ListenerSerializer.properties.id" + """ + + +class LoggingRetentionPolicy(BaseModel): + period: Optional[int] = None + """ + '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' + "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" + """ + + +class Logging(BaseModel): + destination_region_id: Optional[int] = None + """ + '#/components/schemas/LoadbalancerLoggingSerializer/properties/destination_region_id/anyOf/0' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.destination_region_id.anyOf[0]" + """ + + enabled: Optional[bool] = None + """ + '#/components/schemas/LoadbalancerLoggingSerializer/properties/enabled' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.enabled" + """ + + retention_policy: Optional[LoggingRetentionPolicy] = None + """ + '#/components/schemas/LoadbalancerLoggingSerializer/properties/retention_policy/anyOf/0' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.retention_policy.anyOf[0]" + """ + + topic_name: Optional[str] = None + """ + '#/components/schemas/LoadbalancerLoggingSerializer/properties/topic_name/anyOf/0' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.topic_name.anyOf[0]" + """ + + +class VrrpIP(BaseModel): + ip_address: str + """ + '#/components/schemas/VRRPIP/properties/ip_address' + "$.components.schemas.VRRPIP.properties.ip_address" + """ + + role: LoadBalancerInstanceRole + """ + '#/components/schemas/VRRPIP/properties/role' + "$.components.schemas.VRRPIP.properties.role" + """ + + subnet_id: str + """ + '#/components/schemas/VRRPIP/properties/subnet_id' + "$.components.schemas.VRRPIP.properties.subnet_id" + """ + + +class LoadBalancer(BaseModel): + id: str + """ + '#/components/schemas/LoadbalancerSerializer/properties/id' + "$.components.schemas.LoadbalancerSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/LoadbalancerSerializer/properties/created_at' + "$.components.schemas.LoadbalancerSerializer.properties.created_at" + """ + + name: str + """ + '#/components/schemas/LoadbalancerSerializer/properties/name' + "$.components.schemas.LoadbalancerSerializer.properties.name" + """ + + operating_status: LoadBalancerOperatingStatus + """ + '#/components/schemas/LoadbalancerSerializer/properties/operating_status' + "$.components.schemas.LoadbalancerSerializer.properties.operating_status" + """ + + project_id: int + """ + '#/components/schemas/LoadbalancerSerializer/properties/project_id' + "$.components.schemas.LoadbalancerSerializer.properties.project_id" + """ + + provisioning_status: ProvisioningStatus + """ + '#/components/schemas/LoadbalancerSerializer/properties/provisioning_status' + "$.components.schemas.LoadbalancerSerializer.properties.provisioning_status" + """ + + region: str + """ + '#/components/schemas/LoadbalancerSerializer/properties/region' + "$.components.schemas.LoadbalancerSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/LoadbalancerSerializer/properties/region_id' + "$.components.schemas.LoadbalancerSerializer.properties.region_id" + """ + + additional_vips: Optional[List[AdditionalVip]] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/additional_vips' + "$.components.schemas.LoadbalancerSerializer.properties.additional_vips" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.LoadbalancerSerializer.properties.creator_task_id.anyOf[0]" + """ + + ddos_profile: Optional[DDOSProfile] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/ddos_profile/anyOf/0' + "$.components.schemas.LoadbalancerSerializer.properties.ddos_profile.anyOf[0]" + """ + + flavor: Optional[Flavor] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/flavor/anyOf/0' + "$.components.schemas.LoadbalancerSerializer.properties.flavor.anyOf[0]" + """ + + floating_ips: Optional[List[FloatingIP]] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/floating_ips' + "$.components.schemas.LoadbalancerSerializer.properties.floating_ips" + """ + + listeners: Optional[List[Listener]] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/listeners' + "$.components.schemas.LoadbalancerSerializer.properties.listeners" + """ + + logging: Optional[Logging] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/logging/anyOf/0' + "$.components.schemas.LoadbalancerSerializer.properties.logging.anyOf[0]" + """ + + metadata: Optional[List[Tag]] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/metadata' + "$.components.schemas.LoadbalancerSerializer.properties.metadata" + """ + + preferred_connectivity: Optional[LoadBalancerMemberConnectivity] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/preferred_connectivity' + "$.components.schemas.LoadbalancerSerializer.properties.preferred_connectivity" + """ + + stats: Optional[LoadBalancerStatistics] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/stats/anyOf/0' + "$.components.schemas.LoadbalancerSerializer.properties.stats.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/task_id/anyOf/0' + "$.components.schemas.LoadbalancerSerializer.properties.task_id.anyOf[0]" + """ + + updated_at: Optional[datetime] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/updated_at/anyOf/0' + "$.components.schemas.LoadbalancerSerializer.properties.updated_at.anyOf[0]" + """ + + vip_address: Optional[str] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/vip_address/anyOf/0' + "$.components.schemas.LoadbalancerSerializer.properties.vip_address.anyOf[0]" + """ + + vip_ip_family: Optional[InterfaceIPFamily] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/vip_ip_family/anyOf/0' + "$.components.schemas.LoadbalancerSerializer.properties.vip_ip_family.anyOf[0]" + """ + + vip_port_id: Optional[str] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/vip_port_id/anyOf/0' + "$.components.schemas.LoadbalancerSerializer.properties.vip_port_id.anyOf[0]" + """ + + vrrp_ips: Optional[List[VrrpIP]] = None + """ + '#/components/schemas/LoadbalancerSerializer/properties/vrrp_ips' + "$.components.schemas.LoadbalancerSerializer.properties.vrrp_ips" + """ diff --git a/src/gcore/types/cloud/load_balancer_statistics.py b/src/gcore/types/cloud/load_balancer_statistics.py new file mode 100644 index 00000000..dc4f57cd --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_statistics.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["LoadBalancerStatistics"] + + +class LoadBalancerStatistics(BaseModel): + active_connections: int + """ + '#/components/schemas/LoadbalancerStatsSerializer/properties/active_connections' + "$.components.schemas.LoadbalancerStatsSerializer.properties.active_connections" + """ + + bytes_in: int + """ + '#/components/schemas/LoadbalancerStatsSerializer/properties/bytes_in' + "$.components.schemas.LoadbalancerStatsSerializer.properties.bytes_in" + """ + + bytes_out: int + """ + '#/components/schemas/LoadbalancerStatsSerializer/properties/bytes_out' + "$.components.schemas.LoadbalancerStatsSerializer.properties.bytes_out" + """ + + request_errors: int + """ + '#/components/schemas/LoadbalancerStatsSerializer/properties/request_errors' + "$.components.schemas.LoadbalancerStatsSerializer.properties.request_errors" + """ + + total_connections: int + """ + '#/components/schemas/LoadbalancerStatsSerializer/properties/total_connections' + "$.components.schemas.LoadbalancerStatsSerializer.properties.total_connections" + """ diff --git a/src/gcore/types/cloud/tag_update_list_param.py b/src/gcore/types/cloud/tag_update_list_param.py new file mode 100644 index 00000000..0479c357 --- /dev/null +++ b/src/gcore/types/cloud/tag_update_list_param.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["TagUpdateListParam"] + +TagUpdateListParam: TypeAlias = Dict[str, str] diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py new file mode 100644 index 00000000..5417ff38 --- /dev/null +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -0,0 +1,607 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import ( + FloatingIP, + TaskIDList, + FloatingIPListResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFloatingIPs: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + floating_ip = client.cloud.floating_ips.create( + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + floating_ip = client.cloud.floating_ips.create( + project_id=1, + region_id=1, + fixed_ip_address="192.168.10.15", + metadata={"foo": "my-tag-value"}, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.floating_ips.with_raw_response.create( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = response.parse() + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.floating_ips.with_streaming_response.create( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = response.parse() + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + floating_ip = client.cloud.floating_ips.list( + project_id=1, + region_id=1, + ) + assert_matches_type(SyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + floating_ip = client.cloud.floating_ips.list( + project_id=1, + region_id=1, + limit=1000, + metadata_k=["key1", "key2"], + metadata_kv="metadata_kv", + offset=0, + ) + assert_matches_type(SyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.floating_ips.with_raw_response.list( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = response.parse() + assert_matches_type(SyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.floating_ips.with_streaming_response.list( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = response.parse() + assert_matches_type(SyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + floating_ip = client.cloud.floating_ips.delete( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.floating_ips.with_raw_response.delete( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = response.parse() + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.floating_ips.with_streaming_response.delete( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = response.parse() + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + client.cloud.floating_ips.with_raw_response.delete( + floating_ip_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_assign(self, client: Gcore) -> None: + floating_ip = client.cloud.floating_ips.assign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + def test_method_assign_with_all_params(self, client: Gcore) -> None: + floating_ip = client.cloud.floating_ips.assign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + fixed_ip_address="192.168.10.15", + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + def test_raw_response_assign(self, client: Gcore) -> None: + response = client.cloud.floating_ips.with_raw_response.assign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + def test_streaming_response_assign(self, client: Gcore) -> None: + with client.cloud.floating_ips.with_streaming_response.assign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_assign(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + client.cloud.floating_ips.with_raw_response.assign( + floating_ip_id="", + project_id=0, + region_id=0, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + floating_ip = client.cloud.floating_ips.get( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.floating_ips.with_raw_response.get( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.floating_ips.with_streaming_response.get( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + client.cloud.floating_ips.with_raw_response.get( + floating_ip_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_unassign(self, client: Gcore) -> None: + floating_ip = client.cloud.floating_ips.unassign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + def test_raw_response_unassign(self, client: Gcore) -> None: + response = client.cloud.floating_ips.with_raw_response.unassign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + def test_streaming_response_unassign(self, client: Gcore) -> None: + with client.cloud.floating_ips.with_streaming_response.unassign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_unassign(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + client.cloud.floating_ips.with_raw_response.unassign( + floating_ip_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncFloatingIPs: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + floating_ip = await async_client.cloud.floating_ips.create( + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + floating_ip = await async_client.cloud.floating_ips.create( + project_id=1, + region_id=1, + fixed_ip_address="192.168.10.15", + metadata={"foo": "my-tag-value"}, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.floating_ips.with_raw_response.create( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = await response.parse() + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.floating_ips.with_streaming_response.create( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = await response.parse() + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + floating_ip = await async_client.cloud.floating_ips.list( + project_id=1, + region_id=1, + ) + assert_matches_type(AsyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + floating_ip = await async_client.cloud.floating_ips.list( + project_id=1, + region_id=1, + limit=1000, + metadata_k=["key1", "key2"], + metadata_kv="metadata_kv", + offset=0, + ) + assert_matches_type(AsyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.floating_ips.with_raw_response.list( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = await response.parse() + assert_matches_type(AsyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.floating_ips.with_streaming_response.list( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = await response.parse() + assert_matches_type(AsyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + floating_ip = await async_client.cloud.floating_ips.delete( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.floating_ips.with_raw_response.delete( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = await response.parse() + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.floating_ips.with_streaming_response.delete( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = await response.parse() + assert_matches_type(TaskIDList, floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + await async_client.cloud.floating_ips.with_raw_response.delete( + floating_ip_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_assign(self, async_client: AsyncGcore) -> None: + floating_ip = await async_client.cloud.floating_ips.assign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + async def test_method_assign_with_all_params(self, async_client: AsyncGcore) -> None: + floating_ip = await async_client.cloud.floating_ips.assign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + fixed_ip_address="192.168.10.15", + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + async def test_raw_response_assign(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.floating_ips.with_raw_response.assign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = await response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + async def test_streaming_response_assign(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.floating_ips.with_streaming_response.assign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = await response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_assign(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + await async_client.cloud.floating_ips.with_raw_response.assign( + floating_ip_id="", + project_id=0, + region_id=0, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + floating_ip = await async_client.cloud.floating_ips.get( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.floating_ips.with_raw_response.get( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = await response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.floating_ips.with_streaming_response.get( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = await response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + await async_client.cloud.floating_ips.with_raw_response.get( + floating_ip_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_unassign(self, async_client: AsyncGcore) -> None: + floating_ip = await async_client.cloud.floating_ips.unassign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + async def test_raw_response_unassign(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.floating_ips.with_raw_response.unassign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = await response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + async def test_streaming_response_unassign(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.floating_ips.with_streaming_response.unassign( + floating_ip_id="floating_ip_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = await response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_unassign(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + await async_client.cloud.floating_ips.with_raw_response.unassign( + floating_ip_id="", + project_id=0, + region_id=0, + ) From bf548907cdd7d7778e83d1da41986d0b1270e8e7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 16:31:30 +0000 Subject: [PATCH 047/592] GCLOUD2-18673 Add floating IPs detailed model --- .stats.yml | 6 +++--- api.md | 4 ++-- src/gcore/resources/cloud/floating_ips.py | 14 +++++++------- src/gcore/types/cloud/__init__.py | 2 +- ...ist_response.py => floating_ip_detailed.py} | 4 ++-- tests/api_resources/cloud/test_floating_ips.py | 18 +++++++++--------- 6 files changed, 24 insertions(+), 24 deletions(-) rename src/gcore/types/cloud/{floating_ip_list_response.py => floating_ip_detailed.py} (99%) diff --git a/.stats.yml b/.stats.yml index 3f8c676b..a09fe0d7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 44 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-998a58446557c554357001c0ac6e332bee190b0c543459ee35fce91de40efb7d.yml -openapi_spec_hash: 50c6c06469f5fdbf07bf70cacba0fa5b -config_hash: 441bd3f8b04b2f3430ae96a6db6deefb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-28c3946475abf5194d41060fed9f70c03e0aa956609b80f9904e3e93c4b5d3ac.yml +openapi_spec_hash: da50234dcbbe99b74a2ae4a1b7f2999e +config_hash: 65de1b631e711449330b0189de46c61e diff --git a/api.md b/api.md index 0a08ce11..75c52fec 100644 --- a/api.md +++ b/api.md @@ -193,13 +193,13 @@ Methods: Types: ```python -from gcore.types.cloud import FloatingIPListResponse +from gcore.types.cloud import FloatingIPDetailed ``` Methods: - client.cloud.floating_ips.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.floating_ips.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[FloatingIPListResponse] +- client.cloud.floating_ips.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[FloatingIPDetailed] - client.cloud.floating_ips.delete(floating_ip_id, \*, project_id, region_id) -> TaskIDList - client.cloud.floating_ips.assign(floating_ip_id, \*, project_id, region_id, \*\*params) -> FloatingIP - client.cloud.floating_ips.get(floating_ip_id, \*, project_id, region_id) -> FloatingIP diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index fb75fa42..4a632888 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -24,8 +24,8 @@ from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.floating_ip import FloatingIP from ...types.cloud.task_id_list import TaskIDList +from ...types.cloud.floating_ip_detailed import FloatingIPDetailed from ...types.cloud.tag_update_list_param import TagUpdateListParam -from ...types.cloud.floating_ip_list_response import FloatingIPListResponse __all__ = ["FloatingIPsResource", "AsyncFloatingIPsResource"] @@ -127,7 +127,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[FloatingIPListResponse]: + ) -> SyncOffsetPage[FloatingIPDetailed]: """ List floating IPs @@ -164,7 +164,7 @@ def list( region_id = self._client._get_region_id_path_param() return self._get_api_list( f"/cloud/v1/floatingips/{project_id}/{region_id}", - page=SyncOffsetPage[FloatingIPListResponse], + page=SyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -180,7 +180,7 @@ def list( floating_ip_list_params.FloatingIPListParams, ), ), - model=FloatingIPListResponse, + model=FloatingIPDetailed, ) def delete( @@ -488,7 +488,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[FloatingIPListResponse, AsyncOffsetPage[FloatingIPListResponse]]: + ) -> AsyncPaginator[FloatingIPDetailed, AsyncOffsetPage[FloatingIPDetailed]]: """ List floating IPs @@ -525,7 +525,7 @@ def list( region_id = self._client._get_region_id_path_param() return self._get_api_list( f"/cloud/v1/floatingips/{project_id}/{region_id}", - page=AsyncOffsetPage[FloatingIPListResponse], + page=AsyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -541,7 +541,7 @@ def list( floating_ip_list_params.FloatingIPListParams, ), ), - model=FloatingIPListResponse, + model=FloatingIPDetailed, ) async def delete( diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index fe1e8228..a0382a84 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -28,6 +28,7 @@ from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams +from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed from .secret_create_params import SecretCreateParams as SecretCreateParams from .secret_list_response import SecretListResponse as SecretListResponse from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate @@ -43,7 +44,6 @@ from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams -from .floating_ip_list_response import FloatingIPListResponse as FloatingIPListResponse from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField diff --git a/src/gcore/types/cloud/floating_ip_list_response.py b/src/gcore/types/cloud/floating_ip_detailed.py similarity index 99% rename from src/gcore/types/cloud/floating_ip_list_response.py rename to src/gcore/types/cloud/floating_ip_detailed.py index 13c3620c..738b9ae9 100644 --- a/src/gcore/types/cloud/floating_ip_list_response.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -10,7 +10,7 @@ from .floating_ip_status import FloatingIPStatus __all__ = [ - "FloatingIPListResponse", + "FloatingIPDetailed", "Instance", "InstanceAddress", "InstanceAddressSimpleAddressSerializer", @@ -299,7 +299,7 @@ class Instance(BaseModel): """ -class FloatingIPListResponse(BaseModel): +class FloatingIPDetailed(BaseModel): id: Optional[str] = None """ '#/components/schemas/FloatingIPDetailedSerializer/properties/id/anyOf/0' diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index 5417ff38..a53b0a9a 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -13,7 +13,7 @@ from gcore.types.cloud import ( FloatingIP, TaskIDList, - FloatingIPListResponse, + FloatingIPDetailed, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -73,7 +73,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(SyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + assert_matches_type(SyncOffsetPage[FloatingIPDetailed], floating_ip, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -85,7 +85,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: metadata_kv="metadata_kv", offset=0, ) - assert_matches_type(SyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + assert_matches_type(SyncOffsetPage[FloatingIPDetailed], floating_ip, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -97,7 +97,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" floating_ip = response.parse() - assert_matches_type(SyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + assert_matches_type(SyncOffsetPage[FloatingIPDetailed], floating_ip, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -109,7 +109,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" floating_ip = response.parse() - assert_matches_type(SyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + assert_matches_type(SyncOffsetPage[FloatingIPDetailed], floating_ip, path=["response"]) assert cast(Any, response.is_closed) is True @@ -367,7 +367,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(AsyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + assert_matches_type(AsyncOffsetPage[FloatingIPDetailed], floating_ip, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -379,7 +379,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No metadata_kv="metadata_kv", offset=0, ) - assert_matches_type(AsyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + assert_matches_type(AsyncOffsetPage[FloatingIPDetailed], floating_ip, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -391,7 +391,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" floating_ip = await response.parse() - assert_matches_type(AsyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + assert_matches_type(AsyncOffsetPage[FloatingIPDetailed], floating_ip, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -403,7 +403,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" floating_ip = await response.parse() - assert_matches_type(AsyncOffsetPage[FloatingIPListResponse], floating_ip, path=["response"]) + assert_matches_type(AsyncOffsetPage[FloatingIPDetailed], floating_ip, path=["response"]) assert cast(Any, response.is_closed) is True From d191a51f5e0f55f6bda3ce33b4397f282bafaa52 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 04:32:33 +0000 Subject: [PATCH 048/592] chore(ci): add timeout thresholds for CI jobs --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e655e8eb..8c2fa227 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: jobs: lint: + timeout-minutes: 10 name: lint runs-on: ubuntu-latest steps: @@ -30,6 +31,7 @@ jobs: run: ./scripts/lint test: + timeout-minutes: 10 name: test runs-on: ubuntu-latest steps: From 209dc166761ae8fa01c7a578a6dce3aa33e06329 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 04:33:11 +0000 Subject: [PATCH 049/592] chore(internal): import reformatting --- src/gcore/_client.py | 6 +----- src/gcore/resources/cloud/floating_ips.py | 5 +---- src/gcore/resources/cloud/projects.py | 5 +---- src/gcore/resources/cloud/quotas/requests.py | 5 +---- src/gcore/resources/cloud/regions.py | 5 +---- .../cloud/reserved_fixed_ips/reserved_fixed_ips.py | 6 +----- src/gcore/resources/cloud/reserved_fixed_ips/vip.py | 5 +---- src/gcore/resources/cloud/secrets.py | 5 +---- src/gcore/resources/cloud/ssh_keys.py | 5 +---- src/gcore/resources/cloud/tasks.py | 5 +---- 10 files changed, 10 insertions(+), 42 deletions(-) diff --git a/src/gcore/_client.py b/src/gcore/_client.py index f77caac1..f9a696a6 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -19,11 +19,7 @@ ProxiesTypes, RequestOptions, ) -from ._utils import ( - is_given, - get_async_library, - maybe_coerce_integer, -) +from ._utils import is_given, get_async_library, maybe_coerce_integer from ._version import __version__ from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import GcoreError, APIStatusError diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 4a632888..d3ba8cfe 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -7,10 +7,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 42c2f05f..03040c39 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -8,10 +8,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index aa10dc96..fc98fc3b 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -8,10 +8,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index aa869795..37c79cf0 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -7,10 +7,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index fcc64852..e99ba24e 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -16,11 +16,7 @@ AsyncVipResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - required_args, - maybe_transform, - async_maybe_transform, -) +from ...._utils import required_args, maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 2d8064b1..459acbf6 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -7,10 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 2c697b85..14d6fb71 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -9,10 +9,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index fdf98607..55187088 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -7,10 +7,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index c51ddeda..48e802d1 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -9,10 +9,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( From 60f0e4849f306d0d71cbc881612500eb94213e42 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 04:34:41 +0000 Subject: [PATCH 050/592] chore(internal): fix list file params --- src/gcore/_utils/_utils.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gcore/_utils/_utils.py b/src/gcore/_utils/_utils.py index e5811bba..ea3cf3f2 100644 --- a/src/gcore/_utils/_utils.py +++ b/src/gcore/_utils/_utils.py @@ -72,8 +72,16 @@ def _extract_items( from .._files import assert_is_file_content # We have exhausted the path, return the entry we found. - assert_is_file_content(obj, key=flattened_key) assert flattened_key is not None + + if is_list(obj): + files: list[tuple[str, FileTypes]] = [] + for entry in obj: + assert_is_file_content(entry, key=flattened_key + "[]" if flattened_key else "") + files.append((flattened_key + "[]", cast(FileTypes, entry))) + return files + + assert_is_file_content(obj, key=flattened_key) return [(flattened_key, cast(FileTypes, obj))] index += 1 From 90db0d2edd0728a38ec452cef070c97d8886e875 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 04:35:15 +0000 Subject: [PATCH 051/592] chore(internal): refactor retries to not use recursion --- src/gcore/_base_client.py | 414 ++++++++++++++++---------------------- 1 file changed, 175 insertions(+), 239 deletions(-) diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index cee1157f..3c3e98f7 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -437,8 +437,7 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 headers = httpx.Headers(headers_dict) idempotency_header = self._idempotency_header - if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: - options.idempotency_key = options.idempotency_key or self._idempotency_key() + if idempotency_header and options.idempotency_key and idempotency_header not in headers: headers[idempotency_header] = options.idempotency_key # Don't set these headers if they were already set or removed by the caller. We check @@ -903,7 +902,6 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: Literal[True], stream_cls: Type[_StreamT], @@ -914,7 +912,6 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: Literal[False] = False, ) -> ResponseT: ... @@ -924,7 +921,6 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: bool = False, stream_cls: Type[_StreamT] | None = None, @@ -934,125 +930,109 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: bool = False, stream_cls: type[_StreamT] | None = None, ) -> ResponseT | _StreamT: - if remaining_retries is not None: - retries_taken = options.get_max_retries(self.max_retries) - remaining_retries - else: - retries_taken = 0 - - return self._request( - cast_to=cast_to, - options=options, - stream=stream, - stream_cls=stream_cls, - retries_taken=retries_taken, - ) + cast_to = self._maybe_override_cast_to(cast_to, options) - def _request( - self, - *, - cast_to: Type[ResponseT], - options: FinalRequestOptions, - retries_taken: int, - stream: bool, - stream_cls: type[_StreamT] | None, - ) -> ResponseT | _StreamT: # create a copy of the options we were given so that if the # options are mutated later & we then retry, the retries are # given the original options input_options = model_copy(options) - - cast_to = self._maybe_override_cast_to(cast_to, options) - options = self._prepare_options(options) - - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken - request = self._build_request(options, retries_taken=retries_taken) - self._prepare_request(request) - - if options.idempotency_key: + if input_options.idempotency_key is None and input_options.method.lower() != "get": # ensure the idempotency key is reused between requests - input_options.idempotency_key = options.idempotency_key + input_options.idempotency_key = self._idempotency_key() - kwargs: HttpxSendArgs = {} - if self.custom_auth is not None: - kwargs["auth"] = self.custom_auth + response: httpx.Response | None = None + max_retries = input_options.get_max_retries(self.max_retries) - log.debug("Sending HTTP Request: %s %s", request.method, request.url) + retries_taken = 0 + for retries_taken in range(max_retries + 1): + options = model_copy(input_options) + options = self._prepare_options(options) - try: - response = self._client.send( - request, - stream=stream or self._should_stream_response_body(request=request), - **kwargs, - ) - except httpx.TimeoutException as err: - log.debug("Encountered httpx.TimeoutException", exc_info=True) + remaining_retries = max_retries - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + self._prepare_request(request) - if remaining_retries > 0: - return self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth - log.debug("Raising timeout error") - raise APITimeoutError(request=request) from err - except Exception as err: - log.debug("Encountered Exception", exc_info=True) + log.debug("Sending HTTP Request: %s %s", request.method, request.url) - if remaining_retries > 0: - return self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, + response = None + try: + response = self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) - log.debug("Raising connection error") - raise APIConnectionError(request=request) from err - - log.debug( - 'HTTP Response: %s %s "%i %s" %s', - request.method, - request.url, - response.status_code, - response.reason_phrase, - response.headers, - ) + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + err.response.close() + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=response, + ) + continue - try: - response.raise_for_status() - except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code - log.debug("Encountered httpx.HTTPStatusError", exc_info=True) - - if remaining_retries > 0 and self._should_retry(err.response): - err.response.close() - return self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - response_headers=err.response.headers, - stream=stream, - stream_cls=stream_cls, - ) + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + err.response.read() - # If the response is streamed then we need to explicitly read the response - # to completion before attempting to access the response text. - if not err.response.is_closed: - err.response.read() + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None - log.debug("Re-raising status error") - raise self._make_status_error_from_response(err.response) from None + break + assert response is not None, "could not resolve response (should never happen)" return self._process_response( cast_to=cast_to, options=options, @@ -1062,37 +1042,20 @@ def _request( retries_taken=retries_taken, ) - def _retry_request( - self, - options: FinalRequestOptions, - cast_to: Type[ResponseT], - *, - retries_taken: int, - response_headers: httpx.Headers | None, - stream: bool, - stream_cls: type[_StreamT] | None, - ) -> ResponseT | _StreamT: - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + def _sleep_for_retry( + self, *, retries_taken: int, max_retries: int, options: FinalRequestOptions, response: httpx.Response | None + ) -> None: + remaining_retries = max_retries - retries_taken if remaining_retries == 1: log.debug("1 retry left") else: log.debug("%i retries left", remaining_retries) - timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers) + timeout = self._calculate_retry_timeout(remaining_retries, options, response.headers if response else None) log.info("Retrying request to %s in %f seconds", options.url, timeout) - # In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a - # different thread if necessary. time.sleep(timeout) - return self._request( - options=options, - cast_to=cast_to, - retries_taken=retries_taken + 1, - stream=stream, - stream_cls=stream_cls, - ) - def _process_response( self, *, @@ -1436,7 +1399,6 @@ async def request( options: FinalRequestOptions, *, stream: Literal[False] = False, - remaining_retries: Optional[int] = None, ) -> ResponseT: ... @overload @@ -1447,7 +1409,6 @@ async def request( *, stream: Literal[True], stream_cls: type[_AsyncStreamT], - remaining_retries: Optional[int] = None, ) -> _AsyncStreamT: ... @overload @@ -1458,7 +1419,6 @@ async def request( *, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - remaining_retries: Optional[int] = None, ) -> ResponseT | _AsyncStreamT: ... async def request( @@ -1468,120 +1428,111 @@ async def request( *, stream: bool = False, stream_cls: type[_AsyncStreamT] | None = None, - remaining_retries: Optional[int] = None, - ) -> ResponseT | _AsyncStreamT: - if remaining_retries is not None: - retries_taken = options.get_max_retries(self.max_retries) - remaining_retries - else: - retries_taken = 0 - - return await self._request( - cast_to=cast_to, - options=options, - stream=stream, - stream_cls=stream_cls, - retries_taken=retries_taken, - ) - - async def _request( - self, - cast_to: Type[ResponseT], - options: FinalRequestOptions, - *, - stream: bool, - stream_cls: type[_AsyncStreamT] | None, - retries_taken: int, ) -> ResponseT | _AsyncStreamT: if self._platform is None: # `get_platform` can make blocking IO calls so we # execute it earlier while we are in an async context self._platform = await asyncify(get_platform)() + cast_to = self._maybe_override_cast_to(cast_to, options) + # create a copy of the options we were given so that if the # options are mutated later & we then retry, the retries are # given the original options input_options = model_copy(options) - - cast_to = self._maybe_override_cast_to(cast_to, options) - options = await self._prepare_options(options) - - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken - request = self._build_request(options, retries_taken=retries_taken) - await self._prepare_request(request) - - if options.idempotency_key: + if input_options.idempotency_key is None and input_options.method.lower() != "get": # ensure the idempotency key is reused between requests - input_options.idempotency_key = options.idempotency_key + input_options.idempotency_key = self._idempotency_key() - kwargs: HttpxSendArgs = {} - if self.custom_auth is not None: - kwargs["auth"] = self.custom_auth + response: httpx.Response | None = None + max_retries = input_options.get_max_retries(self.max_retries) - try: - response = await self._client.send( - request, - stream=stream or self._should_stream_response_body(request=request), - **kwargs, - ) - except httpx.TimeoutException as err: - log.debug("Encountered httpx.TimeoutException", exc_info=True) + retries_taken = 0 + for retries_taken in range(max_retries + 1): + options = model_copy(input_options) + options = await self._prepare_options(options) - if remaining_retries > 0: - return await self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + remaining_retries = max_retries - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + await self._prepare_request(request) - log.debug("Raising timeout error") - raise APITimeoutError(request=request) from err - except Exception as err: - log.debug("Encountered Exception", exc_info=True) + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth - if remaining_retries > 0: - return await self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + log.debug("Sending HTTP Request: %s %s", request.method, request.url) - log.debug("Raising connection error") - raise APIConnectionError(request=request) from err + response = None + try: + response = await self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, + ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) - log.debug( - 'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase - ) + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + await err.response.aclose() + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=response, + ) + continue - try: - response.raise_for_status() - except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code - log.debug("Encountered httpx.HTTPStatusError", exc_info=True) - - if remaining_retries > 0 and self._should_retry(err.response): - await err.response.aclose() - return await self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - response_headers=err.response.headers, - stream=stream, - stream_cls=stream_cls, - ) + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + await err.response.aread() - # If the response is streamed then we need to explicitly read the response - # to completion before attempting to access the response text. - if not err.response.is_closed: - await err.response.aread() + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None - log.debug("Re-raising status error") - raise self._make_status_error_from_response(err.response) from None + break + assert response is not None, "could not resolve response (should never happen)" return await self._process_response( cast_to=cast_to, options=options, @@ -1591,35 +1542,20 @@ async def _request( retries_taken=retries_taken, ) - async def _retry_request( - self, - options: FinalRequestOptions, - cast_to: Type[ResponseT], - *, - retries_taken: int, - response_headers: httpx.Headers | None, - stream: bool, - stream_cls: type[_AsyncStreamT] | None, - ) -> ResponseT | _AsyncStreamT: - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + async def _sleep_for_retry( + self, *, retries_taken: int, max_retries: int, options: FinalRequestOptions, response: httpx.Response | None + ) -> None: + remaining_retries = max_retries - retries_taken if remaining_retries == 1: log.debug("1 retry left") else: log.debug("%i retries left", remaining_retries) - timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers) + timeout = self._calculate_retry_timeout(remaining_retries, options, response.headers if response else None) log.info("Retrying request to %s in %f seconds", options.url, timeout) await anyio.sleep(timeout) - return await self._request( - options=options, - cast_to=cast_to, - retries_taken=retries_taken + 1, - stream=stream, - stream_cls=stream_cls, - ) - async def _process_response( self, *, From 15d7bf9bd985df98b854d6f9ab04954160f30485 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 04:35:53 +0000 Subject: [PATCH 052/592] fix(pydantic v1): more robust ModelField.annotation check --- src/gcore/_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gcore/_models.py b/src/gcore/_models.py index 58b9263e..798956f1 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -626,8 +626,8 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, # Note: if one variant defines an alias then they all should discriminator_alias = field_info.alias - if field_info.annotation and is_literal_type(field_info.annotation): - for entry in get_args(field_info.annotation): + if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): + for entry in get_args(annotation): if isinstance(entry, str): mapping[entry] = variant From f7ede7fd851ef9ba5f20c68e53f5b5790ed29ebf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 05:17:01 +0000 Subject: [PATCH 053/592] GCLOUD2-18668 feat: Add volumes --- .stats.yml | 4 +- api.md | 21 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + src/gcore/resources/cloud/volumes.py | 1808 +++++++++++++++++ src/gcore/types/cloud/__init__.py | 9 + src/gcore/types/cloud/volume.py | 231 +++ .../cloud/volume_attach_to_instance_params.py | 33 + .../types/cloud/volume_change_type_params.py | 27 + src/gcore/types/cloud/volume_create_params.py | 218 ++ src/gcore/types/cloud/volume_delete_params.py | 27 + .../volume_detach_from_instance_params.py | 27 + src/gcore/types/cloud/volume_list_params.py | 82 + src/gcore/types/cloud/volume_resize_params.py | 27 + src/gcore/types/cloud/volume_update_params.py | 27 + tests/api_resources/cloud/test_volumes.py | 1312 ++++++++++++ 16 files changed, 3897 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/volumes.py create mode 100644 src/gcore/types/cloud/volume.py create mode 100644 src/gcore/types/cloud/volume_attach_to_instance_params.py create mode 100644 src/gcore/types/cloud/volume_change_type_params.py create mode 100644 src/gcore/types/cloud/volume_create_params.py create mode 100644 src/gcore/types/cloud/volume_delete_params.py create mode 100644 src/gcore/types/cloud/volume_detach_from_instance_params.py create mode 100644 src/gcore/types/cloud/volume_list_params.py create mode 100644 src/gcore/types/cloud/volume_resize_params.py create mode 100644 src/gcore/types/cloud/volume_update_params.py create mode 100644 tests/api_resources/cloud/test_volumes.py diff --git a/.stats.yml b/.stats.yml index a09fe0d7..d850ecfb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 44 +configured_endpoints: 54 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-28c3946475abf5194d41060fed9f70c03e0aa956609b80f9904e3e93c4b5d3ac.yml openapi_spec_hash: da50234dcbbe99b74a2ae4a1b7f2999e -config_hash: 65de1b631e711449330b0189de46c61e +config_hash: 42f74af7b7e6377b709a027acce77398 diff --git a/api.md b/api.md index 75c52fec..f88129e5 100644 --- a/api.md +++ b/api.md @@ -188,6 +188,27 @@ Methods: - client.cloud.reserved_fixed_ips.vip.toggle(port_id, \*, project_id, region_id, \*\*params) -> ReservedFixedIP - client.cloud.reserved_fixed_ips.vip.update_connected_ports(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList +## Volumes + +Types: + +```python +from gcore.types.cloud import Volume +``` + +Methods: + +- client.cloud.volumes.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volumes.update(volume_id, \*, project_id, region_id, \*\*params) -> Volume +- client.cloud.volumes.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Volume] +- client.cloud.volumes.delete(volume_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volumes.attach_to_instance(volume_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volumes.change_type(volume_id, \*, project_id, region_id, \*\*params) -> Volume +- client.cloud.volumes.detach_from_instance(volume_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volumes.get(volume_id, \*, project_id, region_id) -> Volume +- client.cloud.volumes.resize(volume_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volumes.revert_to_last_snapshot(volume_id, \*, project_id, region_id) -> None + ## FloatingIPs Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 5f2d379f..9281aa96 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -40,6 +40,14 @@ SecretsResourceWithStreamingResponse, AsyncSecretsResourceWithStreamingResponse, ) +from .volumes import ( + VolumesResource, + AsyncVolumesResource, + VolumesResourceWithRawResponse, + AsyncVolumesResourceWithRawResponse, + VolumesResourceWithStreamingResponse, + AsyncVolumesResourceWithStreamingResponse, +) from .projects import ( ProjectsResource, AsyncProjectsResource, @@ -130,6 +138,12 @@ "AsyncReservedFixedIPsResourceWithRawResponse", "ReservedFixedIPsResourceWithStreamingResponse", "AsyncReservedFixedIPsResourceWithStreamingResponse", + "VolumesResource", + "AsyncVolumesResource", + "VolumesResourceWithRawResponse", + "AsyncVolumesResourceWithRawResponse", + "VolumesResourceWithStreamingResponse", + "AsyncVolumesResourceWithStreamingResponse", "FloatingIPsResource", "AsyncFloatingIPsResource", "FloatingIPsResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 6202d60c..3b991167 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -26,6 +26,14 @@ SecretsResourceWithStreamingResponse, AsyncSecretsResourceWithStreamingResponse, ) +from .volumes import ( + VolumesResource, + AsyncVolumesResource, + VolumesResourceWithRawResponse, + AsyncVolumesResourceWithRawResponse, + VolumesResourceWithStreamingResponse, + AsyncVolumesResourceWithStreamingResponse, +) from .projects import ( ProjectsResource, AsyncProjectsResource, @@ -113,6 +121,10 @@ def ip_ranges(self) -> IPRangesResource: def reserved_fixed_ips(self) -> ReservedFixedIPsResource: return ReservedFixedIPsResource(self._client) + @cached_property + def volumes(self) -> VolumesResource: + return VolumesResource(self._client) + @cached_property def floating_ips(self) -> FloatingIPsResource: return FloatingIPsResource(self._client) @@ -170,6 +182,10 @@ def ip_ranges(self) -> AsyncIPRangesResource: def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResource: return AsyncReservedFixedIPsResource(self._client) + @cached_property + def volumes(self) -> AsyncVolumesResource: + return AsyncVolumesResource(self._client) + @cached_property def floating_ips(self) -> AsyncFloatingIPsResource: return AsyncFloatingIPsResource(self._client) @@ -230,6 +246,10 @@ def ip_ranges(self) -> IPRangesResourceWithRawResponse: def reserved_fixed_ips(self) -> ReservedFixedIPsResourceWithRawResponse: return ReservedFixedIPsResourceWithRawResponse(self._cloud.reserved_fixed_ips) + @cached_property + def volumes(self) -> VolumesResourceWithRawResponse: + return VolumesResourceWithRawResponse(self._cloud.volumes) + @cached_property def floating_ips(self) -> FloatingIPsResourceWithRawResponse: return FloatingIPsResourceWithRawResponse(self._cloud.floating_ips) @@ -271,6 +291,10 @@ def ip_ranges(self) -> AsyncIPRangesResourceWithRawResponse: def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResourceWithRawResponse: return AsyncReservedFixedIPsResourceWithRawResponse(self._cloud.reserved_fixed_ips) + @cached_property + def volumes(self) -> AsyncVolumesResourceWithRawResponse: + return AsyncVolumesResourceWithRawResponse(self._cloud.volumes) + @cached_property def floating_ips(self) -> AsyncFloatingIPsResourceWithRawResponse: return AsyncFloatingIPsResourceWithRawResponse(self._cloud.floating_ips) @@ -312,6 +336,10 @@ def ip_ranges(self) -> IPRangesResourceWithStreamingResponse: def reserved_fixed_ips(self) -> ReservedFixedIPsResourceWithStreamingResponse: return ReservedFixedIPsResourceWithStreamingResponse(self._cloud.reserved_fixed_ips) + @cached_property + def volumes(self) -> VolumesResourceWithStreamingResponse: + return VolumesResourceWithStreamingResponse(self._cloud.volumes) + @cached_property def floating_ips(self) -> FloatingIPsResourceWithStreamingResponse: return FloatingIPsResourceWithStreamingResponse(self._cloud.floating_ips) @@ -353,6 +381,10 @@ def ip_ranges(self) -> AsyncIPRangesResourceWithStreamingResponse: def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResourceWithStreamingResponse: return AsyncReservedFixedIPsResourceWithStreamingResponse(self._cloud.reserved_fixed_ips) + @cached_property + def volumes(self) -> AsyncVolumesResourceWithStreamingResponse: + return AsyncVolumesResourceWithStreamingResponse(self._cloud.volumes) + @cached_property def floating_ips(self) -> AsyncFloatingIPsResourceWithStreamingResponse: return AsyncFloatingIPsResourceWithStreamingResponse(self._cloud.floating_ips) diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py new file mode 100644 index 00000000..2da5a63b --- /dev/null +++ b/src/gcore/resources/cloud/volumes.py @@ -0,0 +1,1808 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import Literal, overload + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._utils import required_args, maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ...types.cloud import ( + volume_list_params, + volume_create_params, + volume_delete_params, + volume_resize_params, + volume_update_params, + volume_change_type_params, + volume_attach_to_instance_params, + volume_detach_from_instance_params, +) +from ..._base_client import AsyncPaginator, make_request_options +from ...types.cloud.volume import Volume +from ...types.cloud.task_id_list import TaskIDList +from ...types.cloud.tag_update_list_param import TagUpdateListParam + +__all__ = ["VolumesResource", "AsyncVolumesResource"] + + +class VolumesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> VolumesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return VolumesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VolumesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return VolumesResourceWithStreamingResponse(self) + + @overload + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + image_id: str, + name: str, + size: int, + source: Literal["image"], + attachment_tag: str | NotGiven = NOT_GIVEN, + instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, + lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, + metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + + image_id: '#/components/schemas/CreateVolumeFromImageSerializer/properties/image_id' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.image_id" + + name: '#/components/schemas/CreateVolumeFromImageSerializer/properties/name' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.name" + + size: '#/components/schemas/CreateVolumeFromImageSerializer/properties/size' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.size" + + source: '#/components/schemas/CreateVolumeFromImageSerializer/properties/source' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.source" + + attachment_tag: '#/components/schemas/CreateVolumeFromImageSerializer/properties/attachment_tag' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.attachment_tag" + + instance_id_to_attach_to: '#/components/schemas/CreateVolumeFromImageSerializer/properties/instance_id_to_attach_to' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.instance_id_to_attach_to" + + lifecycle_policy_ids: '#/components/schemas/CreateVolumeFromImageSerializer/properties/lifecycle_policy_ids' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.lifecycle_policy_ids" + + metadata: '#/components/schemas/CreateVolumeFromImageSerializer/properties/metadata' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.metadata" + + type_name: '#/components/schemas/CreateVolumeFromImageSerializer/properties/type_name' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.type_name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + snapshot_id: str, + source: Literal["snapshot"], + attachment_tag: str | NotGiven = NOT_GIVEN, + instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, + lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, + metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + size: int | NotGiven = NOT_GIVEN, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/name' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.name" + + snapshot_id: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/snapshot_id' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.snapshot_id" + + source: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/source' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.source" + + attachment_tag: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/attachment_tag' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.attachment_tag" + + instance_id_to_attach_to: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/instance_id_to_attach_to' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.instance_id_to_attach_to" + + lifecycle_policy_ids: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/lifecycle_policy_ids' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.lifecycle_policy_ids" + + metadata: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/metadata' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.metadata" + + size: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/size' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.size" + + type_name: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/type_name' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.type_name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + size: int, + source: Literal["new-volume"], + attachment_tag: str | NotGiven = NOT_GIVEN, + instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, + lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, + metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateNewVolumeSerializer/properties/name' + "$.components.schemas.CreateNewVolumeSerializer.properties.name" + + size: '#/components/schemas/CreateNewVolumeSerializer/properties/size' + "$.components.schemas.CreateNewVolumeSerializer.properties.size" + + source: '#/components/schemas/CreateNewVolumeSerializer/properties/source' + "$.components.schemas.CreateNewVolumeSerializer.properties.source" + + attachment_tag: '#/components/schemas/CreateNewVolumeSerializer/properties/attachment_tag' + "$.components.schemas.CreateNewVolumeSerializer.properties.attachment_tag" + + instance_id_to_attach_to: '#/components/schemas/CreateNewVolumeSerializer/properties/instance_id_to_attach_to' + "$.components.schemas.CreateNewVolumeSerializer.properties.instance_id_to_attach_to" + + lifecycle_policy_ids: '#/components/schemas/CreateNewVolumeSerializer/properties/lifecycle_policy_ids' + "$.components.schemas.CreateNewVolumeSerializer.properties.lifecycle_policy_ids" + + metadata: '#/components/schemas/CreateNewVolumeSerializer/properties/metadata' + "$.components.schemas.CreateNewVolumeSerializer.properties.metadata" + + type_name: '#/components/schemas/CreateNewVolumeSerializer/properties/type_name' + "$.components.schemas.CreateNewVolumeSerializer.properties.type_name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args( + ["image_id", "name", "size", "source"], ["name", "snapshot_id", "source"], ["name", "size", "source"] + ) + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + image_id: str | NotGiven = NOT_GIVEN, + name: str, + size: int | NotGiven = NOT_GIVEN, + source: Literal["image"] | Literal["snapshot"] | Literal["new-volume"], + attachment_tag: str | NotGiven = NOT_GIVEN, + instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, + lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, + metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + | NotGiven = NOT_GIVEN, + snapshot_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + 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_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._post( + f"/cloud/v1/volumes/{project_id}/{region_id}", + body=maybe_transform( + { + "image_id": image_id, + "name": name, + "size": size, + "source": source, + "attachment_tag": attachment_tag, + "instance_id_to_attach_to": instance_id_to_attach_to, + "lifecycle_policy_ids": lifecycle_policy_ids, + "metadata": metadata, + "type_name": type_name, + "snapshot_id": snapshot_id, + }, + volume_create_params.VolumeCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + 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, + ) -> Volume: + """ + Rename volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[2].schema" + + name: '#/components/schemas/NameSerializer/properties/name' + "$.components.schemas.NameSerializer.properties.name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return self._patch( + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + body=maybe_transform({"name": name}, volume_update_params.VolumeUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Volume, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + bootable: bool | NotGiven = NOT_GIVEN, + cluster_id: str | NotGiven = NOT_GIVEN, + has_attachments: bool | NotGiven = NOT_GIVEN, + id_part: str | NotGiven = NOT_GIVEN, + instance_id: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + metadata_k: List[str] | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + name_part: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[Volume]: + """ + List volumes + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[1].schema" + + bootable: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[2]" + + cluster_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[3]" + + has_attachments: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[4]" + + id_part: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[5]" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[6]" + + limit: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[7]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[8]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[9]" + + name_part: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[10]" + + offset: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[11]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/volumes/{project_id}/{region_id}", + page=SyncOffsetPage[Volume], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "bootable": bootable, + "cluster_id": cluster_id, + "has_attachments": has_attachments, + "id_part": id_part, + "instance_id": instance_id, + "limit": limit, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "name_part": name_part, + "offset": offset, + }, + volume_list_params.VolumeListParams, + ), + ), + model=Volume, + ) + + def delete( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + snapshots: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[2].schema" + + snapshots: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/3' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return self._delete( + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"snapshots": snapshots}, volume_delete_params.VolumeDeleteParams), + ), + cast_to=TaskIDList, + ) + + def attach_to_instance( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + instance_id: str, + attachment_tag: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """Attach the volume to instance. + + Note: ultra volume can only be attached to an + instance with shared flavor + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/0/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/1/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/2/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[2].schema" + + instance_id: '#/components/schemas/AttachVolumeToInstanceSerializer/properties/instance_id' + "$.components.schemas.AttachVolumeToInstanceSerializer.properties.instance_id" + + attachment_tag: '#/components/schemas/AttachVolumeToInstanceSerializer/properties/attachment_tag' + "$.components.schemas.AttachVolumeToInstanceSerializer.properties.attachment_tag" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return self._post( + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + body=maybe_transform( + { + "instance_id": instance_id, + "attachment_tag": attachment_tag, + }, + volume_attach_to_instance_params.VolumeAttachToInstanceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def change_type( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + volume_type: Literal["ssd_hiiops", "standard"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Volume: + """ + Change volume type + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/2/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[2].schema" + + volume_type: '#/components/schemas/VolumeRetypeSerializer/properties/volume_type' + "$.components.schemas.VolumeRetypeSerializer.properties.volume_type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return self._post( + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + body=maybe_transform({"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Volume, + ) + + def detach_from_instance( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + instance_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Detach the volume from instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/0/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/1/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/2/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[2].schema" + + instance_id: '#/components/schemas/InstanceIdSerializer/properties/instance_id' + "$.components.schemas.InstanceIdSerializer.properties.instance_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return self._post( + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + body=maybe_transform( + {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Volume: + """ + Get volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].get.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return self._get( + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Volume, + ) + + def resize( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + size: 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, + ) -> TaskIDList: + """ + Extend volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/2/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[2].schema" + + size: '#/components/schemas/SizeSerializer/properties/size' + "$.components.schemas.SizeSerializer.properties.size" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return self._post( + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + body=maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def revert_to_last_snapshot( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Revert volume to it's last snapshot + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Frevert/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Frevert/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert'].post.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Frevert/post/parameters/2/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncVolumesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncVolumesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncVolumesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVolumesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncVolumesResourceWithStreamingResponse(self) + + @overload + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + image_id: str, + name: str, + size: int, + source: Literal["image"], + attachment_tag: str | NotGiven = NOT_GIVEN, + instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, + lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, + metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + + image_id: '#/components/schemas/CreateVolumeFromImageSerializer/properties/image_id' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.image_id" + + name: '#/components/schemas/CreateVolumeFromImageSerializer/properties/name' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.name" + + size: '#/components/schemas/CreateVolumeFromImageSerializer/properties/size' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.size" + + source: '#/components/schemas/CreateVolumeFromImageSerializer/properties/source' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.source" + + attachment_tag: '#/components/schemas/CreateVolumeFromImageSerializer/properties/attachment_tag' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.attachment_tag" + + instance_id_to_attach_to: '#/components/schemas/CreateVolumeFromImageSerializer/properties/instance_id_to_attach_to' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.instance_id_to_attach_to" + + lifecycle_policy_ids: '#/components/schemas/CreateVolumeFromImageSerializer/properties/lifecycle_policy_ids' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.lifecycle_policy_ids" + + metadata: '#/components/schemas/CreateVolumeFromImageSerializer/properties/metadata' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.metadata" + + type_name: '#/components/schemas/CreateVolumeFromImageSerializer/properties/type_name' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.type_name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + snapshot_id: str, + source: Literal["snapshot"], + attachment_tag: str | NotGiven = NOT_GIVEN, + instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, + lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, + metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + size: int | NotGiven = NOT_GIVEN, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/name' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.name" + + snapshot_id: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/snapshot_id' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.snapshot_id" + + source: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/source' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.source" + + attachment_tag: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/attachment_tag' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.attachment_tag" + + instance_id_to_attach_to: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/instance_id_to_attach_to' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.instance_id_to_attach_to" + + lifecycle_policy_ids: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/lifecycle_policy_ids' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.lifecycle_policy_ids" + + metadata: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/metadata' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.metadata" + + size: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/size' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.size" + + type_name: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/type_name' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.type_name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + size: int, + source: Literal["new-volume"], + attachment_tag: str | NotGiven = NOT_GIVEN, + instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, + lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, + metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateNewVolumeSerializer/properties/name' + "$.components.schemas.CreateNewVolumeSerializer.properties.name" + + size: '#/components/schemas/CreateNewVolumeSerializer/properties/size' + "$.components.schemas.CreateNewVolumeSerializer.properties.size" + + source: '#/components/schemas/CreateNewVolumeSerializer/properties/source' + "$.components.schemas.CreateNewVolumeSerializer.properties.source" + + attachment_tag: '#/components/schemas/CreateNewVolumeSerializer/properties/attachment_tag' + "$.components.schemas.CreateNewVolumeSerializer.properties.attachment_tag" + + instance_id_to_attach_to: '#/components/schemas/CreateNewVolumeSerializer/properties/instance_id_to_attach_to' + "$.components.schemas.CreateNewVolumeSerializer.properties.instance_id_to_attach_to" + + lifecycle_policy_ids: '#/components/schemas/CreateNewVolumeSerializer/properties/lifecycle_policy_ids' + "$.components.schemas.CreateNewVolumeSerializer.properties.lifecycle_policy_ids" + + metadata: '#/components/schemas/CreateNewVolumeSerializer/properties/metadata' + "$.components.schemas.CreateNewVolumeSerializer.properties.metadata" + + type_name: '#/components/schemas/CreateNewVolumeSerializer/properties/type_name' + "$.components.schemas.CreateNewVolumeSerializer.properties.type_name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args( + ["image_id", "name", "size", "source"], ["name", "snapshot_id", "source"], ["name", "size", "source"] + ) + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + image_id: str | NotGiven = NOT_GIVEN, + name: str, + size: int | NotGiven = NOT_GIVEN, + source: Literal["image"] | Literal["snapshot"] | Literal["new-volume"], + attachment_tag: str | NotGiven = NOT_GIVEN, + instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, + lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, + metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + | NotGiven = NOT_GIVEN, + snapshot_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + 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_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._post( + f"/cloud/v1/volumes/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "image_id": image_id, + "name": name, + "size": size, + "source": source, + "attachment_tag": attachment_tag, + "instance_id_to_attach_to": instance_id_to_attach_to, + "lifecycle_policy_ids": lifecycle_policy_ids, + "metadata": metadata, + "type_name": type_name, + "snapshot_id": snapshot_id, + }, + volume_create_params.VolumeCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + 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, + ) -> Volume: + """ + Rename volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[2].schema" + + name: '#/components/schemas/NameSerializer/properties/name' + "$.components.schemas.NameSerializer.properties.name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return await self._patch( + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + body=await async_maybe_transform({"name": name}, volume_update_params.VolumeUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Volume, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + bootable: bool | NotGiven = NOT_GIVEN, + cluster_id: str | NotGiven = NOT_GIVEN, + has_attachments: bool | NotGiven = NOT_GIVEN, + id_part: str | NotGiven = NOT_GIVEN, + instance_id: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + metadata_k: List[str] | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + name_part: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Volume, AsyncOffsetPage[Volume]]: + """ + List volumes + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[1].schema" + + bootable: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[2]" + + cluster_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[3]" + + has_attachments: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[4]" + + id_part: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[5]" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[6]" + + limit: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[7]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[8]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[9]" + + name_part: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[10]" + + offset: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[11]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/volumes/{project_id}/{region_id}", + page=AsyncOffsetPage[Volume], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "bootable": bootable, + "cluster_id": cluster_id, + "has_attachments": has_attachments, + "id_part": id_part, + "instance_id": instance_id, + "limit": limit, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "name_part": name_part, + "offset": offset, + }, + volume_list_params.VolumeListParams, + ), + ), + model=Volume, + ) + + async def delete( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + snapshots: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[2].schema" + + snapshots: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/3' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return await self._delete( + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"snapshots": snapshots}, volume_delete_params.VolumeDeleteParams), + ), + cast_to=TaskIDList, + ) + + async def attach_to_instance( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + instance_id: str, + attachment_tag: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """Attach the volume to instance. + + Note: ultra volume can only be attached to an + instance with shared flavor + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/0/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/1/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/2/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[2].schema" + + instance_id: '#/components/schemas/AttachVolumeToInstanceSerializer/properties/instance_id' + "$.components.schemas.AttachVolumeToInstanceSerializer.properties.instance_id" + + attachment_tag: '#/components/schemas/AttachVolumeToInstanceSerializer/properties/attachment_tag' + "$.components.schemas.AttachVolumeToInstanceSerializer.properties.attachment_tag" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return await self._post( + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + body=await async_maybe_transform( + { + "instance_id": instance_id, + "attachment_tag": attachment_tag, + }, + volume_attach_to_instance_params.VolumeAttachToInstanceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def change_type( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + volume_type: Literal["ssd_hiiops", "standard"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Volume: + """ + Change volume type + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/2/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[2].schema" + + volume_type: '#/components/schemas/VolumeRetypeSerializer/properties/volume_type' + "$.components.schemas.VolumeRetypeSerializer.properties.volume_type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return await self._post( + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + body=await async_maybe_transform( + {"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Volume, + ) + + async def detach_from_instance( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + instance_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Detach the volume from instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/0/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/1/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/2/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[2].schema" + + instance_id: '#/components/schemas/InstanceIdSerializer/properties/instance_id' + "$.components.schemas.InstanceIdSerializer.properties.instance_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return await self._post( + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + body=await async_maybe_transform( + {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Volume: + """ + Get volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].get.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return await self._get( + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Volume, + ) + + async def resize( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + size: 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, + ) -> TaskIDList: + """ + Extend volume + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/2/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[2].schema" + + size: '#/components/schemas/SizeSerializer/properties/size' + "$.components.schemas.SizeSerializer.properties.size" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + return await self._post( + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + body=await async_maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def revert_to_last_snapshot( + self, + volume_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Revert volume to it's last snapshot + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Frevert/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Frevert/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert'].post.parameters[1].schema" + + volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Frevert/post/parameters/2/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not volume_id: + raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class VolumesResourceWithRawResponse: + def __init__(self, volumes: VolumesResource) -> None: + self._volumes = volumes + + self.create = to_raw_response_wrapper( + volumes.create, + ) + self.update = to_raw_response_wrapper( + volumes.update, + ) + self.list = to_raw_response_wrapper( + volumes.list, + ) + self.delete = to_raw_response_wrapper( + volumes.delete, + ) + self.attach_to_instance = to_raw_response_wrapper( + volumes.attach_to_instance, + ) + self.change_type = to_raw_response_wrapper( + volumes.change_type, + ) + self.detach_from_instance = to_raw_response_wrapper( + volumes.detach_from_instance, + ) + self.get = to_raw_response_wrapper( + volumes.get, + ) + self.resize = to_raw_response_wrapper( + volumes.resize, + ) + self.revert_to_last_snapshot = to_raw_response_wrapper( + volumes.revert_to_last_snapshot, + ) + + +class AsyncVolumesResourceWithRawResponse: + def __init__(self, volumes: AsyncVolumesResource) -> None: + self._volumes = volumes + + self.create = async_to_raw_response_wrapper( + volumes.create, + ) + self.update = async_to_raw_response_wrapper( + volumes.update, + ) + self.list = async_to_raw_response_wrapper( + volumes.list, + ) + self.delete = async_to_raw_response_wrapper( + volumes.delete, + ) + self.attach_to_instance = async_to_raw_response_wrapper( + volumes.attach_to_instance, + ) + self.change_type = async_to_raw_response_wrapper( + volumes.change_type, + ) + self.detach_from_instance = async_to_raw_response_wrapper( + volumes.detach_from_instance, + ) + self.get = async_to_raw_response_wrapper( + volumes.get, + ) + self.resize = async_to_raw_response_wrapper( + volumes.resize, + ) + self.revert_to_last_snapshot = async_to_raw_response_wrapper( + volumes.revert_to_last_snapshot, + ) + + +class VolumesResourceWithStreamingResponse: + def __init__(self, volumes: VolumesResource) -> None: + self._volumes = volumes + + self.create = to_streamed_response_wrapper( + volumes.create, + ) + self.update = to_streamed_response_wrapper( + volumes.update, + ) + self.list = to_streamed_response_wrapper( + volumes.list, + ) + self.delete = to_streamed_response_wrapper( + volumes.delete, + ) + self.attach_to_instance = to_streamed_response_wrapper( + volumes.attach_to_instance, + ) + self.change_type = to_streamed_response_wrapper( + volumes.change_type, + ) + self.detach_from_instance = to_streamed_response_wrapper( + volumes.detach_from_instance, + ) + self.get = to_streamed_response_wrapper( + volumes.get, + ) + self.resize = to_streamed_response_wrapper( + volumes.resize, + ) + self.revert_to_last_snapshot = to_streamed_response_wrapper( + volumes.revert_to_last_snapshot, + ) + + +class AsyncVolumesResourceWithStreamingResponse: + def __init__(self, volumes: AsyncVolumesResource) -> None: + self._volumes = volumes + + self.create = async_to_streamed_response_wrapper( + volumes.create, + ) + self.update = async_to_streamed_response_wrapper( + volumes.update, + ) + self.list = async_to_streamed_response_wrapper( + volumes.list, + ) + self.delete = async_to_streamed_response_wrapper( + volumes.delete, + ) + self.attach_to_instance = async_to_streamed_response_wrapper( + volumes.attach_to_instance, + ) + self.change_type = async_to_streamed_response_wrapper( + volumes.change_type, + ) + self.detach_from_instance = async_to_streamed_response_wrapper( + volumes.detach_from_instance, + ) + self.get = async_to_streamed_response_wrapper( + volumes.get, + ) + self.resize = async_to_streamed_response_wrapper( + volumes.resize, + ) + self.revert_to_last_snapshot = async_to_streamed_response_wrapper( + volumes.revert_to_last_snapshot, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index a0382a84..116f0400 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -7,6 +7,7 @@ from .region import Region as Region from .secret import Secret as Secret from .subnet import Subnet as Subnet +from .volume import Volume as Volume from .network import Network as Network from .project import Project as Project from .ssh_key import SSHKey as SSHKey @@ -23,6 +24,7 @@ from .ddos_profile_field import DDOSProfileField as DDOSProfileField from .floating_ip_status import FloatingIPStatus as FloatingIPStatus from .region_list_params import RegionListParams as RegionListParams +from .volume_list_params import VolumeListParams as VolumeListParams from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .project_list_params import ProjectListParams as ProjectListParams @@ -31,6 +33,10 @@ from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed from .secret_create_params import SecretCreateParams as SecretCreateParams from .secret_list_response import SecretListResponse as SecretListResponse +from .volume_create_params import VolumeCreateParams as VolumeCreateParams +from .volume_delete_params import VolumeDeleteParams as VolumeDeleteParams +from .volume_resize_params import VolumeResizeParams as VolumeResizeParams +from .volume_update_params import VolumeUpdateParams as VolumeUpdateParams from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate from .project_create_params import ProjectCreateParams as ProjectCreateParams from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams @@ -45,6 +51,7 @@ from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse +from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole @@ -53,5 +60,7 @@ from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams +from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity +from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams diff --git a/src/gcore/types/cloud/volume.py b/src/gcore/types/cloud/volume.py new file mode 100644 index 00000000..dadcb691 --- /dev/null +++ b/src/gcore/types/cloud/volume.py @@ -0,0 +1,231 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .tag import Tag +from ..._models import BaseModel + +__all__ = ["Volume", "Attachment", "LimiterStats"] + + +class Attachment(BaseModel): + attachment_id: str + """ + '#/components/schemas/VolumeAttachmentSerializer/properties/attachment_id' + "$.components.schemas.VolumeAttachmentSerializer.properties.attachment_id" + """ + + volume_id: str + """ + '#/components/schemas/VolumeAttachmentSerializer/properties/volume_id' + "$.components.schemas.VolumeAttachmentSerializer.properties.volume_id" + """ + + attached_at: Optional[datetime] = None + """ + '#/components/schemas/VolumeAttachmentSerializer/properties/attached_at/anyOf/0' + "$.components.schemas.VolumeAttachmentSerializer.properties.attached_at.anyOf[0]" + """ + + device: Optional[str] = None + """ + '#/components/schemas/VolumeAttachmentSerializer/properties/device/anyOf/0' + "$.components.schemas.VolumeAttachmentSerializer.properties.device.anyOf[0]" + """ + + flavor_id: Optional[str] = None + """ + '#/components/schemas/VolumeAttachmentSerializer/properties/flavor_id/anyOf/0' + "$.components.schemas.VolumeAttachmentSerializer.properties.flavor_id.anyOf[0]" + """ + + instance_name: Optional[str] = None + """ + '#/components/schemas/VolumeAttachmentSerializer/properties/instance_name/anyOf/0' + "$.components.schemas.VolumeAttachmentSerializer.properties.instance_name.anyOf[0]" + """ + + server_id: Optional[str] = None + """ + '#/components/schemas/VolumeAttachmentSerializer/properties/server_id/anyOf/0' + "$.components.schemas.VolumeAttachmentSerializer.properties.server_id.anyOf[0]" + """ + + +class LimiterStats(BaseModel): + iops_base_limit: int + """ + '#/components/schemas/VolumeLimiterStatsSerializer/properties/iops_base_limit' + "$.components.schemas.VolumeLimiterStatsSerializer.properties.iops_base_limit" + """ + + iops_burst_limit: int + """ + '#/components/schemas/VolumeLimiterStatsSerializer/properties/iops_burst_limit' + "$.components.schemas.VolumeLimiterStatsSerializer.properties.iops_burst_limit" + """ + + m_bps_base_limit: int = FieldInfo(alias="MBps_base_limit") + """ + '#/components/schemas/VolumeLimiterStatsSerializer/properties/MBps_base_limit' + "$.components.schemas.VolumeLimiterStatsSerializer.properties.MBps_base_limit" + """ + + m_bps_burst_limit: int = FieldInfo(alias="MBps_burst_limit") + """ + '#/components/schemas/VolumeLimiterStatsSerializer/properties/MBps_burst_limit' + "$.components.schemas.VolumeLimiterStatsSerializer.properties.MBps_burst_limit" + """ + + +class Volume(BaseModel): + id: str + """ + '#/components/schemas/VolumeSerializer/properties/id' + "$.components.schemas.VolumeSerializer.properties.id" + """ + + bootable: bool + """ + '#/components/schemas/VolumeSerializer/properties/bootable' + "$.components.schemas.VolumeSerializer.properties.bootable" + """ + + created_at: datetime + """ + '#/components/schemas/VolumeSerializer/properties/created_at' + "$.components.schemas.VolumeSerializer.properties.created_at" + """ + + is_root_volume: bool + """ + '#/components/schemas/VolumeSerializer/properties/is_root_volume' + "$.components.schemas.VolumeSerializer.properties.is_root_volume" + """ + + metadata_detailed: List[Tag] + """ + '#/components/schemas/VolumeSerializer/properties/metadata_detailed' + "$.components.schemas.VolumeSerializer.properties.metadata_detailed" + """ + + name: str + """ + '#/components/schemas/VolumeSerializer/properties/name' + "$.components.schemas.VolumeSerializer.properties.name" + """ + + project_id: int + """ + '#/components/schemas/VolumeSerializer/properties/project_id' + "$.components.schemas.VolumeSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/VolumeSerializer/properties/region' + "$.components.schemas.VolumeSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/VolumeSerializer/properties/region_id' + "$.components.schemas.VolumeSerializer.properties.region_id" + """ + + size: int + """ + '#/components/schemas/VolumeSerializer/properties/size' + "$.components.schemas.VolumeSerializer.properties.size" + """ + + status: Literal[ + "attaching", + "available", + "awaiting-transfer", + "backing-up", + "creating", + "deleting", + "detaching", + "downloading", + "error", + "error_backing-up", + "error_deleting", + "error_extending", + "error_restoring", + "extending", + "in-use", + "maintenance", + "reserved", + "restoring-backup", + "retyping", + "uploading", + ] + """ + '#/components/schemas/VolumeSerializer/properties/status' + "$.components.schemas.VolumeSerializer.properties.status" + """ + + tags: List[Tag] + """ + '#/components/schemas/VolumeSerializer/properties/tags' + "$.components.schemas.VolumeSerializer.properties.tags" + """ + + volume_type: str + """ + '#/components/schemas/VolumeSerializer/properties/volume_type' + "$.components.schemas.VolumeSerializer.properties.volume_type" + """ + + attachments: Optional[List[Attachment]] = None + """ + '#/components/schemas/VolumeSerializer/properties/attachments/anyOf/0' + "$.components.schemas.VolumeSerializer.properties.attachments.anyOf[0]" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/VolumeSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.VolumeSerializer.properties.creator_task_id.anyOf[0]" + """ + + limiter_stats: Optional[LimiterStats] = None + """ + '#/components/schemas/VolumeSerializer/properties/limiter_stats/anyOf/0' + "$.components.schemas.VolumeSerializer.properties.limiter_stats.anyOf[0]" + """ + + metadata: Optional[Dict[str, str]] = None + """ + '#/components/schemas/VolumeSerializer/properties/metadata/anyOf/0' + "$.components.schemas.VolumeSerializer.properties.metadata.anyOf[0]" + """ + + snapshot_ids: Optional[List[str]] = None + """ + '#/components/schemas/VolumeSerializer/properties/snapshot_ids/anyOf/0' + "$.components.schemas.VolumeSerializer.properties.snapshot_ids.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/VolumeSerializer/properties/task_id/anyOf/0' + "$.components.schemas.VolumeSerializer.properties.task_id.anyOf[0]" + """ + + updated_at: Optional[datetime] = None + """ + '#/components/schemas/VolumeSerializer/properties/updated_at/anyOf/0' + "$.components.schemas.VolumeSerializer.properties.updated_at.anyOf[0]" + """ + + volume_image_metadata: Optional[Dict[str, str]] = None + """ + '#/components/schemas/VolumeSerializer/properties/volume_image_metadata/anyOf/0' + "$.components.schemas.VolumeSerializer.properties.volume_image_metadata.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/volume_attach_to_instance_params.py b/src/gcore/types/cloud/volume_attach_to_instance_params.py new file mode 100644 index 00000000..76d118e4 --- /dev/null +++ b/src/gcore/types/cloud/volume_attach_to_instance_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["VolumeAttachToInstanceParams"] + + +class VolumeAttachToInstanceParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/0/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/1/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[1].schema" + """ + + instance_id: Required[str] + """ + '#/components/schemas/AttachVolumeToInstanceSerializer/properties/instance_id' + "$.components.schemas.AttachVolumeToInstanceSerializer.properties.instance_id" + """ + + attachment_tag: str + """ + '#/components/schemas/AttachVolumeToInstanceSerializer/properties/attachment_tag' + "$.components.schemas.AttachVolumeToInstanceSerializer.properties.attachment_tag" + """ diff --git a/src/gcore/types/cloud/volume_change_type_params.py b/src/gcore/types/cloud/volume_change_type_params.py new file mode 100644 index 00000000..0cc057fc --- /dev/null +++ b/src/gcore/types/cloud/volume_change_type_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["VolumeChangeTypeParams"] + + +class VolumeChangeTypeParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[1].schema" + """ + + volume_type: Required[Literal["ssd_hiiops", "standard"]] + """ + '#/components/schemas/VolumeRetypeSerializer/properties/volume_type' + "$.components.schemas.VolumeRetypeSerializer.properties.volume_type" + """ diff --git a/src/gcore/types/cloud/volume_create_params.py b/src/gcore/types/cloud/volume_create_params.py new file mode 100644 index 00000000..643674e6 --- /dev/null +++ b/src/gcore/types/cloud/volume_create_params.py @@ -0,0 +1,218 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .tag_update_list_param import TagUpdateListParam + +__all__ = [ + "VolumeCreateParams", + "CreateVolumeFromImageSerializer", + "CreateVolumeFromSnapshotSerializer", + "CreateNewVolumeSerializer", +] + + +class CreateVolumeFromImageSerializer(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + image_id: Required[str] + """ + '#/components/schemas/CreateVolumeFromImageSerializer/properties/image_id' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.image_id" + """ + + name: Required[str] + """ + '#/components/schemas/CreateVolumeFromImageSerializer/properties/name' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.name" + """ + + size: Required[int] + """ + '#/components/schemas/CreateVolumeFromImageSerializer/properties/size' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.size" + """ + + source: Required[Literal["image"]] + """ + '#/components/schemas/CreateVolumeFromImageSerializer/properties/source' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.source" + """ + + attachment_tag: str + """ + '#/components/schemas/CreateVolumeFromImageSerializer/properties/attachment_tag' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.attachment_tag" + """ + + instance_id_to_attach_to: str + """ + '#/components/schemas/CreateVolumeFromImageSerializer/properties/instance_id_to_attach_to' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.instance_id_to_attach_to" + """ + + lifecycle_policy_ids: Iterable[int] + """ + '#/components/schemas/CreateVolumeFromImageSerializer/properties/lifecycle_policy_ids' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.lifecycle_policy_ids" + """ + + metadata: TagUpdateListParam + """ + '#/components/schemas/CreateVolumeFromImageSerializer/properties/metadata' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.metadata" + """ + + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + """ + '#/components/schemas/CreateVolumeFromImageSerializer/properties/type_name' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.type_name" + """ + + +class CreateVolumeFromSnapshotSerializer(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/name' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.name" + """ + + snapshot_id: Required[str] + """ + '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/snapshot_id' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.snapshot_id" + """ + + source: Required[Literal["snapshot"]] + """ + '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/source' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.source" + """ + + attachment_tag: str + """ + '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/attachment_tag' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.attachment_tag" + """ + + instance_id_to_attach_to: str + """ + '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/instance_id_to_attach_to' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.instance_id_to_attach_to" + """ + + lifecycle_policy_ids: Iterable[int] + """ + '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/lifecycle_policy_ids' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.lifecycle_policy_ids" + """ + + metadata: TagUpdateListParam + """ + '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/metadata' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.metadata" + """ + + size: int + """ + '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/size' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.size" + """ + + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + """ + '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/type_name' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.type_name" + """ + + +class CreateNewVolumeSerializer(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/CreateNewVolumeSerializer/properties/name' + "$.components.schemas.CreateNewVolumeSerializer.properties.name" + """ + + size: Required[int] + """ + '#/components/schemas/CreateNewVolumeSerializer/properties/size' + "$.components.schemas.CreateNewVolumeSerializer.properties.size" + """ + + source: Required[Literal["new-volume"]] + """ + '#/components/schemas/CreateNewVolumeSerializer/properties/source' + "$.components.schemas.CreateNewVolumeSerializer.properties.source" + """ + + attachment_tag: str + """ + '#/components/schemas/CreateNewVolumeSerializer/properties/attachment_tag' + "$.components.schemas.CreateNewVolumeSerializer.properties.attachment_tag" + """ + + instance_id_to_attach_to: str + """ + '#/components/schemas/CreateNewVolumeSerializer/properties/instance_id_to_attach_to' + "$.components.schemas.CreateNewVolumeSerializer.properties.instance_id_to_attach_to" + """ + + lifecycle_policy_ids: Iterable[int] + """ + '#/components/schemas/CreateNewVolumeSerializer/properties/lifecycle_policy_ids' + "$.components.schemas.CreateNewVolumeSerializer.properties.lifecycle_policy_ids" + """ + + metadata: TagUpdateListParam + """ + '#/components/schemas/CreateNewVolumeSerializer/properties/metadata' + "$.components.schemas.CreateNewVolumeSerializer.properties.metadata" + """ + + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + """ + '#/components/schemas/CreateNewVolumeSerializer/properties/type_name' + "$.components.schemas.CreateNewVolumeSerializer.properties.type_name" + """ + + +VolumeCreateParams: TypeAlias = Union[ + CreateVolumeFromImageSerializer, CreateVolumeFromSnapshotSerializer, CreateNewVolumeSerializer +] diff --git a/src/gcore/types/cloud/volume_delete_params.py b/src/gcore/types/cloud/volume_delete_params.py new file mode 100644 index 00000000..0ee0199f --- /dev/null +++ b/src/gcore/types/cloud/volume_delete_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["VolumeDeleteParams"] + + +class VolumeDeleteParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[1].schema" + """ + + snapshots: str + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/3' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[3]" + """ diff --git a/src/gcore/types/cloud/volume_detach_from_instance_params.py b/src/gcore/types/cloud/volume_detach_from_instance_params.py new file mode 100644 index 00000000..d58bea9d --- /dev/null +++ b/src/gcore/types/cloud/volume_detach_from_instance_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["VolumeDetachFromInstanceParams"] + + +class VolumeDetachFromInstanceParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/0/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/1/schema' + "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[1].schema" + """ + + instance_id: Required[str] + """ + '#/components/schemas/InstanceIdSerializer/properties/instance_id' + "$.components.schemas.InstanceIdSerializer.properties.instance_id" + """ diff --git a/src/gcore/types/cloud/volume_list_params.py b/src/gcore/types/cloud/volume_list_params.py new file mode 100644 index 00000000..950cc8c9 --- /dev/null +++ b/src/gcore/types/cloud/volume_list_params.py @@ -0,0 +1,82 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import TypedDict + +__all__ = ["VolumeListParams"] + + +class VolumeListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + bootable: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[2]" + """ + + cluster_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[3]" + """ + + has_attachments: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[4]" + """ + + id_part: str + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[5]" + """ + + instance_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[6]" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[7]" + """ + + metadata_k: List[str] + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[8]" + """ + + metadata_kv: str + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[9]" + """ + + name_part: str + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[10]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[11]" + """ diff --git a/src/gcore/types/cloud/volume_resize_params.py b/src/gcore/types/cloud/volume_resize_params.py new file mode 100644 index 00000000..d6b633b0 --- /dev/null +++ b/src/gcore/types/cloud/volume_resize_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["VolumeResizeParams"] + + +class VolumeResizeParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[1].schema" + """ + + size: Required[int] + """ + '#/components/schemas/SizeSerializer/properties/size' + "$.components.schemas.SizeSerializer.properties.size" + """ diff --git a/src/gcore/types/cloud/volume_update_params.py b/src/gcore/types/cloud/volume_update_params.py new file mode 100644 index 00000000..60cda2d2 --- /dev/null +++ b/src/gcore/types/cloud/volume_update_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["VolumeUpdateParams"] + + +class VolumeUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/NameSerializer/properties/name' + "$.components.schemas.NameSerializer.properties.name" + """ diff --git a/tests/api_resources/cloud/test_volumes.py b/tests/api_resources/cloud/test_volumes.py new file mode 100644 index 00000000..cb7c981a --- /dev/null +++ b/tests/api_resources/cloud/test_volumes.py @@ -0,0 +1,1312 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import ( + Volume, + TaskIDList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestVolumes: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create_overload_1(self, client: Gcore) -> None: + volume = client.cloud.volumes.create( + project_id=1, + region_id=1, + image_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + name="volume-1", + size=10, + source="image", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: + volume = client.cloud.volumes.create( + project_id=1, + region_id=1, + image_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + name="volume-1", + size=10, + source="image", + attachment_tag="device-tag", + instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + lifecycle_policy_ids=[1, 2], + metadata={"foo": "my-tag-value"}, + type_name="standard", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_raw_response_create_overload_1(self, client: Gcore) -> None: + response = client.cloud.volumes.with_raw_response.create( + project_id=1, + region_id=1, + image_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + name="volume-1", + size=10, + source="image", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_1(self, client: Gcore) -> None: + with client.cloud.volumes.with_streaming_response.create( + project_id=1, + region_id=1, + image_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + name="volume-1", + size=10, + source="image", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_2(self, client: Gcore) -> None: + volume = client.cloud.volumes.create( + project_id=1, + region_id=1, + name="volume-1", + snapshot_id="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + source="snapshot", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: + volume = client.cloud.volumes.create( + project_id=1, + region_id=1, + name="volume-1", + snapshot_id="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + source="snapshot", + attachment_tag="device-tag", + instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + lifecycle_policy_ids=[1, 2], + metadata={"foo": "my-tag-value"}, + size=10, + type_name="standard", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_raw_response_create_overload_2(self, client: Gcore) -> None: + response = client.cloud.volumes.with_raw_response.create( + project_id=1, + region_id=1, + name="volume-1", + snapshot_id="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + source="snapshot", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_2(self, client: Gcore) -> None: + with client.cloud.volumes.with_streaming_response.create( + project_id=1, + region_id=1, + name="volume-1", + snapshot_id="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + source="snapshot", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_3(self, client: Gcore) -> None: + volume = client.cloud.volumes.create( + project_id=1, + region_id=1, + name="volume-1", + size=10, + source="new-volume", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_3(self, client: Gcore) -> None: + volume = client.cloud.volumes.create( + project_id=1, + region_id=1, + name="volume-1", + size=10, + source="new-volume", + attachment_tag="device-tag", + instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + lifecycle_policy_ids=[1, 2], + metadata={"foo": "my-tag-value"}, + type_name="standard", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_raw_response_create_overload_3(self, client: Gcore) -> None: + response = client.cloud.volumes.with_raw_response.create( + project_id=1, + region_id=1, + name="volume-1", + size=10, + source="new-volume", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_3(self, client: Gcore) -> None: + with client.cloud.volumes.with_streaming_response.create( + project_id=1, + region_id=1, + name="volume-1", + size=10, + source="new-volume", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + volume = client.cloud.volumes.update( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + name="my-resource", + ) + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.volumes.with_raw_response.update( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + name="my-resource", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.volumes.with_streaming_response.update( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + name="my-resource", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert_matches_type(Volume, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + client.cloud.volumes.with_raw_response.update( + volume_id="", + project_id=1, + region_id=1, + name="my-resource", + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + volume = client.cloud.volumes.list( + project_id=1, + region_id=1, + ) + assert_matches_type(SyncOffsetPage[Volume], volume, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + volume = client.cloud.volumes.list( + project_id=1, + region_id=1, + bootable=False, + cluster_id="t12345", + has_attachments=True, + id_part="726ecfcc-7fd0-4e30-a86e-7892524aa483", + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + limit=1000, + metadata_k=["key1", "key2"], + metadata_kv="metadata_kv", + name_part="test", + offset=0, + ) + assert_matches_type(SyncOffsetPage[Volume], volume, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.volumes.with_raw_response.list( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert_matches_type(SyncOffsetPage[Volume], volume, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.volumes.with_streaming_response.list( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert_matches_type(SyncOffsetPage[Volume], volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + volume = client.cloud.volumes.delete( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_method_delete_with_all_params(self, client: Gcore) -> None: + volume = client.cloud.volumes.delete( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + snapshots="726ecfcc-7fd0-4e30-a86e-7892524aa483,726ecfcc-7fd0-4e30-a86e-7892524aa484", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.volumes.with_raw_response.delete( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.volumes.with_streaming_response.delete( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + client.cloud.volumes.with_raw_response.delete( + volume_id="", + project_id=1, + region_id=1, + ) + + @parametrize + def test_method_attach_to_instance(self, client: Gcore) -> None: + volume = client.cloud.volumes.attach_to_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_method_attach_to_instance_with_all_params(self, client: Gcore) -> None: + volume = client.cloud.volumes.attach_to_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + attachment_tag="root", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_raw_response_attach_to_instance(self, client: Gcore) -> None: + response = client.cloud.volumes.with_raw_response.attach_to_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_streaming_response_attach_to_instance(self, client: Gcore) -> None: + with client.cloud.volumes.with_streaming_response.attach_to_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_to_instance(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + client.cloud.volumes.with_raw_response.attach_to_instance( + volume_id="", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) + + @parametrize + def test_method_change_type(self, client: Gcore) -> None: + volume = client.cloud.volumes.change_type( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + volume_type="ssd_hiiops", + ) + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + def test_raw_response_change_type(self, client: Gcore) -> None: + response = client.cloud.volumes.with_raw_response.change_type( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + volume_type="ssd_hiiops", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + def test_streaming_response_change_type(self, client: Gcore) -> None: + with client.cloud.volumes.with_streaming_response.change_type( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + volume_type="ssd_hiiops", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert_matches_type(Volume, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_change_type(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + client.cloud.volumes.with_raw_response.change_type( + volume_id="", + project_id=1, + region_id=1, + volume_type="ssd_hiiops", + ) + + @parametrize + def test_method_detach_from_instance(self, client: Gcore) -> None: + volume = client.cloud.volumes.detach_from_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_raw_response_detach_from_instance(self, client: Gcore) -> None: + response = client.cloud.volumes.with_raw_response.detach_from_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_streaming_response_detach_from_instance(self, client: Gcore) -> None: + with client.cloud.volumes.with_streaming_response.detach_from_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_detach_from_instance(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + client.cloud.volumes.with_raw_response.detach_from_instance( + volume_id="", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + volume = client.cloud.volumes.get( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.volumes.with_raw_response.get( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.volumes.with_streaming_response.get( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert_matches_type(Volume, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + client.cloud.volumes.with_raw_response.get( + volume_id="", + project_id=1, + region_id=1, + ) + + @parametrize + def test_method_resize(self, client: Gcore) -> None: + volume = client.cloud.volumes.resize( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + size=100, + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_raw_response_resize(self, client: Gcore) -> None: + response = client.cloud.volumes.with_raw_response.resize( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + size=100, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + def test_streaming_response_resize(self, client: Gcore) -> None: + with client.cloud.volumes.with_streaming_response.resize( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + size=100, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_resize(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + client.cloud.volumes.with_raw_response.resize( + volume_id="", + project_id=1, + region_id=1, + size=100, + ) + + @parametrize + def test_method_revert_to_last_snapshot(self, client: Gcore) -> None: + volume = client.cloud.volumes.revert_to_last_snapshot( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert volume is None + + @parametrize + def test_raw_response_revert_to_last_snapshot(self, client: Gcore) -> None: + response = client.cloud.volumes.with_raw_response.revert_to_last_snapshot( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert volume is None + + @parametrize + def test_streaming_response_revert_to_last_snapshot(self, client: Gcore) -> None: + with client.cloud.volumes.with_streaming_response.revert_to_last_snapshot( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert volume is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_revert_to_last_snapshot(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + client.cloud.volumes.with_raw_response.revert_to_last_snapshot( + volume_id="", + project_id=1, + region_id=1, + ) + + +class TestAsyncVolumes: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create_overload_1(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.create( + project_id=1, + region_id=1, + image_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + name="volume-1", + size=10, + source="image", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.create( + project_id=1, + region_id=1, + image_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + name="volume-1", + size=10, + source="image", + attachment_tag="device-tag", + instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + lifecycle_policy_ids=[1, 2], + metadata={"foo": "my-tag-value"}, + type_name="standard", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volumes.with_raw_response.create( + project_id=1, + region_id=1, + image_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + name="volume-1", + size=10, + source="image", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volumes.with_streaming_response.create( + project_id=1, + region_id=1, + image_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + name="volume-1", + size=10, + source="image", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_2(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.create( + project_id=1, + region_id=1, + name="volume-1", + snapshot_id="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + source="snapshot", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.create( + project_id=1, + region_id=1, + name="volume-1", + snapshot_id="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + source="snapshot", + attachment_tag="device-tag", + instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + lifecycle_policy_ids=[1, 2], + metadata={"foo": "my-tag-value"}, + size=10, + type_name="standard", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volumes.with_raw_response.create( + project_id=1, + region_id=1, + name="volume-1", + snapshot_id="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + source="snapshot", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volumes.with_streaming_response.create( + project_id=1, + region_id=1, + name="volume-1", + snapshot_id="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + source="snapshot", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_3(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.create( + project_id=1, + region_id=1, + name="volume-1", + size=10, + source="new-volume", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.create( + project_id=1, + region_id=1, + name="volume-1", + size=10, + source="new-volume", + attachment_tag="device-tag", + instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", + lifecycle_policy_ids=[1, 2], + metadata={"foo": "my-tag-value"}, + type_name="standard", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_3(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volumes.with_raw_response.create( + project_id=1, + region_id=1, + name="volume-1", + size=10, + source="new-volume", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_3(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volumes.with_streaming_response.create( + project_id=1, + region_id=1, + name="volume-1", + size=10, + source="new-volume", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.update( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + name="my-resource", + ) + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volumes.with_raw_response.update( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + name="my-resource", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volumes.with_streaming_response.update( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + name="my-resource", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert_matches_type(Volume, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + await async_client.cloud.volumes.with_raw_response.update( + volume_id="", + project_id=1, + region_id=1, + name="my-resource", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.list( + project_id=1, + region_id=1, + ) + assert_matches_type(AsyncOffsetPage[Volume], volume, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.list( + project_id=1, + region_id=1, + bootable=False, + cluster_id="t12345", + has_attachments=True, + id_part="726ecfcc-7fd0-4e30-a86e-7892524aa483", + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + limit=1000, + metadata_k=["key1", "key2"], + metadata_kv="metadata_kv", + name_part="test", + offset=0, + ) + assert_matches_type(AsyncOffsetPage[Volume], volume, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volumes.with_raw_response.list( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert_matches_type(AsyncOffsetPage[Volume], volume, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volumes.with_streaming_response.list( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert_matches_type(AsyncOffsetPage[Volume], volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.delete( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.delete( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + snapshots="726ecfcc-7fd0-4e30-a86e-7892524aa483,726ecfcc-7fd0-4e30-a86e-7892524aa484", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volumes.with_raw_response.delete( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volumes.with_streaming_response.delete( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + await async_client.cloud.volumes.with_raw_response.delete( + volume_id="", + project_id=1, + region_id=1, + ) + + @parametrize + async def test_method_attach_to_instance(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.attach_to_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_method_attach_to_instance_with_all_params(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.attach_to_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + attachment_tag="root", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_raw_response_attach_to_instance(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volumes.with_raw_response.attach_to_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_streaming_response_attach_to_instance(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volumes.with_streaming_response.attach_to_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_to_instance(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + await async_client.cloud.volumes.with_raw_response.attach_to_instance( + volume_id="", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) + + @parametrize + async def test_method_change_type(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.change_type( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + volume_type="ssd_hiiops", + ) + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + async def test_raw_response_change_type(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volumes.with_raw_response.change_type( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + volume_type="ssd_hiiops", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + async def test_streaming_response_change_type(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volumes.with_streaming_response.change_type( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + volume_type="ssd_hiiops", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert_matches_type(Volume, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_change_type(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + await async_client.cloud.volumes.with_raw_response.change_type( + volume_id="", + project_id=1, + region_id=1, + volume_type="ssd_hiiops", + ) + + @parametrize + async def test_method_detach_from_instance(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.detach_from_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_raw_response_detach_from_instance(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volumes.with_raw_response.detach_from_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_streaming_response_detach_from_instance(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volumes.with_streaming_response.detach_from_instance( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_detach_from_instance(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + await async_client.cloud.volumes.with_raw_response.detach_from_instance( + volume_id="", + project_id=1, + region_id=1, + instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.get( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volumes.with_raw_response.get( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volumes.with_streaming_response.get( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert_matches_type(Volume, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + await async_client.cloud.volumes.with_raw_response.get( + volume_id="", + project_id=1, + region_id=1, + ) + + @parametrize + async def test_method_resize(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.resize( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + size=100, + ) + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volumes.with_raw_response.resize( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + size=100, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + @parametrize + async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volumes.with_streaming_response.resize( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + size=100, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert_matches_type(TaskIDList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_resize(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + await async_client.cloud.volumes.with_raw_response.resize( + volume_id="", + project_id=1, + region_id=1, + size=100, + ) + + @parametrize + async def test_method_revert_to_last_snapshot(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.revert_to_last_snapshot( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert volume is None + + @parametrize + async def test_raw_response_revert_to_last_snapshot(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volumes.with_raw_response.revert_to_last_snapshot( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert volume is None + + @parametrize + async def test_streaming_response_revert_to_last_snapshot(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volumes.with_streaming_response.revert_to_last_snapshot( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert volume is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_revert_to_last_snapshot(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `volume_id` but received ''"): + await async_client.cloud.volumes.with_raw_response.revert_to_last_snapshot( + volume_id="", + project_id=1, + region_id=1, + ) From 9e0c1367e5b47c7cb1789961e4092b173895c8e6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 05:20:21 +0000 Subject: [PATCH 054/592] GCLOUD2-18669 feat: Add routers --- .stats.yml | 4 +- api.md | 20 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + .../resources/cloud/networks/__init__.py | 33 + .../resources/cloud/networks/networks.py | 102 ++ src/gcore/resources/cloud/networks/routers.py | 982 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 1 + src/gcore/types/cloud/networks/__init__.py | 11 + src/gcore/types/cloud/networks/router.py | 169 +++ .../networks/router_attach_subnet_params.py | 27 + .../cloud/networks/router_create_params.py | 107 ++ .../networks/router_detach_subnet_params.py | 27 + src/gcore/types/cloud/networks/router_list.py | 22 + .../cloud/networks/router_list_params.py | 33 + .../cloud/networks/router_update_params.py | 62 ++ src/gcore/types/cloud/neutron_route_param.py | 21 + .../api_resources/cloud/networks/__init__.py | 1 + .../cloud/networks/test_routers.py | 756 ++++++++++++++ 19 files changed, 2422 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/networks/__init__.py create mode 100644 src/gcore/resources/cloud/networks/networks.py create mode 100644 src/gcore/resources/cloud/networks/routers.py create mode 100644 src/gcore/types/cloud/networks/__init__.py create mode 100644 src/gcore/types/cloud/networks/router.py create mode 100644 src/gcore/types/cloud/networks/router_attach_subnet_params.py create mode 100644 src/gcore/types/cloud/networks/router_create_params.py create mode 100644 src/gcore/types/cloud/networks/router_detach_subnet_params.py create mode 100644 src/gcore/types/cloud/networks/router_list.py create mode 100644 src/gcore/types/cloud/networks/router_list_params.py create mode 100644 src/gcore/types/cloud/networks/router_update_params.py create mode 100644 src/gcore/types/cloud/neutron_route_param.py create mode 100644 tests/api_resources/cloud/networks/__init__.py create mode 100644 tests/api_resources/cloud/networks/test_routers.py diff --git a/.stats.yml b/.stats.yml index d850ecfb..48715d48 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 54 +configured_endpoints: 61 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-28c3946475abf5194d41060fed9f70c03e0aa956609b80f9904e3e93c4b5d3ac.yml openapi_spec_hash: da50234dcbbe99b74a2ae4a1b7f2999e -config_hash: 42f74af7b7e6377b709a027acce77398 +config_hash: 5ae91376a8a2c6e5b0cddc435a38d49f diff --git a/api.md b/api.md index f88129e5..24085f98 100644 --- a/api.md +++ b/api.md @@ -188,6 +188,26 @@ Methods: - client.cloud.reserved_fixed_ips.vip.toggle(port_id, \*, project_id, region_id, \*\*params) -> ReservedFixedIP - client.cloud.reserved_fixed_ips.vip.update_connected_ports(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList +## Networks + +### Routers + +Types: + +```python +from gcore.types.cloud.networks import Router, RouterList, SubnetID +``` + +Methods: + +- client.cloud.networks.routers.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.networks.routers.update(router_id, \*, project_id, region_id, \*\*params) -> Router +- client.cloud.networks.routers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Router] +- client.cloud.networks.routers.delete(router_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.networks.routers.attach_subnet(router_id, \*, project_id, region_id, \*\*params) -> Router +- client.cloud.networks.routers.detach_subnet(router_id, \*, project_id, region_id, \*\*params) -> Router +- client.cloud.networks.routers.get(router_id, \*, project_id, region_id) -> Router + ## Volumes Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 9281aa96..804d7362 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -48,6 +48,14 @@ VolumesResourceWithStreamingResponse, AsyncVolumesResourceWithStreamingResponse, ) +from .networks import ( + NetworksResource, + AsyncNetworksResource, + NetworksResourceWithRawResponse, + AsyncNetworksResourceWithRawResponse, + NetworksResourceWithStreamingResponse, + AsyncNetworksResourceWithStreamingResponse, +) from .projects import ( ProjectsResource, AsyncProjectsResource, @@ -138,6 +146,12 @@ "AsyncReservedFixedIPsResourceWithRawResponse", "ReservedFixedIPsResourceWithStreamingResponse", "AsyncReservedFixedIPsResourceWithStreamingResponse", + "NetworksResource", + "AsyncNetworksResource", + "NetworksResourceWithRawResponse", + "AsyncNetworksResourceWithRawResponse", + "NetworksResourceWithStreamingResponse", + "AsyncNetworksResourceWithStreamingResponse", "VolumesResource", "AsyncVolumesResource", "VolumesResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 3b991167..1aee1293 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -76,6 +76,14 @@ QuotasResourceWithStreamingResponse, AsyncQuotasResourceWithStreamingResponse, ) +from .networks.networks import ( + NetworksResource, + AsyncNetworksResource, + NetworksResourceWithRawResponse, + AsyncNetworksResourceWithRawResponse, + NetworksResourceWithStreamingResponse, + AsyncNetworksResourceWithStreamingResponse, +) from .reserved_fixed_ips.reserved_fixed_ips import ( ReservedFixedIPsResource, AsyncReservedFixedIPsResource, @@ -121,6 +129,10 @@ def ip_ranges(self) -> IPRangesResource: def reserved_fixed_ips(self) -> ReservedFixedIPsResource: return ReservedFixedIPsResource(self._client) + @cached_property + def networks(self) -> NetworksResource: + return NetworksResource(self._client) + @cached_property def volumes(self) -> VolumesResource: return VolumesResource(self._client) @@ -182,6 +194,10 @@ def ip_ranges(self) -> AsyncIPRangesResource: def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResource: return AsyncReservedFixedIPsResource(self._client) + @cached_property + def networks(self) -> AsyncNetworksResource: + return AsyncNetworksResource(self._client) + @cached_property def volumes(self) -> AsyncVolumesResource: return AsyncVolumesResource(self._client) @@ -246,6 +262,10 @@ def ip_ranges(self) -> IPRangesResourceWithRawResponse: def reserved_fixed_ips(self) -> ReservedFixedIPsResourceWithRawResponse: return ReservedFixedIPsResourceWithRawResponse(self._cloud.reserved_fixed_ips) + @cached_property + def networks(self) -> NetworksResourceWithRawResponse: + return NetworksResourceWithRawResponse(self._cloud.networks) + @cached_property def volumes(self) -> VolumesResourceWithRawResponse: return VolumesResourceWithRawResponse(self._cloud.volumes) @@ -291,6 +311,10 @@ def ip_ranges(self) -> AsyncIPRangesResourceWithRawResponse: def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResourceWithRawResponse: return AsyncReservedFixedIPsResourceWithRawResponse(self._cloud.reserved_fixed_ips) + @cached_property + def networks(self) -> AsyncNetworksResourceWithRawResponse: + return AsyncNetworksResourceWithRawResponse(self._cloud.networks) + @cached_property def volumes(self) -> AsyncVolumesResourceWithRawResponse: return AsyncVolumesResourceWithRawResponse(self._cloud.volumes) @@ -336,6 +360,10 @@ def ip_ranges(self) -> IPRangesResourceWithStreamingResponse: def reserved_fixed_ips(self) -> ReservedFixedIPsResourceWithStreamingResponse: return ReservedFixedIPsResourceWithStreamingResponse(self._cloud.reserved_fixed_ips) + @cached_property + def networks(self) -> NetworksResourceWithStreamingResponse: + return NetworksResourceWithStreamingResponse(self._cloud.networks) + @cached_property def volumes(self) -> VolumesResourceWithStreamingResponse: return VolumesResourceWithStreamingResponse(self._cloud.volumes) @@ -381,6 +409,10 @@ def ip_ranges(self) -> AsyncIPRangesResourceWithStreamingResponse: def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResourceWithStreamingResponse: return AsyncReservedFixedIPsResourceWithStreamingResponse(self._cloud.reserved_fixed_ips) + @cached_property + def networks(self) -> AsyncNetworksResourceWithStreamingResponse: + return AsyncNetworksResourceWithStreamingResponse(self._cloud.networks) + @cached_property def volumes(self) -> AsyncVolumesResourceWithStreamingResponse: return AsyncVolumesResourceWithStreamingResponse(self._cloud.volumes) diff --git a/src/gcore/resources/cloud/networks/__init__.py b/src/gcore/resources/cloud/networks/__init__.py new file mode 100644 index 00000000..5631e7e9 --- /dev/null +++ b/src/gcore/resources/cloud/networks/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .routers import ( + RoutersResource, + AsyncRoutersResource, + RoutersResourceWithRawResponse, + AsyncRoutersResourceWithRawResponse, + RoutersResourceWithStreamingResponse, + AsyncRoutersResourceWithStreamingResponse, +) +from .networks import ( + NetworksResource, + AsyncNetworksResource, + NetworksResourceWithRawResponse, + AsyncNetworksResourceWithRawResponse, + NetworksResourceWithStreamingResponse, + AsyncNetworksResourceWithStreamingResponse, +) + +__all__ = [ + "RoutersResource", + "AsyncRoutersResource", + "RoutersResourceWithRawResponse", + "AsyncRoutersResourceWithRawResponse", + "RoutersResourceWithStreamingResponse", + "AsyncRoutersResourceWithStreamingResponse", + "NetworksResource", + "AsyncNetworksResource", + "NetworksResourceWithRawResponse", + "AsyncNetworksResourceWithRawResponse", + "NetworksResourceWithStreamingResponse", + "AsyncNetworksResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py new file mode 100644 index 00000000..bfb62826 --- /dev/null +++ b/src/gcore/resources/cloud/networks/networks.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .routers import ( + RoutersResource, + AsyncRoutersResource, + RoutersResourceWithRawResponse, + AsyncRoutersResourceWithRawResponse, + RoutersResourceWithStreamingResponse, + AsyncRoutersResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["NetworksResource", "AsyncNetworksResource"] + + +class NetworksResource(SyncAPIResource): + @cached_property + def routers(self) -> RoutersResource: + return RoutersResource(self._client) + + @cached_property + def with_raw_response(self) -> NetworksResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return NetworksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> NetworksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return NetworksResourceWithStreamingResponse(self) + + +class AsyncNetworksResource(AsyncAPIResource): + @cached_property + def routers(self) -> AsyncRoutersResource: + return AsyncRoutersResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncNetworksResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncNetworksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncNetworksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncNetworksResourceWithStreamingResponse(self) + + +class NetworksResourceWithRawResponse: + def __init__(self, networks: NetworksResource) -> None: + self._networks = networks + + @cached_property + def routers(self) -> RoutersResourceWithRawResponse: + return RoutersResourceWithRawResponse(self._networks.routers) + + +class AsyncNetworksResourceWithRawResponse: + def __init__(self, networks: AsyncNetworksResource) -> None: + self._networks = networks + + @cached_property + def routers(self) -> AsyncRoutersResourceWithRawResponse: + return AsyncRoutersResourceWithRawResponse(self._networks.routers) + + +class NetworksResourceWithStreamingResponse: + def __init__(self, networks: NetworksResource) -> None: + self._networks = networks + + @cached_property + def routers(self) -> RoutersResourceWithStreamingResponse: + return RoutersResourceWithStreamingResponse(self._networks.routers) + + +class AsyncNetworksResourceWithStreamingResponse: + def __init__(self, networks: AsyncNetworksResource) -> None: + self._networks = networks + + @cached_property + def routers(self) -> AsyncRoutersResourceWithStreamingResponse: + return AsyncRoutersResourceWithStreamingResponse(self._networks.routers) diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py new file mode 100644 index 00000000..4f42131b --- /dev/null +++ b/src/gcore/resources/cloud/networks/routers.py @@ -0,0 +1,982 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.networks import ( + router_list_params, + router_create_params, + router_update_params, + router_attach_subnet_params, + router_detach_subnet_params, +) +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.networks.router import Router +from ....types.cloud.neutron_route_param import NeutronRouteParam + +__all__ = ["RoutersResource", "AsyncRoutersResource"] + + +class RoutersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RoutersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return RoutersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RoutersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return RoutersResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, + interfaces: Optional[Iterable[router_create_params.Interface]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create router + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateRouterSerializer/properties/name' + "$.components.schemas.CreateRouterSerializer.properties.name" + + external_gateway_info: '#/components/schemas/CreateRouterSerializer/properties/external_gateway_info' + "$.components.schemas.CreateRouterSerializer.properties.external_gateway_info" + + interfaces: '#/components/schemas/CreateRouterSerializer/properties/interfaces/anyOf/0' + "$.components.schemas.CreateRouterSerializer.properties.interfaces.anyOf[0]" + + routes: '#/components/schemas/CreateRouterSerializer/properties/routes/anyOf/0' + "$.components.schemas.CreateRouterSerializer.properties.routes.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._post( + f"/cloud/v1/routers/{project_id}/{region_id}", + body=maybe_transform( + { + "name": name, + "external_gateway_info": external_gateway_info, + "interfaces": interfaces, + "routes": routes, + }, + router_create_params.RouterCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + router_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Router: + """ + Update router + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[1].schema" + + router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[2].schema" + + external_gateway_info: '#/components/schemas/PatchRouterSerializer/properties/external_gateway_info/anyOf/0' + "$.components.schemas.PatchRouterSerializer.properties.external_gateway_info.anyOf[0]" + + name: '#/components/schemas/PatchRouterSerializer/properties/name/anyOf/0' + "$.components.schemas.PatchRouterSerializer.properties.name.anyOf[0]" + + routes: '#/components/schemas/PatchRouterSerializer/properties/routes/anyOf/0' + "$.components.schemas.PatchRouterSerializer.properties.routes.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not router_id: + raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") + return self._patch( + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + body=maybe_transform( + { + "external_gateway_info": external_gateway_info, + "name": name, + "routes": routes, + }, + router_update_params.RouterUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Router, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[Router]: + """ + List routers + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[2]" + + offset: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/routers/{project_id}/{region_id}", + page=SyncOffsetPage[Router], + 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, + }, + router_list_params.RouterListParams, + ), + ), + model=Router, + ) + + def delete( + self, + router_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete router + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}']['delete'].parameters[1].schema" + + router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not router_id: + raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") + return self._delete( + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def attach_subnet( + self, + router_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Router: + """ + Attach subnet to router + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[1].schema" + + router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/2/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[2].schema" + + subnet_id: '#/components/schemas/SubnetIdSerializer/properties/subnet_id' + "$.components.schemas.SubnetIdSerializer.properties.subnet_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not router_id: + raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") + return self._post( + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + body=maybe_transform({"subnet_id": subnet_id}, router_attach_subnet_params.RouterAttachSubnetParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Router, + ) + + def detach_subnet( + self, + router_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Router: + """ + Detach subnet from router + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[1].schema" + + router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/2/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[2].schema" + + subnet_id: '#/components/schemas/SubnetIdSerializer/properties/subnet_id' + "$.components.schemas.SubnetIdSerializer.properties.subnet_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not router_id: + raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") + return self._post( + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + body=maybe_transform({"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Router, + ) + + def get( + self, + router_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Router: + """ + Get specific router + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].get.parameters[1].schema" + + router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not router_id: + raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") + return self._get( + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Router, + ) + + +class AsyncRoutersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRoutersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRoutersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRoutersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncRoutersResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, + interfaces: Optional[Iterable[router_create_params.Interface]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create router + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateRouterSerializer/properties/name' + "$.components.schemas.CreateRouterSerializer.properties.name" + + external_gateway_info: '#/components/schemas/CreateRouterSerializer/properties/external_gateway_info' + "$.components.schemas.CreateRouterSerializer.properties.external_gateway_info" + + interfaces: '#/components/schemas/CreateRouterSerializer/properties/interfaces/anyOf/0' + "$.components.schemas.CreateRouterSerializer.properties.interfaces.anyOf[0]" + + routes: '#/components/schemas/CreateRouterSerializer/properties/routes/anyOf/0' + "$.components.schemas.CreateRouterSerializer.properties.routes.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._post( + f"/cloud/v1/routers/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "name": name, + "external_gateway_info": external_gateway_info, + "interfaces": interfaces, + "routes": routes, + }, + router_create_params.RouterCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + router_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Router: + """ + Update router + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[1].schema" + + router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[2].schema" + + external_gateway_info: '#/components/schemas/PatchRouterSerializer/properties/external_gateway_info/anyOf/0' + "$.components.schemas.PatchRouterSerializer.properties.external_gateway_info.anyOf[0]" + + name: '#/components/schemas/PatchRouterSerializer/properties/name/anyOf/0' + "$.components.schemas.PatchRouterSerializer.properties.name.anyOf[0]" + + routes: '#/components/schemas/PatchRouterSerializer/properties/routes/anyOf/0' + "$.components.schemas.PatchRouterSerializer.properties.routes.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not router_id: + raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") + return await self._patch( + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + body=await async_maybe_transform( + { + "external_gateway_info": external_gateway_info, + "name": name, + "routes": routes, + }, + router_update_params.RouterUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Router, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Router, AsyncOffsetPage[Router]]: + """ + List routers + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[2]" + + offset: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/routers/{project_id}/{region_id}", + page=AsyncOffsetPage[Router], + 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, + }, + router_list_params.RouterListParams, + ), + ), + model=Router, + ) + + async def delete( + self, + router_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete router + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}']['delete'].parameters[1].schema" + + router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not router_id: + raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") + return await self._delete( + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def attach_subnet( + self, + router_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Router: + """ + Attach subnet to router + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[1].schema" + + router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/2/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[2].schema" + + subnet_id: '#/components/schemas/SubnetIdSerializer/properties/subnet_id' + "$.components.schemas.SubnetIdSerializer.properties.subnet_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not router_id: + raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") + return await self._post( + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + body=await async_maybe_transform( + {"subnet_id": subnet_id}, router_attach_subnet_params.RouterAttachSubnetParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Router, + ) + + async def detach_subnet( + self, + router_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Router: + """ + Detach subnet from router + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[1].schema" + + router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/2/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[2].schema" + + subnet_id: '#/components/schemas/SubnetIdSerializer/properties/subnet_id' + "$.components.schemas.SubnetIdSerializer.properties.subnet_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not router_id: + raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") + return await self._post( + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + body=await async_maybe_transform( + {"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Router, + ) + + async def get( + self, + router_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Router: + """ + Get specific router + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].get.parameters[1].schema" + + router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not router_id: + raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") + return await self._get( + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Router, + ) + + +class RoutersResourceWithRawResponse: + def __init__(self, routers: RoutersResource) -> None: + self._routers = routers + + self.create = to_raw_response_wrapper( + routers.create, + ) + self.update = to_raw_response_wrapper( + routers.update, + ) + self.list = to_raw_response_wrapper( + routers.list, + ) + self.delete = to_raw_response_wrapper( + routers.delete, + ) + self.attach_subnet = to_raw_response_wrapper( + routers.attach_subnet, + ) + self.detach_subnet = to_raw_response_wrapper( + routers.detach_subnet, + ) + self.get = to_raw_response_wrapper( + routers.get, + ) + + +class AsyncRoutersResourceWithRawResponse: + def __init__(self, routers: AsyncRoutersResource) -> None: + self._routers = routers + + self.create = async_to_raw_response_wrapper( + routers.create, + ) + self.update = async_to_raw_response_wrapper( + routers.update, + ) + self.list = async_to_raw_response_wrapper( + routers.list, + ) + self.delete = async_to_raw_response_wrapper( + routers.delete, + ) + self.attach_subnet = async_to_raw_response_wrapper( + routers.attach_subnet, + ) + self.detach_subnet = async_to_raw_response_wrapper( + routers.detach_subnet, + ) + self.get = async_to_raw_response_wrapper( + routers.get, + ) + + +class RoutersResourceWithStreamingResponse: + def __init__(self, routers: RoutersResource) -> None: + self._routers = routers + + self.create = to_streamed_response_wrapper( + routers.create, + ) + self.update = to_streamed_response_wrapper( + routers.update, + ) + self.list = to_streamed_response_wrapper( + routers.list, + ) + self.delete = to_streamed_response_wrapper( + routers.delete, + ) + self.attach_subnet = to_streamed_response_wrapper( + routers.attach_subnet, + ) + self.detach_subnet = to_streamed_response_wrapper( + routers.detach_subnet, + ) + self.get = to_streamed_response_wrapper( + routers.get, + ) + + +class AsyncRoutersResourceWithStreamingResponse: + def __init__(self, routers: AsyncRoutersResource) -> None: + self._routers = routers + + self.create = async_to_streamed_response_wrapper( + routers.create, + ) + self.update = async_to_streamed_response_wrapper( + routers.update, + ) + self.list = async_to_streamed_response_wrapper( + routers.list, + ) + self.delete = async_to_streamed_response_wrapper( + routers.delete, + ) + self.attach_subnet = async_to_streamed_response_wrapper( + routers.attach_subnet, + ) + self.detach_subnet = async_to_streamed_response_wrapper( + routers.detach_subnet, + ) + self.get = async_to_streamed_response_wrapper( + routers.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 116f0400..8885a467 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -27,6 +27,7 @@ from .volume_list_params import VolumeListParams as VolumeListParams from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily +from .neutron_route_param import NeutronRouteParam as NeutronRouteParam from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams diff --git a/src/gcore/types/cloud/networks/__init__.py b/src/gcore/types/cloud/networks/__init__.py new file mode 100644 index 00000000..e9e0ee94 --- /dev/null +++ b/src/gcore/types/cloud/networks/__init__.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .router import Router as Router +from .router_list import RouterList as RouterList +from .router_list_params import RouterListParams as RouterListParams +from .router_create_params import RouterCreateParams as RouterCreateParams +from .router_update_params import RouterUpdateParams as RouterUpdateParams +from .router_attach_subnet_params import RouterAttachSubnetParams as RouterAttachSubnetParams +from .router_detach_subnet_params import RouterDetachSubnetParams as RouterDetachSubnetParams diff --git a/src/gcore/types/cloud/networks/router.py b/src/gcore/types/cloud/networks/router.py new file mode 100644 index 00000000..dfe2fb5f --- /dev/null +++ b/src/gcore/types/cloud/networks/router.py @@ -0,0 +1,169 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel +from ..neutron_route import NeutronRoute + +__all__ = ["Router", "Interface", "InterfaceIPAssignment", "ExternalGatewayInfo", "ExternalGatewayInfoExternalFixedIP"] + + +class InterfaceIPAssignment(BaseModel): + ip_address: str + """ + '#/components/schemas/PortIpSubnetIdSerializer/properties/ip_address' + "$.components.schemas.PortIpSubnetIdSerializer.properties.ip_address" + """ + + subnet_id: str + """ + '#/components/schemas/PortIpSubnetIdSerializer/properties/subnet_id' + "$.components.schemas.PortIpSubnetIdSerializer.properties.subnet_id" + """ + + +class Interface(BaseModel): + ip_assignments: List[InterfaceIPAssignment] + """ + '#/components/schemas/PortSerializer/properties/ip_assignments' + "$.components.schemas.PortSerializer.properties.ip_assignments" + """ + + network_id: str + """ + '#/components/schemas/PortSerializer/properties/network_id' + "$.components.schemas.PortSerializer.properties.network_id" + """ + + port_id: str + """ + '#/components/schemas/PortSerializer/properties/port_id' + "$.components.schemas.PortSerializer.properties.port_id" + """ + + mac_address: Optional[str] = None + """ + '#/components/schemas/PortSerializer/properties/mac_address/anyOf/0' + "$.components.schemas.PortSerializer.properties.mac_address.anyOf[0]" + """ + + +class ExternalGatewayInfoExternalFixedIP(BaseModel): + ip_address: str + """ + '#/components/schemas/PortIpSubnetIdSerializer/properties/ip_address' + "$.components.schemas.PortIpSubnetIdSerializer.properties.ip_address" + """ + + subnet_id: str + """ + '#/components/schemas/PortIpSubnetIdSerializer/properties/subnet_id' + "$.components.schemas.PortIpSubnetIdSerializer.properties.subnet_id" + """ + + +class ExternalGatewayInfo(BaseModel): + enable_snat: bool + """ + '#/components/schemas/ExternalGatewaySerializer/properties/enable_snat' + "$.components.schemas.ExternalGatewaySerializer.properties.enable_snat" + """ + + external_fixed_ips: List[ExternalGatewayInfoExternalFixedIP] + """ + '#/components/schemas/ExternalGatewaySerializer/properties/external_fixed_ips' + "$.components.schemas.ExternalGatewaySerializer.properties.external_fixed_ips" + """ + + network_id: str + """ + '#/components/schemas/ExternalGatewaySerializer/properties/network_id' + "$.components.schemas.ExternalGatewaySerializer.properties.network_id" + """ + + +class Router(BaseModel): + id: str + """ + '#/components/schemas/RouterSerializer/properties/id' + "$.components.schemas.RouterSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/RouterSerializer/properties/created_at' + "$.components.schemas.RouterSerializer.properties.created_at" + """ + + distributed: bool + """ + '#/components/schemas/RouterSerializer/properties/distributed' + "$.components.schemas.RouterSerializer.properties.distributed" + """ + + interfaces: List[Interface] + """ + '#/components/schemas/RouterSerializer/properties/interfaces' + "$.components.schemas.RouterSerializer.properties.interfaces" + """ + + name: str + """ + '#/components/schemas/RouterSerializer/properties/name' + "$.components.schemas.RouterSerializer.properties.name" + """ + + project_id: int + """ + '#/components/schemas/RouterSerializer/properties/project_id' + "$.components.schemas.RouterSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/RouterSerializer/properties/region' + "$.components.schemas.RouterSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/RouterSerializer/properties/region_id' + "$.components.schemas.RouterSerializer.properties.region_id" + """ + + routes: List[NeutronRoute] + """ + '#/components/schemas/RouterSerializer/properties/routes' + "$.components.schemas.RouterSerializer.properties.routes" + """ + + status: str + """ + '#/components/schemas/RouterSerializer/properties/status' + "$.components.schemas.RouterSerializer.properties.status" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/RouterSerializer/properties/task_id/anyOf/0' + "$.components.schemas.RouterSerializer.properties.task_id.anyOf[0]" + """ + + updated_at: datetime + """ + '#/components/schemas/RouterSerializer/properties/updated_at' + "$.components.schemas.RouterSerializer.properties.updated_at" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/RouterSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.RouterSerializer.properties.creator_task_id.anyOf[0]" + """ + + external_gateway_info: Optional[ExternalGatewayInfo] = None + """ + '#/components/schemas/RouterSerializer/properties/external_gateway_info/anyOf/0' + "$.components.schemas.RouterSerializer.properties.external_gateway_info.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/networks/router_attach_subnet_params.py b/src/gcore/types/cloud/networks/router_attach_subnet_params.py new file mode 100644 index 00000000..9e23b7df --- /dev/null +++ b/src/gcore/types/cloud/networks/router_attach_subnet_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RouterAttachSubnetParams"] + + +class RouterAttachSubnetParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[1].schema" + """ + + subnet_id: Required[str] + """ + '#/components/schemas/SubnetIdSerializer/properties/subnet_id' + "$.components.schemas.SubnetIdSerializer.properties.subnet_id" + """ diff --git a/src/gcore/types/cloud/networks/router_create_params.py b/src/gcore/types/cloud/networks/router_create_params.py new file mode 100644 index 00000000..b47d07a6 --- /dev/null +++ b/src/gcore/types/cloud/networks/router_create_params.py @@ -0,0 +1,107 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from ..neutron_route_param import NeutronRouteParam + +__all__ = [ + "RouterCreateParams", + "ExternalGatewayInfo", + "ExternalGatewayInfoRouterExternalManualGwSerializer", + "ExternalGatewayInfoRouterExternalDefaultGwSerializer", + "Interface", +] + + +class RouterCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/CreateRouterSerializer/properties/name' + "$.components.schemas.CreateRouterSerializer.properties.name" + """ + + external_gateway_info: Optional[ExternalGatewayInfo] + """ + '#/components/schemas/CreateRouterSerializer/properties/external_gateway_info' + "$.components.schemas.CreateRouterSerializer.properties.external_gateway_info" + """ + + interfaces: Optional[Iterable[Interface]] + """ + '#/components/schemas/CreateRouterSerializer/properties/interfaces/anyOf/0' + "$.components.schemas.CreateRouterSerializer.properties.interfaces.anyOf[0]" + """ + + routes: Optional[Iterable[NeutronRouteParam]] + """ + '#/components/schemas/CreateRouterSerializer/properties/routes/anyOf/0' + "$.components.schemas.CreateRouterSerializer.properties.routes.anyOf[0]" + """ + + +class ExternalGatewayInfoRouterExternalManualGwSerializer(TypedDict, total=False): + network_id: Required[str] + """ + '#/components/schemas/RouterExternalManualGwSerializer/properties/network_id' + "$.components.schemas.RouterExternalManualGwSerializer.properties.network_id" + """ + + enable_snat: bool + """ + '#/components/schemas/RouterExternalManualGwSerializer/properties/enable_snat' + "$.components.schemas.RouterExternalManualGwSerializer.properties.enable_snat" + """ + + type: Literal["manual"] + """ + '#/components/schemas/RouterExternalManualGwSerializer/properties/type' + "$.components.schemas.RouterExternalManualGwSerializer.properties.type" + """ + + +class ExternalGatewayInfoRouterExternalDefaultGwSerializer(TypedDict, total=False): + enable_snat: bool + """ + '#/components/schemas/RouterExternalDefaultGwSerializer/properties/enable_snat' + "$.components.schemas.RouterExternalDefaultGwSerializer.properties.enable_snat" + """ + + type: Literal["default"] + """ + '#/components/schemas/RouterExternalDefaultGwSerializer/properties/type' + "$.components.schemas.RouterExternalDefaultGwSerializer.properties.type" + """ + + +ExternalGatewayInfo: TypeAlias = Union[ + ExternalGatewayInfoRouterExternalManualGwSerializer, ExternalGatewayInfoRouterExternalDefaultGwSerializer +] + + +class Interface(TypedDict, total=False): + subnet_id: Required[str] + """ + '#/components/schemas/CreateRouterInterfaceSubnetSerializer/properties/subnet_id' + "$.components.schemas.CreateRouterInterfaceSubnetSerializer.properties.subnet_id" + """ + + type: Literal["subnet"] + """ + '#/components/schemas/CreateRouterInterfaceSubnetSerializer/properties/type' + "$.components.schemas.CreateRouterInterfaceSubnetSerializer.properties.type" + """ diff --git a/src/gcore/types/cloud/networks/router_detach_subnet_params.py b/src/gcore/types/cloud/networks/router_detach_subnet_params.py new file mode 100644 index 00000000..ba7db5bb --- /dev/null +++ b/src/gcore/types/cloud/networks/router_detach_subnet_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RouterDetachSubnetParams"] + + +class RouterDetachSubnetParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[1].schema" + """ + + subnet_id: Required[str] + """ + '#/components/schemas/SubnetIdSerializer/properties/subnet_id' + "$.components.schemas.SubnetIdSerializer.properties.subnet_id" + """ diff --git a/src/gcore/types/cloud/networks/router_list.py b/src/gcore/types/cloud/networks/router_list.py new file mode 100644 index 00000000..79d4b6df --- /dev/null +++ b/src/gcore/types/cloud/networks/router_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .router import Router +from ...._models import BaseModel + +__all__ = ["RouterList"] + + +class RouterList(BaseModel): + count: int + """ + '#/components/schemas/RouterSerializerList/properties/count' + "$.components.schemas.RouterSerializerList.properties.count" + """ + + results: List[Router] + """ + '#/components/schemas/RouterSerializerList/properties/results' + "$.components.schemas.RouterSerializerList.properties.results" + """ diff --git a/src/gcore/types/cloud/networks/router_list_params.py b/src/gcore/types/cloud/networks/router_list_params.py new file mode 100644 index 00000000..96ddd1af --- /dev/null +++ b/src/gcore/types/cloud/networks/router_list_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["RouterListParams"] + + +class RouterListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[2]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[3]" + """ diff --git a/src/gcore/types/cloud/networks/router_update_params.py b/src/gcore/types/cloud/networks/router_update_params.py new file mode 100644 index 00000000..53aab8f1 --- /dev/null +++ b/src/gcore/types/cloud/networks/router_update_params.py @@ -0,0 +1,62 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +from ..neutron_route_param import NeutronRouteParam + +__all__ = ["RouterUpdateParams", "ExternalGatewayInfo"] + + +class RouterUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[1].schema" + """ + + external_gateway_info: Optional[ExternalGatewayInfo] + """ + '#/components/schemas/PatchRouterSerializer/properties/external_gateway_info/anyOf/0' + "$.components.schemas.PatchRouterSerializer.properties.external_gateway_info.anyOf[0]" + """ + + name: Optional[str] + """ + '#/components/schemas/PatchRouterSerializer/properties/name/anyOf/0' + "$.components.schemas.PatchRouterSerializer.properties.name.anyOf[0]" + """ + + routes: Optional[Iterable[NeutronRouteParam]] + """ + '#/components/schemas/PatchRouterSerializer/properties/routes/anyOf/0' + "$.components.schemas.PatchRouterSerializer.properties.routes.anyOf[0]" + """ + + +class ExternalGatewayInfo(TypedDict, total=False): + network_id: Required[str] + """ + '#/components/schemas/RouterExternalManualGwSerializer/properties/network_id' + "$.components.schemas.RouterExternalManualGwSerializer.properties.network_id" + """ + + enable_snat: bool + """ + '#/components/schemas/RouterExternalManualGwSerializer/properties/enable_snat' + "$.components.schemas.RouterExternalManualGwSerializer.properties.enable_snat" + """ + + type: Literal["manual"] + """ + '#/components/schemas/RouterExternalManualGwSerializer/properties/type' + "$.components.schemas.RouterExternalManualGwSerializer.properties.type" + """ diff --git a/src/gcore/types/cloud/neutron_route_param.py b/src/gcore/types/cloud/neutron_route_param.py new file mode 100644 index 00000000..24651682 --- /dev/null +++ b/src/gcore/types/cloud/neutron_route_param.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 Required, TypedDict + +__all__ = ["NeutronRouteParam"] + + +class NeutronRouteParam(TypedDict, total=False): + destination: Required[str] + """ + '#/components/schemas/NeutronRouteSerializer/properties/destination' + "$.components.schemas.NeutronRouteSerializer.properties.destination" + """ + + nexthop: Required[str] + """ + '#/components/schemas/NeutronRouteSerializer/properties/nexthop' + "$.components.schemas.NeutronRouteSerializer.properties.nexthop" + """ diff --git a/tests/api_resources/cloud/networks/__init__.py b/tests/api_resources/cloud/networks/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/networks/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/networks/test_routers.py b/tests/api_resources/cloud/networks/test_routers.py new file mode 100644 index 00000000..329a44ca --- /dev/null +++ b/tests/api_resources/cloud/networks/test_routers.py @@ -0,0 +1,756 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.networks import ( + Router, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRouters: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + router = client.cloud.networks.routers.create( + project_id=0, + region_id=0, + name="my_wonderful_router", + ) + assert_matches_type(TaskIDList, router, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + router = client.cloud.networks.routers.create( + project_id=0, + region_id=0, + name="my_wonderful_router", + external_gateway_info={ + "enable_snat": True, + "type": "default", + }, + interfaces=[ + { + "subnet_id": "3ed9e2ce-f906-47fb-ba32-c25a3f63df4f", + "type": "subnet", + } + ], + routes=[ + { + "destination": "10.0.3.0/24", + "nexthop": "10.0.0.13", + } + ], + ) + assert_matches_type(TaskIDList, router, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.networks.routers.with_raw_response.create( + project_id=0, + region_id=0, + name="my_wonderful_router", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = response.parse() + assert_matches_type(TaskIDList, router, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.networks.routers.with_streaming_response.create( + project_id=0, + region_id=0, + name="my_wonderful_router", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = response.parse() + assert_matches_type(TaskIDList, router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + router = client.cloud.networks.routers.update( + router_id="router_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Router, router, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + router = client.cloud.networks.routers.update( + router_id="router_id", + project_id=0, + region_id=0, + external_gateway_info={ + "network_id": "d7745dcf-b302-4795-9d61-6cc52487af48", + "enable_snat": False, + "type": "manual", + }, + name="my_renamed_router", + routes=[ + { + "destination": "10.0.3.0/24", + "nexthop": "10.0.0.13", + } + ], + ) + assert_matches_type(Router, router, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.networks.routers.with_raw_response.update( + router_id="router_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = response.parse() + assert_matches_type(Router, router, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.networks.routers.with_streaming_response.update( + router_id="router_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = response.parse() + assert_matches_type(Router, router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): + client.cloud.networks.routers.with_raw_response.update( + router_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + router = client.cloud.networks.routers.list( + project_id=0, + region_id=0, + ) + assert_matches_type(SyncOffsetPage[Router], router, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + router = client.cloud.networks.routers.list( + project_id=0, + region_id=0, + limit=0, + offset=0, + ) + assert_matches_type(SyncOffsetPage[Router], router, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.networks.routers.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = response.parse() + assert_matches_type(SyncOffsetPage[Router], router, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.networks.routers.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = response.parse() + assert_matches_type(SyncOffsetPage[Router], router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + router = client.cloud.networks.routers.delete( + router_id="router_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, router, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.networks.routers.with_raw_response.delete( + router_id="router_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = response.parse() + assert_matches_type(TaskIDList, router, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.networks.routers.with_streaming_response.delete( + router_id="router_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = response.parse() + assert_matches_type(TaskIDList, router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): + client.cloud.networks.routers.with_raw_response.delete( + router_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_attach_subnet(self, client: Gcore) -> None: + router = client.cloud.networks.routers.attach_subnet( + router_id="router_id", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) + assert_matches_type(Router, router, path=["response"]) + + @parametrize + def test_raw_response_attach_subnet(self, client: Gcore) -> None: + response = client.cloud.networks.routers.with_raw_response.attach_subnet( + router_id="router_id", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = response.parse() + assert_matches_type(Router, router, path=["response"]) + + @parametrize + def test_streaming_response_attach_subnet(self, client: Gcore) -> None: + with client.cloud.networks.routers.with_streaming_response.attach_subnet( + router_id="router_id", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = response.parse() + assert_matches_type(Router, router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_subnet(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): + client.cloud.networks.routers.with_raw_response.attach_subnet( + router_id="", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) + + @parametrize + def test_method_detach_subnet(self, client: Gcore) -> None: + router = client.cloud.networks.routers.detach_subnet( + router_id="router_id", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) + assert_matches_type(Router, router, path=["response"]) + + @parametrize + def test_raw_response_detach_subnet(self, client: Gcore) -> None: + response = client.cloud.networks.routers.with_raw_response.detach_subnet( + router_id="router_id", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = response.parse() + assert_matches_type(Router, router, path=["response"]) + + @parametrize + def test_streaming_response_detach_subnet(self, client: Gcore) -> None: + with client.cloud.networks.routers.with_streaming_response.detach_subnet( + router_id="router_id", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = response.parse() + assert_matches_type(Router, router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_detach_subnet(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): + client.cloud.networks.routers.with_raw_response.detach_subnet( + router_id="", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + router = client.cloud.networks.routers.get( + router_id="router_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Router, router, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.networks.routers.with_raw_response.get( + router_id="router_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = response.parse() + assert_matches_type(Router, router, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.networks.routers.with_streaming_response.get( + router_id="router_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = response.parse() + assert_matches_type(Router, router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): + client.cloud.networks.routers.with_raw_response.get( + router_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncRouters: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + router = await async_client.cloud.networks.routers.create( + project_id=0, + region_id=0, + name="my_wonderful_router", + ) + assert_matches_type(TaskIDList, router, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + router = await async_client.cloud.networks.routers.create( + project_id=0, + region_id=0, + name="my_wonderful_router", + external_gateway_info={ + "enable_snat": True, + "type": "default", + }, + interfaces=[ + { + "subnet_id": "3ed9e2ce-f906-47fb-ba32-c25a3f63df4f", + "type": "subnet", + } + ], + routes=[ + { + "destination": "10.0.3.0/24", + "nexthop": "10.0.0.13", + } + ], + ) + assert_matches_type(TaskIDList, router, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.routers.with_raw_response.create( + project_id=0, + region_id=0, + name="my_wonderful_router", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = await response.parse() + assert_matches_type(TaskIDList, router, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.routers.with_streaming_response.create( + project_id=0, + region_id=0, + name="my_wonderful_router", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = await response.parse() + assert_matches_type(TaskIDList, router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + router = await async_client.cloud.networks.routers.update( + router_id="router_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Router, router, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + router = await async_client.cloud.networks.routers.update( + router_id="router_id", + project_id=0, + region_id=0, + external_gateway_info={ + "network_id": "d7745dcf-b302-4795-9d61-6cc52487af48", + "enable_snat": False, + "type": "manual", + }, + name="my_renamed_router", + routes=[ + { + "destination": "10.0.3.0/24", + "nexthop": "10.0.0.13", + } + ], + ) + assert_matches_type(Router, router, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.routers.with_raw_response.update( + router_id="router_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = await response.parse() + assert_matches_type(Router, router, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.routers.with_streaming_response.update( + router_id="router_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = await response.parse() + assert_matches_type(Router, router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): + await async_client.cloud.networks.routers.with_raw_response.update( + router_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + router = await async_client.cloud.networks.routers.list( + project_id=0, + region_id=0, + ) + assert_matches_type(AsyncOffsetPage[Router], router, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + router = await async_client.cloud.networks.routers.list( + project_id=0, + region_id=0, + limit=0, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[Router], router, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.routers.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = await response.parse() + assert_matches_type(AsyncOffsetPage[Router], router, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.routers.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = await response.parse() + assert_matches_type(AsyncOffsetPage[Router], router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + router = await async_client.cloud.networks.routers.delete( + router_id="router_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, router, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.routers.with_raw_response.delete( + router_id="router_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = await response.parse() + assert_matches_type(TaskIDList, router, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.routers.with_streaming_response.delete( + router_id="router_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = await response.parse() + assert_matches_type(TaskIDList, router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): + await async_client.cloud.networks.routers.with_raw_response.delete( + router_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_attach_subnet(self, async_client: AsyncGcore) -> None: + router = await async_client.cloud.networks.routers.attach_subnet( + router_id="router_id", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) + assert_matches_type(Router, router, path=["response"]) + + @parametrize + async def test_raw_response_attach_subnet(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.routers.with_raw_response.attach_subnet( + router_id="router_id", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = await response.parse() + assert_matches_type(Router, router, path=["response"]) + + @parametrize + async def test_streaming_response_attach_subnet(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.routers.with_streaming_response.attach_subnet( + router_id="router_id", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = await response.parse() + assert_matches_type(Router, router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_subnet(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): + await async_client.cloud.networks.routers.with_raw_response.attach_subnet( + router_id="", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) + + @parametrize + async def test_method_detach_subnet(self, async_client: AsyncGcore) -> None: + router = await async_client.cloud.networks.routers.detach_subnet( + router_id="router_id", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) + assert_matches_type(Router, router, path=["response"]) + + @parametrize + async def test_raw_response_detach_subnet(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.routers.with_raw_response.detach_subnet( + router_id="router_id", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = await response.parse() + assert_matches_type(Router, router, path=["response"]) + + @parametrize + async def test_streaming_response_detach_subnet(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.routers.with_streaming_response.detach_subnet( + router_id="router_id", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = await response.parse() + assert_matches_type(Router, router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_detach_subnet(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): + await async_client.cloud.networks.routers.with_raw_response.detach_subnet( + router_id="", + project_id=0, + region_id=0, + subnet_id="subnet_id", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + router = await async_client.cloud.networks.routers.get( + router_id="router_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Router, router, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.routers.with_raw_response.get( + router_id="router_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + router = await response.parse() + assert_matches_type(Router, router, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.routers.with_streaming_response.get( + router_id="router_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + router = await response.parse() + assert_matches_type(Router, router, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): + await async_client.cloud.networks.routers.with_raw_response.get( + router_id="", + project_id=0, + region_id=0, + ) From 6a12363b38d774bf2c14ee85e614e6284e4637bd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 08:10:31 +0000 Subject: [PATCH 055/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 48715d48..61c1df57 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 61 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-28c3946475abf5194d41060fed9f70c03e0aa956609b80f9904e3e93c4b5d3ac.yml -openapi_spec_hash: da50234dcbbe99b74a2ae4a1b7f2999e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-704d790a88e748be44961419e9f6f8155e183cac66ebd183ac9c0195c9a3d1bf.yml +openapi_spec_hash: 169fae9f2073f3ba088aa92a3eb34306 config_hash: 5ae91376a8a2c6e5b0cddc435a38d49f From 56802be7571ce56378db2ede975a316fcf6941e8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 08:18:32 +0000 Subject: [PATCH 056/592] GCLOUD2-18775 Add cloud security groups resource --- .stats.yml | 4 +- api.md | 26 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + .../cloud/security_groups/__init__.py | 33 + .../resources/cloud/security_groups/rules.py | 710 +++++++++++++ .../cloud/security_groups/security_groups.py | 991 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 6 + src/gcore/types/cloud/security_group.py | 84 ++ .../types/cloud/security_group_copy_params.py | 27 + .../cloud/security_group_create_params.py | 141 +++ .../types/cloud/security_group_list_params.py | 45 + src/gcore/types/cloud/security_group_rule.py | 116 ++ .../cloud/security_group_update_params.py | 121 +++ .../types/cloud/security_groups/__init__.py | 6 + .../security_groups/rule_create_params.py | 95 ++ .../security_groups/rule_replace_params.py | 101 ++ .../cloud/security_groups/__init__.py | 1 + .../cloud/security_groups/test_rules.py | 384 +++++++ .../cloud/test_security_groups.py | 761 ++++++++++++++ 20 files changed, 3696 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/security_groups/__init__.py create mode 100644 src/gcore/resources/cloud/security_groups/rules.py create mode 100644 src/gcore/resources/cloud/security_groups/security_groups.py create mode 100644 src/gcore/types/cloud/security_group.py create mode 100644 src/gcore/types/cloud/security_group_copy_params.py create mode 100644 src/gcore/types/cloud/security_group_create_params.py create mode 100644 src/gcore/types/cloud/security_group_list_params.py create mode 100644 src/gcore/types/cloud/security_group_rule.py create mode 100644 src/gcore/types/cloud/security_group_update_params.py create mode 100644 src/gcore/types/cloud/security_groups/__init__.py create mode 100644 src/gcore/types/cloud/security_groups/rule_create_params.py create mode 100644 src/gcore/types/cloud/security_groups/rule_replace_params.py create mode 100644 tests/api_resources/cloud/security_groups/__init__.py create mode 100644 tests/api_resources/cloud/security_groups/test_rules.py create mode 100644 tests/api_resources/cloud/test_security_groups.py diff --git a/.stats.yml b/.stats.yml index 61c1df57..9a135a8c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 61 +configured_endpoints: 71 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-704d790a88e748be44961419e9f6f8155e183cac66ebd183ac9c0195c9a3d1bf.yml openapi_spec_hash: 169fae9f2073f3ba088aa92a3eb34306 -config_hash: 5ae91376a8a2c6e5b0cddc435a38d49f +config_hash: bc30468b83982ee323b0c073eb662044 diff --git a/api.md b/api.md index 24085f98..638f9a40 100644 --- a/api.md +++ b/api.md @@ -245,3 +245,29 @@ Methods: - client.cloud.floating_ips.assign(floating_ip_id, \*, project_id, region_id, \*\*params) -> FloatingIP - client.cloud.floating_ips.get(floating_ip_id, \*, project_id, region_id) -> FloatingIP - client.cloud.floating_ips.unassign(floating_ip_id, \*, project_id, region_id) -> FloatingIP + +## SecurityGroups + +Types: + +```python +from gcore.types.cloud import SecurityGroup, SecurityGroupRule +``` + +Methods: + +- client.cloud.security_groups.create(\*, project_id, region_id, \*\*params) -> SecurityGroup +- client.cloud.security_groups.update(group_id, \*, project_id, region_id, \*\*params) -> SecurityGroup +- client.cloud.security_groups.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[SecurityGroup] +- client.cloud.security_groups.delete(group_id, \*, project_id, region_id) -> None +- client.cloud.security_groups.copy(group_id, \*, project_id, region_id, \*\*params) -> None +- client.cloud.security_groups.get(group_id, \*, project_id, region_id) -> SecurityGroup +- client.cloud.security_groups.revert_to_default(group_id, \*, project_id, region_id) -> SecurityGroup + +### Rules + +Methods: + +- client.cloud.security_groups.rules.create(group_id, \*, project_id, region_id, \*\*params) -> SecurityGroupRule +- client.cloud.security_groups.rules.delete(rule_id, \*, project_id, region_id) -> None +- client.cloud.security_groups.rules.replace(rule_id, \*, project_id, region_id, \*\*params) -> SecurityGroupRule diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 804d7362..9bee3f78 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -88,6 +88,14 @@ FloatingIPsResourceWithStreamingResponse, AsyncFloatingIPsResourceWithStreamingResponse, ) +from .security_groups import ( + SecurityGroupsResource, + AsyncSecurityGroupsResource, + SecurityGroupsResourceWithRawResponse, + AsyncSecurityGroupsResourceWithRawResponse, + SecurityGroupsResourceWithStreamingResponse, + AsyncSecurityGroupsResourceWithStreamingResponse, +) from .reserved_fixed_ips import ( ReservedFixedIPsResource, AsyncReservedFixedIPsResource, @@ -164,6 +172,12 @@ "AsyncFloatingIPsResourceWithRawResponse", "FloatingIPsResourceWithStreamingResponse", "AsyncFloatingIPsResourceWithStreamingResponse", + "SecurityGroupsResource", + "AsyncSecurityGroupsResource", + "SecurityGroupsResourceWithRawResponse", + "AsyncSecurityGroupsResourceWithRawResponse", + "SecurityGroupsResourceWithStreamingResponse", + "AsyncSecurityGroupsResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 1aee1293..b48a8e2d 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -84,6 +84,14 @@ NetworksResourceWithStreamingResponse, AsyncNetworksResourceWithStreamingResponse, ) +from .security_groups.security_groups import ( + SecurityGroupsResource, + AsyncSecurityGroupsResource, + SecurityGroupsResourceWithRawResponse, + AsyncSecurityGroupsResourceWithRawResponse, + SecurityGroupsResourceWithStreamingResponse, + AsyncSecurityGroupsResourceWithStreamingResponse, +) from .reserved_fixed_ips.reserved_fixed_ips import ( ReservedFixedIPsResource, AsyncReservedFixedIPsResource, @@ -141,6 +149,10 @@ def volumes(self) -> VolumesResource: def floating_ips(self) -> FloatingIPsResource: return FloatingIPsResource(self._client) + @cached_property + def security_groups(self) -> SecurityGroupsResource: + return SecurityGroupsResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -206,6 +218,10 @@ def volumes(self) -> AsyncVolumesResource: def floating_ips(self) -> AsyncFloatingIPsResource: return AsyncFloatingIPsResource(self._client) + @cached_property + def security_groups(self) -> AsyncSecurityGroupsResource: + return AsyncSecurityGroupsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -274,6 +290,10 @@ def volumes(self) -> VolumesResourceWithRawResponse: def floating_ips(self) -> FloatingIPsResourceWithRawResponse: return FloatingIPsResourceWithRawResponse(self._cloud.floating_ips) + @cached_property + def security_groups(self) -> SecurityGroupsResourceWithRawResponse: + return SecurityGroupsResourceWithRawResponse(self._cloud.security_groups) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -323,6 +343,10 @@ def volumes(self) -> AsyncVolumesResourceWithRawResponse: def floating_ips(self) -> AsyncFloatingIPsResourceWithRawResponse: return AsyncFloatingIPsResourceWithRawResponse(self._cloud.floating_ips) + @cached_property + def security_groups(self) -> AsyncSecurityGroupsResourceWithRawResponse: + return AsyncSecurityGroupsResourceWithRawResponse(self._cloud.security_groups) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -372,6 +396,10 @@ def volumes(self) -> VolumesResourceWithStreamingResponse: def floating_ips(self) -> FloatingIPsResourceWithStreamingResponse: return FloatingIPsResourceWithStreamingResponse(self._cloud.floating_ips) + @cached_property + def security_groups(self) -> SecurityGroupsResourceWithStreamingResponse: + return SecurityGroupsResourceWithStreamingResponse(self._cloud.security_groups) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -420,3 +448,7 @@ def volumes(self) -> AsyncVolumesResourceWithStreamingResponse: @cached_property def floating_ips(self) -> AsyncFloatingIPsResourceWithStreamingResponse: return AsyncFloatingIPsResourceWithStreamingResponse(self._cloud.floating_ips) + + @cached_property + def security_groups(self) -> AsyncSecurityGroupsResourceWithStreamingResponse: + return AsyncSecurityGroupsResourceWithStreamingResponse(self._cloud.security_groups) diff --git a/src/gcore/resources/cloud/security_groups/__init__.py b/src/gcore/resources/cloud/security_groups/__init__.py new file mode 100644 index 00000000..8671970e --- /dev/null +++ b/src/gcore/resources/cloud/security_groups/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .rules import ( + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, +) +from .security_groups import ( + SecurityGroupsResource, + AsyncSecurityGroupsResource, + SecurityGroupsResourceWithRawResponse, + AsyncSecurityGroupsResourceWithRawResponse, + SecurityGroupsResourceWithStreamingResponse, + AsyncSecurityGroupsResourceWithStreamingResponse, +) + +__all__ = [ + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "SecurityGroupsResource", + "AsyncSecurityGroupsResource", + "SecurityGroupsResourceWithRawResponse", + "AsyncSecurityGroupsResourceWithRawResponse", + "SecurityGroupsResourceWithStreamingResponse", + "AsyncSecurityGroupsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py new file mode 100644 index 00000000..2487201c --- /dev/null +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -0,0 +1,710 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.security_groups import rule_create_params, rule_replace_params +from ....types.cloud.security_group_rule import SecurityGroupRule + +__all__ = ["RulesResource", "AsyncRulesResource"] + + +class RulesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RulesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return RulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return RulesResourceWithStreamingResponse(self) + + def create( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + description: str | NotGiven = NOT_GIVEN, + direction: Literal["egress", "ingress"] | NotGiven = NOT_GIVEN, + ethertype: Literal["IPv4", "IPv6"] | NotGiven = NOT_GIVEN, + port_range_max: Optional[int] | NotGiven = NOT_GIVEN, + port_range_min: Optional[int] | NotGiven = NOT_GIVEN, + protocol: Literal[ + "ah", + "any", + "dccp", + "egp", + "esp", + "gre", + "icmp", + "igmp", + "ipencap", + "ipip", + "ipv6-encap", + "ipv6-frag", + "ipv6-icmp", + "ipv6-nonxt", + "ipv6-opts", + "ipv6-route", + "ospf", + "pgm", + "rsvp", + "sctp", + "tcp", + "udp", + "udplite", + "vrrp", + ] + | NotGiven = NOT_GIVEN, + remote_group_id: str | NotGiven = NOT_GIVEN, + remote_ip_prefix: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecurityGroupRule: + """ + Add new rule to security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/2/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[2].schema" + + description: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/description' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.description" + + direction: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/direction' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.direction" + + ethertype: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/ethertype' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.ethertype" + + port_range_max: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" + + port_range_min: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" + + protocol: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/protocol' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.protocol" + + remote_group_id: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_group_id' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_group_id" + + remote_ip_prefix: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + return self._post( + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + body=maybe_transform( + { + "description": description, + "direction": direction, + "ethertype": ethertype, + "port_range_max": port_range_max, + "port_range_min": port_range_min, + "protocol": protocol, + "remote_group_id": remote_group_id, + "remote_ip_prefix": remote_ip_prefix, + }, + rule_create_params.RuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecurityGroupRule, + ) + + def delete( + self, + rule_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete security group rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}']['delete'].parameters[1].schema" + + rule_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def replace( + self, + rule_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + direction: Literal["egress", "ingress"], + security_group_id: str, + description: str | NotGiven = NOT_GIVEN, + ethertype: Optional[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + port_range_max: Optional[int] | NotGiven = NOT_GIVEN, + port_range_min: Optional[int] | NotGiven = NOT_GIVEN, + protocol: Literal[ + "ah", + "any", + "dccp", + "egp", + "esp", + "gre", + "icmp", + "igmp", + "ipencap", + "ipip", + "ipv6-encap", + "ipv6-frag", + "ipv6-icmp", + "ipv6-nonxt", + "ipv6-opts", + "ipv6-route", + "ospf", + "pgm", + "rsvp", + "sctp", + "tcp", + "udp", + "udplite", + "vrrp", + ] + | NotGiven = NOT_GIVEN, + remote_group_id: Optional[str] | NotGiven = NOT_GIVEN, + remote_ip_prefix: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecurityGroupRule: + """ + Edit the security group rule: delete old and create new rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/0/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/1/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[1].schema" + + rule_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/2/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[2].schema" + + direction: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/direction' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.direction" + + security_group_id: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/security_group_id' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.security_group_id" + + description: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/description' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.description" + + ethertype: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/ethertype/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.ethertype.anyOf[0]" + + port_range_max: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" + + port_range_min: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" + + protocol: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/protocol' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.protocol" + + remote_group_id: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/remote_group_id/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.remote_group_id.anyOf[0]" + + remote_ip_prefix: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + return self._put( + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + body=maybe_transform( + { + "direction": direction, + "security_group_id": security_group_id, + "description": description, + "ethertype": ethertype, + "port_range_max": port_range_max, + "port_range_min": port_range_min, + "protocol": protocol, + "remote_group_id": remote_group_id, + "remote_ip_prefix": remote_ip_prefix, + }, + rule_replace_params.RuleReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecurityGroupRule, + ) + + +class AsyncRulesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncRulesResourceWithStreamingResponse(self) + + async def create( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + description: str | NotGiven = NOT_GIVEN, + direction: Literal["egress", "ingress"] | NotGiven = NOT_GIVEN, + ethertype: Literal["IPv4", "IPv6"] | NotGiven = NOT_GIVEN, + port_range_max: Optional[int] | NotGiven = NOT_GIVEN, + port_range_min: Optional[int] | NotGiven = NOT_GIVEN, + protocol: Literal[ + "ah", + "any", + "dccp", + "egp", + "esp", + "gre", + "icmp", + "igmp", + "ipencap", + "ipip", + "ipv6-encap", + "ipv6-frag", + "ipv6-icmp", + "ipv6-nonxt", + "ipv6-opts", + "ipv6-route", + "ospf", + "pgm", + "rsvp", + "sctp", + "tcp", + "udp", + "udplite", + "vrrp", + ] + | NotGiven = NOT_GIVEN, + remote_group_id: str | NotGiven = NOT_GIVEN, + remote_ip_prefix: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecurityGroupRule: + """ + Add new rule to security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/2/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[2].schema" + + description: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/description' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.description" + + direction: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/direction' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.direction" + + ethertype: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/ethertype' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.ethertype" + + port_range_max: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" + + port_range_min: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" + + protocol: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/protocol' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.protocol" + + remote_group_id: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_group_id' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_group_id" + + remote_ip_prefix: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + return await self._post( + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + body=await async_maybe_transform( + { + "description": description, + "direction": direction, + "ethertype": ethertype, + "port_range_max": port_range_max, + "port_range_min": port_range_min, + "protocol": protocol, + "remote_group_id": remote_group_id, + "remote_ip_prefix": remote_ip_prefix, + }, + rule_create_params.RuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecurityGroupRule, + ) + + async def delete( + self, + rule_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete security group rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}']['delete'].parameters[1].schema" + + rule_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def replace( + self, + rule_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + direction: Literal["egress", "ingress"], + security_group_id: str, + description: str | NotGiven = NOT_GIVEN, + ethertype: Optional[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + port_range_max: Optional[int] | NotGiven = NOT_GIVEN, + port_range_min: Optional[int] | NotGiven = NOT_GIVEN, + protocol: Literal[ + "ah", + "any", + "dccp", + "egp", + "esp", + "gre", + "icmp", + "igmp", + "ipencap", + "ipip", + "ipv6-encap", + "ipv6-frag", + "ipv6-icmp", + "ipv6-nonxt", + "ipv6-opts", + "ipv6-route", + "ospf", + "pgm", + "rsvp", + "sctp", + "tcp", + "udp", + "udplite", + "vrrp", + ] + | NotGiven = NOT_GIVEN, + remote_group_id: Optional[str] | NotGiven = NOT_GIVEN, + remote_ip_prefix: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecurityGroupRule: + """ + Edit the security group rule: delete old and create new rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/0/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/1/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[1].schema" + + rule_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/2/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[2].schema" + + direction: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/direction' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.direction" + + security_group_id: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/security_group_id' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.security_group_id" + + description: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/description' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.description" + + ethertype: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/ethertype/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.ethertype.anyOf[0]" + + port_range_max: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" + + port_range_min: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" + + protocol: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/protocol' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.protocol" + + remote_group_id: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/remote_group_id/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.remote_group_id.anyOf[0]" + + remote_ip_prefix: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + return await self._put( + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + body=await async_maybe_transform( + { + "direction": direction, + "security_group_id": security_group_id, + "description": description, + "ethertype": ethertype, + "port_range_max": port_range_max, + "port_range_min": port_range_min, + "protocol": protocol, + "remote_group_id": remote_group_id, + "remote_ip_prefix": remote_ip_prefix, + }, + rule_replace_params.RuleReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecurityGroupRule, + ) + + +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: + self._rules = rules + + self.create = to_raw_response_wrapper( + rules.create, + ) + self.delete = to_raw_response_wrapper( + rules.delete, + ) + self.replace = to_raw_response_wrapper( + rules.replace, + ) + + +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: + self._rules = rules + + self.create = async_to_raw_response_wrapper( + rules.create, + ) + self.delete = async_to_raw_response_wrapper( + rules.delete, + ) + self.replace = async_to_raw_response_wrapper( + rules.replace, + ) + + +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: + self._rules = rules + + self.create = to_streamed_response_wrapper( + rules.create, + ) + self.delete = to_streamed_response_wrapper( + rules.delete, + ) + self.replace = to_streamed_response_wrapper( + rules.replace, + ) + + +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: + self._rules = rules + + self.create = async_to_streamed_response_wrapper( + rules.create, + ) + self.delete = async_to_streamed_response_wrapper( + rules.delete, + ) + self.replace = async_to_streamed_response_wrapper( + rules.replace, + ) diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py new file mode 100644 index 00000000..e72fc5da --- /dev/null +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -0,0 +1,991 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable + +import httpx + +from .rules import ( + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.cloud import ( + security_group_copy_params, + security_group_list_params, + security_group_create_params, + security_group_update_params, +) +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.security_group import SecurityGroup + +__all__ = ["SecurityGroupsResource", "AsyncSecurityGroupsResource"] + + +class SecurityGroupsResource(SyncAPIResource): + @cached_property + def rules(self) -> RulesResource: + return RulesResource(self._client) + + @cached_property + def with_raw_response(self) -> SecurityGroupsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return SecurityGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SecurityGroupsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return SecurityGroupsResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + security_group: security_group_create_params.SecurityGroup, + instances: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecurityGroup: + """ + Create security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].post.parameters[1].schema" + + security_group: '#/components/schemas/CreateSecurityGroupSerializer/properties/security_group' + "$.components.schemas.CreateSecurityGroupSerializer.properties.security_group" + + instances: '#/components/schemas/CreateSecurityGroupSerializer/properties/instances' + "$.components.schemas.CreateSecurityGroupSerializer.properties.instances" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._post( + f"/cloud/v1/securitygroups/{project_id}/{region_id}", + body=maybe_transform( + { + "security_group": security_group, + "instances": instances, + }, + security_group_create_params.SecurityGroupCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecurityGroup, + ) + + def update( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + changed_rules: Iterable[security_group_update_params.ChangedRule] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecurityGroup: + """ + Change security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[2].schema" + + changed_rules: '#/components/schemas/UpdateSecurityGroupSerializer/properties/changed_rules' + "$.components.schemas.UpdateSecurityGroupSerializer.properties.changed_rules" + + name: '#/components/schemas/UpdateSecurityGroupSerializer/properties/name' + "$.components.schemas.UpdateSecurityGroupSerializer.properties.name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + return self._patch( + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + body=maybe_transform( + { + "changed_rules": changed_rules, + "name": name, + }, + security_group_update_params.SecurityGroupUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecurityGroup, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + metadata_k: str | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[SecurityGroup]: + """ + Get security groups + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[2]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[3]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[4]" + + offset: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[5]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/securitygroups/{project_id}/{region_id}", + page=SyncOffsetPage[SecurityGroup], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "offset": offset, + }, + security_group_list_params.SecurityGroupListParams, + ), + ), + model=SecurityGroup, + ) + + def delete( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def copy( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Create a deep copy of security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/2/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[2].schema" + + name: '#/components/schemas/NameSerializerPydantic/properties/name' + "$.components.schemas.NameSerializerPydantic.properties.name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + body=maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecurityGroup: + """ + Get security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].get.parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + return self._get( + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecurityGroup, + ) + + def revert_to_default( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecurityGroup: + """ + Revert security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frevert/post/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frevert/post/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert'].post.parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frevert/post/parameters/2/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + return self._post( + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecurityGroup, + ) + + +class AsyncSecurityGroupsResource(AsyncAPIResource): + @cached_property + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncSecurityGroupsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncSecurityGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSecurityGroupsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncSecurityGroupsResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + security_group: security_group_create_params.SecurityGroup, + instances: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecurityGroup: + """ + Create security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].post.parameters[1].schema" + + security_group: '#/components/schemas/CreateSecurityGroupSerializer/properties/security_group' + "$.components.schemas.CreateSecurityGroupSerializer.properties.security_group" + + instances: '#/components/schemas/CreateSecurityGroupSerializer/properties/instances' + "$.components.schemas.CreateSecurityGroupSerializer.properties.instances" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._post( + f"/cloud/v1/securitygroups/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "security_group": security_group, + "instances": instances, + }, + security_group_create_params.SecurityGroupCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecurityGroup, + ) + + async def update( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + changed_rules: Iterable[security_group_update_params.ChangedRule] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecurityGroup: + """ + Change security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[2].schema" + + changed_rules: '#/components/schemas/UpdateSecurityGroupSerializer/properties/changed_rules' + "$.components.schemas.UpdateSecurityGroupSerializer.properties.changed_rules" + + name: '#/components/schemas/UpdateSecurityGroupSerializer/properties/name' + "$.components.schemas.UpdateSecurityGroupSerializer.properties.name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + return await self._patch( + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + body=await async_maybe_transform( + { + "changed_rules": changed_rules, + "name": name, + }, + security_group_update_params.SecurityGroupUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecurityGroup, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + metadata_k: str | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[SecurityGroup, AsyncOffsetPage[SecurityGroup]]: + """ + Get security groups + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[2]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[3]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[4]" + + offset: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[5]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/securitygroups/{project_id}/{region_id}", + page=AsyncOffsetPage[SecurityGroup], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "offset": offset, + }, + security_group_list_params.SecurityGroupListParams, + ), + ), + model=SecurityGroup, + ) + + async def delete( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def copy( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Create a deep copy of security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/2/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[2].schema" + + name: '#/components/schemas/NameSerializerPydantic/properties/name' + "$.components.schemas.NameSerializerPydantic.properties.name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + body=await async_maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecurityGroup: + """ + Get security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].get.parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + return await self._get( + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecurityGroup, + ) + + async def revert_to_default( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecurityGroup: + """ + Revert security group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frevert/post/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frevert/post/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert'].post.parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frevert/post/parameters/2/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + return await self._post( + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecurityGroup, + ) + + +class SecurityGroupsResourceWithRawResponse: + def __init__(self, security_groups: SecurityGroupsResource) -> None: + self._security_groups = security_groups + + self.create = to_raw_response_wrapper( + security_groups.create, + ) + self.update = to_raw_response_wrapper( + security_groups.update, + ) + self.list = to_raw_response_wrapper( + security_groups.list, + ) + self.delete = to_raw_response_wrapper( + security_groups.delete, + ) + self.copy = to_raw_response_wrapper( + security_groups.copy, + ) + self.get = to_raw_response_wrapper( + security_groups.get, + ) + self.revert_to_default = to_raw_response_wrapper( + security_groups.revert_to_default, + ) + + @cached_property + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._security_groups.rules) + + +class AsyncSecurityGroupsResourceWithRawResponse: + def __init__(self, security_groups: AsyncSecurityGroupsResource) -> None: + self._security_groups = security_groups + + self.create = async_to_raw_response_wrapper( + security_groups.create, + ) + self.update = async_to_raw_response_wrapper( + security_groups.update, + ) + self.list = async_to_raw_response_wrapper( + security_groups.list, + ) + self.delete = async_to_raw_response_wrapper( + security_groups.delete, + ) + self.copy = async_to_raw_response_wrapper( + security_groups.copy, + ) + self.get = async_to_raw_response_wrapper( + security_groups.get, + ) + self.revert_to_default = async_to_raw_response_wrapper( + security_groups.revert_to_default, + ) + + @cached_property + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._security_groups.rules) + + +class SecurityGroupsResourceWithStreamingResponse: + def __init__(self, security_groups: SecurityGroupsResource) -> None: + self._security_groups = security_groups + + self.create = to_streamed_response_wrapper( + security_groups.create, + ) + self.update = to_streamed_response_wrapper( + security_groups.update, + ) + self.list = to_streamed_response_wrapper( + security_groups.list, + ) + self.delete = to_streamed_response_wrapper( + security_groups.delete, + ) + self.copy = to_streamed_response_wrapper( + security_groups.copy, + ) + self.get = to_streamed_response_wrapper( + security_groups.get, + ) + self.revert_to_default = to_streamed_response_wrapper( + security_groups.revert_to_default, + ) + + @cached_property + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._security_groups.rules) + + +class AsyncSecurityGroupsResourceWithStreamingResponse: + def __init__(self, security_groups: AsyncSecurityGroupsResource) -> None: + self._security_groups = security_groups + + self.create = async_to_streamed_response_wrapper( + security_groups.create, + ) + self.update = async_to_streamed_response_wrapper( + security_groups.update, + ) + self.list = async_to_streamed_response_wrapper( + security_groups.list, + ) + self.delete = async_to_streamed_response_wrapper( + security_groups.delete, + ) + self.copy = async_to_streamed_response_wrapper( + security_groups.copy, + ) + self.get = async_to_streamed_response_wrapper( + security_groups.get, + ) + self.revert_to_default = async_to_streamed_response_wrapper( + security_groups.revert_to_default, + ) + + @cached_property + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._security_groups.rules) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 8885a467..f46826f5 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -18,6 +18,7 @@ from .task_id_list import TaskIDList as TaskIDList from .load_balancer import LoadBalancer as LoadBalancer from .neutron_route import NeutronRoute as NeutronRoute +from .security_group import SecurityGroup as SecurityGroup from .ssh_key_created import SSHKeyCreated as SSHKeyCreated from .task_list_params import TaskListParams as TaskListParams from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP @@ -30,6 +31,7 @@ from .neutron_route_param import NeutronRouteParam as NeutronRouteParam from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus +from .security_group_rule import SecurityGroupRule as SecurityGroupRule from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed from .secret_create_params import SecretCreateParams as SecretCreateParams @@ -54,10 +56,14 @@ from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit +from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams +from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse +from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams +from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams diff --git a/src/gcore/types/cloud/security_group.py b/src/gcore/types/cloud/security_group.py new file mode 100644 index 00000000..0e7b9649 --- /dev/null +++ b/src/gcore/types/cloud/security_group.py @@ -0,0 +1,84 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .tag import Tag +from ..._models import BaseModel +from .security_group_rule import SecurityGroupRule + +__all__ = ["SecurityGroup"] + + +class SecurityGroup(BaseModel): + id: str + """ + '#/components/schemas/SecurityGroupSerializer/properties/id' + "$.components.schemas.SecurityGroupSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/SecurityGroupSerializer/properties/created_at' + "$.components.schemas.SecurityGroupSerializer.properties.created_at" + """ + + name: str + """ + '#/components/schemas/SecurityGroupSerializer/properties/name' + "$.components.schemas.SecurityGroupSerializer.properties.name" + """ + + project_id: int + """ + '#/components/schemas/SecurityGroupSerializer/properties/project_id' + "$.components.schemas.SecurityGroupSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/SecurityGroupSerializer/properties/region' + "$.components.schemas.SecurityGroupSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/SecurityGroupSerializer/properties/region_id' + "$.components.schemas.SecurityGroupSerializer.properties.region_id" + """ + + revision_number: int + """ + '#/components/schemas/SecurityGroupSerializer/properties/revision_number' + "$.components.schemas.SecurityGroupSerializer.properties.revision_number" + """ + + updated_at: datetime + """ + '#/components/schemas/SecurityGroupSerializer/properties/updated_at' + "$.components.schemas.SecurityGroupSerializer.properties.updated_at" + """ + + description: Optional[str] = None + """ + '#/components/schemas/SecurityGroupSerializer/properties/description/anyOf/0' + "$.components.schemas.SecurityGroupSerializer.properties.description.anyOf[0]" + """ + + metadata: Optional[List[Tag]] = None + """ + '#/components/schemas/SecurityGroupSerializer/properties/metadata' + "$.components.schemas.SecurityGroupSerializer.properties.metadata" + """ + + security_group_rules: Optional[List[SecurityGroupRule]] = None + """ + '#/components/schemas/SecurityGroupSerializer/properties/security_group_rules' + "$.components.schemas.SecurityGroupSerializer.properties.security_group_rules" + """ + + tags: Optional[List[str]] = None + """ + '#/components/schemas/SecurityGroupSerializer/properties/tags/anyOf/0' + "$.components.schemas.SecurityGroupSerializer.properties.tags.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/security_group_copy_params.py b/src/gcore/types/cloud/security_group_copy_params.py new file mode 100644 index 00000000..c7c0498d --- /dev/null +++ b/src/gcore/types/cloud/security_group_copy_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["SecurityGroupCopyParams"] + + +class SecurityGroupCopyParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/NameSerializerPydantic/properties/name' + "$.components.schemas.NameSerializerPydantic.properties.name" + """ diff --git a/src/gcore/types/cloud/security_group_create_params.py b/src/gcore/types/cloud/security_group_create_params.py new file mode 100644 index 00000000..51db74d2 --- /dev/null +++ b/src/gcore/types/cloud/security_group_create_params.py @@ -0,0 +1,141 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["SecurityGroupCreateParams", "SecurityGroup", "SecurityGroupSecurityGroupRule"] + + +class SecurityGroupCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + security_group: Required[SecurityGroup] + """ + '#/components/schemas/CreateSecurityGroupSerializer/properties/security_group' + "$.components.schemas.CreateSecurityGroupSerializer.properties.security_group" + """ + + instances: List[str] + """ + '#/components/schemas/CreateSecurityGroupSerializer/properties/instances' + "$.components.schemas.CreateSecurityGroupSerializer.properties.instances" + """ + + +class SecurityGroupSecurityGroupRule(TypedDict, total=False): + description: str + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/description' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.description" + """ + + direction: Literal["egress", "ingress"] + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/direction' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.direction" + """ + + ethertype: Literal["IPv4", "IPv6"] + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/ethertype' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.ethertype" + """ + + port_range_max: Optional[int] + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" + """ + + port_range_min: Optional[int] + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" + """ + + protocol: Literal[ + "ah", + "any", + "dccp", + "egp", + "esp", + "gre", + "icmp", + "igmp", + "ipencap", + "ipip", + "ipv6-encap", + "ipv6-frag", + "ipv6-icmp", + "ipv6-nonxt", + "ipv6-opts", + "ipv6-route", + "ospf", + "pgm", + "rsvp", + "sctp", + "tcp", + "udp", + "udplite", + "vrrp", + ] + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/protocol' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.protocol" + """ + + remote_group_id: str + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_group_id' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_group_id" + """ + + remote_ip_prefix: Optional[str] + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + """ + + +class SecurityGroup(TypedDict, total=False): + name: Required[str] + """ + '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/name' + "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.name" + """ + + description: Optional[str] + """ + '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/description/anyOf/0' + "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.description.anyOf[0]" + """ + + metadata: Dict[str, object] + """ + '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/metadata' + "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.metadata" + """ + + security_group_rules: Iterable[SecurityGroupSecurityGroupRule] + """ + '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/security_group_rules' + "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.security_group_rules" + """ + + tags: Optional[List[str]] + """ + '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/tags/anyOf/0' + "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.tags.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/security_group_list_params.py b/src/gcore/types/cloud/security_group_list_params.py new file mode 100644 index 00000000..db435eeb --- /dev/null +++ b/src/gcore/types/cloud/security_group_list_params.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["SecurityGroupListParams"] + + +class SecurityGroupListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[2]" + """ + + metadata_k: str + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[3]" + """ + + metadata_kv: str + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[4]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[5]" + """ diff --git a/src/gcore/types/cloud/security_group_rule.py b/src/gcore/types/cloud/security_group_rule.py new file mode 100644 index 00000000..1bccd8fa --- /dev/null +++ b/src/gcore/types/cloud/security_group_rule.py @@ -0,0 +1,116 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["SecurityGroupRule"] + + +class SecurityGroupRule(BaseModel): + id: str + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/id' + "$.components.schemas.SecurityGroupRuleSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/created_at' + "$.components.schemas.SecurityGroupRuleSerializer.properties.created_at" + """ + + direction: Literal["egress", "ingress"] + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/direction' + "$.components.schemas.SecurityGroupRuleSerializer.properties.direction" + """ + + revision_number: int + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/revision_number' + "$.components.schemas.SecurityGroupRuleSerializer.properties.revision_number" + """ + + security_group_id: str + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/security_group_id' + "$.components.schemas.SecurityGroupRuleSerializer.properties.security_group_id" + """ + + updated_at: datetime + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/updated_at' + "$.components.schemas.SecurityGroupRuleSerializer.properties.updated_at" + """ + + description: Optional[str] = None + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/description/anyOf/0' + "$.components.schemas.SecurityGroupRuleSerializer.properties.description.anyOf[0]" + """ + + ethertype: Optional[Literal["IPv4", "IPv6"]] = None + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/ethertype/anyOf/0' + "$.components.schemas.SecurityGroupRuleSerializer.properties.ethertype.anyOf[0]" + """ + + port_range_max: Optional[int] = None + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' + "$.components.schemas.SecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" + """ + + port_range_min: Optional[int] = None + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' + "$.components.schemas.SecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" + """ + + protocol: Optional[ + Literal[ + "ah", + "any", + "dccp", + "egp", + "esp", + "gre", + "icmp", + "igmp", + "ipencap", + "ipip", + "ipv6-encap", + "ipv6-frag", + "ipv6-icmp", + "ipv6-nonxt", + "ipv6-opts", + "ipv6-route", + "ospf", + "pgm", + "rsvp", + "sctp", + "tcp", + "udp", + "udplite", + "vrrp", + ] + ] = None + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/protocol/anyOf/0' + "$.components.schemas.SecurityGroupRuleSerializer.properties.protocol.anyOf[0]" + """ + + remote_group_id: Optional[str] = None + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/remote_group_id/anyOf/0' + "$.components.schemas.SecurityGroupRuleSerializer.properties.remote_group_id.anyOf[0]" + """ + + remote_ip_prefix: Optional[str] = None + """ + '#/components/schemas/SecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' + "$.components.schemas.SecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/security_group_update_params.py b/src/gcore/types/cloud/security_group_update_params.py new file mode 100644 index 00000000..e2fb8607 --- /dev/null +++ b/src/gcore/types/cloud/security_group_update_params.py @@ -0,0 +1,121 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["SecurityGroupUpdateParams", "ChangedRule"] + + +class SecurityGroupUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[1].schema" + """ + + changed_rules: Iterable[ChangedRule] + """ + '#/components/schemas/UpdateSecurityGroupSerializer/properties/changed_rules' + "$.components.schemas.UpdateSecurityGroupSerializer.properties.changed_rules" + """ + + name: str + """ + '#/components/schemas/UpdateSecurityGroupSerializer/properties/name' + "$.components.schemas.UpdateSecurityGroupSerializer.properties.name" + """ + + +class ChangedRule(TypedDict, total=False): + action: Required[Literal["create", "delete"]] + """ + '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/action' + "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.action" + """ + + description: str + """ + '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/description' + "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.description" + """ + + direction: Literal["egress", "ingress"] + """ + '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/direction' + "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.direction" + """ + + ethertype: Optional[Literal["IPv4", "IPv6"]] + """ + '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/ethertype/anyOf/0' + "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.ethertype.anyOf[0]" + """ + + port_range_max: int + """ + '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/port_range_max' + "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.port_range_max" + """ + + port_range_min: int + """ + '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/port_range_min' + "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.port_range_min" + """ + + protocol: Literal[ + "ah", + "any", + "dccp", + "egp", + "esp", + "gre", + "icmp", + "igmp", + "ipencap", + "ipip", + "ipv6-encap", + "ipv6-frag", + "ipv6-icmp", + "ipv6-nonxt", + "ipv6-opts", + "ipv6-route", + "ospf", + "pgm", + "rsvp", + "sctp", + "tcp", + "udp", + "udplite", + "vrrp", + ] + """ + '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/protocol' + "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.protocol" + """ + + remote_group_id: Optional[str] + """ + '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/remote_group_id/anyOf/0' + "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.remote_group_id.anyOf[0]" + """ + + remote_ip_prefix: Optional[str] + """ + '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' + "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + """ + + security_group_rule_id: Optional[str] + """ + '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/security_group_rule_id/anyOf/0' + "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.security_group_rule_id.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/security_groups/__init__.py b/src/gcore/types/cloud/security_groups/__init__.py new file mode 100644 index 00000000..832f1d77 --- /dev/null +++ b/src/gcore/types/cloud/security_groups/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .rule_create_params import RuleCreateParams as RuleCreateParams +from .rule_replace_params import RuleReplaceParams as RuleReplaceParams diff --git a/src/gcore/types/cloud/security_groups/rule_create_params.py b/src/gcore/types/cloud/security_groups/rule_create_params.py new file mode 100644 index 00000000..8a1b7e2d --- /dev/null +++ b/src/gcore/types/cloud/security_groups/rule_create_params.py @@ -0,0 +1,95 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["RuleCreateParams"] + + +class RuleCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/0/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/1/schema' + "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[1].schema" + """ + + description: str + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/description' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.description" + """ + + direction: Literal["egress", "ingress"] + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/direction' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.direction" + """ + + ethertype: Literal["IPv4", "IPv6"] + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/ethertype' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.ethertype" + """ + + port_range_max: Optional[int] + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" + """ + + port_range_min: Optional[int] + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" + """ + + protocol: Literal[ + "ah", + "any", + "dccp", + "egp", + "esp", + "gre", + "icmp", + "igmp", + "ipencap", + "ipip", + "ipv6-encap", + "ipv6-frag", + "ipv6-icmp", + "ipv6-nonxt", + "ipv6-opts", + "ipv6-route", + "ospf", + "pgm", + "rsvp", + "sctp", + "tcp", + "udp", + "udplite", + "vrrp", + ] + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/protocol' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.protocol" + """ + + remote_group_id: str + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_group_id' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_group_id" + """ + + remote_ip_prefix: Optional[str] + """ + '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' + "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/security_groups/rule_replace_params.py b/src/gcore/types/cloud/security_groups/rule_replace_params.py new file mode 100644 index 00000000..5eba9925 --- /dev/null +++ b/src/gcore/types/cloud/security_groups/rule_replace_params.py @@ -0,0 +1,101 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["RuleReplaceParams"] + + +class RuleReplaceParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/0/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/1/schema' + "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[1].schema" + """ + + direction: Required[Literal["egress", "ingress"]] + """ + '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/direction' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.direction" + """ + + security_group_id: Required[str] + """ + '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/security_group_id' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.security_group_id" + """ + + description: str + """ + '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/description' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.description" + """ + + ethertype: Optional[Literal["IPv4", "IPv6"]] + """ + '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/ethertype/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.ethertype.anyOf[0]" + """ + + port_range_max: Optional[int] + """ + '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" + """ + + port_range_min: Optional[int] + """ + '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" + """ + + protocol: Literal[ + "ah", + "any", + "dccp", + "egp", + "esp", + "gre", + "icmp", + "igmp", + "ipencap", + "ipip", + "ipv6-encap", + "ipv6-frag", + "ipv6-icmp", + "ipv6-nonxt", + "ipv6-opts", + "ipv6-route", + "ospf", + "pgm", + "rsvp", + "sctp", + "tcp", + "udp", + "udplite", + "vrrp", + ] + """ + '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/protocol' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.protocol" + """ + + remote_group_id: Optional[str] + """ + '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/remote_group_id/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.remote_group_id.anyOf[0]" + """ + + remote_ip_prefix: Optional[str] + """ + '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' + "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + """ diff --git a/tests/api_resources/cloud/security_groups/__init__.py b/tests/api_resources/cloud/security_groups/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/security_groups/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/security_groups/test_rules.py b/tests/api_resources/cloud/security_groups/test_rules.py new file mode 100644 index 00000000..b6ac50fb --- /dev/null +++ b/tests/api_resources/cloud/security_groups/test_rules.py @@ -0,0 +1,384 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import SecurityGroupRule + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRules: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + rule = client.cloud.security_groups.rules.create( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + rule = client.cloud.security_groups.rules.create( + group_id="group_id", + project_id=0, + region_id=0, + description="Some description", + direction="ingress", + ethertype="IPv4", + port_range_max=80, + port_range_min=80, + protocol="tcp", + remote_group_id="00000000-0000-4000-8000-000000000000", + remote_ip_prefix="10.0.0.0/8", + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.security_groups.rules.with_raw_response.create( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.security_groups.rules.with_streaming_response.create( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + client.cloud.security_groups.rules.with_raw_response.create( + group_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + rule = client.cloud.security_groups.rules.delete( + rule_id="rule_id", + project_id=0, + region_id=0, + ) + assert rule is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.security_groups.rules.with_raw_response.delete( + rule_id="rule_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert rule is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.security_groups.rules.with_streaming_response.delete( + rule_id="rule_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.cloud.security_groups.rules.with_raw_response.delete( + rule_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + rule = client.cloud.security_groups.rules.replace( + rule_id="rule_id", + project_id=0, + region_id=0, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + rule = client.cloud.security_groups.rules.replace( + rule_id="rule_id", + project_id=0, + region_id=0, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + description="Some description", + ethertype="IPv4", + port_range_max=80, + port_range_min=80, + protocol="tcp", + remote_group_id="00000000-0000-4000-8000-000000000000", + remote_ip_prefix="10.0.0.0/8", + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cloud.security_groups.rules.with_raw_response.replace( + rule_id="rule_id", + project_id=0, + region_id=0, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cloud.security_groups.rules.with_streaming_response.replace( + rule_id="rule_id", + project_id=0, + region_id=0, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_replace(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.cloud.security_groups.rules.with_raw_response.replace( + rule_id="", + project_id=0, + region_id=0, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) + + +class TestAsyncRules: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + rule = await async_client.cloud.security_groups.rules.create( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + rule = await async_client.cloud.security_groups.rules.create( + group_id="group_id", + project_id=0, + region_id=0, + description="Some description", + direction="ingress", + ethertype="IPv4", + port_range_max=80, + port_range_min=80, + protocol="tcp", + remote_group_id="00000000-0000-4000-8000-000000000000", + remote_ip_prefix="10.0.0.0/8", + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.security_groups.rules.with_raw_response.create( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.security_groups.rules.with_streaming_response.create( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + await async_client.cloud.security_groups.rules.with_raw_response.create( + group_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + rule = await async_client.cloud.security_groups.rules.delete( + rule_id="rule_id", + project_id=0, + region_id=0, + ) + assert rule is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.security_groups.rules.with_raw_response.delete( + rule_id="rule_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert rule is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.security_groups.rules.with_streaming_response.delete( + rule_id="rule_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.cloud.security_groups.rules.with_raw_response.delete( + rule_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + rule = await async_client.cloud.security_groups.rules.replace( + rule_id="rule_id", + project_id=0, + region_id=0, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + rule = await async_client.cloud.security_groups.rules.replace( + rule_id="rule_id", + project_id=0, + region_id=0, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + description="Some description", + ethertype="IPv4", + port_range_max=80, + port_range_min=80, + protocol="tcp", + remote_group_id="00000000-0000-4000-8000-000000000000", + remote_ip_prefix="10.0.0.0/8", + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.security_groups.rules.with_raw_response.replace( + rule_id="rule_id", + project_id=0, + region_id=0, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.security_groups.rules.with_streaming_response.replace( + rule_id="rule_id", + project_id=0, + region_id=0, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(SecurityGroupRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_replace(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.cloud.security_groups.rules.with_raw_response.replace( + rule_id="", + project_id=0, + region_id=0, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py new file mode 100644 index 00000000..5082ea2f --- /dev/null +++ b/tests/api_resources/cloud/test_security_groups.py @@ -0,0 +1,761 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import ( + SecurityGroup, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSecurityGroups: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + security_group = client.cloud.security_groups.create( + project_id=0, + region_id=0, + security_group={"name": "my_security_group"}, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + security_group = client.cloud.security_groups.create( + project_id=0, + region_id=0, + security_group={ + "name": "my_security_group", + "description": "Some description", + "metadata": {"my-tag": "bar"}, + "security_group_rules": [ + { + "description": "Some description", + "direction": "ingress", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + } + ], + "tags": ["string"], + }, + instances=["00000000-0000-4000-8000-000000000000"], + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.security_groups.with_raw_response.create( + project_id=0, + region_id=0, + security_group={"name": "my_security_group"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.security_groups.with_streaming_response.create( + project_id=0, + region_id=0, + security_group={"name": "my_security_group"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + security_group = client.cloud.security_groups.update( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + security_group = client.cloud.security_groups.update( + group_id="group_id", + project_id=0, + region_id=0, + changed_rules=[ + { + "action": "delete", + "description": "Some description", + "direction": "egress", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + "security_group_rule_id": "00000000-0000-4000-8000-000000000000", + } + ], + name="some_name", + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.security_groups.with_raw_response.update( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.security_groups.with_streaming_response.update( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + client.cloud.security_groups.with_raw_response.update( + group_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + security_group = client.cloud.security_groups.list( + project_id=0, + region_id=0, + ) + assert_matches_type(SyncOffsetPage[SecurityGroup], security_group, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + security_group = client.cloud.security_groups.list( + project_id=0, + region_id=0, + limit=0, + metadata_k="metadata_k", + metadata_kv="metadata_kv", + offset=0, + ) + assert_matches_type(SyncOffsetPage[SecurityGroup], security_group, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.security_groups.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = response.parse() + assert_matches_type(SyncOffsetPage[SecurityGroup], security_group, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.security_groups.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = response.parse() + assert_matches_type(SyncOffsetPage[SecurityGroup], security_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + security_group = client.cloud.security_groups.delete( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert security_group is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.security_groups.with_raw_response.delete( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = response.parse() + assert security_group is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.security_groups.with_streaming_response.delete( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = response.parse() + assert security_group is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + client.cloud.security_groups.with_raw_response.delete( + group_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_copy(self, client: Gcore) -> None: + security_group = client.cloud.security_groups.copy( + group_id="group_id", + project_id=0, + region_id=0, + name="some_name", + ) + assert security_group is None + + @parametrize + def test_raw_response_copy(self, client: Gcore) -> None: + response = client.cloud.security_groups.with_raw_response.copy( + group_id="group_id", + project_id=0, + region_id=0, + name="some_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = response.parse() + assert security_group is None + + @parametrize + def test_streaming_response_copy(self, client: Gcore) -> None: + with client.cloud.security_groups.with_streaming_response.copy( + group_id="group_id", + project_id=0, + region_id=0, + name="some_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = response.parse() + assert security_group is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_copy(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + client.cloud.security_groups.with_raw_response.copy( + group_id="", + project_id=0, + region_id=0, + name="some_name", + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + security_group = client.cloud.security_groups.get( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.security_groups.with_raw_response.get( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.security_groups.with_streaming_response.get( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + client.cloud.security_groups.with_raw_response.get( + group_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_revert_to_default(self, client: Gcore) -> None: + security_group = client.cloud.security_groups.revert_to_default( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + def test_raw_response_revert_to_default(self, client: Gcore) -> None: + response = client.cloud.security_groups.with_raw_response.revert_to_default( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + def test_streaming_response_revert_to_default(self, client: Gcore) -> None: + with client.cloud.security_groups.with_streaming_response.revert_to_default( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_revert_to_default(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + client.cloud.security_groups.with_raw_response.revert_to_default( + group_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncSecurityGroups: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + security_group = await async_client.cloud.security_groups.create( + project_id=0, + region_id=0, + security_group={"name": "my_security_group"}, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + security_group = await async_client.cloud.security_groups.create( + project_id=0, + region_id=0, + security_group={ + "name": "my_security_group", + "description": "Some description", + "metadata": {"my-tag": "bar"}, + "security_group_rules": [ + { + "description": "Some description", + "direction": "ingress", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + } + ], + "tags": ["string"], + }, + instances=["00000000-0000-4000-8000-000000000000"], + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.security_groups.with_raw_response.create( + project_id=0, + region_id=0, + security_group={"name": "my_security_group"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = await response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.security_groups.with_streaming_response.create( + project_id=0, + region_id=0, + security_group={"name": "my_security_group"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = await response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + security_group = await async_client.cloud.security_groups.update( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + security_group = await async_client.cloud.security_groups.update( + group_id="group_id", + project_id=0, + region_id=0, + changed_rules=[ + { + "action": "delete", + "description": "Some description", + "direction": "egress", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + "security_group_rule_id": "00000000-0000-4000-8000-000000000000", + } + ], + name="some_name", + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.security_groups.with_raw_response.update( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = await response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.security_groups.with_streaming_response.update( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = await response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + await async_client.cloud.security_groups.with_raw_response.update( + group_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + security_group = await async_client.cloud.security_groups.list( + project_id=0, + region_id=0, + ) + assert_matches_type(AsyncOffsetPage[SecurityGroup], security_group, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + security_group = await async_client.cloud.security_groups.list( + project_id=0, + region_id=0, + limit=0, + metadata_k="metadata_k", + metadata_kv="metadata_kv", + offset=0, + ) + assert_matches_type(AsyncOffsetPage[SecurityGroup], security_group, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.security_groups.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = await response.parse() + assert_matches_type(AsyncOffsetPage[SecurityGroup], security_group, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.security_groups.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = await response.parse() + assert_matches_type(AsyncOffsetPage[SecurityGroup], security_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + security_group = await async_client.cloud.security_groups.delete( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert security_group is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.security_groups.with_raw_response.delete( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = await response.parse() + assert security_group is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.security_groups.with_streaming_response.delete( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = await response.parse() + assert security_group is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + await async_client.cloud.security_groups.with_raw_response.delete( + group_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_copy(self, async_client: AsyncGcore) -> None: + security_group = await async_client.cloud.security_groups.copy( + group_id="group_id", + project_id=0, + region_id=0, + name="some_name", + ) + assert security_group is None + + @parametrize + async def test_raw_response_copy(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.security_groups.with_raw_response.copy( + group_id="group_id", + project_id=0, + region_id=0, + name="some_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = await response.parse() + assert security_group is None + + @parametrize + async def test_streaming_response_copy(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.security_groups.with_streaming_response.copy( + group_id="group_id", + project_id=0, + region_id=0, + name="some_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = await response.parse() + assert security_group is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_copy(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + await async_client.cloud.security_groups.with_raw_response.copy( + group_id="", + project_id=0, + region_id=0, + name="some_name", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + security_group = await async_client.cloud.security_groups.get( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.security_groups.with_raw_response.get( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = await response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.security_groups.with_streaming_response.get( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = await response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + await async_client.cloud.security_groups.with_raw_response.get( + group_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_revert_to_default(self, async_client: AsyncGcore) -> None: + security_group = await async_client.cloud.security_groups.revert_to_default( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + async def test_raw_response_revert_to_default(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.security_groups.with_raw_response.revert_to_default( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + security_group = await response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + @parametrize + async def test_streaming_response_revert_to_default(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.security_groups.with_streaming_response.revert_to_default( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + security_group = await response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_revert_to_default(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + await async_client.cloud.security_groups.with_raw_response.revert_to_default( + group_id="", + project_id=0, + region_id=0, + ) From be89f0f3ce2eeb17c48c2eeaf2482704f41910de Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 14:17:53 +0000 Subject: [PATCH 057/592] GCLOUD2-18670 Add cloud networks --- .stats.yml | 4 +- api.md | 18 + .../resources/cloud/networks/__init__.py | 14 + .../resources/cloud/networks/networks.py | 698 ++++++++++++++ src/gcore/resources/cloud/networks/subnets.py | 899 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 3 + .../types/cloud/network_create_params.py | 46 + src/gcore/types/cloud/network_list_params.py | 51 + .../types/cloud/network_update_params.py | 27 + src/gcore/types/cloud/networks/__init__.py | 3 + .../cloud/networks/subnet_create_params.py | 91 ++ .../cloud/networks/subnet_list_params.py | 71 ++ .../cloud/networks/subnet_update_params.py | 54 ++ .../cloud/networks/test_subnets.py | 567 +++++++++++ tests/api_resources/cloud/test_networks.py | 499 ++++++++++ 15 files changed, 3043 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/networks/subnets.py create mode 100644 src/gcore/types/cloud/network_create_params.py create mode 100644 src/gcore/types/cloud/network_list_params.py create mode 100644 src/gcore/types/cloud/network_update_params.py create mode 100644 src/gcore/types/cloud/networks/subnet_create_params.py create mode 100644 src/gcore/types/cloud/networks/subnet_list_params.py create mode 100644 src/gcore/types/cloud/networks/subnet_update_params.py create mode 100644 tests/api_resources/cloud/networks/test_subnets.py create mode 100644 tests/api_resources/cloud/test_networks.py diff --git a/.stats.yml b/.stats.yml index 9a135a8c..dfd22ebe 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 71 +configured_endpoints: 81 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-704d790a88e748be44961419e9f6f8155e183cac66ebd183ac9c0195c9a3d1bf.yml openapi_spec_hash: 169fae9f2073f3ba088aa92a3eb34306 -config_hash: bc30468b83982ee323b0c073eb662044 +config_hash: f44dbe148d290ab905d2fd482070b50d diff --git a/api.md b/api.md index 638f9a40..23fcc7bb 100644 --- a/api.md +++ b/api.md @@ -190,6 +190,24 @@ Methods: ## Networks +Methods: + +- client.cloud.networks.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.networks.update(network_id, \*, project_id, region_id, \*\*params) -> Network +- client.cloud.networks.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Network] +- client.cloud.networks.delete(network_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.networks.get(network_id, \*, project_id, region_id) -> Network + +### Subnets + +Methods: + +- client.cloud.networks.subnets.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.networks.subnets.update(subnet_id, \*, project_id, region_id, \*\*params) -> Subnet +- client.cloud.networks.subnets.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Subnet] +- client.cloud.networks.subnets.delete(subnet_id, \*, project_id, region_id) -> None +- client.cloud.networks.subnets.get(subnet_id, \*, project_id, region_id) -> Subnet + ### Routers Types: diff --git a/src/gcore/resources/cloud/networks/__init__.py b/src/gcore/resources/cloud/networks/__init__.py index 5631e7e9..de3483b6 100644 --- a/src/gcore/resources/cloud/networks/__init__.py +++ b/src/gcore/resources/cloud/networks/__init__.py @@ -8,6 +8,14 @@ RoutersResourceWithStreamingResponse, AsyncRoutersResourceWithStreamingResponse, ) +from .subnets import ( + SubnetsResource, + AsyncSubnetsResource, + SubnetsResourceWithRawResponse, + AsyncSubnetsResourceWithRawResponse, + SubnetsResourceWithStreamingResponse, + AsyncSubnetsResourceWithStreamingResponse, +) from .networks import ( NetworksResource, AsyncNetworksResource, @@ -18,6 +26,12 @@ ) __all__ = [ + "SubnetsResource", + "AsyncSubnetsResource", + "SubnetsResourceWithRawResponse", + "AsyncSubnetsResourceWithRawResponse", + "SubnetsResourceWithStreamingResponse", + "AsyncSubnetsResourceWithStreamingResponse", "RoutersResource", "AsyncRoutersResource", "RoutersResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index bfb62826..d0e3f017 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -2,6 +2,11 @@ from __future__ import annotations +from typing import Dict, Optional +from typing_extensions import Literal + +import httpx + from .routers import ( RoutersResource, AsyncRoutersResource, @@ -10,13 +15,38 @@ RoutersResourceWithStreamingResponse, AsyncRoutersResourceWithStreamingResponse, ) +from .subnets import ( + SubnetsResource, + AsyncSubnetsResource, + SubnetsResourceWithRawResponse, + AsyncSubnetsResourceWithRawResponse, + SubnetsResourceWithStreamingResponse, + AsyncSubnetsResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.cloud import network_list_params, network_create_params, network_update_params +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.network import Network +from ....types.cloud.task_id_list import TaskIDList __all__ = ["NetworksResource", "AsyncNetworksResource"] class NetworksResource(SyncAPIResource): + @cached_property + def subnets(self) -> SubnetsResource: + return SubnetsResource(self._client) + @cached_property def routers(self) -> RoutersResource: return RoutersResource(self._client) @@ -40,8 +70,304 @@ def with_streaming_response(self) -> NetworksResourceWithStreamingResponse: """ return NetworksResourceWithStreamingResponse(self) + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + create_router: bool | NotGiven = NOT_GIVEN, + metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create network + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateNetworkSerializer/properties/name' + "$.components.schemas.CreateNetworkSerializer.properties.name" + + create_router: '#/components/schemas/CreateNetworkSerializer/properties/create_router' + "$.components.schemas.CreateNetworkSerializer.properties.create_router" + + metadata: '#/components/schemas/CreateNetworkSerializer/properties/metadata/anyOf/0' + "$.components.schemas.CreateNetworkSerializer.properties.metadata.anyOf[0]" + + type: '#/components/schemas/CreateNetworkSerializer/properties/type' + "$.components.schemas.CreateNetworkSerializer.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._post( + f"/cloud/v1/networks/{project_id}/{region_id}", + body=maybe_transform( + { + "name": name, + "create_router": create_router, + "metadata": metadata, + "type": type, + }, + network_create_params.NetworkCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + network_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + 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, + ) -> Network: + """ + Change network name + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[1].schema" + + network_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[2].schema" + + name: '#/components/schemas/NameSerializerPydantic/properties/name' + "$.components.schemas.NameSerializerPydantic.properties.name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not network_id: + raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") + return self._patch( + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + body=maybe_transform({"name": name}, network_update_params.NetworkUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Network, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + metadata_k: str | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[Network]: + """ + List networks + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[2]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[3]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[4]" + + offset: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[5]" + + order_by: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[6]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/networks/{project_id}/{region_id}", + page=SyncOffsetPage[Network], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "offset": offset, + "order_by": order_by, + }, + network_list_params.NetworkListParams, + ), + ), + model=Network, + ) + + def delete( + self, + network_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete network + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}']['delete'].parameters[1].schema" + + network_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not network_id: + raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") + return self._delete( + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + network_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Network: + """ + Get network + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].get.parameters[1].schema" + + network_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not network_id: + raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") + return self._get( + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Network, + ) + class AsyncNetworksResource(AsyncAPIResource): + @cached_property + def subnets(self) -> AsyncSubnetsResource: + return AsyncSubnetsResource(self._client) + @cached_property def routers(self) -> AsyncRoutersResource: return AsyncRoutersResource(self._client) @@ -65,11 +391,323 @@ def with_streaming_response(self) -> AsyncNetworksResourceWithStreamingResponse: """ return AsyncNetworksResourceWithStreamingResponse(self) + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + create_router: bool | NotGiven = NOT_GIVEN, + metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create network + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateNetworkSerializer/properties/name' + "$.components.schemas.CreateNetworkSerializer.properties.name" + + create_router: '#/components/schemas/CreateNetworkSerializer/properties/create_router' + "$.components.schemas.CreateNetworkSerializer.properties.create_router" + + metadata: '#/components/schemas/CreateNetworkSerializer/properties/metadata/anyOf/0' + "$.components.schemas.CreateNetworkSerializer.properties.metadata.anyOf[0]" + + type: '#/components/schemas/CreateNetworkSerializer/properties/type' + "$.components.schemas.CreateNetworkSerializer.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._post( + f"/cloud/v1/networks/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "name": name, + "create_router": create_router, + "metadata": metadata, + "type": type, + }, + network_create_params.NetworkCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + network_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + 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, + ) -> Network: + """ + Change network name + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[1].schema" + + network_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[2].schema" + + name: '#/components/schemas/NameSerializerPydantic/properties/name' + "$.components.schemas.NameSerializerPydantic.properties.name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not network_id: + raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") + return await self._patch( + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + body=await async_maybe_transform({"name": name}, network_update_params.NetworkUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Network, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + metadata_k: str | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Network, AsyncOffsetPage[Network]]: + """ + List networks + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[2]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[3]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[4]" + + offset: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[5]" + + order_by: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[6]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/networks/{project_id}/{region_id}", + page=AsyncOffsetPage[Network], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "offset": offset, + "order_by": order_by, + }, + network_list_params.NetworkListParams, + ), + ), + model=Network, + ) + + async def delete( + self, + network_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete network + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}']['delete'].parameters[1].schema" + + network_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not network_id: + raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") + return await self._delete( + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + network_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Network: + """ + Get network + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].get.parameters[1].schema" + + network_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not network_id: + raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") + return await self._get( + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Network, + ) + class NetworksResourceWithRawResponse: def __init__(self, networks: NetworksResource) -> None: self._networks = networks + self.create = to_raw_response_wrapper( + networks.create, + ) + self.update = to_raw_response_wrapper( + networks.update, + ) + self.list = to_raw_response_wrapper( + networks.list, + ) + self.delete = to_raw_response_wrapper( + networks.delete, + ) + self.get = to_raw_response_wrapper( + networks.get, + ) + + @cached_property + def subnets(self) -> SubnetsResourceWithRawResponse: + return SubnetsResourceWithRawResponse(self._networks.subnets) + @cached_property def routers(self) -> RoutersResourceWithRawResponse: return RoutersResourceWithRawResponse(self._networks.routers) @@ -79,6 +717,26 @@ class AsyncNetworksResourceWithRawResponse: def __init__(self, networks: AsyncNetworksResource) -> None: self._networks = networks + self.create = async_to_raw_response_wrapper( + networks.create, + ) + self.update = async_to_raw_response_wrapper( + networks.update, + ) + self.list = async_to_raw_response_wrapper( + networks.list, + ) + self.delete = async_to_raw_response_wrapper( + networks.delete, + ) + self.get = async_to_raw_response_wrapper( + networks.get, + ) + + @cached_property + def subnets(self) -> AsyncSubnetsResourceWithRawResponse: + return AsyncSubnetsResourceWithRawResponse(self._networks.subnets) + @cached_property def routers(self) -> AsyncRoutersResourceWithRawResponse: return AsyncRoutersResourceWithRawResponse(self._networks.routers) @@ -88,6 +746,26 @@ class NetworksResourceWithStreamingResponse: def __init__(self, networks: NetworksResource) -> None: self._networks = networks + self.create = to_streamed_response_wrapper( + networks.create, + ) + self.update = to_streamed_response_wrapper( + networks.update, + ) + self.list = to_streamed_response_wrapper( + networks.list, + ) + self.delete = to_streamed_response_wrapper( + networks.delete, + ) + self.get = to_streamed_response_wrapper( + networks.get, + ) + + @cached_property + def subnets(self) -> SubnetsResourceWithStreamingResponse: + return SubnetsResourceWithStreamingResponse(self._networks.subnets) + @cached_property def routers(self) -> RoutersResourceWithStreamingResponse: return RoutersResourceWithStreamingResponse(self._networks.routers) @@ -97,6 +775,26 @@ class AsyncNetworksResourceWithStreamingResponse: def __init__(self, networks: AsyncNetworksResource) -> None: self._networks = networks + self.create = async_to_streamed_response_wrapper( + networks.create, + ) + self.update = async_to_streamed_response_wrapper( + networks.update, + ) + self.list = async_to_streamed_response_wrapper( + networks.list, + ) + self.delete = async_to_streamed_response_wrapper( + networks.delete, + ) + self.get = async_to_streamed_response_wrapper( + networks.get, + ) + + @cached_property + def subnets(self) -> AsyncSubnetsResourceWithStreamingResponse: + return AsyncSubnetsResourceWithStreamingResponse(self._networks.subnets) + @cached_property def routers(self) -> AsyncRoutersResourceWithStreamingResponse: return AsyncRoutersResourceWithStreamingResponse(self._networks.routers) diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py new file mode 100644 index 00000000..c2066910 --- /dev/null +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -0,0 +1,899 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.cloud import IPVersion +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.subnet import Subnet +from ....types.cloud.networks import subnet_list_params, subnet_create_params, subnet_update_params +from ....types.cloud.ip_version import IPVersion +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.neutron_route_param import NeutronRouteParam + +__all__ = ["SubnetsResource", "AsyncSubnetsResource"] + + +class SubnetsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SubnetsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return SubnetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SubnetsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return SubnetsResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + cidr: str, + name: str, + network_id: str, + connect_to_network_router: bool | NotGiven = NOT_GIVEN, + dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, + enable_dhcp: bool | NotGiven = NOT_GIVEN, + gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + ip_version: IPVersion | NotGiven = NOT_GIVEN, + metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create subnet + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].post.parameters[1].schema" + + cidr: '#/components/schemas/CreateSubnetSerializer/properties/cidr' + "$.components.schemas.CreateSubnetSerializer.properties.cidr" + + name: '#/components/schemas/CreateSubnetSerializer/properties/name' + "$.components.schemas.CreateSubnetSerializer.properties.name" + + network_id: '#/components/schemas/CreateSubnetSerializer/properties/network_id' + "$.components.schemas.CreateSubnetSerializer.properties.network_id" + + connect_to_network_router: '#/components/schemas/CreateSubnetSerializer/properties/connect_to_network_router' + "$.components.schemas.CreateSubnetSerializer.properties.connect_to_network_router" + + dns_nameservers: '#/components/schemas/CreateSubnetSerializer/properties/dns_nameservers/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.dns_nameservers.anyOf[0]" + + enable_dhcp: '#/components/schemas/CreateSubnetSerializer/properties/enable_dhcp' + "$.components.schemas.CreateSubnetSerializer.properties.enable_dhcp" + + gateway_ip: '#/components/schemas/CreateSubnetSerializer/properties/gateway_ip/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.gateway_ip.anyOf[0]" + + host_routes: '#/components/schemas/CreateSubnetSerializer/properties/host_routes/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.host_routes.anyOf[0]" + + ip_version: '#/components/schemas/CreateSubnetSerializer/properties/ip_version' + "$.components.schemas.CreateSubnetSerializer.properties.ip_version" + + metadata: '#/components/schemas/CreateSubnetSerializer/properties/metadata/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.metadata.anyOf[0]" + + router_id_to_connect: '#/components/schemas/CreateSubnetSerializer/properties/router_id_to_connect/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._post( + f"/cloud/v1/subnets/{project_id}/{region_id}", + body=maybe_transform( + { + "cidr": cidr, + "name": name, + "network_id": network_id, + "connect_to_network_router": connect_to_network_router, + "dns_nameservers": dns_nameservers, + "enable_dhcp": enable_dhcp, + "gateway_ip": gateway_ip, + "host_routes": host_routes, + "ip_version": ip_version, + "metadata": metadata, + "router_id_to_connect": router_id_to_connect, + }, + subnet_create_params.SubnetCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + subnet_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, + enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, + gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Subnet: + """ + Change subnet properties + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[1].schema" + + subnet_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[2].schema" + + dns_nameservers: '#/components/schemas/PatchSubnetSerializer/properties/dns_nameservers/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.dns_nameservers.anyOf[0]" + + enable_dhcp: '#/components/schemas/PatchSubnetSerializer/properties/enable_dhcp/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.enable_dhcp.anyOf[0]" + + gateway_ip: '#/components/schemas/PatchSubnetSerializer/properties/gateway_ip/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.gateway_ip.anyOf[0]" + + host_routes: '#/components/schemas/PatchSubnetSerializer/properties/host_routes/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.host_routes.anyOf[0]" + + name: '#/components/schemas/PatchSubnetSerializer/properties/name/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.name.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not subnet_id: + raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") + return self._patch( + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + body=maybe_transform( + { + "dns_nameservers": dns_nameservers, + "enable_dhcp": enable_dhcp, + "gateway_ip": gateway_ip, + "host_routes": host_routes, + "name": name, + }, + subnet_update_params.SubnetUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Subnet, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + metadata_k: List[str] | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + network_id: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: Literal[ + "available_ips.asc", + "available_ips.desc", + "cidr.asc", + "cidr.desc", + "created_at.asc", + "created_at.desc", + "name.asc", + "name.desc", + "total_ips.asc", + "total_ips.desc", + "updated_at.asc", + "updated_at.desc", + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[Subnet]: + """ + List subnets + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[2]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[3]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[4]" + + network_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[5]" + + offset: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[6]" + + order_by: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[7]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/subnets/{project_id}/{region_id}", + page=SyncOffsetPage[Subnet], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "network_id": network_id, + "offset": offset, + "order_by": order_by, + }, + subnet_list_params.SubnetListParams, + ), + ), + model=Subnet, + ) + + def delete( + self, + subnet_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete subnet + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}']['delete'].parameters[1].schema" + + subnet_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not subnet_id: + raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + subnet_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Subnet: + """ + Get subnet + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].get.parameters[1].schema" + + subnet_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not subnet_id: + raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") + return self._get( + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Subnet, + ) + + +class AsyncSubnetsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSubnetsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncSubnetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSubnetsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncSubnetsResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + cidr: str, + name: str, + network_id: str, + connect_to_network_router: bool | NotGiven = NOT_GIVEN, + dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, + enable_dhcp: bool | NotGiven = NOT_GIVEN, + gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + ip_version: IPVersion | NotGiven = NOT_GIVEN, + metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create subnet + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].post.parameters[1].schema" + + cidr: '#/components/schemas/CreateSubnetSerializer/properties/cidr' + "$.components.schemas.CreateSubnetSerializer.properties.cidr" + + name: '#/components/schemas/CreateSubnetSerializer/properties/name' + "$.components.schemas.CreateSubnetSerializer.properties.name" + + network_id: '#/components/schemas/CreateSubnetSerializer/properties/network_id' + "$.components.schemas.CreateSubnetSerializer.properties.network_id" + + connect_to_network_router: '#/components/schemas/CreateSubnetSerializer/properties/connect_to_network_router' + "$.components.schemas.CreateSubnetSerializer.properties.connect_to_network_router" + + dns_nameservers: '#/components/schemas/CreateSubnetSerializer/properties/dns_nameservers/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.dns_nameservers.anyOf[0]" + + enable_dhcp: '#/components/schemas/CreateSubnetSerializer/properties/enable_dhcp' + "$.components.schemas.CreateSubnetSerializer.properties.enable_dhcp" + + gateway_ip: '#/components/schemas/CreateSubnetSerializer/properties/gateway_ip/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.gateway_ip.anyOf[0]" + + host_routes: '#/components/schemas/CreateSubnetSerializer/properties/host_routes/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.host_routes.anyOf[0]" + + ip_version: '#/components/schemas/CreateSubnetSerializer/properties/ip_version' + "$.components.schemas.CreateSubnetSerializer.properties.ip_version" + + metadata: '#/components/schemas/CreateSubnetSerializer/properties/metadata/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.metadata.anyOf[0]" + + router_id_to_connect: '#/components/schemas/CreateSubnetSerializer/properties/router_id_to_connect/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._post( + f"/cloud/v1/subnets/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "cidr": cidr, + "name": name, + "network_id": network_id, + "connect_to_network_router": connect_to_network_router, + "dns_nameservers": dns_nameservers, + "enable_dhcp": enable_dhcp, + "gateway_ip": gateway_ip, + "host_routes": host_routes, + "ip_version": ip_version, + "metadata": metadata, + "router_id_to_connect": router_id_to_connect, + }, + subnet_create_params.SubnetCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + subnet_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, + enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, + gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Subnet: + """ + Change subnet properties + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[1].schema" + + subnet_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[2].schema" + + dns_nameservers: '#/components/schemas/PatchSubnetSerializer/properties/dns_nameservers/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.dns_nameservers.anyOf[0]" + + enable_dhcp: '#/components/schemas/PatchSubnetSerializer/properties/enable_dhcp/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.enable_dhcp.anyOf[0]" + + gateway_ip: '#/components/schemas/PatchSubnetSerializer/properties/gateway_ip/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.gateway_ip.anyOf[0]" + + host_routes: '#/components/schemas/PatchSubnetSerializer/properties/host_routes/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.host_routes.anyOf[0]" + + name: '#/components/schemas/PatchSubnetSerializer/properties/name/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.name.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not subnet_id: + raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") + return await self._patch( + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + body=await async_maybe_transform( + { + "dns_nameservers": dns_nameservers, + "enable_dhcp": enable_dhcp, + "gateway_ip": gateway_ip, + "host_routes": host_routes, + "name": name, + }, + subnet_update_params.SubnetUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Subnet, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + metadata_k: List[str] | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + network_id: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: Literal[ + "available_ips.asc", + "available_ips.desc", + "cidr.asc", + "cidr.desc", + "created_at.asc", + "created_at.desc", + "name.asc", + "name.desc", + "total_ips.asc", + "total_ips.desc", + "updated_at.asc", + "updated_at.desc", + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Subnet, AsyncOffsetPage[Subnet]]: + """ + List subnets + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[2]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[3]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[4]" + + network_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[5]" + + offset: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[6]" + + order_by: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[7]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/subnets/{project_id}/{region_id}", + page=AsyncOffsetPage[Subnet], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "network_id": network_id, + "offset": offset, + "order_by": order_by, + }, + subnet_list_params.SubnetListParams, + ), + ), + model=Subnet, + ) + + async def delete( + self, + subnet_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete subnet + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}']['delete'].parameters[1].schema" + + subnet_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not subnet_id: + raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + subnet_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Subnet: + """ + Get subnet + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].get.parameters[1].schema" + + subnet_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not subnet_id: + raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") + return await self._get( + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Subnet, + ) + + +class SubnetsResourceWithRawResponse: + def __init__(self, subnets: SubnetsResource) -> None: + self._subnets = subnets + + self.create = to_raw_response_wrapper( + subnets.create, + ) + self.update = to_raw_response_wrapper( + subnets.update, + ) + self.list = to_raw_response_wrapper( + subnets.list, + ) + self.delete = to_raw_response_wrapper( + subnets.delete, + ) + self.get = to_raw_response_wrapper( + subnets.get, + ) + + +class AsyncSubnetsResourceWithRawResponse: + def __init__(self, subnets: AsyncSubnetsResource) -> None: + self._subnets = subnets + + self.create = async_to_raw_response_wrapper( + subnets.create, + ) + self.update = async_to_raw_response_wrapper( + subnets.update, + ) + self.list = async_to_raw_response_wrapper( + subnets.list, + ) + self.delete = async_to_raw_response_wrapper( + subnets.delete, + ) + self.get = async_to_raw_response_wrapper( + subnets.get, + ) + + +class SubnetsResourceWithStreamingResponse: + def __init__(self, subnets: SubnetsResource) -> None: + self._subnets = subnets + + self.create = to_streamed_response_wrapper( + subnets.create, + ) + self.update = to_streamed_response_wrapper( + subnets.update, + ) + self.list = to_streamed_response_wrapper( + subnets.list, + ) + self.delete = to_streamed_response_wrapper( + subnets.delete, + ) + self.get = to_streamed_response_wrapper( + subnets.get, + ) + + +class AsyncSubnetsResourceWithStreamingResponse: + def __init__(self, subnets: AsyncSubnetsResource) -> None: + self._subnets = subnets + + self.create = async_to_streamed_response_wrapper( + subnets.create, + ) + self.update = async_to_streamed_response_wrapper( + subnets.update, + ) + self.list = async_to_streamed_response_wrapper( + subnets.list, + ) + self.delete = async_to_streamed_response_wrapper( + subnets.delete, + ) + self.get = async_to_streamed_response_wrapper( + subnets.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index f46826f5..2abd4804 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -28,6 +28,7 @@ from .volume_list_params import VolumeListParams as VolumeListParams from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily +from .network_list_params import NetworkListParams as NetworkListParams from .neutron_route_param import NeutronRouteParam as NeutronRouteParam from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus @@ -41,6 +42,8 @@ from .volume_resize_params import VolumeResizeParams as VolumeResizeParams from .volume_update_params import VolumeUpdateParams as VolumeUpdateParams from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate +from .network_create_params import NetworkCreateParams as NetworkCreateParams +from .network_update_params import NetworkUpdateParams as NetworkUpdateParams from .project_create_params import ProjectCreateParams as ProjectCreateParams from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams diff --git a/src/gcore/types/cloud/network_create_params.py b/src/gcore/types/cloud/network_create_params.py new file mode 100644 index 00000000..d47f2c4a --- /dev/null +++ b/src/gcore/types/cloud/network_create_params.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["NetworkCreateParams"] + + +class NetworkCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/CreateNetworkSerializer/properties/name' + "$.components.schemas.CreateNetworkSerializer.properties.name" + """ + + create_router: bool + """ + '#/components/schemas/CreateNetworkSerializer/properties/create_router' + "$.components.schemas.CreateNetworkSerializer.properties.create_router" + """ + + metadata: Optional[Dict[str, str]] + """ + '#/components/schemas/CreateNetworkSerializer/properties/metadata/anyOf/0' + "$.components.schemas.CreateNetworkSerializer.properties.metadata.anyOf[0]" + """ + + type: Literal["vlan", "vxlan"] + """ + '#/components/schemas/CreateNetworkSerializer/properties/type' + "$.components.schemas.CreateNetworkSerializer.properties.type" + """ diff --git a/src/gcore/types/cloud/network_list_params.py b/src/gcore/types/cloud/network_list_params.py new file mode 100644 index 00000000..e72a01e2 --- /dev/null +++ b/src/gcore/types/cloud/network_list_params.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["NetworkListParams"] + + +class NetworkListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[2]" + """ + + metadata_k: str + """ + '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[3]" + """ + + metadata_kv: str + """ + '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[4]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[5]" + """ + + order_by: str + """ + '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[6]" + """ diff --git a/src/gcore/types/cloud/network_update_params.py b/src/gcore/types/cloud/network_update_params.py new file mode 100644 index 00000000..375ab5dd --- /dev/null +++ b/src/gcore/types/cloud/network_update_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["NetworkUpdateParams"] + + +class NetworkUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/NameSerializerPydantic/properties/name' + "$.components.schemas.NameSerializerPydantic.properties.name" + """ diff --git a/src/gcore/types/cloud/networks/__init__.py b/src/gcore/types/cloud/networks/__init__.py index e9e0ee94..be19f7cf 100644 --- a/src/gcore/types/cloud/networks/__init__.py +++ b/src/gcore/types/cloud/networks/__init__.py @@ -5,7 +5,10 @@ from .router import Router as Router from .router_list import RouterList as RouterList from .router_list_params import RouterListParams as RouterListParams +from .subnet_list_params import SubnetListParams as SubnetListParams from .router_create_params import RouterCreateParams as RouterCreateParams from .router_update_params import RouterUpdateParams as RouterUpdateParams +from .subnet_create_params import SubnetCreateParams as SubnetCreateParams +from .subnet_update_params import SubnetUpdateParams as SubnetUpdateParams from .router_attach_subnet_params import RouterAttachSubnetParams as RouterAttachSubnetParams from .router_detach_subnet_params import RouterDetachSubnetParams as RouterDetachSubnetParams diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py new file mode 100644 index 00000000..0801eb1c --- /dev/null +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -0,0 +1,91 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Required, TypedDict + +from ..ip_version import IPVersion +from ..neutron_route_param import NeutronRouteParam + +__all__ = ["SubnetCreateParams"] + + +class SubnetCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + cidr: Required[str] + """ + '#/components/schemas/CreateSubnetSerializer/properties/cidr' + "$.components.schemas.CreateSubnetSerializer.properties.cidr" + """ + + name: Required[str] + """ + '#/components/schemas/CreateSubnetSerializer/properties/name' + "$.components.schemas.CreateSubnetSerializer.properties.name" + """ + + network_id: Required[str] + """ + '#/components/schemas/CreateSubnetSerializer/properties/network_id' + "$.components.schemas.CreateSubnetSerializer.properties.network_id" + """ + + connect_to_network_router: bool + """ + '#/components/schemas/CreateSubnetSerializer/properties/connect_to_network_router' + "$.components.schemas.CreateSubnetSerializer.properties.connect_to_network_router" + """ + + dns_nameservers: Optional[List[str]] + """ + '#/components/schemas/CreateSubnetSerializer/properties/dns_nameservers/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.dns_nameservers.anyOf[0]" + """ + + enable_dhcp: bool + """ + '#/components/schemas/CreateSubnetSerializer/properties/enable_dhcp' + "$.components.schemas.CreateSubnetSerializer.properties.enable_dhcp" + """ + + gateway_ip: Optional[str] + """ + '#/components/schemas/CreateSubnetSerializer/properties/gateway_ip/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.gateway_ip.anyOf[0]" + """ + + host_routes: Optional[Iterable[NeutronRouteParam]] + """ + '#/components/schemas/CreateSubnetSerializer/properties/host_routes/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.host_routes.anyOf[0]" + """ + + ip_version: IPVersion + """ + '#/components/schemas/CreateSubnetSerializer/properties/ip_version' + "$.components.schemas.CreateSubnetSerializer.properties.ip_version" + """ + + metadata: Optional[Dict[str, str]] + """ + '#/components/schemas/CreateSubnetSerializer/properties/metadata/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.metadata.anyOf[0]" + """ + + router_id_to_connect: Optional[str] + """ + '#/components/schemas/CreateSubnetSerializer/properties/router_id_to_connect/anyOf/0' + "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/networks/subnet_list_params.py b/src/gcore/types/cloud/networks/subnet_list_params.py new file mode 100644 index 00000000..b7004132 --- /dev/null +++ b/src/gcore/types/cloud/networks/subnet_list_params.py @@ -0,0 +1,71 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, TypedDict + +__all__ = ["SubnetListParams"] + + +class SubnetListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[2]" + """ + + metadata_k: List[str] + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[3]" + """ + + metadata_kv: str + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[4]" + """ + + network_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[5]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[6]" + """ + + order_by: Literal[ + "available_ips.asc", + "available_ips.desc", + "cidr.asc", + "cidr.desc", + "created_at.asc", + "created_at.desc", + "name.asc", + "name.desc", + "total_ips.asc", + "total_ips.desc", + "updated_at.asc", + "updated_at.desc", + ] + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[7]" + """ diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py new file mode 100644 index 00000000..aa96d08b --- /dev/null +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -0,0 +1,54 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional +from typing_extensions import TypedDict + +from ..neutron_route_param import NeutronRouteParam + +__all__ = ["SubnetUpdateParams"] + + +class SubnetUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[1].schema" + """ + + dns_nameservers: Optional[List[str]] + """ + '#/components/schemas/PatchSubnetSerializer/properties/dns_nameservers/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.dns_nameservers.anyOf[0]" + """ + + enable_dhcp: Optional[bool] + """ + '#/components/schemas/PatchSubnetSerializer/properties/enable_dhcp/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.enable_dhcp.anyOf[0]" + """ + + gateway_ip: Optional[str] + """ + '#/components/schemas/PatchSubnetSerializer/properties/gateway_ip/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.gateway_ip.anyOf[0]" + """ + + host_routes: Optional[Iterable[NeutronRouteParam]] + """ + '#/components/schemas/PatchSubnetSerializer/properties/host_routes/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.host_routes.anyOf[0]" + """ + + name: Optional[str] + """ + '#/components/schemas/PatchSubnetSerializer/properties/name/anyOf/0' + "$.components.schemas.PatchSubnetSerializer.properties.name.anyOf[0]" + """ diff --git a/tests/api_resources/cloud/networks/test_subnets.py b/tests/api_resources/cloud/networks/test_subnets.py new file mode 100644 index 00000000..8e9d0930 --- /dev/null +++ b/tests/api_resources/cloud/networks/test_subnets.py @@ -0,0 +1,567 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import Subnet, TaskIDList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSubnets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + subnet = client.cloud.networks.subnets.create( + project_id=1, + region_id=1, + cidr="192.168.10.0/24", + name="my subnet", + network_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + assert_matches_type(TaskIDList, subnet, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + subnet = client.cloud.networks.subnets.create( + project_id=1, + region_id=1, + cidr="192.168.10.0/24", + name="my subnet", + network_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + connect_to_network_router=True, + dns_nameservers=["8.8.4.4", "1.1.1.1"], + enable_dhcp=True, + gateway_ip="192.168.10.1", + host_routes=[ + { + "destination": "10.0.3.0/24", + "nexthop": "10.0.0.13", + } + ], + ip_version=4, + metadata={"my-tag": "my-tag-value"}, + router_id_to_connect="00000000-0000-4000-8000-000000000000", + ) + assert_matches_type(TaskIDList, subnet, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.networks.subnets.with_raw_response.create( + project_id=1, + region_id=1, + cidr="192.168.10.0/24", + name="my subnet", + network_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subnet = response.parse() + assert_matches_type(TaskIDList, subnet, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.networks.subnets.with_streaming_response.create( + project_id=1, + region_id=1, + cidr="192.168.10.0/24", + name="my subnet", + network_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subnet = response.parse() + assert_matches_type(TaskIDList, subnet, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + subnet = client.cloud.networks.subnets.update( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + assert_matches_type(Subnet, subnet, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + subnet = client.cloud.networks.subnets.update( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + dns_nameservers=["8.8.4.4", "1.1.1.1"], + enable_dhcp=True, + gateway_ip="192.168.10.1", + host_routes=[ + { + "destination": "10.0.3.0/24", + "nexthop": "10.0.0.13", + } + ], + name="some_name", + ) + assert_matches_type(Subnet, subnet, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.networks.subnets.with_raw_response.update( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subnet = response.parse() + assert_matches_type(Subnet, subnet, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.networks.subnets.with_streaming_response.update( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subnet = response.parse() + assert_matches_type(Subnet, subnet, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `subnet_id` but received ''"): + client.cloud.networks.subnets.with_raw_response.update( + subnet_id="", + project_id=1, + region_id=1, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + subnet = client.cloud.networks.subnets.list( + project_id=1, + region_id=1, + ) + assert_matches_type(SyncOffsetPage[Subnet], subnet, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + subnet = client.cloud.networks.subnets.list( + project_id=1, + region_id=1, + limit=1000, + metadata_k=["key1", "key2"], + metadata_kv="metadata_kv", + network_id="b30d0de7-bca2-4c83-9c57-9e645bd2cc92", + offset=0, + order_by="name.asc", + ) + assert_matches_type(SyncOffsetPage[Subnet], subnet, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.networks.subnets.with_raw_response.list( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subnet = response.parse() + assert_matches_type(SyncOffsetPage[Subnet], subnet, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.networks.subnets.with_streaming_response.list( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subnet = response.parse() + assert_matches_type(SyncOffsetPage[Subnet], subnet, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + subnet = client.cloud.networks.subnets.delete( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + assert subnet is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.networks.subnets.with_raw_response.delete( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subnet = response.parse() + assert subnet is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.networks.subnets.with_streaming_response.delete( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subnet = response.parse() + assert subnet is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `subnet_id` but received ''"): + client.cloud.networks.subnets.with_raw_response.delete( + subnet_id="", + project_id=1, + region_id=1, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + subnet = client.cloud.networks.subnets.get( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + assert_matches_type(Subnet, subnet, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.networks.subnets.with_raw_response.get( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subnet = response.parse() + assert_matches_type(Subnet, subnet, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.networks.subnets.with_streaming_response.get( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subnet = response.parse() + assert_matches_type(Subnet, subnet, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `subnet_id` but received ''"): + client.cloud.networks.subnets.with_raw_response.get( + subnet_id="", + project_id=1, + region_id=1, + ) + + +class TestAsyncSubnets: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + subnet = await async_client.cloud.networks.subnets.create( + project_id=1, + region_id=1, + cidr="192.168.10.0/24", + name="my subnet", + network_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + assert_matches_type(TaskIDList, subnet, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + subnet = await async_client.cloud.networks.subnets.create( + project_id=1, + region_id=1, + cidr="192.168.10.0/24", + name="my subnet", + network_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + connect_to_network_router=True, + dns_nameservers=["8.8.4.4", "1.1.1.1"], + enable_dhcp=True, + gateway_ip="192.168.10.1", + host_routes=[ + { + "destination": "10.0.3.0/24", + "nexthop": "10.0.0.13", + } + ], + ip_version=4, + metadata={"my-tag": "my-tag-value"}, + router_id_to_connect="00000000-0000-4000-8000-000000000000", + ) + assert_matches_type(TaskIDList, subnet, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.subnets.with_raw_response.create( + project_id=1, + region_id=1, + cidr="192.168.10.0/24", + name="my subnet", + network_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subnet = await response.parse() + assert_matches_type(TaskIDList, subnet, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.subnets.with_streaming_response.create( + project_id=1, + region_id=1, + cidr="192.168.10.0/24", + name="my subnet", + network_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subnet = await response.parse() + assert_matches_type(TaskIDList, subnet, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + subnet = await async_client.cloud.networks.subnets.update( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + assert_matches_type(Subnet, subnet, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + subnet = await async_client.cloud.networks.subnets.update( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + dns_nameservers=["8.8.4.4", "1.1.1.1"], + enable_dhcp=True, + gateway_ip="192.168.10.1", + host_routes=[ + { + "destination": "10.0.3.0/24", + "nexthop": "10.0.0.13", + } + ], + name="some_name", + ) + assert_matches_type(Subnet, subnet, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.subnets.with_raw_response.update( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subnet = await response.parse() + assert_matches_type(Subnet, subnet, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.subnets.with_streaming_response.update( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subnet = await response.parse() + assert_matches_type(Subnet, subnet, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `subnet_id` but received ''"): + await async_client.cloud.networks.subnets.with_raw_response.update( + subnet_id="", + project_id=1, + region_id=1, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + subnet = await async_client.cloud.networks.subnets.list( + project_id=1, + region_id=1, + ) + assert_matches_type(AsyncOffsetPage[Subnet], subnet, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + subnet = await async_client.cloud.networks.subnets.list( + project_id=1, + region_id=1, + limit=1000, + metadata_k=["key1", "key2"], + metadata_kv="metadata_kv", + network_id="b30d0de7-bca2-4c83-9c57-9e645bd2cc92", + offset=0, + order_by="name.asc", + ) + assert_matches_type(AsyncOffsetPage[Subnet], subnet, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.subnets.with_raw_response.list( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subnet = await response.parse() + assert_matches_type(AsyncOffsetPage[Subnet], subnet, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.subnets.with_streaming_response.list( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subnet = await response.parse() + assert_matches_type(AsyncOffsetPage[Subnet], subnet, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + subnet = await async_client.cloud.networks.subnets.delete( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + assert subnet is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.subnets.with_raw_response.delete( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subnet = await response.parse() + assert subnet is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.subnets.with_streaming_response.delete( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subnet = await response.parse() + assert subnet is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `subnet_id` but received ''"): + await async_client.cloud.networks.subnets.with_raw_response.delete( + subnet_id="", + project_id=1, + region_id=1, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + subnet = await async_client.cloud.networks.subnets.get( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + assert_matches_type(Subnet, subnet, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.subnets.with_raw_response.get( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subnet = await response.parse() + assert_matches_type(Subnet, subnet, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.subnets.with_streaming_response.get( + subnet_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subnet = await response.parse() + assert_matches_type(Subnet, subnet, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `subnet_id` but received ''"): + await async_client.cloud.networks.subnets.with_raw_response.get( + subnet_id="", + project_id=1, + region_id=1, + ) diff --git a/tests/api_resources/cloud/test_networks.py b/tests/api_resources/cloud/test_networks.py new file mode 100644 index 00000000..af455350 --- /dev/null +++ b/tests/api_resources/cloud/test_networks.py @@ -0,0 +1,499 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import Network, TaskIDList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestNetworks: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + network = client.cloud.networks.create( + project_id=0, + region_id=0, + name="my network", + ) + assert_matches_type(TaskIDList, network, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + network = client.cloud.networks.create( + project_id=0, + region_id=0, + name="my network", + create_router=True, + metadata={"my-tag": "my-tag-value"}, + type="vxlan", + ) + assert_matches_type(TaskIDList, network, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.networks.with_raw_response.create( + project_id=0, + region_id=0, + name="my network", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network = response.parse() + assert_matches_type(TaskIDList, network, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.networks.with_streaming_response.create( + project_id=0, + region_id=0, + name="my network", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network = response.parse() + assert_matches_type(TaskIDList, network, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + network = client.cloud.networks.update( + network_id="network_id", + project_id=0, + region_id=0, + name="some_name", + ) + assert_matches_type(Network, network, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.networks.with_raw_response.update( + network_id="network_id", + project_id=0, + region_id=0, + name="some_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network = response.parse() + assert_matches_type(Network, network, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.networks.with_streaming_response.update( + network_id="network_id", + project_id=0, + region_id=0, + name="some_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network = response.parse() + assert_matches_type(Network, network, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): + client.cloud.networks.with_raw_response.update( + network_id="", + project_id=0, + region_id=0, + name="some_name", + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + network = client.cloud.networks.list( + project_id=0, + region_id=0, + ) + assert_matches_type(SyncOffsetPage[Network], network, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + network = client.cloud.networks.list( + project_id=0, + region_id=0, + limit=0, + metadata_k="metadata_k", + metadata_kv="metadata_kv", + offset=0, + order_by="order_by", + ) + assert_matches_type(SyncOffsetPage[Network], network, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.networks.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network = response.parse() + assert_matches_type(SyncOffsetPage[Network], network, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.networks.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network = response.parse() + assert_matches_type(SyncOffsetPage[Network], network, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + network = client.cloud.networks.delete( + network_id="network_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, network, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.networks.with_raw_response.delete( + network_id="network_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network = response.parse() + assert_matches_type(TaskIDList, network, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.networks.with_streaming_response.delete( + network_id="network_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network = response.parse() + assert_matches_type(TaskIDList, network, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): + client.cloud.networks.with_raw_response.delete( + network_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + network = client.cloud.networks.get( + network_id="network_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Network, network, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.networks.with_raw_response.get( + network_id="network_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network = response.parse() + assert_matches_type(Network, network, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.networks.with_streaming_response.get( + network_id="network_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network = response.parse() + assert_matches_type(Network, network, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): + client.cloud.networks.with_raw_response.get( + network_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncNetworks: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + network = await async_client.cloud.networks.create( + project_id=0, + region_id=0, + name="my network", + ) + assert_matches_type(TaskIDList, network, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + network = await async_client.cloud.networks.create( + project_id=0, + region_id=0, + name="my network", + create_router=True, + metadata={"my-tag": "my-tag-value"}, + type="vxlan", + ) + assert_matches_type(TaskIDList, network, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.with_raw_response.create( + project_id=0, + region_id=0, + name="my network", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network = await response.parse() + assert_matches_type(TaskIDList, network, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.with_streaming_response.create( + project_id=0, + region_id=0, + name="my network", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network = await response.parse() + assert_matches_type(TaskIDList, network, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + network = await async_client.cloud.networks.update( + network_id="network_id", + project_id=0, + region_id=0, + name="some_name", + ) + assert_matches_type(Network, network, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.with_raw_response.update( + network_id="network_id", + project_id=0, + region_id=0, + name="some_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network = await response.parse() + assert_matches_type(Network, network, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.with_streaming_response.update( + network_id="network_id", + project_id=0, + region_id=0, + name="some_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network = await response.parse() + assert_matches_type(Network, network, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): + await async_client.cloud.networks.with_raw_response.update( + network_id="", + project_id=0, + region_id=0, + name="some_name", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + network = await async_client.cloud.networks.list( + project_id=0, + region_id=0, + ) + assert_matches_type(AsyncOffsetPage[Network], network, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + network = await async_client.cloud.networks.list( + project_id=0, + region_id=0, + limit=0, + metadata_k="metadata_k", + metadata_kv="metadata_kv", + offset=0, + order_by="order_by", + ) + assert_matches_type(AsyncOffsetPage[Network], network, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network = await response.parse() + assert_matches_type(AsyncOffsetPage[Network], network, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network = await response.parse() + assert_matches_type(AsyncOffsetPage[Network], network, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + network = await async_client.cloud.networks.delete( + network_id="network_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, network, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.with_raw_response.delete( + network_id="network_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network = await response.parse() + assert_matches_type(TaskIDList, network, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.with_streaming_response.delete( + network_id="network_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network = await response.parse() + assert_matches_type(TaskIDList, network, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): + await async_client.cloud.networks.with_raw_response.delete( + network_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + network = await async_client.cloud.networks.get( + network_id="network_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Network, network, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.networks.with_raw_response.get( + network_id="network_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network = await response.parse() + assert_matches_type(Network, network, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.networks.with_streaming_response.get( + network_id="network_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network = await response.parse() + assert_matches_type(Network, network, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): + await async_client.cloud.networks.with_raw_response.get( + network_id="", + project_id=0, + region_id=0, + ) From d96532f5a1868ca3e2259900a1d8e3c03c22c8d2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:09:08 +0000 Subject: [PATCH 058/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index dfd22ebe..55b2c8b5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-704d790a88e748be44961419e9f6f8155e183cac66ebd183ac9c0195c9a3d1bf.yml -openapi_spec_hash: 169fae9f2073f3ba088aa92a3eb34306 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e39804de8b5c320a8015dcde593be93e8df2c35f99be4c48bf75d4ab0ba7ab3a.yml +openapi_spec_hash: 9f7283a11935ecc054fc2d00f9c5ade1 config_hash: f44dbe148d290ab905d2fd482070b50d From 4372143260397468e6a687f2e49d049a806d0498 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:55:24 +0000 Subject: [PATCH 059/592] chore(internal): minor formatting changes --- src/gcore/types/cloud/ddos_profile_status.py | 1 - src/gcore/types/cloud/load_balancer_statistics.py | 1 - src/gcore/types/cloud/neutron_route.py | 1 - src/gcore/types/cloud/reserved_fixed_ips/ip_assignment.py | 1 - src/gcore/types/cloud/tag.py | 1 - 5 files changed, 5 deletions(-) diff --git a/src/gcore/types/cloud/ddos_profile_status.py b/src/gcore/types/cloud/ddos_profile_status.py index 20abdced..a291dfdd 100644 --- a/src/gcore/types/cloud/ddos_profile_status.py +++ b/src/gcore/types/cloud/ddos_profile_status.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ..._models import BaseModel __all__ = ["DDOSProfileStatus"] diff --git a/src/gcore/types/cloud/load_balancer_statistics.py b/src/gcore/types/cloud/load_balancer_statistics.py index dc4f57cd..d4508aaa 100644 --- a/src/gcore/types/cloud/load_balancer_statistics.py +++ b/src/gcore/types/cloud/load_balancer_statistics.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ..._models import BaseModel __all__ = ["LoadBalancerStatistics"] diff --git a/src/gcore/types/cloud/neutron_route.py b/src/gcore/types/cloud/neutron_route.py index 3cb3370b..59eea1e8 100644 --- a/src/gcore/types/cloud/neutron_route.py +++ b/src/gcore/types/cloud/neutron_route.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ..._models import BaseModel __all__ = ["NeutronRoute"] diff --git a/src/gcore/types/cloud/reserved_fixed_ips/ip_assignment.py b/src/gcore/types/cloud/reserved_fixed_ips/ip_assignment.py index 211eefaf..5b9c6604 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/ip_assignment.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/ip_assignment.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ..subnet import Subnet from ...._models import BaseModel diff --git a/src/gcore/types/cloud/tag.py b/src/gcore/types/cloud/tag.py index 9299a626..0baf134b 100644 --- a/src/gcore/types/cloud/tag.py +++ b/src/gcore/types/cloud/tag.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - from ..._models import BaseModel __all__ = ["Tag"] From e7f2e9b7adbf56397e70768938971d3df8e2fe6a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:56:01 +0000 Subject: [PATCH 060/592] chore(internal): codegen related update --- .github/workflows/ci.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c2fa227..d6f5621c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,18 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: timeout-minutes: 10 name: lint - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -33,7 +33,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -53,7 +53,7 @@ jobs: prevent-debug-release: name: Prevent Debug SDK Release - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - run: | echo "This SDK was built in debug mode, this job is a failsafe to prevent releasing debug SDKs" From ed4210b9728b121ff6f38ec308644c16ff649da0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:56:34 +0000 Subject: [PATCH 061/592] chore(ci): only use depot for staging repos --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6f5621c..b2169002 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 @@ -33,7 +33,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 @@ -53,7 +53,7 @@ jobs: prevent-debug-release: name: Prevent Debug SDK Release - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - run: | echo "This SDK was built in debug mode, this job is a failsafe to prevent releasing debug SDKs" From 1de4d846ff9901d76ab9f2670b455302f4771ff1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:58:16 +0000 Subject: [PATCH 062/592] chore: broadly detect json family of content-type headers --- src/gcore/_response.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gcore/_response.py b/src/gcore/_response.py index ddab201d..f8a69959 100644 --- a/src/gcore/_response.py +++ b/src/gcore/_response.py @@ -233,7 +233,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: # split is required to handle cases where additional information is included # in the response, e.g. application/json; charset=utf-8 content_type, *_ = response.headers.get("content-type", "*").split(";") - if content_type != "application/json": + if not content_type.endswith("json"): if is_basemodel(cast_to): try: data = response.json() From 939cf1f8e9a21aa1c5d302a7168366a08bf80c28 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 11:08:33 +0000 Subject: [PATCH 063/592] Add all shared schemas --- .stats.yml | 2 +- api.md | 6 +++--- src/gcore/resources/cloud/floating_ips.py | 7 +++---- src/gcore/resources/cloud/volumes.py | 19 +++++++++---------- src/gcore/types/cloud/__init__.py | 1 - .../types/cloud/floating_ip_create_params.py | 6 ++---- .../types/cloud/tag_update_list_param.py | 10 ---------- src/gcore/types/cloud/volume_create_params.py | 10 ++++------ .../api_resources/cloud/test_floating_ips.py | 4 ++-- 9 files changed, 24 insertions(+), 41 deletions(-) delete mode 100644 src/gcore/types/cloud/tag_update_list_param.py diff --git a/.stats.yml b/.stats.yml index 55b2c8b5..21ad7752 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 81 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e39804de8b5c320a8015dcde593be93e8df2c35f99be4c48bf75d4ab0ba7ab3a.yml openapi_spec_hash: 9f7283a11935ecc054fc2d00f9c5ade1 -config_hash: f44dbe148d290ab905d2fd482070b50d +config_hash: 63718a5516558d684de630b38e2b72f1 diff --git a/api.md b/api.md index 23fcc7bb..63ea251c 100644 --- a/api.md +++ b/api.md @@ -4,6 +4,8 @@ Types: ```python from gcore.types.cloud import ( + BaremetalFlavorList, + Console, DDOSProfile, DDOSProfileField, DDOSProfileOptionList, @@ -22,14 +24,12 @@ from gcore.types.cloud import ( LoadBalancerOperatingStatus, LoadBalancerStatistics, Network, - NetworkAnySubnetFip, - NetworkSubnetFip, NeutronRoute, + PortList, ProvisioningStatus, Subnet, Tag, TagList, - TagUpdateList, TaskIDList, ) ``` diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index d3ba8cfe..d292f3d8 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Optional +from typing import Dict, List, Optional import httpx @@ -22,7 +22,6 @@ from ...types.cloud.floating_ip import FloatingIP from ...types.cloud.task_id_list import TaskIDList from ...types.cloud.floating_ip_detailed import FloatingIPDetailed -from ...types.cloud.tag_update_list_param import TagUpdateListParam __all__ = ["FloatingIPsResource", "AsyncFloatingIPsResource"] @@ -53,7 +52,7 @@ def create( project_id: int | None = None, region_id: int | None = None, fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, - metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, port_id: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -414,7 +413,7 @@ async def create( project_id: int | None = None, region_id: int | None = None, fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, - metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, port_id: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 2da5a63b..95f41724 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Dict, List, Iterable from typing_extensions import Literal, overload import httpx @@ -31,7 +31,6 @@ from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.volume import Volume from ...types.cloud.task_id_list import TaskIDList -from ...types.cloud.tag_update_list_param import TagUpdateListParam __all__ = ["VolumesResource", "AsyncVolumesResource"] @@ -69,7 +68,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -138,7 +137,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, @@ -208,7 +207,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -277,7 +276,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, snapshot_id: str | NotGiven = NOT_GIVEN, @@ -882,7 +881,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -951,7 +950,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, @@ -1021,7 +1020,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1090,7 +1089,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: TagUpdateListParam | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, snapshot_id: str | NotGiven = NOT_GIVEN, diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 2abd4804..15d7c798 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -47,7 +47,6 @@ from .project_create_params import ProjectCreateParams as ProjectCreateParams from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams -from .tag_update_list_param import TagUpdateListParam as TagUpdateListParam from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams diff --git a/src/gcore/types/cloud/floating_ip_create_params.py b/src/gcore/types/cloud/floating_ip_create_params.py index ff2252a3..e0e173b5 100644 --- a/src/gcore/types/cloud/floating_ip_create_params.py +++ b/src/gcore/types/cloud/floating_ip_create_params.py @@ -2,11 +2,9 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import TypedDict -from .tag_update_list_param import TagUpdateListParam - __all__ = ["FloatingIPCreateParams"] @@ -29,7 +27,7 @@ class FloatingIPCreateParams(TypedDict, total=False): "$.components.schemas.CreateFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" """ - metadata: TagUpdateListParam + metadata: Dict[str, str] """ '#/components/schemas/CreateFloatingIPSerializer/properties/metadata' "$.components.schemas.CreateFloatingIPSerializer.properties.metadata" diff --git a/src/gcore/types/cloud/tag_update_list_param.py b/src/gcore/types/cloud/tag_update_list_param.py deleted file mode 100644 index 0479c357..00000000 --- a/src/gcore/types/cloud/tag_update_list_param.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict -from typing_extensions import TypeAlias - -__all__ = ["TagUpdateListParam"] - -TagUpdateListParam: TypeAlias = Dict[str, str] diff --git a/src/gcore/types/cloud/volume_create_params.py b/src/gcore/types/cloud/volume_create_params.py index 643674e6..56aeb345 100644 --- a/src/gcore/types/cloud/volume_create_params.py +++ b/src/gcore/types/cloud/volume_create_params.py @@ -2,11 +2,9 @@ from __future__ import annotations -from typing import Union, Iterable +from typing import Dict, Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .tag_update_list_param import TagUpdateListParam - __all__ = [ "VolumeCreateParams", "CreateVolumeFromImageSerializer", @@ -70,7 +68,7 @@ class CreateVolumeFromImageSerializer(TypedDict, total=False): "$.components.schemas.CreateVolumeFromImageSerializer.properties.lifecycle_policy_ids" """ - metadata: TagUpdateListParam + metadata: Dict[str, str] """ '#/components/schemas/CreateVolumeFromImageSerializer/properties/metadata' "$.components.schemas.CreateVolumeFromImageSerializer.properties.metadata" @@ -132,7 +130,7 @@ class CreateVolumeFromSnapshotSerializer(TypedDict, total=False): "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.lifecycle_policy_ids" """ - metadata: TagUpdateListParam + metadata: Dict[str, str] """ '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/metadata' "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.metadata" @@ -200,7 +198,7 @@ class CreateNewVolumeSerializer(TypedDict, total=False): "$.components.schemas.CreateNewVolumeSerializer.properties.lifecycle_policy_ids" """ - metadata: TagUpdateListParam + metadata: Dict[str, str] """ '#/components/schemas/CreateNewVolumeSerializer/properties/metadata' "$.components.schemas.CreateNewVolumeSerializer.properties.metadata" diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index a53b0a9a..137d3c2f 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -36,7 +36,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, fixed_ip_address="192.168.10.15", - metadata={"foo": "my-tag-value"}, + metadata={"my-tag": "my-tag-value"}, port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) @@ -330,7 +330,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> project_id=1, region_id=1, fixed_ip_address="192.168.10.15", - metadata={"foo": "my-tag-value"}, + metadata={"my-tag": "my-tag-value"}, port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) From 38fd149d6458ed29707ab7be301deebc3d3dcc6b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 11:20:12 +0000 Subject: [PATCH 064/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 21ad7752..68bb0e9d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 81 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e39804de8b5c320a8015dcde593be93e8df2c35f99be4c48bf75d4ab0ba7ab3a.yml openapi_spec_hash: 9f7283a11935ecc054fc2d00f9c5ade1 -config_hash: 63718a5516558d684de630b38e2b72f1 +config_hash: d5cf3aff2803ced6a2d744a6cb9f50e2 From 43e92bd15c2b09b4a3900aedce7c0d62d34dbc21 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 16:08:47 +0000 Subject: [PATCH 065/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 68bb0e9d..956546d7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e39804de8b5c320a8015dcde593be93e8df2c35f99be4c48bf75d4ab0ba7ab3a.yml -openapi_spec_hash: 9f7283a11935ecc054fc2d00f9c5ade1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-72685b3225ad5f13b3803ccdba56ef933c8fea4883069c3230001ff6e3da24bf.yml +openapi_spec_hash: f8426a896f6b42b4fd028a4b3724e522 config_hash: d5cf3aff2803ced6a2d744a6cb9f50e2 From af6020f822f418ea843e4015c3435c2fecb309e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 11:30:57 +0000 Subject: [PATCH 066/592] GCLOUD2-18566 Add cloud images for baremetal and instances --- .stats.yml | 4 +- api.md | 23 + src/gcore/resources/cloud/__init__.py | 28 + .../resources/cloud/baremetal/__init__.py | 33 + .../resources/cloud/baremetal/baremetal.py | 102 ++ src/gcore/resources/cloud/baremetal/images.py | 255 ++++ src/gcore/resources/cloud/cloud.py | 64 + .../resources/cloud/instances/__init__.py | 33 + src/gcore/resources/cloud/instances/images.py | 1166 +++++++++++++++++ .../resources/cloud/instances/instances.py | 102 ++ src/gcore/types/cloud/__init__.py | 2 + src/gcore/types/cloud/baremetal/__init__.py | 5 + .../cloud/baremetal/image_list_params.py | 51 + src/gcore/types/cloud/image.py | 203 +++ src/gcore/types/cloud/image_list.py | 22 + src/gcore/types/cloud/instances/__init__.py | 9 + .../image_create_from_volume_params.py | 82 ++ .../types/cloud/instances/image_get_params.py | 51 + .../cloud/instances/image_list_params.py | 51 + .../cloud/instances/image_update_params.py | 64 + .../cloud/instances/image_upload_params.py | 94 ++ .../api_resources/cloud/baremetal/__init__.py | 1 + .../cloud/baremetal/test_images.py | 116 ++ .../api_resources/cloud/instances/__init__.py | 1 + .../cloud/instances/test_images.py | 688 ++++++++++ 25 files changed, 3248 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/baremetal/__init__.py create mode 100644 src/gcore/resources/cloud/baremetal/baremetal.py create mode 100644 src/gcore/resources/cloud/baremetal/images.py create mode 100644 src/gcore/resources/cloud/instances/__init__.py create mode 100644 src/gcore/resources/cloud/instances/images.py create mode 100644 src/gcore/resources/cloud/instances/instances.py create mode 100644 src/gcore/types/cloud/baremetal/__init__.py create mode 100644 src/gcore/types/cloud/baremetal/image_list_params.py create mode 100644 src/gcore/types/cloud/image.py create mode 100644 src/gcore/types/cloud/image_list.py create mode 100644 src/gcore/types/cloud/instances/__init__.py create mode 100644 src/gcore/types/cloud/instances/image_create_from_volume_params.py create mode 100644 src/gcore/types/cloud/instances/image_get_params.py create mode 100644 src/gcore/types/cloud/instances/image_list_params.py create mode 100644 src/gcore/types/cloud/instances/image_update_params.py create mode 100644 src/gcore/types/cloud/instances/image_upload_params.py create mode 100644 tests/api_resources/cloud/baremetal/__init__.py create mode 100644 tests/api_resources/cloud/baremetal/test_images.py create mode 100644 tests/api_resources/cloud/instances/__init__.py create mode 100644 tests/api_resources/cloud/instances/test_images.py diff --git a/.stats.yml b/.stats.yml index 956546d7..81cd75ed 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 81 +configured_endpoints: 88 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-72685b3225ad5f13b3803ccdba56ef933c8fea4883069c3230001ff6e3da24bf.yml openapi_spec_hash: f8426a896f6b42b4fd028a4b3724e522 -config_hash: d5cf3aff2803ced6a2d744a6cb9f50e2 +config_hash: 55db419b5f75fc0d2db24bef0860a449 diff --git a/api.md b/api.md index 63ea251c..4747d0fc 100644 --- a/api.md +++ b/api.md @@ -15,6 +15,8 @@ from gcore.types.cloud import ( FlavorHardwareDescription, FloatingIP, FloatingIPStatus, + Image, + ImageList, InstanceMetricsTimeUnit, InterfaceIPFamily, IPVersion, @@ -289,3 +291,24 @@ Methods: - client.cloud.security_groups.rules.create(group_id, \*, project_id, region_id, \*\*params) -> SecurityGroupRule - client.cloud.security_groups.rules.delete(rule_id, \*, project_id, region_id) -> None - client.cloud.security_groups.rules.replace(rule_id, \*, project_id, region_id, \*\*params) -> SecurityGroupRule + +## Baremetal + +### Images + +Methods: + +- client.cloud.baremetal.images.list(\*, project_id, region_id, \*\*params) -> ImageList + +## Instances + +### Images + +Methods: + +- client.cloud.instances.images.update(image_id, \*, project_id, region_id, \*\*params) -> Image +- client.cloud.instances.images.list(\*, project_id, region_id, \*\*params) -> ImageList +- client.cloud.instances.images.delete(image_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.instances.images.create_from_volume(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.images.get(image_id, \*, project_id, region_id, \*\*params) -> Image +- client.cloud.instances.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 9bee3f78..0a641b4d 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -72,6 +72,22 @@ SSHKeysResourceWithStreamingResponse, AsyncSSHKeysResourceWithStreamingResponse, ) +from .baremetal import ( + BaremetalResource, + AsyncBaremetalResource, + BaremetalResourceWithRawResponse, + AsyncBaremetalResourceWithRawResponse, + BaremetalResourceWithStreamingResponse, + AsyncBaremetalResourceWithStreamingResponse, +) +from .instances import ( + InstancesResource, + AsyncInstancesResource, + InstancesResourceWithRawResponse, + AsyncInstancesResourceWithRawResponse, + InstancesResourceWithStreamingResponse, + AsyncInstancesResourceWithStreamingResponse, +) from .ip_ranges import ( IPRangesResource, AsyncIPRangesResource, @@ -178,6 +194,18 @@ "AsyncSecurityGroupsResourceWithRawResponse", "SecurityGroupsResourceWithStreamingResponse", "AsyncSecurityGroupsResourceWithStreamingResponse", + "BaremetalResource", + "AsyncBaremetalResource", + "BaremetalResourceWithRawResponse", + "AsyncBaremetalResourceWithRawResponse", + "BaremetalResourceWithStreamingResponse", + "AsyncBaremetalResourceWithStreamingResponse", + "InstancesResource", + "AsyncInstancesResource", + "InstancesResourceWithRawResponse", + "AsyncInstancesResourceWithRawResponse", + "InstancesResourceWithStreamingResponse", + "AsyncInstancesResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/baremetal/__init__.py b/src/gcore/resources/cloud/baremetal/__init__.py new file mode 100644 index 00000000..150c8353 --- /dev/null +++ b/src/gcore/resources/cloud/baremetal/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .images import ( + ImagesResource, + AsyncImagesResource, + ImagesResourceWithRawResponse, + AsyncImagesResourceWithRawResponse, + ImagesResourceWithStreamingResponse, + AsyncImagesResourceWithStreamingResponse, +) +from .baremetal import ( + BaremetalResource, + AsyncBaremetalResource, + BaremetalResourceWithRawResponse, + AsyncBaremetalResourceWithRawResponse, + BaremetalResourceWithStreamingResponse, + AsyncBaremetalResourceWithStreamingResponse, +) + +__all__ = [ + "ImagesResource", + "AsyncImagesResource", + "ImagesResourceWithRawResponse", + "AsyncImagesResourceWithRawResponse", + "ImagesResourceWithStreamingResponse", + "AsyncImagesResourceWithStreamingResponse", + "BaremetalResource", + "AsyncBaremetalResource", + "BaremetalResourceWithRawResponse", + "AsyncBaremetalResourceWithRawResponse", + "BaremetalResourceWithStreamingResponse", + "AsyncBaremetalResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/baremetal/baremetal.py b/src/gcore/resources/cloud/baremetal/baremetal.py new file mode 100644 index 00000000..d5c41832 --- /dev/null +++ b/src/gcore/resources/cloud/baremetal/baremetal.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .images import ( + ImagesResource, + AsyncImagesResource, + ImagesResourceWithRawResponse, + AsyncImagesResourceWithRawResponse, + ImagesResourceWithStreamingResponse, + AsyncImagesResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["BaremetalResource", "AsyncBaremetalResource"] + + +class BaremetalResource(SyncAPIResource): + @cached_property + def images(self) -> ImagesResource: + return ImagesResource(self._client) + + @cached_property + def with_raw_response(self) -> BaremetalResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return BaremetalResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BaremetalResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return BaremetalResourceWithStreamingResponse(self) + + +class AsyncBaremetalResource(AsyncAPIResource): + @cached_property + def images(self) -> AsyncImagesResource: + return AsyncImagesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncBaremetalResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncBaremetalResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBaremetalResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncBaremetalResourceWithStreamingResponse(self) + + +class BaremetalResourceWithRawResponse: + def __init__(self, baremetal: BaremetalResource) -> None: + self._baremetal = baremetal + + @cached_property + def images(self) -> ImagesResourceWithRawResponse: + return ImagesResourceWithRawResponse(self._baremetal.images) + + +class AsyncBaremetalResourceWithRawResponse: + def __init__(self, baremetal: AsyncBaremetalResource) -> None: + self._baremetal = baremetal + + @cached_property + def images(self) -> AsyncImagesResourceWithRawResponse: + return AsyncImagesResourceWithRawResponse(self._baremetal.images) + + +class BaremetalResourceWithStreamingResponse: + def __init__(self, baremetal: BaremetalResource) -> None: + self._baremetal = baremetal + + @cached_property + def images(self) -> ImagesResourceWithStreamingResponse: + return ImagesResourceWithStreamingResponse(self._baremetal.images) + + +class AsyncBaremetalResourceWithStreamingResponse: + def __init__(self, baremetal: AsyncBaremetalResource) -> None: + self._baremetal = baremetal + + @cached_property + def images(self) -> AsyncImagesResourceWithStreamingResponse: + return AsyncImagesResourceWithStreamingResponse(self._baremetal.images) diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py new file mode 100644 index 00000000..bbb4ec3c --- /dev/null +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -0,0 +1,255 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.baremetal import image_list_params +from ....types.cloud.image_list import ImageList + +__all__ = ["ImagesResource", "AsyncImagesResource"] + + +class ImagesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ImagesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return ImagesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ImagesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return ImagesResourceWithStreamingResponse(self) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + include_prices: bool | NotGiven = NOT_GIVEN, + metadata_k: str | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + private: str | NotGiven = NOT_GIVEN, + visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ImageList: + """Retrieve the available images list for bare metal servers. + + Returned entities may + or may not be owned by the project + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[1].schema" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[2]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[3]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[4]" + + private: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[5]" + + visibility: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[6]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get( + f"/cloud/v1/bmimages/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "include_prices": include_prices, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "private": private, + "visibility": visibility, + }, + image_list_params.ImageListParams, + ), + ), + cast_to=ImageList, + ) + + +class AsyncImagesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncImagesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncImagesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncImagesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncImagesResourceWithStreamingResponse(self) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + include_prices: bool | NotGiven = NOT_GIVEN, + metadata_k: str | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + private: str | NotGiven = NOT_GIVEN, + visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ImageList: + """Retrieve the available images list for bare metal servers. + + Returned entities may + or may not be owned by the project + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[1].schema" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[2]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[3]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[4]" + + private: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[5]" + + visibility: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[6]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._get( + f"/cloud/v1/bmimages/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "include_prices": include_prices, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "private": private, + "visibility": visibility, + }, + image_list_params.ImageListParams, + ), + ), + cast_to=ImageList, + ) + + +class ImagesResourceWithRawResponse: + def __init__(self, images: ImagesResource) -> None: + self._images = images + + self.list = to_raw_response_wrapper( + images.list, + ) + + +class AsyncImagesResourceWithRawResponse: + def __init__(self, images: AsyncImagesResource) -> None: + self._images = images + + self.list = async_to_raw_response_wrapper( + images.list, + ) + + +class ImagesResourceWithStreamingResponse: + def __init__(self, images: ImagesResource) -> None: + self._images = images + + self.list = to_streamed_response_wrapper( + images.list, + ) + + +class AsyncImagesResourceWithStreamingResponse: + def __init__(self, images: AsyncImagesResource) -> None: + self._images = images + + self.list = async_to_streamed_response_wrapper( + images.list, + ) diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index b48a8e2d..f56e9958 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -84,6 +84,22 @@ NetworksResourceWithStreamingResponse, AsyncNetworksResourceWithStreamingResponse, ) +from .baremetal.baremetal import ( + BaremetalResource, + AsyncBaremetalResource, + BaremetalResourceWithRawResponse, + AsyncBaremetalResourceWithRawResponse, + BaremetalResourceWithStreamingResponse, + AsyncBaremetalResourceWithStreamingResponse, +) +from .instances.instances import ( + InstancesResource, + AsyncInstancesResource, + InstancesResourceWithRawResponse, + AsyncInstancesResourceWithRawResponse, + InstancesResourceWithStreamingResponse, + AsyncInstancesResourceWithStreamingResponse, +) from .security_groups.security_groups import ( SecurityGroupsResource, AsyncSecurityGroupsResource, @@ -153,6 +169,14 @@ def floating_ips(self) -> FloatingIPsResource: def security_groups(self) -> SecurityGroupsResource: return SecurityGroupsResource(self._client) + @cached_property + def baremetal(self) -> BaremetalResource: + return BaremetalResource(self._client) + + @cached_property + def instances(self) -> InstancesResource: + return InstancesResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -222,6 +246,14 @@ def floating_ips(self) -> AsyncFloatingIPsResource: def security_groups(self) -> AsyncSecurityGroupsResource: return AsyncSecurityGroupsResource(self._client) + @cached_property + def baremetal(self) -> AsyncBaremetalResource: + return AsyncBaremetalResource(self._client) + + @cached_property + def instances(self) -> AsyncInstancesResource: + return AsyncInstancesResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -294,6 +326,14 @@ def floating_ips(self) -> FloatingIPsResourceWithRawResponse: def security_groups(self) -> SecurityGroupsResourceWithRawResponse: return SecurityGroupsResourceWithRawResponse(self._cloud.security_groups) + @cached_property + def baremetal(self) -> BaremetalResourceWithRawResponse: + return BaremetalResourceWithRawResponse(self._cloud.baremetal) + + @cached_property + def instances(self) -> InstancesResourceWithRawResponse: + return InstancesResourceWithRawResponse(self._cloud.instances) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -347,6 +387,14 @@ def floating_ips(self) -> AsyncFloatingIPsResourceWithRawResponse: def security_groups(self) -> AsyncSecurityGroupsResourceWithRawResponse: return AsyncSecurityGroupsResourceWithRawResponse(self._cloud.security_groups) + @cached_property + def baremetal(self) -> AsyncBaremetalResourceWithRawResponse: + return AsyncBaremetalResourceWithRawResponse(self._cloud.baremetal) + + @cached_property + def instances(self) -> AsyncInstancesResourceWithRawResponse: + return AsyncInstancesResourceWithRawResponse(self._cloud.instances) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -400,6 +448,14 @@ def floating_ips(self) -> FloatingIPsResourceWithStreamingResponse: def security_groups(self) -> SecurityGroupsResourceWithStreamingResponse: return SecurityGroupsResourceWithStreamingResponse(self._cloud.security_groups) + @cached_property + def baremetal(self) -> BaremetalResourceWithStreamingResponse: + return BaremetalResourceWithStreamingResponse(self._cloud.baremetal) + + @cached_property + def instances(self) -> InstancesResourceWithStreamingResponse: + return InstancesResourceWithStreamingResponse(self._cloud.instances) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -452,3 +508,11 @@ def floating_ips(self) -> AsyncFloatingIPsResourceWithStreamingResponse: @cached_property def security_groups(self) -> AsyncSecurityGroupsResourceWithStreamingResponse: return AsyncSecurityGroupsResourceWithStreamingResponse(self._cloud.security_groups) + + @cached_property + def baremetal(self) -> AsyncBaremetalResourceWithStreamingResponse: + return AsyncBaremetalResourceWithStreamingResponse(self._cloud.baremetal) + + @cached_property + def instances(self) -> AsyncInstancesResourceWithStreamingResponse: + return AsyncInstancesResourceWithStreamingResponse(self._cloud.instances) diff --git a/src/gcore/resources/cloud/instances/__init__.py b/src/gcore/resources/cloud/instances/__init__.py new file mode 100644 index 00000000..daab9fa0 --- /dev/null +++ b/src/gcore/resources/cloud/instances/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .images import ( + ImagesResource, + AsyncImagesResource, + ImagesResourceWithRawResponse, + AsyncImagesResourceWithRawResponse, + ImagesResourceWithStreamingResponse, + AsyncImagesResourceWithStreamingResponse, +) +from .instances import ( + InstancesResource, + AsyncInstancesResource, + InstancesResourceWithRawResponse, + AsyncInstancesResourceWithRawResponse, + InstancesResourceWithStreamingResponse, + AsyncInstancesResourceWithStreamingResponse, +) + +__all__ = [ + "ImagesResource", + "AsyncImagesResource", + "ImagesResourceWithRawResponse", + "AsyncImagesResourceWithRawResponse", + "ImagesResourceWithStreamingResponse", + "AsyncImagesResourceWithStreamingResponse", + "InstancesResource", + "AsyncInstancesResource", + "InstancesResourceWithRawResponse", + "AsyncInstancesResourceWithRawResponse", + "InstancesResourceWithStreamingResponse", + "AsyncInstancesResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py new file mode 100644 index 00000000..5d23a014 --- /dev/null +++ b/src/gcore/resources/cloud/instances/images.py @@ -0,0 +1,1166 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.image import Image +from ....types.cloud.instances import ( + image_get_params, + image_list_params, + image_update_params, + image_upload_params, + image_create_from_volume_params, +) +from ....types.cloud.image_list import ImageList +from ....types.cloud.task_id_list import TaskIDList + +__all__ = ["ImagesResource", "AsyncImagesResource"] + + +class ImagesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ImagesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return ImagesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ImagesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return ImagesResourceWithStreamingResponse(self) + + def update( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, + hw_machine_type: Literal["i440", "q35"] | NotGiven = NOT_GIVEN, + is_baremetal: Optional[bool] | NotGiven = NOT_GIVEN, + metadata: object | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, + ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Image: + """ + Update image fields + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[1].schema" + + image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[2].schema" + + hw_firmware_type: '#/components/schemas/UpdateImageSchema/properties/hw_firmware_type' + "$.components.schemas.UpdateImageSchema.properties.hw_firmware_type" + + hw_machine_type: '#/components/schemas/UpdateImageSchema/properties/hw_machine_type' + "$.components.schemas.UpdateImageSchema.properties.hw_machine_type" + + is_baremetal: '#/components/schemas/UpdateImageSchema/properties/is_baremetal' + "$.components.schemas.UpdateImageSchema.properties.is_baremetal" + + metadata: '#/components/schemas/UpdateImageSchema/properties/metadata' + "$.components.schemas.UpdateImageSchema.properties.metadata" + + name: '#/components/schemas/UpdateImageSchema/properties/name' + "$.components.schemas.UpdateImageSchema.properties.name" + + os_type: '#/components/schemas/UpdateImageSchema/properties/os_type' + "$.components.schemas.UpdateImageSchema.properties.os_type" + + ssh_key: '#/components/schemas/UpdateImageSchema/properties/ssh_key' + "$.components.schemas.UpdateImageSchema.properties.ssh_key" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return self._patch( + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + body=maybe_transform( + { + "hw_firmware_type": hw_firmware_type, + "hw_machine_type": hw_machine_type, + "is_baremetal": is_baremetal, + "metadata": metadata, + "name": name, + "os_type": os_type, + "ssh_key": ssh_key, + }, + image_update_params.ImageUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Image, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + include_prices: bool | NotGiven = NOT_GIVEN, + metadata_k: str | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + private: str | NotGiven = NOT_GIVEN, + visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ImageList: + """Retrieve an available images list. + + Returned entities owned by the project and + public OR shared with the client + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[1].schema" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[2]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[3]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[4]" + + private: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[5]" + + visibility: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[6]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get( + f"/cloud/v1/images/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "include_prices": include_prices, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "private": private, + "visibility": visibility, + }, + image_list_params.ImageListParams, + ), + ), + cast_to=ImageList, + ) + + def delete( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete the image + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}']['delete'].parameters[1].schema" + + image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return self._delete( + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def create_from_volume( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + volume_id: str, + architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, + hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, + hw_machine_type: Literal["i440", "q35"] | NotGiven = NOT_GIVEN, + is_baremetal: Optional[bool] | NotGiven = NOT_GIVEN, + metadata: object | NotGiven = NOT_GIVEN, + os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, + source: str | NotGiven = NOT_GIVEN, + ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create image + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/ImageCreateSchema/properties/name' + "$.components.schemas.ImageCreateSchema.properties.name" + + volume_id: '#/components/schemas/ImageCreateSchema/properties/volume_id' + "$.components.schemas.ImageCreateSchema.properties.volume_id" + + architecture: '#/components/schemas/ImageCreateSchema/properties/architecture' + "$.components.schemas.ImageCreateSchema.properties.architecture" + + hw_firmware_type: '#/components/schemas/ImageCreateSchema/properties/hw_firmware_type' + "$.components.schemas.ImageCreateSchema.properties.hw_firmware_type" + + hw_machine_type: '#/components/schemas/ImageCreateSchema/properties/hw_machine_type' + "$.components.schemas.ImageCreateSchema.properties.hw_machine_type" + + is_baremetal: '#/components/schemas/ImageCreateSchema/properties/is_baremetal' + "$.components.schemas.ImageCreateSchema.properties.is_baremetal" + + metadata: '#/components/schemas/ImageCreateSchema/properties/metadata' + "$.components.schemas.ImageCreateSchema.properties.metadata" + + os_type: '#/components/schemas/ImageCreateSchema/properties/os_type' + "$.components.schemas.ImageCreateSchema.properties.os_type" + + source: '#/components/schemas/ImageCreateSchema/properties/source' + "$.components.schemas.ImageCreateSchema.properties.source" + + ssh_key: '#/components/schemas/ImageCreateSchema/properties/ssh_key' + "$.components.schemas.ImageCreateSchema.properties.ssh_key" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._post( + f"/cloud/v1/images/{project_id}/{region_id}", + body=maybe_transform( + { + "name": name, + "volume_id": volume_id, + "architecture": architecture, + "hw_firmware_type": hw_firmware_type, + "hw_machine_type": hw_machine_type, + "is_baremetal": is_baremetal, + "metadata": metadata, + "os_type": os_type, + "source": source, + "ssh_key": ssh_key, + }, + image_create_from_volume_params.ImageCreateFromVolumeParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + include_prices: bool | NotGiven = NOT_GIVEN, + metadata_k: str | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + private: str | NotGiven = NOT_GIVEN, + visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Image: + """ + Get image + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[1].schema" + + image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[2].schema" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/3' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[3]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/4' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[4]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/5' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[5]" + + private: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/6' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[6]" + + visibility: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/7' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[7]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return self._get( + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "include_prices": include_prices, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "private": private, + "visibility": visibility, + }, + image_get_params.ImageGetParams, + ), + ), + cast_to=Image, + ) + + def upload( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + url: str, + architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, + cow_format: bool | NotGiven = NOT_GIVEN, + hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, + hw_machine_type: Literal["i440", "q35"] | NotGiven = NOT_GIVEN, + is_baremetal: Optional[bool] | NotGiven = NOT_GIVEN, + metadata: object | NotGiven = NOT_GIVEN, + os_distro: str | NotGiven = NOT_GIVEN, + os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, + os_version: str | NotGiven = NOT_GIVEN, + ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Upload image + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/ImageDownloadSchema/properties/name' + "$.components.schemas.ImageDownloadSchema.properties.name" + + url: '#/components/schemas/ImageDownloadSchema/properties/url' + "$.components.schemas.ImageDownloadSchema.properties.url" + + architecture: '#/components/schemas/ImageDownloadSchema/properties/architecture' + "$.components.schemas.ImageDownloadSchema.properties.architecture" + + cow_format: '#/components/schemas/ImageDownloadSchema/properties/cow_format' + "$.components.schemas.ImageDownloadSchema.properties.cow_format" + + hw_firmware_type: '#/components/schemas/ImageDownloadSchema/properties/hw_firmware_type' + "$.components.schemas.ImageDownloadSchema.properties.hw_firmware_type" + + hw_machine_type: '#/components/schemas/ImageDownloadSchema/properties/hw_machine_type' + "$.components.schemas.ImageDownloadSchema.properties.hw_machine_type" + + is_baremetal: '#/components/schemas/ImageDownloadSchema/properties/is_baremetal' + "$.components.schemas.ImageDownloadSchema.properties.is_baremetal" + + metadata: '#/components/schemas/ImageDownloadSchema/properties/metadata' + "$.components.schemas.ImageDownloadSchema.properties.metadata" + + os_distro: '#/components/schemas/ImageDownloadSchema/properties/os_distro' + "$.components.schemas.ImageDownloadSchema.properties.os_distro" + + os_type: '#/components/schemas/ImageDownloadSchema/properties/os_type' + "$.components.schemas.ImageDownloadSchema.properties.os_type" + + os_version: '#/components/schemas/ImageDownloadSchema/properties/os_version' + "$.components.schemas.ImageDownloadSchema.properties.os_version" + + ssh_key: '#/components/schemas/ImageDownloadSchema/properties/ssh_key' + "$.components.schemas.ImageDownloadSchema.properties.ssh_key" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._post( + f"/cloud/v1/downloadimage/{project_id}/{region_id}", + body=maybe_transform( + { + "name": name, + "url": url, + "architecture": architecture, + "cow_format": cow_format, + "hw_firmware_type": hw_firmware_type, + "hw_machine_type": hw_machine_type, + "is_baremetal": is_baremetal, + "metadata": metadata, + "os_distro": os_distro, + "os_type": os_type, + "os_version": os_version, + "ssh_key": ssh_key, + }, + image_upload_params.ImageUploadParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncImagesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncImagesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncImagesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncImagesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncImagesResourceWithStreamingResponse(self) + + async def update( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, + hw_machine_type: Literal["i440", "q35"] | NotGiven = NOT_GIVEN, + is_baremetal: Optional[bool] | NotGiven = NOT_GIVEN, + metadata: object | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, + ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Image: + """ + Update image fields + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[1].schema" + + image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[2].schema" + + hw_firmware_type: '#/components/schemas/UpdateImageSchema/properties/hw_firmware_type' + "$.components.schemas.UpdateImageSchema.properties.hw_firmware_type" + + hw_machine_type: '#/components/schemas/UpdateImageSchema/properties/hw_machine_type' + "$.components.schemas.UpdateImageSchema.properties.hw_machine_type" + + is_baremetal: '#/components/schemas/UpdateImageSchema/properties/is_baremetal' + "$.components.schemas.UpdateImageSchema.properties.is_baremetal" + + metadata: '#/components/schemas/UpdateImageSchema/properties/metadata' + "$.components.schemas.UpdateImageSchema.properties.metadata" + + name: '#/components/schemas/UpdateImageSchema/properties/name' + "$.components.schemas.UpdateImageSchema.properties.name" + + os_type: '#/components/schemas/UpdateImageSchema/properties/os_type' + "$.components.schemas.UpdateImageSchema.properties.os_type" + + ssh_key: '#/components/schemas/UpdateImageSchema/properties/ssh_key' + "$.components.schemas.UpdateImageSchema.properties.ssh_key" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return await self._patch( + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + body=await async_maybe_transform( + { + "hw_firmware_type": hw_firmware_type, + "hw_machine_type": hw_machine_type, + "is_baremetal": is_baremetal, + "metadata": metadata, + "name": name, + "os_type": os_type, + "ssh_key": ssh_key, + }, + image_update_params.ImageUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Image, + ) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + include_prices: bool | NotGiven = NOT_GIVEN, + metadata_k: str | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + private: str | NotGiven = NOT_GIVEN, + visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ImageList: + """Retrieve an available images list. + + Returned entities owned by the project and + public OR shared with the client + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[1].schema" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[2]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[3]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[4]" + + private: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[5]" + + visibility: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[6]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._get( + f"/cloud/v1/images/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "include_prices": include_prices, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "private": private, + "visibility": visibility, + }, + image_list_params.ImageListParams, + ), + ), + cast_to=ImageList, + ) + + async def delete( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete the image + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}']['delete'].parameters[1].schema" + + image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return await self._delete( + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def create_from_volume( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + volume_id: str, + architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, + hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, + hw_machine_type: Literal["i440", "q35"] | NotGiven = NOT_GIVEN, + is_baremetal: Optional[bool] | NotGiven = NOT_GIVEN, + metadata: object | NotGiven = NOT_GIVEN, + os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, + source: str | NotGiven = NOT_GIVEN, + ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create image + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/ImageCreateSchema/properties/name' + "$.components.schemas.ImageCreateSchema.properties.name" + + volume_id: '#/components/schemas/ImageCreateSchema/properties/volume_id' + "$.components.schemas.ImageCreateSchema.properties.volume_id" + + architecture: '#/components/schemas/ImageCreateSchema/properties/architecture' + "$.components.schemas.ImageCreateSchema.properties.architecture" + + hw_firmware_type: '#/components/schemas/ImageCreateSchema/properties/hw_firmware_type' + "$.components.schemas.ImageCreateSchema.properties.hw_firmware_type" + + hw_machine_type: '#/components/schemas/ImageCreateSchema/properties/hw_machine_type' + "$.components.schemas.ImageCreateSchema.properties.hw_machine_type" + + is_baremetal: '#/components/schemas/ImageCreateSchema/properties/is_baremetal' + "$.components.schemas.ImageCreateSchema.properties.is_baremetal" + + metadata: '#/components/schemas/ImageCreateSchema/properties/metadata' + "$.components.schemas.ImageCreateSchema.properties.metadata" + + os_type: '#/components/schemas/ImageCreateSchema/properties/os_type' + "$.components.schemas.ImageCreateSchema.properties.os_type" + + source: '#/components/schemas/ImageCreateSchema/properties/source' + "$.components.schemas.ImageCreateSchema.properties.source" + + ssh_key: '#/components/schemas/ImageCreateSchema/properties/ssh_key' + "$.components.schemas.ImageCreateSchema.properties.ssh_key" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._post( + f"/cloud/v1/images/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "name": name, + "volume_id": volume_id, + "architecture": architecture, + "hw_firmware_type": hw_firmware_type, + "hw_machine_type": hw_machine_type, + "is_baremetal": is_baremetal, + "metadata": metadata, + "os_type": os_type, + "source": source, + "ssh_key": ssh_key, + }, + image_create_from_volume_params.ImageCreateFromVolumeParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + include_prices: bool | NotGiven = NOT_GIVEN, + metadata_k: str | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + private: str | NotGiven = NOT_GIVEN, + visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Image: + """ + Get image + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[1].schema" + + image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[2].schema" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/3' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[3]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/4' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[4]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/5' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[5]" + + private: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/6' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[6]" + + visibility: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/7' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[7]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return await self._get( + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "include_prices": include_prices, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "private": private, + "visibility": visibility, + }, + image_get_params.ImageGetParams, + ), + ), + cast_to=Image, + ) + + async def upload( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + url: str, + architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, + cow_format: bool | NotGiven = NOT_GIVEN, + hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, + hw_machine_type: Literal["i440", "q35"] | NotGiven = NOT_GIVEN, + is_baremetal: Optional[bool] | NotGiven = NOT_GIVEN, + metadata: object | NotGiven = NOT_GIVEN, + os_distro: str | NotGiven = NOT_GIVEN, + os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, + os_version: str | NotGiven = NOT_GIVEN, + ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Upload image + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/ImageDownloadSchema/properties/name' + "$.components.schemas.ImageDownloadSchema.properties.name" + + url: '#/components/schemas/ImageDownloadSchema/properties/url' + "$.components.schemas.ImageDownloadSchema.properties.url" + + architecture: '#/components/schemas/ImageDownloadSchema/properties/architecture' + "$.components.schemas.ImageDownloadSchema.properties.architecture" + + cow_format: '#/components/schemas/ImageDownloadSchema/properties/cow_format' + "$.components.schemas.ImageDownloadSchema.properties.cow_format" + + hw_firmware_type: '#/components/schemas/ImageDownloadSchema/properties/hw_firmware_type' + "$.components.schemas.ImageDownloadSchema.properties.hw_firmware_type" + + hw_machine_type: '#/components/schemas/ImageDownloadSchema/properties/hw_machine_type' + "$.components.schemas.ImageDownloadSchema.properties.hw_machine_type" + + is_baremetal: '#/components/schemas/ImageDownloadSchema/properties/is_baremetal' + "$.components.schemas.ImageDownloadSchema.properties.is_baremetal" + + metadata: '#/components/schemas/ImageDownloadSchema/properties/metadata' + "$.components.schemas.ImageDownloadSchema.properties.metadata" + + os_distro: '#/components/schemas/ImageDownloadSchema/properties/os_distro' + "$.components.schemas.ImageDownloadSchema.properties.os_distro" + + os_type: '#/components/schemas/ImageDownloadSchema/properties/os_type' + "$.components.schemas.ImageDownloadSchema.properties.os_type" + + os_version: '#/components/schemas/ImageDownloadSchema/properties/os_version' + "$.components.schemas.ImageDownloadSchema.properties.os_version" + + ssh_key: '#/components/schemas/ImageDownloadSchema/properties/ssh_key' + "$.components.schemas.ImageDownloadSchema.properties.ssh_key" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._post( + f"/cloud/v1/downloadimage/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "name": name, + "url": url, + "architecture": architecture, + "cow_format": cow_format, + "hw_firmware_type": hw_firmware_type, + "hw_machine_type": hw_machine_type, + "is_baremetal": is_baremetal, + "metadata": metadata, + "os_distro": os_distro, + "os_type": os_type, + "os_version": os_version, + "ssh_key": ssh_key, + }, + image_upload_params.ImageUploadParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class ImagesResourceWithRawResponse: + def __init__(self, images: ImagesResource) -> None: + self._images = images + + self.update = to_raw_response_wrapper( + images.update, + ) + self.list = to_raw_response_wrapper( + images.list, + ) + self.delete = to_raw_response_wrapper( + images.delete, + ) + self.create_from_volume = to_raw_response_wrapper( + images.create_from_volume, + ) + self.get = to_raw_response_wrapper( + images.get, + ) + self.upload = to_raw_response_wrapper( + images.upload, + ) + + +class AsyncImagesResourceWithRawResponse: + def __init__(self, images: AsyncImagesResource) -> None: + self._images = images + + self.update = async_to_raw_response_wrapper( + images.update, + ) + self.list = async_to_raw_response_wrapper( + images.list, + ) + self.delete = async_to_raw_response_wrapper( + images.delete, + ) + self.create_from_volume = async_to_raw_response_wrapper( + images.create_from_volume, + ) + self.get = async_to_raw_response_wrapper( + images.get, + ) + self.upload = async_to_raw_response_wrapper( + images.upload, + ) + + +class ImagesResourceWithStreamingResponse: + def __init__(self, images: ImagesResource) -> None: + self._images = images + + self.update = to_streamed_response_wrapper( + images.update, + ) + self.list = to_streamed_response_wrapper( + images.list, + ) + self.delete = to_streamed_response_wrapper( + images.delete, + ) + self.create_from_volume = to_streamed_response_wrapper( + images.create_from_volume, + ) + self.get = to_streamed_response_wrapper( + images.get, + ) + self.upload = to_streamed_response_wrapper( + images.upload, + ) + + +class AsyncImagesResourceWithStreamingResponse: + def __init__(self, images: AsyncImagesResource) -> None: + self._images = images + + self.update = async_to_streamed_response_wrapper( + images.update, + ) + self.list = async_to_streamed_response_wrapper( + images.list, + ) + self.delete = async_to_streamed_response_wrapper( + images.delete, + ) + self.create_from_volume = async_to_streamed_response_wrapper( + images.create_from_volume, + ) + self.get = async_to_streamed_response_wrapper( + images.get, + ) + self.upload = async_to_streamed_response_wrapper( + images.upload, + ) diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py new file mode 100644 index 00000000..5f0f44c1 --- /dev/null +++ b/src/gcore/resources/cloud/instances/instances.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .images import ( + ImagesResource, + AsyncImagesResource, + ImagesResourceWithRawResponse, + AsyncImagesResourceWithRawResponse, + ImagesResourceWithStreamingResponse, + AsyncImagesResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["InstancesResource", "AsyncInstancesResource"] + + +class InstancesResource(SyncAPIResource): + @cached_property + def images(self) -> ImagesResource: + return ImagesResource(self._client) + + @cached_property + def with_raw_response(self) -> InstancesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return InstancesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InstancesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return InstancesResourceWithStreamingResponse(self) + + +class AsyncInstancesResource(AsyncAPIResource): + @cached_property + def images(self) -> AsyncImagesResource: + return AsyncImagesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncInstancesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncInstancesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInstancesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncInstancesResourceWithStreamingResponse(self) + + +class InstancesResourceWithRawResponse: + def __init__(self, instances: InstancesResource) -> None: + self._instances = instances + + @cached_property + def images(self) -> ImagesResourceWithRawResponse: + return ImagesResourceWithRawResponse(self._instances.images) + + +class AsyncInstancesResourceWithRawResponse: + def __init__(self, instances: AsyncInstancesResource) -> None: + self._instances = instances + + @cached_property + def images(self) -> AsyncImagesResourceWithRawResponse: + return AsyncImagesResourceWithRawResponse(self._instances.images) + + +class InstancesResourceWithStreamingResponse: + def __init__(self, instances: InstancesResource) -> None: + self._instances = instances + + @cached_property + def images(self) -> ImagesResourceWithStreamingResponse: + return ImagesResourceWithStreamingResponse(self._instances.images) + + +class AsyncInstancesResourceWithStreamingResponse: + def __init__(self, instances: AsyncInstancesResource) -> None: + self._instances = instances + + @cached_property + def images(self) -> AsyncImagesResourceWithStreamingResponse: + return AsyncImagesResourceWithStreamingResponse(self._instances.images) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 15d7c798..596bc420 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -4,6 +4,7 @@ from .tag import Tag as Tag from .task import Task as Task +from .image import Image as Image from .region import Region as Region from .secret import Secret as Secret from .subnet import Subnet as Subnet @@ -12,6 +13,7 @@ from .project import Project as Project from .ssh_key import SSHKey as SSHKey from .ip_ranges import IPRanges as IPRanges +from .image_list import ImageList as ImageList from .ip_version import IPVersion as IPVersion from .floating_ip import FloatingIP as FloatingIP from .ddos_profile import DDOSProfile as DDOSProfile diff --git a/src/gcore/types/cloud/baremetal/__init__.py b/src/gcore/types/cloud/baremetal/__init__.py new file mode 100644 index 00000000..f4bc0da0 --- /dev/null +++ b/src/gcore/types/cloud/baremetal/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .image_list_params import ImageListParams as ImageListParams diff --git a/src/gcore/types/cloud/baremetal/image_list_params.py b/src/gcore/types/cloud/baremetal/image_list_params.py new file mode 100644 index 00000000..81cc9d35 --- /dev/null +++ b/src/gcore/types/cloud/baremetal/image_list_params.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["ImageListParams"] + + +class ImageListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + include_prices: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[2]" + """ + + metadata_k: str + """ + '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[3]" + """ + + metadata_kv: str + """ + '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[4]" + """ + + private: str + """ + '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[5]" + """ + + visibility: Literal["private", "public", "shared"] + """ + '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[6]" + """ diff --git a/src/gcore/types/cloud/image.py b/src/gcore/types/cloud/image.py new file mode 100644 index 00000000..3cdac041 --- /dev/null +++ b/src/gcore/types/cloud/image.py @@ -0,0 +1,203 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Image"] + + +class Image(BaseModel): + name: str + """ + '#/components/schemas/ImageSchema/properties/name' + "$.components.schemas.ImageSchema.properties.name" + """ + + id: Optional[str] = None + """ + '#/components/schemas/ImageSchema/properties/id' + "$.components.schemas.ImageSchema.properties.id" + """ + + architecture: Optional[Literal["aarch64", "x86_64"]] = None + """ + '#/components/schemas/ImageSchema/properties/architecture' + "$.components.schemas.ImageSchema.properties.architecture" + """ + + created_at: Optional[datetime] = None + """ + '#/components/schemas/ImageSchema/properties/created_at' + "$.components.schemas.ImageSchema.properties.created_at" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/ImageSchema/properties/creator_task_id' + "$.components.schemas.ImageSchema.properties.creator_task_id" + """ + + currency_code: Optional[str] = None + """ + '#/components/schemas/ImageSchema/properties/currency_code' + "$.components.schemas.ImageSchema.properties.currency_code" + """ + + description: Optional[str] = None + """ + '#/components/schemas/ImageSchema/properties/description' + "$.components.schemas.ImageSchema.properties.description" + """ + + disk_format: Optional[str] = None + """ + '#/components/schemas/ImageSchema/properties/disk_format' + "$.components.schemas.ImageSchema.properties.disk_format" + """ + + display_order: Optional[int] = None + """ + '#/components/schemas/ImageSchema/properties/display_order' + "$.components.schemas.ImageSchema.properties.display_order" + """ + + hw_firmware_type: Optional[Literal["bios", "uefi"]] = None + """ + '#/components/schemas/ImageSchema/properties/hw_firmware_type' + "$.components.schemas.ImageSchema.properties.hw_firmware_type" + """ + + hw_machine_type: Optional[Literal["i440", "q35"]] = None + """ + '#/components/schemas/ImageSchema/properties/hw_machine_type' + "$.components.schemas.ImageSchema.properties.hw_machine_type" + """ + + internally_shared: Optional[bool] = None + """ + '#/components/schemas/ImageSchema/properties/internally_shared' + "$.components.schemas.ImageSchema.properties.internally_shared" + """ + + is_baremetal: Optional[bool] = None + """ + '#/components/schemas/ImageSchema/properties/is_baremetal' + "$.components.schemas.ImageSchema.properties.is_baremetal" + """ + + metadata: Optional[object] = None + """ + '#/components/schemas/ImageSchema/properties/metadata' + "$.components.schemas.ImageSchema.properties.metadata" + """ + + metadata_detailed: Optional[object] = None + """ + '#/components/schemas/ImageSchema/properties/metadata_detailed' + "$.components.schemas.ImageSchema.properties.metadata_detailed" + """ + + min_disk: Optional[int] = None + """ + '#/components/schemas/ImageSchema/properties/min_disk' + "$.components.schemas.ImageSchema.properties.min_disk" + """ + + min_ram: Optional[int] = None + """ + '#/components/schemas/ImageSchema/properties/min_ram' + "$.components.schemas.ImageSchema.properties.min_ram" + """ + + os_distro: Optional[str] = None + """ + '#/components/schemas/ImageSchema/properties/os_distro' + "$.components.schemas.ImageSchema.properties.os_distro" + """ + + os_type: Optional[Literal["linux", "windows"]] = None + """ + '#/components/schemas/ImageSchema/properties/os_type' + "$.components.schemas.ImageSchema.properties.os_type" + """ + + os_version: Optional[str] = None + """ + '#/components/schemas/ImageSchema/properties/os_version' + "$.components.schemas.ImageSchema.properties.os_version" + """ + + price_per_hour: Optional[float] = None + """ + '#/components/schemas/ImageSchema/properties/price_per_hour' + "$.components.schemas.ImageSchema.properties.price_per_hour" + """ + + price_per_month: Optional[float] = None + """ + '#/components/schemas/ImageSchema/properties/price_per_month' + "$.components.schemas.ImageSchema.properties.price_per_month" + """ + + price_status: Optional[Literal["error", "hide", "show"]] = None + """ + '#/components/schemas/ImageSchema/properties/price_status' + "$.components.schemas.ImageSchema.properties.price_status" + """ + + project_id: Optional[int] = None + """ + '#/components/schemas/ImageSchema/properties/project_id' + "$.components.schemas.ImageSchema.properties.project_id" + """ + + region: Optional[str] = None + """ + '#/components/schemas/ImageSchema/properties/region' + "$.components.schemas.ImageSchema.properties.region" + """ + + region_id: Optional[int] = None + """ + '#/components/schemas/ImageSchema/properties/region_id' + "$.components.schemas.ImageSchema.properties.region_id" + """ + + size: Optional[int] = None + """ + '#/components/schemas/ImageSchema/properties/size' + "$.components.schemas.ImageSchema.properties.size" + """ + + ssh_key: Optional[Literal["allow", "deny", "required"]] = None + """ + '#/components/schemas/ImageSchema/properties/ssh_key' + "$.components.schemas.ImageSchema.properties.ssh_key" + """ + + status: Optional[str] = None + """ + '#/components/schemas/ImageSchema/properties/status' + "$.components.schemas.ImageSchema.properties.status" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/ImageSchema/properties/task_id' + "$.components.schemas.ImageSchema.properties.task_id" + """ + + updated_at: Optional[datetime] = None + """ + '#/components/schemas/ImageSchema/properties/updated_at' + "$.components.schemas.ImageSchema.properties.updated_at" + """ + + visibility: Optional[str] = None + """ + '#/components/schemas/ImageSchema/properties/visibility' + "$.components.schemas.ImageSchema.properties.visibility" + """ diff --git a/src/gcore/types/cloud/image_list.py b/src/gcore/types/cloud/image_list.py new file mode 100644 index 00000000..00e34cea --- /dev/null +++ b/src/gcore/types/cloud/image_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .image import Image +from ..._models import BaseModel + +__all__ = ["ImageList"] + + +class ImageList(BaseModel): + count: Optional[int] = None + """ + '#/components/schemas/ImageListSchema/properties/count' + "$.components.schemas.ImageListSchema.properties.count" + """ + + results: Optional[List[Image]] = None + """ + '#/components/schemas/ImageListSchema/properties/results' + "$.components.schemas.ImageListSchema.properties.results" + """ diff --git a/src/gcore/types/cloud/instances/__init__.py b/src/gcore/types/cloud/instances/__init__.py new file mode 100644 index 00000000..060c3b69 --- /dev/null +++ b/src/gcore/types/cloud/instances/__init__.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .image_get_params import ImageGetParams as ImageGetParams +from .image_list_params import ImageListParams as ImageListParams +from .image_update_params import ImageUpdateParams as ImageUpdateParams +from .image_upload_params import ImageUploadParams as ImageUploadParams +from .image_create_from_volume_params import ImageCreateFromVolumeParams as ImageCreateFromVolumeParams diff --git a/src/gcore/types/cloud/instances/image_create_from_volume_params.py b/src/gcore/types/cloud/instances/image_create_from_volume_params.py new file mode 100644 index 00000000..2e8ed137 --- /dev/null +++ b/src/gcore/types/cloud/instances/image_create_from_volume_params.py @@ -0,0 +1,82 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ImageCreateFromVolumeParams"] + + +class ImageCreateFromVolumeParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/ImageCreateSchema/properties/name' + "$.components.schemas.ImageCreateSchema.properties.name" + """ + + volume_id: Required[str] + """ + '#/components/schemas/ImageCreateSchema/properties/volume_id' + "$.components.schemas.ImageCreateSchema.properties.volume_id" + """ + + architecture: Literal["aarch64", "x86_64"] + """ + '#/components/schemas/ImageCreateSchema/properties/architecture' + "$.components.schemas.ImageCreateSchema.properties.architecture" + """ + + hw_firmware_type: Literal["bios", "uefi"] + """ + '#/components/schemas/ImageCreateSchema/properties/hw_firmware_type' + "$.components.schemas.ImageCreateSchema.properties.hw_firmware_type" + """ + + hw_machine_type: Literal["i440", "q35"] + """ + '#/components/schemas/ImageCreateSchema/properties/hw_machine_type' + "$.components.schemas.ImageCreateSchema.properties.hw_machine_type" + """ + + is_baremetal: Optional[bool] + """ + '#/components/schemas/ImageCreateSchema/properties/is_baremetal' + "$.components.schemas.ImageCreateSchema.properties.is_baremetal" + """ + + metadata: object + """ + '#/components/schemas/ImageCreateSchema/properties/metadata' + "$.components.schemas.ImageCreateSchema.properties.metadata" + """ + + os_type: Literal["linux", "windows"] + """ + '#/components/schemas/ImageCreateSchema/properties/os_type' + "$.components.schemas.ImageCreateSchema.properties.os_type" + """ + + source: str + """ + '#/components/schemas/ImageCreateSchema/properties/source' + "$.components.schemas.ImageCreateSchema.properties.source" + """ + + ssh_key: Literal["allow", "deny", "required"] + """ + '#/components/schemas/ImageCreateSchema/properties/ssh_key' + "$.components.schemas.ImageCreateSchema.properties.ssh_key" + """ diff --git a/src/gcore/types/cloud/instances/image_get_params.py b/src/gcore/types/cloud/instances/image_get_params.py new file mode 100644 index 00000000..dc700d19 --- /dev/null +++ b/src/gcore/types/cloud/instances/image_get_params.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["ImageGetParams"] + + +class ImageGetParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[1].schema" + """ + + include_prices: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/3' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[3]" + """ + + metadata_k: str + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/4' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[4]" + """ + + metadata_kv: str + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/5' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[5]" + """ + + private: str + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/6' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[6]" + """ + + visibility: Literal["private", "public", "shared"] + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/7' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[7]" + """ diff --git a/src/gcore/types/cloud/instances/image_list_params.py b/src/gcore/types/cloud/instances/image_list_params.py new file mode 100644 index 00000000..900f2523 --- /dev/null +++ b/src/gcore/types/cloud/instances/image_list_params.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["ImageListParams"] + + +class ImageListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + include_prices: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[2]" + """ + + metadata_k: str + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[3]" + """ + + metadata_kv: str + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[4]" + """ + + private: str + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[5]" + """ + + visibility: Literal["private", "public", "shared"] + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[6]" + """ diff --git a/src/gcore/types/cloud/instances/image_update_params.py b/src/gcore/types/cloud/instances/image_update_params.py new file mode 100644 index 00000000..95b5eae3 --- /dev/null +++ b/src/gcore/types/cloud/instances/image_update_params.py @@ -0,0 +1,64 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["ImageUpdateParams"] + + +class ImageUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[1].schema" + """ + + hw_firmware_type: Literal["bios", "uefi"] + """ + '#/components/schemas/UpdateImageSchema/properties/hw_firmware_type' + "$.components.schemas.UpdateImageSchema.properties.hw_firmware_type" + """ + + hw_machine_type: Literal["i440", "q35"] + """ + '#/components/schemas/UpdateImageSchema/properties/hw_machine_type' + "$.components.schemas.UpdateImageSchema.properties.hw_machine_type" + """ + + is_baremetal: Optional[bool] + """ + '#/components/schemas/UpdateImageSchema/properties/is_baremetal' + "$.components.schemas.UpdateImageSchema.properties.is_baremetal" + """ + + metadata: object + """ + '#/components/schemas/UpdateImageSchema/properties/metadata' + "$.components.schemas.UpdateImageSchema.properties.metadata" + """ + + name: str + """ + '#/components/schemas/UpdateImageSchema/properties/name' + "$.components.schemas.UpdateImageSchema.properties.name" + """ + + os_type: Literal["linux", "windows"] + """ + '#/components/schemas/UpdateImageSchema/properties/os_type' + "$.components.schemas.UpdateImageSchema.properties.os_type" + """ + + ssh_key: Literal["allow", "deny", "required"] + """ + '#/components/schemas/UpdateImageSchema/properties/ssh_key' + "$.components.schemas.UpdateImageSchema.properties.ssh_key" + """ diff --git a/src/gcore/types/cloud/instances/image_upload_params.py b/src/gcore/types/cloud/instances/image_upload_params.py new file mode 100644 index 00000000..ae6af248 --- /dev/null +++ b/src/gcore/types/cloud/instances/image_upload_params.py @@ -0,0 +1,94 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ImageUploadParams"] + + +class ImageUploadParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/ImageDownloadSchema/properties/name' + "$.components.schemas.ImageDownloadSchema.properties.name" + """ + + url: Required[str] + """ + '#/components/schemas/ImageDownloadSchema/properties/url' + "$.components.schemas.ImageDownloadSchema.properties.url" + """ + + architecture: Literal["aarch64", "x86_64"] + """ + '#/components/schemas/ImageDownloadSchema/properties/architecture' + "$.components.schemas.ImageDownloadSchema.properties.architecture" + """ + + cow_format: bool + """ + '#/components/schemas/ImageDownloadSchema/properties/cow_format' + "$.components.schemas.ImageDownloadSchema.properties.cow_format" + """ + + hw_firmware_type: Literal["bios", "uefi"] + """ + '#/components/schemas/ImageDownloadSchema/properties/hw_firmware_type' + "$.components.schemas.ImageDownloadSchema.properties.hw_firmware_type" + """ + + hw_machine_type: Literal["i440", "q35"] + """ + '#/components/schemas/ImageDownloadSchema/properties/hw_machine_type' + "$.components.schemas.ImageDownloadSchema.properties.hw_machine_type" + """ + + is_baremetal: Optional[bool] + """ + '#/components/schemas/ImageDownloadSchema/properties/is_baremetal' + "$.components.schemas.ImageDownloadSchema.properties.is_baremetal" + """ + + metadata: object + """ + '#/components/schemas/ImageDownloadSchema/properties/metadata' + "$.components.schemas.ImageDownloadSchema.properties.metadata" + """ + + os_distro: str + """ + '#/components/schemas/ImageDownloadSchema/properties/os_distro' + "$.components.schemas.ImageDownloadSchema.properties.os_distro" + """ + + os_type: Literal["linux", "windows"] + """ + '#/components/schemas/ImageDownloadSchema/properties/os_type' + "$.components.schemas.ImageDownloadSchema.properties.os_type" + """ + + os_version: str + """ + '#/components/schemas/ImageDownloadSchema/properties/os_version' + "$.components.schemas.ImageDownloadSchema.properties.os_version" + """ + + ssh_key: Literal["allow", "deny", "required"] + """ + '#/components/schemas/ImageDownloadSchema/properties/ssh_key' + "$.components.schemas.ImageDownloadSchema.properties.ssh_key" + """ diff --git a/tests/api_resources/cloud/baremetal/__init__.py b/tests/api_resources/cloud/baremetal/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/baremetal/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/baremetal/test_images.py b/tests/api_resources/cloud/baremetal/test_images.py new file mode 100644 index 00000000..f9223c4b --- /dev/null +++ b/tests/api_resources/cloud/baremetal/test_images.py @@ -0,0 +1,116 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import ImageList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestImages: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + image = client.cloud.baremetal.images.list( + project_id=0, + region_id=0, + ) + assert_matches_type(ImageList, image, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + image = client.cloud.baremetal.images.list( + project_id=0, + region_id=0, + include_prices=True, + metadata_k="metadata_k", + metadata_kv="metadata_kv", + private="private", + visibility="private", + ) + assert_matches_type(ImageList, image, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.baremetal.images.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(ImageList, image, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.baremetal.images.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(ImageList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncImages: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.baremetal.images.list( + project_id=0, + region_id=0, + ) + assert_matches_type(ImageList, image, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.baremetal.images.list( + project_id=0, + region_id=0, + include_prices=True, + metadata_k="metadata_k", + metadata_kv="metadata_kv", + private="private", + visibility="private", + ) + assert_matches_type(ImageList, image, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.baremetal.images.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(ImageList, image, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.baremetal.images.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(ImageList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/instances/__init__.py b/tests/api_resources/cloud/instances/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/instances/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/instances/test_images.py b/tests/api_resources/cloud/instances/test_images.py new file mode 100644 index 00000000..82328d35 --- /dev/null +++ b/tests/api_resources/cloud/instances/test_images.py @@ -0,0 +1,688 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import Image, ImageList, TaskIDList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestImages: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Gcore) -> None: + image = client.cloud.instances.images.update( + image_id="image_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Image, image, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + image = client.cloud.instances.images.update( + image_id="image_id", + project_id=0, + region_id=0, + hw_firmware_type="bios", + hw_machine_type="i440", + is_baremetal=True, + metadata={}, + name="string", + os_type="linux", + ssh_key="allow", + ) + assert_matches_type(Image, image, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.instances.images.with_raw_response.update( + image_id="image_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(Image, image, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.instances.images.with_streaming_response.update( + image_id="image_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(Image, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + client.cloud.instances.images.with_raw_response.update( + image_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + image = client.cloud.instances.images.list( + project_id=0, + region_id=0, + ) + assert_matches_type(ImageList, image, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + image = client.cloud.instances.images.list( + project_id=0, + region_id=0, + include_prices=True, + metadata_k="metadata_k", + metadata_kv="metadata_kv", + private="private", + visibility="private", + ) + assert_matches_type(ImageList, image, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.instances.images.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(ImageList, image, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.instances.images.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(ImageList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + image = client.cloud.instances.images.delete( + image_id="image_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.instances.images.with_raw_response.delete( + image_id="image_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.instances.images.with_streaming_response.delete( + image_id="image_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + client.cloud.instances.images.with_raw_response.delete( + image_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_create_from_volume(self, client: Gcore) -> None: + image = client.cloud.instances.images.create_from_volume( + project_id=0, + region_id=0, + name="test_image", + volume_id="d478ae29-dedc-4869-82f0-96104425f565", + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_method_create_from_volume_with_all_params(self, client: Gcore) -> None: + image = client.cloud.instances.images.create_from_volume( + project_id=0, + region_id=0, + name="test_image", + volume_id="d478ae29-dedc-4869-82f0-96104425f565", + architecture="x86_64", + hw_firmware_type="bios", + hw_machine_type="q35", + is_baremetal=False, + metadata={"key": "value"}, + os_type="linux", + source="volume", + ssh_key="allow", + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_raw_response_create_from_volume(self, client: Gcore) -> None: + response = client.cloud.instances.images.with_raw_response.create_from_volume( + project_id=0, + region_id=0, + name="test_image", + volume_id="d478ae29-dedc-4869-82f0-96104425f565", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_streaming_response_create_from_volume(self, client: Gcore) -> None: + with client.cloud.instances.images.with_streaming_response.create_from_volume( + project_id=0, + region_id=0, + name="test_image", + volume_id="d478ae29-dedc-4869-82f0-96104425f565", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + image = client.cloud.instances.images.get( + image_id="image_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Image, image, path=["response"]) + + @parametrize + def test_method_get_with_all_params(self, client: Gcore) -> None: + image = client.cloud.instances.images.get( + image_id="image_id", + project_id=0, + region_id=0, + include_prices=True, + metadata_k="metadata_k", + metadata_kv="metadata_kv", + private="private", + visibility="private", + ) + assert_matches_type(Image, image, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.instances.images.with_raw_response.get( + image_id="image_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(Image, image, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.instances.images.with_streaming_response.get( + image_id="image_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(Image, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + client.cloud.instances.images.with_raw_response.get( + image_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_upload(self, client: Gcore) -> None: + image = client.cloud.instances.images.upload( + project_id=0, + region_id=0, + name="image_name", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_method_upload_with_all_params(self, client: Gcore) -> None: + image = client.cloud.instances.images.upload( + project_id=0, + region_id=0, + name="image_name", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + architecture="x86_64", + cow_format=False, + hw_firmware_type="bios", + hw_machine_type="q35", + is_baremetal=False, + metadata={"key": "value"}, + os_distro="os_distro", + os_type="linux", + os_version="os_version", + ssh_key="allow", + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_raw_response_upload(self, client: Gcore) -> None: + response = client.cloud.instances.images.with_raw_response.upload( + project_id=0, + region_id=0, + name="image_name", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_streaming_response_upload(self, client: Gcore) -> None: + with client.cloud.instances.images.with_streaming_response.upload( + project_id=0, + region_id=0, + name="image_name", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncImages: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.instances.images.update( + image_id="image_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Image, image, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.instances.images.update( + image_id="image_id", + project_id=0, + region_id=0, + hw_firmware_type="bios", + hw_machine_type="i440", + is_baremetal=True, + metadata={}, + name="string", + os_type="linux", + ssh_key="allow", + ) + assert_matches_type(Image, image, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.images.with_raw_response.update( + image_id="image_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(Image, image, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.images.with_streaming_response.update( + image_id="image_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(Image, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + await async_client.cloud.instances.images.with_raw_response.update( + image_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.instances.images.list( + project_id=0, + region_id=0, + ) + assert_matches_type(ImageList, image, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.instances.images.list( + project_id=0, + region_id=0, + include_prices=True, + metadata_k="metadata_k", + metadata_kv="metadata_kv", + private="private", + visibility="private", + ) + assert_matches_type(ImageList, image, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.images.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(ImageList, image, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.images.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(ImageList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.instances.images.delete( + image_id="image_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.images.with_raw_response.delete( + image_id="image_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.images.with_streaming_response.delete( + image_id="image_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + await async_client.cloud.instances.images.with_raw_response.delete( + image_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_create_from_volume(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.instances.images.create_from_volume( + project_id=0, + region_id=0, + name="test_image", + volume_id="d478ae29-dedc-4869-82f0-96104425f565", + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_method_create_from_volume_with_all_params(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.instances.images.create_from_volume( + project_id=0, + region_id=0, + name="test_image", + volume_id="d478ae29-dedc-4869-82f0-96104425f565", + architecture="x86_64", + hw_firmware_type="bios", + hw_machine_type="q35", + is_baremetal=False, + metadata={"key": "value"}, + os_type="linux", + source="volume", + ssh_key="allow", + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_raw_response_create_from_volume(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.images.with_raw_response.create_from_volume( + project_id=0, + region_id=0, + name="test_image", + volume_id="d478ae29-dedc-4869-82f0-96104425f565", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_streaming_response_create_from_volume(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.images.with_streaming_response.create_from_volume( + project_id=0, + region_id=0, + name="test_image", + volume_id="d478ae29-dedc-4869-82f0-96104425f565", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.instances.images.get( + image_id="image_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Image, image, path=["response"]) + + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.instances.images.get( + image_id="image_id", + project_id=0, + region_id=0, + include_prices=True, + metadata_k="metadata_k", + metadata_kv="metadata_kv", + private="private", + visibility="private", + ) + assert_matches_type(Image, image, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.images.with_raw_response.get( + image_id="image_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(Image, image, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.images.with_streaming_response.get( + image_id="image_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(Image, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + await async_client.cloud.instances.images.with_raw_response.get( + image_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_upload(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.instances.images.upload( + project_id=0, + region_id=0, + name="image_name", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.instances.images.upload( + project_id=0, + region_id=0, + name="image_name", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + architecture="x86_64", + cow_format=False, + hw_firmware_type="bios", + hw_machine_type="q35", + is_baremetal=False, + metadata={"key": "value"}, + os_distro="os_distro", + os_type="linux", + os_version="os_version", + ssh_key="allow", + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_raw_response_upload(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.images.with_raw_response.upload( + project_id=0, + region_id=0, + name="image_name", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_streaming_response_upload(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.images.with_streaming_response.upload( + project_id=0, + region_id=0, + name="image_name", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True From a54e62662f33ae79052b220a3955863239ac6820 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 09:25:58 +0000 Subject: [PATCH 067/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 7 +- src/gcore/resources/cloud/networks/routers.py | 9 +- src/gcore/resources/cloud/networks/subnets.py | 9 +- src/gcore/resources/cloud/quotas/requests.py | 24 +- src/gcore/types/cloud/__init__.py | 2 - src/gcore/types/cloud/floating_ip_detailed.py | 37 +- src/gcore/types/cloud/load_balancer.py | 22 +- src/gcore/types/cloud/networks/router.py | 26 +- .../cloud/networks/router_create_params.py | 19 +- .../cloud/networks/router_update_params.py | 20 +- .../cloud/networks/subnet_create_params.py | 19 +- .../cloud/networks/subnet_update_params.py | 22 +- src/gcore/types/cloud/neutron_route.py | 19 - src/gcore/types/cloud/neutron_route_param.py | 21 - src/gcore/types/cloud/quotas/__init__.py | 1 + .../cloud/quotas/request_list_response.py | 394 ++++++++++++++++++ src/gcore/types/cloud/subnet.py | 19 +- src/gcore/types/cloud/volume.py | 1 + .../cloud/quotas/test_requests.py | 19 +- 20 files changed, 555 insertions(+), 139 deletions(-) delete mode 100644 src/gcore/types/cloud/neutron_route.py delete mode 100644 src/gcore/types/cloud/neutron_route_param.py create mode 100644 src/gcore/types/cloud/quotas/request_list_response.py diff --git a/.stats.yml b/.stats.yml index 81cd75ed..81289190 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 88 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-72685b3225ad5f13b3803ccdba56ef933c8fea4883069c3230001ff6e3da24bf.yml -openapi_spec_hash: f8426a896f6b42b4fd028a4b3724e522 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7dc53a8ce0e8691975b00337faf79d130814c518bd2678a6c54a1603ede12331.yml +openapi_spec_hash: ea94cdbb22dfb693d9044f23f631fb1a config_hash: 55db419b5f75fc0d2db24bef0860a449 diff --git a/api.md b/api.md index 4747d0fc..52bdce9a 100644 --- a/api.md +++ b/api.md @@ -4,7 +4,6 @@ Types: ```python from gcore.types.cloud import ( - BaremetalFlavorList, Console, DDOSProfile, DDOSProfileField, @@ -26,8 +25,6 @@ from gcore.types.cloud import ( LoadBalancerOperatingStatus, LoadBalancerStatistics, Network, - NeutronRoute, - PortList, ProvisioningStatus, Subnet, Tag, @@ -99,13 +96,13 @@ Methods: Types: ```python -from gcore.types.cloud.quotas import RequestGetResponse +from gcore.types.cloud.quotas import RequestListResponse, RequestGetResponse ``` Methods: - client.cloud.quotas.requests.create(\*\*params) -> None -- client.cloud.quotas.requests.list(\*\*params) -> None +- client.cloud.quotas.requests.list(\*\*params) -> SyncOffsetPage[RequestListResponse] - client.cloud.quotas.requests.delete(request_id) -> None - client.cloud.quotas.requests.get(request_id) -> RequestGetResponse diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 4f42131b..ba41b13b 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -27,7 +27,6 @@ ) from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.networks.router import Router -from ....types.cloud.neutron_route_param import NeutronRouteParam __all__ = ["RoutersResource", "AsyncRoutersResource"] @@ -60,7 +59,7 @@ def create( name: str, external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, interfaces: Optional[Iterable[router_create_params.Interface]] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[router_create_params.Route]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -127,7 +126,7 @@ def update( region_id: int | None = None, external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[router_update_params.Route]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -479,7 +478,7 @@ async def create( name: str, external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, interfaces: Optional[Iterable[router_create_params.Interface]] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[router_create_params.Route]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -546,7 +545,7 @@ async def update( region_id: int | None = None, external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[router_update_params.Route]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index c2066910..5c619b21 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -24,7 +24,6 @@ from ....types.cloud.networks import subnet_list_params, subnet_create_params, subnet_update_params from ....types.cloud.ip_version import IPVersion from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.neutron_route_param import NeutronRouteParam __all__ = ["SubnetsResource", "AsyncSubnetsResource"] @@ -61,7 +60,7 @@ def create( dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, enable_dhcp: bool | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, @@ -160,7 +159,7 @@ def update( dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -454,7 +453,7 @@ async def create( dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, enable_dhcp: bool | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, @@ -553,7 +552,7 @@ async def update( dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index fc98fc3b..eefc7328 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -17,9 +17,11 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.quotas import request_list_params, request_create_params from ....types.cloud.quotas.request_get_response import RequestGetResponse +from ....types.cloud.quotas.request_list_response import RequestListResponse __all__ = ["RequestsResource", "AsyncRequestsResource"] @@ -107,7 +109,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: + ) -> SyncOffsetPage[RequestListResponse]: """ Returns a list of sent requests to change current quotas and their statuses @@ -129,9 +131,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._get( + return self._get_api_list( "/cloud/v2/limits_request", + page=SyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -146,7 +148,7 @@ def list( request_list_params.RequestListParams, ), ), - cast_to=NoneType, + model=RequestListResponse, ) def delete( @@ -294,7 +296,7 @@ async def create( cast_to=NoneType, ) - async def list( + def list( self, *, limit: int | NotGiven = NOT_GIVEN, @@ -306,7 +308,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: + ) -> AsyncPaginator[RequestListResponse, AsyncOffsetPage[RequestListResponse]]: """ Returns a list of sent requests to change current quotas and their statuses @@ -328,15 +330,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._get( + return self._get_api_list( "/cloud/v2/limits_request", + page=AsyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "limit": limit, "offset": offset, @@ -345,7 +347,7 @@ async def list( request_list_params.RequestListParams, ), ), - cast_to=NoneType, + model=RequestListResponse, ) async def delete( diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 596bc420..b4622f2a 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -19,7 +19,6 @@ from .ddos_profile import DDOSProfile as DDOSProfile from .task_id_list import TaskIDList as TaskIDList from .load_balancer import LoadBalancer as LoadBalancer -from .neutron_route import NeutronRoute as NeutronRoute from .security_group import SecurityGroup as SecurityGroup from .ssh_key_created import SSHKeyCreated as SSHKeyCreated from .task_list_params import TaskListParams as TaskListParams @@ -31,7 +30,6 @@ from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .network_list_params import NetworkListParams as NetworkListParams -from .neutron_route_param import NeutronRouteParam as NeutronRouteParam from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus from .security_group_rule import SecurityGroupRule as SecurityGroupRule diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index 738b9ae9..c9013de2 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -13,8 +13,7 @@ "FloatingIPDetailed", "Instance", "InstanceAddress", - "InstanceAddressSimpleAddressSerializer", - "InstanceAddressAddressInterfaceSerializer", + "InstanceAddressAddressSerializer", "InstanceAddressAddressDetailedSerializer", "InstanceFlavor", "InstanceSecurityGroup", @@ -22,37 +21,23 @@ ] -class InstanceAddressSimpleAddressSerializer(BaseModel): +class InstanceAddressAddressSerializer(BaseModel): addr: str """ - '#/components/schemas/SimpleAddressSerializer/properties/addr' - "$.components.schemas.SimpleAddressSerializer.properties.addr" - """ - - type: str - """ - '#/components/schemas/SimpleAddressSerializer/properties/type' - "$.components.schemas.SimpleAddressSerializer.properties.type" - """ - - -class InstanceAddressAddressInterfaceSerializer(BaseModel): - addr: str - """ - '#/components/schemas/AddressInterfaceSerializer/properties/addr' - "$.components.schemas.AddressInterfaceSerializer.properties.addr" + '#/components/schemas/AddressSerializer/properties/addr' + "$.components.schemas.AddressSerializer.properties.addr" """ interface_name: Optional[str] = None """ - '#/components/schemas/AddressInterfaceSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.AddressInterfaceSerializer.properties.interface_name.anyOf[0]" + '#/components/schemas/AddressSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.AddressSerializer.properties.interface_name.anyOf[0]" """ type: str """ - '#/components/schemas/AddressInterfaceSerializer/properties/type' - "$.components.schemas.AddressInterfaceSerializer.properties.type" + '#/components/schemas/AddressSerializer/properties/type' + "$.components.schemas.AddressSerializer.properties.type" """ @@ -88,11 +73,7 @@ class InstanceAddressAddressDetailedSerializer(BaseModel): """ -InstanceAddress: TypeAlias = Union[ - InstanceAddressSimpleAddressSerializer, - InstanceAddressAddressInterfaceSerializer, - InstanceAddressAddressDetailedSerializer, -] +InstanceAddress: TypeAlias = Union[InstanceAddressAddressSerializer, InstanceAddressAddressDetailedSerializer] class InstanceFlavor(BaseModel): diff --git a/src/gcore/types/cloud/load_balancer.py b/src/gcore/types/cloud/load_balancer.py index 58077913..b883c3b4 100644 --- a/src/gcore/types/cloud/load_balancer.py +++ b/src/gcore/types/cloud/load_balancer.py @@ -76,26 +76,26 @@ class LoggingRetentionPolicy(BaseModel): class Logging(BaseModel): destination_region_id: Optional[int] = None """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/destination_region_id/anyOf/0' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.destination_region_id.anyOf[0]" + '#/components/schemas/LoggingOutSerializer/properties/destination_region_id/anyOf/0' + "$.components.schemas.LoggingOutSerializer.properties.destination_region_id.anyOf[0]" """ - enabled: Optional[bool] = None + enabled: bool """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/enabled' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.enabled" + '#/components/schemas/LoggingOutSerializer/properties/enabled' + "$.components.schemas.LoggingOutSerializer.properties.enabled" """ - retention_policy: Optional[LoggingRetentionPolicy] = None + topic_name: Optional[str] = None """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/retention_policy/anyOf/0' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.retention_policy.anyOf[0]" + '#/components/schemas/LoggingOutSerializer/properties/topic_name/anyOf/0' + "$.components.schemas.LoggingOutSerializer.properties.topic_name.anyOf[0]" """ - topic_name: Optional[str] = None + retention_policy: Optional[LoggingRetentionPolicy] = None """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/topic_name/anyOf/0' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.topic_name.anyOf[0]" + '#/components/schemas/LoggingOutSerializer/properties/retention_policy/anyOf/0' + "$.components.schemas.LoggingOutSerializer.properties.retention_policy.anyOf[0]" """ diff --git a/src/gcore/types/cloud/networks/router.py b/src/gcore/types/cloud/networks/router.py index dfe2fb5f..53a33e9a 100644 --- a/src/gcore/types/cloud/networks/router.py +++ b/src/gcore/types/cloud/networks/router.py @@ -4,9 +4,15 @@ from datetime import datetime from ...._models import BaseModel -from ..neutron_route import NeutronRoute -__all__ = ["Router", "Interface", "InterfaceIPAssignment", "ExternalGatewayInfo", "ExternalGatewayInfoExternalFixedIP"] +__all__ = [ + "Router", + "Interface", + "InterfaceIPAssignment", + "Route", + "ExternalGatewayInfo", + "ExternalGatewayInfoExternalFixedIP", +] class InterfaceIPAssignment(BaseModel): @@ -49,6 +55,20 @@ class Interface(BaseModel): """ +class Route(BaseModel): + destination: str + """ + '#/components/schemas/RouteOutSerializer/properties/destination' + "$.components.schemas.RouteOutSerializer.properties.destination" + """ + + nexthop: str + """ + '#/components/schemas/RouteOutSerializer/properties/nexthop' + "$.components.schemas.RouteOutSerializer.properties.nexthop" + """ + + class ExternalGatewayInfoExternalFixedIP(BaseModel): ip_address: str """ @@ -132,7 +152,7 @@ class Router(BaseModel): "$.components.schemas.RouterSerializer.properties.region_id" """ - routes: List[NeutronRoute] + routes: List[Route] """ '#/components/schemas/RouterSerializer/properties/routes' "$.components.schemas.RouterSerializer.properties.routes" diff --git a/src/gcore/types/cloud/networks/router_create_params.py b/src/gcore/types/cloud/networks/router_create_params.py index b47d07a6..b0422a10 100644 --- a/src/gcore/types/cloud/networks/router_create_params.py +++ b/src/gcore/types/cloud/networks/router_create_params.py @@ -5,14 +5,13 @@ from typing import Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict -from ..neutron_route_param import NeutronRouteParam - __all__ = [ "RouterCreateParams", "ExternalGatewayInfo", "ExternalGatewayInfoRouterExternalManualGwSerializer", "ExternalGatewayInfoRouterExternalDefaultGwSerializer", "Interface", + "Route", ] @@ -47,7 +46,7 @@ class RouterCreateParams(TypedDict, total=False): "$.components.schemas.CreateRouterSerializer.properties.interfaces.anyOf[0]" """ - routes: Optional[Iterable[NeutronRouteParam]] + routes: Optional[Iterable[Route]] """ '#/components/schemas/CreateRouterSerializer/properties/routes/anyOf/0' "$.components.schemas.CreateRouterSerializer.properties.routes.anyOf[0]" @@ -105,3 +104,17 @@ class Interface(TypedDict, total=False): '#/components/schemas/CreateRouterInterfaceSubnetSerializer/properties/type' "$.components.schemas.CreateRouterInterfaceSubnetSerializer.properties.type" """ + + +class Route(TypedDict, total=False): + destination: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/destination' + "$.components.schemas.RouteInSerializer.properties.destination" + """ + + nexthop: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/nexthop' + "$.components.schemas.RouteInSerializer.properties.nexthop" + """ diff --git a/src/gcore/types/cloud/networks/router_update_params.py b/src/gcore/types/cloud/networks/router_update_params.py index 53aab8f1..29c33e1f 100644 --- a/src/gcore/types/cloud/networks/router_update_params.py +++ b/src/gcore/types/cloud/networks/router_update_params.py @@ -5,9 +5,7 @@ from typing import Iterable, Optional from typing_extensions import Literal, Required, TypedDict -from ..neutron_route_param import NeutronRouteParam - -__all__ = ["RouterUpdateParams", "ExternalGatewayInfo"] +__all__ = ["RouterUpdateParams", "ExternalGatewayInfo", "Route"] class RouterUpdateParams(TypedDict, total=False): @@ -35,7 +33,7 @@ class RouterUpdateParams(TypedDict, total=False): "$.components.schemas.PatchRouterSerializer.properties.name.anyOf[0]" """ - routes: Optional[Iterable[NeutronRouteParam]] + routes: Optional[Iterable[Route]] """ '#/components/schemas/PatchRouterSerializer/properties/routes/anyOf/0' "$.components.schemas.PatchRouterSerializer.properties.routes.anyOf[0]" @@ -60,3 +58,17 @@ class ExternalGatewayInfo(TypedDict, total=False): '#/components/schemas/RouterExternalManualGwSerializer/properties/type' "$.components.schemas.RouterExternalManualGwSerializer.properties.type" """ + + +class Route(TypedDict, total=False): + destination: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/destination' + "$.components.schemas.RouteInSerializer.properties.destination" + """ + + nexthop: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/nexthop' + "$.components.schemas.RouteInSerializer.properties.nexthop" + """ diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index 0801eb1c..e4fde91d 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -6,9 +6,8 @@ from typing_extensions import Required, TypedDict from ..ip_version import IPVersion -from ..neutron_route_param import NeutronRouteParam -__all__ = ["SubnetCreateParams"] +__all__ = ["SubnetCreateParams", "HostRoute"] class SubnetCreateParams(TypedDict, total=False): @@ -66,7 +65,7 @@ class SubnetCreateParams(TypedDict, total=False): "$.components.schemas.CreateSubnetSerializer.properties.gateway_ip.anyOf[0]" """ - host_routes: Optional[Iterable[NeutronRouteParam]] + host_routes: Optional[Iterable[HostRoute]] """ '#/components/schemas/CreateSubnetSerializer/properties/host_routes/anyOf/0' "$.components.schemas.CreateSubnetSerializer.properties.host_routes.anyOf[0]" @@ -89,3 +88,17 @@ class SubnetCreateParams(TypedDict, total=False): '#/components/schemas/CreateSubnetSerializer/properties/router_id_to_connect/anyOf/0' "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" """ + + +class HostRoute(TypedDict, total=False): + destination: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/destination' + "$.components.schemas.RouteInSerializer.properties.destination" + """ + + nexthop: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/nexthop' + "$.components.schemas.RouteInSerializer.properties.nexthop" + """ diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index aa96d08b..ca79f228 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -3,11 +3,9 @@ from __future__ import annotations from typing import List, Iterable, Optional -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict -from ..neutron_route_param import NeutronRouteParam - -__all__ = ["SubnetUpdateParams"] +__all__ = ["SubnetUpdateParams", "HostRoute"] class SubnetUpdateParams(TypedDict, total=False): @@ -41,7 +39,7 @@ class SubnetUpdateParams(TypedDict, total=False): "$.components.schemas.PatchSubnetSerializer.properties.gateway_ip.anyOf[0]" """ - host_routes: Optional[Iterable[NeutronRouteParam]] + host_routes: Optional[Iterable[HostRoute]] """ '#/components/schemas/PatchSubnetSerializer/properties/host_routes/anyOf/0' "$.components.schemas.PatchSubnetSerializer.properties.host_routes.anyOf[0]" @@ -52,3 +50,17 @@ class SubnetUpdateParams(TypedDict, total=False): '#/components/schemas/PatchSubnetSerializer/properties/name/anyOf/0' "$.components.schemas.PatchSubnetSerializer.properties.name.anyOf[0]" """ + + +class HostRoute(TypedDict, total=False): + destination: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/destination' + "$.components.schemas.RouteInSerializer.properties.destination" + """ + + nexthop: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/nexthop' + "$.components.schemas.RouteInSerializer.properties.nexthop" + """ diff --git a/src/gcore/types/cloud/neutron_route.py b/src/gcore/types/cloud/neutron_route.py deleted file mode 100644 index 59eea1e8..00000000 --- a/src/gcore/types/cloud/neutron_route.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["NeutronRoute"] - - -class NeutronRoute(BaseModel): - destination: str - """ - '#/components/schemas/NeutronRouteSerializer/properties/destination' - "$.components.schemas.NeutronRouteSerializer.properties.destination" - """ - - nexthop: str - """ - '#/components/schemas/NeutronRouteSerializer/properties/nexthop' - "$.components.schemas.NeutronRouteSerializer.properties.nexthop" - """ diff --git a/src/gcore/types/cloud/neutron_route_param.py b/src/gcore/types/cloud/neutron_route_param.py deleted file mode 100644 index 24651682..00000000 --- a/src/gcore/types/cloud/neutron_route_param.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["NeutronRouteParam"] - - -class NeutronRouteParam(TypedDict, total=False): - destination: Required[str] - """ - '#/components/schemas/NeutronRouteSerializer/properties/destination' - "$.components.schemas.NeutronRouteSerializer.properties.destination" - """ - - nexthop: Required[str] - """ - '#/components/schemas/NeutronRouteSerializer/properties/nexthop' - "$.components.schemas.NeutronRouteSerializer.properties.nexthop" - """ diff --git a/src/gcore/types/cloud/quotas/__init__.py b/src/gcore/types/cloud/quotas/__init__.py index 8bf1b202..600a55cb 100644 --- a/src/gcore/types/cloud/quotas/__init__.py +++ b/src/gcore/types/cloud/quotas/__init__.py @@ -5,3 +5,4 @@ from .request_list_params import RequestListParams as RequestListParams from .request_get_response import RequestGetResponse as RequestGetResponse from .request_create_params import RequestCreateParams as RequestCreateParams +from .request_list_response import RequestListResponse as RequestListResponse diff --git a/src/gcore/types/cloud/quotas/request_list_response.py b/src/gcore/types/cloud/quotas/request_list_response.py new file mode 100644 index 00000000..7d043c9c --- /dev/null +++ b/src/gcore/types/cloud/quotas/request_list_response.py @@ -0,0 +1,394 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["RequestListResponse", "RequestedLimits", "RequestedLimitsGlobalLimits", "RequestedLimitsRegionalLimit"] + + +class RequestedLimitsGlobalLimits(BaseModel): + inference_cpu_millicore_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_cpu_millicore_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_cpu_millicore_count_limit" + """ + + inference_gpu_a100_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_a100_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_a100_count_limit" + """ + + inference_gpu_h100_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_h100_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_h100_count_limit" + """ + + inference_gpu_l40s_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_l40s_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_l40s_count_limit" + """ + + inference_instance_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_instance_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_instance_count_limit" + """ + + keypair_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/keypair_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.keypair_count_limit" + """ + + project_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/project_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.project_count_limit" + """ + + +class RequestedLimitsRegionalLimit(BaseModel): + baremetal_basic_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_basic_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_basic_count_limit" + """ + + baremetal_gpu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_gpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_gpu_count_limit" + """ + + baremetal_hf_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_hf_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_hf_count_limit" + """ + + baremetal_infrastructure_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_infrastructure_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_infrastructure_count_limit" + """ + + baremetal_network_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_network_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_network_count_limit" + """ + + baremetal_storage_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_storage_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_storage_count_limit" + """ + + caas_container_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_container_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_container_count_limit" + """ + + caas_cpu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_cpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_cpu_count_limit" + """ + + caas_gpu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_gpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_gpu_count_limit" + """ + + caas_ram_size_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_ram_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_ram_size_limit" + """ + + cluster_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cluster_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cluster_count_limit" + """ + + cpu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cpu_count_limit" + """ + + dbaas_postgres_cluster_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/dbaas_postgres_cluster_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.dbaas_postgres_cluster_count_limit" + """ + + external_ip_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/external_ip_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.external_ip_count_limit" + """ + + faas_cpu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_cpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_cpu_count_limit" + """ + + faas_function_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_function_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_function_count_limit" + """ + + faas_namespace_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_namespace_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_namespace_count_limit" + """ + + faas_ram_size_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_ram_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_ram_size_limit" + """ + + firewall_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/firewall_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.firewall_count_limit" + """ + + floating_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/floating_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.floating_count_limit" + """ + + gpu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_count_limit" + """ + + gpu_virtual_a100_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_a100_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_a100_count_limit" + """ + + gpu_virtual_h100_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_h100_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_h100_count_limit" + """ + + gpu_virtual_l40s_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_l40s_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_l40s_count_limit" + """ + + image_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_count_limit" + """ + + image_size_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_size_limit" + """ + + ipu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ipu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ipu_count_limit" + """ + + laas_topic_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/laas_topic_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.laas_topic_count_limit" + """ + + loadbalancer_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/loadbalancer_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.loadbalancer_count_limit" + """ + + network_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/network_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.network_count_limit" + """ + + ram_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ram_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ram_limit" + """ + + region_id: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/region_id' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.region_id" + """ + + registry_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_count_limit" + """ + + registry_storage_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_storage_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_storage_limit" + """ + + router_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/router_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.router_count_limit" + """ + + secret_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/secret_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.secret_count_limit" + """ + + servergroup_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/servergroup_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.servergroup_count_limit" + """ + + sfs_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_count_limit" + """ + + sfs_size_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_size_limit" + """ + + shared_vm_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/shared_vm_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.shared_vm_count_limit" + """ + + snapshot_schedule_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/snapshot_schedule_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.snapshot_schedule_count_limit" + """ + + subnet_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/subnet_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.subnet_count_limit" + """ + + vm_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/vm_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.vm_count_limit" + """ + + volume_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_count_limit" + """ + + volume_size_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_size_limit" + """ + + volume_snapshots_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_count_limit" + """ + + volume_snapshots_size_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_size_limit" + """ + + +class RequestedLimits(BaseModel): + global_limits: Optional[RequestedLimitsGlobalLimits] = None + """ + '#/components/schemas/AllClientQuotasLimitsSerializer/properties/global_limits' + "$.components.schemas.AllClientQuotasLimitsSerializer.properties.global_limits" + """ + + regional_limits: Optional[List[RequestedLimitsRegionalLimit]] = None + """ + '#/components/schemas/AllClientQuotasLimitsSerializer/properties/regional_limits' + "$.components.schemas.AllClientQuotasLimitsSerializer.properties.regional_limits" + """ + + +class RequestListResponse(BaseModel): + id: int + """ + '#/components/schemas/LimitsRequestSerializer/properties/id' + "$.components.schemas.LimitsRequestSerializer.properties.id" + """ + + client_id: int + """ + '#/components/schemas/LimitsRequestSerializer/properties/client_id' + "$.components.schemas.LimitsRequestSerializer.properties.client_id" + """ + + requested_limits: RequestedLimits + """ + '#/components/schemas/LimitsRequestSerializer/properties/requested_limits' + "$.components.schemas.LimitsRequestSerializer.properties.requested_limits" + """ + + status: str + """ + '#/components/schemas/LimitsRequestSerializer/properties/status' + "$.components.schemas.LimitsRequestSerializer.properties.status" + """ + + created_at: Optional[datetime] = None + """ + '#/components/schemas/LimitsRequestSerializer/properties/created_at' + "$.components.schemas.LimitsRequestSerializer.properties.created_at" + """ + + description: Optional[str] = None + """ + '#/components/schemas/LimitsRequestSerializer/properties/description/anyOf/0' + "$.components.schemas.LimitsRequestSerializer.properties.description.anyOf[0]" + """ + + updated_at: Optional[datetime] = None + """ + '#/components/schemas/LimitsRequestSerializer/properties/updated_at/anyOf/0' + "$.components.schemas.LimitsRequestSerializer.properties.updated_at.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/subnet.py b/src/gcore/types/cloud/subnet.py index 943cee49..9b4420b3 100644 --- a/src/gcore/types/cloud/subnet.py +++ b/src/gcore/types/cloud/subnet.py @@ -6,9 +6,22 @@ from .tag import Tag from ..._models import BaseModel from .ip_version import IPVersion -from .neutron_route import NeutronRoute -__all__ = ["Subnet"] +__all__ = ["Subnet", "HostRoute"] + + +class HostRoute(BaseModel): + destination: str + """ + '#/components/schemas/RouteOutSerializer/properties/destination' + "$.components.schemas.RouteOutSerializer.properties.destination" + """ + + nexthop: str + """ + '#/components/schemas/RouteOutSerializer/properties/nexthop' + "$.components.schemas.RouteOutSerializer.properties.nexthop" + """ class Subnet(BaseModel): @@ -114,7 +127,7 @@ class Subnet(BaseModel): "$.components.schemas.SubnetSerializer.properties.has_router" """ - host_routes: Optional[List[NeutronRoute]] = None + host_routes: Optional[List[HostRoute]] = None """ '#/components/schemas/SubnetSerializer/properties/host_routes/anyOf/0' "$.components.schemas.SubnetSerializer.properties.host_routes.anyOf[0]" diff --git a/src/gcore/types/cloud/volume.py b/src/gcore/types/cloud/volume.py index dadcb691..c5655971 100644 --- a/src/gcore/types/cloud/volume.py +++ b/src/gcore/types/cloud/volume.py @@ -163,6 +163,7 @@ class Volume(BaseModel): "reserved", "restoring-backup", "retyping", + "reverting", "uploading", ] """ diff --git a/tests/api_resources/cloud/quotas/test_requests.py b/tests/api_resources/cloud/quotas/test_requests.py index 4cb9bf1b..55d95441 100644 --- a/tests/api_resources/cloud/quotas/test_requests.py +++ b/tests/api_resources/cloud/quotas/test_requests.py @@ -9,7 +9,8 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.quotas import RequestGetResponse +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud.quotas import RequestGetResponse, RequestListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -124,7 +125,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: request = client.cloud.quotas.requests.list() - assert request is None + assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -133,7 +134,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: offset=0, status=["done", "in progress"], ) - assert request is None + assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -142,7 +143,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert request is None + assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -151,7 +152,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert request is None + assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -342,7 +343,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: request = await async_client.cloud.quotas.requests.list() - assert request is None + assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -351,7 +352,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No offset=0, status=["done", "in progress"], ) - assert request is None + assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -360,7 +361,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert request is None + assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -369,7 +370,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert request is None + assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) assert cast(Any, response.is_closed) is True From 4af4b69b818a1509826fab8f85cd37bf8058597a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 10:08:42 +0000 Subject: [PATCH 068/592] GCLOUD2-18778 Add cloud file shares --- .stats.yml | 4 +- api.md | 31 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + .../resources/cloud/file_shares/__init__.py | 33 + .../cloud/file_shares/access_rules.py | 458 ++++++++ .../cloud/file_shares/file_shares.py | 1043 +++++++++++++++++ src/gcore/types/cloud/__init__.py | 5 + src/gcore/types/cloud/file_share.py | 165 +++ .../types/cloud/file_share_create_params.py | 145 +++ .../types/cloud/file_share_list_params.py | 33 + .../types/cloud/file_share_resize_params.py | 27 + .../types/cloud/file_share_update_params.py | 27 + src/gcore/types/cloud/file_shares/__init__.py | 7 + .../types/cloud/file_shares/access_rule.py | 33 + .../file_shares/access_rule_create_params.py | 33 + .../cloud/file_shares/access_rule_list.py | 22 + .../cloud/file_shares/__init__.py | 1 + .../cloud/file_shares/test_access_rules.py | 338 ++++++ tests/api_resources/cloud/test_file_shares.py | 754 ++++++++++++ 20 files changed, 3203 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/file_shares/__init__.py create mode 100644 src/gcore/resources/cloud/file_shares/access_rules.py create mode 100644 src/gcore/resources/cloud/file_shares/file_shares.py create mode 100644 src/gcore/types/cloud/file_share.py create mode 100644 src/gcore/types/cloud/file_share_create_params.py create mode 100644 src/gcore/types/cloud/file_share_list_params.py create mode 100644 src/gcore/types/cloud/file_share_resize_params.py create mode 100644 src/gcore/types/cloud/file_share_update_params.py create mode 100644 src/gcore/types/cloud/file_shares/__init__.py create mode 100644 src/gcore/types/cloud/file_shares/access_rule.py create mode 100644 src/gcore/types/cloud/file_shares/access_rule_create_params.py create mode 100644 src/gcore/types/cloud/file_shares/access_rule_list.py create mode 100644 tests/api_resources/cloud/file_shares/__init__.py create mode 100644 tests/api_resources/cloud/file_shares/test_access_rules.py create mode 100644 tests/api_resources/cloud/test_file_shares.py diff --git a/.stats.yml b/.stats.yml index 81289190..b40a1996 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 88 +configured_endpoints: 97 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7dc53a8ce0e8691975b00337faf79d130814c518bd2678a6c54a1603ede12331.yml openapi_spec_hash: ea94cdbb22dfb693d9044f23f631fb1a -config_hash: 55db419b5f75fc0d2db24bef0860a449 +config_hash: dfebad2c06187795c7c950365600d24e diff --git a/api.md b/api.md index 52bdce9a..27143715 100644 --- a/api.md +++ b/api.md @@ -309,3 +309,34 @@ Methods: - client.cloud.instances.images.create_from_volume(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.instances.images.get(image_id, \*, project_id, region_id, \*\*params) -> Image - client.cloud.instances.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList + +## FileShares + +Types: + +```python +from gcore.types.cloud import FileShare +``` + +Methods: + +- client.cloud.file_shares.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.file_shares.update(file_share_id, \*, project_id, region_id, \*\*params) -> FileShare +- client.cloud.file_shares.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[FileShare] +- client.cloud.file_shares.delete(file_share_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.file_shares.get(file_share_id, \*, project_id, region_id) -> FileShare +- client.cloud.file_shares.resize(file_share_id, \*, project_id, region_id, \*\*params) -> TaskIDList + +### AccessRules + +Types: + +```python +from gcore.types.cloud.file_shares import AccessRule, AccessRuleList +``` + +Methods: + +- client.cloud.file_shares.access_rules.create(file_share_id, \*, project_id, region_id, \*\*params) -> AccessRule +- client.cloud.file_shares.access_rules.list(file_share_id, \*, project_id, region_id) -> AccessRuleList +- client.cloud.file_shares.access_rules.delete(access_rule_id, \*, project_id, region_id, file_share_id) -> None diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 0a641b4d..3cebe18e 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -96,6 +96,14 @@ IPRangesResourceWithStreamingResponse, AsyncIPRangesResourceWithStreamingResponse, ) +from .file_shares import ( + FileSharesResource, + AsyncFileSharesResource, + FileSharesResourceWithRawResponse, + AsyncFileSharesResourceWithRawResponse, + FileSharesResourceWithStreamingResponse, + AsyncFileSharesResourceWithStreamingResponse, +) from .floating_ips import ( FloatingIPsResource, AsyncFloatingIPsResource, @@ -206,6 +214,12 @@ "AsyncInstancesResourceWithRawResponse", "InstancesResourceWithStreamingResponse", "AsyncInstancesResourceWithStreamingResponse", + "FileSharesResource", + "AsyncFileSharesResource", + "FileSharesResourceWithRawResponse", + "AsyncFileSharesResourceWithRawResponse", + "FileSharesResourceWithStreamingResponse", + "AsyncFileSharesResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index f56e9958..6fd323d7 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -100,6 +100,14 @@ InstancesResourceWithStreamingResponse, AsyncInstancesResourceWithStreamingResponse, ) +from .file_shares.file_shares import ( + FileSharesResource, + AsyncFileSharesResource, + FileSharesResourceWithRawResponse, + AsyncFileSharesResourceWithRawResponse, + FileSharesResourceWithStreamingResponse, + AsyncFileSharesResourceWithStreamingResponse, +) from .security_groups.security_groups import ( SecurityGroupsResource, AsyncSecurityGroupsResource, @@ -177,6 +185,10 @@ def baremetal(self) -> BaremetalResource: def instances(self) -> InstancesResource: return InstancesResource(self._client) + @cached_property + def file_shares(self) -> FileSharesResource: + return FileSharesResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -254,6 +266,10 @@ def baremetal(self) -> AsyncBaremetalResource: def instances(self) -> AsyncInstancesResource: return AsyncInstancesResource(self._client) + @cached_property + def file_shares(self) -> AsyncFileSharesResource: + return AsyncFileSharesResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -334,6 +350,10 @@ def baremetal(self) -> BaremetalResourceWithRawResponse: def instances(self) -> InstancesResourceWithRawResponse: return InstancesResourceWithRawResponse(self._cloud.instances) + @cached_property + def file_shares(self) -> FileSharesResourceWithRawResponse: + return FileSharesResourceWithRawResponse(self._cloud.file_shares) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -395,6 +415,10 @@ def baremetal(self) -> AsyncBaremetalResourceWithRawResponse: def instances(self) -> AsyncInstancesResourceWithRawResponse: return AsyncInstancesResourceWithRawResponse(self._cloud.instances) + @cached_property + def file_shares(self) -> AsyncFileSharesResourceWithRawResponse: + return AsyncFileSharesResourceWithRawResponse(self._cloud.file_shares) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -456,6 +480,10 @@ def baremetal(self) -> BaremetalResourceWithStreamingResponse: def instances(self) -> InstancesResourceWithStreamingResponse: return InstancesResourceWithStreamingResponse(self._cloud.instances) + @cached_property + def file_shares(self) -> FileSharesResourceWithStreamingResponse: + return FileSharesResourceWithStreamingResponse(self._cloud.file_shares) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -516,3 +544,7 @@ def baremetal(self) -> AsyncBaremetalResourceWithStreamingResponse: @cached_property def instances(self) -> AsyncInstancesResourceWithStreamingResponse: return AsyncInstancesResourceWithStreamingResponse(self._cloud.instances) + + @cached_property + def file_shares(self) -> AsyncFileSharesResourceWithStreamingResponse: + return AsyncFileSharesResourceWithStreamingResponse(self._cloud.file_shares) diff --git a/src/gcore/resources/cloud/file_shares/__init__.py b/src/gcore/resources/cloud/file_shares/__init__.py new file mode 100644 index 00000000..7026ea29 --- /dev/null +++ b/src/gcore/resources/cloud/file_shares/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .file_shares import ( + FileSharesResource, + AsyncFileSharesResource, + FileSharesResourceWithRawResponse, + AsyncFileSharesResourceWithRawResponse, + FileSharesResourceWithStreamingResponse, + AsyncFileSharesResourceWithStreamingResponse, +) +from .access_rules import ( + AccessRulesResource, + AsyncAccessRulesResource, + AccessRulesResourceWithRawResponse, + AsyncAccessRulesResourceWithRawResponse, + AccessRulesResourceWithStreamingResponse, + AsyncAccessRulesResourceWithStreamingResponse, +) + +__all__ = [ + "AccessRulesResource", + "AsyncAccessRulesResource", + "AccessRulesResourceWithRawResponse", + "AsyncAccessRulesResourceWithRawResponse", + "AccessRulesResourceWithStreamingResponse", + "AsyncAccessRulesResourceWithStreamingResponse", + "FileSharesResource", + "AsyncFileSharesResource", + "FileSharesResourceWithRawResponse", + "AsyncFileSharesResourceWithRawResponse", + "FileSharesResourceWithStreamingResponse", + "AsyncFileSharesResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py new file mode 100644 index 00000000..c3cbe0e4 --- /dev/null +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -0,0 +1,458 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.file_shares import access_rule_create_params +from ....types.cloud.file_shares.access_rule import AccessRule +from ....types.cloud.file_shares.access_rule_list import AccessRuleList + +__all__ = ["AccessRulesResource", "AsyncAccessRulesResource"] + + +class AccessRulesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AccessRulesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AccessRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AccessRulesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AccessRulesResourceWithStreamingResponse(self) + + def create( + self, + file_share_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + access_mode: Literal["ro", "rw"], + ip_address: 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, + ) -> AccessRule: + """ + Create file share access rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[2].schema" + + access_mode: '#/components/schemas/CreateAccessRuleSerializer/properties/access_mode' + "$.components.schemas.CreateAccessRuleSerializer.properties.access_mode" + + ip_address: '#/components/schemas/CreateAccessRuleSerializer/properties/ip_address/anyOf/0' + "$.components.schemas.CreateAccessRuleSerializer.properties.ip_address.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + return self._post( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + body=maybe_transform( + { + "access_mode": access_mode, + "ip_address": ip_address, + }, + access_rule_create_params.AccessRuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AccessRule, + ) + + def list( + self, + file_share_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AccessRuleList: + """ + Get file share access rules + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/get/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/get/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].get.parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/get/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + return self._get( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AccessRuleList, + ) + + def delete( + self, + access_rule_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + file_share_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete file share access rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[2].schema" + + access_rule_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + if not access_rule_id: + raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncAccessRulesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAccessRulesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncAccessRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAccessRulesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncAccessRulesResourceWithStreamingResponse(self) + + async def create( + self, + file_share_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + access_mode: Literal["ro", "rw"], + ip_address: 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, + ) -> AccessRule: + """ + Create file share access rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[2].schema" + + access_mode: '#/components/schemas/CreateAccessRuleSerializer/properties/access_mode' + "$.components.schemas.CreateAccessRuleSerializer.properties.access_mode" + + ip_address: '#/components/schemas/CreateAccessRuleSerializer/properties/ip_address/anyOf/0' + "$.components.schemas.CreateAccessRuleSerializer.properties.ip_address.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + return await self._post( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + body=await async_maybe_transform( + { + "access_mode": access_mode, + "ip_address": ip_address, + }, + access_rule_create_params.AccessRuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AccessRule, + ) + + async def list( + self, + file_share_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AccessRuleList: + """ + Get file share access rules + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/get/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/get/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].get.parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/get/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + return await self._get( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AccessRuleList, + ) + + async def delete( + self, + access_rule_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + file_share_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete file share access rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[2].schema" + + access_rule_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + if not access_rule_id: + raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AccessRulesResourceWithRawResponse: + def __init__(self, access_rules: AccessRulesResource) -> None: + self._access_rules = access_rules + + self.create = to_raw_response_wrapper( + access_rules.create, + ) + self.list = to_raw_response_wrapper( + access_rules.list, + ) + self.delete = to_raw_response_wrapper( + access_rules.delete, + ) + + +class AsyncAccessRulesResourceWithRawResponse: + def __init__(self, access_rules: AsyncAccessRulesResource) -> None: + self._access_rules = access_rules + + self.create = async_to_raw_response_wrapper( + access_rules.create, + ) + self.list = async_to_raw_response_wrapper( + access_rules.list, + ) + self.delete = async_to_raw_response_wrapper( + access_rules.delete, + ) + + +class AccessRulesResourceWithStreamingResponse: + def __init__(self, access_rules: AccessRulesResource) -> None: + self._access_rules = access_rules + + self.create = to_streamed_response_wrapper( + access_rules.create, + ) + self.list = to_streamed_response_wrapper( + access_rules.list, + ) + self.delete = to_streamed_response_wrapper( + access_rules.delete, + ) + + +class AsyncAccessRulesResourceWithStreamingResponse: + def __init__(self, access_rules: AsyncAccessRulesResource) -> None: + self._access_rules = access_rules + + self.create = async_to_streamed_response_wrapper( + access_rules.create, + ) + self.list = async_to_streamed_response_wrapper( + access_rules.list, + ) + self.delete = async_to_streamed_response_wrapper( + access_rules.delete, + ) diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py new file mode 100644 index 00000000..089daa34 --- /dev/null +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -0,0 +1,1043 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable +from typing_extensions import Literal, overload + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import required_args, maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .access_rules import ( + AccessRulesResource, + AsyncAccessRulesResource, + AccessRulesResourceWithRawResponse, + AsyncAccessRulesResourceWithRawResponse, + AccessRulesResourceWithStreamingResponse, + AsyncAccessRulesResourceWithStreamingResponse, +) +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.cloud import ( + file_share_list_params, + file_share_create_params, + file_share_resize_params, + file_share_update_params, +) +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.file_share import FileShare +from ....types.cloud.task_id_list import TaskIDList + +__all__ = ["FileSharesResource", "AsyncFileSharesResource"] + + +class FileSharesResource(SyncAPIResource): + @cached_property + def access_rules(self) -> AccessRulesResource: + return AccessRulesResource(self._client) + + @cached_property + def with_raw_response(self) -> FileSharesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return FileSharesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FileSharesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return FileSharesResourceWithStreamingResponse(self) + + @overload + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + network: file_share_create_params.CreateStandardFileShareSerializerNetwork, + protocol: Literal["NFS"], + size: int, + access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create file share + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateStandardFileShareSerializer/properties/name' + "$.components.schemas.CreateStandardFileShareSerializer.properties.name" + + network: '#/components/schemas/CreateStandardFileShareSerializer/properties/network' + "$.components.schemas.CreateStandardFileShareSerializer.properties.network" + + protocol: '#/components/schemas/CreateStandardFileShareSerializer/properties/protocol' + "$.components.schemas.CreateStandardFileShareSerializer.properties.protocol" + + size: '#/components/schemas/CreateStandardFileShareSerializer/properties/size' + "$.components.schemas.CreateStandardFileShareSerializer.properties.size" + + access: '#/components/schemas/CreateStandardFileShareSerializer/properties/access' + "$.components.schemas.CreateStandardFileShareSerializer.properties.access" + + metadata: '#/components/schemas/CreateStandardFileShareSerializer/properties/metadata' + "$.components.schemas.CreateStandardFileShareSerializer.properties.metadata" + + volume_type: '#/components/schemas/CreateStandardFileShareSerializer/properties/volume_type' + "$.components.schemas.CreateStandardFileShareSerializer.properties.volume_type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + protocol: Literal["NFS"], + size: int, + volume_type: Literal["vast_share_type"], + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create file share + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateVastFileShareSerializer/properties/name' + "$.components.schemas.CreateVastFileShareSerializer.properties.name" + + protocol: '#/components/schemas/CreateVastFileShareSerializer/properties/protocol' + "$.components.schemas.CreateVastFileShareSerializer.properties.protocol" + + size: '#/components/schemas/CreateVastFileShareSerializer/properties/size' + "$.components.schemas.CreateVastFileShareSerializer.properties.size" + + volume_type: '#/components/schemas/CreateVastFileShareSerializer/properties/volume_type' + "$.components.schemas.CreateVastFileShareSerializer.properties.volume_type" + + metadata: '#/components/schemas/CreateVastFileShareSerializer/properties/metadata' + "$.components.schemas.CreateVastFileShareSerializer.properties.metadata" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args(["name", "network", "protocol", "size"], ["name", "protocol", "size", "volume_type"]) + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + network: file_share_create_params.CreateStandardFileShareSerializerNetwork | NotGiven = NOT_GIVEN, + protocol: Literal["NFS"], + size: int, + access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + 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_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._post( + f"/cloud/v1/file_shares/{project_id}/{region_id}", + body=maybe_transform( + { + "name": name, + "network": network, + "protocol": protocol, + "size": size, + "access": access, + "metadata": metadata, + "volume_type": volume_type, + }, + file_share_create_params.FileShareCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + file_share_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + 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, + ) -> FileShare: + """ + Rename file share + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[2].schema" + + name: '#/components/schemas/NameSerializer/properties/name' + "$.components.schemas.NameSerializer.properties.name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + return self._patch( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + body=maybe_transform({"name": name}, file_share_update_params.FileShareUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileShare, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[FileShare]: + """ + List file shares + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[2]" + + offset: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/file_shares/{project_id}/{region_id}", + page=SyncOffsetPage[FileShare], + 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, + }, + file_share_list_params.FileShareListParams, + ), + ), + model=FileShare, + ) + + def delete( + self, + file_share_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete file share + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}']['delete'].parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + return self._delete( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + file_share_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileShare: + """ + Get file share + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].get.parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + return self._get( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileShare, + ) + + def resize( + self, + file_share_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + size: 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, + ) -> TaskIDList: + """ + Resize file share + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[2].schema" + + size: '#/components/schemas/ResizeSfsSerializer/properties/size' + "$.components.schemas.ResizeSfsSerializer.properties.size" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + return self._post( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + body=maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncFileSharesResource(AsyncAPIResource): + @cached_property + def access_rules(self) -> AsyncAccessRulesResource: + return AsyncAccessRulesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncFileSharesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncFileSharesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFileSharesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncFileSharesResourceWithStreamingResponse(self) + + @overload + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + network: file_share_create_params.CreateStandardFileShareSerializerNetwork, + protocol: Literal["NFS"], + size: int, + access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create file share + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateStandardFileShareSerializer/properties/name' + "$.components.schemas.CreateStandardFileShareSerializer.properties.name" + + network: '#/components/schemas/CreateStandardFileShareSerializer/properties/network' + "$.components.schemas.CreateStandardFileShareSerializer.properties.network" + + protocol: '#/components/schemas/CreateStandardFileShareSerializer/properties/protocol' + "$.components.schemas.CreateStandardFileShareSerializer.properties.protocol" + + size: '#/components/schemas/CreateStandardFileShareSerializer/properties/size' + "$.components.schemas.CreateStandardFileShareSerializer.properties.size" + + access: '#/components/schemas/CreateStandardFileShareSerializer/properties/access' + "$.components.schemas.CreateStandardFileShareSerializer.properties.access" + + metadata: '#/components/schemas/CreateStandardFileShareSerializer/properties/metadata' + "$.components.schemas.CreateStandardFileShareSerializer.properties.metadata" + + volume_type: '#/components/schemas/CreateStandardFileShareSerializer/properties/volume_type' + "$.components.schemas.CreateStandardFileShareSerializer.properties.volume_type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + protocol: Literal["NFS"], + size: int, + volume_type: Literal["vast_share_type"], + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create file share + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateVastFileShareSerializer/properties/name' + "$.components.schemas.CreateVastFileShareSerializer.properties.name" + + protocol: '#/components/schemas/CreateVastFileShareSerializer/properties/protocol' + "$.components.schemas.CreateVastFileShareSerializer.properties.protocol" + + size: '#/components/schemas/CreateVastFileShareSerializer/properties/size' + "$.components.schemas.CreateVastFileShareSerializer.properties.size" + + volume_type: '#/components/schemas/CreateVastFileShareSerializer/properties/volume_type' + "$.components.schemas.CreateVastFileShareSerializer.properties.volume_type" + + metadata: '#/components/schemas/CreateVastFileShareSerializer/properties/metadata' + "$.components.schemas.CreateVastFileShareSerializer.properties.metadata" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args(["name", "network", "protocol", "size"], ["name", "protocol", "size", "volume_type"]) + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + network: file_share_create_params.CreateStandardFileShareSerializerNetwork | NotGiven = NOT_GIVEN, + protocol: Literal["NFS"], + size: int, + access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + 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_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return await self._post( + f"/cloud/v1/file_shares/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "name": name, + "network": network, + "protocol": protocol, + "size": size, + "access": access, + "metadata": metadata, + "volume_type": volume_type, + }, + file_share_create_params.FileShareCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + file_share_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + 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, + ) -> FileShare: + """ + Rename file share + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[2].schema" + + name: '#/components/schemas/NameSerializer/properties/name' + "$.components.schemas.NameSerializer.properties.name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + return await self._patch( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + body=await async_maybe_transform({"name": name}, file_share_update_params.FileShareUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileShare, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[FileShare, AsyncOffsetPage[FileShare]]: + """ + List file shares + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[2]" + + offset: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/file_shares/{project_id}/{region_id}", + page=AsyncOffsetPage[FileShare], + 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, + }, + file_share_list_params.FileShareListParams, + ), + ), + model=FileShare, + ) + + async def delete( + self, + file_share_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete file share + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}']['delete'].parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + return await self._delete( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + file_share_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileShare: + """ + Get file share + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].get.parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + return await self._get( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileShare, + ) + + async def resize( + self, + file_share_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + size: 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, + ) -> TaskIDList: + """ + Resize file share + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[1].schema" + + file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/2/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[2].schema" + + size: '#/components/schemas/ResizeSfsSerializer/properties/size' + "$.components.schemas.ResizeSfsSerializer.properties.size" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_project_id_path_param() + if region_id is None: + region_id = self._client._get_region_id_path_param() + if not file_share_id: + raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") + return await self._post( + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + body=await async_maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class FileSharesResourceWithRawResponse: + def __init__(self, file_shares: FileSharesResource) -> None: + self._file_shares = file_shares + + self.create = to_raw_response_wrapper( + file_shares.create, + ) + self.update = to_raw_response_wrapper( + file_shares.update, + ) + self.list = to_raw_response_wrapper( + file_shares.list, + ) + self.delete = to_raw_response_wrapper( + file_shares.delete, + ) + self.get = to_raw_response_wrapper( + file_shares.get, + ) + self.resize = to_raw_response_wrapper( + file_shares.resize, + ) + + @cached_property + def access_rules(self) -> AccessRulesResourceWithRawResponse: + return AccessRulesResourceWithRawResponse(self._file_shares.access_rules) + + +class AsyncFileSharesResourceWithRawResponse: + def __init__(self, file_shares: AsyncFileSharesResource) -> None: + self._file_shares = file_shares + + self.create = async_to_raw_response_wrapper( + file_shares.create, + ) + self.update = async_to_raw_response_wrapper( + file_shares.update, + ) + self.list = async_to_raw_response_wrapper( + file_shares.list, + ) + self.delete = async_to_raw_response_wrapper( + file_shares.delete, + ) + self.get = async_to_raw_response_wrapper( + file_shares.get, + ) + self.resize = async_to_raw_response_wrapper( + file_shares.resize, + ) + + @cached_property + def access_rules(self) -> AsyncAccessRulesResourceWithRawResponse: + return AsyncAccessRulesResourceWithRawResponse(self._file_shares.access_rules) + + +class FileSharesResourceWithStreamingResponse: + def __init__(self, file_shares: FileSharesResource) -> None: + self._file_shares = file_shares + + self.create = to_streamed_response_wrapper( + file_shares.create, + ) + self.update = to_streamed_response_wrapper( + file_shares.update, + ) + self.list = to_streamed_response_wrapper( + file_shares.list, + ) + self.delete = to_streamed_response_wrapper( + file_shares.delete, + ) + self.get = to_streamed_response_wrapper( + file_shares.get, + ) + self.resize = to_streamed_response_wrapper( + file_shares.resize, + ) + + @cached_property + def access_rules(self) -> AccessRulesResourceWithStreamingResponse: + return AccessRulesResourceWithStreamingResponse(self._file_shares.access_rules) + + +class AsyncFileSharesResourceWithStreamingResponse: + def __init__(self, file_shares: AsyncFileSharesResource) -> None: + self._file_shares = file_shares + + self.create = async_to_streamed_response_wrapper( + file_shares.create, + ) + self.update = async_to_streamed_response_wrapper( + file_shares.update, + ) + self.list = async_to_streamed_response_wrapper( + file_shares.list, + ) + self.delete = async_to_streamed_response_wrapper( + file_shares.delete, + ) + self.get = async_to_streamed_response_wrapper( + file_shares.get, + ) + self.resize = async_to_streamed_response_wrapper( + file_shares.resize, + ) + + @cached_property + def access_rules(self) -> AsyncAccessRulesResourceWithStreamingResponse: + return AsyncAccessRulesResourceWithStreamingResponse(self._file_shares.access_rules) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index b4622f2a..8cb2fc91 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -13,6 +13,7 @@ from .project import Project as Project from .ssh_key import SSHKey as SSHKey from .ip_ranges import IPRanges as IPRanges +from .file_share import FileShare as FileShare from .image_list import ImageList as ImageList from .ip_version import IPVersion as IPVersion from .floating_ip import FloatingIP as FloatingIP @@ -47,11 +48,15 @@ from .project_create_params import ProjectCreateParams as ProjectCreateParams from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams +from .file_share_list_params import FileShareListParams as FileShareListParams from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList +from .file_share_create_params import FileShareCreateParams as FileShareCreateParams +from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams +from .file_share_update_params import FileShareUpdateParams as FileShareUpdateParams from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams diff --git a/src/gcore/types/cloud/file_share.py b/src/gcore/types/cloud/file_share.py new file mode 100644 index 00000000..fc069797 --- /dev/null +++ b/src/gcore/types/cloud/file_share.py @@ -0,0 +1,165 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from .tag import Tag +from ..._models import BaseModel + +__all__ = ["FileShare"] + + +class FileShare(BaseModel): + id: str + """ + '#/components/schemas/FileShareSerializer/properties/id' + "$.components.schemas.FileShareSerializer.properties.id" + """ + + connection_point: Optional[str] = None + """ + '#/components/schemas/FileShareSerializer/properties/connection_point/anyOf/0' + "$.components.schemas.FileShareSerializer.properties.connection_point.anyOf[0]" + """ + + created_at: str + """ + '#/components/schemas/FileShareSerializer/properties/created_at' + "$.components.schemas.FileShareSerializer.properties.created_at" + """ + + creator_task_id: str + """ + '#/components/schemas/FileShareSerializer/properties/creator_task_id' + "$.components.schemas.FileShareSerializer.properties.creator_task_id" + """ + + metadata: Dict[str, str] + """ + '#/components/schemas/FileShareSerializer/properties/metadata' + "$.components.schemas.FileShareSerializer.properties.metadata" + """ + + metadata_detailed: List[Tag] + """ + '#/components/schemas/FileShareSerializer/properties/metadata_detailed' + "$.components.schemas.FileShareSerializer.properties.metadata_detailed" + """ + + name: str + """ + '#/components/schemas/FileShareSerializer/properties/name' + "$.components.schemas.FileShareSerializer.properties.name" + """ + + network_id: str + """ + '#/components/schemas/FileShareSerializer/properties/network_id' + "$.components.schemas.FileShareSerializer.properties.network_id" + """ + + network_name: str + """ + '#/components/schemas/FileShareSerializer/properties/network_name' + "$.components.schemas.FileShareSerializer.properties.network_name" + """ + + project_id: int + """ + '#/components/schemas/FileShareSerializer/properties/project_id' + "$.components.schemas.FileShareSerializer.properties.project_id" + """ + + protocol: str + """ + '#/components/schemas/FileShareSerializer/properties/protocol' + "$.components.schemas.FileShareSerializer.properties.protocol" + """ + + region: str + """ + '#/components/schemas/FileShareSerializer/properties/region' + "$.components.schemas.FileShareSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/FileShareSerializer/properties/region_id' + "$.components.schemas.FileShareSerializer.properties.region_id" + """ + + share_network_name: Optional[str] = None + """ + '#/components/schemas/FileShareSerializer/properties/share_network_name/anyOf/0' + "$.components.schemas.FileShareSerializer.properties.share_network_name.anyOf[0]" + """ + + size: int + """ + '#/components/schemas/FileShareSerializer/properties/size' + "$.components.schemas.FileShareSerializer.properties.size" + """ + + status: Literal[ + "available", + "awaiting_transfer", + "backup_creating", + "backup_restoring", + "backup_restoring_error", + "creating", + "creating_from_snapshot", + "deleted", + "deleting", + "error", + "error_deleting", + "extending", + "extending_error", + "inactive", + "manage_error", + "manage_starting", + "migrating", + "migrating_to", + "replication_change", + "reverting", + "reverting_error", + "shrinking", + "shrinking_error", + "shrinking_possible_data_loss_error", + "unmanage_error", + "unmanage_starting", + "unmanaged", + ] + """ + '#/components/schemas/FileShareSerializer/properties/status' + "$.components.schemas.FileShareSerializer.properties.status" + """ + + subnet_id: str + """ + '#/components/schemas/FileShareSerializer/properties/subnet_id' + "$.components.schemas.FileShareSerializer.properties.subnet_id" + """ + + subnet_name: str + """ + '#/components/schemas/FileShareSerializer/properties/subnet_name' + "$.components.schemas.FileShareSerializer.properties.subnet_name" + """ + + tags: List[Tag] + """ + '#/components/schemas/FileShareSerializer/properties/tags' + "$.components.schemas.FileShareSerializer.properties.tags" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/FileShareSerializer/properties/task_id/anyOf/0' + "$.components.schemas.FileShareSerializer.properties.task_id.anyOf[0]" + """ + + volume_type: Literal["default_share_type", "vast_share_type"] + """ + '#/components/schemas/FileShareSerializer/properties/volume_type' + "$.components.schemas.FileShareSerializer.properties.volume_type" + """ diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py new file mode 100644 index 00000000..057e5500 --- /dev/null +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -0,0 +1,145 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = [ + "FileShareCreateParams", + "CreateStandardFileShareSerializer", + "CreateStandardFileShareSerializerNetwork", + "CreateStandardFileShareSerializerAccess", + "CreateVastFileShareSerializer", +] + + +class CreateStandardFileShareSerializer(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/CreateStandardFileShareSerializer/properties/name' + "$.components.schemas.CreateStandardFileShareSerializer.properties.name" + """ + + network: Required[CreateStandardFileShareSerializerNetwork] + """ + '#/components/schemas/CreateStandardFileShareSerializer/properties/network' + "$.components.schemas.CreateStandardFileShareSerializer.properties.network" + """ + + protocol: Required[Literal["NFS"]] + """ + '#/components/schemas/CreateStandardFileShareSerializer/properties/protocol' + "$.components.schemas.CreateStandardFileShareSerializer.properties.protocol" + """ + + size: Required[int] + """ + '#/components/schemas/CreateStandardFileShareSerializer/properties/size' + "$.components.schemas.CreateStandardFileShareSerializer.properties.size" + """ + + access: Iterable[CreateStandardFileShareSerializerAccess] + """ + '#/components/schemas/CreateStandardFileShareSerializer/properties/access' + "$.components.schemas.CreateStandardFileShareSerializer.properties.access" + """ + + metadata: Dict[str, str] + """ + '#/components/schemas/CreateStandardFileShareSerializer/properties/metadata' + "$.components.schemas.CreateStandardFileShareSerializer.properties.metadata" + """ + + volume_type: Literal["default_share_type"] + """ + '#/components/schemas/CreateStandardFileShareSerializer/properties/volume_type' + "$.components.schemas.CreateStandardFileShareSerializer.properties.volume_type" + """ + + +class CreateStandardFileShareSerializerNetwork(TypedDict, total=False): + network_id: Required[str] + """ + '#/components/schemas/FileShareNetworkSerializer/properties/network_id' + "$.components.schemas.FileShareNetworkSerializer.properties.network_id" + """ + + subnet_id: str + """ + '#/components/schemas/FileShareNetworkSerializer/properties/subnet_id' + "$.components.schemas.FileShareNetworkSerializer.properties.subnet_id" + """ + + +class CreateStandardFileShareSerializerAccess(TypedDict, total=False): + access_mode: Required[Literal["ro", "rw"]] + """ + '#/components/schemas/CreateAccessRuleSerializer/properties/access_mode' + "$.components.schemas.CreateAccessRuleSerializer.properties.access_mode" + """ + + ip_address: Required[str] + """ + '#/components/schemas/CreateAccessRuleSerializer/properties/ip_address/anyOf/0' + "$.components.schemas.CreateAccessRuleSerializer.properties.ip_address.anyOf[0]" + """ + + +class CreateVastFileShareSerializer(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/CreateVastFileShareSerializer/properties/name' + "$.components.schemas.CreateVastFileShareSerializer.properties.name" + """ + + protocol: Required[Literal["NFS"]] + """ + '#/components/schemas/CreateVastFileShareSerializer/properties/protocol' + "$.components.schemas.CreateVastFileShareSerializer.properties.protocol" + """ + + size: Required[int] + """ + '#/components/schemas/CreateVastFileShareSerializer/properties/size' + "$.components.schemas.CreateVastFileShareSerializer.properties.size" + """ + + volume_type: Required[Literal["vast_share_type"]] + """ + '#/components/schemas/CreateVastFileShareSerializer/properties/volume_type' + "$.components.schemas.CreateVastFileShareSerializer.properties.volume_type" + """ + + metadata: Dict[str, str] + """ + '#/components/schemas/CreateVastFileShareSerializer/properties/metadata' + "$.components.schemas.CreateVastFileShareSerializer.properties.metadata" + """ + + +FileShareCreateParams: TypeAlias = Union[CreateStandardFileShareSerializer, CreateVastFileShareSerializer] diff --git a/src/gcore/types/cloud/file_share_list_params.py b/src/gcore/types/cloud/file_share_list_params.py new file mode 100644 index 00000000..3fe60a78 --- /dev/null +++ b/src/gcore/types/cloud/file_share_list_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["FileShareListParams"] + + +class FileShareListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[2]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[3]" + """ diff --git a/src/gcore/types/cloud/file_share_resize_params.py b/src/gcore/types/cloud/file_share_resize_params.py new file mode 100644 index 00000000..d257990a --- /dev/null +++ b/src/gcore/types/cloud/file_share_resize_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["FileShareResizeParams"] + + +class FileShareResizeParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[1].schema" + """ + + size: Required[int] + """ + '#/components/schemas/ResizeSfsSerializer/properties/size' + "$.components.schemas.ResizeSfsSerializer.properties.size" + """ diff --git a/src/gcore/types/cloud/file_share_update_params.py b/src/gcore/types/cloud/file_share_update_params.py new file mode 100644 index 00000000..22254727 --- /dev/null +++ b/src/gcore/types/cloud/file_share_update_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["FileShareUpdateParams"] + + +class FileShareUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/NameSerializer/properties/name' + "$.components.schemas.NameSerializer.properties.name" + """ diff --git a/src/gcore/types/cloud/file_shares/__init__.py b/src/gcore/types/cloud/file_shares/__init__.py new file mode 100644 index 00000000..59fee441 --- /dev/null +++ b/src/gcore/types/cloud/file_shares/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .access_rule import AccessRule as AccessRule +from .access_rule_list import AccessRuleList as AccessRuleList +from .access_rule_create_params import AccessRuleCreateParams as AccessRuleCreateParams diff --git a/src/gcore/types/cloud/file_shares/access_rule.py b/src/gcore/types/cloud/file_shares/access_rule.py new file mode 100644 index 00000000..b46d99a9 --- /dev/null +++ b/src/gcore/types/cloud/file_shares/access_rule.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["AccessRule"] + + +class AccessRule(BaseModel): + id: str + """ + '#/components/schemas/AccessRuleSerializer/properties/id' + "$.components.schemas.AccessRuleSerializer.properties.id" + """ + + access_level: Literal["ro", "rw"] + """ + '#/components/schemas/AccessRuleSerializer/properties/access_level' + "$.components.schemas.AccessRuleSerializer.properties.access_level" + """ + + access_to: str + """ + '#/components/schemas/AccessRuleSerializer/properties/access_to/anyOf/0' + "$.components.schemas.AccessRuleSerializer.properties.access_to.anyOf[0]" + """ + + state: Literal["active", "applying", "denying", "error", "new", "queued_to_apply", "queued_to_deny"] + """ + '#/components/schemas/AccessRuleSerializer/properties/state' + "$.components.schemas.AccessRuleSerializer.properties.state" + """ diff --git a/src/gcore/types/cloud/file_shares/access_rule_create_params.py b/src/gcore/types/cloud/file_shares/access_rule_create_params.py new file mode 100644 index 00000000..462708cb --- /dev/null +++ b/src/gcore/types/cloud/file_shares/access_rule_create_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["AccessRuleCreateParams"] + + +class AccessRuleCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/0/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/1/schema' + "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[1].schema" + """ + + access_mode: Required[Literal["ro", "rw"]] + """ + '#/components/schemas/CreateAccessRuleSerializer/properties/access_mode' + "$.components.schemas.CreateAccessRuleSerializer.properties.access_mode" + """ + + ip_address: Required[str] + """ + '#/components/schemas/CreateAccessRuleSerializer/properties/ip_address/anyOf/0' + "$.components.schemas.CreateAccessRuleSerializer.properties.ip_address.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/file_shares/access_rule_list.py b/src/gcore/types/cloud/file_shares/access_rule_list.py new file mode 100644 index 00000000..d5440663 --- /dev/null +++ b/src/gcore/types/cloud/file_shares/access_rule_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .access_rule import AccessRule + +__all__ = ["AccessRuleList"] + + +class AccessRuleList(BaseModel): + count: int + """ + '#/components/schemas/AccessRuleCollectionSerializer/properties/count' + "$.components.schemas.AccessRuleCollectionSerializer.properties.count" + """ + + results: List[AccessRule] + """ + '#/components/schemas/AccessRuleCollectionSerializer/properties/results' + "$.components.schemas.AccessRuleCollectionSerializer.properties.results" + """ diff --git a/tests/api_resources/cloud/file_shares/__init__.py b/tests/api_resources/cloud/file_shares/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/file_shares/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/file_shares/test_access_rules.py b/tests/api_resources/cloud/file_shares/test_access_rules.py new file mode 100644 index 00000000..59ad1e15 --- /dev/null +++ b/tests/api_resources/cloud/file_shares/test_access_rules.py @@ -0,0 +1,338 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.file_shares import AccessRule, AccessRuleList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAccessRules: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + access_rule = client.cloud.file_shares.access_rules.create( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + access_mode="ro", + ip_address="192.168.1.1", + ) + assert_matches_type(AccessRule, access_rule, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.file_shares.access_rules.with_raw_response.create( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + access_mode="ro", + ip_address="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + access_rule = response.parse() + assert_matches_type(AccessRule, access_rule, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.file_shares.access_rules.with_streaming_response.create( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + access_mode="ro", + ip_address="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + access_rule = response.parse() + assert_matches_type(AccessRule, access_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + client.cloud.file_shares.access_rules.with_raw_response.create( + file_share_id="", + project_id=1, + region_id=1, + access_mode="ro", + ip_address="192.168.1.1", + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + access_rule = client.cloud.file_shares.access_rules.list( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + assert_matches_type(AccessRuleList, access_rule, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.file_shares.access_rules.with_raw_response.list( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + access_rule = response.parse() + assert_matches_type(AccessRuleList, access_rule, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.file_shares.access_rules.with_streaming_response.list( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + access_rule = response.parse() + assert_matches_type(AccessRuleList, access_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + client.cloud.file_shares.access_rules.with_raw_response.list( + file_share_id="", + project_id=1, + region_id=1, + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + access_rule = client.cloud.file_shares.access_rules.delete( + access_rule_id="4f09d7dd-f1f8-4352-b015-741b2192db47", + project_id=1, + region_id=1, + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + ) + assert access_rule is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.file_shares.access_rules.with_raw_response.delete( + access_rule_id="4f09d7dd-f1f8-4352-b015-741b2192db47", + project_id=1, + region_id=1, + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + access_rule = response.parse() + assert access_rule is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.file_shares.access_rules.with_streaming_response.delete( + access_rule_id="4f09d7dd-f1f8-4352-b015-741b2192db47", + project_id=1, + region_id=1, + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + access_rule = response.parse() + assert access_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + client.cloud.file_shares.access_rules.with_raw_response.delete( + access_rule_id="4f09d7dd-f1f8-4352-b015-741b2192db47", + project_id=1, + region_id=1, + file_share_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `access_rule_id` but received ''"): + client.cloud.file_shares.access_rules.with_raw_response.delete( + access_rule_id="", + project_id=1, + region_id=1, + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + ) + + +class TestAsyncAccessRules: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + access_rule = await async_client.cloud.file_shares.access_rules.create( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + access_mode="ro", + ip_address="192.168.1.1", + ) + assert_matches_type(AccessRule, access_rule, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.file_shares.access_rules.with_raw_response.create( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + access_mode="ro", + ip_address="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + access_rule = await response.parse() + assert_matches_type(AccessRule, access_rule, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.file_shares.access_rules.with_streaming_response.create( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + access_mode="ro", + ip_address="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + access_rule = await response.parse() + assert_matches_type(AccessRule, access_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + await async_client.cloud.file_shares.access_rules.with_raw_response.create( + file_share_id="", + project_id=1, + region_id=1, + access_mode="ro", + ip_address="192.168.1.1", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + access_rule = await async_client.cloud.file_shares.access_rules.list( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + assert_matches_type(AccessRuleList, access_rule, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.file_shares.access_rules.with_raw_response.list( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + access_rule = await response.parse() + assert_matches_type(AccessRuleList, access_rule, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.file_shares.access_rules.with_streaming_response.list( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + access_rule = await response.parse() + assert_matches_type(AccessRuleList, access_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + await async_client.cloud.file_shares.access_rules.with_raw_response.list( + file_share_id="", + project_id=1, + region_id=1, + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + access_rule = await async_client.cloud.file_shares.access_rules.delete( + access_rule_id="4f09d7dd-f1f8-4352-b015-741b2192db47", + project_id=1, + region_id=1, + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + ) + assert access_rule is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.file_shares.access_rules.with_raw_response.delete( + access_rule_id="4f09d7dd-f1f8-4352-b015-741b2192db47", + project_id=1, + region_id=1, + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + access_rule = await response.parse() + assert access_rule is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.file_shares.access_rules.with_streaming_response.delete( + access_rule_id="4f09d7dd-f1f8-4352-b015-741b2192db47", + project_id=1, + region_id=1, + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + access_rule = await response.parse() + assert access_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + await async_client.cloud.file_shares.access_rules.with_raw_response.delete( + access_rule_id="4f09d7dd-f1f8-4352-b015-741b2192db47", + project_id=1, + region_id=1, + file_share_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `access_rule_id` but received ''"): + await async_client.cloud.file_shares.access_rules.with_raw_response.delete( + access_rule_id="", + project_id=1, + region_id=1, + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + ) diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py new file mode 100644 index 00000000..5d39bccb --- /dev/null +++ b/tests/api_resources/cloud/test_file_shares.py @@ -0,0 +1,754 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import ( + FileShare, + TaskIDList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFileShares: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create_overload_1(self, client: Gcore) -> None: + file_share = client.cloud.file_shares.create( + project_id=1, + region_id=1, + name="test-share-file-system", + network={"network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8"}, + protocol="NFS", + size=5, + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: + file_share = client.cloud.file_shares.create( + project_id=1, + region_id=1, + name="test-share-file-system", + network={ + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + }, + protocol="NFS", + size=5, + access=[ + { + "access_mode": "ro", + "ip_address": "10.0.0.1", + } + ], + metadata={"my-tag": "my-tag-value"}, + volume_type="default_share_type", + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + def test_raw_response_create_overload_1(self, client: Gcore) -> None: + response = client.cloud.file_shares.with_raw_response.create( + project_id=1, + region_id=1, + name="test-share-file-system", + network={"network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8"}, + protocol="NFS", + size=5, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_1(self, client: Gcore) -> None: + with client.cloud.file_shares.with_streaming_response.create( + project_id=1, + region_id=1, + name="test-share-file-system", + network={"network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8"}, + protocol="NFS", + size=5, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_2(self, client: Gcore) -> None: + file_share = client.cloud.file_shares.create( + project_id=1, + region_id=1, + name="test-share-file-system", + protocol="NFS", + size=5, + volume_type="vast_share_type", + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: + file_share = client.cloud.file_shares.create( + project_id=1, + region_id=1, + name="test-share-file-system", + protocol="NFS", + size=5, + volume_type="vast_share_type", + metadata={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + def test_raw_response_create_overload_2(self, client: Gcore) -> None: + response = client.cloud.file_shares.with_raw_response.create( + project_id=1, + region_id=1, + name="test-share-file-system", + protocol="NFS", + size=5, + volume_type="vast_share_type", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_2(self, client: Gcore) -> None: + with client.cloud.file_shares.with_streaming_response.create( + project_id=1, + region_id=1, + name="test-share-file-system", + protocol="NFS", + size=5, + volume_type="vast_share_type", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + file_share = client.cloud.file_shares.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + name="my-resource", + ) + assert_matches_type(FileShare, file_share, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.file_shares.with_raw_response.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + name="my-resource", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = response.parse() + assert_matches_type(FileShare, file_share, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.file_shares.with_streaming_response.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + name="my-resource", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = response.parse() + assert_matches_type(FileShare, file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + client.cloud.file_shares.with_raw_response.update( + file_share_id="", + project_id=1, + region_id=1, + name="my-resource", + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + file_share = client.cloud.file_shares.list( + project_id=1, + region_id=1, + ) + assert_matches_type(SyncOffsetPage[FileShare], file_share, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + file_share = client.cloud.file_shares.list( + project_id=1, + region_id=1, + limit=1000, + offset=0, + ) + assert_matches_type(SyncOffsetPage[FileShare], file_share, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.file_shares.with_raw_response.list( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = response.parse() + assert_matches_type(SyncOffsetPage[FileShare], file_share, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.file_shares.with_streaming_response.list( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = response.parse() + assert_matches_type(SyncOffsetPage[FileShare], file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + file_share = client.cloud.file_shares.delete( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.file_shares.with_raw_response.delete( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.file_shares.with_streaming_response.delete( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + client.cloud.file_shares.with_raw_response.delete( + file_share_id="", + project_id=1, + region_id=1, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + file_share = client.cloud.file_shares.get( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + assert_matches_type(FileShare, file_share, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.file_shares.with_raw_response.get( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = response.parse() + assert_matches_type(FileShare, file_share, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.file_shares.with_streaming_response.get( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = response.parse() + assert_matches_type(FileShare, file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + client.cloud.file_shares.with_raw_response.get( + file_share_id="", + project_id=1, + region_id=1, + ) + + @parametrize + def test_method_resize(self, client: Gcore) -> None: + file_share = client.cloud.file_shares.resize( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + size=5, + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + def test_raw_response_resize(self, client: Gcore) -> None: + response = client.cloud.file_shares.with_raw_response.resize( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + size=5, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + def test_streaming_response_resize(self, client: Gcore) -> None: + with client.cloud.file_shares.with_streaming_response.resize( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + size=5, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_resize(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + client.cloud.file_shares.with_raw_response.resize( + file_share_id="", + project_id=1, + region_id=1, + size=5, + ) + + +class TestAsyncFileShares: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create_overload_1(self, async_client: AsyncGcore) -> None: + file_share = await async_client.cloud.file_shares.create( + project_id=1, + region_id=1, + name="test-share-file-system", + network={"network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8"}, + protocol="NFS", + size=5, + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + file_share = await async_client.cloud.file_shares.create( + project_id=1, + region_id=1, + name="test-share-file-system", + network={ + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + }, + protocol="NFS", + size=5, + access=[ + { + "access_mode": "ro", + "ip_address": "10.0.0.1", + } + ], + metadata={"my-tag": "my-tag-value"}, + volume_type="default_share_type", + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.file_shares.with_raw_response.create( + project_id=1, + region_id=1, + name="test-share-file-system", + network={"network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8"}, + protocol="NFS", + size=5, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = await response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.file_shares.with_streaming_response.create( + project_id=1, + region_id=1, + name="test-share-file-system", + network={"network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8"}, + protocol="NFS", + size=5, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = await response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_2(self, async_client: AsyncGcore) -> None: + file_share = await async_client.cloud.file_shares.create( + project_id=1, + region_id=1, + name="test-share-file-system", + protocol="NFS", + size=5, + volume_type="vast_share_type", + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + file_share = await async_client.cloud.file_shares.create( + project_id=1, + region_id=1, + name="test-share-file-system", + protocol="NFS", + size=5, + volume_type="vast_share_type", + metadata={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.file_shares.with_raw_response.create( + project_id=1, + region_id=1, + name="test-share-file-system", + protocol="NFS", + size=5, + volume_type="vast_share_type", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = await response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.file_shares.with_streaming_response.create( + project_id=1, + region_id=1, + name="test-share-file-system", + protocol="NFS", + size=5, + volume_type="vast_share_type", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = await response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + file_share = await async_client.cloud.file_shares.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + name="my-resource", + ) + assert_matches_type(FileShare, file_share, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.file_shares.with_raw_response.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + name="my-resource", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = await response.parse() + assert_matches_type(FileShare, file_share, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.file_shares.with_streaming_response.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + name="my-resource", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = await response.parse() + assert_matches_type(FileShare, file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + await async_client.cloud.file_shares.with_raw_response.update( + file_share_id="", + project_id=1, + region_id=1, + name="my-resource", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + file_share = await async_client.cloud.file_shares.list( + project_id=1, + region_id=1, + ) + assert_matches_type(AsyncOffsetPage[FileShare], file_share, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + file_share = await async_client.cloud.file_shares.list( + project_id=1, + region_id=1, + limit=1000, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[FileShare], file_share, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.file_shares.with_raw_response.list( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = await response.parse() + assert_matches_type(AsyncOffsetPage[FileShare], file_share, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.file_shares.with_streaming_response.list( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = await response.parse() + assert_matches_type(AsyncOffsetPage[FileShare], file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + file_share = await async_client.cloud.file_shares.delete( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.file_shares.with_raw_response.delete( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = await response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.file_shares.with_streaming_response.delete( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = await response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + await async_client.cloud.file_shares.with_raw_response.delete( + file_share_id="", + project_id=1, + region_id=1, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + file_share = await async_client.cloud.file_shares.get( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + assert_matches_type(FileShare, file_share, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.file_shares.with_raw_response.get( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = await response.parse() + assert_matches_type(FileShare, file_share, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.file_shares.with_streaming_response.get( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = await response.parse() + assert_matches_type(FileShare, file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + await async_client.cloud.file_shares.with_raw_response.get( + file_share_id="", + project_id=1, + region_id=1, + ) + + @parametrize + async def test_method_resize(self, async_client: AsyncGcore) -> None: + file_share = await async_client.cloud.file_shares.resize( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + size=5, + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.file_shares.with_raw_response.resize( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + size=5, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_share = await response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + @parametrize + async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.file_shares.with_streaming_response.resize( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + size=5, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_share = await response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_resize(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + await async_client.cloud.file_shares.with_raw_response.resize( + file_share_id="", + project_id=1, + region_id=1, + size=5, + ) From 4b02c8709d91425f117ef60ac0cdd57dfb87b57c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 10:41:03 +0000 Subject: [PATCH 069/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 7 +- src/gcore/resources/cloud/networks/routers.py | 9 +- src/gcore/resources/cloud/networks/subnets.py | 9 +- src/gcore/resources/cloud/quotas/requests.py | 24 +- src/gcore/types/cloud/__init__.py | 2 + src/gcore/types/cloud/floating_ip_detailed.py | 37 +- src/gcore/types/cloud/load_balancer.py | 22 +- src/gcore/types/cloud/networks/router.py | 26 +- .../cloud/networks/router_create_params.py | 19 +- .../cloud/networks/router_update_params.py | 20 +- .../cloud/networks/subnet_create_params.py | 19 +- .../cloud/networks/subnet_update_params.py | 22 +- src/gcore/types/cloud/neutron_route.py | 19 + src/gcore/types/cloud/neutron_route_param.py | 21 + src/gcore/types/cloud/quotas/__init__.py | 1 - .../cloud/quotas/request_list_response.py | 394 ------------------ src/gcore/types/cloud/subnet.py | 19 +- src/gcore/types/cloud/volume.py | 1 - .../cloud/quotas/test_requests.py | 19 +- 20 files changed, 139 insertions(+), 555 deletions(-) create mode 100644 src/gcore/types/cloud/neutron_route.py create mode 100644 src/gcore/types/cloud/neutron_route_param.py delete mode 100644 src/gcore/types/cloud/quotas/request_list_response.py diff --git a/.stats.yml b/.stats.yml index b40a1996..42ea4dc9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7dc53a8ce0e8691975b00337faf79d130814c518bd2678a6c54a1603ede12331.yml -openapi_spec_hash: ea94cdbb22dfb693d9044f23f631fb1a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c0ddd251e17b7132e029bd882ca5724bfc8cf506b5c471c52aac7996593de1a8.yml +openapi_spec_hash: 852c6dc29b57bb698cf759b01428dad5 config_hash: dfebad2c06187795c7c950365600d24e diff --git a/api.md b/api.md index 27143715..b3de2060 100644 --- a/api.md +++ b/api.md @@ -4,6 +4,7 @@ Types: ```python from gcore.types.cloud import ( + BaremetalFlavorList, Console, DDOSProfile, DDOSProfileField, @@ -25,6 +26,8 @@ from gcore.types.cloud import ( LoadBalancerOperatingStatus, LoadBalancerStatistics, Network, + NeutronRoute, + PortList, ProvisioningStatus, Subnet, Tag, @@ -96,13 +99,13 @@ Methods: Types: ```python -from gcore.types.cloud.quotas import RequestListResponse, RequestGetResponse +from gcore.types.cloud.quotas import RequestGetResponse ``` Methods: - client.cloud.quotas.requests.create(\*\*params) -> None -- client.cloud.quotas.requests.list(\*\*params) -> SyncOffsetPage[RequestListResponse] +- client.cloud.quotas.requests.list(\*\*params) -> None - client.cloud.quotas.requests.delete(request_id) -> None - client.cloud.quotas.requests.get(request_id) -> RequestGetResponse diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index ba41b13b..4f42131b 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -27,6 +27,7 @@ ) from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.networks.router import Router +from ....types.cloud.neutron_route_param import NeutronRouteParam __all__ = ["RoutersResource", "AsyncRoutersResource"] @@ -59,7 +60,7 @@ def create( name: str, external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, interfaces: Optional[Iterable[router_create_params.Interface]] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[router_create_params.Route]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -126,7 +127,7 @@ def update( region_id: int | None = None, external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[router_update_params.Route]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -478,7 +479,7 @@ async def create( name: str, external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, interfaces: Optional[Iterable[router_create_params.Interface]] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[router_create_params.Route]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -545,7 +546,7 @@ async def update( region_id: int | None = None, external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[router_update_params.Route]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 5c619b21..c2066910 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -24,6 +24,7 @@ from ....types.cloud.networks import subnet_list_params, subnet_create_params, subnet_update_params from ....types.cloud.ip_version import IPVersion from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.neutron_route_param import NeutronRouteParam __all__ = ["SubnetsResource", "AsyncSubnetsResource"] @@ -60,7 +61,7 @@ def create( dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, enable_dhcp: bool | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, @@ -159,7 +160,7 @@ def update( dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -453,7 +454,7 @@ async def create( dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, enable_dhcp: bool | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, @@ -552,7 +553,7 @@ async def update( dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index eefc7328..fc98fc3b 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -17,11 +17,9 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ...._base_client import AsyncPaginator, make_request_options +from ...._base_client import make_request_options from ....types.cloud.quotas import request_list_params, request_create_params from ....types.cloud.quotas.request_get_response import RequestGetResponse -from ....types.cloud.quotas.request_list_response import RequestListResponse __all__ = ["RequestsResource", "AsyncRequestsResource"] @@ -109,7 +107,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[RequestListResponse]: + ) -> None: """ Returns a list of sent requests to change current quotas and their statuses @@ -131,9 +129,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._get( "/cloud/v2/limits_request", - page=SyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -148,7 +146,7 @@ def list( request_list_params.RequestListParams, ), ), - model=RequestListResponse, + cast_to=NoneType, ) def delete( @@ -296,7 +294,7 @@ async def create( cast_to=NoneType, ) - def list( + async def list( self, *, limit: int | NotGiven = NOT_GIVEN, @@ -308,7 +306,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[RequestListResponse, AsyncOffsetPage[RequestListResponse]]: + ) -> None: """ Returns a list of sent requests to change current quotas and their statuses @@ -330,15 +328,15 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._get( "/cloud/v2/limits_request", - page=AsyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform( + query=await async_maybe_transform( { "limit": limit, "offset": offset, @@ -347,7 +345,7 @@ def list( request_list_params.RequestListParams, ), ), - model=RequestListResponse, + cast_to=NoneType, ) async def delete( diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 8cb2fc91..a1b0a1fd 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -20,6 +20,7 @@ from .ddos_profile import DDOSProfile as DDOSProfile from .task_id_list import TaskIDList as TaskIDList from .load_balancer import LoadBalancer as LoadBalancer +from .neutron_route import NeutronRoute as NeutronRoute from .security_group import SecurityGroup as SecurityGroup from .ssh_key_created import SSHKeyCreated as SSHKeyCreated from .task_list_params import TaskListParams as TaskListParams @@ -31,6 +32,7 @@ from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .network_list_params import NetworkListParams as NetworkListParams +from .neutron_route_param import NeutronRouteParam as NeutronRouteParam from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus from .security_group_rule import SecurityGroupRule as SecurityGroupRule diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index c9013de2..738b9ae9 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -13,7 +13,8 @@ "FloatingIPDetailed", "Instance", "InstanceAddress", - "InstanceAddressAddressSerializer", + "InstanceAddressSimpleAddressSerializer", + "InstanceAddressAddressInterfaceSerializer", "InstanceAddressAddressDetailedSerializer", "InstanceFlavor", "InstanceSecurityGroup", @@ -21,23 +22,37 @@ ] -class InstanceAddressAddressSerializer(BaseModel): +class InstanceAddressSimpleAddressSerializer(BaseModel): addr: str """ - '#/components/schemas/AddressSerializer/properties/addr' - "$.components.schemas.AddressSerializer.properties.addr" + '#/components/schemas/SimpleAddressSerializer/properties/addr' + "$.components.schemas.SimpleAddressSerializer.properties.addr" + """ + + type: str + """ + '#/components/schemas/SimpleAddressSerializer/properties/type' + "$.components.schemas.SimpleAddressSerializer.properties.type" + """ + + +class InstanceAddressAddressInterfaceSerializer(BaseModel): + addr: str + """ + '#/components/schemas/AddressInterfaceSerializer/properties/addr' + "$.components.schemas.AddressInterfaceSerializer.properties.addr" """ interface_name: Optional[str] = None """ - '#/components/schemas/AddressSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.AddressSerializer.properties.interface_name.anyOf[0]" + '#/components/schemas/AddressInterfaceSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.AddressInterfaceSerializer.properties.interface_name.anyOf[0]" """ type: str """ - '#/components/schemas/AddressSerializer/properties/type' - "$.components.schemas.AddressSerializer.properties.type" + '#/components/schemas/AddressInterfaceSerializer/properties/type' + "$.components.schemas.AddressInterfaceSerializer.properties.type" """ @@ -73,7 +88,11 @@ class InstanceAddressAddressDetailedSerializer(BaseModel): """ -InstanceAddress: TypeAlias = Union[InstanceAddressAddressSerializer, InstanceAddressAddressDetailedSerializer] +InstanceAddress: TypeAlias = Union[ + InstanceAddressSimpleAddressSerializer, + InstanceAddressAddressInterfaceSerializer, + InstanceAddressAddressDetailedSerializer, +] class InstanceFlavor(BaseModel): diff --git a/src/gcore/types/cloud/load_balancer.py b/src/gcore/types/cloud/load_balancer.py index b883c3b4..58077913 100644 --- a/src/gcore/types/cloud/load_balancer.py +++ b/src/gcore/types/cloud/load_balancer.py @@ -76,26 +76,26 @@ class LoggingRetentionPolicy(BaseModel): class Logging(BaseModel): destination_region_id: Optional[int] = None """ - '#/components/schemas/LoggingOutSerializer/properties/destination_region_id/anyOf/0' - "$.components.schemas.LoggingOutSerializer.properties.destination_region_id.anyOf[0]" + '#/components/schemas/LoadbalancerLoggingSerializer/properties/destination_region_id/anyOf/0' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.destination_region_id.anyOf[0]" """ - enabled: bool + enabled: Optional[bool] = None """ - '#/components/schemas/LoggingOutSerializer/properties/enabled' - "$.components.schemas.LoggingOutSerializer.properties.enabled" + '#/components/schemas/LoadbalancerLoggingSerializer/properties/enabled' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.enabled" """ - topic_name: Optional[str] = None + retention_policy: Optional[LoggingRetentionPolicy] = None """ - '#/components/schemas/LoggingOutSerializer/properties/topic_name/anyOf/0' - "$.components.schemas.LoggingOutSerializer.properties.topic_name.anyOf[0]" + '#/components/schemas/LoadbalancerLoggingSerializer/properties/retention_policy/anyOf/0' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.retention_policy.anyOf[0]" """ - retention_policy: Optional[LoggingRetentionPolicy] = None + topic_name: Optional[str] = None """ - '#/components/schemas/LoggingOutSerializer/properties/retention_policy/anyOf/0' - "$.components.schemas.LoggingOutSerializer.properties.retention_policy.anyOf[0]" + '#/components/schemas/LoadbalancerLoggingSerializer/properties/topic_name/anyOf/0' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.topic_name.anyOf[0]" """ diff --git a/src/gcore/types/cloud/networks/router.py b/src/gcore/types/cloud/networks/router.py index 53a33e9a..dfe2fb5f 100644 --- a/src/gcore/types/cloud/networks/router.py +++ b/src/gcore/types/cloud/networks/router.py @@ -4,15 +4,9 @@ from datetime import datetime from ...._models import BaseModel +from ..neutron_route import NeutronRoute -__all__ = [ - "Router", - "Interface", - "InterfaceIPAssignment", - "Route", - "ExternalGatewayInfo", - "ExternalGatewayInfoExternalFixedIP", -] +__all__ = ["Router", "Interface", "InterfaceIPAssignment", "ExternalGatewayInfo", "ExternalGatewayInfoExternalFixedIP"] class InterfaceIPAssignment(BaseModel): @@ -55,20 +49,6 @@ class Interface(BaseModel): """ -class Route(BaseModel): - destination: str - """ - '#/components/schemas/RouteOutSerializer/properties/destination' - "$.components.schemas.RouteOutSerializer.properties.destination" - """ - - nexthop: str - """ - '#/components/schemas/RouteOutSerializer/properties/nexthop' - "$.components.schemas.RouteOutSerializer.properties.nexthop" - """ - - class ExternalGatewayInfoExternalFixedIP(BaseModel): ip_address: str """ @@ -152,7 +132,7 @@ class Router(BaseModel): "$.components.schemas.RouterSerializer.properties.region_id" """ - routes: List[Route] + routes: List[NeutronRoute] """ '#/components/schemas/RouterSerializer/properties/routes' "$.components.schemas.RouterSerializer.properties.routes" diff --git a/src/gcore/types/cloud/networks/router_create_params.py b/src/gcore/types/cloud/networks/router_create_params.py index b0422a10..b47d07a6 100644 --- a/src/gcore/types/cloud/networks/router_create_params.py +++ b/src/gcore/types/cloud/networks/router_create_params.py @@ -5,13 +5,14 @@ from typing import Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict +from ..neutron_route_param import NeutronRouteParam + __all__ = [ "RouterCreateParams", "ExternalGatewayInfo", "ExternalGatewayInfoRouterExternalManualGwSerializer", "ExternalGatewayInfoRouterExternalDefaultGwSerializer", "Interface", - "Route", ] @@ -46,7 +47,7 @@ class RouterCreateParams(TypedDict, total=False): "$.components.schemas.CreateRouterSerializer.properties.interfaces.anyOf[0]" """ - routes: Optional[Iterable[Route]] + routes: Optional[Iterable[NeutronRouteParam]] """ '#/components/schemas/CreateRouterSerializer/properties/routes/anyOf/0' "$.components.schemas.CreateRouterSerializer.properties.routes.anyOf[0]" @@ -104,17 +105,3 @@ class Interface(TypedDict, total=False): '#/components/schemas/CreateRouterInterfaceSubnetSerializer/properties/type' "$.components.schemas.CreateRouterInterfaceSubnetSerializer.properties.type" """ - - -class Route(TypedDict, total=False): - destination: Required[str] - """ - '#/components/schemas/RouteInSerializer/properties/destination' - "$.components.schemas.RouteInSerializer.properties.destination" - """ - - nexthop: Required[str] - """ - '#/components/schemas/RouteInSerializer/properties/nexthop' - "$.components.schemas.RouteInSerializer.properties.nexthop" - """ diff --git a/src/gcore/types/cloud/networks/router_update_params.py b/src/gcore/types/cloud/networks/router_update_params.py index 29c33e1f..53aab8f1 100644 --- a/src/gcore/types/cloud/networks/router_update_params.py +++ b/src/gcore/types/cloud/networks/router_update_params.py @@ -5,7 +5,9 @@ from typing import Iterable, Optional from typing_extensions import Literal, Required, TypedDict -__all__ = ["RouterUpdateParams", "ExternalGatewayInfo", "Route"] +from ..neutron_route_param import NeutronRouteParam + +__all__ = ["RouterUpdateParams", "ExternalGatewayInfo"] class RouterUpdateParams(TypedDict, total=False): @@ -33,7 +35,7 @@ class RouterUpdateParams(TypedDict, total=False): "$.components.schemas.PatchRouterSerializer.properties.name.anyOf[0]" """ - routes: Optional[Iterable[Route]] + routes: Optional[Iterable[NeutronRouteParam]] """ '#/components/schemas/PatchRouterSerializer/properties/routes/anyOf/0' "$.components.schemas.PatchRouterSerializer.properties.routes.anyOf[0]" @@ -58,17 +60,3 @@ class ExternalGatewayInfo(TypedDict, total=False): '#/components/schemas/RouterExternalManualGwSerializer/properties/type' "$.components.schemas.RouterExternalManualGwSerializer.properties.type" """ - - -class Route(TypedDict, total=False): - destination: Required[str] - """ - '#/components/schemas/RouteInSerializer/properties/destination' - "$.components.schemas.RouteInSerializer.properties.destination" - """ - - nexthop: Required[str] - """ - '#/components/schemas/RouteInSerializer/properties/nexthop' - "$.components.schemas.RouteInSerializer.properties.nexthop" - """ diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index e4fde91d..0801eb1c 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -6,8 +6,9 @@ from typing_extensions import Required, TypedDict from ..ip_version import IPVersion +from ..neutron_route_param import NeutronRouteParam -__all__ = ["SubnetCreateParams", "HostRoute"] +__all__ = ["SubnetCreateParams"] class SubnetCreateParams(TypedDict, total=False): @@ -65,7 +66,7 @@ class SubnetCreateParams(TypedDict, total=False): "$.components.schemas.CreateSubnetSerializer.properties.gateway_ip.anyOf[0]" """ - host_routes: Optional[Iterable[HostRoute]] + host_routes: Optional[Iterable[NeutronRouteParam]] """ '#/components/schemas/CreateSubnetSerializer/properties/host_routes/anyOf/0' "$.components.schemas.CreateSubnetSerializer.properties.host_routes.anyOf[0]" @@ -88,17 +89,3 @@ class SubnetCreateParams(TypedDict, total=False): '#/components/schemas/CreateSubnetSerializer/properties/router_id_to_connect/anyOf/0' "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" """ - - -class HostRoute(TypedDict, total=False): - destination: Required[str] - """ - '#/components/schemas/RouteInSerializer/properties/destination' - "$.components.schemas.RouteInSerializer.properties.destination" - """ - - nexthop: Required[str] - """ - '#/components/schemas/RouteInSerializer/properties/nexthop' - "$.components.schemas.RouteInSerializer.properties.nexthop" - """ diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index ca79f228..aa96d08b 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -3,9 +3,11 @@ from __future__ import annotations from typing import List, Iterable, Optional -from typing_extensions import Required, TypedDict +from typing_extensions import TypedDict -__all__ = ["SubnetUpdateParams", "HostRoute"] +from ..neutron_route_param import NeutronRouteParam + +__all__ = ["SubnetUpdateParams"] class SubnetUpdateParams(TypedDict, total=False): @@ -39,7 +41,7 @@ class SubnetUpdateParams(TypedDict, total=False): "$.components.schemas.PatchSubnetSerializer.properties.gateway_ip.anyOf[0]" """ - host_routes: Optional[Iterable[HostRoute]] + host_routes: Optional[Iterable[NeutronRouteParam]] """ '#/components/schemas/PatchSubnetSerializer/properties/host_routes/anyOf/0' "$.components.schemas.PatchSubnetSerializer.properties.host_routes.anyOf[0]" @@ -50,17 +52,3 @@ class SubnetUpdateParams(TypedDict, total=False): '#/components/schemas/PatchSubnetSerializer/properties/name/anyOf/0' "$.components.schemas.PatchSubnetSerializer.properties.name.anyOf[0]" """ - - -class HostRoute(TypedDict, total=False): - destination: Required[str] - """ - '#/components/schemas/RouteInSerializer/properties/destination' - "$.components.schemas.RouteInSerializer.properties.destination" - """ - - nexthop: Required[str] - """ - '#/components/schemas/RouteInSerializer/properties/nexthop' - "$.components.schemas.RouteInSerializer.properties.nexthop" - """ diff --git a/src/gcore/types/cloud/neutron_route.py b/src/gcore/types/cloud/neutron_route.py new file mode 100644 index 00000000..59eea1e8 --- /dev/null +++ b/src/gcore/types/cloud/neutron_route.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["NeutronRoute"] + + +class NeutronRoute(BaseModel): + destination: str + """ + '#/components/schemas/NeutronRouteSerializer/properties/destination' + "$.components.schemas.NeutronRouteSerializer.properties.destination" + """ + + nexthop: str + """ + '#/components/schemas/NeutronRouteSerializer/properties/nexthop' + "$.components.schemas.NeutronRouteSerializer.properties.nexthop" + """ diff --git a/src/gcore/types/cloud/neutron_route_param.py b/src/gcore/types/cloud/neutron_route_param.py new file mode 100644 index 00000000..24651682 --- /dev/null +++ b/src/gcore/types/cloud/neutron_route_param.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 Required, TypedDict + +__all__ = ["NeutronRouteParam"] + + +class NeutronRouteParam(TypedDict, total=False): + destination: Required[str] + """ + '#/components/schemas/NeutronRouteSerializer/properties/destination' + "$.components.schemas.NeutronRouteSerializer.properties.destination" + """ + + nexthop: Required[str] + """ + '#/components/schemas/NeutronRouteSerializer/properties/nexthop' + "$.components.schemas.NeutronRouteSerializer.properties.nexthop" + """ diff --git a/src/gcore/types/cloud/quotas/__init__.py b/src/gcore/types/cloud/quotas/__init__.py index 600a55cb..8bf1b202 100644 --- a/src/gcore/types/cloud/quotas/__init__.py +++ b/src/gcore/types/cloud/quotas/__init__.py @@ -5,4 +5,3 @@ from .request_list_params import RequestListParams as RequestListParams from .request_get_response import RequestGetResponse as RequestGetResponse from .request_create_params import RequestCreateParams as RequestCreateParams -from .request_list_response import RequestListResponse as RequestListResponse diff --git a/src/gcore/types/cloud/quotas/request_list_response.py b/src/gcore/types/cloud/quotas/request_list_response.py deleted file mode 100644 index 7d043c9c..00000000 --- a/src/gcore/types/cloud/quotas/request_list_response.py +++ /dev/null @@ -1,394 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["RequestListResponse", "RequestedLimits", "RequestedLimitsGlobalLimits", "RequestedLimitsRegionalLimit"] - - -class RequestedLimitsGlobalLimits(BaseModel): - inference_cpu_millicore_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_cpu_millicore_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_cpu_millicore_count_limit" - """ - - inference_gpu_a100_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_a100_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_a100_count_limit" - """ - - inference_gpu_h100_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_h100_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_h100_count_limit" - """ - - inference_gpu_l40s_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_l40s_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_l40s_count_limit" - """ - - inference_instance_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_instance_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_instance_count_limit" - """ - - keypair_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/keypair_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.keypair_count_limit" - """ - - project_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/project_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.project_count_limit" - """ - - -class RequestedLimitsRegionalLimit(BaseModel): - baremetal_basic_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_basic_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_basic_count_limit" - """ - - baremetal_gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_gpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_gpu_count_limit" - """ - - baremetal_hf_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_hf_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_hf_count_limit" - """ - - baremetal_infrastructure_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_infrastructure_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_infrastructure_count_limit" - """ - - baremetal_network_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_network_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_network_count_limit" - """ - - baremetal_storage_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_storage_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_storage_count_limit" - """ - - caas_container_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_container_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_container_count_limit" - """ - - caas_cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_cpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_cpu_count_limit" - """ - - caas_gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_gpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_gpu_count_limit" - """ - - caas_ram_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_ram_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_ram_size_limit" - """ - - cluster_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cluster_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cluster_count_limit" - """ - - cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cpu_count_limit" - """ - - dbaas_postgres_cluster_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/dbaas_postgres_cluster_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.dbaas_postgres_cluster_count_limit" - """ - - external_ip_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/external_ip_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.external_ip_count_limit" - """ - - faas_cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_cpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_cpu_count_limit" - """ - - faas_function_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_function_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_function_count_limit" - """ - - faas_namespace_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_namespace_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_namespace_count_limit" - """ - - faas_ram_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_ram_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_ram_size_limit" - """ - - firewall_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/firewall_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.firewall_count_limit" - """ - - floating_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/floating_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.floating_count_limit" - """ - - gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_count_limit" - """ - - gpu_virtual_a100_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_a100_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_a100_count_limit" - """ - - gpu_virtual_h100_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_h100_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_h100_count_limit" - """ - - gpu_virtual_l40s_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_l40s_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_l40s_count_limit" - """ - - image_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_count_limit" - """ - - image_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_size_limit" - """ - - ipu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ipu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ipu_count_limit" - """ - - laas_topic_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/laas_topic_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.laas_topic_count_limit" - """ - - loadbalancer_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/loadbalancer_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.loadbalancer_count_limit" - """ - - network_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/network_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.network_count_limit" - """ - - ram_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ram_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ram_limit" - """ - - region_id: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/region_id' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.region_id" - """ - - registry_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_count_limit" - """ - - registry_storage_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_storage_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_storage_limit" - """ - - router_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/router_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.router_count_limit" - """ - - secret_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/secret_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.secret_count_limit" - """ - - servergroup_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/servergroup_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.servergroup_count_limit" - """ - - sfs_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_count_limit" - """ - - sfs_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_size_limit" - """ - - shared_vm_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/shared_vm_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.shared_vm_count_limit" - """ - - snapshot_schedule_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/snapshot_schedule_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.snapshot_schedule_count_limit" - """ - - subnet_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/subnet_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.subnet_count_limit" - """ - - vm_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/vm_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.vm_count_limit" - """ - - volume_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_count_limit" - """ - - volume_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_size_limit" - """ - - volume_snapshots_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_count_limit" - """ - - volume_snapshots_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_size_limit" - """ - - -class RequestedLimits(BaseModel): - global_limits: Optional[RequestedLimitsGlobalLimits] = None - """ - '#/components/schemas/AllClientQuotasLimitsSerializer/properties/global_limits' - "$.components.schemas.AllClientQuotasLimitsSerializer.properties.global_limits" - """ - - regional_limits: Optional[List[RequestedLimitsRegionalLimit]] = None - """ - '#/components/schemas/AllClientQuotasLimitsSerializer/properties/regional_limits' - "$.components.schemas.AllClientQuotasLimitsSerializer.properties.regional_limits" - """ - - -class RequestListResponse(BaseModel): - id: int - """ - '#/components/schemas/LimitsRequestSerializer/properties/id' - "$.components.schemas.LimitsRequestSerializer.properties.id" - """ - - client_id: int - """ - '#/components/schemas/LimitsRequestSerializer/properties/client_id' - "$.components.schemas.LimitsRequestSerializer.properties.client_id" - """ - - requested_limits: RequestedLimits - """ - '#/components/schemas/LimitsRequestSerializer/properties/requested_limits' - "$.components.schemas.LimitsRequestSerializer.properties.requested_limits" - """ - - status: str - """ - '#/components/schemas/LimitsRequestSerializer/properties/status' - "$.components.schemas.LimitsRequestSerializer.properties.status" - """ - - created_at: Optional[datetime] = None - """ - '#/components/schemas/LimitsRequestSerializer/properties/created_at' - "$.components.schemas.LimitsRequestSerializer.properties.created_at" - """ - - description: Optional[str] = None - """ - '#/components/schemas/LimitsRequestSerializer/properties/description/anyOf/0' - "$.components.schemas.LimitsRequestSerializer.properties.description.anyOf[0]" - """ - - updated_at: Optional[datetime] = None - """ - '#/components/schemas/LimitsRequestSerializer/properties/updated_at/anyOf/0' - "$.components.schemas.LimitsRequestSerializer.properties.updated_at.anyOf[0]" - """ diff --git a/src/gcore/types/cloud/subnet.py b/src/gcore/types/cloud/subnet.py index 9b4420b3..943cee49 100644 --- a/src/gcore/types/cloud/subnet.py +++ b/src/gcore/types/cloud/subnet.py @@ -6,22 +6,9 @@ from .tag import Tag from ..._models import BaseModel from .ip_version import IPVersion +from .neutron_route import NeutronRoute -__all__ = ["Subnet", "HostRoute"] - - -class HostRoute(BaseModel): - destination: str - """ - '#/components/schemas/RouteOutSerializer/properties/destination' - "$.components.schemas.RouteOutSerializer.properties.destination" - """ - - nexthop: str - """ - '#/components/schemas/RouteOutSerializer/properties/nexthop' - "$.components.schemas.RouteOutSerializer.properties.nexthop" - """ +__all__ = ["Subnet"] class Subnet(BaseModel): @@ -127,7 +114,7 @@ class Subnet(BaseModel): "$.components.schemas.SubnetSerializer.properties.has_router" """ - host_routes: Optional[List[HostRoute]] = None + host_routes: Optional[List[NeutronRoute]] = None """ '#/components/schemas/SubnetSerializer/properties/host_routes/anyOf/0' "$.components.schemas.SubnetSerializer.properties.host_routes.anyOf[0]" diff --git a/src/gcore/types/cloud/volume.py b/src/gcore/types/cloud/volume.py index c5655971..dadcb691 100644 --- a/src/gcore/types/cloud/volume.py +++ b/src/gcore/types/cloud/volume.py @@ -163,7 +163,6 @@ class Volume(BaseModel): "reserved", "restoring-backup", "retyping", - "reverting", "uploading", ] """ diff --git a/tests/api_resources/cloud/quotas/test_requests.py b/tests/api_resources/cloud/quotas/test_requests.py index 55d95441..4cb9bf1b 100644 --- a/tests/api_resources/cloud/quotas/test_requests.py +++ b/tests/api_resources/cloud/quotas/test_requests.py @@ -9,8 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.cloud.quotas import RequestGetResponse, RequestListResponse +from gcore.types.cloud.quotas import RequestGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -125,7 +124,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: request = client.cloud.quotas.requests.list() - assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) + assert request is None @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -134,7 +133,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: offset=0, status=["done", "in progress"], ) - assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) + assert request is None @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -143,7 +142,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) + assert request is None @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -152,7 +151,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) + assert request is None assert cast(Any, response.is_closed) is True @@ -343,7 +342,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: request = await async_client.cloud.quotas.requests.list() - assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) + assert request is None @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -352,7 +351,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No offset=0, status=["done", "in progress"], ) - assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) + assert request is None @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -361,7 +360,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) + assert request is None @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -370,7 +369,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) + assert request is None assert cast(Any, response.is_closed) is True From efa3acc7eec1d42d99296b1a68b127ee3f4bfa62 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 11:52:58 +0000 Subject: [PATCH 070/592] Rename cloud client opts --- .stats.yml | 2 +- src/gcore/_client.py | 116 +++++++++--------- src/gcore/resources/cloud/baremetal/images.py | 8 +- .../cloud/file_shares/access_rules.py | 24 ++-- .../cloud/file_shares/file_shares.py | 48 ++++---- src/gcore/resources/cloud/floating_ips.py | 48 ++++---- src/gcore/resources/cloud/instances/images.py | 48 ++++---- .../resources/cloud/networks/networks.py | 40 +++--- src/gcore/resources/cloud/networks/routers.py | 56 ++++----- src/gcore/resources/cloud/networks/subnets.py | 40 +++--- src/gcore/resources/cloud/projects.py | 12 +- src/gcore/resources/cloud/quotas/quotas.py | 4 +- src/gcore/resources/cloud/regions.py | 4 +- .../reserved_fixed_ips/reserved_fixed_ips.py | 32 ++--- .../resources/cloud/reserved_fixed_ips/vip.py | 40 +++--- src/gcore/resources/cloud/secrets.py | 40 +++--- .../resources/cloud/security_groups/rules.py | 24 ++-- .../cloud/security_groups/security_groups.py | 56 ++++----- src/gcore/resources/cloud/ssh_keys.py | 20 +-- src/gcore/resources/cloud/volumes.py | 80 ++++++------ tests/test_client.py | 24 ++-- 21 files changed, 383 insertions(+), 383 deletions(-) diff --git a/.stats.yml b/.stats.yml index 42ea4dc9..ece90500 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c0ddd251e17b7132e029bd882ca5724bfc8cf506b5c471c52aac7996593de1a8.yml openapi_spec_hash: 852c6dc29b57bb698cf759b01428dad5 -config_hash: dfebad2c06187795c7c950365600d24e +config_hash: 8868cada96234911a473ad3806ffe3c0 diff --git a/src/gcore/_client.py b/src/gcore/_client.py index f9a696a6..7ee5ab00 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -40,17 +40,17 @@ class Gcore(SyncAPIClient): # client options api_key: str - project_id: int | None - region_id: int | None - polling_interval_ms: int | None + cloud_project_id: int | None + cloud_region_id: int | None + cloud_polling_interval_ms: int | None def __init__( self, *, api_key: str | None = None, - project_id: int | None = None, - region_id: int | None = None, - polling_interval_ms: int | None = 1000, + cloud_project_id: int | None = None, + cloud_region_id: int | None = None, + cloud_polling_interval_ms: int | None = 1000, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, @@ -74,8 +74,8 @@ def __init__( This automatically infers the following arguments from their corresponding environment variables if they are not provided: - `api_key` from `GCORE_API_KEY` - - `project_id` from `GCORE_PROJECT` - - `region_id` from `GCORE_REGION` + - `cloud_project_id` from `GCORE_CLOUD_PROJECT_ID` + - `cloud_region_id` from `GCORE_CLOUD_REGION_ID` """ if api_key is None: api_key = os.environ.get("GCORE_API_KEY") @@ -85,17 +85,17 @@ def __init__( ) self.api_key = api_key - if project_id is None: - project_id = maybe_coerce_integer(os.environ.get("GCORE_PROJECT")) - self.project_id = project_id + if cloud_project_id is None: + cloud_project_id = maybe_coerce_integer(os.environ.get("GCORE_CLOUD_PROJECT_ID")) + self.cloud_project_id = cloud_project_id - if region_id is None: - region_id = maybe_coerce_integer(os.environ.get("GCORE_REGION")) - self.region_id = region_id + if cloud_region_id is None: + cloud_region_id = maybe_coerce_integer(os.environ.get("GCORE_CLOUD_REGION_ID")) + self.cloud_region_id = cloud_region_id - if polling_interval_ms is None: - polling_interval_ms = 1000 - self.polling_interval_ms = polling_interval_ms + if cloud_polling_interval_ms is None: + cloud_polling_interval_ms = 1000 + self.cloud_polling_interval_ms = cloud_polling_interval_ms if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") @@ -141,9 +141,9 @@ def copy( self, *, api_key: str | None = None, - project_id: int | None = None, - region_id: int | None = None, - polling_interval_ms: int | None = None, + cloud_project_id: int | None = None, + cloud_region_id: int | None = None, + cloud_polling_interval_ms: int | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.Client | None = None, @@ -178,9 +178,9 @@ def copy( http_client = http_client or self._client return self.__class__( api_key=api_key or self.api_key, - project_id=project_id or self.project_id, - region_id=region_id or self.region_id, - polling_interval_ms=polling_interval_ms or self.polling_interval_ms, + cloud_project_id=cloud_project_id or self.cloud_project_id, + cloud_region_id=cloud_region_id or self.cloud_region_id, + cloud_polling_interval_ms=cloud_polling_interval_ms or self.cloud_polling_interval_ms, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, @@ -194,22 +194,22 @@ def copy( # client.with_options(timeout=10).foo.create(...) with_options = copy - def _get_project_id_path_param(self) -> int: - from_client = self.project_id + def _get_cloud_project_id_path_param(self) -> int: + from_client = self.cloud_project_id if from_client is not None: return from_client raise ValueError( - "Missing project_id argument; Please provide it at the client level, e.g. Gcore(project_id='abcd') or per method." + "Missing cloud_project_id argument; Please provide it at the client level, e.g. Gcore(cloud_project_id='abcd') or per method." ) - def _get_region_id_path_param(self) -> int: - from_client = self.region_id + def _get_cloud_region_id_path_param(self) -> int: + from_client = self.cloud_region_id if from_client is not None: return from_client raise ValueError( - "Missing region_id argument; Please provide it at the client level, e.g. Gcore(region_id='abcd') or per method." + "Missing cloud_region_id argument; Please provide it at the client level, e.g. Gcore(cloud_region_id='abcd') or per method." ) @override @@ -253,17 +253,17 @@ class AsyncGcore(AsyncAPIClient): # client options api_key: str - project_id: int | None - region_id: int | None - polling_interval_ms: int | None + cloud_project_id: int | None + cloud_region_id: int | None + cloud_polling_interval_ms: int | None def __init__( self, *, api_key: str | None = None, - project_id: int | None = None, - region_id: int | None = None, - polling_interval_ms: int | None = 1000, + cloud_project_id: int | None = None, + cloud_region_id: int | None = None, + cloud_polling_interval_ms: int | None = 1000, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, @@ -287,8 +287,8 @@ def __init__( This automatically infers the following arguments from their corresponding environment variables if they are not provided: - `api_key` from `GCORE_API_KEY` - - `project_id` from `GCORE_PROJECT` - - `region_id` from `GCORE_REGION` + - `cloud_project_id` from `GCORE_CLOUD_PROJECT_ID` + - `cloud_region_id` from `GCORE_CLOUD_REGION_ID` """ if api_key is None: api_key = os.environ.get("GCORE_API_KEY") @@ -298,17 +298,17 @@ def __init__( ) self.api_key = api_key - if project_id is None: - project_id = maybe_coerce_integer(os.environ.get("GCORE_PROJECT")) - self.project_id = project_id + if cloud_project_id is None: + cloud_project_id = maybe_coerce_integer(os.environ.get("GCORE_CLOUD_PROJECT_ID")) + self.cloud_project_id = cloud_project_id - if region_id is None: - region_id = maybe_coerce_integer(os.environ.get("GCORE_REGION")) - self.region_id = region_id + if cloud_region_id is None: + cloud_region_id = maybe_coerce_integer(os.environ.get("GCORE_CLOUD_REGION_ID")) + self.cloud_region_id = cloud_region_id - if polling_interval_ms is None: - polling_interval_ms = 1000 - self.polling_interval_ms = polling_interval_ms + if cloud_polling_interval_ms is None: + cloud_polling_interval_ms = 1000 + self.cloud_polling_interval_ms = cloud_polling_interval_ms if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") @@ -354,9 +354,9 @@ def copy( self, *, api_key: str | None = None, - project_id: int | None = None, - region_id: int | None = None, - polling_interval_ms: int | None = None, + cloud_project_id: int | None = None, + cloud_region_id: int | None = None, + cloud_polling_interval_ms: int | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.AsyncClient | None = None, @@ -391,9 +391,9 @@ def copy( http_client = http_client or self._client return self.__class__( api_key=api_key or self.api_key, - project_id=project_id or self.project_id, - region_id=region_id or self.region_id, - polling_interval_ms=polling_interval_ms or self.polling_interval_ms, + cloud_project_id=cloud_project_id or self.cloud_project_id, + cloud_region_id=cloud_region_id or self.cloud_region_id, + cloud_polling_interval_ms=cloud_polling_interval_ms or self.cloud_polling_interval_ms, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, @@ -407,22 +407,22 @@ def copy( # client.with_options(timeout=10).foo.create(...) with_options = copy - def _get_project_id_path_param(self) -> int: - from_client = self.project_id + def _get_cloud_project_id_path_param(self) -> int: + from_client = self.cloud_project_id if from_client is not None: return from_client raise ValueError( - "Missing project_id argument; Please provide it at the client level, e.g. AsyncGcore(project_id='abcd') or per method." + "Missing cloud_project_id argument; Please provide it at the client level, e.g. AsyncGcore(cloud_project_id='abcd') or per method." ) - def _get_region_id_path_param(self) -> int: - from_client = self.region_id + def _get_cloud_region_id_path_param(self) -> int: + from_client = self.cloud_region_id if from_client is not None: return from_client raise ValueError( - "Missing region_id argument; Please provide it at the client level, e.g. AsyncGcore(region_id='abcd') or per method." + "Missing cloud_region_id argument; Please provide it at the client level, e.g. AsyncGcore(cloud_region_id='abcd') or per method." ) @override diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index bbb4ec3c..a3296f4d 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -96,9 +96,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get( f"/cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( @@ -194,9 +194,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._get( f"/cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index c3cbe0e4..8f7fc220 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -87,9 +87,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( @@ -142,9 +142,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( @@ -194,9 +194,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") if not access_rule_id: @@ -274,9 +274,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( @@ -329,9 +329,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( @@ -381,9 +381,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") if not access_rule_id: diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 089daa34..8267f5d1 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -198,9 +198,9 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._post( f"/cloud/v1/file_shares/{project_id}/{region_id}", body=maybe_transform( @@ -260,9 +260,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._patch( @@ -313,9 +313,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/file_shares/{project_id}/{region_id}", page=SyncOffsetPage[FileShare], @@ -370,9 +370,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._delete( @@ -418,9 +418,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( @@ -470,9 +470,9 @@ def resize( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( @@ -644,9 +644,9 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._post( f"/cloud/v1/file_shares/{project_id}/{region_id}", body=await async_maybe_transform( @@ -706,9 +706,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._patch( @@ -759,9 +759,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/file_shares/{project_id}/{region_id}", page=AsyncOffsetPage[FileShare], @@ -816,9 +816,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._delete( @@ -864,9 +864,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( @@ -916,9 +916,9 @@ async def resize( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index d292f3d8..356d353a 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -89,9 +89,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._post( f"/cloud/v1/floatingips/{project_id}/{region_id}", body=maybe_transform( @@ -155,9 +155,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/floatingips/{project_id}/{region_id}", page=SyncOffsetPage[FloatingIPDetailed], @@ -214,9 +214,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._delete( @@ -270,9 +270,9 @@ def assign( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( @@ -325,9 +325,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._get( @@ -373,9 +373,9 @@ def unassign( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( @@ -450,9 +450,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._post( f"/cloud/v1/floatingips/{project_id}/{region_id}", body=await async_maybe_transform( @@ -516,9 +516,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/floatingips/{project_id}/{region_id}", page=AsyncOffsetPage[FloatingIPDetailed], @@ -575,9 +575,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._delete( @@ -631,9 +631,9 @@ async def assign( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( @@ -686,9 +686,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._get( @@ -734,9 +734,9 @@ async def unassign( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index 5d23a014..f1f9524e 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -115,9 +115,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._patch( @@ -193,9 +193,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get( f"/cloud/v1/images/{project_id}/{region_id}", options=make_request_options( @@ -252,9 +252,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( @@ -336,9 +336,9 @@ def create_from_volume( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._post( f"/cloud/v1/images/{project_id}/{region_id}", body=maybe_transform( @@ -417,9 +417,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( @@ -522,9 +522,9 @@ def upload( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._post( f"/cloud/v1/downloadimage/{project_id}/{region_id}", body=maybe_transform( @@ -634,9 +634,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._patch( @@ -712,9 +712,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._get( f"/cloud/v1/images/{project_id}/{region_id}", options=make_request_options( @@ -771,9 +771,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( @@ -855,9 +855,9 @@ async def create_from_volume( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._post( f"/cloud/v1/images/{project_id}/{region_id}", body=await async_maybe_transform( @@ -936,9 +936,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( @@ -1041,9 +1041,9 @@ async def upload( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._post( f"/cloud/v1/downloadimage/{project_id}/{region_id}", body=await async_maybe_transform( diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index d0e3f017..792ca50c 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -117,9 +117,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._post( f"/cloud/v1/networks/{project_id}/{region_id}", body=maybe_transform( @@ -176,9 +176,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._patch( @@ -241,9 +241,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/networks/{project_id}/{region_id}", page=SyncOffsetPage[Network], @@ -301,9 +301,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._delete( @@ -349,9 +349,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._get( @@ -438,9 +438,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._post( f"/cloud/v1/networks/{project_id}/{region_id}", body=await async_maybe_transform( @@ -497,9 +497,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._patch( @@ -562,9 +562,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/networks/{project_id}/{region_id}", page=AsyncOffsetPage[Network], @@ -622,9 +622,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._delete( @@ -670,9 +670,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._get( diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 4f42131b..b4007f42 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -99,9 +99,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._post( f"/cloud/v1/routers/{project_id}/{region_id}", body=maybe_transform( @@ -166,9 +166,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._patch( @@ -226,9 +226,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/routers/{project_id}/{region_id}", page=SyncOffsetPage[Router], @@ -283,9 +283,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._delete( @@ -335,9 +335,9 @@ def attach_subnet( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( @@ -388,9 +388,9 @@ def detach_subnet( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( @@ -437,9 +437,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._get( @@ -518,9 +518,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._post( f"/cloud/v1/routers/{project_id}/{region_id}", body=await async_maybe_transform( @@ -585,9 +585,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._patch( @@ -645,9 +645,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/routers/{project_id}/{region_id}", page=AsyncOffsetPage[Router], @@ -702,9 +702,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._delete( @@ -754,9 +754,9 @@ async def attach_subnet( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( @@ -809,9 +809,9 @@ async def detach_subnet( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( @@ -860,9 +860,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._get( diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index c2066910..c5bab612 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -124,9 +124,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._post( f"/cloud/v1/subnets/{project_id}/{region_id}", body=maybe_transform( @@ -206,9 +206,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._patch( @@ -298,9 +298,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/subnets/{project_id}/{region_id}", page=SyncOffsetPage[Subnet], @@ -359,9 +359,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -408,9 +408,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._get( @@ -517,9 +517,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._post( f"/cloud/v1/subnets/{project_id}/{region_id}", body=await async_maybe_transform( @@ -599,9 +599,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._patch( @@ -691,9 +691,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/subnets/{project_id}/{region_id}", page=AsyncOffsetPage[Subnet], @@ -752,9 +752,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -801,9 +801,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._get( diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 03040c39..0c01283e 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -198,7 +198,7 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() return self._delete( f"/cloud/v1/projects/{project_id}", options=make_request_options( @@ -234,7 +234,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() return self._get( f"/cloud/v1/projects/{project_id}", options=make_request_options( @@ -278,7 +278,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() return self._put( f"/cloud/v1/projects/{project_id}", body=maybe_transform( @@ -467,7 +467,7 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() return await self._delete( f"/cloud/v1/projects/{project_id}", options=make_request_options( @@ -503,7 +503,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() return await self._get( f"/cloud/v1/projects/{project_id}", options=make_request_options( @@ -547,7 +547,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() return await self._put( f"/cloud/v1/projects/{project_id}", body=await async_maybe_transform( diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 514142de..3733575a 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -103,7 +103,7 @@ def get_by_region( timeout: Override the client-level default timeout for this request, in seconds """ if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get( f"/cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( @@ -221,7 +221,7 @@ async def get_by_region( timeout: Override the client-level default timeout for this request, in seconds """ if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._get( f"/cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index 37c79cf0..57da0445 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -75,7 +75,7 @@ def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get( f"/cloud/v1/regions/{region_id}", options=make_request_options( @@ -207,7 +207,7 @@ async def retrieve( timeout: Override the client-level default timeout for this request, in seconds """ if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._get( f"/cloud/v1/regions/{region_id}", options=make_request_options( diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index e99ba24e..8a8d3833 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -315,9 +315,9 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._post( f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=maybe_transform( @@ -405,9 +405,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=SyncOffsetPage[ReservedFixedIP], @@ -469,9 +469,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._delete( @@ -517,9 +517,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( @@ -811,9 +811,9 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._post( f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=await async_maybe_transform( @@ -901,9 +901,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=AsyncOffsetPage[ReservedFixedIP], @@ -965,9 +965,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._delete( @@ -1013,9 +1013,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 459acbf6..abd1c487 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -84,9 +84,9 @@ def list_candidate_ports( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( @@ -132,9 +132,9 @@ def list_connected_ports( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( @@ -184,9 +184,9 @@ def replace_connected_ports( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._put( @@ -239,9 +239,9 @@ def toggle( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( @@ -292,9 +292,9 @@ def update_connected_ports( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( @@ -364,9 +364,9 @@ async def list_candidate_ports( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( @@ -412,9 +412,9 @@ async def list_connected_ports( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( @@ -464,9 +464,9 @@ async def replace_connected_ports( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._put( @@ -519,9 +519,9 @@ async def toggle( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( @@ -572,9 +572,9 @@ async def update_connected_ports( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 14d6fb71..7d8318c1 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -114,9 +114,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._post( f"/cloud/v1/secrets/{project_id}/{region_id}", body=maybe_transform( @@ -170,9 +170,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get( f"/cloud/v1/secrets/{project_id}/{region_id}", options=make_request_options( @@ -216,9 +216,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._delete( @@ -264,9 +264,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._get( @@ -320,9 +320,9 @@ def upload_tls_certificate( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._post( f"/cloud/v2/secrets/{project_id}/{region_id}", body=maybe_transform( @@ -427,9 +427,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._post( f"/cloud/v1/secrets/{project_id}/{region_id}", body=await async_maybe_transform( @@ -483,9 +483,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._get( f"/cloud/v1/secrets/{project_id}/{region_id}", options=make_request_options( @@ -529,9 +529,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._delete( @@ -577,9 +577,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._get( @@ -633,9 +633,9 @@ async def upload_tls_certificate( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._post( f"/cloud/v2/secrets/{project_id}/{region_id}", body=await async_maybe_transform( diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index 2487201c..def90622 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -137,9 +137,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( @@ -198,9 +198,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -309,9 +309,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._put( @@ -450,9 +450,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( @@ -511,9 +511,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -622,9 +622,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._put( diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index e72fc5da..6bf15902 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -100,9 +100,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._post( f"/cloud/v1/securitygroups/{project_id}/{region_id}", body=maybe_transform( @@ -161,9 +161,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._patch( @@ -228,9 +228,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/securitygroups/{project_id}/{region_id}", page=SyncOffsetPage[SecurityGroup], @@ -287,9 +287,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -340,9 +340,9 @@ def copy( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -390,9 +390,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( @@ -438,9 +438,9 @@ def revert_to_default( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( @@ -515,9 +515,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._post( f"/cloud/v1/securitygroups/{project_id}/{region_id}", body=await async_maybe_transform( @@ -576,9 +576,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._patch( @@ -643,9 +643,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/securitygroups/{project_id}/{region_id}", page=AsyncOffsetPage[SecurityGroup], @@ -702,9 +702,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -755,9 +755,9 @@ async def copy( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -805,9 +805,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( @@ -853,9 +853,9 @@ async def revert_to_default( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 55187088..44b1f8c8 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -84,7 +84,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() return self._post( f"/cloud/v1/ssh_keys/{project_id}", body=maybe_transform( @@ -136,7 +136,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._patch( @@ -187,7 +187,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( f"/cloud/v1/ssh_keys/{project_id}", page=SyncOffsetPage[SSHKey], @@ -239,7 +239,7 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -282,7 +282,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._get( @@ -353,7 +353,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() return await self._post( f"/cloud/v1/ssh_keys/{project_id}", body=await async_maybe_transform( @@ -405,7 +405,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._patch( @@ -458,7 +458,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( f"/cloud/v1/ssh_keys/{project_id}", page=AsyncOffsetPage[SSHKey], @@ -510,7 +510,7 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -553,7 +553,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._get( diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 95f41724..0b3a34f4 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -288,9 +288,9 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._post( f"/cloud/v1/volumes/{project_id}/{region_id}", body=maybe_transform( @@ -353,9 +353,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._patch( @@ -438,9 +438,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/volumes/{project_id}/{region_id}", page=SyncOffsetPage[Volume], @@ -507,9 +507,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._delete( @@ -569,9 +569,9 @@ def attach_to_instance( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( @@ -628,9 +628,9 @@ def change_type( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( @@ -681,9 +681,9 @@ def detach_from_instance( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( @@ -732,9 +732,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._get( @@ -784,9 +784,9 @@ def resize( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( @@ -833,9 +833,9 @@ def revert_to_last_snapshot( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} @@ -1101,9 +1101,9 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return await self._post( f"/cloud/v1/volumes/{project_id}/{region_id}", body=await async_maybe_transform( @@ -1166,9 +1166,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._patch( @@ -1251,9 +1251,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( f"/cloud/v1/volumes/{project_id}/{region_id}", page=AsyncOffsetPage[Volume], @@ -1320,9 +1320,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._delete( @@ -1382,9 +1382,9 @@ async def attach_to_instance( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( @@ -1441,9 +1441,9 @@ async def change_type( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( @@ -1496,9 +1496,9 @@ async def detach_from_instance( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( @@ -1547,9 +1547,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._get( @@ -1599,9 +1599,9 @@ async def resize( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( @@ -1648,9 +1648,9 @@ async def revert_to_last_snapshot( timeout: Override the client-level default timeout for this request, in seconds """ if project_id is None: - project_id = self._client._get_project_id_path_param() + project_id = self._client._get_cloud_project_id_path_param() if region_id is None: - region_id = self._client._get_region_id_path_param() + region_id = self._client._get_cloud_region_id_path_param() if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} diff --git a/tests/test_client.py b/tests/test_client.py index ec259699..942e8242 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -357,25 +357,25 @@ def test_default_query_option(self) -> None: url = httpx.URL(request.url) assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} - def test_project_id_client_params(self) -> None: + def test_cloud_project_id_client_params(self) -> None: client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) with client as c2: - with pytest.raises(ValueError, match="Missing project_id argument;"): + with pytest.raises(ValueError, match="Missing cloud_project_id argument;"): c2.cloud.projects.delete() - client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, project_id=0) + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_project_id=0) with client as c2: c2.cloud.projects.delete() - def test_region_id_client_params(self) -> None: + def test_cloud_region_id_client_params(self) -> None: client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) with client as c2: - with pytest.raises(ValueError, match="Missing region_id argument;"): + with pytest.raises(ValueError, match="Missing cloud_region_id argument;"): c2.cloud.regions.retrieve() - client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, region_id=0) + client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_region_id=0) with client as c2: c2.cloud.regions.retrieve() @@ -1143,25 +1143,25 @@ def test_default_query_option(self) -> None: url = httpx.URL(request.url) assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} - async def test_project_id_client_params(self) -> None: + async def test_cloud_project_id_client_params(self) -> None: client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) async with client as c2: - with pytest.raises(ValueError, match="Missing project_id argument;"): + with pytest.raises(ValueError, match="Missing cloud_project_id argument;"): await c2.cloud.projects.delete() - client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, project_id=0) + client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_project_id=0) async with client as c2: await c2.cloud.projects.delete() - async def test_region_id_client_params(self) -> None: + async def test_cloud_region_id_client_params(self) -> None: client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) async with client as c2: - with pytest.raises(ValueError, match="Missing region_id argument;"): + with pytest.raises(ValueError, match="Missing cloud_region_id argument;"): await c2.cloud.regions.retrieve() - client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, region_id=0) + client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_region_id=0) async with client as c2: await c2.cloud.regions.retrieve() From 6d767d4e0e4c5caf860194e71cb0b99158c94e22 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 15:22:04 +0000 Subject: [PATCH 071/592] feat(api): trigger codegen --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index ece90500..f5800544 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c0ddd251e17b7132e029bd882ca5724bfc8cf506b5c471c52aac7996593de1a8.yml openapi_spec_hash: 852c6dc29b57bb698cf759b01428dad5 -config_hash: 8868cada96234911a473ad3806ffe3c0 +config_hash: b897a74a7b38ec93659254483f518d8d From 45002f78289759cabfb8497bf6d304b14a3f9cd4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Apr 2025 13:22:57 +0000 Subject: [PATCH 072/592] GCLOUD2-18781 Add cloud billing reservations --- .stats.yml | 4 +- api.md | 13 + src/gcore/resources/cloud/__init__.py | 14 + .../resources/cloud/billing_reservations.py | 382 ++++++++++++++++++ src/gcore/resources/cloud/cloud.py | 32 ++ src/gcore/types/cloud/__init__.py | 2 + src/gcore/types/cloud/billing_reservation.py | 285 +++++++++++++ .../cloud/billing_reservation_list_params.py | 81 ++++ .../cloud/test_billing_reservations.py | 170 ++++++++ 9 files changed, 981 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/billing_reservations.py create mode 100644 src/gcore/types/cloud/billing_reservation.py create mode 100644 src/gcore/types/cloud/billing_reservation_list_params.py create mode 100644 tests/api_resources/cloud/test_billing_reservations.py diff --git a/.stats.yml b/.stats.yml index f5800544..5fb11e1e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 97 +configured_endpoints: 99 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c0ddd251e17b7132e029bd882ca5724bfc8cf506b5c471c52aac7996593de1a8.yml openapi_spec_hash: 852c6dc29b57bb698cf759b01428dad5 -config_hash: b897a74a7b38ec93659254483f518d8d +config_hash: 6326252ee0dc6677c63c9a7e3f7d7853 diff --git a/api.md b/api.md index b3de2060..043473dc 100644 --- a/api.md +++ b/api.md @@ -343,3 +343,16 @@ Methods: - client.cloud.file_shares.access_rules.create(file_share_id, \*, project_id, region_id, \*\*params) -> AccessRule - client.cloud.file_shares.access_rules.list(file_share_id, \*, project_id, region_id) -> AccessRuleList - client.cloud.file_shares.access_rules.delete(access_rule_id, \*, project_id, region_id, file_share_id) -> None + +## BillingReservations + +Types: + +```python +from gcore.types.cloud import BillingReservation +``` + +Methods: + +- client.cloud.billing_reservations.list(\*\*params) -> SyncOffsetPage[BillingReservation] +- client.cloud.billing_reservations.get(reservation_id) -> BillingReservation diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 3cebe18e..df54f1e7 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -128,6 +128,14 @@ ReservedFixedIPsResourceWithStreamingResponse, AsyncReservedFixedIPsResourceWithStreamingResponse, ) +from .billing_reservations import ( + BillingReservationsResource, + AsyncBillingReservationsResource, + BillingReservationsResourceWithRawResponse, + AsyncBillingReservationsResourceWithRawResponse, + BillingReservationsResourceWithStreamingResponse, + AsyncBillingReservationsResourceWithStreamingResponse, +) __all__ = [ "ProjectsResource", @@ -220,6 +228,12 @@ "AsyncFileSharesResourceWithRawResponse", "FileSharesResourceWithStreamingResponse", "AsyncFileSharesResourceWithStreamingResponse", + "BillingReservationsResource", + "AsyncBillingReservationsResource", + "BillingReservationsResourceWithRawResponse", + "AsyncBillingReservationsResourceWithRawResponse", + "BillingReservationsResourceWithStreamingResponse", + "AsyncBillingReservationsResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py new file mode 100644 index 00000000..759350d6 --- /dev/null +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -0,0 +1,382 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import date, datetime +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ...types.cloud import billing_reservation_list_params +from ..._base_client import AsyncPaginator, make_request_options +from ...types.cloud.billing_reservation import BillingReservation + +__all__ = ["BillingReservationsResource", "AsyncBillingReservationsResource"] + + +class BillingReservationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> BillingReservationsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return BillingReservationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BillingReservationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return BillingReservationsResourceWithStreamingResponse(self) + + def list( + self, + *, + activated_from: Union[str, date] | NotGiven = NOT_GIVEN, + activated_to: Union[str, date] | NotGiven = NOT_GIVEN, + created_from: Union[str, datetime] | NotGiven = NOT_GIVEN, + created_to: Union[str, datetime] | NotGiven = NOT_GIVEN, + deactivated_from: Union[str, date] | NotGiven = NOT_GIVEN, + deactivated_to: Union[str, date] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + metric_name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + region_id: int | NotGiven = NOT_GIVEN, + status: List[ + Literal[ + "ACTIVATED", "APPROVED", "COPIED", "CREATED", "EXPIRED", "REJECTED", "RESERVED", "WAITING_FOR_PAYMENT" + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[BillingReservation]: + """ + List reservations + + Args: + activated_from: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/0' + "$.paths['/cloud/v1/reservations'].get.parameters[0]" + + activated_to: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/1' + "$.paths['/cloud/v1/reservations'].get.parameters[1]" + + created_from: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/2' + "$.paths['/cloud/v1/reservations'].get.parameters[2]" + + created_to: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/3' + "$.paths['/cloud/v1/reservations'].get.parameters[3]" + + deactivated_from: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/4' + "$.paths['/cloud/v1/reservations'].get.parameters[4]" + + deactivated_to: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/5' + "$.paths['/cloud/v1/reservations'].get.parameters[5]" + + limit: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/6' + "$.paths['/cloud/v1/reservations'].get.parameters[6]" + + metric_name: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/7' + "$.paths['/cloud/v1/reservations'].get.parameters[7]" + + offset: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/8' + "$.paths['/cloud/v1/reservations'].get.parameters[8]" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/9' + "$.paths['/cloud/v1/reservations'].get.parameters[9]" + + status: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/10' + "$.paths['/cloud/v1/reservations'].get.parameters[10]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v1/reservations", + page=SyncOffsetPage[BillingReservation], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "activated_from": activated_from, + "activated_to": activated_to, + "created_from": created_from, + "created_to": created_to, + "deactivated_from": deactivated_from, + "deactivated_to": deactivated_to, + "limit": limit, + "metric_name": metric_name, + "offset": offset, + "region_id": region_id, + "status": status, + }, + billing_reservation_list_params.BillingReservationListParams, + ), + ), + model=BillingReservation, + ) + + def get( + self, + reservation_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, + ) -> BillingReservation: + """ + Get specific reservation + + Args: + reservation_id: '#/paths/%2Fcloud%2Fv1%2Freservations%2F%7Breservation_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/reservations/{reservation_id}'].get.parameters[0].schema" + + 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"/cloud/v1/reservations/{reservation_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BillingReservation, + ) + + +class AsyncBillingReservationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncBillingReservationsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncBillingReservationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBillingReservationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncBillingReservationsResourceWithStreamingResponse(self) + + def list( + self, + *, + activated_from: Union[str, date] | NotGiven = NOT_GIVEN, + activated_to: Union[str, date] | NotGiven = NOT_GIVEN, + created_from: Union[str, datetime] | NotGiven = NOT_GIVEN, + created_to: Union[str, datetime] | NotGiven = NOT_GIVEN, + deactivated_from: Union[str, date] | NotGiven = NOT_GIVEN, + deactivated_to: Union[str, date] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + metric_name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + region_id: int | NotGiven = NOT_GIVEN, + status: List[ + Literal[ + "ACTIVATED", "APPROVED", "COPIED", "CREATED", "EXPIRED", "REJECTED", "RESERVED", "WAITING_FOR_PAYMENT" + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[BillingReservation, AsyncOffsetPage[BillingReservation]]: + """ + List reservations + + Args: + activated_from: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/0' + "$.paths['/cloud/v1/reservations'].get.parameters[0]" + + activated_to: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/1' + "$.paths['/cloud/v1/reservations'].get.parameters[1]" + + created_from: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/2' + "$.paths['/cloud/v1/reservations'].get.parameters[2]" + + created_to: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/3' + "$.paths['/cloud/v1/reservations'].get.parameters[3]" + + deactivated_from: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/4' + "$.paths['/cloud/v1/reservations'].get.parameters[4]" + + deactivated_to: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/5' + "$.paths['/cloud/v1/reservations'].get.parameters[5]" + + limit: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/6' + "$.paths['/cloud/v1/reservations'].get.parameters[6]" + + metric_name: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/7' + "$.paths['/cloud/v1/reservations'].get.parameters[7]" + + offset: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/8' + "$.paths['/cloud/v1/reservations'].get.parameters[8]" + + region_id: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/9' + "$.paths['/cloud/v1/reservations'].get.parameters[9]" + + status: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/10' + "$.paths['/cloud/v1/reservations'].get.parameters[10]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v1/reservations", + page=AsyncOffsetPage[BillingReservation], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "activated_from": activated_from, + "activated_to": activated_to, + "created_from": created_from, + "created_to": created_to, + "deactivated_from": deactivated_from, + "deactivated_to": deactivated_to, + "limit": limit, + "metric_name": metric_name, + "offset": offset, + "region_id": region_id, + "status": status, + }, + billing_reservation_list_params.BillingReservationListParams, + ), + ), + model=BillingReservation, + ) + + async def get( + self, + reservation_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, + ) -> BillingReservation: + """ + Get specific reservation + + Args: + reservation_id: '#/paths/%2Fcloud%2Fv1%2Freservations%2F%7Breservation_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/reservations/{reservation_id}'].get.parameters[0].schema" + + 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"/cloud/v1/reservations/{reservation_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BillingReservation, + ) + + +class BillingReservationsResourceWithRawResponse: + def __init__(self, billing_reservations: BillingReservationsResource) -> None: + self._billing_reservations = billing_reservations + + self.list = to_raw_response_wrapper( + billing_reservations.list, + ) + self.get = to_raw_response_wrapper( + billing_reservations.get, + ) + + +class AsyncBillingReservationsResourceWithRawResponse: + def __init__(self, billing_reservations: AsyncBillingReservationsResource) -> None: + self._billing_reservations = billing_reservations + + self.list = async_to_raw_response_wrapper( + billing_reservations.list, + ) + self.get = async_to_raw_response_wrapper( + billing_reservations.get, + ) + + +class BillingReservationsResourceWithStreamingResponse: + def __init__(self, billing_reservations: BillingReservationsResource) -> None: + self._billing_reservations = billing_reservations + + self.list = to_streamed_response_wrapper( + billing_reservations.list, + ) + self.get = to_streamed_response_wrapper( + billing_reservations.get, + ) + + +class AsyncBillingReservationsResourceWithStreamingResponse: + def __init__(self, billing_reservations: AsyncBillingReservationsResource) -> None: + self._billing_reservations = billing_reservations + + self.list = async_to_streamed_response_wrapper( + billing_reservations.list, + ) + self.get = async_to_streamed_response_wrapper( + billing_reservations.get, + ) diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 6fd323d7..497e8e51 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -100,6 +100,14 @@ InstancesResourceWithStreamingResponse, AsyncInstancesResourceWithStreamingResponse, ) +from .billing_reservations import ( + BillingReservationsResource, + AsyncBillingReservationsResource, + BillingReservationsResourceWithRawResponse, + AsyncBillingReservationsResourceWithRawResponse, + BillingReservationsResourceWithStreamingResponse, + AsyncBillingReservationsResourceWithStreamingResponse, +) from .file_shares.file_shares import ( FileSharesResource, AsyncFileSharesResource, @@ -189,6 +197,10 @@ def instances(self) -> InstancesResource: def file_shares(self) -> FileSharesResource: return FileSharesResource(self._client) + @cached_property + def billing_reservations(self) -> BillingReservationsResource: + return BillingReservationsResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -270,6 +282,10 @@ def instances(self) -> AsyncInstancesResource: def file_shares(self) -> AsyncFileSharesResource: return AsyncFileSharesResource(self._client) + @cached_property + def billing_reservations(self) -> AsyncBillingReservationsResource: + return AsyncBillingReservationsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -354,6 +370,10 @@ def instances(self) -> InstancesResourceWithRawResponse: def file_shares(self) -> FileSharesResourceWithRawResponse: return FileSharesResourceWithRawResponse(self._cloud.file_shares) + @cached_property + def billing_reservations(self) -> BillingReservationsResourceWithRawResponse: + return BillingReservationsResourceWithRawResponse(self._cloud.billing_reservations) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -419,6 +439,10 @@ def instances(self) -> AsyncInstancesResourceWithRawResponse: def file_shares(self) -> AsyncFileSharesResourceWithRawResponse: return AsyncFileSharesResourceWithRawResponse(self._cloud.file_shares) + @cached_property + def billing_reservations(self) -> AsyncBillingReservationsResourceWithRawResponse: + return AsyncBillingReservationsResourceWithRawResponse(self._cloud.billing_reservations) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -484,6 +508,10 @@ def instances(self) -> InstancesResourceWithStreamingResponse: def file_shares(self) -> FileSharesResourceWithStreamingResponse: return FileSharesResourceWithStreamingResponse(self._cloud.file_shares) + @cached_property + def billing_reservations(self) -> BillingReservationsResourceWithStreamingResponse: + return BillingReservationsResourceWithStreamingResponse(self._cloud.billing_reservations) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -548,3 +576,7 @@ def instances(self) -> AsyncInstancesResourceWithStreamingResponse: @cached_property def file_shares(self) -> AsyncFileSharesResourceWithStreamingResponse: return AsyncFileSharesResourceWithStreamingResponse(self._cloud.file_shares) + + @cached_property + def billing_reservations(self) -> AsyncBillingReservationsResourceWithStreamingResponse: + return AsyncBillingReservationsResourceWithStreamingResponse(self._cloud.billing_reservations) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index a1b0a1fd..c185a74f 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -29,6 +29,7 @@ from .floating_ip_status import FloatingIPStatus as FloatingIPStatus from .region_list_params import RegionListParams as RegionListParams from .volume_list_params import VolumeListParams as VolumeListParams +from .billing_reservation import BillingReservation as BillingReservation from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .network_list_params import NetworkListParams as NetworkListParams @@ -75,6 +76,7 @@ from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus +from .billing_reservation_list_params import BillingReservationListParams as BillingReservationListParams from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity diff --git a/src/gcore/types/cloud/billing_reservation.py b/src/gcore/types/cloud/billing_reservation.py new file mode 100644 index 00000000..d2f4c8ad --- /dev/null +++ b/src/gcore/types/cloud/billing_reservation.py @@ -0,0 +1,285 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import date, datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BillingReservation", "AmountPrices", "Resource"] + + +class AmountPrices(BaseModel): + commit_price_per_month: str + """ + '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/commit_price_per_month' + "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.commit_price_per_month" + """ + + commit_price_per_unit: str + """ + '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/commit_price_per_unit' + "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.commit_price_per_unit" + """ + + commit_price_total: str + """ + '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/commit_price_total' + "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.commit_price_total" + """ + + currency_code: str + """ + '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/currency_code' + "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.currency_code" + """ + + overcommit_price_per_month: str + """ + '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/overcommit_price_per_month' + "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.overcommit_price_per_month" + """ + + overcommit_price_per_unit: str + """ + '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/overcommit_price_per_unit' + "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.overcommit_price_per_unit" + """ + + overcommit_price_total: str + """ + '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/overcommit_price_total' + "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.overcommit_price_total" + """ + + +class Resource(BaseModel): + activity_period: str + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/activity_period' + "$.components.schemas.BillingReservationResourceSerializer.properties.activity_period" + """ + + activity_period_length: int + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/activity_period_length' + "$.components.schemas.BillingReservationResourceSerializer.properties.activity_period_length" + """ + + billing_plan_item_id: int + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/billing_plan_item_id' + "$.components.schemas.BillingReservationResourceSerializer.properties.billing_plan_item_id" + """ + + commit_price_per_month: str + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/commit_price_per_month' + "$.components.schemas.BillingReservationResourceSerializer.properties.commit_price_per_month" + """ + + commit_price_per_unit: str + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/commit_price_per_unit' + "$.components.schemas.BillingReservationResourceSerializer.properties.commit_price_per_unit" + """ + + commit_price_total: str + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/commit_price_total' + "$.components.schemas.BillingReservationResourceSerializer.properties.commit_price_total" + """ + + overcommit_billing_plan_item_id: int + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/overcommit_billing_plan_item_id' + "$.components.schemas.BillingReservationResourceSerializer.properties.overcommit_billing_plan_item_id" + """ + + overcommit_price_per_month: str + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/overcommit_price_per_month' + "$.components.schemas.BillingReservationResourceSerializer.properties.overcommit_price_per_month" + """ + + overcommit_price_per_unit: str + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/overcommit_price_per_unit' + "$.components.schemas.BillingReservationResourceSerializer.properties.overcommit_price_per_unit" + """ + + overcommit_price_total: str + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/overcommit_price_total' + "$.components.schemas.BillingReservationResourceSerializer.properties.overcommit_price_total" + """ + + resource_count: int + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/resource_count' + "$.components.schemas.BillingReservationResourceSerializer.properties.resource_count" + """ + + resource_name: str + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/resource_name' + "$.components.schemas.BillingReservationResourceSerializer.properties.resource_name" + """ + + resource_type: Literal["flavor"] + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/resource_type' + "$.components.schemas.BillingReservationResourceSerializer.properties.resource_type" + """ + + unit_name: str + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/unit_name' + "$.components.schemas.BillingReservationResourceSerializer.properties.unit_name" + """ + + unit_size_month: str + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/unit_size_month' + "$.components.schemas.BillingReservationResourceSerializer.properties.unit_size_month" + """ + + unit_size_total: str + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/unit_size_total' + "$.components.schemas.BillingReservationResourceSerializer.properties.unit_size_total" + """ + + cpu: Optional[str] = None + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/cpu/anyOf/0' + "$.components.schemas.BillingReservationResourceSerializer.properties.cpu.anyOf[0]" + """ + + disk: Optional[str] = None + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/disk/anyOf/0' + "$.components.schemas.BillingReservationResourceSerializer.properties.disk.anyOf[0]" + """ + + ram: Optional[str] = None + """ + '#/components/schemas/BillingReservationResourceSerializer/properties/ram/anyOf/0' + "$.components.schemas.BillingReservationResourceSerializer.properties.ram.anyOf[0]" + """ + + +class BillingReservation(BaseModel): + id: int + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/id' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.id" + """ + + active_from: date + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/active_from' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.active_from" + """ + + active_to: date + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/active_to' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.active_to" + """ + + activity_period: str + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/activity_period' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.activity_period" + """ + + activity_period_length: int + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/activity_period_length' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.activity_period_length" + """ + + amount_prices: AmountPrices + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/amount_prices' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.amount_prices" + """ + + billing_plan_id: int + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/billing_plan_id' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.billing_plan_id" + """ + + created_at: datetime + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/created_at' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.created_at" + """ + + error: Optional[str] = None + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/error/anyOf/0' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.error.anyOf[0]" + """ + + eta: Optional[date] = None + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/eta/anyOf/0' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.eta.anyOf[0]" + """ + + is_expiration_message_visible: bool + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/is_expiration_message_visible' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.is_expiration_message_visible" + """ + + name: str + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/name' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.name" + """ + + next_statuses: List[str] + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/next_statuses' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.next_statuses" + """ + + region_id: int + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/region_id' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.region_id" + """ + + region_name: str + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/region_name' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.region_name" + """ + + remind_expiration_message: Optional[date] = None + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/remind_expiration_message/anyOf/0' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.remind_expiration_message.anyOf[0]" + """ + + resources: List[Resource] + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/resources' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.resources" + """ + + status: str + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/status' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.status" + """ + + user_status: str + """ + '#/components/schemas/BillingReservationItemResponseSerializer/properties/user_status' + "$.components.schemas.BillingReservationItemResponseSerializer.properties.user_status" + """ diff --git a/src/gcore/types/cloud/billing_reservation_list_params.py b/src/gcore/types/cloud/billing_reservation_list_params.py new file mode 100644 index 00000000..ce188dba --- /dev/null +++ b/src/gcore/types/cloud/billing_reservation_list_params.py @@ -0,0 +1,81 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import date, datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["BillingReservationListParams"] + + +class BillingReservationListParams(TypedDict, total=False): + activated_from: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """ + '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/0' + "$.paths['/cloud/v1/reservations'].get.parameters[0]" + """ + + activated_to: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """ + '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/1' + "$.paths['/cloud/v1/reservations'].get.parameters[1]" + """ + + created_from: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/2' + "$.paths['/cloud/v1/reservations'].get.parameters[2]" + """ + + created_to: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/3' + "$.paths['/cloud/v1/reservations'].get.parameters[3]" + """ + + deactivated_from: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """ + '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/4' + "$.paths['/cloud/v1/reservations'].get.parameters[4]" + """ + + deactivated_to: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """ + '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/5' + "$.paths['/cloud/v1/reservations'].get.parameters[5]" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/6' + "$.paths['/cloud/v1/reservations'].get.parameters[6]" + """ + + metric_name: str + """ + '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/7' + "$.paths['/cloud/v1/reservations'].get.parameters[7]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/8' + "$.paths['/cloud/v1/reservations'].get.parameters[8]" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/9' + "$.paths['/cloud/v1/reservations'].get.parameters[9]" + """ + + status: List[ + Literal["ACTIVATED", "APPROVED", "COPIED", "CREATED", "EXPIRED", "REJECTED", "RESERVED", "WAITING_FOR_PAYMENT"] + ] + """ + '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/10' + "$.paths['/cloud/v1/reservations'].get.parameters[10]" + """ diff --git a/tests/api_resources/cloud/test_billing_reservations.py b/tests/api_resources/cloud/test_billing_reservations.py new file mode 100644 index 00000000..9c5d6f89 --- /dev/null +++ b/tests/api_resources/cloud/test_billing_reservations.py @@ -0,0 +1,170 @@ +# 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._utils import parse_date, parse_datetime +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import BillingReservation + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBillingReservations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + billing_reservation = client.cloud.billing_reservations.list() + assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + billing_reservation = client.cloud.billing_reservations.list( + activated_from=parse_date("2019-12-27"), + activated_to=parse_date("2019-12-27"), + created_from=parse_datetime("2019-12-27T18:11:19.117Z"), + created_to=parse_datetime("2019-12-27T18:11:19.117Z"), + deactivated_from=parse_date("2019-12-27"), + deactivated_to=parse_date("2019-12-27"), + limit=1, + metric_name="metric_name", + offset=0, + region_id=0, + status=["ACTIVATED"], + ) + assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.billing_reservations.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + billing_reservation = response.parse() + assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.billing_reservations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + billing_reservation = response.parse() + assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + billing_reservation = client.cloud.billing_reservations.get( + 0, + ) + assert_matches_type(BillingReservation, billing_reservation, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.billing_reservations.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + billing_reservation = response.parse() + assert_matches_type(BillingReservation, billing_reservation, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.billing_reservations.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + billing_reservation = response.parse() + assert_matches_type(BillingReservation, billing_reservation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncBillingReservations: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + billing_reservation = await async_client.cloud.billing_reservations.list() + assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + billing_reservation = await async_client.cloud.billing_reservations.list( + activated_from=parse_date("2019-12-27"), + activated_to=parse_date("2019-12-27"), + created_from=parse_datetime("2019-12-27T18:11:19.117Z"), + created_to=parse_datetime("2019-12-27T18:11:19.117Z"), + deactivated_from=parse_date("2019-12-27"), + deactivated_to=parse_date("2019-12-27"), + limit=1, + metric_name="metric_name", + offset=0, + region_id=0, + status=["ACTIVATED"], + ) + assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.billing_reservations.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + billing_reservation = await response.parse() + assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.billing_reservations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + billing_reservation = await response.parse() + assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + billing_reservation = await async_client.cloud.billing_reservations.get( + 0, + ) + assert_matches_type(BillingReservation, billing_reservation, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.billing_reservations.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + billing_reservation = await response.parse() + assert_matches_type(BillingReservation, billing_reservation, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.billing_reservations.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + billing_reservation = await response.parse() + assert_matches_type(BillingReservation, billing_reservation, path=["response"]) + + assert cast(Any, response.is_closed) is True From 789f446239619b1159c1ab47ac4290174f2acea1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Apr 2025 13:52:46 +0000 Subject: [PATCH 073/592] GCLOUD2-18776 Add cloud placement groups --- .stats.yml | 4 +- api.md | 15 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 ++ src/gcore/resources/cloud/placement_groups.py | 529 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 3 + src/gcore/types/cloud/placement_group.py | 65 +++ .../cloud/placement_group_create_params.py | 33 ++ src/gcore/types/cloud/placement_group_list.py | 22 + .../cloud/test_placement_groups.py | 354 ++++++++++++ 10 files changed, 1069 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/placement_groups.py create mode 100644 src/gcore/types/cloud/placement_group.py create mode 100644 src/gcore/types/cloud/placement_group_create_params.py create mode 100644 src/gcore/types/cloud/placement_group_list.py create mode 100644 tests/api_resources/cloud/test_placement_groups.py diff --git a/.stats.yml b/.stats.yml index 5fb11e1e..284777df 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 99 +configured_endpoints: 103 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c0ddd251e17b7132e029bd882ca5724bfc8cf506b5c471c52aac7996593de1a8.yml openapi_spec_hash: 852c6dc29b57bb698cf759b01428dad5 -config_hash: 6326252ee0dc6677c63c9a7e3f7d7853 +config_hash: a572942392d31c30f030939f9375bec6 diff --git a/api.md b/api.md index 043473dc..70205c66 100644 --- a/api.md +++ b/api.md @@ -292,6 +292,21 @@ Methods: - client.cloud.security_groups.rules.delete(rule_id, \*, project_id, region_id) -> None - client.cloud.security_groups.rules.replace(rule_id, \*, project_id, region_id, \*\*params) -> SecurityGroupRule +## PlacementGroups + +Types: + +```python +from gcore.types.cloud import PlacementGroup, PlacementGroupList +``` + +Methods: + +- client.cloud.placement_groups.create(\*, project_id, region_id, \*\*params) -> PlacementGroup +- client.cloud.placement_groups.list(\*, project_id, region_id) -> PlacementGroupList +- client.cloud.placement_groups.delete(group_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.placement_groups.get(group_id, \*, project_id, region_id) -> PlacementGroup + ## Baremetal ### Images diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index df54f1e7..9e9a5c46 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -120,6 +120,14 @@ SecurityGroupsResourceWithStreamingResponse, AsyncSecurityGroupsResourceWithStreamingResponse, ) +from .placement_groups import ( + PlacementGroupsResource, + AsyncPlacementGroupsResource, + PlacementGroupsResourceWithRawResponse, + AsyncPlacementGroupsResourceWithRawResponse, + PlacementGroupsResourceWithStreamingResponse, + AsyncPlacementGroupsResourceWithStreamingResponse, +) from .reserved_fixed_ips import ( ReservedFixedIPsResource, AsyncReservedFixedIPsResource, @@ -210,6 +218,12 @@ "AsyncSecurityGroupsResourceWithRawResponse", "SecurityGroupsResourceWithStreamingResponse", "AsyncSecurityGroupsResourceWithStreamingResponse", + "PlacementGroupsResource", + "AsyncPlacementGroupsResource", + "PlacementGroupsResourceWithRawResponse", + "AsyncPlacementGroupsResourceWithRawResponse", + "PlacementGroupsResourceWithStreamingResponse", + "AsyncPlacementGroupsResourceWithStreamingResponse", "BaremetalResource", "AsyncBaremetalResource", "BaremetalResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 497e8e51..116d5383 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -76,6 +76,14 @@ QuotasResourceWithStreamingResponse, AsyncQuotasResourceWithStreamingResponse, ) +from .placement_groups import ( + PlacementGroupsResource, + AsyncPlacementGroupsResource, + PlacementGroupsResourceWithRawResponse, + AsyncPlacementGroupsResourceWithRawResponse, + PlacementGroupsResourceWithStreamingResponse, + AsyncPlacementGroupsResourceWithStreamingResponse, +) from .networks.networks import ( NetworksResource, AsyncNetworksResource, @@ -185,6 +193,10 @@ def floating_ips(self) -> FloatingIPsResource: def security_groups(self) -> SecurityGroupsResource: return SecurityGroupsResource(self._client) + @cached_property + def placement_groups(self) -> PlacementGroupsResource: + return PlacementGroupsResource(self._client) + @cached_property def baremetal(self) -> BaremetalResource: return BaremetalResource(self._client) @@ -270,6 +282,10 @@ def floating_ips(self) -> AsyncFloatingIPsResource: def security_groups(self) -> AsyncSecurityGroupsResource: return AsyncSecurityGroupsResource(self._client) + @cached_property + def placement_groups(self) -> AsyncPlacementGroupsResource: + return AsyncPlacementGroupsResource(self._client) + @cached_property def baremetal(self) -> AsyncBaremetalResource: return AsyncBaremetalResource(self._client) @@ -358,6 +374,10 @@ def floating_ips(self) -> FloatingIPsResourceWithRawResponse: def security_groups(self) -> SecurityGroupsResourceWithRawResponse: return SecurityGroupsResourceWithRawResponse(self._cloud.security_groups) + @cached_property + def placement_groups(self) -> PlacementGroupsResourceWithRawResponse: + return PlacementGroupsResourceWithRawResponse(self._cloud.placement_groups) + @cached_property def baremetal(self) -> BaremetalResourceWithRawResponse: return BaremetalResourceWithRawResponse(self._cloud.baremetal) @@ -427,6 +447,10 @@ def floating_ips(self) -> AsyncFloatingIPsResourceWithRawResponse: def security_groups(self) -> AsyncSecurityGroupsResourceWithRawResponse: return AsyncSecurityGroupsResourceWithRawResponse(self._cloud.security_groups) + @cached_property + def placement_groups(self) -> AsyncPlacementGroupsResourceWithRawResponse: + return AsyncPlacementGroupsResourceWithRawResponse(self._cloud.placement_groups) + @cached_property def baremetal(self) -> AsyncBaremetalResourceWithRawResponse: return AsyncBaremetalResourceWithRawResponse(self._cloud.baremetal) @@ -496,6 +520,10 @@ def floating_ips(self) -> FloatingIPsResourceWithStreamingResponse: def security_groups(self) -> SecurityGroupsResourceWithStreamingResponse: return SecurityGroupsResourceWithStreamingResponse(self._cloud.security_groups) + @cached_property + def placement_groups(self) -> PlacementGroupsResourceWithStreamingResponse: + return PlacementGroupsResourceWithStreamingResponse(self._cloud.placement_groups) + @cached_property def baremetal(self) -> BaremetalResourceWithStreamingResponse: return BaremetalResourceWithStreamingResponse(self._cloud.baremetal) @@ -565,6 +593,10 @@ def floating_ips(self) -> AsyncFloatingIPsResourceWithStreamingResponse: def security_groups(self) -> AsyncSecurityGroupsResourceWithStreamingResponse: return AsyncSecurityGroupsResourceWithStreamingResponse(self._cloud.security_groups) + @cached_property + def placement_groups(self) -> AsyncPlacementGroupsResourceWithStreamingResponse: + return AsyncPlacementGroupsResourceWithStreamingResponse(self._cloud.placement_groups) + @cached_property def baremetal(self) -> AsyncBaremetalResourceWithStreamingResponse: return AsyncBaremetalResourceWithStreamingResponse(self._cloud.baremetal) diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py new file mode 100644 index 00000000..1e2e77c3 --- /dev/null +++ b/src/gcore/resources/cloud/placement_groups.py @@ -0,0 +1,529 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cloud import placement_group_create_params +from ..._base_client import make_request_options +from ...types.cloud.task_id_list import TaskIDList +from ...types.cloud.placement_group import PlacementGroup +from ...types.cloud.placement_group_list import PlacementGroupList + +__all__ = ["PlacementGroupsResource", "AsyncPlacementGroupsResource"] + + +class PlacementGroupsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PlacementGroupsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return PlacementGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PlacementGroupsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return PlacementGroupsResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + policy: Literal["affinity", "anti-affinity", "soft-anti-affinity"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PlacementGroup: + """ + Create an affinity or anti-affinity or soft-anti-affinity placement group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateServerGroupSerializer/properties/name' + "$.components.schemas.CreateServerGroupSerializer.properties.name" + + policy: '#/components/schemas/CreateServerGroupSerializer/properties/policy' + "$.components.schemas.CreateServerGroupSerializer.properties.policy" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/servergroups/{project_id}/{region_id}", + body=maybe_transform( + { + "name": name, + "policy": policy, + }, + placement_group_create_params.PlacementGroupCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PlacementGroup, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PlacementGroupList: + """ + List placement groups + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/servergroups/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PlacementGroupList, + ) + + def delete( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete placement group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + return self._delete( + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PlacementGroup: + """ + Get placement group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}'].get.parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + return self._get( + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PlacementGroup, + ) + + +class AsyncPlacementGroupsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPlacementGroupsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncPlacementGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPlacementGroupsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncPlacementGroupsResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + policy: Literal["affinity", "anti-affinity", "soft-anti-affinity"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PlacementGroup: + """ + Create an affinity or anti-affinity or soft-anti-affinity placement group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/CreateServerGroupSerializer/properties/name' + "$.components.schemas.CreateServerGroupSerializer.properties.name" + + policy: '#/components/schemas/CreateServerGroupSerializer/properties/policy' + "$.components.schemas.CreateServerGroupSerializer.properties.policy" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/servergroups/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "name": name, + "policy": policy, + }, + placement_group_create_params.PlacementGroupCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PlacementGroup, + ) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PlacementGroupList: + """ + List placement groups + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/servergroups/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PlacementGroupList, + ) + + async def delete( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete placement group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + return await self._delete( + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + group_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PlacementGroup: + """ + Get placement group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}'].get.parameters[1].schema" + + group_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") + return await self._get( + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PlacementGroup, + ) + + +class PlacementGroupsResourceWithRawResponse: + def __init__(self, placement_groups: PlacementGroupsResource) -> None: + self._placement_groups = placement_groups + + self.create = to_raw_response_wrapper( + placement_groups.create, + ) + self.list = to_raw_response_wrapper( + placement_groups.list, + ) + self.delete = to_raw_response_wrapper( + placement_groups.delete, + ) + self.get = to_raw_response_wrapper( + placement_groups.get, + ) + + +class AsyncPlacementGroupsResourceWithRawResponse: + def __init__(self, placement_groups: AsyncPlacementGroupsResource) -> None: + self._placement_groups = placement_groups + + self.create = async_to_raw_response_wrapper( + placement_groups.create, + ) + self.list = async_to_raw_response_wrapper( + placement_groups.list, + ) + self.delete = async_to_raw_response_wrapper( + placement_groups.delete, + ) + self.get = async_to_raw_response_wrapper( + placement_groups.get, + ) + + +class PlacementGroupsResourceWithStreamingResponse: + def __init__(self, placement_groups: PlacementGroupsResource) -> None: + self._placement_groups = placement_groups + + self.create = to_streamed_response_wrapper( + placement_groups.create, + ) + self.list = to_streamed_response_wrapper( + placement_groups.list, + ) + self.delete = to_streamed_response_wrapper( + placement_groups.delete, + ) + self.get = to_streamed_response_wrapper( + placement_groups.get, + ) + + +class AsyncPlacementGroupsResourceWithStreamingResponse: + def __init__(self, placement_groups: AsyncPlacementGroupsResource) -> None: + self._placement_groups = placement_groups + + self.create = async_to_streamed_response_wrapper( + placement_groups.create, + ) + self.list = async_to_streamed_response_wrapper( + placement_groups.list, + ) + self.delete = async_to_streamed_response_wrapper( + placement_groups.delete, + ) + self.get = async_to_streamed_response_wrapper( + placement_groups.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index c185a74f..5c8821a4 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -22,6 +22,7 @@ from .load_balancer import LoadBalancer as LoadBalancer from .neutron_route import NeutronRoute as NeutronRoute from .security_group import SecurityGroup as SecurityGroup +from .placement_group import PlacementGroup as PlacementGroup from .ssh_key_created import SSHKeyCreated as SSHKeyCreated from .task_list_params import TaskListParams as TaskListParams from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP @@ -39,6 +40,7 @@ from .security_group_rule import SecurityGroupRule as SecurityGroupRule from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed +from .placement_group_list import PlacementGroupList as PlacementGroupList from .secret_create_params import SecretCreateParams as SecretCreateParams from .secret_list_response import SecretListResponse as SecretListResponse from .volume_create_params import VolumeCreateParams as VolumeCreateParams @@ -74,6 +76,7 @@ from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams +from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus from .billing_reservation_list_params import BillingReservationListParams as BillingReservationListParams diff --git a/src/gcore/types/cloud/placement_group.py b/src/gcore/types/cloud/placement_group.py new file mode 100644 index 00000000..dd35f63c --- /dev/null +++ b/src/gcore/types/cloud/placement_group.py @@ -0,0 +1,65 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["PlacementGroup", "Instance"] + + +class Instance(BaseModel): + instance_id: str + """ + '#/components/schemas/InstanceBriefSerializer/properties/instance_id' + "$.components.schemas.InstanceBriefSerializer.properties.instance_id" + """ + + instance_name: str + """ + '#/components/schemas/InstanceBriefSerializer/properties/instance_name' + "$.components.schemas.InstanceBriefSerializer.properties.instance_name" + """ + + +class PlacementGroup(BaseModel): + instances: List[Instance] + """ + '#/components/schemas/ServerGroupSerializer/properties/instances' + "$.components.schemas.ServerGroupSerializer.properties.instances" + """ + + name: str + """ + '#/components/schemas/ServerGroupSerializer/properties/name' + "$.components.schemas.ServerGroupSerializer.properties.name" + """ + + policy: str + """ + '#/components/schemas/ServerGroupSerializer/properties/policy' + "$.components.schemas.ServerGroupSerializer.properties.policy" + """ + + project_id: int + """ + '#/components/schemas/ServerGroupSerializer/properties/project_id' + "$.components.schemas.ServerGroupSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/ServerGroupSerializer/properties/region' + "$.components.schemas.ServerGroupSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/ServerGroupSerializer/properties/region_id' + "$.components.schemas.ServerGroupSerializer.properties.region_id" + """ + + servergroup_id: str + """ + '#/components/schemas/ServerGroupSerializer/properties/servergroup_id' + "$.components.schemas.ServerGroupSerializer.properties.servergroup_id" + """ diff --git a/src/gcore/types/cloud/placement_group_create_params.py b/src/gcore/types/cloud/placement_group_create_params.py new file mode 100644 index 00000000..54012fbe --- /dev/null +++ b/src/gcore/types/cloud/placement_group_create_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["PlacementGroupCreateParams"] + + +class PlacementGroupCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/CreateServerGroupSerializer/properties/name' + "$.components.schemas.CreateServerGroupSerializer.properties.name" + """ + + policy: Required[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] + """ + '#/components/schemas/CreateServerGroupSerializer/properties/policy' + "$.components.schemas.CreateServerGroupSerializer.properties.policy" + """ diff --git a/src/gcore/types/cloud/placement_group_list.py b/src/gcore/types/cloud/placement_group_list.py new file mode 100644 index 00000000..56292342 --- /dev/null +++ b/src/gcore/types/cloud/placement_group_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .placement_group import PlacementGroup + +__all__ = ["PlacementGroupList"] + + +class PlacementGroupList(BaseModel): + count: int + """ + '#/components/schemas/ServerGroupSerializerList/properties/count' + "$.components.schemas.ServerGroupSerializerList.properties.count" + """ + + results: List[PlacementGroup] + """ + '#/components/schemas/ServerGroupSerializerList/properties/results' + "$.components.schemas.ServerGroupSerializerList.properties.results" + """ diff --git a/tests/api_resources/cloud/test_placement_groups.py b/tests/api_resources/cloud/test_placement_groups.py new file mode 100644 index 00000000..a6962d8d --- /dev/null +++ b/tests/api_resources/cloud/test_placement_groups.py @@ -0,0 +1,354 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import TaskIDList, PlacementGroup, PlacementGroupList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPlacementGroups: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + placement_group = client.cloud.placement_groups.create( + project_id=0, + region_id=0, + name="my-server-group", + policy="anti-affinity", + ) + assert_matches_type(PlacementGroup, placement_group, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.placement_groups.with_raw_response.create( + project_id=0, + region_id=0, + name="my-server-group", + policy="anti-affinity", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + placement_group = response.parse() + assert_matches_type(PlacementGroup, placement_group, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.placement_groups.with_streaming_response.create( + project_id=0, + region_id=0, + name="my-server-group", + policy="anti-affinity", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + placement_group = response.parse() + assert_matches_type(PlacementGroup, placement_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + placement_group = client.cloud.placement_groups.list( + project_id=0, + region_id=0, + ) + assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.placement_groups.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + placement_group = response.parse() + assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.placement_groups.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + placement_group = response.parse() + assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + placement_group = client.cloud.placement_groups.delete( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, placement_group, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.placement_groups.with_raw_response.delete( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + placement_group = response.parse() + assert_matches_type(TaskIDList, placement_group, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.placement_groups.with_streaming_response.delete( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + placement_group = response.parse() + assert_matches_type(TaskIDList, placement_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + client.cloud.placement_groups.with_raw_response.delete( + group_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + placement_group = client.cloud.placement_groups.get( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert_matches_type(PlacementGroup, placement_group, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.placement_groups.with_raw_response.get( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + placement_group = response.parse() + assert_matches_type(PlacementGroup, placement_group, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.placement_groups.with_streaming_response.get( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + placement_group = response.parse() + assert_matches_type(PlacementGroup, placement_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + client.cloud.placement_groups.with_raw_response.get( + group_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncPlacementGroups: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + placement_group = await async_client.cloud.placement_groups.create( + project_id=0, + region_id=0, + name="my-server-group", + policy="anti-affinity", + ) + assert_matches_type(PlacementGroup, placement_group, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.placement_groups.with_raw_response.create( + project_id=0, + region_id=0, + name="my-server-group", + policy="anti-affinity", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + placement_group = await response.parse() + assert_matches_type(PlacementGroup, placement_group, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.placement_groups.with_streaming_response.create( + project_id=0, + region_id=0, + name="my-server-group", + policy="anti-affinity", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + placement_group = await response.parse() + assert_matches_type(PlacementGroup, placement_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + placement_group = await async_client.cloud.placement_groups.list( + project_id=0, + region_id=0, + ) + assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.placement_groups.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + placement_group = await response.parse() + assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.placement_groups.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + placement_group = await response.parse() + assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + placement_group = await async_client.cloud.placement_groups.delete( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, placement_group, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.placement_groups.with_raw_response.delete( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + placement_group = await response.parse() + assert_matches_type(TaskIDList, placement_group, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.placement_groups.with_streaming_response.delete( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + placement_group = await response.parse() + assert_matches_type(TaskIDList, placement_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + await async_client.cloud.placement_groups.with_raw_response.delete( + group_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + placement_group = await async_client.cloud.placement_groups.get( + group_id="group_id", + project_id=0, + region_id=0, + ) + assert_matches_type(PlacementGroup, placement_group, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.placement_groups.with_raw_response.get( + group_id="group_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + placement_group = await response.parse() + assert_matches_type(PlacementGroup, placement_group, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.placement_groups.with_streaming_response.get( + group_id="group_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + placement_group = await response.parse() + assert_matches_type(PlacementGroup, placement_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + await async_client.cloud.placement_groups.with_raw_response.get( + group_id="", + project_id=0, + region_id=0, + ) From 875527ed63a1d80563213c5497700778f7cc8deb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Apr 2025 15:44:19 +0000 Subject: [PATCH 074/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 7 +- src/gcore/resources/cloud/networks/routers.py | 9 +- src/gcore/resources/cloud/networks/subnets.py | 9 +- src/gcore/resources/cloud/quotas/requests.py | 24 +- src/gcore/types/cloud/__init__.py | 2 - src/gcore/types/cloud/file_share.py | 1 + src/gcore/types/cloud/floating_ip_detailed.py | 64 +-- src/gcore/types/cloud/load_balancer.py | 22 +- src/gcore/types/cloud/networks/router.py | 26 +- .../cloud/networks/router_create_params.py | 19 +- .../cloud/networks/router_update_params.py | 20 +- .../cloud/networks/subnet_create_params.py | 19 +- .../cloud/networks/subnet_update_params.py | 22 +- src/gcore/types/cloud/neutron_route.py | 19 - src/gcore/types/cloud/neutron_route_param.py | 21 - src/gcore/types/cloud/quotas/__init__.py | 1 + .../cloud/quotas/request_list_response.py | 394 ++++++++++++++++++ src/gcore/types/cloud/subnet.py | 19 +- src/gcore/types/cloud/volume.py | 1 + .../cloud/quotas/test_requests.py | 19 +- 21 files changed, 579 insertions(+), 143 deletions(-) delete mode 100644 src/gcore/types/cloud/neutron_route.py delete mode 100644 src/gcore/types/cloud/neutron_route_param.py create mode 100644 src/gcore/types/cloud/quotas/request_list_response.py diff --git a/.stats.yml b/.stats.yml index 284777df..341d4982 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 103 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c0ddd251e17b7132e029bd882ca5724bfc8cf506b5c471c52aac7996593de1a8.yml -openapi_spec_hash: 852c6dc29b57bb698cf759b01428dad5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1b085537d9cf740f2b3313109b3be0f00952207abc6f1fee686579c070e71fc2.yml +openapi_spec_hash: 61acc4dd694c9d01c88941c577deb740 config_hash: a572942392d31c30f030939f9375bec6 diff --git a/api.md b/api.md index 70205c66..57e4305f 100644 --- a/api.md +++ b/api.md @@ -4,7 +4,6 @@ Types: ```python from gcore.types.cloud import ( - BaremetalFlavorList, Console, DDOSProfile, DDOSProfileField, @@ -26,8 +25,6 @@ from gcore.types.cloud import ( LoadBalancerOperatingStatus, LoadBalancerStatistics, Network, - NeutronRoute, - PortList, ProvisioningStatus, Subnet, Tag, @@ -99,13 +96,13 @@ Methods: Types: ```python -from gcore.types.cloud.quotas import RequestGetResponse +from gcore.types.cloud.quotas import RequestListResponse, RequestGetResponse ``` Methods: - client.cloud.quotas.requests.create(\*\*params) -> None -- client.cloud.quotas.requests.list(\*\*params) -> None +- client.cloud.quotas.requests.list(\*\*params) -> SyncOffsetPage[RequestListResponse] - client.cloud.quotas.requests.delete(request_id) -> None - client.cloud.quotas.requests.get(request_id) -> RequestGetResponse diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index b4007f42..300c0359 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -27,7 +27,6 @@ ) from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.networks.router import Router -from ....types.cloud.neutron_route_param import NeutronRouteParam __all__ = ["RoutersResource", "AsyncRoutersResource"] @@ -60,7 +59,7 @@ def create( name: str, external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, interfaces: Optional[Iterable[router_create_params.Interface]] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[router_create_params.Route]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -127,7 +126,7 @@ def update( region_id: int | None = None, external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[router_update_params.Route]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -479,7 +478,7 @@ async def create( name: str, external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, interfaces: Optional[Iterable[router_create_params.Interface]] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[router_create_params.Route]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -546,7 +545,7 @@ async def update( region_id: int | None = None, external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + routes: Optional[Iterable[router_update_params.Route]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index c5bab612..9d02aeb0 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -24,7 +24,6 @@ from ....types.cloud.networks import subnet_list_params, subnet_create_params, subnet_update_params from ....types.cloud.ip_version import IPVersion from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.neutron_route_param import NeutronRouteParam __all__ = ["SubnetsResource", "AsyncSubnetsResource"] @@ -61,7 +60,7 @@ def create( dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, enable_dhcp: bool | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, @@ -160,7 +159,7 @@ def update( dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -454,7 +453,7 @@ async def create( dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, enable_dhcp: bool | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, @@ -553,7 +552,7 @@ async def update( dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[NeutronRouteParam]] | NotGiven = NOT_GIVEN, + host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index fc98fc3b..eefc7328 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -17,9 +17,11 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.quotas import request_list_params, request_create_params from ....types.cloud.quotas.request_get_response import RequestGetResponse +from ....types.cloud.quotas.request_list_response import RequestListResponse __all__ = ["RequestsResource", "AsyncRequestsResource"] @@ -107,7 +109,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: + ) -> SyncOffsetPage[RequestListResponse]: """ Returns a list of sent requests to change current quotas and their statuses @@ -129,9 +131,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._get( + return self._get_api_list( "/cloud/v2/limits_request", + page=SyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -146,7 +148,7 @@ def list( request_list_params.RequestListParams, ), ), - cast_to=NoneType, + model=RequestListResponse, ) def delete( @@ -294,7 +296,7 @@ async def create( cast_to=NoneType, ) - async def list( + def list( self, *, limit: int | NotGiven = NOT_GIVEN, @@ -306,7 +308,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: + ) -> AsyncPaginator[RequestListResponse, AsyncOffsetPage[RequestListResponse]]: """ Returns a list of sent requests to change current quotas and their statuses @@ -328,15 +330,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._get( + return self._get_api_list( "/cloud/v2/limits_request", + page=AsyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "limit": limit, "offset": offset, @@ -345,7 +347,7 @@ async def list( request_list_params.RequestListParams, ), ), - cast_to=NoneType, + model=RequestListResponse, ) async def delete( diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 5c8821a4..1dd63405 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -20,7 +20,6 @@ from .ddos_profile import DDOSProfile as DDOSProfile from .task_id_list import TaskIDList as TaskIDList from .load_balancer import LoadBalancer as LoadBalancer -from .neutron_route import NeutronRoute as NeutronRoute from .security_group import SecurityGroup as SecurityGroup from .placement_group import PlacementGroup as PlacementGroup from .ssh_key_created import SSHKeyCreated as SSHKeyCreated @@ -34,7 +33,6 @@ from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .network_list_params import NetworkListParams as NetworkListParams -from .neutron_route_param import NeutronRouteParam as NeutronRouteParam from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus from .security_group_rule import SecurityGroupRule as SecurityGroupRule diff --git a/src/gcore/types/cloud/file_share.py b/src/gcore/types/cloud/file_share.py index fc069797..21032a65 100644 --- a/src/gcore/types/cloud/file_share.py +++ b/src/gcore/types/cloud/file_share.py @@ -110,6 +110,7 @@ class FileShare(BaseModel): "creating_from_snapshot", "deleted", "deleting", + "ensuring", "error", "error_deleting", "extending", diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index 738b9ae9..58a9f364 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -13,85 +13,85 @@ "FloatingIPDetailed", "Instance", "InstanceAddress", - "InstanceAddressSimpleAddressSerializer", - "InstanceAddressAddressInterfaceSerializer", - "InstanceAddressAddressDetailedSerializer", + "InstanceAddressInstanceFloatingAddressSerializer", + "InstanceAddressInstanceFixedAddressShortSerializer", + "InstanceAddressInstanceFixedAddressSerializer", "InstanceFlavor", "InstanceSecurityGroup", "InstanceVolume", ] -class InstanceAddressSimpleAddressSerializer(BaseModel): +class InstanceAddressInstanceFloatingAddressSerializer(BaseModel): addr: str """ - '#/components/schemas/SimpleAddressSerializer/properties/addr' - "$.components.schemas.SimpleAddressSerializer.properties.addr" + '#/components/schemas/InstanceFloatingAddressSerializer/properties/addr' + "$.components.schemas.InstanceFloatingAddressSerializer.properties.addr" """ - type: str + type: Literal["floating"] """ - '#/components/schemas/SimpleAddressSerializer/properties/type' - "$.components.schemas.SimpleAddressSerializer.properties.type" + '#/components/schemas/InstanceFloatingAddressSerializer/properties/type' + "$.components.schemas.InstanceFloatingAddressSerializer.properties.type" """ -class InstanceAddressAddressInterfaceSerializer(BaseModel): +class InstanceAddressInstanceFixedAddressShortSerializer(BaseModel): addr: str """ - '#/components/schemas/AddressInterfaceSerializer/properties/addr' - "$.components.schemas.AddressInterfaceSerializer.properties.addr" + '#/components/schemas/InstanceFixedAddressShortSerializer/properties/addr' + "$.components.schemas.InstanceFixedAddressShortSerializer.properties.addr" """ interface_name: Optional[str] = None """ - '#/components/schemas/AddressInterfaceSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.AddressInterfaceSerializer.properties.interface_name.anyOf[0]" + '#/components/schemas/InstanceFixedAddressShortSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.InstanceFixedAddressShortSerializer.properties.interface_name.anyOf[0]" """ - type: str + type: Literal["fixed"] """ - '#/components/schemas/AddressInterfaceSerializer/properties/type' - "$.components.schemas.AddressInterfaceSerializer.properties.type" + '#/components/schemas/InstanceFixedAddressShortSerializer/properties/type' + "$.components.schemas.InstanceFixedAddressShortSerializer.properties.type" """ -class InstanceAddressAddressDetailedSerializer(BaseModel): +class InstanceAddressInstanceFixedAddressSerializer(BaseModel): addr: str """ - '#/components/schemas/AddressDetailedSerializer/properties/addr' - "$.components.schemas.AddressDetailedSerializer.properties.addr" + '#/components/schemas/InstanceFixedAddressSerializer/properties/addr' + "$.components.schemas.InstanceFixedAddressSerializer.properties.addr" """ interface_name: Optional[str] = None """ - '#/components/schemas/AddressDetailedSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.AddressDetailedSerializer.properties.interface_name.anyOf[0]" + '#/components/schemas/InstanceFixedAddressSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.InstanceFixedAddressSerializer.properties.interface_name.anyOf[0]" """ subnet_id: str """ - '#/components/schemas/AddressDetailedSerializer/properties/subnet_id' - "$.components.schemas.AddressDetailedSerializer.properties.subnet_id" + '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_id' + "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_id" """ subnet_name: str """ - '#/components/schemas/AddressDetailedSerializer/properties/subnet_name' - "$.components.schemas.AddressDetailedSerializer.properties.subnet_name" + '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_name' + "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_name" """ - type: str + type: Literal["fixed"] """ - '#/components/schemas/AddressDetailedSerializer/properties/type' - "$.components.schemas.AddressDetailedSerializer.properties.type" + '#/components/schemas/InstanceFixedAddressSerializer/properties/type' + "$.components.schemas.InstanceFixedAddressSerializer.properties.type" """ InstanceAddress: TypeAlias = Union[ - InstanceAddressSimpleAddressSerializer, - InstanceAddressAddressInterfaceSerializer, - InstanceAddressAddressDetailedSerializer, + InstanceAddressInstanceFloatingAddressSerializer, + InstanceAddressInstanceFixedAddressShortSerializer, + InstanceAddressInstanceFixedAddressSerializer, ] diff --git a/src/gcore/types/cloud/load_balancer.py b/src/gcore/types/cloud/load_balancer.py index 58077913..b883c3b4 100644 --- a/src/gcore/types/cloud/load_balancer.py +++ b/src/gcore/types/cloud/load_balancer.py @@ -76,26 +76,26 @@ class LoggingRetentionPolicy(BaseModel): class Logging(BaseModel): destination_region_id: Optional[int] = None """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/destination_region_id/anyOf/0' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.destination_region_id.anyOf[0]" + '#/components/schemas/LoggingOutSerializer/properties/destination_region_id/anyOf/0' + "$.components.schemas.LoggingOutSerializer.properties.destination_region_id.anyOf[0]" """ - enabled: Optional[bool] = None + enabled: bool """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/enabled' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.enabled" + '#/components/schemas/LoggingOutSerializer/properties/enabled' + "$.components.schemas.LoggingOutSerializer.properties.enabled" """ - retention_policy: Optional[LoggingRetentionPolicy] = None + topic_name: Optional[str] = None """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/retention_policy/anyOf/0' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.retention_policy.anyOf[0]" + '#/components/schemas/LoggingOutSerializer/properties/topic_name/anyOf/0' + "$.components.schemas.LoggingOutSerializer.properties.topic_name.anyOf[0]" """ - topic_name: Optional[str] = None + retention_policy: Optional[LoggingRetentionPolicy] = None """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/topic_name/anyOf/0' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.topic_name.anyOf[0]" + '#/components/schemas/LoggingOutSerializer/properties/retention_policy/anyOf/0' + "$.components.schemas.LoggingOutSerializer.properties.retention_policy.anyOf[0]" """ diff --git a/src/gcore/types/cloud/networks/router.py b/src/gcore/types/cloud/networks/router.py index dfe2fb5f..53a33e9a 100644 --- a/src/gcore/types/cloud/networks/router.py +++ b/src/gcore/types/cloud/networks/router.py @@ -4,9 +4,15 @@ from datetime import datetime from ...._models import BaseModel -from ..neutron_route import NeutronRoute -__all__ = ["Router", "Interface", "InterfaceIPAssignment", "ExternalGatewayInfo", "ExternalGatewayInfoExternalFixedIP"] +__all__ = [ + "Router", + "Interface", + "InterfaceIPAssignment", + "Route", + "ExternalGatewayInfo", + "ExternalGatewayInfoExternalFixedIP", +] class InterfaceIPAssignment(BaseModel): @@ -49,6 +55,20 @@ class Interface(BaseModel): """ +class Route(BaseModel): + destination: str + """ + '#/components/schemas/RouteOutSerializer/properties/destination' + "$.components.schemas.RouteOutSerializer.properties.destination" + """ + + nexthop: str + """ + '#/components/schemas/RouteOutSerializer/properties/nexthop' + "$.components.schemas.RouteOutSerializer.properties.nexthop" + """ + + class ExternalGatewayInfoExternalFixedIP(BaseModel): ip_address: str """ @@ -132,7 +152,7 @@ class Router(BaseModel): "$.components.schemas.RouterSerializer.properties.region_id" """ - routes: List[NeutronRoute] + routes: List[Route] """ '#/components/schemas/RouterSerializer/properties/routes' "$.components.schemas.RouterSerializer.properties.routes" diff --git a/src/gcore/types/cloud/networks/router_create_params.py b/src/gcore/types/cloud/networks/router_create_params.py index b47d07a6..b0422a10 100644 --- a/src/gcore/types/cloud/networks/router_create_params.py +++ b/src/gcore/types/cloud/networks/router_create_params.py @@ -5,14 +5,13 @@ from typing import Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict -from ..neutron_route_param import NeutronRouteParam - __all__ = [ "RouterCreateParams", "ExternalGatewayInfo", "ExternalGatewayInfoRouterExternalManualGwSerializer", "ExternalGatewayInfoRouterExternalDefaultGwSerializer", "Interface", + "Route", ] @@ -47,7 +46,7 @@ class RouterCreateParams(TypedDict, total=False): "$.components.schemas.CreateRouterSerializer.properties.interfaces.anyOf[0]" """ - routes: Optional[Iterable[NeutronRouteParam]] + routes: Optional[Iterable[Route]] """ '#/components/schemas/CreateRouterSerializer/properties/routes/anyOf/0' "$.components.schemas.CreateRouterSerializer.properties.routes.anyOf[0]" @@ -105,3 +104,17 @@ class Interface(TypedDict, total=False): '#/components/schemas/CreateRouterInterfaceSubnetSerializer/properties/type' "$.components.schemas.CreateRouterInterfaceSubnetSerializer.properties.type" """ + + +class Route(TypedDict, total=False): + destination: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/destination' + "$.components.schemas.RouteInSerializer.properties.destination" + """ + + nexthop: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/nexthop' + "$.components.schemas.RouteInSerializer.properties.nexthop" + """ diff --git a/src/gcore/types/cloud/networks/router_update_params.py b/src/gcore/types/cloud/networks/router_update_params.py index 53aab8f1..29c33e1f 100644 --- a/src/gcore/types/cloud/networks/router_update_params.py +++ b/src/gcore/types/cloud/networks/router_update_params.py @@ -5,9 +5,7 @@ from typing import Iterable, Optional from typing_extensions import Literal, Required, TypedDict -from ..neutron_route_param import NeutronRouteParam - -__all__ = ["RouterUpdateParams", "ExternalGatewayInfo"] +__all__ = ["RouterUpdateParams", "ExternalGatewayInfo", "Route"] class RouterUpdateParams(TypedDict, total=False): @@ -35,7 +33,7 @@ class RouterUpdateParams(TypedDict, total=False): "$.components.schemas.PatchRouterSerializer.properties.name.anyOf[0]" """ - routes: Optional[Iterable[NeutronRouteParam]] + routes: Optional[Iterable[Route]] """ '#/components/schemas/PatchRouterSerializer/properties/routes/anyOf/0' "$.components.schemas.PatchRouterSerializer.properties.routes.anyOf[0]" @@ -60,3 +58,17 @@ class ExternalGatewayInfo(TypedDict, total=False): '#/components/schemas/RouterExternalManualGwSerializer/properties/type' "$.components.schemas.RouterExternalManualGwSerializer.properties.type" """ + + +class Route(TypedDict, total=False): + destination: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/destination' + "$.components.schemas.RouteInSerializer.properties.destination" + """ + + nexthop: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/nexthop' + "$.components.schemas.RouteInSerializer.properties.nexthop" + """ diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index 0801eb1c..e4fde91d 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -6,9 +6,8 @@ from typing_extensions import Required, TypedDict from ..ip_version import IPVersion -from ..neutron_route_param import NeutronRouteParam -__all__ = ["SubnetCreateParams"] +__all__ = ["SubnetCreateParams", "HostRoute"] class SubnetCreateParams(TypedDict, total=False): @@ -66,7 +65,7 @@ class SubnetCreateParams(TypedDict, total=False): "$.components.schemas.CreateSubnetSerializer.properties.gateway_ip.anyOf[0]" """ - host_routes: Optional[Iterable[NeutronRouteParam]] + host_routes: Optional[Iterable[HostRoute]] """ '#/components/schemas/CreateSubnetSerializer/properties/host_routes/anyOf/0' "$.components.schemas.CreateSubnetSerializer.properties.host_routes.anyOf[0]" @@ -89,3 +88,17 @@ class SubnetCreateParams(TypedDict, total=False): '#/components/schemas/CreateSubnetSerializer/properties/router_id_to_connect/anyOf/0' "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" """ + + +class HostRoute(TypedDict, total=False): + destination: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/destination' + "$.components.schemas.RouteInSerializer.properties.destination" + """ + + nexthop: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/nexthop' + "$.components.schemas.RouteInSerializer.properties.nexthop" + """ diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index aa96d08b..ca79f228 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -3,11 +3,9 @@ from __future__ import annotations from typing import List, Iterable, Optional -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict -from ..neutron_route_param import NeutronRouteParam - -__all__ = ["SubnetUpdateParams"] +__all__ = ["SubnetUpdateParams", "HostRoute"] class SubnetUpdateParams(TypedDict, total=False): @@ -41,7 +39,7 @@ class SubnetUpdateParams(TypedDict, total=False): "$.components.schemas.PatchSubnetSerializer.properties.gateway_ip.anyOf[0]" """ - host_routes: Optional[Iterable[NeutronRouteParam]] + host_routes: Optional[Iterable[HostRoute]] """ '#/components/schemas/PatchSubnetSerializer/properties/host_routes/anyOf/0' "$.components.schemas.PatchSubnetSerializer.properties.host_routes.anyOf[0]" @@ -52,3 +50,17 @@ class SubnetUpdateParams(TypedDict, total=False): '#/components/schemas/PatchSubnetSerializer/properties/name/anyOf/0' "$.components.schemas.PatchSubnetSerializer.properties.name.anyOf[0]" """ + + +class HostRoute(TypedDict, total=False): + destination: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/destination' + "$.components.schemas.RouteInSerializer.properties.destination" + """ + + nexthop: Required[str] + """ + '#/components/schemas/RouteInSerializer/properties/nexthop' + "$.components.schemas.RouteInSerializer.properties.nexthop" + """ diff --git a/src/gcore/types/cloud/neutron_route.py b/src/gcore/types/cloud/neutron_route.py deleted file mode 100644 index 59eea1e8..00000000 --- a/src/gcore/types/cloud/neutron_route.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["NeutronRoute"] - - -class NeutronRoute(BaseModel): - destination: str - """ - '#/components/schemas/NeutronRouteSerializer/properties/destination' - "$.components.schemas.NeutronRouteSerializer.properties.destination" - """ - - nexthop: str - """ - '#/components/schemas/NeutronRouteSerializer/properties/nexthop' - "$.components.schemas.NeutronRouteSerializer.properties.nexthop" - """ diff --git a/src/gcore/types/cloud/neutron_route_param.py b/src/gcore/types/cloud/neutron_route_param.py deleted file mode 100644 index 24651682..00000000 --- a/src/gcore/types/cloud/neutron_route_param.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["NeutronRouteParam"] - - -class NeutronRouteParam(TypedDict, total=False): - destination: Required[str] - """ - '#/components/schemas/NeutronRouteSerializer/properties/destination' - "$.components.schemas.NeutronRouteSerializer.properties.destination" - """ - - nexthop: Required[str] - """ - '#/components/schemas/NeutronRouteSerializer/properties/nexthop' - "$.components.schemas.NeutronRouteSerializer.properties.nexthop" - """ diff --git a/src/gcore/types/cloud/quotas/__init__.py b/src/gcore/types/cloud/quotas/__init__.py index 8bf1b202..600a55cb 100644 --- a/src/gcore/types/cloud/quotas/__init__.py +++ b/src/gcore/types/cloud/quotas/__init__.py @@ -5,3 +5,4 @@ from .request_list_params import RequestListParams as RequestListParams from .request_get_response import RequestGetResponse as RequestGetResponse from .request_create_params import RequestCreateParams as RequestCreateParams +from .request_list_response import RequestListResponse as RequestListResponse diff --git a/src/gcore/types/cloud/quotas/request_list_response.py b/src/gcore/types/cloud/quotas/request_list_response.py new file mode 100644 index 00000000..7d043c9c --- /dev/null +++ b/src/gcore/types/cloud/quotas/request_list_response.py @@ -0,0 +1,394 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["RequestListResponse", "RequestedLimits", "RequestedLimitsGlobalLimits", "RequestedLimitsRegionalLimit"] + + +class RequestedLimitsGlobalLimits(BaseModel): + inference_cpu_millicore_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_cpu_millicore_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_cpu_millicore_count_limit" + """ + + inference_gpu_a100_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_a100_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_a100_count_limit" + """ + + inference_gpu_h100_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_h100_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_h100_count_limit" + """ + + inference_gpu_l40s_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_l40s_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_l40s_count_limit" + """ + + inference_instance_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_instance_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_instance_count_limit" + """ + + keypair_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/keypair_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.keypair_count_limit" + """ + + project_count_limit: Optional[int] = None + """ + '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/project_count_limit' + "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.project_count_limit" + """ + + +class RequestedLimitsRegionalLimit(BaseModel): + baremetal_basic_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_basic_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_basic_count_limit" + """ + + baremetal_gpu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_gpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_gpu_count_limit" + """ + + baremetal_hf_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_hf_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_hf_count_limit" + """ + + baremetal_infrastructure_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_infrastructure_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_infrastructure_count_limit" + """ + + baremetal_network_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_network_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_network_count_limit" + """ + + baremetal_storage_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_storage_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_storage_count_limit" + """ + + caas_container_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_container_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_container_count_limit" + """ + + caas_cpu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_cpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_cpu_count_limit" + """ + + caas_gpu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_gpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_gpu_count_limit" + """ + + caas_ram_size_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_ram_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_ram_size_limit" + """ + + cluster_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cluster_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cluster_count_limit" + """ + + cpu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cpu_count_limit" + """ + + dbaas_postgres_cluster_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/dbaas_postgres_cluster_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.dbaas_postgres_cluster_count_limit" + """ + + external_ip_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/external_ip_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.external_ip_count_limit" + """ + + faas_cpu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_cpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_cpu_count_limit" + """ + + faas_function_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_function_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_function_count_limit" + """ + + faas_namespace_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_namespace_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_namespace_count_limit" + """ + + faas_ram_size_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_ram_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_ram_size_limit" + """ + + firewall_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/firewall_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.firewall_count_limit" + """ + + floating_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/floating_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.floating_count_limit" + """ + + gpu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_count_limit" + """ + + gpu_virtual_a100_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_a100_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_a100_count_limit" + """ + + gpu_virtual_h100_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_h100_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_h100_count_limit" + """ + + gpu_virtual_l40s_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_l40s_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_l40s_count_limit" + """ + + image_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_count_limit" + """ + + image_size_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_size_limit" + """ + + ipu_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ipu_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ipu_count_limit" + """ + + laas_topic_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/laas_topic_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.laas_topic_count_limit" + """ + + loadbalancer_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/loadbalancer_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.loadbalancer_count_limit" + """ + + network_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/network_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.network_count_limit" + """ + + ram_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ram_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ram_limit" + """ + + region_id: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/region_id' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.region_id" + """ + + registry_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_count_limit" + """ + + registry_storage_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_storage_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_storage_limit" + """ + + router_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/router_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.router_count_limit" + """ + + secret_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/secret_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.secret_count_limit" + """ + + servergroup_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/servergroup_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.servergroup_count_limit" + """ + + sfs_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_count_limit" + """ + + sfs_size_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_size_limit" + """ + + shared_vm_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/shared_vm_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.shared_vm_count_limit" + """ + + snapshot_schedule_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/snapshot_schedule_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.snapshot_schedule_count_limit" + """ + + subnet_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/subnet_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.subnet_count_limit" + """ + + vm_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/vm_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.vm_count_limit" + """ + + volume_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_count_limit" + """ + + volume_size_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_size_limit" + """ + + volume_snapshots_count_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_count_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_count_limit" + """ + + volume_snapshots_size_limit: Optional[int] = None + """ + '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_size_limit' + "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_size_limit" + """ + + +class RequestedLimits(BaseModel): + global_limits: Optional[RequestedLimitsGlobalLimits] = None + """ + '#/components/schemas/AllClientQuotasLimitsSerializer/properties/global_limits' + "$.components.schemas.AllClientQuotasLimitsSerializer.properties.global_limits" + """ + + regional_limits: Optional[List[RequestedLimitsRegionalLimit]] = None + """ + '#/components/schemas/AllClientQuotasLimitsSerializer/properties/regional_limits' + "$.components.schemas.AllClientQuotasLimitsSerializer.properties.regional_limits" + """ + + +class RequestListResponse(BaseModel): + id: int + """ + '#/components/schemas/LimitsRequestSerializer/properties/id' + "$.components.schemas.LimitsRequestSerializer.properties.id" + """ + + client_id: int + """ + '#/components/schemas/LimitsRequestSerializer/properties/client_id' + "$.components.schemas.LimitsRequestSerializer.properties.client_id" + """ + + requested_limits: RequestedLimits + """ + '#/components/schemas/LimitsRequestSerializer/properties/requested_limits' + "$.components.schemas.LimitsRequestSerializer.properties.requested_limits" + """ + + status: str + """ + '#/components/schemas/LimitsRequestSerializer/properties/status' + "$.components.schemas.LimitsRequestSerializer.properties.status" + """ + + created_at: Optional[datetime] = None + """ + '#/components/schemas/LimitsRequestSerializer/properties/created_at' + "$.components.schemas.LimitsRequestSerializer.properties.created_at" + """ + + description: Optional[str] = None + """ + '#/components/schemas/LimitsRequestSerializer/properties/description/anyOf/0' + "$.components.schemas.LimitsRequestSerializer.properties.description.anyOf[0]" + """ + + updated_at: Optional[datetime] = None + """ + '#/components/schemas/LimitsRequestSerializer/properties/updated_at/anyOf/0' + "$.components.schemas.LimitsRequestSerializer.properties.updated_at.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/subnet.py b/src/gcore/types/cloud/subnet.py index 943cee49..9b4420b3 100644 --- a/src/gcore/types/cloud/subnet.py +++ b/src/gcore/types/cloud/subnet.py @@ -6,9 +6,22 @@ from .tag import Tag from ..._models import BaseModel from .ip_version import IPVersion -from .neutron_route import NeutronRoute -__all__ = ["Subnet"] +__all__ = ["Subnet", "HostRoute"] + + +class HostRoute(BaseModel): + destination: str + """ + '#/components/schemas/RouteOutSerializer/properties/destination' + "$.components.schemas.RouteOutSerializer.properties.destination" + """ + + nexthop: str + """ + '#/components/schemas/RouteOutSerializer/properties/nexthop' + "$.components.schemas.RouteOutSerializer.properties.nexthop" + """ class Subnet(BaseModel): @@ -114,7 +127,7 @@ class Subnet(BaseModel): "$.components.schemas.SubnetSerializer.properties.has_router" """ - host_routes: Optional[List[NeutronRoute]] = None + host_routes: Optional[List[HostRoute]] = None """ '#/components/schemas/SubnetSerializer/properties/host_routes/anyOf/0' "$.components.schemas.SubnetSerializer.properties.host_routes.anyOf[0]" diff --git a/src/gcore/types/cloud/volume.py b/src/gcore/types/cloud/volume.py index dadcb691..c5655971 100644 --- a/src/gcore/types/cloud/volume.py +++ b/src/gcore/types/cloud/volume.py @@ -163,6 +163,7 @@ class Volume(BaseModel): "reserved", "restoring-backup", "retyping", + "reverting", "uploading", ] """ diff --git a/tests/api_resources/cloud/quotas/test_requests.py b/tests/api_resources/cloud/quotas/test_requests.py index 4cb9bf1b..55d95441 100644 --- a/tests/api_resources/cloud/quotas/test_requests.py +++ b/tests/api_resources/cloud/quotas/test_requests.py @@ -9,7 +9,8 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.quotas import RequestGetResponse +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud.quotas import RequestGetResponse, RequestListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -124,7 +125,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: request = client.cloud.quotas.requests.list() - assert request is None + assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -133,7 +134,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: offset=0, status=["done", "in progress"], ) - assert request is None + assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -142,7 +143,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert request is None + assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -151,7 +152,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert request is None + assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -342,7 +343,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: request = await async_client.cloud.quotas.requests.list() - assert request is None + assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -351,7 +352,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No offset=0, status=["done", "in progress"], ) - assert request is None + assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -360,7 +361,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert request is None + assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -369,7 +370,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert request is None + assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) assert cast(Any, response.is_closed) is True From 7d68a256b7e19a0e30efc011ea248cb9d567238d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Apr 2025 16:37:58 +0000 Subject: [PATCH 075/592] GCLOUD2-18675 Add cloud load balancers --- .stats.yml | 4 +- api.md | 119 ++ src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + .../cloud/load_balancers/__init__.py | 103 ++ .../resources/cloud/load_balancers/flavors.py | 207 +++ .../load_balancers/l7_policies/__init__.py | 33 + .../load_balancers/l7_policies/l7_policies.py | 830 ++++++++++ .../cloud/load_balancers/l7_policies/rules.py | 846 ++++++++++ .../cloud/load_balancers/listeners.py | 906 +++++++++++ .../cloud/load_balancers/load_balancers.py | 1384 +++++++++++++++++ .../resources/cloud/load_balancers/metrics.py | 227 +++ .../cloud/load_balancers/pools/__init__.py | 47 + .../load_balancers/pools/health_monitors.py | 400 +++++ .../cloud/load_balancers/pools/members.py | 407 +++++ .../cloud/load_balancers/pools/pools.py | 1004 ++++++++++++ .../cloud/load_balancers/statuses.py | 290 ++++ src/gcore/types/cloud/__init__.py | 33 + src/gcore/types/cloud/detailed_lb_pool.py | 146 ++ .../types/cloud/detailed_lb_pool_list.py | 22 + .../types/cloud/detailed_lb_pool_member.py | 71 + .../cloud/flavor_hardware_description.py | 57 + .../types/cloud/health_monitor_status.py | 34 + src/gcore/types/cloud/health_monitor_type.py | 7 + src/gcore/types/cloud/http_method.py | 7 + src/gcore/types/cloud/l7_policy.py | 115 ++ src/gcore/types/cloud/l7_policy_list.py | 22 + src/gcore/types/cloud/l7_rule.py | 101 ++ src/gcore/types/cloud/l7_rule_list.py | 22 + src/gcore/types/cloud/lb_algorithm.py | 7 + src/gcore/types/cloud/lb_flavor_list.py | 81 + src/gcore/types/cloud/lb_health_monitor.py | 85 + src/gcore/types/cloud/lb_listener.py | 147 ++ src/gcore/types/cloud/lb_listener_list.py | 22 + src/gcore/types/cloud/lb_listener_protocol.py | 7 + src/gcore/types/cloud/lb_pool_protocol.py | 7 + .../types/cloud/lb_session_persistence.py | 34 + src/gcore/types/cloud/listener_status.py | 42 + .../cloud/load_balancer_create_params.py | 489 ++++++ .../cloud/load_balancer_failover_params.py | 27 + .../types/cloud/load_balancer_get_params.py | 33 + .../types/cloud/load_balancer_list_params.py | 81 + .../cloud/load_balancer_resize_params.py | 27 + src/gcore/types/cloud/load_balancer_status.py | 55 + .../types/cloud/load_balancer_status_list.py | 22 + .../cloud/load_balancer_update_params.py | 76 + .../types/cloud/load_balancers/__init__.py | 15 + .../load_balancers/flavor_list_params.py | 27 + .../load_balancers/l7_policies/__init__.py | 6 + .../l7_policies/rule_create_params.py | 69 + .../l7_policies/rule_replace_params.py | 66 + .../load_balancers/l7_policy_create_params.py | 76 + .../l7_policy_replace_params.py | 70 + .../load_balancers/listener_create_params.py | 116 ++ .../load_balancers/listener_get_params.py | 27 + .../load_balancers/listener_list_params.py | 33 + .../load_balancers/listener_update_params.py | 90 ++ .../load_balancers/metric_list_params.py | 35 + .../load_balancers/pool_create_params.py | 238 +++ .../cloud/load_balancers/pool_list_params.py | 39 + .../load_balancers/pool_update_params.py | 226 +++ .../cloud/load_balancers/pools/__init__.py | 6 + .../pools/health_monitor_create_params.py | 74 + .../load_balancers/pools/member_add_params.py | 70 + src/gcore/types/cloud/loadbalancer_metrics.py | 53 + .../types/cloud/loadbalancer_metrics_list.py | 22 + src/gcore/types/cloud/member_status.py | 39 + src/gcore/types/cloud/pool_status.py | 49 + .../types/cloud/session_persistence_type.py | 7 + .../cloud/load_balancers/__init__.py | 1 + .../load_balancers/l7_policies/__init__.py | 1 + .../load_balancers/l7_policies/test_rules.py | 640 ++++++++ .../cloud/load_balancers/pools/__init__.py | 1 + .../pools/test_health_monitors.py | 272 ++++ .../load_balancers/pools/test_members.py | 280 ++++ .../cloud/load_balancers/test_flavors.py | 108 ++ .../cloud/load_balancers/test_l7_policies.py | 522 +++++++ .../cloud/load_balancers/test_listeners.py | 596 +++++++ .../cloud/load_balancers/test_metrics.py | 130 ++ .../cloud/load_balancers/test_pools.py | 680 ++++++++ .../cloud/load_balancers/test_statuses.py | 182 +++ .../cloud/test_load_balancers.py | 946 +++++++++++ 82 files changed, 14542 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/load_balancers/__init__.py create mode 100644 src/gcore/resources/cloud/load_balancers/flavors.py create mode 100644 src/gcore/resources/cloud/load_balancers/l7_policies/__init__.py create mode 100644 src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py create mode 100644 src/gcore/resources/cloud/load_balancers/l7_policies/rules.py create mode 100644 src/gcore/resources/cloud/load_balancers/listeners.py create mode 100644 src/gcore/resources/cloud/load_balancers/load_balancers.py create mode 100644 src/gcore/resources/cloud/load_balancers/metrics.py create mode 100644 src/gcore/resources/cloud/load_balancers/pools/__init__.py create mode 100644 src/gcore/resources/cloud/load_balancers/pools/health_monitors.py create mode 100644 src/gcore/resources/cloud/load_balancers/pools/members.py create mode 100644 src/gcore/resources/cloud/load_balancers/pools/pools.py create mode 100644 src/gcore/resources/cloud/load_balancers/statuses.py create mode 100644 src/gcore/types/cloud/detailed_lb_pool.py create mode 100644 src/gcore/types/cloud/detailed_lb_pool_list.py create mode 100644 src/gcore/types/cloud/detailed_lb_pool_member.py create mode 100644 src/gcore/types/cloud/flavor_hardware_description.py create mode 100644 src/gcore/types/cloud/health_monitor_status.py create mode 100644 src/gcore/types/cloud/health_monitor_type.py create mode 100644 src/gcore/types/cloud/http_method.py create mode 100644 src/gcore/types/cloud/l7_policy.py create mode 100644 src/gcore/types/cloud/l7_policy_list.py create mode 100644 src/gcore/types/cloud/l7_rule.py create mode 100644 src/gcore/types/cloud/l7_rule_list.py create mode 100644 src/gcore/types/cloud/lb_algorithm.py create mode 100644 src/gcore/types/cloud/lb_flavor_list.py create mode 100644 src/gcore/types/cloud/lb_health_monitor.py create mode 100644 src/gcore/types/cloud/lb_listener.py create mode 100644 src/gcore/types/cloud/lb_listener_list.py create mode 100644 src/gcore/types/cloud/lb_listener_protocol.py create mode 100644 src/gcore/types/cloud/lb_pool_protocol.py create mode 100644 src/gcore/types/cloud/lb_session_persistence.py create mode 100644 src/gcore/types/cloud/listener_status.py create mode 100644 src/gcore/types/cloud/load_balancer_create_params.py create mode 100644 src/gcore/types/cloud/load_balancer_failover_params.py create mode 100644 src/gcore/types/cloud/load_balancer_get_params.py create mode 100644 src/gcore/types/cloud/load_balancer_list_params.py create mode 100644 src/gcore/types/cloud/load_balancer_resize_params.py create mode 100644 src/gcore/types/cloud/load_balancer_status.py create mode 100644 src/gcore/types/cloud/load_balancer_status_list.py create mode 100644 src/gcore/types/cloud/load_balancer_update_params.py create mode 100644 src/gcore/types/cloud/load_balancers/__init__.py create mode 100644 src/gcore/types/cloud/load_balancers/flavor_list_params.py create mode 100644 src/gcore/types/cloud/load_balancers/l7_policies/__init__.py create mode 100644 src/gcore/types/cloud/load_balancers/l7_policies/rule_create_params.py create mode 100644 src/gcore/types/cloud/load_balancers/l7_policies/rule_replace_params.py create mode 100644 src/gcore/types/cloud/load_balancers/l7_policy_create_params.py create mode 100644 src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py create mode 100644 src/gcore/types/cloud/load_balancers/listener_create_params.py create mode 100644 src/gcore/types/cloud/load_balancers/listener_get_params.py create mode 100644 src/gcore/types/cloud/load_balancers/listener_list_params.py create mode 100644 src/gcore/types/cloud/load_balancers/listener_update_params.py create mode 100644 src/gcore/types/cloud/load_balancers/metric_list_params.py create mode 100644 src/gcore/types/cloud/load_balancers/pool_create_params.py create mode 100644 src/gcore/types/cloud/load_balancers/pool_list_params.py create mode 100644 src/gcore/types/cloud/load_balancers/pool_update_params.py create mode 100644 src/gcore/types/cloud/load_balancers/pools/__init__.py create mode 100644 src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py create mode 100644 src/gcore/types/cloud/load_balancers/pools/member_add_params.py create mode 100644 src/gcore/types/cloud/loadbalancer_metrics.py create mode 100644 src/gcore/types/cloud/loadbalancer_metrics_list.py create mode 100644 src/gcore/types/cloud/member_status.py create mode 100644 src/gcore/types/cloud/pool_status.py create mode 100644 src/gcore/types/cloud/session_persistence_type.py create mode 100644 tests/api_resources/cloud/load_balancers/__init__.py create mode 100644 tests/api_resources/cloud/load_balancers/l7_policies/__init__.py create mode 100644 tests/api_resources/cloud/load_balancers/l7_policies/test_rules.py create mode 100644 tests/api_resources/cloud/load_balancers/pools/__init__.py create mode 100644 tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py create mode 100644 tests/api_resources/cloud/load_balancers/pools/test_members.py create mode 100644 tests/api_resources/cloud/load_balancers/test_flavors.py create mode 100644 tests/api_resources/cloud/load_balancers/test_l7_policies.py create mode 100644 tests/api_resources/cloud/load_balancers/test_listeners.py create mode 100644 tests/api_resources/cloud/load_balancers/test_metrics.py create mode 100644 tests/api_resources/cloud/load_balancers/test_pools.py create mode 100644 tests/api_resources/cloud/load_balancers/test_statuses.py create mode 100644 tests/api_resources/cloud/test_load_balancers.py diff --git a/.stats.yml b/.stats.yml index 341d4982..b84c0d63 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 103 +configured_endpoints: 138 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1b085537d9cf740f2b3313109b3be0f00952207abc6f1fee686579c070e71fc2.yml openapi_spec_hash: 61acc4dd694c9d01c88941c577deb740 -config_hash: a572942392d31c30f030939f9375bec6 +config_hash: c5eaa6ab250cfbddab458eb251f7af30 diff --git a/api.md b/api.md index 57e4305f..431824c0 100644 --- a/api.md +++ b/api.md @@ -150,6 +150,125 @@ Methods: - client.cloud.ip_ranges.list() -> IPRanges +## LoadBalancers + +Types: + +```python +from gcore.types.cloud import ( + DetailedLbPool, + DetailedLbPoolList, + DetailedLbPoolMember, + HealthMonitorStatus, + HealthMonitorType, + HTTPMethod, + L7Policy, + L7PolicyList, + L7Rule, + L7RuleList, + LaasIndexRetentionPolicy, + LbAlgorithm, + LbFlavorList, + LbHealthMonitor, + LbListener, + LbListenerList, + LbListenerProtocol, + LbPoolProtocol, + LbSessionPersistence, + ListenerStatus, + LoadBalancerStatus, + LoadBalancerStatusList, + LoadbalancerMetrics, + LoadbalancerMetricsList, + MemberStatus, + PoolStatus, + SessionPersistenceType, +) +``` + +Methods: + +- client.cloud.load_balancers.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.update(loadbalancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer +- client.cloud.load_balancers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[LoadBalancer] +- client.cloud.load_balancers.delete(loadbalancer_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.load_balancers.failover(loadbalancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.get(loadbalancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer +- client.cloud.load_balancers.resize(loadbalancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList + +### L7Policies + +Methods: + +- client.cloud.load_balancers.l7_policies.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.l7_policies.list(\*, project_id, region_id) -> L7PolicyList +- 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) -> L7Policy +- client.cloud.load_balancers.l7_policies.replace(l7policy_id, \*, project_id, region_id, \*\*params) -> TaskIDList + +#### Rules + +Methods: + +- client.cloud.load_balancers.l7_policies.rules.create(l7policy_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.l7_policies.rules.list(l7policy_id, \*, project_id, region_id) -> L7RuleList +- client.cloud.load_balancers.l7_policies.rules.delete(l7rule_id, \*, project_id, region_id, l7policy_id) -> TaskIDList +- client.cloud.load_balancers.l7_policies.rules.get(l7rule_id, \*, project_id, region_id, l7policy_id) -> L7Rule +- client.cloud.load_balancers.l7_policies.rules.replace(l7rule_id, \*, project_id, region_id, l7policy_id, \*\*params) -> TaskIDList + +### Flavors + +Methods: + +- client.cloud.load_balancers.flavors.list(\*, project_id, region_id, \*\*params) -> LbFlavorList + +### Listeners + +Methods: + +- client.cloud.load_balancers.listeners.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.listeners.update(listener_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.listeners.list(\*, project_id, region_id, \*\*params) -> LbListenerList +- client.cloud.load_balancers.listeners.delete(listener_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.load_balancers.listeners.get(listener_id, \*, project_id, region_id, \*\*params) -> LbListener + +### Pools + +Methods: + +- client.cloud.load_balancers.pools.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.pools.update(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.pools.list(\*, project_id, region_id, \*\*params) -> DetailedLbPoolList +- client.cloud.load_balancers.pools.delete(pool_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.load_balancers.pools.get(pool_id, \*, project_id, region_id) -> DetailedLbPool + +#### HealthMonitors + +Methods: + +- client.cloud.load_balancers.pools.health_monitors.create(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.pools.health_monitors.delete(pool_id, \*, project_id, region_id) -> None + +#### Members + +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 + +### Metrics + +Methods: + +- client.cloud.load_balancers.metrics.list(loadbalancer_id, \*, project_id, region_id, \*\*params) -> LoadbalancerMetricsList + +### Statuses + +Methods: + +- client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> LoadBalancerStatusList +- client.cloud.load_balancers.statuses.get(loadbalancer_id, \*, project_id, region_id) -> LoadBalancerStatus + ## ReservedFixedIPs Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 9e9a5c46..7acc474e 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -112,6 +112,14 @@ FloatingIPsResourceWithStreamingResponse, AsyncFloatingIPsResourceWithStreamingResponse, ) +from .load_balancers import ( + LoadBalancersResource, + AsyncLoadBalancersResource, + LoadBalancersResourceWithRawResponse, + AsyncLoadBalancersResourceWithRawResponse, + LoadBalancersResourceWithStreamingResponse, + AsyncLoadBalancersResourceWithStreamingResponse, +) from .security_groups import ( SecurityGroupsResource, AsyncSecurityGroupsResource, @@ -188,6 +196,12 @@ "AsyncIPRangesResourceWithRawResponse", "IPRangesResourceWithStreamingResponse", "AsyncIPRangesResourceWithStreamingResponse", + "LoadBalancersResource", + "AsyncLoadBalancersResource", + "LoadBalancersResourceWithRawResponse", + "AsyncLoadBalancersResourceWithRawResponse", + "LoadBalancersResourceWithStreamingResponse", + "AsyncLoadBalancersResourceWithStreamingResponse", "ReservedFixedIPsResource", "AsyncReservedFixedIPsResource", "ReservedFixedIPsResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 116d5383..5a93ea45 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -124,6 +124,14 @@ FileSharesResourceWithStreamingResponse, AsyncFileSharesResourceWithStreamingResponse, ) +from .load_balancers.load_balancers import ( + LoadBalancersResource, + AsyncLoadBalancersResource, + LoadBalancersResourceWithRawResponse, + AsyncLoadBalancersResourceWithRawResponse, + LoadBalancersResourceWithStreamingResponse, + AsyncLoadBalancersResourceWithStreamingResponse, +) from .security_groups.security_groups import ( SecurityGroupsResource, AsyncSecurityGroupsResource, @@ -173,6 +181,10 @@ def ssh_keys(self) -> SSHKeysResource: def ip_ranges(self) -> IPRangesResource: return IPRangesResource(self._client) + @cached_property + def load_balancers(self) -> LoadBalancersResource: + return LoadBalancersResource(self._client) + @cached_property def reserved_fixed_ips(self) -> ReservedFixedIPsResource: return ReservedFixedIPsResource(self._client) @@ -262,6 +274,10 @@ def ssh_keys(self) -> AsyncSSHKeysResource: def ip_ranges(self) -> AsyncIPRangesResource: return AsyncIPRangesResource(self._client) + @cached_property + def load_balancers(self) -> AsyncLoadBalancersResource: + return AsyncLoadBalancersResource(self._client) + @cached_property def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResource: return AsyncReservedFixedIPsResource(self._client) @@ -354,6 +370,10 @@ def ssh_keys(self) -> SSHKeysResourceWithRawResponse: def ip_ranges(self) -> IPRangesResourceWithRawResponse: return IPRangesResourceWithRawResponse(self._cloud.ip_ranges) + @cached_property + def load_balancers(self) -> LoadBalancersResourceWithRawResponse: + return LoadBalancersResourceWithRawResponse(self._cloud.load_balancers) + @cached_property def reserved_fixed_ips(self) -> ReservedFixedIPsResourceWithRawResponse: return ReservedFixedIPsResourceWithRawResponse(self._cloud.reserved_fixed_ips) @@ -427,6 +447,10 @@ def ssh_keys(self) -> AsyncSSHKeysResourceWithRawResponse: def ip_ranges(self) -> AsyncIPRangesResourceWithRawResponse: return AsyncIPRangesResourceWithRawResponse(self._cloud.ip_ranges) + @cached_property + def load_balancers(self) -> AsyncLoadBalancersResourceWithRawResponse: + return AsyncLoadBalancersResourceWithRawResponse(self._cloud.load_balancers) + @cached_property def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResourceWithRawResponse: return AsyncReservedFixedIPsResourceWithRawResponse(self._cloud.reserved_fixed_ips) @@ -500,6 +524,10 @@ def ssh_keys(self) -> SSHKeysResourceWithStreamingResponse: def ip_ranges(self) -> IPRangesResourceWithStreamingResponse: return IPRangesResourceWithStreamingResponse(self._cloud.ip_ranges) + @cached_property + def load_balancers(self) -> LoadBalancersResourceWithStreamingResponse: + return LoadBalancersResourceWithStreamingResponse(self._cloud.load_balancers) + @cached_property def reserved_fixed_ips(self) -> ReservedFixedIPsResourceWithStreamingResponse: return ReservedFixedIPsResourceWithStreamingResponse(self._cloud.reserved_fixed_ips) @@ -573,6 +601,10 @@ def ssh_keys(self) -> AsyncSSHKeysResourceWithStreamingResponse: def ip_ranges(self) -> AsyncIPRangesResourceWithStreamingResponse: return AsyncIPRangesResourceWithStreamingResponse(self._cloud.ip_ranges) + @cached_property + def load_balancers(self) -> AsyncLoadBalancersResourceWithStreamingResponse: + return AsyncLoadBalancersResourceWithStreamingResponse(self._cloud.load_balancers) + @cached_property def reserved_fixed_ips(self) -> AsyncReservedFixedIPsResourceWithStreamingResponse: return AsyncReservedFixedIPsResourceWithStreamingResponse(self._cloud.reserved_fixed_ips) diff --git a/src/gcore/resources/cloud/load_balancers/__init__.py b/src/gcore/resources/cloud/load_balancers/__init__.py new file mode 100644 index 00000000..4de45722 --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/__init__.py @@ -0,0 +1,103 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .pools import ( + PoolsResource, + AsyncPoolsResource, + PoolsResourceWithRawResponse, + AsyncPoolsResourceWithRawResponse, + PoolsResourceWithStreamingResponse, + AsyncPoolsResourceWithStreamingResponse, +) +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) +from .statuses import ( + StatusesResource, + AsyncStatusesResource, + StatusesResourceWithRawResponse, + AsyncStatusesResourceWithRawResponse, + StatusesResourceWithStreamingResponse, + AsyncStatusesResourceWithStreamingResponse, +) +from .listeners import ( + ListenersResource, + AsyncListenersResource, + ListenersResourceWithRawResponse, + AsyncListenersResourceWithRawResponse, + ListenersResourceWithStreamingResponse, + AsyncListenersResourceWithStreamingResponse, +) +from .l7_policies import ( + L7PoliciesResource, + AsyncL7PoliciesResource, + L7PoliciesResourceWithRawResponse, + AsyncL7PoliciesResourceWithRawResponse, + L7PoliciesResourceWithStreamingResponse, + AsyncL7PoliciesResourceWithStreamingResponse, +) +from .load_balancers import ( + LoadBalancersResource, + AsyncLoadBalancersResource, + LoadBalancersResourceWithRawResponse, + AsyncLoadBalancersResourceWithRawResponse, + LoadBalancersResourceWithStreamingResponse, + AsyncLoadBalancersResourceWithStreamingResponse, +) + +__all__ = [ + "L7PoliciesResource", + "AsyncL7PoliciesResource", + "L7PoliciesResourceWithRawResponse", + "AsyncL7PoliciesResourceWithRawResponse", + "L7PoliciesResourceWithStreamingResponse", + "AsyncL7PoliciesResourceWithStreamingResponse", + "FlavorsResource", + "AsyncFlavorsResource", + "FlavorsResourceWithRawResponse", + "AsyncFlavorsResourceWithRawResponse", + "FlavorsResourceWithStreamingResponse", + "AsyncFlavorsResourceWithStreamingResponse", + "ListenersResource", + "AsyncListenersResource", + "ListenersResourceWithRawResponse", + "AsyncListenersResourceWithRawResponse", + "ListenersResourceWithStreamingResponse", + "AsyncListenersResourceWithStreamingResponse", + "PoolsResource", + "AsyncPoolsResource", + "PoolsResourceWithRawResponse", + "AsyncPoolsResourceWithRawResponse", + "PoolsResourceWithStreamingResponse", + "AsyncPoolsResourceWithStreamingResponse", + "MetricsResource", + "AsyncMetricsResource", + "MetricsResourceWithRawResponse", + "AsyncMetricsResourceWithRawResponse", + "MetricsResourceWithStreamingResponse", + "AsyncMetricsResourceWithStreamingResponse", + "StatusesResource", + "AsyncStatusesResource", + "StatusesResourceWithRawResponse", + "AsyncStatusesResourceWithRawResponse", + "StatusesResourceWithStreamingResponse", + "AsyncStatusesResourceWithStreamingResponse", + "LoadBalancersResource", + "AsyncLoadBalancersResource", + "LoadBalancersResourceWithRawResponse", + "AsyncLoadBalancersResourceWithRawResponse", + "LoadBalancersResourceWithStreamingResponse", + "AsyncLoadBalancersResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py new file mode 100644 index 00000000..12169d7e --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -0,0 +1,207 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.lb_flavor_list import LbFlavorList +from ....types.cloud.load_balancers import flavor_list_params + +__all__ = ["FlavorsResource", "AsyncFlavorsResource"] + + +class FlavorsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FlavorsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return FlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return FlavorsResourceWithStreamingResponse(self) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + include_prices: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LbFlavorList: + """Retrieve a list of load balancer flavors. + + When the include_prices query + parameter is specified, the list shows prices. A client in trial mode gets all + price values as 0. If you get Pricing Error contact the support + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[1].schema" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[2]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/lbflavors/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"include_prices": include_prices}, flavor_list_params.FlavorListParams), + ), + cast_to=LbFlavorList, + ) + + +class AsyncFlavorsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFlavorsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncFlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncFlavorsResourceWithStreamingResponse(self) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + include_prices: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LbFlavorList: + """Retrieve a list of load balancer flavors. + + When the include_prices query + parameter is specified, the list shows prices. A client in trial mode gets all + price values as 0. If you get Pricing Error contact the support + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[1].schema" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[2]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/lbflavors/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"include_prices": include_prices}, flavor_list_params.FlavorListParams + ), + ), + cast_to=LbFlavorList, + ) + + +class FlavorsResourceWithRawResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_raw_response_wrapper( + flavors.list, + ) + + +class AsyncFlavorsResourceWithRawResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_raw_response_wrapper( + flavors.list, + ) + + +class FlavorsResourceWithStreamingResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_streamed_response_wrapper( + flavors.list, + ) + + +class AsyncFlavorsResourceWithStreamingResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_streamed_response_wrapper( + flavors.list, + ) diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/__init__.py b/src/gcore/resources/cloud/load_balancers/l7_policies/__init__.py new file mode 100644 index 00000000..fcd15923 --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .rules import ( + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, +) +from .l7_policies import ( + L7PoliciesResource, + AsyncL7PoliciesResource, + L7PoliciesResourceWithRawResponse, + AsyncL7PoliciesResourceWithRawResponse, + L7PoliciesResourceWithStreamingResponse, + AsyncL7PoliciesResourceWithStreamingResponse, +) + +__all__ = [ + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "L7PoliciesResource", + "AsyncL7PoliciesResource", + "L7PoliciesResourceWithRawResponse", + "AsyncL7PoliciesResourceWithRawResponse", + "L7PoliciesResourceWithStreamingResponse", + "AsyncL7PoliciesResourceWithStreamingResponse", +] 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 new file mode 100644 index 00000000..5f35d513 --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py @@ -0,0 +1,830 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal + +import httpx + +from .rules import ( + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, +) +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.cloud.l7_policy import L7Policy +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.l7_policy_list import L7PolicyList +from .....types.cloud.load_balancers import l7_policy_create_params, l7_policy_replace_params + +__all__ = ["L7PoliciesResource", "AsyncL7PoliciesResource"] + + +class L7PoliciesResource(SyncAPIResource): + @cached_property + def rules(self) -> RulesResource: + return RulesResource(self._client) + + @cached_property + def with_raw_response(self) -> L7PoliciesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return L7PoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> L7PoliciesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return L7PoliciesResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], + listener_id: str, + name: str | NotGiven = NOT_GIVEN, + position: int | NotGiven = NOT_GIVEN, + redirect_http_code: int | NotGiven = NOT_GIVEN, + redirect_pool_id: str | NotGiven = NOT_GIVEN, + redirect_prefix: str | NotGiven = NOT_GIVEN, + redirect_url: str | NotGiven = NOT_GIVEN, + tags: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create load balancer L7 policy + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].post.parameters[1].schema" + + action: '#/components/schemas/CreateL7PolicySchema/properties/action' + "$.components.schemas.CreateL7PolicySchema.properties.action" + + listener_id: '#/components/schemas/CreateL7PolicySchema/properties/listener_id' + "$.components.schemas.CreateL7PolicySchema.properties.listener_id" + + name: '#/components/schemas/CreateL7PolicySchema/properties/name' + "$.components.schemas.CreateL7PolicySchema.properties.name" + + position: '#/components/schemas/CreateL7PolicySchema/properties/position' + "$.components.schemas.CreateL7PolicySchema.properties.position" + + redirect_http_code: '#/components/schemas/CreateL7PolicySchema/properties/redirect_http_code' + "$.components.schemas.CreateL7PolicySchema.properties.redirect_http_code" + + redirect_pool_id: '#/components/schemas/CreateL7PolicySchema/properties/redirect_pool_id' + "$.components.schemas.CreateL7PolicySchema.properties.redirect_pool_id" + + redirect_prefix: '#/components/schemas/CreateL7PolicySchema/properties/redirect_prefix' + "$.components.schemas.CreateL7PolicySchema.properties.redirect_prefix" + + redirect_url: '#/components/schemas/CreateL7PolicySchema/properties/redirect_url' + "$.components.schemas.CreateL7PolicySchema.properties.redirect_url" + + tags: '#/components/schemas/CreateL7PolicySchema/properties/tags' + "$.components.schemas.CreateL7PolicySchema.properties.tags" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/l7policies/{project_id}/{region_id}", + body=maybe_transform( + { + "action": action, + "listener_id": listener_id, + "name": name, + "position": position, + "redirect_http_code": redirect_http_code, + "redirect_pool_id": redirect_pool_id, + "redirect_prefix": redirect_prefix, + "redirect_url": redirect_url, + "tags": tags, + }, + l7_policy_create_params.L7PolicyCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> L7PolicyList: + """ + List load balancer L7 policies + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/l7policies/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=L7PolicyList, + ) + + def delete( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete load balancer L7 policy + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}']['delete'].parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + return self._delete( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> L7Policy: + """ + Get load balancer L7 policy + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].get.parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + return self._get( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=L7Policy, + ) + + def replace( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], + name: str | NotGiven = NOT_GIVEN, + position: int | NotGiven = NOT_GIVEN, + redirect_http_code: int | NotGiven = NOT_GIVEN, + redirect_pool_id: str | NotGiven = NOT_GIVEN, + redirect_prefix: str | NotGiven = NOT_GIVEN, + redirect_url: str | NotGiven = NOT_GIVEN, + tags: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Replace load balancer L7 policy properties + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[2].schema" + + action: '#/components/schemas/UpdateL7PolicySchema/properties/action' + "$.components.schemas.UpdateL7PolicySchema.properties.action" + + name: '#/components/schemas/UpdateL7PolicySchema/properties/name' + "$.components.schemas.UpdateL7PolicySchema.properties.name" + + position: '#/components/schemas/UpdateL7PolicySchema/properties/position' + "$.components.schemas.UpdateL7PolicySchema.properties.position" + + redirect_http_code: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_http_code' + "$.components.schemas.UpdateL7PolicySchema.properties.redirect_http_code" + + redirect_pool_id: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_pool_id' + "$.components.schemas.UpdateL7PolicySchema.properties.redirect_pool_id" + + redirect_prefix: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_prefix' + "$.components.schemas.UpdateL7PolicySchema.properties.redirect_prefix" + + redirect_url: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_url' + "$.components.schemas.UpdateL7PolicySchema.properties.redirect_url" + + tags: '#/components/schemas/UpdateL7PolicySchema/properties/tags' + "$.components.schemas.UpdateL7PolicySchema.properties.tags" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not 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, + "name": name, + "position": position, + "redirect_http_code": redirect_http_code, + "redirect_pool_id": redirect_pool_id, + "redirect_prefix": redirect_prefix, + "redirect_url": redirect_url, + "tags": tags, + }, + 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, + ) + + +class AsyncL7PoliciesResource(AsyncAPIResource): + @cached_property + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncL7PoliciesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncL7PoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncL7PoliciesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncL7PoliciesResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], + listener_id: str, + name: str | NotGiven = NOT_GIVEN, + position: int | NotGiven = NOT_GIVEN, + redirect_http_code: int | NotGiven = NOT_GIVEN, + redirect_pool_id: str | NotGiven = NOT_GIVEN, + redirect_prefix: str | NotGiven = NOT_GIVEN, + redirect_url: str | NotGiven = NOT_GIVEN, + tags: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create load balancer L7 policy + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].post.parameters[1].schema" + + action: '#/components/schemas/CreateL7PolicySchema/properties/action' + "$.components.schemas.CreateL7PolicySchema.properties.action" + + listener_id: '#/components/schemas/CreateL7PolicySchema/properties/listener_id' + "$.components.schemas.CreateL7PolicySchema.properties.listener_id" + + name: '#/components/schemas/CreateL7PolicySchema/properties/name' + "$.components.schemas.CreateL7PolicySchema.properties.name" + + position: '#/components/schemas/CreateL7PolicySchema/properties/position' + "$.components.schemas.CreateL7PolicySchema.properties.position" + + redirect_http_code: '#/components/schemas/CreateL7PolicySchema/properties/redirect_http_code' + "$.components.schemas.CreateL7PolicySchema.properties.redirect_http_code" + + redirect_pool_id: '#/components/schemas/CreateL7PolicySchema/properties/redirect_pool_id' + "$.components.schemas.CreateL7PolicySchema.properties.redirect_pool_id" + + redirect_prefix: '#/components/schemas/CreateL7PolicySchema/properties/redirect_prefix' + "$.components.schemas.CreateL7PolicySchema.properties.redirect_prefix" + + redirect_url: '#/components/schemas/CreateL7PolicySchema/properties/redirect_url' + "$.components.schemas.CreateL7PolicySchema.properties.redirect_url" + + tags: '#/components/schemas/CreateL7PolicySchema/properties/tags' + "$.components.schemas.CreateL7PolicySchema.properties.tags" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/l7policies/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "action": action, + "listener_id": listener_id, + "name": name, + "position": position, + "redirect_http_code": redirect_http_code, + "redirect_pool_id": redirect_pool_id, + "redirect_prefix": redirect_prefix, + "redirect_url": redirect_url, + "tags": tags, + }, + l7_policy_create_params.L7PolicyCreateParams, + ), + 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, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> L7PolicyList: + """ + List load balancer L7 policies + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/l7policies/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=L7PolicyList, + ) + + async def delete( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete load balancer L7 policy + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}']['delete'].parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + return await self._delete( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> L7Policy: + """ + Get load balancer L7 policy + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].get.parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + return await self._get( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=L7Policy, + ) + + async def replace( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], + name: str | NotGiven = NOT_GIVEN, + position: int | NotGiven = NOT_GIVEN, + redirect_http_code: int | NotGiven = NOT_GIVEN, + redirect_pool_id: str | NotGiven = NOT_GIVEN, + redirect_prefix: str | NotGiven = NOT_GIVEN, + redirect_url: str | NotGiven = NOT_GIVEN, + tags: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Replace load balancer L7 policy properties + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[2].schema" + + action: '#/components/schemas/UpdateL7PolicySchema/properties/action' + "$.components.schemas.UpdateL7PolicySchema.properties.action" + + name: '#/components/schemas/UpdateL7PolicySchema/properties/name' + "$.components.schemas.UpdateL7PolicySchema.properties.name" + + position: '#/components/schemas/UpdateL7PolicySchema/properties/position' + "$.components.schemas.UpdateL7PolicySchema.properties.position" + + redirect_http_code: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_http_code' + "$.components.schemas.UpdateL7PolicySchema.properties.redirect_http_code" + + redirect_pool_id: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_pool_id' + "$.components.schemas.UpdateL7PolicySchema.properties.redirect_pool_id" + + redirect_prefix: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_prefix' + "$.components.schemas.UpdateL7PolicySchema.properties.redirect_prefix" + + redirect_url: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_url' + "$.components.schemas.UpdateL7PolicySchema.properties.redirect_url" + + tags: '#/components/schemas/UpdateL7PolicySchema/properties/tags' + "$.components.schemas.UpdateL7PolicySchema.properties.tags" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not 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, + "name": name, + "position": position, + "redirect_http_code": redirect_http_code, + "redirect_pool_id": redirect_pool_id, + "redirect_prefix": redirect_prefix, + "redirect_url": redirect_url, + "tags": tags, + }, + 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, + ) + + +class L7PoliciesResourceWithRawResponse: + def __init__(self, l7_policies: L7PoliciesResource) -> None: + self._l7_policies = l7_policies + + self.create = to_raw_response_wrapper( + l7_policies.create, + ) + self.list = to_raw_response_wrapper( + l7_policies.list, + ) + self.delete = to_raw_response_wrapper( + l7_policies.delete, + ) + self.get = to_raw_response_wrapper( + l7_policies.get, + ) + self.replace = to_raw_response_wrapper( + l7_policies.replace, + ) + + @cached_property + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._l7_policies.rules) + + +class AsyncL7PoliciesResourceWithRawResponse: + def __init__(self, l7_policies: AsyncL7PoliciesResource) -> None: + self._l7_policies = l7_policies + + self.create = async_to_raw_response_wrapper( + l7_policies.create, + ) + self.list = async_to_raw_response_wrapper( + l7_policies.list, + ) + self.delete = async_to_raw_response_wrapper( + l7_policies.delete, + ) + self.get = async_to_raw_response_wrapper( + l7_policies.get, + ) + self.replace = async_to_raw_response_wrapper( + l7_policies.replace, + ) + + @cached_property + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._l7_policies.rules) + + +class L7PoliciesResourceWithStreamingResponse: + def __init__(self, l7_policies: L7PoliciesResource) -> None: + self._l7_policies = l7_policies + + self.create = to_streamed_response_wrapper( + l7_policies.create, + ) + self.list = to_streamed_response_wrapper( + l7_policies.list, + ) + self.delete = to_streamed_response_wrapper( + l7_policies.delete, + ) + self.get = to_streamed_response_wrapper( + l7_policies.get, + ) + self.replace = to_streamed_response_wrapper( + l7_policies.replace, + ) + + @cached_property + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._l7_policies.rules) + + +class AsyncL7PoliciesResourceWithStreamingResponse: + def __init__(self, l7_policies: AsyncL7PoliciesResource) -> None: + self._l7_policies = l7_policies + + self.create = async_to_streamed_response_wrapper( + l7_policies.create, + ) + self.list = async_to_streamed_response_wrapper( + l7_policies.list, + ) + self.delete = async_to_streamed_response_wrapper( + l7_policies.delete, + ) + self.get = async_to_streamed_response_wrapper( + l7_policies.get, + ) + self.replace = async_to_streamed_response_wrapper( + l7_policies.replace, + ) + + @cached_property + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._l7_policies.rules) diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py new file mode 100644 index 00000000..75d667f5 --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -0,0 +1,846 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.cloud.l7_rule import L7Rule +from .....types.cloud.l7_rule_list import L7RuleList +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.load_balancers.l7_policies import rule_create_params, rule_replace_params + +__all__ = ["RulesResource", "AsyncRulesResource"] + + +class RulesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RulesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return RulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return RulesResourceWithStreamingResponse(self) + + def create( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"], + type: Literal[ + "COOKIE", + "FILE_TYPE", + "HEADER", + "HOST_NAME", + "PATH", + "SSL_CONN_HAS_CERT", + "SSL_DN_FIELD", + "SSL_VERIFY_RESULT", + ], + value: str, + invert: bool | NotGiven = NOT_GIVEN, + key: str | NotGiven = NOT_GIVEN, + tags: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create load balancer L7 rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[2].schema" + + compare_type: '#/components/schemas/CreateL7RuleSchema/properties/compare_type' + "$.components.schemas.CreateL7RuleSchema.properties.compare_type" + + type: '#/components/schemas/CreateL7RuleSchema/properties/type' + "$.components.schemas.CreateL7RuleSchema.properties.type" + + value: '#/components/schemas/CreateL7RuleSchema/properties/value' + "$.components.schemas.CreateL7RuleSchema.properties.value" + + invert: '#/components/schemas/CreateL7RuleSchema/properties/invert' + "$.components.schemas.CreateL7RuleSchema.properties.invert" + + key: '#/components/schemas/CreateL7RuleSchema/properties/key' + "$.components.schemas.CreateL7RuleSchema.properties.key" + + tags: '#/components/schemas/CreateL7RuleSchema/properties/tags' + "$.components.schemas.CreateL7RuleSchema.properties.tags" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + return self._post( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + body=maybe_transform( + { + "compare_type": compare_type, + "type": type, + "value": value, + "invert": invert, + "key": key, + "tags": tags, + }, + rule_create_params.RuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> L7RuleList: + """ + List load balancer L7 policy rules + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/get/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/get/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].get.parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/get/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + return self._get( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=L7RuleList, + ) + + def delete( + self, + l7rule_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + l7policy_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete load balancer L7 rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[2].schema" + + l7rule_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + if not l7rule_id: + raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") + return self._delete( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + l7rule_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + l7policy_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> L7Rule: + """ + Get load balancer L7 rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[2].schema" + + l7rule_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/3/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + if not l7rule_id: + raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") + return self._get( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=L7Rule, + ) + + def replace( + self, + l7rule_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + l7policy_id: str, + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | NotGiven = NOT_GIVEN, + invert: bool | NotGiven = NOT_GIVEN, + key: str | NotGiven = NOT_GIVEN, + tags: List[str] | NotGiven = NOT_GIVEN, + type: Literal[ + "COOKIE", + "FILE_TYPE", + "HEADER", + "HOST_NAME", + "PATH", + "SSL_CONN_HAS_CERT", + "SSL_DN_FIELD", + "SSL_VERIFY_RESULT", + ] + | NotGiven = NOT_GIVEN, + value: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Replace load balancer L7 rule properties + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[2].schema" + + l7rule_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/3/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[3].schema" + + compare_type: '#/components/schemas/UpdateL7RuleSchema/properties/compare_type' + "$.components.schemas.UpdateL7RuleSchema.properties.compare_type" + + invert: '#/components/schemas/UpdateL7RuleSchema/properties/invert' + "$.components.schemas.UpdateL7RuleSchema.properties.invert" + + key: '#/components/schemas/UpdateL7RuleSchema/properties/key' + "$.components.schemas.UpdateL7RuleSchema.properties.key" + + tags: '#/components/schemas/UpdateL7RuleSchema/properties/tags' + "$.components.schemas.UpdateL7RuleSchema.properties.tags" + + type: '#/components/schemas/UpdateL7RuleSchema/properties/type' + "$.components.schemas.UpdateL7RuleSchema.properties.type" + + value: '#/components/schemas/UpdateL7RuleSchema/properties/value' + "$.components.schemas.UpdateL7RuleSchema.properties.value" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + if not l7rule_id: + raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") + return self._put( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + body=maybe_transform( + { + "compare_type": compare_type, + "invert": invert, + "key": key, + "tags": tags, + "type": type, + "value": value, + }, + rule_replace_params.RuleReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncRulesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncRulesResourceWithStreamingResponse(self) + + async def create( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"], + type: Literal[ + "COOKIE", + "FILE_TYPE", + "HEADER", + "HOST_NAME", + "PATH", + "SSL_CONN_HAS_CERT", + "SSL_DN_FIELD", + "SSL_VERIFY_RESULT", + ], + value: str, + invert: bool | NotGiven = NOT_GIVEN, + key: str | NotGiven = NOT_GIVEN, + tags: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create load balancer L7 rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[2].schema" + + compare_type: '#/components/schemas/CreateL7RuleSchema/properties/compare_type' + "$.components.schemas.CreateL7RuleSchema.properties.compare_type" + + type: '#/components/schemas/CreateL7RuleSchema/properties/type' + "$.components.schemas.CreateL7RuleSchema.properties.type" + + value: '#/components/schemas/CreateL7RuleSchema/properties/value' + "$.components.schemas.CreateL7RuleSchema.properties.value" + + invert: '#/components/schemas/CreateL7RuleSchema/properties/invert' + "$.components.schemas.CreateL7RuleSchema.properties.invert" + + key: '#/components/schemas/CreateL7RuleSchema/properties/key' + "$.components.schemas.CreateL7RuleSchema.properties.key" + + tags: '#/components/schemas/CreateL7RuleSchema/properties/tags' + "$.components.schemas.CreateL7RuleSchema.properties.tags" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + return await self._post( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + body=await async_maybe_transform( + { + "compare_type": compare_type, + "type": type, + "value": value, + "invert": invert, + "key": key, + "tags": tags, + }, + rule_create_params.RuleCreateParams, + ), + 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, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> L7RuleList: + """ + List load balancer L7 policy rules + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/get/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/get/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].get.parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/get/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + return await self._get( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=L7RuleList, + ) + + async def delete( + self, + l7rule_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + l7policy_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete load balancer L7 rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[2].schema" + + l7rule_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + if not l7rule_id: + raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") + return await self._delete( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + l7rule_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + l7policy_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> L7Rule: + """ + Get load balancer L7 rule + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[2].schema" + + l7rule_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/3/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + if not l7rule_id: + raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") + return await self._get( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=L7Rule, + ) + + async def replace( + self, + l7rule_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + l7policy_id: str, + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | NotGiven = NOT_GIVEN, + invert: bool | NotGiven = NOT_GIVEN, + key: str | NotGiven = NOT_GIVEN, + tags: List[str] | NotGiven = NOT_GIVEN, + type: Literal[ + "COOKIE", + "FILE_TYPE", + "HEADER", + "HOST_NAME", + "PATH", + "SSL_CONN_HAS_CERT", + "SSL_DN_FIELD", + "SSL_VERIFY_RESULT", + ] + | NotGiven = NOT_GIVEN, + value: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Replace load balancer L7 rule properties + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[1].schema" + + l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[2].schema" + + l7rule_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/3/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[3].schema" + + compare_type: '#/components/schemas/UpdateL7RuleSchema/properties/compare_type' + "$.components.schemas.UpdateL7RuleSchema.properties.compare_type" + + invert: '#/components/schemas/UpdateL7RuleSchema/properties/invert' + "$.components.schemas.UpdateL7RuleSchema.properties.invert" + + key: '#/components/schemas/UpdateL7RuleSchema/properties/key' + "$.components.schemas.UpdateL7RuleSchema.properties.key" + + tags: '#/components/schemas/UpdateL7RuleSchema/properties/tags' + "$.components.schemas.UpdateL7RuleSchema.properties.tags" + + type: '#/components/schemas/UpdateL7RuleSchema/properties/type' + "$.components.schemas.UpdateL7RuleSchema.properties.type" + + value: '#/components/schemas/UpdateL7RuleSchema/properties/value' + "$.components.schemas.UpdateL7RuleSchema.properties.value" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + if not l7rule_id: + raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") + return await self._put( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + body=await async_maybe_transform( + { + "compare_type": compare_type, + "invert": invert, + "key": key, + "tags": tags, + "type": type, + "value": value, + }, + rule_replace_params.RuleReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: + self._rules = rules + + self.create = to_raw_response_wrapper( + rules.create, + ) + self.list = to_raw_response_wrapper( + rules.list, + ) + self.delete = to_raw_response_wrapper( + rules.delete, + ) + self.get = to_raw_response_wrapper( + rules.get, + ) + self.replace = to_raw_response_wrapper( + rules.replace, + ) + + +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: + self._rules = rules + + self.create = async_to_raw_response_wrapper( + rules.create, + ) + self.list = async_to_raw_response_wrapper( + rules.list, + ) + self.delete = async_to_raw_response_wrapper( + rules.delete, + ) + self.get = async_to_raw_response_wrapper( + rules.get, + ) + self.replace = async_to_raw_response_wrapper( + rules.replace, + ) + + +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: + self._rules = rules + + self.create = to_streamed_response_wrapper( + rules.create, + ) + self.list = to_streamed_response_wrapper( + rules.list, + ) + self.delete = to_streamed_response_wrapper( + rules.delete, + ) + self.get = to_streamed_response_wrapper( + rules.get, + ) + self.replace = to_streamed_response_wrapper( + rules.replace, + ) + + +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: + self._rules = rules + + self.create = async_to_streamed_response_wrapper( + rules.create, + ) + self.list = async_to_streamed_response_wrapper( + rules.list, + ) + self.delete = async_to_streamed_response_wrapper( + rules.delete, + ) + self.get = async_to_streamed_response_wrapper( + rules.get, + ) + self.replace = async_to_streamed_response_wrapper( + rules.replace, + ) diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py new file mode 100644 index 00000000..1e53c4e7 --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -0,0 +1,906 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....types.cloud import LbListenerProtocol +from ...._base_client import make_request_options +from ....types.cloud.lb_listener import LbListener +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.load_balancers import ( + listener_get_params, + listener_list_params, + listener_create_params, + listener_update_params, +) +from ....types.cloud.lb_listener_list import LbListenerList +from ....types.cloud.lb_listener_protocol import LbListenerProtocol + +__all__ = ["ListenersResource", "AsyncListenersResource"] + + +class ListenersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ListenersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return ListenersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ListenersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return ListenersResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + loadbalancer_id: str, + name: str, + protocol: LbListenerProtocol, + protocol_port: int, + allowed_cidrs: Optional[List[str]] | NotGiven = NOT_GIVEN, + connection_limit: int | NotGiven = NOT_GIVEN, + insert_x_forwarded: bool | NotGiven = NOT_GIVEN, + secret_id: str | NotGiven = NOT_GIVEN, + sni_secret_id: List[str] | NotGiven = NOT_GIVEN, + timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + user_list: Iterable[listener_create_params.UserList] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create load balancer listener + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].post.parameters[1].schema" + + loadbalancer_id: '#/components/schemas/CreateLbListenerSerializer/properties/loadbalancer_id' + "$.components.schemas.CreateLbListenerSerializer.properties.loadbalancer_id" + + name: '#/components/schemas/CreateLbListenerSerializer/properties/name' + "$.components.schemas.CreateLbListenerSerializer.properties.name" + + protocol: '#/components/schemas/CreateLbListenerSerializer/properties/protocol' + "$.components.schemas.CreateLbListenerSerializer.properties.protocol" + + protocol_port: '#/components/schemas/CreateLbListenerSerializer/properties/protocol_port' + "$.components.schemas.CreateLbListenerSerializer.properties.protocol_port" + + allowed_cidrs: '#/components/schemas/CreateLbListenerSerializer/properties/allowed_cidrs/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.allowed_cidrs.anyOf[0]" + + connection_limit: '#/components/schemas/CreateLbListenerSerializer/properties/connection_limit' + "$.components.schemas.CreateLbListenerSerializer.properties.connection_limit" + + insert_x_forwarded: '#/components/schemas/CreateLbListenerSerializer/properties/insert_x_forwarded' + "$.components.schemas.CreateLbListenerSerializer.properties.insert_x_forwarded" + + secret_id: '#/components/schemas/CreateLbListenerSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.secret_id.anyOf[0]" + + sni_secret_id: '#/components/schemas/CreateLbListenerSerializer/properties/sni_secret_id' + "$.components.schemas.CreateLbListenerSerializer.properties.sni_secret_id" + + timeout_client_data: '#/components/schemas/CreateLbListenerSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.timeout_client_data.anyOf[0]" + + timeout_member_connect: '#/components/schemas/CreateLbListenerSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.timeout_member_connect.anyOf[0]" + + timeout_member_data: '#/components/schemas/CreateLbListenerSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.timeout_member_data.anyOf[0]" + + user_list: '#/components/schemas/CreateLbListenerSerializer/properties/user_list' + "$.components.schemas.CreateLbListenerSerializer.properties.user_list" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/lblisteners/{project_id}/{region_id}", + body=maybe_transform( + { + "loadbalancer_id": loadbalancer_id, + "name": name, + "protocol": protocol, + "protocol_port": protocol_port, + "allowed_cidrs": allowed_cidrs, + "connection_limit": connection_limit, + "insert_x_forwarded": insert_x_forwarded, + "secret_id": secret_id, + "sni_secret_id": sni_secret_id, + "timeout_client_data": timeout_client_data, + "timeout_member_connect": timeout_member_connect, + "timeout_member_data": timeout_member_data, + "user_list": user_list, + }, + listener_create_params.ListenerCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + listener_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + allowed_cidrs: Optional[List[str]] | NotGiven = NOT_GIVEN, + connection_limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + secret_id: Optional[str] | NotGiven = NOT_GIVEN, + sni_secret_id: Optional[List[str]] | NotGiven = NOT_GIVEN, + timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + user_list: Optional[Iterable[listener_update_params.UserList]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Update listener + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[1].schema" + + listener_id: '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[2].schema" + + allowed_cidrs: '#/components/schemas/PatchLbListenerSerializer/properties/allowed_cidrs/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.allowed_cidrs.anyOf[0]" + + connection_limit: '#/components/schemas/PatchLbListenerSerializer/properties/connection_limit' + "$.components.schemas.PatchLbListenerSerializer.properties.connection_limit" + + name: '#/components/schemas/PatchLbListenerSerializer/properties/name' + "$.components.schemas.PatchLbListenerSerializer.properties.name" + + secret_id: '#/components/schemas/PatchLbListenerSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.secret_id.anyOf[0]" + + sni_secret_id: '#/components/schemas/PatchLbListenerSerializer/properties/sni_secret_id/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.sni_secret_id.anyOf[0]" + + timeout_client_data: '#/components/schemas/PatchLbListenerSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.timeout_client_data.anyOf[0]" + + timeout_member_connect: '#/components/schemas/PatchLbListenerSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.timeout_member_connect.anyOf[0]" + + timeout_member_data: '#/components/schemas/PatchLbListenerSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.timeout_member_data.anyOf[0]" + + user_list: '#/components/schemas/PatchLbListenerSerializer/properties/user_list/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.user_list.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not listener_id: + raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") + return self._patch( + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + body=maybe_transform( + { + "allowed_cidrs": allowed_cidrs, + "connection_limit": connection_limit, + "name": name, + "secret_id": secret_id, + "sni_secret_id": sni_secret_id, + "timeout_client_data": timeout_client_data, + "timeout_member_connect": timeout_member_connect, + "timeout_member_data": timeout_member_data, + "user_list": user_list, + }, + listener_update_params.ListenerUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + loadbalancer_id: str | NotGiven = NOT_GIVEN, + show_stats: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LbListenerList: + """ + List load balancer listeners + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[2]" + + show_stats: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/lblisteners/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "loadbalancer_id": loadbalancer_id, + "show_stats": show_stats, + }, + listener_list_params.ListenerListParams, + ), + ), + cast_to=LbListenerList, + ) + + def delete( + self, + listener_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete load balancer listener + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}']['delete'].parameters[1].schema" + + listener_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not listener_id: + raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") + return self._delete( + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + listener_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + show_stats: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LbListener: + """ + Get listener + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[1].schema" + + listener_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[2].schema" + + show_stats: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/3' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not listener_id: + raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") + return self._get( + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"show_stats": show_stats}, listener_get_params.ListenerGetParams), + ), + cast_to=LbListener, + ) + + +class AsyncListenersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncListenersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncListenersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncListenersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncListenersResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + loadbalancer_id: str, + name: str, + protocol: LbListenerProtocol, + protocol_port: int, + allowed_cidrs: Optional[List[str]] | NotGiven = NOT_GIVEN, + connection_limit: int | NotGiven = NOT_GIVEN, + insert_x_forwarded: bool | NotGiven = NOT_GIVEN, + secret_id: str | NotGiven = NOT_GIVEN, + sni_secret_id: List[str] | NotGiven = NOT_GIVEN, + timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + user_list: Iterable[listener_create_params.UserList] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create load balancer listener + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].post.parameters[1].schema" + + loadbalancer_id: '#/components/schemas/CreateLbListenerSerializer/properties/loadbalancer_id' + "$.components.schemas.CreateLbListenerSerializer.properties.loadbalancer_id" + + name: '#/components/schemas/CreateLbListenerSerializer/properties/name' + "$.components.schemas.CreateLbListenerSerializer.properties.name" + + protocol: '#/components/schemas/CreateLbListenerSerializer/properties/protocol' + "$.components.schemas.CreateLbListenerSerializer.properties.protocol" + + protocol_port: '#/components/schemas/CreateLbListenerSerializer/properties/protocol_port' + "$.components.schemas.CreateLbListenerSerializer.properties.protocol_port" + + allowed_cidrs: '#/components/schemas/CreateLbListenerSerializer/properties/allowed_cidrs/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.allowed_cidrs.anyOf[0]" + + connection_limit: '#/components/schemas/CreateLbListenerSerializer/properties/connection_limit' + "$.components.schemas.CreateLbListenerSerializer.properties.connection_limit" + + insert_x_forwarded: '#/components/schemas/CreateLbListenerSerializer/properties/insert_x_forwarded' + "$.components.schemas.CreateLbListenerSerializer.properties.insert_x_forwarded" + + secret_id: '#/components/schemas/CreateLbListenerSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.secret_id.anyOf[0]" + + sni_secret_id: '#/components/schemas/CreateLbListenerSerializer/properties/sni_secret_id' + "$.components.schemas.CreateLbListenerSerializer.properties.sni_secret_id" + + timeout_client_data: '#/components/schemas/CreateLbListenerSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.timeout_client_data.anyOf[0]" + + timeout_member_connect: '#/components/schemas/CreateLbListenerSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.timeout_member_connect.anyOf[0]" + + timeout_member_data: '#/components/schemas/CreateLbListenerSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.timeout_member_data.anyOf[0]" + + user_list: '#/components/schemas/CreateLbListenerSerializer/properties/user_list' + "$.components.schemas.CreateLbListenerSerializer.properties.user_list" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/lblisteners/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "loadbalancer_id": loadbalancer_id, + "name": name, + "protocol": protocol, + "protocol_port": protocol_port, + "allowed_cidrs": allowed_cidrs, + "connection_limit": connection_limit, + "insert_x_forwarded": insert_x_forwarded, + "secret_id": secret_id, + "sni_secret_id": sni_secret_id, + "timeout_client_data": timeout_client_data, + "timeout_member_connect": timeout_member_connect, + "timeout_member_data": timeout_member_data, + "user_list": user_list, + }, + listener_create_params.ListenerCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + listener_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + allowed_cidrs: Optional[List[str]] | NotGiven = NOT_GIVEN, + connection_limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + secret_id: Optional[str] | NotGiven = NOT_GIVEN, + sni_secret_id: Optional[List[str]] | NotGiven = NOT_GIVEN, + timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + user_list: Optional[Iterable[listener_update_params.UserList]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Update listener + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[1].schema" + + listener_id: '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[2].schema" + + allowed_cidrs: '#/components/schemas/PatchLbListenerSerializer/properties/allowed_cidrs/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.allowed_cidrs.anyOf[0]" + + connection_limit: '#/components/schemas/PatchLbListenerSerializer/properties/connection_limit' + "$.components.schemas.PatchLbListenerSerializer.properties.connection_limit" + + name: '#/components/schemas/PatchLbListenerSerializer/properties/name' + "$.components.schemas.PatchLbListenerSerializer.properties.name" + + secret_id: '#/components/schemas/PatchLbListenerSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.secret_id.anyOf[0]" + + sni_secret_id: '#/components/schemas/PatchLbListenerSerializer/properties/sni_secret_id/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.sni_secret_id.anyOf[0]" + + timeout_client_data: '#/components/schemas/PatchLbListenerSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.timeout_client_data.anyOf[0]" + + timeout_member_connect: '#/components/schemas/PatchLbListenerSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.timeout_member_connect.anyOf[0]" + + timeout_member_data: '#/components/schemas/PatchLbListenerSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.timeout_member_data.anyOf[0]" + + user_list: '#/components/schemas/PatchLbListenerSerializer/properties/user_list/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.user_list.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not listener_id: + raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") + return await self._patch( + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + body=await async_maybe_transform( + { + "allowed_cidrs": allowed_cidrs, + "connection_limit": connection_limit, + "name": name, + "secret_id": secret_id, + "sni_secret_id": sni_secret_id, + "timeout_client_data": timeout_client_data, + "timeout_member_connect": timeout_member_connect, + "timeout_member_data": timeout_member_data, + "user_list": user_list, + }, + listener_update_params.ListenerUpdateParams, + ), + 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, + *, + project_id: int | None = None, + region_id: int | None = None, + loadbalancer_id: str | NotGiven = NOT_GIVEN, + show_stats: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LbListenerList: + """ + List load balancer listeners + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[2]" + + show_stats: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/lblisteners/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "loadbalancer_id": loadbalancer_id, + "show_stats": show_stats, + }, + listener_list_params.ListenerListParams, + ), + ), + cast_to=LbListenerList, + ) + + async def delete( + self, + listener_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete load balancer listener + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}']['delete'].parameters[1].schema" + + listener_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not listener_id: + raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") + return await self._delete( + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + listener_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + show_stats: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LbListener: + """ + Get listener + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[1].schema" + + listener_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[2].schema" + + show_stats: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/3' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not listener_id: + raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") + return await self._get( + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"show_stats": show_stats}, listener_get_params.ListenerGetParams), + ), + cast_to=LbListener, + ) + + +class ListenersResourceWithRawResponse: + def __init__(self, listeners: ListenersResource) -> None: + self._listeners = listeners + + self.create = to_raw_response_wrapper( + listeners.create, + ) + self.update = to_raw_response_wrapper( + listeners.update, + ) + self.list = to_raw_response_wrapper( + listeners.list, + ) + self.delete = to_raw_response_wrapper( + listeners.delete, + ) + self.get = to_raw_response_wrapper( + listeners.get, + ) + + +class AsyncListenersResourceWithRawResponse: + def __init__(self, listeners: AsyncListenersResource) -> None: + self._listeners = listeners + + self.create = async_to_raw_response_wrapper( + listeners.create, + ) + self.update = async_to_raw_response_wrapper( + listeners.update, + ) + self.list = async_to_raw_response_wrapper( + listeners.list, + ) + self.delete = async_to_raw_response_wrapper( + listeners.delete, + ) + self.get = async_to_raw_response_wrapper( + listeners.get, + ) + + +class ListenersResourceWithStreamingResponse: + def __init__(self, listeners: ListenersResource) -> None: + self._listeners = listeners + + self.create = to_streamed_response_wrapper( + listeners.create, + ) + self.update = to_streamed_response_wrapper( + listeners.update, + ) + self.list = to_streamed_response_wrapper( + listeners.list, + ) + self.delete = to_streamed_response_wrapper( + listeners.delete, + ) + self.get = to_streamed_response_wrapper( + listeners.get, + ) + + +class AsyncListenersResourceWithStreamingResponse: + def __init__(self, listeners: AsyncListenersResource) -> None: + self._listeners = listeners + + self.create = async_to_streamed_response_wrapper( + listeners.create, + ) + self.update = async_to_streamed_response_wrapper( + listeners.update, + ) + self.list = async_to_streamed_response_wrapper( + listeners.list, + ) + self.delete = async_to_streamed_response_wrapper( + listeners.delete, + ) + self.get = async_to_streamed_response_wrapper( + listeners.get, + ) diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py new file mode 100644 index 00000000..3323bd3c --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -0,0 +1,1384 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable + +import httpx + +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) +from .statuses import ( + StatusesResource, + AsyncStatusesResource, + StatusesResourceWithRawResponse, + AsyncStatusesResourceWithRawResponse, + StatusesResourceWithStreamingResponse, + AsyncStatusesResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from .listeners import ( + ListenersResource, + AsyncListenersResource, + ListenersResourceWithRawResponse, + AsyncListenersResourceWithRawResponse, + ListenersResourceWithStreamingResponse, + AsyncListenersResourceWithStreamingResponse, +) +from ...._compat import cached_property +from .pools.pools import ( + PoolsResource, + AsyncPoolsResource, + PoolsResourceWithRawResponse, + AsyncPoolsResourceWithRawResponse, + PoolsResourceWithStreamingResponse, + AsyncPoolsResourceWithStreamingResponse, +) +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.cloud import ( + InterfaceIPFamily, + LoadBalancerMemberConnectivity, + load_balancer_get_params, + load_balancer_list_params, + load_balancer_create_params, + load_balancer_resize_params, + load_balancer_update_params, + load_balancer_failover_params, +) +from ...._base_client import AsyncPaginator, make_request_options +from .l7_policies.l7_policies import ( + L7PoliciesResource, + AsyncL7PoliciesResource, + L7PoliciesResourceWithRawResponse, + AsyncL7PoliciesResourceWithRawResponse, + L7PoliciesResourceWithStreamingResponse, + AsyncL7PoliciesResourceWithStreamingResponse, +) +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.load_balancer import LoadBalancer +from ....types.cloud.interface_ip_family import InterfaceIPFamily +from ....types.cloud.load_balancer_member_connectivity import LoadBalancerMemberConnectivity + +__all__ = ["LoadBalancersResource", "AsyncLoadBalancersResource"] + + +class LoadBalancersResource(SyncAPIResource): + @cached_property + def l7_policies(self) -> L7PoliciesResource: + return L7PoliciesResource(self._client) + + @cached_property + def flavors(self) -> FlavorsResource: + return FlavorsResource(self._client) + + @cached_property + def listeners(self) -> ListenersResource: + return ListenersResource(self._client) + + @cached_property + def pools(self) -> PoolsResource: + return PoolsResource(self._client) + + @cached_property + def metrics(self) -> MetricsResource: + return MetricsResource(self._client) + + @cached_property + def statuses(self) -> StatusesResource: + return StatusesResource(self._client) + + @cached_property + def with_raw_response(self) -> LoadBalancersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return LoadBalancersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LoadBalancersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return LoadBalancersResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str | NotGiven = NOT_GIVEN, + floating_ip: load_balancer_create_params.FloatingIP | NotGiven = NOT_GIVEN, + listeners: Iterable[load_balancer_create_params.Listener] | NotGiven = NOT_GIVEN, + logging: load_balancer_create_params.Logging | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + name_template: str | NotGiven = NOT_GIVEN, + preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, + tag: List[str] | NotGiven = NOT_GIVEN, + vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, + vip_network_id: str | NotGiven = NOT_GIVEN, + vip_port_id: str | NotGiven = NOT_GIVEN, + vip_subnet_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create load balancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].post.parameters[1].schema" + + flavor: '#/components/schemas/CreateLoadbalancerSerializer/properties/flavor' + "$.components.schemas.CreateLoadbalancerSerializer.properties.flavor" + + floating_ip: '#/components/schemas/CreateLoadbalancerSerializer/properties/floating_ip' + "$.components.schemas.CreateLoadbalancerSerializer.properties.floating_ip" + + listeners: '#/components/schemas/CreateLoadbalancerSerializer/properties/listeners' + "$.components.schemas.CreateLoadbalancerSerializer.properties.listeners" + + logging: '#/components/schemas/CreateLoadbalancerSerializer/properties/logging' + "$.components.schemas.CreateLoadbalancerSerializer.properties.logging" + + metadata: '#/components/schemas/CreateLoadbalancerSerializer/properties/metadata' + "$.components.schemas.CreateLoadbalancerSerializer.properties.metadata" + + name: '#/components/schemas/CreateLoadbalancerSerializer/properties/name' + "$.components.schemas.CreateLoadbalancerSerializer.properties.name" + + name_template: '#/components/schemas/CreateLoadbalancerSerializer/properties/name_template' + "$.components.schemas.CreateLoadbalancerSerializer.properties.name_template" + + preferred_connectivity: '#/components/schemas/CreateLoadbalancerSerializer/properties/preferred_connectivity' + "$.components.schemas.CreateLoadbalancerSerializer.properties.preferred_connectivity" + + tag: '#/components/schemas/CreateLoadbalancerSerializer/properties/tag' + "$.components.schemas.CreateLoadbalancerSerializer.properties.tag" + + vip_ip_family: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_ip_family' + "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_ip_family" + + vip_network_id: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_network_id' + "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_network_id" + + vip_port_id: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_port_id' + "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_port_id" + + vip_subnet_id: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_subnet_id' + "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_subnet_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + body=maybe_transform( + { + "flavor": flavor, + "floating_ip": floating_ip, + "listeners": listeners, + "logging": logging, + "metadata": metadata, + "name": name, + "name_template": name_template, + "preferred_connectivity": preferred_connectivity, + "tag": tag, + "vip_ip_family": vip_ip_family, + "vip_network_id": vip_network_id, + "vip_port_id": vip_port_id, + "vip_subnet_id": vip_subnet_id, + }, + load_balancer_create_params.LoadBalancerCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + logging: load_balancer_update_params.Logging | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LoadBalancer: + """ + Rename load balancer, activate/deactivate logs or update preferred connectivity + for load balancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[2].schema" + + logging: '#/components/schemas/LoadBalancerPatchSerializer/properties/logging' + "$.components.schemas.LoadBalancerPatchSerializer.properties.logging" + + name: '#/components/schemas/LoadBalancerPatchSerializer/properties/name' + "$.components.schemas.LoadBalancerPatchSerializer.properties.name" + + preferred_connectivity: '#/components/schemas/LoadBalancerPatchSerializer/properties/preferred_connectivity' + "$.components.schemas.LoadBalancerPatchSerializer.properties.preferred_connectivity" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return self._patch( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + body=maybe_transform( + { + "logging": logging, + "name": name, + "preferred_connectivity": preferred_connectivity, + }, + load_balancer_update_params.LoadBalancerUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancer, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + assigned_floating: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + logging_enabled: bool | NotGiven = NOT_GIVEN, + metadata_k: str | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: str | NotGiven = NOT_GIVEN, + show_stats: bool | NotGiven = NOT_GIVEN, + with_ddos: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[LoadBalancer]: + """ + List load balancers + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[1].schema" + + assigned_floating: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[2]" + + limit: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[3]" + + logging_enabled: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[4]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[5]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[6]" + + name: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[7]" + + offset: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[8]" + + order_by: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[9]" + + show_stats: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[10]" + + with_ddos: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[11]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + page=SyncOffsetPage[LoadBalancer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "assigned_floating": assigned_floating, + "limit": limit, + "logging_enabled": logging_enabled, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "name": name, + "offset": offset, + "order_by": order_by, + "show_stats": show_stats, + "with_ddos": with_ddos, + }, + load_balancer_list_params.LoadBalancerListParams, + ), + ), + model=LoadBalancer, + ) + + def delete( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete load balancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}']['delete'].parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return self._delete( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def failover( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + force: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Failover loadbalancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[2].schema" + + force: '#/components/schemas/FailoverLoadBalancer/properties/force' + "$.components.schemas.FailoverLoadBalancer.properties.force" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + show_stats: bool | NotGiven = NOT_GIVEN, + with_ddos: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LoadBalancer: + """ + Get load balancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[2].schema" + + show_stats: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/3' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[3]" + + with_ddos: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/4' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[4]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "show_stats": show_stats, + "with_ddos": with_ddos, + }, + load_balancer_get_params.LoadBalancerGetParams, + ), + ), + cast_to=LoadBalancer, + ) + + def resize( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Resize loadbalancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[2].schema" + + flavor: '#/components/schemas/ResizeLoadBalancer/properties/flavor' + "$.components.schemas.ResizeLoadBalancer.properties.flavor" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncLoadBalancersResource(AsyncAPIResource): + @cached_property + def l7_policies(self) -> AsyncL7PoliciesResource: + return AsyncL7PoliciesResource(self._client) + + @cached_property + def flavors(self) -> AsyncFlavorsResource: + return AsyncFlavorsResource(self._client) + + @cached_property + def listeners(self) -> AsyncListenersResource: + return AsyncListenersResource(self._client) + + @cached_property + def pools(self) -> AsyncPoolsResource: + return AsyncPoolsResource(self._client) + + @cached_property + def metrics(self) -> AsyncMetricsResource: + return AsyncMetricsResource(self._client) + + @cached_property + def statuses(self) -> AsyncStatusesResource: + return AsyncStatusesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncLoadBalancersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncLoadBalancersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLoadBalancersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncLoadBalancersResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str | NotGiven = NOT_GIVEN, + floating_ip: load_balancer_create_params.FloatingIP | NotGiven = NOT_GIVEN, + listeners: Iterable[load_balancer_create_params.Listener] | NotGiven = NOT_GIVEN, + logging: load_balancer_create_params.Logging | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + name_template: str | NotGiven = NOT_GIVEN, + preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, + tag: List[str] | NotGiven = NOT_GIVEN, + vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, + vip_network_id: str | NotGiven = NOT_GIVEN, + vip_port_id: str | NotGiven = NOT_GIVEN, + vip_subnet_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create load balancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].post.parameters[1].schema" + + flavor: '#/components/schemas/CreateLoadbalancerSerializer/properties/flavor' + "$.components.schemas.CreateLoadbalancerSerializer.properties.flavor" + + floating_ip: '#/components/schemas/CreateLoadbalancerSerializer/properties/floating_ip' + "$.components.schemas.CreateLoadbalancerSerializer.properties.floating_ip" + + listeners: '#/components/schemas/CreateLoadbalancerSerializer/properties/listeners' + "$.components.schemas.CreateLoadbalancerSerializer.properties.listeners" + + logging: '#/components/schemas/CreateLoadbalancerSerializer/properties/logging' + "$.components.schemas.CreateLoadbalancerSerializer.properties.logging" + + metadata: '#/components/schemas/CreateLoadbalancerSerializer/properties/metadata' + "$.components.schemas.CreateLoadbalancerSerializer.properties.metadata" + + name: '#/components/schemas/CreateLoadbalancerSerializer/properties/name' + "$.components.schemas.CreateLoadbalancerSerializer.properties.name" + + name_template: '#/components/schemas/CreateLoadbalancerSerializer/properties/name_template' + "$.components.schemas.CreateLoadbalancerSerializer.properties.name_template" + + preferred_connectivity: '#/components/schemas/CreateLoadbalancerSerializer/properties/preferred_connectivity' + "$.components.schemas.CreateLoadbalancerSerializer.properties.preferred_connectivity" + + tag: '#/components/schemas/CreateLoadbalancerSerializer/properties/tag' + "$.components.schemas.CreateLoadbalancerSerializer.properties.tag" + + vip_ip_family: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_ip_family' + "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_ip_family" + + vip_network_id: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_network_id' + "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_network_id" + + vip_port_id: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_port_id' + "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_port_id" + + vip_subnet_id: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_subnet_id' + "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_subnet_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "flavor": flavor, + "floating_ip": floating_ip, + "listeners": listeners, + "logging": logging, + "metadata": metadata, + "name": name, + "name_template": name_template, + "preferred_connectivity": preferred_connectivity, + "tag": tag, + "vip_ip_family": vip_ip_family, + "vip_network_id": vip_network_id, + "vip_port_id": vip_port_id, + "vip_subnet_id": vip_subnet_id, + }, + load_balancer_create_params.LoadBalancerCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + logging: load_balancer_update_params.Logging | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LoadBalancer: + """ + Rename load balancer, activate/deactivate logs or update preferred connectivity + for load balancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[2].schema" + + logging: '#/components/schemas/LoadBalancerPatchSerializer/properties/logging' + "$.components.schemas.LoadBalancerPatchSerializer.properties.logging" + + name: '#/components/schemas/LoadBalancerPatchSerializer/properties/name' + "$.components.schemas.LoadBalancerPatchSerializer.properties.name" + + preferred_connectivity: '#/components/schemas/LoadBalancerPatchSerializer/properties/preferred_connectivity' + "$.components.schemas.LoadBalancerPatchSerializer.properties.preferred_connectivity" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return await self._patch( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + body=await async_maybe_transform( + { + "logging": logging, + "name": name, + "preferred_connectivity": preferred_connectivity, + }, + load_balancer_update_params.LoadBalancerUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancer, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + assigned_floating: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + logging_enabled: bool | NotGiven = NOT_GIVEN, + metadata_k: str | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: str | NotGiven = NOT_GIVEN, + show_stats: bool | NotGiven = NOT_GIVEN, + with_ddos: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[LoadBalancer, AsyncOffsetPage[LoadBalancer]]: + """ + List load balancers + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[1].schema" + + assigned_floating: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[2]" + + limit: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[3]" + + logging_enabled: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[4]" + + metadata_k: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[5]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[6]" + + name: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[7]" + + offset: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[8]" + + order_by: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[9]" + + show_stats: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[10]" + + with_ddos: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[11]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + page=AsyncOffsetPage[LoadBalancer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "assigned_floating": assigned_floating, + "limit": limit, + "logging_enabled": logging_enabled, + "metadata_k": metadata_k, + "metadata_kv": metadata_kv, + "name": name, + "offset": offset, + "order_by": order_by, + "show_stats": show_stats, + "with_ddos": with_ddos, + }, + load_balancer_list_params.LoadBalancerListParams, + ), + ), + model=LoadBalancer, + ) + + async def delete( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete load balancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}']['delete'].parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return await self._delete( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def failover( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + force: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Failover loadbalancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[2].schema" + + force: '#/components/schemas/FailoverLoadBalancer/properties/force' + "$.components.schemas.FailoverLoadBalancer.properties.force" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return await self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + body=await async_maybe_transform( + {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + show_stats: bool | NotGiven = NOT_GIVEN, + with_ddos: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LoadBalancer: + """ + Get load balancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[2].schema" + + show_stats: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/3' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[3]" + + with_ddos: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/4' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[4]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return await self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "show_stats": show_stats, + "with_ddos": with_ddos, + }, + load_balancer_get_params.LoadBalancerGetParams, + ), + ), + cast_to=LoadBalancer, + ) + + async def resize( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Resize loadbalancer + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[2].schema" + + flavor: '#/components/schemas/ResizeLoadBalancer/properties/flavor' + "$.components.schemas.ResizeLoadBalancer.properties.flavor" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return await self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class LoadBalancersResourceWithRawResponse: + def __init__(self, load_balancers: LoadBalancersResource) -> None: + self._load_balancers = load_balancers + + self.create = to_raw_response_wrapper( + load_balancers.create, + ) + self.update = to_raw_response_wrapper( + load_balancers.update, + ) + self.list = to_raw_response_wrapper( + load_balancers.list, + ) + self.delete = to_raw_response_wrapper( + load_balancers.delete, + ) + self.failover = to_raw_response_wrapper( + load_balancers.failover, + ) + self.get = to_raw_response_wrapper( + load_balancers.get, + ) + self.resize = to_raw_response_wrapper( + load_balancers.resize, + ) + + @cached_property + def l7_policies(self) -> L7PoliciesResourceWithRawResponse: + return L7PoliciesResourceWithRawResponse(self._load_balancers.l7_policies) + + @cached_property + def flavors(self) -> FlavorsResourceWithRawResponse: + return FlavorsResourceWithRawResponse(self._load_balancers.flavors) + + @cached_property + def listeners(self) -> ListenersResourceWithRawResponse: + return ListenersResourceWithRawResponse(self._load_balancers.listeners) + + @cached_property + def pools(self) -> PoolsResourceWithRawResponse: + return PoolsResourceWithRawResponse(self._load_balancers.pools) + + @cached_property + def metrics(self) -> MetricsResourceWithRawResponse: + return MetricsResourceWithRawResponse(self._load_balancers.metrics) + + @cached_property + def statuses(self) -> StatusesResourceWithRawResponse: + return StatusesResourceWithRawResponse(self._load_balancers.statuses) + + +class AsyncLoadBalancersResourceWithRawResponse: + def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: + self._load_balancers = load_balancers + + self.create = async_to_raw_response_wrapper( + load_balancers.create, + ) + self.update = async_to_raw_response_wrapper( + load_balancers.update, + ) + self.list = async_to_raw_response_wrapper( + load_balancers.list, + ) + self.delete = async_to_raw_response_wrapper( + load_balancers.delete, + ) + self.failover = async_to_raw_response_wrapper( + load_balancers.failover, + ) + self.get = async_to_raw_response_wrapper( + load_balancers.get, + ) + self.resize = async_to_raw_response_wrapper( + load_balancers.resize, + ) + + @cached_property + def l7_policies(self) -> AsyncL7PoliciesResourceWithRawResponse: + return AsyncL7PoliciesResourceWithRawResponse(self._load_balancers.l7_policies) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithRawResponse: + return AsyncFlavorsResourceWithRawResponse(self._load_balancers.flavors) + + @cached_property + def listeners(self) -> AsyncListenersResourceWithRawResponse: + return AsyncListenersResourceWithRawResponse(self._load_balancers.listeners) + + @cached_property + def pools(self) -> AsyncPoolsResourceWithRawResponse: + return AsyncPoolsResourceWithRawResponse(self._load_balancers.pools) + + @cached_property + def metrics(self) -> AsyncMetricsResourceWithRawResponse: + return AsyncMetricsResourceWithRawResponse(self._load_balancers.metrics) + + @cached_property + def statuses(self) -> AsyncStatusesResourceWithRawResponse: + return AsyncStatusesResourceWithRawResponse(self._load_balancers.statuses) + + +class LoadBalancersResourceWithStreamingResponse: + def __init__(self, load_balancers: LoadBalancersResource) -> None: + self._load_balancers = load_balancers + + self.create = to_streamed_response_wrapper( + load_balancers.create, + ) + self.update = to_streamed_response_wrapper( + load_balancers.update, + ) + self.list = to_streamed_response_wrapper( + load_balancers.list, + ) + self.delete = to_streamed_response_wrapper( + load_balancers.delete, + ) + self.failover = to_streamed_response_wrapper( + load_balancers.failover, + ) + self.get = to_streamed_response_wrapper( + load_balancers.get, + ) + self.resize = to_streamed_response_wrapper( + load_balancers.resize, + ) + + @cached_property + def l7_policies(self) -> L7PoliciesResourceWithStreamingResponse: + return L7PoliciesResourceWithStreamingResponse(self._load_balancers.l7_policies) + + @cached_property + def flavors(self) -> FlavorsResourceWithStreamingResponse: + return FlavorsResourceWithStreamingResponse(self._load_balancers.flavors) + + @cached_property + def listeners(self) -> ListenersResourceWithStreamingResponse: + return ListenersResourceWithStreamingResponse(self._load_balancers.listeners) + + @cached_property + def pools(self) -> PoolsResourceWithStreamingResponse: + return PoolsResourceWithStreamingResponse(self._load_balancers.pools) + + @cached_property + def metrics(self) -> MetricsResourceWithStreamingResponse: + return MetricsResourceWithStreamingResponse(self._load_balancers.metrics) + + @cached_property + def statuses(self) -> StatusesResourceWithStreamingResponse: + return StatusesResourceWithStreamingResponse(self._load_balancers.statuses) + + +class AsyncLoadBalancersResourceWithStreamingResponse: + def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: + self._load_balancers = load_balancers + + self.create = async_to_streamed_response_wrapper( + load_balancers.create, + ) + self.update = async_to_streamed_response_wrapper( + load_balancers.update, + ) + self.list = async_to_streamed_response_wrapper( + load_balancers.list, + ) + self.delete = async_to_streamed_response_wrapper( + load_balancers.delete, + ) + self.failover = async_to_streamed_response_wrapper( + load_balancers.failover, + ) + self.get = async_to_streamed_response_wrapper( + load_balancers.get, + ) + self.resize = async_to_streamed_response_wrapper( + load_balancers.resize, + ) + + @cached_property + def l7_policies(self) -> AsyncL7PoliciesResourceWithStreamingResponse: + return AsyncL7PoliciesResourceWithStreamingResponse(self._load_balancers.l7_policies) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse: + return AsyncFlavorsResourceWithStreamingResponse(self._load_balancers.flavors) + + @cached_property + def listeners(self) -> AsyncListenersResourceWithStreamingResponse: + return AsyncListenersResourceWithStreamingResponse(self._load_balancers.listeners) + + @cached_property + def pools(self) -> AsyncPoolsResourceWithStreamingResponse: + return AsyncPoolsResourceWithStreamingResponse(self._load_balancers.pools) + + @cached_property + def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: + return AsyncMetricsResourceWithStreamingResponse(self._load_balancers.metrics) + + @cached_property + def statuses(self) -> AsyncStatusesResourceWithStreamingResponse: + return AsyncStatusesResourceWithStreamingResponse(self._load_balancers.statuses) diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py new file mode 100644 index 00000000..affb2a65 --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -0,0 +1,227 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....types.cloud import InstanceMetricsTimeUnit +from ...._base_client import make_request_options +from ....types.cloud.load_balancers import metric_list_params +from ....types.cloud.loadbalancer_metrics_list import LoadbalancerMetricsList +from ....types.cloud.instance_metrics_time_unit import InstanceMetricsTimeUnit + +__all__ = ["MetricsResource", "AsyncMetricsResource"] + + +class MetricsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> MetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return MetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return MetricsResourceWithStreamingResponse(self) + + def list( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + time_interval: int, + time_unit: InstanceMetricsTimeUnit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LoadbalancerMetricsList: + """ + Get loadbalancer metrics, including cpu, memory and network + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[2].schema" + + time_interval: '#/components/schemas/LoadbalancerMetricsRequestSerializer/properties/time_interval' + "$.components.schemas.LoadbalancerMetricsRequestSerializer.properties.time_interval" + + time_unit: '#/components/schemas/LoadbalancerMetricsRequestSerializer/properties/time_unit' + "$.components.schemas.LoadbalancerMetricsRequestSerializer.properties.time_unit" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + body=maybe_transform( + { + "time_interval": time_interval, + "time_unit": time_unit, + }, + metric_list_params.MetricListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadbalancerMetricsList, + ) + + +class AsyncMetricsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncMetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncMetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncMetricsResourceWithStreamingResponse(self) + + async def list( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + time_interval: int, + time_unit: InstanceMetricsTimeUnit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LoadbalancerMetricsList: + """ + Get loadbalancer metrics, including cpu, memory and network + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[2].schema" + + time_interval: '#/components/schemas/LoadbalancerMetricsRequestSerializer/properties/time_interval' + "$.components.schemas.LoadbalancerMetricsRequestSerializer.properties.time_interval" + + time_unit: '#/components/schemas/LoadbalancerMetricsRequestSerializer/properties/time_unit' + "$.components.schemas.LoadbalancerMetricsRequestSerializer.properties.time_unit" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return await self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + body=await async_maybe_transform( + { + "time_interval": time_interval, + "time_unit": time_unit, + }, + metric_list_params.MetricListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadbalancerMetricsList, + ) + + +class MetricsResourceWithRawResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_raw_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithRawResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_raw_response_wrapper( + metrics.list, + ) + + +class MetricsResourceWithStreamingResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_streamed_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithStreamingResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_streamed_response_wrapper( + metrics.list, + ) diff --git a/src/gcore/resources/cloud/load_balancers/pools/__init__.py b/src/gcore/resources/cloud/load_balancers/pools/__init__.py new file mode 100644 index 00000000..c9c02f6d --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/pools/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .pools import ( + PoolsResource, + AsyncPoolsResource, + PoolsResourceWithRawResponse, + AsyncPoolsResourceWithRawResponse, + PoolsResourceWithStreamingResponse, + AsyncPoolsResourceWithStreamingResponse, +) +from .members import ( + MembersResource, + AsyncMembersResource, + MembersResourceWithRawResponse, + AsyncMembersResourceWithRawResponse, + MembersResourceWithStreamingResponse, + AsyncMembersResourceWithStreamingResponse, +) +from .health_monitors import ( + HealthMonitorsResource, + AsyncHealthMonitorsResource, + HealthMonitorsResourceWithRawResponse, + AsyncHealthMonitorsResourceWithRawResponse, + HealthMonitorsResourceWithStreamingResponse, + AsyncHealthMonitorsResourceWithStreamingResponse, +) + +__all__ = [ + "HealthMonitorsResource", + "AsyncHealthMonitorsResource", + "HealthMonitorsResourceWithRawResponse", + "AsyncHealthMonitorsResourceWithRawResponse", + "HealthMonitorsResourceWithStreamingResponse", + "AsyncHealthMonitorsResourceWithStreamingResponse", + "MembersResource", + "AsyncMembersResource", + "MembersResourceWithRawResponse", + "AsyncMembersResourceWithRawResponse", + "MembersResourceWithStreamingResponse", + "AsyncMembersResourceWithStreamingResponse", + "PoolsResource", + "AsyncPoolsResource", + "PoolsResourceWithRawResponse", + "AsyncPoolsResourceWithRawResponse", + "PoolsResourceWithStreamingResponse", + "AsyncPoolsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py new file mode 100644 index 00000000..d30854cd --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -0,0 +1,400 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .....types.cloud import HTTPMethod, HealthMonitorType +from ....._base_client import make_request_options +from .....types.cloud.http_method import HTTPMethod +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.health_monitor_type import HealthMonitorType +from .....types.cloud.load_balancers.pools import health_monitor_create_params + +__all__ = ["HealthMonitorsResource", "AsyncHealthMonitorsResource"] + + +class HealthMonitorsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> HealthMonitorsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return HealthMonitorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> HealthMonitorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return HealthMonitorsResourceWithStreamingResponse(self) + + def create( + self, + pool_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + delay: int, + max_retries: int, + api_timeout: int, + type: HealthMonitorType, + expected_codes: Optional[str] | NotGiven = NOT_GIVEN, + http_method: Optional[HTTPMethod] | NotGiven = NOT_GIVEN, + max_retries_down: Optional[int] | NotGiven = NOT_GIVEN, + url_path: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create Load Balancer Pool Health Monitor + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[2].schema" + + delay: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/delay' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.delay" + + max_retries: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries" + + api_timeout: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/timeout' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.timeout" + + type: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/type' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.type" + + expected_codes: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/expected_codes/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" + + http_method: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/http_method/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.http_method.anyOf[0]" + + max_retries_down: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries_down/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries_down.anyOf[0]" + + url_path: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/url_path/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.url_path.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + return self._post( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + body=maybe_transform( + { + "delay": delay, + "max_retries": max_retries, + "api_timeout": api_timeout, + "type": type, + "expected_codes": expected_codes, + "http_method": http_method, + "max_retries_down": max_retries_down, + "url_path": url_path, + }, + health_monitor_create_params.HealthMonitorCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def delete( + self, + pool_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete load balancer pool health monitor + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/delete/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/delete/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor']['delete'].parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/delete/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncHealthMonitorsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncHealthMonitorsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncHealthMonitorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncHealthMonitorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncHealthMonitorsResourceWithStreamingResponse(self) + + async def create( + self, + pool_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + delay: int, + max_retries: int, + api_timeout: int, + type: HealthMonitorType, + expected_codes: Optional[str] | NotGiven = NOT_GIVEN, + http_method: Optional[HTTPMethod] | NotGiven = NOT_GIVEN, + max_retries_down: Optional[int] | NotGiven = NOT_GIVEN, + url_path: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create Load Balancer Pool Health Monitor + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[2].schema" + + delay: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/delay' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.delay" + + max_retries: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries" + + api_timeout: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/timeout' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.timeout" + + type: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/type' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.type" + + expected_codes: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/expected_codes/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" + + http_method: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/http_method/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.http_method.anyOf[0]" + + max_retries_down: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries_down/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries_down.anyOf[0]" + + url_path: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/url_path/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.url_path.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + return await self._post( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + body=await async_maybe_transform( + { + "delay": delay, + "max_retries": max_retries, + "api_timeout": api_timeout, + "type": type, + "expected_codes": expected_codes, + "http_method": http_method, + "max_retries_down": max_retries_down, + "url_path": url_path, + }, + health_monitor_create_params.HealthMonitorCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def delete( + self, + pool_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete load balancer pool health monitor + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/delete/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/delete/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor']['delete'].parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/delete/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class HealthMonitorsResourceWithRawResponse: + def __init__(self, health_monitors: HealthMonitorsResource) -> None: + self._health_monitors = health_monitors + + self.create = to_raw_response_wrapper( + health_monitors.create, + ) + self.delete = to_raw_response_wrapper( + health_monitors.delete, + ) + + +class AsyncHealthMonitorsResourceWithRawResponse: + def __init__(self, health_monitors: AsyncHealthMonitorsResource) -> None: + self._health_monitors = health_monitors + + self.create = async_to_raw_response_wrapper( + health_monitors.create, + ) + self.delete = async_to_raw_response_wrapper( + health_monitors.delete, + ) + + +class HealthMonitorsResourceWithStreamingResponse: + def __init__(self, health_monitors: HealthMonitorsResource) -> None: + self._health_monitors = health_monitors + + self.create = to_streamed_response_wrapper( + health_monitors.create, + ) + self.delete = to_streamed_response_wrapper( + health_monitors.delete, + ) + + +class AsyncHealthMonitorsResourceWithStreamingResponse: + def __init__(self, health_monitors: AsyncHealthMonitorsResource) -> None: + self._health_monitors = health_monitors + + self.create = async_to_streamed_response_wrapper( + health_monitors.create, + ) + self.delete = async_to_streamed_response_wrapper( + health_monitors.delete, + ) diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py new file mode 100644 index 00000000..368af297 --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -0,0 +1,407 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.load_balancers.pools import member_add_params + +__all__ = ["MembersResource", "AsyncMembersResource"] + + +class MembersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> MembersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return MembersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> MembersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return MembersResourceWithStreamingResponse(self) + + def add( + self, + pool_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + address: str, + protocol_port: int, + admin_state_up: Optional[bool] | NotGiven = NOT_GIVEN, + instance_id: Optional[str] | NotGiven = NOT_GIVEN, + monitor_address: Optional[str] | NotGiven = NOT_GIVEN, + monitor_port: Optional[int] | NotGiven = NOT_GIVEN, + subnet_id: Optional[str] | NotGiven = NOT_GIVEN, + weight: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create load balancer pool member + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[2].schema" + + address: '#/components/schemas/CreateLbPoolMemberSerializer/properties/address' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.address" + + protocol_port: '#/components/schemas/CreateLbPoolMemberSerializer/properties/protocol_port' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.protocol_port" + + admin_state_up: '#/components/schemas/CreateLbPoolMemberSerializer/properties/admin_state_up/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.admin_state_up.anyOf[0]" + + instance_id: '#/components/schemas/CreateLbPoolMemberSerializer/properties/instance_id/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.instance_id.anyOf[0]" + + monitor_address: '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_address/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" + + monitor_port: '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_port/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" + + subnet_id: '#/components/schemas/CreateLbPoolMemberSerializer/properties/subnet_id/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" + + weight: '#/components/schemas/CreateLbPoolMemberSerializer/properties/weight/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.weight.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + return self._post( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + body=maybe_transform( + { + "address": address, + "protocol_port": protocol_port, + "admin_state_up": admin_state_up, + "instance_id": instance_id, + "monitor_address": monitor_address, + "monitor_port": monitor_port, + "subnet_id": subnet_id, + "weight": weight, + }, + member_add_params.MemberAddParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def remove( + self, + member_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + pool_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete load balancer pool member + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[2].schema" + + member_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + if not member_id: + raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") + return self._delete( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncMembersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncMembersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncMembersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncMembersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncMembersResourceWithStreamingResponse(self) + + async def add( + self, + pool_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + address: str, + protocol_port: int, + admin_state_up: Optional[bool] | NotGiven = NOT_GIVEN, + instance_id: Optional[str] | NotGiven = NOT_GIVEN, + monitor_address: Optional[str] | NotGiven = NOT_GIVEN, + monitor_port: Optional[int] | NotGiven = NOT_GIVEN, + subnet_id: Optional[str] | NotGiven = NOT_GIVEN, + weight: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create load balancer pool member + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[2].schema" + + address: '#/components/schemas/CreateLbPoolMemberSerializer/properties/address' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.address" + + protocol_port: '#/components/schemas/CreateLbPoolMemberSerializer/properties/protocol_port' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.protocol_port" + + admin_state_up: '#/components/schemas/CreateLbPoolMemberSerializer/properties/admin_state_up/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.admin_state_up.anyOf[0]" + + instance_id: '#/components/schemas/CreateLbPoolMemberSerializer/properties/instance_id/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.instance_id.anyOf[0]" + + monitor_address: '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_address/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" + + monitor_port: '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_port/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" + + subnet_id: '#/components/schemas/CreateLbPoolMemberSerializer/properties/subnet_id/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" + + weight: '#/components/schemas/CreateLbPoolMemberSerializer/properties/weight/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.weight.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + return await self._post( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + body=await async_maybe_transform( + { + "address": address, + "protocol_port": protocol_port, + "admin_state_up": admin_state_up, + "instance_id": instance_id, + "monitor_address": monitor_address, + "monitor_port": monitor_port, + "subnet_id": subnet_id, + "weight": weight, + }, + member_add_params.MemberAddParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def remove( + self, + member_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + pool_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete load balancer pool member + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[2].schema" + + member_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + if not member_id: + raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") + return await self._delete( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class MembersResourceWithRawResponse: + def __init__(self, members: MembersResource) -> None: + self._members = members + + self.add = to_raw_response_wrapper( + members.add, + ) + self.remove = to_raw_response_wrapper( + members.remove, + ) + + +class AsyncMembersResourceWithRawResponse: + def __init__(self, members: AsyncMembersResource) -> None: + self._members = members + + self.add = async_to_raw_response_wrapper( + members.add, + ) + self.remove = async_to_raw_response_wrapper( + members.remove, + ) + + +class MembersResourceWithStreamingResponse: + def __init__(self, members: MembersResource) -> None: + self._members = members + + self.add = to_streamed_response_wrapper( + members.add, + ) + self.remove = to_streamed_response_wrapper( + members.remove, + ) + + +class AsyncMembersResourceWithStreamingResponse: + def __init__(self, members: AsyncMembersResource) -> None: + self._members = members + + self.add = async_to_streamed_response_wrapper( + members.add, + ) + self.remove = async_to_streamed_response_wrapper( + members.remove, + ) diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py new file mode 100644 index 00000000..86b49ff1 --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.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, Optional + +import httpx + +from .members import ( + MembersResource, + AsyncMembersResource, + MembersResourceWithRawResponse, + AsyncMembersResourceWithRawResponse, + MembersResourceWithStreamingResponse, + AsyncMembersResourceWithStreamingResponse, +) +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .....types.cloud import LbAlgorithm, LbPoolProtocol +from .health_monitors import ( + HealthMonitorsResource, + AsyncHealthMonitorsResource, + HealthMonitorsResourceWithRawResponse, + AsyncHealthMonitorsResourceWithRawResponse, + HealthMonitorsResourceWithStreamingResponse, + AsyncHealthMonitorsResourceWithStreamingResponse, +) +from ....._base_client import make_request_options +from .....types.cloud.lb_algorithm import LbAlgorithm +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.load_balancers import pool_list_params, pool_create_params, pool_update_params +from .....types.cloud.detailed_lb_pool import DetailedLbPool +from .....types.cloud.lb_pool_protocol import LbPoolProtocol +from .....types.cloud.detailed_lb_pool_list import DetailedLbPoolList + +__all__ = ["PoolsResource", "AsyncPoolsResource"] + + +class PoolsResource(SyncAPIResource): + @cached_property + def health_monitors(self) -> HealthMonitorsResource: + return HealthMonitorsResource(self._client) + + @cached_property + def members(self) -> MembersResource: + return MembersResource(self._client) + + @cached_property + def with_raw_response(self) -> PoolsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return PoolsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PoolsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return PoolsResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + lb_algorithm: LbAlgorithm, + name: str, + protocol: LbPoolProtocol, + ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, + crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, + healthmonitor: Optional[pool_create_params.Healthmonitor] | NotGiven = NOT_GIVEN, + listener_id: Optional[str] | NotGiven = NOT_GIVEN, + loadbalancer_id: Optional[str] | NotGiven = NOT_GIVEN, + members: Optional[Iterable[pool_create_params.Member]] | NotGiven = NOT_GIVEN, + secret_id: Optional[str] | NotGiven = NOT_GIVEN, + session_persistence: Optional[pool_create_params.SessionPersistence] | NotGiven = NOT_GIVEN, + timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create load balancer pool + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].post.parameters[1].schema" + + lb_algorithm: '#/components/schemas/CreateLbPoolSerializer/properties/lb_algorithm' + "$.components.schemas.CreateLbPoolSerializer.properties.lb_algorithm" + + name: '#/components/schemas/CreateLbPoolSerializer/properties/name' + "$.components.schemas.CreateLbPoolSerializer.properties.name" + + protocol: '#/components/schemas/CreateLbPoolSerializer/properties/protocol' + "$.components.schemas.CreateLbPoolSerializer.properties.protocol" + + ca_secret_id: '#/components/schemas/CreateLbPoolSerializer/properties/ca_secret_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.ca_secret_id.anyOf[0]" + + crl_secret_id: '#/components/schemas/CreateLbPoolSerializer/properties/crl_secret_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.crl_secret_id.anyOf[0]" + + healthmonitor: '#/components/schemas/CreateLbPoolSerializer/properties/healthmonitor/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.healthmonitor.anyOf[0]" + + listener_id: '#/components/schemas/CreateLbPoolSerializer/properties/listener_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.listener_id.anyOf[0]" + + loadbalancer_id: '#/components/schemas/CreateLbPoolSerializer/properties/loadbalancer_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.loadbalancer_id.anyOf[0]" + + members: '#/components/schemas/CreateLbPoolSerializer/properties/members/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.members.anyOf[0]" + + secret_id: '#/components/schemas/CreateLbPoolSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.secret_id.anyOf[0]" + + session_persistence: '#/components/schemas/CreateLbPoolSerializer/properties/session_persistence/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.session_persistence.anyOf[0]" + + timeout_client_data: '#/components/schemas/CreateLbPoolSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.timeout_client_data.anyOf[0]" + + timeout_member_connect: '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" + + timeout_member_data: '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_data.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/lbpools/{project_id}/{region_id}", + body=maybe_transform( + { + "lb_algorithm": lb_algorithm, + "name": name, + "protocol": protocol, + "ca_secret_id": ca_secret_id, + "crl_secret_id": crl_secret_id, + "healthmonitor": healthmonitor, + "listener_id": listener_id, + "loadbalancer_id": loadbalancer_id, + "members": members, + "secret_id": secret_id, + "session_persistence": session_persistence, + "timeout_client_data": timeout_client_data, + "timeout_member_connect": timeout_member_connect, + "timeout_member_data": timeout_member_data, + }, + pool_create_params.PoolCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + pool_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, + crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, + healthmonitor: Optional[pool_update_params.Healthmonitor] | NotGiven = NOT_GIVEN, + lb_algorithm: LbAlgorithm | NotGiven = NOT_GIVEN, + members: Optional[Iterable[pool_update_params.Member]] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + protocol: LbPoolProtocol | NotGiven = NOT_GIVEN, + secret_id: Optional[str] | NotGiven = NOT_GIVEN, + session_persistence: Optional[pool_update_params.SessionPersistence] | NotGiven = NOT_GIVEN, + timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Changes provided here will overwrite existing load balancer pool settings. + Undefined fields will be kept as is. Complex objects need to be specified fully, + they will be overwritten. + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[2].schema" + + ca_secret_id: '#/components/schemas/PatchLbPoolSerializer/properties/ca_secret_id/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.ca_secret_id.anyOf[0]" + + crl_secret_id: '#/components/schemas/PatchLbPoolSerializer/properties/crl_secret_id/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.crl_secret_id.anyOf[0]" + + healthmonitor: '#/components/schemas/PatchLbPoolSerializer/properties/healthmonitor/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.healthmonitor.anyOf[0]" + + lb_algorithm: '#/components/schemas/PatchLbPoolSerializer/properties/lb_algorithm' + "$.components.schemas.PatchLbPoolSerializer.properties.lb_algorithm" + + members: '#/components/schemas/PatchLbPoolSerializer/properties/members/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.members.anyOf[0]" + + name: '#/components/schemas/PatchLbPoolSerializer/properties/name' + "$.components.schemas.PatchLbPoolSerializer.properties.name" + + protocol: '#/components/schemas/PatchLbPoolSerializer/properties/protocol' + "$.components.schemas.PatchLbPoolSerializer.properties.protocol" + + secret_id: '#/components/schemas/PatchLbPoolSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.secret_id.anyOf[0]" + + session_persistence: '#/components/schemas/PatchLbPoolSerializer/properties/session_persistence/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.session_persistence.anyOf[0]" + + timeout_client_data: '#/components/schemas/PatchLbPoolSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.timeout_client_data.anyOf[0]" + + timeout_member_connect: '#/components/schemas/PatchLbPoolSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" + + timeout_member_data: '#/components/schemas/PatchLbPoolSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.timeout_member_data.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + return self._patch( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + body=maybe_transform( + { + "ca_secret_id": ca_secret_id, + "crl_secret_id": crl_secret_id, + "healthmonitor": healthmonitor, + "lb_algorithm": lb_algorithm, + "members": members, + "name": name, + "protocol": protocol, + "secret_id": secret_id, + "session_persistence": session_persistence, + "timeout_client_data": timeout_client_data, + "timeout_member_connect": timeout_member_connect, + "timeout_member_data": timeout_member_data, + }, + pool_update_params.PoolUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + details: bool | NotGiven = NOT_GIVEN, + listener_id: str | NotGiven = NOT_GIVEN, + loadbalancer_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DetailedLbPoolList: + """ + List load balancer pools + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[1].schema" + + details: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[2]" + + listener_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[3]" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[4]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/lbpools/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "details": details, + "listener_id": listener_id, + "loadbalancer_id": loadbalancer_id, + }, + pool_list_params.PoolListParams, + ), + ), + cast_to=DetailedLbPoolList, + ) + + def delete( + self, + pool_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete load balancer pool + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}']['delete'].parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + return self._delete( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + pool_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DetailedLbPool: + """ + Get load balancer pool + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].get.parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + return self._get( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DetailedLbPool, + ) + + +class AsyncPoolsResource(AsyncAPIResource): + @cached_property + def health_monitors(self) -> AsyncHealthMonitorsResource: + return AsyncHealthMonitorsResource(self._client) + + @cached_property + def members(self) -> AsyncMembersResource: + return AsyncMembersResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncPoolsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncPoolsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPoolsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncPoolsResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + lb_algorithm: LbAlgorithm, + name: str, + protocol: LbPoolProtocol, + ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, + crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, + healthmonitor: Optional[pool_create_params.Healthmonitor] | NotGiven = NOT_GIVEN, + listener_id: Optional[str] | NotGiven = NOT_GIVEN, + loadbalancer_id: Optional[str] | NotGiven = NOT_GIVEN, + members: Optional[Iterable[pool_create_params.Member]] | NotGiven = NOT_GIVEN, + secret_id: Optional[str] | NotGiven = NOT_GIVEN, + session_persistence: Optional[pool_create_params.SessionPersistence] | NotGiven = NOT_GIVEN, + timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create load balancer pool + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].post.parameters[1].schema" + + lb_algorithm: '#/components/schemas/CreateLbPoolSerializer/properties/lb_algorithm' + "$.components.schemas.CreateLbPoolSerializer.properties.lb_algorithm" + + name: '#/components/schemas/CreateLbPoolSerializer/properties/name' + "$.components.schemas.CreateLbPoolSerializer.properties.name" + + protocol: '#/components/schemas/CreateLbPoolSerializer/properties/protocol' + "$.components.schemas.CreateLbPoolSerializer.properties.protocol" + + ca_secret_id: '#/components/schemas/CreateLbPoolSerializer/properties/ca_secret_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.ca_secret_id.anyOf[0]" + + crl_secret_id: '#/components/schemas/CreateLbPoolSerializer/properties/crl_secret_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.crl_secret_id.anyOf[0]" + + healthmonitor: '#/components/schemas/CreateLbPoolSerializer/properties/healthmonitor/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.healthmonitor.anyOf[0]" + + listener_id: '#/components/schemas/CreateLbPoolSerializer/properties/listener_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.listener_id.anyOf[0]" + + loadbalancer_id: '#/components/schemas/CreateLbPoolSerializer/properties/loadbalancer_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.loadbalancer_id.anyOf[0]" + + members: '#/components/schemas/CreateLbPoolSerializer/properties/members/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.members.anyOf[0]" + + secret_id: '#/components/schemas/CreateLbPoolSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.secret_id.anyOf[0]" + + session_persistence: '#/components/schemas/CreateLbPoolSerializer/properties/session_persistence/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.session_persistence.anyOf[0]" + + timeout_client_data: '#/components/schemas/CreateLbPoolSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.timeout_client_data.anyOf[0]" + + timeout_member_connect: '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" + + timeout_member_data: '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_data.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/lbpools/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "lb_algorithm": lb_algorithm, + "name": name, + "protocol": protocol, + "ca_secret_id": ca_secret_id, + "crl_secret_id": crl_secret_id, + "healthmonitor": healthmonitor, + "listener_id": listener_id, + "loadbalancer_id": loadbalancer_id, + "members": members, + "secret_id": secret_id, + "session_persistence": session_persistence, + "timeout_client_data": timeout_client_data, + "timeout_member_connect": timeout_member_connect, + "timeout_member_data": timeout_member_data, + }, + pool_create_params.PoolCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + pool_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, + crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, + healthmonitor: Optional[pool_update_params.Healthmonitor] | NotGiven = NOT_GIVEN, + lb_algorithm: LbAlgorithm | NotGiven = NOT_GIVEN, + members: Optional[Iterable[pool_update_params.Member]] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + protocol: LbPoolProtocol | NotGiven = NOT_GIVEN, + secret_id: Optional[str] | NotGiven = NOT_GIVEN, + session_persistence: Optional[pool_update_params.SessionPersistence] | NotGiven = NOT_GIVEN, + timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, + timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Changes provided here will overwrite existing load balancer pool settings. + Undefined fields will be kept as is. Complex objects need to be specified fully, + they will be overwritten. + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[2].schema" + + ca_secret_id: '#/components/schemas/PatchLbPoolSerializer/properties/ca_secret_id/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.ca_secret_id.anyOf[0]" + + crl_secret_id: '#/components/schemas/PatchLbPoolSerializer/properties/crl_secret_id/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.crl_secret_id.anyOf[0]" + + healthmonitor: '#/components/schemas/PatchLbPoolSerializer/properties/healthmonitor/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.healthmonitor.anyOf[0]" + + lb_algorithm: '#/components/schemas/PatchLbPoolSerializer/properties/lb_algorithm' + "$.components.schemas.PatchLbPoolSerializer.properties.lb_algorithm" + + members: '#/components/schemas/PatchLbPoolSerializer/properties/members/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.members.anyOf[0]" + + name: '#/components/schemas/PatchLbPoolSerializer/properties/name' + "$.components.schemas.PatchLbPoolSerializer.properties.name" + + protocol: '#/components/schemas/PatchLbPoolSerializer/properties/protocol' + "$.components.schemas.PatchLbPoolSerializer.properties.protocol" + + secret_id: '#/components/schemas/PatchLbPoolSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.secret_id.anyOf[0]" + + session_persistence: '#/components/schemas/PatchLbPoolSerializer/properties/session_persistence/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.session_persistence.anyOf[0]" + + timeout_client_data: '#/components/schemas/PatchLbPoolSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.timeout_client_data.anyOf[0]" + + timeout_member_connect: '#/components/schemas/PatchLbPoolSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" + + timeout_member_data: '#/components/schemas/PatchLbPoolSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.timeout_member_data.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + return await self._patch( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + body=await async_maybe_transform( + { + "ca_secret_id": ca_secret_id, + "crl_secret_id": crl_secret_id, + "healthmonitor": healthmonitor, + "lb_algorithm": lb_algorithm, + "members": members, + "name": name, + "protocol": protocol, + "secret_id": secret_id, + "session_persistence": session_persistence, + "timeout_client_data": timeout_client_data, + "timeout_member_connect": timeout_member_connect, + "timeout_member_data": timeout_member_data, + }, + pool_update_params.PoolUpdateParams, + ), + 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, + *, + project_id: int | None = None, + region_id: int | None = None, + details: bool | NotGiven = NOT_GIVEN, + listener_id: str | NotGiven = NOT_GIVEN, + loadbalancer_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DetailedLbPoolList: + """ + List load balancer pools + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[1].schema" + + details: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[2]" + + listener_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[3]" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[4]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/lbpools/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "details": details, + "listener_id": listener_id, + "loadbalancer_id": loadbalancer_id, + }, + pool_list_params.PoolListParams, + ), + ), + cast_to=DetailedLbPoolList, + ) + + async def delete( + self, + pool_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete load balancer pool + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}']['delete'].parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + return await self._delete( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + pool_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DetailedLbPool: + """ + Get load balancer pool + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].get.parameters[1].schema" + + pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not pool_id: + raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") + return await self._get( + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DetailedLbPool, + ) + + +class PoolsResourceWithRawResponse: + def __init__(self, pools: PoolsResource) -> None: + self._pools = pools + + self.create = to_raw_response_wrapper( + pools.create, + ) + self.update = to_raw_response_wrapper( + pools.update, + ) + self.list = to_raw_response_wrapper( + pools.list, + ) + self.delete = to_raw_response_wrapper( + pools.delete, + ) + self.get = to_raw_response_wrapper( + pools.get, + ) + + @cached_property + def health_monitors(self) -> HealthMonitorsResourceWithRawResponse: + return HealthMonitorsResourceWithRawResponse(self._pools.health_monitors) + + @cached_property + def members(self) -> MembersResourceWithRawResponse: + return MembersResourceWithRawResponse(self._pools.members) + + +class AsyncPoolsResourceWithRawResponse: + def __init__(self, pools: AsyncPoolsResource) -> None: + self._pools = pools + + self.create = async_to_raw_response_wrapper( + pools.create, + ) + self.update = async_to_raw_response_wrapper( + pools.update, + ) + self.list = async_to_raw_response_wrapper( + pools.list, + ) + self.delete = async_to_raw_response_wrapper( + pools.delete, + ) + self.get = async_to_raw_response_wrapper( + pools.get, + ) + + @cached_property + def health_monitors(self) -> AsyncHealthMonitorsResourceWithRawResponse: + return AsyncHealthMonitorsResourceWithRawResponse(self._pools.health_monitors) + + @cached_property + def members(self) -> AsyncMembersResourceWithRawResponse: + return AsyncMembersResourceWithRawResponse(self._pools.members) + + +class PoolsResourceWithStreamingResponse: + def __init__(self, pools: PoolsResource) -> None: + self._pools = pools + + self.create = to_streamed_response_wrapper( + pools.create, + ) + self.update = to_streamed_response_wrapper( + pools.update, + ) + self.list = to_streamed_response_wrapper( + pools.list, + ) + self.delete = to_streamed_response_wrapper( + pools.delete, + ) + self.get = to_streamed_response_wrapper( + pools.get, + ) + + @cached_property + def health_monitors(self) -> HealthMonitorsResourceWithStreamingResponse: + return HealthMonitorsResourceWithStreamingResponse(self._pools.health_monitors) + + @cached_property + def members(self) -> MembersResourceWithStreamingResponse: + return MembersResourceWithStreamingResponse(self._pools.members) + + +class AsyncPoolsResourceWithStreamingResponse: + def __init__(self, pools: AsyncPoolsResource) -> None: + self._pools = pools + + self.create = async_to_streamed_response_wrapper( + pools.create, + ) + self.update = async_to_streamed_response_wrapper( + pools.update, + ) + self.list = async_to_streamed_response_wrapper( + pools.list, + ) + self.delete = async_to_streamed_response_wrapper( + pools.delete, + ) + self.get = async_to_streamed_response_wrapper( + pools.get, + ) + + @cached_property + def health_monitors(self) -> AsyncHealthMonitorsResourceWithStreamingResponse: + return AsyncHealthMonitorsResourceWithStreamingResponse(self._pools.health_monitors) + + @cached_property + def members(self) -> AsyncMembersResourceWithStreamingResponse: + return AsyncMembersResourceWithStreamingResponse(self._pools.members) diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py new file mode 100644 index 00000000..3b33c75f --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -0,0 +1,290 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.load_balancer_status import LoadBalancerStatus +from ....types.cloud.load_balancer_status_list import LoadBalancerStatusList + +__all__ = ["StatusesResource", "AsyncStatusesResource"] + + +class StatusesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StatusesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return StatusesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StatusesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return StatusesResourceWithStreamingResponse(self) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LoadBalancerStatusList: + """ + List load balancers statuses + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fstatus/get/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/status'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fstatus/get/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/status'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancerStatusList, + ) + + def get( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LoadBalancerStatus: + """ + Get load balancer status + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fstatus/get/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fstatus/get/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status'].get.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fstatus/get/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancerStatus, + ) + + +class AsyncStatusesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncStatusesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncStatusesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStatusesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncStatusesResourceWithStreamingResponse(self) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LoadBalancerStatusList: + """ + List load balancers statuses + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fstatus/get/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/status'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fstatus/get/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/status'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancerStatusList, + ) + + async def get( + self, + loadbalancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LoadBalancerStatus: + """ + Get load balancer status + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fstatus/get/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fstatus/get/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status'].get.parameters[1].schema" + + loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fstatus/get/parameters/2/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not loadbalancer_id: + raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") + return await self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancerStatus, + ) + + +class StatusesResourceWithRawResponse: + def __init__(self, statuses: StatusesResource) -> None: + self._statuses = statuses + + self.list = to_raw_response_wrapper( + statuses.list, + ) + self.get = to_raw_response_wrapper( + statuses.get, + ) + + +class AsyncStatusesResourceWithRawResponse: + def __init__(self, statuses: AsyncStatusesResource) -> None: + self._statuses = statuses + + self.list = async_to_raw_response_wrapper( + statuses.list, + ) + self.get = async_to_raw_response_wrapper( + statuses.get, + ) + + +class StatusesResourceWithStreamingResponse: + def __init__(self, statuses: StatusesResource) -> None: + self._statuses = statuses + + self.list = to_streamed_response_wrapper( + statuses.list, + ) + self.get = to_streamed_response_wrapper( + statuses.get, + ) + + +class AsyncStatusesResourceWithStreamingResponse: + def __init__(self, statuses: AsyncStatusesResource) -> None: + self._statuses = statuses + + self.list = async_to_streamed_response_wrapper( + statuses.list, + ) + self.get = async_to_streamed_response_wrapper( + statuses.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 1dd63405..9de7b4cb 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -9,21 +9,36 @@ from .secret import Secret as Secret from .subnet import Subnet as Subnet from .volume import Volume as Volume +from .l7_rule import L7Rule as L7Rule from .network import Network as Network from .project import Project as Project from .ssh_key import SSHKey as SSHKey from .ip_ranges import IPRanges as IPRanges +from .l7_policy import L7Policy as L7Policy from .file_share import FileShare as FileShare from .image_list import ImageList as ImageList from .ip_version import IPVersion as IPVersion from .floating_ip import FloatingIP as FloatingIP +from .http_method import HTTPMethod as HTTPMethod +from .lb_listener import LbListener as LbListener +from .pool_status import PoolStatus as PoolStatus from .ddos_profile import DDOSProfile as DDOSProfile +from .l7_rule_list import L7RuleList as L7RuleList +from .lb_algorithm import LbAlgorithm as LbAlgorithm from .task_id_list import TaskIDList as TaskIDList from .load_balancer import LoadBalancer as LoadBalancer +from .member_status import MemberStatus as MemberStatus +from .l7_policy_list import L7PolicyList as L7PolicyList +from .lb_flavor_list import LbFlavorList as LbFlavorList from .security_group import SecurityGroup as SecurityGroup +from .listener_status import ListenerStatus as ListenerStatus from .placement_group import PlacementGroup as PlacementGroup from .ssh_key_created import SSHKeyCreated as SSHKeyCreated +from .detailed_lb_pool import DetailedLbPool as DetailedLbPool +from .lb_listener_list import LbListenerList as LbListenerList +from .lb_pool_protocol import LbPoolProtocol as LbPoolProtocol from .task_list_params import TaskListParams as TaskListParams +from .lb_health_monitor import LbHealthMonitor as LbHealthMonitor from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP from .ddos_profile_field import DDOSProfileField as DDOSProfileField from .floating_ip_status import FloatingIPStatus as FloatingIPStatus @@ -31,6 +46,7 @@ from .volume_list_params import VolumeListParams as VolumeListParams from .billing_reservation import BillingReservation as BillingReservation from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus +from .health_monitor_type import HealthMonitorType as HealthMonitorType from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .network_list_params import NetworkListParams as NetworkListParams from .project_list_params import ProjectListParams as ProjectListParams @@ -38,6 +54,9 @@ from .security_group_rule import SecurityGroupRule as SecurityGroupRule from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed +from .lb_listener_protocol import LbListenerProtocol as LbListenerProtocol +from .load_balancer_status import LoadBalancerStatus as LoadBalancerStatus +from .loadbalancer_metrics import LoadbalancerMetrics as LoadbalancerMetrics from .placement_group_list import PlacementGroupList as PlacementGroupList from .secret_create_params import SecretCreateParams as SecretCreateParams from .secret_list_response import SecretListResponse as SecretListResponse @@ -46,34 +65,48 @@ from .volume_resize_params import VolumeResizeParams as VolumeResizeParams from .volume_update_params import VolumeUpdateParams as VolumeUpdateParams from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate +from .detailed_lb_pool_list import DetailedLbPoolList as DetailedLbPoolList +from .health_monitor_status import HealthMonitorStatus as HealthMonitorStatus from .network_create_params import NetworkCreateParams as NetworkCreateParams from .network_update_params import NetworkUpdateParams as NetworkUpdateParams from .project_create_params import ProjectCreateParams as ProjectCreateParams from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams from .file_share_list_params import FileShareListParams as FileShareListParams +from .lb_session_persistence import LbSessionPersistence as LbSessionPersistence from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams +from .detailed_lb_pool_member import DetailedLbPoolMember as DetailedLbPoolMember from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList from .file_share_create_params import FileShareCreateParams as FileShareCreateParams from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams from .file_share_update_params import FileShareUpdateParams as FileShareUpdateParams +from .load_balancer_get_params import LoadBalancerGetParams as LoadBalancerGetParams from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics +from .session_persistence_type import SessionPersistenceType as SessionPersistenceType from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams +from .load_balancer_list_params import LoadBalancerListParams as LoadBalancerListParams +from .load_balancer_status_list import LoadBalancerStatusList as LoadBalancerStatusList +from .loadbalancer_metrics_list import LoadbalancerMetricsList as LoadbalancerMetricsList from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField +from .flavor_hardware_description import FlavorHardwareDescription as FlavorHardwareDescription +from .load_balancer_create_params import LoadBalancerCreateParams as LoadBalancerCreateParams from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole +from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams +from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams +from .load_balancer_failover_params import LoadBalancerFailoverParams as LoadBalancerFailoverParams from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus diff --git a/src/gcore/types/cloud/detailed_lb_pool.py b/src/gcore/types/cloud/detailed_lb_pool.py new file mode 100644 index 00000000..c39481fc --- /dev/null +++ b/src/gcore/types/cloud/detailed_lb_pool.py @@ -0,0 +1,146 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .lb_algorithm import LbAlgorithm +from .lb_pool_protocol import LbPoolProtocol +from .lb_health_monitor import LbHealthMonitor +from .provisioning_status import ProvisioningStatus +from .lb_session_persistence import LbSessionPersistence +from .detailed_lb_pool_member import DetailedLbPoolMember +from .load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = ["DetailedLbPool", "Listener", "Loadbalancer"] + + +class Listener(BaseModel): + id: str + """ + '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' + "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" + """ + + +class Loadbalancer(BaseModel): + id: str + """ + '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' + "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" + """ + + +class DetailedLbPool(BaseModel): + id: str + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/id' + "$.components.schemas.DetailedLbPoolSerializer.properties.id" + """ + + ca_secret_id: Optional[str] = None + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/ca_secret_id/anyOf/0' + "$.components.schemas.DetailedLbPoolSerializer.properties.ca_secret_id.anyOf[0]" + """ + + crl_secret_id: Optional[str] = None + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/crl_secret_id/anyOf/0' + "$.components.schemas.DetailedLbPoolSerializer.properties.crl_secret_id.anyOf[0]" + """ + + lb_algorithm: LbAlgorithm + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/lb_algorithm' + "$.components.schemas.DetailedLbPoolSerializer.properties.lb_algorithm" + """ + + listeners: List[Listener] + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/listeners' + "$.components.schemas.DetailedLbPoolSerializer.properties.listeners" + """ + + loadbalancers: List[Loadbalancer] + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/loadbalancers' + "$.components.schemas.DetailedLbPoolSerializer.properties.loadbalancers" + """ + + members: List[DetailedLbPoolMember] + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/members' + "$.components.schemas.DetailedLbPoolSerializer.properties.members" + """ + + name: str + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/name' + "$.components.schemas.DetailedLbPoolSerializer.properties.name" + """ + + operating_status: LoadBalancerOperatingStatus + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/operating_status' + "$.components.schemas.DetailedLbPoolSerializer.properties.operating_status" + """ + + protocol: LbPoolProtocol + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/protocol' + "$.components.schemas.DetailedLbPoolSerializer.properties.protocol" + """ + + provisioning_status: ProvisioningStatus + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/provisioning_status' + "$.components.schemas.DetailedLbPoolSerializer.properties.provisioning_status" + """ + + secret_id: Optional[str] = None + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.DetailedLbPoolSerializer.properties.secret_id.anyOf[0]" + """ + + session_persistence: Optional[LbSessionPersistence] = None + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/session_persistence/anyOf/0' + "$.components.schemas.DetailedLbPoolSerializer.properties.session_persistence.anyOf[0]" + """ + + timeout_client_data: Optional[int] = None + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.DetailedLbPoolSerializer.properties.timeout_client_data.anyOf[0]" + """ + + timeout_member_connect: Optional[int] = None + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.DetailedLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" + """ + + timeout_member_data: Optional[int] = None + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.DetailedLbPoolSerializer.properties.timeout_member_data.anyOf[0]" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.DetailedLbPoolSerializer.properties.creator_task_id.anyOf[0]" + """ + + healthmonitor: Optional[LbHealthMonitor] = None + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/healthmonitor/anyOf/0' + "$.components.schemas.DetailedLbPoolSerializer.properties.healthmonitor.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/DetailedLbPoolSerializer/properties/task_id/anyOf/0' + "$.components.schemas.DetailedLbPoolSerializer.properties.task_id.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/detailed_lb_pool_list.py b/src/gcore/types/cloud/detailed_lb_pool_list.py new file mode 100644 index 00000000..8dd06f86 --- /dev/null +++ b/src/gcore/types/cloud/detailed_lb_pool_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .detailed_lb_pool import DetailedLbPool + +__all__ = ["DetailedLbPoolList"] + + +class DetailedLbPoolList(BaseModel): + count: int + """ + '#/components/schemas/DetailedLbPoolSerializerList/properties/count' + "$.components.schemas.DetailedLbPoolSerializerList.properties.count" + """ + + results: List[DetailedLbPool] + """ + '#/components/schemas/DetailedLbPoolSerializerList/properties/results' + "$.components.schemas.DetailedLbPoolSerializerList.properties.results" + """ diff --git a/src/gcore/types/cloud/detailed_lb_pool_member.py b/src/gcore/types/cloud/detailed_lb_pool_member.py new file mode 100644 index 00000000..4c5401c4 --- /dev/null +++ b/src/gcore/types/cloud/detailed_lb_pool_member.py @@ -0,0 +1,71 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .provisioning_status import ProvisioningStatus +from .load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = ["DetailedLbPoolMember"] + + +class DetailedLbPoolMember(BaseModel): + id: str + """ + '#/components/schemas/DetailedLbPoolMemberSerializer/properties/id' + "$.components.schemas.DetailedLbPoolMemberSerializer.properties.id" + """ + + address: str + """ + '#/components/schemas/DetailedLbPoolMemberSerializer/properties/address' + "$.components.schemas.DetailedLbPoolMemberSerializer.properties.address" + """ + + admin_state_up: bool + """ + '#/components/schemas/DetailedLbPoolMemberSerializer/properties/admin_state_up' + "$.components.schemas.DetailedLbPoolMemberSerializer.properties.admin_state_up" + """ + + operating_status: LoadBalancerOperatingStatus + """ + '#/components/schemas/DetailedLbPoolMemberSerializer/properties/operating_status' + "$.components.schemas.DetailedLbPoolMemberSerializer.properties.operating_status" + """ + + protocol_port: int + """ + '#/components/schemas/DetailedLbPoolMemberSerializer/properties/protocol_port' + "$.components.schemas.DetailedLbPoolMemberSerializer.properties.protocol_port" + """ + + provisioning_status: ProvisioningStatus + """ + '#/components/schemas/DetailedLbPoolMemberSerializer/properties/provisioning_status' + "$.components.schemas.DetailedLbPoolMemberSerializer.properties.provisioning_status" + """ + + weight: int + """ + '#/components/schemas/DetailedLbPoolMemberSerializer/properties/weight' + "$.components.schemas.DetailedLbPoolMemberSerializer.properties.weight" + """ + + monitor_address: Optional[str] = None + """ + '#/components/schemas/DetailedLbPoolMemberSerializer/properties/monitor_address/anyOf/0' + "$.components.schemas.DetailedLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" + """ + + monitor_port: Optional[int] = None + """ + '#/components/schemas/DetailedLbPoolMemberSerializer/properties/monitor_port/anyOf/0' + "$.components.schemas.DetailedLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" + """ + + subnet_id: Optional[str] = None + """ + '#/components/schemas/DetailedLbPoolMemberSerializer/properties/subnet_id/anyOf/0' + "$.components.schemas.DetailedLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/flavor_hardware_description.py b/src/gcore/types/cloud/flavor_hardware_description.py new file mode 100644 index 00000000..4a2286a5 --- /dev/null +++ b/src/gcore/types/cloud/flavor_hardware_description.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["FlavorHardwareDescription"] + + +class FlavorHardwareDescription(BaseModel): + cpu: Optional[str] = None + """ + '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/cpu/anyOf/0' + "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.cpu.anyOf[0]" + """ + + disk: Optional[str] = None + """ + '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/disk/anyOf/0' + "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.disk.anyOf[0]" + """ + + ephemeral: Optional[str] = None + """ + '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/ephemeral/anyOf/0' + "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.ephemeral.anyOf[0]" + """ + + gpu: Optional[str] = None + """ + '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/gpu/anyOf/0' + "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.gpu.anyOf[0]" + """ + + ipu: Optional[str] = None + """ + '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/ipu/anyOf/0' + "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.ipu.anyOf[0]" + """ + + network: Optional[str] = None + """ + '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/network/anyOf/0' + "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.network.anyOf[0]" + """ + + poplar_count: Optional[int] = None + """ + '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/poplar_count/anyOf/0' + "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.poplar_count.anyOf[0]" + """ + + ram: Optional[str] = None + """ + '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/ram/anyOf/0' + "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.ram.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/health_monitor_status.py b/src/gcore/types/cloud/health_monitor_status.py new file mode 100644 index 00000000..eaeb5a70 --- /dev/null +++ b/src/gcore/types/cloud/health_monitor_status.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from .health_monitor_type import HealthMonitorType +from .provisioning_status import ProvisioningStatus +from .load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = ["HealthMonitorStatus"] + + +class HealthMonitorStatus(BaseModel): + id: str + """ + '#/components/schemas/HealthMonitorStatusSerializer/properties/id' + "$.components.schemas.HealthMonitorStatusSerializer.properties.id" + """ + + operating_status: LoadBalancerOperatingStatus + """ + '#/components/schemas/HealthMonitorStatusSerializer/properties/operating_status' + "$.components.schemas.HealthMonitorStatusSerializer.properties.operating_status" + """ + + provisioning_status: ProvisioningStatus + """ + '#/components/schemas/HealthMonitorStatusSerializer/properties/provisioning_status' + "$.components.schemas.HealthMonitorStatusSerializer.properties.provisioning_status" + """ + + type: HealthMonitorType + """ + '#/components/schemas/HealthMonitorStatusSerializer/properties/type' + "$.components.schemas.HealthMonitorStatusSerializer.properties.type" + """ diff --git a/src/gcore/types/cloud/health_monitor_type.py b/src/gcore/types/cloud/health_monitor_type.py new file mode 100644 index 00000000..dd84a442 --- /dev/null +++ b/src/gcore/types/cloud/health_monitor_type.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["HealthMonitorType"] + +HealthMonitorType: TypeAlias = Literal["HTTP", "HTTPS", "K8S", "PING", "TCP", "TLS-HELLO", "UDP-CONNECT"] diff --git a/src/gcore/types/cloud/http_method.py b/src/gcore/types/cloud/http_method.py new file mode 100644 index 00000000..803934ff --- /dev/null +++ b/src/gcore/types/cloud/http_method.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["HTTPMethod"] + +HTTPMethod: TypeAlias = Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"] diff --git a/src/gcore/types/cloud/l7_policy.py b/src/gcore/types/cloud/l7_policy.py new file mode 100644 index 00000000..f812acdf --- /dev/null +++ b/src/gcore/types/cloud/l7_policy.py @@ -0,0 +1,115 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .l7_rule import L7Rule +from ..._models import BaseModel + +__all__ = ["L7Policy"] + + +class L7Policy(BaseModel): + id: Optional[str] = None + """ + '#/components/schemas/L7PolicySchema/properties/id' + "$.components.schemas.L7PolicySchema.properties.id" + """ + + action: Optional[Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"]] = None + """ + '#/components/schemas/L7PolicySchema/properties/action' + "$.components.schemas.L7PolicySchema.properties.action" + """ + + listener_id: Optional[str] = None + """ + '#/components/schemas/L7PolicySchema/properties/listener_id' + "$.components.schemas.L7PolicySchema.properties.listener_id" + """ + + name: Optional[str] = None + """ + '#/components/schemas/L7PolicySchema/properties/name' + "$.components.schemas.L7PolicySchema.properties.name" + """ + + operating_status: Optional[Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"]] = None + """ + '#/components/schemas/L7PolicySchema/properties/operating_status' + "$.components.schemas.L7PolicySchema.properties.operating_status" + """ + + position: Optional[int] = None + """ + '#/components/schemas/L7PolicySchema/properties/position' + "$.components.schemas.L7PolicySchema.properties.position" + """ + + project_id: Optional[int] = None + """ + '#/components/schemas/L7PolicySchema/properties/project_id' + "$.components.schemas.L7PolicySchema.properties.project_id" + """ + + provisioning_status: Optional[ + Literal["ACTIVE", "DELETED", "ERROR", "PENDING_CREATE", "PENDING_DELETE", "PENDING_UPDATE"] + ] = None + """ + '#/components/schemas/L7PolicySchema/properties/provisioning_status' + "$.components.schemas.L7PolicySchema.properties.provisioning_status" + """ + + redirect_http_code: Optional[int] = None + """ + '#/components/schemas/L7PolicySchema/properties/redirect_http_code' + "$.components.schemas.L7PolicySchema.properties.redirect_http_code" + """ + + redirect_pool_id: Optional[str] = None + """ + '#/components/schemas/L7PolicySchema/properties/redirect_pool_id' + "$.components.schemas.L7PolicySchema.properties.redirect_pool_id" + """ + + redirect_prefix: Optional[str] = None + """ + '#/components/schemas/L7PolicySchema/properties/redirect_prefix' + "$.components.schemas.L7PolicySchema.properties.redirect_prefix" + """ + + redirect_url: Optional[str] = None + """ + '#/components/schemas/L7PolicySchema/properties/redirect_url' + "$.components.schemas.L7PolicySchema.properties.redirect_url" + """ + + region: Optional[str] = None + """ + '#/components/schemas/L7PolicySchema/properties/region' + "$.components.schemas.L7PolicySchema.properties.region" + """ + + region_id: Optional[int] = None + """ + '#/components/schemas/L7PolicySchema/properties/region_id' + "$.components.schemas.L7PolicySchema.properties.region_id" + """ + + rules: Optional[List[L7Rule]] = None + """ + '#/components/schemas/L7PolicySchema/properties/rules' + "$.components.schemas.L7PolicySchema.properties.rules" + """ + + tags: Optional[List[str]] = None + """ + '#/components/schemas/L7PolicySchema/properties/tags' + "$.components.schemas.L7PolicySchema.properties.tags" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/L7PolicySchema/properties/task_id' + "$.components.schemas.L7PolicySchema.properties.task_id" + """ diff --git a/src/gcore/types/cloud/l7_policy_list.py b/src/gcore/types/cloud/l7_policy_list.py new file mode 100644 index 00000000..802ab5dc --- /dev/null +++ b/src/gcore/types/cloud/l7_policy_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .l7_policy import L7Policy + +__all__ = ["L7PolicyList"] + + +class L7PolicyList(BaseModel): + count: Optional[int] = None + """ + '#/components/schemas/L7PolicyListSchema/properties/count' + "$.components.schemas.L7PolicyListSchema.properties.count" + """ + + results: Optional[List[L7Policy]] = None + """ + '#/components/schemas/L7PolicyListSchema/properties/results' + "$.components.schemas.L7PolicyListSchema.properties.results" + """ diff --git a/src/gcore/types/cloud/l7_rule.py b/src/gcore/types/cloud/l7_rule.py new file mode 100644 index 00000000..ba331ac1 --- /dev/null +++ b/src/gcore/types/cloud/l7_rule.py @@ -0,0 +1,101 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["L7Rule"] + + +class L7Rule(BaseModel): + id: Optional[str] = None + """ + '#/components/schemas/L7RuleSchema/properties/id' + "$.components.schemas.L7RuleSchema.properties.id" + """ + + compare_type: Optional[Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"]] = None + """ + '#/components/schemas/L7RuleSchema/properties/compare_type' + "$.components.schemas.L7RuleSchema.properties.compare_type" + """ + + invert: Optional[bool] = None + """ + '#/components/schemas/L7RuleSchema/properties/invert' + "$.components.schemas.L7RuleSchema.properties.invert" + """ + + key: Optional[str] = None + """ + '#/components/schemas/L7RuleSchema/properties/key' + "$.components.schemas.L7RuleSchema.properties.key" + """ + + operating_status: Optional[Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"]] = None + """ + '#/components/schemas/L7RuleSchema/properties/operating_status' + "$.components.schemas.L7RuleSchema.properties.operating_status" + """ + + project_id: Optional[int] = None + """ + '#/components/schemas/L7RuleSchema/properties/project_id' + "$.components.schemas.L7RuleSchema.properties.project_id" + """ + + provisioning_status: Optional[ + Literal["ACTIVE", "DELETED", "ERROR", "PENDING_CREATE", "PENDING_DELETE", "PENDING_UPDATE"] + ] = None + """ + '#/components/schemas/L7RuleSchema/properties/provisioning_status' + "$.components.schemas.L7RuleSchema.properties.provisioning_status" + """ + + region: Optional[str] = None + """ + '#/components/schemas/L7RuleSchema/properties/region' + "$.components.schemas.L7RuleSchema.properties.region" + """ + + region_id: Optional[int] = None + """ + '#/components/schemas/L7RuleSchema/properties/region_id' + "$.components.schemas.L7RuleSchema.properties.region_id" + """ + + tags: Optional[List[str]] = None + """ + '#/components/schemas/L7RuleSchema/properties/tags' + "$.components.schemas.L7RuleSchema.properties.tags" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/L7RuleSchema/properties/task_id' + "$.components.schemas.L7RuleSchema.properties.task_id" + """ + + type: Optional[ + Literal[ + "COOKIE", + "FILE_TYPE", + "HEADER", + "HOST_NAME", + "PATH", + "SSL_CONN_HAS_CERT", + "SSL_DN_FIELD", + "SSL_VERIFY_RESULT", + ] + ] = None + """ + '#/components/schemas/L7RuleSchema/properties/type' + "$.components.schemas.L7RuleSchema.properties.type" + """ + + value: Optional[str] = None + """ + '#/components/schemas/L7RuleSchema/properties/value' + "$.components.schemas.L7RuleSchema.properties.value" + """ diff --git a/src/gcore/types/cloud/l7_rule_list.py b/src/gcore/types/cloud/l7_rule_list.py new file mode 100644 index 00000000..a5a567e6 --- /dev/null +++ b/src/gcore/types/cloud/l7_rule_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .l7_rule import L7Rule +from ..._models import BaseModel + +__all__ = ["L7RuleList"] + + +class L7RuleList(BaseModel): + count: Optional[int] = None + """ + '#/components/schemas/L7RuleListSchema/properties/count' + "$.components.schemas.L7RuleListSchema.properties.count" + """ + + results: Optional[List[L7Rule]] = None + """ + '#/components/schemas/L7RuleListSchema/properties/results' + "$.components.schemas.L7RuleListSchema.properties.results" + """ diff --git a/src/gcore/types/cloud/lb_algorithm.py b/src/gcore/types/cloud/lb_algorithm.py new file mode 100644 index 00000000..8d49ada2 --- /dev/null +++ b/src/gcore/types/cloud/lb_algorithm.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["LbAlgorithm"] + +LbAlgorithm: TypeAlias = Literal["LEAST_CONNECTIONS", "ROUND_ROBIN", "SOURCE_IP"] diff --git a/src/gcore/types/cloud/lb_flavor_list.py b/src/gcore/types/cloud/lb_flavor_list.py new file mode 100644 index 00000000..57faf8ac --- /dev/null +++ b/src/gcore/types/cloud/lb_flavor_list.py @@ -0,0 +1,81 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from ..._models import BaseModel +from .flavor_hardware_description import FlavorHardwareDescription + +__all__ = ["LbFlavorList", "Result", "ResultHardwareDescription"] + +ResultHardwareDescription: TypeAlias = Union[FlavorHardwareDescription, object] + + +class Result(BaseModel): + flavor_id: str + """ + '#/components/schemas/LbFlavorPricingSerializer/properties/flavor_id' + "$.components.schemas.LbFlavorPricingSerializer.properties.flavor_id" + """ + + flavor_name: str + """ + '#/components/schemas/LbFlavorPricingSerializer/properties/flavor_name' + "$.components.schemas.LbFlavorPricingSerializer.properties.flavor_name" + """ + + hardware_description: ResultHardwareDescription + """ + '#/components/schemas/LbFlavorPricingSerializer/properties/hardware_description' + "$.components.schemas.LbFlavorPricingSerializer.properties.hardware_description" + """ + + ram: int + """ + '#/components/schemas/LbFlavorPricingSerializer/properties/ram' + "$.components.schemas.LbFlavorPricingSerializer.properties.ram" + """ + + vcpus: int + """ + '#/components/schemas/LbFlavorPricingSerializer/properties/vcpus' + "$.components.schemas.LbFlavorPricingSerializer.properties.vcpus" + """ + + currency_code: Optional[str] = None + """ + '#/components/schemas/LbFlavorPricingSerializer/properties/currency_code/anyOf/0' + "$.components.schemas.LbFlavorPricingSerializer.properties.currency_code.anyOf[0]" + """ + + price_per_hour: Optional[float] = None + """ + '#/components/schemas/LbFlavorPricingSerializer/properties/price_per_hour/anyOf/0' + "$.components.schemas.LbFlavorPricingSerializer.properties.price_per_hour.anyOf[0]" + """ + + price_per_month: Optional[float] = None + """ + '#/components/schemas/LbFlavorPricingSerializer/properties/price_per_month/anyOf/0' + "$.components.schemas.LbFlavorPricingSerializer.properties.price_per_month.anyOf[0]" + """ + + price_status: Optional[Literal["error", "hide", "show"]] = None + """ + '#/components/schemas/LbFlavorPricingSerializer/properties/price_status/anyOf/0' + "$.components.schemas.LbFlavorPricingSerializer.properties.price_status.anyOf[0]" + """ + + +class LbFlavorList(BaseModel): + count: int + """ + '#/components/schemas/LbFlavorPricingCollectionSerializer/properties/count' + "$.components.schemas.LbFlavorPricingCollectionSerializer.properties.count" + """ + + results: List[Result] + """ + '#/components/schemas/LbFlavorPricingCollectionSerializer/properties/results' + "$.components.schemas.LbFlavorPricingCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/lb_health_monitor.py b/src/gcore/types/cloud/lb_health_monitor.py new file mode 100644 index 00000000..1e47e760 --- /dev/null +++ b/src/gcore/types/cloud/lb_health_monitor.py @@ -0,0 +1,85 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .http_method import HTTPMethod +from .health_monitor_type import HealthMonitorType +from .provisioning_status import ProvisioningStatus +from .load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = ["LbHealthMonitor"] + + +class LbHealthMonitor(BaseModel): + id: str + """ + '#/components/schemas/LbHealthMonitorSerializer/properties/id' + "$.components.schemas.LbHealthMonitorSerializer.properties.id" + """ + + admin_state_up: bool + """ + '#/components/schemas/LbHealthMonitorSerializer/properties/admin_state_up' + "$.components.schemas.LbHealthMonitorSerializer.properties.admin_state_up" + """ + + delay: int + """ + '#/components/schemas/LbHealthMonitorSerializer/properties/delay' + "$.components.schemas.LbHealthMonitorSerializer.properties.delay" + """ + + max_retries: int + """ + '#/components/schemas/LbHealthMonitorSerializer/properties/max_retries' + "$.components.schemas.LbHealthMonitorSerializer.properties.max_retries" + """ + + max_retries_down: int + """ + '#/components/schemas/LbHealthMonitorSerializer/properties/max_retries_down' + "$.components.schemas.LbHealthMonitorSerializer.properties.max_retries_down" + """ + + operating_status: LoadBalancerOperatingStatus + """ + '#/components/schemas/LbHealthMonitorSerializer/properties/operating_status' + "$.components.schemas.LbHealthMonitorSerializer.properties.operating_status" + """ + + provisioning_status: ProvisioningStatus + """ + '#/components/schemas/LbHealthMonitorSerializer/properties/provisioning_status' + "$.components.schemas.LbHealthMonitorSerializer.properties.provisioning_status" + """ + + timeout: int + """ + '#/components/schemas/LbHealthMonitorSerializer/properties/timeout' + "$.components.schemas.LbHealthMonitorSerializer.properties.timeout" + """ + + type: HealthMonitorType + """ + '#/components/schemas/LbHealthMonitorSerializer/properties/type' + "$.components.schemas.LbHealthMonitorSerializer.properties.type" + """ + + expected_codes: Optional[str] = None + """ + '#/components/schemas/LbHealthMonitorSerializer/properties/expected_codes/anyOf/0' + "$.components.schemas.LbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" + """ + + http_method: Optional[HTTPMethod] = None + """ + '#/components/schemas/LbHealthMonitorSerializer/properties/http_method/anyOf/0' + "$.components.schemas.LbHealthMonitorSerializer.properties.http_method.anyOf[0]" + """ + + url_path: Optional[str] = None + """ + '#/components/schemas/LbHealthMonitorSerializer/properties/url_path/anyOf/0' + "$.components.schemas.LbHealthMonitorSerializer.properties.url_path.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/lb_listener.py b/src/gcore/types/cloud/lb_listener.py new file mode 100644 index 00000000..45e485df --- /dev/null +++ b/src/gcore/types/cloud/lb_listener.py @@ -0,0 +1,147 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .provisioning_status import ProvisioningStatus +from .lb_listener_protocol import LbListenerProtocol +from .load_balancer_statistics import LoadBalancerStatistics +from .load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = ["LbListener", "UserList"] + + +class UserList(BaseModel): + encrypted_password: str + """ + '#/components/schemas/UserListItem/properties/encrypted_password' + "$.components.schemas.UserListItem.properties.encrypted_password" + """ + + username: str + """ + '#/components/schemas/UserListItem/properties/username' + "$.components.schemas.UserListItem.properties.username" + """ + + +class LbListener(BaseModel): + id: str + """ + '#/components/schemas/LbListenerSerializer/properties/id' + "$.components.schemas.LbListenerSerializer.properties.id" + """ + + connection_limit: int + """ + '#/components/schemas/LbListenerSerializer/properties/connection_limit' + "$.components.schemas.LbListenerSerializer.properties.connection_limit" + """ + + insert_headers: object + """ + '#/components/schemas/LbListenerSerializer/properties/insert_headers' + "$.components.schemas.LbListenerSerializer.properties.insert_headers" + """ + + name: str + """ + '#/components/schemas/LbListenerSerializer/properties/name' + "$.components.schemas.LbListenerSerializer.properties.name" + """ + + operating_status: LoadBalancerOperatingStatus + """ + '#/components/schemas/LbListenerSerializer/properties/operating_status' + "$.components.schemas.LbListenerSerializer.properties.operating_status" + """ + + protocol: LbListenerProtocol + """ + '#/components/schemas/LbListenerSerializer/properties/protocol' + "$.components.schemas.LbListenerSerializer.properties.protocol" + """ + + protocol_port: int + """ + '#/components/schemas/LbListenerSerializer/properties/protocol_port' + "$.components.schemas.LbListenerSerializer.properties.protocol_port" + """ + + provisioning_status: ProvisioningStatus + """ + '#/components/schemas/LbListenerSerializer/properties/provisioning_status' + "$.components.schemas.LbListenerSerializer.properties.provisioning_status" + """ + + allowed_cidrs: Optional[List[str]] = None + """ + '#/components/schemas/LbListenerSerializer/properties/allowed_cidrs/anyOf/0' + "$.components.schemas.LbListenerSerializer.properties.allowed_cidrs.anyOf[0]" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/LbListenerSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.LbListenerSerializer.properties.creator_task_id.anyOf[0]" + """ + + loadbalancer_id: Optional[str] = None + """ + '#/components/schemas/LbListenerSerializer/properties/loadbalancer_id/anyOf/0' + "$.components.schemas.LbListenerSerializer.properties.loadbalancer_id.anyOf[0]" + """ + + pool_count: Optional[int] = None + """ + '#/components/schemas/LbListenerSerializer/properties/pool_count/anyOf/0' + "$.components.schemas.LbListenerSerializer.properties.pool_count.anyOf[0]" + """ + + secret_id: Optional[str] = None + """ + '#/components/schemas/LbListenerSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.LbListenerSerializer.properties.secret_id.anyOf[0]" + """ + + sni_secret_id: Optional[List[str]] = None + """ + '#/components/schemas/LbListenerSerializer/properties/sni_secret_id/anyOf/0' + "$.components.schemas.LbListenerSerializer.properties.sni_secret_id.anyOf[0]" + """ + + stats: Optional[LoadBalancerStatistics] = None + """ + '#/components/schemas/LbListenerSerializer/properties/stats/anyOf/0' + "$.components.schemas.LbListenerSerializer.properties.stats.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/LbListenerSerializer/properties/task_id/anyOf/0' + "$.components.schemas.LbListenerSerializer.properties.task_id.anyOf[0]" + """ + + timeout_client_data: Optional[int] = None + """ + '#/components/schemas/LbListenerSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.LbListenerSerializer.properties.timeout_client_data.anyOf[0]" + """ + + timeout_member_connect: Optional[int] = None + """ + '#/components/schemas/LbListenerSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.LbListenerSerializer.properties.timeout_member_connect.anyOf[0]" + """ + + timeout_member_data: Optional[int] = None + """ + '#/components/schemas/LbListenerSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.LbListenerSerializer.properties.timeout_member_data.anyOf[0]" + """ + + user_list: Optional[List[UserList]] = None + """ + '#/components/schemas/LbListenerSerializer/properties/user_list' + "$.components.schemas.LbListenerSerializer.properties.user_list" + """ diff --git a/src/gcore/types/cloud/lb_listener_list.py b/src/gcore/types/cloud/lb_listener_list.py new file mode 100644 index 00000000..70d1977e --- /dev/null +++ b/src/gcore/types/cloud/lb_listener_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .lb_listener import LbListener + +__all__ = ["LbListenerList"] + + +class LbListenerList(BaseModel): + count: int + """ + '#/components/schemas/LbListenerSerializerList/properties/count' + "$.components.schemas.LbListenerSerializerList.properties.count" + """ + + results: List[LbListener] + """ + '#/components/schemas/LbListenerSerializerList/properties/results' + "$.components.schemas.LbListenerSerializerList.properties.results" + """ diff --git a/src/gcore/types/cloud/lb_listener_protocol.py b/src/gcore/types/cloud/lb_listener_protocol.py new file mode 100644 index 00000000..06fdedec --- /dev/null +++ b/src/gcore/types/cloud/lb_listener_protocol.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["LbListenerProtocol"] + +LbListenerProtocol: TypeAlias = Literal["HTTP", "HTTPS", "PROMETHEUS", "TCP", "TERMINATED_HTTPS", "UDP"] diff --git a/src/gcore/types/cloud/lb_pool_protocol.py b/src/gcore/types/cloud/lb_pool_protocol.py new file mode 100644 index 00000000..2a7a30a9 --- /dev/null +++ b/src/gcore/types/cloud/lb_pool_protocol.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["LbPoolProtocol"] + +LbPoolProtocol: TypeAlias = Literal["HTTP", "HTTPS", "PROXY", "PROXYV2", "TCP", "UDP"] diff --git a/src/gcore/types/cloud/lb_session_persistence.py b/src/gcore/types/cloud/lb_session_persistence.py new file mode 100644 index 00000000..00b03295 --- /dev/null +++ b/src/gcore/types/cloud/lb_session_persistence.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .session_persistence_type import SessionPersistenceType + +__all__ = ["LbSessionPersistence"] + + +class LbSessionPersistence(BaseModel): + type: SessionPersistenceType + """ + '#/components/schemas/LbSessionPersistence/properties/type' + "$.components.schemas.LbSessionPersistence.properties.type" + """ + + cookie_name: Optional[str] = None + """ + '#/components/schemas/LbSessionPersistence/properties/cookie_name/anyOf/0' + "$.components.schemas.LbSessionPersistence.properties.cookie_name.anyOf[0]" + """ + + persistence_granularity: Optional[str] = None + """ + '#/components/schemas/LbSessionPersistence/properties/persistence_granularity/anyOf/0' + "$.components.schemas.LbSessionPersistence.properties.persistence_granularity.anyOf[0]" + """ + + persistence_timeout: Optional[int] = None + """ + '#/components/schemas/LbSessionPersistence/properties/persistence_timeout/anyOf/0' + "$.components.schemas.LbSessionPersistence.properties.persistence_timeout.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/listener_status.py b/src/gcore/types/cloud/listener_status.py new file mode 100644 index 00000000..f261f938 --- /dev/null +++ b/src/gcore/types/cloud/listener_status.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .pool_status import PoolStatus +from .provisioning_status import ProvisioningStatus +from .load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = ["ListenerStatus"] + + +class ListenerStatus(BaseModel): + id: str + """ + '#/components/schemas/ListenerStatusSerializer/properties/id' + "$.components.schemas.ListenerStatusSerializer.properties.id" + """ + + name: str + """ + '#/components/schemas/ListenerStatusSerializer/properties/name' + "$.components.schemas.ListenerStatusSerializer.properties.name" + """ + + operating_status: LoadBalancerOperatingStatus + """ + '#/components/schemas/ListenerStatusSerializer/properties/operating_status' + "$.components.schemas.ListenerStatusSerializer.properties.operating_status" + """ + + pools: List[PoolStatus] + """ + '#/components/schemas/ListenerStatusSerializer/properties/pools' + "$.components.schemas.ListenerStatusSerializer.properties.pools" + """ + + provisioning_status: ProvisioningStatus + """ + '#/components/schemas/ListenerStatusSerializer/properties/provisioning_status' + "$.components.schemas.ListenerStatusSerializer.properties.provisioning_status" + """ diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py new file mode 100644 index 00000000..a94ed222 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -0,0 +1,489 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .http_method import HTTPMethod +from .lb_algorithm import LbAlgorithm +from .lb_pool_protocol import LbPoolProtocol +from .health_monitor_type import HealthMonitorType +from .interface_ip_family import InterfaceIPFamily +from .lb_listener_protocol import LbListenerProtocol +from .session_persistence_type import SessionPersistenceType +from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity + +__all__ = [ + "LoadBalancerCreateParams", + "FloatingIP", + "FloatingIPNewInstanceFloatingIPInterfaceSerializer", + "FloatingIPExistingInstanceFloatingIPInterfaceSerializer", + "Listener", + "ListenerPool", + "ListenerPoolHealthmonitor", + "ListenerPoolMember", + "ListenerPoolSessionPersistence", + "ListenerUserList", + "Logging", + "LoggingRetentionPolicy", +] + + +class LoadBalancerCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + flavor: str + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/flavor' + "$.components.schemas.CreateLoadbalancerSerializer.properties.flavor" + """ + + floating_ip: FloatingIP + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/floating_ip' + "$.components.schemas.CreateLoadbalancerSerializer.properties.floating_ip" + """ + + listeners: Iterable[Listener] + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/listeners' + "$.components.schemas.CreateLoadbalancerSerializer.properties.listeners" + """ + + logging: Logging + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/logging' + "$.components.schemas.CreateLoadbalancerSerializer.properties.logging" + """ + + metadata: Dict[str, str] + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/metadata' + "$.components.schemas.CreateLoadbalancerSerializer.properties.metadata" + """ + + name: str + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/name' + "$.components.schemas.CreateLoadbalancerSerializer.properties.name" + """ + + name_template: str + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/name_template' + "$.components.schemas.CreateLoadbalancerSerializer.properties.name_template" + """ + + preferred_connectivity: LoadBalancerMemberConnectivity + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/preferred_connectivity' + "$.components.schemas.CreateLoadbalancerSerializer.properties.preferred_connectivity" + """ + + tag: List[str] + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/tag' + "$.components.schemas.CreateLoadbalancerSerializer.properties.tag" + """ + + vip_ip_family: InterfaceIPFamily + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_ip_family' + "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_ip_family" + """ + + vip_network_id: str + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_network_id' + "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_network_id" + """ + + vip_port_id: str + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_port_id' + "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_port_id" + """ + + vip_subnet_id: str + """ + '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_subnet_id' + "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_subnet_id" + """ + + +class FloatingIPNewInstanceFloatingIPInterfaceSerializer(TypedDict, total=False): + source: Required[Literal["new"]] + """ + '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +class FloatingIPExistingInstanceFloatingIPInterfaceSerializer(TypedDict, total=False): + existing_floating_id: Required[str] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + """ + + source: Required[Literal["existing"]] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +FloatingIP: TypeAlias = Union[ + FloatingIPNewInstanceFloatingIPInterfaceSerializer, FloatingIPExistingInstanceFloatingIPInterfaceSerializer +] + + +class ListenerPoolHealthmonitor(TypedDict, total=False): + delay: Required[int] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/delay' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.delay" + """ + + max_retries: Required[int] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries" + """ + + timeout: Required[int] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/timeout' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.timeout" + """ + + type: Required[HealthMonitorType] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/type' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.type" + """ + + expected_codes: Optional[str] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/expected_codes/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" + """ + + http_method: Optional[HTTPMethod] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/http_method/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.http_method.anyOf[0]" + """ + + max_retries_down: Optional[int] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries_down/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries_down.anyOf[0]" + """ + + url_path: Optional[str] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/url_path/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.url_path.anyOf[0]" + """ + + +class ListenerPoolMember(TypedDict, total=False): + address: Required[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/address' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.address" + """ + + protocol_port: Required[int] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/protocol_port' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.protocol_port" + """ + + admin_state_up: Optional[bool] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/admin_state_up/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.admin_state_up.anyOf[0]" + """ + + instance_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/instance_id/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.instance_id.anyOf[0]" + """ + + monitor_address: Optional[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_address/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" + """ + + monitor_port: Optional[int] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_port/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" + """ + + subnet_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/subnet_id/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" + """ + + weight: Optional[int] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/weight/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.weight.anyOf[0]" + """ + + +class ListenerPoolSessionPersistence(TypedDict, total=False): + type: Required[SessionPersistenceType] + """ + '#/components/schemas/MutateLbSessionPersistence/properties/type' + "$.components.schemas.MutateLbSessionPersistence.properties.type" + """ + + cookie_name: Optional[str] + """ + '#/components/schemas/MutateLbSessionPersistence/properties/cookie_name/anyOf/0' + "$.components.schemas.MutateLbSessionPersistence.properties.cookie_name.anyOf[0]" + """ + + persistence_granularity: Optional[str] + """ + '#/components/schemas/MutateLbSessionPersistence/properties/persistence_granularity/anyOf/0' + "$.components.schemas.MutateLbSessionPersistence.properties.persistence_granularity.anyOf[0]" + """ + + persistence_timeout: Optional[int] + """ + '#/components/schemas/MutateLbSessionPersistence/properties/persistence_timeout/anyOf/0' + "$.components.schemas.MutateLbSessionPersistence.properties.persistence_timeout.anyOf[0]" + """ + + +class ListenerPool(TypedDict, total=False): + lb_algorithm: Required[LbAlgorithm] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/lb_algorithm' + "$.components.schemas.CreateLbPoolSerializer.properties.lb_algorithm" + """ + + name: Required[str] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/name' + "$.components.schemas.CreateLbPoolSerializer.properties.name" + """ + + protocol: Required[LbPoolProtocol] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/protocol' + "$.components.schemas.CreateLbPoolSerializer.properties.protocol" + """ + + ca_secret_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/ca_secret_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.ca_secret_id.anyOf[0]" + """ + + crl_secret_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/crl_secret_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.crl_secret_id.anyOf[0]" + """ + + healthmonitor: Optional[ListenerPoolHealthmonitor] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/healthmonitor/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.healthmonitor.anyOf[0]" + """ + + listener_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/listener_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.listener_id.anyOf[0]" + """ + + loadbalancer_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/loadbalancer_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.loadbalancer_id.anyOf[0]" + """ + + members: Optional[Iterable[ListenerPoolMember]] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/members/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.members.anyOf[0]" + """ + + secret_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.secret_id.anyOf[0]" + """ + + session_persistence: Optional[ListenerPoolSessionPersistence] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/session_persistence/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.session_persistence.anyOf[0]" + """ + + timeout_client_data: Optional[int] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.timeout_client_data.anyOf[0]" + """ + + timeout_member_connect: Optional[int] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" + """ + + timeout_member_data: Optional[int] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_data.anyOf[0]" + """ + + +class ListenerUserList(TypedDict, total=False): + encrypted_password: Required[str] + """ + '#/components/schemas/UserListItem/properties/encrypted_password' + "$.components.schemas.UserListItem.properties.encrypted_password" + """ + + username: Required[str] + """ + '#/components/schemas/UserListItem/properties/username' + "$.components.schemas.UserListItem.properties.username" + """ + + +class Listener(TypedDict, total=False): + name: Required[str] + """ + '#/components/schemas/CreateListenerSerializer/properties/name' + "$.components.schemas.CreateListenerSerializer.properties.name" + """ + + protocol: Required[LbListenerProtocol] + """ + '#/components/schemas/CreateListenerSerializer/properties/protocol' + "$.components.schemas.CreateListenerSerializer.properties.protocol" + """ + + protocol_port: Required[int] + """ + '#/components/schemas/CreateListenerSerializer/properties/protocol_port' + "$.components.schemas.CreateListenerSerializer.properties.protocol_port" + """ + + allowed_cidrs: Optional[List[str]] + """ + '#/components/schemas/CreateListenerSerializer/properties/allowed_cidrs/anyOf/0' + "$.components.schemas.CreateListenerSerializer.properties.allowed_cidrs.anyOf[0]" + """ + + connection_limit: int + """ + '#/components/schemas/CreateListenerSerializer/properties/connection_limit' + "$.components.schemas.CreateListenerSerializer.properties.connection_limit" + """ + + insert_x_forwarded: bool + """ + '#/components/schemas/CreateListenerSerializer/properties/insert_x_forwarded' + "$.components.schemas.CreateListenerSerializer.properties.insert_x_forwarded" + """ + + pools: Iterable[ListenerPool] + """ + '#/components/schemas/CreateListenerSerializer/properties/pools' + "$.components.schemas.CreateListenerSerializer.properties.pools" + """ + + secret_id: str + """ + '#/components/schemas/CreateListenerSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.CreateListenerSerializer.properties.secret_id.anyOf[0]" + """ + + sni_secret_id: List[str] + """ + '#/components/schemas/CreateListenerSerializer/properties/sni_secret_id' + "$.components.schemas.CreateListenerSerializer.properties.sni_secret_id" + """ + + timeout_client_data: Optional[int] + """ + '#/components/schemas/CreateListenerSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.CreateListenerSerializer.properties.timeout_client_data.anyOf[0]" + """ + + timeout_member_connect: Optional[int] + """ + '#/components/schemas/CreateListenerSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.CreateListenerSerializer.properties.timeout_member_connect.anyOf[0]" + """ + + timeout_member_data: Optional[int] + """ + '#/components/schemas/CreateListenerSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.CreateListenerSerializer.properties.timeout_member_data.anyOf[0]" + """ + + user_list: Iterable[ListenerUserList] + """ + '#/components/schemas/CreateListenerSerializer/properties/user_list' + "$.components.schemas.CreateListenerSerializer.properties.user_list" + """ + + +class LoggingRetentionPolicy(TypedDict, total=False): + period: Required[Optional[int]] + """ + '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' + "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" + """ + + +class Logging(TypedDict, total=False): + destination_region_id: Optional[int] + """ + '#/components/schemas/LoadbalancerLoggingSerializer/properties/destination_region_id/anyOf/0' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.destination_region_id.anyOf[0]" + """ + + enabled: bool + """ + '#/components/schemas/LoadbalancerLoggingSerializer/properties/enabled' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.enabled" + """ + + retention_policy: Optional[LoggingRetentionPolicy] + """ + '#/components/schemas/LoadbalancerLoggingSerializer/properties/retention_policy/anyOf/0' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.retention_policy.anyOf[0]" + """ + + topic_name: Optional[str] + """ + '#/components/schemas/LoadbalancerLoggingSerializer/properties/topic_name/anyOf/0' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.topic_name.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/load_balancer_failover_params.py b/src/gcore/types/cloud/load_balancer_failover_params.py new file mode 100644 index 00000000..082cc6bc --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_failover_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["LoadBalancerFailoverParams"] + + +class LoadBalancerFailoverParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[1].schema" + """ + + force: bool + """ + '#/components/schemas/FailoverLoadBalancer/properties/force' + "$.components.schemas.FailoverLoadBalancer.properties.force" + """ diff --git a/src/gcore/types/cloud/load_balancer_get_params.py b/src/gcore/types/cloud/load_balancer_get_params.py new file mode 100644 index 00000000..a1fbb78f --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_get_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["LoadBalancerGetParams"] + + +class LoadBalancerGetParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[1].schema" + """ + + show_stats: bool + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/3' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[3]" + """ + + with_ddos: bool + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/4' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[4]" + """ diff --git a/src/gcore/types/cloud/load_balancer_list_params.py b/src/gcore/types/cloud/load_balancer_list_params.py new file mode 100644 index 00000000..51ac0dca --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_list_params.py @@ -0,0 +1,81 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["LoadBalancerListParams"] + + +class LoadBalancerListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + assigned_floating: bool + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[2]" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[3]" + """ + + logging_enabled: bool + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[4]" + """ + + metadata_k: str + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[5]" + """ + + metadata_kv: str + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[6]" + """ + + name: str + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[7]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[8]" + """ + + order_by: str + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[9]" + """ + + show_stats: bool + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[10]" + """ + + with_ddos: bool + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[11]" + """ diff --git a/src/gcore/types/cloud/load_balancer_resize_params.py b/src/gcore/types/cloud/load_balancer_resize_params.py new file mode 100644 index 00000000..56d120ff --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_resize_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LoadBalancerResizeParams"] + + +class LoadBalancerResizeParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[1].schema" + """ + + flavor: Required[str] + """ + '#/components/schemas/ResizeLoadBalancer/properties/flavor' + "$.components.schemas.ResizeLoadBalancer.properties.flavor" + """ diff --git a/src/gcore/types/cloud/load_balancer_status.py b/src/gcore/types/cloud/load_balancer_status.py new file mode 100644 index 00000000..ab1ed403 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_status.py @@ -0,0 +1,55 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .tag import Tag +from ..._models import BaseModel +from .listener_status import ListenerStatus +from .provisioning_status import ProvisioningStatus +from .load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = ["LoadBalancerStatus"] + + +class LoadBalancerStatus(BaseModel): + id: str + """ + '#/components/schemas/LoadBalancerStatusSerializer/properties/id' + "$.components.schemas.LoadBalancerStatusSerializer.properties.id" + """ + + listeners: List[ListenerStatus] + """ + '#/components/schemas/LoadBalancerStatusSerializer/properties/listeners' + "$.components.schemas.LoadBalancerStatusSerializer.properties.listeners" + """ + + name: str + """ + '#/components/schemas/LoadBalancerStatusSerializer/properties/name' + "$.components.schemas.LoadBalancerStatusSerializer.properties.name" + """ + + operating_status: LoadBalancerOperatingStatus + """ + '#/components/schemas/LoadBalancerStatusSerializer/properties/operating_status' + "$.components.schemas.LoadBalancerStatusSerializer.properties.operating_status" + """ + + provisioning_status: ProvisioningStatus + """ + '#/components/schemas/LoadBalancerStatusSerializer/properties/provisioning_status' + "$.components.schemas.LoadBalancerStatusSerializer.properties.provisioning_status" + """ + + metadata: Optional[List[Tag]] = None + """ + '#/components/schemas/LoadBalancerStatusSerializer/properties/metadata' + "$.components.schemas.LoadBalancerStatusSerializer.properties.metadata" + """ + + tags: Optional[List[Tag]] = None + """ + '#/components/schemas/LoadBalancerStatusSerializer/properties/tags' + "$.components.schemas.LoadBalancerStatusSerializer.properties.tags" + """ diff --git a/src/gcore/types/cloud/load_balancer_status_list.py b/src/gcore/types/cloud/load_balancer_status_list.py new file mode 100644 index 00000000..bffb1b35 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_status_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .load_balancer_status import LoadBalancerStatus + +__all__ = ["LoadBalancerStatusList"] + + +class LoadBalancerStatusList(BaseModel): + count: int + """ + '#/components/schemas/LoadBalancerStatusSerializerList/properties/count' + "$.components.schemas.LoadBalancerStatusSerializerList.properties.count" + """ + + results: List[LoadBalancerStatus] + """ + '#/components/schemas/LoadBalancerStatusSerializerList/properties/results' + "$.components.schemas.LoadBalancerStatusSerializerList.properties.results" + """ diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py new file mode 100644 index 00000000..22333abb --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -0,0 +1,76 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity + +__all__ = ["LoadBalancerUpdateParams", "Logging", "LoggingRetentionPolicy"] + + +class LoadBalancerUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[1].schema" + """ + + logging: Logging + """ + '#/components/schemas/LoadBalancerPatchSerializer/properties/logging' + "$.components.schemas.LoadBalancerPatchSerializer.properties.logging" + """ + + name: str + """ + '#/components/schemas/LoadBalancerPatchSerializer/properties/name' + "$.components.schemas.LoadBalancerPatchSerializer.properties.name" + """ + + preferred_connectivity: LoadBalancerMemberConnectivity + """ + '#/components/schemas/LoadBalancerPatchSerializer/properties/preferred_connectivity' + "$.components.schemas.LoadBalancerPatchSerializer.properties.preferred_connectivity" + """ + + +class LoggingRetentionPolicy(TypedDict, total=False): + period: Required[Optional[int]] + """ + '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' + "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" + """ + + +class Logging(TypedDict, total=False): + destination_region_id: Optional[int] + """ + '#/components/schemas/LoadbalancerLoggingSerializer/properties/destination_region_id/anyOf/0' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.destination_region_id.anyOf[0]" + """ + + enabled: bool + """ + '#/components/schemas/LoadbalancerLoggingSerializer/properties/enabled' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.enabled" + """ + + retention_policy: Optional[LoggingRetentionPolicy] + """ + '#/components/schemas/LoadbalancerLoggingSerializer/properties/retention_policy/anyOf/0' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.retention_policy.anyOf[0]" + """ + + topic_name: Optional[str] + """ + '#/components/schemas/LoadbalancerLoggingSerializer/properties/topic_name/anyOf/0' + "$.components.schemas.LoadbalancerLoggingSerializer.properties.topic_name.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py new file mode 100644 index 00000000..433f966c --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .pool_list_params import PoolListParams as PoolListParams +from .flavor_list_params import FlavorListParams as FlavorListParams +from .metric_list_params import MetricListParams as MetricListParams +from .pool_create_params import PoolCreateParams as PoolCreateParams +from .pool_update_params import PoolUpdateParams as PoolUpdateParams +from .listener_get_params import ListenerGetParams as ListenerGetParams +from .listener_list_params import ListenerListParams as ListenerListParams +from .listener_create_params import ListenerCreateParams as ListenerCreateParams +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/flavor_list_params.py b/src/gcore/types/cloud/load_balancers/flavor_list_params.py new file mode 100644 index 00000000..33984f0e --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/flavor_list_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["FlavorListParams"] + + +class FlavorListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + include_prices: bool + """ + '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[2]" + """ diff --git a/src/gcore/types/cloud/load_balancers/l7_policies/__init__.py b/src/gcore/types/cloud/load_balancers/l7_policies/__init__.py new file mode 100644 index 00000000..832f1d77 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/l7_policies/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .rule_create_params import RuleCreateParams as RuleCreateParams +from .rule_replace_params import RuleReplaceParams as RuleReplaceParams 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 new file mode 100644 index 00000000..c2f153b5 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/l7_policies/rule_create_params.py @@ -0,0 +1,69 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["RuleCreateParams"] + + +class RuleCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[1].schema" + """ + + compare_type: Required[Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"]] + """ + '#/components/schemas/CreateL7RuleSchema/properties/compare_type' + "$.components.schemas.CreateL7RuleSchema.properties.compare_type" + """ + + type: Required[ + Literal[ + "COOKIE", + "FILE_TYPE", + "HEADER", + "HOST_NAME", + "PATH", + "SSL_CONN_HAS_CERT", + "SSL_DN_FIELD", + "SSL_VERIFY_RESULT", + ] + ] + """ + '#/components/schemas/CreateL7RuleSchema/properties/type' + "$.components.schemas.CreateL7RuleSchema.properties.type" + """ + + value: Required[str] + """ + '#/components/schemas/CreateL7RuleSchema/properties/value' + "$.components.schemas.CreateL7RuleSchema.properties.value" + """ + + invert: bool + """ + '#/components/schemas/CreateL7RuleSchema/properties/invert' + "$.components.schemas.CreateL7RuleSchema.properties.invert" + """ + + key: str + """ + '#/components/schemas/CreateL7RuleSchema/properties/key' + "$.components.schemas.CreateL7RuleSchema.properties.key" + """ + + tags: List[str] + """ + '#/components/schemas/CreateL7RuleSchema/properties/tags' + "$.components.schemas.CreateL7RuleSchema.properties.tags" + """ 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 new file mode 100644 index 00000000..f10f5f1c --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/l7_policies/rule_replace_params.py @@ -0,0 +1,66 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["RuleReplaceParams"] + + +class RuleReplaceParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[1].schema" + """ + + l7policy_id: Required[str] + """ + '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/2/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[2].schema" + """ + + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] + """ + '#/components/schemas/UpdateL7RuleSchema/properties/compare_type' + "$.components.schemas.UpdateL7RuleSchema.properties.compare_type" + """ + + invert: bool + """ + '#/components/schemas/UpdateL7RuleSchema/properties/invert' + "$.components.schemas.UpdateL7RuleSchema.properties.invert" + """ + + key: str + """ + '#/components/schemas/UpdateL7RuleSchema/properties/key' + "$.components.schemas.UpdateL7RuleSchema.properties.key" + """ + + tags: List[str] + """ + '#/components/schemas/UpdateL7RuleSchema/properties/tags' + "$.components.schemas.UpdateL7RuleSchema.properties.tags" + """ + + type: Literal[ + "COOKIE", "FILE_TYPE", "HEADER", "HOST_NAME", "PATH", "SSL_CONN_HAS_CERT", "SSL_DN_FIELD", "SSL_VERIFY_RESULT" + ] + """ + '#/components/schemas/UpdateL7RuleSchema/properties/type' + "$.components.schemas.UpdateL7RuleSchema.properties.type" + """ + + value: str + """ + '#/components/schemas/UpdateL7RuleSchema/properties/value' + "$.components.schemas.UpdateL7RuleSchema.properties.value" + """ diff --git a/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py b/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py new file mode 100644 index 00000000..200ae529 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py @@ -0,0 +1,76 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["L7PolicyCreateParams"] + + +class L7PolicyCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + action: Required[Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"]] + """ + '#/components/schemas/CreateL7PolicySchema/properties/action' + "$.components.schemas.CreateL7PolicySchema.properties.action" + """ + + listener_id: Required[str] + """ + '#/components/schemas/CreateL7PolicySchema/properties/listener_id' + "$.components.schemas.CreateL7PolicySchema.properties.listener_id" + """ + + name: str + """ + '#/components/schemas/CreateL7PolicySchema/properties/name' + "$.components.schemas.CreateL7PolicySchema.properties.name" + """ + + position: int + """ + '#/components/schemas/CreateL7PolicySchema/properties/position' + "$.components.schemas.CreateL7PolicySchema.properties.position" + """ + + redirect_http_code: int + """ + '#/components/schemas/CreateL7PolicySchema/properties/redirect_http_code' + "$.components.schemas.CreateL7PolicySchema.properties.redirect_http_code" + """ + + redirect_pool_id: str + """ + '#/components/schemas/CreateL7PolicySchema/properties/redirect_pool_id' + "$.components.schemas.CreateL7PolicySchema.properties.redirect_pool_id" + """ + + redirect_prefix: str + """ + '#/components/schemas/CreateL7PolicySchema/properties/redirect_prefix' + "$.components.schemas.CreateL7PolicySchema.properties.redirect_prefix" + """ + + redirect_url: str + """ + '#/components/schemas/CreateL7PolicySchema/properties/redirect_url' + "$.components.schemas.CreateL7PolicySchema.properties.redirect_url" + """ + + tags: List[str] + """ + '#/components/schemas/CreateL7PolicySchema/properties/tags' + "$.components.schemas.CreateL7PolicySchema.properties.tags" + """ 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 new file mode 100644 index 00000000..2e7d436a --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py @@ -0,0 +1,70 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["L7PolicyReplaceParams"] + + +class L7PolicyReplaceParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/0/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/1/schema' + "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[1].schema" + """ + + action: Required[Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"]] + """ + '#/components/schemas/UpdateL7PolicySchema/properties/action' + "$.components.schemas.UpdateL7PolicySchema.properties.action" + """ + + name: str + """ + '#/components/schemas/UpdateL7PolicySchema/properties/name' + "$.components.schemas.UpdateL7PolicySchema.properties.name" + """ + + position: int + """ + '#/components/schemas/UpdateL7PolicySchema/properties/position' + "$.components.schemas.UpdateL7PolicySchema.properties.position" + """ + + redirect_http_code: int + """ + '#/components/schemas/UpdateL7PolicySchema/properties/redirect_http_code' + "$.components.schemas.UpdateL7PolicySchema.properties.redirect_http_code" + """ + + redirect_pool_id: str + """ + '#/components/schemas/UpdateL7PolicySchema/properties/redirect_pool_id' + "$.components.schemas.UpdateL7PolicySchema.properties.redirect_pool_id" + """ + + redirect_prefix: str + """ + '#/components/schemas/UpdateL7PolicySchema/properties/redirect_prefix' + "$.components.schemas.UpdateL7PolicySchema.properties.redirect_prefix" + """ + + redirect_url: str + """ + '#/components/schemas/UpdateL7PolicySchema/properties/redirect_url' + "$.components.schemas.UpdateL7PolicySchema.properties.redirect_url" + """ + + tags: List[str] + """ + '#/components/schemas/UpdateL7PolicySchema/properties/tags' + "$.components.schemas.UpdateL7PolicySchema.properties.tags" + """ diff --git a/src/gcore/types/cloud/load_balancers/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py new file mode 100644 index 00000000..fbec7d1f --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -0,0 +1,116 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional +from typing_extensions import Required, TypedDict + +from ..lb_listener_protocol import LbListenerProtocol + +__all__ = ["ListenerCreateParams", "UserList"] + + +class ListenerCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + loadbalancer_id: Required[str] + """ + '#/components/schemas/CreateLbListenerSerializer/properties/loadbalancer_id' + "$.components.schemas.CreateLbListenerSerializer.properties.loadbalancer_id" + """ + + name: Required[str] + """ + '#/components/schemas/CreateLbListenerSerializer/properties/name' + "$.components.schemas.CreateLbListenerSerializer.properties.name" + """ + + protocol: Required[LbListenerProtocol] + """ + '#/components/schemas/CreateLbListenerSerializer/properties/protocol' + "$.components.schemas.CreateLbListenerSerializer.properties.protocol" + """ + + protocol_port: Required[int] + """ + '#/components/schemas/CreateLbListenerSerializer/properties/protocol_port' + "$.components.schemas.CreateLbListenerSerializer.properties.protocol_port" + """ + + allowed_cidrs: Optional[List[str]] + """ + '#/components/schemas/CreateLbListenerSerializer/properties/allowed_cidrs/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.allowed_cidrs.anyOf[0]" + """ + + connection_limit: int + """ + '#/components/schemas/CreateLbListenerSerializer/properties/connection_limit' + "$.components.schemas.CreateLbListenerSerializer.properties.connection_limit" + """ + + insert_x_forwarded: bool + """ + '#/components/schemas/CreateLbListenerSerializer/properties/insert_x_forwarded' + "$.components.schemas.CreateLbListenerSerializer.properties.insert_x_forwarded" + """ + + secret_id: str + """ + '#/components/schemas/CreateLbListenerSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.secret_id.anyOf[0]" + """ + + sni_secret_id: List[str] + """ + '#/components/schemas/CreateLbListenerSerializer/properties/sni_secret_id' + "$.components.schemas.CreateLbListenerSerializer.properties.sni_secret_id" + """ + + timeout_client_data: Optional[int] + """ + '#/components/schemas/CreateLbListenerSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.timeout_client_data.anyOf[0]" + """ + + timeout_member_connect: Optional[int] + """ + '#/components/schemas/CreateLbListenerSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.timeout_member_connect.anyOf[0]" + """ + + timeout_member_data: Optional[int] + """ + '#/components/schemas/CreateLbListenerSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.CreateLbListenerSerializer.properties.timeout_member_data.anyOf[0]" + """ + + user_list: Iterable[UserList] + """ + '#/components/schemas/CreateLbListenerSerializer/properties/user_list' + "$.components.schemas.CreateLbListenerSerializer.properties.user_list" + """ + + +class UserList(TypedDict, total=False): + encrypted_password: Required[str] + """ + '#/components/schemas/UserListItem/properties/encrypted_password' + "$.components.schemas.UserListItem.properties.encrypted_password" + """ + + username: Required[str] + """ + '#/components/schemas/UserListItem/properties/username' + "$.components.schemas.UserListItem.properties.username" + """ diff --git a/src/gcore/types/cloud/load_balancers/listener_get_params.py b/src/gcore/types/cloud/load_balancers/listener_get_params.py new file mode 100644 index 00000000..0e6f88e6 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/listener_get_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ListenerGetParams"] + + +class ListenerGetParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[1].schema" + """ + + show_stats: bool + """ + '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/3' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[3]" + """ diff --git a/src/gcore/types/cloud/load_balancers/listener_list_params.py b/src/gcore/types/cloud/load_balancers/listener_list_params.py new file mode 100644 index 00000000..7b4dfa8e --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/listener_list_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ListenerListParams"] + + +class ListenerListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + loadbalancer_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[2]" + """ + + show_stats: bool + """ + '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[3]" + """ diff --git a/src/gcore/types/cloud/load_balancers/listener_update_params.py b/src/gcore/types/cloud/load_balancers/listener_update_params.py new file mode 100644 index 00000000..3af906be --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/listener_update_params.py @@ -0,0 +1,90 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["ListenerUpdateParams", "UserList"] + + +class ListenerUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[1].schema" + """ + + allowed_cidrs: Optional[List[str]] + """ + '#/components/schemas/PatchLbListenerSerializer/properties/allowed_cidrs/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.allowed_cidrs.anyOf[0]" + """ + + connection_limit: int + """ + '#/components/schemas/PatchLbListenerSerializer/properties/connection_limit' + "$.components.schemas.PatchLbListenerSerializer.properties.connection_limit" + """ + + name: str + """ + '#/components/schemas/PatchLbListenerSerializer/properties/name' + "$.components.schemas.PatchLbListenerSerializer.properties.name" + """ + + secret_id: Optional[str] + """ + '#/components/schemas/PatchLbListenerSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.secret_id.anyOf[0]" + """ + + sni_secret_id: Optional[List[str]] + """ + '#/components/schemas/PatchLbListenerSerializer/properties/sni_secret_id/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.sni_secret_id.anyOf[0]" + """ + + timeout_client_data: Optional[int] + """ + '#/components/schemas/PatchLbListenerSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.timeout_client_data.anyOf[0]" + """ + + timeout_member_connect: Optional[int] + """ + '#/components/schemas/PatchLbListenerSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.timeout_member_connect.anyOf[0]" + """ + + timeout_member_data: Optional[int] + """ + '#/components/schemas/PatchLbListenerSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.timeout_member_data.anyOf[0]" + """ + + user_list: Optional[Iterable[UserList]] + """ + '#/components/schemas/PatchLbListenerSerializer/properties/user_list/anyOf/0' + "$.components.schemas.PatchLbListenerSerializer.properties.user_list.anyOf[0]" + """ + + +class UserList(TypedDict, total=False): + encrypted_password: Required[str] + """ + '#/components/schemas/UserListItem/properties/encrypted_password' + "$.components.schemas.UserListItem.properties.encrypted_password" + """ + + username: Required[str] + """ + '#/components/schemas/UserListItem/properties/username' + "$.components.schemas.UserListItem.properties.username" + """ diff --git a/src/gcore/types/cloud/load_balancers/metric_list_params.py b/src/gcore/types/cloud/load_balancers/metric_list_params.py new file mode 100644 index 00000000..1ac365c8 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/metric_list_params.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ..instance_metrics_time_unit import InstanceMetricsTimeUnit + +__all__ = ["MetricListParams"] + + +class MetricListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/0/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/1/schema' + "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[1].schema" + """ + + time_interval: Required[int] + """ + '#/components/schemas/LoadbalancerMetricsRequestSerializer/properties/time_interval' + "$.components.schemas.LoadbalancerMetricsRequestSerializer.properties.time_interval" + """ + + time_unit: Required[InstanceMetricsTimeUnit] + """ + '#/components/schemas/LoadbalancerMetricsRequestSerializer/properties/time_unit' + "$.components.schemas.LoadbalancerMetricsRequestSerializer.properties.time_unit" + """ diff --git a/src/gcore/types/cloud/load_balancers/pool_create_params.py b/src/gcore/types/cloud/load_balancers/pool_create_params.py new file mode 100644 index 00000000..e5637629 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -0,0 +1,238 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict + +from ..http_method import HTTPMethod +from ..lb_algorithm import LbAlgorithm +from ..lb_pool_protocol import LbPoolProtocol +from ..health_monitor_type import HealthMonitorType +from ..session_persistence_type import SessionPersistenceType + +__all__ = ["PoolCreateParams", "Healthmonitor", "Member", "SessionPersistence"] + + +class PoolCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + lb_algorithm: Required[LbAlgorithm] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/lb_algorithm' + "$.components.schemas.CreateLbPoolSerializer.properties.lb_algorithm" + """ + + name: Required[str] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/name' + "$.components.schemas.CreateLbPoolSerializer.properties.name" + """ + + protocol: Required[LbPoolProtocol] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/protocol' + "$.components.schemas.CreateLbPoolSerializer.properties.protocol" + """ + + ca_secret_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/ca_secret_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.ca_secret_id.anyOf[0]" + """ + + crl_secret_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/crl_secret_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.crl_secret_id.anyOf[0]" + """ + + healthmonitor: Optional[Healthmonitor] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/healthmonitor/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.healthmonitor.anyOf[0]" + """ + + listener_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/listener_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.listener_id.anyOf[0]" + """ + + loadbalancer_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/loadbalancer_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.loadbalancer_id.anyOf[0]" + """ + + members: Optional[Iterable[Member]] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/members/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.members.anyOf[0]" + """ + + secret_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.secret_id.anyOf[0]" + """ + + session_persistence: Optional[SessionPersistence] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/session_persistence/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.session_persistence.anyOf[0]" + """ + + timeout_client_data: Optional[int] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.timeout_client_data.anyOf[0]" + """ + + timeout_member_connect: Optional[int] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" + """ + + timeout_member_data: Optional[int] + """ + '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_data.anyOf[0]" + """ + + +class Healthmonitor(TypedDict, total=False): + delay: Required[int] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/delay' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.delay" + """ + + max_retries: Required[int] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries" + """ + + timeout: Required[int] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/timeout' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.timeout" + """ + + type: Required[HealthMonitorType] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/type' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.type" + """ + + expected_codes: Optional[str] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/expected_codes/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" + """ + + http_method: Optional[HTTPMethod] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/http_method/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.http_method.anyOf[0]" + """ + + max_retries_down: Optional[int] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries_down/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries_down.anyOf[0]" + """ + + url_path: Optional[str] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/url_path/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.url_path.anyOf[0]" + """ + + +class Member(TypedDict, total=False): + address: Required[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/address' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.address" + """ + + protocol_port: Required[int] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/protocol_port' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.protocol_port" + """ + + admin_state_up: Optional[bool] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/admin_state_up/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.admin_state_up.anyOf[0]" + """ + + instance_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/instance_id/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.instance_id.anyOf[0]" + """ + + monitor_address: Optional[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_address/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" + """ + + monitor_port: Optional[int] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_port/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" + """ + + subnet_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/subnet_id/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" + """ + + weight: Optional[int] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/weight/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.weight.anyOf[0]" + """ + + +class SessionPersistence(TypedDict, total=False): + type: Required[SessionPersistenceType] + """ + '#/components/schemas/MutateLbSessionPersistence/properties/type' + "$.components.schemas.MutateLbSessionPersistence.properties.type" + """ + + cookie_name: Optional[str] + """ + '#/components/schemas/MutateLbSessionPersistence/properties/cookie_name/anyOf/0' + "$.components.schemas.MutateLbSessionPersistence.properties.cookie_name.anyOf[0]" + """ + + persistence_granularity: Optional[str] + """ + '#/components/schemas/MutateLbSessionPersistence/properties/persistence_granularity/anyOf/0' + "$.components.schemas.MutateLbSessionPersistence.properties.persistence_granularity.anyOf[0]" + """ + + persistence_timeout: Optional[int] + """ + '#/components/schemas/MutateLbSessionPersistence/properties/persistence_timeout/anyOf/0' + "$.components.schemas.MutateLbSessionPersistence.properties.persistence_timeout.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/load_balancers/pool_list_params.py b/src/gcore/types/cloud/load_balancers/pool_list_params.py new file mode 100644 index 00000000..fedd5626 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/pool_list_params.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["PoolListParams"] + + +class PoolListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + details: bool + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[2]" + """ + + listener_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[3]" + """ + + loadbalancer_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[4]" + """ diff --git a/src/gcore/types/cloud/load_balancers/pool_update_params.py b/src/gcore/types/cloud/load_balancers/pool_update_params.py new file mode 100644 index 00000000..c87090b8 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/pool_update_params.py @@ -0,0 +1,226 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict + +from ..http_method import HTTPMethod +from ..lb_algorithm import LbAlgorithm +from ..lb_pool_protocol import LbPoolProtocol +from ..health_monitor_type import HealthMonitorType +from ..session_persistence_type import SessionPersistenceType + +__all__ = ["PoolUpdateParams", "Healthmonitor", "Member", "SessionPersistence"] + + +class PoolUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[1].schema" + """ + + ca_secret_id: Optional[str] + """ + '#/components/schemas/PatchLbPoolSerializer/properties/ca_secret_id/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.ca_secret_id.anyOf[0]" + """ + + crl_secret_id: Optional[str] + """ + '#/components/schemas/PatchLbPoolSerializer/properties/crl_secret_id/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.crl_secret_id.anyOf[0]" + """ + + healthmonitor: Optional[Healthmonitor] + """ + '#/components/schemas/PatchLbPoolSerializer/properties/healthmonitor/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.healthmonitor.anyOf[0]" + """ + + lb_algorithm: LbAlgorithm + """ + '#/components/schemas/PatchLbPoolSerializer/properties/lb_algorithm' + "$.components.schemas.PatchLbPoolSerializer.properties.lb_algorithm" + """ + + members: Optional[Iterable[Member]] + """ + '#/components/schemas/PatchLbPoolSerializer/properties/members/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.members.anyOf[0]" + """ + + name: str + """ + '#/components/schemas/PatchLbPoolSerializer/properties/name' + "$.components.schemas.PatchLbPoolSerializer.properties.name" + """ + + protocol: LbPoolProtocol + """ + '#/components/schemas/PatchLbPoolSerializer/properties/protocol' + "$.components.schemas.PatchLbPoolSerializer.properties.protocol" + """ + + secret_id: Optional[str] + """ + '#/components/schemas/PatchLbPoolSerializer/properties/secret_id/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.secret_id.anyOf[0]" + """ + + session_persistence: Optional[SessionPersistence] + """ + '#/components/schemas/PatchLbPoolSerializer/properties/session_persistence/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.session_persistence.anyOf[0]" + """ + + timeout_client_data: Optional[int] + """ + '#/components/schemas/PatchLbPoolSerializer/properties/timeout_client_data/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.timeout_client_data.anyOf[0]" + """ + + timeout_member_connect: Optional[int] + """ + '#/components/schemas/PatchLbPoolSerializer/properties/timeout_member_connect/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" + """ + + timeout_member_data: Optional[int] + """ + '#/components/schemas/PatchLbPoolSerializer/properties/timeout_member_data/anyOf/0' + "$.components.schemas.PatchLbPoolSerializer.properties.timeout_member_data.anyOf[0]" + """ + + +class Healthmonitor(TypedDict, total=False): + delay: Required[int] + """ + '#/components/schemas/PatchLbHealthMonitorSerializer/properties/delay' + "$.components.schemas.PatchLbHealthMonitorSerializer.properties.delay" + """ + + max_retries: Required[int] + """ + '#/components/schemas/PatchLbHealthMonitorSerializer/properties/max_retries' + "$.components.schemas.PatchLbHealthMonitorSerializer.properties.max_retries" + """ + + timeout: Required[int] + """ + '#/components/schemas/PatchLbHealthMonitorSerializer/properties/timeout' + "$.components.schemas.PatchLbHealthMonitorSerializer.properties.timeout" + """ + + expected_codes: Optional[str] + """ + '#/components/schemas/PatchLbHealthMonitorSerializer/properties/expected_codes/anyOf/0' + "$.components.schemas.PatchLbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" + """ + + http_method: Optional[HTTPMethod] + """ + '#/components/schemas/PatchLbHealthMonitorSerializer/properties/http_method/anyOf/0' + "$.components.schemas.PatchLbHealthMonitorSerializer.properties.http_method.anyOf[0]" + """ + + max_retries_down: Optional[int] + """ + '#/components/schemas/PatchLbHealthMonitorSerializer/properties/max_retries_down/anyOf/0' + "$.components.schemas.PatchLbHealthMonitorSerializer.properties.max_retries_down.anyOf[0]" + """ + + type: Optional[HealthMonitorType] + """ + '#/components/schemas/PatchLbHealthMonitorSerializer/properties/type/anyOf/0' + "$.components.schemas.PatchLbHealthMonitorSerializer.properties.type.anyOf[0]" + """ + + url_path: Optional[str] + """ + '#/components/schemas/PatchLbHealthMonitorSerializer/properties/url_path/anyOf/0' + "$.components.schemas.PatchLbHealthMonitorSerializer.properties.url_path.anyOf[0]" + """ + + +class Member(TypedDict, total=False): + address: Required[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/address' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.address" + """ + + protocol_port: Required[int] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/protocol_port' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.protocol_port" + """ + + admin_state_up: Optional[bool] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/admin_state_up/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.admin_state_up.anyOf[0]" + """ + + instance_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/instance_id/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.instance_id.anyOf[0]" + """ + + monitor_address: Optional[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_address/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" + """ + + monitor_port: Optional[int] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_port/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" + """ + + subnet_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/subnet_id/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" + """ + + weight: Optional[int] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/weight/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.weight.anyOf[0]" + """ + + +class SessionPersistence(TypedDict, total=False): + type: Required[SessionPersistenceType] + """ + '#/components/schemas/MutateLbSessionPersistence/properties/type' + "$.components.schemas.MutateLbSessionPersistence.properties.type" + """ + + cookie_name: Optional[str] + """ + '#/components/schemas/MutateLbSessionPersistence/properties/cookie_name/anyOf/0' + "$.components.schemas.MutateLbSessionPersistence.properties.cookie_name.anyOf[0]" + """ + + persistence_granularity: Optional[str] + """ + '#/components/schemas/MutateLbSessionPersistence/properties/persistence_granularity/anyOf/0' + "$.components.schemas.MutateLbSessionPersistence.properties.persistence_granularity.anyOf[0]" + """ + + persistence_timeout: Optional[int] + """ + '#/components/schemas/MutateLbSessionPersistence/properties/persistence_timeout/anyOf/0' + "$.components.schemas.MutateLbSessionPersistence.properties.persistence_timeout.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/load_balancers/pools/__init__.py b/src/gcore/types/cloud/load_balancers/pools/__init__.py new file mode 100644 index 00000000..0b6f1f5d --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/pools/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .member_add_params import MemberAddParams as MemberAddParams +from .health_monitor_create_params import HealthMonitorCreateParams as HealthMonitorCreateParams diff --git a/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py b/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py new file mode 100644 index 00000000..5e2edbc5 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, Annotated, TypedDict + +from ....._utils import PropertyInfo +from ...http_method import HTTPMethod +from ...health_monitor_type import HealthMonitorType + +__all__ = ["HealthMonitorCreateParams"] + + +class HealthMonitorCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[1].schema" + """ + + delay: Required[int] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/delay' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.delay" + """ + + max_retries: Required[int] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries" + """ + + api_timeout: Required[Annotated[int, PropertyInfo(alias="timeout")]] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/timeout' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.timeout" + """ + + type: Required[HealthMonitorType] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/type' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.type" + """ + + expected_codes: Optional[str] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/expected_codes/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" + """ + + http_method: Optional[HTTPMethod] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/http_method/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.http_method.anyOf[0]" + """ + + max_retries_down: Optional[int] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries_down/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries_down.anyOf[0]" + """ + + url_path: Optional[str] + """ + '#/components/schemas/CreateLbHealthMonitorSerializer/properties/url_path/anyOf/0' + "$.components.schemas.CreateLbHealthMonitorSerializer.properties.url_path.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py new file mode 100644 index 00000000..11578aab --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py @@ -0,0 +1,70 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +__all__ = ["MemberAddParams"] + + +class MemberAddParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/0/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/1/schema' + "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[1].schema" + """ + + address: Required[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/address' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.address" + """ + + protocol_port: Required[int] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/protocol_port' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.protocol_port" + """ + + admin_state_up: Optional[bool] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/admin_state_up/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.admin_state_up.anyOf[0]" + """ + + instance_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/instance_id/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.instance_id.anyOf[0]" + """ + + monitor_address: Optional[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_address/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" + """ + + monitor_port: Optional[int] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_port/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" + """ + + subnet_id: Optional[str] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/subnet_id/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" + """ + + weight: Optional[int] + """ + '#/components/schemas/CreateLbPoolMemberSerializer/properties/weight/anyOf/0' + "$.components.schemas.CreateLbPoolMemberSerializer.properties.weight.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/loadbalancer_metrics.py b/src/gcore/types/cloud/loadbalancer_metrics.py new file mode 100644 index 00000000..5128c352 --- /dev/null +++ b/src/gcore/types/cloud/loadbalancer_metrics.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["LoadbalancerMetrics"] + + +class LoadbalancerMetrics(BaseModel): + cpu_util: Optional[float] = None + """ + '#/components/schemas/LoadbalancerMetricsSerializer/properties/cpu_util/anyOf/0' + "$.components.schemas.LoadbalancerMetricsSerializer.properties.cpu_util.anyOf[0]" + """ + + memory_util: Optional[float] = None + """ + '#/components/schemas/LoadbalancerMetricsSerializer/properties/memory_util/anyOf/0' + "$.components.schemas.LoadbalancerMetricsSerializer.properties.memory_util.anyOf[0]" + """ + + network_bps_egress: Optional[float] = FieldInfo(alias="network_Bps_egress", default=None) + """ + '#/components/schemas/LoadbalancerMetricsSerializer/properties/network_Bps_egress/anyOf/0' + "$.components.schemas.LoadbalancerMetricsSerializer.properties.network_Bps_egress.anyOf[0]" + """ + + network_bps_ingress: Optional[float] = FieldInfo(alias="network_Bps_ingress", default=None) + """ + '#/components/schemas/LoadbalancerMetricsSerializer/properties/network_Bps_ingress/anyOf/0' + "$.components.schemas.LoadbalancerMetricsSerializer.properties.network_Bps_ingress.anyOf[0]" + """ + + network_pps_egress: Optional[float] = None + """ + '#/components/schemas/LoadbalancerMetricsSerializer/properties/network_pps_egress/anyOf/0' + "$.components.schemas.LoadbalancerMetricsSerializer.properties.network_pps_egress.anyOf[0]" + """ + + network_pps_ingress: Optional[float] = None + """ + '#/components/schemas/LoadbalancerMetricsSerializer/properties/network_pps_ingress/anyOf/0' + "$.components.schemas.LoadbalancerMetricsSerializer.properties.network_pps_ingress.anyOf[0]" + """ + + time: Optional[str] = None + """ + '#/components/schemas/LoadbalancerMetricsSerializer/properties/time/anyOf/0' + "$.components.schemas.LoadbalancerMetricsSerializer.properties.time.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/loadbalancer_metrics_list.py b/src/gcore/types/cloud/loadbalancer_metrics_list.py new file mode 100644 index 00000000..c4ea5074 --- /dev/null +++ b/src/gcore/types/cloud/loadbalancer_metrics_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .loadbalancer_metrics import LoadbalancerMetrics + +__all__ = ["LoadbalancerMetricsList"] + + +class LoadbalancerMetricsList(BaseModel): + count: int + """ + '#/components/schemas/LoadbalancerMetricsSerializerList/properties/count' + "$.components.schemas.LoadbalancerMetricsSerializerList.properties.count" + """ + + results: List[LoadbalancerMetrics] + """ + '#/components/schemas/LoadbalancerMetricsSerializerList/properties/results' + "$.components.schemas.LoadbalancerMetricsSerializerList.properties.results" + """ diff --git a/src/gcore/types/cloud/member_status.py b/src/gcore/types/cloud/member_status.py new file mode 100644 index 00000000..a0b1f5dd --- /dev/null +++ b/src/gcore/types/cloud/member_status.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from .provisioning_status import ProvisioningStatus +from .load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = ["MemberStatus"] + + +class MemberStatus(BaseModel): + id: str + """ + '#/components/schemas/MemberStatusSerializer/properties/id' + "$.components.schemas.MemberStatusSerializer.properties.id" + """ + + address: str + """ + '#/components/schemas/MemberStatusSerializer/properties/address' + "$.components.schemas.MemberStatusSerializer.properties.address" + """ + + operating_status: LoadBalancerOperatingStatus + """ + '#/components/schemas/MemberStatusSerializer/properties/operating_status' + "$.components.schemas.MemberStatusSerializer.properties.operating_status" + """ + + protocol_port: int + """ + '#/components/schemas/MemberStatusSerializer/properties/protocol_port' + "$.components.schemas.MemberStatusSerializer.properties.protocol_port" + """ + + provisioning_status: ProvisioningStatus + """ + '#/components/schemas/MemberStatusSerializer/properties/provisioning_status' + "$.components.schemas.MemberStatusSerializer.properties.provisioning_status" + """ diff --git a/src/gcore/types/cloud/pool_status.py b/src/gcore/types/cloud/pool_status.py new file mode 100644 index 00000000..5e8e44fa --- /dev/null +++ b/src/gcore/types/cloud/pool_status.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .member_status import MemberStatus +from .provisioning_status import ProvisioningStatus +from .health_monitor_status import HealthMonitorStatus +from .load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = ["PoolStatus"] + + +class PoolStatus(BaseModel): + id: str + """ + '#/components/schemas/PoolStatusSerializer/properties/id' + "$.components.schemas.PoolStatusSerializer.properties.id" + """ + + members: List[MemberStatus] + """ + '#/components/schemas/PoolStatusSerializer/properties/members' + "$.components.schemas.PoolStatusSerializer.properties.members" + """ + + name: str + """ + '#/components/schemas/PoolStatusSerializer/properties/name' + "$.components.schemas.PoolStatusSerializer.properties.name" + """ + + operating_status: LoadBalancerOperatingStatus + """ + '#/components/schemas/PoolStatusSerializer/properties/operating_status' + "$.components.schemas.PoolStatusSerializer.properties.operating_status" + """ + + provisioning_status: ProvisioningStatus + """ + '#/components/schemas/PoolStatusSerializer/properties/provisioning_status' + "$.components.schemas.PoolStatusSerializer.properties.provisioning_status" + """ + + health_monitor: Optional[HealthMonitorStatus] = None + """ + '#/components/schemas/PoolStatusSerializer/properties/health_monitor' + "$.components.schemas.PoolStatusSerializer.properties.health_monitor" + """ diff --git a/src/gcore/types/cloud/session_persistence_type.py b/src/gcore/types/cloud/session_persistence_type.py new file mode 100644 index 00000000..7c4dd233 --- /dev/null +++ b/src/gcore/types/cloud/session_persistence_type.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["SessionPersistenceType"] + +SessionPersistenceType: TypeAlias = Literal["APP_COOKIE", "HTTP_COOKIE", "SOURCE_IP"] diff --git a/tests/api_resources/cloud/load_balancers/__init__.py b/tests/api_resources/cloud/load_balancers/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/load_balancers/l7_policies/__init__.py b/tests/api_resources/cloud/load_balancers/l7_policies/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/l7_policies/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/load_balancers/l7_policies/test_rules.py b/tests/api_resources/cloud/load_balancers/l7_policies/test_rules.py new file mode 100644 index 00000000..d82ba4c0 --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/l7_policies/test_rules.py @@ -0,0 +1,640 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import L7Rule, L7RuleList, TaskIDList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRules: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + rule = client.cloud.load_balancers.l7_policies.rules.create( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + compare_type="REGEX", + type="PATH", + value="/images*", + ) + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + rule = client.cloud.load_balancers.l7_policies.rules.create( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + compare_type="REGEX", + type="PATH", + value="/images*", + invert=False, + key="key", + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.rules.with_raw_response.create( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + compare_type="REGEX", + type="PATH", + value="/images*", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.rules.with_streaming_response.create( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + compare_type="REGEX", + type="PATH", + value="/images*", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(TaskIDList, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(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.rules.with_raw_response.create( + l7policy_id="", + project_id=0, + region_id=0, + compare_type="REGEX", + type="PATH", + value="/images*", + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + rule = client.cloud.load_balancers.l7_policies.rules.list( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) + assert_matches_type(L7RuleList, rule, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.rules.with_raw_response.list( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(L7RuleList, rule, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.rules.with_streaming_response.list( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(L7RuleList, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(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.rules.with_raw_response.list( + l7policy_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + rule = client.cloud.load_balancers.l7_policies.rules.delete( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.rules.with_raw_response.delete( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.rules.with_streaming_response.delete( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(TaskIDList, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + client.cloud.load_balancers.l7_policies.rules.with_raw_response.delete( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7rule_id` but received ''"): + client.cloud.load_balancers.l7_policies.rules.with_raw_response.delete( + l7rule_id="", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + rule = client.cloud.load_balancers.l7_policies.rules.get( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + assert_matches_type(L7Rule, rule, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.rules.with_raw_response.get( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(L7Rule, rule, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.rules.with_streaming_response.get( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(L7Rule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + client.cloud.load_balancers.l7_policies.rules.with_raw_response.get( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7rule_id` but received ''"): + client.cloud.load_balancers.l7_policies.rules.with_raw_response.get( + l7rule_id="", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + rule = client.cloud.load_balancers.l7_policies.rules.replace( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + rule = client.cloud.load_balancers.l7_policies.rules.replace( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + compare_type="CONTAINS", + invert=True, + key="key", + tags=["string"], + type="COOKIE", + value="value", + ) + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.rules.with_raw_response.replace( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.rules.with_streaming_response.replace( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(TaskIDList, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_replace(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.rules.with_raw_response.replace( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7rule_id` but received ''"): + client.cloud.load_balancers.l7_policies.rules.with_raw_response.replace( + l7rule_id="", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + + +class TestAsyncRules: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + rule = await async_client.cloud.load_balancers.l7_policies.rules.create( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + compare_type="REGEX", + type="PATH", + value="/images*", + ) + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + rule = await async_client.cloud.load_balancers.l7_policies.rules.create( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + compare_type="REGEX", + type="PATH", + value="/images*", + invert=False, + key="key", + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.create( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + compare_type="REGEX", + type="PATH", + value="/images*", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.rules.with_streaming_response.create( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + compare_type="REGEX", + type="PATH", + value="/images*", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(TaskIDList, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(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.rules.with_raw_response.create( + l7policy_id="", + project_id=0, + region_id=0, + compare_type="REGEX", + type="PATH", + value="/images*", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + rule = await async_client.cloud.load_balancers.l7_policies.rules.list( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) + assert_matches_type(L7RuleList, rule, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.list( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(L7RuleList, rule, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.rules.with_streaming_response.list( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(L7RuleList, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(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.rules.with_raw_response.list( + l7policy_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + rule = await async_client.cloud.load_balancers.l7_policies.rules.delete( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.delete( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.rules.with_streaming_response.delete( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(TaskIDList, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.delete( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7rule_id` but received ''"): + await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.delete( + l7rule_id="", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + rule = await async_client.cloud.load_balancers.l7_policies.rules.get( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + assert_matches_type(L7Rule, rule, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.get( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(L7Rule, rule, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.rules.with_streaming_response.get( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(L7Rule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.get( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7rule_id` but received ''"): + await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.get( + l7rule_id="", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + rule = await async_client.cloud.load_balancers.l7_policies.rules.replace( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + rule = await async_client.cloud.load_balancers.l7_policies.rules.replace( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + compare_type="CONTAINS", + invert=True, + key="key", + tags=["string"], + type="COOKIE", + value="value", + ) + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.replace( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(TaskIDList, rule, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.rules.with_streaming_response.replace( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(TaskIDList, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_replace(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.rules.with_raw_response.replace( + l7rule_id="l7rule_id", + project_id=0, + region_id=0, + l7policy_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7rule_id` but received ''"): + await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.replace( + l7rule_id="", + project_id=0, + region_id=0, + l7policy_id="l7policy_id", + ) diff --git a/tests/api_resources/cloud/load_balancers/pools/__init__.py b/tests/api_resources/cloud/load_balancers/pools/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/pools/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py b/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py new file mode 100644 index 00000000..9a3acf5f --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py @@ -0,0 +1,272 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import TaskIDList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestHealthMonitors: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + health_monitor = client.cloud.load_balancers.pools.health_monitors.create( + pool_id="pool_id", + project_id=0, + region_id=0, + delay=10, + max_retries=2, + api_timeout=5, + type="HTTP", + ) + assert_matches_type(TaskIDList, health_monitor, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + health_monitor = client.cloud.load_balancers.pools.health_monitors.create( + pool_id="pool_id", + project_id=0, + region_id=0, + delay=10, + max_retries=2, + api_timeout=5, + type="HTTP", + expected_codes="200,301,302", + http_method="CONNECT", + max_retries_down=2, + url_path="/", + ) + assert_matches_type(TaskIDList, health_monitor, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.load_balancers.pools.health_monitors.with_raw_response.create( + pool_id="pool_id", + project_id=0, + region_id=0, + delay=10, + max_retries=2, + api_timeout=5, + type="HTTP", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + health_monitor = response.parse() + assert_matches_type(TaskIDList, health_monitor, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.load_balancers.pools.health_monitors.with_streaming_response.create( + pool_id="pool_id", + project_id=0, + region_id=0, + delay=10, + max_retries=2, + api_timeout=5, + type="HTTP", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + health_monitor = response.parse() + assert_matches_type(TaskIDList, health_monitor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + 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.health_monitors.with_raw_response.create( + pool_id="", + project_id=0, + region_id=0, + delay=10, + max_retries=2, + api_timeout=5, + type="HTTP", + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + health_monitor = client.cloud.load_balancers.pools.health_monitors.delete( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + assert health_monitor is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.load_balancers.pools.health_monitors.with_raw_response.delete( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + health_monitor = response.parse() + assert health_monitor is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.load_balancers.pools.health_monitors.with_streaming_response.delete( + pool_id="pool_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + health_monitor = response.parse() + assert health_monitor is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): + client.cloud.load_balancers.pools.health_monitors.with_raw_response.delete( + pool_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncHealthMonitors: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + health_monitor = await async_client.cloud.load_balancers.pools.health_monitors.create( + pool_id="pool_id", + project_id=0, + region_id=0, + delay=10, + max_retries=2, + api_timeout=5, + type="HTTP", + ) + assert_matches_type(TaskIDList, health_monitor, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + health_monitor = await async_client.cloud.load_balancers.pools.health_monitors.create( + pool_id="pool_id", + project_id=0, + region_id=0, + delay=10, + max_retries=2, + api_timeout=5, + type="HTTP", + expected_codes="200,301,302", + http_method="CONNECT", + max_retries_down=2, + url_path="/", + ) + assert_matches_type(TaskIDList, health_monitor, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.pools.health_monitors.with_raw_response.create( + pool_id="pool_id", + project_id=0, + region_id=0, + delay=10, + max_retries=2, + api_timeout=5, + type="HTTP", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + health_monitor = await response.parse() + assert_matches_type(TaskIDList, health_monitor, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.pools.health_monitors.with_streaming_response.create( + pool_id="pool_id", + project_id=0, + region_id=0, + delay=10, + max_retries=2, + api_timeout=5, + type="HTTP", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + health_monitor = await response.parse() + assert_matches_type(TaskIDList, health_monitor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + 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.health_monitors.with_raw_response.create( + pool_id="", + project_id=0, + region_id=0, + delay=10, + max_retries=2, + api_timeout=5, + type="HTTP", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + health_monitor = await async_client.cloud.load_balancers.pools.health_monitors.delete( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + assert health_monitor is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.pools.health_monitors.with_raw_response.delete( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + health_monitor = await response.parse() + assert health_monitor is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.pools.health_monitors.with_streaming_response.delete( + pool_id="pool_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + health_monitor = await response.parse() + assert health_monitor is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): + await async_client.cloud.load_balancers.pools.health_monitors.with_raw_response.delete( + pool_id="", + project_id=0, + region_id=0, + ) diff --git a/tests/api_resources/cloud/load_balancers/pools/test_members.py b/tests/api_resources/cloud/load_balancers/pools/test_members.py new file mode 100644 index 00000000..cd28252b --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/pools/test_members.py @@ -0,0 +1,280 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import TaskIDList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +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( + pool_id="pool_id", + project_id=0, + region_id=0, + address="192.168.40.33", + protocol_port=80, + ) + 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( + pool_id="pool_id", + project_id=0, + region_id=0, + address="192.168.40.33", + protocol_port=80, + admin_state_up=False, + instance_id="a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", + monitor_address="monitor_address", + monitor_port=0, + subnet_id="32283b0b-b560-4690-810c-f672cbb2e28d", + weight=1, + ) + 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( + pool_id="pool_id", + project_id=0, + region_id=0, + address="192.168.40.33", + protocol_port=80, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + member = response.parse() + 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( + pool_id="pool_id", + project_id=0, + region_id=0, + address="192.168.40.33", + protocol_port=80, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + member = response.parse() + assert_matches_type(TaskIDList, member, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_add(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( + pool_id="", + project_id=0, + region_id=0, + address="192.168.40.33", + protocol_port=80, + ) + + @parametrize + def test_method_remove(self, client: Gcore) -> None: + member = client.cloud.load_balancers.pools.members.remove( + member_id="member_id", + project_id=0, + region_id=0, + pool_id="pool_id", + ) + 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( + member_id="member_id", + project_id=0, + region_id=0, + pool_id="pool_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + member = response.parse() + 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( + member_id="member_id", + project_id=0, + region_id=0, + pool_id="pool_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + member = response.parse() + assert_matches_type(TaskIDList, member, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_remove(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( + member_id="member_id", + project_id=0, + region_id=0, + pool_id="", + ) + + 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( + member_id="", + project_id=0, + region_id=0, + pool_id="pool_id", + ) + + +class TestAsyncMembers: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_add(self, async_client: AsyncGcore) -> None: + member = await async_client.cloud.load_balancers.pools.members.add( + pool_id="pool_id", + project_id=0, + region_id=0, + address="192.168.40.33", + protocol_port=80, + ) + 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( + pool_id="pool_id", + project_id=0, + region_id=0, + address="192.168.40.33", + protocol_port=80, + admin_state_up=False, + instance_id="a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", + monitor_address="monitor_address", + monitor_port=0, + subnet_id="32283b0b-b560-4690-810c-f672cbb2e28d", + weight=1, + ) + 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( + pool_id="pool_id", + project_id=0, + region_id=0, + address="192.168.40.33", + protocol_port=80, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + member = await response.parse() + 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( + pool_id="pool_id", + project_id=0, + region_id=0, + address="192.168.40.33", + protocol_port=80, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + member = await response.parse() + assert_matches_type(TaskIDList, member, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_add(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( + pool_id="", + project_id=0, + region_id=0, + address="192.168.40.33", + protocol_port=80, + ) + + @parametrize + async def test_method_remove(self, async_client: AsyncGcore) -> None: + member = await async_client.cloud.load_balancers.pools.members.remove( + member_id="member_id", + project_id=0, + region_id=0, + pool_id="pool_id", + ) + 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( + member_id="member_id", + project_id=0, + region_id=0, + pool_id="pool_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + member = await response.parse() + 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( + member_id="member_id", + project_id=0, + region_id=0, + pool_id="pool_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + member = await response.parse() + assert_matches_type(TaskIDList, member, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_remove(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( + member_id="member_id", + project_id=0, + region_id=0, + pool_id="", + ) + + 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( + member_id="", + project_id=0, + region_id=0, + pool_id="pool_id", + ) diff --git a/tests/api_resources/cloud/load_balancers/test_flavors.py b/tests/api_resources/cloud/load_balancers/test_flavors.py new file mode 100644 index 00000000..2e266685 --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/test_flavors.py @@ -0,0 +1,108 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import LbFlavorList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFlavors: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + flavor = client.cloud.load_balancers.flavors.list( + project_id=0, + region_id=0, + ) + assert_matches_type(LbFlavorList, flavor, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + flavor = client.cloud.load_balancers.flavors.list( + project_id=0, + region_id=0, + include_prices=True, + ) + assert_matches_type(LbFlavorList, flavor, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.load_balancers.flavors.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = response.parse() + assert_matches_type(LbFlavorList, flavor, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.load_balancers.flavors.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = response.parse() + assert_matches_type(LbFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFlavors: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.load_balancers.flavors.list( + project_id=0, + region_id=0, + ) + assert_matches_type(LbFlavorList, flavor, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.load_balancers.flavors.list( + project_id=0, + region_id=0, + include_prices=True, + ) + assert_matches_type(LbFlavorList, flavor, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.flavors.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = await response.parse() + assert_matches_type(LbFlavorList, flavor, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.flavors.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = await response.parse() + assert_matches_type(LbFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_l7_policies.py b/tests/api_resources/cloud/load_balancers/test_l7_policies.py new file mode 100644 index 00000000..1a41011b --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/test_l7_policies.py @@ -0,0 +1,522 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import L7Policy, TaskIDList, L7PolicyList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestL7Policies: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.create( + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.create( + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + name="redirect-example.com", + position=1, + redirect_http_code=301, + redirect_pool_id="redirect_pool_id", + redirect_prefix="redirect_prefix", + redirect_url="http://www.example.com", + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.with_raw_response.create( + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + ) + + 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_create(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.with_streaming_response.create( + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + ) 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_method_list(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.list( + project_id=0, + region_id=0, + ) + assert_matches_type(L7PolicyList, l7_policy, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + l7_policy = response.parse() + assert_matches_type(L7PolicyList, l7_policy, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + l7_policy = response.parse() + assert_matches_type(L7PolicyList, l7_policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.delete( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.with_raw_response.delete( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) + + 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_delete(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.with_streaming_response.delete( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) 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_delete(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.delete( + l7policy_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.get( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) + assert_matches_type(L7Policy, l7_policy, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.with_raw_response.get( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + l7_policy = response.parse() + assert_matches_type(L7Policy, l7_policy, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.with_streaming_response.get( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + l7_policy = response.parse() + assert_matches_type(L7Policy, l7_policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + client.cloud.load_balancers.l7_policies.with_raw_response.get( + l7policy_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.replace( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.replace( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + name="redirect-images.example.com", + position=1, + redirect_http_code=301, + redirect_pool_id="redirect_pool_id", + redirect_prefix="redirect_prefix", + redirect_url="http://images.example.com", + tags=["updated_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.with_raw_response.replace( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + ) + + 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(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.with_streaming_response.replace( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + ) 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(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=0, + region_id=0, + action="REDIRECT_TO_URL", + ) + + +class TestAsyncL7Policies: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.create( + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.create( + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + name="redirect-example.com", + position=1, + redirect_http_code=301, + redirect_pool_id="redirect_pool_id", + redirect_prefix="redirect_prefix", + redirect_url="http://www.example.com", + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.create( + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + ) + + 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_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.create( + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + ) 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_method_list(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.list( + project_id=0, + region_id=0, + ) + assert_matches_type(L7PolicyList, l7_policy, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + l7_policy = await response.parse() + assert_matches_type(L7PolicyList, l7_policy, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.list( + project_id=0, + region_id=0, + ) 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(L7PolicyList, l7_policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.delete( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.delete( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) + + 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_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.delete( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) 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_delete(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.delete( + l7policy_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.get( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) + assert_matches_type(L7Policy, l7_policy, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.get( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + l7_policy = await response.parse() + assert_matches_type(L7Policy, l7_policy, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.get( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + ) 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(L7Policy, l7_policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + await async_client.cloud.load_balancers.l7_policies.with_raw_response.get( + l7policy_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.replace( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.replace( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + name="redirect-images.example.com", + position=1, + redirect_http_code=301, + redirect_pool_id="redirect_pool_id", + redirect_prefix="redirect_prefix", + redirect_url="http://images.example.com", + tags=["updated_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.replace( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + ) + + 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(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.replace( + l7policy_id="l7policy_id", + project_id=0, + region_id=0, + action="REDIRECT_TO_URL", + ) 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(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=0, + region_id=0, + action="REDIRECT_TO_URL", + ) diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py new file mode 100644 index 00000000..1cdfa3ce --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -0,0 +1,596 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import LbListener, TaskIDList, LbListenerList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestListeners: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + listener = client.cloud.load_balancers.listeners.create( + project_id=0, + region_id=0, + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + name="my_listener", + protocol="HTTP", + protocol_port=80, + ) + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + listener = client.cloud.load_balancers.listeners.create( + project_id=0, + region_id=0, + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + name="my_listener", + protocol="HTTP", + protocol_port=80, + allowed_cidrs=["10.0.0.0/8"], + connection_limit=100000, + insert_x_forwarded=False, + secret_id="f2e734d0-fa2b-42c2-ad33-4c6db5101e00", + sni_secret_id=["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], + timeout_client_data=50000, + timeout_member_connect=50000, + timeout_member_data=0, + user_list=[ + { + "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", + "username": "admin", + } + ], + ) + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.load_balancers.listeners.with_raw_response.create( + project_id=0, + region_id=0, + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + name="my_listener", + protocol="HTTP", + protocol_port=80, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + listener = response.parse() + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.load_balancers.listeners.with_streaming_response.create( + project_id=0, + region_id=0, + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + name="my_listener", + protocol="HTTP", + protocol_port=80, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + listener = response.parse() + assert_matches_type(TaskIDList, listener, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + listener = client.cloud.load_balancers.listeners.update( + listener_id="listener_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + listener = client.cloud.load_balancers.listeners.update( + listener_id="listener_id", + project_id=0, + region_id=0, + allowed_cidrs=["10.0.0.0/8"], + connection_limit=100000, + name="new_listener_name", + secret_id="af4a64e7-03ca-470f-9a09-b77d54c5abd8", + sni_secret_id=["af4a64e7-03ca-470f-9a09-b77d54c5abd8", "12b43d95-d420-4c79-a883-49bf146cbdff"], + timeout_client_data=50000, + timeout_member_connect=50000, + timeout_member_data=0, + user_list=[ + { + "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", + "username": "admin", + } + ], + ) + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.load_balancers.listeners.with_raw_response.update( + listener_id="listener_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + listener = response.parse() + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.load_balancers.listeners.with_streaming_response.update( + listener_id="listener_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + listener = response.parse() + assert_matches_type(TaskIDList, listener, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `listener_id` but received ''"): + client.cloud.load_balancers.listeners.with_raw_response.update( + listener_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + listener = client.cloud.load_balancers.listeners.list( + project_id=0, + region_id=0, + ) + assert_matches_type(LbListenerList, listener, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + listener = client.cloud.load_balancers.listeners.list( + project_id=0, + region_id=0, + loadbalancer_id="loadbalancer_id", + show_stats=True, + ) + assert_matches_type(LbListenerList, listener, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.load_balancers.listeners.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + listener = response.parse() + assert_matches_type(LbListenerList, listener, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.load_balancers.listeners.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + listener = response.parse() + assert_matches_type(LbListenerList, listener, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + listener = client.cloud.load_balancers.listeners.delete( + listener_id="listener_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.load_balancers.listeners.with_raw_response.delete( + listener_id="listener_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + listener = response.parse() + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.load_balancers.listeners.with_streaming_response.delete( + listener_id="listener_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + listener = response.parse() + assert_matches_type(TaskIDList, listener, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `listener_id` but received ''"): + client.cloud.load_balancers.listeners.with_raw_response.delete( + listener_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + listener = client.cloud.load_balancers.listeners.get( + listener_id="listener_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LbListener, listener, path=["response"]) + + @parametrize + def test_method_get_with_all_params(self, client: Gcore) -> None: + listener = client.cloud.load_balancers.listeners.get( + listener_id="listener_id", + project_id=0, + region_id=0, + show_stats=True, + ) + assert_matches_type(LbListener, listener, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.load_balancers.listeners.with_raw_response.get( + listener_id="listener_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + listener = response.parse() + assert_matches_type(LbListener, listener, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.load_balancers.listeners.with_streaming_response.get( + listener_id="listener_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + listener = response.parse() + assert_matches_type(LbListener, listener, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `listener_id` but received ''"): + client.cloud.load_balancers.listeners.with_raw_response.get( + listener_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncListeners: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + listener = await async_client.cloud.load_balancers.listeners.create( + project_id=0, + region_id=0, + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + name="my_listener", + protocol="HTTP", + protocol_port=80, + ) + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + listener = await async_client.cloud.load_balancers.listeners.create( + project_id=0, + region_id=0, + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + name="my_listener", + protocol="HTTP", + protocol_port=80, + allowed_cidrs=["10.0.0.0/8"], + connection_limit=100000, + insert_x_forwarded=False, + secret_id="f2e734d0-fa2b-42c2-ad33-4c6db5101e00", + sni_secret_id=["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], + timeout_client_data=50000, + timeout_member_connect=50000, + timeout_member_data=0, + user_list=[ + { + "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", + "username": "admin", + } + ], + ) + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.listeners.with_raw_response.create( + project_id=0, + region_id=0, + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + name="my_listener", + protocol="HTTP", + protocol_port=80, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + listener = await response.parse() + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.listeners.with_streaming_response.create( + project_id=0, + region_id=0, + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + name="my_listener", + protocol="HTTP", + protocol_port=80, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + listener = await response.parse() + assert_matches_type(TaskIDList, listener, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + listener = await async_client.cloud.load_balancers.listeners.update( + listener_id="listener_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + listener = await async_client.cloud.load_balancers.listeners.update( + listener_id="listener_id", + project_id=0, + region_id=0, + allowed_cidrs=["10.0.0.0/8"], + connection_limit=100000, + name="new_listener_name", + secret_id="af4a64e7-03ca-470f-9a09-b77d54c5abd8", + sni_secret_id=["af4a64e7-03ca-470f-9a09-b77d54c5abd8", "12b43d95-d420-4c79-a883-49bf146cbdff"], + timeout_client_data=50000, + timeout_member_connect=50000, + timeout_member_data=0, + user_list=[ + { + "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", + "username": "admin", + } + ], + ) + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.listeners.with_raw_response.update( + listener_id="listener_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + listener = await response.parse() + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.listeners.with_streaming_response.update( + listener_id="listener_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + listener = await response.parse() + assert_matches_type(TaskIDList, listener, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `listener_id` but received ''"): + await async_client.cloud.load_balancers.listeners.with_raw_response.update( + listener_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + listener = await async_client.cloud.load_balancers.listeners.list( + project_id=0, + region_id=0, + ) + assert_matches_type(LbListenerList, listener, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + listener = await async_client.cloud.load_balancers.listeners.list( + project_id=0, + region_id=0, + loadbalancer_id="loadbalancer_id", + show_stats=True, + ) + assert_matches_type(LbListenerList, listener, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.listeners.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + listener = await response.parse() + assert_matches_type(LbListenerList, listener, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.listeners.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + listener = await response.parse() + assert_matches_type(LbListenerList, listener, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + listener = await async_client.cloud.load_balancers.listeners.delete( + listener_id="listener_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.listeners.with_raw_response.delete( + listener_id="listener_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + listener = await response.parse() + assert_matches_type(TaskIDList, listener, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.listeners.with_streaming_response.delete( + listener_id="listener_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + listener = await response.parse() + assert_matches_type(TaskIDList, listener, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `listener_id` but received ''"): + await async_client.cloud.load_balancers.listeners.with_raw_response.delete( + listener_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + listener = await async_client.cloud.load_balancers.listeners.get( + listener_id="listener_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LbListener, listener, path=["response"]) + + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: + listener = await async_client.cloud.load_balancers.listeners.get( + listener_id="listener_id", + project_id=0, + region_id=0, + show_stats=True, + ) + assert_matches_type(LbListener, listener, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.listeners.with_raw_response.get( + listener_id="listener_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + listener = await response.parse() + assert_matches_type(LbListener, listener, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.listeners.with_streaming_response.get( + listener_id="listener_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + listener = await response.parse() + assert_matches_type(LbListener, listener, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `listener_id` but received ''"): + await async_client.cloud.load_balancers.listeners.with_raw_response.get( + listener_id="", + project_id=0, + region_id=0, + ) diff --git a/tests/api_resources/cloud/load_balancers/test_metrics.py b/tests/api_resources/cloud/load_balancers/test_metrics.py new file mode 100644 index 00000000..042d6293 --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/test_metrics.py @@ -0,0 +1,130 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import LoadbalancerMetricsList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestMetrics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + metric = client.cloud.load_balancers.metrics.list( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + assert_matches_type(LoadbalancerMetricsList, metric, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.load_balancers.metrics.with_raw_response.list( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = response.parse() + assert_matches_type(LoadbalancerMetricsList, metric, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.load_balancers.metrics.with_streaming_response.list( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = response.parse() + assert_matches_type(LoadbalancerMetricsList, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + client.cloud.load_balancers.metrics.with_raw_response.list( + loadbalancer_id="", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + + +class TestAsyncMetrics: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + metric = await async_client.cloud.load_balancers.metrics.list( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + assert_matches_type(LoadbalancerMetricsList, metric, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.metrics.with_raw_response.list( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = await response.parse() + assert_matches_type(LoadbalancerMetricsList, metric, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.metrics.with_streaming_response.list( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = await response.parse() + assert_matches_type(LoadbalancerMetricsList, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + await async_client.cloud.load_balancers.metrics.with_raw_response.list( + loadbalancer_id="", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py new file mode 100644 index 00000000..731c9ca6 --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -0,0 +1,680 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import TaskIDList, DetailedLbPool, DetailedLbPoolList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPools: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + pool = client.cloud.load_balancers.pools.create( + project_id=0, + region_id=0, + lb_algorithm="LEAST_CONNECTIONS", + name="pool_name", + protocol="HTTP", + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + pool = client.cloud.load_balancers.pools.create( + project_id=0, + region_id=0, + lb_algorithm="LEAST_CONNECTIONS", + name="pool_name", + protocol="HTTP", + ca_secret_id="ca_secret_id", + crl_secret_id="crl_secret_id", + healthmonitor={ + "delay": 10, + "max_retries": 3, + "timeout": 5, + "type": "HTTP", + "expected_codes": "200,301,302", + "http_method": "GET", + "max_retries_down": 3, + "url_path": "/", + }, + listener_id="listener_id", + loadbalancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + members=[ + { + "address": "192.168.1.101", + "protocol_port": 8000, + "admin_state_up": False, + "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", + "monitor_address": "monitor_address", + "monitor_port": 0, + "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", + "weight": 2, + }, + { + "address": "192.168.1.102", + "protocol_port": 8000, + "admin_state_up": False, + "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", + "monitor_address": "monitor_address", + "monitor_port": 0, + "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", + "weight": 4, + }, + ], + secret_id="secret_id", + session_persistence={ + "type": "APP_COOKIE", + "cookie_name": "cookie_name", + "persistence_granularity": "persistence_granularity", + "persistence_timeout": 0, + }, + timeout_client_data=50000, + timeout_member_connect=50000, + timeout_member_data=0, + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.load_balancers.pools.with_raw_response.create( + project_id=0, + region_id=0, + lb_algorithm="LEAST_CONNECTIONS", + name="pool_name", + protocol="HTTP", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.load_balancers.pools.with_streaming_response.create( + project_id=0, + region_id=0, + lb_algorithm="LEAST_CONNECTIONS", + name="pool_name", + protocol="HTTP", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + pool = client.cloud.load_balancers.pools.update( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + pool = client.cloud.load_balancers.pools.update( + pool_id="pool_id", + project_id=0, + region_id=0, + ca_secret_id="ca_secret_id", + crl_secret_id="crl_secret_id", + healthmonitor={ + "delay": 10, + "max_retries": 2, + "timeout": 5, + "expected_codes": "200,301,302", + "http_method": "CONNECT", + "max_retries_down": 2, + "type": "HTTP", + "url_path": "/", + }, + lb_algorithm="LEAST_CONNECTIONS", + members=[ + { + "address": "192.168.40.33", + "protocol_port": 80, + "admin_state_up": False, + "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", + "monitor_address": "monitor_address", + "monitor_port": 0, + "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", + "weight": 1, + } + ], + name="new_pool_name", + protocol="HTTP", + secret_id="secret_id", + session_persistence={ + "type": "APP_COOKIE", + "cookie_name": "cookie_name", + "persistence_granularity": "persistence_granularity", + "persistence_timeout": 0, + }, + timeout_client_data=50000, + timeout_member_connect=50000, + timeout_member_data=0, + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.load_balancers.pools.with_raw_response.update( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.load_balancers.pools.with_streaming_response.update( + pool_id="pool_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): + client.cloud.load_balancers.pools.with_raw_response.update( + pool_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + pool = client.cloud.load_balancers.pools.list( + project_id=0, + region_id=0, + ) + assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + pool = client.cloud.load_balancers.pools.list( + project_id=0, + region_id=0, + details=True, + listener_id="listener_id", + loadbalancer_id="loadbalancer_id", + ) + assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.load_balancers.pools.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.load_balancers.pools.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + pool = client.cloud.load_balancers.pools.delete( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.load_balancers.pools.with_raw_response.delete( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.load_balancers.pools.with_streaming_response.delete( + pool_id="pool_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): + client.cloud.load_balancers.pools.with_raw_response.delete( + pool_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + pool = client.cloud.load_balancers.pools.get( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + assert_matches_type(DetailedLbPool, pool, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.load_balancers.pools.with_raw_response.get( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(DetailedLbPool, pool, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.load_balancers.pools.with_streaming_response.get( + pool_id="pool_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(DetailedLbPool, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): + client.cloud.load_balancers.pools.with_raw_response.get( + pool_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncPools: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.load_balancers.pools.create( + project_id=0, + region_id=0, + lb_algorithm="LEAST_CONNECTIONS", + name="pool_name", + protocol="HTTP", + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.load_balancers.pools.create( + project_id=0, + region_id=0, + lb_algorithm="LEAST_CONNECTIONS", + name="pool_name", + protocol="HTTP", + ca_secret_id="ca_secret_id", + crl_secret_id="crl_secret_id", + healthmonitor={ + "delay": 10, + "max_retries": 3, + "timeout": 5, + "type": "HTTP", + "expected_codes": "200,301,302", + "http_method": "GET", + "max_retries_down": 3, + "url_path": "/", + }, + listener_id="listener_id", + loadbalancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + members=[ + { + "address": "192.168.1.101", + "protocol_port": 8000, + "admin_state_up": False, + "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", + "monitor_address": "monitor_address", + "monitor_port": 0, + "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", + "weight": 2, + }, + { + "address": "192.168.1.102", + "protocol_port": 8000, + "admin_state_up": False, + "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", + "monitor_address": "monitor_address", + "monitor_port": 0, + "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", + "weight": 4, + }, + ], + secret_id="secret_id", + session_persistence={ + "type": "APP_COOKIE", + "cookie_name": "cookie_name", + "persistence_granularity": "persistence_granularity", + "persistence_timeout": 0, + }, + timeout_client_data=50000, + timeout_member_connect=50000, + timeout_member_data=0, + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.pools.with_raw_response.create( + project_id=0, + region_id=0, + lb_algorithm="LEAST_CONNECTIONS", + name="pool_name", + protocol="HTTP", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.pools.with_streaming_response.create( + project_id=0, + region_id=0, + lb_algorithm="LEAST_CONNECTIONS", + name="pool_name", + protocol="HTTP", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.load_balancers.pools.update( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.load_balancers.pools.update( + pool_id="pool_id", + project_id=0, + region_id=0, + ca_secret_id="ca_secret_id", + crl_secret_id="crl_secret_id", + healthmonitor={ + "delay": 10, + "max_retries": 2, + "timeout": 5, + "expected_codes": "200,301,302", + "http_method": "CONNECT", + "max_retries_down": 2, + "type": "HTTP", + "url_path": "/", + }, + lb_algorithm="LEAST_CONNECTIONS", + members=[ + { + "address": "192.168.40.33", + "protocol_port": 80, + "admin_state_up": False, + "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", + "monitor_address": "monitor_address", + "monitor_port": 0, + "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", + "weight": 1, + } + ], + name="new_pool_name", + protocol="HTTP", + secret_id="secret_id", + session_persistence={ + "type": "APP_COOKIE", + "cookie_name": "cookie_name", + "persistence_granularity": "persistence_granularity", + "persistence_timeout": 0, + }, + timeout_client_data=50000, + timeout_member_connect=50000, + timeout_member_data=0, + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.pools.with_raw_response.update( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.pools.with_streaming_response.update( + pool_id="pool_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): + await async_client.cloud.load_balancers.pools.with_raw_response.update( + pool_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.load_balancers.pools.list( + project_id=0, + region_id=0, + ) + assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.load_balancers.pools.list( + project_id=0, + region_id=0, + details=True, + listener_id="listener_id", + loadbalancer_id="loadbalancer_id", + ) + assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.pools.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.pools.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.load_balancers.pools.delete( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.pools.with_raw_response.delete( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.pools.with_streaming_response.delete( + pool_id="pool_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): + await async_client.cloud.load_balancers.pools.with_raw_response.delete( + pool_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.load_balancers.pools.get( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + assert_matches_type(DetailedLbPool, pool, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.pools.with_raw_response.get( + pool_id="pool_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(DetailedLbPool, pool, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.pools.with_streaming_response.get( + pool_id="pool_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(DetailedLbPool, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): + await async_client.cloud.load_balancers.pools.with_raw_response.get( + pool_id="", + project_id=0, + region_id=0, + ) diff --git a/tests/api_resources/cloud/load_balancers/test_statuses.py b/tests/api_resources/cloud/load_balancers/test_statuses.py new file mode 100644 index 00000000..413375f0 --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/test_statuses.py @@ -0,0 +1,182 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import LoadBalancerStatus, LoadBalancerStatusList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestStatuses: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + status = client.cloud.load_balancers.statuses.list( + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.load_balancers.statuses.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + status = response.parse() + assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.load_balancers.statuses.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + status = response.parse() + assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + status = client.cloud.load_balancers.statuses.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.load_balancers.statuses.with_raw_response.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + status = response.parse() + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.load_balancers.statuses.with_streaming_response.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + status = response.parse() + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + client.cloud.load_balancers.statuses.with_raw_response.get( + loadbalancer_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncStatuses: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + status = await async_client.cloud.load_balancers.statuses.list( + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.statuses.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + status = await response.parse() + assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.statuses.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + status = await response.parse() + assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + status = await async_client.cloud.load_balancers.statuses.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.statuses.with_raw_response.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + status = await response.parse() + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.statuses.with_streaming_response.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + status = await response.parse() + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + await async_client.cloud.load_balancers.statuses.with_raw_response.get( + loadbalancer_id="", + project_id=0, + region_id=0, + ) diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py new file mode 100644 index 00000000..5ef4852d --- /dev/null +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -0,0 +1,946 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import ( + TaskIDList, + LoadBalancer, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLoadBalancers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.create( + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.create( + project_id=0, + region_id=0, + flavor="lb1-1-2", + floating_ip={ + "existing_floating_id": "c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + "source": "existing", + }, + listeners=[ + { + "name": "my_listener", + "protocol": "HTTP", + "protocol_port": 80, + "allowed_cidrs": ["10.0.0.0/8"], + "connection_limit": 100000, + "insert_x_forwarded": False, + "pools": [ + { + "lb_algorithm": "LEAST_CONNECTIONS", + "name": "pool_name", + "protocol": "HTTP", + "ca_secret_id": "ca_secret_id", + "crl_secret_id": "crl_secret_id", + "healthmonitor": { + "delay": 10, + "max_retries": 3, + "timeout": 5, + "type": "HTTP", + "expected_codes": "200,301,302", + "http_method": "GET", + "max_retries_down": 3, + "url_path": "/", + }, + "listener_id": "listener_id", + "loadbalancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + "members": [ + { + "address": "192.168.1.101", + "protocol_port": 8000, + "admin_state_up": False, + "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", + "monitor_address": "monitor_address", + "monitor_port": 0, + "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", + "weight": 2, + }, + { + "address": "192.168.1.102", + "protocol_port": 8000, + "admin_state_up": False, + "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", + "monitor_address": "monitor_address", + "monitor_port": 0, + "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", + "weight": 4, + }, + ], + "secret_id": "secret_id", + "session_persistence": { + "type": "APP_COOKIE", + "cookie_name": "cookie_name", + "persistence_granularity": "persistence_granularity", + "persistence_timeout": 0, + }, + "timeout_client_data": 50000, + "timeout_member_connect": 50000, + "timeout_member_data": 0, + } + ], + "secret_id": "f2e734d0-fa2b-42c2-ad33-4c6db5101e00", + "sni_secret_id": ["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], + "timeout_client_data": 50000, + "timeout_member_connect": 50000, + "timeout_member_data": 0, + "user_list": [ + { + "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", + "username": "admin", + } + ], + } + ], + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + metadata={"my-tag": "my-tag-value"}, + name="new_load_balancer", + name_template="lb_name_template", + preferred_connectivity="L2", + tag=["k8s"], + vip_ip_family="dual", + vip_network_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + vip_port_id="ff83e13a-b256-4be2-ba5d-028d3f0ab450", + vip_subnet_id="4e7802d3-5023-44b8-b298-7726558fddf4", + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.create( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.create( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.update( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.update( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + name="some_name", + preferred_connectivity="L2", + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.update( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.update( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.update( + loadbalancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.list( + project_id=0, + region_id=0, + ) + assert_matches_type(SyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.list( + project_id=0, + region_id=0, + assigned_floating=True, + limit=0, + logging_enabled=True, + metadata_k="metadata_k", + metadata_kv="metadata_kv", + name="name", + offset=0, + order_by="order_by", + show_stats=True, + with_ddos=True, + ) + assert_matches_type(SyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(SyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(SyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.delete( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.delete( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.delete( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.delete( + loadbalancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_failover(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.failover( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_method_failover_with_all_params(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.failover( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + force=True, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_failover(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.failover( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_failover(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.failover( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_failover(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.failover( + loadbalancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_method_get_with_all_params(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + show_stats=True, + with_ddos=True, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.get( + loadbalancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_resize(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.resize( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_resize(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.resize( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_resize(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.resize( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_resize(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.resize( + loadbalancer_id="", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + + +class TestAsyncLoadBalancers: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.create( + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.create( + project_id=0, + region_id=0, + flavor="lb1-1-2", + floating_ip={ + "existing_floating_id": "c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + "source": "existing", + }, + listeners=[ + { + "name": "my_listener", + "protocol": "HTTP", + "protocol_port": 80, + "allowed_cidrs": ["10.0.0.0/8"], + "connection_limit": 100000, + "insert_x_forwarded": False, + "pools": [ + { + "lb_algorithm": "LEAST_CONNECTIONS", + "name": "pool_name", + "protocol": "HTTP", + "ca_secret_id": "ca_secret_id", + "crl_secret_id": "crl_secret_id", + "healthmonitor": { + "delay": 10, + "max_retries": 3, + "timeout": 5, + "type": "HTTP", + "expected_codes": "200,301,302", + "http_method": "GET", + "max_retries_down": 3, + "url_path": "/", + }, + "listener_id": "listener_id", + "loadbalancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + "members": [ + { + "address": "192.168.1.101", + "protocol_port": 8000, + "admin_state_up": False, + "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", + "monitor_address": "monitor_address", + "monitor_port": 0, + "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", + "weight": 2, + }, + { + "address": "192.168.1.102", + "protocol_port": 8000, + "admin_state_up": False, + "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", + "monitor_address": "monitor_address", + "monitor_port": 0, + "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", + "weight": 4, + }, + ], + "secret_id": "secret_id", + "session_persistence": { + "type": "APP_COOKIE", + "cookie_name": "cookie_name", + "persistence_granularity": "persistence_granularity", + "persistence_timeout": 0, + }, + "timeout_client_data": 50000, + "timeout_member_connect": 50000, + "timeout_member_data": 0, + } + ], + "secret_id": "f2e734d0-fa2b-42c2-ad33-4c6db5101e00", + "sni_secret_id": ["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], + "timeout_client_data": 50000, + "timeout_member_connect": 50000, + "timeout_member_data": 0, + "user_list": [ + { + "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", + "username": "admin", + } + ], + } + ], + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + metadata={"my-tag": "my-tag-value"}, + name="new_load_balancer", + name_template="lb_name_template", + preferred_connectivity="L2", + tag=["k8s"], + vip_ip_family="dual", + vip_network_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + vip_port_id="ff83e13a-b256-4be2-ba5d-028d3f0ab450", + vip_subnet_id="4e7802d3-5023-44b8-b298-7726558fddf4", + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.create( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.create( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.update( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.update( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + name="some_name", + preferred_connectivity="L2", + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.update( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.update( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.update( + loadbalancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.list( + project_id=0, + region_id=0, + ) + assert_matches_type(AsyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.list( + project_id=0, + region_id=0, + assigned_floating=True, + limit=0, + logging_enabled=True, + metadata_k="metadata_k", + metadata_kv="metadata_kv", + name="name", + offset=0, + order_by="order_by", + show_stats=True, + with_ddos=True, + ) + assert_matches_type(AsyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(AsyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(AsyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.delete( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.delete( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.delete( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.delete( + loadbalancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_failover(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.failover( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_method_failover_with_all_params(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.failover( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + force=True, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_failover(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.failover( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_failover(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.failover( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_failover(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.failover( + loadbalancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + show_stats=True, + with_ddos=True, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.get( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.get( + loadbalancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_resize(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.resize( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.resize( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.resize( + loadbalancer_id="loadbalancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_resize(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.resize( + loadbalancer_id="", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) From 4bfdfc06245af1f25779d346726b52d68f5d59d0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 02:36:45 +0000 Subject: [PATCH 076/592] GCLOUD2-18780 feat: Add inference --- .stats.yml | 4 +- api.md | 115 ++ src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + .../resources/cloud/inference/__init__.py | 89 ++ .../cloud/inference/deployments/__init__.py | 33 + .../inference/deployments/deployments.py | 1229 +++++++++++++++++ .../cloud/inference/deployments/logs.py | 245 ++++ .../resources/cloud/inference/flavors.py | 282 ++++ .../resources/cloud/inference/inference.py | 295 ++++ src/gcore/resources/cloud/inference/models.py | 293 ++++ .../cloud/inference/registry_credentials.py | 681 +++++++++ .../resources/cloud/inference/secrets.py | 655 +++++++++ src/gcore/types/cloud/__init__.py | 20 + src/gcore/types/cloud/aws_iam_data.py | 19 + src/gcore/types/cloud/aws_iam_data_param.py | 21 + src/gcore/types/cloud/capacity.py | 19 + src/gcore/types/cloud/container_probe.py | 60 + .../types/cloud/container_probe_config.py | 22 + src/gcore/types/cloud/container_probe_exec.py | 15 + .../types/cloud/container_probe_http_get.py | 41 + .../types/cloud/container_probe_tcp_socket.py | 13 + src/gcore/types/cloud/container_scale.py | 40 + .../cloud/container_scale_trigger_rate.py | 19 + .../cloud/container_scale_trigger_sqs.py | 57 + .../container_scale_trigger_threshold.py | 13 + .../types/cloud/container_scale_triggers.py | 48 + src/gcore/types/cloud/deploy_status.py | 19 + src/gcore/types/cloud/inference/__init__.py | 25 + src/gcore/types/cloud/inference/container.py | 41 + .../inference/deployment_create_params.py | 702 ++++++++++ .../cloud/inference/deployment_list_params.py | 27 + .../inference/deployment_update_params.py | 696 ++++++++++ .../cloud/inference/deployments/__init__.py | 5 + .../inference/deployments/log_list_params.py | 40 + .../cloud/inference/flavor_list_params.py | 21 + src/gcore/types/cloud/inference/inference.py | 122 ++ .../inference/inference_apikey_secret.py | 21 + .../types/cloud/inference/inference_flavor.py | 61 + .../types/cloud/inference/inference_log.py | 33 + .../inference_registry_credential.py | 31 + .../inference_registry_credential_full.py | 37 + .../types/cloud/inference/inference_secret.py | 26 + .../cloud/inference/mlcatalog_model_card.py | 119 ++ .../inference/mlcatalog_order_by_choices.py | 7 + .../cloud/inference/model_list_params.py | 29 + .../registry_credential_create_params.py | 39 + .../registry_credential_list_params.py | 27 + .../registry_credential_replace_params.py | 33 + .../cloud/inference/secret_create_params.py | 35 + .../cloud/inference/secret_list_params.py | 27 + .../cloud/inference/secret_replace_params.py | 29 + src/gcore/types/cloud/inference_probes.py | 28 + src/gcore/types/cloud/ingress_opts_out.py | 13 + src/gcore/types/cloud/ingress_opts_param.py | 15 + src/gcore/types/cloud/load_balancer.py | 37 +- src/gcore/types/cloud/logging.py | 41 + src/gcore/types/cloud/region_capacity.py | 22 + src/gcore/types/cloud/region_capacity_list.py | 22 + .../api_resources/cloud/inference/__init__.py | 1 + .../cloud/inference/deployments/__init__.py | 1 + .../cloud/inference/deployments/test_logs.py | 131 ++ .../cloud/inference/test_deployments.py | 1219 ++++++++++++++++ .../cloud/inference/test_flavors.py | 165 +++ .../cloud/inference/test_models.py | 167 +++ .../inference/test_registry_credentials.py | 468 +++++++ .../cloud/inference/test_secrets.py | 493 +++++++ tests/api_resources/cloud/test_inference.py | 72 + 68 files changed, 9484 insertions(+), 37 deletions(-) create mode 100644 src/gcore/resources/cloud/inference/__init__.py create mode 100644 src/gcore/resources/cloud/inference/deployments/__init__.py create mode 100644 src/gcore/resources/cloud/inference/deployments/deployments.py create mode 100644 src/gcore/resources/cloud/inference/deployments/logs.py create mode 100644 src/gcore/resources/cloud/inference/flavors.py create mode 100644 src/gcore/resources/cloud/inference/inference.py create mode 100644 src/gcore/resources/cloud/inference/models.py create mode 100644 src/gcore/resources/cloud/inference/registry_credentials.py create mode 100644 src/gcore/resources/cloud/inference/secrets.py create mode 100644 src/gcore/types/cloud/aws_iam_data.py create mode 100644 src/gcore/types/cloud/aws_iam_data_param.py create mode 100644 src/gcore/types/cloud/capacity.py create mode 100644 src/gcore/types/cloud/container_probe.py create mode 100644 src/gcore/types/cloud/container_probe_config.py create mode 100644 src/gcore/types/cloud/container_probe_exec.py create mode 100644 src/gcore/types/cloud/container_probe_http_get.py create mode 100644 src/gcore/types/cloud/container_probe_tcp_socket.py create mode 100644 src/gcore/types/cloud/container_scale.py create mode 100644 src/gcore/types/cloud/container_scale_trigger_rate.py create mode 100644 src/gcore/types/cloud/container_scale_trigger_sqs.py create mode 100644 src/gcore/types/cloud/container_scale_trigger_threshold.py create mode 100644 src/gcore/types/cloud/container_scale_triggers.py create mode 100644 src/gcore/types/cloud/deploy_status.py create mode 100644 src/gcore/types/cloud/inference/__init__.py create mode 100644 src/gcore/types/cloud/inference/container.py create mode 100644 src/gcore/types/cloud/inference/deployment_create_params.py create mode 100644 src/gcore/types/cloud/inference/deployment_list_params.py create mode 100644 src/gcore/types/cloud/inference/deployment_update_params.py create mode 100644 src/gcore/types/cloud/inference/deployments/__init__.py create mode 100644 src/gcore/types/cloud/inference/deployments/log_list_params.py create mode 100644 src/gcore/types/cloud/inference/flavor_list_params.py create mode 100644 src/gcore/types/cloud/inference/inference.py create mode 100644 src/gcore/types/cloud/inference/inference_apikey_secret.py create mode 100644 src/gcore/types/cloud/inference/inference_flavor.py create mode 100644 src/gcore/types/cloud/inference/inference_log.py create mode 100644 src/gcore/types/cloud/inference/inference_registry_credential.py create mode 100644 src/gcore/types/cloud/inference/inference_registry_credential_full.py create mode 100644 src/gcore/types/cloud/inference/inference_secret.py create mode 100644 src/gcore/types/cloud/inference/mlcatalog_model_card.py create mode 100644 src/gcore/types/cloud/inference/mlcatalog_order_by_choices.py create mode 100644 src/gcore/types/cloud/inference/model_list_params.py create mode 100644 src/gcore/types/cloud/inference/registry_credential_create_params.py create mode 100644 src/gcore/types/cloud/inference/registry_credential_list_params.py create mode 100644 src/gcore/types/cloud/inference/registry_credential_replace_params.py create mode 100644 src/gcore/types/cloud/inference/secret_create_params.py create mode 100644 src/gcore/types/cloud/inference/secret_list_params.py create mode 100644 src/gcore/types/cloud/inference/secret_replace_params.py create mode 100644 src/gcore/types/cloud/inference_probes.py create mode 100644 src/gcore/types/cloud/ingress_opts_out.py create mode 100644 src/gcore/types/cloud/ingress_opts_param.py create mode 100644 src/gcore/types/cloud/logging.py create mode 100644 src/gcore/types/cloud/region_capacity.py create mode 100644 src/gcore/types/cloud/region_capacity_list.py create mode 100644 tests/api_resources/cloud/inference/__init__.py create mode 100644 tests/api_resources/cloud/inference/deployments/__init__.py create mode 100644 tests/api_resources/cloud/inference/deployments/test_logs.py create mode 100644 tests/api_resources/cloud/inference/test_deployments.py create mode 100644 tests/api_resources/cloud/inference/test_flavors.py create mode 100644 tests/api_resources/cloud/inference/test_models.py create mode 100644 tests/api_resources/cloud/inference/test_registry_credentials.py create mode 100644 tests/api_resources/cloud/inference/test_secrets.py create mode 100644 tests/api_resources/cloud/test_inference.py diff --git a/.stats.yml b/.stats.yml index b84c0d63..1d929d83 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 138 +configured_endpoints: 162 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1b085537d9cf740f2b3313109b3be0f00952207abc6f1fee686579c070e71fc2.yml openapi_spec_hash: 61acc4dd694c9d01c88941c577deb740 -config_hash: c5eaa6ab250cfbddab458eb251f7af30 +config_hash: 4cfb3bf532d50b2f700b644a73397703 diff --git a/api.md b/api.md index 431824c0..74adc8de 100644 --- a/api.md +++ b/api.md @@ -408,6 +408,121 @@ Methods: - client.cloud.security_groups.rules.delete(rule_id, \*, project_id, region_id) -> None - client.cloud.security_groups.rules.replace(rule_id, \*, project_id, region_id, \*\*params) -> SecurityGroupRule +## Inference + +Types: + +```python +from gcore.types.cloud import ( + AwsIamData, + Capacity, + ContainerProbe, + ContainerProbeConfig, + ContainerProbeExec, + ContainerProbeHTTPGet, + ContainerProbeTcpSocket, + ContainerScale, + ContainerScaleTriggerRate, + ContainerScaleTriggerSqs, + ContainerScaleTriggerThreshold, + ContainerScaleTriggers, + DeployStatus, + InferenceProbes, + IngressOpts, + IngressOptsOut, + Logging, + RegionCapacity, + RegionCapacityList, +) +``` + +Methods: + +- client.cloud.inference.get_capacity_by_region() -> RegionCapacityList + +### Flavors + +Types: + +```python +from gcore.types.cloud.inference import InferenceFlavor +``` + +Methods: + +- client.cloud.inference.flavors.list(\*\*params) -> SyncOffsetPage[InferenceFlavor] +- client.cloud.inference.flavors.get(flavor_name) -> InferenceFlavor + +### Models + +Types: + +```python +from gcore.types.cloud.inference import MlcatalogModelCard, MlcatalogOrderByChoices +``` + +Methods: + +- client.cloud.inference.models.list(\*\*params) -> SyncOffsetPage[MlcatalogModelCard] +- client.cloud.inference.models.get(model_id) -> MlcatalogModelCard + +### Deployments + +Types: + +```python +from gcore.types.cloud.inference import Container, Inference, InferenceApikeySecret, InferenceLog +``` + +Methods: + +- client.cloud.inference.deployments.create(\*, project_id, \*\*params) -> TaskIDList +- client.cloud.inference.deployments.update(deployment_name, \*, project_id, \*\*params) -> TaskIDList +- client.cloud.inference.deployments.list(\*, project_id, \*\*params) -> SyncOffsetPage[Inference] +- client.cloud.inference.deployments.delete(deployment_name, \*, project_id) -> TaskIDList +- client.cloud.inference.deployments.get(deployment_name, \*, project_id) -> Inference +- client.cloud.inference.deployments.get_api_key(deployment_name, \*, project_id) -> InferenceApikeySecret +- client.cloud.inference.deployments.start(deployment_name, \*, project_id) -> None +- client.cloud.inference.deployments.stop(deployment_name, \*, project_id) -> None + +#### Logs + +Methods: + +- client.cloud.inference.deployments.logs.list(deployment_name, \*, project_id, \*\*params) -> SyncOffsetPage[InferenceLog] + +### RegistryCredentials + +Types: + +```python +from gcore.types.cloud.inference import InferenceRegistryCredential, InferenceRegistryCredentialFull +``` + +Methods: + +- client.cloud.inference.registry_credentials.create(\*, project_id, \*\*params) -> InferenceRegistryCredentialFull +- client.cloud.inference.registry_credentials.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceRegistryCredential] +- client.cloud.inference.registry_credentials.delete(credential_name, \*, project_id) -> None +- client.cloud.inference.registry_credentials.get(credential_name, \*, project_id) -> InferenceRegistryCredential +- client.cloud.inference.registry_credentials.replace(credential_name, \*, project_id, \*\*params) -> None + +### Secrets + +Types: + +```python +from gcore.types.cloud.inference import InferenceSecret +``` + +Methods: + +- client.cloud.inference.secrets.create(\*, project_id, \*\*params) -> InferenceSecret +- client.cloud.inference.secrets.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceSecret] +- client.cloud.inference.secrets.delete(secret_name, \*, project_id) -> None +- client.cloud.inference.secrets.get(secret_name, \*, project_id) -> InferenceSecret +- client.cloud.inference.secrets.replace(secret_name, \*, project_id, \*\*params) -> InferenceSecret + ## PlacementGroups Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 7acc474e..17c8bbd8 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -80,6 +80,14 @@ BaremetalResourceWithStreamingResponse, AsyncBaremetalResourceWithStreamingResponse, ) +from .inference import ( + InferenceResource, + AsyncInferenceResource, + InferenceResourceWithRawResponse, + AsyncInferenceResourceWithRawResponse, + InferenceResourceWithStreamingResponse, + AsyncInferenceResourceWithStreamingResponse, +) from .instances import ( InstancesResource, AsyncInstancesResource, @@ -232,6 +240,12 @@ "AsyncSecurityGroupsResourceWithRawResponse", "SecurityGroupsResourceWithStreamingResponse", "AsyncSecurityGroupsResourceWithStreamingResponse", + "InferenceResource", + "AsyncInferenceResource", + "InferenceResourceWithRawResponse", + "AsyncInferenceResourceWithRawResponse", + "InferenceResourceWithStreamingResponse", + "AsyncInferenceResourceWithStreamingResponse", "PlacementGroupsResource", "AsyncPlacementGroupsResource", "PlacementGroupsResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 5a93ea45..64115b3d 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -100,6 +100,14 @@ BaremetalResourceWithStreamingResponse, AsyncBaremetalResourceWithStreamingResponse, ) +from .inference.inference import ( + InferenceResource, + AsyncInferenceResource, + InferenceResourceWithRawResponse, + AsyncInferenceResourceWithRawResponse, + InferenceResourceWithStreamingResponse, + AsyncInferenceResourceWithStreamingResponse, +) from .instances.instances import ( InstancesResource, AsyncInstancesResource, @@ -205,6 +213,10 @@ def floating_ips(self) -> FloatingIPsResource: def security_groups(self) -> SecurityGroupsResource: return SecurityGroupsResource(self._client) + @cached_property + def inference(self) -> InferenceResource: + return InferenceResource(self._client) + @cached_property def placement_groups(self) -> PlacementGroupsResource: return PlacementGroupsResource(self._client) @@ -298,6 +310,10 @@ def floating_ips(self) -> AsyncFloatingIPsResource: def security_groups(self) -> AsyncSecurityGroupsResource: return AsyncSecurityGroupsResource(self._client) + @cached_property + def inference(self) -> AsyncInferenceResource: + return AsyncInferenceResource(self._client) + @cached_property def placement_groups(self) -> AsyncPlacementGroupsResource: return AsyncPlacementGroupsResource(self._client) @@ -394,6 +410,10 @@ def floating_ips(self) -> FloatingIPsResourceWithRawResponse: def security_groups(self) -> SecurityGroupsResourceWithRawResponse: return SecurityGroupsResourceWithRawResponse(self._cloud.security_groups) + @cached_property + def inference(self) -> InferenceResourceWithRawResponse: + return InferenceResourceWithRawResponse(self._cloud.inference) + @cached_property def placement_groups(self) -> PlacementGroupsResourceWithRawResponse: return PlacementGroupsResourceWithRawResponse(self._cloud.placement_groups) @@ -471,6 +491,10 @@ def floating_ips(self) -> AsyncFloatingIPsResourceWithRawResponse: def security_groups(self) -> AsyncSecurityGroupsResourceWithRawResponse: return AsyncSecurityGroupsResourceWithRawResponse(self._cloud.security_groups) + @cached_property + def inference(self) -> AsyncInferenceResourceWithRawResponse: + return AsyncInferenceResourceWithRawResponse(self._cloud.inference) + @cached_property def placement_groups(self) -> AsyncPlacementGroupsResourceWithRawResponse: return AsyncPlacementGroupsResourceWithRawResponse(self._cloud.placement_groups) @@ -548,6 +572,10 @@ def floating_ips(self) -> FloatingIPsResourceWithStreamingResponse: def security_groups(self) -> SecurityGroupsResourceWithStreamingResponse: return SecurityGroupsResourceWithStreamingResponse(self._cloud.security_groups) + @cached_property + def inference(self) -> InferenceResourceWithStreamingResponse: + return InferenceResourceWithStreamingResponse(self._cloud.inference) + @cached_property def placement_groups(self) -> PlacementGroupsResourceWithStreamingResponse: return PlacementGroupsResourceWithStreamingResponse(self._cloud.placement_groups) @@ -625,6 +653,10 @@ def floating_ips(self) -> AsyncFloatingIPsResourceWithStreamingResponse: def security_groups(self) -> AsyncSecurityGroupsResourceWithStreamingResponse: return AsyncSecurityGroupsResourceWithStreamingResponse(self._cloud.security_groups) + @cached_property + def inference(self) -> AsyncInferenceResourceWithStreamingResponse: + return AsyncInferenceResourceWithStreamingResponse(self._cloud.inference) + @cached_property def placement_groups(self) -> AsyncPlacementGroupsResourceWithStreamingResponse: return AsyncPlacementGroupsResourceWithStreamingResponse(self._cloud.placement_groups) diff --git a/src/gcore/resources/cloud/inference/__init__.py b/src/gcore/resources/cloud/inference/__init__.py new file mode 100644 index 00000000..04a7f060 --- /dev/null +++ b/src/gcore/resources/cloud/inference/__init__.py @@ -0,0 +1,89 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .models import ( + ModelsResource, + AsyncModelsResource, + ModelsResourceWithRawResponse, + AsyncModelsResourceWithRawResponse, + ModelsResourceWithStreamingResponse, + AsyncModelsResourceWithStreamingResponse, +) +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .secrets import ( + SecretsResource, + AsyncSecretsResource, + SecretsResourceWithRawResponse, + AsyncSecretsResourceWithRawResponse, + SecretsResourceWithStreamingResponse, + AsyncSecretsResourceWithStreamingResponse, +) +from .inference import ( + InferenceResource, + AsyncInferenceResource, + InferenceResourceWithRawResponse, + AsyncInferenceResourceWithRawResponse, + InferenceResourceWithStreamingResponse, + AsyncInferenceResourceWithStreamingResponse, +) +from .deployments import ( + DeploymentsResource, + AsyncDeploymentsResource, + DeploymentsResourceWithRawResponse, + AsyncDeploymentsResourceWithRawResponse, + DeploymentsResourceWithStreamingResponse, + AsyncDeploymentsResourceWithStreamingResponse, +) +from .registry_credentials import ( + RegistryCredentialsResource, + AsyncRegistryCredentialsResource, + RegistryCredentialsResourceWithRawResponse, + AsyncRegistryCredentialsResourceWithRawResponse, + RegistryCredentialsResourceWithStreamingResponse, + AsyncRegistryCredentialsResourceWithStreamingResponse, +) + +__all__ = [ + "FlavorsResource", + "AsyncFlavorsResource", + "FlavorsResourceWithRawResponse", + "AsyncFlavorsResourceWithRawResponse", + "FlavorsResourceWithStreamingResponse", + "AsyncFlavorsResourceWithStreamingResponse", + "ModelsResource", + "AsyncModelsResource", + "ModelsResourceWithRawResponse", + "AsyncModelsResourceWithRawResponse", + "ModelsResourceWithStreamingResponse", + "AsyncModelsResourceWithStreamingResponse", + "DeploymentsResource", + "AsyncDeploymentsResource", + "DeploymentsResourceWithRawResponse", + "AsyncDeploymentsResourceWithRawResponse", + "DeploymentsResourceWithStreamingResponse", + "AsyncDeploymentsResourceWithStreamingResponse", + "RegistryCredentialsResource", + "AsyncRegistryCredentialsResource", + "RegistryCredentialsResourceWithRawResponse", + "AsyncRegistryCredentialsResourceWithRawResponse", + "RegistryCredentialsResourceWithStreamingResponse", + "AsyncRegistryCredentialsResourceWithStreamingResponse", + "SecretsResource", + "AsyncSecretsResource", + "SecretsResourceWithRawResponse", + "AsyncSecretsResourceWithRawResponse", + "SecretsResourceWithStreamingResponse", + "AsyncSecretsResourceWithStreamingResponse", + "InferenceResource", + "AsyncInferenceResource", + "InferenceResourceWithRawResponse", + "AsyncInferenceResourceWithRawResponse", + "InferenceResourceWithStreamingResponse", + "AsyncInferenceResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/inference/deployments/__init__.py b/src/gcore/resources/cloud/inference/deployments/__init__.py new file mode 100644 index 00000000..7386d04f --- /dev/null +++ b/src/gcore/resources/cloud/inference/deployments/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) +from .deployments import ( + DeploymentsResource, + AsyncDeploymentsResource, + DeploymentsResourceWithRawResponse, + AsyncDeploymentsResourceWithRawResponse, + DeploymentsResourceWithStreamingResponse, + AsyncDeploymentsResourceWithStreamingResponse, +) + +__all__ = [ + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", + "DeploymentsResource", + "AsyncDeploymentsResource", + "DeploymentsResourceWithRawResponse", + "AsyncDeploymentsResourceWithRawResponse", + "DeploymentsResourceWithStreamingResponse", + "AsyncDeploymentsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py new file mode 100644 index 00000000..e0f7c1b2 --- /dev/null +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -0,0 +1,1229 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional + +import httpx + +from .logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) +from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 .....pagination import SyncOffsetPage, AsyncOffsetPage +from ....._base_client import AsyncPaginator, make_request_options +from .....types.cloud.inference import deployment_list_params, deployment_create_params, deployment_update_params +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.ingress_opts_param import IngressOptsParam +from .....types.cloud.inference.inference import Inference +from .....types.cloud.inference.inference_apikey_secret import InferenceApikeySecret + +__all__ = ["DeploymentsResource", "AsyncDeploymentsResource"] + + +class DeploymentsResource(SyncAPIResource): + @cached_property + def logs(self) -> LogsResource: + return LogsResource(self._client) + + @cached_property + def with_raw_response(self) -> DeploymentsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return DeploymentsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DeploymentsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return DeploymentsResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + containers: Iterable[deployment_create_params.Container], + flavor_name: str, + image: str, + listening_port: int, + name: str, + auth_enabled: bool | NotGiven = NOT_GIVEN, + command: Optional[List[str]] | NotGiven = NOT_GIVEN, + credentials_name: Optional[str] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + envs: Dict[str, str] | NotGiven = NOT_GIVEN, + ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN, + logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN, + probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN, + api_timeout: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create inference deployment + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments'].post.parameters[0].schema" + + containers: '#/components/schemas/InferenceInstanceInSerializerV3/properties/containers' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.containers" + + flavor_name: '#/components/schemas/InferenceInstanceInSerializerV3/properties/flavor_name' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.flavor_name" + + image: '#/components/schemas/InferenceInstanceInSerializerV3/properties/image' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.image" + + listening_port: '#/components/schemas/InferenceInstanceInSerializerV3/properties/listening_port' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.listening_port" + + name: '#/components/schemas/InferenceInstanceInSerializerV3/properties/name' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.name" + + auth_enabled: '#/components/schemas/InferenceInstanceInSerializerV3/properties/auth_enabled' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.auth_enabled" + + command: '#/components/schemas/InferenceInstanceInSerializerV3/properties/command/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.command.anyOf[0]" + + credentials_name: '#/components/schemas/InferenceInstanceInSerializerV3/properties/credentials_name/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.credentials_name.anyOf[0]" + + description: '#/components/schemas/InferenceInstanceInSerializerV3/properties/description/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.description.anyOf[0]" + + envs: '#/components/schemas/InferenceInstanceInSerializerV3/properties/envs' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.envs" + + ingress_opts: '#/components/schemas/InferenceInstanceInSerializerV3/properties/ingress_opts/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.ingress_opts.anyOf[0]" + + logging: '#/components/schemas/InferenceInstanceInSerializerV3/properties/logging/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.logging.anyOf[0]" + + probes: '#/components/schemas/InferenceInstanceInSerializerV3/properties/probes/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.probes.anyOf[0]" + + api_timeout: '#/components/schemas/InferenceInstanceInSerializerV3/properties/timeout/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.timeout.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._post( + f"/cloud/v3/inference/{project_id}/deployments", + body=maybe_transform( + { + "containers": containers, + "flavor_name": flavor_name, + "image": image, + "listening_port": listening_port, + "name": name, + "auth_enabled": auth_enabled, + "command": command, + "credentials_name": credentials_name, + "description": description, + "envs": envs, + "ingress_opts": ingress_opts, + "logging": logging, + "probes": probes, + "api_timeout": api_timeout, + }, + deployment_create_params.DeploymentCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + deployment_name: str, + *, + project_id: int | None = None, + auth_enabled: Optional[bool] | NotGiven = NOT_GIVEN, + command: Optional[List[str]] | NotGiven = NOT_GIVEN, + containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, + credentials_name: Optional[str] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + flavor_name: Optional[str] | NotGiven = NOT_GIVEN, + image: Optional[str] | NotGiven = NOT_GIVEN, + ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN, + listening_port: Optional[int] | NotGiven = NOT_GIVEN, + logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN, + probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN, + api_timeout: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Update inference deployment + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/patch/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].patch.parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/patch/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].patch.parameters[1].schema" + + auth_enabled: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/auth_enabled/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.auth_enabled.anyOf[0]" + + command: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/command/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.command.anyOf[0]" + + containers: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/containers/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.containers.anyOf[0]" + + credentials_name: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/credentials_name/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.credentials_name.anyOf[0]" + + description: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/description/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.description.anyOf[0]" + + envs: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/envs/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.envs.anyOf[0]" + + flavor_name: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/flavor_name/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.flavor_name.anyOf[0]" + + image: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/image/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.image.anyOf[0]" + + ingress_opts: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/ingress_opts/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.ingress_opts.anyOf[0]" + + listening_port: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/listening_port/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.listening_port.anyOf[0]" + + logging: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/logging/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.logging.anyOf[0]" + + probes: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/probes/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.probes.anyOf[0]" + + api_timeout: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/timeout/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.timeout.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return self._patch( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + body=maybe_transform( + { + "auth_enabled": auth_enabled, + "command": command, + "containers": containers, + "credentials_name": credentials_name, + "description": description, + "envs": envs, + "flavor_name": flavor_name, + "image": image, + "ingress_opts": ingress_opts, + "listening_port": listening_port, + "logging": logging, + "probes": probes, + "api_timeout": api_timeout, + }, + deployment_update_params.DeploymentUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[Inference]: + """ + List inference deployments + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[0].schema" + + limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/1' + "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[1]" + + offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/2' + "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[2]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._get_api_list( + f"/cloud/v3/inference/{project_id}/deployments", + page=SyncOffsetPage[Inference], + 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, + }, + deployment_list_params.DeploymentListParams, + ), + ), + model=Inference, + ) + + def delete( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete inference deployment + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/delete/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}']['delete'].parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/delete/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}']['delete'].parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return self._delete( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Inference: + """ + Get inference deployment + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].get.parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/get/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return self._get( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Inference, + ) + + def get_api_key( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceApikeySecret: + """ + Get inference deployment API key + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fapikey/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey'].get.parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fapikey/get/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return self._get( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceApikeySecret, + ) + + def start( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + This operation initializes an inference deployment after it was stopped, making + it available to handle inference requests again. The instance will launch with + the **minimum** number of replicas defined in the scaling settings. + + - If the minimum replicas are set to **0**, the instance will initially start + with **0** replicas. + - It will automatically scale up when it receives requests or SQS messages, + according to the configured scaling rules. + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstart/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start'].post.parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstart/post/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start'].post.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def stop( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + This operation shuts down an inference deployment, making it unavailable for + handling requests. The deployment will scale down to **0** replicas, overriding + any minimum replica settings. + + - Once stopped, the deployment will **not** process any inference requests or + SQS messages. + - It will **not** restart automatically and must be started manually. + - While stopped, the deployment will **not** incur any charges. + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstop/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop'].post.parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstop/post/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop'].post.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncDeploymentsResource(AsyncAPIResource): + @cached_property + def logs(self) -> AsyncLogsResource: + return AsyncLogsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncDeploymentsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncDeploymentsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDeploymentsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncDeploymentsResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + containers: Iterable[deployment_create_params.Container], + flavor_name: str, + image: str, + listening_port: int, + name: str, + auth_enabled: bool | NotGiven = NOT_GIVEN, + command: Optional[List[str]] | NotGiven = NOT_GIVEN, + credentials_name: Optional[str] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + envs: Dict[str, str] | NotGiven = NOT_GIVEN, + ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN, + logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN, + probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN, + api_timeout: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create inference deployment + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments'].post.parameters[0].schema" + + containers: '#/components/schemas/InferenceInstanceInSerializerV3/properties/containers' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.containers" + + flavor_name: '#/components/schemas/InferenceInstanceInSerializerV3/properties/flavor_name' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.flavor_name" + + image: '#/components/schemas/InferenceInstanceInSerializerV3/properties/image' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.image" + + listening_port: '#/components/schemas/InferenceInstanceInSerializerV3/properties/listening_port' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.listening_port" + + name: '#/components/schemas/InferenceInstanceInSerializerV3/properties/name' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.name" + + auth_enabled: '#/components/schemas/InferenceInstanceInSerializerV3/properties/auth_enabled' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.auth_enabled" + + command: '#/components/schemas/InferenceInstanceInSerializerV3/properties/command/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.command.anyOf[0]" + + credentials_name: '#/components/schemas/InferenceInstanceInSerializerV3/properties/credentials_name/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.credentials_name.anyOf[0]" + + description: '#/components/schemas/InferenceInstanceInSerializerV3/properties/description/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.description.anyOf[0]" + + envs: '#/components/schemas/InferenceInstanceInSerializerV3/properties/envs' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.envs" + + ingress_opts: '#/components/schemas/InferenceInstanceInSerializerV3/properties/ingress_opts/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.ingress_opts.anyOf[0]" + + logging: '#/components/schemas/InferenceInstanceInSerializerV3/properties/logging/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.logging.anyOf[0]" + + probes: '#/components/schemas/InferenceInstanceInSerializerV3/properties/probes/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.probes.anyOf[0]" + + api_timeout: '#/components/schemas/InferenceInstanceInSerializerV3/properties/timeout/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.timeout.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return await self._post( + f"/cloud/v3/inference/{project_id}/deployments", + body=await async_maybe_transform( + { + "containers": containers, + "flavor_name": flavor_name, + "image": image, + "listening_port": listening_port, + "name": name, + "auth_enabled": auth_enabled, + "command": command, + "credentials_name": credentials_name, + "description": description, + "envs": envs, + "ingress_opts": ingress_opts, + "logging": logging, + "probes": probes, + "api_timeout": api_timeout, + }, + deployment_create_params.DeploymentCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + deployment_name: str, + *, + project_id: int | None = None, + auth_enabled: Optional[bool] | NotGiven = NOT_GIVEN, + command: Optional[List[str]] | NotGiven = NOT_GIVEN, + containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, + credentials_name: Optional[str] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + flavor_name: Optional[str] | NotGiven = NOT_GIVEN, + image: Optional[str] | NotGiven = NOT_GIVEN, + ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN, + listening_port: Optional[int] | NotGiven = NOT_GIVEN, + logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN, + probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN, + api_timeout: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Update inference deployment + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/patch/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].patch.parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/patch/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].patch.parameters[1].schema" + + auth_enabled: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/auth_enabled/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.auth_enabled.anyOf[0]" + + command: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/command/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.command.anyOf[0]" + + containers: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/containers/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.containers.anyOf[0]" + + credentials_name: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/credentials_name/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.credentials_name.anyOf[0]" + + description: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/description/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.description.anyOf[0]" + + envs: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/envs/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.envs.anyOf[0]" + + flavor_name: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/flavor_name/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.flavor_name.anyOf[0]" + + image: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/image/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.image.anyOf[0]" + + ingress_opts: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/ingress_opts/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.ingress_opts.anyOf[0]" + + listening_port: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/listening_port/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.listening_port.anyOf[0]" + + logging: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/logging/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.logging.anyOf[0]" + + probes: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/probes/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.probes.anyOf[0]" + + api_timeout: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/timeout/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.timeout.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return await self._patch( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + body=await async_maybe_transform( + { + "auth_enabled": auth_enabled, + "command": command, + "containers": containers, + "credentials_name": credentials_name, + "description": description, + "envs": envs, + "flavor_name": flavor_name, + "image": image, + "ingress_opts": ingress_opts, + "listening_port": listening_port, + "logging": logging, + "probes": probes, + "api_timeout": api_timeout, + }, + deployment_update_params.DeploymentUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Inference, AsyncOffsetPage[Inference]]: + """ + List inference deployments + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[0].schema" + + limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/1' + "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[1]" + + offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/2' + "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[2]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._get_api_list( + f"/cloud/v3/inference/{project_id}/deployments", + page=AsyncOffsetPage[Inference], + 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, + }, + deployment_list_params.DeploymentListParams, + ), + ), + model=Inference, + ) + + async def delete( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete inference deployment + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/delete/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}']['delete'].parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/delete/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}']['delete'].parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return await self._delete( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Inference: + """ + Get inference deployment + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].get.parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/get/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return await self._get( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Inference, + ) + + async def get_api_key( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceApikeySecret: + """ + Get inference deployment API key + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fapikey/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey'].get.parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fapikey/get/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return await self._get( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceApikeySecret, + ) + + async def start( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + This operation initializes an inference deployment after it was stopped, making + it available to handle inference requests again. The instance will launch with + the **minimum** number of replicas defined in the scaling settings. + + - If the minimum replicas are set to **0**, the instance will initially start + with **0** replicas. + - It will automatically scale up when it receives requests or SQS messages, + according to the configured scaling rules. + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstart/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start'].post.parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstart/post/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start'].post.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def stop( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + This operation shuts down an inference deployment, making it unavailable for + handling requests. The deployment will scale down to **0** replicas, overriding + any minimum replica settings. + + - Once stopped, the deployment will **not** process any inference requests or + SQS messages. + - It will **not** restart automatically and must be started manually. + - While stopped, the deployment will **not** incur any charges. + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstop/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop'].post.parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstop/post/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop'].post.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class DeploymentsResourceWithRawResponse: + def __init__(self, deployments: DeploymentsResource) -> None: + self._deployments = deployments + + self.create = to_raw_response_wrapper( + deployments.create, + ) + self.update = to_raw_response_wrapper( + deployments.update, + ) + self.list = to_raw_response_wrapper( + deployments.list, + ) + self.delete = to_raw_response_wrapper( + deployments.delete, + ) + self.get = to_raw_response_wrapper( + deployments.get, + ) + self.get_api_key = to_raw_response_wrapper( + deployments.get_api_key, + ) + self.start = to_raw_response_wrapper( + deployments.start, + ) + self.stop = to_raw_response_wrapper( + deployments.stop, + ) + + @cached_property + def logs(self) -> LogsResourceWithRawResponse: + return LogsResourceWithRawResponse(self._deployments.logs) + + +class AsyncDeploymentsResourceWithRawResponse: + def __init__(self, deployments: AsyncDeploymentsResource) -> None: + self._deployments = deployments + + self.create = async_to_raw_response_wrapper( + deployments.create, + ) + self.update = async_to_raw_response_wrapper( + deployments.update, + ) + self.list = async_to_raw_response_wrapper( + deployments.list, + ) + self.delete = async_to_raw_response_wrapper( + deployments.delete, + ) + self.get = async_to_raw_response_wrapper( + deployments.get, + ) + self.get_api_key = async_to_raw_response_wrapper( + deployments.get_api_key, + ) + self.start = async_to_raw_response_wrapper( + deployments.start, + ) + self.stop = async_to_raw_response_wrapper( + deployments.stop, + ) + + @cached_property + def logs(self) -> AsyncLogsResourceWithRawResponse: + return AsyncLogsResourceWithRawResponse(self._deployments.logs) + + +class DeploymentsResourceWithStreamingResponse: + def __init__(self, deployments: DeploymentsResource) -> None: + self._deployments = deployments + + self.create = to_streamed_response_wrapper( + deployments.create, + ) + self.update = to_streamed_response_wrapper( + deployments.update, + ) + self.list = to_streamed_response_wrapper( + deployments.list, + ) + self.delete = to_streamed_response_wrapper( + deployments.delete, + ) + self.get = to_streamed_response_wrapper( + deployments.get, + ) + self.get_api_key = to_streamed_response_wrapper( + deployments.get_api_key, + ) + self.start = to_streamed_response_wrapper( + deployments.start, + ) + self.stop = to_streamed_response_wrapper( + deployments.stop, + ) + + @cached_property + def logs(self) -> LogsResourceWithStreamingResponse: + return LogsResourceWithStreamingResponse(self._deployments.logs) + + +class AsyncDeploymentsResourceWithStreamingResponse: + def __init__(self, deployments: AsyncDeploymentsResource) -> None: + self._deployments = deployments + + self.create = async_to_streamed_response_wrapper( + deployments.create, + ) + self.update = async_to_streamed_response_wrapper( + deployments.update, + ) + self.list = async_to_streamed_response_wrapper( + deployments.list, + ) + self.delete = async_to_streamed_response_wrapper( + deployments.delete, + ) + self.get = async_to_streamed_response_wrapper( + deployments.get, + ) + self.get_api_key = async_to_streamed_response_wrapper( + deployments.get_api_key, + ) + self.start = async_to_streamed_response_wrapper( + deployments.start, + ) + self.stop = async_to_streamed_response_wrapper( + deployments.stop, + ) + + @cached_property + def logs(self) -> AsyncLogsResourceWithStreamingResponse: + return AsyncLogsResourceWithStreamingResponse(self._deployments.logs) diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py new file mode 100644 index 00000000..c721e180 --- /dev/null +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -0,0 +1,245 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .....pagination import SyncOffsetPage, AsyncOffsetPage +from ....._base_client import AsyncPaginator, make_request_options +from .....types.cloud.inference.deployments import log_list_params +from .....types.cloud.inference.inference_log import InferenceLog + +__all__ = ["LogsResource", "AsyncLogsResource"] + + +class LogsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> LogsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return LogsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LogsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return LogsResourceWithStreamingResponse(self) + + def list( + self, + deployment_name: str, + *, + project_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: Literal["time.asc", "time.desc"] | NotGiven = NOT_GIVEN, + region_id: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[InferenceLog]: + """ + Get inference deployment logs + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/2' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[2]" + + offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/3' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[3]" + + order_by: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/4' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[4]" + + region_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/5/schema/anyOf/0' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[5].schema.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return self._get_api_list( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + page=SyncOffsetPage[InferenceLog], + 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, + "region_id": region_id, + }, + log_list_params.LogListParams, + ), + ), + model=InferenceLog, + ) + + +class AsyncLogsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncLogsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncLogsResourceWithStreamingResponse(self) + + def list( + self, + deployment_name: str, + *, + project_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: Literal["time.asc", "time.desc"] | NotGiven = NOT_GIVEN, + region_id: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[InferenceLog, AsyncOffsetPage[InferenceLog]]: + """ + Get inference deployment logs + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[0].schema" + + deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/2' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[2]" + + offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/3' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[3]" + + order_by: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/4' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[4]" + + region_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/5/schema/anyOf/0' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[5].schema.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return self._get_api_list( + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + page=AsyncOffsetPage[InferenceLog], + 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, + "region_id": region_id, + }, + log_list_params.LogListParams, + ), + ), + model=InferenceLog, + ) + + +class LogsResourceWithRawResponse: + def __init__(self, logs: LogsResource) -> None: + self._logs = logs + + self.list = to_raw_response_wrapper( + logs.list, + ) + + +class AsyncLogsResourceWithRawResponse: + def __init__(self, logs: AsyncLogsResource) -> None: + self._logs = logs + + self.list = async_to_raw_response_wrapper( + logs.list, + ) + + +class LogsResourceWithStreamingResponse: + def __init__(self, logs: LogsResource) -> None: + self._logs = logs + + self.list = to_streamed_response_wrapper( + logs.list, + ) + + +class AsyncLogsResourceWithStreamingResponse: + def __init__(self, logs: AsyncLogsResource) -> None: + self._logs = logs + + self.list = async_to_streamed_response_wrapper( + logs.list, + ) diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py new file mode 100644 index 00000000..62a71e7c --- /dev/null +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -0,0 +1,282 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.inference import flavor_list_params +from ....types.cloud.inference.inference_flavor import InferenceFlavor + +__all__ = ["FlavorsResource", "AsyncFlavorsResource"] + + +class FlavorsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FlavorsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return FlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return FlavorsResourceWithStreamingResponse(self) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[InferenceFlavor]: + """ + List inference flavors + + Args: + limit: '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors/get/parameters/0' + "$.paths['/cloud/v3/inference/flavors'].get.parameters[0]" + + offset: '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors/get/parameters/1' + "$.paths['/cloud/v3/inference/flavors'].get.parameters[1]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v3/inference/flavors", + page=SyncOffsetPage[InferenceFlavor], + 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, + }, + flavor_list_params.FlavorListParams, + ), + ), + model=InferenceFlavor, + ) + + def get( + self, + flavor_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, + ) -> InferenceFlavor: + """ + Get inference flavor + + Args: + flavor_name: '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors%2F%7Bflavor_name%7D/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/flavors/{flavor_name}'].get.parameters[0].schema" + + 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 flavor_name: + raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") + return self._get( + f"/cloud/v3/inference/flavors/{flavor_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceFlavor, + ) + + +class AsyncFlavorsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFlavorsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncFlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncFlavorsResourceWithStreamingResponse(self) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[InferenceFlavor, AsyncOffsetPage[InferenceFlavor]]: + """ + List inference flavors + + Args: + limit: '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors/get/parameters/0' + "$.paths['/cloud/v3/inference/flavors'].get.parameters[0]" + + offset: '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors/get/parameters/1' + "$.paths['/cloud/v3/inference/flavors'].get.parameters[1]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v3/inference/flavors", + page=AsyncOffsetPage[InferenceFlavor], + 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, + }, + flavor_list_params.FlavorListParams, + ), + ), + model=InferenceFlavor, + ) + + async def get( + self, + flavor_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, + ) -> InferenceFlavor: + """ + Get inference flavor + + Args: + flavor_name: '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors%2F%7Bflavor_name%7D/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/flavors/{flavor_name}'].get.parameters[0].schema" + + 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 flavor_name: + raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") + return await self._get( + f"/cloud/v3/inference/flavors/{flavor_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceFlavor, + ) + + +class FlavorsResourceWithRawResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_raw_response_wrapper( + flavors.list, + ) + self.get = to_raw_response_wrapper( + flavors.get, + ) + + +class AsyncFlavorsResourceWithRawResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_raw_response_wrapper( + flavors.list, + ) + self.get = async_to_raw_response_wrapper( + flavors.get, + ) + + +class FlavorsResourceWithStreamingResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_streamed_response_wrapper( + flavors.list, + ) + self.get = to_streamed_response_wrapper( + flavors.get, + ) + + +class AsyncFlavorsResourceWithStreamingResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_streamed_response_wrapper( + flavors.list, + ) + self.get = async_to_streamed_response_wrapper( + flavors.get, + ) diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py new file mode 100644 index 00000000..f32fa46c --- /dev/null +++ b/src/gcore/resources/cloud/inference/inference.py @@ -0,0 +1,295 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .models import ( + ModelsResource, + AsyncModelsResource, + ModelsResourceWithRawResponse, + AsyncModelsResourceWithRawResponse, + ModelsResourceWithStreamingResponse, + AsyncModelsResourceWithStreamingResponse, +) +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .secrets import ( + SecretsResource, + AsyncSecretsResource, + SecretsResourceWithRawResponse, + AsyncSecretsResourceWithRawResponse, + SecretsResourceWithStreamingResponse, + AsyncSecretsResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from .registry_credentials import ( + RegistryCredentialsResource, + AsyncRegistryCredentialsResource, + RegistryCredentialsResourceWithRawResponse, + AsyncRegistryCredentialsResourceWithRawResponse, + RegistryCredentialsResourceWithStreamingResponse, + AsyncRegistryCredentialsResourceWithStreamingResponse, +) +from .deployments.deployments import ( + DeploymentsResource, + AsyncDeploymentsResource, + DeploymentsResourceWithRawResponse, + AsyncDeploymentsResourceWithRawResponse, + DeploymentsResourceWithStreamingResponse, + AsyncDeploymentsResourceWithStreamingResponse, +) +from ....types.cloud.region_capacity_list import RegionCapacityList + +__all__ = ["InferenceResource", "AsyncInferenceResource"] + + +class InferenceResource(SyncAPIResource): + @cached_property + def flavors(self) -> FlavorsResource: + return FlavorsResource(self._client) + + @cached_property + def models(self) -> ModelsResource: + return ModelsResource(self._client) + + @cached_property + def deployments(self) -> DeploymentsResource: + return DeploymentsResource(self._client) + + @cached_property + def registry_credentials(self) -> RegistryCredentialsResource: + return RegistryCredentialsResource(self._client) + + @cached_property + def secrets(self) -> SecretsResource: + return SecretsResource(self._client) + + @cached_property + def with_raw_response(self) -> InferenceResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return InferenceResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InferenceResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return InferenceResourceWithStreamingResponse(self) + + def get_capacity_by_region( + 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, + ) -> RegionCapacityList: + """Get inference capacity by region""" + return self._get( + "/cloud/v3/inference/capacity", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegionCapacityList, + ) + + +class AsyncInferenceResource(AsyncAPIResource): + @cached_property + def flavors(self) -> AsyncFlavorsResource: + return AsyncFlavorsResource(self._client) + + @cached_property + def models(self) -> AsyncModelsResource: + return AsyncModelsResource(self._client) + + @cached_property + def deployments(self) -> AsyncDeploymentsResource: + return AsyncDeploymentsResource(self._client) + + @cached_property + def registry_credentials(self) -> AsyncRegistryCredentialsResource: + return AsyncRegistryCredentialsResource(self._client) + + @cached_property + def secrets(self) -> AsyncSecretsResource: + return AsyncSecretsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncInferenceResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncInferenceResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInferenceResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncInferenceResourceWithStreamingResponse(self) + + async def get_capacity_by_region( + 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, + ) -> RegionCapacityList: + """Get inference capacity by region""" + return await self._get( + "/cloud/v3/inference/capacity", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegionCapacityList, + ) + + +class InferenceResourceWithRawResponse: + def __init__(self, inference: InferenceResource) -> None: + self._inference = inference + + self.get_capacity_by_region = to_raw_response_wrapper( + inference.get_capacity_by_region, + ) + + @cached_property + def flavors(self) -> FlavorsResourceWithRawResponse: + return FlavorsResourceWithRawResponse(self._inference.flavors) + + @cached_property + def models(self) -> ModelsResourceWithRawResponse: + return ModelsResourceWithRawResponse(self._inference.models) + + @cached_property + def deployments(self) -> DeploymentsResourceWithRawResponse: + return DeploymentsResourceWithRawResponse(self._inference.deployments) + + @cached_property + def registry_credentials(self) -> RegistryCredentialsResourceWithRawResponse: + return RegistryCredentialsResourceWithRawResponse(self._inference.registry_credentials) + + @cached_property + def secrets(self) -> SecretsResourceWithRawResponse: + return SecretsResourceWithRawResponse(self._inference.secrets) + + +class AsyncInferenceResourceWithRawResponse: + def __init__(self, inference: AsyncInferenceResource) -> None: + self._inference = inference + + self.get_capacity_by_region = async_to_raw_response_wrapper( + inference.get_capacity_by_region, + ) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithRawResponse: + return AsyncFlavorsResourceWithRawResponse(self._inference.flavors) + + @cached_property + def models(self) -> AsyncModelsResourceWithRawResponse: + return AsyncModelsResourceWithRawResponse(self._inference.models) + + @cached_property + def deployments(self) -> AsyncDeploymentsResourceWithRawResponse: + return AsyncDeploymentsResourceWithRawResponse(self._inference.deployments) + + @cached_property + def registry_credentials(self) -> AsyncRegistryCredentialsResourceWithRawResponse: + return AsyncRegistryCredentialsResourceWithRawResponse(self._inference.registry_credentials) + + @cached_property + def secrets(self) -> AsyncSecretsResourceWithRawResponse: + return AsyncSecretsResourceWithRawResponse(self._inference.secrets) + + +class InferenceResourceWithStreamingResponse: + def __init__(self, inference: InferenceResource) -> None: + self._inference = inference + + self.get_capacity_by_region = to_streamed_response_wrapper( + inference.get_capacity_by_region, + ) + + @cached_property + def flavors(self) -> FlavorsResourceWithStreamingResponse: + return FlavorsResourceWithStreamingResponse(self._inference.flavors) + + @cached_property + def models(self) -> ModelsResourceWithStreamingResponse: + return ModelsResourceWithStreamingResponse(self._inference.models) + + @cached_property + def deployments(self) -> DeploymentsResourceWithStreamingResponse: + return DeploymentsResourceWithStreamingResponse(self._inference.deployments) + + @cached_property + def registry_credentials(self) -> RegistryCredentialsResourceWithStreamingResponse: + return RegistryCredentialsResourceWithStreamingResponse(self._inference.registry_credentials) + + @cached_property + def secrets(self) -> SecretsResourceWithStreamingResponse: + return SecretsResourceWithStreamingResponse(self._inference.secrets) + + +class AsyncInferenceResourceWithStreamingResponse: + def __init__(self, inference: AsyncInferenceResource) -> None: + self._inference = inference + + self.get_capacity_by_region = async_to_streamed_response_wrapper( + inference.get_capacity_by_region, + ) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse: + return AsyncFlavorsResourceWithStreamingResponse(self._inference.flavors) + + @cached_property + def models(self) -> AsyncModelsResourceWithStreamingResponse: + return AsyncModelsResourceWithStreamingResponse(self._inference.models) + + @cached_property + def deployments(self) -> AsyncDeploymentsResourceWithStreamingResponse: + return AsyncDeploymentsResourceWithStreamingResponse(self._inference.deployments) + + @cached_property + def registry_credentials(self) -> AsyncRegistryCredentialsResourceWithStreamingResponse: + return AsyncRegistryCredentialsResourceWithStreamingResponse(self._inference.registry_credentials) + + @cached_property + def secrets(self) -> AsyncSecretsResourceWithStreamingResponse: + return AsyncSecretsResourceWithStreamingResponse(self._inference.secrets) diff --git a/src/gcore/resources/cloud/inference/models.py b/src/gcore/resources/cloud/inference/models.py new file mode 100644 index 00000000..4ea98ece --- /dev/null +++ b/src/gcore/resources/cloud/inference/models.py @@ -0,0 +1,293 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.inference import MlcatalogOrderByChoices, model_list_params +from ....types.cloud.inference.mlcatalog_model_card import MlcatalogModelCard +from ....types.cloud.inference.mlcatalog_order_by_choices import MlcatalogOrderByChoices + +__all__ = ["ModelsResource", "AsyncModelsResource"] + + +class ModelsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ModelsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return ModelsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ModelsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return ModelsResourceWithStreamingResponse(self) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: MlcatalogOrderByChoices | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[MlcatalogModelCard]: + """ + List models from catalog + + Args: + limit: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/0' + "$.paths['/cloud/v3/inference/models'].get.parameters[0]" + + offset: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/1' + "$.paths['/cloud/v3/inference/models'].get.parameters[1]" + + order_by: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/2' + "$.paths['/cloud/v3/inference/models'].get.parameters[2]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v3/inference/models", + page=SyncOffsetPage[MlcatalogModelCard], + 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, + }, + model_list_params.ModelListParams, + ), + ), + model=MlcatalogModelCard, + ) + + def get( + self, + model_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> MlcatalogModelCard: + """ + Get model from catalog + + Args: + model_id: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels%2F%7Bmodel_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/models/{model_id}'].get.parameters[0].schema" + + 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 model_id: + raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}") + return self._get( + f"/cloud/v3/inference/models/{model_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=MlcatalogModelCard, + ) + + +class AsyncModelsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncModelsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncModelsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncModelsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncModelsResourceWithStreamingResponse(self) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: MlcatalogOrderByChoices | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[MlcatalogModelCard, AsyncOffsetPage[MlcatalogModelCard]]: + """ + List models from catalog + + Args: + limit: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/0' + "$.paths['/cloud/v3/inference/models'].get.parameters[0]" + + offset: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/1' + "$.paths['/cloud/v3/inference/models'].get.parameters[1]" + + order_by: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/2' + "$.paths['/cloud/v3/inference/models'].get.parameters[2]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v3/inference/models", + page=AsyncOffsetPage[MlcatalogModelCard], + 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, + }, + model_list_params.ModelListParams, + ), + ), + model=MlcatalogModelCard, + ) + + async def get( + self, + model_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> MlcatalogModelCard: + """ + Get model from catalog + + Args: + model_id: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels%2F%7Bmodel_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/models/{model_id}'].get.parameters[0].schema" + + 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 model_id: + raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}") + return await self._get( + f"/cloud/v3/inference/models/{model_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=MlcatalogModelCard, + ) + + +class ModelsResourceWithRawResponse: + def __init__(self, models: ModelsResource) -> None: + self._models = models + + self.list = to_raw_response_wrapper( + models.list, + ) + self.get = to_raw_response_wrapper( + models.get, + ) + + +class AsyncModelsResourceWithRawResponse: + def __init__(self, models: AsyncModelsResource) -> None: + self._models = models + + self.list = async_to_raw_response_wrapper( + models.list, + ) + self.get = async_to_raw_response_wrapper( + models.get, + ) + + +class ModelsResourceWithStreamingResponse: + def __init__(self, models: ModelsResource) -> None: + self._models = models + + self.list = to_streamed_response_wrapper( + models.list, + ) + self.get = to_streamed_response_wrapper( + models.get, + ) + + +class AsyncModelsResourceWithStreamingResponse: + def __init__(self, models: AsyncModelsResource) -> None: + self._models = models + + self.list = async_to_streamed_response_wrapper( + models.list, + ) + self.get = async_to_streamed_response_wrapper( + models.get, + ) diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py new file mode 100644 index 00000000..2d92bc62 --- /dev/null +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -0,0 +1,681 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.inference import ( + registry_credential_list_params, + registry_credential_create_params, + registry_credential_replace_params, +) +from ....types.cloud.inference.inference_registry_credential import InferenceRegistryCredential +from ....types.cloud.inference.inference_registry_credential_full import InferenceRegistryCredentialFull + +__all__ = ["RegistryCredentialsResource", "AsyncRegistryCredentialsResource"] + + +class RegistryCredentialsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RegistryCredentialsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return RegistryCredentialsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RegistryCredentialsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return RegistryCredentialsResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + name: str, + password: str, + registry_url: str, + username: 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, + ) -> InferenceRegistryCredentialFull: + """ + Create inference registry credential + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].post.parameters[0].schema" + + name: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/name' + "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.name" + + password: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/password' + "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.password" + + registry_url: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/registry_url' + "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.registry_url" + + username: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/username' + "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.username" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._post( + f"/cloud/v3/inference/{project_id}/registry_credentials", + body=maybe_transform( + { + "name": name, + "password": password, + "registry_url": registry_url, + "username": username, + }, + registry_credential_create_params.RegistryCredentialCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceRegistryCredentialFull, + ) + + def list( + self, + *, + project_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[InferenceRegistryCredential]: + """ + List inference registry credentials + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[0].schema" + + limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/1' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[1]" + + offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/2' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[2]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._get_api_list( + f"/cloud/v3/inference/{project_id}/registry_credentials", + page=SyncOffsetPage[InferenceRegistryCredential], + 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, + }, + registry_credential_list_params.RegistryCredentialListParams, + ), + ), + model=InferenceRegistryCredential, + ) + + def delete( + self, + credential_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete inference registry credential + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/delete/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}']['delete'].parameters[0].schema" + + credential_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/delete/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}']['delete'].parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not credential_name: + raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + credential_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceRegistryCredential: + """ + Get inference registry credential + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].get.parameters[0].schema" + + credential_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/get/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not credential_name: + raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") + return self._get( + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceRegistryCredential, + ) + + def replace( + self, + credential_name: str, + *, + project_id: int | None = None, + password: str, + registry_url: str, + username: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Update inference registry credential + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/put/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].put.parameters[0].schema" + + credential_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/put/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].put.parameters[1].schema" + + password: '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/password' + "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.password" + + registry_url: '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/registry_url' + "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.registry_url" + + username: '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/username' + "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.username" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not credential_name: + raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._put( + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + body=maybe_transform( + { + "password": password, + "registry_url": registry_url, + "username": username, + }, + registry_credential_replace_params.RegistryCredentialReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncRegistryCredentialsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRegistryCredentialsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRegistryCredentialsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRegistryCredentialsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncRegistryCredentialsResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + name: str, + password: str, + registry_url: str, + username: 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, + ) -> InferenceRegistryCredentialFull: + """ + Create inference registry credential + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].post.parameters[0].schema" + + name: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/name' + "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.name" + + password: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/password' + "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.password" + + registry_url: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/registry_url' + "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.registry_url" + + username: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/username' + "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.username" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return await self._post( + f"/cloud/v3/inference/{project_id}/registry_credentials", + body=await async_maybe_transform( + { + "name": name, + "password": password, + "registry_url": registry_url, + "username": username, + }, + registry_credential_create_params.RegistryCredentialCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceRegistryCredentialFull, + ) + + def list( + self, + *, + project_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[InferenceRegistryCredential, AsyncOffsetPage[InferenceRegistryCredential]]: + """ + List inference registry credentials + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[0].schema" + + limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/1' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[1]" + + offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/2' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[2]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._get_api_list( + f"/cloud/v3/inference/{project_id}/registry_credentials", + page=AsyncOffsetPage[InferenceRegistryCredential], + 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, + }, + registry_credential_list_params.RegistryCredentialListParams, + ), + ), + model=InferenceRegistryCredential, + ) + + async def delete( + self, + credential_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete inference registry credential + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/delete/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}']['delete'].parameters[0].schema" + + credential_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/delete/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}']['delete'].parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not credential_name: + raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + credential_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceRegistryCredential: + """ + Get inference registry credential + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].get.parameters[0].schema" + + credential_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/get/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not credential_name: + raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") + return await self._get( + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceRegistryCredential, + ) + + async def replace( + self, + credential_name: str, + *, + project_id: int | None = None, + password: str, + registry_url: str, + username: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Update inference registry credential + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/put/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].put.parameters[0].schema" + + credential_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/put/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].put.parameters[1].schema" + + password: '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/password' + "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.password" + + registry_url: '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/registry_url' + "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.registry_url" + + username: '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/username' + "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.username" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not credential_name: + raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._put( + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + body=await async_maybe_transform( + { + "password": password, + "registry_url": registry_url, + "username": username, + }, + registry_credential_replace_params.RegistryCredentialReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class RegistryCredentialsResourceWithRawResponse: + def __init__(self, registry_credentials: RegistryCredentialsResource) -> None: + self._registry_credentials = registry_credentials + + self.create = to_raw_response_wrapper( + registry_credentials.create, + ) + self.list = to_raw_response_wrapper( + registry_credentials.list, + ) + self.delete = to_raw_response_wrapper( + registry_credentials.delete, + ) + self.get = to_raw_response_wrapper( + registry_credentials.get, + ) + self.replace = to_raw_response_wrapper( + registry_credentials.replace, + ) + + +class AsyncRegistryCredentialsResourceWithRawResponse: + def __init__(self, registry_credentials: AsyncRegistryCredentialsResource) -> None: + self._registry_credentials = registry_credentials + + self.create = async_to_raw_response_wrapper( + registry_credentials.create, + ) + self.list = async_to_raw_response_wrapper( + registry_credentials.list, + ) + self.delete = async_to_raw_response_wrapper( + registry_credentials.delete, + ) + self.get = async_to_raw_response_wrapper( + registry_credentials.get, + ) + self.replace = async_to_raw_response_wrapper( + registry_credentials.replace, + ) + + +class RegistryCredentialsResourceWithStreamingResponse: + def __init__(self, registry_credentials: RegistryCredentialsResource) -> None: + self._registry_credentials = registry_credentials + + self.create = to_streamed_response_wrapper( + registry_credentials.create, + ) + self.list = to_streamed_response_wrapper( + registry_credentials.list, + ) + self.delete = to_streamed_response_wrapper( + registry_credentials.delete, + ) + self.get = to_streamed_response_wrapper( + registry_credentials.get, + ) + self.replace = to_streamed_response_wrapper( + registry_credentials.replace, + ) + + +class AsyncRegistryCredentialsResourceWithStreamingResponse: + def __init__(self, registry_credentials: AsyncRegistryCredentialsResource) -> None: + self._registry_credentials = registry_credentials + + self.create = async_to_streamed_response_wrapper( + registry_credentials.create, + ) + self.list = async_to_streamed_response_wrapper( + registry_credentials.list, + ) + self.delete = async_to_streamed_response_wrapper( + registry_credentials.delete, + ) + self.get = async_to_streamed_response_wrapper( + registry_credentials.get, + ) + self.replace = async_to_streamed_response_wrapper( + registry_credentials.replace, + ) diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py new file mode 100644 index 00000000..ac0e5255 --- /dev/null +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -0,0 +1,655 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.inference import secret_list_params, secret_create_params, secret_replace_params +from ....types.cloud.aws_iam_data_param import AwsIamDataParam +from ....types.cloud.inference.inference_secret import InferenceSecret + +__all__ = ["SecretsResource", "AsyncSecretsResource"] + + +class SecretsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SecretsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return SecretsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SecretsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return SecretsResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + data: AwsIamDataParam, + name: str, + type: 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, + ) -> InferenceSecret: + """ + Create Inference Secret + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets'].post.parameters[0].schema" + + data: '#/components/schemas/InferenceBoxSecretsInSerializer/properties/data' + "$.components.schemas.InferenceBoxSecretsInSerializer.properties.data" + + name: '#/components/schemas/InferenceBoxSecretsInSerializer/properties/name' + "$.components.schemas.InferenceBoxSecretsInSerializer.properties.name" + + type: '#/components/schemas/InferenceBoxSecretsInSerializer/properties/type' + "$.components.schemas.InferenceBoxSecretsInSerializer.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._post( + f"/cloud/v3/inference/{project_id}/secrets", + body=maybe_transform( + { + "data": data, + "name": name, + "type": type, + }, + secret_create_params.SecretCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceSecret, + ) + + def list( + self, + *, + project_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[InferenceSecret]: + """ + List Secrets for Inference + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[0].schema" + + limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/1' + "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[1]" + + offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/2' + "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[2]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._get_api_list( + f"/cloud/v3/inference/{project_id}/secrets", + page=SyncOffsetPage[InferenceSecret], + 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, + }, + secret_list_params.SecretListParams, + ), + ), + model=InferenceSecret, + ) + + def delete( + self, + secret_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete Inference Secret + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/delete/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}']['delete'].parameters[0].schema" + + secret_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/delete/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}']['delete'].parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not secret_name: + raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + secret_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceSecret: + """ + Get Inference Secret + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].get.parameters[0].schema" + + secret_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/get/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not secret_name: + raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") + return self._get( + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceSecret, + ) + + def replace( + self, + secret_name: str, + *, + project_id: int | None = None, + data: AwsIamDataParam, + type: 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, + ) -> InferenceSecret: + """ + Update Inference Secret + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/put/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].put.parameters[0].schema" + + secret_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/put/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].put.parameters[1].schema" + + data: '#/components/schemas/InferenceSecretInUpdateSerializer/properties/data' + "$.components.schemas.InferenceSecretInUpdateSerializer.properties.data" + + type: '#/components/schemas/InferenceSecretInUpdateSerializer/properties/type' + "$.components.schemas.InferenceSecretInUpdateSerializer.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not secret_name: + raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") + return self._put( + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + body=maybe_transform( + { + "data": data, + "type": type, + }, + secret_replace_params.SecretReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceSecret, + ) + + +class AsyncSecretsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSecretsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncSecretsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSecretsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncSecretsResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + data: AwsIamDataParam, + name: str, + type: 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, + ) -> InferenceSecret: + """ + Create Inference Secret + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets'].post.parameters[0].schema" + + data: '#/components/schemas/InferenceBoxSecretsInSerializer/properties/data' + "$.components.schemas.InferenceBoxSecretsInSerializer.properties.data" + + name: '#/components/schemas/InferenceBoxSecretsInSerializer/properties/name' + "$.components.schemas.InferenceBoxSecretsInSerializer.properties.name" + + type: '#/components/schemas/InferenceBoxSecretsInSerializer/properties/type' + "$.components.schemas.InferenceBoxSecretsInSerializer.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return await self._post( + f"/cloud/v3/inference/{project_id}/secrets", + body=await async_maybe_transform( + { + "data": data, + "name": name, + "type": type, + }, + secret_create_params.SecretCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceSecret, + ) + + def list( + self, + *, + project_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[InferenceSecret, AsyncOffsetPage[InferenceSecret]]: + """ + List Secrets for Inference + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[0].schema" + + limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/1' + "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[1]" + + offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/2' + "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[2]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._get_api_list( + f"/cloud/v3/inference/{project_id}/secrets", + page=AsyncOffsetPage[InferenceSecret], + 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, + }, + secret_list_params.SecretListParams, + ), + ), + model=InferenceSecret, + ) + + async def delete( + self, + secret_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete Inference Secret + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/delete/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}']['delete'].parameters[0].schema" + + secret_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/delete/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}']['delete'].parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not secret_name: + raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + secret_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceSecret: + """ + Get Inference Secret + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].get.parameters[0].schema" + + secret_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/get/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not secret_name: + raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") + return await self._get( + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceSecret, + ) + + async def replace( + self, + secret_name: str, + *, + project_id: int | None = None, + data: AwsIamDataParam, + type: 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, + ) -> InferenceSecret: + """ + Update Inference Secret + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/put/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].put.parameters[0].schema" + + secret_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/put/parameters/1/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].put.parameters[1].schema" + + data: '#/components/schemas/InferenceSecretInUpdateSerializer/properties/data' + "$.components.schemas.InferenceSecretInUpdateSerializer.properties.data" + + type: '#/components/schemas/InferenceSecretInUpdateSerializer/properties/type' + "$.components.schemas.InferenceSecretInUpdateSerializer.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not secret_name: + raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") + return await self._put( + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + body=await async_maybe_transform( + { + "data": data, + "type": type, + }, + secret_replace_params.SecretReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceSecret, + ) + + +class SecretsResourceWithRawResponse: + def __init__(self, secrets: SecretsResource) -> None: + self._secrets = secrets + + self.create = to_raw_response_wrapper( + secrets.create, + ) + self.list = to_raw_response_wrapper( + secrets.list, + ) + self.delete = to_raw_response_wrapper( + secrets.delete, + ) + self.get = to_raw_response_wrapper( + secrets.get, + ) + self.replace = to_raw_response_wrapper( + secrets.replace, + ) + + +class AsyncSecretsResourceWithRawResponse: + def __init__(self, secrets: AsyncSecretsResource) -> None: + self._secrets = secrets + + self.create = async_to_raw_response_wrapper( + secrets.create, + ) + self.list = async_to_raw_response_wrapper( + secrets.list, + ) + self.delete = async_to_raw_response_wrapper( + secrets.delete, + ) + self.get = async_to_raw_response_wrapper( + secrets.get, + ) + self.replace = async_to_raw_response_wrapper( + secrets.replace, + ) + + +class SecretsResourceWithStreamingResponse: + def __init__(self, secrets: SecretsResource) -> None: + self._secrets = secrets + + self.create = to_streamed_response_wrapper( + secrets.create, + ) + self.list = to_streamed_response_wrapper( + secrets.list, + ) + self.delete = to_streamed_response_wrapper( + secrets.delete, + ) + self.get = to_streamed_response_wrapper( + secrets.get, + ) + self.replace = to_streamed_response_wrapper( + secrets.replace, + ) + + +class AsyncSecretsResourceWithStreamingResponse: + def __init__(self, secrets: AsyncSecretsResource) -> None: + self._secrets = secrets + + self.create = async_to_streamed_response_wrapper( + secrets.create, + ) + self.list = async_to_streamed_response_wrapper( + secrets.list, + ) + self.delete = async_to_streamed_response_wrapper( + secrets.delete, + ) + self.get = async_to_streamed_response_wrapper( + secrets.get, + ) + self.replace = async_to_streamed_response_wrapper( + secrets.replace, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 9de7b4cb..9214b40a 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -10,9 +10,11 @@ from .subnet import Subnet as Subnet from .volume import Volume as Volume from .l7_rule import L7Rule as L7Rule +from .logging import Logging as Logging from .network import Network as Network from .project import Project as Project from .ssh_key import SSHKey as SSHKey +from .capacity import Capacity as Capacity from .ip_ranges import IPRanges as IPRanges from .l7_policy import L7Policy as L7Policy from .file_share import FileShare as FileShare @@ -22,26 +24,35 @@ from .http_method import HTTPMethod as HTTPMethod from .lb_listener import LbListener as LbListener from .pool_status import PoolStatus as PoolStatus +from .aws_iam_data import AwsIamData as AwsIamData from .ddos_profile import DDOSProfile as DDOSProfile from .l7_rule_list import L7RuleList as L7RuleList from .lb_algorithm import LbAlgorithm as LbAlgorithm from .task_id_list import TaskIDList as TaskIDList +from .deploy_status import DeployStatus as DeployStatus from .load_balancer import LoadBalancer as LoadBalancer from .member_status import MemberStatus as MemberStatus from .l7_policy_list import L7PolicyList as L7PolicyList from .lb_flavor_list import LbFlavorList as LbFlavorList from .security_group import SecurityGroup as SecurityGroup +from .container_probe import ContainerProbe as ContainerProbe +from .container_scale import ContainerScale as ContainerScale from .listener_status import ListenerStatus as ListenerStatus from .placement_group import PlacementGroup as PlacementGroup +from .region_capacity import RegionCapacity as RegionCapacity from .ssh_key_created import SSHKeyCreated as SSHKeyCreated from .detailed_lb_pool import DetailedLbPool as DetailedLbPool +from .inference_probes import InferenceProbes as InferenceProbes +from .ingress_opts_out import IngressOptsOut as IngressOptsOut from .lb_listener_list import LbListenerList as LbListenerList from .lb_pool_protocol import LbPoolProtocol as LbPoolProtocol from .task_list_params import TaskListParams as TaskListParams from .lb_health_monitor import LbHealthMonitor as LbHealthMonitor from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP +from .aws_iam_data_param import AwsIamDataParam as AwsIamDataParam from .ddos_profile_field import DDOSProfileField as DDOSProfileField from .floating_ip_status import FloatingIPStatus as FloatingIPStatus +from .ingress_opts_param import IngressOptsParam as IngressOptsParam from .region_list_params import RegionListParams as RegionListParams from .volume_list_params import VolumeListParams as VolumeListParams from .billing_reservation import BillingReservation as BillingReservation @@ -53,11 +64,13 @@ from .provisioning_status import ProvisioningStatus as ProvisioningStatus from .security_group_rule import SecurityGroupRule as SecurityGroupRule from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams +from .container_probe_exec import ContainerProbeExec as ContainerProbeExec from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed from .lb_listener_protocol import LbListenerProtocol as LbListenerProtocol from .load_balancer_status import LoadBalancerStatus as LoadBalancerStatus from .loadbalancer_metrics import LoadbalancerMetrics as LoadbalancerMetrics from .placement_group_list import PlacementGroupList as PlacementGroupList +from .region_capacity_list import RegionCapacityList as RegionCapacityList from .secret_create_params import SecretCreateParams as SecretCreateParams from .secret_list_response import SecretListResponse as SecretListResponse from .volume_create_params import VolumeCreateParams as VolumeCreateParams @@ -72,6 +85,7 @@ from .project_create_params import ProjectCreateParams as ProjectCreateParams from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams +from .container_probe_config import ContainerProbeConfig as ContainerProbeConfig from .file_share_list_params import FileShareListParams as FileShareListParams from .lb_session_persistence import LbSessionPersistence as LbSessionPersistence from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams @@ -79,6 +93,8 @@ from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams from .detailed_lb_pool_member import DetailedLbPoolMember as DetailedLbPoolMember from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams +from .container_probe_http_get import ContainerProbeHTTPGet as ContainerProbeHTTPGet +from .container_scale_triggers import ContainerScaleTriggers as ContainerScaleTriggers from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList from .file_share_create_params import FileShareCreateParams as FileShareCreateParams from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams @@ -93,9 +109,11 @@ from .loadbalancer_metrics_list import LoadbalancerMetricsList as LoadbalancerMetricsList from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams +from .container_probe_tcp_socket import ContainerProbeTcpSocket as ContainerProbeTcpSocket from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams +from .container_scale_trigger_sqs import ContainerScaleTriggerSqs as ContainerScaleTriggerSqs from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField from .flavor_hardware_description import FlavorHardwareDescription as FlavorHardwareDescription from .load_balancer_create_params import LoadBalancerCreateParams as LoadBalancerCreateParams @@ -103,6 +121,7 @@ from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams +from .container_scale_trigger_rate import ContainerScaleTriggerRate as ContainerScaleTriggerRate from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams @@ -113,6 +132,7 @@ from .billing_reservation_list_params import BillingReservationListParams as BillingReservationListParams from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams +from .container_scale_trigger_threshold import ContainerScaleTriggerThreshold as ContainerScaleTriggerThreshold from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams diff --git a/src/gcore/types/cloud/aws_iam_data.py b/src/gcore/types/cloud/aws_iam_data.py new file mode 100644 index 00000000..1df1f50c --- /dev/null +++ b/src/gcore/types/cloud/aws_iam_data.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["AwsIamData"] + + +class AwsIamData(BaseModel): + aws_access_key_id: str + """ + '#/components/schemas/AwsIamData/properties/aws_access_key_id' + "$.components.schemas.AwsIamData.properties.aws_access_key_id" + """ + + aws_secret_access_key: str + """ + '#/components/schemas/AwsIamData/properties/aws_secret_access_key' + "$.components.schemas.AwsIamData.properties.aws_secret_access_key" + """ diff --git a/src/gcore/types/cloud/aws_iam_data_param.py b/src/gcore/types/cloud/aws_iam_data_param.py new file mode 100644 index 00000000..62f0854c --- /dev/null +++ b/src/gcore/types/cloud/aws_iam_data_param.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 Required, TypedDict + +__all__ = ["AwsIamDataParam"] + + +class AwsIamDataParam(TypedDict, total=False): + aws_access_key_id: Required[str] + """ + '#/components/schemas/AwsIamData/properties/aws_access_key_id' + "$.components.schemas.AwsIamData.properties.aws_access_key_id" + """ + + aws_secret_access_key: Required[str] + """ + '#/components/schemas/AwsIamData/properties/aws_secret_access_key' + "$.components.schemas.AwsIamData.properties.aws_secret_access_key" + """ diff --git a/src/gcore/types/cloud/capacity.py b/src/gcore/types/cloud/capacity.py new file mode 100644 index 00000000..92456d1d --- /dev/null +++ b/src/gcore/types/cloud/capacity.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["Capacity"] + + +class Capacity(BaseModel): + capacity: int + """ + '#/components/schemas/CapacityDetailsSerializer/properties/capacity' + "$.components.schemas.CapacityDetailsSerializer.properties.capacity" + """ + + flavor_name: str + """ + '#/components/schemas/CapacityDetailsSerializer/properties/flavor_name' + "$.components.schemas.CapacityDetailsSerializer.properties.flavor_name" + """ diff --git a/src/gcore/types/cloud/container_probe.py b/src/gcore/types/cloud/container_probe.py new file mode 100644 index 00000000..88700bdd --- /dev/null +++ b/src/gcore/types/cloud/container_probe.py @@ -0,0 +1,60 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .container_probe_exec import ContainerProbeExec +from .container_probe_http_get import ContainerProbeHTTPGet +from .container_probe_tcp_socket import ContainerProbeTcpSocket + +__all__ = ["ContainerProbe"] + + +class ContainerProbe(BaseModel): + exec: Optional[ContainerProbeExec] = None + """ + '#/components/schemas/ContainerProbeOutSerializerV2/properties/exec/anyOf/0' + "$.components.schemas.ContainerProbeOutSerializerV2.properties.exec.anyOf[0]" + """ + + failure_threshold: int + """ + '#/components/schemas/ContainerProbeOutSerializerV2/properties/failure_threshold' + "$.components.schemas.ContainerProbeOutSerializerV2.properties.failure_threshold" + """ + + http_get: Optional[ContainerProbeHTTPGet] = None + """ + '#/components/schemas/ContainerProbeOutSerializerV2/properties/http_get/anyOf/0' + "$.components.schemas.ContainerProbeOutSerializerV2.properties.http_get.anyOf[0]" + """ + + initial_delay_seconds: int + """ + '#/components/schemas/ContainerProbeOutSerializerV2/properties/initial_delay_seconds' + "$.components.schemas.ContainerProbeOutSerializerV2.properties.initial_delay_seconds" + """ + + period_seconds: int + """ + '#/components/schemas/ContainerProbeOutSerializerV2/properties/period_seconds' + "$.components.schemas.ContainerProbeOutSerializerV2.properties.period_seconds" + """ + + success_threshold: int + """ + '#/components/schemas/ContainerProbeOutSerializerV2/properties/success_threshold' + "$.components.schemas.ContainerProbeOutSerializerV2.properties.success_threshold" + """ + + tcp_socket: Optional[ContainerProbeTcpSocket] = None + """ + '#/components/schemas/ContainerProbeOutSerializerV2/properties/tcp_socket/anyOf/0' + "$.components.schemas.ContainerProbeOutSerializerV2.properties.tcp_socket.anyOf[0]" + """ + + timeout_seconds: int + """ + '#/components/schemas/ContainerProbeOutSerializerV2/properties/timeout_seconds' + "$.components.schemas.ContainerProbeOutSerializerV2.properties.timeout_seconds" + """ diff --git a/src/gcore/types/cloud/container_probe_config.py b/src/gcore/types/cloud/container_probe_config.py new file mode 100644 index 00000000..fbefe4ec --- /dev/null +++ b/src/gcore/types/cloud/container_probe_config.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .container_probe import ContainerProbe + +__all__ = ["ContainerProbeConfig"] + + +class ContainerProbeConfig(BaseModel): + enabled: bool + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationOutSerializerV2/properties/enabled' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationOutSerializerV2.properties.enabled" + """ + + probe: Optional[ContainerProbe] = None + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationOutSerializerV2/properties/probe/anyOf/0' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationOutSerializerV2.properties.probe.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/container_probe_exec.py b/src/gcore/types/cloud/container_probe_exec.py new file mode 100644 index 00000000..3a5c112d --- /dev/null +++ b/src/gcore/types/cloud/container_probe_exec.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["ContainerProbeExec"] + + +class ContainerProbeExec(BaseModel): + command: List[str] + """ + '#/components/schemas/ContainerProbeExecConfigOutSerializerV2/properties/command' + "$.components.schemas.ContainerProbeExecConfigOutSerializerV2.properties.command" + """ diff --git a/src/gcore/types/cloud/container_probe_http_get.py b/src/gcore/types/cloud/container_probe_http_get.py new file mode 100644 index 00000000..6552247b --- /dev/null +++ b/src/gcore/types/cloud/container_probe_http_get.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["ContainerProbeHTTPGet"] + + +class ContainerProbeHTTPGet(BaseModel): + headers: Dict[str, str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigOutSerializerV2/properties/headers' + "$.components.schemas.ContainerProbeHttpGetConfigOutSerializerV2.properties.headers" + """ + + host: Optional[str] = None + """ + '#/components/schemas/ContainerProbeHttpGetConfigOutSerializerV2/properties/host/anyOf/0' + "$.components.schemas.ContainerProbeHttpGetConfigOutSerializerV2.properties.host.anyOf[0]" + """ + + path: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigOutSerializerV2/properties/path' + "$.components.schemas.ContainerProbeHttpGetConfigOutSerializerV2.properties.path" + """ + + port: int + """ + '#/components/schemas/ContainerProbeHttpGetConfigOutSerializerV2/properties/port' + "$.components.schemas.ContainerProbeHttpGetConfigOutSerializerV2.properties.port" + """ + + schema_: str = FieldInfo(alias="schema") + """ + '#/components/schemas/ContainerProbeHttpGetConfigOutSerializerV2/properties/schema' + "$.components.schemas.ContainerProbeHttpGetConfigOutSerializerV2.properties.schema" + """ diff --git a/src/gcore/types/cloud/container_probe_tcp_socket.py b/src/gcore/types/cloud/container_probe_tcp_socket.py new file mode 100644 index 00000000..f384c66f --- /dev/null +++ b/src/gcore/types/cloud/container_probe_tcp_socket.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["ContainerProbeTcpSocket"] + + +class ContainerProbeTcpSocket(BaseModel): + port: int + """ + '#/components/schemas/ContainerProbeTcpSocketConfigOutSerializerV2/properties/port' + "$.components.schemas.ContainerProbeTcpSocketConfigOutSerializerV2.properties.port" + """ diff --git a/src/gcore/types/cloud/container_scale.py b/src/gcore/types/cloud/container_scale.py new file mode 100644 index 00000000..c5686dc7 --- /dev/null +++ b/src/gcore/types/cloud/container_scale.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .container_scale_triggers import ContainerScaleTriggers + +__all__ = ["ContainerScale"] + + +class ContainerScale(BaseModel): + cooldown_period: Optional[int] = None + """ + '#/components/schemas/ContainerScaleOutSerializerV3/properties/cooldown_period/anyOf/0' + "$.components.schemas.ContainerScaleOutSerializerV3.properties.cooldown_period.anyOf[0]" + """ + + max: int + """ + '#/components/schemas/ContainerScaleOutSerializerV3/properties/max' + "$.components.schemas.ContainerScaleOutSerializerV3.properties.max" + """ + + min: int + """ + '#/components/schemas/ContainerScaleOutSerializerV3/properties/min' + "$.components.schemas.ContainerScaleOutSerializerV3.properties.min" + """ + + polling_interval: Optional[int] = None + """ + '#/components/schemas/ContainerScaleOutSerializerV3/properties/polling_interval/anyOf/0' + "$.components.schemas.ContainerScaleOutSerializerV3.properties.polling_interval.anyOf[0]" + """ + + triggers: ContainerScaleTriggers + """ + '#/components/schemas/ContainerScaleOutSerializerV3/properties/triggers' + "$.components.schemas.ContainerScaleOutSerializerV3.properties.triggers" + """ diff --git a/src/gcore/types/cloud/container_scale_trigger_rate.py b/src/gcore/types/cloud/container_scale_trigger_rate.py new file mode 100644 index 00000000..45e45489 --- /dev/null +++ b/src/gcore/types/cloud/container_scale_trigger_rate.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["ContainerScaleTriggerRate"] + + +class ContainerScaleTriggerRate(BaseModel): + rate: int + """ + '#/components/schemas/ContainerScaleTriggersRateOutSerializer/properties/rate' + "$.components.schemas.ContainerScaleTriggersRateOutSerializer.properties.rate" + """ + + window: int + """ + '#/components/schemas/ContainerScaleTriggersRateOutSerializer/properties/window' + "$.components.schemas.ContainerScaleTriggersRateOutSerializer.properties.window" + """ diff --git a/src/gcore/types/cloud/container_scale_trigger_sqs.py b/src/gcore/types/cloud/container_scale_trigger_sqs.py new file mode 100644 index 00000000..366e48da --- /dev/null +++ b/src/gcore/types/cloud/container_scale_trigger_sqs.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["ContainerScaleTriggerSqs"] + + +class ContainerScaleTriggerSqs(BaseModel): + activation_queue_length: int + """ + '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/activation_queue_length' + "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.activation_queue_length" + """ + + aws_endpoint: Optional[str] = None + """ + '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/aws_endpoint/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.aws_endpoint.anyOf[0]" + """ + + aws_region: str + """ + '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/aws_region' + "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.aws_region" + """ + + queue_length: int + """ + '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/queue_length' + "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.queue_length" + """ + + queue_url: str + """ + '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/queue_url' + "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.queue_url" + """ + + scale_on_delayed: bool + """ + '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/scale_on_delayed' + "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.scale_on_delayed" + """ + + scale_on_flight: bool + """ + '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/scale_on_flight' + "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.scale_on_flight" + """ + + secret_name: str + """ + '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/secret_name' + "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.secret_name" + """ diff --git a/src/gcore/types/cloud/container_scale_trigger_threshold.py b/src/gcore/types/cloud/container_scale_trigger_threshold.py new file mode 100644 index 00000000..d2a50647 --- /dev/null +++ b/src/gcore/types/cloud/container_scale_trigger_threshold.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["ContainerScaleTriggerThreshold"] + + +class ContainerScaleTriggerThreshold(BaseModel): + threshold: int + """ + '#/components/schemas/ContainerScaleTriggersThresholdOutSerializer/properties/threshold' + "$.components.schemas.ContainerScaleTriggersThresholdOutSerializer.properties.threshold" + """ diff --git a/src/gcore/types/cloud/container_scale_triggers.py b/src/gcore/types/cloud/container_scale_triggers.py new file mode 100644 index 00000000..dceeedc6 --- /dev/null +++ b/src/gcore/types/cloud/container_scale_triggers.py @@ -0,0 +1,48 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .container_scale_trigger_sqs import ContainerScaleTriggerSqs +from .container_scale_trigger_rate import ContainerScaleTriggerRate +from .container_scale_trigger_threshold import ContainerScaleTriggerThreshold + +__all__ = ["ContainerScaleTriggers"] + + +class ContainerScaleTriggers(BaseModel): + cpu: Optional[ContainerScaleTriggerThreshold] = None + """ + '#/components/schemas/ContainerScaleTriggersOutSerializer/properties/cpu/anyOf/0' + "$.components.schemas.ContainerScaleTriggersOutSerializer.properties.cpu.anyOf[0]" + """ + + gpu_memory: Optional[ContainerScaleTriggerThreshold] = None + """ + '#/components/schemas/ContainerScaleTriggersOutSerializer/properties/gpu_memory/anyOf/0' + "$.components.schemas.ContainerScaleTriggersOutSerializer.properties.gpu_memory.anyOf[0]" + """ + + gpu_utilization: Optional[ContainerScaleTriggerThreshold] = None + """ + '#/components/schemas/ContainerScaleTriggersOutSerializer/properties/gpu_utilization/anyOf/0' + "$.components.schemas.ContainerScaleTriggersOutSerializer.properties.gpu_utilization.anyOf[0]" + """ + + http: Optional[ContainerScaleTriggerRate] = None + """ + '#/components/schemas/ContainerScaleTriggersOutSerializer/properties/http/anyOf/0' + "$.components.schemas.ContainerScaleTriggersOutSerializer.properties.http.anyOf[0]" + """ + + memory: Optional[ContainerScaleTriggerThreshold] = None + """ + '#/components/schemas/ContainerScaleTriggersOutSerializer/properties/memory/anyOf/0' + "$.components.schemas.ContainerScaleTriggersOutSerializer.properties.memory.anyOf[0]" + """ + + sqs: Optional[ContainerScaleTriggerSqs] = None + """ + '#/components/schemas/ContainerScaleTriggersOutSerializer/properties/sqs/anyOf/0' + "$.components.schemas.ContainerScaleTriggersOutSerializer.properties.sqs.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/deploy_status.py b/src/gcore/types/cloud/deploy_status.py new file mode 100644 index 00000000..720d1af4 --- /dev/null +++ b/src/gcore/types/cloud/deploy_status.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["DeployStatus"] + + +class DeployStatus(BaseModel): + ready: int + """ + '#/components/schemas/DeployStatusSerializer/properties/ready' + "$.components.schemas.DeployStatusSerializer.properties.ready" + """ + + total: int + """ + '#/components/schemas/DeployStatusSerializer/properties/total' + "$.components.schemas.DeployStatusSerializer.properties.total" + """ diff --git a/src/gcore/types/cloud/inference/__init__.py b/src/gcore/types/cloud/inference/__init__.py new file mode 100644 index 00000000..c6e0d9d3 --- /dev/null +++ b/src/gcore/types/cloud/inference/__init__.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .container import Container as Container +from .inference import Inference as Inference +from .inference_log import InferenceLog as InferenceLog +from .inference_flavor import InferenceFlavor as InferenceFlavor +from .inference_secret import InferenceSecret as InferenceSecret +from .model_list_params import ModelListParams as ModelListParams +from .flavor_list_params import FlavorListParams as FlavorListParams +from .secret_list_params import SecretListParams as SecretListParams +from .mlcatalog_model_card import MlcatalogModelCard as MlcatalogModelCard +from .secret_create_params import SecretCreateParams as SecretCreateParams +from .secret_replace_params import SecretReplaceParams as SecretReplaceParams +from .deployment_list_params import DeploymentListParams as DeploymentListParams +from .inference_apikey_secret import InferenceApikeySecret as InferenceApikeySecret +from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams +from .deployment_update_params import DeploymentUpdateParams as DeploymentUpdateParams +from .mlcatalog_order_by_choices import MlcatalogOrderByChoices as MlcatalogOrderByChoices +from .inference_registry_credential import InferenceRegistryCredential as InferenceRegistryCredential +from .registry_credential_list_params import RegistryCredentialListParams as RegistryCredentialListParams +from .registry_credential_create_params import RegistryCredentialCreateParams as RegistryCredentialCreateParams +from .inference_registry_credential_full import InferenceRegistryCredentialFull as InferenceRegistryCredentialFull +from .registry_credential_replace_params import RegistryCredentialReplaceParams as RegistryCredentialReplaceParams diff --git a/src/gcore/types/cloud/inference/container.py b/src/gcore/types/cloud/inference/container.py new file mode 100644 index 00000000..4648ec87 --- /dev/null +++ b/src/gcore/types/cloud/inference/container.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel +from ..deploy_status import DeployStatus +from ..container_scale import ContainerScale + +__all__ = ["Container"] + + +class Container(BaseModel): + address: Optional[str] = None + """ + '#/components/schemas/ContainerOutSerializerV3/properties/address/anyOf/0' + "$.components.schemas.ContainerOutSerializerV3.properties.address.anyOf[0]" + """ + + deploy_status: DeployStatus + """ + '#/components/schemas/ContainerOutSerializerV3/properties/deploy_status' + "$.components.schemas.ContainerOutSerializerV3.properties.deploy_status" + """ + + error_message: Optional[str] = None + """ + '#/components/schemas/ContainerOutSerializerV3/properties/error_message/anyOf/0' + "$.components.schemas.ContainerOutSerializerV3.properties.error_message.anyOf[0]" + """ + + region_id: int + """ + '#/components/schemas/ContainerOutSerializerV3/properties/region_id' + "$.components.schemas.ContainerOutSerializerV3.properties.region_id" + """ + + scale: ContainerScale + """ + '#/components/schemas/ContainerOutSerializerV3/properties/scale' + "$.components.schemas.ContainerOutSerializerV3.properties.scale" + """ diff --git a/src/gcore/types/cloud/inference/deployment_create_params.py b/src/gcore/types/cloud/inference/deployment_create_params.py new file mode 100644 index 00000000..cbdae2e6 --- /dev/null +++ b/src/gcore/types/cloud/inference/deployment_create_params.py @@ -0,0 +1,702 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo +from ..ingress_opts_param import IngressOptsParam + +__all__ = [ + "DeploymentCreateParams", + "Container", + "ContainerScale", + "ContainerScaleTriggers", + "ContainerScaleTriggersCPU", + "ContainerScaleTriggersGPUMemory", + "ContainerScaleTriggersGPUUtilization", + "ContainerScaleTriggersHTTP", + "ContainerScaleTriggersMemory", + "ContainerScaleTriggersSqs", + "Logging", + "LoggingRetentionPolicy", + "Probes", + "ProbesLivenessProbe", + "ProbesLivenessProbeProbe", + "ProbesLivenessProbeProbeExec", + "ProbesLivenessProbeProbeHTTPGet", + "ProbesLivenessProbeProbeTcpSocket", + "ProbesReadinessProbe", + "ProbesReadinessProbeProbe", + "ProbesReadinessProbeProbeExec", + "ProbesReadinessProbeProbeHTTPGet", + "ProbesReadinessProbeProbeTcpSocket", + "ProbesStartupProbe", + "ProbesStartupProbeProbe", + "ProbesStartupProbeProbeExec", + "ProbesStartupProbeProbeHTTPGet", + "ProbesStartupProbeProbeTcpSocket", +] + + +class DeploymentCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments'].post.parameters[0].schema" + """ + + containers: Required[Iterable[Container]] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/containers' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.containers" + """ + + flavor_name: Required[str] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/flavor_name' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.flavor_name" + """ + + image: Required[str] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/image' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.image" + """ + + listening_port: Required[int] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/listening_port' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.listening_port" + """ + + name: Required[str] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/name' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.name" + """ + + auth_enabled: bool + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/auth_enabled' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.auth_enabled" + """ + + command: Optional[List[str]] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/command/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.command.anyOf[0]" + """ + + credentials_name: Optional[str] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/credentials_name/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.credentials_name.anyOf[0]" + """ + + description: Optional[str] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/description/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.description.anyOf[0]" + """ + + envs: Dict[str, str] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/envs' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.envs" + """ + + ingress_opts: Optional[IngressOptsParam] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/ingress_opts/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.ingress_opts.anyOf[0]" + """ + + logging: Optional[Logging] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/logging/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.logging.anyOf[0]" + """ + + probes: Optional[Probes] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/probes/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.probes.anyOf[0]" + """ + + api_timeout: Annotated[Optional[int], PropertyInfo(alias="timeout")] + """ + '#/components/schemas/InferenceInstanceInSerializerV3/properties/timeout/anyOf/0' + "$.components.schemas.InferenceInstanceInSerializerV3.properties.timeout.anyOf[0]" + """ + + +class ContainerScaleTriggersCPU(TypedDict, total=False): + threshold: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' + "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" + """ + + +class ContainerScaleTriggersGPUMemory(TypedDict, total=False): + threshold: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' + "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" + """ + + +class ContainerScaleTriggersGPUUtilization(TypedDict, total=False): + threshold: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' + "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" + """ + + +class ContainerScaleTriggersHTTP(TypedDict, total=False): + rate: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersRateSerializer/properties/rate' + "$.components.schemas.ContainerScaleTriggersRateSerializer.properties.rate" + """ + + window: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersRateSerializer/properties/window' + "$.components.schemas.ContainerScaleTriggersRateSerializer.properties.window" + """ + + +class ContainerScaleTriggersMemory(TypedDict, total=False): + threshold: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' + "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" + """ + + +class ContainerScaleTriggersSqs(TypedDict, total=False): + activation_queue_length: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/activation_queue_length' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.activation_queue_length" + """ + + aws_region: Required[str] + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/aws_region' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.aws_region" + """ + + queue_length: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/queue_length' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.queue_length" + """ + + queue_url: Required[str] + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/queue_url' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.queue_url" + """ + + secret_name: Required[str] + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/secret_name' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.secret_name" + """ + + aws_endpoint: Optional[str] + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/aws_endpoint/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.aws_endpoint.anyOf[0]" + """ + + scale_on_delayed: bool + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/scale_on_delayed' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.scale_on_delayed" + """ + + scale_on_flight: bool + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/scale_on_flight' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.scale_on_flight" + """ + + +class ContainerScaleTriggers(TypedDict, total=False): + cpu: Optional[ContainerScaleTriggersCPU] + """ + '#/components/schemas/ContainerScaleTriggersSerializer/properties/cpu/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSerializer.properties.cpu.anyOf[0]" + """ + + gpu_memory: Optional[ContainerScaleTriggersGPUMemory] + """ + '#/components/schemas/ContainerScaleTriggersSerializer/properties/gpu_memory/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSerializer.properties.gpu_memory.anyOf[0]" + """ + + gpu_utilization: Optional[ContainerScaleTriggersGPUUtilization] + """ + '#/components/schemas/ContainerScaleTriggersSerializer/properties/gpu_utilization/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSerializer.properties.gpu_utilization.anyOf[0]" + """ + + http: Optional[ContainerScaleTriggersHTTP] + """ + '#/components/schemas/ContainerScaleTriggersSerializer/properties/http/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSerializer.properties.http.anyOf[0]" + """ + + memory: Optional[ContainerScaleTriggersMemory] + """ + '#/components/schemas/ContainerScaleTriggersSerializer/properties/memory/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSerializer.properties.memory.anyOf[0]" + """ + + sqs: Optional[ContainerScaleTriggersSqs] + """ + '#/components/schemas/ContainerScaleTriggersSerializer/properties/sqs/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSerializer.properties.sqs.anyOf[0]" + """ + + +class ContainerScale(TypedDict, total=False): + max: Required[int] + """ + '#/components/schemas/ContainerScaleSerializerV3/properties/max' + "$.components.schemas.ContainerScaleSerializerV3.properties.max" + """ + + min: Required[int] + """ + '#/components/schemas/ContainerScaleSerializerV3/properties/min' + "$.components.schemas.ContainerScaleSerializerV3.properties.min" + """ + + cooldown_period: Optional[int] + """ + '#/components/schemas/ContainerScaleSerializerV3/properties/cooldown_period/anyOf/0' + "$.components.schemas.ContainerScaleSerializerV3.properties.cooldown_period.anyOf[0]" + """ + + polling_interval: Optional[int] + """ + '#/components/schemas/ContainerScaleSerializerV3/properties/polling_interval/anyOf/0' + "$.components.schemas.ContainerScaleSerializerV3.properties.polling_interval.anyOf[0]" + """ + + triggers: ContainerScaleTriggers + """ + '#/components/schemas/ContainerScaleSerializerV3/properties/triggers' + "$.components.schemas.ContainerScaleSerializerV3.properties.triggers" + """ + + +class Container(TypedDict, total=False): + region_id: Required[int] + """ + '#/components/schemas/ContainerInSerializerV3/properties/region_id' + "$.components.schemas.ContainerInSerializerV3.properties.region_id" + """ + + scale: Required[ContainerScale] + """ + '#/components/schemas/ContainerInSerializerV3/properties/scale' + "$.components.schemas.ContainerInSerializerV3.properties.scale" + """ + + +class LoggingRetentionPolicy(TypedDict, total=False): + period: Required[Optional[int]] + """ + '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' + "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" + """ + + +class Logging(TypedDict, total=False): + destination_region_id: Optional[int] + """ + '#/components/schemas/LoggingInSerializer/properties/destination_region_id/anyOf/0' + "$.components.schemas.LoggingInSerializer.properties.destination_region_id.anyOf[0]" + """ + + enabled: bool + """ + '#/components/schemas/LoggingInSerializer/properties/enabled' + "$.components.schemas.LoggingInSerializer.properties.enabled" + """ + + retention_policy: Optional[LoggingRetentionPolicy] + """ + '#/components/schemas/LoggingInSerializer/properties/retention_policy/anyOf/0' + "$.components.schemas.LoggingInSerializer.properties.retention_policy.anyOf[0]" + """ + + topic_name: Optional[str] + """ + '#/components/schemas/LoggingInSerializer/properties/topic_name/anyOf/0' + "$.components.schemas.LoggingInSerializer.properties.topic_name.anyOf[0]" + """ + + +class ProbesLivenessProbeProbeExec(TypedDict, total=False): + command: Required[List[str]] + """ + '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' + "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" + """ + + +class ProbesLivenessProbeProbeHTTPGet(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" + """ + + headers: Dict[str, str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" + """ + + host: Optional[str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" + """ + + path: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" + """ + + schema: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" + """ + + +class ProbesLivenessProbeProbeTcpSocket(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" + """ + + +class ProbesLivenessProbeProbe(TypedDict, total=False): + exec: Optional[ProbesLivenessProbeProbeExec] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" + """ + + failure_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" + """ + + http_get: Optional[ProbesLivenessProbeProbeHTTPGet] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" + """ + + initial_delay_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" + """ + + period_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" + """ + + success_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" + """ + + tcp_socket: Optional[ProbesLivenessProbeProbeTcpSocket] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" + """ + + timeout_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" + """ + + +class ProbesLivenessProbe(TypedDict, total=False): + enabled: Required[bool] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" + """ + + probe: Optional[ProbesLivenessProbeProbe] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" + """ + + +class ProbesReadinessProbeProbeExec(TypedDict, total=False): + command: Required[List[str]] + """ + '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' + "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" + """ + + +class ProbesReadinessProbeProbeHTTPGet(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" + """ + + headers: Dict[str, str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" + """ + + host: Optional[str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" + """ + + path: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" + """ + + schema: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" + """ + + +class ProbesReadinessProbeProbeTcpSocket(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" + """ + + +class ProbesReadinessProbeProbe(TypedDict, total=False): + exec: Optional[ProbesReadinessProbeProbeExec] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" + """ + + failure_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" + """ + + http_get: Optional[ProbesReadinessProbeProbeHTTPGet] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" + """ + + initial_delay_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" + """ + + period_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" + """ + + success_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" + """ + + tcp_socket: Optional[ProbesReadinessProbeProbeTcpSocket] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" + """ + + timeout_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" + """ + + +class ProbesReadinessProbe(TypedDict, total=False): + enabled: Required[bool] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" + """ + + probe: Optional[ProbesReadinessProbeProbe] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" + """ + + +class ProbesStartupProbeProbeExec(TypedDict, total=False): + command: Required[List[str]] + """ + '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' + "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" + """ + + +class ProbesStartupProbeProbeHTTPGet(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" + """ + + headers: Dict[str, str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" + """ + + host: Optional[str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" + """ + + path: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" + """ + + schema: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" + """ + + +class ProbesStartupProbeProbeTcpSocket(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" + """ + + +class ProbesStartupProbeProbe(TypedDict, total=False): + exec: Optional[ProbesStartupProbeProbeExec] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" + """ + + failure_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" + """ + + http_get: Optional[ProbesStartupProbeProbeHTTPGet] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" + """ + + initial_delay_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" + """ + + period_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" + """ + + success_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" + """ + + tcp_socket: Optional[ProbesStartupProbeProbeTcpSocket] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" + """ + + timeout_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" + """ + + +class ProbesStartupProbe(TypedDict, total=False): + enabled: Required[bool] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" + """ + + probe: Optional[ProbesStartupProbeProbe] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" + """ + + +class Probes(TypedDict, total=False): + liveness_probe: Optional[ProbesLivenessProbe] + """ + '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/liveness_probe/anyOf/0' + "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.liveness_probe.anyOf[0]" + """ + + readiness_probe: Optional[ProbesReadinessProbe] + """ + '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/readiness_probe/anyOf/0' + "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.readiness_probe.anyOf[0]" + """ + + startup_probe: Optional[ProbesStartupProbe] + """ + '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/startup_probe/anyOf/0' + "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.startup_probe.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/inference/deployment_list_params.py b/src/gcore/types/cloud/inference/deployment_list_params.py new file mode 100644 index 00000000..d1c0bd5d --- /dev/null +++ b/src/gcore/types/cloud/inference/deployment_list_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["DeploymentListParams"] + + +class DeploymentListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[0].schema" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/1' + "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[1]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/2' + "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[2]" + """ diff --git a/src/gcore/types/cloud/inference/deployment_update_params.py b/src/gcore/types/cloud/inference/deployment_update_params.py new file mode 100644 index 00000000..5fe57807 --- /dev/null +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -0,0 +1,696 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo +from ..ingress_opts_param import IngressOptsParam + +__all__ = [ + "DeploymentUpdateParams", + "Container", + "ContainerScale", + "ContainerScaleTriggers", + "ContainerScaleTriggersCPU", + "ContainerScaleTriggersGPUMemory", + "ContainerScaleTriggersGPUUtilization", + "ContainerScaleTriggersHTTP", + "ContainerScaleTriggersMemory", + "ContainerScaleTriggersSqs", + "Logging", + "LoggingRetentionPolicy", + "Probes", + "ProbesLivenessProbe", + "ProbesLivenessProbeProbe", + "ProbesLivenessProbeProbeExec", + "ProbesLivenessProbeProbeHTTPGet", + "ProbesLivenessProbeProbeTcpSocket", + "ProbesReadinessProbe", + "ProbesReadinessProbeProbe", + "ProbesReadinessProbeProbeExec", + "ProbesReadinessProbeProbeHTTPGet", + "ProbesReadinessProbeProbeTcpSocket", + "ProbesStartupProbe", + "ProbesStartupProbeProbe", + "ProbesStartupProbeProbeExec", + "ProbesStartupProbeProbeHTTPGet", + "ProbesStartupProbeProbeTcpSocket", +] + + +class DeploymentUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/patch/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].patch.parameters[0].schema" + """ + + auth_enabled: Optional[bool] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/auth_enabled/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.auth_enabled.anyOf[0]" + """ + + command: Optional[List[str]] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/command/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.command.anyOf[0]" + """ + + containers: Optional[Iterable[Container]] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/containers/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.containers.anyOf[0]" + """ + + credentials_name: Optional[str] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/credentials_name/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.credentials_name.anyOf[0]" + """ + + description: Optional[str] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/description/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.description.anyOf[0]" + """ + + envs: Optional[Dict[str, str]] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/envs/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.envs.anyOf[0]" + """ + + flavor_name: Optional[str] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/flavor_name/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.flavor_name.anyOf[0]" + """ + + image: Optional[str] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/image/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.image.anyOf[0]" + """ + + ingress_opts: Optional[IngressOptsParam] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/ingress_opts/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.ingress_opts.anyOf[0]" + """ + + listening_port: Optional[int] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/listening_port/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.listening_port.anyOf[0]" + """ + + logging: Optional[Logging] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/logging/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.logging.anyOf[0]" + """ + + probes: Optional[Probes] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/probes/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.probes.anyOf[0]" + """ + + api_timeout: Annotated[Optional[int], PropertyInfo(alias="timeout")] + """ + '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/timeout/anyOf/0' + "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.timeout.anyOf[0]" + """ + + +class ContainerScaleTriggersCPU(TypedDict, total=False): + threshold: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' + "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" + """ + + +class ContainerScaleTriggersGPUMemory(TypedDict, total=False): + threshold: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' + "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" + """ + + +class ContainerScaleTriggersGPUUtilization(TypedDict, total=False): + threshold: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' + "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" + """ + + +class ContainerScaleTriggersHTTP(TypedDict, total=False): + rate: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersRateSerializer/properties/rate' + "$.components.schemas.ContainerScaleTriggersRateSerializer.properties.rate" + """ + + window: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersRateSerializer/properties/window' + "$.components.schemas.ContainerScaleTriggersRateSerializer.properties.window" + """ + + +class ContainerScaleTriggersMemory(TypedDict, total=False): + threshold: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' + "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" + """ + + +class ContainerScaleTriggersSqs(TypedDict, total=False): + activation_queue_length: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/activation_queue_length' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.activation_queue_length" + """ + + aws_region: Required[str] + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/aws_region' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.aws_region" + """ + + queue_length: Required[int] + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/queue_length' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.queue_length" + """ + + queue_url: Required[str] + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/queue_url' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.queue_url" + """ + + secret_name: Required[str] + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/secret_name' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.secret_name" + """ + + aws_endpoint: Optional[str] + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/aws_endpoint/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.aws_endpoint.anyOf[0]" + """ + + scale_on_delayed: bool + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/scale_on_delayed' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.scale_on_delayed" + """ + + scale_on_flight: bool + """ + '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/scale_on_flight' + "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.scale_on_flight" + """ + + +class ContainerScaleTriggers(TypedDict, total=False): + cpu: Optional[ContainerScaleTriggersCPU] + """ + '#/components/schemas/ContainerScaleTriggersSerializer/properties/cpu/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSerializer.properties.cpu.anyOf[0]" + """ + + gpu_memory: Optional[ContainerScaleTriggersGPUMemory] + """ + '#/components/schemas/ContainerScaleTriggersSerializer/properties/gpu_memory/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSerializer.properties.gpu_memory.anyOf[0]" + """ + + gpu_utilization: Optional[ContainerScaleTriggersGPUUtilization] + """ + '#/components/schemas/ContainerScaleTriggersSerializer/properties/gpu_utilization/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSerializer.properties.gpu_utilization.anyOf[0]" + """ + + http: Optional[ContainerScaleTriggersHTTP] + """ + '#/components/schemas/ContainerScaleTriggersSerializer/properties/http/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSerializer.properties.http.anyOf[0]" + """ + + memory: Optional[ContainerScaleTriggersMemory] + """ + '#/components/schemas/ContainerScaleTriggersSerializer/properties/memory/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSerializer.properties.memory.anyOf[0]" + """ + + sqs: Optional[ContainerScaleTriggersSqs] + """ + '#/components/schemas/ContainerScaleTriggersSerializer/properties/sqs/anyOf/0' + "$.components.schemas.ContainerScaleTriggersSerializer.properties.sqs.anyOf[0]" + """ + + +class ContainerScale(TypedDict, total=False): + max: Required[int] + """ + '#/components/schemas/ContainerScaleUpdateSerializerV3/properties/max' + "$.components.schemas.ContainerScaleUpdateSerializerV3.properties.max" + """ + + min: Required[int] + """ + '#/components/schemas/ContainerScaleUpdateSerializerV3/properties/min' + "$.components.schemas.ContainerScaleUpdateSerializerV3.properties.min" + """ + + cooldown_period: int + """ + '#/components/schemas/ContainerScaleUpdateSerializerV3/properties/cooldown_period' + "$.components.schemas.ContainerScaleUpdateSerializerV3.properties.cooldown_period" + """ + + polling_interval: int + """ + '#/components/schemas/ContainerScaleUpdateSerializerV3/properties/polling_interval' + "$.components.schemas.ContainerScaleUpdateSerializerV3.properties.polling_interval" + """ + + triggers: ContainerScaleTriggers + """ + '#/components/schemas/ContainerScaleUpdateSerializerV3/properties/triggers' + "$.components.schemas.ContainerScaleUpdateSerializerV3.properties.triggers" + """ + + +class Container(TypedDict, total=False): + region_id: Required[Optional[int]] + """ + '#/components/schemas/ContainerInUpdateSerializerV3/properties/region_id/anyOf/0' + "$.components.schemas.ContainerInUpdateSerializerV3.properties.region_id.anyOf[0]" + """ + + scale: Required[Optional[ContainerScale]] + """ + '#/components/schemas/ContainerInUpdateSerializerV3/properties/scale/anyOf/0' + "$.components.schemas.ContainerInUpdateSerializerV3.properties.scale.anyOf[0]" + """ + + +class LoggingRetentionPolicy(TypedDict, total=False): + period: Required[Optional[int]] + """ + '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' + "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" + """ + + +class Logging(TypedDict, total=False): + destination_region_id: Optional[int] + """ + '#/components/schemas/LoggingInSerializer/properties/destination_region_id/anyOf/0' + "$.components.schemas.LoggingInSerializer.properties.destination_region_id.anyOf[0]" + """ + + enabled: bool + """ + '#/components/schemas/LoggingInSerializer/properties/enabled' + "$.components.schemas.LoggingInSerializer.properties.enabled" + """ + + retention_policy: Optional[LoggingRetentionPolicy] + """ + '#/components/schemas/LoggingInSerializer/properties/retention_policy/anyOf/0' + "$.components.schemas.LoggingInSerializer.properties.retention_policy.anyOf[0]" + """ + + topic_name: Optional[str] + """ + '#/components/schemas/LoggingInSerializer/properties/topic_name/anyOf/0' + "$.components.schemas.LoggingInSerializer.properties.topic_name.anyOf[0]" + """ + + +class ProbesLivenessProbeProbeExec(TypedDict, total=False): + command: Required[List[str]] + """ + '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' + "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" + """ + + +class ProbesLivenessProbeProbeHTTPGet(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" + """ + + headers: Dict[str, str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" + """ + + host: Optional[str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" + """ + + path: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" + """ + + schema: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" + """ + + +class ProbesLivenessProbeProbeTcpSocket(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" + """ + + +class ProbesLivenessProbeProbe(TypedDict, total=False): + exec: Optional[ProbesLivenessProbeProbeExec] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" + """ + + failure_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" + """ + + http_get: Optional[ProbesLivenessProbeProbeHTTPGet] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" + """ + + initial_delay_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" + """ + + period_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" + """ + + success_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" + """ + + tcp_socket: Optional[ProbesLivenessProbeProbeTcpSocket] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" + """ + + timeout_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" + """ + + +class ProbesLivenessProbe(TypedDict, total=False): + enabled: Required[bool] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" + """ + + probe: Optional[ProbesLivenessProbeProbe] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" + """ + + +class ProbesReadinessProbeProbeExec(TypedDict, total=False): + command: Required[List[str]] + """ + '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' + "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" + """ + + +class ProbesReadinessProbeProbeHTTPGet(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" + """ + + headers: Dict[str, str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" + """ + + host: Optional[str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" + """ + + path: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" + """ + + schema: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" + """ + + +class ProbesReadinessProbeProbeTcpSocket(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" + """ + + +class ProbesReadinessProbeProbe(TypedDict, total=False): + exec: Optional[ProbesReadinessProbeProbeExec] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" + """ + + failure_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" + """ + + http_get: Optional[ProbesReadinessProbeProbeHTTPGet] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" + """ + + initial_delay_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" + """ + + period_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" + """ + + success_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" + """ + + tcp_socket: Optional[ProbesReadinessProbeProbeTcpSocket] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" + """ + + timeout_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" + """ + + +class ProbesReadinessProbe(TypedDict, total=False): + enabled: Required[bool] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" + """ + + probe: Optional[ProbesReadinessProbeProbe] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" + """ + + +class ProbesStartupProbeProbeExec(TypedDict, total=False): + command: Required[List[str]] + """ + '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' + "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" + """ + + +class ProbesStartupProbeProbeHTTPGet(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" + """ + + headers: Dict[str, str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" + """ + + host: Optional[str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" + """ + + path: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" + """ + + schema: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" + """ + + +class ProbesStartupProbeProbeTcpSocket(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" + """ + + +class ProbesStartupProbeProbe(TypedDict, total=False): + exec: Optional[ProbesStartupProbeProbeExec] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" + """ + + failure_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" + """ + + http_get: Optional[ProbesStartupProbeProbeHTTPGet] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" + """ + + initial_delay_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" + """ + + period_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" + """ + + success_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" + """ + + tcp_socket: Optional[ProbesStartupProbeProbeTcpSocket] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" + """ + + timeout_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" + """ + + +class ProbesStartupProbe(TypedDict, total=False): + enabled: Required[bool] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" + """ + + probe: Optional[ProbesStartupProbeProbe] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" + """ + + +class Probes(TypedDict, total=False): + liveness_probe: Optional[ProbesLivenessProbe] + """ + '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/liveness_probe/anyOf/0' + "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.liveness_probe.anyOf[0]" + """ + + readiness_probe: Optional[ProbesReadinessProbe] + """ + '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/readiness_probe/anyOf/0' + "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.readiness_probe.anyOf[0]" + """ + + startup_probe: Optional[ProbesStartupProbe] + """ + '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/startup_probe/anyOf/0' + "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.startup_probe.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/inference/deployments/__init__.py b/src/gcore/types/cloud/inference/deployments/__init__.py new file mode 100644 index 00000000..344b4c92 --- /dev/null +++ b/src/gcore/types/cloud/inference/deployments/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .log_list_params import LogListParams as LogListParams diff --git a/src/gcore/types/cloud/inference/deployments/log_list_params.py b/src/gcore/types/cloud/inference/deployments/log_list_params.py new file mode 100644 index 00000000..61dca752 --- /dev/null +++ b/src/gcore/types/cloud/inference/deployments/log_list_params.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["LogListParams"] + + +class LogListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[0].schema" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/2' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[2]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/3' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[3]" + """ + + order_by: Literal["time.asc", "time.desc"] + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/4' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[4]" + """ + + region_id: Optional[int] + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/5/schema/anyOf/0' + "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[5].schema.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/inference/flavor_list_params.py b/src/gcore/types/cloud/inference/flavor_list_params.py new file mode 100644 index 00000000..53a9caf1 --- /dev/null +++ b/src/gcore/types/cloud/inference/flavor_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 TypedDict + +__all__ = ["FlavorListParams"] + + +class FlavorListParams(TypedDict, total=False): + limit: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors/get/parameters/0' + "$.paths['/cloud/v3/inference/flavors'].get.parameters[0]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors/get/parameters/1' + "$.paths['/cloud/v3/inference/flavors'].get.parameters[1]" + """ diff --git a/src/gcore/types/cloud/inference/inference.py b/src/gcore/types/cloud/inference/inference.py new file mode 100644 index 00000000..b7f2ad5c --- /dev/null +++ b/src/gcore/types/cloud/inference/inference.py @@ -0,0 +1,122 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from ..logging import Logging +from .container import Container +from ...._models import BaseModel +from ..inference_probes import InferenceProbes +from ..ingress_opts_out import IngressOptsOut + +__all__ = ["Inference"] + + +class Inference(BaseModel): + address: Optional[str] = None + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/address/anyOf/0' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.address.anyOf[0]" + """ + + auth_enabled: bool + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/auth_enabled' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.auth_enabled" + """ + + command: Optional[str] = None + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/command/anyOf/0' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.command.anyOf[0]" + """ + + containers: List[Container] + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/containers' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.containers" + """ + + created_at: Optional[str] = None + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/created_at/anyOf/0' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.created_at.anyOf[0]" + """ + + credentials_name: str + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/credentials_name' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.credentials_name" + """ + + description: str + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/description' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.description" + """ + + envs: Optional[Dict[str, str]] = None + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/envs/anyOf/0' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.envs.anyOf[0]" + """ + + flavor_name: str + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/flavor_name' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.flavor_name" + """ + + image: str + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/image' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.image" + """ + + ingress_opts: Optional[IngressOptsOut] = None + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/ingress_opts/anyOf/0' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.ingress_opts.anyOf[0]" + """ + + listening_port: int + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/listening_port' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.listening_port" + """ + + logging: Optional[Logging] = None + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/logging/anyOf/0' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.logging.anyOf[0]" + """ + + name: str + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/name' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.name" + """ + + probes: Optional[InferenceProbes] = None + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/probes/anyOf/0' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.probes.anyOf[0]" + """ + + project_id: int + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/project_id' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.project_id" + """ + + status: Literal["ACTIVE", "DELETING", "DEPLOYING", "DISABLED", "PARTIALLYDEPLOYED"] + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/status' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.status" + """ + + timeout: Optional[int] = None + """ + '#/components/schemas/InferenceInstanceOutSerializerV3/properties/timeout/anyOf/0' + "$.components.schemas.InferenceInstanceOutSerializerV3.properties.timeout.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/inference/inference_apikey_secret.py b/src/gcore/types/cloud/inference/inference_apikey_secret.py new file mode 100644 index 00000000..266c8c2e --- /dev/null +++ b/src/gcore/types/cloud/inference/inference_apikey_secret.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["InferenceApikeySecret"] + + +class InferenceApikeySecret(BaseModel): + secret: str + """ + '#/components/schemas/InferenceInstanceApikeySecretSerializerV3/properties/secret' + "$.components.schemas.InferenceInstanceApikeySecretSerializerV3.properties.secret" + """ + + status: Literal["PENDING", "READY"] + """ + '#/components/schemas/InferenceInstanceApikeySecretSerializerV3/properties/status' + "$.components.schemas.InferenceInstanceApikeySecretSerializerV3.properties.status" + """ diff --git a/src/gcore/types/cloud/inference/inference_flavor.py b/src/gcore/types/cloud/inference/inference_flavor.py new file mode 100644 index 00000000..66e4feb8 --- /dev/null +++ b/src/gcore/types/cloud/inference/inference_flavor.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["InferenceFlavor"] + + +class InferenceFlavor(BaseModel): + cpu: float + """ + '#/components/schemas/InferenceFlavorOutSerializerV3/properties/cpu' + "$.components.schemas.InferenceFlavorOutSerializerV3.properties.cpu" + """ + + description: str + """ + '#/components/schemas/InferenceFlavorOutSerializerV3/properties/description' + "$.components.schemas.InferenceFlavorOutSerializerV3.properties.description" + """ + + gpu: int + """ + '#/components/schemas/InferenceFlavorOutSerializerV3/properties/gpu' + "$.components.schemas.InferenceFlavorOutSerializerV3.properties.gpu" + """ + + gpu_compute_capability: str + """ + '#/components/schemas/InferenceFlavorOutSerializerV3/properties/gpu_compute_capability' + "$.components.schemas.InferenceFlavorOutSerializerV3.properties.gpu_compute_capability" + """ + + gpu_memory: float + """ + '#/components/schemas/InferenceFlavorOutSerializerV3/properties/gpu_memory' + "$.components.schemas.InferenceFlavorOutSerializerV3.properties.gpu_memory" + """ + + gpu_model: str + """ + '#/components/schemas/InferenceFlavorOutSerializerV3/properties/gpu_model' + "$.components.schemas.InferenceFlavorOutSerializerV3.properties.gpu_model" + """ + + is_gpu_shared: bool + """ + '#/components/schemas/InferenceFlavorOutSerializerV3/properties/is_gpu_shared' + "$.components.schemas.InferenceFlavorOutSerializerV3.properties.is_gpu_shared" + """ + + memory: float + """ + '#/components/schemas/InferenceFlavorOutSerializerV3/properties/memory' + "$.components.schemas.InferenceFlavorOutSerializerV3.properties.memory" + """ + + name: str + """ + '#/components/schemas/InferenceFlavorOutSerializerV3/properties/name' + "$.components.schemas.InferenceFlavorOutSerializerV3.properties.name" + """ diff --git a/src/gcore/types/cloud/inference/inference_log.py b/src/gcore/types/cloud/inference/inference_log.py new file mode 100644 index 00000000..ad352a48 --- /dev/null +++ b/src/gcore/types/cloud/inference/inference_log.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["InferenceLog"] + + +class InferenceLog(BaseModel): + message: str + """ + '#/components/schemas/InferenceInstanceLogSerializerV3/properties/message' + "$.components.schemas.InferenceInstanceLogSerializerV3.properties.message" + """ + + pod: str + """ + '#/components/schemas/InferenceInstanceLogSerializerV3/properties/pod' + "$.components.schemas.InferenceInstanceLogSerializerV3.properties.pod" + """ + + region_id: int + """ + '#/components/schemas/InferenceInstanceLogSerializerV3/properties/region_id' + "$.components.schemas.InferenceInstanceLogSerializerV3.properties.region_id" + """ + + time: datetime + """ + '#/components/schemas/InferenceInstanceLogSerializerV3/properties/time' + "$.components.schemas.InferenceInstanceLogSerializerV3.properties.time" + """ diff --git a/src/gcore/types/cloud/inference/inference_registry_credential.py b/src/gcore/types/cloud/inference/inference_registry_credential.py new file mode 100644 index 00000000..dc56a378 --- /dev/null +++ b/src/gcore/types/cloud/inference/inference_registry_credential.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["InferenceRegistryCredential"] + + +class InferenceRegistryCredential(BaseModel): + name: str + """ + '#/components/schemas/InferenceRegistryCredentialOutSerializer/properties/name' + "$.components.schemas.InferenceRegistryCredentialOutSerializer.properties.name" + """ + + project_id: int + """ + '#/components/schemas/InferenceRegistryCredentialOutSerializer/properties/project_id' + "$.components.schemas.InferenceRegistryCredentialOutSerializer.properties.project_id" + """ + + registry_url: str + """ + '#/components/schemas/InferenceRegistryCredentialOutSerializer/properties/registry_url' + "$.components.schemas.InferenceRegistryCredentialOutSerializer.properties.registry_url" + """ + + username: str + """ + '#/components/schemas/InferenceRegistryCredentialOutSerializer/properties/username' + "$.components.schemas.InferenceRegistryCredentialOutSerializer.properties.username" + """ diff --git a/src/gcore/types/cloud/inference/inference_registry_credential_full.py b/src/gcore/types/cloud/inference/inference_registry_credential_full.py new file mode 100644 index 00000000..774459aa --- /dev/null +++ b/src/gcore/types/cloud/inference/inference_registry_credential_full.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["InferenceRegistryCredentialFull"] + + +class InferenceRegistryCredentialFull(BaseModel): + name: str + """ + '#/components/schemas/InferenceRegistryCredentialOutFullSerializer/properties/name' + "$.components.schemas.InferenceRegistryCredentialOutFullSerializer.properties.name" + """ + + password: str + """ + '#/components/schemas/InferenceRegistryCredentialOutFullSerializer/properties/password' + "$.components.schemas.InferenceRegistryCredentialOutFullSerializer.properties.password" + """ + + project_id: int + """ + '#/components/schemas/InferenceRegistryCredentialOutFullSerializer/properties/project_id' + "$.components.schemas.InferenceRegistryCredentialOutFullSerializer.properties.project_id" + """ + + registry_url: str + """ + '#/components/schemas/InferenceRegistryCredentialOutFullSerializer/properties/registry_url' + "$.components.schemas.InferenceRegistryCredentialOutFullSerializer.properties.registry_url" + """ + + username: str + """ + '#/components/schemas/InferenceRegistryCredentialOutFullSerializer/properties/username' + "$.components.schemas.InferenceRegistryCredentialOutFullSerializer.properties.username" + """ diff --git a/src/gcore/types/cloud/inference/inference_secret.py b/src/gcore/types/cloud/inference/inference_secret.py new file mode 100644 index 00000000..a3b5e6ff --- /dev/null +++ b/src/gcore/types/cloud/inference/inference_secret.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel +from ..aws_iam_data import AwsIamData + +__all__ = ["InferenceSecret"] + + +class InferenceSecret(BaseModel): + data: AwsIamData + """ + '#/components/schemas/InferenceBoxSecretsSerializer/properties/data' + "$.components.schemas.InferenceBoxSecretsSerializer.properties.data" + """ + + name: str + """ + '#/components/schemas/InferenceBoxSecretsSerializer/properties/name' + "$.components.schemas.InferenceBoxSecretsSerializer.properties.name" + """ + + type: str + """ + '#/components/schemas/InferenceBoxSecretsSerializer/properties/type' + "$.components.schemas.InferenceBoxSecretsSerializer.properties.type" + """ diff --git a/src/gcore/types/cloud/inference/mlcatalog_model_card.py b/src/gcore/types/cloud/inference/mlcatalog_model_card.py new file mode 100644 index 00000000..54c72d8a --- /dev/null +++ b/src/gcore/types/cloud/inference/mlcatalog_model_card.py @@ -0,0 +1,119 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["MlcatalogModelCard"] + + +class MlcatalogModelCard(BaseModel): + id: str + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/id' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.id" + """ + + category: Optional[str] = None + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/category/anyOf/0' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.category.anyOf[0]" + """ + + default_flavor_name: Optional[str] = None + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/default_flavor_name/anyOf/0' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.default_flavor_name.anyOf[0]" + """ + + description: str + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/description' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.description" + """ + + developer: Optional[str] = None + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/developer/anyOf/0' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.developer.anyOf[0]" + """ + + documentation_page: Optional[str] = None + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/documentation_page/anyOf/0' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.documentation_page.anyOf[0]" + """ + + eula_url: Optional[str] = None + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/eula_url/anyOf/0' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.eula_url.anyOf[0]" + """ + + example_curl_request: Optional[str] = None + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/example_curl_request/anyOf/0' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.example_curl_request.anyOf[0]" + """ + + has_eula: bool + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/has_eula' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.has_eula" + """ + + image_registry_id: Optional[str] = None + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/image_registry_id/anyOf/0' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.image_registry_id.anyOf[0]" + """ + + image_url: str + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/image_url' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.image_url" + """ + + inference_backend: Optional[str] = None + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/inference_backend/anyOf/0' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.inference_backend.anyOf[0]" + """ + + inference_frontend: Optional[str] = None + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/inference_frontend/anyOf/0' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.inference_frontend.anyOf[0]" + """ + + api_model_id: Optional[str] = FieldInfo(alias="model_id", default=None) + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/model_id/anyOf/0' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.model_id.anyOf[0]" + """ + + name: str + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/name' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.name" + """ + + openai_compatibility: Optional[str] = None + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/openai_compatibility/anyOf/0' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.openai_compatibility.anyOf[0]" + """ + + port: int + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/port' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.port" + """ + + version: Optional[str] = None + """ + '#/components/schemas/MLCatalogModelCardSerializerV3/properties/version/anyOf/0' + "$.components.schemas.MLCatalogModelCardSerializerV3.properties.version.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/inference/mlcatalog_order_by_choices.py b/src/gcore/types/cloud/inference/mlcatalog_order_by_choices.py new file mode 100644 index 00000000..6b6f1648 --- /dev/null +++ b/src/gcore/types/cloud/inference/mlcatalog_order_by_choices.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["MlcatalogOrderByChoices"] + +MlcatalogOrderByChoices: TypeAlias = Literal["name.asc", "name.desc"] diff --git a/src/gcore/types/cloud/inference/model_list_params.py b/src/gcore/types/cloud/inference/model_list_params.py new file mode 100644 index 00000000..ae565c29 --- /dev/null +++ b/src/gcore/types/cloud/inference/model_list_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from .mlcatalog_order_by_choices import MlcatalogOrderByChoices + +__all__ = ["ModelListParams"] + + +class ModelListParams(TypedDict, total=False): + limit: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/0' + "$.paths['/cloud/v3/inference/models'].get.parameters[0]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/1' + "$.paths['/cloud/v3/inference/models'].get.parameters[1]" + """ + + order_by: MlcatalogOrderByChoices + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/2' + "$.paths['/cloud/v3/inference/models'].get.parameters[2]" + """ diff --git a/src/gcore/types/cloud/inference/registry_credential_create_params.py b/src/gcore/types/cloud/inference/registry_credential_create_params.py new file mode 100644 index 00000000..46ea8c64 --- /dev/null +++ b/src/gcore/types/cloud/inference/registry_credential_create_params.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RegistryCredentialCreateParams"] + + +class RegistryCredentialCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].post.parameters[0].schema" + """ + + name: Required[str] + """ + '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/name' + "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.name" + """ + + password: Required[str] + """ + '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/password' + "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.password" + """ + + registry_url: Required[str] + """ + '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/registry_url' + "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.registry_url" + """ + + username: Required[str] + """ + '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/username' + "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.username" + """ diff --git a/src/gcore/types/cloud/inference/registry_credential_list_params.py b/src/gcore/types/cloud/inference/registry_credential_list_params.py new file mode 100644 index 00000000..0707f5ab --- /dev/null +++ b/src/gcore/types/cloud/inference/registry_credential_list_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["RegistryCredentialListParams"] + + +class RegistryCredentialListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[0].schema" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/1' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[1]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/2' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[2]" + """ diff --git a/src/gcore/types/cloud/inference/registry_credential_replace_params.py b/src/gcore/types/cloud/inference/registry_credential_replace_params.py new file mode 100644 index 00000000..6b829ea4 --- /dev/null +++ b/src/gcore/types/cloud/inference/registry_credential_replace_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RegistryCredentialReplaceParams"] + + +class RegistryCredentialReplaceParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/put/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].put.parameters[0].schema" + """ + + password: Required[str] + """ + '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/password' + "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.password" + """ + + registry_url: Required[str] + """ + '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/registry_url' + "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.registry_url" + """ + + username: Required[str] + """ + '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/username' + "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.username" + """ diff --git a/src/gcore/types/cloud/inference/secret_create_params.py b/src/gcore/types/cloud/inference/secret_create_params.py new file mode 100644 index 00000000..60d586de --- /dev/null +++ b/src/gcore/types/cloud/inference/secret_create_params.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ..aws_iam_data_param import AwsIamDataParam + +__all__ = ["SecretCreateParams"] + + +class SecretCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/post/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets'].post.parameters[0].schema" + """ + + data: Required[AwsIamDataParam] + """ + '#/components/schemas/InferenceBoxSecretsInSerializer/properties/data' + "$.components.schemas.InferenceBoxSecretsInSerializer.properties.data" + """ + + name: Required[str] + """ + '#/components/schemas/InferenceBoxSecretsInSerializer/properties/name' + "$.components.schemas.InferenceBoxSecretsInSerializer.properties.name" + """ + + type: Required[str] + """ + '#/components/schemas/InferenceBoxSecretsInSerializer/properties/type' + "$.components.schemas.InferenceBoxSecretsInSerializer.properties.type" + """ diff --git a/src/gcore/types/cloud/inference/secret_list_params.py b/src/gcore/types/cloud/inference/secret_list_params.py new file mode 100644 index 00000000..dc14d4d3 --- /dev/null +++ b/src/gcore/types/cloud/inference/secret_list_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["SecretListParams"] + + +class SecretListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[0].schema" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/1' + "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[1]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/2' + "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[2]" + """ diff --git a/src/gcore/types/cloud/inference/secret_replace_params.py b/src/gcore/types/cloud/inference/secret_replace_params.py new file mode 100644 index 00000000..182fbeb8 --- /dev/null +++ b/src/gcore/types/cloud/inference/secret_replace_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ..aws_iam_data_param import AwsIamDataParam + +__all__ = ["SecretReplaceParams"] + + +class SecretReplaceParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/put/parameters/0/schema' + "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].put.parameters[0].schema" + """ + + data: Required[AwsIamDataParam] + """ + '#/components/schemas/InferenceSecretInUpdateSerializer/properties/data' + "$.components.schemas.InferenceSecretInUpdateSerializer.properties.data" + """ + + type: Required[str] + """ + '#/components/schemas/InferenceSecretInUpdateSerializer/properties/type' + "$.components.schemas.InferenceSecretInUpdateSerializer.properties.type" + """ diff --git a/src/gcore/types/cloud/inference_probes.py b/src/gcore/types/cloud/inference_probes.py new file mode 100644 index 00000000..63c6fcef --- /dev/null +++ b/src/gcore/types/cloud/inference_probes.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .container_probe_config import ContainerProbeConfig + +__all__ = ["InferenceProbes"] + + +class InferenceProbes(BaseModel): + liveness_probe: Optional[ContainerProbeConfig] = None + """ + '#/components/schemas/InferenceInstanceProbesOutSerializerV2/properties/liveness_probe/anyOf/0' + "$.components.schemas.InferenceInstanceProbesOutSerializerV2.properties.liveness_probe.anyOf[0]" + """ + + readiness_probe: Optional[ContainerProbeConfig] = None + """ + '#/components/schemas/InferenceInstanceProbesOutSerializerV2/properties/readiness_probe/anyOf/0' + "$.components.schemas.InferenceInstanceProbesOutSerializerV2.properties.readiness_probe.anyOf[0]" + """ + + startup_probe: Optional[ContainerProbeConfig] = None + """ + '#/components/schemas/InferenceInstanceProbesOutSerializerV2/properties/startup_probe/anyOf/0' + "$.components.schemas.InferenceInstanceProbesOutSerializerV2.properties.startup_probe.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/ingress_opts_out.py b/src/gcore/types/cloud/ingress_opts_out.py new file mode 100644 index 00000000..67158dc7 --- /dev/null +++ b/src/gcore/types/cloud/ingress_opts_out.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["IngressOptsOut"] + + +class IngressOptsOut(BaseModel): + disable_response_buffering: bool + """ + '#/components/schemas/IngressOptsOutSerializer/properties/disable_response_buffering' + "$.components.schemas.IngressOptsOutSerializer.properties.disable_response_buffering" + """ diff --git a/src/gcore/types/cloud/ingress_opts_param.py b/src/gcore/types/cloud/ingress_opts_param.py new file mode 100644 index 00000000..8314784c --- /dev/null +++ b/src/gcore/types/cloud/ingress_opts_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["IngressOptsParam"] + + +class IngressOptsParam(TypedDict, total=False): + disable_response_buffering: bool + """ + '#/components/schemas/IngressOptsSerializer/properties/disable_response_buffering' + "$.components.schemas.IngressOptsSerializer.properties.disable_response_buffering" + """ diff --git a/src/gcore/types/cloud/load_balancer.py b/src/gcore/types/cloud/load_balancer.py index b883c3b4..807140a1 100644 --- a/src/gcore/types/cloud/load_balancer.py +++ b/src/gcore/types/cloud/load_balancer.py @@ -4,6 +4,7 @@ from datetime import datetime from .tag import Tag +from .logging import Logging from ..._models import BaseModel from .floating_ip import FloatingIP from .ddos_profile import DDOSProfile @@ -14,7 +15,7 @@ from .load_balancer_operating_status import LoadBalancerOperatingStatus from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity -__all__ = ["LoadBalancer", "AdditionalVip", "Flavor", "Listener", "Logging", "LoggingRetentionPolicy", "VrrpIP"] +__all__ = ["LoadBalancer", "AdditionalVip", "Flavor", "Listener", "VrrpIP"] class AdditionalVip(BaseModel): @@ -65,40 +66,6 @@ class Listener(BaseModel): """ -class LoggingRetentionPolicy(BaseModel): - period: Optional[int] = None - """ - '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' - "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" - """ - - -class Logging(BaseModel): - destination_region_id: Optional[int] = None - """ - '#/components/schemas/LoggingOutSerializer/properties/destination_region_id/anyOf/0' - "$.components.schemas.LoggingOutSerializer.properties.destination_region_id.anyOf[0]" - """ - - enabled: bool - """ - '#/components/schemas/LoggingOutSerializer/properties/enabled' - "$.components.schemas.LoggingOutSerializer.properties.enabled" - """ - - topic_name: Optional[str] = None - """ - '#/components/schemas/LoggingOutSerializer/properties/topic_name/anyOf/0' - "$.components.schemas.LoggingOutSerializer.properties.topic_name.anyOf[0]" - """ - - retention_policy: Optional[LoggingRetentionPolicy] = None - """ - '#/components/schemas/LoggingOutSerializer/properties/retention_policy/anyOf/0' - "$.components.schemas.LoggingOutSerializer.properties.retention_policy.anyOf[0]" - """ - - class VrrpIP(BaseModel): ip_address: str """ diff --git a/src/gcore/types/cloud/logging.py b/src/gcore/types/cloud/logging.py new file mode 100644 index 00000000..341eeb99 --- /dev/null +++ b/src/gcore/types/cloud/logging.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Logging", "RetentionPolicy"] + + +class RetentionPolicy(BaseModel): + period: Optional[int] = None + """ + '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' + "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" + """ + + +class Logging(BaseModel): + destination_region_id: Optional[int] = None + """ + '#/components/schemas/LoggingOutSerializer/properties/destination_region_id/anyOf/0' + "$.components.schemas.LoggingOutSerializer.properties.destination_region_id.anyOf[0]" + """ + + enabled: bool + """ + '#/components/schemas/LoggingOutSerializer/properties/enabled' + "$.components.schemas.LoggingOutSerializer.properties.enabled" + """ + + topic_name: Optional[str] = None + """ + '#/components/schemas/LoggingOutSerializer/properties/topic_name/anyOf/0' + "$.components.schemas.LoggingOutSerializer.properties.topic_name.anyOf[0]" + """ + + retention_policy: Optional[RetentionPolicy] = None + """ + '#/components/schemas/LoggingOutSerializer/properties/retention_policy/anyOf/0' + "$.components.schemas.LoggingOutSerializer.properties.retention_policy.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/region_capacity.py b/src/gcore/types/cloud/region_capacity.py new file mode 100644 index 00000000..89b2d6d1 --- /dev/null +++ b/src/gcore/types/cloud/region_capacity.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .capacity import Capacity +from ..._models import BaseModel + +__all__ = ["RegionCapacity"] + + +class RegionCapacity(BaseModel): + capacity: List[Capacity] + """ + '#/components/schemas/RegionCapacityOutSerializerV3/properties/capacity' + "$.components.schemas.RegionCapacityOutSerializerV3.properties.capacity" + """ + + region_id: int + """ + '#/components/schemas/RegionCapacityOutSerializerV3/properties/region_id' + "$.components.schemas.RegionCapacityOutSerializerV3.properties.region_id" + """ diff --git a/src/gcore/types/cloud/region_capacity_list.py b/src/gcore/types/cloud/region_capacity_list.py new file mode 100644 index 00000000..09e531e3 --- /dev/null +++ b/src/gcore/types/cloud/region_capacity_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .region_capacity import RegionCapacity + +__all__ = ["RegionCapacityList"] + + +class RegionCapacityList(BaseModel): + count: int + """ + '#/components/schemas/RegionCapacityOutSerializerV3List/properties/count' + "$.components.schemas.RegionCapacityOutSerializerV3List.properties.count" + """ + + results: List[RegionCapacity] + """ + '#/components/schemas/RegionCapacityOutSerializerV3List/properties/results' + "$.components.schemas.RegionCapacityOutSerializerV3List.properties.results" + """ diff --git a/tests/api_resources/cloud/inference/__init__.py b/tests/api_resources/cloud/inference/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/inference/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/inference/deployments/__init__.py b/tests/api_resources/cloud/inference/deployments/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/inference/deployments/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/inference/deployments/test_logs.py b/tests/api_resources/cloud/inference/deployments/test_logs.py new file mode 100644 index 00000000..b23ecfa9 --- /dev/null +++ b/tests/api_resources/cloud/inference/deployments/test_logs.py @@ -0,0 +1,131 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud.inference import InferenceLog + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLogs: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + log = client.cloud.inference.deployments.logs.list( + deployment_name="my-instance", + project_id=1, + ) + assert_matches_type(SyncOffsetPage[InferenceLog], log, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + log = client.cloud.inference.deployments.logs.list( + deployment_name="my-instance", + project_id=1, + limit=1000, + offset=0, + order_by="time.asc", + region_id=1, + ) + assert_matches_type(SyncOffsetPage[InferenceLog], log, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.inference.deployments.logs.with_raw_response.list( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + log = response.parse() + assert_matches_type(SyncOffsetPage[InferenceLog], log, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.inference.deployments.logs.with_streaming_response.list( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + log = response.parse() + assert_matches_type(SyncOffsetPage[InferenceLog], log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + client.cloud.inference.deployments.logs.with_raw_response.list( + deployment_name="", + project_id=1, + ) + + +class TestAsyncLogs: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + log = await async_client.cloud.inference.deployments.logs.list( + deployment_name="my-instance", + project_id=1, + ) + assert_matches_type(AsyncOffsetPage[InferenceLog], log, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + log = await async_client.cloud.inference.deployments.logs.list( + deployment_name="my-instance", + project_id=1, + limit=1000, + offset=0, + order_by="time.asc", + region_id=1, + ) + assert_matches_type(AsyncOffsetPage[InferenceLog], log, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.deployments.logs.with_raw_response.list( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + log = await response.parse() + assert_matches_type(AsyncOffsetPage[InferenceLog], log, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.deployments.logs.with_streaming_response.list( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + log = await response.parse() + assert_matches_type(AsyncOffsetPage[InferenceLog], log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + await async_client.cloud.inference.deployments.logs.with_raw_response.list( + deployment_name="", + project_id=1, + ) diff --git a/tests/api_resources/cloud/inference/test_deployments.py b/tests/api_resources/cloud/inference/test_deployments.py new file mode 100644 index 00000000..d3c9765b --- /dev/null +++ b/tests/api_resources/cloud/inference/test_deployments.py @@ -0,0 +1,1219 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.inference import ( + Inference, + InferenceApikeySecret, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDeployments: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + deployment = client.cloud.inference.deployments.create( + project_id=1, + containers=[ + { + "region_id": 1, + "scale": { + "max": 3, + "min": 1, + }, + } + ], + flavor_name="inference-16vcpu-232gib-1xh100-80gb", + image="nginx:latest", + listening_port=80, + name="my-instance", + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + deployment = client.cloud.inference.deployments.create( + project_id=1, + containers=[ + { + "region_id": 1, + "scale": { + "max": 3, + "min": 1, + "cooldown_period": 60, + "polling_interval": 30, + "triggers": { + "cpu": {"threshold": 80}, + "gpu_memory": {"threshold": 80}, + "gpu_utilization": {"threshold": 80}, + "http": { + "rate": 1, + "window": 60, + }, + "memory": {"threshold": 70}, + "sqs": { + "activation_queue_length": 1, + "aws_region": "us-east-1", + "queue_length": 10, + "queue_url": "https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue", + "secret_name": "x", + "aws_endpoint": "aws_endpoint", + "scale_on_delayed": True, + "scale_on_flight": True, + }, + }, + }, + } + ], + flavor_name="inference-16vcpu-232gib-1xh100-80gb", + image="nginx:latest", + listening_port=80, + name="my-instance", + auth_enabled=False, + command=["nginx", "-g", "daemon off;"], + credentials_name="dockerhub", + description="My first instance", + envs={ + "DEBUG_MODE": "False", + "KEY": "12345", + }, + ingress_opts={"disable_response_buffering": True}, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 42}, + "topic_name": "my-log-name", + }, + probes={ + "liveness_probe": { + "enabled": True, + "probe": { + "exec": {"command": ["ls", "-l"]}, + "failure_threshold": 3, + "http_get": { + "port": 80, + "headers": {"Authorization": "Bearer token 123"}, + "host": "127.0.0.1", + "path": "/healthz", + "schema": "HTTP", + }, + "initial_delay_seconds": 0, + "period_seconds": 5, + "success_threshold": 1, + "tcp_socket": {"port": 80}, + "timeout_seconds": 1, + }, + }, + "readiness_probe": { + "enabled": True, + "probe": { + "exec": {"command": ["ls", "-l"]}, + "failure_threshold": 3, + "http_get": { + "port": 80, + "headers": {"Authorization": "Bearer token 123"}, + "host": "127.0.0.1", + "path": "/healthz", + "schema": "HTTP", + }, + "initial_delay_seconds": 0, + "period_seconds": 5, + "success_threshold": 1, + "tcp_socket": {"port": 80}, + "timeout_seconds": 1, + }, + }, + "startup_probe": { + "enabled": True, + "probe": { + "exec": {"command": ["ls", "-l"]}, + "failure_threshold": 3, + "http_get": { + "port": 80, + "headers": {"Authorization": "Bearer token 123"}, + "host": "127.0.0.1", + "path": "/healthz", + "schema": "HTTP", + }, + "initial_delay_seconds": 0, + "period_seconds": 5, + "success_threshold": 1, + "tcp_socket": {"port": 80}, + "timeout_seconds": 1, + }, + }, + }, + api_timeout=120, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.inference.deployments.with_raw_response.create( + project_id=1, + containers=[ + { + "region_id": 1, + "scale": { + "max": 3, + "min": 1, + }, + } + ], + flavor_name="inference-16vcpu-232gib-1xh100-80gb", + image="nginx:latest", + listening_port=80, + name="my-instance", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.inference.deployments.with_streaming_response.create( + project_id=1, + containers=[ + { + "region_id": 1, + "scale": { + "max": 3, + "min": 1, + }, + } + ], + flavor_name="inference-16vcpu-232gib-1xh100-80gb", + image="nginx:latest", + listening_port=80, + name="my-instance", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + deployment = client.cloud.inference.deployments.update( + deployment_name="my-instance", + project_id=1, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + deployment = client.cloud.inference.deployments.update( + deployment_name="my-instance", + project_id=1, + auth_enabled=False, + command=["nginx", "-g", "daemon off;"], + containers=[ + { + "region_id": 0, + "scale": { + "max": 3, + "min": 1, + "cooldown_period": 60, + "polling_interval": 30, + "triggers": { + "cpu": {"threshold": 80}, + "gpu_memory": {"threshold": 80}, + "gpu_utilization": {"threshold": 80}, + "http": { + "rate": 1, + "window": 60, + }, + "memory": {"threshold": 70}, + "sqs": { + "activation_queue_length": 1, + "aws_region": "us-east-1", + "queue_length": 10, + "queue_url": "https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue", + "secret_name": "x", + "aws_endpoint": "aws_endpoint", + "scale_on_delayed": True, + "scale_on_flight": True, + }, + }, + }, + } + ], + credentials_name="dockerhub", + description="My first instance", + envs={ + "DEBUG_MODE": "False", + "KEY": "12345", + }, + flavor_name="inference-16vcpu-232gib-1xh100-80gb", + image="nginx:latest", + ingress_opts={"disable_response_buffering": True}, + listening_port=80, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 42}, + "topic_name": "my-log-name", + }, + probes={ + "liveness_probe": { + "enabled": True, + "probe": { + "exec": {"command": ["ls", "-l"]}, + "failure_threshold": 3, + "http_get": { + "port": 80, + "headers": {"Authorization": "Bearer token 123"}, + "host": "127.0.0.1", + "path": "/healthz", + "schema": "HTTP", + }, + "initial_delay_seconds": 0, + "period_seconds": 5, + "success_threshold": 1, + "tcp_socket": {"port": 80}, + "timeout_seconds": 1, + }, + }, + "readiness_probe": { + "enabled": True, + "probe": { + "exec": {"command": ["ls", "-l"]}, + "failure_threshold": 3, + "http_get": { + "port": 80, + "headers": {"Authorization": "Bearer token 123"}, + "host": "127.0.0.1", + "path": "/healthz", + "schema": "HTTP", + }, + "initial_delay_seconds": 0, + "period_seconds": 5, + "success_threshold": 1, + "tcp_socket": {"port": 80}, + "timeout_seconds": 1, + }, + }, + "startup_probe": { + "enabled": True, + "probe": { + "exec": {"command": ["ls", "-l"]}, + "failure_threshold": 3, + "http_get": { + "port": 80, + "headers": {"Authorization": "Bearer token 123"}, + "host": "127.0.0.1", + "path": "/healthz", + "schema": "HTTP", + }, + "initial_delay_seconds": 0, + "period_seconds": 5, + "success_threshold": 1, + "tcp_socket": {"port": 80}, + "timeout_seconds": 1, + }, + }, + }, + api_timeout=120, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.inference.deployments.with_raw_response.update( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.inference.deployments.with_streaming_response.update( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + client.cloud.inference.deployments.with_raw_response.update( + deployment_name="", + project_id=1, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + deployment = client.cloud.inference.deployments.list( + project_id=1, + ) + assert_matches_type(SyncOffsetPage[Inference], deployment, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + deployment = client.cloud.inference.deployments.list( + project_id=1, + limit=1000, + offset=0, + ) + assert_matches_type(SyncOffsetPage[Inference], deployment, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.inference.deployments.with_raw_response.list( + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(SyncOffsetPage[Inference], deployment, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.inference.deployments.with_streaming_response.list( + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert_matches_type(SyncOffsetPage[Inference], deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + deployment = client.cloud.inference.deployments.delete( + deployment_name="my-instance", + project_id=1, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.inference.deployments.with_raw_response.delete( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.inference.deployments.with_streaming_response.delete( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + client.cloud.inference.deployments.with_raw_response.delete( + deployment_name="", + project_id=1, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + deployment = client.cloud.inference.deployments.get( + deployment_name="my-instance", + project_id=1, + ) + assert_matches_type(Inference, deployment, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.inference.deployments.with_raw_response.get( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(Inference, deployment, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.inference.deployments.with_streaming_response.get( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert_matches_type(Inference, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + client.cloud.inference.deployments.with_raw_response.get( + deployment_name="", + project_id=1, + ) + + @parametrize + def test_method_get_api_key(self, client: Gcore) -> None: + deployment = client.cloud.inference.deployments.get_api_key( + deployment_name="my-instance", + project_id=1, + ) + assert_matches_type(InferenceApikeySecret, deployment, path=["response"]) + + @parametrize + def test_raw_response_get_api_key(self, client: Gcore) -> None: + response = client.cloud.inference.deployments.with_raw_response.get_api_key( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(InferenceApikeySecret, deployment, path=["response"]) + + @parametrize + def test_streaming_response_get_api_key(self, client: Gcore) -> None: + with client.cloud.inference.deployments.with_streaming_response.get_api_key( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert_matches_type(InferenceApikeySecret, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_api_key(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + client.cloud.inference.deployments.with_raw_response.get_api_key( + deployment_name="", + project_id=1, + ) + + @parametrize + def test_method_start(self, client: Gcore) -> None: + deployment = client.cloud.inference.deployments.start( + deployment_name="my-instance", + project_id=1, + ) + assert deployment is None + + @parametrize + def test_raw_response_start(self, client: Gcore) -> None: + response = client.cloud.inference.deployments.with_raw_response.start( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert deployment is None + + @parametrize + def test_streaming_response_start(self, client: Gcore) -> None: + with client.cloud.inference.deployments.with_streaming_response.start( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert deployment is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_start(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + client.cloud.inference.deployments.with_raw_response.start( + deployment_name="", + project_id=1, + ) + + @parametrize + def test_method_stop(self, client: Gcore) -> None: + deployment = client.cloud.inference.deployments.stop( + deployment_name="my-instance", + project_id=1, + ) + assert deployment is None + + @parametrize + def test_raw_response_stop(self, client: Gcore) -> None: + response = client.cloud.inference.deployments.with_raw_response.stop( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert deployment is None + + @parametrize + def test_streaming_response_stop(self, client: Gcore) -> None: + with client.cloud.inference.deployments.with_streaming_response.stop( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert deployment is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_stop(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + client.cloud.inference.deployments.with_raw_response.stop( + deployment_name="", + project_id=1, + ) + + +class TestAsyncDeployments: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.deployments.create( + project_id=1, + containers=[ + { + "region_id": 1, + "scale": { + "max": 3, + "min": 1, + }, + } + ], + flavor_name="inference-16vcpu-232gib-1xh100-80gb", + image="nginx:latest", + listening_port=80, + name="my-instance", + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.deployments.create( + project_id=1, + containers=[ + { + "region_id": 1, + "scale": { + "max": 3, + "min": 1, + "cooldown_period": 60, + "polling_interval": 30, + "triggers": { + "cpu": {"threshold": 80}, + "gpu_memory": {"threshold": 80}, + "gpu_utilization": {"threshold": 80}, + "http": { + "rate": 1, + "window": 60, + }, + "memory": {"threshold": 70}, + "sqs": { + "activation_queue_length": 1, + "aws_region": "us-east-1", + "queue_length": 10, + "queue_url": "https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue", + "secret_name": "x", + "aws_endpoint": "aws_endpoint", + "scale_on_delayed": True, + "scale_on_flight": True, + }, + }, + }, + } + ], + flavor_name="inference-16vcpu-232gib-1xh100-80gb", + image="nginx:latest", + listening_port=80, + name="my-instance", + auth_enabled=False, + command=["nginx", "-g", "daemon off;"], + credentials_name="dockerhub", + description="My first instance", + envs={ + "DEBUG_MODE": "False", + "KEY": "12345", + }, + ingress_opts={"disable_response_buffering": True}, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 42}, + "topic_name": "my-log-name", + }, + probes={ + "liveness_probe": { + "enabled": True, + "probe": { + "exec": {"command": ["ls", "-l"]}, + "failure_threshold": 3, + "http_get": { + "port": 80, + "headers": {"Authorization": "Bearer token 123"}, + "host": "127.0.0.1", + "path": "/healthz", + "schema": "HTTP", + }, + "initial_delay_seconds": 0, + "period_seconds": 5, + "success_threshold": 1, + "tcp_socket": {"port": 80}, + "timeout_seconds": 1, + }, + }, + "readiness_probe": { + "enabled": True, + "probe": { + "exec": {"command": ["ls", "-l"]}, + "failure_threshold": 3, + "http_get": { + "port": 80, + "headers": {"Authorization": "Bearer token 123"}, + "host": "127.0.0.1", + "path": "/healthz", + "schema": "HTTP", + }, + "initial_delay_seconds": 0, + "period_seconds": 5, + "success_threshold": 1, + "tcp_socket": {"port": 80}, + "timeout_seconds": 1, + }, + }, + "startup_probe": { + "enabled": True, + "probe": { + "exec": {"command": ["ls", "-l"]}, + "failure_threshold": 3, + "http_get": { + "port": 80, + "headers": {"Authorization": "Bearer token 123"}, + "host": "127.0.0.1", + "path": "/healthz", + "schema": "HTTP", + }, + "initial_delay_seconds": 0, + "period_seconds": 5, + "success_threshold": 1, + "tcp_socket": {"port": 80}, + "timeout_seconds": 1, + }, + }, + }, + api_timeout=120, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.deployments.with_raw_response.create( + project_id=1, + containers=[ + { + "region_id": 1, + "scale": { + "max": 3, + "min": 1, + }, + } + ], + flavor_name="inference-16vcpu-232gib-1xh100-80gb", + image="nginx:latest", + listening_port=80, + name="my-instance", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.deployments.with_streaming_response.create( + project_id=1, + containers=[ + { + "region_id": 1, + "scale": { + "max": 3, + "min": 1, + }, + } + ], + flavor_name="inference-16vcpu-232gib-1xh100-80gb", + image="nginx:latest", + listening_port=80, + name="my-instance", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.deployments.update( + deployment_name="my-instance", + project_id=1, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.deployments.update( + deployment_name="my-instance", + project_id=1, + auth_enabled=False, + command=["nginx", "-g", "daemon off;"], + containers=[ + { + "region_id": 0, + "scale": { + "max": 3, + "min": 1, + "cooldown_period": 60, + "polling_interval": 30, + "triggers": { + "cpu": {"threshold": 80}, + "gpu_memory": {"threshold": 80}, + "gpu_utilization": {"threshold": 80}, + "http": { + "rate": 1, + "window": 60, + }, + "memory": {"threshold": 70}, + "sqs": { + "activation_queue_length": 1, + "aws_region": "us-east-1", + "queue_length": 10, + "queue_url": "https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue", + "secret_name": "x", + "aws_endpoint": "aws_endpoint", + "scale_on_delayed": True, + "scale_on_flight": True, + }, + }, + }, + } + ], + credentials_name="dockerhub", + description="My first instance", + envs={ + "DEBUG_MODE": "False", + "KEY": "12345", + }, + flavor_name="inference-16vcpu-232gib-1xh100-80gb", + image="nginx:latest", + ingress_opts={"disable_response_buffering": True}, + listening_port=80, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 42}, + "topic_name": "my-log-name", + }, + probes={ + "liveness_probe": { + "enabled": True, + "probe": { + "exec": {"command": ["ls", "-l"]}, + "failure_threshold": 3, + "http_get": { + "port": 80, + "headers": {"Authorization": "Bearer token 123"}, + "host": "127.0.0.1", + "path": "/healthz", + "schema": "HTTP", + }, + "initial_delay_seconds": 0, + "period_seconds": 5, + "success_threshold": 1, + "tcp_socket": {"port": 80}, + "timeout_seconds": 1, + }, + }, + "readiness_probe": { + "enabled": True, + "probe": { + "exec": {"command": ["ls", "-l"]}, + "failure_threshold": 3, + "http_get": { + "port": 80, + "headers": {"Authorization": "Bearer token 123"}, + "host": "127.0.0.1", + "path": "/healthz", + "schema": "HTTP", + }, + "initial_delay_seconds": 0, + "period_seconds": 5, + "success_threshold": 1, + "tcp_socket": {"port": 80}, + "timeout_seconds": 1, + }, + }, + "startup_probe": { + "enabled": True, + "probe": { + "exec": {"command": ["ls", "-l"]}, + "failure_threshold": 3, + "http_get": { + "port": 80, + "headers": {"Authorization": "Bearer token 123"}, + "host": "127.0.0.1", + "path": "/healthz", + "schema": "HTTP", + }, + "initial_delay_seconds": 0, + "period_seconds": 5, + "success_threshold": 1, + "tcp_socket": {"port": 80}, + "timeout_seconds": 1, + }, + }, + }, + api_timeout=120, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.deployments.with_raw_response.update( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.deployments.with_streaming_response.update( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + await async_client.cloud.inference.deployments.with_raw_response.update( + deployment_name="", + project_id=1, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.deployments.list( + project_id=1, + ) + assert_matches_type(AsyncOffsetPage[Inference], deployment, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.deployments.list( + project_id=1, + limit=1000, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[Inference], deployment, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.deployments.with_raw_response.list( + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(AsyncOffsetPage[Inference], deployment, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.deployments.with_streaming_response.list( + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert_matches_type(AsyncOffsetPage[Inference], deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.deployments.delete( + deployment_name="my-instance", + project_id=1, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.deployments.with_raw_response.delete( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.deployments.with_streaming_response.delete( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + await async_client.cloud.inference.deployments.with_raw_response.delete( + deployment_name="", + project_id=1, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.deployments.get( + deployment_name="my-instance", + project_id=1, + ) + assert_matches_type(Inference, deployment, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.deployments.with_raw_response.get( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(Inference, deployment, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.deployments.with_streaming_response.get( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert_matches_type(Inference, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + await async_client.cloud.inference.deployments.with_raw_response.get( + deployment_name="", + project_id=1, + ) + + @parametrize + async def test_method_get_api_key(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.deployments.get_api_key( + deployment_name="my-instance", + project_id=1, + ) + assert_matches_type(InferenceApikeySecret, deployment, path=["response"]) + + @parametrize + async def test_raw_response_get_api_key(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.deployments.with_raw_response.get_api_key( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(InferenceApikeySecret, deployment, path=["response"]) + + @parametrize + async def test_streaming_response_get_api_key(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.deployments.with_streaming_response.get_api_key( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert_matches_type(InferenceApikeySecret, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_api_key(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + await async_client.cloud.inference.deployments.with_raw_response.get_api_key( + deployment_name="", + project_id=1, + ) + + @parametrize + async def test_method_start(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.deployments.start( + deployment_name="my-instance", + project_id=1, + ) + assert deployment is None + + @parametrize + async def test_raw_response_start(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.deployments.with_raw_response.start( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert deployment is None + + @parametrize + async def test_streaming_response_start(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.deployments.with_streaming_response.start( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert deployment is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_start(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + await async_client.cloud.inference.deployments.with_raw_response.start( + deployment_name="", + project_id=1, + ) + + @parametrize + async def test_method_stop(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.deployments.stop( + deployment_name="my-instance", + project_id=1, + ) + assert deployment is None + + @parametrize + async def test_raw_response_stop(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.deployments.with_raw_response.stop( + deployment_name="my-instance", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert deployment is None + + @parametrize + async def test_streaming_response_stop(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.deployments.with_streaming_response.stop( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert deployment is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_stop(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + await async_client.cloud.inference.deployments.with_raw_response.stop( + deployment_name="", + project_id=1, + ) diff --git a/tests/api_resources/cloud/inference/test_flavors.py b/tests/api_resources/cloud/inference/test_flavors.py new file mode 100644 index 00000000..cc6433e5 --- /dev/null +++ b/tests/api_resources/cloud/inference/test_flavors.py @@ -0,0 +1,165 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud.inference import InferenceFlavor + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFlavors: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + flavor = client.cloud.inference.flavors.list() + assert_matches_type(SyncOffsetPage[InferenceFlavor], flavor, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + flavor = client.cloud.inference.flavors.list( + limit=1000, + offset=0, + ) + assert_matches_type(SyncOffsetPage[InferenceFlavor], flavor, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.inference.flavors.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = response.parse() + assert_matches_type(SyncOffsetPage[InferenceFlavor], flavor, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.inference.flavors.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = response.parse() + assert_matches_type(SyncOffsetPage[InferenceFlavor], flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + flavor = client.cloud.inference.flavors.get( + "inference-16vcpu-232gib-1xh100-80gb", + ) + assert_matches_type(InferenceFlavor, flavor, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.inference.flavors.with_raw_response.get( + "inference-16vcpu-232gib-1xh100-80gb", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = response.parse() + assert_matches_type(InferenceFlavor, flavor, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.inference.flavors.with_streaming_response.get( + "inference-16vcpu-232gib-1xh100-80gb", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = response.parse() + assert_matches_type(InferenceFlavor, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flavor_name` but received ''"): + client.cloud.inference.flavors.with_raw_response.get( + "", + ) + + +class TestAsyncFlavors: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.inference.flavors.list() + assert_matches_type(AsyncOffsetPage[InferenceFlavor], flavor, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.inference.flavors.list( + limit=1000, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[InferenceFlavor], flavor, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.flavors.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = await response.parse() + assert_matches_type(AsyncOffsetPage[InferenceFlavor], flavor, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.flavors.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = await response.parse() + assert_matches_type(AsyncOffsetPage[InferenceFlavor], flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.inference.flavors.get( + "inference-16vcpu-232gib-1xh100-80gb", + ) + assert_matches_type(InferenceFlavor, flavor, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.flavors.with_raw_response.get( + "inference-16vcpu-232gib-1xh100-80gb", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = await response.parse() + assert_matches_type(InferenceFlavor, flavor, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.flavors.with_streaming_response.get( + "inference-16vcpu-232gib-1xh100-80gb", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = await response.parse() + assert_matches_type(InferenceFlavor, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `flavor_name` but received ''"): + await async_client.cloud.inference.flavors.with_raw_response.get( + "", + ) diff --git a/tests/api_resources/cloud/inference/test_models.py b/tests/api_resources/cloud/inference/test_models.py new file mode 100644 index 00000000..23048376 --- /dev/null +++ b/tests/api_resources/cloud/inference/test_models.py @@ -0,0 +1,167 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud.inference import MlcatalogModelCard + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestModels: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + model = client.cloud.inference.models.list() + assert_matches_type(SyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + model = client.cloud.inference.models.list( + limit=1000, + offset=0, + order_by="name.asc", + ) + assert_matches_type(SyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.inference.models.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + model = response.parse() + assert_matches_type(SyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.inference.models.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + model = response.parse() + assert_matches_type(SyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + model = client.cloud.inference.models.get( + "model_id", + ) + assert_matches_type(MlcatalogModelCard, model, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.inference.models.with_raw_response.get( + "model_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + model = response.parse() + assert_matches_type(MlcatalogModelCard, model, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.inference.models.with_streaming_response.get( + "model_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + model = response.parse() + assert_matches_type(MlcatalogModelCard, model, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_id` but received ''"): + client.cloud.inference.models.with_raw_response.get( + "", + ) + + +class TestAsyncModels: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + model = await async_client.cloud.inference.models.list() + assert_matches_type(AsyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + model = await async_client.cloud.inference.models.list( + limit=1000, + offset=0, + order_by="name.asc", + ) + assert_matches_type(AsyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.models.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + model = await response.parse() + assert_matches_type(AsyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.models.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + model = await response.parse() + assert_matches_type(AsyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + model = await async_client.cloud.inference.models.get( + "model_id", + ) + assert_matches_type(MlcatalogModelCard, model, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.models.with_raw_response.get( + "model_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + model = await response.parse() + assert_matches_type(MlcatalogModelCard, model, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.models.with_streaming_response.get( + "model_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + model = await response.parse() + assert_matches_type(MlcatalogModelCard, model, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_id` but received ''"): + await async_client.cloud.inference.models.with_raw_response.get( + "", + ) diff --git a/tests/api_resources/cloud/inference/test_registry_credentials.py b/tests/api_resources/cloud/inference/test_registry_credentials.py new file mode 100644 index 00000000..76ddb01f --- /dev/null +++ b/tests/api_resources/cloud/inference/test_registry_credentials.py @@ -0,0 +1,468 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud.inference import ( + InferenceRegistryCredential, + InferenceRegistryCredentialFull, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRegistryCredentials: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + registry_credential = client.cloud.inference.registry_credentials.create( + project_id=1, + name="docker-io", + password="password", + registry_url="registry.example.com", + username="username", + ) + assert_matches_type(InferenceRegistryCredentialFull, registry_credential, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.inference.registry_credentials.with_raw_response.create( + project_id=1, + name="docker-io", + password="password", + registry_url="registry.example.com", + username="username", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry_credential = response.parse() + assert_matches_type(InferenceRegistryCredentialFull, registry_credential, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.inference.registry_credentials.with_streaming_response.create( + project_id=1, + name="docker-io", + password="password", + registry_url="registry.example.com", + username="username", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry_credential = response.parse() + assert_matches_type(InferenceRegistryCredentialFull, registry_credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + registry_credential = client.cloud.inference.registry_credentials.list( + project_id=1, + ) + assert_matches_type(SyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + registry_credential = client.cloud.inference.registry_credentials.list( + project_id=1, + limit=1000, + offset=0, + ) + assert_matches_type(SyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.inference.registry_credentials.with_raw_response.list( + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry_credential = response.parse() + assert_matches_type(SyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.inference.registry_credentials.with_streaming_response.list( + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry_credential = response.parse() + assert_matches_type(SyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + registry_credential = client.cloud.inference.registry_credentials.delete( + credential_name="docker-io", + project_id=1, + ) + assert registry_credential is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.inference.registry_credentials.with_raw_response.delete( + credential_name="docker-io", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry_credential = response.parse() + assert registry_credential is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.inference.registry_credentials.with_streaming_response.delete( + credential_name="docker-io", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry_credential = response.parse() + assert registry_credential is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `credential_name` but received ''"): + client.cloud.inference.registry_credentials.with_raw_response.delete( + credential_name="", + project_id=1, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + registry_credential = client.cloud.inference.registry_credentials.get( + credential_name="docker-io", + project_id=1, + ) + assert_matches_type(InferenceRegistryCredential, registry_credential, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.inference.registry_credentials.with_raw_response.get( + credential_name="docker-io", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry_credential = response.parse() + assert_matches_type(InferenceRegistryCredential, registry_credential, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.inference.registry_credentials.with_streaming_response.get( + credential_name="docker-io", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry_credential = response.parse() + assert_matches_type(InferenceRegistryCredential, registry_credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `credential_name` but received ''"): + client.cloud.inference.registry_credentials.with_raw_response.get( + credential_name="", + project_id=1, + ) + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + registry_credential = client.cloud.inference.registry_credentials.replace( + credential_name="docker-io", + project_id=1, + password="password", + registry_url="registry.example.com", + username="username", + ) + assert registry_credential is None + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cloud.inference.registry_credentials.with_raw_response.replace( + credential_name="docker-io", + project_id=1, + password="password", + registry_url="registry.example.com", + username="username", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry_credential = response.parse() + assert registry_credential is None + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cloud.inference.registry_credentials.with_streaming_response.replace( + credential_name="docker-io", + project_id=1, + password="password", + registry_url="registry.example.com", + username="username", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry_credential = response.parse() + assert registry_credential is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_replace(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `credential_name` but received ''"): + client.cloud.inference.registry_credentials.with_raw_response.replace( + credential_name="", + project_id=1, + password="password", + registry_url="registry.example.com", + username="username", + ) + + +class TestAsyncRegistryCredentials: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + registry_credential = await async_client.cloud.inference.registry_credentials.create( + project_id=1, + name="docker-io", + password="password", + registry_url="registry.example.com", + username="username", + ) + assert_matches_type(InferenceRegistryCredentialFull, registry_credential, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.registry_credentials.with_raw_response.create( + project_id=1, + name="docker-io", + password="password", + registry_url="registry.example.com", + username="username", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry_credential = await response.parse() + assert_matches_type(InferenceRegistryCredentialFull, registry_credential, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.registry_credentials.with_streaming_response.create( + project_id=1, + name="docker-io", + password="password", + registry_url="registry.example.com", + username="username", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry_credential = await response.parse() + assert_matches_type(InferenceRegistryCredentialFull, registry_credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + registry_credential = await async_client.cloud.inference.registry_credentials.list( + project_id=1, + ) + assert_matches_type(AsyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + registry_credential = await async_client.cloud.inference.registry_credentials.list( + project_id=1, + limit=1000, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.registry_credentials.with_raw_response.list( + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry_credential = await response.parse() + assert_matches_type(AsyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.registry_credentials.with_streaming_response.list( + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry_credential = await response.parse() + assert_matches_type(AsyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + registry_credential = await async_client.cloud.inference.registry_credentials.delete( + credential_name="docker-io", + project_id=1, + ) + assert registry_credential is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.registry_credentials.with_raw_response.delete( + credential_name="docker-io", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry_credential = await response.parse() + assert registry_credential is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.registry_credentials.with_streaming_response.delete( + credential_name="docker-io", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry_credential = await response.parse() + assert registry_credential is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `credential_name` but received ''"): + await async_client.cloud.inference.registry_credentials.with_raw_response.delete( + credential_name="", + project_id=1, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + registry_credential = await async_client.cloud.inference.registry_credentials.get( + credential_name="docker-io", + project_id=1, + ) + assert_matches_type(InferenceRegistryCredential, registry_credential, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.registry_credentials.with_raw_response.get( + credential_name="docker-io", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry_credential = await response.parse() + assert_matches_type(InferenceRegistryCredential, registry_credential, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.registry_credentials.with_streaming_response.get( + credential_name="docker-io", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry_credential = await response.parse() + assert_matches_type(InferenceRegistryCredential, registry_credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `credential_name` but received ''"): + await async_client.cloud.inference.registry_credentials.with_raw_response.get( + credential_name="", + project_id=1, + ) + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + registry_credential = await async_client.cloud.inference.registry_credentials.replace( + credential_name="docker-io", + project_id=1, + password="password", + registry_url="registry.example.com", + username="username", + ) + assert registry_credential is None + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.registry_credentials.with_raw_response.replace( + credential_name="docker-io", + project_id=1, + password="password", + registry_url="registry.example.com", + username="username", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry_credential = await response.parse() + assert registry_credential is None + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.registry_credentials.with_streaming_response.replace( + credential_name="docker-io", + project_id=1, + password="password", + registry_url="registry.example.com", + username="username", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry_credential = await response.parse() + assert registry_credential is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_replace(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `credential_name` but received ''"): + await async_client.cloud.inference.registry_credentials.with_raw_response.replace( + credential_name="", + project_id=1, + password="password", + registry_url="registry.example.com", + username="username", + ) diff --git a/tests/api_resources/cloud/inference/test_secrets.py b/tests/api_resources/cloud/inference/test_secrets.py new file mode 100644 index 00000000..1dcff8b1 --- /dev/null +++ b/tests/api_resources/cloud/inference/test_secrets.py @@ -0,0 +1,493 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud.inference import InferenceSecret + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSecrets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + secret = client.cloud.inference.secrets.create( + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + name="aws-dev", + type="aws-iam", + ) + assert_matches_type(InferenceSecret, secret, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.inference.secrets.with_raw_response.create( + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + name="aws-dev", + type="aws-iam", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(InferenceSecret, secret, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.inference.secrets.with_streaming_response.create( + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + name="aws-dev", + type="aws-iam", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(InferenceSecret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + secret = client.cloud.inference.secrets.list( + project_id=1, + ) + assert_matches_type(SyncOffsetPage[InferenceSecret], secret, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + secret = client.cloud.inference.secrets.list( + project_id=1, + limit=1000, + offset=0, + ) + assert_matches_type(SyncOffsetPage[InferenceSecret], secret, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.inference.secrets.with_raw_response.list( + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(SyncOffsetPage[InferenceSecret], secret, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.inference.secrets.with_streaming_response.list( + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(SyncOffsetPage[InferenceSecret], secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + secret = client.cloud.inference.secrets.delete( + secret_name="aws-dev", + project_id=1, + ) + assert secret is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.inference.secrets.with_raw_response.delete( + secret_name="aws-dev", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert secret is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.inference.secrets.with_streaming_response.delete( + secret_name="aws-dev", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert secret is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_name` but received ''"): + client.cloud.inference.secrets.with_raw_response.delete( + secret_name="", + project_id=1, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + secret = client.cloud.inference.secrets.get( + secret_name="aws-dev", + project_id=1, + ) + assert_matches_type(InferenceSecret, secret, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.inference.secrets.with_raw_response.get( + secret_name="aws-dev", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(InferenceSecret, secret, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.inference.secrets.with_streaming_response.get( + secret_name="aws-dev", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(InferenceSecret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_name` but received ''"): + client.cloud.inference.secrets.with_raw_response.get( + secret_name="", + project_id=1, + ) + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + secret = client.cloud.inference.secrets.replace( + secret_name="aws-dev", + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + type="aws-iam", + ) + assert_matches_type(InferenceSecret, secret, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cloud.inference.secrets.with_raw_response.replace( + secret_name="aws-dev", + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + type="aws-iam", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(InferenceSecret, secret, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cloud.inference.secrets.with_streaming_response.replace( + secret_name="aws-dev", + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + type="aws-iam", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(InferenceSecret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_replace(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_name` but received ''"): + client.cloud.inference.secrets.with_raw_response.replace( + secret_name="", + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + type="aws-iam", + ) + + +class TestAsyncSecrets: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.inference.secrets.create( + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + name="aws-dev", + type="aws-iam", + ) + assert_matches_type(InferenceSecret, secret, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.secrets.with_raw_response.create( + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + name="aws-dev", + type="aws-iam", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(InferenceSecret, secret, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.secrets.with_streaming_response.create( + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + name="aws-dev", + type="aws-iam", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(InferenceSecret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.inference.secrets.list( + project_id=1, + ) + assert_matches_type(AsyncOffsetPage[InferenceSecret], secret, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.inference.secrets.list( + project_id=1, + limit=1000, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[InferenceSecret], secret, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.secrets.with_raw_response.list( + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(AsyncOffsetPage[InferenceSecret], secret, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.secrets.with_streaming_response.list( + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(AsyncOffsetPage[InferenceSecret], secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.inference.secrets.delete( + secret_name="aws-dev", + project_id=1, + ) + assert secret is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.secrets.with_raw_response.delete( + secret_name="aws-dev", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert secret is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.secrets.with_streaming_response.delete( + secret_name="aws-dev", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert secret is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_name` but received ''"): + await async_client.cloud.inference.secrets.with_raw_response.delete( + secret_name="", + project_id=1, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.inference.secrets.get( + secret_name="aws-dev", + project_id=1, + ) + assert_matches_type(InferenceSecret, secret, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.secrets.with_raw_response.get( + secret_name="aws-dev", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(InferenceSecret, secret, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.secrets.with_streaming_response.get( + secret_name="aws-dev", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(InferenceSecret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_name` but received ''"): + await async_client.cloud.inference.secrets.with_raw_response.get( + secret_name="", + project_id=1, + ) + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.inference.secrets.replace( + secret_name="aws-dev", + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + type="aws-iam", + ) + assert_matches_type(InferenceSecret, secret, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.secrets.with_raw_response.replace( + secret_name="aws-dev", + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + type="aws-iam", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(InferenceSecret, secret, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.secrets.with_streaming_response.replace( + secret_name="aws-dev", + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + type="aws-iam", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(InferenceSecret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_replace(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_name` but received ''"): + await async_client.cloud.inference.secrets.with_raw_response.replace( + secret_name="", + project_id=1, + data={ + "aws_access_key_id": "fake-key-id", + "aws_secret_access_key": "fake-secret", + }, + type="aws-iam", + ) diff --git a/tests/api_resources/cloud/test_inference.py b/tests/api_resources/cloud/test_inference.py new file mode 100644 index 00000000..b30c062e --- /dev/null +++ b/tests/api_resources/cloud/test_inference.py @@ -0,0 +1,72 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import RegionCapacityList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInference: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_capacity_by_region(self, client: Gcore) -> None: + inference = client.cloud.inference.get_capacity_by_region() + assert_matches_type(RegionCapacityList, inference, path=["response"]) + + @parametrize + def test_raw_response_get_capacity_by_region(self, client: Gcore) -> None: + response = client.cloud.inference.with_raw_response.get_capacity_by_region() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inference = response.parse() + assert_matches_type(RegionCapacityList, inference, path=["response"]) + + @parametrize + def test_streaming_response_get_capacity_by_region(self, client: Gcore) -> None: + with client.cloud.inference.with_streaming_response.get_capacity_by_region() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inference = response.parse() + assert_matches_type(RegionCapacityList, inference, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncInference: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_get_capacity_by_region(self, async_client: AsyncGcore) -> None: + inference = await async_client.cloud.inference.get_capacity_by_region() + assert_matches_type(RegionCapacityList, inference, path=["response"]) + + @parametrize + async def test_raw_response_get_capacity_by_region(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.with_raw_response.get_capacity_by_region() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inference = await response.parse() + assert_matches_type(RegionCapacityList, inference, path=["response"]) + + @parametrize + async def test_streaming_response_get_capacity_by_region(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.with_streaming_response.get_capacity_by_region() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inference = await response.parse() + assert_matches_type(RegionCapacityList, inference, path=["response"]) + + assert cast(Any, response.is_closed) is True From 4e3f56f1d3ab186d5250270d5dc0ec3e98700803 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 03:17:10 +0000 Subject: [PATCH 077/592] chore(ci): fix formatting for debug mode --- .github/workflows/ci.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2169002..a1fb6de5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,11 +51,12 @@ jobs: - name: Run tests run: ./scripts/test - prevent-debug-release: - name: Prevent Debug SDK Release - runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - steps: - - run: | - echo "This SDK was built in debug mode, this job is a failsafe to prevent releasing debug SDKs" - echo "Remove 'debug: true' from your Stainless config." - exit 1 + prevent-debug-release: + name: Prevent Debug SDK Release + runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + steps: + - name: Debug Mode Failsafe + run: | + echo "This SDK was built in debug mode, this job is a failsafe to prevent releasing debug SDKs" + echo "Remove 'debug: true' from your Stainless config." + exit 1 From 622d856bf97b80b7ee67f0cd6c17c3c1a6314937 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 06:09:09 +0000 Subject: [PATCH 078/592] GCLOUD2-18784 Add cloud users --- .stats.yml | 4 +- api.md | 17 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + src/gcore/resources/cloud/users/__init__.py | 33 ++ .../resources/cloud/users/role_assignments.py | 557 ++++++++++++++++++ src/gcore/resources/cloud/users/users.py | 102 ++++ src/gcore/types/cloud/users/__init__.py | 9 + .../types/cloud/users/role_assignment.py | 58 ++ .../users/role_assignment_create_params.py | 34 ++ .../users/role_assignment_list_params.py | 33 ++ .../users/role_assignment_update_delete.py | 13 + .../users/role_assignment_update_params.py | 34 ++ tests/api_resources/cloud/users/__init__.py | 1 + .../cloud/users/test_role_assignments.py | 342 +++++++++++ 15 files changed, 1281 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/users/__init__.py create mode 100644 src/gcore/resources/cloud/users/role_assignments.py create mode 100644 src/gcore/resources/cloud/users/users.py create mode 100644 src/gcore/types/cloud/users/__init__.py create mode 100644 src/gcore/types/cloud/users/role_assignment.py create mode 100644 src/gcore/types/cloud/users/role_assignment_create_params.py create mode 100644 src/gcore/types/cloud/users/role_assignment_list_params.py create mode 100644 src/gcore/types/cloud/users/role_assignment_update_delete.py create mode 100644 src/gcore/types/cloud/users/role_assignment_update_params.py create mode 100644 tests/api_resources/cloud/users/__init__.py create mode 100644 tests/api_resources/cloud/users/test_role_assignments.py diff --git a/.stats.yml b/.stats.yml index 1d929d83..b316256d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 162 +configured_endpoints: 166 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1b085537d9cf740f2b3313109b3be0f00952207abc6f1fee686579c070e71fc2.yml openapi_spec_hash: 61acc4dd694c9d01c88941c577deb740 -config_hash: 4cfb3bf532d50b2f700b644a73397703 +config_hash: c0edf3c34508241c0b6e81283204eec9 diff --git a/api.md b/api.md index 74adc8de..f37ebba3 100644 --- a/api.md +++ b/api.md @@ -408,6 +408,23 @@ Methods: - client.cloud.security_groups.rules.delete(rule_id, \*, project_id, region_id) -> None - client.cloud.security_groups.rules.replace(rule_id, \*, project_id, region_id, \*\*params) -> SecurityGroupRule +## Users + +### RoleAssignments + +Types: + +```python +from gcore.types.cloud.users import RoleAssignment, RoleAssignmentUpdateDelete +``` + +Methods: + +- client.cloud.users.role_assignments.create(\*\*params) -> RoleAssignment +- client.cloud.users.role_assignments.update(assignment_id, \*\*params) -> RoleAssignmentUpdateDelete +- client.cloud.users.role_assignments.list(\*\*params) -> SyncOffsetPage[RoleAssignment] +- client.cloud.users.role_assignments.delete(assignment_id) -> RoleAssignmentUpdateDelete + ## Inference Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 17c8bbd8..b79e01cf 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -16,6 +16,14 @@ TasksResourceWithStreamingResponse, AsyncTasksResourceWithStreamingResponse, ) +from .users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) from .quotas import ( QuotasResource, AsyncQuotasResource, @@ -240,6 +248,12 @@ "AsyncSecurityGroupsResourceWithRawResponse", "SecurityGroupsResourceWithStreamingResponse", "AsyncSecurityGroupsResourceWithStreamingResponse", + "UsersResource", + "AsyncUsersResource", + "UsersResourceWithRawResponse", + "AsyncUsersResourceWithRawResponse", + "UsersResourceWithStreamingResponse", + "AsyncUsersResourceWithStreamingResponse", "InferenceResource", "AsyncInferenceResource", "InferenceResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 64115b3d..112640c8 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -60,6 +60,14 @@ AsyncIPRangesResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource +from .users.users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) from .floating_ips import ( FloatingIPsResource, AsyncFloatingIPsResource, @@ -213,6 +221,10 @@ def floating_ips(self) -> FloatingIPsResource: def security_groups(self) -> SecurityGroupsResource: return SecurityGroupsResource(self._client) + @cached_property + def users(self) -> UsersResource: + return UsersResource(self._client) + @cached_property def inference(self) -> InferenceResource: return InferenceResource(self._client) @@ -310,6 +322,10 @@ def floating_ips(self) -> AsyncFloatingIPsResource: def security_groups(self) -> AsyncSecurityGroupsResource: return AsyncSecurityGroupsResource(self._client) + @cached_property + def users(self) -> AsyncUsersResource: + return AsyncUsersResource(self._client) + @cached_property def inference(self) -> AsyncInferenceResource: return AsyncInferenceResource(self._client) @@ -410,6 +426,10 @@ def floating_ips(self) -> FloatingIPsResourceWithRawResponse: def security_groups(self) -> SecurityGroupsResourceWithRawResponse: return SecurityGroupsResourceWithRawResponse(self._cloud.security_groups) + @cached_property + def users(self) -> UsersResourceWithRawResponse: + return UsersResourceWithRawResponse(self._cloud.users) + @cached_property def inference(self) -> InferenceResourceWithRawResponse: return InferenceResourceWithRawResponse(self._cloud.inference) @@ -491,6 +511,10 @@ def floating_ips(self) -> AsyncFloatingIPsResourceWithRawResponse: def security_groups(self) -> AsyncSecurityGroupsResourceWithRawResponse: return AsyncSecurityGroupsResourceWithRawResponse(self._cloud.security_groups) + @cached_property + def users(self) -> AsyncUsersResourceWithRawResponse: + return AsyncUsersResourceWithRawResponse(self._cloud.users) + @cached_property def inference(self) -> AsyncInferenceResourceWithRawResponse: return AsyncInferenceResourceWithRawResponse(self._cloud.inference) @@ -572,6 +596,10 @@ def floating_ips(self) -> FloatingIPsResourceWithStreamingResponse: def security_groups(self) -> SecurityGroupsResourceWithStreamingResponse: return SecurityGroupsResourceWithStreamingResponse(self._cloud.security_groups) + @cached_property + def users(self) -> UsersResourceWithStreamingResponse: + return UsersResourceWithStreamingResponse(self._cloud.users) + @cached_property def inference(self) -> InferenceResourceWithStreamingResponse: return InferenceResourceWithStreamingResponse(self._cloud.inference) @@ -653,6 +681,10 @@ def floating_ips(self) -> AsyncFloatingIPsResourceWithStreamingResponse: def security_groups(self) -> AsyncSecurityGroupsResourceWithStreamingResponse: return AsyncSecurityGroupsResourceWithStreamingResponse(self._cloud.security_groups) + @cached_property + def users(self) -> AsyncUsersResourceWithStreamingResponse: + return AsyncUsersResourceWithStreamingResponse(self._cloud.users) + @cached_property def inference(self) -> AsyncInferenceResourceWithStreamingResponse: return AsyncInferenceResourceWithStreamingResponse(self._cloud.inference) diff --git a/src/gcore/resources/cloud/users/__init__.py b/src/gcore/resources/cloud/users/__init__.py new file mode 100644 index 00000000..43e07e09 --- /dev/null +++ b/src/gcore/resources/cloud/users/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) +from .role_assignments import ( + RoleAssignmentsResource, + AsyncRoleAssignmentsResource, + RoleAssignmentsResourceWithRawResponse, + AsyncRoleAssignmentsResourceWithRawResponse, + RoleAssignmentsResourceWithStreamingResponse, + AsyncRoleAssignmentsResourceWithStreamingResponse, +) + +__all__ = [ + "RoleAssignmentsResource", + "AsyncRoleAssignmentsResource", + "RoleAssignmentsResourceWithRawResponse", + "AsyncRoleAssignmentsResourceWithRawResponse", + "RoleAssignmentsResourceWithStreamingResponse", + "AsyncRoleAssignmentsResourceWithStreamingResponse", + "UsersResource", + "AsyncUsersResource", + "UsersResourceWithRawResponse", + "AsyncUsersResourceWithRawResponse", + "UsersResourceWithStreamingResponse", + "AsyncUsersResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py new file mode 100644 index 00000000..6a57f48b --- /dev/null +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -0,0 +1,557 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.users import ( + role_assignment_list_params, + role_assignment_create_params, + role_assignment_update_params, +) +from ....types.cloud.users.role_assignment import RoleAssignment +from ....types.cloud.users.role_assignment_update_delete import RoleAssignmentUpdateDelete + +__all__ = ["RoleAssignmentsResource", "AsyncRoleAssignmentsResource"] + + +class RoleAssignmentsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RoleAssignmentsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return RoleAssignmentsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RoleAssignmentsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return RoleAssignmentsResourceWithStreamingResponse(self) + + def create( + self, + *, + role: str, + user_id: int, + client_id: Optional[int] | NotGiven = NOT_GIVEN, + project_id: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RoleAssignment: + """ + Assign role to existing user + + Args: + role: '#/components/schemas/RequestAssignmentSerializer/properties/role' + "$.components.schemas.RequestAssignmentSerializer.properties.role" + + user_id: '#/components/schemas/RequestAssignmentSerializer/properties/user_id' + "$.components.schemas.RequestAssignmentSerializer.properties.user_id" + + client_id: '#/components/schemas/RequestAssignmentSerializer/properties/client_id/anyOf/0' + "$.components.schemas.RequestAssignmentSerializer.properties.client_id.anyOf[0]" + + project_id: '#/components/schemas/RequestAssignmentSerializer/properties/project_id/anyOf/0' + "$.components.schemas.RequestAssignmentSerializer.properties.project_id.anyOf[0]" + + 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( + "/cloud/v1/users/assignments", + body=maybe_transform( + { + "role": role, + "user_id": user_id, + "client_id": client_id, + "project_id": project_id, + }, + role_assignment_create_params.RoleAssignmentCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RoleAssignment, + ) + + def update( + self, + assignment_id: int, + *, + role: str, + user_id: int, + client_id: Optional[int] | NotGiven = NOT_GIVEN, + project_id: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RoleAssignmentUpdateDelete: + """ + Modify role assignment to existing user + + Args: + assignment_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments%2F%7Bassignment_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/users/assignments/{assignment_id}'].patch.parameters[0].schema" + + role: '#/components/schemas/RequestAssignmentSerializer/properties/role' + "$.components.schemas.RequestAssignmentSerializer.properties.role" + + user_id: '#/components/schemas/RequestAssignmentSerializer/properties/user_id' + "$.components.schemas.RequestAssignmentSerializer.properties.user_id" + + client_id: '#/components/schemas/RequestAssignmentSerializer/properties/client_id/anyOf/0' + "$.components.schemas.RequestAssignmentSerializer.properties.client_id.anyOf[0]" + + project_id: '#/components/schemas/RequestAssignmentSerializer/properties/project_id/anyOf/0' + "$.components.schemas.RequestAssignmentSerializer.properties.project_id.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/cloud/v1/users/assignments/{assignment_id}", + body=maybe_transform( + { + "role": role, + "user_id": user_id, + "client_id": client_id, + "project_id": project_id, + }, + role_assignment_update_params.RoleAssignmentUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RoleAssignmentUpdateDelete, + ) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + project_id: int | NotGiven = NOT_GIVEN, + user_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[RoleAssignment]: + """ + List assignments + + Args: + limit: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/0' + "$.paths['/cloud/v1/users/assignments'].get.parameters[0]" + + offset: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/1' + "$.paths['/cloud/v1/users/assignments'].get.parameters[1]" + + project_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/2' + "$.paths['/cloud/v1/users/assignments'].get.parameters[2]" + + user_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/3' + "$.paths['/cloud/v1/users/assignments'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v1/users/assignments", + page=SyncOffsetPage[RoleAssignment], + 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, + "project_id": project_id, + "user_id": user_id, + }, + role_assignment_list_params.RoleAssignmentListParams, + ), + ), + model=RoleAssignment, + ) + + def delete( + self, + assignment_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, + ) -> RoleAssignmentUpdateDelete: + """ + Delete role assignment + + Args: + assignment_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments%2F%7Bassignment_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/users/assignments/{assignment_id}']['delete'].parameters[0].schema" + + 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"/cloud/v1/users/assignments/{assignment_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RoleAssignmentUpdateDelete, + ) + + +class AsyncRoleAssignmentsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRoleAssignmentsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRoleAssignmentsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRoleAssignmentsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncRoleAssignmentsResourceWithStreamingResponse(self) + + async def create( + self, + *, + role: str, + user_id: int, + client_id: Optional[int] | NotGiven = NOT_GIVEN, + project_id: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RoleAssignment: + """ + Assign role to existing user + + Args: + role: '#/components/schemas/RequestAssignmentSerializer/properties/role' + "$.components.schemas.RequestAssignmentSerializer.properties.role" + + user_id: '#/components/schemas/RequestAssignmentSerializer/properties/user_id' + "$.components.schemas.RequestAssignmentSerializer.properties.user_id" + + client_id: '#/components/schemas/RequestAssignmentSerializer/properties/client_id/anyOf/0' + "$.components.schemas.RequestAssignmentSerializer.properties.client_id.anyOf[0]" + + project_id: '#/components/schemas/RequestAssignmentSerializer/properties/project_id/anyOf/0' + "$.components.schemas.RequestAssignmentSerializer.properties.project_id.anyOf[0]" + + 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( + "/cloud/v1/users/assignments", + body=await async_maybe_transform( + { + "role": role, + "user_id": user_id, + "client_id": client_id, + "project_id": project_id, + }, + role_assignment_create_params.RoleAssignmentCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RoleAssignment, + ) + + async def update( + self, + assignment_id: int, + *, + role: str, + user_id: int, + client_id: Optional[int] | NotGiven = NOT_GIVEN, + project_id: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RoleAssignmentUpdateDelete: + """ + Modify role assignment to existing user + + Args: + assignment_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments%2F%7Bassignment_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/users/assignments/{assignment_id}'].patch.parameters[0].schema" + + role: '#/components/schemas/RequestAssignmentSerializer/properties/role' + "$.components.schemas.RequestAssignmentSerializer.properties.role" + + user_id: '#/components/schemas/RequestAssignmentSerializer/properties/user_id' + "$.components.schemas.RequestAssignmentSerializer.properties.user_id" + + client_id: '#/components/schemas/RequestAssignmentSerializer/properties/client_id/anyOf/0' + "$.components.schemas.RequestAssignmentSerializer.properties.client_id.anyOf[0]" + + project_id: '#/components/schemas/RequestAssignmentSerializer/properties/project_id/anyOf/0' + "$.components.schemas.RequestAssignmentSerializer.properties.project_id.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/cloud/v1/users/assignments/{assignment_id}", + body=await async_maybe_transform( + { + "role": role, + "user_id": user_id, + "client_id": client_id, + "project_id": project_id, + }, + role_assignment_update_params.RoleAssignmentUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RoleAssignmentUpdateDelete, + ) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + project_id: int | NotGiven = NOT_GIVEN, + user_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[RoleAssignment, AsyncOffsetPage[RoleAssignment]]: + """ + List assignments + + Args: + limit: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/0' + "$.paths['/cloud/v1/users/assignments'].get.parameters[0]" + + offset: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/1' + "$.paths['/cloud/v1/users/assignments'].get.parameters[1]" + + project_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/2' + "$.paths['/cloud/v1/users/assignments'].get.parameters[2]" + + user_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/3' + "$.paths['/cloud/v1/users/assignments'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v1/users/assignments", + page=AsyncOffsetPage[RoleAssignment], + 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, + "project_id": project_id, + "user_id": user_id, + }, + role_assignment_list_params.RoleAssignmentListParams, + ), + ), + model=RoleAssignment, + ) + + async def delete( + self, + assignment_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, + ) -> RoleAssignmentUpdateDelete: + """ + Delete role assignment + + Args: + assignment_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments%2F%7Bassignment_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/users/assignments/{assignment_id}']['delete'].parameters[0].schema" + + 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"/cloud/v1/users/assignments/{assignment_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RoleAssignmentUpdateDelete, + ) + + +class RoleAssignmentsResourceWithRawResponse: + def __init__(self, role_assignments: RoleAssignmentsResource) -> None: + self._role_assignments = role_assignments + + self.create = to_raw_response_wrapper( + role_assignments.create, + ) + self.update = to_raw_response_wrapper( + role_assignments.update, + ) + self.list = to_raw_response_wrapper( + role_assignments.list, + ) + self.delete = to_raw_response_wrapper( + role_assignments.delete, + ) + + +class AsyncRoleAssignmentsResourceWithRawResponse: + def __init__(self, role_assignments: AsyncRoleAssignmentsResource) -> None: + self._role_assignments = role_assignments + + self.create = async_to_raw_response_wrapper( + role_assignments.create, + ) + self.update = async_to_raw_response_wrapper( + role_assignments.update, + ) + self.list = async_to_raw_response_wrapper( + role_assignments.list, + ) + self.delete = async_to_raw_response_wrapper( + role_assignments.delete, + ) + + +class RoleAssignmentsResourceWithStreamingResponse: + def __init__(self, role_assignments: RoleAssignmentsResource) -> None: + self._role_assignments = role_assignments + + self.create = to_streamed_response_wrapper( + role_assignments.create, + ) + self.update = to_streamed_response_wrapper( + role_assignments.update, + ) + self.list = to_streamed_response_wrapper( + role_assignments.list, + ) + self.delete = to_streamed_response_wrapper( + role_assignments.delete, + ) + + +class AsyncRoleAssignmentsResourceWithStreamingResponse: + def __init__(self, role_assignments: AsyncRoleAssignmentsResource) -> None: + self._role_assignments = role_assignments + + self.create = async_to_streamed_response_wrapper( + role_assignments.create, + ) + self.update = async_to_streamed_response_wrapper( + role_assignments.update, + ) + self.list = async_to_streamed_response_wrapper( + role_assignments.list, + ) + self.delete = async_to_streamed_response_wrapper( + role_assignments.delete, + ) diff --git a/src/gcore/resources/cloud/users/users.py b/src/gcore/resources/cloud/users/users.py new file mode 100644 index 00000000..0be8524c --- /dev/null +++ b/src/gcore/resources/cloud/users/users.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from .role_assignments import ( + RoleAssignmentsResource, + AsyncRoleAssignmentsResource, + RoleAssignmentsResourceWithRawResponse, + AsyncRoleAssignmentsResourceWithRawResponse, + RoleAssignmentsResourceWithStreamingResponse, + AsyncRoleAssignmentsResourceWithStreamingResponse, +) + +__all__ = ["UsersResource", "AsyncUsersResource"] + + +class UsersResource(SyncAPIResource): + @cached_property + def role_assignments(self) -> RoleAssignmentsResource: + return RoleAssignmentsResource(self._client) + + @cached_property + def with_raw_response(self) -> UsersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return UsersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> UsersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return UsersResourceWithStreamingResponse(self) + + +class AsyncUsersResource(AsyncAPIResource): + @cached_property + def role_assignments(self) -> AsyncRoleAssignmentsResource: + return AsyncRoleAssignmentsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncUsersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncUsersResourceWithStreamingResponse(self) + + +class UsersResourceWithRawResponse: + def __init__(self, users: UsersResource) -> None: + self._users = users + + @cached_property + def role_assignments(self) -> RoleAssignmentsResourceWithRawResponse: + return RoleAssignmentsResourceWithRawResponse(self._users.role_assignments) + + +class AsyncUsersResourceWithRawResponse: + def __init__(self, users: AsyncUsersResource) -> None: + self._users = users + + @cached_property + def role_assignments(self) -> AsyncRoleAssignmentsResourceWithRawResponse: + return AsyncRoleAssignmentsResourceWithRawResponse(self._users.role_assignments) + + +class UsersResourceWithStreamingResponse: + def __init__(self, users: UsersResource) -> None: + self._users = users + + @cached_property + def role_assignments(self) -> RoleAssignmentsResourceWithStreamingResponse: + return RoleAssignmentsResourceWithStreamingResponse(self._users.role_assignments) + + +class AsyncUsersResourceWithStreamingResponse: + def __init__(self, users: AsyncUsersResource) -> None: + self._users = users + + @cached_property + def role_assignments(self) -> AsyncRoleAssignmentsResourceWithStreamingResponse: + return AsyncRoleAssignmentsResourceWithStreamingResponse(self._users.role_assignments) diff --git a/src/gcore/types/cloud/users/__init__.py b/src/gcore/types/cloud/users/__init__.py new file mode 100644 index 00000000..4f7272e2 --- /dev/null +++ b/src/gcore/types/cloud/users/__init__.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .role_assignment import RoleAssignment as RoleAssignment +from .role_assignment_list_params import RoleAssignmentListParams as RoleAssignmentListParams +from .role_assignment_create_params import RoleAssignmentCreateParams as RoleAssignmentCreateParams +from .role_assignment_update_delete import RoleAssignmentUpdateDelete as RoleAssignmentUpdateDelete +from .role_assignment_update_params import RoleAssignmentUpdateParams as RoleAssignmentUpdateParams diff --git a/src/gcore/types/cloud/users/role_assignment.py b/src/gcore/types/cloud/users/role_assignment.py new file mode 100644 index 00000000..15b39b68 --- /dev/null +++ b/src/gcore/types/cloud/users/role_assignment.py @@ -0,0 +1,58 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["RoleAssignment"] + + +class RoleAssignment(BaseModel): + id: int + """ + '#/components/schemas/RoleAssignmentSerializer/properties/id' + "$.components.schemas.RoleAssignmentSerializer.properties.id" + """ + + assigned_by: Optional[int] = None + """ + '#/components/schemas/RoleAssignmentSerializer/properties/assigned_by/anyOf/0' + "$.components.schemas.RoleAssignmentSerializer.properties.assigned_by.anyOf[0]" + """ + + client_id: int + """ + '#/components/schemas/RoleAssignmentSerializer/properties/client_id' + "$.components.schemas.RoleAssignmentSerializer.properties.client_id" + """ + + created_at: datetime + """ + '#/components/schemas/RoleAssignmentSerializer/properties/created_at' + "$.components.schemas.RoleAssignmentSerializer.properties.created_at" + """ + + project_id: Optional[int] = None + """ + '#/components/schemas/RoleAssignmentSerializer/properties/project_id/anyOf/0' + "$.components.schemas.RoleAssignmentSerializer.properties.project_id.anyOf[0]" + """ + + role: str + """ + '#/components/schemas/RoleAssignmentSerializer/properties/role' + "$.components.schemas.RoleAssignmentSerializer.properties.role" + """ + + updated_at: Optional[datetime] = None + """ + '#/components/schemas/RoleAssignmentSerializer/properties/updated_at/anyOf/0' + "$.components.schemas.RoleAssignmentSerializer.properties.updated_at.anyOf[0]" + """ + + user_id: int + """ + '#/components/schemas/RoleAssignmentSerializer/properties/user_id' + "$.components.schemas.RoleAssignmentSerializer.properties.user_id" + """ diff --git a/src/gcore/types/cloud/users/role_assignment_create_params.py b/src/gcore/types/cloud/users/role_assignment_create_params.py new file mode 100644 index 00000000..3c148cd6 --- /dev/null +++ b/src/gcore/types/cloud/users/role_assignment_create_params.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +__all__ = ["RoleAssignmentCreateParams"] + + +class RoleAssignmentCreateParams(TypedDict, total=False): + role: Required[str] + """ + '#/components/schemas/RequestAssignmentSerializer/properties/role' + "$.components.schemas.RequestAssignmentSerializer.properties.role" + """ + + user_id: Required[int] + """ + '#/components/schemas/RequestAssignmentSerializer/properties/user_id' + "$.components.schemas.RequestAssignmentSerializer.properties.user_id" + """ + + client_id: Optional[int] + """ + '#/components/schemas/RequestAssignmentSerializer/properties/client_id/anyOf/0' + "$.components.schemas.RequestAssignmentSerializer.properties.client_id.anyOf[0]" + """ + + project_id: Optional[int] + """ + '#/components/schemas/RequestAssignmentSerializer/properties/project_id/anyOf/0' + "$.components.schemas.RequestAssignmentSerializer.properties.project_id.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/users/role_assignment_list_params.py b/src/gcore/types/cloud/users/role_assignment_list_params.py new file mode 100644 index 00000000..99587621 --- /dev/null +++ b/src/gcore/types/cloud/users/role_assignment_list_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["RoleAssignmentListParams"] + + +class RoleAssignmentListParams(TypedDict, total=False): + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/0' + "$.paths['/cloud/v1/users/assignments'].get.parameters[0]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/1' + "$.paths['/cloud/v1/users/assignments'].get.parameters[1]" + """ + + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/2' + "$.paths['/cloud/v1/users/assignments'].get.parameters[2]" + """ + + user_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/3' + "$.paths['/cloud/v1/users/assignments'].get.parameters[3]" + """ diff --git a/src/gcore/types/cloud/users/role_assignment_update_delete.py b/src/gcore/types/cloud/users/role_assignment_update_delete.py new file mode 100644 index 00000000..7eb8ae70 --- /dev/null +++ b/src/gcore/types/cloud/users/role_assignment_update_delete.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["RoleAssignmentUpdateDelete"] + + +class RoleAssignmentUpdateDelete(BaseModel): + assignment_id: int + """ + '#/components/schemas/AssignmentSerializer/properties/assignment_id' + "$.components.schemas.AssignmentSerializer.properties.assignment_id" + """ diff --git a/src/gcore/types/cloud/users/role_assignment_update_params.py b/src/gcore/types/cloud/users/role_assignment_update_params.py new file mode 100644 index 00000000..c8443c55 --- /dev/null +++ b/src/gcore/types/cloud/users/role_assignment_update_params.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +__all__ = ["RoleAssignmentUpdateParams"] + + +class RoleAssignmentUpdateParams(TypedDict, total=False): + role: Required[str] + """ + '#/components/schemas/RequestAssignmentSerializer/properties/role' + "$.components.schemas.RequestAssignmentSerializer.properties.role" + """ + + user_id: Required[int] + """ + '#/components/schemas/RequestAssignmentSerializer/properties/user_id' + "$.components.schemas.RequestAssignmentSerializer.properties.user_id" + """ + + client_id: Optional[int] + """ + '#/components/schemas/RequestAssignmentSerializer/properties/client_id/anyOf/0' + "$.components.schemas.RequestAssignmentSerializer.properties.client_id.anyOf[0]" + """ + + project_id: Optional[int] + """ + '#/components/schemas/RequestAssignmentSerializer/properties/project_id/anyOf/0' + "$.components.schemas.RequestAssignmentSerializer.properties.project_id.anyOf[0]" + """ diff --git a/tests/api_resources/cloud/users/__init__.py b/tests/api_resources/cloud/users/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/users/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/users/test_role_assignments.py b/tests/api_resources/cloud/users/test_role_assignments.py new file mode 100644 index 00000000..f41e6762 --- /dev/null +++ b/tests/api_resources/cloud/users/test_role_assignments.py @@ -0,0 +1,342 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud.users import ( + RoleAssignment, + RoleAssignmentUpdateDelete, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRoleAssignments: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + role_assignment = client.cloud.users.role_assignments.create( + role="ClientAdministrator", + user_id=777, + ) + assert_matches_type(RoleAssignment, role_assignment, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + role_assignment = client.cloud.users.role_assignments.create( + role="ClientAdministrator", + user_id=777, + client_id=8, + project_id=0, + ) + assert_matches_type(RoleAssignment, role_assignment, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.users.role_assignments.with_raw_response.create( + role="ClientAdministrator", + user_id=777, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + role_assignment = response.parse() + assert_matches_type(RoleAssignment, role_assignment, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.users.role_assignments.with_streaming_response.create( + role="ClientAdministrator", + user_id=777, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + role_assignment = response.parse() + assert_matches_type(RoleAssignment, role_assignment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + role_assignment = client.cloud.users.role_assignments.update( + assignment_id=123, + role="ClientAdministrator", + user_id=777, + ) + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + role_assignment = client.cloud.users.role_assignments.update( + assignment_id=123, + role="ClientAdministrator", + user_id=777, + client_id=8, + project_id=0, + ) + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.users.role_assignments.with_raw_response.update( + assignment_id=123, + role="ClientAdministrator", + user_id=777, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + role_assignment = response.parse() + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.users.role_assignments.with_streaming_response.update( + assignment_id=123, + role="ClientAdministrator", + user_id=777, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + role_assignment = response.parse() + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + role_assignment = client.cloud.users.role_assignments.list() + assert_matches_type(SyncOffsetPage[RoleAssignment], role_assignment, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + role_assignment = client.cloud.users.role_assignments.list( + limit=100, + offset=0, + project_id=123, + user_id=123, + ) + assert_matches_type(SyncOffsetPage[RoleAssignment], role_assignment, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.users.role_assignments.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + role_assignment = response.parse() + assert_matches_type(SyncOffsetPage[RoleAssignment], role_assignment, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.users.role_assignments.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + role_assignment = response.parse() + assert_matches_type(SyncOffsetPage[RoleAssignment], role_assignment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + role_assignment = client.cloud.users.role_assignments.delete( + 123, + ) + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.users.role_assignments.with_raw_response.delete( + 123, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + role_assignment = response.parse() + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.users.role_assignments.with_streaming_response.delete( + 123, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + role_assignment = response.parse() + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRoleAssignments: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + role_assignment = await async_client.cloud.users.role_assignments.create( + role="ClientAdministrator", + user_id=777, + ) + assert_matches_type(RoleAssignment, role_assignment, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + role_assignment = await async_client.cloud.users.role_assignments.create( + role="ClientAdministrator", + user_id=777, + client_id=8, + project_id=0, + ) + assert_matches_type(RoleAssignment, role_assignment, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.users.role_assignments.with_raw_response.create( + role="ClientAdministrator", + user_id=777, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + role_assignment = await response.parse() + assert_matches_type(RoleAssignment, role_assignment, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.users.role_assignments.with_streaming_response.create( + role="ClientAdministrator", + user_id=777, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + role_assignment = await response.parse() + assert_matches_type(RoleAssignment, role_assignment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + role_assignment = await async_client.cloud.users.role_assignments.update( + assignment_id=123, + role="ClientAdministrator", + user_id=777, + ) + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + role_assignment = await async_client.cloud.users.role_assignments.update( + assignment_id=123, + role="ClientAdministrator", + user_id=777, + client_id=8, + project_id=0, + ) + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.users.role_assignments.with_raw_response.update( + assignment_id=123, + role="ClientAdministrator", + user_id=777, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + role_assignment = await response.parse() + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.users.role_assignments.with_streaming_response.update( + assignment_id=123, + role="ClientAdministrator", + user_id=777, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + role_assignment = await response.parse() + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + role_assignment = await async_client.cloud.users.role_assignments.list() + assert_matches_type(AsyncOffsetPage[RoleAssignment], role_assignment, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + role_assignment = await async_client.cloud.users.role_assignments.list( + limit=100, + offset=0, + project_id=123, + user_id=123, + ) + assert_matches_type(AsyncOffsetPage[RoleAssignment], role_assignment, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.users.role_assignments.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + role_assignment = await response.parse() + assert_matches_type(AsyncOffsetPage[RoleAssignment], role_assignment, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.users.role_assignments.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + role_assignment = await response.parse() + assert_matches_type(AsyncOffsetPage[RoleAssignment], role_assignment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + role_assignment = await async_client.cloud.users.role_assignments.delete( + 123, + ) + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.users.role_assignments.with_raw_response.delete( + 123, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + role_assignment = await response.parse() + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.users.role_assignments.with_streaming_response.delete( + 123, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + role_assignment = await response.parse() + assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + + assert cast(Any, response.is_closed) is True From e40c74d5452d72dd36509e35ae370383ed587695 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 08:17:16 +0000 Subject: [PATCH 079/592] GCLOUD2-18779 Add cloud baremetal subresources --- .stats.yml | 4 +- api.md | 27 + .../resources/cloud/baremetal/__init__.py | 28 + .../resources/cloud/baremetal/baremetal.py | 64 ++ .../resources/cloud/baremetal/flavors.py | 412 +++++++++ .../resources/cloud/baremetal/servers.py | 799 ++++++++++++++++++ src/gcore/types/cloud/baremetal/__init__.py | 8 + .../types/cloud/baremetal/baremetal_server.py | 461 ++++++++++ .../cloud/baremetal/flavor_list_params.py | 57 ++ .../cloud/baremetal/flavor_list_response.py | 114 +++ .../baremetal/flavor_list_suitable_params.py | 39 + .../flavor_list_suitable_response.py | 114 +++ .../cloud/baremetal/server_create_params.py | 410 +++++++++ .../cloud/baremetal/server_list_params.py | 151 ++++ .../cloud/baremetal/server_rebuild_params.py | 33 + .../cloud/baremetal/test_flavors.py | 211 +++++ .../cloud/baremetal/test_servers.py | 423 ++++++++++ 17 files changed, 3353 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/baremetal/flavors.py create mode 100644 src/gcore/resources/cloud/baremetal/servers.py create mode 100644 src/gcore/types/cloud/baremetal/baremetal_server.py create mode 100644 src/gcore/types/cloud/baremetal/flavor_list_params.py create mode 100644 src/gcore/types/cloud/baremetal/flavor_list_response.py create mode 100644 src/gcore/types/cloud/baremetal/flavor_list_suitable_params.py create mode 100644 src/gcore/types/cloud/baremetal/flavor_list_suitable_response.py create mode 100644 src/gcore/types/cloud/baremetal/server_create_params.py create mode 100644 src/gcore/types/cloud/baremetal/server_list_params.py create mode 100644 src/gcore/types/cloud/baremetal/server_rebuild_params.py create mode 100644 tests/api_resources/cloud/baremetal/test_flavors.py create mode 100644 tests/api_resources/cloud/baremetal/test_servers.py diff --git a/.stats.yml b/.stats.yml index b316256d..72d4eb91 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 166 +configured_endpoints: 171 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1b085537d9cf740f2b3313109b3be0f00952207abc6f1fee686579c070e71fc2.yml openapi_spec_hash: 61acc4dd694c9d01c88941c577deb740 -config_hash: c0edf3c34508241c0b6e81283204eec9 +config_hash: ec7c5974d987e11bcd3be200616819e5 diff --git a/api.md b/api.md index f37ebba3..234ee193 100644 --- a/api.md +++ b/api.md @@ -563,6 +563,33 @@ Methods: - client.cloud.baremetal.images.list(\*, project_id, region_id, \*\*params) -> ImageList +### Flavors + +Types: + +```python +from gcore.types.cloud.baremetal import FlavorListResponse, FlavorListSuitableResponse +``` + +Methods: + +- client.cloud.baremetal.flavors.list(\*, project_id, region_id, \*\*params) -> FlavorListResponse +- client.cloud.baremetal.flavors.list_suitable(\*, project_id, region_id, \*\*params) -> FlavorListSuitableResponse + +### Servers + +Types: + +```python +from gcore.types.cloud.baremetal import BaremetalServer +``` + +Methods: + +- client.cloud.baremetal.servers.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.baremetal.servers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[BaremetalServer] +- client.cloud.baremetal.servers.rebuild(server_id, \*, project_id, region_id, \*\*params) -> TaskIDList + ## Instances ### Images diff --git a/src/gcore/resources/cloud/baremetal/__init__.py b/src/gcore/resources/cloud/baremetal/__init__.py index 150c8353..f122cad9 100644 --- a/src/gcore/resources/cloud/baremetal/__init__.py +++ b/src/gcore/resources/cloud/baremetal/__init__.py @@ -8,6 +8,22 @@ ImagesResourceWithStreamingResponse, AsyncImagesResourceWithStreamingResponse, ) +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .servers import ( + ServersResource, + AsyncServersResource, + ServersResourceWithRawResponse, + AsyncServersResourceWithRawResponse, + ServersResourceWithStreamingResponse, + AsyncServersResourceWithStreamingResponse, +) from .baremetal import ( BaremetalResource, AsyncBaremetalResource, @@ -24,6 +40,18 @@ "AsyncImagesResourceWithRawResponse", "ImagesResourceWithStreamingResponse", "AsyncImagesResourceWithStreamingResponse", + "FlavorsResource", + "AsyncFlavorsResource", + "FlavorsResourceWithRawResponse", + "AsyncFlavorsResourceWithRawResponse", + "FlavorsResourceWithStreamingResponse", + "AsyncFlavorsResourceWithStreamingResponse", + "ServersResource", + "AsyncServersResource", + "ServersResourceWithRawResponse", + "AsyncServersResourceWithRawResponse", + "ServersResourceWithStreamingResponse", + "AsyncServersResourceWithStreamingResponse", "BaremetalResource", "AsyncBaremetalResource", "BaremetalResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/baremetal/baremetal.py b/src/gcore/resources/cloud/baremetal/baremetal.py index d5c41832..1690b561 100644 --- a/src/gcore/resources/cloud/baremetal/baremetal.py +++ b/src/gcore/resources/cloud/baremetal/baremetal.py @@ -10,6 +10,22 @@ ImagesResourceWithStreamingResponse, AsyncImagesResourceWithStreamingResponse, ) +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .servers import ( + ServersResource, + AsyncServersResource, + ServersResourceWithRawResponse, + AsyncServersResourceWithRawResponse, + ServersResourceWithStreamingResponse, + AsyncServersResourceWithStreamingResponse, +) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -21,6 +37,14 @@ class BaremetalResource(SyncAPIResource): def images(self) -> ImagesResource: return ImagesResource(self._client) + @cached_property + def flavors(self) -> FlavorsResource: + return FlavorsResource(self._client) + + @cached_property + def servers(self) -> ServersResource: + return ServersResource(self._client) + @cached_property def with_raw_response(self) -> BaremetalResourceWithRawResponse: """ @@ -46,6 +70,14 @@ class AsyncBaremetalResource(AsyncAPIResource): def images(self) -> AsyncImagesResource: return AsyncImagesResource(self._client) + @cached_property + def flavors(self) -> AsyncFlavorsResource: + return AsyncFlavorsResource(self._client) + + @cached_property + def servers(self) -> AsyncServersResource: + return AsyncServersResource(self._client) + @cached_property def with_raw_response(self) -> AsyncBaremetalResourceWithRawResponse: """ @@ -74,6 +106,14 @@ def __init__(self, baremetal: BaremetalResource) -> None: def images(self) -> ImagesResourceWithRawResponse: return ImagesResourceWithRawResponse(self._baremetal.images) + @cached_property + def flavors(self) -> FlavorsResourceWithRawResponse: + return FlavorsResourceWithRawResponse(self._baremetal.flavors) + + @cached_property + def servers(self) -> ServersResourceWithRawResponse: + return ServersResourceWithRawResponse(self._baremetal.servers) + class AsyncBaremetalResourceWithRawResponse: def __init__(self, baremetal: AsyncBaremetalResource) -> None: @@ -83,6 +123,14 @@ def __init__(self, baremetal: AsyncBaremetalResource) -> None: def images(self) -> AsyncImagesResourceWithRawResponse: return AsyncImagesResourceWithRawResponse(self._baremetal.images) + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithRawResponse: + return AsyncFlavorsResourceWithRawResponse(self._baremetal.flavors) + + @cached_property + def servers(self) -> AsyncServersResourceWithRawResponse: + return AsyncServersResourceWithRawResponse(self._baremetal.servers) + class BaremetalResourceWithStreamingResponse: def __init__(self, baremetal: BaremetalResource) -> None: @@ -92,6 +140,14 @@ def __init__(self, baremetal: BaremetalResource) -> None: def images(self) -> ImagesResourceWithStreamingResponse: return ImagesResourceWithStreamingResponse(self._baremetal.images) + @cached_property + def flavors(self) -> FlavorsResourceWithStreamingResponse: + return FlavorsResourceWithStreamingResponse(self._baremetal.flavors) + + @cached_property + def servers(self) -> ServersResourceWithStreamingResponse: + return ServersResourceWithStreamingResponse(self._baremetal.servers) + class AsyncBaremetalResourceWithStreamingResponse: def __init__(self, baremetal: AsyncBaremetalResource) -> None: @@ -100,3 +156,11 @@ def __init__(self, baremetal: AsyncBaremetalResource) -> None: @cached_property def images(self) -> AsyncImagesResourceWithStreamingResponse: return AsyncImagesResourceWithStreamingResponse(self._baremetal.images) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse: + return AsyncFlavorsResourceWithStreamingResponse(self._baremetal.flavors) + + @cached_property + def servers(self) -> AsyncServersResourceWithStreamingResponse: + return AsyncServersResourceWithStreamingResponse(self._baremetal.servers) diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py new file mode 100644 index 00000000..d0178dc1 --- /dev/null +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -0,0 +1,412 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.baremetal import flavor_list_params, flavor_list_suitable_params +from ....types.cloud.baremetal.flavor_list_response import FlavorListResponse +from ....types.cloud.baremetal.flavor_list_suitable_response import FlavorListSuitableResponse + +__all__ = ["FlavorsResource", "AsyncFlavorsResource"] + + +class FlavorsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FlavorsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return FlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return FlavorsResourceWithStreamingResponse(self) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + disabled: bool | NotGiven = NOT_GIVEN, + exclude_linux: bool | NotGiven = NOT_GIVEN, + exclude_windows: bool | NotGiven = NOT_GIVEN, + include_capacity: bool | NotGiven = NOT_GIVEN, + include_prices: bool | NotGiven = NOT_GIVEN, + include_reservation_stock: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FlavorListResponse: + """Retrieve a list of flavors. + + When the include_prices query parameter is + specified, the list shows prices. A client in trial mode gets all price values + as 0. If you get Pricing Error contact the support + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[1].schema" + + disabled: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[2]" + + exclude_linux: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[3]" + + exclude_windows: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[4]" + + include_capacity: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[5]" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[6]" + + include_reservation_stock: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[7]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/bmflavors/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "disabled": disabled, + "exclude_linux": exclude_linux, + "exclude_windows": exclude_windows, + "include_capacity": include_capacity, + "include_prices": include_prices, + "include_reservation_stock": include_reservation_stock, + }, + flavor_list_params.FlavorListParams, + ), + ), + cast_to=FlavorListResponse, + ) + + def list_suitable( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + include_prices: bool | NotGiven = NOT_GIVEN, + apptemplate_id: str | NotGiven = NOT_GIVEN, + image_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FlavorListSuitableResponse: + """ + List suitalbe flavors for bare metal server creation + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/0/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/1/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[1].schema" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/2' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[2]" + + apptemplate_id: '#/components/schemas/AvailableBaremetalFlavorsRequestSchema/properties/apptemplate_id' + "$.components.schemas.AvailableBaremetalFlavorsRequestSchema.properties.apptemplate_id" + + image_id: '#/components/schemas/AvailableBaremetalFlavorsRequestSchema/properties/image_id' + "$.components.schemas.AvailableBaremetalFlavorsRequestSchema.properties.image_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors", + body=maybe_transform( + { + "apptemplate_id": apptemplate_id, + "image_id": image_id, + }, + flavor_list_suitable_params.FlavorListSuitableParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"include_prices": include_prices}, flavor_list_suitable_params.FlavorListSuitableParams + ), + ), + cast_to=FlavorListSuitableResponse, + ) + + +class AsyncFlavorsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFlavorsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncFlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncFlavorsResourceWithStreamingResponse(self) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + disabled: bool | NotGiven = NOT_GIVEN, + exclude_linux: bool | NotGiven = NOT_GIVEN, + exclude_windows: bool | NotGiven = NOT_GIVEN, + include_capacity: bool | NotGiven = NOT_GIVEN, + include_prices: bool | NotGiven = NOT_GIVEN, + include_reservation_stock: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FlavorListResponse: + """Retrieve a list of flavors. + + When the include_prices query parameter is + specified, the list shows prices. A client in trial mode gets all price values + as 0. If you get Pricing Error contact the support + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[1].schema" + + disabled: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[2]" + + exclude_linux: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[3]" + + exclude_windows: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[4]" + + include_capacity: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[5]" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[6]" + + include_reservation_stock: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[7]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/bmflavors/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "disabled": disabled, + "exclude_linux": exclude_linux, + "exclude_windows": exclude_windows, + "include_capacity": include_capacity, + "include_prices": include_prices, + "include_reservation_stock": include_reservation_stock, + }, + flavor_list_params.FlavorListParams, + ), + ), + cast_to=FlavorListResponse, + ) + + async def list_suitable( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + include_prices: bool | NotGiven = NOT_GIVEN, + apptemplate_id: str | NotGiven = NOT_GIVEN, + image_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FlavorListSuitableResponse: + """ + List suitalbe flavors for bare metal server creation + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/0/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/1/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[1].schema" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/2' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[2]" + + apptemplate_id: '#/components/schemas/AvailableBaremetalFlavorsRequestSchema/properties/apptemplate_id' + "$.components.schemas.AvailableBaremetalFlavorsRequestSchema.properties.apptemplate_id" + + image_id: '#/components/schemas/AvailableBaremetalFlavorsRequestSchema/properties/image_id' + "$.components.schemas.AvailableBaremetalFlavorsRequestSchema.properties.image_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors", + body=await async_maybe_transform( + { + "apptemplate_id": apptemplate_id, + "image_id": image_id, + }, + flavor_list_suitable_params.FlavorListSuitableParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"include_prices": include_prices}, flavor_list_suitable_params.FlavorListSuitableParams + ), + ), + cast_to=FlavorListSuitableResponse, + ) + + +class FlavorsResourceWithRawResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_raw_response_wrapper( + flavors.list, + ) + self.list_suitable = to_raw_response_wrapper( + flavors.list_suitable, + ) + + +class AsyncFlavorsResourceWithRawResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_raw_response_wrapper( + flavors.list, + ) + self.list_suitable = async_to_raw_response_wrapper( + flavors.list_suitable, + ) + + +class FlavorsResourceWithStreamingResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_streamed_response_wrapper( + flavors.list, + ) + self.list_suitable = to_streamed_response_wrapper( + flavors.list_suitable, + ) + + +class AsyncFlavorsResourceWithStreamingResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_streamed_response_wrapper( + flavors.list, + ) + self.list_suitable = async_to_streamed_response_wrapper( + flavors.list_suitable, + ) diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py new file mode 100644 index 00000000..674a2a71 --- /dev/null +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -0,0 +1,799 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Union, Iterable, Optional +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.baremetal import server_list_params, server_create_params, server_rebuild_params +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.baremetal.baremetal_server import BaremetalServer + +__all__ = ["ServersResource", "AsyncServersResource"] + + +class ServersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ServersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return ServersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ServersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return ServersResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str, + interfaces: Iterable[server_create_params.Interface], + app_config: Optional[object] | NotGiven = NOT_GIVEN, + apptemplate_id: str | NotGiven = NOT_GIVEN, + ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, + image_id: str | NotGiven = NOT_GIVEN, + keypair_name: Optional[str] | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + name_templates: List[str] | NotGiven = NOT_GIVEN, + names: List[str] | NotGiven = NOT_GIVEN, + password: str | NotGiven = NOT_GIVEN, + user_data: str | NotGiven = NOT_GIVEN, + username: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create a new bare metal server or multiple servers + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].post.parameters[1].schema" + + flavor: '#/components/schemas/CreateBareMetalServerSerializer/properties/flavor' + "$.components.schemas.CreateBareMetalServerSerializer.properties.flavor" + + interfaces: '#/components/schemas/CreateBareMetalServerSerializer/properties/interfaces' + "$.components.schemas.CreateBareMetalServerSerializer.properties.interfaces" + + app_config: '#/components/schemas/CreateBareMetalServerSerializer/properties/app_config/anyOf/0' + "$.components.schemas.CreateBareMetalServerSerializer.properties.app_config.anyOf[0]" + + apptemplate_id: '#/components/schemas/CreateBareMetalServerSerializer/properties/apptemplate_id' + "$.components.schemas.CreateBareMetalServerSerializer.properties.apptemplate_id" + + ddos_profile: '#/components/schemas/CreateBareMetalServerSerializer/properties/ddos_profile' + "$.components.schemas.CreateBareMetalServerSerializer.properties.ddos_profile" + + image_id: '#/components/schemas/CreateBareMetalServerSerializer/properties/image_id' + "$.components.schemas.CreateBareMetalServerSerializer.properties.image_id" + + keypair_name: '#/components/schemas/CreateBareMetalServerSerializer/properties/keypair_name/anyOf/0' + "$.components.schemas.CreateBareMetalServerSerializer.properties.keypair_name.anyOf[0]" + + metadata: '#/components/schemas/CreateBareMetalServerSerializer/properties/metadata' + "$.components.schemas.CreateBareMetalServerSerializer.properties.metadata" + + name_templates: '#/components/schemas/CreateBareMetalServerSerializer/properties/name_templates' + "$.components.schemas.CreateBareMetalServerSerializer.properties.name_templates" + + names: '#/components/schemas/CreateBareMetalServerSerializer/properties/names' + "$.components.schemas.CreateBareMetalServerSerializer.properties.names" + + password: '#/components/schemas/CreateBareMetalServerSerializer/properties/password' + "$.components.schemas.CreateBareMetalServerSerializer.properties.password" + + user_data: '#/components/schemas/CreateBareMetalServerSerializer/properties/user_data' + "$.components.schemas.CreateBareMetalServerSerializer.properties.user_data" + + username: '#/components/schemas/CreateBareMetalServerSerializer/properties/username' + "$.components.schemas.CreateBareMetalServerSerializer.properties.username" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/bminstances/{project_id}/{region_id}", + body=maybe_transform( + { + "flavor": flavor, + "interfaces": interfaces, + "app_config": app_config, + "apptemplate_id": apptemplate_id, + "ddos_profile": ddos_profile, + "image_id": image_id, + "keypair_name": keypair_name, + "metadata": metadata, + "name_templates": name_templates, + "names": names, + "password": password, + "user_data": user_data, + "username": username, + }, + server_create_params.ServerCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN, + changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN, + flavor_id: str | NotGiven = NOT_GIVEN, + flavor_prefix: str | NotGiven = NOT_GIVEN, + include_k8s: bool | NotGiven = NOT_GIVEN, + ip: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + metadata_v: List[str] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + only_isolated: bool | NotGiven = NOT_GIVEN, + only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN, + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] + | NotGiven = NOT_GIVEN, + profile_name: str | NotGiven = NOT_GIVEN, + protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN, + status: Literal[ + "ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED" + ] + | NotGiven = NOT_GIVEN, + type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, + uuid: str | NotGiven = NOT_GIVEN, + with_ddos: bool | NotGiven = NOT_GIVEN, + with_interfaces_name: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[BaremetalServer]: + """ + List bare metal servers + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[1].schema" + + changes_before: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[2]" + + changes_since: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[3]" + + flavor_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[4]" + + flavor_prefix: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[5]" + + include_k8s: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[6]" + + ip: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[7]" + + limit: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[8]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[9]" + + metadata_v: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[10]" + + name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[11]" + + offset: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[12]" + + only_isolated: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[13]" + + only_with_fixed_external_ip: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[14]" + + order_by: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[15]" + + profile_name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[16]" + + protection_status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[17]" + + status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[18]" + + type_ddos_profile: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[19]" + + uuid: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/20' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[20]" + + with_ddos: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/21' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[21]" + + with_interfaces_name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/22' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[22]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/bminstances/{project_id}/{region_id}", + page=SyncOffsetPage[BaremetalServer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "changes_before": changes_before, + "changes_since": changes_since, + "flavor_id": flavor_id, + "flavor_prefix": flavor_prefix, + "include_k8s": include_k8s, + "ip": ip, + "limit": limit, + "metadata_kv": metadata_kv, + "metadata_v": metadata_v, + "name": name, + "offset": offset, + "only_isolated": only_isolated, + "only_with_fixed_external_ip": only_with_fixed_external_ip, + "order_by": order_by, + "profile_name": profile_name, + "protection_status": protection_status, + "status": status, + "type_ddos_profile": type_ddos_profile, + "uuid": uuid, + "with_ddos": with_ddos, + "with_interfaces_name": with_interfaces_name, + }, + server_list_params.ServerListParams, + ), + ), + model=BaremetalServer, + ) + + def rebuild( + self, + server_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + image_id: str | NotGiven = NOT_GIVEN, + user_data: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Rebuild bare metal server + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/0/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/1/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[1].schema" + + server_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/2/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[2].schema" + + image_id: '#/components/schemas/RebuildBaremetalSchema/properties/image_id' + "$.components.schemas.RebuildBaremetalSchema.properties.image_id" + + user_data: '#/components/schemas/RebuildBaremetalSchema/properties/user_data' + "$.components.schemas.RebuildBaremetalSchema.properties.user_data" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not server_id: + raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") + return self._post( + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + body=maybe_transform( + { + "image_id": image_id, + "user_data": user_data, + }, + server_rebuild_params.ServerRebuildParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncServersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncServersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncServersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncServersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncServersResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str, + interfaces: Iterable[server_create_params.Interface], + app_config: Optional[object] | NotGiven = NOT_GIVEN, + apptemplate_id: str | NotGiven = NOT_GIVEN, + ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, + image_id: str | NotGiven = NOT_GIVEN, + keypair_name: Optional[str] | NotGiven = NOT_GIVEN, + metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + name_templates: List[str] | NotGiven = NOT_GIVEN, + names: List[str] | NotGiven = NOT_GIVEN, + password: str | NotGiven = NOT_GIVEN, + user_data: str | NotGiven = NOT_GIVEN, + username: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create a new bare metal server or multiple servers + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].post.parameters[1].schema" + + flavor: '#/components/schemas/CreateBareMetalServerSerializer/properties/flavor' + "$.components.schemas.CreateBareMetalServerSerializer.properties.flavor" + + interfaces: '#/components/schemas/CreateBareMetalServerSerializer/properties/interfaces' + "$.components.schemas.CreateBareMetalServerSerializer.properties.interfaces" + + app_config: '#/components/schemas/CreateBareMetalServerSerializer/properties/app_config/anyOf/0' + "$.components.schemas.CreateBareMetalServerSerializer.properties.app_config.anyOf[0]" + + apptemplate_id: '#/components/schemas/CreateBareMetalServerSerializer/properties/apptemplate_id' + "$.components.schemas.CreateBareMetalServerSerializer.properties.apptemplate_id" + + ddos_profile: '#/components/schemas/CreateBareMetalServerSerializer/properties/ddos_profile' + "$.components.schemas.CreateBareMetalServerSerializer.properties.ddos_profile" + + image_id: '#/components/schemas/CreateBareMetalServerSerializer/properties/image_id' + "$.components.schemas.CreateBareMetalServerSerializer.properties.image_id" + + keypair_name: '#/components/schemas/CreateBareMetalServerSerializer/properties/keypair_name/anyOf/0' + "$.components.schemas.CreateBareMetalServerSerializer.properties.keypair_name.anyOf[0]" + + metadata: '#/components/schemas/CreateBareMetalServerSerializer/properties/metadata' + "$.components.schemas.CreateBareMetalServerSerializer.properties.metadata" + + name_templates: '#/components/schemas/CreateBareMetalServerSerializer/properties/name_templates' + "$.components.schemas.CreateBareMetalServerSerializer.properties.name_templates" + + names: '#/components/schemas/CreateBareMetalServerSerializer/properties/names' + "$.components.schemas.CreateBareMetalServerSerializer.properties.names" + + password: '#/components/schemas/CreateBareMetalServerSerializer/properties/password' + "$.components.schemas.CreateBareMetalServerSerializer.properties.password" + + user_data: '#/components/schemas/CreateBareMetalServerSerializer/properties/user_data' + "$.components.schemas.CreateBareMetalServerSerializer.properties.user_data" + + username: '#/components/schemas/CreateBareMetalServerSerializer/properties/username' + "$.components.schemas.CreateBareMetalServerSerializer.properties.username" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/bminstances/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "flavor": flavor, + "interfaces": interfaces, + "app_config": app_config, + "apptemplate_id": apptemplate_id, + "ddos_profile": ddos_profile, + "image_id": image_id, + "keypair_name": keypair_name, + "metadata": metadata, + "name_templates": name_templates, + "names": names, + "password": password, + "user_data": user_data, + "username": username, + }, + server_create_params.ServerCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN, + changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN, + flavor_id: str | NotGiven = NOT_GIVEN, + flavor_prefix: str | NotGiven = NOT_GIVEN, + include_k8s: bool | NotGiven = NOT_GIVEN, + ip: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + metadata_kv: str | NotGiven = NOT_GIVEN, + metadata_v: List[str] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + only_isolated: bool | NotGiven = NOT_GIVEN, + only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN, + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] + | NotGiven = NOT_GIVEN, + profile_name: str | NotGiven = NOT_GIVEN, + protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN, + status: Literal[ + "ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED" + ] + | NotGiven = NOT_GIVEN, + type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, + uuid: str | NotGiven = NOT_GIVEN, + with_ddos: bool | NotGiven = NOT_GIVEN, + with_interfaces_name: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[BaremetalServer, AsyncOffsetPage[BaremetalServer]]: + """ + List bare metal servers + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[1].schema" + + changes_before: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[2]" + + changes_since: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[3]" + + flavor_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[4]" + + flavor_prefix: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[5]" + + include_k8s: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[6]" + + ip: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[7]" + + limit: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[8]" + + metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[9]" + + metadata_v: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[10]" + + name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[11]" + + offset: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[12]" + + only_isolated: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[13]" + + only_with_fixed_external_ip: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[14]" + + order_by: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[15]" + + profile_name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[16]" + + protection_status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[17]" + + status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[18]" + + type_ddos_profile: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[19]" + + uuid: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/20' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[20]" + + with_ddos: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/21' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[21]" + + with_interfaces_name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/22' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[22]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/bminstances/{project_id}/{region_id}", + page=AsyncOffsetPage[BaremetalServer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "changes_before": changes_before, + "changes_since": changes_since, + "flavor_id": flavor_id, + "flavor_prefix": flavor_prefix, + "include_k8s": include_k8s, + "ip": ip, + "limit": limit, + "metadata_kv": metadata_kv, + "metadata_v": metadata_v, + "name": name, + "offset": offset, + "only_isolated": only_isolated, + "only_with_fixed_external_ip": only_with_fixed_external_ip, + "order_by": order_by, + "profile_name": profile_name, + "protection_status": protection_status, + "status": status, + "type_ddos_profile": type_ddos_profile, + "uuid": uuid, + "with_ddos": with_ddos, + "with_interfaces_name": with_interfaces_name, + }, + server_list_params.ServerListParams, + ), + ), + model=BaremetalServer, + ) + + async def rebuild( + self, + server_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + image_id: str | NotGiven = NOT_GIVEN, + user_data: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Rebuild bare metal server + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/0/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/1/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[1].schema" + + server_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/2/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[2].schema" + + image_id: '#/components/schemas/RebuildBaremetalSchema/properties/image_id' + "$.components.schemas.RebuildBaremetalSchema.properties.image_id" + + user_data: '#/components/schemas/RebuildBaremetalSchema/properties/user_data' + "$.components.schemas.RebuildBaremetalSchema.properties.user_data" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not server_id: + raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") + return await self._post( + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + body=await async_maybe_transform( + { + "image_id": image_id, + "user_data": user_data, + }, + server_rebuild_params.ServerRebuildParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class ServersResourceWithRawResponse: + def __init__(self, servers: ServersResource) -> None: + self._servers = servers + + self.create = to_raw_response_wrapper( + servers.create, + ) + self.list = to_raw_response_wrapper( + servers.list, + ) + self.rebuild = to_raw_response_wrapper( + servers.rebuild, + ) + + +class AsyncServersResourceWithRawResponse: + def __init__(self, servers: AsyncServersResource) -> None: + self._servers = servers + + self.create = async_to_raw_response_wrapper( + servers.create, + ) + self.list = async_to_raw_response_wrapper( + servers.list, + ) + self.rebuild = async_to_raw_response_wrapper( + servers.rebuild, + ) + + +class ServersResourceWithStreamingResponse: + def __init__(self, servers: ServersResource) -> None: + self._servers = servers + + self.create = to_streamed_response_wrapper( + servers.create, + ) + self.list = to_streamed_response_wrapper( + servers.list, + ) + self.rebuild = to_streamed_response_wrapper( + servers.rebuild, + ) + + +class AsyncServersResourceWithStreamingResponse: + def __init__(self, servers: AsyncServersResource) -> None: + self._servers = servers + + self.create = async_to_streamed_response_wrapper( + servers.create, + ) + self.list = async_to_streamed_response_wrapper( + servers.list, + ) + self.rebuild = async_to_streamed_response_wrapper( + servers.rebuild, + ) diff --git a/src/gcore/types/cloud/baremetal/__init__.py b/src/gcore/types/cloud/baremetal/__init__.py index f4bc0da0..fa9f1b7f 100644 --- a/src/gcore/types/cloud/baremetal/__init__.py +++ b/src/gcore/types/cloud/baremetal/__init__.py @@ -2,4 +2,12 @@ from __future__ import annotations +from .baremetal_server import BaremetalServer as BaremetalServer from .image_list_params import ImageListParams as ImageListParams +from .flavor_list_params import FlavorListParams as FlavorListParams +from .server_list_params import ServerListParams as ServerListParams +from .flavor_list_response import FlavorListResponse as FlavorListResponse +from .server_create_params import ServerCreateParams as ServerCreateParams +from .server_rebuild_params import ServerRebuildParams as ServerRebuildParams +from .flavor_list_suitable_params import FlavorListSuitableParams as FlavorListSuitableParams +from .flavor_list_suitable_response import FlavorListSuitableResponse as FlavorListSuitableResponse diff --git a/src/gcore/types/cloud/baremetal/baremetal_server.py b/src/gcore/types/cloud/baremetal/baremetal_server.py new file mode 100644 index 00000000..2ac81b07 --- /dev/null +++ b/src/gcore/types/cloud/baremetal/baremetal_server.py @@ -0,0 +1,461 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, TypeAlias + +from pydantic import Field as FieldInfo + +from ..tag import Tag +from ...._models import BaseModel +from ..ddos_profile import DDOSProfile + +__all__ = [ + "BaremetalServer", + "Address", + "AddressBareMetalFloatingAddressSerializer", + "AddressBareMetalFixedAddressSerializer", + "BlackholePort", + "FixedIPAssignment", + "Flavor", + "FlavorHardwareDescription", + "InstanceIsolation", + "SecurityGroup", + "Volume", +] + + +class AddressBareMetalFloatingAddressSerializer(BaseModel): + addr: str + """ + '#/components/schemas/BareMetalFloatingAddressSerializer/properties/addr' + "$.components.schemas.BareMetalFloatingAddressSerializer.properties.addr" + """ + + type: Literal["floating"] + """ + '#/components/schemas/BareMetalFloatingAddressSerializer/properties/type' + "$.components.schemas.BareMetalFloatingAddressSerializer.properties.type" + """ + + +class AddressBareMetalFixedAddressSerializer(BaseModel): + addr: str + """ + '#/components/schemas/BareMetalFixedAddressSerializer/properties/addr' + "$.components.schemas.BareMetalFixedAddressSerializer.properties.addr" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/BareMetalFixedAddressSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.BareMetalFixedAddressSerializer.properties.interface_name.anyOf[0]" + """ + + subnet_id: str + """ + '#/components/schemas/BareMetalFixedAddressSerializer/properties/subnet_id' + "$.components.schemas.BareMetalFixedAddressSerializer.properties.subnet_id" + """ + + subnet_name: str + """ + '#/components/schemas/BareMetalFixedAddressSerializer/properties/subnet_name' + "$.components.schemas.BareMetalFixedAddressSerializer.properties.subnet_name" + """ + + type: Literal["fixed"] + """ + '#/components/schemas/BareMetalFixedAddressSerializer/properties/type' + "$.components.schemas.BareMetalFixedAddressSerializer.properties.type" + """ + + +Address: TypeAlias = Union[AddressBareMetalFloatingAddressSerializer, AddressBareMetalFixedAddressSerializer] + + +class BlackholePort(BaseModel): + alarm_end: datetime = FieldInfo(alias="AlarmEnd") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlarmEnd' + "$.components.schemas.BlackholePortSerializer.properties.AlarmEnd" + """ + + alarm_start: datetime = FieldInfo(alias="AlarmStart") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlarmStart' + "$.components.schemas.BlackholePortSerializer.properties.AlarmStart" + """ + + alarm_state: Literal[ + "ACK_REQ", + "ALARM", + "ARCHIVED", + "CLEAR", + "CLEARING", + "CLEARING_FAIL", + "END_GRACE", + "END_WAIT", + "MANUAL_CLEAR", + "MANUAL_CLEARING", + "MANUAL_CLEARING_FAIL", + "MANUAL_MITIGATING", + "MANUAL_STARTING", + "MANUAL_STARTING_FAIL", + "MITIGATING", + "STARTING", + "STARTING_FAIL", + "START_WAIT", + "ack_req", + "alarm", + "archived", + "clear", + "clearing", + "clearing_fail", + "end_grace", + "end_wait", + "manual_clear", + "manual_clearing", + "manual_clearing_fail", + "manual_mitigating", + "manual_starting", + "manual_starting_fail", + "mitigating", + "start_wait", + "starting", + "starting_fail", + ] = FieldInfo(alias="AlarmState") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlarmState' + "$.components.schemas.BlackholePortSerializer.properties.AlarmState" + """ + + alert_duration: str = FieldInfo(alias="AlertDuration") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlertDuration' + "$.components.schemas.BlackholePortSerializer.properties.AlertDuration" + """ + + destination_ip: str = FieldInfo(alias="DestinationIP") + """ + '#/components/schemas/BlackholePortSerializer/properties/DestinationIP' + "$.components.schemas.BlackholePortSerializer.properties.DestinationIP" + """ + + id: int = FieldInfo(alias="ID") + """ + '#/components/schemas/BlackholePortSerializer/properties/ID' + "$.components.schemas.BlackholePortSerializer.properties.ID" + """ + + +class FixedIPAssignment(BaseModel): + external: bool + """ + '#/components/schemas/IpAssignmentsSerializer/properties/external' + "$.components.schemas.IpAssignmentsSerializer.properties.external" + """ + + ip_address: str + """ + '#/components/schemas/IpAssignmentsSerializer/properties/ip_address' + "$.components.schemas.IpAssignmentsSerializer.properties.ip_address" + """ + + subnet_id: str + """ + '#/components/schemas/IpAssignmentsSerializer/properties/subnet_id' + "$.components.schemas.IpAssignmentsSerializer.properties.subnet_id" + """ + + +class FlavorHardwareDescription(BaseModel): + cpu: str + """ + '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/cpu' + "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.cpu" + """ + + disk: str + """ + '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/disk' + "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.disk" + """ + + license: str + """ + '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/license' + "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.license" + """ + + network: str + """ + '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/network' + "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.network" + """ + + ram: str + """ + '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/ram' + "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.ram" + """ + + +class Flavor(BaseModel): + architecture: str + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/architecture' + "$.components.schemas.BareMetalFlavorSerializer.properties.architecture" + """ + + flavor_id: str + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/flavor_id' + "$.components.schemas.BareMetalFlavorSerializer.properties.flavor_id" + """ + + flavor_name: str + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/flavor_name' + "$.components.schemas.BareMetalFlavorSerializer.properties.flavor_name" + """ + + hardware_description: FlavorHardwareDescription + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/hardware_description' + "$.components.schemas.BareMetalFlavorSerializer.properties.hardware_description" + """ + + os_type: str + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/os_type' + "$.components.schemas.BareMetalFlavorSerializer.properties.os_type" + """ + + ram: int + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/ram' + "$.components.schemas.BareMetalFlavorSerializer.properties.ram" + """ + + resource_class: str + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/resource_class' + "$.components.schemas.BareMetalFlavorSerializer.properties.resource_class" + """ + + vcpus: int + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/vcpus' + "$.components.schemas.BareMetalFlavorSerializer.properties.vcpus" + """ + + +class InstanceIsolation(BaseModel): + reason: Optional[str] = None + """ + '#/components/schemas/IsolationSerializer/properties/reason/anyOf/0' + "$.components.schemas.IsolationSerializer.properties.reason.anyOf[0]" + """ + + +class SecurityGroup(BaseModel): + name: str + """ + '#/components/schemas/NameSerializerPydantic/properties/name' + "$.components.schemas.NameSerializerPydantic.properties.name" + """ + + +class Volume(BaseModel): + id: str + """ + '#/components/schemas/InstanceVolumeSerializer/properties/id' + "$.components.schemas.InstanceVolumeSerializer.properties.id" + """ + + delete_on_termination: bool + """ + '#/components/schemas/InstanceVolumeSerializer/properties/delete_on_termination' + "$.components.schemas.InstanceVolumeSerializer.properties.delete_on_termination" + """ + + +class BaremetalServer(BaseModel): + addresses: Dict[str, List[Address]] + """ + '#/components/schemas/BareMetalServerSerializer/properties/addresses' + "$.components.schemas.BareMetalServerSerializer.properties.addresses" + """ + + blackhole_ports: List[BlackholePort] + """ + '#/components/schemas/BareMetalServerSerializer/properties/blackhole_ports' + "$.components.schemas.BareMetalServerSerializer.properties.blackhole_ports" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/BareMetalServerSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.BareMetalServerSerializer.properties.creator_task_id.anyOf[0]" + """ + + ddos_profile: Optional[DDOSProfile] = None + """ + '#/components/schemas/BareMetalServerSerializer/properties/ddos_profile/anyOf/0' + "$.components.schemas.BareMetalServerSerializer.properties.ddos_profile.anyOf[0]" + """ + + fixed_ip_assignments: List[FixedIPAssignment] + """ + '#/components/schemas/BareMetalServerSerializer/properties/fixed_ip_assignments' + "$.components.schemas.BareMetalServerSerializer.properties.fixed_ip_assignments" + """ + + flavor: Flavor + """ + '#/components/schemas/BareMetalServerSerializer/properties/flavor' + "$.components.schemas.BareMetalServerSerializer.properties.flavor" + """ + + instance_created: datetime + """ + '#/components/schemas/BareMetalServerSerializer/properties/instance_created' + "$.components.schemas.BareMetalServerSerializer.properties.instance_created" + """ + + instance_description: Optional[str] = None + """ + '#/components/schemas/BareMetalServerSerializer/properties/instance_description/anyOf/0' + "$.components.schemas.BareMetalServerSerializer.properties.instance_description.anyOf[0]" + """ + + instance_id: str + """ + '#/components/schemas/BareMetalServerSerializer/properties/instance_id' + "$.components.schemas.BareMetalServerSerializer.properties.instance_id" + """ + + instance_isolation: Optional[InstanceIsolation] = None + """ + '#/components/schemas/BareMetalServerSerializer/properties/instance_isolation/anyOf/0' + "$.components.schemas.BareMetalServerSerializer.properties.instance_isolation.anyOf[0]" + """ + + instance_name: str + """ + '#/components/schemas/BareMetalServerSerializer/properties/instance_name' + "$.components.schemas.BareMetalServerSerializer.properties.instance_name" + """ + + keypair_name: Optional[str] = None + """ + '#/components/schemas/BareMetalServerSerializer/properties/keypair_name/anyOf/0' + "$.components.schemas.BareMetalServerSerializer.properties.keypair_name.anyOf[0]" + """ + + project_id: int + """ + '#/components/schemas/BareMetalServerSerializer/properties/project_id' + "$.components.schemas.BareMetalServerSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/BareMetalServerSerializer/properties/region' + "$.components.schemas.BareMetalServerSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/BareMetalServerSerializer/properties/region_id' + "$.components.schemas.BareMetalServerSerializer.properties.region_id" + """ + + security_groups: List[SecurityGroup] + """ + '#/components/schemas/BareMetalServerSerializer/properties/security_groups' + "$.components.schemas.BareMetalServerSerializer.properties.security_groups" + """ + + status: Literal[ + "ACTIVE", + "BUILD", + "DELETED", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PASSWORD", + "PAUSED", + "REBOOT", + "REBUILD", + "RESCUE", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "UNKNOWN", + "VERIFY_RESIZE", + ] + """ + '#/components/schemas/BareMetalServerSerializer/properties/status' + "$.components.schemas.BareMetalServerSerializer.properties.status" + """ + + tags: List[Tag] + """ + '#/components/schemas/BareMetalServerSerializer/properties/tags' + "$.components.schemas.BareMetalServerSerializer.properties.tags" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/BareMetalServerSerializer/properties/task_id/anyOf/0' + "$.components.schemas.BareMetalServerSerializer.properties.task_id.anyOf[0]" + """ + + task_state: Optional[str] = None + """ + '#/components/schemas/BareMetalServerSerializer/properties/task_state/anyOf/0' + "$.components.schemas.BareMetalServerSerializer.properties.task_state.anyOf[0]" + """ + + vm_state: Literal[ + "active", + "building", + "deleted", + "error", + "paused", + "rescued", + "resized", + "shelved", + "shelved_offloaded", + "soft-deleted", + "stopped", + "suspended", + ] + """ + '#/components/schemas/BareMetalServerSerializer/properties/vm_state' + "$.components.schemas.BareMetalServerSerializer.properties.vm_state" + """ + + volumes: List[Volume] + """ + '#/components/schemas/BareMetalServerSerializer/properties/volumes' + "$.components.schemas.BareMetalServerSerializer.properties.volumes" + """ + + metadata: Optional[Dict[str, str]] = None + """ + '#/components/schemas/BareMetalServerSerializer/properties/metadata' + "$.components.schemas.BareMetalServerSerializer.properties.metadata" + """ + + metadata_detailed: Optional[List[Tag]] = None + """ + '#/components/schemas/BareMetalServerSerializer/properties/metadata_detailed' + "$.components.schemas.BareMetalServerSerializer.properties.metadata_detailed" + """ diff --git a/src/gcore/types/cloud/baremetal/flavor_list_params.py b/src/gcore/types/cloud/baremetal/flavor_list_params.py new file mode 100644 index 00000000..0a289dc2 --- /dev/null +++ b/src/gcore/types/cloud/baremetal/flavor_list_params.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["FlavorListParams"] + + +class FlavorListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + disabled: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[2]" + """ + + exclude_linux: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[3]" + """ + + exclude_windows: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[4]" + """ + + include_capacity: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[5]" + """ + + include_prices: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[6]" + """ + + include_reservation_stock: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[7]" + """ diff --git a/src/gcore/types/cloud/baremetal/flavor_list_response.py b/src/gcore/types/cloud/baremetal/flavor_list_response.py new file mode 100644 index 00000000..32bc9f65 --- /dev/null +++ b/src/gcore/types/cloud/baremetal/flavor_list_response.py @@ -0,0 +1,114 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["FlavorListResponse", "Result"] + + +class Result(BaseModel): + architecture: str + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/architecture' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.architecture" + """ + + disabled: bool + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/disabled' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.disabled" + """ + + flavor_id: str + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/flavor_id' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.flavor_id" + """ + + flavor_name: str + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/flavor_name' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.flavor_name" + """ + + os_type: str + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/os_type' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.os_type" + """ + + ram: int + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/ram' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.ram" + """ + + resource_class: Optional[str] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/resource_class/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.resource_class.anyOf[0]" + """ + + vcpus: int + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/vcpus' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.vcpus" + """ + + capacity: Optional[int] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/capacity/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.capacity.anyOf[0]" + """ + + currency_code: Optional[str] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/currency_code/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.currency_code.anyOf[0]" + """ + + hardware_description: Optional[Dict[str, str]] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/hardware_description' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.hardware_description" + """ + + price_per_hour: Optional[float] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/price_per_hour/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.price_per_hour.anyOf[0]" + """ + + price_per_month: Optional[float] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/price_per_month/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.price_per_month.anyOf[0]" + """ + + price_status: Optional[Literal["error", "hide", "show"]] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/price_status/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.price_status.anyOf[0]" + """ + + reserved_in_stock: Optional[int] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/reserved_in_stock/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.reserved_in_stock.anyOf[0]" + """ + + +class FlavorListResponse(BaseModel): + count: int + """ + '#/components/schemas/BareMetalFlavorExtendedCollectionSerializer/properties/count' + "$.components.schemas.BareMetalFlavorExtendedCollectionSerializer.properties.count" + """ + + results: List[Result] + """ + '#/components/schemas/BareMetalFlavorExtendedCollectionSerializer/properties/results' + "$.components.schemas.BareMetalFlavorExtendedCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/baremetal/flavor_list_suitable_params.py b/src/gcore/types/cloud/baremetal/flavor_list_suitable_params.py new file mode 100644 index 00000000..6d8c6a27 --- /dev/null +++ b/src/gcore/types/cloud/baremetal/flavor_list_suitable_params.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["FlavorListSuitableParams"] + + +class FlavorListSuitableParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/0/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/1/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[1].schema" + """ + + include_prices: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/2' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[2]" + """ + + apptemplate_id: str + """ + '#/components/schemas/AvailableBaremetalFlavorsRequestSchema/properties/apptemplate_id' + "$.components.schemas.AvailableBaremetalFlavorsRequestSchema.properties.apptemplate_id" + """ + + image_id: str + """ + '#/components/schemas/AvailableBaremetalFlavorsRequestSchema/properties/image_id' + "$.components.schemas.AvailableBaremetalFlavorsRequestSchema.properties.image_id" + """ diff --git a/src/gcore/types/cloud/baremetal/flavor_list_suitable_response.py b/src/gcore/types/cloud/baremetal/flavor_list_suitable_response.py new file mode 100644 index 00000000..dfdfa85a --- /dev/null +++ b/src/gcore/types/cloud/baremetal/flavor_list_suitable_response.py @@ -0,0 +1,114 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["FlavorListSuitableResponse", "Result"] + + +class Result(BaseModel): + architecture: str + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/architecture' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.architecture" + """ + + disabled: bool + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/disabled' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.disabled" + """ + + flavor_id: str + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/flavor_id' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.flavor_id" + """ + + flavor_name: str + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/flavor_name' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.flavor_name" + """ + + os_type: str + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/os_type' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.os_type" + """ + + ram: int + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/ram' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.ram" + """ + + resource_class: Optional[str] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/resource_class/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.resource_class.anyOf[0]" + """ + + vcpus: int + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/vcpus' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.vcpus" + """ + + capacity: Optional[int] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/capacity/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.capacity.anyOf[0]" + """ + + currency_code: Optional[str] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/currency_code/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.currency_code.anyOf[0]" + """ + + hardware_description: Optional[Dict[str, str]] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/hardware_description' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.hardware_description" + """ + + price_per_hour: Optional[float] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/price_per_hour/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.price_per_hour.anyOf[0]" + """ + + price_per_month: Optional[float] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/price_per_month/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.price_per_month.anyOf[0]" + """ + + price_status: Optional[Literal["error", "hide", "show"]] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/price_status/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.price_status.anyOf[0]" + """ + + reserved_in_stock: Optional[int] = None + """ + '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/reserved_in_stock/anyOf/0' + "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.reserved_in_stock.anyOf[0]" + """ + + +class FlavorListSuitableResponse(BaseModel): + count: int + """ + '#/components/schemas/BareMetalFlavorExtendedCollectionSerializer/properties/count' + "$.components.schemas.BareMetalFlavorExtendedCollectionSerializer.properties.count" + """ + + results: List[Result] + """ + '#/components/schemas/BareMetalFlavorExtendedCollectionSerializer/properties/results' + "$.components.schemas.BareMetalFlavorExtendedCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py new file mode 100644 index 00000000..551b182a --- /dev/null +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -0,0 +1,410 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from ..interface_ip_family import InterfaceIPFamily + +__all__ = [ + "ServerCreateParams", + "Interface", + "InterfaceCreateBareMetalExternalInterfaceSerializer", + "InterfaceCreateBareMetalSubnetInterfaceSerializer", + "InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIP", + "InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer", + "InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIPExistingInstanceFloatingIPInterfaceSerializer", + "InterfaceCreateBareMetalAnySubnetInterfaceSerializer", + "InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIP", + "InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer", + "InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIPExistingInstanceFloatingIPInterfaceSerializer", + "InterfaceCreateBareMetalReservedFixedIPInterfaceSerializer", + "InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIP", + "InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer", + "InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIPExistingInstanceFloatingIPInterfaceSerializer", + "DDOSProfile", + "DDOSProfileField", +] + + +class ServerCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + flavor: Required[str] + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/flavor' + "$.components.schemas.CreateBareMetalServerSerializer.properties.flavor" + """ + + interfaces: Required[Iterable[Interface]] + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/interfaces' + "$.components.schemas.CreateBareMetalServerSerializer.properties.interfaces" + """ + + app_config: Optional[object] + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/app_config/anyOf/0' + "$.components.schemas.CreateBareMetalServerSerializer.properties.app_config.anyOf[0]" + """ + + apptemplate_id: str + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/apptemplate_id' + "$.components.schemas.CreateBareMetalServerSerializer.properties.apptemplate_id" + """ + + ddos_profile: DDOSProfile + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/ddos_profile' + "$.components.schemas.CreateBareMetalServerSerializer.properties.ddos_profile" + """ + + image_id: str + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/image_id' + "$.components.schemas.CreateBareMetalServerSerializer.properties.image_id" + """ + + keypair_name: Optional[str] + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/keypair_name/anyOf/0' + "$.components.schemas.CreateBareMetalServerSerializer.properties.keypair_name.anyOf[0]" + """ + + metadata: Dict[str, str] + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/metadata' + "$.components.schemas.CreateBareMetalServerSerializer.properties.metadata" + """ + + name_templates: List[str] + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/name_templates' + "$.components.schemas.CreateBareMetalServerSerializer.properties.name_templates" + """ + + names: List[str] + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/names' + "$.components.schemas.CreateBareMetalServerSerializer.properties.names" + """ + + password: str + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/password' + "$.components.schemas.CreateBareMetalServerSerializer.properties.password" + """ + + user_data: str + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/user_data' + "$.components.schemas.CreateBareMetalServerSerializer.properties.user_data" + """ + + username: str + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/username' + "$.components.schemas.CreateBareMetalServerSerializer.properties.username" + """ + + +class InterfaceCreateBareMetalExternalInterfaceSerializer(TypedDict, total=False): + type: Required[Literal["external"]] + """ + '#/components/schemas/CreateBareMetalExternalInterfaceSerializer/properties/type' + "$.components.schemas.CreateBareMetalExternalInterfaceSerializer.properties.type" + """ + + interface_name: str + """ + '#/components/schemas/CreateBareMetalExternalInterfaceSerializer/properties/interface_name' + "$.components.schemas.CreateBareMetalExternalInterfaceSerializer.properties.interface_name" + """ + + ip_family: Optional[InterfaceIPFamily] + """ + '#/components/schemas/CreateBareMetalExternalInterfaceSerializer/properties/ip_family/anyOf/0' + "$.components.schemas.CreateBareMetalExternalInterfaceSerializer.properties.ip_family.anyOf[0]" + """ + + port_group: int + """ + '#/components/schemas/CreateBareMetalExternalInterfaceSerializer/properties/port_group' + "$.components.schemas.CreateBareMetalExternalInterfaceSerializer.properties.port_group" + """ + + +class InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + source: Required[Literal["new"]] + """ + '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +class InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIPExistingInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + existing_floating_id: Required[str] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + """ + + source: Required[Literal["existing"]] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIP: TypeAlias = Union[ + InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer, + InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIPExistingInstanceFloatingIPInterfaceSerializer, +] + + +class InterfaceCreateBareMetalSubnetInterfaceSerializer(TypedDict, total=False): + network_id: Required[str] + """ + '#/components/schemas/CreateBareMetalSubnetInterfaceSerializer/properties/network_id' + "$.components.schemas.CreateBareMetalSubnetInterfaceSerializer.properties.network_id" + """ + + subnet_id: Required[str] + """ + '#/components/schemas/CreateBareMetalSubnetInterfaceSerializer/properties/subnet_id' + "$.components.schemas.CreateBareMetalSubnetInterfaceSerializer.properties.subnet_id" + """ + + type: Required[Literal["subnet"]] + """ + '#/components/schemas/CreateBareMetalSubnetInterfaceSerializer/properties/type' + "$.components.schemas.CreateBareMetalSubnetInterfaceSerializer.properties.type" + """ + + floating_ip: InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIP + """ + '#/components/schemas/CreateBareMetalSubnetInterfaceSerializer/properties/floating_ip' + "$.components.schemas.CreateBareMetalSubnetInterfaceSerializer.properties.floating_ip" + """ + + interface_name: str + """ + '#/components/schemas/CreateBareMetalSubnetInterfaceSerializer/properties/interface_name' + "$.components.schemas.CreateBareMetalSubnetInterfaceSerializer.properties.interface_name" + """ + + port_group: int + """ + '#/components/schemas/CreateBareMetalSubnetInterfaceSerializer/properties/port_group' + "$.components.schemas.CreateBareMetalSubnetInterfaceSerializer.properties.port_group" + """ + + +class InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + source: Required[Literal["new"]] + """ + '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +class InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIPExistingInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + existing_floating_id: Required[str] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + """ + + source: Required[Literal["existing"]] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIP: TypeAlias = Union[ + InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer, + InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIPExistingInstanceFloatingIPInterfaceSerializer, +] + + +class InterfaceCreateBareMetalAnySubnetInterfaceSerializer(TypedDict, total=False): + network_id: Required[str] + """ + '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/network_id' + "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.network_id" + """ + + type: Required[Literal["any_subnet"]] + """ + '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/type' + "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.type" + """ + + floating_ip: InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIP + """ + '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/floating_ip' + "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.floating_ip" + """ + + interface_name: str + """ + '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/interface_name' + "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.interface_name" + """ + + ip_address: str + """ + '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/ip_address' + "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.ip_address" + """ + + ip_family: Optional[InterfaceIPFamily] + """ + '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/ip_family/anyOf/0' + "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.ip_family.anyOf[0]" + """ + + port_group: int + """ + '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/port_group' + "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.port_group" + """ + + +class InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + source: Required[Literal["new"]] + """ + '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +class InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIPExistingInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + existing_floating_id: Required[str] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + """ + + source: Required[Literal["existing"]] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIP: TypeAlias = Union[ + InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer, + InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIPExistingInstanceFloatingIPInterfaceSerializer, +] + + +class InterfaceCreateBareMetalReservedFixedIPInterfaceSerializer(TypedDict, total=False): + port_id: Required[str] + """ + '#/components/schemas/CreateBareMetalReservedFixedIpInterfaceSerializer/properties/port_id' + "$.components.schemas.CreateBareMetalReservedFixedIpInterfaceSerializer.properties.port_id" + """ + + type: Required[Literal["reserved_fixed_ip"]] + """ + '#/components/schemas/CreateBareMetalReservedFixedIpInterfaceSerializer/properties/type' + "$.components.schemas.CreateBareMetalReservedFixedIpInterfaceSerializer.properties.type" + """ + + floating_ip: InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIP + """ + '#/components/schemas/CreateBareMetalReservedFixedIpInterfaceSerializer/properties/floating_ip' + "$.components.schemas.CreateBareMetalReservedFixedIpInterfaceSerializer.properties.floating_ip" + """ + + interface_name: str + """ + '#/components/schemas/CreateBareMetalReservedFixedIpInterfaceSerializer/properties/interface_name' + "$.components.schemas.CreateBareMetalReservedFixedIpInterfaceSerializer.properties.interface_name" + """ + + port_group: int + """ + '#/components/schemas/CreateBareMetalReservedFixedIpInterfaceSerializer/properties/port_group' + "$.components.schemas.CreateBareMetalReservedFixedIpInterfaceSerializer.properties.port_group" + """ + + +Interface: TypeAlias = Union[ + InterfaceCreateBareMetalExternalInterfaceSerializer, + InterfaceCreateBareMetalSubnetInterfaceSerializer, + InterfaceCreateBareMetalAnySubnetInterfaceSerializer, + InterfaceCreateBareMetalReservedFixedIPInterfaceSerializer, +] + + +class DDOSProfileField(TypedDict, total=False): + base_field: Optional[int] + """ + '#/components/schemas/CreateBareMetalDDoSProfileFieldSerializer/properties/base_field/anyOf/0' + "$.components.schemas.CreateBareMetalDDoSProfileFieldSerializer.properties.base_field.anyOf[0]" + """ + + field_name: Optional[str] + """ + '#/components/schemas/CreateBareMetalDDoSProfileFieldSerializer/properties/field_name/anyOf/0' + "$.components.schemas.CreateBareMetalDDoSProfileFieldSerializer.properties.field_name.anyOf[0]" + """ + + field_value: Union[Iterable[object], int, str, None] + """ + '#/components/schemas/CreateBareMetalDDoSProfileFieldSerializer/properties/field_value' + "$.components.schemas.CreateBareMetalDDoSProfileFieldSerializer.properties.field_value" + """ + + value: Optional[str] + """ + '#/components/schemas/CreateBareMetalDDoSProfileFieldSerializer/properties/value/anyOf/0' + "$.components.schemas.CreateBareMetalDDoSProfileFieldSerializer.properties.value.anyOf[0]" + """ + + +class DDOSProfile(TypedDict, total=False): + profile_template: Required[int] + """ + '#/components/schemas/CreateDDoSProfileSerializer/properties/profile_template' + "$.components.schemas.CreateDDoSProfileSerializer.properties.profile_template" + """ + + fields: Optional[Iterable[DDOSProfileField]] + """ + '#/components/schemas/CreateDDoSProfileSerializer/properties/fields/anyOf/0' + "$.components.schemas.CreateDDoSProfileSerializer.properties.fields.anyOf[0]" + """ + + profile_template_name: Optional[str] + """ + '#/components/schemas/CreateDDoSProfileSerializer/properties/profile_template_name/anyOf/0' + "$.components.schemas.CreateDDoSProfileSerializer.properties.profile_template_name.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/baremetal/server_list_params.py b/src/gcore/types/cloud/baremetal/server_list_params.py new file mode 100644 index 00000000..b803a1ba --- /dev/null +++ b/src/gcore/types/cloud/baremetal/server_list_params.py @@ -0,0 +1,151 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["ServerListParams"] + + +class ServerListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + changes_before: Annotated[Union[str, datetime], PropertyInfo(alias="changes-before", format="iso8601")] + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[2]" + """ + + changes_since: Annotated[Union[str, datetime], PropertyInfo(alias="changes-since", format="iso8601")] + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[3]" + """ + + flavor_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[4]" + """ + + flavor_prefix: str + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[5]" + """ + + include_k8s: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[6]" + """ + + ip: str + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[7]" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[8]" + """ + + metadata_kv: str + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[9]" + """ + + metadata_v: List[str] + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[10]" + """ + + name: str + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[11]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[12]" + """ + + only_isolated: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[13]" + """ + + only_with_fixed_external_ip: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[14]" + """ + + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[15]" + """ + + profile_name: str + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[16]" + """ + + protection_status: Literal["Active", "Queued", "Error"] + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[17]" + """ + + status: Literal["ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED"] + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[18]" + """ + + type_ddos_profile: Literal["basic", "advanced"] + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[19]" + """ + + uuid: str + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/20' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[20]" + """ + + with_ddos: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/21' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[21]" + """ + + with_interfaces_name: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/22' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[22]" + """ diff --git a/src/gcore/types/cloud/baremetal/server_rebuild_params.py b/src/gcore/types/cloud/baremetal/server_rebuild_params.py new file mode 100644 index 00000000..3abb0ec3 --- /dev/null +++ b/src/gcore/types/cloud/baremetal/server_rebuild_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ServerRebuildParams"] + + +class ServerRebuildParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/0/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/1/schema' + "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[1].schema" + """ + + image_id: str + """ + '#/components/schemas/RebuildBaremetalSchema/properties/image_id' + "$.components.schemas.RebuildBaremetalSchema.properties.image_id" + """ + + user_data: str + """ + '#/components/schemas/RebuildBaremetalSchema/properties/user_data' + "$.components.schemas.RebuildBaremetalSchema.properties.user_data" + """ diff --git a/tests/api_resources/cloud/baremetal/test_flavors.py b/tests/api_resources/cloud/baremetal/test_flavors.py new file mode 100644 index 00000000..a5c646de --- /dev/null +++ b/tests/api_resources/cloud/baremetal/test_flavors.py @@ -0,0 +1,211 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.baremetal import ( + FlavorListResponse, + FlavorListSuitableResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFlavors: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + flavor = client.cloud.baremetal.flavors.list( + project_id=0, + region_id=0, + ) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + flavor = client.cloud.baremetal.flavors.list( + project_id=0, + region_id=0, + disabled=True, + exclude_linux=True, + exclude_windows=True, + include_capacity=True, + include_prices=True, + include_reservation_stock=True, + ) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.baremetal.flavors.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = response.parse() + assert_matches_type(FlavorListResponse, flavor, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.baremetal.flavors.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = response.parse() + assert_matches_type(FlavorListResponse, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_suitable(self, client: Gcore) -> None: + flavor = client.cloud.baremetal.flavors.list_suitable( + project_id=0, + region_id=0, + ) + assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + + @parametrize + def test_method_list_suitable_with_all_params(self, client: Gcore) -> None: + flavor = client.cloud.baremetal.flavors.list_suitable( + project_id=0, + region_id=0, + include_prices=True, + apptemplate_id="apptemplate_id", + image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", + ) + assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + + @parametrize + def test_raw_response_list_suitable(self, client: Gcore) -> None: + response = client.cloud.baremetal.flavors.with_raw_response.list_suitable( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = response.parse() + assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + + @parametrize + def test_streaming_response_list_suitable(self, client: Gcore) -> None: + with client.cloud.baremetal.flavors.with_streaming_response.list_suitable( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = response.parse() + assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFlavors: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.baremetal.flavors.list( + project_id=0, + region_id=0, + ) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.baremetal.flavors.list( + project_id=0, + region_id=0, + disabled=True, + exclude_linux=True, + exclude_windows=True, + include_capacity=True, + include_prices=True, + include_reservation_stock=True, + ) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.baremetal.flavors.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = await response.parse() + assert_matches_type(FlavorListResponse, flavor, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.baremetal.flavors.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = await response.parse() + assert_matches_type(FlavorListResponse, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_suitable(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.baremetal.flavors.list_suitable( + project_id=0, + region_id=0, + ) + assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + + @parametrize + async def test_method_list_suitable_with_all_params(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.baremetal.flavors.list_suitable( + project_id=0, + region_id=0, + include_prices=True, + apptemplate_id="apptemplate_id", + image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", + ) + assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + + @parametrize + async def test_raw_response_list_suitable(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.baremetal.flavors.with_raw_response.list_suitable( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = await response.parse() + assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + + @parametrize + async def test_streaming_response_list_suitable(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.baremetal.flavors.with_streaming_response.list_suitable( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = await response.parse() + assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py new file mode 100644 index 00000000..0845c891 --- /dev/null +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -0,0 +1,423 @@ +# 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._utils import parse_datetime +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.baremetal import BaremetalServer + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestServers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + server = client.cloud.baremetal.servers.create( + project_id=1, + region_id=1, + flavor="bm2-hf-medium", + interfaces=[{"type": "external"}], + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + server = client.cloud.baremetal.servers.create( + project_id=1, + region_id=1, + flavor="bm2-hf-medium", + interfaces=[ + { + "type": "external", + "interface_name": "eth0", + "ip_family": "ipv4", + "port_group": 0, + } + ], + app_config={}, + apptemplate_id="apptemplate_id", + ddos_profile={ + "profile_template": 1, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": "value", + } + ], + "profile_template_name": "profile_template_name", + }, + image_id="image_id", + keypair_name="my-keypair", + metadata={"my-tag": "my-tag-value"}, + name_templates=["my-bare-metal-{ip_octets}"], + names=["my-bare-metal"], + password="password", + user_data="user_data", + username="username", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.baremetal.servers.with_raw_response.create( + project_id=1, + region_id=1, + flavor="bm2-hf-medium", + interfaces=[{"type": "external"}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.baremetal.servers.with_streaming_response.create( + project_id=1, + region_id=1, + flavor="bm2-hf-medium", + interfaces=[{"type": "external"}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + server = client.cloud.baremetal.servers.list( + project_id=1, + region_id=1, + ) + assert_matches_type(SyncOffsetPage[BaremetalServer], server, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + server = client.cloud.baremetal.servers.list( + project_id=1, + region_id=1, + changes_before=parse_datetime("2025-10-01T12:00:00Z"), + changes_since=parse_datetime("2025-10-01T12:00:00Z"), + flavor_id="bm2-hf-small", + flavor_prefix="bm2-", + include_k8s=True, + ip="192.168.0.1", + limit=1000, + metadata_kv="metadata_kv", + metadata_v=["value1", "value2"], + name="name", + offset=0, + only_isolated=True, + only_with_fixed_external_ip=True, + order_by="name.asc", + profile_name="profile_name", + protection_status="Active", + status="ACTIVE", + type_ddos_profile="advanced", + uuid="b5b4d65d-945f-4b98-ab6f-332319c724ef", + with_ddos=True, + with_interfaces_name=True, + ) + assert_matches_type(SyncOffsetPage[BaremetalServer], server, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.baremetal.servers.with_raw_response.list( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(SyncOffsetPage[BaremetalServer], server, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.baremetal.servers.with_streaming_response.list( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(SyncOffsetPage[BaremetalServer], server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_rebuild(self, client: Gcore) -> None: + server = client.cloud.baremetal.servers.rebuild( + server_id="server_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_method_rebuild_with_all_params(self, client: Gcore) -> None: + server = client.cloud.baremetal.servers.rebuild( + server_id="server_id", + project_id=0, + region_id=0, + image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", + user_data="aGVsbG9fd29ybGQ=", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_raw_response_rebuild(self, client: Gcore) -> None: + response = client.cloud.baremetal.servers.with_raw_response.rebuild( + server_id="server_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_streaming_response_rebuild(self, client: Gcore) -> None: + with client.cloud.baremetal.servers.with_streaming_response.rebuild( + server_id="server_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_rebuild(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): + client.cloud.baremetal.servers.with_raw_response.rebuild( + server_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncServers: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.baremetal.servers.create( + project_id=1, + region_id=1, + flavor="bm2-hf-medium", + interfaces=[{"type": "external"}], + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.baremetal.servers.create( + project_id=1, + region_id=1, + flavor="bm2-hf-medium", + interfaces=[ + { + "type": "external", + "interface_name": "eth0", + "ip_family": "ipv4", + "port_group": 0, + } + ], + app_config={}, + apptemplate_id="apptemplate_id", + ddos_profile={ + "profile_template": 1, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": "value", + } + ], + "profile_template_name": "profile_template_name", + }, + image_id="image_id", + keypair_name="my-keypair", + metadata={"my-tag": "my-tag-value"}, + name_templates=["my-bare-metal-{ip_octets}"], + names=["my-bare-metal"], + password="password", + user_data="user_data", + username="username", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.baremetal.servers.with_raw_response.create( + project_id=1, + region_id=1, + flavor="bm2-hf-medium", + interfaces=[{"type": "external"}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.baremetal.servers.with_streaming_response.create( + project_id=1, + region_id=1, + flavor="bm2-hf-medium", + interfaces=[{"type": "external"}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.baremetal.servers.list( + project_id=1, + region_id=1, + ) + assert_matches_type(AsyncOffsetPage[BaremetalServer], server, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.baremetal.servers.list( + project_id=1, + region_id=1, + changes_before=parse_datetime("2025-10-01T12:00:00Z"), + changes_since=parse_datetime("2025-10-01T12:00:00Z"), + flavor_id="bm2-hf-small", + flavor_prefix="bm2-", + include_k8s=True, + ip="192.168.0.1", + limit=1000, + metadata_kv="metadata_kv", + metadata_v=["value1", "value2"], + name="name", + offset=0, + only_isolated=True, + only_with_fixed_external_ip=True, + order_by="name.asc", + profile_name="profile_name", + protection_status="Active", + status="ACTIVE", + type_ddos_profile="advanced", + uuid="b5b4d65d-945f-4b98-ab6f-332319c724ef", + with_ddos=True, + with_interfaces_name=True, + ) + assert_matches_type(AsyncOffsetPage[BaremetalServer], server, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.baremetal.servers.with_raw_response.list( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(AsyncOffsetPage[BaremetalServer], server, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.baremetal.servers.with_streaming_response.list( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(AsyncOffsetPage[BaremetalServer], server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_rebuild(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.baremetal.servers.rebuild( + server_id="server_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_method_rebuild_with_all_params(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.baremetal.servers.rebuild( + server_id="server_id", + project_id=0, + region_id=0, + image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", + user_data="aGVsbG9fd29ybGQ=", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_raw_response_rebuild(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.baremetal.servers.with_raw_response.rebuild( + server_id="server_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_streaming_response_rebuild(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.baremetal.servers.with_streaming_response.rebuild( + server_id="server_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_rebuild(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): + await async_client.cloud.baremetal.servers.with_raw_response.rebuild( + server_id="", + project_id=0, + region_id=0, + ) From 9a5e52bf9ecc8d863b0bfa123fbdf22b3eaf50d7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 10:00:09 +0000 Subject: [PATCH 080/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 22 +- src/gcore/resources/cloud/baremetal/images.py | 39 +- .../resources/cloud/baremetal/servers.py | 76 ++-- .../cloud/file_shares/file_shares.py | 32 +- src/gcore/resources/cloud/floating_ips.py | 48 +- src/gcore/resources/cloud/instances/images.py | 417 ++++++++---------- .../cloud/load_balancers/load_balancers.py | 66 ++- .../resources/cloud/networks/networks.py | 50 +-- src/gcore/resources/cloud/networks/routers.py | 30 +- src/gcore/resources/cloud/networks/subnets.py | 56 +-- .../cloud/security_groups/security_groups.py | 28 +- src/gcore/resources/cloud/volumes.py | 80 ++-- src/gcore/types/cloud/__init__.py | 2 - src/gcore/types/cloud/baremetal/__init__.py | 1 + .../types/cloud/baremetal/baremetal_server.py | 48 -- .../cloud/baremetal/image_list_params.py | 7 +- .../cloud/baremetal/image_list_response.py | 182 ++++++++ .../cloud/baremetal/server_create_params.py | 12 +- .../cloud/baremetal/server_list_params.py | 20 +- src/gcore/types/cloud/file_share.py | 14 +- .../types/cloud/file_share_create_params.py | 12 +- src/gcore/types/cloud/floating_ip.py | 6 - .../types/cloud/floating_ip_create_params.py | 12 +- src/gcore/types/cloud/floating_ip_detailed.py | 18 - .../types/cloud/floating_ip_list_params.py | 6 +- src/gcore/types/cloud/image.py | 203 --------- src/gcore/types/cloud/image_list.py | 22 - src/gcore/types/cloud/instances/__init__.py | 3 + .../image_create_from_volume_params.py | 56 +-- .../types/cloud/instances/image_get_params.py | 26 +- .../cloud/instances/image_get_response.py | 168 +++++++ .../cloud/instances/image_list_params.py | 7 +- .../cloud/instances/image_list_response.py | 182 ++++++++ .../cloud/instances/image_update_params.py | 42 +- .../cloud/instances/image_update_response.py | 168 +++++++ .../cloud/instances/image_upload_params.py | 66 +-- src/gcore/types/cloud/load_balancer.py | 12 +- .../cloud/load_balancer_create_params.py | 12 +- .../types/cloud/load_balancer_list_params.py | 13 +- src/gcore/types/cloud/load_balancer_status.py | 6 - src/gcore/types/cloud/network.py | 6 - .../types/cloud/network_create_params.py | 8 +- src/gcore/types/cloud/network_list_params.py | 9 +- .../networks/router_attach_subnet_params.py | 10 +- .../cloud/networks/subnet_create_params.py | 12 +- .../cloud/networks/subnet_list_params.py | 28 +- src/gcore/types/cloud/security_group.py | 18 +- .../cloud/security_group_create_params.py | 12 +- .../types/cloud/security_group_list_params.py | 7 +- src/gcore/types/cloud/subnet.py | 6 - src/gcore/types/cloud/volume.py | 12 - src/gcore/types/cloud/volume_create_params.py | 24 +- src/gcore/types/cloud/volume_list_params.py | 8 +- .../cloud/baremetal/test_images.py | 26 +- .../cloud/baremetal/test_servers.py | 12 +- .../cloud/instances/test_images.py | 135 +++--- .../cloud/networks/test_routers.py | 66 ++- .../cloud/networks/test_subnets.py | 12 +- tests/api_resources/cloud/test_file_shares.py | 8 +- .../api_resources/cloud/test_floating_ips.py | 12 +- .../cloud/test_load_balancers.py | 14 +- tests/api_resources/cloud/test_networks.py | 12 +- .../cloud/test_security_groups.py | 14 +- tests/api_resources/cloud/test_volumes.py | 20 +- 65 files changed, 1541 insertions(+), 1224 deletions(-) create mode 100644 src/gcore/types/cloud/baremetal/image_list_response.py delete mode 100644 src/gcore/types/cloud/image.py delete mode 100644 src/gcore/types/cloud/image_list.py create mode 100644 src/gcore/types/cloud/instances/image_get_response.py create mode 100644 src/gcore/types/cloud/instances/image_list_response.py create mode 100644 src/gcore/types/cloud/instances/image_update_response.py diff --git a/.stats.yml b/.stats.yml index 72d4eb91..fdcf1b73 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 171 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1b085537d9cf740f2b3313109b3be0f00952207abc6f1fee686579c070e71fc2.yml -openapi_spec_hash: 61acc4dd694c9d01c88941c577deb740 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fd112571ef5f42061c9dee7ecc057c924513aa9e6b2c9e373e847b07eb19e315.yml +openapi_spec_hash: 842d806607c522f6db146861c3d2ec62 config_hash: ec7c5974d987e11bcd3be200616819e5 diff --git a/api.md b/api.md index 234ee193..c5f5a7a7 100644 --- a/api.md +++ b/api.md @@ -14,8 +14,6 @@ from gcore.types.cloud import ( FlavorHardwareDescription, FloatingIP, FloatingIPStatus, - Image, - ImageList, InstanceMetricsTimeUnit, InterfaceIPFamily, IPVersion, @@ -559,9 +557,15 @@ Methods: ### Images +Types: + +```python +from gcore.types.cloud.baremetal import ImageListResponse +``` + Methods: -- client.cloud.baremetal.images.list(\*, project_id, region_id, \*\*params) -> ImageList +- client.cloud.baremetal.images.list(\*, project_id, region_id, \*\*params) -> ImageListResponse ### Flavors @@ -594,13 +598,19 @@ Methods: ### Images +Types: + +```python +from gcore.types.cloud.instances import ImageUpdateResponse, ImageListResponse, ImageGetResponse +``` + Methods: -- client.cloud.instances.images.update(image_id, \*, project_id, region_id, \*\*params) -> Image -- client.cloud.instances.images.list(\*, project_id, region_id, \*\*params) -> ImageList +- client.cloud.instances.images.update(image_id, \*, project_id, region_id, \*\*params) -> ImageUpdateResponse +- client.cloud.instances.images.list(\*, project_id, region_id, \*\*params) -> ImageListResponse - client.cloud.instances.images.delete(image_id, \*, project_id, region_id) -> TaskIDList - client.cloud.instances.images.create_from_volume(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.instances.images.get(image_id, \*, project_id, region_id, \*\*params) -> Image +- client.cloud.instances.images.get(image_id, \*, project_id, region_id, \*\*params) -> ImageGetResponse - client.cloud.instances.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList ## FileShares diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index a3296f4d..7134e90d 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import List from typing_extensions import Literal import httpx @@ -18,7 +19,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.baremetal import image_list_params -from ....types.cloud.image_list import ImageList +from ....types.cloud.baremetal.image_list_response import ImageListResponse __all__ = ["ImagesResource", "AsyncImagesResource"] @@ -49,9 +50,9 @@ def list( project_id: int | None = None, region_id: int | None = None, include_prices: bool | NotGiven = NOT_GIVEN, - metadata_k: str | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, private: str | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -59,7 +60,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageList: + ) -> ImageListResponse: """Retrieve the available images list for bare metal servers. Returned entities may @@ -75,13 +76,13 @@ def list( include_prices: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[2]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + private: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[3]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + tag_key: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[4]" - private: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[5]" visibility: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' @@ -109,15 +110,15 @@ def list( query=maybe_transform( { "include_prices": include_prices, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "private": private, + "tag_key": tag_key, + "tag_key_value": tag_key_value, "visibility": visibility, }, image_list_params.ImageListParams, ), ), - cast_to=ImageList, + cast_to=ImageListResponse, ) @@ -147,9 +148,9 @@ async def list( project_id: int | None = None, region_id: int | None = None, include_prices: bool | NotGiven = NOT_GIVEN, - metadata_k: str | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, private: str | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -157,7 +158,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageList: + ) -> ImageListResponse: """Retrieve the available images list for bare metal servers. Returned entities may @@ -173,13 +174,13 @@ async def list( include_prices: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[2]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + private: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[3]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + tag_key: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[4]" - private: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[5]" visibility: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' @@ -207,15 +208,15 @@ async def list( query=await async_maybe_transform( { "include_prices": include_prices, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "private": private, + "tag_key": tag_key, + "tag_key_value": tag_key_value, "visibility": visibility, }, image_list_params.ImageListParams, ), ), - cast_to=ImageList, + cast_to=ImageListResponse, ) diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 674a2a71..afc30dd1 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -59,10 +59,10 @@ def create( ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, image_id: str | NotGiven = NOT_GIVEN, keypair_name: Optional[str] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, name_templates: List[str] | NotGiven = NOT_GIVEN, names: List[str] | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -103,9 +103,6 @@ def create( keypair_name: '#/components/schemas/CreateBareMetalServerSerializer/properties/keypair_name/anyOf/0' "$.components.schemas.CreateBareMetalServerSerializer.properties.keypair_name.anyOf[0]" - metadata: '#/components/schemas/CreateBareMetalServerSerializer/properties/metadata' - "$.components.schemas.CreateBareMetalServerSerializer.properties.metadata" - name_templates: '#/components/schemas/CreateBareMetalServerSerializer/properties/name_templates' "$.components.schemas.CreateBareMetalServerSerializer.properties.name_templates" @@ -115,6 +112,9 @@ def create( password: '#/components/schemas/CreateBareMetalServerSerializer/properties/password' "$.components.schemas.CreateBareMetalServerSerializer.properties.password" + tags: '#/components/schemas/CreateBareMetalServerSerializer/properties/tags' + "$.components.schemas.CreateBareMetalServerSerializer.properties.tags" + user_data: '#/components/schemas/CreateBareMetalServerSerializer/properties/user_data' "$.components.schemas.CreateBareMetalServerSerializer.properties.user_data" @@ -144,10 +144,10 @@ def create( "ddos_profile": ddos_profile, "image_id": image_id, "keypair_name": keypair_name, - "metadata": metadata, "name_templates": name_templates, "names": names, "password": password, + "tags": tags, "user_data": user_data, "username": username, }, @@ -171,8 +171,6 @@ def list( include_k8s: bool | NotGiven = NOT_GIVEN, ip: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, - metadata_v: List[str] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, only_isolated: bool | NotGiven = NOT_GIVEN, @@ -185,6 +183,8 @@ def list( "ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED" ] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, + tag_value: List[str] | NotGiven = NOT_GIVEN, type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, uuid: str | NotGiven = NOT_GIVEN, with_ddos: bool | NotGiven = NOT_GIVEN, @@ -227,34 +227,34 @@ def list( limit: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[8]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[9]" - metadata_v: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + offset: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[10]" - name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + only_isolated: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[11]" - offset: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' + only_with_fixed_external_ip: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[12]" - only_isolated: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' + order_by: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[13]" - only_with_fixed_external_ip: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' + profile_name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[14]" - order_by: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' + protection_status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[15]" - profile_name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' + status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[16]" - protection_status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[17]" - status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' + tag_value: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[18]" type_ddos_profile: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' @@ -298,8 +298,6 @@ def list( "include_k8s": include_k8s, "ip": ip, "limit": limit, - "metadata_kv": metadata_kv, - "metadata_v": metadata_v, "name": name, "offset": offset, "only_isolated": only_isolated, @@ -308,6 +306,8 @@ def list( "profile_name": profile_name, "protection_status": protection_status, "status": status, + "tag_key_value": tag_key_value, + "tag_value": tag_value, "type_ddos_profile": type_ddos_profile, "uuid": uuid, "with_ddos": with_ddos, @@ -415,10 +415,10 @@ async def create( ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, image_id: str | NotGiven = NOT_GIVEN, keypair_name: Optional[str] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, name_templates: List[str] | NotGiven = NOT_GIVEN, names: List[str] | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -459,9 +459,6 @@ async def create( keypair_name: '#/components/schemas/CreateBareMetalServerSerializer/properties/keypair_name/anyOf/0' "$.components.schemas.CreateBareMetalServerSerializer.properties.keypair_name.anyOf[0]" - metadata: '#/components/schemas/CreateBareMetalServerSerializer/properties/metadata' - "$.components.schemas.CreateBareMetalServerSerializer.properties.metadata" - name_templates: '#/components/schemas/CreateBareMetalServerSerializer/properties/name_templates' "$.components.schemas.CreateBareMetalServerSerializer.properties.name_templates" @@ -471,6 +468,9 @@ async def create( password: '#/components/schemas/CreateBareMetalServerSerializer/properties/password' "$.components.schemas.CreateBareMetalServerSerializer.properties.password" + tags: '#/components/schemas/CreateBareMetalServerSerializer/properties/tags' + "$.components.schemas.CreateBareMetalServerSerializer.properties.tags" + user_data: '#/components/schemas/CreateBareMetalServerSerializer/properties/user_data' "$.components.schemas.CreateBareMetalServerSerializer.properties.user_data" @@ -500,10 +500,10 @@ async def create( "ddos_profile": ddos_profile, "image_id": image_id, "keypair_name": keypair_name, - "metadata": metadata, "name_templates": name_templates, "names": names, "password": password, + "tags": tags, "user_data": user_data, "username": username, }, @@ -527,8 +527,6 @@ def list( include_k8s: bool | NotGiven = NOT_GIVEN, ip: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, - metadata_v: List[str] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, only_isolated: bool | NotGiven = NOT_GIVEN, @@ -541,6 +539,8 @@ def list( "ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED" ] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, + tag_value: List[str] | NotGiven = NOT_GIVEN, type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, uuid: str | NotGiven = NOT_GIVEN, with_ddos: bool | NotGiven = NOT_GIVEN, @@ -583,34 +583,34 @@ def list( limit: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[8]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[9]" - metadata_v: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + offset: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[10]" - name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + only_isolated: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[11]" - offset: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' + only_with_fixed_external_ip: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[12]" - only_isolated: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' + order_by: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[13]" - only_with_fixed_external_ip: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' + profile_name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[14]" - order_by: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' + protection_status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[15]" - profile_name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' + status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[16]" - protection_status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[17]" - status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' + tag_value: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[18]" type_ddos_profile: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' @@ -654,8 +654,6 @@ def list( "include_k8s": include_k8s, "ip": ip, "limit": limit, - "metadata_kv": metadata_kv, - "metadata_v": metadata_v, "name": name, "offset": offset, "only_isolated": only_isolated, @@ -664,6 +662,8 @@ def list( "profile_name": profile_name, "protection_status": protection_status, "status": status, + "tag_key_value": tag_key_value, + "tag_value": tag_value, "type_ddos_profile": type_ddos_profile, "uuid": uuid, "with_ddos": with_ddos, diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 8267f5d1..51e28b39 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -74,7 +74,7 @@ def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -108,8 +108,8 @@ def create( access: '#/components/schemas/CreateStandardFileShareSerializer/properties/access' "$.components.schemas.CreateStandardFileShareSerializer.properties.access" - metadata: '#/components/schemas/CreateStandardFileShareSerializer/properties/metadata' - "$.components.schemas.CreateStandardFileShareSerializer.properties.metadata" + tags: '#/components/schemas/CreateStandardFileShareSerializer/properties/tags' + "$.components.schemas.CreateStandardFileShareSerializer.properties.tags" volume_type: '#/components/schemas/CreateStandardFileShareSerializer/properties/volume_type' "$.components.schemas.CreateStandardFileShareSerializer.properties.volume_type" @@ -134,7 +134,7 @@ def create( protocol: Literal["NFS"], size: int, volume_type: Literal["vast_share_type"], - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -164,8 +164,8 @@ def create( volume_type: '#/components/schemas/CreateVastFileShareSerializer/properties/volume_type' "$.components.schemas.CreateVastFileShareSerializer.properties.volume_type" - metadata: '#/components/schemas/CreateVastFileShareSerializer/properties/metadata' - "$.components.schemas.CreateVastFileShareSerializer.properties.metadata" + tags: '#/components/schemas/CreateVastFileShareSerializer/properties/tags' + "$.components.schemas.CreateVastFileShareSerializer.properties.tags" extra_headers: Send extra headers @@ -188,7 +188,7 @@ def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -210,7 +210,7 @@ def create( "protocol": protocol, "size": size, "access": access, - "metadata": metadata, + "tags": tags, "volume_type": volume_type, }, file_share_create_params.FileShareCreateParams, @@ -520,7 +520,7 @@ async def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -554,8 +554,8 @@ async def create( access: '#/components/schemas/CreateStandardFileShareSerializer/properties/access' "$.components.schemas.CreateStandardFileShareSerializer.properties.access" - metadata: '#/components/schemas/CreateStandardFileShareSerializer/properties/metadata' - "$.components.schemas.CreateStandardFileShareSerializer.properties.metadata" + tags: '#/components/schemas/CreateStandardFileShareSerializer/properties/tags' + "$.components.schemas.CreateStandardFileShareSerializer.properties.tags" volume_type: '#/components/schemas/CreateStandardFileShareSerializer/properties/volume_type' "$.components.schemas.CreateStandardFileShareSerializer.properties.volume_type" @@ -580,7 +580,7 @@ async def create( protocol: Literal["NFS"], size: int, volume_type: Literal["vast_share_type"], - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -610,8 +610,8 @@ async def create( volume_type: '#/components/schemas/CreateVastFileShareSerializer/properties/volume_type' "$.components.schemas.CreateVastFileShareSerializer.properties.volume_type" - metadata: '#/components/schemas/CreateVastFileShareSerializer/properties/metadata' - "$.components.schemas.CreateVastFileShareSerializer.properties.metadata" + tags: '#/components/schemas/CreateVastFileShareSerializer/properties/tags' + "$.components.schemas.CreateVastFileShareSerializer.properties.tags" extra_headers: Send extra headers @@ -634,7 +634,7 @@ async def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -656,7 +656,7 @@ async def create( "protocol": protocol, "size": size, "access": access, - "metadata": metadata, + "tags": tags, "volume_type": volume_type, }, file_share_create_params.FileShareCreateParams, diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 356d353a..2b52d36d 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -52,8 +52,8 @@ def create( project_id: int | None = None, region_id: int | None = None, fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, port_id: Optional[str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -74,12 +74,12 @@ def create( fixed_ip_address: '#/components/schemas/CreateFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' "$.components.schemas.CreateFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" - metadata: '#/components/schemas/CreateFloatingIPSerializer/properties/metadata' - "$.components.schemas.CreateFloatingIPSerializer.properties.metadata" - port_id: '#/components/schemas/CreateFloatingIPSerializer/properties/port_id/anyOf/0' "$.components.schemas.CreateFloatingIPSerializer.properties.port_id.anyOf[0]" + tags: '#/components/schemas/CreateFloatingIPSerializer/properties/tags' + "$.components.schemas.CreateFloatingIPSerializer.properties.tags" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -97,8 +97,8 @@ def create( body=maybe_transform( { "fixed_ip_address": fixed_ip_address, - "metadata": metadata, "port_id": port_id, + "tags": tags, }, floating_ip_create_params.FloatingIPCreateParams, ), @@ -114,9 +114,9 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, - metadata_k: List[str] | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -137,13 +137,13 @@ def list( limit: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[2]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + offset: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[3]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + tag_key: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[4]" - offset: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[5]" extra_headers: Send extra headers @@ -169,9 +169,9 @@ def list( query=maybe_transform( { "limit": limit, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "offset": offset, + "tag_key": tag_key, + "tag_key_value": tag_key_value, }, floating_ip_list_params.FloatingIPListParams, ), @@ -413,8 +413,8 @@ async def create( project_id: int | None = None, region_id: int | None = None, fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, port_id: Optional[str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -435,12 +435,12 @@ async def create( fixed_ip_address: '#/components/schemas/CreateFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' "$.components.schemas.CreateFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" - metadata: '#/components/schemas/CreateFloatingIPSerializer/properties/metadata' - "$.components.schemas.CreateFloatingIPSerializer.properties.metadata" - port_id: '#/components/schemas/CreateFloatingIPSerializer/properties/port_id/anyOf/0' "$.components.schemas.CreateFloatingIPSerializer.properties.port_id.anyOf[0]" + tags: '#/components/schemas/CreateFloatingIPSerializer/properties/tags' + "$.components.schemas.CreateFloatingIPSerializer.properties.tags" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -458,8 +458,8 @@ async def create( body=await async_maybe_transform( { "fixed_ip_address": fixed_ip_address, - "metadata": metadata, "port_id": port_id, + "tags": tags, }, floating_ip_create_params.FloatingIPCreateParams, ), @@ -475,9 +475,9 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, - metadata_k: List[str] | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -498,13 +498,13 @@ def list( limit: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[2]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + offset: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[3]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + tag_key: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[4]" - offset: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[5]" extra_headers: Send extra headers @@ -530,9 +530,9 @@ def list( query=maybe_transform( { "limit": limit, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "offset": offset, + "tag_key": tag_key, + "tag_key_value": tag_key_value, }, floating_ip_list_params.FloatingIPListParams, ), diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index f1f9524e..fca48674 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, List, Optional from typing_extensions import Literal import httpx @@ -18,7 +18,6 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.cloud.image import Image from ....types.cloud.instances import ( image_get_params, image_list_params, @@ -26,8 +25,10 @@ image_upload_params, image_create_from_volume_params, ) -from ....types.cloud.image_list import ImageList from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.instances.image_get_response import ImageGetResponse +from ....types.cloud.instances.image_list_response import ImageListResponse +from ....types.cloud.instances.image_update_response import ImageUpdateResponse __all__ = ["ImagesResource", "AsyncImagesResource"] @@ -59,19 +60,19 @@ def update( project_id: int | None = None, region_id: int | None = None, hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, - hw_machine_type: Literal["i440", "q35"] | NotGiven = NOT_GIVEN, - is_baremetal: Optional[bool] | NotGiven = NOT_GIVEN, - metadata: object | NotGiven = NOT_GIVEN, + hw_machine_type: Literal["pc", "q35"] | NotGiven = NOT_GIVEN, + is_baremetal: bool | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Image: + ) -> ImageUpdateResponse: """ Update image fields @@ -85,26 +86,26 @@ def update( image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/2/schema' "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[2].schema" - hw_firmware_type: '#/components/schemas/UpdateImageSchema/properties/hw_firmware_type' - "$.components.schemas.UpdateImageSchema.properties.hw_firmware_type" + hw_firmware_type: '#/components/schemas/UpdateImageSerializer/properties/hw_firmware_type' + "$.components.schemas.UpdateImageSerializer.properties.hw_firmware_type" - hw_machine_type: '#/components/schemas/UpdateImageSchema/properties/hw_machine_type' - "$.components.schemas.UpdateImageSchema.properties.hw_machine_type" + hw_machine_type: '#/components/schemas/UpdateImageSerializer/properties/hw_machine_type' + "$.components.schemas.UpdateImageSerializer.properties.hw_machine_type" - is_baremetal: '#/components/schemas/UpdateImageSchema/properties/is_baremetal' - "$.components.schemas.UpdateImageSchema.properties.is_baremetal" + is_baremetal: '#/components/schemas/UpdateImageSerializer/properties/is_baremetal' + "$.components.schemas.UpdateImageSerializer.properties.is_baremetal" - metadata: '#/components/schemas/UpdateImageSchema/properties/metadata' - "$.components.schemas.UpdateImageSchema.properties.metadata" + name: '#/components/schemas/UpdateImageSerializer/properties/name' + "$.components.schemas.UpdateImageSerializer.properties.name" - name: '#/components/schemas/UpdateImageSchema/properties/name' - "$.components.schemas.UpdateImageSchema.properties.name" + os_type: '#/components/schemas/UpdateImageSerializer/properties/os_type' + "$.components.schemas.UpdateImageSerializer.properties.os_type" - os_type: '#/components/schemas/UpdateImageSchema/properties/os_type' - "$.components.schemas.UpdateImageSchema.properties.os_type" + ssh_key: '#/components/schemas/UpdateImageSerializer/properties/ssh_key' + "$.components.schemas.UpdateImageSerializer.properties.ssh_key" - ssh_key: '#/components/schemas/UpdateImageSchema/properties/ssh_key' - "$.components.schemas.UpdateImageSchema.properties.ssh_key" + tags: '#/components/schemas/UpdateImageSerializer/properties/tags' + "$.components.schemas.UpdateImageSerializer.properties.tags" extra_headers: Send extra headers @@ -127,17 +128,17 @@ def update( "hw_firmware_type": hw_firmware_type, "hw_machine_type": hw_machine_type, "is_baremetal": is_baremetal, - "metadata": metadata, "name": name, "os_type": os_type, "ssh_key": ssh_key, + "tags": tags, }, image_update_params.ImageUpdateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Image, + cast_to=ImageUpdateResponse, ) def list( @@ -146,9 +147,9 @@ def list( project_id: int | None = None, region_id: int | None = None, include_prices: bool | NotGiven = NOT_GIVEN, - metadata_k: str | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, private: str | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -156,7 +157,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageList: + ) -> ImageListResponse: """Retrieve an available images list. Returned entities owned by the project and @@ -172,13 +173,13 @@ def list( include_prices: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[2]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + private: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[3]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + tag_key: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[4]" - private: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[5]" visibility: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' @@ -206,15 +207,15 @@ def list( query=maybe_transform( { "include_prices": include_prices, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "private": private, + "tag_key": tag_key, + "tag_key_value": tag_key_value, "visibility": visibility, }, image_list_params.ImageListParams, ), ), - cast_to=ImageList, + cast_to=ImageListResponse, ) def delete( @@ -273,13 +274,13 @@ def create_from_volume( name: str, volume_id: str, architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, - hw_machine_type: Literal["i440", "q35"] | NotGiven = NOT_GIVEN, - is_baremetal: Optional[bool] | NotGiven = NOT_GIVEN, - metadata: object | NotGiven = NOT_GIVEN, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, + hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, + is_baremetal: bool | NotGiven = NOT_GIVEN, os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - source: str | NotGiven = NOT_GIVEN, + source: Literal["volume"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -288,7 +289,7 @@ def create_from_volume( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create image + Create image from volume Args: project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' @@ -297,35 +298,35 @@ def create_from_volume( region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[1].schema" - name: '#/components/schemas/ImageCreateSchema/properties/name' - "$.components.schemas.ImageCreateSchema.properties.name" + name: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/name' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.name" - volume_id: '#/components/schemas/ImageCreateSchema/properties/volume_id' - "$.components.schemas.ImageCreateSchema.properties.volume_id" + volume_id: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/volume_id' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.volume_id" - architecture: '#/components/schemas/ImageCreateSchema/properties/architecture' - "$.components.schemas.ImageCreateSchema.properties.architecture" + architecture: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/architecture' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.architecture" - hw_firmware_type: '#/components/schemas/ImageCreateSchema/properties/hw_firmware_type' - "$.components.schemas.ImageCreateSchema.properties.hw_firmware_type" + hw_firmware_type: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.hw_firmware_type.anyOf[0]" - hw_machine_type: '#/components/schemas/ImageCreateSchema/properties/hw_machine_type' - "$.components.schemas.ImageCreateSchema.properties.hw_machine_type" + hw_machine_type: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/hw_machine_type/anyOf/0' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.hw_machine_type.anyOf[0]" - is_baremetal: '#/components/schemas/ImageCreateSchema/properties/is_baremetal' - "$.components.schemas.ImageCreateSchema.properties.is_baremetal" + is_baremetal: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/is_baremetal' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.is_baremetal" - metadata: '#/components/schemas/ImageCreateSchema/properties/metadata' - "$.components.schemas.ImageCreateSchema.properties.metadata" + os_type: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/os_type' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.os_type" - os_type: '#/components/schemas/ImageCreateSchema/properties/os_type' - "$.components.schemas.ImageCreateSchema.properties.os_type" + source: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/source' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.source" - source: '#/components/schemas/ImageCreateSchema/properties/source' - "$.components.schemas.ImageCreateSchema.properties.source" + ssh_key: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/ssh_key' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.ssh_key" - ssh_key: '#/components/schemas/ImageCreateSchema/properties/ssh_key' - "$.components.schemas.ImageCreateSchema.properties.ssh_key" + tags: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/tags' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.tags" extra_headers: Send extra headers @@ -349,10 +350,10 @@ def create_from_volume( "hw_firmware_type": hw_firmware_type, "hw_machine_type": hw_machine_type, "is_baremetal": is_baremetal, - "metadata": metadata, "os_type": os_type, "source": source, "ssh_key": ssh_key, + "tags": tags, }, image_create_from_volume_params.ImageCreateFromVolumeParams, ), @@ -369,17 +370,13 @@ def get( project_id: int | None = None, region_id: int | None = None, include_prices: bool | NotGiven = NOT_GIVEN, - metadata_k: str | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, - private: str | NotGiven = NOT_GIVEN, - visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Image: + ) -> ImageGetResponse: """ Get image @@ -396,18 +393,6 @@ def get( include_prices: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/3' "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[3]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/4' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[4]" - - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/5' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[5]" - - private: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/6' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[6]" - - visibility: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/7' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[7]" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -429,18 +414,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform( - { - "include_prices": include_prices, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, - "private": private, - "visibility": visibility, - }, - image_get_params.ImageGetParams, - ), + query=maybe_transform({"include_prices": include_prices}, image_get_params.ImageGetParams), ), - cast_to=Image, + cast_to=ImageGetResponse, ) def upload( @@ -452,14 +428,14 @@ def upload( url: str, architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, - hw_machine_type: Literal["i440", "q35"] | NotGiven = NOT_GIVEN, - is_baremetal: Optional[bool] | NotGiven = NOT_GIVEN, - metadata: object | NotGiven = NOT_GIVEN, - os_distro: str | NotGiven = NOT_GIVEN, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, + hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, + is_baremetal: bool | NotGiven = NOT_GIVEN, + os_distro: Optional[str] | NotGiven = NOT_GIVEN, os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - os_version: str | NotGiven = NOT_GIVEN, + os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -477,41 +453,41 @@ def upload( region_id: '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[1].schema" - name: '#/components/schemas/ImageDownloadSchema/properties/name' - "$.components.schemas.ImageDownloadSchema.properties.name" + name: '#/components/schemas/ImageDownloadSerializer/properties/name' + "$.components.schemas.ImageDownloadSerializer.properties.name" - url: '#/components/schemas/ImageDownloadSchema/properties/url' - "$.components.schemas.ImageDownloadSchema.properties.url" + url: '#/components/schemas/ImageDownloadSerializer/properties/url' + "$.components.schemas.ImageDownloadSerializer.properties.url" - architecture: '#/components/schemas/ImageDownloadSchema/properties/architecture' - "$.components.schemas.ImageDownloadSchema.properties.architecture" + architecture: '#/components/schemas/ImageDownloadSerializer/properties/architecture' + "$.components.schemas.ImageDownloadSerializer.properties.architecture" - cow_format: '#/components/schemas/ImageDownloadSchema/properties/cow_format' - "$.components.schemas.ImageDownloadSchema.properties.cow_format" + cow_format: '#/components/schemas/ImageDownloadSerializer/properties/cow_format' + "$.components.schemas.ImageDownloadSerializer.properties.cow_format" - hw_firmware_type: '#/components/schemas/ImageDownloadSchema/properties/hw_firmware_type' - "$.components.schemas.ImageDownloadSchema.properties.hw_firmware_type" + hw_firmware_type: '#/components/schemas/ImageDownloadSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.ImageDownloadSerializer.properties.hw_firmware_type.anyOf[0]" - hw_machine_type: '#/components/schemas/ImageDownloadSchema/properties/hw_machine_type' - "$.components.schemas.ImageDownloadSchema.properties.hw_machine_type" + hw_machine_type: '#/components/schemas/ImageDownloadSerializer/properties/hw_machine_type/anyOf/0' + "$.components.schemas.ImageDownloadSerializer.properties.hw_machine_type.anyOf[0]" - is_baremetal: '#/components/schemas/ImageDownloadSchema/properties/is_baremetal' - "$.components.schemas.ImageDownloadSchema.properties.is_baremetal" + is_baremetal: '#/components/schemas/ImageDownloadSerializer/properties/is_baremetal' + "$.components.schemas.ImageDownloadSerializer.properties.is_baremetal" - metadata: '#/components/schemas/ImageDownloadSchema/properties/metadata' - "$.components.schemas.ImageDownloadSchema.properties.metadata" + os_distro: '#/components/schemas/ImageDownloadSerializer/properties/os_distro/anyOf/0' + "$.components.schemas.ImageDownloadSerializer.properties.os_distro.anyOf[0]" - os_distro: '#/components/schemas/ImageDownloadSchema/properties/os_distro' - "$.components.schemas.ImageDownloadSchema.properties.os_distro" + os_type: '#/components/schemas/ImageDownloadSerializer/properties/os_type' + "$.components.schemas.ImageDownloadSerializer.properties.os_type" - os_type: '#/components/schemas/ImageDownloadSchema/properties/os_type' - "$.components.schemas.ImageDownloadSchema.properties.os_type" + os_version: '#/components/schemas/ImageDownloadSerializer/properties/os_version/anyOf/0' + "$.components.schemas.ImageDownloadSerializer.properties.os_version.anyOf[0]" - os_version: '#/components/schemas/ImageDownloadSchema/properties/os_version' - "$.components.schemas.ImageDownloadSchema.properties.os_version" + ssh_key: '#/components/schemas/ImageDownloadSerializer/properties/ssh_key' + "$.components.schemas.ImageDownloadSerializer.properties.ssh_key" - ssh_key: '#/components/schemas/ImageDownloadSchema/properties/ssh_key' - "$.components.schemas.ImageDownloadSchema.properties.ssh_key" + tags: '#/components/schemas/ImageDownloadSerializer/properties/tags' + "$.components.schemas.ImageDownloadSerializer.properties.tags" extra_headers: Send extra headers @@ -536,11 +512,11 @@ def upload( "hw_firmware_type": hw_firmware_type, "hw_machine_type": hw_machine_type, "is_baremetal": is_baremetal, - "metadata": metadata, "os_distro": os_distro, "os_type": os_type, "os_version": os_version, "ssh_key": ssh_key, + "tags": tags, }, image_upload_params.ImageUploadParams, ), @@ -578,19 +554,19 @@ async def update( project_id: int | None = None, region_id: int | None = None, hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, - hw_machine_type: Literal["i440", "q35"] | NotGiven = NOT_GIVEN, - is_baremetal: Optional[bool] | NotGiven = NOT_GIVEN, - metadata: object | NotGiven = NOT_GIVEN, + hw_machine_type: Literal["pc", "q35"] | NotGiven = NOT_GIVEN, + is_baremetal: bool | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Image: + ) -> ImageUpdateResponse: """ Update image fields @@ -604,26 +580,26 @@ async def update( image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/2/schema' "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[2].schema" - hw_firmware_type: '#/components/schemas/UpdateImageSchema/properties/hw_firmware_type' - "$.components.schemas.UpdateImageSchema.properties.hw_firmware_type" + hw_firmware_type: '#/components/schemas/UpdateImageSerializer/properties/hw_firmware_type' + "$.components.schemas.UpdateImageSerializer.properties.hw_firmware_type" - hw_machine_type: '#/components/schemas/UpdateImageSchema/properties/hw_machine_type' - "$.components.schemas.UpdateImageSchema.properties.hw_machine_type" + hw_machine_type: '#/components/schemas/UpdateImageSerializer/properties/hw_machine_type' + "$.components.schemas.UpdateImageSerializer.properties.hw_machine_type" - is_baremetal: '#/components/schemas/UpdateImageSchema/properties/is_baremetal' - "$.components.schemas.UpdateImageSchema.properties.is_baremetal" + is_baremetal: '#/components/schemas/UpdateImageSerializer/properties/is_baremetal' + "$.components.schemas.UpdateImageSerializer.properties.is_baremetal" - metadata: '#/components/schemas/UpdateImageSchema/properties/metadata' - "$.components.schemas.UpdateImageSchema.properties.metadata" + name: '#/components/schemas/UpdateImageSerializer/properties/name' + "$.components.schemas.UpdateImageSerializer.properties.name" - name: '#/components/schemas/UpdateImageSchema/properties/name' - "$.components.schemas.UpdateImageSchema.properties.name" + os_type: '#/components/schemas/UpdateImageSerializer/properties/os_type' + "$.components.schemas.UpdateImageSerializer.properties.os_type" - os_type: '#/components/schemas/UpdateImageSchema/properties/os_type' - "$.components.schemas.UpdateImageSchema.properties.os_type" + ssh_key: '#/components/schemas/UpdateImageSerializer/properties/ssh_key' + "$.components.schemas.UpdateImageSerializer.properties.ssh_key" - ssh_key: '#/components/schemas/UpdateImageSchema/properties/ssh_key' - "$.components.schemas.UpdateImageSchema.properties.ssh_key" + tags: '#/components/schemas/UpdateImageSerializer/properties/tags' + "$.components.schemas.UpdateImageSerializer.properties.tags" extra_headers: Send extra headers @@ -646,17 +622,17 @@ async def update( "hw_firmware_type": hw_firmware_type, "hw_machine_type": hw_machine_type, "is_baremetal": is_baremetal, - "metadata": metadata, "name": name, "os_type": os_type, "ssh_key": ssh_key, + "tags": tags, }, image_update_params.ImageUpdateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Image, + cast_to=ImageUpdateResponse, ) async def list( @@ -665,9 +641,9 @@ async def list( project_id: int | None = None, region_id: int | None = None, include_prices: bool | NotGiven = NOT_GIVEN, - metadata_k: str | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, private: str | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -675,7 +651,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageList: + ) -> ImageListResponse: """Retrieve an available images list. Returned entities owned by the project and @@ -691,13 +667,13 @@ async def list( include_prices: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[2]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + private: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[3]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + tag_key: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[4]" - private: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[5]" visibility: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' @@ -725,15 +701,15 @@ async def list( query=await async_maybe_transform( { "include_prices": include_prices, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "private": private, + "tag_key": tag_key, + "tag_key_value": tag_key_value, "visibility": visibility, }, image_list_params.ImageListParams, ), ), - cast_to=ImageList, + cast_to=ImageListResponse, ) async def delete( @@ -792,13 +768,13 @@ async def create_from_volume( name: str, volume_id: str, architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, - hw_machine_type: Literal["i440", "q35"] | NotGiven = NOT_GIVEN, - is_baremetal: Optional[bool] | NotGiven = NOT_GIVEN, - metadata: object | NotGiven = NOT_GIVEN, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, + hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, + is_baremetal: bool | NotGiven = NOT_GIVEN, os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - source: str | NotGiven = NOT_GIVEN, + source: Literal["volume"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -807,7 +783,7 @@ async def create_from_volume( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create image + Create image from volume Args: project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' @@ -816,35 +792,35 @@ async def create_from_volume( region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[1].schema" - name: '#/components/schemas/ImageCreateSchema/properties/name' - "$.components.schemas.ImageCreateSchema.properties.name" + name: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/name' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.name" - volume_id: '#/components/schemas/ImageCreateSchema/properties/volume_id' - "$.components.schemas.ImageCreateSchema.properties.volume_id" + volume_id: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/volume_id' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.volume_id" - architecture: '#/components/schemas/ImageCreateSchema/properties/architecture' - "$.components.schemas.ImageCreateSchema.properties.architecture" + architecture: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/architecture' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.architecture" - hw_firmware_type: '#/components/schemas/ImageCreateSchema/properties/hw_firmware_type' - "$.components.schemas.ImageCreateSchema.properties.hw_firmware_type" + hw_firmware_type: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.hw_firmware_type.anyOf[0]" - hw_machine_type: '#/components/schemas/ImageCreateSchema/properties/hw_machine_type' - "$.components.schemas.ImageCreateSchema.properties.hw_machine_type" + hw_machine_type: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/hw_machine_type/anyOf/0' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.hw_machine_type.anyOf[0]" - is_baremetal: '#/components/schemas/ImageCreateSchema/properties/is_baremetal' - "$.components.schemas.ImageCreateSchema.properties.is_baremetal" + is_baremetal: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/is_baremetal' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.is_baremetal" - metadata: '#/components/schemas/ImageCreateSchema/properties/metadata' - "$.components.schemas.ImageCreateSchema.properties.metadata" + os_type: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/os_type' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.os_type" - os_type: '#/components/schemas/ImageCreateSchema/properties/os_type' - "$.components.schemas.ImageCreateSchema.properties.os_type" + source: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/source' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.source" - source: '#/components/schemas/ImageCreateSchema/properties/source' - "$.components.schemas.ImageCreateSchema.properties.source" + ssh_key: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/ssh_key' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.ssh_key" - ssh_key: '#/components/schemas/ImageCreateSchema/properties/ssh_key' - "$.components.schemas.ImageCreateSchema.properties.ssh_key" + tags: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/tags' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.tags" extra_headers: Send extra headers @@ -868,10 +844,10 @@ async def create_from_volume( "hw_firmware_type": hw_firmware_type, "hw_machine_type": hw_machine_type, "is_baremetal": is_baremetal, - "metadata": metadata, "os_type": os_type, "source": source, "ssh_key": ssh_key, + "tags": tags, }, image_create_from_volume_params.ImageCreateFromVolumeParams, ), @@ -888,17 +864,13 @@ async def get( project_id: int | None = None, region_id: int | None = None, include_prices: bool | NotGiven = NOT_GIVEN, - metadata_k: str | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, - private: str | NotGiven = NOT_GIVEN, - visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Image: + ) -> ImageGetResponse: """ Get image @@ -915,18 +887,6 @@ async def get( include_prices: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/3' "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[3]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/4' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[4]" - - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/5' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[5]" - - private: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/6' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[6]" - - visibility: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/7' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[7]" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -948,18 +908,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( - { - "include_prices": include_prices, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, - "private": private, - "visibility": visibility, - }, - image_get_params.ImageGetParams, - ), + query=await async_maybe_transform({"include_prices": include_prices}, image_get_params.ImageGetParams), ), - cast_to=Image, + cast_to=ImageGetResponse, ) async def upload( @@ -971,14 +922,14 @@ async def upload( url: str, architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, - hw_machine_type: Literal["i440", "q35"] | NotGiven = NOT_GIVEN, - is_baremetal: Optional[bool] | NotGiven = NOT_GIVEN, - metadata: object | NotGiven = NOT_GIVEN, - os_distro: str | NotGiven = NOT_GIVEN, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, + hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, + is_baremetal: bool | NotGiven = NOT_GIVEN, + os_distro: Optional[str] | NotGiven = NOT_GIVEN, os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - os_version: str | NotGiven = NOT_GIVEN, + os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -996,41 +947,41 @@ async def upload( region_id: '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[1].schema" - name: '#/components/schemas/ImageDownloadSchema/properties/name' - "$.components.schemas.ImageDownloadSchema.properties.name" + name: '#/components/schemas/ImageDownloadSerializer/properties/name' + "$.components.schemas.ImageDownloadSerializer.properties.name" - url: '#/components/schemas/ImageDownloadSchema/properties/url' - "$.components.schemas.ImageDownloadSchema.properties.url" + url: '#/components/schemas/ImageDownloadSerializer/properties/url' + "$.components.schemas.ImageDownloadSerializer.properties.url" - architecture: '#/components/schemas/ImageDownloadSchema/properties/architecture' - "$.components.schemas.ImageDownloadSchema.properties.architecture" + architecture: '#/components/schemas/ImageDownloadSerializer/properties/architecture' + "$.components.schemas.ImageDownloadSerializer.properties.architecture" - cow_format: '#/components/schemas/ImageDownloadSchema/properties/cow_format' - "$.components.schemas.ImageDownloadSchema.properties.cow_format" + cow_format: '#/components/schemas/ImageDownloadSerializer/properties/cow_format' + "$.components.schemas.ImageDownloadSerializer.properties.cow_format" - hw_firmware_type: '#/components/schemas/ImageDownloadSchema/properties/hw_firmware_type' - "$.components.schemas.ImageDownloadSchema.properties.hw_firmware_type" + hw_firmware_type: '#/components/schemas/ImageDownloadSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.ImageDownloadSerializer.properties.hw_firmware_type.anyOf[0]" - hw_machine_type: '#/components/schemas/ImageDownloadSchema/properties/hw_machine_type' - "$.components.schemas.ImageDownloadSchema.properties.hw_machine_type" + hw_machine_type: '#/components/schemas/ImageDownloadSerializer/properties/hw_machine_type/anyOf/0' + "$.components.schemas.ImageDownloadSerializer.properties.hw_machine_type.anyOf[0]" - is_baremetal: '#/components/schemas/ImageDownloadSchema/properties/is_baremetal' - "$.components.schemas.ImageDownloadSchema.properties.is_baremetal" + is_baremetal: '#/components/schemas/ImageDownloadSerializer/properties/is_baremetal' + "$.components.schemas.ImageDownloadSerializer.properties.is_baremetal" - metadata: '#/components/schemas/ImageDownloadSchema/properties/metadata' - "$.components.schemas.ImageDownloadSchema.properties.metadata" + os_distro: '#/components/schemas/ImageDownloadSerializer/properties/os_distro/anyOf/0' + "$.components.schemas.ImageDownloadSerializer.properties.os_distro.anyOf[0]" - os_distro: '#/components/schemas/ImageDownloadSchema/properties/os_distro' - "$.components.schemas.ImageDownloadSchema.properties.os_distro" + os_type: '#/components/schemas/ImageDownloadSerializer/properties/os_type' + "$.components.schemas.ImageDownloadSerializer.properties.os_type" - os_type: '#/components/schemas/ImageDownloadSchema/properties/os_type' - "$.components.schemas.ImageDownloadSchema.properties.os_type" + os_version: '#/components/schemas/ImageDownloadSerializer/properties/os_version/anyOf/0' + "$.components.schemas.ImageDownloadSerializer.properties.os_version.anyOf[0]" - os_version: '#/components/schemas/ImageDownloadSchema/properties/os_version' - "$.components.schemas.ImageDownloadSchema.properties.os_version" + ssh_key: '#/components/schemas/ImageDownloadSerializer/properties/ssh_key' + "$.components.schemas.ImageDownloadSerializer.properties.ssh_key" - ssh_key: '#/components/schemas/ImageDownloadSchema/properties/ssh_key' - "$.components.schemas.ImageDownloadSchema.properties.ssh_key" + tags: '#/components/schemas/ImageDownloadSerializer/properties/tags' + "$.components.schemas.ImageDownloadSerializer.properties.tags" extra_headers: Send extra headers @@ -1055,11 +1006,11 @@ async def upload( "hw_firmware_type": hw_firmware_type, "hw_machine_type": hw_machine_type, "is_baremetal": is_baremetal, - "metadata": metadata, "os_distro": os_distro, "os_type": os_type, "os_version": os_version, "ssh_key": ssh_key, + "tags": tags, }, image_upload_params.ImageUploadParams, ), diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 3323bd3c..113ed9cb 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -137,11 +137,10 @@ def create( floating_ip: load_balancer_create_params.FloatingIP | NotGiven = NOT_GIVEN, listeners: Iterable[load_balancer_create_params.Listener] | NotGiven = NOT_GIVEN, logging: load_balancer_create_params.Logging | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, name_template: str | NotGiven = NOT_GIVEN, preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tag: List[str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, vip_network_id: str | NotGiven = NOT_GIVEN, vip_port_id: str | NotGiven = NOT_GIVEN, @@ -175,9 +174,6 @@ def create( logging: '#/components/schemas/CreateLoadbalancerSerializer/properties/logging' "$.components.schemas.CreateLoadbalancerSerializer.properties.logging" - metadata: '#/components/schemas/CreateLoadbalancerSerializer/properties/metadata' - "$.components.schemas.CreateLoadbalancerSerializer.properties.metadata" - name: '#/components/schemas/CreateLoadbalancerSerializer/properties/name' "$.components.schemas.CreateLoadbalancerSerializer.properties.name" @@ -187,8 +183,8 @@ def create( preferred_connectivity: '#/components/schemas/CreateLoadbalancerSerializer/properties/preferred_connectivity' "$.components.schemas.CreateLoadbalancerSerializer.properties.preferred_connectivity" - tag: '#/components/schemas/CreateLoadbalancerSerializer/properties/tag' - "$.components.schemas.CreateLoadbalancerSerializer.properties.tag" + tags: '#/components/schemas/CreateLoadbalancerSerializer/properties/tags' + "$.components.schemas.CreateLoadbalancerSerializer.properties.tags" vip_ip_family: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_ip_family' "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_ip_family" @@ -222,11 +218,10 @@ def create( "floating_ip": floating_ip, "listeners": listeners, "logging": logging, - "metadata": metadata, "name": name, "name_template": name_template, "preferred_connectivity": preferred_connectivity, - "tag": tag, + "tags": tags, "vip_ip_family": vip_ip_family, "vip_network_id": vip_network_id, "vip_port_id": vip_port_id, @@ -317,12 +312,12 @@ def list( assigned_floating: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, logging_enabled: bool | NotGiven = NOT_GIVEN, - metadata_k: str | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: str | NotGiven = NOT_GIVEN, show_stats: bool | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, with_ddos: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -350,22 +345,22 @@ def list( logging_enabled: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[4]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + name: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[5]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + offset: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[6]" - name: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + order_by: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[7]" - offset: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + show_stats: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[8]" - order_by: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + tag_key: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[9]" - show_stats: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[10]" with_ddos: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' @@ -396,12 +391,12 @@ def list( "assigned_floating": assigned_floating, "limit": limit, "logging_enabled": logging_enabled, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "name": name, "offset": offset, "order_by": order_by, "show_stats": show_stats, + "tag_key": tag_key, + "tag_key_value": tag_key_value, "with_ddos": with_ddos, }, load_balancer_list_params.LoadBalancerListParams, @@ -684,11 +679,10 @@ async def create( floating_ip: load_balancer_create_params.FloatingIP | NotGiven = NOT_GIVEN, listeners: Iterable[load_balancer_create_params.Listener] | NotGiven = NOT_GIVEN, logging: load_balancer_create_params.Logging | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, name_template: str | NotGiven = NOT_GIVEN, preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tag: List[str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, vip_network_id: str | NotGiven = NOT_GIVEN, vip_port_id: str | NotGiven = NOT_GIVEN, @@ -722,9 +716,6 @@ async def create( logging: '#/components/schemas/CreateLoadbalancerSerializer/properties/logging' "$.components.schemas.CreateLoadbalancerSerializer.properties.logging" - metadata: '#/components/schemas/CreateLoadbalancerSerializer/properties/metadata' - "$.components.schemas.CreateLoadbalancerSerializer.properties.metadata" - name: '#/components/schemas/CreateLoadbalancerSerializer/properties/name' "$.components.schemas.CreateLoadbalancerSerializer.properties.name" @@ -734,8 +725,8 @@ async def create( preferred_connectivity: '#/components/schemas/CreateLoadbalancerSerializer/properties/preferred_connectivity' "$.components.schemas.CreateLoadbalancerSerializer.properties.preferred_connectivity" - tag: '#/components/schemas/CreateLoadbalancerSerializer/properties/tag' - "$.components.schemas.CreateLoadbalancerSerializer.properties.tag" + tags: '#/components/schemas/CreateLoadbalancerSerializer/properties/tags' + "$.components.schemas.CreateLoadbalancerSerializer.properties.tags" vip_ip_family: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_ip_family' "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_ip_family" @@ -769,11 +760,10 @@ async def create( "floating_ip": floating_ip, "listeners": listeners, "logging": logging, - "metadata": metadata, "name": name, "name_template": name_template, "preferred_connectivity": preferred_connectivity, - "tag": tag, + "tags": tags, "vip_ip_family": vip_ip_family, "vip_network_id": vip_network_id, "vip_port_id": vip_port_id, @@ -864,12 +854,12 @@ def list( assigned_floating: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, logging_enabled: bool | NotGiven = NOT_GIVEN, - metadata_k: str | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: str | NotGiven = NOT_GIVEN, show_stats: bool | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, with_ddos: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -897,22 +887,22 @@ def list( logging_enabled: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[4]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + name: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[5]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + offset: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[6]" - name: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + order_by: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[7]" - offset: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + show_stats: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[8]" - order_by: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + tag_key: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[9]" - show_stats: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[10]" with_ddos: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' @@ -943,12 +933,12 @@ def list( "assigned_floating": assigned_floating, "limit": limit, "logging_enabled": logging_enabled, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "name": name, "offset": offset, "order_by": order_by, "show_stats": show_stats, + "tag_key": tag_key, + "tag_key_value": tag_key_value, "with_ddos": with_ddos, }, load_balancer_list_params.LoadBalancerListParams, diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 792ca50c..84951310 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Dict, List from typing_extensions import Literal import httpx @@ -77,7 +77,7 @@ def create( region_id: int | None = None, name: str, create_router: bool | NotGiven = NOT_GIVEN, - metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -102,8 +102,8 @@ def create( create_router: '#/components/schemas/CreateNetworkSerializer/properties/create_router' "$.components.schemas.CreateNetworkSerializer.properties.create_router" - metadata: '#/components/schemas/CreateNetworkSerializer/properties/metadata/anyOf/0' - "$.components.schemas.CreateNetworkSerializer.properties.metadata.anyOf[0]" + tags: '#/components/schemas/CreateNetworkSerializer/properties/tags' + "$.components.schemas.CreateNetworkSerializer.properties.tags" type: '#/components/schemas/CreateNetworkSerializer/properties/type' "$.components.schemas.CreateNetworkSerializer.properties.type" @@ -126,7 +126,7 @@ def create( { "name": name, "create_router": create_router, - "metadata": metadata, + "tags": tags, "type": type, }, network_create_params.NetworkCreateParams, @@ -196,10 +196,10 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, - metadata_k: str | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: str | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -220,16 +220,16 @@ def list( limit: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[2]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + offset: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[3]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + order_by: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[4]" - offset: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + tag_key: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[5]" - order_by: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[6]" extra_headers: Send extra headers @@ -255,10 +255,10 @@ def list( query=maybe_transform( { "limit": limit, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "offset": offset, "order_by": order_by, + "tag_key": tag_key, + "tag_key_value": tag_key_value, }, network_list_params.NetworkListParams, ), @@ -398,7 +398,7 @@ async def create( region_id: int | None = None, name: str, create_router: bool | NotGiven = NOT_GIVEN, - metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -423,8 +423,8 @@ async def create( create_router: '#/components/schemas/CreateNetworkSerializer/properties/create_router' "$.components.schemas.CreateNetworkSerializer.properties.create_router" - metadata: '#/components/schemas/CreateNetworkSerializer/properties/metadata/anyOf/0' - "$.components.schemas.CreateNetworkSerializer.properties.metadata.anyOf[0]" + tags: '#/components/schemas/CreateNetworkSerializer/properties/tags' + "$.components.schemas.CreateNetworkSerializer.properties.tags" type: '#/components/schemas/CreateNetworkSerializer/properties/type' "$.components.schemas.CreateNetworkSerializer.properties.type" @@ -447,7 +447,7 @@ async def create( { "name": name, "create_router": create_router, - "metadata": metadata, + "tags": tags, "type": type, }, network_create_params.NetworkCreateParams, @@ -517,10 +517,10 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, - metadata_k: str | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: str | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -541,16 +541,16 @@ def list( limit: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[2]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + offset: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[3]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + order_by: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[4]" - offset: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + tag_key: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[5]" - order_by: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[6]" extra_headers: Send extra headers @@ -576,10 +576,10 @@ def list( query=maybe_transform( { "limit": limit, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "offset": offset, "order_by": order_by, + "tag_key": tag_key, + "tag_key_value": tag_key_value, }, network_list_params.NetworkListParams, ), diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 300c0359..9d48a329 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -302,6 +302,7 @@ def attach_subnet( project_id: int | None = None, region_id: int | None = None, subnet_id: str, + ip_address: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -322,8 +323,11 @@ def attach_subnet( router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/2/schema' "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[2].schema" - subnet_id: '#/components/schemas/SubnetIdSerializer/properties/subnet_id' - "$.components.schemas.SubnetIdSerializer.properties.subnet_id" + subnet_id: '#/components/schemas/AddRouterInterfaceSerializer/properties/subnet_id' + "$.components.schemas.AddRouterInterfaceSerializer.properties.subnet_id" + + ip_address: '#/components/schemas/AddRouterInterfaceSerializer/properties/ip_address' + "$.components.schemas.AddRouterInterfaceSerializer.properties.ip_address" extra_headers: Send extra headers @@ -341,7 +345,13 @@ def attach_subnet( raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", - body=maybe_transform({"subnet_id": subnet_id}, router_attach_subnet_params.RouterAttachSubnetParams), + body=maybe_transform( + { + "subnet_id": subnet_id, + "ip_address": ip_address, + }, + router_attach_subnet_params.RouterAttachSubnetParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -721,6 +731,7 @@ async def attach_subnet( project_id: int | None = None, region_id: int | None = None, subnet_id: str, + ip_address: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -741,8 +752,11 @@ async def attach_subnet( router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/2/schema' "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[2].schema" - subnet_id: '#/components/schemas/SubnetIdSerializer/properties/subnet_id' - "$.components.schemas.SubnetIdSerializer.properties.subnet_id" + subnet_id: '#/components/schemas/AddRouterInterfaceSerializer/properties/subnet_id' + "$.components.schemas.AddRouterInterfaceSerializer.properties.subnet_id" + + ip_address: '#/components/schemas/AddRouterInterfaceSerializer/properties/ip_address' + "$.components.schemas.AddRouterInterfaceSerializer.properties.ip_address" extra_headers: Send extra headers @@ -761,7 +775,11 @@ async def attach_subnet( return await self._post( f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=await async_maybe_transform( - {"subnet_id": subnet_id}, router_attach_subnet_params.RouterAttachSubnetParams + { + "subnet_id": subnet_id, + "ip_address": ip_address, + }, + router_attach_subnet_params.RouterAttachSubnetParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 9d02aeb0..b945aca6 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -62,8 +62,8 @@ def create( gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, - metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -108,12 +108,12 @@ def create( ip_version: '#/components/schemas/CreateSubnetSerializer/properties/ip_version' "$.components.schemas.CreateSubnetSerializer.properties.ip_version" - metadata: '#/components/schemas/CreateSubnetSerializer/properties/metadata/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.metadata.anyOf[0]" - router_id_to_connect: '#/components/schemas/CreateSubnetSerializer/properties/router_id_to_connect/anyOf/0' "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" + tags: '#/components/schemas/CreateSubnetSerializer/properties/tags' + "$.components.schemas.CreateSubnetSerializer.properties.tags" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -139,8 +139,8 @@ def create( "gateway_ip": gateway_ip, "host_routes": host_routes, "ip_version": ip_version, - "metadata": metadata, "router_id_to_connect": router_id_to_connect, + "tags": tags, }, subnet_create_params.SubnetCreateParams, ), @@ -234,8 +234,6 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, - metadata_k: List[str] | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, network_id: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: Literal[ @@ -253,6 +251,8 @@ def list( "updated_at.desc", ] | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -273,19 +273,19 @@ def list( limit: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[2]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + network_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[3]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + offset: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[4]" - network_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + order_by: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[5]" - offset: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + tag_key: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[6]" - order_by: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[7]" extra_headers: Send extra headers @@ -311,11 +311,11 @@ def list( query=maybe_transform( { "limit": limit, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "network_id": network_id, "offset": offset, "order_by": order_by, + "tag_key": tag_key, + "tag_key_value": tag_key_value, }, subnet_list_params.SubnetListParams, ), @@ -455,8 +455,8 @@ async def create( gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, - metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -501,12 +501,12 @@ async def create( ip_version: '#/components/schemas/CreateSubnetSerializer/properties/ip_version' "$.components.schemas.CreateSubnetSerializer.properties.ip_version" - metadata: '#/components/schemas/CreateSubnetSerializer/properties/metadata/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.metadata.anyOf[0]" - router_id_to_connect: '#/components/schemas/CreateSubnetSerializer/properties/router_id_to_connect/anyOf/0' "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" + tags: '#/components/schemas/CreateSubnetSerializer/properties/tags' + "$.components.schemas.CreateSubnetSerializer.properties.tags" + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -532,8 +532,8 @@ async def create( "gateway_ip": gateway_ip, "host_routes": host_routes, "ip_version": ip_version, - "metadata": metadata, "router_id_to_connect": router_id_to_connect, + "tags": tags, }, subnet_create_params.SubnetCreateParams, ), @@ -627,8 +627,6 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, - metadata_k: List[str] | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, network_id: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: Literal[ @@ -646,6 +644,8 @@ def list( "updated_at.desc", ] | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -666,19 +666,19 @@ def list( limit: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[2]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + network_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[3]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + offset: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[4]" - network_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + order_by: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[5]" - offset: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + tag_key: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[6]" - order_by: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[7]" extra_headers: Send extra headers @@ -704,11 +704,11 @@ def list( query=maybe_transform( { "limit": limit, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "network_id": network_id, "offset": offset, "order_by": order_by, + "tag_key": tag_key, + "tag_key_value": tag_key_value, }, subnet_list_params.SubnetListParams, ), diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 6bf15902..57bfacfa 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -187,9 +187,9 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, - metadata_k: str | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -210,13 +210,13 @@ def list( limit: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[2]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + offset: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[3]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + tag_key: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[4]" - offset: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[5]" extra_headers: Send extra headers @@ -242,9 +242,9 @@ def list( query=maybe_transform( { "limit": limit, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "offset": offset, + "tag_key": tag_key, + "tag_key_value": tag_key_value, }, security_group_list_params.SecurityGroupListParams, ), @@ -602,9 +602,9 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, - metadata_k: str | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -625,13 +625,13 @@ def list( limit: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[2]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + offset: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[3]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + tag_key: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[4]" - offset: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[5]" extra_headers: Send extra headers @@ -657,9 +657,9 @@ def list( query=maybe_transform( { "limit": limit, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "offset": offset, + "tag_key": tag_key, + "tag_key_value": tag_key_value, }, security_group_list_params.SecurityGroupListParams, ), diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 0b3a34f4..3dcbae5a 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -68,7 +68,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -109,8 +109,8 @@ def create( lifecycle_policy_ids: '#/components/schemas/CreateVolumeFromImageSerializer/properties/lifecycle_policy_ids' "$.components.schemas.CreateVolumeFromImageSerializer.properties.lifecycle_policy_ids" - metadata: '#/components/schemas/CreateVolumeFromImageSerializer/properties/metadata' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.metadata" + tags: '#/components/schemas/CreateVolumeFromImageSerializer/properties/tags' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.tags" type_name: '#/components/schemas/CreateVolumeFromImageSerializer/properties/type_name' "$.components.schemas.CreateVolumeFromImageSerializer.properties.type_name" @@ -137,8 +137,8 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -176,12 +176,12 @@ def create( lifecycle_policy_ids: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/lifecycle_policy_ids' "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.lifecycle_policy_ids" - metadata: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/metadata' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.metadata" - size: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/size' "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.size" + tags: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/tags' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.tags" + type_name: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/type_name' "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.type_name" @@ -207,7 +207,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -245,8 +245,8 @@ def create( lifecycle_policy_ids: '#/components/schemas/CreateNewVolumeSerializer/properties/lifecycle_policy_ids' "$.components.schemas.CreateNewVolumeSerializer.properties.lifecycle_policy_ids" - metadata: '#/components/schemas/CreateNewVolumeSerializer/properties/metadata' - "$.components.schemas.CreateNewVolumeSerializer.properties.metadata" + tags: '#/components/schemas/CreateNewVolumeSerializer/properties/tags' + "$.components.schemas.CreateNewVolumeSerializer.properties.tags" type_name: '#/components/schemas/CreateNewVolumeSerializer/properties/type_name' "$.components.schemas.CreateNewVolumeSerializer.properties.type_name" @@ -276,7 +276,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, snapshot_id: str | NotGiven = NOT_GIVEN, @@ -302,7 +302,7 @@ def create( "attachment_tag": attachment_tag, "instance_id_to_attach_to": instance_id_to_attach_to, "lifecycle_policy_ids": lifecycle_policy_ids, - "metadata": metadata, + "tags": tags, "type_name": type_name, "snapshot_id": snapshot_id, }, @@ -378,10 +378,10 @@ def list( id_part: str | NotGiven = NOT_GIVEN, instance_id: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, - metadata_k: List[str] | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, name_part: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -417,16 +417,16 @@ def list( limit: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[7]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + name_part: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[8]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + offset: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[9]" - name_part: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + tag_key: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[10]" - offset: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[11]" extra_headers: Send extra headers @@ -457,10 +457,10 @@ def list( "id_part": id_part, "instance_id": instance_id, "limit": limit, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "name_part": name_part, "offset": offset, + "tag_key": tag_key, + "tag_key_value": tag_key_value, }, volume_list_params.VolumeListParams, ), @@ -881,7 +881,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -922,8 +922,8 @@ async def create( lifecycle_policy_ids: '#/components/schemas/CreateVolumeFromImageSerializer/properties/lifecycle_policy_ids' "$.components.schemas.CreateVolumeFromImageSerializer.properties.lifecycle_policy_ids" - metadata: '#/components/schemas/CreateVolumeFromImageSerializer/properties/metadata' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.metadata" + tags: '#/components/schemas/CreateVolumeFromImageSerializer/properties/tags' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.tags" type_name: '#/components/schemas/CreateVolumeFromImageSerializer/properties/type_name' "$.components.schemas.CreateVolumeFromImageSerializer.properties.type_name" @@ -950,8 +950,8 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -989,12 +989,12 @@ async def create( lifecycle_policy_ids: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/lifecycle_policy_ids' "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.lifecycle_policy_ids" - metadata: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/metadata' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.metadata" - size: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/size' "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.size" + tags: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/tags' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.tags" + type_name: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/type_name' "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.type_name" @@ -1020,7 +1020,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1058,8 +1058,8 @@ async def create( lifecycle_policy_ids: '#/components/schemas/CreateNewVolumeSerializer/properties/lifecycle_policy_ids' "$.components.schemas.CreateNewVolumeSerializer.properties.lifecycle_policy_ids" - metadata: '#/components/schemas/CreateNewVolumeSerializer/properties/metadata' - "$.components.schemas.CreateNewVolumeSerializer.properties.metadata" + tags: '#/components/schemas/CreateNewVolumeSerializer/properties/tags' + "$.components.schemas.CreateNewVolumeSerializer.properties.tags" type_name: '#/components/schemas/CreateNewVolumeSerializer/properties/type_name' "$.components.schemas.CreateNewVolumeSerializer.properties.type_name" @@ -1089,7 +1089,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - metadata: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, snapshot_id: str | NotGiven = NOT_GIVEN, @@ -1115,7 +1115,7 @@ async def create( "attachment_tag": attachment_tag, "instance_id_to_attach_to": instance_id_to_attach_to, "lifecycle_policy_ids": lifecycle_policy_ids, - "metadata": metadata, + "tags": tags, "type_name": type_name, "snapshot_id": snapshot_id, }, @@ -1191,10 +1191,10 @@ def list( id_part: str | NotGiven = NOT_GIVEN, instance_id: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, - metadata_k: List[str] | NotGiven = NOT_GIVEN, - metadata_kv: str | NotGiven = NOT_GIVEN, name_part: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1230,16 +1230,16 @@ def list( limit: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[7]" - metadata_k: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + name_part: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[8]" - metadata_kv: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + offset: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[9]" - name_part: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + tag_key: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[10]" - offset: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[11]" extra_headers: Send extra headers @@ -1270,10 +1270,10 @@ def list( "id_part": id_part, "instance_id": instance_id, "limit": limit, - "metadata_k": metadata_k, - "metadata_kv": metadata_kv, "name_part": name_part, "offset": offset, + "tag_key": tag_key, + "tag_key_value": tag_key_value, }, volume_list_params.VolumeListParams, ), diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 9214b40a..b2014bf4 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -4,7 +4,6 @@ from .tag import Tag as Tag from .task import Task as Task -from .image import Image as Image from .region import Region as Region from .secret import Secret as Secret from .subnet import Subnet as Subnet @@ -18,7 +17,6 @@ from .ip_ranges import IPRanges as IPRanges from .l7_policy import L7Policy as L7Policy from .file_share import FileShare as FileShare -from .image_list import ImageList as ImageList from .ip_version import IPVersion as IPVersion from .floating_ip import FloatingIP as FloatingIP from .http_method import HTTPMethod as HTTPMethod diff --git a/src/gcore/types/cloud/baremetal/__init__.py b/src/gcore/types/cloud/baremetal/__init__.py index fa9f1b7f..aec0d07f 100644 --- a/src/gcore/types/cloud/baremetal/__init__.py +++ b/src/gcore/types/cloud/baremetal/__init__.py @@ -6,6 +6,7 @@ from .image_list_params import ImageListParams as ImageListParams from .flavor_list_params import FlavorListParams as FlavorListParams from .server_list_params import ServerListParams as ServerListParams +from .image_list_response import ImageListResponse as ImageListResponse from .flavor_list_response import FlavorListResponse as FlavorListResponse from .server_create_params import ServerCreateParams as ServerCreateParams from .server_rebuild_params import ServerRebuildParams as ServerRebuildParams diff --git a/src/gcore/types/cloud/baremetal/baremetal_server.py b/src/gcore/types/cloud/baremetal/baremetal_server.py index 2ac81b07..13055ebf 100644 --- a/src/gcore/types/cloud/baremetal/baremetal_server.py +++ b/src/gcore/types/cloud/baremetal/baremetal_server.py @@ -20,8 +20,6 @@ "Flavor", "FlavorHardwareDescription", "InstanceIsolation", - "SecurityGroup", - "Volume", ] @@ -259,28 +257,6 @@ class InstanceIsolation(BaseModel): """ -class SecurityGroup(BaseModel): - name: str - """ - '#/components/schemas/NameSerializerPydantic/properties/name' - "$.components.schemas.NameSerializerPydantic.properties.name" - """ - - -class Volume(BaseModel): - id: str - """ - '#/components/schemas/InstanceVolumeSerializer/properties/id' - "$.components.schemas.InstanceVolumeSerializer.properties.id" - """ - - delete_on_termination: bool - """ - '#/components/schemas/InstanceVolumeSerializer/properties/delete_on_termination' - "$.components.schemas.InstanceVolumeSerializer.properties.delete_on_termination" - """ - - class BaremetalServer(BaseModel): addresses: Dict[str, List[Address]] """ @@ -372,12 +348,6 @@ class BaremetalServer(BaseModel): "$.components.schemas.BareMetalServerSerializer.properties.region_id" """ - security_groups: List[SecurityGroup] - """ - '#/components/schemas/BareMetalServerSerializer/properties/security_groups' - "$.components.schemas.BareMetalServerSerializer.properties.security_groups" - """ - status: Literal[ "ACTIVE", "BUILD", @@ -441,21 +411,3 @@ class BaremetalServer(BaseModel): '#/components/schemas/BareMetalServerSerializer/properties/vm_state' "$.components.schemas.BareMetalServerSerializer.properties.vm_state" """ - - volumes: List[Volume] - """ - '#/components/schemas/BareMetalServerSerializer/properties/volumes' - "$.components.schemas.BareMetalServerSerializer.properties.volumes" - """ - - metadata: Optional[Dict[str, str]] = None - """ - '#/components/schemas/BareMetalServerSerializer/properties/metadata' - "$.components.schemas.BareMetalServerSerializer.properties.metadata" - """ - - metadata_detailed: Optional[List[Tag]] = None - """ - '#/components/schemas/BareMetalServerSerializer/properties/metadata_detailed' - "$.components.schemas.BareMetalServerSerializer.properties.metadata_detailed" - """ diff --git a/src/gcore/types/cloud/baremetal/image_list_params.py b/src/gcore/types/cloud/baremetal/image_list_params.py index 81cc9d35..12509079 100644 --- a/src/gcore/types/cloud/baremetal/image_list_params.py +++ b/src/gcore/types/cloud/baremetal/image_list_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import List from typing_extensions import Literal, TypedDict __all__ = ["ImageListParams"] @@ -26,19 +27,19 @@ class ImageListParams(TypedDict, total=False): "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[2]" """ - metadata_k: str + private: str """ '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[3]" """ - metadata_kv: str + tag_key: List[str] """ '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[4]" """ - private: str + tag_key_value: str """ '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[5]" diff --git a/src/gcore/types/cloud/baremetal/image_list_response.py b/src/gcore/types/cloud/baremetal/image_list_response.py new file mode 100644 index 00000000..f69cf576 --- /dev/null +++ b/src/gcore/types/cloud/baremetal/image_list_response.py @@ -0,0 +1,182 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..tag import Tag +from ...._models import BaseModel + +__all__ = ["ImageListResponse", "Result"] + + +class Result(BaseModel): + id: str + """ + '#/components/schemas/ImageSerializer/properties/id' + "$.components.schemas.ImageSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/ImageSerializer/properties/created_at' + "$.components.schemas.ImageSerializer.properties.created_at" + """ + + disk_format: str + """ + '#/components/schemas/ImageSerializer/properties/disk_format' + "$.components.schemas.ImageSerializer.properties.disk_format" + """ + + min_disk: int + """ + '#/components/schemas/ImageSerializer/properties/min_disk' + "$.components.schemas.ImageSerializer.properties.min_disk" + """ + + min_ram: int + """ + '#/components/schemas/ImageSerializer/properties/min_ram' + "$.components.schemas.ImageSerializer.properties.min_ram" + """ + + name: str + """ + '#/components/schemas/ImageSerializer/properties/name' + "$.components.schemas.ImageSerializer.properties.name" + """ + + os_distro: str + """ + '#/components/schemas/ImageSerializer/properties/os_distro' + "$.components.schemas.ImageSerializer.properties.os_distro" + """ + + os_type: Literal["linux", "windows"] + """ + '#/components/schemas/ImageSerializer/properties/os_type' + "$.components.schemas.ImageSerializer.properties.os_type" + """ + + os_version: str + """ + '#/components/schemas/ImageSerializer/properties/os_version' + "$.components.schemas.ImageSerializer.properties.os_version" + """ + + project_id: int + """ + '#/components/schemas/ImageSerializer/properties/project_id' + "$.components.schemas.ImageSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/ImageSerializer/properties/region' + "$.components.schemas.ImageSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/ImageSerializer/properties/region_id' + "$.components.schemas.ImageSerializer.properties.region_id" + """ + + size: int + """ + '#/components/schemas/ImageSerializer/properties/size' + "$.components.schemas.ImageSerializer.properties.size" + """ + + status: str + """ + '#/components/schemas/ImageSerializer/properties/status' + "$.components.schemas.ImageSerializer.properties.status" + """ + + tags: List[Tag] + """ + '#/components/schemas/ImageSerializer/properties/tags' + "$.components.schemas.ImageSerializer.properties.tags" + """ + + updated_at: datetime + """ + '#/components/schemas/ImageSerializer/properties/updated_at' + "$.components.schemas.ImageSerializer.properties.updated_at" + """ + + visibility: str + """ + '#/components/schemas/ImageSerializer/properties/visibility' + "$.components.schemas.ImageSerializer.properties.visibility" + """ + + architecture: Optional[Literal["aarch64", "x86_64"]] = None + """ + '#/components/schemas/ImageSerializer/properties/architecture' + "$.components.schemas.ImageSerializer.properties.architecture" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/ImageSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.ImageSerializer.properties.creator_task_id.anyOf[0]" + """ + + description: Optional[str] = None + """ + '#/components/schemas/ImageSerializer/properties/description/anyOf/0' + "$.components.schemas.ImageSerializer.properties.description.anyOf[0]" + """ + + display_order: Optional[int] = None + """ + '#/components/schemas/ImageSerializer/properties/display_order/anyOf/0' + "$.components.schemas.ImageSerializer.properties.display_order.anyOf[0]" + """ + + hw_firmware_type: Optional[Literal["bios", "uefi"]] = None + """ + '#/components/schemas/ImageSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.ImageSerializer.properties.hw_firmware_type.anyOf[0]" + """ + + hw_machine_type: Optional[Literal["pc", "q35"]] = None + """ + '#/components/schemas/ImageSerializer/properties/hw_machine_type/anyOf/0' + "$.components.schemas.ImageSerializer.properties.hw_machine_type.anyOf[0]" + """ + + is_baremetal: Optional[bool] = None + """ + '#/components/schemas/ImageSerializer/properties/is_baremetal/anyOf/0' + "$.components.schemas.ImageSerializer.properties.is_baremetal.anyOf[0]" + """ + + ssh_key: Optional[Literal["allow", "deny", "required"]] = None + """ + '#/components/schemas/ImageSerializer/properties/ssh_key/anyOf/0' + "$.components.schemas.ImageSerializer.properties.ssh_key.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/ImageSerializer/properties/task_id/anyOf/0' + "$.components.schemas.ImageSerializer.properties.task_id.anyOf[0]" + """ + + +class ImageListResponse(BaseModel): + count: int + """ + '#/components/schemas/ImageCollectionSerializer/properties/count' + "$.components.schemas.ImageCollectionSerializer.properties.count" + """ + + results: List[Result] + """ + '#/components/schemas/ImageCollectionSerializer/properties/results' + "$.components.schemas.ImageCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index 551b182a..a615b68f 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -83,12 +83,6 @@ class ServerCreateParams(TypedDict, total=False): "$.components.schemas.CreateBareMetalServerSerializer.properties.keypair_name.anyOf[0]" """ - metadata: Dict[str, str] - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/metadata' - "$.components.schemas.CreateBareMetalServerSerializer.properties.metadata" - """ - name_templates: List[str] """ '#/components/schemas/CreateBareMetalServerSerializer/properties/name_templates' @@ -107,6 +101,12 @@ class ServerCreateParams(TypedDict, total=False): "$.components.schemas.CreateBareMetalServerSerializer.properties.password" """ + tags: Dict[str, str] + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/tags' + "$.components.schemas.CreateBareMetalServerSerializer.properties.tags" + """ + user_data: str """ '#/components/schemas/CreateBareMetalServerSerializer/properties/user_data' diff --git a/src/gcore/types/cloud/baremetal/server_list_params.py b/src/gcore/types/cloud/baremetal/server_list_params.py index b803a1ba..7bd41751 100644 --- a/src/gcore/types/cloud/baremetal/server_list_params.py +++ b/src/gcore/types/cloud/baremetal/server_list_params.py @@ -66,61 +66,61 @@ class ServerListParams(TypedDict, total=False): "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[8]" """ - metadata_kv: str + name: str """ '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[9]" """ - metadata_v: List[str] + offset: int """ '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[10]" """ - name: str + only_isolated: bool """ '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[11]" """ - offset: int + only_with_fixed_external_ip: bool """ '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[12]" """ - only_isolated: bool + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] """ '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[13]" """ - only_with_fixed_external_ip: bool + profile_name: str """ '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[14]" """ - order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] + protection_status: Literal["Active", "Queued", "Error"] """ '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[15]" """ - profile_name: str + status: Literal["ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED"] """ '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[16]" """ - protection_status: Literal["Active", "Queued", "Error"] + tag_key_value: str """ '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[17]" """ - status: Literal["ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED"] + tag_value: List[str] """ '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[18]" diff --git a/src/gcore/types/cloud/file_share.py b/src/gcore/types/cloud/file_share.py index 21032a65..d3199ba0 100644 --- a/src/gcore/types/cloud/file_share.py +++ b/src/gcore/types/cloud/file_share.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Optional +from typing import List, Optional from typing_extensions import Literal from .tag import Tag @@ -34,18 +34,6 @@ class FileShare(BaseModel): "$.components.schemas.FileShareSerializer.properties.creator_task_id" """ - metadata: Dict[str, str] - """ - '#/components/schemas/FileShareSerializer/properties/metadata' - "$.components.schemas.FileShareSerializer.properties.metadata" - """ - - metadata_detailed: List[Tag] - """ - '#/components/schemas/FileShareSerializer/properties/metadata_detailed' - "$.components.schemas.FileShareSerializer.properties.metadata_detailed" - """ - name: str """ '#/components/schemas/FileShareSerializer/properties/name' diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index 057e5500..23a1cd8d 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -57,10 +57,10 @@ class CreateStandardFileShareSerializer(TypedDict, total=False): "$.components.schemas.CreateStandardFileShareSerializer.properties.access" """ - metadata: Dict[str, str] + tags: Dict[str, str] """ - '#/components/schemas/CreateStandardFileShareSerializer/properties/metadata' - "$.components.schemas.CreateStandardFileShareSerializer.properties.metadata" + '#/components/schemas/CreateStandardFileShareSerializer/properties/tags' + "$.components.schemas.CreateStandardFileShareSerializer.properties.tags" """ volume_type: Literal["default_share_type"] @@ -135,10 +135,10 @@ class CreateVastFileShareSerializer(TypedDict, total=False): "$.components.schemas.CreateVastFileShareSerializer.properties.volume_type" """ - metadata: Dict[str, str] + tags: Dict[str, str] """ - '#/components/schemas/CreateVastFileShareSerializer/properties/metadata' - "$.components.schemas.CreateVastFileShareSerializer.properties.metadata" + '#/components/schemas/CreateVastFileShareSerializer/properties/tags' + "$.components.schemas.CreateVastFileShareSerializer.properties.tags" """ diff --git a/src/gcore/types/cloud/floating_ip.py b/src/gcore/types/cloud/floating_ip.py index 3d6e7b9f..aa0c41ff 100644 --- a/src/gcore/types/cloud/floating_ip.py +++ b/src/gcore/types/cloud/floating_ip.py @@ -53,12 +53,6 @@ class FloatingIP(BaseModel): "$.components.schemas.FloatingIPSerializer.properties.floating_ip_address.anyOf[0]" """ - metadata: List[Tag] - """ - '#/components/schemas/FloatingIPSerializer/properties/metadata' - "$.components.schemas.FloatingIPSerializer.properties.metadata" - """ - port_id: Optional[str] = None """ '#/components/schemas/FloatingIPSerializer/properties/port_id/anyOf/0' diff --git a/src/gcore/types/cloud/floating_ip_create_params.py b/src/gcore/types/cloud/floating_ip_create_params.py index e0e173b5..7c7ada4d 100644 --- a/src/gcore/types/cloud/floating_ip_create_params.py +++ b/src/gcore/types/cloud/floating_ip_create_params.py @@ -27,14 +27,14 @@ class FloatingIPCreateParams(TypedDict, total=False): "$.components.schemas.CreateFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" """ - metadata: Dict[str, str] - """ - '#/components/schemas/CreateFloatingIPSerializer/properties/metadata' - "$.components.schemas.CreateFloatingIPSerializer.properties.metadata" - """ - port_id: Optional[str] """ '#/components/schemas/CreateFloatingIPSerializer/properties/port_id/anyOf/0' "$.components.schemas.CreateFloatingIPSerializer.properties.port_id.anyOf[0]" """ + + tags: Dict[str, str] + """ + '#/components/schemas/CreateFloatingIPSerializer/properties/tags' + "$.components.schemas.CreateFloatingIPSerializer.properties.tags" + """ diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index 58a9f364..6f3a8386 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -192,18 +192,6 @@ class Instance(BaseModel): "$.components.schemas.InstanceInFloatingSerializer.properties.keypair_name.anyOf[0]" """ - metadata: Dict[str, str] - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/metadata' - "$.components.schemas.InstanceInFloatingSerializer.properties.metadata" - """ - - metadata_detailed: List[Tag] - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/metadata_detailed' - "$.components.schemas.InstanceInFloatingSerializer.properties.metadata_detailed" - """ - project_id: int """ '#/components/schemas/InstanceInFloatingSerializer/properties/project_id' @@ -354,12 +342,6 @@ class FloatingIPDetailed(BaseModel): "$.components.schemas.FloatingIPDetailedSerializer.properties.loadbalancer.anyOf[0]" """ - metadata: List[Tag] - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/metadata' - "$.components.schemas.FloatingIPDetailedSerializer.properties.metadata" - """ - port_id: Optional[str] = None """ '#/components/schemas/FloatingIPDetailedSerializer/properties/port_id/anyOf/0' diff --git a/src/gcore/types/cloud/floating_ip_list_params.py b/src/gcore/types/cloud/floating_ip_list_params.py index 3a2f67b7..903e1b75 100644 --- a/src/gcore/types/cloud/floating_ip_list_params.py +++ b/src/gcore/types/cloud/floating_ip_list_params.py @@ -27,19 +27,19 @@ class FloatingIPListParams(TypedDict, total=False): "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[2]" """ - metadata_k: List[str] + offset: int """ '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[3]" """ - metadata_kv: str + tag_key: List[str] """ '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[4]" """ - offset: int + tag_key_value: str """ '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[5]" diff --git a/src/gcore/types/cloud/image.py b/src/gcore/types/cloud/image.py deleted file mode 100644 index 3cdac041..00000000 --- a/src/gcore/types/cloud/image.py +++ /dev/null @@ -1,203 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["Image"] - - -class Image(BaseModel): - name: str - """ - '#/components/schemas/ImageSchema/properties/name' - "$.components.schemas.ImageSchema.properties.name" - """ - - id: Optional[str] = None - """ - '#/components/schemas/ImageSchema/properties/id' - "$.components.schemas.ImageSchema.properties.id" - """ - - architecture: Optional[Literal["aarch64", "x86_64"]] = None - """ - '#/components/schemas/ImageSchema/properties/architecture' - "$.components.schemas.ImageSchema.properties.architecture" - """ - - created_at: Optional[datetime] = None - """ - '#/components/schemas/ImageSchema/properties/created_at' - "$.components.schemas.ImageSchema.properties.created_at" - """ - - creator_task_id: Optional[str] = None - """ - '#/components/schemas/ImageSchema/properties/creator_task_id' - "$.components.schemas.ImageSchema.properties.creator_task_id" - """ - - currency_code: Optional[str] = None - """ - '#/components/schemas/ImageSchema/properties/currency_code' - "$.components.schemas.ImageSchema.properties.currency_code" - """ - - description: Optional[str] = None - """ - '#/components/schemas/ImageSchema/properties/description' - "$.components.schemas.ImageSchema.properties.description" - """ - - disk_format: Optional[str] = None - """ - '#/components/schemas/ImageSchema/properties/disk_format' - "$.components.schemas.ImageSchema.properties.disk_format" - """ - - display_order: Optional[int] = None - """ - '#/components/schemas/ImageSchema/properties/display_order' - "$.components.schemas.ImageSchema.properties.display_order" - """ - - hw_firmware_type: Optional[Literal["bios", "uefi"]] = None - """ - '#/components/schemas/ImageSchema/properties/hw_firmware_type' - "$.components.schemas.ImageSchema.properties.hw_firmware_type" - """ - - hw_machine_type: Optional[Literal["i440", "q35"]] = None - """ - '#/components/schemas/ImageSchema/properties/hw_machine_type' - "$.components.schemas.ImageSchema.properties.hw_machine_type" - """ - - internally_shared: Optional[bool] = None - """ - '#/components/schemas/ImageSchema/properties/internally_shared' - "$.components.schemas.ImageSchema.properties.internally_shared" - """ - - is_baremetal: Optional[bool] = None - """ - '#/components/schemas/ImageSchema/properties/is_baremetal' - "$.components.schemas.ImageSchema.properties.is_baremetal" - """ - - metadata: Optional[object] = None - """ - '#/components/schemas/ImageSchema/properties/metadata' - "$.components.schemas.ImageSchema.properties.metadata" - """ - - metadata_detailed: Optional[object] = None - """ - '#/components/schemas/ImageSchema/properties/metadata_detailed' - "$.components.schemas.ImageSchema.properties.metadata_detailed" - """ - - min_disk: Optional[int] = None - """ - '#/components/schemas/ImageSchema/properties/min_disk' - "$.components.schemas.ImageSchema.properties.min_disk" - """ - - min_ram: Optional[int] = None - """ - '#/components/schemas/ImageSchema/properties/min_ram' - "$.components.schemas.ImageSchema.properties.min_ram" - """ - - os_distro: Optional[str] = None - """ - '#/components/schemas/ImageSchema/properties/os_distro' - "$.components.schemas.ImageSchema.properties.os_distro" - """ - - os_type: Optional[Literal["linux", "windows"]] = None - """ - '#/components/schemas/ImageSchema/properties/os_type' - "$.components.schemas.ImageSchema.properties.os_type" - """ - - os_version: Optional[str] = None - """ - '#/components/schemas/ImageSchema/properties/os_version' - "$.components.schemas.ImageSchema.properties.os_version" - """ - - price_per_hour: Optional[float] = None - """ - '#/components/schemas/ImageSchema/properties/price_per_hour' - "$.components.schemas.ImageSchema.properties.price_per_hour" - """ - - price_per_month: Optional[float] = None - """ - '#/components/schemas/ImageSchema/properties/price_per_month' - "$.components.schemas.ImageSchema.properties.price_per_month" - """ - - price_status: Optional[Literal["error", "hide", "show"]] = None - """ - '#/components/schemas/ImageSchema/properties/price_status' - "$.components.schemas.ImageSchema.properties.price_status" - """ - - project_id: Optional[int] = None - """ - '#/components/schemas/ImageSchema/properties/project_id' - "$.components.schemas.ImageSchema.properties.project_id" - """ - - region: Optional[str] = None - """ - '#/components/schemas/ImageSchema/properties/region' - "$.components.schemas.ImageSchema.properties.region" - """ - - region_id: Optional[int] = None - """ - '#/components/schemas/ImageSchema/properties/region_id' - "$.components.schemas.ImageSchema.properties.region_id" - """ - - size: Optional[int] = None - """ - '#/components/schemas/ImageSchema/properties/size' - "$.components.schemas.ImageSchema.properties.size" - """ - - ssh_key: Optional[Literal["allow", "deny", "required"]] = None - """ - '#/components/schemas/ImageSchema/properties/ssh_key' - "$.components.schemas.ImageSchema.properties.ssh_key" - """ - - status: Optional[str] = None - """ - '#/components/schemas/ImageSchema/properties/status' - "$.components.schemas.ImageSchema.properties.status" - """ - - task_id: Optional[str] = None - """ - '#/components/schemas/ImageSchema/properties/task_id' - "$.components.schemas.ImageSchema.properties.task_id" - """ - - updated_at: Optional[datetime] = None - """ - '#/components/schemas/ImageSchema/properties/updated_at' - "$.components.schemas.ImageSchema.properties.updated_at" - """ - - visibility: Optional[str] = None - """ - '#/components/schemas/ImageSchema/properties/visibility' - "$.components.schemas.ImageSchema.properties.visibility" - """ diff --git a/src/gcore/types/cloud/image_list.py b/src/gcore/types/cloud/image_list.py deleted file mode 100644 index 00e34cea..00000000 --- a/src/gcore/types/cloud/image_list.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .image import Image -from ..._models import BaseModel - -__all__ = ["ImageList"] - - -class ImageList(BaseModel): - count: Optional[int] = None - """ - '#/components/schemas/ImageListSchema/properties/count' - "$.components.schemas.ImageListSchema.properties.count" - """ - - results: Optional[List[Image]] = None - """ - '#/components/schemas/ImageListSchema/properties/results' - "$.components.schemas.ImageListSchema.properties.results" - """ diff --git a/src/gcore/types/cloud/instances/__init__.py b/src/gcore/types/cloud/instances/__init__.py index 060c3b69..d47592e8 100644 --- a/src/gcore/types/cloud/instances/__init__.py +++ b/src/gcore/types/cloud/instances/__init__.py @@ -4,6 +4,9 @@ from .image_get_params import ImageGetParams as ImageGetParams from .image_list_params import ImageListParams as ImageListParams +from .image_get_response import ImageGetResponse as ImageGetResponse +from .image_list_response import ImageListResponse as ImageListResponse from .image_update_params import ImageUpdateParams as ImageUpdateParams from .image_upload_params import ImageUploadParams as ImageUploadParams +from .image_update_response import ImageUpdateResponse as ImageUpdateResponse from .image_create_from_volume_params import ImageCreateFromVolumeParams as ImageCreateFromVolumeParams diff --git a/src/gcore/types/cloud/instances/image_create_from_volume_params.py b/src/gcore/types/cloud/instances/image_create_from_volume_params.py index 2e8ed137..31205cb8 100644 --- a/src/gcore/types/cloud/instances/image_create_from_volume_params.py +++ b/src/gcore/types/cloud/instances/image_create_from_volume_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ImageCreateFromVolumeParams"] @@ -23,60 +23,60 @@ class ImageCreateFromVolumeParams(TypedDict, total=False): name: Required[str] """ - '#/components/schemas/ImageCreateSchema/properties/name' - "$.components.schemas.ImageCreateSchema.properties.name" + '#/components/schemas/ImageCreateFromVolumeSerializer/properties/name' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.name" """ volume_id: Required[str] """ - '#/components/schemas/ImageCreateSchema/properties/volume_id' - "$.components.schemas.ImageCreateSchema.properties.volume_id" + '#/components/schemas/ImageCreateFromVolumeSerializer/properties/volume_id' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.volume_id" """ architecture: Literal["aarch64", "x86_64"] """ - '#/components/schemas/ImageCreateSchema/properties/architecture' - "$.components.schemas.ImageCreateSchema.properties.architecture" + '#/components/schemas/ImageCreateFromVolumeSerializer/properties/architecture' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.architecture" """ - hw_firmware_type: Literal["bios", "uefi"] + hw_firmware_type: Optional[Literal["bios", "uefi"]] """ - '#/components/schemas/ImageCreateSchema/properties/hw_firmware_type' - "$.components.schemas.ImageCreateSchema.properties.hw_firmware_type" + '#/components/schemas/ImageCreateFromVolumeSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.hw_firmware_type.anyOf[0]" """ - hw_machine_type: Literal["i440", "q35"] + hw_machine_type: Optional[Literal["pc", "q35"]] """ - '#/components/schemas/ImageCreateSchema/properties/hw_machine_type' - "$.components.schemas.ImageCreateSchema.properties.hw_machine_type" + '#/components/schemas/ImageCreateFromVolumeSerializer/properties/hw_machine_type/anyOf/0' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.hw_machine_type.anyOf[0]" """ - is_baremetal: Optional[bool] + is_baremetal: bool """ - '#/components/schemas/ImageCreateSchema/properties/is_baremetal' - "$.components.schemas.ImageCreateSchema.properties.is_baremetal" + '#/components/schemas/ImageCreateFromVolumeSerializer/properties/is_baremetal' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.is_baremetal" """ - metadata: object + os_type: Literal["linux", "windows"] """ - '#/components/schemas/ImageCreateSchema/properties/metadata' - "$.components.schemas.ImageCreateSchema.properties.metadata" + '#/components/schemas/ImageCreateFromVolumeSerializer/properties/os_type' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.os_type" """ - os_type: Literal["linux", "windows"] + source: Literal["volume"] """ - '#/components/schemas/ImageCreateSchema/properties/os_type' - "$.components.schemas.ImageCreateSchema.properties.os_type" + '#/components/schemas/ImageCreateFromVolumeSerializer/properties/source' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.source" """ - source: str + ssh_key: Literal["allow", "deny", "required"] """ - '#/components/schemas/ImageCreateSchema/properties/source' - "$.components.schemas.ImageCreateSchema.properties.source" + '#/components/schemas/ImageCreateFromVolumeSerializer/properties/ssh_key' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.ssh_key" """ - ssh_key: Literal["allow", "deny", "required"] + tags: Dict[str, str] """ - '#/components/schemas/ImageCreateSchema/properties/ssh_key' - "$.components.schemas.ImageCreateSchema.properties.ssh_key" + '#/components/schemas/ImageCreateFromVolumeSerializer/properties/tags' + "$.components.schemas.ImageCreateFromVolumeSerializer.properties.tags" """ diff --git a/src/gcore/types/cloud/instances/image_get_params.py b/src/gcore/types/cloud/instances/image_get_params.py index dc700d19..aefa51db 100644 --- a/src/gcore/types/cloud/instances/image_get_params.py +++ b/src/gcore/types/cloud/instances/image_get_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import Literal, TypedDict +from typing_extensions import TypedDict __all__ = ["ImageGetParams"] @@ -25,27 +25,3 @@ class ImageGetParams(TypedDict, total=False): '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/3' "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[3]" """ - - metadata_k: str - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/4' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[4]" - """ - - metadata_kv: str - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/5' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[5]" - """ - - private: str - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/6' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[6]" - """ - - visibility: Literal["private", "public", "shared"] - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/7' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[7]" - """ diff --git a/src/gcore/types/cloud/instances/image_get_response.py b/src/gcore/types/cloud/instances/image_get_response.py new file mode 100644 index 00000000..a050bab7 --- /dev/null +++ b/src/gcore/types/cloud/instances/image_get_response.py @@ -0,0 +1,168 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..tag import Tag +from ...._models import BaseModel + +__all__ = ["ImageGetResponse"] + + +class ImageGetResponse(BaseModel): + id: str + """ + '#/components/schemas/ImageSerializer/properties/id' + "$.components.schemas.ImageSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/ImageSerializer/properties/created_at' + "$.components.schemas.ImageSerializer.properties.created_at" + """ + + disk_format: str + """ + '#/components/schemas/ImageSerializer/properties/disk_format' + "$.components.schemas.ImageSerializer.properties.disk_format" + """ + + min_disk: int + """ + '#/components/schemas/ImageSerializer/properties/min_disk' + "$.components.schemas.ImageSerializer.properties.min_disk" + """ + + min_ram: int + """ + '#/components/schemas/ImageSerializer/properties/min_ram' + "$.components.schemas.ImageSerializer.properties.min_ram" + """ + + name: str + """ + '#/components/schemas/ImageSerializer/properties/name' + "$.components.schemas.ImageSerializer.properties.name" + """ + + os_distro: str + """ + '#/components/schemas/ImageSerializer/properties/os_distro' + "$.components.schemas.ImageSerializer.properties.os_distro" + """ + + os_type: Literal["linux", "windows"] + """ + '#/components/schemas/ImageSerializer/properties/os_type' + "$.components.schemas.ImageSerializer.properties.os_type" + """ + + os_version: str + """ + '#/components/schemas/ImageSerializer/properties/os_version' + "$.components.schemas.ImageSerializer.properties.os_version" + """ + + project_id: int + """ + '#/components/schemas/ImageSerializer/properties/project_id' + "$.components.schemas.ImageSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/ImageSerializer/properties/region' + "$.components.schemas.ImageSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/ImageSerializer/properties/region_id' + "$.components.schemas.ImageSerializer.properties.region_id" + """ + + size: int + """ + '#/components/schemas/ImageSerializer/properties/size' + "$.components.schemas.ImageSerializer.properties.size" + """ + + status: str + """ + '#/components/schemas/ImageSerializer/properties/status' + "$.components.schemas.ImageSerializer.properties.status" + """ + + tags: List[Tag] + """ + '#/components/schemas/ImageSerializer/properties/tags' + "$.components.schemas.ImageSerializer.properties.tags" + """ + + updated_at: datetime + """ + '#/components/schemas/ImageSerializer/properties/updated_at' + "$.components.schemas.ImageSerializer.properties.updated_at" + """ + + visibility: str + """ + '#/components/schemas/ImageSerializer/properties/visibility' + "$.components.schemas.ImageSerializer.properties.visibility" + """ + + architecture: Optional[Literal["aarch64", "x86_64"]] = None + """ + '#/components/schemas/ImageSerializer/properties/architecture' + "$.components.schemas.ImageSerializer.properties.architecture" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/ImageSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.ImageSerializer.properties.creator_task_id.anyOf[0]" + """ + + description: Optional[str] = None + """ + '#/components/schemas/ImageSerializer/properties/description/anyOf/0' + "$.components.schemas.ImageSerializer.properties.description.anyOf[0]" + """ + + display_order: Optional[int] = None + """ + '#/components/schemas/ImageSerializer/properties/display_order/anyOf/0' + "$.components.schemas.ImageSerializer.properties.display_order.anyOf[0]" + """ + + hw_firmware_type: Optional[Literal["bios", "uefi"]] = None + """ + '#/components/schemas/ImageSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.ImageSerializer.properties.hw_firmware_type.anyOf[0]" + """ + + hw_machine_type: Optional[Literal["pc", "q35"]] = None + """ + '#/components/schemas/ImageSerializer/properties/hw_machine_type/anyOf/0' + "$.components.schemas.ImageSerializer.properties.hw_machine_type.anyOf[0]" + """ + + is_baremetal: Optional[bool] = None + """ + '#/components/schemas/ImageSerializer/properties/is_baremetal/anyOf/0' + "$.components.schemas.ImageSerializer.properties.is_baremetal.anyOf[0]" + """ + + ssh_key: Optional[Literal["allow", "deny", "required"]] = None + """ + '#/components/schemas/ImageSerializer/properties/ssh_key/anyOf/0' + "$.components.schemas.ImageSerializer.properties.ssh_key.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/ImageSerializer/properties/task_id/anyOf/0' + "$.components.schemas.ImageSerializer.properties.task_id.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/instances/image_list_params.py b/src/gcore/types/cloud/instances/image_list_params.py index 900f2523..e6a19ab9 100644 --- a/src/gcore/types/cloud/instances/image_list_params.py +++ b/src/gcore/types/cloud/instances/image_list_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import List from typing_extensions import Literal, TypedDict __all__ = ["ImageListParams"] @@ -26,19 +27,19 @@ class ImageListParams(TypedDict, total=False): "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[2]" """ - metadata_k: str + private: str """ '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[3]" """ - metadata_kv: str + tag_key: List[str] """ '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[4]" """ - private: str + tag_key_value: str """ '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[5]" diff --git a/src/gcore/types/cloud/instances/image_list_response.py b/src/gcore/types/cloud/instances/image_list_response.py new file mode 100644 index 00000000..f69cf576 --- /dev/null +++ b/src/gcore/types/cloud/instances/image_list_response.py @@ -0,0 +1,182 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..tag import Tag +from ...._models import BaseModel + +__all__ = ["ImageListResponse", "Result"] + + +class Result(BaseModel): + id: str + """ + '#/components/schemas/ImageSerializer/properties/id' + "$.components.schemas.ImageSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/ImageSerializer/properties/created_at' + "$.components.schemas.ImageSerializer.properties.created_at" + """ + + disk_format: str + """ + '#/components/schemas/ImageSerializer/properties/disk_format' + "$.components.schemas.ImageSerializer.properties.disk_format" + """ + + min_disk: int + """ + '#/components/schemas/ImageSerializer/properties/min_disk' + "$.components.schemas.ImageSerializer.properties.min_disk" + """ + + min_ram: int + """ + '#/components/schemas/ImageSerializer/properties/min_ram' + "$.components.schemas.ImageSerializer.properties.min_ram" + """ + + name: str + """ + '#/components/schemas/ImageSerializer/properties/name' + "$.components.schemas.ImageSerializer.properties.name" + """ + + os_distro: str + """ + '#/components/schemas/ImageSerializer/properties/os_distro' + "$.components.schemas.ImageSerializer.properties.os_distro" + """ + + os_type: Literal["linux", "windows"] + """ + '#/components/schemas/ImageSerializer/properties/os_type' + "$.components.schemas.ImageSerializer.properties.os_type" + """ + + os_version: str + """ + '#/components/schemas/ImageSerializer/properties/os_version' + "$.components.schemas.ImageSerializer.properties.os_version" + """ + + project_id: int + """ + '#/components/schemas/ImageSerializer/properties/project_id' + "$.components.schemas.ImageSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/ImageSerializer/properties/region' + "$.components.schemas.ImageSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/ImageSerializer/properties/region_id' + "$.components.schemas.ImageSerializer.properties.region_id" + """ + + size: int + """ + '#/components/schemas/ImageSerializer/properties/size' + "$.components.schemas.ImageSerializer.properties.size" + """ + + status: str + """ + '#/components/schemas/ImageSerializer/properties/status' + "$.components.schemas.ImageSerializer.properties.status" + """ + + tags: List[Tag] + """ + '#/components/schemas/ImageSerializer/properties/tags' + "$.components.schemas.ImageSerializer.properties.tags" + """ + + updated_at: datetime + """ + '#/components/schemas/ImageSerializer/properties/updated_at' + "$.components.schemas.ImageSerializer.properties.updated_at" + """ + + visibility: str + """ + '#/components/schemas/ImageSerializer/properties/visibility' + "$.components.schemas.ImageSerializer.properties.visibility" + """ + + architecture: Optional[Literal["aarch64", "x86_64"]] = None + """ + '#/components/schemas/ImageSerializer/properties/architecture' + "$.components.schemas.ImageSerializer.properties.architecture" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/ImageSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.ImageSerializer.properties.creator_task_id.anyOf[0]" + """ + + description: Optional[str] = None + """ + '#/components/schemas/ImageSerializer/properties/description/anyOf/0' + "$.components.schemas.ImageSerializer.properties.description.anyOf[0]" + """ + + display_order: Optional[int] = None + """ + '#/components/schemas/ImageSerializer/properties/display_order/anyOf/0' + "$.components.schemas.ImageSerializer.properties.display_order.anyOf[0]" + """ + + hw_firmware_type: Optional[Literal["bios", "uefi"]] = None + """ + '#/components/schemas/ImageSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.ImageSerializer.properties.hw_firmware_type.anyOf[0]" + """ + + hw_machine_type: Optional[Literal["pc", "q35"]] = None + """ + '#/components/schemas/ImageSerializer/properties/hw_machine_type/anyOf/0' + "$.components.schemas.ImageSerializer.properties.hw_machine_type.anyOf[0]" + """ + + is_baremetal: Optional[bool] = None + """ + '#/components/schemas/ImageSerializer/properties/is_baremetal/anyOf/0' + "$.components.schemas.ImageSerializer.properties.is_baremetal.anyOf[0]" + """ + + ssh_key: Optional[Literal["allow", "deny", "required"]] = None + """ + '#/components/schemas/ImageSerializer/properties/ssh_key/anyOf/0' + "$.components.schemas.ImageSerializer.properties.ssh_key.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/ImageSerializer/properties/task_id/anyOf/0' + "$.components.schemas.ImageSerializer.properties.task_id.anyOf[0]" + """ + + +class ImageListResponse(BaseModel): + count: int + """ + '#/components/schemas/ImageCollectionSerializer/properties/count' + "$.components.schemas.ImageCollectionSerializer.properties.count" + """ + + results: List[Result] + """ + '#/components/schemas/ImageCollectionSerializer/properties/results' + "$.components.schemas.ImageCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/instances/image_update_params.py b/src/gcore/types/cloud/instances/image_update_params.py index 95b5eae3..c86a4acf 100644 --- a/src/gcore/types/cloud/instances/image_update_params.py +++ b/src/gcore/types/cloud/instances/image_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict from typing_extensions import Literal, TypedDict __all__ = ["ImageUpdateParams"] @@ -23,42 +23,42 @@ class ImageUpdateParams(TypedDict, total=False): hw_firmware_type: Literal["bios", "uefi"] """ - '#/components/schemas/UpdateImageSchema/properties/hw_firmware_type' - "$.components.schemas.UpdateImageSchema.properties.hw_firmware_type" + '#/components/schemas/UpdateImageSerializer/properties/hw_firmware_type' + "$.components.schemas.UpdateImageSerializer.properties.hw_firmware_type" """ - hw_machine_type: Literal["i440", "q35"] + hw_machine_type: Literal["pc", "q35"] """ - '#/components/schemas/UpdateImageSchema/properties/hw_machine_type' - "$.components.schemas.UpdateImageSchema.properties.hw_machine_type" + '#/components/schemas/UpdateImageSerializer/properties/hw_machine_type' + "$.components.schemas.UpdateImageSerializer.properties.hw_machine_type" """ - is_baremetal: Optional[bool] + is_baremetal: bool """ - '#/components/schemas/UpdateImageSchema/properties/is_baremetal' - "$.components.schemas.UpdateImageSchema.properties.is_baremetal" - """ - - metadata: object - """ - '#/components/schemas/UpdateImageSchema/properties/metadata' - "$.components.schemas.UpdateImageSchema.properties.metadata" + '#/components/schemas/UpdateImageSerializer/properties/is_baremetal' + "$.components.schemas.UpdateImageSerializer.properties.is_baremetal" """ name: str """ - '#/components/schemas/UpdateImageSchema/properties/name' - "$.components.schemas.UpdateImageSchema.properties.name" + '#/components/schemas/UpdateImageSerializer/properties/name' + "$.components.schemas.UpdateImageSerializer.properties.name" """ os_type: Literal["linux", "windows"] """ - '#/components/schemas/UpdateImageSchema/properties/os_type' - "$.components.schemas.UpdateImageSchema.properties.os_type" + '#/components/schemas/UpdateImageSerializer/properties/os_type' + "$.components.schemas.UpdateImageSerializer.properties.os_type" """ ssh_key: Literal["allow", "deny", "required"] """ - '#/components/schemas/UpdateImageSchema/properties/ssh_key' - "$.components.schemas.UpdateImageSchema.properties.ssh_key" + '#/components/schemas/UpdateImageSerializer/properties/ssh_key' + "$.components.schemas.UpdateImageSerializer.properties.ssh_key" + """ + + tags: Dict[str, str] + """ + '#/components/schemas/UpdateImageSerializer/properties/tags' + "$.components.schemas.UpdateImageSerializer.properties.tags" """ diff --git a/src/gcore/types/cloud/instances/image_update_response.py b/src/gcore/types/cloud/instances/image_update_response.py new file mode 100644 index 00000000..5e5dd33e --- /dev/null +++ b/src/gcore/types/cloud/instances/image_update_response.py @@ -0,0 +1,168 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..tag import Tag +from ...._models import BaseModel + +__all__ = ["ImageUpdateResponse"] + + +class ImageUpdateResponse(BaseModel): + id: str + """ + '#/components/schemas/ImageSerializer/properties/id' + "$.components.schemas.ImageSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/ImageSerializer/properties/created_at' + "$.components.schemas.ImageSerializer.properties.created_at" + """ + + disk_format: str + """ + '#/components/schemas/ImageSerializer/properties/disk_format' + "$.components.schemas.ImageSerializer.properties.disk_format" + """ + + min_disk: int + """ + '#/components/schemas/ImageSerializer/properties/min_disk' + "$.components.schemas.ImageSerializer.properties.min_disk" + """ + + min_ram: int + """ + '#/components/schemas/ImageSerializer/properties/min_ram' + "$.components.schemas.ImageSerializer.properties.min_ram" + """ + + name: str + """ + '#/components/schemas/ImageSerializer/properties/name' + "$.components.schemas.ImageSerializer.properties.name" + """ + + os_distro: str + """ + '#/components/schemas/ImageSerializer/properties/os_distro' + "$.components.schemas.ImageSerializer.properties.os_distro" + """ + + os_type: Literal["linux", "windows"] + """ + '#/components/schemas/ImageSerializer/properties/os_type' + "$.components.schemas.ImageSerializer.properties.os_type" + """ + + os_version: str + """ + '#/components/schemas/ImageSerializer/properties/os_version' + "$.components.schemas.ImageSerializer.properties.os_version" + """ + + project_id: int + """ + '#/components/schemas/ImageSerializer/properties/project_id' + "$.components.schemas.ImageSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/ImageSerializer/properties/region' + "$.components.schemas.ImageSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/ImageSerializer/properties/region_id' + "$.components.schemas.ImageSerializer.properties.region_id" + """ + + size: int + """ + '#/components/schemas/ImageSerializer/properties/size' + "$.components.schemas.ImageSerializer.properties.size" + """ + + status: str + """ + '#/components/schemas/ImageSerializer/properties/status' + "$.components.schemas.ImageSerializer.properties.status" + """ + + tags: List[Tag] + """ + '#/components/schemas/ImageSerializer/properties/tags' + "$.components.schemas.ImageSerializer.properties.tags" + """ + + updated_at: datetime + """ + '#/components/schemas/ImageSerializer/properties/updated_at' + "$.components.schemas.ImageSerializer.properties.updated_at" + """ + + visibility: str + """ + '#/components/schemas/ImageSerializer/properties/visibility' + "$.components.schemas.ImageSerializer.properties.visibility" + """ + + architecture: Optional[Literal["aarch64", "x86_64"]] = None + """ + '#/components/schemas/ImageSerializer/properties/architecture' + "$.components.schemas.ImageSerializer.properties.architecture" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/ImageSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.ImageSerializer.properties.creator_task_id.anyOf[0]" + """ + + description: Optional[str] = None + """ + '#/components/schemas/ImageSerializer/properties/description/anyOf/0' + "$.components.schemas.ImageSerializer.properties.description.anyOf[0]" + """ + + display_order: Optional[int] = None + """ + '#/components/schemas/ImageSerializer/properties/display_order/anyOf/0' + "$.components.schemas.ImageSerializer.properties.display_order.anyOf[0]" + """ + + hw_firmware_type: Optional[Literal["bios", "uefi"]] = None + """ + '#/components/schemas/ImageSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.ImageSerializer.properties.hw_firmware_type.anyOf[0]" + """ + + hw_machine_type: Optional[Literal["pc", "q35"]] = None + """ + '#/components/schemas/ImageSerializer/properties/hw_machine_type/anyOf/0' + "$.components.schemas.ImageSerializer.properties.hw_machine_type.anyOf[0]" + """ + + is_baremetal: Optional[bool] = None + """ + '#/components/schemas/ImageSerializer/properties/is_baremetal/anyOf/0' + "$.components.schemas.ImageSerializer.properties.is_baremetal.anyOf[0]" + """ + + ssh_key: Optional[Literal["allow", "deny", "required"]] = None + """ + '#/components/schemas/ImageSerializer/properties/ssh_key/anyOf/0' + "$.components.schemas.ImageSerializer.properties.ssh_key.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/ImageSerializer/properties/task_id/anyOf/0' + "$.components.schemas.ImageSerializer.properties.task_id.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/instances/image_upload_params.py b/src/gcore/types/cloud/instances/image_upload_params.py index ae6af248..95237809 100644 --- a/src/gcore/types/cloud/instances/image_upload_params.py +++ b/src/gcore/types/cloud/instances/image_upload_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ImageUploadParams"] @@ -23,72 +23,72 @@ class ImageUploadParams(TypedDict, total=False): name: Required[str] """ - '#/components/schemas/ImageDownloadSchema/properties/name' - "$.components.schemas.ImageDownloadSchema.properties.name" + '#/components/schemas/ImageDownloadSerializer/properties/name' + "$.components.schemas.ImageDownloadSerializer.properties.name" """ url: Required[str] """ - '#/components/schemas/ImageDownloadSchema/properties/url' - "$.components.schemas.ImageDownloadSchema.properties.url" + '#/components/schemas/ImageDownloadSerializer/properties/url' + "$.components.schemas.ImageDownloadSerializer.properties.url" """ architecture: Literal["aarch64", "x86_64"] """ - '#/components/schemas/ImageDownloadSchema/properties/architecture' - "$.components.schemas.ImageDownloadSchema.properties.architecture" + '#/components/schemas/ImageDownloadSerializer/properties/architecture' + "$.components.schemas.ImageDownloadSerializer.properties.architecture" """ cow_format: bool """ - '#/components/schemas/ImageDownloadSchema/properties/cow_format' - "$.components.schemas.ImageDownloadSchema.properties.cow_format" + '#/components/schemas/ImageDownloadSerializer/properties/cow_format' + "$.components.schemas.ImageDownloadSerializer.properties.cow_format" """ - hw_firmware_type: Literal["bios", "uefi"] + hw_firmware_type: Optional[Literal["bios", "uefi"]] """ - '#/components/schemas/ImageDownloadSchema/properties/hw_firmware_type' - "$.components.schemas.ImageDownloadSchema.properties.hw_firmware_type" + '#/components/schemas/ImageDownloadSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.ImageDownloadSerializer.properties.hw_firmware_type.anyOf[0]" """ - hw_machine_type: Literal["i440", "q35"] + hw_machine_type: Optional[Literal["pc", "q35"]] """ - '#/components/schemas/ImageDownloadSchema/properties/hw_machine_type' - "$.components.schemas.ImageDownloadSchema.properties.hw_machine_type" + '#/components/schemas/ImageDownloadSerializer/properties/hw_machine_type/anyOf/0' + "$.components.schemas.ImageDownloadSerializer.properties.hw_machine_type.anyOf[0]" """ - is_baremetal: Optional[bool] + is_baremetal: bool """ - '#/components/schemas/ImageDownloadSchema/properties/is_baremetal' - "$.components.schemas.ImageDownloadSchema.properties.is_baremetal" + '#/components/schemas/ImageDownloadSerializer/properties/is_baremetal' + "$.components.schemas.ImageDownloadSerializer.properties.is_baremetal" """ - metadata: object + os_distro: Optional[str] """ - '#/components/schemas/ImageDownloadSchema/properties/metadata' - "$.components.schemas.ImageDownloadSchema.properties.metadata" + '#/components/schemas/ImageDownloadSerializer/properties/os_distro/anyOf/0' + "$.components.schemas.ImageDownloadSerializer.properties.os_distro.anyOf[0]" """ - os_distro: str + os_type: Literal["linux", "windows"] """ - '#/components/schemas/ImageDownloadSchema/properties/os_distro' - "$.components.schemas.ImageDownloadSchema.properties.os_distro" + '#/components/schemas/ImageDownloadSerializer/properties/os_type' + "$.components.schemas.ImageDownloadSerializer.properties.os_type" """ - os_type: Literal["linux", "windows"] + os_version: Optional[str] """ - '#/components/schemas/ImageDownloadSchema/properties/os_type' - "$.components.schemas.ImageDownloadSchema.properties.os_type" + '#/components/schemas/ImageDownloadSerializer/properties/os_version/anyOf/0' + "$.components.schemas.ImageDownloadSerializer.properties.os_version.anyOf[0]" """ - os_version: str + ssh_key: Literal["allow", "deny", "required"] """ - '#/components/schemas/ImageDownloadSchema/properties/os_version' - "$.components.schemas.ImageDownloadSchema.properties.os_version" + '#/components/schemas/ImageDownloadSerializer/properties/ssh_key' + "$.components.schemas.ImageDownloadSerializer.properties.ssh_key" """ - ssh_key: Literal["allow", "deny", "required"] + tags: Dict[str, str] """ - '#/components/schemas/ImageDownloadSchema/properties/ssh_key' - "$.components.schemas.ImageDownloadSchema.properties.ssh_key" + '#/components/schemas/ImageDownloadSerializer/properties/tags' + "$.components.schemas.ImageDownloadSerializer.properties.tags" """ diff --git a/src/gcore/types/cloud/load_balancer.py b/src/gcore/types/cloud/load_balancer.py index 807140a1..6deb67af 100644 --- a/src/gcore/types/cloud/load_balancer.py +++ b/src/gcore/types/cloud/load_balancer.py @@ -135,6 +135,12 @@ class LoadBalancer(BaseModel): "$.components.schemas.LoadbalancerSerializer.properties.region_id" """ + tags_v2: List[Tag] + """ + '#/components/schemas/LoadbalancerSerializer/properties/tags_v2' + "$.components.schemas.LoadbalancerSerializer.properties.tags_v2" + """ + additional_vips: Optional[List[AdditionalVip]] = None """ '#/components/schemas/LoadbalancerSerializer/properties/additional_vips' @@ -177,12 +183,6 @@ class LoadBalancer(BaseModel): "$.components.schemas.LoadbalancerSerializer.properties.logging.anyOf[0]" """ - metadata: Optional[List[Tag]] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/metadata' - "$.components.schemas.LoadbalancerSerializer.properties.metadata" - """ - preferred_connectivity: Optional[LoadBalancerMemberConnectivity] = None """ '#/components/schemas/LoadbalancerSerializer/properties/preferred_connectivity' diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index a94ed222..0c0d8581 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -67,12 +67,6 @@ class LoadBalancerCreateParams(TypedDict, total=False): "$.components.schemas.CreateLoadbalancerSerializer.properties.logging" """ - metadata: Dict[str, str] - """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/metadata' - "$.components.schemas.CreateLoadbalancerSerializer.properties.metadata" - """ - name: str """ '#/components/schemas/CreateLoadbalancerSerializer/properties/name' @@ -91,10 +85,10 @@ class LoadBalancerCreateParams(TypedDict, total=False): "$.components.schemas.CreateLoadbalancerSerializer.properties.preferred_connectivity" """ - tag: List[str] + tags: Dict[str, str] """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/tag' - "$.components.schemas.CreateLoadbalancerSerializer.properties.tag" + '#/components/schemas/CreateLoadbalancerSerializer/properties/tags' + "$.components.schemas.CreateLoadbalancerSerializer.properties.tags" """ vip_ip_family: InterfaceIPFamily diff --git a/src/gcore/types/cloud/load_balancer_list_params.py b/src/gcore/types/cloud/load_balancer_list_params.py index 51ac0dca..52369863 100644 --- a/src/gcore/types/cloud/load_balancer_list_params.py +++ b/src/gcore/types/cloud/load_balancer_list_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import List from typing_extensions import TypedDict __all__ = ["LoadBalancerListParams"] @@ -38,37 +39,37 @@ class LoadBalancerListParams(TypedDict, total=False): "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[4]" """ - metadata_k: str + name: str """ '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[5]" """ - metadata_kv: str + offset: int """ '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[6]" """ - name: str + order_by: str """ '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[7]" """ - offset: int + show_stats: bool """ '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[8]" """ - order_by: str + tag_key: List[str] """ '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[9]" """ - show_stats: bool + tag_key_value: str """ '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[10]" diff --git a/src/gcore/types/cloud/load_balancer_status.py b/src/gcore/types/cloud/load_balancer_status.py index ab1ed403..be7acf50 100644 --- a/src/gcore/types/cloud/load_balancer_status.py +++ b/src/gcore/types/cloud/load_balancer_status.py @@ -42,12 +42,6 @@ class LoadBalancerStatus(BaseModel): "$.components.schemas.LoadBalancerStatusSerializer.properties.provisioning_status" """ - metadata: Optional[List[Tag]] = None - """ - '#/components/schemas/LoadBalancerStatusSerializer/properties/metadata' - "$.components.schemas.LoadBalancerStatusSerializer.properties.metadata" - """ - tags: Optional[List[Tag]] = None """ '#/components/schemas/LoadBalancerStatusSerializer/properties/tags' diff --git a/src/gcore/types/cloud/network.py b/src/gcore/types/cloud/network.py index 51bde528..a2e41d8e 100644 --- a/src/gcore/types/cloud/network.py +++ b/src/gcore/types/cloud/network.py @@ -28,12 +28,6 @@ class Network(BaseModel): "$.components.schemas.NetworkSerializer.properties.external" """ - metadata: List[Tag] - """ - '#/components/schemas/NetworkSerializer/properties/metadata' - "$.components.schemas.NetworkSerializer.properties.metadata" - """ - name: str """ '#/components/schemas/NetworkSerializer/properties/name' diff --git a/src/gcore/types/cloud/network_create_params.py b/src/gcore/types/cloud/network_create_params.py index d47f2c4a..d89487dd 100644 --- a/src/gcore/types/cloud/network_create_params.py +++ b/src/gcore/types/cloud/network_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Dict from typing_extensions import Literal, Required, TypedDict __all__ = ["NetworkCreateParams"] @@ -33,10 +33,10 @@ class NetworkCreateParams(TypedDict, total=False): "$.components.schemas.CreateNetworkSerializer.properties.create_router" """ - metadata: Optional[Dict[str, str]] + tags: Dict[str, str] """ - '#/components/schemas/CreateNetworkSerializer/properties/metadata/anyOf/0' - "$.components.schemas.CreateNetworkSerializer.properties.metadata.anyOf[0]" + '#/components/schemas/CreateNetworkSerializer/properties/tags' + "$.components.schemas.CreateNetworkSerializer.properties.tags" """ type: Literal["vlan", "vxlan"] diff --git a/src/gcore/types/cloud/network_list_params.py b/src/gcore/types/cloud/network_list_params.py index e72a01e2..e3d15874 100644 --- a/src/gcore/types/cloud/network_list_params.py +++ b/src/gcore/types/cloud/network_list_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import List from typing_extensions import TypedDict __all__ = ["NetworkListParams"] @@ -26,25 +27,25 @@ class NetworkListParams(TypedDict, total=False): "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[2]" """ - metadata_k: str + offset: int """ '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[3]" """ - metadata_kv: str + order_by: str """ '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[4]" """ - offset: int + tag_key: List[str] """ '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[5]" """ - order_by: str + tag_key_value: str """ '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[6]" diff --git a/src/gcore/types/cloud/networks/router_attach_subnet_params.py b/src/gcore/types/cloud/networks/router_attach_subnet_params.py index 9e23b7df..ee9531c4 100644 --- a/src/gcore/types/cloud/networks/router_attach_subnet_params.py +++ b/src/gcore/types/cloud/networks/router_attach_subnet_params.py @@ -22,6 +22,12 @@ class RouterAttachSubnetParams(TypedDict, total=False): subnet_id: Required[str] """ - '#/components/schemas/SubnetIdSerializer/properties/subnet_id' - "$.components.schemas.SubnetIdSerializer.properties.subnet_id" + '#/components/schemas/AddRouterInterfaceSerializer/properties/subnet_id' + "$.components.schemas.AddRouterInterfaceSerializer.properties.subnet_id" + """ + + ip_address: str + """ + '#/components/schemas/AddRouterInterfaceSerializer/properties/ip_address' + "$.components.schemas.AddRouterInterfaceSerializer.properties.ip_address" """ diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index e4fde91d..0867ba29 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -77,18 +77,18 @@ class SubnetCreateParams(TypedDict, total=False): "$.components.schemas.CreateSubnetSerializer.properties.ip_version" """ - metadata: Optional[Dict[str, str]] - """ - '#/components/schemas/CreateSubnetSerializer/properties/metadata/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.metadata.anyOf[0]" - """ - router_id_to_connect: Optional[str] """ '#/components/schemas/CreateSubnetSerializer/properties/router_id_to_connect/anyOf/0' "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" """ + tags: Dict[str, str] + """ + '#/components/schemas/CreateSubnetSerializer/properties/tags' + "$.components.schemas.CreateSubnetSerializer.properties.tags" + """ + class HostRoute(TypedDict, total=False): destination: Required[str] diff --git a/src/gcore/types/cloud/networks/subnet_list_params.py b/src/gcore/types/cloud/networks/subnet_list_params.py index b7004132..b416159e 100644 --- a/src/gcore/types/cloud/networks/subnet_list_params.py +++ b/src/gcore/types/cloud/networks/subnet_list_params.py @@ -27,30 +27,18 @@ class SubnetListParams(TypedDict, total=False): "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[2]" """ - metadata_k: List[str] + network_id: str """ '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[3]" """ - metadata_kv: str + offset: int """ '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[4]" """ - network_id: str - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[5]" - """ - - offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[6]" - """ - order_by: Literal[ "available_ips.asc", "available_ips.desc", @@ -66,6 +54,18 @@ class SubnetListParams(TypedDict, total=False): "updated_at.desc", ] """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[5]" + """ + + tag_key: List[str] + """ + '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[6]" + """ + + tag_key_value: str + """ '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[7]" """ diff --git a/src/gcore/types/cloud/security_group.py b/src/gcore/types/cloud/security_group.py index 0e7b9649..2b3bc526 100644 --- a/src/gcore/types/cloud/security_group.py +++ b/src/gcore/types/cloud/security_group.py @@ -53,6 +53,12 @@ class SecurityGroup(BaseModel): "$.components.schemas.SecurityGroupSerializer.properties.revision_number" """ + tags_v2: List[Tag] + """ + '#/components/schemas/SecurityGroupSerializer/properties/tags_v2' + "$.components.schemas.SecurityGroupSerializer.properties.tags_v2" + """ + updated_at: datetime """ '#/components/schemas/SecurityGroupSerializer/properties/updated_at' @@ -65,20 +71,8 @@ class SecurityGroup(BaseModel): "$.components.schemas.SecurityGroupSerializer.properties.description.anyOf[0]" """ - metadata: Optional[List[Tag]] = None - """ - '#/components/schemas/SecurityGroupSerializer/properties/metadata' - "$.components.schemas.SecurityGroupSerializer.properties.metadata" - """ - security_group_rules: Optional[List[SecurityGroupRule]] = None """ '#/components/schemas/SecurityGroupSerializer/properties/security_group_rules' "$.components.schemas.SecurityGroupSerializer.properties.security_group_rules" """ - - tags: Optional[List[str]] = None - """ - '#/components/schemas/SecurityGroupSerializer/properties/tags/anyOf/0' - "$.components.schemas.SecurityGroupSerializer.properties.tags.anyOf[0]" - """ diff --git a/src/gcore/types/cloud/security_group_create_params.py b/src/gcore/types/cloud/security_group_create_params.py index 51db74d2..ddd5c32d 100644 --- a/src/gcore/types/cloud/security_group_create_params.py +++ b/src/gcore/types/cloud/security_group_create_params.py @@ -122,20 +122,14 @@ class SecurityGroup(TypedDict, total=False): "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.description.anyOf[0]" """ - metadata: Dict[str, object] - """ - '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/metadata' - "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.metadata" - """ - security_group_rules: Iterable[SecurityGroupSecurityGroupRule] """ '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/security_group_rules' "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.security_group_rules" """ - tags: Optional[List[str]] + tags: Dict[str, object] """ - '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/tags/anyOf/0' - "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.tags.anyOf[0]" + '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/tags' + "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.tags" """ diff --git a/src/gcore/types/cloud/security_group_list_params.py b/src/gcore/types/cloud/security_group_list_params.py index db435eeb..e01fbe1f 100644 --- a/src/gcore/types/cloud/security_group_list_params.py +++ b/src/gcore/types/cloud/security_group_list_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import List from typing_extensions import TypedDict __all__ = ["SecurityGroupListParams"] @@ -26,19 +27,19 @@ class SecurityGroupListParams(TypedDict, total=False): "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[2]" """ - metadata_k: str + offset: int """ '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[3]" """ - metadata_kv: str + tag_key: List[str] """ '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[4]" """ - offset: int + tag_key_value: str """ '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[5]" diff --git a/src/gcore/types/cloud/subnet.py b/src/gcore/types/cloud/subnet.py index 9b4420b3..d936483a 100644 --- a/src/gcore/types/cloud/subnet.py +++ b/src/gcore/types/cloud/subnet.py @@ -133,12 +133,6 @@ class Subnet(BaseModel): "$.components.schemas.SubnetSerializer.properties.host_routes.anyOf[0]" """ - metadata: Optional[List[Tag]] = None - """ - '#/components/schemas/SubnetSerializer/properties/metadata' - "$.components.schemas.SubnetSerializer.properties.metadata" - """ - task_id: Optional[str] = None """ '#/components/schemas/SubnetSerializer/properties/task_id/anyOf/0' diff --git a/src/gcore/types/cloud/volume.py b/src/gcore/types/cloud/volume.py index c5655971..91b678b8 100644 --- a/src/gcore/types/cloud/volume.py +++ b/src/gcore/types/cloud/volume.py @@ -107,12 +107,6 @@ class Volume(BaseModel): "$.components.schemas.VolumeSerializer.properties.is_root_volume" """ - metadata_detailed: List[Tag] - """ - '#/components/schemas/VolumeSerializer/properties/metadata_detailed' - "$.components.schemas.VolumeSerializer.properties.metadata_detailed" - """ - name: str """ '#/components/schemas/VolumeSerializer/properties/name' @@ -201,12 +195,6 @@ class Volume(BaseModel): "$.components.schemas.VolumeSerializer.properties.limiter_stats.anyOf[0]" """ - metadata: Optional[Dict[str, str]] = None - """ - '#/components/schemas/VolumeSerializer/properties/metadata/anyOf/0' - "$.components.schemas.VolumeSerializer.properties.metadata.anyOf[0]" - """ - snapshot_ids: Optional[List[str]] = None """ '#/components/schemas/VolumeSerializer/properties/snapshot_ids/anyOf/0' diff --git a/src/gcore/types/cloud/volume_create_params.py b/src/gcore/types/cloud/volume_create_params.py index 56aeb345..3a890abb 100644 --- a/src/gcore/types/cloud/volume_create_params.py +++ b/src/gcore/types/cloud/volume_create_params.py @@ -68,10 +68,10 @@ class CreateVolumeFromImageSerializer(TypedDict, total=False): "$.components.schemas.CreateVolumeFromImageSerializer.properties.lifecycle_policy_ids" """ - metadata: Dict[str, str] + tags: Dict[str, str] """ - '#/components/schemas/CreateVolumeFromImageSerializer/properties/metadata' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.metadata" + '#/components/schemas/CreateVolumeFromImageSerializer/properties/tags' + "$.components.schemas.CreateVolumeFromImageSerializer.properties.tags" """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] @@ -130,18 +130,18 @@ class CreateVolumeFromSnapshotSerializer(TypedDict, total=False): "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.lifecycle_policy_ids" """ - metadata: Dict[str, str] - """ - '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/metadata' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.metadata" - """ - size: int """ '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/size' "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.size" """ + tags: Dict[str, str] + """ + '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/tags' + "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.tags" + """ + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] """ '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/type_name' @@ -198,10 +198,10 @@ class CreateNewVolumeSerializer(TypedDict, total=False): "$.components.schemas.CreateNewVolumeSerializer.properties.lifecycle_policy_ids" """ - metadata: Dict[str, str] + tags: Dict[str, str] """ - '#/components/schemas/CreateNewVolumeSerializer/properties/metadata' - "$.components.schemas.CreateNewVolumeSerializer.properties.metadata" + '#/components/schemas/CreateNewVolumeSerializer/properties/tags' + "$.components.schemas.CreateNewVolumeSerializer.properties.tags" """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] diff --git a/src/gcore/types/cloud/volume_list_params.py b/src/gcore/types/cloud/volume_list_params.py index 950cc8c9..6ca7cf2e 100644 --- a/src/gcore/types/cloud/volume_list_params.py +++ b/src/gcore/types/cloud/volume_list_params.py @@ -57,25 +57,25 @@ class VolumeListParams(TypedDict, total=False): "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[7]" """ - metadata_k: List[str] + name_part: str """ '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[8]" """ - metadata_kv: str + offset: int """ '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[9]" """ - name_part: str + tag_key: List[str] """ '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[10]" """ - offset: int + tag_key_value: str """ '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[11]" diff --git a/tests/api_resources/cloud/baremetal/test_images.py b/tests/api_resources/cloud/baremetal/test_images.py index f9223c4b..97605521 100644 --- a/tests/api_resources/cloud/baremetal/test_images.py +++ b/tests/api_resources/cloud/baremetal/test_images.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import ImageList +from gcore.types.cloud.baremetal import ImageListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -31,12 +31,12 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: project_id=0, region_id=0, include_prices=True, - metadata_k="metadata_k", - metadata_kv="metadata_kv", private="private", + tag_key=["string"], + tag_key_value="tag_key_value", visibility="private", ) - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -48,7 +48,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -60,7 +60,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +74,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -82,12 +82,12 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No project_id=0, region_id=0, include_prices=True, - metadata_k="metadata_k", - metadata_kv="metadata_kv", private="private", + tag_key=["string"], + tag_key_value="tag_key_value", visibility="private", ) - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -99,7 +99,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -111,6 +111,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index 0845c891..52689adf 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -60,10 +60,10 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: }, image_id="image_id", keypair_name="my-keypair", - metadata={"my-tag": "my-tag-value"}, name_templates=["my-bare-metal-{ip_octets}"], names=["my-bare-metal"], password="password", + tags={"my-tag": "my-tag-value"}, user_data="user_data", username="username", ) @@ -119,8 +119,6 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: include_k8s=True, ip="192.168.0.1", limit=1000, - metadata_kv="metadata_kv", - metadata_v=["value1", "value2"], name="name", offset=0, only_isolated=True, @@ -129,6 +127,8 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: profile_name="profile_name", protection_status="Active", status="ACTIVE", + tag_key_value="tag_key_value", + tag_value=["value1", "value2"], type_ddos_profile="advanced", uuid="b5b4d65d-945f-4b98-ab6f-332319c724ef", with_ddos=True, @@ -263,10 +263,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> }, image_id="image_id", keypair_name="my-keypair", - metadata={"my-tag": "my-tag-value"}, name_templates=["my-bare-metal-{ip_octets}"], names=["my-bare-metal"], password="password", + tags={"my-tag": "my-tag-value"}, user_data="user_data", username="username", ) @@ -322,8 +322,6 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No include_k8s=True, ip="192.168.0.1", limit=1000, - metadata_kv="metadata_kv", - metadata_v=["value1", "value2"], name="name", offset=0, only_isolated=True, @@ -332,6 +330,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No profile_name="profile_name", protection_status="Active", status="ACTIVE", + tag_key_value="tag_key_value", + tag_value=["value1", "value2"], type_ddos_profile="advanced", uuid="b5b4d65d-945f-4b98-ab6f-332319c724ef", with_ddos=True, diff --git a/tests/api_resources/cloud/instances/test_images.py b/tests/api_resources/cloud/instances/test_images.py index 82328d35..9c852bc5 100644 --- a/tests/api_resources/cloud/instances/test_images.py +++ b/tests/api_resources/cloud/instances/test_images.py @@ -9,7 +9,12 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import Image, ImageList, TaskIDList +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.instances import ( + ImageGetResponse, + ImageListResponse, + ImageUpdateResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +29,7 @@ def test_method_update(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageUpdateResponse, image, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: @@ -33,14 +38,14 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: project_id=0, region_id=0, hw_firmware_type="bios", - hw_machine_type="i440", - is_baremetal=True, - metadata={}, - name="string", + hw_machine_type="q35", + is_baremetal=False, + name="my-image", os_type="linux", ssh_key="allow", + tags={"my-tag": "my-tag-value"}, ) - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageUpdateResponse, image, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: @@ -53,7 +58,7 @@ def test_raw_response_update(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageUpdateResponse, image, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: @@ -66,7 +71,7 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageUpdateResponse, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -85,7 +90,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -93,12 +98,12 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: project_id=0, region_id=0, include_prices=True, - metadata_k="metadata_k", - metadata_kv="metadata_kv", private="private", + tag_key=["string"], + tag_key_value="tag_key_value", visibility="private", ) - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -110,7 +115,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -122,7 +127,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -177,7 +182,7 @@ def test_method_create_from_volume(self, client: Gcore) -> None: image = client.cloud.instances.images.create_from_volume( project_id=0, region_id=0, - name="test_image", + name="my-image", volume_id="d478ae29-dedc-4869-82f0-96104425f565", ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -187,16 +192,16 @@ def test_method_create_from_volume_with_all_params(self, client: Gcore) -> None: image = client.cloud.instances.images.create_from_volume( project_id=0, region_id=0, - name="test_image", + name="my-image", volume_id="d478ae29-dedc-4869-82f0-96104425f565", architecture="x86_64", hw_firmware_type="bios", hw_machine_type="q35", is_baremetal=False, - metadata={"key": "value"}, os_type="linux", source="volume", ssh_key="allow", + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -205,7 +210,7 @@ def test_raw_response_create_from_volume(self, client: Gcore) -> None: response = client.cloud.instances.images.with_raw_response.create_from_volume( project_id=0, region_id=0, - name="test_image", + name="my-image", volume_id="d478ae29-dedc-4869-82f0-96104425f565", ) @@ -219,7 +224,7 @@ def test_streaming_response_create_from_volume(self, client: Gcore) -> None: with client.cloud.instances.images.with_streaming_response.create_from_volume( project_id=0, region_id=0, - name="test_image", + name="my-image", volume_id="d478ae29-dedc-4869-82f0-96104425f565", ) as response: assert not response.is_closed @@ -237,7 +242,7 @@ def test_method_get(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageGetResponse, image, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Gcore) -> None: @@ -246,12 +251,8 @@ def test_method_get_with_all_params(self, client: Gcore) -> None: project_id=0, region_id=0, include_prices=True, - metadata_k="metadata_k", - metadata_kv="metadata_kv", - private="private", - visibility="private", ) - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageGetResponse, image, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -264,7 +265,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageGetResponse, image, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -277,7 +278,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageGetResponse, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -295,7 +296,7 @@ def test_method_upload(self, client: Gcore) -> None: image = client.cloud.instances.images.upload( project_id=0, region_id=0, - name="image_name", + name="my-image", url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -305,18 +306,18 @@ def test_method_upload_with_all_params(self, client: Gcore) -> None: image = client.cloud.instances.images.upload( project_id=0, region_id=0, - name="image_name", + name="my-image", url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", architecture="x86_64", cow_format=False, hw_firmware_type="bios", hw_machine_type="q35", is_baremetal=False, - metadata={"key": "value"}, - os_distro="os_distro", + os_distro="ubuntu", os_type="linux", - os_version="os_version", + os_version="22.04", ssh_key="allow", + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -325,7 +326,7 @@ def test_raw_response_upload(self, client: Gcore) -> None: response = client.cloud.instances.images.with_raw_response.upload( project_id=0, region_id=0, - name="image_name", + name="my-image", url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", ) @@ -339,7 +340,7 @@ def test_streaming_response_upload(self, client: Gcore) -> None: with client.cloud.instances.images.with_streaming_response.upload( project_id=0, region_id=0, - name="image_name", + name="my-image", url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", ) as response: assert not response.is_closed @@ -361,7 +362,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageUpdateResponse, image, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: @@ -370,14 +371,14 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> project_id=0, region_id=0, hw_firmware_type="bios", - hw_machine_type="i440", - is_baremetal=True, - metadata={}, - name="string", + hw_machine_type="q35", + is_baremetal=False, + name="my-image", os_type="linux", ssh_key="allow", + tags={"my-tag": "my-tag-value"}, ) - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageUpdateResponse, image, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @@ -390,7 +391,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageUpdateResponse, image, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: @@ -403,7 +404,7 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageUpdateResponse, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -422,7 +423,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -430,12 +431,12 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No project_id=0, region_id=0, include_prices=True, - metadata_k="metadata_k", - metadata_kv="metadata_kv", private="private", + tag_key=["string"], + tag_key_value="tag_key_value", visibility="private", ) - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -447,7 +448,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -459,7 +460,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(ImageList, image, path=["response"]) + assert_matches_type(ImageListResponse, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -514,7 +515,7 @@ async def test_method_create_from_volume(self, async_client: AsyncGcore) -> None image = await async_client.cloud.instances.images.create_from_volume( project_id=0, region_id=0, - name="test_image", + name="my-image", volume_id="d478ae29-dedc-4869-82f0-96104425f565", ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -524,16 +525,16 @@ async def test_method_create_from_volume_with_all_params(self, async_client: Asy image = await async_client.cloud.instances.images.create_from_volume( project_id=0, region_id=0, - name="test_image", + name="my-image", volume_id="d478ae29-dedc-4869-82f0-96104425f565", architecture="x86_64", hw_firmware_type="bios", hw_machine_type="q35", is_baremetal=False, - metadata={"key": "value"}, os_type="linux", source="volume", ssh_key="allow", + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -542,7 +543,7 @@ async def test_raw_response_create_from_volume(self, async_client: AsyncGcore) - response = await async_client.cloud.instances.images.with_raw_response.create_from_volume( project_id=0, region_id=0, - name="test_image", + name="my-image", volume_id="d478ae29-dedc-4869-82f0-96104425f565", ) @@ -556,7 +557,7 @@ async def test_streaming_response_create_from_volume(self, async_client: AsyncGc async with async_client.cloud.instances.images.with_streaming_response.create_from_volume( project_id=0, region_id=0, - name="test_image", + name="my-image", volume_id="d478ae29-dedc-4869-82f0-96104425f565", ) as response: assert not response.is_closed @@ -574,7 +575,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageGetResponse, image, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: @@ -583,12 +584,8 @@ async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> Non project_id=0, region_id=0, include_prices=True, - metadata_k="metadata_k", - metadata_kv="metadata_kv", - private="private", - visibility="private", ) - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageGetResponse, image, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -601,7 +598,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageGetResponse, image, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -614,7 +611,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(Image, image, path=["response"]) + assert_matches_type(ImageGetResponse, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -632,7 +629,7 @@ async def test_method_upload(self, async_client: AsyncGcore) -> None: image = await async_client.cloud.instances.images.upload( project_id=0, region_id=0, - name="image_name", + name="my-image", url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -642,18 +639,18 @@ async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> image = await async_client.cloud.instances.images.upload( project_id=0, region_id=0, - name="image_name", + name="my-image", url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", architecture="x86_64", cow_format=False, hw_firmware_type="bios", hw_machine_type="q35", is_baremetal=False, - metadata={"key": "value"}, - os_distro="os_distro", + os_distro="ubuntu", os_type="linux", - os_version="os_version", + os_version="22.04", ssh_key="allow", + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -662,7 +659,7 @@ async def test_raw_response_upload(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.instances.images.with_raw_response.upload( project_id=0, region_id=0, - name="image_name", + name="my-image", url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", ) @@ -676,7 +673,7 @@ async def test_streaming_response_upload(self, async_client: AsyncGcore) -> None async with async_client.cloud.instances.images.with_streaming_response.upload( project_id=0, region_id=0, - name="image_name", + name="my-image", url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", ) as response: assert not response.is_closed diff --git a/tests/api_resources/cloud/networks/test_routers.py b/tests/api_resources/cloud/networks/test_routers.py index 329a44ca..b8414ea9 100644 --- a/tests/api_resources/cloud/networks/test_routers.py +++ b/tests/api_resources/cloud/networks/test_routers.py @@ -243,19 +243,30 @@ def test_path_params_delete(self, client: Gcore) -> None: @parametrize def test_method_attach_subnet(self, client: Gcore) -> None: router = client.cloud.networks.routers.attach_subnet( - router_id="router_id", - project_id=0, - region_id=0, + router_id="ccd5b925-e35c-4611-a511-67ab503104c8", + project_id=1, + region_id=1, + subnet_id="subnet_id", + ) + assert_matches_type(Router, router, path=["response"]) + + @parametrize + def test_method_attach_subnet_with_all_params(self, client: Gcore) -> None: + router = client.cloud.networks.routers.attach_subnet( + router_id="ccd5b925-e35c-4611-a511-67ab503104c8", + project_id=1, + region_id=1, subnet_id="subnet_id", + ip_address="ip_address", ) assert_matches_type(Router, router, path=["response"]) @parametrize def test_raw_response_attach_subnet(self, client: Gcore) -> None: response = client.cloud.networks.routers.with_raw_response.attach_subnet( - router_id="router_id", - project_id=0, - region_id=0, + router_id="ccd5b925-e35c-4611-a511-67ab503104c8", + project_id=1, + region_id=1, subnet_id="subnet_id", ) @@ -267,9 +278,9 @@ def test_raw_response_attach_subnet(self, client: Gcore) -> None: @parametrize def test_streaming_response_attach_subnet(self, client: Gcore) -> None: with client.cloud.networks.routers.with_streaming_response.attach_subnet( - router_id="router_id", - project_id=0, - region_id=0, + router_id="ccd5b925-e35c-4611-a511-67ab503104c8", + project_id=1, + region_id=1, subnet_id="subnet_id", ) as response: assert not response.is_closed @@ -285,8 +296,8 @@ def test_path_params_attach_subnet(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): client.cloud.networks.routers.with_raw_response.attach_subnet( router_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, subnet_id="subnet_id", ) @@ -612,19 +623,30 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_attach_subnet(self, async_client: AsyncGcore) -> None: router = await async_client.cloud.networks.routers.attach_subnet( - router_id="router_id", - project_id=0, - region_id=0, + router_id="ccd5b925-e35c-4611-a511-67ab503104c8", + project_id=1, + region_id=1, + subnet_id="subnet_id", + ) + assert_matches_type(Router, router, path=["response"]) + + @parametrize + async def test_method_attach_subnet_with_all_params(self, async_client: AsyncGcore) -> None: + router = await async_client.cloud.networks.routers.attach_subnet( + router_id="ccd5b925-e35c-4611-a511-67ab503104c8", + project_id=1, + region_id=1, subnet_id="subnet_id", + ip_address="ip_address", ) assert_matches_type(Router, router, path=["response"]) @parametrize async def test_raw_response_attach_subnet(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.networks.routers.with_raw_response.attach_subnet( - router_id="router_id", - project_id=0, - region_id=0, + router_id="ccd5b925-e35c-4611-a511-67ab503104c8", + project_id=1, + region_id=1, subnet_id="subnet_id", ) @@ -636,9 +658,9 @@ async def test_raw_response_attach_subnet(self, async_client: AsyncGcore) -> Non @parametrize async def test_streaming_response_attach_subnet(self, async_client: AsyncGcore) -> None: async with async_client.cloud.networks.routers.with_streaming_response.attach_subnet( - router_id="router_id", - project_id=0, - region_id=0, + router_id="ccd5b925-e35c-4611-a511-67ab503104c8", + project_id=1, + region_id=1, subnet_id="subnet_id", ) as response: assert not response.is_closed @@ -654,8 +676,8 @@ async def test_path_params_attach_subnet(self, async_client: AsyncGcore) -> None with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): await async_client.cloud.networks.routers.with_raw_response.attach_subnet( router_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, subnet_id="subnet_id", ) diff --git a/tests/api_resources/cloud/networks/test_subnets.py b/tests/api_resources/cloud/networks/test_subnets.py index 8e9d0930..5f5be075 100644 --- a/tests/api_resources/cloud/networks/test_subnets.py +++ b/tests/api_resources/cloud/networks/test_subnets.py @@ -48,8 +48,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: } ], ip_version=4, - metadata={"my-tag": "my-tag-value"}, router_id_to_connect="00000000-0000-4000-8000-000000000000", + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, subnet, path=["response"]) @@ -164,11 +164,11 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, limit=1000, - metadata_k=["key1", "key2"], - metadata_kv="metadata_kv", network_id="b30d0de7-bca2-4c83-9c57-9e645bd2cc92", offset=0, order_by="name.asc", + tag_key=["key1", "key2"], + tag_key_value="tag_key_value", ) assert_matches_type(SyncOffsetPage[Subnet], subnet, path=["response"]) @@ -324,8 +324,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> } ], ip_version=4, - metadata={"my-tag": "my-tag-value"}, router_id_to_connect="00000000-0000-4000-8000-000000000000", + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, subnet, path=["response"]) @@ -440,11 +440,11 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No project_id=1, region_id=1, limit=1000, - metadata_k=["key1", "key2"], - metadata_kv="metadata_kv", network_id="b30d0de7-bca2-4c83-9c57-9e645bd2cc92", offset=0, order_by="name.asc", + tag_key=["key1", "key2"], + tag_key_value="tag_key_value", ) assert_matches_type(AsyncOffsetPage[Subnet], subnet, path=["response"]) diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index 5d39bccb..482a4200 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -51,7 +51,7 @@ def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: "ip_address": "10.0.0.1", } ], - metadata={"my-tag": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, volume_type="default_share_type", ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -111,7 +111,7 @@ def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: protocol="NFS", size=5, volume_type="vast_share_type", - metadata={"my-tag": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -419,7 +419,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn "ip_address": "10.0.0.1", } ], - metadata={"my-tag": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, volume_type="default_share_type", ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -479,7 +479,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn protocol="NFS", size=5, volume_type="vast_share_type", - metadata={"my-tag": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, file_share, path=["response"]) diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index 137d3c2f..52a54438 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -36,8 +36,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, fixed_ip_address="192.168.10.15", - metadata={"my-tag": "my-tag-value"}, port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) @@ -81,9 +81,9 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, limit=1000, - metadata_k=["key1", "key2"], - metadata_kv="metadata_kv", offset=0, + tag_key=["key1", "key2"], + tag_key_value="tag_key_value", ) assert_matches_type(SyncOffsetPage[FloatingIPDetailed], floating_ip, path=["response"]) @@ -330,8 +330,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> project_id=1, region_id=1, fixed_ip_address="192.168.10.15", - metadata={"my-tag": "my-tag-value"}, port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) @@ -375,9 +375,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No project_id=1, region_id=1, limit=1000, - metadata_k=["key1", "key2"], - metadata_kv="metadata_kv", offset=0, + tag_key=["key1", "key2"], + tag_key_value="tag_key_value", ) assert_matches_type(AsyncOffsetPage[FloatingIPDetailed], floating_ip, path=["response"]) diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index 5ef4852d..e89a1d3a 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -119,11 +119,10 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "retention_policy": {"period": 45}, "topic_name": "my-log-name", }, - metadata={"my-tag": "my-tag-value"}, name="new_load_balancer", name_template="lb_name_template", preferred_connectivity="L2", - tag=["k8s"], + tags={"my-tag": "my-tag-value"}, vip_ip_family="dual", vip_network_id="ac307687-31a4-4a11-a949-6bea1b2878f5", vip_port_id="ff83e13a-b256-4be2-ba5d-028d3f0ab450", @@ -236,12 +235,12 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: assigned_floating=True, limit=0, logging_enabled=True, - metadata_k="metadata_k", - metadata_kv="metadata_kv", name="name", offset=0, order_by="order_by", show_stats=True, + tag_key=["string"], + tag_key_value="tag_key_value", with_ddos=True, ) assert_matches_type(SyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) @@ -583,11 +582,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "retention_policy": {"period": 45}, "topic_name": "my-log-name", }, - metadata={"my-tag": "my-tag-value"}, name="new_load_balancer", name_template="lb_name_template", preferred_connectivity="L2", - tag=["k8s"], + tags={"my-tag": "my-tag-value"}, vip_ip_family="dual", vip_network_id="ac307687-31a4-4a11-a949-6bea1b2878f5", vip_port_id="ff83e13a-b256-4be2-ba5d-028d3f0ab450", @@ -700,12 +698,12 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No assigned_floating=True, limit=0, logging_enabled=True, - metadata_k="metadata_k", - metadata_kv="metadata_kv", name="name", offset=0, order_by="order_by", show_stats=True, + tag_key=["string"], + tag_key_value="tag_key_value", with_ddos=True, ) assert_matches_type(AsyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) diff --git a/tests/api_resources/cloud/test_networks.py b/tests/api_resources/cloud/test_networks.py index af455350..3f7b785f 100644 --- a/tests/api_resources/cloud/test_networks.py +++ b/tests/api_resources/cloud/test_networks.py @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: region_id=0, name="my network", create_router=True, - metadata={"my-tag": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, type="vxlan", ) assert_matches_type(TaskIDList, network, path=["response"]) @@ -131,10 +131,10 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: project_id=0, region_id=0, limit=0, - metadata_k="metadata_k", - metadata_kv="metadata_kv", offset=0, order_by="order_by", + tag_key=["string"], + tag_key_value="tag_key_value", ) assert_matches_type(SyncOffsetPage[Network], network, path=["response"]) @@ -276,7 +276,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> region_id=0, name="my network", create_router=True, - metadata={"my-tag": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, type="vxlan", ) assert_matches_type(TaskIDList, network, path=["response"]) @@ -373,10 +373,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No project_id=0, region_id=0, limit=0, - metadata_k="metadata_k", - metadata_kv="metadata_kv", offset=0, order_by="order_by", + tag_key=["string"], + tag_key_value="tag_key_value", ) assert_matches_type(AsyncOffsetPage[Network], network, path=["response"]) diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index 5082ea2f..20630068 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -37,7 +37,6 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: security_group={ "name": "my_security_group", "description": "Some description", - "metadata": {"my-tag": "bar"}, "security_group_rules": [ { "description": "Some description", @@ -50,7 +49,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "remote_ip_prefix": "10.0.0.0/8", } ], - "tags": ["string"], + "tags": {"my-tag": "bar"}, }, instances=["00000000-0000-4000-8000-000000000000"], ) @@ -168,9 +167,9 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: project_id=0, region_id=0, limit=0, - metadata_k="metadata_k", - metadata_kv="metadata_kv", offset=0, + tag_key=["string"], + tag_key_value="tag_key_value", ) assert_matches_type(SyncOffsetPage[SecurityGroup], security_group, path=["response"]) @@ -409,7 +408,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> security_group={ "name": "my_security_group", "description": "Some description", - "metadata": {"my-tag": "bar"}, "security_group_rules": [ { "description": "Some description", @@ -422,7 +420,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "remote_ip_prefix": "10.0.0.0/8", } ], - "tags": ["string"], + "tags": {"my-tag": "bar"}, }, instances=["00000000-0000-4000-8000-000000000000"], ) @@ -540,9 +538,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No project_id=0, region_id=0, limit=0, - metadata_k="metadata_k", - metadata_kv="metadata_kv", offset=0, + tag_key=["string"], + tag_key_value="tag_key_value", ) assert_matches_type(AsyncOffsetPage[SecurityGroup], security_group, path=["response"]) diff --git a/tests/api_resources/cloud/test_volumes.py b/tests/api_resources/cloud/test_volumes.py index cb7c981a..02543827 100644 --- a/tests/api_resources/cloud/test_volumes.py +++ b/tests/api_resources/cloud/test_volumes.py @@ -45,7 +45,7 @@ def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - metadata={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -106,8 +106,8 @@ def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - metadata={"foo": "my-tag-value"}, size=10, + tags={"my-tag": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -166,7 +166,7 @@ def test_method_create_with_all_params_overload_3(self, client: Gcore) -> None: attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - metadata={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -272,10 +272,10 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: id_part="726ecfcc-7fd0-4e30-a86e-7892524aa483", instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", limit=1000, - metadata_k=["key1", "key2"], - metadata_kv="metadata_kv", name_part="test", offset=0, + tag_key=["key1", "key2"], + tag_key_value="tag_key_value", ) assert_matches_type(SyncOffsetPage[Volume], volume, path=["response"]) @@ -692,7 +692,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - metadata={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -753,8 +753,8 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - metadata={"foo": "my-tag-value"}, size=10, + tags={"my-tag": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -813,7 +813,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - metadata={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -919,10 +919,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No id_part="726ecfcc-7fd0-4e30-a86e-7892524aa483", instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", limit=1000, - metadata_k=["key1", "key2"], - metadata_kv="metadata_kv", name_part="test", offset=0, + tag_key=["key1", "key2"], + tag_key_value="tag_key_value", ) assert_matches_type(AsyncOffsetPage[Volume], volume, path=["response"]) From 281a05310365f255efa6e55075c653eb41aebc81 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 10:55:51 +0000 Subject: [PATCH 081/592] Update shared image model schema references --- .stats.yml | 2 +- api.md | 22 +-- src/gcore/resources/cloud/baremetal/images.py | 10 +- src/gcore/resources/cloud/instances/images.py | 29 ++- src/gcore/types/cloud/__init__.py | 2 + src/gcore/types/cloud/baremetal/__init__.py | 1 - .../cloud/baremetal/image_list_response.py | 182 ------------------ .../image_get_response.py => image.py} | 8 +- src/gcore/types/cloud/image_list.py | 22 +++ src/gcore/types/cloud/instances/__init__.py | 3 - .../cloud/instances/image_list_response.py | 182 ------------------ .../cloud/instances/image_update_response.py | 168 ---------------- .../cloud/baremetal/test_images.py | 18 +- .../cloud/instances/test_images.py | 55 +++--- 14 files changed, 88 insertions(+), 616 deletions(-) delete mode 100644 src/gcore/types/cloud/baremetal/image_list_response.py rename src/gcore/types/cloud/{instances/image_get_response.py => image.py} (97%) create mode 100644 src/gcore/types/cloud/image_list.py delete mode 100644 src/gcore/types/cloud/instances/image_list_response.py delete mode 100644 src/gcore/types/cloud/instances/image_update_response.py diff --git a/.stats.yml b/.stats.yml index fdcf1b73..fe54c7f4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 171 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fd112571ef5f42061c9dee7ecc057c924513aa9e6b2c9e373e847b07eb19e315.yml openapi_spec_hash: 842d806607c522f6db146861c3d2ec62 -config_hash: ec7c5974d987e11bcd3be200616819e5 +config_hash: bb82bee1aa2b5f1b265a9a22b6c7e4e7 diff --git a/api.md b/api.md index c5f5a7a7..234ee193 100644 --- a/api.md +++ b/api.md @@ -14,6 +14,8 @@ from gcore.types.cloud import ( FlavorHardwareDescription, FloatingIP, FloatingIPStatus, + Image, + ImageList, InstanceMetricsTimeUnit, InterfaceIPFamily, IPVersion, @@ -557,15 +559,9 @@ Methods: ### Images -Types: - -```python -from gcore.types.cloud.baremetal import ImageListResponse -``` - Methods: -- client.cloud.baremetal.images.list(\*, project_id, region_id, \*\*params) -> ImageListResponse +- client.cloud.baremetal.images.list(\*, project_id, region_id, \*\*params) -> ImageList ### Flavors @@ -598,19 +594,13 @@ Methods: ### Images -Types: - -```python -from gcore.types.cloud.instances import ImageUpdateResponse, ImageListResponse, ImageGetResponse -``` - Methods: -- client.cloud.instances.images.update(image_id, \*, project_id, region_id, \*\*params) -> ImageUpdateResponse -- client.cloud.instances.images.list(\*, project_id, region_id, \*\*params) -> ImageListResponse +- client.cloud.instances.images.update(image_id, \*, project_id, region_id, \*\*params) -> Image +- client.cloud.instances.images.list(\*, project_id, region_id, \*\*params) -> ImageList - client.cloud.instances.images.delete(image_id, \*, project_id, region_id) -> TaskIDList - client.cloud.instances.images.create_from_volume(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.instances.images.get(image_id, \*, project_id, region_id, \*\*params) -> ImageGetResponse +- client.cloud.instances.images.get(image_id, \*, project_id, region_id, \*\*params) -> Image - client.cloud.instances.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList ## FileShares diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index 7134e90d..c728ce04 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -19,7 +19,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.baremetal import image_list_params -from ....types.cloud.baremetal.image_list_response import ImageListResponse +from ....types.cloud.image_list import ImageList __all__ = ["ImagesResource", "AsyncImagesResource"] @@ -60,7 +60,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageListResponse: + ) -> ImageList: """Retrieve the available images list for bare metal servers. Returned entities may @@ -118,7 +118,7 @@ def list( image_list_params.ImageListParams, ), ), - cast_to=ImageListResponse, + cast_to=ImageList, ) @@ -158,7 +158,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageListResponse: + ) -> ImageList: """Retrieve the available images list for bare metal servers. Returned entities may @@ -216,7 +216,7 @@ async def list( image_list_params.ImageListParams, ), ), - cast_to=ImageListResponse, + cast_to=ImageList, ) diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index fca48674..65b88a93 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -18,6 +18,7 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options +from ....types.cloud.image import Image from ....types.cloud.instances import ( image_get_params, image_list_params, @@ -25,10 +26,8 @@ image_upload_params, image_create_from_volume_params, ) +from ....types.cloud.image_list import ImageList from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.instances.image_get_response import ImageGetResponse -from ....types.cloud.instances.image_list_response import ImageListResponse -from ....types.cloud.instances.image_update_response import ImageUpdateResponse __all__ = ["ImagesResource", "AsyncImagesResource"] @@ -72,7 +71,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageUpdateResponse: + ) -> Image: """ Update image fields @@ -138,7 +137,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ImageUpdateResponse, + cast_to=Image, ) def list( @@ -157,7 +156,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageListResponse: + ) -> ImageList: """Retrieve an available images list. Returned entities owned by the project and @@ -215,7 +214,7 @@ def list( image_list_params.ImageListParams, ), ), - cast_to=ImageListResponse, + cast_to=ImageList, ) def delete( @@ -376,7 +375,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageGetResponse: + ) -> Image: """ Get image @@ -416,7 +415,7 @@ def get( timeout=timeout, query=maybe_transform({"include_prices": include_prices}, image_get_params.ImageGetParams), ), - cast_to=ImageGetResponse, + cast_to=Image, ) def upload( @@ -566,7 +565,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageUpdateResponse: + ) -> Image: """ Update image fields @@ -632,7 +631,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ImageUpdateResponse, + cast_to=Image, ) async def list( @@ -651,7 +650,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageListResponse: + ) -> ImageList: """Retrieve an available images list. Returned entities owned by the project and @@ -709,7 +708,7 @@ async def list( image_list_params.ImageListParams, ), ), - cast_to=ImageListResponse, + cast_to=ImageList, ) async def delete( @@ -870,7 +869,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageGetResponse: + ) -> Image: """ Get image @@ -910,7 +909,7 @@ async def get( timeout=timeout, query=await async_maybe_transform({"include_prices": include_prices}, image_get_params.ImageGetParams), ), - cast_to=ImageGetResponse, + cast_to=Image, ) async def upload( diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index b2014bf4..9214b40a 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -4,6 +4,7 @@ from .tag import Tag as Tag from .task import Task as Task +from .image import Image as Image from .region import Region as Region from .secret import Secret as Secret from .subnet import Subnet as Subnet @@ -17,6 +18,7 @@ from .ip_ranges import IPRanges as IPRanges from .l7_policy import L7Policy as L7Policy from .file_share import FileShare as FileShare +from .image_list import ImageList as ImageList from .ip_version import IPVersion as IPVersion from .floating_ip import FloatingIP as FloatingIP from .http_method import HTTPMethod as HTTPMethod diff --git a/src/gcore/types/cloud/baremetal/__init__.py b/src/gcore/types/cloud/baremetal/__init__.py index aec0d07f..fa9f1b7f 100644 --- a/src/gcore/types/cloud/baremetal/__init__.py +++ b/src/gcore/types/cloud/baremetal/__init__.py @@ -6,7 +6,6 @@ from .image_list_params import ImageListParams as ImageListParams from .flavor_list_params import FlavorListParams as FlavorListParams from .server_list_params import ServerListParams as ServerListParams -from .image_list_response import ImageListResponse as ImageListResponse from .flavor_list_response import FlavorListResponse as FlavorListResponse from .server_create_params import ServerCreateParams as ServerCreateParams from .server_rebuild_params import ServerRebuildParams as ServerRebuildParams diff --git a/src/gcore/types/cloud/baremetal/image_list_response.py b/src/gcore/types/cloud/baremetal/image_list_response.py deleted file mode 100644 index f69cf576..00000000 --- a/src/gcore/types/cloud/baremetal/image_list_response.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ..tag import Tag -from ...._models import BaseModel - -__all__ = ["ImageListResponse", "Result"] - - -class Result(BaseModel): - id: str - """ - '#/components/schemas/ImageSerializer/properties/id' - "$.components.schemas.ImageSerializer.properties.id" - """ - - created_at: datetime - """ - '#/components/schemas/ImageSerializer/properties/created_at' - "$.components.schemas.ImageSerializer.properties.created_at" - """ - - disk_format: str - """ - '#/components/schemas/ImageSerializer/properties/disk_format' - "$.components.schemas.ImageSerializer.properties.disk_format" - """ - - min_disk: int - """ - '#/components/schemas/ImageSerializer/properties/min_disk' - "$.components.schemas.ImageSerializer.properties.min_disk" - """ - - min_ram: int - """ - '#/components/schemas/ImageSerializer/properties/min_ram' - "$.components.schemas.ImageSerializer.properties.min_ram" - """ - - name: str - """ - '#/components/schemas/ImageSerializer/properties/name' - "$.components.schemas.ImageSerializer.properties.name" - """ - - os_distro: str - """ - '#/components/schemas/ImageSerializer/properties/os_distro' - "$.components.schemas.ImageSerializer.properties.os_distro" - """ - - os_type: Literal["linux", "windows"] - """ - '#/components/schemas/ImageSerializer/properties/os_type' - "$.components.schemas.ImageSerializer.properties.os_type" - """ - - os_version: str - """ - '#/components/schemas/ImageSerializer/properties/os_version' - "$.components.schemas.ImageSerializer.properties.os_version" - """ - - project_id: int - """ - '#/components/schemas/ImageSerializer/properties/project_id' - "$.components.schemas.ImageSerializer.properties.project_id" - """ - - region: str - """ - '#/components/schemas/ImageSerializer/properties/region' - "$.components.schemas.ImageSerializer.properties.region" - """ - - region_id: int - """ - '#/components/schemas/ImageSerializer/properties/region_id' - "$.components.schemas.ImageSerializer.properties.region_id" - """ - - size: int - """ - '#/components/schemas/ImageSerializer/properties/size' - "$.components.schemas.ImageSerializer.properties.size" - """ - - status: str - """ - '#/components/schemas/ImageSerializer/properties/status' - "$.components.schemas.ImageSerializer.properties.status" - """ - - tags: List[Tag] - """ - '#/components/schemas/ImageSerializer/properties/tags' - "$.components.schemas.ImageSerializer.properties.tags" - """ - - updated_at: datetime - """ - '#/components/schemas/ImageSerializer/properties/updated_at' - "$.components.schemas.ImageSerializer.properties.updated_at" - """ - - visibility: str - """ - '#/components/schemas/ImageSerializer/properties/visibility' - "$.components.schemas.ImageSerializer.properties.visibility" - """ - - architecture: Optional[Literal["aarch64", "x86_64"]] = None - """ - '#/components/schemas/ImageSerializer/properties/architecture' - "$.components.schemas.ImageSerializer.properties.architecture" - """ - - creator_task_id: Optional[str] = None - """ - '#/components/schemas/ImageSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.ImageSerializer.properties.creator_task_id.anyOf[0]" - """ - - description: Optional[str] = None - """ - '#/components/schemas/ImageSerializer/properties/description/anyOf/0' - "$.components.schemas.ImageSerializer.properties.description.anyOf[0]" - """ - - display_order: Optional[int] = None - """ - '#/components/schemas/ImageSerializer/properties/display_order/anyOf/0' - "$.components.schemas.ImageSerializer.properties.display_order.anyOf[0]" - """ - - hw_firmware_type: Optional[Literal["bios", "uefi"]] = None - """ - '#/components/schemas/ImageSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.ImageSerializer.properties.hw_firmware_type.anyOf[0]" - """ - - hw_machine_type: Optional[Literal["pc", "q35"]] = None - """ - '#/components/schemas/ImageSerializer/properties/hw_machine_type/anyOf/0' - "$.components.schemas.ImageSerializer.properties.hw_machine_type.anyOf[0]" - """ - - is_baremetal: Optional[bool] = None - """ - '#/components/schemas/ImageSerializer/properties/is_baremetal/anyOf/0' - "$.components.schemas.ImageSerializer.properties.is_baremetal.anyOf[0]" - """ - - ssh_key: Optional[Literal["allow", "deny", "required"]] = None - """ - '#/components/schemas/ImageSerializer/properties/ssh_key/anyOf/0' - "$.components.schemas.ImageSerializer.properties.ssh_key.anyOf[0]" - """ - - task_id: Optional[str] = None - """ - '#/components/schemas/ImageSerializer/properties/task_id/anyOf/0' - "$.components.schemas.ImageSerializer.properties.task_id.anyOf[0]" - """ - - -class ImageListResponse(BaseModel): - count: int - """ - '#/components/schemas/ImageCollectionSerializer/properties/count' - "$.components.schemas.ImageCollectionSerializer.properties.count" - """ - - results: List[Result] - """ - '#/components/schemas/ImageCollectionSerializer/properties/results' - "$.components.schemas.ImageCollectionSerializer.properties.results" - """ diff --git a/src/gcore/types/cloud/instances/image_get_response.py b/src/gcore/types/cloud/image.py similarity index 97% rename from src/gcore/types/cloud/instances/image_get_response.py rename to src/gcore/types/cloud/image.py index a050bab7..d6e4a93f 100644 --- a/src/gcore/types/cloud/instances/image_get_response.py +++ b/src/gcore/types/cloud/image.py @@ -4,13 +4,13 @@ from datetime import datetime from typing_extensions import Literal -from ..tag import Tag -from ...._models import BaseModel +from .tag import Tag +from ..._models import BaseModel -__all__ = ["ImageGetResponse"] +__all__ = ["Image"] -class ImageGetResponse(BaseModel): +class Image(BaseModel): id: str """ '#/components/schemas/ImageSerializer/properties/id' diff --git a/src/gcore/types/cloud/image_list.py b/src/gcore/types/cloud/image_list.py new file mode 100644 index 00000000..d5ac3e1f --- /dev/null +++ b/src/gcore/types/cloud/image_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .image import Image +from ..._models import BaseModel + +__all__ = ["ImageList"] + + +class ImageList(BaseModel): + count: int + """ + '#/components/schemas/ImageCollectionSerializer/properties/count' + "$.components.schemas.ImageCollectionSerializer.properties.count" + """ + + results: List[Image] + """ + '#/components/schemas/ImageCollectionSerializer/properties/results' + "$.components.schemas.ImageCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/instances/__init__.py b/src/gcore/types/cloud/instances/__init__.py index d47592e8..060c3b69 100644 --- a/src/gcore/types/cloud/instances/__init__.py +++ b/src/gcore/types/cloud/instances/__init__.py @@ -4,9 +4,6 @@ from .image_get_params import ImageGetParams as ImageGetParams from .image_list_params import ImageListParams as ImageListParams -from .image_get_response import ImageGetResponse as ImageGetResponse -from .image_list_response import ImageListResponse as ImageListResponse from .image_update_params import ImageUpdateParams as ImageUpdateParams from .image_upload_params import ImageUploadParams as ImageUploadParams -from .image_update_response import ImageUpdateResponse as ImageUpdateResponse from .image_create_from_volume_params import ImageCreateFromVolumeParams as ImageCreateFromVolumeParams diff --git a/src/gcore/types/cloud/instances/image_list_response.py b/src/gcore/types/cloud/instances/image_list_response.py deleted file mode 100644 index f69cf576..00000000 --- a/src/gcore/types/cloud/instances/image_list_response.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ..tag import Tag -from ...._models import BaseModel - -__all__ = ["ImageListResponse", "Result"] - - -class Result(BaseModel): - id: str - """ - '#/components/schemas/ImageSerializer/properties/id' - "$.components.schemas.ImageSerializer.properties.id" - """ - - created_at: datetime - """ - '#/components/schemas/ImageSerializer/properties/created_at' - "$.components.schemas.ImageSerializer.properties.created_at" - """ - - disk_format: str - """ - '#/components/schemas/ImageSerializer/properties/disk_format' - "$.components.schemas.ImageSerializer.properties.disk_format" - """ - - min_disk: int - """ - '#/components/schemas/ImageSerializer/properties/min_disk' - "$.components.schemas.ImageSerializer.properties.min_disk" - """ - - min_ram: int - """ - '#/components/schemas/ImageSerializer/properties/min_ram' - "$.components.schemas.ImageSerializer.properties.min_ram" - """ - - name: str - """ - '#/components/schemas/ImageSerializer/properties/name' - "$.components.schemas.ImageSerializer.properties.name" - """ - - os_distro: str - """ - '#/components/schemas/ImageSerializer/properties/os_distro' - "$.components.schemas.ImageSerializer.properties.os_distro" - """ - - os_type: Literal["linux", "windows"] - """ - '#/components/schemas/ImageSerializer/properties/os_type' - "$.components.schemas.ImageSerializer.properties.os_type" - """ - - os_version: str - """ - '#/components/schemas/ImageSerializer/properties/os_version' - "$.components.schemas.ImageSerializer.properties.os_version" - """ - - project_id: int - """ - '#/components/schemas/ImageSerializer/properties/project_id' - "$.components.schemas.ImageSerializer.properties.project_id" - """ - - region: str - """ - '#/components/schemas/ImageSerializer/properties/region' - "$.components.schemas.ImageSerializer.properties.region" - """ - - region_id: int - """ - '#/components/schemas/ImageSerializer/properties/region_id' - "$.components.schemas.ImageSerializer.properties.region_id" - """ - - size: int - """ - '#/components/schemas/ImageSerializer/properties/size' - "$.components.schemas.ImageSerializer.properties.size" - """ - - status: str - """ - '#/components/schemas/ImageSerializer/properties/status' - "$.components.schemas.ImageSerializer.properties.status" - """ - - tags: List[Tag] - """ - '#/components/schemas/ImageSerializer/properties/tags' - "$.components.schemas.ImageSerializer.properties.tags" - """ - - updated_at: datetime - """ - '#/components/schemas/ImageSerializer/properties/updated_at' - "$.components.schemas.ImageSerializer.properties.updated_at" - """ - - visibility: str - """ - '#/components/schemas/ImageSerializer/properties/visibility' - "$.components.schemas.ImageSerializer.properties.visibility" - """ - - architecture: Optional[Literal["aarch64", "x86_64"]] = None - """ - '#/components/schemas/ImageSerializer/properties/architecture' - "$.components.schemas.ImageSerializer.properties.architecture" - """ - - creator_task_id: Optional[str] = None - """ - '#/components/schemas/ImageSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.ImageSerializer.properties.creator_task_id.anyOf[0]" - """ - - description: Optional[str] = None - """ - '#/components/schemas/ImageSerializer/properties/description/anyOf/0' - "$.components.schemas.ImageSerializer.properties.description.anyOf[0]" - """ - - display_order: Optional[int] = None - """ - '#/components/schemas/ImageSerializer/properties/display_order/anyOf/0' - "$.components.schemas.ImageSerializer.properties.display_order.anyOf[0]" - """ - - hw_firmware_type: Optional[Literal["bios", "uefi"]] = None - """ - '#/components/schemas/ImageSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.ImageSerializer.properties.hw_firmware_type.anyOf[0]" - """ - - hw_machine_type: Optional[Literal["pc", "q35"]] = None - """ - '#/components/schemas/ImageSerializer/properties/hw_machine_type/anyOf/0' - "$.components.schemas.ImageSerializer.properties.hw_machine_type.anyOf[0]" - """ - - is_baremetal: Optional[bool] = None - """ - '#/components/schemas/ImageSerializer/properties/is_baremetal/anyOf/0' - "$.components.schemas.ImageSerializer.properties.is_baremetal.anyOf[0]" - """ - - ssh_key: Optional[Literal["allow", "deny", "required"]] = None - """ - '#/components/schemas/ImageSerializer/properties/ssh_key/anyOf/0' - "$.components.schemas.ImageSerializer.properties.ssh_key.anyOf[0]" - """ - - task_id: Optional[str] = None - """ - '#/components/schemas/ImageSerializer/properties/task_id/anyOf/0' - "$.components.schemas.ImageSerializer.properties.task_id.anyOf[0]" - """ - - -class ImageListResponse(BaseModel): - count: int - """ - '#/components/schemas/ImageCollectionSerializer/properties/count' - "$.components.schemas.ImageCollectionSerializer.properties.count" - """ - - results: List[Result] - """ - '#/components/schemas/ImageCollectionSerializer/properties/results' - "$.components.schemas.ImageCollectionSerializer.properties.results" - """ diff --git a/src/gcore/types/cloud/instances/image_update_response.py b/src/gcore/types/cloud/instances/image_update_response.py deleted file mode 100644 index 5e5dd33e..00000000 --- a/src/gcore/types/cloud/instances/image_update_response.py +++ /dev/null @@ -1,168 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ..tag import Tag -from ...._models import BaseModel - -__all__ = ["ImageUpdateResponse"] - - -class ImageUpdateResponse(BaseModel): - id: str - """ - '#/components/schemas/ImageSerializer/properties/id' - "$.components.schemas.ImageSerializer.properties.id" - """ - - created_at: datetime - """ - '#/components/schemas/ImageSerializer/properties/created_at' - "$.components.schemas.ImageSerializer.properties.created_at" - """ - - disk_format: str - """ - '#/components/schemas/ImageSerializer/properties/disk_format' - "$.components.schemas.ImageSerializer.properties.disk_format" - """ - - min_disk: int - """ - '#/components/schemas/ImageSerializer/properties/min_disk' - "$.components.schemas.ImageSerializer.properties.min_disk" - """ - - min_ram: int - """ - '#/components/schemas/ImageSerializer/properties/min_ram' - "$.components.schemas.ImageSerializer.properties.min_ram" - """ - - name: str - """ - '#/components/schemas/ImageSerializer/properties/name' - "$.components.schemas.ImageSerializer.properties.name" - """ - - os_distro: str - """ - '#/components/schemas/ImageSerializer/properties/os_distro' - "$.components.schemas.ImageSerializer.properties.os_distro" - """ - - os_type: Literal["linux", "windows"] - """ - '#/components/schemas/ImageSerializer/properties/os_type' - "$.components.schemas.ImageSerializer.properties.os_type" - """ - - os_version: str - """ - '#/components/schemas/ImageSerializer/properties/os_version' - "$.components.schemas.ImageSerializer.properties.os_version" - """ - - project_id: int - """ - '#/components/schemas/ImageSerializer/properties/project_id' - "$.components.schemas.ImageSerializer.properties.project_id" - """ - - region: str - """ - '#/components/schemas/ImageSerializer/properties/region' - "$.components.schemas.ImageSerializer.properties.region" - """ - - region_id: int - """ - '#/components/schemas/ImageSerializer/properties/region_id' - "$.components.schemas.ImageSerializer.properties.region_id" - """ - - size: int - """ - '#/components/schemas/ImageSerializer/properties/size' - "$.components.schemas.ImageSerializer.properties.size" - """ - - status: str - """ - '#/components/schemas/ImageSerializer/properties/status' - "$.components.schemas.ImageSerializer.properties.status" - """ - - tags: List[Tag] - """ - '#/components/schemas/ImageSerializer/properties/tags' - "$.components.schemas.ImageSerializer.properties.tags" - """ - - updated_at: datetime - """ - '#/components/schemas/ImageSerializer/properties/updated_at' - "$.components.schemas.ImageSerializer.properties.updated_at" - """ - - visibility: str - """ - '#/components/schemas/ImageSerializer/properties/visibility' - "$.components.schemas.ImageSerializer.properties.visibility" - """ - - architecture: Optional[Literal["aarch64", "x86_64"]] = None - """ - '#/components/schemas/ImageSerializer/properties/architecture' - "$.components.schemas.ImageSerializer.properties.architecture" - """ - - creator_task_id: Optional[str] = None - """ - '#/components/schemas/ImageSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.ImageSerializer.properties.creator_task_id.anyOf[0]" - """ - - description: Optional[str] = None - """ - '#/components/schemas/ImageSerializer/properties/description/anyOf/0' - "$.components.schemas.ImageSerializer.properties.description.anyOf[0]" - """ - - display_order: Optional[int] = None - """ - '#/components/schemas/ImageSerializer/properties/display_order/anyOf/0' - "$.components.schemas.ImageSerializer.properties.display_order.anyOf[0]" - """ - - hw_firmware_type: Optional[Literal["bios", "uefi"]] = None - """ - '#/components/schemas/ImageSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.ImageSerializer.properties.hw_firmware_type.anyOf[0]" - """ - - hw_machine_type: Optional[Literal["pc", "q35"]] = None - """ - '#/components/schemas/ImageSerializer/properties/hw_machine_type/anyOf/0' - "$.components.schemas.ImageSerializer.properties.hw_machine_type.anyOf[0]" - """ - - is_baremetal: Optional[bool] = None - """ - '#/components/schemas/ImageSerializer/properties/is_baremetal/anyOf/0' - "$.components.schemas.ImageSerializer.properties.is_baremetal.anyOf[0]" - """ - - ssh_key: Optional[Literal["allow", "deny", "required"]] = None - """ - '#/components/schemas/ImageSerializer/properties/ssh_key/anyOf/0' - "$.components.schemas.ImageSerializer.properties.ssh_key.anyOf[0]" - """ - - task_id: Optional[str] = None - """ - '#/components/schemas/ImageSerializer/properties/task_id/anyOf/0' - "$.components.schemas.ImageSerializer.properties.task_id.anyOf[0]" - """ diff --git a/tests/api_resources/cloud/baremetal/test_images.py b/tests/api_resources/cloud/baremetal/test_images.py index 97605521..bff7624d 100644 --- a/tests/api_resources/cloud/baremetal/test_images.py +++ b/tests/api_resources/cloud/baremetal/test_images.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.baremetal import ImageListResponse +from gcore.types.cloud import ImageList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -36,7 +36,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: tag_key_value="tag_key_value", visibility="private", ) - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -48,7 +48,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -60,7 +60,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +74,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -87,7 +87,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No tag_key_value="tag_key_value", visibility="private", ) - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -99,7 +99,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -111,6 +111,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/instances/test_images.py b/tests/api_resources/cloud/instances/test_images.py index 9c852bc5..7fee425e 100644 --- a/tests/api_resources/cloud/instances/test_images.py +++ b/tests/api_resources/cloud/instances/test_images.py @@ -9,12 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList -from gcore.types.cloud.instances import ( - ImageGetResponse, - ImageListResponse, - ImageUpdateResponse, -) +from gcore.types.cloud import Image, ImageList, TaskIDList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +24,7 @@ def test_method_update(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ImageUpdateResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: @@ -45,7 +40,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: ssh_key="allow", tags={"my-tag": "my-tag-value"}, ) - assert_matches_type(ImageUpdateResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: @@ -58,7 +53,7 @@ def test_raw_response_update(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(ImageUpdateResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: @@ -71,7 +66,7 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(ImageUpdateResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -90,7 +85,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -103,7 +98,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: tag_key_value="tag_key_value", visibility="private", ) - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -115,7 +110,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -127,7 +122,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -242,7 +237,7 @@ def test_method_get(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ImageGetResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Gcore) -> None: @@ -252,7 +247,7 @@ def test_method_get_with_all_params(self, client: Gcore) -> None: region_id=0, include_prices=True, ) - assert_matches_type(ImageGetResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -265,7 +260,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(ImageGetResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -278,7 +273,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = response.parse() - assert_matches_type(ImageGetResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -362,7 +357,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ImageUpdateResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: @@ -378,7 +373,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> ssh_key="allow", tags={"my-tag": "my-tag-value"}, ) - assert_matches_type(ImageUpdateResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @@ -391,7 +386,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(ImageUpdateResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: @@ -404,7 +399,7 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(ImageUpdateResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -423,7 +418,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -436,7 +431,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No tag_key_value="tag_key_value", visibility="private", ) - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -448,7 +443,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -460,7 +455,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(ImageListResponse, image, path=["response"]) + assert_matches_type(ImageList, image, path=["response"]) assert cast(Any, response.is_closed) is True @@ -575,7 +570,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ImageGetResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: @@ -585,7 +580,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> Non region_id=0, include_prices=True, ) - assert_matches_type(ImageGetResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -598,7 +593,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(ImageGetResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -611,7 +606,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" image = await response.parse() - assert_matches_type(ImageGetResponse, image, path=["response"]) + assert_matches_type(Image, image, path=["response"]) assert cast(Any, response.is_closed) is True From d58d5f8f50311f6681f39aa726f2f65d11cdfa78 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 12:13:48 +0000 Subject: [PATCH 082/592] GCLOUD2-18783 feat: Add cloud registries --- .stats.yml | 4 +- api.md | 65 ++ src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + .../resources/cloud/registries/__init__.py | 75 ++ .../resources/cloud/registries/artifacts.py | 331 +++++++ .../resources/cloud/registries/registries.py | 764 ++++++++++++++++ .../cloud/registries/repositories.py | 307 +++++++ src/gcore/resources/cloud/registries/tags.py | 226 +++++ src/gcore/resources/cloud/registries/users.py | 833 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 5 + src/gcore/types/cloud/registries/__init__.py | 14 + .../cloud/registries/registry_artifact.py | 59 ++ .../registries/registry_artifact_list.py | 22 + .../cloud/registries/registry_repository.py | 51 ++ .../registries/registry_repository_list.py | 22 + .../types/cloud/registries/registry_user.py | 46 + .../cloud/registries/registry_user_created.py | 52 ++ .../cloud/registries/registry_user_list.py | 22 + .../registries/user_create_multiple_params.py | 54 ++ .../cloud/registries/user_create_params.py | 45 + .../cloud/registries/user_update_params.py | 39 + src/gcore/types/cloud/registry.py | 57 ++ .../types/cloud/registry_create_params.py | 33 + src/gcore/types/cloud/registry_list.py | 22 + .../types/cloud/registry_resize_params.py | 27 + src/gcore/types/cloud/registry_tag.py | 45 + .../cloud/registries/__init__.py | 1 + .../cloud/registries/test_artifacts.py | 248 ++++++ .../cloud/registries/test_repositories.py | 196 +++++ .../cloud/registries/test_tags.py | 176 ++++ .../cloud/registries/test_users.py | 592 +++++++++++++ tests/api_resources/cloud/test_registries.py | 426 +++++++++ 33 files changed, 4903 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/registries/__init__.py create mode 100644 src/gcore/resources/cloud/registries/artifacts.py create mode 100644 src/gcore/resources/cloud/registries/registries.py create mode 100644 src/gcore/resources/cloud/registries/repositories.py create mode 100644 src/gcore/resources/cloud/registries/tags.py create mode 100644 src/gcore/resources/cloud/registries/users.py create mode 100644 src/gcore/types/cloud/registries/__init__.py create mode 100644 src/gcore/types/cloud/registries/registry_artifact.py create mode 100644 src/gcore/types/cloud/registries/registry_artifact_list.py create mode 100644 src/gcore/types/cloud/registries/registry_repository.py create mode 100644 src/gcore/types/cloud/registries/registry_repository_list.py create mode 100644 src/gcore/types/cloud/registries/registry_user.py create mode 100644 src/gcore/types/cloud/registries/registry_user_created.py create mode 100644 src/gcore/types/cloud/registries/registry_user_list.py create mode 100644 src/gcore/types/cloud/registries/user_create_multiple_params.py create mode 100644 src/gcore/types/cloud/registries/user_create_params.py create mode 100644 src/gcore/types/cloud/registries/user_update_params.py create mode 100644 src/gcore/types/cloud/registry.py create mode 100644 src/gcore/types/cloud/registry_create_params.py create mode 100644 src/gcore/types/cloud/registry_list.py create mode 100644 src/gcore/types/cloud/registry_resize_params.py create mode 100644 src/gcore/types/cloud/registry_tag.py create mode 100644 tests/api_resources/cloud/registries/__init__.py create mode 100644 tests/api_resources/cloud/registries/test_artifacts.py create mode 100644 tests/api_resources/cloud/registries/test_repositories.py create mode 100644 tests/api_resources/cloud/registries/test_tags.py create mode 100644 tests/api_resources/cloud/registries/test_users.py create mode 100644 tests/api_resources/cloud/test_registries.py diff --git a/.stats.yml b/.stats.yml index fe54c7f4..b55fb9a4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 171 +configured_endpoints: 187 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fd112571ef5f42061c9dee7ecc057c924513aa9e6b2c9e373e847b07eb19e315.yml openapi_spec_hash: 842d806607c522f6db146861c3d2ec62 -config_hash: bb82bee1aa2b5f1b265a9a22b6c7e4e7 +config_hash: d1a049f48b534175f273285f6f6376b6 diff --git a/api.md b/api.md index 234ee193..f9e42c7d 100644 --- a/api.md +++ b/api.md @@ -603,6 +603,71 @@ Methods: - client.cloud.instances.images.get(image_id, \*, project_id, region_id, \*\*params) -> Image - client.cloud.instances.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList +## Registries + +Types: + +```python +from gcore.types.cloud import Registry, RegistryList, RegistryTag +``` + +Methods: + +- client.cloud.registries.create(\*, project_id, region_id, \*\*params) -> Registry +- client.cloud.registries.list(\*, project_id, region_id) -> RegistryList +- client.cloud.registries.delete(registry_id, \*, project_id, region_id) -> None +- client.cloud.registries.get(registry_id, \*, project_id, region_id) -> Registry +- client.cloud.registries.resize(registry_id, \*, project_id, region_id, \*\*params) -> Registry + +### Repositories + +Types: + +```python +from gcore.types.cloud.registries import RegistryRepository, RegistryRepositoryList +``` + +Methods: + +- client.cloud.registries.repositories.list(registry_id, \*, project_id, region_id) -> RegistryRepositoryList +- client.cloud.registries.repositories.delete(repository_name, \*, project_id, region_id, registry_id) -> None + +### Artifacts + +Types: + +```python +from gcore.types.cloud.registries import RegistryArtifact, RegistryArtifactList +``` + +Methods: + +- client.cloud.registries.artifacts.list(repository_name, \*, project_id, region_id, registry_id) -> RegistryArtifactList +- client.cloud.registries.artifacts.delete(digest, \*, project_id, region_id, registry_id, repository_name) -> None + +### Tags + +Methods: + +- client.cloud.registries.tags.delete(tag_name, \*, project_id, region_id, registry_id, repository_name, digest) -> None + +### Users + +Types: + +```python +from gcore.types.cloud.registries import RegistryUser, RegistryUserCreated, RegistryUserList +``` + +Methods: + +- client.cloud.registries.users.create(registry_id, \*, project_id, region_id, \*\*params) -> RegistryUser +- 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.refresh_secret(user_id, \*, project_id, region_id, registry_id) -> None + ## FileShares Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index b79e01cf..19fb7cd2 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -112,6 +112,14 @@ IPRangesResourceWithStreamingResponse, AsyncIPRangesResourceWithStreamingResponse, ) +from .registries import ( + RegistriesResource, + AsyncRegistriesResource, + RegistriesResourceWithRawResponse, + AsyncRegistriesResourceWithRawResponse, + RegistriesResourceWithStreamingResponse, + AsyncRegistriesResourceWithStreamingResponse, +) from .file_shares import ( FileSharesResource, AsyncFileSharesResource, @@ -278,6 +286,12 @@ "AsyncInstancesResourceWithRawResponse", "InstancesResourceWithStreamingResponse", "AsyncInstancesResourceWithStreamingResponse", + "RegistriesResource", + "AsyncRegistriesResource", + "RegistriesResourceWithRawResponse", + "AsyncRegistriesResourceWithRawResponse", + "RegistriesResourceWithStreamingResponse", + "AsyncRegistriesResourceWithStreamingResponse", "FileSharesResource", "AsyncFileSharesResource", "FileSharesResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 112640c8..a38195c3 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -132,6 +132,14 @@ BillingReservationsResourceWithStreamingResponse, AsyncBillingReservationsResourceWithStreamingResponse, ) +from .registries.registries import ( + RegistriesResource, + AsyncRegistriesResource, + RegistriesResourceWithRawResponse, + AsyncRegistriesResourceWithRawResponse, + RegistriesResourceWithStreamingResponse, + AsyncRegistriesResourceWithStreamingResponse, +) from .file_shares.file_shares import ( FileSharesResource, AsyncFileSharesResource, @@ -241,6 +249,10 @@ def baremetal(self) -> BaremetalResource: def instances(self) -> InstancesResource: return InstancesResource(self._client) + @cached_property + def registries(self) -> RegistriesResource: + return RegistriesResource(self._client) + @cached_property def file_shares(self) -> FileSharesResource: return FileSharesResource(self._client) @@ -342,6 +354,10 @@ def baremetal(self) -> AsyncBaremetalResource: def instances(self) -> AsyncInstancesResource: return AsyncInstancesResource(self._client) + @cached_property + def registries(self) -> AsyncRegistriesResource: + return AsyncRegistriesResource(self._client) + @cached_property def file_shares(self) -> AsyncFileSharesResource: return AsyncFileSharesResource(self._client) @@ -446,6 +462,10 @@ def baremetal(self) -> BaremetalResourceWithRawResponse: def instances(self) -> InstancesResourceWithRawResponse: return InstancesResourceWithRawResponse(self._cloud.instances) + @cached_property + def registries(self) -> RegistriesResourceWithRawResponse: + return RegistriesResourceWithRawResponse(self._cloud.registries) + @cached_property def file_shares(self) -> FileSharesResourceWithRawResponse: return FileSharesResourceWithRawResponse(self._cloud.file_shares) @@ -531,6 +551,10 @@ def baremetal(self) -> AsyncBaremetalResourceWithRawResponse: def instances(self) -> AsyncInstancesResourceWithRawResponse: return AsyncInstancesResourceWithRawResponse(self._cloud.instances) + @cached_property + def registries(self) -> AsyncRegistriesResourceWithRawResponse: + return AsyncRegistriesResourceWithRawResponse(self._cloud.registries) + @cached_property def file_shares(self) -> AsyncFileSharesResourceWithRawResponse: return AsyncFileSharesResourceWithRawResponse(self._cloud.file_shares) @@ -616,6 +640,10 @@ def baremetal(self) -> BaremetalResourceWithStreamingResponse: def instances(self) -> InstancesResourceWithStreamingResponse: return InstancesResourceWithStreamingResponse(self._cloud.instances) + @cached_property + def registries(self) -> RegistriesResourceWithStreamingResponse: + return RegistriesResourceWithStreamingResponse(self._cloud.registries) + @cached_property def file_shares(self) -> FileSharesResourceWithStreamingResponse: return FileSharesResourceWithStreamingResponse(self._cloud.file_shares) @@ -701,6 +729,10 @@ def baremetal(self) -> AsyncBaremetalResourceWithStreamingResponse: def instances(self) -> AsyncInstancesResourceWithStreamingResponse: return AsyncInstancesResourceWithStreamingResponse(self._cloud.instances) + @cached_property + def registries(self) -> AsyncRegistriesResourceWithStreamingResponse: + return AsyncRegistriesResourceWithStreamingResponse(self._cloud.registries) + @cached_property def file_shares(self) -> AsyncFileSharesResourceWithStreamingResponse: return AsyncFileSharesResourceWithStreamingResponse(self._cloud.file_shares) diff --git a/src/gcore/resources/cloud/registries/__init__.py b/src/gcore/resources/cloud/registries/__init__.py new file mode 100644 index 00000000..92477d1a --- /dev/null +++ b/src/gcore/resources/cloud/registries/__init__.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .tags import ( + TagsResource, + AsyncTagsResource, + TagsResourceWithRawResponse, + AsyncTagsResourceWithRawResponse, + TagsResourceWithStreamingResponse, + AsyncTagsResourceWithStreamingResponse, +) +from .users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) +from .artifacts import ( + ArtifactsResource, + AsyncArtifactsResource, + ArtifactsResourceWithRawResponse, + AsyncArtifactsResourceWithRawResponse, + ArtifactsResourceWithStreamingResponse, + AsyncArtifactsResourceWithStreamingResponse, +) +from .registries import ( + RegistriesResource, + AsyncRegistriesResource, + RegistriesResourceWithRawResponse, + AsyncRegistriesResourceWithRawResponse, + RegistriesResourceWithStreamingResponse, + AsyncRegistriesResourceWithStreamingResponse, +) +from .repositories import ( + RepositoriesResource, + AsyncRepositoriesResource, + RepositoriesResourceWithRawResponse, + AsyncRepositoriesResourceWithRawResponse, + RepositoriesResourceWithStreamingResponse, + AsyncRepositoriesResourceWithStreamingResponse, +) + +__all__ = [ + "RepositoriesResource", + "AsyncRepositoriesResource", + "RepositoriesResourceWithRawResponse", + "AsyncRepositoriesResourceWithRawResponse", + "RepositoriesResourceWithStreamingResponse", + "AsyncRepositoriesResourceWithStreamingResponse", + "ArtifactsResource", + "AsyncArtifactsResource", + "ArtifactsResourceWithRawResponse", + "AsyncArtifactsResourceWithRawResponse", + "ArtifactsResourceWithStreamingResponse", + "AsyncArtifactsResourceWithStreamingResponse", + "TagsResource", + "AsyncTagsResource", + "TagsResourceWithRawResponse", + "AsyncTagsResourceWithRawResponse", + "TagsResourceWithStreamingResponse", + "AsyncTagsResourceWithStreamingResponse", + "UsersResource", + "AsyncUsersResource", + "UsersResourceWithRawResponse", + "AsyncUsersResourceWithRawResponse", + "UsersResourceWithStreamingResponse", + "AsyncUsersResourceWithStreamingResponse", + "RegistriesResource", + "AsyncRegistriesResource", + "RegistriesResourceWithRawResponse", + "AsyncRegistriesResourceWithRawResponse", + "RegistriesResourceWithStreamingResponse", + "AsyncRegistriesResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py new file mode 100644 index 00000000..628599cd --- /dev/null +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -0,0 +1,331 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.registries.registry_artifact_list import RegistryArtifactList + +__all__ = ["ArtifactsResource", "AsyncArtifactsResource"] + + +class ArtifactsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ArtifactsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return ArtifactsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ArtifactsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return ArtifactsResourceWithStreamingResponse(self) + + def list( + self, + repository_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_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, + ) -> RegistryArtifactList: + """ + List artifacts + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[2].schema" + + repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not repository_name: + raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") + return self._get( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryArtifactList, + ) + + def delete( + self, + digest: str, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_id: int, + repository_name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete an artifact + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[2].schema" + + repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[3].schema" + + digest: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/4/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[4].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not repository_name: + raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") + if not digest: + raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncArtifactsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncArtifactsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncArtifactsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncArtifactsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncArtifactsResourceWithStreamingResponse(self) + + async def list( + self, + repository_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_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, + ) -> RegistryArtifactList: + """ + List artifacts + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[2].schema" + + repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not repository_name: + raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") + return await self._get( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryArtifactList, + ) + + async def delete( + self, + digest: str, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_id: int, + repository_name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete an artifact + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[2].schema" + + repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[3].schema" + + digest: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/4/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[4].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not repository_name: + raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") + if not digest: + raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class ArtifactsResourceWithRawResponse: + def __init__(self, artifacts: ArtifactsResource) -> None: + self._artifacts = artifacts + + self.list = to_raw_response_wrapper( + artifacts.list, + ) + self.delete = to_raw_response_wrapper( + artifacts.delete, + ) + + +class AsyncArtifactsResourceWithRawResponse: + def __init__(self, artifacts: AsyncArtifactsResource) -> None: + self._artifacts = artifacts + + self.list = async_to_raw_response_wrapper( + artifacts.list, + ) + self.delete = async_to_raw_response_wrapper( + artifacts.delete, + ) + + +class ArtifactsResourceWithStreamingResponse: + def __init__(self, artifacts: ArtifactsResource) -> None: + self._artifacts = artifacts + + self.list = to_streamed_response_wrapper( + artifacts.list, + ) + self.delete = to_streamed_response_wrapper( + artifacts.delete, + ) + + +class AsyncArtifactsResourceWithStreamingResponse: + def __init__(self, artifacts: AsyncArtifactsResource) -> None: + self._artifacts = artifacts + + self.list = async_to_streamed_response_wrapper( + artifacts.list, + ) + self.delete = async_to_streamed_response_wrapper( + artifacts.delete, + ) diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py new file mode 100644 index 00000000..24161130 --- /dev/null +++ b/src/gcore/resources/cloud/registries/registries.py @@ -0,0 +1,764 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .tags import ( + TagsResource, + AsyncTagsResource, + TagsResourceWithRawResponse, + AsyncTagsResourceWithRawResponse, + TagsResourceWithStreamingResponse, + AsyncTagsResourceWithStreamingResponse, +) +from .users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from .artifacts import ( + ArtifactsResource, + AsyncArtifactsResource, + ArtifactsResourceWithRawResponse, + AsyncArtifactsResourceWithRawResponse, + ArtifactsResourceWithStreamingResponse, + AsyncArtifactsResourceWithStreamingResponse, +) +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 .repositories import ( + RepositoriesResource, + AsyncRepositoriesResource, + RepositoriesResourceWithRawResponse, + AsyncRepositoriesResourceWithRawResponse, + RepositoriesResourceWithStreamingResponse, + AsyncRepositoriesResourceWithStreamingResponse, +) +from ....types.cloud import registry_create_params, registry_resize_params +from ...._base_client import make_request_options +from ....types.cloud.registry import Registry +from ....types.cloud.registry_list import RegistryList + +__all__ = ["RegistriesResource", "AsyncRegistriesResource"] + + +class RegistriesResource(SyncAPIResource): + @cached_property + def repositories(self) -> RepositoriesResource: + return RepositoriesResource(self._client) + + @cached_property + def artifacts(self) -> ArtifactsResource: + return ArtifactsResource(self._client) + + @cached_property + def tags(self) -> TagsResource: + return TagsResource(self._client) + + @cached_property + def users(self) -> UsersResource: + return UsersResource(self._client) + + @cached_property + def with_raw_response(self) -> RegistriesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return RegistriesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RegistriesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return RegistriesResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + storage_limit: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Registry: + """ + Create a registry + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/RegistryCreateSerializer/properties/name' + "$.components.schemas.RegistryCreateSerializer.properties.name" + + storage_limit: '#/components/schemas/RegistryCreateSerializer/properties/storage_limit' + "$.components.schemas.RegistryCreateSerializer.properties.storage_limit" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/registries/{project_id}/{region_id}", + body=maybe_transform( + { + "name": name, + "storage_limit": storage_limit, + }, + registry_create_params.RegistryCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Registry, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegistryList: + """ + Get registry list + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/registries/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryList, + ) + + def delete( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a registry + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}']['delete'].parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Registry: + """ + Get a registry + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}'].get.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Registry, + ) + + def resize( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + storage_limit: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Registry: + """ + Resize a registry + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[2].schema" + + storage_limit: '#/components/schemas/RegistryResizeSerializer/properties/storage_limit' + "$.components.schemas.RegistryResizeSerializer.properties.storage_limit" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._patch( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + body=maybe_transform({"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Registry, + ) + + +class AsyncRegistriesResource(AsyncAPIResource): + @cached_property + def repositories(self) -> AsyncRepositoriesResource: + return AsyncRepositoriesResource(self._client) + + @cached_property + def artifacts(self) -> AsyncArtifactsResource: + return AsyncArtifactsResource(self._client) + + @cached_property + def tags(self) -> AsyncTagsResource: + return AsyncTagsResource(self._client) + + @cached_property + def users(self) -> AsyncUsersResource: + return AsyncUsersResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncRegistriesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRegistriesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRegistriesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncRegistriesResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + storage_limit: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Registry: + """ + Create a registry + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].post.parameters[1].schema" + + name: '#/components/schemas/RegistryCreateSerializer/properties/name' + "$.components.schemas.RegistryCreateSerializer.properties.name" + + storage_limit: '#/components/schemas/RegistryCreateSerializer/properties/storage_limit' + "$.components.schemas.RegistryCreateSerializer.properties.storage_limit" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/registries/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "name": name, + "storage_limit": storage_limit, + }, + registry_create_params.RegistryCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Registry, + ) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegistryList: + """ + Get registry list + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/registries/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryList, + ) + + async def delete( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a registry + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}']['delete'].parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Registry: + """ + Get a registry + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}'].get.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Registry, + ) + + async def resize( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + storage_limit: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Registry: + """ + Resize a registry + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[2].schema" + + storage_limit: '#/components/schemas/RegistryResizeSerializer/properties/storage_limit' + "$.components.schemas.RegistryResizeSerializer.properties.storage_limit" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._patch( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + body=await async_maybe_transform( + {"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Registry, + ) + + +class RegistriesResourceWithRawResponse: + def __init__(self, registries: RegistriesResource) -> None: + self._registries = registries + + self.create = to_raw_response_wrapper( + registries.create, + ) + self.list = to_raw_response_wrapper( + registries.list, + ) + self.delete = to_raw_response_wrapper( + registries.delete, + ) + self.get = to_raw_response_wrapper( + registries.get, + ) + self.resize = to_raw_response_wrapper( + registries.resize, + ) + + @cached_property + def repositories(self) -> RepositoriesResourceWithRawResponse: + return RepositoriesResourceWithRawResponse(self._registries.repositories) + + @cached_property + def artifacts(self) -> ArtifactsResourceWithRawResponse: + return ArtifactsResourceWithRawResponse(self._registries.artifacts) + + @cached_property + def tags(self) -> TagsResourceWithRawResponse: + return TagsResourceWithRawResponse(self._registries.tags) + + @cached_property + def users(self) -> UsersResourceWithRawResponse: + return UsersResourceWithRawResponse(self._registries.users) + + +class AsyncRegistriesResourceWithRawResponse: + def __init__(self, registries: AsyncRegistriesResource) -> None: + self._registries = registries + + self.create = async_to_raw_response_wrapper( + registries.create, + ) + self.list = async_to_raw_response_wrapper( + registries.list, + ) + self.delete = async_to_raw_response_wrapper( + registries.delete, + ) + self.get = async_to_raw_response_wrapper( + registries.get, + ) + self.resize = async_to_raw_response_wrapper( + registries.resize, + ) + + @cached_property + def repositories(self) -> AsyncRepositoriesResourceWithRawResponse: + return AsyncRepositoriesResourceWithRawResponse(self._registries.repositories) + + @cached_property + def artifacts(self) -> AsyncArtifactsResourceWithRawResponse: + return AsyncArtifactsResourceWithRawResponse(self._registries.artifacts) + + @cached_property + def tags(self) -> AsyncTagsResourceWithRawResponse: + return AsyncTagsResourceWithRawResponse(self._registries.tags) + + @cached_property + def users(self) -> AsyncUsersResourceWithRawResponse: + return AsyncUsersResourceWithRawResponse(self._registries.users) + + +class RegistriesResourceWithStreamingResponse: + def __init__(self, registries: RegistriesResource) -> None: + self._registries = registries + + self.create = to_streamed_response_wrapper( + registries.create, + ) + self.list = to_streamed_response_wrapper( + registries.list, + ) + self.delete = to_streamed_response_wrapper( + registries.delete, + ) + self.get = to_streamed_response_wrapper( + registries.get, + ) + self.resize = to_streamed_response_wrapper( + registries.resize, + ) + + @cached_property + def repositories(self) -> RepositoriesResourceWithStreamingResponse: + return RepositoriesResourceWithStreamingResponse(self._registries.repositories) + + @cached_property + def artifacts(self) -> ArtifactsResourceWithStreamingResponse: + return ArtifactsResourceWithStreamingResponse(self._registries.artifacts) + + @cached_property + def tags(self) -> TagsResourceWithStreamingResponse: + return TagsResourceWithStreamingResponse(self._registries.tags) + + @cached_property + def users(self) -> UsersResourceWithStreamingResponse: + return UsersResourceWithStreamingResponse(self._registries.users) + + +class AsyncRegistriesResourceWithStreamingResponse: + def __init__(self, registries: AsyncRegistriesResource) -> None: + self._registries = registries + + self.create = async_to_streamed_response_wrapper( + registries.create, + ) + self.list = async_to_streamed_response_wrapper( + registries.list, + ) + self.delete = async_to_streamed_response_wrapper( + registries.delete, + ) + self.get = async_to_streamed_response_wrapper( + registries.get, + ) + self.resize = async_to_streamed_response_wrapper( + registries.resize, + ) + + @cached_property + def repositories(self) -> AsyncRepositoriesResourceWithStreamingResponse: + return AsyncRepositoriesResourceWithStreamingResponse(self._registries.repositories) + + @cached_property + def artifacts(self) -> AsyncArtifactsResourceWithStreamingResponse: + return AsyncArtifactsResourceWithStreamingResponse(self._registries.artifacts) + + @cached_property + def tags(self) -> AsyncTagsResourceWithStreamingResponse: + return AsyncTagsResourceWithStreamingResponse(self._registries.tags) + + @cached_property + def users(self) -> AsyncUsersResourceWithStreamingResponse: + return AsyncUsersResourceWithStreamingResponse(self._registries.users) diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py new file mode 100644 index 00000000..72e5e818 --- /dev/null +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -0,0 +1,307 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.registries.registry_repository_list import RegistryRepositoryList + +__all__ = ["RepositoriesResource", "AsyncRepositoriesResource"] + + +class RepositoriesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RepositoriesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return RepositoriesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RepositoriesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return RepositoriesResourceWithStreamingResponse(self) + + def list( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegistryRepositoryList: + """ + List repositories + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories/get/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories/get/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories'].get.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories/get/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryRepositoryList, + ) + + def delete( + self, + repository_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a repository + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[2].schema" + + repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not repository_name: + raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncRepositoriesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRepositoriesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRepositoriesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRepositoriesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncRepositoriesResourceWithStreamingResponse(self) + + async def list( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegistryRepositoryList: + """ + List repositories + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories/get/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories/get/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories'].get.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories/get/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryRepositoryList, + ) + + async def delete( + self, + repository_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a repository + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[2].schema" + + repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not repository_name: + raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class RepositoriesResourceWithRawResponse: + def __init__(self, repositories: RepositoriesResource) -> None: + self._repositories = repositories + + self.list = to_raw_response_wrapper( + repositories.list, + ) + self.delete = to_raw_response_wrapper( + repositories.delete, + ) + + +class AsyncRepositoriesResourceWithRawResponse: + def __init__(self, repositories: AsyncRepositoriesResource) -> None: + self._repositories = repositories + + self.list = async_to_raw_response_wrapper( + repositories.list, + ) + self.delete = async_to_raw_response_wrapper( + repositories.delete, + ) + + +class RepositoriesResourceWithStreamingResponse: + def __init__(self, repositories: RepositoriesResource) -> None: + self._repositories = repositories + + self.list = to_streamed_response_wrapper( + repositories.list, + ) + self.delete = to_streamed_response_wrapper( + repositories.delete, + ) + + +class AsyncRepositoriesResourceWithStreamingResponse: + def __init__(self, repositories: AsyncRepositoriesResource) -> None: + self._repositories = repositories + + self.list = async_to_streamed_response_wrapper( + repositories.list, + ) + self.delete = async_to_streamed_response_wrapper( + repositories.delete, + ) diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py new file mode 100644 index 00000000..6c68261b --- /dev/null +++ b/src/gcore/resources/cloud/registries/tags.py @@ -0,0 +1,226 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options + +__all__ = ["TagsResource", "AsyncTagsResource"] + + +class TagsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TagsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return TagsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TagsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return TagsResourceWithStreamingResponse(self) + + def delete( + self, + tag_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_id: int, + repository_name: str, + digest: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a tag + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[2].schema" + + repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[3].schema" + + digest: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/4/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[4].schema" + + tag_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/5/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[5].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not repository_name: + raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") + if not digest: + raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") + if not tag_name: + raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncTagsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTagsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncTagsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTagsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncTagsResourceWithStreamingResponse(self) + + async def delete( + self, + tag_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_id: int, + repository_name: str, + digest: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a tag + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[2].schema" + + repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[3].schema" + + digest: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/4/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[4].schema" + + tag_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/5/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[5].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not repository_name: + raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") + if not digest: + raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") + if not tag_name: + raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class TagsResourceWithRawResponse: + def __init__(self, tags: TagsResource) -> None: + self._tags = tags + + self.delete = to_raw_response_wrapper( + tags.delete, + ) + + +class AsyncTagsResourceWithRawResponse: + def __init__(self, tags: AsyncTagsResource) -> None: + self._tags = tags + + self.delete = async_to_raw_response_wrapper( + tags.delete, + ) + + +class TagsResourceWithStreamingResponse: + def __init__(self, tags: TagsResource) -> None: + self._tags = tags + + self.delete = to_streamed_response_wrapper( + tags.delete, + ) + + +class AsyncTagsResourceWithStreamingResponse: + def __init__(self, tags: AsyncTagsResource) -> None: + self._tags = tags + + self.delete = async_to_streamed_response_wrapper( + tags.delete, + ) diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py new file mode 100644 index 00000000..ebb6bc7b --- /dev/null +++ b/src/gcore/resources/cloud/registries/users.py @@ -0,0 +1,833 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.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 + +__all__ = ["UsersResource", "AsyncUsersResource"] + + +class UsersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> UsersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return UsersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> UsersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return UsersResourceWithStreamingResponse(self) + + def create( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + duration: int, + name: str, + read_only: bool | NotGiven = NOT_GIVEN, + secret: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegistryUser: + """ + Create a user + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[2].schema" + + duration: '#/components/schemas/RegistryUserCreateSerializer/properties/duration' + "$.components.schemas.RegistryUserCreateSerializer.properties.duration" + + name: '#/components/schemas/RegistryUserCreateSerializer/properties/name' + "$.components.schemas.RegistryUserCreateSerializer.properties.name" + + read_only: '#/components/schemas/RegistryUserCreateSerializer/properties/read_only' + "$.components.schemas.RegistryUserCreateSerializer.properties.read_only" + + secret: '#/components/schemas/RegistryUserCreateSerializer/properties/secret' + "$.components.schemas.RegistryUserCreateSerializer.properties.secret" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + body=maybe_transform( + { + "duration": duration, + "name": name, + "read_only": read_only, + "secret": secret, + }, + user_create_params.UserCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryUser, + ) + + def update( + self, + user_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_id: int, + duration: int, + read_only: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegistryUser: + """ + Update a user + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[2].schema" + + user_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[3].schema" + + duration: '#/components/schemas/RegistryUserUpdateSerializer/properties/duration' + "$.components.schemas.RegistryUserUpdateSerializer.properties.duration" + + read_only: '#/components/schemas/RegistryUserUpdateSerializer/properties/read_only' + "$.components.schemas.RegistryUserUpdateSerializer.properties.read_only" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._patch( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + body=maybe_transform( + { + "duration": duration, + "read_only": read_only, + }, + user_update_params.UserUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryUser, + ) + + def list( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegistryUserList: + """ + Get user list + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/get/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/get/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].get.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/get/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryUserList, + ) + + def delete( + self, + user_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a user + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[2].schema" + + user_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def create_multiple( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + users: Iterable[user_create_multiple_params.User], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegistryUserCreated: + """ + Batch create users + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[2].schema" + + users: '#/components/schemas/RegistryBatchUsersCreateSerializer/properties/users' + "$.components.schemas.RegistryBatchUsersCreateSerializer.properties.users" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + body=maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryUserCreated, + ) + + def refresh_secret( + self, + user_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Refresh a secret + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[2].schema" + + user_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncUsersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncUsersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncUsersResourceWithStreamingResponse(self) + + async def create( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + duration: int, + name: str, + read_only: bool | NotGiven = NOT_GIVEN, + secret: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegistryUser: + """ + Create a user + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[2].schema" + + duration: '#/components/schemas/RegistryUserCreateSerializer/properties/duration' + "$.components.schemas.RegistryUserCreateSerializer.properties.duration" + + name: '#/components/schemas/RegistryUserCreateSerializer/properties/name' + "$.components.schemas.RegistryUserCreateSerializer.properties.name" + + read_only: '#/components/schemas/RegistryUserCreateSerializer/properties/read_only' + "$.components.schemas.RegistryUserCreateSerializer.properties.read_only" + + secret: '#/components/schemas/RegistryUserCreateSerializer/properties/secret' + "$.components.schemas.RegistryUserCreateSerializer.properties.secret" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + body=await async_maybe_transform( + { + "duration": duration, + "name": name, + "read_only": read_only, + "secret": secret, + }, + user_create_params.UserCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryUser, + ) + + async def update( + self, + user_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_id: int, + duration: int, + read_only: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegistryUser: + """ + Update a user + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[2].schema" + + user_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[3].schema" + + duration: '#/components/schemas/RegistryUserUpdateSerializer/properties/duration' + "$.components.schemas.RegistryUserUpdateSerializer.properties.duration" + + read_only: '#/components/schemas/RegistryUserUpdateSerializer/properties/read_only' + "$.components.schemas.RegistryUserUpdateSerializer.properties.read_only" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._patch( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + body=await async_maybe_transform( + { + "duration": duration, + "read_only": read_only, + }, + user_update_params.UserUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryUser, + ) + + async def list( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegistryUserList: + """ + Get user list + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/get/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/get/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].get.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/get/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryUserList, + ) + + async def delete( + self, + user_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a user + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[2].schema" + + user_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def create_multiple( + self, + registry_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + users: Iterable[user_create_multiple_params.User], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RegistryUserCreated: + """ + Batch create users + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[2].schema" + + users: '#/components/schemas/RegistryBatchUsersCreateSerializer/properties/users' + "$.components.schemas.RegistryBatchUsersCreateSerializer.properties.users" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + body=await async_maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegistryUserCreated, + ) + + async def refresh_secret( + self, + user_id: int, + *, + project_id: int | None = None, + region_id: int | None = None, + registry_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Refresh a secret + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[1].schema" + + registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[2].schema" + + user_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/3/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[3].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class UsersResourceWithRawResponse: + def __init__(self, users: UsersResource) -> None: + self._users = users + + self.create = to_raw_response_wrapper( + users.create, + ) + self.update = to_raw_response_wrapper( + users.update, + ) + self.list = to_raw_response_wrapper( + users.list, + ) + self.delete = to_raw_response_wrapper( + users.delete, + ) + self.create_multiple = to_raw_response_wrapper( + users.create_multiple, + ) + self.refresh_secret = to_raw_response_wrapper( + users.refresh_secret, + ) + + +class AsyncUsersResourceWithRawResponse: + def __init__(self, users: AsyncUsersResource) -> None: + self._users = users + + self.create = async_to_raw_response_wrapper( + users.create, + ) + self.update = async_to_raw_response_wrapper( + users.update, + ) + self.list = async_to_raw_response_wrapper( + users.list, + ) + self.delete = async_to_raw_response_wrapper( + users.delete, + ) + self.create_multiple = async_to_raw_response_wrapper( + users.create_multiple, + ) + self.refresh_secret = async_to_raw_response_wrapper( + users.refresh_secret, + ) + + +class UsersResourceWithStreamingResponse: + def __init__(self, users: UsersResource) -> None: + self._users = users + + self.create = to_streamed_response_wrapper( + users.create, + ) + self.update = to_streamed_response_wrapper( + users.update, + ) + self.list = to_streamed_response_wrapper( + users.list, + ) + self.delete = to_streamed_response_wrapper( + users.delete, + ) + self.create_multiple = to_streamed_response_wrapper( + users.create_multiple, + ) + self.refresh_secret = to_streamed_response_wrapper( + users.refresh_secret, + ) + + +class AsyncUsersResourceWithStreamingResponse: + def __init__(self, users: AsyncUsersResource) -> None: + self._users = users + + self.create = async_to_streamed_response_wrapper( + users.create, + ) + self.update = async_to_streamed_response_wrapper( + users.update, + ) + self.list = async_to_streamed_response_wrapper( + users.list, + ) + self.delete = async_to_streamed_response_wrapper( + users.delete, + ) + self.create_multiple = async_to_streamed_response_wrapper( + users.create_multiple, + ) + self.refresh_secret = async_to_streamed_response_wrapper( + users.refresh_secret, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 9214b40a..e969fcd0 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -15,6 +15,7 @@ from .project import Project as Project from .ssh_key import SSHKey as SSHKey from .capacity import Capacity as Capacity +from .registry import Registry as Registry from .ip_ranges import IPRanges as IPRanges from .l7_policy import L7Policy as L7Policy from .file_share import FileShare as FileShare @@ -28,10 +29,12 @@ from .ddos_profile import DDOSProfile as DDOSProfile from .l7_rule_list import L7RuleList as L7RuleList from .lb_algorithm import LbAlgorithm as LbAlgorithm +from .registry_tag import RegistryTag as RegistryTag from .task_id_list import TaskIDList as TaskIDList from .deploy_status import DeployStatus as DeployStatus from .load_balancer import LoadBalancer as LoadBalancer from .member_status import MemberStatus as MemberStatus +from .registry_list import RegistryList as RegistryList from .l7_policy_list import L7PolicyList as L7PolicyList from .lb_flavor_list import LbFlavorList as LbFlavorList from .security_group import SecurityGroup as SecurityGroup @@ -91,6 +94,8 @@ from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams +from .registry_create_params import RegistryCreateParams as RegistryCreateParams +from .registry_resize_params import RegistryResizeParams as RegistryResizeParams from .detailed_lb_pool_member import DetailedLbPoolMember as DetailedLbPoolMember from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams from .container_probe_http_get import ContainerProbeHTTPGet as ContainerProbeHTTPGet diff --git a/src/gcore/types/cloud/registries/__init__.py b/src/gcore/types/cloud/registries/__init__.py new file mode 100644 index 00000000..9b7535c7 --- /dev/null +++ b/src/gcore/types/cloud/registries/__init__.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .registry_user import RegistryUser as RegistryUser +from .registry_artifact import RegistryArtifact as RegistryArtifact +from .registry_user_list import RegistryUserList as RegistryUserList +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_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_artifact.py b/src/gcore/types/cloud/registries/registry_artifact.py new file mode 100644 index 00000000..9dbd1cc7 --- /dev/null +++ b/src/gcore/types/cloud/registries/registry_artifact.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime + +from ...._models import BaseModel +from ..registry_tag import RegistryTag + +__all__ = ["RegistryArtifact"] + + +class RegistryArtifact(BaseModel): + id: int + """ + '#/components/schemas/RegistryArtifactSerializer/properties/id' + "$.components.schemas.RegistryArtifactSerializer.properties.id" + """ + + digest: str + """ + '#/components/schemas/RegistryArtifactSerializer/properties/digest' + "$.components.schemas.RegistryArtifactSerializer.properties.digest" + """ + + pulled_at: datetime + """ + '#/components/schemas/RegistryArtifactSerializer/properties/pulled_at' + "$.components.schemas.RegistryArtifactSerializer.properties.pulled_at" + """ + + pushed_at: datetime + """ + '#/components/schemas/RegistryArtifactSerializer/properties/pushed_at' + "$.components.schemas.RegistryArtifactSerializer.properties.pushed_at" + """ + + registry_id: int + """ + '#/components/schemas/RegistryArtifactSerializer/properties/registry_id' + "$.components.schemas.RegistryArtifactSerializer.properties.registry_id" + """ + + repository_id: int + """ + '#/components/schemas/RegistryArtifactSerializer/properties/repository_id' + "$.components.schemas.RegistryArtifactSerializer.properties.repository_id" + """ + + size: int + """ + '#/components/schemas/RegistryArtifactSerializer/properties/size' + "$.components.schemas.RegistryArtifactSerializer.properties.size" + """ + + tags: List[RegistryTag] + """ + '#/components/schemas/RegistryArtifactSerializer/properties/tags' + "$.components.schemas.RegistryArtifactSerializer.properties.tags" + """ diff --git a/src/gcore/types/cloud/registries/registry_artifact_list.py b/src/gcore/types/cloud/registries/registry_artifact_list.py new file mode 100644 index 00000000..3c58aacc --- /dev/null +++ b/src/gcore/types/cloud/registries/registry_artifact_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .registry_artifact import RegistryArtifact + +__all__ = ["RegistryArtifactList"] + + +class RegistryArtifactList(BaseModel): + count: int + """ + '#/components/schemas/RegistryArtifactCollectionSerializer/properties/count' + "$.components.schemas.RegistryArtifactCollectionSerializer.properties.count" + """ + + results: List[RegistryArtifact] + """ + '#/components/schemas/RegistryArtifactCollectionSerializer/properties/results' + "$.components.schemas.RegistryArtifactCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/registries/registry_repository.py b/src/gcore/types/cloud/registries/registry_repository.py new file mode 100644 index 00000000..b17d23cf --- /dev/null +++ b/src/gcore/types/cloud/registries/registry_repository.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["RegistryRepository"] + + +class RegistryRepository(BaseModel): + id: int + """ + '#/components/schemas/RegistryRepositorySerializer/properties/id' + "$.components.schemas.RegistryRepositorySerializer.properties.id" + """ + + artifact_count: int + """ + '#/components/schemas/RegistryRepositorySerializer/properties/artifact_count' + "$.components.schemas.RegistryRepositorySerializer.properties.artifact_count" + """ + + created_at: datetime + """ + '#/components/schemas/RegistryRepositorySerializer/properties/created_at' + "$.components.schemas.RegistryRepositorySerializer.properties.created_at" + """ + + name: str + """ + '#/components/schemas/RegistryRepositorySerializer/properties/name' + "$.components.schemas.RegistryRepositorySerializer.properties.name" + """ + + pull_count: int + """ + '#/components/schemas/RegistryRepositorySerializer/properties/pull_count' + "$.components.schemas.RegistryRepositorySerializer.properties.pull_count" + """ + + registry_id: int + """ + '#/components/schemas/RegistryRepositorySerializer/properties/registry_id' + "$.components.schemas.RegistryRepositorySerializer.properties.registry_id" + """ + + updated_at: datetime + """ + '#/components/schemas/RegistryRepositorySerializer/properties/updated_at' + "$.components.schemas.RegistryRepositorySerializer.properties.updated_at" + """ diff --git a/src/gcore/types/cloud/registries/registry_repository_list.py b/src/gcore/types/cloud/registries/registry_repository_list.py new file mode 100644 index 00000000..88cbb721 --- /dev/null +++ b/src/gcore/types/cloud/registries/registry_repository_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .registry_repository import RegistryRepository + +__all__ = ["RegistryRepositoryList"] + + +class RegistryRepositoryList(BaseModel): + count: int + """ + '#/components/schemas/RegistryRepositoryCollectionSerializer/properties/count' + "$.components.schemas.RegistryRepositoryCollectionSerializer.properties.count" + """ + + results: List[RegistryRepository] + """ + '#/components/schemas/RegistryRepositoryCollectionSerializer/properties/results' + "$.components.schemas.RegistryRepositoryCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/registries/registry_user.py b/src/gcore/types/cloud/registries/registry_user.py new file mode 100644 index 00000000..4d509e69 --- /dev/null +++ b/src/gcore/types/cloud/registries/registry_user.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["RegistryUser"] + + +class RegistryUser(BaseModel): + id: int + """ + '#/components/schemas/RegistryUserSerializer/properties/id' + "$.components.schemas.RegistryUserSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/RegistryUserSerializer/properties/created_at' + "$.components.schemas.RegistryUserSerializer.properties.created_at" + """ + + duration: int + """ + '#/components/schemas/RegistryUserSerializer/properties/duration' + "$.components.schemas.RegistryUserSerializer.properties.duration" + """ + + expires_at: datetime + """ + '#/components/schemas/RegistryUserSerializer/properties/expires_at' + "$.components.schemas.RegistryUserSerializer.properties.expires_at" + """ + + name: str + """ + '#/components/schemas/RegistryUserSerializer/properties/name' + "$.components.schemas.RegistryUserSerializer.properties.name" + """ + + read_only: Optional[bool] = None + """ + '#/components/schemas/RegistryUserSerializer/properties/read_only' + "$.components.schemas.RegistryUserSerializer.properties.read_only" + """ diff --git a/src/gcore/types/cloud/registries/registry_user_created.py b/src/gcore/types/cloud/registries/registry_user_created.py new file mode 100644 index 00000000..27eaad01 --- /dev/null +++ b/src/gcore/types/cloud/registries/registry_user_created.py @@ -0,0 +1,52 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["RegistryUserCreated"] + + +class RegistryUserCreated(BaseModel): + id: int + """ + '#/components/schemas/RegistryUserCreateResponseSerializer/properties/id' + "$.components.schemas.RegistryUserCreateResponseSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/RegistryUserCreateResponseSerializer/properties/created_at' + "$.components.schemas.RegistryUserCreateResponseSerializer.properties.created_at" + """ + + duration: int + """ + '#/components/schemas/RegistryUserCreateResponseSerializer/properties/duration' + "$.components.schemas.RegistryUserCreateResponseSerializer.properties.duration" + """ + + expires_at: datetime + """ + '#/components/schemas/RegistryUserCreateResponseSerializer/properties/expires_at' + "$.components.schemas.RegistryUserCreateResponseSerializer.properties.expires_at" + """ + + name: str + """ + '#/components/schemas/RegistryUserCreateResponseSerializer/properties/name' + "$.components.schemas.RegistryUserCreateResponseSerializer.properties.name" + """ + + read_only: Optional[bool] = None + """ + '#/components/schemas/RegistryUserCreateResponseSerializer/properties/read_only' + "$.components.schemas.RegistryUserCreateResponseSerializer.properties.read_only" + """ + + secret: Optional[str] = None + """ + '#/components/schemas/RegistryUserCreateResponseSerializer/properties/secret' + "$.components.schemas.RegistryUserCreateResponseSerializer.properties.secret" + """ diff --git a/src/gcore/types/cloud/registries/registry_user_list.py b/src/gcore/types/cloud/registries/registry_user_list.py new file mode 100644 index 00000000..4a085aaf --- /dev/null +++ b/src/gcore/types/cloud/registries/registry_user_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .registry_user import RegistryUser + +__all__ = ["RegistryUserList"] + + +class RegistryUserList(BaseModel): + count: int + """ + '#/components/schemas/RegistryUserCollectionSerializer/properties/count' + "$.components.schemas.RegistryUserCollectionSerializer.properties.count" + """ + + results: List[RegistryUser] + """ + '#/components/schemas/RegistryUserCollectionSerializer/properties/results' + "$.components.schemas.RegistryUserCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/registries/user_create_multiple_params.py b/src/gcore/types/cloud/registries/user_create_multiple_params.py new file mode 100644 index 00000000..023d3799 --- /dev/null +++ b/src/gcore/types/cloud/registries/user_create_multiple_params.py @@ -0,0 +1,54 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["UserCreateMultipleParams", "User"] + + +class UserCreateMultipleParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[1].schema" + """ + + users: Required[Iterable[User]] + """ + '#/components/schemas/RegistryBatchUsersCreateSerializer/properties/users' + "$.components.schemas.RegistryBatchUsersCreateSerializer.properties.users" + """ + + +class User(TypedDict, total=False): + duration: Required[int] + """ + '#/components/schemas/RegistryUserCreateSerializer/properties/duration' + "$.components.schemas.RegistryUserCreateSerializer.properties.duration" + """ + + name: Required[str] + """ + '#/components/schemas/RegistryUserCreateSerializer/properties/name' + "$.components.schemas.RegistryUserCreateSerializer.properties.name" + """ + + read_only: bool + """ + '#/components/schemas/RegistryUserCreateSerializer/properties/read_only' + "$.components.schemas.RegistryUserCreateSerializer.properties.read_only" + """ + + secret: str + """ + '#/components/schemas/RegistryUserCreateSerializer/properties/secret' + "$.components.schemas.RegistryUserCreateSerializer.properties.secret" + """ diff --git a/src/gcore/types/cloud/registries/user_create_params.py b/src/gcore/types/cloud/registries/user_create_params.py new file mode 100644 index 00000000..dc191ac4 --- /dev/null +++ b/src/gcore/types/cloud/registries/user_create_params.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["UserCreateParams"] + + +class UserCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[1].schema" + """ + + duration: Required[int] + """ + '#/components/schemas/RegistryUserCreateSerializer/properties/duration' + "$.components.schemas.RegistryUserCreateSerializer.properties.duration" + """ + + name: Required[str] + """ + '#/components/schemas/RegistryUserCreateSerializer/properties/name' + "$.components.schemas.RegistryUserCreateSerializer.properties.name" + """ + + read_only: bool + """ + '#/components/schemas/RegistryUserCreateSerializer/properties/read_only' + "$.components.schemas.RegistryUserCreateSerializer.properties.read_only" + """ + + secret: str + """ + '#/components/schemas/RegistryUserCreateSerializer/properties/secret' + "$.components.schemas.RegistryUserCreateSerializer.properties.secret" + """ diff --git a/src/gcore/types/cloud/registries/user_update_params.py b/src/gcore/types/cloud/registries/user_update_params.py new file mode 100644 index 00000000..3a2eafb7 --- /dev/null +++ b/src/gcore/types/cloud/registries/user_update_params.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["UserUpdateParams"] + + +class UserUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[1].schema" + """ + + registry_id: Required[int] + """ + '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[2].schema" + """ + + duration: Required[int] + """ + '#/components/schemas/RegistryUserUpdateSerializer/properties/duration' + "$.components.schemas.RegistryUserUpdateSerializer.properties.duration" + """ + + read_only: bool + """ + '#/components/schemas/RegistryUserUpdateSerializer/properties/read_only' + "$.components.schemas.RegistryUserUpdateSerializer.properties.read_only" + """ diff --git a/src/gcore/types/cloud/registry.py b/src/gcore/types/cloud/registry.py new file mode 100644 index 00000000..53473474 --- /dev/null +++ b/src/gcore/types/cloud/registry.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["Registry"] + + +class Registry(BaseModel): + id: int + """ + '#/components/schemas/RegistrySerializer/properties/id' + "$.components.schemas.RegistrySerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/RegistrySerializer/properties/created_at' + "$.components.schemas.RegistrySerializer.properties.created_at" + """ + + name: str + """ + '#/components/schemas/RegistrySerializer/properties/name' + "$.components.schemas.RegistrySerializer.properties.name" + """ + + repo_count: int + """ + '#/components/schemas/RegistrySerializer/properties/repo_count' + "$.components.schemas.RegistrySerializer.properties.repo_count" + """ + + storage_limit: int + """ + '#/components/schemas/RegistrySerializer/properties/storage_limit' + "$.components.schemas.RegistrySerializer.properties.storage_limit" + """ + + storage_used: int + """ + '#/components/schemas/RegistrySerializer/properties/storage_used' + "$.components.schemas.RegistrySerializer.properties.storage_used" + """ + + updated_at: datetime + """ + '#/components/schemas/RegistrySerializer/properties/updated_at' + "$.components.schemas.RegistrySerializer.properties.updated_at" + """ + + url: str + """ + '#/components/schemas/RegistrySerializer/properties/url' + "$.components.schemas.RegistrySerializer.properties.url" + """ diff --git a/src/gcore/types/cloud/registry_create_params.py b/src/gcore/types/cloud/registry_create_params.py new file mode 100644 index 00000000..c79fd1ee --- /dev/null +++ b/src/gcore/types/cloud/registry_create_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RegistryCreateParams"] + + +class RegistryCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/RegistryCreateSerializer/properties/name' + "$.components.schemas.RegistryCreateSerializer.properties.name" + """ + + storage_limit: int + """ + '#/components/schemas/RegistryCreateSerializer/properties/storage_limit' + "$.components.schemas.RegistryCreateSerializer.properties.storage_limit" + """ diff --git a/src/gcore/types/cloud/registry_list.py b/src/gcore/types/cloud/registry_list.py new file mode 100644 index 00000000..9c7b56e2 --- /dev/null +++ b/src/gcore/types/cloud/registry_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .registry import Registry +from ..._models import BaseModel + +__all__ = ["RegistryList"] + + +class RegistryList(BaseModel): + count: int + """ + '#/components/schemas/RegistryCollectionSerializer/properties/count' + "$.components.schemas.RegistryCollectionSerializer.properties.count" + """ + + results: List[Registry] + """ + '#/components/schemas/RegistryCollectionSerializer/properties/results' + "$.components.schemas.RegistryCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/registry_resize_params.py b/src/gcore/types/cloud/registry_resize_params.py new file mode 100644 index 00000000..67051054 --- /dev/null +++ b/src/gcore/types/cloud/registry_resize_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["RegistryResizeParams"] + + +class RegistryResizeParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/0/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/1/schema' + "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[1].schema" + """ + + storage_limit: int + """ + '#/components/schemas/RegistryResizeSerializer/properties/storage_limit' + "$.components.schemas.RegistryResizeSerializer.properties.storage_limit" + """ diff --git a/src/gcore/types/cloud/registry_tag.py b/src/gcore/types/cloud/registry_tag.py new file mode 100644 index 00000000..1ff8acf2 --- /dev/null +++ b/src/gcore/types/cloud/registry_tag.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["RegistryTag"] + + +class RegistryTag(BaseModel): + id: int + """ + '#/components/schemas/RegistryTagSerializer/properties/id' + "$.components.schemas.RegistryTagSerializer.properties.id" + """ + + artifact_id: int + """ + '#/components/schemas/RegistryTagSerializer/properties/artifact_id' + "$.components.schemas.RegistryTagSerializer.properties.artifact_id" + """ + + name: str + """ + '#/components/schemas/RegistryTagSerializer/properties/name' + "$.components.schemas.RegistryTagSerializer.properties.name" + """ + + pulled_at: datetime + """ + '#/components/schemas/RegistryTagSerializer/properties/pulled_at' + "$.components.schemas.RegistryTagSerializer.properties.pulled_at" + """ + + pushed_at: datetime + """ + '#/components/schemas/RegistryTagSerializer/properties/pushed_at' + "$.components.schemas.RegistryTagSerializer.properties.pushed_at" + """ + + repository_id: int + """ + '#/components/schemas/RegistryTagSerializer/properties/repository_id' + "$.components.schemas.RegistryTagSerializer.properties.repository_id" + """ diff --git a/tests/api_resources/cloud/registries/__init__.py b/tests/api_resources/cloud/registries/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/registries/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/registries/test_artifacts.py b/tests/api_resources/cloud/registries/test_artifacts.py new file mode 100644 index 00000000..ab68f23d --- /dev/null +++ b/tests/api_resources/cloud/registries/test_artifacts.py @@ -0,0 +1,248 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.registries import RegistryArtifactList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestArtifacts: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + artifact = client.cloud.registries.artifacts.list( + repository_name="repository_name", + project_id=0, + region_id=0, + registry_id=0, + ) + assert_matches_type(RegistryArtifactList, artifact, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.registries.artifacts.with_raw_response.list( + repository_name="repository_name", + project_id=0, + region_id=0, + registry_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + artifact = response.parse() + assert_matches_type(RegistryArtifactList, artifact, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.registries.artifacts.with_streaming_response.list( + repository_name="repository_name", + project_id=0, + region_id=0, + registry_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + artifact = response.parse() + assert_matches_type(RegistryArtifactList, artifact, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `repository_name` but received ''"): + client.cloud.registries.artifacts.with_raw_response.list( + repository_name="", + project_id=0, + region_id=0, + registry_id=0, + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + artifact = client.cloud.registries.artifacts.delete( + digest="digest", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + ) + assert artifact is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.registries.artifacts.with_raw_response.delete( + digest="digest", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + artifact = response.parse() + assert artifact is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.registries.artifacts.with_streaming_response.delete( + digest="digest", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + artifact = response.parse() + assert artifact is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `repository_name` but received ''"): + client.cloud.registries.artifacts.with_raw_response.delete( + digest="digest", + project_id=0, + region_id=0, + registry_id=0, + repository_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `digest` but received ''"): + client.cloud.registries.artifacts.with_raw_response.delete( + digest="", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + ) + + +class TestAsyncArtifacts: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + artifact = await async_client.cloud.registries.artifacts.list( + repository_name="repository_name", + project_id=0, + region_id=0, + registry_id=0, + ) + assert_matches_type(RegistryArtifactList, artifact, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.artifacts.with_raw_response.list( + repository_name="repository_name", + project_id=0, + region_id=0, + registry_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + artifact = await response.parse() + assert_matches_type(RegistryArtifactList, artifact, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.artifacts.with_streaming_response.list( + repository_name="repository_name", + project_id=0, + region_id=0, + registry_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + artifact = await response.parse() + assert_matches_type(RegistryArtifactList, artifact, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `repository_name` but received ''"): + await async_client.cloud.registries.artifacts.with_raw_response.list( + repository_name="", + project_id=0, + region_id=0, + registry_id=0, + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + artifact = await async_client.cloud.registries.artifacts.delete( + digest="digest", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + ) + assert artifact is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.artifacts.with_raw_response.delete( + digest="digest", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + artifact = await response.parse() + assert artifact is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.artifacts.with_streaming_response.delete( + digest="digest", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + artifact = await response.parse() + assert artifact is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `repository_name` but received ''"): + await async_client.cloud.registries.artifacts.with_raw_response.delete( + digest="digest", + project_id=0, + region_id=0, + registry_id=0, + repository_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `digest` but received ''"): + await async_client.cloud.registries.artifacts.with_raw_response.delete( + digest="", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + ) diff --git a/tests/api_resources/cloud/registries/test_repositories.py b/tests/api_resources/cloud/registries/test_repositories.py new file mode 100644 index 00000000..6cb3d0c6 --- /dev/null +++ b/tests/api_resources/cloud/registries/test_repositories.py @@ -0,0 +1,196 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.registries import RegistryRepositoryList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRepositories: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + repository = client.cloud.registries.repositories.list( + registry_id=0, + project_id=0, + region_id=0, + ) + assert_matches_type(RegistryRepositoryList, repository, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.registries.repositories.with_raw_response.list( + registry_id=0, + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = response.parse() + assert_matches_type(RegistryRepositoryList, repository, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.registries.repositories.with_streaming_response.list( + registry_id=0, + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = response.parse() + assert_matches_type(RegistryRepositoryList, repository, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + repository = client.cloud.registries.repositories.delete( + repository_name="repository_name", + project_id=0, + region_id=0, + registry_id=0, + ) + assert repository is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.registries.repositories.with_raw_response.delete( + repository_name="repository_name", + project_id=0, + region_id=0, + registry_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = response.parse() + assert repository is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.registries.repositories.with_streaming_response.delete( + repository_name="repository_name", + project_id=0, + region_id=0, + registry_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = response.parse() + assert repository is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `repository_name` but received ''"): + client.cloud.registries.repositories.with_raw_response.delete( + repository_name="", + project_id=0, + region_id=0, + registry_id=0, + ) + + +class TestAsyncRepositories: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + repository = await async_client.cloud.registries.repositories.list( + registry_id=0, + project_id=0, + region_id=0, + ) + assert_matches_type(RegistryRepositoryList, repository, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.repositories.with_raw_response.list( + registry_id=0, + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = await response.parse() + assert_matches_type(RegistryRepositoryList, repository, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.repositories.with_streaming_response.list( + registry_id=0, + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = await response.parse() + assert_matches_type(RegistryRepositoryList, repository, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + repository = await async_client.cloud.registries.repositories.delete( + repository_name="repository_name", + project_id=0, + region_id=0, + registry_id=0, + ) + assert repository is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.repositories.with_raw_response.delete( + repository_name="repository_name", + project_id=0, + region_id=0, + registry_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + repository = await response.parse() + assert repository is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.repositories.with_streaming_response.delete( + repository_name="repository_name", + project_id=0, + region_id=0, + registry_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + repository = await response.parse() + assert repository is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `repository_name` but received ''"): + await async_client.cloud.registries.repositories.with_raw_response.delete( + repository_name="", + project_id=0, + region_id=0, + registry_id=0, + ) diff --git a/tests/api_resources/cloud/registries/test_tags.py b/tests/api_resources/cloud/registries/test_tags.py new file mode 100644 index 00000000..0999b260 --- /dev/null +++ b/tests/api_resources/cloud/registries/test_tags.py @@ -0,0 +1,176 @@ +# 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 + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTags: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + tag = client.cloud.registries.tags.delete( + tag_name="tag_name", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + digest="digest", + ) + assert tag is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.registries.tags.with_raw_response.delete( + tag_name="tag_name", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + digest="digest", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tag = response.parse() + assert tag is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.registries.tags.with_streaming_response.delete( + tag_name="tag_name", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + digest="digest", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tag = response.parse() + assert tag is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `repository_name` but received ''"): + client.cloud.registries.tags.with_raw_response.delete( + tag_name="tag_name", + project_id=0, + region_id=0, + registry_id=0, + repository_name="", + digest="digest", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `digest` but received ''"): + client.cloud.registries.tags.with_raw_response.delete( + tag_name="tag_name", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + digest="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag_name` but received ''"): + client.cloud.registries.tags.with_raw_response.delete( + tag_name="", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + digest="digest", + ) + + +class TestAsyncTags: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + tag = await async_client.cloud.registries.tags.delete( + tag_name="tag_name", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + digest="digest", + ) + assert tag is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.tags.with_raw_response.delete( + tag_name="tag_name", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + digest="digest", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tag = await response.parse() + assert tag is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.tags.with_streaming_response.delete( + tag_name="tag_name", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + digest="digest", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tag = await response.parse() + assert tag is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `repository_name` but received ''"): + await async_client.cloud.registries.tags.with_raw_response.delete( + tag_name="tag_name", + project_id=0, + region_id=0, + registry_id=0, + repository_name="", + digest="digest", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `digest` but received ''"): + await async_client.cloud.registries.tags.with_raw_response.delete( + tag_name="tag_name", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + digest="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag_name` but received ''"): + await async_client.cloud.registries.tags.with_raw_response.delete( + tag_name="", + project_id=0, + region_id=0, + registry_id=0, + repository_name="repository_name", + digest="digest", + ) diff --git a/tests/api_resources/cloud/registries/test_users.py b/tests/api_resources/cloud/registries/test_users.py new file mode 100644 index 00000000..30ea6d26 --- /dev/null +++ b/tests/api_resources/cloud/registries/test_users.py @@ -0,0 +1,592 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.registries import ( + RegistryUser, + RegistryUserList, + RegistryUserCreated, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestUsers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + user = client.cloud.registries.users.create( + registry_id=0, + project_id=0, + region_id=0, + duration=14, + name="user1", + ) + assert_matches_type(RegistryUser, user, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + user = client.cloud.registries.users.create( + registry_id=0, + project_id=0, + region_id=0, + duration=14, + name="user1", + read_only=False, + secret="secret", + ) + assert_matches_type(RegistryUser, user, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.registries.users.with_raw_response.create( + registry_id=0, + project_id=0, + region_id=0, + duration=14, + name="user1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(RegistryUser, user, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.registries.users.with_streaming_response.create( + registry_id=0, + project_id=0, + region_id=0, + duration=14, + name="user1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(RegistryUser, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + user = client.cloud.registries.users.update( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + duration=14, + ) + assert_matches_type(RegistryUser, user, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + user = client.cloud.registries.users.update( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + duration=14, + read_only=False, + ) + assert_matches_type(RegistryUser, user, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.registries.users.with_raw_response.update( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + duration=14, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(RegistryUser, user, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.registries.users.with_streaming_response.update( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + duration=14, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(RegistryUser, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + user = client.cloud.registries.users.list( + registry_id=0, + project_id=0, + region_id=0, + ) + assert_matches_type(RegistryUserList, user, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.registries.users.with_raw_response.list( + registry_id=0, + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(RegistryUserList, user, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.registries.users.with_streaming_response.list( + registry_id=0, + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(RegistryUserList, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + user = client.cloud.registries.users.delete( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + ) + assert user is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.registries.users.with_raw_response.delete( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert user is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.registries.users.with_streaming_response.delete( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert user is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_multiple(self, client: Gcore) -> None: + user = client.cloud.registries.users.create_multiple( + registry_id=0, + project_id=0, + region_id=0, + users=[ + { + "duration": -1, + "name": "user1", + } + ], + ) + assert_matches_type(RegistryUserCreated, user, path=["response"]) + + @parametrize + def test_raw_response_create_multiple(self, client: Gcore) -> None: + response = client.cloud.registries.users.with_raw_response.create_multiple( + registry_id=0, + project_id=0, + region_id=0, + users=[ + { + "duration": -1, + "name": "user1", + } + ], + ) + + 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"]) + + @parametrize + def test_streaming_response_create_multiple(self, client: Gcore) -> None: + with client.cloud.registries.users.with_streaming_response.create_multiple( + registry_id=0, + project_id=0, + region_id=0, + users=[ + { + "duration": -1, + "name": "user1", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(RegistryUserCreated, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_refresh_secret(self, client: Gcore) -> None: + user = client.cloud.registries.users.refresh_secret( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + ) + assert user is None + + @parametrize + def test_raw_response_refresh_secret(self, client: Gcore) -> None: + response = client.cloud.registries.users.with_raw_response.refresh_secret( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert user is None + + @parametrize + def test_streaming_response_refresh_secret(self, client: Gcore) -> None: + with client.cloud.registries.users.with_streaming_response.refresh_secret( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert user is None + + assert cast(Any, response.is_closed) is True + + +class TestAsyncUsers: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + user = await async_client.cloud.registries.users.create( + registry_id=0, + project_id=0, + region_id=0, + duration=14, + name="user1", + ) + assert_matches_type(RegistryUser, user, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + user = await async_client.cloud.registries.users.create( + registry_id=0, + project_id=0, + region_id=0, + duration=14, + name="user1", + read_only=False, + secret="secret", + ) + assert_matches_type(RegistryUser, user, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.users.with_raw_response.create( + registry_id=0, + project_id=0, + region_id=0, + duration=14, + name="user1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(RegistryUser, user, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.users.with_streaming_response.create( + registry_id=0, + project_id=0, + region_id=0, + duration=14, + name="user1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(RegistryUser, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + user = await async_client.cloud.registries.users.update( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + duration=14, + ) + assert_matches_type(RegistryUser, user, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + user = await async_client.cloud.registries.users.update( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + duration=14, + read_only=False, + ) + assert_matches_type(RegistryUser, user, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.users.with_raw_response.update( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + duration=14, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(RegistryUser, user, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.users.with_streaming_response.update( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + duration=14, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(RegistryUser, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + user = await async_client.cloud.registries.users.list( + registry_id=0, + project_id=0, + region_id=0, + ) + assert_matches_type(RegistryUserList, user, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.users.with_raw_response.list( + registry_id=0, + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(RegistryUserList, user, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.users.with_streaming_response.list( + registry_id=0, + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(RegistryUserList, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + user = await async_client.cloud.registries.users.delete( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + ) + assert user is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.users.with_raw_response.delete( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert user is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.users.with_streaming_response.delete( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert user is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_multiple(self, async_client: AsyncGcore) -> None: + user = await async_client.cloud.registries.users.create_multiple( + registry_id=0, + project_id=0, + region_id=0, + users=[ + { + "duration": -1, + "name": "user1", + } + ], + ) + assert_matches_type(RegistryUserCreated, user, path=["response"]) + + @parametrize + async def test_raw_response_create_multiple(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.users.with_raw_response.create_multiple( + registry_id=0, + project_id=0, + region_id=0, + users=[ + { + "duration": -1, + "name": "user1", + } + ], + ) + + 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"]) + + @parametrize + async def test_streaming_response_create_multiple(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.users.with_streaming_response.create_multiple( + registry_id=0, + project_id=0, + region_id=0, + users=[ + { + "duration": -1, + "name": "user1", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(RegistryUserCreated, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_refresh_secret(self, async_client: AsyncGcore) -> None: + user = await async_client.cloud.registries.users.refresh_secret( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + ) + assert user is None + + @parametrize + async def test_raw_response_refresh_secret(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.users.with_raw_response.refresh_secret( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert user is None + + @parametrize + async def test_streaming_response_refresh_secret(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.users.with_streaming_response.refresh_secret( + user_id=0, + project_id=0, + region_id=0, + registry_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert user is None + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_registries.py b/tests/api_resources/cloud/test_registries.py new file mode 100644 index 00000000..4fe48383 --- /dev/null +++ b/tests/api_resources/cloud/test_registries.py @@ -0,0 +1,426 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import Registry, RegistryList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRegistries: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + registry = client.cloud.registries.create( + project_id=0, + region_id=0, + name="reg-home1", + ) + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + registry = client.cloud.registries.create( + project_id=0, + region_id=0, + name="reg-home1", + storage_limit=5, + ) + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.registries.with_raw_response.create( + project_id=0, + region_id=0, + name="reg-home1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry = response.parse() + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.registries.with_streaming_response.create( + project_id=0, + region_id=0, + name="reg-home1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry = response.parse() + assert_matches_type(Registry, registry, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + registry = client.cloud.registries.list( + project_id=0, + region_id=0, + ) + assert_matches_type(RegistryList, registry, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.registries.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry = response.parse() + assert_matches_type(RegistryList, registry, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.registries.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry = response.parse() + assert_matches_type(RegistryList, registry, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + registry = client.cloud.registries.delete( + registry_id=0, + project_id=0, + region_id=0, + ) + assert registry is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.registries.with_raw_response.delete( + registry_id=0, + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry = response.parse() + assert registry is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.registries.with_streaming_response.delete( + registry_id=0, + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry = response.parse() + assert registry is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + registry = client.cloud.registries.get( + registry_id=0, + project_id=0, + region_id=0, + ) + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.registries.with_raw_response.get( + registry_id=0, + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry = response.parse() + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.registries.with_streaming_response.get( + registry_id=0, + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry = response.parse() + assert_matches_type(Registry, registry, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_resize(self, client: Gcore) -> None: + registry = client.cloud.registries.resize( + registry_id=0, + project_id=0, + region_id=0, + ) + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + def test_method_resize_with_all_params(self, client: Gcore) -> None: + registry = client.cloud.registries.resize( + registry_id=0, + project_id=0, + region_id=0, + storage_limit=5, + ) + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + def test_raw_response_resize(self, client: Gcore) -> None: + response = client.cloud.registries.with_raw_response.resize( + registry_id=0, + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry = response.parse() + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + def test_streaming_response_resize(self, client: Gcore) -> None: + with client.cloud.registries.with_streaming_response.resize( + registry_id=0, + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry = response.parse() + assert_matches_type(Registry, registry, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRegistries: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + registry = await async_client.cloud.registries.create( + project_id=0, + region_id=0, + name="reg-home1", + ) + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + registry = await async_client.cloud.registries.create( + project_id=0, + region_id=0, + name="reg-home1", + storage_limit=5, + ) + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.with_raw_response.create( + project_id=0, + region_id=0, + name="reg-home1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry = await response.parse() + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.with_streaming_response.create( + project_id=0, + region_id=0, + name="reg-home1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry = await response.parse() + assert_matches_type(Registry, registry, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + registry = await async_client.cloud.registries.list( + project_id=0, + region_id=0, + ) + assert_matches_type(RegistryList, registry, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry = await response.parse() + assert_matches_type(RegistryList, registry, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry = await response.parse() + assert_matches_type(RegistryList, registry, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + registry = await async_client.cloud.registries.delete( + registry_id=0, + project_id=0, + region_id=0, + ) + assert registry is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.with_raw_response.delete( + registry_id=0, + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry = await response.parse() + assert registry is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.with_streaming_response.delete( + registry_id=0, + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry = await response.parse() + assert registry is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + registry = await async_client.cloud.registries.get( + registry_id=0, + project_id=0, + region_id=0, + ) + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.with_raw_response.get( + registry_id=0, + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry = await response.parse() + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.with_streaming_response.get( + registry_id=0, + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry = await response.parse() + assert_matches_type(Registry, registry, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_resize(self, async_client: AsyncGcore) -> None: + registry = await async_client.cloud.registries.resize( + registry_id=0, + project_id=0, + region_id=0, + ) + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + async def test_method_resize_with_all_params(self, async_client: AsyncGcore) -> None: + registry = await async_client.cloud.registries.resize( + registry_id=0, + project_id=0, + region_id=0, + storage_limit=5, + ) + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.registries.with_raw_response.resize( + registry_id=0, + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + registry = await response.parse() + assert_matches_type(Registry, registry, path=["response"]) + + @parametrize + async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.registries.with_streaming_response.resize( + registry_id=0, + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + registry = await response.parse() + assert_matches_type(Registry, registry, path=["response"]) + + assert cast(Any, response.is_closed) is True From a2a2cbe4e29691b471c3061242e8d2c9af6d614d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 13:29:00 +0000 Subject: [PATCH 083/592] GCLOUD2-18782 Add gpu cloud resource --- .stats.yml | 4 +- api.md | 57 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + .../cloud/gpu_baremetal_clusters/__init__.py | 75 + .../cloud/gpu_baremetal_clusters/flavors.py | 221 +++ .../gpu_baremetal_clusters.py | 1336 +++++++++++++++++ .../cloud/gpu_baremetal_clusters/images.py | 610 ++++++++ .../gpu_baremetal_clusters/interfaces.py | 193 +++ .../cloud/gpu_baremetal_clusters/servers.py | 1328 ++++++++++++++++ src/gcore/types/cloud/__init__.py | 15 + src/gcore/types/cloud/console.py | 33 + .../types/cloud/gpu_baremetal_cluster.py | 170 +++ .../gpu_baremetal_cluster_create_params.py | 404 +++++ .../gpu_baremetal_cluster_delete_params.py | 39 + .../gpu_baremetal_cluster_list_params.py | 33 + .../gpu_baremetal_cluster_rebuild_params.py | 40 + .../gpu_baremetal_cluster_resize_params.py | 27 + .../cloud/gpu_baremetal_clusters/__init__.py | 9 + .../flavor_list_params.py | 34 + .../image_upload_params.py | 82 + .../server_attach_interface_params.py | 456 ++++++ .../server_delete_params.py | 33 + .../server_detach_interface_params.py | 33 + src/gcore/types/cloud/gpu_baremetal_flavor.py | 232 +++ .../types/cloud/gpu_baremetal_flavor_list.py | 22 + src/gcore/types/cloud/gpu_cluster_server.py | 459 ++++++ .../types/cloud/gpu_cluster_server_list.py | 22 + src/gcore/types/cloud/gpu_image.py | 107 ++ src/gcore/types/cloud/gpu_image_list.py | 22 + src/gcore/types/cloud/network_interface.py | 426 ++++++ .../types/cloud/network_interface_list.py | 22 + .../cloud/gpu_baremetal_clusters/__init__.py | 1 + .../gpu_baremetal_clusters/test_flavors.py | 110 ++ .../gpu_baremetal_clusters/test_images.py | 390 +++++ .../gpu_baremetal_clusters/test_interfaces.py | 114 ++ .../gpu_baremetal_clusters/test_servers.py | 1202 +++++++++++++++ .../cloud/test_gpu_baremetal_clusters.py | 1015 +++++++++++++ 38 files changed, 9420 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/gpu_baremetal_clusters/__init__.py create mode 100644 src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py create mode 100644 src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py create mode 100644 src/gcore/resources/cloud/gpu_baremetal_clusters/images.py create mode 100644 src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py create mode 100644 src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py create mode 100644 src/gcore/types/cloud/console.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_cluster.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_flavor.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_flavor_list.py create mode 100644 src/gcore/types/cloud/gpu_cluster_server.py create mode 100644 src/gcore/types/cloud/gpu_cluster_server_list.py create mode 100644 src/gcore/types/cloud/gpu_image.py create mode 100644 src/gcore/types/cloud/gpu_image_list.py create mode 100644 src/gcore/types/cloud/network_interface.py create mode 100644 src/gcore/types/cloud/network_interface_list.py create mode 100644 tests/api_resources/cloud/gpu_baremetal_clusters/__init__.py create mode 100644 tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py create mode 100644 tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py create mode 100644 tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py create mode 100644 tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py create mode 100644 tests/api_resources/cloud/test_gpu_baremetal_clusters.py diff --git a/.stats.yml b/.stats.yml index b55fb9a4..f7ecf0f9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 187 +configured_endpoints: 207 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fd112571ef5f42061c9dee7ecc057c924513aa9e6b2c9e373e847b07eb19e315.yml openapi_spec_hash: 842d806607c522f6db146861c3d2ec62 -config_hash: d1a049f48b534175f273285f6f6376b6 +config_hash: c348fbf7090d8e896780cb8cd3a808f5 diff --git a/api.md b/api.md index f9e42c7d..363e3707 100644 --- a/api.md +++ b/api.md @@ -14,6 +14,10 @@ from gcore.types.cloud import ( FlavorHardwareDescription, FloatingIP, FloatingIPStatus, + GPUClusterServer, + GPUClusterServerList, + GPUImage, + GPUImageList, Image, ImageList, InstanceMetricsTimeUnit, @@ -25,6 +29,8 @@ from gcore.types.cloud import ( LoadBalancerOperatingStatus, LoadBalancerStatistics, Network, + NetworkInterface, + NetworkInterfaceList, ProvisioningStatus, Subnet, Tag, @@ -711,3 +717,54 @@ Methods: - client.cloud.billing_reservations.list(\*\*params) -> SyncOffsetPage[BillingReservation] - client.cloud.billing_reservations.get(reservation_id) -> BillingReservation + +## GPUBaremetalClusters + +Types: + +```python +from gcore.types.cloud import GPUBaremetalCluster, GPUBaremetalFlavor, GPUBaremetalFlavorList +``` + +Methods: + +- client.cloud.gpu_baremetal_clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalCluster] +- client.cloud.gpu_baremetal_clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.get(cluster_id, \*, project_id, region_id) -> GPUBaremetalCluster +- client.cloud.gpu_baremetal_clusters.powercycle_all_servers(cluster_id, \*, project_id, region_id) -> GPUClusterServerList +- client.cloud.gpu_baremetal_clusters.reboot_all_servers(cluster_id, \*, project_id, region_id) -> GPUClusterServerList +- client.cloud.gpu_baremetal_clusters.rebuild(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.resize(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList + +### Interfaces + +Methods: + +- client.cloud.gpu_baremetal_clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> NetworkInterfaceList + +### Servers + +Methods: + +- client.cloud.gpu_baremetal_clusters.servers.delete(instance_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.servers.attach_interface(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.servers.detach_interface(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.servers.get_console(instance_id, \*, project_id, region_id) -> Console +- client.cloud.gpu_baremetal_clusters.servers.powercycle(instance_id, \*, project_id, region_id) -> GPUClusterServer +- client.cloud.gpu_baremetal_clusters.servers.reboot(instance_id, \*, project_id, region_id) -> GPUClusterServer + +### Flavors + +Methods: + +- client.cloud.gpu_baremetal_clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUBaremetalFlavorList + +### Images + +Methods: + +- client.cloud.gpu_baremetal_clusters.images.list(\*, project_id, region_id) -> GPUImageList +- client.cloud.gpu_baremetal_clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage +- client.cloud.gpu_baremetal_clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 19fb7cd2..96dd527c 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -176,6 +176,14 @@ BillingReservationsResourceWithStreamingResponse, AsyncBillingReservationsResourceWithStreamingResponse, ) +from .gpu_baremetal_clusters import ( + GPUBaremetalClustersResource, + AsyncGPUBaremetalClustersResource, + GPUBaremetalClustersResourceWithRawResponse, + AsyncGPUBaremetalClustersResourceWithRawResponse, + GPUBaremetalClustersResourceWithStreamingResponse, + AsyncGPUBaremetalClustersResourceWithStreamingResponse, +) __all__ = [ "ProjectsResource", @@ -304,6 +312,12 @@ "AsyncBillingReservationsResourceWithRawResponse", "BillingReservationsResourceWithStreamingResponse", "AsyncBillingReservationsResourceWithStreamingResponse", + "GPUBaremetalClustersResource", + "AsyncGPUBaremetalClustersResource", + "GPUBaremetalClustersResourceWithRawResponse", + "AsyncGPUBaremetalClustersResourceWithRawResponse", + "GPUBaremetalClustersResourceWithStreamingResponse", + "AsyncGPUBaremetalClustersResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index a38195c3..d9740f20 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -172,6 +172,14 @@ ReservedFixedIPsResourceWithStreamingResponse, AsyncReservedFixedIPsResourceWithStreamingResponse, ) +from .gpu_baremetal_clusters.gpu_baremetal_clusters import ( + GPUBaremetalClustersResource, + AsyncGPUBaremetalClustersResource, + GPUBaremetalClustersResourceWithRawResponse, + AsyncGPUBaremetalClustersResourceWithRawResponse, + GPUBaremetalClustersResourceWithStreamingResponse, + AsyncGPUBaremetalClustersResourceWithStreamingResponse, +) __all__ = ["CloudResource", "AsyncCloudResource"] @@ -261,6 +269,10 @@ def file_shares(self) -> FileSharesResource: def billing_reservations(self) -> BillingReservationsResource: return BillingReservationsResource(self._client) + @cached_property + def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResource: + return GPUBaremetalClustersResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -366,6 +378,10 @@ def file_shares(self) -> AsyncFileSharesResource: def billing_reservations(self) -> AsyncBillingReservationsResource: return AsyncBillingReservationsResource(self._client) + @cached_property + def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResource: + return AsyncGPUBaremetalClustersResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -474,6 +490,10 @@ def file_shares(self) -> FileSharesResourceWithRawResponse: def billing_reservations(self) -> BillingReservationsResourceWithRawResponse: return BillingReservationsResourceWithRawResponse(self._cloud.billing_reservations) + @cached_property + def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithRawResponse: + return GPUBaremetalClustersResourceWithRawResponse(self._cloud.gpu_baremetal_clusters) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -563,6 +583,10 @@ def file_shares(self) -> AsyncFileSharesResourceWithRawResponse: def billing_reservations(self) -> AsyncBillingReservationsResourceWithRawResponse: return AsyncBillingReservationsResourceWithRawResponse(self._cloud.billing_reservations) + @cached_property + def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithRawResponse: + return AsyncGPUBaremetalClustersResourceWithRawResponse(self._cloud.gpu_baremetal_clusters) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -652,6 +676,10 @@ def file_shares(self) -> FileSharesResourceWithStreamingResponse: def billing_reservations(self) -> BillingReservationsResourceWithStreamingResponse: return BillingReservationsResourceWithStreamingResponse(self._cloud.billing_reservations) + @cached_property + def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithStreamingResponse: + return GPUBaremetalClustersResourceWithStreamingResponse(self._cloud.gpu_baremetal_clusters) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -740,3 +768,7 @@ def file_shares(self) -> AsyncFileSharesResourceWithStreamingResponse: @cached_property def billing_reservations(self) -> AsyncBillingReservationsResourceWithStreamingResponse: return AsyncBillingReservationsResourceWithStreamingResponse(self._cloud.billing_reservations) + + @cached_property + def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithStreamingResponse: + return AsyncGPUBaremetalClustersResourceWithStreamingResponse(self._cloud.gpu_baremetal_clusters) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/__init__.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/__init__.py new file mode 100644 index 00000000..ecfb4752 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/__init__.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .images import ( + ImagesResource, + AsyncImagesResource, + ImagesResourceWithRawResponse, + AsyncImagesResourceWithRawResponse, + ImagesResourceWithStreamingResponse, + AsyncImagesResourceWithStreamingResponse, +) +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .servers import ( + ServersResource, + AsyncServersResource, + ServersResourceWithRawResponse, + AsyncServersResourceWithRawResponse, + ServersResourceWithStreamingResponse, + AsyncServersResourceWithStreamingResponse, +) +from .interfaces import ( + InterfacesResource, + AsyncInterfacesResource, + InterfacesResourceWithRawResponse, + AsyncInterfacesResourceWithRawResponse, + InterfacesResourceWithStreamingResponse, + AsyncInterfacesResourceWithStreamingResponse, +) +from .gpu_baremetal_clusters import ( + GPUBaremetalClustersResource, + AsyncGPUBaremetalClustersResource, + GPUBaremetalClustersResourceWithRawResponse, + AsyncGPUBaremetalClustersResourceWithRawResponse, + GPUBaremetalClustersResourceWithStreamingResponse, + AsyncGPUBaremetalClustersResourceWithStreamingResponse, +) + +__all__ = [ + "InterfacesResource", + "AsyncInterfacesResource", + "InterfacesResourceWithRawResponse", + "AsyncInterfacesResourceWithRawResponse", + "InterfacesResourceWithStreamingResponse", + "AsyncInterfacesResourceWithStreamingResponse", + "ServersResource", + "AsyncServersResource", + "ServersResourceWithRawResponse", + "AsyncServersResourceWithRawResponse", + "ServersResourceWithStreamingResponse", + "AsyncServersResourceWithStreamingResponse", + "FlavorsResource", + "AsyncFlavorsResource", + "FlavorsResourceWithRawResponse", + "AsyncFlavorsResourceWithRawResponse", + "FlavorsResourceWithStreamingResponse", + "AsyncFlavorsResourceWithStreamingResponse", + "ImagesResource", + "AsyncImagesResource", + "ImagesResourceWithRawResponse", + "AsyncImagesResourceWithRawResponse", + "ImagesResourceWithStreamingResponse", + "AsyncImagesResourceWithStreamingResponse", + "GPUBaremetalClustersResource", + "AsyncGPUBaremetalClustersResource", + "GPUBaremetalClustersResourceWithRawResponse", + "AsyncGPUBaremetalClustersResourceWithRawResponse", + "GPUBaremetalClustersResourceWithStreamingResponse", + "AsyncGPUBaremetalClustersResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py new file mode 100644 index 00000000..266b4f85 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -0,0 +1,221 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.gpu_baremetal_clusters import flavor_list_params +from ....types.cloud.gpu_baremetal_flavor_list import GPUBaremetalFlavorList + +__all__ = ["FlavorsResource", "AsyncFlavorsResource"] + + +class FlavorsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FlavorsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return FlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return FlavorsResourceWithStreamingResponse(self) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + hide_disabled: Optional[bool] | NotGiven = NOT_GIVEN, + include_prices: Optional[bool] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUBaremetalFlavorList: + """ + List bare metal GPU flavors + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/0/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/1/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[1].schema" + + hide_disabled: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/2/schema/anyOf/0' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[2].schema.anyOf[0]" + + include_prices: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/3/schema/anyOf/0' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[3].schema.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "hide_disabled": hide_disabled, + "include_prices": include_prices, + }, + flavor_list_params.FlavorListParams, + ), + ), + cast_to=GPUBaremetalFlavorList, + ) + + +class AsyncFlavorsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFlavorsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncFlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncFlavorsResourceWithStreamingResponse(self) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + hide_disabled: Optional[bool] | NotGiven = NOT_GIVEN, + include_prices: Optional[bool] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUBaremetalFlavorList: + """ + List bare metal GPU flavors + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/0/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/1/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[1].schema" + + hide_disabled: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/2/schema/anyOf/0' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[2].schema.anyOf[0]" + + include_prices: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/3/schema/anyOf/0' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[3].schema.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "hide_disabled": hide_disabled, + "include_prices": include_prices, + }, + flavor_list_params.FlavorListParams, + ), + ), + cast_to=GPUBaremetalFlavorList, + ) + + +class FlavorsResourceWithRawResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_raw_response_wrapper( + flavors.list, + ) + + +class AsyncFlavorsResourceWithRawResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_raw_response_wrapper( + flavors.list, + ) + + +class FlavorsResourceWithStreamingResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_streamed_response_wrapper( + flavors.list, + ) + + +class AsyncFlavorsResourceWithStreamingResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_streamed_response_wrapper( + flavors.list, + ) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py new file mode 100644 index 00000000..f2a52b85 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -0,0 +1,1336 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional + +import httpx + +from .images import ( + ImagesResource, + AsyncImagesResource, + ImagesResourceWithRawResponse, + AsyncImagesResourceWithRawResponse, + ImagesResourceWithStreamingResponse, + AsyncImagesResourceWithStreamingResponse, +) +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .servers import ( + ServersResource, + AsyncServersResource, + ServersResourceWithRawResponse, + AsyncServersResourceWithRawResponse, + ServersResourceWithStreamingResponse, + AsyncServersResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from .interfaces import ( + InterfacesResource, + AsyncInterfacesResource, + InterfacesResourceWithRawResponse, + AsyncInterfacesResourceWithRawResponse, + InterfacesResourceWithStreamingResponse, + AsyncInterfacesResourceWithStreamingResponse, +) +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.cloud import ( + gpu_baremetal_cluster_list_params, + gpu_baremetal_cluster_create_params, + gpu_baremetal_cluster_delete_params, + gpu_baremetal_cluster_resize_params, + gpu_baremetal_cluster_rebuild_params, +) +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.gpu_baremetal_cluster import GPUBaremetalCluster +from ....types.cloud.gpu_cluster_server_list import GPUClusterServerList + +__all__ = ["GPUBaremetalClustersResource", "AsyncGPUBaremetalClustersResource"] + + +class GPUBaremetalClustersResource(SyncAPIResource): + @cached_property + def interfaces(self) -> InterfacesResource: + return InterfacesResource(self._client) + + @cached_property + def servers(self) -> ServersResource: + return ServersResource(self._client) + + @cached_property + def flavors(self) -> FlavorsResource: + return FlavorsResource(self._client) + + @cached_property + def images(self) -> ImagesResource: + return ImagesResource(self._client) + + @cached_property + def with_raw_response(self) -> GPUBaremetalClustersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return GPUBaremetalClustersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> GPUBaremetalClustersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return GPUBaremetalClustersResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: str | None = None, + region_id: str | None = None, + flavor: str, + image_id: str, + interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface], + name: str, + instances_count: int | NotGiven = NOT_GIVEN, + keypair_name: str | NotGiven = NOT_GIVEN, + password: str | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, + user_data: str | NotGiven = NOT_GIVEN, + username: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create a new GPU cluster. + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[1].schema" + + flavor: '#/components/schemas/CreateAIClusterGPUSerializer/properties/flavor' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.flavor" + + image_id: '#/components/schemas/CreateAIClusterGPUSerializer/properties/image_id' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.image_id" + + interfaces: '#/components/schemas/CreateAIClusterGPUSerializer/properties/interfaces' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.interfaces" + + name: '#/components/schemas/CreateAIClusterGPUSerializer/properties/name' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.name" + + instances_count: '#/components/schemas/CreateAIClusterGPUSerializer/properties/instances_count' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.instances_count" + + keypair_name: '#/components/schemas/CreateAIClusterGPUSerializer/properties/keypair_name' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.keypair_name" + + password: '#/components/schemas/CreateAIClusterGPUSerializer/properties/password' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.password" + + tags: '#/components/schemas/CreateAIClusterGPUSerializer/properties/tags' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.tags" + + user_data: '#/components/schemas/CreateAIClusterGPUSerializer/properties/user_data' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.user_data" + + username: '#/components/schemas/CreateAIClusterGPUSerializer/properties/username' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.username" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not region_id: + raise ValueError(f"Expected a non-empty value for `region_id` but received {region_id!r}") + return self._post( + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}", + body=maybe_transform( + { + "flavor": flavor, + "image_id": image_id, + "interfaces": interfaces, + "name": name, + "instances_count": instances_count, + "keypair_name": keypair_name, + "password": password, + "tags": tags, + "user_data": user_data, + "username": username, + }, + gpu_baremetal_cluster_create_params.GPUBaremetalClusterCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[GPUBaremetalCluster]: + """ + List GPU clusters + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[2]" + + offset: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get_api_list( + f"/cloud/v2/ai/clusters/{project_id}/{region_id}", + page=SyncOffsetPage[GPUBaremetalCluster], + 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, + }, + gpu_baremetal_cluster_list_params.GPUBaremetalClusterListParams, + ), + ), + model=GPUBaremetalCluster, + ) + + def delete( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + delete_floatings: bool | NotGiven = NOT_GIVEN, + floatings: str | NotGiven = NOT_GIVEN, + reserved_fixed_ips: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete GPU cluster + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[2].schema" + + delete_floatings: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/3' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[3]" + + floatings: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/4' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[4]" + + reserved_fixed_ips: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/5' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[5]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._delete( + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "delete_floatings": delete_floatings, + "floatings": floatings, + "reserved_fixed_ips": reserved_fixed_ips, + }, + gpu_baremetal_cluster_delete_params.GPUBaremetalClusterDeleteParams, + ), + ), + cast_to=TaskIDList, + ) + + def get( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUBaremetalCluster: + """ + Get GPU cluster + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}'].get.parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._get( + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUBaremetalCluster, + ) + + def powercycle_all_servers( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUClusterServerList: + """ + Powercycle (stop and start) all GPU cluster nodes, aka hard reboot + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fpowercycle/post/parameters/0/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fpowercycle/post/parameters/1/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle'].post.parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fpowercycle/post/parameters/2/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._post( + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUClusterServerList, + ) + + def reboot_all_servers( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUClusterServerList: + """ + Reboot all GPU cluster nodes + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Freboot/post/parameters/0/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Freboot/post/parameters/1/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot'].post.parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Freboot/post/parameters/2/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._post( + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUClusterServerList, + ) + + def rebuild( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + nodes: List[str], + image_id: Optional[str] | NotGiven = NOT_GIVEN, + user_data: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """Rebuild one or many nodes from GPU cluster. + + All cluster nodes need to be + provided to change the cluster image. + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[2].schema" + + nodes: '#/components/schemas/RebuildClusterSerializer/properties/nodes' + "$.components.schemas.RebuildClusterSerializer.properties.nodes" + + image_id: '#/components/schemas/RebuildClusterSerializer/properties/image_id/anyOf/0' + "$.components.schemas.RebuildClusterSerializer.properties.image_id.anyOf[0]" + + user_data: '#/components/schemas/RebuildClusterSerializer/properties/user_data/anyOf/0' + "$.components.schemas.RebuildClusterSerializer.properties.user_data.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._post( + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + body=maybe_transform( + { + "nodes": nodes, + "image_id": image_id, + "user_data": user_data, + }, + gpu_baremetal_cluster_rebuild_params.GPUBaremetalClusterRebuildParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def resize( + self, + cluster_id: str, + *, + project_id: str | None = None, + region_id: str | None = None, + instances_count: 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, + ) -> TaskIDList: + """ + Resize an existing AI GPU cluster. + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[2].schema" + + instances_count: '#/components/schemas/ResizeAIClusterGPUSerializerV1/properties/instances_count' + "$.components.schemas.ResizeAIClusterGPUSerializerV1.properties.instances_count" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not region_id: + raise ValueError(f"Expected a non-empty value for `region_id` but received {region_id!r}") + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._post( + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + body=maybe_transform( + {"instances_count": instances_count}, + gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncGPUBaremetalClustersResource(AsyncAPIResource): + @cached_property + def interfaces(self) -> AsyncInterfacesResource: + return AsyncInterfacesResource(self._client) + + @cached_property + def servers(self) -> AsyncServersResource: + return AsyncServersResource(self._client) + + @cached_property + def flavors(self) -> AsyncFlavorsResource: + return AsyncFlavorsResource(self._client) + + @cached_property + def images(self) -> AsyncImagesResource: + return AsyncImagesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncGPUBaremetalClustersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncGPUBaremetalClustersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncGPUBaremetalClustersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncGPUBaremetalClustersResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: str | None = None, + region_id: str | None = None, + flavor: str, + image_id: str, + interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface], + name: str, + instances_count: int | NotGiven = NOT_GIVEN, + keypair_name: str | NotGiven = NOT_GIVEN, + password: str | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, + user_data: str | NotGiven = NOT_GIVEN, + username: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create a new GPU cluster. + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[1].schema" + + flavor: '#/components/schemas/CreateAIClusterGPUSerializer/properties/flavor' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.flavor" + + image_id: '#/components/schemas/CreateAIClusterGPUSerializer/properties/image_id' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.image_id" + + interfaces: '#/components/schemas/CreateAIClusterGPUSerializer/properties/interfaces' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.interfaces" + + name: '#/components/schemas/CreateAIClusterGPUSerializer/properties/name' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.name" + + instances_count: '#/components/schemas/CreateAIClusterGPUSerializer/properties/instances_count' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.instances_count" + + keypair_name: '#/components/schemas/CreateAIClusterGPUSerializer/properties/keypair_name' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.keypair_name" + + password: '#/components/schemas/CreateAIClusterGPUSerializer/properties/password' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.password" + + tags: '#/components/schemas/CreateAIClusterGPUSerializer/properties/tags' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.tags" + + user_data: '#/components/schemas/CreateAIClusterGPUSerializer/properties/user_data' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.user_data" + + username: '#/components/schemas/CreateAIClusterGPUSerializer/properties/username' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.username" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not region_id: + raise ValueError(f"Expected a non-empty value for `region_id` but received {region_id!r}") + return await self._post( + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "flavor": flavor, + "image_id": image_id, + "interfaces": interfaces, + "name": name, + "instances_count": instances_count, + "keypair_name": keypair_name, + "password": password, + "tags": tags, + "user_data": user_data, + "username": username, + }, + gpu_baremetal_cluster_create_params.GPUBaremetalClusterCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[GPUBaremetalCluster, AsyncOffsetPage[GPUBaremetalCluster]]: + """ + List GPU clusters + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[1].schema" + + limit: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[2]" + + offset: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get_api_list( + f"/cloud/v2/ai/clusters/{project_id}/{region_id}", + page=AsyncOffsetPage[GPUBaremetalCluster], + 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, + }, + gpu_baremetal_cluster_list_params.GPUBaremetalClusterListParams, + ), + ), + model=GPUBaremetalCluster, + ) + + async def delete( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + delete_floatings: bool | NotGiven = NOT_GIVEN, + floatings: str | NotGiven = NOT_GIVEN, + reserved_fixed_ips: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete GPU cluster + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[2].schema" + + delete_floatings: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/3' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[3]" + + floatings: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/4' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[4]" + + reserved_fixed_ips: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/5' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[5]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._delete( + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "delete_floatings": delete_floatings, + "floatings": floatings, + "reserved_fixed_ips": reserved_fixed_ips, + }, + gpu_baremetal_cluster_delete_params.GPUBaremetalClusterDeleteParams, + ), + ), + cast_to=TaskIDList, + ) + + async def get( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUBaremetalCluster: + """ + Get GPU cluster + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}'].get.parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._get( + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUBaremetalCluster, + ) + + async def powercycle_all_servers( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUClusterServerList: + """ + Powercycle (stop and start) all GPU cluster nodes, aka hard reboot + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fpowercycle/post/parameters/0/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fpowercycle/post/parameters/1/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle'].post.parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fpowercycle/post/parameters/2/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._post( + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUClusterServerList, + ) + + async def reboot_all_servers( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUClusterServerList: + """ + Reboot all GPU cluster nodes + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Freboot/post/parameters/0/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Freboot/post/parameters/1/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot'].post.parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Freboot/post/parameters/2/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._post( + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUClusterServerList, + ) + + async def rebuild( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + nodes: List[str], + image_id: Optional[str] | NotGiven = NOT_GIVEN, + user_data: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """Rebuild one or many nodes from GPU cluster. + + All cluster nodes need to be + provided to change the cluster image. + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[2].schema" + + nodes: '#/components/schemas/RebuildClusterSerializer/properties/nodes' + "$.components.schemas.RebuildClusterSerializer.properties.nodes" + + image_id: '#/components/schemas/RebuildClusterSerializer/properties/image_id/anyOf/0' + "$.components.schemas.RebuildClusterSerializer.properties.image_id.anyOf[0]" + + user_data: '#/components/schemas/RebuildClusterSerializer/properties/user_data/anyOf/0' + "$.components.schemas.RebuildClusterSerializer.properties.user_data.anyOf[0]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._post( + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + body=await async_maybe_transform( + { + "nodes": nodes, + "image_id": image_id, + "user_data": user_data, + }, + gpu_baremetal_cluster_rebuild_params.GPUBaremetalClusterRebuildParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def resize( + self, + cluster_id: str, + *, + project_id: str | None = None, + region_id: str | None = None, + instances_count: 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, + ) -> TaskIDList: + """ + Resize an existing AI GPU cluster. + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[2].schema" + + instances_count: '#/components/schemas/ResizeAIClusterGPUSerializerV1/properties/instances_count' + "$.components.schemas.ResizeAIClusterGPUSerializerV1.properties.instances_count" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not region_id: + raise ValueError(f"Expected a non-empty value for `region_id` but received {region_id!r}") + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._post( + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + body=await async_maybe_transform( + {"instances_count": instances_count}, + gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class GPUBaremetalClustersResourceWithRawResponse: + def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None: + self._gpu_baremetal_clusters = gpu_baremetal_clusters + + self.create = to_raw_response_wrapper( + gpu_baremetal_clusters.create, + ) + self.list = to_raw_response_wrapper( + gpu_baremetal_clusters.list, + ) + self.delete = to_raw_response_wrapper( + gpu_baremetal_clusters.delete, + ) + self.get = to_raw_response_wrapper( + gpu_baremetal_clusters.get, + ) + self.powercycle_all_servers = to_raw_response_wrapper( + gpu_baremetal_clusters.powercycle_all_servers, + ) + self.reboot_all_servers = to_raw_response_wrapper( + gpu_baremetal_clusters.reboot_all_servers, + ) + self.rebuild = to_raw_response_wrapper( + gpu_baremetal_clusters.rebuild, + ) + self.resize = to_raw_response_wrapper( + gpu_baremetal_clusters.resize, + ) + + @cached_property + def interfaces(self) -> InterfacesResourceWithRawResponse: + return InterfacesResourceWithRawResponse(self._gpu_baremetal_clusters.interfaces) + + @cached_property + def servers(self) -> ServersResourceWithRawResponse: + return ServersResourceWithRawResponse(self._gpu_baremetal_clusters.servers) + + @cached_property + def flavors(self) -> FlavorsResourceWithRawResponse: + return FlavorsResourceWithRawResponse(self._gpu_baremetal_clusters.flavors) + + @cached_property + def images(self) -> ImagesResourceWithRawResponse: + return ImagesResourceWithRawResponse(self._gpu_baremetal_clusters.images) + + +class AsyncGPUBaremetalClustersResourceWithRawResponse: + def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> None: + self._gpu_baremetal_clusters = gpu_baremetal_clusters + + self.create = async_to_raw_response_wrapper( + gpu_baremetal_clusters.create, + ) + self.list = async_to_raw_response_wrapper( + gpu_baremetal_clusters.list, + ) + self.delete = async_to_raw_response_wrapper( + gpu_baremetal_clusters.delete, + ) + self.get = async_to_raw_response_wrapper( + gpu_baremetal_clusters.get, + ) + self.powercycle_all_servers = async_to_raw_response_wrapper( + gpu_baremetal_clusters.powercycle_all_servers, + ) + self.reboot_all_servers = async_to_raw_response_wrapper( + gpu_baremetal_clusters.reboot_all_servers, + ) + self.rebuild = async_to_raw_response_wrapper( + gpu_baremetal_clusters.rebuild, + ) + self.resize = async_to_raw_response_wrapper( + gpu_baremetal_clusters.resize, + ) + + @cached_property + def interfaces(self) -> AsyncInterfacesResourceWithRawResponse: + return AsyncInterfacesResourceWithRawResponse(self._gpu_baremetal_clusters.interfaces) + + @cached_property + def servers(self) -> AsyncServersResourceWithRawResponse: + return AsyncServersResourceWithRawResponse(self._gpu_baremetal_clusters.servers) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithRawResponse: + return AsyncFlavorsResourceWithRawResponse(self._gpu_baremetal_clusters.flavors) + + @cached_property + def images(self) -> AsyncImagesResourceWithRawResponse: + return AsyncImagesResourceWithRawResponse(self._gpu_baremetal_clusters.images) + + +class GPUBaremetalClustersResourceWithStreamingResponse: + def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None: + self._gpu_baremetal_clusters = gpu_baremetal_clusters + + self.create = to_streamed_response_wrapper( + gpu_baremetal_clusters.create, + ) + self.list = to_streamed_response_wrapper( + gpu_baremetal_clusters.list, + ) + self.delete = to_streamed_response_wrapper( + gpu_baremetal_clusters.delete, + ) + self.get = to_streamed_response_wrapper( + gpu_baremetal_clusters.get, + ) + self.powercycle_all_servers = to_streamed_response_wrapper( + gpu_baremetal_clusters.powercycle_all_servers, + ) + self.reboot_all_servers = to_streamed_response_wrapper( + gpu_baremetal_clusters.reboot_all_servers, + ) + self.rebuild = to_streamed_response_wrapper( + gpu_baremetal_clusters.rebuild, + ) + self.resize = to_streamed_response_wrapper( + gpu_baremetal_clusters.resize, + ) + + @cached_property + def interfaces(self) -> InterfacesResourceWithStreamingResponse: + return InterfacesResourceWithStreamingResponse(self._gpu_baremetal_clusters.interfaces) + + @cached_property + def servers(self) -> ServersResourceWithStreamingResponse: + return ServersResourceWithStreamingResponse(self._gpu_baremetal_clusters.servers) + + @cached_property + def flavors(self) -> FlavorsResourceWithStreamingResponse: + return FlavorsResourceWithStreamingResponse(self._gpu_baremetal_clusters.flavors) + + @cached_property + def images(self) -> ImagesResourceWithStreamingResponse: + return ImagesResourceWithStreamingResponse(self._gpu_baremetal_clusters.images) + + +class AsyncGPUBaremetalClustersResourceWithStreamingResponse: + def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> None: + self._gpu_baremetal_clusters = gpu_baremetal_clusters + + self.create = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.create, + ) + self.list = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.list, + ) + self.delete = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.delete, + ) + self.get = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.get, + ) + self.powercycle_all_servers = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.powercycle_all_servers, + ) + self.reboot_all_servers = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.reboot_all_servers, + ) + self.rebuild = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.rebuild, + ) + self.resize = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.resize, + ) + + @cached_property + def interfaces(self) -> AsyncInterfacesResourceWithStreamingResponse: + return AsyncInterfacesResourceWithStreamingResponse(self._gpu_baremetal_clusters.interfaces) + + @cached_property + def servers(self) -> AsyncServersResourceWithStreamingResponse: + return AsyncServersResourceWithStreamingResponse(self._gpu_baremetal_clusters.servers) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse: + return AsyncFlavorsResourceWithStreamingResponse(self._gpu_baremetal_clusters.flavors) + + @cached_property + def images(self) -> AsyncImagesResourceWithStreamingResponse: + return AsyncImagesResourceWithStreamingResponse(self._gpu_baremetal_clusters.images) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py new file mode 100644 index 00000000..d5dfc47d --- /dev/null +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -0,0 +1,610 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.gpu_image import GPUImage +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.gpu_image_list import GPUImageList +from ....types.cloud.gpu_baremetal_clusters import image_upload_params + +__all__ = ["ImagesResource", "AsyncImagesResource"] + + +class ImagesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ImagesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return ImagesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ImagesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return ImagesResourceWithStreamingResponse(self) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUImageList: + """ + List bare metal GPU images + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/get/parameters/0/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/get/parameters/1/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUImageList, + ) + + def delete( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete bare metal GPU image by ID + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}']['delete'].parameters[1].schema" + + image_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return self._delete( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUImage: + """ + Get bare metal GPU image by ID + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}'].get.parameters[1].schema" + + image_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return self._get( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUImage, + ) + + def upload( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + url: str, + architecture: Optional[Literal["aarch64", "x86_64"]] | NotGiven = NOT_GIVEN, + cow_format: bool | NotGiven = NOT_GIVEN, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, + os_distro: Optional[str] | NotGiven = NOT_GIVEN, + os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, + os_version: Optional[str] | NotGiven = NOT_GIVEN, + ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Upload new bare metal GPU image + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/post/parameters/0/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/post/parameters/1/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].post.parameters[1].schema" + + name: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/name' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.name" + + url: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/url/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.url.anyOf[0]" + + architecture: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/architecture/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.architecture.anyOf[0]" + + cow_format: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/cow_format' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.cow_format" + + hw_firmware_type: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.hw_firmware_type.anyOf[0]" + + os_distro: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_distro/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_distro.anyOf[0]" + + os_type: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_type/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_type.anyOf[0]" + + os_version: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_version/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_version.anyOf[0]" + + ssh_key: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/ssh_key' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.ssh_key" + + tags: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/tags' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.tags" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + body=maybe_transform( + { + "name": name, + "url": url, + "architecture": architecture, + "cow_format": cow_format, + "hw_firmware_type": hw_firmware_type, + "os_distro": os_distro, + "os_type": os_type, + "os_version": os_version, + "ssh_key": ssh_key, + "tags": tags, + }, + image_upload_params.ImageUploadParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncImagesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncImagesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncImagesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncImagesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncImagesResourceWithStreamingResponse(self) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUImageList: + """ + List bare metal GPU images + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/get/parameters/0/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/get/parameters/1/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].get.parameters[1].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUImageList, + ) + + async def delete( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete bare metal GPU image by ID + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}']['delete'].parameters[1].schema" + + image_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}']['delete'].parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return await self._delete( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUImage: + """ + Get bare metal GPU image by ID + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}'].get.parameters[1].schema" + + image_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return await self._get( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUImage, + ) + + async def upload( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + url: str, + architecture: Optional[Literal["aarch64", "x86_64"]] | NotGiven = NOT_GIVEN, + cow_format: bool | NotGiven = NOT_GIVEN, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, + os_distro: Optional[str] | NotGiven = NOT_GIVEN, + os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, + os_version: Optional[str] | NotGiven = NOT_GIVEN, + ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Upload new bare metal GPU image + + Args: + project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/post/parameters/0/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/post/parameters/1/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].post.parameters[1].schema" + + name: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/name' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.name" + + url: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/url/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.url.anyOf[0]" + + architecture: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/architecture/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.architecture.anyOf[0]" + + cow_format: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/cow_format' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.cow_format" + + hw_firmware_type: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.hw_firmware_type.anyOf[0]" + + os_distro: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_distro/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_distro.anyOf[0]" + + os_type: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_type/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_type.anyOf[0]" + + os_version: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_version/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_version.anyOf[0]" + + ssh_key: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/ssh_key' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.ssh_key" + + tags: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/tags' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.tags" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + body=await async_maybe_transform( + { + "name": name, + "url": url, + "architecture": architecture, + "cow_format": cow_format, + "hw_firmware_type": hw_firmware_type, + "os_distro": os_distro, + "os_type": os_type, + "os_version": os_version, + "ssh_key": ssh_key, + "tags": tags, + }, + image_upload_params.ImageUploadParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class ImagesResourceWithRawResponse: + def __init__(self, images: ImagesResource) -> None: + self._images = images + + self.list = to_raw_response_wrapper( + images.list, + ) + self.delete = to_raw_response_wrapper( + images.delete, + ) + self.get = to_raw_response_wrapper( + images.get, + ) + self.upload = to_raw_response_wrapper( + images.upload, + ) + + +class AsyncImagesResourceWithRawResponse: + def __init__(self, images: AsyncImagesResource) -> None: + self._images = images + + self.list = async_to_raw_response_wrapper( + images.list, + ) + self.delete = async_to_raw_response_wrapper( + images.delete, + ) + self.get = async_to_raw_response_wrapper( + images.get, + ) + self.upload = async_to_raw_response_wrapper( + images.upload, + ) + + +class ImagesResourceWithStreamingResponse: + def __init__(self, images: ImagesResource) -> None: + self._images = images + + self.list = to_streamed_response_wrapper( + images.list, + ) + self.delete = to_streamed_response_wrapper( + images.delete, + ) + self.get = to_streamed_response_wrapper( + images.get, + ) + self.upload = to_streamed_response_wrapper( + images.upload, + ) + + +class AsyncImagesResourceWithStreamingResponse: + def __init__(self, images: AsyncImagesResource) -> None: + self._images = images + + self.list = async_to_streamed_response_wrapper( + images.list, + ) + self.delete = async_to_streamed_response_wrapper( + images.delete, + ) + self.get = async_to_streamed_response_wrapper( + images.get, + ) + self.upload = async_to_streamed_response_wrapper( + images.upload, + ) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py new file mode 100644 index 00000000..6c4d7583 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -0,0 +1,193 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.network_interface_list import NetworkInterfaceList + +__all__ = ["InterfacesResource", "AsyncInterfacesResource"] + + +class InterfacesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InterfacesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return InterfacesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InterfacesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return InterfacesResourceWithStreamingResponse(self) + + def list( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> NetworkInterfaceList: + """ + List network interfaces attached to GPU cluster servers + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Finterfaces/get/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Finterfaces/get/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces'].get.parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Finterfaces/get/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._get( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NetworkInterfaceList, + ) + + +class AsyncInterfacesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInterfacesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncInterfacesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInterfacesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncInterfacesResourceWithStreamingResponse(self) + + async def list( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> NetworkInterfaceList: + """ + List network interfaces attached to GPU cluster servers + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Finterfaces/get/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Finterfaces/get/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces'].get.parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Finterfaces/get/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._get( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NetworkInterfaceList, + ) + + +class InterfacesResourceWithRawResponse: + def __init__(self, interfaces: InterfacesResource) -> None: + self._interfaces = interfaces + + self.list = to_raw_response_wrapper( + interfaces.list, + ) + + +class AsyncInterfacesResourceWithRawResponse: + def __init__(self, interfaces: AsyncInterfacesResource) -> None: + self._interfaces = interfaces + + self.list = async_to_raw_response_wrapper( + interfaces.list, + ) + + +class InterfacesResourceWithStreamingResponse: + def __init__(self, interfaces: InterfacesResource) -> None: + self._interfaces = interfaces + + self.list = to_streamed_response_wrapper( + interfaces.list, + ) + + +class AsyncInterfacesResourceWithStreamingResponse: + def __init__(self, interfaces: AsyncInterfacesResource) -> None: + self._interfaces = interfaces + + self.list = async_to_streamed_response_wrapper( + interfaces.list, + ) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py new file mode 100644 index 00000000..0c068ec1 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -0,0 +1,1328 @@ +# 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, overload + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.console import Console +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.gpu_cluster_server import GPUClusterServer +from ....types.cloud.gpu_baremetal_clusters import ( + server_delete_params, + server_attach_interface_params, + server_detach_interface_params, +) + +__all__ = ["ServersResource", "AsyncServersResource"] + + +class ServersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ServersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return ServersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ServersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return ServersResourceWithStreamingResponse(self) + + def delete( + self, + instance_id: str, + *, + project_id: str | None = None, + region_id: str | None = None, + cluster_id: str, + delete_floatings: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Remove single node from GPU cluster. + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[2].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[3].schema" + + delete_floatings: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/4' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[4]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not region_id: + raise ValueError(f"Expected a non-empty value for `region_id` but received {region_id!r}") + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._delete( + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"delete_floatings": delete_floatings}, server_delete_params.ServerDeleteParams), + ), + cast_to=TaskIDList, + ) + + @overload + def attach_interface( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to GPU cluster node + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + ddos_profile: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/interface_name' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.interface_name" + + ip_family: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ip_family' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ip_family" + + port_group: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/port_group' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/security_groups' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.security_groups" + + type: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/type' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def attach_interface( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to GPU cluster node + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + subnet_id: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/subnet_id' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.subnet_id" + + ddos_profile: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/interface_name' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.interface_name" + + port_group: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/port_group' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/security_groups' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.security_groups" + + type: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/type' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def attach_interface( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + network_id: str, + ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to GPU cluster node + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + network_id: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/network_id' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.network_id" + + ddos_profile: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/interface_name' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.interface_name" + + ip_family: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ip_family' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ip_family" + + port_group: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/port_group' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/security_groups' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.security_groups" + + type: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/type' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def attach_interface( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_id: str, + ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile + | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to GPU cluster node + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + port_id: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_id' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_id" + + ddos_profile: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/interface_name' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.interface_name" + + port_group: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_group' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/security_groups' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.security_groups" + + type: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/type' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + def attach_interface( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + subnet_id: str | NotGiven = NOT_GIVEN, + network_id: str | NotGiven = NOT_GIVEN, + port_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + body=maybe_transform( + { + "ddos_profile": ddos_profile, + "interface_name": interface_name, + "ip_family": ip_family, + "port_group": port_group, + "security_groups": security_groups, + "type": type, + "subnet_id": subnet_id, + "network_id": network_id, + "port_id": port_id, + }, + server_attach_interface_params.ServerAttachInterfaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def detach_interface( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ip_address: str, + port_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Detach interface from GPU cluster node + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[2].schema" + + ip_address: '#/components/schemas/PortIdWithIpSchema/properties/ip_address' + "$.components.schemas.PortIdWithIpSchema.properties.ip_address" + + port_id: '#/components/schemas/PortIdWithIpSchema/properties/port_id' + "$.components.schemas.PortIdWithIpSchema.properties.port_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + body=maybe_transform( + { + "ip_address": ip_address, + "port_id": port_id, + }, + server_detach_interface_params.ServerDetachInterfaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get_console( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Console: + """ + Get GPU cluster node console URL + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._get( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Console, + ) + + def powercycle( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUClusterServer: + """ + Powercycle (stop and start) one GPU cluster node, aka hard reboot + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fpowercycle/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fpowercycle/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fpowercycle/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUClusterServer, + ) + + def reboot( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUClusterServer: + """ + Reboot one GPU cluster node + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Freboot/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Freboot/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Freboot/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUClusterServer, + ) + + +class AsyncServersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncServersResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncServersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncServersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncServersResourceWithStreamingResponse(self) + + async def delete( + self, + instance_id: str, + *, + project_id: str | None = None, + region_id: str | None = None, + cluster_id: str, + delete_floatings: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Remove single node from GPU cluster. + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[1].schema" + + cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[2].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/3/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[3].schema" + + delete_floatings: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/4' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[4]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not region_id: + raise ValueError(f"Expected a non-empty value for `region_id` but received {region_id!r}") + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._delete( + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"delete_floatings": delete_floatings}, server_delete_params.ServerDeleteParams + ), + ), + cast_to=TaskIDList, + ) + + @overload + async def attach_interface( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to GPU cluster node + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + ddos_profile: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/interface_name' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.interface_name" + + ip_family: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ip_family' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ip_family" + + port_group: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/port_group' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/security_groups' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.security_groups" + + type: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/type' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def attach_interface( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to GPU cluster node + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + subnet_id: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/subnet_id' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.subnet_id" + + ddos_profile: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/interface_name' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.interface_name" + + port_group: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/port_group' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/security_groups' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.security_groups" + + type: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/type' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def attach_interface( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + network_id: str, + ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to GPU cluster node + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + network_id: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/network_id' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.network_id" + + ddos_profile: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/interface_name' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.interface_name" + + ip_family: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ip_family' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ip_family" + + port_group: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/port_group' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/security_groups' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.security_groups" + + type: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/type' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def attach_interface( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_id: str, + ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile + | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to GPU cluster node + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + port_id: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_id' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_id" + + ddos_profile: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/interface_name' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.interface_name" + + port_group: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_group' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/security_groups' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.security_groups" + + type: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/type' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + async def attach_interface( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + subnet_id: str | NotGiven = NOT_GIVEN, + network_id: str | NotGiven = NOT_GIVEN, + port_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + body=await async_maybe_transform( + { + "ddos_profile": ddos_profile, + "interface_name": interface_name, + "ip_family": ip_family, + "port_group": port_group, + "security_groups": security_groups, + "type": type, + "subnet_id": subnet_id, + "network_id": network_id, + "port_id": port_id, + }, + server_attach_interface_params.ServerAttachInterfaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def detach_interface( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ip_address: str, + port_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Detach interface from GPU cluster node + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[2].schema" + + ip_address: '#/components/schemas/PortIdWithIpSchema/properties/ip_address' + "$.components.schemas.PortIdWithIpSchema.properties.ip_address" + + port_id: '#/components/schemas/PortIdWithIpSchema/properties/port_id' + "$.components.schemas.PortIdWithIpSchema.properties.port_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + body=await async_maybe_transform( + { + "ip_address": ip_address, + "port_id": port_id, + }, + server_detach_interface_params.ServerDetachInterfaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get_console( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Console: + """ + Get GPU cluster node console URL + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._get( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Console, + ) + + async def powercycle( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUClusterServer: + """ + Powercycle (stop and start) one GPU cluster node, aka hard reboot + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fpowercycle/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fpowercycle/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fpowercycle/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUClusterServer, + ) + + async def reboot( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> GPUClusterServer: + """ + Reboot one GPU cluster node + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Freboot/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Freboot/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Freboot/post/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUClusterServer, + ) + + +class ServersResourceWithRawResponse: + def __init__(self, servers: ServersResource) -> None: + self._servers = servers + + self.delete = to_raw_response_wrapper( + servers.delete, + ) + self.attach_interface = to_raw_response_wrapper( + servers.attach_interface, + ) + self.detach_interface = to_raw_response_wrapper( + servers.detach_interface, + ) + self.get_console = to_raw_response_wrapper( + servers.get_console, + ) + self.powercycle = to_raw_response_wrapper( + servers.powercycle, + ) + self.reboot = to_raw_response_wrapper( + servers.reboot, + ) + + +class AsyncServersResourceWithRawResponse: + def __init__(self, servers: AsyncServersResource) -> None: + self._servers = servers + + self.delete = async_to_raw_response_wrapper( + servers.delete, + ) + self.attach_interface = async_to_raw_response_wrapper( + servers.attach_interface, + ) + self.detach_interface = async_to_raw_response_wrapper( + servers.detach_interface, + ) + self.get_console = async_to_raw_response_wrapper( + servers.get_console, + ) + self.powercycle = async_to_raw_response_wrapper( + servers.powercycle, + ) + self.reboot = async_to_raw_response_wrapper( + servers.reboot, + ) + + +class ServersResourceWithStreamingResponse: + def __init__(self, servers: ServersResource) -> None: + self._servers = servers + + self.delete = to_streamed_response_wrapper( + servers.delete, + ) + self.attach_interface = to_streamed_response_wrapper( + servers.attach_interface, + ) + self.detach_interface = to_streamed_response_wrapper( + servers.detach_interface, + ) + self.get_console = to_streamed_response_wrapper( + servers.get_console, + ) + self.powercycle = to_streamed_response_wrapper( + servers.powercycle, + ) + self.reboot = to_streamed_response_wrapper( + servers.reboot, + ) + + +class AsyncServersResourceWithStreamingResponse: + def __init__(self, servers: AsyncServersResource) -> None: + self._servers = servers + + self.delete = async_to_streamed_response_wrapper( + servers.delete, + ) + self.attach_interface = async_to_streamed_response_wrapper( + servers.attach_interface, + ) + self.detach_interface = async_to_streamed_response_wrapper( + servers.detach_interface, + ) + self.get_console = async_to_streamed_response_wrapper( + servers.get_console, + ) + self.powercycle = async_to_streamed_response_wrapper( + servers.powercycle, + ) + self.reboot = async_to_streamed_response_wrapper( + servers.reboot, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index e969fcd0..8dc40a92 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -9,6 +9,7 @@ from .secret import Secret as Secret from .subnet import Subnet as Subnet from .volume import Volume as Volume +from .console import Console as Console from .l7_rule import L7Rule as L7Rule from .logging import Logging as Logging from .network import Network as Network @@ -16,6 +17,7 @@ from .ssh_key import SSHKey as SSHKey from .capacity import Capacity as Capacity from .registry import Registry as Registry +from .gpu_image import GPUImage as GPUImage from .ip_ranges import IPRanges as IPRanges from .l7_policy import L7Policy as L7Policy from .file_share import FileShare as FileShare @@ -35,6 +37,7 @@ from .load_balancer import LoadBalancer as LoadBalancer from .member_status import MemberStatus as MemberStatus from .registry_list import RegistryList as RegistryList +from .gpu_image_list import GPUImageList as GPUImageList from .l7_policy_list import L7PolicyList as L7PolicyList from .lb_flavor_list import LbFlavorList as LbFlavorList from .security_group import SecurityGroup as SecurityGroup @@ -51,10 +54,12 @@ from .lb_pool_protocol import LbPoolProtocol as LbPoolProtocol from .task_list_params import TaskListParams as TaskListParams from .lb_health_monitor import LbHealthMonitor as LbHealthMonitor +from .network_interface import NetworkInterface as NetworkInterface from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP from .aws_iam_data_param import AwsIamDataParam as AwsIamDataParam from .ddos_profile_field import DDOSProfileField as DDOSProfileField from .floating_ip_status import FloatingIPStatus as FloatingIPStatus +from .gpu_cluster_server import GPUClusterServer as GPUClusterServer from .ingress_opts_param import IngressOptsParam as IngressOptsParam from .region_list_params import RegionListParams as RegionListParams from .volume_list_params import VolumeListParams as VolumeListParams @@ -69,6 +74,7 @@ from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams from .container_probe_exec import ContainerProbeExec as ContainerProbeExec from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed +from .gpu_baremetal_flavor import GPUBaremetalFlavor as GPUBaremetalFlavor from .lb_listener_protocol import LbListenerProtocol as LbListenerProtocol from .load_balancer_status import LoadBalancerStatus as LoadBalancerStatus from .loadbalancer_metrics import LoadbalancerMetrics as LoadbalancerMetrics @@ -82,6 +88,7 @@ from .volume_update_params import VolumeUpdateParams as VolumeUpdateParams from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate from .detailed_lb_pool_list import DetailedLbPoolList as DetailedLbPoolList +from .gpu_baremetal_cluster import GPUBaremetalCluster as GPUBaremetalCluster from .health_monitor_status import HealthMonitorStatus as HealthMonitorStatus from .network_create_params import NetworkCreateParams as NetworkCreateParams from .network_update_params import NetworkUpdateParams as NetworkUpdateParams @@ -91,6 +98,7 @@ from .container_probe_config import ContainerProbeConfig as ContainerProbeConfig from .file_share_list_params import FileShareListParams as FileShareListParams from .lb_session_persistence import LbSessionPersistence as LbSessionPersistence +from .network_interface_list import NetworkInterfaceList as NetworkInterfaceList from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams @@ -98,6 +106,7 @@ from .registry_resize_params import RegistryResizeParams as RegistryResizeParams from .detailed_lb_pool_member import DetailedLbPoolMember as DetailedLbPoolMember from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams +from .gpu_cluster_server_list import GPUClusterServerList as GPUClusterServerList from .container_probe_http_get import ContainerProbeHTTPGet as ContainerProbeHTTPGet from .container_scale_triggers import ContainerScaleTriggers as ContainerScaleTriggers from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList @@ -109,6 +118,7 @@ from .session_persistence_type import SessionPersistenceType as SessionPersistenceType from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams +from .gpu_baremetal_flavor_list import GPUBaremetalFlavorList as GPUBaremetalFlavorList from .load_balancer_list_params import LoadBalancerListParams as LoadBalancerListParams from .load_balancer_status_list import LoadBalancerStatusList as LoadBalancerStatusList from .loadbalancer_metrics_list import LoadbalancerMetricsList as LoadbalancerMetricsList @@ -138,6 +148,11 @@ from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams from .container_scale_trigger_threshold import ContainerScaleTriggerThreshold as ContainerScaleTriggerThreshold +from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams +from .gpu_baremetal_cluster_create_params import GPUBaremetalClusterCreateParams as GPUBaremetalClusterCreateParams +from .gpu_baremetal_cluster_delete_params import GPUBaremetalClusterDeleteParams as GPUBaremetalClusterDeleteParams +from .gpu_baremetal_cluster_resize_params import GPUBaremetalClusterResizeParams as GPUBaremetalClusterResizeParams +from .gpu_baremetal_cluster_rebuild_params import GPUBaremetalClusterRebuildParams as GPUBaremetalClusterRebuildParams from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams diff --git a/src/gcore/types/cloud/console.py b/src/gcore/types/cloud/console.py new file mode 100644 index 00000000..e7deb2d3 --- /dev/null +++ b/src/gcore/types/cloud/console.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["Console", "RemoteConsole"] + + +class RemoteConsole(BaseModel): + protocol: str + """ + '#/components/schemas/RemoteConsoleData/properties/protocol' + "$.components.schemas.RemoteConsoleData.properties.protocol" + """ + + type: str + """ + '#/components/schemas/RemoteConsoleData/properties/type' + "$.components.schemas.RemoteConsoleData.properties.type" + """ + + url: str + """ + '#/components/schemas/RemoteConsoleData/properties/url' + "$.components.schemas.RemoteConsoleData.properties.url" + """ + + +class Console(BaseModel): + remote_console: RemoteConsole + """ + '#/components/schemas/RemoteConsoleSerializer/properties/remote_console' + "$.components.schemas.RemoteConsoleSerializer.properties.remote_console" + """ diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal_cluster.py new file mode 100644 index 00000000..68fd6500 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_cluster.py @@ -0,0 +1,170 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .tag import Tag +from ..._models import BaseModel +from .gpu_cluster_server import GPUClusterServer + +__all__ = ["GPUBaremetalCluster", "Interface"] + + +class Interface(BaseModel): + network_id: str + """ + '#/components/schemas/AIClusterNetworkSerializer/properties/network_id' + "$.components.schemas.AIClusterNetworkSerializer.properties.network_id" + """ + + port_id: str + """ + '#/components/schemas/AIClusterNetworkSerializer/properties/port_id' + "$.components.schemas.AIClusterNetworkSerializer.properties.port_id" + """ + + subnet_id: str + """ + '#/components/schemas/AIClusterNetworkSerializer/properties/subnet_id' + "$.components.schemas.AIClusterNetworkSerializer.properties.subnet_id" + """ + + type: str + """ + '#/components/schemas/AIClusterNetworkSerializer/properties/type' + "$.components.schemas.AIClusterNetworkSerializer.properties.type" + """ + + +class GPUBaremetalCluster(BaseModel): + cluster_id: str + """ + '#/components/schemas/AIClusterSerializer/properties/cluster_id' + "$.components.schemas.AIClusterSerializer.properties.cluster_id" + """ + + cluster_name: str + """ + '#/components/schemas/AIClusterSerializer/properties/cluster_name' + "$.components.schemas.AIClusterSerializer.properties.cluster_name" + """ + + cluster_status: Literal["ACTIVE", "ERROR", "PENDING", "SUSPENDED"] + """ + '#/components/schemas/AIClusterSerializer/properties/cluster_status' + "$.components.schemas.AIClusterSerializer.properties.cluster_status" + """ + + created_at: Optional[str] = None + """ + '#/components/schemas/AIClusterSerializer/properties/created_at/anyOf/0' + "$.components.schemas.AIClusterSerializer.properties.created_at.anyOf[0]" + """ + + creator_task_id: str + """ + '#/components/schemas/AIClusterSerializer/properties/creator_task_id' + "$.components.schemas.AIClusterSerializer.properties.creator_task_id" + """ + + flavor: str + """ + '#/components/schemas/AIClusterSerializer/properties/flavor' + "$.components.schemas.AIClusterSerializer.properties.flavor" + """ + + image_id: str + """ + '#/components/schemas/AIClusterSerializer/properties/image_id' + "$.components.schemas.AIClusterSerializer.properties.image_id" + """ + + image_name: str + """ + '#/components/schemas/AIClusterSerializer/properties/image_name' + "$.components.schemas.AIClusterSerializer.properties.image_name" + """ + + interfaces: Optional[List[Interface]] = None + """ + '#/components/schemas/AIClusterSerializer/properties/interfaces/anyOf/0' + "$.components.schemas.AIClusterSerializer.properties.interfaces.anyOf[0]" + """ + + keypair_name: Optional[str] = None + """ + '#/components/schemas/AIClusterSerializer/properties/keypair_name/anyOf/0' + "$.components.schemas.AIClusterSerializer.properties.keypair_name.anyOf[0]" + """ + + password: Optional[str] = None + """ + '#/components/schemas/AIClusterSerializer/properties/password/anyOf/0' + "$.components.schemas.AIClusterSerializer.properties.password.anyOf[0]" + """ + + project_id: int + """ + '#/components/schemas/AIClusterSerializer/properties/project_id' + "$.components.schemas.AIClusterSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/AIClusterSerializer/properties/region' + "$.components.schemas.AIClusterSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/AIClusterSerializer/properties/region_id' + "$.components.schemas.AIClusterSerializer.properties.region_id" + """ + + servers: List[GPUClusterServer] + """ + '#/components/schemas/AIClusterSerializer/properties/servers' + "$.components.schemas.AIClusterSerializer.properties.servers" + """ + + tags: List[Tag] + """ + '#/components/schemas/AIClusterSerializer/properties/tags' + "$.components.schemas.AIClusterSerializer.properties.tags" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/AIClusterSerializer/properties/task_id/anyOf/0' + "$.components.schemas.AIClusterSerializer.properties.task_id.anyOf[0]" + """ + + task_status: Literal[ + "CLUSTER_CLEAN_UP", + "CLUSTER_RESIZE", + "CLUSTER_RESUME", + "CLUSTER_SUSPEND", + "ERROR", + "FINISHED", + "IPU_SERVERS", + "NETWORK", + "POPLAR_SERVERS", + "POST_DEPLOY_SETUP", + "VIPU_CONTROLLER", + ] + """ + '#/components/schemas/AIClusterSerializer/properties/task_status' + "$.components.schemas.AIClusterSerializer.properties.task_status" + """ + + user_data: Optional[str] = None + """ + '#/components/schemas/AIClusterSerializer/properties/user_data/anyOf/0' + "$.components.schemas.AIClusterSerializer.properties.user_data.anyOf[0]" + """ + + username: Optional[str] = None + """ + '#/components/schemas/AIClusterSerializer/properties/username/anyOf/0' + "$.components.schemas.AIClusterSerializer.properties.username.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py new file mode 100644 index 00000000..dc2ed16a --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -0,0 +1,404 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .interface_ip_family import InterfaceIPFamily + +__all__ = [ + "GPUBaremetalClusterCreateParams", + "Interface", + "InterfaceNewInterfaceExternalSerializerPydantic", + "InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup", + "InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic", + "InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIP", + "InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer", + "InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer", + "InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup", + "InterfaceNewInterfaceAnySubnetFipSerializerPydantic", + "InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIP", + "InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer", + "InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer", + "InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup", + "InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic", + "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIP", + "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer", + "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer", + "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup", +] + + +class GPUBaremetalClusterCreateParams(TypedDict, total=False): + project_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + flavor: Required[str] + """ + '#/components/schemas/CreateAIClusterGPUSerializer/properties/flavor' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.flavor" + """ + + image_id: Required[str] + """ + '#/components/schemas/CreateAIClusterGPUSerializer/properties/image_id' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.image_id" + """ + + interfaces: Required[Iterable[Interface]] + """ + '#/components/schemas/CreateAIClusterGPUSerializer/properties/interfaces' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.interfaces" + """ + + name: Required[str] + """ + '#/components/schemas/CreateAIClusterGPUSerializer/properties/name' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.name" + """ + + instances_count: int + """ + '#/components/schemas/CreateAIClusterGPUSerializer/properties/instances_count' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.instances_count" + """ + + keypair_name: str + """ + '#/components/schemas/CreateAIClusterGPUSerializer/properties/keypair_name' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.keypair_name" + """ + + password: str + """ + '#/components/schemas/CreateAIClusterGPUSerializer/properties/password' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.password" + """ + + tags: Dict[str, str] + """ + '#/components/schemas/CreateAIClusterGPUSerializer/properties/tags' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.tags" + """ + + user_data: str + """ + '#/components/schemas/CreateAIClusterGPUSerializer/properties/user_data' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.user_data" + """ + + username: str + """ + '#/components/schemas/CreateAIClusterGPUSerializer/properties/username' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.username" + """ + + +class InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' + "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" + """ + + +class InterfaceNewInterfaceExternalSerializerPydantic(TypedDict, total=False): + type: Required[Literal["external"]] + """ + '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/type' + "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.type" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/interface_name' + "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.interface_name" + """ + + ip_family: Optional[InterfaceIPFamily] + """ + '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/ip_family/anyOf/0' + "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.ip_family.anyOf[0]" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/port_group' + "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.port_group" + """ + + security_groups: Iterable[InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup] + """ + '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/security_groups' + "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.security_groups" + """ + + +class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + source: Required[Literal["new"]] + """ + '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + existing_floating_id: Required[str] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + """ + + source: Required[Literal["existing"]] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIP: TypeAlias = Union[ + InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer, + InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer, +] + + +class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' + "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" + """ + + +class InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic(TypedDict, total=False): + network_id: Required[str] + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/network_id' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.network_id" + """ + + subnet_id: Required[str] + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/subnet_id' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.subnet_id" + """ + + type: Required[Literal["subnet"]] + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/type' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.type" + """ + + floating_ip: InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIP + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/floating_ip' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.floating_ip" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/interface_name' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.interface_name" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/port_group' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.port_group" + """ + + security_groups: Iterable[InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup] + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/security_groups' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.security_groups" + """ + + +class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + source: Required[Literal["new"]] + """ + '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + existing_floating_id: Required[str] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + """ + + source: Required[Literal["existing"]] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIP: TypeAlias = Union[ + InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer, + InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer, +] + + +class InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' + "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" + """ + + +class InterfaceNewInterfaceAnySubnetFipSerializerPydantic(TypedDict, total=False): + network_id: Required[str] + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/network_id' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.network_id" + """ + + type: Required[Literal["any_subnet"]] + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/type' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.type" + """ + + floating_ip: InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIP + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/floating_ip' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.floating_ip" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/interface_name' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.interface_name" + """ + + ip_address: str + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/ip_address' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.ip_address" + """ + + ip_family: Optional[InterfaceIPFamily] + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/ip_family/anyOf/0' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.ip_family.anyOf[0]" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/port_group' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.port_group" + """ + + security_groups: Iterable[InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup] + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/security_groups' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.security_groups" + """ + + +class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + source: Required[Literal["new"]] + """ + '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + existing_floating_id: Required[str] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + """ + + source: Required[Literal["existing"]] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIP: TypeAlias = Union[ + InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer, + InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer, +] + + +class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' + "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" + """ + + +class InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic(TypedDict, total=False): + port_id: Required[str] + """ + '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/port_id' + "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.port_id" + """ + + type: Required[Literal["reserved_fixed_ip"]] + """ + '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/type' + "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.type" + """ + + floating_ip: InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIP + """ + '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/floating_ip' + "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.floating_ip" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/interface_name' + "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.interface_name" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/port_group' + "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.port_group" + """ + + security_groups: Iterable[InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup] + """ + '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/security_groups' + "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.security_groups" + """ + + +Interface: TypeAlias = Union[ + InterfaceNewInterfaceExternalSerializerPydantic, + InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic, + InterfaceNewInterfaceAnySubnetFipSerializerPydantic, + InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic, +] diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py new file mode 100644 index 00000000..1d31aed9 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["GPUBaremetalClusterDeleteParams"] + + +class GPUBaremetalClusterDeleteParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[1].schema" + """ + + delete_floatings: bool + """ + '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/3' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[3]" + """ + + floatings: str + """ + '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/4' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[4]" + """ + + reserved_fixed_ips: str + """ + '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/5' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[5]" + """ diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py new file mode 100644 index 00000000..06e6378e --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["GPUBaremetalClusterListParams"] + + +class GPUBaremetalClusterListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[2]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[3]" + """ diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py new file mode 100644 index 00000000..4c0e5d36 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["GPUBaremetalClusterRebuildParams"] + + +class GPUBaremetalClusterRebuildParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[1].schema" + """ + + nodes: Required[List[str]] + """ + '#/components/schemas/RebuildClusterSerializer/properties/nodes' + "$.components.schemas.RebuildClusterSerializer.properties.nodes" + """ + + image_id: Optional[str] + """ + '#/components/schemas/RebuildClusterSerializer/properties/image_id/anyOf/0' + "$.components.schemas.RebuildClusterSerializer.properties.image_id.anyOf[0]" + """ + + user_data: Optional[str] + """ + '#/components/schemas/RebuildClusterSerializer/properties/user_data/anyOf/0' + "$.components.schemas.RebuildClusterSerializer.properties.user_data.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py new file mode 100644 index 00000000..7ef5ad97 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["GPUBaremetalClusterResizeParams"] + + +class GPUBaremetalClusterResizeParams(TypedDict, total=False): + project_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[0].schema" + """ + + region_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[1].schema" + """ + + instances_count: Required[int] + """ + '#/components/schemas/ResizeAIClusterGPUSerializerV1/properties/instances_count' + "$.components.schemas.ResizeAIClusterGPUSerializerV1.properties.instances_count" + """ diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py b/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py new file mode 100644 index 00000000..7d30e274 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .flavor_list_params import FlavorListParams as FlavorListParams +from .image_upload_params import ImageUploadParams as ImageUploadParams +from .server_delete_params import ServerDeleteParams as ServerDeleteParams +from .server_attach_interface_params import ServerAttachInterfaceParams as ServerAttachInterfaceParams +from .server_detach_interface_params import ServerDetachInterfaceParams as ServerDetachInterfaceParams diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py new file mode 100644 index 00000000..a3bbeba9 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["FlavorListParams"] + + +class FlavorListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/0/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/1/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[1].schema" + """ + + hide_disabled: Optional[bool] + """ + '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/2/schema/anyOf/0' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[2].schema.anyOf[0]" + """ + + include_prices: Optional[bool] + """ + '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/3/schema/anyOf/0' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[3].schema.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py new file mode 100644 index 00000000..1f547965 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py @@ -0,0 +1,82 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ImageUploadParams"] + + +class ImageUploadParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/post/parameters/0/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/post/parameters/1/schema' + "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].post.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/name' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.name" + """ + + url: Required[str] + """ + '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/url/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.url.anyOf[0]" + """ + + architecture: Optional[Literal["aarch64", "x86_64"]] + """ + '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/architecture/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.architecture.anyOf[0]" + """ + + cow_format: bool + """ + '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/cow_format' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.cow_format" + """ + + hw_firmware_type: Optional[Literal["bios", "uefi"]] + """ + '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/hw_firmware_type/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.hw_firmware_type.anyOf[0]" + """ + + os_distro: Optional[str] + """ + '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_distro/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_distro.anyOf[0]" + """ + + os_type: Optional[Literal["linux", "windows"]] + """ + '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_type/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_type.anyOf[0]" + """ + + os_version: Optional[str] + """ + '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_version/anyOf/0' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_version.anyOf[0]" + """ + + ssh_key: Literal["allow", "deny", "required"] + """ + '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/ssh_key' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.ssh_key" + """ + + tags: Dict[str, str] + """ + '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/tags' + "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.tags" + """ 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 new file mode 100644 index 00000000..64e69e9c --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py @@ -0,0 +1,456 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = [ + "ServerAttachInterfaceParams", + "NewInterfaceExternalExtendSchemaWithDDOS", + "NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile", + "NewInterfaceExternalExtendSchemaWithDdosddosProfileField", + "NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup", + "NewInterfaceSpecificSubnetSchema", + "NewInterfaceSpecificSubnetSchemaDDOSProfile", + "NewInterfaceSpecificSubnetSchemaDDOSProfileField", + "NewInterfaceSpecificSubnetSchemaSecurityGroup", + "NewInterfaceAnySubnetSchema", + "NewInterfaceAnySubnetSchemaDDOSProfile", + "NewInterfaceAnySubnetSchemaDDOSProfileField", + "NewInterfaceAnySubnetSchemaSecurityGroup", + "NewInterfaceReservedFixedIPSchema", + "NewInterfaceReservedFixedIPSchemaDDOSProfile", + "NewInterfaceReservedFixedIPSchemaDDOSProfileField", + "NewInterfaceReservedFixedIPSchemaSecurityGroup", +] + + +class NewInterfaceExternalExtendSchemaWithDDOS(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + """ + + ddos_profile: NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + """ + '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ddos_profile.allOf[0]" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/interface_name' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.interface_name" + """ + + ip_family: Literal["dual", "ipv4", "ipv6"] + """ + '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ip_family' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ip_family" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/port_group' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.port_group" + """ + + security_groups: Iterable[NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + """ + '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/security_groups' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.security_groups" + """ + + type: str + """ + '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/type' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.type" + """ + + +class NewInterfaceExternalExtendSchemaWithDdosddosProfileField(TypedDict, total=False): + base_field: Optional[int] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" + """ + + field_name: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" + """ + + field_value: object + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" + """ + + value: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" + """ + + +class NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile(TypedDict, total=False): + profile_template: Required[int] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" + """ + + fields: Iterable[NewInterfaceExternalExtendSchemaWithDdosddosProfileField] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" + """ + + profile_template_name: str + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" + """ + + +class NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSchema/properties/id' + "$.components.schemas.MandatoryIdSchema.properties.id" + """ + + +class NewInterfaceSpecificSubnetSchema(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + """ + + subnet_id: Required[str] + """ + '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/subnet_id' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.subnet_id" + """ + + ddos_profile: NewInterfaceSpecificSubnetSchemaDDOSProfile + """ + '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.ddos_profile.allOf[0]" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/interface_name' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.interface_name" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/port_group' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.port_group" + """ + + security_groups: Iterable[NewInterfaceSpecificSubnetSchemaSecurityGroup] + """ + '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/security_groups' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.security_groups" + """ + + type: str + """ + '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/type' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.type" + """ + + +class NewInterfaceSpecificSubnetSchemaDDOSProfileField(TypedDict, total=False): + base_field: Optional[int] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" + """ + + field_name: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" + """ + + field_value: object + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" + """ + + value: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" + """ + + +class NewInterfaceSpecificSubnetSchemaDDOSProfile(TypedDict, total=False): + profile_template: Required[int] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" + """ + + fields: Iterable[NewInterfaceSpecificSubnetSchemaDDOSProfileField] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" + """ + + profile_template_name: str + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" + """ + + +class NewInterfaceSpecificSubnetSchemaSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSchema/properties/id' + "$.components.schemas.MandatoryIdSchema.properties.id" + """ + + +class NewInterfaceAnySubnetSchema(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + """ + + network_id: Required[str] + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/network_id' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.network_id" + """ + + ddos_profile: NewInterfaceAnySubnetSchemaDDOSProfile + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ddos_profile.allOf[0]" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/interface_name' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.interface_name" + """ + + ip_family: Literal["dual", "ipv4", "ipv6"] + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ip_family' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ip_family" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/port_group' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.port_group" + """ + + security_groups: Iterable[NewInterfaceAnySubnetSchemaSecurityGroup] + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/security_groups' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.security_groups" + """ + + type: str + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/type' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.type" + """ + + +class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): + base_field: Optional[int] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" + """ + + field_name: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" + """ + + field_value: object + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" + """ + + value: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" + """ + + +class NewInterfaceAnySubnetSchemaDDOSProfile(TypedDict, total=False): + profile_template: Required[int] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" + """ + + fields: Iterable[NewInterfaceAnySubnetSchemaDDOSProfileField] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" + """ + + profile_template_name: str + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" + """ + + +class NewInterfaceAnySubnetSchemaSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSchema/properties/id' + "$.components.schemas.MandatoryIdSchema.properties.id" + """ + + +class NewInterfaceReservedFixedIPSchema(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + """ + + port_id: Required[str] + """ + '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_id' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_id" + """ + + ddos_profile: NewInterfaceReservedFixedIPSchemaDDOSProfile + """ + '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.ddos_profile.allOf[0]" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/interface_name' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.interface_name" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_group' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_group" + """ + + security_groups: Iterable[NewInterfaceReservedFixedIPSchemaSecurityGroup] + """ + '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/security_groups' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.security_groups" + """ + + type: str + """ + '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/type' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.type" + """ + + +class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): + base_field: Optional[int] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" + """ + + field_name: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" + """ + + field_value: object + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" + """ + + value: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" + """ + + +class NewInterfaceReservedFixedIPSchemaDDOSProfile(TypedDict, total=False): + profile_template: Required[int] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" + """ + + fields: Iterable[NewInterfaceReservedFixedIPSchemaDDOSProfileField] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" + """ + + profile_template_name: str + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" + """ + + +class NewInterfaceReservedFixedIPSchemaSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSchema/properties/id' + "$.components.schemas.MandatoryIdSchema.properties.id" + """ + + +ServerAttachInterfaceParams: TypeAlias = Union[ + NewInterfaceExternalExtendSchemaWithDDOS, + NewInterfaceSpecificSubnetSchema, + NewInterfaceAnySubnetSchema, + NewInterfaceReservedFixedIPSchema, +] diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py new file mode 100644 index 00000000..ad7acc00 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ServerDeleteParams"] + + +class ServerDeleteParams(TypedDict, total=False): + project_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[0].schema" + """ + + region_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[1].schema" + """ + + cluster_id: Required[str] + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[2].schema" + """ + + delete_floatings: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/4' + "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[4]" + """ diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py new file mode 100644 index 00000000..0c39ad42 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ServerDetachInterfaceParams"] + + +class ServerDetachInterfaceParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[1].schema" + """ + + ip_address: Required[str] + """ + '#/components/schemas/PortIdWithIpSchema/properties/ip_address' + "$.components.schemas.PortIdWithIpSchema.properties.ip_address" + """ + + port_id: Required[str] + """ + '#/components/schemas/PortIdWithIpSchema/properties/port_id' + "$.components.schemas.PortIdWithIpSchema.properties.port_id" + """ diff --git a/src/gcore/types/cloud/gpu_baremetal_flavor.py b/src/gcore/types/cloud/gpu_baremetal_flavor.py new file mode 100644 index 00000000..bf404111 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_flavor.py @@ -0,0 +1,232 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal, TypeAlias + +from ..._models import BaseModel + +__all__ = [ + "GPUBaremetalFlavor", + "GPUBaremetalFlavorSerializerWithoutPrice", + "GPUBaremetalFlavorSerializerWithoutPriceHardwareDescription", + "GPUBaremetalFlavorSerializerWithoutPriceHardwareProperties", + "GPUBaremetalFlavorSerializerWithPrices", + "GPUBaremetalFlavorSerializerWithPricesHardwareDescription", + "GPUBaremetalFlavorSerializerWithPricesHardwareProperties", + "GPUBaremetalFlavorSerializerWithPricesPrice", +] + + +class GPUBaremetalFlavorSerializerWithoutPriceHardwareDescription(BaseModel): + cpu: str + """ + '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/cpu' + "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.cpu" + """ + + disk: str + """ + '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/disk' + "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.disk" + """ + + gpu: str + """ + '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/gpu' + "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.gpu" + """ + + network: str + """ + '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/network' + "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.network" + """ + + ram: str + """ + '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/ram' + "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.ram" + """ + + +class GPUBaremetalFlavorSerializerWithoutPriceHardwareProperties(BaseModel): + gpu_count: Optional[int] = None + """ + '#/components/schemas/GpuFlavorHardwareProperties/properties/gpu_count/anyOf/0' + "$.components.schemas.GpuFlavorHardwareProperties.properties.gpu_count.anyOf[0]" + """ + + gpu_manufacturer: Optional[str] = None + """ + '#/components/schemas/GpuFlavorHardwareProperties/properties/gpu_manufacturer/anyOf/0' + "$.components.schemas.GpuFlavorHardwareProperties.properties.gpu_manufacturer.anyOf[0]" + """ + + gpu_model: Optional[str] = None + """ + '#/components/schemas/GpuFlavorHardwareProperties/properties/gpu_model/anyOf/0' + "$.components.schemas.GpuFlavorHardwareProperties.properties.gpu_model.anyOf[0]" + """ + + +class GPUBaremetalFlavorSerializerWithoutPrice(BaseModel): + architecture: Optional[str] = None + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithoutPrice/properties/architecture/anyOf/0' + "$.components.schemas.GpuBaremetalFlavorSerializerWithoutPrice.properties.architecture.anyOf[0]" + """ + + capacity: int + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithoutPrice/properties/capacity' + "$.components.schemas.GpuBaremetalFlavorSerializerWithoutPrice.properties.capacity" + """ + + disabled: bool + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithoutPrice/properties/disabled' + "$.components.schemas.GpuBaremetalFlavorSerializerWithoutPrice.properties.disabled" + """ + + hardware_description: GPUBaremetalFlavorSerializerWithoutPriceHardwareDescription + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithoutPrice/properties/hardware_description' + "$.components.schemas.GpuBaremetalFlavorSerializerWithoutPrice.properties.hardware_description" + """ + + hardware_properties: GPUBaremetalFlavorSerializerWithoutPriceHardwareProperties + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithoutPrice/properties/hardware_properties' + "$.components.schemas.GpuBaremetalFlavorSerializerWithoutPrice.properties.hardware_properties" + """ + + name: str + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithoutPrice/properties/name' + "$.components.schemas.GpuBaremetalFlavorSerializerWithoutPrice.properties.name" + """ + + +class GPUBaremetalFlavorSerializerWithPricesHardwareDescription(BaseModel): + cpu: str + """ + '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/cpu' + "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.cpu" + """ + + disk: str + """ + '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/disk' + "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.disk" + """ + + gpu: str + """ + '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/gpu' + "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.gpu" + """ + + network: str + """ + '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/network' + "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.network" + """ + + ram: str + """ + '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/ram' + "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.ram" + """ + + +class GPUBaremetalFlavorSerializerWithPricesHardwareProperties(BaseModel): + gpu_count: Optional[int] = None + """ + '#/components/schemas/GpuFlavorHardwareProperties/properties/gpu_count/anyOf/0' + "$.components.schemas.GpuFlavorHardwareProperties.properties.gpu_count.anyOf[0]" + """ + + gpu_manufacturer: Optional[str] = None + """ + '#/components/schemas/GpuFlavorHardwareProperties/properties/gpu_manufacturer/anyOf/0' + "$.components.schemas.GpuFlavorHardwareProperties.properties.gpu_manufacturer.anyOf[0]" + """ + + gpu_model: Optional[str] = None + """ + '#/components/schemas/GpuFlavorHardwareProperties/properties/gpu_model/anyOf/0' + "$.components.schemas.GpuFlavorHardwareProperties.properties.gpu_model.anyOf[0]" + """ + + +class GPUBaremetalFlavorSerializerWithPricesPrice(BaseModel): + currency_code: Optional[str] = None + """ + '#/components/schemas/FlavorPrice/properties/currency_code/anyOf/0' + "$.components.schemas.FlavorPrice.properties.currency_code.anyOf[0]" + """ + + price_per_hour: Optional[float] = None + """ + '#/components/schemas/FlavorPrice/properties/price_per_hour/anyOf/0' + "$.components.schemas.FlavorPrice.properties.price_per_hour.anyOf[0]" + """ + + price_per_month: Optional[float] = None + """ + '#/components/schemas/FlavorPrice/properties/price_per_month/anyOf/0' + "$.components.schemas.FlavorPrice.properties.price_per_month.anyOf[0]" + """ + + price_status: Optional[Literal["error", "hide", "show"]] = None + """ + '#/components/schemas/FlavorPrice/properties/price_status/anyOf/0' + "$.components.schemas.FlavorPrice.properties.price_status.anyOf[0]" + """ + + +class GPUBaremetalFlavorSerializerWithPrices(BaseModel): + architecture: Optional[str] = None + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/architecture/anyOf/0' + "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.architecture.anyOf[0]" + """ + + capacity: int + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/capacity' + "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.capacity" + """ + + disabled: bool + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/disabled' + "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.disabled" + """ + + hardware_description: GPUBaremetalFlavorSerializerWithPricesHardwareDescription + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/hardware_description' + "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.hardware_description" + """ + + hardware_properties: GPUBaremetalFlavorSerializerWithPricesHardwareProperties + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/hardware_properties' + "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.hardware_properties" + """ + + name: str + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/name' + "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.name" + """ + + price: GPUBaremetalFlavorSerializerWithPricesPrice + """ + '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/price' + "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.price" + """ + + +GPUBaremetalFlavor: TypeAlias = Union[GPUBaremetalFlavorSerializerWithoutPrice, GPUBaremetalFlavorSerializerWithPrices] diff --git a/src/gcore/types/cloud/gpu_baremetal_flavor_list.py b/src/gcore/types/cloud/gpu_baremetal_flavor_list.py new file mode 100644 index 00000000..7bad1937 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_flavor_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .gpu_baremetal_flavor import GPUBaremetalFlavor + +__all__ = ["GPUBaremetalFlavorList"] + + +class GPUBaremetalFlavorList(BaseModel): + count: int + """ + '#/components/schemas/ListGpuBaremetalFlavorSerializer/properties/count' + "$.components.schemas.ListGpuBaremetalFlavorSerializer.properties.count" + """ + + results: List[GPUBaremetalFlavor] + """ + '#/components/schemas/ListGpuBaremetalFlavorSerializer/properties/results' + "$.components.schemas.ListGpuBaremetalFlavorSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/gpu_cluster_server.py b/src/gcore/types/cloud/gpu_cluster_server.py new file mode 100644 index 00000000..4a428243 --- /dev/null +++ b/src/gcore/types/cloud/gpu_cluster_server.py @@ -0,0 +1,459 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, TypeAlias + +from pydantic import Field as FieldInfo + +from .tag import Tag +from ..._models import BaseModel +from .ddos_profile import DDOSProfile + +__all__ = [ + "GPUClusterServer", + "Address", + "AddressInstanceFloatingAddressSerializer", + "AddressInstanceFixedAddressShortSerializer", + "AddressInstanceFixedAddressSerializer", + "BlackholePort", + "FixedIPAssignment", + "Flavor", + "FlavorHardwareDescription", + "InstanceIsolation", + "SecurityGroup", +] + + +class AddressInstanceFloatingAddressSerializer(BaseModel): + addr: str + """ + '#/components/schemas/InstanceFloatingAddressSerializer/properties/addr' + "$.components.schemas.InstanceFloatingAddressSerializer.properties.addr" + """ + + type: Literal["floating"] + """ + '#/components/schemas/InstanceFloatingAddressSerializer/properties/type' + "$.components.schemas.InstanceFloatingAddressSerializer.properties.type" + """ + + +class AddressInstanceFixedAddressShortSerializer(BaseModel): + addr: str + """ + '#/components/schemas/InstanceFixedAddressShortSerializer/properties/addr' + "$.components.schemas.InstanceFixedAddressShortSerializer.properties.addr" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/InstanceFixedAddressShortSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.InstanceFixedAddressShortSerializer.properties.interface_name.anyOf[0]" + """ + + type: Literal["fixed"] + """ + '#/components/schemas/InstanceFixedAddressShortSerializer/properties/type' + "$.components.schemas.InstanceFixedAddressShortSerializer.properties.type" + """ + + +class AddressInstanceFixedAddressSerializer(BaseModel): + addr: str + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/addr' + "$.components.schemas.InstanceFixedAddressSerializer.properties.addr" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.InstanceFixedAddressSerializer.properties.interface_name.anyOf[0]" + """ + + subnet_id: str + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_id' + "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_id" + """ + + subnet_name: str + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_name' + "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_name" + """ + + type: Literal["fixed"] + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/type' + "$.components.schemas.InstanceFixedAddressSerializer.properties.type" + """ + + +Address: TypeAlias = Union[ + AddressInstanceFloatingAddressSerializer, + AddressInstanceFixedAddressShortSerializer, + AddressInstanceFixedAddressSerializer, +] + + +class BlackholePort(BaseModel): + alarm_end: datetime = FieldInfo(alias="AlarmEnd") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlarmEnd' + "$.components.schemas.BlackholePortSerializer.properties.AlarmEnd" + """ + + alarm_start: datetime = FieldInfo(alias="AlarmStart") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlarmStart' + "$.components.schemas.BlackholePortSerializer.properties.AlarmStart" + """ + + alarm_state: Literal[ + "ACK_REQ", + "ALARM", + "ARCHIVED", + "CLEAR", + "CLEARING", + "CLEARING_FAIL", + "END_GRACE", + "END_WAIT", + "MANUAL_CLEAR", + "MANUAL_CLEARING", + "MANUAL_CLEARING_FAIL", + "MANUAL_MITIGATING", + "MANUAL_STARTING", + "MANUAL_STARTING_FAIL", + "MITIGATING", + "STARTING", + "STARTING_FAIL", + "START_WAIT", + "ack_req", + "alarm", + "archived", + "clear", + "clearing", + "clearing_fail", + "end_grace", + "end_wait", + "manual_clear", + "manual_clearing", + "manual_clearing_fail", + "manual_mitigating", + "manual_starting", + "manual_starting_fail", + "mitigating", + "start_wait", + "starting", + "starting_fail", + ] = FieldInfo(alias="AlarmState") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlarmState' + "$.components.schemas.BlackholePortSerializer.properties.AlarmState" + """ + + alert_duration: str = FieldInfo(alias="AlertDuration") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlertDuration' + "$.components.schemas.BlackholePortSerializer.properties.AlertDuration" + """ + + destination_ip: str = FieldInfo(alias="DestinationIP") + """ + '#/components/schemas/BlackholePortSerializer/properties/DestinationIP' + "$.components.schemas.BlackholePortSerializer.properties.DestinationIP" + """ + + id: int = FieldInfo(alias="ID") + """ + '#/components/schemas/BlackholePortSerializer/properties/ID' + "$.components.schemas.BlackholePortSerializer.properties.ID" + """ + + +class FixedIPAssignment(BaseModel): + external: bool + """ + '#/components/schemas/IpAssignmentsSerializer/properties/external' + "$.components.schemas.IpAssignmentsSerializer.properties.external" + """ + + ip_address: str + """ + '#/components/schemas/IpAssignmentsSerializer/properties/ip_address' + "$.components.schemas.IpAssignmentsSerializer.properties.ip_address" + """ + + subnet_id: str + """ + '#/components/schemas/IpAssignmentsSerializer/properties/subnet_id' + "$.components.schemas.IpAssignmentsSerializer.properties.subnet_id" + """ + + +class FlavorHardwareDescription(BaseModel): + cpu: str + """ + '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/cpu' + "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.cpu" + """ + + disk: str + """ + '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/disk' + "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.disk" + """ + + gpu: str + """ + '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/gpu' + "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.gpu" + """ + + license: str + """ + '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/license' + "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.license" + """ + + network: str + """ + '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/network' + "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.network" + """ + + ram: str + """ + '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/ram' + "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.ram" + """ + + +class Flavor(BaseModel): + architecture: str + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/architecture' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.architecture" + """ + + flavor_id: str + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/flavor_id' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.flavor_id" + """ + + flavor_name: str + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/flavor_name' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.flavor_name" + """ + + hardware_description: FlavorHardwareDescription + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/hardware_description' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.hardware_description" + """ + + os_type: str + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/os_type' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.os_type" + """ + + ram: int + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/ram' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.ram" + """ + + resource_class: str + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/resource_class' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.resource_class" + """ + + vcpus: int + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/vcpus' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.vcpus" + """ + + +class InstanceIsolation(BaseModel): + reason: Optional[str] = None + """ + '#/components/schemas/IsolationSerializer/properties/reason/anyOf/0' + "$.components.schemas.IsolationSerializer.properties.reason.anyOf[0]" + """ + + +class SecurityGroup(BaseModel): + name: str + """ + '#/components/schemas/NameSerializerPydantic/properties/name' + "$.components.schemas.NameSerializerPydantic.properties.name" + """ + + +class GPUClusterServer(BaseModel): + addresses: Dict[str, List[Address]] + """ + '#/components/schemas/GPUClusterServerSerializer/properties/addresses' + "$.components.schemas.GPUClusterServerSerializer.properties.addresses" + """ + + blackhole_ports: List[BlackholePort] + """ + '#/components/schemas/GPUClusterServerSerializer/properties/blackhole_ports' + "$.components.schemas.GPUClusterServerSerializer.properties.blackhole_ports" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/GPUClusterServerSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.GPUClusterServerSerializer.properties.creator_task_id.anyOf[0]" + """ + + ddos_profile: Optional[DDOSProfile] = None + """ + '#/components/schemas/GPUClusterServerSerializer/properties/ddos_profile/anyOf/0' + "$.components.schemas.GPUClusterServerSerializer.properties.ddos_profile.anyOf[0]" + """ + + fixed_ip_assignments: Optional[List[FixedIPAssignment]] = None + """ + '#/components/schemas/GPUClusterServerSerializer/properties/fixed_ip_assignments/anyOf/0' + "$.components.schemas.GPUClusterServerSerializer.properties.fixed_ip_assignments.anyOf[0]" + """ + + flavor: Flavor + """ + '#/components/schemas/GPUClusterServerSerializer/properties/flavor' + "$.components.schemas.GPUClusterServerSerializer.properties.flavor" + """ + + instance_created: datetime + """ + '#/components/schemas/GPUClusterServerSerializer/properties/instance_created' + "$.components.schemas.GPUClusterServerSerializer.properties.instance_created" + """ + + instance_description: Optional[str] = None + """ + '#/components/schemas/GPUClusterServerSerializer/properties/instance_description/anyOf/0' + "$.components.schemas.GPUClusterServerSerializer.properties.instance_description.anyOf[0]" + """ + + instance_id: str + """ + '#/components/schemas/GPUClusterServerSerializer/properties/instance_id' + "$.components.schemas.GPUClusterServerSerializer.properties.instance_id" + """ + + instance_isolation: Optional[InstanceIsolation] = None + """ + '#/components/schemas/GPUClusterServerSerializer/properties/instance_isolation/anyOf/0' + "$.components.schemas.GPUClusterServerSerializer.properties.instance_isolation.anyOf[0]" + """ + + instance_name: str + """ + '#/components/schemas/GPUClusterServerSerializer/properties/instance_name' + "$.components.schemas.GPUClusterServerSerializer.properties.instance_name" + """ + + keypair_name: Optional[str] = None + """ + '#/components/schemas/GPUClusterServerSerializer/properties/keypair_name/anyOf/0' + "$.components.schemas.GPUClusterServerSerializer.properties.keypair_name.anyOf[0]" + """ + + project_id: int + """ + '#/components/schemas/GPUClusterServerSerializer/properties/project_id' + "$.components.schemas.GPUClusterServerSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/GPUClusterServerSerializer/properties/region' + "$.components.schemas.GPUClusterServerSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/GPUClusterServerSerializer/properties/region_id' + "$.components.schemas.GPUClusterServerSerializer.properties.region_id" + """ + + security_groups: List[SecurityGroup] + """ + '#/components/schemas/GPUClusterServerSerializer/properties/security_groups' + "$.components.schemas.GPUClusterServerSerializer.properties.security_groups" + """ + + status: Literal[ + "ACTIVE", + "BUILD", + "DELETED", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PASSWORD", + "PAUSED", + "REBOOT", + "REBUILD", + "RESCUE", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "UNKNOWN", + "VERIFY_RESIZE", + ] + """ + '#/components/schemas/GPUClusterServerSerializer/properties/status' + "$.components.schemas.GPUClusterServerSerializer.properties.status" + """ + + tags: List[Tag] + """ + '#/components/schemas/GPUClusterServerSerializer/properties/tags' + "$.components.schemas.GPUClusterServerSerializer.properties.tags" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/GPUClusterServerSerializer/properties/task_id/anyOf/0' + "$.components.schemas.GPUClusterServerSerializer.properties.task_id.anyOf[0]" + """ + + task_state: Optional[str] = None + """ + '#/components/schemas/GPUClusterServerSerializer/properties/task_state/anyOf/0' + "$.components.schemas.GPUClusterServerSerializer.properties.task_state.anyOf[0]" + """ + + vm_state: Literal[ + "active", + "building", + "deleted", + "error", + "paused", + "rescued", + "resized", + "shelved", + "shelved_offloaded", + "soft-deleted", + "stopped", + "suspended", + ] + """ + '#/components/schemas/GPUClusterServerSerializer/properties/vm_state' + "$.components.schemas.GPUClusterServerSerializer.properties.vm_state" + """ diff --git a/src/gcore/types/cloud/gpu_cluster_server_list.py b/src/gcore/types/cloud/gpu_cluster_server_list.py new file mode 100644 index 00000000..c1f84c5e --- /dev/null +++ b/src/gcore/types/cloud/gpu_cluster_server_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .gpu_cluster_server import GPUClusterServer + +__all__ = ["GPUClusterServerList"] + + +class GPUClusterServerList(BaseModel): + count: int + """ + '#/components/schemas/GPUClusterServerCollectionSerializer/properties/count' + "$.components.schemas.GPUClusterServerCollectionSerializer.properties.count" + """ + + results: List[GPUClusterServer] + """ + '#/components/schemas/GPUClusterServerCollectionSerializer/properties/results' + "$.components.schemas.GPUClusterServerCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/gpu_image.py b/src/gcore/types/cloud/gpu_image.py new file mode 100644 index 00000000..35ef98cf --- /dev/null +++ b/src/gcore/types/cloud/gpu_image.py @@ -0,0 +1,107 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .tag import Tag +from ..._models import BaseModel + +__all__ = ["GPUImage"] + + +class GPUImage(BaseModel): + id: str + """ + '#/components/schemas/GpuImageSerializer/properties/id' + "$.components.schemas.GpuImageSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/GpuImageSerializer/properties/created_at' + "$.components.schemas.GpuImageSerializer.properties.created_at" + """ + + min_disk: int + """ + '#/components/schemas/GpuImageSerializer/properties/min_disk' + "$.components.schemas.GpuImageSerializer.properties.min_disk" + """ + + min_ram: int + """ + '#/components/schemas/GpuImageSerializer/properties/min_ram' + "$.components.schemas.GpuImageSerializer.properties.min_ram" + """ + + name: str + """ + '#/components/schemas/GpuImageSerializer/properties/name' + "$.components.schemas.GpuImageSerializer.properties.name" + """ + + status: str + """ + '#/components/schemas/GpuImageSerializer/properties/status' + "$.components.schemas.GpuImageSerializer.properties.status" + """ + + tags: List[Tag] + """ + '#/components/schemas/GpuImageSerializer/properties/tags' + "$.components.schemas.GpuImageSerializer.properties.tags" + """ + + updated_at: datetime + """ + '#/components/schemas/GpuImageSerializer/properties/updated_at' + "$.components.schemas.GpuImageSerializer.properties.updated_at" + """ + + visibility: str + """ + '#/components/schemas/GpuImageSerializer/properties/visibility' + "$.components.schemas.GpuImageSerializer.properties.visibility" + """ + + architecture: Optional[str] = None + """ + '#/components/schemas/GpuImageSerializer/properties/architecture/anyOf/0' + "$.components.schemas.GpuImageSerializer.properties.architecture.anyOf[0]" + """ + + os_distro: Optional[str] = None + """ + '#/components/schemas/GpuImageSerializer/properties/os_distro/anyOf/0' + "$.components.schemas.GpuImageSerializer.properties.os_distro.anyOf[0]" + """ + + os_type: Optional[str] = None + """ + '#/components/schemas/GpuImageSerializer/properties/os_type/anyOf/0' + "$.components.schemas.GpuImageSerializer.properties.os_type.anyOf[0]" + """ + + os_version: Optional[str] = None + """ + '#/components/schemas/GpuImageSerializer/properties/os_version/anyOf/0' + "$.components.schemas.GpuImageSerializer.properties.os_version.anyOf[0]" + """ + + size: Optional[int] = None + """ + '#/components/schemas/GpuImageSerializer/properties/size' + "$.components.schemas.GpuImageSerializer.properties.size" + """ + + ssh_key: Optional[str] = None + """ + '#/components/schemas/GpuImageSerializer/properties/ssh_key/anyOf/0' + "$.components.schemas.GpuImageSerializer.properties.ssh_key.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/GpuImageSerializer/properties/task_id/anyOf/0' + "$.components.schemas.GpuImageSerializer.properties.task_id.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/gpu_image_list.py b/src/gcore/types/cloud/gpu_image_list.py new file mode 100644 index 00000000..2d721edc --- /dev/null +++ b/src/gcore/types/cloud/gpu_image_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .gpu_image import GPUImage + +__all__ = ["GPUImageList"] + + +class GPUImageList(BaseModel): + count: int + """ + '#/components/schemas/ListGpuImageSerializer/properties/count' + "$.components.schemas.ListGpuImageSerializer.properties.count" + """ + + results: List[GPUImage] + """ + '#/components/schemas/ListGpuImageSerializer/properties/results' + "$.components.schemas.ListGpuImageSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/network_interface.py b/src/gcore/types/cloud/network_interface.py new file mode 100644 index 00000000..741964cc --- /dev/null +++ b/src/gcore/types/cloud/network_interface.py @@ -0,0 +1,426 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .tag import Tag +from .subnet import Subnet +from ..._models import BaseModel +from .floating_ip import FloatingIP + +__all__ = [ + "NetworkInterface", + "AllowedAddressPair", + "IPAssignment", + "NetworkDetails", + "SubPort", + "SubPortAllowedAddressPair", + "SubPortIPAssignment", + "SubPortNetworkDetails", +] + + +class AllowedAddressPair(BaseModel): + ip_address: str + """ + '#/components/schemas/AllowedAddressPairsSerializer/properties/ip_address/anyOf/0' + "$.components.schemas.AllowedAddressPairsSerializer.properties.ip_address.anyOf[0]" + """ + + mac_address: Optional[str] = None + """ + '#/components/schemas/AllowedAddressPairsSerializer/properties/mac_address/anyOf/0' + "$.components.schemas.AllowedAddressPairsSerializer.properties.mac_address.anyOf[0]" + """ + + +class IPAssignment(BaseModel): + ip_address: str + """ + '#/components/schemas/PortIpSubnetIdSerializer/properties/ip_address' + "$.components.schemas.PortIpSubnetIdSerializer.properties.ip_address" + """ + + subnet_id: str + """ + '#/components/schemas/PortIpSubnetIdSerializer/properties/subnet_id' + "$.components.schemas.PortIpSubnetIdSerializer.properties.subnet_id" + """ + + +class NetworkDetails(BaseModel): + id: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/id' + "$.components.schemas.NetworkSubnetworkSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/created_at' + "$.components.schemas.NetworkSubnetworkSerializer.properties.created_at" + """ + + external: bool + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/external' + "$.components.schemas.NetworkSubnetworkSerializer.properties.external" + """ + + name: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/name' + "$.components.schemas.NetworkSubnetworkSerializer.properties.name" + """ + + port_security_enabled: bool + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/port_security_enabled' + "$.components.schemas.NetworkSubnetworkSerializer.properties.port_security_enabled" + """ + + region: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/region' + "$.components.schemas.NetworkSubnetworkSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/region_id' + "$.components.schemas.NetworkSubnetworkSerializer.properties.region_id" + """ + + shared: bool + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/shared' + "$.components.schemas.NetworkSubnetworkSerializer.properties.shared" + """ + + tags: List[Tag] + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/tags' + "$.components.schemas.NetworkSubnetworkSerializer.properties.tags" + """ + + type: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/type' + "$.components.schemas.NetworkSubnetworkSerializer.properties.type" + """ + + updated_at: datetime + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/updated_at' + "$.components.schemas.NetworkSubnetworkSerializer.properties.updated_at" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.creator_task_id.anyOf[0]" + """ + + default: Optional[bool] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/default/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties['default'].anyOf[0]" + """ + + mtu: Optional[int] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/mtu' + "$.components.schemas.NetworkSubnetworkSerializer.properties.mtu" + """ + + project_id: Optional[int] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/project_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.project_id.anyOf[0]" + """ + + segmentation_id: Optional[int] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/segmentation_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.segmentation_id.anyOf[0]" + """ + + subnets: Optional[List[Subnet]] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/subnets/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.subnets.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/task_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.task_id.anyOf[0]" + """ + + +class SubPortAllowedAddressPair(BaseModel): + ip_address: str + """ + '#/components/schemas/AllowedAddressPairsSerializer/properties/ip_address/anyOf/0' + "$.components.schemas.AllowedAddressPairsSerializer.properties.ip_address.anyOf[0]" + """ + + mac_address: Optional[str] = None + """ + '#/components/schemas/AllowedAddressPairsSerializer/properties/mac_address/anyOf/0' + "$.components.schemas.AllowedAddressPairsSerializer.properties.mac_address.anyOf[0]" + """ + + +class SubPortIPAssignment(BaseModel): + ip_address: str + """ + '#/components/schemas/PortIpSubnetIdSerializer/properties/ip_address' + "$.components.schemas.PortIpSubnetIdSerializer.properties.ip_address" + """ + + subnet_id: str + """ + '#/components/schemas/PortIpSubnetIdSerializer/properties/subnet_id' + "$.components.schemas.PortIpSubnetIdSerializer.properties.subnet_id" + """ + + +class SubPortNetworkDetails(BaseModel): + id: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/id' + "$.components.schemas.NetworkSubnetworkSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/created_at' + "$.components.schemas.NetworkSubnetworkSerializer.properties.created_at" + """ + + external: bool + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/external' + "$.components.schemas.NetworkSubnetworkSerializer.properties.external" + """ + + name: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/name' + "$.components.schemas.NetworkSubnetworkSerializer.properties.name" + """ + + port_security_enabled: bool + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/port_security_enabled' + "$.components.schemas.NetworkSubnetworkSerializer.properties.port_security_enabled" + """ + + region: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/region' + "$.components.schemas.NetworkSubnetworkSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/region_id' + "$.components.schemas.NetworkSubnetworkSerializer.properties.region_id" + """ + + shared: bool + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/shared' + "$.components.schemas.NetworkSubnetworkSerializer.properties.shared" + """ + + tags: List[Tag] + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/tags' + "$.components.schemas.NetworkSubnetworkSerializer.properties.tags" + """ + + type: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/type' + "$.components.schemas.NetworkSubnetworkSerializer.properties.type" + """ + + updated_at: datetime + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/updated_at' + "$.components.schemas.NetworkSubnetworkSerializer.properties.updated_at" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.creator_task_id.anyOf[0]" + """ + + default: Optional[bool] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/default/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties['default'].anyOf[0]" + """ + + mtu: Optional[int] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/mtu' + "$.components.schemas.NetworkSubnetworkSerializer.properties.mtu" + """ + + project_id: Optional[int] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/project_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.project_id.anyOf[0]" + """ + + segmentation_id: Optional[int] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/segmentation_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.segmentation_id.anyOf[0]" + """ + + subnets: Optional[List[Subnet]] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/subnets/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.subnets.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/task_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.task_id.anyOf[0]" + """ + + +class SubPort(BaseModel): + allowed_address_pairs: List[SubPortAllowedAddressPair] + """ + '#/components/schemas/InstanceInterfaceSubportSerializer/properties/allowed_address_pairs' + "$.components.schemas.InstanceInterfaceSubportSerializer.properties.allowed_address_pairs" + """ + + floatingip_details: List[FloatingIP] + """ + '#/components/schemas/InstanceInterfaceSubportSerializer/properties/floatingip_details' + "$.components.schemas.InstanceInterfaceSubportSerializer.properties.floatingip_details" + """ + + ip_assignments: List[SubPortIPAssignment] + """ + '#/components/schemas/InstanceInterfaceSubportSerializer/properties/ip_assignments' + "$.components.schemas.InstanceInterfaceSubportSerializer.properties.ip_assignments" + """ + + network_details: SubPortNetworkDetails + """ + '#/components/schemas/InstanceInterfaceSubportSerializer/properties/network_details' + "$.components.schemas.InstanceInterfaceSubportSerializer.properties.network_details" + """ + + network_id: str + """ + '#/components/schemas/InstanceInterfaceSubportSerializer/properties/network_id' + "$.components.schemas.InstanceInterfaceSubportSerializer.properties.network_id" + """ + + port_id: str + """ + '#/components/schemas/InstanceInterfaceSubportSerializer/properties/port_id' + "$.components.schemas.InstanceInterfaceSubportSerializer.properties.port_id" + """ + + port_security_enabled: bool + """ + '#/components/schemas/InstanceInterfaceSubportSerializer/properties/port_security_enabled' + "$.components.schemas.InstanceInterfaceSubportSerializer.properties.port_security_enabled" + """ + + segmentation_id: int + """ + '#/components/schemas/InstanceInterfaceSubportSerializer/properties/segmentation_id' + "$.components.schemas.InstanceInterfaceSubportSerializer.properties.segmentation_id" + """ + + segmentation_type: str + """ + '#/components/schemas/InstanceInterfaceSubportSerializer/properties/segmentation_type' + "$.components.schemas.InstanceInterfaceSubportSerializer.properties.segmentation_type" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/InstanceInterfaceSubportSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.InstanceInterfaceSubportSerializer.properties.interface_name.anyOf[0]" + """ + + mac_address: Optional[str] = None + """ + '#/components/schemas/InstanceInterfaceSubportSerializer/properties/mac_address/anyOf/0' + "$.components.schemas.InstanceInterfaceSubportSerializer.properties.mac_address.anyOf[0]" + """ + + +class NetworkInterface(BaseModel): + allowed_address_pairs: List[AllowedAddressPair] + """ + '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/allowed_address_pairs' + "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.allowed_address_pairs" + """ + + floatingip_details: List[FloatingIP] + """ + '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/floatingip_details' + "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.floatingip_details" + """ + + ip_assignments: List[IPAssignment] + """ + '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/ip_assignments' + "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.ip_assignments" + """ + + network_details: NetworkDetails + """ + '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/network_details' + "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.network_details" + """ + + network_id: str + """ + '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/network_id' + "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.network_id" + """ + + port_id: str + """ + '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/port_id' + "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.port_id" + """ + + port_security_enabled: bool + """ + '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/port_security_enabled' + "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.port_security_enabled" + """ + + sub_ports: List[SubPort] + """ + '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/sub_ports' + "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.sub_ports" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.interface_name.anyOf[0]" + """ + + mac_address: Optional[str] = None + """ + '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/mac_address/anyOf/0' + "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.mac_address.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/network_interface_list.py b/src/gcore/types/cloud/network_interface_list.py new file mode 100644 index 00000000..b7f5805f --- /dev/null +++ b/src/gcore/types/cloud/network_interface_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .network_interface import NetworkInterface + +__all__ = ["NetworkInterfaceList"] + + +class NetworkInterfaceList(BaseModel): + count: int + """ + '#/components/schemas/InstanceInterfaceTrunkCollectionSerializer/properties/count' + "$.components.schemas.InstanceInterfaceTrunkCollectionSerializer.properties.count" + """ + + results: List[NetworkInterface] + """ + '#/components/schemas/InstanceInterfaceTrunkCollectionSerializer/properties/results' + "$.components.schemas.InstanceInterfaceTrunkCollectionSerializer.properties.results" + """ diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/__init__.py b/tests/api_resources/cloud/gpu_baremetal_clusters/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py new file mode 100644 index 00000000..05585a1a --- /dev/null +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py @@ -0,0 +1,110 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import GPUBaremetalFlavorList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFlavors: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + flavor = client.cloud.gpu_baremetal_clusters.flavors.list( + project_id=1, + region_id=7, + ) + assert_matches_type(GPUBaremetalFlavorList, flavor, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + flavor = client.cloud.gpu_baremetal_clusters.flavors.list( + project_id=1, + region_id=7, + hide_disabled=True, + include_prices=True, + ) + assert_matches_type(GPUBaremetalFlavorList, flavor, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.flavors.with_raw_response.list( + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = response.parse() + assert_matches_type(GPUBaremetalFlavorList, flavor, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.flavors.with_streaming_response.list( + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = response.parse() + assert_matches_type(GPUBaremetalFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFlavors: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.gpu_baremetal_clusters.flavors.list( + project_id=1, + region_id=7, + ) + assert_matches_type(GPUBaremetalFlavorList, flavor, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.gpu_baremetal_clusters.flavors.list( + project_id=1, + region_id=7, + hide_disabled=True, + include_prices=True, + ) + assert_matches_type(GPUBaremetalFlavorList, flavor, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.flavors.with_raw_response.list( + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = await response.parse() + assert_matches_type(GPUBaremetalFlavorList, flavor, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.flavors.with_streaming_response.list( + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = await response.parse() + assert_matches_type(GPUBaremetalFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py new file mode 100644 index 00000000..c2b357cb --- /dev/null +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py @@ -0,0 +1,390 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import GPUImage, TaskIDList, GPUImageList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestImages: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + image = client.cloud.gpu_baremetal_clusters.images.list( + project_id=1, + region_id=7, + ) + assert_matches_type(GPUImageList, image, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.images.with_raw_response.list( + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(GPUImageList, image, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.images.with_streaming_response.list( + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(GPUImageList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + image = client.cloud.gpu_baremetal_clusters.images.delete( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.images.with_raw_response.delete( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.images.with_streaming_response.delete( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + client.cloud.gpu_baremetal_clusters.images.with_raw_response.delete( + image_id="", + project_id=1, + region_id=7, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + image = client.cloud.gpu_baremetal_clusters.images.get( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + assert_matches_type(GPUImage, image, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.images.with_raw_response.get( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(GPUImage, image, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.images.with_streaming_response.get( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(GPUImage, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + client.cloud.gpu_baremetal_clusters.images.with_raw_response.get( + image_id="", + project_id=1, + region_id=7, + ) + + @parametrize + def test_method_upload(self, client: Gcore) -> None: + image = client.cloud.gpu_baremetal_clusters.images.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_method_upload_with_all_params(self, client: Gcore) -> None: + image = client.cloud.gpu_baremetal_clusters.images.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + architecture="x86_64", + cow_format=True, + hw_firmware_type="bios", + os_distro="os_distro", + os_type="linux", + os_version="19.04", + ssh_key="allow", + tags={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_raw_response_upload(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.images.with_raw_response.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_streaming_response_upload(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.images.with_streaming_response.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncImages: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.gpu_baremetal_clusters.images.list( + project_id=1, + region_id=7, + ) + assert_matches_type(GPUImageList, image, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.images.with_raw_response.list( + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(GPUImageList, image, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.images.with_streaming_response.list( + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(GPUImageList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.gpu_baremetal_clusters.images.delete( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.images.with_raw_response.delete( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.images.with_streaming_response.delete( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.images.with_raw_response.delete( + image_id="", + project_id=1, + region_id=7, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.gpu_baremetal_clusters.images.get( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + assert_matches_type(GPUImage, image, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.images.with_raw_response.get( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(GPUImage, image, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.images.with_streaming_response.get( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(GPUImage, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.images.with_raw_response.get( + image_id="", + project_id=1, + region_id=7, + ) + + @parametrize + async def test_method_upload(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.gpu_baremetal_clusters.images.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.gpu_baremetal_clusters.images.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + architecture="x86_64", + cow_format=True, + hw_firmware_type="bios", + os_distro="os_distro", + os_type="linux", + os_version="19.04", + ssh_key="allow", + tags={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_raw_response_upload(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.images.with_raw_response.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_streaming_response_upload(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.images.with_streaming_response.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py new file mode 100644 index 00000000..bc0fc507 --- /dev/null +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py @@ -0,0 +1,114 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import NetworkInterfaceList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInterfaces: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.list( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(NetworkInterfaceList, interface, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.list( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(NetworkInterfaceList, interface, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.list( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(NetworkInterfaceList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.list( + cluster_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncInterfaces: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.list( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(NetworkInterfaceList, interface, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.list( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(NetworkInterfaceList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.list( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(NetworkInterfaceList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.list( + cluster_id="", + project_id=0, + region_id=0, + ) diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py new file mode 100644 index 00000000..8b15da66 --- /dev/null +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py @@ -0,0 +1,1202 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import Console, TaskIDList, GPUClusterServer + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestServers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.delete( + instance_id="instance_id", + project_id="project_id", + region_id="region_id", + cluster_id="cluster_id", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_method_delete_with_all_params(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.delete( + instance_id="instance_id", + project_id="project_id", + region_id="region_id", + cluster_id="cluster_id", + delete_floatings=True, + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + instance_id="instance_id", + project_id="project_id", + region_id="region_id", + cluster_id="cluster_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.delete( + instance_id="instance_id", + project_id="project_id", + region_id="region_id", + cluster_id="cluster_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + instance_id="instance_id", + project_id="", + region_id="region_id", + cluster_id="cluster_id", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `region_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + instance_id="instance_id", + project_id="project_id", + region_id="", + cluster_id="cluster_id", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + instance_id="instance_id", + project_id="project_id", + region_id="region_id", + cluster_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + instance_id="", + project_id="project_id", + region_id="region_id", + cluster_id="cluster_id", + ) + + @parametrize + def test_method_attach_interface_overload_1(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_method_attach_interface_with_all_params_overload_1(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="interface_name", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="external", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_raw_response_attach_interface_overload_1(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_streaming_response_attach_interface_overload_1(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_interface_overload_1(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_attach_interface_overload_2(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_method_attach_interface_with_all_params_overload_2(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-subnet-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="subnet", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_raw_response_attach_interface_overload_2(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_streaming_response_attach_interface_overload_2(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_interface_overload_2(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + def test_method_attach_interface_overload_3(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_method_attach_interface_with_all_params_overload_3(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-any-subnet-interface", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="any_subnet", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_raw_response_attach_interface_overload_3(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_streaming_response_attach_interface_overload_3(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_interface_overload_3(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + def test_method_attach_interface_overload_4(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_method_attach_interface_with_all_params_overload_4(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-rfip-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="reserved_fixed_ip", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_raw_response_attach_interface_overload_4(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_streaming_response_attach_interface_overload_4(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_interface_overload_4(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + @parametrize + def test_method_detach_interface(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.detach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_raw_response_detach_interface(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.detach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_streaming_response_detach_interface(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.detach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_detach_interface(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.detach_interface( + instance_id="", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + + @parametrize + def test_method_get_console(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Console, server, path=["response"]) + + @parametrize + def test_raw_response_get_console(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(Console, server, path=["response"]) + + @parametrize + def test_streaming_response_get_console(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(Console, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_console(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.get_console( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_powercycle(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.powercycle( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(GPUClusterServer, server, path=["response"]) + + @parametrize + def test_raw_response_powercycle(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.powercycle( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(GPUClusterServer, server, path=["response"]) + + @parametrize + def test_streaming_response_powercycle(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.powercycle( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(GPUClusterServer, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_powercycle(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.powercycle( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_reboot(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.reboot( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(GPUClusterServer, server, path=["response"]) + + @parametrize + def test_raw_response_reboot(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.reboot( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(GPUClusterServer, server, path=["response"]) + + @parametrize + def test_streaming_response_reboot(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.reboot( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(GPUClusterServer, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_reboot(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.reboot( + instance_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncServers: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.delete( + instance_id="instance_id", + project_id="project_id", + region_id="region_id", + cluster_id="cluster_id", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.delete( + instance_id="instance_id", + project_id="project_id", + region_id="region_id", + cluster_id="cluster_id", + delete_floatings=True, + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + instance_id="instance_id", + project_id="project_id", + region_id="region_id", + cluster_id="cluster_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.delete( + instance_id="instance_id", + project_id="project_id", + region_id="region_id", + cluster_id="cluster_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + instance_id="instance_id", + project_id="", + region_id="region_id", + cluster_id="cluster_id", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `region_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + instance_id="instance_id", + project_id="project_id", + region_id="", + cluster_id="cluster_id", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + instance_id="instance_id", + project_id="project_id", + region_id="region_id", + cluster_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + instance_id="", + project_id="project_id", + region_id="region_id", + cluster_id="cluster_id", + ) + + @parametrize + async def test_method_attach_interface_overload_1(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_method_attach_interface_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="interface_name", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="external", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_raw_response_attach_interface_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_streaming_response_attach_interface_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_interface_overload_1(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_attach_interface_overload_2(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_method_attach_interface_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-subnet-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="subnet", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_raw_response_attach_interface_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_streaming_response_attach_interface_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_interface_overload_2(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + async def test_method_attach_interface_overload_3(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_method_attach_interface_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-any-subnet-interface", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="any_subnet", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_raw_response_attach_interface_overload_3(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_streaming_response_attach_interface_overload_3(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_interface_overload_3(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + async def test_method_attach_interface_overload_4(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_method_attach_interface_with_all_params_overload_4(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-rfip-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="reserved_fixed_ip", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_raw_response_attach_interface_overload_4(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_streaming_response_attach_interface_overload_4(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_interface_overload_4(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( + instance_id="", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + @parametrize + async def test_method_detach_interface(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.detach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_raw_response_detach_interface(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.detach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_streaming_response_detach_interface(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.detach_interface( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_detach_interface(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.detach_interface( + instance_id="", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + + @parametrize + async def test_method_get_console(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Console, server, path=["response"]) + + @parametrize + async def test_raw_response_get_console(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(Console, server, path=["response"]) + + @parametrize + async def test_streaming_response_get_console(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(Console, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_console(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.get_console( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_powercycle(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.powercycle( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(GPUClusterServer, server, path=["response"]) + + @parametrize + async def test_raw_response_powercycle(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.powercycle( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(GPUClusterServer, server, path=["response"]) + + @parametrize + async def test_streaming_response_powercycle(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.powercycle( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(GPUClusterServer, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_powercycle(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.powercycle( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_reboot(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.reboot( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(GPUClusterServer, server, path=["response"]) + + @parametrize + async def test_raw_response_reboot(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.reboot( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(GPUClusterServer, server, path=["response"]) + + @parametrize + async def test_streaming_response_reboot(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.reboot( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(GPUClusterServer, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_reboot(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.reboot( + instance_id="", + project_id=0, + region_id=0, + ) diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py new file mode 100644 index 00000000..936cda07 --- /dev/null +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -0,0 +1,1015 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import ( + TaskIDList, + GPUBaremetalCluster, + GPUClusterServerList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestGPUBaremetalClusters: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( + project_id="project_id", + region_id="region_id", + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( + project_id="project_id", + region_id="region_id", + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + "floating_ip": {"source": "new"}, + "interface_name": "interface_name", + "port_group": 0, + "security_groups": [{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], + } + ], + name="my-gpu-cluster", + instances_count=1, + keypair_name="my-keypair", + password="password", + tags={"my-tag": "my-tag-value"}, + user_data="user_data", + username="username", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.with_raw_response.create( + project_id="project_id", + region_id="region_id", + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.with_streaming_response.create( + project_id="project_id", + region_id="region_id", + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.create( + project_id="", + region_id="region_id", + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `region_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.create( + project_id="project_id", + region_id="", + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( + project_id=0, + region_id=0, + ) + assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( + project_id=0, + region_id=0, + limit=0, + offset=0, + ) + assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = response.parse() + assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = response.parse() + assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_method_delete_with_all_params(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + delete_floatings=True, + floatings="floatings", + reserved_fixed_ips="reserved_fixed_ips", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.with_streaming_response.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + cluster_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.get( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.with_raw_response.get( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = response.parse() + assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.with_streaming_response.get( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = response.parse() + assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.get( + cluster_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_powercycle_all_servers(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.powercycle_all_servers( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_raw_response_powercycle_all_servers(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.with_raw_response.powercycle_all_servers( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = response.parse() + assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_streaming_response_powercycle_all_servers(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.with_streaming_response.powercycle_all_servers( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = response.parse() + assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_powercycle_all_servers(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.powercycle_all_servers( + cluster_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_reboot_all_servers(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.reboot_all_servers( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_raw_response_reboot_all_servers(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.with_raw_response.reboot_all_servers( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = response.parse() + assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_streaming_response_reboot_all_servers(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.with_streaming_response.reboot_all_servers( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = response.parse() + assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_reboot_all_servers(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.reboot_all_servers( + cluster_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_rebuild(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.rebuild( + cluster_id="cluster_id", + project_id=0, + region_id=0, + nodes=["string"], + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_method_rebuild_with_all_params(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.rebuild( + cluster_id="cluster_id", + project_id=0, + region_id=0, + nodes=["string"], + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + user_data="user_data", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_raw_response_rebuild(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.with_raw_response.rebuild( + cluster_id="cluster_id", + project_id=0, + region_id=0, + nodes=["string"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_streaming_response_rebuild(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.with_streaming_response.rebuild( + cluster_id="cluster_id", + project_id=0, + region_id=0, + nodes=["string"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_rebuild(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.rebuild( + cluster_id="", + project_id=0, + region_id=0, + nodes=["string"], + ) + + @parametrize + def test_method_resize(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.resize( + cluster_id="cluster_id", + project_id="project_id", + region_id="region_id", + instances_count=1, + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_raw_response_resize(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.with_raw_response.resize( + cluster_id="cluster_id", + project_id="project_id", + region_id="region_id", + instances_count=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_streaming_response_resize(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.with_streaming_response.resize( + cluster_id="cluster_id", + project_id="project_id", + region_id="region_id", + instances_count=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_resize(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.resize( + cluster_id="cluster_id", + project_id="", + region_id="region_id", + instances_count=1, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `region_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.resize( + cluster_id="cluster_id", + project_id="project_id", + region_id="", + instances_count=1, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.resize( + cluster_id="", + project_id="project_id", + region_id="region_id", + instances_count=1, + ) + + +class TestAsyncGPUBaremetalClusters: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( + project_id="project_id", + region_id="region_id", + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( + project_id="project_id", + region_id="region_id", + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + "floating_ip": {"source": "new"}, + "interface_name": "interface_name", + "port_group": 0, + "security_groups": [{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], + } + ], + name="my-gpu-cluster", + instances_count=1, + keypair_name="my-keypair", + password="password", + tags={"my-tag": "my-tag-value"}, + user_data="user_data", + username="username", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.create( + project_id="project_id", + region_id="region_id", + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.create( + project_id="project_id", + region_id="region_id", + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.create( + project_id="", + region_id="region_id", + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `region_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.create( + project_id="project_id", + region_id="", + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( + project_id=0, + region_id=0, + ) + assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( + project_id=0, + region_id=0, + limit=0, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + delete_floatings=True, + floatings="floatings", + reserved_fixed_ips="reserved_fixed_ips", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + cluster_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.get( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.get( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = await response.parse() + assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.get( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = await response.parse() + assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.get( + cluster_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_powercycle_all_servers(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.powercycle_all_servers( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_raw_response_powercycle_all_servers(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.powercycle_all_servers( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = await response.parse() + assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_powercycle_all_servers(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.powercycle_all_servers( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = await response.parse() + assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_powercycle_all_servers(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.powercycle_all_servers( + cluster_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_reboot_all_servers(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.reboot_all_servers( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_raw_response_reboot_all_servers(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.reboot_all_servers( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = await response.parse() + assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_reboot_all_servers(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.reboot_all_servers( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = await response.parse() + assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_reboot_all_servers(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.reboot_all_servers( + cluster_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_rebuild(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.rebuild( + cluster_id="cluster_id", + project_id=0, + region_id=0, + nodes=["string"], + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_method_rebuild_with_all_params(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.rebuild( + cluster_id="cluster_id", + project_id=0, + region_id=0, + nodes=["string"], + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + user_data="user_data", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_raw_response_rebuild(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.rebuild( + cluster_id="cluster_id", + project_id=0, + region_id=0, + nodes=["string"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_rebuild(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.rebuild( + cluster_id="cluster_id", + project_id=0, + region_id=0, + nodes=["string"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_rebuild(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.rebuild( + cluster_id="", + project_id=0, + region_id=0, + nodes=["string"], + ) + + @parametrize + async def test_method_resize(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.resize( + cluster_id="cluster_id", + project_id="project_id", + region_id="region_id", + instances_count=1, + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.resize( + cluster_id="cluster_id", + project_id="project_id", + region_id="region_id", + instances_count=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.resize( + cluster_id="cluster_id", + project_id="project_id", + region_id="region_id", + instances_count=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_resize(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.resize( + cluster_id="cluster_id", + project_id="", + region_id="region_id", + instances_count=1, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `region_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.resize( + cluster_id="cluster_id", + project_id="project_id", + region_id="", + instances_count=1, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.resize( + cluster_id="", + project_id="project_id", + region_id="region_id", + instances_count=1, + ) From 142ba6f66f658803da3e37b00946f8975cdd62fe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 15:13:40 +0000 Subject: [PATCH 084/592] feat(api): remove duplicates --- .stats.yml | 4 +- api.md | 89 +- src/gcore/resources/cloud/__init__.py | 12 +- .../resources/cloud/baremetal/servers.py | 7 +- src/gcore/resources/cloud/cloud.py | 48 +- .../cloud/file_shares/file_shares.py | 15 +- src/gcore/resources/cloud/floating_ips.py | 7 +- .../gpu_baremetal_clusters.py | 7 +- .../cloud/gpu_baremetal_clusters/images.py | 7 +- .../resources/cloud/instances/__init__.py | 42 + .../resources/cloud/instances/flavors.py | 503 ++++ src/gcore/resources/cloud/instances/images.py | 15 +- .../resources/cloud/instances/instances.py | 2459 +++++++++++++++++ .../resources/cloud/instances/interfaces.py | 959 +++++++ .../resources/cloud/instances/metrics.py | 227 ++ .../cloud/load_balancers/load_balancers.py | 7 +- .../resources/cloud/networks/networks.py | 7 +- src/gcore/resources/cloud/networks/subnets.py | 7 +- src/gcore/resources/cloud/volumes.py | 19 +- src/gcore/types/cloud/__init__.py | 20 + .../cloud/baremetal/server_create_params.py | 5 +- .../types/cloud/file_share_create_params.py | 8 +- .../types/cloud/floating_ip_create_params.py | 6 +- .../gpu_baremetal_cluster_create_params.py | 5 +- .../image_upload_params.py | 6 +- src/gcore/types/cloud/instance.py | 630 +++++ .../types/cloud/instance_action_params.py | 57 + .../instance_add_to_placement_group_params.py | 27 + .../instance_assign_security_group_params.py | 48 + .../types/cloud/instance_create_params.py | 513 ++++ .../types/cloud/instance_delete_params.py | 45 + .../cloud/instance_get_console_params.py | 27 + src/gcore/types/cloud/instance_interface.py | 205 ++ src/gcore/types/cloud/instance_list.py | 22 + src/gcore/types/cloud/instance_list_params.py | 198 ++ .../types/cloud/instance_resize_params.py | 27 + ...instance_unassign_security_group_params.py | 48 + .../types/cloud/instance_update_params.py | 27 + src/gcore/types/cloud/instances/__init__.py | 10 + .../flavor_list_for_resize_params.py | 27 + .../cloud/instances/flavor_list_params.py | 45 + .../instances/flavor_list_suitable_params.py | 90 + .../image_create_from_volume_params.py | 6 +- .../cloud/instances/image_update_params.py | 5 +- .../cloud/instances/image_upload_params.py | 6 +- .../types/cloud/instances/instance_flavor.py | 88 + .../cloud/instances/instance_flavor_list.py | 22 + .../instances/interface_attach_params.py | 456 +++ .../instances/interface_detach_params.py | 33 + .../cloud/instances/metric_list_params.py | 35 + src/gcore/types/cloud/instances/metrics.py | 91 + .../types/cloud/instances/metrics_list.py | 22 + .../cloud/load_balancer_create_params.py | 5 +- .../types/cloud/network_create_params.py | 5 +- .../cloud/networks/subnet_create_params.py | 5 +- .../types/cloud/tag_update_list_param.py | 10 + src/gcore/types/cloud/volume_create_params.py | 10 +- .../cloud/baremetal/test_servers.py | 4 +- .../gpu_baremetal_clusters/test_images.py | 4 +- .../cloud/instances/test_flavors.py | 346 +++ .../cloud/instances/test_images.py | 12 +- .../cloud/instances/test_interfaces.py | 848 ++++++ .../cloud/instances/test_metrics.py | 130 + .../cloud/networks/test_subnets.py | 4 +- tests/api_resources/cloud/test_file_shares.py | 8 +- .../api_resources/cloud/test_floating_ips.py | 4 +- .../cloud/test_gpu_baremetal_clusters.py | 4 +- tests/api_resources/cloud/test_instances.py | 1725 ++++++++++++ .../cloud/test_load_balancers.py | 4 +- tests/api_resources/cloud/test_networks.py | 9 +- tests/api_resources/cloud/test_volumes.py | 12 +- 71 files changed, 10303 insertions(+), 147 deletions(-) create mode 100644 src/gcore/resources/cloud/instances/flavors.py create mode 100644 src/gcore/resources/cloud/instances/interfaces.py create mode 100644 src/gcore/resources/cloud/instances/metrics.py create mode 100644 src/gcore/types/cloud/instance.py create mode 100644 src/gcore/types/cloud/instance_action_params.py create mode 100644 src/gcore/types/cloud/instance_add_to_placement_group_params.py create mode 100644 src/gcore/types/cloud/instance_assign_security_group_params.py create mode 100644 src/gcore/types/cloud/instance_create_params.py create mode 100644 src/gcore/types/cloud/instance_delete_params.py create mode 100644 src/gcore/types/cloud/instance_get_console_params.py create mode 100644 src/gcore/types/cloud/instance_interface.py create mode 100644 src/gcore/types/cloud/instance_list.py create mode 100644 src/gcore/types/cloud/instance_list_params.py create mode 100644 src/gcore/types/cloud/instance_resize_params.py create mode 100644 src/gcore/types/cloud/instance_unassign_security_group_params.py create mode 100644 src/gcore/types/cloud/instance_update_params.py create mode 100644 src/gcore/types/cloud/instances/flavor_list_for_resize_params.py create mode 100644 src/gcore/types/cloud/instances/flavor_list_params.py create mode 100644 src/gcore/types/cloud/instances/flavor_list_suitable_params.py create mode 100644 src/gcore/types/cloud/instances/instance_flavor.py create mode 100644 src/gcore/types/cloud/instances/instance_flavor_list.py create mode 100644 src/gcore/types/cloud/instances/interface_attach_params.py create mode 100644 src/gcore/types/cloud/instances/interface_detach_params.py create mode 100644 src/gcore/types/cloud/instances/metric_list_params.py create mode 100644 src/gcore/types/cloud/instances/metrics.py create mode 100644 src/gcore/types/cloud/instances/metrics_list.py create mode 100644 src/gcore/types/cloud/tag_update_list_param.py create mode 100644 tests/api_resources/cloud/instances/test_flavors.py create mode 100644 tests/api_resources/cloud/instances/test_interfaces.py create mode 100644 tests/api_resources/cloud/instances/test_metrics.py create mode 100644 tests/api_resources/cloud/test_instances.py diff --git a/.stats.yml b/.stats.yml index f7ecf0f9..66855e16 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 207 +configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fd112571ef5f42061c9dee7ecc057c924513aa9e6b2c9e373e847b07eb19e315.yml openapi_spec_hash: 842d806607c522f6db146861c3d2ec62 -config_hash: c348fbf7090d8e896780cb8cd3a808f5 +config_hash: 6c6a10d09723b492598499f838299f17 diff --git a/api.md b/api.md index 363e3707..16116fc1 100644 --- a/api.md +++ b/api.md @@ -20,6 +20,8 @@ from gcore.types.cloud import ( GPUImageList, Image, ImageList, + Instance, + InstanceList, InstanceMetricsTimeUnit, InterfaceIPFamily, IPVersion, @@ -29,12 +31,16 @@ from gcore.types.cloud import ( LoadBalancerOperatingStatus, LoadBalancerStatistics, Network, + NetworkAnySubnetFip, NetworkInterface, NetworkInterfaceList, + NetworkSubnetFip, ProvisioningStatus, + RemoteConsole, Subnet, Tag, TagList, + TagUpdateList, TaskIDList, ) ``` @@ -596,19 +602,6 @@ Methods: - client.cloud.baremetal.servers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[BaremetalServer] - client.cloud.baremetal.servers.rebuild(server_id, \*, project_id, region_id, \*\*params) -> TaskIDList -## Instances - -### Images - -Methods: - -- client.cloud.instances.images.update(image_id, \*, project_id, region_id, \*\*params) -> Image -- client.cloud.instances.images.list(\*, project_id, region_id, \*\*params) -> ImageList -- client.cloud.instances.images.delete(image_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.instances.images.create_from_volume(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.instances.images.get(image_id, \*, project_id, region_id, \*\*params) -> Image -- client.cloud.instances.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList - ## Registries Types: @@ -768,3 +761,73 @@ Methods: - client.cloud.gpu_baremetal_clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList - client.cloud.gpu_baremetal_clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage - client.cloud.gpu_baremetal_clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList + +## Instances + +Types: + +```python +from gcore.types.cloud import InstanceInterface +``` + +Methods: + +- client.cloud.instances.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.update(instance_id, \*, project_id, region_id, \*\*params) -> Instance +- client.cloud.instances.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Instance] +- client.cloud.instances.delete(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.action(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.add_to_placement_group(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.assign_security_group(instance_id, \*, project_id, region_id, \*\*params) -> None +- client.cloud.instances.disable_port_security(port_id, \*, project_id, region_id) -> InstanceInterface +- client.cloud.instances.enable_port_security(port_id, \*, project_id, region_id) -> InstanceInterface +- client.cloud.instances.get(instance_id, \*, project_id, region_id) -> Instance +- client.cloud.instances.get_console(instance_id, \*, project_id, region_id, \*\*params) -> Console +- client.cloud.instances.remove_from_placement_group(instance_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.instances.resize(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.unassign_security_group(instance_id, \*, project_id, region_id, \*\*params) -> None + +### Flavors + +Types: + +```python +from gcore.types.cloud.instances import InstanceFlavor, InstanceFlavorList +``` + +Methods: + +- client.cloud.instances.flavors.list(\*, project_id, region_id, \*\*params) -> InstanceFlavorList +- client.cloud.instances.flavors.list_for_resize(instance_id, \*, project_id, region_id, \*\*params) -> InstanceFlavorList +- client.cloud.instances.flavors.list_suitable(\*, project_id, region_id, \*\*params) -> InstanceFlavorList + +### Interfaces + +Methods: + +- client.cloud.instances.interfaces.list(instance_id, \*, project_id, region_id) -> NetworkInterfaceList +- client.cloud.instances.interfaces.attach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.interfaces.detach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList + +### Images + +Methods: + +- client.cloud.instances.images.update(image_id, \*, project_id, region_id, \*\*params) -> Image +- client.cloud.instances.images.list(\*, project_id, region_id, \*\*params) -> ImageList +- client.cloud.instances.images.delete(image_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.instances.images.create_from_volume(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.images.get(image_id, \*, project_id, region_id, \*\*params) -> Image +- client.cloud.instances.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList + +### Metrics + +Types: + +```python +from gcore.types.cloud.instances import Metrics, MetricsList +``` + +Methods: + +- client.cloud.instances.metrics.list(instance_id, \*, project_id, region_id, \*\*params) -> MetricsList diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 96dd527c..62c133cf 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -288,12 +288,6 @@ "AsyncBaremetalResourceWithRawResponse", "BaremetalResourceWithStreamingResponse", "AsyncBaremetalResourceWithStreamingResponse", - "InstancesResource", - "AsyncInstancesResource", - "InstancesResourceWithRawResponse", - "AsyncInstancesResourceWithRawResponse", - "InstancesResourceWithStreamingResponse", - "AsyncInstancesResourceWithStreamingResponse", "RegistriesResource", "AsyncRegistriesResource", "RegistriesResourceWithRawResponse", @@ -318,6 +312,12 @@ "AsyncGPUBaremetalClustersResourceWithRawResponse", "GPUBaremetalClustersResourceWithStreamingResponse", "AsyncGPUBaremetalClustersResourceWithStreamingResponse", + "InstancesResource", + "AsyncInstancesResource", + "InstancesResourceWithRawResponse", + "AsyncInstancesResourceWithRawResponse", + "InstancesResourceWithStreamingResponse", + "AsyncInstancesResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index afc30dd1..e4137a5e 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable, Optional +from typing import List, Union, Iterable, Optional from datetime import datetime from typing_extensions import Literal @@ -22,6 +22,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.baremetal import server_list_params, server_create_params, server_rebuild_params from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.tag_update_list_param import TagUpdateListParam from ....types.cloud.baremetal.baremetal_server import BaremetalServer __all__ = ["ServersResource", "AsyncServersResource"] @@ -62,7 +63,7 @@ def create( name_templates: List[str] | NotGiven = NOT_GIVEN, names: List[str] | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -418,7 +419,7 @@ async def create( name_templates: List[str] | NotGiven = NOT_GIVEN, names: List[str] | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index d9740f20..c9218336 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -253,10 +253,6 @@ def placement_groups(self) -> PlacementGroupsResource: def baremetal(self) -> BaremetalResource: return BaremetalResource(self._client) - @cached_property - def instances(self) -> InstancesResource: - return InstancesResource(self._client) - @cached_property def registries(self) -> RegistriesResource: return RegistriesResource(self._client) @@ -273,6 +269,10 @@ def billing_reservations(self) -> BillingReservationsResource: def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResource: return GPUBaremetalClustersResource(self._client) + @cached_property + def instances(self) -> InstancesResource: + return InstancesResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -362,10 +362,6 @@ def placement_groups(self) -> AsyncPlacementGroupsResource: def baremetal(self) -> AsyncBaremetalResource: return AsyncBaremetalResource(self._client) - @cached_property - def instances(self) -> AsyncInstancesResource: - return AsyncInstancesResource(self._client) - @cached_property def registries(self) -> AsyncRegistriesResource: return AsyncRegistriesResource(self._client) @@ -382,6 +378,10 @@ def billing_reservations(self) -> AsyncBillingReservationsResource: def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResource: return AsyncGPUBaremetalClustersResource(self._client) + @cached_property + def instances(self) -> AsyncInstancesResource: + return AsyncInstancesResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -474,10 +474,6 @@ def placement_groups(self) -> PlacementGroupsResourceWithRawResponse: def baremetal(self) -> BaremetalResourceWithRawResponse: return BaremetalResourceWithRawResponse(self._cloud.baremetal) - @cached_property - def instances(self) -> InstancesResourceWithRawResponse: - return InstancesResourceWithRawResponse(self._cloud.instances) - @cached_property def registries(self) -> RegistriesResourceWithRawResponse: return RegistriesResourceWithRawResponse(self._cloud.registries) @@ -494,6 +490,10 @@ def billing_reservations(self) -> BillingReservationsResourceWithRawResponse: def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithRawResponse: return GPUBaremetalClustersResourceWithRawResponse(self._cloud.gpu_baremetal_clusters) + @cached_property + def instances(self) -> InstancesResourceWithRawResponse: + return InstancesResourceWithRawResponse(self._cloud.instances) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -567,10 +567,6 @@ def placement_groups(self) -> AsyncPlacementGroupsResourceWithRawResponse: def baremetal(self) -> AsyncBaremetalResourceWithRawResponse: return AsyncBaremetalResourceWithRawResponse(self._cloud.baremetal) - @cached_property - def instances(self) -> AsyncInstancesResourceWithRawResponse: - return AsyncInstancesResourceWithRawResponse(self._cloud.instances) - @cached_property def registries(self) -> AsyncRegistriesResourceWithRawResponse: return AsyncRegistriesResourceWithRawResponse(self._cloud.registries) @@ -587,6 +583,10 @@ def billing_reservations(self) -> AsyncBillingReservationsResourceWithRawRespons def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithRawResponse: return AsyncGPUBaremetalClustersResourceWithRawResponse(self._cloud.gpu_baremetal_clusters) + @cached_property + def instances(self) -> AsyncInstancesResourceWithRawResponse: + return AsyncInstancesResourceWithRawResponse(self._cloud.instances) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -660,10 +660,6 @@ def placement_groups(self) -> PlacementGroupsResourceWithStreamingResponse: def baremetal(self) -> BaremetalResourceWithStreamingResponse: return BaremetalResourceWithStreamingResponse(self._cloud.baremetal) - @cached_property - def instances(self) -> InstancesResourceWithStreamingResponse: - return InstancesResourceWithStreamingResponse(self._cloud.instances) - @cached_property def registries(self) -> RegistriesResourceWithStreamingResponse: return RegistriesResourceWithStreamingResponse(self._cloud.registries) @@ -680,6 +676,10 @@ def billing_reservations(self) -> BillingReservationsResourceWithStreamingRespon def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithStreamingResponse: return GPUBaremetalClustersResourceWithStreamingResponse(self._cloud.gpu_baremetal_clusters) + @cached_property + def instances(self) -> InstancesResourceWithStreamingResponse: + return InstancesResourceWithStreamingResponse(self._cloud.instances) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -753,10 +753,6 @@ def placement_groups(self) -> AsyncPlacementGroupsResourceWithStreamingResponse: def baremetal(self) -> AsyncBaremetalResourceWithStreamingResponse: return AsyncBaremetalResourceWithStreamingResponse(self._cloud.baremetal) - @cached_property - def instances(self) -> AsyncInstancesResourceWithStreamingResponse: - return AsyncInstancesResourceWithStreamingResponse(self._cloud.instances) - @cached_property def registries(self) -> AsyncRegistriesResourceWithStreamingResponse: return AsyncRegistriesResourceWithStreamingResponse(self._cloud.registries) @@ -772,3 +768,7 @@ def billing_reservations(self) -> AsyncBillingReservationsResourceWithStreamingR @cached_property def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithStreamingResponse: return AsyncGPUBaremetalClustersResourceWithStreamingResponse(self._cloud.gpu_baremetal_clusters) + + @cached_property + def instances(self) -> AsyncInstancesResourceWithStreamingResponse: + return AsyncInstancesResourceWithStreamingResponse(self._cloud.instances) diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 51e28b39..3f91a20a 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable +from typing import Iterable from typing_extensions import Literal, overload import httpx @@ -35,6 +35,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.file_share import FileShare from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.tag_update_list_param import TagUpdateListParam __all__ = ["FileSharesResource", "AsyncFileSharesResource"] @@ -74,7 +75,7 @@ def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -134,7 +135,7 @@ def create( protocol: Literal["NFS"], size: int, volume_type: Literal["vast_share_type"], - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -188,7 +189,7 @@ def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -520,7 +521,7 @@ async def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -580,7 +581,7 @@ async def create( protocol: Literal["NFS"], size: int, volume_type: Literal["vast_share_type"], - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -634,7 +635,7 @@ async def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 2b52d36d..5e466a1f 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Optional +from typing import List, Optional import httpx @@ -22,6 +22,7 @@ from ...types.cloud.floating_ip import FloatingIP from ...types.cloud.task_id_list import TaskIDList from ...types.cloud.floating_ip_detailed import FloatingIPDetailed +from ...types.cloud.tag_update_list_param import TagUpdateListParam __all__ = ["FloatingIPsResource", "AsyncFloatingIPsResource"] @@ -53,7 +54,7 @@ def create( region_id: int | None = None, fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, port_id: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -414,7 +415,7 @@ async def create( region_id: int | None = None, fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, port_id: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index f2a52b85..c1aeafae 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional +from typing import List, Iterable, Optional import httpx @@ -59,6 +59,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.gpu_baremetal_cluster import GPUBaremetalCluster +from ....types.cloud.tag_update_list_param import TagUpdateListParam from ....types.cloud.gpu_cluster_server_list import GPUClusterServerList __all__ = ["GPUBaremetalClustersResource", "AsyncGPUBaremetalClustersResource"] @@ -112,7 +113,7 @@ def create( instances_count: int | NotGiven = NOT_GIVEN, keypair_name: str | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -656,7 +657,7 @@ async def create( instances_count: int | NotGiven = NOT_GIVEN, keypair_name: str | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index d5dfc47d..eb2990ee 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal import httpx @@ -21,6 +21,7 @@ from ....types.cloud.gpu_image import GPUImage from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.gpu_image_list import GPUImageList +from ....types.cloud.tag_update_list_param import TagUpdateListParam from ....types.cloud.gpu_baremetal_clusters import image_upload_params __all__ = ["ImagesResource", "AsyncImagesResource"] @@ -198,7 +199,7 @@ def upload( os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -454,7 +455,7 @@ async def upload( os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/instances/__init__.py b/src/gcore/resources/cloud/instances/__init__.py index daab9fa0..0f7240dd 100644 --- a/src/gcore/resources/cloud/instances/__init__.py +++ b/src/gcore/resources/cloud/instances/__init__.py @@ -8,6 +8,22 @@ ImagesResourceWithStreamingResponse, AsyncImagesResourceWithStreamingResponse, ) +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) from .instances import ( InstancesResource, AsyncInstancesResource, @@ -16,14 +32,40 @@ InstancesResourceWithStreamingResponse, AsyncInstancesResourceWithStreamingResponse, ) +from .interfaces import ( + InterfacesResource, + AsyncInterfacesResource, + InterfacesResourceWithRawResponse, + AsyncInterfacesResourceWithRawResponse, + InterfacesResourceWithStreamingResponse, + AsyncInterfacesResourceWithStreamingResponse, +) __all__ = [ + "FlavorsResource", + "AsyncFlavorsResource", + "FlavorsResourceWithRawResponse", + "AsyncFlavorsResourceWithRawResponse", + "FlavorsResourceWithStreamingResponse", + "AsyncFlavorsResourceWithStreamingResponse", + "InterfacesResource", + "AsyncInterfacesResource", + "InterfacesResourceWithRawResponse", + "AsyncInterfacesResourceWithRawResponse", + "InterfacesResourceWithStreamingResponse", + "AsyncInterfacesResourceWithStreamingResponse", "ImagesResource", "AsyncImagesResource", "ImagesResourceWithRawResponse", "AsyncImagesResourceWithRawResponse", "ImagesResourceWithStreamingResponse", "AsyncImagesResourceWithStreamingResponse", + "MetricsResource", + "AsyncMetricsResource", + "MetricsResourceWithRawResponse", + "AsyncMetricsResourceWithRawResponse", + "MetricsResourceWithStreamingResponse", + "AsyncMetricsResourceWithStreamingResponse", "InstancesResource", "AsyncInstancesResource", "InstancesResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py new file mode 100644 index 00000000..9eacb19c --- /dev/null +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -0,0 +1,503 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.instances import flavor_list_params, flavor_list_suitable_params, flavor_list_for_resize_params +from ....types.cloud.instances.instance_flavor_list import InstanceFlavorList + +__all__ = ["FlavorsResource", "AsyncFlavorsResource"] + + +class FlavorsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FlavorsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return FlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return FlavorsResourceWithStreamingResponse(self) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + disabled: bool | NotGiven = NOT_GIVEN, + exclude_linux: bool | NotGiven = NOT_GIVEN, + exclude_windows: bool | NotGiven = NOT_GIVEN, + include_prices: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceFlavorList: + """Retrieve a list of flavors. + + When the include_prices query parameter is + specified, the list shows prices. A client in trial mode gets all price values + as 0. If you get Pricing Error contact the support + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[1].schema" + + disabled: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[2]" + + exclude_linux: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[3]" + + exclude_windows: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[4]" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[5]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/flavors/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "disabled": disabled, + "exclude_linux": exclude_linux, + "exclude_windows": exclude_windows, + "include_prices": include_prices, + }, + flavor_list_params.FlavorListParams, + ), + ), + cast_to=InstanceFlavorList, + ) + + def list_for_resize( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + include_prices: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceFlavorList: + """ + List suitable flavors for instance resize + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[2].schema" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/3' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._get( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"include_prices": include_prices}, flavor_list_for_resize_params.FlavorListForResizeParams + ), + ), + cast_to=InstanceFlavorList, + ) + + def list_suitable( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + volumes: Iterable[flavor_list_suitable_params.Volume], + include_prices: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceFlavorList: + """ + List suitable flavors for instance creation + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[1].schema" + + volumes: '#/components/schemas/CreateInstanceVolumeListSchema/properties/volumes' + "$.components.schemas.CreateInstanceVolumeListSchema.properties.volumes" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/2' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[2]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/available_flavors", + body=maybe_transform({"volumes": volumes}, flavor_list_suitable_params.FlavorListSuitableParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"include_prices": include_prices}, flavor_list_suitable_params.FlavorListSuitableParams + ), + ), + cast_to=InstanceFlavorList, + ) + + +class AsyncFlavorsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFlavorsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncFlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncFlavorsResourceWithStreamingResponse(self) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + disabled: bool | NotGiven = NOT_GIVEN, + exclude_linux: bool | NotGiven = NOT_GIVEN, + exclude_windows: bool | NotGiven = NOT_GIVEN, + include_prices: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceFlavorList: + """Retrieve a list of flavors. + + When the include_prices query parameter is + specified, the list shows prices. A client in trial mode gets all price values + as 0. If you get Pricing Error contact the support + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[1].schema" + + disabled: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[2]" + + exclude_linux: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[3]" + + exclude_windows: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[4]" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[5]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/flavors/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "disabled": disabled, + "exclude_linux": exclude_linux, + "exclude_windows": exclude_windows, + "include_prices": include_prices, + }, + flavor_list_params.FlavorListParams, + ), + ), + cast_to=InstanceFlavorList, + ) + + async def list_for_resize( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + include_prices: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceFlavorList: + """ + List suitable flavors for instance resize + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[2].schema" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/3' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._get( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"include_prices": include_prices}, flavor_list_for_resize_params.FlavorListForResizeParams + ), + ), + cast_to=InstanceFlavorList, + ) + + async def list_suitable( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + volumes: Iterable[flavor_list_suitable_params.Volume], + include_prices: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceFlavorList: + """ + List suitable flavors for instance creation + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[1].schema" + + volumes: '#/components/schemas/CreateInstanceVolumeListSchema/properties/volumes' + "$.components.schemas.CreateInstanceVolumeListSchema.properties.volumes" + + include_prices: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/2' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[2]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/available_flavors", + body=await async_maybe_transform( + {"volumes": volumes}, flavor_list_suitable_params.FlavorListSuitableParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"include_prices": include_prices}, flavor_list_suitable_params.FlavorListSuitableParams + ), + ), + cast_to=InstanceFlavorList, + ) + + +class FlavorsResourceWithRawResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_raw_response_wrapper( + flavors.list, + ) + self.list_for_resize = to_raw_response_wrapper( + flavors.list_for_resize, + ) + self.list_suitable = to_raw_response_wrapper( + flavors.list_suitable, + ) + + +class AsyncFlavorsResourceWithRawResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_raw_response_wrapper( + flavors.list, + ) + self.list_for_resize = async_to_raw_response_wrapper( + flavors.list_for_resize, + ) + self.list_suitable = async_to_raw_response_wrapper( + flavors.list_suitable, + ) + + +class FlavorsResourceWithStreamingResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_streamed_response_wrapper( + flavors.list, + ) + self.list_for_resize = to_streamed_response_wrapper( + flavors.list_for_resize, + ) + self.list_suitable = to_streamed_response_wrapper( + flavors.list_suitable, + ) + + +class AsyncFlavorsResourceWithStreamingResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_streamed_response_wrapper( + flavors.list, + ) + self.list_for_resize = async_to_streamed_response_wrapper( + flavors.list_for_resize, + ) + self.list_suitable = async_to_streamed_response_wrapper( + flavors.list_suitable, + ) diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index 65b88a93..71024123 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Optional +from typing import List, Optional from typing_extensions import Literal import httpx @@ -28,6 +28,7 @@ ) from ....types.cloud.image_list import ImageList from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.tag_update_list_param import TagUpdateListParam __all__ = ["ImagesResource", "AsyncImagesResource"] @@ -64,7 +65,7 @@ def update( name: str | NotGiven = NOT_GIVEN, os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -279,7 +280,7 @@ def create_from_volume( os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, source: Literal["volume"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -434,7 +435,7 @@ def upload( os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -558,7 +559,7 @@ async def update( name: str | NotGiven = NOT_GIVEN, os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -773,7 +774,7 @@ async def create_from_volume( os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, source: Literal["volume"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -928,7 +929,7 @@ async def upload( os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 5f0f44c1..96487435 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -2,6 +2,12 @@ from __future__ import annotations +from typing import List, Union, Iterable, Optional +from datetime import datetime +from typing_extensions import Literal, overload + +import httpx + from .images import ( ImagesResource, AsyncImagesResource, @@ -10,17 +16,80 @@ ImagesResourceWithStreamingResponse, AsyncImagesResourceWithStreamingResponse, ) +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import required_args, maybe_transform, async_maybe_transform from ...._compat import cached_property +from .interfaces import ( + InterfacesResource, + AsyncInterfacesResource, + InterfacesResourceWithRawResponse, + AsyncInterfacesResourceWithRawResponse, + InterfacesResourceWithStreamingResponse, + AsyncInterfacesResourceWithStreamingResponse, +) from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.cloud import ( + instance_list_params, + instance_action_params, + instance_create_params, + instance_delete_params, + instance_resize_params, + instance_update_params, + instance_get_console_params, + instance_assign_security_group_params, + instance_add_to_placement_group_params, + instance_unassign_security_group_params, +) +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.console import Console +from ....types.cloud.instance import Instance +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.instance_interface import InstanceInterface +from ....types.cloud.tag_update_list_param import TagUpdateListParam __all__ = ["InstancesResource", "AsyncInstancesResource"] class InstancesResource(SyncAPIResource): + @cached_property + def flavors(self) -> FlavorsResource: + return FlavorsResource(self._client) + + @cached_property + def interfaces(self) -> InterfacesResource: + return InterfacesResource(self._client) + @cached_property def images(self) -> ImagesResource: return ImagesResource(self._client) + @cached_property + def metrics(self) -> MetricsResource: + return MetricsResource(self._client) + @cached_property def with_raw_response(self) -> InstancesResourceWithRawResponse: """ @@ -40,12 +109,1103 @@ def with_streaming_response(self) -> InstancesResourceWithStreamingResponse: """ return InstancesResourceWithStreamingResponse(self) + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str, + interfaces: Iterable[instance_create_params.Interface], + volumes: Iterable[instance_create_params.Volume], + allow_app_ports: bool | NotGiven = NOT_GIVEN, + configuration: Optional[object] | NotGiven = NOT_GIVEN, + keypair_name: Optional[str] | NotGiven = NOT_GIVEN, + name_templates: List[str] | NotGiven = NOT_GIVEN, + names: List[str] | NotGiven = NOT_GIVEN, + password: str | NotGiven = NOT_GIVEN, + security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, + servergroup_id: str | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + user_data: str | NotGiven = NOT_GIVEN, + username: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """Create one or many instances or basic VMs. + + For Linux instances, use the + 'username' and 'password' to create a new user. When only 'password' is + provided, it is set as the password for the default user of the image. The + 'user_data' is ignored when the 'password' is specified. Use the 'user_data' + field to provide a cloud-init script in base64 to apply configurations to the + instance. For Windows instances, the 'username' cannot be specified in the + request. Use the 'password' field to set the password for the 'Admin' user on + Windows. Use the 'user_data' field to provide a cloudbase-init script in base64 + to create new users on Windows. The password of the Admin user cannot be updated + via 'user_data'. + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}'].post.parameters[1].schema" + + flavor: '#/components/schemas/CreateInstanceSerializerV2/properties/flavor' + "$.components.schemas.CreateInstanceSerializerV2.properties.flavor" + + interfaces: '#/components/schemas/CreateInstanceSerializerV2/properties/interfaces' + "$.components.schemas.CreateInstanceSerializerV2.properties.interfaces" + + volumes: '#/components/schemas/CreateInstanceSerializerV2/properties/volumes' + "$.components.schemas.CreateInstanceSerializerV2.properties.volumes" + + allow_app_ports: '#/components/schemas/CreateInstanceSerializerV2/properties/allow_app_ports' + "$.components.schemas.CreateInstanceSerializerV2.properties.allow_app_ports" + + configuration: '#/components/schemas/CreateInstanceSerializerV2/properties/configuration/anyOf/0' + "$.components.schemas.CreateInstanceSerializerV2.properties.configuration.anyOf[0]" + + keypair_name: '#/components/schemas/CreateInstanceSerializerV2/properties/keypair_name/anyOf/0' + "$.components.schemas.CreateInstanceSerializerV2.properties.keypair_name.anyOf[0]" + + name_templates: '#/components/schemas/CreateInstanceSerializerV2/properties/name_templates' + "$.components.schemas.CreateInstanceSerializerV2.properties.name_templates" + + names: '#/components/schemas/CreateInstanceSerializerV2/properties/names' + "$.components.schemas.CreateInstanceSerializerV2.properties.names" + + password: '#/components/schemas/CreateInstanceSerializerV2/properties/password' + "$.components.schemas.CreateInstanceSerializerV2.properties.password" + + security_groups: '#/components/schemas/CreateInstanceSerializerV2/properties/security_groups' + "$.components.schemas.CreateInstanceSerializerV2.properties.security_groups" + + servergroup_id: '#/components/schemas/CreateInstanceSerializerV2/properties/servergroup_id' + "$.components.schemas.CreateInstanceSerializerV2.properties.servergroup_id" + + tags: '#/components/schemas/CreateInstanceSerializerV2/properties/tags' + "$.components.schemas.CreateInstanceSerializerV2.properties.tags" + + user_data: '#/components/schemas/CreateInstanceSerializerV2/properties/user_data' + "$.components.schemas.CreateInstanceSerializerV2.properties.user_data" + + username: '#/components/schemas/CreateInstanceSerializerV2/properties/username' + "$.components.schemas.CreateInstanceSerializerV2.properties.username" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v2/instances/{project_id}/{region_id}", + body=maybe_transform( + { + "flavor": flavor, + "interfaces": interfaces, + "volumes": volumes, + "allow_app_ports": allow_app_ports, + "configuration": configuration, + "keypair_name": keypair_name, + "name_templates": name_templates, + "names": names, + "password": password, + "security_groups": security_groups, + "servergroup_id": servergroup_id, + "tags": tags, + "user_data": user_data, + "username": username, + }, + instance_create_params.InstanceCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + 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, + ) -> Instance: + """ + Rename instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[2].schema" + + name: '#/components/schemas/NameSerializer/properties/name' + "$.components.schemas.NameSerializer.properties.name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._patch( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Instance, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + available_floating: bool | NotGiven = NOT_GIVEN, + changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN, + changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN, + exclude_flavor_prefix: str | NotGiven = NOT_GIVEN, + exclude_secgroup: str | NotGiven = NOT_GIVEN, + flavor_id: str | NotGiven = NOT_GIVEN, + flavor_prefix: str | NotGiven = NOT_GIVEN, + include_ai: bool | NotGiven = NOT_GIVEN, + include_baremetal: bool | NotGiven = NOT_GIVEN, + include_k8s: bool | NotGiven = NOT_GIVEN, + ip: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + only_isolated: bool | NotGiven = NOT_GIVEN, + only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN, + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, + profile_name: str | NotGiven = NOT_GIVEN, + protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN, + status: Literal[ + "ACTIVE", + "BUILD", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PAUSED", + "REBOOT", + "REBUILD", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "VERIFY_RESIZE", + ] + | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, + tag_value: List[str] | NotGiven = NOT_GIVEN, + type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, + uuid: str | NotGiven = NOT_GIVEN, + with_ddos: bool | NotGiven = NOT_GIVEN, + with_interfaces_name: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[Instance]: + """ + List instances + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[1].schema" + + available_floating: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[2]" + + changes_before: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[3]" + + changes_since: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[4]" + + exclude_flavor_prefix: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[5]" + + exclude_secgroup: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[6]" + + flavor_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[7]" + + flavor_prefix: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[8]" + + include_ai: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[9]" + + include_baremetal: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[10]" + + include_k8s: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[11]" + + ip: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[12]" + + limit: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[13]" + + name: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[14]" + + offset: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[15]" + + only_isolated: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[16]" + + only_with_fixed_external_ip: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[17]" + + order_by: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[18]" + + profile_name: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[19]" + + protection_status: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/20' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[20]" + + status: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/21' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[21]" + + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/22' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[22]" + + tag_value: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/23' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[23]" + + type_ddos_profile: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/24' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[24]" + + uuid: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/25' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[25]" + + with_ddos: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/26' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[26]" + + with_interfaces_name: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/27' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[27]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/instances/{project_id}/{region_id}", + page=SyncOffsetPage[Instance], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "available_floating": available_floating, + "changes_before": changes_before, + "changes_since": changes_since, + "exclude_flavor_prefix": exclude_flavor_prefix, + "exclude_secgroup": exclude_secgroup, + "flavor_id": flavor_id, + "flavor_prefix": flavor_prefix, + "include_ai": include_ai, + "include_baremetal": include_baremetal, + "include_k8s": include_k8s, + "ip": ip, + "limit": limit, + "name": name, + "offset": offset, + "only_isolated": only_isolated, + "only_with_fixed_external_ip": only_with_fixed_external_ip, + "order_by": order_by, + "profile_name": profile_name, + "protection_status": protection_status, + "status": status, + "tag_key_value": tag_key_value, + "tag_value": tag_value, + "type_ddos_profile": type_ddos_profile, + "uuid": uuid, + "with_ddos": with_ddos, + "with_interfaces_name": with_interfaces_name, + }, + instance_list_params.InstanceListParams, + ), + ), + model=Instance, + ) + + def delete( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + delete_floatings: bool | NotGiven = NOT_GIVEN, + floatings: str | NotGiven = NOT_GIVEN, + reserved_fixed_ips: str | NotGiven = NOT_GIVEN, + volumes: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[2].schema" + + delete_floatings: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/3' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[3]" + + floatings: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/4' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[4]" + + reserved_fixed_ips: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/5' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[5]" + + volumes: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/6' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[6]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._delete( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "delete_floatings": delete_floatings, + "floatings": floatings, + "reserved_fixed_ips": reserved_fixed_ips, + "volumes": volumes, + }, + instance_delete_params.InstanceDeleteParams, + ), + ), + cast_to=TaskIDList, + ) + + @overload + def action( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["start"], + activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + The action can be one of: start, stop, reboot, powercycle, suspend or resume. + Suspend and resume are not available for baremetal instances. + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/0/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/1/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/2/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[2].schema" + + action: '#/components/schemas/StartActionInstanceSerializer/properties/action' + "$.components.schemas.StartActionInstanceSerializer.properties.action" + + activate_profile: '#/components/schemas/StartActionInstanceSerializer/properties/activate_profile/anyOf/0' + "$.components.schemas.StartActionInstanceSerializer.properties.activate_profile.anyOf[0]" + + 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 action( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["reboot", "reboot_hard", "resume", "stop", "suspend"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + The action can be one of: start, stop, reboot, powercycle, suspend or resume. + Suspend and resume are not available for baremetal instances. + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/0/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/1/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/2/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[2].schema" + + action: '#/components/schemas/BasicActionInstanceSerializer/properties/action' + "$.components.schemas.BasicActionInstanceSerializer.properties.action" + + 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"]) + def action( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["start"] | Literal["reboot", "reboot_hard", "resume", "stop", "suspend"], + activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + body=maybe_transform( + { + "action": action, + "activate_profile": activate_profile, + }, + instance_action_params.InstanceActionParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def add_to_placement_group( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + servergroup_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Put instance into the server group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[2].schema" + + servergroup_id: '#/components/schemas/InstancePutServerGroupSchema/properties/servergroup_id' + "$.components.schemas.InstancePutServerGroupSchema.properties.servergroup_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + body=maybe_transform( + {"servergroup_id": servergroup_id}, + instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def assign_security_group( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str | NotGiven = NOT_GIVEN, + ports_security_group_names: Iterable[instance_assign_security_group_params.PortsSecurityGroupName] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Assign the security group to the server. + + To assign multiple security groups to + all ports, use the NULL value for the port_id field + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[2].schema" + + name: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/name' + "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.name" + + ports_security_group_names: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/ports_security_group_names' + "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.ports_security_group_names" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + body=maybe_transform( + { + "name": name, + "ports_security_group_names": ports_security_group_names, + }, + instance_assign_security_group_params.InstanceAssignSecurityGroupParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def disable_port_security( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceInterface: + """ + Disable port security for instance interface + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fdisable_port_security/post/parameters/0/schema' + "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fdisable_port_security/post/parameters/1/schema' + "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security'].post.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fdisable_port_security/post/parameters/2/schema' + "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return self._post( + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InstanceInterface, + ) + + def enable_port_security( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceInterface: + """ + Enable port security for instance interface + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fenable_port_security/post/parameters/0/schema' + "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fenable_port_security/post/parameters/1/schema' + "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security'].post.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fenable_port_security/post/parameters/2/schema' + "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return self._post( + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InstanceInterface, + ) + + def get( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Instance: + """ + **Cookie Parameters**: + + - `language` (str, optional): Language for the response content. Affects the + `ddos_profile` field. Supported values: + - `'en'` (default) + - `'de'` + - `'ru'` + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].get.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._get( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Instance, + ) + + def get_console( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + console_type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Console: + """ + Get instance console URL + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[2].schema" + + console_type: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/3' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._get( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"console_type": console_type}, instance_get_console_params.InstanceGetConsoleParams + ), + ), + cast_to=Console, + ) + + def remove_from_placement_group( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Remove instance from the server group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fremove_from_servergroup/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fremove_from_servergroup/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fremove_from_servergroup/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def resize( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Change flavor of the instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[2].schema" + + flavor_id: '#/components/schemas/FlavorIdSchema/properties/flavor_id' + "$.components.schemas.FlavorIdSchema.properties.flavor_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + body=maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def unassign_security_group( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str | NotGiven = NOT_GIVEN, + ports_security_group_names: Iterable[instance_unassign_security_group_params.PortsSecurityGroupName] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Un-assign the security group to the server. + + To un-assign multiple security + groups to all ports, use the NULL value for the port_id field + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[2].schema" + + name: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/name' + "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.name" + + ports_security_group_names: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/ports_security_group_names' + "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.ports_security_group_names" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + body=maybe_transform( + { + "name": name, + "ports_security_group_names": ports_security_group_names, + }, + instance_unassign_security_group_params.InstanceUnassignSecurityGroupParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + class AsyncInstancesResource(AsyncAPIResource): + @cached_property + def flavors(self) -> AsyncFlavorsResource: + return AsyncFlavorsResource(self._client) + + @cached_property + def interfaces(self) -> AsyncInterfacesResource: + return AsyncInterfacesResource(self._client) + @cached_property def images(self) -> AsyncImagesResource: return AsyncImagesResource(self._client) + @cached_property + def metrics(self) -> AsyncMetricsResource: + return AsyncMetricsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncInstancesResourceWithRawResponse: """ @@ -65,38 +1225,1337 @@ def with_streaming_response(self) -> AsyncInstancesResourceWithStreamingResponse """ return AsyncInstancesResourceWithStreamingResponse(self) + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str, + interfaces: Iterable[instance_create_params.Interface], + volumes: Iterable[instance_create_params.Volume], + allow_app_ports: bool | NotGiven = NOT_GIVEN, + configuration: Optional[object] | NotGiven = NOT_GIVEN, + keypair_name: Optional[str] | NotGiven = NOT_GIVEN, + name_templates: List[str] | NotGiven = NOT_GIVEN, + names: List[str] | NotGiven = NOT_GIVEN, + password: str | NotGiven = NOT_GIVEN, + security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, + servergroup_id: str | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + user_data: str | NotGiven = NOT_GIVEN, + username: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """Create one or many instances or basic VMs. + + For Linux instances, use the + 'username' and 'password' to create a new user. When only 'password' is + provided, it is set as the password for the default user of the image. The + 'user_data' is ignored when the 'password' is specified. Use the 'user_data' + field to provide a cloud-init script in base64 to apply configurations to the + instance. For Windows instances, the 'username' cannot be specified in the + request. Use the 'password' field to set the password for the 'Admin' user on + Windows. Use the 'user_data' field to provide a cloudbase-init script in base64 + to create new users on Windows. The password of the Admin user cannot be updated + via 'user_data'. + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}'].post.parameters[1].schema" + + flavor: '#/components/schemas/CreateInstanceSerializerV2/properties/flavor' + "$.components.schemas.CreateInstanceSerializerV2.properties.flavor" + + interfaces: '#/components/schemas/CreateInstanceSerializerV2/properties/interfaces' + "$.components.schemas.CreateInstanceSerializerV2.properties.interfaces" + + volumes: '#/components/schemas/CreateInstanceSerializerV2/properties/volumes' + "$.components.schemas.CreateInstanceSerializerV2.properties.volumes" + + allow_app_ports: '#/components/schemas/CreateInstanceSerializerV2/properties/allow_app_ports' + "$.components.schemas.CreateInstanceSerializerV2.properties.allow_app_ports" + + configuration: '#/components/schemas/CreateInstanceSerializerV2/properties/configuration/anyOf/0' + "$.components.schemas.CreateInstanceSerializerV2.properties.configuration.anyOf[0]" + + keypair_name: '#/components/schemas/CreateInstanceSerializerV2/properties/keypair_name/anyOf/0' + "$.components.schemas.CreateInstanceSerializerV2.properties.keypair_name.anyOf[0]" + + name_templates: '#/components/schemas/CreateInstanceSerializerV2/properties/name_templates' + "$.components.schemas.CreateInstanceSerializerV2.properties.name_templates" + + names: '#/components/schemas/CreateInstanceSerializerV2/properties/names' + "$.components.schemas.CreateInstanceSerializerV2.properties.names" + + password: '#/components/schemas/CreateInstanceSerializerV2/properties/password' + "$.components.schemas.CreateInstanceSerializerV2.properties.password" + + security_groups: '#/components/schemas/CreateInstanceSerializerV2/properties/security_groups' + "$.components.schemas.CreateInstanceSerializerV2.properties.security_groups" + + servergroup_id: '#/components/schemas/CreateInstanceSerializerV2/properties/servergroup_id' + "$.components.schemas.CreateInstanceSerializerV2.properties.servergroup_id" + + tags: '#/components/schemas/CreateInstanceSerializerV2/properties/tags' + "$.components.schemas.CreateInstanceSerializerV2.properties.tags" + + user_data: '#/components/schemas/CreateInstanceSerializerV2/properties/user_data' + "$.components.schemas.CreateInstanceSerializerV2.properties.user_data" + + username: '#/components/schemas/CreateInstanceSerializerV2/properties/username' + "$.components.schemas.CreateInstanceSerializerV2.properties.username" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v2/instances/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "flavor": flavor, + "interfaces": interfaces, + "volumes": volumes, + "allow_app_ports": allow_app_ports, + "configuration": configuration, + "keypair_name": keypair_name, + "name_templates": name_templates, + "names": names, + "password": password, + "security_groups": security_groups, + "servergroup_id": servergroup_id, + "tags": tags, + "user_data": user_data, + "username": username, + }, + instance_create_params.InstanceCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + 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, + ) -> Instance: + """ + Rename instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[2].schema" + + name: '#/components/schemas/NameSerializer/properties/name' + "$.components.schemas.NameSerializer.properties.name" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._patch( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Instance, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + available_floating: bool | NotGiven = NOT_GIVEN, + changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN, + changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN, + exclude_flavor_prefix: str | NotGiven = NOT_GIVEN, + exclude_secgroup: str | NotGiven = NOT_GIVEN, + flavor_id: str | NotGiven = NOT_GIVEN, + flavor_prefix: str | NotGiven = NOT_GIVEN, + include_ai: bool | NotGiven = NOT_GIVEN, + include_baremetal: bool | NotGiven = NOT_GIVEN, + include_k8s: bool | NotGiven = NOT_GIVEN, + ip: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + only_isolated: bool | NotGiven = NOT_GIVEN, + only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN, + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, + profile_name: str | NotGiven = NOT_GIVEN, + protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN, + status: Literal[ + "ACTIVE", + "BUILD", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PAUSED", + "REBOOT", + "REBUILD", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "VERIFY_RESIZE", + ] + | NotGiven = NOT_GIVEN, + tag_key_value: str | NotGiven = NOT_GIVEN, + tag_value: List[str] | NotGiven = NOT_GIVEN, + type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, + uuid: str | NotGiven = NOT_GIVEN, + with_ddos: bool | NotGiven = NOT_GIVEN, + with_interfaces_name: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Instance, AsyncOffsetPage[Instance]]: + """ + List instances + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[1].schema" + + available_floating: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[2]" + + changes_before: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[3]" + + changes_since: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[4]" + + exclude_flavor_prefix: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[5]" + + exclude_secgroup: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[6]" + + flavor_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[7]" + + flavor_prefix: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[8]" + + include_ai: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[9]" + + include_baremetal: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[10]" + + include_k8s: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[11]" + + ip: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[12]" + + limit: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[13]" + + name: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[14]" + + offset: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[15]" + + only_isolated: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[16]" + + only_with_fixed_external_ip: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[17]" + + order_by: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[18]" + + profile_name: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[19]" + + protection_status: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/20' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[20]" + + status: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/21' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[21]" + + tag_key_value: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/22' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[22]" + + tag_value: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/23' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[23]" + + type_ddos_profile: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/24' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[24]" + + uuid: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/25' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[25]" + + with_ddos: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/26' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[26]" + + with_interfaces_name: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/27' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[27]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/instances/{project_id}/{region_id}", + page=AsyncOffsetPage[Instance], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "available_floating": available_floating, + "changes_before": changes_before, + "changes_since": changes_since, + "exclude_flavor_prefix": exclude_flavor_prefix, + "exclude_secgroup": exclude_secgroup, + "flavor_id": flavor_id, + "flavor_prefix": flavor_prefix, + "include_ai": include_ai, + "include_baremetal": include_baremetal, + "include_k8s": include_k8s, + "ip": ip, + "limit": limit, + "name": name, + "offset": offset, + "only_isolated": only_isolated, + "only_with_fixed_external_ip": only_with_fixed_external_ip, + "order_by": order_by, + "profile_name": profile_name, + "protection_status": protection_status, + "status": status, + "tag_key_value": tag_key_value, + "tag_value": tag_value, + "type_ddos_profile": type_ddos_profile, + "uuid": uuid, + "with_ddos": with_ddos, + "with_interfaces_name": with_interfaces_name, + }, + instance_list_params.InstanceListParams, + ), + ), + model=Instance, + ) + + async def delete( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + delete_floatings: bool | NotGiven = NOT_GIVEN, + floatings: str | NotGiven = NOT_GIVEN, + reserved_fixed_ips: str | NotGiven = NOT_GIVEN, + volumes: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[2].schema" + + delete_floatings: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/3' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[3]" + + floatings: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/4' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[4]" + + reserved_fixed_ips: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/5' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[5]" + + volumes: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/6' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[6]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._delete( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "delete_floatings": delete_floatings, + "floatings": floatings, + "reserved_fixed_ips": reserved_fixed_ips, + "volumes": volumes, + }, + instance_delete_params.InstanceDeleteParams, + ), + ), + cast_to=TaskIDList, + ) + + @overload + async def action( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["start"], + activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + The action can be one of: start, stop, reboot, powercycle, suspend or resume. + Suspend and resume are not available for baremetal instances. + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/0/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/1/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/2/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[2].schema" + + action: '#/components/schemas/StartActionInstanceSerializer/properties/action' + "$.components.schemas.StartActionInstanceSerializer.properties.action" + + activate_profile: '#/components/schemas/StartActionInstanceSerializer/properties/activate_profile/anyOf/0' + "$.components.schemas.StartActionInstanceSerializer.properties.activate_profile.anyOf[0]" + + 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 action( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["reboot", "reboot_hard", "resume", "stop", "suspend"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + The action can be one of: start, stop, reboot, powercycle, suspend or resume. + Suspend and resume are not available for baremetal instances. + + Args: + project_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/0/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/1/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/2/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[2].schema" + + action: '#/components/schemas/BasicActionInstanceSerializer/properties/action' + "$.components.schemas.BasicActionInstanceSerializer.properties.action" + + 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"]) + async def action( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["start"] | Literal["reboot", "reboot_hard", "resume", "stop", "suspend"], + activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + body=await async_maybe_transform( + { + "action": action, + "activate_profile": activate_profile, + }, + instance_action_params.InstanceActionParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def add_to_placement_group( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + servergroup_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Put instance into the server group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[2].schema" + + servergroup_id: '#/components/schemas/InstancePutServerGroupSchema/properties/servergroup_id' + "$.components.schemas.InstancePutServerGroupSchema.properties.servergroup_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + body=await async_maybe_transform( + {"servergroup_id": servergroup_id}, + instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def assign_security_group( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str | NotGiven = NOT_GIVEN, + ports_security_group_names: Iterable[instance_assign_security_group_params.PortsSecurityGroupName] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Assign the security group to the server. + + To assign multiple security groups to + all ports, use the NULL value for the port_id field + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[2].schema" + + name: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/name' + "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.name" + + ports_security_group_names: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/ports_security_group_names' + "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.ports_security_group_names" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + body=await async_maybe_transform( + { + "name": name, + "ports_security_group_names": ports_security_group_names, + }, + instance_assign_security_group_params.InstanceAssignSecurityGroupParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def disable_port_security( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceInterface: + """ + Disable port security for instance interface + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fdisable_port_security/post/parameters/0/schema' + "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fdisable_port_security/post/parameters/1/schema' + "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security'].post.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fdisable_port_security/post/parameters/2/schema' + "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return await self._post( + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InstanceInterface, + ) + + async def enable_port_security( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceInterface: + """ + Enable port security for instance interface + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fenable_port_security/post/parameters/0/schema' + "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fenable_port_security/post/parameters/1/schema' + "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security'].post.parameters[1].schema" + + port_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fenable_port_security/post/parameters/2/schema' + "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return await self._post( + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InstanceInterface, + ) + + async def get( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Instance: + """ + **Cookie Parameters**: + + - `language` (str, optional): Language for the response content. Affects the + `ddos_profile` field. Supported values: + - `'en'` (default) + - `'de'` + - `'ru'` + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].get.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/get/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._get( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Instance, + ) + + async def get_console( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + console_type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Console: + """ + Get instance console URL + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[2].schema" + + console_type: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/3' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[3]" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._get( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"console_type": console_type}, instance_get_console_params.InstanceGetConsoleParams + ), + ), + cast_to=Console, + ) + + async def remove_from_placement_group( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Remove instance from the server group + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fremove_from_servergroup/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fremove_from_servergroup/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fremove_from_servergroup/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup'].post.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def resize( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Change flavor of the instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[2].schema" + + flavor_id: '#/components/schemas/FlavorIdSchema/properties/flavor_id' + "$.components.schemas.FlavorIdSchema.properties.flavor_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + body=await async_maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def unassign_security_group( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str | NotGiven = NOT_GIVEN, + ports_security_group_names: Iterable[instance_unassign_security_group_params.PortsSecurityGroupName] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Un-assign the security group to the server. + + To un-assign multiple security + groups to all ports, use the NULL value for the port_id field + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[2].schema" + + name: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/name' + "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.name" + + ports_security_group_names: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/ports_security_group_names' + "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.ports_security_group_names" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + body=await async_maybe_transform( + { + "name": name, + "ports_security_group_names": ports_security_group_names, + }, + instance_unassign_security_group_params.InstanceUnassignSecurityGroupParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + class InstancesResourceWithRawResponse: def __init__(self, instances: InstancesResource) -> None: self._instances = instances + self.create = to_raw_response_wrapper( + instances.create, + ) + self.update = to_raw_response_wrapper( + instances.update, + ) + self.list = to_raw_response_wrapper( + instances.list, + ) + self.delete = to_raw_response_wrapper( + instances.delete, + ) + self.action = to_raw_response_wrapper( + instances.action, + ) + self.add_to_placement_group = to_raw_response_wrapper( + instances.add_to_placement_group, + ) + self.assign_security_group = to_raw_response_wrapper( + instances.assign_security_group, + ) + self.disable_port_security = to_raw_response_wrapper( + instances.disable_port_security, + ) + self.enable_port_security = to_raw_response_wrapper( + instances.enable_port_security, + ) + self.get = to_raw_response_wrapper( + instances.get, + ) + self.get_console = to_raw_response_wrapper( + instances.get_console, + ) + self.remove_from_placement_group = to_raw_response_wrapper( + instances.remove_from_placement_group, + ) + self.resize = to_raw_response_wrapper( + instances.resize, + ) + self.unassign_security_group = to_raw_response_wrapper( + instances.unassign_security_group, + ) + + @cached_property + def flavors(self) -> FlavorsResourceWithRawResponse: + return FlavorsResourceWithRawResponse(self._instances.flavors) + + @cached_property + def interfaces(self) -> InterfacesResourceWithRawResponse: + return InterfacesResourceWithRawResponse(self._instances.interfaces) + @cached_property def images(self) -> ImagesResourceWithRawResponse: return ImagesResourceWithRawResponse(self._instances.images) + @cached_property + def metrics(self) -> MetricsResourceWithRawResponse: + return MetricsResourceWithRawResponse(self._instances.metrics) + class AsyncInstancesResourceWithRawResponse: def __init__(self, instances: AsyncInstancesResource) -> None: self._instances = instances + self.create = async_to_raw_response_wrapper( + instances.create, + ) + self.update = async_to_raw_response_wrapper( + instances.update, + ) + self.list = async_to_raw_response_wrapper( + instances.list, + ) + self.delete = async_to_raw_response_wrapper( + instances.delete, + ) + self.action = async_to_raw_response_wrapper( + instances.action, + ) + self.add_to_placement_group = async_to_raw_response_wrapper( + instances.add_to_placement_group, + ) + self.assign_security_group = async_to_raw_response_wrapper( + instances.assign_security_group, + ) + self.disable_port_security = async_to_raw_response_wrapper( + instances.disable_port_security, + ) + self.enable_port_security = async_to_raw_response_wrapper( + instances.enable_port_security, + ) + self.get = async_to_raw_response_wrapper( + instances.get, + ) + self.get_console = async_to_raw_response_wrapper( + instances.get_console, + ) + self.remove_from_placement_group = async_to_raw_response_wrapper( + instances.remove_from_placement_group, + ) + self.resize = async_to_raw_response_wrapper( + instances.resize, + ) + self.unassign_security_group = async_to_raw_response_wrapper( + instances.unassign_security_group, + ) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithRawResponse: + return AsyncFlavorsResourceWithRawResponse(self._instances.flavors) + + @cached_property + def interfaces(self) -> AsyncInterfacesResourceWithRawResponse: + return AsyncInterfacesResourceWithRawResponse(self._instances.interfaces) + @cached_property def images(self) -> AsyncImagesResourceWithRawResponse: return AsyncImagesResourceWithRawResponse(self._instances.images) + @cached_property + def metrics(self) -> AsyncMetricsResourceWithRawResponse: + return AsyncMetricsResourceWithRawResponse(self._instances.metrics) + class InstancesResourceWithStreamingResponse: def __init__(self, instances: InstancesResource) -> None: self._instances = instances + self.create = to_streamed_response_wrapper( + instances.create, + ) + self.update = to_streamed_response_wrapper( + instances.update, + ) + self.list = to_streamed_response_wrapper( + instances.list, + ) + self.delete = to_streamed_response_wrapper( + instances.delete, + ) + self.action = to_streamed_response_wrapper( + instances.action, + ) + self.add_to_placement_group = to_streamed_response_wrapper( + instances.add_to_placement_group, + ) + self.assign_security_group = to_streamed_response_wrapper( + instances.assign_security_group, + ) + self.disable_port_security = to_streamed_response_wrapper( + instances.disable_port_security, + ) + self.enable_port_security = to_streamed_response_wrapper( + instances.enable_port_security, + ) + self.get = to_streamed_response_wrapper( + instances.get, + ) + self.get_console = to_streamed_response_wrapper( + instances.get_console, + ) + self.remove_from_placement_group = to_streamed_response_wrapper( + instances.remove_from_placement_group, + ) + self.resize = to_streamed_response_wrapper( + instances.resize, + ) + self.unassign_security_group = to_streamed_response_wrapper( + instances.unassign_security_group, + ) + + @cached_property + def flavors(self) -> FlavorsResourceWithStreamingResponse: + return FlavorsResourceWithStreamingResponse(self._instances.flavors) + + @cached_property + def interfaces(self) -> InterfacesResourceWithStreamingResponse: + return InterfacesResourceWithStreamingResponse(self._instances.interfaces) + @cached_property def images(self) -> ImagesResourceWithStreamingResponse: return ImagesResourceWithStreamingResponse(self._instances.images) + @cached_property + def metrics(self) -> MetricsResourceWithStreamingResponse: + return MetricsResourceWithStreamingResponse(self._instances.metrics) + class AsyncInstancesResourceWithStreamingResponse: def __init__(self, instances: AsyncInstancesResource) -> None: self._instances = instances + self.create = async_to_streamed_response_wrapper( + instances.create, + ) + self.update = async_to_streamed_response_wrapper( + instances.update, + ) + self.list = async_to_streamed_response_wrapper( + instances.list, + ) + self.delete = async_to_streamed_response_wrapper( + instances.delete, + ) + self.action = async_to_streamed_response_wrapper( + instances.action, + ) + self.add_to_placement_group = async_to_streamed_response_wrapper( + instances.add_to_placement_group, + ) + self.assign_security_group = async_to_streamed_response_wrapper( + instances.assign_security_group, + ) + self.disable_port_security = async_to_streamed_response_wrapper( + instances.disable_port_security, + ) + self.enable_port_security = async_to_streamed_response_wrapper( + instances.enable_port_security, + ) + self.get = async_to_streamed_response_wrapper( + instances.get, + ) + self.get_console = async_to_streamed_response_wrapper( + instances.get_console, + ) + self.remove_from_placement_group = async_to_streamed_response_wrapper( + instances.remove_from_placement_group, + ) + self.resize = async_to_streamed_response_wrapper( + instances.resize, + ) + self.unassign_security_group = async_to_streamed_response_wrapper( + instances.unassign_security_group, + ) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse: + return AsyncFlavorsResourceWithStreamingResponse(self._instances.flavors) + + @cached_property + def interfaces(self) -> AsyncInterfacesResourceWithStreamingResponse: + return AsyncInterfacesResourceWithStreamingResponse(self._instances.interfaces) + @cached_property def images(self) -> AsyncImagesResourceWithStreamingResponse: return AsyncImagesResourceWithStreamingResponse(self._instances.images) + + @cached_property + def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: + return AsyncMetricsResourceWithStreamingResponse(self._instances.metrics) diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py new file mode 100644 index 00000000..f5dacbce --- /dev/null +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -0,0 +1,959 @@ +# 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, overload + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.instances import interface_attach_params, interface_detach_params +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.network_interface_list import NetworkInterfaceList + +__all__ = ["InterfacesResource", "AsyncInterfacesResource"] + + +class InterfacesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InterfacesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return InterfacesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InterfacesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return InterfacesResourceWithStreamingResponse(self) + + def list( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> NetworkInterfaceList: + """ + List network interfaces attached to the instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Finterfaces/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Finterfaces/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces'].get.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Finterfaces/get/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._get( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NetworkInterfaceList, + ) + + @overload + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + ddos_profile: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/interface_name' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.interface_name" + + ip_family: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ip_family' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ip_family" + + port_group: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/port_group' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/security_groups' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.security_groups" + + type: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/type' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + subnet_id: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/subnet_id' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.subnet_id" + + ddos_profile: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/interface_name' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.interface_name" + + port_group: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/port_group' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/security_groups' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.security_groups" + + type: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/type' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + network_id: str, + ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + network_id: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/network_id' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.network_id" + + ddos_profile: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/interface_name' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.interface_name" + + ip_family: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ip_family' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ip_family" + + port_group: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/port_group' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/security_groups' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.security_groups" + + type: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/type' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_id: str, + ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + port_id: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_id' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_id" + + ddos_profile: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/interface_name' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.interface_name" + + port_group: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_group' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/security_groups' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.security_groups" + + type: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/type' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + subnet_id: str | NotGiven = NOT_GIVEN, + network_id: str | NotGiven = NOT_GIVEN, + port_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + body=maybe_transform( + { + "ddos_profile": ddos_profile, + "interface_name": interface_name, + "ip_family": ip_family, + "port_group": port_group, + "security_groups": security_groups, + "type": type, + "subnet_id": subnet_id, + "network_id": network_id, + "port_id": port_id, + }, + interface_attach_params.InterfaceAttachParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def detach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ip_address: str, + port_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Detach interface from instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[2].schema" + + ip_address: '#/components/schemas/PortIdWithIpSchema/properties/ip_address' + "$.components.schemas.PortIdWithIpSchema.properties.ip_address" + + port_id: '#/components/schemas/PortIdWithIpSchema/properties/port_id' + "$.components.schemas.PortIdWithIpSchema.properties.port_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + body=maybe_transform( + { + "ip_address": ip_address, + "port_id": port_id, + }, + interface_detach_params.InterfaceDetachParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncInterfacesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInterfacesResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncInterfacesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInterfacesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncInterfacesResourceWithStreamingResponse(self) + + async def list( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> NetworkInterfaceList: + """ + List network interfaces attached to the instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Finterfaces/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces'].get.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Finterfaces/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces'].get.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Finterfaces/get/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces'].get.parameters[2].schema" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._get( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NetworkInterfaceList, + ) + + @overload + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + ddos_profile: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/interface_name' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.interface_name" + + ip_family: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ip_family' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ip_family" + + port_group: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/port_group' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/security_groups' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.security_groups" + + type: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/type' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + subnet_id: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/subnet_id' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.subnet_id" + + ddos_profile: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/interface_name' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.interface_name" + + port_group: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/port_group' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/security_groups' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.security_groups" + + type: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/type' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + network_id: str, + ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + network_id: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/network_id' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.network_id" + + ddos_profile: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/interface_name' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.interface_name" + + ip_family: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ip_family' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ip_family" + + port_group: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/port_group' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/security_groups' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.security_groups" + + type: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/type' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_id: str, + ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Attach interface to instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + + port_id: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_id' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_id" + + ddos_profile: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.ddos_profile.allOf[0]" + + interface_name: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/interface_name' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.interface_name" + + port_group: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_group' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_group" + + security_groups: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/security_groups' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.security_groups" + + type: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/type' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.type" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | NotGiven = NOT_GIVEN, + interface_name: str | NotGiven = NOT_GIVEN, + ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, + port_group: int | NotGiven = NOT_GIVEN, + security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | NotGiven = NOT_GIVEN, + type: str | NotGiven = NOT_GIVEN, + subnet_id: str | NotGiven = NOT_GIVEN, + network_id: str | NotGiven = NOT_GIVEN, + port_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + body=await async_maybe_transform( + { + "ddos_profile": ddos_profile, + "interface_name": interface_name, + "ip_family": ip_family, + "port_group": port_group, + "security_groups": security_groups, + "type": type, + "subnet_id": subnet_id, + "network_id": network_id, + "port_id": port_id, + }, + interface_attach_params.InterfaceAttachParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def detach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ip_address: str, + port_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Detach interface from instance + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[2].schema" + + ip_address: '#/components/schemas/PortIdWithIpSchema/properties/ip_address' + "$.components.schemas.PortIdWithIpSchema.properties.ip_address" + + port_id: '#/components/schemas/PortIdWithIpSchema/properties/port_id' + "$.components.schemas.PortIdWithIpSchema.properties.port_id" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + body=await async_maybe_transform( + { + "ip_address": ip_address, + "port_id": port_id, + }, + interface_detach_params.InterfaceDetachParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class InterfacesResourceWithRawResponse: + def __init__(self, interfaces: InterfacesResource) -> None: + self._interfaces = interfaces + + self.list = to_raw_response_wrapper( + interfaces.list, + ) + self.attach = to_raw_response_wrapper( + interfaces.attach, + ) + self.detach = to_raw_response_wrapper( + interfaces.detach, + ) + + +class AsyncInterfacesResourceWithRawResponse: + def __init__(self, interfaces: AsyncInterfacesResource) -> None: + self._interfaces = interfaces + + self.list = async_to_raw_response_wrapper( + interfaces.list, + ) + self.attach = async_to_raw_response_wrapper( + interfaces.attach, + ) + self.detach = async_to_raw_response_wrapper( + interfaces.detach, + ) + + +class InterfacesResourceWithStreamingResponse: + def __init__(self, interfaces: InterfacesResource) -> None: + self._interfaces = interfaces + + self.list = to_streamed_response_wrapper( + interfaces.list, + ) + self.attach = to_streamed_response_wrapper( + interfaces.attach, + ) + self.detach = to_streamed_response_wrapper( + interfaces.detach, + ) + + +class AsyncInterfacesResourceWithStreamingResponse: + def __init__(self, interfaces: AsyncInterfacesResource) -> None: + self._interfaces = interfaces + + self.list = async_to_streamed_response_wrapper( + interfaces.list, + ) + self.attach = async_to_streamed_response_wrapper( + interfaces.attach, + ) + self.detach = async_to_streamed_response_wrapper( + interfaces.detach, + ) diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py new file mode 100644 index 00000000..c0628106 --- /dev/null +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -0,0 +1,227 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....types.cloud import InstanceMetricsTimeUnit +from ...._base_client import make_request_options +from ....types.cloud.instances import metric_list_params +from ....types.cloud.instances.metrics_list import MetricsList +from ....types.cloud.instance_metrics_time_unit import InstanceMetricsTimeUnit + +__all__ = ["MetricsResource", "AsyncMetricsResource"] + + +class MetricsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> MetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return MetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return MetricsResourceWithStreamingResponse(self) + + def list( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + time_interval: int, + time_unit: InstanceMetricsTimeUnit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> MetricsList: + """ + Get instance metrics, including cpu, memory, network and disk metrics + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[2].schema" + + time_interval: '#/components/schemas/InstanceMetricsRequestSerializer/properties/time_interval' + "$.components.schemas.InstanceMetricsRequestSerializer.properties.time_interval" + + time_unit: '#/components/schemas/InstanceMetricsRequestSerializer/properties/time_unit' + "$.components.schemas.InstanceMetricsRequestSerializer.properties.time_unit" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + body=maybe_transform( + { + "time_interval": time_interval, + "time_unit": time_unit, + }, + metric_list_params.MetricListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=MetricsList, + ) + + +class AsyncMetricsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncMetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncMetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncMetricsResourceWithStreamingResponse(self) + + async def list( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + time_interval: int, + time_unit: InstanceMetricsTimeUnit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> MetricsList: + """ + Get instance metrics, including cpu, memory, network and disk metrics + + Args: + project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[0].schema" + + region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[1].schema" + + instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/2/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[2].schema" + + time_interval: '#/components/schemas/InstanceMetricsRequestSerializer/properties/time_interval' + "$.components.schemas.InstanceMetricsRequestSerializer.properties.time_interval" + + time_unit: '#/components/schemas/InstanceMetricsRequestSerializer/properties/time_unit' + "$.components.schemas.InstanceMetricsRequestSerializer.properties.time_unit" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + body=await async_maybe_transform( + { + "time_interval": time_interval, + "time_unit": time_unit, + }, + metric_list_params.MetricListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=MetricsList, + ) + + +class MetricsResourceWithRawResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_raw_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithRawResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_raw_response_wrapper( + metrics.list, + ) + + +class MetricsResourceWithStreamingResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_streamed_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithStreamingResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_streamed_response_wrapper( + metrics.list, + ) diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 113ed9cb..1603cc01 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Iterable +from typing import List, Iterable import httpx @@ -79,6 +79,7 @@ from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.load_balancer import LoadBalancer from ....types.cloud.interface_ip_family import InterfaceIPFamily +from ....types.cloud.tag_update_list_param import TagUpdateListParam from ....types.cloud.load_balancer_member_connectivity import LoadBalancerMemberConnectivity __all__ = ["LoadBalancersResource", "AsyncLoadBalancersResource"] @@ -140,7 +141,7 @@ def create( name: str | NotGiven = NOT_GIVEN, name_template: str | NotGiven = NOT_GIVEN, preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, vip_network_id: str | NotGiven = NOT_GIVEN, vip_port_id: str | NotGiven = NOT_GIVEN, @@ -682,7 +683,7 @@ async def create( name: str | NotGiven = NOT_GIVEN, name_template: str | NotGiven = NOT_GIVEN, preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, vip_network_id: str | NotGiven = NOT_GIVEN, vip_port_id: str | NotGiven = NOT_GIVEN, diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 84951310..474294ad 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List +from typing import List from typing_extensions import Literal import httpx @@ -38,6 +38,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.network import Network from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.tag_update_list_param import TagUpdateListParam __all__ = ["NetworksResource", "AsyncNetworksResource"] @@ -77,7 +78,7 @@ def create( region_id: int | None = None, name: str, create_router: bool | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -398,7 +399,7 @@ async def create( region_id: int | None = None, name: str, create_router: bool | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index b945aca6..79ffb3ce 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional +from typing import List, Iterable, Optional from typing_extensions import Literal import httpx @@ -24,6 +24,7 @@ from ....types.cloud.networks import subnet_list_params, subnet_create_params, subnet_update_params from ....types.cloud.ip_version import IPVersion from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.tag_update_list_param import TagUpdateListParam __all__ = ["SubnetsResource", "AsyncSubnetsResource"] @@ -63,7 +64,7 @@ def create( host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -456,7 +457,7 @@ async def create( host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 3dcbae5a..2c32c1b1 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Iterable +from typing import List, Iterable from typing_extensions import Literal, overload import httpx @@ -31,6 +31,7 @@ from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.volume import Volume from ...types.cloud.task_id_list import TaskIDList +from ...types.cloud.tag_update_list_param import TagUpdateListParam __all__ = ["VolumesResource", "AsyncVolumesResource"] @@ -68,7 +69,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -138,7 +139,7 @@ def create( instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -207,7 +208,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -276,7 +277,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, snapshot_id: str | NotGiven = NOT_GIVEN, @@ -881,7 +882,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -951,7 +952,7 @@ async def create( instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1020,7 +1021,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1089,7 +1090,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: TagUpdateListParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, snapshot_id: str | NotGiven = NOT_GIVEN, diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 8dc40a92..bb4c46e3 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -16,6 +16,7 @@ from .project import Project as Project from .ssh_key import SSHKey as SSHKey from .capacity import Capacity as Capacity +from .instance import Instance as Instance from .registry import Registry as Registry from .gpu_image import GPUImage as GPUImage from .ip_ranges import IPRanges as IPRanges @@ -34,6 +35,7 @@ from .registry_tag import RegistryTag as RegistryTag from .task_id_list import TaskIDList as TaskIDList from .deploy_status import DeployStatus as DeployStatus +from .instance_list import InstanceList as InstanceList from .load_balancer import LoadBalancer as LoadBalancer from .member_status import MemberStatus as MemberStatus from .registry_list import RegistryList as RegistryList @@ -61,6 +63,7 @@ from .floating_ip_status import FloatingIPStatus as FloatingIPStatus from .gpu_cluster_server import GPUClusterServer as GPUClusterServer from .ingress_opts_param import IngressOptsParam as IngressOptsParam +from .instance_interface import InstanceInterface as InstanceInterface from .region_list_params import RegionListParams as RegionListParams from .volume_list_params import VolumeListParams as VolumeListParams from .billing_reservation import BillingReservation as BillingReservation @@ -75,6 +78,7 @@ from .container_probe_exec import ContainerProbeExec as ContainerProbeExec from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed from .gpu_baremetal_flavor import GPUBaremetalFlavor as GPUBaremetalFlavor +from .instance_list_params import InstanceListParams as InstanceListParams from .lb_listener_protocol import LbListenerProtocol as LbListenerProtocol from .load_balancer_status import LoadBalancerStatus as LoadBalancerStatus from .loadbalancer_metrics import LoadbalancerMetrics as LoadbalancerMetrics @@ -95,8 +99,14 @@ from .project_create_params import ProjectCreateParams as ProjectCreateParams from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams +from .tag_update_list_param import TagUpdateListParam as TagUpdateListParam from .container_probe_config import ContainerProbeConfig as ContainerProbeConfig from .file_share_list_params import FileShareListParams as FileShareListParams +from .instance_action_params import InstanceActionParams as InstanceActionParams +from .instance_create_params import InstanceCreateParams as InstanceCreateParams +from .instance_delete_params import InstanceDeleteParams as InstanceDeleteParams +from .instance_resize_params import InstanceResizeParams as InstanceResizeParams +from .instance_update_params import InstanceUpdateParams as InstanceUpdateParams from .lb_session_persistence import LbSessionPersistence as LbSessionPersistence from .network_interface_list import NetworkInterfaceList as NetworkInterfaceList from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams @@ -131,6 +141,7 @@ from .container_scale_trigger_sqs import ContainerScaleTriggerSqs as ContainerScaleTriggerSqs from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField from .flavor_hardware_description import FlavorHardwareDescription as FlavorHardwareDescription +from .instance_get_console_params import InstanceGetConsoleParams as InstanceGetConsoleParams from .load_balancer_create_params import LoadBalancerCreateParams as LoadBalancerCreateParams from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams @@ -156,3 +167,12 @@ from .gpu_baremetal_cluster_resize_params import GPUBaremetalClusterResizeParams as GPUBaremetalClusterResizeParams from .gpu_baremetal_cluster_rebuild_params import GPUBaremetalClusterRebuildParams as GPUBaremetalClusterRebuildParams from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams +from .instance_assign_security_group_params import ( + InstanceAssignSecurityGroupParams as InstanceAssignSecurityGroupParams, +) +from .instance_add_to_placement_group_params import ( + InstanceAddToPlacementGroupParams as InstanceAddToPlacementGroupParams, +) +from .instance_unassign_security_group_params import ( + InstanceUnassignSecurityGroupParams as InstanceUnassignSecurityGroupParams, +) diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index a615b68f..9eef4724 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -2,10 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable, Optional +from typing import List, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..interface_ip_family import InterfaceIPFamily +from ..tag_update_list_param import TagUpdateListParam __all__ = [ "ServerCreateParams", @@ -101,7 +102,7 @@ class ServerCreateParams(TypedDict, total=False): "$.components.schemas.CreateBareMetalServerSerializer.properties.password" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/CreateBareMetalServerSerializer/properties/tags' "$.components.schemas.CreateBareMetalServerSerializer.properties.tags" diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index 23a1cd8d..9532bdfc 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict +from .tag_update_list_param import TagUpdateListParam + __all__ = [ "FileShareCreateParams", "CreateStandardFileShareSerializer", @@ -57,7 +59,7 @@ class CreateStandardFileShareSerializer(TypedDict, total=False): "$.components.schemas.CreateStandardFileShareSerializer.properties.access" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/CreateStandardFileShareSerializer/properties/tags' "$.components.schemas.CreateStandardFileShareSerializer.properties.tags" @@ -135,7 +137,7 @@ class CreateVastFileShareSerializer(TypedDict, total=False): "$.components.schemas.CreateVastFileShareSerializer.properties.volume_type" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/CreateVastFileShareSerializer/properties/tags' "$.components.schemas.CreateVastFileShareSerializer.properties.tags" diff --git a/src/gcore/types/cloud/floating_ip_create_params.py b/src/gcore/types/cloud/floating_ip_create_params.py index 7c7ada4d..3427425a 100644 --- a/src/gcore/types/cloud/floating_ip_create_params.py +++ b/src/gcore/types/cloud/floating_ip_create_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import TypedDict +from .tag_update_list_param import TagUpdateListParam + __all__ = ["FloatingIPCreateParams"] @@ -33,7 +35,7 @@ class FloatingIPCreateParams(TypedDict, total=False): "$.components.schemas.CreateFloatingIPSerializer.properties.port_id.anyOf[0]" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/CreateFloatingIPSerializer/properties/tags' "$.components.schemas.CreateFloatingIPSerializer.properties.tags" 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 dc2ed16a..6205ebd8 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -2,10 +2,11 @@ from __future__ import annotations -from typing import Dict, Union, Iterable, Optional +from typing import Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .interface_ip_family import InterfaceIPFamily +from .tag_update_list_param import TagUpdateListParam __all__ = [ "GPUBaremetalClusterCreateParams", @@ -85,7 +86,7 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): "$.components.schemas.CreateAIClusterGPUSerializer.properties.password" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/CreateAIClusterGPUSerializer/properties/tags' "$.components.schemas.CreateAIClusterGPUSerializer.properties.tags" diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py index 1f547965..b9a34561 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal, Required, TypedDict +from ..tag_update_list_param import TagUpdateListParam + __all__ = ["ImageUploadParams"] @@ -75,7 +77,7 @@ class ImageUploadParams(TypedDict, total=False): "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.ssh_key" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/tags' "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.tags" diff --git a/src/gcore/types/cloud/instance.py b/src/gcore/types/cloud/instance.py new file mode 100644 index 00000000..f88d0aff --- /dev/null +++ b/src/gcore/types/cloud/instance.py @@ -0,0 +1,630 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, TypeAlias + +from pydantic import Field as FieldInfo + +from .tag import Tag +from ..._models import BaseModel +from .ddos_profile import DDOSProfile + +__all__ = [ + "Instance", + "Address", + "AddressInstanceFloatingAddressSerializer", + "AddressInstanceFixedAddressShortSerializer", + "AddressInstanceFixedAddressSerializer", + "BlackholePort", + "FixedIPAssignment", + "Flavor", + "FlavorInstanceFlavorSerializer", + "FlavorInstanceFlavorSerializerHardwareDescription", + "FlavorBareMetalFlavorSerializer", + "FlavorBareMetalFlavorSerializerHardwareDescription", + "FlavorDeprecatedGPUClusterFlavorSerializer", + "FlavorDeprecatedGPUClusterFlavorSerializerHardwareDescription", + "InstanceIsolation", + "SecurityGroup", + "Volume", +] + + +class AddressInstanceFloatingAddressSerializer(BaseModel): + addr: str + """ + '#/components/schemas/InstanceFloatingAddressSerializer/properties/addr' + "$.components.schemas.InstanceFloatingAddressSerializer.properties.addr" + """ + + type: Literal["floating"] + """ + '#/components/schemas/InstanceFloatingAddressSerializer/properties/type' + "$.components.schemas.InstanceFloatingAddressSerializer.properties.type" + """ + + +class AddressInstanceFixedAddressShortSerializer(BaseModel): + addr: str + """ + '#/components/schemas/InstanceFixedAddressShortSerializer/properties/addr' + "$.components.schemas.InstanceFixedAddressShortSerializer.properties.addr" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/InstanceFixedAddressShortSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.InstanceFixedAddressShortSerializer.properties.interface_name.anyOf[0]" + """ + + type: Literal["fixed"] + """ + '#/components/schemas/InstanceFixedAddressShortSerializer/properties/type' + "$.components.schemas.InstanceFixedAddressShortSerializer.properties.type" + """ + + +class AddressInstanceFixedAddressSerializer(BaseModel): + addr: str + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/addr' + "$.components.schemas.InstanceFixedAddressSerializer.properties.addr" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.InstanceFixedAddressSerializer.properties.interface_name.anyOf[0]" + """ + + subnet_id: str + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_id' + "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_id" + """ + + subnet_name: str + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_name' + "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_name" + """ + + type: Literal["fixed"] + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/type' + "$.components.schemas.InstanceFixedAddressSerializer.properties.type" + """ + + +Address: TypeAlias = Union[ + AddressInstanceFloatingAddressSerializer, + AddressInstanceFixedAddressShortSerializer, + AddressInstanceFixedAddressSerializer, +] + + +class BlackholePort(BaseModel): + alarm_end: datetime = FieldInfo(alias="AlarmEnd") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlarmEnd' + "$.components.schemas.BlackholePortSerializer.properties.AlarmEnd" + """ + + alarm_start: datetime = FieldInfo(alias="AlarmStart") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlarmStart' + "$.components.schemas.BlackholePortSerializer.properties.AlarmStart" + """ + + alarm_state: Literal[ + "ACK_REQ", + "ALARM", + "ARCHIVED", + "CLEAR", + "CLEARING", + "CLEARING_FAIL", + "END_GRACE", + "END_WAIT", + "MANUAL_CLEAR", + "MANUAL_CLEARING", + "MANUAL_CLEARING_FAIL", + "MANUAL_MITIGATING", + "MANUAL_STARTING", + "MANUAL_STARTING_FAIL", + "MITIGATING", + "STARTING", + "STARTING_FAIL", + "START_WAIT", + "ack_req", + "alarm", + "archived", + "clear", + "clearing", + "clearing_fail", + "end_grace", + "end_wait", + "manual_clear", + "manual_clearing", + "manual_clearing_fail", + "manual_mitigating", + "manual_starting", + "manual_starting_fail", + "mitigating", + "start_wait", + "starting", + "starting_fail", + ] = FieldInfo(alias="AlarmState") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlarmState' + "$.components.schemas.BlackholePortSerializer.properties.AlarmState" + """ + + alert_duration: str = FieldInfo(alias="AlertDuration") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlertDuration' + "$.components.schemas.BlackholePortSerializer.properties.AlertDuration" + """ + + destination_ip: str = FieldInfo(alias="DestinationIP") + """ + '#/components/schemas/BlackholePortSerializer/properties/DestinationIP' + "$.components.schemas.BlackholePortSerializer.properties.DestinationIP" + """ + + id: int = FieldInfo(alias="ID") + """ + '#/components/schemas/BlackholePortSerializer/properties/ID' + "$.components.schemas.BlackholePortSerializer.properties.ID" + """ + + +class FixedIPAssignment(BaseModel): + external: bool + """ + '#/components/schemas/IpAssignmentsSerializer/properties/external' + "$.components.schemas.IpAssignmentsSerializer.properties.external" + """ + + ip_address: str + """ + '#/components/schemas/IpAssignmentsSerializer/properties/ip_address' + "$.components.schemas.IpAssignmentsSerializer.properties.ip_address" + """ + + subnet_id: str + """ + '#/components/schemas/IpAssignmentsSerializer/properties/subnet_id' + "$.components.schemas.IpAssignmentsSerializer.properties.subnet_id" + """ + + +class FlavorInstanceFlavorSerializerHardwareDescription(BaseModel): + ram: str + """ + '#/components/schemas/InstanceFlavorHardwareDescriptionSerializer/properties/ram' + "$.components.schemas.InstanceFlavorHardwareDescriptionSerializer.properties.ram" + """ + + vcpus: str + """ + '#/components/schemas/InstanceFlavorHardwareDescriptionSerializer/properties/vcpus' + "$.components.schemas.InstanceFlavorHardwareDescriptionSerializer.properties.vcpus" + """ + + +class FlavorInstanceFlavorSerializer(BaseModel): + architecture: str + """ + '#/components/schemas/InstanceFlavorSerializer/properties/architecture' + "$.components.schemas.InstanceFlavorSerializer.properties.architecture" + """ + + flavor_id: str + """ + '#/components/schemas/InstanceFlavorSerializer/properties/flavor_id' + "$.components.schemas.InstanceFlavorSerializer.properties.flavor_id" + """ + + flavor_name: str + """ + '#/components/schemas/InstanceFlavorSerializer/properties/flavor_name' + "$.components.schemas.InstanceFlavorSerializer.properties.flavor_name" + """ + + hardware_description: FlavorInstanceFlavorSerializerHardwareDescription + """ + '#/components/schemas/InstanceFlavorSerializer/properties/hardware_description' + "$.components.schemas.InstanceFlavorSerializer.properties.hardware_description" + """ + + os_type: str + """ + '#/components/schemas/InstanceFlavorSerializer/properties/os_type' + "$.components.schemas.InstanceFlavorSerializer.properties.os_type" + """ + + ram: int + """ + '#/components/schemas/InstanceFlavorSerializer/properties/ram' + "$.components.schemas.InstanceFlavorSerializer.properties.ram" + """ + + vcpus: int + """ + '#/components/schemas/InstanceFlavorSerializer/properties/vcpus' + "$.components.schemas.InstanceFlavorSerializer.properties.vcpus" + """ + + +class FlavorBareMetalFlavorSerializerHardwareDescription(BaseModel): + cpu: str + """ + '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/cpu' + "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.cpu" + """ + + disk: str + """ + '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/disk' + "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.disk" + """ + + license: str + """ + '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/license' + "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.license" + """ + + network: str + """ + '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/network' + "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.network" + """ + + ram: str + """ + '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/ram' + "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.ram" + """ + + +class FlavorBareMetalFlavorSerializer(BaseModel): + architecture: str + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/architecture' + "$.components.schemas.BareMetalFlavorSerializer.properties.architecture" + """ + + flavor_id: str + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/flavor_id' + "$.components.schemas.BareMetalFlavorSerializer.properties.flavor_id" + """ + + flavor_name: str + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/flavor_name' + "$.components.schemas.BareMetalFlavorSerializer.properties.flavor_name" + """ + + hardware_description: FlavorBareMetalFlavorSerializerHardwareDescription + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/hardware_description' + "$.components.schemas.BareMetalFlavorSerializer.properties.hardware_description" + """ + + os_type: str + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/os_type' + "$.components.schemas.BareMetalFlavorSerializer.properties.os_type" + """ + + ram: int + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/ram' + "$.components.schemas.BareMetalFlavorSerializer.properties.ram" + """ + + resource_class: str + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/resource_class' + "$.components.schemas.BareMetalFlavorSerializer.properties.resource_class" + """ + + vcpus: int + """ + '#/components/schemas/BareMetalFlavorSerializer/properties/vcpus' + "$.components.schemas.BareMetalFlavorSerializer.properties.vcpus" + """ + + +class FlavorDeprecatedGPUClusterFlavorSerializerHardwareDescription(BaseModel): + cpu: str + """ + '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/cpu' + "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.cpu" + """ + + disk: str + """ + '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/disk' + "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.disk" + """ + + gpu: str + """ + '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/gpu' + "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.gpu" + """ + + license: str + """ + '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/license' + "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.license" + """ + + network: str + """ + '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/network' + "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.network" + """ + + ram: str + """ + '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/ram' + "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.ram" + """ + + +class FlavorDeprecatedGPUClusterFlavorSerializer(BaseModel): + architecture: str + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/architecture' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.architecture" + """ + + flavor_id: str + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/flavor_id' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.flavor_id" + """ + + flavor_name: str + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/flavor_name' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.flavor_name" + """ + + hardware_description: FlavorDeprecatedGPUClusterFlavorSerializerHardwareDescription + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/hardware_description' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.hardware_description" + """ + + os_type: str + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/os_type' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.os_type" + """ + + ram: int + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/ram' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.ram" + """ + + resource_class: str + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/resource_class' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.resource_class" + """ + + vcpus: int + """ + '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/vcpus' + "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.vcpus" + """ + + +Flavor: TypeAlias = Union[ + FlavorInstanceFlavorSerializer, FlavorBareMetalFlavorSerializer, FlavorDeprecatedGPUClusterFlavorSerializer +] + + +class InstanceIsolation(BaseModel): + reason: Optional[str] = None + """ + '#/components/schemas/IsolationSerializer/properties/reason/anyOf/0' + "$.components.schemas.IsolationSerializer.properties.reason.anyOf[0]" + """ + + +class SecurityGroup(BaseModel): + name: str + """ + '#/components/schemas/NameSerializerPydantic/properties/name' + "$.components.schemas.NameSerializerPydantic.properties.name" + """ + + +class Volume(BaseModel): + id: str + """ + '#/components/schemas/InstanceVolumeSerializer/properties/id' + "$.components.schemas.InstanceVolumeSerializer.properties.id" + """ + + delete_on_termination: bool + """ + '#/components/schemas/InstanceVolumeSerializer/properties/delete_on_termination' + "$.components.schemas.InstanceVolumeSerializer.properties.delete_on_termination" + """ + + +class Instance(BaseModel): + addresses: Dict[str, List[Address]] + """ + '#/components/schemas/InstanceSerializer/properties/addresses' + "$.components.schemas.InstanceSerializer.properties.addresses" + """ + + blackhole_ports: List[BlackholePort] + """ + '#/components/schemas/InstanceSerializer/properties/blackhole_ports' + "$.components.schemas.InstanceSerializer.properties.blackhole_ports" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/InstanceSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.InstanceSerializer.properties.creator_task_id.anyOf[0]" + """ + + ddos_profile: Optional[DDOSProfile] = None + """ + '#/components/schemas/InstanceSerializer/properties/ddos_profile/anyOf/0' + "$.components.schemas.InstanceSerializer.properties.ddos_profile.anyOf[0]" + """ + + fixed_ip_assignments: Optional[List[FixedIPAssignment]] = None + """ + '#/components/schemas/InstanceSerializer/properties/fixed_ip_assignments/anyOf/0' + "$.components.schemas.InstanceSerializer.properties.fixed_ip_assignments.anyOf[0]" + """ + + flavor: Flavor + """ + '#/components/schemas/InstanceSerializer/properties/flavor' + "$.components.schemas.InstanceSerializer.properties.flavor" + """ + + instance_created: datetime + """ + '#/components/schemas/InstanceSerializer/properties/instance_created' + "$.components.schemas.InstanceSerializer.properties.instance_created" + """ + + instance_description: Optional[str] = None + """ + '#/components/schemas/InstanceSerializer/properties/instance_description/anyOf/0' + "$.components.schemas.InstanceSerializer.properties.instance_description.anyOf[0]" + """ + + instance_id: str + """ + '#/components/schemas/InstanceSerializer/properties/instance_id' + "$.components.schemas.InstanceSerializer.properties.instance_id" + """ + + instance_isolation: Optional[InstanceIsolation] = None + """ + '#/components/schemas/InstanceSerializer/properties/instance_isolation/anyOf/0' + "$.components.schemas.InstanceSerializer.properties.instance_isolation.anyOf[0]" + """ + + instance_name: str + """ + '#/components/schemas/InstanceSerializer/properties/instance_name' + "$.components.schemas.InstanceSerializer.properties.instance_name" + """ + + keypair_name: Optional[str] = None + """ + '#/components/schemas/InstanceSerializer/properties/keypair_name/anyOf/0' + "$.components.schemas.InstanceSerializer.properties.keypair_name.anyOf[0]" + """ + + project_id: int + """ + '#/components/schemas/InstanceSerializer/properties/project_id' + "$.components.schemas.InstanceSerializer.properties.project_id" + """ + + region: str + """ + '#/components/schemas/InstanceSerializer/properties/region' + "$.components.schemas.InstanceSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/InstanceSerializer/properties/region_id' + "$.components.schemas.InstanceSerializer.properties.region_id" + """ + + security_groups: List[SecurityGroup] + """ + '#/components/schemas/InstanceSerializer/properties/security_groups' + "$.components.schemas.InstanceSerializer.properties.security_groups" + """ + + status: Literal[ + "ACTIVE", + "BUILD", + "DELETED", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PASSWORD", + "PAUSED", + "REBOOT", + "REBUILD", + "RESCUE", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "UNKNOWN", + "VERIFY_RESIZE", + ] + """ + '#/components/schemas/InstanceSerializer/properties/status' + "$.components.schemas.InstanceSerializer.properties.status" + """ + + tags: List[Tag] + """ + '#/components/schemas/InstanceSerializer/properties/tags' + "$.components.schemas.InstanceSerializer.properties.tags" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/InstanceSerializer/properties/task_id/anyOf/0' + "$.components.schemas.InstanceSerializer.properties.task_id.anyOf[0]" + """ + + task_state: Optional[str] = None + """ + '#/components/schemas/InstanceSerializer/properties/task_state/anyOf/0' + "$.components.schemas.InstanceSerializer.properties.task_state.anyOf[0]" + """ + + vm_state: Literal[ + "active", + "building", + "deleted", + "error", + "paused", + "rescued", + "resized", + "shelved", + "shelved_offloaded", + "soft-deleted", + "stopped", + "suspended", + ] + """ + '#/components/schemas/InstanceSerializer/properties/vm_state' + "$.components.schemas.InstanceSerializer.properties.vm_state" + """ + + volumes: List[Volume] + """ + '#/components/schemas/InstanceSerializer/properties/volumes' + "$.components.schemas.InstanceSerializer.properties.volumes" + """ diff --git a/src/gcore/types/cloud/instance_action_params.py b/src/gcore/types/cloud/instance_action_params.py new file mode 100644 index 00000000..d32ad038 --- /dev/null +++ b/src/gcore/types/cloud/instance_action_params.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = ["InstanceActionParams", "StartActionInstanceSerializer", "BasicActionInstanceSerializer"] + + +class StartActionInstanceSerializer(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/0/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/1/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[1].schema" + """ + + action: Required[Literal["start"]] + """ + '#/components/schemas/StartActionInstanceSerializer/properties/action' + "$.components.schemas.StartActionInstanceSerializer.properties.action" + """ + + activate_profile: Optional[bool] + """ + '#/components/schemas/StartActionInstanceSerializer/properties/activate_profile/anyOf/0' + "$.components.schemas.StartActionInstanceSerializer.properties.activate_profile.anyOf[0]" + """ + + +class BasicActionInstanceSerializer(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/0/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/1/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[1].schema" + """ + + action: Required[Literal["reboot", "reboot_hard", "resume", "stop", "suspend"]] + """ + '#/components/schemas/BasicActionInstanceSerializer/properties/action' + "$.components.schemas.BasicActionInstanceSerializer.properties.action" + """ + + +InstanceActionParams: TypeAlias = Union[StartActionInstanceSerializer, BasicActionInstanceSerializer] diff --git a/src/gcore/types/cloud/instance_add_to_placement_group_params.py b/src/gcore/types/cloud/instance_add_to_placement_group_params.py new file mode 100644 index 00000000..51e6405c --- /dev/null +++ b/src/gcore/types/cloud/instance_add_to_placement_group_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["InstanceAddToPlacementGroupParams"] + + +class InstanceAddToPlacementGroupParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[1].schema" + """ + + servergroup_id: Required[str] + """ + '#/components/schemas/InstancePutServerGroupSchema/properties/servergroup_id' + "$.components.schemas.InstancePutServerGroupSchema.properties.servergroup_id" + """ diff --git a/src/gcore/types/cloud/instance_assign_security_group_params.py b/src/gcore/types/cloud/instance_assign_security_group_params.py new file mode 100644 index 00000000..1a58c296 --- /dev/null +++ b/src/gcore/types/cloud/instance_assign_security_group_params.py @@ -0,0 +1,48 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["InstanceAssignSecurityGroupParams", "PortsSecurityGroupName"] + + +class InstanceAssignSecurityGroupParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[1].schema" + """ + + name: str + """ + '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/name' + "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.name" + """ + + ports_security_group_names: Iterable[PortsSecurityGroupName] + """ + '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/ports_security_group_names' + "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.ports_security_group_names" + """ + + +class PortsSecurityGroupName(TypedDict, total=False): + port_id: Required[Optional[str]] + """ + '#/components/schemas/PortSecurityGroupNamesSchema/properties/port_id' + "$.components.schemas.PortSecurityGroupNamesSchema.properties.port_id" + """ + + security_group_names: Required[List[str]] + """ + '#/components/schemas/PortSecurityGroupNamesSchema/properties/security_group_names' + "$.components.schemas.PortSecurityGroupNamesSchema.properties.security_group_names" + """ diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py new file mode 100644 index 00000000..d4058ff3 --- /dev/null +++ b/src/gcore/types/cloud/instance_create_params.py @@ -0,0 +1,513 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .interface_ip_family import InterfaceIPFamily +from .tag_update_list_param import TagUpdateListParam + +__all__ = [ + "InstanceCreateParams", + "Interface", + "InterfaceNewInterfaceExternalSerializerPydantic", + "InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup", + "InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic", + "InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIP", + "InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer", + "InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer", + "InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup", + "InterfaceNewInterfaceAnySubnetFipSerializerPydantic", + "InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIP", + "InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer", + "InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer", + "InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup", + "InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic", + "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIP", + "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer", + "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer", + "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup", + "Volume", + "SecurityGroup", +] + + +class InstanceCreateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' + "$.paths['/cloud/v2/instances/{project_id}/{region_id}'].post.parameters[1].schema" + """ + + flavor: Required[str] + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/flavor' + "$.components.schemas.CreateInstanceSerializerV2.properties.flavor" + """ + + interfaces: Required[Iterable[Interface]] + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/interfaces' + "$.components.schemas.CreateInstanceSerializerV2.properties.interfaces" + """ + + volumes: Required[Iterable[Volume]] + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/volumes' + "$.components.schemas.CreateInstanceSerializerV2.properties.volumes" + """ + + allow_app_ports: bool + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/allow_app_ports' + "$.components.schemas.CreateInstanceSerializerV2.properties.allow_app_ports" + """ + + configuration: Optional[object] + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/configuration/anyOf/0' + "$.components.schemas.CreateInstanceSerializerV2.properties.configuration.anyOf[0]" + """ + + keypair_name: Optional[str] + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/keypair_name/anyOf/0' + "$.components.schemas.CreateInstanceSerializerV2.properties.keypair_name.anyOf[0]" + """ + + name_templates: List[str] + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/name_templates' + "$.components.schemas.CreateInstanceSerializerV2.properties.name_templates" + """ + + names: List[str] + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/names' + "$.components.schemas.CreateInstanceSerializerV2.properties.names" + """ + + password: str + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/password' + "$.components.schemas.CreateInstanceSerializerV2.properties.password" + """ + + security_groups: Iterable[SecurityGroup] + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/security_groups' + "$.components.schemas.CreateInstanceSerializerV2.properties.security_groups" + """ + + servergroup_id: str + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/servergroup_id' + "$.components.schemas.CreateInstanceSerializerV2.properties.servergroup_id" + """ + + tags: TagUpdateListParam + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/tags' + "$.components.schemas.CreateInstanceSerializerV2.properties.tags" + """ + + user_data: str + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/user_data' + "$.components.schemas.CreateInstanceSerializerV2.properties.user_data" + """ + + username: str + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/username' + "$.components.schemas.CreateInstanceSerializerV2.properties.username" + """ + + +class InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' + "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" + """ + + +class InterfaceNewInterfaceExternalSerializerPydantic(TypedDict, total=False): + type: Required[Literal["external"]] + """ + '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/type' + "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.type" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/interface_name' + "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.interface_name" + """ + + ip_family: Optional[InterfaceIPFamily] + """ + '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/ip_family/anyOf/0' + "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.ip_family.anyOf[0]" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/port_group' + "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.port_group" + """ + + security_groups: Iterable[InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup] + """ + '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/security_groups' + "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.security_groups" + """ + + +class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + source: Required[Literal["new"]] + """ + '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + existing_floating_id: Required[str] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + """ + + source: Required[Literal["existing"]] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIP: TypeAlias = Union[ + InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer, + InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer, +] + + +class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' + "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" + """ + + +class InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic(TypedDict, total=False): + network_id: Required[str] + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/network_id' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.network_id" + """ + + subnet_id: Required[str] + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/subnet_id' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.subnet_id" + """ + + type: Required[Literal["subnet"]] + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/type' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.type" + """ + + floating_ip: InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIP + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/floating_ip' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.floating_ip" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/interface_name' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.interface_name" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/port_group' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.port_group" + """ + + security_groups: Iterable[InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup] + """ + '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/security_groups' + "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.security_groups" + """ + + +class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + source: Required[Literal["new"]] + """ + '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + existing_floating_id: Required[str] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + """ + + source: Required[Literal["existing"]] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIP: TypeAlias = Union[ + InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer, + InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer, +] + + +class InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' + "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" + """ + + +class InterfaceNewInterfaceAnySubnetFipSerializerPydantic(TypedDict, total=False): + network_id: Required[str] + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/network_id' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.network_id" + """ + + type: Required[Literal["any_subnet"]] + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/type' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.type" + """ + + floating_ip: InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIP + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/floating_ip' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.floating_ip" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/interface_name' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.interface_name" + """ + + ip_address: str + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/ip_address' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.ip_address" + """ + + ip_family: Optional[InterfaceIPFamily] + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/ip_family/anyOf/0' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.ip_family.anyOf[0]" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/port_group' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.port_group" + """ + + security_groups: Iterable[InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup] + """ + '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/security_groups' + "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.security_groups" + """ + + +class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + source: Required[Literal["new"]] + """ + '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer( + TypedDict, total=False +): + existing_floating_id: Required[str] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + """ + + source: Required[Literal["existing"]] + """ + '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' + "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """ + + +InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIP: TypeAlias = Union[ + InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer, + InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer, +] + + +class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' + "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" + """ + + +class InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic(TypedDict, total=False): + port_id: Required[str] + """ + '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/port_id' + "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.port_id" + """ + + type: Required[Literal["reserved_fixed_ip"]] + """ + '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/type' + "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.type" + """ + + floating_ip: InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIP + """ + '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/floating_ip' + "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.floating_ip" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/interface_name' + "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.interface_name" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/port_group' + "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.port_group" + """ + + security_groups: Iterable[InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup] + """ + '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/security_groups' + "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.security_groups" + """ + + +Interface: TypeAlias = Union[ + InterfaceNewInterfaceExternalSerializerPydantic, + InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic, + InterfaceNewInterfaceAnySubnetFipSerializerPydantic, + InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic, +] + + +class Volume(TypedDict, total=False): + source: Required[Literal["apptemplate", "existing-volume", "image", "new-volume", "snapshot"]] + """ + '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/source' + "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.source" + """ + + apptemplate_id: str + """ + '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/apptemplate_id' + "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.apptemplate_id" + """ + + attachment_tag: str + """ + '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/attachment_tag' + "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.attachment_tag" + """ + + boot_index: int + """ + '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/boot_index' + "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.boot_index" + """ + + delete_on_termination: bool + """ + '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/delete_on_termination' + "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.delete_on_termination" + """ + + image_id: str + """ + '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/image_id' + "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.image_id" + """ + + name: str + """ + '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/name' + "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.name" + """ + + size: int + """ + '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/size' + "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.size" + """ + + snapshot_id: str + """ + '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/snapshot_id' + "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.snapshot_id" + """ + + tags: TagUpdateListParam + """ + '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/tags' + "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.tags" + """ + + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + """ + '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/type_name' + "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.type_name" + """ + + volume_id: str + """ + '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/volume_id' + "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.volume_id" + """ + + +class SecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' + "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" + """ diff --git a/src/gcore/types/cloud/instance_delete_params.py b/src/gcore/types/cloud/instance_delete_params.py new file mode 100644 index 00000000..c02e1669 --- /dev/null +++ b/src/gcore/types/cloud/instance_delete_params.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["InstanceDeleteParams"] + + +class InstanceDeleteParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[1].schema" + """ + + delete_floatings: bool + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/3' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[3]" + """ + + floatings: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/4' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[4]" + """ + + reserved_fixed_ips: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/5' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[5]" + """ + + volumes: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/6' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[6]" + """ diff --git a/src/gcore/types/cloud/instance_get_console_params.py b/src/gcore/types/cloud/instance_get_console_params.py new file mode 100644 index 00000000..57304cc9 --- /dev/null +++ b/src/gcore/types/cloud/instance_get_console_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["InstanceGetConsoleParams"] + + +class InstanceGetConsoleParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[1].schema" + """ + + console_type: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/3' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[3]" + """ diff --git a/src/gcore/types/cloud/instance_interface.py b/src/gcore/types/cloud/instance_interface.py new file mode 100644 index 00000000..3ffc7f9a --- /dev/null +++ b/src/gcore/types/cloud/instance_interface.py @@ -0,0 +1,205 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .tag import Tag +from .subnet import Subnet +from ..._models import BaseModel +from .floating_ip import FloatingIP + +__all__ = ["InstanceInterface", "AllowedAddressPair", "IPAssignment", "NetworkDetails"] + + +class AllowedAddressPair(BaseModel): + ip_address: str + """ + '#/components/schemas/AllowedAddressPairsSerializer/properties/ip_address/anyOf/0' + "$.components.schemas.AllowedAddressPairsSerializer.properties.ip_address.anyOf[0]" + """ + + mac_address: Optional[str] = None + """ + '#/components/schemas/AllowedAddressPairsSerializer/properties/mac_address/anyOf/0' + "$.components.schemas.AllowedAddressPairsSerializer.properties.mac_address.anyOf[0]" + """ + + +class IPAssignment(BaseModel): + ip_address: str + """ + '#/components/schemas/PortIpSubnetIdSerializer/properties/ip_address' + "$.components.schemas.PortIpSubnetIdSerializer.properties.ip_address" + """ + + subnet_id: str + """ + '#/components/schemas/PortIpSubnetIdSerializer/properties/subnet_id' + "$.components.schemas.PortIpSubnetIdSerializer.properties.subnet_id" + """ + + +class NetworkDetails(BaseModel): + id: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/id' + "$.components.schemas.NetworkSubnetworkSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/created_at' + "$.components.schemas.NetworkSubnetworkSerializer.properties.created_at" + """ + + external: bool + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/external' + "$.components.schemas.NetworkSubnetworkSerializer.properties.external" + """ + + name: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/name' + "$.components.schemas.NetworkSubnetworkSerializer.properties.name" + """ + + port_security_enabled: bool + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/port_security_enabled' + "$.components.schemas.NetworkSubnetworkSerializer.properties.port_security_enabled" + """ + + region: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/region' + "$.components.schemas.NetworkSubnetworkSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/region_id' + "$.components.schemas.NetworkSubnetworkSerializer.properties.region_id" + """ + + shared: bool + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/shared' + "$.components.schemas.NetworkSubnetworkSerializer.properties.shared" + """ + + tags: List[Tag] + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/tags' + "$.components.schemas.NetworkSubnetworkSerializer.properties.tags" + """ + + type: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/type' + "$.components.schemas.NetworkSubnetworkSerializer.properties.type" + """ + + updated_at: datetime + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/updated_at' + "$.components.schemas.NetworkSubnetworkSerializer.properties.updated_at" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.creator_task_id.anyOf[0]" + """ + + default: Optional[bool] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/default/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties['default'].anyOf[0]" + """ + + mtu: Optional[int] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/mtu' + "$.components.schemas.NetworkSubnetworkSerializer.properties.mtu" + """ + + project_id: Optional[int] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/project_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.project_id.anyOf[0]" + """ + + segmentation_id: Optional[int] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/segmentation_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.segmentation_id.anyOf[0]" + """ + + subnets: Optional[List[Subnet]] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/subnets/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.subnets.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/task_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.task_id.anyOf[0]" + """ + + +class InstanceInterface(BaseModel): + allowed_address_pairs: List[AllowedAddressPair] + """ + '#/components/schemas/InstanceInterfaceSerializer/properties/allowed_address_pairs' + "$.components.schemas.InstanceInterfaceSerializer.properties.allowed_address_pairs" + """ + + floatingip_details: List[FloatingIP] + """ + '#/components/schemas/InstanceInterfaceSerializer/properties/floatingip_details' + "$.components.schemas.InstanceInterfaceSerializer.properties.floatingip_details" + """ + + ip_assignments: List[IPAssignment] + """ + '#/components/schemas/InstanceInterfaceSerializer/properties/ip_assignments' + "$.components.schemas.InstanceInterfaceSerializer.properties.ip_assignments" + """ + + network_details: NetworkDetails + """ + '#/components/schemas/InstanceInterfaceSerializer/properties/network_details' + "$.components.schemas.InstanceInterfaceSerializer.properties.network_details" + """ + + network_id: str + """ + '#/components/schemas/InstanceInterfaceSerializer/properties/network_id' + "$.components.schemas.InstanceInterfaceSerializer.properties.network_id" + """ + + port_id: str + """ + '#/components/schemas/InstanceInterfaceSerializer/properties/port_id' + "$.components.schemas.InstanceInterfaceSerializer.properties.port_id" + """ + + port_security_enabled: bool + """ + '#/components/schemas/InstanceInterfaceSerializer/properties/port_security_enabled' + "$.components.schemas.InstanceInterfaceSerializer.properties.port_security_enabled" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/InstanceInterfaceSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.InstanceInterfaceSerializer.properties.interface_name.anyOf[0]" + """ + + mac_address: Optional[str] = None + """ + '#/components/schemas/InstanceInterfaceSerializer/properties/mac_address/anyOf/0' + "$.components.schemas.InstanceInterfaceSerializer.properties.mac_address.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/instance_list.py b/src/gcore/types/cloud/instance_list.py new file mode 100644 index 00000000..7a8e4c4a --- /dev/null +++ b/src/gcore/types/cloud/instance_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .instance import Instance +from ..._models import BaseModel + +__all__ = ["InstanceList"] + + +class InstanceList(BaseModel): + count: int + """ + '#/components/schemas/InstanceCollectionSerializer/properties/count' + "$.components.schemas.InstanceCollectionSerializer.properties.count" + """ + + results: List[Instance] + """ + '#/components/schemas/InstanceCollectionSerializer/properties/results' + "$.components.schemas.InstanceCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/instance_list_params.py b/src/gcore/types/cloud/instance_list_params.py new file mode 100644 index 00000000..f6d4a67d --- /dev/null +++ b/src/gcore/types/cloud/instance_list_params.py @@ -0,0 +1,198 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["InstanceListParams"] + + +class InstanceListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + available_floating: bool + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[2]" + """ + + changes_before: Annotated[Union[str, datetime], PropertyInfo(alias="changes-before", format="iso8601")] + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[3]" + """ + + changes_since: Annotated[Union[str, datetime], PropertyInfo(alias="changes-since", format="iso8601")] + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[4]" + """ + + exclude_flavor_prefix: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[5]" + """ + + exclude_secgroup: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[6]" + """ + + flavor_id: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[7]" + """ + + flavor_prefix: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[8]" + """ + + include_ai: bool + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[9]" + """ + + include_baremetal: bool + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[10]" + """ + + include_k8s: bool + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[11]" + """ + + ip: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[12]" + """ + + limit: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[13]" + """ + + name: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[14]" + """ + + offset: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[15]" + """ + + only_isolated: bool + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[16]" + """ + + only_with_fixed_external_ip: bool + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[17]" + """ + + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[18]" + """ + + profile_name: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[19]" + """ + + protection_status: Literal["Active", "Queued", "Error"] + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/20' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[20]" + """ + + status: Literal[ + "ACTIVE", + "BUILD", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PAUSED", + "REBOOT", + "REBUILD", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "VERIFY_RESIZE", + ] + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/21' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[21]" + """ + + tag_key_value: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/22' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[22]" + """ + + tag_value: List[str] + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/23' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[23]" + """ + + type_ddos_profile: Literal["basic", "advanced"] + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/24' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[24]" + """ + + uuid: str + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/25' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[25]" + """ + + with_ddos: bool + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/26' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[26]" + """ + + with_interfaces_name: bool + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/27' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[27]" + """ diff --git a/src/gcore/types/cloud/instance_resize_params.py b/src/gcore/types/cloud/instance_resize_params.py new file mode 100644 index 00000000..15b8ae17 --- /dev/null +++ b/src/gcore/types/cloud/instance_resize_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["InstanceResizeParams"] + + +class InstanceResizeParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[1].schema" + """ + + flavor_id: Required[str] + """ + '#/components/schemas/FlavorIdSchema/properties/flavor_id' + "$.components.schemas.FlavorIdSchema.properties.flavor_id" + """ diff --git a/src/gcore/types/cloud/instance_unassign_security_group_params.py b/src/gcore/types/cloud/instance_unassign_security_group_params.py new file mode 100644 index 00000000..100b0809 --- /dev/null +++ b/src/gcore/types/cloud/instance_unassign_security_group_params.py @@ -0,0 +1,48 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["InstanceUnassignSecurityGroupParams", "PortsSecurityGroupName"] + + +class InstanceUnassignSecurityGroupParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[1].schema" + """ + + name: str + """ + '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/name' + "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.name" + """ + + ports_security_group_names: Iterable[PortsSecurityGroupName] + """ + '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/ports_security_group_names' + "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.ports_security_group_names" + """ + + +class PortsSecurityGroupName(TypedDict, total=False): + port_id: Required[Optional[str]] + """ + '#/components/schemas/PortSecurityGroupNamesSchema/properties/port_id' + "$.components.schemas.PortSecurityGroupNamesSchema.properties.port_id" + """ + + security_group_names: Required[List[str]] + """ + '#/components/schemas/PortSecurityGroupNamesSchema/properties/security_group_names' + "$.components.schemas.PortSecurityGroupNamesSchema.properties.security_group_names" + """ diff --git a/src/gcore/types/cloud/instance_update_params.py b/src/gcore/types/cloud/instance_update_params.py new file mode 100644 index 00000000..cf094766 --- /dev/null +++ b/src/gcore/types/cloud/instance_update_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["InstanceUpdateParams"] + + +class InstanceUpdateParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[1].schema" + """ + + name: Required[str] + """ + '#/components/schemas/NameSerializer/properties/name' + "$.components.schemas.NameSerializer.properties.name" + """ diff --git a/src/gcore/types/cloud/instances/__init__.py b/src/gcore/types/cloud/instances/__init__.py index 060c3b69..f275af0a 100644 --- a/src/gcore/types/cloud/instances/__init__.py +++ b/src/gcore/types/cloud/instances/__init__.py @@ -2,8 +2,18 @@ from __future__ import annotations +from .metrics import Metrics as Metrics +from .metrics_list import MetricsList as MetricsList +from .instance_flavor import InstanceFlavor as InstanceFlavor from .image_get_params import ImageGetParams as ImageGetParams from .image_list_params import ImageListParams as ImageListParams +from .flavor_list_params import FlavorListParams as FlavorListParams +from .metric_list_params import MetricListParams as MetricListParams from .image_update_params import ImageUpdateParams as ImageUpdateParams from .image_upload_params import ImageUploadParams as ImageUploadParams +from .instance_flavor_list import InstanceFlavorList as InstanceFlavorList +from .interface_attach_params import InterfaceAttachParams as InterfaceAttachParams +from .interface_detach_params import InterfaceDetachParams as InterfaceDetachParams +from .flavor_list_suitable_params import FlavorListSuitableParams as FlavorListSuitableParams +from .flavor_list_for_resize_params import FlavorListForResizeParams as FlavorListForResizeParams from .image_create_from_volume_params import ImageCreateFromVolumeParams as ImageCreateFromVolumeParams diff --git a/src/gcore/types/cloud/instances/flavor_list_for_resize_params.py b/src/gcore/types/cloud/instances/flavor_list_for_resize_params.py new file mode 100644 index 00000000..a2bcb22a --- /dev/null +++ b/src/gcore/types/cloud/instances/flavor_list_for_resize_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["FlavorListForResizeParams"] + + +class FlavorListForResizeParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[1].schema" + """ + + include_prices: bool + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/3' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[3]" + """ diff --git a/src/gcore/types/cloud/instances/flavor_list_params.py b/src/gcore/types/cloud/instances/flavor_list_params.py new file mode 100644 index 00000000..3fbc6f0a --- /dev/null +++ b/src/gcore/types/cloud/instances/flavor_list_params.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["FlavorListParams"] + + +class FlavorListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[1].schema" + """ + + disabled: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[2]" + """ + + exclude_linux: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[3]" + """ + + exclude_windows: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[4]" + """ + + include_prices: bool + """ + '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' + "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[5]" + """ diff --git a/src/gcore/types/cloud/instances/flavor_list_suitable_params.py b/src/gcore/types/cloud/instances/flavor_list_suitable_params.py new file mode 100644 index 00000000..d8895a16 --- /dev/null +++ b/src/gcore/types/cloud/instances/flavor_list_suitable_params.py @@ -0,0 +1,90 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["FlavorListSuitableParams", "Volume"] + + +class FlavorListSuitableParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[1].schema" + """ + + volumes: Required[Iterable[Volume]] + """ + '#/components/schemas/CreateInstanceVolumeListSchema/properties/volumes' + "$.components.schemas.CreateInstanceVolumeListSchema.properties.volumes" + """ + + include_prices: bool + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/2' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[2]" + """ + + +class Volume(TypedDict, total=False): + source: Required[Literal["apptemplate", "existing-volume", "image", "new-volume", "snapshot"]] + """ + '#/components/schemas/CheckFlavorVolumeSchema/properties/source' + "$.components.schemas.CheckFlavorVolumeSchema.properties.source" + """ + + apptemplate_id: str + """ + '#/components/schemas/CheckFlavorVolumeSchema/properties/apptemplate_id' + "$.components.schemas.CheckFlavorVolumeSchema.properties.apptemplate_id" + """ + + boot_index: int + """ + '#/components/schemas/CheckFlavorVolumeSchema/properties/boot_index' + "$.components.schemas.CheckFlavorVolumeSchema.properties.boot_index" + """ + + image_id: str + """ + '#/components/schemas/CheckFlavorVolumeSchema/properties/image_id' + "$.components.schemas.CheckFlavorVolumeSchema.properties.image_id" + """ + + name: Optional[str] + """ + '#/components/schemas/CheckFlavorVolumeSchema/properties/name' + "$.components.schemas.CheckFlavorVolumeSchema.properties.name" + """ + + size: int + """ + '#/components/schemas/CheckFlavorVolumeSchema/properties/size' + "$.components.schemas.CheckFlavorVolumeSchema.properties.size" + """ + + snapshot_id: str + """ + '#/components/schemas/CheckFlavorVolumeSchema/properties/snapshot_id' + "$.components.schemas.CheckFlavorVolumeSchema.properties.snapshot_id" + """ + + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + """ + '#/components/schemas/CheckFlavorVolumeSchema/properties/type_name' + "$.components.schemas.CheckFlavorVolumeSchema.properties.type_name" + """ + + volume_id: str + """ + '#/components/schemas/CheckFlavorVolumeSchema/properties/volume_id' + "$.components.schemas.CheckFlavorVolumeSchema.properties.volume_id" + """ diff --git a/src/gcore/types/cloud/instances/image_create_from_volume_params.py b/src/gcore/types/cloud/instances/image_create_from_volume_params.py index 31205cb8..eaaee130 100644 --- a/src/gcore/types/cloud/instances/image_create_from_volume_params.py +++ b/src/gcore/types/cloud/instances/image_create_from_volume_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal, Required, TypedDict +from ..tag_update_list_param import TagUpdateListParam + __all__ = ["ImageCreateFromVolumeParams"] @@ -75,7 +77,7 @@ class ImageCreateFromVolumeParams(TypedDict, total=False): "$.components.schemas.ImageCreateFromVolumeSerializer.properties.ssh_key" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/ImageCreateFromVolumeSerializer/properties/tags' "$.components.schemas.ImageCreateFromVolumeSerializer.properties.tags" diff --git a/src/gcore/types/cloud/instances/image_update_params.py b/src/gcore/types/cloud/instances/image_update_params.py index c86a4acf..8b1dd76a 100644 --- a/src/gcore/types/cloud/instances/image_update_params.py +++ b/src/gcore/types/cloud/instances/image_update_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import Dict from typing_extensions import Literal, TypedDict +from ..tag_update_list_param import TagUpdateListParam + __all__ = ["ImageUpdateParams"] @@ -57,7 +58,7 @@ class ImageUpdateParams(TypedDict, total=False): "$.components.schemas.UpdateImageSerializer.properties.ssh_key" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/UpdateImageSerializer/properties/tags' "$.components.schemas.UpdateImageSerializer.properties.tags" diff --git a/src/gcore/types/cloud/instances/image_upload_params.py b/src/gcore/types/cloud/instances/image_upload_params.py index 95237809..db781440 100644 --- a/src/gcore/types/cloud/instances/image_upload_params.py +++ b/src/gcore/types/cloud/instances/image_upload_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal, Required, TypedDict +from ..tag_update_list_param import TagUpdateListParam + __all__ = ["ImageUploadParams"] @@ -87,7 +89,7 @@ class ImageUploadParams(TypedDict, total=False): "$.components.schemas.ImageDownloadSerializer.properties.ssh_key" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/ImageDownloadSerializer/properties/tags' "$.components.schemas.ImageDownloadSerializer.properties.tags" diff --git a/src/gcore/types/cloud/instances/instance_flavor.py b/src/gcore/types/cloud/instances/instance_flavor.py new file mode 100644 index 00000000..66719803 --- /dev/null +++ b/src/gcore/types/cloud/instances/instance_flavor.py @@ -0,0 +1,88 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["InstanceFlavor"] + + +class InstanceFlavor(BaseModel): + architecture: str + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/architecture' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.architecture" + """ + + disabled: bool + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/disabled' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.disabled" + """ + + flavor_id: str + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/flavor_id' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.flavor_id" + """ + + flavor_name: str + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/flavor_name' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.flavor_name" + """ + + os_type: str + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/os_type' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.os_type" + """ + + ram: int + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/ram' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.ram" + """ + + vcpus: int + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/vcpus' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.vcpus" + """ + + capacity: Optional[int] = None + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/capacity/anyOf/0' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.capacity.anyOf[0]" + """ + + currency_code: Optional[str] = None + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/currency_code/anyOf/0' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.currency_code.anyOf[0]" + """ + + hardware_description: Optional[Dict[str, str]] = None + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/hardware_description' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.hardware_description" + """ + + price_per_hour: Optional[float] = None + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/price_per_hour/anyOf/0' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.price_per_hour.anyOf[0]" + """ + + price_per_month: Optional[float] = None + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/price_per_month/anyOf/0' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.price_per_month.anyOf[0]" + """ + + price_status: Optional[Literal["error", "hide", "show"]] = None + """ + '#/components/schemas/InstanceFlavorExtendedSerializer/properties/price_status/anyOf/0' + "$.components.schemas.InstanceFlavorExtendedSerializer.properties.price_status.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/instances/instance_flavor_list.py b/src/gcore/types/cloud/instances/instance_flavor_list.py new file mode 100644 index 00000000..69803c53 --- /dev/null +++ b/src/gcore/types/cloud/instances/instance_flavor_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .instance_flavor import InstanceFlavor + +__all__ = ["InstanceFlavorList"] + + +class InstanceFlavorList(BaseModel): + count: int + """ + '#/components/schemas/InstanceFlavorExtendedCollectionSerializer/properties/count' + "$.components.schemas.InstanceFlavorExtendedCollectionSerializer.properties.count" + """ + + results: List[InstanceFlavor] + """ + '#/components/schemas/InstanceFlavorExtendedCollectionSerializer/properties/results' + "$.components.schemas.InstanceFlavorExtendedCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/instances/interface_attach_params.py b/src/gcore/types/cloud/instances/interface_attach_params.py new file mode 100644 index 00000000..86e3d728 --- /dev/null +++ b/src/gcore/types/cloud/instances/interface_attach_params.py @@ -0,0 +1,456 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = [ + "InterfaceAttachParams", + "NewInterfaceExternalExtendSchemaWithDDOS", + "NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile", + "NewInterfaceExternalExtendSchemaWithDdosddosProfileField", + "NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup", + "NewInterfaceSpecificSubnetSchema", + "NewInterfaceSpecificSubnetSchemaDDOSProfile", + "NewInterfaceSpecificSubnetSchemaDDOSProfileField", + "NewInterfaceSpecificSubnetSchemaSecurityGroup", + "NewInterfaceAnySubnetSchema", + "NewInterfaceAnySubnetSchemaDDOSProfile", + "NewInterfaceAnySubnetSchemaDDOSProfileField", + "NewInterfaceAnySubnetSchemaSecurityGroup", + "NewInterfaceReservedFixedIPSchema", + "NewInterfaceReservedFixedIPSchemaDDOSProfile", + "NewInterfaceReservedFixedIPSchemaDDOSProfileField", + "NewInterfaceReservedFixedIPSchemaSecurityGroup", +] + + +class NewInterfaceExternalExtendSchemaWithDDOS(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + """ + + ddos_profile: NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + """ + '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ddos_profile.allOf[0]" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/interface_name' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.interface_name" + """ + + ip_family: Literal["dual", "ipv4", "ipv6"] + """ + '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ip_family' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ip_family" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/port_group' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.port_group" + """ + + security_groups: Iterable[NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + """ + '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/security_groups' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.security_groups" + """ + + type: str + """ + '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/type' + "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.type" + """ + + +class NewInterfaceExternalExtendSchemaWithDdosddosProfileField(TypedDict, total=False): + base_field: Optional[int] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" + """ + + field_name: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" + """ + + field_value: object + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" + """ + + value: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" + """ + + +class NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile(TypedDict, total=False): + profile_template: Required[int] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" + """ + + fields: Iterable[NewInterfaceExternalExtendSchemaWithDdosddosProfileField] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" + """ + + profile_template_name: str + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" + """ + + +class NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSchema/properties/id' + "$.components.schemas.MandatoryIdSchema.properties.id" + """ + + +class NewInterfaceSpecificSubnetSchema(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + """ + + subnet_id: Required[str] + """ + '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/subnet_id' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.subnet_id" + """ + + ddos_profile: NewInterfaceSpecificSubnetSchemaDDOSProfile + """ + '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.ddos_profile.allOf[0]" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/interface_name' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.interface_name" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/port_group' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.port_group" + """ + + security_groups: Iterable[NewInterfaceSpecificSubnetSchemaSecurityGroup] + """ + '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/security_groups' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.security_groups" + """ + + type: str + """ + '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/type' + "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.type" + """ + + +class NewInterfaceSpecificSubnetSchemaDDOSProfileField(TypedDict, total=False): + base_field: Optional[int] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" + """ + + field_name: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" + """ + + field_value: object + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" + """ + + value: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" + """ + + +class NewInterfaceSpecificSubnetSchemaDDOSProfile(TypedDict, total=False): + profile_template: Required[int] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" + """ + + fields: Iterable[NewInterfaceSpecificSubnetSchemaDDOSProfileField] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" + """ + + profile_template_name: str + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" + """ + + +class NewInterfaceSpecificSubnetSchemaSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSchema/properties/id' + "$.components.schemas.MandatoryIdSchema.properties.id" + """ + + +class NewInterfaceAnySubnetSchema(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + """ + + network_id: Required[str] + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/network_id' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.network_id" + """ + + ddos_profile: NewInterfaceAnySubnetSchemaDDOSProfile + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ddos_profile.allOf[0]" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/interface_name' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.interface_name" + """ + + ip_family: Literal["dual", "ipv4", "ipv6"] + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ip_family' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ip_family" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/port_group' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.port_group" + """ + + security_groups: Iterable[NewInterfaceAnySubnetSchemaSecurityGroup] + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/security_groups' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.security_groups" + """ + + type: str + """ + '#/components/schemas/NewInterfaceAnySubnetSchema/properties/type' + "$.components.schemas.NewInterfaceAnySubnetSchema.properties.type" + """ + + +class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): + base_field: Optional[int] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" + """ + + field_name: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" + """ + + field_value: object + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" + """ + + value: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" + """ + + +class NewInterfaceAnySubnetSchemaDDOSProfile(TypedDict, total=False): + profile_template: Required[int] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" + """ + + fields: Iterable[NewInterfaceAnySubnetSchemaDDOSProfileField] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" + """ + + profile_template_name: str + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" + """ + + +class NewInterfaceAnySubnetSchemaSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSchema/properties/id' + "$.components.schemas.MandatoryIdSchema.properties.id" + """ + + +class NewInterfaceReservedFixedIPSchema(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + """ + + port_id: Required[str] + """ + '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_id' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_id" + """ + + ddos_profile: NewInterfaceReservedFixedIPSchemaDDOSProfile + """ + '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/ddos_profile/allOf/0' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.ddos_profile.allOf[0]" + """ + + interface_name: str + """ + '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/interface_name' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.interface_name" + """ + + port_group: int + """ + '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_group' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_group" + """ + + security_groups: Iterable[NewInterfaceReservedFixedIPSchemaSecurityGroup] + """ + '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/security_groups' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.security_groups" + """ + + type: str + """ + '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/type' + "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.type" + """ + + +class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): + base_field: Optional[int] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" + """ + + field_name: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" + """ + + field_value: object + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" + """ + + value: Optional[str] + """ + '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' + "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" + """ + + +class NewInterfaceReservedFixedIPSchemaDDOSProfile(TypedDict, total=False): + profile_template: Required[int] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" + """ + + fields: Iterable[NewInterfaceReservedFixedIPSchemaDDOSProfileField] + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" + """ + + profile_template_name: str + """ + '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' + "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" + """ + + +class NewInterfaceReservedFixedIPSchemaSecurityGroup(TypedDict, total=False): + id: Required[str] + """ + '#/components/schemas/MandatoryIdSchema/properties/id' + "$.components.schemas.MandatoryIdSchema.properties.id" + """ + + +InterfaceAttachParams: TypeAlias = Union[ + NewInterfaceExternalExtendSchemaWithDDOS, + NewInterfaceSpecificSubnetSchema, + NewInterfaceAnySubnetSchema, + NewInterfaceReservedFixedIPSchema, +] diff --git a/src/gcore/types/cloud/instances/interface_detach_params.py b/src/gcore/types/cloud/instances/interface_detach_params.py new file mode 100644 index 00000000..7c3a2e66 --- /dev/null +++ b/src/gcore/types/cloud/instances/interface_detach_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["InterfaceDetachParams"] + + +class InterfaceDetachParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[1].schema" + """ + + ip_address: Required[str] + """ + '#/components/schemas/PortIdWithIpSchema/properties/ip_address' + "$.components.schemas.PortIdWithIpSchema.properties.ip_address" + """ + + port_id: Required[str] + """ + '#/components/schemas/PortIdWithIpSchema/properties/port_id' + "$.components.schemas.PortIdWithIpSchema.properties.port_id" + """ diff --git a/src/gcore/types/cloud/instances/metric_list_params.py b/src/gcore/types/cloud/instances/metric_list_params.py new file mode 100644 index 00000000..0a070052 --- /dev/null +++ b/src/gcore/types/cloud/instances/metric_list_params.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ..instance_metrics_time_unit import InstanceMetricsTimeUnit + +__all__ = ["MetricListParams"] + + +class MetricListParams(TypedDict, total=False): + project_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/0/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[0].schema" + """ + + region_id: int + """ + '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/1/schema' + "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[1].schema" + """ + + time_interval: Required[int] + """ + '#/components/schemas/InstanceMetricsRequestSerializer/properties/time_interval' + "$.components.schemas.InstanceMetricsRequestSerializer.properties.time_interval" + """ + + time_unit: Required[InstanceMetricsTimeUnit] + """ + '#/components/schemas/InstanceMetricsRequestSerializer/properties/time_unit' + "$.components.schemas.InstanceMetricsRequestSerializer.properties.time_unit" + """ diff --git a/src/gcore/types/cloud/instances/metrics.py b/src/gcore/types/cloud/instances/metrics.py new file mode 100644 index 00000000..e5ff9469 --- /dev/null +++ b/src/gcore/types/cloud/instances/metrics.py @@ -0,0 +1,91 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["Metrics", "Disk"] + + +class Disk(BaseModel): + disk_bps_read: Optional[float] = FieldInfo(alias="disk_Bps_read", default=None) + """ + '#/components/schemas/DisksMetrics/properties/disk_Bps_read/anyOf/0' + "$.components.schemas.DisksMetrics.properties.disk_Bps_read.anyOf[0]" + """ + + disk_bps_write: Optional[float] = FieldInfo(alias="disk_Bps_write", default=None) + """ + '#/components/schemas/DisksMetrics/properties/disk_Bps_write/anyOf/0' + "$.components.schemas.DisksMetrics.properties.disk_Bps_write.anyOf[0]" + """ + + disk_iops_read: Optional[float] = None + """ + '#/components/schemas/DisksMetrics/properties/disk_iops_read/anyOf/0' + "$.components.schemas.DisksMetrics.properties.disk_iops_read.anyOf[0]" + """ + + disk_iops_write: Optional[float] = None + """ + '#/components/schemas/DisksMetrics/properties/disk_iops_write/anyOf/0' + "$.components.schemas.DisksMetrics.properties.disk_iops_write.anyOf[0]" + """ + + disk_name: Optional[str] = None + """ + '#/components/schemas/DisksMetrics/properties/disk_name/anyOf/0' + "$.components.schemas.DisksMetrics.properties.disk_name.anyOf[0]" + """ + + +class Metrics(BaseModel): + time: str + """ + '#/components/schemas/InstanceMetricsSerializer/properties/time' + "$.components.schemas.InstanceMetricsSerializer.properties.time" + """ + + cpu_util: Optional[float] = None + """ + '#/components/schemas/InstanceMetricsSerializer/properties/cpu_util/anyOf/0' + "$.components.schemas.InstanceMetricsSerializer.properties.cpu_util.anyOf[0]" + """ + + disks: Optional[List[Disk]] = None + """ + '#/components/schemas/InstanceMetricsSerializer/properties/disks/anyOf/0' + "$.components.schemas.InstanceMetricsSerializer.properties.disks.anyOf[0]" + """ + + memory_util: Optional[float] = None + """ + '#/components/schemas/InstanceMetricsSerializer/properties/memory_util/anyOf/0' + "$.components.schemas.InstanceMetricsSerializer.properties.memory_util.anyOf[0]" + """ + + network_bps_egress: Optional[float] = FieldInfo(alias="network_Bps_egress", default=None) + """ + '#/components/schemas/InstanceMetricsSerializer/properties/network_Bps_egress/anyOf/0' + "$.components.schemas.InstanceMetricsSerializer.properties.network_Bps_egress.anyOf[0]" + """ + + network_bps_ingress: Optional[float] = FieldInfo(alias="network_Bps_ingress", default=None) + """ + '#/components/schemas/InstanceMetricsSerializer/properties/network_Bps_ingress/anyOf/0' + "$.components.schemas.InstanceMetricsSerializer.properties.network_Bps_ingress.anyOf[0]" + """ + + network_pps_egress: Optional[float] = None + """ + '#/components/schemas/InstanceMetricsSerializer/properties/network_pps_egress/anyOf/0' + "$.components.schemas.InstanceMetricsSerializer.properties.network_pps_egress.anyOf[0]" + """ + + network_pps_ingress: Optional[float] = None + """ + '#/components/schemas/InstanceMetricsSerializer/properties/network_pps_ingress/anyOf/0' + "$.components.schemas.InstanceMetricsSerializer.properties.network_pps_ingress.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/instances/metrics_list.py b/src/gcore/types/cloud/instances/metrics_list.py new file mode 100644 index 00000000..d3cbff46 --- /dev/null +++ b/src/gcore/types/cloud/instances/metrics_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .metrics import Metrics +from ...._models import BaseModel + +__all__ = ["MetricsList"] + + +class MetricsList(BaseModel): + count: int + """ + '#/components/schemas/InstanceMetricsListSerializer/properties/count' + "$.components.schemas.InstanceMetricsListSerializer.properties.count" + """ + + results: List[Metrics] + """ + '#/components/schemas/InstanceMetricsListSerializer/properties/results' + "$.components.schemas.InstanceMetricsListSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 0c0d8581..315cd360 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable, Optional +from typing import List, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .http_method import HTTPMethod @@ -11,6 +11,7 @@ from .health_monitor_type import HealthMonitorType from .interface_ip_family import InterfaceIPFamily from .lb_listener_protocol import LbListenerProtocol +from .tag_update_list_param import TagUpdateListParam from .session_persistence_type import SessionPersistenceType from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity @@ -85,7 +86,7 @@ class LoadBalancerCreateParams(TypedDict, total=False): "$.components.schemas.CreateLoadbalancerSerializer.properties.preferred_connectivity" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/CreateLoadbalancerSerializer/properties/tags' "$.components.schemas.CreateLoadbalancerSerializer.properties.tags" diff --git a/src/gcore/types/cloud/network_create_params.py b/src/gcore/types/cloud/network_create_params.py index d89487dd..b4ce478a 100644 --- a/src/gcore/types/cloud/network_create_params.py +++ b/src/gcore/types/cloud/network_create_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import Dict from typing_extensions import Literal, Required, TypedDict +from .tag_update_list_param import TagUpdateListParam + __all__ = ["NetworkCreateParams"] @@ -33,7 +34,7 @@ class NetworkCreateParams(TypedDict, total=False): "$.components.schemas.CreateNetworkSerializer.properties.create_router" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/CreateNetworkSerializer/properties/tags' "$.components.schemas.CreateNetworkSerializer.properties.tags" diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index 0867ba29..49034372 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -2,10 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional +from typing import List, Iterable, Optional from typing_extensions import Required, TypedDict from ..ip_version import IPVersion +from ..tag_update_list_param import TagUpdateListParam __all__ = ["SubnetCreateParams", "HostRoute"] @@ -83,7 +84,7 @@ class SubnetCreateParams(TypedDict, total=False): "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/CreateSubnetSerializer/properties/tags' "$.components.schemas.CreateSubnetSerializer.properties.tags" diff --git a/src/gcore/types/cloud/tag_update_list_param.py b/src/gcore/types/cloud/tag_update_list_param.py new file mode 100644 index 00000000..0479c357 --- /dev/null +++ b/src/gcore/types/cloud/tag_update_list_param.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["TagUpdateListParam"] + +TagUpdateListParam: TypeAlias = Dict[str, str] diff --git a/src/gcore/types/cloud/volume_create_params.py b/src/gcore/types/cloud/volume_create_params.py index 3a890abb..53b7bcbe 100644 --- a/src/gcore/types/cloud/volume_create_params.py +++ b/src/gcore/types/cloud/volume_create_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict +from .tag_update_list_param import TagUpdateListParam + __all__ = [ "VolumeCreateParams", "CreateVolumeFromImageSerializer", @@ -68,7 +70,7 @@ class CreateVolumeFromImageSerializer(TypedDict, total=False): "$.components.schemas.CreateVolumeFromImageSerializer.properties.lifecycle_policy_ids" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/CreateVolumeFromImageSerializer/properties/tags' "$.components.schemas.CreateVolumeFromImageSerializer.properties.tags" @@ -136,7 +138,7 @@ class CreateVolumeFromSnapshotSerializer(TypedDict, total=False): "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.size" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/tags' "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.tags" @@ -198,7 +200,7 @@ class CreateNewVolumeSerializer(TypedDict, total=False): "$.components.schemas.CreateNewVolumeSerializer.properties.lifecycle_policy_ids" """ - tags: Dict[str, str] + tags: TagUpdateListParam """ '#/components/schemas/CreateNewVolumeSerializer/properties/tags' "$.components.schemas.CreateNewVolumeSerializer.properties.tags" diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index 52689adf..fd8d2e62 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -63,7 +63,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: name_templates=["my-bare-metal-{ip_octets}"], names=["my-bare-metal"], password="password", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, user_data="user_data", username="username", ) @@ -266,7 +266,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> name_templates=["my-bare-metal-{ip_octets}"], names=["my-bare-metal"], password="password", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, user_data="user_data", username="username", ) diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py index c2b357cb..30e17761 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py @@ -167,7 +167,7 @@ def test_method_upload_with_all_params(self, client: Gcore) -> None: os_type="linux", os_version="19.04", ssh_key="allow", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -355,7 +355,7 @@ async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> os_type="linux", os_version="19.04", ssh_key="allow", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) diff --git a/tests/api_resources/cloud/instances/test_flavors.py b/tests/api_resources/cloud/instances/test_flavors.py new file mode 100644 index 00000000..d9766976 --- /dev/null +++ b/tests/api_resources/cloud/instances/test_flavors.py @@ -0,0 +1,346 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.instances import ( + InstanceFlavorList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFlavors: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + flavor = client.cloud.instances.flavors.list( + project_id=0, + region_id=0, + ) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + flavor = client.cloud.instances.flavors.list( + project_id=0, + region_id=0, + disabled=True, + exclude_linux=True, + exclude_windows=True, + include_prices=True, + ) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.instances.flavors.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = response.parse() + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.instances.flavors.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = response.parse() + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_for_resize(self, client: Gcore) -> None: + flavor = client.cloud.instances.flavors.list_for_resize( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + def test_method_list_for_resize_with_all_params(self, client: Gcore) -> None: + flavor = client.cloud.instances.flavors.list_for_resize( + instance_id="instance_id", + project_id=0, + region_id=0, + include_prices=True, + ) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + def test_raw_response_list_for_resize(self, client: Gcore) -> None: + response = client.cloud.instances.flavors.with_raw_response.list_for_resize( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = response.parse() + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + def test_streaming_response_list_for_resize(self, client: Gcore) -> None: + with client.cloud.instances.flavors.with_streaming_response.list_for_resize( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = response.parse() + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list_for_resize(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.flavors.with_raw_response.list_for_resize( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_list_suitable(self, client: Gcore) -> None: + flavor = client.cloud.instances.flavors.list_suitable( + project_id=0, + region_id=0, + volumes=[{"source": "image"}], + ) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + def test_method_list_suitable_with_all_params(self, client: Gcore) -> None: + flavor = client.cloud.instances.flavors.list_suitable( + project_id=0, + region_id=0, + volumes=[ + { + "source": "image", + "apptemplate_id": "apptemplate_id", + "boot_index": 0, + "image_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + "name": "TestVM5 Ubuntu boot image", + "size": 10, + "snapshot_id": "snapshot_id", + "type_name": "ssd_hiiops", + "volume_id": "volume_id", + } + ], + include_prices=True, + ) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + def test_raw_response_list_suitable(self, client: Gcore) -> None: + response = client.cloud.instances.flavors.with_raw_response.list_suitable( + project_id=0, + region_id=0, + volumes=[{"source": "image"}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = response.parse() + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + def test_streaming_response_list_suitable(self, client: Gcore) -> None: + with client.cloud.instances.flavors.with_streaming_response.list_suitable( + project_id=0, + region_id=0, + volumes=[{"source": "image"}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = response.parse() + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFlavors: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.instances.flavors.list( + project_id=0, + region_id=0, + ) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.instances.flavors.list( + project_id=0, + region_id=0, + disabled=True, + exclude_linux=True, + exclude_windows=True, + include_prices=True, + ) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.flavors.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = await response.parse() + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.flavors.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = await response.parse() + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_for_resize(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.instances.flavors.list_for_resize( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + async def test_method_list_for_resize_with_all_params(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.instances.flavors.list_for_resize( + instance_id="instance_id", + project_id=0, + region_id=0, + include_prices=True, + ) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + async def test_raw_response_list_for_resize(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.flavors.with_raw_response.list_for_resize( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = await response.parse() + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + async def test_streaming_response_list_for_resize(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.flavors.with_streaming_response.list_for_resize( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = await response.parse() + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list_for_resize(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.flavors.with_raw_response.list_for_resize( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_list_suitable(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.instances.flavors.list_suitable( + project_id=0, + region_id=0, + volumes=[{"source": "image"}], + ) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + async def test_method_list_suitable_with_all_params(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.instances.flavors.list_suitable( + project_id=0, + region_id=0, + volumes=[ + { + "source": "image", + "apptemplate_id": "apptemplate_id", + "boot_index": 0, + "image_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + "name": "TestVM5 Ubuntu boot image", + "size": 10, + "snapshot_id": "snapshot_id", + "type_name": "ssd_hiiops", + "volume_id": "volume_id", + } + ], + include_prices=True, + ) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + async def test_raw_response_list_suitable(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.flavors.with_raw_response.list_suitable( + project_id=0, + region_id=0, + volumes=[{"source": "image"}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = await response.parse() + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + @parametrize + async def test_streaming_response_list_suitable(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.flavors.with_streaming_response.list_suitable( + project_id=0, + region_id=0, + volumes=[{"source": "image"}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = await response.parse() + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/instances/test_images.py b/tests/api_resources/cloud/instances/test_images.py index 7fee425e..d796aec9 100644 --- a/tests/api_resources/cloud/instances/test_images.py +++ b/tests/api_resources/cloud/instances/test_images.py @@ -38,7 +38,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: name="my-image", os_type="linux", ssh_key="allow", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Image, image, path=["response"]) @@ -196,7 +196,7 @@ def test_method_create_from_volume_with_all_params(self, client: Gcore) -> None: os_type="linux", source="volume", ssh_key="allow", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -312,7 +312,7 @@ def test_method_upload_with_all_params(self, client: Gcore) -> None: os_type="linux", os_version="22.04", ssh_key="allow", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -371,7 +371,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> name="my-image", os_type="linux", ssh_key="allow", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Image, image, path=["response"]) @@ -529,7 +529,7 @@ async def test_method_create_from_volume_with_all_params(self, async_client: Asy os_type="linux", source="volume", ssh_key="allow", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -645,7 +645,7 @@ async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> os_type="linux", os_version="22.04", ssh_key="allow", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) diff --git a/tests/api_resources/cloud/instances/test_interfaces.py b/tests/api_resources/cloud/instances/test_interfaces.py new file mode 100644 index 00000000..a3b34d4c --- /dev/null +++ b/tests/api_resources/cloud/instances/test_interfaces.py @@ -0,0 +1,848 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import TaskIDList, NetworkInterfaceList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInterfaces: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + interface = client.cloud.instances.interfaces.list( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(NetworkInterfaceList, interface, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.instances.interfaces.with_raw_response.list( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(NetworkInterfaceList, interface, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.instances.interfaces.with_streaming_response.list( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(NetworkInterfaceList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.interfaces.with_raw_response.list( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_attach_overload_1(self, client: Gcore) -> None: + interface = client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_method_attach_with_all_params_overload_1(self, client: Gcore) -> None: + interface = client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="interface_name", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="external", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_attach_overload_1(self, client: Gcore) -> None: + response = client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_attach_overload_1(self, client: Gcore) -> None: + with client.cloud.instances.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_overload_1(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_attach_overload_2(self, client: Gcore) -> None: + interface = client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_method_attach_with_all_params_overload_2(self, client: Gcore) -> None: + interface = client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-subnet-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="subnet", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_attach_overload_2(self, client: Gcore) -> None: + response = client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_attach_overload_2(self, client: Gcore) -> None: + with client.cloud.instances.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_overload_2(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + def test_method_attach_overload_3(self, client: Gcore) -> None: + interface = client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_method_attach_with_all_params_overload_3(self, client: Gcore) -> None: + interface = client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-any-subnet-interface", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="any_subnet", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_attach_overload_3(self, client: Gcore) -> None: + response = client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_attach_overload_3(self, client: Gcore) -> None: + with client.cloud.instances.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_overload_3(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + def test_method_attach_overload_4(self, client: Gcore) -> None: + interface = client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_method_attach_with_all_params_overload_4(self, client: Gcore) -> None: + interface = client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-rfip-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="reserved_fixed_ip", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_attach_overload_4(self, client: Gcore) -> None: + response = client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_attach_overload_4(self, client: Gcore) -> None: + with client.cloud.instances.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_overload_4(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + @parametrize + def test_method_detach(self, client: Gcore) -> None: + interface = client.cloud.instances.interfaces.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_detach(self, client: Gcore) -> None: + response = client.cloud.instances.interfaces.with_raw_response.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_detach(self, client: Gcore) -> None: + with client.cloud.instances.interfaces.with_streaming_response.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_detach(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.interfaces.with_raw_response.detach( + instance_id="", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + + +class TestAsyncInterfaces: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.instances.interfaces.list( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(NetworkInterfaceList, interface, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.interfaces.with_raw_response.list( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(NetworkInterfaceList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.interfaces.with_streaming_response.list( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(NetworkInterfaceList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.interfaces.with_raw_response.list( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_attach_overload_1(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_method_attach_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="interface_name", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="external", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_attach_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_attach_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_overload_1(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_attach_overload_2(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_method_attach_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-subnet-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="subnet", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_attach_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_attach_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_overload_2(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + async def test_method_attach_overload_3(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_method_attach_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-any-subnet-interface", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="any_subnet", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_attach_overload_3(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_attach_overload_3(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_overload_3(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + async def test_method_attach_overload_4(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_method_attach_with_all_params_overload_4(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.instances.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-rfip-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="reserved_fixed_ip", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_attach_overload_4(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_attach_overload_4(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_overload_4(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + @parametrize + async def test_method_detach(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.instances.interfaces.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_detach(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.interfaces.with_raw_response.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_detach(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.interfaces.with_streaming_response.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_detach(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.interfaces.with_raw_response.detach( + instance_id="", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) diff --git a/tests/api_resources/cloud/instances/test_metrics.py b/tests/api_resources/cloud/instances/test_metrics.py new file mode 100644 index 00000000..cf5ce302 --- /dev/null +++ b/tests/api_resources/cloud/instances/test_metrics.py @@ -0,0 +1,130 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.instances import MetricsList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestMetrics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + metric = client.cloud.instances.metrics.list( + instance_id="instance_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + assert_matches_type(MetricsList, metric, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.instances.metrics.with_raw_response.list( + instance_id="instance_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = response.parse() + assert_matches_type(MetricsList, metric, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.instances.metrics.with_streaming_response.list( + instance_id="instance_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = response.parse() + assert_matches_type(MetricsList, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.metrics.with_raw_response.list( + instance_id="", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + + +class TestAsyncMetrics: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + metric = await async_client.cloud.instances.metrics.list( + instance_id="instance_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + assert_matches_type(MetricsList, metric, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.metrics.with_raw_response.list( + instance_id="instance_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = await response.parse() + assert_matches_type(MetricsList, metric, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.metrics.with_streaming_response.list( + instance_id="instance_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = await response.parse() + assert_matches_type(MetricsList, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.metrics.with_raw_response.list( + instance_id="", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) diff --git a/tests/api_resources/cloud/networks/test_subnets.py b/tests/api_resources/cloud/networks/test_subnets.py index 5f5be075..88244d9c 100644 --- a/tests/api_resources/cloud/networks/test_subnets.py +++ b/tests/api_resources/cloud/networks/test_subnets.py @@ -49,7 +49,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: ], ip_version=4, router_id_to_connect="00000000-0000-4000-8000-000000000000", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, subnet, path=["response"]) @@ -325,7 +325,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> ], ip_version=4, router_id_to_connect="00000000-0000-4000-8000-000000000000", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, subnet, path=["response"]) diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index 482a4200..289e198f 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -51,7 +51,7 @@ def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: "ip_address": "10.0.0.1", } ], - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, volume_type="default_share_type", ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -111,7 +111,7 @@ def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: protocol="NFS", size=5, volume_type="vast_share_type", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -419,7 +419,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn "ip_address": "10.0.0.1", } ], - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, volume_type="default_share_type", ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -479,7 +479,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn protocol="NFS", size=5, volume_type="vast_share_type", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, file_share, path=["response"]) diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index 52a54438..38d101e5 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -37,7 +37,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: region_id=1, fixed_ip_address="192.168.10.15", port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) @@ -331,7 +331,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> region_id=1, fixed_ip_address="192.168.10.15", port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index 936cda07..d5807da8 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -62,7 +62,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: instances_count=1, keypair_name="my-keypair", password="password", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, user_data="user_data", username="username", ) @@ -560,7 +560,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> instances_count=1, keypair_name="my-keypair", password="password", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, user_data="user_data", username="username", ) diff --git a/tests/api_resources/cloud/test_instances.py b/tests/api_resources/cloud/test_instances.py new file mode 100644 index 00000000..d7258230 --- /dev/null +++ b/tests/api_resources/cloud/test_instances.py @@ -0,0 +1,1725 @@ +# 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._utils import parse_datetime +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import ( + Console, + Instance, + TaskIDList, + InstanceInterface, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInstances: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + instance = client.cloud.instances.create( + project_id=1, + region_id=1, + flavor="g2-standard-32-64", + interfaces=[{"type": "external"}], + volumes=[{"source": "image"}], + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + instance = client.cloud.instances.create( + project_id=1, + region_id=1, + flavor="g2-standard-32-64", + interfaces=[ + { + "type": "external", + "interface_name": "eth0", + "ip_family": "ipv4", + "port_group": 0, + "security_groups": [{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], + } + ], + volumes=[ + { + "source": "image", + "apptemplate_id": "grafana", + "attachment_tag": "root", + "boot_index": 0, + "delete_on_termination": False, + "image_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + "name": "boot-volume", + "size": 10, + "snapshot_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + "tags": {"foo": "my-tag-value"}, + "type_name": "ssd_hiiops", + "volume_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + } + ], + allow_app_ports=True, + configuration={}, + keypair_name="my-keypair", + name_templates=["my-instance-{ip_octets}"], + names=["my-instance"], + password="password", + security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], + servergroup_id="servergroup_id", + tags={"foo": "my-tag-value"}, + user_data="user_data", + username="username", + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.create( + project_id=1, + region_id=1, + flavor="g2-standard-32-64", + interfaces=[{"type": "external"}], + volumes=[{"source": "image"}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.create( + project_id=1, + region_id=1, + flavor="g2-standard-32-64", + interfaces=[{"type": "external"}], + volumes=[{"source": "image"}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + instance = client.cloud.instances.update( + instance_id="instance_id", + project_id=0, + region_id=0, + name="my-resource", + ) + assert_matches_type(Instance, instance, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.update( + instance_id="instance_id", + project_id=0, + region_id=0, + name="my-resource", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(Instance, instance, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.update( + instance_id="instance_id", + project_id=0, + region_id=0, + name="my-resource", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(Instance, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.with_raw_response.update( + instance_id="", + project_id=0, + region_id=0, + name="my-resource", + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + instance = client.cloud.instances.list( + project_id=1, + region_id=1, + ) + assert_matches_type(SyncOffsetPage[Instance], instance, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + instance = client.cloud.instances.list( + project_id=1, + region_id=1, + available_floating=True, + changes_before=parse_datetime("2025-10-01T12:00:00Z"), + changes_since=parse_datetime("2025-10-01T12:00:00Z"), + exclude_flavor_prefix="g1-", + exclude_secgroup="secgroup_name", + flavor_id="g2-standard-32-64", + flavor_prefix="g2-", + include_ai=False, + include_baremetal=False, + include_k8s=True, + ip="192.168.0.1", + limit=1000, + name="name", + offset=0, + only_isolated=True, + only_with_fixed_external_ip=True, + order_by="name.asc", + profile_name="profile_name", + protection_status="Active", + status="ACTIVE", + tag_key_value="tag_key_value", + tag_value=["value1", "value2"], + type_ddos_profile="advanced", + uuid="b5b4d65d-945f-4b98-ab6f-332319c724ef", + with_ddos=True, + with_interfaces_name=True, + ) + assert_matches_type(SyncOffsetPage[Instance], instance, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.list( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(SyncOffsetPage[Instance], instance, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.list( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(SyncOffsetPage[Instance], instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + instance = client.cloud.instances.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_method_delete_with_all_params(self, client: Gcore) -> None: + instance = client.cloud.instances.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + delete_floatings=True, + floatings="floatings", + reserved_fixed_ips="reserved_fixed_ips", + volumes="volume_id_1,volume_id_2", + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.with_raw_response.delete( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_action_overload_1(self, client: Gcore) -> None: + instance = client.cloud.instances.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="start", + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_method_action_with_all_params_overload_1(self, client: Gcore) -> None: + instance = client.cloud.instances.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="start", + activate_profile=True, + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_raw_response_action_overload_1(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="start", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_streaming_response_action_overload_1(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="start", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_action_overload_1(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.with_raw_response.action( + instance_id="", + project_id=0, + region_id=0, + action="start", + ) + + @parametrize + def test_method_action_overload_2(self, client: Gcore) -> None: + instance = client.cloud.instances.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="stop", + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_raw_response_action_overload_2(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="stop", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_streaming_response_action_overload_2(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="stop", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_action_overload_2(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.with_raw_response.action( + instance_id="", + project_id=0, + region_id=0, + action="stop", + ) + + @parametrize + def test_method_add_to_placement_group(self, client: Gcore) -> None: + instance = client.cloud.instances.add_to_placement_group( + instance_id="instance_id", + project_id=0, + region_id=0, + servergroup_id="47003067-550a-6f17-93b6-81ee16ba061e", + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_raw_response_add_to_placement_group(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.add_to_placement_group( + instance_id="instance_id", + project_id=0, + region_id=0, + servergroup_id="47003067-550a-6f17-93b6-81ee16ba061e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_streaming_response_add_to_placement_group(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.add_to_placement_group( + instance_id="instance_id", + project_id=0, + region_id=0, + servergroup_id="47003067-550a-6f17-93b6-81ee16ba061e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_add_to_placement_group(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.with_raw_response.add_to_placement_group( + instance_id="", + project_id=0, + region_id=0, + servergroup_id="47003067-550a-6f17-93b6-81ee16ba061e", + ) + + @parametrize + def test_method_assign_security_group(self, client: Gcore) -> None: + instance = client.cloud.instances.assign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert instance is None + + @parametrize + def test_method_assign_security_group_with_all_params(self, client: Gcore) -> None: + instance = client.cloud.instances.assign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + name="some_name", + ports_security_group_names=[ + { + "port_id": None, + "security_group_names": ["some_name"], + }, + { + "port_id": "ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + "security_group_names": ["name1", "name2"], + }, + ], + ) + assert instance is None + + @parametrize + def test_raw_response_assign_security_group(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.assign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert instance is None + + @parametrize + def test_streaming_response_assign_security_group(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.assign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert instance is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_assign_security_group(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.with_raw_response.assign_security_group( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_disable_port_security(self, client: Gcore) -> None: + instance = client.cloud.instances.disable_port_security( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(InstanceInterface, instance, path=["response"]) + + @parametrize + def test_raw_response_disable_port_security(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.disable_port_security( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(InstanceInterface, instance, path=["response"]) + + @parametrize + def test_streaming_response_disable_port_security(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.disable_port_security( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(InstanceInterface, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_disable_port_security(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.instances.with_raw_response.disable_port_security( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_enable_port_security(self, client: Gcore) -> None: + instance = client.cloud.instances.enable_port_security( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(InstanceInterface, instance, path=["response"]) + + @parametrize + def test_raw_response_enable_port_security(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.enable_port_security( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(InstanceInterface, instance, path=["response"]) + + @parametrize + def test_streaming_response_enable_port_security(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.enable_port_security( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(InstanceInterface, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_enable_port_security(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.instances.with_raw_response.enable_port_security( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + instance = client.cloud.instances.get( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Instance, instance, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.get( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(Instance, instance, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.get( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(Instance, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.with_raw_response.get( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get_console(self, client: Gcore) -> None: + instance = client.cloud.instances.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Console, instance, path=["response"]) + + @parametrize + def test_method_get_console_with_all_params(self, client: Gcore) -> None: + instance = client.cloud.instances.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + console_type="console_type", + ) + assert_matches_type(Console, instance, path=["response"]) + + @parametrize + def test_raw_response_get_console(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(Console, instance, path=["response"]) + + @parametrize + def test_streaming_response_get_console(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(Console, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_console(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.with_raw_response.get_console( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_remove_from_placement_group(self, client: Gcore) -> None: + instance = client.cloud.instances.remove_from_placement_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_raw_response_remove_from_placement_group(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.remove_from_placement_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_streaming_response_remove_from_placement_group(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.remove_from_placement_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_remove_from_placement_group(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.with_raw_response.remove_from_placement_group( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_resize(self, client: Gcore) -> None: + instance = client.cloud.instances.resize( + instance_id="instance_id", + project_id=0, + region_id=0, + flavor_id="g1s-shared-1-0.5", + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_raw_response_resize(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.resize( + instance_id="instance_id", + project_id=0, + region_id=0, + flavor_id="g1s-shared-1-0.5", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + def test_streaming_response_resize(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.resize( + instance_id="instance_id", + project_id=0, + region_id=0, + flavor_id="g1s-shared-1-0.5", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_resize(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.with_raw_response.resize( + instance_id="", + project_id=0, + region_id=0, + flavor_id="g1s-shared-1-0.5", + ) + + @parametrize + def test_method_unassign_security_group(self, client: Gcore) -> None: + instance = client.cloud.instances.unassign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert instance is None + + @parametrize + def test_method_unassign_security_group_with_all_params(self, client: Gcore) -> None: + instance = client.cloud.instances.unassign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + name="some_name", + ports_security_group_names=[ + { + "port_id": None, + "security_group_names": ["some_name"], + }, + { + "port_id": "ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + "security_group_names": ["name1", "name2"], + }, + ], + ) + assert instance is None + + @parametrize + def test_raw_response_unassign_security_group(self, client: Gcore) -> None: + response = client.cloud.instances.with_raw_response.unassign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = response.parse() + assert instance is None + + @parametrize + def test_streaming_response_unassign_security_group(self, client: Gcore) -> None: + with client.cloud.instances.with_streaming_response.unassign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = response.parse() + assert instance is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_unassign_security_group(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.instances.with_raw_response.unassign_security_group( + instance_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncInstances: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.create( + project_id=1, + region_id=1, + flavor="g2-standard-32-64", + interfaces=[{"type": "external"}], + volumes=[{"source": "image"}], + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.create( + project_id=1, + region_id=1, + flavor="g2-standard-32-64", + interfaces=[ + { + "type": "external", + "interface_name": "eth0", + "ip_family": "ipv4", + "port_group": 0, + "security_groups": [{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], + } + ], + volumes=[ + { + "source": "image", + "apptemplate_id": "grafana", + "attachment_tag": "root", + "boot_index": 0, + "delete_on_termination": False, + "image_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + "name": "boot-volume", + "size": 10, + "snapshot_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + "tags": {"foo": "my-tag-value"}, + "type_name": "ssd_hiiops", + "volume_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + } + ], + allow_app_ports=True, + configuration={}, + keypair_name="my-keypair", + name_templates=["my-instance-{ip_octets}"], + names=["my-instance"], + password="password", + security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], + servergroup_id="servergroup_id", + tags={"foo": "my-tag-value"}, + user_data="user_data", + username="username", + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.create( + project_id=1, + region_id=1, + flavor="g2-standard-32-64", + interfaces=[{"type": "external"}], + volumes=[{"source": "image"}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.create( + project_id=1, + region_id=1, + flavor="g2-standard-32-64", + interfaces=[{"type": "external"}], + volumes=[{"source": "image"}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.update( + instance_id="instance_id", + project_id=0, + region_id=0, + name="my-resource", + ) + assert_matches_type(Instance, instance, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.update( + instance_id="instance_id", + project_id=0, + region_id=0, + name="my-resource", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(Instance, instance, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.update( + instance_id="instance_id", + project_id=0, + region_id=0, + name="my-resource", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(Instance, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.with_raw_response.update( + instance_id="", + project_id=0, + region_id=0, + name="my-resource", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.list( + project_id=1, + region_id=1, + ) + assert_matches_type(AsyncOffsetPage[Instance], instance, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.list( + project_id=1, + region_id=1, + available_floating=True, + changes_before=parse_datetime("2025-10-01T12:00:00Z"), + changes_since=parse_datetime("2025-10-01T12:00:00Z"), + exclude_flavor_prefix="g1-", + exclude_secgroup="secgroup_name", + flavor_id="g2-standard-32-64", + flavor_prefix="g2-", + include_ai=False, + include_baremetal=False, + include_k8s=True, + ip="192.168.0.1", + limit=1000, + name="name", + offset=0, + only_isolated=True, + only_with_fixed_external_ip=True, + order_by="name.asc", + profile_name="profile_name", + protection_status="Active", + status="ACTIVE", + tag_key_value="tag_key_value", + tag_value=["value1", "value2"], + type_ddos_profile="advanced", + uuid="b5b4d65d-945f-4b98-ab6f-332319c724ef", + with_ddos=True, + with_interfaces_name=True, + ) + assert_matches_type(AsyncOffsetPage[Instance], instance, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.list( + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(AsyncOffsetPage[Instance], instance, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.list( + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(AsyncOffsetPage[Instance], instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + delete_floatings=True, + floatings="floatings", + reserved_fixed_ips="reserved_fixed_ips", + volumes="volume_id_1,volume_id_2", + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.with_raw_response.delete( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_action_overload_1(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="start", + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_method_action_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="start", + activate_profile=True, + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_raw_response_action_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="start", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_streaming_response_action_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="start", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_action_overload_1(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.with_raw_response.action( + instance_id="", + project_id=0, + region_id=0, + action="start", + ) + + @parametrize + async def test_method_action_overload_2(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="stop", + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_raw_response_action_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="stop", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_streaming_response_action_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.action( + instance_id="instance_id", + project_id=0, + region_id=0, + action="stop", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_action_overload_2(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.with_raw_response.action( + instance_id="", + project_id=0, + region_id=0, + action="stop", + ) + + @parametrize + async def test_method_add_to_placement_group(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.add_to_placement_group( + instance_id="instance_id", + project_id=0, + region_id=0, + servergroup_id="47003067-550a-6f17-93b6-81ee16ba061e", + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_raw_response_add_to_placement_group(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.add_to_placement_group( + instance_id="instance_id", + project_id=0, + region_id=0, + servergroup_id="47003067-550a-6f17-93b6-81ee16ba061e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_streaming_response_add_to_placement_group(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.add_to_placement_group( + instance_id="instance_id", + project_id=0, + region_id=0, + servergroup_id="47003067-550a-6f17-93b6-81ee16ba061e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_add_to_placement_group(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.with_raw_response.add_to_placement_group( + instance_id="", + project_id=0, + region_id=0, + servergroup_id="47003067-550a-6f17-93b6-81ee16ba061e", + ) + + @parametrize + async def test_method_assign_security_group(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.assign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert instance is None + + @parametrize + async def test_method_assign_security_group_with_all_params(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.assign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + name="some_name", + ports_security_group_names=[ + { + "port_id": None, + "security_group_names": ["some_name"], + }, + { + "port_id": "ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + "security_group_names": ["name1", "name2"], + }, + ], + ) + assert instance is None + + @parametrize + async def test_raw_response_assign_security_group(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.assign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert instance is None + + @parametrize + async def test_streaming_response_assign_security_group(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.assign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert instance is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_assign_security_group(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.with_raw_response.assign_security_group( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_disable_port_security(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.disable_port_security( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(InstanceInterface, instance, path=["response"]) + + @parametrize + async def test_raw_response_disable_port_security(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.disable_port_security( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(InstanceInterface, instance, path=["response"]) + + @parametrize + async def test_streaming_response_disable_port_security(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.disable_port_security( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(InstanceInterface, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_disable_port_security(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.instances.with_raw_response.disable_port_security( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_enable_port_security(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.enable_port_security( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(InstanceInterface, instance, path=["response"]) + + @parametrize + async def test_raw_response_enable_port_security(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.enable_port_security( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(InstanceInterface, instance, path=["response"]) + + @parametrize + async def test_streaming_response_enable_port_security(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.enable_port_security( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(InstanceInterface, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_enable_port_security(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.instances.with_raw_response.enable_port_security( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.get( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Instance, instance, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.get( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(Instance, instance, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.get( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(Instance, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.with_raw_response.get( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get_console(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Console, instance, path=["response"]) + + @parametrize + async def test_method_get_console_with_all_params(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + console_type="console_type", + ) + assert_matches_type(Console, instance, path=["response"]) + + @parametrize + async def test_raw_response_get_console(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(Console, instance, path=["response"]) + + @parametrize + async def test_streaming_response_get_console(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.get_console( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(Console, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_console(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.with_raw_response.get_console( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_remove_from_placement_group(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.remove_from_placement_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_raw_response_remove_from_placement_group(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.remove_from_placement_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_streaming_response_remove_from_placement_group(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.remove_from_placement_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_remove_from_placement_group(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.with_raw_response.remove_from_placement_group( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_resize(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.resize( + instance_id="instance_id", + project_id=0, + region_id=0, + flavor_id="g1s-shared-1-0.5", + ) + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.resize( + instance_id="instance_id", + project_id=0, + region_id=0, + flavor_id="g1s-shared-1-0.5", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + @parametrize + async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.resize( + instance_id="instance_id", + project_id=0, + region_id=0, + flavor_id="g1s-shared-1-0.5", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert_matches_type(TaskIDList, instance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_resize(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.with_raw_response.resize( + instance_id="", + project_id=0, + region_id=0, + flavor_id="g1s-shared-1-0.5", + ) + + @parametrize + async def test_method_unassign_security_group(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.unassign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert instance is None + + @parametrize + async def test_method_unassign_security_group_with_all_params(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.unassign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + name="some_name", + ports_security_group_names=[ + { + "port_id": None, + "security_group_names": ["some_name"], + }, + { + "port_id": "ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + "security_group_names": ["name1", "name2"], + }, + ], + ) + assert instance is None + + @parametrize + async def test_raw_response_unassign_security_group(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.instances.with_raw_response.unassign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + instance = await response.parse() + assert instance is None + + @parametrize + async def test_streaming_response_unassign_security_group(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.instances.with_streaming_response.unassign_security_group( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + instance = await response.parse() + assert instance is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_unassign_security_group(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.instances.with_raw_response.unassign_security_group( + instance_id="", + project_id=0, + region_id=0, + ) diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index e89a1d3a..a219b32d 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -122,7 +122,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: name="new_load_balancer", name_template="lb_name_template", preferred_connectivity="L2", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, vip_ip_family="dual", vip_network_id="ac307687-31a4-4a11-a949-6bea1b2878f5", vip_port_id="ff83e13a-b256-4be2-ba5d-028d3f0ab450", @@ -585,7 +585,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> name="new_load_balancer", name_template="lb_name_template", preferred_connectivity="L2", - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, vip_ip_family="dual", vip_network_id="ac307687-31a4-4a11-a949-6bea1b2878f5", vip_port_id="ff83e13a-b256-4be2-ba5d-028d3f0ab450", diff --git a/tests/api_resources/cloud/test_networks.py b/tests/api_resources/cloud/test_networks.py index 3f7b785f..5c363241 100644 --- a/tests/api_resources/cloud/test_networks.py +++ b/tests/api_resources/cloud/test_networks.py @@ -10,7 +10,10 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.cloud import Network, TaskIDList +from gcore.types.cloud import ( + Network, + TaskIDList, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -34,7 +37,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: region_id=0, name="my network", create_router=True, - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, type="vxlan", ) assert_matches_type(TaskIDList, network, path=["response"]) @@ -276,7 +279,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> region_id=0, name="my network", create_router=True, - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, type="vxlan", ) assert_matches_type(TaskIDList, network, path=["response"]) diff --git a/tests/api_resources/cloud/test_volumes.py b/tests/api_resources/cloud/test_volumes.py index 02543827..0b57fe0b 100644 --- a/tests/api_resources/cloud/test_volumes.py +++ b/tests/api_resources/cloud/test_volumes.py @@ -45,7 +45,7 @@ def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -107,7 +107,7 @@ def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], size=10, - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -166,7 +166,7 @@ def test_method_create_with_all_params_overload_3(self, client: Gcore) -> None: attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -692,7 +692,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -754,7 +754,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], size=10, - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -813,7 +813,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - tags={"my-tag": "my-tag-value"}, + tags={"foo": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) From 97a10f307fa94b43da36f874ebcbad45ddb5ab02 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 16:34:53 +0000 Subject: [PATCH 085/592] feat(api): manual upload of aggregated API specs --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 66855e16..66e0f779 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fd112571ef5f42061c9dee7ecc057c924513aa9e6b2c9e373e847b07eb19e315.yml -openapi_spec_hash: 842d806607c522f6db146861c3d2ec62 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c7b68330e1f124989668e49aa5654ecaaa21e768b4aefc2767bf3da17f819fca.yml +openapi_spec_hash: ac60218f89a231987dd9681fdfa55e35 config_hash: 6c6a10d09723b492598499f838299f17 From 181ea7bc998e3a5eaa520abeeae9249f960ecfba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 17:13:18 +0000 Subject: [PATCH 086/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../gpu_baremetal_clusters.py | 32 +--- .../cloud/gpu_baremetal_clusters/servers.py | 16 +- .../gpu_baremetal_cluster_create_params.py | 4 +- .../gpu_baremetal_cluster_resize_params.py | 4 +- .../server_delete_params.py | 4 +- .../gpu_baremetal_clusters/test_servers.py | 80 +++------ .../cloud/test_gpu_baremetal_clusters.py | 164 ++++-------------- 8 files changed, 76 insertions(+), 232 deletions(-) diff --git a/.stats.yml b/.stats.yml index 66e0f779..041d718c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c7b68330e1f124989668e49aa5654ecaaa21e768b4aefc2767bf3da17f819fca.yml -openapi_spec_hash: ac60218f89a231987dd9681fdfa55e35 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-19ba3a0329cc66d71217f40c80117d5a87da8e187a45f8f2a7ee98b61f717793.yml +openapi_spec_hash: 32cced8d6497c1c69901ee5aa4f3f653 config_hash: 6c6a10d09723b492598499f838299f17 diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index c1aeafae..91a84150 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -104,8 +104,8 @@ def with_streaming_response(self) -> GPUBaremetalClustersResourceWithStreamingRe def create( self, *, - project_id: str | None = None, - region_id: str | None = None, + project_id: int | None = None, + region_id: int | None = None, flavor: str, image_id: str, interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface], @@ -173,12 +173,8 @@ def create( """ if project_id is None: project_id = self._client._get_cloud_project_id_path_param() - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") if region_id is None: region_id = self._client._get_cloud_region_id_path_param() - if not region_id: - raise ValueError(f"Expected a non-empty value for `region_id` but received {region_id!r}") return self._post( f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}", body=maybe_transform( @@ -552,8 +548,8 @@ def resize( self, cluster_id: str, *, - project_id: str | None = None, - region_id: str | None = None, + project_id: int | None = None, + region_id: int | None = None, instances_count: 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. @@ -588,12 +584,8 @@ def resize( """ if project_id is None: project_id = self._client._get_cloud_project_id_path_param() - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") if region_id is None: region_id = self._client._get_cloud_region_id_path_param() - if not region_id: - raise ValueError(f"Expected a non-empty value for `region_id` but received {region_id!r}") if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( @@ -648,8 +640,8 @@ def with_streaming_response(self) -> AsyncGPUBaremetalClustersResourceWithStream async def create( self, *, - project_id: str | None = None, - region_id: str | None = None, + project_id: int | None = None, + region_id: int | None = None, flavor: str, image_id: str, interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface], @@ -717,12 +709,8 @@ async def create( """ if project_id is None: project_id = self._client._get_cloud_project_id_path_param() - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") if region_id is None: region_id = self._client._get_cloud_region_id_path_param() - if not region_id: - raise ValueError(f"Expected a non-empty value for `region_id` but received {region_id!r}") return await self._post( f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}", body=await async_maybe_transform( @@ -1096,8 +1084,8 @@ async def resize( self, cluster_id: str, *, - project_id: str | None = None, - region_id: str | None = None, + project_id: int | None = None, + region_id: int | None = None, instances_count: 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. @@ -1132,12 +1120,8 @@ async def resize( """ if project_id is None: project_id = self._client._get_cloud_project_id_path_param() - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") if region_id is None: region_id = self._client._get_cloud_region_id_path_param() - if not region_id: - raise ValueError(f"Expected a non-empty value for `region_id` but received {region_id!r}") if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 0c068ec1..65cee238 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -54,8 +54,8 @@ def delete( self, instance_id: str, *, - project_id: str | None = None, - region_id: str | None = None, + project_id: int | None = None, + region_id: int | None = None, cluster_id: str, delete_floatings: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -94,12 +94,8 @@ def delete( """ if project_id is None: project_id = self._client._get_cloud_project_id_path_param() - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") if region_id is None: region_id = self._client._get_cloud_region_id_path_param() - if not region_id: - raise ValueError(f"Expected a non-empty value for `region_id` but received {region_id!r}") if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") if not instance_id: @@ -654,8 +650,8 @@ async def delete( self, instance_id: str, *, - project_id: str | None = None, - region_id: str | None = None, + project_id: int | None = None, + region_id: int | None = None, cluster_id: str, delete_floatings: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -694,12 +690,8 @@ async def delete( """ if project_id is None: project_id = self._client._get_cloud_project_id_path_param() - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") if region_id is None: region_id = self._client._get_cloud_region_id_path_param() - if not region_id: - raise ValueError(f"Expected a non-empty value for `region_id` but received {region_id!r}") if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") if not instance_id: 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 6205ebd8..a034ee4c 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -32,13 +32,13 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): - project_id: str + project_id: int """ '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[0].schema" """ - region_id: str + region_id: int """ '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[1].schema" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py index 7ef5ad97..8cca0bfd 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py @@ -8,13 +8,13 @@ class GPUBaremetalClusterResizeParams(TypedDict, total=False): - project_id: str + project_id: int """ '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/0/schema' "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[0].schema" """ - region_id: str + region_id: int """ '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/1/schema' "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[1].schema" diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py index ad7acc00..188a86b7 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py @@ -8,13 +8,13 @@ class ServerDeleteParams(TypedDict, total=False): - project_id: str + project_id: int """ '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/0/schema' "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[0].schema" """ - region_id: str + region_id: int """ '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/1/schema' "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[1].schema" diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py index 8b15da66..f754ae5e 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py @@ -21,8 +21,8 @@ class TestServers: def test_method_delete(self, client: Gcore) -> None: server = client.cloud.gpu_baremetal_clusters.servers.delete( instance_id="instance_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, cluster_id="cluster_id", ) assert_matches_type(TaskIDList, server, path=["response"]) @@ -31,8 +31,8 @@ def test_method_delete(self, client: Gcore) -> None: def test_method_delete_with_all_params(self, client: Gcore) -> None: server = client.cloud.gpu_baremetal_clusters.servers.delete( instance_id="instance_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, cluster_id="cluster_id", delete_floatings=True, ) @@ -42,8 +42,8 @@ def test_method_delete_with_all_params(self, client: Gcore) -> None: def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( instance_id="instance_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, cluster_id="cluster_id", ) @@ -56,8 +56,8 @@ def test_raw_response_delete(self, client: Gcore) -> None: def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.delete( instance_id="instance_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, cluster_id="cluster_id", ) as response: assert not response.is_closed @@ -70,35 +70,19 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_path_params_delete(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( - instance_id="instance_id", - project_id="", - region_id="region_id", - cluster_id="cluster_id", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `region_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( - instance_id="instance_id", - project_id="project_id", - region_id="", - cluster_id="cluster_id", - ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( instance_id="instance_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, cluster_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( instance_id="", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, cluster_id="cluster_id", ) @@ -615,8 +599,8 @@ class TestAsyncServers: async def test_method_delete(self, async_client: AsyncGcore) -> None: server = await async_client.cloud.gpu_baremetal_clusters.servers.delete( instance_id="instance_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, cluster_id="cluster_id", ) assert_matches_type(TaskIDList, server, path=["response"]) @@ -625,8 +609,8 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: server = await async_client.cloud.gpu_baremetal_clusters.servers.delete( instance_id="instance_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, cluster_id="cluster_id", delete_floatings=True, ) @@ -636,8 +620,8 @@ async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( instance_id="instance_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, cluster_id="cluster_id", ) @@ -650,8 +634,8 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.delete( instance_id="instance_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, cluster_id="cluster_id", ) as response: assert not response.is_closed @@ -664,35 +648,19 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( - instance_id="instance_id", - project_id="", - region_id="region_id", - cluster_id="cluster_id", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `region_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( - instance_id="instance_id", - project_id="project_id", - region_id="", - cluster_id="cluster_id", - ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( instance_id="instance_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, cluster_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( instance_id="", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, cluster_id="cluster_id", ) diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index d5807da8..8f12e075 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -25,8 +25,8 @@ class TestGPUBaremetalClusters: @parametrize def test_method_create(self, client: Gcore) -> None: gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, flavor="bm3-ai-1xlarge-h100-80-8", image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", interfaces=[ @@ -43,8 +43,8 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, flavor="bm3-ai-1xlarge-h100-80-8", image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", interfaces=[ @@ -71,8 +71,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.gpu_baremetal_clusters.with_raw_response.create( - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, flavor="bm3-ai-1xlarge-h100-80-8", image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", interfaces=[ @@ -93,8 +93,8 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.gpu_baremetal_clusters.with_streaming_response.create( - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, flavor="bm3-ai-1xlarge-h100-80-8", image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", interfaces=[ @@ -114,40 +114,6 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_path_params_create(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.create( - project_id="", - region_id="region_id", - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `region_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.create( - project_id="project_id", - region_id="", - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) - @parametrize def test_method_list(self, client: Gcore) -> None: gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( @@ -454,8 +420,8 @@ def test_path_params_rebuild(self, client: Gcore) -> None: def test_method_resize(self, client: Gcore) -> None: gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.resize( cluster_id="cluster_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, instances_count=1, ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @@ -464,8 +430,8 @@ def test_method_resize(self, client: Gcore) -> None: def test_raw_response_resize(self, client: Gcore) -> None: response = client.cloud.gpu_baremetal_clusters.with_raw_response.resize( cluster_id="cluster_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, instances_count=1, ) @@ -478,8 +444,8 @@ def test_raw_response_resize(self, client: Gcore) -> None: def test_streaming_response_resize(self, client: Gcore) -> None: with client.cloud.gpu_baremetal_clusters.with_streaming_response.resize( cluster_id="cluster_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, instances_count=1, ) as response: assert not response.is_closed @@ -492,27 +458,11 @@ def test_streaming_response_resize(self, client: Gcore) -> None: @parametrize def test_path_params_resize(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.resize( - cluster_id="cluster_id", - project_id="", - region_id="region_id", - instances_count=1, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `region_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.resize( - cluster_id="cluster_id", - project_id="project_id", - region_id="", - instances_count=1, - ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): client.cloud.gpu_baremetal_clusters.with_raw_response.resize( cluster_id="", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, instances_count=1, ) @@ -523,8 +473,8 @@ class TestAsyncGPUBaremetalClusters: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, flavor="bm3-ai-1xlarge-h100-80-8", image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", interfaces=[ @@ -541,8 +491,8 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, flavor="bm3-ai-1xlarge-h100-80-8", image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", interfaces=[ @@ -569,8 +519,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.create( - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, flavor="bm3-ai-1xlarge-h100-80-8", image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", interfaces=[ @@ -591,8 +541,8 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.create( - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, flavor="bm3-ai-1xlarge-h100-80-8", image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", interfaces=[ @@ -612,40 +562,6 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True - @parametrize - async def test_path_params_create(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.create( - project_id="", - region_id="region_id", - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `region_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.create( - project_id="project_id", - region_id="", - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) - @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( @@ -952,8 +868,8 @@ async def test_path_params_rebuild(self, async_client: AsyncGcore) -> None: async def test_method_resize(self, async_client: AsyncGcore) -> None: gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.resize( cluster_id="cluster_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, instances_count=1, ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @@ -962,8 +878,8 @@ async def test_method_resize(self, async_client: AsyncGcore) -> None: async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.resize( cluster_id="cluster_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, instances_count=1, ) @@ -976,8 +892,8 @@ async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.resize( cluster_id="cluster_id", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, instances_count=1, ) as response: assert not response.is_closed @@ -990,26 +906,10 @@ async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None @parametrize async def test_path_params_resize(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.resize( - cluster_id="cluster_id", - project_id="", - region_id="region_id", - instances_count=1, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `region_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.resize( - cluster_id="cluster_id", - project_id="project_id", - region_id="", - instances_count=1, - ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): await async_client.cloud.gpu_baremetal_clusters.with_raw_response.resize( cluster_id="", - project_id="project_id", - region_id="region_id", + project_id=0, + region_id=0, instances_count=1, ) From b895b0120df6d78f772bc1d927c5137a9cfd33f1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 1 May 2025 12:08:08 +0000 Subject: [PATCH 087/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 041d718c..829f3c7f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-19ba3a0329cc66d71217f40c80117d5a87da8e187a45f8f2a7ee98b61f717793.yml -openapi_spec_hash: 32cced8d6497c1c69901ee5aa4f3f653 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6d35e219632d219cfeb0625ceeaa79647d5524235c15e123fa593fc0b0372337.yml +openapi_spec_hash: 735d770f9cbfa2956fa23609a553b0a0 config_hash: 6c6a10d09723b492598499f838299f17 From 1a20f4122c621cf3ea94a264c430c392300ccbb3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 1 May 2025 16:09:15 +0000 Subject: [PATCH 088/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 829f3c7f..327e025c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6d35e219632d219cfeb0625ceeaa79647d5524235c15e123fa593fc0b0372337.yml -openapi_spec_hash: 735d770f9cbfa2956fa23609a553b0a0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9fb6cc18f402eea43c8d77142c48ab722c8f7ff4e2ccc3b67d5c5a32a8f1fdcd.yml +openapi_spec_hash: 464640e9fd720b497b3edd34768e72bd config_hash: 6c6a10d09723b492598499f838299f17 From ea6f17822339a250b42683ab7e84631916080941 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 09:03:55 +0000 Subject: [PATCH 089/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- .../resources/cloud/baremetal/servers.py | 20 +++++++++---------- .../gpu_baremetal_clusters.py | 20 +++++++++---------- .../resources/cloud/instances/instances.py | 20 +++++++++---------- .../types/cloud/baremetal/baremetal_server.py | 12 +++++------ .../cloud/baremetal/server_create_params.py | 12 +++++------ src/gcore/types/cloud/floating_ip_detailed.py | 12 +++++------ .../types/cloud/gpu_baremetal_cluster.py | 12 +++++------ .../gpu_baremetal_cluster_create_params.py | 12 +++++------ src/gcore/types/cloud/gpu_cluster_server.py | 12 +++++------ src/gcore/types/cloud/instance.py | 12 +++++------ .../types/cloud/instance_create_params.py | 12 +++++------ .../cloud/baremetal/test_servers.py | 4 ++-- .../cloud/test_gpu_baremetal_clusters.py | 4 ++-- tests/api_resources/cloud/test_instances.py | 4 ++-- 15 files changed, 86 insertions(+), 86 deletions(-) diff --git a/.stats.yml b/.stats.yml index 327e025c..ad0a5133 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9fb6cc18f402eea43c8d77142c48ab722c8f7ff4e2ccc3b67d5c5a32a8f1fdcd.yml -openapi_spec_hash: 464640e9fd720b497b3edd34768e72bd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-506b88d8207b6721e83a9b8e91ce33e143b3fbe83055e4e8cc276c98ffd0ac20.yml +openapi_spec_hash: 5909b18d3de69bcd21c1a4965e643d7f config_hash: 6c6a10d09723b492598499f838299f17 diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index e4137a5e..9b57577b 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -59,10 +59,10 @@ def create( apptemplate_id: str | NotGiven = NOT_GIVEN, ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, image_id: str | NotGiven = NOT_GIVEN, - keypair_name: Optional[str] | NotGiven = NOT_GIVEN, name_templates: List[str] | NotGiven = NOT_GIVEN, names: List[str] | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, + ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, tags: TagUpdateListParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, @@ -101,9 +101,6 @@ def create( image_id: '#/components/schemas/CreateBareMetalServerSerializer/properties/image_id' "$.components.schemas.CreateBareMetalServerSerializer.properties.image_id" - keypair_name: '#/components/schemas/CreateBareMetalServerSerializer/properties/keypair_name/anyOf/0' - "$.components.schemas.CreateBareMetalServerSerializer.properties.keypair_name.anyOf[0]" - name_templates: '#/components/schemas/CreateBareMetalServerSerializer/properties/name_templates' "$.components.schemas.CreateBareMetalServerSerializer.properties.name_templates" @@ -113,6 +110,9 @@ def create( password: '#/components/schemas/CreateBareMetalServerSerializer/properties/password' "$.components.schemas.CreateBareMetalServerSerializer.properties.password" + ssh_key_name: '#/components/schemas/CreateBareMetalServerSerializer/properties/ssh_key_name/anyOf/0' + "$.components.schemas.CreateBareMetalServerSerializer.properties.ssh_key_name.anyOf[0]" + tags: '#/components/schemas/CreateBareMetalServerSerializer/properties/tags' "$.components.schemas.CreateBareMetalServerSerializer.properties.tags" @@ -144,10 +144,10 @@ def create( "apptemplate_id": apptemplate_id, "ddos_profile": ddos_profile, "image_id": image_id, - "keypair_name": keypair_name, "name_templates": name_templates, "names": names, "password": password, + "ssh_key_name": ssh_key_name, "tags": tags, "user_data": user_data, "username": username, @@ -415,10 +415,10 @@ async def create( apptemplate_id: str | NotGiven = NOT_GIVEN, ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, image_id: str | NotGiven = NOT_GIVEN, - keypair_name: Optional[str] | NotGiven = NOT_GIVEN, name_templates: List[str] | NotGiven = NOT_GIVEN, names: List[str] | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, + ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, tags: TagUpdateListParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, @@ -457,9 +457,6 @@ async def create( image_id: '#/components/schemas/CreateBareMetalServerSerializer/properties/image_id' "$.components.schemas.CreateBareMetalServerSerializer.properties.image_id" - keypair_name: '#/components/schemas/CreateBareMetalServerSerializer/properties/keypair_name/anyOf/0' - "$.components.schemas.CreateBareMetalServerSerializer.properties.keypair_name.anyOf[0]" - name_templates: '#/components/schemas/CreateBareMetalServerSerializer/properties/name_templates' "$.components.schemas.CreateBareMetalServerSerializer.properties.name_templates" @@ -469,6 +466,9 @@ async def create( password: '#/components/schemas/CreateBareMetalServerSerializer/properties/password' "$.components.schemas.CreateBareMetalServerSerializer.properties.password" + ssh_key_name: '#/components/schemas/CreateBareMetalServerSerializer/properties/ssh_key_name/anyOf/0' + "$.components.schemas.CreateBareMetalServerSerializer.properties.ssh_key_name.anyOf[0]" + tags: '#/components/schemas/CreateBareMetalServerSerializer/properties/tags' "$.components.schemas.CreateBareMetalServerSerializer.properties.tags" @@ -500,10 +500,10 @@ async def create( "apptemplate_id": apptemplate_id, "ddos_profile": ddos_profile, "image_id": image_id, - "keypair_name": keypair_name, "name_templates": name_templates, "names": names, "password": password, + "ssh_key_name": ssh_key_name, "tags": tags, "user_data": user_data, "username": username, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 91a84150..49023a71 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -111,8 +111,8 @@ def create( interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface], name: str, instances_count: int | NotGiven = NOT_GIVEN, - keypair_name: str | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, + ssh_key_name: str | NotGiven = NOT_GIVEN, tags: TagUpdateListParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, @@ -148,12 +148,12 @@ def create( instances_count: '#/components/schemas/CreateAIClusterGPUSerializer/properties/instances_count' "$.components.schemas.CreateAIClusterGPUSerializer.properties.instances_count" - keypair_name: '#/components/schemas/CreateAIClusterGPUSerializer/properties/keypair_name' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.keypair_name" - password: '#/components/schemas/CreateAIClusterGPUSerializer/properties/password' "$.components.schemas.CreateAIClusterGPUSerializer.properties.password" + ssh_key_name: '#/components/schemas/CreateAIClusterGPUSerializer/properties/ssh_key_name' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.ssh_key_name" + tags: '#/components/schemas/CreateAIClusterGPUSerializer/properties/tags' "$.components.schemas.CreateAIClusterGPUSerializer.properties.tags" @@ -184,8 +184,8 @@ def create( "interfaces": interfaces, "name": name, "instances_count": instances_count, - "keypair_name": keypair_name, "password": password, + "ssh_key_name": ssh_key_name, "tags": tags, "user_data": user_data, "username": username, @@ -647,8 +647,8 @@ async def create( interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface], name: str, instances_count: int | NotGiven = NOT_GIVEN, - keypair_name: str | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, + ssh_key_name: str | NotGiven = NOT_GIVEN, tags: TagUpdateListParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, @@ -684,12 +684,12 @@ async def create( instances_count: '#/components/schemas/CreateAIClusterGPUSerializer/properties/instances_count' "$.components.schemas.CreateAIClusterGPUSerializer.properties.instances_count" - keypair_name: '#/components/schemas/CreateAIClusterGPUSerializer/properties/keypair_name' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.keypair_name" - password: '#/components/schemas/CreateAIClusterGPUSerializer/properties/password' "$.components.schemas.CreateAIClusterGPUSerializer.properties.password" + ssh_key_name: '#/components/schemas/CreateAIClusterGPUSerializer/properties/ssh_key_name' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.ssh_key_name" + tags: '#/components/schemas/CreateAIClusterGPUSerializer/properties/tags' "$.components.schemas.CreateAIClusterGPUSerializer.properties.tags" @@ -720,8 +720,8 @@ async def create( "interfaces": interfaces, "name": name, "instances_count": instances_count, - "keypair_name": keypair_name, "password": password, + "ssh_key_name": ssh_key_name, "tags": tags, "user_data": user_data, "username": username, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 96487435..06a36920 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -119,12 +119,12 @@ def create( volumes: Iterable[instance_create_params.Volume], allow_app_ports: bool | NotGiven = NOT_GIVEN, configuration: Optional[object] | NotGiven = NOT_GIVEN, - keypair_name: Optional[str] | NotGiven = NOT_GIVEN, name_templates: List[str] | NotGiven = NOT_GIVEN, names: List[str] | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, servergroup_id: str | NotGiven = NOT_GIVEN, + ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, tags: TagUpdateListParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, @@ -170,9 +170,6 @@ def create( configuration: '#/components/schemas/CreateInstanceSerializerV2/properties/configuration/anyOf/0' "$.components.schemas.CreateInstanceSerializerV2.properties.configuration.anyOf[0]" - keypair_name: '#/components/schemas/CreateInstanceSerializerV2/properties/keypair_name/anyOf/0' - "$.components.schemas.CreateInstanceSerializerV2.properties.keypair_name.anyOf[0]" - name_templates: '#/components/schemas/CreateInstanceSerializerV2/properties/name_templates' "$.components.schemas.CreateInstanceSerializerV2.properties.name_templates" @@ -188,6 +185,9 @@ def create( servergroup_id: '#/components/schemas/CreateInstanceSerializerV2/properties/servergroup_id' "$.components.schemas.CreateInstanceSerializerV2.properties.servergroup_id" + ssh_key_name: '#/components/schemas/CreateInstanceSerializerV2/properties/ssh_key_name/anyOf/0' + "$.components.schemas.CreateInstanceSerializerV2.properties.ssh_key_name.anyOf[0]" + tags: '#/components/schemas/CreateInstanceSerializerV2/properties/tags' "$.components.schemas.CreateInstanceSerializerV2.properties.tags" @@ -218,12 +218,12 @@ def create( "volumes": volumes, "allow_app_ports": allow_app_ports, "configuration": configuration, - "keypair_name": keypair_name, "name_templates": name_templates, "names": names, "password": password, "security_groups": security_groups, "servergroup_id": servergroup_id, + "ssh_key_name": ssh_key_name, "tags": tags, "user_data": user_data, "username": username, @@ -1235,12 +1235,12 @@ async def create( volumes: Iterable[instance_create_params.Volume], allow_app_ports: bool | NotGiven = NOT_GIVEN, configuration: Optional[object] | NotGiven = NOT_GIVEN, - keypair_name: Optional[str] | NotGiven = NOT_GIVEN, name_templates: List[str] | NotGiven = NOT_GIVEN, names: List[str] | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, servergroup_id: str | NotGiven = NOT_GIVEN, + ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, tags: TagUpdateListParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, @@ -1286,9 +1286,6 @@ async def create( configuration: '#/components/schemas/CreateInstanceSerializerV2/properties/configuration/anyOf/0' "$.components.schemas.CreateInstanceSerializerV2.properties.configuration.anyOf[0]" - keypair_name: '#/components/schemas/CreateInstanceSerializerV2/properties/keypair_name/anyOf/0' - "$.components.schemas.CreateInstanceSerializerV2.properties.keypair_name.anyOf[0]" - name_templates: '#/components/schemas/CreateInstanceSerializerV2/properties/name_templates' "$.components.schemas.CreateInstanceSerializerV2.properties.name_templates" @@ -1304,6 +1301,9 @@ async def create( servergroup_id: '#/components/schemas/CreateInstanceSerializerV2/properties/servergroup_id' "$.components.schemas.CreateInstanceSerializerV2.properties.servergroup_id" + ssh_key_name: '#/components/schemas/CreateInstanceSerializerV2/properties/ssh_key_name/anyOf/0' + "$.components.schemas.CreateInstanceSerializerV2.properties.ssh_key_name.anyOf[0]" + tags: '#/components/schemas/CreateInstanceSerializerV2/properties/tags' "$.components.schemas.CreateInstanceSerializerV2.properties.tags" @@ -1334,12 +1334,12 @@ async def create( "volumes": volumes, "allow_app_ports": allow_app_ports, "configuration": configuration, - "keypair_name": keypair_name, "name_templates": name_templates, "names": names, "password": password, "security_groups": security_groups, "servergroup_id": servergroup_id, + "ssh_key_name": ssh_key_name, "tags": tags, "user_data": user_data, "username": username, diff --git a/src/gcore/types/cloud/baremetal/baremetal_server.py b/src/gcore/types/cloud/baremetal/baremetal_server.py index 13055ebf..7cd310bd 100644 --- a/src/gcore/types/cloud/baremetal/baremetal_server.py +++ b/src/gcore/types/cloud/baremetal/baremetal_server.py @@ -324,12 +324,6 @@ class BaremetalServer(BaseModel): "$.components.schemas.BareMetalServerSerializer.properties.instance_name" """ - keypair_name: Optional[str] = None - """ - '#/components/schemas/BareMetalServerSerializer/properties/keypair_name/anyOf/0' - "$.components.schemas.BareMetalServerSerializer.properties.keypair_name.anyOf[0]" - """ - project_id: int """ '#/components/schemas/BareMetalServerSerializer/properties/project_id' @@ -348,6 +342,12 @@ class BaremetalServer(BaseModel): "$.components.schemas.BareMetalServerSerializer.properties.region_id" """ + ssh_key_name: Optional[str] = None + """ + '#/components/schemas/BareMetalServerSerializer/properties/ssh_key_name/anyOf/0' + "$.components.schemas.BareMetalServerSerializer.properties.ssh_key_name.anyOf[0]" + """ + status: Literal[ "ACTIVE", "BUILD", diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index 9eef4724..5bdb11b9 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -78,12 +78,6 @@ class ServerCreateParams(TypedDict, total=False): "$.components.schemas.CreateBareMetalServerSerializer.properties.image_id" """ - keypair_name: Optional[str] - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/keypair_name/anyOf/0' - "$.components.schemas.CreateBareMetalServerSerializer.properties.keypair_name.anyOf[0]" - """ - name_templates: List[str] """ '#/components/schemas/CreateBareMetalServerSerializer/properties/name_templates' @@ -102,6 +96,12 @@ class ServerCreateParams(TypedDict, total=False): "$.components.schemas.CreateBareMetalServerSerializer.properties.password" """ + ssh_key_name: Optional[str] + """ + '#/components/schemas/CreateBareMetalServerSerializer/properties/ssh_key_name/anyOf/0' + "$.components.schemas.CreateBareMetalServerSerializer.properties.ssh_key_name.anyOf[0]" + """ + tags: TagUpdateListParam """ '#/components/schemas/CreateBareMetalServerSerializer/properties/tags' diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index 6f3a8386..da67335c 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -186,12 +186,6 @@ class Instance(BaseModel): "$.components.schemas.InstanceInFloatingSerializer.properties.instance_name" """ - keypair_name: Optional[str] = None - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/keypair_name/anyOf/0' - "$.components.schemas.InstanceInFloatingSerializer.properties.keypair_name.anyOf[0]" - """ - project_id: int """ '#/components/schemas/InstanceInFloatingSerializer/properties/project_id' @@ -216,6 +210,12 @@ class Instance(BaseModel): "$.components.schemas.InstanceInFloatingSerializer.properties.security_groups" """ + ssh_key_name: Optional[str] = None + """ + '#/components/schemas/InstanceInFloatingSerializer/properties/ssh_key_name/anyOf/0' + "$.components.schemas.InstanceInFloatingSerializer.properties.ssh_key_name.anyOf[0]" + """ + status: Literal[ "ACTIVE", "BUILD", diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal_cluster.py index 68fd6500..58de4247 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster.py @@ -91,12 +91,6 @@ class GPUBaremetalCluster(BaseModel): "$.components.schemas.AIClusterSerializer.properties.interfaces.anyOf[0]" """ - keypair_name: Optional[str] = None - """ - '#/components/schemas/AIClusterSerializer/properties/keypair_name/anyOf/0' - "$.components.schemas.AIClusterSerializer.properties.keypair_name.anyOf[0]" - """ - password: Optional[str] = None """ '#/components/schemas/AIClusterSerializer/properties/password/anyOf/0' @@ -127,6 +121,12 @@ class GPUBaremetalCluster(BaseModel): "$.components.schemas.AIClusterSerializer.properties.servers" """ + ssh_key_name: Optional[str] = None + """ + '#/components/schemas/AIClusterSerializer/properties/ssh_key_name/anyOf/0' + "$.components.schemas.AIClusterSerializer.properties.ssh_key_name.anyOf[0]" + """ + tags: List[Tag] """ '#/components/schemas/AIClusterSerializer/properties/tags' 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 a034ee4c..a3e96053 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -74,18 +74,18 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): "$.components.schemas.CreateAIClusterGPUSerializer.properties.instances_count" """ - keypair_name: str - """ - '#/components/schemas/CreateAIClusterGPUSerializer/properties/keypair_name' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.keypair_name" - """ - password: str """ '#/components/schemas/CreateAIClusterGPUSerializer/properties/password' "$.components.schemas.CreateAIClusterGPUSerializer.properties.password" """ + ssh_key_name: str + """ + '#/components/schemas/CreateAIClusterGPUSerializer/properties/ssh_key_name' + "$.components.schemas.CreateAIClusterGPUSerializer.properties.ssh_key_name" + """ + tags: TagUpdateListParam """ '#/components/schemas/CreateAIClusterGPUSerializer/properties/tags' diff --git a/src/gcore/types/cloud/gpu_cluster_server.py b/src/gcore/types/cloud/gpu_cluster_server.py index 4a428243..3a3fdefc 100644 --- a/src/gcore/types/cloud/gpu_cluster_server.py +++ b/src/gcore/types/cloud/gpu_cluster_server.py @@ -364,12 +364,6 @@ class GPUClusterServer(BaseModel): "$.components.schemas.GPUClusterServerSerializer.properties.instance_name" """ - keypair_name: Optional[str] = None - """ - '#/components/schemas/GPUClusterServerSerializer/properties/keypair_name/anyOf/0' - "$.components.schemas.GPUClusterServerSerializer.properties.keypair_name.anyOf[0]" - """ - project_id: int """ '#/components/schemas/GPUClusterServerSerializer/properties/project_id' @@ -394,6 +388,12 @@ class GPUClusterServer(BaseModel): "$.components.schemas.GPUClusterServerSerializer.properties.security_groups" """ + ssh_key_name: Optional[str] = None + """ + '#/components/schemas/GPUClusterServerSerializer/properties/ssh_key_name/anyOf/0' + "$.components.schemas.GPUClusterServerSerializer.properties.ssh_key_name.anyOf[0]" + """ + status: Literal[ "ACTIVE", "BUILD", diff --git a/src/gcore/types/cloud/instance.py b/src/gcore/types/cloud/instance.py index f88d0aff..3a4f42ba 100644 --- a/src/gcore/types/cloud/instance.py +++ b/src/gcore/types/cloud/instance.py @@ -529,12 +529,6 @@ class Instance(BaseModel): "$.components.schemas.InstanceSerializer.properties.instance_name" """ - keypair_name: Optional[str] = None - """ - '#/components/schemas/InstanceSerializer/properties/keypair_name/anyOf/0' - "$.components.schemas.InstanceSerializer.properties.keypair_name.anyOf[0]" - """ - project_id: int """ '#/components/schemas/InstanceSerializer/properties/project_id' @@ -559,6 +553,12 @@ class Instance(BaseModel): "$.components.schemas.InstanceSerializer.properties.security_groups" """ + ssh_key_name: Optional[str] = None + """ + '#/components/schemas/InstanceSerializer/properties/ssh_key_name/anyOf/0' + "$.components.schemas.InstanceSerializer.properties.ssh_key_name.anyOf[0]" + """ + status: Literal[ "ACTIVE", "BUILD", diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index d4058ff3..b4ef3ee2 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -76,12 +76,6 @@ class InstanceCreateParams(TypedDict, total=False): "$.components.schemas.CreateInstanceSerializerV2.properties.configuration.anyOf[0]" """ - keypair_name: Optional[str] - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/keypair_name/anyOf/0' - "$.components.schemas.CreateInstanceSerializerV2.properties.keypair_name.anyOf[0]" - """ - name_templates: List[str] """ '#/components/schemas/CreateInstanceSerializerV2/properties/name_templates' @@ -112,6 +106,12 @@ class InstanceCreateParams(TypedDict, total=False): "$.components.schemas.CreateInstanceSerializerV2.properties.servergroup_id" """ + ssh_key_name: Optional[str] + """ + '#/components/schemas/CreateInstanceSerializerV2/properties/ssh_key_name/anyOf/0' + "$.components.schemas.CreateInstanceSerializerV2.properties.ssh_key_name.anyOf[0]" + """ + tags: TagUpdateListParam """ '#/components/schemas/CreateInstanceSerializerV2/properties/tags' diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index fd8d2e62..f94270ee 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -59,10 +59,10 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "profile_template_name": "profile_template_name", }, image_id="image_id", - keypair_name="my-keypair", name_templates=["my-bare-metal-{ip_octets}"], names=["my-bare-metal"], password="password", + ssh_key_name="my-ssh-key", tags={"foo": "my-tag-value"}, user_data="user_data", username="username", @@ -262,10 +262,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "profile_template_name": "profile_template_name", }, image_id="image_id", - keypair_name="my-keypair", name_templates=["my-bare-metal-{ip_octets}"], names=["my-bare-metal"], password="password", + ssh_key_name="my-ssh-key", tags={"foo": "my-tag-value"}, user_data="user_data", username="username", diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index 8f12e075..990299b0 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -60,8 +60,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: ], name="my-gpu-cluster", instances_count=1, - keypair_name="my-keypair", password="password", + ssh_key_name="my-ssh-key", tags={"foo": "my-tag-value"}, user_data="user_data", username="username", @@ -508,8 +508,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> ], name="my-gpu-cluster", instances_count=1, - keypair_name="my-keypair", password="password", + ssh_key_name="my-ssh-key", tags={"foo": "my-tag-value"}, user_data="user_data", username="username", diff --git a/tests/api_resources/cloud/test_instances.py b/tests/api_resources/cloud/test_instances.py index d7258230..ecd2a577 100644 --- a/tests/api_resources/cloud/test_instances.py +++ b/tests/api_resources/cloud/test_instances.py @@ -68,12 +68,12 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: ], allow_app_ports=True, configuration={}, - keypair_name="my-keypair", name_templates=["my-instance-{ip_octets}"], names=["my-instance"], password="password", security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], servergroup_id="servergroup_id", + ssh_key_name="my-ssh-key", tags={"foo": "my-tag-value"}, user_data="user_data", username="username", @@ -920,12 +920,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> ], allow_app_ports=True, configuration={}, - keypair_name="my-keypair", name_templates=["my-instance-{ip_octets}"], names=["my-instance"], password="password", security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], servergroup_id="servergroup_id", + ssh_key_name="my-ssh-key", tags={"foo": "my-tag-value"}, user_data="user_data", username="username", From 936ff1f4abb08653005be1686eb2b4c42ecc5413 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 12:16:47 +0000 Subject: [PATCH 090/592] Multiple fixes in the stainless config --- .stats.yml | 2 +- api.md | 23 ++-- .../resources/cloud/baremetal/flavors.py | 19 ++- src/gcore/types/cloud/__init__.py | 6 + src/gcore/types/cloud/baremetal/__init__.py | 4 +- .../baremetal/baremetal_fixed_address.py | 40 ++++++ .../baremetal/baremetal_floating_address.py | 21 ++++ .../types/cloud/baremetal/baremetal_server.py | 53 +------- .../flavor_list_suitable_response.py | 114 ------------------ ...r_list_response.py => baremetal_flavor.py} | 22 +--- .../types/cloud/baremetal_flavor_list.py | 22 ++++ src/gcore/types/cloud/fixed_address.py | 40 ++++++ src/gcore/types/cloud/fixed_address_short.py | 28 +++++ src/gcore/types/cloud/floating_address.py | 21 ++++ src/gcore/types/cloud/floating_ip_detailed.py | 79 +----------- src/gcore/types/cloud/gpu_cluster_server.py | 79 +----------- src/gcore/types/cloud/instance.py | 79 +----------- src/gcore/types/cloud/networks/router.py | 24 +--- src/gcore/types/cloud/route.py | 19 +++ src/gcore/types/cloud/subnet.py | 19 +-- .../cloud/baremetal/test_flavors.py | 37 +++--- 21 files changed, 263 insertions(+), 488 deletions(-) create mode 100644 src/gcore/types/cloud/baremetal/baremetal_fixed_address.py create mode 100644 src/gcore/types/cloud/baremetal/baremetal_floating_address.py delete mode 100644 src/gcore/types/cloud/baremetal/flavor_list_suitable_response.py rename src/gcore/types/cloud/{baremetal/flavor_list_response.py => baremetal_flavor.py} (85%) create mode 100644 src/gcore/types/cloud/baremetal_flavor_list.py create mode 100644 src/gcore/types/cloud/fixed_address.py create mode 100644 src/gcore/types/cloud/fixed_address_short.py create mode 100644 src/gcore/types/cloud/floating_address.py create mode 100644 src/gcore/types/cloud/route.py diff --git a/.stats.yml b/.stats.yml index ad0a5133..40f0629d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-506b88d8207b6721e83a9b8e91ce33e143b3fbe83055e4e8cc276c98ffd0ac20.yml openapi_spec_hash: 5909b18d3de69bcd21c1a4965e643d7f -config_hash: 6c6a10d09723b492598499f838299f17 +config_hash: ec989e8f0c07fb133876737d22adda5f diff --git a/api.md b/api.md index 16116fc1..72970ea2 100644 --- a/api.md +++ b/api.md @@ -4,6 +4,8 @@ Types: ```python from gcore.types.cloud import ( + BaremetalFlavor, + BaremetalFlavorList, Console, DDOSProfile, DDOSProfileField, @@ -11,7 +13,10 @@ from gcore.types.cloud import ( DDOSProfileStatus, DDOSProfileTemplate, DDOSProfileTemplateField, + FixedAddress, + FixedAddressShort, FlavorHardwareDescription, + FloatingAddress, FloatingIP, FloatingIPStatus, GPUClusterServer, @@ -36,7 +41,7 @@ from gcore.types.cloud import ( NetworkInterfaceList, NetworkSubnetFip, ProvisioningStatus, - RemoteConsole, + Route, Subnet, Tag, TagList, @@ -577,23 +582,21 @@ Methods: ### Flavors -Types: - -```python -from gcore.types.cloud.baremetal import FlavorListResponse, FlavorListSuitableResponse -``` - Methods: -- client.cloud.baremetal.flavors.list(\*, project_id, region_id, \*\*params) -> FlavorListResponse -- client.cloud.baremetal.flavors.list_suitable(\*, project_id, region_id, \*\*params) -> FlavorListSuitableResponse +- client.cloud.baremetal.flavors.list(\*, project_id, region_id, \*\*params) -> BaremetalFlavorList +- client.cloud.baremetal.flavors.list_suitable(\*, project_id, region_id, \*\*params) -> BaremetalFlavorList ### Servers Types: ```python -from gcore.types.cloud.baremetal import BaremetalServer +from gcore.types.cloud.baremetal import ( + BaremetalFixedAddress, + BaremetalFloatingAddress, + BaremetalServer, +) ``` Methods: diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index d0178dc1..dca4648b 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -16,8 +16,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.baremetal import flavor_list_params, flavor_list_suitable_params -from ....types.cloud.baremetal.flavor_list_response import FlavorListResponse -from ....types.cloud.baremetal.flavor_list_suitable_response import FlavorListSuitableResponse +from ....types.cloud.baremetal_flavor_list import BaremetalFlavorList __all__ = ["FlavorsResource", "AsyncFlavorsResource"] @@ -59,7 +58,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FlavorListResponse: + ) -> BaremetalFlavorList: """Retrieve a list of flavors. When the include_prices query parameter is @@ -122,7 +121,7 @@ def list( flavor_list_params.FlavorListParams, ), ), - cast_to=FlavorListResponse, + cast_to=BaremetalFlavorList, ) def list_suitable( @@ -139,7 +138,7 @@ def list_suitable( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FlavorListSuitableResponse: + ) -> BaremetalFlavorList: """ List suitalbe flavors for bare metal server creation @@ -189,7 +188,7 @@ def list_suitable( {"include_prices": include_prices}, flavor_list_suitable_params.FlavorListSuitableParams ), ), - cast_to=FlavorListSuitableResponse, + cast_to=BaremetalFlavorList, ) @@ -230,7 +229,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FlavorListResponse: + ) -> BaremetalFlavorList: """Retrieve a list of flavors. When the include_prices query parameter is @@ -293,7 +292,7 @@ async def list( flavor_list_params.FlavorListParams, ), ), - cast_to=FlavorListResponse, + cast_to=BaremetalFlavorList, ) async def list_suitable( @@ -310,7 +309,7 @@ async def list_suitable( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FlavorListSuitableResponse: + ) -> BaremetalFlavorList: """ List suitalbe flavors for bare metal server creation @@ -360,7 +359,7 @@ async def list_suitable( {"include_prices": include_prices}, flavor_list_suitable_params.FlavorListSuitableParams ), ), - cast_to=FlavorListSuitableResponse, + cast_to=BaremetalFlavorList, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index bb4c46e3..c3cd8b8f 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -5,6 +5,7 @@ from .tag import Tag as Tag from .task import Task as Task from .image import Image as Image +from .route import Route as Route from .region import Region as Region from .secret import Secret as Secret from .subnet import Subnet as Subnet @@ -35,6 +36,7 @@ from .registry_tag import RegistryTag as RegistryTag from .task_id_list import TaskIDList as TaskIDList from .deploy_status import DeployStatus as DeployStatus +from .fixed_address import FixedAddress as FixedAddress from .instance_list import InstanceList as InstanceList from .load_balancer import LoadBalancer as LoadBalancer from .member_status import MemberStatus as MemberStatus @@ -49,7 +51,9 @@ from .placement_group import PlacementGroup as PlacementGroup from .region_capacity import RegionCapacity as RegionCapacity from .ssh_key_created import SSHKeyCreated as SSHKeyCreated +from .baremetal_flavor import BaremetalFlavor as BaremetalFlavor from .detailed_lb_pool import DetailedLbPool as DetailedLbPool +from .floating_address import FloatingAddress as FloatingAddress from .inference_probes import InferenceProbes as InferenceProbes from .ingress_opts_out import IngressOptsOut as IngressOptsOut from .lb_listener_list import LbListenerList as LbListenerList @@ -68,6 +72,7 @@ from .volume_list_params import VolumeListParams as VolumeListParams from .billing_reservation import BillingReservation as BillingReservation from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus +from .fixed_address_short import FixedAddressShort as FixedAddressShort from .health_monitor_type import HealthMonitorType as HealthMonitorType from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .network_list_params import NetworkListParams as NetworkListParams @@ -90,6 +95,7 @@ from .volume_delete_params import VolumeDeleteParams as VolumeDeleteParams from .volume_resize_params import VolumeResizeParams as VolumeResizeParams from .volume_update_params import VolumeUpdateParams as VolumeUpdateParams +from .baremetal_flavor_list import BaremetalFlavorList as BaremetalFlavorList from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate from .detailed_lb_pool_list import DetailedLbPoolList as DetailedLbPoolList from .gpu_baremetal_cluster import GPUBaremetalCluster as GPUBaremetalCluster diff --git a/src/gcore/types/cloud/baremetal/__init__.py b/src/gcore/types/cloud/baremetal/__init__.py index fa9f1b7f..7cdfa810 100644 --- a/src/gcore/types/cloud/baremetal/__init__.py +++ b/src/gcore/types/cloud/baremetal/__init__.py @@ -6,8 +6,8 @@ from .image_list_params import ImageListParams as ImageListParams from .flavor_list_params import FlavorListParams as FlavorListParams from .server_list_params import ServerListParams as ServerListParams -from .flavor_list_response import FlavorListResponse as FlavorListResponse from .server_create_params import ServerCreateParams as ServerCreateParams from .server_rebuild_params import ServerRebuildParams as ServerRebuildParams +from .baremetal_fixed_address import BaremetalFixedAddress as BaremetalFixedAddress +from .baremetal_floating_address import BaremetalFloatingAddress as BaremetalFloatingAddress from .flavor_list_suitable_params import FlavorListSuitableParams as FlavorListSuitableParams -from .flavor_list_suitable_response import FlavorListSuitableResponse as FlavorListSuitableResponse diff --git a/src/gcore/types/cloud/baremetal/baremetal_fixed_address.py b/src/gcore/types/cloud/baremetal/baremetal_fixed_address.py new file mode 100644 index 00000000..facb77ab --- /dev/null +++ b/src/gcore/types/cloud/baremetal/baremetal_fixed_address.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["BaremetalFixedAddress"] + + +class BaremetalFixedAddress(BaseModel): + addr: str + """ + '#/components/schemas/BareMetalFixedAddressSerializer/properties/addr' + "$.components.schemas.BareMetalFixedAddressSerializer.properties.addr" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/BareMetalFixedAddressSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.BareMetalFixedAddressSerializer.properties.interface_name.anyOf[0]" + """ + + subnet_id: str + """ + '#/components/schemas/BareMetalFixedAddressSerializer/properties/subnet_id' + "$.components.schemas.BareMetalFixedAddressSerializer.properties.subnet_id" + """ + + subnet_name: str + """ + '#/components/schemas/BareMetalFixedAddressSerializer/properties/subnet_name' + "$.components.schemas.BareMetalFixedAddressSerializer.properties.subnet_name" + """ + + type: Literal["fixed"] + """ + '#/components/schemas/BareMetalFixedAddressSerializer/properties/type' + "$.components.schemas.BareMetalFixedAddressSerializer.properties.type" + """ diff --git a/src/gcore/types/cloud/baremetal/baremetal_floating_address.py b/src/gcore/types/cloud/baremetal/baremetal_floating_address.py new file mode 100644 index 00000000..8ee97043 --- /dev/null +++ b/src/gcore/types/cloud/baremetal/baremetal_floating_address.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["BaremetalFloatingAddress"] + + +class BaremetalFloatingAddress(BaseModel): + addr: str + """ + '#/components/schemas/BareMetalFloatingAddressSerializer/properties/addr' + "$.components.schemas.BareMetalFloatingAddressSerializer.properties.addr" + """ + + type: Literal["floating"] + """ + '#/components/schemas/BareMetalFloatingAddressSerializer/properties/type' + "$.components.schemas.BareMetalFloatingAddressSerializer.properties.type" + """ diff --git a/src/gcore/types/cloud/baremetal/baremetal_server.py b/src/gcore/types/cloud/baremetal/baremetal_server.py index 7cd310bd..e0d48f6e 100644 --- a/src/gcore/types/cloud/baremetal/baremetal_server.py +++ b/src/gcore/types/cloud/baremetal/baremetal_server.py @@ -9,12 +9,12 @@ from ..tag import Tag from ...._models import BaseModel from ..ddos_profile import DDOSProfile +from .baremetal_fixed_address import BaremetalFixedAddress +from .baremetal_floating_address import BaremetalFloatingAddress __all__ = [ "BaremetalServer", "Address", - "AddressBareMetalFloatingAddressSerializer", - "AddressBareMetalFixedAddressSerializer", "BlackholePort", "FixedIPAssignment", "Flavor", @@ -22,54 +22,7 @@ "InstanceIsolation", ] - -class AddressBareMetalFloatingAddressSerializer(BaseModel): - addr: str - """ - '#/components/schemas/BareMetalFloatingAddressSerializer/properties/addr' - "$.components.schemas.BareMetalFloatingAddressSerializer.properties.addr" - """ - - type: Literal["floating"] - """ - '#/components/schemas/BareMetalFloatingAddressSerializer/properties/type' - "$.components.schemas.BareMetalFloatingAddressSerializer.properties.type" - """ - - -class AddressBareMetalFixedAddressSerializer(BaseModel): - addr: str - """ - '#/components/schemas/BareMetalFixedAddressSerializer/properties/addr' - "$.components.schemas.BareMetalFixedAddressSerializer.properties.addr" - """ - - interface_name: Optional[str] = None - """ - '#/components/schemas/BareMetalFixedAddressSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.BareMetalFixedAddressSerializer.properties.interface_name.anyOf[0]" - """ - - subnet_id: str - """ - '#/components/schemas/BareMetalFixedAddressSerializer/properties/subnet_id' - "$.components.schemas.BareMetalFixedAddressSerializer.properties.subnet_id" - """ - - subnet_name: str - """ - '#/components/schemas/BareMetalFixedAddressSerializer/properties/subnet_name' - "$.components.schemas.BareMetalFixedAddressSerializer.properties.subnet_name" - """ - - type: Literal["fixed"] - """ - '#/components/schemas/BareMetalFixedAddressSerializer/properties/type' - "$.components.schemas.BareMetalFixedAddressSerializer.properties.type" - """ - - -Address: TypeAlias = Union[AddressBareMetalFloatingAddressSerializer, AddressBareMetalFixedAddressSerializer] +Address: TypeAlias = Union[BaremetalFloatingAddress, BaremetalFixedAddress] class BlackholePort(BaseModel): diff --git a/src/gcore/types/cloud/baremetal/flavor_list_suitable_response.py b/src/gcore/types/cloud/baremetal/flavor_list_suitable_response.py deleted file mode 100644 index dfdfa85a..00000000 --- a/src/gcore/types/cloud/baremetal/flavor_list_suitable_response.py +++ /dev/null @@ -1,114 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["FlavorListSuitableResponse", "Result"] - - -class Result(BaseModel): - architecture: str - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/architecture' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.architecture" - """ - - disabled: bool - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/disabled' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.disabled" - """ - - flavor_id: str - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/flavor_id' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.flavor_id" - """ - - flavor_name: str - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/flavor_name' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.flavor_name" - """ - - os_type: str - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/os_type' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.os_type" - """ - - ram: int - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/ram' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.ram" - """ - - resource_class: Optional[str] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/resource_class/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.resource_class.anyOf[0]" - """ - - vcpus: int - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/vcpus' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.vcpus" - """ - - capacity: Optional[int] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/capacity/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.capacity.anyOf[0]" - """ - - currency_code: Optional[str] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/currency_code/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.currency_code.anyOf[0]" - """ - - hardware_description: Optional[Dict[str, str]] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/hardware_description' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.hardware_description" - """ - - price_per_hour: Optional[float] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/price_per_hour/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.price_per_hour.anyOf[0]" - """ - - price_per_month: Optional[float] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/price_per_month/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.price_per_month.anyOf[0]" - """ - - price_status: Optional[Literal["error", "hide", "show"]] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/price_status/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.price_status.anyOf[0]" - """ - - reserved_in_stock: Optional[int] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/reserved_in_stock/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.reserved_in_stock.anyOf[0]" - """ - - -class FlavorListSuitableResponse(BaseModel): - count: int - """ - '#/components/schemas/BareMetalFlavorExtendedCollectionSerializer/properties/count' - "$.components.schemas.BareMetalFlavorExtendedCollectionSerializer.properties.count" - """ - - results: List[Result] - """ - '#/components/schemas/BareMetalFlavorExtendedCollectionSerializer/properties/results' - "$.components.schemas.BareMetalFlavorExtendedCollectionSerializer.properties.results" - """ diff --git a/src/gcore/types/cloud/baremetal/flavor_list_response.py b/src/gcore/types/cloud/baremetal_flavor.py similarity index 85% rename from src/gcore/types/cloud/baremetal/flavor_list_response.py rename to src/gcore/types/cloud/baremetal_flavor.py index 32bc9f65..429826de 100644 --- a/src/gcore/types/cloud/baremetal/flavor_list_response.py +++ b/src/gcore/types/cloud/baremetal_flavor.py @@ -1,14 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Optional +from typing import Dict, Optional from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel -__all__ = ["FlavorListResponse", "Result"] +__all__ = ["BaremetalFlavor"] -class Result(BaseModel): +class BaremetalFlavor(BaseModel): architecture: str """ '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/architecture' @@ -98,17 +98,3 @@ class Result(BaseModel): '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/reserved_in_stock/anyOf/0' "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.reserved_in_stock.anyOf[0]" """ - - -class FlavorListResponse(BaseModel): - count: int - """ - '#/components/schemas/BareMetalFlavorExtendedCollectionSerializer/properties/count' - "$.components.schemas.BareMetalFlavorExtendedCollectionSerializer.properties.count" - """ - - results: List[Result] - """ - '#/components/schemas/BareMetalFlavorExtendedCollectionSerializer/properties/results' - "$.components.schemas.BareMetalFlavorExtendedCollectionSerializer.properties.results" - """ diff --git a/src/gcore/types/cloud/baremetal_flavor_list.py b/src/gcore/types/cloud/baremetal_flavor_list.py new file mode 100644 index 00000000..190fc68d --- /dev/null +++ b/src/gcore/types/cloud/baremetal_flavor_list.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .baremetal_flavor import BaremetalFlavor + +__all__ = ["BaremetalFlavorList"] + + +class BaremetalFlavorList(BaseModel): + count: int + """ + '#/components/schemas/BareMetalFlavorExtendedCollectionSerializer/properties/count' + "$.components.schemas.BareMetalFlavorExtendedCollectionSerializer.properties.count" + """ + + results: List[BaremetalFlavor] + """ + '#/components/schemas/BareMetalFlavorExtendedCollectionSerializer/properties/results' + "$.components.schemas.BareMetalFlavorExtendedCollectionSerializer.properties.results" + """ diff --git a/src/gcore/types/cloud/fixed_address.py b/src/gcore/types/cloud/fixed_address.py new file mode 100644 index 00000000..5d01bab4 --- /dev/null +++ b/src/gcore/types/cloud/fixed_address.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["FixedAddress"] + + +class FixedAddress(BaseModel): + addr: str + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/addr' + "$.components.schemas.InstanceFixedAddressSerializer.properties.addr" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.InstanceFixedAddressSerializer.properties.interface_name.anyOf[0]" + """ + + subnet_id: str + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_id' + "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_id" + """ + + subnet_name: str + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_name' + "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_name" + """ + + type: Literal["fixed"] + """ + '#/components/schemas/InstanceFixedAddressSerializer/properties/type' + "$.components.schemas.InstanceFixedAddressSerializer.properties.type" + """ diff --git a/src/gcore/types/cloud/fixed_address_short.py b/src/gcore/types/cloud/fixed_address_short.py new file mode 100644 index 00000000..6d0682de --- /dev/null +++ b/src/gcore/types/cloud/fixed_address_short.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["FixedAddressShort"] + + +class FixedAddressShort(BaseModel): + addr: str + """ + '#/components/schemas/InstanceFixedAddressShortSerializer/properties/addr' + "$.components.schemas.InstanceFixedAddressShortSerializer.properties.addr" + """ + + interface_name: Optional[str] = None + """ + '#/components/schemas/InstanceFixedAddressShortSerializer/properties/interface_name/anyOf/0' + "$.components.schemas.InstanceFixedAddressShortSerializer.properties.interface_name.anyOf[0]" + """ + + type: Literal["fixed"] + """ + '#/components/schemas/InstanceFixedAddressShortSerializer/properties/type' + "$.components.schemas.InstanceFixedAddressShortSerializer.properties.type" + """ diff --git a/src/gcore/types/cloud/floating_address.py b/src/gcore/types/cloud/floating_address.py new file mode 100644 index 00000000..cc186158 --- /dev/null +++ b/src/gcore/types/cloud/floating_address.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["FloatingAddress"] + + +class FloatingAddress(BaseModel): + addr: str + """ + '#/components/schemas/InstanceFloatingAddressSerializer/properties/addr' + "$.components.schemas.InstanceFloatingAddressSerializer.properties.addr" + """ + + type: Literal["floating"] + """ + '#/components/schemas/InstanceFloatingAddressSerializer/properties/type' + "$.components.schemas.InstanceFloatingAddressSerializer.properties.type" + """ diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index da67335c..a3b5ea70 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -6,93 +6,22 @@ from .tag import Tag from ..._models import BaseModel +from .fixed_address import FixedAddress from .load_balancer import LoadBalancer +from .floating_address import FloatingAddress from .floating_ip_status import FloatingIPStatus +from .fixed_address_short import FixedAddressShort __all__ = [ "FloatingIPDetailed", "Instance", "InstanceAddress", - "InstanceAddressInstanceFloatingAddressSerializer", - "InstanceAddressInstanceFixedAddressShortSerializer", - "InstanceAddressInstanceFixedAddressSerializer", "InstanceFlavor", "InstanceSecurityGroup", "InstanceVolume", ] - -class InstanceAddressInstanceFloatingAddressSerializer(BaseModel): - addr: str - """ - '#/components/schemas/InstanceFloatingAddressSerializer/properties/addr' - "$.components.schemas.InstanceFloatingAddressSerializer.properties.addr" - """ - - type: Literal["floating"] - """ - '#/components/schemas/InstanceFloatingAddressSerializer/properties/type' - "$.components.schemas.InstanceFloatingAddressSerializer.properties.type" - """ - - -class InstanceAddressInstanceFixedAddressShortSerializer(BaseModel): - addr: str - """ - '#/components/schemas/InstanceFixedAddressShortSerializer/properties/addr' - "$.components.schemas.InstanceFixedAddressShortSerializer.properties.addr" - """ - - interface_name: Optional[str] = None - """ - '#/components/schemas/InstanceFixedAddressShortSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.InstanceFixedAddressShortSerializer.properties.interface_name.anyOf[0]" - """ - - type: Literal["fixed"] - """ - '#/components/schemas/InstanceFixedAddressShortSerializer/properties/type' - "$.components.schemas.InstanceFixedAddressShortSerializer.properties.type" - """ - - -class InstanceAddressInstanceFixedAddressSerializer(BaseModel): - addr: str - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/addr' - "$.components.schemas.InstanceFixedAddressSerializer.properties.addr" - """ - - interface_name: Optional[str] = None - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.InstanceFixedAddressSerializer.properties.interface_name.anyOf[0]" - """ - - subnet_id: str - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_id' - "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_id" - """ - - subnet_name: str - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_name' - "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_name" - """ - - type: Literal["fixed"] - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/type' - "$.components.schemas.InstanceFixedAddressSerializer.properties.type" - """ - - -InstanceAddress: TypeAlias = Union[ - InstanceAddressInstanceFloatingAddressSerializer, - InstanceAddressInstanceFixedAddressShortSerializer, - InstanceAddressInstanceFixedAddressSerializer, -] +InstanceAddress: TypeAlias = Union[FloatingAddress, FixedAddressShort, FixedAddress] class InstanceFlavor(BaseModel): diff --git a/src/gcore/types/cloud/gpu_cluster_server.py b/src/gcore/types/cloud/gpu_cluster_server.py index 3a3fdefc..300e79d5 100644 --- a/src/gcore/types/cloud/gpu_cluster_server.py +++ b/src/gcore/types/cloud/gpu_cluster_server.py @@ -9,13 +9,13 @@ from .tag import Tag from ..._models import BaseModel from .ddos_profile import DDOSProfile +from .fixed_address import FixedAddress +from .floating_address import FloatingAddress +from .fixed_address_short import FixedAddressShort __all__ = [ "GPUClusterServer", "Address", - "AddressInstanceFloatingAddressSerializer", - "AddressInstanceFixedAddressShortSerializer", - "AddressInstanceFixedAddressSerializer", "BlackholePort", "FixedIPAssignment", "Flavor", @@ -24,78 +24,7 @@ "SecurityGroup", ] - -class AddressInstanceFloatingAddressSerializer(BaseModel): - addr: str - """ - '#/components/schemas/InstanceFloatingAddressSerializer/properties/addr' - "$.components.schemas.InstanceFloatingAddressSerializer.properties.addr" - """ - - type: Literal["floating"] - """ - '#/components/schemas/InstanceFloatingAddressSerializer/properties/type' - "$.components.schemas.InstanceFloatingAddressSerializer.properties.type" - """ - - -class AddressInstanceFixedAddressShortSerializer(BaseModel): - addr: str - """ - '#/components/schemas/InstanceFixedAddressShortSerializer/properties/addr' - "$.components.schemas.InstanceFixedAddressShortSerializer.properties.addr" - """ - - interface_name: Optional[str] = None - """ - '#/components/schemas/InstanceFixedAddressShortSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.InstanceFixedAddressShortSerializer.properties.interface_name.anyOf[0]" - """ - - type: Literal["fixed"] - """ - '#/components/schemas/InstanceFixedAddressShortSerializer/properties/type' - "$.components.schemas.InstanceFixedAddressShortSerializer.properties.type" - """ - - -class AddressInstanceFixedAddressSerializer(BaseModel): - addr: str - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/addr' - "$.components.schemas.InstanceFixedAddressSerializer.properties.addr" - """ - - interface_name: Optional[str] = None - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.InstanceFixedAddressSerializer.properties.interface_name.anyOf[0]" - """ - - subnet_id: str - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_id' - "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_id" - """ - - subnet_name: str - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_name' - "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_name" - """ - - type: Literal["fixed"] - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/type' - "$.components.schemas.InstanceFixedAddressSerializer.properties.type" - """ - - -Address: TypeAlias = Union[ - AddressInstanceFloatingAddressSerializer, - AddressInstanceFixedAddressShortSerializer, - AddressInstanceFixedAddressSerializer, -] +Address: TypeAlias = Union[FloatingAddress, FixedAddressShort, FixedAddress] class BlackholePort(BaseModel): diff --git a/src/gcore/types/cloud/instance.py b/src/gcore/types/cloud/instance.py index 3a4f42ba..ff204cc3 100644 --- a/src/gcore/types/cloud/instance.py +++ b/src/gcore/types/cloud/instance.py @@ -9,13 +9,13 @@ from .tag import Tag from ..._models import BaseModel from .ddos_profile import DDOSProfile +from .fixed_address import FixedAddress +from .floating_address import FloatingAddress +from .fixed_address_short import FixedAddressShort __all__ = [ "Instance", "Address", - "AddressInstanceFloatingAddressSerializer", - "AddressInstanceFixedAddressShortSerializer", - "AddressInstanceFixedAddressSerializer", "BlackholePort", "FixedIPAssignment", "Flavor", @@ -30,78 +30,7 @@ "Volume", ] - -class AddressInstanceFloatingAddressSerializer(BaseModel): - addr: str - """ - '#/components/schemas/InstanceFloatingAddressSerializer/properties/addr' - "$.components.schemas.InstanceFloatingAddressSerializer.properties.addr" - """ - - type: Literal["floating"] - """ - '#/components/schemas/InstanceFloatingAddressSerializer/properties/type' - "$.components.schemas.InstanceFloatingAddressSerializer.properties.type" - """ - - -class AddressInstanceFixedAddressShortSerializer(BaseModel): - addr: str - """ - '#/components/schemas/InstanceFixedAddressShortSerializer/properties/addr' - "$.components.schemas.InstanceFixedAddressShortSerializer.properties.addr" - """ - - interface_name: Optional[str] = None - """ - '#/components/schemas/InstanceFixedAddressShortSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.InstanceFixedAddressShortSerializer.properties.interface_name.anyOf[0]" - """ - - type: Literal["fixed"] - """ - '#/components/schemas/InstanceFixedAddressShortSerializer/properties/type' - "$.components.schemas.InstanceFixedAddressShortSerializer.properties.type" - """ - - -class AddressInstanceFixedAddressSerializer(BaseModel): - addr: str - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/addr' - "$.components.schemas.InstanceFixedAddressSerializer.properties.addr" - """ - - interface_name: Optional[str] = None - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.InstanceFixedAddressSerializer.properties.interface_name.anyOf[0]" - """ - - subnet_id: str - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_id' - "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_id" - """ - - subnet_name: str - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_name' - "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_name" - """ - - type: Literal["fixed"] - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/type' - "$.components.schemas.InstanceFixedAddressSerializer.properties.type" - """ - - -Address: TypeAlias = Union[ - AddressInstanceFloatingAddressSerializer, - AddressInstanceFixedAddressShortSerializer, - AddressInstanceFixedAddressSerializer, -] +Address: TypeAlias = Union[FloatingAddress, FixedAddressShort, FixedAddress] class BlackholePort(BaseModel): diff --git a/src/gcore/types/cloud/networks/router.py b/src/gcore/types/cloud/networks/router.py index 53a33e9a..dc4e9a36 100644 --- a/src/gcore/types/cloud/networks/router.py +++ b/src/gcore/types/cloud/networks/router.py @@ -3,16 +3,10 @@ from typing import List, Optional from datetime import datetime +from ..route import Route from ...._models import BaseModel -__all__ = [ - "Router", - "Interface", - "InterfaceIPAssignment", - "Route", - "ExternalGatewayInfo", - "ExternalGatewayInfoExternalFixedIP", -] +__all__ = ["Router", "Interface", "InterfaceIPAssignment", "ExternalGatewayInfo", "ExternalGatewayInfoExternalFixedIP"] class InterfaceIPAssignment(BaseModel): @@ -55,20 +49,6 @@ class Interface(BaseModel): """ -class Route(BaseModel): - destination: str - """ - '#/components/schemas/RouteOutSerializer/properties/destination' - "$.components.schemas.RouteOutSerializer.properties.destination" - """ - - nexthop: str - """ - '#/components/schemas/RouteOutSerializer/properties/nexthop' - "$.components.schemas.RouteOutSerializer.properties.nexthop" - """ - - class ExternalGatewayInfoExternalFixedIP(BaseModel): ip_address: str """ diff --git a/src/gcore/types/cloud/route.py b/src/gcore/types/cloud/route.py new file mode 100644 index 00000000..2732e748 --- /dev/null +++ b/src/gcore/types/cloud/route.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["Route"] + + +class Route(BaseModel): + destination: str + """ + '#/components/schemas/RouteOutSerializer/properties/destination' + "$.components.schemas.RouteOutSerializer.properties.destination" + """ + + nexthop: str + """ + '#/components/schemas/RouteOutSerializer/properties/nexthop' + "$.components.schemas.RouteOutSerializer.properties.nexthop" + """ diff --git a/src/gcore/types/cloud/subnet.py b/src/gcore/types/cloud/subnet.py index d936483a..b0145b3a 100644 --- a/src/gcore/types/cloud/subnet.py +++ b/src/gcore/types/cloud/subnet.py @@ -4,24 +4,11 @@ from datetime import datetime from .tag import Tag +from .route import Route from ..._models import BaseModel from .ip_version import IPVersion -__all__ = ["Subnet", "HostRoute"] - - -class HostRoute(BaseModel): - destination: str - """ - '#/components/schemas/RouteOutSerializer/properties/destination' - "$.components.schemas.RouteOutSerializer.properties.destination" - """ - - nexthop: str - """ - '#/components/schemas/RouteOutSerializer/properties/nexthop' - "$.components.schemas.RouteOutSerializer.properties.nexthop" - """ +__all__ = ["Subnet"] class Subnet(BaseModel): @@ -127,7 +114,7 @@ class Subnet(BaseModel): "$.components.schemas.SubnetSerializer.properties.has_router" """ - host_routes: Optional[List[HostRoute]] = None + host_routes: Optional[List[Route]] = None """ '#/components/schemas/SubnetSerializer/properties/host_routes/anyOf/0' "$.components.schemas.SubnetSerializer.properties.host_routes.anyOf[0]" diff --git a/tests/api_resources/cloud/baremetal/test_flavors.py b/tests/api_resources/cloud/baremetal/test_flavors.py index a5c646de..322c22e2 100644 --- a/tests/api_resources/cloud/baremetal/test_flavors.py +++ b/tests/api_resources/cloud/baremetal/test_flavors.py @@ -9,10 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.baremetal import ( - FlavorListResponse, - FlavorListSuitableResponse, -) +from gcore.types.cloud import BaremetalFlavorList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +23,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -40,7 +37,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: include_prices=True, include_reservation_stock=True, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -52,7 +49,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -64,7 +61,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +71,7 @@ def test_method_list_suitable(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize def test_method_list_suitable_with_all_params(self, client: Gcore) -> None: @@ -85,7 +82,7 @@ def test_method_list_suitable_with_all_params(self, client: Gcore) -> None: apptemplate_id="apptemplate_id", image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", ) - assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize def test_raw_response_list_suitable(self, client: Gcore) -> None: @@ -97,7 +94,7 @@ def test_raw_response_list_suitable(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize def test_streaming_response_list_suitable(self, client: Gcore) -> None: @@ -109,7 +106,7 @@ def test_streaming_response_list_suitable(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -123,7 +120,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -137,7 +134,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No include_prices=True, include_reservation_stock=True, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -149,7 +146,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -161,7 +158,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -171,7 +168,7 @@ async def test_method_list_suitable(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize async def test_method_list_suitable_with_all_params(self, async_client: AsyncGcore) -> None: @@ -182,7 +179,7 @@ async def test_method_list_suitable_with_all_params(self, async_client: AsyncGco apptemplate_id="apptemplate_id", image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", ) - assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize async def test_raw_response_list_suitable(self, async_client: AsyncGcore) -> None: @@ -194,7 +191,7 @@ async def test_raw_response_list_suitable(self, async_client: AsyncGcore) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize async def test_streaming_response_list_suitable(self, async_client: AsyncGcore) -> None: @@ -206,6 +203,6 @@ async def test_streaming_response_list_suitable(self, async_client: AsyncGcore) assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(FlavorListSuitableResponse, flavor, path=["response"]) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True From bfbfe3b95634fce5cc673cad22228fd8ddd130dc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 15:27:59 +0000 Subject: [PATCH 091/592] Add model recommended --- .stats.yml | 2 +- api.md | 16 +- src/gcore/types/cloud/__init__.py | 14 + .../types/cloud/allowed_address_pairs.py | 21 + .../types/cloud/baremetal/baremetal_server.py | 97 +---- src/gcore/types/cloud/blackhole_port.py | 85 ++++ .../container_probe_config_create_param.py | 24 ++ .../cloud/container_probe_create_param.py | 62 +++ .../container_probe_exec_create_param.py | 16 + .../container_probe_http_get_create_param.py | 40 ++ ...container_probe_tcp_socket_create_param.py | 15 + src/gcore/types/cloud/gpu_cluster_server.py | 98 +---- .../inference/deployment_create_params.py | 370 +----------------- .../inference/deployment_update_params.py | 370 +----------------- src/gcore/types/cloud/instance.py | 89 +---- src/gcore/types/cloud/instance_interface.py | 148 +------ src/gcore/types/cloud/instance_isolation.py | 15 + src/gcore/types/cloud/ip_assignment.py | 19 + .../cloud/laas_index_retention_policy.py | 15 + .../laas_index_retention_policy_param.py | 16 + .../cloud/load_balancer_create_params.py | 12 +- .../cloud/load_balancer_update_params.py | 15 +- src/gcore/types/cloud/logging.py | 13 +- src/gcore/types/cloud/network_details.py | 120 ++++++ src/gcore/types/cloud/network_interface.py | 301 +------------- src/gcore/types/cloud/networks/router.py | 35 +- src/gcore/types/cloud/reserved_fixed_ip.py | 19 +- .../cloud/reserved_fixed_ips/__init__.py | 2 +- .../reserved_fixed_ips/candidate_port.py | 4 +- .../reserved_fixed_ips/connected_port.py | 4 +- .../{ip_assignment.py => ip_with_subnet.py} | 4 +- 31 files changed, 532 insertions(+), 1529 deletions(-) create mode 100644 src/gcore/types/cloud/allowed_address_pairs.py create mode 100644 src/gcore/types/cloud/blackhole_port.py create mode 100644 src/gcore/types/cloud/container_probe_config_create_param.py create mode 100644 src/gcore/types/cloud/container_probe_create_param.py create mode 100644 src/gcore/types/cloud/container_probe_exec_create_param.py create mode 100644 src/gcore/types/cloud/container_probe_http_get_create_param.py create mode 100644 src/gcore/types/cloud/container_probe_tcp_socket_create_param.py create mode 100644 src/gcore/types/cloud/instance_isolation.py create mode 100644 src/gcore/types/cloud/ip_assignment.py create mode 100644 src/gcore/types/cloud/laas_index_retention_policy.py create mode 100644 src/gcore/types/cloud/laas_index_retention_policy_param.py create mode 100644 src/gcore/types/cloud/network_details.py rename src/gcore/types/cloud/reserved_fixed_ips/{ip_assignment.py => ip_with_subnet.py} (92%) diff --git a/.stats.yml b/.stats.yml index 40f0629d..69d1a3fe 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-506b88d8207b6721e83a9b8e91ce33e143b3fbe83055e4e8cc276c98ffd0ac20.yml openapi_spec_hash: 5909b18d3de69bcd21c1a4965e643d7f -config_hash: ec989e8f0c07fb133876737d22adda5f +config_hash: 92f5ba39304b08484c4704bbca02f7ac diff --git a/api.md b/api.md index 72970ea2..415350ad 100644 --- a/api.md +++ b/api.md @@ -4,8 +4,10 @@ Types: ```python from gcore.types.cloud import ( + AllowedAddressPairs, BaremetalFlavor, BaremetalFlavorList, + BlackholePort, Console, DDOSProfile, DDOSProfileField, @@ -26,17 +28,22 @@ from gcore.types.cloud import ( Image, ImageList, Instance, + InstanceIsolation, InstanceList, InstanceMetricsTimeUnit, InterfaceIPFamily, + IPAssignment, IPVersion, + LaasIndexRetentionPolicy, LoadBalancer, LoadBalancerInstanceRole, LoadBalancerMemberConnectivity, LoadBalancerOperatingStatus, LoadBalancerStatistics, + Logging, Network, NetworkAnySubnetFip, + NetworkDetails, NetworkInterface, NetworkInterfaceList, NetworkSubnetFip, @@ -183,7 +190,6 @@ from gcore.types.cloud import ( L7PolicyList, L7Rule, L7RuleList, - LaasIndexRetentionPolicy, LbAlgorithm, LbFlavorList, LbHealthMonitor, @@ -311,7 +317,7 @@ from gcore.types.cloud.reserved_fixed_ips import ( CandidatePortList, ConnectedPort, ConnectedPortList, - IPAssignment, + IPWithSubnet, ) ``` @@ -452,9 +458,14 @@ from gcore.types.cloud import ( Capacity, ContainerProbe, ContainerProbeConfig, + ContainerProbeConfigCreate, + ContainerProbeCreate, ContainerProbeExec, + ContainerProbeExecCreate, ContainerProbeHTTPGet, + ContainerProbeHTTPGetCreate, ContainerProbeTcpSocket, + ContainerProbeTcpSocketCreate, ContainerScale, ContainerScaleTriggerRate, ContainerScaleTriggerSqs, @@ -464,7 +475,6 @@ from gcore.types.cloud import ( InferenceProbes, IngressOpts, IngressOptsOut, - Logging, RegionCapacity, RegionCapacityList, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index c3cd8b8f..3ccb9f38 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -38,9 +38,11 @@ from .deploy_status import DeployStatus as DeployStatus from .fixed_address import FixedAddress as FixedAddress from .instance_list import InstanceList as InstanceList +from .ip_assignment import IPAssignment as IPAssignment from .load_balancer import LoadBalancer as LoadBalancer from .member_status import MemberStatus as MemberStatus from .registry_list import RegistryList as RegistryList +from .blackhole_port import BlackholePort as BlackholePort from .gpu_image_list import GPUImageList as GPUImageList from .l7_policy_list import L7PolicyList as L7PolicyList from .lb_flavor_list import LbFlavorList as LbFlavorList @@ -48,6 +50,7 @@ from .container_probe import ContainerProbe as ContainerProbe from .container_scale import ContainerScale as ContainerScale from .listener_status import ListenerStatus as ListenerStatus +from .network_details import NetworkDetails as NetworkDetails from .placement_group import PlacementGroup as PlacementGroup from .region_capacity import RegionCapacity as RegionCapacity from .ssh_key_created import SSHKeyCreated as SSHKeyCreated @@ -68,6 +71,7 @@ from .gpu_cluster_server import GPUClusterServer as GPUClusterServer from .ingress_opts_param import IngressOptsParam as IngressOptsParam from .instance_interface import InstanceInterface as InstanceInterface +from .instance_isolation import InstanceIsolation as InstanceIsolation from .region_list_params import RegionListParams as RegionListParams from .volume_list_params import VolumeListParams as VolumeListParams from .billing_reservation import BillingReservation as BillingReservation @@ -95,6 +99,7 @@ from .volume_delete_params import VolumeDeleteParams as VolumeDeleteParams from .volume_resize_params import VolumeResizeParams as VolumeResizeParams from .volume_update_params import VolumeUpdateParams as VolumeUpdateParams +from .allowed_address_pairs import AllowedAddressPairs as AllowedAddressPairs from .baremetal_flavor_list import BaremetalFlavorList as BaremetalFlavorList from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate from .detailed_lb_pool_list import DetailedLbPoolList as DetailedLbPoolList @@ -148,11 +153,13 @@ from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField from .flavor_hardware_description import FlavorHardwareDescription as FlavorHardwareDescription from .instance_get_console_params import InstanceGetConsoleParams as InstanceGetConsoleParams +from .laas_index_retention_policy import LaasIndexRetentionPolicy as LaasIndexRetentionPolicy from .load_balancer_create_params import LoadBalancerCreateParams as LoadBalancerCreateParams from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams +from .container_probe_create_param import ContainerProbeCreateParam as ContainerProbeCreateParam from .container_scale_trigger_rate import ContainerScaleTriggerRate as ContainerScaleTriggerRate from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams @@ -164,21 +171,28 @@ from .billing_reservation_list_params import BillingReservationListParams as BillingReservationListParams from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams +from .container_probe_exec_create_param import ContainerProbeExecCreateParam as ContainerProbeExecCreateParam from .container_scale_trigger_threshold import ContainerScaleTriggerThreshold as ContainerScaleTriggerThreshold from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams +from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams +from .container_probe_config_create_param import ContainerProbeConfigCreateParam as ContainerProbeConfigCreateParam from .gpu_baremetal_cluster_create_params import GPUBaremetalClusterCreateParams as GPUBaremetalClusterCreateParams from .gpu_baremetal_cluster_delete_params import GPUBaremetalClusterDeleteParams as GPUBaremetalClusterDeleteParams from .gpu_baremetal_cluster_resize_params import GPUBaremetalClusterResizeParams as GPUBaremetalClusterResizeParams from .gpu_baremetal_cluster_rebuild_params import GPUBaremetalClusterRebuildParams as GPUBaremetalClusterRebuildParams from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams +from .container_probe_http_get_create_param import ContainerProbeHTTPGetCreateParam as ContainerProbeHTTPGetCreateParam from .instance_assign_security_group_params import ( InstanceAssignSecurityGroupParams as InstanceAssignSecurityGroupParams, ) from .instance_add_to_placement_group_params import ( InstanceAddToPlacementGroupParams as InstanceAddToPlacementGroupParams, ) +from .container_probe_tcp_socket_create_param import ( + ContainerProbeTcpSocketCreateParam as ContainerProbeTcpSocketCreateParam, +) from .instance_unassign_security_group_params import ( InstanceUnassignSecurityGroupParams as InstanceUnassignSecurityGroupParams, ) diff --git a/src/gcore/types/cloud/allowed_address_pairs.py b/src/gcore/types/cloud/allowed_address_pairs.py new file mode 100644 index 00000000..643404fc --- /dev/null +++ b/src/gcore/types/cloud/allowed_address_pairs.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["AllowedAddressPairs"] + + +class AllowedAddressPairs(BaseModel): + ip_address: str + """ + '#/components/schemas/AllowedAddressPairsSerializer/properties/ip_address/anyOf/0' + "$.components.schemas.AllowedAddressPairsSerializer.properties.ip_address.anyOf[0]" + """ + + mac_address: Optional[str] = None + """ + '#/components/schemas/AllowedAddressPairsSerializer/properties/mac_address/anyOf/0' + "$.components.schemas.AllowedAddressPairsSerializer.properties.mac_address.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/baremetal/baremetal_server.py b/src/gcore/types/cloud/baremetal/baremetal_server.py index e0d48f6e..7e64f42b 100644 --- a/src/gcore/types/cloud/baremetal/baremetal_server.py +++ b/src/gcore/types/cloud/baremetal/baremetal_server.py @@ -4,102 +4,19 @@ from datetime import datetime from typing_extensions import Literal, TypeAlias -from pydantic import Field as FieldInfo - from ..tag import Tag from ...._models import BaseModel from ..ddos_profile import DDOSProfile +from ..blackhole_port import BlackholePort +from ..instance_isolation import InstanceIsolation from .baremetal_fixed_address import BaremetalFixedAddress from .baremetal_floating_address import BaremetalFloatingAddress -__all__ = [ - "BaremetalServer", - "Address", - "BlackholePort", - "FixedIPAssignment", - "Flavor", - "FlavorHardwareDescription", - "InstanceIsolation", -] +__all__ = ["BaremetalServer", "Address", "FixedIPAssignment", "Flavor", "FlavorHardwareDescription"] Address: TypeAlias = Union[BaremetalFloatingAddress, BaremetalFixedAddress] -class BlackholePort(BaseModel): - alarm_end: datetime = FieldInfo(alias="AlarmEnd") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlarmEnd' - "$.components.schemas.BlackholePortSerializer.properties.AlarmEnd" - """ - - alarm_start: datetime = FieldInfo(alias="AlarmStart") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlarmStart' - "$.components.schemas.BlackholePortSerializer.properties.AlarmStart" - """ - - alarm_state: Literal[ - "ACK_REQ", - "ALARM", - "ARCHIVED", - "CLEAR", - "CLEARING", - "CLEARING_FAIL", - "END_GRACE", - "END_WAIT", - "MANUAL_CLEAR", - "MANUAL_CLEARING", - "MANUAL_CLEARING_FAIL", - "MANUAL_MITIGATING", - "MANUAL_STARTING", - "MANUAL_STARTING_FAIL", - "MITIGATING", - "STARTING", - "STARTING_FAIL", - "START_WAIT", - "ack_req", - "alarm", - "archived", - "clear", - "clearing", - "clearing_fail", - "end_grace", - "end_wait", - "manual_clear", - "manual_clearing", - "manual_clearing_fail", - "manual_mitigating", - "manual_starting", - "manual_starting_fail", - "mitigating", - "start_wait", - "starting", - "starting_fail", - ] = FieldInfo(alias="AlarmState") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlarmState' - "$.components.schemas.BlackholePortSerializer.properties.AlarmState" - """ - - alert_duration: str = FieldInfo(alias="AlertDuration") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlertDuration' - "$.components.schemas.BlackholePortSerializer.properties.AlertDuration" - """ - - destination_ip: str = FieldInfo(alias="DestinationIP") - """ - '#/components/schemas/BlackholePortSerializer/properties/DestinationIP' - "$.components.schemas.BlackholePortSerializer.properties.DestinationIP" - """ - - id: int = FieldInfo(alias="ID") - """ - '#/components/schemas/BlackholePortSerializer/properties/ID' - "$.components.schemas.BlackholePortSerializer.properties.ID" - """ - - class FixedIPAssignment(BaseModel): external: bool """ @@ -202,14 +119,6 @@ class Flavor(BaseModel): """ -class InstanceIsolation(BaseModel): - reason: Optional[str] = None - """ - '#/components/schemas/IsolationSerializer/properties/reason/anyOf/0' - "$.components.schemas.IsolationSerializer.properties.reason.anyOf[0]" - """ - - class BaremetalServer(BaseModel): addresses: Dict[str, List[Address]] """ diff --git a/src/gcore/types/cloud/blackhole_port.py b/src/gcore/types/cloud/blackhole_port.py new file mode 100644 index 00000000..297098eb --- /dev/null +++ b/src/gcore/types/cloud/blackhole_port.py @@ -0,0 +1,85 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["BlackholePort"] + + +class BlackholePort(BaseModel): + alarm_end: datetime = FieldInfo(alias="AlarmEnd") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlarmEnd' + "$.components.schemas.BlackholePortSerializer.properties.AlarmEnd" + """ + + alarm_start: datetime = FieldInfo(alias="AlarmStart") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlarmStart' + "$.components.schemas.BlackholePortSerializer.properties.AlarmStart" + """ + + alarm_state: Literal[ + "ACK_REQ", + "ALARM", + "ARCHIVED", + "CLEAR", + "CLEARING", + "CLEARING_FAIL", + "END_GRACE", + "END_WAIT", + "MANUAL_CLEAR", + "MANUAL_CLEARING", + "MANUAL_CLEARING_FAIL", + "MANUAL_MITIGATING", + "MANUAL_STARTING", + "MANUAL_STARTING_FAIL", + "MITIGATING", + "STARTING", + "STARTING_FAIL", + "START_WAIT", + "ack_req", + "alarm", + "archived", + "clear", + "clearing", + "clearing_fail", + "end_grace", + "end_wait", + "manual_clear", + "manual_clearing", + "manual_clearing_fail", + "manual_mitigating", + "manual_starting", + "manual_starting_fail", + "mitigating", + "start_wait", + "starting", + "starting_fail", + ] = FieldInfo(alias="AlarmState") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlarmState' + "$.components.schemas.BlackholePortSerializer.properties.AlarmState" + """ + + alert_duration: str = FieldInfo(alias="AlertDuration") + """ + '#/components/schemas/BlackholePortSerializer/properties/AlertDuration' + "$.components.schemas.BlackholePortSerializer.properties.AlertDuration" + """ + + destination_ip: str = FieldInfo(alias="DestinationIP") + """ + '#/components/schemas/BlackholePortSerializer/properties/DestinationIP' + "$.components.schemas.BlackholePortSerializer.properties.DestinationIP" + """ + + id: int = FieldInfo(alias="ID") + """ + '#/components/schemas/BlackholePortSerializer/properties/ID' + "$.components.schemas.BlackholePortSerializer.properties.ID" + """ diff --git a/src/gcore/types/cloud/container_probe_config_create_param.py b/src/gcore/types/cloud/container_probe_config_create_param.py new file mode 100644 index 00000000..a8e715d5 --- /dev/null +++ b/src/gcore/types/cloud/container_probe_config_create_param.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +from .container_probe_create_param import ContainerProbeCreateParam + +__all__ = ["ContainerProbeConfigCreateParam"] + + +class ContainerProbeConfigCreateParam(TypedDict, total=False): + enabled: Required[bool] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" + """ + + probe: Optional[ContainerProbeCreateParam] + """ + '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' + "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/container_probe_create_param.py b/src/gcore/types/cloud/container_probe_create_param.py new file mode 100644 index 00000000..c6a35b4a --- /dev/null +++ b/src/gcore/types/cloud/container_probe_create_param.py @@ -0,0 +1,62 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +from .container_probe_exec_create_param import ContainerProbeExecCreateParam +from .container_probe_http_get_create_param import ContainerProbeHTTPGetCreateParam +from .container_probe_tcp_socket_create_param import ContainerProbeTcpSocketCreateParam + +__all__ = ["ContainerProbeCreateParam"] + + +class ContainerProbeCreateParam(TypedDict, total=False): + exec: Optional[ContainerProbeExecCreateParam] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" + """ + + failure_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" + """ + + http_get: Optional[ContainerProbeHTTPGetCreateParam] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" + """ + + initial_delay_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" + """ + + period_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" + """ + + success_threshold: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' + "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" + """ + + tcp_socket: Optional[ContainerProbeTcpSocketCreateParam] + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' + "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" + """ + + timeout_seconds: int + """ + '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' + "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" + """ diff --git a/src/gcore/types/cloud/container_probe_exec_create_param.py b/src/gcore/types/cloud/container_probe_exec_create_param.py new file mode 100644 index 00000000..7b69c2a5 --- /dev/null +++ b/src/gcore/types/cloud/container_probe_exec_create_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Required, TypedDict + +__all__ = ["ContainerProbeExecCreateParam"] + + +class ContainerProbeExecCreateParam(TypedDict, total=False): + command: Required[List[str]] + """ + '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' + "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" + """ diff --git a/src/gcore/types/cloud/container_probe_http_get_create_param.py b/src/gcore/types/cloud/container_probe_http_get_create_param.py new file mode 100644 index 00000000..b660269a --- /dev/null +++ b/src/gcore/types/cloud/container_probe_http_get_create_param.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["ContainerProbeHTTPGetCreateParam"] + + +class ContainerProbeHTTPGetCreateParam(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" + """ + + headers: Dict[str, str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" + """ + + host: Optional[str] + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" + """ + + path: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" + """ + + schema: str + """ + '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' + "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" + """ diff --git a/src/gcore/types/cloud/container_probe_tcp_socket_create_param.py b/src/gcore/types/cloud/container_probe_tcp_socket_create_param.py new file mode 100644 index 00000000..7fedc87f --- /dev/null +++ b/src/gcore/types/cloud/container_probe_tcp_socket_create_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ContainerProbeTcpSocketCreateParam"] + + +class ContainerProbeTcpSocketCreateParam(TypedDict, total=False): + port: Required[int] + """ + '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' + "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" + """ diff --git a/src/gcore/types/cloud/gpu_cluster_server.py b/src/gcore/types/cloud/gpu_cluster_server.py index 300e79d5..a41b818a 100644 --- a/src/gcore/types/cloud/gpu_cluster_server.py +++ b/src/gcore/types/cloud/gpu_cluster_server.py @@ -4,104 +4,20 @@ from datetime import datetime from typing_extensions import Literal, TypeAlias -from pydantic import Field as FieldInfo - from .tag import Tag from ..._models import BaseModel from .ddos_profile import DDOSProfile from .fixed_address import FixedAddress +from .blackhole_port import BlackholePort from .floating_address import FloatingAddress +from .instance_isolation import InstanceIsolation from .fixed_address_short import FixedAddressShort -__all__ = [ - "GPUClusterServer", - "Address", - "BlackholePort", - "FixedIPAssignment", - "Flavor", - "FlavorHardwareDescription", - "InstanceIsolation", - "SecurityGroup", -] +__all__ = ["GPUClusterServer", "Address", "FixedIPAssignment", "Flavor", "FlavorHardwareDescription", "SecurityGroup"] Address: TypeAlias = Union[FloatingAddress, FixedAddressShort, FixedAddress] -class BlackholePort(BaseModel): - alarm_end: datetime = FieldInfo(alias="AlarmEnd") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlarmEnd' - "$.components.schemas.BlackholePortSerializer.properties.AlarmEnd" - """ - - alarm_start: datetime = FieldInfo(alias="AlarmStart") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlarmStart' - "$.components.schemas.BlackholePortSerializer.properties.AlarmStart" - """ - - alarm_state: Literal[ - "ACK_REQ", - "ALARM", - "ARCHIVED", - "CLEAR", - "CLEARING", - "CLEARING_FAIL", - "END_GRACE", - "END_WAIT", - "MANUAL_CLEAR", - "MANUAL_CLEARING", - "MANUAL_CLEARING_FAIL", - "MANUAL_MITIGATING", - "MANUAL_STARTING", - "MANUAL_STARTING_FAIL", - "MITIGATING", - "STARTING", - "STARTING_FAIL", - "START_WAIT", - "ack_req", - "alarm", - "archived", - "clear", - "clearing", - "clearing_fail", - "end_grace", - "end_wait", - "manual_clear", - "manual_clearing", - "manual_clearing_fail", - "manual_mitigating", - "manual_starting", - "manual_starting_fail", - "mitigating", - "start_wait", - "starting", - "starting_fail", - ] = FieldInfo(alias="AlarmState") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlarmState' - "$.components.schemas.BlackholePortSerializer.properties.AlarmState" - """ - - alert_duration: str = FieldInfo(alias="AlertDuration") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlertDuration' - "$.components.schemas.BlackholePortSerializer.properties.AlertDuration" - """ - - destination_ip: str = FieldInfo(alias="DestinationIP") - """ - '#/components/schemas/BlackholePortSerializer/properties/DestinationIP' - "$.components.schemas.BlackholePortSerializer.properties.DestinationIP" - """ - - id: int = FieldInfo(alias="ID") - """ - '#/components/schemas/BlackholePortSerializer/properties/ID' - "$.components.schemas.BlackholePortSerializer.properties.ID" - """ - - class FixedIPAssignment(BaseModel): external: bool """ @@ -210,14 +126,6 @@ class Flavor(BaseModel): """ -class InstanceIsolation(BaseModel): - reason: Optional[str] = None - """ - '#/components/schemas/IsolationSerializer/properties/reason/anyOf/0' - "$.components.schemas.IsolationSerializer.properties.reason.anyOf[0]" - """ - - class SecurityGroup(BaseModel): name: str """ diff --git a/src/gcore/types/cloud/inference/deployment_create_params.py b/src/gcore/types/cloud/inference/deployment_create_params.py index cbdae2e6..2133185c 100644 --- a/src/gcore/types/cloud/inference/deployment_create_params.py +++ b/src/gcore/types/cloud/inference/deployment_create_params.py @@ -7,6 +7,8 @@ from ...._utils import PropertyInfo from ..ingress_opts_param import IngressOptsParam +from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam +from ..container_probe_config_create_param import ContainerProbeConfigCreateParam __all__ = [ "DeploymentCreateParams", @@ -20,23 +22,7 @@ "ContainerScaleTriggersMemory", "ContainerScaleTriggersSqs", "Logging", - "LoggingRetentionPolicy", "Probes", - "ProbesLivenessProbe", - "ProbesLivenessProbeProbe", - "ProbesLivenessProbeProbeExec", - "ProbesLivenessProbeProbeHTTPGet", - "ProbesLivenessProbeProbeTcpSocket", - "ProbesReadinessProbe", - "ProbesReadinessProbeProbe", - "ProbesReadinessProbeProbeExec", - "ProbesReadinessProbeProbeHTTPGet", - "ProbesReadinessProbeProbeTcpSocket", - "ProbesStartupProbe", - "ProbesStartupProbeProbe", - "ProbesStartupProbeProbeExec", - "ProbesStartupProbeProbeHTTPGet", - "ProbesStartupProbeProbeTcpSocket", ] @@ -312,14 +298,6 @@ class Container(TypedDict, total=False): """ -class LoggingRetentionPolicy(TypedDict, total=False): - period: Required[Optional[int]] - """ - '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' - "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" - """ - - class Logging(TypedDict, total=False): destination_region_id: Optional[int] """ @@ -333,7 +311,7 @@ class Logging(TypedDict, total=False): "$.components.schemas.LoggingInSerializer.properties.enabled" """ - retention_policy: Optional[LoggingRetentionPolicy] + retention_policy: Optional[LaasIndexRetentionPolicyParam] """ '#/components/schemas/LoggingInSerializer/properties/retention_policy/anyOf/0' "$.components.schemas.LoggingInSerializer.properties.retention_policy.anyOf[0]" @@ -346,356 +324,20 @@ class Logging(TypedDict, total=False): """ -class ProbesLivenessProbeProbeExec(TypedDict, total=False): - command: Required[List[str]] - """ - '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' - "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" - """ - - -class ProbesLivenessProbeProbeHTTPGet(TypedDict, total=False): - port: Required[int] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" - """ - - headers: Dict[str, str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" - """ - - host: Optional[str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" - """ - - path: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" - """ - - schema: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" - """ - - -class ProbesLivenessProbeProbeTcpSocket(TypedDict, total=False): - port: Required[int] - """ - '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" - """ - - -class ProbesLivenessProbeProbe(TypedDict, total=False): - exec: Optional[ProbesLivenessProbeProbeExec] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" - """ - - failure_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" - """ - - http_get: Optional[ProbesLivenessProbeProbeHTTPGet] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" - """ - - initial_delay_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" - """ - - period_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" - """ - - success_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" - """ - - tcp_socket: Optional[ProbesLivenessProbeProbeTcpSocket] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" - """ - - timeout_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" - """ - - -class ProbesLivenessProbe(TypedDict, total=False): - enabled: Required[bool] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" - """ - - probe: Optional[ProbesLivenessProbeProbe] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" - """ - - -class ProbesReadinessProbeProbeExec(TypedDict, total=False): - command: Required[List[str]] - """ - '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' - "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" - """ - - -class ProbesReadinessProbeProbeHTTPGet(TypedDict, total=False): - port: Required[int] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" - """ - - headers: Dict[str, str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" - """ - - host: Optional[str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" - """ - - path: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" - """ - - schema: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" - """ - - -class ProbesReadinessProbeProbeTcpSocket(TypedDict, total=False): - port: Required[int] - """ - '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" - """ - - -class ProbesReadinessProbeProbe(TypedDict, total=False): - exec: Optional[ProbesReadinessProbeProbeExec] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" - """ - - failure_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" - """ - - http_get: Optional[ProbesReadinessProbeProbeHTTPGet] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" - """ - - initial_delay_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" - """ - - period_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" - """ - - success_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" - """ - - tcp_socket: Optional[ProbesReadinessProbeProbeTcpSocket] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" - """ - - timeout_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" - """ - - -class ProbesReadinessProbe(TypedDict, total=False): - enabled: Required[bool] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" - """ - - probe: Optional[ProbesReadinessProbeProbe] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" - """ - - -class ProbesStartupProbeProbeExec(TypedDict, total=False): - command: Required[List[str]] - """ - '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' - "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" - """ - - -class ProbesStartupProbeProbeHTTPGet(TypedDict, total=False): - port: Required[int] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" - """ - - headers: Dict[str, str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" - """ - - host: Optional[str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" - """ - - path: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" - """ - - schema: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" - """ - - -class ProbesStartupProbeProbeTcpSocket(TypedDict, total=False): - port: Required[int] - """ - '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" - """ - - -class ProbesStartupProbeProbe(TypedDict, total=False): - exec: Optional[ProbesStartupProbeProbeExec] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" - """ - - failure_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" - """ - - http_get: Optional[ProbesStartupProbeProbeHTTPGet] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" - """ - - initial_delay_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" - """ - - period_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" - """ - - success_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" - """ - - tcp_socket: Optional[ProbesStartupProbeProbeTcpSocket] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" - """ - - timeout_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" - """ - - -class ProbesStartupProbe(TypedDict, total=False): - enabled: Required[bool] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" - """ - - probe: Optional[ProbesStartupProbeProbe] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" - """ - - class Probes(TypedDict, total=False): - liveness_probe: Optional[ProbesLivenessProbe] + liveness_probe: Optional[ContainerProbeConfigCreateParam] """ '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/liveness_probe/anyOf/0' "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.liveness_probe.anyOf[0]" """ - readiness_probe: Optional[ProbesReadinessProbe] + readiness_probe: Optional[ContainerProbeConfigCreateParam] """ '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/readiness_probe/anyOf/0' "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.readiness_probe.anyOf[0]" """ - startup_probe: Optional[ProbesStartupProbe] + startup_probe: Optional[ContainerProbeConfigCreateParam] """ '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/startup_probe/anyOf/0' "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.startup_probe.anyOf[0]" diff --git a/src/gcore/types/cloud/inference/deployment_update_params.py b/src/gcore/types/cloud/inference/deployment_update_params.py index 5fe57807..a9a628ed 100644 --- a/src/gcore/types/cloud/inference/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -7,6 +7,8 @@ from ...._utils import PropertyInfo from ..ingress_opts_param import IngressOptsParam +from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam +from ..container_probe_config_create_param import ContainerProbeConfigCreateParam __all__ = [ "DeploymentUpdateParams", @@ -20,23 +22,7 @@ "ContainerScaleTriggersMemory", "ContainerScaleTriggersSqs", "Logging", - "LoggingRetentionPolicy", "Probes", - "ProbesLivenessProbe", - "ProbesLivenessProbeProbe", - "ProbesLivenessProbeProbeExec", - "ProbesLivenessProbeProbeHTTPGet", - "ProbesLivenessProbeProbeTcpSocket", - "ProbesReadinessProbe", - "ProbesReadinessProbeProbe", - "ProbesReadinessProbeProbeExec", - "ProbesReadinessProbeProbeHTTPGet", - "ProbesReadinessProbeProbeTcpSocket", - "ProbesStartupProbe", - "ProbesStartupProbeProbe", - "ProbesStartupProbeProbeExec", - "ProbesStartupProbeProbeHTTPGet", - "ProbesStartupProbeProbeTcpSocket", ] @@ -306,14 +292,6 @@ class Container(TypedDict, total=False): """ -class LoggingRetentionPolicy(TypedDict, total=False): - period: Required[Optional[int]] - """ - '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' - "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" - """ - - class Logging(TypedDict, total=False): destination_region_id: Optional[int] """ @@ -327,7 +305,7 @@ class Logging(TypedDict, total=False): "$.components.schemas.LoggingInSerializer.properties.enabled" """ - retention_policy: Optional[LoggingRetentionPolicy] + retention_policy: Optional[LaasIndexRetentionPolicyParam] """ '#/components/schemas/LoggingInSerializer/properties/retention_policy/anyOf/0' "$.components.schemas.LoggingInSerializer.properties.retention_policy.anyOf[0]" @@ -340,356 +318,20 @@ class Logging(TypedDict, total=False): """ -class ProbesLivenessProbeProbeExec(TypedDict, total=False): - command: Required[List[str]] - """ - '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' - "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" - """ - - -class ProbesLivenessProbeProbeHTTPGet(TypedDict, total=False): - port: Required[int] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" - """ - - headers: Dict[str, str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" - """ - - host: Optional[str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" - """ - - path: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" - """ - - schema: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" - """ - - -class ProbesLivenessProbeProbeTcpSocket(TypedDict, total=False): - port: Required[int] - """ - '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" - """ - - -class ProbesLivenessProbeProbe(TypedDict, total=False): - exec: Optional[ProbesLivenessProbeProbeExec] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" - """ - - failure_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" - """ - - http_get: Optional[ProbesLivenessProbeProbeHTTPGet] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" - """ - - initial_delay_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" - """ - - period_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" - """ - - success_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" - """ - - tcp_socket: Optional[ProbesLivenessProbeProbeTcpSocket] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" - """ - - timeout_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" - """ - - -class ProbesLivenessProbe(TypedDict, total=False): - enabled: Required[bool] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" - """ - - probe: Optional[ProbesLivenessProbeProbe] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" - """ - - -class ProbesReadinessProbeProbeExec(TypedDict, total=False): - command: Required[List[str]] - """ - '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' - "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" - """ - - -class ProbesReadinessProbeProbeHTTPGet(TypedDict, total=False): - port: Required[int] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" - """ - - headers: Dict[str, str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" - """ - - host: Optional[str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" - """ - - path: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" - """ - - schema: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" - """ - - -class ProbesReadinessProbeProbeTcpSocket(TypedDict, total=False): - port: Required[int] - """ - '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" - """ - - -class ProbesReadinessProbeProbe(TypedDict, total=False): - exec: Optional[ProbesReadinessProbeProbeExec] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" - """ - - failure_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" - """ - - http_get: Optional[ProbesReadinessProbeProbeHTTPGet] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" - """ - - initial_delay_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" - """ - - period_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" - """ - - success_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" - """ - - tcp_socket: Optional[ProbesReadinessProbeProbeTcpSocket] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" - """ - - timeout_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" - """ - - -class ProbesReadinessProbe(TypedDict, total=False): - enabled: Required[bool] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" - """ - - probe: Optional[ProbesReadinessProbeProbe] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" - """ - - -class ProbesStartupProbeProbeExec(TypedDict, total=False): - command: Required[List[str]] - """ - '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' - "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" - """ - - -class ProbesStartupProbeProbeHTTPGet(TypedDict, total=False): - port: Required[int] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" - """ - - headers: Dict[str, str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" - """ - - host: Optional[str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" - """ - - path: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" - """ - - schema: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" - """ - - -class ProbesStartupProbeProbeTcpSocket(TypedDict, total=False): - port: Required[int] - """ - '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" - """ - - -class ProbesStartupProbeProbe(TypedDict, total=False): - exec: Optional[ProbesStartupProbeProbeExec] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" - """ - - failure_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" - """ - - http_get: Optional[ProbesStartupProbeProbeHTTPGet] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" - """ - - initial_delay_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" - """ - - period_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" - """ - - success_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" - """ - - tcp_socket: Optional[ProbesStartupProbeProbeTcpSocket] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" - """ - - timeout_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" - """ - - -class ProbesStartupProbe(TypedDict, total=False): - enabled: Required[bool] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" - """ - - probe: Optional[ProbesStartupProbeProbe] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" - """ - - class Probes(TypedDict, total=False): - liveness_probe: Optional[ProbesLivenessProbe] + liveness_probe: Optional[ContainerProbeConfigCreateParam] """ '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/liveness_probe/anyOf/0' "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.liveness_probe.anyOf[0]" """ - readiness_probe: Optional[ProbesReadinessProbe] + readiness_probe: Optional[ContainerProbeConfigCreateParam] """ '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/readiness_probe/anyOf/0' "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.readiness_probe.anyOf[0]" """ - startup_probe: Optional[ProbesStartupProbe] + startup_probe: Optional[ContainerProbeConfigCreateParam] """ '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/startup_probe/anyOf/0' "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.startup_probe.anyOf[0]" diff --git a/src/gcore/types/cloud/instance.py b/src/gcore/types/cloud/instance.py index ff204cc3..49b5f6ae 100644 --- a/src/gcore/types/cloud/instance.py +++ b/src/gcore/types/cloud/instance.py @@ -4,19 +4,18 @@ from datetime import datetime from typing_extensions import Literal, TypeAlias -from pydantic import Field as FieldInfo - from .tag import Tag from ..._models import BaseModel from .ddos_profile import DDOSProfile from .fixed_address import FixedAddress +from .blackhole_port import BlackholePort from .floating_address import FloatingAddress +from .instance_isolation import InstanceIsolation from .fixed_address_short import FixedAddressShort __all__ = [ "Instance", "Address", - "BlackholePort", "FixedIPAssignment", "Flavor", "FlavorInstanceFlavorSerializer", @@ -25,7 +24,6 @@ "FlavorBareMetalFlavorSerializerHardwareDescription", "FlavorDeprecatedGPUClusterFlavorSerializer", "FlavorDeprecatedGPUClusterFlavorSerializerHardwareDescription", - "InstanceIsolation", "SecurityGroup", "Volume", ] @@ -33,81 +31,6 @@ Address: TypeAlias = Union[FloatingAddress, FixedAddressShort, FixedAddress] -class BlackholePort(BaseModel): - alarm_end: datetime = FieldInfo(alias="AlarmEnd") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlarmEnd' - "$.components.schemas.BlackholePortSerializer.properties.AlarmEnd" - """ - - alarm_start: datetime = FieldInfo(alias="AlarmStart") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlarmStart' - "$.components.schemas.BlackholePortSerializer.properties.AlarmStart" - """ - - alarm_state: Literal[ - "ACK_REQ", - "ALARM", - "ARCHIVED", - "CLEAR", - "CLEARING", - "CLEARING_FAIL", - "END_GRACE", - "END_WAIT", - "MANUAL_CLEAR", - "MANUAL_CLEARING", - "MANUAL_CLEARING_FAIL", - "MANUAL_MITIGATING", - "MANUAL_STARTING", - "MANUAL_STARTING_FAIL", - "MITIGATING", - "STARTING", - "STARTING_FAIL", - "START_WAIT", - "ack_req", - "alarm", - "archived", - "clear", - "clearing", - "clearing_fail", - "end_grace", - "end_wait", - "manual_clear", - "manual_clearing", - "manual_clearing_fail", - "manual_mitigating", - "manual_starting", - "manual_starting_fail", - "mitigating", - "start_wait", - "starting", - "starting_fail", - ] = FieldInfo(alias="AlarmState") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlarmState' - "$.components.schemas.BlackholePortSerializer.properties.AlarmState" - """ - - alert_duration: str = FieldInfo(alias="AlertDuration") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlertDuration' - "$.components.schemas.BlackholePortSerializer.properties.AlertDuration" - """ - - destination_ip: str = FieldInfo(alias="DestinationIP") - """ - '#/components/schemas/BlackholePortSerializer/properties/DestinationIP' - "$.components.schemas.BlackholePortSerializer.properties.DestinationIP" - """ - - id: int = FieldInfo(alias="ID") - """ - '#/components/schemas/BlackholePortSerializer/properties/ID' - "$.components.schemas.BlackholePortSerializer.properties.ID" - """ - - class FixedIPAssignment(BaseModel): external: bool """ @@ -361,14 +284,6 @@ class FlavorDeprecatedGPUClusterFlavorSerializer(BaseModel): ] -class InstanceIsolation(BaseModel): - reason: Optional[str] = None - """ - '#/components/schemas/IsolationSerializer/properties/reason/anyOf/0' - "$.components.schemas.IsolationSerializer.properties.reason.anyOf[0]" - """ - - class SecurityGroup(BaseModel): name: str """ diff --git a/src/gcore/types/cloud/instance_interface.py b/src/gcore/types/cloud/instance_interface.py index 3ffc7f9a..55e38f55 100644 --- a/src/gcore/types/cloud/instance_interface.py +++ b/src/gcore/types/cloud/instance_interface.py @@ -1,156 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Optional -from datetime import datetime -from .tag import Tag -from .subnet import Subnet from ..._models import BaseModel from .floating_ip import FloatingIP +from .ip_assignment import IPAssignment +from .network_details import NetworkDetails +from .allowed_address_pairs import AllowedAddressPairs -__all__ = ["InstanceInterface", "AllowedAddressPair", "IPAssignment", "NetworkDetails"] - - -class AllowedAddressPair(BaseModel): - ip_address: str - """ - '#/components/schemas/AllowedAddressPairsSerializer/properties/ip_address/anyOf/0' - "$.components.schemas.AllowedAddressPairsSerializer.properties.ip_address.anyOf[0]" - """ - - mac_address: Optional[str] = None - """ - '#/components/schemas/AllowedAddressPairsSerializer/properties/mac_address/anyOf/0' - "$.components.schemas.AllowedAddressPairsSerializer.properties.mac_address.anyOf[0]" - """ - - -class IPAssignment(BaseModel): - ip_address: str - """ - '#/components/schemas/PortIpSubnetIdSerializer/properties/ip_address' - "$.components.schemas.PortIpSubnetIdSerializer.properties.ip_address" - """ - - subnet_id: str - """ - '#/components/schemas/PortIpSubnetIdSerializer/properties/subnet_id' - "$.components.schemas.PortIpSubnetIdSerializer.properties.subnet_id" - """ - - -class NetworkDetails(BaseModel): - id: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/id' - "$.components.schemas.NetworkSubnetworkSerializer.properties.id" - """ - - created_at: datetime - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/created_at' - "$.components.schemas.NetworkSubnetworkSerializer.properties.created_at" - """ - - external: bool - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/external' - "$.components.schemas.NetworkSubnetworkSerializer.properties.external" - """ - - name: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/name' - "$.components.schemas.NetworkSubnetworkSerializer.properties.name" - """ - - port_security_enabled: bool - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/port_security_enabled' - "$.components.schemas.NetworkSubnetworkSerializer.properties.port_security_enabled" - """ - - region: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/region' - "$.components.schemas.NetworkSubnetworkSerializer.properties.region" - """ - - region_id: int - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/region_id' - "$.components.schemas.NetworkSubnetworkSerializer.properties.region_id" - """ - - shared: bool - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/shared' - "$.components.schemas.NetworkSubnetworkSerializer.properties.shared" - """ - - tags: List[Tag] - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/tags' - "$.components.schemas.NetworkSubnetworkSerializer.properties.tags" - """ - - type: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/type' - "$.components.schemas.NetworkSubnetworkSerializer.properties.type" - """ - - updated_at: datetime - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/updated_at' - "$.components.schemas.NetworkSubnetworkSerializer.properties.updated_at" - """ - - creator_task_id: Optional[str] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.creator_task_id.anyOf[0]" - """ - - default: Optional[bool] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/default/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties['default'].anyOf[0]" - """ - - mtu: Optional[int] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/mtu' - "$.components.schemas.NetworkSubnetworkSerializer.properties.mtu" - """ - - project_id: Optional[int] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/project_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.project_id.anyOf[0]" - """ - - segmentation_id: Optional[int] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/segmentation_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.segmentation_id.anyOf[0]" - """ - - subnets: Optional[List[Subnet]] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/subnets/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.subnets.anyOf[0]" - """ - - task_id: Optional[str] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/task_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.task_id.anyOf[0]" - """ +__all__ = ["InstanceInterface"] class InstanceInterface(BaseModel): - allowed_address_pairs: List[AllowedAddressPair] + allowed_address_pairs: List[AllowedAddressPairs] """ '#/components/schemas/InstanceInterfaceSerializer/properties/allowed_address_pairs' "$.components.schemas.InstanceInterfaceSerializer.properties.allowed_address_pairs" diff --git a/src/gcore/types/cloud/instance_isolation.py b/src/gcore/types/cloud/instance_isolation.py new file mode 100644 index 00000000..0ba971a5 --- /dev/null +++ b/src/gcore/types/cloud/instance_isolation.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["InstanceIsolation"] + + +class InstanceIsolation(BaseModel): + reason: Optional[str] = None + """ + '#/components/schemas/IsolationSerializer/properties/reason/anyOf/0' + "$.components.schemas.IsolationSerializer.properties.reason.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/ip_assignment.py b/src/gcore/types/cloud/ip_assignment.py new file mode 100644 index 00000000..44998d10 --- /dev/null +++ b/src/gcore/types/cloud/ip_assignment.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["IPAssignment"] + + +class IPAssignment(BaseModel): + ip_address: str + """ + '#/components/schemas/PortIpSubnetIdSerializer/properties/ip_address' + "$.components.schemas.PortIpSubnetIdSerializer.properties.ip_address" + """ + + subnet_id: str + """ + '#/components/schemas/PortIpSubnetIdSerializer/properties/subnet_id' + "$.components.schemas.PortIpSubnetIdSerializer.properties.subnet_id" + """ diff --git a/src/gcore/types/cloud/laas_index_retention_policy.py b/src/gcore/types/cloud/laas_index_retention_policy.py new file mode 100644 index 00000000..5e80c8c8 --- /dev/null +++ b/src/gcore/types/cloud/laas_index_retention_policy.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["LaasIndexRetentionPolicy"] + + +class LaasIndexRetentionPolicy(BaseModel): + period: Optional[int] = None + """ + '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' + "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/laas_index_retention_policy_param.py b/src/gcore/types/cloud/laas_index_retention_policy_param.py new file mode 100644 index 00000000..36c0137c --- /dev/null +++ b/src/gcore/types/cloud/laas_index_retention_policy_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +__all__ = ["LaasIndexRetentionPolicyParam"] + + +class LaasIndexRetentionPolicyParam(TypedDict, total=False): + period: Required[Optional[int]] + """ + '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' + "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 315cd360..fae9664d 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -13,6 +13,7 @@ from .lb_listener_protocol import LbListenerProtocol from .tag_update_list_param import TagUpdateListParam from .session_persistence_type import SessionPersistenceType +from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity __all__ = [ @@ -27,7 +28,6 @@ "ListenerPoolSessionPersistence", "ListenerUserList", "Logging", - "LoggingRetentionPolicy", ] @@ -450,14 +450,6 @@ class Listener(TypedDict, total=False): """ -class LoggingRetentionPolicy(TypedDict, total=False): - period: Required[Optional[int]] - """ - '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' - "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" - """ - - class Logging(TypedDict, total=False): destination_region_id: Optional[int] """ @@ -471,7 +463,7 @@ class Logging(TypedDict, total=False): "$.components.schemas.LoadbalancerLoggingSerializer.properties.enabled" """ - retention_policy: Optional[LoggingRetentionPolicy] + retention_policy: Optional[LaasIndexRetentionPolicyParam] """ '#/components/schemas/LoadbalancerLoggingSerializer/properties/retention_policy/anyOf/0' "$.components.schemas.LoadbalancerLoggingSerializer.properties.retention_policy.anyOf[0]" diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py index 22333abb..b5bb50ae 100644 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -3,11 +3,12 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Required, TypedDict +from typing_extensions import TypedDict +from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity -__all__ = ["LoadBalancerUpdateParams", "Logging", "LoggingRetentionPolicy"] +__all__ = ["LoadBalancerUpdateParams", "Logging"] class LoadBalancerUpdateParams(TypedDict, total=False): @@ -42,14 +43,6 @@ class LoadBalancerUpdateParams(TypedDict, total=False): """ -class LoggingRetentionPolicy(TypedDict, total=False): - period: Required[Optional[int]] - """ - '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' - "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" - """ - - class Logging(TypedDict, total=False): destination_region_id: Optional[int] """ @@ -63,7 +56,7 @@ class Logging(TypedDict, total=False): "$.components.schemas.LoadbalancerLoggingSerializer.properties.enabled" """ - retention_policy: Optional[LoggingRetentionPolicy] + retention_policy: Optional[LaasIndexRetentionPolicyParam] """ '#/components/schemas/LoadbalancerLoggingSerializer/properties/retention_policy/anyOf/0' "$.components.schemas.LoadbalancerLoggingSerializer.properties.retention_policy.anyOf[0]" diff --git a/src/gcore/types/cloud/logging.py b/src/gcore/types/cloud/logging.py index 341eeb99..ca864c4b 100644 --- a/src/gcore/types/cloud/logging.py +++ b/src/gcore/types/cloud/logging.py @@ -3,16 +3,9 @@ from typing import Optional from ..._models import BaseModel +from .laas_index_retention_policy import LaasIndexRetentionPolicy -__all__ = ["Logging", "RetentionPolicy"] - - -class RetentionPolicy(BaseModel): - period: Optional[int] = None - """ - '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' - "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" - """ +__all__ = ["Logging"] class Logging(BaseModel): @@ -34,7 +27,7 @@ class Logging(BaseModel): "$.components.schemas.LoggingOutSerializer.properties.topic_name.anyOf[0]" """ - retention_policy: Optional[RetentionPolicy] = None + retention_policy: Optional[LaasIndexRetentionPolicy] = None """ '#/components/schemas/LoggingOutSerializer/properties/retention_policy/anyOf/0' "$.components.schemas.LoggingOutSerializer.properties.retention_policy.anyOf[0]" diff --git a/src/gcore/types/cloud/network_details.py b/src/gcore/types/cloud/network_details.py new file mode 100644 index 00000000..3cf38a5e --- /dev/null +++ b/src/gcore/types/cloud/network_details.py @@ -0,0 +1,120 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from .tag import Tag +from .subnet import Subnet +from ..._models import BaseModel + +__all__ = ["NetworkDetails"] + + +class NetworkDetails(BaseModel): + id: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/id' + "$.components.schemas.NetworkSubnetworkSerializer.properties.id" + """ + + created_at: datetime + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/created_at' + "$.components.schemas.NetworkSubnetworkSerializer.properties.created_at" + """ + + external: bool + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/external' + "$.components.schemas.NetworkSubnetworkSerializer.properties.external" + """ + + name: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/name' + "$.components.schemas.NetworkSubnetworkSerializer.properties.name" + """ + + port_security_enabled: bool + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/port_security_enabled' + "$.components.schemas.NetworkSubnetworkSerializer.properties.port_security_enabled" + """ + + region: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/region' + "$.components.schemas.NetworkSubnetworkSerializer.properties.region" + """ + + region_id: int + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/region_id' + "$.components.schemas.NetworkSubnetworkSerializer.properties.region_id" + """ + + shared: bool + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/shared' + "$.components.schemas.NetworkSubnetworkSerializer.properties.shared" + """ + + tags: List[Tag] + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/tags' + "$.components.schemas.NetworkSubnetworkSerializer.properties.tags" + """ + + type: str + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/type' + "$.components.schemas.NetworkSubnetworkSerializer.properties.type" + """ + + updated_at: datetime + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/updated_at' + "$.components.schemas.NetworkSubnetworkSerializer.properties.updated_at" + """ + + creator_task_id: Optional[str] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/creator_task_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.creator_task_id.anyOf[0]" + """ + + default: Optional[bool] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/default/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties['default'].anyOf[0]" + """ + + mtu: Optional[int] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/mtu' + "$.components.schemas.NetworkSubnetworkSerializer.properties.mtu" + """ + + project_id: Optional[int] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/project_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.project_id.anyOf[0]" + """ + + segmentation_id: Optional[int] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/segmentation_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.segmentation_id.anyOf[0]" + """ + + subnets: Optional[List[Subnet]] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/subnets/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.subnets.anyOf[0]" + """ + + task_id: Optional[str] = None + """ + '#/components/schemas/NetworkSubnetworkSerializer/properties/task_id/anyOf/0' + "$.components.schemas.NetworkSubnetworkSerializer.properties.task_id.anyOf[0]" + """ diff --git a/src/gcore/types/cloud/network_interface.py b/src/gcore/types/cloud/network_interface.py index 741964cc..f9763b43 100644 --- a/src/gcore/types/cloud/network_interface.py +++ b/src/gcore/types/cloud/network_interface.py @@ -1,303 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Optional -from datetime import datetime -from .tag import Tag -from .subnet import Subnet from ..._models import BaseModel from .floating_ip import FloatingIP +from .ip_assignment import IPAssignment +from .network_details import NetworkDetails +from .allowed_address_pairs import AllowedAddressPairs -__all__ = [ - "NetworkInterface", - "AllowedAddressPair", - "IPAssignment", - "NetworkDetails", - "SubPort", - "SubPortAllowedAddressPair", - "SubPortIPAssignment", - "SubPortNetworkDetails", -] - - -class AllowedAddressPair(BaseModel): - ip_address: str - """ - '#/components/schemas/AllowedAddressPairsSerializer/properties/ip_address/anyOf/0' - "$.components.schemas.AllowedAddressPairsSerializer.properties.ip_address.anyOf[0]" - """ - - mac_address: Optional[str] = None - """ - '#/components/schemas/AllowedAddressPairsSerializer/properties/mac_address/anyOf/0' - "$.components.schemas.AllowedAddressPairsSerializer.properties.mac_address.anyOf[0]" - """ - - -class IPAssignment(BaseModel): - ip_address: str - """ - '#/components/schemas/PortIpSubnetIdSerializer/properties/ip_address' - "$.components.schemas.PortIpSubnetIdSerializer.properties.ip_address" - """ - - subnet_id: str - """ - '#/components/schemas/PortIpSubnetIdSerializer/properties/subnet_id' - "$.components.schemas.PortIpSubnetIdSerializer.properties.subnet_id" - """ - - -class NetworkDetails(BaseModel): - id: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/id' - "$.components.schemas.NetworkSubnetworkSerializer.properties.id" - """ - - created_at: datetime - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/created_at' - "$.components.schemas.NetworkSubnetworkSerializer.properties.created_at" - """ - - external: bool - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/external' - "$.components.schemas.NetworkSubnetworkSerializer.properties.external" - """ - - name: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/name' - "$.components.schemas.NetworkSubnetworkSerializer.properties.name" - """ - - port_security_enabled: bool - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/port_security_enabled' - "$.components.schemas.NetworkSubnetworkSerializer.properties.port_security_enabled" - """ - - region: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/region' - "$.components.schemas.NetworkSubnetworkSerializer.properties.region" - """ - - region_id: int - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/region_id' - "$.components.schemas.NetworkSubnetworkSerializer.properties.region_id" - """ - - shared: bool - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/shared' - "$.components.schemas.NetworkSubnetworkSerializer.properties.shared" - """ - - tags: List[Tag] - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/tags' - "$.components.schemas.NetworkSubnetworkSerializer.properties.tags" - """ - - type: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/type' - "$.components.schemas.NetworkSubnetworkSerializer.properties.type" - """ - - updated_at: datetime - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/updated_at' - "$.components.schemas.NetworkSubnetworkSerializer.properties.updated_at" - """ - - creator_task_id: Optional[str] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.creator_task_id.anyOf[0]" - """ - - default: Optional[bool] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/default/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties['default'].anyOf[0]" - """ - - mtu: Optional[int] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/mtu' - "$.components.schemas.NetworkSubnetworkSerializer.properties.mtu" - """ - - project_id: Optional[int] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/project_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.project_id.anyOf[0]" - """ - - segmentation_id: Optional[int] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/segmentation_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.segmentation_id.anyOf[0]" - """ - - subnets: Optional[List[Subnet]] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/subnets/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.subnets.anyOf[0]" - """ - - task_id: Optional[str] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/task_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.task_id.anyOf[0]" - """ - - -class SubPortAllowedAddressPair(BaseModel): - ip_address: str - """ - '#/components/schemas/AllowedAddressPairsSerializer/properties/ip_address/anyOf/0' - "$.components.schemas.AllowedAddressPairsSerializer.properties.ip_address.anyOf[0]" - """ - - mac_address: Optional[str] = None - """ - '#/components/schemas/AllowedAddressPairsSerializer/properties/mac_address/anyOf/0' - "$.components.schemas.AllowedAddressPairsSerializer.properties.mac_address.anyOf[0]" - """ - - -class SubPortIPAssignment(BaseModel): - ip_address: str - """ - '#/components/schemas/PortIpSubnetIdSerializer/properties/ip_address' - "$.components.schemas.PortIpSubnetIdSerializer.properties.ip_address" - """ - - subnet_id: str - """ - '#/components/schemas/PortIpSubnetIdSerializer/properties/subnet_id' - "$.components.schemas.PortIpSubnetIdSerializer.properties.subnet_id" - """ - - -class SubPortNetworkDetails(BaseModel): - id: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/id' - "$.components.schemas.NetworkSubnetworkSerializer.properties.id" - """ - - created_at: datetime - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/created_at' - "$.components.schemas.NetworkSubnetworkSerializer.properties.created_at" - """ - - external: bool - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/external' - "$.components.schemas.NetworkSubnetworkSerializer.properties.external" - """ - - name: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/name' - "$.components.schemas.NetworkSubnetworkSerializer.properties.name" - """ - - port_security_enabled: bool - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/port_security_enabled' - "$.components.schemas.NetworkSubnetworkSerializer.properties.port_security_enabled" - """ - - region: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/region' - "$.components.schemas.NetworkSubnetworkSerializer.properties.region" - """ - - region_id: int - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/region_id' - "$.components.schemas.NetworkSubnetworkSerializer.properties.region_id" - """ - - shared: bool - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/shared' - "$.components.schemas.NetworkSubnetworkSerializer.properties.shared" - """ - - tags: List[Tag] - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/tags' - "$.components.schemas.NetworkSubnetworkSerializer.properties.tags" - """ - - type: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/type' - "$.components.schemas.NetworkSubnetworkSerializer.properties.type" - """ - - updated_at: datetime - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/updated_at' - "$.components.schemas.NetworkSubnetworkSerializer.properties.updated_at" - """ - - creator_task_id: Optional[str] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.creator_task_id.anyOf[0]" - """ - - default: Optional[bool] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/default/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties['default'].anyOf[0]" - """ - - mtu: Optional[int] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/mtu' - "$.components.schemas.NetworkSubnetworkSerializer.properties.mtu" - """ - - project_id: Optional[int] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/project_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.project_id.anyOf[0]" - """ - - segmentation_id: Optional[int] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/segmentation_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.segmentation_id.anyOf[0]" - """ - - subnets: Optional[List[Subnet]] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/subnets/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.subnets.anyOf[0]" - """ - - task_id: Optional[str] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/task_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.task_id.anyOf[0]" - """ +__all__ = ["NetworkInterface", "SubPort"] class SubPort(BaseModel): - allowed_address_pairs: List[SubPortAllowedAddressPair] + allowed_address_pairs: List[AllowedAddressPairs] """ '#/components/schemas/InstanceInterfaceSubportSerializer/properties/allowed_address_pairs' "$.components.schemas.InstanceInterfaceSubportSerializer.properties.allowed_address_pairs" @@ -309,13 +24,13 @@ class SubPort(BaseModel): "$.components.schemas.InstanceInterfaceSubportSerializer.properties.floatingip_details" """ - ip_assignments: List[SubPortIPAssignment] + ip_assignments: List[IPAssignment] """ '#/components/schemas/InstanceInterfaceSubportSerializer/properties/ip_assignments' "$.components.schemas.InstanceInterfaceSubportSerializer.properties.ip_assignments" """ - network_details: SubPortNetworkDetails + network_details: NetworkDetails """ '#/components/schemas/InstanceInterfaceSubportSerializer/properties/network_details' "$.components.schemas.InstanceInterfaceSubportSerializer.properties.network_details" @@ -365,7 +80,7 @@ class SubPort(BaseModel): class NetworkInterface(BaseModel): - allowed_address_pairs: List[AllowedAddressPair] + allowed_address_pairs: List[AllowedAddressPairs] """ '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/allowed_address_pairs' "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.allowed_address_pairs" diff --git a/src/gcore/types/cloud/networks/router.py b/src/gcore/types/cloud/networks/router.py index dc4e9a36..9471d222 100644 --- a/src/gcore/types/cloud/networks/router.py +++ b/src/gcore/types/cloud/networks/router.py @@ -5,26 +5,13 @@ from ..route import Route from ...._models import BaseModel +from ..ip_assignment import IPAssignment -__all__ = ["Router", "Interface", "InterfaceIPAssignment", "ExternalGatewayInfo", "ExternalGatewayInfoExternalFixedIP"] - - -class InterfaceIPAssignment(BaseModel): - ip_address: str - """ - '#/components/schemas/PortIpSubnetIdSerializer/properties/ip_address' - "$.components.schemas.PortIpSubnetIdSerializer.properties.ip_address" - """ - - subnet_id: str - """ - '#/components/schemas/PortIpSubnetIdSerializer/properties/subnet_id' - "$.components.schemas.PortIpSubnetIdSerializer.properties.subnet_id" - """ +__all__ = ["Router", "Interface", "ExternalGatewayInfo"] class Interface(BaseModel): - ip_assignments: List[InterfaceIPAssignment] + ip_assignments: List[IPAssignment] """ '#/components/schemas/PortSerializer/properties/ip_assignments' "$.components.schemas.PortSerializer.properties.ip_assignments" @@ -49,20 +36,6 @@ class Interface(BaseModel): """ -class ExternalGatewayInfoExternalFixedIP(BaseModel): - ip_address: str - """ - '#/components/schemas/PortIpSubnetIdSerializer/properties/ip_address' - "$.components.schemas.PortIpSubnetIdSerializer.properties.ip_address" - """ - - subnet_id: str - """ - '#/components/schemas/PortIpSubnetIdSerializer/properties/subnet_id' - "$.components.schemas.PortIpSubnetIdSerializer.properties.subnet_id" - """ - - class ExternalGatewayInfo(BaseModel): enable_snat: bool """ @@ -70,7 +43,7 @@ class ExternalGatewayInfo(BaseModel): "$.components.schemas.ExternalGatewaySerializer.properties.enable_snat" """ - external_fixed_ips: List[ExternalGatewayInfoExternalFixedIP] + external_fixed_ips: List[IPAssignment] """ '#/components/schemas/ExternalGatewaySerializer/properties/external_fixed_ips' "$.components.schemas.ExternalGatewaySerializer.properties.external_fixed_ips" diff --git a/src/gcore/types/cloud/reserved_fixed_ip.py b/src/gcore/types/cloud/reserved_fixed_ip.py index be129da5..178ac436 100644 --- a/src/gcore/types/cloud/reserved_fixed_ip.py +++ b/src/gcore/types/cloud/reserved_fixed_ip.py @@ -5,22 +5,9 @@ from .network import Network from ..._models import BaseModel +from .allowed_address_pairs import AllowedAddressPairs -__all__ = ["ReservedFixedIP", "AllowedAddressPair", "Attachment", "Reservation"] - - -class AllowedAddressPair(BaseModel): - ip_address: str - """ - '#/components/schemas/AllowedAddressPairsSerializer/properties/ip_address/anyOf/0' - "$.components.schemas.AllowedAddressPairsSerializer.properties.ip_address.anyOf[0]" - """ - - mac_address: Optional[str] = None - """ - '#/components/schemas/AllowedAddressPairsSerializer/properties/mac_address/anyOf/0' - "$.components.schemas.AllowedAddressPairsSerializer.properties.mac_address.anyOf[0]" - """ +__all__ = ["ReservedFixedIP", "Attachment", "Reservation"] class Attachment(BaseModel): @@ -58,7 +45,7 @@ class Reservation(BaseModel): class ReservedFixedIP(BaseModel): - allowed_address_pairs: List[AllowedAddressPair] + allowed_address_pairs: List[AllowedAddressPairs] """ '#/components/schemas/ReservedFixedIPSerializer/properties/allowed_address_pairs' "$.components.schemas.ReservedFixedIPSerializer.properties.allowed_address_pairs" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/__init__.py b/src/gcore/types/cloud/reserved_fixed_ips/__init__.py index 2c8fdba1..a437e01d 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/__init__.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/__init__.py @@ -2,9 +2,9 @@ from __future__ import annotations -from .ip_assignment import IPAssignment as IPAssignment from .candidate_port import CandidatePort as CandidatePort from .connected_port import ConnectedPort as ConnectedPort +from .ip_with_subnet import IPWithSubnet as IPWithSubnet from .vip_toggle_params import VipToggleParams as VipToggleParams from .candidate_port_list import CandidatePortList as CandidatePortList from .connected_port_list import ConnectedPortList as ConnectedPortList diff --git a/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py b/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py index 088f1dd2..cb211f4c 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py @@ -4,7 +4,7 @@ from ..network import Network from ...._models import BaseModel -from .ip_assignment import IPAssignment +from .ip_with_subnet import IPWithSubnet __all__ = ["CandidatePort"] @@ -22,7 +22,7 @@ class CandidatePort(BaseModel): "$.components.schemas.VIPAttachCandidateSerializer.properties.instance_name" """ - ip_assignments: List[IPAssignment] + ip_assignments: List[IPWithSubnet] """ '#/components/schemas/VIPAttachCandidateSerializer/properties/ip_assignments' "$.components.schemas.VIPAttachCandidateSerializer.properties.ip_assignments" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py b/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py index ec5bcb5c..0b3de37d 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py @@ -4,7 +4,7 @@ from ..network import Network from ...._models import BaseModel -from .ip_assignment import IPAssignment +from .ip_with_subnet import IPWithSubnet __all__ = ["ConnectedPort"] @@ -22,7 +22,7 @@ class ConnectedPort(BaseModel): "$.components.schemas.ConnectedDevicesVIPSerializer.properties.instance_name" """ - ip_assignments: List[IPAssignment] + ip_assignments: List[IPWithSubnet] """ '#/components/schemas/ConnectedDevicesVIPSerializer/properties/ip_assignments' "$.components.schemas.ConnectedDevicesVIPSerializer.properties.ip_assignments" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/ip_assignment.py b/src/gcore/types/cloud/reserved_fixed_ips/ip_with_subnet.py similarity index 92% rename from src/gcore/types/cloud/reserved_fixed_ips/ip_assignment.py rename to src/gcore/types/cloud/reserved_fixed_ips/ip_with_subnet.py index 5b9c6604..be4e7937 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/ip_assignment.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/ip_with_subnet.py @@ -3,10 +3,10 @@ from ..subnet import Subnet from ...._models import BaseModel -__all__ = ["IPAssignment"] +__all__ = ["IPWithSubnet"] -class IPAssignment(BaseModel): +class IPWithSubnet(BaseModel): ip_address: str """ '#/components/schemas/PortIpWithSubnetSerializer/properties/ip_address' From 886f31f0c155d936817686e56adf3fcddee78bad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 15:36:06 +0000 Subject: [PATCH 092/592] feat(api): manual updates --- .github/workflows/ci.yml | 10 - .stats.yml | 2 +- .../resources/cloud/baremetal/flavors.py | 80 +-- src/gcore/resources/cloud/baremetal/images.py | 46 +- .../resources/cloud/baremetal/servers.py | 328 ++++----- .../resources/cloud/billing_reservations.py | 76 +- .../cloud/file_shares/access_rules.py | 72 +- .../cloud/file_shares/file_shares.py | 222 +++--- src/gcore/resources/cloud/floating_ips.py | 168 ++--- .../cloud/gpu_baremetal_clusters/flavors.py | 24 +- .../gpu_baremetal_clusters.py | 272 ++----- .../cloud/gpu_baremetal_clusters/images.py | 130 ++-- .../gpu_baremetal_clusters/interfaces.py | 18 - .../cloud/gpu_baremetal_clusters/servers.py | 338 ++------- .../inference/deployments/deployments.py | 310 ++++---- .../cloud/inference/deployments/logs.py | 38 +- .../resources/cloud/inference/flavors.py | 30 +- src/gcore/resources/cloud/inference/models.py | 36 +- .../cloud/inference/registry_credentials.py | 104 +-- .../resources/cloud/inference/secrets.py | 102 +-- .../resources/cloud/instances/flavors.py | 90 +-- src/gcore/resources/cloud/instances/images.py | 330 +++------ .../resources/cloud/instances/instances.py | 670 ++++++------------ .../resources/cloud/instances/interfaces.py | 270 ++----- .../resources/cloud/instances/metrics.py | 30 +- .../resources/cloud/load_balancers/flavors.py | 18 +- .../load_balancers/l7_policies/l7_policies.py | 200 ++---- .../cloud/load_balancers/l7_policies/rules.py | 188 +---- .../cloud/load_balancers/listeners.py | 238 ++----- .../cloud/load_balancers/load_balancers.py | 322 +++------ .../resources/cloud/load_balancers/metrics.py | 30 +- .../load_balancers/pools/health_monitors.py | 88 +-- .../cloud/load_balancers/pools/members.py | 94 +-- .../cloud/load_balancers/pools/pools.py | 256 ++----- .../cloud/load_balancers/statuses.py | 30 - .../resources/cloud/networks/networks.py | 150 +--- src/gcore/resources/cloud/networks/routers.py | 188 +---- src/gcore/resources/cloud/networks/subnets.py | 246 +++---- src/gcore/resources/cloud/placement_groups.py | 72 +- src/gcore/resources/cloud/projects.py | 100 +-- src/gcore/resources/cloud/quotas/quotas.py | 18 +- src/gcore/resources/cloud/quotas/requests.py | 50 +- src/gcore/resources/cloud/regions.py | 58 +- .../resources/cloud/registries/artifacts.py | 54 -- .../resources/cloud/registries/registries.py | 96 +-- .../cloud/registries/repositories.py | 42 -- src/gcore/resources/cloud/registries/tags.py | 36 - src/gcore/resources/cloud/registries/users.py | 168 +---- .../reserved_fixed_ips/reserved_fixed_ips.py | 266 ++----- .../resources/cloud/reserved_fixed_ips/vip.py | 108 +-- src/gcore/resources/cloud/secrets.py | 176 ++--- .../resources/cloud/security_groups/rules.py | 160 +---- .../cloud/security_groups/security_groups.py | 172 +---- src/gcore/resources/cloud/ssh_keys.py | 106 ++- src/gcore/resources/cloud/tasks.py | 224 ++++-- .../resources/cloud/users/role_assignments.py | 96 +-- src/gcore/resources/cloud/volumes.py | 502 ++++++------- .../types/cloud/allowed_address_pairs.py | 10 +- src/gcore/types/cloud/aws_iam_data.py | 10 +- src/gcore/types/cloud/aws_iam_data_param.py | 10 +- .../baremetal/baremetal_fixed_address.py | 28 +- .../baremetal/baremetal_floating_address.py | 10 +- .../types/cloud/baremetal/baremetal_server.py | 188 ++--- .../cloud/baremetal/flavor_list_params.py | 40 +- .../baremetal/flavor_list_suitable_params.py | 23 +- .../cloud/baremetal/image_list_params.py | 35 +- .../cloud/baremetal/server_create_params.py | 306 ++++---- .../cloud/baremetal/server_list_params.py | 125 ++-- .../cloud/baremetal/server_rebuild_params.py | 20 +- src/gcore/types/cloud/baremetal_flavor.py | 76 +- .../types/cloud/baremetal_flavor_list.py | 10 +- src/gcore/types/cloud/billing_reservation.py | 226 ++---- .../cloud/billing_reservation_list_params.py | 53 +- src/gcore/types/cloud/blackhole_port.py | 29 +- src/gcore/types/cloud/capacity.py | 10 +- src/gcore/types/cloud/console.py | 17 +- src/gcore/types/cloud/container_probe.py | 40 +- .../types/cloud/container_probe_config.py | 10 +- .../container_probe_config_create_param.py | 10 +- .../cloud/container_probe_create_param.py | 40 +- src/gcore/types/cloud/container_probe_exec.py | 5 +- .../container_probe_exec_create_param.py | 5 +- .../types/cloud/container_probe_http_get.py | 25 +- .../container_probe_http_get_create_param.py | 25 +- .../types/cloud/container_probe_tcp_socket.py | 5 +- ...container_probe_tcp_socket_create_param.py | 5 +- src/gcore/types/cloud/container_scale.py | 25 +- .../cloud/container_scale_trigger_rate.py | 10 +- .../cloud/container_scale_trigger_sqs.py | 40 +- .../container_scale_trigger_threshold.py | 5 +- .../types/cloud/container_scale_triggers.py | 32 +- src/gcore/types/cloud/ddos_profile.py | 36 +- src/gcore/types/cloud/ddos_profile_field.py | 44 -- .../types/cloud/ddos_profile_option_list.py | 10 +- src/gcore/types/cloud/ddos_profile_status.py | 10 +- .../types/cloud/ddos_profile_template.py | 16 - .../cloud/ddos_profile_template_field.py | 28 - src/gcore/types/cloud/deploy_status.py | 10 +- src/gcore/types/cloud/detailed_lb_pool.py | 107 +-- .../types/cloud/detailed_lb_pool_list.py | 10 +- .../types/cloud/detailed_lb_pool_member.py | 52 +- src/gcore/types/cloud/file_share.py | 103 +-- .../types/cloud/file_share_create_params.py | 111 +-- .../types/cloud/file_share_list_params.py | 21 +- .../types/cloud/file_share_resize_params.py | 15 +- .../types/cloud/file_share_update_params.py | 15 +- .../types/cloud/file_shares/access_rule.py | 20 +- .../file_shares/access_rule_create_params.py | 20 +- .../cloud/file_shares/access_rule_list.py | 10 +- src/gcore/types/cloud/fixed_address.py | 32 +- src/gcore/types/cloud/fixed_address_short.py | 18 +- .../cloud/flavor_hardware_description.py | 40 +- src/gcore/types/cloud/floating_address.py | 10 +- src/gcore/types/cloud/floating_ip.py | 93 +-- .../types/cloud/floating_ip_assign_params.py | 18 +- .../types/cloud/floating_ip_create_params.py | 28 +- src/gcore/types/cloud/floating_ip_detailed.py | 234 ++---- .../types/cloud/floating_ip_list_params.py | 33 +- .../types/cloud/gpu_baremetal_cluster.py | 130 +--- .../gpu_baremetal_cluster_create_params.py | 290 +++----- .../gpu_baremetal_cluster_delete_params.py | 25 +- .../gpu_baremetal_cluster_list_params.py | 18 +- .../gpu_baremetal_cluster_rebuild_params.py | 22 +- .../gpu_baremetal_cluster_resize_params.py | 13 +- .../flavor_list_params.py | 20 +- .../image_upload_params.py | 64 +- .../server_attach_interface_params.py | 317 ++------- .../server_delete_params.py | 18 +- .../server_detach_interface_params.py | 18 +- src/gcore/types/cloud/gpu_baremetal_flavor.py | 165 +---- .../types/cloud/gpu_baremetal_flavor_list.py | 10 +- src/gcore/types/cloud/gpu_cluster_server.py | 203 ++---- .../types/cloud/gpu_cluster_server_list.py | 10 +- src/gcore/types/cloud/gpu_image.py | 87 +-- src/gcore/types/cloud/gpu_image_list.py | 10 +- .../types/cloud/health_monitor_status.py | 20 +- src/gcore/types/cloud/image.py | 136 +--- src/gcore/types/cloud/image_list.py | 10 +- src/gcore/types/cloud/inference/container.py | 25 +- .../inference/deployment_create_params.py | 256 ++----- .../cloud/inference/deployment_list_params.py | 16 +- .../inference/deployment_update_params.py | 249 ++----- .../inference/deployments/log_list_params.py | 26 +- .../cloud/inference/flavor_list_params.py | 11 +- src/gcore/types/cloud/inference/inference.py | 107 ++- .../inference/inference_apikey_secret.py | 10 +- .../types/cloud/inference/inference_flavor.py | 45 +- .../types/cloud/inference/inference_log.py | 20 +- .../inference_registry_credential.py | 20 +- .../inference_registry_credential_full.py | 25 +- .../types/cloud/inference/inference_secret.py | 15 +- .../cloud/inference/mlcatalog_model_card.py | 90 +-- .../cloud/inference/model_list_params.py | 16 +- .../registry_credential_create_params.py | 25 +- .../registry_credential_list_params.py | 16 +- .../registry_credential_replace_params.py | 20 +- .../cloud/inference/secret_create_params.py | 20 +- .../cloud/inference/secret_list_params.py | 16 +- .../cloud/inference/secret_replace_params.py | 15 +- src/gcore/types/cloud/inference_probes.py | 15 +- src/gcore/types/cloud/ingress_opts_out.py | 9 +- src/gcore/types/cloud/ingress_opts_param.py | 9 +- src/gcore/types/cloud/instance.py | 328 ++------- .../types/cloud/instance_action_params.py | 31 +- .../instance_add_to_placement_group_params.py | 13 +- .../instance_assign_security_group_params.py | 28 +- .../types/cloud/instance_create_params.py | 414 +++++------ .../types/cloud/instance_delete_params.py | 32 +- .../cloud/instance_get_console_params.py | 13 +- src/gcore/types/cloud/instance_interface.py | 45 +- src/gcore/types/cloud/instance_isolation.py | 5 +- src/gcore/types/cloud/instance_list.py | 10 +- src/gcore/types/cloud/instance_list_params.py | 152 ++-- .../types/cloud/instance_resize_params.py | 13 +- ...instance_unassign_security_group_params.py | 28 +- .../types/cloud/instance_update_params.py | 15 +- .../flavor_list_for_resize_params.py | 13 +- .../cloud/instances/flavor_list_params.py | 28 +- .../instances/flavor_list_suitable_params.py | 64 +- .../image_create_from_volume_params.py | 63 +- .../types/cloud/instances/image_get_params.py | 13 +- .../cloud/instances/image_list_params.py | 35 +- .../cloud/instances/image_update_params.py | 48 +- .../cloud/instances/image_upload_params.py | 72 +- .../types/cloud/instances/instance_flavor.py | 65 +- .../cloud/instances/instance_flavor_list.py | 10 +- .../instances/interface_attach_params.py | 317 ++------- .../instances/interface_detach_params.py | 18 +- .../cloud/instances/metric_list_params.py | 20 +- src/gcore/types/cloud/instances/metrics.py | 65 +- .../types/cloud/instances/metrics_list.py | 10 +- src/gcore/types/cloud/ip_assignment.py | 10 +- src/gcore/types/cloud/ip_ranges.py | 5 +- src/gcore/types/cloud/l7_policy.py | 93 +-- src/gcore/types/cloud/l7_policy_list.py | 10 +- src/gcore/types/cloud/l7_rule.py | 69 +- src/gcore/types/cloud/l7_rule_list.py | 10 +- .../cloud/laas_index_retention_policy.py | 5 +- .../laas_index_retention_policy_param.py | 5 +- src/gcore/types/cloud/lb_flavor_list.py | 55 +- src/gcore/types/cloud/lb_health_monitor.py | 59 +- src/gcore/types/cloud/lb_listener.py | 112 +-- src/gcore/types/cloud/lb_listener_list.py | 10 +- .../types/cloud/lb_session_persistence.py | 20 +- src/gcore/types/cloud/listener_status.py | 25 +- src/gcore/types/cloud/load_balancer.py | 176 ++--- .../cloud/load_balancer_create_params.py | 367 +++------- .../cloud/load_balancer_failover_params.py | 13 +- .../types/cloud/load_balancer_get_params.py | 18 +- .../types/cloud/load_balancer_list_params.py | 61 +- .../cloud/load_balancer_resize_params.py | 13 +- .../types/cloud/load_balancer_statistics.py | 25 +- src/gcore/types/cloud/load_balancer_status.py | 35 +- .../types/cloud/load_balancer_status_list.py | 10 +- .../cloud/load_balancer_update_params.py | 42 +- .../load_balancers/flavor_list_params.py | 13 +- .../l7_policies/rule_create_params.py | 41 +- .../l7_policies/rule_replace_params.py | 45 +- .../load_balancers/l7_policy_create_params.py | 56 +- .../l7_policy_replace_params.py | 51 +- .../load_balancers/listener_create_params.py | 82 +-- .../load_balancers/listener_get_params.py | 13 +- .../load_balancers/listener_list_params.py | 18 +- .../load_balancers/listener_update_params.py | 61 +- .../load_balancers/metric_list_params.py | 18 +- .../load_balancers/pool_create_params.py | 183 ++--- .../cloud/load_balancers/pool_list_params.py | 22 +- .../load_balancers/pool_update_params.py | 175 ++--- .../pools/health_monitor_create_params.py | 51 +- .../load_balancers/pools/member_add_params.py | 50 +- src/gcore/types/cloud/loadbalancer_metrics.py | 35 +- .../types/cloud/loadbalancer_metrics_list.py | 10 +- src/gcore/types/cloud/logging.py | 20 +- src/gcore/types/cloud/member_status.py | 25 +- src/gcore/types/cloud/network.py | 96 +-- .../types/cloud/network_create_params.py | 33 +- src/gcore/types/cloud/network_details.py | 95 +-- src/gcore/types/cloud/network_interface.py | 105 +-- .../types/cloud/network_interface_list.py | 10 +- src/gcore/types/cloud/network_list_params.py | 36 +- .../types/cloud/network_update_params.py | 13 +- src/gcore/types/cloud/networks/router.py | 107 +-- .../networks/router_attach_subnet_params.py | 19 +- .../cloud/networks/router_create_params.py | 71 +- .../networks/router_detach_subnet_params.py | 13 +- src/gcore/types/cloud/networks/router_list.py | 10 +- .../cloud/networks/router_list_params.py | 18 +- .../cloud/networks/router_update_params.py | 47 +- .../cloud/networks/subnet_create_params.py | 85 +-- .../cloud/networks/subnet_list_params.py | 43 +- .../cloud/networks/subnet_update_params.py | 47 +- src/gcore/types/cloud/placement_group.py | 46 +- .../cloud/placement_group_create_params.py | 18 +- src/gcore/types/cloud/placement_group_list.py | 10 +- src/gcore/types/cloud/pool_status.py | 30 +- src/gcore/types/cloud/project.py | 47 +- .../types/cloud/project_create_params.py | 20 +- src/gcore/types/cloud/project_list_params.py | 30 +- .../types/cloud/project_replace_params.py | 14 +- .../types/cloud/quota_get_all_response.py | 545 +++----------- .../cloud/quota_get_by_region_response.py | 465 +++--------- .../types/cloud/quota_get_global_response.py | 70 +- .../cloud/quotas/request_create_params.py | 295 ++------ .../cloud/quotas/request_get_response.py | 315 ++------ .../types/cloud/quotas/request_list_params.py | 16 +- .../cloud/quotas/request_list_response.py | 315 ++------ src/gcore/types/cloud/region.py | 148 +--- src/gcore/types/cloud/region_capacity.py | 10 +- src/gcore/types/cloud/region_capacity_list.py | 10 +- src/gcore/types/cloud/region_list_params.py | 26 +- .../types/cloud/region_retrieve_params.py | 9 +- .../cloud/registries/registry_artifact.py | 40 +- .../registries/registry_artifact_list.py | 10 +- .../cloud/registries/registry_repository.py | 35 +- .../registries/registry_repository_list.py | 10 +- .../types/cloud/registries/registry_user.py | 30 +- .../cloud/registries/registry_user_created.py | 35 +- .../cloud/registries/registry_user_list.py | 10 +- .../registries/user_create_multiple_params.py | 36 +- .../cloud/registries/user_create_params.py | 31 +- .../cloud/registries/user_update_params.py | 22 +- src/gcore/types/cloud/registry.py | 40 +- .../types/cloud/registry_create_params.py | 21 +- src/gcore/types/cloud/registry_list.py | 10 +- .../types/cloud/registry_resize_params.py | 13 +- src/gcore/types/cloud/registry_tag.py | 30 +- src/gcore/types/cloud/reserved_fixed_ip.py | 132 +--- .../cloud/reserved_fixed_ip_create_params.py | 119 +--- .../cloud/reserved_fixed_ip_list_params.py | 52 +- .../reserved_fixed_ips/candidate_port.py | 25 +- .../reserved_fixed_ips/candidate_port_list.py | 10 +- .../reserved_fixed_ips/connected_port.py | 25 +- .../reserved_fixed_ips/connected_port_list.py | 10 +- .../reserved_fixed_ips/ip_with_subnet.py | 15 +- .../vip_replace_connected_ports_params.py | 13 +- .../reserved_fixed_ips/vip_toggle_params.py | 13 +- .../vip_update_connected_ports_params.py | 13 +- src/gcore/types/cloud/route.py | 9 +- src/gcore/types/cloud/secret.py | 61 +- src/gcore/types/cloud/secret_create_params.py | 68 +- src/gcore/types/cloud/secret_list_response.py | 10 +- .../secret_upload_tls_certificate_params.py | 38 +- src/gcore/types/cloud/security_group.py | 55 +- .../types/cloud/security_group_copy_params.py | 13 +- .../cloud/security_group_create_params.py | 81 +-- .../types/cloud/security_group_list_params.py | 30 +- src/gcore/types/cloud/security_group_rule.py | 63 +- .../cloud/security_group_update_params.py | 66 +- .../security_groups/rule_create_params.py | 46 +- .../security_groups/rule_replace_params.py | 51 +- src/gcore/types/cloud/ssh_key.py | 42 +- .../types/cloud/ssh_key_create_params.py | 28 +- src/gcore/types/cloud/ssh_key_created.py | 56 +- src/gcore/types/cloud/ssh_key_list_params.py | 20 +- .../types/cloud/ssh_key_update_params.py | 10 +- src/gcore/types/cloud/subnet.py | 108 +-- src/gcore/types/cloud/tag.py | 15 +- src/gcore/types/cloud/task.py | 275 ++----- .../cloud/task_acknowledge_all_params.py | 10 +- src/gcore/types/cloud/task_id_list.py | 5 +- src/gcore/types/cloud/task_list_params.py | 95 ++- .../types/cloud/users/role_assignment.py | 39 +- .../users/role_assignment_create_params.py | 20 +- .../users/role_assignment_list_params.py | 22 +- .../users/role_assignment_update_delete.py | 5 +- .../users/role_assignment_update_params.py | 20 +- src/gcore/types/cloud/volume.py | 157 +--- .../cloud/volume_attach_to_instance_params.py | 20 +- .../types/cloud/volume_change_type_params.py | 15 +- src/gcore/types/cloud/volume_create_params.py | 182 ++--- src/gcore/types/cloud/volume_delete_params.py | 15 +- .../volume_detach_from_instance_params.py | 15 +- src/gcore/types/cloud/volume_list_params.py | 62 +- src/gcore/types/cloud/volume_resize_params.py | 15 +- src/gcore/types/cloud/volume_update_params.py | 15 +- 335 files changed, 6269 insertions(+), 17522 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1fb6de5..df7f57ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,13 +50,3 @@ jobs: - name: Run tests run: ./scripts/test - - prevent-debug-release: - name: Prevent Debug SDK Release - runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - steps: - - name: Debug Mode Failsafe - run: | - echo "This SDK was built in debug mode, this job is a failsafe to prevent releasing debug SDKs" - echo "Remove 'debug: true' from your Stainless config." - exit 1 diff --git a/.stats.yml b/.stats.yml index 69d1a3fe..014e6fef 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-506b88d8207b6721e83a9b8e91ce33e143b3fbe83055e4e8cc276c98ffd0ac20.yml openapi_spec_hash: 5909b18d3de69bcd21c1a4965e643d7f -config_hash: 92f5ba39304b08484c4704bbca02f7ac +config_hash: 4e84bb86c6b30323e08ed8a76b63b191 diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index dca4648b..0f2a66ff 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -66,29 +66,18 @@ def list( as 0. If you get Pricing Error contact the support Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[0].schema" + disabled: Flag for filtering disabled flavors in the region. Defaults to true - region_id: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[1].schema" + exclude_linux: Set to true to exclude flavors dedicated to linux images. Default False - disabled: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[2]" + exclude_windows: Set to true to exclude flavors dedicated to windows images. Default False - exclude_linux: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[3]" + include_capacity: Set to true if the response should include flavor capacity - exclude_windows: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[4]" + include_prices: Set to true if the response should include flavor prices - include_capacity: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[5]" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[6]" - - include_reservation_stock: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[7]" + include_reservation_stock: Optional. Set to true if flavor listing should include count of reserved + resources in stock. extra_headers: Send extra headers @@ -143,20 +132,11 @@ def list_suitable( List suitalbe flavors for bare metal server creation Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/0/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/1/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[1].schema" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/2' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[2]" + include_prices: Set to true if flavor listing should include flavor prices - apptemplate_id: '#/components/schemas/AvailableBaremetalFlavorsRequestSchema/properties/apptemplate_id' - "$.components.schemas.AvailableBaremetalFlavorsRequestSchema.properties.apptemplate_id" + apptemplate_id: Apptemplate ID - image_id: '#/components/schemas/AvailableBaremetalFlavorsRequestSchema/properties/image_id' - "$.components.schemas.AvailableBaremetalFlavorsRequestSchema.properties.image_id" + image_id: Image ID extra_headers: Send extra headers @@ -237,29 +217,18 @@ async def list( as 0. If you get Pricing Error contact the support Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[0].schema" + disabled: Flag for filtering disabled flavors in the region. Defaults to true - region_id: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[1].schema" + exclude_linux: Set to true to exclude flavors dedicated to linux images. Default False - disabled: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[2]" + exclude_windows: Set to true to exclude flavors dedicated to windows images. Default False - exclude_linux: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[3]" + include_capacity: Set to true if the response should include flavor capacity - exclude_windows: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[4]" + include_prices: Set to true if the response should include flavor prices - include_capacity: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[5]" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[6]" - - include_reservation_stock: '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[7]" + include_reservation_stock: Optional. Set to true if flavor listing should include count of reserved + resources in stock. extra_headers: Send extra headers @@ -314,20 +283,11 @@ async def list_suitable( List suitalbe flavors for bare metal server creation Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/0/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/1/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[1].schema" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/2' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[2]" + include_prices: Set to true if flavor listing should include flavor prices - apptemplate_id: '#/components/schemas/AvailableBaremetalFlavorsRequestSchema/properties/apptemplate_id' - "$.components.schemas.AvailableBaremetalFlavorsRequestSchema.properties.apptemplate_id" + apptemplate_id: Apptemplate ID - image_id: '#/components/schemas/AvailableBaremetalFlavorsRequestSchema/properties/image_id' - "$.components.schemas.AvailableBaremetalFlavorsRequestSchema.properties.image_id" + image_id: Image ID extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index c728ce04..73c9e454 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -67,26 +67,17 @@ def list( or may not be owned by the project Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[0].schema" + include_prices: Show price - region_id: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[1].schema" + private: Any value to show private images - include_prices: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[2]" + tag_key: Filter by tag keys. - private: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[3]" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. 'curl -G + --data-urlencode 'tag_key_value={"key": "value"}' --url + 'http://localhost:1111/v1/images/1/1'" - tag_key: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[4]" - - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[5]" - - visibility: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[6]" + visibility: Image visibility. Globally visible images are public extra_headers: Send extra headers @@ -165,26 +156,17 @@ async def list( or may not be owned by the project Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[1].schema" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[2]" + include_prices: Show price - private: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[3]" + private: Any value to show private images - tag_key: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[4]" + tag_key: Filter by tag keys. - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[5]" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. 'curl -G + --data-urlencode 'tag_key_value={"key": "value"}' --url + 'http://localhost:1111/v1/images/1/1'" - visibility: '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[6]" + visibility: Image visibility. Globally visible images are public extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 9b57577b..b51fe069 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -77,50 +77,55 @@ def create( Create a new bare metal server or multiple servers Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - flavor: '#/components/schemas/CreateBareMetalServerSerializer/properties/flavor' - "$.components.schemas.CreateBareMetalServerSerializer.properties.flavor" + flavor: The flavor of the instance. - interfaces: '#/components/schemas/CreateBareMetalServerSerializer/properties/interfaces' - "$.components.schemas.CreateBareMetalServerSerializer.properties.interfaces" + interfaces: A list of network interfaces for the server. You can create one or more + interfaces—private, public, or both. - app_config: '#/components/schemas/CreateBareMetalServerSerializer/properties/app_config/anyOf/0' - "$.components.schemas.CreateBareMetalServerSerializer.properties.app_config.anyOf[0]" + app_config: Parameters for the application template if creating the instance from an + `apptemplate`. - apptemplate_id: '#/components/schemas/CreateBareMetalServerSerializer/properties/apptemplate_id' - "$.components.schemas.CreateBareMetalServerSerializer.properties.apptemplate_id" + apptemplate_id: Apptemplate ID. Either `image_id` or `apptemplate_id` is required. - ddos_profile: '#/components/schemas/CreateBareMetalServerSerializer/properties/ddos_profile' - "$.components.schemas.CreateBareMetalServerSerializer.properties.ddos_profile" + ddos_profile: Enable advanced DDoS protection for the server - image_id: '#/components/schemas/CreateBareMetalServerSerializer/properties/image_id' - "$.components.schemas.CreateBareMetalServerSerializer.properties.image_id" + image_id: Image ID. Either `image_id` or `apptemplate_id` is required. - name_templates: '#/components/schemas/CreateBareMetalServerSerializer/properties/name_templates' - "$.components.schemas.CreateBareMetalServerSerializer.properties.name_templates" + name_templates: If you want server names to be automatically generated using IP octets, you can + specify name templates instead of setting names manually.Provide a list of + templated names that should be replaced using the selected template. The + following template formats are supported: `{ip_octets}`, `{two_ip_octets}`, and + `{one_ip_octet}`. - names: '#/components/schemas/CreateBareMetalServerSerializer/properties/names' - "$.components.schemas.CreateBareMetalServerSerializer.properties.names" + names: List of server names. Specify one name to create a single server. - password: '#/components/schemas/CreateBareMetalServerSerializer/properties/password' - "$.components.schemas.CreateBareMetalServerSerializer.properties.password" + password: For Linux instances, 'username' and 'password' are used to create a new user. + When only 'password' is provided, it is set as the password for the default user + of the image. For Windows instances, 'username' cannot be specified. Use the + 'password' field to set the password for the 'Admin' user on Windows. Use the + 'user_data' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via 'user_data'. - ssh_key_name: '#/components/schemas/CreateBareMetalServerSerializer/properties/ssh_key_name/anyOf/0' - "$.components.schemas.CreateBareMetalServerSerializer.properties.ssh_key_name.anyOf[0]" + ssh_key_name: Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint. - tags: '#/components/schemas/CreateBareMetalServerSerializer/properties/tags' - "$.components.schemas.CreateBareMetalServerSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - user_data: '#/components/schemas/CreateBareMetalServerSerializer/properties/user_data' - "$.components.schemas.CreateBareMetalServerSerializer.properties.user_data" + user_data: String in base64 format. For Linux instances, 'user_data' is ignored when + 'password' field is provided. For Windows instances, Admin user password is set + by 'password' field and cannot be updated via 'user_data'. Examples of the + user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html - username: '#/components/schemas/CreateBareMetalServerSerializer/properties/username' - "$.components.schemas.CreateBareMetalServerSerializer.properties.username" + username: For Linux instances, 'username' and 'password' are used to create a new user. + For Windows instances, 'username' cannot be specified. Use 'password' field to + set the password for the 'Admin' user on Windows. extra_headers: Send extra headers @@ -201,74 +206,64 @@ def list( List bare metal servers Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID - changes_before: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[2]" + changes_before: Filters the instances by a date and time stamp when the instances last changed. - changes_since: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[3]" + changes_since: Filters the instances by a date and time stamp when the instances last changed + status. - flavor_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[4]" + flavor_id: Filter out instances by flavor_id. Flavor id must match exactly. - flavor_prefix: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[5]" + flavor_prefix: Filter out instances by flavor_prefix. - include_k8s: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[6]" + include_k8s: Include managed k8s worker nodes - ip: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[7]" + ip: An IPv4 address to filter results by. Note: partial matches are allowed. For + example, searching for 192.168.0.1 will return 192.168.0.1, 192.168.0.10, + 192.168.0.110, and so on. - limit: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[8]" + limit: Optional. Limit the number of returned items - name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[9]" + name: Filter instances by name. You can provide a full or partial name, instances with + matching names will be returned. For example, entering 'test' will return all + instances that contain 'test' in their name. - offset: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[10]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - only_isolated: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[11]" + only_isolated: Include only isolated instances - only_with_fixed_external_ip: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[12]" + only_with_fixed_external_ip: Return bare metals only with external fixed IP addresses. - order_by: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[13]" + order_by: Order by field and direction. - profile_name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[14]" + profile_name: Filter result by ddos protection profile name. Effective only with with_ddos set + to true. - protection_status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[15]" + protection_status: Filter result by DDoS protection_status. Effective only with with_ddos set to + true. (Active, Queued or Error) - status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[16]" + status: Filters instances by a server status, as a string. - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[17]" + tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode + "tag_key_value={"key": "value"}" --url + "https://example.com/cloud/v1/resource/1/1" - tag_value: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[18]" + tag_value: Optional. Filter by tag values. ?tag_value=value1&tag_value=value2 - type_ddos_profile: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[19]" + type_ddos_profile: Return bare metals either only with advanced or only basic DDoS protection. + Effective only with with_ddos set to true. (advanced or basic) - uuid: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/20' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[20]" + uuid: Filter the server list result by the UUID of the server. Allowed UUID part - with_ddos: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/21' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[21]" + with_ddos: Include DDoS profile information for bare-metal servers in the response when set + to `true`. Otherwise, the `ddos_profile` field in the response is `null` by + default. - with_interfaces_name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/22' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[22]" + with_interfaces_name: Include `interface_name` in the addresses extra_headers: Send extra headers @@ -339,20 +334,11 @@ def rebuild( Rebuild bare metal server Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/0/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[0].schema" + image_id: Image ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/1/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[1].schema" - - server_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/2/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[2].schema" - - image_id: '#/components/schemas/RebuildBaremetalSchema/properties/image_id' - "$.components.schemas.RebuildBaremetalSchema.properties.image_id" - - user_data: '#/components/schemas/RebuildBaremetalSchema/properties/user_data' - "$.components.schemas.RebuildBaremetalSchema.properties.user_data" + user_data: String in base64 format. Must not be passed together with 'username' or + 'password'. Examples of the user_data: + https://cloudinit.readthedocs.io/en/latest/topics/examples.html extra_headers: Send extra headers @@ -433,50 +419,55 @@ async def create( Create a new bare metal server or multiple servers Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - flavor: '#/components/schemas/CreateBareMetalServerSerializer/properties/flavor' - "$.components.schemas.CreateBareMetalServerSerializer.properties.flavor" + flavor: The flavor of the instance. - interfaces: '#/components/schemas/CreateBareMetalServerSerializer/properties/interfaces' - "$.components.schemas.CreateBareMetalServerSerializer.properties.interfaces" + interfaces: A list of network interfaces for the server. You can create one or more + interfaces—private, public, or both. - app_config: '#/components/schemas/CreateBareMetalServerSerializer/properties/app_config/anyOf/0' - "$.components.schemas.CreateBareMetalServerSerializer.properties.app_config.anyOf[0]" + app_config: Parameters for the application template if creating the instance from an + `apptemplate`. - apptemplate_id: '#/components/schemas/CreateBareMetalServerSerializer/properties/apptemplate_id' - "$.components.schemas.CreateBareMetalServerSerializer.properties.apptemplate_id" + apptemplate_id: Apptemplate ID. Either `image_id` or `apptemplate_id` is required. - ddos_profile: '#/components/schemas/CreateBareMetalServerSerializer/properties/ddos_profile' - "$.components.schemas.CreateBareMetalServerSerializer.properties.ddos_profile" + ddos_profile: Enable advanced DDoS protection for the server - image_id: '#/components/schemas/CreateBareMetalServerSerializer/properties/image_id' - "$.components.schemas.CreateBareMetalServerSerializer.properties.image_id" + image_id: Image ID. Either `image_id` or `apptemplate_id` is required. - name_templates: '#/components/schemas/CreateBareMetalServerSerializer/properties/name_templates' - "$.components.schemas.CreateBareMetalServerSerializer.properties.name_templates" + name_templates: If you want server names to be automatically generated using IP octets, you can + specify name templates instead of setting names manually.Provide a list of + templated names that should be replaced using the selected template. The + following template formats are supported: `{ip_octets}`, `{two_ip_octets}`, and + `{one_ip_octet}`. - names: '#/components/schemas/CreateBareMetalServerSerializer/properties/names' - "$.components.schemas.CreateBareMetalServerSerializer.properties.names" + names: List of server names. Specify one name to create a single server. - password: '#/components/schemas/CreateBareMetalServerSerializer/properties/password' - "$.components.schemas.CreateBareMetalServerSerializer.properties.password" + password: For Linux instances, 'username' and 'password' are used to create a new user. + When only 'password' is provided, it is set as the password for the default user + of the image. For Windows instances, 'username' cannot be specified. Use the + 'password' field to set the password for the 'Admin' user on Windows. Use the + 'user_data' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via 'user_data'. - ssh_key_name: '#/components/schemas/CreateBareMetalServerSerializer/properties/ssh_key_name/anyOf/0' - "$.components.schemas.CreateBareMetalServerSerializer.properties.ssh_key_name.anyOf[0]" + ssh_key_name: Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint. - tags: '#/components/schemas/CreateBareMetalServerSerializer/properties/tags' - "$.components.schemas.CreateBareMetalServerSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - user_data: '#/components/schemas/CreateBareMetalServerSerializer/properties/user_data' - "$.components.schemas.CreateBareMetalServerSerializer.properties.user_data" + user_data: String in base64 format. For Linux instances, 'user_data' is ignored when + 'password' field is provided. For Windows instances, Admin user password is set + by 'password' field and cannot be updated via 'user_data'. Examples of the + user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html - username: '#/components/schemas/CreateBareMetalServerSerializer/properties/username' - "$.components.schemas.CreateBareMetalServerSerializer.properties.username" + username: For Linux instances, 'username' and 'password' are used to create a new user. + For Windows instances, 'username' cannot be specified. Use 'password' field to + set the password for the 'Admin' user on Windows. extra_headers: Send extra headers @@ -557,74 +548,64 @@ def list( List bare metal servers Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID - changes_before: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[2]" + changes_before: Filters the instances by a date and time stamp when the instances last changed. - changes_since: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[3]" + changes_since: Filters the instances by a date and time stamp when the instances last changed + status. - flavor_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[4]" + flavor_id: Filter out instances by flavor_id. Flavor id must match exactly. - flavor_prefix: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[5]" + flavor_prefix: Filter out instances by flavor_prefix. - include_k8s: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[6]" + include_k8s: Include managed k8s worker nodes - ip: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[7]" + ip: An IPv4 address to filter results by. Note: partial matches are allowed. For + example, searching for 192.168.0.1 will return 192.168.0.1, 192.168.0.10, + 192.168.0.110, and so on. - limit: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[8]" + limit: Optional. Limit the number of returned items - name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[9]" + name: Filter instances by name. You can provide a full or partial name, instances with + matching names will be returned. For example, entering 'test' will return all + instances that contain 'test' in their name. - offset: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[10]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - only_isolated: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[11]" + only_isolated: Include only isolated instances - only_with_fixed_external_ip: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[12]" + only_with_fixed_external_ip: Return bare metals only with external fixed IP addresses. - order_by: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[13]" + order_by: Order by field and direction. - profile_name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[14]" + profile_name: Filter result by ddos protection profile name. Effective only with with_ddos set + to true. - protection_status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[15]" + protection_status: Filter result by DDoS protection_status. Effective only with with_ddos set to + true. (Active, Queued or Error) - status: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[16]" + status: Filters instances by a server status, as a string. - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[17]" + tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode + "tag_key_value={"key": "value"}" --url + "https://example.com/cloud/v1/resource/1/1" - tag_value: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[18]" + tag_value: Optional. Filter by tag values. ?tag_value=value1&tag_value=value2 - type_ddos_profile: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[19]" + type_ddos_profile: Return bare metals either only with advanced or only basic DDoS protection. + Effective only with with_ddos set to true. (advanced or basic) - uuid: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/20' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[20]" + uuid: Filter the server list result by the UUID of the server. Allowed UUID part - with_ddos: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/21' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[21]" + with_ddos: Include DDoS profile information for bare-metal servers in the response when set + to `true`. Otherwise, the `ddos_profile` field in the response is `null` by + default. - with_interfaces_name: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/22' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[22]" + with_interfaces_name: Include `interface_name` in the addresses extra_headers: Send extra headers @@ -695,20 +676,11 @@ async def rebuild( Rebuild bare metal server Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/0/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/1/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[1].schema" - - server_id: '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/2/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[2].schema" - - image_id: '#/components/schemas/RebuildBaremetalSchema/properties/image_id' - "$.components.schemas.RebuildBaremetalSchema.properties.image_id" + image_id: Image ID - user_data: '#/components/schemas/RebuildBaremetalSchema/properties/user_data' - "$.components.schemas.RebuildBaremetalSchema.properties.user_data" + user_data: String in base64 format. Must not be passed together with 'username' or + 'password'. Examples of the user_data: + https://cloudinit.readthedocs.io/en/latest/topics/examples.html extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index 759350d6..75cd583f 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -76,38 +76,29 @@ def list( List reservations Args: - activated_from: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/0' - "$.paths['/cloud/v1/reservations'].get.parameters[0]" + activated_from: Lower bound, starting from what date the reservation was/will be activated - activated_to: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/1' - "$.paths['/cloud/v1/reservations'].get.parameters[1]" + activated_to: High bound, before what date the reservation was/will be activated - created_from: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/2' - "$.paths['/cloud/v1/reservations'].get.parameters[2]" + created_from: Lower bound the filter, showing result(s) equal to or greater than date the + reservation was created - created_to: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/3' - "$.paths['/cloud/v1/reservations'].get.parameters[3]" + created_to: High bound the filter, showing result(s) equal to or less date the reservation + was created - deactivated_from: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/4' - "$.paths['/cloud/v1/reservations'].get.parameters[4]" + deactivated_from: Lower bound, starting from what date the reservation was/will be deactivated - deactivated_to: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/5' - "$.paths['/cloud/v1/reservations'].get.parameters[5]" + deactivated_to: High bound, before what date the reservation was/will be deactivated - limit: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/6' - "$.paths['/cloud/v1/reservations'].get.parameters[6]" + limit: Limit of reservation list page - metric_name: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/7' - "$.paths['/cloud/v1/reservations'].get.parameters[7]" + metric_name: Name from billing features for specific resource - offset: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/8' - "$.paths['/cloud/v1/reservations'].get.parameters[8]" + offset: Offset in reservation list - region_id: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/9' - "$.paths['/cloud/v1/reservations'].get.parameters[9]" + region_id: Region for reservation - status: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/10' - "$.paths['/cloud/v1/reservations'].get.parameters[10]" + status: Field for fixed a status by reservation workflow extra_headers: Send extra headers @@ -160,8 +151,7 @@ def get( Get specific reservation Args: - reservation_id: '#/paths/%2Fcloud%2Fv1%2Freservations%2F%7Breservation_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/reservations/{reservation_id}'].get.parameters[0].schema" + reservation_id: ID of the reservation extra_headers: Send extra headers @@ -230,38 +220,29 @@ def list( List reservations Args: - activated_from: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/0' - "$.paths['/cloud/v1/reservations'].get.parameters[0]" + activated_from: Lower bound, starting from what date the reservation was/will be activated - activated_to: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/1' - "$.paths['/cloud/v1/reservations'].get.parameters[1]" + activated_to: High bound, before what date the reservation was/will be activated - created_from: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/2' - "$.paths['/cloud/v1/reservations'].get.parameters[2]" + created_from: Lower bound the filter, showing result(s) equal to or greater than date the + reservation was created - created_to: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/3' - "$.paths['/cloud/v1/reservations'].get.parameters[3]" + created_to: High bound the filter, showing result(s) equal to or less date the reservation + was created - deactivated_from: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/4' - "$.paths['/cloud/v1/reservations'].get.parameters[4]" + deactivated_from: Lower bound, starting from what date the reservation was/will be deactivated - deactivated_to: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/5' - "$.paths['/cloud/v1/reservations'].get.parameters[5]" + deactivated_to: High bound, before what date the reservation was/will be deactivated - limit: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/6' - "$.paths['/cloud/v1/reservations'].get.parameters[6]" + limit: Limit of reservation list page - metric_name: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/7' - "$.paths['/cloud/v1/reservations'].get.parameters[7]" + metric_name: Name from billing features for specific resource - offset: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/8' - "$.paths['/cloud/v1/reservations'].get.parameters[8]" + offset: Offset in reservation list - region_id: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/9' - "$.paths['/cloud/v1/reservations'].get.parameters[9]" + region_id: Region for reservation - status: '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/10' - "$.paths['/cloud/v1/reservations'].get.parameters[10]" + status: Field for fixed a status by reservation workflow extra_headers: Send extra headers @@ -314,8 +295,7 @@ async def get( Get specific reservation Args: - reservation_id: '#/paths/%2Fcloud%2Fv1%2Freservations%2F%7Breservation_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/reservations/{reservation_id}'].get.parameters[0].schema" + reservation_id: ID of the reservation extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index 8f7fc220..2b9f42d9 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -63,20 +63,15 @@ def create( Create file share access rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[2].schema" + file_share_id: File Share ID - access_mode: '#/components/schemas/CreateAccessRuleSerializer/properties/access_mode' - "$.components.schemas.CreateAccessRuleSerializer.properties.access_mode" + access_mode: Access mode - ip_address: '#/components/schemas/CreateAccessRuleSerializer/properties/ip_address/anyOf/0' - "$.components.schemas.CreateAccessRuleSerializer.properties.ip_address.anyOf[0]" + ip_address: Source IP or network extra_headers: Send extra headers @@ -124,14 +119,11 @@ def list( Get file share access rules Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/get/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/get/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].get.parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/get/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].get.parameters[2].schema" + file_share_id: File Share ID extra_headers: Send extra headers @@ -173,17 +165,13 @@ def delete( Delete file share access rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[2].schema" + file_share_id: File Share ID - access_rule_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[3].schema" + access_rule_id: Access Rule ID extra_headers: Send extra headers @@ -250,20 +238,15 @@ async def create( Create file share access rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[2].schema" + file_share_id: File Share ID - access_mode: '#/components/schemas/CreateAccessRuleSerializer/properties/access_mode' - "$.components.schemas.CreateAccessRuleSerializer.properties.access_mode" + access_mode: Access mode - ip_address: '#/components/schemas/CreateAccessRuleSerializer/properties/ip_address/anyOf/0' - "$.components.schemas.CreateAccessRuleSerializer.properties.ip_address.anyOf[0]" + ip_address: Source IP or network extra_headers: Send extra headers @@ -311,14 +294,11 @@ async def list( Get file share access rules Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/get/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/get/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].get.parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/get/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].get.parameters[2].schema" + file_share_id: File Share ID extra_headers: Send extra headers @@ -360,17 +340,13 @@ async def delete( Delete file share access rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[2].schema" + file_share_id: File Share ID - access_rule_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule%2F%7Baccess_rule_id%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}']['delete'].parameters[3].schema" + access_rule_id: Access Rule ID extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 3f91a20a..e6f464d9 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -88,32 +88,27 @@ def create( Create file share Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - name: '#/components/schemas/CreateStandardFileShareSerializer/properties/name' - "$.components.schemas.CreateStandardFileShareSerializer.properties.name" + name: File share name - network: '#/components/schemas/CreateStandardFileShareSerializer/properties/network' - "$.components.schemas.CreateStandardFileShareSerializer.properties.network" + network: File share network configuration - protocol: '#/components/schemas/CreateStandardFileShareSerializer/properties/protocol' - "$.components.schemas.CreateStandardFileShareSerializer.properties.protocol" + protocol: File share protocol - size: '#/components/schemas/CreateStandardFileShareSerializer/properties/size' - "$.components.schemas.CreateStandardFileShareSerializer.properties.size" + size: File share size - access: '#/components/schemas/CreateStandardFileShareSerializer/properties/access' - "$.components.schemas.CreateStandardFileShareSerializer.properties.access" + access: Access Rules - tags: '#/components/schemas/CreateStandardFileShareSerializer/properties/tags' - "$.components.schemas.CreateStandardFileShareSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - volume_type: '#/components/schemas/CreateStandardFileShareSerializer/properties/volume_type' - "$.components.schemas.CreateStandardFileShareSerializer.properties.volume_type" + volume_type: File share volume type extra_headers: Send extra headers @@ -147,26 +142,23 @@ def create( Create file share Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - name: '#/components/schemas/CreateVastFileShareSerializer/properties/name' - "$.components.schemas.CreateVastFileShareSerializer.properties.name" + name: File share name - protocol: '#/components/schemas/CreateVastFileShareSerializer/properties/protocol' - "$.components.schemas.CreateVastFileShareSerializer.properties.protocol" + protocol: File share protocol - size: '#/components/schemas/CreateVastFileShareSerializer/properties/size' - "$.components.schemas.CreateVastFileShareSerializer.properties.size" + size: File share size - volume_type: '#/components/schemas/CreateVastFileShareSerializer/properties/volume_type' - "$.components.schemas.CreateVastFileShareSerializer.properties.volume_type" + volume_type: File share volume type - tags: '#/components/schemas/CreateVastFileShareSerializer/properties/tags' - "$.components.schemas.CreateVastFileShareSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers @@ -240,17 +232,13 @@ def update( Rename file share Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[2].schema" + file_share_id: File Share ID - name: '#/components/schemas/NameSerializer/properties/name' - "$.components.schemas.NameSerializer.properties.name" + name: Name. extra_headers: Send extra headers @@ -293,17 +281,14 @@ def list( List file shares Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID - limit: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[2]" + limit: Optional. Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[3]" + offset: Optional. Offset value is used to exclude the first set of records from the + result extra_headers: Send extra headers @@ -353,14 +338,11 @@ def delete( Delete file share Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}']['delete'].parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}']['delete'].parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}']['delete'].parameters[2].schema" + file_share_id: File Share ID extra_headers: Send extra headers @@ -401,14 +383,11 @@ def get( Get file share Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].get.parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].get.parameters[2].schema" + file_share_id: File Share ID extra_headers: Send extra headers @@ -450,17 +429,13 @@ def resize( Resize file share Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[2].schema" + file_share_id: File Share ID - size: '#/components/schemas/ResizeSfsSerializer/properties/size' - "$.components.schemas.ResizeSfsSerializer.properties.size" + size: File Share new size in GiB. extra_headers: Send extra headers @@ -534,32 +509,27 @@ async def create( Create file share Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - name: '#/components/schemas/CreateStandardFileShareSerializer/properties/name' - "$.components.schemas.CreateStandardFileShareSerializer.properties.name" + name: File share name - network: '#/components/schemas/CreateStandardFileShareSerializer/properties/network' - "$.components.schemas.CreateStandardFileShareSerializer.properties.network" + network: File share network configuration - protocol: '#/components/schemas/CreateStandardFileShareSerializer/properties/protocol' - "$.components.schemas.CreateStandardFileShareSerializer.properties.protocol" + protocol: File share protocol - size: '#/components/schemas/CreateStandardFileShareSerializer/properties/size' - "$.components.schemas.CreateStandardFileShareSerializer.properties.size" + size: File share size - access: '#/components/schemas/CreateStandardFileShareSerializer/properties/access' - "$.components.schemas.CreateStandardFileShareSerializer.properties.access" + access: Access Rules - tags: '#/components/schemas/CreateStandardFileShareSerializer/properties/tags' - "$.components.schemas.CreateStandardFileShareSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - volume_type: '#/components/schemas/CreateStandardFileShareSerializer/properties/volume_type' - "$.components.schemas.CreateStandardFileShareSerializer.properties.volume_type" + volume_type: File share volume type extra_headers: Send extra headers @@ -593,26 +563,23 @@ async def create( Create file share Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - name: '#/components/schemas/CreateVastFileShareSerializer/properties/name' - "$.components.schemas.CreateVastFileShareSerializer.properties.name" + name: File share name - protocol: '#/components/schemas/CreateVastFileShareSerializer/properties/protocol' - "$.components.schemas.CreateVastFileShareSerializer.properties.protocol" + protocol: File share protocol - size: '#/components/schemas/CreateVastFileShareSerializer/properties/size' - "$.components.schemas.CreateVastFileShareSerializer.properties.size" + size: File share size - volume_type: '#/components/schemas/CreateVastFileShareSerializer/properties/volume_type' - "$.components.schemas.CreateVastFileShareSerializer.properties.volume_type" + volume_type: File share volume type - tags: '#/components/schemas/CreateVastFileShareSerializer/properties/tags' - "$.components.schemas.CreateVastFileShareSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers @@ -686,17 +653,13 @@ async def update( Rename file share Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[2].schema" + file_share_id: File Share ID - name: '#/components/schemas/NameSerializer/properties/name' - "$.components.schemas.NameSerializer.properties.name" + name: Name. extra_headers: Send extra headers @@ -739,17 +702,14 @@ def list( List file shares Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID - limit: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[2]" + limit: Optional. Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[3]" + offset: Optional. Offset value is used to exclude the first set of records from the + result extra_headers: Send extra headers @@ -799,14 +759,11 @@ async def delete( Delete file share Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}']['delete'].parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}']['delete'].parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}']['delete'].parameters[2].schema" + file_share_id: File Share ID extra_headers: Send extra headers @@ -847,14 +804,11 @@ async def get( Get file share Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].get.parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].get.parameters[2].schema" + file_share_id: File Share ID extra_headers: Send extra headers @@ -896,17 +850,13 @@ async def resize( Resize file share Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[1].schema" + region_id: Region ID - file_share_id: '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/2/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[2].schema" + file_share_id: File Share ID - size: '#/components/schemas/ResizeSfsSerializer/properties/size' - "$.components.schemas.ResizeSfsSerializer.properties.size" + size: File Share new size in GiB. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 5e466a1f..f2873e30 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -66,20 +66,21 @@ def create( Create floating IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - fixed_ip_address: '#/components/schemas/CreateFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' - "$.components.schemas.CreateFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" + fixed_ip_address: If the port has multiple IP addresses, a specific one can be selected using this + field. If not specified, the first IP in the port's list will be used by + default. - port_id: '#/components/schemas/CreateFloatingIPSerializer/properties/port_id/anyOf/0' - "$.components.schemas.CreateFloatingIPSerializer.properties.port_id.anyOf[0]" + port_id: If provided, the floating IP will be immediately attached to the specified port. - tags: '#/components/schemas/CreateFloatingIPSerializer/properties/tags' - "$.components.schemas.CreateFloatingIPSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers @@ -129,23 +130,20 @@ def list( List floating IPs Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID - limit: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[2]" + limit: Optional. Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[3]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - tag_key: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[4]" + tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[5]" + tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode + "tag_key_value={"key": "value"}" --url + "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers @@ -197,15 +195,6 @@ def delete( Delete floating IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}']['delete'].parameters[1].schema" - - floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -247,20 +236,9 @@ def assign( Assign floating IP to instance or loadbalancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[1].schema" - - floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/2/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[2].schema" - - port_id: '#/components/schemas/AssignFloatingIPSerializer/properties/port_id' - "$.components.schemas.AssignFloatingIPSerializer.properties.port_id" + port_id: Port ID - fixed_ip_address: '#/components/schemas/AssignFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' - "$.components.schemas.AssignFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" + fixed_ip_address: Fixed IP address extra_headers: Send extra headers @@ -308,15 +286,6 @@ def get( Get floating IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}'].get.parameters[1].schema" - - floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -356,15 +325,6 @@ def unassign( Unassign floating IP from the instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Funassign/post/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Funassign/post/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign'].post.parameters[1].schema" - - floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Funassign/post/parameters/2/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -427,20 +387,21 @@ async def create( Create floating IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - fixed_ip_address: '#/components/schemas/CreateFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' - "$.components.schemas.CreateFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" + fixed_ip_address: If the port has multiple IP addresses, a specific one can be selected using this + field. If not specified, the first IP in the port's list will be used by + default. - port_id: '#/components/schemas/CreateFloatingIPSerializer/properties/port_id/anyOf/0' - "$.components.schemas.CreateFloatingIPSerializer.properties.port_id.anyOf[0]" + port_id: If provided, the floating IP will be immediately attached to the specified port. - tags: '#/components/schemas/CreateFloatingIPSerializer/properties/tags' - "$.components.schemas.CreateFloatingIPSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers @@ -490,23 +451,20 @@ def list( List floating IPs Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID - limit: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[2]" + limit: Optional. Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[3]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - tag_key: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[4]" + tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[5]" + tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode + "tag_key_value={"key": "value"}" --url + "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers @@ -558,15 +516,6 @@ async def delete( Delete floating IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}']['delete'].parameters[1].schema" - - floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -608,20 +557,9 @@ async def assign( Assign floating IP to instance or loadbalancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[1].schema" - - floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/2/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[2].schema" - - port_id: '#/components/schemas/AssignFloatingIPSerializer/properties/port_id' - "$.components.schemas.AssignFloatingIPSerializer.properties.port_id" + port_id: Port ID - fixed_ip_address: '#/components/schemas/AssignFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' - "$.components.schemas.AssignFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" + fixed_ip_address: Fixed IP address extra_headers: Send extra headers @@ -669,15 +607,6 @@ async def get( Get floating IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}'].get.parameters[1].schema" - - floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -717,15 +646,6 @@ async def unassign( Unassign floating IP from the instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Funassign/post/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Funassign/post/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign'].post.parameters[1].schema" - - floating_ip_id: '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Funassign/post/parameters/2/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index 266b4f85..f171531f 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -61,17 +61,13 @@ def list( List bare metal GPU flavors Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/0/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/1/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[1].schema" + region_id: Region ID - hide_disabled: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/2/schema/anyOf/0' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[2].schema.anyOf[0]" + hide_disabled: Flag for filtering disabled flavors in the region. - include_prices: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/3/schema/anyOf/0' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[3].schema.anyOf[0]" + include_prices: Set to true if the response should include flavor prices. extra_headers: Send extra headers @@ -142,17 +138,13 @@ async def list( List bare metal GPU flavors Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/0/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/1/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[1].schema" + region_id: Region ID - hide_disabled: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/2/schema/anyOf/0' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[2].schema.anyOf[0]" + hide_disabled: Flag for filtering disabled flavors in the region. - include_prices: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/3/schema/anyOf/0' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[3].schema.anyOf[0]" + include_prices: Set to true if the response should include flavor prices. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 49023a71..0ec18d9f 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -127,41 +127,34 @@ def create( Create a new GPU cluster. Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[0].schema" + flavor: Flavor name - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[1].schema" + image_id: Image ID - flavor: '#/components/schemas/CreateAIClusterGPUSerializer/properties/flavor' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.flavor" + interfaces: Subnet IPs and floating IPs - image_id: '#/components/schemas/CreateAIClusterGPUSerializer/properties/image_id' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.image_id" + name: GPU Cluster name - interfaces: '#/components/schemas/CreateAIClusterGPUSerializer/properties/interfaces' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.interfaces" + instances_count: Number of servers to create - name: '#/components/schemas/CreateAIClusterGPUSerializer/properties/name' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.name" + password: A password for a bare metal server. This parameter is used to set a password for + the "Admin" user on a Windows instance, a default user or a new user on a Linux + instance - instances_count: '#/components/schemas/CreateAIClusterGPUSerializer/properties/instances_count' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.instances_count" + ssh_key_name: Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint. - password: '#/components/schemas/CreateAIClusterGPUSerializer/properties/password' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.password" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - ssh_key_name: '#/components/schemas/CreateAIClusterGPUSerializer/properties/ssh_key_name' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.ssh_key_name" + user_data: String in base64 format. Must not be passed together with 'username' or + 'password'. Examples of the user_data: + https://cloudinit.readthedocs.io/en/latest/topics/examples.html - tags: '#/components/schemas/CreateAIClusterGPUSerializer/properties/tags' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.tags" - - user_data: '#/components/schemas/CreateAIClusterGPUSerializer/properties/user_data' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.user_data" - - username: '#/components/schemas/CreateAIClusterGPUSerializer/properties/username' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.username" + username: A name of a new user in the Linux instance. It may be passed with a 'password' + parameter extra_headers: Send extra headers @@ -216,17 +209,9 @@ def list( List GPU clusters Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[1].schema" + limit: Limit the number of returned clusters - limit: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[2]" - - offset: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[3]" + offset: Offset value is used to exclude the first set of records from the result extra_headers: Send extra headers @@ -279,23 +264,13 @@ def delete( Delete GPU cluster Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[2].schema" + delete_floatings: True if it is required to delete floating IPs assigned to the servers. Can't be + used with floatings. - delete_floatings: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/3' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[3]" + floatings: Comma separated list of floating ids that should be deleted. Can't be used with + delete_floatings. - floatings: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/4' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[4]" - - reserved_fixed_ips: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/5' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[5]" + reserved_fixed_ips: Comma separated list of port IDs to be deleted with the servers extra_headers: Send extra headers @@ -347,15 +322,6 @@ def get( Get GPU cluster Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}'].get.parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -395,15 +361,6 @@ def powercycle_all_servers( Powercycle (stop and start) all GPU cluster nodes, aka hard reboot Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fpowercycle/post/parameters/0/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fpowercycle/post/parameters/1/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle'].post.parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fpowercycle/post/parameters/2/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -443,15 +400,6 @@ def reboot_all_servers( Reboot all GPU cluster nodes Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Freboot/post/parameters/0/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Freboot/post/parameters/1/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot'].post.parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Freboot/post/parameters/2/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -496,23 +444,13 @@ def rebuild( provided to change the cluster image. Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[1].schema" + nodes: List of nodes uuids to be rebuild - cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[2].schema" + image_id: AI GPU image ID - nodes: '#/components/schemas/RebuildClusterSerializer/properties/nodes' - "$.components.schemas.RebuildClusterSerializer.properties.nodes" - - image_id: '#/components/schemas/RebuildClusterSerializer/properties/image_id/anyOf/0' - "$.components.schemas.RebuildClusterSerializer.properties.image_id.anyOf[0]" - - user_data: '#/components/schemas/RebuildClusterSerializer/properties/user_data/anyOf/0' - "$.components.schemas.RebuildClusterSerializer.properties.user_data.anyOf[0]" + user_data: + String in base64 format.Examples of the user_data: + https://cloudinit.readthedocs.io/en/latest/topics/examples.html extra_headers: Send extra headers @@ -562,17 +500,7 @@ def resize( Resize an existing AI GPU cluster. Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[2].schema" - - instances_count: '#/components/schemas/ResizeAIClusterGPUSerializerV1/properties/instances_count' - "$.components.schemas.ResizeAIClusterGPUSerializerV1.properties.instances_count" + instances_count: Resized (total) number of instances extra_headers: Send extra headers @@ -663,41 +591,34 @@ async def create( Create a new GPU cluster. Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[0].schema" + flavor: Flavor name - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[1].schema" + image_id: Image ID - flavor: '#/components/schemas/CreateAIClusterGPUSerializer/properties/flavor' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.flavor" + interfaces: Subnet IPs and floating IPs - image_id: '#/components/schemas/CreateAIClusterGPUSerializer/properties/image_id' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.image_id" + name: GPU Cluster name - interfaces: '#/components/schemas/CreateAIClusterGPUSerializer/properties/interfaces' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.interfaces" + instances_count: Number of servers to create - name: '#/components/schemas/CreateAIClusterGPUSerializer/properties/name' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.name" + password: A password for a bare metal server. This parameter is used to set a password for + the "Admin" user on a Windows instance, a default user or a new user on a Linux + instance - instances_count: '#/components/schemas/CreateAIClusterGPUSerializer/properties/instances_count' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.instances_count" + ssh_key_name: Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint. - password: '#/components/schemas/CreateAIClusterGPUSerializer/properties/password' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.password" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - ssh_key_name: '#/components/schemas/CreateAIClusterGPUSerializer/properties/ssh_key_name' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.ssh_key_name" + user_data: String in base64 format. Must not be passed together with 'username' or + 'password'. Examples of the user_data: + https://cloudinit.readthedocs.io/en/latest/topics/examples.html - tags: '#/components/schemas/CreateAIClusterGPUSerializer/properties/tags' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.tags" - - user_data: '#/components/schemas/CreateAIClusterGPUSerializer/properties/user_data' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.user_data" - - username: '#/components/schemas/CreateAIClusterGPUSerializer/properties/username' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.username" + username: A name of a new user in the Linux instance. It may be passed with a 'password' + parameter extra_headers: Send extra headers @@ -752,17 +673,9 @@ def list( List GPU clusters Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[1].schema" + limit: Limit the number of returned clusters - limit: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[2]" - - offset: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[3]" + offset: Offset value is used to exclude the first set of records from the result extra_headers: Send extra headers @@ -815,23 +728,13 @@ async def delete( Delete GPU cluster Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[2].schema" + delete_floatings: True if it is required to delete floating IPs assigned to the servers. Can't be + used with floatings. - delete_floatings: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/3' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[3]" + floatings: Comma separated list of floating ids that should be deleted. Can't be used with + delete_floatings. - floatings: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/4' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[4]" - - reserved_fixed_ips: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/5' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[5]" + reserved_fixed_ips: Comma separated list of port IDs to be deleted with the servers extra_headers: Send extra headers @@ -883,15 +786,6 @@ async def get( Get GPU cluster Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}'].get.parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -931,15 +825,6 @@ async def powercycle_all_servers( Powercycle (stop and start) all GPU cluster nodes, aka hard reboot Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fpowercycle/post/parameters/0/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fpowercycle/post/parameters/1/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle'].post.parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fpowercycle/post/parameters/2/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -979,15 +864,6 @@ async def reboot_all_servers( Reboot all GPU cluster nodes Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Freboot/post/parameters/0/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Freboot/post/parameters/1/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot'].post.parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Freboot/post/parameters/2/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1032,23 +908,13 @@ async def rebuild( provided to change the cluster image. Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[1].schema" + nodes: List of nodes uuids to be rebuild - cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[2].schema" + image_id: AI GPU image ID - nodes: '#/components/schemas/RebuildClusterSerializer/properties/nodes' - "$.components.schemas.RebuildClusterSerializer.properties.nodes" - - image_id: '#/components/schemas/RebuildClusterSerializer/properties/image_id/anyOf/0' - "$.components.schemas.RebuildClusterSerializer.properties.image_id.anyOf[0]" - - user_data: '#/components/schemas/RebuildClusterSerializer/properties/user_data/anyOf/0' - "$.components.schemas.RebuildClusterSerializer.properties.user_data.anyOf[0]" + user_data: + String in base64 format.Examples of the user_data: + https://cloudinit.readthedocs.io/en/latest/topics/examples.html extra_headers: Send extra headers @@ -1098,17 +964,7 @@ async def resize( Resize an existing AI GPU cluster. Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[2].schema" - - instances_count: '#/components/schemas/ResizeAIClusterGPUSerializerV1/properties/instances_count' - "$.components.schemas.ResizeAIClusterGPUSerializerV1.properties.instances_count" + instances_count: Resized (total) number of instances extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index eb2990ee..a21e19ca 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -63,11 +63,9 @@ def list( List bare metal GPU images Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/get/parameters/0/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/get/parameters/1/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].get.parameters[1].schema" + region_id: Region ID extra_headers: Send extra headers @@ -106,14 +104,11 @@ def delete( Delete bare metal GPU image by ID Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}']['delete'].parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}']['delete'].parameters[1].schema" + region_id: Region ID - image_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}']['delete'].parameters[2].schema" + image_id: Image ID extra_headers: Send extra headers @@ -154,14 +149,11 @@ def get( Get bare metal GPU image by ID Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}'].get.parameters[1].schema" + region_id: Region ID - image_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}'].get.parameters[2].schema" + image_id: Image ID extra_headers: Send extra headers @@ -211,41 +203,34 @@ def upload( Upload new bare metal GPU image Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/post/parameters/0/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/post/parameters/1/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].post.parameters[1].schema" + region_id: Region ID - name: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/name' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.name" + name: Image name - url: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/url/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.url.anyOf[0]" + url: Image URL - architecture: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/architecture/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.architecture.anyOf[0]" + architecture: Image architecture type: aarch64, x86_64 - cow_format: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/cow_format' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.cow_format" + cow_format: When True, image cannot be deleted unless all volumes, created from it, are + deleted. - hw_firmware_type: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.hw_firmware_type.anyOf[0]" + hw_firmware_type: Specifies the type of firmware with which to boot the guest. - os_distro: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_distro/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_distro.anyOf[0]" + os_distro: OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc. - os_type: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_type/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_type.anyOf[0]" + os_type: The operating system installed on the image. Linux by default - os_version: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_version/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_version.anyOf[0]" + os_version: OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian - ssh_key: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/ssh_key' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.ssh_key" + ssh_key: Permission to use a ssh key in instances - tags: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/tags' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers @@ -319,11 +304,9 @@ async def list( List bare metal GPU images Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/get/parameters/0/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/get/parameters/1/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].get.parameters[1].schema" + region_id: Region ID extra_headers: Send extra headers @@ -362,14 +345,11 @@ async def delete( Delete bare metal GPU image by ID Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}']['delete'].parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}']['delete'].parameters[1].schema" + region_id: Region ID - image_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}']['delete'].parameters[2].schema" + image_id: Image ID extra_headers: Send extra headers @@ -410,14 +390,11 @@ async def get( Get bare metal GPU image by ID Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}'].get.parameters[1].schema" + region_id: Region ID - image_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages%2F%7Bimage_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}'].get.parameters[2].schema" + image_id: Image ID extra_headers: Send extra headers @@ -467,41 +444,34 @@ async def upload( Upload new bare metal GPU image Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/post/parameters/0/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/post/parameters/1/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].post.parameters[1].schema" + region_id: Region ID - name: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/name' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.name" + name: Image name - url: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/url/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.url.anyOf[0]" + url: Image URL - architecture: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/architecture/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.architecture.anyOf[0]" + architecture: Image architecture type: aarch64, x86_64 - cow_format: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/cow_format' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.cow_format" + cow_format: When True, image cannot be deleted unless all volumes, created from it, are + deleted. - hw_firmware_type: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.hw_firmware_type.anyOf[0]" + hw_firmware_type: Specifies the type of firmware with which to boot the guest. - os_distro: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_distro/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_distro.anyOf[0]" + os_distro: OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc. - os_type: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_type/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_type.anyOf[0]" + os_type: The operating system installed on the image. Linux by default - os_version: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_version/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_version.anyOf[0]" + os_version: OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian - ssh_key: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/ssh_key' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.ssh_key" + ssh_key: Permission to use a ssh key in instances - tags: '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/tags' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index 6c4d7583..78cbdee8 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -56,15 +56,6 @@ def list( List network interfaces attached to GPU cluster servers Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Finterfaces/get/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Finterfaces/get/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces'].get.parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Finterfaces/get/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -125,15 +116,6 @@ async def list( List network interfaces attached to GPU cluster servers Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Finterfaces/get/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Finterfaces/get/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces'].get.parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Finterfaces/get/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 65cee238..06eabf2e 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -69,20 +69,8 @@ def delete( Remove single node from GPU cluster. Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[2].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[3].schema" - - delete_floatings: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/4' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[4]" + delete_floatings: Set False if you do not want to delete assigned floating IPs. By default, it's + True. extra_headers: Send extra headers @@ -138,32 +126,17 @@ def attach_interface( Attach interface to GPU cluster node Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" - - ddos_profile: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ddos_profile.allOf[0]" + ddos_profile: Advanced DDoS protection. - interface_name: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/interface_name' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.interface_name" + interface_name: Interface name - ip_family: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ip_family' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ip_family" + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - port_group: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/port_group' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.port_group" + port_group: Each group will be added to the separate trunk. - security_groups: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/security_groups' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.security_groups" + security_groups: List of security group IDs - type: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/type' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.type" + type: Must be 'external'. Union tag extra_headers: Send extra headers @@ -200,32 +173,17 @@ def attach_interface( Attach interface to GPU cluster node Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + subnet_id: Port will get an IP address from this subnet - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + ddos_profile: Advanced DDoS protection. - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + interface_name: Interface name - subnet_id: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/subnet_id' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.subnet_id" + port_group: Each group will be added to the separate trunk. - ddos_profile: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.ddos_profile.allOf[0]" + security_groups: List of security group IDs - interface_name: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/interface_name' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.interface_name" - - port_group: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/port_group' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.port_group" - - security_groups: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/security_groups' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.security_groups" - - type: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/type' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.type" + type: Must be 'subnet' extra_headers: Send extra headers @@ -263,35 +221,19 @@ def attach_interface( Attach interface to GPU cluster node Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + network_id: Port will get an IP address in this network subnet - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + ddos_profile: Advanced DDoS protection. - network_id: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/network_id' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.network_id" + interface_name: Interface name - ddos_profile: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ddos_profile.allOf[0]" + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - interface_name: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/interface_name' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.interface_name" + port_group: Each group will be added to the separate trunk. - ip_family: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ip_family' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ip_family" + security_groups: List of security group IDs - port_group: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/port_group' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.port_group" - - security_groups: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/security_groups' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.security_groups" - - type: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/type' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.type" + type: Must be 'any_subnet' extra_headers: Send extra headers @@ -329,32 +271,17 @@ def attach_interface( Attach interface to GPU cluster node Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + port_id: Port ID - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + ddos_profile: Advanced DDoS protection. - port_id: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_id' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_id" + interface_name: Interface name - ddos_profile: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.ddos_profile.allOf[0]" + port_group: Each group will be added to the separate trunk. - interface_name: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/interface_name' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.interface_name" + security_groups: List of security group IDs - port_group: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_group' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_group" - - security_groups: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/security_groups' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.security_groups" - - type: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/type' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.type" + type: Must be 'reserved_fixed_ip'. Union tag extra_headers: Send extra headers @@ -437,20 +364,9 @@ def detach_interface( Detach interface from GPU cluster node Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[2].schema" + ip_address: IP address - ip_address: '#/components/schemas/PortIdWithIpSchema/properties/ip_address' - "$.components.schemas.PortIdWithIpSchema.properties.ip_address" - - port_id: '#/components/schemas/PortIdWithIpSchema/properties/port_id' - "$.components.schemas.PortIdWithIpSchema.properties.port_id" + port_id: ID of the port extra_headers: Send extra headers @@ -498,15 +414,6 @@ def get_console( Get GPU cluster node console URL Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -546,15 +453,6 @@ def powercycle( Powercycle (stop and start) one GPU cluster node, aka hard reboot Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fpowercycle/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fpowercycle/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fpowercycle/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -594,15 +492,6 @@ def reboot( Reboot one GPU cluster node Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Freboot/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Freboot/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Freboot/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -665,20 +554,8 @@ async def delete( Remove single node from GPU cluster. Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[1].schema" - - cluster_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[2].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[3].schema" - - delete_floatings: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/4' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[4]" + delete_floatings: Set False if you do not want to delete assigned floating IPs. By default, it's + True. extra_headers: Send extra headers @@ -736,32 +613,17 @@ async def attach_interface( Attach interface to GPU cluster node Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" - - ddos_profile: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ddos_profile.allOf[0]" + ddos_profile: Advanced DDoS protection. - interface_name: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/interface_name' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.interface_name" + interface_name: Interface name - ip_family: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ip_family' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ip_family" + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - port_group: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/port_group' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.port_group" + port_group: Each group will be added to the separate trunk. - security_groups: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/security_groups' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.security_groups" + security_groups: List of security group IDs - type: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/type' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.type" + type: Must be 'external'. Union tag extra_headers: Send extra headers @@ -798,32 +660,17 @@ async def attach_interface( Attach interface to GPU cluster node Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + subnet_id: Port will get an IP address from this subnet - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + ddos_profile: Advanced DDoS protection. - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + interface_name: Interface name - subnet_id: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/subnet_id' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.subnet_id" + port_group: Each group will be added to the separate trunk. - ddos_profile: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.ddos_profile.allOf[0]" + security_groups: List of security group IDs - interface_name: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/interface_name' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.interface_name" - - port_group: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/port_group' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.port_group" - - security_groups: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/security_groups' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.security_groups" - - type: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/type' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.type" + type: Must be 'subnet' extra_headers: Send extra headers @@ -861,35 +708,19 @@ async def attach_interface( Attach interface to GPU cluster node Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + network_id: Port will get an IP address in this network subnet - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + ddos_profile: Advanced DDoS protection. - network_id: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/network_id' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.network_id" + interface_name: Interface name - ddos_profile: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ddos_profile.allOf[0]" + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - interface_name: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/interface_name' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.interface_name" + port_group: Each group will be added to the separate trunk. - ip_family: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ip_family' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ip_family" + security_groups: List of security group IDs - port_group: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/port_group' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.port_group" - - security_groups: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/security_groups' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.security_groups" - - type: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/type' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.type" + type: Must be 'any_subnet' extra_headers: Send extra headers @@ -927,32 +758,17 @@ async def attach_interface( Attach interface to GPU cluster node Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + port_id: Port ID - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + ddos_profile: Advanced DDoS protection. - port_id: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_id' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_id" + interface_name: Interface name - ddos_profile: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.ddos_profile.allOf[0]" + port_group: Each group will be added to the separate trunk. - interface_name: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/interface_name' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.interface_name" + security_groups: List of security group IDs - port_group: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_group' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_group" - - security_groups: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/security_groups' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.security_groups" - - type: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/type' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.type" + type: Must be 'reserved_fixed_ip'. Union tag extra_headers: Send extra headers @@ -1035,20 +851,9 @@ async def detach_interface( Detach interface from GPU cluster node Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[2].schema" + ip_address: IP address - ip_address: '#/components/schemas/PortIdWithIpSchema/properties/ip_address' - "$.components.schemas.PortIdWithIpSchema.properties.ip_address" - - port_id: '#/components/schemas/PortIdWithIpSchema/properties/port_id' - "$.components.schemas.PortIdWithIpSchema.properties.port_id" + port_id: ID of the port extra_headers: Send extra headers @@ -1096,15 +901,6 @@ async def get_console( Get GPU cluster node console URL Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1144,15 +940,6 @@ async def powercycle( Powercycle (stop and start) one GPU cluster node, aka hard reboot Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fpowercycle/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fpowercycle/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fpowercycle/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1192,15 +979,6 @@ async def reboot( Reboot one GPU cluster node Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Freboot/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Freboot/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Freboot/post/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index e0f7c1b2..36c254a7 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -88,50 +88,46 @@ def create( Create inference deployment Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments'].post.parameters[0].schema" + project_id: Project ID - containers: '#/components/schemas/InferenceInstanceInSerializerV3/properties/containers' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.containers" + containers: List of containers for the inference instance. - flavor_name: '#/components/schemas/InferenceInstanceInSerializerV3/properties/flavor_name' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.flavor_name" + flavor_name: Flavor name for the inference instance. - image: '#/components/schemas/InferenceInstanceInSerializerV3/properties/image' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.image" + image: Docker image for the inference instance. This field should contain the image + name and tag in the format 'name:tag', e.g., 'nginx:latest'. It defaults to + Docker Hub as the image registry, but any accessible Docker image URL can be + specified. - listening_port: '#/components/schemas/InferenceInstanceInSerializerV3/properties/listening_port' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.listening_port" + listening_port: Listening port for the inference instance. - name: '#/components/schemas/InferenceInstanceInSerializerV3/properties/name' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.name" + name: Inference instance name. - auth_enabled: '#/components/schemas/InferenceInstanceInSerializerV3/properties/auth_enabled' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.auth_enabled" + auth_enabled: Set to `true` to enable API key authentication for the inference instance. + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required + for the requests to the instance if enabled - command: '#/components/schemas/InferenceInstanceInSerializerV3/properties/command/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.command.anyOf[0]" + command: Command to be executed when running a container from an image. - credentials_name: '#/components/schemas/InferenceInstanceInSerializerV3/properties/credentials_name/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.credentials_name.anyOf[0]" + credentials_name: Registry credentials name - description: '#/components/schemas/InferenceInstanceInSerializerV3/properties/description/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.description.anyOf[0]" + description: Inference instance description. - envs: '#/components/schemas/InferenceInstanceInSerializerV3/properties/envs' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.envs" + envs: Environment variables for the inference instance. - ingress_opts: '#/components/schemas/InferenceInstanceInSerializerV3/properties/ingress_opts/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.ingress_opts.anyOf[0]" + ingress_opts: Ingress options for the inference instance - logging: '#/components/schemas/InferenceInstanceInSerializerV3/properties/logging/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.logging.anyOf[0]" + logging: Logging configuration for the inference instance - probes: '#/components/schemas/InferenceInstanceInSerializerV3/properties/probes/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.probes.anyOf[0]" + probes: 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. - api_timeout: '#/components/schemas/InferenceInstanceInSerializerV3/properties/timeout/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.timeout.anyOf[0]" + api_timeout: Specifies the duration in seconds without any requests after which the + containers will be downscaled to their minimum scale value as defined by + `scale.min`. If set, this helps in optimizing resource usage by reducing the + number of container instances during periods of inactivity. The default value + when the parameter is not set is 120. extra_headers: Send extra headers @@ -199,50 +195,44 @@ def update( Update inference deployment Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/patch/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].patch.parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/patch/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].patch.parameters[1].schema" + deployment_name: Inference instance name. - auth_enabled: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/auth_enabled/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.auth_enabled.anyOf[0]" + auth_enabled: Set to `true` to enable API key authentication for the inference instance. + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required + for the requests to the instance if enabled - command: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/command/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.command.anyOf[0]" + command: Command to be executed when running a container from an image. - containers: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/containers/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.containers.anyOf[0]" + containers: List of containers for the inference instance. - credentials_name: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/credentials_name/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.credentials_name.anyOf[0]" + credentials_name: Registry credentials name - description: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/description/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.description.anyOf[0]" + description: Inference instance description. - envs: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/envs/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.envs.anyOf[0]" + envs: Environment variables for the inference instance. - flavor_name: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/flavor_name/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.flavor_name.anyOf[0]" + flavor_name: Flavor name for the inference instance. - image: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/image/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.image.anyOf[0]" + image: Docker image for the inference instance. This field should contain the image + name and tag in the format 'name:tag', e.g., 'nginx:latest'. It defaults to + Docker Hub as the image registry, but any accessible Docker image URL can be + specified. - ingress_opts: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/ingress_opts/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.ingress_opts.anyOf[0]" + ingress_opts: Ingress options for the inference instance - listening_port: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/listening_port/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.listening_port.anyOf[0]" + listening_port: Listening port for the inference instance. - logging: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/logging/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.logging.anyOf[0]" + logging: Logging configuration for the inference instance - probes: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/probes/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.probes.anyOf[0]" + probes: Probes configured for all containers of the inference instance. - api_timeout: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/timeout/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.timeout.anyOf[0]" + api_timeout: Specifies the duration in seconds without any requests after which the + containers will be downscaled to their minimum scale value as defined by + `scale.min`. If set, this helps in optimizing resource usage by reducing the + number of container instances during periods of inactivity. The default value + when the parameter is not set is 120. extra_headers: Send extra headers @@ -295,18 +285,17 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[Inference]: - """ - List inference deployments + """List inference deployments Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[0].schema" + project_id: Project ID + + limit: Optional. - limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/1' - "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[1]" + Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/2' - "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[2]" + offset: Optional. Offset value is used to exclude the first set of records from the + result extra_headers: Send extra headers @@ -353,11 +342,9 @@ def delete( Delete inference deployment Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/delete/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}']['delete'].parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/delete/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}']['delete'].parameters[1].schema" + deployment_name: Inference instance name. extra_headers: Send extra headers @@ -395,11 +382,9 @@ def get( Get inference deployment Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].get.parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/get/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].get.parameters[1].schema" + deployment_name: Inference instance name. extra_headers: Send extra headers @@ -437,11 +422,9 @@ def get_api_key( Get inference deployment API key Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fapikey/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey'].get.parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fapikey/get/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey'].get.parameters[1].schema" + deployment_name: Inference instance name. extra_headers: Send extra headers @@ -486,11 +469,9 @@ def start( according to the configured scaling rules. Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstart/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start'].post.parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstart/post/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start'].post.parameters[1].schema" + deployment_name: Inference instance name. extra_headers: Send extra headers @@ -536,11 +517,9 @@ def stop( - While stopped, the deployment will **not** incur any charges. Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstop/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop'].post.parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstop/post/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop'].post.parameters[1].schema" + deployment_name: Inference instance name. extra_headers: Send extra headers @@ -617,50 +596,46 @@ async def create( Create inference deployment Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments'].post.parameters[0].schema" + project_id: Project ID - containers: '#/components/schemas/InferenceInstanceInSerializerV3/properties/containers' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.containers" + containers: List of containers for the inference instance. - flavor_name: '#/components/schemas/InferenceInstanceInSerializerV3/properties/flavor_name' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.flavor_name" + flavor_name: Flavor name for the inference instance. - image: '#/components/schemas/InferenceInstanceInSerializerV3/properties/image' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.image" + image: Docker image for the inference instance. This field should contain the image + name and tag in the format 'name:tag', e.g., 'nginx:latest'. It defaults to + Docker Hub as the image registry, but any accessible Docker image URL can be + specified. - listening_port: '#/components/schemas/InferenceInstanceInSerializerV3/properties/listening_port' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.listening_port" + listening_port: Listening port for the inference instance. - name: '#/components/schemas/InferenceInstanceInSerializerV3/properties/name' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.name" + name: Inference instance name. - auth_enabled: '#/components/schemas/InferenceInstanceInSerializerV3/properties/auth_enabled' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.auth_enabled" + auth_enabled: Set to `true` to enable API key authentication for the inference instance. + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required + for the requests to the instance if enabled - command: '#/components/schemas/InferenceInstanceInSerializerV3/properties/command/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.command.anyOf[0]" + command: Command to be executed when running a container from an image. - credentials_name: '#/components/schemas/InferenceInstanceInSerializerV3/properties/credentials_name/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.credentials_name.anyOf[0]" + credentials_name: Registry credentials name - description: '#/components/schemas/InferenceInstanceInSerializerV3/properties/description/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.description.anyOf[0]" + description: Inference instance description. - envs: '#/components/schemas/InferenceInstanceInSerializerV3/properties/envs' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.envs" + envs: Environment variables for the inference instance. - ingress_opts: '#/components/schemas/InferenceInstanceInSerializerV3/properties/ingress_opts/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.ingress_opts.anyOf[0]" + ingress_opts: Ingress options for the inference instance - logging: '#/components/schemas/InferenceInstanceInSerializerV3/properties/logging/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.logging.anyOf[0]" + logging: Logging configuration for the inference instance - probes: '#/components/schemas/InferenceInstanceInSerializerV3/properties/probes/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.probes.anyOf[0]" + probes: 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. - api_timeout: '#/components/schemas/InferenceInstanceInSerializerV3/properties/timeout/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.timeout.anyOf[0]" + api_timeout: Specifies the duration in seconds without any requests after which the + containers will be downscaled to their minimum scale value as defined by + `scale.min`. If set, this helps in optimizing resource usage by reducing the + number of container instances during periods of inactivity. The default value + when the parameter is not set is 120. extra_headers: Send extra headers @@ -728,50 +703,44 @@ async def update( Update inference deployment Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/patch/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].patch.parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/patch/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].patch.parameters[1].schema" + deployment_name: Inference instance name. - auth_enabled: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/auth_enabled/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.auth_enabled.anyOf[0]" + auth_enabled: Set to `true` to enable API key authentication for the inference instance. + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required + for the requests to the instance if enabled - command: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/command/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.command.anyOf[0]" + command: Command to be executed when running a container from an image. - containers: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/containers/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.containers.anyOf[0]" + containers: List of containers for the inference instance. - credentials_name: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/credentials_name/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.credentials_name.anyOf[0]" + credentials_name: Registry credentials name - description: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/description/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.description.anyOf[0]" + description: Inference instance description. - envs: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/envs/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.envs.anyOf[0]" + envs: Environment variables for the inference instance. - flavor_name: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/flavor_name/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.flavor_name.anyOf[0]" + flavor_name: Flavor name for the inference instance. - image: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/image/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.image.anyOf[0]" + image: Docker image for the inference instance. This field should contain the image + name and tag in the format 'name:tag', e.g., 'nginx:latest'. It defaults to + Docker Hub as the image registry, but any accessible Docker image URL can be + specified. - ingress_opts: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/ingress_opts/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.ingress_opts.anyOf[0]" + ingress_opts: Ingress options for the inference instance - listening_port: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/listening_port/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.listening_port.anyOf[0]" + listening_port: Listening port for the inference instance. - logging: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/logging/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.logging.anyOf[0]" + logging: Logging configuration for the inference instance - probes: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/probes/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.probes.anyOf[0]" + probes: Probes configured for all containers of the inference instance. - api_timeout: '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/timeout/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.timeout.anyOf[0]" + api_timeout: Specifies the duration in seconds without any requests after which the + containers will be downscaled to their minimum scale value as defined by + `scale.min`. If set, this helps in optimizing resource usage by reducing the + number of container instances during periods of inactivity. The default value + when the parameter is not set is 120. extra_headers: Send extra headers @@ -824,18 +793,17 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Inference, AsyncOffsetPage[Inference]]: - """ - List inference deployments + """List inference deployments Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[0].schema" + project_id: Project ID + + limit: Optional. - limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/1' - "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[1]" + Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/2' - "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[2]" + offset: Optional. Offset value is used to exclude the first set of records from the + result extra_headers: Send extra headers @@ -882,11 +850,9 @@ async def delete( Delete inference deployment Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/delete/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}']['delete'].parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/delete/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}']['delete'].parameters[1].schema" + deployment_name: Inference instance name. extra_headers: Send extra headers @@ -924,11 +890,9 @@ async def get( Get inference deployment Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].get.parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/get/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].get.parameters[1].schema" + deployment_name: Inference instance name. extra_headers: Send extra headers @@ -966,11 +930,9 @@ async def get_api_key( Get inference deployment API key Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fapikey/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey'].get.parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fapikey/get/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey'].get.parameters[1].schema" + deployment_name: Inference instance name. extra_headers: Send extra headers @@ -1015,11 +977,9 @@ async def start( according to the configured scaling rules. Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstart/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start'].post.parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstart/post/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start'].post.parameters[1].schema" + deployment_name: Inference instance name. extra_headers: Send extra headers @@ -1065,11 +1025,9 @@ async def stop( - While stopped, the deployment will **not** incur any charges. Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstop/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop'].post.parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Fstop/post/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop'].post.parameters[1].schema" + deployment_name: Inference instance name. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index c721e180..78941e3e 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -65,23 +65,18 @@ def list( Get inference deployment logs Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[1].schema" + deployment_name: Inference instance name. - limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/2' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[2]" + limit: Optional. Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/3' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[3]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - order_by: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/4' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[4]" + order_by: Order by field - region_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/5/schema/anyOf/0' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[5].schema.anyOf[0]" + region_id: Region ID extra_headers: Send extra headers @@ -157,23 +152,18 @@ def list( Get inference deployment logs Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[0].schema" + project_id: Project ID - deployment_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[1].schema" + deployment_name: Inference instance name. - limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/2' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[2]" + limit: Optional. Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/3' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[3]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - order_by: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/4' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[4]" + order_by: Order by field - region_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/5/schema/anyOf/0' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[5].schema.anyOf[0]" + region_id: Region ID extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index 62a71e7c..34f474c8 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -54,15 +54,15 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[InferenceFlavor]: - """ - List inference flavors + """List inference flavors Args: - limit: '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors/get/parameters/0' - "$.paths['/cloud/v3/inference/flavors'].get.parameters[0]" + limit: Optional. + + Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors/get/parameters/1' - "$.paths['/cloud/v3/inference/flavors'].get.parameters[1]" + offset: Optional. Offset value is used to exclude the first set of records from the + result extra_headers: Send extra headers @@ -106,8 +106,7 @@ def get( Get inference flavor Args: - flavor_name: '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors%2F%7Bflavor_name%7D/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/flavors/{flavor_name}'].get.parameters[0].schema" + flavor_name: Inference flavor name. extra_headers: Send extra headers @@ -160,15 +159,15 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[InferenceFlavor, AsyncOffsetPage[InferenceFlavor]]: - """ - List inference flavors + """List inference flavors Args: - limit: '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors/get/parameters/0' - "$.paths['/cloud/v3/inference/flavors'].get.parameters[0]" + limit: Optional. + + Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors/get/parameters/1' - "$.paths['/cloud/v3/inference/flavors'].get.parameters[1]" + offset: Optional. Offset value is used to exclude the first set of records from the + result extra_headers: Send extra headers @@ -212,8 +211,7 @@ async def get( Get inference flavor Args: - flavor_name: '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors%2F%7Bflavor_name%7D/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/flavors/{flavor_name}'].get.parameters[0].schema" + flavor_name: Inference flavor name. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/inference/models.py b/src/gcore/resources/cloud/inference/models.py index 4ea98ece..fecd820f 100644 --- a/src/gcore/resources/cloud/inference/models.py +++ b/src/gcore/resources/cloud/inference/models.py @@ -56,18 +56,17 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[MlcatalogModelCard]: - """ - List models from catalog + """List models from catalog Args: - limit: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/0' - "$.paths['/cloud/v3/inference/models'].get.parameters[0]" + limit: Optional. + + Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/1' - "$.paths['/cloud/v3/inference/models'].get.parameters[1]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - order_by: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/2' - "$.paths['/cloud/v3/inference/models'].get.parameters[2]" + order_by: Order instances by transmitted fields and directions extra_headers: Send extra headers @@ -112,8 +111,7 @@ def get( Get model from catalog Args: - model_id: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels%2F%7Bmodel_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/models/{model_id}'].get.parameters[0].schema" + model_id: Model ID extra_headers: Send extra headers @@ -167,18 +165,17 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[MlcatalogModelCard, AsyncOffsetPage[MlcatalogModelCard]]: - """ - List models from catalog + """List models from catalog Args: - limit: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/0' - "$.paths['/cloud/v3/inference/models'].get.parameters[0]" + limit: Optional. + + Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/1' - "$.paths['/cloud/v3/inference/models'].get.parameters[1]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - order_by: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/2' - "$.paths['/cloud/v3/inference/models'].get.parameters[2]" + order_by: Order instances by transmitted fields and directions extra_headers: Send extra headers @@ -223,8 +220,7 @@ async def get( Get model from catalog Args: - model_id: '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels%2F%7Bmodel_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/models/{model_id}'].get.parameters[0].schema" + model_id: Model ID extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 2d92bc62..25ac65da 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -66,20 +66,15 @@ def create( Create inference registry credential Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].post.parameters[0].schema" + project_id: Project ID - name: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/name' - "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.name" + name: Registry credential name. - password: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/password' - "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.password" + password: Registry password. - registry_url: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/registry_url' - "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.registry_url" + registry_url: Registry URL. - username: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/username' - "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.username" + username: Registry username. extra_headers: Send extra headers @@ -125,14 +120,12 @@ def list( List inference registry credentials Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[0].schema" + project_id: Project ID - limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/1' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[1]" + limit: Optional. Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/2' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[2]" + offset: Optional. Offset value is used to exclude the first set of records from the + result extra_headers: Send extra headers @@ -179,11 +172,9 @@ def delete( Delete inference registry credential Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/delete/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}']['delete'].parameters[0].schema" + project_id: Project ID - credential_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/delete/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}']['delete'].parameters[1].schema" + credential_name: Registry credential name. extra_headers: Send extra headers @@ -222,11 +213,9 @@ def get( Get inference registry credential Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].get.parameters[0].schema" + project_id: Project ID - credential_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/get/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].get.parameters[1].schema" + credential_name: Registry credential name. extra_headers: Send extra headers @@ -267,20 +256,15 @@ def replace( Update inference registry credential Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/put/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].put.parameters[0].schema" + project_id: Project ID - credential_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/put/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].put.parameters[1].schema" + credential_name: Registry credential name. - password: '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/password' - "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.password" + password: Registry password. - registry_url: '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/registry_url' - "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.registry_url" + registry_url: Registry URL. - username: '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/username' - "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.username" + username: Registry username. extra_headers: Send extra headers @@ -351,20 +335,15 @@ async def create( Create inference registry credential Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].post.parameters[0].schema" + project_id: Project ID - name: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/name' - "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.name" + name: Registry credential name. - password: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/password' - "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.password" + password: Registry password. - registry_url: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/registry_url' - "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.registry_url" + registry_url: Registry URL. - username: '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/username' - "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.username" + username: Registry username. extra_headers: Send extra headers @@ -410,14 +389,12 @@ def list( List inference registry credentials Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[0].schema" + project_id: Project ID - limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/1' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[1]" + limit: Optional. Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/2' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[2]" + offset: Optional. Offset value is used to exclude the first set of records from the + result extra_headers: Send extra headers @@ -464,11 +441,9 @@ async def delete( Delete inference registry credential Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/delete/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}']['delete'].parameters[0].schema" + project_id: Project ID - credential_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/delete/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}']['delete'].parameters[1].schema" + credential_name: Registry credential name. extra_headers: Send extra headers @@ -507,11 +482,9 @@ async def get( Get inference registry credential Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].get.parameters[0].schema" + project_id: Project ID - credential_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/get/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].get.parameters[1].schema" + credential_name: Registry credential name. extra_headers: Send extra headers @@ -552,20 +525,15 @@ async def replace( Update inference registry credential Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/put/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].put.parameters[0].schema" + project_id: Project ID - credential_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/put/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].put.parameters[1].schema" + credential_name: Registry credential name. - password: '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/password' - "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.password" + password: Registry password. - registry_url: '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/registry_url' - "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.registry_url" + registry_url: Registry URL. - username: '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/username' - "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.username" + username: Registry username. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index ac0e5255..833e4ff1 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -61,17 +61,13 @@ def create( Create Inference Secret Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets'].post.parameters[0].schema" + project_id: Project ID - data: '#/components/schemas/InferenceBoxSecretsInSerializer/properties/data' - "$.components.schemas.InferenceBoxSecretsInSerializer.properties.data" + data: Secret data. - name: '#/components/schemas/InferenceBoxSecretsInSerializer/properties/name' - "$.components.schemas.InferenceBoxSecretsInSerializer.properties.name" + name: Secret name. - type: '#/components/schemas/InferenceBoxSecretsInSerializer/properties/type' - "$.components.schemas.InferenceBoxSecretsInSerializer.properties.type" + type: Secret type. Currently only `aws-iam` is supported. extra_headers: Send extra headers @@ -112,18 +108,17 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[InferenceSecret]: - """ - List Secrets for Inference + """List Secrets for Inference Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[0].schema" + project_id: Project ID + + limit: Optional. - limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/1' - "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[1]" + Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/2' - "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[2]" + offset: Optional. Offset value is used to exclude the first set of records from the + result extra_headers: Send extra headers @@ -170,11 +165,9 @@ def delete( Delete Inference Secret Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/delete/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}']['delete'].parameters[0].schema" + project_id: Project ID - secret_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/delete/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}']['delete'].parameters[1].schema" + secret_name: Inference secret name. extra_headers: Send extra headers @@ -213,11 +206,9 @@ def get( Get Inference Secret Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].get.parameters[0].schema" + project_id: Project ID - secret_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/get/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].get.parameters[1].schema" + secret_name: Inference secret name. extra_headers: Send extra headers @@ -257,17 +248,13 @@ def replace( Update Inference Secret Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/put/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].put.parameters[0].schema" + project_id: Project ID - secret_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/put/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].put.parameters[1].schema" + secret_name: Inference secret name. - data: '#/components/schemas/InferenceSecretInUpdateSerializer/properties/data' - "$.components.schemas.InferenceSecretInUpdateSerializer.properties.data" + data: Secret data. - type: '#/components/schemas/InferenceSecretInUpdateSerializer/properties/type' - "$.components.schemas.InferenceSecretInUpdateSerializer.properties.type" + type: Secret type. extra_headers: Send extra headers @@ -335,17 +322,13 @@ async def create( Create Inference Secret Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets'].post.parameters[0].schema" + project_id: Project ID - data: '#/components/schemas/InferenceBoxSecretsInSerializer/properties/data' - "$.components.schemas.InferenceBoxSecretsInSerializer.properties.data" + data: Secret data. - name: '#/components/schemas/InferenceBoxSecretsInSerializer/properties/name' - "$.components.schemas.InferenceBoxSecretsInSerializer.properties.name" + name: Secret name. - type: '#/components/schemas/InferenceBoxSecretsInSerializer/properties/type' - "$.components.schemas.InferenceBoxSecretsInSerializer.properties.type" + type: Secret type. Currently only `aws-iam` is supported. extra_headers: Send extra headers @@ -386,18 +369,17 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[InferenceSecret, AsyncOffsetPage[InferenceSecret]]: - """ - List Secrets for Inference + """List Secrets for Inference Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[0].schema" + project_id: Project ID + + limit: Optional. - limit: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/1' - "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[1]" + Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/2' - "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[2]" + offset: Optional. Offset value is used to exclude the first set of records from the + result extra_headers: Send extra headers @@ -444,11 +426,9 @@ async def delete( Delete Inference Secret Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/delete/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}']['delete'].parameters[0].schema" + project_id: Project ID - secret_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/delete/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}']['delete'].parameters[1].schema" + secret_name: Inference secret name. extra_headers: Send extra headers @@ -487,11 +467,9 @@ async def get( Get Inference Secret Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].get.parameters[0].schema" + project_id: Project ID - secret_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/get/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].get.parameters[1].schema" + secret_name: Inference secret name. extra_headers: Send extra headers @@ -531,17 +509,13 @@ async def replace( Update Inference Secret Args: - project_id: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/put/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].put.parameters[0].schema" + project_id: Project ID - secret_name: '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/put/parameters/1/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].put.parameters[1].schema" + secret_name: Inference secret name. - data: '#/components/schemas/InferenceSecretInUpdateSerializer/properties/data' - "$.components.schemas.InferenceSecretInUpdateSerializer.properties.data" + data: Secret data. - type: '#/components/schemas/InferenceSecretInUpdateSerializer/properties/type' - "$.components.schemas.InferenceSecretInUpdateSerializer.properties.type" + type: Secret type. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 9eacb19c..4525a6c3 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -66,23 +66,13 @@ def list( as 0. If you get Pricing Error contact the support Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[0].schema" + disabled: Flag for filtering disabled flavors in the region. Defaults to true - region_id: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[1].schema" + exclude_linux: Set to true to exclude flavors dedicated to linux images. Default False - disabled: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[2]" + exclude_windows: Set to true to exclude flavors dedicated to windows images. Default False - exclude_linux: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[3]" - - exclude_windows: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[4]" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[5]" + include_prices: Set to true if the response should include flavor prices extra_headers: Send extra headers @@ -134,17 +124,7 @@ def list_for_resize( List suitable flavors for instance resize Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[2].schema" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/3' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[3]" + include_prices: Set to true if flavor listing should include flavor prices extra_headers: Send extra headers @@ -188,21 +168,14 @@ def list_suitable( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> InstanceFlavorList: - """ - List suitable flavors for instance creation + """List suitable flavors for instance creation Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[1].schema" + volumes: Volumes details. - volumes: '#/components/schemas/CreateInstanceVolumeListSchema/properties/volumes' - "$.components.schemas.CreateInstanceVolumeListSchema.properties.volumes" + Non-important info such as names may be omitted. - include_prices: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/2' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[2]" + include_prices: Set to true if flavor listing should include flavor prices extra_headers: Send extra headers @@ -275,23 +248,13 @@ async def list( as 0. If you get Pricing Error contact the support Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[0].schema" + disabled: Flag for filtering disabled flavors in the region. Defaults to true - region_id: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[1].schema" + exclude_linux: Set to true to exclude flavors dedicated to linux images. Default False - disabled: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[2]" + exclude_windows: Set to true to exclude flavors dedicated to windows images. Default False - exclude_linux: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[3]" - - exclude_windows: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[4]" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[5]" + include_prices: Set to true if the response should include flavor prices extra_headers: Send extra headers @@ -343,17 +306,7 @@ async def list_for_resize( List suitable flavors for instance resize Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[2].schema" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/3' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[3]" + include_prices: Set to true if flavor listing should include flavor prices extra_headers: Send extra headers @@ -397,21 +350,14 @@ async def list_suitable( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> InstanceFlavorList: - """ - List suitable flavors for instance creation + """List suitable flavors for instance creation Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[1].schema" + volumes: Volumes details. - volumes: '#/components/schemas/CreateInstanceVolumeListSchema/properties/volumes' - "$.components.schemas.CreateInstanceVolumeListSchema.properties.volumes" + Non-important info such as names may be omitted. - include_prices: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/2' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[2]" + include_prices: Set to true if flavor listing should include flavor prices extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index 71024123..a627e99a 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -77,35 +77,23 @@ def update( Update image fields Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[0].schema" + hw_firmware_type: Specifies the type of firmware with which to boot the guest. - region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[1].schema" + hw_machine_type: A virtual chipset type. - image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[2].schema" + is_baremetal: Set to true if the image will be used by bare metal servers. - hw_firmware_type: '#/components/schemas/UpdateImageSerializer/properties/hw_firmware_type' - "$.components.schemas.UpdateImageSerializer.properties.hw_firmware_type" + name: Image display name - hw_machine_type: '#/components/schemas/UpdateImageSerializer/properties/hw_machine_type' - "$.components.schemas.UpdateImageSerializer.properties.hw_machine_type" + os_type: The operating system installed on the image. - is_baremetal: '#/components/schemas/UpdateImageSerializer/properties/is_baremetal' - "$.components.schemas.UpdateImageSerializer.properties.is_baremetal" + ssh_key: Whether the image supports SSH key or not - name: '#/components/schemas/UpdateImageSerializer/properties/name' - "$.components.schemas.UpdateImageSerializer.properties.name" - - os_type: '#/components/schemas/UpdateImageSerializer/properties/os_type' - "$.components.schemas.UpdateImageSerializer.properties.os_type" - - ssh_key: '#/components/schemas/UpdateImageSerializer/properties/ssh_key' - "$.components.schemas.UpdateImageSerializer.properties.ssh_key" - - tags: '#/components/schemas/UpdateImageSerializer/properties/tags' - "$.components.schemas.UpdateImageSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers @@ -164,26 +152,17 @@ def list( public OR shared with the client Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[1].schema" + include_prices: Show price - include_prices: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[2]" + private: Any value to show private images - private: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[3]" + tag_key: Filter by tag keys. - tag_key: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[4]" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. 'curl -G + --data-urlencode 'tag_key_value={"key": "value"}' --url + 'http://localhost:1111/v1/images/1/1'" - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[5]" - - visibility: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[6]" + visibility: Image visibility. Globally visible images are public extra_headers: Send extra headers @@ -235,15 +214,6 @@ def delete( Delete the image Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}']['delete'].parameters[1].schema" - - image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -292,41 +262,29 @@ def create_from_volume( Create image from volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[0].schema" + name: Image name - region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[1].schema" + volume_id: Required if source is volume. Volume id - name: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/name' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.name" + architecture: Image CPU architecture type: `aarch64`, `x86_64` - volume_id: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/volume_id' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.volume_id" + hw_firmware_type: Specifies the type of firmware with which to boot the guest. - architecture: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/architecture' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.architecture" + hw_machine_type: A virtual chipset type. - hw_firmware_type: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.hw_firmware_type.anyOf[0]" + is_baremetal: Set to true if the image will be used by bare metal servers. Defaults to false. - hw_machine_type: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/hw_machine_type/anyOf/0' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.hw_machine_type.anyOf[0]" + os_type: The operating system installed on the image. - is_baremetal: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/is_baremetal' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.is_baremetal" + source: Image source - os_type: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/os_type' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.os_type" + ssh_key: Whether the image supports SSH key or not - source: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/source' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.source" - - ssh_key: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/ssh_key' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.ssh_key" - - tags: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/tags' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers @@ -381,17 +339,7 @@ def get( Get image Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[1].schema" - - image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[2].schema" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/3' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[3]" + include_prices: Show price extra_headers: Send extra headers @@ -447,47 +395,34 @@ def upload( Upload image Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[1].schema" - - name: '#/components/schemas/ImageDownloadSerializer/properties/name' - "$.components.schemas.ImageDownloadSerializer.properties.name" + name: Image name - url: '#/components/schemas/ImageDownloadSerializer/properties/url' - "$.components.schemas.ImageDownloadSerializer.properties.url" + url: URL - architecture: '#/components/schemas/ImageDownloadSerializer/properties/architecture' - "$.components.schemas.ImageDownloadSerializer.properties.architecture" + architecture: Image CPU architecture type: `aarch64`, `x86_64` - cow_format: '#/components/schemas/ImageDownloadSerializer/properties/cow_format' - "$.components.schemas.ImageDownloadSerializer.properties.cow_format" + cow_format: When True, image cannot be deleted unless all volumes, created from it, are + deleted. - hw_firmware_type: '#/components/schemas/ImageDownloadSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.ImageDownloadSerializer.properties.hw_firmware_type.anyOf[0]" + hw_firmware_type: Specifies the type of firmware with which to boot the guest. - hw_machine_type: '#/components/schemas/ImageDownloadSerializer/properties/hw_machine_type/anyOf/0' - "$.components.schemas.ImageDownloadSerializer.properties.hw_machine_type.anyOf[0]" + hw_machine_type: A virtual chipset type. - is_baremetal: '#/components/schemas/ImageDownloadSerializer/properties/is_baremetal' - "$.components.schemas.ImageDownloadSerializer.properties.is_baremetal" + is_baremetal: Set to true if the image will be used by bare metal servers. Defaults to false. - os_distro: '#/components/schemas/ImageDownloadSerializer/properties/os_distro/anyOf/0' - "$.components.schemas.ImageDownloadSerializer.properties.os_distro.anyOf[0]" + os_distro: OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc. - os_type: '#/components/schemas/ImageDownloadSerializer/properties/os_type' - "$.components.schemas.ImageDownloadSerializer.properties.os_type" + os_type: The operating system installed on the image. - os_version: '#/components/schemas/ImageDownloadSerializer/properties/os_version/anyOf/0' - "$.components.schemas.ImageDownloadSerializer.properties.os_version.anyOf[0]" + os_version: OS version, i.e. 22.04 (for Ubuntu) or 9.4 for Debian - ssh_key: '#/components/schemas/ImageDownloadSerializer/properties/ssh_key' - "$.components.schemas.ImageDownloadSerializer.properties.ssh_key" + ssh_key: Whether the image supports SSH key or not - tags: '#/components/schemas/ImageDownloadSerializer/properties/tags' - "$.components.schemas.ImageDownloadSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers @@ -571,35 +506,23 @@ async def update( Update image fields Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[0].schema" + hw_firmware_type: Specifies the type of firmware with which to boot the guest. - region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[1].schema" + hw_machine_type: A virtual chipset type. - image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[2].schema" + is_baremetal: Set to true if the image will be used by bare metal servers. - hw_firmware_type: '#/components/schemas/UpdateImageSerializer/properties/hw_firmware_type' - "$.components.schemas.UpdateImageSerializer.properties.hw_firmware_type" + name: Image display name - hw_machine_type: '#/components/schemas/UpdateImageSerializer/properties/hw_machine_type' - "$.components.schemas.UpdateImageSerializer.properties.hw_machine_type" + os_type: The operating system installed on the image. - is_baremetal: '#/components/schemas/UpdateImageSerializer/properties/is_baremetal' - "$.components.schemas.UpdateImageSerializer.properties.is_baremetal" + ssh_key: Whether the image supports SSH key or not - name: '#/components/schemas/UpdateImageSerializer/properties/name' - "$.components.schemas.UpdateImageSerializer.properties.name" - - os_type: '#/components/schemas/UpdateImageSerializer/properties/os_type' - "$.components.schemas.UpdateImageSerializer.properties.os_type" - - ssh_key: '#/components/schemas/UpdateImageSerializer/properties/ssh_key' - "$.components.schemas.UpdateImageSerializer.properties.ssh_key" - - tags: '#/components/schemas/UpdateImageSerializer/properties/tags' - "$.components.schemas.UpdateImageSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers @@ -658,26 +581,17 @@ async def list( public OR shared with the client Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[1].schema" + include_prices: Show price - include_prices: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[2]" + private: Any value to show private images - private: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[3]" + tag_key: Filter by tag keys. - tag_key: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[4]" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. 'curl -G + --data-urlencode 'tag_key_value={"key": "value"}' --url + 'http://localhost:1111/v1/images/1/1'" - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[5]" - - visibility: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[6]" + visibility: Image visibility. Globally visible images are public extra_headers: Send extra headers @@ -729,15 +643,6 @@ async def delete( Delete the image Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}']['delete'].parameters[1].schema" - - image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -786,41 +691,29 @@ async def create_from_volume( Create image from volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[0].schema" + name: Image name - region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[1].schema" + volume_id: Required if source is volume. Volume id - name: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/name' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.name" + architecture: Image CPU architecture type: `aarch64`, `x86_64` - volume_id: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/volume_id' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.volume_id" + hw_firmware_type: Specifies the type of firmware with which to boot the guest. - architecture: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/architecture' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.architecture" + hw_machine_type: A virtual chipset type. - hw_firmware_type: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.hw_firmware_type.anyOf[0]" + is_baremetal: Set to true if the image will be used by bare metal servers. Defaults to false. - hw_machine_type: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/hw_machine_type/anyOf/0' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.hw_machine_type.anyOf[0]" + os_type: The operating system installed on the image. - is_baremetal: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/is_baremetal' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.is_baremetal" + source: Image source - os_type: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/os_type' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.os_type" + ssh_key: Whether the image supports SSH key or not - source: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/source' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.source" - - ssh_key: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/ssh_key' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.ssh_key" - - tags: '#/components/schemas/ImageCreateFromVolumeSerializer/properties/tags' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers @@ -875,17 +768,7 @@ async def get( Get image Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[1].schema" - - image_id: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[2].schema" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/3' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[3]" + include_prices: Show price extra_headers: Send extra headers @@ -941,47 +824,34 @@ async def upload( Upload image Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[1].schema" - - name: '#/components/schemas/ImageDownloadSerializer/properties/name' - "$.components.schemas.ImageDownloadSerializer.properties.name" + name: Image name - url: '#/components/schemas/ImageDownloadSerializer/properties/url' - "$.components.schemas.ImageDownloadSerializer.properties.url" + url: URL - architecture: '#/components/schemas/ImageDownloadSerializer/properties/architecture' - "$.components.schemas.ImageDownloadSerializer.properties.architecture" + architecture: Image CPU architecture type: `aarch64`, `x86_64` - cow_format: '#/components/schemas/ImageDownloadSerializer/properties/cow_format' - "$.components.schemas.ImageDownloadSerializer.properties.cow_format" + cow_format: When True, image cannot be deleted unless all volumes, created from it, are + deleted. - hw_firmware_type: '#/components/schemas/ImageDownloadSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.ImageDownloadSerializer.properties.hw_firmware_type.anyOf[0]" + hw_firmware_type: Specifies the type of firmware with which to boot the guest. - hw_machine_type: '#/components/schemas/ImageDownloadSerializer/properties/hw_machine_type/anyOf/0' - "$.components.schemas.ImageDownloadSerializer.properties.hw_machine_type.anyOf[0]" + hw_machine_type: A virtual chipset type. - is_baremetal: '#/components/schemas/ImageDownloadSerializer/properties/is_baremetal' - "$.components.schemas.ImageDownloadSerializer.properties.is_baremetal" + is_baremetal: Set to true if the image will be used by bare metal servers. Defaults to false. - os_distro: '#/components/schemas/ImageDownloadSerializer/properties/os_distro/anyOf/0' - "$.components.schemas.ImageDownloadSerializer.properties.os_distro.anyOf[0]" + os_distro: OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc. - os_type: '#/components/schemas/ImageDownloadSerializer/properties/os_type' - "$.components.schemas.ImageDownloadSerializer.properties.os_type" + os_type: The operating system installed on the image. - os_version: '#/components/schemas/ImageDownloadSerializer/properties/os_version/anyOf/0' - "$.components.schemas.ImageDownloadSerializer.properties.os_version.anyOf[0]" + os_version: OS version, i.e. 22.04 (for Ubuntu) or 9.4 for Debian - ssh_key: '#/components/schemas/ImageDownloadSerializer/properties/ssh_key' - "$.components.schemas.ImageDownloadSerializer.properties.ssh_key" + ssh_key: Whether the image supports SSH key or not - tags: '#/components/schemas/ImageDownloadSerializer/properties/tags' - "$.components.schemas.ImageDownloadSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 06a36920..22513fc5 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -149,53 +149,64 @@ def create( via 'user_data'. Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - flavor: '#/components/schemas/CreateInstanceSerializerV2/properties/flavor' - "$.components.schemas.CreateInstanceSerializerV2.properties.flavor" + flavor: The flavor of the instance. - interfaces: '#/components/schemas/CreateInstanceSerializerV2/properties/interfaces' - "$.components.schemas.CreateInstanceSerializerV2.properties.interfaces" + interfaces: A list of network interfaces for the instance. You can create one or more + interfaces—private, public, or both. - volumes: '#/components/schemas/CreateInstanceSerializerV2/properties/volumes' - "$.components.schemas.CreateInstanceSerializerV2.properties.volumes" + volumes: List of volumes for instances - allow_app_ports: '#/components/schemas/CreateInstanceSerializerV2/properties/allow_app_ports' - "$.components.schemas.CreateInstanceSerializerV2.properties.allow_app_ports" + allow_app_ports: Set to `true` if creating the instance from an `apptemplate`. This allows + application ports in the security group for instances created from a marketplace + application template. - configuration: '#/components/schemas/CreateInstanceSerializerV2/properties/configuration/anyOf/0' - "$.components.schemas.CreateInstanceSerializerV2.properties.configuration.anyOf[0]" + configuration: Parameters for the application template if creating the instance from an + `apptemplate`. - name_templates: '#/components/schemas/CreateInstanceSerializerV2/properties/name_templates' - "$.components.schemas.CreateInstanceSerializerV2.properties.name_templates" + name_templates: If you want instance names to be automatically generated using IP octets, you + can specify name templates instead of setting names manually.Provide a list of + templated names that should be replaced using the selected template. The + following template formats are supported: `{ip_octets}`, `{two_ip_octets}`, and + `{one_ip_octet}`. - names: '#/components/schemas/CreateInstanceSerializerV2/properties/names' - "$.components.schemas.CreateInstanceSerializerV2.properties.names" + names: List of instance names. Specify one name to create a single instance. - password: '#/components/schemas/CreateInstanceSerializerV2/properties/password' - "$.components.schemas.CreateInstanceSerializerV2.properties.password" + password: For Linux instances, 'username' and 'password' are used to create a new user. + When only 'password' is provided, it is set as the password for the default user + of the image. For Windows instances, 'username' cannot be specified. Use the + 'password' field to set the password for the 'Admin' user on Windows. Use the + 'user_data' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via 'user_data'. - security_groups: '#/components/schemas/CreateInstanceSerializerV2/properties/security_groups' - "$.components.schemas.CreateInstanceSerializerV2.properties.security_groups" + security_groups: Applies only to instances and is ignored for bare metal. Specifies security + group UUIDs to be applied to all instance network interfaces. - servergroup_id: '#/components/schemas/CreateInstanceSerializerV2/properties/servergroup_id' - "$.components.schemas.CreateInstanceSerializerV2.properties.servergroup_id" + servergroup_id: Server group ID for instance placement policy. Can be an anti-affinity, + affinity, or soft-anti-affinity group. `anti-affinity` ensures instances are + placed on different hosts for high availability. `affinity` places instances on + the same host for low-latency communication. `soft-anti-affinity` tries to place + instances on different hosts but allows sharing if needed. - ssh_key_name: '#/components/schemas/CreateInstanceSerializerV2/properties/ssh_key_name/anyOf/0' - "$.components.schemas.CreateInstanceSerializerV2.properties.ssh_key_name.anyOf[0]" + ssh_key_name: Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint. - tags: '#/components/schemas/CreateInstanceSerializerV2/properties/tags' - "$.components.schemas.CreateInstanceSerializerV2.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - user_data: '#/components/schemas/CreateInstanceSerializerV2/properties/user_data' - "$.components.schemas.CreateInstanceSerializerV2.properties.user_data" + user_data: String in base64 format. For Linux instances, 'user_data' is ignored when + 'password' field is provided. For Windows instances, Admin user password is set + by 'password' field and cannot be updated via 'user_data'. Examples of the + user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html - username: '#/components/schemas/CreateInstanceSerializerV2/properties/username' - "$.components.schemas.CreateInstanceSerializerV2.properties.username" + username: For Linux instances, 'username' and 'password' are used to create a new user. + For Windows instances, 'username' cannot be specified. Use 'password' field to + set the password for the 'Admin' user on Windows. extra_headers: Send extra headers @@ -254,17 +265,13 @@ def update( Rename instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[1].schema" + region_id: Region ID - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[2].schema" + instance_id: Instance ID - name: '#/components/schemas/NameSerializer/properties/name' - "$.components.schemas.NameSerializer.properties.name" + name: Name. extra_headers: Send extra headers @@ -349,89 +356,73 @@ def list( List instances Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID - available_floating: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[2]" + available_floating: Only show instances which are able to handle floating address - changes_before: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[3]" + changes_before: Filters the instances by a date and time stamp when the instances last changed. - changes_since: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[4]" + changes_since: Filters the instances by a date and time stamp when the instances last changed + status. - exclude_flavor_prefix: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[5]" + exclude_flavor_prefix: Exclude instances with specified flavor prefix - exclude_secgroup: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[6]" + exclude_secgroup: Exclude instances with specified security group name - flavor_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[7]" + flavor_id: Filter out instances by flavor_id. Flavor id must match exactly. - flavor_prefix: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[8]" + flavor_prefix: Filter out instances by flavor_prefix. - include_ai: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[9]" + include_ai: Include GPU clusters' servers - include_baremetal: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[10]" + include_baremetal: Include bare metal servers. Please, use `GET /v1/bminstances/` instead - include_k8s: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[11]" + include_k8s: Include managed k8s worker nodes - ip: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[12]" + ip: An IPv4 address to filter results by. Note: partial matches are allowed. For + example, searching for 192.168.0.1 will return 192.168.0.1, 192.168.0.10, + 192.168.0.110, and so on. - limit: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[13]" + limit: Optional. Limit the number of returned items - name: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[14]" + name: Filter instances by name. You can provide a full or partial name, instances with + matching names will be returned. For example, entering 'test' will return all + instances that contain 'test' in their name. - offset: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[15]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - only_isolated: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[16]" + only_isolated: Include only isolated instances - only_with_fixed_external_ip: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[17]" + only_with_fixed_external_ip: Return bare metals only with external fixed IP addresses. - order_by: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[18]" + order_by: Order by field and direction. - profile_name: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[19]" + profile_name: Filter result by ddos protection profile name. Effective only with with_ddos set + to true. - protection_status: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/20' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[20]" + protection_status: Filter result by DDoS protection_status. if parameter is provided. Effective + only with with_ddos set to true. (Active, Queued or Error) - status: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/21' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[21]" + status: Filters instances by status. - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/22' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[22]" + tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode + "tag_key_value={"key": "value"}" --url + "https://example.com/cloud/v1/resource/1/1" - tag_value: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/23' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[23]" + tag_value: Optional. Filter by tag values. ?tag_value=value1&tag_value=value2 - type_ddos_profile: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/24' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[24]" + type_ddos_profile: Return bare metals either only with advanced or only basic DDoS protection. + Effective only with with_ddos set to true. (advanced or basic) - uuid: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/25' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[25]" + uuid: Filter the server list result by the UUID of the server. Allowed UUID part - with_ddos: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/26' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[26]" + with_ddos: Include DDoS profile information in the response when set to `true`. Otherwise, + the `ddos_profile` field in the response is `null` by default. - with_interfaces_name: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/27' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[27]" + with_interfaces_name: Include `interface_name` in the addresses extra_headers: Send extra headers @@ -509,26 +500,21 @@ def delete( Delete instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[1].schema" + region_id: Region ID - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[2].schema" + instance_id: Instance ID - delete_floatings: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/3' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[3]" + delete_floatings: True if it is required to delete floating IPs assigned to the instance. Can't be + used with `floatings`. - floatings: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/4' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[4]" + floatings: Comma separated list of floating ids that should be deleted. Can't be used with + `delete_floatings`. - reserved_fixed_ips: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/5' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[5]" + reserved_fixed_ips: Comma separated list of port IDs to be deleted with the instance - volumes: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/6' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[6]" + volumes: Comma separated list of volume IDs to be deleted with the instance extra_headers: Send extra headers @@ -585,20 +571,9 @@ def action( Suspend and resume are not available for baremetal instances. Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/0/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[0].schema" + action: Instance action name - region_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/1/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/2/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[2].schema" - - action: '#/components/schemas/StartActionInstanceSerializer/properties/action' - "$.components.schemas.StartActionInstanceSerializer.properties.action" - - activate_profile: '#/components/schemas/StartActionInstanceSerializer/properties/activate_profile/anyOf/0' - "$.components.schemas.StartActionInstanceSerializer.properties.activate_profile.anyOf[0]" + activate_profile: Used on start instance to activate Advanced DDoS profile extra_headers: Send extra headers @@ -630,17 +605,7 @@ def action( Suspend and resume are not available for baremetal instances. Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/0/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/1/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/2/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[2].schema" - - action: '#/components/schemas/BasicActionInstanceSerializer/properties/action' - "$.components.schemas.BasicActionInstanceSerializer.properties.action" + action: Instance action name extra_headers: Send extra headers @@ -707,17 +672,7 @@ def add_to_placement_group( Put instance into the server group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[2].schema" - - servergroup_id: '#/components/schemas/InstancePutServerGroupSchema/properties/servergroup_id' - "$.components.schemas.InstancePutServerGroupSchema.properties.servergroup_id" + servergroup_id: Anti-affinity or affinity or soft-anti-affinity server group ID. extra_headers: Send extra headers @@ -767,20 +722,9 @@ def assign_security_group( all ports, use the NULL value for the port_id field Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[2].schema" - - name: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/name' - "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.name" + name: Security group name, applies to all ports - ports_security_group_names: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/ports_security_group_names' - "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.ports_security_group_names" + ports_security_group_names: Port security groups mapping extra_headers: Send extra headers @@ -829,15 +773,6 @@ def disable_port_security( Disable port security for instance interface Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fdisable_port_security/post/parameters/0/schema' - "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fdisable_port_security/post/parameters/1/schema' - "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security'].post.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fdisable_port_security/post/parameters/2/schema' - "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -877,15 +812,6 @@ def enable_port_security( Enable port security for instance interface Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fenable_port_security/post/parameters/0/schema' - "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fenable_port_security/post/parameters/1/schema' - "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security'].post.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fenable_port_security/post/parameters/2/schema' - "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -931,14 +857,11 @@ def get( - `'ru'` Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].get.parameters[1].schema" + region_id: Region ID - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].get.parameters[2].schema" + instance_id: Instance ID extra_headers: Send extra headers @@ -980,17 +903,7 @@ def get_console( Get instance console URL Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[2].schema" - - console_type: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/3' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[3]" + console_type: Console type extra_headers: Send extra headers @@ -1037,15 +950,6 @@ def remove_from_placement_group( Remove instance from the server group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fremove_from_servergroup/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fremove_from_servergroup/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fremove_from_servergroup/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1086,17 +990,7 @@ def resize( Change flavor of the instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[2].schema" - - flavor_id: '#/components/schemas/FlavorIdSchema/properties/flavor_id' - "$.components.schemas.FlavorIdSchema.properties.flavor_id" + flavor_id: Flavor ID extra_headers: Send extra headers @@ -1143,20 +1037,9 @@ def unassign_security_group( groups to all ports, use the NULL value for the port_id field Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[2].schema" - - name: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/name' - "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.name" + name: Security group name, applies to all ports - ports_security_group_names: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/ports_security_group_names' - "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.ports_security_group_names" + ports_security_group_names: Port security groups mapping extra_headers: Send extra headers @@ -1265,53 +1148,64 @@ async def create( via 'user_data'. Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - flavor: '#/components/schemas/CreateInstanceSerializerV2/properties/flavor' - "$.components.schemas.CreateInstanceSerializerV2.properties.flavor" + flavor: The flavor of the instance. - interfaces: '#/components/schemas/CreateInstanceSerializerV2/properties/interfaces' - "$.components.schemas.CreateInstanceSerializerV2.properties.interfaces" + interfaces: A list of network interfaces for the instance. You can create one or more + interfaces—private, public, or both. - volumes: '#/components/schemas/CreateInstanceSerializerV2/properties/volumes' - "$.components.schemas.CreateInstanceSerializerV2.properties.volumes" + volumes: List of volumes for instances - allow_app_ports: '#/components/schemas/CreateInstanceSerializerV2/properties/allow_app_ports' - "$.components.schemas.CreateInstanceSerializerV2.properties.allow_app_ports" + allow_app_ports: Set to `true` if creating the instance from an `apptemplate`. This allows + application ports in the security group for instances created from a marketplace + application template. - configuration: '#/components/schemas/CreateInstanceSerializerV2/properties/configuration/anyOf/0' - "$.components.schemas.CreateInstanceSerializerV2.properties.configuration.anyOf[0]" + configuration: Parameters for the application template if creating the instance from an + `apptemplate`. - name_templates: '#/components/schemas/CreateInstanceSerializerV2/properties/name_templates' - "$.components.schemas.CreateInstanceSerializerV2.properties.name_templates" + name_templates: If you want instance names to be automatically generated using IP octets, you + can specify name templates instead of setting names manually.Provide a list of + templated names that should be replaced using the selected template. The + following template formats are supported: `{ip_octets}`, `{two_ip_octets}`, and + `{one_ip_octet}`. - names: '#/components/schemas/CreateInstanceSerializerV2/properties/names' - "$.components.schemas.CreateInstanceSerializerV2.properties.names" + names: List of instance names. Specify one name to create a single instance. - password: '#/components/schemas/CreateInstanceSerializerV2/properties/password' - "$.components.schemas.CreateInstanceSerializerV2.properties.password" + password: For Linux instances, 'username' and 'password' are used to create a new user. + When only 'password' is provided, it is set as the password for the default user + of the image. For Windows instances, 'username' cannot be specified. Use the + 'password' field to set the password for the 'Admin' user on Windows. Use the + 'user_data' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via 'user_data'. - security_groups: '#/components/schemas/CreateInstanceSerializerV2/properties/security_groups' - "$.components.schemas.CreateInstanceSerializerV2.properties.security_groups" + security_groups: Applies only to instances and is ignored for bare metal. Specifies security + group UUIDs to be applied to all instance network interfaces. - servergroup_id: '#/components/schemas/CreateInstanceSerializerV2/properties/servergroup_id' - "$.components.schemas.CreateInstanceSerializerV2.properties.servergroup_id" + servergroup_id: Server group ID for instance placement policy. Can be an anti-affinity, + affinity, or soft-anti-affinity group. `anti-affinity` ensures instances are + placed on different hosts for high availability. `affinity` places instances on + the same host for low-latency communication. `soft-anti-affinity` tries to place + instances on different hosts but allows sharing if needed. - ssh_key_name: '#/components/schemas/CreateInstanceSerializerV2/properties/ssh_key_name/anyOf/0' - "$.components.schemas.CreateInstanceSerializerV2.properties.ssh_key_name.anyOf[0]" + ssh_key_name: Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint. - tags: '#/components/schemas/CreateInstanceSerializerV2/properties/tags' - "$.components.schemas.CreateInstanceSerializerV2.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - user_data: '#/components/schemas/CreateInstanceSerializerV2/properties/user_data' - "$.components.schemas.CreateInstanceSerializerV2.properties.user_data" + user_data: String in base64 format. For Linux instances, 'user_data' is ignored when + 'password' field is provided. For Windows instances, Admin user password is set + by 'password' field and cannot be updated via 'user_data'. Examples of the + user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html - username: '#/components/schemas/CreateInstanceSerializerV2/properties/username' - "$.components.schemas.CreateInstanceSerializerV2.properties.username" + username: For Linux instances, 'username' and 'password' are used to create a new user. + For Windows instances, 'username' cannot be specified. Use 'password' field to + set the password for the 'Admin' user on Windows. extra_headers: Send extra headers @@ -1370,17 +1264,13 @@ async def update( Rename instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[1].schema" + region_id: Region ID - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[2].schema" + instance_id: Instance ID - name: '#/components/schemas/NameSerializer/properties/name' - "$.components.schemas.NameSerializer.properties.name" + name: Name. extra_headers: Send extra headers @@ -1465,89 +1355,73 @@ def list( List instances Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID - available_floating: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[2]" + available_floating: Only show instances which are able to handle floating address - changes_before: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[3]" + changes_before: Filters the instances by a date and time stamp when the instances last changed. - changes_since: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[4]" + changes_since: Filters the instances by a date and time stamp when the instances last changed + status. - exclude_flavor_prefix: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[5]" + exclude_flavor_prefix: Exclude instances with specified flavor prefix - exclude_secgroup: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[6]" + exclude_secgroup: Exclude instances with specified security group name - flavor_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[7]" + flavor_id: Filter out instances by flavor_id. Flavor id must match exactly. - flavor_prefix: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[8]" + flavor_prefix: Filter out instances by flavor_prefix. - include_ai: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[9]" + include_ai: Include GPU clusters' servers - include_baremetal: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[10]" + include_baremetal: Include bare metal servers. Please, use `GET /v1/bminstances/` instead - include_k8s: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[11]" + include_k8s: Include managed k8s worker nodes - ip: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[12]" + ip: An IPv4 address to filter results by. Note: partial matches are allowed. For + example, searching for 192.168.0.1 will return 192.168.0.1, 192.168.0.10, + 192.168.0.110, and so on. - limit: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[13]" + limit: Optional. Limit the number of returned items - name: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[14]" + name: Filter instances by name. You can provide a full or partial name, instances with + matching names will be returned. For example, entering 'test' will return all + instances that contain 'test' in their name. - offset: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[15]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - only_isolated: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[16]" + only_isolated: Include only isolated instances - only_with_fixed_external_ip: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[17]" + only_with_fixed_external_ip: Return bare metals only with external fixed IP addresses. - order_by: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[18]" + order_by: Order by field and direction. - profile_name: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[19]" + profile_name: Filter result by ddos protection profile name. Effective only with with_ddos set + to true. - protection_status: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/20' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[20]" + protection_status: Filter result by DDoS protection_status. if parameter is provided. Effective + only with with_ddos set to true. (Active, Queued or Error) - status: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/21' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[21]" + status: Filters instances by status. - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/22' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[22]" + tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode + "tag_key_value={"key": "value"}" --url + "https://example.com/cloud/v1/resource/1/1" - tag_value: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/23' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[23]" + tag_value: Optional. Filter by tag values. ?tag_value=value1&tag_value=value2 - type_ddos_profile: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/24' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[24]" + type_ddos_profile: Return bare metals either only with advanced or only basic DDoS protection. + Effective only with with_ddos set to true. (advanced or basic) - uuid: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/25' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[25]" + uuid: Filter the server list result by the UUID of the server. Allowed UUID part - with_ddos: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/26' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[26]" + with_ddos: Include DDoS profile information in the response when set to `true`. Otherwise, + the `ddos_profile` field in the response is `null` by default. - with_interfaces_name: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/27' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[27]" + with_interfaces_name: Include `interface_name` in the addresses extra_headers: Send extra headers @@ -1625,26 +1499,21 @@ async def delete( Delete instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[1].schema" + region_id: Region ID - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[2].schema" + instance_id: Instance ID - delete_floatings: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/3' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[3]" + delete_floatings: True if it is required to delete floating IPs assigned to the instance. Can't be + used with `floatings`. - floatings: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/4' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[4]" + floatings: Comma separated list of floating ids that should be deleted. Can't be used with + `delete_floatings`. - reserved_fixed_ips: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/5' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[5]" + reserved_fixed_ips: Comma separated list of port IDs to be deleted with the instance - volumes: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/6' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[6]" + volumes: Comma separated list of volume IDs to be deleted with the instance extra_headers: Send extra headers @@ -1701,20 +1570,9 @@ async def action( Suspend and resume are not available for baremetal instances. Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/0/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[0].schema" + action: Instance action name - region_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/1/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/2/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[2].schema" - - action: '#/components/schemas/StartActionInstanceSerializer/properties/action' - "$.components.schemas.StartActionInstanceSerializer.properties.action" - - activate_profile: '#/components/schemas/StartActionInstanceSerializer/properties/activate_profile/anyOf/0' - "$.components.schemas.StartActionInstanceSerializer.properties.activate_profile.anyOf[0]" + activate_profile: Used on start instance to activate Advanced DDoS profile extra_headers: Send extra headers @@ -1746,17 +1604,7 @@ async def action( Suspend and resume are not available for baremetal instances. Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/0/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/1/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/2/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[2].schema" - - action: '#/components/schemas/BasicActionInstanceSerializer/properties/action' - "$.components.schemas.BasicActionInstanceSerializer.properties.action" + action: Instance action name extra_headers: Send extra headers @@ -1823,17 +1671,7 @@ async def add_to_placement_group( Put instance into the server group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[2].schema" - - servergroup_id: '#/components/schemas/InstancePutServerGroupSchema/properties/servergroup_id' - "$.components.schemas.InstancePutServerGroupSchema.properties.servergroup_id" + servergroup_id: Anti-affinity or affinity or soft-anti-affinity server group ID. extra_headers: Send extra headers @@ -1883,20 +1721,9 @@ async def assign_security_group( all ports, use the NULL value for the port_id field Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[2].schema" - - name: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/name' - "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.name" + name: Security group name, applies to all ports - ports_security_group_names: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/ports_security_group_names' - "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.ports_security_group_names" + ports_security_group_names: Port security groups mapping extra_headers: Send extra headers @@ -1945,15 +1772,6 @@ async def disable_port_security( Disable port security for instance interface Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fdisable_port_security/post/parameters/0/schema' - "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fdisable_port_security/post/parameters/1/schema' - "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security'].post.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fdisable_port_security/post/parameters/2/schema' - "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1993,15 +1811,6 @@ async def enable_port_security( Enable port security for instance interface Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fenable_port_security/post/parameters/0/schema' - "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fenable_port_security/post/parameters/1/schema' - "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security'].post.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Fports%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fenable_port_security/post/parameters/2/schema' - "$.paths['/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -2047,14 +1856,11 @@ async def get( - `'ru'` Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].get.parameters[1].schema" + region_id: Region ID - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].get.parameters[2].schema" + instance_id: Instance ID extra_headers: Send extra headers @@ -2096,17 +1902,7 @@ async def get_console( Get instance console URL Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[2].schema" - - console_type: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/3' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[3]" + console_type: Console type extra_headers: Send extra headers @@ -2153,15 +1949,6 @@ async def remove_from_placement_group( Remove instance from the server group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fremove_from_servergroup/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fremove_from_servergroup/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fremove_from_servergroup/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -2202,17 +1989,7 @@ async def resize( Change flavor of the instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[2].schema" - - flavor_id: '#/components/schemas/FlavorIdSchema/properties/flavor_id' - "$.components.schemas.FlavorIdSchema.properties.flavor_id" + flavor_id: Flavor ID extra_headers: Send extra headers @@ -2259,20 +2036,9 @@ async def unassign_security_group( groups to all ports, use the NULL value for the port_id field Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[2].schema" - - name: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/name' - "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.name" + name: Security group name, applies to all ports - ports_security_group_names: '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/ports_security_group_names' - "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.ports_security_group_names" + ports_security_group_names: Port security groups mapping extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index f5dacbce..47d571c6 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -62,15 +62,6 @@ def list( List network interfaces attached to the instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Finterfaces/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Finterfaces/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces'].get.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Finterfaces/get/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -119,32 +110,17 @@ def attach( Attach interface to instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + ddos_profile: Advanced DDoS protection. - ddos_profile: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ddos_profile.allOf[0]" + interface_name: Interface name - interface_name: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/interface_name' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.interface_name" + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - ip_family: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ip_family' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ip_family" + port_group: Each group will be added to the separate trunk. - port_group: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/port_group' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.port_group" + security_groups: List of security group IDs - security_groups: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/security_groups' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.security_groups" - - type: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/type' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.type" + type: Must be 'external'. Union tag extra_headers: Send extra headers @@ -181,32 +157,17 @@ def attach( Attach interface to instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" - - subnet_id: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/subnet_id' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.subnet_id" + subnet_id: Port will get an IP address from this subnet - ddos_profile: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.ddos_profile.allOf[0]" + ddos_profile: Advanced DDoS protection. - interface_name: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/interface_name' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.interface_name" + interface_name: Interface name - port_group: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/port_group' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.port_group" + port_group: Each group will be added to the separate trunk. - security_groups: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/security_groups' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.security_groups" + security_groups: List of security group IDs - type: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/type' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.type" + type: Must be 'subnet' extra_headers: Send extra headers @@ -244,35 +205,19 @@ def attach( Attach interface to instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + network_id: Port will get an IP address in this network subnet - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + ddos_profile: Advanced DDoS protection. - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + interface_name: Interface name - network_id: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/network_id' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.network_id" + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - ddos_profile: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ddos_profile.allOf[0]" + port_group: Each group will be added to the separate trunk. - interface_name: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/interface_name' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.interface_name" + security_groups: List of security group IDs - ip_family: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ip_family' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ip_family" - - port_group: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/port_group' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.port_group" - - security_groups: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/security_groups' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.security_groups" - - type: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/type' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.type" + type: Must be 'any_subnet' extra_headers: Send extra headers @@ -309,32 +254,17 @@ def attach( Attach interface to instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + port_id: Port ID - port_id: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_id' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_id" + ddos_profile: Advanced DDoS protection. - ddos_profile: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.ddos_profile.allOf[0]" + interface_name: Interface name - interface_name: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/interface_name' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.interface_name" + port_group: Each group will be added to the separate trunk. - port_group: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_group' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_group" + security_groups: List of security group IDs - security_groups: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/security_groups' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.security_groups" - - type: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/type' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.type" + type: Must be 'reserved_fixed_ip'. Union tag extra_headers: Send extra headers @@ -417,20 +347,9 @@ def detach( Detach interface from instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[2].schema" - - ip_address: '#/components/schemas/PortIdWithIpSchema/properties/ip_address' - "$.components.schemas.PortIdWithIpSchema.properties.ip_address" + ip_address: IP address - port_id: '#/components/schemas/PortIdWithIpSchema/properties/port_id' - "$.components.schemas.PortIdWithIpSchema.properties.port_id" + port_id: ID of the port extra_headers: Send extra headers @@ -499,15 +418,6 @@ async def list( List network interfaces attached to the instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Finterfaces/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Finterfaces/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces'].get.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Finterfaces/get/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -556,32 +466,17 @@ async def attach( Attach interface to instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + ddos_profile: Advanced DDoS protection. - ddos_profile: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ddos_profile.allOf[0]" + interface_name: Interface name - interface_name: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/interface_name' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.interface_name" + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - ip_family: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ip_family' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ip_family" + port_group: Each group will be added to the separate trunk. - port_group: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/port_group' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.port_group" + security_groups: List of security group IDs - security_groups: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/security_groups' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.security_groups" - - type: '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/type' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.type" + type: Must be 'external'. Union tag extra_headers: Send extra headers @@ -618,32 +513,17 @@ async def attach( Attach interface to instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" - - subnet_id: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/subnet_id' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.subnet_id" + subnet_id: Port will get an IP address from this subnet - ddos_profile: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.ddos_profile.allOf[0]" + ddos_profile: Advanced DDoS protection. - interface_name: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/interface_name' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.interface_name" + interface_name: Interface name - port_group: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/port_group' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.port_group" + port_group: Each group will be added to the separate trunk. - security_groups: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/security_groups' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.security_groups" + security_groups: List of security group IDs - type: '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/type' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.type" + type: Must be 'subnet' extra_headers: Send extra headers @@ -681,35 +561,19 @@ async def attach( Attach interface to instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" + network_id: Port will get an IP address in this network subnet - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" + ddos_profile: Advanced DDoS protection. - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + interface_name: Interface name - network_id: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/network_id' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.network_id" + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - ddos_profile: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ddos_profile.allOf[0]" + port_group: Each group will be added to the separate trunk. - interface_name: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/interface_name' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.interface_name" + security_groups: List of security group IDs - ip_family: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ip_family' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ip_family" - - port_group: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/port_group' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.port_group" - - security_groups: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/security_groups' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.security_groups" - - type: '#/components/schemas/NewInterfaceAnySubnetSchema/properties/type' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.type" + type: Must be 'any_subnet' extra_headers: Send extra headers @@ -746,32 +610,17 @@ async def attach( Attach interface to instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[2].schema" + port_id: Port ID - port_id: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_id' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_id" + ddos_profile: Advanced DDoS protection. - ddos_profile: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.ddos_profile.allOf[0]" + interface_name: Interface name - interface_name: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/interface_name' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.interface_name" + port_group: Each group will be added to the separate trunk. - port_group: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_group' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_group" + security_groups: List of security group IDs - security_groups: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/security_groups' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.security_groups" - - type: '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/type' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.type" + type: Must be 'reserved_fixed_ip'. Union tag extra_headers: Send extra headers @@ -854,20 +703,9 @@ async def detach( Detach interface from instance Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[1].schema" - - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[2].schema" - - ip_address: '#/components/schemas/PortIdWithIpSchema/properties/ip_address' - "$.components.schemas.PortIdWithIpSchema.properties.ip_address" + ip_address: IP address - port_id: '#/components/schemas/PortIdWithIpSchema/properties/port_id' - "$.components.schemas.PortIdWithIpSchema.properties.port_id" + port_id: ID of the port extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index c0628106..90c7c579 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -62,20 +62,15 @@ def list( Get instance metrics, including cpu, memory, network and disk metrics Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[1].schema" + region_id: Region ID - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[2].schema" + instance_id: Instance ID - time_interval: '#/components/schemas/InstanceMetricsRequestSerializer/properties/time_interval' - "$.components.schemas.InstanceMetricsRequestSerializer.properties.time_interval" + time_interval: Time interval. - time_unit: '#/components/schemas/InstanceMetricsRequestSerializer/properties/time_unit' - "$.components.schemas.InstanceMetricsRequestSerializer.properties.time_unit" + time_unit: Time interval unit. extra_headers: Send extra headers @@ -146,20 +141,15 @@ async def list( Get instance metrics, including cpu, memory, network and disk metrics Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[1].schema" + region_id: Region ID - instance_id: '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/2/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[2].schema" + instance_id: Instance ID - time_interval: '#/components/schemas/InstanceMetricsRequestSerializer/properties/time_interval' - "$.components.schemas.InstanceMetricsRequestSerializer.properties.time_interval" + time_interval: Time interval. - time_unit: '#/components/schemas/InstanceMetricsRequestSerializer/properties/time_unit' - "$.components.schemas.InstanceMetricsRequestSerializer.properties.time_unit" + time_unit: Time interval unit. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index 12169d7e..35e17f49 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -61,14 +61,7 @@ def list( price values as 0. If you get Pricing Error contact the support Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[1].schema" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[2]" + include_prices: Set to true if the response should include flavor prices extra_headers: Send extra headers @@ -135,14 +128,7 @@ async def list( price values as 0. If you get Pricing Error contact the support Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[1].schema" - - include_prices: '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[2]" + include_prices: Set to true if the response should include flavor prices extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index 5f35d513..f3073e4f 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 @@ -83,38 +83,28 @@ def create( Create load balancer L7 policy Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].post.parameters[0].schema" + action: Action - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].post.parameters[1].schema" + listener_id: Listener ID - action: '#/components/schemas/CreateL7PolicySchema/properties/action' - "$.components.schemas.CreateL7PolicySchema.properties.action" + name: Human-readable name of the policy - listener_id: '#/components/schemas/CreateL7PolicySchema/properties/listener_id' - "$.components.schemas.CreateL7PolicySchema.properties.listener_id" + position: The position of this policy on the listener. Positions start at 1. - name: '#/components/schemas/CreateL7PolicySchema/properties/name' - "$.components.schemas.CreateL7PolicySchema.properties.name" + 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. - position: '#/components/schemas/CreateL7PolicySchema/properties/position' - "$.components.schemas.CreateL7PolicySchema.properties.position" + redirect_pool_id: Requests matching this policy will be redirected to the pool withthis ID. Only + valid if action is REDIRECT_TO_POOL. - redirect_http_code: '#/components/schemas/CreateL7PolicySchema/properties/redirect_http_code' - "$.components.schemas.CreateL7PolicySchema.properties.redirect_http_code" + redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid + if action is REDIRECT_PREFIX. - redirect_pool_id: '#/components/schemas/CreateL7PolicySchema/properties/redirect_pool_id' - "$.components.schemas.CreateL7PolicySchema.properties.redirect_pool_id" + redirect_url: Requests matching this policy will be redirected to this URL. Only valid if + action is REDIRECT_TO_URL. - redirect_prefix: '#/components/schemas/CreateL7PolicySchema/properties/redirect_prefix' - "$.components.schemas.CreateL7PolicySchema.properties.redirect_prefix" - - redirect_url: '#/components/schemas/CreateL7PolicySchema/properties/redirect_url' - "$.components.schemas.CreateL7PolicySchema.properties.redirect_url" - - tags: '#/components/schemas/CreateL7PolicySchema/properties/tags' - "$.components.schemas.CreateL7PolicySchema.properties.tags" + tags: A list of simple strings assigned to the resource. extra_headers: Send extra headers @@ -166,12 +156,6 @@ def list( List load balancer L7 policies Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].get.parameters[1].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -209,15 +193,6 @@ def delete( Delete load balancer L7 policy Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}']['delete'].parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -257,15 +232,6 @@ def get( Get load balancer L7 policy Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].get.parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -313,38 +279,26 @@ def replace( Replace load balancer L7 policy properties Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[2].schema" - - action: '#/components/schemas/UpdateL7PolicySchema/properties/action' - "$.components.schemas.UpdateL7PolicySchema.properties.action" + action: Action - name: '#/components/schemas/UpdateL7PolicySchema/properties/name' - "$.components.schemas.UpdateL7PolicySchema.properties.name" + name: Human-readable name of the policy - position: '#/components/schemas/UpdateL7PolicySchema/properties/position' - "$.components.schemas.UpdateL7PolicySchema.properties.position" + position: The position of this policy on the listener. Positions start at 1. - redirect_http_code: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_http_code' - "$.components.schemas.UpdateL7PolicySchema.properties.redirect_http_code" + 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. - redirect_pool_id: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_pool_id' - "$.components.schemas.UpdateL7PolicySchema.properties.redirect_pool_id" + redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID. Only + valid if action is REDIRECT_TO_POOL. - redirect_prefix: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_prefix' - "$.components.schemas.UpdateL7PolicySchema.properties.redirect_prefix" + redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid + if action is REDIRECT_PREFIX. - redirect_url: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_url' - "$.components.schemas.UpdateL7PolicySchema.properties.redirect_url" + redirect_url: Requests matching this policy will be redirected to this URL. Only valid if + action is REDIRECT_TO_URL. - tags: '#/components/schemas/UpdateL7PolicySchema/properties/tags' - "$.components.schemas.UpdateL7PolicySchema.properties.tags" + tags: A list of simple strings assigned to the resource. extra_headers: Send extra headers @@ -431,38 +385,28 @@ async def create( Create load balancer L7 policy Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].post.parameters[0].schema" + action: Action - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].post.parameters[1].schema" + listener_id: Listener ID - action: '#/components/schemas/CreateL7PolicySchema/properties/action' - "$.components.schemas.CreateL7PolicySchema.properties.action" + name: Human-readable name of the policy - listener_id: '#/components/schemas/CreateL7PolicySchema/properties/listener_id' - "$.components.schemas.CreateL7PolicySchema.properties.listener_id" + position: The position of this policy on the listener. Positions start at 1. - name: '#/components/schemas/CreateL7PolicySchema/properties/name' - "$.components.schemas.CreateL7PolicySchema.properties.name" + 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. - position: '#/components/schemas/CreateL7PolicySchema/properties/position' - "$.components.schemas.CreateL7PolicySchema.properties.position" + redirect_pool_id: Requests matching this policy will be redirected to the pool withthis ID. Only + valid if action is REDIRECT_TO_POOL. - redirect_http_code: '#/components/schemas/CreateL7PolicySchema/properties/redirect_http_code' - "$.components.schemas.CreateL7PolicySchema.properties.redirect_http_code" + redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid + if action is REDIRECT_PREFIX. - redirect_pool_id: '#/components/schemas/CreateL7PolicySchema/properties/redirect_pool_id' - "$.components.schemas.CreateL7PolicySchema.properties.redirect_pool_id" + redirect_url: Requests matching this policy will be redirected to this URL. Only valid if + action is REDIRECT_TO_URL. - redirect_prefix: '#/components/schemas/CreateL7PolicySchema/properties/redirect_prefix' - "$.components.schemas.CreateL7PolicySchema.properties.redirect_prefix" - - redirect_url: '#/components/schemas/CreateL7PolicySchema/properties/redirect_url' - "$.components.schemas.CreateL7PolicySchema.properties.redirect_url" - - tags: '#/components/schemas/CreateL7PolicySchema/properties/tags' - "$.components.schemas.CreateL7PolicySchema.properties.tags" + tags: A list of simple strings assigned to the resource. extra_headers: Send extra headers @@ -514,12 +458,6 @@ async def list( List load balancer L7 policies Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].get.parameters[1].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -557,15 +495,6 @@ async def delete( Delete load balancer L7 policy Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}']['delete'].parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -605,15 +534,6 @@ async def get( Get load balancer L7 policy Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].get.parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -661,38 +581,26 @@ async def replace( Replace load balancer L7 policy properties Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[2].schema" - - action: '#/components/schemas/UpdateL7PolicySchema/properties/action' - "$.components.schemas.UpdateL7PolicySchema.properties.action" + action: Action - name: '#/components/schemas/UpdateL7PolicySchema/properties/name' - "$.components.schemas.UpdateL7PolicySchema.properties.name" + name: Human-readable name of the policy - position: '#/components/schemas/UpdateL7PolicySchema/properties/position' - "$.components.schemas.UpdateL7PolicySchema.properties.position" + position: The position of this policy on the listener. Positions start at 1. - redirect_http_code: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_http_code' - "$.components.schemas.UpdateL7PolicySchema.properties.redirect_http_code" + 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. - redirect_pool_id: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_pool_id' - "$.components.schemas.UpdateL7PolicySchema.properties.redirect_pool_id" + redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID. Only + valid if action is REDIRECT_TO_POOL. - redirect_prefix: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_prefix' - "$.components.schemas.UpdateL7PolicySchema.properties.redirect_prefix" + redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid + if action is REDIRECT_PREFIX. - redirect_url: '#/components/schemas/UpdateL7PolicySchema/properties/redirect_url' - "$.components.schemas.UpdateL7PolicySchema.properties.redirect_url" + redirect_url: Requests matching this policy will be redirected to this URL. Only valid if + action is REDIRECT_TO_URL. - tags: '#/components/schemas/UpdateL7PolicySchema/properties/tags' - "$.components.schemas.UpdateL7PolicySchema.properties.tags" + tags: A list of simple strings assigned to the resource. extra_headers: Send extra headers 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 75d667f5..4c8d987d 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -78,32 +78,19 @@ def create( Create load balancer L7 rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[0].schema" + compare_type: The comparison type for the L7 rule - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[1].schema" + type: The L7 rule type - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[2].schema" + value: The value to use for the comparison. For example, the file type to compare - compare_type: '#/components/schemas/CreateL7RuleSchema/properties/compare_type' - "$.components.schemas.CreateL7RuleSchema.properties.compare_type" + invert: When true the logic of the rule is inverted. For example, with invert true, + 'equal to' would become 'not equal to'. Default is false. - type: '#/components/schemas/CreateL7RuleSchema/properties/type' - "$.components.schemas.CreateL7RuleSchema.properties.type" + key: The key to use for the comparison. For example, the name of the cookie to + evaluate. - value: '#/components/schemas/CreateL7RuleSchema/properties/value' - "$.components.schemas.CreateL7RuleSchema.properties.value" - - invert: '#/components/schemas/CreateL7RuleSchema/properties/invert' - "$.components.schemas.CreateL7RuleSchema.properties.invert" - - key: '#/components/schemas/CreateL7RuleSchema/properties/key' - "$.components.schemas.CreateL7RuleSchema.properties.key" - - tags: '#/components/schemas/CreateL7RuleSchema/properties/tags' - "$.components.schemas.CreateL7RuleSchema.properties.tags" + tags: A list of simple strings assigned to the l7 rule extra_headers: Send extra headers @@ -155,15 +142,6 @@ def list( List load balancer L7 policy rules Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/get/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/get/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].get.parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/get/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -204,18 +182,6 @@ def delete( Delete load balancer L7 rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[2].schema" - - l7rule_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -258,18 +224,6 @@ def get( Get load balancer L7 rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[2].schema" - - l7rule_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/3/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -328,35 +282,19 @@ def replace( Replace load balancer L7 rule properties Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[2].schema" - - l7rule_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/3/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[3].schema" - - compare_type: '#/components/schemas/UpdateL7RuleSchema/properties/compare_type' - "$.components.schemas.UpdateL7RuleSchema.properties.compare_type" + compare_type: The comparison type for the L7 rule - invert: '#/components/schemas/UpdateL7RuleSchema/properties/invert' - "$.components.schemas.UpdateL7RuleSchema.properties.invert" + invert: When true the logic of the rule is inverted. For example, with invert true, + 'equal to' would become 'not equal to'. Default is false. - key: '#/components/schemas/UpdateL7RuleSchema/properties/key' - "$.components.schemas.UpdateL7RuleSchema.properties.key" + key: The key to use for the comparison. For example, the name of the cookie to + evaluate. - tags: '#/components/schemas/UpdateL7RuleSchema/properties/tags' - "$.components.schemas.UpdateL7RuleSchema.properties.tags" + tags: A list of simple strings assigned to the l7 rule - type: '#/components/schemas/UpdateL7RuleSchema/properties/type' - "$.components.schemas.UpdateL7RuleSchema.properties.type" + type: The L7 rule type - value: '#/components/schemas/UpdateL7RuleSchema/properties/value' - "$.components.schemas.UpdateL7RuleSchema.properties.value" + value: The value to use for the comparison. For example, the file type to compare extra_headers: Send extra headers @@ -446,32 +384,19 @@ async def create( Create load balancer L7 rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[0].schema" + compare_type: The comparison type for the L7 rule - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[1].schema" + type: The L7 rule type - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[2].schema" + value: The value to use for the comparison. For example, the file type to compare - compare_type: '#/components/schemas/CreateL7RuleSchema/properties/compare_type' - "$.components.schemas.CreateL7RuleSchema.properties.compare_type" + invert: When true the logic of the rule is inverted. For example, with invert true, + 'equal to' would become 'not equal to'. Default is false. - type: '#/components/schemas/CreateL7RuleSchema/properties/type' - "$.components.schemas.CreateL7RuleSchema.properties.type" + key: The key to use for the comparison. For example, the name of the cookie to + evaluate. - value: '#/components/schemas/CreateL7RuleSchema/properties/value' - "$.components.schemas.CreateL7RuleSchema.properties.value" - - invert: '#/components/schemas/CreateL7RuleSchema/properties/invert' - "$.components.schemas.CreateL7RuleSchema.properties.invert" - - key: '#/components/schemas/CreateL7RuleSchema/properties/key' - "$.components.schemas.CreateL7RuleSchema.properties.key" - - tags: '#/components/schemas/CreateL7RuleSchema/properties/tags' - "$.components.schemas.CreateL7RuleSchema.properties.tags" + tags: A list of simple strings assigned to the l7 rule extra_headers: Send extra headers @@ -523,15 +448,6 @@ async def list( List load balancer L7 policy rules Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/get/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/get/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].get.parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/get/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -572,18 +488,6 @@ async def delete( Delete load balancer L7 rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[2].schema" - - l7rule_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}']['delete'].parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -626,18 +530,6 @@ async def get( Get load balancer L7 rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[2].schema" - - l7rule_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/get/parameters/3/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].get.parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -696,35 +588,19 @@ async def replace( Replace load balancer L7 rule properties Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[1].schema" - - l7policy_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[2].schema" - - l7rule_id: '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/3/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[3].schema" - - compare_type: '#/components/schemas/UpdateL7RuleSchema/properties/compare_type' - "$.components.schemas.UpdateL7RuleSchema.properties.compare_type" + compare_type: The comparison type for the L7 rule - invert: '#/components/schemas/UpdateL7RuleSchema/properties/invert' - "$.components.schemas.UpdateL7RuleSchema.properties.invert" + invert: When true the logic of the rule is inverted. For example, with invert true, + 'equal to' would become 'not equal to'. Default is false. - key: '#/components/schemas/UpdateL7RuleSchema/properties/key' - "$.components.schemas.UpdateL7RuleSchema.properties.key" + key: The key to use for the comparison. For example, the name of the cookie to + evaluate. - tags: '#/components/schemas/UpdateL7RuleSchema/properties/tags' - "$.components.schemas.UpdateL7RuleSchema.properties.tags" + tags: A list of simple strings assigned to the l7 rule - type: '#/components/schemas/UpdateL7RuleSchema/properties/type' - "$.components.schemas.UpdateL7RuleSchema.properties.type" + type: The L7 rule type - value: '#/components/schemas/UpdateL7RuleSchema/properties/value' - "$.components.schemas.UpdateL7RuleSchema.properties.value" + value: The value to use for the comparison. For example, the file type to compare extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 1e53c4e7..38496c3b 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -81,50 +81,34 @@ def create( Create load balancer listener Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].post.parameters[0].schema" + loadbalancer_id: Load balancer ID - region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].post.parameters[1].schema" + name: Load balancer listener name - loadbalancer_id: '#/components/schemas/CreateLbListenerSerializer/properties/loadbalancer_id' - "$.components.schemas.CreateLbListenerSerializer.properties.loadbalancer_id" + protocol: Load balancer listener protocol - name: '#/components/schemas/CreateLbListenerSerializer/properties/name' - "$.components.schemas.CreateLbListenerSerializer.properties.name" + protocol_port: Protocol port - protocol: '#/components/schemas/CreateLbListenerSerializer/properties/protocol' - "$.components.schemas.CreateLbListenerSerializer.properties.protocol" + allowed_cidrs: Network CIDRs from which service will be accessible - protocol_port: '#/components/schemas/CreateLbListenerSerializer/properties/protocol_port' - "$.components.schemas.CreateLbListenerSerializer.properties.protocol_port" + connection_limit: Limit of the simultaneous connections - allowed_cidrs: '#/components/schemas/CreateLbListenerSerializer/properties/allowed_cidrs/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.allowed_cidrs.anyOf[0]" + insert_x_forwarded: Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. + Only used with HTTP or TERMINATED_HTTPS protocols. - connection_limit: '#/components/schemas/CreateLbListenerSerializer/properties/connection_limit' - "$.components.schemas.CreateLbListenerSerializer.properties.connection_limit" + secret_id: ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS + listener - insert_x_forwarded: '#/components/schemas/CreateLbListenerSerializer/properties/insert_x_forwarded' - "$.components.schemas.CreateLbListenerSerializer.properties.insert_x_forwarded" + sni_secret_id: List of secrets IDs containing PKCS12 format certificate/key bundles for + TERMINATED_HTTPS or PROMETHEUS listeners - secret_id: '#/components/schemas/CreateLbListenerSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.secret_id.anyOf[0]" + timeout_client_data: Frontend client inactivity timeout in milliseconds - sni_secret_id: '#/components/schemas/CreateLbListenerSerializer/properties/sni_secret_id' - "$.components.schemas.CreateLbListenerSerializer.properties.sni_secret_id" + timeout_member_connect: Backend member connection timeout in milliseconds - timeout_client_data: '#/components/schemas/CreateLbListenerSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.timeout_client_data.anyOf[0]" + timeout_member_data: Backend member inactivity timeout in milliseconds - timeout_member_connect: '#/components/schemas/CreateLbListenerSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.timeout_member_connect.anyOf[0]" - - timeout_member_data: '#/components/schemas/CreateLbListenerSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.timeout_member_data.anyOf[0]" - - user_list: '#/components/schemas/CreateLbListenerSerializer/properties/user_list' - "$.components.schemas.CreateLbListenerSerializer.properties.user_list" + user_list: Load balancer listener list of username and encrypted password items extra_headers: Send extra headers @@ -190,41 +174,25 @@ def update( Update listener Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[1].schema" - - listener_id: '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[2].schema" + allowed_cidrs: Network CIDRs from which service will be accessible - allowed_cidrs: '#/components/schemas/PatchLbListenerSerializer/properties/allowed_cidrs/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.allowed_cidrs.anyOf[0]" + connection_limit: Limit of simultaneous connections - connection_limit: '#/components/schemas/PatchLbListenerSerializer/properties/connection_limit' - "$.components.schemas.PatchLbListenerSerializer.properties.connection_limit" + name: Load balancer listener name - name: '#/components/schemas/PatchLbListenerSerializer/properties/name' - "$.components.schemas.PatchLbListenerSerializer.properties.name" + secret_id: ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS + load balancer - secret_id: '#/components/schemas/PatchLbListenerSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.secret_id.anyOf[0]" + sni_secret_id: List of secret's ID containing PKCS12 format certificate/key bundfles for + TERMINATED_HTTPS or PROMETHEUS listeners - sni_secret_id: '#/components/schemas/PatchLbListenerSerializer/properties/sni_secret_id/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.sni_secret_id.anyOf[0]" + timeout_client_data: Frontend client inactivity timeout in milliseconds - timeout_client_data: '#/components/schemas/PatchLbListenerSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.timeout_client_data.anyOf[0]" + timeout_member_connect: Backend member connection timeout in milliseconds - timeout_member_connect: '#/components/schemas/PatchLbListenerSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.timeout_member_connect.anyOf[0]" + timeout_member_data: Backend member inactivity timeout in milliseconds - timeout_member_data: '#/components/schemas/PatchLbListenerSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.timeout_member_data.anyOf[0]" - - user_list: '#/components/schemas/PatchLbListenerSerializer/properties/user_list/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.user_list.anyOf[0]" + user_list: Load balancer listener users list extra_headers: Send extra headers @@ -280,17 +248,9 @@ def list( List load balancer listeners Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[2]" + loadbalancer_id: Load balancer ID - show_stats: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[3]" + show_stats: Show statistics extra_headers: Send extra headers @@ -339,15 +299,6 @@ def delete( Delete load balancer listener Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}']['delete'].parameters[1].schema" - - listener_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -388,17 +339,7 @@ def get( Get listener Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[1].schema" - - listener_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[2].schema" - - show_stats: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/3' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[3]" + show_stats: Show statistics extra_headers: Send extra headers @@ -476,50 +417,34 @@ async def create( Create load balancer listener Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].post.parameters[0].schema" + loadbalancer_id: Load balancer ID - region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].post.parameters[1].schema" + name: Load balancer listener name - loadbalancer_id: '#/components/schemas/CreateLbListenerSerializer/properties/loadbalancer_id' - "$.components.schemas.CreateLbListenerSerializer.properties.loadbalancer_id" + protocol: Load balancer listener protocol - name: '#/components/schemas/CreateLbListenerSerializer/properties/name' - "$.components.schemas.CreateLbListenerSerializer.properties.name" + protocol_port: Protocol port - protocol: '#/components/schemas/CreateLbListenerSerializer/properties/protocol' - "$.components.schemas.CreateLbListenerSerializer.properties.protocol" + allowed_cidrs: Network CIDRs from which service will be accessible - protocol_port: '#/components/schemas/CreateLbListenerSerializer/properties/protocol_port' - "$.components.schemas.CreateLbListenerSerializer.properties.protocol_port" + connection_limit: Limit of the simultaneous connections - allowed_cidrs: '#/components/schemas/CreateLbListenerSerializer/properties/allowed_cidrs/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.allowed_cidrs.anyOf[0]" + insert_x_forwarded: Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. + Only used with HTTP or TERMINATED_HTTPS protocols. - connection_limit: '#/components/schemas/CreateLbListenerSerializer/properties/connection_limit' - "$.components.schemas.CreateLbListenerSerializer.properties.connection_limit" + secret_id: ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS + listener - insert_x_forwarded: '#/components/schemas/CreateLbListenerSerializer/properties/insert_x_forwarded' - "$.components.schemas.CreateLbListenerSerializer.properties.insert_x_forwarded" + sni_secret_id: List of secrets IDs containing PKCS12 format certificate/key bundles for + TERMINATED_HTTPS or PROMETHEUS listeners - secret_id: '#/components/schemas/CreateLbListenerSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.secret_id.anyOf[0]" + timeout_client_data: Frontend client inactivity timeout in milliseconds - sni_secret_id: '#/components/schemas/CreateLbListenerSerializer/properties/sni_secret_id' - "$.components.schemas.CreateLbListenerSerializer.properties.sni_secret_id" + timeout_member_connect: Backend member connection timeout in milliseconds - timeout_client_data: '#/components/schemas/CreateLbListenerSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.timeout_client_data.anyOf[0]" + timeout_member_data: Backend member inactivity timeout in milliseconds - timeout_member_connect: '#/components/schemas/CreateLbListenerSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.timeout_member_connect.anyOf[0]" - - timeout_member_data: '#/components/schemas/CreateLbListenerSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.timeout_member_data.anyOf[0]" - - user_list: '#/components/schemas/CreateLbListenerSerializer/properties/user_list' - "$.components.schemas.CreateLbListenerSerializer.properties.user_list" + user_list: Load balancer listener list of username and encrypted password items extra_headers: Send extra headers @@ -585,41 +510,25 @@ async def update( Update listener Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[1].schema" - - listener_id: '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[2].schema" + allowed_cidrs: Network CIDRs from which service will be accessible - allowed_cidrs: '#/components/schemas/PatchLbListenerSerializer/properties/allowed_cidrs/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.allowed_cidrs.anyOf[0]" + connection_limit: Limit of simultaneous connections - connection_limit: '#/components/schemas/PatchLbListenerSerializer/properties/connection_limit' - "$.components.schemas.PatchLbListenerSerializer.properties.connection_limit" + name: Load balancer listener name - name: '#/components/schemas/PatchLbListenerSerializer/properties/name' - "$.components.schemas.PatchLbListenerSerializer.properties.name" + secret_id: ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS + load balancer - secret_id: '#/components/schemas/PatchLbListenerSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.secret_id.anyOf[0]" + sni_secret_id: List of secret's ID containing PKCS12 format certificate/key bundfles for + TERMINATED_HTTPS or PROMETHEUS listeners - sni_secret_id: '#/components/schemas/PatchLbListenerSerializer/properties/sni_secret_id/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.sni_secret_id.anyOf[0]" + timeout_client_data: Frontend client inactivity timeout in milliseconds - timeout_client_data: '#/components/schemas/PatchLbListenerSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.timeout_client_data.anyOf[0]" + timeout_member_connect: Backend member connection timeout in milliseconds - timeout_member_connect: '#/components/schemas/PatchLbListenerSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.timeout_member_connect.anyOf[0]" + timeout_member_data: Backend member inactivity timeout in milliseconds - timeout_member_data: '#/components/schemas/PatchLbListenerSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.timeout_member_data.anyOf[0]" - - user_list: '#/components/schemas/PatchLbListenerSerializer/properties/user_list/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.user_list.anyOf[0]" + user_list: Load balancer listener users list extra_headers: Send extra headers @@ -675,17 +584,9 @@ async def list( List load balancer listeners Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[2]" + loadbalancer_id: Load balancer ID - show_stats: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[3]" + show_stats: Show statistics extra_headers: Send extra headers @@ -734,15 +635,6 @@ async def delete( Delete load balancer listener Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}']['delete'].parameters[1].schema" - - listener_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -783,17 +675,7 @@ async def get( Get listener Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[1].schema" - - listener_id: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[2].schema" - - show_stats: '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/3' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[3]" + show_stats: Show statistics extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 1603cc01..e6640e0b 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -157,47 +157,40 @@ def create( Create load balancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].post.parameters[0].schema" + flavor: Load balancer flavor name - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].post.parameters[1].schema" + floating_ip: Floating IP configuration for assignment - flavor: '#/components/schemas/CreateLoadbalancerSerializer/properties/flavor' - "$.components.schemas.CreateLoadbalancerSerializer.properties.flavor" + listeners: Load balancer listeners. Maximum 50 per LB (excluding Prometheus endpoint + listener). - floating_ip: '#/components/schemas/CreateLoadbalancerSerializer/properties/floating_ip' - "$.components.schemas.CreateLoadbalancerSerializer.properties.floating_ip" + logging: Logging configuration - listeners: '#/components/schemas/CreateLoadbalancerSerializer/properties/listeners' - "$.components.schemas.CreateLoadbalancerSerializer.properties.listeners" + name: Load balancer name - logging: '#/components/schemas/CreateLoadbalancerSerializer/properties/logging' - "$.components.schemas.CreateLoadbalancerSerializer.properties.logging" + name_template: Load balancer name which will be changed by template. - name: '#/components/schemas/CreateLoadbalancerSerializer/properties/name' - "$.components.schemas.CreateLoadbalancerSerializer.properties.name" + preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools + members. L2 provides best performance, L3 provides less IPs usage. It is taking + effect only if instance_id + ip_address is provided, not subnet_id + ip_address, + because we're considering this as intentional subnet_id specification. - name_template: '#/components/schemas/CreateLoadbalancerSerializer/properties/name_template' - "$.components.schemas.CreateLoadbalancerSerializer.properties.name_template" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - preferred_connectivity: '#/components/schemas/CreateLoadbalancerSerializer/properties/preferred_connectivity' - "$.components.schemas.CreateLoadbalancerSerializer.properties.preferred_connectivity" + vip_ip_family: IP family for load balancer subnet auto-selection if vip_network_id is specified - tags: '#/components/schemas/CreateLoadbalancerSerializer/properties/tags' - "$.components.schemas.CreateLoadbalancerSerializer.properties.tags" + vip_network_id: Network ID for load balancer. If not specified, default external network will be + used. Mutually exclusive with vip_port_id - vip_ip_family: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_ip_family' - "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_ip_family" + vip_port_id: Existing Reserved Fixed IP port ID for load balancer. Mutually exclusive with + vip_network_id - vip_network_id: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_network_id' - "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_network_id" - - vip_port_id: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_port_id' - "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_port_id" - - vip_subnet_id: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_subnet_id' - "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_subnet_id" + vip_subnet_id: Subnet ID for load balancer. If not specified, any subnet from vip_network_id + will be selected. Ignored when vip_network_id is not specified. extra_headers: Send extra headers @@ -257,23 +250,12 @@ def update( for load balancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[2].schema" - - logging: '#/components/schemas/LoadBalancerPatchSerializer/properties/logging' - "$.components.schemas.LoadBalancerPatchSerializer.properties.logging" + logging: Logging configuration - name: '#/components/schemas/LoadBalancerPatchSerializer/properties/name' - "$.components.schemas.LoadBalancerPatchSerializer.properties.name" + name: Name. - preferred_connectivity: '#/components/schemas/LoadBalancerPatchSerializer/properties/preferred_connectivity' - "$.components.schemas.LoadBalancerPatchSerializer.properties.preferred_connectivity" + preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools + members extra_headers: Send extra headers @@ -331,41 +313,30 @@ def list( List load balancers Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[0].schema" + assigned_floating: With or without assigned floating IP - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[1].schema" + limit: Limit the number of returned limit request entities. - assigned_floating: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[2]" + logging_enabled: With or without logging - limit: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[3]" + name: Filter by name - logging_enabled: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[4]" + offset: Offset value is used to exclude the first set of records from the result. - name: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[5]" + order_by: Ordering Load Balancer list result by name, created_at, updated_at, + operating_status, provisioning_status, vip_address, vip_ip_family and flavor + fields of the load balancer and directions (name.asc), default is + "created_at.asc" - offset: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[6]" + show_stats: Show statistics - order_by: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[7]" + tag_key: Filter by tag keys. - show_stats: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[8]" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G + --data-urlencode "tag_key_value={"key": "value"}" --url + "http://localhost:1111/v1/loadbalancers/1/1" - tag_key: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[9]" - - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[10]" - - with_ddos: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[11]" + with_ddos: Show Advanced DDoS protection profile, if exists extra_headers: Send extra headers @@ -423,15 +394,6 @@ def delete( Delete load balancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}']['delete'].parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -472,17 +434,7 @@ def failover( Failover loadbalancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[2].schema" - - force: '#/components/schemas/FailoverLoadBalancer/properties/force' - "$.components.schemas.FailoverLoadBalancer.properties.force" + force: Validate current load balancer status before failover or not. extra_headers: Send extra headers @@ -526,20 +478,9 @@ def get( Get load balancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[2].schema" + show_stats: Show statistics - show_stats: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/3' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[3]" - - with_ddos: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/4' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[4]" + with_ddos: Show DDoS profile extra_headers: Send extra headers @@ -591,17 +532,7 @@ def resize( Resize loadbalancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[2].schema" - - flavor: '#/components/schemas/ResizeLoadBalancer/properties/flavor' - "$.components.schemas.ResizeLoadBalancer.properties.flavor" + flavor: Name of the desired flavor to resize to. extra_headers: Send extra headers @@ -699,47 +630,40 @@ async def create( Create load balancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].post.parameters[0].schema" + flavor: Load balancer flavor name - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].post.parameters[1].schema" + floating_ip: Floating IP configuration for assignment - flavor: '#/components/schemas/CreateLoadbalancerSerializer/properties/flavor' - "$.components.schemas.CreateLoadbalancerSerializer.properties.flavor" + listeners: Load balancer listeners. Maximum 50 per LB (excluding Prometheus endpoint + listener). - floating_ip: '#/components/schemas/CreateLoadbalancerSerializer/properties/floating_ip' - "$.components.schemas.CreateLoadbalancerSerializer.properties.floating_ip" + logging: Logging configuration - listeners: '#/components/schemas/CreateLoadbalancerSerializer/properties/listeners' - "$.components.schemas.CreateLoadbalancerSerializer.properties.listeners" + name: Load balancer name - logging: '#/components/schemas/CreateLoadbalancerSerializer/properties/logging' - "$.components.schemas.CreateLoadbalancerSerializer.properties.logging" + name_template: Load balancer name which will be changed by template. - name: '#/components/schemas/CreateLoadbalancerSerializer/properties/name' - "$.components.schemas.CreateLoadbalancerSerializer.properties.name" + preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools + members. L2 provides best performance, L3 provides less IPs usage. It is taking + effect only if instance_id + ip_address is provided, not subnet_id + ip_address, + because we're considering this as intentional subnet_id specification. - name_template: '#/components/schemas/CreateLoadbalancerSerializer/properties/name_template' - "$.components.schemas.CreateLoadbalancerSerializer.properties.name_template" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - preferred_connectivity: '#/components/schemas/CreateLoadbalancerSerializer/properties/preferred_connectivity' - "$.components.schemas.CreateLoadbalancerSerializer.properties.preferred_connectivity" + vip_ip_family: IP family for load balancer subnet auto-selection if vip_network_id is specified - tags: '#/components/schemas/CreateLoadbalancerSerializer/properties/tags' - "$.components.schemas.CreateLoadbalancerSerializer.properties.tags" + vip_network_id: Network ID for load balancer. If not specified, default external network will be + used. Mutually exclusive with vip_port_id - vip_ip_family: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_ip_family' - "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_ip_family" + vip_port_id: Existing Reserved Fixed IP port ID for load balancer. Mutually exclusive with + vip_network_id - vip_network_id: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_network_id' - "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_network_id" - - vip_port_id: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_port_id' - "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_port_id" - - vip_subnet_id: '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_subnet_id' - "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_subnet_id" + vip_subnet_id: Subnet ID for load balancer. If not specified, any subnet from vip_network_id + will be selected. Ignored when vip_network_id is not specified. extra_headers: Send extra headers @@ -799,23 +723,12 @@ async def update( for load balancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[2].schema" - - logging: '#/components/schemas/LoadBalancerPatchSerializer/properties/logging' - "$.components.schemas.LoadBalancerPatchSerializer.properties.logging" + logging: Logging configuration - name: '#/components/schemas/LoadBalancerPatchSerializer/properties/name' - "$.components.schemas.LoadBalancerPatchSerializer.properties.name" + name: Name. - preferred_connectivity: '#/components/schemas/LoadBalancerPatchSerializer/properties/preferred_connectivity' - "$.components.schemas.LoadBalancerPatchSerializer.properties.preferred_connectivity" + preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools + members extra_headers: Send extra headers @@ -873,41 +786,30 @@ def list( List load balancers Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[0].schema" + assigned_floating: With or without assigned floating IP - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[1].schema" + limit: Limit the number of returned limit request entities. - assigned_floating: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[2]" + logging_enabled: With or without logging - limit: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[3]" + name: Filter by name - logging_enabled: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[4]" + offset: Offset value is used to exclude the first set of records from the result. - name: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[5]" + order_by: Ordering Load Balancer list result by name, created_at, updated_at, + operating_status, provisioning_status, vip_address, vip_ip_family and flavor + fields of the load balancer and directions (name.asc), default is + "created_at.asc" - offset: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[6]" + show_stats: Show statistics - order_by: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[7]" + tag_key: Filter by tag keys. - show_stats: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[8]" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G + --data-urlencode "tag_key_value={"key": "value"}" --url + "http://localhost:1111/v1/loadbalancers/1/1" - tag_key: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[9]" - - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[10]" - - with_ddos: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[11]" + with_ddos: Show Advanced DDoS protection profile, if exists extra_headers: Send extra headers @@ -965,15 +867,6 @@ async def delete( Delete load balancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}']['delete'].parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1014,17 +907,7 @@ async def failover( Failover loadbalancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[2].schema" - - force: '#/components/schemas/FailoverLoadBalancer/properties/force' - "$.components.schemas.FailoverLoadBalancer.properties.force" + force: Validate current load balancer status before failover or not. extra_headers: Send extra headers @@ -1070,20 +953,9 @@ async def get( Get load balancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[2].schema" + show_stats: Show statistics - show_stats: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/3' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[3]" - - with_ddos: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/4' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[4]" + with_ddos: Show DDoS profile extra_headers: Send extra headers @@ -1135,17 +1007,7 @@ async def resize( Resize loadbalancer Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[2].schema" - - flavor: '#/components/schemas/ResizeLoadBalancer/properties/flavor' - "$.components.schemas.ResizeLoadBalancer.properties.flavor" + flavor: Name of the desired flavor to resize to. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index affb2a65..aa89d045 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -62,20 +62,9 @@ def list( Get loadbalancer metrics, including cpu, memory and network Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[0].schema" + time_interval: Time interval - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[2].schema" - - time_interval: '#/components/schemas/LoadbalancerMetricsRequestSerializer/properties/time_interval' - "$.components.schemas.LoadbalancerMetricsRequestSerializer.properties.time_interval" - - time_unit: '#/components/schemas/LoadbalancerMetricsRequestSerializer/properties/time_unit' - "$.components.schemas.LoadbalancerMetricsRequestSerializer.properties.time_unit" + time_unit: Time interval unit extra_headers: Send extra headers @@ -146,20 +135,9 @@ async def list( Get loadbalancer metrics, including cpu, memory and network Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[2].schema" - - time_interval: '#/components/schemas/LoadbalancerMetricsRequestSerializer/properties/time_interval' - "$.components.schemas.LoadbalancerMetricsRequestSerializer.properties.time_interval" + time_interval: Time interval - time_unit: '#/components/schemas/LoadbalancerMetricsRequestSerializer/properties/time_unit' - "$.components.schemas.LoadbalancerMetricsRequestSerializer.properties.time_unit" + time_unit: Time interval unit extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index d30854cd..6f64504d 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -71,38 +71,23 @@ def create( Create Load Balancer Pool Health Monitor Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[0].schema" + delay: The time, in seconds, between sending probes to members - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[1].schema" + max_retries: Number of successes before the member is switched to ONLINE state - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[2].schema" + api_timeout: The maximum time to connect. Must be less than the delay value - delay: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/delay' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.delay" + type: Health monitor type. Once health monitor is created, cannot be changed. - max_retries: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries" + expected_codes: Can only be used together with `HTTP` or `HTTPS` health monitor type. - api_timeout: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/timeout' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.timeout" + http_method: HTTP method. Can only be used together with `HTTP` or `HTTPS` health monitor + type. - type: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/type' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.type" + max_retries_down: Number of failures before the member is switched to ERROR state. - expected_codes: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/expected_codes/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" - - http_method: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/http_method/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.http_method.anyOf[0]" - - max_retries_down: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries_down/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries_down.anyOf[0]" - - url_path: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/url_path/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.url_path.anyOf[0]" + url_path: URL Path. Defaults to '/'. Can only be used together with `HTTP` or `HTTPS` + health monitor type. extra_headers: Send extra headers @@ -156,15 +141,6 @@ def delete( Delete load balancer pool health monitor Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/delete/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/delete/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor']['delete'].parameters[1].schema" - - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/delete/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -234,38 +210,23 @@ async def create( Create Load Balancer Pool Health Monitor Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[0].schema" + delay: The time, in seconds, between sending probes to members - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[1].schema" + max_retries: Number of successes before the member is switched to ONLINE state - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[2].schema" + api_timeout: The maximum time to connect. Must be less than the delay value - delay: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/delay' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.delay" + type: Health monitor type. Once health monitor is created, cannot be changed. - max_retries: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries" + expected_codes: Can only be used together with `HTTP` or `HTTPS` health monitor type. - api_timeout: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/timeout' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.timeout" + http_method: HTTP method. Can only be used together with `HTTP` or `HTTPS` health monitor + type. - type: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/type' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.type" + max_retries_down: Number of failures before the member is switched to ERROR state. - expected_codes: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/expected_codes/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" - - http_method: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/http_method/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.http_method.anyOf[0]" - - max_retries_down: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries_down/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries_down.anyOf[0]" - - url_path: '#/components/schemas/CreateLbHealthMonitorSerializer/properties/url_path/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.url_path.anyOf[0]" + url_path: URL Path. Defaults to '/'. Can only be used together with `HTTP` or `HTTPS` + health monitor type. extra_headers: Send extra headers @@ -319,15 +280,6 @@ async def delete( Delete load balancer pool health monitor Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/delete/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/delete/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor']['delete'].parameters[1].schema" - - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/delete/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 368af297..128679a8 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -68,38 +68,23 @@ def add( Create load balancer pool member Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[0].schema" + address: Member IP address - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[1].schema" + protocol_port: Member IP port - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[2].schema" + admin_state_up: true if enabled. Defaults to true - address: '#/components/schemas/CreateLbPoolMemberSerializer/properties/address' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.address" + instance_id: Either subnet_id or instance_id should be provided - protocol_port: '#/components/schemas/CreateLbPoolMemberSerializer/properties/protocol_port' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.protocol_port" + monitor_address: An alternate IP address used for health monitoring of a backend member. Default + is null which monitors the member address. - admin_state_up: '#/components/schemas/CreateLbPoolMemberSerializer/properties/admin_state_up/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.admin_state_up.anyOf[0]" + monitor_port: An alternate protocol port used for health monitoring of a backend member. + Default is null which monitors the member protocol_port. - instance_id: '#/components/schemas/CreateLbPoolMemberSerializer/properties/instance_id/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.instance_id.anyOf[0]" + subnet_id: Either subnet_id or instance_id should be provided - monitor_address: '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_address/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" - - monitor_port: '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_port/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" - - subnet_id: '#/components/schemas/CreateLbPoolMemberSerializer/properties/subnet_id/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" - - weight: '#/components/schemas/CreateLbPoolMemberSerializer/properties/weight/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.weight.anyOf[0]" + weight: Member weight. Valid values: 0 to 256, defaults to 1 extra_headers: Send extra headers @@ -154,18 +139,6 @@ def remove( Delete load balancer pool member Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[1].schema" - - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[2].schema" - - member_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -236,38 +209,23 @@ async def add( Create load balancer pool member Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[0].schema" + address: Member IP address - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[1].schema" + protocol_port: Member IP port - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[2].schema" + admin_state_up: true if enabled. Defaults to true - address: '#/components/schemas/CreateLbPoolMemberSerializer/properties/address' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.address" + instance_id: Either subnet_id or instance_id should be provided - protocol_port: '#/components/schemas/CreateLbPoolMemberSerializer/properties/protocol_port' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.protocol_port" + monitor_address: An alternate IP address used for health monitoring of a backend member. Default + is null which monitors the member address. - admin_state_up: '#/components/schemas/CreateLbPoolMemberSerializer/properties/admin_state_up/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.admin_state_up.anyOf[0]" + monitor_port: An alternate protocol port used for health monitoring of a backend member. + Default is null which monitors the member protocol_port. - instance_id: '#/components/schemas/CreateLbPoolMemberSerializer/properties/instance_id/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.instance_id.anyOf[0]" + subnet_id: Either subnet_id or instance_id should be provided - monitor_address: '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_address/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" - - monitor_port: '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_port/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" - - subnet_id: '#/components/schemas/CreateLbPoolMemberSerializer/properties/subnet_id/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" - - weight: '#/components/schemas/CreateLbPoolMemberSerializer/properties/weight/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.weight.anyOf[0]" + weight: Member weight. Valid values: 0 to 256, defaults to 1 extra_headers: Send extra headers @@ -322,18 +280,6 @@ async def remove( Delete load balancer pool member Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[1].schema" - - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[2].schema" - - member_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember%2F%7Bmember_id%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}']['delete'].parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 86b49ff1..0da7f303 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -102,53 +102,33 @@ def create( Create load balancer pool Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].post.parameters[0].schema" + lb_algorithm: Load balancer algorithm - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].post.parameters[1].schema" + name: Pool name - lb_algorithm: '#/components/schemas/CreateLbPoolSerializer/properties/lb_algorithm' - "$.components.schemas.CreateLbPoolSerializer.properties.lb_algorithm" + protocol: Protocol - name: '#/components/schemas/CreateLbPoolSerializer/properties/name' - "$.components.schemas.CreateLbPoolSerializer.properties.name" + ca_secret_id: Secret ID of CA certificate bundle - protocol: '#/components/schemas/CreateLbPoolSerializer/properties/protocol' - "$.components.schemas.CreateLbPoolSerializer.properties.protocol" + crl_secret_id: Secret ID of CA revocation list file - ca_secret_id: '#/components/schemas/CreateLbPoolSerializer/properties/ca_secret_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.ca_secret_id.anyOf[0]" + healthmonitor: Health monitor details - crl_secret_id: '#/components/schemas/CreateLbPoolSerializer/properties/crl_secret_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.crl_secret_id.anyOf[0]" + listener_id: Listener ID - healthmonitor: '#/components/schemas/CreateLbPoolSerializer/properties/healthmonitor/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.healthmonitor.anyOf[0]" + loadbalancer_id: Loadbalancer ID - listener_id: '#/components/schemas/CreateLbPoolSerializer/properties/listener_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.listener_id.anyOf[0]" + members: Pool members - loadbalancer_id: '#/components/schemas/CreateLbPoolSerializer/properties/loadbalancer_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.loadbalancer_id.anyOf[0]" + secret_id: Secret ID for TLS client authentication to the member servers - members: '#/components/schemas/CreateLbPoolSerializer/properties/members/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.members.anyOf[0]" + session_persistence: Session persistence details - secret_id: '#/components/schemas/CreateLbPoolSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.secret_id.anyOf[0]" + timeout_client_data: Frontend client inactivity timeout in milliseconds - session_persistence: '#/components/schemas/CreateLbPoolSerializer/properties/session_persistence/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.session_persistence.anyOf[0]" + timeout_member_connect: Backend member connection timeout in milliseconds - timeout_client_data: '#/components/schemas/CreateLbPoolSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.timeout_client_data.anyOf[0]" - - timeout_member_connect: '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" - - timeout_member_data: '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_data.anyOf[0]" + timeout_member_data: Backend member inactivity timeout in milliseconds extra_headers: Send extra headers @@ -220,50 +200,30 @@ def update( they will be overwritten. Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[1].schema" - - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[2].schema" + ca_secret_id: Secret ID of CA certificate bundle - ca_secret_id: '#/components/schemas/PatchLbPoolSerializer/properties/ca_secret_id/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.ca_secret_id.anyOf[0]" + crl_secret_id: Secret ID of CA revocation list file - crl_secret_id: '#/components/schemas/PatchLbPoolSerializer/properties/crl_secret_id/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.crl_secret_id.anyOf[0]" + healthmonitor: New pool health monitor settings - healthmonitor: '#/components/schemas/PatchLbPoolSerializer/properties/healthmonitor/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.healthmonitor.anyOf[0]" + lb_algorithm: New load balancer pool algorithm of how to distribute requests - lb_algorithm: '#/components/schemas/PatchLbPoolSerializer/properties/lb_algorithm' - "$.components.schemas.PatchLbPoolSerializer.properties.lb_algorithm" + members: New sequence of load balancer pool members. If members are the same (by + address + port), they will be kept as is without recreation and downtime. - members: '#/components/schemas/PatchLbPoolSerializer/properties/members/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.members.anyOf[0]" + name: New pool name - name: '#/components/schemas/PatchLbPoolSerializer/properties/name' - "$.components.schemas.PatchLbPoolSerializer.properties.name" + protocol: New communication protocol - protocol: '#/components/schemas/PatchLbPoolSerializer/properties/protocol' - "$.components.schemas.PatchLbPoolSerializer.properties.protocol" + secret_id: Secret ID for TLS client authentication to the member servers - secret_id: '#/components/schemas/PatchLbPoolSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.secret_id.anyOf[0]" + session_persistence: New session persistence settings - session_persistence: '#/components/schemas/PatchLbPoolSerializer/properties/session_persistence/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.session_persistence.anyOf[0]" + timeout_client_data: Frontend client inactivity timeout in milliseconds - timeout_client_data: '#/components/schemas/PatchLbPoolSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.timeout_client_data.anyOf[0]" + timeout_member_connect: Backend member connection timeout in milliseconds - timeout_member_connect: '#/components/schemas/PatchLbPoolSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" - - timeout_member_data: '#/components/schemas/PatchLbPoolSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.timeout_member_data.anyOf[0]" + timeout_member_data: Backend member inactivity timeout in milliseconds extra_headers: Send extra headers @@ -323,20 +283,12 @@ def list( List load balancer pools Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[1].schema" - - details: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[2]" + details: If true, show member and healthmonitor details of each pool (increases request + time) - listener_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[3]" + listener_id: Load balancer listener ID - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[4]" + loadbalancer_id: Load balancer ID extra_headers: Send extra headers @@ -386,15 +338,6 @@ def delete( Delete load balancer pool Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}']['delete'].parameters[1].schema" - - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -434,15 +377,6 @@ def get( Get load balancer pool Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].get.parameters[1].schema" - - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -524,53 +458,33 @@ async def create( Create load balancer pool Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].post.parameters[0].schema" + lb_algorithm: Load balancer algorithm - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].post.parameters[1].schema" + name: Pool name - lb_algorithm: '#/components/schemas/CreateLbPoolSerializer/properties/lb_algorithm' - "$.components.schemas.CreateLbPoolSerializer.properties.lb_algorithm" + protocol: Protocol - name: '#/components/schemas/CreateLbPoolSerializer/properties/name' - "$.components.schemas.CreateLbPoolSerializer.properties.name" + ca_secret_id: Secret ID of CA certificate bundle - protocol: '#/components/schemas/CreateLbPoolSerializer/properties/protocol' - "$.components.schemas.CreateLbPoolSerializer.properties.protocol" + crl_secret_id: Secret ID of CA revocation list file - ca_secret_id: '#/components/schemas/CreateLbPoolSerializer/properties/ca_secret_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.ca_secret_id.anyOf[0]" + healthmonitor: Health monitor details - crl_secret_id: '#/components/schemas/CreateLbPoolSerializer/properties/crl_secret_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.crl_secret_id.anyOf[0]" + listener_id: Listener ID - healthmonitor: '#/components/schemas/CreateLbPoolSerializer/properties/healthmonitor/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.healthmonitor.anyOf[0]" + loadbalancer_id: Loadbalancer ID - listener_id: '#/components/schemas/CreateLbPoolSerializer/properties/listener_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.listener_id.anyOf[0]" + members: Pool members - loadbalancer_id: '#/components/schemas/CreateLbPoolSerializer/properties/loadbalancer_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.loadbalancer_id.anyOf[0]" + secret_id: Secret ID for TLS client authentication to the member servers - members: '#/components/schemas/CreateLbPoolSerializer/properties/members/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.members.anyOf[0]" + session_persistence: Session persistence details - secret_id: '#/components/schemas/CreateLbPoolSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.secret_id.anyOf[0]" + timeout_client_data: Frontend client inactivity timeout in milliseconds - session_persistence: '#/components/schemas/CreateLbPoolSerializer/properties/session_persistence/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.session_persistence.anyOf[0]" + timeout_member_connect: Backend member connection timeout in milliseconds - timeout_client_data: '#/components/schemas/CreateLbPoolSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.timeout_client_data.anyOf[0]" - - timeout_member_connect: '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" - - timeout_member_data: '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_data.anyOf[0]" + timeout_member_data: Backend member inactivity timeout in milliseconds extra_headers: Send extra headers @@ -642,50 +556,30 @@ async def update( they will be overwritten. Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[1].schema" - - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[2].schema" + ca_secret_id: Secret ID of CA certificate bundle - ca_secret_id: '#/components/schemas/PatchLbPoolSerializer/properties/ca_secret_id/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.ca_secret_id.anyOf[0]" + crl_secret_id: Secret ID of CA revocation list file - crl_secret_id: '#/components/schemas/PatchLbPoolSerializer/properties/crl_secret_id/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.crl_secret_id.anyOf[0]" + healthmonitor: New pool health monitor settings - healthmonitor: '#/components/schemas/PatchLbPoolSerializer/properties/healthmonitor/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.healthmonitor.anyOf[0]" + lb_algorithm: New load balancer pool algorithm of how to distribute requests - lb_algorithm: '#/components/schemas/PatchLbPoolSerializer/properties/lb_algorithm' - "$.components.schemas.PatchLbPoolSerializer.properties.lb_algorithm" + members: New sequence of load balancer pool members. If members are the same (by + address + port), they will be kept as is without recreation and downtime. - members: '#/components/schemas/PatchLbPoolSerializer/properties/members/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.members.anyOf[0]" + name: New pool name - name: '#/components/schemas/PatchLbPoolSerializer/properties/name' - "$.components.schemas.PatchLbPoolSerializer.properties.name" + protocol: New communication protocol - protocol: '#/components/schemas/PatchLbPoolSerializer/properties/protocol' - "$.components.schemas.PatchLbPoolSerializer.properties.protocol" + secret_id: Secret ID for TLS client authentication to the member servers - secret_id: '#/components/schemas/PatchLbPoolSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.secret_id.anyOf[0]" + session_persistence: New session persistence settings - session_persistence: '#/components/schemas/PatchLbPoolSerializer/properties/session_persistence/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.session_persistence.anyOf[0]" + timeout_client_data: Frontend client inactivity timeout in milliseconds - timeout_client_data: '#/components/schemas/PatchLbPoolSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.timeout_client_data.anyOf[0]" + timeout_member_connect: Backend member connection timeout in milliseconds - timeout_member_connect: '#/components/schemas/PatchLbPoolSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" - - timeout_member_data: '#/components/schemas/PatchLbPoolSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.timeout_member_data.anyOf[0]" + timeout_member_data: Backend member inactivity timeout in milliseconds extra_headers: Send extra headers @@ -745,20 +639,12 @@ async def list( List load balancer pools Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[1].schema" - - details: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[2]" + details: If true, show member and healthmonitor details of each pool (increases request + time) - listener_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[3]" + listener_id: Load balancer listener ID - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[4]" + loadbalancer_id: Load balancer ID extra_headers: Send extra headers @@ -808,15 +694,6 @@ async def delete( Delete load balancer pool Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}']['delete'].parameters[1].schema" - - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -856,15 +733,6 @@ async def get( Get load balancer pool Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].get.parameters[1].schema" - - pool_id: '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 3b33c75f..ec309e9c 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -56,12 +56,6 @@ def list( List load balancers statuses Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fstatus/get/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/status'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fstatus/get/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/status'].get.parameters[1].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -99,15 +93,6 @@ def get( Get load balancer status Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fstatus/get/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fstatus/get/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status'].get.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fstatus/get/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -167,12 +152,6 @@ async def list( List load balancers statuses Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fstatus/get/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/status'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fstatus/get/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/status'].get.parameters[1].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -210,15 +189,6 @@ async def get( Get load balancer status Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fstatus/get/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fstatus/get/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status'].get.parameters[1].schema" - - loadbalancer_id: '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fstatus/get/parameters/2/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 474294ad..592d4ec5 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -91,23 +91,17 @@ def create( Create network Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].post.parameters[0].schema" + name: Network name - region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].post.parameters[1].schema" + create_router: Defaults to True - name: '#/components/schemas/CreateNetworkSerializer/properties/name' - "$.components.schemas.CreateNetworkSerializer.properties.name" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - create_router: '#/components/schemas/CreateNetworkSerializer/properties/create_router' - "$.components.schemas.CreateNetworkSerializer.properties.create_router" - - tags: '#/components/schemas/CreateNetworkSerializer/properties/tags' - "$.components.schemas.CreateNetworkSerializer.properties.tags" - - type: '#/components/schemas/CreateNetworkSerializer/properties/type' - "$.components.schemas.CreateNetworkSerializer.properties.type" + type: vlan or vxlan network type is allowed. Default value is vxlan extra_headers: Send extra headers @@ -156,17 +150,7 @@ def update( Change network name Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[1].schema" - - network_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[2].schema" - - name: '#/components/schemas/NameSerializerPydantic/properties/name' - "$.components.schemas.NameSerializerPydantic.properties.name" + name: Name. extra_headers: Send extra headers @@ -212,26 +196,17 @@ def list( List networks Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[1].schema" - - limit: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[2]" + limit: Limit the number of returned limit request entities. - offset: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[3]" + offset: Offset value is used to exclude the first set of records from the result. - order_by: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[4]" + order_by: Order networks by fields and directions (name.asc). Default is `created_at.asc`. - tag_key: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[5]" + tag_key: Filter by tag keys. - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[6]" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G + --data-urlencode "tag_key_value={"key": "value"}" --url + "http://localhost:1111/v1/networks/1/1" extra_headers: Send extra headers @@ -284,15 +259,6 @@ def delete( Delete network Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}']['delete'].parameters[1].schema" - - network_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -332,15 +298,6 @@ def get( Get network Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].get.parameters[1].schema" - - network_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -412,23 +369,17 @@ async def create( Create network Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].post.parameters[0].schema" + name: Network name - region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].post.parameters[1].schema" + create_router: Defaults to True - name: '#/components/schemas/CreateNetworkSerializer/properties/name' - "$.components.schemas.CreateNetworkSerializer.properties.name" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - create_router: '#/components/schemas/CreateNetworkSerializer/properties/create_router' - "$.components.schemas.CreateNetworkSerializer.properties.create_router" - - tags: '#/components/schemas/CreateNetworkSerializer/properties/tags' - "$.components.schemas.CreateNetworkSerializer.properties.tags" - - type: '#/components/schemas/CreateNetworkSerializer/properties/type' - "$.components.schemas.CreateNetworkSerializer.properties.type" + type: vlan or vxlan network type is allowed. Default value is vxlan extra_headers: Send extra headers @@ -477,17 +428,7 @@ async def update( Change network name Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[1].schema" - - network_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[2].schema" - - name: '#/components/schemas/NameSerializerPydantic/properties/name' - "$.components.schemas.NameSerializerPydantic.properties.name" + name: Name. extra_headers: Send extra headers @@ -533,26 +474,17 @@ def list( List networks Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[1].schema" - - limit: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[2]" + limit: Limit the number of returned limit request entities. - offset: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[3]" + offset: Offset value is used to exclude the first set of records from the result. - order_by: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[4]" + order_by: Order networks by fields and directions (name.asc). Default is `created_at.asc`. - tag_key: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[5]" + tag_key: Filter by tag keys. - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[6]" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G + --data-urlencode "tag_key_value={"key": "value"}" --url + "http://localhost:1111/v1/networks/1/1" extra_headers: Send extra headers @@ -605,15 +537,6 @@ async def delete( Delete network Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}']['delete'].parameters[1].schema" - - network_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -653,15 +576,6 @@ async def get( Get network Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].get.parameters[1].schema" - - network_id: '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 9d48a329..17ac0693 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -71,23 +71,13 @@ def create( Create router Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].post.parameters[0].schema" + name: name of router - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].post.parameters[1].schema" + external_gateway_info - name: '#/components/schemas/CreateRouterSerializer/properties/name' - "$.components.schemas.CreateRouterSerializer.properties.name" + interfaces: List of interfaces to attach to router immediately after creation. - external_gateway_info: '#/components/schemas/CreateRouterSerializer/properties/external_gateway_info' - "$.components.schemas.CreateRouterSerializer.properties.external_gateway_info" - - interfaces: '#/components/schemas/CreateRouterSerializer/properties/interfaces/anyOf/0' - "$.components.schemas.CreateRouterSerializer.properties.interfaces.anyOf[0]" - - routes: '#/components/schemas/CreateRouterSerializer/properties/routes/anyOf/0' - "$.components.schemas.CreateRouterSerializer.properties.routes.anyOf[0]" + routes: List of custom routes. extra_headers: Send extra headers @@ -138,23 +128,11 @@ def update( Update router Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[1].schema" - - router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[2].schema" + external_gateway_info: New external gateway. - external_gateway_info: '#/components/schemas/PatchRouterSerializer/properties/external_gateway_info/anyOf/0' - "$.components.schemas.PatchRouterSerializer.properties.external_gateway_info.anyOf[0]" + name: New name of router - name: '#/components/schemas/PatchRouterSerializer/properties/name/anyOf/0' - "$.components.schemas.PatchRouterSerializer.properties.name.anyOf[0]" - - routes: '#/components/schemas/PatchRouterSerializer/properties/routes/anyOf/0' - "$.components.schemas.PatchRouterSerializer.properties.routes.anyOf[0]" + routes: List of custom routes. extra_headers: Send extra headers @@ -204,17 +182,9 @@ def list( List routers Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[1].schema" + limit: Limit the number of returned limit request entities. - limit: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[2]" - - offset: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[3]" + offset: Offset value is used to exclude the first set of records from the result. extra_headers: Send extra headers @@ -264,15 +234,6 @@ def delete( Delete router Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}']['delete'].parameters[1].schema" - - router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -314,20 +275,16 @@ def attach_subnet( Attach subnet to router Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[1].schema" + region_id: Region ID - router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/2/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[2].schema" + router_id: Router ID - subnet_id: '#/components/schemas/AddRouterInterfaceSerializer/properties/subnet_id' - "$.components.schemas.AddRouterInterfaceSerializer.properties.subnet_id" + subnet_id: Subnet ID on which router interface will be created - ip_address: '#/components/schemas/AddRouterInterfaceSerializer/properties/ip_address' - "$.components.schemas.AddRouterInterfaceSerializer.properties.ip_address" + ip_address: IP address to assign for router's interface, if not specified, address will be + selected automatically extra_headers: Send extra headers @@ -376,17 +333,7 @@ def detach_subnet( Detach subnet from router Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[1].schema" - - router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/2/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[2].schema" - - subnet_id: '#/components/schemas/SubnetIdSerializer/properties/subnet_id' - "$.components.schemas.SubnetIdSerializer.properties.subnet_id" + subnet_id: Target IP is identified by it's subnet extra_headers: Send extra headers @@ -428,15 +375,6 @@ def get( Get specific router Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].get.parameters[1].schema" - - router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -500,23 +438,13 @@ async def create( Create router Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].post.parameters[0].schema" + name: name of router - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].post.parameters[1].schema" + external_gateway_info - name: '#/components/schemas/CreateRouterSerializer/properties/name' - "$.components.schemas.CreateRouterSerializer.properties.name" + interfaces: List of interfaces to attach to router immediately after creation. - external_gateway_info: '#/components/schemas/CreateRouterSerializer/properties/external_gateway_info' - "$.components.schemas.CreateRouterSerializer.properties.external_gateway_info" - - interfaces: '#/components/schemas/CreateRouterSerializer/properties/interfaces/anyOf/0' - "$.components.schemas.CreateRouterSerializer.properties.interfaces.anyOf[0]" - - routes: '#/components/schemas/CreateRouterSerializer/properties/routes/anyOf/0' - "$.components.schemas.CreateRouterSerializer.properties.routes.anyOf[0]" + routes: List of custom routes. extra_headers: Send extra headers @@ -567,23 +495,11 @@ async def update( Update router Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[1].schema" - - router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[2].schema" + external_gateway_info: New external gateway. - external_gateway_info: '#/components/schemas/PatchRouterSerializer/properties/external_gateway_info/anyOf/0' - "$.components.schemas.PatchRouterSerializer.properties.external_gateway_info.anyOf[0]" + name: New name of router - name: '#/components/schemas/PatchRouterSerializer/properties/name/anyOf/0' - "$.components.schemas.PatchRouterSerializer.properties.name.anyOf[0]" - - routes: '#/components/schemas/PatchRouterSerializer/properties/routes/anyOf/0' - "$.components.schemas.PatchRouterSerializer.properties.routes.anyOf[0]" + routes: List of custom routes. extra_headers: Send extra headers @@ -633,17 +549,9 @@ def list( List routers Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[1].schema" + limit: Limit the number of returned limit request entities. - limit: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[2]" - - offset: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[3]" + offset: Offset value is used to exclude the first set of records from the result. extra_headers: Send extra headers @@ -693,15 +601,6 @@ async def delete( Delete router Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}']['delete'].parameters[1].schema" - - router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -743,20 +642,16 @@ async def attach_subnet( Attach subnet to router Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[1].schema" + region_id: Region ID - router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/2/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[2].schema" + router_id: Router ID - subnet_id: '#/components/schemas/AddRouterInterfaceSerializer/properties/subnet_id' - "$.components.schemas.AddRouterInterfaceSerializer.properties.subnet_id" + subnet_id: Subnet ID on which router interface will be created - ip_address: '#/components/schemas/AddRouterInterfaceSerializer/properties/ip_address' - "$.components.schemas.AddRouterInterfaceSerializer.properties.ip_address" + ip_address: IP address to assign for router's interface, if not specified, address will be + selected automatically extra_headers: Send extra headers @@ -805,17 +700,7 @@ async def detach_subnet( Detach subnet from router Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[1].schema" - - router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/2/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[2].schema" - - subnet_id: '#/components/schemas/SubnetIdSerializer/properties/subnet_id' - "$.components.schemas.SubnetIdSerializer.properties.subnet_id" + subnet_id: Target IP is identified by it's subnet extra_headers: Send extra headers @@ -859,15 +744,6 @@ async def get( Get specific router Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].get.parameters[1].schema" - - router_id: '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 79ffb3ce..4097dcd3 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -76,44 +76,41 @@ def create( Create subnet Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - cidr: '#/components/schemas/CreateSubnetSerializer/properties/cidr' - "$.components.schemas.CreateSubnetSerializer.properties.cidr" + cidr: CIDR - name: '#/components/schemas/CreateSubnetSerializer/properties/name' - "$.components.schemas.CreateSubnetSerializer.properties.name" + name: Subnet name - network_id: '#/components/schemas/CreateSubnetSerializer/properties/network_id' - "$.components.schemas.CreateSubnetSerializer.properties.network_id" + network_id: Network ID - connect_to_network_router: '#/components/schemas/CreateSubnetSerializer/properties/connect_to_network_router' - "$.components.schemas.CreateSubnetSerializer.properties.connect_to_network_router" + connect_to_network_router: True if the network's router should get a gateway in this subnet. Must be + explicitly 'false' when gateway_ip is null. - dns_nameservers: '#/components/schemas/CreateSubnetSerializer/properties/dns_nameservers/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.dns_nameservers.anyOf[0]" + dns_nameservers: List IP addresses of DNS servers to advertise via DHCP. - enable_dhcp: '#/components/schemas/CreateSubnetSerializer/properties/enable_dhcp' - "$.components.schemas.CreateSubnetSerializer.properties.enable_dhcp" + enable_dhcp: True if DHCP should be enabled - gateway_ip: '#/components/schemas/CreateSubnetSerializer/properties/gateway_ip/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.gateway_ip.anyOf[0]" + gateway_ip: Default GW IPv4 address to advertise in DHCP routes in this subnet. Omit this + field to let the cloud backend allocate it automatically. Set to null if no + gateway must be advertised by this subnet's DHCP (useful when attaching + instances to multiple subnets in order to prevent default route conflicts). - host_routes: '#/components/schemas/CreateSubnetSerializer/properties/host_routes/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.host_routes.anyOf[0]" + host_routes: List of custom static routes to advertise via DHCP. - ip_version: '#/components/schemas/CreateSubnetSerializer/properties/ip_version' - "$.components.schemas.CreateSubnetSerializer.properties.ip_version" + ip_version: IP version - router_id_to_connect: '#/components/schemas/CreateSubnetSerializer/properties/router_id_to_connect/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" + router_id_to_connect: ID of the router to connect to. Requires `connect_to_network_router` set to + true. If not specified, attempts to find a router created during network + creation. - tags: '#/components/schemas/CreateSubnetSerializer/properties/tags' - "$.components.schemas.CreateSubnetSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers @@ -173,29 +170,24 @@ def update( Change subnet properties Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[1].schema" + region_id: Region ID - subnet_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[2].schema" + subnet_id: Subnet ID - dns_nameservers: '#/components/schemas/PatchSubnetSerializer/properties/dns_nameservers/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.dns_nameservers.anyOf[0]" + dns_nameservers: List IP addresses of DNS servers to advertise via DHCP. - enable_dhcp: '#/components/schemas/PatchSubnetSerializer/properties/enable_dhcp/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.enable_dhcp.anyOf[0]" + enable_dhcp: True if DHCP should be enabled - gateway_ip: '#/components/schemas/PatchSubnetSerializer/properties/gateway_ip/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.gateway_ip.anyOf[0]" + gateway_ip: Default GW IPv4 address to advertise in DHCP routes in this subnet. Omit this + field to let the cloud backend allocate it automatically. Set to null if no + gateway must be advertised by this subnet's DHCP (useful when attaching + instances to multiple subnets in order to prevent default route conflicts). - host_routes: '#/components/schemas/PatchSubnetSerializer/properties/host_routes/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.host_routes.anyOf[0]" + host_routes: List of custom static routes to advertise via DHCP. - name: '#/components/schemas/PatchSubnetSerializer/properties/name/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.name.anyOf[0]" + name: Name extra_headers: Send extra headers @@ -265,29 +257,26 @@ def list( List subnets Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID - limit: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[2]" + limit: Optional. Limit the number of returned items - network_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[3]" + network_id: Only list subnets of this network - offset: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[4]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - order_by: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[5]" + order_by: Ordering subnets list result by `name`, `created_at`, `updated_at`, + `available_ips`, `total_ips`, and `cidr` (default) fields of the subnet and + directions (`name.asc`). - tag_key: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[6]" + tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[7]" + tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode + "tag_key_value={"key": "value"}" --url + "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers @@ -341,14 +330,11 @@ def delete( Delete subnet Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}']['delete'].parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}']['delete'].parameters[1].schema" + region_id: Region ID - subnet_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}']['delete'].parameters[2].schema" + subnet_id: Subnet ID extra_headers: Send extra headers @@ -390,14 +376,11 @@ def get( Get subnet Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].get.parameters[1].schema" + region_id: Region ID - subnet_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].get.parameters[2].schema" + subnet_id: Subnet ID extra_headers: Send extra headers @@ -469,44 +452,41 @@ async def create( Create subnet Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - cidr: '#/components/schemas/CreateSubnetSerializer/properties/cidr' - "$.components.schemas.CreateSubnetSerializer.properties.cidr" + cidr: CIDR - name: '#/components/schemas/CreateSubnetSerializer/properties/name' - "$.components.schemas.CreateSubnetSerializer.properties.name" + name: Subnet name - network_id: '#/components/schemas/CreateSubnetSerializer/properties/network_id' - "$.components.schemas.CreateSubnetSerializer.properties.network_id" + network_id: Network ID - connect_to_network_router: '#/components/schemas/CreateSubnetSerializer/properties/connect_to_network_router' - "$.components.schemas.CreateSubnetSerializer.properties.connect_to_network_router" + connect_to_network_router: True if the network's router should get a gateway in this subnet. Must be + explicitly 'false' when gateway_ip is null. - dns_nameservers: '#/components/schemas/CreateSubnetSerializer/properties/dns_nameservers/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.dns_nameservers.anyOf[0]" + dns_nameservers: List IP addresses of DNS servers to advertise via DHCP. - enable_dhcp: '#/components/schemas/CreateSubnetSerializer/properties/enable_dhcp' - "$.components.schemas.CreateSubnetSerializer.properties.enable_dhcp" + enable_dhcp: True if DHCP should be enabled - gateway_ip: '#/components/schemas/CreateSubnetSerializer/properties/gateway_ip/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.gateway_ip.anyOf[0]" + gateway_ip: Default GW IPv4 address to advertise in DHCP routes in this subnet. Omit this + field to let the cloud backend allocate it automatically. Set to null if no + gateway must be advertised by this subnet's DHCP (useful when attaching + instances to multiple subnets in order to prevent default route conflicts). - host_routes: '#/components/schemas/CreateSubnetSerializer/properties/host_routes/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.host_routes.anyOf[0]" + host_routes: List of custom static routes to advertise via DHCP. - ip_version: '#/components/schemas/CreateSubnetSerializer/properties/ip_version' - "$.components.schemas.CreateSubnetSerializer.properties.ip_version" + ip_version: IP version - router_id_to_connect: '#/components/schemas/CreateSubnetSerializer/properties/router_id_to_connect/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" + router_id_to_connect: ID of the router to connect to. Requires `connect_to_network_router` set to + true. If not specified, attempts to find a router created during network + creation. - tags: '#/components/schemas/CreateSubnetSerializer/properties/tags' - "$.components.schemas.CreateSubnetSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. extra_headers: Send extra headers @@ -566,29 +546,24 @@ async def update( Change subnet properties Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[1].schema" + region_id: Region ID - subnet_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[2].schema" + subnet_id: Subnet ID - dns_nameservers: '#/components/schemas/PatchSubnetSerializer/properties/dns_nameservers/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.dns_nameservers.anyOf[0]" + dns_nameservers: List IP addresses of DNS servers to advertise via DHCP. - enable_dhcp: '#/components/schemas/PatchSubnetSerializer/properties/enable_dhcp/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.enable_dhcp.anyOf[0]" + enable_dhcp: True if DHCP should be enabled - gateway_ip: '#/components/schemas/PatchSubnetSerializer/properties/gateway_ip/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.gateway_ip.anyOf[0]" + gateway_ip: Default GW IPv4 address to advertise in DHCP routes in this subnet. Omit this + field to let the cloud backend allocate it automatically. Set to null if no + gateway must be advertised by this subnet's DHCP (useful when attaching + instances to multiple subnets in order to prevent default route conflicts). - host_routes: '#/components/schemas/PatchSubnetSerializer/properties/host_routes/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.host_routes.anyOf[0]" + host_routes: List of custom static routes to advertise via DHCP. - name: '#/components/schemas/PatchSubnetSerializer/properties/name/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.name.anyOf[0]" + name: Name extra_headers: Send extra headers @@ -658,29 +633,26 @@ def list( List subnets Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID - limit: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[2]" + limit: Optional. Limit the number of returned items - network_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[3]" + network_id: Only list subnets of this network - offset: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[4]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - order_by: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[5]" + order_by: Ordering subnets list result by `name`, `created_at`, `updated_at`, + `available_ips`, `total_ips`, and `cidr` (default) fields of the subnet and + directions (`name.asc`). - tag_key: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[6]" + tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[7]" + tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode + "tag_key_value={"key": "value"}" --url + "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers @@ -734,14 +706,11 @@ async def delete( Delete subnet Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}']['delete'].parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}']['delete'].parameters[1].schema" + region_id: Region ID - subnet_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}']['delete'].parameters[2].schema" + subnet_id: Subnet ID extra_headers: Send extra headers @@ -783,14 +752,11 @@ async def get( Get subnet Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].get.parameters[1].schema" + region_id: Region ID - subnet_id: '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].get.parameters[2].schema" + subnet_id: Subnet ID extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 1e2e77c3..4feb4a40 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -63,17 +63,9 @@ def create( Create an affinity or anti-affinity or soft-anti-affinity placement group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].post.parameters[0].schema" + name: The name of the server group. - region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].post.parameters[1].schema" - - name: '#/components/schemas/CreateServerGroupSerializer/properties/name' - "$.components.schemas.CreateServerGroupSerializer.properties.name" - - policy: '#/components/schemas/CreateServerGroupSerializer/properties/policy' - "$.components.schemas.CreateServerGroupSerializer.properties.policy" + policy: The server group policy. extra_headers: Send extra headers @@ -118,12 +110,6 @@ def list( List placement groups Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].get.parameters[1].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -161,15 +147,6 @@ def delete( Delete placement group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -209,15 +186,6 @@ def get( Get placement group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}'].get.parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -279,17 +247,9 @@ async def create( Create an affinity or anti-affinity or soft-anti-affinity placement group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].post.parameters[0].schema" + name: The name of the server group. - region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].post.parameters[1].schema" - - name: '#/components/schemas/CreateServerGroupSerializer/properties/name' - "$.components.schemas.CreateServerGroupSerializer.properties.name" - - policy: '#/components/schemas/CreateServerGroupSerializer/properties/policy' - "$.components.schemas.CreateServerGroupSerializer.properties.policy" + policy: The server group policy. extra_headers: Send extra headers @@ -334,12 +294,6 @@ async def list( List placement groups Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].get.parameters[1].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -377,15 +331,6 @@ async def delete( Delete placement group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -425,15 +370,6 @@ async def get( Get placement group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}'].get.parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 0c01283e..4049af8d 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -60,21 +60,18 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Project: - """ - Create project + """Create project Args: - name: '#/components/schemas/CreateProjectSerializer/properties/name' - "$.components.schemas.CreateProjectSerializer.properties.name" + name: Unique project name for a client. + + Each client always has one "default" project. - client_id: '#/components/schemas/CreateProjectSerializer/properties/client_id/anyOf/0' - "$.components.schemas.CreateProjectSerializer.properties.client_id.anyOf[0]" + client_id: ID associated with the client. - description: '#/components/schemas/CreateProjectSerializer/properties/description/anyOf/0' - "$.components.schemas.CreateProjectSerializer.properties.description.anyOf[0]" + description: Description of the project. - state: '#/components/schemas/CreateProjectSerializer/properties/state/anyOf/0' - "$.components.schemas.CreateProjectSerializer.properties.state.anyOf[0]" + state: State of the project. extra_headers: Send extra headers @@ -121,23 +118,17 @@ def list( List projects Args: - client_id: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/0' - "$.paths['/cloud/v1/projects'].get.parameters[0]" + client_id: Client ID filter for administrators. - include_deleted: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/1' - "$.paths['/cloud/v1/projects'].get.parameters[1]" + include_deleted: Whether to include deleted projects in the response. - limit: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/2' - "$.paths['/cloud/v1/projects'].get.parameters[2]" + limit: Limit value is used to limit the number of records in the result - name: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/3' - "$.paths['/cloud/v1/projects'].get.parameters[3]" + name: Name to filter the results by. - offset: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/4' - "$.paths['/cloud/v1/projects'].get.parameters[4]" + offset: Offset value is used to exclude the first set of records from the result - order_by: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/5' - "$.paths['/cloud/v1/projects'].get.parameters[5]" + order_by: Order by field and direction. extra_headers: Send extra headers @@ -186,9 +177,6 @@ def delete( and will not be recoverable Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/projects/{project_id}']['delete'].parameters[0].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -222,9 +210,6 @@ def get( Get Project Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/projects/{project_id}'].get.parameters[0].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -260,14 +245,9 @@ def replace( Update Project Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/put/parameters/0/schema' - "$.paths['/cloud/v1/projects/{project_id}'].put.parameters[0].schema" - - name: '#/components/schemas/NameDescriptionSerializer/properties/name' - "$.components.schemas.NameDescriptionSerializer.properties.name" + name: Name of the entity, following a specific format. - description: '#/components/schemas/NameDescriptionSerializer/properties/description/anyOf/0' - "$.components.schemas.NameDescriptionSerializer.properties.description.anyOf[0]" + description: Description of the project. extra_headers: Send extra headers @@ -329,21 +309,18 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Project: - """ - Create project + """Create project Args: - name: '#/components/schemas/CreateProjectSerializer/properties/name' - "$.components.schemas.CreateProjectSerializer.properties.name" + name: Unique project name for a client. + + Each client always has one "default" project. - client_id: '#/components/schemas/CreateProjectSerializer/properties/client_id/anyOf/0' - "$.components.schemas.CreateProjectSerializer.properties.client_id.anyOf[0]" + client_id: ID associated with the client. - description: '#/components/schemas/CreateProjectSerializer/properties/description/anyOf/0' - "$.components.schemas.CreateProjectSerializer.properties.description.anyOf[0]" + description: Description of the project. - state: '#/components/schemas/CreateProjectSerializer/properties/state/anyOf/0' - "$.components.schemas.CreateProjectSerializer.properties.state.anyOf[0]" + state: State of the project. extra_headers: Send extra headers @@ -390,23 +367,17 @@ def list( List projects Args: - client_id: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/0' - "$.paths['/cloud/v1/projects'].get.parameters[0]" + client_id: Client ID filter for administrators. - include_deleted: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/1' - "$.paths['/cloud/v1/projects'].get.parameters[1]" + include_deleted: Whether to include deleted projects in the response. - limit: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/2' - "$.paths['/cloud/v1/projects'].get.parameters[2]" + limit: Limit value is used to limit the number of records in the result - name: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/3' - "$.paths['/cloud/v1/projects'].get.parameters[3]" + name: Name to filter the results by. - offset: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/4' - "$.paths['/cloud/v1/projects'].get.parameters[4]" + offset: Offset value is used to exclude the first set of records from the result - order_by: '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/5' - "$.paths['/cloud/v1/projects'].get.parameters[5]" + order_by: Order by field and direction. extra_headers: Send extra headers @@ -455,9 +426,6 @@ async def delete( and will not be recoverable Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/projects/{project_id}']['delete'].parameters[0].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -491,9 +459,6 @@ async def get( Get Project Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/projects/{project_id}'].get.parameters[0].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -529,14 +494,9 @@ async def replace( Update Project Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/put/parameters/0/schema' - "$.paths['/cloud/v1/projects/{project_id}'].put.parameters[0].schema" - - name: '#/components/schemas/NameDescriptionSerializer/properties/name' - "$.components.schemas.NameDescriptionSerializer.properties.name" + name: Name of the entity, following a specific format. - description: '#/components/schemas/NameDescriptionSerializer/properties/description/anyOf/0' - "$.components.schemas.NameDescriptionSerializer.properties.description.anyOf[0]" + description: Description of the project. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 3733575a..a4547029 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -88,11 +88,9 @@ def get_by_region( Get a quota by region Args: - client_id: '#/paths/%2Fcloud%2Fv2%2Fregional_quotas%2F%7Bclient_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v2/regional_quotas/{client_id}/{region_id}'].get.parameters[0].schema" + client_id: Client ID - region_id: '#/paths/%2Fcloud%2Fv2%2Fregional_quotas%2F%7Bclient_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v2/regional_quotas/{client_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID extra_headers: Send extra headers @@ -127,8 +125,7 @@ def get_global( Get global quota Args: - client_id: '#/paths/%2Fcloud%2Fv2%2Fglobal_quotas%2F%7Bclient_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v2/global_quotas/{client_id}'].get.parameters[0].schema" + client_id: Client ID extra_headers: Send extra headers @@ -206,11 +203,9 @@ async def get_by_region( Get a quota by region Args: - client_id: '#/paths/%2Fcloud%2Fv2%2Fregional_quotas%2F%7Bclient_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v2/regional_quotas/{client_id}/{region_id}'].get.parameters[0].schema" + client_id: Client ID - region_id: '#/paths/%2Fcloud%2Fv2%2Fregional_quotas%2F%7Bclient_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v2/regional_quotas/{client_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID extra_headers: Send extra headers @@ -245,8 +240,7 @@ async def get_global( Get global quota Args: - client_id: '#/paths/%2Fcloud%2Fv2%2Fglobal_quotas%2F%7Bclient_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v2/global_quotas/{client_id}'].get.parameters[0].schema" + client_id: Client ID extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index eefc7328..149f6d73 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -63,14 +63,11 @@ def create( Create request to change quotas Args: - description: '#/components/schemas/LimitsRequestCreateSerializer/properties/description' - "$.components.schemas.LimitsRequestCreateSerializer.properties.description" + description: Describe the reason, in general terms. - requested_limits: '#/components/schemas/LimitsRequestCreateSerializer/properties/requested_limits' - "$.components.schemas.LimitsRequestCreateSerializer.properties.requested_limits" + requested_limits: Limits you want to increase. - client_id: '#/components/schemas/LimitsRequestCreateSerializer/properties/client_id' - "$.components.schemas.LimitsRequestCreateSerializer.properties.client_id" + client_id: Client ID that requests the limit increase. extra_headers: Send extra headers @@ -114,14 +111,12 @@ def list( Returns a list of sent requests to change current quotas and their statuses Args: - limit: '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/0' - "$.paths['/cloud/v2/limits_request'].get.parameters[0]" + limit: Optional. Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/1' - "$.paths['/cloud/v2/limits_request'].get.parameters[1]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - status: '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/2/schema/anyOf/0' - "$.paths['/cloud/v2/limits_request'].get.parameters[2].schema.anyOf[0]" + status: List of limit requests statuses for filtering extra_headers: Send extra headers @@ -166,8 +161,7 @@ def delete( Delete request to change quotas Args: - request_id: '#/paths/%2Fcloud%2Fv2%2Flimits_request%2F%7Brequest_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v2/limits_request/{request_id}']['delete'].parameters[0].schema" + request_id: LimitRequest ID extra_headers: Send extra headers @@ -203,8 +197,7 @@ def get( Get request to change quota limits. Args: - request_id: '#/paths/%2Fcloud%2Fv2%2Flimits_request%2F%7Brequest_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v2/limits_request/{request_id}'].get.parameters[0].schema" + request_id: LimitRequest ID extra_headers: Send extra headers @@ -262,14 +255,11 @@ async def create( Create request to change quotas Args: - description: '#/components/schemas/LimitsRequestCreateSerializer/properties/description' - "$.components.schemas.LimitsRequestCreateSerializer.properties.description" + description: Describe the reason, in general terms. - requested_limits: '#/components/schemas/LimitsRequestCreateSerializer/properties/requested_limits' - "$.components.schemas.LimitsRequestCreateSerializer.properties.requested_limits" + requested_limits: Limits you want to increase. - client_id: '#/components/schemas/LimitsRequestCreateSerializer/properties/client_id' - "$.components.schemas.LimitsRequestCreateSerializer.properties.client_id" + client_id: Client ID that requests the limit increase. extra_headers: Send extra headers @@ -313,14 +303,12 @@ def list( Returns a list of sent requests to change current quotas and their statuses Args: - limit: '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/0' - "$.paths['/cloud/v2/limits_request'].get.parameters[0]" + limit: Optional. Limit the number of returned items - offset: '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/1' - "$.paths['/cloud/v2/limits_request'].get.parameters[1]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - status: '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/2/schema/anyOf/0' - "$.paths['/cloud/v2/limits_request'].get.parameters[2].schema.anyOf[0]" + status: List of limit requests statuses for filtering extra_headers: Send extra headers @@ -365,8 +353,7 @@ async def delete( Delete request to change quotas Args: - request_id: '#/paths/%2Fcloud%2Fv2%2Flimits_request%2F%7Brequest_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v2/limits_request/{request_id}']['delete'].parameters[0].schema" + request_id: LimitRequest ID extra_headers: Send extra headers @@ -402,8 +389,7 @@ async def get( Get request to change quota limits. Args: - request_id: '#/paths/%2Fcloud%2Fv2%2Flimits_request%2F%7Brequest_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v2/limits_request/{request_id}'].get.parameters[0].schema" + request_id: LimitRequest ID extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index 57da0445..652dc1bf 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -60,11 +60,10 @@ def retrieve( Get region Args: - region_id: '#/paths/%2Fcloud%2Fv1%2Fregions%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/regions/{region_id}'].get.parameters[0].schema" + region_id: Region ID - show_volume_types: '#/paths/%2Fcloud%2Fv1%2Fregions%2F%7Bregion_id%7D/get/parameters/1' - "$.paths['/cloud/v1/regions/{region_id}'].get.parameters[1]" + show_volume_types: If true, null `available_volume_type` is replaced with a list of available + volume types. extra_headers: Send extra headers @@ -106,24 +105,22 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[Region]: - """ - List regions + """List regions Args: - limit: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/0' - "$.paths['/cloud/v1/regions'].get.parameters[0]" + limit: Limit the number of returned regions. + + Falls back to default of 100 if not + specified. Limited by max limit value of 1000 - offset: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/1' - "$.paths['/cloud/v1/regions'].get.parameters[1]" + offset: Offset value is used to exclude the first set of records from the result - order_by: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/2' - "$.paths['/cloud/v1/regions'].get.parameters[2]" + order_by: Order by field and direction. - product: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/3' - "$.paths['/cloud/v1/regions'].get.parameters[3]" + product: If defined then return only regions that support given product. - show_volume_types: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/4' - "$.paths['/cloud/v1/regions'].get.parameters[4]" + show_volume_types: If true, null `available_volume_type` is replaced with a list of available + volume types. extra_headers: Send extra headers @@ -192,11 +189,10 @@ async def retrieve( Get region Args: - region_id: '#/paths/%2Fcloud%2Fv1%2Fregions%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/regions/{region_id}'].get.parameters[0].schema" + region_id: Region ID - show_volume_types: '#/paths/%2Fcloud%2Fv1%2Fregions%2F%7Bregion_id%7D/get/parameters/1' - "$.paths['/cloud/v1/regions/{region_id}'].get.parameters[1]" + show_volume_types: If true, null `available_volume_type` is replaced with a list of available + volume types. extra_headers: Send extra headers @@ -238,24 +234,22 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Region, AsyncOffsetPage[Region]]: - """ - List regions + """List regions Args: - limit: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/0' - "$.paths['/cloud/v1/regions'].get.parameters[0]" + limit: Limit the number of returned regions. + + Falls back to default of 100 if not + specified. Limited by max limit value of 1000 - offset: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/1' - "$.paths['/cloud/v1/regions'].get.parameters[1]" + offset: Offset value is used to exclude the first set of records from the result - order_by: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/2' - "$.paths['/cloud/v1/regions'].get.parameters[2]" + order_by: Order by field and direction. - product: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/3' - "$.paths['/cloud/v1/regions'].get.parameters[3]" + product: If defined then return only regions that support given product. - show_volume_types: '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/4' - "$.paths['/cloud/v1/regions'].get.parameters[4]" + show_volume_types: If true, null `available_volume_type` is replaced with a list of available + volume types. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index 628599cd..aeec5c3c 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -57,18 +57,6 @@ def list( List artifacts Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[2].schema" - - repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -110,21 +98,6 @@ def delete( Delete an artifact Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[2].schema" - - repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[3].schema" - - digest: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/4/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[4].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -189,18 +162,6 @@ async def list( List artifacts Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[2].schema" - - repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts/get/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts'].get.parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -242,21 +203,6 @@ async def delete( Delete an artifact Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[2].schema" - - repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[3].schema" - - digest: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D/delete/parameters/4/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}']['delete'].parameters[4].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 24161130..4f26fb63 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -108,17 +108,13 @@ def create( Create a registry Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].post.parameters[0].schema" + name: A name for the container registry. - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].post.parameters[1].schema" + Should be in lowercase, consisting only of numbers, letters and -, - name: '#/components/schemas/RegistryCreateSerializer/properties/name' - "$.components.schemas.RegistryCreateSerializer.properties.name" + with maximum length of 24 characters - storage_limit: '#/components/schemas/RegistryCreateSerializer/properties/storage_limit' - "$.components.schemas.RegistryCreateSerializer.properties.storage_limit" + storage_limit: Registry storage limit, GiB extra_headers: Send extra headers @@ -163,12 +159,6 @@ def list( Get registry list Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].get.parameters[1].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -206,15 +196,6 @@ def delete( Delete a registry Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}']['delete'].parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -253,15 +234,6 @@ def get( Get a registry Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}'].get.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -300,17 +272,7 @@ def resize( Resize a registry Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[2].schema" - - storage_limit: '#/components/schemas/RegistryResizeSerializer/properties/storage_limit' - "$.components.schemas.RegistryResizeSerializer.properties.storage_limit" + storage_limit: Registry storage limit, GiB extra_headers: Send extra headers @@ -388,17 +350,13 @@ async def create( Create a registry Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].post.parameters[0].schema" + name: A name for the container registry. - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].post.parameters[1].schema" + Should be in lowercase, consisting only of numbers, letters and -, - name: '#/components/schemas/RegistryCreateSerializer/properties/name' - "$.components.schemas.RegistryCreateSerializer.properties.name" + with maximum length of 24 characters - storage_limit: '#/components/schemas/RegistryCreateSerializer/properties/storage_limit' - "$.components.schemas.RegistryCreateSerializer.properties.storage_limit" + storage_limit: Registry storage limit, GiB extra_headers: Send extra headers @@ -443,12 +401,6 @@ async def list( Get registry list Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].get.parameters[1].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -486,15 +438,6 @@ async def delete( Delete a registry Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}']['delete'].parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -533,15 +476,6 @@ async def get( Get a registry Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}'].get.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -580,17 +514,7 @@ async def resize( Resize a registry Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[2].schema" - - storage_limit: '#/components/schemas/RegistryResizeSerializer/properties/storage_limit' - "$.components.schemas.RegistryResizeSerializer.properties.storage_limit" + storage_limit: Registry storage limit, GiB extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index 72e5e818..08a10aae 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -56,15 +56,6 @@ def list( List repositories Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories/get/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories/get/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories'].get.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories/get/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -103,18 +94,6 @@ def delete( Delete a repository Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[2].schema" - - repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -176,15 +155,6 @@ async def list( List repositories Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories/get/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories/get/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories'].get.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories/get/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -223,18 +193,6 @@ async def delete( Delete a repository Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[2].schema" - - repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}']['delete'].parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index 6c68261b..0d98d281 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -58,24 +58,6 @@ def delete( Delete a tag Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[2].schema" - - repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[3].schema" - - digest: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/4/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[4].schema" - - tag_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/5/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[5].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -144,24 +126,6 @@ async def delete( Delete a tag Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[2].schema" - - repository_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[3].schema" - - digest: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/4/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[4].schema" - - tag_name: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Frepositories%2F%7Brepository_name%7D%2Fartifacts%2F%7Bdigest%7D%2Ftags%2F%7Btag_name%7D/delete/parameters/5/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}']['delete'].parameters[5].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index ebb6bc7b..469dc7f1 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -66,26 +66,17 @@ def create( Create a user Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[0].schema" + duration: User account operating time, days - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[1].schema" + name: A name for the registry user. - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[2].schema" + Should be in lowercase, consisting only of numbers and letters, - duration: '#/components/schemas/RegistryUserCreateSerializer/properties/duration' - "$.components.schemas.RegistryUserCreateSerializer.properties.duration" + with maximum length of 16 characters - name: '#/components/schemas/RegistryUserCreateSerializer/properties/name' - "$.components.schemas.RegistryUserCreateSerializer.properties.name" + read_only: Read-only user - read_only: '#/components/schemas/RegistryUserCreateSerializer/properties/read_only' - "$.components.schemas.RegistryUserCreateSerializer.properties.read_only" - - secret: '#/components/schemas/RegistryUserCreateSerializer/properties/secret' - "$.components.schemas.RegistryUserCreateSerializer.properties.secret" + secret: User secret extra_headers: Send extra headers @@ -136,23 +127,9 @@ def update( Update a user Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[2].schema" - - user_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[3].schema" - - duration: '#/components/schemas/RegistryUserUpdateSerializer/properties/duration' - "$.components.schemas.RegistryUserUpdateSerializer.properties.duration" + duration: User account operating time, days - read_only: '#/components/schemas/RegistryUserUpdateSerializer/properties/read_only' - "$.components.schemas.RegistryUserUpdateSerializer.properties.read_only" + read_only: Read-only user extra_headers: Send extra headers @@ -198,15 +175,6 @@ def list( Get user list Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/get/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/get/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].get.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/get/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -245,18 +213,6 @@ def delete( Delete a user Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[2].schema" - - user_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -296,17 +252,7 @@ def create_multiple( Batch create users Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[2].schema" - - users: '#/components/schemas/RegistryBatchUsersCreateSerializer/properties/users' - "$.components.schemas.RegistryBatchUsersCreateSerializer.properties.users" + users: Set of users extra_headers: Send extra headers @@ -347,18 +293,6 @@ def refresh_secret( Refresh a secret Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[2].schema" - - user_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -422,26 +356,17 @@ async def create( Create a user Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[0].schema" + duration: User account operating time, days - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[1].schema" + name: A name for the registry user. - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[2].schema" + Should be in lowercase, consisting only of numbers and letters, - duration: '#/components/schemas/RegistryUserCreateSerializer/properties/duration' - "$.components.schemas.RegistryUserCreateSerializer.properties.duration" + with maximum length of 16 characters - name: '#/components/schemas/RegistryUserCreateSerializer/properties/name' - "$.components.schemas.RegistryUserCreateSerializer.properties.name" + read_only: Read-only user - read_only: '#/components/schemas/RegistryUserCreateSerializer/properties/read_only' - "$.components.schemas.RegistryUserCreateSerializer.properties.read_only" - - secret: '#/components/schemas/RegistryUserCreateSerializer/properties/secret' - "$.components.schemas.RegistryUserCreateSerializer.properties.secret" + secret: User secret extra_headers: Send extra headers @@ -492,23 +417,9 @@ async def update( Update a user Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[2].schema" - - user_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[3].schema" - - duration: '#/components/schemas/RegistryUserUpdateSerializer/properties/duration' - "$.components.schemas.RegistryUserUpdateSerializer.properties.duration" + duration: User account operating time, days - read_only: '#/components/schemas/RegistryUserUpdateSerializer/properties/read_only' - "$.components.schemas.RegistryUserUpdateSerializer.properties.read_only" + read_only: Read-only user extra_headers: Send extra headers @@ -554,15 +465,6 @@ async def list( Get user list Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/get/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/get/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].get.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/get/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -601,18 +503,6 @@ async def delete( Delete a user Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[2].schema" - - user_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/delete/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}']['delete'].parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -652,17 +542,7 @@ async def create_multiple( Batch create users Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[2].schema" - - users: '#/components/schemas/RegistryBatchUsersCreateSerializer/properties/users' - "$.components.schemas.RegistryBatchUsersCreateSerializer.properties.users" + users: Set of users extra_headers: Send extra headers @@ -703,18 +583,6 @@ async def refresh_secret( Refresh a secret Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[1].schema" - - registry_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[2].schema" - - user_id: '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D%2Frefresh_secret/post/parameters/3/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret'].post.parameters[3].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index 8a8d3833..55073b8f 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -79,20 +79,11 @@ def create( Create reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + type: Must be 'external' - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - type: '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.type" - - ip_family: '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/ip_family/anyOf/0' - "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.ip_family.anyOf[0]" - - is_vip: '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/is_vip' - "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.is_vip" + is_vip: If reserved fixed IP is a VIP extra_headers: Send extra headers @@ -124,20 +115,11 @@ def create( Create reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + subnet_id: Reserved fixed IP will be allocated in this subnet - subnet_id: '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/subnet_id' - "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.subnet_id" + type: Must be 'subnet'. - type: '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.type" - - is_vip: '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/is_vip' - "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.is_vip" + is_vip: If reserved fixed IP is a VIP extra_headers: Send extra headers @@ -170,23 +152,13 @@ def create( Create reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + network_id: Reserved fixed IP will be allocated in a subnet of this network - network_id: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/network_id' - "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.network_id" + type: Must be 'any_subnet'. - type: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.type" + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - ip_family: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/ip_family/anyOf/0' - "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.ip_family.anyOf[0]" - - is_vip: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/is_vip' - "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.is_vip" + is_vip: If reserved fixed IP is a VIP extra_headers: Send extra headers @@ -219,23 +191,13 @@ def create( Create reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + ip_address: Reserved fixed IP will be allocated the given IP address - ip_address: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/ip_address' - "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.ip_address" + network_id: Reserved fixed IP will be allocated in a subnet of this network - network_id: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/network_id' - "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.network_id" + type: Must be 'ip_address'. - type: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.type" - - is_vip: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/is_vip' - "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.is_vip" + is_vip: If reserved fixed IP is a VIP extra_headers: Send extra headers @@ -266,17 +228,10 @@ def create( Create reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + port_id: Port ID to make a reserved fixed IP (for example, `vip_port_id` of the Load + Balancer entity). - port_id: '#/components/schemas/NewReservedFixedIpSpecificPortSerializer/properties/port_id' - "$.components.schemas.NewReservedFixedIpSpecificPortSerializer.properties.port_id" - - type: '#/components/schemas/NewReservedFixedIpSpecificPortSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpSpecificPortSerializer.properties.type" + type: Must be 'port'. extra_headers: Send extra headers @@ -363,38 +318,26 @@ def list( List reserved fixed IPs Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[1].schema" - - available_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[2]" + available_only: Set to true if the response should only list IP addresses that are not attached + to any instance - device_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[3]" + device_id: Filter IPs by device ID it is attached to - external_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[4]" + external_only: Set to true if the response should only list public IP addresses - internal_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[5]" + internal_only: Set to true if the response should only list private IP addresses - ip_address: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[6]" + ip_address: An IPv4 address to filter results by. Regular expression allowed - limit: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[7]" + limit: Limit the number of returned IPs - offset: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[8]" + offset: Offset value is used to exclude the first set of records from the result - order_by: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[9]" + order_by: Ordering reserved fixed IP list result by name, status, updated_at, created_at + or fixed_ip_address fields of the reserved fixed IP and directions (status.asc), + default is "fixed_ip_address.asc" - vip_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[10]" + vip_only: Set to true if the response should only list VIPs extra_headers: Send extra headers @@ -451,15 +394,6 @@ def delete( Delete reserved fixed ip Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}']['delete'].parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -499,15 +433,6 @@ def get( Get reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].get.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -575,20 +500,11 @@ async def create( Create reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" + type: Must be 'external' - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - type: '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.type" - - ip_family: '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/ip_family/anyOf/0' - "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.ip_family.anyOf[0]" - - is_vip: '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/is_vip' - "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.is_vip" + is_vip: If reserved fixed IP is a VIP extra_headers: Send extra headers @@ -620,20 +536,11 @@ async def create( Create reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + subnet_id: Reserved fixed IP will be allocated in this subnet - subnet_id: '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/subnet_id' - "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.subnet_id" + type: Must be 'subnet'. - type: '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.type" - - is_vip: '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/is_vip' - "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.is_vip" + is_vip: If reserved fixed IP is a VIP extra_headers: Send extra headers @@ -666,23 +573,13 @@ async def create( Create reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + network_id: Reserved fixed IP will be allocated in a subnet of this network - network_id: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/network_id' - "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.network_id" + type: Must be 'any_subnet'. - type: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.type" + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - ip_family: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/ip_family/anyOf/0' - "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.ip_family.anyOf[0]" - - is_vip: '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/is_vip' - "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.is_vip" + is_vip: If reserved fixed IP is a VIP extra_headers: Send extra headers @@ -715,23 +612,13 @@ async def create( Create reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + ip_address: Reserved fixed IP will be allocated the given IP address - ip_address: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/ip_address' - "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.ip_address" + network_id: Reserved fixed IP will be allocated in a subnet of this network - network_id: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/network_id' - "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.network_id" + type: Must be 'ip_address'. - type: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.type" - - is_vip: '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/is_vip' - "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.is_vip" + is_vip: If reserved fixed IP is a VIP extra_headers: Send extra headers @@ -762,17 +649,10 @@ async def create( Create reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" + port_id: Port ID to make a reserved fixed IP (for example, `vip_port_id` of the Load + Balancer entity). - port_id: '#/components/schemas/NewReservedFixedIpSpecificPortSerializer/properties/port_id' - "$.components.schemas.NewReservedFixedIpSpecificPortSerializer.properties.port_id" - - type: '#/components/schemas/NewReservedFixedIpSpecificPortSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpSpecificPortSerializer.properties.type" + type: Must be 'port'. extra_headers: Send extra headers @@ -859,38 +739,26 @@ def list( List reserved fixed IPs Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[1].schema" - - available_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[2]" + available_only: Set to true if the response should only list IP addresses that are not attached + to any instance - device_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[3]" + device_id: Filter IPs by device ID it is attached to - external_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[4]" + external_only: Set to true if the response should only list public IP addresses - internal_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[5]" + internal_only: Set to true if the response should only list private IP addresses - ip_address: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[6]" + ip_address: An IPv4 address to filter results by. Regular expression allowed - limit: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[7]" + limit: Limit the number of returned IPs - offset: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[8]" + offset: Offset value is used to exclude the first set of records from the result - order_by: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[9]" + order_by: Ordering reserved fixed IP list result by name, status, updated_at, created_at + or fixed_ip_address fields of the reserved fixed IP and directions (status.asc), + default is "fixed_ip_address.asc" - vip_only: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[10]" + vip_only: Set to true if the response should only list VIPs extra_headers: Send extra headers @@ -947,15 +815,6 @@ async def delete( Delete reserved fixed ip Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}']['delete'].parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -995,15 +854,6 @@ async def get( Get reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].get.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index abd1c487..7f66a11e 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -66,15 +66,6 @@ def list_candidate_ports( List instance ports that are available for connecting to VIP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Favailable_devices/get/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Favailable_devices/get/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices'].get.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Favailable_devices/get/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -114,15 +105,6 @@ def list_connected_ports( List instance ports that share VIP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/get/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/get/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].get.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/get/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -163,17 +145,7 @@ def replace_connected_ports( Replace ports that share VIP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[2].schema" - - port_ids: '#/components/schemas/PortIDsForVIPSerializer/properties/port_ids' - "$.components.schemas.PortIDsForVIPSerializer.properties.port_ids" + port_ids: List of port IDs that will share one VIP extra_headers: Send extra headers @@ -218,17 +190,7 @@ def toggle( Switch VIP status of reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[2].schema" - - is_vip: '#/components/schemas/PatchReservedFixedIPSerializer/properties/is_vip' - "$.components.schemas.PatchReservedFixedIPSerializer.properties.is_vip" + is_vip: If reserved fixed IP should be a VIP extra_headers: Send extra headers @@ -271,17 +233,7 @@ def update_connected_ports( Add ports that share VIP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[2].schema" - - port_ids: '#/components/schemas/PortIDsForVIPSerializer/properties/port_ids' - "$.components.schemas.PortIDsForVIPSerializer.properties.port_ids" + port_ids: List of port IDs that will share one VIP extra_headers: Send extra headers @@ -346,15 +298,6 @@ async def list_candidate_ports( List instance ports that are available for connecting to VIP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Favailable_devices/get/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Favailable_devices/get/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices'].get.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Favailable_devices/get/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -394,15 +337,6 @@ async def list_connected_ports( List instance ports that share VIP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/get/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/get/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].get.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/get/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -443,17 +377,7 @@ async def replace_connected_ports( Replace ports that share VIP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[2].schema" - - port_ids: '#/components/schemas/PortIDsForVIPSerializer/properties/port_ids' - "$.components.schemas.PortIDsForVIPSerializer.properties.port_ids" + port_ids: List of port IDs that will share one VIP extra_headers: Send extra headers @@ -498,17 +422,7 @@ async def toggle( Switch VIP status of reserved fixed IP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[2].schema" - - is_vip: '#/components/schemas/PatchReservedFixedIPSerializer/properties/is_vip' - "$.components.schemas.PatchReservedFixedIPSerializer.properties.is_vip" + is_vip: If reserved fixed IP should be a VIP extra_headers: Send extra headers @@ -551,17 +465,7 @@ async def update_connected_ports( Add ports that share VIP Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[1].schema" - - port_id: '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/2/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[2].schema" - - port_ids: '#/components/schemas/PortIDsForVIPSerializer/properties/port_ids' - "$.components.schemas.PortIDsForVIPSerializer.properties.port_ids" + port_ids: List of port IDs that will share one VIP extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 7d8318c1..c7e350c2 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -68,42 +68,41 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Create secret + """Create secret Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].post.parameters[0].schema" + name: Secret name - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].post.parameters[1].schema" + payload: Secret payload. - name: '#/components/schemas/CreateSecretSerializer/properties/name' - "$.components.schemas.CreateSecretSerializer.properties.name" + For HTTPS-terminated load balancing, provide base64 encoded + conents of a PKCS12 file. The PKCS12 file is the combined TLS certificate, key, + and intermediate certificate chain obtained from an external certificate + authority. The file can be created via openssl, e.g.'openssl pkcs12 -export + -inkey server.key -in server.crt -certfile ca-chain.crt -passout pass: -out + server.p12'The key and certificate should be PEM-encoded, and the intermediate + certificate chain should be multiple PEM-encoded certs concatenated together - payload: '#/components/schemas/CreateSecretSerializer/properties/payload' - "$.components.schemas.CreateSecretSerializer.properties.payload" + payload_content_encoding: The encoding used for the payload to be able to include it in the JSON request. + Currently only base64 is supported - payload_content_encoding: '#/components/schemas/CreateSecretSerializer/properties/payload_content_encoding' - "$.components.schemas.CreateSecretSerializer.properties.payload_content_encoding" + payload_content_type: The media type for the content of the payload - payload_content_type: '#/components/schemas/CreateSecretSerializer/properties/payload_content_type' - "$.components.schemas.CreateSecretSerializer.properties.payload_content_type" + secret_type: Secret type. symmetric - Used for storing byte arrays such as keys suitable for + symmetric encryption; public - Used for storing the public key of an asymmetric + keypair; private - Used for storing the private key of an asymmetric keypair; + passphrase - Used for storing plain text passphrases; certificate - Used for + storing cryptographic certificates such as X.509 certificates; opaque - Used for + backwards compatibility with previous versions of the API - secret_type: '#/components/schemas/CreateSecretSerializer/properties/secret_type' - "$.components.schemas.CreateSecretSerializer.properties.secret_type" + algorithm: Metadata provided by a user or system for informational purposes. - algorithm: '#/components/schemas/CreateSecretSerializer/properties/algorithm/anyOf/0' - "$.components.schemas.CreateSecretSerializer.properties.algorithm.anyOf[0]" + bit_length: Metadata provided by a user or system for informational purposes. Value must be + greater than zero. - bit_length: '#/components/schemas/CreateSecretSerializer/properties/bit_length/anyOf/0' - "$.components.schemas.CreateSecretSerializer.properties.bit_length.anyOf[0]" + expiration: Datetime when the secret will expire. - expiration: '#/components/schemas/CreateSecretSerializer/properties/expiration/anyOf/0' - "$.components.schemas.CreateSecretSerializer.properties.expiration.anyOf[0]" - - mode: '#/components/schemas/CreateSecretSerializer/properties/mode/anyOf/0' - "$.components.schemas.CreateSecretSerializer.properties.mode.anyOf[0]" + mode: Metadata provided by a user or system for informational purposes. extra_headers: Send extra headers @@ -155,12 +154,6 @@ def list( List secrets Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].get.parameters[1].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -198,15 +191,6 @@ def delete( Delete secret Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}']['delete'].parameters[1].schema" - - secret_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -246,15 +230,6 @@ def get( Get secret Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}'].get.parameters[1].schema" - - secret_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -296,20 +271,11 @@ def upload_tls_certificate( Create secret Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v2/secrets/{project_id}/{region_id}'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v2/secrets/{project_id}/{region_id}'].post.parameters[1].schema" - - name: '#/components/schemas/CreateSecretSerializerV2/properties/name' - "$.components.schemas.CreateSecretSerializerV2.properties.name" + name: Secret name - payload: '#/components/schemas/CreateSecretSerializerV2/properties/payload' - "$.components.schemas.CreateSecretSerializerV2.properties.payload" + payload: Secret payload. - expiration: '#/components/schemas/CreateSecretSerializerV2/properties/expiration/anyOf/0' - "$.components.schemas.CreateSecretSerializerV2.properties.expiration.anyOf[0]" + expiration: Datetime when the secret will expire. Defaults to None extra_headers: Send extra headers @@ -381,42 +347,41 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Create secret + """Create secret Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].post.parameters[0].schema" + name: Secret name - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].post.parameters[1].schema" + payload: Secret payload. - name: '#/components/schemas/CreateSecretSerializer/properties/name' - "$.components.schemas.CreateSecretSerializer.properties.name" + For HTTPS-terminated load balancing, provide base64 encoded + conents of a PKCS12 file. The PKCS12 file is the combined TLS certificate, key, + and intermediate certificate chain obtained from an external certificate + authority. The file can be created via openssl, e.g.'openssl pkcs12 -export + -inkey server.key -in server.crt -certfile ca-chain.crt -passout pass: -out + server.p12'The key and certificate should be PEM-encoded, and the intermediate + certificate chain should be multiple PEM-encoded certs concatenated together - payload: '#/components/schemas/CreateSecretSerializer/properties/payload' - "$.components.schemas.CreateSecretSerializer.properties.payload" + payload_content_encoding: The encoding used for the payload to be able to include it in the JSON request. + Currently only base64 is supported - payload_content_encoding: '#/components/schemas/CreateSecretSerializer/properties/payload_content_encoding' - "$.components.schemas.CreateSecretSerializer.properties.payload_content_encoding" + payload_content_type: The media type for the content of the payload - payload_content_type: '#/components/schemas/CreateSecretSerializer/properties/payload_content_type' - "$.components.schemas.CreateSecretSerializer.properties.payload_content_type" + secret_type: Secret type. symmetric - Used for storing byte arrays such as keys suitable for + symmetric encryption; public - Used for storing the public key of an asymmetric + keypair; private - Used for storing the private key of an asymmetric keypair; + passphrase - Used for storing plain text passphrases; certificate - Used for + storing cryptographic certificates such as X.509 certificates; opaque - Used for + backwards compatibility with previous versions of the API - secret_type: '#/components/schemas/CreateSecretSerializer/properties/secret_type' - "$.components.schemas.CreateSecretSerializer.properties.secret_type" + algorithm: Metadata provided by a user or system for informational purposes. - algorithm: '#/components/schemas/CreateSecretSerializer/properties/algorithm/anyOf/0' - "$.components.schemas.CreateSecretSerializer.properties.algorithm.anyOf[0]" + bit_length: Metadata provided by a user or system for informational purposes. Value must be + greater than zero. - bit_length: '#/components/schemas/CreateSecretSerializer/properties/bit_length/anyOf/0' - "$.components.schemas.CreateSecretSerializer.properties.bit_length.anyOf[0]" + expiration: Datetime when the secret will expire. - expiration: '#/components/schemas/CreateSecretSerializer/properties/expiration/anyOf/0' - "$.components.schemas.CreateSecretSerializer.properties.expiration.anyOf[0]" - - mode: '#/components/schemas/CreateSecretSerializer/properties/mode/anyOf/0' - "$.components.schemas.CreateSecretSerializer.properties.mode.anyOf[0]" + mode: Metadata provided by a user or system for informational purposes. extra_headers: Send extra headers @@ -468,12 +433,6 @@ async def list( List secrets Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].get.parameters[1].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -511,15 +470,6 @@ async def delete( Delete secret Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}']['delete'].parameters[1].schema" - - secret_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -559,15 +509,6 @@ async def get( Get secret Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}'].get.parameters[1].schema" - - secret_id: '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsecret_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -609,20 +550,11 @@ async def upload_tls_certificate( Create secret Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v2/secrets/{project_id}/{region_id}'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv2%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v2/secrets/{project_id}/{region_id}'].post.parameters[1].schema" - - name: '#/components/schemas/CreateSecretSerializerV2/properties/name' - "$.components.schemas.CreateSecretSerializerV2.properties.name" + name: Secret name - payload: '#/components/schemas/CreateSecretSerializerV2/properties/payload' - "$.components.schemas.CreateSecretSerializerV2.properties.payload" + payload: Secret payload. - expiration: '#/components/schemas/CreateSecretSerializerV2/properties/expiration/anyOf/0' - "$.components.schemas.CreateSecretSerializerV2.properties.expiration.anyOf[0]" + expiration: Datetime when the secret will expire. Defaults to None extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index def90622..0cf89d57 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -95,38 +95,21 @@ def create( Add new rule to security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[0].schema" + description: Rule description - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[1].schema" + direction: Ingress or egress, which is the direction in which the security group is applied - group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/2/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[2].schema" + ethertype: Ether type - description: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/description' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.description" + port_range_max: The maximum port number in the range that is matched by the security group rule - direction: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/direction' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.direction" + port_range_min: The minimum port number in the range that is matched by the security group rule - ethertype: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/ethertype' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.ethertype" + protocol: Protocol - port_range_max: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" + remote_group_id: The remote group UUID to associate with this security group - port_range_min: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" - - protocol: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/protocol' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.protocol" - - remote_group_id: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_group_id' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_group_id" - - remote_ip_prefix: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + remote_ip_prefix: The remote IP prefix that is matched by this security group rule extra_headers: Send extra headers @@ -180,15 +163,6 @@ def delete( Delete security group rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}']['delete'].parameters[1].schema" - - rule_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -264,41 +238,25 @@ def replace( Edit the security group rule: delete old and create new rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/0/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/1/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[1].schema" - - rule_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/2/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[2].schema" - - direction: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/direction' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.direction" + direction: Ingress or egress, which is the direction in which the security group rule is + applied - security_group_id: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/security_group_id' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.security_group_id" + security_group_id: Parent security group of this rule - description: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/description' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.description" + description: Rule description - ethertype: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/ethertype/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.ethertype.anyOf[0]" + ethertype: Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress + or egress rules. - port_range_max: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" + port_range_max: The maximum port number in the range that is matched by the security group rule - port_range_min: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" + port_range_min: The minimum port number in the range that is matched by the security group rule - protocol: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/protocol' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.protocol" + protocol: Protocol - remote_group_id: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/remote_group_id/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.remote_group_id.anyOf[0]" + remote_group_id: The remote group UUID to associate with this security group rule - remote_ip_prefix: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + remote_ip_prefix: The remote IP prefix that is matched by this security group rule extra_headers: Send extra headers @@ -408,38 +366,21 @@ async def create( Add new rule to security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[0].schema" + description: Rule description - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[1].schema" + direction: Ingress or egress, which is the direction in which the security group is applied - group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/2/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[2].schema" + ethertype: Ether type - description: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/description' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.description" + port_range_max: The maximum port number in the range that is matched by the security group rule - direction: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/direction' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.direction" + port_range_min: The minimum port number in the range that is matched by the security group rule - ethertype: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/ethertype' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.ethertype" + protocol: Protocol - port_range_max: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" + remote_group_id: The remote group UUID to associate with this security group - port_range_min: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" - - protocol: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/protocol' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.protocol" - - remote_group_id: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_group_id' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_group_id" - - remote_ip_prefix: '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + remote_ip_prefix: The remote IP prefix that is matched by this security group rule extra_headers: Send extra headers @@ -493,15 +434,6 @@ async def delete( Delete security group rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}']['delete'].parameters[1].schema" - - rule_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -577,41 +509,25 @@ async def replace( Edit the security group rule: delete old and create new rule Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/0/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/1/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[1].schema" - - rule_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/2/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[2].schema" - - direction: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/direction' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.direction" + direction: Ingress or egress, which is the direction in which the security group rule is + applied - security_group_id: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/security_group_id' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.security_group_id" + security_group_id: Parent security group of this rule - description: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/description' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.description" + description: Rule description - ethertype: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/ethertype/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.ethertype.anyOf[0]" + ethertype: Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress + or egress rules. - port_range_max: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" + port_range_max: The maximum port number in the range that is matched by the security group rule - port_range_min: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" + port_range_min: The minimum port number in the range that is matched by the security group rule - protocol: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/protocol' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.protocol" + protocol: Protocol - remote_group_id: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/remote_group_id/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.remote_group_id.anyOf[0]" + remote_group_id: The remote group UUID to associate with this security group rule - remote_ip_prefix: '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" + remote_ip_prefix: The remote IP prefix that is matched by this security group rule extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 57bfacfa..53b63372 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -79,17 +79,9 @@ def create( Create security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].post.parameters[0].schema" + security_group: Security group - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].post.parameters[1].schema" - - security_group: '#/components/schemas/CreateSecurityGroupSerializer/properties/security_group' - "$.components.schemas.CreateSecurityGroupSerializer.properties.security_group" - - instances: '#/components/schemas/CreateSecurityGroupSerializer/properties/instances' - "$.components.schemas.CreateSecurityGroupSerializer.properties.instances" + instances: List of instances extra_headers: Send extra headers @@ -137,20 +129,9 @@ def update( Change security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[2].schema" - - changed_rules: '#/components/schemas/UpdateSecurityGroupSerializer/properties/changed_rules' - "$.components.schemas.UpdateSecurityGroupSerializer.properties.changed_rules" + changed_rules: List of rules to create or delete - name: '#/components/schemas/UpdateSecurityGroupSerializer/properties/name' - "$.components.schemas.UpdateSecurityGroupSerializer.properties.name" + name: Name extra_headers: Send extra headers @@ -201,23 +182,15 @@ def list( Get security groups Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[0].schema" + limit: Limit the number of returned limit request entities. - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[1].schema" + offset: Offset value is used to exclude the first set of records from the result. - limit: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[2]" + tag_key: Filter by tag keys. - offset: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[3]" - - tag_key: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[4]" - - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[5]" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G + --data-urlencode "tag_key_value={"key": "value"}" --url + "http://localhost:1111/v1/securitygroups/1/1" extra_headers: Send extra headers @@ -269,15 +242,6 @@ def delete( Delete security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -319,17 +283,7 @@ def copy( Create a deep copy of security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/2/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[2].schema" - - name: '#/components/schemas/NameSerializerPydantic/properties/name' - "$.components.schemas.NameSerializerPydantic.properties.name" + name: Name. extra_headers: Send extra headers @@ -372,15 +326,6 @@ def get( Get security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].get.parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -420,15 +365,6 @@ def revert_to_default( Revert security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frevert/post/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frevert/post/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert'].post.parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frevert/post/parameters/2/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -494,17 +430,9 @@ async def create( Create security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].post.parameters[0].schema" + security_group: Security group - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].post.parameters[1].schema" - - security_group: '#/components/schemas/CreateSecurityGroupSerializer/properties/security_group' - "$.components.schemas.CreateSecurityGroupSerializer.properties.security_group" - - instances: '#/components/schemas/CreateSecurityGroupSerializer/properties/instances' - "$.components.schemas.CreateSecurityGroupSerializer.properties.instances" + instances: List of instances extra_headers: Send extra headers @@ -552,20 +480,9 @@ async def update( Change security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[2].schema" - - changed_rules: '#/components/schemas/UpdateSecurityGroupSerializer/properties/changed_rules' - "$.components.schemas.UpdateSecurityGroupSerializer.properties.changed_rules" + changed_rules: List of rules to create or delete - name: '#/components/schemas/UpdateSecurityGroupSerializer/properties/name' - "$.components.schemas.UpdateSecurityGroupSerializer.properties.name" + name: Name extra_headers: Send extra headers @@ -616,23 +533,15 @@ def list( Get security groups Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[0].schema" + limit: Limit the number of returned limit request entities. - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[1].schema" + offset: Offset value is used to exclude the first set of records from the result. - limit: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[2]" + tag_key: Filter by tag keys. - offset: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[3]" - - tag_key: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[4]" - - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[5]" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G + --data-urlencode "tag_key_value={"key": "value"}" --url + "http://localhost:1111/v1/securitygroups/1/1" extra_headers: Send extra headers @@ -684,15 +593,6 @@ async def delete( Delete security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}']['delete'].parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -734,17 +634,7 @@ async def copy( Create a deep copy of security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/2/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[2].schema" - - name: '#/components/schemas/NameSerializerPydantic/properties/name' - "$.components.schemas.NameSerializerPydantic.properties.name" + name: Name. extra_headers: Send extra headers @@ -787,15 +677,6 @@ async def get( Get security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].get.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].get.parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].get.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -835,15 +716,6 @@ async def revert_to_default( Revert security group Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frevert/post/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert'].post.parameters[0].schema" - - region_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frevert/post/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert'].post.parameters[1].schema" - - group_id: '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frevert/post/parameters/2/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert'].post.parameters[2].schema" - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 44b1f8c8..a7437398 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -63,17 +63,21 @@ def create( To generate a key, omit the public_key parameter from the request body Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].post.parameters[0].schema" + project_id: Project ID - name: '#/components/schemas/CreateSSHKeySerializer/properties/name' - "$.components.schemas.CreateSSHKeySerializer.properties.name" + name: SSH key name - public_key: '#/components/schemas/CreateSSHKeySerializer/properties/public_key' - "$.components.schemas.CreateSSHKeySerializer.properties.public_key" + public_key: The public part of an SSH key is the shareable portion of an SSH key pair. It + can be safely sent to servers or services to grant access. It does not contain + sensitive information. - shared_in_project: '#/components/schemas/CreateSSHKeySerializer/properties/shared_in_project' - "$.components.schemas.CreateSSHKeySerializer.properties.shared_in_project" + - If you’re uploading your own key, provide the public part here (usually found + in a file like `id_ed25519.pub`). + - If you want the platform to generate an Ed25519 key pair for you, leave this + field empty — the system will return the private key in the response **once + only**. + + shared_in_project: SSH key is shared with all users in the project extra_headers: Send extra headers @@ -118,14 +122,11 @@ def update( Share or unshare SSH key with users Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].patch.parameters[0].schema" + project_id: Project ID - ssh_key_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].patch.parameters[1].schema" + ssh_key_id: SSH key ID - shared_in_project: '#/components/schemas/ShareSSHKeySerializer/properties/shared_in_project' - "$.components.schemas.ShareSSHKeySerializer.properties.shared_in_project" + shared_in_project: Share your ssh key with all users in the project extra_headers: Send extra headers @@ -166,17 +167,13 @@ def list( List SSH keys Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[0].schema" + project_id: Project ID - limit: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/1' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[1]" + limit: Maximum number of SSH keys to return - offset: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/2' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[2]" + offset: Offset for pagination - order_by: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/3' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[3]" + order_by: Sort order for the SSH keys extra_headers: Send extra headers @@ -224,11 +221,9 @@ def delete( Delete SSH key Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}']['delete'].parameters[0].schema" + project_id: Project ID - ssh_key_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}']['delete'].parameters[1].schema" + ssh_key_id: SSH key ID extra_headers: Send extra headers @@ -267,11 +262,9 @@ def get( Get SSH key Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].get.parameters[0].schema" + project_id: Project ID - ssh_key_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].get.parameters[1].schema" + ssh_key_id: SSH key ID extra_headers: Send extra headers @@ -332,17 +325,21 @@ async def create( To generate a key, omit the public_key parameter from the request body Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].post.parameters[0].schema" + project_id: Project ID + + name: SSH key name - name: '#/components/schemas/CreateSSHKeySerializer/properties/name' - "$.components.schemas.CreateSSHKeySerializer.properties.name" + public_key: The public part of an SSH key is the shareable portion of an SSH key pair. It + can be safely sent to servers or services to grant access. It does not contain + sensitive information. - public_key: '#/components/schemas/CreateSSHKeySerializer/properties/public_key' - "$.components.schemas.CreateSSHKeySerializer.properties.public_key" + - If you’re uploading your own key, provide the public part here (usually found + in a file like `id_ed25519.pub`). + - If you want the platform to generate an Ed25519 key pair for you, leave this + field empty — the system will return the private key in the response **once + only**. - shared_in_project: '#/components/schemas/CreateSSHKeySerializer/properties/shared_in_project' - "$.components.schemas.CreateSSHKeySerializer.properties.shared_in_project" + shared_in_project: SSH key is shared with all users in the project extra_headers: Send extra headers @@ -387,14 +384,11 @@ async def update( Share or unshare SSH key with users Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].patch.parameters[0].schema" + project_id: Project ID - ssh_key_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].patch.parameters[1].schema" + ssh_key_id: SSH key ID - shared_in_project: '#/components/schemas/ShareSSHKeySerializer/properties/shared_in_project' - "$.components.schemas.ShareSSHKeySerializer.properties.shared_in_project" + shared_in_project: Share your ssh key with all users in the project extra_headers: Send extra headers @@ -437,17 +431,13 @@ def list( List SSH keys Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[0].schema" + project_id: Project ID - limit: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/1' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[1]" + limit: Maximum number of SSH keys to return - offset: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/2' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[2]" + offset: Offset for pagination - order_by: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/3' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[3]" + order_by: Sort order for the SSH keys extra_headers: Send extra headers @@ -495,11 +485,9 @@ async def delete( Delete SSH key Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}']['delete'].parameters[0].schema" + project_id: Project ID - ssh_key_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}']['delete'].parameters[1].schema" + ssh_key_id: SSH key ID extra_headers: Send extra headers @@ -538,11 +526,9 @@ async def get( Get SSH key Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].get.parameters[0].schema" + project_id: Project ID - ssh_key_id: '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].get.parameters[1].schema" + ssh_key_id: SSH key ID extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 48e802d1..379ea8da 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -66,39 +66,77 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[Task]: - """ - List tasks + """List tasks Args: - from_timestamp: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/0/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[0].schema.anyOf[0]" - - is_acknowledged: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/1/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[1].schema.anyOf[0]" - - limit: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/2' - "$.paths['/cloud/v1/tasks'].get.parameters[2]" - - offset: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/3' - "$.paths['/cloud/v1/tasks'].get.parameters[3]" - - project_id: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/4/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[4].schema.anyOf[0]" - - region_id: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/5/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[5].schema.anyOf[0]" - - sorting: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/6/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[6].schema.anyOf[0]" - - state: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/7/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[7].schema.anyOf[0]" - - task_type: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/8/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[8].schema.anyOf[0]" - - to_timestamp: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/9/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[9].schema.anyOf[0]" + from_timestamp: ISO formatted datetime string. + + Filter the tasks by creation date greater than or + equal to from_timestamp + + is_acknowledged: Filter the tasks by their acknowledgement status + + limit: Limit the number of returned tasks. Falls back to default of 10 if not + specified. Limited by max limit value of 1000 + + offset: Offset value is used to exclude the first set of records from the result + + project_id: The project ID to filter the tasks by project. Supports multiple values of kind + key=value1&key=value2 + + region_id: The region ID to filter the tasks by region. Supports multiple values of kind + key=value1&key=value2 + + sorting: Sorting by creation date. Oldest first, or most recent first + + state: Filter the tasks by state. Supports multiple values of kind + key=value1&key=value2 + + task_type: Filter the tasks by their type one of ['activate_ddos_profile', + 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', + 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', + 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', + 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', + 'create_fip', 'create_gpu_virtual_cluster', 'create_image', + 'create_inference_instance', 'create_inference_instance_key', + 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', + 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', + 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', + 'create_reserved_fixed_ip', 'create_router', 'create_secret', + 'create_servergroup', 'create_sfs', 'create_snapshot', 'create_subnet', + 'create_vm', 'create_volume', 'deactivate_ddos_profile', + 'delete_ai_cluster_gpu', 'delete_caas_container', + 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', + 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', + 'delete_gpu_virtual_server', 'delete_image', 'delete_inference_instance', + 'delete_k8s_cluster_pool_v2', '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', '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', 'replace_lbmetadata', 'resize_k8s_cluster_v2', + 'resize_loadbalancer', 'resize_vm', 'resume_vm', 'revert_volume', + 'soft_reboot_gpu_baremetal_server', 'soft_reboot_gpu_virtual_cluster', + 'soft_reboot_gpu_virtual_server', 'soft_reboot_vm', + 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', + 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', + 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', + 'sync_private_flavors', 'update_ddos_profile', 'update_inference_instance', + 'update_inference_instance_key', 'update_k8s_cluster_v2', 'update_lbmetadata', + 'update_port_allowed_address_pairs', 'update_tags_gpu_virtual_cluster', + 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu', + 'upscale_gpu_virtual_cluster'] + + to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or + equal to to_timestamp extra_headers: Send extra headers @@ -151,11 +189,9 @@ def acknowledge_all( Acknowledge all client tasks in project or region Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2Facknowledge_all/post/parameters/0/schema/anyOf/0' - "$.paths['/cloud/v1/tasks/acknowledge_all'].post.parameters[0].schema.anyOf[0]" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2Facknowledge_all/post/parameters/1/schema/anyOf/0' - "$.paths['/cloud/v1/tasks/acknowledge_all'].post.parameters[1].schema.anyOf[0]" + region_id: Region ID extra_headers: Send extra headers @@ -199,8 +235,7 @@ def acknowledge_one( Acknowledge one task on project scope Args: - task_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2F%7Btask_id%7D%2Facknowledge/post/parameters/0/schema' - "$.paths['/cloud/v1/tasks/{task_id}/acknowledge'].post.parameters[0].schema" + task_id: Task ID extra_headers: Send extra headers @@ -235,8 +270,7 @@ def get( Get task Args: - task_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2F%7Btask_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/tasks/{task_id}'].get.parameters[0].schema" + task_id: Task ID extra_headers: Send extra headers @@ -297,39 +331,77 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Task, AsyncOffsetPage[Task]]: - """ - List tasks + """List tasks Args: - from_timestamp: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/0/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[0].schema.anyOf[0]" - - is_acknowledged: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/1/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[1].schema.anyOf[0]" - - limit: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/2' - "$.paths['/cloud/v1/tasks'].get.parameters[2]" - - offset: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/3' - "$.paths['/cloud/v1/tasks'].get.parameters[3]" - - project_id: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/4/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[4].schema.anyOf[0]" - - region_id: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/5/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[5].schema.anyOf[0]" - - sorting: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/6/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[6].schema.anyOf[0]" - - state: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/7/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[7].schema.anyOf[0]" - - task_type: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/8/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[8].schema.anyOf[0]" - - to_timestamp: '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/9/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[9].schema.anyOf[0]" + from_timestamp: ISO formatted datetime string. + + Filter the tasks by creation date greater than or + equal to from_timestamp + + is_acknowledged: Filter the tasks by their acknowledgement status + + limit: Limit the number of returned tasks. Falls back to default of 10 if not + specified. Limited by max limit value of 1000 + + offset: Offset value is used to exclude the first set of records from the result + + project_id: The project ID to filter the tasks by project. Supports multiple values of kind + key=value1&key=value2 + + region_id: The region ID to filter the tasks by region. Supports multiple values of kind + key=value1&key=value2 + + sorting: Sorting by creation date. Oldest first, or most recent first + + state: Filter the tasks by state. Supports multiple values of kind + key=value1&key=value2 + + task_type: Filter the tasks by their type one of ['activate_ddos_profile', + 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', + 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', + 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', + 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', + 'create_fip', 'create_gpu_virtual_cluster', 'create_image', + 'create_inference_instance', 'create_inference_instance_key', + 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', + 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', + 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', + 'create_reserved_fixed_ip', 'create_router', 'create_secret', + 'create_servergroup', 'create_sfs', 'create_snapshot', 'create_subnet', + 'create_vm', 'create_volume', 'deactivate_ddos_profile', + 'delete_ai_cluster_gpu', 'delete_caas_container', + 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', + 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', + 'delete_gpu_virtual_server', 'delete_image', 'delete_inference_instance', + 'delete_k8s_cluster_pool_v2', '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', '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', 'replace_lbmetadata', 'resize_k8s_cluster_v2', + 'resize_loadbalancer', 'resize_vm', 'resume_vm', 'revert_volume', + 'soft_reboot_gpu_baremetal_server', 'soft_reboot_gpu_virtual_cluster', + 'soft_reboot_gpu_virtual_server', 'soft_reboot_vm', + 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', + 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', + 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', + 'sync_private_flavors', 'update_ddos_profile', 'update_inference_instance', + 'update_inference_instance_key', 'update_k8s_cluster_v2', 'update_lbmetadata', + 'update_port_allowed_address_pairs', 'update_tags_gpu_virtual_cluster', + 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu', + 'upscale_gpu_virtual_cluster'] + + to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or + equal to to_timestamp extra_headers: Send extra headers @@ -382,11 +454,9 @@ async def acknowledge_all( Acknowledge all client tasks in project or region Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2Facknowledge_all/post/parameters/0/schema/anyOf/0' - "$.paths['/cloud/v1/tasks/acknowledge_all'].post.parameters[0].schema.anyOf[0]" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2Facknowledge_all/post/parameters/1/schema/anyOf/0' - "$.paths['/cloud/v1/tasks/acknowledge_all'].post.parameters[1].schema.anyOf[0]" + region_id: Region ID extra_headers: Send extra headers @@ -430,8 +500,7 @@ async def acknowledge_one( Acknowledge one task on project scope Args: - task_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2F%7Btask_id%7D%2Facknowledge/post/parameters/0/schema' - "$.paths['/cloud/v1/tasks/{task_id}/acknowledge'].post.parameters[0].schema" + task_id: Task ID extra_headers: Send extra headers @@ -466,8 +535,7 @@ async def get( Get task Args: - task_id: '#/paths/%2Fcloud%2Fv1%2Ftasks%2F%7Btask_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/tasks/{task_id}'].get.parameters[0].schema" + task_id: Task ID extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 6a57f48b..634cfdfc 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -67,17 +67,13 @@ def create( Assign role to existing user Args: - role: '#/components/schemas/RequestAssignmentSerializer/properties/role' - "$.components.schemas.RequestAssignmentSerializer.properties.role" + role: User role - user_id: '#/components/schemas/RequestAssignmentSerializer/properties/user_id' - "$.components.schemas.RequestAssignmentSerializer.properties.user_id" + user_id: User ID - client_id: '#/components/schemas/RequestAssignmentSerializer/properties/client_id/anyOf/0' - "$.components.schemas.RequestAssignmentSerializer.properties.client_id.anyOf[0]" + client_id: Client ID. Required if project_id is specified - project_id: '#/components/schemas/RequestAssignmentSerializer/properties/project_id/anyOf/0' - "$.components.schemas.RequestAssignmentSerializer.properties.project_id.anyOf[0]" + project_id: Project ID extra_headers: Send extra headers @@ -123,20 +119,15 @@ def update( Modify role assignment to existing user Args: - assignment_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments%2F%7Bassignment_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/users/assignments/{assignment_id}'].patch.parameters[0].schema" + assignment_id: Assignment ID - role: '#/components/schemas/RequestAssignmentSerializer/properties/role' - "$.components.schemas.RequestAssignmentSerializer.properties.role" + role: User role - user_id: '#/components/schemas/RequestAssignmentSerializer/properties/user_id' - "$.components.schemas.RequestAssignmentSerializer.properties.user_id" + user_id: User ID - client_id: '#/components/schemas/RequestAssignmentSerializer/properties/client_id/anyOf/0' - "$.components.schemas.RequestAssignmentSerializer.properties.client_id.anyOf[0]" + client_id: Client ID. Required if project_id is specified - project_id: '#/components/schemas/RequestAssignmentSerializer/properties/project_id/anyOf/0' - "$.components.schemas.RequestAssignmentSerializer.properties.project_id.anyOf[0]" + project_id: Project ID extra_headers: Send extra headers @@ -177,21 +168,19 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[RoleAssignment]: - """ - List assignments + """List assignments Args: - limit: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/0' - "$.paths['/cloud/v1/users/assignments'].get.parameters[0]" + limit: Limit the number of returned items. + + Falls back to default of 1000 if not + specified. Limited by max limit value of 1000 - offset: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/1' - "$.paths['/cloud/v1/users/assignments'].get.parameters[1]" + offset: Offset value is used to exclude the first set of records from the result - project_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/2' - "$.paths['/cloud/v1/users/assignments'].get.parameters[2]" + project_id: Project ID - user_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/3' - "$.paths['/cloud/v1/users/assignments'].get.parameters[3]" + user_id: User ID for filtering extra_headers: Send extra headers @@ -237,8 +226,7 @@ def delete( Delete role assignment Args: - assignment_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments%2F%7Bassignment_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/users/assignments/{assignment_id}']['delete'].parameters[0].schema" + assignment_id: Assignment ID extra_headers: Send extra headers @@ -295,17 +283,13 @@ async def create( Assign role to existing user Args: - role: '#/components/schemas/RequestAssignmentSerializer/properties/role' - "$.components.schemas.RequestAssignmentSerializer.properties.role" + role: User role - user_id: '#/components/schemas/RequestAssignmentSerializer/properties/user_id' - "$.components.schemas.RequestAssignmentSerializer.properties.user_id" + user_id: User ID - client_id: '#/components/schemas/RequestAssignmentSerializer/properties/client_id/anyOf/0' - "$.components.schemas.RequestAssignmentSerializer.properties.client_id.anyOf[0]" + client_id: Client ID. Required if project_id is specified - project_id: '#/components/schemas/RequestAssignmentSerializer/properties/project_id/anyOf/0' - "$.components.schemas.RequestAssignmentSerializer.properties.project_id.anyOf[0]" + project_id: Project ID extra_headers: Send extra headers @@ -351,20 +335,15 @@ async def update( Modify role assignment to existing user Args: - assignment_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments%2F%7Bassignment_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/users/assignments/{assignment_id}'].patch.parameters[0].schema" + assignment_id: Assignment ID - role: '#/components/schemas/RequestAssignmentSerializer/properties/role' - "$.components.schemas.RequestAssignmentSerializer.properties.role" + role: User role - user_id: '#/components/schemas/RequestAssignmentSerializer/properties/user_id' - "$.components.schemas.RequestAssignmentSerializer.properties.user_id" + user_id: User ID - client_id: '#/components/schemas/RequestAssignmentSerializer/properties/client_id/anyOf/0' - "$.components.schemas.RequestAssignmentSerializer.properties.client_id.anyOf[0]" + client_id: Client ID. Required if project_id is specified - project_id: '#/components/schemas/RequestAssignmentSerializer/properties/project_id/anyOf/0' - "$.components.schemas.RequestAssignmentSerializer.properties.project_id.anyOf[0]" + project_id: Project ID extra_headers: Send extra headers @@ -405,21 +384,19 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[RoleAssignment, AsyncOffsetPage[RoleAssignment]]: - """ - List assignments + """List assignments Args: - limit: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/0' - "$.paths['/cloud/v1/users/assignments'].get.parameters[0]" + limit: Limit the number of returned items. + + Falls back to default of 1000 if not + specified. Limited by max limit value of 1000 - offset: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/1' - "$.paths['/cloud/v1/users/assignments'].get.parameters[1]" + offset: Offset value is used to exclude the first set of records from the result - project_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/2' - "$.paths['/cloud/v1/users/assignments'].get.parameters[2]" + project_id: Project ID - user_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/3' - "$.paths['/cloud/v1/users/assignments'].get.parameters[3]" + user_id: User ID for filtering extra_headers: Send extra headers @@ -465,8 +442,7 @@ async def delete( Delete role assignment Args: - assignment_id: '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments%2F%7Bassignment_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/users/assignments/{assignment_id}']['delete'].parameters[0].schema" + assignment_id: Assignment ID extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 2c32c1b1..a228ccff 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -83,38 +83,34 @@ def create( Create volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - image_id: '#/components/schemas/CreateVolumeFromImageSerializer/properties/image_id' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.image_id" + image_id: Image ID - name: '#/components/schemas/CreateVolumeFromImageSerializer/properties/name' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.name" + name: Volume name - size: '#/components/schemas/CreateVolumeFromImageSerializer/properties/size' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.size" + size: Volume size in GiB - source: '#/components/schemas/CreateVolumeFromImageSerializer/properties/source' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.source" + source: Volume source type - attachment_tag: '#/components/schemas/CreateVolumeFromImageSerializer/properties/attachment_tag' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.attachment_tag" + attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in + conjunction with instance_id_to_attach_to - instance_id_to_attach_to: '#/components/schemas/CreateVolumeFromImageSerializer/properties/instance_id_to_attach_to' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.instance_id_to_attach_to" + instance_id_to_attach_to: instance_id to attach newly-created volume to - lifecycle_policy_ids: '#/components/schemas/CreateVolumeFromImageSerializer/properties/lifecycle_policy_ids' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.lifecycle_policy_ids" + lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the + volume - tags: '#/components/schemas/CreateVolumeFromImageSerializer/properties/tags' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - type_name: '#/components/schemas/CreateVolumeFromImageSerializer/properties/type_name' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.type_name" + type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`, + volume type will be derived from the snapshot volume. extra_headers: Send extra headers @@ -153,38 +149,35 @@ def create( Create volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - name: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/name' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.name" + name: Volume name - snapshot_id: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/snapshot_id' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.snapshot_id" + snapshot_id: Snapshot ID - source: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/source' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.source" + source: Volume source type - attachment_tag: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/attachment_tag' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.attachment_tag" + attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in + conjunction with instance_id_to_attach_to - instance_id_to_attach_to: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/instance_id_to_attach_to' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.instance_id_to_attach_to" + instance_id_to_attach_to: instance_id to attach newly-created volume to - lifecycle_policy_ids: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/lifecycle_policy_ids' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.lifecycle_policy_ids" + lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the + volume - size: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/size' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.size" + size: Volume size in GiB. If specified, value must be equal to respective snapshot + size - tags: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/tags' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - type_name: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/type_name' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.type_name" + type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`, + volume type will be derived from the snapshot volume. extra_headers: Send extra headers @@ -222,35 +215,32 @@ def create( Create volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - name: '#/components/schemas/CreateNewVolumeSerializer/properties/name' - "$.components.schemas.CreateNewVolumeSerializer.properties.name" + name: Volume name - size: '#/components/schemas/CreateNewVolumeSerializer/properties/size' - "$.components.schemas.CreateNewVolumeSerializer.properties.size" + size: Volume size in GiB - source: '#/components/schemas/CreateNewVolumeSerializer/properties/source' - "$.components.schemas.CreateNewVolumeSerializer.properties.source" + source: Volume source type - attachment_tag: '#/components/schemas/CreateNewVolumeSerializer/properties/attachment_tag' - "$.components.schemas.CreateNewVolumeSerializer.properties.attachment_tag" + attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in + conjunction with instance_id_to_attach_to - instance_id_to_attach_to: '#/components/schemas/CreateNewVolumeSerializer/properties/instance_id_to_attach_to' - "$.components.schemas.CreateNewVolumeSerializer.properties.instance_id_to_attach_to" + instance_id_to_attach_to: instance_id to attach newly-created volume to - lifecycle_policy_ids: '#/components/schemas/CreateNewVolumeSerializer/properties/lifecycle_policy_ids' - "$.components.schemas.CreateNewVolumeSerializer.properties.lifecycle_policy_ids" + lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the + volume - tags: '#/components/schemas/CreateNewVolumeSerializer/properties/tags' - "$.components.schemas.CreateNewVolumeSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - type_name: '#/components/schemas/CreateNewVolumeSerializer/properties/type_name' - "$.components.schemas.CreateNewVolumeSerializer.properties.type_name" + type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`, + volume type will be derived from the snapshot volume. extra_headers: Send extra headers @@ -333,17 +323,13 @@ def update( Rename volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[2].schema" + volume_id: Volume ID - name: '#/components/schemas/NameSerializer/properties/name' - "$.components.schemas.NameSerializer.properties.name" + name: Name. extra_headers: Send extra headers @@ -394,41 +380,33 @@ def list( List volumes Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID - bootable: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[2]" + bootable: Filter by bootable field - cluster_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[3]" + cluster_id: Filter volumes by k8s cluster ID - has_attachments: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[4]" + has_attachments: Filter by the presence of attachments - id_part: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[5]" + id_part: Filter the volume list result by the ID part of the volume - instance_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[6]" + instance_id: Filter volumes by instance ID - limit: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[7]" + limit: Optional. Limit the number of returned items - name_part: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[8]" + name_part: Filter volumes by name_part inclusion in volume name.Any substring can be used + and volumes will be returned with names containing the substring. - offset: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[9]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - tag_key: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[10]" + tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[11]" + tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode + "tag_key_value={"key": "value"}" --url + "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers @@ -487,17 +465,13 @@ def delete( Delete volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[2].schema" + volume_id: Volume ID - snapshots: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/3' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[3]" + snapshots: Comma separated list of snapshot IDs to be deleted with the volume. extra_headers: Send extra headers @@ -546,20 +520,15 @@ def attach_to_instance( instance with shared flavor Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/0/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/1/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/2/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[2].schema" + volume_id: Volume ID - instance_id: '#/components/schemas/AttachVolumeToInstanceSerializer/properties/instance_id' - "$.components.schemas.AttachVolumeToInstanceSerializer.properties.instance_id" + instance_id: Instance ID. - attachment_tag: '#/components/schemas/AttachVolumeToInstanceSerializer/properties/attachment_tag' - "$.components.schemas.AttachVolumeToInstanceSerializer.properties.attachment_tag" + attachment_tag: Block device attachment tag (not exposed in the normal tags). extra_headers: Send extra headers @@ -608,17 +577,13 @@ def change_type( Change volume type Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/2/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[2].schema" + volume_id: Volume ID - volume_type: '#/components/schemas/VolumeRetypeSerializer/properties/volume_type' - "$.components.schemas.VolumeRetypeSerializer.properties.volume_type" + volume_type: New volume type name extra_headers: Send extra headers @@ -661,17 +626,13 @@ def detach_from_instance( Detach the volume from instance Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/0/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/1/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/2/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[2].schema" + volume_id: Volume ID - instance_id: '#/components/schemas/InstanceIdSerializer/properties/instance_id' - "$.components.schemas.InstanceIdSerializer.properties.instance_id" + instance_id: Instance ID extra_headers: Send extra headers @@ -715,14 +676,11 @@ def get( Get volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].get.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].get.parameters[2].schema" + volume_id: Volume ID extra_headers: Send extra headers @@ -764,17 +722,13 @@ def resize( Extend volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/2/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[2].schema" + volume_id: Volume ID - size: '#/components/schemas/SizeSerializer/properties/size' - "$.components.schemas.SizeSerializer.properties.size" + size: New volume size in GiB extra_headers: Send extra headers @@ -816,14 +770,11 @@ def revert_to_last_snapshot( Revert volume to it's last snapshot Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Frevert/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Frevert/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert'].post.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Frevert/post/parameters/2/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert'].post.parameters[2].schema" + volume_id: Volume ID extra_headers: Send extra headers @@ -896,38 +847,34 @@ async def create( Create volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - image_id: '#/components/schemas/CreateVolumeFromImageSerializer/properties/image_id' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.image_id" + image_id: Image ID - name: '#/components/schemas/CreateVolumeFromImageSerializer/properties/name' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.name" + name: Volume name - size: '#/components/schemas/CreateVolumeFromImageSerializer/properties/size' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.size" + size: Volume size in GiB - source: '#/components/schemas/CreateVolumeFromImageSerializer/properties/source' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.source" + source: Volume source type - attachment_tag: '#/components/schemas/CreateVolumeFromImageSerializer/properties/attachment_tag' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.attachment_tag" + attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in + conjunction with instance_id_to_attach_to - instance_id_to_attach_to: '#/components/schemas/CreateVolumeFromImageSerializer/properties/instance_id_to_attach_to' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.instance_id_to_attach_to" + instance_id_to_attach_to: instance_id to attach newly-created volume to - lifecycle_policy_ids: '#/components/schemas/CreateVolumeFromImageSerializer/properties/lifecycle_policy_ids' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.lifecycle_policy_ids" + lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the + volume - tags: '#/components/schemas/CreateVolumeFromImageSerializer/properties/tags' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - type_name: '#/components/schemas/CreateVolumeFromImageSerializer/properties/type_name' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.type_name" + type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`, + volume type will be derived from the snapshot volume. extra_headers: Send extra headers @@ -966,38 +913,35 @@ async def create( Create volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - name: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/name' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.name" + name: Volume name - snapshot_id: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/snapshot_id' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.snapshot_id" + snapshot_id: Snapshot ID - source: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/source' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.source" + source: Volume source type - attachment_tag: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/attachment_tag' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.attachment_tag" + attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in + conjunction with instance_id_to_attach_to - instance_id_to_attach_to: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/instance_id_to_attach_to' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.instance_id_to_attach_to" + instance_id_to_attach_to: instance_id to attach newly-created volume to - lifecycle_policy_ids: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/lifecycle_policy_ids' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.lifecycle_policy_ids" + lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the + volume - size: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/size' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.size" + size: Volume size in GiB. If specified, value must be equal to respective snapshot + size - tags: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/tags' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - type_name: '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/type_name' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.type_name" + type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`, + volume type will be derived from the snapshot volume. extra_headers: Send extra headers @@ -1035,35 +979,32 @@ async def create( Create volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" + region_id: Region ID - name: '#/components/schemas/CreateNewVolumeSerializer/properties/name' - "$.components.schemas.CreateNewVolumeSerializer.properties.name" + name: Volume name - size: '#/components/schemas/CreateNewVolumeSerializer/properties/size' - "$.components.schemas.CreateNewVolumeSerializer.properties.size" + size: Volume size in GiB - source: '#/components/schemas/CreateNewVolumeSerializer/properties/source' - "$.components.schemas.CreateNewVolumeSerializer.properties.source" + source: Volume source type - attachment_tag: '#/components/schemas/CreateNewVolumeSerializer/properties/attachment_tag' - "$.components.schemas.CreateNewVolumeSerializer.properties.attachment_tag" + attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in + conjunction with instance_id_to_attach_to - instance_id_to_attach_to: '#/components/schemas/CreateNewVolumeSerializer/properties/instance_id_to_attach_to' - "$.components.schemas.CreateNewVolumeSerializer.properties.instance_id_to_attach_to" + instance_id_to_attach_to: instance_id to attach newly-created volume to - lifecycle_policy_ids: '#/components/schemas/CreateNewVolumeSerializer/properties/lifecycle_policy_ids' - "$.components.schemas.CreateNewVolumeSerializer.properties.lifecycle_policy_ids" + lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the + volume - tags: '#/components/schemas/CreateNewVolumeSerializer/properties/tags' - "$.components.schemas.CreateNewVolumeSerializer.properties.tags" + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. 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. - type_name: '#/components/schemas/CreateNewVolumeSerializer/properties/type_name' - "$.components.schemas.CreateNewVolumeSerializer.properties.type_name" + type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`, + volume type will be derived from the snapshot volume. extra_headers: Send extra headers @@ -1146,17 +1087,13 @@ async def update( Rename volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[2].schema" + volume_id: Volume ID - name: '#/components/schemas/NameSerializer/properties/name' - "$.components.schemas.NameSerializer.properties.name" + name: Name. extra_headers: Send extra headers @@ -1207,41 +1144,33 @@ def list( List volumes Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[1].schema" + region_id: Region ID - bootable: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[2]" + bootable: Filter by bootable field - cluster_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[3]" + cluster_id: Filter volumes by k8s cluster ID - has_attachments: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[4]" + has_attachments: Filter by the presence of attachments - id_part: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[5]" + id_part: Filter the volume list result by the ID part of the volume - instance_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[6]" + instance_id: Filter volumes by instance ID - limit: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[7]" + limit: Optional. Limit the number of returned items - name_part: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[8]" + name_part: Filter volumes by name_part inclusion in volume name.Any substring can be used + and volumes will be returned with names containing the substring. - offset: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[9]" + offset: Optional. Offset value is used to exclude the first set of records from the + result - tag_key: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[10]" + tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 - tag_key_value: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[11]" + tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode + "tag_key_value={"key": "value"}" --url + "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers @@ -1300,17 +1229,13 @@ async def delete( Delete volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[2].schema" + volume_id: Volume ID - snapshots: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/3' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[3]" + snapshots: Comma separated list of snapshot IDs to be deleted with the volume. extra_headers: Send extra headers @@ -1359,20 +1284,15 @@ async def attach_to_instance( instance with shared flavor Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/0/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/1/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/2/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[2].schema" + volume_id: Volume ID - instance_id: '#/components/schemas/AttachVolumeToInstanceSerializer/properties/instance_id' - "$.components.schemas.AttachVolumeToInstanceSerializer.properties.instance_id" + instance_id: Instance ID. - attachment_tag: '#/components/schemas/AttachVolumeToInstanceSerializer/properties/attachment_tag' - "$.components.schemas.AttachVolumeToInstanceSerializer.properties.attachment_tag" + attachment_tag: Block device attachment tag (not exposed in the normal tags). extra_headers: Send extra headers @@ -1421,17 +1341,13 @@ async def change_type( Change volume type Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/2/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[2].schema" + volume_id: Volume ID - volume_type: '#/components/schemas/VolumeRetypeSerializer/properties/volume_type' - "$.components.schemas.VolumeRetypeSerializer.properties.volume_type" + volume_type: New volume type name extra_headers: Send extra headers @@ -1476,17 +1392,13 @@ async def detach_from_instance( Detach the volume from instance Args: - project_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/0/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/1/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/2/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[2].schema" + volume_id: Volume ID - instance_id: '#/components/schemas/InstanceIdSerializer/properties/instance_id' - "$.components.schemas.InstanceIdSerializer.properties.instance_id" + instance_id: Instance ID extra_headers: Send extra headers @@ -1530,14 +1442,11 @@ async def get( Get volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].get.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].get.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/get/parameters/2/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].get.parameters[2].schema" + volume_id: Volume ID extra_headers: Send extra headers @@ -1579,17 +1488,13 @@ async def resize( Extend volume Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/2/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[2].schema" + volume_id: Volume ID - size: '#/components/schemas/SizeSerializer/properties/size' - "$.components.schemas.SizeSerializer.properties.size" + size: New volume size in GiB extra_headers: Send extra headers @@ -1631,14 +1536,11 @@ async def revert_to_last_snapshot( Revert volume to it's last snapshot Args: - project_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Frevert/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert'].post.parameters[0].schema" + project_id: Project ID - region_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Frevert/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert'].post.parameters[1].schema" + region_id: Region ID - volume_id: '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Frevert/post/parameters/2/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert'].post.parameters[2].schema" + volume_id: Volume ID extra_headers: Send extra headers diff --git a/src/gcore/types/cloud/allowed_address_pairs.py b/src/gcore/types/cloud/allowed_address_pairs.py index 643404fc..9a028363 100644 --- a/src/gcore/types/cloud/allowed_address_pairs.py +++ b/src/gcore/types/cloud/allowed_address_pairs.py @@ -9,13 +9,7 @@ class AllowedAddressPairs(BaseModel): ip_address: str - """ - '#/components/schemas/AllowedAddressPairsSerializer/properties/ip_address/anyOf/0' - "$.components.schemas.AllowedAddressPairsSerializer.properties.ip_address.anyOf[0]" - """ + """Subnet mask or IP address of the port specified in allowed_address_pairs""" mac_address: Optional[str] = None - """ - '#/components/schemas/AllowedAddressPairsSerializer/properties/mac_address/anyOf/0' - "$.components.schemas.AllowedAddressPairsSerializer.properties.mac_address.anyOf[0]" - """ + """MAC address of the port specified in allowed_address_pairs""" diff --git a/src/gcore/types/cloud/aws_iam_data.py b/src/gcore/types/cloud/aws_iam_data.py index 1df1f50c..104ecba7 100644 --- a/src/gcore/types/cloud/aws_iam_data.py +++ b/src/gcore/types/cloud/aws_iam_data.py @@ -7,13 +7,7 @@ class AwsIamData(BaseModel): aws_access_key_id: str - """ - '#/components/schemas/AwsIamData/properties/aws_access_key_id' - "$.components.schemas.AwsIamData.properties.aws_access_key_id" - """ + """AWS IAM key ID.""" aws_secret_access_key: str - """ - '#/components/schemas/AwsIamData/properties/aws_secret_access_key' - "$.components.schemas.AwsIamData.properties.aws_secret_access_key" - """ + """AWS IAM secret key.""" diff --git a/src/gcore/types/cloud/aws_iam_data_param.py b/src/gcore/types/cloud/aws_iam_data_param.py index 62f0854c..412d9eed 100644 --- a/src/gcore/types/cloud/aws_iam_data_param.py +++ b/src/gcore/types/cloud/aws_iam_data_param.py @@ -9,13 +9,7 @@ class AwsIamDataParam(TypedDict, total=False): aws_access_key_id: Required[str] - """ - '#/components/schemas/AwsIamData/properties/aws_access_key_id' - "$.components.schemas.AwsIamData.properties.aws_access_key_id" - """ + """AWS IAM key ID.""" aws_secret_access_key: Required[str] - """ - '#/components/schemas/AwsIamData/properties/aws_secret_access_key' - "$.components.schemas.AwsIamData.properties.aws_secret_access_key" - """ + """AWS IAM secret key.""" diff --git a/src/gcore/types/cloud/baremetal/baremetal_fixed_address.py b/src/gcore/types/cloud/baremetal/baremetal_fixed_address.py index facb77ab..93d72394 100644 --- a/src/gcore/types/cloud/baremetal/baremetal_fixed_address.py +++ b/src/gcore/types/cloud/baremetal/baremetal_fixed_address.py @@ -10,31 +10,21 @@ class BaremetalFixedAddress(BaseModel): addr: str - """ - '#/components/schemas/BareMetalFixedAddressSerializer/properties/addr' - "$.components.schemas.BareMetalFixedAddressSerializer.properties.addr" - """ + """Address""" interface_name: Optional[str] = None - """ - '#/components/schemas/BareMetalFixedAddressSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.BareMetalFixedAddressSerializer.properties.interface_name.anyOf[0]" + """Interface name. + + This field will be `null` if `with_interfaces_name=true` is not set in the + request when listing servers. It will also be `null` if the `interface_name` was + not specified during server creation or when attaching the interface. """ subnet_id: str - """ - '#/components/schemas/BareMetalFixedAddressSerializer/properties/subnet_id' - "$.components.schemas.BareMetalFixedAddressSerializer.properties.subnet_id" - """ + """The unique identifier of the subnet associated with this address.""" subnet_name: str - """ - '#/components/schemas/BareMetalFixedAddressSerializer/properties/subnet_name' - "$.components.schemas.BareMetalFixedAddressSerializer.properties.subnet_name" - """ + """The name of the subnet associated with this address.""" type: Literal["fixed"] - """ - '#/components/schemas/BareMetalFixedAddressSerializer/properties/type' - "$.components.schemas.BareMetalFixedAddressSerializer.properties.type" - """ + """Type of the address""" diff --git a/src/gcore/types/cloud/baremetal/baremetal_floating_address.py b/src/gcore/types/cloud/baremetal/baremetal_floating_address.py index 8ee97043..a5690da4 100644 --- a/src/gcore/types/cloud/baremetal/baremetal_floating_address.py +++ b/src/gcore/types/cloud/baremetal/baremetal_floating_address.py @@ -9,13 +9,7 @@ class BaremetalFloatingAddress(BaseModel): addr: str - """ - '#/components/schemas/BareMetalFloatingAddressSerializer/properties/addr' - "$.components.schemas.BareMetalFloatingAddressSerializer.properties.addr" - """ + """Address""" type: Literal["floating"] - """ - '#/components/schemas/BareMetalFloatingAddressSerializer/properties/type' - "$.components.schemas.BareMetalFloatingAddressSerializer.properties.type" - """ + """Type of the address""" diff --git a/src/gcore/types/cloud/baremetal/baremetal_server.py b/src/gcore/types/cloud/baremetal/baremetal_server.py index 7e64f42b..bc0a8cda 100644 --- a/src/gcore/types/cloud/baremetal/baremetal_server.py +++ b/src/gcore/types/cloud/baremetal/baremetal_server.py @@ -19,196 +19,106 @@ class FixedIPAssignment(BaseModel): external: bool - """ - '#/components/schemas/IpAssignmentsSerializer/properties/external' - "$.components.schemas.IpAssignmentsSerializer.properties.external" - """ + """Is network external""" ip_address: str - """ - '#/components/schemas/IpAssignmentsSerializer/properties/ip_address' - "$.components.schemas.IpAssignmentsSerializer.properties.ip_address" - """ + """Ip address""" subnet_id: str - """ - '#/components/schemas/IpAssignmentsSerializer/properties/subnet_id' - "$.components.schemas.IpAssignmentsSerializer.properties.subnet_id" - """ + """Interface subnet id""" class FlavorHardwareDescription(BaseModel): cpu: str - """ - '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/cpu' - "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.cpu" - """ + """Human-readable CPU description""" disk: str - """ - '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/disk' - "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.disk" - """ + """Human-readable disk description""" license: str - """ - '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/license' - "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.license" - """ + """If the flavor is licensed, this field contains the license type""" network: str - """ - '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/network' - "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.network" - """ + """Human-readable NIC description""" ram: str - """ - '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/ram' - "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.ram" - """ + """Human-readable RAM description""" class Flavor(BaseModel): architecture: str - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/architecture' - "$.components.schemas.BareMetalFlavorSerializer.properties.architecture" - """ + """CPU architecture""" flavor_id: str - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/flavor_id' - "$.components.schemas.BareMetalFlavorSerializer.properties.flavor_id" - """ + """Flavor ID is the same as name""" flavor_name: str - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/flavor_name' - "$.components.schemas.BareMetalFlavorSerializer.properties.flavor_name" - """ + """Flavor name""" hardware_description: FlavorHardwareDescription - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/hardware_description' - "$.components.schemas.BareMetalFlavorSerializer.properties.hardware_description" - """ + """Additional hardware description""" os_type: str - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/os_type' - "$.components.schemas.BareMetalFlavorSerializer.properties.os_type" - """ + """Operating system""" ram: int - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/ram' - "$.components.schemas.BareMetalFlavorSerializer.properties.ram" - """ + """RAM size in MiB""" resource_class: str - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/resource_class' - "$.components.schemas.BareMetalFlavorSerializer.properties.resource_class" - """ + """Flavor resource class for mapping to hardware capacity""" vcpus: int - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/vcpus' - "$.components.schemas.BareMetalFlavorSerializer.properties.vcpus" - """ + """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" class BaremetalServer(BaseModel): addresses: Dict[str, List[Address]] - """ - '#/components/schemas/BareMetalServerSerializer/properties/addresses' - "$.components.schemas.BareMetalServerSerializer.properties.addresses" - """ + """Map of network_name to list of addresses in that network""" blackhole_ports: List[BlackholePort] - """ - '#/components/schemas/BareMetalServerSerializer/properties/blackhole_ports' - "$.components.schemas.BareMetalServerSerializer.properties.blackhole_ports" - """ + """IP addresses of the instances that are blackholed by DDoS mitigation system""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/BareMetalServerSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.BareMetalServerSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" ddos_profile: Optional[DDOSProfile] = None - """ - '#/components/schemas/BareMetalServerSerializer/properties/ddos_profile/anyOf/0' - "$.components.schemas.BareMetalServerSerializer.properties.ddos_profile.anyOf[0]" + """Bare metal advanced DDoS protection profile. + + It is always `null` if query parameter `with_ddos=true` is not set. """ fixed_ip_assignments: List[FixedIPAssignment] - """ - '#/components/schemas/BareMetalServerSerializer/properties/fixed_ip_assignments' - "$.components.schemas.BareMetalServerSerializer.properties.fixed_ip_assignments" - """ + """Fixed IP assigned to instance""" flavor: Flavor - """ - '#/components/schemas/BareMetalServerSerializer/properties/flavor' - "$.components.schemas.BareMetalServerSerializer.properties.flavor" - """ + """Flavor""" instance_created: datetime - """ - '#/components/schemas/BareMetalServerSerializer/properties/instance_created' - "$.components.schemas.BareMetalServerSerializer.properties.instance_created" - """ + """Datetime when bare metal server was created""" instance_description: Optional[str] = None - """ - '#/components/schemas/BareMetalServerSerializer/properties/instance_description/anyOf/0' - "$.components.schemas.BareMetalServerSerializer.properties.instance_description.anyOf[0]" - """ + """Bare metal server description""" instance_id: str - """ - '#/components/schemas/BareMetalServerSerializer/properties/instance_id' - "$.components.schemas.BareMetalServerSerializer.properties.instance_id" - """ + """Bare metal server ID""" instance_isolation: Optional[InstanceIsolation] = None - """ - '#/components/schemas/BareMetalServerSerializer/properties/instance_isolation/anyOf/0' - "$.components.schemas.BareMetalServerSerializer.properties.instance_isolation.anyOf[0]" - """ + """Instance isolation information""" instance_name: str - """ - '#/components/schemas/BareMetalServerSerializer/properties/instance_name' - "$.components.schemas.BareMetalServerSerializer.properties.instance_name" - """ + """Bare metal server name""" project_id: int - """ - '#/components/schemas/BareMetalServerSerializer/properties/project_id' - "$.components.schemas.BareMetalServerSerializer.properties.project_id" - """ + """Project ID""" region: str - """ - '#/components/schemas/BareMetalServerSerializer/properties/region' - "$.components.schemas.BareMetalServerSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/BareMetalServerSerializer/properties/region_id' - "$.components.schemas.BareMetalServerSerializer.properties.region_id" - """ + """Region ID""" ssh_key_name: Optional[str] = None - """ - '#/components/schemas/BareMetalServerSerializer/properties/ssh_key_name/anyOf/0' - "$.components.schemas.BareMetalServerSerializer.properties.ssh_key_name.anyOf[0]" - """ + """SSH key assigned to bare metal server""" status: Literal[ "ACTIVE", @@ -232,28 +142,27 @@ class BaremetalServer(BaseModel): "UNKNOWN", "VERIFY_RESIZE", ] - """ - '#/components/schemas/BareMetalServerSerializer/properties/status' - "$.components.schemas.BareMetalServerSerializer.properties.status" - """ + """Bare metal server status""" tags: List[Tag] - """ - '#/components/schemas/BareMetalServerSerializer/properties/tags' - "$.components.schemas.BareMetalServerSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ task_id: Optional[str] = None - """ - '#/components/schemas/BareMetalServerSerializer/properties/task_id/anyOf/0' - "$.components.schemas.BareMetalServerSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ task_state: Optional[str] = None - """ - '#/components/schemas/BareMetalServerSerializer/properties/task_state/anyOf/0' - "$.components.schemas.BareMetalServerSerializer.properties.task_state.anyOf[0]" - """ + """Task state""" vm_state: Literal[ "active", @@ -269,7 +178,4 @@ class BaremetalServer(BaseModel): "stopped", "suspended", ] - """ - '#/components/schemas/BareMetalServerSerializer/properties/vm_state' - "$.components.schemas.BareMetalServerSerializer.properties.vm_state" - """ + """Bare metal server state""" diff --git a/src/gcore/types/cloud/baremetal/flavor_list_params.py b/src/gcore/types/cloud/baremetal/flavor_list_params.py index 0a289dc2..618ab77f 100644 --- a/src/gcore/types/cloud/baremetal/flavor_list_params.py +++ b/src/gcore/types/cloud/baremetal/flavor_list_params.py @@ -9,49 +9,27 @@ class FlavorListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[1].schema" - """ disabled: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[2]" - """ + """Flag for filtering disabled flavors in the region. Defaults to true""" exclude_linux: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[3]" - """ + """Set to true to exclude flavors dedicated to linux images. Default False""" exclude_windows: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[4]" - """ + """Set to true to exclude flavors dedicated to windows images. Default False""" include_capacity: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[5]" - """ + """Set to true if the response should include flavor capacity""" include_prices: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[6]" - """ + """Set to true if the response should include flavor prices""" include_reservation_stock: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fbmflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/bmflavors/{project_id}/{region_id}'].get.parameters[7]" + """Optional. + + Set to true if flavor listing should include count of reserved resources in + stock. """ diff --git a/src/gcore/types/cloud/baremetal/flavor_list_suitable_params.py b/src/gcore/types/cloud/baremetal/flavor_list_suitable_params.py index 6d8c6a27..ec5beb24 100644 --- a/src/gcore/types/cloud/baremetal/flavor_list_suitable_params.py +++ b/src/gcore/types/cloud/baremetal/flavor_list_suitable_params.py @@ -9,31 +9,14 @@ class FlavorListSuitableParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/0/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/1/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[1].schema" - """ include_prices: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/2' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors'].post.parameters[2]" - """ + """Set to true if flavor listing should include flavor prices""" apptemplate_id: str - """ - '#/components/schemas/AvailableBaremetalFlavorsRequestSchema/properties/apptemplate_id' - "$.components.schemas.AvailableBaremetalFlavorsRequestSchema.properties.apptemplate_id" - """ + """Apptemplate ID""" image_id: str - """ - '#/components/schemas/AvailableBaremetalFlavorsRequestSchema/properties/image_id' - "$.components.schemas.AvailableBaremetalFlavorsRequestSchema.properties.image_id" - """ + """Image ID""" diff --git a/src/gcore/types/cloud/baremetal/image_list_params.py b/src/gcore/types/cloud/baremetal/image_list_params.py index 12509079..09f8b505 100644 --- a/src/gcore/types/cloud/baremetal/image_list_params.py +++ b/src/gcore/types/cloud/baremetal/image_list_params.py @@ -10,43 +10,24 @@ class ImageListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[1].schema" - """ include_prices: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[2]" - """ + """Show price""" private: str - """ - '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[3]" - """ + """Any value to show private images""" tag_key: List[str] - """ - '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[4]" - """ + """Filter by tag keys.""" tag_key_value: str - """ - '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[5]" + """Filter by tag key-value pairs. + + Must be a valid JSON string. 'curl -G --data-urlencode 'tag_key_value={"key": + "value"}' --url 'http://localhost:1111/v1/images/1/1'" """ visibility: Literal["private", "public", "shared"] - """ - '#/paths/%2Fcloud%2Fv1%2Fbmimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/bmimages/{project_id}/{region_id}'].get.parameters[6]" - """ + """Image visibility. Globally visible images are public""" diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index 5bdb11b9..8be35d6b 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -31,129 +31,113 @@ class ServerCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].post.parameters[1].schema" - """ + """Region ID""" flavor: Required[str] - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/flavor' - "$.components.schemas.CreateBareMetalServerSerializer.properties.flavor" - """ + """The flavor of the instance.""" interfaces: Required[Iterable[Interface]] - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/interfaces' - "$.components.schemas.CreateBareMetalServerSerializer.properties.interfaces" + """A list of network interfaces for the server. + + You can create one or more interfaces—private, public, or both. """ app_config: Optional[object] """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/app_config/anyOf/0' - "$.components.schemas.CreateBareMetalServerSerializer.properties.app_config.anyOf[0]" + Parameters for the application template if creating the instance from an + `apptemplate`. """ apptemplate_id: str - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/apptemplate_id' - "$.components.schemas.CreateBareMetalServerSerializer.properties.apptemplate_id" - """ + """Apptemplate ID. Either `image_id` or `apptemplate_id` is required.""" ddos_profile: DDOSProfile - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/ddos_profile' - "$.components.schemas.CreateBareMetalServerSerializer.properties.ddos_profile" - """ + """Enable advanced DDoS protection for the server""" image_id: str - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/image_id' - "$.components.schemas.CreateBareMetalServerSerializer.properties.image_id" - """ + """Image ID. Either `image_id` or `apptemplate_id` is required.""" name_templates: List[str] """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/name_templates' - "$.components.schemas.CreateBareMetalServerSerializer.properties.name_templates" + If you want server names to be automatically generated using IP octets, you can + specify name templates instead of setting names manually.Provide a list of + templated names that should be replaced using the selected template. The + following template formats are supported: `{ip_octets}`, `{two_ip_octets}`, and + `{one_ip_octet}`. """ names: List[str] - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/names' - "$.components.schemas.CreateBareMetalServerSerializer.properties.names" - """ + """List of server names. Specify one name to create a single server.""" password: str - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/password' - "$.components.schemas.CreateBareMetalServerSerializer.properties.password" + """For Linux instances, 'username' and 'password' are used to create a new user. + + When only 'password' is provided, it is set as the password for the default user + of the image. For Windows instances, 'username' cannot be specified. Use the + 'password' field to set the password for the 'Admin' user on Windows. Use the + 'user_data' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via 'user_data'. """ ssh_key_name: Optional[str] - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/ssh_key_name/anyOf/0' - "$.components.schemas.CreateBareMetalServerSerializer.properties.ssh_key_name.anyOf[0]" - """ + """Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint.""" tags: TagUpdateListParam - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/tags' - "$.components.schemas.CreateBareMetalServerSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. """ user_data: str - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/user_data' - "$.components.schemas.CreateBareMetalServerSerializer.properties.user_data" + """String in base64 format. + + For Linux instances, 'user_data' is ignored when 'password' field is provided. + For Windows instances, Admin user password is set by 'password' field and cannot + be updated via 'user_data'. Examples of the user_data: + https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ username: str - """ - '#/components/schemas/CreateBareMetalServerSerializer/properties/username' - "$.components.schemas.CreateBareMetalServerSerializer.properties.username" + """For Linux instances, 'username' and 'password' are used to create a new user. + + For Windows instances, 'username' cannot be specified. Use 'password' field to + set the password for the 'Admin' user on Windows. """ class InterfaceCreateBareMetalExternalInterfaceSerializer(TypedDict, total=False): type: Required[Literal["external"]] - """ - '#/components/schemas/CreateBareMetalExternalInterfaceSerializer/properties/type' - "$.components.schemas.CreateBareMetalExternalInterfaceSerializer.properties.type" - """ + """A public IP address will be assigned to the instance.""" interface_name: str - """ - '#/components/schemas/CreateBareMetalExternalInterfaceSerializer/properties/interface_name' - "$.components.schemas.CreateBareMetalExternalInterfaceSerializer.properties.interface_name" + """Interface name. + + Defaults to `null` and is returned as `null` in the API response if not set. """ ip_family: Optional[InterfaceIPFamily] - """ - '#/components/schemas/CreateBareMetalExternalInterfaceSerializer/properties/ip_family/anyOf/0' - "$.components.schemas.CreateBareMetalExternalInterfaceSerializer.properties.ip_family.anyOf[0]" - """ + """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" port_group: int - """ - '#/components/schemas/CreateBareMetalExternalInterfaceSerializer/properties/port_group' - "$.components.schemas.CreateBareMetalExternalInterfaceSerializer.properties.port_group" - """ + """Applicable only to bare metal. Each group is added to a separate trunk.""" class InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer( TypedDict, total=False ): source: Required[Literal["new"]] - """ - '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """A new floating IP will be created and attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -162,14 +146,16 @@ class InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIPExistingInstanc ): existing_floating_id: Required[str] """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + An existing available floating IP id must be specified if the source is set to + `existing` """ source: Required[Literal["existing"]] - """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """An existing available floating IP will be attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -181,49 +167,40 @@ class InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIPExistingInstanc class InterfaceCreateBareMetalSubnetInterfaceSerializer(TypedDict, total=False): network_id: Required[str] - """ - '#/components/schemas/CreateBareMetalSubnetInterfaceSerializer/properties/network_id' - "$.components.schemas.CreateBareMetalSubnetInterfaceSerializer.properties.network_id" - """ + """The network where the instance will be connected.""" subnet_id: Required[str] - """ - '#/components/schemas/CreateBareMetalSubnetInterfaceSerializer/properties/subnet_id' - "$.components.schemas.CreateBareMetalSubnetInterfaceSerializer.properties.subnet_id" - """ + """The instance will get an IP address from this subnet.""" type: Required[Literal["subnet"]] - """ - '#/components/schemas/CreateBareMetalSubnetInterfaceSerializer/properties/type' - "$.components.schemas.CreateBareMetalSubnetInterfaceSerializer.properties.type" + """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. """ floating_ip: InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIP - """ - '#/components/schemas/CreateBareMetalSubnetInterfaceSerializer/properties/floating_ip' - "$.components.schemas.CreateBareMetalSubnetInterfaceSerializer.properties.floating_ip" - """ + """Allows the instance to have a public IP that can be reached from the internet.""" interface_name: str - """ - '#/components/schemas/CreateBareMetalSubnetInterfaceSerializer/properties/interface_name' - "$.components.schemas.CreateBareMetalSubnetInterfaceSerializer.properties.interface_name" + """Interface name. + + Defaults to `null` and is returned as `null` in the API response if not set. """ port_group: int - """ - '#/components/schemas/CreateBareMetalSubnetInterfaceSerializer/properties/port_group' - "$.components.schemas.CreateBareMetalSubnetInterfaceSerializer.properties.port_group" - """ + """Applicable only to bare metal. Each group is added to a separate trunk.""" class InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer( TypedDict, total=False ): source: Required[Literal["new"]] - """ - '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """A new floating IP will be created and attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -232,14 +209,16 @@ class InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIPExistingInst ): existing_floating_id: Required[str] """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + An existing available floating IP id must be specified if the source is set to + `existing` """ source: Required[Literal["existing"]] - """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """An existing available floating IP will be attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -251,55 +230,39 @@ class InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIPExistingInst class InterfaceCreateBareMetalAnySubnetInterfaceSerializer(TypedDict, total=False): network_id: Required[str] - """ - '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/network_id' - "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.network_id" - """ + """The network where the instance will be connected.""" type: Required[Literal["any_subnet"]] - """ - '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/type' - "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.type" - """ + """Instance will be attached to a subnet with the largest count of free IPs.""" floating_ip: InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIP - """ - '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/floating_ip' - "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.floating_ip" - """ + """Allows the instance to have a public IP that can be reached from the internet.""" interface_name: str - """ - '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/interface_name' - "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.interface_name" + """Interface name. + + Defaults to `null` and is returned as `null` in the API response if not set. """ ip_address: str - """ - '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/ip_address' - "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.ip_address" - """ + """You can specify a specific IP address from your subnet.""" ip_family: Optional[InterfaceIPFamily] - """ - '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/ip_family/anyOf/0' - "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.ip_family.anyOf[0]" - """ + """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" port_group: int - """ - '#/components/schemas/CreateBareMetalAnySubnetInterfaceSerializer/properties/port_group' - "$.components.schemas.CreateBareMetalAnySubnetInterfaceSerializer.properties.port_group" - """ + """Applicable only to bare metal. Each group is added to a separate trunk.""" class InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer( TypedDict, total=False ): source: Required[Literal["new"]] - """ - '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """A new floating IP will be created and attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -308,14 +271,16 @@ class InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIPExisti ): existing_floating_id: Required[str] """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + An existing available floating IP id must be specified if the source is set to + `existing` """ source: Required[Literal["existing"]] - """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """An existing available floating IP will be attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -327,34 +292,26 @@ class InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIPExisti class InterfaceCreateBareMetalReservedFixedIPInterfaceSerializer(TypedDict, total=False): port_id: Required[str] - """ - '#/components/schemas/CreateBareMetalReservedFixedIpInterfaceSerializer/properties/port_id' - "$.components.schemas.CreateBareMetalReservedFixedIpInterfaceSerializer.properties.port_id" - """ + """Network ID the subnet belongs to. Port will be plugged in this network.""" type: Required[Literal["reserved_fixed_ip"]] - """ - '#/components/schemas/CreateBareMetalReservedFixedIpInterfaceSerializer/properties/type' - "$.components.schemas.CreateBareMetalReservedFixedIpInterfaceSerializer.properties.type" + """An existing available reserved fixed IP will be attached to the instance. + + If the reserved IP is not public and you choose to add a floating IP, the + instance will be accessible from the internet. """ floating_ip: InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIP - """ - '#/components/schemas/CreateBareMetalReservedFixedIpInterfaceSerializer/properties/floating_ip' - "$.components.schemas.CreateBareMetalReservedFixedIpInterfaceSerializer.properties.floating_ip" - """ + """Allows the instance to have a public IP that can be reached from the internet.""" interface_name: str - """ - '#/components/schemas/CreateBareMetalReservedFixedIpInterfaceSerializer/properties/interface_name' - "$.components.schemas.CreateBareMetalReservedFixedIpInterfaceSerializer.properties.interface_name" + """Interface name. + + Defaults to `null` and is returned as `null` in the API response if not set. """ port_group: int - """ - '#/components/schemas/CreateBareMetalReservedFixedIpInterfaceSerializer/properties/port_group' - "$.components.schemas.CreateBareMetalReservedFixedIpInterfaceSerializer.properties.port_group" - """ + """Applicable only to bare metal. Each group is added to a separate trunk.""" Interface: TypeAlias = Union[ @@ -367,45 +324,24 @@ class InterfaceCreateBareMetalReservedFixedIPInterfaceSerializer(TypedDict, tota class DDOSProfileField(TypedDict, total=False): base_field: Optional[int] - """ - '#/components/schemas/CreateBareMetalDDoSProfileFieldSerializer/properties/base_field/anyOf/0' - "$.components.schemas.CreateBareMetalDDoSProfileFieldSerializer.properties.base_field.anyOf[0]" - """ + """ID of DDoS profile field""" field_name: Optional[str] - """ - '#/components/schemas/CreateBareMetalDDoSProfileFieldSerializer/properties/field_name/anyOf/0' - "$.components.schemas.CreateBareMetalDDoSProfileFieldSerializer.properties.field_name.anyOf[0]" - """ + """Name of DDoS profile field""" field_value: Union[Iterable[object], int, str, None] - """ - '#/components/schemas/CreateBareMetalDDoSProfileFieldSerializer/properties/field_value' - "$.components.schemas.CreateBareMetalDDoSProfileFieldSerializer.properties.field_value" - """ + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """ - '#/components/schemas/CreateBareMetalDDoSProfileFieldSerializer/properties/value/anyOf/0' - "$.components.schemas.CreateBareMetalDDoSProfileFieldSerializer.properties.value.anyOf[0]" - """ + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class DDOSProfile(TypedDict, total=False): profile_template: Required[int] - """ - '#/components/schemas/CreateDDoSProfileSerializer/properties/profile_template' - "$.components.schemas.CreateDDoSProfileSerializer.properties.profile_template" - """ + """DDoS profile template ID""" fields: Optional[Iterable[DDOSProfileField]] - """ - '#/components/schemas/CreateDDoSProfileSerializer/properties/fields/anyOf/0' - "$.components.schemas.CreateDDoSProfileSerializer.properties.fields.anyOf[0]" - """ + """DDoS profile parameters""" profile_template_name: Optional[str] - """ - '#/components/schemas/CreateDDoSProfileSerializer/properties/profile_template_name/anyOf/0' - "$.components.schemas.CreateDDoSProfileSerializer.properties.profile_template_name.anyOf[0]" - """ + """DDoS profile template name""" diff --git a/src/gcore/types/cloud/baremetal/server_list_params.py b/src/gcore/types/cloud/baremetal/server_list_params.py index 7bd41751..122e6731 100644 --- a/src/gcore/types/cloud/baremetal/server_list_params.py +++ b/src/gcore/types/cloud/baremetal/server_list_params.py @@ -13,139 +13,102 @@ class ServerListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[1].schema" - """ + """Region ID""" changes_before: Annotated[Union[str, datetime], PropertyInfo(alias="changes-before", format="iso8601")] - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[2]" - """ + """Filters the instances by a date and time stamp when the instances last changed.""" changes_since: Annotated[Union[str, datetime], PropertyInfo(alias="changes-since", format="iso8601")] """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[3]" + Filters the instances by a date and time stamp when the instances last changed + status. """ flavor_id: str - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[4]" - """ + """Filter out instances by flavor_id. Flavor id must match exactly.""" flavor_prefix: str - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[5]" - """ + """Filter out instances by flavor_prefix.""" include_k8s: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[6]" - """ + """Include managed k8s worker nodes""" ip: str - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[7]" + """An IPv4 address to filter results by. + + Note: partial matches are allowed. For example, searching for 192.168.0.1 will + return 192.168.0.1, 192.168.0.10, 192.168.0.110, and so on. """ limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[8]" - """ + """Optional. Limit the number of returned items""" name: str - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[9]" + """Filter instances by name. + + You can provide a full or partial name, instances with matching names will be + returned. For example, entering 'test' will return all instances that contain + 'test' in their name. """ offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[10]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ only_isolated: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[11]" - """ + """Include only isolated instances""" only_with_fixed_external_ip: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[12]" - """ + """Return bare metals only with external fixed IP addresses.""" order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[13]" - """ + """Order by field and direction.""" profile_name: str - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[14]" + """Filter result by ddos protection profile name. + + Effective only with with_ddos set to true. """ protection_status: Literal["Active", "Queued", "Error"] - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[15]" + """Filter result by DDoS protection_status. + + Effective only with with_ddos set to true. (Active, Queued or Error) """ status: Literal["ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED"] - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[16]" - """ + """Filters instances by a server status, as a string.""" tag_key_value: str - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[17]" + """Optional. + + Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": + "value"}" --url "https://example.com/cloud/v1/resource/1/1" """ tag_value: List[str] - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[18]" - """ + """Optional. Filter by tag values. ?tag_value=value1&tag_value=value2""" type_ddos_profile: Literal["basic", "advanced"] - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[19]" + """Return bare metals either only with advanced or only basic DDoS protection. + + Effective only with with_ddos set to true. (advanced or basic) """ uuid: str - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/20' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[20]" - """ + """Filter the server list result by the UUID of the server. Allowed UUID part""" with_ddos: bool """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/21' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[21]" + Include DDoS profile information for bare-metal servers in the response when set + to `true`. Otherwise, the `ddos_profile` field in the response is `null` by + default. """ with_interfaces_name: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/22' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}'].get.parameters[22]" - """ + """Include `interface_name` in the addresses""" diff --git a/src/gcore/types/cloud/baremetal/server_rebuild_params.py b/src/gcore/types/cloud/baremetal/server_rebuild_params.py index 3abb0ec3..9bc57135 100644 --- a/src/gcore/types/cloud/baremetal/server_rebuild_params.py +++ b/src/gcore/types/cloud/baremetal/server_rebuild_params.py @@ -9,25 +9,15 @@ class ServerRebuildParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/0/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fbminstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bserver_id%7D%2Frebuild/post/parameters/1/schema' - "$.paths['/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild'].post.parameters[1].schema" - """ image_id: str - """ - '#/components/schemas/RebuildBaremetalSchema/properties/image_id' - "$.components.schemas.RebuildBaremetalSchema.properties.image_id" - """ + """Image ID""" user_data: str - """ - '#/components/schemas/RebuildBaremetalSchema/properties/user_data' - "$.components.schemas.RebuildBaremetalSchema.properties.user_data" + """String in base64 format. + + Must not be passed together with 'username' or 'password'. Examples of the + user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ diff --git a/src/gcore/types/cloud/baremetal_flavor.py b/src/gcore/types/cloud/baremetal_flavor.py index 429826de..e28f667d 100644 --- a/src/gcore/types/cloud/baremetal_flavor.py +++ b/src/gcore/types/cloud/baremetal_flavor.py @@ -10,91 +10,49 @@ class BaremetalFlavor(BaseModel): architecture: str - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/architecture' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.architecture" - """ + """Flavor architecture type""" disabled: bool - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/disabled' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.disabled" - """ + """Disabled flavor flag""" flavor_id: str - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/flavor_id' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.flavor_id" - """ + """Flavor ID is the same as name""" flavor_name: str - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/flavor_name' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.flavor_name" - """ + """Flavor name""" os_type: str - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/os_type' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.os_type" - """ + """Flavor operating system""" ram: int - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/ram' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.ram" - """ + """RAM size in MiB""" resource_class: Optional[str] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/resource_class/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.resource_class.anyOf[0]" - """ + """Flavor resource class for mapping to hardware capacity""" vcpus: int - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/vcpus' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.vcpus" - """ + """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" capacity: Optional[int] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/capacity/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.capacity.anyOf[0]" - """ + """Number of available instances of given configuration""" currency_code: Optional[str] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/currency_code/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.currency_code.anyOf[0]" - """ + """Currency code. Shown if the include_prices query parameter if set to true""" hardware_description: Optional[Dict[str, str]] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/hardware_description' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.hardware_description" - """ + """Additional hardware description""" price_per_hour: Optional[float] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/price_per_hour/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.price_per_hour.anyOf[0]" - """ + """Price per hour. Shown if the include_prices query parameter if set to true""" price_per_month: Optional[float] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/price_per_month/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.price_per_month.anyOf[0]" - """ + """Price per month. Shown if the include_prices query parameter if set to true""" price_status: Optional[Literal["error", "hide", "show"]] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/price_status/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.price_status.anyOf[0]" - """ + """Price status for the UI""" reserved_in_stock: Optional[int] = None - """ - '#/components/schemas/BareMetalFlavorExtendedSerializer/properties/reserved_in_stock/anyOf/0' - "$.components.schemas.BareMetalFlavorExtendedSerializer.properties.reserved_in_stock.anyOf[0]" + """Count of reserved but not used nodes. + + If a client don't have reservations for the flavor, it's None. """ diff --git a/src/gcore/types/cloud/baremetal_flavor_list.py b/src/gcore/types/cloud/baremetal_flavor_list.py index 190fc68d..f57c96ec 100644 --- a/src/gcore/types/cloud/baremetal_flavor_list.py +++ b/src/gcore/types/cloud/baremetal_flavor_list.py @@ -10,13 +10,7 @@ class BaremetalFlavorList(BaseModel): count: int - """ - '#/components/schemas/BareMetalFlavorExtendedCollectionSerializer/properties/count' - "$.components.schemas.BareMetalFlavorExtendedCollectionSerializer.properties.count" - """ + """Number of objects""" results: List[BaremetalFlavor] - """ - '#/components/schemas/BareMetalFlavorExtendedCollectionSerializer/properties/results' - "$.components.schemas.BareMetalFlavorExtendedCollectionSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/billing_reservation.py b/src/gcore/types/cloud/billing_reservation.py index d2f4c8ad..8f36e1bb 100644 --- a/src/gcore/types/cloud/billing_reservation.py +++ b/src/gcore/types/cloud/billing_reservation.py @@ -11,275 +11,143 @@ class AmountPrices(BaseModel): commit_price_per_month: str - """ - '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/commit_price_per_month' - "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.commit_price_per_month" - """ + """Commit price of the item charged per month""" commit_price_per_unit: str - """ - '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/commit_price_per_unit' - "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.commit_price_per_unit" - """ + """Commit price of the item charged per hour""" commit_price_total: str - """ - '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/commit_price_total' - "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.commit_price_total" - """ + """Commit price of the item charged for all period reservation""" currency_code: str - """ - '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/currency_code' - "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.currency_code" - """ + """Currency code (3 letter code per ISO 4217)""" overcommit_price_per_month: str - """ - '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/overcommit_price_per_month' - "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.overcommit_price_per_month" - """ + """Overcommit price of the item charged per month""" overcommit_price_per_unit: str - """ - '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/overcommit_price_per_unit' - "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.overcommit_price_per_unit" - """ + """Overcommit price of the item charged per hour""" overcommit_price_total: str - """ - '#/components/schemas/BillingReservationAmountPricesResponseSerializer/properties/overcommit_price_total' - "$.components.schemas.BillingReservationAmountPricesResponseSerializer.properties.overcommit_price_total" - """ + """Overcommit price of the item charged for all period reservation""" class Resource(BaseModel): activity_period: str - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/activity_period' - "$.components.schemas.BillingReservationResourceSerializer.properties.activity_period" - """ + """Name of the billing period, e.g month""" activity_period_length: int - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/activity_period_length' - "$.components.schemas.BillingReservationResourceSerializer.properties.activity_period_length" - """ + """Length of the full reservation period by `activity_period`""" billing_plan_item_id: int - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/billing_plan_item_id' - "$.components.schemas.BillingReservationResourceSerializer.properties.billing_plan_item_id" - """ + """Billing plan item id""" commit_price_per_month: str - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/commit_price_per_month' - "$.components.schemas.BillingReservationResourceSerializer.properties.commit_price_per_month" - """ + """Commit price of the item charged per month""" commit_price_per_unit: str - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/commit_price_per_unit' - "$.components.schemas.BillingReservationResourceSerializer.properties.commit_price_per_unit" - """ + """Commit price of the item charged per hour""" commit_price_total: str - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/commit_price_total' - "$.components.schemas.BillingReservationResourceSerializer.properties.commit_price_total" - """ + """Commit price of the item charged for all period reservation""" overcommit_billing_plan_item_id: int - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/overcommit_billing_plan_item_id' - "$.components.schemas.BillingReservationResourceSerializer.properties.overcommit_billing_plan_item_id" - """ + """Overcommit billing plan item id""" overcommit_price_per_month: str - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/overcommit_price_per_month' - "$.components.schemas.BillingReservationResourceSerializer.properties.overcommit_price_per_month" - """ + """Overcommit price of the item charged per month""" overcommit_price_per_unit: str - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/overcommit_price_per_unit' - "$.components.schemas.BillingReservationResourceSerializer.properties.overcommit_price_per_unit" - """ + """Overcommit price of the item charged per hour""" overcommit_price_total: str - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/overcommit_price_total' - "$.components.schemas.BillingReservationResourceSerializer.properties.overcommit_price_total" - """ + """Overcommit price of the item charged for all period reservation""" resource_count: int - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/resource_count' - "$.components.schemas.BillingReservationResourceSerializer.properties.resource_count" - """ + """Number of reserved resource items""" resource_name: str - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/resource_name' - "$.components.schemas.BillingReservationResourceSerializer.properties.resource_name" - """ + """Resource name""" resource_type: Literal["flavor"] - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/resource_type' - "$.components.schemas.BillingReservationResourceSerializer.properties.resource_type" - """ + """Resource type""" unit_name: str - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/unit_name' - "$.components.schemas.BillingReservationResourceSerializer.properties.unit_name" - """ + """Billing unit name""" unit_size_month: str - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/unit_size_month' - "$.components.schemas.BillingReservationResourceSerializer.properties.unit_size_month" - """ + """Minimal billing size, for example it is 744 hours per 1 month.""" unit_size_total: str - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/unit_size_total' - "$.components.schemas.BillingReservationResourceSerializer.properties.unit_size_total" - """ + """Unit size month multiplied by count of resources in the reservation""" cpu: Optional[str] = None - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/cpu/anyOf/0' - "$.components.schemas.BillingReservationResourceSerializer.properties.cpu.anyOf[0]" - """ + """Baremetal CPU description""" disk: Optional[str] = None - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/disk/anyOf/0' - "$.components.schemas.BillingReservationResourceSerializer.properties.disk.anyOf[0]" - """ + """Baremetal disk description""" ram: Optional[str] = None - """ - '#/components/schemas/BillingReservationResourceSerializer/properties/ram/anyOf/0' - "$.components.schemas.BillingReservationResourceSerializer.properties.ram.anyOf[0]" - """ + """Baremetal RAM description""" class BillingReservation(BaseModel): id: int - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/id' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.id" - """ + """Reservation id""" active_from: date - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/active_from' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.active_from" - """ + """Reservation active from date""" active_to: date - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/active_to' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.active_to" - """ + """Reservation active to date""" activity_period: str - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/activity_period' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.activity_period" - """ + """Name of the billing period, e.g month""" activity_period_length: int - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/activity_period_length' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.activity_period_length" - """ + """Length of the full reservation period by `activity_period`""" amount_prices: AmountPrices - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/amount_prices' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.amount_prices" - """ + """Reservation amount prices""" billing_plan_id: int - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/billing_plan_id' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.billing_plan_id" - """ + """Billing plan id""" created_at: datetime - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/created_at' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.created_at" - """ + """Reservation creation date""" error: Optional[str] = None - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/error/anyOf/0' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.error.anyOf[0]" - """ + """Error message if any occured during reservation""" eta: Optional[date] = None - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/eta/anyOf/0' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.eta.anyOf[0]" + """ETA delivery if bare metal out of stock. + + Value None means that bare metal in stock. """ is_expiration_message_visible: bool - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/is_expiration_message_visible' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.is_expiration_message_visible" - """ + """Hide or show expiration message to customer.""" name: str - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/name' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.name" - """ + """Reservation name""" next_statuses: List[str] - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/next_statuses' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.next_statuses" - """ + """List of possible next reservation statuses""" region_id: int - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/region_id' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.region_id" - """ + """Region id""" region_name: str - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/region_name' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.region_name" - """ + """Region name""" remind_expiration_message: Optional[date] = None - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/remind_expiration_message/anyOf/0' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.remind_expiration_message.anyOf[0]" - """ + """The date when show expiration date to customer""" resources: List[Resource] - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/resources' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.resources" - """ + """List of reservation resources""" status: str - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/status' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.status" - """ + """Reservation status""" user_status: str - """ - '#/components/schemas/BillingReservationItemResponseSerializer/properties/user_status' - "$.components.schemas.BillingReservationItemResponseSerializer.properties.user_status" - """ + """User status""" diff --git a/src/gcore/types/cloud/billing_reservation_list_params.py b/src/gcore/types/cloud/billing_reservation_list_params.py index ce188dba..6218c2c8 100644 --- a/src/gcore/types/cloud/billing_reservation_list_params.py +++ b/src/gcore/types/cloud/billing_reservation_list_params.py @@ -13,69 +13,42 @@ class BillingReservationListParams(TypedDict, total=False): activated_from: Annotated[Union[str, date], PropertyInfo(format="iso8601")] - """ - '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/0' - "$.paths['/cloud/v1/reservations'].get.parameters[0]" - """ + """Lower bound, starting from what date the reservation was/will be activated""" activated_to: Annotated[Union[str, date], PropertyInfo(format="iso8601")] - """ - '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/1' - "$.paths['/cloud/v1/reservations'].get.parameters[1]" - """ + """High bound, before what date the reservation was/will be activated""" created_from: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ - '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/2' - "$.paths['/cloud/v1/reservations'].get.parameters[2]" + Lower bound the filter, showing result(s) equal to or greater than date the + reservation was created """ created_to: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ - '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/3' - "$.paths['/cloud/v1/reservations'].get.parameters[3]" + High bound the filter, showing result(s) equal to or less date the reservation + was created """ deactivated_from: Annotated[Union[str, date], PropertyInfo(format="iso8601")] - """ - '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/4' - "$.paths['/cloud/v1/reservations'].get.parameters[4]" - """ + """Lower bound, starting from what date the reservation was/will be deactivated""" deactivated_to: Annotated[Union[str, date], PropertyInfo(format="iso8601")] - """ - '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/5' - "$.paths['/cloud/v1/reservations'].get.parameters[5]" - """ + """High bound, before what date the reservation was/will be deactivated""" limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/6' - "$.paths['/cloud/v1/reservations'].get.parameters[6]" - """ + """Limit of reservation list page""" metric_name: str - """ - '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/7' - "$.paths['/cloud/v1/reservations'].get.parameters[7]" - """ + """Name from billing features for specific resource""" offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/8' - "$.paths['/cloud/v1/reservations'].get.parameters[8]" - """ + """Offset in reservation list""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/9' - "$.paths['/cloud/v1/reservations'].get.parameters[9]" - """ + """Region for reservation""" status: List[ Literal["ACTIVATED", "APPROVED", "COPIED", "CREATED", "EXPIRED", "REJECTED", "RESERVED", "WAITING_FOR_PAYMENT"] ] - """ - '#/paths/%2Fcloud%2Fv1%2Freservations/get/parameters/10' - "$.paths['/cloud/v1/reservations'].get.parameters[10]" - """ + """Field for fixed a status by reservation workflow""" diff --git a/src/gcore/types/cloud/blackhole_port.py b/src/gcore/types/cloud/blackhole_port.py index 297098eb..6b51cf32 100644 --- a/src/gcore/types/cloud/blackhole_port.py +++ b/src/gcore/types/cloud/blackhole_port.py @@ -12,16 +12,10 @@ class BlackholePort(BaseModel): alarm_end: datetime = FieldInfo(alias="AlarmEnd") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlarmEnd' - "$.components.schemas.BlackholePortSerializer.properties.AlarmEnd" - """ + """A date-time string giving the time that the alarm ended""" alarm_start: datetime = FieldInfo(alias="AlarmStart") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlarmStart' - "$.components.schemas.BlackholePortSerializer.properties.AlarmStart" - """ + """A date-time string giving the time that the alarm started""" alarm_state: Literal[ "ACK_REQ", @@ -61,25 +55,12 @@ class BlackholePort(BaseModel): "starting", "starting_fail", ] = FieldInfo(alias="AlarmState") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlarmState' - "$.components.schemas.BlackholePortSerializer.properties.AlarmState" - """ + """Current state of alarm""" alert_duration: str = FieldInfo(alias="AlertDuration") - """ - '#/components/schemas/BlackholePortSerializer/properties/AlertDuration' - "$.components.schemas.BlackholePortSerializer.properties.AlertDuration" - """ + """Total alert duration""" destination_ip: str = FieldInfo(alias="DestinationIP") - """ - '#/components/schemas/BlackholePortSerializer/properties/DestinationIP' - "$.components.schemas.BlackholePortSerializer.properties.DestinationIP" - """ + """Notification destination IP address""" id: int = FieldInfo(alias="ID") - """ - '#/components/schemas/BlackholePortSerializer/properties/ID' - "$.components.schemas.BlackholePortSerializer.properties.ID" - """ diff --git a/src/gcore/types/cloud/capacity.py b/src/gcore/types/cloud/capacity.py index 92456d1d..31d4c8ff 100644 --- a/src/gcore/types/cloud/capacity.py +++ b/src/gcore/types/cloud/capacity.py @@ -7,13 +7,7 @@ class Capacity(BaseModel): capacity: int - """ - '#/components/schemas/CapacityDetailsSerializer/properties/capacity' - "$.components.schemas.CapacityDetailsSerializer.properties.capacity" - """ + """Available capacity.""" flavor_name: str - """ - '#/components/schemas/CapacityDetailsSerializer/properties/flavor_name' - "$.components.schemas.CapacityDetailsSerializer.properties.flavor_name" - """ + """Flavor name.""" diff --git a/src/gcore/types/cloud/console.py b/src/gcore/types/cloud/console.py index e7deb2d3..83456788 100644 --- a/src/gcore/types/cloud/console.py +++ b/src/gcore/types/cloud/console.py @@ -7,27 +7,12 @@ class RemoteConsole(BaseModel): protocol: str - """ - '#/components/schemas/RemoteConsoleData/properties/protocol' - "$.components.schemas.RemoteConsoleData.properties.protocol" - """ type: str - """ - '#/components/schemas/RemoteConsoleData/properties/type' - "$.components.schemas.RemoteConsoleData.properties.type" - """ url: str - """ - '#/components/schemas/RemoteConsoleData/properties/url' - "$.components.schemas.RemoteConsoleData.properties.url" - """ class Console(BaseModel): remote_console: RemoteConsole - """ - '#/components/schemas/RemoteConsoleSerializer/properties/remote_console' - "$.components.schemas.RemoteConsoleSerializer.properties.remote_console" - """ + """Remote console information""" diff --git a/src/gcore/types/cloud/container_probe.py b/src/gcore/types/cloud/container_probe.py index 88700bdd..9dcc3746 100644 --- a/src/gcore/types/cloud/container_probe.py +++ b/src/gcore/types/cloud/container_probe.py @@ -12,49 +12,25 @@ class ContainerProbe(BaseModel): exec: Optional[ContainerProbeExec] = None - """ - '#/components/schemas/ContainerProbeOutSerializerV2/properties/exec/anyOf/0' - "$.components.schemas.ContainerProbeOutSerializerV2.properties.exec.anyOf[0]" - """ + """Exec probe configuration""" failure_threshold: int - """ - '#/components/schemas/ContainerProbeOutSerializerV2/properties/failure_threshold' - "$.components.schemas.ContainerProbeOutSerializerV2.properties.failure_threshold" - """ + """The number of consecutive probe failures that mark the container as unhealthy.""" http_get: Optional[ContainerProbeHTTPGet] = None - """ - '#/components/schemas/ContainerProbeOutSerializerV2/properties/http_get/anyOf/0' - "$.components.schemas.ContainerProbeOutSerializerV2.properties.http_get.anyOf[0]" - """ + """HTTP GET probe configuration""" initial_delay_seconds: int - """ - '#/components/schemas/ContainerProbeOutSerializerV2/properties/initial_delay_seconds' - "$.components.schemas.ContainerProbeOutSerializerV2.properties.initial_delay_seconds" - """ + """The initial delay before starting the first probe.""" period_seconds: int - """ - '#/components/schemas/ContainerProbeOutSerializerV2/properties/period_seconds' - "$.components.schemas.ContainerProbeOutSerializerV2.properties.period_seconds" - """ + """How often (in seconds) to perform the probe.""" success_threshold: int - """ - '#/components/schemas/ContainerProbeOutSerializerV2/properties/success_threshold' - "$.components.schemas.ContainerProbeOutSerializerV2.properties.success_threshold" - """ + """The number of consecutive successful probes that mark the container as healthy.""" tcp_socket: Optional[ContainerProbeTcpSocket] = None - """ - '#/components/schemas/ContainerProbeOutSerializerV2/properties/tcp_socket/anyOf/0' - "$.components.schemas.ContainerProbeOutSerializerV2.properties.tcp_socket.anyOf[0]" - """ + """TCP socket probe configuration""" timeout_seconds: int - """ - '#/components/schemas/ContainerProbeOutSerializerV2/properties/timeout_seconds' - "$.components.schemas.ContainerProbeOutSerializerV2.properties.timeout_seconds" - """ + """The timeout for each probe.""" diff --git a/src/gcore/types/cloud/container_probe_config.py b/src/gcore/types/cloud/container_probe_config.py index fbefe4ec..39c2f379 100644 --- a/src/gcore/types/cloud/container_probe_config.py +++ b/src/gcore/types/cloud/container_probe_config.py @@ -10,13 +10,7 @@ class ContainerProbeConfig(BaseModel): enabled: bool - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationOutSerializerV2/properties/enabled' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationOutSerializerV2.properties.enabled" - """ + """Whether the probe is enabled or not.""" probe: Optional[ContainerProbe] = None - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationOutSerializerV2/properties/probe/anyOf/0' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationOutSerializerV2.properties.probe.anyOf[0]" - """ + """Probe configuration (exec, http_get or tcp_socket)""" diff --git a/src/gcore/types/cloud/container_probe_config_create_param.py b/src/gcore/types/cloud/container_probe_config_create_param.py index a8e715d5..7c6d0695 100644 --- a/src/gcore/types/cloud/container_probe_config_create_param.py +++ b/src/gcore/types/cloud/container_probe_config_create_param.py @@ -12,13 +12,7 @@ class ContainerProbeConfigCreateParam(TypedDict, total=False): enabled: Required[bool] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/enabled' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.enabled" - """ + """Whether the probe is enabled or not.""" probe: Optional[ContainerProbeCreateParam] - """ - '#/components/schemas/InferenceInstanceContainerProbeConfigurationSerializerV2/properties/probe/anyOf/0' - "$.components.schemas.InferenceInstanceContainerProbeConfigurationSerializerV2.properties.probe.anyOf[0]" - """ + """Probe configuration (exec, http_get or tcp_socket)""" diff --git a/src/gcore/types/cloud/container_probe_create_param.py b/src/gcore/types/cloud/container_probe_create_param.py index c6a35b4a..5163d9ac 100644 --- a/src/gcore/types/cloud/container_probe_create_param.py +++ b/src/gcore/types/cloud/container_probe_create_param.py @@ -14,49 +14,25 @@ class ContainerProbeCreateParam(TypedDict, total=False): exec: Optional[ContainerProbeExecCreateParam] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/exec/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.exec.anyOf[0]" - """ + """Exec probe configuration""" failure_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/failure_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.failure_threshold" - """ + """The number of consecutive probe failures that mark the container as unhealthy.""" http_get: Optional[ContainerProbeHTTPGetCreateParam] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/http_get/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.http_get.anyOf[0]" - """ + """HTTP GET probe configuration""" initial_delay_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/initial_delay_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.initial_delay_seconds" - """ + """The initial delay before starting the first probe.""" period_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/period_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.period_seconds" - """ + """How often (in seconds) to perform the probe.""" success_threshold: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/success_threshold' - "$.components.schemas.ContainerProbeSerializerV2.properties.success_threshold" - """ + """The number of consecutive successful probes that mark the container as healthy.""" tcp_socket: Optional[ContainerProbeTcpSocketCreateParam] - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/tcp_socket/anyOf/0' - "$.components.schemas.ContainerProbeSerializerV2.properties.tcp_socket.anyOf[0]" - """ + """TCP socket probe configuration""" timeout_seconds: int - """ - '#/components/schemas/ContainerProbeSerializerV2/properties/timeout_seconds' - "$.components.schemas.ContainerProbeSerializerV2.properties.timeout_seconds" - """ + """The timeout for each probe.""" diff --git a/src/gcore/types/cloud/container_probe_exec.py b/src/gcore/types/cloud/container_probe_exec.py index 3a5c112d..5d8f7c4b 100644 --- a/src/gcore/types/cloud/container_probe_exec.py +++ b/src/gcore/types/cloud/container_probe_exec.py @@ -9,7 +9,4 @@ class ContainerProbeExec(BaseModel): command: List[str] - """ - '#/components/schemas/ContainerProbeExecConfigOutSerializerV2/properties/command' - "$.components.schemas.ContainerProbeExecConfigOutSerializerV2.properties.command" - """ + """Command to be executed inside the running container.""" diff --git a/src/gcore/types/cloud/container_probe_exec_create_param.py b/src/gcore/types/cloud/container_probe_exec_create_param.py index 7b69c2a5..53f1d6a5 100644 --- a/src/gcore/types/cloud/container_probe_exec_create_param.py +++ b/src/gcore/types/cloud/container_probe_exec_create_param.py @@ -10,7 +10,4 @@ class ContainerProbeExecCreateParam(TypedDict, total=False): command: Required[List[str]] - """ - '#/components/schemas/ContainerProbeExecConfigSerializerV2/properties/command' - "$.components.schemas.ContainerProbeExecConfigSerializerV2.properties.command" - """ + """Command to be executed inside the running container.""" diff --git a/src/gcore/types/cloud/container_probe_http_get.py b/src/gcore/types/cloud/container_probe_http_get.py index 6552247b..a5e30713 100644 --- a/src/gcore/types/cloud/container_probe_http_get.py +++ b/src/gcore/types/cloud/container_probe_http_get.py @@ -11,31 +11,16 @@ class ContainerProbeHTTPGet(BaseModel): headers: Dict[str, str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigOutSerializerV2/properties/headers' - "$.components.schemas.ContainerProbeHttpGetConfigOutSerializerV2.properties.headers" - """ + """HTTP headers to be sent with the request.""" host: Optional[str] = None - """ - '#/components/schemas/ContainerProbeHttpGetConfigOutSerializerV2/properties/host/anyOf/0' - "$.components.schemas.ContainerProbeHttpGetConfigOutSerializerV2.properties.host.anyOf[0]" - """ + """Host name to send HTTP request to.""" path: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigOutSerializerV2/properties/path' - "$.components.schemas.ContainerProbeHttpGetConfigOutSerializerV2.properties.path" - """ + """The endpoint to send the HTTP request to.""" port: int - """ - '#/components/schemas/ContainerProbeHttpGetConfigOutSerializerV2/properties/port' - "$.components.schemas.ContainerProbeHttpGetConfigOutSerializerV2.properties.port" - """ + """Port number the probe should connect to.""" schema_: str = FieldInfo(alias="schema") - """ - '#/components/schemas/ContainerProbeHttpGetConfigOutSerializerV2/properties/schema' - "$.components.schemas.ContainerProbeHttpGetConfigOutSerializerV2.properties.schema" - """ + """Schema to use for the HTTP request.""" diff --git a/src/gcore/types/cloud/container_probe_http_get_create_param.py b/src/gcore/types/cloud/container_probe_http_get_create_param.py index b660269a..94075984 100644 --- a/src/gcore/types/cloud/container_probe_http_get_create_param.py +++ b/src/gcore/types/cloud/container_probe_http_get_create_param.py @@ -10,31 +10,16 @@ class ContainerProbeHTTPGetCreateParam(TypedDict, total=False): port: Required[int] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.port" - """ + """Port number the probe should connect to.""" headers: Dict[str, str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/headers' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.headers" - """ + """HTTP headers to be sent with the request.""" host: Optional[str] - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/host/anyOf/0' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.host.anyOf[0]" - """ + """Host name to send HTTP request to.""" path: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/path' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.path" - """ + """The endpoint to send the HTTP request to.""" schema: str - """ - '#/components/schemas/ContainerProbeHttpGetConfigSerializerV2/properties/schema' - "$.components.schemas.ContainerProbeHttpGetConfigSerializerV2.properties.schema" - """ + """Schema to use for the HTTP request.""" diff --git a/src/gcore/types/cloud/container_probe_tcp_socket.py b/src/gcore/types/cloud/container_probe_tcp_socket.py index f384c66f..91c73c79 100644 --- a/src/gcore/types/cloud/container_probe_tcp_socket.py +++ b/src/gcore/types/cloud/container_probe_tcp_socket.py @@ -7,7 +7,4 @@ class ContainerProbeTcpSocket(BaseModel): port: int - """ - '#/components/schemas/ContainerProbeTcpSocketConfigOutSerializerV2/properties/port' - "$.components.schemas.ContainerProbeTcpSocketConfigOutSerializerV2.properties.port" - """ + """Port number to check if it's open.""" diff --git a/src/gcore/types/cloud/container_probe_tcp_socket_create_param.py b/src/gcore/types/cloud/container_probe_tcp_socket_create_param.py index 7fedc87f..c7534ac4 100644 --- a/src/gcore/types/cloud/container_probe_tcp_socket_create_param.py +++ b/src/gcore/types/cloud/container_probe_tcp_socket_create_param.py @@ -9,7 +9,4 @@ class ContainerProbeTcpSocketCreateParam(TypedDict, total=False): port: Required[int] - """ - '#/components/schemas/ContainerProbeTcpSocketConfigSerializerV2/properties/port' - "$.components.schemas.ContainerProbeTcpSocketConfigSerializerV2.properties.port" - """ + """Port number to check if it's open.""" diff --git a/src/gcore/types/cloud/container_scale.py b/src/gcore/types/cloud/container_scale.py index c5686dc7..9378a9df 100644 --- a/src/gcore/types/cloud/container_scale.py +++ b/src/gcore/types/cloud/container_scale.py @@ -10,31 +10,16 @@ class ContainerScale(BaseModel): cooldown_period: Optional[int] = None - """ - '#/components/schemas/ContainerScaleOutSerializerV3/properties/cooldown_period/anyOf/0' - "$.components.schemas.ContainerScaleOutSerializerV3.properties.cooldown_period.anyOf[0]" - """ + """Cooldown period between scaling actions in seconds""" max: int - """ - '#/components/schemas/ContainerScaleOutSerializerV3/properties/max' - "$.components.schemas.ContainerScaleOutSerializerV3.properties.max" - """ + """Maximum scale for the container""" min: int - """ - '#/components/schemas/ContainerScaleOutSerializerV3/properties/min' - "$.components.schemas.ContainerScaleOutSerializerV3.properties.min" - """ + """Minimum scale for the container""" polling_interval: Optional[int] = None - """ - '#/components/schemas/ContainerScaleOutSerializerV3/properties/polling_interval/anyOf/0' - "$.components.schemas.ContainerScaleOutSerializerV3.properties.polling_interval.anyOf[0]" - """ + """Polling interval for scaling triggers in seconds""" triggers: ContainerScaleTriggers - """ - '#/components/schemas/ContainerScaleOutSerializerV3/properties/triggers' - "$.components.schemas.ContainerScaleOutSerializerV3.properties.triggers" - """ + """Triggers for scaling actions""" diff --git a/src/gcore/types/cloud/container_scale_trigger_rate.py b/src/gcore/types/cloud/container_scale_trigger_rate.py index 45e45489..6a0cfa17 100644 --- a/src/gcore/types/cloud/container_scale_trigger_rate.py +++ b/src/gcore/types/cloud/container_scale_trigger_rate.py @@ -7,13 +7,7 @@ class ContainerScaleTriggerRate(BaseModel): rate: int - """ - '#/components/schemas/ContainerScaleTriggersRateOutSerializer/properties/rate' - "$.components.schemas.ContainerScaleTriggersRateOutSerializer.properties.rate" - """ + """Request count per 'window' seconds for the http trigger""" window: int - """ - '#/components/schemas/ContainerScaleTriggersRateOutSerializer/properties/window' - "$.components.schemas.ContainerScaleTriggersRateOutSerializer.properties.window" - """ + """Time window for rate calculation in seconds""" diff --git a/src/gcore/types/cloud/container_scale_trigger_sqs.py b/src/gcore/types/cloud/container_scale_trigger_sqs.py index 366e48da..9c47d420 100644 --- a/src/gcore/types/cloud/container_scale_trigger_sqs.py +++ b/src/gcore/types/cloud/container_scale_trigger_sqs.py @@ -9,49 +9,25 @@ class ContainerScaleTriggerSqs(BaseModel): activation_queue_length: int - """ - '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/activation_queue_length' - "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.activation_queue_length" - """ + """Number of messages for activation""" aws_endpoint: Optional[str] = None - """ - '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/aws_endpoint/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.aws_endpoint.anyOf[0]" - """ + """Custom AWS endpoint""" aws_region: str - """ - '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/aws_region' - "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.aws_region" - """ + """AWS region""" queue_length: int - """ - '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/queue_length' - "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.queue_length" - """ + """Number of messages for one replica""" queue_url: str - """ - '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/queue_url' - "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.queue_url" - """ + """SQS queue URL""" scale_on_delayed: bool - """ - '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/scale_on_delayed' - "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.scale_on_delayed" - """ + """Scale on delayed messages""" scale_on_flight: bool - """ - '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/scale_on_flight' - "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.scale_on_flight" - """ + """Scale on in-flight messages""" secret_name: str - """ - '#/components/schemas/ContainerScaleTriggersSqsOutSerializer/properties/secret_name' - "$.components.schemas.ContainerScaleTriggersSqsOutSerializer.properties.secret_name" - """ + """Auth secret name""" diff --git a/src/gcore/types/cloud/container_scale_trigger_threshold.py b/src/gcore/types/cloud/container_scale_trigger_threshold.py index d2a50647..c5ad7388 100644 --- a/src/gcore/types/cloud/container_scale_trigger_threshold.py +++ b/src/gcore/types/cloud/container_scale_trigger_threshold.py @@ -7,7 +7,4 @@ class ContainerScaleTriggerThreshold(BaseModel): threshold: int - """ - '#/components/schemas/ContainerScaleTriggersThresholdOutSerializer/properties/threshold' - "$.components.schemas.ContainerScaleTriggersThresholdOutSerializer.properties.threshold" - """ + """Threshold value for the trigger in percentage""" diff --git a/src/gcore/types/cloud/container_scale_triggers.py b/src/gcore/types/cloud/container_scale_triggers.py index dceeedc6..abdd43d7 100644 --- a/src/gcore/types/cloud/container_scale_triggers.py +++ b/src/gcore/types/cloud/container_scale_triggers.py @@ -12,37 +12,25 @@ class ContainerScaleTriggers(BaseModel): cpu: Optional[ContainerScaleTriggerThreshold] = None - """ - '#/components/schemas/ContainerScaleTriggersOutSerializer/properties/cpu/anyOf/0' - "$.components.schemas.ContainerScaleTriggersOutSerializer.properties.cpu.anyOf[0]" - """ + """CPU trigger configuration""" gpu_memory: Optional[ContainerScaleTriggerThreshold] = None - """ - '#/components/schemas/ContainerScaleTriggersOutSerializer/properties/gpu_memory/anyOf/0' - "$.components.schemas.ContainerScaleTriggersOutSerializer.properties.gpu_memory.anyOf[0]" + """GPU memory trigger configuration. + + Calculated by DCGM_FI_DEV_MEM_COPY_UTIL metric """ gpu_utilization: Optional[ContainerScaleTriggerThreshold] = None - """ - '#/components/schemas/ContainerScaleTriggersOutSerializer/properties/gpu_utilization/anyOf/0' - "$.components.schemas.ContainerScaleTriggersOutSerializer.properties.gpu_utilization.anyOf[0]" + """GPU utilization trigger configuration. + + Calculated by DCGM_FI_DEV_GPU_UTIL metric """ http: Optional[ContainerScaleTriggerRate] = None - """ - '#/components/schemas/ContainerScaleTriggersOutSerializer/properties/http/anyOf/0' - "$.components.schemas.ContainerScaleTriggersOutSerializer.properties.http.anyOf[0]" - """ + """HTTP trigger configuration""" memory: Optional[ContainerScaleTriggerThreshold] = None - """ - '#/components/schemas/ContainerScaleTriggersOutSerializer/properties/memory/anyOf/0' - "$.components.schemas.ContainerScaleTriggersOutSerializer.properties.memory.anyOf[0]" - """ + """Memory trigger configuration""" sqs: Optional[ContainerScaleTriggerSqs] = None - """ - '#/components/schemas/ContainerScaleTriggersOutSerializer/properties/sqs/anyOf/0' - "$.components.schemas.ContainerScaleTriggersOutSerializer.properties.sqs.anyOf[0]" - """ + """SQS trigger configuration""" diff --git a/src/gcore/types/cloud/ddos_profile.py b/src/gcore/types/cloud/ddos_profile.py index 6efc8eb3..f84c69cd 100644 --- a/src/gcore/types/cloud/ddos_profile.py +++ b/src/gcore/types/cloud/ddos_profile.py @@ -13,49 +13,21 @@ class DDOSProfile(BaseModel): id: int - """ - '#/components/schemas/GetClientProfileSerializer/properties/id' - "$.components.schemas.GetClientProfileSerializer.properties.id" - """ + """DDoS protection profile ID""" profile_template: DDOSProfileTemplate - """ - '#/components/schemas/GetClientProfileSerializer/properties/profile_template' - "$.components.schemas.GetClientProfileSerializer.properties.profile_template" - """ + """Template data""" fields: Optional[List[DDOSProfileField]] = None - """ - '#/components/schemas/GetClientProfileSerializer/properties/fields' - "$.components.schemas.GetClientProfileSerializer.properties.fields" - """ options: Optional[DDOSProfileOptionList] = None - """ - '#/components/schemas/GetClientProfileSerializer/properties/options/anyOf/0' - "$.components.schemas.GetClientProfileSerializer.properties.options.anyOf[0]" - """ profile_template_description: Optional[str] = None - """ - '#/components/schemas/GetClientProfileSerializer/properties/profile_template_description/anyOf/0' - "$.components.schemas.GetClientProfileSerializer.properties.profile_template_description.anyOf[0]" - """ + """DDoS profile template description""" protocols: Optional[List[object]] = None - """ - '#/components/schemas/GetClientProfileSerializer/properties/protocols/anyOf/0' - "$.components.schemas.GetClientProfileSerializer.properties.protocols.anyOf[0]" - """ + """List of protocols""" site: Optional[str] = None - """ - '#/components/schemas/GetClientProfileSerializer/properties/site/anyOf/0' - "$.components.schemas.GetClientProfileSerializer.properties.site.anyOf[0]" - """ status: Optional[DDOSProfileStatus] = None - """ - '#/components/schemas/GetClientProfileSerializer/properties/status/anyOf/0' - "$.components.schemas.GetClientProfileSerializer.properties.status.anyOf[0]" - """ diff --git a/src/gcore/types/cloud/ddos_profile_field.py b/src/gcore/types/cloud/ddos_profile_field.py index 8d803d00..6ec1b6c8 100644 --- a/src/gcore/types/cloud/ddos_profile_field.py +++ b/src/gcore/types/cloud/ddos_profile_field.py @@ -9,67 +9,23 @@ class DDOSProfileField(BaseModel): id: int - """ - '#/components/schemas/ClientProfileFieldSerializer/properties/id' - "$.components.schemas.ClientProfileFieldSerializer.properties.id" - """ default: object - """ - '#/components/schemas/ClientProfileFieldSerializer/properties/default' - "$.components.schemas.ClientProfileFieldSerializer.properties['default']" - """ description: str - """ - '#/components/schemas/ClientProfileFieldSerializer/properties/description' - "$.components.schemas.ClientProfileFieldSerializer.properties.description" - """ field_value: object - """ - '#/components/schemas/ClientProfileFieldSerializer/properties/field_value' - "$.components.schemas.ClientProfileFieldSerializer.properties.field_value" - """ name: str - """ - '#/components/schemas/ClientProfileFieldSerializer/properties/name' - "$.components.schemas.ClientProfileFieldSerializer.properties.name" - """ base_field: Optional[int] = None - """ - '#/components/schemas/ClientProfileFieldSerializer/properties/base_field/anyOf/0' - "$.components.schemas.ClientProfileFieldSerializer.properties.base_field.anyOf[0]" - """ field_name: Optional[str] = None - """ - '#/components/schemas/ClientProfileFieldSerializer/properties/field_name/anyOf/0' - "$.components.schemas.ClientProfileFieldSerializer.properties.field_name.anyOf[0]" - """ field_type: Optional[str] = None - """ - '#/components/schemas/ClientProfileFieldSerializer/properties/field_type/anyOf/0' - "$.components.schemas.ClientProfileFieldSerializer.properties.field_type.anyOf[0]" - """ required: Optional[bool] = None - """ - '#/components/schemas/ClientProfileFieldSerializer/properties/required/anyOf/0' - "$.components.schemas.ClientProfileFieldSerializer.properties.required.anyOf[0]" - """ validation_schema: Optional[object] = None - """ - '#/components/schemas/ClientProfileFieldSerializer/properties/validation_schema' - "$.components.schemas.ClientProfileFieldSerializer.properties.validation_schema" - """ value: Optional[str] = None - """ - '#/components/schemas/ClientProfileFieldSerializer/properties/value/anyOf/0' - "$.components.schemas.ClientProfileFieldSerializer.properties.value.anyOf[0]" - """ diff --git a/src/gcore/types/cloud/ddos_profile_option_list.py b/src/gcore/types/cloud/ddos_profile_option_list.py index 199aedc2..d3638aa9 100644 --- a/src/gcore/types/cloud/ddos_profile_option_list.py +++ b/src/gcore/types/cloud/ddos_profile_option_list.py @@ -9,13 +9,7 @@ class DDOSProfileOptionList(BaseModel): active: Optional[bool] = None - """ - '#/components/schemas/ProfileOptionsSerializer/properties/active/anyOf/0' - "$.components.schemas.ProfileOptionsSerializer.properties.active.anyOf[0]" - """ + """Activate profile.""" bgp: Optional[bool] = None - """ - '#/components/schemas/ProfileOptionsSerializer/properties/bgp/anyOf/0' - "$.components.schemas.ProfileOptionsSerializer.properties.bgp.anyOf[0]" - """ + """Activate BGP protocol.""" diff --git a/src/gcore/types/cloud/ddos_profile_status.py b/src/gcore/types/cloud/ddos_profile_status.py index a291dfdd..b6b7ea5f 100644 --- a/src/gcore/types/cloud/ddos_profile_status.py +++ b/src/gcore/types/cloud/ddos_profile_status.py @@ -7,13 +7,7 @@ class DDOSProfileStatus(BaseModel): error_description: str - """ - '#/components/schemas/DdosProfileStatusSerializer/properties/error_description' - "$.components.schemas.DdosProfileStatusSerializer.properties.error_description" - """ + """Description of the error, if it exists""" status: str - """ - '#/components/schemas/DdosProfileStatusSerializer/properties/status' - "$.components.schemas.DdosProfileStatusSerializer.properties.status" - """ + """Profile status""" diff --git a/src/gcore/types/cloud/ddos_profile_template.py b/src/gcore/types/cloud/ddos_profile_template.py index 5786e0db..f3154487 100644 --- a/src/gcore/types/cloud/ddos_profile_template.py +++ b/src/gcore/types/cloud/ddos_profile_template.py @@ -10,25 +10,9 @@ class DDOSProfileTemplate(BaseModel): id: int - """ - '#/components/schemas/ClientProfileTemplateSerializer/properties/id' - "$.components.schemas.ClientProfileTemplateSerializer.properties.id" - """ name: str - """ - '#/components/schemas/ClientProfileTemplateSerializer/properties/name' - "$.components.schemas.ClientProfileTemplateSerializer.properties.name" - """ description: Optional[str] = None - """ - '#/components/schemas/ClientProfileTemplateSerializer/properties/description/anyOf/0' - "$.components.schemas.ClientProfileTemplateSerializer.properties.description.anyOf[0]" - """ fields: Optional[List[DDOSProfileTemplateField]] = None - """ - '#/components/schemas/ClientProfileTemplateSerializer/properties/fields' - "$.components.schemas.ClientProfileTemplateSerializer.properties.fields" - """ diff --git a/src/gcore/types/cloud/ddos_profile_template_field.py b/src/gcore/types/cloud/ddos_profile_template_field.py index 34d590c2..df9a9078 100644 --- a/src/gcore/types/cloud/ddos_profile_template_field.py +++ b/src/gcore/types/cloud/ddos_profile_template_field.py @@ -9,43 +9,15 @@ class DDOSProfileTemplateField(BaseModel): id: int - """ - '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/id' - "$.components.schemas.ClientProfileTemplateFieldSerializer.properties.id" - """ name: str - """ - '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/name' - "$.components.schemas.ClientProfileTemplateFieldSerializer.properties.name" - """ default: Optional[str] = None - """ - '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/default/anyOf/0' - "$.components.schemas.ClientProfileTemplateFieldSerializer.properties['default'].anyOf[0]" - """ description: Optional[str] = None - """ - '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/description/anyOf/0' - "$.components.schemas.ClientProfileTemplateFieldSerializer.properties.description.anyOf[0]" - """ field_type: Optional[str] = None - """ - '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/field_type/anyOf/0' - "$.components.schemas.ClientProfileTemplateFieldSerializer.properties.field_type.anyOf[0]" - """ required: Optional[bool] = None - """ - '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/required/anyOf/0' - "$.components.schemas.ClientProfileTemplateFieldSerializer.properties.required.anyOf[0]" - """ validation_schema: Optional[object] = None - """ - '#/components/schemas/ClientProfileTemplateFieldSerializer/properties/validation_schema' - "$.components.schemas.ClientProfileTemplateFieldSerializer.properties.validation_schema" - """ diff --git a/src/gcore/types/cloud/deploy_status.py b/src/gcore/types/cloud/deploy_status.py index 720d1af4..396147f9 100644 --- a/src/gcore/types/cloud/deploy_status.py +++ b/src/gcore/types/cloud/deploy_status.py @@ -7,13 +7,7 @@ class DeployStatus(BaseModel): ready: int - """ - '#/components/schemas/DeployStatusSerializer/properties/ready' - "$.components.schemas.DeployStatusSerializer.properties.ready" - """ + """Number of ready instances""" total: int - """ - '#/components/schemas/DeployStatusSerializer/properties/total' - "$.components.schemas.DeployStatusSerializer.properties.total" - """ + """Total number of instances""" diff --git a/src/gcore/types/cloud/detailed_lb_pool.py b/src/gcore/types/cloud/detailed_lb_pool.py index c39481fc..1f50fd02 100644 --- a/src/gcore/types/cloud/detailed_lb_pool.py +++ b/src/gcore/types/cloud/detailed_lb_pool.py @@ -16,131 +16,72 @@ class Listener(BaseModel): id: str - """ - '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' - "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" - """ + """Resource ID""" class Loadbalancer(BaseModel): id: str - """ - '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' - "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" - """ + """Resource ID""" class DetailedLbPool(BaseModel): id: str - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/id' - "$.components.schemas.DetailedLbPoolSerializer.properties.id" - """ + """Pool ID""" ca_secret_id: Optional[str] = None - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/ca_secret_id/anyOf/0' - "$.components.schemas.DetailedLbPoolSerializer.properties.ca_secret_id.anyOf[0]" - """ + """Secret ID of CA certificate bundle""" crl_secret_id: Optional[str] = None - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/crl_secret_id/anyOf/0' - "$.components.schemas.DetailedLbPoolSerializer.properties.crl_secret_id.anyOf[0]" - """ + """Secret ID of CA revocation list file""" lb_algorithm: LbAlgorithm - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/lb_algorithm' - "$.components.schemas.DetailedLbPoolSerializer.properties.lb_algorithm" - """ + """Load balancer algorithm""" listeners: List[Listener] - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/listeners' - "$.components.schemas.DetailedLbPoolSerializer.properties.listeners" - """ + """Listeners IDs""" loadbalancers: List[Loadbalancer] - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/loadbalancers' - "$.components.schemas.DetailedLbPoolSerializer.properties.loadbalancers" - """ + """Load balancers IDs""" members: List[DetailedLbPoolMember] - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/members' - "$.components.schemas.DetailedLbPoolSerializer.properties.members" - """ + """Pool members""" name: str - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/name' - "$.components.schemas.DetailedLbPoolSerializer.properties.name" - """ + """Pool name""" operating_status: LoadBalancerOperatingStatus - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/operating_status' - "$.components.schemas.DetailedLbPoolSerializer.properties.operating_status" - """ + """Pool operating status""" protocol: LbPoolProtocol - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/protocol' - "$.components.schemas.DetailedLbPoolSerializer.properties.protocol" - """ + """Protocol""" provisioning_status: ProvisioningStatus - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/provisioning_status' - "$.components.schemas.DetailedLbPoolSerializer.properties.provisioning_status" - """ + """Pool lifecycle status""" secret_id: Optional[str] = None - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.DetailedLbPoolSerializer.properties.secret_id.anyOf[0]" - """ + """Secret ID for TLS client authentication to the member servers""" session_persistence: Optional[LbSessionPersistence] = None - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/session_persistence/anyOf/0' - "$.components.schemas.DetailedLbPoolSerializer.properties.session_persistence.anyOf[0]" - """ + """Session persistence parameters""" timeout_client_data: Optional[int] = None - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.DetailedLbPoolSerializer.properties.timeout_client_data.anyOf[0]" - """ + """Frontend client inactivity timeout in milliseconds""" timeout_member_connect: Optional[int] = None - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.DetailedLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" - """ + """Backend member connection timeout in milliseconds""" timeout_member_data: Optional[int] = None - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.DetailedLbPoolSerializer.properties.timeout_member_data.anyOf[0]" - """ + """Backend member inactivity timeout in milliseconds""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.DetailedLbPoolSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" healthmonitor: Optional[LbHealthMonitor] = None - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/healthmonitor/anyOf/0' - "$.components.schemas.DetailedLbPoolSerializer.properties.healthmonitor.anyOf[0]" - """ + """Health monitor parameters""" task_id: Optional[str] = None - """ - '#/components/schemas/DetailedLbPoolSerializer/properties/task_id/anyOf/0' - "$.components.schemas.DetailedLbPoolSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ diff --git a/src/gcore/types/cloud/detailed_lb_pool_list.py b/src/gcore/types/cloud/detailed_lb_pool_list.py index 8dd06f86..405fd06e 100644 --- a/src/gcore/types/cloud/detailed_lb_pool_list.py +++ b/src/gcore/types/cloud/detailed_lb_pool_list.py @@ -10,13 +10,7 @@ class DetailedLbPoolList(BaseModel): count: int - """ - '#/components/schemas/DetailedLbPoolSerializerList/properties/count' - "$.components.schemas.DetailedLbPoolSerializerList.properties.count" - """ + """Number of objects""" results: List[DetailedLbPool] - """ - '#/components/schemas/DetailedLbPoolSerializerList/properties/results' - "$.components.schemas.DetailedLbPoolSerializerList.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/detailed_lb_pool_member.py b/src/gcore/types/cloud/detailed_lb_pool_member.py index 4c5401c4..8b53b985 100644 --- a/src/gcore/types/cloud/detailed_lb_pool_member.py +++ b/src/gcore/types/cloud/detailed_lb_pool_member.py @@ -11,61 +11,37 @@ class DetailedLbPoolMember(BaseModel): id: str - """ - '#/components/schemas/DetailedLbPoolMemberSerializer/properties/id' - "$.components.schemas.DetailedLbPoolMemberSerializer.properties.id" - """ + """Member ID must be provided if an existing member is being updated""" address: str - """ - '#/components/schemas/DetailedLbPoolMemberSerializer/properties/address' - "$.components.schemas.DetailedLbPoolMemberSerializer.properties.address" - """ + """Member IP address""" admin_state_up: bool - """ - '#/components/schemas/DetailedLbPoolMemberSerializer/properties/admin_state_up' - "$.components.schemas.DetailedLbPoolMemberSerializer.properties.admin_state_up" - """ + """true if enabled. Defaults to true""" operating_status: LoadBalancerOperatingStatus - """ - '#/components/schemas/DetailedLbPoolMemberSerializer/properties/operating_status' - "$.components.schemas.DetailedLbPoolMemberSerializer.properties.operating_status" - """ + """Member operating status of the entity""" protocol_port: int - """ - '#/components/schemas/DetailedLbPoolMemberSerializer/properties/protocol_port' - "$.components.schemas.DetailedLbPoolMemberSerializer.properties.protocol_port" - """ + """Member IP port""" provisioning_status: ProvisioningStatus - """ - '#/components/schemas/DetailedLbPoolMemberSerializer/properties/provisioning_status' - "$.components.schemas.DetailedLbPoolMemberSerializer.properties.provisioning_status" - """ + """Pool member lifecycle status""" weight: int - """ - '#/components/schemas/DetailedLbPoolMemberSerializer/properties/weight' - "$.components.schemas.DetailedLbPoolMemberSerializer.properties.weight" - """ + """Member weight. Valid values: 0 to 256, defaults to 1""" monitor_address: Optional[str] = None - """ - '#/components/schemas/DetailedLbPoolMemberSerializer/properties/monitor_address/anyOf/0' - "$.components.schemas.DetailedLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" + """An alternate IP address used for health monitoring of a backend member. + + Default is null which monitors the member address. """ monitor_port: Optional[int] = None - """ - '#/components/schemas/DetailedLbPoolMemberSerializer/properties/monitor_port/anyOf/0' - "$.components.schemas.DetailedLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" + """An alternate protocol port used for health monitoring of a backend member. + + Default is null which monitors the member protocol_port. """ subnet_id: Optional[str] = None - """ - '#/components/schemas/DetailedLbPoolMemberSerializer/properties/subnet_id/anyOf/0' - "$.components.schemas.DetailedLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" - """ + """Either subnet_id or instance_id should be provided""" diff --git a/src/gcore/types/cloud/file_share.py b/src/gcore/types/cloud/file_share.py index d3199ba0..323b4a39 100644 --- a/src/gcore/types/cloud/file_share.py +++ b/src/gcore/types/cloud/file_share.py @@ -11,82 +11,46 @@ class FileShare(BaseModel): id: str - """ - '#/components/schemas/FileShareSerializer/properties/id' - "$.components.schemas.FileShareSerializer.properties.id" - """ + """File share ID""" connection_point: Optional[str] = None - """ - '#/components/schemas/FileShareSerializer/properties/connection_point/anyOf/0' - "$.components.schemas.FileShareSerializer.properties.connection_point.anyOf[0]" - """ + """Connection point. Can be null during File share creation""" created_at: str - """ - '#/components/schemas/FileShareSerializer/properties/created_at' - "$.components.schemas.FileShareSerializer.properties.created_at" - """ + """Datetime when the file share was created""" creator_task_id: str - """ - '#/components/schemas/FileShareSerializer/properties/creator_task_id' - "$.components.schemas.FileShareSerializer.properties.creator_task_id" - """ + """Task that created this entity""" name: str - """ - '#/components/schemas/FileShareSerializer/properties/name' - "$.components.schemas.FileShareSerializer.properties.name" - """ + """File share name""" network_id: str - """ - '#/components/schemas/FileShareSerializer/properties/network_id' - "$.components.schemas.FileShareSerializer.properties.network_id" - """ + """Network ID.""" network_name: str - """ - '#/components/schemas/FileShareSerializer/properties/network_name' - "$.components.schemas.FileShareSerializer.properties.network_name" - """ + """Network name.""" project_id: int - """ - '#/components/schemas/FileShareSerializer/properties/project_id' - "$.components.schemas.FileShareSerializer.properties.project_id" - """ + """Project ID""" protocol: str - """ - '#/components/schemas/FileShareSerializer/properties/protocol' - "$.components.schemas.FileShareSerializer.properties.protocol" - """ + """File share protocol""" region: str - """ - '#/components/schemas/FileShareSerializer/properties/region' - "$.components.schemas.FileShareSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/FileShareSerializer/properties/region_id' - "$.components.schemas.FileShareSerializer.properties.region_id" - """ + """Region ID""" share_network_name: Optional[str] = None - """ - '#/components/schemas/FileShareSerializer/properties/share_network_name/anyOf/0' - "$.components.schemas.FileShareSerializer.properties.share_network_name.anyOf[0]" + """Share network name. + + May be null if the file share was created with volume type VAST """ size: int - """ - '#/components/schemas/FileShareSerializer/properties/size' - "$.components.schemas.FileShareSerializer.properties.size" - """ + """File share size, GiB""" status: Literal[ "available", @@ -118,37 +82,30 @@ class FileShare(BaseModel): "unmanage_starting", "unmanaged", ] - """ - '#/components/schemas/FileShareSerializer/properties/status' - "$.components.schemas.FileShareSerializer.properties.status" - """ + """File share status""" subnet_id: str - """ - '#/components/schemas/FileShareSerializer/properties/subnet_id' - "$.components.schemas.FileShareSerializer.properties.subnet_id" - """ + """Subnet ID.""" subnet_name: str - """ - '#/components/schemas/FileShareSerializer/properties/subnet_name' - "$.components.schemas.FileShareSerializer.properties.subnet_name" - """ + """Subnet name.""" tags: List[Tag] - """ - '#/components/schemas/FileShareSerializer/properties/tags' - "$.components.schemas.FileShareSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ task_id: Optional[str] = None - """ - '#/components/schemas/FileShareSerializer/properties/task_id/anyOf/0' - "$.components.schemas.FileShareSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ volume_type: Literal["default_share_type", "vast_share_type"] - """ - '#/components/schemas/FileShareSerializer/properties/volume_type' - "$.components.schemas.FileShareSerializer.properties.volume_type" - """ + """File share disk type""" diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index 9532bdfc..efa9dc40 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -18,129 +18,86 @@ class CreateStandardFileShareSerializer(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[1].schema" - """ + """Region ID""" name: Required[str] - """ - '#/components/schemas/CreateStandardFileShareSerializer/properties/name' - "$.components.schemas.CreateStandardFileShareSerializer.properties.name" - """ + """File share name""" network: Required[CreateStandardFileShareSerializerNetwork] - """ - '#/components/schemas/CreateStandardFileShareSerializer/properties/network' - "$.components.schemas.CreateStandardFileShareSerializer.properties.network" - """ + """File share network configuration""" protocol: Required[Literal["NFS"]] - """ - '#/components/schemas/CreateStandardFileShareSerializer/properties/protocol' - "$.components.schemas.CreateStandardFileShareSerializer.properties.protocol" - """ + """File share protocol""" size: Required[int] - """ - '#/components/schemas/CreateStandardFileShareSerializer/properties/size' - "$.components.schemas.CreateStandardFileShareSerializer.properties.size" - """ + """File share size""" access: Iterable[CreateStandardFileShareSerializerAccess] - """ - '#/components/schemas/CreateStandardFileShareSerializer/properties/access' - "$.components.schemas.CreateStandardFileShareSerializer.properties.access" - """ + """Access Rules""" tags: TagUpdateListParam - """ - '#/components/schemas/CreateStandardFileShareSerializer/properties/tags' - "$.components.schemas.CreateStandardFileShareSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. """ volume_type: Literal["default_share_type"] - """ - '#/components/schemas/CreateStandardFileShareSerializer/properties/volume_type' - "$.components.schemas.CreateStandardFileShareSerializer.properties.volume_type" - """ + """File share volume type""" class CreateStandardFileShareSerializerNetwork(TypedDict, total=False): network_id: Required[str] - """ - '#/components/schemas/FileShareNetworkSerializer/properties/network_id' - "$.components.schemas.FileShareNetworkSerializer.properties.network_id" - """ + """Network ID.""" subnet_id: str - """ - '#/components/schemas/FileShareNetworkSerializer/properties/subnet_id' - "$.components.schemas.FileShareNetworkSerializer.properties.subnet_id" + """Subnetwork ID. + + If the subnet is not selected, it will be selected automatically. """ class CreateStandardFileShareSerializerAccess(TypedDict, total=False): access_mode: Required[Literal["ro", "rw"]] - """ - '#/components/schemas/CreateAccessRuleSerializer/properties/access_mode' - "$.components.schemas.CreateAccessRuleSerializer.properties.access_mode" - """ + """Access mode""" ip_address: Required[str] - """ - '#/components/schemas/CreateAccessRuleSerializer/properties/ip_address/anyOf/0' - "$.components.schemas.CreateAccessRuleSerializer.properties.ip_address.anyOf[0]" - """ + """Source IP or network""" class CreateVastFileShareSerializer(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].post.parameters[1].schema" - """ + """Region ID""" name: Required[str] - """ - '#/components/schemas/CreateVastFileShareSerializer/properties/name' - "$.components.schemas.CreateVastFileShareSerializer.properties.name" - """ + """File share name""" protocol: Required[Literal["NFS"]] - """ - '#/components/schemas/CreateVastFileShareSerializer/properties/protocol' - "$.components.schemas.CreateVastFileShareSerializer.properties.protocol" - """ + """File share protocol""" size: Required[int] - """ - '#/components/schemas/CreateVastFileShareSerializer/properties/size' - "$.components.schemas.CreateVastFileShareSerializer.properties.size" - """ + """File share size""" volume_type: Required[Literal["vast_share_type"]] - """ - '#/components/schemas/CreateVastFileShareSerializer/properties/volume_type' - "$.components.schemas.CreateVastFileShareSerializer.properties.volume_type" - """ + """File share volume type""" tags: TagUpdateListParam - """ - '#/components/schemas/CreateVastFileShareSerializer/properties/tags' - "$.components.schemas.CreateVastFileShareSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ diff --git a/src/gcore/types/cloud/file_share_list_params.py b/src/gcore/types/cloud/file_share_list_params.py index 3fe60a78..924f9e87 100644 --- a/src/gcore/types/cloud/file_share_list_params.py +++ b/src/gcore/types/cloud/file_share_list_params.py @@ -9,25 +9,16 @@ class FileShareListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[1].schema" - """ + """Region ID""" limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[2]" - """ + """Optional. Limit the number of returned items""" offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}'].get.parameters[3]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ diff --git a/src/gcore/types/cloud/file_share_resize_params.py b/src/gcore/types/cloud/file_share_resize_params.py index d257990a..8f135a4d 100644 --- a/src/gcore/types/cloud/file_share_resize_params.py +++ b/src/gcore/types/cloud/file_share_resize_params.py @@ -9,19 +9,10 @@ class FileShareResizeParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Fextend/post/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend'].post.parameters[1].schema" - """ + """Region ID""" size: Required[int] - """ - '#/components/schemas/ResizeSfsSerializer/properties/size' - "$.components.schemas.ResizeSfsSerializer.properties.size" - """ + """File Share new size in GiB.""" diff --git a/src/gcore/types/cloud/file_share_update_params.py b/src/gcore/types/cloud/file_share_update_params.py index 22254727..e5940b87 100644 --- a/src/gcore/types/cloud/file_share_update_params.py +++ b/src/gcore/types/cloud/file_share_update_params.py @@ -9,19 +9,10 @@ class FileShareUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}'].patch.parameters[1].schema" - """ + """Region ID""" name: Required[str] - """ - '#/components/schemas/NameSerializer/properties/name' - "$.components.schemas.NameSerializer.properties.name" - """ + """Name.""" diff --git a/src/gcore/types/cloud/file_shares/access_rule.py b/src/gcore/types/cloud/file_shares/access_rule.py index b46d99a9..49d04b63 100644 --- a/src/gcore/types/cloud/file_shares/access_rule.py +++ b/src/gcore/types/cloud/file_shares/access_rule.py @@ -9,25 +9,13 @@ class AccessRule(BaseModel): id: str - """ - '#/components/schemas/AccessRuleSerializer/properties/id' - "$.components.schemas.AccessRuleSerializer.properties.id" - """ + """Access Rule ID""" access_level: Literal["ro", "rw"] - """ - '#/components/schemas/AccessRuleSerializer/properties/access_level' - "$.components.schemas.AccessRuleSerializer.properties.access_level" - """ + """Access mode""" access_to: str - """ - '#/components/schemas/AccessRuleSerializer/properties/access_to/anyOf/0' - "$.components.schemas.AccessRuleSerializer.properties.access_to.anyOf[0]" - """ + """Source IP or network""" state: Literal["active", "applying", "denying", "error", "new", "queued_to_apply", "queued_to_deny"] - """ - '#/components/schemas/AccessRuleSerializer/properties/state' - "$.components.schemas.AccessRuleSerializer.properties.state" - """ + """Access Rule state""" diff --git a/src/gcore/types/cloud/file_shares/access_rule_create_params.py b/src/gcore/types/cloud/file_shares/access_rule_create_params.py index 462708cb..6edc7b7d 100644 --- a/src/gcore/types/cloud/file_shares/access_rule_create_params.py +++ b/src/gcore/types/cloud/file_shares/access_rule_create_params.py @@ -9,25 +9,13 @@ class AccessRuleCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/0/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffile_shares%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfile_share_id%7D%2Faccess_rule/post/parameters/1/schema' - "$.paths['/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule'].post.parameters[1].schema" - """ + """Region ID""" access_mode: Required[Literal["ro", "rw"]] - """ - '#/components/schemas/CreateAccessRuleSerializer/properties/access_mode' - "$.components.schemas.CreateAccessRuleSerializer.properties.access_mode" - """ + """Access mode""" ip_address: Required[str] - """ - '#/components/schemas/CreateAccessRuleSerializer/properties/ip_address/anyOf/0' - "$.components.schemas.CreateAccessRuleSerializer.properties.ip_address.anyOf[0]" - """ + """Source IP or network""" diff --git a/src/gcore/types/cloud/file_shares/access_rule_list.py b/src/gcore/types/cloud/file_shares/access_rule_list.py index d5440663..2951c96d 100644 --- a/src/gcore/types/cloud/file_shares/access_rule_list.py +++ b/src/gcore/types/cloud/file_shares/access_rule_list.py @@ -10,13 +10,7 @@ class AccessRuleList(BaseModel): count: int - """ - '#/components/schemas/AccessRuleCollectionSerializer/properties/count' - "$.components.schemas.AccessRuleCollectionSerializer.properties.count" - """ + """Number of objects""" results: List[AccessRule] - """ - '#/components/schemas/AccessRuleCollectionSerializer/properties/results' - "$.components.schemas.AccessRuleCollectionSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/fixed_address.py b/src/gcore/types/cloud/fixed_address.py index 5d01bab4..995d2c83 100644 --- a/src/gcore/types/cloud/fixed_address.py +++ b/src/gcore/types/cloud/fixed_address.py @@ -10,31 +10,29 @@ class FixedAddress(BaseModel): addr: str - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/addr' - "$.components.schemas.InstanceFixedAddressSerializer.properties.addr" - """ + """IP address""" interface_name: Optional[str] = None - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.InstanceFixedAddressSerializer.properties.interface_name.anyOf[0]" + """Interface name. + + This field will be `null` if `with_interfaces_name=true` is not set in the + request when listing instances. It will also be `null` if the `interface_name` + was not specified during instance creation or when attaching the interface. """ subnet_id: str - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_id' - "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_id" + """The unique identifier of the subnet associated with this address. + + Included only in the response for a single-resource lookup (GET by ID). For the + trunk subports, this field is always set. """ subnet_name: str - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/subnet_name' - "$.components.schemas.InstanceFixedAddressSerializer.properties.subnet_name" + """The name of the subnet associated with this address. + + Included only in the response for a single-resource lookup (GET by ID). For the + trunk subports, this field is always set. """ type: Literal["fixed"] - """ - '#/components/schemas/InstanceFixedAddressSerializer/properties/type' - "$.components.schemas.InstanceFixedAddressSerializer.properties.type" - """ + """Type of the address""" diff --git a/src/gcore/types/cloud/fixed_address_short.py b/src/gcore/types/cloud/fixed_address_short.py index 6d0682de..baf1dd75 100644 --- a/src/gcore/types/cloud/fixed_address_short.py +++ b/src/gcore/types/cloud/fixed_address_short.py @@ -10,19 +10,15 @@ class FixedAddressShort(BaseModel): addr: str - """ - '#/components/schemas/InstanceFixedAddressShortSerializer/properties/addr' - "$.components.schemas.InstanceFixedAddressShortSerializer.properties.addr" - """ + """IP address""" interface_name: Optional[str] = None - """ - '#/components/schemas/InstanceFixedAddressShortSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.InstanceFixedAddressShortSerializer.properties.interface_name.anyOf[0]" + """Interface name. + + This field will be `null` if `with_interfaces_name=true` is not set in the + request when listing instances. It will also be `null` if the `interface_name` + was not specified during instance creation or when attaching the interface. """ type: Literal["fixed"] - """ - '#/components/schemas/InstanceFixedAddressShortSerializer/properties/type' - "$.components.schemas.InstanceFixedAddressShortSerializer.properties.type" - """ + """Type of the address""" diff --git a/src/gcore/types/cloud/flavor_hardware_description.py b/src/gcore/types/cloud/flavor_hardware_description.py index 4a2286a5..a5b259e8 100644 --- a/src/gcore/types/cloud/flavor_hardware_description.py +++ b/src/gcore/types/cloud/flavor_hardware_description.py @@ -9,49 +9,25 @@ class FlavorHardwareDescription(BaseModel): cpu: Optional[str] = None - """ - '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/cpu/anyOf/0' - "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.cpu.anyOf[0]" - """ + """Human-readable CPU description""" disk: Optional[str] = None - """ - '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/disk/anyOf/0' - "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.disk.anyOf[0]" - """ + """Human-readable disk description""" ephemeral: Optional[str] = None - """ - '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/ephemeral/anyOf/0' - "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.ephemeral.anyOf[0]" - """ + """Human-readable ephemeral disk description""" gpu: Optional[str] = None - """ - '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/gpu/anyOf/0' - "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.gpu.anyOf[0]" - """ + """Human-readable GPU description""" ipu: Optional[str] = None - """ - '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/ipu/anyOf/0' - "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.ipu.anyOf[0]" - """ + """Human-readable IPU description of AI cluster""" network: Optional[str] = None - """ - '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/network/anyOf/0' - "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.network.anyOf[0]" - """ + """Human-readable NIC description""" poplar_count: Optional[int] = None - """ - '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/poplar_count/anyOf/0' - "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.poplar_count.anyOf[0]" - """ + """Human-readable count of poplar servers of AI cluster""" ram: Optional[str] = None - """ - '#/components/schemas/FlavorHardwareDescriptionSerializer/properties/ram/anyOf/0' - "$.components.schemas.FlavorHardwareDescriptionSerializer.properties.ram.anyOf[0]" - """ + """Human-readable RAM description""" diff --git a/src/gcore/types/cloud/floating_address.py b/src/gcore/types/cloud/floating_address.py index cc186158..d730f632 100644 --- a/src/gcore/types/cloud/floating_address.py +++ b/src/gcore/types/cloud/floating_address.py @@ -9,13 +9,7 @@ class FloatingAddress(BaseModel): addr: str - """ - '#/components/schemas/InstanceFloatingAddressSerializer/properties/addr' - "$.components.schemas.InstanceFloatingAddressSerializer.properties.addr" - """ + """Address""" type: Literal["floating"] - """ - '#/components/schemas/InstanceFloatingAddressSerializer/properties/type' - "$.components.schemas.InstanceFloatingAddressSerializer.properties.type" - """ + """Type of the address""" diff --git a/src/gcore/types/cloud/floating_ip.py b/src/gcore/types/cloud/floating_ip.py index aa0c41ff..b111c43d 100644 --- a/src/gcore/types/cloud/floating_ip.py +++ b/src/gcore/types/cloud/floating_ip.py @@ -12,103 +12,66 @@ class FloatingIP(BaseModel): id: Optional[str] = None - """ - '#/components/schemas/FloatingIPSerializer/properties/id/anyOf/0' - "$.components.schemas.FloatingIPSerializer.properties.id.anyOf[0]" - """ + """Floating IP ID""" created_at: datetime - """ - '#/components/schemas/FloatingIPSerializer/properties/created_at' - "$.components.schemas.FloatingIPSerializer.properties.created_at" - """ + """Datetime when the floating IP was created""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/FloatingIPSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.FloatingIPSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" dns_domain: Optional[str] = None - """ - '#/components/schemas/FloatingIPSerializer/properties/dns_domain/anyOf/0' - "$.components.schemas.FloatingIPSerializer.properties.dns_domain.anyOf[0]" - """ + """This field is deprecated and can be ignored""" dns_name: Optional[str] = None - """ - '#/components/schemas/FloatingIPSerializer/properties/dns_name/anyOf/0' - "$.components.schemas.FloatingIPSerializer.properties.dns_name.anyOf[0]" - """ + """This field is deprecated and can be ignored""" fixed_ip_address: Optional[str] = None - """ - '#/components/schemas/FloatingIPSerializer/properties/fixed_ip_address/anyOf/0' - "$.components.schemas.FloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" - """ + """IP address of the port the floating IP is attached to""" floating_ip_address: Optional[str] = None - """ - '#/components/schemas/FloatingIPSerializer/properties/floating_ip_address/anyOf/0' - "$.components.schemas.FloatingIPSerializer.properties.floating_ip_address.anyOf[0]" - """ + """IP Address of the floating IP""" port_id: Optional[str] = None - """ - '#/components/schemas/FloatingIPSerializer/properties/port_id/anyOf/0' - "$.components.schemas.FloatingIPSerializer.properties.port_id.anyOf[0]" + """Port ID the floating IP is attached to. + + The `fixed_ip_address` is the IP address of the port. """ project_id: int - """ - '#/components/schemas/FloatingIPSerializer/properties/project_id' - "$.components.schemas.FloatingIPSerializer.properties.project_id" - """ + """Project ID""" region: str - """ - '#/components/schemas/FloatingIPSerializer/properties/region' - "$.components.schemas.FloatingIPSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/FloatingIPSerializer/properties/region_id' - "$.components.schemas.FloatingIPSerializer.properties.region_id" - """ + """Region ID""" router_id: Optional[str] = None - """ - '#/components/schemas/FloatingIPSerializer/properties/router_id/anyOf/0' - "$.components.schemas.FloatingIPSerializer.properties.router_id.anyOf[0]" - """ + """Router ID""" status: Optional[FloatingIPStatus] = None - """ - '#/components/schemas/FloatingIPSerializer/properties/status/anyOf/0' - "$.components.schemas.FloatingIPSerializer.properties.status.anyOf[0]" - """ + """Floating IP status""" subnet_id: Optional[str] = None - """ - '#/components/schemas/FloatingIPSerializer/properties/subnet_id/anyOf/0' - "$.components.schemas.FloatingIPSerializer.properties.subnet_id.anyOf[0]" - """ + """This field is deprecated and can be ignored""" tags: List[Tag] - """ - '#/components/schemas/FloatingIPSerializer/properties/tags' - "$.components.schemas.FloatingIPSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ task_id: Optional[str] = None - """ - '#/components/schemas/FloatingIPSerializer/properties/task_id/anyOf/0' - "$.components.schemas.FloatingIPSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ updated_at: datetime - """ - '#/components/schemas/FloatingIPSerializer/properties/updated_at' - "$.components.schemas.FloatingIPSerializer.properties.updated_at" - """ + """Datetime when the floating IP was last updated""" diff --git a/src/gcore/types/cloud/floating_ip_assign_params.py b/src/gcore/types/cloud/floating_ip_assign_params.py index e43ebaf2..e90fcfee 100644 --- a/src/gcore/types/cloud/floating_ip_assign_params.py +++ b/src/gcore/types/cloud/floating_ip_assign_params.py @@ -10,25 +10,11 @@ class FloatingIPAssignParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bfloating_ip_id%7D%2Fassign/post/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign'].post.parameters[1].schema" - """ port_id: Required[str] - """ - '#/components/schemas/AssignFloatingIPSerializer/properties/port_id' - "$.components.schemas.AssignFloatingIPSerializer.properties.port_id" - """ + """Port ID""" fixed_ip_address: Optional[str] - """ - '#/components/schemas/AssignFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' - "$.components.schemas.AssignFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" - """ + """Fixed IP address""" diff --git a/src/gcore/types/cloud/floating_ip_create_params.py b/src/gcore/types/cloud/floating_ip_create_params.py index 3427425a..a872ea64 100644 --- a/src/gcore/types/cloud/floating_ip_create_params.py +++ b/src/gcore/types/cloud/floating_ip_create_params.py @@ -12,31 +12,29 @@ class FloatingIPCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].post.parameters[1].schema" - """ + """Region ID""" fixed_ip_address: Optional[str] """ - '#/components/schemas/CreateFloatingIPSerializer/properties/fixed_ip_address/anyOf/0' - "$.components.schemas.CreateFloatingIPSerializer.properties.fixed_ip_address.anyOf[0]" + If the port has multiple IP addresses, a specific one can be selected using this + field. If not specified, the first IP in the port's list will be used by + default. """ port_id: Optional[str] """ - '#/components/schemas/CreateFloatingIPSerializer/properties/port_id/anyOf/0' - "$.components.schemas.CreateFloatingIPSerializer.properties.port_id.anyOf[0]" + If provided, the floating IP will be immediately attached to the specified port. """ tags: TagUpdateListParam - """ - '#/components/schemas/CreateFloatingIPSerializer/properties/tags' - "$.components.schemas.CreateFloatingIPSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index a3b5ea70..057730b2 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -26,124 +26,67 @@ class InstanceFlavor(BaseModel): flavor_id: str - """ - '#/components/schemas/BaseFlavorSerializer/properties/flavor_id' - "$.components.schemas.BaseFlavorSerializer.properties.flavor_id" - """ + """Flavor ID is the same as name""" flavor_name: str - """ - '#/components/schemas/BaseFlavorSerializer/properties/flavor_name' - "$.components.schemas.BaseFlavorSerializer.properties.flavor_name" - """ + """Flavor name""" ram: int - """ - '#/components/schemas/BaseFlavorSerializer/properties/ram' - "$.components.schemas.BaseFlavorSerializer.properties.ram" - """ + """RAM size in MiB""" vcpus: int - """ - '#/components/schemas/BaseFlavorSerializer/properties/vcpus' - "$.components.schemas.BaseFlavorSerializer.properties.vcpus" - """ + """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" class InstanceSecurityGroup(BaseModel): name: str - """ - '#/components/schemas/NameSerializerPydantic/properties/name' - "$.components.schemas.NameSerializerPydantic.properties.name" - """ + """Name.""" class InstanceVolume(BaseModel): id: str - """ - '#/components/schemas/InstanceVolumeSerializer/properties/id' - "$.components.schemas.InstanceVolumeSerializer.properties.id" - """ + """Volume ID""" delete_on_termination: bool - """ - '#/components/schemas/InstanceVolumeSerializer/properties/delete_on_termination' - "$.components.schemas.InstanceVolumeSerializer.properties.delete_on_termination" - """ + """Whether the volume is deleted together with the VM""" class Instance(BaseModel): addresses: Dict[str, List[InstanceAddress]] - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/addresses' - "$.components.schemas.InstanceInFloatingSerializer.properties.addresses" - """ + """Map of network_name to list of addresses in that network""" creator_task_id: str - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/creator_task_id' - "$.components.schemas.InstanceInFloatingSerializer.properties.creator_task_id" - """ + """Task that created this entity""" flavor: InstanceFlavor - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/flavor' - "$.components.schemas.InstanceInFloatingSerializer.properties.flavor" - """ + """Flavor""" instance_created: datetime - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/instance_created' - "$.components.schemas.InstanceInFloatingSerializer.properties.instance_created" - """ + """Datetime when instance was created""" instance_description: Optional[str] = None - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/instance_description/anyOf/0' - "$.components.schemas.InstanceInFloatingSerializer.properties.instance_description.anyOf[0]" - """ + """Instance description""" instance_id: str - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/instance_id' - "$.components.schemas.InstanceInFloatingSerializer.properties.instance_id" - """ + """Instance ID""" instance_name: str - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/instance_name' - "$.components.schemas.InstanceInFloatingSerializer.properties.instance_name" - """ + """Instance name""" project_id: int - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/project_id' - "$.components.schemas.InstanceInFloatingSerializer.properties.project_id" - """ + """Project ID""" region: str - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/region' - "$.components.schemas.InstanceInFloatingSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/region_id' - "$.components.schemas.InstanceInFloatingSerializer.properties.region_id" - """ + """Region ID""" security_groups: List[InstanceSecurityGroup] - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/security_groups' - "$.components.schemas.InstanceInFloatingSerializer.properties.security_groups" - """ + """Security groups""" ssh_key_name: Optional[str] = None - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/ssh_key_name/anyOf/0' - "$.components.schemas.InstanceInFloatingSerializer.properties.ssh_key_name.anyOf[0]" - """ + """SSH key name assigned to instance""" status: Literal[ "ACTIVE", @@ -167,28 +110,27 @@ class Instance(BaseModel): "UNKNOWN", "VERIFY_RESIZE", ] - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/status' - "$.components.schemas.InstanceInFloatingSerializer.properties.status" - """ + """Instance status""" tags: List[Tag] - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/tags' - "$.components.schemas.InstanceInFloatingSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ task_id: Optional[str] = None - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/task_id/anyOf/0' - "$.components.schemas.InstanceInFloatingSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ task_state: Optional[str] = None - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/task_state/anyOf/0' - "$.components.schemas.InstanceInFloatingSerializer.properties.task_state.anyOf[0]" - """ + """Task state""" vm_state: Literal[ "active", @@ -204,129 +146,77 @@ class Instance(BaseModel): "stopped", "suspended", ] - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/vm_state' - "$.components.schemas.InstanceInFloatingSerializer.properties.vm_state" - """ + """Virtual machine state (active)""" volumes: List[InstanceVolume] - """ - '#/components/schemas/InstanceInFloatingSerializer/properties/volumes' - "$.components.schemas.InstanceInFloatingSerializer.properties.volumes" - """ + """List of volumes""" class FloatingIPDetailed(BaseModel): id: Optional[str] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/id/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.id.anyOf[0]" - """ + """Floating IP ID""" created_at: datetime - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/created_at' - "$.components.schemas.FloatingIPDetailedSerializer.properties.created_at" - """ + """Datetime when the floating IP was created""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" dns_domain: Optional[str] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/dns_domain/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.dns_domain.anyOf[0]" - """ + """This field is deprecated and can be ignored""" dns_name: Optional[str] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/dns_name/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.dns_name.anyOf[0]" - """ + """This field is deprecated and can be ignored""" fixed_ip_address: Optional[str] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/fixed_ip_address/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.fixed_ip_address.anyOf[0]" - """ + """IP address of the port the floating IP is attached to""" floating_ip_address: Optional[str] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/floating_ip_address/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.floating_ip_address.anyOf[0]" - """ + """IP Address of the floating IP""" instance: Optional[Instance] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/instance/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.instance.anyOf[0]" - """ + """Instance the floating IP is attached to""" loadbalancer: Optional[LoadBalancer] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/loadbalancer/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.loadbalancer.anyOf[0]" - """ + """Load balancer the floating IP is attached to""" port_id: Optional[str] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/port_id/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.port_id.anyOf[0]" - """ + """Port ID""" project_id: int - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/project_id' - "$.components.schemas.FloatingIPDetailedSerializer.properties.project_id" - """ + """Project ID""" region: str - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/region' - "$.components.schemas.FloatingIPDetailedSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/region_id' - "$.components.schemas.FloatingIPDetailedSerializer.properties.region_id" - """ + """Region ID""" router_id: Optional[str] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/router_id/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.router_id.anyOf[0]" - """ + """Router ID""" status: Optional[FloatingIPStatus] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/status/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.status.anyOf[0]" - """ + """Floating IP status""" subnet_id: Optional[str] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/subnet_id/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.subnet_id.anyOf[0]" - """ + """This field is deprecated and can be ignored""" tags: List[Tag] - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/tags' - "$.components.schemas.FloatingIPDetailedSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ task_id: Optional[str] = None - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/task_id/anyOf/0' - "$.components.schemas.FloatingIPDetailedSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ updated_at: datetime - """ - '#/components/schemas/FloatingIPDetailedSerializer/properties/updated_at' - "$.components.schemas.FloatingIPDetailedSerializer.properties.updated_at" - """ + """Datetime when the floating IP was last updated""" diff --git a/src/gcore/types/cloud/floating_ip_list_params.py b/src/gcore/types/cloud/floating_ip_list_params.py index 903e1b75..66325daf 100644 --- a/src/gcore/types/cloud/floating_ip_list_params.py +++ b/src/gcore/types/cloud/floating_ip_list_params.py @@ -10,37 +10,26 @@ class FloatingIPListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[1].schema" - """ + """Region ID""" limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[2]" - """ + """Optional. Limit the number of returned items""" offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[3]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ tag_key: List[str] - """ - '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[4]" - """ + """Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2""" tag_key_value: str - """ - '#/paths/%2Fcloud%2Fv1%2Ffloatingips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/floatingips/{project_id}/{region_id}'].get.parameters[5]" + """Optional. + + Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": + "value"}" --url "https://example.com/cloud/v1/resource/1/1" """ diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal_cluster.py index 58de4247..dce0f0cb 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster.py @@ -12,132 +12,80 @@ class Interface(BaseModel): network_id: str - """ - '#/components/schemas/AIClusterNetworkSerializer/properties/network_id' - "$.components.schemas.AIClusterNetworkSerializer.properties.network_id" - """ + """Network ID""" port_id: str - """ - '#/components/schemas/AIClusterNetworkSerializer/properties/port_id' - "$.components.schemas.AIClusterNetworkSerializer.properties.port_id" - """ + """Network ID the subnet belongs to. Port will be plugged in this network""" subnet_id: str - """ - '#/components/schemas/AIClusterNetworkSerializer/properties/subnet_id' - "$.components.schemas.AIClusterNetworkSerializer.properties.subnet_id" - """ + """Port is assigned to IP address from the subnet""" type: str - """ - '#/components/schemas/AIClusterNetworkSerializer/properties/type' - "$.components.schemas.AIClusterNetworkSerializer.properties.type" - """ + """Network type""" class GPUBaremetalCluster(BaseModel): cluster_id: str - """ - '#/components/schemas/AIClusterSerializer/properties/cluster_id' - "$.components.schemas.AIClusterSerializer.properties.cluster_id" - """ + """GPU Cluster ID""" cluster_name: str - """ - '#/components/schemas/AIClusterSerializer/properties/cluster_name' - "$.components.schemas.AIClusterSerializer.properties.cluster_name" - """ + """GPU Cluster Name""" cluster_status: Literal["ACTIVE", "ERROR", "PENDING", "SUSPENDED"] - """ - '#/components/schemas/AIClusterSerializer/properties/cluster_status' - "$.components.schemas.AIClusterSerializer.properties.cluster_status" - """ + """GPU Cluster status""" created_at: Optional[str] = None - """ - '#/components/schemas/AIClusterSerializer/properties/created_at/anyOf/0' - "$.components.schemas.AIClusterSerializer.properties.created_at.anyOf[0]" - """ + """Datetime when the cluster was created""" creator_task_id: str - """ - '#/components/schemas/AIClusterSerializer/properties/creator_task_id' - "$.components.schemas.AIClusterSerializer.properties.creator_task_id" - """ + """Task that created this entity""" flavor: str - """ - '#/components/schemas/AIClusterSerializer/properties/flavor' - "$.components.schemas.AIClusterSerializer.properties.flavor" - """ + """Flavor ID is the same as the name""" image_id: str - """ - '#/components/schemas/AIClusterSerializer/properties/image_id' - "$.components.schemas.AIClusterSerializer.properties.image_id" - """ + """Image ID""" image_name: str - """ - '#/components/schemas/AIClusterSerializer/properties/image_name' - "$.components.schemas.AIClusterSerializer.properties.image_name" - """ + """Image name""" interfaces: Optional[List[Interface]] = None - """ - '#/components/schemas/AIClusterSerializer/properties/interfaces/anyOf/0' - "$.components.schemas.AIClusterSerializer.properties.interfaces.anyOf[0]" - """ + """Networks managed by user and associated with the cluster""" password: Optional[str] = None - """ - '#/components/schemas/AIClusterSerializer/properties/password/anyOf/0' - "$.components.schemas.AIClusterSerializer.properties.password.anyOf[0]" + """A password for a bare metal server. + + This parameter is used to set a password for the "Admin" user on a Windows + instance, a default user or a new user on a Linux instance """ project_id: int - """ - '#/components/schemas/AIClusterSerializer/properties/project_id' - "$.components.schemas.AIClusterSerializer.properties.project_id" - """ + """Project ID""" region: str - """ - '#/components/schemas/AIClusterSerializer/properties/region' - "$.components.schemas.AIClusterSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/AIClusterSerializer/properties/region_id' - "$.components.schemas.AIClusterSerializer.properties.region_id" - """ + """Region ID""" servers: List[GPUClusterServer] - """ - '#/components/schemas/AIClusterSerializer/properties/servers' - "$.components.schemas.AIClusterSerializer.properties.servers" - """ + """GPU cluster servers""" ssh_key_name: Optional[str] = None - """ - '#/components/schemas/AIClusterSerializer/properties/ssh_key_name/anyOf/0' - "$.components.schemas.AIClusterSerializer.properties.ssh_key_name.anyOf[0]" - """ + """Keypair name to inject into new cluster(s)""" tags: List[Tag] - """ - '#/components/schemas/AIClusterSerializer/properties/tags' - "$.components.schemas.AIClusterSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ task_id: Optional[str] = None - """ - '#/components/schemas/AIClusterSerializer/properties/task_id/anyOf/0' - "$.components.schemas.AIClusterSerializer.properties.task_id.anyOf[0]" - """ + """Task ID associated with the cluster""" task_status: Literal[ "CLUSTER_CLEAN_UP", @@ -152,19 +100,17 @@ class GPUBaremetalCluster(BaseModel): "POST_DEPLOY_SETUP", "VIPU_CONTROLLER", ] - """ - '#/components/schemas/AIClusterSerializer/properties/task_status' - "$.components.schemas.AIClusterSerializer.properties.task_status" - """ + """Task status""" user_data: Optional[str] = None - """ - '#/components/schemas/AIClusterSerializer/properties/user_data/anyOf/0' - "$.components.schemas.AIClusterSerializer.properties.user_data.anyOf[0]" + """String in base64 format. + + Must not be passed together with 'username' or 'password'. Examples of the + user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ username: Optional[str] = None - """ - '#/components/schemas/AIClusterSerializer/properties/username/anyOf/0' - "$.components.schemas.AIClusterSerializer.properties.username.anyOf[0]" + """A name of a new user in the Linux instance. + + It may be passed with a 'password' parameter """ 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 a3e96053..56c0a07d 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -33,115 +33,83 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}'].post.parameters[1].schema" - """ flavor: Required[str] - """ - '#/components/schemas/CreateAIClusterGPUSerializer/properties/flavor' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.flavor" - """ + """Flavor name""" image_id: Required[str] - """ - '#/components/schemas/CreateAIClusterGPUSerializer/properties/image_id' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.image_id" - """ + """Image ID""" interfaces: Required[Iterable[Interface]] - """ - '#/components/schemas/CreateAIClusterGPUSerializer/properties/interfaces' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.interfaces" - """ + """Subnet IPs and floating IPs""" name: Required[str] - """ - '#/components/schemas/CreateAIClusterGPUSerializer/properties/name' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.name" - """ + """GPU Cluster name""" instances_count: int - """ - '#/components/schemas/CreateAIClusterGPUSerializer/properties/instances_count' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.instances_count" - """ + """Number of servers to create""" password: str - """ - '#/components/schemas/CreateAIClusterGPUSerializer/properties/password' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.password" + """A password for a bare metal server. + + This parameter is used to set a password for the "Admin" user on a Windows + instance, a default user or a new user on a Linux instance """ ssh_key_name: str - """ - '#/components/schemas/CreateAIClusterGPUSerializer/properties/ssh_key_name' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.ssh_key_name" - """ + """Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint.""" tags: TagUpdateListParam - """ - '#/components/schemas/CreateAIClusterGPUSerializer/properties/tags' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. """ user_data: str - """ - '#/components/schemas/CreateAIClusterGPUSerializer/properties/user_data' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.user_data" + """String in base64 format. + + Must not be passed together with 'username' or 'password'. Examples of the + user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ username: str - """ - '#/components/schemas/CreateAIClusterGPUSerializer/properties/username' - "$.components.schemas.CreateAIClusterGPUSerializer.properties.username" + """A name of a new user in the Linux instance. + + It may be passed with a 'password' parameter """ class InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' - "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" - """ + """Resource ID""" class InterfaceNewInterfaceExternalSerializerPydantic(TypedDict, total=False): type: Required[Literal["external"]] - """ - '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/type' - "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.type" - """ + """A public IP address will be assigned to the instance.""" interface_name: str - """ - '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/interface_name' - "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.interface_name" + """Interface name. + + Defaults to `null` and is returned as `null` in the API response if not set. """ ip_family: Optional[InterfaceIPFamily] - """ - '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/ip_family/anyOf/0' - "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.ip_family.anyOf[0]" - """ + """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" port_group: int - """ - '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/port_group' - "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.port_group" - """ + """Applicable only to bare metal. Each group is added to a separate trunk.""" security_groups: Iterable[InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup] - """ - '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/security_groups' - "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.security_groups" + """Applies only to instances and is ignored for bare metal. + + Specifies security group UUIDs to be applied to the instance network interface. """ @@ -149,9 +117,11 @@ class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPNewInsta TypedDict, total=False ): source: Required[Literal["new"]] - """ - '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """A new floating IP will be created and attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -160,14 +130,16 @@ class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExisting ): existing_floating_id: Required[str] """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + An existing available floating IP id must be specified if the source is set to + `existing` """ source: Required[Literal["existing"]] - """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """An existing available floating IP will be attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -179,53 +151,39 @@ class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExisting class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' - "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" - """ + """Resource ID""" class InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic(TypedDict, total=False): network_id: Required[str] - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/network_id' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.network_id" - """ + """The network where the instance will be connected.""" subnet_id: Required[str] - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/subnet_id' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.subnet_id" - """ + """The instance will get an IP address from this subnet.""" type: Required[Literal["subnet"]] - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/type' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.type" + """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. """ floating_ip: InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIP - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/floating_ip' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.floating_ip" - """ + """Allows the instance to have a public IP that can be reached from the internet.""" interface_name: str - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/interface_name' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.interface_name" + """Interface name. + + Defaults to `null` and is returned as `null` in the API response if not set. """ port_group: int - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/port_group' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.port_group" - """ + """Applicable only to bare metal. Each group is added to a separate trunk.""" security_groups: Iterable[InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup] - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/security_groups' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.security_groups" + """Applies only to instances and is ignored for bare metal. + + Specifies security group UUIDs to be applied to the instance network interface. """ @@ -233,9 +191,11 @@ class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPNewInstanceFl TypedDict, total=False ): source: Required[Literal["new"]] - """ - '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """A new floating IP will be created and attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -244,14 +204,16 @@ class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInsta ): existing_floating_id: Required[str] """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + An existing available floating IP id must be specified if the source is set to + `existing` """ source: Required[Literal["existing"]] - """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """An existing available floating IP will be attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -263,59 +225,38 @@ class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInsta class InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' - "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" - """ + """Resource ID""" class InterfaceNewInterfaceAnySubnetFipSerializerPydantic(TypedDict, total=False): network_id: Required[str] - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/network_id' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.network_id" - """ + """The network where the instance will be connected.""" type: Required[Literal["any_subnet"]] - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/type' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.type" - """ + """Instance will be attached to a subnet with the largest count of free IPs.""" floating_ip: InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIP - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/floating_ip' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.floating_ip" - """ + """Allows the instance to have a public IP that can be reached from the internet.""" interface_name: str - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/interface_name' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.interface_name" + """Interface name. + + Defaults to `null` and is returned as `null` in the API response if not set. """ ip_address: str - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/ip_address' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.ip_address" - """ + """You can specify a specific IP address from your subnet.""" ip_family: Optional[InterfaceIPFamily] - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/ip_family/anyOf/0' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.ip_family.anyOf[0]" - """ + """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" port_group: int - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/port_group' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.port_group" - """ + """Applicable only to bare metal. Each group is added to a separate trunk.""" security_groups: Iterable[InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup] - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/security_groups' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.security_groups" + """Applies only to instances and is ignored for bare metal. + + Specifies security group UUIDs to be applied to the instance network interface. """ @@ -323,9 +264,11 @@ class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPNewInst TypedDict, total=False ): source: Required[Literal["new"]] - """ - '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """A new floating IP will be created and attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -334,14 +277,16 @@ class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistin ): existing_floating_id: Required[str] """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + An existing available floating IP id must be specified if the source is set to + `existing` """ source: Required[Literal["existing"]] - """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """An existing available floating IP will be attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -353,47 +298,36 @@ class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistin class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' - "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" - """ + """Resource ID""" class InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic(TypedDict, total=False): port_id: Required[str] - """ - '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/port_id' - "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.port_id" - """ + """Network ID the subnet belongs to. Port will be plugged in this network.""" type: Required[Literal["reserved_fixed_ip"]] - """ - '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/type' - "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.type" + """An existing available reserved fixed IP will be attached to the instance. + + If the reserved IP is not public and you choose to add a floating IP, the + instance will be accessible from the internet. """ floating_ip: InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIP - """ - '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/floating_ip' - "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.floating_ip" - """ + """Allows the instance to have a public IP that can be reached from the internet.""" interface_name: str - """ - '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/interface_name' - "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.interface_name" + """Interface name. + + Defaults to `null` and is returned as `null` in the API response if not set. """ port_group: int - """ - '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/port_group' - "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.port_group" - """ + """Applicable only to bare metal. Each group is added to a separate trunk.""" security_groups: Iterable[InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup] - """ - '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/security_groups' - "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.security_groups" + """Applies only to instances and is ignored for bare metal. + + Specifies security group UUIDs to be applied to the instance network interface. """ diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py index 1d31aed9..eddc7d1a 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py @@ -9,31 +9,20 @@ class GPUBaremetalClusterDeleteParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[1].schema" - """ delete_floatings: bool - """ - '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/3' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[3]" + """True if it is required to delete floating IPs assigned to the servers. + + Can't be used with floatings. """ floatings: str - """ - '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/4' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[4]" + """Comma separated list of floating ids that should be deleted. + + Can't be used with delete_floatings. """ reserved_fixed_ips: str - """ - '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D/delete/parameters/5' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}']['delete'].parameters[5]" - """ + """Comma separated list of port IDs to be deleted with the servers""" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py index 06e6378e..98549a17 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py @@ -9,25 +9,11 @@ class GPUBaremetalClusterListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[1].schema" - """ limit: int - """ - '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[2]" - """ + """Limit the number of returned clusters""" offset: int - """ - '#/paths/%2Fcloud%2Fv2%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v2/ai/clusters/{project_id}/{region_id}'].get.parameters[3]" - """ + """Offset value is used to exclude the first set of records from the result""" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py index 4c0e5d36..ef32ec82 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py @@ -10,31 +10,17 @@ class GPUBaremetalClusterRebuildParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Frebuild/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild'].post.parameters[1].schema" - """ nodes: Required[List[str]] - """ - '#/components/schemas/RebuildClusterSerializer/properties/nodes' - "$.components.schemas.RebuildClusterSerializer.properties.nodes" - """ + """List of nodes uuids to be rebuild""" image_id: Optional[str] - """ - '#/components/schemas/RebuildClusterSerializer/properties/image_id/anyOf/0' - "$.components.schemas.RebuildClusterSerializer.properties.image_id.anyOf[0]" - """ + """AI GPU image ID""" user_data: Optional[str] """ - '#/components/schemas/RebuildClusterSerializer/properties/user_data/anyOf/0' - "$.components.schemas.RebuildClusterSerializer.properties.user_data.anyOf[0]" + String in base64 format.Examples of the user_data: + https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py index 8cca0bfd..9f8b0391 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py @@ -9,19 +9,8 @@ class GPUBaremetalClusterResizeParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fresize/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize'].post.parameters[1].schema" - """ instances_count: Required[int] - """ - '#/components/schemas/ResizeAIClusterGPUSerializerV1/properties/instances_count' - "$.components.schemas.ResizeAIClusterGPUSerializerV1.properties.instances_count" - """ + """Resized (total) number of instances""" diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py index a3bbeba9..0a134384 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py @@ -10,25 +10,13 @@ class FlavorListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/0/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/1/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[1].schema" - """ + """Region ID""" hide_disabled: Optional[bool] - """ - '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/2/schema/anyOf/0' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[2].schema.anyOf[0]" - """ + """Flag for filtering disabled flavors in the region.""" include_prices: Optional[bool] - """ - '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fflavors/get/parameters/3/schema/anyOf/0' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors'].get.parameters[3].schema.anyOf[0]" - """ + """Set to true if the response should include flavor prices.""" diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py index b9a34561..18ebd4c7 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py @@ -12,73 +12,47 @@ class ImageUploadParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/post/parameters/0/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Fgpu%2Fbaremetal%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Fimages/post/parameters/1/schema' - "$.paths['/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images'].post.parameters[1].schema" - """ + """Region ID""" name: Required[str] - """ - '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/name' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.name" - """ + """Image name""" url: Required[str] - """ - '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/url/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.url.anyOf[0]" - """ + """Image URL""" architecture: Optional[Literal["aarch64", "x86_64"]] - """ - '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/architecture/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.architecture.anyOf[0]" - """ + """Image architecture type: aarch64, x86_64""" cow_format: bool """ - '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/cow_format' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.cow_format" + When True, image cannot be deleted unless all volumes, created from it, are + deleted. """ hw_firmware_type: Optional[Literal["bios", "uefi"]] - """ - '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.hw_firmware_type.anyOf[0]" - """ + """Specifies the type of firmware with which to boot the guest.""" os_distro: Optional[str] - """ - '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_distro/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_distro.anyOf[0]" - """ + """OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc.""" os_type: Optional[Literal["linux", "windows"]] - """ - '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_type/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_type.anyOf[0]" - """ + """The operating system installed on the image. Linux by default""" os_version: Optional[str] - """ - '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/os_version/anyOf/0' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.os_version.anyOf[0]" - """ + """OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian""" ssh_key: Literal["allow", "deny", "required"] - """ - '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/ssh_key' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.ssh_key" - """ + """Permission to use a ssh key in instances""" tags: TagUpdateListParam - """ - '#/components/schemas/UploadBaremetalGpuImageSerializer/properties/tags' - "$.components.schemas.UploadBaremetalGpuImageSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py index 64e69e9c..6d2f4fce 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 @@ -28,424 +28,221 @@ class NewInterfaceExternalExtendSchemaWithDDOS(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - """ ddos_profile: NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - """ - '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ddos_profile.allOf[0]" - """ + """Advanced DDoS protection.""" interface_name: str - """ - '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/interface_name' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.interface_name" - """ + """Interface name""" ip_family: Literal["dual", "ipv4", "ipv6"] - """ - '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ip_family' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ip_family" - """ + """Which subnets should be selected: IPv4, IPv6 or use dual stack.""" port_group: int - """ - '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/port_group' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.port_group" - """ + """Each group will be added to the separate trunk.""" security_groups: Iterable[NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - """ - '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/security_groups' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.security_groups" - """ + """List of security group IDs""" type: str - """ - '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/type' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.type" - """ + """Must be 'external'. Union tag""" class NewInterfaceExternalExtendSchemaWithDdosddosProfileField(TypedDict, total=False): base_field: Optional[int] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" - """ + """ID of DDoS profile field""" field_name: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" - """ + """Name of DDoS profile field""" field_value: object - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" - """ + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" - """ + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile(TypedDict, total=False): profile_template: Required[int] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" - """ + """DDoS profile template ID.""" fields: Iterable[NewInterfaceExternalExtendSchemaWithDdosddosProfileField] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" - """ + """Protection parameters.""" profile_template_name: str - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" - """ + """DDoS profile template name.""" class NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSchema/properties/id' - "$.components.schemas.MandatoryIdSchema.properties.id" - """ + """Resource ID""" class NewInterfaceSpecificSubnetSchema(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - """ subnet_id: Required[str] - """ - '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/subnet_id' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.subnet_id" - """ + """Port will get an IP address from this subnet""" ddos_profile: NewInterfaceSpecificSubnetSchemaDDOSProfile - """ - '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.ddos_profile.allOf[0]" - """ + """Advanced DDoS protection.""" interface_name: str - """ - '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/interface_name' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.interface_name" - """ + """Interface name""" port_group: int - """ - '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/port_group' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.port_group" - """ + """Each group will be added to the separate trunk.""" security_groups: Iterable[NewInterfaceSpecificSubnetSchemaSecurityGroup] - """ - '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/security_groups' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.security_groups" - """ + """List of security group IDs""" type: str - """ - '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/type' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.type" - """ + """Must be 'subnet'""" class NewInterfaceSpecificSubnetSchemaDDOSProfileField(TypedDict, total=False): base_field: Optional[int] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" - """ + """ID of DDoS profile field""" field_name: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" - """ + """Name of DDoS profile field""" field_value: object - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" - """ + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" - """ + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceSpecificSubnetSchemaDDOSProfile(TypedDict, total=False): profile_template: Required[int] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" - """ + """DDoS profile template ID.""" fields: Iterable[NewInterfaceSpecificSubnetSchemaDDOSProfileField] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" - """ + """Protection parameters.""" profile_template_name: str - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" - """ + """DDoS profile template name.""" class NewInterfaceSpecificSubnetSchemaSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSchema/properties/id' - "$.components.schemas.MandatoryIdSchema.properties.id" - """ + """Resource ID""" class NewInterfaceAnySubnetSchema(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - """ network_id: Required[str] - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/network_id' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.network_id" - """ + """Port will get an IP address in this network subnet""" ddos_profile: NewInterfaceAnySubnetSchemaDDOSProfile - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ddos_profile.allOf[0]" - """ + """Advanced DDoS protection.""" interface_name: str - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/interface_name' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.interface_name" - """ + """Interface name""" ip_family: Literal["dual", "ipv4", "ipv6"] - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ip_family' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ip_family" - """ + """Which subnets should be selected: IPv4, IPv6 or use dual stack.""" port_group: int - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/port_group' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.port_group" - """ + """Each group will be added to the separate trunk.""" security_groups: Iterable[NewInterfaceAnySubnetSchemaSecurityGroup] - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/security_groups' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.security_groups" - """ + """List of security group IDs""" type: str - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/type' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.type" - """ + """Must be 'any_subnet'""" class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): base_field: Optional[int] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" - """ + """ID of DDoS profile field""" field_name: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" - """ + """Name of DDoS profile field""" field_value: object - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" - """ + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" - """ + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceAnySubnetSchemaDDOSProfile(TypedDict, total=False): profile_template: Required[int] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" - """ + """DDoS profile template ID.""" fields: Iterable[NewInterfaceAnySubnetSchemaDDOSProfileField] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" - """ + """Protection parameters.""" profile_template_name: str - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" - """ + """DDoS profile template name.""" class NewInterfaceAnySubnetSchemaSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSchema/properties/id' - "$.components.schemas.MandatoryIdSchema.properties.id" - """ + """Resource ID""" class NewInterfaceReservedFixedIPSchema(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - """ port_id: Required[str] - """ - '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_id' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_id" - """ + """Port ID""" ddos_profile: NewInterfaceReservedFixedIPSchemaDDOSProfile - """ - '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.ddos_profile.allOf[0]" - """ + """Advanced DDoS protection.""" interface_name: str - """ - '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/interface_name' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.interface_name" - """ + """Interface name""" port_group: int - """ - '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_group' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_group" - """ + """Each group will be added to the separate trunk.""" security_groups: Iterable[NewInterfaceReservedFixedIPSchemaSecurityGroup] - """ - '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/security_groups' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.security_groups" - """ + """List of security group IDs""" type: str - """ - '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/type' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.type" - """ + """Must be 'reserved_fixed_ip'. Union tag""" class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): base_field: Optional[int] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" - """ + """ID of DDoS profile field""" field_name: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" - """ + """Name of DDoS profile field""" field_value: object - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" - """ + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" - """ + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceReservedFixedIPSchemaDDOSProfile(TypedDict, total=False): profile_template: Required[int] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" - """ + """DDoS profile template ID.""" fields: Iterable[NewInterfaceReservedFixedIPSchemaDDOSProfileField] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" - """ + """Protection parameters.""" profile_template_name: str - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" - """ + """DDoS profile template name.""" class NewInterfaceReservedFixedIPSchemaSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSchema/properties/id' - "$.components.schemas.MandatoryIdSchema.properties.id" - """ + """Resource ID""" ServerAttachInterfaceParams: TypeAlias = Union[ diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py index 188a86b7..534d22f7 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py @@ -9,25 +9,13 @@ class ServerDeleteParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[1].schema" - """ cluster_id: Required[str] - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/2/schema' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[2].schema" - """ delete_floatings: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2Fgpu%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bcluster_id%7D%2Fnode%2F%7Binstance_id%7D/delete/parameters/4' - "$.paths['/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}']['delete'].parameters[4]" + """Set False if you do not want to delete assigned floating IPs. + + By default, it's True. """ diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py index 0c39ad42..4c9cacc3 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py @@ -9,25 +9,11 @@ class ServerDetachInterfaceParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fai%2Fclusters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[1].schema" - """ ip_address: Required[str] - """ - '#/components/schemas/PortIdWithIpSchema/properties/ip_address' - "$.components.schemas.PortIdWithIpSchema.properties.ip_address" - """ + """IP address""" port_id: Required[str] - """ - '#/components/schemas/PortIdWithIpSchema/properties/port_id' - "$.components.schemas.PortIdWithIpSchema.properties.port_id" - """ + """ID of the port""" diff --git a/src/gcore/types/cloud/gpu_baremetal_flavor.py b/src/gcore/types/cloud/gpu_baremetal_flavor.py index bf404111..50d3d93b 100644 --- a/src/gcore/types/cloud/gpu_baremetal_flavor.py +++ b/src/gcore/types/cloud/gpu_baremetal_flavor.py @@ -19,214 +19,115 @@ class GPUBaremetalFlavorSerializerWithoutPriceHardwareDescription(BaseModel): cpu: str - """ - '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/cpu' - "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.cpu" - """ + """Human-readable CPU description""" disk: str - """ - '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/disk' - "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.disk" - """ + """Human-readable disk description""" gpu: str - """ - '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/gpu' - "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.gpu" - """ + """Human-readable GPU description""" network: str - """ - '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/network' - "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.network" - """ + """Human-readable NIC description""" ram: str - """ - '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/ram' - "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.ram" - """ + """Human-readable RAM description""" class GPUBaremetalFlavorSerializerWithoutPriceHardwareProperties(BaseModel): gpu_count: Optional[int] = None - """ - '#/components/schemas/GpuFlavorHardwareProperties/properties/gpu_count/anyOf/0' - "$.components.schemas.GpuFlavorHardwareProperties.properties.gpu_count.anyOf[0]" - """ + """The total count of available GPUs.""" gpu_manufacturer: Optional[str] = None - """ - '#/components/schemas/GpuFlavorHardwareProperties/properties/gpu_manufacturer/anyOf/0' - "$.components.schemas.GpuFlavorHardwareProperties.properties.gpu_manufacturer.anyOf[0]" - """ + """The manufacturer of the graphics processing GPU""" gpu_model: Optional[str] = None - """ - '#/components/schemas/GpuFlavorHardwareProperties/properties/gpu_model/anyOf/0' - "$.components.schemas.GpuFlavorHardwareProperties.properties.gpu_model.anyOf[0]" - """ + """GPU model""" class GPUBaremetalFlavorSerializerWithoutPrice(BaseModel): architecture: Optional[str] = None - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithoutPrice/properties/architecture/anyOf/0' - "$.components.schemas.GpuBaremetalFlavorSerializerWithoutPrice.properties.architecture.anyOf[0]" - """ + """Flavor architecture type""" capacity: int - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithoutPrice/properties/capacity' - "$.components.schemas.GpuBaremetalFlavorSerializerWithoutPrice.properties.capacity" - """ + """Number of available instances of given flavor""" disabled: bool - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithoutPrice/properties/disabled' - "$.components.schemas.GpuBaremetalFlavorSerializerWithoutPrice.properties.disabled" - """ + """If the flavor is disabled, new resources cannot be created using this flavor.""" hardware_description: GPUBaremetalFlavorSerializerWithoutPriceHardwareDescription - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithoutPrice/properties/hardware_description' - "$.components.schemas.GpuBaremetalFlavorSerializerWithoutPrice.properties.hardware_description" - """ + """Additional bare metal hardware description""" hardware_properties: GPUBaremetalFlavorSerializerWithoutPriceHardwareProperties - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithoutPrice/properties/hardware_properties' - "$.components.schemas.GpuBaremetalFlavorSerializerWithoutPrice.properties.hardware_properties" - """ + """Additional bare metal hardware properties""" name: str - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithoutPrice/properties/name' - "$.components.schemas.GpuBaremetalFlavorSerializerWithoutPrice.properties.name" - """ + """Flavor name""" class GPUBaremetalFlavorSerializerWithPricesHardwareDescription(BaseModel): cpu: str - """ - '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/cpu' - "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.cpu" - """ + """Human-readable CPU description""" disk: str - """ - '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/disk' - "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.disk" - """ + """Human-readable disk description""" gpu: str - """ - '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/gpu' - "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.gpu" - """ + """Human-readable GPU description""" network: str - """ - '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/network' - "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.network" - """ + """Human-readable NIC description""" ram: str - """ - '#/components/schemas/GpuBaremetalFlavorHardwareDescriptionSerializer/properties/ram' - "$.components.schemas.GpuBaremetalFlavorHardwareDescriptionSerializer.properties.ram" - """ + """Human-readable RAM description""" class GPUBaremetalFlavorSerializerWithPricesHardwareProperties(BaseModel): gpu_count: Optional[int] = None - """ - '#/components/schemas/GpuFlavorHardwareProperties/properties/gpu_count/anyOf/0' - "$.components.schemas.GpuFlavorHardwareProperties.properties.gpu_count.anyOf[0]" - """ + """The total count of available GPUs.""" gpu_manufacturer: Optional[str] = None - """ - '#/components/schemas/GpuFlavorHardwareProperties/properties/gpu_manufacturer/anyOf/0' - "$.components.schemas.GpuFlavorHardwareProperties.properties.gpu_manufacturer.anyOf[0]" - """ + """The manufacturer of the graphics processing GPU""" gpu_model: Optional[str] = None - """ - '#/components/schemas/GpuFlavorHardwareProperties/properties/gpu_model/anyOf/0' - "$.components.schemas.GpuFlavorHardwareProperties.properties.gpu_model.anyOf[0]" - """ + """GPU model""" class GPUBaremetalFlavorSerializerWithPricesPrice(BaseModel): currency_code: Optional[str] = None - """ - '#/components/schemas/FlavorPrice/properties/currency_code/anyOf/0' - "$.components.schemas.FlavorPrice.properties.currency_code.anyOf[0]" - """ + """Currency code. Shown if the include_prices query parameter if set to true""" price_per_hour: Optional[float] = None - """ - '#/components/schemas/FlavorPrice/properties/price_per_hour/anyOf/0' - "$.components.schemas.FlavorPrice.properties.price_per_hour.anyOf[0]" - """ + """Price per hour. Shown if the include_prices query parameter if set to true""" price_per_month: Optional[float] = None - """ - '#/components/schemas/FlavorPrice/properties/price_per_month/anyOf/0' - "$.components.schemas.FlavorPrice.properties.price_per_month.anyOf[0]" - """ + """Price per month. Shown if the include_prices query parameter if set to true""" price_status: Optional[Literal["error", "hide", "show"]] = None - """ - '#/components/schemas/FlavorPrice/properties/price_status/anyOf/0' - "$.components.schemas.FlavorPrice.properties.price_status.anyOf[0]" - """ + """Price status for the UI""" class GPUBaremetalFlavorSerializerWithPrices(BaseModel): architecture: Optional[str] = None - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/architecture/anyOf/0' - "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.architecture.anyOf[0]" - """ + """Flavor architecture type""" capacity: int - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/capacity' - "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.capacity" - """ + """Number of available instances of given flavor""" disabled: bool - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/disabled' - "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.disabled" - """ + """If the flavor is disabled, new resources cannot be created using this flavor.""" hardware_description: GPUBaremetalFlavorSerializerWithPricesHardwareDescription - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/hardware_description' - "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.hardware_description" - """ + """Additional virtual hardware description""" hardware_properties: GPUBaremetalFlavorSerializerWithPricesHardwareProperties - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/hardware_properties' - "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.hardware_properties" - """ + """Additional bare metal hardware properties""" name: str - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/name' - "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.name" - """ + """Flavor name""" price: GPUBaremetalFlavorSerializerWithPricesPrice - """ - '#/components/schemas/GpuBaremetalFlavorSerializerWithPrices/properties/price' - "$.components.schemas.GpuBaremetalFlavorSerializerWithPrices.properties.price" - """ + """Flavor price""" GPUBaremetalFlavor: TypeAlias = Union[GPUBaremetalFlavorSerializerWithoutPrice, GPUBaremetalFlavorSerializerWithPrices] diff --git a/src/gcore/types/cloud/gpu_baremetal_flavor_list.py b/src/gcore/types/cloud/gpu_baremetal_flavor_list.py index 7bad1937..8b241544 100644 --- a/src/gcore/types/cloud/gpu_baremetal_flavor_list.py +++ b/src/gcore/types/cloud/gpu_baremetal_flavor_list.py @@ -10,13 +10,7 @@ class GPUBaremetalFlavorList(BaseModel): count: int - """ - '#/components/schemas/ListGpuBaremetalFlavorSerializer/properties/count' - "$.components.schemas.ListGpuBaremetalFlavorSerializer.properties.count" - """ + """Number of objects""" results: List[GPUBaremetalFlavor] - """ - '#/components/schemas/ListGpuBaremetalFlavorSerializer/properties/results' - "$.components.schemas.ListGpuBaremetalFlavorSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/gpu_cluster_server.py b/src/gcore/types/cloud/gpu_cluster_server.py index a41b818a..842a77d7 100644 --- a/src/gcore/types/cloud/gpu_cluster_server.py +++ b/src/gcore/types/cloud/gpu_cluster_server.py @@ -20,216 +20,117 @@ class FixedIPAssignment(BaseModel): external: bool - """ - '#/components/schemas/IpAssignmentsSerializer/properties/external' - "$.components.schemas.IpAssignmentsSerializer.properties.external" - """ + """Is network external""" ip_address: str - """ - '#/components/schemas/IpAssignmentsSerializer/properties/ip_address' - "$.components.schemas.IpAssignmentsSerializer.properties.ip_address" - """ + """Ip address""" subnet_id: str - """ - '#/components/schemas/IpAssignmentsSerializer/properties/subnet_id' - "$.components.schemas.IpAssignmentsSerializer.properties.subnet_id" - """ + """Interface subnet id""" class FlavorHardwareDescription(BaseModel): cpu: str - """ - '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/cpu' - "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.cpu" - """ + """Human-readable CPU description""" disk: str - """ - '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/disk' - "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.disk" - """ + """Human-readable disk description""" gpu: str - """ - '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/gpu' - "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.gpu" - """ + """Human-readable GPU description""" license: str - """ - '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/license' - "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.license" - """ + """If the flavor is licensed, this field contains the license type""" network: str - """ - '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/network' - "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.network" - """ + """Human-readable NIC description""" ram: str - """ - '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/ram' - "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.ram" - """ + """Human-readable RAM description""" class Flavor(BaseModel): architecture: str - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/architecture' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.architecture" - """ + """CPU architecture""" flavor_id: str - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/flavor_id' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.flavor_id" - """ + """Flavor ID is the same as name""" flavor_name: str - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/flavor_name' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.flavor_name" - """ + """Flavor name""" hardware_description: FlavorHardwareDescription - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/hardware_description' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.hardware_description" - """ + """Additional hardware description""" os_type: str - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/os_type' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.os_type" - """ + """Operating system""" ram: int - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/ram' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.ram" - """ + """RAM size in MiB""" resource_class: str - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/resource_class' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.resource_class" - """ + """Flavor resource class for mapping to hardware capacity""" vcpus: int - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/vcpus' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.vcpus" - """ + """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" class SecurityGroup(BaseModel): name: str - """ - '#/components/schemas/NameSerializerPydantic/properties/name' - "$.components.schemas.NameSerializerPydantic.properties.name" - """ + """Name.""" class GPUClusterServer(BaseModel): addresses: Dict[str, List[Address]] - """ - '#/components/schemas/GPUClusterServerSerializer/properties/addresses' - "$.components.schemas.GPUClusterServerSerializer.properties.addresses" - """ + """Map of network_name to list of addresses in that network""" blackhole_ports: List[BlackholePort] - """ - '#/components/schemas/GPUClusterServerSerializer/properties/blackhole_ports' - "$.components.schemas.GPUClusterServerSerializer.properties.blackhole_ports" - """ + """IP addresses of the instances that are blackholed by DDoS mitigation system""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/GPUClusterServerSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.GPUClusterServerSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" ddos_profile: Optional[DDOSProfile] = None - """ - '#/components/schemas/GPUClusterServerSerializer/properties/ddos_profile/anyOf/0' - "$.components.schemas.GPUClusterServerSerializer.properties.ddos_profile.anyOf[0]" + """Advanced DDoS protection profile. + + It is always `null` if query parameter `with_ddos=true` is not set. """ fixed_ip_assignments: Optional[List[FixedIPAssignment]] = None - """ - '#/components/schemas/GPUClusterServerSerializer/properties/fixed_ip_assignments/anyOf/0' - "$.components.schemas.GPUClusterServerSerializer.properties.fixed_ip_assignments.anyOf[0]" - """ + """Fixed IP assigned to instance""" flavor: Flavor - """ - '#/components/schemas/GPUClusterServerSerializer/properties/flavor' - "$.components.schemas.GPUClusterServerSerializer.properties.flavor" - """ + """Flavor""" instance_created: datetime - """ - '#/components/schemas/GPUClusterServerSerializer/properties/instance_created' - "$.components.schemas.GPUClusterServerSerializer.properties.instance_created" - """ + """Datetime when instance was created""" instance_description: Optional[str] = None - """ - '#/components/schemas/GPUClusterServerSerializer/properties/instance_description/anyOf/0' - "$.components.schemas.GPUClusterServerSerializer.properties.instance_description.anyOf[0]" - """ + """Instance description""" instance_id: str - """ - '#/components/schemas/GPUClusterServerSerializer/properties/instance_id' - "$.components.schemas.GPUClusterServerSerializer.properties.instance_id" - """ + """Instance ID""" instance_isolation: Optional[InstanceIsolation] = None - """ - '#/components/schemas/GPUClusterServerSerializer/properties/instance_isolation/anyOf/0' - "$.components.schemas.GPUClusterServerSerializer.properties.instance_isolation.anyOf[0]" - """ + """Instance isolation information""" instance_name: str - """ - '#/components/schemas/GPUClusterServerSerializer/properties/instance_name' - "$.components.schemas.GPUClusterServerSerializer.properties.instance_name" - """ + """Instance name""" project_id: int - """ - '#/components/schemas/GPUClusterServerSerializer/properties/project_id' - "$.components.schemas.GPUClusterServerSerializer.properties.project_id" - """ + """Project ID""" region: str - """ - '#/components/schemas/GPUClusterServerSerializer/properties/region' - "$.components.schemas.GPUClusterServerSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/GPUClusterServerSerializer/properties/region_id' - "$.components.schemas.GPUClusterServerSerializer.properties.region_id" - """ + """Region ID""" security_groups: List[SecurityGroup] - """ - '#/components/schemas/GPUClusterServerSerializer/properties/security_groups' - "$.components.schemas.GPUClusterServerSerializer.properties.security_groups" - """ + """Security groups""" ssh_key_name: Optional[str] = None - """ - '#/components/schemas/GPUClusterServerSerializer/properties/ssh_key_name/anyOf/0' - "$.components.schemas.GPUClusterServerSerializer.properties.ssh_key_name.anyOf[0]" - """ + """SSH key name assigned to instance""" status: Literal[ "ACTIVE", @@ -253,28 +154,27 @@ class GPUClusterServer(BaseModel): "UNKNOWN", "VERIFY_RESIZE", ] - """ - '#/components/schemas/GPUClusterServerSerializer/properties/status' - "$.components.schemas.GPUClusterServerSerializer.properties.status" - """ + """Instance status""" tags: List[Tag] - """ - '#/components/schemas/GPUClusterServerSerializer/properties/tags' - "$.components.schemas.GPUClusterServerSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ task_id: Optional[str] = None - """ - '#/components/schemas/GPUClusterServerSerializer/properties/task_id/anyOf/0' - "$.components.schemas.GPUClusterServerSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ task_state: Optional[str] = None - """ - '#/components/schemas/GPUClusterServerSerializer/properties/task_state/anyOf/0' - "$.components.schemas.GPUClusterServerSerializer.properties.task_state.anyOf[0]" - """ + """Task state""" vm_state: Literal[ "active", @@ -290,7 +190,4 @@ class GPUClusterServer(BaseModel): "stopped", "suspended", ] - """ - '#/components/schemas/GPUClusterServerSerializer/properties/vm_state' - "$.components.schemas.GPUClusterServerSerializer.properties.vm_state" - """ + """Virtual machine state (active)""" diff --git a/src/gcore/types/cloud/gpu_cluster_server_list.py b/src/gcore/types/cloud/gpu_cluster_server_list.py index c1f84c5e..21dd43f9 100644 --- a/src/gcore/types/cloud/gpu_cluster_server_list.py +++ b/src/gcore/types/cloud/gpu_cluster_server_list.py @@ -10,13 +10,7 @@ class GPUClusterServerList(BaseModel): count: int - """ - '#/components/schemas/GPUClusterServerCollectionSerializer/properties/count' - "$.components.schemas.GPUClusterServerCollectionSerializer.properties.count" - """ + """Number of objects""" results: List[GPUClusterServer] - """ - '#/components/schemas/GPUClusterServerCollectionSerializer/properties/results' - "$.components.schemas.GPUClusterServerCollectionSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/gpu_image.py b/src/gcore/types/cloud/gpu_image.py index 35ef98cf..a5335c77 100644 --- a/src/gcore/types/cloud/gpu_image.py +++ b/src/gcore/types/cloud/gpu_image.py @@ -11,97 +11,60 @@ class GPUImage(BaseModel): id: str - """ - '#/components/schemas/GpuImageSerializer/properties/id' - "$.components.schemas.GpuImageSerializer.properties.id" - """ + """Image ID""" created_at: datetime - """ - '#/components/schemas/GpuImageSerializer/properties/created_at' - "$.components.schemas.GpuImageSerializer.properties.created_at" - """ + """Datetime when the image was created""" min_disk: int - """ - '#/components/schemas/GpuImageSerializer/properties/min_disk' - "$.components.schemas.GpuImageSerializer.properties.min_disk" - """ + """Minimal boot volume required""" min_ram: int - """ - '#/components/schemas/GpuImageSerializer/properties/min_ram' - "$.components.schemas.GpuImageSerializer.properties.min_ram" - """ + """Minimal VM RAM required""" name: str - """ - '#/components/schemas/GpuImageSerializer/properties/name' - "$.components.schemas.GpuImageSerializer.properties.name" - """ + """Image name""" status: str - """ - '#/components/schemas/GpuImageSerializer/properties/status' - "$.components.schemas.GpuImageSerializer.properties.status" - """ + """Image status""" tags: List[Tag] - """ - '#/components/schemas/GpuImageSerializer/properties/tags' - "$.components.schemas.GpuImageSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ updated_at: datetime - """ - '#/components/schemas/GpuImageSerializer/properties/updated_at' - "$.components.schemas.GpuImageSerializer.properties.updated_at" - """ + """Datetime when the image was updated""" visibility: str - """ - '#/components/schemas/GpuImageSerializer/properties/visibility' - "$.components.schemas.GpuImageSerializer.properties.visibility" - """ + """Image visibility. Globally visible images are public""" architecture: Optional[str] = None - """ - '#/components/schemas/GpuImageSerializer/properties/architecture/anyOf/0' - "$.components.schemas.GpuImageSerializer.properties.architecture.anyOf[0]" - """ + """Image architecture type""" os_distro: Optional[str] = None - """ - '#/components/schemas/GpuImageSerializer/properties/os_distro/anyOf/0' - "$.components.schemas.GpuImageSerializer.properties.os_distro.anyOf[0]" - """ + """OS Distribution""" os_type: Optional[str] = None - """ - '#/components/schemas/GpuImageSerializer/properties/os_type/anyOf/0' - "$.components.schemas.GpuImageSerializer.properties.os_type.anyOf[0]" - """ + """The operating system installed on the image""" os_version: Optional[str] = None - """ - '#/components/schemas/GpuImageSerializer/properties/os_version/anyOf/0' - "$.components.schemas.GpuImageSerializer.properties.os_version.anyOf[0]" - """ + """OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian""" size: Optional[int] = None - """ - '#/components/schemas/GpuImageSerializer/properties/size' - "$.components.schemas.GpuImageSerializer.properties.size" - """ + """Image size in bytes.""" ssh_key: Optional[str] = None - """ - '#/components/schemas/GpuImageSerializer/properties/ssh_key/anyOf/0' - "$.components.schemas.GpuImageSerializer.properties.ssh_key.anyOf[0]" - """ + """Whether the image supports SSH key or not""" task_id: Optional[str] = None - """ - '#/components/schemas/GpuImageSerializer/properties/task_id/anyOf/0' - "$.components.schemas.GpuImageSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ diff --git a/src/gcore/types/cloud/gpu_image_list.py b/src/gcore/types/cloud/gpu_image_list.py index 2d721edc..d180ff92 100644 --- a/src/gcore/types/cloud/gpu_image_list.py +++ b/src/gcore/types/cloud/gpu_image_list.py @@ -10,13 +10,7 @@ class GPUImageList(BaseModel): count: int - """ - '#/components/schemas/ListGpuImageSerializer/properties/count' - "$.components.schemas.ListGpuImageSerializer.properties.count" - """ + """Number of objects""" results: List[GPUImage] - """ - '#/components/schemas/ListGpuImageSerializer/properties/results' - "$.components.schemas.ListGpuImageSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/health_monitor_status.py b/src/gcore/types/cloud/health_monitor_status.py index eaeb5a70..733e8d77 100644 --- a/src/gcore/types/cloud/health_monitor_status.py +++ b/src/gcore/types/cloud/health_monitor_status.py @@ -10,25 +10,13 @@ class HealthMonitorStatus(BaseModel): id: str - """ - '#/components/schemas/HealthMonitorStatusSerializer/properties/id' - "$.components.schemas.HealthMonitorStatusSerializer.properties.id" - """ + """UUID of the entity""" operating_status: LoadBalancerOperatingStatus - """ - '#/components/schemas/HealthMonitorStatusSerializer/properties/operating_status' - "$.components.schemas.HealthMonitorStatusSerializer.properties.operating_status" - """ + """Operating status of the entity""" provisioning_status: ProvisioningStatus - """ - '#/components/schemas/HealthMonitorStatusSerializer/properties/provisioning_status' - "$.components.schemas.HealthMonitorStatusSerializer.properties.provisioning_status" - """ + """Provisioning status of the entity""" type: HealthMonitorType - """ - '#/components/schemas/HealthMonitorStatusSerializer/properties/type' - "$.components.schemas.HealthMonitorStatusSerializer.properties.type" - """ + """Type of the Health Monitor""" diff --git a/src/gcore/types/cloud/image.py b/src/gcore/types/cloud/image.py index d6e4a93f..96313cdd 100644 --- a/src/gcore/types/cloud/image.py +++ b/src/gcore/types/cloud/image.py @@ -12,157 +12,89 @@ class Image(BaseModel): id: str - """ - '#/components/schemas/ImageSerializer/properties/id' - "$.components.schemas.ImageSerializer.properties.id" - """ + """Image ID""" created_at: datetime - """ - '#/components/schemas/ImageSerializer/properties/created_at' - "$.components.schemas.ImageSerializer.properties.created_at" - """ + """Datetime when the image was created""" disk_format: str - """ - '#/components/schemas/ImageSerializer/properties/disk_format' - "$.components.schemas.ImageSerializer.properties.disk_format" - """ + """Disk format""" min_disk: int - """ - '#/components/schemas/ImageSerializer/properties/min_disk' - "$.components.schemas.ImageSerializer.properties.min_disk" - """ + """Minimal boot volume required""" min_ram: int - """ - '#/components/schemas/ImageSerializer/properties/min_ram' - "$.components.schemas.ImageSerializer.properties.min_ram" - """ + """Minimal VM RAM required""" name: str - """ - '#/components/schemas/ImageSerializer/properties/name' - "$.components.schemas.ImageSerializer.properties.name" - """ + """Image display name""" os_distro: str - """ - '#/components/schemas/ImageSerializer/properties/os_distro' - "$.components.schemas.ImageSerializer.properties.os_distro" - """ + """OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc.""" os_type: Literal["linux", "windows"] - """ - '#/components/schemas/ImageSerializer/properties/os_type' - "$.components.schemas.ImageSerializer.properties.os_type" - """ + """The operating system installed on the image.""" os_version: str - """ - '#/components/schemas/ImageSerializer/properties/os_version' - "$.components.schemas.ImageSerializer.properties.os_version" - """ + """OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian""" project_id: int - """ - '#/components/schemas/ImageSerializer/properties/project_id' - "$.components.schemas.ImageSerializer.properties.project_id" - """ + """Project ID""" region: str - """ - '#/components/schemas/ImageSerializer/properties/region' - "$.components.schemas.ImageSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/ImageSerializer/properties/region_id' - "$.components.schemas.ImageSerializer.properties.region_id" - """ + """Region ID""" size: int - """ - '#/components/schemas/ImageSerializer/properties/size' - "$.components.schemas.ImageSerializer.properties.size" - """ + """Image size in bytes""" status: str - """ - '#/components/schemas/ImageSerializer/properties/status' - "$.components.schemas.ImageSerializer.properties.status" - """ + """Image status, i.e. active""" tags: List[Tag] - """ - '#/components/schemas/ImageSerializer/properties/tags' - "$.components.schemas.ImageSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ updated_at: datetime - """ - '#/components/schemas/ImageSerializer/properties/updated_at' - "$.components.schemas.ImageSerializer.properties.updated_at" - """ + """Datetime when the image was updated""" visibility: str - """ - '#/components/schemas/ImageSerializer/properties/visibility' - "$.components.schemas.ImageSerializer.properties.visibility" - """ + """Image visibility. Globally visible images are public""" architecture: Optional[Literal["aarch64", "x86_64"]] = None - """ - '#/components/schemas/ImageSerializer/properties/architecture' - "$.components.schemas.ImageSerializer.properties.architecture" - """ + """An image architecture type: aarch64, x86_64""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/ImageSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.ImageSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" description: Optional[str] = None - """ - '#/components/schemas/ImageSerializer/properties/description/anyOf/0' - "$.components.schemas.ImageSerializer.properties.description.anyOf[0]" - """ + """Image description""" display_order: Optional[int] = None - """ - '#/components/schemas/ImageSerializer/properties/display_order/anyOf/0' - "$.components.schemas.ImageSerializer.properties.display_order.anyOf[0]" - """ hw_firmware_type: Optional[Literal["bios", "uefi"]] = None - """ - '#/components/schemas/ImageSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.ImageSerializer.properties.hw_firmware_type.anyOf[0]" - """ + """Specifies the type of firmware with which to boot the guest.""" hw_machine_type: Optional[Literal["pc", "q35"]] = None - """ - '#/components/schemas/ImageSerializer/properties/hw_machine_type/anyOf/0' - "$.components.schemas.ImageSerializer.properties.hw_machine_type.anyOf[0]" - """ + """A virtual chipset type.""" is_baremetal: Optional[bool] = None - """ - '#/components/schemas/ImageSerializer/properties/is_baremetal/anyOf/0' - "$.components.schemas.ImageSerializer.properties.is_baremetal.anyOf[0]" - """ + """Set to true if the image will be used by bare metal servers. Defaults to false.""" ssh_key: Optional[Literal["allow", "deny", "required"]] = None - """ - '#/components/schemas/ImageSerializer/properties/ssh_key/anyOf/0' - "$.components.schemas.ImageSerializer.properties.ssh_key.anyOf[0]" - """ + """Whether the image supports SSH key or not""" task_id: Optional[str] = None - """ - '#/components/schemas/ImageSerializer/properties/task_id/anyOf/0' - "$.components.schemas.ImageSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ diff --git a/src/gcore/types/cloud/image_list.py b/src/gcore/types/cloud/image_list.py index d5ac3e1f..4a4981fc 100644 --- a/src/gcore/types/cloud/image_list.py +++ b/src/gcore/types/cloud/image_list.py @@ -10,13 +10,7 @@ class ImageList(BaseModel): count: int - """ - '#/components/schemas/ImageCollectionSerializer/properties/count' - "$.components.schemas.ImageCollectionSerializer.properties.count" - """ + """Number of objects""" results: List[Image] - """ - '#/components/schemas/ImageCollectionSerializer/properties/results' - "$.components.schemas.ImageCollectionSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/inference/container.py b/src/gcore/types/cloud/inference/container.py index 4648ec87..20170d6c 100644 --- a/src/gcore/types/cloud/inference/container.py +++ b/src/gcore/types/cloud/inference/container.py @@ -11,31 +11,16 @@ class Container(BaseModel): address: Optional[str] = None - """ - '#/components/schemas/ContainerOutSerializerV3/properties/address/anyOf/0' - "$.components.schemas.ContainerOutSerializerV3.properties.address.anyOf[0]" - """ + """Address of the inference instance""" deploy_status: DeployStatus - """ - '#/components/schemas/ContainerOutSerializerV3/properties/deploy_status' - "$.components.schemas.ContainerOutSerializerV3.properties.deploy_status" - """ + """Status of the containers deployment""" error_message: Optional[str] = None - """ - '#/components/schemas/ContainerOutSerializerV3/properties/error_message/anyOf/0' - "$.components.schemas.ContainerOutSerializerV3.properties.error_message.anyOf[0]" - """ + """Error message if the container deployment failed""" region_id: int - """ - '#/components/schemas/ContainerOutSerializerV3/properties/region_id' - "$.components.schemas.ContainerOutSerializerV3.properties.region_id" - """ + """Region name for the container""" scale: ContainerScale - """ - '#/components/schemas/ContainerOutSerializerV3/properties/scale' - "$.components.schemas.ContainerOutSerializerV3.properties.scale" - """ + """Scale for the container""" diff --git a/src/gcore/types/cloud/inference/deployment_create_params.py b/src/gcore/types/cloud/inference/deployment_create_params.py index 2133185c..e69a1c2a 100644 --- a/src/gcore/types/cloud/inference/deployment_create_params.py +++ b/src/gcore/types/cloud/inference/deployment_create_params.py @@ -28,317 +28,195 @@ class DeploymentCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments'].post.parameters[0].schema" - """ + """Project ID""" containers: Required[Iterable[Container]] - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/containers' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.containers" - """ + """List of containers for the inference instance.""" flavor_name: Required[str] - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/flavor_name' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.flavor_name" - """ + """Flavor name for the inference instance.""" image: Required[str] - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/image' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.image" + """Docker image for the inference instance. + + This field should contain the image name and tag in the format 'name:tag', e.g., + 'nginx:latest'. It defaults to Docker Hub as the image registry, but any + accessible Docker image URL can be specified. """ listening_port: Required[int] - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/listening_port' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.listening_port" - """ + """Listening port for the inference instance.""" name: Required[str] - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/name' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.name" - """ + """Inference instance name.""" auth_enabled: bool - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/auth_enabled' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.auth_enabled" + """Set to `true` to enable API key authentication for the inference instance. + + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required + for the requests to the instance if enabled """ command: Optional[List[str]] - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/command/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.command.anyOf[0]" - """ + """Command to be executed when running a container from an image.""" credentials_name: Optional[str] - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/credentials_name/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.credentials_name.anyOf[0]" - """ + """Registry credentials name""" description: Optional[str] - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/description/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.description.anyOf[0]" - """ + """Inference instance description.""" envs: Dict[str, str] - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/envs' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.envs" - """ + """Environment variables for the inference instance.""" ingress_opts: Optional[IngressOptsParam] - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/ingress_opts/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.ingress_opts.anyOf[0]" - """ + """Ingress options for the inference instance""" logging: Optional[Logging] - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/logging/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.logging.anyOf[0]" - """ + """Logging configuration for the inference instance""" probes: Optional[Probes] - """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/probes/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.probes.anyOf[0]" + """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. """ api_timeout: Annotated[Optional[int], PropertyInfo(alias="timeout")] """ - '#/components/schemas/InferenceInstanceInSerializerV3/properties/timeout/anyOf/0' - "$.components.schemas.InferenceInstanceInSerializerV3.properties.timeout.anyOf[0]" + Specifies the duration in seconds without any requests after which the + containers will be downscaled to their minimum scale value as defined by + `scale.min`. If set, this helps in optimizing resource usage by reducing the + number of container instances during periods of inactivity. The default value + when the parameter is not set is 120. """ class ContainerScaleTriggersCPU(TypedDict, total=False): threshold: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' - "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" - """ + """Threshold value for the trigger in percentage""" class ContainerScaleTriggersGPUMemory(TypedDict, total=False): threshold: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' - "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" - """ + """Threshold value for the trigger in percentage""" class ContainerScaleTriggersGPUUtilization(TypedDict, total=False): threshold: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' - "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" - """ + """Threshold value for the trigger in percentage""" class ContainerScaleTriggersHTTP(TypedDict, total=False): rate: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersRateSerializer/properties/rate' - "$.components.schemas.ContainerScaleTriggersRateSerializer.properties.rate" - """ + """Request count per 'window' seconds for the http trigger""" window: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersRateSerializer/properties/window' - "$.components.schemas.ContainerScaleTriggersRateSerializer.properties.window" - """ + """Time window for rate calculation in seconds""" class ContainerScaleTriggersMemory(TypedDict, total=False): threshold: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' - "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" - """ + """Threshold value for the trigger in percentage""" class ContainerScaleTriggersSqs(TypedDict, total=False): activation_queue_length: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/activation_queue_length' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.activation_queue_length" - """ + """Number of messages for activation""" aws_region: Required[str] - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/aws_region' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.aws_region" - """ + """AWS region""" queue_length: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/queue_length' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.queue_length" - """ + """Number of messages for one replica""" queue_url: Required[str] - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/queue_url' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.queue_url" - """ + """SQS queue URL""" secret_name: Required[str] - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/secret_name' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.secret_name" - """ + """Auth secret name""" aws_endpoint: Optional[str] - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/aws_endpoint/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.aws_endpoint.anyOf[0]" - """ + """Custom AWS endpoint""" scale_on_delayed: bool - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/scale_on_delayed' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.scale_on_delayed" - """ + """Scale on delayed messages""" scale_on_flight: bool - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/scale_on_flight' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.scale_on_flight" - """ + """Scale on in-flight messages""" class ContainerScaleTriggers(TypedDict, total=False): cpu: Optional[ContainerScaleTriggersCPU] - """ - '#/components/schemas/ContainerScaleTriggersSerializer/properties/cpu/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSerializer.properties.cpu.anyOf[0]" - """ + """CPU trigger configuration""" gpu_memory: Optional[ContainerScaleTriggersGPUMemory] - """ - '#/components/schemas/ContainerScaleTriggersSerializer/properties/gpu_memory/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSerializer.properties.gpu_memory.anyOf[0]" + """GPU memory trigger configuration. + + Calculated by DCGM_FI_DEV_MEM_COPY_UTIL metric """ gpu_utilization: Optional[ContainerScaleTriggersGPUUtilization] - """ - '#/components/schemas/ContainerScaleTriggersSerializer/properties/gpu_utilization/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSerializer.properties.gpu_utilization.anyOf[0]" + """GPU utilization trigger configuration. + + Calculated by DCGM_FI_DEV_GPU_UTIL metric """ http: Optional[ContainerScaleTriggersHTTP] - """ - '#/components/schemas/ContainerScaleTriggersSerializer/properties/http/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSerializer.properties.http.anyOf[0]" - """ + """HTTP trigger configuration""" memory: Optional[ContainerScaleTriggersMemory] - """ - '#/components/schemas/ContainerScaleTriggersSerializer/properties/memory/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSerializer.properties.memory.anyOf[0]" - """ + """Memory trigger configuration""" sqs: Optional[ContainerScaleTriggersSqs] - """ - '#/components/schemas/ContainerScaleTriggersSerializer/properties/sqs/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSerializer.properties.sqs.anyOf[0]" - """ + """SQS trigger configuration""" class ContainerScale(TypedDict, total=False): max: Required[int] - """ - '#/components/schemas/ContainerScaleSerializerV3/properties/max' - "$.components.schemas.ContainerScaleSerializerV3.properties.max" - """ + """Maximum scale for the container""" min: Required[int] - """ - '#/components/schemas/ContainerScaleSerializerV3/properties/min' - "$.components.schemas.ContainerScaleSerializerV3.properties.min" - """ + """Minimum scale for the container""" cooldown_period: Optional[int] - """ - '#/components/schemas/ContainerScaleSerializerV3/properties/cooldown_period/anyOf/0' - "$.components.schemas.ContainerScaleSerializerV3.properties.cooldown_period.anyOf[0]" - """ + """Cooldown period between scaling actions in seconds""" polling_interval: Optional[int] - """ - '#/components/schemas/ContainerScaleSerializerV3/properties/polling_interval/anyOf/0' - "$.components.schemas.ContainerScaleSerializerV3.properties.polling_interval.anyOf[0]" - """ + """Polling interval for scaling triggers in seconds""" triggers: ContainerScaleTriggers - """ - '#/components/schemas/ContainerScaleSerializerV3/properties/triggers' - "$.components.schemas.ContainerScaleSerializerV3.properties.triggers" - """ + """Triggers for scaling actions""" class Container(TypedDict, total=False): region_id: Required[int] - """ - '#/components/schemas/ContainerInSerializerV3/properties/region_id' - "$.components.schemas.ContainerInSerializerV3.properties.region_id" - """ + """Region id for the container""" scale: Required[ContainerScale] - """ - '#/components/schemas/ContainerInSerializerV3/properties/scale' - "$.components.schemas.ContainerInSerializerV3.properties.scale" - """ + """Scale for the container""" class Logging(TypedDict, total=False): destination_region_id: Optional[int] - """ - '#/components/schemas/LoggingInSerializer/properties/destination_region_id/anyOf/0' - "$.components.schemas.LoggingInSerializer.properties.destination_region_id.anyOf[0]" - """ + """ID of the region in which the logs will be stored""" enabled: bool - """ - '#/components/schemas/LoggingInSerializer/properties/enabled' - "$.components.schemas.LoggingInSerializer.properties.enabled" - """ + """Enable or disable log streaming""" retention_policy: Optional[LaasIndexRetentionPolicyParam] - """ - '#/components/schemas/LoggingInSerializer/properties/retention_policy/anyOf/0' - "$.components.schemas.LoggingInSerializer.properties.retention_policy.anyOf[0]" - """ + """Logs retention policy""" topic_name: Optional[str] - """ - '#/components/schemas/LoggingInSerializer/properties/topic_name/anyOf/0' - "$.components.schemas.LoggingInSerializer.properties.topic_name.anyOf[0]" - """ + """The topic name to stream logs to""" class Probes(TypedDict, total=False): liveness_probe: Optional[ContainerProbeConfigCreateParam] - """ - '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/liveness_probe/anyOf/0' - "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.liveness_probe.anyOf[0]" - """ + """Liveness probe configuration""" readiness_probe: Optional[ContainerProbeConfigCreateParam] - """ - '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/readiness_probe/anyOf/0' - "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.readiness_probe.anyOf[0]" - """ + """Readiness probe configuration""" startup_probe: Optional[ContainerProbeConfigCreateParam] - """ - '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/startup_probe/anyOf/0' - "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.startup_probe.anyOf[0]" - """ + """Startup probe configuration""" diff --git a/src/gcore/types/cloud/inference/deployment_list_params.py b/src/gcore/types/cloud/inference/deployment_list_params.py index d1c0bd5d..74410be1 100644 --- a/src/gcore/types/cloud/inference/deployment_list_params.py +++ b/src/gcore/types/cloud/inference/deployment_list_params.py @@ -9,19 +9,13 @@ class DeploymentListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[0].schema" - """ + """Project ID""" limit: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/1' - "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[1]" - """ + """Optional. Limit the number of returned items""" offset: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments/get/parameters/2' - "$.paths['/cloud/v3/inference/{project_id}/deployments'].get.parameters[2]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ diff --git a/src/gcore/types/cloud/inference/deployment_update_params.py b/src/gcore/types/cloud/inference/deployment_update_params.py index a9a628ed..cf081581 100644 --- a/src/gcore/types/cloud/inference/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -28,311 +28,188 @@ class DeploymentUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D/patch/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}'].patch.parameters[0].schema" - """ + """Project ID""" auth_enabled: Optional[bool] - """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/auth_enabled/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.auth_enabled.anyOf[0]" + """Set to `true` to enable API key authentication for the inference instance. + + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required + for the requests to the instance if enabled """ command: Optional[List[str]] - """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/command/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.command.anyOf[0]" - """ + """Command to be executed when running a container from an image.""" containers: Optional[Iterable[Container]] - """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/containers/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.containers.anyOf[0]" - """ + """List of containers for the inference instance.""" credentials_name: Optional[str] - """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/credentials_name/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.credentials_name.anyOf[0]" - """ + """Registry credentials name""" description: Optional[str] - """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/description/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.description.anyOf[0]" - """ + """Inference instance description.""" envs: Optional[Dict[str, str]] - """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/envs/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.envs.anyOf[0]" - """ + """Environment variables for the inference instance.""" flavor_name: Optional[str] - """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/flavor_name/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.flavor_name.anyOf[0]" - """ + """Flavor name for the inference instance.""" image: Optional[str] - """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/image/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.image.anyOf[0]" + """Docker image for the inference instance. + + This field should contain the image name and tag in the format 'name:tag', e.g., + 'nginx:latest'. It defaults to Docker Hub as the image registry, but any + accessible Docker image URL can be specified. """ ingress_opts: Optional[IngressOptsParam] - """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/ingress_opts/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.ingress_opts.anyOf[0]" - """ + """Ingress options for the inference instance""" listening_port: Optional[int] - """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/listening_port/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.listening_port.anyOf[0]" - """ + """Listening port for the inference instance.""" logging: Optional[Logging] - """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/logging/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.logging.anyOf[0]" - """ + """Logging configuration for the inference instance""" probes: Optional[Probes] - """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/probes/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.probes.anyOf[0]" - """ + """Probes configured for all containers of the inference instance.""" api_timeout: Annotated[Optional[int], PropertyInfo(alias="timeout")] """ - '#/components/schemas/InferenceInstanceInUpdateSerializerV3/properties/timeout/anyOf/0' - "$.components.schemas.InferenceInstanceInUpdateSerializerV3.properties.timeout.anyOf[0]" + Specifies the duration in seconds without any requests after which the + containers will be downscaled to their minimum scale value as defined by + `scale.min`. If set, this helps in optimizing resource usage by reducing the + number of container instances during periods of inactivity. The default value + when the parameter is not set is 120. """ class ContainerScaleTriggersCPU(TypedDict, total=False): threshold: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' - "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" - """ + """Threshold value for the trigger in percentage""" class ContainerScaleTriggersGPUMemory(TypedDict, total=False): threshold: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' - "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" - """ + """Threshold value for the trigger in percentage""" class ContainerScaleTriggersGPUUtilization(TypedDict, total=False): threshold: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' - "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" - """ + """Threshold value for the trigger in percentage""" class ContainerScaleTriggersHTTP(TypedDict, total=False): rate: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersRateSerializer/properties/rate' - "$.components.schemas.ContainerScaleTriggersRateSerializer.properties.rate" - """ + """Request count per 'window' seconds for the http trigger""" window: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersRateSerializer/properties/window' - "$.components.schemas.ContainerScaleTriggersRateSerializer.properties.window" - """ + """Time window for rate calculation in seconds""" class ContainerScaleTriggersMemory(TypedDict, total=False): threshold: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersThresholdSerializer/properties/threshold' - "$.components.schemas.ContainerScaleTriggersThresholdSerializer.properties.threshold" - """ + """Threshold value for the trigger in percentage""" class ContainerScaleTriggersSqs(TypedDict, total=False): activation_queue_length: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/activation_queue_length' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.activation_queue_length" - """ + """Number of messages for activation""" aws_region: Required[str] - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/aws_region' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.aws_region" - """ + """AWS region""" queue_length: Required[int] - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/queue_length' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.queue_length" - """ + """Number of messages for one replica""" queue_url: Required[str] - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/queue_url' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.queue_url" - """ + """SQS queue URL""" secret_name: Required[str] - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/secret_name' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.secret_name" - """ + """Auth secret name""" aws_endpoint: Optional[str] - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/aws_endpoint/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.aws_endpoint.anyOf[0]" - """ + """Custom AWS endpoint""" scale_on_delayed: bool - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/scale_on_delayed' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.scale_on_delayed" - """ + """Scale on delayed messages""" scale_on_flight: bool - """ - '#/components/schemas/ContainerScaleTriggersSqsSerializer/properties/scale_on_flight' - "$.components.schemas.ContainerScaleTriggersSqsSerializer.properties.scale_on_flight" - """ + """Scale on in-flight messages""" class ContainerScaleTriggers(TypedDict, total=False): cpu: Optional[ContainerScaleTriggersCPU] - """ - '#/components/schemas/ContainerScaleTriggersSerializer/properties/cpu/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSerializer.properties.cpu.anyOf[0]" - """ + """CPU trigger configuration""" gpu_memory: Optional[ContainerScaleTriggersGPUMemory] - """ - '#/components/schemas/ContainerScaleTriggersSerializer/properties/gpu_memory/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSerializer.properties.gpu_memory.anyOf[0]" + """GPU memory trigger configuration. + + Calculated by DCGM_FI_DEV_MEM_COPY_UTIL metric """ gpu_utilization: Optional[ContainerScaleTriggersGPUUtilization] - """ - '#/components/schemas/ContainerScaleTriggersSerializer/properties/gpu_utilization/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSerializer.properties.gpu_utilization.anyOf[0]" + """GPU utilization trigger configuration. + + Calculated by DCGM_FI_DEV_GPU_UTIL metric """ http: Optional[ContainerScaleTriggersHTTP] - """ - '#/components/schemas/ContainerScaleTriggersSerializer/properties/http/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSerializer.properties.http.anyOf[0]" - """ + """HTTP trigger configuration""" memory: Optional[ContainerScaleTriggersMemory] - """ - '#/components/schemas/ContainerScaleTriggersSerializer/properties/memory/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSerializer.properties.memory.anyOf[0]" - """ + """Memory trigger configuration""" sqs: Optional[ContainerScaleTriggersSqs] - """ - '#/components/schemas/ContainerScaleTriggersSerializer/properties/sqs/anyOf/0' - "$.components.schemas.ContainerScaleTriggersSerializer.properties.sqs.anyOf[0]" - """ + """SQS trigger configuration""" class ContainerScale(TypedDict, total=False): max: Required[int] - """ - '#/components/schemas/ContainerScaleUpdateSerializerV3/properties/max' - "$.components.schemas.ContainerScaleUpdateSerializerV3.properties.max" - """ + """Maximum scale for the container""" min: Required[int] - """ - '#/components/schemas/ContainerScaleUpdateSerializerV3/properties/min' - "$.components.schemas.ContainerScaleUpdateSerializerV3.properties.min" - """ + """Minimum scale for the container""" cooldown_period: int - """ - '#/components/schemas/ContainerScaleUpdateSerializerV3/properties/cooldown_period' - "$.components.schemas.ContainerScaleUpdateSerializerV3.properties.cooldown_period" - """ + """Cooldown period between scaling actions in seconds""" polling_interval: int - """ - '#/components/schemas/ContainerScaleUpdateSerializerV3/properties/polling_interval' - "$.components.schemas.ContainerScaleUpdateSerializerV3.properties.polling_interval" - """ + """Polling interval for scaling triggers in seconds""" triggers: ContainerScaleTriggers - """ - '#/components/schemas/ContainerScaleUpdateSerializerV3/properties/triggers' - "$.components.schemas.ContainerScaleUpdateSerializerV3.properties.triggers" - """ + """Triggers for scaling actions""" class Container(TypedDict, total=False): region_id: Required[Optional[int]] - """ - '#/components/schemas/ContainerInUpdateSerializerV3/properties/region_id/anyOf/0' - "$.components.schemas.ContainerInUpdateSerializerV3.properties.region_id.anyOf[0]" - """ + """Region id for the container""" scale: Required[Optional[ContainerScale]] - """ - '#/components/schemas/ContainerInUpdateSerializerV3/properties/scale/anyOf/0' - "$.components.schemas.ContainerInUpdateSerializerV3.properties.scale.anyOf[0]" - """ + """Scale for the container""" class Logging(TypedDict, total=False): destination_region_id: Optional[int] - """ - '#/components/schemas/LoggingInSerializer/properties/destination_region_id/anyOf/0' - "$.components.schemas.LoggingInSerializer.properties.destination_region_id.anyOf[0]" - """ + """ID of the region in which the logs will be stored""" enabled: bool - """ - '#/components/schemas/LoggingInSerializer/properties/enabled' - "$.components.schemas.LoggingInSerializer.properties.enabled" - """ + """Enable or disable log streaming""" retention_policy: Optional[LaasIndexRetentionPolicyParam] - """ - '#/components/schemas/LoggingInSerializer/properties/retention_policy/anyOf/0' - "$.components.schemas.LoggingInSerializer.properties.retention_policy.anyOf[0]" - """ + """Logs retention policy""" topic_name: Optional[str] - """ - '#/components/schemas/LoggingInSerializer/properties/topic_name/anyOf/0' - "$.components.schemas.LoggingInSerializer.properties.topic_name.anyOf[0]" - """ + """The topic name to stream logs to""" class Probes(TypedDict, total=False): liveness_probe: Optional[ContainerProbeConfigCreateParam] - """ - '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/liveness_probe/anyOf/0' - "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.liveness_probe.anyOf[0]" - """ + """Liveness probe configuration""" readiness_probe: Optional[ContainerProbeConfigCreateParam] - """ - '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/readiness_probe/anyOf/0' - "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.readiness_probe.anyOf[0]" - """ + """Readiness probe configuration""" startup_probe: Optional[ContainerProbeConfigCreateParam] - """ - '#/components/schemas/InferenceInstanceProbesSerializerV2/properties/startup_probe/anyOf/0' - "$.components.schemas.InferenceInstanceProbesSerializerV2.properties.startup_probe.anyOf[0]" - """ + """Startup probe configuration""" diff --git a/src/gcore/types/cloud/inference/deployments/log_list_params.py b/src/gcore/types/cloud/inference/deployments/log_list_params.py index 61dca752..21d57ac2 100644 --- a/src/gcore/types/cloud/inference/deployments/log_list_params.py +++ b/src/gcore/types/cloud/inference/deployments/log_list_params.py @@ -10,31 +10,19 @@ class LogListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[0].schema" - """ + """Project ID""" limit: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/2' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[2]" - """ + """Optional. Limit the number of returned items""" offset: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/3' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[3]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ order_by: Literal["time.asc", "time.desc"] - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/4' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[4]" - """ + """Order by field""" region_id: Optional[int] - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fdeployments%2F%7Bdeployment_name%7D%2Flogs/get/parameters/5/schema/anyOf/0' - "$.paths['/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs'].get.parameters[5].schema.anyOf[0]" - """ + """Region ID""" diff --git a/src/gcore/types/cloud/inference/flavor_list_params.py b/src/gcore/types/cloud/inference/flavor_list_params.py index 53a9caf1..2ec6f0e0 100644 --- a/src/gcore/types/cloud/inference/flavor_list_params.py +++ b/src/gcore/types/cloud/inference/flavor_list_params.py @@ -9,13 +9,10 @@ class FlavorListParams(TypedDict, total=False): limit: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors/get/parameters/0' - "$.paths['/cloud/v3/inference/flavors'].get.parameters[0]" - """ + """Optional. Limit the number of returned items""" offset: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2Fflavors/get/parameters/1' - "$.paths['/cloud/v3/inference/flavors'].get.parameters[1]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ diff --git a/src/gcore/types/cloud/inference/inference.py b/src/gcore/types/cloud/inference/inference.py index b7f2ad5c..ef59071f 100644 --- a/src/gcore/types/cloud/inference/inference.py +++ b/src/gcore/types/cloud/inference/inference.py @@ -14,109 +14,82 @@ class Inference(BaseModel): address: Optional[str] = None - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/address/anyOf/0' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.address.anyOf[0]" - """ + """Address of the inference instance""" auth_enabled: bool - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/auth_enabled' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.auth_enabled" + """`true` if instance uses API key authentication. + + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required + for the requests to the instance if enabled. """ command: Optional[str] = None - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/command/anyOf/0' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.command.anyOf[0]" - """ + """Command to be executed when running a container from an image.""" containers: List[Container] - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/containers' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.containers" - """ + """List of containers for the inference instance""" created_at: Optional[str] = None - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/created_at/anyOf/0' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.created_at.anyOf[0]" - """ + """Inference instance creation date in ISO 8601 format.""" credentials_name: str - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/credentials_name' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.credentials_name" - """ + """Registry credentials name""" description: str - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/description' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.description" - """ + """Inference instance description.""" envs: Optional[Dict[str, str]] = None - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/envs/anyOf/0' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.envs.anyOf[0]" - """ + """Environment variables for the inference instance""" flavor_name: str - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/flavor_name' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.flavor_name" - """ + """Flavor name for the inference instance""" image: str - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/image' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.image" + """Docker image for the inference instance. + + This field should contain the image name and tag in the format 'name:tag', e.g., + 'nginx:latest'. It defaults to Docker Hub as the image registry, but any + accessible Docker image URL can be specified. """ ingress_opts: Optional[IngressOptsOut] = None - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/ingress_opts/anyOf/0' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.ingress_opts.anyOf[0]" - """ + """Ingress options for the inference instance""" listening_port: int - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/listening_port' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.listening_port" - """ + """Listening port for the inference instance.""" logging: Optional[Logging] = None - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/logging/anyOf/0' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.logging.anyOf[0]" - """ + """Logging configuration for the inference instance""" name: str - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/name' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.name" - """ + """Inference instance name.""" probes: Optional[InferenceProbes] = None - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/probes/anyOf/0' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.probes.anyOf[0]" - """ + """Probes configured for all containers of the inference instance.""" project_id: int - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/project_id' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.project_id" - """ + """Project ID. If not provided, your default project ID will be used.""" status: Literal["ACTIVE", "DELETING", "DEPLOYING", "DISABLED", "PARTIALLYDEPLOYED"] - """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/status' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.status" + """Inference instance status. + + Value can be one of the following: + + - `DEPLOYING` - The instance is being deployed. Containers are not yet created. + - `PARTIALLYDEPLOYED` - All containers have been created, but some may not be + ready yet. Instances stuck in this state typically indicate either image being + pulled, or a failure of some kind. In the latter case, the `error_message` + field of the respective container object in the `containers` collection + explains the failure reason. + - `ACTIVE` - The instance is running and ready to accept requests. + - `DISABLED` - The instance is disabled and not accepting any requests. + - `DELETING` - The instance is being deleted. """ timeout: Optional[int] = None """ - '#/components/schemas/InferenceInstanceOutSerializerV3/properties/timeout/anyOf/0' - "$.components.schemas.InferenceInstanceOutSerializerV3.properties.timeout.anyOf[0]" + Specifies the duration in seconds without any requests after which the + containers will be downscaled to their minimum scale value as defined by + `scale.min`. If set, this helps in optimizing resource usage by reducing the + number of container instances during periods of inactivity. """ diff --git a/src/gcore/types/cloud/inference/inference_apikey_secret.py b/src/gcore/types/cloud/inference/inference_apikey_secret.py index 266c8c2e..173de155 100644 --- a/src/gcore/types/cloud/inference/inference_apikey_secret.py +++ b/src/gcore/types/cloud/inference/inference_apikey_secret.py @@ -9,13 +9,7 @@ class InferenceApikeySecret(BaseModel): secret: str - """ - '#/components/schemas/InferenceInstanceApikeySecretSerializerV3/properties/secret' - "$.components.schemas.InferenceInstanceApikeySecretSerializerV3.properties.secret" - """ + """API key secret""" status: Literal["PENDING", "READY"] - """ - '#/components/schemas/InferenceInstanceApikeySecretSerializerV3/properties/status' - "$.components.schemas.InferenceInstanceApikeySecretSerializerV3.properties.status" - """ + """API key status""" diff --git a/src/gcore/types/cloud/inference/inference_flavor.py b/src/gcore/types/cloud/inference/inference_flavor.py index 66e4feb8..26de9f31 100644 --- a/src/gcore/types/cloud/inference/inference_flavor.py +++ b/src/gcore/types/cloud/inference/inference_flavor.py @@ -7,55 +7,28 @@ class InferenceFlavor(BaseModel): cpu: float - """ - '#/components/schemas/InferenceFlavorOutSerializerV3/properties/cpu' - "$.components.schemas.InferenceFlavorOutSerializerV3.properties.cpu" - """ + """Inference flavor cpu count.""" description: str - """ - '#/components/schemas/InferenceFlavorOutSerializerV3/properties/description' - "$.components.schemas.InferenceFlavorOutSerializerV3.properties.description" - """ + """Inference flavor description.""" gpu: int - """ - '#/components/schemas/InferenceFlavorOutSerializerV3/properties/gpu' - "$.components.schemas.InferenceFlavorOutSerializerV3.properties.gpu" - """ + """Inference flavor gpu count.""" gpu_compute_capability: str - """ - '#/components/schemas/InferenceFlavorOutSerializerV3/properties/gpu_compute_capability' - "$.components.schemas.InferenceFlavorOutSerializerV3.properties.gpu_compute_capability" - """ + """Inference flavor gpu compute capability.""" gpu_memory: float - """ - '#/components/schemas/InferenceFlavorOutSerializerV3/properties/gpu_memory' - "$.components.schemas.InferenceFlavorOutSerializerV3.properties.gpu_memory" - """ + """Inference flavor gpu memory in Gi.""" gpu_model: str - """ - '#/components/schemas/InferenceFlavorOutSerializerV3/properties/gpu_model' - "$.components.schemas.InferenceFlavorOutSerializerV3.properties.gpu_model" - """ + """Inference flavor gpu model.""" is_gpu_shared: bool - """ - '#/components/schemas/InferenceFlavorOutSerializerV3/properties/is_gpu_shared' - "$.components.schemas.InferenceFlavorOutSerializerV3.properties.is_gpu_shared" - """ + """Inference flavor is gpu shared.""" memory: float - """ - '#/components/schemas/InferenceFlavorOutSerializerV3/properties/memory' - "$.components.schemas.InferenceFlavorOutSerializerV3.properties.memory" - """ + """Inference flavor memory in Gi.""" name: str - """ - '#/components/schemas/InferenceFlavorOutSerializerV3/properties/name' - "$.components.schemas.InferenceFlavorOutSerializerV3.properties.name" - """ + """Inference flavor name.""" diff --git a/src/gcore/types/cloud/inference/inference_log.py b/src/gcore/types/cloud/inference/inference_log.py index ad352a48..3817bb25 100644 --- a/src/gcore/types/cloud/inference/inference_log.py +++ b/src/gcore/types/cloud/inference/inference_log.py @@ -9,25 +9,13 @@ class InferenceLog(BaseModel): message: str - """ - '#/components/schemas/InferenceInstanceLogSerializerV3/properties/message' - "$.components.schemas.InferenceInstanceLogSerializerV3.properties.message" - """ + """Log message.""" pod: str - """ - '#/components/schemas/InferenceInstanceLogSerializerV3/properties/pod' - "$.components.schemas.InferenceInstanceLogSerializerV3.properties.pod" - """ + """Pod name.""" region_id: int - """ - '#/components/schemas/InferenceInstanceLogSerializerV3/properties/region_id' - "$.components.schemas.InferenceInstanceLogSerializerV3.properties.region_id" - """ + """Region ID where the container is deployed.""" time: datetime - """ - '#/components/schemas/InferenceInstanceLogSerializerV3/properties/time' - "$.components.schemas.InferenceInstanceLogSerializerV3.properties.time" - """ + """Log message timestamp in ISO 8601 format.""" diff --git a/src/gcore/types/cloud/inference/inference_registry_credential.py b/src/gcore/types/cloud/inference/inference_registry_credential.py index dc56a378..fcc8a469 100644 --- a/src/gcore/types/cloud/inference/inference_registry_credential.py +++ b/src/gcore/types/cloud/inference/inference_registry_credential.py @@ -7,25 +7,13 @@ class InferenceRegistryCredential(BaseModel): name: str - """ - '#/components/schemas/InferenceRegistryCredentialOutSerializer/properties/name' - "$.components.schemas.InferenceRegistryCredentialOutSerializer.properties.name" - """ + """Registry credential name.""" project_id: int - """ - '#/components/schemas/InferenceRegistryCredentialOutSerializer/properties/project_id' - "$.components.schemas.InferenceRegistryCredentialOutSerializer.properties.project_id" - """ + """Project ID to which the inference registry credentials belongs.""" registry_url: str - """ - '#/components/schemas/InferenceRegistryCredentialOutSerializer/properties/registry_url' - "$.components.schemas.InferenceRegistryCredentialOutSerializer.properties.registry_url" - """ + """Registry URL.""" username: str - """ - '#/components/schemas/InferenceRegistryCredentialOutSerializer/properties/username' - "$.components.schemas.InferenceRegistryCredentialOutSerializer.properties.username" - """ + """Registry username.""" diff --git a/src/gcore/types/cloud/inference/inference_registry_credential_full.py b/src/gcore/types/cloud/inference/inference_registry_credential_full.py index 774459aa..52a449f2 100644 --- a/src/gcore/types/cloud/inference/inference_registry_credential_full.py +++ b/src/gcore/types/cloud/inference/inference_registry_credential_full.py @@ -7,31 +7,16 @@ class InferenceRegistryCredentialFull(BaseModel): name: str - """ - '#/components/schemas/InferenceRegistryCredentialOutFullSerializer/properties/name' - "$.components.schemas.InferenceRegistryCredentialOutFullSerializer.properties.name" - """ + """Registry credential name.""" password: str - """ - '#/components/schemas/InferenceRegistryCredentialOutFullSerializer/properties/password' - "$.components.schemas.InferenceRegistryCredentialOutFullSerializer.properties.password" - """ + """Registry password.""" project_id: int - """ - '#/components/schemas/InferenceRegistryCredentialOutFullSerializer/properties/project_id' - "$.components.schemas.InferenceRegistryCredentialOutFullSerializer.properties.project_id" - """ + """Project ID to which the inference registry credentials belongs.""" registry_url: str - """ - '#/components/schemas/InferenceRegistryCredentialOutFullSerializer/properties/registry_url' - "$.components.schemas.InferenceRegistryCredentialOutFullSerializer.properties.registry_url" - """ + """Registry URL.""" username: str - """ - '#/components/schemas/InferenceRegistryCredentialOutFullSerializer/properties/username' - "$.components.schemas.InferenceRegistryCredentialOutFullSerializer.properties.username" - """ + """Registry username.""" diff --git a/src/gcore/types/cloud/inference/inference_secret.py b/src/gcore/types/cloud/inference/inference_secret.py index a3b5e6ff..f1b7bb53 100644 --- a/src/gcore/types/cloud/inference/inference_secret.py +++ b/src/gcore/types/cloud/inference/inference_secret.py @@ -8,19 +8,10 @@ class InferenceSecret(BaseModel): data: AwsIamData - """ - '#/components/schemas/InferenceBoxSecretsSerializer/properties/data' - "$.components.schemas.InferenceBoxSecretsSerializer.properties.data" - """ + """Secret data.""" name: str - """ - '#/components/schemas/InferenceBoxSecretsSerializer/properties/name' - "$.components.schemas.InferenceBoxSecretsSerializer.properties.name" - """ + """Secret name.""" type: str - """ - '#/components/schemas/InferenceBoxSecretsSerializer/properties/type' - "$.components.schemas.InferenceBoxSecretsSerializer.properties.type" - """ + """Secret type.""" diff --git a/src/gcore/types/cloud/inference/mlcatalog_model_card.py b/src/gcore/types/cloud/inference/mlcatalog_model_card.py index 54c72d8a..edf5546c 100644 --- a/src/gcore/types/cloud/inference/mlcatalog_model_card.py +++ b/src/gcore/types/cloud/inference/mlcatalog_model_card.py @@ -11,109 +11,55 @@ class MlcatalogModelCard(BaseModel): id: str - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/id' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.id" - """ + """Model ID.""" category: Optional[str] = None - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/category/anyOf/0' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.category.anyOf[0]" - """ + """Category of the model.""" default_flavor_name: Optional[str] = None - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/default_flavor_name/anyOf/0' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.default_flavor_name.anyOf[0]" - """ + """Default flavor for the model.""" description: str - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/description' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.description" - """ + """Description of the model.""" developer: Optional[str] = None - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/developer/anyOf/0' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.developer.anyOf[0]" - """ + """Developer of the model.""" documentation_page: Optional[str] = None - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/documentation_page/anyOf/0' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.documentation_page.anyOf[0]" - """ + """Path to the documentation page.""" eula_url: Optional[str] = None - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/eula_url/anyOf/0' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.eula_url.anyOf[0]" - """ + """URL to the EULA text.""" example_curl_request: Optional[str] = None - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/example_curl_request/anyOf/0' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.example_curl_request.anyOf[0]" - """ + """Example curl request to the model.""" has_eula: bool - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/has_eula' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.has_eula" - """ + """Whether the model has an EULA.""" image_registry_id: Optional[str] = None - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/image_registry_id/anyOf/0' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.image_registry_id.anyOf[0]" - """ + """Image registry of the model.""" image_url: str - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/image_url' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.image_url" - """ + """Image URL of the model.""" inference_backend: Optional[str] = None - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/inference_backend/anyOf/0' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.inference_backend.anyOf[0]" - """ + """Describing underlying inference engine.""" inference_frontend: Optional[str] = None - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/inference_frontend/anyOf/0' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.inference_frontend.anyOf[0]" - """ + """Describing model frontend type.""" api_model_id: Optional[str] = FieldInfo(alias="model_id", default=None) - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/model_id/anyOf/0' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.model_id.anyOf[0]" - """ + """Model name to perform inference call.""" name: str - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/name' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.name" - """ + """Name of the model.""" openai_compatibility: Optional[str] = None - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/openai_compatibility/anyOf/0' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.openai_compatibility.anyOf[0]" - """ + """OpenAI compatibility level.""" port: int - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/port' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.port" - """ + """Port on which the model runs.""" version: Optional[str] = None - """ - '#/components/schemas/MLCatalogModelCardSerializerV3/properties/version/anyOf/0' - "$.components.schemas.MLCatalogModelCardSerializerV3.properties.version.anyOf[0]" - """ + """Version of the model.""" diff --git a/src/gcore/types/cloud/inference/model_list_params.py b/src/gcore/types/cloud/inference/model_list_params.py index ae565c29..befd35b4 100644 --- a/src/gcore/types/cloud/inference/model_list_params.py +++ b/src/gcore/types/cloud/inference/model_list_params.py @@ -11,19 +11,13 @@ class ModelListParams(TypedDict, total=False): limit: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/0' - "$.paths['/cloud/v3/inference/models'].get.parameters[0]" - """ + """Optional. Limit the number of returned items""" offset: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/1' - "$.paths['/cloud/v3/inference/models'].get.parameters[1]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ order_by: MlcatalogOrderByChoices - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2Fmodels/get/parameters/2' - "$.paths['/cloud/v3/inference/models'].get.parameters[2]" - """ + """Order instances by transmitted fields and directions""" diff --git a/src/gcore/types/cloud/inference/registry_credential_create_params.py b/src/gcore/types/cloud/inference/registry_credential_create_params.py index 46ea8c64..c015816e 100644 --- a/src/gcore/types/cloud/inference/registry_credential_create_params.py +++ b/src/gcore/types/cloud/inference/registry_credential_create_params.py @@ -9,31 +9,16 @@ class RegistryCredentialCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].post.parameters[0].schema" - """ + """Project ID""" name: Required[str] - """ - '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/name' - "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.name" - """ + """Registry credential name.""" password: Required[str] - """ - '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/password' - "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.password" - """ + """Registry password.""" registry_url: Required[str] - """ - '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/registry_url' - "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.registry_url" - """ + """Registry URL.""" username: Required[str] - """ - '#/components/schemas/InferenceRegistryCredentialInSerializer/properties/username' - "$.components.schemas.InferenceRegistryCredentialInSerializer.properties.username" - """ + """Registry username.""" diff --git a/src/gcore/types/cloud/inference/registry_credential_list_params.py b/src/gcore/types/cloud/inference/registry_credential_list_params.py index 0707f5ab..a58555ed 100644 --- a/src/gcore/types/cloud/inference/registry_credential_list_params.py +++ b/src/gcore/types/cloud/inference/registry_credential_list_params.py @@ -9,19 +9,13 @@ class RegistryCredentialListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[0].schema" - """ + """Project ID""" limit: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/1' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[1]" - """ + """Optional. Limit the number of returned items""" offset: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials/get/parameters/2' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials'].get.parameters[2]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ diff --git a/src/gcore/types/cloud/inference/registry_credential_replace_params.py b/src/gcore/types/cloud/inference/registry_credential_replace_params.py index 6b829ea4..d4df6de6 100644 --- a/src/gcore/types/cloud/inference/registry_credential_replace_params.py +++ b/src/gcore/types/cloud/inference/registry_credential_replace_params.py @@ -9,25 +9,13 @@ class RegistryCredentialReplaceParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fregistry_credentials%2F%7Bcredential_name%7D/put/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}'].put.parameters[0].schema" - """ + """Project ID""" password: Required[str] - """ - '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/password' - "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.password" - """ + """Registry password.""" registry_url: Required[str] - """ - '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/registry_url' - "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.registry_url" - """ + """Registry URL.""" username: Required[str] - """ - '#/components/schemas/InferenceRegistryCredentialInUpdateSerializer/properties/username' - "$.components.schemas.InferenceRegistryCredentialInUpdateSerializer.properties.username" - """ + """Registry username.""" diff --git a/src/gcore/types/cloud/inference/secret_create_params.py b/src/gcore/types/cloud/inference/secret_create_params.py index 60d586de..1852b8ea 100644 --- a/src/gcore/types/cloud/inference/secret_create_params.py +++ b/src/gcore/types/cloud/inference/secret_create_params.py @@ -11,25 +11,13 @@ class SecretCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/post/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets'].post.parameters[0].schema" - """ + """Project ID""" data: Required[AwsIamDataParam] - """ - '#/components/schemas/InferenceBoxSecretsInSerializer/properties/data' - "$.components.schemas.InferenceBoxSecretsInSerializer.properties.data" - """ + """Secret data.""" name: Required[str] - """ - '#/components/schemas/InferenceBoxSecretsInSerializer/properties/name' - "$.components.schemas.InferenceBoxSecretsInSerializer.properties.name" - """ + """Secret name.""" type: Required[str] - """ - '#/components/schemas/InferenceBoxSecretsInSerializer/properties/type' - "$.components.schemas.InferenceBoxSecretsInSerializer.properties.type" - """ + """Secret type. Currently only `aws-iam` is supported.""" diff --git a/src/gcore/types/cloud/inference/secret_list_params.py b/src/gcore/types/cloud/inference/secret_list_params.py index dc14d4d3..a264c9a1 100644 --- a/src/gcore/types/cloud/inference/secret_list_params.py +++ b/src/gcore/types/cloud/inference/secret_list_params.py @@ -9,19 +9,13 @@ class SecretListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[0].schema" - """ + """Project ID""" limit: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/1' - "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[1]" - """ + """Optional. Limit the number of returned items""" offset: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets/get/parameters/2' - "$.paths['/cloud/v3/inference/{project_id}/secrets'].get.parameters[2]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ diff --git a/src/gcore/types/cloud/inference/secret_replace_params.py b/src/gcore/types/cloud/inference/secret_replace_params.py index 182fbeb8..b0ebbdfc 100644 --- a/src/gcore/types/cloud/inference/secret_replace_params.py +++ b/src/gcore/types/cloud/inference/secret_replace_params.py @@ -11,19 +11,10 @@ class SecretReplaceParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv3%2Finference%2F%7Bproject_id%7D%2Fsecrets%2F%7Bsecret_name%7D/put/parameters/0/schema' - "$.paths['/cloud/v3/inference/{project_id}/secrets/{secret_name}'].put.parameters[0].schema" - """ + """Project ID""" data: Required[AwsIamDataParam] - """ - '#/components/schemas/InferenceSecretInUpdateSerializer/properties/data' - "$.components.schemas.InferenceSecretInUpdateSerializer.properties.data" - """ + """Secret data.""" type: Required[str] - """ - '#/components/schemas/InferenceSecretInUpdateSerializer/properties/type' - "$.components.schemas.InferenceSecretInUpdateSerializer.properties.type" - """ + """Secret type.""" diff --git a/src/gcore/types/cloud/inference_probes.py b/src/gcore/types/cloud/inference_probes.py index 63c6fcef..93b13259 100644 --- a/src/gcore/types/cloud/inference_probes.py +++ b/src/gcore/types/cloud/inference_probes.py @@ -10,19 +10,10 @@ class InferenceProbes(BaseModel): liveness_probe: Optional[ContainerProbeConfig] = None - """ - '#/components/schemas/InferenceInstanceProbesOutSerializerV2/properties/liveness_probe/anyOf/0' - "$.components.schemas.InferenceInstanceProbesOutSerializerV2.properties.liveness_probe.anyOf[0]" - """ + """Liveness probe configuration""" readiness_probe: Optional[ContainerProbeConfig] = None - """ - '#/components/schemas/InferenceInstanceProbesOutSerializerV2/properties/readiness_probe/anyOf/0' - "$.components.schemas.InferenceInstanceProbesOutSerializerV2.properties.readiness_probe.anyOf[0]" - """ + """Readiness probe configuration""" startup_probe: Optional[ContainerProbeConfig] = None - """ - '#/components/schemas/InferenceInstanceProbesOutSerializerV2/properties/startup_probe/anyOf/0' - "$.components.schemas.InferenceInstanceProbesOutSerializerV2.properties.startup_probe.anyOf[0]" - """ + """Startup probe configuration""" diff --git a/src/gcore/types/cloud/ingress_opts_out.py b/src/gcore/types/cloud/ingress_opts_out.py index 67158dc7..a360ccde 100644 --- a/src/gcore/types/cloud/ingress_opts_out.py +++ b/src/gcore/types/cloud/ingress_opts_out.py @@ -7,7 +7,10 @@ class IngressOptsOut(BaseModel): disable_response_buffering: bool - """ - '#/components/schemas/IngressOptsOutSerializer/properties/disable_response_buffering' - "$.components.schemas.IngressOptsOutSerializer.properties.disable_response_buffering" + """Disable response buffering if true. + + A client usually has a much slower connection and can not consume the response + data as fast as it is produced by an upstream application. Ingress tries to + buffer the whole response in order to release the upstream application as soon + as possible.By default, the response buffering is enabled. """ diff --git a/src/gcore/types/cloud/ingress_opts_param.py b/src/gcore/types/cloud/ingress_opts_param.py index 8314784c..2ea98546 100644 --- a/src/gcore/types/cloud/ingress_opts_param.py +++ b/src/gcore/types/cloud/ingress_opts_param.py @@ -9,7 +9,10 @@ class IngressOptsParam(TypedDict, total=False): disable_response_buffering: bool - """ - '#/components/schemas/IngressOptsSerializer/properties/disable_response_buffering' - "$.components.schemas.IngressOptsSerializer.properties.disable_response_buffering" + """Disable response buffering if true. + + A client usually has a much slower connection and can not consume the response + data as fast as it is produced by an upstream application. Ingress tries to + buffer the whole response in order to release the upstream application as soon + as possible.By default, the response buffering is enabled. """ diff --git a/src/gcore/types/cloud/instance.py b/src/gcore/types/cloud/instance.py index 49b5f6ae..6b1c6145 100644 --- a/src/gcore/types/cloud/instance.py +++ b/src/gcore/types/cloud/instance.py @@ -33,250 +33,133 @@ class FixedIPAssignment(BaseModel): external: bool - """ - '#/components/schemas/IpAssignmentsSerializer/properties/external' - "$.components.schemas.IpAssignmentsSerializer.properties.external" - """ + """Is network external""" ip_address: str - """ - '#/components/schemas/IpAssignmentsSerializer/properties/ip_address' - "$.components.schemas.IpAssignmentsSerializer.properties.ip_address" - """ + """Ip address""" subnet_id: str - """ - '#/components/schemas/IpAssignmentsSerializer/properties/subnet_id' - "$.components.schemas.IpAssignmentsSerializer.properties.subnet_id" - """ + """Interface subnet id""" class FlavorInstanceFlavorSerializerHardwareDescription(BaseModel): ram: str - """ - '#/components/schemas/InstanceFlavorHardwareDescriptionSerializer/properties/ram' - "$.components.schemas.InstanceFlavorHardwareDescriptionSerializer.properties.ram" - """ + """RAM description""" vcpus: str - """ - '#/components/schemas/InstanceFlavorHardwareDescriptionSerializer/properties/vcpus' - "$.components.schemas.InstanceFlavorHardwareDescriptionSerializer.properties.vcpus" - """ + """CPU description""" class FlavorInstanceFlavorSerializer(BaseModel): architecture: str - """ - '#/components/schemas/InstanceFlavorSerializer/properties/architecture' - "$.components.schemas.InstanceFlavorSerializer.properties.architecture" - """ + """CPU architecture""" flavor_id: str - """ - '#/components/schemas/InstanceFlavorSerializer/properties/flavor_id' - "$.components.schemas.InstanceFlavorSerializer.properties.flavor_id" - """ + """Flavor ID is the same as name""" flavor_name: str - """ - '#/components/schemas/InstanceFlavorSerializer/properties/flavor_name' - "$.components.schemas.InstanceFlavorSerializer.properties.flavor_name" - """ + """Flavor name""" hardware_description: FlavorInstanceFlavorSerializerHardwareDescription - """ - '#/components/schemas/InstanceFlavorSerializer/properties/hardware_description' - "$.components.schemas.InstanceFlavorSerializer.properties.hardware_description" - """ + """Additional hardware description""" os_type: str - """ - '#/components/schemas/InstanceFlavorSerializer/properties/os_type' - "$.components.schemas.InstanceFlavorSerializer.properties.os_type" - """ + """Flavor operating system""" ram: int - """ - '#/components/schemas/InstanceFlavorSerializer/properties/ram' - "$.components.schemas.InstanceFlavorSerializer.properties.ram" - """ + """RAM size in MiB""" vcpus: int - """ - '#/components/schemas/InstanceFlavorSerializer/properties/vcpus' - "$.components.schemas.InstanceFlavorSerializer.properties.vcpus" - """ + """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" class FlavorBareMetalFlavorSerializerHardwareDescription(BaseModel): cpu: str - """ - '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/cpu' - "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.cpu" - """ + """Human-readable CPU description""" disk: str - """ - '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/disk' - "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.disk" - """ + """Human-readable disk description""" license: str - """ - '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/license' - "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.license" - """ + """If the flavor is licensed, this field contains the license type""" network: str - """ - '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/network' - "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.network" - """ + """Human-readable NIC description""" ram: str - """ - '#/components/schemas/BareMetalFlavorHardwareDescriptionSerializer/properties/ram' - "$.components.schemas.BareMetalFlavorHardwareDescriptionSerializer.properties.ram" - """ + """Human-readable RAM description""" class FlavorBareMetalFlavorSerializer(BaseModel): architecture: str - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/architecture' - "$.components.schemas.BareMetalFlavorSerializer.properties.architecture" - """ + """CPU architecture""" flavor_id: str - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/flavor_id' - "$.components.schemas.BareMetalFlavorSerializer.properties.flavor_id" - """ + """Flavor ID is the same as name""" flavor_name: str - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/flavor_name' - "$.components.schemas.BareMetalFlavorSerializer.properties.flavor_name" - """ + """Flavor name""" hardware_description: FlavorBareMetalFlavorSerializerHardwareDescription - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/hardware_description' - "$.components.schemas.BareMetalFlavorSerializer.properties.hardware_description" - """ + """Additional hardware description""" os_type: str - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/os_type' - "$.components.schemas.BareMetalFlavorSerializer.properties.os_type" - """ + """Operating system""" ram: int - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/ram' - "$.components.schemas.BareMetalFlavorSerializer.properties.ram" - """ + """RAM size in MiB""" resource_class: str - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/resource_class' - "$.components.schemas.BareMetalFlavorSerializer.properties.resource_class" - """ + """Flavor resource class for mapping to hardware capacity""" vcpus: int - """ - '#/components/schemas/BareMetalFlavorSerializer/properties/vcpus' - "$.components.schemas.BareMetalFlavorSerializer.properties.vcpus" - """ + """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" class FlavorDeprecatedGPUClusterFlavorSerializerHardwareDescription(BaseModel): cpu: str - """ - '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/cpu' - "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.cpu" - """ + """Human-readable CPU description""" disk: str - """ - '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/disk' - "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.disk" - """ + """Human-readable disk description""" gpu: str - """ - '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/gpu' - "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.gpu" - """ + """Human-readable GPU description""" license: str - """ - '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/license' - "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.license" - """ + """If the flavor is licensed, this field contains the license type""" network: str - """ - '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/network' - "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.network" - """ + """Human-readable NIC description""" ram: str - """ - '#/components/schemas/DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer/properties/ram' - "$.components.schemas.DeprecatedAIClusterServerFlavorHardwareDescriptionSerializer.properties.ram" - """ + """Human-readable RAM description""" class FlavorDeprecatedGPUClusterFlavorSerializer(BaseModel): architecture: str - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/architecture' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.architecture" - """ + """CPU architecture""" flavor_id: str - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/flavor_id' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.flavor_id" - """ + """Flavor ID is the same as name""" flavor_name: str - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/flavor_name' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.flavor_name" - """ + """Flavor name""" hardware_description: FlavorDeprecatedGPUClusterFlavorSerializerHardwareDescription - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/hardware_description' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.hardware_description" - """ + """Additional hardware description""" os_type: str - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/os_type' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.os_type" - """ + """Operating system""" ram: int - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/ram' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.ram" - """ + """RAM size in MiB""" resource_class: str - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/resource_class' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.resource_class" - """ + """Flavor resource class for mapping to hardware capacity""" vcpus: int - """ - '#/components/schemas/DeprecatedGpuClusterFlavorSerializer/properties/vcpus' - "$.components.schemas.DeprecatedGpuClusterFlavorSerializer.properties.vcpus" - """ + """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" Flavor: TypeAlias = Union[ @@ -286,122 +169,68 @@ class FlavorDeprecatedGPUClusterFlavorSerializer(BaseModel): class SecurityGroup(BaseModel): name: str - """ - '#/components/schemas/NameSerializerPydantic/properties/name' - "$.components.schemas.NameSerializerPydantic.properties.name" - """ + """Name.""" class Volume(BaseModel): id: str - """ - '#/components/schemas/InstanceVolumeSerializer/properties/id' - "$.components.schemas.InstanceVolumeSerializer.properties.id" - """ + """Volume ID""" delete_on_termination: bool - """ - '#/components/schemas/InstanceVolumeSerializer/properties/delete_on_termination' - "$.components.schemas.InstanceVolumeSerializer.properties.delete_on_termination" - """ + """Whether the volume is deleted together with the VM""" class Instance(BaseModel): addresses: Dict[str, List[Address]] - """ - '#/components/schemas/InstanceSerializer/properties/addresses' - "$.components.schemas.InstanceSerializer.properties.addresses" - """ + """Map of network_name to list of addresses in that network""" blackhole_ports: List[BlackholePort] - """ - '#/components/schemas/InstanceSerializer/properties/blackhole_ports' - "$.components.schemas.InstanceSerializer.properties.blackhole_ports" - """ + """IP addresses of the instances that are blackholed by DDoS mitigation system""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/InstanceSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.InstanceSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" ddos_profile: Optional[DDOSProfile] = None - """ - '#/components/schemas/InstanceSerializer/properties/ddos_profile/anyOf/0' - "$.components.schemas.InstanceSerializer.properties.ddos_profile.anyOf[0]" + """Advanced DDoS protection profile. + + It is always `null` if query parameter `with_ddos=true` is not set. """ fixed_ip_assignments: Optional[List[FixedIPAssignment]] = None - """ - '#/components/schemas/InstanceSerializer/properties/fixed_ip_assignments/anyOf/0' - "$.components.schemas.InstanceSerializer.properties.fixed_ip_assignments.anyOf[0]" - """ + """Fixed IP assigned to instance""" flavor: Flavor - """ - '#/components/schemas/InstanceSerializer/properties/flavor' - "$.components.schemas.InstanceSerializer.properties.flavor" - """ + """Flavor""" instance_created: datetime - """ - '#/components/schemas/InstanceSerializer/properties/instance_created' - "$.components.schemas.InstanceSerializer.properties.instance_created" - """ + """Datetime when instance was created""" instance_description: Optional[str] = None - """ - '#/components/schemas/InstanceSerializer/properties/instance_description/anyOf/0' - "$.components.schemas.InstanceSerializer.properties.instance_description.anyOf[0]" - """ + """Instance description""" instance_id: str - """ - '#/components/schemas/InstanceSerializer/properties/instance_id' - "$.components.schemas.InstanceSerializer.properties.instance_id" - """ + """Instance ID""" instance_isolation: Optional[InstanceIsolation] = None - """ - '#/components/schemas/InstanceSerializer/properties/instance_isolation/anyOf/0' - "$.components.schemas.InstanceSerializer.properties.instance_isolation.anyOf[0]" - """ + """Instance isolation information""" instance_name: str - """ - '#/components/schemas/InstanceSerializer/properties/instance_name' - "$.components.schemas.InstanceSerializer.properties.instance_name" - """ + """Instance name""" project_id: int - """ - '#/components/schemas/InstanceSerializer/properties/project_id' - "$.components.schemas.InstanceSerializer.properties.project_id" - """ + """Project ID""" region: str - """ - '#/components/schemas/InstanceSerializer/properties/region' - "$.components.schemas.InstanceSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/InstanceSerializer/properties/region_id' - "$.components.schemas.InstanceSerializer.properties.region_id" - """ + """Region ID""" security_groups: List[SecurityGroup] - """ - '#/components/schemas/InstanceSerializer/properties/security_groups' - "$.components.schemas.InstanceSerializer.properties.security_groups" - """ + """Security groups""" ssh_key_name: Optional[str] = None - """ - '#/components/schemas/InstanceSerializer/properties/ssh_key_name/anyOf/0' - "$.components.schemas.InstanceSerializer.properties.ssh_key_name.anyOf[0]" - """ + """SSH key assigned to instance""" status: Literal[ "ACTIVE", @@ -425,28 +254,27 @@ class Instance(BaseModel): "UNKNOWN", "VERIFY_RESIZE", ] - """ - '#/components/schemas/InstanceSerializer/properties/status' - "$.components.schemas.InstanceSerializer.properties.status" - """ + """Instance status""" tags: List[Tag] - """ - '#/components/schemas/InstanceSerializer/properties/tags' - "$.components.schemas.InstanceSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ task_id: Optional[str] = None - """ - '#/components/schemas/InstanceSerializer/properties/task_id/anyOf/0' - "$.components.schemas.InstanceSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ task_state: Optional[str] = None - """ - '#/components/schemas/InstanceSerializer/properties/task_state/anyOf/0' - "$.components.schemas.InstanceSerializer.properties.task_state.anyOf[0]" - """ + """Task state""" vm_state: Literal[ "active", @@ -462,13 +290,7 @@ class Instance(BaseModel): "stopped", "suspended", ] - """ - '#/components/schemas/InstanceSerializer/properties/vm_state' - "$.components.schemas.InstanceSerializer.properties.vm_state" - """ + """Virtual machine state (active)""" volumes: List[Volume] - """ - '#/components/schemas/InstanceSerializer/properties/volumes' - "$.components.schemas.InstanceSerializer.properties.volumes" - """ + """List of volumes""" diff --git a/src/gcore/types/cloud/instance_action_params.py b/src/gcore/types/cloud/instance_action_params.py index d32ad038..c7f3ca8f 100644 --- a/src/gcore/types/cloud/instance_action_params.py +++ b/src/gcore/types/cloud/instance_action_params.py @@ -10,48 +10,23 @@ class StartActionInstanceSerializer(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/0/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/1/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[1].schema" - """ action: Required[Literal["start"]] - """ - '#/components/schemas/StartActionInstanceSerializer/properties/action' - "$.components.schemas.StartActionInstanceSerializer.properties.action" - """ + """Instance action name""" activate_profile: Optional[bool] - """ - '#/components/schemas/StartActionInstanceSerializer/properties/activate_profile/anyOf/0' - "$.components.schemas.StartActionInstanceSerializer.properties.activate_profile.anyOf[0]" - """ + """Used on start instance to activate Advanced DDoS profile""" class BasicActionInstanceSerializer(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/0/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faction/post/parameters/1/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action'].post.parameters[1].schema" - """ action: Required[Literal["reboot", "reboot_hard", "resume", "stop", "suspend"]] - """ - '#/components/schemas/BasicActionInstanceSerializer/properties/action' - "$.components.schemas.BasicActionInstanceSerializer.properties.action" - """ + """Instance action name""" InstanceActionParams: TypeAlias = Union[StartActionInstanceSerializer, BasicActionInstanceSerializer] diff --git a/src/gcore/types/cloud/instance_add_to_placement_group_params.py b/src/gcore/types/cloud/instance_add_to_placement_group_params.py index 51e6405c..866f105b 100644 --- a/src/gcore/types/cloud/instance_add_to_placement_group_params.py +++ b/src/gcore/types/cloud/instance_add_to_placement_group_params.py @@ -9,19 +9,8 @@ class InstanceAddToPlacementGroupParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fput_into_servergroup/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup'].post.parameters[1].schema" - """ servergroup_id: Required[str] - """ - '#/components/schemas/InstancePutServerGroupSchema/properties/servergroup_id' - "$.components.schemas.InstancePutServerGroupSchema.properties.servergroup_id" - """ + """Anti-affinity or affinity or soft-anti-affinity server group ID.""" 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 1a58c296..4947252e 100644 --- a/src/gcore/types/cloud/instance_assign_security_group_params.py +++ b/src/gcore/types/cloud/instance_assign_security_group_params.py @@ -10,39 +10,19 @@ class InstanceAssignSecurityGroupParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Faddsecuritygroup/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup'].post.parameters[1].schema" - """ name: str - """ - '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/name' - "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.name" - """ + """Security group name, applies to all ports""" ports_security_group_names: Iterable[PortsSecurityGroupName] - """ - '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/ports_security_group_names' - "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.ports_security_group_names" - """ + """Port security groups mapping""" class PortsSecurityGroupName(TypedDict, total=False): port_id: Required[Optional[str]] - """ - '#/components/schemas/PortSecurityGroupNamesSchema/properties/port_id' - "$.components.schemas.PortSecurityGroupNamesSchema.properties.port_id" - """ + """Port ID. If None, security groups will be applied to all ports""" security_group_names: Required[List[str]] - """ - '#/components/schemas/PortSecurityGroupNamesSchema/properties/security_group_names' - "$.components.schemas.PortSecurityGroupNamesSchema.properties.security_group_names" - """ + """List of security group names""" diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index b4ef3ee2..90ee8ab7 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -35,139 +35,129 @@ class InstanceCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v2/instances/{project_id}/{region_id}'].post.parameters[1].schema" - """ + """Region ID""" flavor: Required[str] - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/flavor' - "$.components.schemas.CreateInstanceSerializerV2.properties.flavor" - """ + """The flavor of the instance.""" interfaces: Required[Iterable[Interface]] - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/interfaces' - "$.components.schemas.CreateInstanceSerializerV2.properties.interfaces" + """A list of network interfaces for the instance. + + You can create one or more interfaces—private, public, or both. """ volumes: Required[Iterable[Volume]] - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/volumes' - "$.components.schemas.CreateInstanceSerializerV2.properties.volumes" - """ + """List of volumes for instances""" allow_app_ports: bool - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/allow_app_ports' - "$.components.schemas.CreateInstanceSerializerV2.properties.allow_app_ports" + """Set to `true` if creating the instance from an `apptemplate`. + + This allows application ports in the security group for instances created from a + marketplace application template. """ configuration: Optional[object] """ - '#/components/schemas/CreateInstanceSerializerV2/properties/configuration/anyOf/0' - "$.components.schemas.CreateInstanceSerializerV2.properties.configuration.anyOf[0]" + Parameters for the application template if creating the instance from an + `apptemplate`. """ name_templates: List[str] """ - '#/components/schemas/CreateInstanceSerializerV2/properties/name_templates' - "$.components.schemas.CreateInstanceSerializerV2.properties.name_templates" + If you want instance names to be automatically generated using IP octets, you + can specify name templates instead of setting names manually.Provide a list of + templated names that should be replaced using the selected template. The + following template formats are supported: `{ip_octets}`, `{two_ip_octets}`, and + `{one_ip_octet}`. """ names: List[str] - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/names' - "$.components.schemas.CreateInstanceSerializerV2.properties.names" - """ + """List of instance names. Specify one name to create a single instance.""" password: str - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/password' - "$.components.schemas.CreateInstanceSerializerV2.properties.password" + """For Linux instances, 'username' and 'password' are used to create a new user. + + When only 'password' is provided, it is set as the password for the default user + of the image. For Windows instances, 'username' cannot be specified. Use the + 'password' field to set the password for the 'Admin' user on Windows. Use the + 'user_data' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via 'user_data'. """ security_groups: Iterable[SecurityGroup] - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/security_groups' - "$.components.schemas.CreateInstanceSerializerV2.properties.security_groups" + """Applies only to instances and is ignored for bare metal. + + Specifies security group UUIDs to be applied to all instance network interfaces. """ servergroup_id: str - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/servergroup_id' - "$.components.schemas.CreateInstanceSerializerV2.properties.servergroup_id" + """Server group ID for instance placement policy. + + Can be an anti-affinity, affinity, or soft-anti-affinity group. `anti-affinity` + ensures instances are placed on different hosts for high availability. + `affinity` places instances on the same host for low-latency communication. + `soft-anti-affinity` tries to place instances on different hosts but allows + sharing if needed. """ ssh_key_name: Optional[str] - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/ssh_key_name/anyOf/0' - "$.components.schemas.CreateInstanceSerializerV2.properties.ssh_key_name.anyOf[0]" - """ + """Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint.""" tags: TagUpdateListParam - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/tags' - "$.components.schemas.CreateInstanceSerializerV2.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. """ user_data: str - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/user_data' - "$.components.schemas.CreateInstanceSerializerV2.properties.user_data" + """String in base64 format. + + For Linux instances, 'user_data' is ignored when 'password' field is provided. + For Windows instances, Admin user password is set by 'password' field and cannot + be updated via 'user_data'. Examples of the user_data: + https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ username: str - """ - '#/components/schemas/CreateInstanceSerializerV2/properties/username' - "$.components.schemas.CreateInstanceSerializerV2.properties.username" + """For Linux instances, 'username' and 'password' are used to create a new user. + + For Windows instances, 'username' cannot be specified. Use 'password' field to + set the password for the 'Admin' user on Windows. """ class InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' - "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" - """ + """Resource ID""" class InterfaceNewInterfaceExternalSerializerPydantic(TypedDict, total=False): type: Required[Literal["external"]] - """ - '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/type' - "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.type" - """ + """A public IP address will be assigned to the instance.""" interface_name: str - """ - '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/interface_name' - "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.interface_name" + """Interface name. + + Defaults to `null` and is returned as `null` in the API response if not set. """ ip_family: Optional[InterfaceIPFamily] - """ - '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/ip_family/anyOf/0' - "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.ip_family.anyOf[0]" - """ + """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" port_group: int - """ - '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/port_group' - "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.port_group" - """ + """Applicable only to bare metal. Each group is added to a separate trunk.""" security_groups: Iterable[InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup] - """ - '#/components/schemas/NewInterfaceExternalSerializerPydantic/properties/security_groups' - "$.components.schemas.NewInterfaceExternalSerializerPydantic.properties.security_groups" + """Applies only to instances and is ignored for bare metal. + + Specifies security group UUIDs to be applied to the instance network interface. """ @@ -175,9 +165,11 @@ class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPNewInsta TypedDict, total=False ): source: Required[Literal["new"]] - """ - '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """A new floating IP will be created and attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -186,14 +178,16 @@ class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExisting ): existing_floating_id: Required[str] """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + An existing available floating IP id must be specified if the source is set to + `existing` """ source: Required[Literal["existing"]] - """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """An existing available floating IP will be attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -205,53 +199,39 @@ class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExisting class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' - "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" - """ + """Resource ID""" class InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic(TypedDict, total=False): network_id: Required[str] - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/network_id' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.network_id" - """ + """The network where the instance will be connected.""" subnet_id: Required[str] - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/subnet_id' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.subnet_id" - """ + """The instance will get an IP address from this subnet.""" type: Required[Literal["subnet"]] - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/type' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.type" + """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. """ floating_ip: InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIP - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/floating_ip' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.floating_ip" - """ + """Allows the instance to have a public IP that can be reached from the internet.""" interface_name: str - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/interface_name' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.interface_name" + """Interface name. + + Defaults to `null` and is returned as `null` in the API response if not set. """ port_group: int - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/port_group' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.port_group" - """ + """Applicable only to bare metal. Each group is added to a separate trunk.""" security_groups: Iterable[InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup] - """ - '#/components/schemas/NewInterfaceSpecificSubnetFipSerializerPydantic/properties/security_groups' - "$.components.schemas.NewInterfaceSpecificSubnetFipSerializerPydantic.properties.security_groups" + """Applies only to instances and is ignored for bare metal. + + Specifies security group UUIDs to be applied to the instance network interface. """ @@ -259,9 +239,11 @@ class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPNewInstanceFl TypedDict, total=False ): source: Required[Literal["new"]] - """ - '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """A new floating IP will be created and attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -270,14 +252,16 @@ class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInsta ): existing_floating_id: Required[str] """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + An existing available floating IP id must be specified if the source is set to + `existing` """ source: Required[Literal["existing"]] - """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """An existing available floating IP will be attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -289,59 +273,38 @@ class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInsta class InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' - "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" - """ + """Resource ID""" class InterfaceNewInterfaceAnySubnetFipSerializerPydantic(TypedDict, total=False): network_id: Required[str] - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/network_id' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.network_id" - """ + """The network where the instance will be connected.""" type: Required[Literal["any_subnet"]] - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/type' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.type" - """ + """Instance will be attached to a subnet with the largest count of free IPs.""" floating_ip: InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIP - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/floating_ip' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.floating_ip" - """ + """Allows the instance to have a public IP that can be reached from the internet.""" interface_name: str - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/interface_name' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.interface_name" + """Interface name. + + Defaults to `null` and is returned as `null` in the API response if not set. """ ip_address: str - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/ip_address' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.ip_address" - """ + """You can specify a specific IP address from your subnet.""" ip_family: Optional[InterfaceIPFamily] - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/ip_family/anyOf/0' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.ip_family.anyOf[0]" - """ + """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" port_group: int - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/port_group' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.port_group" - """ + """Applicable only to bare metal. Each group is added to a separate trunk.""" security_groups: Iterable[InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup] - """ - '#/components/schemas/NewInterfaceAnySubnetFipSerializerPydantic/properties/security_groups' - "$.components.schemas.NewInterfaceAnySubnetFipSerializerPydantic.properties.security_groups" + """Applies only to instances and is ignored for bare metal. + + Specifies security group UUIDs to be applied to the instance network interface. """ @@ -349,9 +312,11 @@ class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPNewInst TypedDict, total=False ): source: Required[Literal["new"]] - """ - '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """A new floating IP will be created and attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -360,14 +325,16 @@ class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistin ): existing_floating_id: Required[str] """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + An existing available floating IP id must be specified if the source is set to + `existing` """ source: Required[Literal["existing"]] - """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """An existing available floating IP will be attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -379,47 +346,36 @@ class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistin class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' - "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" - """ + """Resource ID""" class InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic(TypedDict, total=False): port_id: Required[str] - """ - '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/port_id' - "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.port_id" - """ + """Network ID the subnet belongs to. Port will be plugged in this network.""" type: Required[Literal["reserved_fixed_ip"]] - """ - '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/type' - "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.type" + """An existing available reserved fixed IP will be attached to the instance. + + If the reserved IP is not public and you choose to add a floating IP, the + instance will be accessible from the internet. """ floating_ip: InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIP - """ - '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/floating_ip' - "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.floating_ip" - """ + """Allows the instance to have a public IP that can be reached from the internet.""" interface_name: str - """ - '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/interface_name' - "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.interface_name" + """Interface name. + + Defaults to `null` and is returned as `null` in the API response if not set. """ port_group: int - """ - '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/port_group' - "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.port_group" - """ + """Applicable only to bare metal. Each group is added to a separate trunk.""" security_groups: Iterable[InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup] - """ - '#/components/schemas/NewInterfaceReservedFixedIpFipSerializerPydantic/properties/security_groups' - "$.components.schemas.NewInterfaceReservedFixedIpFipSerializerPydantic.properties.security_groups" + """Applies only to instances and is ignored for bare metal. + + Specifies security group UUIDs to be applied to the instance network interface. """ @@ -433,81 +389,75 @@ class InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic(TypedDict, total class Volume(TypedDict, total=False): source: Required[Literal["apptemplate", "existing-volume", "image", "new-volume", "snapshot"]] - """ - '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/source' - "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.source" + """Volume source. + + For `image`, specify `image_id` and `size`. For `new-volume`, specify `size`. + For `existing-volume`, specify `volume_id`. For `snapshot`, specify + `snapshot_id`. For `apptemplate`, specify `apptemplate_id`. """ apptemplate_id: str - """ - '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/apptemplate_id' - "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.apptemplate_id" - """ + """App template ID. Required if `source` is `apptemplate`""" attachment_tag: str - """ - '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/attachment_tag' - "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.attachment_tag" - """ + """Block device attachment tag (not exposed in the normal tags)""" boot_index: int - """ - '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/boot_index' - "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.boot_index" + """0 means that this is the primary boot device. + + A unique positive value is set for the other bootable devices. A negative number + means that the boot is prohibited. """ delete_on_termination: bool - """ - '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/delete_on_termination' - "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.delete_on_termination" - """ + """Whether the volume should be deleted along with the VM""" image_id: str - """ - '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/image_id' - "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.image_id" - """ + """Image ID. Required if `source` is `image`""" name: str - """ - '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/name' - "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.name" + """The name of the volume. + + If not specified, a name will be generated automatically. """ size: int - """ - '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/size' - "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.size" + """Required when the `source` is either `new-volume` or `image`. + + If specified for the `snapshot` or `existing-volume` `source`, the value must + match the size of the snapshot or the existing volume, respectively. """ snapshot_id: str - """ - '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/snapshot_id' - "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.snapshot_id" - """ + """Volume snapshot ID. Required if `source` is `snapshot`""" tags: TagUpdateListParam - """ - '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/tags' - "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - """ - '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/type_name' - "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.type_name" + """Volume type name. + + Supported values: `standard` – Network SSD block storage offering stable + performance with high random I/O and data reliability (6 IOPS per 1 GiB, 0.4 + MB/s per 1 GiB). Max IOPS: 4500. Max bandwidth: 300 MB/s. `ssd_hiiops` – + High-performance SSD storage for latency-sensitive transactional workloads (60 + IOPS per 1 GiB, 2.5 MB/s per 1 GiB). Max IOPS: 9000. Max bandwidth: 500 MB/s. + `ssd_lowlatency` – SSD storage optimized for low-latency and real-time + processing. Max IOPS: 5000. Average latency: 300 µs. Snapshots and volume + resizing are not supported for `ssd_lowlatency`. """ volume_id: str - """ - '#/components/schemas/CreateInstanceVolumeSerializerPydantic/properties/volume_id' - "$.components.schemas.CreateInstanceVolumeSerializerPydantic.properties.volume_id" - """ + """Volume ID. Required if `source` is `existing-volume`""" class SecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSerializerPydantic/properties/id' - "$.components.schemas.MandatoryIdSerializerPydantic.properties.id" - """ + """Resource ID""" diff --git a/src/gcore/types/cloud/instance_delete_params.py b/src/gcore/types/cloud/instance_delete_params.py index c02e1669..56bf4a29 100644 --- a/src/gcore/types/cloud/instance_delete_params.py +++ b/src/gcore/types/cloud/instance_delete_params.py @@ -9,37 +9,25 @@ class InstanceDeleteParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[1].schema" - """ + """Region ID""" delete_floatings: bool - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/3' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[3]" + """True if it is required to delete floating IPs assigned to the instance. + + Can't be used with `floatings`. """ floatings: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/4' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[4]" + """Comma separated list of floating ids that should be deleted. + + Can't be used with `delete_floatings`. """ reserved_fixed_ips: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/5' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[5]" - """ + """Comma separated list of port IDs to be deleted with the instance""" volumes: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/delete/parameters/6' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}']['delete'].parameters[6]" - """ + """Comma separated list of volume IDs to be deleted with the instance""" diff --git a/src/gcore/types/cloud/instance_get_console_params.py b/src/gcore/types/cloud/instance_get_console_params.py index 57304cc9..eb2df351 100644 --- a/src/gcore/types/cloud/instance_get_console_params.py +++ b/src/gcore/types/cloud/instance_get_console_params.py @@ -9,19 +9,8 @@ class InstanceGetConsoleParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[1].schema" - """ console_type: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fget_console/get/parameters/3' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console'].get.parameters[3]" - """ + """Console type""" diff --git a/src/gcore/types/cloud/instance_interface.py b/src/gcore/types/cloud/instance_interface.py index 55e38f55..1f4e0fb6 100644 --- a/src/gcore/types/cloud/instance_interface.py +++ b/src/gcore/types/cloud/instance_interface.py @@ -13,55 +13,28 @@ class InstanceInterface(BaseModel): allowed_address_pairs: List[AllowedAddressPairs] - """ - '#/components/schemas/InstanceInterfaceSerializer/properties/allowed_address_pairs' - "$.components.schemas.InstanceInterfaceSerializer.properties.allowed_address_pairs" - """ + """Group of subnet masks and/or IP addresses that share the current IP as VIP""" floatingip_details: List[FloatingIP] - """ - '#/components/schemas/InstanceInterfaceSerializer/properties/floatingip_details' - "$.components.schemas.InstanceInterfaceSerializer.properties.floatingip_details" - """ + """Bodies of floating IPs that are NAT-ing IPs of this port""" ip_assignments: List[IPAssignment] - """ - '#/components/schemas/InstanceInterfaceSerializer/properties/ip_assignments' - "$.components.schemas.InstanceInterfaceSerializer.properties.ip_assignments" - """ + """IP addresses assigned to this port""" network_details: NetworkDetails - """ - '#/components/schemas/InstanceInterfaceSerializer/properties/network_details' - "$.components.schemas.InstanceInterfaceSerializer.properties.network_details" - """ + """Body of the network this port is attached to""" network_id: str - """ - '#/components/schemas/InstanceInterfaceSerializer/properties/network_id' - "$.components.schemas.InstanceInterfaceSerializer.properties.network_id" - """ + """ID of the network the port is attached to""" port_id: str - """ - '#/components/schemas/InstanceInterfaceSerializer/properties/port_id' - "$.components.schemas.InstanceInterfaceSerializer.properties.port_id" - """ + """ID of virtual ethernet port object""" port_security_enabled: bool - """ - '#/components/schemas/InstanceInterfaceSerializer/properties/port_security_enabled' - "$.components.schemas.InstanceInterfaceSerializer.properties.port_security_enabled" - """ + """Port security status""" interface_name: Optional[str] = None - """ - '#/components/schemas/InstanceInterfaceSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.InstanceInterfaceSerializer.properties.interface_name.anyOf[0]" - """ + """Interface name""" mac_address: Optional[str] = None - """ - '#/components/schemas/InstanceInterfaceSerializer/properties/mac_address/anyOf/0' - "$.components.schemas.InstanceInterfaceSerializer.properties.mac_address.anyOf[0]" - """ + """MAC address of the virtual port""" diff --git a/src/gcore/types/cloud/instance_isolation.py b/src/gcore/types/cloud/instance_isolation.py index 0ba971a5..988d4a34 100644 --- a/src/gcore/types/cloud/instance_isolation.py +++ b/src/gcore/types/cloud/instance_isolation.py @@ -9,7 +9,4 @@ class InstanceIsolation(BaseModel): reason: Optional[str] = None - """ - '#/components/schemas/IsolationSerializer/properties/reason/anyOf/0' - "$.components.schemas.IsolationSerializer.properties.reason.anyOf[0]" - """ + """The reason of instance isolation if it is isolated from external internet.""" diff --git a/src/gcore/types/cloud/instance_list.py b/src/gcore/types/cloud/instance_list.py index 7a8e4c4a..158812ec 100644 --- a/src/gcore/types/cloud/instance_list.py +++ b/src/gcore/types/cloud/instance_list.py @@ -10,13 +10,7 @@ class InstanceList(BaseModel): count: int - """ - '#/components/schemas/InstanceCollectionSerializer/properties/count' - "$.components.schemas.InstanceCollectionSerializer.properties.count" - """ + """Number of objects""" results: List[Instance] - """ - '#/components/schemas/InstanceCollectionSerializer/properties/results' - "$.components.schemas.InstanceCollectionSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/instance_list_params.py b/src/gcore/types/cloud/instance_list_params.py index f6d4a67d..60ff63ec 100644 --- a/src/gcore/types/cloud/instance_list_params.py +++ b/src/gcore/types/cloud/instance_list_params.py @@ -13,129 +13,88 @@ class InstanceListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[1].schema" - """ + """Region ID""" available_floating: bool - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[2]" - """ + """Only show instances which are able to handle floating address""" changes_before: Annotated[Union[str, datetime], PropertyInfo(alias="changes-before", format="iso8601")] - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[3]" - """ + """Filters the instances by a date and time stamp when the instances last changed.""" changes_since: Annotated[Union[str, datetime], PropertyInfo(alias="changes-since", format="iso8601")] """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[4]" + Filters the instances by a date and time stamp when the instances last changed + status. """ exclude_flavor_prefix: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[5]" - """ + """Exclude instances with specified flavor prefix""" exclude_secgroup: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[6]" - """ + """Exclude instances with specified security group name""" flavor_id: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[7]" - """ + """Filter out instances by flavor_id. Flavor id must match exactly.""" flavor_prefix: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[8]" - """ + """Filter out instances by flavor_prefix.""" include_ai: bool - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[9]" - """ + """Include GPU clusters' servers""" include_baremetal: bool - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[10]" - """ + """Include bare metal servers. Please, use `GET /v1/bminstances/` instead""" include_k8s: bool - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[11]" - """ + """Include managed k8s worker nodes""" ip: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/12' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[12]" + """An IPv4 address to filter results by. + + Note: partial matches are allowed. For example, searching for 192.168.0.1 will + return 192.168.0.1, 192.168.0.10, 192.168.0.110, and so on. """ limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/13' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[13]" - """ + """Optional. Limit the number of returned items""" name: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/14' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[14]" + """Filter instances by name. + + You can provide a full or partial name, instances with matching names will be + returned. For example, entering 'test' will return all instances that contain + 'test' in their name. """ offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/15' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[15]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ only_isolated: bool - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/16' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[16]" - """ + """Include only isolated instances""" only_with_fixed_external_ip: bool - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/17' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[17]" - """ + """Return bare metals only with external fixed IP addresses.""" order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/18' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[18]" - """ + """Order by field and direction.""" profile_name: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/19' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[19]" + """Filter result by ddos protection profile name. + + Effective only with with_ddos set to true. """ protection_status: Literal["Active", "Queued", "Error"] - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/20' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[20]" + """Filter result by DDoS protection_status. + + if parameter is provided. Effective only with with_ddos set to true. (Active, + Queued or Error) """ status: Literal[ @@ -156,43 +115,32 @@ class InstanceListParams(TypedDict, total=False): "SUSPENDED", "VERIFY_RESIZE", ] - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/21' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[21]" - """ + """Filters instances by status.""" tag_key_value: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/22' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[22]" + """Optional. + + Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": + "value"}" --url "https://example.com/cloud/v1/resource/1/1" """ tag_value: List[str] - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/23' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[23]" - """ + """Optional. Filter by tag values. ?tag_value=value1&tag_value=value2""" type_ddos_profile: Literal["basic", "advanced"] - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/24' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[24]" + """Return bare metals either only with advanced or only basic DDoS protection. + + Effective only with with_ddos set to true. (advanced or basic) """ uuid: str - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/25' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[25]" - """ + """Filter the server list result by the UUID of the server. Allowed UUID part""" with_ddos: bool - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/26' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[26]" + """Include DDoS profile information in the response when set to `true`. + + Otherwise, the `ddos_profile` field in the response is `null` by default. """ with_interfaces_name: bool - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/27' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}'].get.parameters[27]" - """ + """Include `interface_name` in the addresses""" diff --git a/src/gcore/types/cloud/instance_resize_params.py b/src/gcore/types/cloud/instance_resize_params.py index 15b8ae17..99b3abe5 100644 --- a/src/gcore/types/cloud/instance_resize_params.py +++ b/src/gcore/types/cloud/instance_resize_params.py @@ -9,19 +9,8 @@ class InstanceResizeParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fchangeflavor/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor'].post.parameters[1].schema" - """ flavor_id: Required[str] - """ - '#/components/schemas/FlavorIdSchema/properties/flavor_id' - "$.components.schemas.FlavorIdSchema.properties.flavor_id" - """ + """Flavor ID""" 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 100b0809..0ff60506 100644 --- a/src/gcore/types/cloud/instance_unassign_security_group_params.py +++ b/src/gcore/types/cloud/instance_unassign_security_group_params.py @@ -10,39 +10,19 @@ class InstanceUnassignSecurityGroupParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdelsecuritygroup/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup'].post.parameters[1].schema" - """ name: str - """ - '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/name' - "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.name" - """ + """Security group name, applies to all ports""" ports_security_group_names: Iterable[PortsSecurityGroupName] - """ - '#/components/schemas/InstancePortsSecurityGroupsSchema/properties/ports_security_group_names' - "$.components.schemas.InstancePortsSecurityGroupsSchema.properties.ports_security_group_names" - """ + """Port security groups mapping""" class PortsSecurityGroupName(TypedDict, total=False): port_id: Required[Optional[str]] - """ - '#/components/schemas/PortSecurityGroupNamesSchema/properties/port_id' - "$.components.schemas.PortSecurityGroupNamesSchema.properties.port_id" - """ + """Port ID. If None, security groups will be applied to all ports""" security_group_names: Required[List[str]] - """ - '#/components/schemas/PortSecurityGroupNamesSchema/properties/security_group_names' - "$.components.schemas.PortSecurityGroupNamesSchema.properties.security_group_names" - """ + """List of security group names""" diff --git a/src/gcore/types/cloud/instance_update_params.py b/src/gcore/types/cloud/instance_update_params.py index cf094766..915a1edb 100644 --- a/src/gcore/types/cloud/instance_update_params.py +++ b/src/gcore/types/cloud/instance_update_params.py @@ -9,19 +9,10 @@ class InstanceUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}'].patch.parameters[1].schema" - """ + """Region ID""" name: Required[str] - """ - '#/components/schemas/NameSerializer/properties/name' - "$.components.schemas.NameSerializer.properties.name" - """ + """Name.""" diff --git a/src/gcore/types/cloud/instances/flavor_list_for_resize_params.py b/src/gcore/types/cloud/instances/flavor_list_for_resize_params.py index a2bcb22a..b1eb6ab1 100644 --- a/src/gcore/types/cloud/instances/flavor_list_for_resize_params.py +++ b/src/gcore/types/cloud/instances/flavor_list_for_resize_params.py @@ -9,19 +9,8 @@ class FlavorListForResizeParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[1].schema" - """ include_prices: bool - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Favailable_flavors/get/parameters/3' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors'].get.parameters[3]" - """ + """Set to true if flavor listing should include flavor prices""" diff --git a/src/gcore/types/cloud/instances/flavor_list_params.py b/src/gcore/types/cloud/instances/flavor_list_params.py index 3fbc6f0a..95fd4c92 100644 --- a/src/gcore/types/cloud/instances/flavor_list_params.py +++ b/src/gcore/types/cloud/instances/flavor_list_params.py @@ -9,37 +9,17 @@ class FlavorListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[1].schema" - """ disabled: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[2]" - """ + """Flag for filtering disabled flavors in the region. Defaults to true""" exclude_linux: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[3]" - """ + """Set to true to exclude flavors dedicated to linux images. Default False""" exclude_windows: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[4]" - """ + """Set to true to exclude flavors dedicated to windows images. Default False""" include_prices: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/flavors/{project_id}/{region_id}'].get.parameters[5]" - """ + """Set to true if the response should include flavor prices""" diff --git a/src/gcore/types/cloud/instances/flavor_list_suitable_params.py b/src/gcore/types/cloud/instances/flavor_list_suitable_params.py index d8895a16..74547aa3 100644 --- a/src/gcore/types/cloud/instances/flavor_list_suitable_params.py +++ b/src/gcore/types/cloud/instances/flavor_list_suitable_params.py @@ -10,81 +10,47 @@ class FlavorListSuitableParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[1].schema" - """ volumes: Required[Iterable[Volume]] - """ - '#/components/schemas/CreateInstanceVolumeListSchema/properties/volumes' - "$.components.schemas.CreateInstanceVolumeListSchema.properties.volumes" - """ + """Volumes details. Non-important info such as names may be omitted.""" include_prices: bool - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2Favailable_flavors/post/parameters/2' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/available_flavors'].post.parameters[2]" - """ + """Set to true if flavor listing should include flavor prices""" class Volume(TypedDict, total=False): source: Required[Literal["apptemplate", "existing-volume", "image", "new-volume", "snapshot"]] - """ - '#/components/schemas/CheckFlavorVolumeSchema/properties/source' - "$.components.schemas.CheckFlavorVolumeSchema.properties.source" - """ + """Volume source""" apptemplate_id: str - """ - '#/components/schemas/CheckFlavorVolumeSchema/properties/apptemplate_id' - "$.components.schemas.CheckFlavorVolumeSchema.properties.apptemplate_id" - """ + """App template ID. Mandatory if volume is created from marketplace template""" boot_index: int """ - '#/components/schemas/CheckFlavorVolumeSchema/properties/boot_index' - "$.components.schemas.CheckFlavorVolumeSchema.properties.boot_index" + 0 should be set for primary boot device Unique positive values for other + bootable devices.Negative - boot prohibited """ image_id: str - """ - '#/components/schemas/CheckFlavorVolumeSchema/properties/image_id' - "$.components.schemas.CheckFlavorVolumeSchema.properties.image_id" - """ + """Image ID. Mandatory if volume is created from image""" name: Optional[str] - """ - '#/components/schemas/CheckFlavorVolumeSchema/properties/name' - "$.components.schemas.CheckFlavorVolumeSchema.properties.name" - """ size: int - """ - '#/components/schemas/CheckFlavorVolumeSchema/properties/size' - "$.components.schemas.CheckFlavorVolumeSchema.properties.size" + """Volume size. + + Must be specified when source is 'new-volume' or 'image'. If specified for + source 'snapshot' or 'existing-volume', value must be equal to respective + snapshot or volume size """ snapshot_id: str - """ - '#/components/schemas/CheckFlavorVolumeSchema/properties/snapshot_id' - "$.components.schemas.CheckFlavorVolumeSchema.properties.snapshot_id" - """ + """Volume snapshot ID. Mandatory if volume is created from a snapshot""" type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - """ - '#/components/schemas/CheckFlavorVolumeSchema/properties/type_name' - "$.components.schemas.CheckFlavorVolumeSchema.properties.type_name" - """ + """One of 'standard', 'ssd_hiiops', 'ssd_local', 'ssd_lowlatency', 'cold', 'ultra'""" volume_id: str - """ - '#/components/schemas/CheckFlavorVolumeSchema/properties/volume_id' - "$.components.schemas.CheckFlavorVolumeSchema.properties.volume_id" - """ + """Volume ID. Mandatory if volume is pre-existing volume""" diff --git a/src/gcore/types/cloud/instances/image_create_from_volume_params.py b/src/gcore/types/cloud/instances/image_create_from_volume_params.py index eaaee130..7cd61603 100644 --- a/src/gcore/types/cloud/instances/image_create_from_volume_params.py +++ b/src/gcore/types/cloud/instances/image_create_from_volume_params.py @@ -12,73 +12,42 @@ class ImageCreateFromVolumeParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].post.parameters[1].schema" - """ name: Required[str] - """ - '#/components/schemas/ImageCreateFromVolumeSerializer/properties/name' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.name" - """ + """Image name""" volume_id: Required[str] - """ - '#/components/schemas/ImageCreateFromVolumeSerializer/properties/volume_id' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.volume_id" - """ + """Required if source is volume. Volume id""" architecture: Literal["aarch64", "x86_64"] - """ - '#/components/schemas/ImageCreateFromVolumeSerializer/properties/architecture' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.architecture" - """ + """Image CPU architecture type: `aarch64`, `x86_64`""" hw_firmware_type: Optional[Literal["bios", "uefi"]] - """ - '#/components/schemas/ImageCreateFromVolumeSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.hw_firmware_type.anyOf[0]" - """ + """Specifies the type of firmware with which to boot the guest.""" hw_machine_type: Optional[Literal["pc", "q35"]] - """ - '#/components/schemas/ImageCreateFromVolumeSerializer/properties/hw_machine_type/anyOf/0' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.hw_machine_type.anyOf[0]" - """ + """A virtual chipset type.""" is_baremetal: bool - """ - '#/components/schemas/ImageCreateFromVolumeSerializer/properties/is_baremetal' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.is_baremetal" - """ + """Set to true if the image will be used by bare metal servers. Defaults to false.""" os_type: Literal["linux", "windows"] - """ - '#/components/schemas/ImageCreateFromVolumeSerializer/properties/os_type' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.os_type" - """ + """The operating system installed on the image.""" source: Literal["volume"] - """ - '#/components/schemas/ImageCreateFromVolumeSerializer/properties/source' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.source" - """ + """Image source""" ssh_key: Literal["allow", "deny", "required"] - """ - '#/components/schemas/ImageCreateFromVolumeSerializer/properties/ssh_key' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.ssh_key" - """ + """Whether the image supports SSH key or not""" tags: TagUpdateListParam - """ - '#/components/schemas/ImageCreateFromVolumeSerializer/properties/tags' - "$.components.schemas.ImageCreateFromVolumeSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ diff --git a/src/gcore/types/cloud/instances/image_get_params.py b/src/gcore/types/cloud/instances/image_get_params.py index aefa51db..f9d96463 100644 --- a/src/gcore/types/cloud/instances/image_get_params.py +++ b/src/gcore/types/cloud/instances/image_get_params.py @@ -9,19 +9,8 @@ class ImageGetParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[1].schema" - """ include_prices: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/get/parameters/3' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].get.parameters[3]" - """ + """Show price""" diff --git a/src/gcore/types/cloud/instances/image_list_params.py b/src/gcore/types/cloud/instances/image_list_params.py index e6a19ab9..09f8b505 100644 --- a/src/gcore/types/cloud/instances/image_list_params.py +++ b/src/gcore/types/cloud/instances/image_list_params.py @@ -10,43 +10,24 @@ class ImageListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[1].schema" - """ include_prices: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[2]" - """ + """Show price""" private: str - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[3]" - """ + """Any value to show private images""" tag_key: List[str] - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[4]" - """ + """Filter by tag keys.""" tag_key_value: str - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[5]" + """Filter by tag key-value pairs. + + Must be a valid JSON string. 'curl -G --data-urlencode 'tag_key_value={"key": + "value"}' --url 'http://localhost:1111/v1/images/1/1'" """ visibility: Literal["private", "public", "shared"] - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/images/{project_id}/{region_id}'].get.parameters[6]" - """ + """Image visibility. Globally visible images are public""" diff --git a/src/gcore/types/cloud/instances/image_update_params.py b/src/gcore/types/cloud/instances/image_update_params.py index 8b1dd76a..c7828260 100644 --- a/src/gcore/types/cloud/instances/image_update_params.py +++ b/src/gcore/types/cloud/instances/image_update_params.py @@ -11,55 +11,33 @@ class ImageUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fimages%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bimage_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/images/{project_id}/{region_id}/{image_id}'].patch.parameters[1].schema" - """ hw_firmware_type: Literal["bios", "uefi"] - """ - '#/components/schemas/UpdateImageSerializer/properties/hw_firmware_type' - "$.components.schemas.UpdateImageSerializer.properties.hw_firmware_type" - """ + """Specifies the type of firmware with which to boot the guest.""" hw_machine_type: Literal["pc", "q35"] - """ - '#/components/schemas/UpdateImageSerializer/properties/hw_machine_type' - "$.components.schemas.UpdateImageSerializer.properties.hw_machine_type" - """ + """A virtual chipset type.""" is_baremetal: bool - """ - '#/components/schemas/UpdateImageSerializer/properties/is_baremetal' - "$.components.schemas.UpdateImageSerializer.properties.is_baremetal" - """ + """Set to true if the image will be used by bare metal servers.""" name: str - """ - '#/components/schemas/UpdateImageSerializer/properties/name' - "$.components.schemas.UpdateImageSerializer.properties.name" - """ + """Image display name""" os_type: Literal["linux", "windows"] - """ - '#/components/schemas/UpdateImageSerializer/properties/os_type' - "$.components.schemas.UpdateImageSerializer.properties.os_type" - """ + """The operating system installed on the image.""" ssh_key: Literal["allow", "deny", "required"] - """ - '#/components/schemas/UpdateImageSerializer/properties/ssh_key' - "$.components.schemas.UpdateImageSerializer.properties.ssh_key" - """ + """Whether the image supports SSH key or not""" tags: TagUpdateListParam - """ - '#/components/schemas/UpdateImageSerializer/properties/tags' - "$.components.schemas.UpdateImageSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ diff --git a/src/gcore/types/cloud/instances/image_upload_params.py b/src/gcore/types/cloud/instances/image_upload_params.py index db781440..c3d511b1 100644 --- a/src/gcore/types/cloud/instances/image_upload_params.py +++ b/src/gcore/types/cloud/instances/image_upload_params.py @@ -12,85 +12,51 @@ class ImageUploadParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fdownloadimage%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/downloadimage/{project_id}/{region_id}'].post.parameters[1].schema" - """ name: Required[str] - """ - '#/components/schemas/ImageDownloadSerializer/properties/name' - "$.components.schemas.ImageDownloadSerializer.properties.name" - """ + """Image name""" url: Required[str] - """ - '#/components/schemas/ImageDownloadSerializer/properties/url' - "$.components.schemas.ImageDownloadSerializer.properties.url" - """ + """URL""" architecture: Literal["aarch64", "x86_64"] - """ - '#/components/schemas/ImageDownloadSerializer/properties/architecture' - "$.components.schemas.ImageDownloadSerializer.properties.architecture" - """ + """Image CPU architecture type: `aarch64`, `x86_64`""" cow_format: bool """ - '#/components/schemas/ImageDownloadSerializer/properties/cow_format' - "$.components.schemas.ImageDownloadSerializer.properties.cow_format" + When True, image cannot be deleted unless all volumes, created from it, are + deleted. """ hw_firmware_type: Optional[Literal["bios", "uefi"]] - """ - '#/components/schemas/ImageDownloadSerializer/properties/hw_firmware_type/anyOf/0' - "$.components.schemas.ImageDownloadSerializer.properties.hw_firmware_type.anyOf[0]" - """ + """Specifies the type of firmware with which to boot the guest.""" hw_machine_type: Optional[Literal["pc", "q35"]] - """ - '#/components/schemas/ImageDownloadSerializer/properties/hw_machine_type/anyOf/0' - "$.components.schemas.ImageDownloadSerializer.properties.hw_machine_type.anyOf[0]" - """ + """A virtual chipset type.""" is_baremetal: bool - """ - '#/components/schemas/ImageDownloadSerializer/properties/is_baremetal' - "$.components.schemas.ImageDownloadSerializer.properties.is_baremetal" - """ + """Set to true if the image will be used by bare metal servers. Defaults to false.""" os_distro: Optional[str] - """ - '#/components/schemas/ImageDownloadSerializer/properties/os_distro/anyOf/0' - "$.components.schemas.ImageDownloadSerializer.properties.os_distro.anyOf[0]" - """ + """OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc.""" os_type: Literal["linux", "windows"] - """ - '#/components/schemas/ImageDownloadSerializer/properties/os_type' - "$.components.schemas.ImageDownloadSerializer.properties.os_type" - """ + """The operating system installed on the image.""" os_version: Optional[str] - """ - '#/components/schemas/ImageDownloadSerializer/properties/os_version/anyOf/0' - "$.components.schemas.ImageDownloadSerializer.properties.os_version.anyOf[0]" - """ + """OS version, i.e. 22.04 (for Ubuntu) or 9.4 for Debian""" ssh_key: Literal["allow", "deny", "required"] - """ - '#/components/schemas/ImageDownloadSerializer/properties/ssh_key' - "$.components.schemas.ImageDownloadSerializer.properties.ssh_key" - """ + """Whether the image supports SSH key or not""" tags: TagUpdateListParam - """ - '#/components/schemas/ImageDownloadSerializer/properties/tags' - "$.components.schemas.ImageDownloadSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ diff --git a/src/gcore/types/cloud/instances/instance_flavor.py b/src/gcore/types/cloud/instances/instance_flavor.py index 66719803..7e53296f 100644 --- a/src/gcore/types/cloud/instances/instance_flavor.py +++ b/src/gcore/types/cloud/instances/instance_flavor.py @@ -10,79 +10,40 @@ class InstanceFlavor(BaseModel): architecture: str - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/architecture' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.architecture" - """ + """Flavor architecture type""" disabled: bool - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/disabled' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.disabled" - """ + """Disabled flavor flag""" flavor_id: str - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/flavor_id' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.flavor_id" - """ + """Flavor ID is the same as name""" flavor_name: str - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/flavor_name' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.flavor_name" - """ + """Flavor name""" os_type: str - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/os_type' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.os_type" - """ + """Flavor operating system""" ram: int - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/ram' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.ram" - """ + """RAM size in MiB""" vcpus: int - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/vcpus' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.vcpus" - """ + """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" capacity: Optional[int] = None - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/capacity/anyOf/0' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.capacity.anyOf[0]" - """ + """Number of available instances of given configuration""" currency_code: Optional[str] = None - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/currency_code/anyOf/0' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.currency_code.anyOf[0]" - """ + """Currency code. Shown if the include_prices query parameter if set to true""" hardware_description: Optional[Dict[str, str]] = None - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/hardware_description' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.hardware_description" - """ + """Additional hardware description""" price_per_hour: Optional[float] = None - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/price_per_hour/anyOf/0' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.price_per_hour.anyOf[0]" - """ + """Price per hour. Shown if the include_prices query parameter if set to true""" price_per_month: Optional[float] = None - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/price_per_month/anyOf/0' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.price_per_month.anyOf[0]" - """ + """Price per month. Shown if the include_prices query parameter if set to true""" price_status: Optional[Literal["error", "hide", "show"]] = None - """ - '#/components/schemas/InstanceFlavorExtendedSerializer/properties/price_status/anyOf/0' - "$.components.schemas.InstanceFlavorExtendedSerializer.properties.price_status.anyOf[0]" - """ + """Price status for the UI""" diff --git a/src/gcore/types/cloud/instances/instance_flavor_list.py b/src/gcore/types/cloud/instances/instance_flavor_list.py index 69803c53..5d1e52c2 100644 --- a/src/gcore/types/cloud/instances/instance_flavor_list.py +++ b/src/gcore/types/cloud/instances/instance_flavor_list.py @@ -10,13 +10,7 @@ class InstanceFlavorList(BaseModel): count: int - """ - '#/components/schemas/InstanceFlavorExtendedCollectionSerializer/properties/count' - "$.components.schemas.InstanceFlavorExtendedCollectionSerializer.properties.count" - """ + """Number of objects""" results: List[InstanceFlavor] - """ - '#/components/schemas/InstanceFlavorExtendedCollectionSerializer/properties/results' - "$.components.schemas.InstanceFlavorExtendedCollectionSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/instances/interface_attach_params.py b/src/gcore/types/cloud/instances/interface_attach_params.py index 86e3d728..2efaba4c 100644 --- a/src/gcore/types/cloud/instances/interface_attach_params.py +++ b/src/gcore/types/cloud/instances/interface_attach_params.py @@ -28,424 +28,221 @@ class NewInterfaceExternalExtendSchemaWithDDOS(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - """ ddos_profile: NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - """ - '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ddos_profile.allOf[0]" - """ + """Advanced DDoS protection.""" interface_name: str - """ - '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/interface_name' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.interface_name" - """ + """Interface name""" ip_family: Literal["dual", "ipv4", "ipv6"] - """ - '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/ip_family' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.ip_family" - """ + """Which subnets should be selected: IPv4, IPv6 or use dual stack.""" port_group: int - """ - '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/port_group' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.port_group" - """ + """Each group will be added to the separate trunk.""" security_groups: Iterable[NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - """ - '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/security_groups' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.security_groups" - """ + """List of security group IDs""" type: str - """ - '#/components/schemas/NewInterfaceExternalExtendSchemaWithDdos/properties/type' - "$.components.schemas.NewInterfaceExternalExtendSchemaWithDdos.properties.type" - """ + """Must be 'external'. Union tag""" class NewInterfaceExternalExtendSchemaWithDdosddosProfileField(TypedDict, total=False): base_field: Optional[int] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" - """ + """ID of DDoS profile field""" field_name: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" - """ + """Name of DDoS profile field""" field_value: object - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" - """ + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" - """ + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile(TypedDict, total=False): profile_template: Required[int] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" - """ + """DDoS profile template ID.""" fields: Iterable[NewInterfaceExternalExtendSchemaWithDdosddosProfileField] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" - """ + """Protection parameters.""" profile_template_name: str - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" - """ + """DDoS profile template name.""" class NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSchema/properties/id' - "$.components.schemas.MandatoryIdSchema.properties.id" - """ + """Resource ID""" class NewInterfaceSpecificSubnetSchema(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - """ subnet_id: Required[str] - """ - '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/subnet_id' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.subnet_id" - """ + """Port will get an IP address from this subnet""" ddos_profile: NewInterfaceSpecificSubnetSchemaDDOSProfile - """ - '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.ddos_profile.allOf[0]" - """ + """Advanced DDoS protection.""" interface_name: str - """ - '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/interface_name' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.interface_name" - """ + """Interface name""" port_group: int - """ - '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/port_group' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.port_group" - """ + """Each group will be added to the separate trunk.""" security_groups: Iterable[NewInterfaceSpecificSubnetSchemaSecurityGroup] - """ - '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/security_groups' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.security_groups" - """ + """List of security group IDs""" type: str - """ - '#/components/schemas/NewInterfaceSpecificSubnetSchema/properties/type' - "$.components.schemas.NewInterfaceSpecificSubnetSchema.properties.type" - """ + """Must be 'subnet'""" class NewInterfaceSpecificSubnetSchemaDDOSProfileField(TypedDict, total=False): base_field: Optional[int] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" - """ + """ID of DDoS profile field""" field_name: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" - """ + """Name of DDoS profile field""" field_value: object - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" - """ + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" - """ + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceSpecificSubnetSchemaDDOSProfile(TypedDict, total=False): profile_template: Required[int] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" - """ + """DDoS profile template ID.""" fields: Iterable[NewInterfaceSpecificSubnetSchemaDDOSProfileField] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" - """ + """Protection parameters.""" profile_template_name: str - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" - """ + """DDoS profile template name.""" class NewInterfaceSpecificSubnetSchemaSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSchema/properties/id' - "$.components.schemas.MandatoryIdSchema.properties.id" - """ + """Resource ID""" class NewInterfaceAnySubnetSchema(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - """ network_id: Required[str] - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/network_id' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.network_id" - """ + """Port will get an IP address in this network subnet""" ddos_profile: NewInterfaceAnySubnetSchemaDDOSProfile - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ddos_profile.allOf[0]" - """ + """Advanced DDoS protection.""" interface_name: str - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/interface_name' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.interface_name" - """ + """Interface name""" ip_family: Literal["dual", "ipv4", "ipv6"] - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/ip_family' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.ip_family" - """ + """Which subnets should be selected: IPv4, IPv6 or use dual stack.""" port_group: int - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/port_group' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.port_group" - """ + """Each group will be added to the separate trunk.""" security_groups: Iterable[NewInterfaceAnySubnetSchemaSecurityGroup] - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/security_groups' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.security_groups" - """ + """List of security group IDs""" type: str - """ - '#/components/schemas/NewInterfaceAnySubnetSchema/properties/type' - "$.components.schemas.NewInterfaceAnySubnetSchema.properties.type" - """ + """Must be 'any_subnet'""" class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): base_field: Optional[int] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" - """ + """ID of DDoS profile field""" field_name: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" - """ + """Name of DDoS profile field""" field_value: object - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" - """ + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" - """ + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceAnySubnetSchemaDDOSProfile(TypedDict, total=False): profile_template: Required[int] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" - """ + """DDoS profile template ID.""" fields: Iterable[NewInterfaceAnySubnetSchemaDDOSProfileField] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" - """ + """Protection parameters.""" profile_template_name: str - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" - """ + """DDoS profile template name.""" class NewInterfaceAnySubnetSchemaSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSchema/properties/id' - "$.components.schemas.MandatoryIdSchema.properties.id" - """ + """Resource ID""" class NewInterfaceReservedFixedIPSchema(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fattach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface'].post.parameters[1].schema" - """ port_id: Required[str] - """ - '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_id' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_id" - """ + """Port ID""" ddos_profile: NewInterfaceReservedFixedIPSchemaDDOSProfile - """ - '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/ddos_profile/allOf/0' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.ddos_profile.allOf[0]" - """ + """Advanced DDoS protection.""" interface_name: str - """ - '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/interface_name' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.interface_name" - """ + """Interface name""" port_group: int - """ - '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/port_group' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.port_group" - """ + """Each group will be added to the separate trunk.""" security_groups: Iterable[NewInterfaceReservedFixedIPSchemaSecurityGroup] - """ - '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/security_groups' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.security_groups" - """ + """List of security group IDs""" type: str - """ - '#/components/schemas/NewInterfaceReservedFixedIpSchema/properties/type' - "$.components.schemas.NewInterfaceReservedFixedIpSchema.properties.type" - """ + """Must be 'reserved_fixed_ip'. Union tag""" class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): base_field: Optional[int] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/base_field' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.base_field" - """ + """ID of DDoS profile field""" field_name: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_name' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_name" - """ + """Name of DDoS profile field""" field_value: object - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/field_value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.field_value" - """ + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """ - '#/components/schemas/DeprecatedCreateClientProfileFieldSchema/properties/value' - "$.components.schemas.DeprecatedCreateClientProfileFieldSchema.properties.value" - """ + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceReservedFixedIPSchemaDDOSProfile(TypedDict, total=False): profile_template: Required[int] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template" - """ + """DDoS profile template ID.""" fields: Iterable[NewInterfaceReservedFixedIPSchemaDDOSProfileField] - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/fields' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.fields" - """ + """Protection parameters.""" profile_template_name: str - """ - '#/components/schemas/DeprecatedCreateDdosProfileSchema/properties/profile_template_name' - "$.components.schemas.DeprecatedCreateDdosProfileSchema.properties.profile_template_name" - """ + """DDoS profile template name.""" class NewInterfaceReservedFixedIPSchemaSecurityGroup(TypedDict, total=False): id: Required[str] - """ - '#/components/schemas/MandatoryIdSchema/properties/id' - "$.components.schemas.MandatoryIdSchema.properties.id" - """ + """Resource ID""" InterfaceAttachParams: TypeAlias = Union[ diff --git a/src/gcore/types/cloud/instances/interface_detach_params.py b/src/gcore/types/cloud/instances/interface_detach_params.py index 7c3a2e66..5f092a84 100644 --- a/src/gcore/types/cloud/instances/interface_detach_params.py +++ b/src/gcore/types/cloud/instances/interface_detach_params.py @@ -9,25 +9,11 @@ class InterfaceDetachParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fdetach_interface/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface'].post.parameters[1].schema" - """ ip_address: Required[str] - """ - '#/components/schemas/PortIdWithIpSchema/properties/ip_address' - "$.components.schemas.PortIdWithIpSchema.properties.ip_address" - """ + """IP address""" port_id: Required[str] - """ - '#/components/schemas/PortIdWithIpSchema/properties/port_id' - "$.components.schemas.PortIdWithIpSchema.properties.port_id" - """ + """ID of the port""" diff --git a/src/gcore/types/cloud/instances/metric_list_params.py b/src/gcore/types/cloud/instances/metric_list_params.py index 0a070052..13be263e 100644 --- a/src/gcore/types/cloud/instances/metric_list_params.py +++ b/src/gcore/types/cloud/instances/metric_list_params.py @@ -11,25 +11,13 @@ class MetricListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/0/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Finstances%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Binstance_id%7D%2Fmetrics/post/parameters/1/schema' - "$.paths['/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics'].post.parameters[1].schema" - """ + """Region ID""" time_interval: Required[int] - """ - '#/components/schemas/InstanceMetricsRequestSerializer/properties/time_interval' - "$.components.schemas.InstanceMetricsRequestSerializer.properties.time_interval" - """ + """Time interval.""" time_unit: Required[InstanceMetricsTimeUnit] - """ - '#/components/schemas/InstanceMetricsRequestSerializer/properties/time_unit' - "$.components.schemas.InstanceMetricsRequestSerializer.properties.time_unit" - """ + """Time interval unit.""" diff --git a/src/gcore/types/cloud/instances/metrics.py b/src/gcore/types/cloud/instances/metrics.py index e5ff9469..2bf65b7d 100644 --- a/src/gcore/types/cloud/instances/metrics.py +++ b/src/gcore/types/cloud/instances/metrics.py @@ -11,81 +11,42 @@ class Disk(BaseModel): disk_bps_read: Optional[float] = FieldInfo(alias="disk_Bps_read", default=None) - """ - '#/components/schemas/DisksMetrics/properties/disk_Bps_read/anyOf/0' - "$.components.schemas.DisksMetrics.properties.disk_Bps_read.anyOf[0]" - """ + """Disk read, Bytes per second""" disk_bps_write: Optional[float] = FieldInfo(alias="disk_Bps_write", default=None) - """ - '#/components/schemas/DisksMetrics/properties/disk_Bps_write/anyOf/0' - "$.components.schemas.DisksMetrics.properties.disk_Bps_write.anyOf[0]" - """ + """Disk write, Bytes per second""" disk_iops_read: Optional[float] = None - """ - '#/components/schemas/DisksMetrics/properties/disk_iops_read/anyOf/0' - "$.components.schemas.DisksMetrics.properties.disk_iops_read.anyOf[0]" - """ + """Disk read, iops""" disk_iops_write: Optional[float] = None - """ - '#/components/schemas/DisksMetrics/properties/disk_iops_write/anyOf/0' - "$.components.schemas.DisksMetrics.properties.disk_iops_write.anyOf[0]" - """ + """Disk write, iops""" disk_name: Optional[str] = None - """ - '#/components/schemas/DisksMetrics/properties/disk_name/anyOf/0' - "$.components.schemas.DisksMetrics.properties.disk_name.anyOf[0]" - """ + """Disk attached slot name""" class Metrics(BaseModel): time: str - """ - '#/components/schemas/InstanceMetricsSerializer/properties/time' - "$.components.schemas.InstanceMetricsSerializer.properties.time" - """ + """Timestamp""" cpu_util: Optional[float] = None - """ - '#/components/schemas/InstanceMetricsSerializer/properties/cpu_util/anyOf/0' - "$.components.schemas.InstanceMetricsSerializer.properties.cpu_util.anyOf[0]" - """ + """CPU utilization, % (max 100% for multi-core)""" disks: Optional[List[Disk]] = None - """ - '#/components/schemas/InstanceMetricsSerializer/properties/disks/anyOf/0' - "$.components.schemas.InstanceMetricsSerializer.properties.disks.anyOf[0]" - """ + """Disks metrics for each of the disks attached""" memory_util: Optional[float] = None - """ - '#/components/schemas/InstanceMetricsSerializer/properties/memory_util/anyOf/0' - "$.components.schemas.InstanceMetricsSerializer.properties.memory_util.anyOf[0]" - """ + """RAM utilization, %""" network_bps_egress: Optional[float] = FieldInfo(alias="network_Bps_egress", default=None) - """ - '#/components/schemas/InstanceMetricsSerializer/properties/network_Bps_egress/anyOf/0' - "$.components.schemas.InstanceMetricsSerializer.properties.network_Bps_egress.anyOf[0]" - """ + """Network out, bytes per second""" network_bps_ingress: Optional[float] = FieldInfo(alias="network_Bps_ingress", default=None) - """ - '#/components/schemas/InstanceMetricsSerializer/properties/network_Bps_ingress/anyOf/0' - "$.components.schemas.InstanceMetricsSerializer.properties.network_Bps_ingress.anyOf[0]" - """ + """Network in, bytes per second""" network_pps_egress: Optional[float] = None - """ - '#/components/schemas/InstanceMetricsSerializer/properties/network_pps_egress/anyOf/0' - "$.components.schemas.InstanceMetricsSerializer.properties.network_pps_egress.anyOf[0]" - """ + """Network out, packets per second""" network_pps_ingress: Optional[float] = None - """ - '#/components/schemas/InstanceMetricsSerializer/properties/network_pps_ingress/anyOf/0' - "$.components.schemas.InstanceMetricsSerializer.properties.network_pps_ingress.anyOf[0]" - """ + """Network in, packets per second""" diff --git a/src/gcore/types/cloud/instances/metrics_list.py b/src/gcore/types/cloud/instances/metrics_list.py index d3cbff46..d898b4a6 100644 --- a/src/gcore/types/cloud/instances/metrics_list.py +++ b/src/gcore/types/cloud/instances/metrics_list.py @@ -10,13 +10,7 @@ class MetricsList(BaseModel): count: int - """ - '#/components/schemas/InstanceMetricsListSerializer/properties/count' - "$.components.schemas.InstanceMetricsListSerializer.properties.count" - """ + """Number of objects""" results: List[Metrics] - """ - '#/components/schemas/InstanceMetricsListSerializer/properties/results' - "$.components.schemas.InstanceMetricsListSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/ip_assignment.py b/src/gcore/types/cloud/ip_assignment.py index 44998d10..49dcc87c 100644 --- a/src/gcore/types/cloud/ip_assignment.py +++ b/src/gcore/types/cloud/ip_assignment.py @@ -7,13 +7,7 @@ class IPAssignment(BaseModel): ip_address: str - """ - '#/components/schemas/PortIpSubnetIdSerializer/properties/ip_address' - "$.components.schemas.PortIpSubnetIdSerializer.properties.ip_address" - """ + """IP address""" subnet_id: str - """ - '#/components/schemas/PortIpSubnetIdSerializer/properties/subnet_id' - "$.components.schemas.PortIpSubnetIdSerializer.properties.subnet_id" - """ + """ID of the subnet that allocated the IP""" diff --git a/src/gcore/types/cloud/ip_ranges.py b/src/gcore/types/cloud/ip_ranges.py index 0bfc21e8..5c983ebe 100644 --- a/src/gcore/types/cloud/ip_ranges.py +++ b/src/gcore/types/cloud/ip_ranges.py @@ -9,7 +9,4 @@ class IPRanges(BaseModel): ranges: List[str] - """ - '#/components/schemas/IPRangesSerializer/properties/ranges' - "$.components.schemas.IPRangesSerializer.properties.ranges" - """ + """IP ranges list""" diff --git a/src/gcore/types/cloud/l7_policy.py b/src/gcore/types/cloud/l7_policy.py index f812acdf..fc4bbd93 100644 --- a/src/gcore/types/cloud/l7_policy.py +++ b/src/gcore/types/cloud/l7_policy.py @@ -11,105 +11,76 @@ class L7Policy(BaseModel): id: Optional[str] = None - """ - '#/components/schemas/L7PolicySchema/properties/id' - "$.components.schemas.L7PolicySchema.properties.id" - """ + """ID""" action: Optional[Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"]] = None - """ - '#/components/schemas/L7PolicySchema/properties/action' - "$.components.schemas.L7PolicySchema.properties.action" - """ + """Action""" listener_id: Optional[str] = None - """ - '#/components/schemas/L7PolicySchema/properties/listener_id' - "$.components.schemas.L7PolicySchema.properties.listener_id" - """ + """Listener ID""" name: Optional[str] = None - """ - '#/components/schemas/L7PolicySchema/properties/name' - "$.components.schemas.L7PolicySchema.properties.name" - """ + """Human-readable name of the policy""" operating_status: Optional[Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"]] = None - """ - '#/components/schemas/L7PolicySchema/properties/operating_status' - "$.components.schemas.L7PolicySchema.properties.operating_status" - """ + """L7 policy operating status""" position: Optional[int] = None - """ - '#/components/schemas/L7PolicySchema/properties/position' - "$.components.schemas.L7PolicySchema.properties.position" - """ + """The position of this policy on the listener. Positions start at 1.""" project_id: Optional[int] = None - """ - '#/components/schemas/L7PolicySchema/properties/project_id' - "$.components.schemas.L7PolicySchema.properties.project_id" - """ + """Project ID""" provisioning_status: Optional[ Literal["ACTIVE", "DELETED", "ERROR", "PENDING_CREATE", "PENDING_DELETE", "PENDING_UPDATE"] ] = None - """ - '#/components/schemas/L7PolicySchema/properties/provisioning_status' - "$.components.schemas.L7PolicySchema.properties.provisioning_status" - """ redirect_http_code: Optional[int] = None """ - '#/components/schemas/L7PolicySchema/properties/redirect_http_code' - "$.components.schemas.L7PolicySchema.properties.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. """ redirect_pool_id: Optional[str] = None - """ - '#/components/schemas/L7PolicySchema/properties/redirect_pool_id' - "$.components.schemas.L7PolicySchema.properties.redirect_pool_id" + """Requests matching this policy will be redirected to the pool with this ID. + + Only valid if action is REDIRECT_TO_POOL. """ redirect_prefix: Optional[str] = None - """ - '#/components/schemas/L7PolicySchema/properties/redirect_prefix' - "$.components.schemas.L7PolicySchema.properties.redirect_prefix" + """Requests matching this policy will be redirected to this Prefix URL. + + Only valid if action is REDIRECT_PREFIX. """ redirect_url: Optional[str] = None - """ - '#/components/schemas/L7PolicySchema/properties/redirect_url' - "$.components.schemas.L7PolicySchema.properties.redirect_url" + """Requests matching this policy will be redirected to this URL. + + Only valid if action is REDIRECT_TO_URL. """ region: Optional[str] = None - """ - '#/components/schemas/L7PolicySchema/properties/region' - "$.components.schemas.L7PolicySchema.properties.region" - """ + """Region name""" region_id: Optional[int] = None - """ - '#/components/schemas/L7PolicySchema/properties/region_id' - "$.components.schemas.L7PolicySchema.properties.region_id" - """ + """Region ID""" rules: Optional[List[L7Rule]] = None - """ - '#/components/schemas/L7PolicySchema/properties/rules' - "$.components.schemas.L7PolicySchema.properties.rules" + """Rules. + + All the rules associated with a given policy are logically ANDed together. A + request must match all the policy’s rules to match the policy.If you need to + express a logical OR operation between rules, then do this by creating multiple + policies with the same action. """ tags: Optional[List[str]] = None - """ - '#/components/schemas/L7PolicySchema/properties/tags' - "$.components.schemas.L7PolicySchema.properties.tags" - """ + """A list of simple strings assigned to the resource.""" task_id: Optional[str] = None - """ - '#/components/schemas/L7PolicySchema/properties/task_id' - "$.components.schemas.L7PolicySchema.properties.task_id" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ diff --git a/src/gcore/types/cloud/l7_policy_list.py b/src/gcore/types/cloud/l7_policy_list.py index 802ab5dc..9d76b97b 100644 --- a/src/gcore/types/cloud/l7_policy_list.py +++ b/src/gcore/types/cloud/l7_policy_list.py @@ -10,13 +10,7 @@ class L7PolicyList(BaseModel): count: Optional[int] = None - """ - '#/components/schemas/L7PolicyListSchema/properties/count' - "$.components.schemas.L7PolicyListSchema.properties.count" - """ + """Number of objects""" results: Optional[List[L7Policy]] = None - """ - '#/components/schemas/L7PolicyListSchema/properties/results' - "$.components.schemas.L7PolicyListSchema.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/l7_rule.py b/src/gcore/types/cloud/l7_rule.py index ba331ac1..029fb849 100644 --- a/src/gcore/types/cloud/l7_rule.py +++ b/src/gcore/types/cloud/l7_rule.py @@ -10,71 +10,48 @@ class L7Rule(BaseModel): id: Optional[str] = None - """ - '#/components/schemas/L7RuleSchema/properties/id' - "$.components.schemas.L7RuleSchema.properties.id" - """ + """L7Rule ID""" compare_type: Optional[Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"]] = None - """ - '#/components/schemas/L7RuleSchema/properties/compare_type' - "$.components.schemas.L7RuleSchema.properties.compare_type" - """ + """The comparison type for the L7 rule""" invert: Optional[bool] = None - """ - '#/components/schemas/L7RuleSchema/properties/invert' - "$.components.schemas.L7RuleSchema.properties.invert" + """When true the logic of the rule is inverted. + + For example, with invert true, 'equal to' would become 'not equal to'. Default + is false. """ key: Optional[str] = None - """ - '#/components/schemas/L7RuleSchema/properties/key' - "$.components.schemas.L7RuleSchema.properties.key" + """The key to use for the comparison. + + For example, the name of the cookie to evaluate. """ operating_status: Optional[Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"]] = None - """ - '#/components/schemas/L7RuleSchema/properties/operating_status' - "$.components.schemas.L7RuleSchema.properties.operating_status" - """ + """L7 policy operating status""" project_id: Optional[int] = None - """ - '#/components/schemas/L7RuleSchema/properties/project_id' - "$.components.schemas.L7RuleSchema.properties.project_id" - """ + """Project ID""" provisioning_status: Optional[ Literal["ACTIVE", "DELETED", "ERROR", "PENDING_CREATE", "PENDING_DELETE", "PENDING_UPDATE"] ] = None - """ - '#/components/schemas/L7RuleSchema/properties/provisioning_status' - "$.components.schemas.L7RuleSchema.properties.provisioning_status" - """ region: Optional[str] = None - """ - '#/components/schemas/L7RuleSchema/properties/region' - "$.components.schemas.L7RuleSchema.properties.region" - """ + """Region name""" region_id: Optional[int] = None - """ - '#/components/schemas/L7RuleSchema/properties/region_id' - "$.components.schemas.L7RuleSchema.properties.region_id" - """ + """Region ID""" tags: Optional[List[str]] = None - """ - '#/components/schemas/L7RuleSchema/properties/tags' - "$.components.schemas.L7RuleSchema.properties.tags" - """ + """A list of simple strings assigned to the l7 rule""" task_id: Optional[str] = None - """ - '#/components/schemas/L7RuleSchema/properties/task_id' - "$.components.schemas.L7RuleSchema.properties.task_id" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ type: Optional[ @@ -89,13 +66,7 @@ class L7Rule(BaseModel): "SSL_VERIFY_RESULT", ] ] = None - """ - '#/components/schemas/L7RuleSchema/properties/type' - "$.components.schemas.L7RuleSchema.properties.type" - """ + """The L7 rule type""" value: Optional[str] = None - """ - '#/components/schemas/L7RuleSchema/properties/value' - "$.components.schemas.L7RuleSchema.properties.value" - """ + """The value to use for the comparison. For example, the file type to compare.""" diff --git a/src/gcore/types/cloud/l7_rule_list.py b/src/gcore/types/cloud/l7_rule_list.py index a5a567e6..c7b7de94 100644 --- a/src/gcore/types/cloud/l7_rule_list.py +++ b/src/gcore/types/cloud/l7_rule_list.py @@ -10,13 +10,7 @@ class L7RuleList(BaseModel): count: Optional[int] = None - """ - '#/components/schemas/L7RuleListSchema/properties/count' - "$.components.schemas.L7RuleListSchema.properties.count" - """ + """Number of objects""" results: Optional[List[L7Rule]] = None - """ - '#/components/schemas/L7RuleListSchema/properties/results' - "$.components.schemas.L7RuleListSchema.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/laas_index_retention_policy.py b/src/gcore/types/cloud/laas_index_retention_policy.py index 5e80c8c8..c14c24f3 100644 --- a/src/gcore/types/cloud/laas_index_retention_policy.py +++ b/src/gcore/types/cloud/laas_index_retention_policy.py @@ -9,7 +9,4 @@ class LaasIndexRetentionPolicy(BaseModel): period: Optional[int] = None - """ - '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' - "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" - """ + """Duration of days for which logs must be kept.""" diff --git a/src/gcore/types/cloud/laas_index_retention_policy_param.py b/src/gcore/types/cloud/laas_index_retention_policy_param.py index 36c0137c..cbe32a67 100644 --- a/src/gcore/types/cloud/laas_index_retention_policy_param.py +++ b/src/gcore/types/cloud/laas_index_retention_policy_param.py @@ -10,7 +10,4 @@ class LaasIndexRetentionPolicyParam(TypedDict, total=False): period: Required[Optional[int]] - """ - '#/components/schemas/LaasIndexRetentionPolicyPydanticSerializer/properties/period/anyOf/0' - "$.components.schemas.LaasIndexRetentionPolicyPydanticSerializer.properties.period.anyOf[0]" - """ + """Duration of days for which logs must be kept.""" diff --git a/src/gcore/types/cloud/lb_flavor_list.py b/src/gcore/types/cloud/lb_flavor_list.py index 57faf8ac..09f27c33 100644 --- a/src/gcore/types/cloud/lb_flavor_list.py +++ b/src/gcore/types/cloud/lb_flavor_list.py @@ -13,69 +13,36 @@ class Result(BaseModel): flavor_id: str - """ - '#/components/schemas/LbFlavorPricingSerializer/properties/flavor_id' - "$.components.schemas.LbFlavorPricingSerializer.properties.flavor_id" - """ + """Flavor ID is the same as name""" flavor_name: str - """ - '#/components/schemas/LbFlavorPricingSerializer/properties/flavor_name' - "$.components.schemas.LbFlavorPricingSerializer.properties.flavor_name" - """ + """Flavor name""" hardware_description: ResultHardwareDescription - """ - '#/components/schemas/LbFlavorPricingSerializer/properties/hardware_description' - "$.components.schemas.LbFlavorPricingSerializer.properties.hardware_description" - """ + """Additional hardware description.""" ram: int - """ - '#/components/schemas/LbFlavorPricingSerializer/properties/ram' - "$.components.schemas.LbFlavorPricingSerializer.properties.ram" - """ + """RAM size in MiB""" vcpus: int - """ - '#/components/schemas/LbFlavorPricingSerializer/properties/vcpus' - "$.components.schemas.LbFlavorPricingSerializer.properties.vcpus" - """ + """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" currency_code: Optional[str] = None - """ - '#/components/schemas/LbFlavorPricingSerializer/properties/currency_code/anyOf/0' - "$.components.schemas.LbFlavorPricingSerializer.properties.currency_code.anyOf[0]" - """ + """Currency code. Shown if the include_prices query parameter if set to true""" price_per_hour: Optional[float] = None - """ - '#/components/schemas/LbFlavorPricingSerializer/properties/price_per_hour/anyOf/0' - "$.components.schemas.LbFlavorPricingSerializer.properties.price_per_hour.anyOf[0]" - """ + """Price per hour. Shown if the include_prices query parameter if set to true""" price_per_month: Optional[float] = None - """ - '#/components/schemas/LbFlavorPricingSerializer/properties/price_per_month/anyOf/0' - "$.components.schemas.LbFlavorPricingSerializer.properties.price_per_month.anyOf[0]" - """ + """Price per month. Shown if the include_prices query parameter if set to true""" price_status: Optional[Literal["error", "hide", "show"]] = None - """ - '#/components/schemas/LbFlavorPricingSerializer/properties/price_status/anyOf/0' - "$.components.schemas.LbFlavorPricingSerializer.properties.price_status.anyOf[0]" - """ + """Price status for the UI""" class LbFlavorList(BaseModel): count: int - """ - '#/components/schemas/LbFlavorPricingCollectionSerializer/properties/count' - "$.components.schemas.LbFlavorPricingCollectionSerializer.properties.count" - """ + """Number of objects""" results: List[Result] - """ - '#/components/schemas/LbFlavorPricingCollectionSerializer/properties/results' - "$.components.schemas.LbFlavorPricingCollectionSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/lb_health_monitor.py b/src/gcore/types/cloud/lb_health_monitor.py index 1e47e760..d0c5f965 100644 --- a/src/gcore/types/cloud/lb_health_monitor.py +++ b/src/gcore/types/cloud/lb_health_monitor.py @@ -13,73 +13,36 @@ class LbHealthMonitor(BaseModel): id: str - """ - '#/components/schemas/LbHealthMonitorSerializer/properties/id' - "$.components.schemas.LbHealthMonitorSerializer.properties.id" - """ + """Health monitor ID""" admin_state_up: bool - """ - '#/components/schemas/LbHealthMonitorSerializer/properties/admin_state_up' - "$.components.schemas.LbHealthMonitorSerializer.properties.admin_state_up" - """ + """true if enabled. Defaults to true""" delay: int - """ - '#/components/schemas/LbHealthMonitorSerializer/properties/delay' - "$.components.schemas.LbHealthMonitorSerializer.properties.delay" - """ + """The time, in seconds, between sending probes to members""" max_retries: int - """ - '#/components/schemas/LbHealthMonitorSerializer/properties/max_retries' - "$.components.schemas.LbHealthMonitorSerializer.properties.max_retries" - """ + """Number of successes before the member is switched to ONLINE state""" max_retries_down: int - """ - '#/components/schemas/LbHealthMonitorSerializer/properties/max_retries_down' - "$.components.schemas.LbHealthMonitorSerializer.properties.max_retries_down" - """ + """Number of failures before the member is switched to ERROR state""" operating_status: LoadBalancerOperatingStatus - """ - '#/components/schemas/LbHealthMonitorSerializer/properties/operating_status' - "$.components.schemas.LbHealthMonitorSerializer.properties.operating_status" - """ + """Health Monitor operating status""" provisioning_status: ProvisioningStatus - """ - '#/components/schemas/LbHealthMonitorSerializer/properties/provisioning_status' - "$.components.schemas.LbHealthMonitorSerializer.properties.provisioning_status" - """ + """Health monitor lifecycle status""" timeout: int - """ - '#/components/schemas/LbHealthMonitorSerializer/properties/timeout' - "$.components.schemas.LbHealthMonitorSerializer.properties.timeout" - """ + """The maximum time to connect. Must be less than the delay value""" type: HealthMonitorType - """ - '#/components/schemas/LbHealthMonitorSerializer/properties/type' - "$.components.schemas.LbHealthMonitorSerializer.properties.type" - """ + """Health monitor type. Once health monitor is created, cannot be changed.""" expected_codes: Optional[str] = None - """ - '#/components/schemas/LbHealthMonitorSerializer/properties/expected_codes/anyOf/0' - "$.components.schemas.LbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" - """ http_method: Optional[HTTPMethod] = None - """ - '#/components/schemas/LbHealthMonitorSerializer/properties/http_method/anyOf/0' - "$.components.schemas.LbHealthMonitorSerializer.properties.http_method.anyOf[0]" - """ + """HTTP method""" url_path: Optional[str] = None - """ - '#/components/schemas/LbHealthMonitorSerializer/properties/url_path/anyOf/0' - "$.components.schemas.LbHealthMonitorSerializer.properties.url_path.anyOf[0]" - """ + """URL Path. Defaults to '/'""" diff --git a/src/gcore/types/cloud/lb_listener.py b/src/gcore/types/cloud/lb_listener.py index 45e485df..2aa7fa1e 100644 --- a/src/gcore/types/cloud/lb_listener.py +++ b/src/gcore/types/cloud/lb_listener.py @@ -13,135 +13,85 @@ class UserList(BaseModel): encrypted_password: str - """ - '#/components/schemas/UserListItem/properties/encrypted_password' - "$.components.schemas.UserListItem.properties.encrypted_password" - """ + """Encrypted password to auth via Basic Authentication""" username: str - """ - '#/components/schemas/UserListItem/properties/username' - "$.components.schemas.UserListItem.properties.username" - """ + """Username to auth via Basic Authentication""" class LbListener(BaseModel): id: str - """ - '#/components/schemas/LbListenerSerializer/properties/id' - "$.components.schemas.LbListenerSerializer.properties.id" - """ + """Load balancer listener ID""" connection_limit: int - """ - '#/components/schemas/LbListenerSerializer/properties/connection_limit' - "$.components.schemas.LbListenerSerializer.properties.connection_limit" - """ + """Limit of simultaneous connections""" insert_headers: object - """ - '#/components/schemas/LbListenerSerializer/properties/insert_headers' - "$.components.schemas.LbListenerSerializer.properties.insert_headers" + """Dictionary of additional header insertion into HTTP headers. + + Only used with HTTP and TERMINATED_HTTPS protocols. """ name: str - """ - '#/components/schemas/LbListenerSerializer/properties/name' - "$.components.schemas.LbListenerSerializer.properties.name" - """ + """Load balancer listener name""" operating_status: LoadBalancerOperatingStatus - """ - '#/components/schemas/LbListenerSerializer/properties/operating_status' - "$.components.schemas.LbListenerSerializer.properties.operating_status" - """ + """Listener operating status""" protocol: LbListenerProtocol - """ - '#/components/schemas/LbListenerSerializer/properties/protocol' - "$.components.schemas.LbListenerSerializer.properties.protocol" - """ + """Load balancer protocol""" protocol_port: int - """ - '#/components/schemas/LbListenerSerializer/properties/protocol_port' - "$.components.schemas.LbListenerSerializer.properties.protocol_port" - """ + """Protocol port""" provisioning_status: ProvisioningStatus - """ - '#/components/schemas/LbListenerSerializer/properties/provisioning_status' - "$.components.schemas.LbListenerSerializer.properties.provisioning_status" - """ + """Listener lifecycle status""" allowed_cidrs: Optional[List[str]] = None - """ - '#/components/schemas/LbListenerSerializer/properties/allowed_cidrs/anyOf/0' - "$.components.schemas.LbListenerSerializer.properties.allowed_cidrs.anyOf[0]" - """ + """Network CIDRs from which service will be accessible""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/LbListenerSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.LbListenerSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" loadbalancer_id: Optional[str] = None - """ - '#/components/schemas/LbListenerSerializer/properties/loadbalancer_id/anyOf/0' - "$.components.schemas.LbListenerSerializer.properties.loadbalancer_id.anyOf[0]" - """ + """Load balancer ID""" pool_count: Optional[int] = None - """ - '#/components/schemas/LbListenerSerializer/properties/pool_count/anyOf/0' - "$.components.schemas.LbListenerSerializer.properties.pool_count.anyOf[0]" - """ + """Number of pools (for UI)""" secret_id: Optional[str] = None """ - '#/components/schemas/LbListenerSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.LbListenerSerializer.properties.secret_id.anyOf[0]" + ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS + load balancer """ sni_secret_id: Optional[List[str]] = None """ - '#/components/schemas/LbListenerSerializer/properties/sni_secret_id/anyOf/0' - "$.components.schemas.LbListenerSerializer.properties.sni_secret_id.anyOf[0]" + List of secret's ID containing PKCS12 format certificate/key bundles for + TERMINATED_HTTPS or PROMETHEUS listeners """ stats: Optional[LoadBalancerStatistics] = None - """ - '#/components/schemas/LbListenerSerializer/properties/stats/anyOf/0' - "$.components.schemas.LbListenerSerializer.properties.stats.anyOf[0]" + """Statistics of the load balancer. + + It is available only in get functions by a flag. """ task_id: Optional[str] = None - """ - '#/components/schemas/LbListenerSerializer/properties/task_id/anyOf/0' - "$.components.schemas.LbListenerSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ timeout_client_data: Optional[int] = None - """ - '#/components/schemas/LbListenerSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.LbListenerSerializer.properties.timeout_client_data.anyOf[0]" - """ + """Frontend client inactivity timeout in milliseconds""" timeout_member_connect: Optional[int] = None - """ - '#/components/schemas/LbListenerSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.LbListenerSerializer.properties.timeout_member_connect.anyOf[0]" - """ + """Backend member connection timeout in milliseconds""" timeout_member_data: Optional[int] = None - """ - '#/components/schemas/LbListenerSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.LbListenerSerializer.properties.timeout_member_data.anyOf[0]" - """ + """Backend member inactivity timeout in milliseconds""" user_list: Optional[List[UserList]] = None - """ - '#/components/schemas/LbListenerSerializer/properties/user_list' - "$.components.schemas.LbListenerSerializer.properties.user_list" - """ + """Load balancer listener users list""" diff --git a/src/gcore/types/cloud/lb_listener_list.py b/src/gcore/types/cloud/lb_listener_list.py index 70d1977e..f8f9d090 100644 --- a/src/gcore/types/cloud/lb_listener_list.py +++ b/src/gcore/types/cloud/lb_listener_list.py @@ -10,13 +10,7 @@ class LbListenerList(BaseModel): count: int - """ - '#/components/schemas/LbListenerSerializerList/properties/count' - "$.components.schemas.LbListenerSerializerList.properties.count" - """ + """Number of objects""" results: List[LbListener] - """ - '#/components/schemas/LbListenerSerializerList/properties/results' - "$.components.schemas.LbListenerSerializerList.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/lb_session_persistence.py b/src/gcore/types/cloud/lb_session_persistence.py index 00b03295..cef9929f 100644 --- a/src/gcore/types/cloud/lb_session_persistence.py +++ b/src/gcore/types/cloud/lb_session_persistence.py @@ -10,25 +10,13 @@ class LbSessionPersistence(BaseModel): type: SessionPersistenceType - """ - '#/components/schemas/LbSessionPersistence/properties/type' - "$.components.schemas.LbSessionPersistence.properties.type" - """ + """Session persistence type""" cookie_name: Optional[str] = None - """ - '#/components/schemas/LbSessionPersistence/properties/cookie_name/anyOf/0' - "$.components.schemas.LbSessionPersistence.properties.cookie_name.anyOf[0]" - """ + """Should be set if app cookie or http cookie is used""" persistence_granularity: Optional[str] = None - """ - '#/components/schemas/LbSessionPersistence/properties/persistence_granularity/anyOf/0' - "$.components.schemas.LbSessionPersistence.properties.persistence_granularity.anyOf[0]" - """ + """Subnet mask if source_ip is used. For UDP ports only""" persistence_timeout: Optional[int] = None - """ - '#/components/schemas/LbSessionPersistence/properties/persistence_timeout/anyOf/0' - "$.components.schemas.LbSessionPersistence.properties.persistence_timeout.anyOf[0]" - """ + """Session persistence timeout. For UDP ports only""" diff --git a/src/gcore/types/cloud/listener_status.py b/src/gcore/types/cloud/listener_status.py index f261f938..6d9441a1 100644 --- a/src/gcore/types/cloud/listener_status.py +++ b/src/gcore/types/cloud/listener_status.py @@ -12,31 +12,16 @@ class ListenerStatus(BaseModel): id: str - """ - '#/components/schemas/ListenerStatusSerializer/properties/id' - "$.components.schemas.ListenerStatusSerializer.properties.id" - """ + """UUID of the entity""" name: str - """ - '#/components/schemas/ListenerStatusSerializer/properties/name' - "$.components.schemas.ListenerStatusSerializer.properties.name" - """ + """Name of the load balancer listener""" operating_status: LoadBalancerOperatingStatus - """ - '#/components/schemas/ListenerStatusSerializer/properties/operating_status' - "$.components.schemas.ListenerStatusSerializer.properties.operating_status" - """ + """Operating status of the entity""" pools: List[PoolStatus] - """ - '#/components/schemas/ListenerStatusSerializer/properties/pools' - "$.components.schemas.ListenerStatusSerializer.properties.pools" - """ + """Pools of the Listeners""" provisioning_status: ProvisioningStatus - """ - '#/components/schemas/ListenerStatusSerializer/properties/provisioning_status' - "$.components.schemas.ListenerStatusSerializer.properties.provisioning_status" - """ + """Provisioning status of the entity""" diff --git a/src/gcore/types/cloud/load_balancer.py b/src/gcore/types/cloud/load_balancer.py index 6deb67af..75e5387a 100644 --- a/src/gcore/types/cloud/load_balancer.py +++ b/src/gcore/types/cloud/load_balancer.py @@ -20,213 +20,125 @@ class AdditionalVip(BaseModel): ip_address: str - """ - '#/components/schemas/NetworkPortFixedIp/properties/ip_address' - "$.components.schemas.NetworkPortFixedIp.properties.ip_address" - """ + """IP address""" subnet_id: str - """ - '#/components/schemas/NetworkPortFixedIp/properties/subnet_id' - "$.components.schemas.NetworkPortFixedIp.properties.subnet_id" - """ + """Subnet UUID""" class Flavor(BaseModel): flavor_id: str - """ - '#/components/schemas/LbFlavorSerializer/properties/flavor_id' - "$.components.schemas.LbFlavorSerializer.properties.flavor_id" - """ + """Flavor ID is the same as name""" flavor_name: str - """ - '#/components/schemas/LbFlavorSerializer/properties/flavor_name' - "$.components.schemas.LbFlavorSerializer.properties.flavor_name" - """ + """Flavor name""" ram: int - """ - '#/components/schemas/LbFlavorSerializer/properties/ram' - "$.components.schemas.LbFlavorSerializer.properties.ram" - """ + """RAM size in MiB""" vcpus: int - """ - '#/components/schemas/LbFlavorSerializer/properties/vcpus' - "$.components.schemas.LbFlavorSerializer.properties.vcpus" - """ + """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" class Listener(BaseModel): id: str - """ - '#/components/schemas/ListenerSerializer/properties/id' - "$.components.schemas.ListenerSerializer.properties.id" - """ + """Listener ID""" class VrrpIP(BaseModel): ip_address: str - """ - '#/components/schemas/VRRPIP/properties/ip_address' - "$.components.schemas.VRRPIP.properties.ip_address" - """ + """IP address""" role: LoadBalancerInstanceRole - """ - '#/components/schemas/VRRPIP/properties/role' - "$.components.schemas.VRRPIP.properties.role" - """ + """LoadBalancer instance role to which VRRP IP belong""" subnet_id: str - """ - '#/components/schemas/VRRPIP/properties/subnet_id' - "$.components.schemas.VRRPIP.properties.subnet_id" - """ + """Subnet UUID""" class LoadBalancer(BaseModel): id: str - """ - '#/components/schemas/LoadbalancerSerializer/properties/id' - "$.components.schemas.LoadbalancerSerializer.properties.id" - """ + """Load balancer ID""" created_at: datetime - """ - '#/components/schemas/LoadbalancerSerializer/properties/created_at' - "$.components.schemas.LoadbalancerSerializer.properties.created_at" - """ + """Datetime when the load balancer was created""" name: str - """ - '#/components/schemas/LoadbalancerSerializer/properties/name' - "$.components.schemas.LoadbalancerSerializer.properties.name" - """ + """Load balancer name""" operating_status: LoadBalancerOperatingStatus - """ - '#/components/schemas/LoadbalancerSerializer/properties/operating_status' - "$.components.schemas.LoadbalancerSerializer.properties.operating_status" - """ + """Load balancer operating status""" project_id: int - """ - '#/components/schemas/LoadbalancerSerializer/properties/project_id' - "$.components.schemas.LoadbalancerSerializer.properties.project_id" - """ + """Project ID""" provisioning_status: ProvisioningStatus - """ - '#/components/schemas/LoadbalancerSerializer/properties/provisioning_status' - "$.components.schemas.LoadbalancerSerializer.properties.provisioning_status" - """ + """Load balancer lifecycle status""" region: str - """ - '#/components/schemas/LoadbalancerSerializer/properties/region' - "$.components.schemas.LoadbalancerSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/LoadbalancerSerializer/properties/region_id' - "$.components.schemas.LoadbalancerSerializer.properties.region_id" - """ + """Region ID""" tags_v2: List[Tag] - """ - '#/components/schemas/LoadbalancerSerializer/properties/tags_v2' - "$.components.schemas.LoadbalancerSerializer.properties.tags_v2" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ additional_vips: Optional[List[AdditionalVip]] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/additional_vips' - "$.components.schemas.LoadbalancerSerializer.properties.additional_vips" - """ + """List of additional IP addresses""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.LoadbalancerSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" ddos_profile: Optional[DDOSProfile] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/ddos_profile/anyOf/0' - "$.components.schemas.LoadbalancerSerializer.properties.ddos_profile.anyOf[0]" - """ + """Loadbalancer advanced DDoS protection profile.""" flavor: Optional[Flavor] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/flavor/anyOf/0' - "$.components.schemas.LoadbalancerSerializer.properties.flavor.anyOf[0]" - """ + """Load balancer flavor (if not default)""" floating_ips: Optional[List[FloatingIP]] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/floating_ips' - "$.components.schemas.LoadbalancerSerializer.properties.floating_ips" - """ + """List of assigned floating IPs""" listeners: Optional[List[Listener]] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/listeners' - "$.components.schemas.LoadbalancerSerializer.properties.listeners" - """ + """Load balancer listeners""" logging: Optional[Logging] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/logging/anyOf/0' - "$.components.schemas.LoadbalancerSerializer.properties.logging.anyOf[0]" - """ + """Logging configuration""" preferred_connectivity: Optional[LoadBalancerMemberConnectivity] = None """ - '#/components/schemas/LoadbalancerSerializer/properties/preferred_connectivity' - "$.components.schemas.LoadbalancerSerializer.properties.preferred_connectivity" + Preferred option to establish connectivity between load balancer and its pools + members """ stats: Optional[LoadBalancerStatistics] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/stats/anyOf/0' - "$.components.schemas.LoadbalancerSerializer.properties.stats.anyOf[0]" - """ + """Statistics of load balancer.""" task_id: Optional[str] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/task_id/anyOf/0' - "$.components.schemas.LoadbalancerSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ updated_at: Optional[datetime] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/updated_at/anyOf/0' - "$.components.schemas.LoadbalancerSerializer.properties.updated_at.anyOf[0]" - """ + """Datetime when the load balancer was last updated""" vip_address: Optional[str] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/vip_address/anyOf/0' - "$.components.schemas.LoadbalancerSerializer.properties.vip_address.anyOf[0]" - """ + """Load balancer IP address""" vip_ip_family: Optional[InterfaceIPFamily] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/vip_ip_family/anyOf/0' - "$.components.schemas.LoadbalancerSerializer.properties.vip_ip_family.anyOf[0]" - """ + """Load balancer IP family""" vip_port_id: Optional[str] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/vip_port_id/anyOf/0' - "$.components.schemas.LoadbalancerSerializer.properties.vip_port_id.anyOf[0]" - """ + """The ID of the Virtual IP (VIP) port.""" vrrp_ips: Optional[List[VrrpIP]] = None - """ - '#/components/schemas/LoadbalancerSerializer/properties/vrrp_ips' - "$.components.schemas.LoadbalancerSerializer.properties.vrrp_ips" - """ + """List of VRRP IP addresses""" diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index fae9664d..2e9e9533 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -33,109 +33,97 @@ class LoadBalancerCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].post.parameters[1].schema" - """ flavor: str - """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/flavor' - "$.components.schemas.CreateLoadbalancerSerializer.properties.flavor" - """ + """Load balancer flavor name""" floating_ip: FloatingIP - """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/floating_ip' - "$.components.schemas.CreateLoadbalancerSerializer.properties.floating_ip" - """ + """Floating IP configuration for assignment""" listeners: Iterable[Listener] - """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/listeners' - "$.components.schemas.CreateLoadbalancerSerializer.properties.listeners" + """Load balancer listeners. + + Maximum 50 per LB (excluding Prometheus endpoint listener). """ logging: Logging - """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/logging' - "$.components.schemas.CreateLoadbalancerSerializer.properties.logging" - """ + """Logging configuration""" name: str - """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/name' - "$.components.schemas.CreateLoadbalancerSerializer.properties.name" - """ + """Load balancer name""" name_template: str - """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/name_template' - "$.components.schemas.CreateLoadbalancerSerializer.properties.name_template" - """ + """Load balancer name which will be changed by template.""" preferred_connectivity: LoadBalancerMemberConnectivity """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/preferred_connectivity' - "$.components.schemas.CreateLoadbalancerSerializer.properties.preferred_connectivity" + Preferred option to establish connectivity between load balancer and its pools + members. L2 provides best performance, L3 provides less IPs usage. It is taking + effect only if instance_id + ip_address is provided, not subnet_id + ip_address, + because we're considering this as intentional subnet_id specification. """ tags: TagUpdateListParam - """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/tags' - "$.components.schemas.CreateLoadbalancerSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. """ vip_ip_family: InterfaceIPFamily """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_ip_family' - "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_ip_family" + IP family for load balancer subnet auto-selection if vip_network_id is specified """ vip_network_id: str - """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_network_id' - "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_network_id" + """Network ID for load balancer. + + If not specified, default external network will be used. Mutually exclusive with + vip_port_id """ vip_port_id: str - """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_port_id' - "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_port_id" + """Existing Reserved Fixed IP port ID for load balancer. + + Mutually exclusive with vip_network_id """ vip_subnet_id: str - """ - '#/components/schemas/CreateLoadbalancerSerializer/properties/vip_subnet_id' - "$.components.schemas.CreateLoadbalancerSerializer.properties.vip_subnet_id" + """Subnet ID for load balancer. + + If not specified, any subnet from vip_network_id will be selected. Ignored when + vip_network_id is not specified. """ class FloatingIPNewInstanceFloatingIPInterfaceSerializer(TypedDict, total=False): source: Required[Literal["new"]] - """ - '#/components/schemas/NewInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.NewInstanceFloatingIpInterfaceSerializer.properties.source" + """A new floating IP will be created and attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ class FloatingIPExistingInstanceFloatingIPInterfaceSerializer(TypedDict, total=False): existing_floating_id: Required[str] """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/existing_floating_id' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.existing_floating_id" + An existing available floating IP id must be specified if the source is set to + `existing` """ source: Required[Literal["existing"]] - """ - '#/components/schemas/ExistingInstanceFloatingIpInterfaceSerializer/properties/source' - "$.components.schemas.ExistingInstanceFloatingIpInterfaceSerializer.properties.source" + """An existing available floating IP will be attached to the instance. + + A floating IP is a public IP that makes the instance accessible from the + internet, even if it only has a private IP. It works like SNAT, allowing + outgoing and incoming traffic. """ @@ -146,331 +134,194 @@ class FloatingIPExistingInstanceFloatingIPInterfaceSerializer(TypedDict, total=F class ListenerPoolHealthmonitor(TypedDict, total=False): delay: Required[int] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/delay' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.delay" - """ + """The time, in seconds, between sending probes to members""" max_retries: Required[int] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries" - """ + """Number of successes before the member is switched to ONLINE state""" timeout: Required[int] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/timeout' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.timeout" - """ + """The maximum time to connect. Must be less than the delay value""" type: Required[HealthMonitorType] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/type' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.type" - """ + """Health monitor type. Once health monitor is created, cannot be changed.""" expected_codes: Optional[str] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/expected_codes/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" - """ + """Can only be used together with `HTTP` or `HTTPS` health monitor type.""" http_method: Optional[HTTPMethod] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/http_method/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.http_method.anyOf[0]" + """HTTP method. + + Can only be used together with `HTTP` or `HTTPS` health monitor type. """ max_retries_down: Optional[int] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries_down/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries_down.anyOf[0]" - """ + """Number of failures before the member is switched to ERROR state.""" url_path: Optional[str] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/url_path/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.url_path.anyOf[0]" + """URL Path. + + Defaults to '/'. Can only be used together with `HTTP` or `HTTPS` health monitor + type. """ class ListenerPoolMember(TypedDict, total=False): address: Required[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/address' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.address" - """ + """Member IP address""" protocol_port: Required[int] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/protocol_port' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.protocol_port" - """ + """Member IP port""" admin_state_up: Optional[bool] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/admin_state_up/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.admin_state_up.anyOf[0]" - """ + """true if enabled. Defaults to true""" instance_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/instance_id/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.instance_id.anyOf[0]" - """ + """Either subnet_id or instance_id should be provided""" monitor_address: Optional[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_address/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" + """An alternate IP address used for health monitoring of a backend member. + + Default is null which monitors the member address. """ monitor_port: Optional[int] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_port/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" + """An alternate protocol port used for health monitoring of a backend member. + + Default is null which monitors the member protocol_port. """ subnet_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/subnet_id/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" - """ + """Either subnet_id or instance_id should be provided""" weight: Optional[int] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/weight/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.weight.anyOf[0]" - """ + """Member weight. Valid values: 0 to 256, defaults to 1""" class ListenerPoolSessionPersistence(TypedDict, total=False): type: Required[SessionPersistenceType] - """ - '#/components/schemas/MutateLbSessionPersistence/properties/type' - "$.components.schemas.MutateLbSessionPersistence.properties.type" - """ + """Session persistence type""" cookie_name: Optional[str] - """ - '#/components/schemas/MutateLbSessionPersistence/properties/cookie_name/anyOf/0' - "$.components.schemas.MutateLbSessionPersistence.properties.cookie_name.anyOf[0]" - """ + """Should be set if app cookie or http cookie is used""" persistence_granularity: Optional[str] - """ - '#/components/schemas/MutateLbSessionPersistence/properties/persistence_granularity/anyOf/0' - "$.components.schemas.MutateLbSessionPersistence.properties.persistence_granularity.anyOf[0]" - """ + """Subnet mask if source_ip is used. For UDP ports only""" persistence_timeout: Optional[int] - """ - '#/components/schemas/MutateLbSessionPersistence/properties/persistence_timeout/anyOf/0' - "$.components.schemas.MutateLbSessionPersistence.properties.persistence_timeout.anyOf[0]" - """ + """Session persistence timeout. For UDP ports only""" class ListenerPool(TypedDict, total=False): lb_algorithm: Required[LbAlgorithm] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/lb_algorithm' - "$.components.schemas.CreateLbPoolSerializer.properties.lb_algorithm" - """ + """Load balancer algorithm""" name: Required[str] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/name' - "$.components.schemas.CreateLbPoolSerializer.properties.name" - """ + """Pool name""" protocol: Required[LbPoolProtocol] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/protocol' - "$.components.schemas.CreateLbPoolSerializer.properties.protocol" - """ + """Protocol""" ca_secret_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/ca_secret_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.ca_secret_id.anyOf[0]" - """ + """Secret ID of CA certificate bundle""" crl_secret_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/crl_secret_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.crl_secret_id.anyOf[0]" - """ + """Secret ID of CA revocation list file""" healthmonitor: Optional[ListenerPoolHealthmonitor] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/healthmonitor/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.healthmonitor.anyOf[0]" - """ + """Health monitor details""" listener_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/listener_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.listener_id.anyOf[0]" - """ + """Listener ID""" loadbalancer_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/loadbalancer_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.loadbalancer_id.anyOf[0]" - """ + """Loadbalancer ID""" members: Optional[Iterable[ListenerPoolMember]] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/members/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.members.anyOf[0]" - """ + """Pool members""" secret_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.secret_id.anyOf[0]" - """ + """Secret ID for TLS client authentication to the member servers""" session_persistence: Optional[ListenerPoolSessionPersistence] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/session_persistence/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.session_persistence.anyOf[0]" - """ + """Session persistence details""" timeout_client_data: Optional[int] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.timeout_client_data.anyOf[0]" - """ + """Frontend client inactivity timeout in milliseconds""" timeout_member_connect: Optional[int] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" - """ + """Backend member connection timeout in milliseconds""" timeout_member_data: Optional[int] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_data.anyOf[0]" - """ + """Backend member inactivity timeout in milliseconds""" class ListenerUserList(TypedDict, total=False): encrypted_password: Required[str] - """ - '#/components/schemas/UserListItem/properties/encrypted_password' - "$.components.schemas.UserListItem.properties.encrypted_password" - """ + """Encrypted password to auth via Basic Authentication""" username: Required[str] - """ - '#/components/schemas/UserListItem/properties/username' - "$.components.schemas.UserListItem.properties.username" - """ + """Username to auth via Basic Authentication""" class Listener(TypedDict, total=False): name: Required[str] - """ - '#/components/schemas/CreateListenerSerializer/properties/name' - "$.components.schemas.CreateListenerSerializer.properties.name" - """ + """Load balancer listener name""" protocol: Required[LbListenerProtocol] - """ - '#/components/schemas/CreateListenerSerializer/properties/protocol' - "$.components.schemas.CreateListenerSerializer.properties.protocol" - """ + """Load balancer listener protocol""" protocol_port: Required[int] - """ - '#/components/schemas/CreateListenerSerializer/properties/protocol_port' - "$.components.schemas.CreateListenerSerializer.properties.protocol_port" - """ + """Protocol port""" allowed_cidrs: Optional[List[str]] - """ - '#/components/schemas/CreateListenerSerializer/properties/allowed_cidrs/anyOf/0' - "$.components.schemas.CreateListenerSerializer.properties.allowed_cidrs.anyOf[0]" - """ + """Network CIDRs from which service will be accessible""" connection_limit: int - """ - '#/components/schemas/CreateListenerSerializer/properties/connection_limit' - "$.components.schemas.CreateListenerSerializer.properties.connection_limit" - """ + """Limit of the simultaneous connections""" insert_x_forwarded: bool - """ - '#/components/schemas/CreateListenerSerializer/properties/insert_x_forwarded' - "$.components.schemas.CreateListenerSerializer.properties.insert_x_forwarded" + """Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. + + Only used with HTTP or TERMINATED_HTTPS protocols. """ pools: Iterable[ListenerPool] - """ - '#/components/schemas/CreateListenerSerializer/properties/pools' - "$.components.schemas.CreateListenerSerializer.properties.pools" - """ + """Member pools""" secret_id: str """ - '#/components/schemas/CreateListenerSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.CreateListenerSerializer.properties.secret_id.anyOf[0]" + ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS + listener """ sni_secret_id: List[str] """ - '#/components/schemas/CreateListenerSerializer/properties/sni_secret_id' - "$.components.schemas.CreateListenerSerializer.properties.sni_secret_id" + List of secrets IDs containing PKCS12 format certificate/key bundles for + TERMINATED_HTTPS or PROMETHEUS listeners """ timeout_client_data: Optional[int] - """ - '#/components/schemas/CreateListenerSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.CreateListenerSerializer.properties.timeout_client_data.anyOf[0]" - """ + """Frontend client inactivity timeout in milliseconds""" timeout_member_connect: Optional[int] - """ - '#/components/schemas/CreateListenerSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.CreateListenerSerializer.properties.timeout_member_connect.anyOf[0]" - """ + """Backend member connection timeout in milliseconds""" timeout_member_data: Optional[int] - """ - '#/components/schemas/CreateListenerSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.CreateListenerSerializer.properties.timeout_member_data.anyOf[0]" - """ + """Backend member inactivity timeout in milliseconds""" user_list: Iterable[ListenerUserList] - """ - '#/components/schemas/CreateListenerSerializer/properties/user_list' - "$.components.schemas.CreateListenerSerializer.properties.user_list" - """ + """Load balancer listener list of username and encrypted password items""" class Logging(TypedDict, total=False): destination_region_id: Optional[int] - """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/destination_region_id/anyOf/0' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.destination_region_id.anyOf[0]" - """ + """Destination region id to which the logs will be written""" enabled: bool - """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/enabled' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.enabled" - """ + """Enable/disable forwarding logs to LaaS""" retention_policy: Optional[LaasIndexRetentionPolicyParam] - """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/retention_policy/anyOf/0' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.retention_policy.anyOf[0]" - """ + """The logs retention policy""" topic_name: Optional[str] - """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/topic_name/anyOf/0' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.topic_name.anyOf[0]" - """ + """The topic name to which the logs will be written""" diff --git a/src/gcore/types/cloud/load_balancer_failover_params.py b/src/gcore/types/cloud/load_balancer_failover_params.py index 082cc6bc..b4a727a7 100644 --- a/src/gcore/types/cloud/load_balancer_failover_params.py +++ b/src/gcore/types/cloud/load_balancer_failover_params.py @@ -9,19 +9,8 @@ class LoadBalancerFailoverParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Ffailover/post/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover'].post.parameters[1].schema" - """ force: bool - """ - '#/components/schemas/FailoverLoadBalancer/properties/force' - "$.components.schemas.FailoverLoadBalancer.properties.force" - """ + """Validate current load balancer status before failover or not.""" diff --git a/src/gcore/types/cloud/load_balancer_get_params.py b/src/gcore/types/cloud/load_balancer_get_params.py index a1fbb78f..233a6f3e 100644 --- a/src/gcore/types/cloud/load_balancer_get_params.py +++ b/src/gcore/types/cloud/load_balancer_get_params.py @@ -9,25 +9,11 @@ class LoadBalancerGetParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[1].schema" - """ show_stats: bool - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/3' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[3]" - """ + """Show statistics""" with_ddos: bool - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/get/parameters/4' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].get.parameters[4]" - """ + """Show DDoS profile""" diff --git a/src/gcore/types/cloud/load_balancer_list_params.py b/src/gcore/types/cloud/load_balancer_list_params.py index 52369863..94fe2169 100644 --- a/src/gcore/types/cloud/load_balancer_list_params.py +++ b/src/gcore/types/cloud/load_balancer_list_params.py @@ -10,73 +10,44 @@ class LoadBalancerListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[1].schema" - """ assigned_floating: bool - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[2]" - """ + """With or without assigned floating IP""" limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[3]" - """ + """Limit the number of returned limit request entities.""" logging_enabled: bool - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[4]" - """ + """With or without logging""" name: str - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[5]" - """ + """Filter by name""" offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[6]" - """ + """Offset value is used to exclude the first set of records from the result.""" order_by: str """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[7]" + Ordering Load Balancer list result by name, created_at, updated_at, + operating_status, provisioning_status, vip_address, vip_ip_family and flavor + fields of the load balancer and directions (name.asc), default is + "created_at.asc" """ show_stats: bool - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[8]" - """ + """Show statistics""" tag_key: List[str] - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[9]" - """ + """Filter by tag keys.""" tag_key_value: str - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[10]" + """Filter by tag key-value pairs. + + Must be a valid JSON string. curl -G --data-urlencode "tag_key_value={"key": + "value"}" --url "http://localhost:1111/v1/loadbalancers/1/1" """ with_ddos: bool - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}'].get.parameters[11]" - """ + """Show Advanced DDoS protection profile, if exists""" diff --git a/src/gcore/types/cloud/load_balancer_resize_params.py b/src/gcore/types/cloud/load_balancer_resize_params.py index 56d120ff..05055dfe 100644 --- a/src/gcore/types/cloud/load_balancer_resize_params.py +++ b/src/gcore/types/cloud/load_balancer_resize_params.py @@ -9,19 +9,8 @@ class LoadBalancerResizeParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fresize/post/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize'].post.parameters[1].schema" - """ flavor: Required[str] - """ - '#/components/schemas/ResizeLoadBalancer/properties/flavor' - "$.components.schemas.ResizeLoadBalancer.properties.flavor" - """ + """Name of the desired flavor to resize to.""" diff --git a/src/gcore/types/cloud/load_balancer_statistics.py b/src/gcore/types/cloud/load_balancer_statistics.py index d4508aaa..903a605a 100644 --- a/src/gcore/types/cloud/load_balancer_statistics.py +++ b/src/gcore/types/cloud/load_balancer_statistics.py @@ -7,31 +7,16 @@ class LoadBalancerStatistics(BaseModel): active_connections: int - """ - '#/components/schemas/LoadbalancerStatsSerializer/properties/active_connections' - "$.components.schemas.LoadbalancerStatsSerializer.properties.active_connections" - """ + """Currently active connections""" bytes_in: int - """ - '#/components/schemas/LoadbalancerStatsSerializer/properties/bytes_in' - "$.components.schemas.LoadbalancerStatsSerializer.properties.bytes_in" - """ + """Total bytes received""" bytes_out: int - """ - '#/components/schemas/LoadbalancerStatsSerializer/properties/bytes_out' - "$.components.schemas.LoadbalancerStatsSerializer.properties.bytes_out" - """ + """Total bytes sent""" request_errors: int - """ - '#/components/schemas/LoadbalancerStatsSerializer/properties/request_errors' - "$.components.schemas.LoadbalancerStatsSerializer.properties.request_errors" - """ + """Total requests that were unable to be fulfilled""" total_connections: int - """ - '#/components/schemas/LoadbalancerStatsSerializer/properties/total_connections' - "$.components.schemas.LoadbalancerStatsSerializer.properties.total_connections" - """ + """Total connections handled""" diff --git a/src/gcore/types/cloud/load_balancer_status.py b/src/gcore/types/cloud/load_balancer_status.py index be7acf50..9560af29 100644 --- a/src/gcore/types/cloud/load_balancer_status.py +++ b/src/gcore/types/cloud/load_balancer_status.py @@ -13,37 +13,26 @@ class LoadBalancerStatus(BaseModel): id: str - """ - '#/components/schemas/LoadBalancerStatusSerializer/properties/id' - "$.components.schemas.LoadBalancerStatusSerializer.properties.id" - """ + """UUID of the entity""" listeners: List[ListenerStatus] - """ - '#/components/schemas/LoadBalancerStatusSerializer/properties/listeners' - "$.components.schemas.LoadBalancerStatusSerializer.properties.listeners" - """ + """Listeners of the Load Balancer""" name: str - """ - '#/components/schemas/LoadBalancerStatusSerializer/properties/name' - "$.components.schemas.LoadBalancerStatusSerializer.properties.name" - """ + """Name of the load balancer""" operating_status: LoadBalancerOperatingStatus - """ - '#/components/schemas/LoadBalancerStatusSerializer/properties/operating_status' - "$.components.schemas.LoadBalancerStatusSerializer.properties.operating_status" - """ + """Operating status of the entity""" provisioning_status: ProvisioningStatus - """ - '#/components/schemas/LoadBalancerStatusSerializer/properties/provisioning_status' - "$.components.schemas.LoadBalancerStatusSerializer.properties.provisioning_status" - """ + """Provisioning status of the entity""" tags: Optional[List[Tag]] = None - """ - '#/components/schemas/LoadBalancerStatusSerializer/properties/tags' - "$.components.schemas.LoadBalancerStatusSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ diff --git a/src/gcore/types/cloud/load_balancer_status_list.py b/src/gcore/types/cloud/load_balancer_status_list.py index bffb1b35..0432a12c 100644 --- a/src/gcore/types/cloud/load_balancer_status_list.py +++ b/src/gcore/types/cloud/load_balancer_status_list.py @@ -10,13 +10,7 @@ class LoadBalancerStatusList(BaseModel): count: int - """ - '#/components/schemas/LoadBalancerStatusSerializerList/properties/count' - "$.components.schemas.LoadBalancerStatusSerializerList.properties.count" - """ + """Number of objects""" results: List[LoadBalancerStatus] - """ - '#/components/schemas/LoadBalancerStatusSerializerList/properties/results' - "$.components.schemas.LoadBalancerStatusSerializerList.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py index b5bb50ae..9b7653fe 100644 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -13,57 +13,31 @@ class LoadBalancerUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}'].patch.parameters[1].schema" - """ logging: Logging - """ - '#/components/schemas/LoadBalancerPatchSerializer/properties/logging' - "$.components.schemas.LoadBalancerPatchSerializer.properties.logging" - """ + """Logging configuration""" name: str - """ - '#/components/schemas/LoadBalancerPatchSerializer/properties/name' - "$.components.schemas.LoadBalancerPatchSerializer.properties.name" - """ + """Name.""" preferred_connectivity: LoadBalancerMemberConnectivity """ - '#/components/schemas/LoadBalancerPatchSerializer/properties/preferred_connectivity' - "$.components.schemas.LoadBalancerPatchSerializer.properties.preferred_connectivity" + Preferred option to establish connectivity between load balancer and its pools + members """ class Logging(TypedDict, total=False): destination_region_id: Optional[int] - """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/destination_region_id/anyOf/0' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.destination_region_id.anyOf[0]" - """ + """Destination region id to which the logs will be written""" enabled: bool - """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/enabled' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.enabled" - """ + """Enable/disable forwarding logs to LaaS""" retention_policy: Optional[LaasIndexRetentionPolicyParam] - """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/retention_policy/anyOf/0' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.retention_policy.anyOf[0]" - """ + """The logs retention policy""" topic_name: Optional[str] - """ - '#/components/schemas/LoadbalancerLoggingSerializer/properties/topic_name/anyOf/0' - "$.components.schemas.LoadbalancerLoggingSerializer.properties.topic_name.anyOf[0]" - """ + """The topic name to which the logs will be written""" diff --git a/src/gcore/types/cloud/load_balancers/flavor_list_params.py b/src/gcore/types/cloud/load_balancers/flavor_list_params.py index 33984f0e..4db3ee38 100644 --- a/src/gcore/types/cloud/load_balancers/flavor_list_params.py +++ b/src/gcore/types/cloud/load_balancers/flavor_list_params.py @@ -9,19 +9,8 @@ class FlavorListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[1].schema" - """ include_prices: bool - """ - '#/paths/%2Fcloud%2Fv1%2Flbflavors%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/lbflavors/{project_id}/{region_id}'].get.parameters[2]" - """ + """Set to true if the response should include flavor prices""" 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 c2f153b5..c7209f66 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 @@ -10,22 +10,11 @@ class RuleCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules/post/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules'].post.parameters[1].schema" - """ compare_type: Required[Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"]] - """ - '#/components/schemas/CreateL7RuleSchema/properties/compare_type' - "$.components.schemas.CreateL7RuleSchema.properties.compare_type" - """ + """The comparison type for the L7 rule""" type: Required[ Literal[ @@ -39,31 +28,23 @@ class RuleCreateParams(TypedDict, total=False): "SSL_VERIFY_RESULT", ] ] - """ - '#/components/schemas/CreateL7RuleSchema/properties/type' - "$.components.schemas.CreateL7RuleSchema.properties.type" - """ + """The L7 rule type""" value: Required[str] - """ - '#/components/schemas/CreateL7RuleSchema/properties/value' - "$.components.schemas.CreateL7RuleSchema.properties.value" - """ + """The value to use for the comparison. For example, the file type to compare""" invert: bool - """ - '#/components/schemas/CreateL7RuleSchema/properties/invert' - "$.components.schemas.CreateL7RuleSchema.properties.invert" + """When true the logic of the rule is inverted. + + For example, with invert true, 'equal to' would become 'not equal to'. Default + is false. """ key: str - """ - '#/components/schemas/CreateL7RuleSchema/properties/key' - "$.components.schemas.CreateL7RuleSchema.properties.key" + """The key to use for the comparison. + + For example, the name of the cookie to evaluate. """ tags: List[str] - """ - '#/components/schemas/CreateL7RuleSchema/properties/tags' - "$.components.schemas.CreateL7RuleSchema.properties.tags" - """ + """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 f10f5f1c..f2c7004b 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 @@ -10,57 +10,34 @@ class RuleReplaceParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[1].schema" - """ l7policy_id: Required[str] - """ - '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D%2Frules%2F%7Bl7rule_id%7D/put/parameters/2/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}'].put.parameters[2].schema" - """ compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] - """ - '#/components/schemas/UpdateL7RuleSchema/properties/compare_type' - "$.components.schemas.UpdateL7RuleSchema.properties.compare_type" - """ + """The comparison type for the L7 rule""" invert: bool - """ - '#/components/schemas/UpdateL7RuleSchema/properties/invert' - "$.components.schemas.UpdateL7RuleSchema.properties.invert" + """When true the logic of the rule is inverted. + + For example, with invert true, 'equal to' would become 'not equal to'. Default + is false. """ key: str - """ - '#/components/schemas/UpdateL7RuleSchema/properties/key' - "$.components.schemas.UpdateL7RuleSchema.properties.key" + """The key to use for the comparison. + + For example, the name of the cookie to evaluate. """ tags: List[str] - """ - '#/components/schemas/UpdateL7RuleSchema/properties/tags' - "$.components.schemas.UpdateL7RuleSchema.properties.tags" - """ + """A list of simple strings assigned to the l7 rule""" type: Literal[ "COOKIE", "FILE_TYPE", "HEADER", "HOST_NAME", "PATH", "SSL_CONN_HAS_CERT", "SSL_DN_FIELD", "SSL_VERIFY_RESULT" ] - """ - '#/components/schemas/UpdateL7RuleSchema/properties/type' - "$.components.schemas.UpdateL7RuleSchema.properties.type" - """ + """The L7 rule type""" value: str - """ - '#/components/schemas/UpdateL7RuleSchema/properties/value' - "$.components.schemas.UpdateL7RuleSchema.properties.value" - """ + """The value to use for the comparison. For example, the file type to compare""" diff --git a/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py b/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py index 200ae529..390b0f1b 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py +++ b/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py @@ -10,67 +10,45 @@ class L7PolicyCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}'].post.parameters[1].schema" - """ action: Required[Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"]] - """ - '#/components/schemas/CreateL7PolicySchema/properties/action' - "$.components.schemas.CreateL7PolicySchema.properties.action" - """ + """Action""" listener_id: Required[str] - """ - '#/components/schemas/CreateL7PolicySchema/properties/listener_id' - "$.components.schemas.CreateL7PolicySchema.properties.listener_id" - """ + """Listener ID""" name: str - """ - '#/components/schemas/CreateL7PolicySchema/properties/name' - "$.components.schemas.CreateL7PolicySchema.properties.name" - """ + """Human-readable name of the policy""" position: int - """ - '#/components/schemas/CreateL7PolicySchema/properties/position' - "$.components.schemas.CreateL7PolicySchema.properties.position" - """ + """The position of this policy on the listener. Positions start at 1.""" redirect_http_code: int """ - '#/components/schemas/CreateL7PolicySchema/properties/redirect_http_code' - "$.components.schemas.CreateL7PolicySchema.properties.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. """ redirect_pool_id: str - """ - '#/components/schemas/CreateL7PolicySchema/properties/redirect_pool_id' - "$.components.schemas.CreateL7PolicySchema.properties.redirect_pool_id" + """Requests matching this policy will be redirected to the pool withthis ID. + + Only valid if action is REDIRECT_TO_POOL. """ redirect_prefix: str - """ - '#/components/schemas/CreateL7PolicySchema/properties/redirect_prefix' - "$.components.schemas.CreateL7PolicySchema.properties.redirect_prefix" + """Requests matching this policy will be redirected to this Prefix URL. + + Only valid if action is REDIRECT_PREFIX. """ redirect_url: str - """ - '#/components/schemas/CreateL7PolicySchema/properties/redirect_url' - "$.components.schemas.CreateL7PolicySchema.properties.redirect_url" + """Requests matching this policy will be redirected to this URL. + + Only valid if action is REDIRECT_TO_URL. """ tags: List[str] - """ - '#/components/schemas/CreateL7PolicySchema/properties/tags' - "$.components.schemas.CreateL7PolicySchema.properties.tags" - """ + """A list of simple strings assigned to the resource.""" 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 index 2e7d436a..bd35a28c 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py +++ b/src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py @@ -10,61 +10,42 @@ class L7PolicyReplaceParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/0/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fl7policies%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bl7policy_id%7D/put/parameters/1/schema' - "$.paths['/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}'].put.parameters[1].schema" - """ action: Required[Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"]] - """ - '#/components/schemas/UpdateL7PolicySchema/properties/action' - "$.components.schemas.UpdateL7PolicySchema.properties.action" - """ + """Action""" name: str - """ - '#/components/schemas/UpdateL7PolicySchema/properties/name' - "$.components.schemas.UpdateL7PolicySchema.properties.name" - """ + """Human-readable name of the policy""" position: int - """ - '#/components/schemas/UpdateL7PolicySchema/properties/position' - "$.components.schemas.UpdateL7PolicySchema.properties.position" - """ + """The position of this policy on the listener. Positions start at 1.""" redirect_http_code: int """ - '#/components/schemas/UpdateL7PolicySchema/properties/redirect_http_code' - "$.components.schemas.UpdateL7PolicySchema.properties.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. """ redirect_pool_id: str - """ - '#/components/schemas/UpdateL7PolicySchema/properties/redirect_pool_id' - "$.components.schemas.UpdateL7PolicySchema.properties.redirect_pool_id" + """Requests matching this policy will be redirected to the pool with this ID. + + Only valid if action is REDIRECT_TO_POOL. """ redirect_prefix: str - """ - '#/components/schemas/UpdateL7PolicySchema/properties/redirect_prefix' - "$.components.schemas.UpdateL7PolicySchema.properties.redirect_prefix" + """Requests matching this policy will be redirected to this Prefix URL. + + Only valid if action is REDIRECT_PREFIX. """ redirect_url: str - """ - '#/components/schemas/UpdateL7PolicySchema/properties/redirect_url' - "$.components.schemas.UpdateL7PolicySchema.properties.redirect_url" + """Requests matching this policy will be redirected to this URL. + + Only valid if action is REDIRECT_TO_URL. """ tags: List[str] - """ - '#/components/schemas/UpdateL7PolicySchema/properties/tags' - "$.components.schemas.UpdateL7PolicySchema.properties.tags" - """ + """A list of simple strings assigned to the resource.""" diff --git a/src/gcore/types/cloud/load_balancers/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py index fbec7d1f..903e4330 100644 --- a/src/gcore/types/cloud/load_balancers/listener_create_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -12,105 +12,61 @@ class ListenerCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].post.parameters[1].schema" - """ loadbalancer_id: Required[str] - """ - '#/components/schemas/CreateLbListenerSerializer/properties/loadbalancer_id' - "$.components.schemas.CreateLbListenerSerializer.properties.loadbalancer_id" - """ + """Load balancer ID""" name: Required[str] - """ - '#/components/schemas/CreateLbListenerSerializer/properties/name' - "$.components.schemas.CreateLbListenerSerializer.properties.name" - """ + """Load balancer listener name""" protocol: Required[LbListenerProtocol] - """ - '#/components/schemas/CreateLbListenerSerializer/properties/protocol' - "$.components.schemas.CreateLbListenerSerializer.properties.protocol" - """ + """Load balancer listener protocol""" protocol_port: Required[int] - """ - '#/components/schemas/CreateLbListenerSerializer/properties/protocol_port' - "$.components.schemas.CreateLbListenerSerializer.properties.protocol_port" - """ + """Protocol port""" allowed_cidrs: Optional[List[str]] - """ - '#/components/schemas/CreateLbListenerSerializer/properties/allowed_cidrs/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.allowed_cidrs.anyOf[0]" - """ + """Network CIDRs from which service will be accessible""" connection_limit: int - """ - '#/components/schemas/CreateLbListenerSerializer/properties/connection_limit' - "$.components.schemas.CreateLbListenerSerializer.properties.connection_limit" - """ + """Limit of the simultaneous connections""" insert_x_forwarded: bool - """ - '#/components/schemas/CreateLbListenerSerializer/properties/insert_x_forwarded' - "$.components.schemas.CreateLbListenerSerializer.properties.insert_x_forwarded" + """Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. + + Only used with HTTP or TERMINATED_HTTPS protocols. """ secret_id: str """ - '#/components/schemas/CreateLbListenerSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.secret_id.anyOf[0]" + ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS + listener """ sni_secret_id: List[str] """ - '#/components/schemas/CreateLbListenerSerializer/properties/sni_secret_id' - "$.components.schemas.CreateLbListenerSerializer.properties.sni_secret_id" + List of secrets IDs containing PKCS12 format certificate/key bundles for + TERMINATED_HTTPS or PROMETHEUS listeners """ timeout_client_data: Optional[int] - """ - '#/components/schemas/CreateLbListenerSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.timeout_client_data.anyOf[0]" - """ + """Frontend client inactivity timeout in milliseconds""" timeout_member_connect: Optional[int] - """ - '#/components/schemas/CreateLbListenerSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.timeout_member_connect.anyOf[0]" - """ + """Backend member connection timeout in milliseconds""" timeout_member_data: Optional[int] - """ - '#/components/schemas/CreateLbListenerSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.CreateLbListenerSerializer.properties.timeout_member_data.anyOf[0]" - """ + """Backend member inactivity timeout in milliseconds""" user_list: Iterable[UserList] - """ - '#/components/schemas/CreateLbListenerSerializer/properties/user_list' - "$.components.schemas.CreateLbListenerSerializer.properties.user_list" - """ + """Load balancer listener list of username and encrypted password items""" class UserList(TypedDict, total=False): encrypted_password: Required[str] - """ - '#/components/schemas/UserListItem/properties/encrypted_password' - "$.components.schemas.UserListItem.properties.encrypted_password" - """ + """Encrypted password to auth via Basic Authentication""" username: Required[str] - """ - '#/components/schemas/UserListItem/properties/username' - "$.components.schemas.UserListItem.properties.username" - """ + """Username to auth via Basic Authentication""" diff --git a/src/gcore/types/cloud/load_balancers/listener_get_params.py b/src/gcore/types/cloud/load_balancers/listener_get_params.py index 0e6f88e6..798a60c7 100644 --- a/src/gcore/types/cloud/load_balancers/listener_get_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_get_params.py @@ -9,19 +9,8 @@ class ListenerGetParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[1].schema" - """ show_stats: bool - """ - '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/get/parameters/3' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}'].get.parameters[3]" - """ + """Show statistics""" diff --git a/src/gcore/types/cloud/load_balancers/listener_list_params.py b/src/gcore/types/cloud/load_balancers/listener_list_params.py index 7b4dfa8e..1d76944b 100644 --- a/src/gcore/types/cloud/load_balancers/listener_list_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_list_params.py @@ -9,25 +9,11 @@ class ListenerListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[1].schema" - """ loadbalancer_id: str - """ - '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[2]" - """ + """Load balancer ID""" show_stats: bool - """ - '#/paths/%2Fcloud%2Fv1%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/lblisteners/{project_id}/{region_id}'].get.parameters[3]" - """ + """Show statistics""" diff --git a/src/gcore/types/cloud/load_balancers/listener_update_params.py b/src/gcore/types/cloud/load_balancers/listener_update_params.py index 3af906be..62517db0 100644 --- a/src/gcore/types/cloud/load_balancers/listener_update_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_update_params.py @@ -10,81 +10,46 @@ class ListenerUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Flblisteners%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Blistener_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}'].patch.parameters[1].schema" - """ allowed_cidrs: Optional[List[str]] - """ - '#/components/schemas/PatchLbListenerSerializer/properties/allowed_cidrs/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.allowed_cidrs.anyOf[0]" - """ + """Network CIDRs from which service will be accessible""" connection_limit: int - """ - '#/components/schemas/PatchLbListenerSerializer/properties/connection_limit' - "$.components.schemas.PatchLbListenerSerializer.properties.connection_limit" - """ + """Limit of simultaneous connections""" name: str - """ - '#/components/schemas/PatchLbListenerSerializer/properties/name' - "$.components.schemas.PatchLbListenerSerializer.properties.name" - """ + """Load balancer listener name""" secret_id: Optional[str] """ - '#/components/schemas/PatchLbListenerSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.secret_id.anyOf[0]" + ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS + load balancer """ sni_secret_id: Optional[List[str]] """ - '#/components/schemas/PatchLbListenerSerializer/properties/sni_secret_id/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.sni_secret_id.anyOf[0]" + List of secret's ID containing PKCS12 format certificate/key bundfles for + TERMINATED_HTTPS or PROMETHEUS listeners """ timeout_client_data: Optional[int] - """ - '#/components/schemas/PatchLbListenerSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.timeout_client_data.anyOf[0]" - """ + """Frontend client inactivity timeout in milliseconds""" timeout_member_connect: Optional[int] - """ - '#/components/schemas/PatchLbListenerSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.timeout_member_connect.anyOf[0]" - """ + """Backend member connection timeout in milliseconds""" timeout_member_data: Optional[int] - """ - '#/components/schemas/PatchLbListenerSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.timeout_member_data.anyOf[0]" - """ + """Backend member inactivity timeout in milliseconds""" user_list: Optional[Iterable[UserList]] - """ - '#/components/schemas/PatchLbListenerSerializer/properties/user_list/anyOf/0' - "$.components.schemas.PatchLbListenerSerializer.properties.user_list.anyOf[0]" - """ + """Load balancer listener users list""" class UserList(TypedDict, total=False): encrypted_password: Required[str] - """ - '#/components/schemas/UserListItem/properties/encrypted_password' - "$.components.schemas.UserListItem.properties.encrypted_password" - """ + """Encrypted password to auth via Basic Authentication""" username: Required[str] - """ - '#/components/schemas/UserListItem/properties/username' - "$.components.schemas.UserListItem.properties.username" - """ + """Username to auth via Basic Authentication""" diff --git a/src/gcore/types/cloud/load_balancers/metric_list_params.py b/src/gcore/types/cloud/load_balancers/metric_list_params.py index 1ac365c8..4af5e414 100644 --- a/src/gcore/types/cloud/load_balancers/metric_list_params.py +++ b/src/gcore/types/cloud/load_balancers/metric_list_params.py @@ -11,25 +11,11 @@ class MetricListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/0/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Floadbalancers%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bloadbalancer_id%7D%2Fmetrics/post/parameters/1/schema' - "$.paths['/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics'].post.parameters[1].schema" - """ time_interval: Required[int] - """ - '#/components/schemas/LoadbalancerMetricsRequestSerializer/properties/time_interval' - "$.components.schemas.LoadbalancerMetricsRequestSerializer.properties.time_interval" - """ + """Time interval""" time_unit: Required[InstanceMetricsTimeUnit] - """ - '#/components/schemas/LoadbalancerMetricsRequestSerializer/properties/time_unit' - "$.components.schemas.LoadbalancerMetricsRequestSerializer.properties.time_unit" - """ + """Time interval unit""" 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 e5637629..66b20932 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -16,223 +16,126 @@ class PoolCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].post.parameters[1].schema" - """ lb_algorithm: Required[LbAlgorithm] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/lb_algorithm' - "$.components.schemas.CreateLbPoolSerializer.properties.lb_algorithm" - """ + """Load balancer algorithm""" name: Required[str] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/name' - "$.components.schemas.CreateLbPoolSerializer.properties.name" - """ + """Pool name""" protocol: Required[LbPoolProtocol] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/protocol' - "$.components.schemas.CreateLbPoolSerializer.properties.protocol" - """ + """Protocol""" ca_secret_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/ca_secret_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.ca_secret_id.anyOf[0]" - """ + """Secret ID of CA certificate bundle""" crl_secret_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/crl_secret_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.crl_secret_id.anyOf[0]" - """ + """Secret ID of CA revocation list file""" healthmonitor: Optional[Healthmonitor] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/healthmonitor/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.healthmonitor.anyOf[0]" - """ + """Health monitor details""" listener_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/listener_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.listener_id.anyOf[0]" - """ + """Listener ID""" loadbalancer_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/loadbalancer_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.loadbalancer_id.anyOf[0]" - """ + """Loadbalancer ID""" members: Optional[Iterable[Member]] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/members/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.members.anyOf[0]" - """ + """Pool members""" secret_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.secret_id.anyOf[0]" - """ + """Secret ID for TLS client authentication to the member servers""" session_persistence: Optional[SessionPersistence] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/session_persistence/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.session_persistence.anyOf[0]" - """ + """Session persistence details""" timeout_client_data: Optional[int] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.timeout_client_data.anyOf[0]" - """ + """Frontend client inactivity timeout in milliseconds""" timeout_member_connect: Optional[int] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" - """ + """Backend member connection timeout in milliseconds""" timeout_member_data: Optional[int] - """ - '#/components/schemas/CreateLbPoolSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.CreateLbPoolSerializer.properties.timeout_member_data.anyOf[0]" - """ + """Backend member inactivity timeout in milliseconds""" class Healthmonitor(TypedDict, total=False): delay: Required[int] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/delay' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.delay" - """ + """The time, in seconds, between sending probes to members""" max_retries: Required[int] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries" - """ + """Number of successes before the member is switched to ONLINE state""" timeout: Required[int] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/timeout' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.timeout" - """ + """The maximum time to connect. Must be less than the delay value""" type: Required[HealthMonitorType] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/type' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.type" - """ + """Health monitor type. Once health monitor is created, cannot be changed.""" expected_codes: Optional[str] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/expected_codes/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" - """ + """Can only be used together with `HTTP` or `HTTPS` health monitor type.""" http_method: Optional[HTTPMethod] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/http_method/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.http_method.anyOf[0]" + """HTTP method. + + Can only be used together with `HTTP` or `HTTPS` health monitor type. """ max_retries_down: Optional[int] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries_down/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries_down.anyOf[0]" - """ + """Number of failures before the member is switched to ERROR state.""" url_path: Optional[str] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/url_path/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.url_path.anyOf[0]" + """URL Path. + + Defaults to '/'. Can only be used together with `HTTP` or `HTTPS` health monitor + type. """ class Member(TypedDict, total=False): address: Required[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/address' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.address" - """ + """Member IP address""" protocol_port: Required[int] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/protocol_port' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.protocol_port" - """ + """Member IP port""" admin_state_up: Optional[bool] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/admin_state_up/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.admin_state_up.anyOf[0]" - """ + """true if enabled. Defaults to true""" instance_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/instance_id/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.instance_id.anyOf[0]" - """ + """Either subnet_id or instance_id should be provided""" monitor_address: Optional[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_address/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" + """An alternate IP address used for health monitoring of a backend member. + + Default is null which monitors the member address. """ monitor_port: Optional[int] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_port/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" + """An alternate protocol port used for health monitoring of a backend member. + + Default is null which monitors the member protocol_port. """ subnet_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/subnet_id/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" - """ + """Either subnet_id or instance_id should be provided""" weight: Optional[int] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/weight/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.weight.anyOf[0]" - """ + """Member weight. Valid values: 0 to 256, defaults to 1""" class SessionPersistence(TypedDict, total=False): type: Required[SessionPersistenceType] - """ - '#/components/schemas/MutateLbSessionPersistence/properties/type' - "$.components.schemas.MutateLbSessionPersistence.properties.type" - """ + """Session persistence type""" cookie_name: Optional[str] - """ - '#/components/schemas/MutateLbSessionPersistence/properties/cookie_name/anyOf/0' - "$.components.schemas.MutateLbSessionPersistence.properties.cookie_name.anyOf[0]" - """ + """Should be set if app cookie or http cookie is used""" persistence_granularity: Optional[str] - """ - '#/components/schemas/MutateLbSessionPersistence/properties/persistence_granularity/anyOf/0' - "$.components.schemas.MutateLbSessionPersistence.properties.persistence_granularity.anyOf[0]" - """ + """Subnet mask if source_ip is used. For UDP ports only""" persistence_timeout: Optional[int] - """ - '#/components/schemas/MutateLbSessionPersistence/properties/persistence_timeout/anyOf/0' - "$.components.schemas.MutateLbSessionPersistence.properties.persistence_timeout.anyOf[0]" - """ + """Session persistence timeout. For UDP ports only""" diff --git a/src/gcore/types/cloud/load_balancers/pool_list_params.py b/src/gcore/types/cloud/load_balancers/pool_list_params.py index fedd5626..ec9fe43a 100644 --- a/src/gcore/types/cloud/load_balancers/pool_list_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_list_params.py @@ -9,31 +9,17 @@ class PoolListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[1].schema" - """ details: bool """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[2]" + If true, show member and healthmonitor details of each pool (increases request + time) """ listener_id: str - """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[3]" - """ + """Load balancer listener ID""" loadbalancer_id: str - """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}'].get.parameters[4]" - """ + """Load balancer ID""" 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 c87090b8..be41e37d 100644 --- a/src/gcore/types/cloud/load_balancers/pool_update_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_update_params.py @@ -16,211 +16,124 @@ class PoolUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}'].patch.parameters[1].schema" - """ ca_secret_id: Optional[str] - """ - '#/components/schemas/PatchLbPoolSerializer/properties/ca_secret_id/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.ca_secret_id.anyOf[0]" - """ + """Secret ID of CA certificate bundle""" crl_secret_id: Optional[str] - """ - '#/components/schemas/PatchLbPoolSerializer/properties/crl_secret_id/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.crl_secret_id.anyOf[0]" - """ + """Secret ID of CA revocation list file""" healthmonitor: Optional[Healthmonitor] - """ - '#/components/schemas/PatchLbPoolSerializer/properties/healthmonitor/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.healthmonitor.anyOf[0]" - """ + """New pool health monitor settings""" lb_algorithm: LbAlgorithm - """ - '#/components/schemas/PatchLbPoolSerializer/properties/lb_algorithm' - "$.components.schemas.PatchLbPoolSerializer.properties.lb_algorithm" - """ + """New load balancer pool algorithm of how to distribute requests""" members: Optional[Iterable[Member]] - """ - '#/components/schemas/PatchLbPoolSerializer/properties/members/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.members.anyOf[0]" + """New sequence of load balancer pool members. + + If members are the same (by address + port), they will be kept as is without + recreation and downtime. """ name: str - """ - '#/components/schemas/PatchLbPoolSerializer/properties/name' - "$.components.schemas.PatchLbPoolSerializer.properties.name" - """ + """New pool name""" protocol: LbPoolProtocol - """ - '#/components/schemas/PatchLbPoolSerializer/properties/protocol' - "$.components.schemas.PatchLbPoolSerializer.properties.protocol" - """ + """New communication protocol""" secret_id: Optional[str] - """ - '#/components/schemas/PatchLbPoolSerializer/properties/secret_id/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.secret_id.anyOf[0]" - """ + """Secret ID for TLS client authentication to the member servers""" session_persistence: Optional[SessionPersistence] - """ - '#/components/schemas/PatchLbPoolSerializer/properties/session_persistence/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.session_persistence.anyOf[0]" - """ + """New session persistence settings""" timeout_client_data: Optional[int] - """ - '#/components/schemas/PatchLbPoolSerializer/properties/timeout_client_data/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.timeout_client_data.anyOf[0]" - """ + """Frontend client inactivity timeout in milliseconds""" timeout_member_connect: Optional[int] - """ - '#/components/schemas/PatchLbPoolSerializer/properties/timeout_member_connect/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.timeout_member_connect.anyOf[0]" - """ + """Backend member connection timeout in milliseconds""" timeout_member_data: Optional[int] - """ - '#/components/schemas/PatchLbPoolSerializer/properties/timeout_member_data/anyOf/0' - "$.components.schemas.PatchLbPoolSerializer.properties.timeout_member_data.anyOf[0]" - """ + """Backend member inactivity timeout in milliseconds""" class Healthmonitor(TypedDict, total=False): delay: Required[int] - """ - '#/components/schemas/PatchLbHealthMonitorSerializer/properties/delay' - "$.components.schemas.PatchLbHealthMonitorSerializer.properties.delay" - """ + """The time, in seconds, between sending probes to members""" max_retries: Required[int] - """ - '#/components/schemas/PatchLbHealthMonitorSerializer/properties/max_retries' - "$.components.schemas.PatchLbHealthMonitorSerializer.properties.max_retries" - """ + """Number of successes before the member is switched to ONLINE state""" timeout: Required[int] - """ - '#/components/schemas/PatchLbHealthMonitorSerializer/properties/timeout' - "$.components.schemas.PatchLbHealthMonitorSerializer.properties.timeout" - """ + """The maximum time to connect. Must be less than the delay value""" expected_codes: Optional[str] - """ - '#/components/schemas/PatchLbHealthMonitorSerializer/properties/expected_codes/anyOf/0' - "$.components.schemas.PatchLbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" - """ + """Can only be used together with `HTTP` or `HTTPS` health monitor type.""" http_method: Optional[HTTPMethod] - """ - '#/components/schemas/PatchLbHealthMonitorSerializer/properties/http_method/anyOf/0' - "$.components.schemas.PatchLbHealthMonitorSerializer.properties.http_method.anyOf[0]" + """HTTP method. + + Can only be used together with `HTTP` or `HTTPS` health monitor type. """ max_retries_down: Optional[int] - """ - '#/components/schemas/PatchLbHealthMonitorSerializer/properties/max_retries_down/anyOf/0' - "$.components.schemas.PatchLbHealthMonitorSerializer.properties.max_retries_down.anyOf[0]" - """ + """Number of failures before the member is switched to ERROR state.""" type: Optional[HealthMonitorType] - """ - '#/components/schemas/PatchLbHealthMonitorSerializer/properties/type/anyOf/0' - "$.components.schemas.PatchLbHealthMonitorSerializer.properties.type.anyOf[0]" - """ + """Health monitor type. Once health monitor is created, cannot be changed.""" url_path: Optional[str] - """ - '#/components/schemas/PatchLbHealthMonitorSerializer/properties/url_path/anyOf/0' - "$.components.schemas.PatchLbHealthMonitorSerializer.properties.url_path.anyOf[0]" + """URL Path. + + Defaults to '/'. Can only be used together with `HTTP` or `HTTPS` health monitor + type. """ class Member(TypedDict, total=False): address: Required[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/address' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.address" - """ + """Member IP address""" protocol_port: Required[int] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/protocol_port' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.protocol_port" - """ + """Member IP port""" admin_state_up: Optional[bool] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/admin_state_up/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.admin_state_up.anyOf[0]" - """ + """true if enabled. Defaults to true""" instance_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/instance_id/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.instance_id.anyOf[0]" - """ + """Either subnet_id or instance_id should be provided""" monitor_address: Optional[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_address/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" + """An alternate IP address used for health monitoring of a backend member. + + Default is null which monitors the member address. """ monitor_port: Optional[int] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_port/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" + """An alternate protocol port used for health monitoring of a backend member. + + Default is null which monitors the member protocol_port. """ subnet_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/subnet_id/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" - """ + """Either subnet_id or instance_id should be provided""" weight: Optional[int] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/weight/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.weight.anyOf[0]" - """ + """Member weight. Valid values: 0 to 256, defaults to 1""" class SessionPersistence(TypedDict, total=False): type: Required[SessionPersistenceType] - """ - '#/components/schemas/MutateLbSessionPersistence/properties/type' - "$.components.schemas.MutateLbSessionPersistence.properties.type" - """ + """Session persistence type""" cookie_name: Optional[str] - """ - '#/components/schemas/MutateLbSessionPersistence/properties/cookie_name/anyOf/0' - "$.components.schemas.MutateLbSessionPersistence.properties.cookie_name.anyOf[0]" - """ + """Should be set if app cookie or http cookie is used""" persistence_granularity: Optional[str] - """ - '#/components/schemas/MutateLbSessionPersistence/properties/persistence_granularity/anyOf/0' - "$.components.schemas.MutateLbSessionPersistence.properties.persistence_granularity.anyOf[0]" - """ + """Subnet mask if source_ip is used. For UDP ports only""" persistence_timeout: Optional[int] - """ - '#/components/schemas/MutateLbSessionPersistence/properties/persistence_timeout/anyOf/0' - "$.components.schemas.MutateLbSessionPersistence.properties.persistence_timeout.anyOf[0]" - """ + """Session persistence timeout. For UDP ports only""" diff --git a/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py b/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py index 5e2edbc5..591e24d0 100644 --- a/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py @@ -14,61 +14,36 @@ class HealthMonitorCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fhealthmonitor/post/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor'].post.parameters[1].schema" - """ delay: Required[int] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/delay' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.delay" - """ + """The time, in seconds, between sending probes to members""" max_retries: Required[int] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries" - """ + """Number of successes before the member is switched to ONLINE state""" api_timeout: Required[Annotated[int, PropertyInfo(alias="timeout")]] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/timeout' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.timeout" - """ + """The maximum time to connect. Must be less than the delay value""" type: Required[HealthMonitorType] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/type' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.type" - """ + """Health monitor type. Once health monitor is created, cannot be changed.""" expected_codes: Optional[str] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/expected_codes/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.expected_codes.anyOf[0]" - """ + """Can only be used together with `HTTP` or `HTTPS` health monitor type.""" http_method: Optional[HTTPMethod] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/http_method/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.http_method.anyOf[0]" + """HTTP method. + + Can only be used together with `HTTP` or `HTTPS` health monitor type. """ max_retries_down: Optional[int] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/max_retries_down/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.max_retries_down.anyOf[0]" - """ + """Number of failures before the member is switched to ERROR state.""" url_path: Optional[str] - """ - '#/components/schemas/CreateLbHealthMonitorSerializer/properties/url_path/anyOf/0' - "$.components.schemas.CreateLbHealthMonitorSerializer.properties.url_path.anyOf[0]" + """URL Path. + + Defaults to '/'. Can only be used together with `HTTP` or `HTTPS` health monitor + type. """ diff --git a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py index 11578aab..e13d9f3e 100644 --- a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py @@ -10,61 +10,35 @@ class MemberAddParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/0/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Flbpools%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bpool_id%7D%2Fmember/post/parameters/1/schema' - "$.paths['/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member'].post.parameters[1].schema" - """ address: Required[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/address' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.address" - """ + """Member IP address""" protocol_port: Required[int] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/protocol_port' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.protocol_port" - """ + """Member IP port""" admin_state_up: Optional[bool] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/admin_state_up/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.admin_state_up.anyOf[0]" - """ + """true if enabled. Defaults to true""" instance_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/instance_id/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.instance_id.anyOf[0]" - """ + """Either subnet_id or instance_id should be provided""" monitor_address: Optional[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_address/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_address.anyOf[0]" + """An alternate IP address used for health monitoring of a backend member. + + Default is null which monitors the member address. """ monitor_port: Optional[int] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/monitor_port/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.monitor_port.anyOf[0]" + """An alternate protocol port used for health monitoring of a backend member. + + Default is null which monitors the member protocol_port. """ subnet_id: Optional[str] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/subnet_id/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.subnet_id.anyOf[0]" - """ + """Either subnet_id or instance_id should be provided""" weight: Optional[int] - """ - '#/components/schemas/CreateLbPoolMemberSerializer/properties/weight/anyOf/0' - "$.components.schemas.CreateLbPoolMemberSerializer.properties.weight.anyOf[0]" - """ + """Member weight. Valid values: 0 to 256, defaults to 1""" diff --git a/src/gcore/types/cloud/loadbalancer_metrics.py b/src/gcore/types/cloud/loadbalancer_metrics.py index 5128c352..d4f146bb 100644 --- a/src/gcore/types/cloud/loadbalancer_metrics.py +++ b/src/gcore/types/cloud/loadbalancer_metrics.py @@ -11,43 +11,22 @@ class LoadbalancerMetrics(BaseModel): cpu_util: Optional[float] = None - """ - '#/components/schemas/LoadbalancerMetricsSerializer/properties/cpu_util/anyOf/0' - "$.components.schemas.LoadbalancerMetricsSerializer.properties.cpu_util.anyOf[0]" - """ + """CPU utilization, % (max 100% for multi-core)""" memory_util: Optional[float] = None - """ - '#/components/schemas/LoadbalancerMetricsSerializer/properties/memory_util/anyOf/0' - "$.components.schemas.LoadbalancerMetricsSerializer.properties.memory_util.anyOf[0]" - """ + """RAM utilization, %""" network_bps_egress: Optional[float] = FieldInfo(alias="network_Bps_egress", default=None) - """ - '#/components/schemas/LoadbalancerMetricsSerializer/properties/network_Bps_egress/anyOf/0' - "$.components.schemas.LoadbalancerMetricsSerializer.properties.network_Bps_egress.anyOf[0]" - """ + """Network out, bytes per second""" network_bps_ingress: Optional[float] = FieldInfo(alias="network_Bps_ingress", default=None) - """ - '#/components/schemas/LoadbalancerMetricsSerializer/properties/network_Bps_ingress/anyOf/0' - "$.components.schemas.LoadbalancerMetricsSerializer.properties.network_Bps_ingress.anyOf[0]" - """ + """Network in, bytes per second""" network_pps_egress: Optional[float] = None - """ - '#/components/schemas/LoadbalancerMetricsSerializer/properties/network_pps_egress/anyOf/0' - "$.components.schemas.LoadbalancerMetricsSerializer.properties.network_pps_egress.anyOf[0]" - """ + """Network out, packets per second""" network_pps_ingress: Optional[float] = None - """ - '#/components/schemas/LoadbalancerMetricsSerializer/properties/network_pps_ingress/anyOf/0' - "$.components.schemas.LoadbalancerMetricsSerializer.properties.network_pps_ingress.anyOf[0]" - """ + """Network in, packets per second""" time: Optional[str] = None - """ - '#/components/schemas/LoadbalancerMetricsSerializer/properties/time/anyOf/0' - "$.components.schemas.LoadbalancerMetricsSerializer.properties.time.anyOf[0]" - """ + """Timestamp""" diff --git a/src/gcore/types/cloud/loadbalancer_metrics_list.py b/src/gcore/types/cloud/loadbalancer_metrics_list.py index c4ea5074..6a421044 100644 --- a/src/gcore/types/cloud/loadbalancer_metrics_list.py +++ b/src/gcore/types/cloud/loadbalancer_metrics_list.py @@ -10,13 +10,7 @@ class LoadbalancerMetricsList(BaseModel): count: int - """ - '#/components/schemas/LoadbalancerMetricsSerializerList/properties/count' - "$.components.schemas.LoadbalancerMetricsSerializerList.properties.count" - """ + """Number of objects""" results: List[LoadbalancerMetrics] - """ - '#/components/schemas/LoadbalancerMetricsSerializerList/properties/results' - "$.components.schemas.LoadbalancerMetricsSerializerList.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/logging.py b/src/gcore/types/cloud/logging.py index ca864c4b..c9062e7e 100644 --- a/src/gcore/types/cloud/logging.py +++ b/src/gcore/types/cloud/logging.py @@ -10,25 +10,13 @@ class Logging(BaseModel): destination_region_id: Optional[int] = None - """ - '#/components/schemas/LoggingOutSerializer/properties/destination_region_id/anyOf/0' - "$.components.schemas.LoggingOutSerializer.properties.destination_region_id.anyOf[0]" - """ + """ID of the region in which the logs will be stored""" enabled: bool - """ - '#/components/schemas/LoggingOutSerializer/properties/enabled' - "$.components.schemas.LoggingOutSerializer.properties.enabled" - """ + """Indicates if log streaming is enabled or disabled""" topic_name: Optional[str] = None - """ - '#/components/schemas/LoggingOutSerializer/properties/topic_name/anyOf/0' - "$.components.schemas.LoggingOutSerializer.properties.topic_name.anyOf[0]" - """ + """The topic name to stream logs to""" retention_policy: Optional[LaasIndexRetentionPolicy] = None - """ - '#/components/schemas/LoggingOutSerializer/properties/retention_policy/anyOf/0' - "$.components.schemas.LoggingOutSerializer.properties.retention_policy.anyOf[0]" - """ + """Logs retention policy""" diff --git a/src/gcore/types/cloud/member_status.py b/src/gcore/types/cloud/member_status.py index a0b1f5dd..102424ae 100644 --- a/src/gcore/types/cloud/member_status.py +++ b/src/gcore/types/cloud/member_status.py @@ -9,31 +9,16 @@ class MemberStatus(BaseModel): id: str - """ - '#/components/schemas/MemberStatusSerializer/properties/id' - "$.components.schemas.MemberStatusSerializer.properties.id" - """ + """UUID of the entity""" address: str - """ - '#/components/schemas/MemberStatusSerializer/properties/address' - "$.components.schemas.MemberStatusSerializer.properties.address" - """ + """Address of the member (server)""" operating_status: LoadBalancerOperatingStatus - """ - '#/components/schemas/MemberStatusSerializer/properties/operating_status' - "$.components.schemas.MemberStatusSerializer.properties.operating_status" - """ + """Operating status of the entity""" protocol_port: int - """ - '#/components/schemas/MemberStatusSerializer/properties/protocol_port' - "$.components.schemas.MemberStatusSerializer.properties.protocol_port" - """ + """Port of the member (server)""" provisioning_status: ProvisioningStatus - """ - '#/components/schemas/MemberStatusSerializer/properties/provisioning_status' - "$.components.schemas.MemberStatusSerializer.properties.provisioning_status" - """ + """Provisioning status of the entity""" diff --git a/src/gcore/types/cloud/network.py b/src/gcore/types/cloud/network.py index a2e41d8e..6f9382ce 100644 --- a/src/gcore/types/cloud/network.py +++ b/src/gcore/types/cloud/network.py @@ -11,109 +11,69 @@ class Network(BaseModel): id: str - """ - '#/components/schemas/NetworkSerializer/properties/id' - "$.components.schemas.NetworkSerializer.properties.id" - """ + """Network ID""" created_at: datetime - """ - '#/components/schemas/NetworkSerializer/properties/created_at' - "$.components.schemas.NetworkSerializer.properties.created_at" - """ + """Datetime when the network was created""" external: bool - """ - '#/components/schemas/NetworkSerializer/properties/external' - "$.components.schemas.NetworkSerializer.properties.external" - """ + """True if the network `router:external` attribute""" name: str - """ - '#/components/schemas/NetworkSerializer/properties/name' - "$.components.schemas.NetworkSerializer.properties.name" - """ + """Network name""" port_security_enabled: bool """ - '#/components/schemas/NetworkSerializer/properties/port_security_enabled' - "$.components.schemas.NetworkSerializer.properties.port_security_enabled" + Indicates port_security_enabled status of all newly created in the network + ports. """ region: str - """ - '#/components/schemas/NetworkSerializer/properties/region' - "$.components.schemas.NetworkSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/NetworkSerializer/properties/region_id' - "$.components.schemas.NetworkSerializer.properties.region_id" - """ + """Region ID""" shared: bool - """ - '#/components/schemas/NetworkSerializer/properties/shared' - "$.components.schemas.NetworkSerializer.properties.shared" - """ + """True when the network is shared with your project by external owner""" subnets: List[str] - """ - '#/components/schemas/NetworkSerializer/properties/subnets' - "$.components.schemas.NetworkSerializer.properties.subnets" - """ + """List of subnetworks""" tags: List[Tag] - """ - '#/components/schemas/NetworkSerializer/properties/tags' - "$.components.schemas.NetworkSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ type: str - """ - '#/components/schemas/NetworkSerializer/properties/type' - "$.components.schemas.NetworkSerializer.properties.type" - """ + """Network type (vlan, vxlan)""" updated_at: datetime - """ - '#/components/schemas/NetworkSerializer/properties/updated_at' - "$.components.schemas.NetworkSerializer.properties.updated_at" - """ + """Datetime when the network was last updated""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/NetworkSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.NetworkSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" default: Optional[bool] = None - """ - '#/components/schemas/NetworkSerializer/properties/default/anyOf/0' - "$.components.schemas.NetworkSerializer.properties['default'].anyOf[0]" - """ + """True if network has is_default attribute""" mtu: Optional[int] = None - """ - '#/components/schemas/NetworkSerializer/properties/mtu' - "$.components.schemas.NetworkSerializer.properties.mtu" - """ + """MTU (maximum transmission unit). Default value is 1450""" project_id: Optional[int] = None - """ - '#/components/schemas/NetworkSerializer/properties/project_id/anyOf/0' - "$.components.schemas.NetworkSerializer.properties.project_id.anyOf[0]" - """ + """Project ID""" segmentation_id: Optional[int] = None - """ - '#/components/schemas/NetworkSerializer/properties/segmentation_id/anyOf/0' - "$.components.schemas.NetworkSerializer.properties.segmentation_id.anyOf[0]" - """ + """Id of network segment""" task_id: Optional[str] = None - """ - '#/components/schemas/NetworkSerializer/properties/task_id/anyOf/0' - "$.components.schemas.NetworkSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ diff --git a/src/gcore/types/cloud/network_create_params.py b/src/gcore/types/cloud/network_create_params.py index b4ce478a..c695747a 100644 --- a/src/gcore/types/cloud/network_create_params.py +++ b/src/gcore/types/cloud/network_create_params.py @@ -11,37 +11,24 @@ class NetworkCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].post.parameters[1].schema" - """ name: Required[str] - """ - '#/components/schemas/CreateNetworkSerializer/properties/name' - "$.components.schemas.CreateNetworkSerializer.properties.name" - """ + """Network name""" create_router: bool - """ - '#/components/schemas/CreateNetworkSerializer/properties/create_router' - "$.components.schemas.CreateNetworkSerializer.properties.create_router" - """ + """Defaults to True""" tags: TagUpdateListParam - """ - '#/components/schemas/CreateNetworkSerializer/properties/tags' - "$.components.schemas.CreateNetworkSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. """ type: Literal["vlan", "vxlan"] - """ - '#/components/schemas/CreateNetworkSerializer/properties/type' - "$.components.schemas.CreateNetworkSerializer.properties.type" - """ + """vlan or vxlan network type is allowed. Default value is vxlan""" diff --git a/src/gcore/types/cloud/network_details.py b/src/gcore/types/cloud/network_details.py index 3cf38a5e..65313a3e 100644 --- a/src/gcore/types/cloud/network_details.py +++ b/src/gcore/types/cloud/network_details.py @@ -12,109 +12,68 @@ class NetworkDetails(BaseModel): id: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/id' - "$.components.schemas.NetworkSubnetworkSerializer.properties.id" - """ + """Network ID""" created_at: datetime - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/created_at' - "$.components.schemas.NetworkSubnetworkSerializer.properties.created_at" - """ + """Datetime when the network was created""" external: bool - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/external' - "$.components.schemas.NetworkSubnetworkSerializer.properties.external" - """ + """True if the network `router:external` attribute""" name: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/name' - "$.components.schemas.NetworkSubnetworkSerializer.properties.name" - """ + """Network name""" port_security_enabled: bool """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/port_security_enabled' - "$.components.schemas.NetworkSubnetworkSerializer.properties.port_security_enabled" + Indicates port_security_enabled status of all newly created in the network + ports. """ region: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/region' - "$.components.schemas.NetworkSubnetworkSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/region_id' - "$.components.schemas.NetworkSubnetworkSerializer.properties.region_id" - """ + """Region ID""" shared: bool - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/shared' - "$.components.schemas.NetworkSubnetworkSerializer.properties.shared" - """ + """True when the network is shared with your project by external owner""" tags: List[Tag] - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/tags' - "$.components.schemas.NetworkSubnetworkSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ type: str - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/type' - "$.components.schemas.NetworkSubnetworkSerializer.properties.type" - """ + """Network type (vlan, vxlan)""" updated_at: datetime - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/updated_at' - "$.components.schemas.NetworkSubnetworkSerializer.properties.updated_at" - """ + """Datetime when the network was last updated""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" default: Optional[bool] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/default/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties['default'].anyOf[0]" - """ + """True if network has is_default attribute""" mtu: Optional[int] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/mtu' - "$.components.schemas.NetworkSubnetworkSerializer.properties.mtu" - """ + """MTU (maximum transmission unit). Default value is 1450""" project_id: Optional[int] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/project_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.project_id.anyOf[0]" - """ + """Project ID""" segmentation_id: Optional[int] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/segmentation_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.segmentation_id.anyOf[0]" - """ + """Id of network segment""" subnets: Optional[List[Subnet]] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/subnets/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.subnets.anyOf[0]" - """ task_id: Optional[str] = None - """ - '#/components/schemas/NetworkSubnetworkSerializer/properties/task_id/anyOf/0' - "$.components.schemas.NetworkSubnetworkSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ diff --git a/src/gcore/types/cloud/network_interface.py b/src/gcore/types/cloud/network_interface.py index f9763b43..ee262b28 100644 --- a/src/gcore/types/cloud/network_interface.py +++ b/src/gcore/types/cloud/network_interface.py @@ -13,129 +13,66 @@ class SubPort(BaseModel): allowed_address_pairs: List[AllowedAddressPairs] - """ - '#/components/schemas/InstanceInterfaceSubportSerializer/properties/allowed_address_pairs' - "$.components.schemas.InstanceInterfaceSubportSerializer.properties.allowed_address_pairs" - """ + """Group of subnet masks and/or IP addresses that share the current IP as VIP""" floatingip_details: List[FloatingIP] - """ - '#/components/schemas/InstanceInterfaceSubportSerializer/properties/floatingip_details' - "$.components.schemas.InstanceInterfaceSubportSerializer.properties.floatingip_details" - """ + """Bodies of floating IPs that are NAT-ing IPs of this port""" ip_assignments: List[IPAssignment] - """ - '#/components/schemas/InstanceInterfaceSubportSerializer/properties/ip_assignments' - "$.components.schemas.InstanceInterfaceSubportSerializer.properties.ip_assignments" - """ + """IP addresses assigned to this port""" network_details: NetworkDetails - """ - '#/components/schemas/InstanceInterfaceSubportSerializer/properties/network_details' - "$.components.schemas.InstanceInterfaceSubportSerializer.properties.network_details" - """ + """Body of the network this port is attached to""" network_id: str - """ - '#/components/schemas/InstanceInterfaceSubportSerializer/properties/network_id' - "$.components.schemas.InstanceInterfaceSubportSerializer.properties.network_id" - """ + """ID of the network the port is attached to""" port_id: str - """ - '#/components/schemas/InstanceInterfaceSubportSerializer/properties/port_id' - "$.components.schemas.InstanceInterfaceSubportSerializer.properties.port_id" - """ + """ID of virtual ethernet port object""" port_security_enabled: bool - """ - '#/components/schemas/InstanceInterfaceSubportSerializer/properties/port_security_enabled' - "$.components.schemas.InstanceInterfaceSubportSerializer.properties.port_security_enabled" - """ + """Port security status""" segmentation_id: int - """ - '#/components/schemas/InstanceInterfaceSubportSerializer/properties/segmentation_id' - "$.components.schemas.InstanceInterfaceSubportSerializer.properties.segmentation_id" - """ + """id of network segment""" segmentation_type: str - """ - '#/components/schemas/InstanceInterfaceSubportSerializer/properties/segmentation_type' - "$.components.schemas.InstanceInterfaceSubportSerializer.properties.segmentation_type" - """ + """type of network segment""" interface_name: Optional[str] = None - """ - '#/components/schemas/InstanceInterfaceSubportSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.InstanceInterfaceSubportSerializer.properties.interface_name.anyOf[0]" - """ + """Interface name""" mac_address: Optional[str] = None - """ - '#/components/schemas/InstanceInterfaceSubportSerializer/properties/mac_address/anyOf/0' - "$.components.schemas.InstanceInterfaceSubportSerializer.properties.mac_address.anyOf[0]" - """ + """MAC address of the virtual port""" class NetworkInterface(BaseModel): allowed_address_pairs: List[AllowedAddressPairs] - """ - '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/allowed_address_pairs' - "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.allowed_address_pairs" - """ + """Group of subnet masks and/or IP addresses that share the current IP as VIP""" floatingip_details: List[FloatingIP] - """ - '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/floatingip_details' - "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.floatingip_details" - """ + """Bodies of floating IPs that are NAT-ing IPs of this port""" ip_assignments: List[IPAssignment] - """ - '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/ip_assignments' - "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.ip_assignments" - """ + """IP addresses assigned to this port""" network_details: NetworkDetails - """ - '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/network_details' - "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.network_details" - """ + """Body of the network this port is attached to""" network_id: str - """ - '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/network_id' - "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.network_id" - """ + """ID of the network the port is attached to""" port_id: str - """ - '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/port_id' - "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.port_id" - """ + """ID of virtual ethernet port object""" port_security_enabled: bool - """ - '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/port_security_enabled' - "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.port_security_enabled" - """ + """Port security status""" sub_ports: List[SubPort] - """ - '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/sub_ports' - "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.sub_ports" - """ + """body of ports that are included into trunk port""" interface_name: Optional[str] = None - """ - '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/interface_name/anyOf/0' - "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.interface_name.anyOf[0]" - """ + """Interface name""" mac_address: Optional[str] = None - """ - '#/components/schemas/InstanceInterfaceTrunkSerializer/properties/mac_address/anyOf/0' - "$.components.schemas.InstanceInterfaceTrunkSerializer.properties.mac_address.anyOf[0]" - """ + """MAC address of the virtual port""" diff --git a/src/gcore/types/cloud/network_interface_list.py b/src/gcore/types/cloud/network_interface_list.py index b7f5805f..42be30e6 100644 --- a/src/gcore/types/cloud/network_interface_list.py +++ b/src/gcore/types/cloud/network_interface_list.py @@ -10,13 +10,7 @@ class NetworkInterfaceList(BaseModel): count: int - """ - '#/components/schemas/InstanceInterfaceTrunkCollectionSerializer/properties/count' - "$.components.schemas.InstanceInterfaceTrunkCollectionSerializer.properties.count" - """ + """Number of objects""" results: List[NetworkInterface] - """ - '#/components/schemas/InstanceInterfaceTrunkCollectionSerializer/properties/results' - "$.components.schemas.InstanceInterfaceTrunkCollectionSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/network_list_params.py b/src/gcore/types/cloud/network_list_params.py index e3d15874..a2d51979 100644 --- a/src/gcore/types/cloud/network_list_params.py +++ b/src/gcore/types/cloud/network_list_params.py @@ -10,43 +10,27 @@ class NetworkListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[1].schema" - """ limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[2]" - """ + """Limit the number of returned limit request entities.""" offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[3]" - """ + """Offset value is used to exclude the first set of records from the result.""" order_by: str - """ - '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[4]" + """Order networks by fields and directions (name.asc). + + Default is `created_at.asc`. """ tag_key: List[str] - """ - '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[5]" - """ + """Filter by tag keys.""" tag_key_value: str - """ - '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}'].get.parameters[6]" + """Filter by tag key-value pairs. + + Must be a valid JSON string. curl -G --data-urlencode "tag_key_value={"key": + "value"}" --url "http://localhost:1111/v1/networks/1/1" """ diff --git a/src/gcore/types/cloud/network_update_params.py b/src/gcore/types/cloud/network_update_params.py index 375ab5dd..750428f4 100644 --- a/src/gcore/types/cloud/network_update_params.py +++ b/src/gcore/types/cloud/network_update_params.py @@ -9,19 +9,8 @@ class NetworkUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fnetworks%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bnetwork_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/networks/{project_id}/{region_id}/{network_id}'].patch.parameters[1].schema" - """ name: Required[str] - """ - '#/components/schemas/NameSerializerPydantic/properties/name' - "$.components.schemas.NameSerializerPydantic.properties.name" - """ + """Name.""" diff --git a/src/gcore/types/cloud/networks/router.py b/src/gcore/types/cloud/networks/router.py index 9471d222..c5d1d5a3 100644 --- a/src/gcore/types/cloud/networks/router.py +++ b/src/gcore/types/cloud/networks/router.py @@ -12,131 +12,72 @@ class Interface(BaseModel): ip_assignments: List[IPAssignment] - """ - '#/components/schemas/PortSerializer/properties/ip_assignments' - "$.components.schemas.PortSerializer.properties.ip_assignments" - """ + """IP addresses assigned to this port""" network_id: str - """ - '#/components/schemas/PortSerializer/properties/network_id' - "$.components.schemas.PortSerializer.properties.network_id" - """ + """ID of the network the port is attached to""" port_id: str - """ - '#/components/schemas/PortSerializer/properties/port_id' - "$.components.schemas.PortSerializer.properties.port_id" - """ + """ID of virtual ethernet port object""" mac_address: Optional[str] = None - """ - '#/components/schemas/PortSerializer/properties/mac_address/anyOf/0' - "$.components.schemas.PortSerializer.properties.mac_address.anyOf[0]" - """ + """MAC address of the virtual port""" class ExternalGatewayInfo(BaseModel): enable_snat: bool - """ - '#/components/schemas/ExternalGatewaySerializer/properties/enable_snat' - "$.components.schemas.ExternalGatewaySerializer.properties.enable_snat" - """ + """Is SNAT enabled.""" external_fixed_ips: List[IPAssignment] - """ - '#/components/schemas/ExternalGatewaySerializer/properties/external_fixed_ips' - "$.components.schemas.ExternalGatewaySerializer.properties.external_fixed_ips" - """ + """List of external IPs that emit SNAT-ed traffic.""" network_id: str - """ - '#/components/schemas/ExternalGatewaySerializer/properties/network_id' - "$.components.schemas.ExternalGatewaySerializer.properties.network_id" - """ + """Id of the external network.""" class Router(BaseModel): id: str - """ - '#/components/schemas/RouterSerializer/properties/id' - "$.components.schemas.RouterSerializer.properties.id" - """ + """Router ID""" created_at: datetime - """ - '#/components/schemas/RouterSerializer/properties/created_at' - "$.components.schemas.RouterSerializer.properties.created_at" - """ + """Datetime when the router was created""" distributed: bool - """ - '#/components/schemas/RouterSerializer/properties/distributed' - "$.components.schemas.RouterSerializer.properties.distributed" - """ + """Whether the router is distributed or centralized.""" interfaces: List[Interface] - """ - '#/components/schemas/RouterSerializer/properties/interfaces' - "$.components.schemas.RouterSerializer.properties.interfaces" - """ + """List of router interfaces.""" name: str - """ - '#/components/schemas/RouterSerializer/properties/name' - "$.components.schemas.RouterSerializer.properties.name" - """ + """Router name""" project_id: int - """ - '#/components/schemas/RouterSerializer/properties/project_id' - "$.components.schemas.RouterSerializer.properties.project_id" - """ + """Project ID""" region: str - """ - '#/components/schemas/RouterSerializer/properties/region' - "$.components.schemas.RouterSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/RouterSerializer/properties/region_id' - "$.components.schemas.RouterSerializer.properties.region_id" - """ + """Region ID""" routes: List[Route] - """ - '#/components/schemas/RouterSerializer/properties/routes' - "$.components.schemas.RouterSerializer.properties.routes" - """ + """List of custom routes.""" status: str - """ - '#/components/schemas/RouterSerializer/properties/status' - "$.components.schemas.RouterSerializer.properties.status" - """ + """Status of the router.""" task_id: Optional[str] = None - """ - '#/components/schemas/RouterSerializer/properties/task_id/anyOf/0' - "$.components.schemas.RouterSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ updated_at: datetime - """ - '#/components/schemas/RouterSerializer/properties/updated_at' - "$.components.schemas.RouterSerializer.properties.updated_at" - """ + """Datetime when the router was last updated""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/RouterSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.RouterSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" external_gateway_info: Optional[ExternalGatewayInfo] = None - """ - '#/components/schemas/RouterSerializer/properties/external_gateway_info/anyOf/0' - "$.components.schemas.RouterSerializer.properties.external_gateway_info.anyOf[0]" - """ + """State of this router's external gateway.""" diff --git a/src/gcore/types/cloud/networks/router_attach_subnet_params.py b/src/gcore/types/cloud/networks/router_attach_subnet_params.py index ee9531c4..3ee5f7f6 100644 --- a/src/gcore/types/cloud/networks/router_attach_subnet_params.py +++ b/src/gcore/types/cloud/networks/router_attach_subnet_params.py @@ -9,25 +9,16 @@ class RouterAttachSubnetParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fattach/post/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach'].post.parameters[1].schema" - """ + """Region ID""" subnet_id: Required[str] - """ - '#/components/schemas/AddRouterInterfaceSerializer/properties/subnet_id' - "$.components.schemas.AddRouterInterfaceSerializer.properties.subnet_id" - """ + """Subnet ID on which router interface will be created""" ip_address: str """ - '#/components/schemas/AddRouterInterfaceSerializer/properties/ip_address' - "$.components.schemas.AddRouterInterfaceSerializer.properties.ip_address" + IP address to assign for router's interface, if not specified, address will be + selected automatically """ diff --git a/src/gcore/types/cloud/networks/router_create_params.py b/src/gcore/types/cloud/networks/router_create_params.py index b0422a10..4fa5449b 100644 --- a/src/gcore/types/cloud/networks/router_create_params.py +++ b/src/gcore/types/cloud/networks/router_create_params.py @@ -17,74 +17,38 @@ class RouterCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].post.parameters[1].schema" - """ name: Required[str] - """ - '#/components/schemas/CreateRouterSerializer/properties/name' - "$.components.schemas.CreateRouterSerializer.properties.name" - """ + """name of router""" external_gateway_info: Optional[ExternalGatewayInfo] - """ - '#/components/schemas/CreateRouterSerializer/properties/external_gateway_info' - "$.components.schemas.CreateRouterSerializer.properties.external_gateway_info" - """ interfaces: Optional[Iterable[Interface]] - """ - '#/components/schemas/CreateRouterSerializer/properties/interfaces/anyOf/0' - "$.components.schemas.CreateRouterSerializer.properties.interfaces.anyOf[0]" - """ + """List of interfaces to attach to router immediately after creation.""" routes: Optional[Iterable[Route]] - """ - '#/components/schemas/CreateRouterSerializer/properties/routes/anyOf/0' - "$.components.schemas.CreateRouterSerializer.properties.routes.anyOf[0]" - """ + """List of custom routes.""" class ExternalGatewayInfoRouterExternalManualGwSerializer(TypedDict, total=False): network_id: Required[str] - """ - '#/components/schemas/RouterExternalManualGwSerializer/properties/network_id' - "$.components.schemas.RouterExternalManualGwSerializer.properties.network_id" - """ + """id of the external network.""" enable_snat: bool - """ - '#/components/schemas/RouterExternalManualGwSerializer/properties/enable_snat' - "$.components.schemas.RouterExternalManualGwSerializer.properties.enable_snat" - """ + """Is SNAT enabled. Defaults to true.""" type: Literal["manual"] - """ - '#/components/schemas/RouterExternalManualGwSerializer/properties/type' - "$.components.schemas.RouterExternalManualGwSerializer.properties.type" - """ + """must be 'manual'.""" class ExternalGatewayInfoRouterExternalDefaultGwSerializer(TypedDict, total=False): enable_snat: bool - """ - '#/components/schemas/RouterExternalDefaultGwSerializer/properties/enable_snat' - "$.components.schemas.RouterExternalDefaultGwSerializer.properties.enable_snat" - """ + """Is SNAT enabled. Defaults to true.""" type: Literal["default"] - """ - '#/components/schemas/RouterExternalDefaultGwSerializer/properties/type' - "$.components.schemas.RouterExternalDefaultGwSerializer.properties.type" - """ + """must be 'default'.""" ExternalGatewayInfo: TypeAlias = Union[ @@ -94,27 +58,18 @@ class ExternalGatewayInfoRouterExternalDefaultGwSerializer(TypedDict, total=Fals class Interface(TypedDict, total=False): subnet_id: Required[str] - """ - '#/components/schemas/CreateRouterInterfaceSubnetSerializer/properties/subnet_id' - "$.components.schemas.CreateRouterInterfaceSubnetSerializer.properties.subnet_id" - """ + """id of the subnet to attach to.""" type: Literal["subnet"] - """ - '#/components/schemas/CreateRouterInterfaceSubnetSerializer/properties/type' - "$.components.schemas.CreateRouterInterfaceSubnetSerializer.properties.type" - """ + """must be 'subnet'.""" class Route(TypedDict, total=False): destination: Required[str] - """ - '#/components/schemas/RouteInSerializer/properties/destination' - "$.components.schemas.RouteInSerializer.properties.destination" - """ + """CIDR of destination IPv4 subnet.""" nexthop: Required[str] """ - '#/components/schemas/RouteInSerializer/properties/nexthop' - "$.components.schemas.RouteInSerializer.properties.nexthop" + IPv4 address to forward traffic to if it's destination IP matches 'destination' + CIDR. """ diff --git a/src/gcore/types/cloud/networks/router_detach_subnet_params.py b/src/gcore/types/cloud/networks/router_detach_subnet_params.py index ba7db5bb..ecf64cb2 100644 --- a/src/gcore/types/cloud/networks/router_detach_subnet_params.py +++ b/src/gcore/types/cloud/networks/router_detach_subnet_params.py @@ -9,19 +9,8 @@ class RouterDetachSubnetParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D%2Fdetach/post/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach'].post.parameters[1].schema" - """ subnet_id: Required[str] - """ - '#/components/schemas/SubnetIdSerializer/properties/subnet_id' - "$.components.schemas.SubnetIdSerializer.properties.subnet_id" - """ + """Target IP is identified by it's subnet""" diff --git a/src/gcore/types/cloud/networks/router_list.py b/src/gcore/types/cloud/networks/router_list.py index 79d4b6df..23a83fc8 100644 --- a/src/gcore/types/cloud/networks/router_list.py +++ b/src/gcore/types/cloud/networks/router_list.py @@ -10,13 +10,7 @@ class RouterList(BaseModel): count: int - """ - '#/components/schemas/RouterSerializerList/properties/count' - "$.components.schemas.RouterSerializerList.properties.count" - """ + """Number of objects""" results: List[Router] - """ - '#/components/schemas/RouterSerializerList/properties/results' - "$.components.schemas.RouterSerializerList.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/networks/router_list_params.py b/src/gcore/types/cloud/networks/router_list_params.py index 96ddd1af..5ff04e35 100644 --- a/src/gcore/types/cloud/networks/router_list_params.py +++ b/src/gcore/types/cloud/networks/router_list_params.py @@ -9,25 +9,11 @@ class RouterListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[1].schema" - """ limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[2]" - """ + """Limit the number of returned limit request entities.""" offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}'].get.parameters[3]" - """ + """Offset value is used to exclude the first set of records from the result.""" diff --git a/src/gcore/types/cloud/networks/router_update_params.py b/src/gcore/types/cloud/networks/router_update_params.py index 29c33e1f..b48253b7 100644 --- a/src/gcore/types/cloud/networks/router_update_params.py +++ b/src/gcore/types/cloud/networks/router_update_params.py @@ -10,65 +10,36 @@ class RouterUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Frouters%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brouter_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/routers/{project_id}/{region_id}/{router_id}'].patch.parameters[1].schema" - """ external_gateway_info: Optional[ExternalGatewayInfo] - """ - '#/components/schemas/PatchRouterSerializer/properties/external_gateway_info/anyOf/0' - "$.components.schemas.PatchRouterSerializer.properties.external_gateway_info.anyOf[0]" - """ + """New external gateway.""" name: Optional[str] - """ - '#/components/schemas/PatchRouterSerializer/properties/name/anyOf/0' - "$.components.schemas.PatchRouterSerializer.properties.name.anyOf[0]" - """ + """New name of router""" routes: Optional[Iterable[Route]] - """ - '#/components/schemas/PatchRouterSerializer/properties/routes/anyOf/0' - "$.components.schemas.PatchRouterSerializer.properties.routes.anyOf[0]" - """ + """List of custom routes.""" class ExternalGatewayInfo(TypedDict, total=False): network_id: Required[str] - """ - '#/components/schemas/RouterExternalManualGwSerializer/properties/network_id' - "$.components.schemas.RouterExternalManualGwSerializer.properties.network_id" - """ + """id of the external network.""" enable_snat: bool - """ - '#/components/schemas/RouterExternalManualGwSerializer/properties/enable_snat' - "$.components.schemas.RouterExternalManualGwSerializer.properties.enable_snat" - """ + """Is SNAT enabled. Defaults to true.""" type: Literal["manual"] - """ - '#/components/schemas/RouterExternalManualGwSerializer/properties/type' - "$.components.schemas.RouterExternalManualGwSerializer.properties.type" - """ + """must be 'manual'.""" class Route(TypedDict, total=False): destination: Required[str] - """ - '#/components/schemas/RouteInSerializer/properties/destination' - "$.components.schemas.RouteInSerializer.properties.destination" - """ + """CIDR of destination IPv4 subnet.""" nexthop: Required[str] """ - '#/components/schemas/RouteInSerializer/properties/nexthop' - "$.components.schemas.RouteInSerializer.properties.nexthop" + IPv4 address to forward traffic to if it's destination IP matches 'destination' + CIDR. """ diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index 49034372..80e8c31e 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -13,93 +13,70 @@ class SubnetCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].post.parameters[1].schema" - """ + """Region ID""" cidr: Required[str] - """ - '#/components/schemas/CreateSubnetSerializer/properties/cidr' - "$.components.schemas.CreateSubnetSerializer.properties.cidr" - """ + """CIDR""" name: Required[str] - """ - '#/components/schemas/CreateSubnetSerializer/properties/name' - "$.components.schemas.CreateSubnetSerializer.properties.name" - """ + """Subnet name""" network_id: Required[str] - """ - '#/components/schemas/CreateSubnetSerializer/properties/network_id' - "$.components.schemas.CreateSubnetSerializer.properties.network_id" - """ + """Network ID""" connect_to_network_router: bool - """ - '#/components/schemas/CreateSubnetSerializer/properties/connect_to_network_router' - "$.components.schemas.CreateSubnetSerializer.properties.connect_to_network_router" + """True if the network's router should get a gateway in this subnet. + + Must be explicitly 'false' when gateway_ip is null. """ dns_nameservers: Optional[List[str]] - """ - '#/components/schemas/CreateSubnetSerializer/properties/dns_nameservers/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.dns_nameservers.anyOf[0]" - """ + """List IP addresses of DNS servers to advertise via DHCP.""" enable_dhcp: bool - """ - '#/components/schemas/CreateSubnetSerializer/properties/enable_dhcp' - "$.components.schemas.CreateSubnetSerializer.properties.enable_dhcp" - """ + """True if DHCP should be enabled""" gateway_ip: Optional[str] - """ - '#/components/schemas/CreateSubnetSerializer/properties/gateway_ip/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.gateway_ip.anyOf[0]" + """Default GW IPv4 address to advertise in DHCP routes in this subnet. + + Omit this field to let the cloud backend allocate it automatically. Set to null + if no gateway must be advertised by this subnet's DHCP (useful when attaching + instances to multiple subnets in order to prevent default route conflicts). """ host_routes: Optional[Iterable[HostRoute]] - """ - '#/components/schemas/CreateSubnetSerializer/properties/host_routes/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.host_routes.anyOf[0]" - """ + """List of custom static routes to advertise via DHCP.""" ip_version: IPVersion - """ - '#/components/schemas/CreateSubnetSerializer/properties/ip_version' - "$.components.schemas.CreateSubnetSerializer.properties.ip_version" - """ + """IP version""" router_id_to_connect: Optional[str] - """ - '#/components/schemas/CreateSubnetSerializer/properties/router_id_to_connect/anyOf/0' - "$.components.schemas.CreateSubnetSerializer.properties.router_id_to_connect.anyOf[0]" + """ID of the router to connect to. + + Requires `connect_to_network_router` set to true. If not specified, attempts to + find a router created during network creation. """ tags: TagUpdateListParam - """ - '#/components/schemas/CreateSubnetSerializer/properties/tags' - "$.components.schemas.CreateSubnetSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. """ class HostRoute(TypedDict, total=False): destination: Required[str] - """ - '#/components/schemas/RouteInSerializer/properties/destination' - "$.components.schemas.RouteInSerializer.properties.destination" - """ + """CIDR of destination IPv4 subnet.""" nexthop: Required[str] """ - '#/components/schemas/RouteInSerializer/properties/nexthop' - "$.components.schemas.RouteInSerializer.properties.nexthop" + IPv4 address to forward traffic to if it's destination IP matches 'destination' + CIDR. """ diff --git a/src/gcore/types/cloud/networks/subnet_list_params.py b/src/gcore/types/cloud/networks/subnet_list_params.py index b416159e..5ce2271e 100644 --- a/src/gcore/types/cloud/networks/subnet_list_params.py +++ b/src/gcore/types/cloud/networks/subnet_list_params.py @@ -10,33 +10,21 @@ class SubnetListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[1].schema" - """ + """Region ID""" limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[2]" - """ + """Optional. Limit the number of returned items""" network_id: str - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[3]" - """ + """Only list subnets of this network""" offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[4]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ order_by: Literal[ @@ -54,18 +42,17 @@ class SubnetListParams(TypedDict, total=False): "updated_at.desc", ] """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[5]" + Ordering subnets list result by `name`, `created_at`, `updated_at`, + `available_ips`, `total_ips`, and `cidr` (default) fields of the subnet and + directions (`name.asc`). """ tag_key: List[str] - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[6]" - """ + """Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2""" tag_key_value: str - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}'].get.parameters[7]" + """Optional. + + Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": + "value"}" --url "https://example.com/cloud/v1/resource/1/1" """ diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index ca79f228..7fb218da 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -10,57 +10,38 @@ class SubnetUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsubnets%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bsubnet_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}'].patch.parameters[1].schema" - """ + """Region ID""" dns_nameservers: Optional[List[str]] - """ - '#/components/schemas/PatchSubnetSerializer/properties/dns_nameservers/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.dns_nameservers.anyOf[0]" - """ + """List IP addresses of DNS servers to advertise via DHCP.""" enable_dhcp: Optional[bool] - """ - '#/components/schemas/PatchSubnetSerializer/properties/enable_dhcp/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.enable_dhcp.anyOf[0]" - """ + """True if DHCP should be enabled""" gateway_ip: Optional[str] - """ - '#/components/schemas/PatchSubnetSerializer/properties/gateway_ip/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.gateway_ip.anyOf[0]" + """Default GW IPv4 address to advertise in DHCP routes in this subnet. + + Omit this field to let the cloud backend allocate it automatically. Set to null + if no gateway must be advertised by this subnet's DHCP (useful when attaching + instances to multiple subnets in order to prevent default route conflicts). """ host_routes: Optional[Iterable[HostRoute]] - """ - '#/components/schemas/PatchSubnetSerializer/properties/host_routes/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.host_routes.anyOf[0]" - """ + """List of custom static routes to advertise via DHCP.""" name: Optional[str] - """ - '#/components/schemas/PatchSubnetSerializer/properties/name/anyOf/0' - "$.components.schemas.PatchSubnetSerializer.properties.name.anyOf[0]" - """ + """Name""" class HostRoute(TypedDict, total=False): destination: Required[str] - """ - '#/components/schemas/RouteInSerializer/properties/destination' - "$.components.schemas.RouteInSerializer.properties.destination" - """ + """CIDR of destination IPv4 subnet.""" nexthop: Required[str] """ - '#/components/schemas/RouteInSerializer/properties/nexthop' - "$.components.schemas.RouteInSerializer.properties.nexthop" + IPv4 address to forward traffic to if it's destination IP matches 'destination' + CIDR. """ diff --git a/src/gcore/types/cloud/placement_group.py b/src/gcore/types/cloud/placement_group.py index dd35f63c..64c528a0 100644 --- a/src/gcore/types/cloud/placement_group.py +++ b/src/gcore/types/cloud/placement_group.py @@ -9,57 +9,33 @@ class Instance(BaseModel): instance_id: str - """ - '#/components/schemas/InstanceBriefSerializer/properties/instance_id' - "$.components.schemas.InstanceBriefSerializer.properties.instance_id" - """ + """The ID of the instance, corresponding to the attribute 'id'.""" instance_name: str - """ - '#/components/schemas/InstanceBriefSerializer/properties/instance_name' - "$.components.schemas.InstanceBriefSerializer.properties.instance_name" - """ + """The name of the instance, corresponding to the attribute 'name'.""" class PlacementGroup(BaseModel): instances: List[Instance] - """ - '#/components/schemas/ServerGroupSerializer/properties/instances' - "$.components.schemas.ServerGroupSerializer.properties.instances" - """ + """The list of instances in this server group.""" name: str - """ - '#/components/schemas/ServerGroupSerializer/properties/name' - "$.components.schemas.ServerGroupSerializer.properties.name" - """ + """The name of the server group.""" policy: str - """ - '#/components/schemas/ServerGroupSerializer/properties/policy' - "$.components.schemas.ServerGroupSerializer.properties.policy" + """The server group policy. + + Options are: anti-affinity, affinity, or soft-anti-affinity. """ project_id: int - """ - '#/components/schemas/ServerGroupSerializer/properties/project_id' - "$.components.schemas.ServerGroupSerializer.properties.project_id" - """ + """Project ID""" region: str - """ - '#/components/schemas/ServerGroupSerializer/properties/region' - "$.components.schemas.ServerGroupSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/ServerGroupSerializer/properties/region_id' - "$.components.schemas.ServerGroupSerializer.properties.region_id" - """ + """Region ID""" servergroup_id: str - """ - '#/components/schemas/ServerGroupSerializer/properties/servergroup_id' - "$.components.schemas.ServerGroupSerializer.properties.servergroup_id" - """ + """The ID of the server group.""" diff --git a/src/gcore/types/cloud/placement_group_create_params.py b/src/gcore/types/cloud/placement_group_create_params.py index 54012fbe..b5ca3e39 100644 --- a/src/gcore/types/cloud/placement_group_create_params.py +++ b/src/gcore/types/cloud/placement_group_create_params.py @@ -9,25 +9,11 @@ class PlacementGroupCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fservergroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/servergroups/{project_id}/{region_id}'].post.parameters[1].schema" - """ name: Required[str] - """ - '#/components/schemas/CreateServerGroupSerializer/properties/name' - "$.components.schemas.CreateServerGroupSerializer.properties.name" - """ + """The name of the server group.""" policy: Required[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] - """ - '#/components/schemas/CreateServerGroupSerializer/properties/policy' - "$.components.schemas.CreateServerGroupSerializer.properties.policy" - """ + """The server group policy.""" diff --git a/src/gcore/types/cloud/placement_group_list.py b/src/gcore/types/cloud/placement_group_list.py index 56292342..92fbc1f9 100644 --- a/src/gcore/types/cloud/placement_group_list.py +++ b/src/gcore/types/cloud/placement_group_list.py @@ -10,13 +10,7 @@ class PlacementGroupList(BaseModel): count: int - """ - '#/components/schemas/ServerGroupSerializerList/properties/count' - "$.components.schemas.ServerGroupSerializerList.properties.count" - """ + """Number of objects""" results: List[PlacementGroup] - """ - '#/components/schemas/ServerGroupSerializerList/properties/results' - "$.components.schemas.ServerGroupSerializerList.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/pool_status.py b/src/gcore/types/cloud/pool_status.py index 5e8e44fa..0af514bc 100644 --- a/src/gcore/types/cloud/pool_status.py +++ b/src/gcore/types/cloud/pool_status.py @@ -13,37 +13,19 @@ class PoolStatus(BaseModel): id: str - """ - '#/components/schemas/PoolStatusSerializer/properties/id' - "$.components.schemas.PoolStatusSerializer.properties.id" - """ + """UUID of the entity""" members: List[MemberStatus] - """ - '#/components/schemas/PoolStatusSerializer/properties/members' - "$.components.schemas.PoolStatusSerializer.properties.members" - """ + """Members (servers) of the pool""" name: str - """ - '#/components/schemas/PoolStatusSerializer/properties/name' - "$.components.schemas.PoolStatusSerializer.properties.name" - """ + """Name of the load balancer pool""" operating_status: LoadBalancerOperatingStatus - """ - '#/components/schemas/PoolStatusSerializer/properties/operating_status' - "$.components.schemas.PoolStatusSerializer.properties.operating_status" - """ + """Operating status of the entity""" provisioning_status: ProvisioningStatus - """ - '#/components/schemas/PoolStatusSerializer/properties/provisioning_status' - "$.components.schemas.PoolStatusSerializer.properties.provisioning_status" - """ + """Provisioning status of the entity""" health_monitor: Optional[HealthMonitorStatus] = None - """ - '#/components/schemas/PoolStatusSerializer/properties/health_monitor' - "$.components.schemas.PoolStatusSerializer.properties.health_monitor" - """ + """Health Monitor of the Pool""" diff --git a/src/gcore/types/cloud/project.py b/src/gcore/types/cloud/project.py index c31c1474..8d978657 100644 --- a/src/gcore/types/cloud/project.py +++ b/src/gcore/types/cloud/project.py @@ -10,55 +10,38 @@ class Project(BaseModel): id: int - """ - '#/components/schemas/ProjectSerializer/properties/id' - "$.components.schemas.ProjectSerializer.properties.id" - """ + """Project ID, which is automatically generated upon creation.""" client_id: int - """ - '#/components/schemas/ProjectSerializer/properties/client_id' - "$.components.schemas.ProjectSerializer.properties.client_id" - """ + """ID associated with the client.""" created_at: datetime - """ - '#/components/schemas/ProjectSerializer/properties/created_at' - "$.components.schemas.ProjectSerializer.properties.created_at" - """ + """Datetime of creation, which is automatically generated.""" is_default: bool - """ - '#/components/schemas/ProjectSerializer/properties/is_default' - "$.components.schemas.ProjectSerializer.properties.is_default" + """Indicates if the project is the default one. + + Each client always has one default project. """ name: str - """ - '#/components/schemas/ProjectSerializer/properties/name' - "$.components.schemas.ProjectSerializer.properties.name" - """ + """Unique project name for a client.""" state: str - """ - '#/components/schemas/ProjectSerializer/properties/state' - "$.components.schemas.ProjectSerializer.properties.state" - """ + """The state of the project.""" deleted_at: Optional[datetime] = None """ - '#/components/schemas/ProjectSerializer/properties/deleted_at/anyOf/0' - "$.components.schemas.ProjectSerializer.properties.deleted_at.anyOf[0]" + Datetime of deletion, which is automatically generated if the project is + deleted. """ description: Optional[str] = None - """ - '#/components/schemas/ProjectSerializer/properties/description/anyOf/0' - "$.components.schemas.ProjectSerializer.properties.description.anyOf[0]" - """ + """Description of the project.""" task_id: Optional[str] = None - """ - '#/components/schemas/ProjectSerializer/properties/task_id/anyOf/0' - "$.components.schemas.ProjectSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ diff --git a/src/gcore/types/cloud/project_create_params.py b/src/gcore/types/cloud/project_create_params.py index fd5ead0c..9a9255be 100644 --- a/src/gcore/types/cloud/project_create_params.py +++ b/src/gcore/types/cloud/project_create_params.py @@ -10,25 +10,13 @@ class ProjectCreateParams(TypedDict, total=False): name: Required[str] - """ - '#/components/schemas/CreateProjectSerializer/properties/name' - "$.components.schemas.CreateProjectSerializer.properties.name" - """ + """Unique project name for a client. Each client always has one "default" project.""" client_id: Optional[int] - """ - '#/components/schemas/CreateProjectSerializer/properties/client_id/anyOf/0' - "$.components.schemas.CreateProjectSerializer.properties.client_id.anyOf[0]" - """ + """ID associated with the client.""" description: Optional[str] - """ - '#/components/schemas/CreateProjectSerializer/properties/description/anyOf/0' - "$.components.schemas.CreateProjectSerializer.properties.description.anyOf[0]" - """ + """Description of the project.""" state: Optional[str] - """ - '#/components/schemas/CreateProjectSerializer/properties/state/anyOf/0' - "$.components.schemas.CreateProjectSerializer.properties.state.anyOf[0]" - """ + """State of the project.""" diff --git a/src/gcore/types/cloud/project_list_params.py b/src/gcore/types/cloud/project_list_params.py index 53753f9b..a469a6ed 100644 --- a/src/gcore/types/cloud/project_list_params.py +++ b/src/gcore/types/cloud/project_list_params.py @@ -9,37 +9,19 @@ class ProjectListParams(TypedDict, total=False): client_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/0' - "$.paths['/cloud/v1/projects'].get.parameters[0]" - """ + """Client ID filter for administrators.""" include_deleted: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/1' - "$.paths['/cloud/v1/projects'].get.parameters[1]" - """ + """Whether to include deleted projects in the response.""" limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/2' - "$.paths['/cloud/v1/projects'].get.parameters[2]" - """ + """Limit value is used to limit the number of records in the result""" name: str - """ - '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/3' - "$.paths['/cloud/v1/projects'].get.parameters[3]" - """ + """Name to filter the results by.""" offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/4' - "$.paths['/cloud/v1/projects'].get.parameters[4]" - """ + """Offset value is used to exclude the first set of records from the result""" order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] - """ - '#/paths/%2Fcloud%2Fv1%2Fprojects/get/parameters/5' - "$.paths['/cloud/v1/projects'].get.parameters[5]" - """ + """Order by field and direction.""" diff --git a/src/gcore/types/cloud/project_replace_params.py b/src/gcore/types/cloud/project_replace_params.py index f52748e5..c26f1c6f 100644 --- a/src/gcore/types/cloud/project_replace_params.py +++ b/src/gcore/types/cloud/project_replace_params.py @@ -10,19 +10,9 @@ class ProjectReplaceParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fprojects%2F%7Bproject_id%7D/put/parameters/0/schema' - "$.paths['/cloud/v1/projects/{project_id}'].put.parameters[0].schema" - """ name: Required[str] - """ - '#/components/schemas/NameDescriptionSerializer/properties/name' - "$.components.schemas.NameDescriptionSerializer.properties.name" - """ + """Name of the entity, following a specific format.""" description: Optional[str] - """ - '#/components/schemas/NameDescriptionSerializer/properties/description/anyOf/0' - "$.components.schemas.NameDescriptionSerializer.properties.description.anyOf[0]" - """ + """Description of the project.""" diff --git a/src/gcore/types/cloud/quota_get_all_response.py b/src/gcore/types/cloud/quota_get_all_response.py index 738fb2b2..c03ab710 100644 --- a/src/gcore/types/cloud/quota_get_all_response.py +++ b/src/gcore/types/cloud/quota_get_all_response.py @@ -9,659 +9,332 @@ class GlobalQuotas(BaseModel): inference_cpu_millicore_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_cpu_millicore_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_cpu_millicore_count_limit" - """ + """Inference CPU millicore count limit""" inference_cpu_millicore_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_cpu_millicore_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_cpu_millicore_count_usage" - """ + """Inference CPU millicore count usage""" inference_gpu_a100_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_a100_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_a100_count_limit" - """ + """Inference GPU A100 Count limit""" inference_gpu_a100_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_a100_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_a100_count_usage" - """ + """Inference GPU A100 Count usage""" inference_gpu_h100_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_h100_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_h100_count_limit" - """ + """Inference GPU H100 Count limit""" inference_gpu_h100_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_h100_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_h100_count_usage" - """ + """Inference GPU H100 Count usage""" inference_gpu_l40s_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_l40s_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_l40s_count_limit" - """ + """Inference GPU L40s Count limit""" inference_gpu_l40s_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_l40s_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_l40s_count_usage" - """ + """Inference GPU L40s Count usage""" inference_instance_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_instance_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_instance_count_limit" - """ + """Inference instance count limit""" inference_instance_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_instance_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_instance_count_usage" - """ + """Inference instance count usage""" keypair_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/keypair_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.keypair_count_limit" - """ + """SSH Keys Count limit""" keypair_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/keypair_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.keypair_count_usage" - """ + """SSH Keys Count usage""" project_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/project_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.project_count_limit" - """ + """Projects Count limit""" project_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/project_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.project_count_usage" - """ + """Projects Count usage""" class RegionalQuota(BaseModel): baremetal_basic_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_basic_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_basic_count_limit" - """ + """Basic bare metal servers count limit""" baremetal_basic_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_basic_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_basic_count_usage" - """ + """Basic bare metal servers count usage""" baremetal_gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_gpu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_gpu_count_limit" - """ + """AI GPU bare metal servers count limit""" baremetal_gpu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_gpu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_gpu_count_usage" - """ + """AI GPU bare metal servers count usage""" baremetal_hf_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_hf_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_hf_count_limit" - """ + """High-frequency bare metal servers count limit""" baremetal_hf_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_hf_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_hf_count_usage" - """ + """High-frequency bare metal servers count usage""" baremetal_infrastructure_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_infrastructure_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_infrastructure_count_limit" - """ + """Infrastructure bare metal servers count limit""" baremetal_infrastructure_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_infrastructure_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_infrastructure_count_usage" - """ + """Infrastructure bare metal servers count usage""" baremetal_network_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_network_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_network_count_limit" - """ + """Bare metal Network Count limit""" baremetal_network_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_network_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_network_count_usage" - """ + """Bare metal Network Count usage""" baremetal_storage_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_storage_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_storage_count_limit" - """ + """Storage bare metal servers count limit""" baremetal_storage_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_storage_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_storage_count_usage" - """ + """Storage bare metal servers count usage""" caas_container_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_container_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_container_count_limit" - """ + """Containers count limit""" caas_container_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_container_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_container_count_usage" - """ + """Containers count usage""" caas_cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_cpu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_cpu_count_limit" - """ + """mCPU count for containers limit""" caas_cpu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_cpu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_cpu_count_usage" - """ + """mCPU count for containers usage""" caas_gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_gpu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_gpu_count_limit" - """ + """Containers gpu count limit""" caas_gpu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_gpu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_gpu_count_usage" - """ + """Containers gpu count usage""" caas_ram_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_ram_size_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_ram_size_limit" - """ + """MB memory count for containers limit""" caas_ram_size_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_ram_size_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_ram_size_usage" - """ + """MB memory count for containers usage""" cluster_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/cluster_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.cluster_count_limit" - """ + """K8s clusters count limit""" cluster_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/cluster_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.cluster_count_usage" - """ + """K8s clusters count usage""" cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/cpu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.cpu_count_limit" - """ + """vCPU Count limit""" cpu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/cpu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.cpu_count_usage" - """ + """vCPU Count usage""" dbaas_postgres_cluster_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/dbaas_postgres_cluster_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.dbaas_postgres_cluster_count_limit" - """ + """DBaaS cluster count limit""" dbaas_postgres_cluster_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/dbaas_postgres_cluster_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.dbaas_postgres_cluster_count_usage" - """ + """DBaaS cluster count usage""" external_ip_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/external_ip_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.external_ip_count_limit" - """ + """External IP Count limit""" external_ip_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/external_ip_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.external_ip_count_usage" - """ + """External IP Count usage""" faas_cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_cpu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_cpu_count_limit" - """ + """mCPU count for functions limit""" faas_cpu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_cpu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_cpu_count_usage" - """ + """mCPU count for functions usage""" faas_function_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_function_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_function_count_limit" - """ + """Functions count limit""" faas_function_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_function_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_function_count_usage" - """ + """Functions count usage""" faas_namespace_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_namespace_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_namespace_count_limit" - """ + """Functions namespace count limit""" faas_namespace_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_namespace_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_namespace_count_usage" - """ + """Functions namespace count usage""" faas_ram_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_ram_size_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_ram_size_limit" - """ + """MB memory count for functions limit""" faas_ram_size_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_ram_size_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_ram_size_usage" - """ + """MB memory count for functions usage""" firewall_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/firewall_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.firewall_count_limit" - """ + """Firewalls Count limit""" firewall_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/firewall_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.firewall_count_usage" - """ + """Firewalls Count usage""" floating_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/floating_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.floating_count_limit" - """ + """Floating IP Count limit""" floating_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/floating_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.floating_count_usage" - """ + """Floating IP Count usage""" gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_count_limit" - """ + """GPU Count limit""" gpu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_count_usage" - """ + """GPU Count usage""" gpu_virtual_a100_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_a100_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_a100_count_limit" - """ + """Virtual A100 GPU card count limit""" gpu_virtual_a100_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_a100_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_a100_count_usage" - """ + """Virtual A100 GPU card count usage""" gpu_virtual_h100_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_h100_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_h100_count_limit" - """ + """Virtual H100 GPU card count limit""" gpu_virtual_h100_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_h100_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_h100_count_usage" - """ + """Virtual H100 GPU card count usage""" gpu_virtual_l40s_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_l40s_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_l40s_count_limit" - """ + """Virtual L40S GPU card count limit""" gpu_virtual_l40s_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_l40s_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_l40s_count_usage" - """ + """Virtual L40S GPU card count usage""" image_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/image_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.image_count_limit" - """ + """Images Count limit""" image_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/image_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.image_count_usage" - """ + """Images Count usage""" image_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/image_size_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.image_size_limit" - """ + """Images Size, GiB limit""" image_size_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/image_size_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.image_size_usage" - """ + """Images Size, GiB usage""" ipu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/ipu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.ipu_count_limit" - """ + """IPU Count limit""" ipu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/ipu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.ipu_count_usage" - """ + """IPU Count usage""" laas_topic_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/laas_topic_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.laas_topic_count_limit" - """ + """LaaS Topics Count limit""" laas_topic_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/laas_topic_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.laas_topic_count_usage" - """ + """LaaS Topics Count usage""" loadbalancer_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/loadbalancer_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.loadbalancer_count_limit" - """ + """Load Balancers Count limit""" loadbalancer_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/loadbalancer_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.loadbalancer_count_usage" - """ + """Load Balancers Count usage""" network_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/network_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.network_count_limit" - """ + """Networks Count limit""" network_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/network_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.network_count_usage" - """ + """Networks Count usage""" ram_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/ram_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.ram_limit" - """ + """RAM Size, GiB limit""" ram_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/ram_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.ram_usage" - """ + """RAM Size, GiB usage""" region_id: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/region_id' - "$.components.schemas.RegionalQuotasSerializer.properties.region_id" - """ + """Region ID""" registry_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/registry_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.registry_count_limit" - """ + """Registries count limit""" registry_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/registry_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.registry_count_usage" - """ + """Registries count usage""" registry_storage_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/registry_storage_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.registry_storage_limit" - """ + """Registries volume usage, GiB limit""" registry_storage_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/registry_storage_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.registry_storage_usage" - """ + """Registries volume usage, GiB usage""" router_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/router_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.router_count_limit" - """ + """Routers Count limit""" router_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/router_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.router_count_usage" - """ + """Routers Count usage""" secret_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/secret_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.secret_count_limit" - """ + """Secret Count limit""" secret_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/secret_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.secret_count_usage" - """ + """Secret Count usage""" servergroup_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/servergroup_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.servergroup_count_limit" - """ + """Placement Group Count limit""" servergroup_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/servergroup_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.servergroup_count_usage" - """ + """Placement Group Count usage""" sfs_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/sfs_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.sfs_count_limit" - """ + """Shared file system Count limit""" sfs_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/sfs_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.sfs_count_usage" - """ + """Shared file system Count usage""" sfs_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/sfs_size_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.sfs_size_limit" - """ + """Shared file system Size, GiB limit""" sfs_size_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/sfs_size_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.sfs_size_usage" - """ + """Shared file system Size, GiB usage""" shared_vm_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/shared_vm_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.shared_vm_count_limit" - """ + """Basic VMs Count limit""" shared_vm_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/shared_vm_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.shared_vm_count_usage" - """ + """Basic VMs Count usage""" snapshot_schedule_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/snapshot_schedule_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.snapshot_schedule_count_limit" - """ + """Snapshot Schedules Count limit""" snapshot_schedule_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/snapshot_schedule_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.snapshot_schedule_count_usage" - """ + """Snapshot Schedules Count usage""" subnet_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/subnet_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.subnet_count_limit" - """ + """Subnets Count limit""" subnet_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/subnet_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.subnet_count_usage" - """ + """Subnets Count usage""" vm_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/vm_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.vm_count_limit" - """ + """Instances Dedicated Count limit""" vm_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/vm_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.vm_count_usage" - """ + """Instances Dedicated Count usage""" volume_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_count_limit" - """ + """Volumes Count limit""" volume_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_count_usage" - """ + """Volumes Count usage""" volume_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_size_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_size_limit" - """ + """Volumes Size, GiB limit""" volume_size_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_size_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_size_usage" - """ + """Volumes Size, GiB usage""" volume_snapshots_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_count_limit" - """ + """Snapshots Count limit""" volume_snapshots_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_count_usage" - """ + """Snapshots Count usage""" volume_snapshots_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_size_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_size_limit" - """ + """Snapshots Size, GiB limit""" volume_snapshots_size_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_size_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_size_usage" - """ + """Snapshots Size, GiB usage""" class QuotaGetAllResponse(BaseModel): global_quotas: Optional[GlobalQuotas] = None - """ - '#/components/schemas/AllClientQuotasSerializer/properties/global_quotas' - "$.components.schemas.AllClientQuotasSerializer.properties.global_quotas" - """ + """Global entity quotas""" regional_quotas: Optional[List[RegionalQuota]] = None - """ - '#/components/schemas/AllClientQuotasSerializer/properties/regional_quotas' - "$.components.schemas.AllClientQuotasSerializer.properties.regional_quotas" - """ + """Regional entity quotas. Only contains initialized quotas.""" diff --git a/src/gcore/types/cloud/quota_get_by_region_response.py b/src/gcore/types/cloud/quota_get_by_region_response.py index a523b610..f34fa83c 100644 --- a/src/gcore/types/cloud/quota_get_by_region_response.py +++ b/src/gcore/types/cloud/quota_get_by_region_response.py @@ -9,559 +9,280 @@ class QuotaGetByRegionResponse(BaseModel): baremetal_basic_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_basic_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_basic_count_limit" - """ + """Basic bare metal servers count limit""" baremetal_basic_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_basic_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_basic_count_usage" - """ + """Basic bare metal servers count usage""" baremetal_gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_gpu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_gpu_count_limit" - """ + """AI GPU bare metal servers count limit""" baremetal_gpu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_gpu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_gpu_count_usage" - """ + """AI GPU bare metal servers count usage""" baremetal_hf_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_hf_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_hf_count_limit" - """ + """High-frequency bare metal servers count limit""" baremetal_hf_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_hf_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_hf_count_usage" - """ + """High-frequency bare metal servers count usage""" baremetal_infrastructure_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_infrastructure_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_infrastructure_count_limit" - """ + """Infrastructure bare metal servers count limit""" baremetal_infrastructure_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_infrastructure_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_infrastructure_count_usage" - """ + """Infrastructure bare metal servers count usage""" baremetal_network_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_network_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_network_count_limit" - """ + """Bare metal Network Count limit""" baremetal_network_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_network_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_network_count_usage" - """ + """Bare metal Network Count usage""" baremetal_storage_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_storage_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_storage_count_limit" - """ + """Storage bare metal servers count limit""" baremetal_storage_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/baremetal_storage_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.baremetal_storage_count_usage" - """ + """Storage bare metal servers count usage""" caas_container_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_container_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_container_count_limit" - """ + """Containers count limit""" caas_container_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_container_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_container_count_usage" - """ + """Containers count usage""" caas_cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_cpu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_cpu_count_limit" - """ + """mCPU count for containers limit""" caas_cpu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_cpu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_cpu_count_usage" - """ + """mCPU count for containers usage""" caas_gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_gpu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_gpu_count_limit" - """ + """Containers gpu count limit""" caas_gpu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_gpu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_gpu_count_usage" - """ + """Containers gpu count usage""" caas_ram_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_ram_size_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_ram_size_limit" - """ + """MB memory count for containers limit""" caas_ram_size_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/caas_ram_size_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.caas_ram_size_usage" - """ + """MB memory count for containers usage""" cluster_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/cluster_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.cluster_count_limit" - """ + """K8s clusters count limit""" cluster_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/cluster_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.cluster_count_usage" - """ + """K8s clusters count usage""" cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/cpu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.cpu_count_limit" - """ + """vCPU Count limit""" cpu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/cpu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.cpu_count_usage" - """ + """vCPU Count usage""" dbaas_postgres_cluster_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/dbaas_postgres_cluster_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.dbaas_postgres_cluster_count_limit" - """ + """DBaaS cluster count limit""" dbaas_postgres_cluster_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/dbaas_postgres_cluster_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.dbaas_postgres_cluster_count_usage" - """ + """DBaaS cluster count usage""" external_ip_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/external_ip_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.external_ip_count_limit" - """ + """External IP Count limit""" external_ip_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/external_ip_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.external_ip_count_usage" - """ + """External IP Count usage""" faas_cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_cpu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_cpu_count_limit" - """ + """mCPU count for functions limit""" faas_cpu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_cpu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_cpu_count_usage" - """ + """mCPU count for functions usage""" faas_function_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_function_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_function_count_limit" - """ + """Functions count limit""" faas_function_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_function_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_function_count_usage" - """ + """Functions count usage""" faas_namespace_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_namespace_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_namespace_count_limit" - """ + """Functions namespace count limit""" faas_namespace_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_namespace_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_namespace_count_usage" - """ + """Functions namespace count usage""" faas_ram_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_ram_size_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_ram_size_limit" - """ + """MB memory count for functions limit""" faas_ram_size_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/faas_ram_size_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.faas_ram_size_usage" - """ + """MB memory count for functions usage""" firewall_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/firewall_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.firewall_count_limit" - """ + """Firewalls Count limit""" firewall_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/firewall_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.firewall_count_usage" - """ + """Firewalls Count usage""" floating_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/floating_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.floating_count_limit" - """ + """Floating IP Count limit""" floating_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/floating_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.floating_count_usage" - """ + """Floating IP Count usage""" gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_count_limit" - """ + """GPU Count limit""" gpu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_count_usage" - """ + """GPU Count usage""" gpu_virtual_a100_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_a100_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_a100_count_limit" - """ + """Virtual A100 GPU card count limit""" gpu_virtual_a100_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_a100_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_a100_count_usage" - """ + """Virtual A100 GPU card count usage""" gpu_virtual_h100_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_h100_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_h100_count_limit" - """ + """Virtual H100 GPU card count limit""" gpu_virtual_h100_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_h100_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_h100_count_usage" - """ + """Virtual H100 GPU card count usage""" gpu_virtual_l40s_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_l40s_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_l40s_count_limit" - """ + """Virtual L40S GPU card count limit""" gpu_virtual_l40s_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/gpu_virtual_l40s_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.gpu_virtual_l40s_count_usage" - """ + """Virtual L40S GPU card count usage""" image_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/image_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.image_count_limit" - """ + """Images Count limit""" image_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/image_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.image_count_usage" - """ + """Images Count usage""" image_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/image_size_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.image_size_limit" - """ + """Images Size, GiB limit""" image_size_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/image_size_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.image_size_usage" - """ + """Images Size, GiB usage""" ipu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/ipu_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.ipu_count_limit" - """ + """IPU Count limit""" ipu_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/ipu_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.ipu_count_usage" - """ + """IPU Count usage""" laas_topic_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/laas_topic_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.laas_topic_count_limit" - """ + """LaaS Topics Count limit""" laas_topic_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/laas_topic_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.laas_topic_count_usage" - """ + """LaaS Topics Count usage""" loadbalancer_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/loadbalancer_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.loadbalancer_count_limit" - """ + """Load Balancers Count limit""" loadbalancer_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/loadbalancer_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.loadbalancer_count_usage" - """ + """Load Balancers Count usage""" network_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/network_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.network_count_limit" - """ + """Networks Count limit""" network_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/network_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.network_count_usage" - """ + """Networks Count usage""" ram_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/ram_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.ram_limit" - """ + """RAM Size, GiB limit""" ram_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/ram_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.ram_usage" - """ + """RAM Size, GiB usage""" region_id: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/region_id' - "$.components.schemas.RegionalQuotasSerializer.properties.region_id" - """ + """Region ID""" registry_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/registry_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.registry_count_limit" - """ + """Registries count limit""" registry_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/registry_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.registry_count_usage" - """ + """Registries count usage""" registry_storage_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/registry_storage_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.registry_storage_limit" - """ + """Registries volume usage, GiB limit""" registry_storage_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/registry_storage_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.registry_storage_usage" - """ + """Registries volume usage, GiB usage""" router_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/router_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.router_count_limit" - """ + """Routers Count limit""" router_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/router_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.router_count_usage" - """ + """Routers Count usage""" secret_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/secret_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.secret_count_limit" - """ + """Secret Count limit""" secret_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/secret_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.secret_count_usage" - """ + """Secret Count usage""" servergroup_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/servergroup_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.servergroup_count_limit" - """ + """Placement Group Count limit""" servergroup_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/servergroup_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.servergroup_count_usage" - """ + """Placement Group Count usage""" sfs_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/sfs_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.sfs_count_limit" - """ + """Shared file system Count limit""" sfs_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/sfs_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.sfs_count_usage" - """ + """Shared file system Count usage""" sfs_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/sfs_size_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.sfs_size_limit" - """ + """Shared file system Size, GiB limit""" sfs_size_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/sfs_size_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.sfs_size_usage" - """ + """Shared file system Size, GiB usage""" shared_vm_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/shared_vm_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.shared_vm_count_limit" - """ + """Basic VMs Count limit""" shared_vm_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/shared_vm_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.shared_vm_count_usage" - """ + """Basic VMs Count usage""" snapshot_schedule_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/snapshot_schedule_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.snapshot_schedule_count_limit" - """ + """Snapshot Schedules Count limit""" snapshot_schedule_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/snapshot_schedule_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.snapshot_schedule_count_usage" - """ + """Snapshot Schedules Count usage""" subnet_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/subnet_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.subnet_count_limit" - """ + """Subnets Count limit""" subnet_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/subnet_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.subnet_count_usage" - """ + """Subnets Count usage""" vm_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/vm_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.vm_count_limit" - """ + """Instances Dedicated Count limit""" vm_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/vm_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.vm_count_usage" - """ + """Instances Dedicated Count usage""" volume_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_count_limit" - """ + """Volumes Count limit""" volume_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_count_usage" - """ + """Volumes Count usage""" volume_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_size_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_size_limit" - """ + """Volumes Size, GiB limit""" volume_size_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_size_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_size_usage" - """ + """Volumes Size, GiB usage""" volume_snapshots_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_count_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_count_limit" - """ + """Snapshots Count limit""" volume_snapshots_count_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_count_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_count_usage" - """ + """Snapshots Count usage""" volume_snapshots_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_size_limit' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_size_limit" - """ + """Snapshots Size, GiB limit""" volume_snapshots_size_usage: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasSerializer/properties/volume_snapshots_size_usage' - "$.components.schemas.RegionalQuotasSerializer.properties.volume_snapshots_size_usage" - """ + """Snapshots Size, GiB usage""" diff --git a/src/gcore/types/cloud/quota_get_global_response.py b/src/gcore/types/cloud/quota_get_global_response.py index 02b4b236..39773e14 100644 --- a/src/gcore/types/cloud/quota_get_global_response.py +++ b/src/gcore/types/cloud/quota_get_global_response.py @@ -9,85 +9,43 @@ class QuotaGetGlobalResponse(BaseModel): inference_cpu_millicore_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_cpu_millicore_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_cpu_millicore_count_limit" - """ + """Inference CPU millicore count limit""" inference_cpu_millicore_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_cpu_millicore_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_cpu_millicore_count_usage" - """ + """Inference CPU millicore count usage""" inference_gpu_a100_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_a100_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_a100_count_limit" - """ + """Inference GPU A100 Count limit""" inference_gpu_a100_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_a100_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_a100_count_usage" - """ + """Inference GPU A100 Count usage""" inference_gpu_h100_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_h100_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_h100_count_limit" - """ + """Inference GPU H100 Count limit""" inference_gpu_h100_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_h100_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_h100_count_usage" - """ + """Inference GPU H100 Count usage""" inference_gpu_l40s_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_l40s_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_l40s_count_limit" - """ + """Inference GPU L40s Count limit""" inference_gpu_l40s_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_gpu_l40s_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_gpu_l40s_count_usage" - """ + """Inference GPU L40s Count usage""" inference_instance_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_instance_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_instance_count_limit" - """ + """Inference instance count limit""" inference_instance_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/inference_instance_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.inference_instance_count_usage" - """ + """Inference instance count usage""" keypair_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/keypair_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.keypair_count_limit" - """ + """SSH Keys Count limit""" keypair_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/keypair_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.keypair_count_usage" - """ + """SSH Keys Count usage""" project_count_limit: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/project_count_limit' - "$.components.schemas.GlobalQuotasSerializer.properties.project_count_limit" - """ + """Projects Count limit""" project_count_usage: Optional[int] = None - """ - '#/components/schemas/GlobalQuotasSerializer/properties/project_count_usage' - "$.components.schemas.GlobalQuotasSerializer.properties.project_count_usage" - """ + """Projects Count usage""" diff --git a/src/gcore/types/cloud/quotas/request_create_params.py b/src/gcore/types/cloud/quotas/request_create_params.py index 8599dc94..1a7ac333 100644 --- a/src/gcore/types/cloud/quotas/request_create_params.py +++ b/src/gcore/types/cloud/quotas/request_create_params.py @@ -10,361 +10,184 @@ class RequestCreateParams(TypedDict, total=False): description: Required[str] - """ - '#/components/schemas/LimitsRequestCreateSerializer/properties/description' - "$.components.schemas.LimitsRequestCreateSerializer.properties.description" - """ + """Describe the reason, in general terms.""" requested_limits: Required[RequestedLimits] - """ - '#/components/schemas/LimitsRequestCreateSerializer/properties/requested_limits' - "$.components.schemas.LimitsRequestCreateSerializer.properties.requested_limits" - """ + """Limits you want to increase.""" client_id: int - """ - '#/components/schemas/LimitsRequestCreateSerializer/properties/client_id' - "$.components.schemas.LimitsRequestCreateSerializer.properties.client_id" - """ + """Client ID that requests the limit increase.""" class RequestedLimitsGlobalLimits(TypedDict, total=False): inference_cpu_millicore_count_limit: int - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_cpu_millicore_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_cpu_millicore_count_limit" - """ + """Inference CPU millicore count limit""" inference_gpu_a100_count_limit: int - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_a100_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_a100_count_limit" - """ + """Inference GPU A100 Count limit""" inference_gpu_h100_count_limit: int - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_h100_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_h100_count_limit" - """ + """Inference GPU H100 Count limit""" inference_gpu_l40s_count_limit: int - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_l40s_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_l40s_count_limit" - """ + """Inference GPU L40s Count limit""" inference_instance_count_limit: int - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_instance_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_instance_count_limit" - """ + """Inference instance count limit""" keypair_count_limit: int - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/keypair_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.keypair_count_limit" - """ + """SSH Keys Count limit""" project_count_limit: int - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/project_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.project_count_limit" - """ + """Projects Count limit""" class RequestedLimitsRegionalLimit(TypedDict, total=False): baremetal_basic_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_basic_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_basic_count_limit" - """ + """Basic bare metal servers count limit""" baremetal_gpu_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_gpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_gpu_count_limit" - """ + """AI GPU bare metal servers count limit""" baremetal_hf_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_hf_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_hf_count_limit" - """ + """High-frequency bare metal servers count limit""" baremetal_infrastructure_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_infrastructure_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_infrastructure_count_limit" - """ + """Infrastructure bare metal servers count limit""" baremetal_network_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_network_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_network_count_limit" - """ + """Bare metal Network Count limit""" baremetal_storage_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_storage_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_storage_count_limit" - """ + """Storage bare metal servers count limit""" caas_container_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_container_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_container_count_limit" - """ + """Containers count limit""" caas_cpu_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_cpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_cpu_count_limit" - """ + """mCPU count for containers limit""" caas_gpu_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_gpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_gpu_count_limit" - """ + """Containers gpu count limit""" caas_ram_size_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_ram_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_ram_size_limit" - """ + """MB memory count for containers limit""" cluster_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cluster_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cluster_count_limit" - """ + """K8s clusters count limit""" cpu_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cpu_count_limit" - """ + """vCPU Count limit""" dbaas_postgres_cluster_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/dbaas_postgres_cluster_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.dbaas_postgres_cluster_count_limit" - """ + """DBaaS cluster count limit""" external_ip_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/external_ip_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.external_ip_count_limit" - """ + """External IP Count limit""" faas_cpu_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_cpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_cpu_count_limit" - """ + """mCPU count for functions limit""" faas_function_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_function_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_function_count_limit" - """ + """Functions count limit""" faas_namespace_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_namespace_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_namespace_count_limit" - """ + """Functions namespace count limit""" faas_ram_size_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_ram_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_ram_size_limit" - """ + """MB memory count for functions limit""" firewall_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/firewall_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.firewall_count_limit" - """ + """Firewalls Count limit""" floating_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/floating_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.floating_count_limit" - """ + """Floating IP Count limit""" gpu_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_count_limit" - """ + """GPU Count limit""" gpu_virtual_a100_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_a100_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_a100_count_limit" - """ + """Virtual A100 GPU card count limit""" gpu_virtual_h100_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_h100_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_h100_count_limit" - """ + """Virtual H100 GPU card count limit""" gpu_virtual_l40s_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_l40s_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_l40s_count_limit" - """ + """Virtual L40S GPU card count limit""" image_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_count_limit" - """ + """Images Count limit""" image_size_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_size_limit" - """ + """Images Size, GiB limit""" ipu_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ipu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ipu_count_limit" - """ + """IPU Count limit""" laas_topic_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/laas_topic_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.laas_topic_count_limit" - """ + """LaaS Topics Count limit""" loadbalancer_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/loadbalancer_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.loadbalancer_count_limit" - """ + """Load Balancers Count limit""" network_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/network_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.network_count_limit" - """ + """Networks Count limit""" ram_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ram_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ram_limit" - """ + """RAM Size, GiB limit""" region_id: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/region_id' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.region_id" - """ + """Region ID""" registry_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_count_limit" - """ + """Registries count limit""" registry_storage_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_storage_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_storage_limit" - """ + """Registries volume usage, GiB limit""" router_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/router_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.router_count_limit" - """ + """Routers Count limit""" secret_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/secret_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.secret_count_limit" - """ + """Secret Count limit""" servergroup_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/servergroup_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.servergroup_count_limit" - """ + """Placement Group Count limit""" sfs_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_count_limit" - """ + """Shared file system Count limit""" sfs_size_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_size_limit" - """ + """Shared file system Size, GiB limit""" shared_vm_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/shared_vm_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.shared_vm_count_limit" - """ + """Basic VMs Count limit""" snapshot_schedule_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/snapshot_schedule_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.snapshot_schedule_count_limit" - """ + """Snapshot Schedules Count limit""" subnet_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/subnet_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.subnet_count_limit" - """ + """Subnets Count limit""" vm_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/vm_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.vm_count_limit" - """ + """Instances Dedicated Count limit""" volume_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_count_limit" - """ + """Volumes Count limit""" volume_size_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_size_limit" - """ + """Volumes Size, GiB limit""" volume_snapshots_count_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_count_limit" - """ + """Snapshots Count limit""" volume_snapshots_size_limit: int - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_size_limit" - """ + """Snapshots Size, GiB limit""" class RequestedLimits(TypedDict, total=False): global_limits: RequestedLimitsGlobalLimits - """ - '#/components/schemas/ClientMixedQuotasLimitsSerializer/properties/global_limits' - "$.components.schemas.ClientMixedQuotasLimitsSerializer.properties.global_limits" - """ + """Global entity quota limits""" regional_limits: Iterable[RequestedLimitsRegionalLimit] - """ - '#/components/schemas/ClientMixedQuotasLimitsSerializer/properties/regional_limits' - "$.components.schemas.ClientMixedQuotasLimitsSerializer.properties.regional_limits" - """ + """Regions and their 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 3a85f8fb..d01ceddc 100644 --- a/src/gcore/types/cloud/quotas/request_get_response.py +++ b/src/gcore/types/cloud/quotas/request_get_response.py @@ -10,385 +10,196 @@ class RequestedLimitsGlobalLimits(BaseModel): inference_cpu_millicore_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_cpu_millicore_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_cpu_millicore_count_limit" - """ + """Inference CPU millicore count limit""" inference_gpu_a100_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_a100_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_a100_count_limit" - """ + """Inference GPU A100 Count limit""" inference_gpu_h100_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_h100_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_h100_count_limit" - """ + """Inference GPU H100 Count limit""" inference_gpu_l40s_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_l40s_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_l40s_count_limit" - """ + """Inference GPU L40s Count limit""" inference_instance_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_instance_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_instance_count_limit" - """ + """Inference instance count limit""" keypair_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/keypair_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.keypair_count_limit" - """ + """SSH Keys Count limit""" project_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/project_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.project_count_limit" - """ + """Projects Count limit""" class RequestedLimitsRegionalLimit(BaseModel): baremetal_basic_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_basic_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_basic_count_limit" - """ + """Basic bare metal servers count limit""" baremetal_gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_gpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_gpu_count_limit" - """ + """AI GPU bare metal servers count limit""" baremetal_hf_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_hf_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_hf_count_limit" - """ + """High-frequency bare metal servers count limit""" baremetal_infrastructure_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_infrastructure_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_infrastructure_count_limit" - """ + """Infrastructure bare metal servers count limit""" baremetal_network_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_network_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_network_count_limit" - """ + """Bare metal Network Count limit""" baremetal_storage_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_storage_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_storage_count_limit" - """ + """Storage bare metal servers count limit""" caas_container_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_container_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_container_count_limit" - """ + """Containers count limit""" caas_cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_cpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_cpu_count_limit" - """ + """mCPU count for containers limit""" caas_gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_gpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_gpu_count_limit" - """ + """Containers gpu count limit""" caas_ram_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_ram_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_ram_size_limit" - """ + """MB memory count for containers limit""" cluster_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cluster_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cluster_count_limit" - """ + """K8s clusters count limit""" cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cpu_count_limit" - """ + """vCPU Count limit""" dbaas_postgres_cluster_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/dbaas_postgres_cluster_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.dbaas_postgres_cluster_count_limit" - """ + """DBaaS cluster count limit""" external_ip_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/external_ip_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.external_ip_count_limit" - """ + """External IP Count limit""" faas_cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_cpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_cpu_count_limit" - """ + """mCPU count for functions limit""" faas_function_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_function_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_function_count_limit" - """ + """Functions count limit""" faas_namespace_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_namespace_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_namespace_count_limit" - """ + """Functions namespace count limit""" faas_ram_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_ram_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_ram_size_limit" - """ + """MB memory count for functions limit""" firewall_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/firewall_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.firewall_count_limit" - """ + """Firewalls Count limit""" floating_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/floating_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.floating_count_limit" - """ + """Floating IP Count limit""" gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_count_limit" - """ + """GPU Count limit""" gpu_virtual_a100_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_a100_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_a100_count_limit" - """ + """Virtual A100 GPU card count limit""" gpu_virtual_h100_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_h100_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_h100_count_limit" - """ + """Virtual H100 GPU card count limit""" gpu_virtual_l40s_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_l40s_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_l40s_count_limit" - """ + """Virtual L40S GPU card count limit""" image_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_count_limit" - """ + """Images Count limit""" image_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_size_limit" - """ + """Images Size, GiB limit""" ipu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ipu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ipu_count_limit" - """ + """IPU Count limit""" laas_topic_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/laas_topic_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.laas_topic_count_limit" - """ + """LaaS Topics Count limit""" loadbalancer_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/loadbalancer_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.loadbalancer_count_limit" - """ + """Load Balancers Count limit""" network_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/network_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.network_count_limit" - """ + """Networks Count limit""" ram_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ram_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ram_limit" - """ + """RAM Size, GiB limit""" region_id: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/region_id' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.region_id" - """ + """Region ID""" registry_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_count_limit" - """ + """Registries count limit""" registry_storage_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_storage_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_storage_limit" - """ + """Registries volume usage, GiB limit""" router_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/router_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.router_count_limit" - """ + """Routers Count limit""" secret_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/secret_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.secret_count_limit" - """ + """Secret Count limit""" servergroup_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/servergroup_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.servergroup_count_limit" - """ + """Placement Group Count limit""" sfs_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_count_limit" - """ + """Shared file system Count limit""" sfs_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_size_limit" - """ + """Shared file system Size, GiB limit""" shared_vm_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/shared_vm_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.shared_vm_count_limit" - """ + """Basic VMs Count limit""" snapshot_schedule_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/snapshot_schedule_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.snapshot_schedule_count_limit" - """ + """Snapshot Schedules Count limit""" subnet_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/subnet_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.subnet_count_limit" - """ + """Subnets Count limit""" vm_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/vm_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.vm_count_limit" - """ + """Instances Dedicated Count limit""" volume_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_count_limit" - """ + """Volumes Count limit""" volume_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_size_limit" - """ + """Volumes Size, GiB limit""" volume_snapshots_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_count_limit" - """ + """Snapshots Count limit""" volume_snapshots_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_size_limit" - """ + """Snapshots Size, GiB limit""" class RequestedLimits(BaseModel): global_limits: Optional[RequestedLimitsGlobalLimits] = None - """ - '#/components/schemas/AllClientQuotasLimitsSerializer/properties/global_limits' - "$.components.schemas.AllClientQuotasLimitsSerializer.properties.global_limits" - """ + """Global entity quota limits""" regional_limits: Optional[List[RequestedLimitsRegionalLimit]] = None - """ - '#/components/schemas/AllClientQuotasLimitsSerializer/properties/regional_limits' - "$.components.schemas.AllClientQuotasLimitsSerializer.properties.regional_limits" - """ + """Regions and their quota limits""" class RequestGetResponse(BaseModel): id: int - """ - '#/components/schemas/LimitsRequestSerializer/properties/id' - "$.components.schemas.LimitsRequestSerializer.properties.id" - """ + """Request ID""" client_id: int - """ - '#/components/schemas/LimitsRequestSerializer/properties/client_id' - "$.components.schemas.LimitsRequestSerializer.properties.client_id" - """ + """Client ID""" requested_limits: RequestedLimits - """ - '#/components/schemas/LimitsRequestSerializer/properties/requested_limits' - "$.components.schemas.LimitsRequestSerializer.properties.requested_limits" - """ + """Requested limits.""" status: str - """ - '#/components/schemas/LimitsRequestSerializer/properties/status' - "$.components.schemas.LimitsRequestSerializer.properties.status" - """ + """Request status""" created_at: Optional[datetime] = None - """ - '#/components/schemas/LimitsRequestSerializer/properties/created_at' - "$.components.schemas.LimitsRequestSerializer.properties.created_at" - """ + """Datetime when the request was created.""" description: Optional[str] = None - """ - '#/components/schemas/LimitsRequestSerializer/properties/description/anyOf/0' - "$.components.schemas.LimitsRequestSerializer.properties.description.anyOf[0]" - """ + """Describe the reason, in general terms.""" updated_at: Optional[datetime] = None - """ - '#/components/schemas/LimitsRequestSerializer/properties/updated_at/anyOf/0' - "$.components.schemas.LimitsRequestSerializer.properties.updated_at.anyOf[0]" - """ + """Datetime when the request was updated.""" diff --git a/src/gcore/types/cloud/quotas/request_list_params.py b/src/gcore/types/cloud/quotas/request_list_params.py index 6449b0ec..556abaa1 100644 --- a/src/gcore/types/cloud/quotas/request_list_params.py +++ b/src/gcore/types/cloud/quotas/request_list_params.py @@ -10,19 +10,13 @@ class RequestListParams(TypedDict, total=False): limit: int - """ - '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/0' - "$.paths['/cloud/v2/limits_request'].get.parameters[0]" - """ + """Optional. Limit the number of returned items""" offset: int - """ - '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/1' - "$.paths['/cloud/v2/limits_request'].get.parameters[1]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ status: Optional[List[Literal["done", "in progress", "rejected"]]] - """ - '#/paths/%2Fcloud%2Fv2%2Flimits_request/get/parameters/2/schema/anyOf/0' - "$.paths['/cloud/v2/limits_request'].get.parameters[2].schema.anyOf[0]" - """ + """List of limit requests statuses for filtering""" diff --git a/src/gcore/types/cloud/quotas/request_list_response.py b/src/gcore/types/cloud/quotas/request_list_response.py index 7d043c9c..8eea5070 100644 --- a/src/gcore/types/cloud/quotas/request_list_response.py +++ b/src/gcore/types/cloud/quotas/request_list_response.py @@ -10,385 +10,196 @@ class RequestedLimitsGlobalLimits(BaseModel): inference_cpu_millicore_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_cpu_millicore_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_cpu_millicore_count_limit" - """ + """Inference CPU millicore count limit""" inference_gpu_a100_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_a100_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_a100_count_limit" - """ + """Inference GPU A100 Count limit""" inference_gpu_h100_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_h100_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_h100_count_limit" - """ + """Inference GPU H100 Count limit""" inference_gpu_l40s_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_gpu_l40s_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_gpu_l40s_count_limit" - """ + """Inference GPU L40s Count limit""" inference_instance_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/inference_instance_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.inference_instance_count_limit" - """ + """Inference instance count limit""" keypair_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/keypair_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.keypair_count_limit" - """ + """SSH Keys Count limit""" project_count_limit: Optional[int] = None - """ - '#/components/schemas/CreateGlobalQuotasLimitsSerializer/properties/project_count_limit' - "$.components.schemas.CreateGlobalQuotasLimitsSerializer.properties.project_count_limit" - """ + """Projects Count limit""" class RequestedLimitsRegionalLimit(BaseModel): baremetal_basic_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_basic_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_basic_count_limit" - """ + """Basic bare metal servers count limit""" baremetal_gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_gpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_gpu_count_limit" - """ + """AI GPU bare metal servers count limit""" baremetal_hf_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_hf_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_hf_count_limit" - """ + """High-frequency bare metal servers count limit""" baremetal_infrastructure_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_infrastructure_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_infrastructure_count_limit" - """ + """Infrastructure bare metal servers count limit""" baremetal_network_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_network_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_network_count_limit" - """ + """Bare metal Network Count limit""" baremetal_storage_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/baremetal_storage_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.baremetal_storage_count_limit" - """ + """Storage bare metal servers count limit""" caas_container_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_container_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_container_count_limit" - """ + """Containers count limit""" caas_cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_cpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_cpu_count_limit" - """ + """mCPU count for containers limit""" caas_gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_gpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_gpu_count_limit" - """ + """Containers gpu count limit""" caas_ram_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/caas_ram_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.caas_ram_size_limit" - """ + """MB memory count for containers limit""" cluster_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cluster_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cluster_count_limit" - """ + """K8s clusters count limit""" cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/cpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.cpu_count_limit" - """ + """vCPU Count limit""" dbaas_postgres_cluster_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/dbaas_postgres_cluster_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.dbaas_postgres_cluster_count_limit" - """ + """DBaaS cluster count limit""" external_ip_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/external_ip_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.external_ip_count_limit" - """ + """External IP Count limit""" faas_cpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_cpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_cpu_count_limit" - """ + """mCPU count for functions limit""" faas_function_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_function_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_function_count_limit" - """ + """Functions count limit""" faas_namespace_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_namespace_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_namespace_count_limit" - """ + """Functions namespace count limit""" faas_ram_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/faas_ram_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.faas_ram_size_limit" - """ + """MB memory count for functions limit""" firewall_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/firewall_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.firewall_count_limit" - """ + """Firewalls Count limit""" floating_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/floating_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.floating_count_limit" - """ + """Floating IP Count limit""" gpu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_count_limit" - """ + """GPU Count limit""" gpu_virtual_a100_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_a100_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_a100_count_limit" - """ + """Virtual A100 GPU card count limit""" gpu_virtual_h100_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_h100_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_h100_count_limit" - """ + """Virtual H100 GPU card count limit""" gpu_virtual_l40s_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/gpu_virtual_l40s_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.gpu_virtual_l40s_count_limit" - """ + """Virtual L40S GPU card count limit""" image_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_count_limit" - """ + """Images Count limit""" image_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/image_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.image_size_limit" - """ + """Images Size, GiB limit""" ipu_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ipu_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ipu_count_limit" - """ + """IPU Count limit""" laas_topic_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/laas_topic_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.laas_topic_count_limit" - """ + """LaaS Topics Count limit""" loadbalancer_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/loadbalancer_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.loadbalancer_count_limit" - """ + """Load Balancers Count limit""" network_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/network_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.network_count_limit" - """ + """Networks Count limit""" ram_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/ram_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.ram_limit" - """ + """RAM Size, GiB limit""" region_id: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/region_id' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.region_id" - """ + """Region ID""" registry_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_count_limit" - """ + """Registries count limit""" registry_storage_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/registry_storage_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.registry_storage_limit" - """ + """Registries volume usage, GiB limit""" router_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/router_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.router_count_limit" - """ + """Routers Count limit""" secret_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/secret_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.secret_count_limit" - """ + """Secret Count limit""" servergroup_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/servergroup_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.servergroup_count_limit" - """ + """Placement Group Count limit""" sfs_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_count_limit" - """ + """Shared file system Count limit""" sfs_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/sfs_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.sfs_size_limit" - """ + """Shared file system Size, GiB limit""" shared_vm_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/shared_vm_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.shared_vm_count_limit" - """ + """Basic VMs Count limit""" snapshot_schedule_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/snapshot_schedule_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.snapshot_schedule_count_limit" - """ + """Snapshot Schedules Count limit""" subnet_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/subnet_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.subnet_count_limit" - """ + """Subnets Count limit""" vm_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/vm_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.vm_count_limit" - """ + """Instances Dedicated Count limit""" volume_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_count_limit" - """ + """Volumes Count limit""" volume_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_size_limit" - """ + """Volumes Size, GiB limit""" volume_snapshots_count_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_count_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_count_limit" - """ + """Snapshots Count limit""" volume_snapshots_size_limit: Optional[int] = None - """ - '#/components/schemas/RegionalQuotasLimitsSerializer/properties/volume_snapshots_size_limit' - "$.components.schemas.RegionalQuotasLimitsSerializer.properties.volume_snapshots_size_limit" - """ + """Snapshots Size, GiB limit""" class RequestedLimits(BaseModel): global_limits: Optional[RequestedLimitsGlobalLimits] = None - """ - '#/components/schemas/AllClientQuotasLimitsSerializer/properties/global_limits' - "$.components.schemas.AllClientQuotasLimitsSerializer.properties.global_limits" - """ + """Global entity quota limits""" regional_limits: Optional[List[RequestedLimitsRegionalLimit]] = None - """ - '#/components/schemas/AllClientQuotasLimitsSerializer/properties/regional_limits' - "$.components.schemas.AllClientQuotasLimitsSerializer.properties.regional_limits" - """ + """Regions and their quota limits""" class RequestListResponse(BaseModel): id: int - """ - '#/components/schemas/LimitsRequestSerializer/properties/id' - "$.components.schemas.LimitsRequestSerializer.properties.id" - """ + """Request ID""" client_id: int - """ - '#/components/schemas/LimitsRequestSerializer/properties/client_id' - "$.components.schemas.LimitsRequestSerializer.properties.client_id" - """ + """Client ID""" requested_limits: RequestedLimits - """ - '#/components/schemas/LimitsRequestSerializer/properties/requested_limits' - "$.components.schemas.LimitsRequestSerializer.properties.requested_limits" - """ + """Requested limits.""" status: str - """ - '#/components/schemas/LimitsRequestSerializer/properties/status' - "$.components.schemas.LimitsRequestSerializer.properties.status" - """ + """Request status""" created_at: Optional[datetime] = None - """ - '#/components/schemas/LimitsRequestSerializer/properties/created_at' - "$.components.schemas.LimitsRequestSerializer.properties.created_at" - """ + """Datetime when the request was created.""" description: Optional[str] = None - """ - '#/components/schemas/LimitsRequestSerializer/properties/description/anyOf/0' - "$.components.schemas.LimitsRequestSerializer.properties.description.anyOf[0]" - """ + """Describe the reason, in general terms.""" updated_at: Optional[datetime] = None - """ - '#/components/schemas/LimitsRequestSerializer/properties/updated_at/anyOf/0' - "$.components.schemas.LimitsRequestSerializer.properties.updated_at.anyOf[0]" - """ + """Datetime when the request was updated.""" diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py index 0b596685..343f0707 100644 --- a/src/gcore/types/cloud/region.py +++ b/src/gcore/types/cloud/region.py @@ -11,183 +11,91 @@ class Coordinates(BaseModel): latitude: float - """ - '#/components/schemas/Coordinate/properties/latitude' - "$.components.schemas.Coordinate.properties.latitude" - """ longitude: float - """ - '#/components/schemas/Coordinate/properties/longitude' - "$.components.schemas.Coordinate.properties.longitude" - """ class Region(BaseModel): id: int - """ - '#/components/schemas/RegionSerializer/properties/id' - "$.components.schemas.RegionSerializer.properties.id" - """ + """Region ID""" access_level: Literal["core", "edge"] - """ - '#/components/schemas/RegionSerializer/properties/access_level' - "$.components.schemas.RegionSerializer.properties.access_level" - """ + """The access level of the region.""" ai_service_endpoint_id: Optional[int] = None - """ - '#/components/schemas/RegionSerializer/properties/ai_service_endpoint_id/anyOf/0' - "$.components.schemas.RegionSerializer.properties.ai_service_endpoint_id.anyOf[0]" - """ + """AI service API endpoint ID""" available_volume_types: Optional[List[str]] = None - """ - '#/components/schemas/RegionSerializer/properties/available_volume_types/anyOf/0' - "$.components.schemas.RegionSerializer.properties.available_volume_types.anyOf[0]" - """ + """List of available volume types, 'standard', 'ssd_hiiops', 'cold'].""" coordinates: Optional[Coordinates] = None - """ - '#/components/schemas/RegionSerializer/properties/coordinates/anyOf/0' - "$.components.schemas.RegionSerializer.properties.coordinates.anyOf[0]" - """ + """Coordinates of the region""" country: Optional[str] = None - """ - '#/components/schemas/RegionSerializer/properties/country/anyOf/0' - "$.components.schemas.RegionSerializer.properties.country.anyOf[0]" - """ + """Country""" created_at: datetime - """ - '#/components/schemas/RegionSerializer/properties/created_at' - "$.components.schemas.RegionSerializer.properties.created_at" - """ + """Region creation date and time""" created_on: datetime - """ - '#/components/schemas/RegionSerializer/properties/created_on' - "$.components.schemas.RegionSerializer.properties.created_on" - """ + """This field is deprecated. Use `created_at` instead.""" ddos_endpoint_id: Optional[int] = None - """ - '#/components/schemas/RegionSerializer/properties/ddos_endpoint_id/anyOf/0' - "$.components.schemas.RegionSerializer.properties.ddos_endpoint_id.anyOf[0]" - """ + """DDoS endpoint ID""" display_name: str - """ - '#/components/schemas/RegionSerializer/properties/display_name' - "$.components.schemas.RegionSerializer.properties.display_name" - """ + """Human-readable region name""" endpoint_type: Literal["admin", "internal", "public"] - """ - '#/components/schemas/RegionSerializer/properties/endpoint_type' - "$.components.schemas.RegionSerializer.properties.endpoint_type" - """ + """Endpoint type""" external_network_id: Optional[str] = None - """ - '#/components/schemas/RegionSerializer/properties/external_network_id/anyOf/0' - "$.components.schemas.RegionSerializer.properties.external_network_id.anyOf[0]" - """ + """External network ID for Neutron""" file_share_types: Optional[List[Literal["standard", "vast"]]] = None - """ - '#/components/schemas/RegionSerializer/properties/file_share_types/anyOf/0' - "$.components.schemas.RegionSerializer.properties.file_share_types.anyOf[0]" - """ + """List of available file share types""" has_ai: bool - """ - '#/components/schemas/RegionSerializer/properties/has_ai' - "$.components.schemas.RegionSerializer.properties.has_ai" - """ + """Region has AI capability""" has_ai_gpu: bool - """ - '#/components/schemas/RegionSerializer/properties/has_ai_gpu' - "$.components.schemas.RegionSerializer.properties.has_ai_gpu" - """ + """Region has AI GPU capability""" has_baremetal: bool - """ - '#/components/schemas/RegionSerializer/properties/has_baremetal' - "$.components.schemas.RegionSerializer.properties.has_baremetal" - """ + """Region has bare metal capability""" has_basic_vm: bool - """ - '#/components/schemas/RegionSerializer/properties/has_basic_vm' - "$.components.schemas.RegionSerializer.properties.has_basic_vm" - """ + """Region has basic vm capability""" has_k8s: bool - """ - '#/components/schemas/RegionSerializer/properties/has_k8s' - "$.components.schemas.RegionSerializer.properties.has_k8s" - """ + """Region has managed kubernetes capability""" has_kvm: bool - """ - '#/components/schemas/RegionSerializer/properties/has_kvm' - "$.components.schemas.RegionSerializer.properties.has_kvm" - """ + """Region has KVM virtualization capability""" has_sfs: bool - """ - '#/components/schemas/RegionSerializer/properties/has_sfs' - "$.components.schemas.RegionSerializer.properties.has_sfs" - """ + """Region has SFS capability""" keystone_id: int - """ - '#/components/schemas/RegionSerializer/properties/keystone_id' - "$.components.schemas.RegionSerializer.properties.keystone_id" - """ + """Foreign key to Keystone entity""" keystone_name: str - """ - '#/components/schemas/RegionSerializer/properties/keystone_name' - "$.components.schemas.RegionSerializer.properties.keystone_name" - """ + """Technical region name""" metrics_database_id: Optional[int] = None - """ - '#/components/schemas/RegionSerializer/properties/metrics_database_id/anyOf/0' - "$.components.schemas.RegionSerializer.properties.metrics_database_id.anyOf[0]" - """ + """Foreign key to Metrics database entity""" state: Literal["ACTIVE", "DELETED", "DELETING", "DELETION_FAILED", "INACTIVE", "MAINTENANCE", "NEW"] - """ - '#/components/schemas/RegionSerializer/properties/state' - "$.components.schemas.RegionSerializer.properties.state" - """ + """Region state""" task_id: Optional[str] = None - """ - '#/components/schemas/RegionSerializer/properties/task_id/anyOf/0' - "$.components.schemas.RegionSerializer.properties.task_id.anyOf[0]" - """ + """This field is deprecated and can be ignored""" vlan_physical_network: str - """ - '#/components/schemas/RegionSerializer/properties/vlan_physical_network' - "$.components.schemas.RegionSerializer.properties.vlan_physical_network" - """ + """Physical network name to create vlan networks""" zone: Optional[Literal["AMERICAS", "APAC", "EMEA", "RUSSIA_AND_CIS"]] = None - """ - '#/components/schemas/RegionSerializer/properties/zone/anyOf/0' - "$.components.schemas.RegionSerializer.properties.zone.anyOf[0]" - """ + """Geographical zone""" has_dbaas: Optional[bool] = None - """ - '#/components/schemas/RegionSerializer/properties/has_dbaas' - "$.components.schemas.RegionSerializer.properties.has_dbaas" - """ + """Region has DBAAS service""" diff --git a/src/gcore/types/cloud/region_capacity.py b/src/gcore/types/cloud/region_capacity.py index 89b2d6d1..6d84da43 100644 --- a/src/gcore/types/cloud/region_capacity.py +++ b/src/gcore/types/cloud/region_capacity.py @@ -10,13 +10,7 @@ class RegionCapacity(BaseModel): capacity: List[Capacity] - """ - '#/components/schemas/RegionCapacityOutSerializerV3/properties/capacity' - "$.components.schemas.RegionCapacityOutSerializerV3.properties.capacity" - """ + """List of capacities by flavor.""" region_id: int - """ - '#/components/schemas/RegionCapacityOutSerializerV3/properties/region_id' - "$.components.schemas.RegionCapacityOutSerializerV3.properties.region_id" - """ + """Region ID.""" diff --git a/src/gcore/types/cloud/region_capacity_list.py b/src/gcore/types/cloud/region_capacity_list.py index 09e531e3..decc0299 100644 --- a/src/gcore/types/cloud/region_capacity_list.py +++ b/src/gcore/types/cloud/region_capacity_list.py @@ -10,13 +10,7 @@ class RegionCapacityList(BaseModel): count: int - """ - '#/components/schemas/RegionCapacityOutSerializerV3List/properties/count' - "$.components.schemas.RegionCapacityOutSerializerV3List.properties.count" - """ + """Number of objects""" results: List[RegionCapacity] - """ - '#/components/schemas/RegionCapacityOutSerializerV3List/properties/results' - "$.components.schemas.RegionCapacityOutSerializerV3List.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/region_list_params.py b/src/gcore/types/cloud/region_list_params.py index ac68f5da..ac7b106b 100644 --- a/src/gcore/types/cloud/region_list_params.py +++ b/src/gcore/types/cloud/region_list_params.py @@ -9,31 +9,23 @@ class RegionListParams(TypedDict, total=False): limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/0' - "$.paths['/cloud/v1/regions'].get.parameters[0]" + """Limit the number of returned regions. + + Falls back to default of 100 if not specified. Limited by max limit value of + 1000 """ offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/1' - "$.paths['/cloud/v1/regions'].get.parameters[1]" - """ + """Offset value is used to exclude the first set of records from the result""" order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] - """ - '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/2' - "$.paths['/cloud/v1/regions'].get.parameters[2]" - """ + """Order by field and direction.""" product: Literal["containers", "inference"] - """ - '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/3' - "$.paths['/cloud/v1/regions'].get.parameters[3]" - """ + """If defined then return only regions that support given product.""" show_volume_types: bool """ - '#/paths/%2Fcloud%2Fv1%2Fregions/get/parameters/4' - "$.paths['/cloud/v1/regions'].get.parameters[4]" + If true, null `available_volume_type` is replaced with a list of available + volume types. """ diff --git a/src/gcore/types/cloud/region_retrieve_params.py b/src/gcore/types/cloud/region_retrieve_params.py index e124ebea..6dd33927 100644 --- a/src/gcore/types/cloud/region_retrieve_params.py +++ b/src/gcore/types/cloud/region_retrieve_params.py @@ -9,13 +9,10 @@ class RegionRetrieveParams(TypedDict, total=False): region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregions%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/regions/{region_id}'].get.parameters[0].schema" - """ + """Region ID""" show_volume_types: bool """ - '#/paths/%2Fcloud%2Fv1%2Fregions%2F%7Bregion_id%7D/get/parameters/1' - "$.paths['/cloud/v1/regions/{region_id}'].get.parameters[1]" + If true, null `available_volume_type` is replaced with a list of available + volume types. """ diff --git a/src/gcore/types/cloud/registries/registry_artifact.py b/src/gcore/types/cloud/registries/registry_artifact.py index 9dbd1cc7..326adeb6 100644 --- a/src/gcore/types/cloud/registries/registry_artifact.py +++ b/src/gcore/types/cloud/registries/registry_artifact.py @@ -11,49 +11,25 @@ class RegistryArtifact(BaseModel): id: int - """ - '#/components/schemas/RegistryArtifactSerializer/properties/id' - "$.components.schemas.RegistryArtifactSerializer.properties.id" - """ + """Repository ID""" digest: str - """ - '#/components/schemas/RegistryArtifactSerializer/properties/digest' - "$.components.schemas.RegistryArtifactSerializer.properties.digest" - """ + """Artifact digest""" pulled_at: datetime - """ - '#/components/schemas/RegistryArtifactSerializer/properties/pulled_at' - "$.components.schemas.RegistryArtifactSerializer.properties.pulled_at" - """ + """Artifact last pull date-time""" pushed_at: datetime - """ - '#/components/schemas/RegistryArtifactSerializer/properties/pushed_at' - "$.components.schemas.RegistryArtifactSerializer.properties.pushed_at" - """ + """Artifact push date-time""" registry_id: int - """ - '#/components/schemas/RegistryArtifactSerializer/properties/registry_id' - "$.components.schemas.RegistryArtifactSerializer.properties.registry_id" - """ + """Artifact registry ID""" repository_id: int - """ - '#/components/schemas/RegistryArtifactSerializer/properties/repository_id' - "$.components.schemas.RegistryArtifactSerializer.properties.repository_id" - """ + """Artifact repository ID""" size: int - """ - '#/components/schemas/RegistryArtifactSerializer/properties/size' - "$.components.schemas.RegistryArtifactSerializer.properties.size" - """ + """Artifact size, bytes""" tags: List[RegistryTag] - """ - '#/components/schemas/RegistryArtifactSerializer/properties/tags' - "$.components.schemas.RegistryArtifactSerializer.properties.tags" - """ + """Artifact tags""" diff --git a/src/gcore/types/cloud/registries/registry_artifact_list.py b/src/gcore/types/cloud/registries/registry_artifact_list.py index 3c58aacc..4d0e3959 100644 --- a/src/gcore/types/cloud/registries/registry_artifact_list.py +++ b/src/gcore/types/cloud/registries/registry_artifact_list.py @@ -10,13 +10,7 @@ class RegistryArtifactList(BaseModel): count: int - """ - '#/components/schemas/RegistryArtifactCollectionSerializer/properties/count' - "$.components.schemas.RegistryArtifactCollectionSerializer.properties.count" - """ + """Number of objects""" results: List[RegistryArtifact] - """ - '#/components/schemas/RegistryArtifactCollectionSerializer/properties/results' - "$.components.schemas.RegistryArtifactCollectionSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/registries/registry_repository.py b/src/gcore/types/cloud/registries/registry_repository.py index b17d23cf..9d1ddba5 100644 --- a/src/gcore/types/cloud/registries/registry_repository.py +++ b/src/gcore/types/cloud/registries/registry_repository.py @@ -9,43 +9,22 @@ class RegistryRepository(BaseModel): id: int - """ - '#/components/schemas/RegistryRepositorySerializer/properties/id' - "$.components.schemas.RegistryRepositorySerializer.properties.id" - """ + """Repository ID""" artifact_count: int - """ - '#/components/schemas/RegistryRepositorySerializer/properties/artifact_count' - "$.components.schemas.RegistryRepositorySerializer.properties.artifact_count" - """ + """Number of artifacts in the repository""" created_at: datetime - """ - '#/components/schemas/RegistryRepositorySerializer/properties/created_at' - "$.components.schemas.RegistryRepositorySerializer.properties.created_at" - """ + """Repository creation date-time""" name: str - """ - '#/components/schemas/RegistryRepositorySerializer/properties/name' - "$.components.schemas.RegistryRepositorySerializer.properties.name" - """ + """Repository name""" pull_count: int - """ - '#/components/schemas/RegistryRepositorySerializer/properties/pull_count' - "$.components.schemas.RegistryRepositorySerializer.properties.pull_count" - """ + """Number of pools from the repository""" registry_id: int - """ - '#/components/schemas/RegistryRepositorySerializer/properties/registry_id' - "$.components.schemas.RegistryRepositorySerializer.properties.registry_id" - """ + """Repository registry ID""" updated_at: datetime - """ - '#/components/schemas/RegistryRepositorySerializer/properties/updated_at' - "$.components.schemas.RegistryRepositorySerializer.properties.updated_at" - """ + """Repository modification date-time""" diff --git a/src/gcore/types/cloud/registries/registry_repository_list.py b/src/gcore/types/cloud/registries/registry_repository_list.py index 88cbb721..2ef46cf2 100644 --- a/src/gcore/types/cloud/registries/registry_repository_list.py +++ b/src/gcore/types/cloud/registries/registry_repository_list.py @@ -10,13 +10,7 @@ class RegistryRepositoryList(BaseModel): count: int - """ - '#/components/schemas/RegistryRepositoryCollectionSerializer/properties/count' - "$.components.schemas.RegistryRepositoryCollectionSerializer.properties.count" - """ + """Number of objects""" results: List[RegistryRepository] - """ - '#/components/schemas/RegistryRepositoryCollectionSerializer/properties/results' - "$.components.schemas.RegistryRepositoryCollectionSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/registries/registry_user.py b/src/gcore/types/cloud/registries/registry_user.py index 4d509e69..81e7d4b8 100644 --- a/src/gcore/types/cloud/registries/registry_user.py +++ b/src/gcore/types/cloud/registries/registry_user.py @@ -10,37 +10,19 @@ class RegistryUser(BaseModel): id: int - """ - '#/components/schemas/RegistryUserSerializer/properties/id' - "$.components.schemas.RegistryUserSerializer.properties.id" - """ + """User ID""" created_at: datetime - """ - '#/components/schemas/RegistryUserSerializer/properties/created_at' - "$.components.schemas.RegistryUserSerializer.properties.created_at" - """ + """User creation date-time""" duration: int - """ - '#/components/schemas/RegistryUserSerializer/properties/duration' - "$.components.schemas.RegistryUserSerializer.properties.duration" - """ + """User account operating time, days""" expires_at: datetime - """ - '#/components/schemas/RegistryUserSerializer/properties/expires_at' - "$.components.schemas.RegistryUserSerializer.properties.expires_at" - """ + """User operation end date-time""" name: str - """ - '#/components/schemas/RegistryUserSerializer/properties/name' - "$.components.schemas.RegistryUserSerializer.properties.name" - """ + """User name""" read_only: Optional[bool] = None - """ - '#/components/schemas/RegistryUserSerializer/properties/read_only' - "$.components.schemas.RegistryUserSerializer.properties.read_only" - """ + """Read-only user""" diff --git a/src/gcore/types/cloud/registries/registry_user_created.py b/src/gcore/types/cloud/registries/registry_user_created.py index 27eaad01..6cb1ae87 100644 --- a/src/gcore/types/cloud/registries/registry_user_created.py +++ b/src/gcore/types/cloud/registries/registry_user_created.py @@ -10,43 +10,22 @@ class RegistryUserCreated(BaseModel): id: int - """ - '#/components/schemas/RegistryUserCreateResponseSerializer/properties/id' - "$.components.schemas.RegistryUserCreateResponseSerializer.properties.id" - """ + """User ID""" created_at: datetime - """ - '#/components/schemas/RegistryUserCreateResponseSerializer/properties/created_at' - "$.components.schemas.RegistryUserCreateResponseSerializer.properties.created_at" - """ + """User creation date-time""" duration: int - """ - '#/components/schemas/RegistryUserCreateResponseSerializer/properties/duration' - "$.components.schemas.RegistryUserCreateResponseSerializer.properties.duration" - """ + """User account operating time, days""" expires_at: datetime - """ - '#/components/schemas/RegistryUserCreateResponseSerializer/properties/expires_at' - "$.components.schemas.RegistryUserCreateResponseSerializer.properties.expires_at" - """ + """User operation end date-time""" name: str - """ - '#/components/schemas/RegistryUserCreateResponseSerializer/properties/name' - "$.components.schemas.RegistryUserCreateResponseSerializer.properties.name" - """ + """User name""" read_only: Optional[bool] = None - """ - '#/components/schemas/RegistryUserCreateResponseSerializer/properties/read_only' - "$.components.schemas.RegistryUserCreateResponseSerializer.properties.read_only" - """ + """Read-only user""" secret: Optional[str] = None - """ - '#/components/schemas/RegistryUserCreateResponseSerializer/properties/secret' - "$.components.schemas.RegistryUserCreateResponseSerializer.properties.secret" - """ + """User secret""" diff --git a/src/gcore/types/cloud/registries/registry_user_list.py b/src/gcore/types/cloud/registries/registry_user_list.py index 4a085aaf..980254a8 100644 --- a/src/gcore/types/cloud/registries/registry_user_list.py +++ b/src/gcore/types/cloud/registries/registry_user_list.py @@ -10,13 +10,7 @@ class RegistryUserList(BaseModel): count: int - """ - '#/components/schemas/RegistryUserCollectionSerializer/properties/count' - "$.components.schemas.RegistryUserCollectionSerializer.properties.count" - """ + """Number of objects""" results: List[RegistryUser] - """ - '#/components/schemas/RegistryUserCollectionSerializer/properties/results' - "$.components.schemas.RegistryUserCollectionSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/registries/user_create_multiple_params.py b/src/gcore/types/cloud/registries/user_create_multiple_params.py index 023d3799..e580e8dc 100644 --- a/src/gcore/types/cloud/registries/user_create_multiple_params.py +++ b/src/gcore/types/cloud/registries/user_create_multiple_params.py @@ -10,45 +10,27 @@ class UserCreateMultipleParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2Fbatch/post/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch'].post.parameters[1].schema" - """ users: Required[Iterable[User]] - """ - '#/components/schemas/RegistryBatchUsersCreateSerializer/properties/users' - "$.components.schemas.RegistryBatchUsersCreateSerializer.properties.users" - """ + """Set of users""" class User(TypedDict, total=False): duration: Required[int] - """ - '#/components/schemas/RegistryUserCreateSerializer/properties/duration' - "$.components.schemas.RegistryUserCreateSerializer.properties.duration" - """ + """User account operating time, days""" name: Required[str] - """ - '#/components/schemas/RegistryUserCreateSerializer/properties/name' - "$.components.schemas.RegistryUserCreateSerializer.properties.name" + """A name for the registry user. + + Should be in lowercase, consisting only of numbers and letters, + + with maximum length of 16 characters """ read_only: bool - """ - '#/components/schemas/RegistryUserCreateSerializer/properties/read_only' - "$.components.schemas.RegistryUserCreateSerializer.properties.read_only" - """ + """Read-only user""" secret: str - """ - '#/components/schemas/RegistryUserCreateSerializer/properties/secret' - "$.components.schemas.RegistryUserCreateSerializer.properties.secret" - """ + """User secret""" diff --git a/src/gcore/types/cloud/registries/user_create_params.py b/src/gcore/types/cloud/registries/user_create_params.py index dc191ac4..a658b14c 100644 --- a/src/gcore/types/cloud/registries/user_create_params.py +++ b/src/gcore/types/cloud/registries/user_create_params.py @@ -9,37 +9,22 @@ class UserCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers/post/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users'].post.parameters[1].schema" - """ duration: Required[int] - """ - '#/components/schemas/RegistryUserCreateSerializer/properties/duration' - "$.components.schemas.RegistryUserCreateSerializer.properties.duration" - """ + """User account operating time, days""" name: Required[str] - """ - '#/components/schemas/RegistryUserCreateSerializer/properties/name' - "$.components.schemas.RegistryUserCreateSerializer.properties.name" + """A name for the registry user. + + Should be in lowercase, consisting only of numbers and letters, + + with maximum length of 16 characters """ read_only: bool - """ - '#/components/schemas/RegistryUserCreateSerializer/properties/read_only' - "$.components.schemas.RegistryUserCreateSerializer.properties.read_only" - """ + """Read-only user""" secret: str - """ - '#/components/schemas/RegistryUserCreateSerializer/properties/secret' - "$.components.schemas.RegistryUserCreateSerializer.properties.secret" - """ + """User secret""" diff --git a/src/gcore/types/cloud/registries/user_update_params.py b/src/gcore/types/cloud/registries/user_update_params.py index 3a2eafb7..a4be7b07 100644 --- a/src/gcore/types/cloud/registries/user_update_params.py +++ b/src/gcore/types/cloud/registries/user_update_params.py @@ -9,31 +9,13 @@ class UserUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[1].schema" - """ registry_id: Required[int] - """ - '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fusers%2F%7Buser_id%7D/patch/parameters/2/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}'].patch.parameters[2].schema" - """ duration: Required[int] - """ - '#/components/schemas/RegistryUserUpdateSerializer/properties/duration' - "$.components.schemas.RegistryUserUpdateSerializer.properties.duration" - """ + """User account operating time, days""" read_only: bool - """ - '#/components/schemas/RegistryUserUpdateSerializer/properties/read_only' - "$.components.schemas.RegistryUserUpdateSerializer.properties.read_only" - """ + """Read-only user""" diff --git a/src/gcore/types/cloud/registry.py b/src/gcore/types/cloud/registry.py index 53473474..96f588c4 100644 --- a/src/gcore/types/cloud/registry.py +++ b/src/gcore/types/cloud/registry.py @@ -9,49 +9,25 @@ class Registry(BaseModel): id: int - """ - '#/components/schemas/RegistrySerializer/properties/id' - "$.components.schemas.RegistrySerializer.properties.id" - """ + """Registry ID""" created_at: datetime - """ - '#/components/schemas/RegistrySerializer/properties/created_at' - "$.components.schemas.RegistrySerializer.properties.created_at" - """ + """Registry creation date-time""" name: str - """ - '#/components/schemas/RegistrySerializer/properties/name' - "$.components.schemas.RegistrySerializer.properties.name" - """ + """Registry name""" repo_count: int - """ - '#/components/schemas/RegistrySerializer/properties/repo_count' - "$.components.schemas.RegistrySerializer.properties.repo_count" - """ + """Number of repositories in the registry""" storage_limit: int - """ - '#/components/schemas/RegistrySerializer/properties/storage_limit' - "$.components.schemas.RegistrySerializer.properties.storage_limit" - """ + """Registry storage limit, GiB""" storage_used: int - """ - '#/components/schemas/RegistrySerializer/properties/storage_used' - "$.components.schemas.RegistrySerializer.properties.storage_used" - """ + """Registry storage used, bytes""" updated_at: datetime - """ - '#/components/schemas/RegistrySerializer/properties/updated_at' - "$.components.schemas.RegistrySerializer.properties.updated_at" - """ + """Registry modification date-time""" url: str - """ - '#/components/schemas/RegistrySerializer/properties/url' - "$.components.schemas.RegistrySerializer.properties.url" - """ + """Registry url""" diff --git a/src/gcore/types/cloud/registry_create_params.py b/src/gcore/types/cloud/registry_create_params.py index c79fd1ee..2d5ecfbb 100644 --- a/src/gcore/types/cloud/registry_create_params.py +++ b/src/gcore/types/cloud/registry_create_params.py @@ -9,25 +9,16 @@ class RegistryCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}'].post.parameters[1].schema" - """ name: Required[str] - """ - '#/components/schemas/RegistryCreateSerializer/properties/name' - "$.components.schemas.RegistryCreateSerializer.properties.name" + """A name for the container registry. + + Should be in lowercase, consisting only of numbers, letters and -, + + with maximum length of 24 characters """ storage_limit: int - """ - '#/components/schemas/RegistryCreateSerializer/properties/storage_limit' - "$.components.schemas.RegistryCreateSerializer.properties.storage_limit" - """ + """Registry storage limit, GiB""" diff --git a/src/gcore/types/cloud/registry_list.py b/src/gcore/types/cloud/registry_list.py index 9c7b56e2..1f31d5fb 100644 --- a/src/gcore/types/cloud/registry_list.py +++ b/src/gcore/types/cloud/registry_list.py @@ -10,13 +10,7 @@ class RegistryList(BaseModel): count: int - """ - '#/components/schemas/RegistryCollectionSerializer/properties/count' - "$.components.schemas.RegistryCollectionSerializer.properties.count" - """ + """Number of objects""" results: List[Registry] - """ - '#/components/schemas/RegistryCollectionSerializer/properties/results' - "$.components.schemas.RegistryCollectionSerializer.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/registry_resize_params.py b/src/gcore/types/cloud/registry_resize_params.py index 67051054..fb313913 100644 --- a/src/gcore/types/cloud/registry_resize_params.py +++ b/src/gcore/types/cloud/registry_resize_params.py @@ -9,19 +9,8 @@ class RegistryResizeParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/0/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fregistries%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bregistry_id%7D%2Fresize/patch/parameters/1/schema' - "$.paths['/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize'].patch.parameters[1].schema" - """ storage_limit: int - """ - '#/components/schemas/RegistryResizeSerializer/properties/storage_limit' - "$.components.schemas.RegistryResizeSerializer.properties.storage_limit" - """ + """Registry storage limit, GiB""" diff --git a/src/gcore/types/cloud/registry_tag.py b/src/gcore/types/cloud/registry_tag.py index 1ff8acf2..e0668385 100644 --- a/src/gcore/types/cloud/registry_tag.py +++ b/src/gcore/types/cloud/registry_tag.py @@ -9,37 +9,19 @@ class RegistryTag(BaseModel): id: int - """ - '#/components/schemas/RegistryTagSerializer/properties/id' - "$.components.schemas.RegistryTagSerializer.properties.id" - """ + """Tag ID""" artifact_id: int - """ - '#/components/schemas/RegistryTagSerializer/properties/artifact_id' - "$.components.schemas.RegistryTagSerializer.properties.artifact_id" - """ + """Artifact ID""" name: str - """ - '#/components/schemas/RegistryTagSerializer/properties/name' - "$.components.schemas.RegistryTagSerializer.properties.name" - """ + """Tag name""" pulled_at: datetime - """ - '#/components/schemas/RegistryTagSerializer/properties/pulled_at' - "$.components.schemas.RegistryTagSerializer.properties.pulled_at" - """ + """Tag last pull date-time""" pushed_at: datetime - """ - '#/components/schemas/RegistryTagSerializer/properties/pushed_at' - "$.components.schemas.RegistryTagSerializer.properties.pushed_at" - """ + """Tag push date-time""" repository_id: int - """ - '#/components/schemas/RegistryTagSerializer/properties/repository_id' - "$.components.schemas.RegistryTagSerializer.properties.repository_id" - """ + """Repository ID""" diff --git a/src/gcore/types/cloud/reserved_fixed_ip.py b/src/gcore/types/cloud/reserved_fixed_ip.py index 178ac436..89205ad5 100644 --- a/src/gcore/types/cloud/reserved_fixed_ip.py +++ b/src/gcore/types/cloud/reserved_fixed_ip.py @@ -12,161 +12,87 @@ class Attachment(BaseModel): resource_id: Optional[str] = None - """ - '#/components/schemas/AttachmentSerializer/properties/resource_id/anyOf/0' - "$.components.schemas.AttachmentSerializer.properties.resource_id.anyOf[0]" - """ + """Resource ID""" resource_type: Optional[str] = None - """ - '#/components/schemas/AttachmentSerializer/properties/resource_type/anyOf/0' - "$.components.schemas.AttachmentSerializer.properties.resource_type.anyOf[0]" - """ + """Resource type""" class Reservation(BaseModel): resource_id: Optional[str] = None - """ - '#/components/schemas/ReservationSerializer/properties/resource_id/anyOf/0' - "$.components.schemas.ReservationSerializer.properties.resource_id.anyOf[0]" - """ + """ID of the instance or load balancer the IP is attached to""" resource_type: Optional[str] = None - """ - '#/components/schemas/ReservationSerializer/properties/resource_type/anyOf/0' - "$.components.schemas.ReservationSerializer.properties.resource_type.anyOf[0]" - """ + """Resource type of the resource the IP is attached to""" status: Optional[str] = None - """ - '#/components/schemas/ReservationSerializer/properties/status/anyOf/0' - "$.components.schemas.ReservationSerializer.properties.status.anyOf[0]" - """ + """IP reservation status""" class ReservedFixedIP(BaseModel): allowed_address_pairs: List[AllowedAddressPairs] - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/allowed_address_pairs' - "$.components.schemas.ReservedFixedIPSerializer.properties.allowed_address_pairs" - """ + """Group of subnet masks and/or IP addresses that share the current IP as VIP""" attachments: List[Attachment] - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/attachments' - "$.components.schemas.ReservedFixedIPSerializer.properties.attachments" - """ + """Reserved fixed IP attachment entities""" created_at: datetime - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/created_at' - "$.components.schemas.ReservedFixedIPSerializer.properties.created_at" - """ + """Datetime when the reserved fixed IP was created""" is_external: bool - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/is_external' - "$.components.schemas.ReservedFixedIPSerializer.properties.is_external" - """ + """If reserved fixed IP belongs to a public network""" is_vip: bool - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/is_vip' - "$.components.schemas.ReservedFixedIPSerializer.properties.is_vip" - """ + """If reserved fixed IP is a VIP""" name: str - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/name' - "$.components.schemas.ReservedFixedIPSerializer.properties.name" - """ + """Reserved fixed IP name""" network: Network - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/network' - "$.components.schemas.ReservedFixedIPSerializer.properties.network" - """ + """Network details""" network_id: str - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/network_id' - "$.components.schemas.ReservedFixedIPSerializer.properties.network_id" - """ + """ID of the network the port is attached to""" port_id: str - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/port_id' - "$.components.schemas.ReservedFixedIPSerializer.properties.port_id" - """ + """ID of the port underlying the reserved fixed IP""" region: str - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/region' - "$.components.schemas.ReservedFixedIPSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/region_id' - "$.components.schemas.ReservedFixedIPSerializer.properties.region_id" - """ + """Region ID""" reservation: Reservation - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/reservation' - "$.components.schemas.ReservedFixedIPSerializer.properties.reservation" - """ + """Reserved fixed IP status with resource type and ID it is attached to""" status: str - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/status' - "$.components.schemas.ReservedFixedIPSerializer.properties.status" - """ + """Underlying port status""" updated_at: datetime - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/updated_at' - "$.components.schemas.ReservedFixedIPSerializer.properties.updated_at" - """ + """Datetime when the reserved fixed IP was last updated""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.ReservedFixedIPSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" fixed_ip_address: Optional[str] = None - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/fixed_ip_address/anyOf/0' - "$.components.schemas.ReservedFixedIPSerializer.properties.fixed_ip_address.anyOf[0]" - """ + """IPv4 address of the reserved fixed IP""" fixed_ipv6_address: Optional[str] = None - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/fixed_ipv6_address/anyOf/0' - "$.components.schemas.ReservedFixedIPSerializer.properties.fixed_ipv6_address.anyOf[0]" - """ + """IPv6 address of the reserved fixed IP""" project_id: Optional[int] = None - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/project_id/anyOf/0' - "$.components.schemas.ReservedFixedIPSerializer.properties.project_id.anyOf[0]" - """ + """Project ID""" subnet_id: Optional[str] = None - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/subnet_id/anyOf/0' - "$.components.schemas.ReservedFixedIPSerializer.properties.subnet_id.anyOf[0]" - """ + """ID of the subnet that owns the IP address""" subnet_v6_id: Optional[str] = None - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/subnet_v6_id/anyOf/0' - "$.components.schemas.ReservedFixedIPSerializer.properties.subnet_v6_id.anyOf[0]" - """ + """ID of the subnet that owns the IPv6 address""" task_id: Optional[str] = None - """ - '#/components/schemas/ReservedFixedIPSerializer/properties/task_id/anyOf/0' - "$.components.schemas.ReservedFixedIPSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ diff --git a/src/gcore/types/cloud/reserved_fixed_ip_create_params.py b/src/gcore/types/cloud/reserved_fixed_ip_create_params.py index d512ebbf..553101d5 100644 --- a/src/gcore/types/cloud/reserved_fixed_ip_create_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ip_create_params.py @@ -19,168 +19,83 @@ class NewReservedFixedIPExternalSerializer(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" - """ type: Required[Literal["external"]] - """ - '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.type" - """ + """Must be 'external'""" ip_family: Optional[InterfaceIPFamily] - """ - '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/ip_family/anyOf/0' - "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.ip_family.anyOf[0]" - """ + """Which subnets should be selected: IPv4, IPv6 or use dual stack.""" is_vip: bool - """ - '#/components/schemas/NewReservedFixedIpExternalSerializer/properties/is_vip' - "$.components.schemas.NewReservedFixedIpExternalSerializer.properties.is_vip" - """ + """If reserved fixed IP is a VIP""" class NewReservedFixedIPSpecificSubnetSerializer(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" - """ subnet_id: Required[str] - """ - '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/subnet_id' - "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.subnet_id" - """ + """Reserved fixed IP will be allocated in this subnet""" type: Required[Literal["subnet"]] - """ - '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.type" - """ + """Must be 'subnet'.""" is_vip: bool - """ - '#/components/schemas/NewReservedFixedIpSpecificSubnetSerializer/properties/is_vip' - "$.components.schemas.NewReservedFixedIpSpecificSubnetSerializer.properties.is_vip" - """ + """If reserved fixed IP is a VIP""" class NewReservedFixedIPAnySubnetSerializer(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" - """ network_id: Required[str] - """ - '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/network_id' - "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.network_id" - """ + """Reserved fixed IP will be allocated in a subnet of this network""" type: Required[Literal["any_subnet"]] - """ - '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.type" - """ + """Must be 'any_subnet'.""" ip_family: Optional[InterfaceIPFamily] - """ - '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/ip_family/anyOf/0' - "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.ip_family.anyOf[0]" - """ + """Which subnets should be selected: IPv4, IPv6 or use dual stack.""" is_vip: bool - """ - '#/components/schemas/NewReservedFixedIpAnySubnetSerializer/properties/is_vip' - "$.components.schemas.NewReservedFixedIpAnySubnetSerializer.properties.is_vip" - """ + """If reserved fixed IP is a VIP""" class NewReservedFixedIPSpecificIPAddressSerializer(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" - """ ip_address: Required[str] - """ - '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/ip_address' - "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.ip_address" - """ + """Reserved fixed IP will be allocated the given IP address""" network_id: Required[str] - """ - '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/network_id' - "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.network_id" - """ + """Reserved fixed IP will be allocated in a subnet of this network""" type: Required[Literal["ip_address"]] - """ - '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.type" - """ + """Must be 'ip_address'.""" is_vip: bool - """ - '#/components/schemas/NewReservedFixedIpSpecificIpAddressSerializer/properties/is_vip' - "$.components.schemas.NewReservedFixedIpSpecificIpAddressSerializer.properties.is_vip" - """ + """If reserved fixed IP is a VIP""" class NewReservedFixedIPSpecificPortSerializer(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].post.parameters[1].schema" - """ port_id: Required[str] """ - '#/components/schemas/NewReservedFixedIpSpecificPortSerializer/properties/port_id' - "$.components.schemas.NewReservedFixedIpSpecificPortSerializer.properties.port_id" + Port ID to make a reserved fixed IP (for example, `vip_port_id` of the Load + Balancer entity). """ type: Required[Literal["port"]] - """ - '#/components/schemas/NewReservedFixedIpSpecificPortSerializer/properties/type' - "$.components.schemas.NewReservedFixedIpSpecificPortSerializer.properties.type" - """ + """Must be 'port'.""" ReservedFixedIPCreateParams: TypeAlias = Union[ diff --git a/src/gcore/types/cloud/reserved_fixed_ip_list_params.py b/src/gcore/types/cloud/reserved_fixed_ip_list_params.py index 1c883b34..a3f37ace 100644 --- a/src/gcore/types/cloud/reserved_fixed_ip_list_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ip_list_params.py @@ -9,67 +9,39 @@ class ReservedFixedIPListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[1].schema" - """ available_only: bool """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[2]" + Set to true if the response should only list IP addresses that are not attached + to any instance """ device_id: str - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[3]" - """ + """Filter IPs by device ID it is attached to""" external_only: bool - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[4]" - """ + """Set to true if the response should only list public IP addresses""" internal_only: bool - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[5]" - """ + """Set to true if the response should only list private IP addresses""" ip_address: str - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[6]" - """ + """An IPv4 address to filter results by. Regular expression allowed""" limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[7]" - """ + """Limit the number of returned IPs""" offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[8]" - """ + """Offset value is used to exclude the first set of records from the result""" order_by: str """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[9]" + Ordering reserved fixed IP list result by name, status, updated_at, created_at + or fixed_ip_address fields of the reserved fixed IP and directions (status.asc), + default is "fixed_ip_address.asc" """ vip_only: bool - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}'].get.parameters[10]" - """ + """Set to true if the response should only list VIPs""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py b/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py index cb211f4c..78b5db02 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py @@ -11,31 +11,16 @@ class CandidatePort(BaseModel): instance_id: str - """ - '#/components/schemas/VIPAttachCandidateSerializer/properties/instance_id' - "$.components.schemas.VIPAttachCandidateSerializer.properties.instance_id" - """ + """ID of the instance that owns the port""" instance_name: str - """ - '#/components/schemas/VIPAttachCandidateSerializer/properties/instance_name' - "$.components.schemas.VIPAttachCandidateSerializer.properties.instance_name" - """ + """Name of the instance that owns the port""" ip_assignments: List[IPWithSubnet] - """ - '#/components/schemas/VIPAttachCandidateSerializer/properties/ip_assignments' - "$.components.schemas.VIPAttachCandidateSerializer.properties.ip_assignments" - """ + """IP addresses assigned to this port""" network: Network - """ - '#/components/schemas/VIPAttachCandidateSerializer/properties/network' - "$.components.schemas.VIPAttachCandidateSerializer.properties.network" - """ + """Network details""" port_id: str - """ - '#/components/schemas/VIPAttachCandidateSerializer/properties/port_id' - "$.components.schemas.VIPAttachCandidateSerializer.properties.port_id" - """ + """Port ID that shares VIP""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py b/src/gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py index 6382b21f..d01d7744 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py @@ -10,13 +10,7 @@ class CandidatePortList(BaseModel): count: int - """ - '#/components/schemas/VIPAttachCandidateSerializerList/properties/count' - "$.components.schemas.VIPAttachCandidateSerializerList.properties.count" - """ + """Number of objects""" results: List[CandidatePort] - """ - '#/components/schemas/VIPAttachCandidateSerializerList/properties/results' - "$.components.schemas.VIPAttachCandidateSerializerList.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py b/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py index 0b3de37d..0920f52c 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py @@ -11,31 +11,16 @@ class ConnectedPort(BaseModel): instance_id: str - """ - '#/components/schemas/ConnectedDevicesVIPSerializer/properties/instance_id' - "$.components.schemas.ConnectedDevicesVIPSerializer.properties.instance_id" - """ + """ID of the instance that owns the port""" instance_name: str - """ - '#/components/schemas/ConnectedDevicesVIPSerializer/properties/instance_name' - "$.components.schemas.ConnectedDevicesVIPSerializer.properties.instance_name" - """ + """Name of the instance that owns the port""" ip_assignments: List[IPWithSubnet] - """ - '#/components/schemas/ConnectedDevicesVIPSerializer/properties/ip_assignments' - "$.components.schemas.ConnectedDevicesVIPSerializer.properties.ip_assignments" - """ + """IP addresses assigned to this port""" network: Network - """ - '#/components/schemas/ConnectedDevicesVIPSerializer/properties/network' - "$.components.schemas.ConnectedDevicesVIPSerializer.properties.network" - """ + """Network details""" port_id: str - """ - '#/components/schemas/ConnectedDevicesVIPSerializer/properties/port_id' - "$.components.schemas.ConnectedDevicesVIPSerializer.properties.port_id" - """ + """Port ID that shares VIP""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/connected_port_list.py b/src/gcore/types/cloud/reserved_fixed_ips/connected_port_list.py index 1e20a503..cb2079f7 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/connected_port_list.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/connected_port_list.py @@ -10,13 +10,7 @@ class ConnectedPortList(BaseModel): count: int - """ - '#/components/schemas/ConnectedDevicesVIPSerializerList/properties/count' - "$.components.schemas.ConnectedDevicesVIPSerializerList.properties.count" - """ + """Number of objects""" results: List[ConnectedPort] - """ - '#/components/schemas/ConnectedDevicesVIPSerializerList/properties/results' - "$.components.schemas.ConnectedDevicesVIPSerializerList.properties.results" - """ + """Objects""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/ip_with_subnet.py b/src/gcore/types/cloud/reserved_fixed_ips/ip_with_subnet.py index be4e7937..b835f64b 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/ip_with_subnet.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/ip_with_subnet.py @@ -8,19 +8,10 @@ class IPWithSubnet(BaseModel): ip_address: str - """ - '#/components/schemas/PortIpWithSubnetSerializer/properties/ip_address' - "$.components.schemas.PortIpWithSubnetSerializer.properties.ip_address" - """ + """IP address""" subnet: Subnet - """ - '#/components/schemas/PortIpWithSubnetSerializer/properties/subnet' - "$.components.schemas.PortIpWithSubnetSerializer.properties.subnet" - """ + """Subnet details""" subnet_id: str - """ - '#/components/schemas/PortIpWithSubnetSerializer/properties/subnet_id' - "$.components.schemas.PortIpWithSubnetSerializer.properties.subnet_id" - """ + """ID of the subnet that allocated the IP""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py b/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py index 636cea7d..84c497bb 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py @@ -10,19 +10,8 @@ class VipReplaceConnectedPortsParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/put/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].put.parameters[1].schema" - """ port_ids: List[str] - """ - '#/components/schemas/PortIDsForVIPSerializer/properties/port_ids' - "$.components.schemas.PortIDsForVIPSerializer.properties.port_ids" - """ + """List of port IDs that will share one VIP""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip_toggle_params.py b/src/gcore/types/cloud/reserved_fixed_ips/vip_toggle_params.py index 09ed473d..9963340d 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip_toggle_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip_toggle_params.py @@ -9,19 +9,8 @@ class VipToggleParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}'].patch.parameters[1].schema" - """ is_vip: Required[bool] - """ - '#/components/schemas/PatchReservedFixedIPSerializer/properties/is_vip' - "$.components.schemas.PatchReservedFixedIPSerializer.properties.is_vip" - """ + """If reserved fixed IP should be a VIP""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py b/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py index 541b8e3b..d93b4303 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py @@ -10,19 +10,8 @@ class VipUpdateConnectedPortsParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/0/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Freserved_fixed_ips%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bport_id%7D%2Fconnected_devices/patch/parameters/1/schema' - "$.paths['/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices'].patch.parameters[1].schema" - """ port_ids: List[str] - """ - '#/components/schemas/PortIDsForVIPSerializer/properties/port_ids' - "$.components.schemas.PortIDsForVIPSerializer.properties.port_ids" - """ + """List of port IDs that will share one VIP""" diff --git a/src/gcore/types/cloud/route.py b/src/gcore/types/cloud/route.py index 2732e748..f9854287 100644 --- a/src/gcore/types/cloud/route.py +++ b/src/gcore/types/cloud/route.py @@ -7,13 +7,10 @@ class Route(BaseModel): destination: str - """ - '#/components/schemas/RouteOutSerializer/properties/destination' - "$.components.schemas.RouteOutSerializer.properties.destination" - """ + """CIDR of destination IPv4 subnet.""" nexthop: str """ - '#/components/schemas/RouteOutSerializer/properties/nexthop' - "$.components.schemas.RouteOutSerializer.properties.nexthop" + IPv4 address to forward traffic to if it's destination IP matches 'destination' + CIDR. """ diff --git a/src/gcore/types/cloud/secret.py b/src/gcore/types/cloud/secret.py index d094db5c..e7eb5015 100644 --- a/src/gcore/types/cloud/secret.py +++ b/src/gcore/types/cloud/secret.py @@ -11,61 +11,54 @@ class Secret(BaseModel): id: str - """ - '#/components/schemas/SecretSerializer/properties/id' - "$.components.schemas.SecretSerializer.properties.id" - """ + """Secret uuid""" name: str - """ - '#/components/schemas/SecretSerializer/properties/name' - "$.components.schemas.SecretSerializer.properties.name" - """ + """Secret name""" secret_type: Literal["certificate", "opaque", "passphrase", "private", "public", "symmetric"] - """ - '#/components/schemas/SecretSerializer/properties/secret_type' - "$.components.schemas.SecretSerializer.properties.secret_type" + """Secret type, base64 encoded. + + symmetric - Used for storing byte arrays such as keys suitable for symmetric + encryption; public - Used for storing the public key of an asymmetric keypair; + private - Used for storing the private key of an asymmetric keypair; + passphrase - Used for storing plain text passphrases; certificate - Used for + storing cryptographic certificates such as X.509 certificates; opaque - Used for + backwards compatibility with previous versions of the API """ status: str - """ - '#/components/schemas/SecretSerializer/properties/status' - "$.components.schemas.SecretSerializer.properties.status" - """ + """Status""" algorithm: Optional[str] = None - """ - '#/components/schemas/SecretSerializer/properties/algorithm/anyOf/0' - "$.components.schemas.SecretSerializer.properties.algorithm.anyOf[0]" + """Metadata provided by a user or system for informational purposes. + + Defaults to None """ bit_length: Optional[int] = None - """ - '#/components/schemas/SecretSerializer/properties/bit_length/anyOf/0' - "$.components.schemas.SecretSerializer.properties.bit_length.anyOf[0]" + """Metadata provided by a user or system for informational purposes. + + Value must be greater than zero. Defaults to None """ content_types: Optional[Dict[str, str]] = None - """ - '#/components/schemas/SecretSerializer/properties/content_types/anyOf/0' - "$.components.schemas.SecretSerializer.properties.content_types.anyOf[0]" + """Describes the content-types that can be used to retrieve the payload. + + The content-type used with symmetric secrets is application/octet-stream """ created: Optional[datetime] = None - """ - '#/components/schemas/SecretSerializer/properties/created/anyOf/0' - "$.components.schemas.SecretSerializer.properties.created.anyOf[0]" - """ + """Datetime when the secret was created. The format is 2020-01-01T12:00:00+00:00""" expiration: Optional[datetime] = None - """ - '#/components/schemas/SecretSerializer/properties/expiration/anyOf/0' - "$.components.schemas.SecretSerializer.properties.expiration.anyOf[0]" + """Datetime when the secret will expire. + + The format is 2020-01-01T12:00:00+00:00. Defaults to None """ mode: Optional[str] = None - """ - '#/components/schemas/SecretSerializer/properties/mode/anyOf/0' - "$.components.schemas.SecretSerializer.properties.mode.anyOf[0]" + """Metadata provided by a user or system for informational purposes. + + Defaults to None """ diff --git a/src/gcore/types/cloud/secret_create_params.py b/src/gcore/types/cloud/secret_create_params.py index b7916a1f..6b8d4e8f 100644 --- a/src/gcore/types/cloud/secret_create_params.py +++ b/src/gcore/types/cloud/secret_create_params.py @@ -10,67 +10,55 @@ class SecretCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/secrets/{project_id}/{region_id}'].post.parameters[1].schema" - """ name: Required[str] - """ - '#/components/schemas/CreateSecretSerializer/properties/name' - "$.components.schemas.CreateSecretSerializer.properties.name" - """ + """Secret name""" payload: Required[str] - """ - '#/components/schemas/CreateSecretSerializer/properties/payload' - "$.components.schemas.CreateSecretSerializer.properties.payload" + """Secret payload. + + For HTTPS-terminated load balancing, provide base64 encoded conents of a PKCS12 + file. The PKCS12 file is the combined TLS certificate, key, and intermediate + certificate chain obtained from an external certificate authority. The file can + be created via openssl, e.g.'openssl pkcs12 -export -inkey server.key -in + server.crt -certfile ca-chain.crt -passout pass: -out server.p12'The key and + certificate should be PEM-encoded, and the intermediate certificate chain should + be multiple PEM-encoded certs concatenated together """ payload_content_encoding: Required[Literal["base64"]] - """ - '#/components/schemas/CreateSecretSerializer/properties/payload_content_encoding' - "$.components.schemas.CreateSecretSerializer.properties.payload_content_encoding" + """The encoding used for the payload to be able to include it in the JSON request. + + Currently only base64 is supported """ payload_content_type: Required[str] - """ - '#/components/schemas/CreateSecretSerializer/properties/payload_content_type' - "$.components.schemas.CreateSecretSerializer.properties.payload_content_type" - """ + """The media type for the content of the payload""" secret_type: Required[Literal["certificate", "opaque", "passphrase", "private", "public", "symmetric"]] - """ - '#/components/schemas/CreateSecretSerializer/properties/secret_type' - "$.components.schemas.CreateSecretSerializer.properties.secret_type" + """Secret type. + + symmetric - Used for storing byte arrays such as keys suitable for symmetric + encryption; public - Used for storing the public key of an asymmetric keypair; + private - Used for storing the private key of an asymmetric keypair; + passphrase - Used for storing plain text passphrases; certificate - Used for + storing cryptographic certificates such as X.509 certificates; opaque - Used for + backwards compatibility with previous versions of the API """ algorithm: Optional[str] - """ - '#/components/schemas/CreateSecretSerializer/properties/algorithm/anyOf/0' - "$.components.schemas.CreateSecretSerializer.properties.algorithm.anyOf[0]" - """ + """Metadata provided by a user or system for informational purposes.""" bit_length: Optional[int] - """ - '#/components/schemas/CreateSecretSerializer/properties/bit_length/anyOf/0' - "$.components.schemas.CreateSecretSerializer.properties.bit_length.anyOf[0]" + """Metadata provided by a user or system for informational purposes. + + Value must be greater than zero. """ expiration: Optional[str] - """ - '#/components/schemas/CreateSecretSerializer/properties/expiration/anyOf/0' - "$.components.schemas.CreateSecretSerializer.properties.expiration.anyOf[0]" - """ + """Datetime when the secret will expire.""" mode: Optional[str] - """ - '#/components/schemas/CreateSecretSerializer/properties/mode/anyOf/0' - "$.components.schemas.CreateSecretSerializer.properties.mode.anyOf[0]" - """ + """Metadata provided by a user or system for informational purposes.""" diff --git a/src/gcore/types/cloud/secret_list_response.py b/src/gcore/types/cloud/secret_list_response.py index 4016c3c3..b6680c6c 100644 --- a/src/gcore/types/cloud/secret_list_response.py +++ b/src/gcore/types/cloud/secret_list_response.py @@ -10,13 +10,7 @@ class SecretListResponse(BaseModel): count: int - """ - '#/components/schemas/SecretSerializerList/properties/count' - "$.components.schemas.SecretSerializerList.properties.count" - """ + """Number of objects""" results: List[Secret] - """ - '#/components/schemas/SecretSerializerList/properties/results' - "$.components.schemas.SecretSerializerList.properties.results" - """ + """Objects""" 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 f8169cbc..4f394524 100644 --- a/src/gcore/types/cloud/secret_upload_tls_certificate_params.py +++ b/src/gcore/types/cloud/secret_upload_tls_certificate_params.py @@ -13,51 +13,25 @@ class SecretUploadTlsCertificateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v2/secrets/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Fsecrets%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v2/secrets/{project_id}/{region_id}'].post.parameters[1].schema" - """ name: Required[str] - """ - '#/components/schemas/CreateSecretSerializerV2/properties/name' - "$.components.schemas.CreateSecretSerializerV2.properties.name" - """ + """Secret name""" payload: Required[Payload] - """ - '#/components/schemas/CreateSecretSerializerV2/properties/payload' - "$.components.schemas.CreateSecretSerializerV2.properties.payload" - """ + """Secret payload.""" expiration: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] - """ - '#/components/schemas/CreateSecretSerializerV2/properties/expiration/anyOf/0' - "$.components.schemas.CreateSecretSerializerV2.properties.expiration.anyOf[0]" - """ + """Datetime when the secret will expire. Defaults to None""" class Payload(TypedDict, total=False): certificate: Required[str] - """ - '#/components/schemas/CreateSecretPayloadSerializer/properties/certificate' - "$.components.schemas.CreateSecretPayloadSerializer.properties.certificate" - """ + """SSL certificate in PEM format.""" certificate_chain: Required[str] - """ - '#/components/schemas/CreateSecretPayloadSerializer/properties/certificate_chain' - "$.components.schemas.CreateSecretPayloadSerializer.properties.certificate_chain" - """ + """SSL certificate chain of intermediates and root certificates in PEM format.""" private_key: Required[str] - """ - '#/components/schemas/CreateSecretPayloadSerializer/properties/private_key' - "$.components.schemas.CreateSecretPayloadSerializer.properties.private_key" - """ + """SSL private key in PEM format.""" diff --git a/src/gcore/types/cloud/security_group.py b/src/gcore/types/cloud/security_group.py index 2b3bc526..7407daad 100644 --- a/src/gcore/types/cloud/security_group.py +++ b/src/gcore/types/cloud/security_group.py @@ -12,67 +12,34 @@ class SecurityGroup(BaseModel): id: str - """ - '#/components/schemas/SecurityGroupSerializer/properties/id' - "$.components.schemas.SecurityGroupSerializer.properties.id" - """ + """Security group ID""" created_at: datetime - """ - '#/components/schemas/SecurityGroupSerializer/properties/created_at' - "$.components.schemas.SecurityGroupSerializer.properties.created_at" - """ + """Datetime when the security group was created""" name: str - """ - '#/components/schemas/SecurityGroupSerializer/properties/name' - "$.components.schemas.SecurityGroupSerializer.properties.name" - """ + """Security group name""" project_id: int - """ - '#/components/schemas/SecurityGroupSerializer/properties/project_id' - "$.components.schemas.SecurityGroupSerializer.properties.project_id" - """ + """Project ID""" region: str - """ - '#/components/schemas/SecurityGroupSerializer/properties/region' - "$.components.schemas.SecurityGroupSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/SecurityGroupSerializer/properties/region_id' - "$.components.schemas.SecurityGroupSerializer.properties.region_id" - """ + """Region ID""" revision_number: int - """ - '#/components/schemas/SecurityGroupSerializer/properties/revision_number' - "$.components.schemas.SecurityGroupSerializer.properties.revision_number" - """ + """The number of revisions""" tags_v2: List[Tag] - """ - '#/components/schemas/SecurityGroupSerializer/properties/tags_v2' - "$.components.schemas.SecurityGroupSerializer.properties.tags_v2" - """ + """Tags for a security group""" updated_at: datetime - """ - '#/components/schemas/SecurityGroupSerializer/properties/updated_at' - "$.components.schemas.SecurityGroupSerializer.properties.updated_at" - """ + """Datetime when the security group was last updated""" description: Optional[str] = None - """ - '#/components/schemas/SecurityGroupSerializer/properties/description/anyOf/0' - "$.components.schemas.SecurityGroupSerializer.properties.description.anyOf[0]" - """ + """Security group description""" security_group_rules: Optional[List[SecurityGroupRule]] = None - """ - '#/components/schemas/SecurityGroupSerializer/properties/security_group_rules' - "$.components.schemas.SecurityGroupSerializer.properties.security_group_rules" - """ + """Security group rules""" diff --git a/src/gcore/types/cloud/security_group_copy_params.py b/src/gcore/types/cloud/security_group_copy_params.py index c7c0498d..6a1666e9 100644 --- a/src/gcore/types/cloud/security_group_copy_params.py +++ b/src/gcore/types/cloud/security_group_copy_params.py @@ -9,19 +9,8 @@ class SecurityGroupCopyParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Fcopy/post/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy'].post.parameters[1].schema" - """ name: Required[str] - """ - '#/components/schemas/NameSerializerPydantic/properties/name' - "$.components.schemas.NameSerializerPydantic.properties.name" - """ + """Name.""" diff --git a/src/gcore/types/cloud/security_group_create_params.py b/src/gcore/types/cloud/security_group_create_params.py index ddd5c32d..4431da3c 100644 --- a/src/gcore/types/cloud/security_group_create_params.py +++ b/src/gcore/types/cloud/security_group_create_params.py @@ -10,60 +10,33 @@ class SecurityGroupCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].post.parameters[1].schema" - """ security_group: Required[SecurityGroup] - """ - '#/components/schemas/CreateSecurityGroupSerializer/properties/security_group' - "$.components.schemas.CreateSecurityGroupSerializer.properties.security_group" - """ + """Security group""" instances: List[str] - """ - '#/components/schemas/CreateSecurityGroupSerializer/properties/instances' - "$.components.schemas.CreateSecurityGroupSerializer.properties.instances" - """ + """List of instances""" class SecurityGroupSecurityGroupRule(TypedDict, total=False): description: str - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/description' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.description" - """ + """Rule description""" direction: Literal["egress", "ingress"] """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/direction' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.direction" + Ingress or egress, which is the direction in which the security group is applied """ ethertype: Literal["IPv4", "IPv6"] - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/ethertype' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.ethertype" - """ + """Ether type""" port_range_max: Optional[int] - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" - """ + """The maximum port number in the range that is matched by the security group rule""" port_range_min: Optional[int] - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" - """ + """The minimum port number in the range that is matched by the security group rule""" protocol: Literal[ "ah", @@ -91,45 +64,31 @@ class SecurityGroupSecurityGroupRule(TypedDict, total=False): "udplite", "vrrp", ] - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/protocol' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.protocol" - """ + """Protocol""" remote_group_id: str - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_group_id' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_group_id" - """ + """The remote group UUID to associate with this security group""" remote_ip_prefix: Optional[str] - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" - """ + """The remote IP prefix that is matched by this security group rule""" class SecurityGroup(TypedDict, total=False): name: Required[str] - """ - '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/name' - "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.name" - """ + """Security group name""" description: Optional[str] - """ - '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/description/anyOf/0' - "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.description.anyOf[0]" - """ + """Security group description""" security_group_rules: Iterable[SecurityGroupSecurityGroupRule] - """ - '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/security_group_rules' - "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.security_group_rules" - """ + """Security group rules""" tags: Dict[str, object] - """ - '#/components/schemas/SingleCreateSecurityGroupSerializer/properties/tags' - "$.components.schemas.SingleCreateSecurityGroupSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ diff --git a/src/gcore/types/cloud/security_group_list_params.py b/src/gcore/types/cloud/security_group_list_params.py index e01fbe1f..ba59268e 100644 --- a/src/gcore/types/cloud/security_group_list_params.py +++ b/src/gcore/types/cloud/security_group_list_params.py @@ -10,37 +10,21 @@ class SecurityGroupListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[1].schema" - """ limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[2]" - """ + """Limit the number of returned limit request entities.""" offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[3]" - """ + """Offset value is used to exclude the first set of records from the result.""" tag_key: List[str] - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[4]" - """ + """Filter by tag keys.""" tag_key_value: str - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}'].get.parameters[5]" + """Filter by tag key-value pairs. + + Must be a valid JSON string. curl -G --data-urlencode "tag_key_value={"key": + "value"}" --url "http://localhost:1111/v1/securitygroups/1/1" """ diff --git a/src/gcore/types/cloud/security_group_rule.py b/src/gcore/types/cloud/security_group_rule.py index 1bccd8fa..533537e8 100644 --- a/src/gcore/types/cloud/security_group_rule.py +++ b/src/gcore/types/cloud/security_group_rule.py @@ -11,64 +11,40 @@ class SecurityGroupRule(BaseModel): id: str - """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/id' - "$.components.schemas.SecurityGroupRuleSerializer.properties.id" - """ + """The ID of the security group rule""" created_at: datetime - """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/created_at' - "$.components.schemas.SecurityGroupRuleSerializer.properties.created_at" - """ + """Datetime when the rule was created""" direction: Literal["egress", "ingress"] """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/direction' - "$.components.schemas.SecurityGroupRuleSerializer.properties.direction" + Ingress or egress, which is the direction in which the security group rule is + applied """ revision_number: int - """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/revision_number' - "$.components.schemas.SecurityGroupRuleSerializer.properties.revision_number" - """ + """The revision number of the resource""" security_group_id: str - """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/security_group_id' - "$.components.schemas.SecurityGroupRuleSerializer.properties.security_group_id" - """ + """The security group ID to associate with this security group rule""" updated_at: datetime - """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/updated_at' - "$.components.schemas.SecurityGroupRuleSerializer.properties.updated_at" - """ + """Datetime when the rule was last updated""" description: Optional[str] = None - """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/description/anyOf/0' - "$.components.schemas.SecurityGroupRuleSerializer.properties.description.anyOf[0]" - """ + """Rule description""" ethertype: Optional[Literal["IPv4", "IPv6"]] = None """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/ethertype/anyOf/0' - "$.components.schemas.SecurityGroupRuleSerializer.properties.ethertype.anyOf[0]" + Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress + or egress rules. """ port_range_max: Optional[int] = None - """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' - "$.components.schemas.SecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" - """ + """The maximum port number in the range that is matched by the security group rule""" port_range_min: Optional[int] = None - """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' - "$.components.schemas.SecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" - """ + """The minimum port number in the range that is matched by the security group rule""" protocol: Optional[ Literal[ @@ -98,19 +74,10 @@ class SecurityGroupRule(BaseModel): "vrrp", ] ] = None - """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/protocol/anyOf/0' - "$.components.schemas.SecurityGroupRuleSerializer.properties.protocol.anyOf[0]" - """ + """Protocol""" remote_group_id: Optional[str] = None - """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/remote_group_id/anyOf/0' - "$.components.schemas.SecurityGroupRuleSerializer.properties.remote_group_id.anyOf[0]" - """ + """The remote group UUID to associate with this security group rule""" remote_ip_prefix: Optional[str] = None - """ - '#/components/schemas/SecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' - "$.components.schemas.SecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" - """ + """The remote IP prefix that is matched by this security group rule""" diff --git a/src/gcore/types/cloud/security_group_update_params.py b/src/gcore/types/cloud/security_group_update_params.py index e2fb8607..d2118275 100644 --- a/src/gcore/types/cloud/security_group_update_params.py +++ b/src/gcore/types/cloud/security_group_update_params.py @@ -10,66 +10,40 @@ class SecurityGroupUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}'].patch.parameters[1].schema" - """ changed_rules: Iterable[ChangedRule] - """ - '#/components/schemas/UpdateSecurityGroupSerializer/properties/changed_rules' - "$.components.schemas.UpdateSecurityGroupSerializer.properties.changed_rules" - """ + """List of rules to create or delete""" name: str - """ - '#/components/schemas/UpdateSecurityGroupSerializer/properties/name' - "$.components.schemas.UpdateSecurityGroupSerializer.properties.name" - """ + """Name""" class ChangedRule(TypedDict, total=False): action: Required[Literal["create", "delete"]] - """ - '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/action' - "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.action" - """ + """Action for a rule""" description: str - """ - '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/description' - "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.description" - """ + """Security grpup rule description""" direction: Literal["egress", "ingress"] """ - '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/direction' - "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.direction" + Ingress or egress, which is the direction in which the security group rule is + applied """ ethertype: Optional[Literal["IPv4", "IPv6"]] """ - '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/ethertype/anyOf/0' - "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.ethertype.anyOf[0]" + Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress + or egress rules. """ port_range_max: int - """ - '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/port_range_max' - "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.port_range_max" - """ + """The maximum port number in the range that is matched by the security group rule""" port_range_min: int - """ - '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/port_range_min' - "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.port_range_min" - """ + """The minimum port number in the range that is matched by the security group rule""" protocol: Literal[ "ah", @@ -97,25 +71,13 @@ class ChangedRule(TypedDict, total=False): "udplite", "vrrp", ] - """ - '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/protocol' - "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.protocol" - """ + """Protocol""" remote_group_id: Optional[str] - """ - '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/remote_group_id/anyOf/0' - "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.remote_group_id.anyOf[0]" - """ + """The remote group UUID to associate with this security group rule""" remote_ip_prefix: Optional[str] - """ - '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' - "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" - """ + """The remote IP prefix that is matched by this security group rule""" security_group_rule_id: Optional[str] - """ - '#/components/schemas/UpdateSecurityGroupRuleSerializer/properties/security_group_rule_id/anyOf/0' - "$.components.schemas.UpdateSecurityGroupRuleSerializer.properties.security_group_rule_id.anyOf[0]" - """ + """UUID of rule to be deleted. Required for action 'delete' only""" diff --git a/src/gcore/types/cloud/security_groups/rule_create_params.py b/src/gcore/types/cloud/security_groups/rule_create_params.py index 8a1b7e2d..a8ff773d 100644 --- a/src/gcore/types/cloud/security_groups/rule_create_params.py +++ b/src/gcore/types/cloud/security_groups/rule_create_params.py @@ -10,46 +10,25 @@ class RuleCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/0/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygroups%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bgroup_id%7D%2Frules/post/parameters/1/schema' - "$.paths['/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules'].post.parameters[1].schema" - """ description: str - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/description' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.description" - """ + """Rule description""" direction: Literal["egress", "ingress"] """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/direction' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.direction" + Ingress or egress, which is the direction in which the security group is applied """ ethertype: Literal["IPv4", "IPv6"] - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/ethertype' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.ethertype" - """ + """Ether type""" port_range_max: Optional[int] - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" - """ + """The maximum port number in the range that is matched by the security group rule""" port_range_min: Optional[int] - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" - """ + """The minimum port number in the range that is matched by the security group rule""" protocol: Literal[ "ah", @@ -77,19 +56,10 @@ class RuleCreateParams(TypedDict, total=False): "udplite", "vrrp", ] - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/protocol' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.protocol" - """ + """Protocol""" remote_group_id: str - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_group_id' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_group_id" - """ + """The remote group UUID to associate with this security group""" remote_ip_prefix: Optional[str] - """ - '#/components/schemas/CreateSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' - "$.components.schemas.CreateSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" - """ + """The remote IP prefix that is matched by this security group rule""" diff --git a/src/gcore/types/cloud/security_groups/rule_replace_params.py b/src/gcore/types/cloud/security_groups/rule_replace_params.py index 5eba9925..be16eb3b 100644 --- a/src/gcore/types/cloud/security_groups/rule_replace_params.py +++ b/src/gcore/types/cloud/security_groups/rule_replace_params.py @@ -10,52 +10,32 @@ class RuleReplaceParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/0/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[0].schema" - """ region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fsecuritygrouprules%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Brule_id%7D/put/parameters/1/schema' - "$.paths['/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}'].put.parameters[1].schema" - """ direction: Required[Literal["egress", "ingress"]] """ - '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/direction' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.direction" + Ingress or egress, which is the direction in which the security group rule is + applied """ security_group_id: Required[str] - """ - '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/security_group_id' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.security_group_id" - """ + """Parent security group of this rule""" description: str - """ - '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/description' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.description" - """ + """Rule description""" ethertype: Optional[Literal["IPv4", "IPv6"]] """ - '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/ethertype/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.ethertype.anyOf[0]" + Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress + or egress rules. """ port_range_max: Optional[int] - """ - '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/port_range_max/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.port_range_max.anyOf[0]" - """ + """The maximum port number in the range that is matched by the security group rule""" port_range_min: Optional[int] - """ - '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/port_range_min/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.port_range_min.anyOf[0]" - """ + """The minimum port number in the range that is matched by the security group rule""" protocol: Literal[ "ah", @@ -83,19 +63,10 @@ class RuleReplaceParams(TypedDict, total=False): "udplite", "vrrp", ] - """ - '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/protocol' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.protocol" - """ + """Protocol""" remote_group_id: Optional[str] - """ - '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/remote_group_id/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.remote_group_id.anyOf[0]" - """ + """The remote group UUID to associate with this security group rule""" remote_ip_prefix: Optional[str] - """ - '#/components/schemas/ChangeSecurityGroupRuleSerializer/properties/remote_ip_prefix/anyOf/0' - "$.components.schemas.ChangeSecurityGroupRuleSerializer.properties.remote_ip_prefix.anyOf[0]" - """ + """The remote IP prefix that is matched by this security group rule""" diff --git a/src/gcore/types/cloud/ssh_key.py b/src/gcore/types/cloud/ssh_key.py index 4b6f9c15..1430a38d 100644 --- a/src/gcore/types/cloud/ssh_key.py +++ b/src/gcore/types/cloud/ssh_key.py @@ -11,49 +11,29 @@ class SSHKey(BaseModel): id: str - """ - '#/components/schemas/SSHKeySerializer/properties/id' - "$.components.schemas.SSHKeySerializer.properties.id" - """ + """SSH key ID""" created_at: Optional[datetime] = None - """ - '#/components/schemas/SSHKeySerializer/properties/created_at/anyOf/0' - "$.components.schemas.SSHKeySerializer.properties.created_at.anyOf[0]" - """ + """SSH key creation time""" fingerprint: str - """ - '#/components/schemas/SSHKeySerializer/properties/fingerprint' - "$.components.schemas.SSHKeySerializer.properties.fingerprint" - """ + """Fingerprint""" name: str - """ - '#/components/schemas/SSHKeySerializer/properties/name' - "$.components.schemas.SSHKeySerializer.properties.name" - """ + """SSH key name""" project_id: Optional[int] = None - """ - '#/components/schemas/SSHKeySerializer/properties/project_id/anyOf/0' - "$.components.schemas.SSHKeySerializer.properties.project_id.anyOf[0]" - """ + """Project ID""" public_key: str - """ - '#/components/schemas/SSHKeySerializer/properties/public_key' - "$.components.schemas.SSHKeySerializer.properties.public_key" + """The public part of an SSH key is the shareable portion of an SSH key pair. + + It can be safely sent to servers or services to grant access. It does not + contain sensitive information. """ shared_in_project: bool - """ - '#/components/schemas/SSHKeySerializer/properties/shared_in_project' - "$.components.schemas.SSHKeySerializer.properties.shared_in_project" - """ + """SSH key will be visible to all users in the project""" state: Literal["ACTIVE", "DELETING"] - """ - '#/components/schemas/SSHKeySerializer/properties/state' - "$.components.schemas.SSHKeySerializer.properties.state" - """ + """SSH key state""" diff --git a/src/gcore/types/cloud/ssh_key_create_params.py b/src/gcore/types/cloud/ssh_key_create_params.py index 53e04451..65008f58 100644 --- a/src/gcore/types/cloud/ssh_key_create_params.py +++ b/src/gcore/types/cloud/ssh_key_create_params.py @@ -9,25 +9,23 @@ class SSHKeyCreateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].post.parameters[0].schema" - """ + """Project ID""" name: Required[str] - """ - '#/components/schemas/CreateSSHKeySerializer/properties/name' - "$.components.schemas.CreateSSHKeySerializer.properties.name" - """ + """SSH key name""" public_key: str - """ - '#/components/schemas/CreateSSHKeySerializer/properties/public_key' - "$.components.schemas.CreateSSHKeySerializer.properties.public_key" + """The public part of an SSH key is the shareable portion of an SSH key pair. + + It can be safely sent to servers or services to grant access. It does not + contain sensitive information. + + - If you’re uploading your own key, provide the public part here (usually found + in a file like `id_ed25519.pub`). + - If you want the platform to generate an Ed25519 key pair for you, leave this + field empty — the system will return the private key in the response **once + only**. """ shared_in_project: bool - """ - '#/components/schemas/CreateSSHKeySerializer/properties/shared_in_project' - "$.components.schemas.CreateSSHKeySerializer.properties.shared_in_project" - """ + """SSH key is shared with all users in the project""" diff --git a/src/gcore/types/cloud/ssh_key_created.py b/src/gcore/types/cloud/ssh_key_created.py index ae4d3436..c334e2ed 100644 --- a/src/gcore/types/cloud/ssh_key_created.py +++ b/src/gcore/types/cloud/ssh_key_created.py @@ -11,55 +11,43 @@ class SSHKeyCreated(BaseModel): id: str - """ - '#/components/schemas/CreatedSSHKeySerializer/properties/id' - "$.components.schemas.CreatedSSHKeySerializer.properties.id" - """ + """SSH key ID""" created_at: datetime - """ - '#/components/schemas/CreatedSSHKeySerializer/properties/created_at' - "$.components.schemas.CreatedSSHKeySerializer.properties.created_at" - """ + """SSH key creation time""" fingerprint: str - """ - '#/components/schemas/CreatedSSHKeySerializer/properties/fingerprint' - "$.components.schemas.CreatedSSHKeySerializer.properties.fingerprint" - """ + """Fingerprint""" name: str - """ - '#/components/schemas/CreatedSSHKeySerializer/properties/name' - "$.components.schemas.CreatedSSHKeySerializer.properties.name" - """ + """SSH key name""" private_key: Optional[str] = None - """ - '#/components/schemas/CreatedSSHKeySerializer/properties/private_key/anyOf/0' - "$.components.schemas.CreatedSSHKeySerializer.properties.private_key.anyOf[0]" + """The private part of an SSH key is the confidential portion of the key pair. + + It should never be shared or exposed. This key is used to prove your identity + when connecting to a server. + + If you omit the `public_key`, the platform will generate a key for you. The + private_key will be returned **once** in the API response. Be sure to save it + securely, as it cannot be retrieved again later. + + Best practice: Save the private key to a secure location on your machine (e.g., + `~/.ssh/id_ed25519`) and set the file permissions to be readable only by you. """ project_id: int - """ - '#/components/schemas/CreatedSSHKeySerializer/properties/project_id' - "$.components.schemas.CreatedSSHKeySerializer.properties.project_id" - """ + """Project ID""" public_key: str - """ - '#/components/schemas/CreatedSSHKeySerializer/properties/public_key' - "$.components.schemas.CreatedSSHKeySerializer.properties.public_key" + """The public part of an SSH key is the shareable portion of an SSH key pair. + + It can be safely sent to servers or services to grant access. It does not + contain sensitive information. """ shared_in_project: bool - """ - '#/components/schemas/CreatedSSHKeySerializer/properties/shared_in_project' - "$.components.schemas.CreatedSSHKeySerializer.properties.shared_in_project" - """ + """SSH key will be visible to all users in the project""" state: Literal["ACTIVE", "DELETING"] - """ - '#/components/schemas/CreatedSSHKeySerializer/properties/state' - "$.components.schemas.CreatedSSHKeySerializer.properties.state" - """ + """SSH key state""" diff --git a/src/gcore/types/cloud/ssh_key_list_params.py b/src/gcore/types/cloud/ssh_key_list_params.py index 92591f91..a3dea48f 100644 --- a/src/gcore/types/cloud/ssh_key_list_params.py +++ b/src/gcore/types/cloud/ssh_key_list_params.py @@ -9,25 +9,13 @@ class SSHKeyListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[0].schema" - """ + """Project ID""" limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/1' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[1]" - """ + """Maximum number of SSH keys to return""" offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/2' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[2]" - """ + """Offset for pagination""" order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] - """ - '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D/get/parameters/3' - "$.paths['/cloud/v1/ssh_keys/{project_id}'].get.parameters[3]" - """ + """Sort order for the SSH keys""" diff --git a/src/gcore/types/cloud/ssh_key_update_params.py b/src/gcore/types/cloud/ssh_key_update_params.py index bd67e3f0..5efc271e 100644 --- a/src/gcore/types/cloud/ssh_key_update_params.py +++ b/src/gcore/types/cloud/ssh_key_update_params.py @@ -9,13 +9,7 @@ class SSHKeyUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fssh_keys%2F%7Bproject_id%7D%2F%7Bssh_key_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}'].patch.parameters[0].schema" - """ + """Project ID""" shared_in_project: Required[bool] - """ - '#/components/schemas/ShareSSHKeySerializer/properties/shared_in_project' - "$.components.schemas.ShareSSHKeySerializer.properties.shared_in_project" - """ + """Share your ssh key with all users in the project""" diff --git a/src/gcore/types/cloud/subnet.py b/src/gcore/types/cloud/subnet.py index b0145b3a..4d16da48 100644 --- a/src/gcore/types/cloud/subnet.py +++ b/src/gcore/types/cloud/subnet.py @@ -13,121 +13,75 @@ class Subnet(BaseModel): cidr: str - """ - '#/components/schemas/SubnetSerializer/properties/cidr' - "$.components.schemas.SubnetSerializer.properties.cidr" - """ + """CIDR""" created_at: datetime - """ - '#/components/schemas/SubnetSerializer/properties/created_at' - "$.components.schemas.SubnetSerializer.properties.created_at" - """ + """Datetime when the subnet was created""" enable_dhcp: bool - """ - '#/components/schemas/SubnetSerializer/properties/enable_dhcp' - "$.components.schemas.SubnetSerializer.properties.enable_dhcp" - """ + """True if DHCP should be enabled""" ip_version: IPVersion - """ - '#/components/schemas/SubnetSerializer/properties/ip_version' - "$.components.schemas.SubnetSerializer.properties.ip_version" - """ + """IP version""" name: str - """ - '#/components/schemas/SubnetSerializer/properties/name' - "$.components.schemas.SubnetSerializer.properties.name" - """ + """Subnet name""" network_id: str - """ - '#/components/schemas/SubnetSerializer/properties/network_id' - "$.components.schemas.SubnetSerializer.properties.network_id" - """ + """Network ID""" project_id: int - """ - '#/components/schemas/SubnetSerializer/properties/project_id' - "$.components.schemas.SubnetSerializer.properties.project_id" - """ + """Project ID""" region: str - """ - '#/components/schemas/SubnetSerializer/properties/region' - "$.components.schemas.SubnetSerializer.properties.region" - """ + """Region name""" region_id: int - """ - '#/components/schemas/SubnetSerializer/properties/region_id' - "$.components.schemas.SubnetSerializer.properties.region_id" - """ + """Region ID""" tags: List[Tag] - """ - '#/components/schemas/SubnetSerializer/properties/tags' - "$.components.schemas.SubnetSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ updated_at: datetime - """ - '#/components/schemas/SubnetSerializer/properties/updated_at' - "$.components.schemas.SubnetSerializer.properties.updated_at" - """ + """Datetime when the subnet was last updated""" id: Optional[str] = None - """ - '#/components/schemas/SubnetSerializer/properties/id/anyOf/0' - "$.components.schemas.SubnetSerializer.properties.id.anyOf[0]" - """ + """Subnet id.""" available_ips: Optional[int] = None - """ - '#/components/schemas/SubnetSerializer/properties/available_ips/anyOf/0' - "$.components.schemas.SubnetSerializer.properties.available_ips.anyOf[0]" - """ + """Number of available ips in subnet""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/SubnetSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.SubnetSerializer.properties.creator_task_id.anyOf[0]" - """ + """Task that created this entity""" dns_nameservers: Optional[List[str]] = None - """ - '#/components/schemas/SubnetSerializer/properties/dns_nameservers/anyOf/0' - "$.components.schemas.SubnetSerializer.properties.dns_nameservers.anyOf[0]" - """ + """List IP addresses of a DNS resolver reachable from the network""" gateway_ip: Optional[str] = None - """ - '#/components/schemas/SubnetSerializer/properties/gateway_ip/anyOf/0' - "$.components.schemas.SubnetSerializer.properties.gateway_ip.anyOf[0]" + """Default GW IPv4 address, advertised in DHCP routes of this subnet. + + If null, no gateway is advertised by this subnet. """ has_router: Optional[bool] = None - """ - '#/components/schemas/SubnetSerializer/properties/has_router' - "$.components.schemas.SubnetSerializer.properties.has_router" - """ + """Subnet has router attached to it""" host_routes: Optional[List[Route]] = None - """ - '#/components/schemas/SubnetSerializer/properties/host_routes/anyOf/0' - "$.components.schemas.SubnetSerializer.properties.host_routes.anyOf[0]" - """ + """List of custom static routes to advertise via DHCP.""" task_id: Optional[str] = None - """ - '#/components/schemas/SubnetSerializer/properties/task_id/anyOf/0' - "$.components.schemas.SubnetSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ total_ips: Optional[int] = None - """ - '#/components/schemas/SubnetSerializer/properties/total_ips/anyOf/0' - "$.components.schemas.SubnetSerializer.properties.total_ips.anyOf[0]" - """ + """Total number of ips in subnet""" diff --git a/src/gcore/types/cloud/tag.py b/src/gcore/types/cloud/tag.py index 0baf134b..bf23a3ce 100644 --- a/src/gcore/types/cloud/tag.py +++ b/src/gcore/types/cloud/tag.py @@ -7,19 +7,10 @@ class Tag(BaseModel): key: str - """ - '#/components/schemas/TagSerializer/properties/key' - "$.components.schemas.TagSerializer.properties.key" - """ + """Tag key. The maximum size for a key is 255 bytes.""" read_only: bool - """ - '#/components/schemas/TagSerializer/properties/read_only' - "$.components.schemas.TagSerializer.properties.read_only" - """ + """If true, the tag is read-only and cannot be modified by the user""" value: str - """ - '#/components/schemas/TagSerializer/properties/value' - "$.components.schemas.TagSerializer.properties.value" - """ + """Tag value. The maximum size for a value is 1024 bytes.""" diff --git a/src/gcore/types/cloud/task.py b/src/gcore/types/cloud/task.py index 15cba566..a66a37a9 100644 --- a/src/gcore/types/cloud/task.py +++ b/src/gcore/types/cloud/task.py @@ -10,270 +10,138 @@ class CreatedResources(BaseModel): ai_clusters: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/ai_clusters' - "$.components.schemas.CreatedResources.properties.ai_clusters" - """ + """IDs of created AI clusters""" api_keys: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/api_keys' - "$.components.schemas.CreatedResources.properties.api_keys" - """ + """IDs of created API keys""" caas_containers: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/caas_containers' - "$.components.schemas.CreatedResources.properties.caas_containers" - """ + """IDs of created CaaS containers""" ddos_profiles: Optional[List[int]] = None - """ - '#/components/schemas/CreatedResources/properties/ddos_profiles' - "$.components.schemas.CreatedResources.properties.ddos_profiles" - """ + """IDs of created ddos protection profiles""" faas_functions: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/faas_functions' - "$.components.schemas.CreatedResources.properties.faas_functions" - """ + """IDs of created FaaS functions""" faas_namespaces: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/faas_namespaces' - "$.components.schemas.CreatedResources.properties.faas_namespaces" - """ + """IDs of created FaaS namespaces""" file_shares: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/file_shares' - "$.components.schemas.CreatedResources.properties.file_shares" - """ + """IDs of created file shares""" floatingips: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/floatingips' - "$.components.schemas.CreatedResources.properties.floatingips" - """ + """IDs of created floating IPs""" healthmonitors: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/healthmonitors' - "$.components.schemas.CreatedResources.properties.healthmonitors" - """ + """IDs of created health monitors""" heat: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/heat' - "$.components.schemas.CreatedResources.properties.heat" - """ + """IDs of created heat resources""" images: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/images' - "$.components.schemas.CreatedResources.properties.images" - """ + """IDs of created images""" inference_instances: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/inference_instances' - "$.components.schemas.CreatedResources.properties.inference_instances" - """ + """IDs of created inference instances""" instances: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/instances' - "$.components.schemas.CreatedResources.properties.instances" - """ + """IDs of created instances""" k8s_clusters: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/k8s_clusters' - "$.components.schemas.CreatedResources.properties.k8s_clusters" - """ + """IDs of created Kubernetes clusters""" k8s_pools: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/k8s_pools' - "$.components.schemas.CreatedResources.properties.k8s_pools" - """ + """IDs of created Kubernetes pools""" l7polices: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/l7polices' - "$.components.schemas.CreatedResources.properties.l7polices" - """ + """IDs of created L7 policies""" l7rules: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/l7rules' - "$.components.schemas.CreatedResources.properties.l7rules" - """ + """IDs of created L7 rules""" laas_topic: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/laas_topic' - "$.components.schemas.CreatedResources.properties.laas_topic" - """ + """IDs of created LaaS topics""" listeners: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/listeners' - "$.components.schemas.CreatedResources.properties.listeners" - """ + """IDs of created load balancer listeners""" loadbalancers: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/loadbalancers' - "$.components.schemas.CreatedResources.properties.loadbalancers" - """ + """IDs of created load balancers""" members: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/members' - "$.components.schemas.CreatedResources.properties.members" - """ + """IDs of created pool members""" networks: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/networks' - "$.components.schemas.CreatedResources.properties.networks" - """ + """IDs of created networks""" pools: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/pools' - "$.components.schemas.CreatedResources.properties.pools" - """ + """IDs of created load balancer pools""" ports: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/ports' - "$.components.schemas.CreatedResources.properties.ports" - """ + """IDs of created ports""" postgresql_clusters: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/postgresql_clusters' - "$.components.schemas.CreatedResources.properties.postgresql_clusters" - """ + """IDs of created postgres clusters""" projects: Optional[List[int]] = None - """ - '#/components/schemas/CreatedResources/properties/projects' - "$.components.schemas.CreatedResources.properties.projects" - """ + """IDs of created projects""" registry_registries: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/registry_registries' - "$.components.schemas.CreatedResources.properties.registry_registries" - """ + """IDs of created registry registries""" registry_users: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/registry_users' - "$.components.schemas.CreatedResources.properties.registry_users" - """ + """IDs of created registry users""" routers: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/routers' - "$.components.schemas.CreatedResources.properties.routers" - """ + """IDs of created routers""" secrets: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/secrets' - "$.components.schemas.CreatedResources.properties.secrets" - """ + """IDs of created secrets""" servergroups: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/servergroups' - "$.components.schemas.CreatedResources.properties.servergroups" - """ + """IDs of created server groups""" snapshots: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/snapshots' - "$.components.schemas.CreatedResources.properties.snapshots" - """ + """IDs of created volume snapshots""" subnets: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/subnets' - "$.components.schemas.CreatedResources.properties.subnets" - """ + """IDs of created subnets""" volumes: Optional[List[str]] = None - """ - '#/components/schemas/CreatedResources/properties/volumes' - "$.components.schemas.CreatedResources.properties.volumes" - """ + """IDs of created volumes""" class Task(BaseModel): id: str - """ - '#/components/schemas/TaskSerializer/properties/id' - "$.components.schemas.TaskSerializer.properties.id" - """ + """The task ID""" created_on: Optional[str] = None - """ - '#/components/schemas/TaskSerializer/properties/created_on/anyOf/0' - "$.components.schemas.TaskSerializer.properties.created_on.anyOf[0]" - """ + """Created timestamp""" state: Literal["ERROR", "FINISHED", "NEW", "RUNNING"] - """ - '#/components/schemas/TaskSerializer/properties/state' - "$.components.schemas.TaskSerializer.properties.state" - """ + """The task state""" task_type: str - """ - '#/components/schemas/TaskSerializer/properties/task_type' - "$.components.schemas.TaskSerializer.properties.task_type" - """ + """The task type""" user_id: int - """ - '#/components/schemas/TaskSerializer/properties/user_id' - "$.components.schemas.TaskSerializer.properties.user_id" - """ + """The user ID that initiated the task""" acknowledged_at: Optional[str] = None - """ - '#/components/schemas/TaskSerializer/properties/acknowledged_at/anyOf/0' - "$.components.schemas.TaskSerializer.properties.acknowledged_at.anyOf[0]" - """ + """If task was acknowledged, this field stores acknowledge timestamp""" acknowledged_by: Optional[int] = None - """ - '#/components/schemas/TaskSerializer/properties/acknowledged_by/anyOf/0' - "$.components.schemas.TaskSerializer.properties.acknowledged_by.anyOf[0]" - """ + """If task was acknowledged, this field stores user_id of the person""" client_id: Optional[int] = None - """ - '#/components/schemas/TaskSerializer/properties/client_id/anyOf/0' - "$.components.schemas.TaskSerializer.properties.client_id.anyOf[0]" - """ + """The client ID""" created_resources: Optional[CreatedResources] = None - """ - '#/components/schemas/TaskSerializer/properties/created_resources/anyOf/0' - "$.components.schemas.TaskSerializer.properties.created_resources.anyOf[0]" - """ + """If the task creates resources, this field will contain their IDs""" data: Optional[object] = None - """ - '#/components/schemas/TaskSerializer/properties/data/anyOf/0' - "$.components.schemas.TaskSerializer.properties.data.anyOf[0]" - """ + """Task parameters""" detailed_state: Optional[ Literal[ @@ -290,67 +158,34 @@ class Task(BaseModel): "VIPU_CONTROLLER", ] ] = None - """ - '#/components/schemas/TaskSerializer/properties/detailed_state/anyOf/0' - "$.components.schemas.TaskSerializer.properties.detailed_state.anyOf[0]" - """ + """Task detailed state that is more specific to task type""" error: Optional[str] = None - """ - '#/components/schemas/TaskSerializer/properties/error/anyOf/0' - "$.components.schemas.TaskSerializer.properties.error.anyOf[0]" - """ + """The error value""" finished_on: Optional[str] = None - """ - '#/components/schemas/TaskSerializer/properties/finished_on/anyOf/0' - "$.components.schemas.TaskSerializer.properties.finished_on.anyOf[0]" - """ + """Finished timestamp""" job_id: Optional[str] = None - """ - '#/components/schemas/TaskSerializer/properties/job_id/anyOf/0' - "$.components.schemas.TaskSerializer.properties.job_id.anyOf[0]" - """ + """Job ID""" lifecycle_policy_id: Optional[int] = None - """ - '#/components/schemas/TaskSerializer/properties/lifecycle_policy_id/anyOf/0' - "$.components.schemas.TaskSerializer.properties.lifecycle_policy_id.anyOf[0]" - """ + """Lifecycle policy ID""" project_id: Optional[int] = None - """ - '#/components/schemas/TaskSerializer/properties/project_id/anyOf/0' - "$.components.schemas.TaskSerializer.properties.project_id.anyOf[0]" - """ + """The project ID""" region_id: Optional[int] = None - """ - '#/components/schemas/TaskSerializer/properties/region_id/anyOf/0' - "$.components.schemas.TaskSerializer.properties.region_id.anyOf[0]" - """ + """The region ID""" request_id: Optional[str] = None - """ - '#/components/schemas/TaskSerializer/properties/request_id/anyOf/0' - "$.components.schemas.TaskSerializer.properties.request_id.anyOf[0]" - """ + """The request ID""" schedule_id: Optional[str] = None - """ - '#/components/schemas/TaskSerializer/properties/schedule_id/anyOf/0' - "$.components.schemas.TaskSerializer.properties.schedule_id.anyOf[0]" - """ + """Schedule ID""" updated_on: Optional[str] = None - """ - '#/components/schemas/TaskSerializer/properties/updated_on/anyOf/0' - "$.components.schemas.TaskSerializer.properties.updated_on.anyOf[0]" - """ + """Last updated timestamp""" user_client_id: Optional[int] = None - """ - '#/components/schemas/TaskSerializer/properties/user_client_id/anyOf/0' - "$.components.schemas.TaskSerializer.properties.user_client_id.anyOf[0]" - """ + """Client, specified in user's JWT""" diff --git a/src/gcore/types/cloud/task_acknowledge_all_params.py b/src/gcore/types/cloud/task_acknowledge_all_params.py index 4955d69a..d35c39b7 100644 --- a/src/gcore/types/cloud/task_acknowledge_all_params.py +++ b/src/gcore/types/cloud/task_acknowledge_all_params.py @@ -10,13 +10,7 @@ class TaskAcknowledgeAllParams(TypedDict, total=False): project_id: Optional[int] - """ - '#/paths/%2Fcloud%2Fv1%2Ftasks%2Facknowledge_all/post/parameters/0/schema/anyOf/0' - "$.paths['/cloud/v1/tasks/acknowledge_all'].post.parameters[0].schema.anyOf[0]" - """ + """Project ID""" region_id: Optional[int] - """ - '#/paths/%2Fcloud%2Fv1%2Ftasks%2Facknowledge_all/post/parameters/1/schema/anyOf/0' - "$.paths['/cloud/v1/tasks/acknowledge_all'].post.parameters[1].schema.anyOf[0]" - """ + """Region ID""" diff --git a/src/gcore/types/cloud/task_id_list.py b/src/gcore/types/cloud/task_id_list.py index dbc058c3..957deed7 100644 --- a/src/gcore/types/cloud/task_id_list.py +++ b/src/gcore/types/cloud/task_id_list.py @@ -9,7 +9,4 @@ class TaskIDList(BaseModel): tasks: List[str] - """ - '#/components/schemas/TaskIDsSerializer/properties/tasks' - "$.components.schemas.TaskIDsSerializer.properties.tasks" - """ + """List of task IDs""" diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index 54cf8776..f331c906 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -13,61 +13,92 @@ class TaskListParams(TypedDict, total=False): from_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] - """ - '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/0/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[0].schema.anyOf[0]" + """ISO formatted datetime string. + + Filter the tasks by creation date greater than or equal to from_timestamp """ is_acknowledged: Optional[bool] - """ - '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/1/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[1].schema.anyOf[0]" - """ + """Filter the tasks by their acknowledgement status""" limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/2' - "$.paths['/cloud/v1/tasks'].get.parameters[2]" + """Limit the number of returned tasks. + + Falls back to default of 10 if not specified. Limited by max limit value of 1000 """ offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/3' - "$.paths['/cloud/v1/tasks'].get.parameters[3]" - """ + """Offset value is used to exclude the first set of records from the result""" project_id: Optional[Iterable[int]] - """ - '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/4/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[4].schema.anyOf[0]" + """The project ID to filter the tasks by project. + + Supports multiple values of kind key=value1&key=value2 """ region_id: Optional[Iterable[int]] - """ - '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/5/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[5].schema.anyOf[0]" + """The region ID to filter the tasks by region. + + Supports multiple values of kind key=value1&key=value2 """ sorting: Optional[Literal["asc", "desc"]] - """ - '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/6/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[6].schema.anyOf[0]" - """ + """Sorting by creation date. Oldest first, or most recent first""" state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] - """ - '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/7/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[7].schema.anyOf[0]" + """Filter the tasks by state. + + Supports multiple values of kind key=value1&key=value2 """ task_type: Optional[str] """ - '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/8/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[8].schema.anyOf[0]" + Filter the tasks by their type one of ['activate_ddos_profile', + 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', + 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', + 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', + 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', + 'create_fip', 'create_gpu_virtual_cluster', 'create_image', + 'create_inference_instance', 'create_inference_instance_key', + 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', + 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', + 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', + 'create_reserved_fixed_ip', 'create_router', 'create_secret', + 'create_servergroup', 'create_sfs', 'create_snapshot', 'create_subnet', + 'create_vm', 'create_volume', 'deactivate_ddos_profile', + 'delete_ai_cluster_gpu', 'delete_caas_container', + 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', + 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', + 'delete_gpu_virtual_server', 'delete_image', 'delete_inference_instance', + 'delete_k8s_cluster_pool_v2', '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', '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', 'replace_lbmetadata', 'resize_k8s_cluster_v2', + 'resize_loadbalancer', 'resize_vm', 'resume_vm', 'revert_volume', + 'soft_reboot_gpu_baremetal_server', 'soft_reboot_gpu_virtual_cluster', + 'soft_reboot_gpu_virtual_server', 'soft_reboot_vm', + 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', + 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', + 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', + 'sync_private_flavors', 'update_ddos_profile', 'update_inference_instance', + 'update_inference_instance_key', 'update_k8s_cluster_v2', 'update_lbmetadata', + 'update_port_allowed_address_pairs', '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")] - """ - '#/paths/%2Fcloud%2Fv1%2Ftasks/get/parameters/9/schema/anyOf/0' - "$.paths['/cloud/v1/tasks'].get.parameters[9].schema.anyOf[0]" + """ISO formatted datetime string. + + Filter the tasks by creation date less than or equal to to_timestamp """ diff --git a/src/gcore/types/cloud/users/role_assignment.py b/src/gcore/types/cloud/users/role_assignment.py index 15b39b68..774c5ede 100644 --- a/src/gcore/types/cloud/users/role_assignment.py +++ b/src/gcore/types/cloud/users/role_assignment.py @@ -10,49 +10,24 @@ class RoleAssignment(BaseModel): id: int - """ - '#/components/schemas/RoleAssignmentSerializer/properties/id' - "$.components.schemas.RoleAssignmentSerializer.properties.id" - """ + """Assignment ID""" assigned_by: Optional[int] = None - """ - '#/components/schemas/RoleAssignmentSerializer/properties/assigned_by/anyOf/0' - "$.components.schemas.RoleAssignmentSerializer.properties.assigned_by.anyOf[0]" - """ client_id: int - """ - '#/components/schemas/RoleAssignmentSerializer/properties/client_id' - "$.components.schemas.RoleAssignmentSerializer.properties.client_id" - """ + """Client ID""" created_at: datetime - """ - '#/components/schemas/RoleAssignmentSerializer/properties/created_at' - "$.components.schemas.RoleAssignmentSerializer.properties.created_at" - """ + """Created timestamp""" project_id: Optional[int] = None - """ - '#/components/schemas/RoleAssignmentSerializer/properties/project_id/anyOf/0' - "$.components.schemas.RoleAssignmentSerializer.properties.project_id.anyOf[0]" - """ + """Project ID""" role: str - """ - '#/components/schemas/RoleAssignmentSerializer/properties/role' - "$.components.schemas.RoleAssignmentSerializer.properties.role" - """ + """User role""" updated_at: Optional[datetime] = None - """ - '#/components/schemas/RoleAssignmentSerializer/properties/updated_at/anyOf/0' - "$.components.schemas.RoleAssignmentSerializer.properties.updated_at.anyOf[0]" - """ + """Updated timestamp""" user_id: int - """ - '#/components/schemas/RoleAssignmentSerializer/properties/user_id' - "$.components.schemas.RoleAssignmentSerializer.properties.user_id" - """ + """User ID""" diff --git a/src/gcore/types/cloud/users/role_assignment_create_params.py b/src/gcore/types/cloud/users/role_assignment_create_params.py index 3c148cd6..684f5c8f 100644 --- a/src/gcore/types/cloud/users/role_assignment_create_params.py +++ b/src/gcore/types/cloud/users/role_assignment_create_params.py @@ -10,25 +10,13 @@ class RoleAssignmentCreateParams(TypedDict, total=False): role: Required[str] - """ - '#/components/schemas/RequestAssignmentSerializer/properties/role' - "$.components.schemas.RequestAssignmentSerializer.properties.role" - """ + """User role""" user_id: Required[int] - """ - '#/components/schemas/RequestAssignmentSerializer/properties/user_id' - "$.components.schemas.RequestAssignmentSerializer.properties.user_id" - """ + """User ID""" client_id: Optional[int] - """ - '#/components/schemas/RequestAssignmentSerializer/properties/client_id/anyOf/0' - "$.components.schemas.RequestAssignmentSerializer.properties.client_id.anyOf[0]" - """ + """Client ID. Required if project_id is specified""" project_id: Optional[int] - """ - '#/components/schemas/RequestAssignmentSerializer/properties/project_id/anyOf/0' - "$.components.schemas.RequestAssignmentSerializer.properties.project_id.anyOf[0]" - """ + """Project ID""" diff --git a/src/gcore/types/cloud/users/role_assignment_list_params.py b/src/gcore/types/cloud/users/role_assignment_list_params.py index 99587621..524a0450 100644 --- a/src/gcore/types/cloud/users/role_assignment_list_params.py +++ b/src/gcore/types/cloud/users/role_assignment_list_params.py @@ -9,25 +9,17 @@ class RoleAssignmentListParams(TypedDict, total=False): limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/0' - "$.paths['/cloud/v1/users/assignments'].get.parameters[0]" + """Limit the number of returned items. + + Falls back to default of 1000 if not specified. Limited by max limit value of + 1000 """ offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/1' - "$.paths['/cloud/v1/users/assignments'].get.parameters[1]" - """ + """Offset value is used to exclude the first set of records from the result""" project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/2' - "$.paths['/cloud/v1/users/assignments'].get.parameters[2]" - """ + """Project ID""" user_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fusers%2Fassignments/get/parameters/3' - "$.paths['/cloud/v1/users/assignments'].get.parameters[3]" - """ + """User ID for filtering""" diff --git a/src/gcore/types/cloud/users/role_assignment_update_delete.py b/src/gcore/types/cloud/users/role_assignment_update_delete.py index 7eb8ae70..51293863 100644 --- a/src/gcore/types/cloud/users/role_assignment_update_delete.py +++ b/src/gcore/types/cloud/users/role_assignment_update_delete.py @@ -7,7 +7,4 @@ class RoleAssignmentUpdateDelete(BaseModel): assignment_id: int - """ - '#/components/schemas/AssignmentSerializer/properties/assignment_id' - "$.components.schemas.AssignmentSerializer.properties.assignment_id" - """ + """Assignment ID""" diff --git a/src/gcore/types/cloud/users/role_assignment_update_params.py b/src/gcore/types/cloud/users/role_assignment_update_params.py index c8443c55..a444f4a2 100644 --- a/src/gcore/types/cloud/users/role_assignment_update_params.py +++ b/src/gcore/types/cloud/users/role_assignment_update_params.py @@ -10,25 +10,13 @@ class RoleAssignmentUpdateParams(TypedDict, total=False): role: Required[str] - """ - '#/components/schemas/RequestAssignmentSerializer/properties/role' - "$.components.schemas.RequestAssignmentSerializer.properties.role" - """ + """User role""" user_id: Required[int] - """ - '#/components/schemas/RequestAssignmentSerializer/properties/user_id' - "$.components.schemas.RequestAssignmentSerializer.properties.user_id" - """ + """User ID""" client_id: Optional[int] - """ - '#/components/schemas/RequestAssignmentSerializer/properties/client_id/anyOf/0' - "$.components.schemas.RequestAssignmentSerializer.properties.client_id.anyOf[0]" - """ + """Client ID. Required if project_id is specified""" project_id: Optional[int] - """ - '#/components/schemas/RequestAssignmentSerializer/properties/project_id/anyOf/0' - "$.components.schemas.RequestAssignmentSerializer.properties.project_id.anyOf[0]" - """ + """Project ID""" diff --git a/src/gcore/types/cloud/volume.py b/src/gcore/types/cloud/volume.py index 91b678b8..68c9053f 100644 --- a/src/gcore/types/cloud/volume.py +++ b/src/gcore/types/cloud/volume.py @@ -14,128 +14,68 @@ class Attachment(BaseModel): attachment_id: str - """ - '#/components/schemas/VolumeAttachmentSerializer/properties/attachment_id' - "$.components.schemas.VolumeAttachmentSerializer.properties.attachment_id" - """ + """The unique identifier of the attachment object.""" volume_id: str - """ - '#/components/schemas/VolumeAttachmentSerializer/properties/volume_id' - "$.components.schemas.VolumeAttachmentSerializer.properties.volume_id" - """ + """The unique identifier of the attached volume.""" attached_at: Optional[datetime] = None - """ - '#/components/schemas/VolumeAttachmentSerializer/properties/attached_at/anyOf/0' - "$.components.schemas.VolumeAttachmentSerializer.properties.attached_at.anyOf[0]" - """ + """The date and time when the attachment was created.""" device: Optional[str] = None - """ - '#/components/schemas/VolumeAttachmentSerializer/properties/device/anyOf/0' - "$.components.schemas.VolumeAttachmentSerializer.properties.device.anyOf[0]" - """ + """The block device name inside the guest instance.""" flavor_id: Optional[str] = None - """ - '#/components/schemas/VolumeAttachmentSerializer/properties/flavor_id/anyOf/0' - "$.components.schemas.VolumeAttachmentSerializer.properties.flavor_id.anyOf[0]" - """ + """The flavor ID of the instance.""" instance_name: Optional[str] = None - """ - '#/components/schemas/VolumeAttachmentSerializer/properties/instance_name/anyOf/0' - "$.components.schemas.VolumeAttachmentSerializer.properties.instance_name.anyOf[0]" - """ + """The name of the instance if attached and the server name is known.""" server_id: Optional[str] = None - """ - '#/components/schemas/VolumeAttachmentSerializer/properties/server_id/anyOf/0' - "$.components.schemas.VolumeAttachmentSerializer.properties.server_id.anyOf[0]" - """ + """The unique identifier of the instance.""" class LimiterStats(BaseModel): iops_base_limit: int - """ - '#/components/schemas/VolumeLimiterStatsSerializer/properties/iops_base_limit' - "$.components.schemas.VolumeLimiterStatsSerializer.properties.iops_base_limit" - """ + """The sustained IOPS (Input/Output Operations Per Second) limit.""" iops_burst_limit: int - """ - '#/components/schemas/VolumeLimiterStatsSerializer/properties/iops_burst_limit' - "$.components.schemas.VolumeLimiterStatsSerializer.properties.iops_burst_limit" - """ + """The burst IOPS limit.""" m_bps_base_limit: int = FieldInfo(alias="MBps_base_limit") - """ - '#/components/schemas/VolumeLimiterStatsSerializer/properties/MBps_base_limit' - "$.components.schemas.VolumeLimiterStatsSerializer.properties.MBps_base_limit" - """ + """The sustained bandwidth limit in megabytes per second (MBps).""" m_bps_burst_limit: int = FieldInfo(alias="MBps_burst_limit") - """ - '#/components/schemas/VolumeLimiterStatsSerializer/properties/MBps_burst_limit' - "$.components.schemas.VolumeLimiterStatsSerializer.properties.MBps_burst_limit" - """ + """The burst bandwidth limit in megabytes per second (MBps).""" class Volume(BaseModel): id: str - """ - '#/components/schemas/VolumeSerializer/properties/id' - "$.components.schemas.VolumeSerializer.properties.id" - """ + """The unique identifier of the volume.""" bootable: bool - """ - '#/components/schemas/VolumeSerializer/properties/bootable' - "$.components.schemas.VolumeSerializer.properties.bootable" - """ + """Indicates whether the volume is bootable.""" created_at: datetime - """ - '#/components/schemas/VolumeSerializer/properties/created_at' - "$.components.schemas.VolumeSerializer.properties.created_at" - """ + """The date and time when the volume was created.""" is_root_volume: bool - """ - '#/components/schemas/VolumeSerializer/properties/is_root_volume' - "$.components.schemas.VolumeSerializer.properties.is_root_volume" - """ + """Indicates whether this is a root volume.""" name: str - """ - '#/components/schemas/VolumeSerializer/properties/name' - "$.components.schemas.VolumeSerializer.properties.name" - """ + """The name of the volume.""" project_id: int - """ - '#/components/schemas/VolumeSerializer/properties/project_id' - "$.components.schemas.VolumeSerializer.properties.project_id" - """ + """Project ID.""" region: str - """ - '#/components/schemas/VolumeSerializer/properties/region' - "$.components.schemas.VolumeSerializer.properties.region" - """ + """The region where the volume is located.""" region_id: int - """ - '#/components/schemas/VolumeSerializer/properties/region_id' - "$.components.schemas.VolumeSerializer.properties.region_id" - """ + """The identifier of the region.""" size: int - """ - '#/components/schemas/VolumeSerializer/properties/size' - "$.components.schemas.VolumeSerializer.properties.size" - """ + """The size of the volume in gibibytes (GiB).""" status: Literal[ "attaching", @@ -160,61 +100,42 @@ class Volume(BaseModel): "reverting", "uploading", ] - """ - '#/components/schemas/VolumeSerializer/properties/status' - "$.components.schemas.VolumeSerializer.properties.status" - """ + """The current status of the volume.""" tags: List[Tag] - """ - '#/components/schemas/VolumeSerializer/properties/tags' - "$.components.schemas.VolumeSerializer.properties.tags" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. """ volume_type: str - """ - '#/components/schemas/VolumeSerializer/properties/volume_type' - "$.components.schemas.VolumeSerializer.properties.volume_type" - """ + """The type of volume storage.""" attachments: Optional[List[Attachment]] = None - """ - '#/components/schemas/VolumeSerializer/properties/attachments/anyOf/0' - "$.components.schemas.VolumeSerializer.properties.attachments.anyOf[0]" - """ + """List of attachments associated with the volume.""" creator_task_id: Optional[str] = None - """ - '#/components/schemas/VolumeSerializer/properties/creator_task_id/anyOf/0' - "$.components.schemas.VolumeSerializer.properties.creator_task_id.anyOf[0]" - """ + """The ID of the task that created this volume.""" limiter_stats: Optional[LimiterStats] = None - """ - '#/components/schemas/VolumeSerializer/properties/limiter_stats/anyOf/0' - "$.components.schemas.VolumeSerializer.properties.limiter_stats.anyOf[0]" - """ + """Schema representing the Quality of Service (QoS) parameters for a volume.""" snapshot_ids: Optional[List[str]] = None - """ - '#/components/schemas/VolumeSerializer/properties/snapshot_ids/anyOf/0' - "$.components.schemas.VolumeSerializer.properties.snapshot_ids.anyOf[0]" - """ + """List of snapshot IDs associated with this volume.""" task_id: Optional[str] = None - """ - '#/components/schemas/VolumeSerializer/properties/task_id/anyOf/0' - "$.components.schemas.VolumeSerializer.properties.task_id.anyOf[0]" + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. """ updated_at: Optional[datetime] = None - """ - '#/components/schemas/VolumeSerializer/properties/updated_at/anyOf/0' - "$.components.schemas.VolumeSerializer.properties.updated_at.anyOf[0]" - """ + """The date and time when the volume was last updated.""" volume_image_metadata: Optional[Dict[str, str]] = None - """ - '#/components/schemas/VolumeSerializer/properties/volume_image_metadata/anyOf/0' - "$.components.schemas.VolumeSerializer.properties.volume_image_metadata.anyOf[0]" - """ + """Image metadata for volumes created from an image.""" diff --git a/src/gcore/types/cloud/volume_attach_to_instance_params.py b/src/gcore/types/cloud/volume_attach_to_instance_params.py index 76d118e4..9b735a1a 100644 --- a/src/gcore/types/cloud/volume_attach_to_instance_params.py +++ b/src/gcore/types/cloud/volume_attach_to_instance_params.py @@ -9,25 +9,13 @@ class VolumeAttachToInstanceParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/0/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fattach/post/parameters/1/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach'].post.parameters[1].schema" - """ + """Region ID""" instance_id: Required[str] - """ - '#/components/schemas/AttachVolumeToInstanceSerializer/properties/instance_id' - "$.components.schemas.AttachVolumeToInstanceSerializer.properties.instance_id" - """ + """Instance ID.""" attachment_tag: str - """ - '#/components/schemas/AttachVolumeToInstanceSerializer/properties/attachment_tag' - "$.components.schemas.AttachVolumeToInstanceSerializer.properties.attachment_tag" - """ + """Block device attachment tag (not exposed in the normal tags).""" diff --git a/src/gcore/types/cloud/volume_change_type_params.py b/src/gcore/types/cloud/volume_change_type_params.py index 0cc057fc..910cc5f5 100644 --- a/src/gcore/types/cloud/volume_change_type_params.py +++ b/src/gcore/types/cloud/volume_change_type_params.py @@ -9,19 +9,10 @@ class VolumeChangeTypeParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fretype/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype'].post.parameters[1].schema" - """ + """Region ID""" volume_type: Required[Literal["ssd_hiiops", "standard"]] - """ - '#/components/schemas/VolumeRetypeSerializer/properties/volume_type' - "$.components.schemas.VolumeRetypeSerializer.properties.volume_type" - """ + """New volume type name""" diff --git a/src/gcore/types/cloud/volume_create_params.py b/src/gcore/types/cloud/volume_create_params.py index 53b7bcbe..d53d2c6a 100644 --- a/src/gcore/types/cloud/volume_create_params.py +++ b/src/gcore/types/cloud/volume_create_params.py @@ -17,199 +17,157 @@ class CreateVolumeFromImageSerializer(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" - """ + """Region ID""" image_id: Required[str] - """ - '#/components/schemas/CreateVolumeFromImageSerializer/properties/image_id' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.image_id" - """ + """Image ID""" name: Required[str] - """ - '#/components/schemas/CreateVolumeFromImageSerializer/properties/name' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.name" - """ + """Volume name""" size: Required[int] - """ - '#/components/schemas/CreateVolumeFromImageSerializer/properties/size' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.size" - """ + """Volume size in GiB""" source: Required[Literal["image"]] - """ - '#/components/schemas/CreateVolumeFromImageSerializer/properties/source' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.source" - """ + """Volume source type""" attachment_tag: str - """ - '#/components/schemas/CreateVolumeFromImageSerializer/properties/attachment_tag' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.attachment_tag" + """Block device attachment tag (not exposed in the user tags). + + Only used in conjunction with instance_id_to_attach_to """ instance_id_to_attach_to: str - """ - '#/components/schemas/CreateVolumeFromImageSerializer/properties/instance_id_to_attach_to' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.instance_id_to_attach_to" - """ + """instance_id to attach newly-created volume to""" lifecycle_policy_ids: Iterable[int] """ - '#/components/schemas/CreateVolumeFromImageSerializer/properties/lifecycle_policy_ids' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.lifecycle_policy_ids" + List of lifecycle policy IDs (snapshot creation schedules) to associate with the + volume """ tags: TagUpdateListParam - """ - '#/components/schemas/CreateVolumeFromImageSerializer/properties/tags' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - """ - '#/components/schemas/CreateVolumeFromImageSerializer/properties/type_name' - "$.components.schemas.CreateVolumeFromImageSerializer.properties.type_name" + """Volume type. + + Defaults to `standard`. If not specified for source `snapshot`, volume type will + be derived from the snapshot volume. """ class CreateVolumeFromSnapshotSerializer(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" - """ + """Region ID""" name: Required[str] - """ - '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/name' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.name" - """ + """Volume name""" snapshot_id: Required[str] - """ - '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/snapshot_id' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.snapshot_id" - """ + """Snapshot ID""" source: Required[Literal["snapshot"]] - """ - '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/source' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.source" - """ + """Volume source type""" attachment_tag: str - """ - '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/attachment_tag' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.attachment_tag" + """Block device attachment tag (not exposed in the user tags). + + Only used in conjunction with instance_id_to_attach_to """ instance_id_to_attach_to: str - """ - '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/instance_id_to_attach_to' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.instance_id_to_attach_to" - """ + """instance_id to attach newly-created volume to""" lifecycle_policy_ids: Iterable[int] """ - '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/lifecycle_policy_ids' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.lifecycle_policy_ids" + List of lifecycle policy IDs (snapshot creation schedules) to associate with the + volume """ size: int - """ - '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/size' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.size" + """Volume size in GiB. + + If specified, value must be equal to respective snapshot size """ tags: TagUpdateListParam - """ - '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/tags' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - """ - '#/components/schemas/CreateVolumeFromSnapshotSerializer/properties/type_name' - "$.components.schemas.CreateVolumeFromSnapshotSerializer.properties.type_name" + """Volume type. + + Defaults to `standard`. If not specified for source `snapshot`, volume type will + be derived from the snapshot volume. """ class CreateNewVolumeSerializer(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].post.parameters[1].schema" - """ + """Region ID""" name: Required[str] - """ - '#/components/schemas/CreateNewVolumeSerializer/properties/name' - "$.components.schemas.CreateNewVolumeSerializer.properties.name" - """ + """Volume name""" size: Required[int] - """ - '#/components/schemas/CreateNewVolumeSerializer/properties/size' - "$.components.schemas.CreateNewVolumeSerializer.properties.size" - """ + """Volume size in GiB""" source: Required[Literal["new-volume"]] - """ - '#/components/schemas/CreateNewVolumeSerializer/properties/source' - "$.components.schemas.CreateNewVolumeSerializer.properties.source" - """ + """Volume source type""" attachment_tag: str - """ - '#/components/schemas/CreateNewVolumeSerializer/properties/attachment_tag' - "$.components.schemas.CreateNewVolumeSerializer.properties.attachment_tag" + """Block device attachment tag (not exposed in the user tags). + + Only used in conjunction with instance_id_to_attach_to """ instance_id_to_attach_to: str - """ - '#/components/schemas/CreateNewVolumeSerializer/properties/instance_id_to_attach_to' - "$.components.schemas.CreateNewVolumeSerializer.properties.instance_id_to_attach_to" - """ + """instance_id to attach newly-created volume to""" lifecycle_policy_ids: Iterable[int] """ - '#/components/schemas/CreateNewVolumeSerializer/properties/lifecycle_policy_ids' - "$.components.schemas.CreateNewVolumeSerializer.properties.lifecycle_policy_ids" + List of lifecycle policy IDs (snapshot creation schedules) to associate with the + volume """ tags: TagUpdateListParam - """ - '#/components/schemas/CreateNewVolumeSerializer/properties/tags' - "$.components.schemas.CreateNewVolumeSerializer.properties.tags" + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - """ - '#/components/schemas/CreateNewVolumeSerializer/properties/type_name' - "$.components.schemas.CreateNewVolumeSerializer.properties.type_name" + """Volume type. + + Defaults to `standard`. If not specified for source `snapshot`, volume type will + be derived from the snapshot volume. """ diff --git a/src/gcore/types/cloud/volume_delete_params.py b/src/gcore/types/cloud/volume_delete_params.py index 0ee0199f..a435163e 100644 --- a/src/gcore/types/cloud/volume_delete_params.py +++ b/src/gcore/types/cloud/volume_delete_params.py @@ -9,19 +9,10 @@ class VolumeDeleteParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[1].schema" - """ + """Region ID""" snapshots: str - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/delete/parameters/3' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}']['delete'].parameters[3]" - """ + """Comma separated list of snapshot IDs to be deleted with the volume.""" diff --git a/src/gcore/types/cloud/volume_detach_from_instance_params.py b/src/gcore/types/cloud/volume_detach_from_instance_params.py index d58bea9d..0332d605 100644 --- a/src/gcore/types/cloud/volume_detach_from_instance_params.py +++ b/src/gcore/types/cloud/volume_detach_from_instance_params.py @@ -9,19 +9,10 @@ class VolumeDetachFromInstanceParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/0/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv2%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fdetach/post/parameters/1/schema' - "$.paths['/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach'].post.parameters[1].schema" - """ + """Region ID""" instance_id: Required[str] - """ - '#/components/schemas/InstanceIdSerializer/properties/instance_id' - "$.components.schemas.InstanceIdSerializer.properties.instance_id" - """ + """Instance ID""" diff --git a/src/gcore/types/cloud/volume_list_params.py b/src/gcore/types/cloud/volume_list_params.py index 6ca7cf2e..69520d47 100644 --- a/src/gcore/types/cloud/volume_list_params.py +++ b/src/gcore/types/cloud/volume_list_params.py @@ -10,73 +10,47 @@ class VolumeListParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[1].schema" - """ + """Region ID""" bootable: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/2' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[2]" - """ + """Filter by bootable field""" cluster_id: str - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/3' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[3]" - """ + """Filter volumes by k8s cluster ID""" has_attachments: bool - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/4' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[4]" - """ + """Filter by the presence of attachments""" id_part: str - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/5' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[5]" - """ + """Filter the volume list result by the ID part of the volume""" instance_id: str - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/6' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[6]" - """ + """Filter volumes by instance ID""" limit: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/7' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[7]" - """ + """Optional. Limit the number of returned items""" name_part: str """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/8' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[8]" + Filter volumes by name_part inclusion in volume name.Any substring can be used + and volumes will be returned with names containing the substring. """ offset: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/9' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[9]" + """Optional. + + Offset value is used to exclude the first set of records from the result """ tag_key: List[str] - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/10' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[10]" - """ + """Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2""" tag_key_value: str - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D/get/parameters/11' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}'].get.parameters[11]" + """Optional. + + Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": + "value"}" --url "https://example.com/cloud/v1/resource/1/1" """ diff --git a/src/gcore/types/cloud/volume_resize_params.py b/src/gcore/types/cloud/volume_resize_params.py index d6b633b0..34091297 100644 --- a/src/gcore/types/cloud/volume_resize_params.py +++ b/src/gcore/types/cloud/volume_resize_params.py @@ -9,19 +9,10 @@ class VolumeResizeParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D%2Fextend/post/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend'].post.parameters[1].schema" - """ + """Region ID""" size: Required[int] - """ - '#/components/schemas/SizeSerializer/properties/size' - "$.components.schemas.SizeSerializer.properties.size" - """ + """New volume size in GiB""" diff --git a/src/gcore/types/cloud/volume_update_params.py b/src/gcore/types/cloud/volume_update_params.py index 60cda2d2..58439323 100644 --- a/src/gcore/types/cloud/volume_update_params.py +++ b/src/gcore/types/cloud/volume_update_params.py @@ -9,19 +9,10 @@ class VolumeUpdateParams(TypedDict, total=False): project_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/0/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[0].schema" - """ + """Project ID""" region_id: int - """ - '#/paths/%2Fcloud%2Fv1%2Fvolumes%2F%7Bproject_id%7D%2F%7Bregion_id%7D%2F%7Bvolume_id%7D/patch/parameters/1/schema' - "$.paths['/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}'].patch.parameters[1].schema" - """ + """Region ID""" name: Required[str] - """ - '#/components/schemas/NameSerializer/properties/name' - "$.components.schemas.NameSerializer.properties.name" - """ + """Name.""" From cbfbc04d06b4cb990f4300873ed36f45e7e9f574 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 16:36:58 +0000 Subject: [PATCH 093/592] feat(api): add nested_params readme example --- .stats.yml | 2 +- README.md | 83 +++++++++++++----------------------------------------- 2 files changed, 21 insertions(+), 64 deletions(-) diff --git a/.stats.yml b/.stats.yml index 014e6fef..b4d2dfb9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-506b88d8207b6721e83a9b8e91ce33e143b3fbe83055e4e8cc276c98ffd0ac20.yml openapi_spec_hash: 5909b18d3de69bcd21c1a4965e643d7f -config_hash: 4e84bb86c6b30323e08ed8a76b63b191 +config_hash: 737e78b7babcc6f2a3bf1b0e8ec3543f diff --git a/README.md b/README.md index 6b197be3..2a31f439 100644 --- a/README.md +++ b/README.md @@ -162,71 +162,28 @@ from gcore import Gcore client = Gcore() -client.cloud.quotas.requests.create( - description="Scale up mysql cluster", - requested_limits={ - "global_limits": { - "inference_cpu_millicore_count_limit": 0, - "inference_gpu_a100_count_limit": 0, - "inference_gpu_h100_count_limit": 0, - "inference_gpu_l40s_count_limit": 0, - "inference_instance_count_limit": 0, - "keypair_count_limit": 100, - "project_count_limit": 2, +task_id_list = client.cloud.instances.create( + project_id=1, + region_id=1, + flavor="g1-standard-1-2", + interfaces=[{"subnet_id": "your-subnet-uuid"}], + volumes=[ + { + "image_id": "your-image-uuid", + "size": 50, + "type_name": "standard", + "is_bootable": True, }, - "regional_limits": [ - { - "baremetal_basic_count_limit": 0, - "baremetal_gpu_count_limit": 0, - "baremetal_hf_count_limit": 0, - "baremetal_infrastructure_count_limit": 0, - "baremetal_network_count_limit": 0, - "baremetal_storage_count_limit": 0, - "caas_container_count_limit": 0, - "caas_cpu_count_limit": 0, - "caas_gpu_count_limit": 0, - "caas_ram_size_limit": 0, - "cluster_count_limit": 0, - "cpu_count_limit": 0, - "dbaas_postgres_cluster_count_limit": 0, - "external_ip_count_limit": 0, - "faas_cpu_count_limit": 0, - "faas_function_count_limit": 0, - "faas_namespace_count_limit": 0, - "faas_ram_size_limit": 0, - "firewall_count_limit": 0, - "floating_count_limit": 0, - "gpu_count_limit": 0, - "gpu_virtual_a100_count_limit": 0, - "gpu_virtual_h100_count_limit": 0, - "gpu_virtual_l40s_count_limit": 0, - "image_count_limit": 0, - "image_size_limit": 0, - "ipu_count_limit": 0, - "laas_topic_count_limit": 0, - "loadbalancer_count_limit": 0, - "network_count_limit": 0, - "ram_limit": 0, - "region_id": 1, - "registry_count_limit": 0, - "registry_storage_limit": 0, - "router_count_limit": 0, - "secret_count_limit": 0, - "servergroup_count_limit": 0, - "sfs_count_limit": 0, - "sfs_size_limit": 0, - "shared_vm_count_limit": 0, - "snapshot_schedule_count_limit": 0, - "subnet_count_limit": 0, - "vm_count_limit": 0, - "volume_count_limit": 0, - "volume_size_limit": 0, - "volume_snapshots_count_limit": 0, - "volume_snapshots_size_limit": 0, - } - ], - }, + { + "size": 100, + "type_name": "ssd_hiiops", + "is_bootable": False, + }, + ], + names=["my-awesome-instance"], + user_data="IyEvYmluL2Jhc2gKZWNobyAiSGVsbG8sIFdvcmxkISIgPj4gL3RtcC9jbG91ZC1pbml0Lm91dAo=", ) +print(task_id_list.tasks) ``` ## Handling errors From ffd3b47844f96086fa1cf56deced630b77a5889a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 16:52:40 +0000 Subject: [PATCH 094/592] feat(api): rename regions.retrieve() to rregions.get() --- .stats.yml | 2 +- api.md | 2 +- src/gcore/resources/cloud/regions.py | 166 +++++++++--------- src/gcore/types/cloud/__init__.py | 2 +- ...etrieve_params.py => region_get_params.py} | 4 +- tests/api_resources/cloud/test_regions.py | 106 +++++------ tests/test_client.py | 8 +- 7 files changed, 144 insertions(+), 146 deletions(-) rename src/gcore/types/cloud/{region_retrieve_params.py => region_get_params.py} (79%) diff --git a/.stats.yml b/.stats.yml index b4d2dfb9..c208c761 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-506b88d8207b6721e83a9b8e91ce33e143b3fbe83055e4e8cc276c98ffd0ac20.yml openapi_spec_hash: 5909b18d3de69bcd21c1a4965e643d7f -config_hash: 737e78b7babcc6f2a3bf1b0e8ec3543f +config_hash: 541152373765b588831e91dc214f36ee diff --git a/api.md b/api.md index 415350ad..e30690bc 100644 --- a/api.md +++ b/api.md @@ -98,8 +98,8 @@ from gcore.types.cloud import Region Methods: -- client.cloud.regions.retrieve(\*, region_id, \*\*params) -> Region - client.cloud.regions.list(\*\*params) -> SyncOffsetPage[Region] +- client.cloud.regions.get(\*, region_id, \*\*params) -> Region ## Quotas diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index 652dc1bf..c7098465 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -17,7 +17,7 @@ async_to_streamed_response_wrapper, ) from ...pagination import SyncOffsetPage, AsyncOffsetPage -from ...types.cloud import region_list_params, region_retrieve_params +from ...types.cloud import region_get_params, region_list_params from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.region import Region @@ -44,51 +44,6 @@ def with_streaming_response(self) -> RegionsResourceWithStreamingResponse: """ return RegionsResourceWithStreamingResponse(self) - def retrieve( - self, - *, - region_id: int | None = None, - show_volume_types: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Region: - """ - Get region - - Args: - region_id: Region ID - - show_volume_types: If true, null `available_volume_type` is replaced with a list of available - volume types. - - 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 region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - return self._get( - f"/cloud/v1/regions/{region_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - {"show_volume_types": show_volume_types}, region_retrieve_params.RegionRetrieveParams - ), - ), - cast_to=Region, - ) - def list( self, *, @@ -152,28 +107,7 @@ def list( model=Region, ) - -class AsyncRegionsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncRegionsResourceWithRawResponse: - """ - 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers - """ - return AsyncRegionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRegionsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response - """ - return AsyncRegionsResourceWithStreamingResponse(self) - - async def retrieve( + def get( self, *, region_id: int | None = None, @@ -204,20 +138,39 @@ async def retrieve( """ if region_id is None: region_id = self._client._get_cloud_region_id_path_param() - return await self._get( + return self._get( f"/cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( - {"show_volume_types": show_volume_types}, region_retrieve_params.RegionRetrieveParams - ), + query=maybe_transform({"show_volume_types": show_volume_types}, region_get_params.RegionGetParams), ), cast_to=Region, ) + +class AsyncRegionsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRegionsResourceWithRawResponse: + """ + 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRegionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRegionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + """ + return AsyncRegionsResourceWithStreamingResponse(self) + def list( self, *, @@ -281,50 +234,95 @@ def list( model=Region, ) + async def get( + self, + *, + region_id: int | None = None, + show_volume_types: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Region: + """ + Get region + + Args: + region_id: Region ID + + show_volume_types: If true, null `available_volume_type` is replaced with a list of available + volume types. + + 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 region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/regions/{region_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"show_volume_types": show_volume_types}, region_get_params.RegionGetParams + ), + ), + cast_to=Region, + ) + class RegionsResourceWithRawResponse: def __init__(self, regions: RegionsResource) -> None: self._regions = regions - self.retrieve = to_raw_response_wrapper( - regions.retrieve, - ) self.list = to_raw_response_wrapper( regions.list, ) + self.get = to_raw_response_wrapper( + regions.get, + ) class AsyncRegionsResourceWithRawResponse: def __init__(self, regions: AsyncRegionsResource) -> None: self._regions = regions - self.retrieve = async_to_raw_response_wrapper( - regions.retrieve, - ) self.list = async_to_raw_response_wrapper( regions.list, ) + self.get = async_to_raw_response_wrapper( + regions.get, + ) class RegionsResourceWithStreamingResponse: def __init__(self, regions: RegionsResource) -> None: self._regions = regions - self.retrieve = to_streamed_response_wrapper( - regions.retrieve, - ) self.list = to_streamed_response_wrapper( regions.list, ) + self.get = to_streamed_response_wrapper( + regions.get, + ) class AsyncRegionsResourceWithStreamingResponse: def __init__(self, regions: AsyncRegionsResource) -> None: self._regions = regions - self.retrieve = async_to_streamed_response_wrapper( - regions.retrieve, - ) self.list = async_to_streamed_response_wrapper( regions.list, ) + self.get = async_to_streamed_response_wrapper( + regions.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 3ccb9f38..3beade2e 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -64,6 +64,7 @@ from .task_list_params import TaskListParams as TaskListParams from .lb_health_monitor import LbHealthMonitor as LbHealthMonitor from .network_interface import NetworkInterface as NetworkInterface +from .region_get_params import RegionGetParams as RegionGetParams from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP from .aws_iam_data_param import AwsIamDataParam as AwsIamDataParam from .ddos_profile_field import DDOSProfileField as DDOSProfileField @@ -122,7 +123,6 @@ from .network_interface_list import NetworkInterfaceList as NetworkInterfaceList from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse -from .region_retrieve_params import RegionRetrieveParams as RegionRetrieveParams from .registry_create_params import RegistryCreateParams as RegistryCreateParams from .registry_resize_params import RegistryResizeParams as RegistryResizeParams from .detailed_lb_pool_member import DetailedLbPoolMember as DetailedLbPoolMember diff --git a/src/gcore/types/cloud/region_retrieve_params.py b/src/gcore/types/cloud/region_get_params.py similarity index 79% rename from src/gcore/types/cloud/region_retrieve_params.py rename to src/gcore/types/cloud/region_get_params.py index 6dd33927..5d667ede 100644 --- a/src/gcore/types/cloud/region_retrieve_params.py +++ b/src/gcore/types/cloud/region_get_params.py @@ -4,10 +4,10 @@ from typing_extensions import TypedDict -__all__ = ["RegionRetrieveParams"] +__all__ = ["RegionGetParams"] -class RegionRetrieveParams(TypedDict, total=False): +class RegionGetParams(TypedDict, total=False): region_id: int """Region ID""" diff --git a/tests/api_resources/cloud/test_regions.py b/tests/api_resources/cloud/test_regions.py index 04d2cacb..0d00b673 100644 --- a/tests/api_resources/cloud/test_regions.py +++ b/tests/api_resources/cloud/test_regions.py @@ -18,45 +18,6 @@ class TestRegions: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @parametrize - def test_method_retrieve(self, client: Gcore) -> None: - region = client.cloud.regions.retrieve( - region_id=11, - ) - assert_matches_type(Region, region, path=["response"]) - - @parametrize - def test_method_retrieve_with_all_params(self, client: Gcore) -> None: - region = client.cloud.regions.retrieve( - region_id=11, - show_volume_types=False, - ) - assert_matches_type(Region, region, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Gcore) -> None: - response = client.cloud.regions.with_raw_response.retrieve( - region_id=11, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - region = response.parse() - assert_matches_type(Region, region, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Gcore) -> None: - with client.cloud.regions.with_streaming_response.retrieve( - region_id=11, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - region = response.parse() - assert_matches_type(Region, region, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize def test_method_list(self, client: Gcore) -> None: region = client.cloud.regions.list() @@ -93,49 +54,49 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - -class TestAsyncRegions: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - @parametrize - async def test_method_retrieve(self, async_client: AsyncGcore) -> None: - region = await async_client.cloud.regions.retrieve( + def test_method_get(self, client: Gcore) -> None: + region = client.cloud.regions.get( region_id=11, ) assert_matches_type(Region, region, path=["response"]) @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncGcore) -> None: - region = await async_client.cloud.regions.retrieve( + def test_method_get_with_all_params(self, client: Gcore) -> None: + region = client.cloud.regions.get( region_id=11, show_volume_types=False, ) assert_matches_type(Region, region, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.regions.with_raw_response.retrieve( + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.regions.with_raw_response.get( region_id=11, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - region = await response.parse() + region = response.parse() assert_matches_type(Region, region, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.regions.with_streaming_response.retrieve( + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.regions.with_streaming_response.get( region_id=11, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - region = await response.parse() + region = response.parse() assert_matches_type(Region, region, path=["response"]) assert cast(Any, response.is_closed) is True + +class TestAsyncRegions: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: region = await async_client.cloud.regions.list() @@ -171,3 +132,42 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(AsyncOffsetPage[Region], region, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + region = await async_client.cloud.regions.get( + region_id=11, + ) + assert_matches_type(Region, region, path=["response"]) + + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: + region = await async_client.cloud.regions.get( + region_id=11, + show_volume_types=False, + ) + assert_matches_type(Region, region, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.regions.with_raw_response.get( + region_id=11, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + region = await response.parse() + assert_matches_type(Region, region, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.regions.with_streaming_response.get( + region_id=11, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + region = await response.parse() + assert_matches_type(Region, region, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/test_client.py b/tests/test_client.py index 942e8242..6d1fca48 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -373,11 +373,11 @@ def test_cloud_region_id_client_params(self) -> None: with client as c2: with pytest.raises(ValueError, match="Missing cloud_region_id argument;"): - c2.cloud.regions.retrieve() + c2.cloud.regions.get() client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_region_id=0) with client as c2: - c2.cloud.regions.retrieve() + c2.cloud.regions.get() def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1159,11 +1159,11 @@ async def test_cloud_region_id_client_params(self) -> None: async with client as c2: with pytest.raises(ValueError, match="Missing cloud_region_id argument;"): - await c2.cloud.regions.retrieve() + await c2.cloud.regions.get() client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_region_id=0) async with client as c2: - await c2.cloud.regions.retrieve() + await c2.cloud.regions.get() def test_request_extra_json(self) -> None: request = self.client._build_request( From 18eae4ecf4cef291bdd68a27d6d7fc2509cc5b15 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 21:08:53 +0000 Subject: [PATCH 095/592] fix(floating_ips): workaround --- .stats.yml | 2 +- api.md | 1 + src/gcore/types/cloud/__init__.py | 1 + src/gcore/types/cloud/floating_ip_detailed.py | 21 +++++-------------- .../floating_ip_detailed_address_union.py | 12 +++++++++++ 5 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 src/gcore/types/cloud/floating_ip_detailed_address_union.py diff --git a/.stats.yml b/.stats.yml index c208c761..c7dd6177 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-506b88d8207b6721e83a9b8e91ce33e143b3fbe83055e4e8cc276c98ffd0ac20.yml openapi_spec_hash: 5909b18d3de69bcd21c1a4965e643d7f -config_hash: 541152373765b588831e91dc214f36ee +config_hash: 7f438c9d3cf1da5f2bd7fba7ba09b6e0 diff --git a/api.md b/api.md index e30690bc..735b9bb0 100644 --- a/api.md +++ b/api.md @@ -20,6 +20,7 @@ from gcore.types.cloud import ( FlavorHardwareDescription, FloatingAddress, FloatingIP, + FloatingIPDetailedAddressUnion, FloatingIPStatus, GPUClusterServer, GPUClusterServerList, diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 3beade2e..9d36b3c4 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -176,6 +176,7 @@ from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity +from .floating_ip_detailed_address_union import FloatingIPDetailedAddressUnion as FloatingIPDetailedAddressUnion from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams from .container_probe_config_create_param import ContainerProbeConfigCreateParam as ContainerProbeConfigCreateParam from .gpu_baremetal_cluster_create_params import GPUBaremetalClusterCreateParams as GPUBaremetalClusterCreateParams diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index 057730b2..68e24907 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -1,27 +1,16 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, List, Optional from datetime import datetime -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal from .tag import Tag from ..._models import BaseModel -from .fixed_address import FixedAddress from .load_balancer import LoadBalancer -from .floating_address import FloatingAddress from .floating_ip_status import FloatingIPStatus -from .fixed_address_short import FixedAddressShort +from .floating_ip_detailed_address_union import FloatingIPDetailedAddressUnion -__all__ = [ - "FloatingIPDetailed", - "Instance", - "InstanceAddress", - "InstanceFlavor", - "InstanceSecurityGroup", - "InstanceVolume", -] - -InstanceAddress: TypeAlias = Union[FloatingAddress, FixedAddressShort, FixedAddress] +__all__ = ["FloatingIPDetailed", "Instance", "InstanceFlavor", "InstanceSecurityGroup", "InstanceVolume"] class InstanceFlavor(BaseModel): @@ -52,7 +41,7 @@ class InstanceVolume(BaseModel): class Instance(BaseModel): - addresses: Dict[str, List[InstanceAddress]] + addresses: Dict[str, List[FloatingIPDetailedAddressUnion]] """Map of network_name to list of addresses in that network""" creator_task_id: str diff --git a/src/gcore/types/cloud/floating_ip_detailed_address_union.py b/src/gcore/types/cloud/floating_ip_detailed_address_union.py new file mode 100644 index 00000000..a29596bc --- /dev/null +++ b/src/gcore/types/cloud/floating_ip_detailed_address_union.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import TypeAlias + +from .fixed_address import FixedAddress +from .floating_address import FloatingAddress +from .fixed_address_short import FixedAddressShort + +__all__ = ["FloatingIPDetailedAddressUnion"] + +FloatingIPDetailedAddressUnion: TypeAlias = Union[FloatingAddress, FixedAddressShort, FixedAddress] From e015968ee70b1e7d45afe6323b202dff7a087798 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 3 May 2025 14:23:16 +0000 Subject: [PATCH 096/592] fix(cloud): remove workaround --- .stats.yml | 2 +- api.md | 1 - src/gcore/types/cloud/__init__.py | 1 - src/gcore/types/cloud/floating_ip_detailed.py | 21 ++++++++++++++----- .../floating_ip_detailed_address_union.py | 12 ----------- 5 files changed, 17 insertions(+), 20 deletions(-) delete mode 100644 src/gcore/types/cloud/floating_ip_detailed_address_union.py diff --git a/.stats.yml b/.stats.yml index c7dd6177..c208c761 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-506b88d8207b6721e83a9b8e91ce33e143b3fbe83055e4e8cc276c98ffd0ac20.yml openapi_spec_hash: 5909b18d3de69bcd21c1a4965e643d7f -config_hash: 7f438c9d3cf1da5f2bd7fba7ba09b6e0 +config_hash: 541152373765b588831e91dc214f36ee diff --git a/api.md b/api.md index 735b9bb0..e30690bc 100644 --- a/api.md +++ b/api.md @@ -20,7 +20,6 @@ from gcore.types.cloud import ( FlavorHardwareDescription, FloatingAddress, FloatingIP, - FloatingIPDetailedAddressUnion, FloatingIPStatus, GPUClusterServer, GPUClusterServerList, diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 9d36b3c4..3beade2e 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -176,7 +176,6 @@ from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity -from .floating_ip_detailed_address_union import FloatingIPDetailedAddressUnion as FloatingIPDetailedAddressUnion from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams from .container_probe_config_create_param import ContainerProbeConfigCreateParam as ContainerProbeConfigCreateParam from .gpu_baremetal_cluster_create_params import GPUBaremetalClusterCreateParams as GPUBaremetalClusterCreateParams diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index 68e24907..057730b2 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -1,16 +1,27 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Optional +from typing import Dict, List, Union, Optional from datetime import datetime -from typing_extensions import Literal +from typing_extensions import Literal, TypeAlias from .tag import Tag from ..._models import BaseModel +from .fixed_address import FixedAddress from .load_balancer import LoadBalancer +from .floating_address import FloatingAddress from .floating_ip_status import FloatingIPStatus -from .floating_ip_detailed_address_union import FloatingIPDetailedAddressUnion +from .fixed_address_short import FixedAddressShort -__all__ = ["FloatingIPDetailed", "Instance", "InstanceFlavor", "InstanceSecurityGroup", "InstanceVolume"] +__all__ = [ + "FloatingIPDetailed", + "Instance", + "InstanceAddress", + "InstanceFlavor", + "InstanceSecurityGroup", + "InstanceVolume", +] + +InstanceAddress: TypeAlias = Union[FloatingAddress, FixedAddressShort, FixedAddress] class InstanceFlavor(BaseModel): @@ -41,7 +52,7 @@ class InstanceVolume(BaseModel): class Instance(BaseModel): - addresses: Dict[str, List[FloatingIPDetailedAddressUnion]] + addresses: Dict[str, List[InstanceAddress]] """Map of network_name to list of addresses in that network""" creator_task_id: str diff --git a/src/gcore/types/cloud/floating_ip_detailed_address_union.py b/src/gcore/types/cloud/floating_ip_detailed_address_union.py deleted file mode 100644 index a29596bc..00000000 --- a/src/gcore/types/cloud/floating_ip_detailed_address_union.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union -from typing_extensions import TypeAlias - -from .fixed_address import FixedAddress -from .floating_address import FloatingAddress -from .fixed_address_short import FixedAddressShort - -__all__ = ["FloatingIPDetailedAddressUnion"] - -FloatingIPDetailedAddressUnion: TypeAlias = Union[FloatingAddress, FixedAddressShort, FixedAddress] From 89dd56bff1fd9985357c49e7890b7801e5eac551 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 5 May 2025 08:38:23 +0000 Subject: [PATCH 097/592] feat(opts): polling interval in secs --- .stats.yml | 2 +- src/gcore/_client.py | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.stats.yml b/.stats.yml index c208c761..78eb43a1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-506b88d8207b6721e83a9b8e91ce33e143b3fbe83055e4e8cc276c98ffd0ac20.yml openapi_spec_hash: 5909b18d3de69bcd21c1a4965e643d7f -config_hash: 541152373765b588831e91dc214f36ee +config_hash: cc2ad74ed7a4ce98cbc5d7f6ccc53ffe diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 7ee5ab00..e3953335 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -42,7 +42,7 @@ class Gcore(SyncAPIClient): api_key: str cloud_project_id: int | None cloud_region_id: int | None - cloud_polling_interval_ms: int | None + cloud_polling_interval_seconds: int | None def __init__( self, @@ -50,7 +50,7 @@ def __init__( api_key: str | None = None, cloud_project_id: int | None = None, cloud_region_id: int | None = None, - cloud_polling_interval_ms: int | None = 1000, + cloud_polling_interval_seconds: int | None = 3, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, @@ -93,9 +93,9 @@ def __init__( cloud_region_id = maybe_coerce_integer(os.environ.get("GCORE_CLOUD_REGION_ID")) self.cloud_region_id = cloud_region_id - if cloud_polling_interval_ms is None: - cloud_polling_interval_ms = 1000 - self.cloud_polling_interval_ms = cloud_polling_interval_ms + if cloud_polling_interval_seconds is None: + cloud_polling_interval_seconds = 3 + self.cloud_polling_interval_seconds = cloud_polling_interval_seconds if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") @@ -143,7 +143,7 @@ def copy( api_key: str | None = None, cloud_project_id: int | None = None, cloud_region_id: int | None = None, - cloud_polling_interval_ms: int | None = None, + cloud_polling_interval_seconds: int | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.Client | None = None, @@ -180,7 +180,7 @@ def copy( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, - cloud_polling_interval_ms=cloud_polling_interval_ms or self.cloud_polling_interval_ms, + cloud_polling_interval_seconds=cloud_polling_interval_seconds or self.cloud_polling_interval_seconds, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, @@ -255,7 +255,7 @@ class AsyncGcore(AsyncAPIClient): api_key: str cloud_project_id: int | None cloud_region_id: int | None - cloud_polling_interval_ms: int | None + cloud_polling_interval_seconds: int | None def __init__( self, @@ -263,7 +263,7 @@ def __init__( api_key: str | None = None, cloud_project_id: int | None = None, cloud_region_id: int | None = None, - cloud_polling_interval_ms: int | None = 1000, + cloud_polling_interval_seconds: int | None = 3, base_url: str | httpx.URL | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, @@ -306,9 +306,9 @@ def __init__( cloud_region_id = maybe_coerce_integer(os.environ.get("GCORE_CLOUD_REGION_ID")) self.cloud_region_id = cloud_region_id - if cloud_polling_interval_ms is None: - cloud_polling_interval_ms = 1000 - self.cloud_polling_interval_ms = cloud_polling_interval_ms + if cloud_polling_interval_seconds is None: + cloud_polling_interval_seconds = 3 + self.cloud_polling_interval_seconds = cloud_polling_interval_seconds if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") @@ -356,7 +356,7 @@ def copy( api_key: str | None = None, cloud_project_id: int | None = None, cloud_region_id: int | None = None, - cloud_polling_interval_ms: int | None = None, + cloud_polling_interval_seconds: int | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.AsyncClient | None = None, @@ -393,7 +393,7 @@ def copy( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, - cloud_polling_interval_ms=cloud_polling_interval_ms or self.cloud_polling_interval_ms, + cloud_polling_interval_seconds=cloud_polling_interval_seconds or self.cloud_polling_interval_seconds, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, From 8cf9169da61442bab02507065da329d27f3555de Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 5 May 2025 09:54:32 +0000 Subject: [PATCH 098/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- README.md | 1 - .../resources/cloud/baremetal/servers.py | 88 +++-- .../cloud/gpu_baremetal_clusters/flavors.py | 18 +- .../gpu_baremetal_clusters.py | 86 ++--- .../gpu_baremetal_clusters/interfaces.py | 4 +- .../cloud/gpu_baremetal_clusters/servers.py | 36 +- .../resources/cloud/instances/instances.py | 150 ++++---- .../types/cloud/baremetal/baremetal_server.py | 19 +- .../cloud/baremetal/server_create_params.py | 55 ++- .../cloud/flavor_hardware_description.py | 6 - src/gcore/types/cloud/floating_ip_detailed.py | 14 +- .../gpu_baremetal_cluster_create_params.py | 266 ++------------- .../flavor_list_params.py | 9 +- src/gcore/types/cloud/gpu_cluster_server.py | 16 +- src/gcore/types/cloud/instance.py | 14 +- .../types/cloud/instance_create_params.py | 321 +++++++++++++----- .../cloud/baremetal/test_servers.py | 8 +- .../cloud/test_gpu_baremetal_clusters.py | 10 - tests/api_resources/cloud/test_instances.py | 74 ++-- tests/api_resources/cloud/test_volumes.py | 4 +- 21 files changed, 600 insertions(+), 603 deletions(-) diff --git a/.stats.yml b/.stats.yml index 78eb43a1..2311872e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-506b88d8207b6721e83a9b8e91ce33e143b3fbe83055e4e8cc276c98ffd0ac20.yml -openapi_spec_hash: 5909b18d3de69bcd21c1a4965e643d7f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7e9d94a10c2058cbb968b0e4bf424ed4121b9a261a8773b79ee55266e9c97a49.yml +openapi_spec_hash: 54d64209bdc34b2bd81e2344f77d29f8 config_hash: cc2ad74ed7a4ce98cbc5d7f6ccc53ffe diff --git a/README.md b/README.md index 2a31f439..0fdbbda2 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,6 @@ task_id_list = client.cloud.instances.create( "is_bootable": False, }, ], - names=["my-awesome-instance"], user_data="IyEvYmluL2Jhc2gKZWNobyAiSGVsbG8sIFdvcmxkISIgPj4gL3RtcC9jbG91ZC1pbml0Lm91dAo=", ) print(task_id_list.tasks) diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index b51fe069..d5a02e12 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -59,8 +59,8 @@ def create( apptemplate_id: str | NotGiven = NOT_GIVEN, ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, image_id: str | NotGiven = NOT_GIVEN, - name_templates: List[str] | NotGiven = NOT_GIVEN, - names: List[str] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + name_template: str | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, tags: TagUpdateListParam | NotGiven = NOT_GIVEN, @@ -74,7 +74,24 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create a new bare metal server or multiple servers + For Linux, + + - Use the `user_data` field to provide a + cloud-init + script in base64 to apply configurations to the instance. + - Specify the `username` and `password` to create a new user. + - When only `password` is provided, it is set as the password for the default + user of the image. + - The `user_data` is ignored when the `password` is specified. + + For Windows, + + - Use the `user_data` field to provide a + cloudbase-init + script in base64 to create new users on Windows. + - Use the `password` field to set the password for the 'Admin' user on Windows. + - The password of the Admin user cannot be updated via `user_data`. + - The `username` cannot be specified in the request. Args: project_id: Project ID @@ -84,7 +101,7 @@ def create( flavor: The flavor of the instance. interfaces: A list of network interfaces for the server. You can create one or more - interfaces—private, public, or both. + interfaces - private, public, or both. app_config: Parameters for the application template if creating the instance from an `apptemplate`. @@ -95,13 +112,13 @@ def create( image_id: Image ID. Either `image_id` or `apptemplate_id` is required. - name_templates: If you want server names to be automatically generated using IP octets, you can - specify name templates instead of setting names manually.Provide a list of - templated names that should be replaced using the selected template. The - following template formats are supported: `{ip_octets}`, `{two_ip_octets}`, and - `{one_ip_octet}`. + name: Server name. - names: List of server names. Specify one name to create a single server. + name_template: If you want server names to be automatically generated based on IP addresses, + you can provide a name template instead of specifying the name manually. The + template should include a placeholder that will be replaced during provisioning. + Supported placeholders are: `{ip_octets}` (last 3 octets of the IP), + `{two_ip_octets}`, and `{one_ip_octet}`. password: For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user @@ -110,7 +127,8 @@ def create( 'user_data' field to provide a script to create new users on Windows. The password of the Admin user cannot be updated via 'user_data'. - ssh_key_name: Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint. + ssh_key_name: Specifies the name of the SSH keypair, created via the + /v1/ssh_keys endpoint. tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -149,8 +167,8 @@ def create( "apptemplate_id": apptemplate_id, "ddos_profile": ddos_profile, "image_id": image_id, - "name_templates": name_templates, - "names": names, + "name": name, + "name_template": name_template, "password": password, "ssh_key_name": ssh_key_name, "tags": tags, @@ -401,8 +419,8 @@ async def create( apptemplate_id: str | NotGiven = NOT_GIVEN, ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, image_id: str | NotGiven = NOT_GIVEN, - name_templates: List[str] | NotGiven = NOT_GIVEN, - names: List[str] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + name_template: str | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, tags: TagUpdateListParam | NotGiven = NOT_GIVEN, @@ -416,7 +434,24 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create a new bare metal server or multiple servers + For Linux, + + - Use the `user_data` field to provide a + cloud-init + script in base64 to apply configurations to the instance. + - Specify the `username` and `password` to create a new user. + - When only `password` is provided, it is set as the password for the default + user of the image. + - The `user_data` is ignored when the `password` is specified. + + For Windows, + + - Use the `user_data` field to provide a + cloudbase-init + script in base64 to create new users on Windows. + - Use the `password` field to set the password for the 'Admin' user on Windows. + - The password of the Admin user cannot be updated via `user_data`. + - The `username` cannot be specified in the request. Args: project_id: Project ID @@ -426,7 +461,7 @@ async def create( flavor: The flavor of the instance. interfaces: A list of network interfaces for the server. You can create one or more - interfaces—private, public, or both. + interfaces - private, public, or both. app_config: Parameters for the application template if creating the instance from an `apptemplate`. @@ -437,13 +472,13 @@ async def create( image_id: Image ID. Either `image_id` or `apptemplate_id` is required. - name_templates: If you want server names to be automatically generated using IP octets, you can - specify name templates instead of setting names manually.Provide a list of - templated names that should be replaced using the selected template. The - following template formats are supported: `{ip_octets}`, `{two_ip_octets}`, and - `{one_ip_octet}`. + name: Server name. - names: List of server names. Specify one name to create a single server. + name_template: If you want server names to be automatically generated based on IP addresses, + you can provide a name template instead of specifying the name manually. The + template should include a placeholder that will be replaced during provisioning. + Supported placeholders are: `{ip_octets}` (last 3 octets of the IP), + `{two_ip_octets}`, and `{one_ip_octet}`. password: For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user @@ -452,7 +487,8 @@ async def create( 'user_data' field to provide a script to create new users on Windows. The password of the Admin user cannot be updated via 'user_data'. - ssh_key_name: Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint. + ssh_key_name: Specifies the name of the SSH keypair, created via the + /v1/ssh_keys endpoint. tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -491,8 +527,8 @@ async def create( "apptemplate_id": apptemplate_id, "ddos_profile": ddos_profile, "image_id": image_id, - "name_templates": name_templates, - "names": names, + "name": name, + "name_template": name_template, "password": password, "ssh_key_name": ssh_key_name, "tags": tags, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index f171531f..7126fee0 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import Optional - import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -48,8 +46,8 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - hide_disabled: Optional[bool] | NotGiven = NOT_GIVEN, - include_prices: Optional[bool] | NotGiven = NOT_GIVEN, + hide_disabled: bool | NotGiven = NOT_GIVEN, + include_prices: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -65,9 +63,9 @@ def list( region_id: Region ID - hide_disabled: Flag for filtering disabled flavors in the region. + hide_disabled: Set to `true` to remove the disabled flavors from the response. - include_prices: Set to true if the response should include flavor prices. + include_prices: Set to `true` if the response should include flavor prices. extra_headers: Send extra headers @@ -125,8 +123,8 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - hide_disabled: Optional[bool] | NotGiven = NOT_GIVEN, - include_prices: Optional[bool] | NotGiven = NOT_GIVEN, + hide_disabled: bool | NotGiven = NOT_GIVEN, + include_prices: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -142,9 +140,9 @@ async def list( region_id: Region ID - hide_disabled: Flag for filtering disabled flavors in the region. + hide_disabled: Set to `true` to remove the disabled flavors from the response. - include_prices: Set to true if the response should include flavor prices. + include_prices: Set to `true` if the response should include flavor prices. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 0ec18d9f..1ca9af6d 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -111,11 +111,8 @@ def create( interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface], name: str, instances_count: int | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, ssh_key_name: str | NotGiven = NOT_GIVEN, tags: TagUpdateListParam | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -124,24 +121,22 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create a new GPU cluster. + Create bare metal GPU cluster Args: flavor: Flavor name image_id: Image ID - interfaces: Subnet IPs and floating IPs + interfaces: A list of network interfaces for the server. You can create one or more + interfaces - private, public, or both. name: GPU Cluster name instances_count: Number of servers to create - password: A password for a bare metal server. This parameter is used to set a password for - the "Admin" user on a Windows instance, a default user or a new user on a Linux - instance - - ssh_key_name: Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint. + ssh_key_name: Specifies the name of the SSH keypair, created via the + /v1/ssh_keys endpoint. tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -149,13 +144,6 @@ def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - user_data: String in base64 format. Must not be passed together with 'username' or - 'password'. Examples of the user_data: - https://cloudinit.readthedocs.io/en/latest/topics/examples.html - - username: A name of a new user in the Linux instance. It may be passed with a 'password' - parameter - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -177,11 +165,8 @@ def create( "interfaces": interfaces, "name": name, "instances_count": instances_count, - "password": password, "ssh_key_name": ssh_key_name, "tags": tags, - "user_data": user_data, - "username": username, }, gpu_baremetal_cluster_create_params.GPUBaremetalClusterCreateParams, ), @@ -206,7 +191,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[GPUBaremetalCluster]: """ - List GPU clusters + List bare metal GPU clusters Args: limit: Limit the number of returned clusters @@ -261,7 +246,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Delete GPU cluster + Delete bare metal GPU cluster Args: delete_floatings: True if it is required to delete floating IPs assigned to the servers. Can't be @@ -319,7 +304,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUBaremetalCluster: """ - Get GPU cluster + Get bare metal GPU cluster Args: extra_headers: Send extra headers @@ -358,7 +343,7 @@ def powercycle_all_servers( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUClusterServerList: """ - Powercycle (stop and start) all GPU cluster nodes, aka hard reboot + Stops and then starts all cluster servers, effectively performing a hard reboot. Args: extra_headers: Send extra headers @@ -397,7 +382,7 @@ def reboot_all_servers( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUClusterServerList: """ - Reboot all GPU cluster nodes + Reboot all bare metal GPU cluster servers Args: extra_headers: Send extra headers @@ -438,10 +423,8 @@ def rebuild( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """Rebuild one or many nodes from GPU cluster. - - All cluster nodes need to be - provided to change the cluster image. + """ + All cluster nodes must be specified to update the cluster image. Args: nodes: List of nodes uuids to be rebuild @@ -497,7 +480,7 @@ def resize( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Resize an existing AI GPU cluster. + Resize bare metal GPU cluster Args: instances_count: Resized (total) number of instances @@ -575,11 +558,8 @@ async def create( interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface], name: str, instances_count: int | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, ssh_key_name: str | NotGiven = NOT_GIVEN, tags: TagUpdateListParam | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -588,24 +568,22 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create a new GPU cluster. + Create bare metal GPU cluster Args: flavor: Flavor name image_id: Image ID - interfaces: Subnet IPs and floating IPs + interfaces: A list of network interfaces for the server. You can create one or more + interfaces - private, public, or both. name: GPU Cluster name instances_count: Number of servers to create - password: A password for a bare metal server. This parameter is used to set a password for - the "Admin" user on a Windows instance, a default user or a new user on a Linux - instance - - ssh_key_name: Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint. + ssh_key_name: Specifies the name of the SSH keypair, created via the + /v1/ssh_keys endpoint. tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -613,13 +591,6 @@ async def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - user_data: String in base64 format. Must not be passed together with 'username' or - 'password'. Examples of the user_data: - https://cloudinit.readthedocs.io/en/latest/topics/examples.html - - username: A name of a new user in the Linux instance. It may be passed with a 'password' - parameter - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -641,11 +612,8 @@ async def create( "interfaces": interfaces, "name": name, "instances_count": instances_count, - "password": password, "ssh_key_name": ssh_key_name, "tags": tags, - "user_data": user_data, - "username": username, }, gpu_baremetal_cluster_create_params.GPUBaremetalClusterCreateParams, ), @@ -670,7 +638,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[GPUBaremetalCluster, AsyncOffsetPage[GPUBaremetalCluster]]: """ - List GPU clusters + List bare metal GPU clusters Args: limit: Limit the number of returned clusters @@ -725,7 +693,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Delete GPU cluster + Delete bare metal GPU cluster Args: delete_floatings: True if it is required to delete floating IPs assigned to the servers. Can't be @@ -783,7 +751,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUBaremetalCluster: """ - Get GPU cluster + Get bare metal GPU cluster Args: extra_headers: Send extra headers @@ -822,7 +790,7 @@ async def powercycle_all_servers( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUClusterServerList: """ - Powercycle (stop and start) all GPU cluster nodes, aka hard reboot + Stops and then starts all cluster servers, effectively performing a hard reboot. Args: extra_headers: Send extra headers @@ -861,7 +829,7 @@ async def reboot_all_servers( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUClusterServerList: """ - Reboot all GPU cluster nodes + Reboot all bare metal GPU cluster servers Args: extra_headers: Send extra headers @@ -902,10 +870,8 @@ async def rebuild( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """Rebuild one or many nodes from GPU cluster. - - All cluster nodes need to be - provided to change the cluster image. + """ + All cluster nodes must be specified to update the cluster image. Args: nodes: List of nodes uuids to be rebuild @@ -961,7 +927,7 @@ async def resize( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Resize an existing AI GPU cluster. + Resize bare metal GPU cluster Args: instances_count: Resized (total) number of instances diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index 78cbdee8..9b8a661b 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -53,7 +53,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> NetworkInterfaceList: """ - List network interfaces attached to GPU cluster servers + Returns the network interfaces attached to the servers in the cluster. Args: extra_headers: Send extra headers @@ -113,7 +113,7 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> NetworkInterfaceList: """ - List network interfaces attached to GPU cluster servers + Returns the network interfaces attached to the servers in the cluster. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 06eabf2e..4ff3ea55 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -66,7 +66,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Remove single node from GPU cluster. + Delete bare metal GPU server from cluster Args: delete_floatings: Set False if you do not want to delete assigned floating IPs. By default, it's @@ -123,7 +123,7 @@ def attach_interface( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Attach interface to GPU cluster node + Attach interface to bare metal GPU cluster server Args: ddos_profile: Advanced DDoS protection. @@ -170,7 +170,7 @@ def attach_interface( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Attach interface to GPU cluster node + Attach interface to bare metal GPU cluster server Args: subnet_id: Port will get an IP address from this subnet @@ -218,7 +218,7 @@ def attach_interface( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Attach interface to GPU cluster node + Attach interface to bare metal GPU cluster server Args: network_id: Port will get an IP address in this network subnet @@ -268,7 +268,7 @@ def attach_interface( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Attach interface to GPU cluster node + Attach interface to bare metal GPU cluster server Args: port_id: Port ID @@ -361,7 +361,7 @@ def detach_interface( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Detach interface from GPU cluster node + Detach interface from bare metal GPU cluster server Args: ip_address: IP address @@ -411,7 +411,7 @@ def get_console( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Console: """ - Get GPU cluster node console URL + Get bare metal GPU cluster server console URL Args: extra_headers: Send extra headers @@ -450,7 +450,7 @@ def powercycle( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUClusterServer: """ - Powercycle (stop and start) one GPU cluster node, aka hard reboot + Stops and then starts the server, effectively performing a hard reboot. Args: extra_headers: Send extra headers @@ -489,7 +489,7 @@ def reboot( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUClusterServer: """ - Reboot one GPU cluster node + Reboot one bare metal GPU cluster server Args: extra_headers: Send extra headers @@ -551,7 +551,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Remove single node from GPU cluster. + Delete bare metal GPU server from cluster Args: delete_floatings: Set False if you do not want to delete assigned floating IPs. By default, it's @@ -610,7 +610,7 @@ async def attach_interface( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Attach interface to GPU cluster node + Attach interface to bare metal GPU cluster server Args: ddos_profile: Advanced DDoS protection. @@ -657,7 +657,7 @@ async def attach_interface( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Attach interface to GPU cluster node + Attach interface to bare metal GPU cluster server Args: subnet_id: Port will get an IP address from this subnet @@ -705,7 +705,7 @@ async def attach_interface( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Attach interface to GPU cluster node + Attach interface to bare metal GPU cluster server Args: network_id: Port will get an IP address in this network subnet @@ -755,7 +755,7 @@ async def attach_interface( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Attach interface to GPU cluster node + Attach interface to bare metal GPU cluster server Args: port_id: Port ID @@ -848,7 +848,7 @@ async def detach_interface( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Detach interface from GPU cluster node + Detach interface from bare metal GPU cluster server Args: ip_address: IP address @@ -898,7 +898,7 @@ async def get_console( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Console: """ - Get GPU cluster node console URL + Get bare metal GPU cluster server console URL Args: extra_headers: Send extra headers @@ -937,7 +937,7 @@ async def powercycle( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUClusterServer: """ - Powercycle (stop and start) one GPU cluster node, aka hard reboot + Stops and then starts the server, effectively performing a hard reboot. Args: extra_headers: Send extra headers @@ -976,7 +976,7 @@ async def reboot( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUClusterServer: """ - Reboot one GPU cluster node + Reboot one bare metal GPU cluster server Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 22513fc5..de68c38f 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -119,8 +119,8 @@ def create( volumes: Iterable[instance_create_params.Volume], allow_app_ports: bool | NotGiven = NOT_GIVEN, configuration: Optional[object] | NotGiven = NOT_GIVEN, - name_templates: List[str] | NotGiven = NOT_GIVEN, - names: List[str] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + name_template: str | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, servergroup_id: str | NotGiven = NOT_GIVEN, @@ -135,18 +135,25 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """Create one or many instances or basic VMs. - - For Linux instances, use the - 'username' and 'password' to create a new user. When only 'password' is - provided, it is set as the password for the default user of the image. The - 'user_data' is ignored when the 'password' is specified. Use the 'user_data' - field to provide a cloud-init script in base64 to apply configurations to the - instance. For Windows instances, the 'username' cannot be specified in the - request. Use the 'password' field to set the password for the 'Admin' user on - Windows. Use the 'user_data' field to provide a cloudbase-init script in base64 - to create new users on Windows. The password of the Admin user cannot be updated - via 'user_data'. + """ + For Linux, + + - Use the `user_data` field to provide a + cloud-init + script in base64 to apply configurations to the instance. + - Specify the `username` and `password` to create a new user. + - When only `password` is provided, it is set as the password for the default + user of the image. + - The `user_data` is ignored when the `password` is specified. + + For Windows, + + - Use the `user_data` field to provide a + cloudbase-init + script in base64 to create new users on Windows. + - Use the `password` field to set the password for the 'Admin' user on Windows. + - The password of the Admin user cannot be updated via `user_data`. + - The `username` cannot be specified in the request. Args: project_id: Project ID @@ -156,9 +163,9 @@ def create( flavor: The flavor of the instance. interfaces: A list of network interfaces for the instance. You can create one or more - interfaces—private, public, or both. + interfaces - private, public, or both. - volumes: List of volumes for instances + volumes: List of volumes that will be attached to the instance. allow_app_ports: Set to `true` if creating the instance from an `apptemplate`. This allows application ports in the security group for instances created from a marketplace @@ -167,13 +174,13 @@ def create( configuration: Parameters for the application template if creating the instance from an `apptemplate`. - name_templates: If you want instance names to be automatically generated using IP octets, you - can specify name templates instead of setting names manually.Provide a list of - templated names that should be replaced using the selected template. The - following template formats are supported: `{ip_octets}`, `{two_ip_octets}`, and - `{one_ip_octet}`. + name: Instance name. - names: List of instance names. Specify one name to create a single instance. + name_template: If you want the instance name to be automatically generated based on IP + addresses, you can provide a name template instead of specifying the name + manually. The template should include a placeholder that will be replaced during + provisioning. Supported placeholders are: `{ip_octets}` (last 3 octets of the + IP), `{two_ip_octets}`, and `{one_ip_octet}`. password: For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user @@ -182,16 +189,20 @@ def create( 'user_data' field to provide a script to create new users on Windows. The password of the Admin user cannot be updated via 'user_data'. - security_groups: Applies only to instances and is ignored for bare metal. Specifies security - group UUIDs to be applied to all instance network interfaces. + security_groups: Specifies security group UUIDs to be applied to all instance network interfaces. + + servergroup_id: Placement group ID for instance placement policy. - servergroup_id: Server group ID for instance placement policy. Can be an anti-affinity, - affinity, or soft-anti-affinity group. `anti-affinity` ensures instances are - placed on different hosts for high availability. `affinity` places instances on - the same host for low-latency communication. `soft-anti-affinity` tries to place - instances on different hosts but allows sharing if needed. + Supported group types: - ssh_key_name: Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint. + - `anti-affinity`: Ensures instances are placed on different hosts for high + availability. + - `affinity`: Places instances on the same host for low-latency communication. + - `soft-anti-affinity`: Tries to place instances on different hosts but allows + sharing if needed. + + ssh_key_name: Specifies the name of the SSH keypair, created via the + /v1/ssh_keys endpoint. tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -229,8 +240,8 @@ def create( "volumes": volumes, "allow_app_ports": allow_app_ports, "configuration": configuration, - "name_templates": name_templates, - "names": names, + "name": name, + "name_template": name_template, "password": password, "security_groups": security_groups, "servergroup_id": servergroup_id, @@ -1118,8 +1129,8 @@ async def create( volumes: Iterable[instance_create_params.Volume], allow_app_ports: bool | NotGiven = NOT_GIVEN, configuration: Optional[object] | NotGiven = NOT_GIVEN, - name_templates: List[str] | NotGiven = NOT_GIVEN, - names: List[str] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + name_template: str | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, servergroup_id: str | NotGiven = NOT_GIVEN, @@ -1134,18 +1145,25 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """Create one or many instances or basic VMs. - - For Linux instances, use the - 'username' and 'password' to create a new user. When only 'password' is - provided, it is set as the password for the default user of the image. The - 'user_data' is ignored when the 'password' is specified. Use the 'user_data' - field to provide a cloud-init script in base64 to apply configurations to the - instance. For Windows instances, the 'username' cannot be specified in the - request. Use the 'password' field to set the password for the 'Admin' user on - Windows. Use the 'user_data' field to provide a cloudbase-init script in base64 - to create new users on Windows. The password of the Admin user cannot be updated - via 'user_data'. + """ + For Linux, + + - Use the `user_data` field to provide a + cloud-init + script in base64 to apply configurations to the instance. + - Specify the `username` and `password` to create a new user. + - When only `password` is provided, it is set as the password for the default + user of the image. + - The `user_data` is ignored when the `password` is specified. + + For Windows, + + - Use the `user_data` field to provide a + cloudbase-init + script in base64 to create new users on Windows. + - Use the `password` field to set the password for the 'Admin' user on Windows. + - The password of the Admin user cannot be updated via `user_data`. + - The `username` cannot be specified in the request. Args: project_id: Project ID @@ -1155,9 +1173,9 @@ async def create( flavor: The flavor of the instance. interfaces: A list of network interfaces for the instance. You can create one or more - interfaces—private, public, or both. + interfaces - private, public, or both. - volumes: List of volumes for instances + volumes: List of volumes that will be attached to the instance. allow_app_ports: Set to `true` if creating the instance from an `apptemplate`. This allows application ports in the security group for instances created from a marketplace @@ -1166,13 +1184,13 @@ async def create( configuration: Parameters for the application template if creating the instance from an `apptemplate`. - name_templates: If you want instance names to be automatically generated using IP octets, you - can specify name templates instead of setting names manually.Provide a list of - templated names that should be replaced using the selected template. The - following template formats are supported: `{ip_octets}`, `{two_ip_octets}`, and - `{one_ip_octet}`. + name: Instance name. - names: List of instance names. Specify one name to create a single instance. + name_template: If you want the instance name to be automatically generated based on IP + addresses, you can provide a name template instead of specifying the name + manually. The template should include a placeholder that will be replaced during + provisioning. Supported placeholders are: `{ip_octets}` (last 3 octets of the + IP), `{two_ip_octets}`, and `{one_ip_octet}`. password: For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user @@ -1181,16 +1199,20 @@ async def create( 'user_data' field to provide a script to create new users on Windows. The password of the Admin user cannot be updated via 'user_data'. - security_groups: Applies only to instances and is ignored for bare metal. Specifies security - group UUIDs to be applied to all instance network interfaces. + security_groups: Specifies security group UUIDs to be applied to all instance network interfaces. + + servergroup_id: Placement group ID for instance placement policy. - servergroup_id: Server group ID for instance placement policy. Can be an anti-affinity, - affinity, or soft-anti-affinity group. `anti-affinity` ensures instances are - placed on different hosts for high availability. `affinity` places instances on - the same host for low-latency communication. `soft-anti-affinity` tries to place - instances on different hosts but allows sharing if needed. + Supported group types: - ssh_key_name: Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint. + - `anti-affinity`: Ensures instances are placed on different hosts for high + availability. + - `affinity`: Places instances on the same host for low-latency communication. + - `soft-anti-affinity`: Tries to place instances on different hosts but allows + sharing if needed. + + ssh_key_name: Specifies the name of the SSH keypair, created via the + /v1/ssh_keys endpoint. tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -1228,8 +1250,8 @@ async def create( "volumes": volumes, "allow_app_ports": allow_app_ports, "configuration": configuration, - "name_templates": name_templates, - "names": names, + "name": name, + "name_template": name_template, "password": password, "security_groups": security_groups, "servergroup_id": servergroup_id, diff --git a/src/gcore/types/cloud/baremetal/baremetal_server.py b/src/gcore/types/cloud/baremetal/baremetal_server.py index bc0a8cda..657e8887 100644 --- a/src/gcore/types/cloud/baremetal/baremetal_server.py +++ b/src/gcore/types/cloud/baremetal/baremetal_server.py @@ -72,12 +72,18 @@ class Flavor(BaseModel): class BaremetalServer(BaseModel): + id: str + """Bare metal server ID""" + addresses: Dict[str, List[Address]] """Map of network_name to list of addresses in that network""" blackhole_ports: List[BlackholePort] """IP addresses of the instances that are blackholed by DDoS mitigation system""" + created_at: datetime + """Datetime when bare metal server was created""" + creator_task_id: Optional[str] = None """Task that created this entity""" @@ -91,21 +97,12 @@ class BaremetalServer(BaseModel): """Fixed IP assigned to instance""" flavor: Flavor - """Flavor""" - - instance_created: datetime - """Datetime when bare metal server was created""" - - instance_description: Optional[str] = None - """Bare metal server description""" - - instance_id: str - """Bare metal server ID""" + """Flavor details""" instance_isolation: Optional[InstanceIsolation] = None """Instance isolation information""" - instance_name: str + name: str """Bare metal server name""" project_id: int diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index 8be35d6b..a766cded 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Union, Iterable, Optional +from typing import Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..interface_ip_family import InterfaceIPFamily @@ -42,7 +42,7 @@ class ServerCreateParams(TypedDict, total=False): interfaces: Required[Iterable[Interface]] """A list of network interfaces for the server. - You can create one or more interfaces—private, public, or both. + You can create one or more interfaces - private, public, or both. """ app_config: Optional[object] @@ -60,18 +60,18 @@ class ServerCreateParams(TypedDict, total=False): image_id: str """Image ID. Either `image_id` or `apptemplate_id` is required.""" - name_templates: List[str] + name: str + """Server name.""" + + name_template: str """ - If you want server names to be automatically generated using IP octets, you can - specify name templates instead of setting names manually.Provide a list of - templated names that should be replaced using the selected template. The - following template formats are supported: `{ip_octets}`, `{two_ip_octets}`, and - `{one_ip_octet}`. + If you want server names to be automatically generated based on IP addresses, + you can provide a name template instead of specifying the name manually. The + template should include a placeholder that will be replaced during provisioning. + Supported placeholders are: `{ip_octets}` (last 3 octets of the IP), + `{two_ip_octets}`, and `{one_ip_octet}`. """ - names: List[str] - """List of server names. Specify one name to create a single server.""" - password: str """For Linux instances, 'username' and 'password' are used to create a new user. @@ -83,7 +83,10 @@ class ServerCreateParams(TypedDict, total=False): """ ssh_key_name: Optional[str] - """Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint.""" + """ + Specifies the name of the SSH keypair, created via the + /v1/ssh_keys endpoint. + """ tags: TagUpdateListParam """Key-value tags to associate with the resource. @@ -126,7 +129,12 @@ class InterfaceCreateBareMetalExternalInterfaceSerializer(TypedDict, total=False """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" port_group: int - """Applicable only to bare metal. Each group is added to a separate trunk.""" + """Specifies the trunk group to which this interface belongs. + + Applicable only for bare metal servers. Each unique port group is mapped to a + separate trunk port. Use this to control how interfaces are grouped across + trunks. + """ class InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer( @@ -189,7 +197,12 @@ class InterfaceCreateBareMetalSubnetInterfaceSerializer(TypedDict, total=False): """ port_group: int - """Applicable only to bare metal. Each group is added to a separate trunk.""" + """Specifies the trunk group to which this interface belongs. + + Applicable only for bare metal servers. Each unique port group is mapped to a + separate trunk port. Use this to control how interfaces are grouped across + trunks. + """ class InterfaceCreateBareMetalAnySubnetInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer( @@ -251,7 +264,12 @@ class InterfaceCreateBareMetalAnySubnetInterfaceSerializer(TypedDict, total=Fals """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" port_group: int - """Applicable only to bare metal. Each group is added to a separate trunk.""" + """Specifies the trunk group to which this interface belongs. + + Applicable only for bare metal servers. Each unique port group is mapped to a + separate trunk port. Use this to control how interfaces are grouped across + trunks. + """ class InterfaceCreateBareMetalReservedFixedIPInterfaceSerializerFloatingIPNewInstanceFloatingIPInterfaceSerializer( @@ -311,7 +329,12 @@ class InterfaceCreateBareMetalReservedFixedIPInterfaceSerializer(TypedDict, tota """ port_group: int - """Applicable only to bare metal. Each group is added to a separate trunk.""" + """Specifies the trunk group to which this interface belongs. + + Applicable only for bare metal servers. Each unique port group is mapped to a + separate trunk port. Use this to control how interfaces are grouped across + trunks. + """ Interface: TypeAlias = Union[ diff --git a/src/gcore/types/cloud/flavor_hardware_description.py b/src/gcore/types/cloud/flavor_hardware_description.py index a5b259e8..c03f2150 100644 --- a/src/gcore/types/cloud/flavor_hardware_description.py +++ b/src/gcore/types/cloud/flavor_hardware_description.py @@ -20,14 +20,8 @@ class FlavorHardwareDescription(BaseModel): gpu: Optional[str] = None """Human-readable GPU description""" - ipu: Optional[str] = None - """Human-readable IPU description of AI cluster""" - network: Optional[str] = None """Human-readable NIC description""" - poplar_count: Optional[int] = None - """Human-readable count of poplar servers of AI cluster""" - ram: Optional[str] = None """Human-readable RAM description""" diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index 057730b2..bc2ceb7f 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -52,25 +52,25 @@ class InstanceVolume(BaseModel): class Instance(BaseModel): + id: str + """Instance ID""" + addresses: Dict[str, List[InstanceAddress]] """Map of network_name to list of addresses in that network""" + created_at: datetime + """Datetime when instance was created""" + creator_task_id: str """Task that created this entity""" flavor: InstanceFlavor """Flavor""" - instance_created: datetime - """Datetime when instance was created""" - instance_description: Optional[str] = None """Instance description""" - instance_id: str - """Instance ID""" - - instance_name: str + name: str """Instance name""" project_id: int 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 56c0a07d..0a9b2bd9 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -11,23 +11,11 @@ __all__ = [ "GPUBaremetalClusterCreateParams", "Interface", - "InterfaceNewInterfaceExternalSerializerPydantic", - "InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup", - "InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic", - "InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIP", - "InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer", - "InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer", - "InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup", - "InterfaceNewInterfaceAnySubnetFipSerializerPydantic", - "InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIP", - "InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer", - "InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer", - "InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup", - "InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic", - "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIP", - "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer", - "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer", - "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup", + "InterfaceCreateGPUClusterExternalInterfaceSerializer", + "InterfaceCreateGPUClusterSubnetInterfaceSerializer", + "InterfaceCreateGPUClusterSubnetInterfaceSerializerFloatingIP", + "InterfaceCreateGPUClusterAnySubnetInterfaceSerializer", + "InterfaceCreateGPUClusterAnySubnetInterfaceSerializerFloatingIP", ] @@ -43,7 +31,10 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): """Image ID""" interfaces: Required[Iterable[Interface]] - """Subnet IPs and floating IPs""" + """A list of network interfaces for the server. + + You can create one or more interfaces - private, public, or both. + """ name: Required[str] """GPU Cluster name""" @@ -51,15 +42,11 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): instances_count: int """Number of servers to create""" - password: str - """A password for a bare metal server. - - This parameter is used to set a password for the "Admin" user on a Windows - instance, a default user or a new user on a Linux instance - """ - ssh_key_name: str - """Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint.""" + """ + Specifies the name of the SSH keypair, created via the + /v1/ssh_keys endpoint. + """ tags: TagUpdateListParam """Key-value tags to associate with the resource. @@ -71,28 +58,10 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): values. """ - user_data: str - """String in base64 format. - - Must not be passed together with 'username' or 'password'. Examples of the - user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html - """ - - username: str - """A name of a new user in the Linux instance. - - It may be passed with a 'password' parameter - """ - -class InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup(TypedDict, total=False): - id: Required[str] - """Resource ID""" - - -class InterfaceNewInterfaceExternalSerializerPydantic(TypedDict, total=False): +class InterfaceCreateGPUClusterExternalInterfaceSerializer(TypedDict, total=False): type: Required[Literal["external"]] - """A public IP address will be assigned to the instance.""" + """A public IP address will be assigned to the server.""" interface_name: str """Interface name. @@ -103,63 +72,17 @@ class InterfaceNewInterfaceExternalSerializerPydantic(TypedDict, total=False): ip_family: Optional[InterfaceIPFamily] """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" - port_group: int - """Applicable only to bare metal. Each group is added to a separate trunk.""" - - security_groups: Iterable[InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup] - """Applies only to instances and is ignored for bare metal. - - Specifies security group UUIDs to be applied to the instance network interface. - """ - -class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer( - TypedDict, total=False -): +class InterfaceCreateGPUClusterSubnetInterfaceSerializerFloatingIP(TypedDict, total=False): source: Required[Literal["new"]] - """A new floating IP will be created and attached to the instance. - - A floating IP is a public IP that makes the instance accessible from the - internet, even if it only has a private IP. It works like SNAT, allowing - outgoing and incoming traffic. - """ -class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer( - TypedDict, total=False -): - existing_floating_id: Required[str] - """ - An existing available floating IP id must be specified if the source is set to - `existing` - """ - - source: Required[Literal["existing"]] - """An existing available floating IP will be attached to the instance. - - A floating IP is a public IP that makes the instance accessible from the - internet, even if it only has a private IP. It works like SNAT, allowing - outgoing and incoming traffic. - """ - - -InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIP: TypeAlias = Union[ - InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer, - InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer, -] - - -class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup(TypedDict, total=False): - id: Required[str] - """Resource ID""" - - -class InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic(TypedDict, total=False): +class InterfaceCreateGPUClusterSubnetInterfaceSerializer(TypedDict, total=False): network_id: Required[str] - """The network where the instance will be connected.""" + """The network where the server will be connected.""" subnet_id: Required[str] - """The instance will get an IP address from this subnet.""" + """The server will get an IP address from this subnet.""" type: Required[Literal["subnet"]] """The instance will get an IP address from the selected network. @@ -168,8 +91,8 @@ class InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic(TypedDict, total= internet. Otherwise, it will only have a private IP within the network. """ - floating_ip: InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIP - """Allows the instance to have a public IP that can be reached from the internet.""" + floating_ip: InterfaceCreateGPUClusterSubnetInterfaceSerializerFloatingIP + """Floating IP config for this subnet attachment""" interface_name: str """Interface name. @@ -177,66 +100,20 @@ class InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic(TypedDict, total= Defaults to `null` and is returned as `null` in the API response if not set. """ - port_group: int - """Applicable only to bare metal. Each group is added to a separate trunk.""" - - security_groups: Iterable[InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup] - """Applies only to instances and is ignored for bare metal. - - Specifies security group UUIDs to be applied to the instance network interface. - """ - -class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer( - TypedDict, total=False -): +class InterfaceCreateGPUClusterAnySubnetInterfaceSerializerFloatingIP(TypedDict, total=False): source: Required[Literal["new"]] - """A new floating IP will be created and attached to the instance. - - A floating IP is a public IP that makes the instance accessible from the - internet, even if it only has a private IP. It works like SNAT, allowing - outgoing and incoming traffic. - """ - -class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer( - TypedDict, total=False -): - existing_floating_id: Required[str] - """ - An existing available floating IP id must be specified if the source is set to - `existing` - """ - - source: Required[Literal["existing"]] - """An existing available floating IP will be attached to the instance. - - A floating IP is a public IP that makes the instance accessible from the - internet, even if it only has a private IP. It works like SNAT, allowing - outgoing and incoming traffic. - """ - -InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIP: TypeAlias = Union[ - InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer, - InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer, -] - - -class InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup(TypedDict, total=False): - id: Required[str] - """Resource ID""" - - -class InterfaceNewInterfaceAnySubnetFipSerializerPydantic(TypedDict, total=False): +class InterfaceCreateGPUClusterAnySubnetInterfaceSerializer(TypedDict, total=False): network_id: Required[str] - """The network where the instance will be connected.""" + """The network where the server will be connected.""" type: Required[Literal["any_subnet"]] - """Instance will be attached to a subnet with the largest count of free IPs.""" + """Server will be attached to a subnet with the largest count of free IPs.""" - floating_ip: InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIP - """Allows the instance to have a public IP that can be reached from the internet.""" + floating_ip: InterfaceCreateGPUClusterAnySubnetInterfaceSerializerFloatingIP + """Allows the server to have a public IP that can be reached from the internet.""" interface_name: str """Interface name. @@ -247,93 +124,12 @@ class InterfaceNewInterfaceAnySubnetFipSerializerPydantic(TypedDict, total=False ip_address: str """You can specify a specific IP address from your subnet.""" - ip_family: Optional[InterfaceIPFamily] + ip_family: InterfaceIPFamily """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" - port_group: int - """Applicable only to bare metal. Each group is added to a separate trunk.""" - - security_groups: Iterable[InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup] - """Applies only to instances and is ignored for bare metal. - - Specifies security group UUIDs to be applied to the instance network interface. - """ - - -class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer( - TypedDict, total=False -): - source: Required[Literal["new"]] - """A new floating IP will be created and attached to the instance. - - A floating IP is a public IP that makes the instance accessible from the - internet, even if it only has a private IP. It works like SNAT, allowing - outgoing and incoming traffic. - """ - - -class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer( - TypedDict, total=False -): - existing_floating_id: Required[str] - """ - An existing available floating IP id must be specified if the source is set to - `existing` - """ - - source: Required[Literal["existing"]] - """An existing available floating IP will be attached to the instance. - - A floating IP is a public IP that makes the instance accessible from the - internet, even if it only has a private IP. It works like SNAT, allowing - outgoing and incoming traffic. - """ - - -InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIP: TypeAlias = Union[ - InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer, - InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer, -] - - -class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup(TypedDict, total=False): - id: Required[str] - """Resource ID""" - - -class InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic(TypedDict, total=False): - port_id: Required[str] - """Network ID the subnet belongs to. Port will be plugged in this network.""" - - type: Required[Literal["reserved_fixed_ip"]] - """An existing available reserved fixed IP will be attached to the instance. - - If the reserved IP is not public and you choose to add a floating IP, the - instance will be accessible from the internet. - """ - - floating_ip: InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIP - """Allows the instance to have a public IP that can be reached from the internet.""" - - interface_name: str - """Interface name. - - Defaults to `null` and is returned as `null` in the API response if not set. - """ - - port_group: int - """Applicable only to bare metal. Each group is added to a separate trunk.""" - - security_groups: Iterable[InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup] - """Applies only to instances and is ignored for bare metal. - - Specifies security group UUIDs to be applied to the instance network interface. - """ - Interface: TypeAlias = Union[ - InterfaceNewInterfaceExternalSerializerPydantic, - InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic, - InterfaceNewInterfaceAnySubnetFipSerializerPydantic, - InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic, + InterfaceCreateGPUClusterExternalInterfaceSerializer, + InterfaceCreateGPUClusterSubnetInterfaceSerializer, + InterfaceCreateGPUClusterAnySubnetInterfaceSerializer, ] diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py index 0a134384..febeb592 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py @@ -2,7 +2,6 @@ from __future__ import annotations -from typing import Optional from typing_extensions import TypedDict __all__ = ["FlavorListParams"] @@ -15,8 +14,8 @@ class FlavorListParams(TypedDict, total=False): region_id: int """Region ID""" - hide_disabled: Optional[bool] - """Flag for filtering disabled flavors in the region.""" + hide_disabled: bool + """Set to `true` to remove the disabled flavors from the response.""" - include_prices: Optional[bool] - """Set to true if the response should include flavor prices.""" + include_prices: bool + """Set to `true` if the response should include flavor prices.""" diff --git a/src/gcore/types/cloud/gpu_cluster_server.py b/src/gcore/types/cloud/gpu_cluster_server.py index 842a77d7..9e466000 100644 --- a/src/gcore/types/cloud/gpu_cluster_server.py +++ b/src/gcore/types/cloud/gpu_cluster_server.py @@ -81,12 +81,18 @@ class SecurityGroup(BaseModel): class GPUClusterServer(BaseModel): + id: str + """GPU server ID""" + addresses: Dict[str, List[Address]] """Map of network_name to list of addresses in that network""" blackhole_ports: List[BlackholePort] """IP addresses of the instances that are blackholed by DDoS mitigation system""" + created_at: datetime + """Datetime when GPU server was created""" + creator_task_id: Optional[str] = None """Task that created this entity""" @@ -102,20 +108,14 @@ class GPUClusterServer(BaseModel): flavor: Flavor """Flavor""" - instance_created: datetime - """Datetime when instance was created""" - instance_description: Optional[str] = None """Instance description""" - instance_id: str - """Instance ID""" - instance_isolation: Optional[InstanceIsolation] = None """Instance isolation information""" - instance_name: str - """Instance name""" + name: str + """GPU server name""" project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/instance.py b/src/gcore/types/cloud/instance.py index 6b1c6145..4521ec7e 100644 --- a/src/gcore/types/cloud/instance.py +++ b/src/gcore/types/cloud/instance.py @@ -181,12 +181,18 @@ class Volume(BaseModel): class Instance(BaseModel): + id: str + """Instance ID""" + addresses: Dict[str, List[Address]] """Map of network_name to list of addresses in that network""" blackhole_ports: List[BlackholePort] """IP addresses of the instances that are blackholed by DDoS mitigation system""" + created_at: datetime + """Datetime when instance was created""" + creator_task_id: Optional[str] = None """Task that created this entity""" @@ -202,19 +208,13 @@ class Instance(BaseModel): flavor: Flavor """Flavor""" - instance_created: datetime - """Datetime when instance was created""" - instance_description: Optional[str] = None """Instance description""" - instance_id: str - """Instance ID""" - instance_isolation: Optional[InstanceIsolation] = None """Instance isolation information""" - instance_name: str + name: str """Instance name""" project_id: int diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index 90ee8ab7..bf6bde4b 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Union, Iterable, Optional +from typing import Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .interface_ip_family import InterfaceIPFamily @@ -29,6 +29,11 @@ "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPExistingInstanceFloatingIPInterfaceSerializer", "InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup", "Volume", + "VolumeCreateInstanceCreateNewVolumeSerializer", + "VolumeCreateInstanceCreateVolumeFromImageSerializer", + "VolumeCreateInstanceCreateVolumeFromSnapshotSerializer", + "VolumeCreateInstanceCreateVolumeFromApptemplateSerializer", + "VolumeCreateInstanceExistingVolumeSerializer", "SecurityGroup", ] @@ -46,11 +51,11 @@ class InstanceCreateParams(TypedDict, total=False): interfaces: Required[Iterable[Interface]] """A list of network interfaces for the instance. - You can create one or more interfaces—private, public, or both. + You can create one or more interfaces - private, public, or both. """ volumes: Required[Iterable[Volume]] - """List of volumes for instances""" + """List of volumes that will be attached to the instance.""" allow_app_ports: bool """Set to `true` if creating the instance from an `apptemplate`. @@ -65,18 +70,18 @@ class InstanceCreateParams(TypedDict, total=False): `apptemplate`. """ - name_templates: List[str] + name: str + """Instance name.""" + + name_template: str """ - If you want instance names to be automatically generated using IP octets, you - can specify name templates instead of setting names manually.Provide a list of - templated names that should be replaced using the selected template. The - following template formats are supported: `{ip_octets}`, `{two_ip_octets}`, and - `{one_ip_octet}`. + If you want the instance name to be automatically generated based on IP + addresses, you can provide a name template instead of specifying the name + manually. The template should include a placeholder that will be replaced during + provisioning. Supported placeholders are: `{ip_octets}` (last 3 octets of the + IP), `{two_ip_octets}`, and `{one_ip_octet}`. """ - names: List[str] - """List of instance names. Specify one name to create a single instance.""" - password: str """For Linux instances, 'username' and 'password' are used to create a new user. @@ -88,23 +93,27 @@ class InstanceCreateParams(TypedDict, total=False): """ security_groups: Iterable[SecurityGroup] - """Applies only to instances and is ignored for bare metal. - + """ Specifies security group UUIDs to be applied to all instance network interfaces. """ servergroup_id: str - """Server group ID for instance placement policy. + """Placement group ID for instance placement policy. - Can be an anti-affinity, affinity, or soft-anti-affinity group. `anti-affinity` - ensures instances are placed on different hosts for high availability. - `affinity` places instances on the same host for low-latency communication. - `soft-anti-affinity` tries to place instances on different hosts but allows - sharing if needed. + Supported group types: + + - `anti-affinity`: Ensures instances are placed on different hosts for high + availability. + - `affinity`: Places instances on the same host for low-latency communication. + - `soft-anti-affinity`: Tries to place instances on different hosts but allows + sharing if needed. """ ssh_key_name: Optional[str] - """Specifies the name of the SSH keypair, created via the `/v1/ssh_keys` endpoint.""" + """ + Specifies the name of the SSH keypair, created via the + /v1/ssh_keys endpoint. + """ tags: TagUpdateListParam """Key-value tags to associate with the resource. @@ -151,14 +160,8 @@ class InterfaceNewInterfaceExternalSerializerPydantic(TypedDict, total=False): ip_family: Optional[InterfaceIPFamily] """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" - port_group: int - """Applicable only to bare metal. Each group is added to a separate trunk.""" - security_groups: Iterable[InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup] - """Applies only to instances and is ignored for bare metal. - - Specifies security group UUIDs to be applied to the instance network interface. - """ + """Specifies security group UUIDs to be applied to the instance network interface.""" class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer( @@ -225,14 +228,8 @@ class InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic(TypedDict, total= Defaults to `null` and is returned as `null` in the API response if not set. """ - port_group: int - """Applicable only to bare metal. Each group is added to a separate trunk.""" - security_groups: Iterable[InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup] - """Applies only to instances and is ignored for bare metal. - - Specifies security group UUIDs to be applied to the instance network interface. - """ + """Specifies security group UUIDs to be applied to the instance network interface.""" class InterfaceNewInterfaceAnySubnetFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer( @@ -298,14 +295,8 @@ class InterfaceNewInterfaceAnySubnetFipSerializerPydantic(TypedDict, total=False ip_family: Optional[InterfaceIPFamily] """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" - port_group: int - """Applicable only to bare metal. Each group is added to a separate trunk.""" - security_groups: Iterable[InterfaceNewInterfaceAnySubnetFipSerializerPydanticSecurityGroup] - """Applies only to instances and is ignored for bare metal. - - Specifies security group UUIDs to be applied to the instance network interface. - """ + """Specifies security group UUIDs to be applied to the instance network interface.""" class InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticFloatingIPNewInstanceFloatingIPInterfaceSerializer( @@ -369,14 +360,8 @@ class InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic(TypedDict, total Defaults to `null` and is returned as `null` in the API response if not set. """ - port_group: int - """Applicable only to bare metal. Each group is added to a separate trunk.""" - security_groups: Iterable[InterfaceNewInterfaceReservedFixedIPFipSerializerPydanticSecurityGroup] - """Applies only to instances and is ignored for bare metal. - - Specifies security group UUIDs to be applied to the instance network interface. - """ + """Specifies security group UUIDs to be applied to the instance network interface.""" Interface: TypeAlias = Union[ @@ -387,33 +372,72 @@ class InterfaceNewInterfaceReservedFixedIPFipSerializerPydantic(TypedDict, total ] -class Volume(TypedDict, total=False): - source: Required[Literal["apptemplate", "existing-volume", "image", "new-volume", "snapshot"]] - """Volume source. +class VolumeCreateInstanceCreateNewVolumeSerializer(TypedDict, total=False): + size: Required[int] + """Volume size in GiB.""" + + source: Required[Literal["new-volume"]] + """New volume will be created from scratch and attached to the instance.""" + + attachment_tag: str + """Block device attachment tag (not exposed in the normal tags)""" + + delete_on_termination: bool + """Set to `true` to automatically delete the volume when the instance is deleted.""" + + name: str + """The name of the volume. + + If not specified, a name will be generated automatically. + """ + + tags: TagUpdateListParam + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. + """ + + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + """Volume type name. Supported values: - For `image`, specify `image_id` and `size`. For `new-volume`, specify `size`. - For `existing-volume`, specify `volume_id`. For `snapshot`, specify - `snapshot_id`. For `apptemplate`, specify `apptemplate_id`. + - `standard` - Network SSD block storage offering stable performance with high + random I/O and data reliability (6 IOPS per 1 GiB, 0.4 MB/s per 1 GiB). Max + IOPS: 4500. Max bandwidth: 300 MB/s. + - `ssd_hiiops` - High-performance SSD storage for latency-sensitive + transactional workloads (60 IOPS per 1 GiB, 2.5 MB/s per 1 GiB). Max + IOPS: 9000. Max bandwidth: 500 MB/s. + - `ssd_lowlatency` - SSD storage optimized for low-latency and real-time + processing. Max IOPS: 5000. Average latency: 300 µs. Snapshots and volume + resizing are **not** supported for `ssd_lowlatency`. """ - apptemplate_id: str - """App template ID. Required if `source` is `apptemplate`""" + +class VolumeCreateInstanceCreateVolumeFromImageSerializer(TypedDict, total=False): + image_id: Required[str] + """Image ID.""" + + source: Required[Literal["image"]] + """New volume will be created from the image and attached to the instance. + + Specify `boot_index=0` to boot from this volume. + """ attachment_tag: str """Block device attachment tag (not exposed in the normal tags)""" boot_index: int - """0 means that this is the primary boot device. - - A unique positive value is set for the other bootable devices. A negative number - means that the boot is prohibited. + """ + - `0` means that this is the primary boot device; + - A unique positive value is set for the secondary bootable devices; + - A negative number means that the boot is prohibited. """ delete_on_termination: bool - """Whether the volume should be deleted along with the VM""" - - image_id: str - """Image ID. Required if `source` is `image`""" + """Set to `true` to automatically delete the volume when the instance is deleted.""" name: str """The name of the volume. @@ -422,14 +446,111 @@ class Volume(TypedDict, total=False): """ size: int - """Required when the `source` is either `new-volume` or `image`. + """Volume size in GiB. + + - For instances: **specify the desired volume size explicitly**. + - For basic VMs: the size is set automatically based on the flavor. + """ + + tags: TagUpdateListParam + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. + """ + + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + """Volume type name. Supported values: + + - `standard` - Network SSD block storage offering stable performance with high + random I/O and data reliability (6 IOPS per 1 GiB, 0.4 MB/s per 1 GiB). Max + IOPS: 4500. Max bandwidth: 300 MB/s. + - `ssd_hiiops` - High-performance SSD storage for latency-sensitive + transactional workloads (60 IOPS per 1 GiB, 2.5 MB/s per 1 GiB). Max + IOPS: 9000. Max bandwidth: 500 MB/s. + - `ssd_lowlatency` - SSD storage optimized for low-latency and real-time + processing. Max IOPS: 5000. Average latency: 300 µs. Snapshots and volume + resizing are **not** supported for `ssd_lowlatency`. + """ + + +class VolumeCreateInstanceCreateVolumeFromSnapshotSerializer(TypedDict, total=False): + size: Required[int] + """Volume size in GiB.""" + + snapshot_id: Required[str] + """Snapshot ID.""" - If specified for the `snapshot` or `existing-volume` `source`, the value must - match the size of the snapshot or the existing volume, respectively. + source: Required[Literal["snapshot"]] + """New volume will be created from the snapshot and attached to the instance.""" + + attachment_tag: str + """Block device attachment tag (not exposed in the normal tags)""" + + boot_index: int + """ + - `0` means that this is the primary boot device; + - A unique positive value is set for the secondary bootable devices; + - A negative number means that the boot is prohibited. + """ + + delete_on_termination: bool + """Set to `true` to automatically delete the volume when the instance is deleted.""" + + name: str + """The name of the volume. + + If not specified, a name will be generated automatically. + """ + + tags: TagUpdateListParam + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. + """ + + type_name: Literal["ssd_hiiops", "standard"] + """Specifies the volume type. + + If omitted, the type from the source volume will be used by default. + """ + + +class VolumeCreateInstanceCreateVolumeFromApptemplateSerializer(TypedDict, total=False): + apptemplate_id: Required[str] + """App template ID.""" + + source: Required[Literal["apptemplate"]] + """New volume will be created from the app template and attached to the instance.""" + + attachment_tag: str + """Block device attachment tag (not exposed in the normal tags)""" + + boot_index: int + """ + - `0` means that this is the primary boot device; + - A unique positive value is set for the secondary bootable devices; + - A negative number means that the boot is prohibited. + """ + + delete_on_termination: bool + """Set to `true` to automatically delete the volume when the instance is deleted.""" + + name: str + """The name of the volume. + + If not specified, a name will be generated automatically. """ - snapshot_id: str - """Volume snapshot ID. Required if `source` is `snapshot`""" + size: int + """Volume size in GiB.""" tags: TagUpdateListParam """Key-value tags to associate with the resource. @@ -442,20 +563,58 @@ class Volume(TypedDict, total=False): """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - """Volume type name. + """Volume type name. Supported values: - Supported values: `standard` – Network SSD block storage offering stable - performance with high random I/O and data reliability (6 IOPS per 1 GiB, 0.4 - MB/s per 1 GiB). Max IOPS: 4500. Max bandwidth: 300 MB/s. `ssd_hiiops` – - High-performance SSD storage for latency-sensitive transactional workloads (60 - IOPS per 1 GiB, 2.5 MB/s per 1 GiB). Max IOPS: 9000. Max bandwidth: 500 MB/s. - `ssd_lowlatency` – SSD storage optimized for low-latency and real-time - processing. Max IOPS: 5000. Average latency: 300 µs. Snapshots and volume - resizing are not supported for `ssd_lowlatency`. + - `standard` - Network SSD block storage offering stable performance with high + random I/O and data reliability (6 IOPS per 1 GiB, 0.4 MB/s per 1 GiB). Max + IOPS: 4500. Max bandwidth: 300 MB/s. + - `ssd_hiiops` - High-performance SSD storage for latency-sensitive + transactional workloads (60 IOPS per 1 GiB, 2.5 MB/s per 1 GiB). Max + IOPS: 9000. Max bandwidth: 500 MB/s. + - `ssd_lowlatency` - SSD storage optimized for low-latency and real-time + processing. Max IOPS: 5000. Average latency: 300 µs. Snapshots and volume + resizing are **not** supported for `ssd_lowlatency`. """ - volume_id: str - """Volume ID. Required if `source` is `existing-volume`""" + +class VolumeCreateInstanceExistingVolumeSerializer(TypedDict, total=False): + source: Required[Literal["existing-volume"]] + """Existing available volume will be attached to the instance.""" + + volume_id: Required[str] + """Volume ID.""" + + attachment_tag: str + """Block device attachment tag (not exposed in the normal tags)""" + + boot_index: int + """ + - `0` means that this is the primary boot device; + - A unique positive value is set for the secondary bootable devices; + - A negative number means that the boot is prohibited. + """ + + delete_on_termination: bool + """Set to `true` to automatically delete the volume when the instance is deleted.""" + + tags: TagUpdateListParam + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. + """ + + +Volume: TypeAlias = Union[ + VolumeCreateInstanceCreateNewVolumeSerializer, + VolumeCreateInstanceCreateVolumeFromImageSerializer, + VolumeCreateInstanceCreateVolumeFromSnapshotSerializer, + VolumeCreateInstanceCreateVolumeFromApptemplateSerializer, + VolumeCreateInstanceExistingVolumeSerializer, +] class SecurityGroup(TypedDict, total=False): diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index f94270ee..347210d3 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -59,8 +59,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "profile_template_name": "profile_template_name", }, image_id="image_id", - name_templates=["my-bare-metal-{ip_octets}"], - names=["my-bare-metal"], + name="my-bare-metal", + name_template="name_template", password="password", ssh_key_name="my-ssh-key", tags={"foo": "my-tag-value"}, @@ -262,8 +262,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "profile_template_name": "profile_template_name", }, image_id="image_id", - name_templates=["my-bare-metal-{ip_octets}"], - names=["my-bare-metal"], + name="my-bare-metal", + name_template="name_template", password="password", ssh_key_name="my-ssh-key", tags={"foo": "my-tag-value"}, diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index 990299b0..179fe774 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -54,17 +54,12 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "type": "subnet", "floating_ip": {"source": "new"}, "interface_name": "interface_name", - "port_group": 0, - "security_groups": [{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], } ], name="my-gpu-cluster", instances_count=1, - password="password", ssh_key_name="my-ssh-key", tags={"foo": "my-tag-value"}, - user_data="user_data", - username="username", ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @@ -502,17 +497,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "type": "subnet", "floating_ip": {"source": "new"}, "interface_name": "interface_name", - "port_group": 0, - "security_groups": [{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], } ], name="my-gpu-cluster", instances_count=1, - password="password", ssh_key_name="my-ssh-key", tags={"foo": "my-tag-value"}, - user_data="user_data", - username="username", ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) diff --git a/tests/api_resources/cloud/test_instances.py b/tests/api_resources/cloud/test_instances.py index ecd2a577..c517c82b 100644 --- a/tests/api_resources/cloud/test_instances.py +++ b/tests/api_resources/cloud/test_instances.py @@ -31,7 +31,12 @@ def test_method_create(self, client: Gcore) -> None: region_id=1, flavor="g2-standard-32-64", interfaces=[{"type": "external"}], - volumes=[{"source": "image"}], + volumes=[ + { + "size": 20, + "source": "new-volume", + } + ], ) assert_matches_type(TaskIDList, instance, path=["response"]) @@ -46,30 +51,24 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "type": "external", "interface_name": "eth0", "ip_family": "ipv4", - "port_group": 0, "security_groups": [{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], } ], volumes=[ { - "source": "image", - "apptemplate_id": "grafana", - "attachment_tag": "root", - "boot_index": 0, + "size": 20, + "source": "new-volume", + "attachment_tag": "boot", "delete_on_termination": False, - "image_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", "name": "boot-volume", - "size": 10, - "snapshot_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", "tags": {"foo": "my-tag-value"}, "type_name": "ssd_hiiops", - "volume_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", } ], allow_app_ports=True, configuration={}, - name_templates=["my-instance-{ip_octets}"], - names=["my-instance"], + name="my-instance", + name_template="name_template", password="password", security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], servergroup_id="servergroup_id", @@ -87,7 +86,12 @@ def test_raw_response_create(self, client: Gcore) -> None: region_id=1, flavor="g2-standard-32-64", interfaces=[{"type": "external"}], - volumes=[{"source": "image"}], + volumes=[ + { + "size": 20, + "source": "new-volume", + } + ], ) assert response.is_closed is True @@ -102,7 +106,12 @@ def test_streaming_response_create(self, client: Gcore) -> None: region_id=1, flavor="g2-standard-32-64", interfaces=[{"type": "external"}], - volumes=[{"source": "image"}], + volumes=[ + { + "size": 20, + "source": "new-volume", + } + ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -883,7 +892,12 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: region_id=1, flavor="g2-standard-32-64", interfaces=[{"type": "external"}], - volumes=[{"source": "image"}], + volumes=[ + { + "size": 20, + "source": "new-volume", + } + ], ) assert_matches_type(TaskIDList, instance, path=["response"]) @@ -898,30 +912,24 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "type": "external", "interface_name": "eth0", "ip_family": "ipv4", - "port_group": 0, "security_groups": [{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], } ], volumes=[ { - "source": "image", - "apptemplate_id": "grafana", - "attachment_tag": "root", - "boot_index": 0, + "size": 20, + "source": "new-volume", + "attachment_tag": "boot", "delete_on_termination": False, - "image_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", "name": "boot-volume", - "size": 10, - "snapshot_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", "tags": {"foo": "my-tag-value"}, "type_name": "ssd_hiiops", - "volume_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", } ], allow_app_ports=True, configuration={}, - name_templates=["my-instance-{ip_octets}"], - names=["my-instance"], + name="my-instance", + name_template="name_template", password="password", security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], servergroup_id="servergroup_id", @@ -939,7 +947,12 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: region_id=1, flavor="g2-standard-32-64", interfaces=[{"type": "external"}], - volumes=[{"source": "image"}], + volumes=[ + { + "size": 20, + "source": "new-volume", + } + ], ) assert response.is_closed is True @@ -954,7 +967,12 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None region_id=1, flavor="g2-standard-32-64", interfaces=[{"type": "external"}], - volumes=[{"source": "image"}], + volumes=[ + { + "size": 20, + "source": "new-volume", + } + ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/cloud/test_volumes.py b/tests/api_resources/cloud/test_volumes.py index 0b57fe0b..0140c029 100644 --- a/tests/api_resources/cloud/test_volumes.py +++ b/tests/api_resources/cloud/test_volumes.py @@ -378,7 +378,7 @@ def test_method_attach_to_instance_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", - attachment_tag="root", + attachment_tag="boot", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -1025,7 +1025,7 @@ async def test_method_attach_to_instance_with_all_params(self, async_client: Asy project_id=1, region_id=1, instance_id="169942e0-9b53-42df-95ef-1a8b6525c2bd", - attachment_tag="root", + attachment_tag="boot", ) assert_matches_type(TaskIDList, volume, path=["response"]) From 90be775f42ed8b98c00a3404c2d58791a08b760c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 5 May 2025 14:07:52 +0000 Subject: [PATCH 099/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2311872e..83450bd7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7e9d94a10c2058cbb968b0e4bf424ed4121b9a261a8773b79ee55266e9c97a49.yml -openapi_spec_hash: 54d64209bdc34b2bd81e2344f77d29f8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-cea2a0dfb3c484310aed1f2294fb31f8e5417de25cdb4356dffc9effe8f88730.yml +openapi_spec_hash: 69b46ef0cb4385629b4f5e33ad70d5b6 config_hash: cc2ad74ed7a4ce98cbc5d7f6ccc53ffe From 8305d2a127e5819a269391be6fe44473b6865729 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 5 May 2025 17:14:06 +0000 Subject: [PATCH 100/592] fix(cloud): move and/or rename models --- .stats.yml | 2 +- api.md | 20 ++++++++------ .../resources/cloud/baremetal/servers.py | 6 ++--- .../cloud/file_shares/file_shares.py | 14 +++++----- src/gcore/resources/cloud/floating_ips.py | 6 ++--- .../gpu_baremetal_clusters.py | 24 ++++++++--------- .../cloud/gpu_baremetal_clusters/images.py | 6 ++--- .../cloud/gpu_baremetal_clusters/servers.py | 18 ++++++------- src/gcore/resources/cloud/instances/images.py | 14 +++++----- .../resources/cloud/instances/instances.py | 6 ++--- .../cloud/load_balancers/load_balancers.py | 6 ++--- .../resources/cloud/networks/networks.py | 6 ++--- src/gcore/resources/cloud/networks/subnets.py | 6 ++--- src/gcore/resources/cloud/volumes.py | 18 ++++++------- src/gcore/types/cloud/__init__.py | 6 ++--- .../cloud/baremetal/server_create_params.py | 4 +-- .../types/cloud/file_share_create_params.py | 6 ++--- .../types/cloud/floating_ip_create_params.py | 4 +-- .../types/cloud/gpu_baremetal_cluster.py | 4 +-- .../gpu_baremetal_cluster_create_params.py | 4 +-- ...ver.py => gpu_baremetal_cluster_server.py} | 11 ++++++-- ...y => gpu_baremetal_cluster_server_list.py} | 8 +++--- .../image_upload_params.py | 4 +-- .../types/cloud/instance_create_params.py | 14 +++++----- .../image_create_from_volume_params.py | 4 +-- .../cloud/instances/image_update_params.py | 4 +-- .../cloud/instances/image_upload_params.py | 4 +-- .../cloud/load_balancer_create_params.py | 4 +-- .../types/cloud/network_create_params.py | 4 +-- .../cloud/networks/subnet_create_params.py | 4 +-- ..._list_param.py => tag_update_map_param.py} | 4 +-- src/gcore/types/cloud/volume_create_params.py | 8 +++--- .../gpu_baremetal_clusters/test_servers.py | 26 +++++++++---------- .../cloud/test_gpu_baremetal_clusters.py | 26 +++++++++---------- 34 files changed, 158 insertions(+), 147 deletions(-) rename src/gcore/types/cloud/{gpu_cluster_server.py => gpu_baremetal_cluster_server.py} (95%) rename src/gcore/types/cloud/{gpu_cluster_server_list.py => gpu_baremetal_cluster_server_list.py} (50%) rename src/gcore/types/cloud/{tag_update_list_param.py => tag_update_map_param.py} (70%) diff --git a/.stats.yml b/.stats.yml index 83450bd7..4d649384 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-cea2a0dfb3c484310aed1f2294fb31f8e5417de25cdb4356dffc9effe8f88730.yml openapi_spec_hash: 69b46ef0cb4385629b4f5e33ad70d5b6 -config_hash: cc2ad74ed7a4ce98cbc5d7f6ccc53ffe +config_hash: 5e9b2fd8f350d7fc25a01b426572aace diff --git a/api.md b/api.md index e30690bc..306530eb 100644 --- a/api.md +++ b/api.md @@ -21,8 +21,6 @@ from gcore.types.cloud import ( FloatingAddress, FloatingIP, FloatingIPStatus, - GPUClusterServer, - GPUClusterServerList, GPUImage, GPUImageList, Image, @@ -52,7 +50,7 @@ from gcore.types.cloud import ( Subnet, Tag, TagList, - TagUpdateList, + TagUpdateMap, TaskIDList, ) ``` @@ -729,7 +727,13 @@ Methods: Types: ```python -from gcore.types.cloud import GPUBaremetalCluster, GPUBaremetalFlavor, GPUBaremetalFlavorList +from gcore.types.cloud import ( + GPUBaremetalCluster, + GPUBaremetalClusterServer, + GPUBaremetalClusterServerList, + GPUBaremetalFlavor, + GPUBaremetalFlavorList, +) ``` Methods: @@ -738,8 +742,8 @@ Methods: - client.cloud.gpu_baremetal_clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalCluster] - client.cloud.gpu_baremetal_clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.get(cluster_id, \*, project_id, region_id) -> GPUBaremetalCluster -- client.cloud.gpu_baremetal_clusters.powercycle_all_servers(cluster_id, \*, project_id, region_id) -> GPUClusterServerList -- client.cloud.gpu_baremetal_clusters.reboot_all_servers(cluster_id, \*, project_id, region_id) -> GPUClusterServerList +- client.cloud.gpu_baremetal_clusters.powercycle_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerList +- client.cloud.gpu_baremetal_clusters.reboot_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerList - client.cloud.gpu_baremetal_clusters.rebuild(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.resize(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList @@ -757,8 +761,8 @@ Methods: - client.cloud.gpu_baremetal_clusters.servers.attach_interface(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.servers.detach_interface(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.servers.get_console(instance_id, \*, project_id, region_id) -> Console -- client.cloud.gpu_baremetal_clusters.servers.powercycle(instance_id, \*, project_id, region_id) -> GPUClusterServer -- client.cloud.gpu_baremetal_clusters.servers.reboot(instance_id, \*, project_id, region_id) -> GPUClusterServer +- client.cloud.gpu_baremetal_clusters.servers.powercycle(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServer +- client.cloud.gpu_baremetal_clusters.servers.reboot(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServer ### Flavors diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index d5a02e12..041fc064 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -22,7 +22,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.baremetal import server_list_params, server_create_params, server_rebuild_params from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.tag_update_list_param import TagUpdateListParam +from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.baremetal.baremetal_server import BaremetalServer __all__ = ["ServersResource", "AsyncServersResource"] @@ -63,7 +63,7 @@ def create( name_template: str | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -423,7 +423,7 @@ async def create( name_template: str | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index e6f464d9..59b7ed3c 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -35,7 +35,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.file_share import FileShare from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.tag_update_list_param import TagUpdateListParam +from ....types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["FileSharesResource", "AsyncFileSharesResource"] @@ -75,7 +75,7 @@ def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -130,7 +130,7 @@ def create( protocol: Literal["NFS"], size: int, volume_type: Literal["vast_share_type"], - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -181,7 +181,7 @@ def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -496,7 +496,7 @@ async def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -551,7 +551,7 @@ async def create( protocol: Literal["NFS"], size: int, volume_type: Literal["vast_share_type"], - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -602,7 +602,7 @@ async def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index f2873e30..bcb00f11 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -22,7 +22,7 @@ from ...types.cloud.floating_ip import FloatingIP from ...types.cloud.task_id_list import TaskIDList from ...types.cloud.floating_ip_detailed import FloatingIPDetailed -from ...types.cloud.tag_update_list_param import TagUpdateListParam +from ...types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["FloatingIPsResource", "AsyncFloatingIPsResource"] @@ -54,7 +54,7 @@ def create( region_id: int | None = None, fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, port_id: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -375,7 +375,7 @@ async def create( region_id: int | None = None, fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, port_id: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 1ca9af6d..230e525b 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -58,9 +58,9 @@ ) from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.gpu_baremetal_cluster import GPUBaremetalCluster -from ....types.cloud.tag_update_list_param import TagUpdateListParam -from ....types.cloud.gpu_cluster_server_list import GPUClusterServerList +from ....types.cloud.gpu_baremetal_cluster_server_list import GPUBaremetalClusterServerList __all__ = ["GPUBaremetalClustersResource", "AsyncGPUBaremetalClustersResource"] @@ -112,7 +112,7 @@ def create( name: str, instances_count: int | NotGiven = NOT_GIVEN, ssh_key_name: str | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -341,7 +341,7 @@ def powercycle_all_servers( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUClusterServerList: + ) -> GPUBaremetalClusterServerList: """ Stops and then starts all cluster servers, effectively performing a hard reboot. @@ -365,7 +365,7 @@ def powercycle_all_servers( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUClusterServerList, + cast_to=GPUBaremetalClusterServerList, ) def reboot_all_servers( @@ -380,7 +380,7 @@ def reboot_all_servers( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUClusterServerList: + ) -> GPUBaremetalClusterServerList: """ Reboot all bare metal GPU cluster servers @@ -404,7 +404,7 @@ def reboot_all_servers( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUClusterServerList, + cast_to=GPUBaremetalClusterServerList, ) def rebuild( @@ -559,7 +559,7 @@ async def create( name: str, instances_count: int | NotGiven = NOT_GIVEN, ssh_key_name: str | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -788,7 +788,7 @@ async def powercycle_all_servers( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUClusterServerList: + ) -> GPUBaremetalClusterServerList: """ Stops and then starts all cluster servers, effectively performing a hard reboot. @@ -812,7 +812,7 @@ async def powercycle_all_servers( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUClusterServerList, + cast_to=GPUBaremetalClusterServerList, ) async def reboot_all_servers( @@ -827,7 +827,7 @@ async def reboot_all_servers( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUClusterServerList: + ) -> GPUBaremetalClusterServerList: """ Reboot all bare metal GPU cluster servers @@ -851,7 +851,7 @@ async def reboot_all_servers( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUClusterServerList, + cast_to=GPUBaremetalClusterServerList, ) async def rebuild( diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index a21e19ca..2145f7c7 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -21,7 +21,7 @@ from ....types.cloud.gpu_image import GPUImage from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.gpu_image_list import GPUImageList -from ....types.cloud.tag_update_list_param import TagUpdateListParam +from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.gpu_baremetal_clusters import image_upload_params __all__ = ["ImagesResource", "AsyncImagesResource"] @@ -191,7 +191,7 @@ def upload( os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -432,7 +432,7 @@ async def upload( os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 4ff3ea55..9243f9d2 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -20,12 +20,12 @@ from ...._base_client import make_request_options from ....types.cloud.console import Console from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.gpu_cluster_server import GPUClusterServer from ....types.cloud.gpu_baremetal_clusters import ( server_delete_params, server_attach_interface_params, server_detach_interface_params, ) +from ....types.cloud.gpu_baremetal_cluster_server import GPUBaremetalClusterServer __all__ = ["ServersResource", "AsyncServersResource"] @@ -448,7 +448,7 @@ def powercycle( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUClusterServer: + ) -> GPUBaremetalClusterServer: """ Stops and then starts the server, effectively performing a hard reboot. @@ -472,7 +472,7 @@ def powercycle( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUClusterServer, + cast_to=GPUBaremetalClusterServer, ) def reboot( @@ -487,7 +487,7 @@ def reboot( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUClusterServer: + ) -> GPUBaremetalClusterServer: """ Reboot one bare metal GPU cluster server @@ -511,7 +511,7 @@ def reboot( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUClusterServer, + cast_to=GPUBaremetalClusterServer, ) @@ -935,7 +935,7 @@ async def powercycle( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUClusterServer: + ) -> GPUBaremetalClusterServer: """ Stops and then starts the server, effectively performing a hard reboot. @@ -959,7 +959,7 @@ async def powercycle( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUClusterServer, + cast_to=GPUBaremetalClusterServer, ) async def reboot( @@ -974,7 +974,7 @@ async def reboot( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUClusterServer: + ) -> GPUBaremetalClusterServer: """ Reboot one bare metal GPU cluster server @@ -998,7 +998,7 @@ async def reboot( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUClusterServer, + cast_to=GPUBaremetalClusterServer, ) diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index a627e99a..1346c46e 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -28,7 +28,7 @@ ) from ....types.cloud.image_list import ImageList from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.tag_update_list_param import TagUpdateListParam +from ....types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["ImagesResource", "AsyncImagesResource"] @@ -65,7 +65,7 @@ def update( name: str | NotGiven = NOT_GIVEN, os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -250,7 +250,7 @@ def create_from_volume( os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, source: Literal["volume"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -383,7 +383,7 @@ def upload( os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -494,7 +494,7 @@ async def update( name: str | NotGiven = NOT_GIVEN, os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -679,7 +679,7 @@ async def create_from_volume( os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, source: Literal["volume"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -812,7 +812,7 @@ async def upload( os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index de68c38f..b787482e 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -68,7 +68,7 @@ from ....types.cloud.instance import Instance from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.instance_interface import InstanceInterface -from ....types.cloud.tag_update_list_param import TagUpdateListParam +from ....types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["InstancesResource", "AsyncInstancesResource"] @@ -125,7 +125,7 @@ def create( security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, servergroup_id: str | NotGiven = NOT_GIVEN, ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1135,7 +1135,7 @@ async def create( security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, servergroup_id: str | NotGiven = NOT_GIVEN, ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index e6640e0b..f8f504ef 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -79,7 +79,7 @@ from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.load_balancer import LoadBalancer from ....types.cloud.interface_ip_family import InterfaceIPFamily -from ....types.cloud.tag_update_list_param import TagUpdateListParam +from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.load_balancer_member_connectivity import LoadBalancerMemberConnectivity __all__ = ["LoadBalancersResource", "AsyncLoadBalancersResource"] @@ -141,7 +141,7 @@ def create( name: str | NotGiven = NOT_GIVEN, name_template: str | NotGiven = NOT_GIVEN, preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, vip_network_id: str | NotGiven = NOT_GIVEN, vip_port_id: str | NotGiven = NOT_GIVEN, @@ -614,7 +614,7 @@ async def create( name: str | NotGiven = NOT_GIVEN, name_template: str | NotGiven = NOT_GIVEN, preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, vip_network_id: str | NotGiven = NOT_GIVEN, vip_port_id: str | NotGiven = NOT_GIVEN, diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 592d4ec5..ee5f0a04 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -38,7 +38,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.network import Network from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.tag_update_list_param import TagUpdateListParam +from ....types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["NetworksResource", "AsyncNetworksResource"] @@ -78,7 +78,7 @@ def create( region_id: int | None = None, name: str, create_router: bool | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -356,7 +356,7 @@ async def create( region_id: int | None = None, name: str, create_router: bool | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 4097dcd3..a6891b54 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -24,7 +24,7 @@ from ....types.cloud.networks import subnet_list_params, subnet_create_params, subnet_update_params from ....types.cloud.ip_version import IPVersion from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.tag_update_list_param import TagUpdateListParam +from ....types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["SubnetsResource", "AsyncSubnetsResource"] @@ -64,7 +64,7 @@ def create( host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -440,7 +440,7 @@ async def create( host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index a228ccff..28522f6d 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -31,7 +31,7 @@ from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.volume import Volume from ...types.cloud.task_id_list import TaskIDList -from ...types.cloud.tag_update_list_param import TagUpdateListParam +from ...types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["VolumesResource", "AsyncVolumesResource"] @@ -69,7 +69,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -135,7 +135,7 @@ def create( instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -201,7 +201,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -267,7 +267,7 @@ def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, snapshot_id: str | NotGiven = NOT_GIVEN, @@ -833,7 +833,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -899,7 +899,7 @@ async def create( instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -965,7 +965,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1031,7 +1031,7 @@ async def create( attachment_tag: str | NotGiven = NOT_GIVEN, instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateListParam | NotGiven = NOT_GIVEN, + tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | NotGiven = NOT_GIVEN, snapshot_id: str | NotGiven = NOT_GIVEN, diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 3beade2e..c3316c8c 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -69,7 +69,6 @@ from .aws_iam_data_param import AwsIamDataParam as AwsIamDataParam from .ddos_profile_field import DDOSProfileField as DDOSProfileField from .floating_ip_status import FloatingIPStatus as FloatingIPStatus -from .gpu_cluster_server import GPUClusterServer as GPUClusterServer from .ingress_opts_param import IngressOptsParam as IngressOptsParam from .instance_interface import InstanceInterface as InstanceInterface from .instance_isolation import InstanceIsolation as InstanceIsolation @@ -96,6 +95,7 @@ from .region_capacity_list import RegionCapacityList as RegionCapacityList from .secret_create_params import SecretCreateParams as SecretCreateParams from .secret_list_response import SecretListResponse as SecretListResponse +from .tag_update_map_param import TagUpdateMapParam as TagUpdateMapParam from .volume_create_params import VolumeCreateParams as VolumeCreateParams from .volume_delete_params import VolumeDeleteParams as VolumeDeleteParams from .volume_resize_params import VolumeResizeParams as VolumeResizeParams @@ -111,7 +111,6 @@ from .project_create_params import ProjectCreateParams as ProjectCreateParams from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams -from .tag_update_list_param import TagUpdateListParam as TagUpdateListParam from .container_probe_config import ContainerProbeConfig as ContainerProbeConfig from .file_share_list_params import FileShareListParams as FileShareListParams from .instance_action_params import InstanceActionParams as InstanceActionParams @@ -127,7 +126,6 @@ from .registry_resize_params import RegistryResizeParams as RegistryResizeParams from .detailed_lb_pool_member import DetailedLbPoolMember as DetailedLbPoolMember from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams -from .gpu_cluster_server_list import GPUClusterServerList as GPUClusterServerList from .container_probe_http_get import ContainerProbeHTTPGet as ContainerProbeHTTPGet from .container_scale_triggers import ContainerScaleTriggers as ContainerScaleTriggers from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList @@ -161,6 +159,7 @@ from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .container_probe_create_param import ContainerProbeCreateParam as ContainerProbeCreateParam from .container_scale_trigger_rate import ContainerScaleTriggerRate as ContainerScaleTriggerRate +from .gpu_baremetal_cluster_server import GPUBaremetalClusterServer as GPUBaremetalClusterServer from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams @@ -174,6 +173,7 @@ from .container_probe_exec_create_param import ContainerProbeExecCreateParam as ContainerProbeExecCreateParam from .container_scale_trigger_threshold import ContainerScaleTriggerThreshold as ContainerScaleTriggerThreshold from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams +from .gpu_baremetal_cluster_server_list import GPUBaremetalClusterServerList as GPUBaremetalClusterServerList from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index a766cded..47b7053b 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -6,7 +6,7 @@ from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..interface_ip_family import InterfaceIPFamily -from ..tag_update_list_param import TagUpdateListParam +from ..tag_update_map_param import TagUpdateMapParam __all__ = [ "ServerCreateParams", @@ -88,7 +88,7 @@ class ServerCreateParams(TypedDict, total=False): /v1/ssh_keys endpoint. """ - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index efa9dc40..02fe341b 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -5,7 +5,7 @@ from typing import Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .tag_update_list_param import TagUpdateListParam +from .tag_update_map_param import TagUpdateMapParam __all__ = [ "FileShareCreateParams", @@ -38,7 +38,7 @@ class CreateStandardFileShareSerializer(TypedDict, total=False): access: Iterable[CreateStandardFileShareSerializerAccess] """Access Rules""" - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -90,7 +90,7 @@ class CreateVastFileShareSerializer(TypedDict, total=False): volume_type: Required[Literal["vast_share_type"]] """File share volume type""" - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/floating_ip_create_params.py b/src/gcore/types/cloud/floating_ip_create_params.py index a872ea64..06936bd7 100644 --- a/src/gcore/types/cloud/floating_ip_create_params.py +++ b/src/gcore/types/cloud/floating_ip_create_params.py @@ -5,7 +5,7 @@ from typing import Optional from typing_extensions import TypedDict -from .tag_update_list_param import TagUpdateListParam +from .tag_update_map_param import TagUpdateMapParam __all__ = ["FloatingIPCreateParams"] @@ -29,7 +29,7 @@ class FloatingIPCreateParams(TypedDict, total=False): If provided, the floating IP will be immediately attached to the specified port. """ - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal_cluster.py index dce0f0cb..95be387c 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster.py @@ -5,7 +5,7 @@ from .tag import Tag from ..._models import BaseModel -from .gpu_cluster_server import GPUClusterServer +from .gpu_baremetal_cluster_server import GPUBaremetalClusterServer __all__ = ["GPUBaremetalCluster", "Interface"] @@ -68,7 +68,7 @@ class GPUBaremetalCluster(BaseModel): region_id: int """Region ID""" - servers: List[GPUClusterServer] + servers: List[GPUBaremetalClusterServer] """GPU cluster servers""" ssh_key_name: Optional[str] = None 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 0a9b2bd9..8d824389 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -6,7 +6,7 @@ from typing_extensions import Literal, Required, TypeAlias, TypedDict from .interface_ip_family import InterfaceIPFamily -from .tag_update_list_param import TagUpdateListParam +from .tag_update_map_param import TagUpdateMapParam __all__ = [ "GPUBaremetalClusterCreateParams", @@ -48,7 +48,7 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): /v1/ssh_keys endpoint. """ - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/gpu_cluster_server.py b/src/gcore/types/cloud/gpu_baremetal_cluster_server.py similarity index 95% rename from src/gcore/types/cloud/gpu_cluster_server.py rename to src/gcore/types/cloud/gpu_baremetal_cluster_server.py index 9e466000..beafd69c 100644 --- a/src/gcore/types/cloud/gpu_cluster_server.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_server.py @@ -13,7 +13,14 @@ from .instance_isolation import InstanceIsolation from .fixed_address_short import FixedAddressShort -__all__ = ["GPUClusterServer", "Address", "FixedIPAssignment", "Flavor", "FlavorHardwareDescription", "SecurityGroup"] +__all__ = [ + "GPUBaremetalClusterServer", + "Address", + "FixedIPAssignment", + "Flavor", + "FlavorHardwareDescription", + "SecurityGroup", +] Address: TypeAlias = Union[FloatingAddress, FixedAddressShort, FixedAddress] @@ -80,7 +87,7 @@ class SecurityGroup(BaseModel): """Name.""" -class GPUClusterServer(BaseModel): +class GPUBaremetalClusterServer(BaseModel): id: str """GPU server ID""" diff --git a/src/gcore/types/cloud/gpu_cluster_server_list.py b/src/gcore/types/cloud/gpu_baremetal_cluster_server_list.py similarity index 50% rename from src/gcore/types/cloud/gpu_cluster_server_list.py rename to src/gcore/types/cloud/gpu_baremetal_cluster_server_list.py index 21dd43f9..01c531f5 100644 --- a/src/gcore/types/cloud/gpu_cluster_server_list.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_server_list.py @@ -3,14 +3,14 @@ from typing import List from ..._models import BaseModel -from .gpu_cluster_server import GPUClusterServer +from .gpu_baremetal_cluster_server import GPUBaremetalClusterServer -__all__ = ["GPUClusterServerList"] +__all__ = ["GPUBaremetalClusterServerList"] -class GPUClusterServerList(BaseModel): +class GPUBaremetalClusterServerList(BaseModel): count: int """Number of objects""" - results: List[GPUClusterServer] + results: List[GPUBaremetalClusterServer] """Objects""" diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py index 18ebd4c7..1cbd786a 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py @@ -5,7 +5,7 @@ from typing import Optional from typing_extensions import Literal, Required, TypedDict -from ..tag_update_list_param import TagUpdateListParam +from ..tag_update_map_param import TagUpdateMapParam __all__ = ["ImageUploadParams"] @@ -47,7 +47,7 @@ class ImageUploadParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Permission to use a ssh key in instances""" - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index bf6bde4b..a929377a 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -6,7 +6,7 @@ from typing_extensions import Literal, Required, TypeAlias, TypedDict from .interface_ip_family import InterfaceIPFamily -from .tag_update_list_param import TagUpdateListParam +from .tag_update_map_param import TagUpdateMapParam __all__ = [ "InstanceCreateParams", @@ -115,7 +115,7 @@ class InstanceCreateParams(TypedDict, total=False): /v1/ssh_keys endpoint. """ - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -391,7 +391,7 @@ class VolumeCreateInstanceCreateNewVolumeSerializer(TypedDict, total=False): If not specified, a name will be generated automatically. """ - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -452,7 +452,7 @@ class VolumeCreateInstanceCreateVolumeFromImageSerializer(TypedDict, total=False - For basic VMs: the size is set automatically based on the flavor. """ - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -506,7 +506,7 @@ class VolumeCreateInstanceCreateVolumeFromSnapshotSerializer(TypedDict, total=Fa If not specified, a name will be generated automatically. """ - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -552,7 +552,7 @@ class VolumeCreateInstanceCreateVolumeFromApptemplateSerializer(TypedDict, total size: int """Volume size in GiB.""" - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -597,7 +597,7 @@ class VolumeCreateInstanceExistingVolumeSerializer(TypedDict, total=False): delete_on_termination: bool """Set to `true` to automatically delete the volume when the instance is deleted.""" - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instances/image_create_from_volume_params.py b/src/gcore/types/cloud/instances/image_create_from_volume_params.py index 7cd61603..358a4a7d 100644 --- a/src/gcore/types/cloud/instances/image_create_from_volume_params.py +++ b/src/gcore/types/cloud/instances/image_create_from_volume_params.py @@ -5,7 +5,7 @@ from typing import Optional from typing_extensions import Literal, Required, TypedDict -from ..tag_update_list_param import TagUpdateListParam +from ..tag_update_map_param import TagUpdateMapParam __all__ = ["ImageCreateFromVolumeParams"] @@ -42,7 +42,7 @@ class ImageCreateFromVolumeParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Whether the image supports SSH key or not""" - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instances/image_update_params.py b/src/gcore/types/cloud/instances/image_update_params.py index c7828260..6676110f 100644 --- a/src/gcore/types/cloud/instances/image_update_params.py +++ b/src/gcore/types/cloud/instances/image_update_params.py @@ -4,7 +4,7 @@ from typing_extensions import Literal, TypedDict -from ..tag_update_list_param import TagUpdateListParam +from ..tag_update_map_param import TagUpdateMapParam __all__ = ["ImageUpdateParams"] @@ -32,7 +32,7 @@ class ImageUpdateParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Whether the image supports SSH key or not""" - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instances/image_upload_params.py b/src/gcore/types/cloud/instances/image_upload_params.py index c3d511b1..7a278c91 100644 --- a/src/gcore/types/cloud/instances/image_upload_params.py +++ b/src/gcore/types/cloud/instances/image_upload_params.py @@ -5,7 +5,7 @@ from typing import Optional from typing_extensions import Literal, Required, TypedDict -from ..tag_update_list_param import TagUpdateListParam +from ..tag_update_map_param import TagUpdateMapParam __all__ = ["ImageUploadParams"] @@ -51,7 +51,7 @@ class ImageUploadParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Whether the image supports SSH key or not""" - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 2e9e9533..f74019f9 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -11,7 +11,7 @@ from .health_monitor_type import HealthMonitorType from .interface_ip_family import InterfaceIPFamily from .lb_listener_protocol import LbListenerProtocol -from .tag_update_list_param import TagUpdateListParam +from .tag_update_map_param import TagUpdateMapParam from .session_persistence_type import SessionPersistenceType from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity @@ -65,7 +65,7 @@ class LoadBalancerCreateParams(TypedDict, total=False): because we're considering this as intentional subnet_id specification. """ - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/network_create_params.py b/src/gcore/types/cloud/network_create_params.py index c695747a..a406792a 100644 --- a/src/gcore/types/cloud/network_create_params.py +++ b/src/gcore/types/cloud/network_create_params.py @@ -4,7 +4,7 @@ from typing_extensions import Literal, Required, TypedDict -from .tag_update_list_param import TagUpdateListParam +from .tag_update_map_param import TagUpdateMapParam __all__ = ["NetworkCreateParams"] @@ -20,7 +20,7 @@ class NetworkCreateParams(TypedDict, total=False): create_router: bool """Defaults to True""" - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index 80e8c31e..ca25a006 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -6,7 +6,7 @@ from typing_extensions import Required, TypedDict from ..ip_version import IPVersion -from ..tag_update_list_param import TagUpdateListParam +from ..tag_update_map_param import TagUpdateMapParam __all__ = ["SubnetCreateParams", "HostRoute"] @@ -60,7 +60,7 @@ class SubnetCreateParams(TypedDict, total=False): find a router created during network creation. """ - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/tag_update_list_param.py b/src/gcore/types/cloud/tag_update_map_param.py similarity index 70% rename from src/gcore/types/cloud/tag_update_list_param.py rename to src/gcore/types/cloud/tag_update_map_param.py index 0479c357..a1eff214 100644 --- a/src/gcore/types/cloud/tag_update_list_param.py +++ b/src/gcore/types/cloud/tag_update_map_param.py @@ -5,6 +5,6 @@ from typing import Dict from typing_extensions import TypeAlias -__all__ = ["TagUpdateListParam"] +__all__ = ["TagUpdateMapParam"] -TagUpdateListParam: TypeAlias = Dict[str, str] +TagUpdateMapParam: TypeAlias = Dict[str, str] diff --git a/src/gcore/types/cloud/volume_create_params.py b/src/gcore/types/cloud/volume_create_params.py index d53d2c6a..464a9318 100644 --- a/src/gcore/types/cloud/volume_create_params.py +++ b/src/gcore/types/cloud/volume_create_params.py @@ -5,7 +5,7 @@ from typing import Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .tag_update_list_param import TagUpdateListParam +from .tag_update_map_param import TagUpdateMapParam __all__ = [ "VolumeCreateParams", @@ -49,7 +49,7 @@ class CreateVolumeFromImageSerializer(TypedDict, total=False): volume """ - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -104,7 +104,7 @@ class CreateVolumeFromSnapshotSerializer(TypedDict, total=False): If specified, value must be equal to respective snapshot size """ - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -153,7 +153,7 @@ class CreateNewVolumeSerializer(TypedDict, total=False): volume """ - tags: TagUpdateListParam + tags: TagUpdateMapParam """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py index f754ae5e..2063267b 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import Console, TaskIDList, GPUClusterServer +from gcore.types.cloud import Console, TaskIDList, GPUBaremetalClusterServer base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -506,7 +506,7 @@ def test_method_powercycle(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(GPUClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) @parametrize def test_raw_response_powercycle(self, client: Gcore) -> None: @@ -519,7 +519,7 @@ def test_raw_response_powercycle(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = response.parse() - assert_matches_type(GPUClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) @parametrize def test_streaming_response_powercycle(self, client: Gcore) -> None: @@ -532,7 +532,7 @@ def test_streaming_response_powercycle(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = response.parse() - assert_matches_type(GPUClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) assert cast(Any, response.is_closed) is True @@ -552,7 +552,7 @@ def test_method_reboot(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(GPUClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) @parametrize def test_raw_response_reboot(self, client: Gcore) -> None: @@ -565,7 +565,7 @@ def test_raw_response_reboot(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = response.parse() - assert_matches_type(GPUClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) @parametrize def test_streaming_response_reboot(self, client: Gcore) -> None: @@ -578,7 +578,7 @@ def test_streaming_response_reboot(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = response.parse() - assert_matches_type(GPUClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1084,7 +1084,7 @@ async def test_method_powercycle(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(GPUClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) @parametrize async def test_raw_response_powercycle(self, async_client: AsyncGcore) -> None: @@ -1097,7 +1097,7 @@ async def test_raw_response_powercycle(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = await response.parse() - assert_matches_type(GPUClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) @parametrize async def test_streaming_response_powercycle(self, async_client: AsyncGcore) -> None: @@ -1110,7 +1110,7 @@ async def test_streaming_response_powercycle(self, async_client: AsyncGcore) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = await response.parse() - assert_matches_type(GPUClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1130,7 +1130,7 @@ async def test_method_reboot(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(GPUClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) @parametrize async def test_raw_response_reboot(self, async_client: AsyncGcore) -> None: @@ -1143,7 +1143,7 @@ async def test_raw_response_reboot(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = await response.parse() - assert_matches_type(GPUClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) @parametrize async def test_streaming_response_reboot(self, async_client: AsyncGcore) -> None: @@ -1156,7 +1156,7 @@ async def test_streaming_response_reboot(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = await response.parse() - assert_matches_type(GPUClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index 179fe774..b6204482 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -13,7 +13,7 @@ from gcore.types.cloud import ( TaskIDList, GPUBaremetalCluster, - GPUClusterServerList, + GPUBaremetalClusterServerList, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -264,7 +264,7 @@ def test_method_powercycle_all_servers(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) @parametrize def test_raw_response_powercycle_all_servers(self, client: Gcore) -> None: @@ -277,7 +277,7 @@ def test_raw_response_powercycle_all_servers(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) @parametrize def test_streaming_response_powercycle_all_servers(self, client: Gcore) -> None: @@ -290,7 +290,7 @@ def test_streaming_response_powercycle_all_servers(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -310,7 +310,7 @@ def test_method_reboot_all_servers(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) @parametrize def test_raw_response_reboot_all_servers(self, client: Gcore) -> None: @@ -323,7 +323,7 @@ def test_raw_response_reboot_all_servers(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) @parametrize def test_streaming_response_reboot_all_servers(self, client: Gcore) -> None: @@ -336,7 +336,7 @@ def test_streaming_response_reboot_all_servers(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -707,7 +707,7 @@ async def test_method_powercycle_all_servers(self, async_client: AsyncGcore) -> project_id=0, region_id=0, ) - assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_raw_response_powercycle_all_servers(self, async_client: AsyncGcore) -> None: @@ -720,7 +720,7 @@ async def test_raw_response_powercycle_all_servers(self, async_client: AsyncGcor assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_streaming_response_powercycle_all_servers(self, async_client: AsyncGcore) -> None: @@ -733,7 +733,7 @@ async def test_streaming_response_powercycle_all_servers(self, async_client: Asy assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -753,7 +753,7 @@ async def test_method_reboot_all_servers(self, async_client: AsyncGcore) -> None project_id=0, region_id=0, ) - assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_raw_response_reboot_all_servers(self, async_client: AsyncGcore) -> None: @@ -766,7 +766,7 @@ async def test_raw_response_reboot_all_servers(self, async_client: AsyncGcore) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_streaming_response_reboot_all_servers(self, async_client: AsyncGcore) -> None: @@ -779,7 +779,7 @@ async def test_streaming_response_reboot_all_servers(self, async_client: AsyncGc assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True From ceb2b6b11c87fb4bad4b2c704a62ba4b80182704 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 12:00:02 +0000 Subject: [PATCH 101/592] feat: changes for loadbalancers-renaming --- .stats.yml | 2 +- api.md | 55 ++++++++++--------- .../resources/cloud/load_balancers/flavors.py | 10 ++-- .../load_balancers/l7_policies/l7_policies.py | 20 +++---- .../cloud/load_balancers/l7_policies/rules.py | 20 +++---- .../cloud/load_balancers/listeners.py | 20 +++---- .../resources/cloud/load_balancers/metrics.py | 10 ++-- .../load_balancers/pools/health_monitors.py | 8 +-- .../cloud/load_balancers/pools/pools.py | 20 +++---- src/gcore/types/cloud/__init__.py | 33 +++++------ ...lb_health_monitor.py => health_monitor.py} | 8 +-- .../types/cloud/health_monitor_status.py | 4 +- src/gcore/types/cloud/health_monitor_type.py | 7 --- .../types/cloud/lb_health_monitor_type.py | 7 +++ ...type.py => lb_session_persistence_type.py} | 4 +- .../cloud/load_balancer_create_params.py | 8 +-- ...list.py => load_balancer_flavor_detail.py} | 18 ++---- ...r_list.py => load_balancer_flavor_list.py} | 8 +-- ...7_policy.py => load_balancer_l7_policy.py} | 8 +-- ...ist.py => load_balancer_l7_policy_list.py} | 8 +-- .../{l7_rule.py => load_balancer_l7_rule.py} | 4 +- ..._list.py => load_balancer_l7_rule_list.py} | 8 +-- ...er.py => load_balancer_listener_detail.py} | 4 +- .../cloud/load_balancer_listener_list.py | 16 ++++++ ...er_metrics.py => load_balancer_metrics.py} | 4 +- ..._list.py => load_balancer_metrics_list.py} | 8 +-- ...ailed_lb_pool.py => load_balancer_pool.py} | 16 +++--- ...ool_list.py => load_balancer_pool_list.py} | 8 +-- .../load_balancers/pool_create_params.py | 8 +-- .../load_balancers/pool_update_params.py | 8 +-- .../pools/health_monitor_create_params.py | 4 +- .../{detailed_lb_pool_member.py => member.py} | 4 +- ..._persistence.py => session_persistence.py} | 8 +-- .../load_balancers/l7_policies/test_rules.py | 26 ++++----- .../cloud/load_balancers/test_flavors.py | 18 +++--- .../cloud/load_balancers/test_l7_policies.py | 26 ++++----- .../cloud/load_balancers/test_listeners.py | 34 ++++++------ .../cloud/load_balancers/test_metrics.py | 14 ++--- .../cloud/load_balancers/test_pools.py | 30 +++++----- 39 files changed, 268 insertions(+), 258 deletions(-) rename src/gcore/types/cloud/{lb_health_monitor.py => health_monitor.py} (89%) delete mode 100644 src/gcore/types/cloud/health_monitor_type.py create mode 100644 src/gcore/types/cloud/lb_health_monitor_type.py rename src/gcore/types/cloud/{session_persistence_type.py => lb_session_persistence_type.py} (52%) rename src/gcore/types/cloud/{lb_flavor_list.py => load_balancer_flavor_detail.py} (72%) rename src/gcore/types/cloud/{lb_listener_list.py => load_balancer_flavor_list.py} (52%) rename src/gcore/types/cloud/{l7_policy.py => load_balancer_l7_policy.py} (93%) rename src/gcore/types/cloud/{l7_rule_list.py => load_balancer_l7_policy_list.py} (54%) rename src/gcore/types/cloud/{l7_rule.py => load_balancer_l7_rule.py} (96%) rename src/gcore/types/cloud/{l7_policy_list.py => load_balancer_l7_rule_list.py} (55%) rename src/gcore/types/cloud/{lb_listener.py => load_balancer_listener_detail.py} (96%) create mode 100644 src/gcore/types/cloud/load_balancer_listener_list.py rename src/gcore/types/cloud/{loadbalancer_metrics.py => load_balancer_metrics.py} (92%) rename src/gcore/types/cloud/{loadbalancer_metrics_list.py => load_balancer_metrics_list.py} (54%) rename src/gcore/types/cloud/{detailed_lb_pool.py => load_balancer_pool.py} (83%) rename src/gcore/types/cloud/{detailed_lb_pool_list.py => load_balancer_pool_list.py} (56%) rename src/gcore/types/cloud/{detailed_lb_pool_member.py => member.py} (94%) rename src/gcore/types/cloud/{lb_session_persistence.py => session_persistence.py} (74%) diff --git a/.stats.yml b/.stats.yml index 4d649384..d82143ef 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-cea2a0dfb3c484310aed1f2294fb31f8e5417de25cdb4356dffc9effe8f88730.yml openapi_spec_hash: 69b46ef0cb4385629b4f5e33ad70d5b6 -config_hash: 5e9b2fd8f350d7fc25a01b426572aace +config_hash: bb44a58411de4cc3c5dce1aa9bd40392 diff --git a/api.md b/api.md index 306530eb..e907e6d7 100644 --- a/api.md +++ b/api.md @@ -23,6 +23,7 @@ from gcore.types.cloud import ( FloatingIPStatus, GPUImage, GPUImageList, + HTTPMethod, Image, ImageList, Instance, @@ -178,32 +179,32 @@ Types: ```python from gcore.types.cloud import ( - DetailedLbPool, - DetailedLbPoolList, - DetailedLbPoolMember, + HealthMonitor, HealthMonitorStatus, - HealthMonitorType, - HTTPMethod, - L7Policy, - L7PolicyList, - L7Rule, - L7RuleList, LbAlgorithm, - LbFlavorList, - LbHealthMonitor, - LbListener, - LbListenerList, + LbHealthMonitorType, LbListenerProtocol, LbPoolProtocol, - LbSessionPersistence, + LbSessionPersistenceType, ListenerStatus, + LoadBalancerFlavorDetail, + LoadBalancerFlavorList, + LoadBalancerL7Policy, + LoadBalancerL7PolicyList, + LoadBalancerL7Rule, + LoadBalancerL7RuleList, + LoadBalancerListenerDetail, + LoadBalancerListenerList, + LoadBalancerMetrics, + LoadBalancerMetricsList, + LoadBalancerPool, + LoadBalancerPoolList, LoadBalancerStatus, LoadBalancerStatusList, - LoadbalancerMetrics, - LoadbalancerMetricsList, + Member, MemberStatus, PoolStatus, - SessionPersistenceType, + SessionPersistence, ) ``` @@ -222,9 +223,9 @@ Methods: Methods: - client.cloud.load_balancers.l7_policies.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.l7_policies.list(\*, project_id, region_id) -> L7PolicyList +- 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) -> L7Policy +- 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 @@ -232,16 +233,16 @@ Methods: Methods: - client.cloud.load_balancers.l7_policies.rules.create(l7policy_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.l7_policies.rules.list(l7policy_id, \*, project_id, region_id) -> L7RuleList +- client.cloud.load_balancers.l7_policies.rules.list(l7policy_id, \*, project_id, region_id) -> LoadBalancerL7RuleList - client.cloud.load_balancers.l7_policies.rules.delete(l7rule_id, \*, project_id, region_id, l7policy_id) -> TaskIDList -- client.cloud.load_balancers.l7_policies.rules.get(l7rule_id, \*, project_id, region_id, l7policy_id) -> L7Rule +- client.cloud.load_balancers.l7_policies.rules.get(l7rule_id, \*, project_id, region_id, l7policy_id) -> LoadBalancerL7Rule - client.cloud.load_balancers.l7_policies.rules.replace(l7rule_id, \*, project_id, region_id, l7policy_id, \*\*params) -> TaskIDList ### Flavors Methods: -- client.cloud.load_balancers.flavors.list(\*, project_id, region_id, \*\*params) -> LbFlavorList +- client.cloud.load_balancers.flavors.list(\*, project_id, region_id, \*\*params) -> LoadBalancerFlavorList ### Listeners @@ -249,9 +250,9 @@ Methods: - client.cloud.load_balancers.listeners.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.listeners.update(listener_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.listeners.list(\*, project_id, region_id, \*\*params) -> LbListenerList +- client.cloud.load_balancers.listeners.list(\*, project_id, region_id, \*\*params) -> LoadBalancerListenerList - client.cloud.load_balancers.listeners.delete(listener_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.load_balancers.listeners.get(listener_id, \*, project_id, region_id, \*\*params) -> LbListener +- client.cloud.load_balancers.listeners.get(listener_id, \*, project_id, region_id, \*\*params) -> LoadBalancerListenerDetail ### Pools @@ -259,9 +260,9 @@ Methods: - client.cloud.load_balancers.pools.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.pools.update(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.pools.list(\*, project_id, region_id, \*\*params) -> DetailedLbPoolList +- client.cloud.load_balancers.pools.list(\*, project_id, region_id, \*\*params) -> LoadBalancerPoolList - client.cloud.load_balancers.pools.delete(pool_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.load_balancers.pools.get(pool_id, \*, project_id, region_id) -> DetailedLbPool +- client.cloud.load_balancers.pools.get(pool_id, \*, project_id, region_id) -> LoadBalancerPool #### HealthMonitors @@ -281,7 +282,7 @@ Methods: Methods: -- client.cloud.load_balancers.metrics.list(loadbalancer_id, \*, project_id, region_id, \*\*params) -> LoadbalancerMetricsList +- client.cloud.load_balancers.metrics.list(loadbalancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancerMetricsList ### Statuses diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index 35e17f49..8210af64 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -15,8 +15,8 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.cloud.lb_flavor_list import LbFlavorList from ....types.cloud.load_balancers import flavor_list_params +from ....types.cloud.load_balancer_flavor_list import LoadBalancerFlavorList __all__ = ["FlavorsResource", "AsyncFlavorsResource"] @@ -53,7 +53,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LbFlavorList: + ) -> LoadBalancerFlavorList: """Retrieve a list of load balancer flavors. When the include_prices query @@ -84,7 +84,7 @@ def list( timeout=timeout, query=maybe_transform({"include_prices": include_prices}, flavor_list_params.FlavorListParams), ), - cast_to=LbFlavorList, + cast_to=LoadBalancerFlavorList, ) @@ -120,7 +120,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LbFlavorList: + ) -> LoadBalancerFlavorList: """Retrieve a list of load balancer flavors. When the include_prices query @@ -153,7 +153,7 @@ async def list( {"include_prices": include_prices}, flavor_list_params.FlavorListParams ), ), - cast_to=LbFlavorList, + cast_to=LoadBalancerFlavorList, ) 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 f3073e4f..7ee190c7 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,10 +26,10 @@ async_to_streamed_response_wrapper, ) from ....._base_client import make_request_options -from .....types.cloud.l7_policy import L7Policy from .....types.cloud.task_id_list import TaskIDList -from .....types.cloud.l7_policy_list import L7PolicyList from .....types.cloud.load_balancers import l7_policy_create_params, l7_policy_replace_params +from .....types.cloud.load_balancer_l7_policy import LoadBalancerL7Policy +from .....types.cloud.load_balancer_l7_policy_list import LoadBalancerL7PolicyList __all__ = ["L7PoliciesResource", "AsyncL7PoliciesResource"] @@ -151,7 +151,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> L7PolicyList: + ) -> LoadBalancerL7PolicyList: """ List load balancer L7 policies @@ -173,7 +173,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=L7PolicyList, + cast_to=LoadBalancerL7PolicyList, ) def delete( @@ -227,7 +227,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> L7Policy: + ) -> LoadBalancerL7Policy: """ Get load balancer L7 policy @@ -251,7 +251,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=L7Policy, + cast_to=LoadBalancerL7Policy, ) def replace( @@ -453,7 +453,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> L7PolicyList: + ) -> LoadBalancerL7PolicyList: """ List load balancer L7 policies @@ -475,7 +475,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=L7PolicyList, + cast_to=LoadBalancerL7PolicyList, ) async def delete( @@ -529,7 +529,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> L7Policy: + ) -> LoadBalancerL7Policy: """ Get load balancer L7 policy @@ -553,7 +553,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=L7Policy, + cast_to=LoadBalancerL7Policy, ) async def replace( 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 4c8d987d..67bf1968 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -18,9 +18,9 @@ async_to_streamed_response_wrapper, ) from ....._base_client import make_request_options -from .....types.cloud.l7_rule import L7Rule -from .....types.cloud.l7_rule_list import L7RuleList from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.load_balancer_l7_rule import LoadBalancerL7Rule +from .....types.cloud.load_balancer_l7_rule_list import LoadBalancerL7RuleList from .....types.cloud.load_balancers.l7_policies import rule_create_params, rule_replace_params __all__ = ["RulesResource", "AsyncRulesResource"] @@ -137,7 +137,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> L7RuleList: + ) -> LoadBalancerL7RuleList: """ List load balancer L7 policy rules @@ -161,7 +161,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=L7RuleList, + cast_to=LoadBalancerL7RuleList, ) def delete( @@ -219,7 +219,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> L7Rule: + ) -> LoadBalancerL7Rule: """ Get load balancer L7 rule @@ -245,7 +245,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=L7Rule, + cast_to=LoadBalancerL7Rule, ) def replace( @@ -443,7 +443,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> L7RuleList: + ) -> LoadBalancerL7RuleList: """ List load balancer L7 policy rules @@ -467,7 +467,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=L7RuleList, + cast_to=LoadBalancerL7RuleList, ) async def delete( @@ -525,7 +525,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> L7Rule: + ) -> LoadBalancerL7Rule: """ Get load balancer L7 rule @@ -551,7 +551,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=L7Rule, + cast_to=LoadBalancerL7Rule, ) async def replace( diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 38496c3b..ceef740f 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -18,7 +18,6 @@ ) from ....types.cloud import LbListenerProtocol from ...._base_client import make_request_options -from ....types.cloud.lb_listener import LbListener from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.load_balancers import ( listener_get_params, @@ -26,8 +25,9 @@ listener_create_params, listener_update_params, ) -from ....types.cloud.lb_listener_list import LbListenerList from ....types.cloud.lb_listener_protocol import LbListenerProtocol +from ....types.cloud.load_balancer_listener_list import LoadBalancerListenerList +from ....types.cloud.load_balancer_listener_detail import LoadBalancerListenerDetail __all__ = ["ListenersResource", "AsyncListenersResource"] @@ -243,7 +243,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LbListenerList: + ) -> LoadBalancerListenerList: """ List load balancer listeners @@ -279,7 +279,7 @@ def list( listener_list_params.ListenerListParams, ), ), - cast_to=LbListenerList, + cast_to=LoadBalancerListenerList, ) def delete( @@ -334,7 +334,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LbListener: + ) -> LoadBalancerListenerDetail: """ Get listener @@ -364,7 +364,7 @@ def get( timeout=timeout, query=maybe_transform({"show_stats": show_stats}, listener_get_params.ListenerGetParams), ), - cast_to=LbListener, + cast_to=LoadBalancerListenerDetail, ) @@ -579,7 +579,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LbListenerList: + ) -> LoadBalancerListenerList: """ List load balancer listeners @@ -615,7 +615,7 @@ async def list( listener_list_params.ListenerListParams, ), ), - cast_to=LbListenerList, + cast_to=LoadBalancerListenerList, ) async def delete( @@ -670,7 +670,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LbListener: + ) -> LoadBalancerListenerDetail: """ Get listener @@ -700,7 +700,7 @@ async def get( timeout=timeout, query=await async_maybe_transform({"show_stats": show_stats}, listener_get_params.ListenerGetParams), ), - cast_to=LbListener, + cast_to=LoadBalancerListenerDetail, ) diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index aa89d045..f98fd660 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -17,8 +17,8 @@ from ....types.cloud import InstanceMetricsTimeUnit from ...._base_client import make_request_options from ....types.cloud.load_balancers import metric_list_params -from ....types.cloud.loadbalancer_metrics_list import LoadbalancerMetricsList from ....types.cloud.instance_metrics_time_unit import InstanceMetricsTimeUnit +from ....types.cloud.load_balancer_metrics_list import LoadBalancerMetricsList __all__ = ["MetricsResource", "AsyncMetricsResource"] @@ -57,7 +57,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadbalancerMetricsList: + ) -> LoadBalancerMetricsList: """ Get loadbalancer metrics, including cpu, memory and network @@ -92,7 +92,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadbalancerMetricsList, + cast_to=LoadBalancerMetricsList, ) @@ -130,7 +130,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadbalancerMetricsList: + ) -> LoadBalancerMetricsList: """ Get loadbalancer metrics, including cpu, memory and network @@ -165,7 +165,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadbalancerMetricsList, + cast_to=LoadBalancerMetricsList, ) diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index 6f64504d..0aa6aac9 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -16,12 +16,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .....types.cloud import HTTPMethod, HealthMonitorType +from .....types.cloud import HTTPMethod, LbHealthMonitorType from ....._base_client import make_request_options from .....types.cloud.http_method import HTTPMethod from .....types.cloud.task_id_list import TaskIDList -from .....types.cloud.health_monitor_type import HealthMonitorType from .....types.cloud.load_balancers.pools import health_monitor_create_params +from .....types.cloud.lb_health_monitor_type import LbHealthMonitorType __all__ = ["HealthMonitorsResource", "AsyncHealthMonitorsResource"] @@ -55,7 +55,7 @@ def create( delay: int, max_retries: int, api_timeout: int, - type: HealthMonitorType, + type: LbHealthMonitorType, expected_codes: Optional[str] | NotGiven = NOT_GIVEN, http_method: Optional[HTTPMethod] | NotGiven = NOT_GIVEN, max_retries_down: Optional[int] | NotGiven = NOT_GIVEN, @@ -194,7 +194,7 @@ async def create( delay: int, max_retries: int, api_timeout: int, - type: HealthMonitorType, + type: LbHealthMonitorType, expected_codes: Optional[str] | NotGiven = NOT_GIVEN, http_method: Optional[HTTPMethod] | NotGiven = NOT_GIVEN, max_retries_down: Optional[int] | NotGiven = NOT_GIVEN, diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 0da7f303..729c38d1 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -37,9 +37,9 @@ from .....types.cloud.lb_algorithm import LbAlgorithm from .....types.cloud.task_id_list import TaskIDList from .....types.cloud.load_balancers import pool_list_params, pool_create_params, pool_update_params -from .....types.cloud.detailed_lb_pool import DetailedLbPool from .....types.cloud.lb_pool_protocol import LbPoolProtocol -from .....types.cloud.detailed_lb_pool_list import DetailedLbPoolList +from .....types.cloud.load_balancer_pool import LoadBalancerPool +from .....types.cloud.load_balancer_pool_list import LoadBalancerPoolList __all__ = ["PoolsResource", "AsyncPoolsResource"] @@ -278,7 +278,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DetailedLbPoolList: + ) -> LoadBalancerPoolList: """ List load balancer pools @@ -318,7 +318,7 @@ def list( pool_list_params.PoolListParams, ), ), - cast_to=DetailedLbPoolList, + cast_to=LoadBalancerPoolList, ) def delete( @@ -372,7 +372,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DetailedLbPool: + ) -> LoadBalancerPool: """ Get load balancer pool @@ -396,7 +396,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DetailedLbPool, + cast_to=LoadBalancerPool, ) @@ -634,7 +634,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DetailedLbPoolList: + ) -> LoadBalancerPoolList: """ List load balancer pools @@ -674,7 +674,7 @@ async def list( pool_list_params.PoolListParams, ), ), - cast_to=DetailedLbPoolList, + cast_to=LoadBalancerPoolList, ) async def delete( @@ -728,7 +728,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DetailedLbPool: + ) -> LoadBalancerPool: """ Get load balancer pool @@ -752,7 +752,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=DetailedLbPool, + cast_to=LoadBalancerPool, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index c3316c8c..76ad9725 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -6,12 +6,12 @@ from .task import Task as Task from .image import Image as Image from .route import Route as Route +from .member import Member as Member from .region import Region as Region from .secret import Secret as Secret from .subnet import Subnet as Subnet from .volume import Volume as Volume from .console import Console as Console -from .l7_rule import L7Rule as L7Rule from .logging import Logging as Logging from .network import Network as Network from .project import Project as Project @@ -21,17 +21,14 @@ from .registry import Registry as Registry from .gpu_image import GPUImage as GPUImage from .ip_ranges import IPRanges as IPRanges -from .l7_policy import L7Policy as L7Policy from .file_share import FileShare as FileShare from .image_list import ImageList as ImageList from .ip_version import IPVersion as IPVersion from .floating_ip import FloatingIP as FloatingIP from .http_method import HTTPMethod as HTTPMethod -from .lb_listener import LbListener as LbListener from .pool_status import PoolStatus as PoolStatus from .aws_iam_data import AwsIamData as AwsIamData from .ddos_profile import DDOSProfile as DDOSProfile -from .l7_rule_list import L7RuleList as L7RuleList from .lb_algorithm import LbAlgorithm as LbAlgorithm from .registry_tag import RegistryTag as RegistryTag from .task_id_list import TaskIDList as TaskIDList @@ -44,8 +41,7 @@ from .registry_list import RegistryList as RegistryList from .blackhole_port import BlackholePort as BlackholePort from .gpu_image_list import GPUImageList as GPUImageList -from .l7_policy_list import L7PolicyList as L7PolicyList -from .lb_flavor_list import LbFlavorList as LbFlavorList +from .health_monitor import HealthMonitor as HealthMonitor from .security_group import SecurityGroup as SecurityGroup from .container_probe import ContainerProbe as ContainerProbe from .container_scale import ContainerScale as ContainerScale @@ -55,14 +51,11 @@ from .region_capacity import RegionCapacity as RegionCapacity from .ssh_key_created import SSHKeyCreated as SSHKeyCreated from .baremetal_flavor import BaremetalFlavor as BaremetalFlavor -from .detailed_lb_pool import DetailedLbPool as DetailedLbPool from .floating_address import FloatingAddress as FloatingAddress from .inference_probes import InferenceProbes as InferenceProbes from .ingress_opts_out import IngressOptsOut as IngressOptsOut -from .lb_listener_list import LbListenerList as LbListenerList from .lb_pool_protocol import LbPoolProtocol as LbPoolProtocol from .task_list_params import TaskListParams as TaskListParams -from .lb_health_monitor import LbHealthMonitor as LbHealthMonitor from .network_interface import NetworkInterface as NetworkInterface from .region_get_params import RegionGetParams as RegionGetParams from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP @@ -72,17 +65,18 @@ from .ingress_opts_param import IngressOptsParam as IngressOptsParam from .instance_interface import InstanceInterface as InstanceInterface from .instance_isolation import InstanceIsolation as InstanceIsolation +from .load_balancer_pool import LoadBalancerPool as LoadBalancerPool from .region_list_params import RegionListParams as RegionListParams from .volume_list_params import VolumeListParams as VolumeListParams from .billing_reservation import BillingReservation as BillingReservation from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .fixed_address_short import FixedAddressShort as FixedAddressShort -from .health_monitor_type import HealthMonitorType as HealthMonitorType from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .network_list_params import NetworkListParams as NetworkListParams from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus from .security_group_rule import SecurityGroupRule as SecurityGroupRule +from .session_persistence import SessionPersistence as SessionPersistence from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams from .container_probe_exec import ContainerProbeExec as ContainerProbeExec from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed @@ -90,7 +84,6 @@ from .instance_list_params import InstanceListParams as InstanceListParams from .lb_listener_protocol import LbListenerProtocol as LbListenerProtocol from .load_balancer_status import LoadBalancerStatus as LoadBalancerStatus -from .loadbalancer_metrics import LoadbalancerMetrics as LoadbalancerMetrics from .placement_group_list import PlacementGroupList as PlacementGroupList from .region_capacity_list import RegionCapacityList as RegionCapacityList from .secret_create_params import SecretCreateParams as SecretCreateParams @@ -103,9 +96,10 @@ from .allowed_address_pairs import AllowedAddressPairs as AllowedAddressPairs from .baremetal_flavor_list import BaremetalFlavorList as BaremetalFlavorList from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate -from .detailed_lb_pool_list import DetailedLbPoolList as DetailedLbPoolList from .gpu_baremetal_cluster import GPUBaremetalCluster as GPUBaremetalCluster from .health_monitor_status import HealthMonitorStatus as HealthMonitorStatus +from .load_balancer_l7_rule import LoadBalancerL7Rule as LoadBalancerL7Rule +from .load_balancer_metrics import LoadBalancerMetrics as LoadBalancerMetrics from .network_create_params import NetworkCreateParams as NetworkCreateParams from .network_update_params import NetworkUpdateParams as NetworkUpdateParams from .project_create_params import ProjectCreateParams as ProjectCreateParams @@ -118,14 +112,15 @@ from .instance_delete_params import InstanceDeleteParams as InstanceDeleteParams from .instance_resize_params import InstanceResizeParams as InstanceResizeParams from .instance_update_params import InstanceUpdateParams as InstanceUpdateParams -from .lb_session_persistence import LbSessionPersistence as LbSessionPersistence +from .lb_health_monitor_type import LbHealthMonitorType as LbHealthMonitorType from .network_interface_list import NetworkInterfaceList as NetworkInterfaceList from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse from .registry_create_params import RegistryCreateParams as RegistryCreateParams from .registry_resize_params import RegistryResizeParams as RegistryResizeParams -from .detailed_lb_pool_member import DetailedLbPoolMember as DetailedLbPoolMember from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams +from .load_balancer_l7_policy import LoadBalancerL7Policy as LoadBalancerL7Policy +from .load_balancer_pool_list import LoadBalancerPoolList as LoadBalancerPoolList from .container_probe_http_get import ContainerProbeHTTPGet as ContainerProbeHTTPGet from .container_scale_triggers import ContainerScaleTriggers as ContainerScaleTriggers from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList @@ -134,17 +129,18 @@ from .file_share_update_params import FileShareUpdateParams as FileShareUpdateParams from .load_balancer_get_params import LoadBalancerGetParams as LoadBalancerGetParams from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics -from .session_persistence_type import SessionPersistenceType as SessionPersistenceType from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams from .gpu_baremetal_flavor_list import GPUBaremetalFlavorList as GPUBaremetalFlavorList +from .load_balancer_flavor_list import LoadBalancerFlavorList as LoadBalancerFlavorList from .load_balancer_list_params import LoadBalancerListParams as LoadBalancerListParams from .load_balancer_status_list import LoadBalancerStatusList as LoadBalancerStatusList -from .loadbalancer_metrics_list import LoadbalancerMetricsList as LoadbalancerMetricsList from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .container_probe_tcp_socket import ContainerProbeTcpSocket as ContainerProbeTcpSocket from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit +from .load_balancer_l7_rule_list import LoadBalancerL7RuleList as LoadBalancerL7RuleList +from .load_balancer_metrics_list import LoadBalancerMetricsList as LoadBalancerMetricsList from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams from .container_scale_trigger_sqs import ContainerScaleTriggerSqs as ContainerScaleTriggerSqs @@ -152,18 +148,23 @@ from .flavor_hardware_description import FlavorHardwareDescription as FlavorHardwareDescription from .instance_get_console_params import InstanceGetConsoleParams as InstanceGetConsoleParams from .laas_index_retention_policy import LaasIndexRetentionPolicy as LaasIndexRetentionPolicy +from .lb_session_persistence_type import LbSessionPersistenceType as LbSessionPersistenceType from .load_balancer_create_params import LoadBalancerCreateParams as LoadBalancerCreateParams +from .load_balancer_flavor_detail import LoadBalancerFlavorDetail as LoadBalancerFlavorDetail from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole +from .load_balancer_listener_list import LoadBalancerListenerList as LoadBalancerListenerList from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .container_probe_create_param import ContainerProbeCreateParam as ContainerProbeCreateParam from .container_scale_trigger_rate import ContainerScaleTriggerRate as ContainerScaleTriggerRate from .gpu_baremetal_cluster_server import GPUBaremetalClusterServer as GPUBaremetalClusterServer +from .load_balancer_l7_policy_list import LoadBalancerL7PolicyList as LoadBalancerL7PolicyList from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams from .load_balancer_failover_params import LoadBalancerFailoverParams as LoadBalancerFailoverParams +from .load_balancer_listener_detail import LoadBalancerListenerDetail as LoadBalancerListenerDetail from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus diff --git a/src/gcore/types/cloud/lb_health_monitor.py b/src/gcore/types/cloud/health_monitor.py similarity index 89% rename from src/gcore/types/cloud/lb_health_monitor.py rename to src/gcore/types/cloud/health_monitor.py index d0c5f965..25303572 100644 --- a/src/gcore/types/cloud/lb_health_monitor.py +++ b/src/gcore/types/cloud/health_monitor.py @@ -4,14 +4,14 @@ from ..._models import BaseModel from .http_method import HTTPMethod -from .health_monitor_type import HealthMonitorType from .provisioning_status import ProvisioningStatus +from .lb_health_monitor_type import LbHealthMonitorType from .load_balancer_operating_status import LoadBalancerOperatingStatus -__all__ = ["LbHealthMonitor"] +__all__ = ["HealthMonitor"] -class LbHealthMonitor(BaseModel): +class HealthMonitor(BaseModel): id: str """Health monitor ID""" @@ -36,7 +36,7 @@ class LbHealthMonitor(BaseModel): timeout: int """The maximum time to connect. Must be less than the delay value""" - type: HealthMonitorType + type: LbHealthMonitorType """Health monitor type. Once health monitor is created, cannot be changed.""" expected_codes: Optional[str] = None diff --git a/src/gcore/types/cloud/health_monitor_status.py b/src/gcore/types/cloud/health_monitor_status.py index 733e8d77..49b172af 100644 --- a/src/gcore/types/cloud/health_monitor_status.py +++ b/src/gcore/types/cloud/health_monitor_status.py @@ -1,8 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from ..._models import BaseModel -from .health_monitor_type import HealthMonitorType from .provisioning_status import ProvisioningStatus +from .lb_health_monitor_type import LbHealthMonitorType from .load_balancer_operating_status import LoadBalancerOperatingStatus __all__ = ["HealthMonitorStatus"] @@ -18,5 +18,5 @@ class HealthMonitorStatus(BaseModel): provisioning_status: ProvisioningStatus """Provisioning status of the entity""" - type: HealthMonitorType + type: LbHealthMonitorType """Type of the Health Monitor""" diff --git a/src/gcore/types/cloud/health_monitor_type.py b/src/gcore/types/cloud/health_monitor_type.py deleted file mode 100644 index dd84a442..00000000 --- a/src/gcore/types/cloud/health_monitor_type.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["HealthMonitorType"] - -HealthMonitorType: TypeAlias = Literal["HTTP", "HTTPS", "K8S", "PING", "TCP", "TLS-HELLO", "UDP-CONNECT"] diff --git a/src/gcore/types/cloud/lb_health_monitor_type.py b/src/gcore/types/cloud/lb_health_monitor_type.py new file mode 100644 index 00000000..b433b99a --- /dev/null +++ b/src/gcore/types/cloud/lb_health_monitor_type.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["LbHealthMonitorType"] + +LbHealthMonitorType: TypeAlias = Literal["HTTP", "HTTPS", "K8S", "PING", "TCP", "TLS-HELLO", "UDP-CONNECT"] diff --git a/src/gcore/types/cloud/session_persistence_type.py b/src/gcore/types/cloud/lb_session_persistence_type.py similarity index 52% rename from src/gcore/types/cloud/session_persistence_type.py rename to src/gcore/types/cloud/lb_session_persistence_type.py index 7c4dd233..526ec28b 100644 --- a/src/gcore/types/cloud/session_persistence_type.py +++ b/src/gcore/types/cloud/lb_session_persistence_type.py @@ -2,6 +2,6 @@ from typing_extensions import Literal, TypeAlias -__all__ = ["SessionPersistenceType"] +__all__ = ["LbSessionPersistenceType"] -SessionPersistenceType: TypeAlias = Literal["APP_COOKIE", "HTTP_COOKIE", "SOURCE_IP"] +LbSessionPersistenceType: TypeAlias = Literal["APP_COOKIE", "HTTP_COOKIE", "SOURCE_IP"] diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index f74019f9..dfadf6e2 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -8,11 +8,11 @@ from .http_method import HTTPMethod from .lb_algorithm import LbAlgorithm from .lb_pool_protocol import LbPoolProtocol -from .health_monitor_type import HealthMonitorType from .interface_ip_family import InterfaceIPFamily from .lb_listener_protocol import LbListenerProtocol from .tag_update_map_param import TagUpdateMapParam -from .session_persistence_type import SessionPersistenceType +from .lb_health_monitor_type import LbHealthMonitorType +from .lb_session_persistence_type import LbSessionPersistenceType from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity @@ -142,7 +142,7 @@ class ListenerPoolHealthmonitor(TypedDict, total=False): timeout: Required[int] """The maximum time to connect. Must be less than the delay value""" - type: Required[HealthMonitorType] + type: Required[LbHealthMonitorType] """Health monitor type. Once health monitor is created, cannot be changed.""" expected_codes: Optional[str] @@ -198,7 +198,7 @@ class ListenerPoolMember(TypedDict, total=False): class ListenerPoolSessionPersistence(TypedDict, total=False): - type: Required[SessionPersistenceType] + type: Required[LbSessionPersistenceType] """Session persistence type""" cookie_name: Optional[str] diff --git a/src/gcore/types/cloud/lb_flavor_list.py b/src/gcore/types/cloud/load_balancer_flavor_detail.py similarity index 72% rename from src/gcore/types/cloud/lb_flavor_list.py rename to src/gcore/types/cloud/load_balancer_flavor_detail.py index 09f27c33..0d96a5e4 100644 --- a/src/gcore/types/cloud/lb_flavor_list.py +++ b/src/gcore/types/cloud/load_balancer_flavor_detail.py @@ -1,24 +1,24 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import Union, Optional from typing_extensions import Literal, TypeAlias from ..._models import BaseModel from .flavor_hardware_description import FlavorHardwareDescription -__all__ = ["LbFlavorList", "Result", "ResultHardwareDescription"] +__all__ = ["LoadBalancerFlavorDetail", "HardwareDescription"] -ResultHardwareDescription: TypeAlias = Union[FlavorHardwareDescription, object] +HardwareDescription: TypeAlias = Union[FlavorHardwareDescription, object] -class Result(BaseModel): +class LoadBalancerFlavorDetail(BaseModel): flavor_id: str """Flavor ID is the same as name""" flavor_name: str """Flavor name""" - hardware_description: ResultHardwareDescription + hardware_description: HardwareDescription """Additional hardware description.""" ram: int @@ -38,11 +38,3 @@ class Result(BaseModel): price_status: Optional[Literal["error", "hide", "show"]] = None """Price status for the UI""" - - -class LbFlavorList(BaseModel): - count: int - """Number of objects""" - - results: List[Result] - """Objects""" diff --git a/src/gcore/types/cloud/lb_listener_list.py b/src/gcore/types/cloud/load_balancer_flavor_list.py similarity index 52% rename from src/gcore/types/cloud/lb_listener_list.py rename to src/gcore/types/cloud/load_balancer_flavor_list.py index f8f9d090..7b10dbd7 100644 --- a/src/gcore/types/cloud/lb_listener_list.py +++ b/src/gcore/types/cloud/load_balancer_flavor_list.py @@ -3,14 +3,14 @@ from typing import List from ..._models import BaseModel -from .lb_listener import LbListener +from .load_balancer_flavor_detail import LoadBalancerFlavorDetail -__all__ = ["LbListenerList"] +__all__ = ["LoadBalancerFlavorList"] -class LbListenerList(BaseModel): +class LoadBalancerFlavorList(BaseModel): count: int """Number of objects""" - results: List[LbListener] + results: List[LoadBalancerFlavorDetail] """Objects""" diff --git a/src/gcore/types/cloud/l7_policy.py b/src/gcore/types/cloud/load_balancer_l7_policy.py similarity index 93% rename from src/gcore/types/cloud/l7_policy.py rename to src/gcore/types/cloud/load_balancer_l7_policy.py index fc4bbd93..5e0c9a3e 100644 --- a/src/gcore/types/cloud/l7_policy.py +++ b/src/gcore/types/cloud/load_balancer_l7_policy.py @@ -3,13 +3,13 @@ from typing import List, Optional from typing_extensions import Literal -from .l7_rule import L7Rule from ..._models import BaseModel +from .load_balancer_l7_rule import LoadBalancerL7Rule -__all__ = ["L7Policy"] +__all__ = ["LoadBalancerL7Policy"] -class L7Policy(BaseModel): +class LoadBalancerL7Policy(BaseModel): id: Optional[str] = None """ID""" @@ -66,7 +66,7 @@ class L7Policy(BaseModel): region_id: Optional[int] = None """Region ID""" - rules: Optional[List[L7Rule]] = None + rules: Optional[List[LoadBalancerL7Rule]] = None """Rules. All the rules associated with a given policy are logically ANDed together. A diff --git a/src/gcore/types/cloud/l7_rule_list.py b/src/gcore/types/cloud/load_balancer_l7_policy_list.py similarity index 54% rename from src/gcore/types/cloud/l7_rule_list.py rename to src/gcore/types/cloud/load_balancer_l7_policy_list.py index c7b7de94..e3fa62c0 100644 --- a/src/gcore/types/cloud/l7_rule_list.py +++ b/src/gcore/types/cloud/load_balancer_l7_policy_list.py @@ -2,15 +2,15 @@ from typing import List, Optional -from .l7_rule import L7Rule from ..._models import BaseModel +from .load_balancer_l7_policy import LoadBalancerL7Policy -__all__ = ["L7RuleList"] +__all__ = ["LoadBalancerL7PolicyList"] -class L7RuleList(BaseModel): +class LoadBalancerL7PolicyList(BaseModel): count: Optional[int] = None """Number of objects""" - results: Optional[List[L7Rule]] = None + results: Optional[List[LoadBalancerL7Policy]] = None """Objects""" diff --git a/src/gcore/types/cloud/l7_rule.py b/src/gcore/types/cloud/load_balancer_l7_rule.py similarity index 96% rename from src/gcore/types/cloud/l7_rule.py rename to src/gcore/types/cloud/load_balancer_l7_rule.py index 029fb849..244e294b 100644 --- a/src/gcore/types/cloud/l7_rule.py +++ b/src/gcore/types/cloud/load_balancer_l7_rule.py @@ -5,10 +5,10 @@ from ..._models import BaseModel -__all__ = ["L7Rule"] +__all__ = ["LoadBalancerL7Rule"] -class L7Rule(BaseModel): +class LoadBalancerL7Rule(BaseModel): id: Optional[str] = None """L7Rule ID""" diff --git a/src/gcore/types/cloud/l7_policy_list.py b/src/gcore/types/cloud/load_balancer_l7_rule_list.py similarity index 55% rename from src/gcore/types/cloud/l7_policy_list.py rename to src/gcore/types/cloud/load_balancer_l7_rule_list.py index 9d76b97b..8bd48ca0 100644 --- a/src/gcore/types/cloud/l7_policy_list.py +++ b/src/gcore/types/cloud/load_balancer_l7_rule_list.py @@ -3,14 +3,14 @@ from typing import List, Optional from ..._models import BaseModel -from .l7_policy import L7Policy +from .load_balancer_l7_rule import LoadBalancerL7Rule -__all__ = ["L7PolicyList"] +__all__ = ["LoadBalancerL7RuleList"] -class L7PolicyList(BaseModel): +class LoadBalancerL7RuleList(BaseModel): count: Optional[int] = None """Number of objects""" - results: Optional[List[L7Policy]] = None + results: Optional[List[LoadBalancerL7Rule]] = None """Objects""" diff --git a/src/gcore/types/cloud/lb_listener.py b/src/gcore/types/cloud/load_balancer_listener_detail.py similarity index 96% rename from src/gcore/types/cloud/lb_listener.py rename to src/gcore/types/cloud/load_balancer_listener_detail.py index 2aa7fa1e..d73d07af 100644 --- a/src/gcore/types/cloud/lb_listener.py +++ b/src/gcore/types/cloud/load_balancer_listener_detail.py @@ -8,7 +8,7 @@ from .load_balancer_statistics import LoadBalancerStatistics from .load_balancer_operating_status import LoadBalancerOperatingStatus -__all__ = ["LbListener", "UserList"] +__all__ = ["LoadBalancerListenerDetail", "UserList"] class UserList(BaseModel): @@ -19,7 +19,7 @@ class UserList(BaseModel): """Username to auth via Basic Authentication""" -class LbListener(BaseModel): +class LoadBalancerListenerDetail(BaseModel): id: str """Load balancer listener ID""" diff --git a/src/gcore/types/cloud/load_balancer_listener_list.py b/src/gcore/types/cloud/load_balancer_listener_list.py new file mode 100644 index 00000000..eb426067 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_listener_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .load_balancer_listener_detail import LoadBalancerListenerDetail + +__all__ = ["LoadBalancerListenerList"] + + +class LoadBalancerListenerList(BaseModel): + count: int + """Number of objects""" + + results: List[LoadBalancerListenerDetail] + """Objects""" diff --git a/src/gcore/types/cloud/loadbalancer_metrics.py b/src/gcore/types/cloud/load_balancer_metrics.py similarity index 92% rename from src/gcore/types/cloud/loadbalancer_metrics.py rename to src/gcore/types/cloud/load_balancer_metrics.py index d4f146bb..ffdf6859 100644 --- a/src/gcore/types/cloud/loadbalancer_metrics.py +++ b/src/gcore/types/cloud/load_balancer_metrics.py @@ -6,10 +6,10 @@ from ..._models import BaseModel -__all__ = ["LoadbalancerMetrics"] +__all__ = ["LoadBalancerMetrics"] -class LoadbalancerMetrics(BaseModel): +class LoadBalancerMetrics(BaseModel): cpu_util: Optional[float] = None """CPU utilization, % (max 100% for multi-core)""" diff --git a/src/gcore/types/cloud/loadbalancer_metrics_list.py b/src/gcore/types/cloud/load_balancer_metrics_list.py similarity index 54% rename from src/gcore/types/cloud/loadbalancer_metrics_list.py rename to src/gcore/types/cloud/load_balancer_metrics_list.py index 6a421044..c270faf1 100644 --- a/src/gcore/types/cloud/loadbalancer_metrics_list.py +++ b/src/gcore/types/cloud/load_balancer_metrics_list.py @@ -3,14 +3,14 @@ from typing import List from ..._models import BaseModel -from .loadbalancer_metrics import LoadbalancerMetrics +from .load_balancer_metrics import LoadBalancerMetrics -__all__ = ["LoadbalancerMetricsList"] +__all__ = ["LoadBalancerMetricsList"] -class LoadbalancerMetricsList(BaseModel): +class LoadBalancerMetricsList(BaseModel): count: int """Number of objects""" - results: List[LoadbalancerMetrics] + results: List[LoadBalancerMetrics] """Objects""" diff --git a/src/gcore/types/cloud/detailed_lb_pool.py b/src/gcore/types/cloud/load_balancer_pool.py similarity index 83% rename from src/gcore/types/cloud/detailed_lb_pool.py rename to src/gcore/types/cloud/load_balancer_pool.py index 1f50fd02..c9f6217d 100644 --- a/src/gcore/types/cloud/detailed_lb_pool.py +++ b/src/gcore/types/cloud/load_balancer_pool.py @@ -2,16 +2,16 @@ from typing import List, Optional +from .member import Member from ..._models import BaseModel from .lb_algorithm import LbAlgorithm +from .health_monitor import HealthMonitor from .lb_pool_protocol import LbPoolProtocol -from .lb_health_monitor import LbHealthMonitor from .provisioning_status import ProvisioningStatus -from .lb_session_persistence import LbSessionPersistence -from .detailed_lb_pool_member import DetailedLbPoolMember +from .session_persistence import SessionPersistence from .load_balancer_operating_status import LoadBalancerOperatingStatus -__all__ = ["DetailedLbPool", "Listener", "Loadbalancer"] +__all__ = ["LoadBalancerPool", "Listener", "Loadbalancer"] class Listener(BaseModel): @@ -24,7 +24,7 @@ class Loadbalancer(BaseModel): """Resource ID""" -class DetailedLbPool(BaseModel): +class LoadBalancerPool(BaseModel): id: str """Pool ID""" @@ -43,7 +43,7 @@ class DetailedLbPool(BaseModel): loadbalancers: List[Loadbalancer] """Load balancers IDs""" - members: List[DetailedLbPoolMember] + members: List[Member] """Pool members""" name: str @@ -61,7 +61,7 @@ class DetailedLbPool(BaseModel): secret_id: Optional[str] = None """Secret ID for TLS client authentication to the member servers""" - session_persistence: Optional[LbSessionPersistence] = None + session_persistence: Optional[SessionPersistence] = None """Session persistence parameters""" timeout_client_data: Optional[int] = None @@ -76,7 +76,7 @@ class DetailedLbPool(BaseModel): creator_task_id: Optional[str] = None """Task that created this entity""" - healthmonitor: Optional[LbHealthMonitor] = None + healthmonitor: Optional[HealthMonitor] = None """Health monitor parameters""" task_id: Optional[str] = None diff --git a/src/gcore/types/cloud/detailed_lb_pool_list.py b/src/gcore/types/cloud/load_balancer_pool_list.py similarity index 56% rename from src/gcore/types/cloud/detailed_lb_pool_list.py rename to src/gcore/types/cloud/load_balancer_pool_list.py index 405fd06e..071e22e5 100644 --- a/src/gcore/types/cloud/detailed_lb_pool_list.py +++ b/src/gcore/types/cloud/load_balancer_pool_list.py @@ -3,14 +3,14 @@ from typing import List from ..._models import BaseModel -from .detailed_lb_pool import DetailedLbPool +from .load_balancer_pool import LoadBalancerPool -__all__ = ["DetailedLbPoolList"] +__all__ = ["LoadBalancerPoolList"] -class DetailedLbPoolList(BaseModel): +class LoadBalancerPoolList(BaseModel): count: int """Number of objects""" - results: List[DetailedLbPool] + results: List[LoadBalancerPool] """Objects""" 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 66b20932..eabedba7 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -8,8 +8,8 @@ from ..http_method import HTTPMethod from ..lb_algorithm import LbAlgorithm from ..lb_pool_protocol import LbPoolProtocol -from ..health_monitor_type import HealthMonitorType -from ..session_persistence_type import SessionPersistenceType +from ..lb_health_monitor_type import LbHealthMonitorType +from ..lb_session_persistence_type import LbSessionPersistenceType __all__ = ["PoolCreateParams", "Healthmonitor", "Member", "SessionPersistence"] @@ -72,7 +72,7 @@ class Healthmonitor(TypedDict, total=False): timeout: Required[int] """The maximum time to connect. Must be less than the delay value""" - type: Required[HealthMonitorType] + type: Required[LbHealthMonitorType] """Health monitor type. Once health monitor is created, cannot be changed.""" expected_codes: Optional[str] @@ -128,7 +128,7 @@ class Member(TypedDict, total=False): class SessionPersistence(TypedDict, total=False): - type: Required[SessionPersistenceType] + type: Required[LbSessionPersistenceType] """Session persistence type""" cookie_name: Optional[str] 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 be41e37d..ebea1a3a 100644 --- a/src/gcore/types/cloud/load_balancers/pool_update_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_update_params.py @@ -8,8 +8,8 @@ from ..http_method import HTTPMethod from ..lb_algorithm import LbAlgorithm from ..lb_pool_protocol import LbPoolProtocol -from ..health_monitor_type import HealthMonitorType -from ..session_persistence_type import SessionPersistenceType +from ..lb_health_monitor_type import LbHealthMonitorType +from ..lb_session_persistence_type import LbSessionPersistenceType __all__ = ["PoolUpdateParams", "Healthmonitor", "Member", "SessionPersistence"] @@ -82,7 +82,7 @@ class Healthmonitor(TypedDict, total=False): max_retries_down: Optional[int] """Number of failures before the member is switched to ERROR state.""" - type: Optional[HealthMonitorType] + type: Optional[LbHealthMonitorType] """Health monitor type. Once health monitor is created, cannot be changed.""" url_path: Optional[str] @@ -126,7 +126,7 @@ class Member(TypedDict, total=False): class SessionPersistence(TypedDict, total=False): - type: Required[SessionPersistenceType] + type: Required[LbSessionPersistenceType] """Session persistence type""" cookie_name: Optional[str] diff --git a/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py b/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py index 591e24d0..d2726ec9 100644 --- a/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py @@ -7,7 +7,7 @@ from ....._utils import PropertyInfo from ...http_method import HTTPMethod -from ...health_monitor_type import HealthMonitorType +from ...lb_health_monitor_type import LbHealthMonitorType __all__ = ["HealthMonitorCreateParams"] @@ -26,7 +26,7 @@ class HealthMonitorCreateParams(TypedDict, total=False): api_timeout: Required[Annotated[int, PropertyInfo(alias="timeout")]] """The maximum time to connect. Must be less than the delay value""" - type: Required[HealthMonitorType] + type: Required[LbHealthMonitorType] """Health monitor type. Once health monitor is created, cannot be changed.""" expected_codes: Optional[str] diff --git a/src/gcore/types/cloud/detailed_lb_pool_member.py b/src/gcore/types/cloud/member.py similarity index 94% rename from src/gcore/types/cloud/detailed_lb_pool_member.py rename to src/gcore/types/cloud/member.py index 8b53b985..8b87f60b 100644 --- a/src/gcore/types/cloud/detailed_lb_pool_member.py +++ b/src/gcore/types/cloud/member.py @@ -6,10 +6,10 @@ from .provisioning_status import ProvisioningStatus from .load_balancer_operating_status import LoadBalancerOperatingStatus -__all__ = ["DetailedLbPoolMember"] +__all__ = ["Member"] -class DetailedLbPoolMember(BaseModel): +class Member(BaseModel): id: str """Member ID must be provided if an existing member is being updated""" diff --git a/src/gcore/types/cloud/lb_session_persistence.py b/src/gcore/types/cloud/session_persistence.py similarity index 74% rename from src/gcore/types/cloud/lb_session_persistence.py rename to src/gcore/types/cloud/session_persistence.py index cef9929f..0dca6a5c 100644 --- a/src/gcore/types/cloud/lb_session_persistence.py +++ b/src/gcore/types/cloud/session_persistence.py @@ -3,13 +3,13 @@ from typing import Optional from ..._models import BaseModel -from .session_persistence_type import SessionPersistenceType +from .lb_session_persistence_type import LbSessionPersistenceType -__all__ = ["LbSessionPersistence"] +__all__ = ["SessionPersistence"] -class LbSessionPersistence(BaseModel): - type: SessionPersistenceType +class SessionPersistence(BaseModel): + type: LbSessionPersistenceType """Session persistence type""" cookie_name: Optional[str] = None 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 d82ba4c0..794e32f1 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 @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import L7Rule, L7RuleList, TaskIDList +from gcore.types.cloud import TaskIDList, LoadBalancerL7Rule, LoadBalancerL7RuleList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -97,7 +97,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(L7RuleList, rule, path=["response"]) + assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -110,7 +110,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(L7RuleList, rule, path=["response"]) + assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -123,7 +123,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(L7RuleList, rule, path=["response"]) + assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -202,7 +202,7 @@ def test_method_get(self, client: Gcore) -> None: region_id=0, l7policy_id="l7policy_id", ) - assert_matches_type(L7Rule, rule, path=["response"]) + assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -216,7 +216,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(L7Rule, rule, path=["response"]) + assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -230,7 +230,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(L7Rule, rule, path=["response"]) + assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -410,7 +410,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(L7RuleList, rule, path=["response"]) + assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -423,7 +423,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(L7RuleList, rule, path=["response"]) + assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -436,7 +436,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(L7RuleList, rule, path=["response"]) + assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -515,7 +515,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: region_id=0, l7policy_id="l7policy_id", ) - assert_matches_type(L7Rule, rule, path=["response"]) + assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -529,7 +529,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(L7Rule, rule, path=["response"]) + assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -543,7 +543,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(L7Rule, rule, path=["response"]) + assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_flavors.py b/tests/api_resources/cloud/load_balancers/test_flavors.py index 2e266685..33869b8d 100644 --- a/tests/api_resources/cloud/load_balancers/test_flavors.py +++ b/tests/api_resources/cloud/load_balancers/test_flavors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LbFlavorList +from gcore.types.cloud import LoadBalancerFlavorList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(LbFlavorList, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -32,7 +32,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: region_id=0, include_prices=True, ) - assert_matches_type(LbFlavorList, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -44,7 +44,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(LbFlavorList, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -56,7 +56,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(LbFlavorList, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -70,7 +70,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(LbFlavorList, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -79,7 +79,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No region_id=0, include_prices=True, ) - assert_matches_type(LbFlavorList, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -91,7 +91,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(LbFlavorList, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -103,6 +103,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(LbFlavorList, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True 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 1a41011b..cfeb59dc 100644 --- a/tests/api_resources/cloud/load_balancers/test_l7_policies.py +++ b/tests/api_resources/cloud/load_balancers/test_l7_policies.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import L7Policy, TaskIDList, L7PolicyList +from gcore.types.cloud import TaskIDList, LoadBalancerL7Policy, LoadBalancerL7PolicyList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -80,7 +80,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(L7PolicyList, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -92,7 +92,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = response.parse() - assert_matches_type(L7PolicyList, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -104,7 +104,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = response.parse() - assert_matches_type(L7PolicyList, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -161,7 +161,7 @@ def test_method_get(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(L7Policy, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -174,7 +174,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = response.parse() - assert_matches_type(L7Policy, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -187,7 +187,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = response.parse() - assert_matches_type(L7Policy, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -334,7 +334,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(L7PolicyList, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -346,7 +346,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = await response.parse() - assert_matches_type(L7PolicyList, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -358,7 +358,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = await response.parse() - assert_matches_type(L7PolicyList, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -415,7 +415,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(L7Policy, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -428,7 +428,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = await response.parse() - assert_matches_type(L7Policy, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -441,7 +441,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = await response.parse() - assert_matches_type(L7Policy, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index 1cdfa3ce..2c98c9f4 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LbListener, TaskIDList, LbListenerList +from gcore.types.cloud import TaskIDList, LoadBalancerListenerList, LoadBalancerListenerDetail base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -164,7 +164,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(LbListenerList, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -174,7 +174,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: loadbalancer_id="loadbalancer_id", show_stats=True, ) - assert_matches_type(LbListenerList, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -186,7 +186,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = response.parse() - assert_matches_type(LbListenerList, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -198,7 +198,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = response.parse() - assert_matches_type(LbListenerList, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) assert cast(Any, response.is_closed) is True @@ -255,7 +255,7 @@ def test_method_get(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(LbListener, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerDetail, listener, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Gcore) -> None: @@ -265,7 +265,7 @@ def test_method_get_with_all_params(self, client: Gcore) -> None: region_id=0, show_stats=True, ) - assert_matches_type(LbListener, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerDetail, listener, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -278,7 +278,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = response.parse() - assert_matches_type(LbListener, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerDetail, listener, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -291,7 +291,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = response.parse() - assert_matches_type(LbListener, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerDetail, listener, path=["response"]) assert cast(Any, response.is_closed) is True @@ -455,7 +455,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(LbListenerList, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -465,7 +465,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No loadbalancer_id="loadbalancer_id", show_stats=True, ) - assert_matches_type(LbListenerList, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -477,7 +477,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = await response.parse() - assert_matches_type(LbListenerList, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -489,7 +489,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = await response.parse() - assert_matches_type(LbListenerList, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) assert cast(Any, response.is_closed) is True @@ -546,7 +546,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(LbListener, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerDetail, listener, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: @@ -556,7 +556,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> Non region_id=0, show_stats=True, ) - assert_matches_type(LbListener, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerDetail, listener, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -569,7 +569,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = await response.parse() - assert_matches_type(LbListener, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerDetail, listener, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -582,7 +582,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = await response.parse() - assert_matches_type(LbListener, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerDetail, listener, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_metrics.py b/tests/api_resources/cloud/load_balancers/test_metrics.py index 042d6293..50b10030 100644 --- a/tests/api_resources/cloud/load_balancers/test_metrics.py +++ b/tests/api_resources/cloud/load_balancers/test_metrics.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LoadbalancerMetricsList +from gcore.types.cloud import LoadBalancerMetricsList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +26,7 @@ def test_method_list(self, client: Gcore) -> None: time_interval=6, time_unit="day", ) - assert_matches_type(LoadbalancerMetricsList, metric, path=["response"]) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -41,7 +41,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = response.parse() - assert_matches_type(LoadbalancerMetricsList, metric, path=["response"]) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -56,7 +56,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = response.parse() - assert_matches_type(LoadbalancerMetricsList, metric, path=["response"]) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) assert cast(Any, response.is_closed) is True @@ -84,7 +84,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: time_interval=6, time_unit="day", ) - assert_matches_type(LoadbalancerMetricsList, metric, path=["response"]) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -99,7 +99,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = await response.parse() - assert_matches_type(LoadbalancerMetricsList, metric, path=["response"]) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -114,7 +114,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = await response.parse() - assert_matches_type(LoadbalancerMetricsList, metric, path=["response"]) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py index 731c9ca6..ca8600e3 100644 --- a/tests/api_resources/cloud/load_balancers/test_pools.py +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, DetailedLbPool, DetailedLbPoolList +from gcore.types.cloud import TaskIDList, LoadBalancerPool, LoadBalancerPoolList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -215,7 +215,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -226,7 +226,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: listener_id="listener_id", loadbalancer_id="loadbalancer_id", ) - assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -238,7 +238,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -250,7 +250,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -307,7 +307,7 @@ def test_method_get(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(DetailedLbPool, pool, path=["response"]) + assert_matches_type(LoadBalancerPool, pool, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -320,7 +320,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(DetailedLbPool, pool, path=["response"]) + assert_matches_type(LoadBalancerPool, pool, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -333,7 +333,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(DetailedLbPool, pool, path=["response"]) + assert_matches_type(LoadBalancerPool, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -548,7 +548,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -559,7 +559,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No listener_id="listener_id", loadbalancer_id="loadbalancer_id", ) - assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -571,7 +571,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -583,7 +583,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(DetailedLbPoolList, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -640,7 +640,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(DetailedLbPool, pool, path=["response"]) + assert_matches_type(LoadBalancerPool, pool, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -653,7 +653,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(DetailedLbPool, pool, path=["response"]) + assert_matches_type(LoadBalancerPool, pool, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -666,7 +666,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(DetailedLbPool, pool, path=["response"]) + assert_matches_type(LoadBalancerPool, pool, path=["response"]) assert cast(Any, response.is_closed) is True From 9ac11d9fc26d4fbf8d7afc589fc96767f7521eb3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 12:13:03 +0000 Subject: [PATCH 102/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/cloud/secrets.py | 62 +++++- src/gcore/types/cloud/secret_create_params.py | 2 + .../secret_upload_tls_certificate_params.py | 2 + tests/api_resources/cloud/test_secrets.py | 176 +++++++++--------- 5 files changed, 148 insertions(+), 98 deletions(-) diff --git a/.stats.yml b/.stats.yml index d82143ef..df3db037 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-cea2a0dfb3c484310aed1f2294fb31f8e5417de25cdb4356dffc9effe8f88730.yml -openapi_spec_hash: 69b46ef0cb4385629b4f5e33ad70d5b6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-93bed74b07499c4150b58296e09ef29a6430bbcb0bbfe43fe4822d4442aea2ad.yml +openapi_spec_hash: 6a9812343eab85c2b9191e56768f933b config_hash: bb44a58411de4cc3c5dce1aa9bd40392 diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index c7e350c2..3b852ba2 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -68,14 +68,17 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """Create secret + """ + Create secret Args: - name: Secret name + project_id: Project ID - payload: Secret payload. + region_id: Region ID - For HTTPS-terminated load balancing, provide base64 encoded + name: Secret name + + payload: Secret payload. For HTTPS-terminated load balancing, provide base64 encoded conents of a PKCS12 file. The PKCS12 file is the combined TLS certificate, key, and intermediate certificate chain obtained from an external certificate authority. The file can be created via openssl, e.g.'openssl pkcs12 -export @@ -154,6 +157,10 @@ def list( List secrets Args: + project_id: Project ID + + region_id: Region ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -191,6 +198,12 @@ def delete( Delete secret Args: + project_id: Project ID + + region_id: Region ID + + secret_id: Secret ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -230,6 +243,12 @@ def get( Get secret Args: + project_id: Project ID + + region_id: Region ID + + secret_id: Secret ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -271,6 +290,10 @@ def upload_tls_certificate( Create secret Args: + project_id: Project ID + + region_id: Region ID + name: Secret name payload: Secret payload. @@ -347,14 +370,17 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """Create secret + """ + Create secret Args: - name: Secret name + project_id: Project ID - payload: Secret payload. + region_id: Region ID - For HTTPS-terminated load balancing, provide base64 encoded + name: Secret name + + payload: Secret payload. For HTTPS-terminated load balancing, provide base64 encoded conents of a PKCS12 file. The PKCS12 file is the combined TLS certificate, key, and intermediate certificate chain obtained from an external certificate authority. The file can be created via openssl, e.g.'openssl pkcs12 -export @@ -433,6 +459,10 @@ async def list( List secrets Args: + project_id: Project ID + + region_id: Region ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -470,6 +500,12 @@ async def delete( Delete secret Args: + project_id: Project ID + + region_id: Region ID + + secret_id: Secret ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -509,6 +545,12 @@ async def get( Get secret Args: + project_id: Project ID + + region_id: Region ID + + secret_id: Secret ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -550,6 +592,10 @@ async def upload_tls_certificate( Create secret Args: + project_id: Project ID + + region_id: Region ID + name: Secret name payload: Secret payload. diff --git a/src/gcore/types/cloud/secret_create_params.py b/src/gcore/types/cloud/secret_create_params.py index 6b8d4e8f..c8b2afaa 100644 --- a/src/gcore/types/cloud/secret_create_params.py +++ b/src/gcore/types/cloud/secret_create_params.py @@ -10,8 +10,10 @@ class SecretCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" name: Required[str] """Secret name""" 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 4f394524..0ea75d24 100644 --- a/src/gcore/types/cloud/secret_upload_tls_certificate_params.py +++ b/src/gcore/types/cloud/secret_upload_tls_certificate_params.py @@ -13,8 +13,10 @@ class SecretUploadTlsCertificateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" name: Required[str] """Secret name""" diff --git a/tests/api_resources/cloud/test_secrets.py b/tests/api_resources/cloud/test_secrets.py index e3b328e3..dc87c6ca 100644 --- a/tests/api_resources/cloud/test_secrets.py +++ b/tests/api_resources/cloud/test_secrets.py @@ -25,8 +25,8 @@ class TestSecrets: @parametrize def test_method_create(self, client: Gcore) -> None: secret = client.cloud.secrets.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="AES key", payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", payload_content_encoding="base64", @@ -38,8 +38,8 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: secret = client.cloud.secrets.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="AES key", payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", payload_content_encoding="base64", @@ -55,8 +55,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.secrets.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="AES key", payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", payload_content_encoding="base64", @@ -72,8 +72,8 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.secrets.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="AES key", payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", payload_content_encoding="base64", @@ -91,16 +91,16 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: secret = client.cloud.secrets.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert_matches_type(SecretListResponse, secret, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.secrets.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -111,8 +111,8 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.secrets.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -125,18 +125,18 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: secret = client.cloud.secrets.delete( - secret_id="secret_id", - project_id=0, - region_id=0, + secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.secrets.with_raw_response.delete( - secret_id="secret_id", - project_id=0, - region_id=0, + secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -147,9 +147,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.secrets.with_streaming_response.delete( - secret_id="secret_id", - project_id=0, - region_id=0, + secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -164,25 +164,25 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_id` but received ''"): client.cloud.secrets.with_raw_response.delete( secret_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_get(self, client: Gcore) -> None: secret = client.cloud.secrets.get( - secret_id="secret_id", - project_id=0, - region_id=0, + secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215", + project_id=1, + region_id=1, ) assert_matches_type(Secret, secret, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.secrets.with_raw_response.get( - secret_id="secret_id", - project_id=0, - region_id=0, + secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -193,9 +193,9 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.secrets.with_streaming_response.get( - secret_id="secret_id", - project_id=0, - region_id=0, + secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -210,15 +210,15 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_id` but received ''"): client.cloud.secrets.with_raw_response.get( secret_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_upload_tls_certificate(self, client: Gcore) -> None: secret = client.cloud.secrets.upload_tls_certificate( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="Load balancer certificate #1", payload={ "certificate": "", @@ -231,8 +231,8 @@ def test_method_upload_tls_certificate(self, client: Gcore) -> None: @parametrize def test_method_upload_tls_certificate_with_all_params(self, client: Gcore) -> None: secret = client.cloud.secrets.upload_tls_certificate( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="Load balancer certificate #1", payload={ "certificate": "", @@ -246,8 +246,8 @@ def test_method_upload_tls_certificate_with_all_params(self, client: Gcore) -> N @parametrize def test_raw_response_upload_tls_certificate(self, client: Gcore) -> None: response = client.cloud.secrets.with_raw_response.upload_tls_certificate( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="Load balancer certificate #1", payload={ "certificate": "", @@ -264,8 +264,8 @@ def test_raw_response_upload_tls_certificate(self, client: Gcore) -> None: @parametrize def test_streaming_response_upload_tls_certificate(self, client: Gcore) -> None: with client.cloud.secrets.with_streaming_response.upload_tls_certificate( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="Load balancer certificate #1", payload={ "certificate": "", @@ -288,8 +288,8 @@ class TestAsyncSecrets: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: secret = await async_client.cloud.secrets.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="AES key", payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", payload_content_encoding="base64", @@ -301,8 +301,8 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: secret = await async_client.cloud.secrets.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="AES key", payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", payload_content_encoding="base64", @@ -318,8 +318,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.secrets.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="AES key", payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", payload_content_encoding="base64", @@ -335,8 +335,8 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.secrets.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="AES key", payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", payload_content_encoding="base64", @@ -354,16 +354,16 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: secret = await async_client.cloud.secrets.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert_matches_type(SecretListResponse, secret, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.secrets.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -374,8 +374,8 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.secrets.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -388,18 +388,18 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: secret = await async_client.cloud.secrets.delete( - secret_id="secret_id", - project_id=0, - region_id=0, + secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.secrets.with_raw_response.delete( - secret_id="secret_id", - project_id=0, - region_id=0, + secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -410,9 +410,9 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.secrets.with_streaming_response.delete( - secret_id="secret_id", - project_id=0, - region_id=0, + secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -427,25 +427,25 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_id` but received ''"): await async_client.cloud.secrets.with_raw_response.delete( secret_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: secret = await async_client.cloud.secrets.get( - secret_id="secret_id", - project_id=0, - region_id=0, + secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215", + project_id=1, + region_id=1, ) assert_matches_type(Secret, secret, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.secrets.with_raw_response.get( - secret_id="secret_id", - project_id=0, - region_id=0, + secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -456,9 +456,9 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.cloud.secrets.with_streaming_response.get( - secret_id="secret_id", - project_id=0, - region_id=0, + secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -473,15 +473,15 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `secret_id` but received ''"): await async_client.cloud.secrets.with_raw_response.get( secret_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_upload_tls_certificate(self, async_client: AsyncGcore) -> None: secret = await async_client.cloud.secrets.upload_tls_certificate( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="Load balancer certificate #1", payload={ "certificate": "", @@ -494,8 +494,8 @@ async def test_method_upload_tls_certificate(self, async_client: AsyncGcore) -> @parametrize async def test_method_upload_tls_certificate_with_all_params(self, async_client: AsyncGcore) -> None: secret = await async_client.cloud.secrets.upload_tls_certificate( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="Load balancer certificate #1", payload={ "certificate": "", @@ -509,8 +509,8 @@ async def test_method_upload_tls_certificate_with_all_params(self, async_client: @parametrize async def test_raw_response_upload_tls_certificate(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.secrets.with_raw_response.upload_tls_certificate( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="Load balancer certificate #1", payload={ "certificate": "", @@ -527,8 +527,8 @@ async def test_raw_response_upload_tls_certificate(self, async_client: AsyncGcor @parametrize async def test_streaming_response_upload_tls_certificate(self, async_client: AsyncGcore) -> None: async with async_client.cloud.secrets.with_streaming_response.upload_tls_certificate( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="Load balancer certificate #1", payload={ "certificate": "", From 72dba6a0617bfae70bdc186fc04c157ec470c78c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 12:19:05 +0000 Subject: [PATCH 103/592] chore: update SDK settings --- .github/workflows/publish-pypi.yml | 31 +++++++++ .github/workflows/release-doctor.yml | 21 ++++++ .release-please-manifest.json | 3 + .stats.yml | 2 +- CONTRIBUTING.md | 4 +- README.md | 10 +-- bin/check-release-environment | 21 ++++++ pyproject.toml | 6 +- release-please-config.json | 66 +++++++++++++++++++ src/gcore/_version.py | 2 +- .../resources/cloud/baremetal/baremetal.py | 8 +-- .../resources/cloud/baremetal/flavors.py | 8 +-- src/gcore/resources/cloud/baremetal/images.py | 8 +-- .../resources/cloud/baremetal/servers.py | 8 +-- .../resources/cloud/billing_reservations.py | 8 +-- src/gcore/resources/cloud/cloud.py | 8 +-- .../cloud/file_shares/access_rules.py | 8 +-- .../cloud/file_shares/file_shares.py | 8 +-- src/gcore/resources/cloud/floating_ips.py | 8 +-- .../cloud/gpu_baremetal_clusters/flavors.py | 8 +-- .../gpu_baremetal_clusters.py | 8 +-- .../cloud/gpu_baremetal_clusters/images.py | 8 +-- .../gpu_baremetal_clusters/interfaces.py | 8 +-- .../cloud/gpu_baremetal_clusters/servers.py | 8 +-- .../inference/deployments/deployments.py | 8 +-- .../cloud/inference/deployments/logs.py | 8 +-- .../resources/cloud/inference/flavors.py | 8 +-- .../resources/cloud/inference/inference.py | 8 +-- src/gcore/resources/cloud/inference/models.py | 8 +-- .../cloud/inference/registry_credentials.py | 8 +-- .../resources/cloud/inference/secrets.py | 8 +-- .../resources/cloud/instances/flavors.py | 8 +-- src/gcore/resources/cloud/instances/images.py | 8 +-- .../resources/cloud/instances/instances.py | 8 +-- .../resources/cloud/instances/interfaces.py | 8 +-- .../resources/cloud/instances/metrics.py | 8 +-- src/gcore/resources/cloud/ip_ranges.py | 8 +-- .../resources/cloud/load_balancers/flavors.py | 8 +-- .../load_balancers/l7_policies/l7_policies.py | 8 +-- .../cloud/load_balancers/l7_policies/rules.py | 8 +-- .../cloud/load_balancers/listeners.py | 8 +-- .../cloud/load_balancers/load_balancers.py | 8 +-- .../resources/cloud/load_balancers/metrics.py | 8 +-- .../load_balancers/pools/health_monitors.py | 8 +-- .../cloud/load_balancers/pools/members.py | 8 +-- .../cloud/load_balancers/pools/pools.py | 8 +-- .../cloud/load_balancers/statuses.py | 8 +-- .../resources/cloud/networks/networks.py | 8 +-- src/gcore/resources/cloud/networks/routers.py | 8 +-- src/gcore/resources/cloud/networks/subnets.py | 8 +-- src/gcore/resources/cloud/placement_groups.py | 8 +-- src/gcore/resources/cloud/projects.py | 8 +-- src/gcore/resources/cloud/quotas/quotas.py | 8 +-- src/gcore/resources/cloud/quotas/requests.py | 8 +-- src/gcore/resources/cloud/regions.py | 8 +-- .../resources/cloud/registries/artifacts.py | 8 +-- .../resources/cloud/registries/registries.py | 8 +-- .../cloud/registries/repositories.py | 8 +-- src/gcore/resources/cloud/registries/tags.py | 8 +-- src/gcore/resources/cloud/registries/users.py | 8 +-- .../reserved_fixed_ips/reserved_fixed_ips.py | 8 +-- .../resources/cloud/reserved_fixed_ips/vip.py | 8 +-- src/gcore/resources/cloud/secrets.py | 8 +-- .../resources/cloud/security_groups/rules.py | 8 +-- .../cloud/security_groups/security_groups.py | 8 +-- src/gcore/resources/cloud/ssh_keys.py | 8 +-- src/gcore/resources/cloud/tasks.py | 8 +-- .../resources/cloud/users/role_assignments.py | 8 +-- src/gcore/resources/cloud/users/users.py | 8 +-- src/gcore/resources/cloud/volumes.py | 8 +-- 70 files changed, 394 insertions(+), 252 deletions(-) create mode 100644 .github/workflows/publish-pypi.yml create mode 100644 .github/workflows/release-doctor.yml create mode 100644 .release-please-manifest.json create mode 100644 bin/check-release-environment create mode 100644 release-please-config.json diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml new file mode 100644 index 00000000..8c7b0787 --- /dev/null +++ b/.github/workflows/publish-pypi.yml @@ -0,0 +1,31 @@ +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to PyPI in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/G-Core/gcore-python/actions/workflows/publish-pypi.yml +name: Publish PyPI +on: + workflow_dispatch: + + release: + types: [published] + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Publish to PyPI + run: | + bash ./bin/publish-pypi + env: + PYPI_TOKEN: ${{ secrets.GCORE_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 00000000..a7b36139 --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,21 @@ +name: Release Doctor +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + runs-on: ubuntu-latest + if: github.repository == 'G-Core/gcore-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + + steps: + - uses: actions/checkout@v4 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + PYPI_TOKEN: ${{ secrets.GCORE_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..c4762802 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1-alpha.0" +} \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index df3db037..c90ab4ec 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-93bed74b07499c4150b58296e09ef29a6430bbcb0bbfe43fe4822d4442aea2ad.yml openapi_spec_hash: 6a9812343eab85c2b9191e56768f933b -config_hash: bb44a58411de4cc3c5dce1aa9bd40392 +config_hash: dbe8b1c46254ce615e8fb8145e201ded diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cfcb4570..8d6c5e17 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -63,7 +63,7 @@ If you’d like to use the repository from source, you can either install from g To install via git: ```sh -$ pip install git+ssh://git@github.com/stainless-sdks/gcore-python.git +$ pip install git+ssh://git@github.com/G-Core/gcore-python.git ``` Alternatively, you can build from source and install the wheel file: @@ -121,7 +121,7 @@ the changes aren't made through the automated pipeline, you may want to make rel ### Publish with a GitHub workflow -You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/stainless-sdks/gcore-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. +You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/G-Core/gcore-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. ### Publish manually diff --git a/README.md b/README.md index 0fdbbda2..2cff9dc3 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ The REST API documentation can be found on [docs.gcore.com](https://docs.gcore.c ## Installation ```sh -# install from this staging repo -pip install git+ssh://git@github.com/stainless-sdks/gcore-python.git +# install from the production repo +pip install git+ssh://git@github.com/G-Core/gcore-python.git ``` > [!NOTE] @@ -323,9 +323,9 @@ project = response.parse() # get the object that `cloud.projects.create()` woul print(project.id) ``` -These methods return an [`APIResponse`](https://github.com/stainless-sdks/gcore-python/tree/main/src/gcore/_response.py) object. +These methods return an [`APIResponse`](https://github.com/G-Core/gcore-python/tree/main/src/gcore/_response.py) object. -The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/gcore-python/tree/main/src/gcore/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. +The async client returns an [`AsyncAPIResponse`](https://github.com/G-Core/gcore-python/tree/main/src/gcore/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. #### `.with_streaming_response` @@ -431,7 +431,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. -We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/gcore-python/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/G-Core/gcore-python/issues) with questions, bugs, or suggestions. ### Determining the installed version diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 00000000..4df2a0a0 --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +errors=() + +if [ -z "${PYPI_TOKEN}" ]; then + errors+=("The GCORE_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") +fi + +lenErrors=${#errors[@]} + +if [[ lenErrors -gt 0 ]]; then + echo -e "Found the following errors in the release environment:\n" + + for error in "${errors[@]}"; do + echo -e "- $error\n" + done + + exit 1 +fi + +echo "The environment is ready to push releases!" diff --git a/pyproject.toml b/pyproject.toml index 31d96d42..6db93223 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,8 +34,8 @@ classifiers = [ ] [project.urls] -Homepage = "https://github.com/stainless-sdks/gcore-python" -Repository = "https://github.com/stainless-sdks/gcore-python" +Homepage = "https://github.com/G-Core/gcore-python" +Repository = "https://github.com/G-Core/gcore-python" [tool.rye] @@ -121,7 +121,7 @@ path = "README.md" [[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] # replace relative links with absolute links pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' -replacement = '[\1](https://github.com/stainless-sdks/gcore-python/tree/main/\g<2>)' +replacement = '[\1](https://github.com/G-Core/gcore-python/tree/main/\g<2>)' [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..1cc0e065 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,66 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "python", + "extra-files": [ + "src/gcore/_version.py" + ] +} \ No newline at end of file diff --git a/src/gcore/_version.py b/src/gcore/_version.py index 1acc1254..65e3082f 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.0.1-alpha.0" +__version__ = "0.0.1-alpha.0" # x-release-please-version diff --git a/src/gcore/resources/cloud/baremetal/baremetal.py b/src/gcore/resources/cloud/baremetal/baremetal.py index 1690b561..6922c20d 100644 --- a/src/gcore/resources/cloud/baremetal/baremetal.py +++ b/src/gcore/resources/cloud/baremetal/baremetal.py @@ -51,7 +51,7 @@ def with_raw_response(self) -> BaremetalResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return BaremetalResourceWithRawResponse(self) @@ -60,7 +60,7 @@ def with_streaming_response(self) -> BaremetalResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return BaremetalResourceWithStreamingResponse(self) @@ -84,7 +84,7 @@ def with_raw_response(self) -> AsyncBaremetalResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncBaremetalResourceWithRawResponse(self) @@ -93,7 +93,7 @@ def with_streaming_response(self) -> AsyncBaremetalResourceWithStreamingResponse """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncBaremetalResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 0f2a66ff..f3daf325 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -28,7 +28,7 @@ def with_raw_response(self) -> FlavorsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return FlavorsResourceWithRawResponse(self) @@ -37,7 +37,7 @@ def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return FlavorsResourceWithStreamingResponse(self) @@ -179,7 +179,7 @@ def with_raw_response(self) -> AsyncFlavorsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncFlavorsResourceWithRawResponse(self) @@ -188,7 +188,7 @@ def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncFlavorsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index 73c9e454..821ed848 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -31,7 +31,7 @@ def with_raw_response(self) -> ImagesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return ImagesResourceWithRawResponse(self) @@ -40,7 +40,7 @@ def with_streaming_response(self) -> ImagesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return ImagesResourceWithStreamingResponse(self) @@ -120,7 +120,7 @@ def with_raw_response(self) -> AsyncImagesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncImagesResourceWithRawResponse(self) @@ -129,7 +129,7 @@ def with_streaming_response(self) -> AsyncImagesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncImagesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 041fc064..cf6b3f3f 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -35,7 +35,7 @@ def with_raw_response(self) -> ServersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return ServersResourceWithRawResponse(self) @@ -44,7 +44,7 @@ def with_streaming_response(self) -> ServersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return ServersResourceWithStreamingResponse(self) @@ -395,7 +395,7 @@ def with_raw_response(self) -> AsyncServersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncServersResourceWithRawResponse(self) @@ -404,7 +404,7 @@ def with_streaming_response(self) -> AsyncServersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncServersResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index 75cd583f..1f54e088 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -33,7 +33,7 @@ def with_raw_response(self) -> BillingReservationsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return BillingReservationsResourceWithRawResponse(self) @@ -42,7 +42,7 @@ def with_streaming_response(self) -> BillingReservationsResourceWithStreamingRes """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return BillingReservationsResourceWithStreamingResponse(self) @@ -177,7 +177,7 @@ def with_raw_response(self) -> AsyncBillingReservationsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncBillingReservationsResourceWithRawResponse(self) @@ -186,7 +186,7 @@ def with_streaming_response(self) -> AsyncBillingReservationsResourceWithStreami """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncBillingReservationsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index c9218336..9b07f92c 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -279,7 +279,7 @@ def with_raw_response(self) -> CloudResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return CloudResourceWithRawResponse(self) @@ -288,7 +288,7 @@ def with_streaming_response(self) -> CloudResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return CloudResourceWithStreamingResponse(self) @@ -388,7 +388,7 @@ def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncCloudResourceWithRawResponse(self) @@ -397,7 +397,7 @@ def with_streaming_response(self) -> AsyncCloudResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncCloudResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index 2b9f42d9..21ba3f40 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -31,7 +31,7 @@ def with_raw_response(self) -> AccessRulesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AccessRulesResourceWithRawResponse(self) @@ -40,7 +40,7 @@ def with_streaming_response(self) -> AccessRulesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AccessRulesResourceWithStreamingResponse(self) @@ -206,7 +206,7 @@ def with_raw_response(self) -> AsyncAccessRulesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncAccessRulesResourceWithRawResponse(self) @@ -215,7 +215,7 @@ def with_streaming_response(self) -> AsyncAccessRulesResourceWithStreamingRespon """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncAccessRulesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 59b7ed3c..a4e135aa 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -51,7 +51,7 @@ def with_raw_response(self) -> FileSharesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return FileSharesResourceWithRawResponse(self) @@ -60,7 +60,7 @@ def with_streaming_response(self) -> FileSharesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return FileSharesResourceWithStreamingResponse(self) @@ -472,7 +472,7 @@ def with_raw_response(self) -> AsyncFileSharesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncFileSharesResourceWithRawResponse(self) @@ -481,7 +481,7 @@ def with_streaming_response(self) -> AsyncFileSharesResourceWithStreamingRespons """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncFileSharesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index bcb00f11..2d70d273 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -34,7 +34,7 @@ def with_raw_response(self) -> FloatingIPsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return FloatingIPsResourceWithRawResponse(self) @@ -43,7 +43,7 @@ def with_streaming_response(self) -> FloatingIPsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return FloatingIPsResourceWithStreamingResponse(self) @@ -355,7 +355,7 @@ def with_raw_response(self) -> AsyncFloatingIPsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncFloatingIPsResourceWithRawResponse(self) @@ -364,7 +364,7 @@ def with_streaming_response(self) -> AsyncFloatingIPsResourceWithStreamingRespon """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncFloatingIPsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index 7126fee0..abe8d9ef 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -28,7 +28,7 @@ def with_raw_response(self) -> FlavorsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return FlavorsResourceWithRawResponse(self) @@ -37,7 +37,7 @@ def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return FlavorsResourceWithStreamingResponse(self) @@ -105,7 +105,7 @@ def with_raw_response(self) -> AsyncFlavorsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncFlavorsResourceWithRawResponse(self) @@ -114,7 +114,7 @@ def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncFlavorsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 230e525b..51117641 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -88,7 +88,7 @@ def with_raw_response(self) -> GPUBaremetalClustersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return GPUBaremetalClustersResourceWithRawResponse(self) @@ -97,7 +97,7 @@ def with_streaming_response(self) -> GPUBaremetalClustersResourceWithStreamingRe """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return GPUBaremetalClustersResourceWithStreamingResponse(self) @@ -535,7 +535,7 @@ def with_raw_response(self) -> AsyncGPUBaremetalClustersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncGPUBaremetalClustersResourceWithRawResponse(self) @@ -544,7 +544,7 @@ def with_streaming_response(self) -> AsyncGPUBaremetalClustersResourceWithStream """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncGPUBaremetalClustersResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 2145f7c7..4be9a937 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -34,7 +34,7 @@ def with_raw_response(self) -> ImagesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return ImagesResourceWithRawResponse(self) @@ -43,7 +43,7 @@ def with_streaming_response(self) -> ImagesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return ImagesResourceWithStreamingResponse(self) @@ -275,7 +275,7 @@ def with_raw_response(self) -> AsyncImagesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncImagesResourceWithRawResponse(self) @@ -284,7 +284,7 @@ def with_streaming_response(self) -> AsyncImagesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncImagesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index 9b8a661b..dc9e5249 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -26,7 +26,7 @@ def with_raw_response(self) -> InterfacesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return InterfacesResourceWithRawResponse(self) @@ -35,7 +35,7 @@ def with_streaming_response(self) -> InterfacesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return InterfacesResourceWithStreamingResponse(self) @@ -86,7 +86,7 @@ def with_raw_response(self) -> AsyncInterfacesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncInterfacesResourceWithRawResponse(self) @@ -95,7 +95,7 @@ def with_streaming_response(self) -> AsyncInterfacesResourceWithStreamingRespons """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncInterfacesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 9243f9d2..7ca59e37 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -37,7 +37,7 @@ def with_raw_response(self) -> ServersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return ServersResourceWithRawResponse(self) @@ -46,7 +46,7 @@ def with_streaming_response(self) -> ServersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return ServersResourceWithStreamingResponse(self) @@ -522,7 +522,7 @@ def with_raw_response(self) -> AsyncServersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncServersResourceWithRawResponse(self) @@ -531,7 +531,7 @@ def with_streaming_response(self) -> AsyncServersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncServersResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 36c254a7..18521e40 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -46,7 +46,7 @@ def with_raw_response(self) -> DeploymentsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return DeploymentsResourceWithRawResponse(self) @@ -55,7 +55,7 @@ def with_streaming_response(self) -> DeploymentsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return DeploymentsResourceWithStreamingResponse(self) @@ -554,7 +554,7 @@ def with_raw_response(self) -> AsyncDeploymentsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncDeploymentsResourceWithRawResponse(self) @@ -563,7 +563,7 @@ def with_streaming_response(self) -> AsyncDeploymentsResourceWithStreamingRespon """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncDeploymentsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index 78941e3e..816fd99f 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -32,7 +32,7 @@ def with_raw_response(self) -> LogsResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return LogsResourceWithRawResponse(self) @@ -41,7 +41,7 @@ def with_streaming_response(self) -> LogsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return LogsResourceWithStreamingResponse(self) @@ -119,7 +119,7 @@ def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncLogsResourceWithRawResponse(self) @@ -128,7 +128,7 @@ def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncLogsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index 34f474c8..d273b19b 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -29,7 +29,7 @@ def with_raw_response(self) -> FlavorsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return FlavorsResourceWithRawResponse(self) @@ -38,7 +38,7 @@ def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return FlavorsResourceWithStreamingResponse(self) @@ -134,7 +134,7 @@ def with_raw_response(self) -> AsyncFlavorsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncFlavorsResourceWithRawResponse(self) @@ -143,7 +143,7 @@ def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncFlavorsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index f32fa46c..c29bc9b1 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -86,7 +86,7 @@ def with_raw_response(self) -> InferenceResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return InferenceResourceWithRawResponse(self) @@ -95,7 +95,7 @@ def with_streaming_response(self) -> InferenceResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return InferenceResourceWithStreamingResponse(self) @@ -146,7 +146,7 @@ def with_raw_response(self) -> AsyncInferenceResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncInferenceResourceWithRawResponse(self) @@ -155,7 +155,7 @@ def with_streaming_response(self) -> AsyncInferenceResourceWithStreamingResponse """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncInferenceResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/inference/models.py b/src/gcore/resources/cloud/inference/models.py index fecd820f..ba8c7a34 100644 --- a/src/gcore/resources/cloud/inference/models.py +++ b/src/gcore/resources/cloud/inference/models.py @@ -30,7 +30,7 @@ def with_raw_response(self) -> ModelsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return ModelsResourceWithRawResponse(self) @@ -39,7 +39,7 @@ def with_streaming_response(self) -> ModelsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return ModelsResourceWithStreamingResponse(self) @@ -139,7 +139,7 @@ def with_raw_response(self) -> AsyncModelsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncModelsResourceWithRawResponse(self) @@ -148,7 +148,7 @@ def with_streaming_response(self) -> AsyncModelsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncModelsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 25ac65da..70c0cbf6 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -34,7 +34,7 @@ def with_raw_response(self) -> RegistryCredentialsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return RegistryCredentialsResourceWithRawResponse(self) @@ -43,7 +43,7 @@ def with_streaming_response(self) -> RegistryCredentialsResourceWithStreamingRes """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return RegistryCredentialsResourceWithStreamingResponse(self) @@ -303,7 +303,7 @@ def with_raw_response(self) -> AsyncRegistryCredentialsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncRegistryCredentialsResourceWithRawResponse(self) @@ -312,7 +312,7 @@ def with_streaming_response(self) -> AsyncRegistryCredentialsResourceWithStreami """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncRegistryCredentialsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index 833e4ff1..c21ef45c 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -30,7 +30,7 @@ def with_raw_response(self) -> SecretsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return SecretsResourceWithRawResponse(self) @@ -39,7 +39,7 @@ def with_streaming_response(self) -> SecretsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return SecretsResourceWithStreamingResponse(self) @@ -291,7 +291,7 @@ def with_raw_response(self) -> AsyncSecretsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncSecretsResourceWithRawResponse(self) @@ -300,7 +300,7 @@ def with_streaming_response(self) -> AsyncSecretsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncSecretsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 4525a6c3..071f754b 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -30,7 +30,7 @@ def with_raw_response(self) -> FlavorsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return FlavorsResourceWithRawResponse(self) @@ -39,7 +39,7 @@ def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return FlavorsResourceWithStreamingResponse(self) @@ -212,7 +212,7 @@ def with_raw_response(self) -> AsyncFlavorsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncFlavorsResourceWithRawResponse(self) @@ -221,7 +221,7 @@ def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncFlavorsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index 1346c46e..d4f358cb 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -40,7 +40,7 @@ def with_raw_response(self) -> ImagesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return ImagesResourceWithRawResponse(self) @@ -49,7 +49,7 @@ def with_streaming_response(self) -> ImagesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return ImagesResourceWithStreamingResponse(self) @@ -469,7 +469,7 @@ def with_raw_response(self) -> AsyncImagesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncImagesResourceWithRawResponse(self) @@ -478,7 +478,7 @@ def with_streaming_response(self) -> AsyncImagesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncImagesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index b787482e..254306f6 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -96,7 +96,7 @@ def with_raw_response(self) -> InstancesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return InstancesResourceWithRawResponse(self) @@ -105,7 +105,7 @@ def with_streaming_response(self) -> InstancesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return InstancesResourceWithStreamingResponse(self) @@ -1106,7 +1106,7 @@ def with_raw_response(self) -> AsyncInstancesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncInstancesResourceWithRawResponse(self) @@ -1115,7 +1115,7 @@ def with_streaming_response(self) -> AsyncInstancesResourceWithStreamingResponse """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncInstancesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 47d571c6..1df34c30 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -32,7 +32,7 @@ def with_raw_response(self) -> InterfacesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return InterfacesResourceWithRawResponse(self) @@ -41,7 +41,7 @@ def with_streaming_response(self) -> InterfacesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return InterfacesResourceWithStreamingResponse(self) @@ -388,7 +388,7 @@ def with_raw_response(self) -> AsyncInterfacesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncInterfacesResourceWithRawResponse(self) @@ -397,7 +397,7 @@ def with_streaming_response(self) -> AsyncInterfacesResourceWithStreamingRespons """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncInterfacesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index 90c7c579..fa058434 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -30,7 +30,7 @@ def with_raw_response(self) -> MetricsResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return MetricsResourceWithRawResponse(self) @@ -39,7 +39,7 @@ def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return MetricsResourceWithStreamingResponse(self) @@ -109,7 +109,7 @@ def with_raw_response(self) -> AsyncMetricsResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncMetricsResourceWithRawResponse(self) @@ -118,7 +118,7 @@ def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncMetricsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index e572c567..739e19cf 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -26,7 +26,7 @@ def with_raw_response(self) -> IPRangesResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return IPRangesResourceWithRawResponse(self) @@ -35,7 +35,7 @@ def with_streaming_response(self) -> IPRangesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return IPRangesResourceWithStreamingResponse(self) @@ -66,7 +66,7 @@ def with_raw_response(self) -> AsyncIPRangesResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncIPRangesResourceWithRawResponse(self) @@ -75,7 +75,7 @@ def with_streaming_response(self) -> AsyncIPRangesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncIPRangesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index 8210af64..c011bd00 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -28,7 +28,7 @@ def with_raw_response(self) -> FlavorsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return FlavorsResourceWithRawResponse(self) @@ -37,7 +37,7 @@ def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return FlavorsResourceWithStreamingResponse(self) @@ -95,7 +95,7 @@ def with_raw_response(self) -> AsyncFlavorsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncFlavorsResourceWithRawResponse(self) @@ -104,7 +104,7 @@ def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncFlavorsResourceWithStreamingResponse(self) 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 7ee190c7..7fea3985 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 @@ -45,7 +45,7 @@ def with_raw_response(self) -> L7PoliciesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return L7PoliciesResourceWithRawResponse(self) @@ -54,7 +54,7 @@ def with_streaming_response(self) -> L7PoliciesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return L7PoliciesResourceWithStreamingResponse(self) @@ -347,7 +347,7 @@ def with_raw_response(self) -> AsyncL7PoliciesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncL7PoliciesResourceWithRawResponse(self) @@ -356,7 +356,7 @@ def with_streaming_response(self) -> AsyncL7PoliciesResourceWithStreamingRespons """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncL7PoliciesResourceWithStreamingResponse(self) 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 67bf1968..b9201807 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -33,7 +33,7 @@ def with_raw_response(self) -> RulesResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return RulesResourceWithRawResponse(self) @@ -42,7 +42,7 @@ def with_streaming_response(self) -> RulesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return RulesResourceWithStreamingResponse(self) @@ -339,7 +339,7 @@ def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncRulesResourceWithRawResponse(self) @@ -348,7 +348,7 @@ def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncRulesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index ceef740f..5a39cabc 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -39,7 +39,7 @@ def with_raw_response(self) -> ListenersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return ListenersResourceWithRawResponse(self) @@ -48,7 +48,7 @@ def with_streaming_response(self) -> ListenersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return ListenersResourceWithStreamingResponse(self) @@ -375,7 +375,7 @@ def with_raw_response(self) -> AsyncListenersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncListenersResourceWithRawResponse(self) @@ -384,7 +384,7 @@ def with_streaming_response(self) -> AsyncListenersResourceWithStreamingResponse """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncListenersResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index f8f504ef..e87abc6b 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -116,7 +116,7 @@ def with_raw_response(self) -> LoadBalancersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return LoadBalancersResourceWithRawResponse(self) @@ -125,7 +125,7 @@ def with_streaming_response(self) -> LoadBalancersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return LoadBalancersResourceWithStreamingResponse(self) @@ -589,7 +589,7 @@ def with_raw_response(self) -> AsyncLoadBalancersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncLoadBalancersResourceWithRawResponse(self) @@ -598,7 +598,7 @@ def with_streaming_response(self) -> AsyncLoadBalancersResourceWithStreamingResp """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncLoadBalancersResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index f98fd660..7cfa283c 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -30,7 +30,7 @@ def with_raw_response(self) -> MetricsResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return MetricsResourceWithRawResponse(self) @@ -39,7 +39,7 @@ def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return MetricsResourceWithStreamingResponse(self) @@ -103,7 +103,7 @@ def with_raw_response(self) -> AsyncMetricsResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncMetricsResourceWithRawResponse(self) @@ -112,7 +112,7 @@ def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncMetricsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index 0aa6aac9..b2fbfd0f 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -33,7 +33,7 @@ def with_raw_response(self) -> HealthMonitorsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return HealthMonitorsResourceWithRawResponse(self) @@ -42,7 +42,7 @@ def with_streaming_response(self) -> HealthMonitorsResourceWithStreamingResponse """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return HealthMonitorsResourceWithStreamingResponse(self) @@ -172,7 +172,7 @@ def with_raw_response(self) -> AsyncHealthMonitorsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncHealthMonitorsResourceWithRawResponse(self) @@ -181,7 +181,7 @@ def with_streaming_response(self) -> AsyncHealthMonitorsResourceWithStreamingRes """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncHealthMonitorsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 128679a8..ec0cbf0e 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -30,7 +30,7 @@ def with_raw_response(self) -> MembersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return MembersResourceWithRawResponse(self) @@ -39,7 +39,7 @@ def with_streaming_response(self) -> MembersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return MembersResourceWithStreamingResponse(self) @@ -171,7 +171,7 @@ def with_raw_response(self) -> AsyncMembersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncMembersResourceWithRawResponse(self) @@ -180,7 +180,7 @@ def with_streaming_response(self) -> AsyncMembersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncMembersResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 729c38d1..5d7a4c8a 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -59,7 +59,7 @@ def with_raw_response(self) -> PoolsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return PoolsResourceWithRawResponse(self) @@ -68,7 +68,7 @@ def with_streaming_response(self) -> PoolsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return PoolsResourceWithStreamingResponse(self) @@ -415,7 +415,7 @@ def with_raw_response(self) -> AsyncPoolsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncPoolsResourceWithRawResponse(self) @@ -424,7 +424,7 @@ def with_streaming_response(self) -> AsyncPoolsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncPoolsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index ec309e9c..5579e857 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -27,7 +27,7 @@ def with_raw_response(self) -> StatusesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return StatusesResourceWithRawResponse(self) @@ -36,7 +36,7 @@ def with_streaming_response(self) -> StatusesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return StatusesResourceWithStreamingResponse(self) @@ -123,7 +123,7 @@ def with_raw_response(self) -> AsyncStatusesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncStatusesResourceWithRawResponse(self) @@ -132,7 +132,7 @@ def with_streaming_response(self) -> AsyncStatusesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncStatusesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index ee5f0a04..f5eb2317 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -58,7 +58,7 @@ def with_raw_response(self) -> NetworksResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return NetworksResourceWithRawResponse(self) @@ -67,7 +67,7 @@ def with_streaming_response(self) -> NetworksResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return NetworksResourceWithStreamingResponse(self) @@ -336,7 +336,7 @@ def with_raw_response(self) -> AsyncNetworksResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncNetworksResourceWithRawResponse(self) @@ -345,7 +345,7 @@ def with_streaming_response(self) -> AsyncNetworksResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncNetworksResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 17ac0693..97c942f6 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -38,7 +38,7 @@ def with_raw_response(self) -> RoutersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return RoutersResourceWithRawResponse(self) @@ -47,7 +47,7 @@ def with_streaming_response(self) -> RoutersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return RoutersResourceWithStreamingResponse(self) @@ -405,7 +405,7 @@ def with_raw_response(self) -> AsyncRoutersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncRoutersResourceWithRawResponse(self) @@ -414,7 +414,7 @@ def with_streaming_response(self) -> AsyncRoutersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncRoutersResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index a6891b54..f6768c53 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -36,7 +36,7 @@ def with_raw_response(self) -> SubnetsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return SubnetsResourceWithRawResponse(self) @@ -45,7 +45,7 @@ def with_streaming_response(self) -> SubnetsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return SubnetsResourceWithStreamingResponse(self) @@ -412,7 +412,7 @@ def with_raw_response(self) -> AsyncSubnetsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncSubnetsResourceWithRawResponse(self) @@ -421,7 +421,7 @@ def with_streaming_response(self) -> AsyncSubnetsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncSubnetsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 4feb4a40..31777c13 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -32,7 +32,7 @@ def with_raw_response(self) -> PlacementGroupsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return PlacementGroupsResourceWithRawResponse(self) @@ -41,7 +41,7 @@ def with_streaming_response(self) -> PlacementGroupsResourceWithStreamingRespons """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return PlacementGroupsResourceWithStreamingResponse(self) @@ -216,7 +216,7 @@ def with_raw_response(self) -> AsyncPlacementGroupsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncPlacementGroupsResourceWithRawResponse(self) @@ -225,7 +225,7 @@ def with_streaming_response(self) -> AsyncPlacementGroupsResourceWithStreamingRe """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncPlacementGroupsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 4049af8d..1412cae0 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -33,7 +33,7 @@ def with_raw_response(self) -> ProjectsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return ProjectsResourceWithRawResponse(self) @@ -42,7 +42,7 @@ def with_streaming_response(self) -> ProjectsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return ProjectsResourceWithStreamingResponse(self) @@ -282,7 +282,7 @@ def with_raw_response(self) -> AsyncProjectsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncProjectsResourceWithRawResponse(self) @@ -291,7 +291,7 @@ def with_streaming_response(self) -> AsyncProjectsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncProjectsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index a4547029..46f5ca02 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -40,7 +40,7 @@ def with_raw_response(self) -> QuotasResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return QuotasResourceWithRawResponse(self) @@ -49,7 +49,7 @@ def with_streaming_response(self) -> QuotasResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return QuotasResourceWithStreamingResponse(self) @@ -155,7 +155,7 @@ def with_raw_response(self) -> AsyncQuotasResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncQuotasResourceWithRawResponse(self) @@ -164,7 +164,7 @@ def with_streaming_response(self) -> AsyncQuotasResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncQuotasResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 149f6d73..39611360 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -33,7 +33,7 @@ def with_raw_response(self) -> RequestsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return RequestsResourceWithRawResponse(self) @@ -42,7 +42,7 @@ def with_streaming_response(self) -> RequestsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return RequestsResourceWithStreamingResponse(self) @@ -225,7 +225,7 @@ def with_raw_response(self) -> AsyncRequestsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncRequestsResourceWithRawResponse(self) @@ -234,7 +234,7 @@ def with_streaming_response(self) -> AsyncRequestsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncRequestsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index c7098465..b49adfcd 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -31,7 +31,7 @@ def with_raw_response(self) -> RegionsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return RegionsResourceWithRawResponse(self) @@ -40,7 +40,7 @@ def with_streaming_response(self) -> RegionsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return RegionsResourceWithStreamingResponse(self) @@ -158,7 +158,7 @@ def with_raw_response(self) -> AsyncRegionsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncRegionsResourceWithRawResponse(self) @@ -167,7 +167,7 @@ def with_streaming_response(self) -> AsyncRegionsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncRegionsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index aeec5c3c..f336141b 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -26,7 +26,7 @@ def with_raw_response(self) -> ArtifactsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return ArtifactsResourceWithRawResponse(self) @@ -35,7 +35,7 @@ def with_streaming_response(self) -> ArtifactsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return ArtifactsResourceWithStreamingResponse(self) @@ -131,7 +131,7 @@ def with_raw_response(self) -> AsyncArtifactsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncArtifactsResourceWithRawResponse(self) @@ -140,7 +140,7 @@ def with_streaming_response(self) -> AsyncArtifactsResourceWithStreamingResponse """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncArtifactsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 4f26fb63..b84235a8 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -77,7 +77,7 @@ def with_raw_response(self) -> RegistriesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return RegistriesResourceWithRawResponse(self) @@ -86,7 +86,7 @@ def with_streaming_response(self) -> RegistriesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return RegistriesResourceWithStreamingResponse(self) @@ -319,7 +319,7 @@ def with_raw_response(self) -> AsyncRegistriesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncRegistriesResourceWithRawResponse(self) @@ -328,7 +328,7 @@ def with_streaming_response(self) -> AsyncRegistriesResourceWithStreamingRespons """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncRegistriesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index 08a10aae..b2d9c600 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -26,7 +26,7 @@ def with_raw_response(self) -> RepositoriesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return RepositoriesResourceWithRawResponse(self) @@ -35,7 +35,7 @@ def with_streaming_response(self) -> RepositoriesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return RepositoriesResourceWithStreamingResponse(self) @@ -125,7 +125,7 @@ def with_raw_response(self) -> AsyncRepositoriesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncRepositoriesResourceWithRawResponse(self) @@ -134,7 +134,7 @@ def with_streaming_response(self) -> AsyncRepositoriesResourceWithStreamingRespo """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncRepositoriesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index 0d98d281..3a8d39ea 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -25,7 +25,7 @@ def with_raw_response(self) -> TagsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return TagsResourceWithRawResponse(self) @@ -34,7 +34,7 @@ def with_streaming_response(self) -> TagsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return TagsResourceWithStreamingResponse(self) @@ -93,7 +93,7 @@ def with_raw_response(self) -> AsyncTagsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncTagsResourceWithRawResponse(self) @@ -102,7 +102,7 @@ def with_streaming_response(self) -> AsyncTagsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncTagsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index 469dc7f1..ddc36aca 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -32,7 +32,7 @@ def with_raw_response(self) -> UsersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return UsersResourceWithRawResponse(self) @@ -41,7 +41,7 @@ def with_streaming_response(self) -> UsersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return UsersResourceWithStreamingResponse(self) @@ -322,7 +322,7 @@ def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncUsersResourceWithRawResponse(self) @@ -331,7 +331,7 @@ def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncUsersResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index 55073b8f..bb2e32d1 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -46,7 +46,7 @@ def with_raw_response(self) -> ReservedFixedIPsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return ReservedFixedIPsResourceWithRawResponse(self) @@ -55,7 +55,7 @@ def with_streaming_response(self) -> ReservedFixedIPsResourceWithStreamingRespon """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return ReservedFixedIPsResourceWithStreamingResponse(self) @@ -467,7 +467,7 @@ def with_raw_response(self) -> AsyncReservedFixedIPsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncReservedFixedIPsResourceWithRawResponse(self) @@ -476,7 +476,7 @@ def with_streaming_response(self) -> AsyncReservedFixedIPsResourceWithStreamingR """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncReservedFixedIPsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 7f66a11e..5bfbd5c9 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -36,7 +36,7 @@ def with_raw_response(self) -> VipResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return VipResourceWithRawResponse(self) @@ -45,7 +45,7 @@ def with_streaming_response(self) -> VipResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return VipResourceWithStreamingResponse(self) @@ -268,7 +268,7 @@ def with_raw_response(self) -> AsyncVipResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncVipResourceWithRawResponse(self) @@ -277,7 +277,7 @@ def with_streaming_response(self) -> AsyncVipResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncVipResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 3b852ba2..6c5b747f 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -34,7 +34,7 @@ def with_raw_response(self) -> SecretsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return SecretsResourceWithRawResponse(self) @@ -43,7 +43,7 @@ def with_streaming_response(self) -> SecretsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return SecretsResourceWithStreamingResponse(self) @@ -336,7 +336,7 @@ def with_raw_response(self) -> AsyncSecretsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncSecretsResourceWithRawResponse(self) @@ -345,7 +345,7 @@ def with_streaming_response(self) -> AsyncSecretsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncSecretsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index 0cf89d57..105615d6 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -31,7 +31,7 @@ def with_raw_response(self) -> RulesResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return RulesResourceWithRawResponse(self) @@ -40,7 +40,7 @@ def with_streaming_response(self) -> RulesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return RulesResourceWithStreamingResponse(self) @@ -302,7 +302,7 @@ def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncRulesResourceWithRawResponse(self) @@ -311,7 +311,7 @@ def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncRulesResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 53b63372..a519821a 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -48,7 +48,7 @@ def with_raw_response(self) -> SecurityGroupsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return SecurityGroupsResourceWithRawResponse(self) @@ -57,7 +57,7 @@ def with_streaming_response(self) -> SecurityGroupsResourceWithStreamingResponse """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return SecurityGroupsResourceWithStreamingResponse(self) @@ -399,7 +399,7 @@ def with_raw_response(self) -> AsyncSecurityGroupsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncSecurityGroupsResourceWithRawResponse(self) @@ -408,7 +408,7 @@ def with_streaming_response(self) -> AsyncSecurityGroupsResourceWithStreamingRes """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncSecurityGroupsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index a7437398..e43bf03b 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -32,7 +32,7 @@ def with_raw_response(self) -> SSHKeysResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return SSHKeysResourceWithRawResponse(self) @@ -41,7 +41,7 @@ def with_streaming_response(self) -> SSHKeysResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return SSHKeysResourceWithStreamingResponse(self) @@ -294,7 +294,7 @@ def with_raw_response(self) -> AsyncSSHKeysResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncSSHKeysResourceWithRawResponse(self) @@ -303,7 +303,7 @@ def with_streaming_response(self) -> AsyncSSHKeysResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncSSHKeysResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 379ea8da..c6ae3799 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -33,7 +33,7 @@ def with_raw_response(self) -> TasksResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return TasksResourceWithRawResponse(self) @@ -42,7 +42,7 @@ def with_streaming_response(self) -> TasksResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return TasksResourceWithStreamingResponse(self) @@ -298,7 +298,7 @@ def with_raw_response(self) -> AsyncTasksResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncTasksResourceWithRawResponse(self) @@ -307,7 +307,7 @@ def with_streaming_response(self) -> AsyncTasksResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncTasksResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 634cfdfc..dff0b585 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -36,7 +36,7 @@ def with_raw_response(self) -> RoleAssignmentsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return RoleAssignmentsResourceWithRawResponse(self) @@ -45,7 +45,7 @@ def with_streaming_response(self) -> RoleAssignmentsResourceWithStreamingRespons """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return RoleAssignmentsResourceWithStreamingResponse(self) @@ -252,7 +252,7 @@ def with_raw_response(self) -> AsyncRoleAssignmentsResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncRoleAssignmentsResourceWithRawResponse(self) @@ -261,7 +261,7 @@ def with_streaming_response(self) -> AsyncRoleAssignmentsResourceWithStreamingRe """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncRoleAssignmentsResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/users/users.py b/src/gcore/resources/cloud/users/users.py index 0be8524c..f70eabac 100644 --- a/src/gcore/resources/cloud/users/users.py +++ b/src/gcore/resources/cloud/users/users.py @@ -27,7 +27,7 @@ def with_raw_response(self) -> UsersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return UsersResourceWithRawResponse(self) @@ -36,7 +36,7 @@ def with_streaming_response(self) -> UsersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return UsersResourceWithStreamingResponse(self) @@ -52,7 +52,7 @@ def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncUsersResourceWithRawResponse(self) @@ -61,7 +61,7 @@ def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncUsersResourceWithStreamingResponse(self) diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 28522f6d..5ccab79c 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -43,7 +43,7 @@ def with_raw_response(self) -> VolumesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return VolumesResourceWithRawResponse(self) @@ -52,7 +52,7 @@ def with_streaming_response(self) -> VolumesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return VolumesResourceWithStreamingResponse(self) @@ -807,7 +807,7 @@ def with_raw_response(self) -> AsyncVolumesResourceWithRawResponse: 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/stainless-sdks/gcore-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ return AsyncVolumesResourceWithRawResponse(self) @@ -816,7 +816,7 @@ def with_streaming_response(self) -> AsyncVolumesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/gcore-python#with_streaming_response + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ return AsyncVolumesResourceWithStreamingResponse(self) From 6b0b030a7c8e22f7941807bc07b7025da1b4720c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 12:19:35 +0000 Subject: [PATCH 104/592] chore: update SDK settings --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index c90ab4ec..be2a83c9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-93bed74b07499c4150b58296e09ef29a6430bbcb0bbfe43fe4822d4442aea2ad.yml openapi_spec_hash: 6a9812343eab85c2b9191e56768f933b -config_hash: dbe8b1c46254ce615e8fb8145e201ded +config_hash: 70677d790e8718423b80f25eff3e4ab5 From e71fe29b57d4a442f2598bcfcc7cd832a0d88769 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 14:02:39 +0000 Subject: [PATCH 105/592] docs: update links --- .stats.yml | 2 +- README.md | 2 +- SECURITY.md | 2 +- pyproject.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index be2a83c9..8a08688c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-93bed74b07499c4150b58296e09ef29a6430bbcb0bbfe43fe4822d4442aea2ad.yml openapi_spec_hash: 6a9812343eab85c2b9191e56768f933b -config_hash: 70677d790e8718423b80f25eff3e4ab5 +config_hash: 613578f16be9adefe1a3221934359363 diff --git a/README.md b/README.md index 2cff9dc3..66bf40c7 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ It is generated with [Stainless](https://www.stainless.com/). ## Documentation -The REST API documentation can be found on [docs.gcore.com](https://docs.gcore.com). The full API of this library can be found in [api.md](api.md). +The REST API documentation can be found on [api.gcore.com](https://api.gcore.com/docs). The full API of this library can be found in [api.md](api.md). ## Installation diff --git a/SECURITY.md b/SECURITY.md index a3db2db2..0a8609cd 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -20,7 +20,7 @@ or products provided by Gcore please follow the respective company's security re ### Gcore Terms and Policies -Please contact dev-feedback@gcore.com for any questions or concerns regarding security of our services. +Please contact support@gcore.com for any questions or concerns regarding security of our services. --- diff --git a/pyproject.toml b/pyproject.toml index 6db93223..bc03a604 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ description = "The official Python library for the gcore API" dynamic = ["readme"] license = "Apache-2.0" authors = [ -{ name = "Gcore", email = "dev-feedback@gcore.com" }, +{ name = "Gcore", email = "support@gcore.com" }, ] dependencies = [ "httpx>=0.23.0, <1", From 52d16b50f0ba7943a3f7cea2acebee9771897919 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 15:09:40 +0000 Subject: [PATCH 106/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c4762802..ba6c3483 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.1-alpha.0" + ".": "0.1.0-alpha.1" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index bc03a604..3d277732 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.0.1-alpha.0" +version = "0.1.0-alpha.1" 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 65e3082f..6dc59edd 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.0.1-alpha.0" # x-release-please-version +__version__ = "0.1.0-alpha.1" # x-release-please-version From a7faf4ec9dd34239aaf4b089337651802828fdec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 16:17:47 +0000 Subject: [PATCH 107/592] docs: enable pypi publishing --- .stats.yml | 2 +- README.md | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8a08688c..7c8ee594 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-93bed74b07499c4150b58296e09ef29a6430bbcb0bbfe43fe4822d4442aea2ad.yml openapi_spec_hash: 6a9812343eab85c2b9191e56768f933b -config_hash: 613578f16be9adefe1a3221934359363 +config_hash: 9d4b96e2d062330f65e1757c505ce46b diff --git a/README.md b/README.md index 66bf40c7..aa665cf3 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,10 @@ The REST API documentation can be found on [api.gcore.com](https://api.gcore.com ## Installation ```sh -# install from the production repo -pip install git+ssh://git@github.com/G-Core/gcore-python.git +# install from PyPI +pip install --pre gcore ``` -> [!NOTE] -> Once this package is [published to PyPI](https://app.stainless.com/docs/guides/publish), this will become: `pip install --pre gcore` - ## Usage The full API of this library can be found in [api.md](api.md). From 4ff5bba34f988b8cb19b02bede41b85743cb878a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 16:21:42 +0000 Subject: [PATCH 108/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ba6c3483..f14b480a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.1" + ".": "0.1.0-alpha.2" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 3d277732..185efb79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.1.0-alpha.1" +version = "0.1.0-alpha.2" 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 6dc59edd..e8caacba 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.1.0-alpha.1" # x-release-please-version +__version__ = "0.1.0-alpha.2" # x-release-please-version From b7c131f5f27df9aa6aac921f61b3bb05a2e91e46 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 18:10:00 +0000 Subject: [PATCH 109/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7c8ee594..0180e79c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-93bed74b07499c4150b58296e09ef29a6430bbcb0bbfe43fe4822d4442aea2ad.yml -openapi_spec_hash: 6a9812343eab85c2b9191e56768f933b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-edabd3ea6830d8d42bcf3f445ed53d2ca73cea9bf46a7afd16e6c86dee97cf63.yml +openapi_spec_hash: daa678971550a68bab85a62eba8ffa5e config_hash: 9d4b96e2d062330f65e1757c505ce46b From e2bec3a6be49a607dd0a3847f2546ae2fc0a729d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 May 2025 15:26:23 +0000 Subject: [PATCH 110/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 0180e79c..c779e4a7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-edabd3ea6830d8d42bcf3f445ed53d2ca73cea9bf46a7afd16e6c86dee97cf63.yml openapi_spec_hash: daa678971550a68bab85a62eba8ffa5e -config_hash: 9d4b96e2d062330f65e1757c505ce46b +config_hash: 0cda837de45a51a9b60246ffb22604e8 From 14e0c9ed5d52950fdba27f2dd0245058e314def8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 May 2025 16:09:26 +0000 Subject: [PATCH 111/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c779e4a7..e05e20d2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-edabd3ea6830d8d42bcf3f445ed53d2ca73cea9bf46a7afd16e6c86dee97cf63.yml -openapi_spec_hash: daa678971550a68bab85a62eba8ffa5e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b76145629dcc7d96b116490429fbcb6fb4a9c12a3d0a738078a681973c14081d.yml +openapi_spec_hash: 92240813810f5bc1b57c044484ca978e config_hash: 0cda837de45a51a9b60246ffb22604e8 From b3d639639eee2af75b4fdffe4298c0efeec98ee7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 09:27:07 +0000 Subject: [PATCH 112/592] GCLOUD2-18968 Enable breaking change detection --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ .stats.yml | 2 +- scripts/detect-breaking-changes | 9 +++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100755 scripts/detect-breaking-changes diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df7f57ac..713b26df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,3 +50,35 @@ jobs: - name: Run tests run: ./scripts/test + + detect_breaking_changes: + name: detect-breaking-changes + if: github.event_name == 'pull_request' + # Don't try to detect breaking changes if linting fails with the change. That means it's already failing + # and will likely fail at an earlier revision for the same reason, which doesn't indicate a breaking + # change. + needs: lint + runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + steps: + - name: Calculate fetch-depth + run: | + echo "FETCH_DEPTH=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_ENV + + - uses: actions/checkout@v4 + with: + # Ensure we can check out the pull request base in the script below. + fetch-depth: ${{ env.FETCH_DEPTH }} + + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + - name: Install dependencies + run: | + rye sync --all-features + + - name: Detect breaking changes + run: ./scripts/detect-breaking-changes ${{ github.event.pull_request.base.sha }} diff --git a/.stats.yml b/.stats.yml index e05e20d2..bda62306 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b76145629dcc7d96b116490429fbcb6fb4a9c12a3d0a738078a681973c14081d.yml openapi_spec_hash: 92240813810f5bc1b57c044484ca978e -config_hash: 0cda837de45a51a9b60246ffb22604e8 +config_hash: 4ce0219e37d7ed52a8e999f415c64cd6 diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes new file mode 100755 index 00000000..e64fdb16 --- /dev/null +++ b/scripts/detect-breaking-changes @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +echo "==> Detecting breaking changes" +git checkout "$1" -- tests/api_resources tests/test_client.py tests/test_response.py +./scripts/lint From 2a4b62b2f1e783b2d8ef1bd0e74cb19d6eaab6dd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 14:09:13 +0000 Subject: [PATCH 113/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cloud/networks/networks.py | 88 ++++++-- src/gcore/types/cloud/network.py | 42 ++-- .../types/cloud/network_create_params.py | 2 + src/gcore/types/cloud/network_details.py | 47 ++-- src/gcore/types/cloud/network_list_params.py | 25 ++- .../types/cloud/network_update_params.py | 2 + tests/api_resources/cloud/test_networks.py | 208 +++++++++--------- 8 files changed, 242 insertions(+), 176 deletions(-) diff --git a/.stats.yml b/.stats.yml index bda62306..c329a00a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b76145629dcc7d96b116490429fbcb6fb4a9c12a3d0a738078a681973c14081d.yml -openapi_spec_hash: 92240813810f5bc1b57c044484ca978e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-516ce876afb897cc3b1c0018510f6e5fb3d35fd8a5323ba374e7f115a7e825af.yml +openapi_spec_hash: 3738369958f249df6dcff1d73f71b8d9 config_hash: 4ce0219e37d7ed52a8e999f415c64cd6 diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index f5eb2317..2d64b29a 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -91,6 +91,10 @@ def create( Create network Args: + project_id: Project ID + + region_id: Region ID + name: Network name create_router: Defaults to True @@ -150,6 +154,12 @@ def update( Change network name Args: + project_id: Project ID + + region_id: Region ID + + network_id: Network ID + name: Name. extra_headers: Send extra headers @@ -182,7 +192,7 @@ def list( region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, tag_key: List[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -196,17 +206,23 @@ def list( List networks Args: - limit: Limit the number of returned limit request entities. + project_id: Project ID + + region_id: Region ID + + limit: Optional. Limit the number of returned items - offset: Offset value is used to exclude the first set of records from the result. + offset: Optional. Offset value is used to exclude the first set of records from the + result - order_by: Order networks by fields and directions (name.asc). Default is `created_at.asc`. + order_by: Ordering networks list result by `name`, `created_at` fields of the network and + directions (`created_at.desc`). - tag_key: Filter by tag keys. + tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G - --data-urlencode "tag_key_value={"key": "value"}" --url - "http://localhost:1111/v1/networks/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode + "tag_key_value={"key": "value"}" --url + "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers @@ -259,6 +275,12 @@ def delete( Delete network Args: + project_id: Project ID + + region_id: Region ID + + network_id: Network ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -298,6 +320,12 @@ def get( Get network Args: + project_id: Project ID + + region_id: Region ID + + network_id: Network ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -369,6 +397,10 @@ async def create( Create network Args: + project_id: Project ID + + region_id: Region ID + name: Network name create_router: Defaults to True @@ -428,6 +460,12 @@ async def update( Change network name Args: + project_id: Project ID + + region_id: Region ID + + network_id: Network ID + name: Name. extra_headers: Send extra headers @@ -460,7 +498,7 @@ def list( region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, tag_key: List[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -474,17 +512,23 @@ def list( List networks Args: - limit: Limit the number of returned limit request entities. + project_id: Project ID + + region_id: Region ID + + limit: Optional. Limit the number of returned items - offset: Offset value is used to exclude the first set of records from the result. + offset: Optional. Offset value is used to exclude the first set of records from the + result - order_by: Order networks by fields and directions (name.asc). Default is `created_at.asc`. + order_by: Ordering networks list result by `name`, `created_at` fields of the network and + directions (`created_at.desc`). - tag_key: Filter by tag keys. + tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G - --data-urlencode "tag_key_value={"key": "value"}" --url - "http://localhost:1111/v1/networks/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode + "tag_key_value={"key": "value"}" --url + "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers @@ -537,6 +581,12 @@ async def delete( Delete network Args: + project_id: Project ID + + region_id: Region ID + + network_id: Network ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -576,6 +626,12 @@ async def get( Get network Args: + project_id: Project ID + + region_id: Region ID + + network_id: Network ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/types/cloud/network.py b/src/gcore/types/cloud/network.py index 6f9382ce..c0010966 100644 --- a/src/gcore/types/cloud/network.py +++ b/src/gcore/types/cloud/network.py @@ -16,9 +16,18 @@ class Network(BaseModel): created_at: datetime """Datetime when the network was created""" + creator_task_id: Optional[str] = None + """Task that created this entity""" + + default: Optional[bool] = None + """True if network has is_default attribute""" + external: bool """True if the network `router:external` attribute""" + mtu: int + """MTU (maximum transmission unit). Default value is 1450""" + name: str """Network name""" @@ -28,12 +37,18 @@ class Network(BaseModel): ports. """ + project_id: Optional[int] = None + """Project ID""" + region: str """Region name""" region_id: int """Region ID""" + segmentation_id: Optional[int] = None + """Id of network segment""" + shared: bool """True when the network is shared with your project by external owner""" @@ -50,30 +65,15 @@ class Network(BaseModel): values. """ - type: str - """Network type (vlan, vxlan)""" - - updated_at: datetime - """Datetime when the network was last updated""" - - creator_task_id: Optional[str] = None - """Task that created this entity""" - - default: Optional[bool] = None - """True if network has is_default attribute""" - - mtu: Optional[int] = None - """MTU (maximum transmission unit). Default value is 1450""" - - project_id: Optional[int] = None - """Project ID""" - - segmentation_id: Optional[int] = None - """Id of network segment""" - task_id: Optional[str] = None """The UUID of the active task that currently holds a lock on the resource. This lock prevents concurrent modifications to ensure consistency. If `null`, the resource is not locked. """ + + type: str + """Network type (vlan, vxlan)""" + + updated_at: datetime + """Datetime when the network was last updated""" diff --git a/src/gcore/types/cloud/network_create_params.py b/src/gcore/types/cloud/network_create_params.py index a406792a..a91d5bec 100644 --- a/src/gcore/types/cloud/network_create_params.py +++ b/src/gcore/types/cloud/network_create_params.py @@ -11,8 +11,10 @@ class NetworkCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" name: Required[str] """Network name""" diff --git a/src/gcore/types/cloud/network_details.py b/src/gcore/types/cloud/network_details.py index 65313a3e..6d1ead06 100644 --- a/src/gcore/types/cloud/network_details.py +++ b/src/gcore/types/cloud/network_details.py @@ -17,9 +17,18 @@ class NetworkDetails(BaseModel): created_at: datetime """Datetime when the network was created""" + creator_task_id: Optional[str] = None + """Task that created this entity""" + + default: Optional[bool] = None + """True if network has is_default attribute""" + external: bool """True if the network `router:external` attribute""" + mtu: int + """MTU (maximum transmission unit). Default value is 1450""" + name: str """Network name""" @@ -29,15 +38,24 @@ class NetworkDetails(BaseModel): ports. """ + project_id: Optional[int] = None + """Project ID""" + region: str """Region name""" region_id: int """Region ID""" + segmentation_id: Optional[int] = None + """Id of network segment""" + shared: bool """True when the network is shared with your project by external owner""" + subnets: List[Subnet] + """List of subnets associated with the network""" + tags: List[Tag] """List of key-value tags associated with the resource. @@ -48,32 +66,15 @@ class NetworkDetails(BaseModel): values. """ - type: str - """Network type (vlan, vxlan)""" - - updated_at: datetime - """Datetime when the network was last updated""" - - creator_task_id: Optional[str] = None - """Task that created this entity""" - - default: Optional[bool] = None - """True if network has is_default attribute""" - - mtu: Optional[int] = None - """MTU (maximum transmission unit). Default value is 1450""" - - project_id: Optional[int] = None - """Project ID""" - - segmentation_id: Optional[int] = None - """Id of network segment""" - - subnets: Optional[List[Subnet]] = None - task_id: Optional[str] = None """The UUID of the active task that currently holds a lock on the resource. This lock prevents concurrent modifications to ensure consistency. If `null`, the resource is not locked. """ + + type: str + """Network type (vlan, vxlan)""" + + updated_at: datetime + """Datetime when the network was last updated""" diff --git a/src/gcore/types/cloud/network_list_params.py b/src/gcore/types/cloud/network_list_params.py index a2d51979..036239fc 100644 --- a/src/gcore/types/cloud/network_list_params.py +++ b/src/gcore/types/cloud/network_list_params.py @@ -3,34 +3,39 @@ from __future__ import annotations from typing import List -from typing_extensions import TypedDict +from typing_extensions import Literal, TypedDict __all__ = ["NetworkListParams"] class NetworkListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" limit: int - """Limit the number of returned limit request entities.""" + """Optional. Limit the number of returned items""" offset: int - """Offset value is used to exclude the first set of records from the result.""" + """Optional. - order_by: str - """Order networks by fields and directions (name.asc). + Offset value is used to exclude the first set of records from the result + """ - Default is `created_at.asc`. + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] + """ + Ordering networks list result by `name`, `created_at` fields of the network and + directions (`created_at.desc`). """ tag_key: List[str] - """Filter by tag keys.""" + """Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2""" tag_key_value: str - """Filter by tag key-value pairs. + """Optional. - Must be a valid JSON string. curl -G --data-urlencode "tag_key_value={"key": - "value"}" --url "http://localhost:1111/v1/networks/1/1" + Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": + "value"}" --url "https://example.com/cloud/v1/resource/1/1" """ diff --git a/src/gcore/types/cloud/network_update_params.py b/src/gcore/types/cloud/network_update_params.py index 750428f4..8319b067 100644 --- a/src/gcore/types/cloud/network_update_params.py +++ b/src/gcore/types/cloud/network_update_params.py @@ -9,8 +9,10 @@ class NetworkUpdateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" name: Required[str] """Name.""" diff --git a/tests/api_resources/cloud/test_networks.py b/tests/api_resources/cloud/test_networks.py index 5c363241..7380d239 100644 --- a/tests/api_resources/cloud/test_networks.py +++ b/tests/api_resources/cloud/test_networks.py @@ -24,8 +24,8 @@ class TestNetworks: @parametrize def test_method_create(self, client: Gcore) -> None: network = client.cloud.networks.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="my network", ) assert_matches_type(TaskIDList, network, path=["response"]) @@ -33,8 +33,8 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: network = client.cloud.networks.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="my network", create_router=True, tags={"foo": "my-tag-value"}, @@ -45,8 +45,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.networks.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="my network", ) @@ -58,8 +58,8 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.networks.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="my network", ) as response: assert not response.is_closed @@ -73,9 +73,9 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: network = client.cloud.networks.update( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, name="some_name", ) assert_matches_type(Network, network, path=["response"]) @@ -83,9 +83,9 @@ def test_method_update(self, client: Gcore) -> None: @parametrize def test_raw_response_update(self, client: Gcore) -> None: response = client.cloud.networks.with_raw_response.update( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, name="some_name", ) @@ -97,9 +97,9 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: with client.cloud.networks.with_streaming_response.update( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, name="some_name", ) as response: assert not response.is_closed @@ -115,28 +115,28 @@ def test_path_params_update(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): client.cloud.networks.with_raw_response.update( network_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="some_name", ) @parametrize def test_method_list(self, client: Gcore) -> None: network = client.cloud.networks.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert_matches_type(SyncOffsetPage[Network], network, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: network = client.cloud.networks.list( - project_id=0, - region_id=0, - limit=0, + project_id=1, + region_id=1, + limit=1000, offset=0, - order_by="order_by", - tag_key=["string"], + order_by="created_at.desc", + tag_key=["key1", "key2"], tag_key_value="tag_key_value", ) assert_matches_type(SyncOffsetPage[Network], network, path=["response"]) @@ -144,8 +144,8 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.networks.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -156,8 +156,8 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.networks.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -170,18 +170,18 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: network = client.cloud.networks.delete( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, network, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.networks.with_raw_response.delete( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -192,9 +192,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.networks.with_streaming_response.delete( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -209,25 +209,25 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): client.cloud.networks.with_raw_response.delete( network_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_get(self, client: Gcore) -> None: network = client.cloud.networks.get( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, ) assert_matches_type(Network, network, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.networks.with_raw_response.get( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -238,9 +238,9 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.networks.with_streaming_response.get( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -255,8 +255,8 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): client.cloud.networks.with_raw_response.get( network_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @@ -266,8 +266,8 @@ class TestAsyncNetworks: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: network = await async_client.cloud.networks.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="my network", ) assert_matches_type(TaskIDList, network, path=["response"]) @@ -275,8 +275,8 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: network = await async_client.cloud.networks.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="my network", create_router=True, tags={"foo": "my-tag-value"}, @@ -287,8 +287,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.networks.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="my network", ) @@ -300,8 +300,8 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.networks.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="my network", ) as response: assert not response.is_closed @@ -315,9 +315,9 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: network = await async_client.cloud.networks.update( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, name="some_name", ) assert_matches_type(Network, network, path=["response"]) @@ -325,9 +325,9 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.networks.with_raw_response.update( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, name="some_name", ) @@ -339,9 +339,9 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.cloud.networks.with_streaming_response.update( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, name="some_name", ) as response: assert not response.is_closed @@ -357,28 +357,28 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): await async_client.cloud.networks.with_raw_response.update( network_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="some_name", ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: network = await async_client.cloud.networks.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert_matches_type(AsyncOffsetPage[Network], network, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: network = await async_client.cloud.networks.list( - project_id=0, - region_id=0, - limit=0, + project_id=1, + region_id=1, + limit=1000, offset=0, - order_by="order_by", - tag_key=["string"], + order_by="created_at.desc", + tag_key=["key1", "key2"], tag_key_value="tag_key_value", ) assert_matches_type(AsyncOffsetPage[Network], network, path=["response"]) @@ -386,8 +386,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.networks.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -398,8 +398,8 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.networks.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -412,18 +412,18 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: network = await async_client.cloud.networks.delete( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, network, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.networks.with_raw_response.delete( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -434,9 +434,9 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.networks.with_streaming_response.delete( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -451,25 +451,25 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): await async_client.cloud.networks.with_raw_response.delete( network_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: network = await async_client.cloud.networks.get( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, ) assert_matches_type(Network, network, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.networks.with_raw_response.get( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -480,9 +480,9 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.cloud.networks.with_streaming_response.get( - network_id="network_id", - project_id=0, - region_id=0, + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -497,6 +497,6 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `network_id` but received ''"): await async_client.cloud.networks.with_raw_response.get( network_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) From c4ec46a7b8edf156491de5999687466dc6ac6a5d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 18:10:13 +0000 Subject: [PATCH 114/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c329a00a..a3760b21 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 228 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-516ce876afb897cc3b1c0018510f6e5fb3d35fd8a5323ba374e7f115a7e825af.yml -openapi_spec_hash: 3738369958f249df6dcff1d73f71b8d9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c7630e687e27c997adafc3bbebabf19108a03056e909983bf057f8aa6cc66b83.yml +openapi_spec_hash: abd8303b18b3d632d96aa404500b84b5 config_hash: 4ce0219e37d7ed52a8e999f415c64cd6 From 1b680ae86ea3e7976e50bd3defc29af132694802 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 04:45:10 +0000 Subject: [PATCH 115/592] chore(internal): avoid errors for isinstance checks on proxies --- src/gcore/_utils/_proxy.py | 5 ++++- tests/test_utils/test_proxy.py | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gcore/_utils/_proxy.py b/src/gcore/_utils/_proxy.py index ffd883e9..0f239a33 100644 --- a/src/gcore/_utils/_proxy.py +++ b/src/gcore/_utils/_proxy.py @@ -46,7 +46,10 @@ def __dir__(self) -> Iterable[str]: @property # type: ignore @override def __class__(self) -> type: # pyright: ignore - proxied = self.__get_proxied__() + try: + proxied = self.__get_proxied__() + except Exception: + return type(self) if issubclass(type(proxied), LazyProxy): return type(proxied) return proxied.__class__ diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py index 1122b27d..f7b2b9ee 100644 --- a/tests/test_utils/test_proxy.py +++ b/tests/test_utils/test_proxy.py @@ -21,3 +21,14 @@ def test_recursive_proxy() -> None: assert dir(proxy) == [] assert type(proxy).__name__ == "RecursiveLazyProxy" assert type(operator.attrgetter("name.foo.bar.baz")(proxy)).__name__ == "RecursiveLazyProxy" + + +def test_isinstance_does_not_error() -> None: + class AlwaysErrorProxy(LazyProxy[Any]): + @override + def __load__(self) -> Any: + raise RuntimeError("Mocking missing dependency") + + proxy = AlwaysErrorProxy() + assert not isinstance(proxy, dict) + assert isinstance(proxy, LazyProxy) From 702b13f15821120a3b074dced767d8386ed83964 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 04:49:49 +0000 Subject: [PATCH 116/592] docs: remove or fix invalid readme examples --- README.md | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/README.md b/README.md index aa665cf3..3f76a235 100644 --- a/README.md +++ b/README.md @@ -150,38 +150,6 @@ for project in first_page.results: # Remove `await` for non-async usage. ``` -## Nested params - -Nested parameters are dictionaries, typed using `TypedDict`, for example: - -```python -from gcore import Gcore - -client = Gcore() - -task_id_list = client.cloud.instances.create( - project_id=1, - region_id=1, - flavor="g1-standard-1-2", - interfaces=[{"subnet_id": "your-subnet-uuid"}], - volumes=[ - { - "image_id": "your-image-uuid", - "size": 50, - "type_name": "standard", - "is_bootable": True, - }, - { - "size": 100, - "type_name": "ssd_hiiops", - "is_bootable": False, - }, - ], - user_data="IyEvYmluL2Jhc2gKZWNobyAiSGVsbG8sIFdvcmxkISIgPj4gL3RtcC9jbG91ZC1pbml0Lm91dAo=", -) -print(task_id_list.tasks) -``` - ## Handling errors When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `gcore.APIConnectionError` is raised. From cbc7c380d201b5e9b859640dafe458f4c70776db Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 09:45:32 +0000 Subject: [PATCH 117/592] GCLOUD2-18994 add WAAP --- .stats.yml | 4 +- api.md | 31 ++ src/gcore/_client.py | 9 + src/gcore/resources/__init__.py | 14 + src/gcore/resources/waap/__init__.py | 33 ++ src/gcore/resources/waap/domains/__init__.py | 33 ++ src/gcore/resources/waap/domains/domains.py | 515 ++++++++++++++++++ src/gcore/resources/waap/domains/settings.py | 271 +++++++++ src/gcore/resources/waap/waap.py | 102 ++++ src/gcore/types/waap/__init__.py | 12 + src/gcore/types/waap/domain_list_params.py | 30 + src/gcore/types/waap/domain_update_params.py | 12 + src/gcore/types/waap/domains/__init__.py | 5 + .../waap/domains/setting_update_params.py | 41 ++ src/gcore/types/waap/waap_api_urls.py | 15 + src/gcore/types/waap/waap_detailed_domain.py | 37 ++ .../types/waap/waap_domain_ddos_settings.py | 31 ++ src/gcore/types/waap/waap_domain_settings.py | 15 + src/gcore/types/waap/waap_domain_status.py | 7 + src/gcore/types/waap/waap_summary_domain.py | 26 + tests/api_resources/waap/__init__.py | 1 + tests/api_resources/waap/domains/__init__.py | 1 + .../waap/domains/test_settings.py | 170 ++++++ tests/api_resources/waap/test_domains.py | 302 ++++++++++ 24 files changed, 1715 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/waap/__init__.py create mode 100644 src/gcore/resources/waap/domains/__init__.py create mode 100644 src/gcore/resources/waap/domains/domains.py create mode 100644 src/gcore/resources/waap/domains/settings.py create mode 100644 src/gcore/resources/waap/waap.py create mode 100644 src/gcore/types/waap/__init__.py create mode 100644 src/gcore/types/waap/domain_list_params.py create mode 100644 src/gcore/types/waap/domain_update_params.py create mode 100644 src/gcore/types/waap/domains/__init__.py create mode 100644 src/gcore/types/waap/domains/setting_update_params.py create mode 100644 src/gcore/types/waap/waap_api_urls.py create mode 100644 src/gcore/types/waap/waap_detailed_domain.py create mode 100644 src/gcore/types/waap/waap_domain_ddos_settings.py create mode 100644 src/gcore/types/waap/waap_domain_settings.py create mode 100644 src/gcore/types/waap/waap_domain_status.py create mode 100644 src/gcore/types/waap/waap_summary_domain.py create mode 100644 tests/api_resources/waap/__init__.py create mode 100644 tests/api_resources/waap/domains/__init__.py create mode 100644 tests/api_resources/waap/domains/test_settings.py create mode 100644 tests/api_resources/waap/test_domains.py diff --git a/.stats.yml b/.stats.yml index a3760b21..d8a0e246 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 228 +configured_endpoints: 234 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c7630e687e27c997adafc3bbebabf19108a03056e909983bf057f8aa6cc66b83.yml openapi_spec_hash: abd8303b18b3d632d96aa404500b84b5 -config_hash: 4ce0219e37d7ed52a8e999f415c64cd6 +config_hash: 047d50bb070fced4bb9e05678a72b874 diff --git a/api.md b/api.md index e907e6d7..2dd78ec7 100644 --- a/api.md +++ b/api.md @@ -849,3 +849,34 @@ from gcore.types.cloud.instances import Metrics, MetricsList Methods: - client.cloud.instances.metrics.list(instance_id, \*, project_id, region_id, \*\*params) -> MetricsList + +# Waap + +Types: + +```python +from gcore.types.waap import ( + WaapAPIURLs, + WaapDetailedDomain, + WaapDomainDDOSSettings, + WaapDomainSettings, + WaapDomainStatus, + WaapSummaryDomain, +) +``` + +## Domains + +Methods: + +- client.waap.domains.update(domain_id, \*\*params) -> None +- client.waap.domains.list(\*\*params) -> SyncOffsetPage[WaapSummaryDomain] +- client.waap.domains.delete(domain_id) -> None +- client.waap.domains.get(domain_id) -> WaapDetailedDomain + +### Settings + +Methods: + +- client.waap.domains.settings.update(domain_id, \*\*params) -> None +- client.waap.domains.settings.get(domain_id) -> WaapDomainSettings diff --git a/src/gcore/_client.py b/src/gcore/_client.py index e3953335..009df272 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -28,6 +28,7 @@ SyncAPIClient, AsyncAPIClient, ) +from .resources.waap import waap from .resources.cloud import cloud __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Gcore", "AsyncGcore", "Client", "AsyncClient"] @@ -35,6 +36,7 @@ class Gcore(SyncAPIClient): cloud: cloud.CloudResource + waap: waap.WaapResource with_raw_response: GcoreWithRawResponse with_streaming_response: GcoreWithStreamedResponse @@ -114,6 +116,7 @@ def __init__( ) self.cloud = cloud.CloudResource(self) + self.waap = waap.WaapResource(self) self.with_raw_response = GcoreWithRawResponse(self) self.with_streaming_response = GcoreWithStreamedResponse(self) @@ -248,6 +251,7 @@ def _make_status_error( class AsyncGcore(AsyncAPIClient): cloud: cloud.AsyncCloudResource + waap: waap.AsyncWaapResource with_raw_response: AsyncGcoreWithRawResponse with_streaming_response: AsyncGcoreWithStreamedResponse @@ -327,6 +331,7 @@ def __init__( ) self.cloud = cloud.AsyncCloudResource(self) + self.waap = waap.AsyncWaapResource(self) self.with_raw_response = AsyncGcoreWithRawResponse(self) self.with_streaming_response = AsyncGcoreWithStreamedResponse(self) @@ -462,21 +467,25 @@ def _make_status_error( class GcoreWithRawResponse: def __init__(self, client: Gcore) -> None: self.cloud = cloud.CloudResourceWithRawResponse(client.cloud) + self.waap = waap.WaapResourceWithRawResponse(client.waap) class AsyncGcoreWithRawResponse: def __init__(self, client: AsyncGcore) -> None: self.cloud = cloud.AsyncCloudResourceWithRawResponse(client.cloud) + self.waap = waap.AsyncWaapResourceWithRawResponse(client.waap) class GcoreWithStreamedResponse: def __init__(self, client: Gcore) -> None: self.cloud = cloud.CloudResourceWithStreamingResponse(client.cloud) + self.waap = waap.WaapResourceWithStreamingResponse(client.waap) class AsyncGcoreWithStreamedResponse: def __init__(self, client: AsyncGcore) -> None: self.cloud = cloud.AsyncCloudResourceWithStreamingResponse(client.cloud) + self.waap = waap.AsyncWaapResourceWithStreamingResponse(client.waap) Client = Gcore diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py index 628e0c1c..502dad77 100644 --- a/src/gcore/resources/__init__.py +++ b/src/gcore/resources/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .waap import ( + WaapResource, + AsyncWaapResource, + WaapResourceWithRawResponse, + AsyncWaapResourceWithRawResponse, + WaapResourceWithStreamingResponse, + AsyncWaapResourceWithStreamingResponse, +) from .cloud import ( CloudResource, AsyncCloudResource, @@ -16,4 +24,10 @@ "AsyncCloudResourceWithRawResponse", "CloudResourceWithStreamingResponse", "AsyncCloudResourceWithStreamingResponse", + "WaapResource", + "AsyncWaapResource", + "WaapResourceWithRawResponse", + "AsyncWaapResourceWithRawResponse", + "WaapResourceWithStreamingResponse", + "AsyncWaapResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/waap/__init__.py b/src/gcore/resources/waap/__init__.py new file mode 100644 index 00000000..e4b6cbc9 --- /dev/null +++ b/src/gcore/resources/waap/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .waap import ( + WaapResource, + AsyncWaapResource, + WaapResourceWithRawResponse, + AsyncWaapResourceWithRawResponse, + WaapResourceWithStreamingResponse, + AsyncWaapResourceWithStreamingResponse, +) +from .domains import ( + DomainsResource, + AsyncDomainsResource, + DomainsResourceWithRawResponse, + AsyncDomainsResourceWithRawResponse, + DomainsResourceWithStreamingResponse, + AsyncDomainsResourceWithStreamingResponse, +) + +__all__ = [ + "DomainsResource", + "AsyncDomainsResource", + "DomainsResourceWithRawResponse", + "AsyncDomainsResourceWithRawResponse", + "DomainsResourceWithStreamingResponse", + "AsyncDomainsResourceWithStreamingResponse", + "WaapResource", + "AsyncWaapResource", + "WaapResourceWithRawResponse", + "AsyncWaapResourceWithRawResponse", + "WaapResourceWithStreamingResponse", + "AsyncWaapResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/waap/domains/__init__.py b/src/gcore/resources/waap/domains/__init__.py new file mode 100644 index 00000000..7af30ff1 --- /dev/null +++ b/src/gcore/resources/waap/domains/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .domains import ( + DomainsResource, + AsyncDomainsResource, + DomainsResourceWithRawResponse, + AsyncDomainsResourceWithRawResponse, + DomainsResourceWithStreamingResponse, + AsyncDomainsResourceWithStreamingResponse, +) +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) + +__all__ = [ + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "DomainsResource", + "AsyncDomainsResource", + "DomainsResourceWithRawResponse", + "AsyncDomainsResourceWithRawResponse", + "DomainsResourceWithStreamingResponse", + "AsyncDomainsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py new file mode 100644 index 00000000..21085a2a --- /dev/null +++ b/src/gcore/resources/waap/domains/domains.py @@ -0,0 +1,515 @@ +# 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 .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.waap import WaapDomainStatus, domain_list_params, domain_update_params +from ...._base_client import AsyncPaginator, make_request_options +from ....types.waap.waap_domain_status import WaapDomainStatus +from ....types.waap.waap_summary_domain import WaapSummaryDomain +from ....types.waap.waap_detailed_domain import WaapDetailedDomain + +__all__ = ["DomainsResource", "AsyncDomainsResource"] + + +class DomainsResource(SyncAPIResource): + @cached_property + def settings(self) -> SettingsResource: + return SettingsResource(self._client) + + @cached_property + def with_raw_response(self) -> DomainsResourceWithRawResponse: + """ + 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 DomainsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DomainsResourceWithStreamingResponse: + """ + 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 DomainsResourceWithStreamingResponse(self) + + def update( + self, + domain_id: int, + *, + status: Literal["active", "monitor"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Update Domain + + Args: + domain_id: The domain ID + + status: Domain statuses that can be used when updating a domain + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._patch( + f"/waap/v1/domains/{domain_id}", + body=maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + *, + ids: Iterable[int] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] + | NotGiven = NOT_GIVEN, + status: WaapDomainStatus | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[WaapSummaryDomain]: + """ + Retrieve a list of domains associated with the client + + Args: + ids: Filter domains based on their IDs + + limit: Number of items to return + + name: Filter domains based on the domain name. Supports '\\**' as a wildcard character + + offset: Number of items to skip + + ordering: Sort the response by given field. + + status: The different statuses a domain can have + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/waap/v1/domains", + page=SyncOffsetPage[WaapSummaryDomain], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "ids": ids, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + "status": status, + }, + domain_list_params.DomainListParams, + ), + ), + model=WaapSummaryDomain, + ) + + def delete( + self, + domain_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Delete an inactive domain by ID. + + Only domains with status 'bypass' can be + deleted. + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/waap/v1/domains/{domain_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + domain_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, + ) -> WaapDetailedDomain: + """ + Retrieve detailed information about a specific domain + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/waap/v1/domains/{domain_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapDetailedDomain, + ) + + +class AsyncDomainsResource(AsyncAPIResource): + @cached_property + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncDomainsResourceWithRawResponse: + """ + 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 AsyncDomainsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDomainsResourceWithStreamingResponse: + """ + 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 AsyncDomainsResourceWithStreamingResponse(self) + + async def update( + self, + domain_id: int, + *, + status: Literal["active", "monitor"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Update Domain + + Args: + domain_id: The domain ID + + status: Domain statuses that can be used when updating a domain + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._patch( + f"/waap/v1/domains/{domain_id}", + body=await async_maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + *, + ids: Iterable[int] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] + | NotGiven = NOT_GIVEN, + status: WaapDomainStatus | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[WaapSummaryDomain, AsyncOffsetPage[WaapSummaryDomain]]: + """ + Retrieve a list of domains associated with the client + + Args: + ids: Filter domains based on their IDs + + limit: Number of items to return + + name: Filter domains based on the domain name. Supports '\\**' as a wildcard character + + offset: Number of items to skip + + ordering: Sort the response by given field. + + status: The different statuses a domain can have + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/waap/v1/domains", + page=AsyncOffsetPage[WaapSummaryDomain], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "ids": ids, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + "status": status, + }, + domain_list_params.DomainListParams, + ), + ), + model=WaapSummaryDomain, + ) + + async def delete( + self, + domain_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Delete an inactive domain by ID. + + Only domains with status 'bypass' can be + deleted. + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/waap/v1/domains/{domain_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + domain_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, + ) -> WaapDetailedDomain: + """ + Retrieve detailed information about a specific domain + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/waap/v1/domains/{domain_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapDetailedDomain, + ) + + +class DomainsResourceWithRawResponse: + def __init__(self, domains: DomainsResource) -> None: + self._domains = domains + + self.update = to_raw_response_wrapper( + domains.update, + ) + self.list = to_raw_response_wrapper( + domains.list, + ) + self.delete = to_raw_response_wrapper( + domains.delete, + ) + self.get = to_raw_response_wrapper( + domains.get, + ) + + @cached_property + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._domains.settings) + + +class AsyncDomainsResourceWithRawResponse: + def __init__(self, domains: AsyncDomainsResource) -> None: + self._domains = domains + + self.update = async_to_raw_response_wrapper( + domains.update, + ) + self.list = async_to_raw_response_wrapper( + domains.list, + ) + self.delete = async_to_raw_response_wrapper( + domains.delete, + ) + self.get = async_to_raw_response_wrapper( + domains.get, + ) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._domains.settings) + + +class DomainsResourceWithStreamingResponse: + def __init__(self, domains: DomainsResource) -> None: + self._domains = domains + + self.update = to_streamed_response_wrapper( + domains.update, + ) + self.list = to_streamed_response_wrapper( + domains.list, + ) + self.delete = to_streamed_response_wrapper( + domains.delete, + ) + self.get = to_streamed_response_wrapper( + domains.get, + ) + + @cached_property + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._domains.settings) + + +class AsyncDomainsResourceWithStreamingResponse: + def __init__(self, domains: AsyncDomainsResource) -> None: + self._domains = domains + + self.update = async_to_streamed_response_wrapper( + domains.update, + ) + self.list = async_to_streamed_response_wrapper( + domains.list, + ) + self.delete = async_to_streamed_response_wrapper( + domains.delete, + ) + self.get = async_to_streamed_response_wrapper( + domains.get, + ) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._domains.settings) diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py new file mode 100644 index 00000000..63bc77df --- /dev/null +++ b/src/gcore/resources/waap/domains/settings.py @@ -0,0 +1,271 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.waap.domains import setting_update_params +from ....types.waap.waap_domain_settings import WaapDomainSettings + +__all__ = ["SettingsResource", "AsyncSettingsResource"] + + +class SettingsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SettingsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return SettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return SettingsResourceWithStreamingResponse(self) + + def update( + self, + domain_id: int, + *, + api: setting_update_params.API | NotGiven = NOT_GIVEN, + ddos: setting_update_params.DDOS | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Update settings for a specific domain + + Args: + domain_id: The domain ID + + api: Editable API settings of a domain + + ddos: Editable DDoS settings for a domain. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._patch( + f"/waap/v1/domains/{domain_id}/settings", + body=maybe_transform( + { + "api": api, + "ddos": ddos, + }, + setting_update_params.SettingUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + domain_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, + ) -> WaapDomainSettings: + """ + Retrieve settings for a specific domain + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/waap/v1/domains/{domain_id}/settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapDomainSettings, + ) + + +class AsyncSettingsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncSettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncSettingsResourceWithStreamingResponse(self) + + async def update( + self, + domain_id: int, + *, + api: setting_update_params.API | NotGiven = NOT_GIVEN, + ddos: setting_update_params.DDOS | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Update settings for a specific domain + + Args: + domain_id: The domain ID + + api: Editable API settings of a domain + + ddos: Editable DDoS settings for a domain. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._patch( + f"/waap/v1/domains/{domain_id}/settings", + body=await async_maybe_transform( + { + "api": api, + "ddos": ddos, + }, + setting_update_params.SettingUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + domain_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, + ) -> WaapDomainSettings: + """ + Retrieve settings for a specific domain + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/waap/v1/domains/{domain_id}/settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapDomainSettings, + ) + + +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings + + self.update = to_raw_response_wrapper( + settings.update, + ) + self.get = to_raw_response_wrapper( + settings.get, + ) + + +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings + + self.update = async_to_raw_response_wrapper( + settings.update, + ) + self.get = async_to_raw_response_wrapper( + settings.get, + ) + + +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings + + self.update = to_streamed_response_wrapper( + settings.update, + ) + self.get = to_streamed_response_wrapper( + settings.get, + ) + + +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings + + self.update = async_to_streamed_response_wrapper( + settings.update, + ) + self.get = async_to_streamed_response_wrapper( + settings.get, + ) diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py new file mode 100644 index 00000000..0fc8a330 --- /dev/null +++ b/src/gcore/resources/waap/waap.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from .domains.domains import ( + DomainsResource, + AsyncDomainsResource, + DomainsResourceWithRawResponse, + AsyncDomainsResourceWithRawResponse, + DomainsResourceWithStreamingResponse, + AsyncDomainsResourceWithStreamingResponse, +) + +__all__ = ["WaapResource", "AsyncWaapResource"] + + +class WaapResource(SyncAPIResource): + @cached_property + def domains(self) -> DomainsResource: + return DomainsResource(self._client) + + @cached_property + def with_raw_response(self) -> WaapResourceWithRawResponse: + """ + 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 WaapResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> WaapResourceWithStreamingResponse: + """ + 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 WaapResourceWithStreamingResponse(self) + + +class AsyncWaapResource(AsyncAPIResource): + @cached_property + def domains(self) -> AsyncDomainsResource: + return AsyncDomainsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncWaapResourceWithRawResponse: + """ + 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 AsyncWaapResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncWaapResourceWithStreamingResponse: + """ + 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 AsyncWaapResourceWithStreamingResponse(self) + + +class WaapResourceWithRawResponse: + def __init__(self, waap: WaapResource) -> None: + self._waap = waap + + @cached_property + def domains(self) -> DomainsResourceWithRawResponse: + return DomainsResourceWithRawResponse(self._waap.domains) + + +class AsyncWaapResourceWithRawResponse: + def __init__(self, waap: AsyncWaapResource) -> None: + self._waap = waap + + @cached_property + def domains(self) -> AsyncDomainsResourceWithRawResponse: + return AsyncDomainsResourceWithRawResponse(self._waap.domains) + + +class WaapResourceWithStreamingResponse: + def __init__(self, waap: WaapResource) -> None: + self._waap = waap + + @cached_property + def domains(self) -> DomainsResourceWithStreamingResponse: + return DomainsResourceWithStreamingResponse(self._waap.domains) + + +class AsyncWaapResourceWithStreamingResponse: + def __init__(self, waap: AsyncWaapResource) -> None: + self._waap = waap + + @cached_property + def domains(self) -> AsyncDomainsResourceWithStreamingResponse: + return AsyncDomainsResourceWithStreamingResponse(self._waap.domains) diff --git a/src/gcore/types/waap/__init__.py b/src/gcore/types/waap/__init__.py new file mode 100644 index 00000000..578e1aab --- /dev/null +++ b/src/gcore/types/waap/__init__.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .waap_api_urls import WaapAPIURLs as WaapAPIURLs +from .domain_list_params import DomainListParams as DomainListParams +from .waap_domain_status import WaapDomainStatus as WaapDomainStatus +from .waap_summary_domain import WaapSummaryDomain as WaapSummaryDomain +from .domain_update_params import DomainUpdateParams as DomainUpdateParams +from .waap_detailed_domain import WaapDetailedDomain as WaapDetailedDomain +from .waap_domain_settings import WaapDomainSettings as WaapDomainSettings +from .waap_domain_ddos_settings import WaapDomainDDOSSettings as WaapDomainDDOSSettings diff --git a/src/gcore/types/waap/domain_list_params.py b/src/gcore/types/waap/domain_list_params.py new file mode 100644 index 00000000..9e3412ff --- /dev/null +++ b/src/gcore/types/waap/domain_list_params.py @@ -0,0 +1,30 @@ +# 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, TypedDict + +from .waap_domain_status import WaapDomainStatus + +__all__ = ["DomainListParams"] + + +class DomainListParams(TypedDict, total=False): + ids: Iterable[int] + """Filter domains based on their IDs""" + + limit: int + """Number of items to return""" + + name: str + """Filter domains based on the domain name. Supports '\\**' as a wildcard character""" + + offset: int + """Number of items to skip""" + + ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] + """Sort the response by given field.""" + + status: WaapDomainStatus + """The different statuses a domain can have""" diff --git a/src/gcore/types/waap/domain_update_params.py b/src/gcore/types/waap/domain_update_params.py new file mode 100644 index 00000000..a9b8d477 --- /dev/null +++ b/src/gcore/types/waap/domain_update_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["DomainUpdateParams"] + + +class DomainUpdateParams(TypedDict, total=False): + status: Literal["active", "monitor"] + """Domain statuses that can be used when updating a domain""" diff --git a/src/gcore/types/waap/domains/__init__.py b/src/gcore/types/waap/domains/__init__.py new file mode 100644 index 00000000..6eb0310c --- /dev/null +++ b/src/gcore/types/waap/domains/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .setting_update_params import SettingUpdateParams as SettingUpdateParams diff --git a/src/gcore/types/waap/domains/setting_update_params.py b/src/gcore/types/waap/domains/setting_update_params.py new file mode 100644 index 00000000..da930b6f --- /dev/null +++ b/src/gcore/types/waap/domains/setting_update_params.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import TypedDict + +__all__ = ["SettingUpdateParams", "API", "DDOS"] + + +class SettingUpdateParams(TypedDict, total=False): + api: API + """Editable API settings of a domain""" + + ddos: DDOS + """Editable DDoS settings for a domain.""" + + +class API(TypedDict, total=False): + api_urls: List[str] + """The API URLs for a domain. + + If your domain has a common base URL for all API paths, it can be set here + """ + + +class DDOS(TypedDict, total=False): + burst_threshold: int + """The burst threshold detects sudden rises in traffic. + + If it is met and the number of requests is at least five times the last 2-second + interval, DDoS protection will activate. Default is 1000. + """ + + global_threshold: int + """ + The global threshold is responsible for identifying DDoS attacks with a slow + rise in traffic. If the threshold is met and the current number of requests is + at least double that of the previous 10-second window, DDoS protection will + activate. Default is 5000. + """ diff --git a/src/gcore/types/waap/waap_api_urls.py b/src/gcore/types/waap/waap_api_urls.py new file mode 100644 index 00000000..c49abfee --- /dev/null +++ b/src/gcore/types/waap/waap_api_urls.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__ = ["WaapAPIURLs"] + + +class WaapAPIURLs(BaseModel): + api_urls: Optional[List[str]] = None + """The API URLs for a domain. + + If your domain has a common base URL for all API paths, it can be set here + """ diff --git a/src/gcore/types/waap/waap_detailed_domain.py b/src/gcore/types/waap/waap_detailed_domain.py new file mode 100644 index 00000000..c0557bd7 --- /dev/null +++ b/src/gcore/types/waap/waap_detailed_domain.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional +from datetime import datetime + +from ..._models import BaseModel +from .waap_domain_status import WaapDomainStatus + +__all__ = ["WaapDetailedDomain", "Quotas"] + + +class Quotas(BaseModel): + allowed: int + """The maximum allowed number of this resource""" + + current: int + """The current number of this resource""" + + +class WaapDetailedDomain(BaseModel): + id: int + """The domain ID""" + + created_at: datetime + """The date and time the domain was created in ISO 8601 format""" + + custom_page_set: Optional[int] = None + """The ID of the custom page set""" + + name: str + """The domain name""" + + status: WaapDomainStatus + """The different statuses a domain can have""" + + quotas: Optional[Dict[str, Quotas]] = None + """Domain level quotas""" diff --git a/src/gcore/types/waap/waap_domain_ddos_settings.py b/src/gcore/types/waap/waap_domain_ddos_settings.py new file mode 100644 index 00000000..96970d0f --- /dev/null +++ b/src/gcore/types/waap/waap_domain_ddos_settings.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["WaapDomainDDOSSettings"] + + +class WaapDomainDDOSSettings(BaseModel): + burst_threshold: Optional[int] = None + """The burst threshold detects sudden rises in traffic. + + If it is met and the number of requests is at least five times the last 2-second + interval, DDoS protection will activate. Default is 1000. + """ + + global_threshold: Optional[int] = None + """ + The global threshold is responsible for identifying DDoS attacks with a slow + rise in traffic. If the threshold is met and the current number of requests is + at least double that of the previous 10-second window, DDoS protection will + activate. Default is 5000. + """ + + sub_second_threshold: Optional[int] = None + """ + The sub-second threshold protects WAAP servers against attacks from traffic + bursts. When this threshold is reached, the DDoS mode will activate on the + affected WAAP server, not the whole WAAP cluster. Default is 50. + """ diff --git a/src/gcore/types/waap/waap_domain_settings.py b/src/gcore/types/waap/waap_domain_settings.py new file mode 100644 index 00000000..7b51d05e --- /dev/null +++ b/src/gcore/types/waap/waap_domain_settings.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from .waap_api_urls import WaapAPIURLs +from .waap_domain_ddos_settings import WaapDomainDDOSSettings + +__all__ = ["WaapDomainSettings"] + + +class WaapDomainSettings(BaseModel): + api: WaapAPIURLs + """API settings of a domain""" + + ddos: WaapDomainDDOSSettings + """DDoS settings for a domain.""" diff --git a/src/gcore/types/waap/waap_domain_status.py b/src/gcore/types/waap/waap_domain_status.py new file mode 100644 index 00000000..37591819 --- /dev/null +++ b/src/gcore/types/waap/waap_domain_status.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["WaapDomainStatus"] + +WaapDomainStatus: TypeAlias = Literal["active", "bypass", "monitor", "locked"] diff --git a/src/gcore/types/waap/waap_summary_domain.py b/src/gcore/types/waap/waap_summary_domain.py new file mode 100644 index 00000000..b9354d2e --- /dev/null +++ b/src/gcore/types/waap/waap_summary_domain.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ..._models import BaseModel +from .waap_domain_status import WaapDomainStatus + +__all__ = ["WaapSummaryDomain"] + + +class WaapSummaryDomain(BaseModel): + id: int + """The domain ID""" + + created_at: datetime + """The date and time the domain was created in ISO 8601 format""" + + custom_page_set: Optional[int] = None + """The ID of the custom page set""" + + name: str + """The domain name""" + + status: WaapDomainStatus + """The different statuses a domain can have""" diff --git a/tests/api_resources/waap/__init__.py b/tests/api_resources/waap/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/waap/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/waap/domains/__init__.py b/tests/api_resources/waap/domains/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/waap/domains/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/waap/domains/test_settings.py b/tests/api_resources/waap/domains/test_settings.py new file mode 100644 index 00000000..54b94e62 --- /dev/null +++ b/tests/api_resources/waap/domains/test_settings.py @@ -0,0 +1,170 @@ +# 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.waap import WaapDomainSettings + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSettings: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Gcore) -> None: + setting = client.waap.domains.settings.update( + domain_id=0, + ) + assert setting is None + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + setting = client.waap.domains.settings.update( + domain_id=0, + api={"api_urls": ["api/v1/.*", "v2/.*"]}, + ddos={ + "burst_threshold": 30, + "global_threshold": 250, + }, + ) + assert setting is None + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.waap.domains.settings.with_raw_response.update( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert setting is None + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.waap.domains.settings.with_streaming_response.update( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + setting = client.waap.domains.settings.get( + 0, + ) + assert_matches_type(WaapDomainSettings, setting, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.domains.settings.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert_matches_type(WaapDomainSettings, setting, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.domains.settings.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert_matches_type(WaapDomainSettings, setting, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncSettings: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + setting = await async_client.waap.domains.settings.update( + domain_id=0, + ) + assert setting is None + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + setting = await async_client.waap.domains.settings.update( + domain_id=0, + api={"api_urls": ["api/v1/.*", "v2/.*"]}, + ddos={ + "burst_threshold": 30, + "global_threshold": 250, + }, + ) + assert setting is None + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.settings.with_raw_response.update( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert setting is None + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.settings.with_streaming_response.update( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + setting = await async_client.waap.domains.settings.get( + 0, + ) + assert_matches_type(WaapDomainSettings, setting, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.settings.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert_matches_type(WaapDomainSettings, setting, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.settings.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert_matches_type(WaapDomainSettings, setting, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_domains.py b/tests/api_resources/waap/test_domains.py new file mode 100644 index 00000000..1f670c8e --- /dev/null +++ b/tests/api_resources/waap/test_domains.py @@ -0,0 +1,302 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap import ( + WaapSummaryDomain, + WaapDetailedDomain, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDomains: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Gcore) -> None: + domain = client.waap.domains.update( + domain_id=0, + ) + assert domain is None + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + domain = client.waap.domains.update( + domain_id=0, + status="active", + ) + assert domain is None + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.waap.domains.with_raw_response.update( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + domain = response.parse() + assert domain is None + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.waap.domains.with_streaming_response.update( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + domain = response.parse() + assert domain is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + domain = client.waap.domains.list() + assert_matches_type(SyncOffsetPage[WaapSummaryDomain], domain, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + domain = client.waap.domains.list( + ids=[0], + limit=0, + name="name", + offset=0, + ordering="id", + status="active", + ) + assert_matches_type(SyncOffsetPage[WaapSummaryDomain], domain, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.domains.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + domain = response.parse() + assert_matches_type(SyncOffsetPage[WaapSummaryDomain], domain, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.domains.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + domain = response.parse() + assert_matches_type(SyncOffsetPage[WaapSummaryDomain], domain, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + domain = client.waap.domains.delete( + 0, + ) + assert domain is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.waap.domains.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + domain = response.parse() + assert domain is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.waap.domains.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + domain = response.parse() + assert domain is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + domain = client.waap.domains.get( + 0, + ) + assert_matches_type(WaapDetailedDomain, domain, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.domains.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + domain = response.parse() + assert_matches_type(WaapDetailedDomain, domain, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.domains.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + domain = response.parse() + assert_matches_type(WaapDetailedDomain, domain, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncDomains: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + domain = await async_client.waap.domains.update( + domain_id=0, + ) + assert domain is None + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + domain = await async_client.waap.domains.update( + domain_id=0, + status="active", + ) + assert domain is None + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.with_raw_response.update( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + domain = await response.parse() + assert domain is None + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.with_streaming_response.update( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + domain = await response.parse() + assert domain is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + domain = await async_client.waap.domains.list() + assert_matches_type(AsyncOffsetPage[WaapSummaryDomain], domain, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + domain = await async_client.waap.domains.list( + ids=[0], + limit=0, + name="name", + offset=0, + ordering="id", + status="active", + ) + assert_matches_type(AsyncOffsetPage[WaapSummaryDomain], domain, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + domain = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapSummaryDomain], domain, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + domain = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapSummaryDomain], domain, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + domain = await async_client.waap.domains.delete( + 0, + ) + assert domain is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + domain = await response.parse() + assert domain is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + domain = await response.parse() + assert domain is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + domain = await async_client.waap.domains.get( + 0, + ) + assert_matches_type(WaapDetailedDomain, domain, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + domain = await response.parse() + assert_matches_type(WaapDetailedDomain, domain, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + domain = await response.parse() + assert_matches_type(WaapDetailedDomain, domain, path=["response"]) + + assert cast(Any, response.is_closed) is True From 04d206c79b9fce1155fda63c920b943867b2ef77 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 10 May 2025 04:00:48 +0000 Subject: [PATCH 118/592] fix(package): support direct resource imports --- src/gcore/__init__.py | 5 +++++ src/gcore/_utils/_resources_proxy.py | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/gcore/_utils/_resources_proxy.py diff --git a/src/gcore/__init__.py b/src/gcore/__init__.py index 1cfb892f..a3a9f6eb 100644 --- a/src/gcore/__init__.py +++ b/src/gcore/__init__.py @@ -1,5 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import typing as _t + from . import types from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes from ._utils import file_from_path @@ -68,6 +70,9 @@ "DefaultAsyncHttpxClient", ] +if not _t.TYPE_CHECKING: + from ._utils._resources_proxy import resources as resources + _setup_logging() # Update the __module__ attribute for exported symbols so that diff --git a/src/gcore/_utils/_resources_proxy.py b/src/gcore/_utils/_resources_proxy.py new file mode 100644 index 00000000..22dfdbd2 --- /dev/null +++ b/src/gcore/_utils/_resources_proxy.py @@ -0,0 +1,24 @@ +from __future__ import annotations + +from typing import Any +from typing_extensions import override + +from ._proxy import LazyProxy + + +class ResourcesProxy(LazyProxy[Any]): + """A proxy for the `gcore.resources` module. + + This is used so that we can lazily import `gcore.resources` only when + needed *and* so that users can just import `gcore` and reference `gcore.resources` + """ + + @override + def __load__(self) -> Any: + import importlib + + mod = importlib.import_module("gcore.resources") + return mod + + +resources = ResourcesProxy().__as_proxied__() From 69fe86697c81fdac7491aa4bd73e56fc8ff5bf2c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 13 May 2025 09:53:50 +0000 Subject: [PATCH 119/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index d8a0e246..05710058 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c7630e687e27c997adafc3bbebabf19108a03056e909983bf057f8aa6cc66b83.yml -openapi_spec_hash: abd8303b18b3d632d96aa404500b84b5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2587dfa8925ffa05e5d325f9181b7f5e4db2db45b43c9742222f3ca3123d0be7.yml +openapi_spec_hash: e364f863bf13cd322ad866b96b5b0a8d config_hash: 047d50bb070fced4bb9e05678a72b874 From 57972487b9ab48d7c84cf53dda508fe1f857da7e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 13 May 2025 13:21:18 +0000 Subject: [PATCH 120/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 05710058..f008098d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2587dfa8925ffa05e5d325f9181b7f5e4db2db45b43c9742222f3ca3123d0be7.yml -openapi_spec_hash: e364f863bf13cd322ad866b96b5b0a8d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0094613be193916820e176b5a5ca6f6d4de0f85028f9e8bdc64e6f02c2974eb0.yml +openapi_spec_hash: 5ddb3b690b17a0b0a919abf6fe979829 config_hash: 047d50bb070fced4bb9e05678a72b874 From 8a2717bdd375a604ed6d446567ab4e7f1ee7505f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 05:33:07 +0000 Subject: [PATCH 121/592] chore(ci): upload sdks to package manager --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ scripts/utils/upload-artifact.sh | 25 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100755 scripts/utils/upload-artifact.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 713b26df..89465316 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,30 @@ jobs: - name: Run lints run: ./scripts/lint + upload: + if: github.repository == 'stainless-sdks/gcore-python' + timeout-minutes: 10 + name: upload + permissions: + contents: read + id-token: write + runs-on: depot-ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Get GitHub OIDC Token + id: github-oidc + uses: actions/github-script@v6 + with: + script: core.setOutput('github_token', await core.getIDToken()); + + - name: Upload tarball + env: + URL: https://pkg.stainless.com/s + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + run: ./scripts/utils/upload-artifact.sh + test: timeout-minutes: 10 name: test diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh new file mode 100755 index 00000000..93f03863 --- /dev/null +++ b/scripts/utils/upload-artifact.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -exuo pipefail + +RESPONSE=$(curl -X POST "$URL" \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json") + +SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url') + +if [[ "$SIGNED_URL" == "null" ]]; then + echo -e "\033[31mFailed to get signed URL.\033[0m" + exit 1 +fi + +UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \ + -H "Content-Type: application/gzip" \ + --data-binary @- "$SIGNED_URL" 2>&1) + +if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then + echo -e "\033[32mUploaded build to Stainless storage.\033[0m" + echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/gcore-python/$SHA'\033[0m" +else + echo -e "\033[31mFailed to upload artifact.\033[0m" + exit 1 +fi From 164c44167364527f9887305e58f88c9b2049cbd0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 04:12:14 +0000 Subject: [PATCH 122/592] chore(ci): fix installation instructions --- scripts/utils/upload-artifact.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh index 93f03863..6b8632b6 100755 --- a/scripts/utils/upload-artifact.sh +++ b/scripts/utils/upload-artifact.sh @@ -18,7 +18,7 @@ UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \ if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then echo -e "\033[32mUploaded build to Stainless storage.\033[0m" - echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/gcore-python/$SHA'\033[0m" + echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/gcore-python/$SHA'\033[0m" else echo -e "\033[31mFailed to upload artifact.\033[0m" exit 1 From 8636c35bc04ce6b2005b77e5bc46f101be51eef0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 17 May 2025 03:00:03 +0000 Subject: [PATCH 123/592] chore(internal): codegen related update --- scripts/utils/upload-artifact.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh index 6b8632b6..af462863 100755 --- a/scripts/utils/upload-artifact.sh +++ b/scripts/utils/upload-artifact.sh @@ -18,7 +18,7 @@ UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \ if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then echo -e "\033[32mUploaded build to Stainless storage.\033[0m" - echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/gcore-python/$SHA'\033[0m" + echo -e "\033[32mInstallation: pip install --pre 'https://pkg.stainless.com/s/gcore-python/$SHA'\033[0m" else echo -e "\033[31mFailed to upload artifact.\033[0m" exit 1 From 8d66d3c4aab901ccdb761f91a4808c9a46273cfd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 17:09:52 +0000 Subject: [PATCH 124/592] feat(api): aggregated API specs update --- .stats.yml | 4 +-- .../resources/cloud/billing_reservations.py | 24 +++++++++++++ .../gpu_baremetal_clusters.py | 34 +++++++++++++++++++ .../cloud/billing_reservation_list_params.py | 5 +++ .../gpu_baremetal_cluster_create_params.py | 20 +++++++++++ .../cloud/test_billing_reservations.py | 2 ++ .../cloud/test_gpu_baremetal_clusters.py | 6 ++++ 7 files changed, 93 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f008098d..a5cf7470 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0094613be193916820e176b5a5ca6f6d4de0f85028f9e8bdc64e6f02c2974eb0.yml -openapi_spec_hash: 5ddb3b690b17a0b0a919abf6fe979829 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6ee727e6d4495feb039e97d5c69bb6b48e00a1d68a3adca58bd6e66a46ca1fe6.yml +openapi_spec_hash: 2e9b50b274dccd3ccb68e3a642cde2db config_hash: 047d50bb070fced4bb9e05678a72b874 diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index 1f54e088..31855aea 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -58,6 +58,15 @@ def list( limit: int | NotGiven = NOT_GIVEN, metric_name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + order_by: Literal[ + "active_from.asc", + "active_from.desc", + "active_to.asc", + "active_to.desc", + "created_at.asc", + "created_at.desc", + ] + | NotGiven = NOT_GIVEN, region_id: int | NotGiven = NOT_GIVEN, status: List[ Literal[ @@ -96,6 +105,8 @@ def list( offset: Offset in reservation list + order_by: Order by field and direction. + region_id: Region for reservation status: Field for fixed a status by reservation workflow @@ -127,6 +138,7 @@ def list( "limit": limit, "metric_name": metric_name, "offset": offset, + "order_by": order_by, "region_id": region_id, "status": status, }, @@ -202,6 +214,15 @@ def list( limit: int | NotGiven = NOT_GIVEN, metric_name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + order_by: Literal[ + "active_from.asc", + "active_from.desc", + "active_to.asc", + "active_to.desc", + "created_at.asc", + "created_at.desc", + ] + | NotGiven = NOT_GIVEN, region_id: int | NotGiven = NOT_GIVEN, status: List[ Literal[ @@ -240,6 +261,8 @@ def list( offset: Offset in reservation list + order_by: Order by field and direction. + region_id: Region for reservation status: Field for fixed a status by reservation workflow @@ -271,6 +294,7 @@ def list( "limit": limit, "metric_name": metric_name, "offset": offset, + "order_by": order_by, "region_id": region_id, "status": status, }, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 51117641..82877a56 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -111,8 +111,11 @@ def create( interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface], name: str, instances_count: int | NotGiven = NOT_GIVEN, + password: str | NotGiven = NOT_GIVEN, ssh_key_name: str | NotGiven = NOT_GIVEN, tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + user_data: str | NotGiven = NOT_GIVEN, + username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -135,6 +138,10 @@ def create( instances_count: Number of servers to create + password: A password for a bare metal server. This parameter is used to set a password for + the "Admin" user on a Windows instance, a default user or a new user on a Linux + instance + ssh_key_name: Specifies the name of the SSH keypair, created via the /v1/ssh_keys endpoint. @@ -144,6 +151,13 @@ def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. + user_data: String in base64 format. Must not be passed together with 'username' or + 'password'. Examples of the user_data: + https://cloudinit.readthedocs.io/en/latest/topics/examples.html + + username: A name of a new user in the Linux instance. It may be passed with a 'password' + parameter + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -165,8 +179,11 @@ def create( "interfaces": interfaces, "name": name, "instances_count": instances_count, + "password": password, "ssh_key_name": ssh_key_name, "tags": tags, + "user_data": user_data, + "username": username, }, gpu_baremetal_cluster_create_params.GPUBaremetalClusterCreateParams, ), @@ -558,8 +575,11 @@ async def create( interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface], name: str, instances_count: int | NotGiven = NOT_GIVEN, + password: str | NotGiven = NOT_GIVEN, ssh_key_name: str | NotGiven = NOT_GIVEN, tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + user_data: str | NotGiven = NOT_GIVEN, + username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -582,6 +602,10 @@ async def create( instances_count: Number of servers to create + password: A password for a bare metal server. This parameter is used to set a password for + the "Admin" user on a Windows instance, a default user or a new user on a Linux + instance + ssh_key_name: Specifies the name of the SSH keypair, created via the /v1/ssh_keys endpoint. @@ -591,6 +615,13 @@ async def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. + user_data: String in base64 format. Must not be passed together with 'username' or + 'password'. Examples of the user_data: + https://cloudinit.readthedocs.io/en/latest/topics/examples.html + + username: A name of a new user in the Linux instance. It may be passed with a 'password' + parameter + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -612,8 +643,11 @@ async def create( "interfaces": interfaces, "name": name, "instances_count": instances_count, + "password": password, "ssh_key_name": ssh_key_name, "tags": tags, + "user_data": user_data, + "username": username, }, gpu_baremetal_cluster_create_params.GPUBaremetalClusterCreateParams, ), diff --git a/src/gcore/types/cloud/billing_reservation_list_params.py b/src/gcore/types/cloud/billing_reservation_list_params.py index 6218c2c8..a54c8b26 100644 --- a/src/gcore/types/cloud/billing_reservation_list_params.py +++ b/src/gcore/types/cloud/billing_reservation_list_params.py @@ -45,6 +45,11 @@ class BillingReservationListParams(TypedDict, total=False): offset: int """Offset in reservation list""" + order_by: Literal[ + "active_from.asc", "active_from.desc", "active_to.asc", "active_to.desc", "created_at.asc", "created_at.desc" + ] + """Order by field and direction.""" + region_id: int """Region for reservation""" 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 8d824389..8fd160d4 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -42,6 +42,13 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): instances_count: int """Number of servers to create""" + password: str + """A password for a bare metal server. + + This parameter is used to set a password for the "Admin" user on a Windows + instance, a default user or a new user on a Linux instance + """ + ssh_key_name: str """ Specifies the name of the SSH keypair, created via the @@ -58,6 +65,19 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): values. """ + user_data: str + """String in base64 format. + + Must not be passed together with 'username' or 'password'. Examples of the + user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html + """ + + username: str + """A name of a new user in the Linux instance. + + It may be passed with a 'password' parameter + """ + class InterfaceCreateGPUClusterExternalInterfaceSerializer(TypedDict, total=False): type: Required[Literal["external"]] diff --git a/tests/api_resources/cloud/test_billing_reservations.py b/tests/api_resources/cloud/test_billing_reservations.py index 9c5d6f89..7463ebd1 100644 --- a/tests/api_resources/cloud/test_billing_reservations.py +++ b/tests/api_resources/cloud/test_billing_reservations.py @@ -36,6 +36,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: limit=1, metric_name="metric_name", offset=0, + order_by="active_from.asc", region_id=0, status=["ACTIVATED"], ) @@ -113,6 +114,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No limit=1, metric_name="metric_name", offset=0, + order_by="active_from.asc", region_id=0, status=["ACTIVATED"], ) diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index b6204482..5b455c80 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -58,8 +58,11 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: ], name="my-gpu-cluster", instances_count=1, + password="password", ssh_key_name="my-ssh-key", tags={"foo": "my-tag-value"}, + user_data="user_data", + username="username", ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @@ -501,8 +504,11 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> ], name="my-gpu-cluster", instances_count=1, + password="password", ssh_key_name="my-ssh-key", tags={"foo": "my-tag-value"}, + user_data="user_data", + username="username", ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) From 3d11ade29521d7d620ead5b954e835387aa8fd89 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 May 2025 07:57:13 +0000 Subject: [PATCH 125/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- pyproject.toml | 2 +- scripts/utils/upload-artifact.sh | 2 +- src/gcore/_version.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f14b480a..3d2ac0bd 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.2" + ".": "0.1.0" } \ No newline at end of file diff --git a/README.md b/README.md index 3f76a235..da3f33d4 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The REST API documentation can be found on [api.gcore.com](https://api.gcore.com ```sh # install from PyPI -pip install --pre gcore +pip install gcore ``` ## Usage diff --git a/pyproject.toml b/pyproject.toml index 185efb79..ebc4ef81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.1.0-alpha.2" +version = "0.1.0" description = "The official Python library for the gcore API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh index af462863..6b8632b6 100755 --- a/scripts/utils/upload-artifact.sh +++ b/scripts/utils/upload-artifact.sh @@ -18,7 +18,7 @@ UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \ if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then echo -e "\033[32mUploaded build to Stainless storage.\033[0m" - echo -e "\033[32mInstallation: pip install --pre 'https://pkg.stainless.com/s/gcore-python/$SHA'\033[0m" + echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/gcore-python/$SHA'\033[0m" else echo -e "\033[31mFailed to upload artifact.\033[0m" exit 1 diff --git a/src/gcore/_version.py b/src/gcore/_version.py index e8caacba..cb502970 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.1.0-alpha.2" # x-release-please-version +__version__ = "0.1.0" # x-release-please-version From 33427f8409f287ae059e388b31e4f928725f40dc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 May 2025 18:11:25 +0000 Subject: [PATCH 126/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- .../resources/cloud/file_shares/file_shares.py | 16 ++++++++++++++++ src/gcore/types/cloud/file_share.py | 3 +++ src/gcore/types/cloud/file_share_list_params.py | 8 +++++++- tests/api_resources/cloud/test_file_shares.py | 4 ++++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index a5cf7470..38dfdcd7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6ee727e6d4495feb039e97d5c69bb6b48e00a1d68a3adca58bd6e66a46ca1fe6.yml -openapi_spec_hash: 2e9b50b274dccd3ccb68e3a642cde2db +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-bff465bac7d0d2768c61492040be9277c524c46d75f3c045630fcd7c392f154b.yml +openapi_spec_hash: ed8a8e4800ca75fd76a4dc86b6c50f8a config_hash: 047d50bb070fced4bb9e05678a72b874 diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index a4e135aa..9a9ad4bb 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -269,7 +269,9 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + type_name: Literal["standard", "vast"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -287,9 +289,13 @@ def list( limit: Optional. Limit the number of returned items + name: File share name. Uses partial match. + offset: Optional. Offset value is used to exclude the first set of records from the result + type_name: File share type name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -313,7 +319,9 @@ def list( query=maybe_transform( { "limit": limit, + "name": name, "offset": offset, + "type_name": type_name, }, file_share_list_params.FileShareListParams, ), @@ -690,7 +698,9 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + type_name: Literal["standard", "vast"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -708,9 +718,13 @@ def list( limit: Optional. Limit the number of returned items + name: File share name. Uses partial match. + offset: Optional. Offset value is used to exclude the first set of records from the result + type_name: File share type name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -734,7 +748,9 @@ def list( query=maybe_transform( { "limit": limit, + "name": name, "offset": offset, + "type_name": type_name, }, file_share_list_params.FileShareListParams, ), diff --git a/src/gcore/types/cloud/file_share.py b/src/gcore/types/cloud/file_share.py index 323b4a39..1aa2bc60 100644 --- a/src/gcore/types/cloud/file_share.py +++ b/src/gcore/types/cloud/file_share.py @@ -107,5 +107,8 @@ class FileShare(BaseModel): the resource is not locked. """ + type_name: Literal["standard", "vast"] + """File share type name""" + volume_type: Literal["default_share_type", "vast_share_type"] """File share disk type""" diff --git a/src/gcore/types/cloud/file_share_list_params.py b/src/gcore/types/cloud/file_share_list_params.py index 924f9e87..7f72417d 100644 --- a/src/gcore/types/cloud/file_share_list_params.py +++ b/src/gcore/types/cloud/file_share_list_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Literal, TypedDict __all__ = ["FileShareListParams"] @@ -17,8 +17,14 @@ class FileShareListParams(TypedDict, total=False): limit: int """Optional. Limit the number of returned items""" + name: str + """File share name. Uses partial match.""" + offset: int """Optional. Offset value is used to exclude the first set of records from the result """ + + type_name: Literal["standard", "vast"] + """File share type name""" diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index 289e198f..4c547362 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -213,7 +213,9 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, limit=1000, + name="test-sfs", offset=0, + type_name="standard", ) assert_matches_type(SyncOffsetPage[FileShare], file_share, path=["response"]) @@ -581,7 +583,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No project_id=1, region_id=1, limit=1000, + name="test-sfs", offset=0, + type_name="standard", ) assert_matches_type(AsyncOffsetPage[FileShare], file_share, path=["response"]) From d880a18624bf210640342a458041c21314042633 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 02:38:36 +0000 Subject: [PATCH 127/592] chore(docs): grammar improvements --- SECURITY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index 0a8609cd..899ab304 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -16,11 +16,11 @@ before making any information public. ## Reporting Non-SDK Related Security Issues If you encounter security issues that are not directly related to SDKs but pertain to the services -or products provided by Gcore please follow the respective company's security reporting guidelines. +or products provided by Gcore, please follow the respective company's security reporting guidelines. ### Gcore Terms and Policies -Please contact support@gcore.com for any questions or concerns regarding security of our services. +Please contact support@gcore.com for any questions or concerns regarding the security of our services. --- From c4067c25c7540cc38c12c6a62be4f0c934176747 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 14:09:04 +0000 Subject: [PATCH 128/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 38dfdcd7..8b4fdf85 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-bff465bac7d0d2768c61492040be9277c524c46d75f3c045630fcd7c392f154b.yml -openapi_spec_hash: ed8a8e4800ca75fd76a4dc86b6c50f8a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a38e6b49cbe47dd63e166f51a694173d0a3a2fe8bfc65d4cb653c0943de6c865.yml +openapi_spec_hash: 942bdb053b08d362126423c673e67489 config_hash: 047d50bb070fced4bb9e05678a72b874 From 57e33e08cbbe8e6fb4e987ca3ab3808653f0b3a8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 23 May 2025 12:13:19 +0000 Subject: [PATCH 129/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/resources/cloud/tasks.py | 18 ++++++++++++++---- src/gcore/types/cloud/task.py | 3 --- src/gcore/types/cloud/task_list_params.py | 10 ++++++++-- tests/api_resources/cloud/test_tasks.py | 2 ++ 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8b4fdf85..adc11238 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a38e6b49cbe47dd63e166f51a694173d0a3a2fe8bfc65d4cb653c0943de6c865.yml -openapi_spec_hash: 942bdb053b08d362126423c673e67489 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-437ac4b4b902b8ba11d9162d67503e3139b7b1eebb2de4aaa871444fbe6ea962.yml +openapi_spec_hash: d473fa29175d282d4e05aabc497bd826 config_hash: 047d50bb070fced4bb9e05678a72b874 diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index c6ae3799..380212d4 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -53,9 +53,10 @@ def list( is_acknowledged: Optional[bool] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, project_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, region_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - sorting: Optional[Literal["asc", "desc"]] | NotGiven = NOT_GIVEN, + sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] | NotGiven = NOT_GIVEN, task_type: Optional[str] | NotGiven = NOT_GIVEN, to_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, @@ -81,13 +82,16 @@ def list( offset: Offset value is used to exclude the first set of records from the result + order_by: Sorting by creation date. Oldest first, or most recent first + project_id: The project ID to filter the tasks by project. Supports multiple values of kind key=value1&key=value2 region_id: The region ID to filter the tasks by region. Supports multiple values of kind key=value1&key=value2 - sorting: Sorting by creation date. Oldest first, or most recent first + sorting: (DEPRECATED Use 'order_by' instead) Sorting by creation date. Oldest first, or + most recent first state: Filter the tasks by state. Supports multiple values of kind key=value1&key=value2 @@ -160,6 +164,7 @@ def list( "is_acknowledged": is_acknowledged, "limit": limit, "offset": offset, + "order_by": order_by, "project_id": project_id, "region_id": region_id, "sorting": sorting, @@ -318,9 +323,10 @@ def list( is_acknowledged: Optional[bool] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, project_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, region_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - sorting: Optional[Literal["asc", "desc"]] | NotGiven = NOT_GIVEN, + sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] | NotGiven = NOT_GIVEN, task_type: Optional[str] | NotGiven = NOT_GIVEN, to_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, @@ -346,13 +352,16 @@ def list( offset: Offset value is used to exclude the first set of records from the result + order_by: Sorting by creation date. Oldest first, or most recent first + project_id: The project ID to filter the tasks by project. Supports multiple values of kind key=value1&key=value2 region_id: The region ID to filter the tasks by region. Supports multiple values of kind key=value1&key=value2 - sorting: Sorting by creation date. Oldest first, or most recent first + sorting: (DEPRECATED Use 'order_by' instead) Sorting by creation date. Oldest first, or + most recent first state: Filter the tasks by state. Supports multiple values of kind key=value1&key=value2 @@ -425,6 +434,7 @@ def list( "is_acknowledged": is_acknowledged, "limit": limit, "offset": offset, + "order_by": order_by, "project_id": project_id, "region_id": region_id, "sorting": sorting, diff --git a/src/gcore/types/cloud/task.py b/src/gcore/types/cloud/task.py index a66a37a9..a61ab8a8 100644 --- a/src/gcore/types/cloud/task.py +++ b/src/gcore/types/cloud/task.py @@ -36,9 +36,6 @@ class CreatedResources(BaseModel): healthmonitors: Optional[List[str]] = None """IDs of created health monitors""" - heat: Optional[List[str]] = None - """IDs of created heat resources""" - images: Optional[List[str]] = None """IDs of created images""" diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index f331c906..f0b44a75 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -30,6 +30,9 @@ class TaskListParams(TypedDict, total=False): offset: int """Offset value is used to exclude the first set of records from the result""" + order_by: Literal["asc", "desc"] + """Sorting by creation date. Oldest first, or most recent first""" + project_id: Optional[Iterable[int]] """The project ID to filter the tasks by project. @@ -42,8 +45,11 @@ class TaskListParams(TypedDict, total=False): Supports multiple values of kind key=value1&key=value2 """ - sorting: Optional[Literal["asc", "desc"]] - """Sorting by creation date. Oldest first, or most recent first""" + sorting: Literal["asc", "desc"] + """(DEPRECATED Use 'order_by' instead) Sorting by creation date. + + Oldest first, or most recent first + """ state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] """Filter the tasks by state. diff --git a/tests/api_resources/cloud/test_tasks.py b/tests/api_resources/cloud/test_tasks.py index ad721d7c..e28f3fde 100644 --- a/tests/api_resources/cloud/test_tasks.py +++ b/tests/api_resources/cloud/test_tasks.py @@ -31,6 +31,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: is_acknowledged=True, limit=100, offset=0, + order_by="asc", project_id=[0, 0], region_id=[0, 0], sorting="asc", @@ -185,6 +186,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No is_acknowledged=True, limit=100, offset=0, + order_by="asc", project_id=[0, 0], region_id=[0, 0], sorting="asc", From 22549df6cf46f754872a902ca684c2355afe1337 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 23 May 2025 18:09:49 +0000 Subject: [PATCH 130/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index adc11238..8f5cf9c3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-437ac4b4b902b8ba11d9162d67503e3139b7b1eebb2de4aaa871444fbe6ea962.yml -openapi_spec_hash: d473fa29175d282d4e05aabc497bd826 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-884c7c4ac691d2b2fcc6dba34b899bb2b7adb60c595e306bf08ddc6134ed48c6.yml +openapi_spec_hash: eb6d248d44efc42453fca00a92d13094 config_hash: 047d50bb070fced4bb9e05678a72b874 From 9cf0641ce7abff05082c854ca6faef20d97de5d3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 12:13:35 +0000 Subject: [PATCH 131/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../inference/deployments/deployments.py | 8 +- .../container_probe_config_create_param.py | 3 +- .../inference/deployment_update_params.py | 209 +++++++++++++++++- .../types/cloud/quota_get_all_response.py | 18 ++ .../cloud/quota_get_by_region_response.py | 18 ++ .../cloud/quotas/request_create_params.py | 9 + .../cloud/quotas/request_get_response.py | 9 + .../cloud/quotas/request_list_response.py | 9 + .../cloud/inference/test_deployments.py | 12 +- .../cloud/quotas/test_requests.py | 6 + 11 files changed, 285 insertions(+), 20 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8f5cf9c3..505edde2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-884c7c4ac691d2b2fcc6dba34b899bb2b7adb60c595e306bf08ddc6134ed48c6.yml -openapi_spec_hash: eb6d248d44efc42453fca00a92d13094 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-75e656461688b1c53bc6905606e9d737c4e96d1fa027b3b6f2b2ff3da9f175b4.yml +openapi_spec_hash: 8101a463eb253837bd7784043d4aa4da config_hash: 047d50bb070fced4bb9e05678a72b874 diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 18521e40..ba41e262 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -171,13 +171,13 @@ def update( deployment_name: str, *, project_id: int | None = None, - auth_enabled: Optional[bool] | NotGiven = NOT_GIVEN, + auth_enabled: bool | NotGiven = NOT_GIVEN, command: Optional[List[str]] | NotGiven = NOT_GIVEN, containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, credentials_name: Optional[str] | NotGiven = NOT_GIVEN, description: Optional[str] | NotGiven = NOT_GIVEN, envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - flavor_name: Optional[str] | NotGiven = NOT_GIVEN, + flavor_name: str | NotGiven = NOT_GIVEN, image: Optional[str] | NotGiven = NOT_GIVEN, ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN, listening_port: Optional[int] | NotGiven = NOT_GIVEN, @@ -679,13 +679,13 @@ async def update( deployment_name: str, *, project_id: int | None = None, - auth_enabled: Optional[bool] | NotGiven = NOT_GIVEN, + auth_enabled: bool | NotGiven = NOT_GIVEN, command: Optional[List[str]] | NotGiven = NOT_GIVEN, containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, credentials_name: Optional[str] | NotGiven = NOT_GIVEN, description: Optional[str] | NotGiven = NOT_GIVEN, envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - flavor_name: Optional[str] | NotGiven = NOT_GIVEN, + flavor_name: str | NotGiven = NOT_GIVEN, image: Optional[str] | NotGiven = NOT_GIVEN, ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN, listening_port: Optional[int] | NotGiven = NOT_GIVEN, diff --git a/src/gcore/types/cloud/container_probe_config_create_param.py b/src/gcore/types/cloud/container_probe_config_create_param.py index 7c6d0695..0ddedaae 100644 --- a/src/gcore/types/cloud/container_probe_config_create_param.py +++ b/src/gcore/types/cloud/container_probe_config_create_param.py @@ -2,7 +2,6 @@ from __future__ import annotations -from typing import Optional from typing_extensions import Required, TypedDict from .container_probe_create_param import ContainerProbeCreateParam @@ -14,5 +13,5 @@ class ContainerProbeConfigCreateParam(TypedDict, total=False): enabled: Required[bool] """Whether the probe is enabled or not.""" - probe: Optional[ContainerProbeCreateParam] + probe: ContainerProbeCreateParam """Probe configuration (exec, http_get or tcp_socket)""" diff --git a/src/gcore/types/cloud/inference/deployment_update_params.py b/src/gcore/types/cloud/inference/deployment_update_params.py index cf081581..e1a62fdf 100644 --- a/src/gcore/types/cloud/inference/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -8,7 +8,6 @@ from ...._utils import PropertyInfo from ..ingress_opts_param import IngressOptsParam from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam -from ..container_probe_config_create_param import ContainerProbeConfigCreateParam __all__ = [ "DeploymentUpdateParams", @@ -23,6 +22,21 @@ "ContainerScaleTriggersSqs", "Logging", "Probes", + "ProbesLivenessProbe", + "ProbesLivenessProbeProbe", + "ProbesLivenessProbeProbeExec", + "ProbesLivenessProbeProbeHTTPGet", + "ProbesLivenessProbeProbeTcpSocket", + "ProbesReadinessProbe", + "ProbesReadinessProbeProbe", + "ProbesReadinessProbeProbeExec", + "ProbesReadinessProbeProbeHTTPGet", + "ProbesReadinessProbeProbeTcpSocket", + "ProbesStartupProbe", + "ProbesStartupProbeProbe", + "ProbesStartupProbeProbeExec", + "ProbesStartupProbeProbeHTTPGet", + "ProbesStartupProbeProbeTcpSocket", ] @@ -30,7 +44,7 @@ class DeploymentUpdateParams(TypedDict, total=False): project_id: int """Project ID""" - auth_enabled: Optional[bool] + auth_enabled: bool """Set to `true` to enable API key authentication for the inference instance. `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required @@ -52,7 +66,7 @@ class DeploymentUpdateParams(TypedDict, total=False): envs: Optional[Dict[str, str]] """Environment variables for the inference instance.""" - flavor_name: Optional[str] + flavor_name: str """Flavor name for the inference instance.""" image: Optional[str] @@ -204,12 +218,195 @@ class Logging(TypedDict, total=False): """The topic name to stream logs to""" +class ProbesLivenessProbeProbeExec(TypedDict, total=False): + command: List[str] + """Command to be executed inside the running container.""" + + +class ProbesLivenessProbeProbeHTTPGet(TypedDict, total=False): + headers: Dict[str, str] + """HTTP headers to be sent with the request.""" + + host: str + """Host name to send HTTP request to.""" + + path: str + """The endpoint to send the HTTP request to.""" + + port: int + """Port number the probe should connect to.""" + + schema: str + """Schema to use for the HTTP request.""" + + +class ProbesLivenessProbeProbeTcpSocket(TypedDict, total=False): + port: int + """Port number to check if it's open.""" + + +class ProbesLivenessProbeProbe(TypedDict, total=False): + exec: Optional[ProbesLivenessProbeProbeExec] + """Exec probe configuration""" + + failure_threshold: int + """The number of consecutive probe failures that mark the container as unhealthy.""" + + http_get: Optional[ProbesLivenessProbeProbeHTTPGet] + """HTTP GET probe configuration""" + + initial_delay_seconds: int + """The initial delay before starting the first probe.""" + + period_seconds: int + """How often (in seconds) to perform the probe.""" + + success_threshold: int + """The number of consecutive successful probes that mark the container as healthy.""" + + tcp_socket: Optional[ProbesLivenessProbeProbeTcpSocket] + """TCP socket probe configuration""" + + timeout_seconds: int + """The timeout for each probe.""" + + +class ProbesLivenessProbe(TypedDict, total=False): + enabled: bool + """Whether the probe is enabled or not.""" + + probe: ProbesLivenessProbeProbe + """Probe configuration (exec, http_get or tcp_socket)""" + + +class ProbesReadinessProbeProbeExec(TypedDict, total=False): + command: List[str] + """Command to be executed inside the running container.""" + + +class ProbesReadinessProbeProbeHTTPGet(TypedDict, total=False): + headers: Dict[str, str] + """HTTP headers to be sent with the request.""" + + host: str + """Host name to send HTTP request to.""" + + path: str + """The endpoint to send the HTTP request to.""" + + port: int + """Port number the probe should connect to.""" + + schema: str + """Schema to use for the HTTP request.""" + + +class ProbesReadinessProbeProbeTcpSocket(TypedDict, total=False): + port: int + """Port number to check if it's open.""" + + +class ProbesReadinessProbeProbe(TypedDict, total=False): + exec: Optional[ProbesReadinessProbeProbeExec] + """Exec probe configuration""" + + failure_threshold: int + """The number of consecutive probe failures that mark the container as unhealthy.""" + + http_get: Optional[ProbesReadinessProbeProbeHTTPGet] + """HTTP GET probe configuration""" + + initial_delay_seconds: int + """The initial delay before starting the first probe.""" + + period_seconds: int + """How often (in seconds) to perform the probe.""" + + success_threshold: int + """The number of consecutive successful probes that mark the container as healthy.""" + + tcp_socket: Optional[ProbesReadinessProbeProbeTcpSocket] + """TCP socket probe configuration""" + + timeout_seconds: int + """The timeout for each probe.""" + + +class ProbesReadinessProbe(TypedDict, total=False): + enabled: bool + """Whether the probe is enabled or not.""" + + probe: ProbesReadinessProbeProbe + """Probe configuration (exec, http_get or tcp_socket)""" + + +class ProbesStartupProbeProbeExec(TypedDict, total=False): + command: List[str] + """Command to be executed inside the running container.""" + + +class ProbesStartupProbeProbeHTTPGet(TypedDict, total=False): + headers: Dict[str, str] + """HTTP headers to be sent with the request.""" + + host: str + """Host name to send HTTP request to.""" + + path: str + """The endpoint to send the HTTP request to.""" + + port: int + """Port number the probe should connect to.""" + + schema: str + """Schema to use for the HTTP request.""" + + +class ProbesStartupProbeProbeTcpSocket(TypedDict, total=False): + port: int + """Port number to check if it's open.""" + + +class ProbesStartupProbeProbe(TypedDict, total=False): + exec: Optional[ProbesStartupProbeProbeExec] + """Exec probe configuration""" + + failure_threshold: int + """The number of consecutive probe failures that mark the container as unhealthy.""" + + http_get: Optional[ProbesStartupProbeProbeHTTPGet] + """HTTP GET probe configuration""" + + initial_delay_seconds: int + """The initial delay before starting the first probe.""" + + period_seconds: int + """How often (in seconds) to perform the probe.""" + + success_threshold: int + """The number of consecutive successful probes that mark the container as healthy.""" + + tcp_socket: Optional[ProbesStartupProbeProbeTcpSocket] + """TCP socket probe configuration""" + + timeout_seconds: int + """The timeout for each probe.""" + + +class ProbesStartupProbe(TypedDict, total=False): + enabled: bool + """Whether the probe is enabled or not.""" + + probe: ProbesStartupProbeProbe + """Probe configuration (exec, http_get or tcp_socket)""" + + class Probes(TypedDict, total=False): - liveness_probe: Optional[ContainerProbeConfigCreateParam] + liveness_probe: Optional[ProbesLivenessProbe] """Liveness probe configuration""" - readiness_probe: Optional[ContainerProbeConfigCreateParam] + readiness_probe: Optional[ProbesReadinessProbe] """Readiness probe configuration""" - startup_probe: Optional[ContainerProbeConfigCreateParam] + startup_probe: Optional[ProbesStartupProbe] """Startup probe configuration""" diff --git a/src/gcore/types/cloud/quota_get_all_response.py b/src/gcore/types/cloud/quota_get_all_response.py index c03ab710..99ad5482 100644 --- a/src/gcore/types/cloud/quota_get_all_response.py +++ b/src/gcore/types/cloud/quota_get_all_response.py @@ -58,12 +58,30 @@ class RegionalQuota(BaseModel): baremetal_basic_count_usage: Optional[int] = None """Basic bare metal servers count usage""" + baremetal_gpu_a100_count_limit: Optional[int] = None + """Baremetal A100 GPU card count limit""" + + baremetal_gpu_a100_count_usage: Optional[int] = None + """Baremetal A100 GPU card count usage""" + baremetal_gpu_count_limit: Optional[int] = None """AI GPU bare metal servers count limit""" baremetal_gpu_count_usage: Optional[int] = None """AI GPU bare metal servers count usage""" + baremetal_gpu_h100_count_limit: Optional[int] = None + """Baremetal H100 GPU card count limit""" + + baremetal_gpu_h100_count_usage: Optional[int] = None + """Baremetal H100 GPU card count usage""" + + baremetal_gpu_l40s_count_limit: Optional[int] = None + """Baremetal L40S GPU card count limit""" + + baremetal_gpu_l40s_count_usage: Optional[int] = None + """Baremetal L40S GPU card count usage""" + baremetal_hf_count_limit: Optional[int] = None """High-frequency bare metal servers count limit""" diff --git a/src/gcore/types/cloud/quota_get_by_region_response.py b/src/gcore/types/cloud/quota_get_by_region_response.py index f34fa83c..4901ce08 100644 --- a/src/gcore/types/cloud/quota_get_by_region_response.py +++ b/src/gcore/types/cloud/quota_get_by_region_response.py @@ -14,12 +14,30 @@ class QuotaGetByRegionResponse(BaseModel): baremetal_basic_count_usage: Optional[int] = None """Basic bare metal servers count usage""" + baremetal_gpu_a100_count_limit: Optional[int] = None + """Baremetal A100 GPU card count limit""" + + baremetal_gpu_a100_count_usage: Optional[int] = None + """Baremetal A100 GPU card count usage""" + baremetal_gpu_count_limit: Optional[int] = None """AI GPU bare metal servers count limit""" baremetal_gpu_count_usage: Optional[int] = None """AI GPU bare metal servers count usage""" + baremetal_gpu_h100_count_limit: Optional[int] = None + """Baremetal H100 GPU card count limit""" + + baremetal_gpu_h100_count_usage: Optional[int] = None + """Baremetal H100 GPU card count usage""" + + baremetal_gpu_l40s_count_limit: Optional[int] = None + """Baremetal L40S GPU card count limit""" + + baremetal_gpu_l40s_count_usage: Optional[int] = None + """Baremetal L40S GPU card count usage""" + baremetal_hf_count_limit: Optional[int] = None """High-frequency bare metal servers 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 1a7ac333..6cb0aac8 100644 --- a/src/gcore/types/cloud/quotas/request_create_params.py +++ b/src/gcore/types/cloud/quotas/request_create_params.py @@ -46,9 +46,18 @@ class RequestedLimitsRegionalLimit(TypedDict, total=False): baremetal_basic_count_limit: int """Basic bare metal servers count limit""" + baremetal_gpu_a100_count_limit: int + """Baremetal A100 GPU card count limit""" + baremetal_gpu_count_limit: int """AI GPU bare metal servers count limit""" + baremetal_gpu_h100_count_limit: int + """Baremetal H100 GPU card count limit""" + + baremetal_gpu_l40s_count_limit: int + """Baremetal L40S GPU card count limit""" + baremetal_hf_count_limit: int """High-frequency bare metal servers count limit""" diff --git a/src/gcore/types/cloud/quotas/request_get_response.py b/src/gcore/types/cloud/quotas/request_get_response.py index d01ceddc..94a2ba19 100644 --- a/src/gcore/types/cloud/quotas/request_get_response.py +++ b/src/gcore/types/cloud/quotas/request_get_response.py @@ -35,9 +35,18 @@ class RequestedLimitsRegionalLimit(BaseModel): baremetal_basic_count_limit: Optional[int] = None """Basic bare metal servers count limit""" + baremetal_gpu_a100_count_limit: Optional[int] = None + """Baremetal A100 GPU card count limit""" + baremetal_gpu_count_limit: Optional[int] = None """AI GPU bare metal servers count limit""" + baremetal_gpu_h100_count_limit: Optional[int] = None + """Baremetal H100 GPU card count limit""" + + baremetal_gpu_l40s_count_limit: Optional[int] = None + """Baremetal L40S GPU card count limit""" + baremetal_hf_count_limit: Optional[int] = None """High-frequency bare metal servers count limit""" diff --git a/src/gcore/types/cloud/quotas/request_list_response.py b/src/gcore/types/cloud/quotas/request_list_response.py index 8eea5070..b4eb90bb 100644 --- a/src/gcore/types/cloud/quotas/request_list_response.py +++ b/src/gcore/types/cloud/quotas/request_list_response.py @@ -35,9 +35,18 @@ class RequestedLimitsRegionalLimit(BaseModel): baremetal_basic_count_limit: Optional[int] = None """Basic bare metal servers count limit""" + baremetal_gpu_a100_count_limit: Optional[int] = None + """Baremetal A100 GPU card count limit""" + baremetal_gpu_count_limit: Optional[int] = None """AI GPU bare metal servers count limit""" + baremetal_gpu_h100_count_limit: Optional[int] = None + """Baremetal H100 GPU card count limit""" + + baremetal_gpu_l40s_count_limit: Optional[int] = None + """Baremetal L40S GPU card count limit""" + baremetal_hf_count_limit: Optional[int] = None """High-frequency bare metal servers count limit""" diff --git a/tests/api_resources/cloud/inference/test_deployments.py b/tests/api_resources/cloud/inference/test_deployments.py index d3c9765b..bbce91ba 100644 --- a/tests/api_resources/cloud/inference/test_deployments.py +++ b/tests/api_resources/cloud/inference/test_deployments.py @@ -278,10 +278,10 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "exec": {"command": ["ls", "-l"]}, "failure_threshold": 3, "http_get": { - "port": 80, "headers": {"Authorization": "Bearer token 123"}, "host": "127.0.0.1", "path": "/healthz", + "port": 80, "schema": "HTTP", }, "initial_delay_seconds": 0, @@ -297,10 +297,10 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "exec": {"command": ["ls", "-l"]}, "failure_threshold": 3, "http_get": { - "port": 80, "headers": {"Authorization": "Bearer token 123"}, "host": "127.0.0.1", "path": "/healthz", + "port": 80, "schema": "HTTP", }, "initial_delay_seconds": 0, @@ -316,10 +316,10 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "exec": {"command": ["ls", "-l"]}, "failure_threshold": 3, "http_get": { - "port": 80, "headers": {"Authorization": "Bearer token 123"}, "host": "127.0.0.1", "path": "/healthz", + "port": 80, "schema": "HTTP", }, "initial_delay_seconds": 0, @@ -878,10 +878,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "exec": {"command": ["ls", "-l"]}, "failure_threshold": 3, "http_get": { - "port": 80, "headers": {"Authorization": "Bearer token 123"}, "host": "127.0.0.1", "path": "/healthz", + "port": 80, "schema": "HTTP", }, "initial_delay_seconds": 0, @@ -897,10 +897,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "exec": {"command": ["ls", "-l"]}, "failure_threshold": 3, "http_get": { - "port": 80, "headers": {"Authorization": "Bearer token 123"}, "host": "127.0.0.1", "path": "/healthz", + "port": 80, "schema": "HTTP", }, "initial_delay_seconds": 0, @@ -916,10 +916,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "exec": {"command": ["ls", "-l"]}, "failure_threshold": 3, "http_get": { - "port": 80, "headers": {"Authorization": "Bearer token 123"}, "host": "127.0.0.1", "path": "/healthz", + "port": 80, "schema": "HTTP", }, "initial_delay_seconds": 0, diff --git a/tests/api_resources/cloud/quotas/test_requests.py b/tests/api_resources/cloud/quotas/test_requests.py index 55d95441..ad9a144f 100644 --- a/tests/api_resources/cloud/quotas/test_requests.py +++ b/tests/api_resources/cloud/quotas/test_requests.py @@ -43,7 +43,10 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "regional_limits": [ { "baremetal_basic_count_limit": 0, + "baremetal_gpu_a100_count_limit": 0, "baremetal_gpu_count_limit": 0, + "baremetal_gpu_h100_count_limit": 0, + "baremetal_gpu_l40s_count_limit": 0, "baremetal_hf_count_limit": 0, "baremetal_infrastructure_count_limit": 0, "baremetal_network_count_limit": 0, @@ -261,7 +264,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "regional_limits": [ { "baremetal_basic_count_limit": 0, + "baremetal_gpu_a100_count_limit": 0, "baremetal_gpu_count_limit": 0, + "baremetal_gpu_h100_count_limit": 0, + "baremetal_gpu_l40s_count_limit": 0, "baremetal_hf_count_limit": 0, "baremetal_infrastructure_count_limit": 0, "baremetal_network_count_limit": 0, From 582c74bfa62324cc0363cc0b57dc42db6e75beba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 14:08:38 +0000 Subject: [PATCH 132/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 505edde2..c21b2c3f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-75e656461688b1c53bc6905606e9d737c4e96d1fa027b3b6f2b2ff3da9f175b4.yml -openapi_spec_hash: 8101a463eb253837bd7784043d4aa4da +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-072d7dda0b673a0aff6d3df15f6fc8cfd8de52ba309a2e63c448bae7da878933.yml +openapi_spec_hash: f1843072641e18f7a0f94f2430c46d4c config_hash: 047d50bb070fced4bb9e05678a72b874 From 824f4de1160b2e05590fd979666f69182b06ba2c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 18:10:35 +0000 Subject: [PATCH 133/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c21b2c3f..02e5c7e3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-072d7dda0b673a0aff6d3df15f6fc8cfd8de52ba309a2e63c448bae7da878933.yml -openapi_spec_hash: f1843072641e18f7a0f94f2430c46d4c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f211780370767c7e119e6a521bface760f0d7d5f56eb7778e5215387a84b7833.yml +openapi_spec_hash: 8a7d2ec234f85a81061fc00934222de3 config_hash: 047d50bb070fced4bb9e05678a72b874 From 7d59156e5c893997d8b6291686c7231941ed0877 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 18:43:36 +0000 Subject: [PATCH 134/592] fix(ci): do not always skip breaking change detection --- .github/workflows/ci.yml | 32 ----------------- .github/workflows/detect-breaking-changes.yml | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/detect-breaking-changes.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89465316..b773a6a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,35 +74,3 @@ jobs: - name: Run tests run: ./scripts/test - - detect_breaking_changes: - name: detect-breaking-changes - if: github.event_name == 'pull_request' - # Don't try to detect breaking changes if linting fails with the change. That means it's already failing - # and will likely fail at an earlier revision for the same reason, which doesn't indicate a breaking - # change. - needs: lint - runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - steps: - - name: Calculate fetch-depth - run: | - echo "FETCH_DEPTH=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_ENV - - - uses: actions/checkout@v4 - with: - # Ensure we can check out the pull request base in the script below. - fetch-depth: ${{ env.FETCH_DEPTH }} - - - name: Install Rye - run: | - curl -sSf https://rye.astral.sh/get | bash - echo "$HOME/.rye/shims" >> $GITHUB_PATH - env: - RYE_VERSION: '0.44.0' - RYE_INSTALL_OPTION: '--yes' - - name: Install dependencies - run: | - rye sync --all-features - - - name: Detect breaking changes - run: ./scripts/detect-breaking-changes ${{ github.event.pull_request.base.sha }} diff --git a/.github/workflows/detect-breaking-changes.yml b/.github/workflows/detect-breaking-changes.yml new file mode 100644 index 00000000..0d6fc790 --- /dev/null +++ b/.github/workflows/detect-breaking-changes.yml @@ -0,0 +1,34 @@ +name: CI +on: + pull_request: + branches: + - main + - next + +jobs: + detect_breaking_changes: + name: detect-breaking-changes + if: github.repository == 'G-Core/gcore-python' + steps: + - name: Calculate fetch-depth + run: | + echo "FETCH_DEPTH=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_ENV + + - uses: actions/checkout@v4 + with: + # Ensure we can check out the pull request base in the script below. + fetch-depth: ${{ env.FETCH_DEPTH }} + + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + - name: Install dependencies + run: | + rye sync --all-features + + - name: Detect breaking changes + run: ./scripts/detect-breaking-changes ${{ github.event.pull_request.base.sha }} \ No newline at end of file From bccf62df0472ee92fae8473def737e9f018f1864 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 02:19:36 +0000 Subject: [PATCH 135/592] chore(internal): codegen related update --- .github/workflows/detect-breaking-changes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/detect-breaking-changes.yml b/.github/workflows/detect-breaking-changes.yml index 0d6fc790..2803e06e 100644 --- a/.github/workflows/detect-breaking-changes.yml +++ b/.github/workflows/detect-breaking-changes.yml @@ -7,6 +7,7 @@ on: jobs: detect_breaking_changes: + runs-on: 'ubuntu-latest' name: detect-breaking-changes if: github.repository == 'G-Core/gcore-python' steps: From 0696db2d9eb21766080315008351e1fa659302d9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 03:20:33 +0000 Subject: [PATCH 136/592] chore(api): mark some methods as deprecated --- src/gcore/resources/cloud/secrets.py | 27 ++- tests/api_resources/cloud/test_secrets.py | 194 ++++++++++++---------- 2 files changed, 123 insertions(+), 98 deletions(-) diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 6c5b747f..07c3df20 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Union, Optional from datetime import datetime from typing_extensions import Literal @@ -47,6 +48,7 @@ def with_streaming_response(self) -> SecretsResourceWithStreamingResponse: """ return SecretsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def create( self, *, @@ -349,6 +351,7 @@ def with_streaming_response(self) -> AsyncSecretsResourceWithStreamingResponse: """ return AsyncSecretsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def create( self, *, @@ -635,8 +638,10 @@ class SecretsResourceWithRawResponse: def __init__(self, secrets: SecretsResource) -> None: self._secrets = secrets - self.create = to_raw_response_wrapper( - secrets.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + secrets.create # pyright: ignore[reportDeprecated], + ) ) self.list = to_raw_response_wrapper( secrets.list, @@ -656,8 +661,10 @@ class AsyncSecretsResourceWithRawResponse: def __init__(self, secrets: AsyncSecretsResource) -> None: self._secrets = secrets - self.create = async_to_raw_response_wrapper( - secrets.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + secrets.create # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_raw_response_wrapper( secrets.list, @@ -677,8 +684,10 @@ class SecretsResourceWithStreamingResponse: def __init__(self, secrets: SecretsResource) -> None: self._secrets = secrets - self.create = to_streamed_response_wrapper( - secrets.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + secrets.create # pyright: ignore[reportDeprecated], + ) ) self.list = to_streamed_response_wrapper( secrets.list, @@ -698,8 +707,10 @@ class AsyncSecretsResourceWithStreamingResponse: def __init__(self, secrets: AsyncSecretsResource) -> None: self._secrets = secrets - self.create = async_to_streamed_response_wrapper( - secrets.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + secrets.create # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_streamed_response_wrapper( secrets.list, diff --git a/tests/api_resources/cloud/test_secrets.py b/tests/api_resources/cloud/test_secrets.py index dc87c6ca..58399b6b 100644 --- a/tests/api_resources/cloud/test_secrets.py +++ b/tests/api_resources/cloud/test_secrets.py @@ -16,6 +16,8 @@ SecretListResponse, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,45 +26,50 @@ class TestSecrets: @parametrize def test_method_create(self, client: Gcore) -> None: - secret = client.cloud.secrets.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - ) + with pytest.warns(DeprecationWarning): + secret = client.cloud.secrets.create( + project_id=1, + region_id=1, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + ) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - secret = client.cloud.secrets.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - algorithm="aes", - bit_length=256, - expiration="2025-12-28T19:14:44.180394", - mode="cbc", - ) + with pytest.warns(DeprecationWarning): + secret = client.cloud.secrets.create( + project_id=1, + region_id=1, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + algorithm="aes", + bit_length=256, + expiration="2025-12-28T19:14:44.180394", + mode="cbc", + ) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.cloud.secrets.with_raw_response.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.secrets.with_raw_response.create( + project_id=1, + region_id=1, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -71,20 +78,21 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.cloud.secrets.with_streaming_response.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - secret = response.parse() - assert_matches_type(TaskIDList, secret, path=["response"]) + with pytest.warns(DeprecationWarning): + with client.cloud.secrets.with_streaming_response.create( + project_id=1, + region_id=1, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(TaskIDList, secret, path=["response"]) assert cast(Any, response.is_closed) is True @@ -287,45 +295,50 @@ class TestAsyncSecrets: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - secret = await async_client.cloud.secrets.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - ) + with pytest.warns(DeprecationWarning): + secret = await async_client.cloud.secrets.create( + project_id=1, + region_id=1, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + ) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - secret = await async_client.cloud.secrets.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - algorithm="aes", - bit_length=256, - expiration="2025-12-28T19:14:44.180394", - mode="cbc", - ) + with pytest.warns(DeprecationWarning): + secret = await async_client.cloud.secrets.create( + project_id=1, + region_id=1, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + algorithm="aes", + bit_length=256, + expiration="2025-12-28T19:14:44.180394", + mode="cbc", + ) + assert_matches_type(TaskIDList, secret, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.secrets.with_raw_response.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.secrets.with_raw_response.create( + project_id=1, + region_id=1, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -334,20 +347,21 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.secrets.with_streaming_response.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - secret = await response.parse() - assert_matches_type(TaskIDList, secret, path=["response"]) + with pytest.warns(DeprecationWarning): + async with async_client.cloud.secrets.with_streaming_response.create( + project_id=1, + region_id=1, + name="AES key", + payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", + payload_content_encoding="base64", + payload_content_type="application/octet-stream", + secret_type="certificate", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(TaskIDList, secret, path=["response"]) assert cast(Any, response.is_closed) is True From 1b936dd92b2e073c3f9cdbb13426ff3f67df13c6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 12:13:24 +0000 Subject: [PATCH 137/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 23 +- .../cloud/load_balancers/listeners.py | 74 +++++- .../load_balancers/pools/health_monitors.py | 24 ++ .../cloud/load_balancers/pools/members.py | 28 ++ .../cloud/load_balancers/pools/pools.py | 86 ++++-- src/gcore/resources/cloud/secrets.py | 40 ++- src/gcore/types/cloud/__init__.py | 4 +- .../cloud/load_balancer_listener_detail.py | 26 +- .../types/cloud/load_balancer_pool_list.py | 16 -- .../types/cloud/load_balancers/__init__.py | 3 + .../load_balancers/listener_create_params.py | 2 + .../load_balancers/listener_get_params.py | 4 +- .../load_balancers/listener_list_params.py | 6 +- .../listener_list_response.py} | 8 +- .../load_balancers/listener_update_params.py | 2 + .../load_balancers/pool_create_params.py | 2 + .../pool_get_response.py} | 46 ++-- .../cloud/load_balancers/pool_list_params.py | 11 +- .../load_balancers/pool_list_response.py | 111 ++++++++ .../load_balancers/pool_update_params.py | 2 + .../pools/health_monitor_create_params.py | 2 + .../load_balancers/pools/member_add_params.py | 2 + src/gcore/types/cloud/secret_list_params.py | 24 ++ .../pools/test_health_monitors.py | 100 +++---- .../load_balancers/pools/test_members.py | 128 ++++----- .../cloud/load_balancers/test_listeners.py | 245 ++++++++--------- .../cloud/load_balancers/test_pools.py | 250 +++++++++--------- tests/api_resources/cloud/test_secrets.py | 20 ++ 29 files changed, 826 insertions(+), 467 deletions(-) delete mode 100644 src/gcore/types/cloud/load_balancer_pool_list.py rename src/gcore/types/cloud/{load_balancer_listener_list.py => load_balancers/listener_list_response.py} (54%) rename src/gcore/types/cloud/{load_balancer_pool.py => load_balancers/pool_get_response.py} (80%) create mode 100644 src/gcore/types/cloud/load_balancers/pool_list_response.py create mode 100644 src/gcore/types/cloud/secret_list_params.py diff --git a/.stats.yml b/.stats.yml index 02e5c7e3..668c6274 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f211780370767c7e119e6a521bface760f0d7d5f56eb7778e5215387a84b7833.yml -openapi_spec_hash: 8a7d2ec234f85a81061fc00934222de3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0183b03a839d67292fc87f913f05c69b4cae2b0eb081f1c0ea2774403d553300.yml +openapi_spec_hash: d296de433c5f2f6ea840de9468d1aced config_hash: 047d50bb070fced4bb9e05678a72b874 diff --git a/api.md b/api.md index 2dd78ec7..dcecc6b0 100644 --- a/api.md +++ b/api.md @@ -140,7 +140,7 @@ from gcore.types.cloud import Secret, SecretListResponse Methods: - client.cloud.secrets.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.secrets.list(\*, project_id, region_id) -> SecretListResponse +- client.cloud.secrets.list(\*, project_id, region_id, \*\*params) -> SecretListResponse - client.cloud.secrets.delete(secret_id, \*, project_id, region_id) -> TaskIDList - client.cloud.secrets.get(secret_id, \*, project_id, region_id) -> Secret - client.cloud.secrets.upload_tls_certificate(\*, project_id, region_id, \*\*params) -> TaskIDList @@ -194,11 +194,8 @@ from gcore.types.cloud import ( LoadBalancerL7Rule, LoadBalancerL7RuleList, LoadBalancerListenerDetail, - LoadBalancerListenerList, LoadBalancerMetrics, LoadBalancerMetricsList, - LoadBalancerPool, - LoadBalancerPoolList, LoadBalancerStatus, LoadBalancerStatusList, Member, @@ -246,23 +243,35 @@ Methods: ### Listeners +Types: + +```python +from gcore.types.cloud.load_balancers import ListenerListResponse +``` + Methods: - client.cloud.load_balancers.listeners.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.listeners.update(listener_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.listeners.list(\*, project_id, region_id, \*\*params) -> LoadBalancerListenerList +- client.cloud.load_balancers.listeners.list(\*, project_id, region_id, \*\*params) -> ListenerListResponse - client.cloud.load_balancers.listeners.delete(listener_id, \*, project_id, region_id) -> TaskIDList - client.cloud.load_balancers.listeners.get(listener_id, \*, project_id, region_id, \*\*params) -> LoadBalancerListenerDetail ### Pools +Types: + +```python +from gcore.types.cloud.load_balancers import PoolListResponse, PoolGetResponse +``` + Methods: - client.cloud.load_balancers.pools.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.pools.update(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.pools.list(\*, project_id, region_id, \*\*params) -> LoadBalancerPoolList +- client.cloud.load_balancers.pools.list(\*, project_id, region_id, \*\*params) -> PoolListResponse - client.cloud.load_balancers.pools.delete(pool_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.load_balancers.pools.get(pool_id, \*, project_id, region_id) -> LoadBalancerPool +- client.cloud.load_balancers.pools.get(pool_id, \*, project_id, region_id) -> PoolGetResponse #### HealthMonitors diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 5a39cabc..6059351b 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -26,8 +26,8 @@ listener_update_params, ) from ....types.cloud.lb_listener_protocol import LbListenerProtocol -from ....types.cloud.load_balancer_listener_list import LoadBalancerListenerList from ....types.cloud.load_balancer_listener_detail import LoadBalancerListenerDetail +from ....types.cloud.load_balancers.listener_list_response import ListenerListResponse __all__ = ["ListenersResource", "AsyncListenersResource"] @@ -81,6 +81,10 @@ def create( Create load balancer listener Args: + project_id: Project ID + + region_id: Region ID + loadbalancer_id: Load balancer ID name: Load balancer listener name @@ -174,6 +178,12 @@ def update( Update listener Args: + project_id: Project ID + + region_id: Region ID + + listener_id: Listener ID + allowed_cidrs: Network CIDRs from which service will be accessible connection_limit: Limit of simultaneous connections @@ -243,14 +253,18 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancerListenerList: + ) -> ListenerListResponse: """ List load balancer listeners Args: - loadbalancer_id: Load balancer ID + project_id: Project ID + + region_id: Region ID - show_stats: Show statistics + loadbalancer_id: Load Balancer ID + + show_stats: Show stats extra_headers: Send extra headers @@ -279,7 +293,7 @@ def list( listener_list_params.ListenerListParams, ), ), - cast_to=LoadBalancerListenerList, + cast_to=ListenerListResponse, ) def delete( @@ -299,6 +313,12 @@ def delete( Delete load balancer listener Args: + project_id: Project ID + + region_id: Region ID + + listener_id: Listener ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -339,7 +359,13 @@ def get( Get listener Args: - show_stats: Show statistics + project_id: Project ID + + region_id: Region ID + + listener_id: Listener ID + + show_stats: Show stats extra_headers: Send extra headers @@ -417,6 +443,10 @@ async def create( Create load balancer listener Args: + project_id: Project ID + + region_id: Region ID + loadbalancer_id: Load balancer ID name: Load balancer listener name @@ -510,6 +540,12 @@ async def update( Update listener Args: + project_id: Project ID + + region_id: Region ID + + listener_id: Listener ID + allowed_cidrs: Network CIDRs from which service will be accessible connection_limit: Limit of simultaneous connections @@ -579,14 +615,18 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancerListenerList: + ) -> ListenerListResponse: """ List load balancer listeners Args: - loadbalancer_id: Load balancer ID + project_id: Project ID + + region_id: Region ID - show_stats: Show statistics + loadbalancer_id: Load Balancer ID + + show_stats: Show stats extra_headers: Send extra headers @@ -615,7 +655,7 @@ async def list( listener_list_params.ListenerListParams, ), ), - cast_to=LoadBalancerListenerList, + cast_to=ListenerListResponse, ) async def delete( @@ -635,6 +675,12 @@ async def delete( Delete load balancer listener Args: + project_id: Project ID + + region_id: Region ID + + listener_id: Listener ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -675,7 +721,13 @@ async def get( Get listener Args: - show_stats: Show statistics + project_id: Project ID + + region_id: Region ID + + listener_id: Listener ID + + show_stats: Show stats extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index b2fbfd0f..0a63989b 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -71,6 +71,12 @@ def create( Create Load Balancer Pool Health Monitor Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + delay: The time, in seconds, between sending probes to members max_retries: Number of successes before the member is switched to ONLINE state @@ -141,6 +147,12 @@ def delete( Delete load balancer pool health monitor Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -210,6 +222,12 @@ async def create( Create Load Balancer Pool Health Monitor Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + delay: The time, in seconds, between sending probes to members max_retries: Number of successes before the member is switched to ONLINE state @@ -280,6 +298,12 @@ async def delete( Delete load balancer pool health monitor Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index ec0cbf0e..63885efa 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -68,6 +68,12 @@ def add( Create load balancer pool member Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + address: Member IP address protocol_port: Member IP port @@ -139,6 +145,14 @@ def remove( Delete load balancer pool member Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + + member_id: Member ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -209,6 +223,12 @@ async def add( Create load balancer pool member Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + address: Member IP address protocol_port: Member IP port @@ -280,6 +300,14 @@ async def remove( Delete load balancer pool member Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + + member_id: Member ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 5d7a4c8a..0416c5d9 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -38,8 +38,8 @@ from .....types.cloud.task_id_list import TaskIDList from .....types.cloud.load_balancers import pool_list_params, pool_create_params, pool_update_params from .....types.cloud.lb_pool_protocol import LbPoolProtocol -from .....types.cloud.load_balancer_pool import LoadBalancerPool -from .....types.cloud.load_balancer_pool_list import LoadBalancerPoolList +from .....types.cloud.load_balancers.pool_get_response import PoolGetResponse +from .....types.cloud.load_balancers.pool_list_response import PoolListResponse __all__ = ["PoolsResource", "AsyncPoolsResource"] @@ -102,6 +102,10 @@ def create( Create load balancer pool Args: + project_id: Project ID + + region_id: Region ID + lb_algorithm: Load balancer algorithm name: Pool name @@ -200,6 +204,12 @@ def update( they will be overwritten. Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + ca_secret_id: Secret ID of CA certificate bundle crl_secret_id: Secret ID of CA revocation list file @@ -278,17 +288,20 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancerPoolList: + ) -> PoolListResponse: """ List load balancer pools Args: - details: If true, show member and healthmonitor details of each pool (increases request - time) + project_id: Project ID + + region_id: Region ID + + details: Show members and Health Monitor details - listener_id: Load balancer listener ID + listener_id: Listener ID - loadbalancer_id: Load balancer ID + loadbalancer_id: Load Balancer ID extra_headers: Send extra headers @@ -318,7 +331,7 @@ def list( pool_list_params.PoolListParams, ), ), - cast_to=LoadBalancerPoolList, + cast_to=PoolListResponse, ) def delete( @@ -338,6 +351,12 @@ def delete( Delete load balancer pool Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -372,11 +391,17 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancerPool: + ) -> PoolGetResponse: """ Get load balancer pool Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -396,7 +421,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerPool, + cast_to=PoolGetResponse, ) @@ -458,6 +483,10 @@ async def create( Create load balancer pool Args: + project_id: Project ID + + region_id: Region ID + lb_algorithm: Load balancer algorithm name: Pool name @@ -556,6 +585,12 @@ async def update( they will be overwritten. Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + ca_secret_id: Secret ID of CA certificate bundle crl_secret_id: Secret ID of CA revocation list file @@ -634,17 +669,20 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancerPoolList: + ) -> PoolListResponse: """ List load balancer pools Args: - details: If true, show member and healthmonitor details of each pool (increases request - time) + project_id: Project ID + + region_id: Region ID + + details: Show members and Health Monitor details - listener_id: Load balancer listener ID + listener_id: Listener ID - loadbalancer_id: Load balancer ID + loadbalancer_id: Load Balancer ID extra_headers: Send extra headers @@ -674,7 +712,7 @@ async def list( pool_list_params.PoolListParams, ), ), - cast_to=LoadBalancerPoolList, + cast_to=PoolListResponse, ) async def delete( @@ -694,6 +732,12 @@ async def delete( Delete load balancer pool Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -728,11 +772,17 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LoadBalancerPool: + ) -> PoolGetResponse: """ Get load balancer pool Args: + project_id: Project ID + + region_id: Region ID + + pool_id: Pool ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -752,7 +802,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerPool, + cast_to=PoolGetResponse, ) diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 07c3df20..c02861a2 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -19,7 +19,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...types.cloud import secret_create_params, secret_upload_tls_certificate_params +from ...types.cloud import secret_list_params, secret_create_params, secret_upload_tls_certificate_params from ..._base_client import make_request_options from ...types.cloud.secret import Secret from ...types.cloud.task_id_list import TaskIDList @@ -148,6 +148,8 @@ def list( *, project_id: int | None = None, region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -163,6 +165,11 @@ def list( region_id: Region ID + limit: Optional. Limit the number of returned items + + offset: Optional. Offset value is used to exclude the first set of records from the + result + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -178,7 +185,17 @@ def list( return self._get( f"/cloud/v1/secrets/{project_id}/{region_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + }, + secret_list_params.SecretListParams, + ), ), cast_to=SecretListResponse, ) @@ -451,6 +468,8 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -466,6 +485,11 @@ async def list( region_id: Region ID + limit: Optional. Limit the number of returned items + + offset: Optional. Offset value is used to exclude the first set of records from the + result + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -481,7 +505,17 @@ async def list( return await self._get( f"/cloud/v1/secrets/{project_id}/{region_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "limit": limit, + "offset": offset, + }, + secret_list_params.SecretListParams, + ), ), cast_to=SecretListResponse, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 76ad9725..6f83cf93 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -65,8 +65,8 @@ from .ingress_opts_param import IngressOptsParam as IngressOptsParam from .instance_interface import InstanceInterface as InstanceInterface from .instance_isolation import InstanceIsolation as InstanceIsolation -from .load_balancer_pool import LoadBalancerPool as LoadBalancerPool from .region_list_params import RegionListParams as RegionListParams +from .secret_list_params import SecretListParams as SecretListParams from .volume_list_params import VolumeListParams as VolumeListParams from .billing_reservation import BillingReservation as BillingReservation from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus @@ -120,7 +120,6 @@ from .registry_resize_params import RegistryResizeParams as RegistryResizeParams from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams from .load_balancer_l7_policy import LoadBalancerL7Policy as LoadBalancerL7Policy -from .load_balancer_pool_list import LoadBalancerPoolList as LoadBalancerPoolList from .container_probe_http_get import ContainerProbeHTTPGet as ContainerProbeHTTPGet from .container_scale_triggers import ContainerScaleTriggers as ContainerScaleTriggers from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList @@ -152,7 +151,6 @@ from .load_balancer_create_params import LoadBalancerCreateParams as LoadBalancerCreateParams from .load_balancer_flavor_detail import LoadBalancerFlavorDetail as LoadBalancerFlavorDetail from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole -from .load_balancer_listener_list import LoadBalancerListenerList as LoadBalancerListenerList from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams diff --git a/src/gcore/types/cloud/load_balancer_listener_detail.py b/src/gcore/types/cloud/load_balancer_listener_detail.py index d73d07af..46bec730 100644 --- a/src/gcore/types/cloud/load_balancer_listener_detail.py +++ b/src/gcore/types/cloud/load_balancer_listener_detail.py @@ -23,21 +23,33 @@ class LoadBalancerListenerDetail(BaseModel): id: str """Load balancer listener ID""" + allowed_cidrs: Optional[List[str]] = None + """Network CIDRs from which service will be accessible""" + connection_limit: int """Limit of simultaneous connections""" + creator_task_id: Optional[str] = None + """Task that created this entity""" + insert_headers: object """Dictionary of additional header insertion into HTTP headers. Only used with HTTP and TERMINATED_HTTPS protocols. """ + loadbalancer_id: Optional[str] = None + """Load balancer ID""" + name: str """Load balancer listener name""" operating_status: LoadBalancerOperatingStatus """Listener operating status""" + pool_count: Optional[int] = None + """Number of pools (for UI)""" + protocol: LbListenerProtocol """Load balancer protocol""" @@ -47,18 +59,6 @@ class LoadBalancerListenerDetail(BaseModel): provisioning_status: ProvisioningStatus """Listener lifecycle status""" - allowed_cidrs: Optional[List[str]] = None - """Network CIDRs from which service will be accessible""" - - creator_task_id: Optional[str] = None - """Task that created this entity""" - - loadbalancer_id: Optional[str] = None - """Load balancer ID""" - - pool_count: Optional[int] = None - """Number of pools (for UI)""" - secret_id: Optional[str] = None """ ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS @@ -93,5 +93,5 @@ class LoadBalancerListenerDetail(BaseModel): timeout_member_data: Optional[int] = None """Backend member inactivity timeout in milliseconds""" - user_list: Optional[List[UserList]] = None + user_list: List[UserList] """Load balancer listener users list""" diff --git a/src/gcore/types/cloud/load_balancer_pool_list.py b/src/gcore/types/cloud/load_balancer_pool_list.py deleted file mode 100644 index 071e22e5..00000000 --- a/src/gcore/types/cloud/load_balancer_pool_list.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .load_balancer_pool import LoadBalancerPool - -__all__ = ["LoadBalancerPoolList"] - - -class LoadBalancerPoolList(BaseModel): - count: int - """Number of objects""" - - results: List[LoadBalancerPool] - """Objects""" diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index 433f966c..5c43eb6a 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -3,13 +3,16 @@ from __future__ import annotations from .pool_list_params import PoolListParams as PoolListParams +from .pool_get_response import PoolGetResponse as PoolGetResponse from .flavor_list_params import FlavorListParams as FlavorListParams from .metric_list_params import MetricListParams as MetricListParams from .pool_create_params import PoolCreateParams as PoolCreateParams +from .pool_list_response import PoolListResponse as PoolListResponse from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .listener_get_params import ListenerGetParams as ListenerGetParams from .listener_list_params import ListenerListParams as ListenerListParams from .listener_create_params import ListenerCreateParams as ListenerCreateParams +from .listener_list_response import ListenerListResponse as ListenerListResponse 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/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py index 903e4330..338c43af 100644 --- a/src/gcore/types/cloud/load_balancers/listener_create_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -12,8 +12,10 @@ class ListenerCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" loadbalancer_id: Required[str] """Load balancer ID""" diff --git a/src/gcore/types/cloud/load_balancers/listener_get_params.py b/src/gcore/types/cloud/load_balancers/listener_get_params.py index 798a60c7..f3825291 100644 --- a/src/gcore/types/cloud/load_balancers/listener_get_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_get_params.py @@ -9,8 +9,10 @@ class ListenerGetParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" show_stats: bool - """Show statistics""" + """Show stats""" diff --git a/src/gcore/types/cloud/load_balancers/listener_list_params.py b/src/gcore/types/cloud/load_balancers/listener_list_params.py index 1d76944b..783d8482 100644 --- a/src/gcore/types/cloud/load_balancers/listener_list_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_list_params.py @@ -9,11 +9,13 @@ class ListenerListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" loadbalancer_id: str - """Load balancer ID""" + """Load Balancer ID""" show_stats: bool - """Show statistics""" + """Show stats""" diff --git a/src/gcore/types/cloud/load_balancer_listener_list.py b/src/gcore/types/cloud/load_balancers/listener_list_response.py similarity index 54% rename from src/gcore/types/cloud/load_balancer_listener_list.py rename to src/gcore/types/cloud/load_balancers/listener_list_response.py index eb426067..cda6ff03 100644 --- a/src/gcore/types/cloud/load_balancer_listener_list.py +++ b/src/gcore/types/cloud/load_balancers/listener_list_response.py @@ -2,13 +2,13 @@ from typing import List -from ..._models import BaseModel -from .load_balancer_listener_detail import LoadBalancerListenerDetail +from ...._models import BaseModel +from ..load_balancer_listener_detail import LoadBalancerListenerDetail -__all__ = ["LoadBalancerListenerList"] +__all__ = ["ListenerListResponse"] -class LoadBalancerListenerList(BaseModel): +class ListenerListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/load_balancers/listener_update_params.py b/src/gcore/types/cloud/load_balancers/listener_update_params.py index 62517db0..54f5c1e9 100644 --- a/src/gcore/types/cloud/load_balancers/listener_update_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_update_params.py @@ -10,8 +10,10 @@ class ListenerUpdateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" allowed_cidrs: Optional[List[str]] """Network CIDRs from which service will be accessible""" 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 eabedba7..957f4c1b 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -16,8 +16,10 @@ class PoolCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" lb_algorithm: Required[LbAlgorithm] """Load balancer algorithm""" diff --git a/src/gcore/types/cloud/load_balancer_pool.py b/src/gcore/types/cloud/load_balancers/pool_get_response.py similarity index 80% rename from src/gcore/types/cloud/load_balancer_pool.py rename to src/gcore/types/cloud/load_balancers/pool_get_response.py index c9f6217d..2487ffb2 100644 --- a/src/gcore/types/cloud/load_balancer_pool.py +++ b/src/gcore/types/cloud/load_balancers/pool_get_response.py @@ -2,16 +2,16 @@ from typing import List, Optional -from .member import Member -from ..._models import BaseModel -from .lb_algorithm import LbAlgorithm -from .health_monitor import HealthMonitor -from .lb_pool_protocol import LbPoolProtocol -from .provisioning_status import ProvisioningStatus -from .session_persistence import SessionPersistence -from .load_balancer_operating_status import LoadBalancerOperatingStatus +from ..member import Member +from ...._models import BaseModel +from ..lb_algorithm import LbAlgorithm +from ..health_monitor import HealthMonitor +from ..lb_pool_protocol import LbPoolProtocol +from ..provisioning_status import ProvisioningStatus +from ..session_persistence import SessionPersistence +from ..load_balancer_operating_status import LoadBalancerOperatingStatus -__all__ = ["LoadBalancerPool", "Listener", "Loadbalancer"] +__all__ = ["PoolGetResponse", "Listener", "Loadbalancer"] class Listener(BaseModel): @@ -24,16 +24,22 @@ class Loadbalancer(BaseModel): """Resource ID""" -class LoadBalancerPool(BaseModel): +class PoolGetResponse(BaseModel): id: str """Pool ID""" ca_secret_id: Optional[str] = None """Secret ID of CA certificate bundle""" + creator_task_id: Optional[str] = None + """Task that created this entity""" + crl_secret_id: Optional[str] = None """Secret ID of CA revocation list file""" + healthmonitor: Optional[HealthMonitor] = None + """Health monitor parameters""" + lb_algorithm: LbAlgorithm """Load balancer algorithm""" @@ -64,6 +70,13 @@ class LoadBalancerPool(BaseModel): session_persistence: Optional[SessionPersistence] = None """Session persistence parameters""" + task_id: Optional[str] = None + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. + """ + timeout_client_data: Optional[int] = None """Frontend client inactivity timeout in milliseconds""" @@ -72,16 +85,3 @@ class LoadBalancerPool(BaseModel): timeout_member_data: Optional[int] = None """Backend member inactivity timeout in milliseconds""" - - creator_task_id: Optional[str] = None - """Task that created this entity""" - - healthmonitor: Optional[HealthMonitor] = None - """Health monitor parameters""" - - task_id: Optional[str] = None - """The UUID of the active task that currently holds a lock on the resource. - - This lock prevents concurrent modifications to ensure consistency. If `null`, - the resource is not locked. - """ diff --git a/src/gcore/types/cloud/load_balancers/pool_list_params.py b/src/gcore/types/cloud/load_balancers/pool_list_params.py index ec9fe43a..16020665 100644 --- a/src/gcore/types/cloud/load_balancers/pool_list_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_list_params.py @@ -9,17 +9,16 @@ class PoolListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" details: bool - """ - If true, show member and healthmonitor details of each pool (increases request - time) - """ + """Show members and Health Monitor details""" listener_id: str - """Load balancer listener ID""" + """Listener ID""" loadbalancer_id: str - """Load balancer ID""" + """Load Balancer ID""" diff --git a/src/gcore/types/cloud/load_balancers/pool_list_response.py b/src/gcore/types/cloud/load_balancers/pool_list_response.py new file mode 100644 index 00000000..9296bdaf --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/pool_list_response.py @@ -0,0 +1,111 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import TypeAlias + +from ..member import Member +from ...._models import BaseModel +from ..lb_algorithm import LbAlgorithm +from ..health_monitor import HealthMonitor +from ..lb_pool_protocol import LbPoolProtocol +from ..provisioning_status import ProvisioningStatus +from ..session_persistence import SessionPersistence +from ..load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = [ + "PoolListResponse", + "Result", + "ResultListener", + "ResultLoadbalancer", + "ResultMember", + "ResultMemberLbPoolMemberSerializer", +] + + +class ResultListener(BaseModel): + id: str + """Resource ID""" + + +class ResultLoadbalancer(BaseModel): + id: str + """Resource ID""" + + +class ResultMemberLbPoolMemberSerializer(BaseModel): + id: str + """Member ID must be provided if an existing member is being updated""" + + +ResultMember: TypeAlias = Union[ResultMemberLbPoolMemberSerializer, Member] + + +class Result(BaseModel): + id: str + """Pool ID""" + + ca_secret_id: Optional[str] = None + """Secret ID of CA certificate bundle""" + + creator_task_id: Optional[str] = None + """Task that created this entity""" + + crl_secret_id: Optional[str] = None + """Secret ID of CA revocation list file""" + + healthmonitor: Optional[HealthMonitor] = None + """Health monitor parameters""" + + lb_algorithm: LbAlgorithm + """Load balancer algorithm""" + + listeners: List[ResultListener] + """Listeners IDs""" + + loadbalancers: List[ResultLoadbalancer] + """Load balancers IDs""" + + members: List[ResultMember] + """Pool members""" + + name: str + """Pool name""" + + operating_status: LoadBalancerOperatingStatus + """Pool operating status""" + + protocol: LbPoolProtocol + """Protocol""" + + provisioning_status: ProvisioningStatus + """Pool lifecycle status""" + + secret_id: Optional[str] = None + """Secret ID for TLS client authentication to the member servers""" + + session_persistence: Optional[SessionPersistence] = None + """Session persistence parameters""" + + task_id: Optional[str] = None + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. + """ + + timeout_client_data: Optional[int] = None + """Frontend client inactivity timeout in milliseconds""" + + timeout_member_connect: Optional[int] = None + """Backend member connection timeout in milliseconds""" + + timeout_member_data: Optional[int] = None + """Backend member inactivity timeout in milliseconds""" + + +class PoolListResponse(BaseModel): + count: int + """Number of objects""" + + results: List[Result] + """Objects""" 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 ebea1a3a..0a4c2006 100644 --- a/src/gcore/types/cloud/load_balancers/pool_update_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_update_params.py @@ -16,8 +16,10 @@ class PoolUpdateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" ca_secret_id: Optional[str] """Secret ID of CA certificate bundle""" diff --git a/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py b/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py index d2726ec9..2f73578e 100644 --- a/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py @@ -14,8 +14,10 @@ class HealthMonitorCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" delay: Required[int] """The time, in seconds, between sending probes to members""" diff --git a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py index e13d9f3e..fa2e5d28 100644 --- a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py @@ -10,8 +10,10 @@ class MemberAddParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" address: Required[str] """Member IP address""" diff --git a/src/gcore/types/cloud/secret_list_params.py b/src/gcore/types/cloud/secret_list_params.py new file mode 100644 index 00000000..694229eb --- /dev/null +++ b/src/gcore/types/cloud/secret_list_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["SecretListParams"] + + +class SecretListParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + limit: int + """Optional. Limit the number of returned items""" + + offset: int + """Optional. + + Offset value is used to exclude the first set of records from the result + """ diff --git a/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py b/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py index 9a3acf5f..d5df2874 100644 --- a/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py +++ b/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py @@ -20,9 +20,9 @@ class TestHealthMonitors: @parametrize def test_method_create(self, client: Gcore) -> None: health_monitor = client.cloud.load_balancers.pools.health_monitors.create( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, delay=10, max_retries=2, api_timeout=5, @@ -33,9 +33,9 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: health_monitor = client.cloud.load_balancers.pools.health_monitors.create( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, delay=10, max_retries=2, api_timeout=5, @@ -50,9 +50,9 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.load_balancers.pools.health_monitors.with_raw_response.create( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, delay=10, max_retries=2, api_timeout=5, @@ -67,9 +67,9 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.load_balancers.pools.health_monitors.with_streaming_response.create( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, delay=10, max_retries=2, api_timeout=5, @@ -88,8 +88,8 @@ 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.health_monitors.with_raw_response.create( pool_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, delay=10, max_retries=2, api_timeout=5, @@ -99,18 +99,18 @@ def test_path_params_create(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: health_monitor = client.cloud.load_balancers.pools.health_monitors.delete( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert health_monitor is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.load_balancers.pools.health_monitors.with_raw_response.delete( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -121,9 +121,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.load_balancers.pools.health_monitors.with_streaming_response.delete( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -138,8 +138,8 @@ 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.health_monitors.with_raw_response.delete( pool_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @@ -149,9 +149,9 @@ class TestAsyncHealthMonitors: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: health_monitor = await async_client.cloud.load_balancers.pools.health_monitors.create( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, delay=10, max_retries=2, api_timeout=5, @@ -162,9 +162,9 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: health_monitor = await async_client.cloud.load_balancers.pools.health_monitors.create( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, delay=10, max_retries=2, api_timeout=5, @@ -179,9 +179,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.pools.health_monitors.with_raw_response.create( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, delay=10, max_retries=2, api_timeout=5, @@ -196,9 +196,9 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.pools.health_monitors.with_streaming_response.create( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, delay=10, max_retries=2, api_timeout=5, @@ -217,8 +217,8 @@ 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.health_monitors.with_raw_response.create( pool_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, delay=10, max_retries=2, api_timeout=5, @@ -228,18 +228,18 @@ async def test_path_params_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: health_monitor = await async_client.cloud.load_balancers.pools.health_monitors.delete( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert health_monitor is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.pools.health_monitors.with_raw_response.delete( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -250,9 +250,9 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.pools.health_monitors.with_streaming_response.delete( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -267,6 +267,6 @@ 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.health_monitors.with_raw_response.delete( pool_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) 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 cd28252b..3bace5b7 100644 --- a/tests/api_resources/cloud/load_balancers/pools/test_members.py +++ b/tests/api_resources/cloud/load_balancers/pools/test_members.py @@ -20,9 +20,9 @@ class TestMembers: @parametrize def test_method_add(self, client: Gcore) -> None: member = client.cloud.load_balancers.pools.members.add( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, address="192.168.40.33", protocol_port=80, ) @@ -31,9 +31,9 @@ def test_method_add(self, client: Gcore) -> None: @parametrize def test_method_add_with_all_params(self, client: Gcore) -> None: member = client.cloud.load_balancers.pools.members.add( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, address="192.168.40.33", protocol_port=80, admin_state_up=False, @@ -48,9 +48,9 @@ def test_method_add_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_add(self, client: Gcore) -> None: response = client.cloud.load_balancers.pools.members.with_raw_response.add( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, address="192.168.40.33", protocol_port=80, ) @@ -63,9 +63,9 @@ def test_raw_response_add(self, client: Gcore) -> None: @parametrize def test_streaming_response_add(self, client: Gcore) -> None: with client.cloud.load_balancers.pools.members.with_streaming_response.add( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, address="192.168.40.33", protocol_port=80, ) as response: @@ -82,8 +82,8 @@ def test_path_params_add(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( pool_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, address="192.168.40.33", protocol_port=80, ) @@ -91,20 +91,20 @@ 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( - member_id="member_id", - project_id=0, - region_id=0, - pool_id="pool_id", + member_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + pool_id="00000000-0000-4000-8000-000000000000", ) 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( - member_id="member_id", - project_id=0, - region_id=0, - pool_id="pool_id", + member_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + pool_id="00000000-0000-4000-8000-000000000000", ) assert response.is_closed is True @@ -115,10 +115,10 @@ def test_raw_response_remove(self, client: Gcore) -> None: @parametrize def test_streaming_response_remove(self, client: Gcore) -> None: with client.cloud.load_balancers.pools.members.with_streaming_response.remove( - member_id="member_id", - project_id=0, - region_id=0, - pool_id="pool_id", + member_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + pool_id="00000000-0000-4000-8000-000000000000", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -132,18 +132,18 @@ def test_streaming_response_remove(self, client: Gcore) -> None: def test_path_params_remove(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( - member_id="member_id", - project_id=0, - region_id=0, + member_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, pool_id="", ) 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( member_id="", - project_id=0, - region_id=0, - pool_id="pool_id", + project_id=1, + region_id=1, + pool_id="00000000-0000-4000-8000-000000000000", ) @@ -153,9 +153,9 @@ class TestAsyncMembers: @parametrize async def test_method_add(self, async_client: AsyncGcore) -> None: member = await async_client.cloud.load_balancers.pools.members.add( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, address="192.168.40.33", protocol_port=80, ) @@ -164,9 +164,9 @@ async def test_method_add(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> None: member = await async_client.cloud.load_balancers.pools.members.add( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, address="192.168.40.33", protocol_port=80, admin_state_up=False, @@ -181,9 +181,9 @@ async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> Non @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( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, address="192.168.40.33", protocol_port=80, ) @@ -196,9 +196,9 @@ async def test_raw_response_add(self, async_client: AsyncGcore) -> None: @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( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, address="192.168.40.33", protocol_port=80, ) as response: @@ -215,8 +215,8 @@ async def test_path_params_add(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( pool_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, address="192.168.40.33", protocol_port=80, ) @@ -224,20 +224,20 @@ 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( - member_id="member_id", - project_id=0, - region_id=0, - pool_id="pool_id", + member_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + pool_id="00000000-0000-4000-8000-000000000000", ) 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( - member_id="member_id", - project_id=0, - region_id=0, - pool_id="pool_id", + member_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + pool_id="00000000-0000-4000-8000-000000000000", ) assert response.is_closed is True @@ -248,10 +248,10 @@ async def test_raw_response_remove(self, async_client: AsyncGcore) -> None: @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( - member_id="member_id", - project_id=0, - region_id=0, - pool_id="pool_id", + member_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + pool_id="00000000-0000-4000-8000-000000000000", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -265,16 +265,16 @@ async def test_streaming_response_remove(self, async_client: AsyncGcore) -> None async def test_path_params_remove(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( - member_id="member_id", - project_id=0, - region_id=0, + member_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, pool_id="", ) 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( member_id="", - project_id=0, - region_id=0, - pool_id="pool_id", + project_id=1, + region_id=1, + pool_id="00000000-0000-4000-8000-000000000000", ) diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index 2c98c9f4..cdd2a3ac 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -9,7 +9,10 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, LoadBalancerListenerList, LoadBalancerListenerDetail +from gcore.types.cloud import TaskIDList, LoadBalancerListenerDetail +from gcore.types.cloud.load_balancers import ( + ListenerListResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,8 +23,8 @@ class TestListeners: @parametrize def test_method_create(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", @@ -32,8 +35,8 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", @@ -58,8 +61,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.load_balancers.listeners.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", @@ -74,8 +77,8 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.load_balancers.listeners.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", @@ -92,18 +95,18 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.update( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, listener, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.update( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, allowed_cidrs=["10.0.0.0/8"], connection_limit=100000, name="new_listener_name", @@ -124,9 +127,9 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_update(self, client: Gcore) -> None: response = client.cloud.load_balancers.listeners.with_raw_response.update( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -137,9 +140,9 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: with client.cloud.load_balancers.listeners.with_streaming_response.update( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -154,69 +157,69 @@ def test_path_params_update(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `listener_id` but received ''"): client.cloud.load_balancers.listeners.with_raw_response.update( listener_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_list(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) - assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) + assert_matches_type(ListenerListResponse, listener, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.list( - project_id=0, - region_id=0, - loadbalancer_id="loadbalancer_id", + project_id=1, + region_id=1, + loadbalancer_id="00000000-0000-4000-8000-000000000000", show_stats=True, ) - assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) + assert_matches_type(ListenerListResponse, listener, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.load_balancers.listeners.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = response.parse() - assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) + assert_matches_type(ListenerListResponse, listener, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.load_balancers.listeners.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = response.parse() - assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) + assert_matches_type(ListenerListResponse, listener, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.delete( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, listener, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.load_balancers.listeners.with_raw_response.delete( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -227,9 +230,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.load_balancers.listeners.with_streaming_response.delete( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -244,25 +247,25 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `listener_id` but received ''"): client.cloud.load_balancers.listeners.with_raw_response.delete( listener_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_get(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.get( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert_matches_type(LoadBalancerListenerDetail, listener, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.get( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, show_stats=True, ) assert_matches_type(LoadBalancerListenerDetail, listener, path=["response"]) @@ -270,9 +273,9 @@ def test_method_get_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.load_balancers.listeners.with_raw_response.get( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -283,9 +286,9 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.load_balancers.listeners.with_streaming_response.get( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -300,8 +303,8 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `listener_id` but received ''"): client.cloud.load_balancers.listeners.with_raw_response.get( listener_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @@ -311,8 +314,8 @@ class TestAsyncListeners: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: listener = await async_client.cloud.load_balancers.listeners.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", @@ -323,8 +326,8 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: listener = await async_client.cloud.load_balancers.listeners.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", @@ -349,8 +352,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.listeners.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", @@ -365,8 +368,8 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.listeners.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", @@ -383,18 +386,18 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: listener = await async_client.cloud.load_balancers.listeners.update( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, listener, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: listener = await async_client.cloud.load_balancers.listeners.update( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, allowed_cidrs=["10.0.0.0/8"], connection_limit=100000, name="new_listener_name", @@ -415,9 +418,9 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.listeners.with_raw_response.update( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -428,9 +431,9 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.listeners.with_streaming_response.update( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -445,69 +448,69 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `listener_id` but received ''"): await async_client.cloud.load_balancers.listeners.with_raw_response.update( listener_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: listener = await async_client.cloud.load_balancers.listeners.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) - assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) + assert_matches_type(ListenerListResponse, listener, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: listener = await async_client.cloud.load_balancers.listeners.list( - project_id=0, - region_id=0, - loadbalancer_id="loadbalancer_id", + project_id=1, + region_id=1, + loadbalancer_id="00000000-0000-4000-8000-000000000000", show_stats=True, ) - assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) + assert_matches_type(ListenerListResponse, listener, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.listeners.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = await response.parse() - assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) + assert_matches_type(ListenerListResponse, listener, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.listeners.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = await response.parse() - assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) + assert_matches_type(ListenerListResponse, listener, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: listener = await async_client.cloud.load_balancers.listeners.delete( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, listener, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.listeners.with_raw_response.delete( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -518,9 +521,9 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.listeners.with_streaming_response.delete( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -535,25 +538,25 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `listener_id` but received ''"): await async_client.cloud.load_balancers.listeners.with_raw_response.delete( listener_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: listener = await async_client.cloud.load_balancers.listeners.get( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert_matches_type(LoadBalancerListenerDetail, listener, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: listener = await async_client.cloud.load_balancers.listeners.get( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, show_stats=True, ) assert_matches_type(LoadBalancerListenerDetail, listener, path=["response"]) @@ -561,9 +564,9 @@ async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> Non @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.listeners.with_raw_response.get( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -574,9 +577,9 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.listeners.with_streaming_response.get( - listener_id="listener_id", - project_id=0, - region_id=0, + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -591,6 +594,6 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `listener_id` but received ''"): await async_client.cloud.load_balancers.listeners.with_raw_response.get( listener_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py index ca8600e3..79282edc 100644 --- a/tests/api_resources/cloud/load_balancers/test_pools.py +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -9,7 +9,11 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, LoadBalancerPool, LoadBalancerPoolList +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.load_balancers import ( + PoolGetResponse, + PoolListResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,8 +24,8 @@ class TestPools: @parametrize def test_method_create(self, client: Gcore) -> None: pool = client.cloud.load_balancers.pools.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, lb_algorithm="LEAST_CONNECTIONS", name="pool_name", protocol="HTTP", @@ -31,8 +35,8 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: pool = client.cloud.load_balancers.pools.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, lb_algorithm="LEAST_CONNECTIONS", name="pool_name", protocol="HTTP", @@ -88,8 +92,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.load_balancers.pools.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, lb_algorithm="LEAST_CONNECTIONS", name="pool_name", protocol="HTTP", @@ -103,8 +107,8 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.load_balancers.pools.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, lb_algorithm="LEAST_CONNECTIONS", name="pool_name", protocol="HTTP", @@ -120,18 +124,18 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: pool = client.cloud.load_balancers.pools.update( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, pool, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: pool = client.cloud.load_balancers.pools.update( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ca_secret_id="ca_secret_id", crl_secret_id="crl_secret_id", healthmonitor={ @@ -175,9 +179,9 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_update(self, client: Gcore) -> None: response = client.cloud.load_balancers.pools.with_raw_response.update( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -188,9 +192,9 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: with client.cloud.load_balancers.pools.with_streaming_response.update( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -205,70 +209,70 @@ def test_path_params_update(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.with_raw_response.update( pool_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_list(self, client: Gcore) -> None: pool = client.cloud.load_balancers.pools.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) - assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: pool = client.cloud.load_balancers.pools.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, details=True, - listener_id="listener_id", - loadbalancer_id="loadbalancer_id", + listener_id="00000000-0000-4000-8000-000000000000", + loadbalancer_id="00000000-0000-4000-8000-000000000000", ) - assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.load_balancers.pools.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.load_balancers.pools.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: Gcore) -> None: pool = client.cloud.load_balancers.pools.delete( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, pool, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.load_balancers.pools.with_raw_response.delete( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -279,9 +283,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.load_balancers.pools.with_streaming_response.delete( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -296,44 +300,44 @@ 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.with_raw_response.delete( pool_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_get(self, client: Gcore) -> None: pool = client.cloud.load_balancers.pools.get( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) - assert_matches_type(LoadBalancerPool, pool, path=["response"]) + assert_matches_type(PoolGetResponse, pool, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.load_balancers.pools.with_raw_response.get( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(LoadBalancerPool, pool, path=["response"]) + assert_matches_type(PoolGetResponse, pool, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.load_balancers.pools.with_streaming_response.get( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(LoadBalancerPool, pool, path=["response"]) + assert_matches_type(PoolGetResponse, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -342,8 +346,8 @@ def test_path_params_get(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.with_raw_response.get( pool_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @@ -353,8 +357,8 @@ class TestAsyncPools: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.load_balancers.pools.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, lb_algorithm="LEAST_CONNECTIONS", name="pool_name", protocol="HTTP", @@ -364,8 +368,8 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.load_balancers.pools.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, lb_algorithm="LEAST_CONNECTIONS", name="pool_name", protocol="HTTP", @@ -421,8 +425,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.pools.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, lb_algorithm="LEAST_CONNECTIONS", name="pool_name", protocol="HTTP", @@ -436,8 +440,8 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.pools.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, lb_algorithm="LEAST_CONNECTIONS", name="pool_name", protocol="HTTP", @@ -453,18 +457,18 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.load_balancers.pools.update( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, pool, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.load_balancers.pools.update( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ca_secret_id="ca_secret_id", crl_secret_id="crl_secret_id", healthmonitor={ @@ -508,9 +512,9 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.pools.with_raw_response.update( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -521,9 +525,9 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.pools.with_streaming_response.update( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -538,70 +542,70 @@ async def test_path_params_update(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.with_raw_response.update( pool_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.load_balancers.pools.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) - assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.load_balancers.pools.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, details=True, - listener_id="listener_id", - loadbalancer_id="loadbalancer_id", + listener_id="00000000-0000-4000-8000-000000000000", + loadbalancer_id="00000000-0000-4000-8000-000000000000", ) - assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.pools.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.pools.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.load_balancers.pools.delete( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, pool, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.pools.with_raw_response.delete( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -612,9 +616,9 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.pools.with_streaming_response.delete( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -629,44 +633,44 @@ 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.with_raw_response.delete( pool_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.load_balancers.pools.get( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) - assert_matches_type(LoadBalancerPool, pool, path=["response"]) + assert_matches_type(PoolGetResponse, pool, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.pools.with_raw_response.get( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(LoadBalancerPool, pool, path=["response"]) + assert_matches_type(PoolGetResponse, pool, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.pools.with_streaming_response.get( - pool_id="pool_id", - project_id=0, - region_id=0, + pool_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(LoadBalancerPool, pool, path=["response"]) + assert_matches_type(PoolGetResponse, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -675,6 +679,6 @@ async def test_path_params_get(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.with_raw_response.get( pool_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) diff --git a/tests/api_resources/cloud/test_secrets.py b/tests/api_resources/cloud/test_secrets.py index 58399b6b..f49b1f3a 100644 --- a/tests/api_resources/cloud/test_secrets.py +++ b/tests/api_resources/cloud/test_secrets.py @@ -104,6 +104,16 @@ def test_method_list(self, client: Gcore) -> None: ) assert_matches_type(SecretListResponse, secret, path=["response"]) + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + secret = client.cloud.secrets.list( + project_id=1, + region_id=1, + limit=1000, + offset=0, + ) + assert_matches_type(SecretListResponse, secret, path=["response"]) + @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.secrets.with_raw_response.list( @@ -373,6 +383,16 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: ) assert_matches_type(SecretListResponse, secret, path=["response"]) + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + secret = await async_client.cloud.secrets.list( + project_id=1, + region_id=1, + limit=1000, + offset=0, + ) + assert_matches_type(SecretListResponse, secret, path=["response"]) + @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.secrets.with_raw_response.list( From da4e3d5153c2e6b307ad80e83881c28ce2e06f7f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 10:09:31 +0000 Subject: [PATCH 138/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cloud/inference/inference.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 668c6274..25425f2d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0183b03a839d67292fc87f913f05c69b4cae2b0eb081f1c0ea2774403d553300.yml -openapi_spec_hash: d296de433c5f2f6ea840de9468d1aced +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-da371b656e696b11b7a26b9bf9d92a381a49dc68c365c0071f4ac07a9a5c09c1.yml +openapi_spec_hash: b9fc73b647741b85d99cf6066154a945 config_hash: 047d50bb070fced4bb9e05678a72b874 diff --git a/src/gcore/types/cloud/inference/inference.py b/src/gcore/types/cloud/inference/inference.py index ef59071f..450c789f 100644 --- a/src/gcore/types/cloud/inference/inference.py +++ b/src/gcore/types/cloud/inference/inference.py @@ -70,7 +70,7 @@ class Inference(BaseModel): project_id: int """Project ID. If not provided, your default project ID will be used.""" - status: Literal["ACTIVE", "DELETING", "DEPLOYING", "DISABLED", "PARTIALLYDEPLOYED"] + status: Literal["ACTIVE", "DELETING", "DEPLOYING", "DISABLED", "PARTIALLYDEPLOYED", "PENDING"] """Inference instance status. Value can be one of the following: @@ -83,6 +83,8 @@ class Inference(BaseModel): explains the failure reason. - `ACTIVE` - The instance is running and ready to accept requests. - `DISABLED` - The instance is disabled and not accepting any requests. + - `PENDING` - The instance is running but scaled to zero. It will be + automatically scaled up when a request is made. - `DELETING` - The instance is being deleted. """ From 4f78dea721b04fd289a17c0f0d7ecb92cd3681c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 14:55:04 +0000 Subject: [PATCH 139/592] refactor(loadbalancers): change oas schema names --- .stats.yml | 2 +- api.md | 15 ++--- .../cloud/load_balancers/listeners.py | 10 ++-- .../cloud/load_balancers/pools/pools.py | 10 ++-- src/gcore/types/cloud/__init__.py | 3 + ...onse.py => load_balancer_listener_list.py} | 8 +-- ...list_response.py => load_balancer_pool.py} | 55 +++++++------------ .../types/cloud/load_balancer_pool_list.py | 16 ++++++ .../types/cloud/load_balancers/__init__.py | 2 - .../cloud/load_balancers/test_listeners.py | 21 +++---- .../cloud/load_balancers/test_pools.py | 23 ++++---- 11 files changed, 79 insertions(+), 86 deletions(-) rename src/gcore/types/cloud/{load_balancers/listener_list_response.py => load_balancer_listener_list.py} (54%) rename src/gcore/types/cloud/{load_balancers/pool_list_response.py => load_balancer_pool.py} (65%) create mode 100644 src/gcore/types/cloud/load_balancer_pool_list.py diff --git a/.stats.yml b/.stats.yml index 25425f2d..dd1116f0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-da371b656e696b11b7a26b9bf9d92a381a49dc68c365c0071f4ac07a9a5c09c1.yml openapi_spec_hash: b9fc73b647741b85d99cf6066154a945 -config_hash: 047d50bb070fced4bb9e05678a72b874 +config_hash: 50be69a3e4a4c0f9e3c243af951f7423 diff --git a/api.md b/api.md index dcecc6b0..b28bb22b 100644 --- a/api.md +++ b/api.md @@ -194,8 +194,11 @@ from gcore.types.cloud import ( LoadBalancerL7Rule, LoadBalancerL7RuleList, LoadBalancerListenerDetail, + LoadBalancerListenerList, LoadBalancerMetrics, LoadBalancerMetricsList, + LoadBalancerPool, + LoadBalancerPoolList, LoadBalancerStatus, LoadBalancerStatusList, Member, @@ -243,17 +246,11 @@ Methods: ### Listeners -Types: - -```python -from gcore.types.cloud.load_balancers import ListenerListResponse -``` - Methods: - client.cloud.load_balancers.listeners.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.listeners.update(listener_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.listeners.list(\*, project_id, region_id, \*\*params) -> ListenerListResponse +- client.cloud.load_balancers.listeners.list(\*, project_id, region_id, \*\*params) -> LoadBalancerListenerList - client.cloud.load_balancers.listeners.delete(listener_id, \*, project_id, region_id) -> TaskIDList - client.cloud.load_balancers.listeners.get(listener_id, \*, project_id, region_id, \*\*params) -> LoadBalancerListenerDetail @@ -262,14 +259,14 @@ Methods: Types: ```python -from gcore.types.cloud.load_balancers import PoolListResponse, PoolGetResponse +from gcore.types.cloud.load_balancers import PoolGetResponse ``` Methods: - client.cloud.load_balancers.pools.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.pools.update(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.pools.list(\*, project_id, region_id, \*\*params) -> PoolListResponse +- client.cloud.load_balancers.pools.list(\*, project_id, region_id, \*\*params) -> LoadBalancerPoolList - client.cloud.load_balancers.pools.delete(pool_id, \*, project_id, region_id) -> TaskIDList - client.cloud.load_balancers.pools.get(pool_id, \*, project_id, region_id) -> PoolGetResponse diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 6059351b..f6b82af1 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -26,8 +26,8 @@ listener_update_params, ) from ....types.cloud.lb_listener_protocol import LbListenerProtocol +from ....types.cloud.load_balancer_listener_list import LoadBalancerListenerList from ....types.cloud.load_balancer_listener_detail import LoadBalancerListenerDetail -from ....types.cloud.load_balancers.listener_list_response import ListenerListResponse __all__ = ["ListenersResource", "AsyncListenersResource"] @@ -253,7 +253,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ListenerListResponse: + ) -> LoadBalancerListenerList: """ List load balancer listeners @@ -293,7 +293,7 @@ def list( listener_list_params.ListenerListParams, ), ), - cast_to=ListenerListResponse, + cast_to=LoadBalancerListenerList, ) def delete( @@ -615,7 +615,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ListenerListResponse: + ) -> LoadBalancerListenerList: """ List load balancer listeners @@ -655,7 +655,7 @@ async def list( listener_list_params.ListenerListParams, ), ), - cast_to=ListenerListResponse, + cast_to=LoadBalancerListenerList, ) async def delete( diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 0416c5d9..480201ec 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -38,8 +38,8 @@ from .....types.cloud.task_id_list import TaskIDList from .....types.cloud.load_balancers import pool_list_params, pool_create_params, pool_update_params from .....types.cloud.lb_pool_protocol import LbPoolProtocol +from .....types.cloud.load_balancer_pool_list import LoadBalancerPoolList from .....types.cloud.load_balancers.pool_get_response import PoolGetResponse -from .....types.cloud.load_balancers.pool_list_response import PoolListResponse __all__ = ["PoolsResource", "AsyncPoolsResource"] @@ -288,7 +288,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PoolListResponse: + ) -> LoadBalancerPoolList: """ List load balancer pools @@ -331,7 +331,7 @@ def list( pool_list_params.PoolListParams, ), ), - cast_to=PoolListResponse, + cast_to=LoadBalancerPoolList, ) def delete( @@ -669,7 +669,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PoolListResponse: + ) -> LoadBalancerPoolList: """ List load balancer pools @@ -712,7 +712,7 @@ async def list( pool_list_params.PoolListParams, ), ), - cast_to=PoolListResponse, + cast_to=LoadBalancerPoolList, ) async def delete( diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 6f83cf93..8612d016 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -65,6 +65,7 @@ from .ingress_opts_param import IngressOptsParam as IngressOptsParam from .instance_interface import InstanceInterface as InstanceInterface from .instance_isolation import InstanceIsolation as InstanceIsolation +from .load_balancer_pool import LoadBalancerPool as LoadBalancerPool from .region_list_params import RegionListParams as RegionListParams from .secret_list_params import SecretListParams as SecretListParams from .volume_list_params import VolumeListParams as VolumeListParams @@ -120,6 +121,7 @@ from .registry_resize_params import RegistryResizeParams as RegistryResizeParams from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams from .load_balancer_l7_policy import LoadBalancerL7Policy as LoadBalancerL7Policy +from .load_balancer_pool_list import LoadBalancerPoolList as LoadBalancerPoolList from .container_probe_http_get import ContainerProbeHTTPGet as ContainerProbeHTTPGet from .container_scale_triggers import ContainerScaleTriggers as ContainerScaleTriggers from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList @@ -151,6 +153,7 @@ from .load_balancer_create_params import LoadBalancerCreateParams as LoadBalancerCreateParams from .load_balancer_flavor_detail import LoadBalancerFlavorDetail as LoadBalancerFlavorDetail from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole +from .load_balancer_listener_list import LoadBalancerListenerList as LoadBalancerListenerList from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams diff --git a/src/gcore/types/cloud/load_balancers/listener_list_response.py b/src/gcore/types/cloud/load_balancer_listener_list.py similarity index 54% rename from src/gcore/types/cloud/load_balancers/listener_list_response.py rename to src/gcore/types/cloud/load_balancer_listener_list.py index cda6ff03..eb426067 100644 --- a/src/gcore/types/cloud/load_balancers/listener_list_response.py +++ b/src/gcore/types/cloud/load_balancer_listener_list.py @@ -2,13 +2,13 @@ from typing import List -from ...._models import BaseModel -from ..load_balancer_listener_detail import LoadBalancerListenerDetail +from ..._models import BaseModel +from .load_balancer_listener_detail import LoadBalancerListenerDetail -__all__ = ["ListenerListResponse"] +__all__ = ["LoadBalancerListenerList"] -class ListenerListResponse(BaseModel): +class LoadBalancerListenerList(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/load_balancers/pool_list_response.py b/src/gcore/types/cloud/load_balancer_pool.py similarity index 65% rename from src/gcore/types/cloud/load_balancers/pool_list_response.py rename to src/gcore/types/cloud/load_balancer_pool.py index 9296bdaf..c0b35367 100644 --- a/src/gcore/types/cloud/load_balancers/pool_list_response.py +++ b/src/gcore/types/cloud/load_balancer_pool.py @@ -3,44 +3,37 @@ from typing import List, Union, Optional from typing_extensions import TypeAlias -from ..member import Member -from ...._models import BaseModel -from ..lb_algorithm import LbAlgorithm -from ..health_monitor import HealthMonitor -from ..lb_pool_protocol import LbPoolProtocol -from ..provisioning_status import ProvisioningStatus -from ..session_persistence import SessionPersistence -from ..load_balancer_operating_status import LoadBalancerOperatingStatus - -__all__ = [ - "PoolListResponse", - "Result", - "ResultListener", - "ResultLoadbalancer", - "ResultMember", - "ResultMemberLbPoolMemberSerializer", -] - - -class ResultListener(BaseModel): +from . import member +from ..._models import BaseModel +from .lb_algorithm import LbAlgorithm +from .health_monitor import HealthMonitor +from .lb_pool_protocol import LbPoolProtocol +from .provisioning_status import ProvisioningStatus +from .session_persistence import SessionPersistence +from .load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = ["LoadBalancerPool", "Listener", "Loadbalancer", "Member", "MemberLbPoolMemberSerializer"] + + +class Listener(BaseModel): id: str """Resource ID""" -class ResultLoadbalancer(BaseModel): +class Loadbalancer(BaseModel): id: str """Resource ID""" -class ResultMemberLbPoolMemberSerializer(BaseModel): +class MemberLbPoolMemberSerializer(BaseModel): id: str """Member ID must be provided if an existing member is being updated""" -ResultMember: TypeAlias = Union[ResultMemberLbPoolMemberSerializer, Member] +Member: TypeAlias = Union[MemberLbPoolMemberSerializer, member.Member] -class Result(BaseModel): +class LoadBalancerPool(BaseModel): id: str """Pool ID""" @@ -59,13 +52,13 @@ class Result(BaseModel): lb_algorithm: LbAlgorithm """Load balancer algorithm""" - listeners: List[ResultListener] + listeners: List[Listener] """Listeners IDs""" - loadbalancers: List[ResultLoadbalancer] + loadbalancers: List[Loadbalancer] """Load balancers IDs""" - members: List[ResultMember] + members: List[Member] """Pool members""" name: str @@ -101,11 +94,3 @@ class Result(BaseModel): timeout_member_data: Optional[int] = None """Backend member inactivity timeout in milliseconds""" - - -class PoolListResponse(BaseModel): - count: int - """Number of objects""" - - results: List[Result] - """Objects""" diff --git a/src/gcore/types/cloud/load_balancer_pool_list.py b/src/gcore/types/cloud/load_balancer_pool_list.py new file mode 100644 index 00000000..071e22e5 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_pool_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .load_balancer_pool import LoadBalancerPool + +__all__ = ["LoadBalancerPoolList"] + + +class LoadBalancerPoolList(BaseModel): + count: int + """Number of objects""" + + results: List[LoadBalancerPool] + """Objects""" diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index 5c43eb6a..c069d551 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -7,12 +7,10 @@ from .flavor_list_params import FlavorListParams as FlavorListParams from .metric_list_params import MetricListParams as MetricListParams from .pool_create_params import PoolCreateParams as PoolCreateParams -from .pool_list_response import PoolListResponse as PoolListResponse from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .listener_get_params import ListenerGetParams as ListenerGetParams from .listener_list_params import ListenerListParams as ListenerListParams from .listener_create_params import ListenerCreateParams as ListenerCreateParams -from .listener_list_response import ListenerListResponse as ListenerListResponse 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/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index cdd2a3ac..e1ccbeeb 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -9,10 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, LoadBalancerListenerDetail -from gcore.types.cloud.load_balancers import ( - ListenerListResponse, -) +from gcore.types.cloud import TaskIDList, LoadBalancerListenerList, LoadBalancerListenerDetail base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -167,7 +164,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(ListenerListResponse, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -177,7 +174,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: loadbalancer_id="00000000-0000-4000-8000-000000000000", show_stats=True, ) - assert_matches_type(ListenerListResponse, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -189,7 +186,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = response.parse() - assert_matches_type(ListenerListResponse, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -201,7 +198,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = response.parse() - assert_matches_type(ListenerListResponse, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) assert cast(Any, response.is_closed) is True @@ -458,7 +455,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(ListenerListResponse, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -468,7 +465,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No loadbalancer_id="00000000-0000-4000-8000-000000000000", show_stats=True, ) - assert_matches_type(ListenerListResponse, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -480,7 +477,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = await response.parse() - assert_matches_type(ListenerListResponse, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -492,7 +489,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" listener = await response.parse() - assert_matches_type(ListenerListResponse, listener, path=["response"]) + assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py index 79282edc..1b3bb695 100644 --- a/tests/api_resources/cloud/load_balancers/test_pools.py +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -9,11 +9,8 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList -from gcore.types.cloud.load_balancers import ( - PoolGetResponse, - PoolListResponse, -) +from gcore.types.cloud import TaskIDList, LoadBalancerPoolList +from gcore.types.cloud.load_balancers import PoolGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -219,7 +216,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -230,7 +227,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: listener_id="00000000-0000-4000-8000-000000000000", loadbalancer_id="00000000-0000-4000-8000-000000000000", ) - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -242,7 +239,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -254,7 +251,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -552,7 +549,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -563,7 +560,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No listener_id="00000000-0000-4000-8000-000000000000", loadbalancer_id="00000000-0000-4000-8000-000000000000", ) - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -575,7 +572,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -587,7 +584,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) assert cast(Any, response.is_closed) is True From 2ebd75b26b5c17a98220cd005152c286bad9577d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 15:26:35 +0000 Subject: [PATCH 140/592] refactor(loadbalancers): use correct schema for loadbalancer pool --- .stats.yml | 2 +- api.md | 8 +- .../cloud/load_balancers/pools/pools.py | 10 +- src/gcore/types/cloud/load_balancer_pool.py | 15 +-- .../types/cloud/load_balancer_pool_list.py | 103 +++++++++++++++++- .../types/cloud/load_balancers/__init__.py | 1 - .../cloud/load_balancers/pool_get_response.py | 87 --------------- .../cloud/load_balancers/test_pools.py | 15 ++- 8 files changed, 116 insertions(+), 125 deletions(-) delete mode 100644 src/gcore/types/cloud/load_balancers/pool_get_response.py diff --git a/.stats.yml b/.stats.yml index dd1116f0..d34429f2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-da371b656e696b11b7a26b9bf9d92a381a49dc68c365c0071f4ac07a9a5c09c1.yml openapi_spec_hash: b9fc73b647741b85d99cf6066154a945 -config_hash: 50be69a3e4a4c0f9e3c243af951f7423 +config_hash: 9e69470eccc626746245fe5d2acc685b diff --git a/api.md b/api.md index b28bb22b..ffe6bafc 100644 --- a/api.md +++ b/api.md @@ -256,19 +256,13 @@ Methods: ### Pools -Types: - -```python -from gcore.types.cloud.load_balancers import PoolGetResponse -``` - Methods: - client.cloud.load_balancers.pools.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.pools.update(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.pools.list(\*, project_id, region_id, \*\*params) -> LoadBalancerPoolList - client.cloud.load_balancers.pools.delete(pool_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.load_balancers.pools.get(pool_id, \*, project_id, region_id) -> PoolGetResponse +- client.cloud.load_balancers.pools.get(pool_id, \*, project_id, region_id) -> LoadBalancerPool #### HealthMonitors diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 480201ec..96e3e2fa 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -38,8 +38,8 @@ from .....types.cloud.task_id_list import TaskIDList from .....types.cloud.load_balancers import pool_list_params, pool_create_params, pool_update_params from .....types.cloud.lb_pool_protocol import LbPoolProtocol +from .....types.cloud.load_balancer_pool import LoadBalancerPool from .....types.cloud.load_balancer_pool_list import LoadBalancerPoolList -from .....types.cloud.load_balancers.pool_get_response import PoolGetResponse __all__ = ["PoolsResource", "AsyncPoolsResource"] @@ -391,7 +391,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PoolGetResponse: + ) -> LoadBalancerPool: """ Get load balancer pool @@ -421,7 +421,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PoolGetResponse, + cast_to=LoadBalancerPool, ) @@ -772,7 +772,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PoolGetResponse: + ) -> LoadBalancerPool: """ Get load balancer pool @@ -802,7 +802,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PoolGetResponse, + cast_to=LoadBalancerPool, ) diff --git a/src/gcore/types/cloud/load_balancer_pool.py b/src/gcore/types/cloud/load_balancer_pool.py index c0b35367..9b7267b2 100644 --- a/src/gcore/types/cloud/load_balancer_pool.py +++ b/src/gcore/types/cloud/load_balancer_pool.py @@ -1,9 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from typing_extensions import TypeAlias +from typing import List, Optional -from . import member +from .member import Member from ..._models import BaseModel from .lb_algorithm import LbAlgorithm from .health_monitor import HealthMonitor @@ -12,7 +11,7 @@ from .session_persistence import SessionPersistence from .load_balancer_operating_status import LoadBalancerOperatingStatus -__all__ = ["LoadBalancerPool", "Listener", "Loadbalancer", "Member", "MemberLbPoolMemberSerializer"] +__all__ = ["LoadBalancerPool", "Listener", "Loadbalancer"] class Listener(BaseModel): @@ -25,14 +24,6 @@ class Loadbalancer(BaseModel): """Resource ID""" -class MemberLbPoolMemberSerializer(BaseModel): - id: str - """Member ID must be provided if an existing member is being updated""" - - -Member: TypeAlias = Union[MemberLbPoolMemberSerializer, member.Member] - - class LoadBalancerPool(BaseModel): id: str """Pool ID""" diff --git a/src/gcore/types/cloud/load_balancer_pool_list.py b/src/gcore/types/cloud/load_balancer_pool_list.py index 071e22e5..d846c6ca 100644 --- a/src/gcore/types/cloud/load_balancer_pool_list.py +++ b/src/gcore/types/cloud/load_balancer_pool_list.py @@ -1,16 +1,111 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Union, Optional +from typing_extensions import TypeAlias +from .member import Member from ..._models import BaseModel -from .load_balancer_pool import LoadBalancerPool +from .lb_algorithm import LbAlgorithm +from .health_monitor import HealthMonitor +from .lb_pool_protocol import LbPoolProtocol +from .provisioning_status import ProvisioningStatus +from .session_persistence import SessionPersistence +from .load_balancer_operating_status import LoadBalancerOperatingStatus -__all__ = ["LoadBalancerPoolList"] +__all__ = [ + "LoadBalancerPoolList", + "Result", + "ResultListener", + "ResultLoadbalancer", + "ResultMember", + "ResultMemberLbPoolMemberSerializer", +] + + +class ResultListener(BaseModel): + id: str + """Resource ID""" + + +class ResultLoadbalancer(BaseModel): + id: str + """Resource ID""" + + +class ResultMemberLbPoolMemberSerializer(BaseModel): + id: str + """Member ID must be provided if an existing member is being updated""" + + +ResultMember: TypeAlias = Union[ResultMemberLbPoolMemberSerializer, Member] + + +class Result(BaseModel): + id: str + """Pool ID""" + + ca_secret_id: Optional[str] = None + """Secret ID of CA certificate bundle""" + + creator_task_id: Optional[str] = None + """Task that created this entity""" + + crl_secret_id: Optional[str] = None + """Secret ID of CA revocation list file""" + + healthmonitor: Optional[HealthMonitor] = None + """Health monitor parameters""" + + lb_algorithm: LbAlgorithm + """Load balancer algorithm""" + + listeners: List[ResultListener] + """Listeners IDs""" + + loadbalancers: List[ResultLoadbalancer] + """Load balancers IDs""" + + members: List[ResultMember] + """Pool members""" + + name: str + """Pool name""" + + operating_status: LoadBalancerOperatingStatus + """Pool operating status""" + + protocol: LbPoolProtocol + """Protocol""" + + provisioning_status: ProvisioningStatus + """Pool lifecycle status""" + + secret_id: Optional[str] = None + """Secret ID for TLS client authentication to the member servers""" + + session_persistence: Optional[SessionPersistence] = None + """Session persistence parameters""" + + task_id: Optional[str] = None + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. + """ + + timeout_client_data: Optional[int] = None + """Frontend client inactivity timeout in milliseconds""" + + timeout_member_connect: Optional[int] = None + """Backend member connection timeout in milliseconds""" + + timeout_member_data: Optional[int] = None + """Backend member inactivity timeout in milliseconds""" class LoadBalancerPoolList(BaseModel): count: int """Number of objects""" - results: List[LoadBalancerPool] + results: List[Result] """Objects""" diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index c069d551..433f966c 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -3,7 +3,6 @@ from __future__ import annotations from .pool_list_params import PoolListParams as PoolListParams -from .pool_get_response import PoolGetResponse as PoolGetResponse from .flavor_list_params import FlavorListParams as FlavorListParams from .metric_list_params import MetricListParams as MetricListParams from .pool_create_params import PoolCreateParams as PoolCreateParams diff --git a/src/gcore/types/cloud/load_balancers/pool_get_response.py b/src/gcore/types/cloud/load_balancers/pool_get_response.py deleted file mode 100644 index 2487ffb2..00000000 --- a/src/gcore/types/cloud/load_balancers/pool_get_response.py +++ /dev/null @@ -1,87 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..member import Member -from ...._models import BaseModel -from ..lb_algorithm import LbAlgorithm -from ..health_monitor import HealthMonitor -from ..lb_pool_protocol import LbPoolProtocol -from ..provisioning_status import ProvisioningStatus -from ..session_persistence import SessionPersistence -from ..load_balancer_operating_status import LoadBalancerOperatingStatus - -__all__ = ["PoolGetResponse", "Listener", "Loadbalancer"] - - -class Listener(BaseModel): - id: str - """Resource ID""" - - -class Loadbalancer(BaseModel): - id: str - """Resource ID""" - - -class PoolGetResponse(BaseModel): - id: str - """Pool ID""" - - ca_secret_id: Optional[str] = None - """Secret ID of CA certificate bundle""" - - creator_task_id: Optional[str] = None - """Task that created this entity""" - - crl_secret_id: Optional[str] = None - """Secret ID of CA revocation list file""" - - healthmonitor: Optional[HealthMonitor] = None - """Health monitor parameters""" - - lb_algorithm: LbAlgorithm - """Load balancer algorithm""" - - listeners: List[Listener] - """Listeners IDs""" - - loadbalancers: List[Loadbalancer] - """Load balancers IDs""" - - members: List[Member] - """Pool members""" - - name: str - """Pool name""" - - operating_status: LoadBalancerOperatingStatus - """Pool operating status""" - - protocol: LbPoolProtocol - """Protocol""" - - provisioning_status: ProvisioningStatus - """Pool lifecycle status""" - - secret_id: Optional[str] = None - """Secret ID for TLS client authentication to the member servers""" - - session_persistence: Optional[SessionPersistence] = None - """Session persistence parameters""" - - task_id: Optional[str] = None - """The UUID of the active task that currently holds a lock on the resource. - - This lock prevents concurrent modifications to ensure consistency. If `null`, - the resource is not locked. - """ - - timeout_client_data: Optional[int] = None - """Frontend client inactivity timeout in milliseconds""" - - timeout_member_connect: Optional[int] = None - """Backend member connection timeout in milliseconds""" - - timeout_member_data: Optional[int] = None - """Backend member inactivity timeout in milliseconds""" diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py index 1b3bb695..b53c75c2 100644 --- a/tests/api_resources/cloud/load_balancers/test_pools.py +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -9,8 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, LoadBalancerPoolList -from gcore.types.cloud.load_balancers import PoolGetResponse +from gcore.types.cloud import TaskIDList, LoadBalancerPool, LoadBalancerPoolList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -308,7 +307,7 @@ def test_method_get(self, client: Gcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(PoolGetResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPool, pool, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -321,7 +320,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(PoolGetResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPool, pool, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -334,7 +333,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(PoolGetResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPool, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -641,7 +640,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(PoolGetResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPool, pool, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -654,7 +653,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(PoolGetResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPool, pool, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -667,7 +666,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(PoolGetResponse, pool, path=["response"]) + assert_matches_type(LoadBalancerPool, pool, path=["response"]) assert cast(Any, response.is_closed) is True From dbbef3d324652d71d22ade1856cb667bf4c460a8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 10:44:53 +0000 Subject: [PATCH 141/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3d2ac0bd..10f30916 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0" + ".": "0.2.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index ebc4ef81..fe438871 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.1.0" +version = "0.2.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 cb502970..60d50ae3 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.1.0" # x-release-please-version +__version__ = "0.2.0" # x-release-please-version From 54b3f610c69af7d1818914e04a1db78521ce2166 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 16:10:23 +0000 Subject: [PATCH 142/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index d34429f2..ba18c95c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-da371b656e696b11b7a26b9bf9d92a381a49dc68c365c0071f4ac07a9a5c09c1.yml -openapi_spec_hash: b9fc73b647741b85d99cf6066154a945 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-403a7a2f1fb6c3e25e0bf07caea9a5782677d551f21cbb86072b02b146bb0f67.yml +openapi_spec_hash: 34a61db1354251fe5e8fcc2e07b62e93 config_hash: 9e69470eccc626746245fe5d2acc685b From a7cee76cbec8323eeb6dfbc1f4f3cc2aaae56a66 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 02:33:03 +0000 Subject: [PATCH 143/592] chore(docs): remove reference to rye shell --- CONTRIBUTING.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8d6c5e17..be330c39 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,8 +17,7 @@ $ rye sync --all-features You can then run scripts using `rye run python script.py` or by activating the virtual environment: ```sh -$ rye shell -# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work +# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work $ source .venv/bin/activate # now you can omit the `rye run` prefix From 9e0947bc53295f9a6082f34ebaeca0b130b3ca66 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 03:49:21 +0000 Subject: [PATCH 144/592] feat(client): add follow_redirects request option --- src/gcore/_base_client.py | 6 +++++ src/gcore/_models.py | 2 ++ src/gcore/_types.py | 2 ++ tests/test_client.py | 54 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index 3c3e98f7..8ec9e968 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -960,6 +960,9 @@ def request( if self.custom_auth is not None: kwargs["auth"] = self.custom_auth + if options.follow_redirects is not None: + kwargs["follow_redirects"] = options.follow_redirects + log.debug("Sending HTTP Request: %s %s", request.method, request.url) response = None @@ -1460,6 +1463,9 @@ async def request( if self.custom_auth is not None: kwargs["auth"] = self.custom_auth + if options.follow_redirects is not None: + kwargs["follow_redirects"] = options.follow_redirects + log.debug("Sending HTTP Request: %s %s", request.method, request.url) response = None diff --git a/src/gcore/_models.py b/src/gcore/_models.py index 798956f1..4f214980 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -737,6 +737,7 @@ class FinalRequestOptionsInput(TypedDict, total=False): idempotency_key: str json_data: Body extra_json: AnyMapping + follow_redirects: bool @final @@ -750,6 +751,7 @@ class FinalRequestOptions(pydantic.BaseModel): files: Union[HttpxRequestFiles, None] = None idempotency_key: Union[str, None] = None post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() + follow_redirects: Union[bool, None] = None # It should be noted that we cannot use `json` here as that would override # a BaseModel method in an incompatible fashion. diff --git a/src/gcore/_types.py b/src/gcore/_types.py index 7a34e342..aafdc14b 100644 --- a/src/gcore/_types.py +++ b/src/gcore/_types.py @@ -100,6 +100,7 @@ class RequestOptions(TypedDict, total=False): params: Query extra_json: AnyMapping idempotency_key: str + follow_redirects: bool # Sentinel class used until PEP 0661 is accepted @@ -215,3 +216,4 @@ class _GenericAlias(Protocol): class HttpxSendArgs(TypedDict, total=False): auth: httpx.Auth + follow_redirects: bool diff --git a/tests/test_client.py b/tests/test_client.py index 6d1fca48..4a348f1a 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -835,6 +835,33 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert response.http_request.headers.get("x-stainless-retry-count") == "42" + @pytest.mark.respx(base_url=base_url) + def test_follow_redirects(self, respx_mock: MockRouter) -> None: + # Test that the default follow_redirects=True allows following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) + + response = self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + assert response.status_code == 200 + assert response.json() == {"status": "ok"} + + @pytest.mark.respx(base_url=base_url) + def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + # Test that follow_redirects=False prevents following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + + with pytest.raises(APIStatusError) as exc_info: + self.client.post( + "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response + ) + + assert exc_info.value.response.status_code == 302 + assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" + class TestAsyncGcore: client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -1682,3 +1709,30 @@ async def test_main() -> None: raise AssertionError("calling get_platform using asyncify resulted in a hung process") time.sleep(0.1) + + @pytest.mark.respx(base_url=base_url) + async def test_follow_redirects(self, respx_mock: MockRouter) -> None: + # Test that the default follow_redirects=True allows following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) + + response = await self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + assert response.status_code == 200 + assert response.json() == {"status": "ok"} + + @pytest.mark.respx(base_url=base_url) + async def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + # Test that follow_redirects=False prevents following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + + with pytest.raises(APIStatusError) as exc_info: + await self.client.post( + "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response + ) + + assert exc_info.value.response.status_code == 302 + assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" From e971b92b58b28ef6c87a638c8ada2553c7423ab8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Jun 2025 04:20:16 +0000 Subject: [PATCH 145/592] chore(change-detection): filter newly generated files --- scripts/detect-breaking-changes | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index e64fdb16..fb28f3a2 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -5,5 +5,15 @@ set -e cd "$(dirname "$0")/.." echo "==> Detecting breaking changes" -git checkout "$1" -- tests/api_resources tests/test_client.py tests/test_response.py + +TEST_PATHS=( tests/api_resources tests/test_client.py tests/test_response.py ) + +for PATHSPEC in "${TEST_PATHS[@]}"; do + # Try to check out previous versions of the test files + # with the current SDK. + git checkout "$1" -- "${PATHSPEC}" 2>/dev/null || true +done + +# Instead of running the tests, use the linter to check if an +# older test is no longer compatible with the latest SDK. ./scripts/lint From 4cc9c15be39ad85acf107aa864ed28092612ab45 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 5 Jun 2025 12:14:03 +0000 Subject: [PATCH 146/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ba18c95c..ee41868c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-403a7a2f1fb6c3e25e0bf07caea9a5782677d551f21cbb86072b02b146bb0f67.yml -openapi_spec_hash: 34a61db1354251fe5e8fcc2e07b62e93 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7ae2bcdbd5497f950e7f3f5dbcf6f0941f62d4097952c32a66ec46cbff8c27c0.yml +openapi_spec_hash: e0d67acf10bf7026bb878ed3e6d0bba6 config_hash: 9e69470eccc626746245fe5d2acc685b From 0c5e24a90b7d3a6041371bad90c7d73731002a05 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 14:09:06 +0000 Subject: [PATCH 147/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/resources/cloud/instances/instances.py | 8 ++++---- src/gcore/types/cloud/region.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.stats.yml b/.stats.yml index ee41868c..2bb9a645 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7ae2bcdbd5497f950e7f3f5dbcf6f0941f62d4097952c32a66ec46cbff8c27c0.yml -openapi_spec_hash: e0d67acf10bf7026bb878ed3e6d0bba6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a7d56eafe5f805713cf5a5f969ac91f8cff9ab1557eaeed02f13d5ad4cdd4c2f.yml +openapi_spec_hash: f7033b53e3a24149fd8d3b6ed0232482 config_hash: 9e69470eccc626746245fe5d2acc685b diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 254306f6..79dc5aef 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -579,7 +579,7 @@ def action( ) -> TaskIDList: """ The action can be one of: start, stop, reboot, powercycle, suspend or resume. - Suspend and resume are not available for baremetal instances. + Suspend and resume are not available for bare metal instances. Args: action: Instance action name @@ -613,7 +613,7 @@ def action( ) -> TaskIDList: """ The action can be one of: start, stop, reboot, powercycle, suspend or resume. - Suspend and resume are not available for baremetal instances. + Suspend and resume are not available for bare metal instances. Args: action: Instance action name @@ -1589,7 +1589,7 @@ async def action( ) -> TaskIDList: """ The action can be one of: start, stop, reboot, powercycle, suspend or resume. - Suspend and resume are not available for baremetal instances. + Suspend and resume are not available for bare metal instances. Args: action: Instance action name @@ -1623,7 +1623,7 @@ async def action( ) -> TaskIDList: """ The action can be one of: start, stop, reboot, powercycle, suspend or resume. - Suspend and resume are not available for baremetal instances. + Suspend and resume are not available for bare metal instances. Args: action: Instance action name diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py index 343f0707..23e65285 100644 --- a/src/gcore/types/cloud/region.py +++ b/src/gcore/types/cloud/region.py @@ -67,6 +67,9 @@ class Region(BaseModel): has_basic_vm: bool """Region has basic vm capability""" + has_dbaas: bool + """Region has DBAAS service""" + has_k8s: bool """Region has managed kubernetes capability""" @@ -96,6 +99,3 @@ class Region(BaseModel): zone: Optional[Literal["AMERICAS", "APAC", "EMEA", "RUSSIA_AND_CIS"]] = None """Geographical zone""" - - has_dbaas: Optional[bool] = None - """Region has DBAAS service""" From 86f4f6b626ada670fb7b0156768edc4d3ffeac09 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Jun 2025 14:29:20 +0000 Subject: [PATCH 148/592] feat(api): manual upload of aggregated API specs --- .stats.yml | 4 +- api.md | 1 - .../resources/cloud/baremetal/flavors.py | 4 +- src/gcore/resources/cloud/baremetal/images.py | 4 +- .../resources/cloud/baremetal/servers.py | 98 +++++---- src/gcore/resources/cloud/floating_ips.py | 8 +- .../gpu_baremetal_clusters.py | 16 +- .../cloud/gpu_baremetal_clusters/images.py | 4 +- .../cloud/gpu_baremetal_clusters/servers.py | 8 +- .../inference/deployments/deployments.py | 56 +++--- .../resources/cloud/instances/flavors.py | 4 +- src/gcore/resources/cloud/instances/images.py | 4 +- .../resources/cloud/instances/instances.py | 128 ++++++------ .../resources/cloud/instances/interfaces.py | 8 +- .../resources/cloud/load_balancers/flavors.py | 4 +- .../load_balancers/l7_policies/l7_policies.py | 40 ++-- .../cloud/load_balancers/listeners.py | 28 +-- .../cloud/load_balancers/load_balancers.py | 52 ++--- .../cloud/load_balancers/pools/members.py | 12 +- .../resources/cloud/networks/networks.py | 8 +- src/gcore/resources/cloud/networks/subnets.py | 12 +- .../resources/cloud/registries/registries.py | 16 +- src/gcore/resources/cloud/registries/users.py | 14 +- .../reserved_fixed_ips/reserved_fixed_ips.py | 20 +- .../cloud/security_groups/security_groups.py | 4 +- src/gcore/resources/cloud/ssh_keys.py | 12 +- src/gcore/resources/cloud/tasks.py | 188 +++++++++--------- .../resources/cloud/users/role_assignments.py | 8 +- src/gcore/resources/cloud/volumes.py | 36 ++-- .../types/cloud/allowed_address_pairs.py | 4 +- .../types/cloud/baremetal/baremetal_server.py | 2 +- .../cloud/baremetal/image_list_params.py | 2 +- .../cloud/baremetal/server_create_params.py | 18 +- .../cloud/baremetal/server_list_params.py | 16 +- .../cloud/baremetal/server_rebuild_params.py | 2 +- src/gcore/types/cloud/baremetal_flavor.py | 6 +- .../types/cloud/container_probe_config.py | 2 +- .../container_probe_config_create_param.py | 2 +- .../types/cloud/container_scale_triggers.py | 4 +- src/gcore/types/cloud/floating_ip_detailed.py | 2 +- .../types/cloud/floating_ip_list_params.py | 4 +- .../types/cloud/gpu_baremetal_cluster.py | 2 +- .../gpu_baremetal_cluster_create_params.py | 4 +- .../gpu_baremetal_cluster_delete_params.py | 2 +- .../gpu_baremetal_cluster_rebuild_params.py | 2 +- .../cloud/gpu_baremetal_cluster_server.py | 2 +- .../image_upload_params.py | 2 +- .../server_attach_interface_params.py | 20 +- src/gcore/types/cloud/gpu_baremetal_flavor.py | 6 +- src/gcore/types/cloud/image.py | 2 +- .../inference/deployment_create_params.py | 10 +- .../inference/deployment_update_params.py | 14 +- src/gcore/types/cloud/inference/inference.py | 8 +- src/gcore/types/cloud/instance.py | 2 +- .../types/cloud/instance_create_params.py | 26 ++- src/gcore/types/cloud/instance_list_params.py | 16 +- .../instances/flavor_list_suitable_params.py | 5 +- .../cloud/instances/image_list_params.py | 2 +- .../types/cloud/instances/instance_flavor.py | 6 +- .../instances/interface_attach_params.py | 20 +- .../cloud/load_balancer_create_params.py | 32 +-- .../cloud/load_balancer_flavor_detail.py | 6 +- .../types/cloud/load_balancer_l7_policy.py | 10 +- .../types/cloud/load_balancer_list_params.py | 10 +- .../cloud/load_balancer_listener_detail.py | 8 +- .../load_balancers/l7_policy_create_params.py | 10 +- .../l7_policy_replace_params.py | 10 +- .../load_balancers/listener_create_params.py | 8 +- .../load_balancers/listener_update_params.py | 6 +- .../load_balancers/pool_create_params.py | 8 +- .../load_balancers/pool_update_params.py | 8 +- .../load_balancers/pools/member_add_params.py | 6 +- src/gcore/types/cloud/member.py | 4 +- src/gcore/types/cloud/network.py | 4 +- src/gcore/types/cloud/network_details.py | 4 +- src/gcore/types/cloud/network_list_params.py | 4 +- .../cloud/networks/subnet_create_params.py | 2 +- .../cloud/networks/subnet_list_params.py | 4 +- src/gcore/types/cloud/region.py | 2 +- .../registries/user_create_multiple_params.py | 8 +- .../cloud/registries/user_create_params.py | 8 +- .../types/cloud/registry_create_params.py | 8 +- .../cloud/reserved_fixed_ip_create_params.py | 4 +- .../cloud/reserved_fixed_ip_list_params.py | 6 +- .../types/cloud/security_group_list_params.py | 2 +- src/gcore/types/cloud/session_persistence.py | 2 +- .../types/cloud/ssh_key_create_params.py | 4 +- src/gcore/types/cloud/ssh_key_created.py | 14 +- src/gcore/types/cloud/task.py | 2 +- src/gcore/types/cloud/task_list_params.py | 94 ++++----- .../users/role_assignment_create_params.py | 2 +- .../users/role_assignment_update_params.py | 2 +- src/gcore/types/cloud/volume_create_params.py | 12 +- src/gcore/types/cloud/volume_list_params.py | 6 +- src/gcore/types/waap/__init__.py | 1 - .../waap/domains/setting_update_params.py | 7 + src/gcore/types/waap/waap_api_urls.py | 15 -- src/gcore/types/waap/waap_domain_settings.py | 22 +- .../waap/domains/test_settings.py | 10 +- 99 files changed, 694 insertions(+), 697 deletions(-) delete mode 100644 src/gcore/types/waap/waap_api_urls.py diff --git a/.stats.yml b/.stats.yml index 2bb9a645..dbb5cd6e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a7d56eafe5f805713cf5a5f969ac91f8cff9ab1557eaeed02f13d5ad4cdd4c2f.yml -openapi_spec_hash: f7033b53e3a24149fd8d3b6ed0232482 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-99e3a45411a9fb61f7f7390098f039250b0df0d7f9df0651b83d14ec630f94d0.yml +openapi_spec_hash: 8d7f86bf413439fbd7ce9426e6c3a56e config_hash: 9e69470eccc626746245fe5d2acc685b diff --git a/api.md b/api.md index ffe6bafc..a97b7d69 100644 --- a/api.md +++ b/api.md @@ -856,7 +856,6 @@ Types: ```python from gcore.types.waap import ( - WaapAPIURLs, WaapDetailedDomain, WaapDomainDDOSSettings, WaapDomainSettings, diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index f3daf325..83f7e0ea 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -61,7 +61,7 @@ def list( ) -> BaremetalFlavorList: """Retrieve a list of flavors. - When the include_prices query parameter is + When the `include_prices` query parameter is specified, the list shows prices. A client in trial mode gets all price values as 0. If you get Pricing Error contact the support @@ -212,7 +212,7 @@ async def list( ) -> BaremetalFlavorList: """Retrieve a list of flavors. - When the include_prices query parameter is + When the `include_prices` query parameter is specified, the list shows prices. A client in trial mode gets all price values as 0. If you get Pricing Error contact the support diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index 821ed848..d49c23a6 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -74,7 +74,7 @@ def list( tag_key: Filter by tag keys. tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. 'curl -G - --data-urlencode 'tag_key_value={"key": "value"}' --url + --data-urlencode '`tag_key_value`={"key": "value"}' --url 'http://localhost:1111/v1/images/1/1'" visibility: Image visibility. Globally visible images are public @@ -163,7 +163,7 @@ async def list( tag_key: Filter by tag keys. tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. 'curl -G - --data-urlencode 'tag_key_value={"key": "value"}' --url + --data-urlencode '`tag_key_value`={"key": "value"}' --url 'http://localhost:1111/v1/images/1/1'" visibility: Image visibility. Globally visible images are public diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index cf6b3f3f..52713d9e 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -77,18 +77,15 @@ def create( For Linux, - Use the `user_data` field to provide a - cloud-init - script in base64 to apply configurations to the instance. + [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) + in base64 to apply configurations to the instance. - Specify the `username` and `password` to create a new user. - When only `password` is provided, it is set as the password for the default user of the image. - - The `user_data` is ignored when the `password` is specified. - - For Windows, - + - The `user_data` is ignored when the `password` is specified. For Windows, - Use the `user_data` field to provide a - cloudbase-init - script in base64 to create new users on Windows. + [cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config) + in base64 to create new users on Windows. - Use the `password` field to set the password for the 'Admin' user on Windows. - The password of the Admin user cannot be updated via `user_data`. - The `username` cannot be specified in the request. @@ -117,18 +114,18 @@ def create( name_template: If you want server names to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during provisioning. - Supported placeholders are: `{ip_octets}` (last 3 octets of the IP), - `{two_ip_octets}`, and `{one_ip_octet}`. + Supported placeholders are: `{`ip_octets`}` (last 3 octets of the IP), + `{`two_ip_octets`}`, and `{`one_ip_octet`}`. password: For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the - 'user_data' field to provide a script to create new users on Windows. The - password of the Admin user cannot be updated via 'user_data'. + '`user_data`' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via '`user_data`'. ssh_key_name: Specifies the name of the SSH keypair, created via the - /v1/ssh_keys endpoint. + [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -136,10 +133,10 @@ def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - user_data: String in base64 format. For Linux instances, 'user_data' is ignored when + user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when 'password' field is provided. For Windows instances, Admin user password is set - by 'password' field and cannot be updated via 'user_data'. Examples of the - user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html + by 'password' field and cannot be updated via '`user_data`'. Examples of the + `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html username: For Linux instances, 'username' and 'password' are used to create a new user. For Windows instances, 'username' cannot be specified. Use 'password' field to @@ -233,9 +230,9 @@ def list( changes_since: Filters the instances by a date and time stamp when the instances last changed status. - flavor_id: Filter out instances by flavor_id. Flavor id must match exactly. + flavor_id: Filter out instances by `flavor_id`. Flavor id must match exactly. - flavor_prefix: Filter out instances by flavor_prefix. + flavor_prefix: Filter out instances by `flavor_prefix`. include_k8s: Include managed k8s worker nodes @@ -258,22 +255,22 @@ def list( order_by: Order by field and direction. - profile_name: Filter result by ddos protection profile name. Effective only with with_ddos set - to true. + profile_name: Filter result by ddos protection profile name. Effective only with `with_ddos` + set to true. - protection_status: Filter result by DDoS protection_status. Effective only with with_ddos set to - true. (Active, Queued or Error) + protection_status: Filter result by DDoS `protection_status`. Effective only with `with_ddos` set + to true. (Active, Queued or Error) status: Filters instances by a server status, as a string. tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "tag_key_value={"key": "value"}" --url + "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" - tag_value: Optional. Filter by tag values. ?tag_value=value1&tag_value=value2 + tag_value: Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2 type_ddos_profile: Return bare metals either only with advanced or only basic DDoS protection. - Effective only with with_ddos set to true. (advanced or basic) + Effective only with `with_ddos` set to true. (advanced or basic) uuid: Filter the server list result by the UUID of the server. Allowed UUID part @@ -355,7 +352,7 @@ def rebuild( image_id: Image ID user_data: String in base64 format. Must not be passed together with 'username' or - 'password'. Examples of the user_data: + 'password'. Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html extra_headers: Send extra headers @@ -437,18 +434,15 @@ async def create( For Linux, - Use the `user_data` field to provide a - cloud-init - script in base64 to apply configurations to the instance. + [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) + in base64 to apply configurations to the instance. - Specify the `username` and `password` to create a new user. - When only `password` is provided, it is set as the password for the default user of the image. - - The `user_data` is ignored when the `password` is specified. - - For Windows, - + - The `user_data` is ignored when the `password` is specified. For Windows, - Use the `user_data` field to provide a - cloudbase-init - script in base64 to create new users on Windows. + [cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config) + in base64 to create new users on Windows. - Use the `password` field to set the password for the 'Admin' user on Windows. - The password of the Admin user cannot be updated via `user_data`. - The `username` cannot be specified in the request. @@ -477,18 +471,18 @@ async def create( name_template: If you want server names to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during provisioning. - Supported placeholders are: `{ip_octets}` (last 3 octets of the IP), - `{two_ip_octets}`, and `{one_ip_octet}`. + Supported placeholders are: `{`ip_octets`}` (last 3 octets of the IP), + `{`two_ip_octets`}`, and `{`one_ip_octet`}`. password: For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the - 'user_data' field to provide a script to create new users on Windows. The - password of the Admin user cannot be updated via 'user_data'. + '`user_data`' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via '`user_data`'. ssh_key_name: Specifies the name of the SSH keypair, created via the - /v1/ssh_keys endpoint. + [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -496,10 +490,10 @@ async def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - user_data: String in base64 format. For Linux instances, 'user_data' is ignored when + user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when 'password' field is provided. For Windows instances, Admin user password is set - by 'password' field and cannot be updated via 'user_data'. Examples of the - user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html + by 'password' field and cannot be updated via '`user_data`'. Examples of the + `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html username: For Linux instances, 'username' and 'password' are used to create a new user. For Windows instances, 'username' cannot be specified. Use 'password' field to @@ -593,9 +587,9 @@ def list( changes_since: Filters the instances by a date and time stamp when the instances last changed status. - flavor_id: Filter out instances by flavor_id. Flavor id must match exactly. + flavor_id: Filter out instances by `flavor_id`. Flavor id must match exactly. - flavor_prefix: Filter out instances by flavor_prefix. + flavor_prefix: Filter out instances by `flavor_prefix`. include_k8s: Include managed k8s worker nodes @@ -618,22 +612,22 @@ def list( order_by: Order by field and direction. - profile_name: Filter result by ddos protection profile name. Effective only with with_ddos set - to true. + profile_name: Filter result by ddos protection profile name. Effective only with `with_ddos` + set to true. - protection_status: Filter result by DDoS protection_status. Effective only with with_ddos set to - true. (Active, Queued or Error) + protection_status: Filter result by DDoS `protection_status`. Effective only with `with_ddos` set + to true. (Active, Queued or Error) status: Filters instances by a server status, as a string. tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "tag_key_value={"key": "value"}" --url + "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" - tag_value: Optional. Filter by tag values. ?tag_value=value1&tag_value=value2 + tag_value: Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2 type_ddos_profile: Return bare metals either only with advanced or only basic DDoS protection. - Effective only with with_ddos set to true. (advanced or basic) + Effective only with `with_ddos` set to true. (advanced or basic) uuid: Filter the server list result by the UUID of the server. Allowed UUID part @@ -715,7 +709,7 @@ async def rebuild( image_id: Image ID user_data: String in base64 format. Must not be passed together with 'username' or - 'password'. Examples of the user_data: + 'password'. Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 2d70d273..ff122671 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -139,10 +139,10 @@ def list( offset: Optional. Offset value is used to exclude the first set of records from the result - tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "tag_key_value={"key": "value"}" --url + "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers @@ -460,10 +460,10 @@ def list( offset: Optional. Offset value is used to exclude the first set of records from the result - tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "tag_key_value={"key": "value"}" --url + "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 82877a56..9184db09 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -143,7 +143,7 @@ def create( instance ssh_key_name: Specifies the name of the SSH keypair, created via the - /v1/ssh_keys endpoint. + [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -152,7 +152,7 @@ def create( data to be filtered based on tag keys or values. user_data: String in base64 format. Must not be passed together with 'username' or - 'password'. Examples of the user_data: + 'password'. Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html username: A name of a new user in the Linux instance. It may be passed with a 'password' @@ -270,7 +270,7 @@ def delete( used with floatings. floatings: Comma separated list of floating ids that should be deleted. Can't be used with - delete_floatings. + `delete_floatings`. reserved_fixed_ips: Comma separated list of port IDs to be deleted with the servers @@ -449,7 +449,7 @@ def rebuild( image_id: AI GPU image ID user_data: - String in base64 format.Examples of the user_data: + String in base64 format.Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html extra_headers: Send extra headers @@ -607,7 +607,7 @@ async def create( instance ssh_key_name: Specifies the name of the SSH keypair, created via the - /v1/ssh_keys endpoint. + [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -616,7 +616,7 @@ async def create( data to be filtered based on tag keys or values. user_data: String in base64 format. Must not be passed together with 'username' or - 'password'. Examples of the user_data: + 'password'. Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html username: A name of a new user in the Linux instance. It may be passed with a 'password' @@ -734,7 +734,7 @@ async def delete( used with floatings. floatings: Comma separated list of floating ids that should be deleted. Can't be used with - delete_floatings. + `delete_floatings`. reserved_fixed_ips: Comma separated list of port IDs to be deleted with the servers @@ -913,7 +913,7 @@ async def rebuild( image_id: AI GPU image ID user_data: - String in base64 format.Examples of the user_data: + String in base64 format.Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 4be9a937..ef276010 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -211,7 +211,7 @@ def upload( url: Image URL - architecture: Image architecture type: aarch64, x86_64 + architecture: Image architecture type: aarch64, `x86_64` cow_format: When True, image cannot be deleted unless all volumes, created from it, are deleted. @@ -452,7 +452,7 @@ async def upload( url: Image URL - architecture: Image architecture type: aarch64, x86_64 + architecture: Image architecture type: aarch64, `x86_64` cow_format: When True, image cannot be deleted unless all volumes, created from it, are deleted. diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 7ca59e37..3127e2ec 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -233,7 +233,7 @@ def attach_interface( security_groups: List of security group IDs - type: Must be 'any_subnet' + type: Must be '`any_subnet`' extra_headers: Send extra headers @@ -281,7 +281,7 @@ def attach_interface( security_groups: List of security group IDs - type: Must be 'reserved_fixed_ip'. Union tag + type: Must be '`reserved_fixed_ip`'. Union tag extra_headers: Send extra headers @@ -720,7 +720,7 @@ async def attach_interface( security_groups: List of security group IDs - type: Must be 'any_subnet' + type: Must be '`any_subnet`' extra_headers: Send extra headers @@ -768,7 +768,7 @@ async def attach_interface( security_groups: List of security group IDs - type: Must be 'reserved_fixed_ip'. Union tag + type: Must be '`reserved_fixed_ip`'. Union tag extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index ba41e262..792b0fd2 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -104,8 +104,8 @@ def create( name: Inference instance name. auth_enabled: Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required - for the requests to the instance if enabled + `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is + required for the requests to the instance if enabled command: Command to be executed when running a container from an image. @@ -120,7 +120,7 @@ def create( logging: Logging configuration for the inference instance probes: 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 + not provided, and the `image_name` is from a the Model Catalog registry, the default probes will be used. api_timeout: Specifies the duration in seconds without any requests after which the @@ -200,8 +200,8 @@ def update( deployment_name: Inference instance name. auth_enabled: Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required - for the requests to the instance if enabled + `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is + required for the requests to the instance if enabled command: Command to be executed when running a container from an image. @@ -461,10 +461,10 @@ def start( """ This operation initializes an inference deployment after it was stopped, making it available to handle inference requests again. The instance will launch with - the **minimum** number of replicas defined in the scaling settings. + the \\**\\**minimum\\**\\** number of replicas defined in the scaling settings. - - If the minimum replicas are set to **0**, the instance will initially start - with **0** replicas. + - If the minimum replicas are set to \\**\\**0\\**\\**, the instance will initially + start with \\**\\**0\\**\\** replicas. - It will automatically scale up when it receives requests or SQS messages, according to the configured scaling rules. @@ -508,13 +508,13 @@ def stop( ) -> None: """ This operation shuts down an inference deployment, making it unavailable for - handling requests. The deployment will scale down to **0** replicas, overriding - any minimum replica settings. + handling requests. The deployment will scale down to \\**\\**0\\**\\** replicas, + overriding any minimum replica settings. - - Once stopped, the deployment will **not** process any inference requests or - SQS messages. - - It will **not** restart automatically and must be started manually. - - While stopped, the deployment will **not** incur any charges. + - Once stopped, the deployment will \\**\\**not\\**\\** process any inference requests + or SQS messages. + - It will \\**\\**not\\**\\** restart automatically and must be started manually. + - While stopped, the deployment will \\**\\**not\\**\\** incur any charges. Args: project_id: Project ID @@ -612,8 +612,8 @@ async def create( name: Inference instance name. auth_enabled: Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required - for the requests to the instance if enabled + `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is + required for the requests to the instance if enabled command: Command to be executed when running a container from an image. @@ -628,7 +628,7 @@ async def create( logging: Logging configuration for the inference instance probes: 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 + not provided, and the `image_name` is from a the Model Catalog registry, the default probes will be used. api_timeout: Specifies the duration in seconds without any requests after which the @@ -708,8 +708,8 @@ async def update( deployment_name: Inference instance name. auth_enabled: Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required - for the requests to the instance if enabled + `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is + required for the requests to the instance if enabled command: Command to be executed when running a container from an image. @@ -969,10 +969,10 @@ async def start( """ This operation initializes an inference deployment after it was stopped, making it available to handle inference requests again. The instance will launch with - the **minimum** number of replicas defined in the scaling settings. + the \\**\\**minimum\\**\\** number of replicas defined in the scaling settings. - - If the minimum replicas are set to **0**, the instance will initially start - with **0** replicas. + - If the minimum replicas are set to \\**\\**0\\**\\**, the instance will initially + start with \\**\\**0\\**\\** replicas. - It will automatically scale up when it receives requests or SQS messages, according to the configured scaling rules. @@ -1016,13 +1016,13 @@ async def stop( ) -> None: """ This operation shuts down an inference deployment, making it unavailable for - handling requests. The deployment will scale down to **0** replicas, overriding - any minimum replica settings. + handling requests. The deployment will scale down to \\**\\**0\\**\\** replicas, + overriding any minimum replica settings. - - Once stopped, the deployment will **not** process any inference requests or - SQS messages. - - It will **not** restart automatically and must be started manually. - - While stopped, the deployment will **not** incur any charges. + - Once stopped, the deployment will \\**\\**not\\**\\** process any inference requests + or SQS messages. + - It will \\**\\**not\\**\\** restart automatically and must be started manually. + - While stopped, the deployment will \\**\\**not\\**\\** incur any charges. Args: project_id: Project ID diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 071f754b..4dd3898e 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -61,7 +61,7 @@ def list( ) -> InstanceFlavorList: """Retrieve a list of flavors. - When the include_prices query parameter is + When the `include_prices` query parameter is specified, the list shows prices. A client in trial mode gets all price values as 0. If you get Pricing Error contact the support @@ -243,7 +243,7 @@ async def list( ) -> InstanceFlavorList: """Retrieve a list of flavors. - When the include_prices query parameter is + When the `include_prices` query parameter is specified, the list shows prices. A client in trial mode gets all price values as 0. If you get Pricing Error contact the support diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index d4f358cb..605fdb8f 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -159,7 +159,7 @@ def list( tag_key: Filter by tag keys. tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. 'curl -G - --data-urlencode 'tag_key_value={"key": "value"}' --url + --data-urlencode '`tag_key_value`={"key": "value"}' --url 'http://localhost:1111/v1/images/1/1'" visibility: Image visibility. Globally visible images are public @@ -588,7 +588,7 @@ async def list( tag_key: Filter by tag keys. tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. 'curl -G - --data-urlencode 'tag_key_value={"key": "value"}' --url + --data-urlencode '`tag_key_value`={"key": "value"}' --url 'http://localhost:1111/v1/images/1/1'" visibility: Image visibility. Globally visible images are public diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 79dc5aef..e813a831 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -139,18 +139,15 @@ def create( For Linux, - Use the `user_data` field to provide a - cloud-init - script in base64 to apply configurations to the instance. + [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) + in base64 to apply configurations to the instance. - Specify the `username` and `password` to create a new user. - When only `password` is provided, it is set as the password for the default user of the image. - - The `user_data` is ignored when the `password` is specified. - - For Windows, - + - The `user_data` is ignored when the `password` is specified. For Windows, - Use the `user_data` field to provide a - cloudbase-init - script in base64 to create new users on Windows. + [cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config) + in base64 to create new users on Windows. - Use the `password` field to set the password for the 'Admin' user on Windows. - The password of the Admin user cannot be updated via `user_data`. - The `username` cannot be specified in the request. @@ -179,21 +176,20 @@ def create( name_template: If you want the instance name to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during - provisioning. Supported placeholders are: `{ip_octets}` (last 3 octets of the - IP), `{two_ip_octets}`, and `{one_ip_octet}`. + provisioning. Supported placeholders are: `{`ip_octets`}` (last 3 octets of the + IP), `{`two_ip_octets`}`, and `{`one_ip_octet`}`. password: For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the - 'user_data' field to provide a script to create new users on Windows. The - password of the Admin user cannot be updated via 'user_data'. + '`user_data`' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via '`user_data`'. security_groups: Specifies security group UUIDs to be applied to all instance network interfaces. - servergroup_id: Placement group ID for instance placement policy. - - Supported group types: + servergroup_id: + Placement group ID for instance placement policy. Supported group types: - `anti-affinity`: Ensures instances are placed on different hosts for high availability. @@ -202,7 +198,7 @@ def create( sharing if needed. ssh_key_name: Specifies the name of the SSH keypair, created via the - /v1/ssh_keys endpoint. + [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -210,10 +206,10 @@ def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - user_data: String in base64 format. For Linux instances, 'user_data' is ignored when + user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when 'password' field is provided. For Windows instances, Admin user password is set - by 'password' field and cannot be updated via 'user_data'. Examples of the - user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html + by 'password' field and cannot be updated via '`user_data`'. Examples of the + `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html username: For Linux instances, 'username' and 'password' are used to create a new user. For Windows instances, 'username' cannot be specified. Use 'password' field to @@ -382,9 +378,9 @@ def list( exclude_secgroup: Exclude instances with specified security group name - flavor_id: Filter out instances by flavor_id. Flavor id must match exactly. + flavor_id: Filter out instances by `flavor_id`. Flavor id must match exactly. - flavor_prefix: Filter out instances by flavor_prefix. + flavor_prefix: Filter out instances by `flavor_prefix`. include_ai: Include GPU clusters' servers @@ -411,22 +407,22 @@ def list( order_by: Order by field and direction. - profile_name: Filter result by ddos protection profile name. Effective only with with_ddos set - to true. + profile_name: Filter result by ddos protection profile name. Effective only with `with_ddos` + set to true. - protection_status: Filter result by DDoS protection_status. if parameter is provided. Effective - only with with_ddos set to true. (Active, Queued or Error) + protection_status: Filter result by DDoS `protection_status`. if parameter is provided. Effective + only with `with_ddos` set to true. (Active, Queued or Error) status: Filters instances by status. tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "tag_key_value={"key": "value"}" --url + "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" - tag_value: Optional. Filter by tag values. ?tag_value=value1&tag_value=value2 + tag_value: Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2 type_ddos_profile: Return bare metals either only with advanced or only basic DDoS protection. - Effective only with with_ddos set to true. (advanced or basic) + Effective only with `with_ddos` set to true. (advanced or basic) uuid: Filter the server list result by the UUID of the server. Allowed UUID part @@ -730,7 +726,7 @@ def assign_security_group( """Assign the security group to the server. To assign multiple security groups to - all ports, use the NULL value for the port_id field + all ports, use the NULL value for the `port_id` field Args: name: Security group name, applies to all ports @@ -859,13 +855,13 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Instance: """ - **Cookie Parameters**: + \\**\\**Cookie Parameters\\**\\**: - `language` (str, optional): Language for the response content. Affects the `ddos_profile` field. Supported values: - - `'en'` (default) - - `'de'` - - `'ru'` + - `'en'` (default) + - `'de'` + - `'ru'` Args: project_id: Project ID @@ -1045,7 +1041,7 @@ def unassign_security_group( """Un-assign the security group to the server. To un-assign multiple security - groups to all ports, use the NULL value for the port_id field + groups to all ports, use the NULL value for the `port_id` field Args: name: Security group name, applies to all ports @@ -1149,18 +1145,15 @@ async def create( For Linux, - Use the `user_data` field to provide a - cloud-init - script in base64 to apply configurations to the instance. + [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) + in base64 to apply configurations to the instance. - Specify the `username` and `password` to create a new user. - When only `password` is provided, it is set as the password for the default user of the image. - - The `user_data` is ignored when the `password` is specified. - - For Windows, - + - The `user_data` is ignored when the `password` is specified. For Windows, - Use the `user_data` field to provide a - cloudbase-init - script in base64 to create new users on Windows. + [cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config) + in base64 to create new users on Windows. - Use the `password` field to set the password for the 'Admin' user on Windows. - The password of the Admin user cannot be updated via `user_data`. - The `username` cannot be specified in the request. @@ -1189,21 +1182,20 @@ async def create( name_template: If you want the instance name to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during - provisioning. Supported placeholders are: `{ip_octets}` (last 3 octets of the - IP), `{two_ip_octets}`, and `{one_ip_octet}`. + provisioning. Supported placeholders are: `{`ip_octets`}` (last 3 octets of the + IP), `{`two_ip_octets`}`, and `{`one_ip_octet`}`. password: For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the - 'user_data' field to provide a script to create new users on Windows. The - password of the Admin user cannot be updated via 'user_data'. + '`user_data`' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via '`user_data`'. security_groups: Specifies security group UUIDs to be applied to all instance network interfaces. - servergroup_id: Placement group ID for instance placement policy. - - Supported group types: + servergroup_id: + Placement group ID for instance placement policy. Supported group types: - `anti-affinity`: Ensures instances are placed on different hosts for high availability. @@ -1212,7 +1204,7 @@ async def create( sharing if needed. ssh_key_name: Specifies the name of the SSH keypair, created via the - /v1/ssh_keys endpoint. + [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -1220,10 +1212,10 @@ async def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - user_data: String in base64 format. For Linux instances, 'user_data' is ignored when + user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when 'password' field is provided. For Windows instances, Admin user password is set - by 'password' field and cannot be updated via 'user_data'. Examples of the - user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html + by 'password' field and cannot be updated via '`user_data`'. Examples of the + `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html username: For Linux instances, 'username' and 'password' are used to create a new user. For Windows instances, 'username' cannot be specified. Use 'password' field to @@ -1392,9 +1384,9 @@ def list( exclude_secgroup: Exclude instances with specified security group name - flavor_id: Filter out instances by flavor_id. Flavor id must match exactly. + flavor_id: Filter out instances by `flavor_id`. Flavor id must match exactly. - flavor_prefix: Filter out instances by flavor_prefix. + flavor_prefix: Filter out instances by `flavor_prefix`. include_ai: Include GPU clusters' servers @@ -1421,22 +1413,22 @@ def list( order_by: Order by field and direction. - profile_name: Filter result by ddos protection profile name. Effective only with with_ddos set - to true. + profile_name: Filter result by ddos protection profile name. Effective only with `with_ddos` + set to true. - protection_status: Filter result by DDoS protection_status. if parameter is provided. Effective - only with with_ddos set to true. (Active, Queued or Error) + protection_status: Filter result by DDoS `protection_status`. if parameter is provided. Effective + only with `with_ddos` set to true. (Active, Queued or Error) status: Filters instances by status. tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "tag_key_value={"key": "value"}" --url + "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" - tag_value: Optional. Filter by tag values. ?tag_value=value1&tag_value=value2 + tag_value: Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2 type_ddos_profile: Return bare metals either only with advanced or only basic DDoS protection. - Effective only with with_ddos set to true. (advanced or basic) + Effective only with `with_ddos` set to true. (advanced or basic) uuid: Filter the server list result by the UUID of the server. Allowed UUID part @@ -1740,7 +1732,7 @@ async def assign_security_group( """Assign the security group to the server. To assign multiple security groups to - all ports, use the NULL value for the port_id field + all ports, use the NULL value for the `port_id` field Args: name: Security group name, applies to all ports @@ -1869,13 +1861,13 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Instance: """ - **Cookie Parameters**: + \\**\\**Cookie Parameters\\**\\**: - `language` (str, optional): Language for the response content. Affects the `ddos_profile` field. Supported values: - - `'en'` (default) - - `'de'` - - `'ru'` + - `'en'` (default) + - `'de'` + - `'ru'` Args: project_id: Project ID @@ -2055,7 +2047,7 @@ async def unassign_security_group( """Un-assign the security group to the server. To un-assign multiple security - groups to all ports, use the NULL value for the port_id field + groups to all ports, use the NULL value for the `port_id` field Args: name: Security group name, applies to all ports diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 1df34c30..733ded71 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -217,7 +217,7 @@ def attach( security_groups: List of security group IDs - type: Must be 'any_subnet' + type: Must be '`any_subnet`' extra_headers: Send extra headers @@ -264,7 +264,7 @@ def attach( security_groups: List of security group IDs - type: Must be 'reserved_fixed_ip'. Union tag + type: Must be '`reserved_fixed_ip`'. Union tag extra_headers: Send extra headers @@ -573,7 +573,7 @@ async def attach( security_groups: List of security group IDs - type: Must be 'any_subnet' + type: Must be '`any_subnet`' extra_headers: Send extra headers @@ -620,7 +620,7 @@ async def attach( security_groups: List of security group IDs - type: Must be 'reserved_fixed_ip'. Union tag + type: Must be '`reserved_fixed_ip`'. Union tag extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index c011bd00..48ba2c61 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -56,7 +56,7 @@ def list( ) -> LoadBalancerFlavorList: """Retrieve a list of load balancer flavors. - When the include_prices query + When the `include_prices` query parameter is specified, the list shows prices. A client in trial mode gets all price values as 0. If you get Pricing Error contact the support @@ -123,7 +123,7 @@ async def list( ) -> LoadBalancerFlavorList: """Retrieve a list of load balancer flavors. - When the include_prices query + When the `include_prices` query parameter is specified, the list shows prices. A client in trial mode gets all price values as 0. If you get Pricing Error contact the support 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 7fea3985..602694d4 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 @@ -92,17 +92,17 @@ def create( position: The position of this policy on the listener. Positions start at 1. 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. + 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. redirect_pool_id: Requests matching this policy will be redirected to the pool withthis ID. Only - valid if action is REDIRECT_TO_POOL. + valid if action is `REDIRECT_TO_POOL`. redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid - if action is REDIRECT_PREFIX. + if action is `REDIRECT_PREFIX`. redirect_url: Requests matching this policy will be redirected to this URL. Only valid if - action is REDIRECT_TO_URL. + action is `REDIRECT_TO_URL`. tags: A list of simple strings assigned to the resource. @@ -286,17 +286,17 @@ def replace( position: The position of this policy on the listener. Positions start at 1. 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. + 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. redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID. Only - valid if action is REDIRECT_TO_POOL. + valid if action is `REDIRECT_TO_POOL`. redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid - if action is REDIRECT_PREFIX. + if action is `REDIRECT_PREFIX`. redirect_url: Requests matching this policy will be redirected to this URL. Only valid if - action is REDIRECT_TO_URL. + action is `REDIRECT_TO_URL`. tags: A list of simple strings assigned to the resource. @@ -394,17 +394,17 @@ async def create( position: The position of this policy on the listener. Positions start at 1. 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. + 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. redirect_pool_id: Requests matching this policy will be redirected to the pool withthis ID. Only - valid if action is REDIRECT_TO_POOL. + valid if action is `REDIRECT_TO_POOL`. redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid - if action is REDIRECT_PREFIX. + if action is `REDIRECT_PREFIX`. redirect_url: Requests matching this policy will be redirected to this URL. Only valid if - action is REDIRECT_TO_URL. + action is `REDIRECT_TO_URL`. tags: A list of simple strings assigned to the resource. @@ -588,17 +588,17 @@ async def replace( position: The position of this policy on the listener. Positions start at 1. 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. + 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. redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID. Only - valid if action is REDIRECT_TO_POOL. + valid if action is `REDIRECT_TO_POOL`. redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid - if action is REDIRECT_PREFIX. + if action is `REDIRECT_PREFIX`. redirect_url: Requests matching this policy will be redirected to this URL. Only valid if - action is REDIRECT_TO_URL. + action is `REDIRECT_TO_URL`. tags: A list of simple strings assigned to the resource. diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index f6b82af1..3198371d 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -98,13 +98,13 @@ def create( connection_limit: Limit of the simultaneous connections insert_x_forwarded: Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. - Only used with HTTP or TERMINATED_HTTPS protocols. + Only used with HTTP or `TERMINATED_HTTPS` protocols. - secret_id: ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS - listener + secret_id: ID of the secret where PKCS12 file is stored for `TERMINATED_HTTPS` or + PROMETHEUS listener sni_secret_id: List of secrets IDs containing PKCS12 format certificate/key bundles for - TERMINATED_HTTPS or PROMETHEUS listeners + `TERMINATED_HTTPS` or PROMETHEUS listeners timeout_client_data: Frontend client inactivity timeout in milliseconds @@ -190,11 +190,11 @@ def update( name: Load balancer listener name - secret_id: ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS - load balancer + secret_id: ID of the secret where PKCS12 file is stored for `TERMINATED_HTTPS` or + PROMETHEUS load balancer sni_secret_id: List of secret's ID containing PKCS12 format certificate/key bundfles for - TERMINATED_HTTPS or PROMETHEUS listeners + `TERMINATED_HTTPS` or PROMETHEUS listeners timeout_client_data: Frontend client inactivity timeout in milliseconds @@ -460,13 +460,13 @@ async def create( connection_limit: Limit of the simultaneous connections insert_x_forwarded: Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. - Only used with HTTP or TERMINATED_HTTPS protocols. + Only used with HTTP or `TERMINATED_HTTPS` protocols. - secret_id: ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS - listener + secret_id: ID of the secret where PKCS12 file is stored for `TERMINATED_HTTPS` or + PROMETHEUS listener sni_secret_id: List of secrets IDs containing PKCS12 format certificate/key bundles for - TERMINATED_HTTPS or PROMETHEUS listeners + `TERMINATED_HTTPS` or PROMETHEUS listeners timeout_client_data: Frontend client inactivity timeout in milliseconds @@ -552,11 +552,11 @@ async def update( name: Load balancer listener name - secret_id: ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS - load balancer + secret_id: ID of the secret where PKCS12 file is stored for `TERMINATED_HTTPS` or + PROMETHEUS load balancer sni_secret_id: List of secret's ID containing PKCS12 format certificate/key bundfles for - TERMINATED_HTTPS or PROMETHEUS listeners + `TERMINATED_HTTPS` or PROMETHEUS listeners timeout_client_data: Frontend client inactivity timeout in milliseconds diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index e87abc6b..c1debc30 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -172,8 +172,9 @@ def create( preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools members. L2 provides best performance, L3 provides less IPs usage. It is taking - effect only if instance_id + ip_address is provided, not subnet_id + ip_address, - because we're considering this as intentional subnet_id specification. + effect only if `instance_id` + `ip_address` is provided, not `subnet_id` + + `ip_address`, because we're considering this as intentional `subnet_id` + specification. tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -181,16 +182,17 @@ def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - vip_ip_family: IP family for load balancer subnet auto-selection if vip_network_id is specified + vip_ip_family: IP family for load balancer subnet auto-selection if `vip_network_id` is + specified vip_network_id: Network ID for load balancer. If not specified, default external network will be - used. Mutually exclusive with vip_port_id + used. Mutually exclusive with `vip_port_id` vip_port_id: Existing Reserved Fixed IP port ID for load balancer. Mutually exclusive with - vip_network_id + `vip_network_id` - vip_subnet_id: Subnet ID for load balancer. If not specified, any subnet from vip_network_id - will be selected. Ignored when vip_network_id is not specified. + vip_subnet_id: Subnet ID for load balancer. If not specified, any subnet from `vip_network_id` + will be selected. Ignored when `vip_network_id` is not specified. extra_headers: Send extra headers @@ -323,17 +325,17 @@ def list( offset: Offset value is used to exclude the first set of records from the result. - order_by: Ordering Load Balancer list result by name, created_at, updated_at, - operating_status, provisioning_status, vip_address, vip_ip_family and flavor - fields of the load balancer and directions (name.asc), default is - "created_at.asc" + order_by: Ordering Load Balancer list result by name, `created_at`, `updated_at`, + `operating_status`, `provisioning_status`, `vip_address`, `vip_ip_family` and + flavor fields of the load balancer and directions (name.asc), default is + "`created_at`.asc" show_stats: Show statistics tag_key: Filter by tag keys. tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G - --data-urlencode "tag_key_value={"key": "value"}" --url + --data-urlencode "`tag_key_value`={"key": "value"}" --url "http://localhost:1111/v1/loadbalancers/1/1" with_ddos: Show Advanced DDoS protection profile, if exists @@ -645,8 +647,9 @@ async def create( preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools members. L2 provides best performance, L3 provides less IPs usage. It is taking - effect only if instance_id + ip_address is provided, not subnet_id + ip_address, - because we're considering this as intentional subnet_id specification. + effect only if `instance_id` + `ip_address` is provided, not `subnet_id` + + `ip_address`, because we're considering this as intentional `subnet_id` + specification. tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -654,16 +657,17 @@ async def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - vip_ip_family: IP family for load balancer subnet auto-selection if vip_network_id is specified + vip_ip_family: IP family for load balancer subnet auto-selection if `vip_network_id` is + specified vip_network_id: Network ID for load balancer. If not specified, default external network will be - used. Mutually exclusive with vip_port_id + used. Mutually exclusive with `vip_port_id` vip_port_id: Existing Reserved Fixed IP port ID for load balancer. Mutually exclusive with - vip_network_id + `vip_network_id` - vip_subnet_id: Subnet ID for load balancer. If not specified, any subnet from vip_network_id - will be selected. Ignored when vip_network_id is not specified. + vip_subnet_id: Subnet ID for load balancer. If not specified, any subnet from `vip_network_id` + will be selected. Ignored when `vip_network_id` is not specified. extra_headers: Send extra headers @@ -796,17 +800,17 @@ def list( offset: Offset value is used to exclude the first set of records from the result. - order_by: Ordering Load Balancer list result by name, created_at, updated_at, - operating_status, provisioning_status, vip_address, vip_ip_family and flavor - fields of the load balancer and directions (name.asc), default is - "created_at.asc" + order_by: Ordering Load Balancer list result by name, `created_at`, `updated_at`, + `operating_status`, `provisioning_status`, `vip_address`, `vip_ip_family` and + flavor fields of the load balancer and directions (name.asc), default is + "`created_at`.asc" show_stats: Show statistics tag_key: Filter by tag keys. tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G - --data-urlencode "tag_key_value={"key": "value"}" --url + --data-urlencode "`tag_key_value`={"key": "value"}" --url "http://localhost:1111/v1/loadbalancers/1/1" with_ddos: Show Advanced DDoS protection profile, if exists diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 63885efa..5e05941f 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -80,15 +80,15 @@ def add( admin_state_up: true if enabled. Defaults to true - instance_id: Either subnet_id or instance_id should be provided + instance_id: Either `subnet_id` or `instance_id` should be provided monitor_address: An alternate IP address used for health monitoring of a backend member. Default is null which monitors the member address. monitor_port: An alternate protocol port used for health monitoring of a backend member. - Default is null which monitors the member protocol_port. + Default is null which monitors the member `protocol_port`. - subnet_id: Either subnet_id or instance_id should be provided + subnet_id: Either `subnet_id` or `instance_id` should be provided weight: Member weight. Valid values: 0 to 256, defaults to 1 @@ -235,15 +235,15 @@ async def add( admin_state_up: true if enabled. Defaults to true - instance_id: Either subnet_id or instance_id should be provided + instance_id: Either `subnet_id` or `instance_id` should be provided monitor_address: An alternate IP address used for health monitoring of a backend member. Default is null which monitors the member address. monitor_port: An alternate protocol port used for health monitoring of a backend member. - Default is null which monitors the member protocol_port. + Default is null which monitors the member `protocol_port`. - subnet_id: Either subnet_id or instance_id should be provided + subnet_id: Either `subnet_id` or `instance_id` should be provided weight: Member weight. Valid values: 0 to 256, defaults to 1 diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 2d64b29a..d980ebfa 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -218,10 +218,10 @@ def list( order_by: Ordering networks list result by `name`, `created_at` fields of the network and directions (`created_at.desc`). - tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "tag_key_value={"key": "value"}" --url + "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers @@ -524,10 +524,10 @@ def list( order_by: Ordering networks list result by `name`, `created_at` fields of the network and directions (`created_at.desc`). - tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "tag_key_value={"key": "value"}" --url + "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index f6768c53..b65a97e0 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -87,7 +87,7 @@ def create( network_id: Network ID connect_to_network_router: True if the network's router should get a gateway in this subnet. Must be - explicitly 'false' when gateway_ip is null. + explicitly 'false' when `gateway_ip` is null. dns_nameservers: List IP addresses of DNS servers to advertise via DHCP. @@ -272,10 +272,10 @@ def list( `available_ips`, `total_ips`, and `cidr` (default) fields of the subnet and directions (`name.asc`). - tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "tag_key_value={"key": "value"}" --url + "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers @@ -463,7 +463,7 @@ async def create( network_id: Network ID connect_to_network_router: True if the network's router should get a gateway in this subnet. Must be - explicitly 'false' when gateway_ip is null. + explicitly 'false' when `gateway_ip` is null. dns_nameservers: List IP addresses of DNS servers to advertise via DHCP. @@ -648,10 +648,10 @@ def list( `available_ips`, `total_ips`, and `cidr` (default) fields of the subnet and directions (`name.asc`). - tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "tag_key_value={"key": "value"}" --url + "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index b84235a8..2d9580ce 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -104,15 +104,13 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Registry: - """ - Create a registry + """Create a registry Args: name: A name for the container registry. - Should be in lowercase, consisting only of numbers, letters and -, - - with maximum length of 24 characters + Should be in lowercase, consisting only of + numbers, letters and -, with maximum length of 24 characters storage_limit: Registry storage limit, GiB @@ -346,15 +344,13 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Registry: - """ - Create a registry + """Create a registry Args: name: A name for the container registry. - Should be in lowercase, consisting only of numbers, letters and -, - - with maximum length of 24 characters + Should be in lowercase, consisting only of + numbers, letters and -, with maximum length of 24 characters storage_limit: Registry storage limit, GiB diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index ddc36aca..c9e1b821 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -68,11 +68,8 @@ def create( Args: duration: User account operating time, days - name: A name for the registry user. - - Should be in lowercase, consisting only of numbers and letters, - - with maximum length of 16 characters + name: A name for the registry user. Should be in lowercase, consisting only of numbers + and letters, with maximum length of 16 characters read_only: Read-only user @@ -358,11 +355,8 @@ async def create( Args: duration: User account operating time, days - name: A name for the registry user. - - Should be in lowercase, consisting only of numbers and letters, - - with maximum length of 16 characters + name: A name for the registry user. Should be in lowercase, consisting only of numbers + and letters, with maximum length of 16 characters read_only: Read-only user diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index bb2e32d1..6afd2869 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -154,7 +154,7 @@ def create( Args: network_id: Reserved fixed IP will be allocated in a subnet of this network - type: Must be 'any_subnet'. + type: Must be '`any_subnet`'. ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. @@ -195,7 +195,7 @@ def create( network_id: Reserved fixed IP will be allocated in a subnet of this network - type: Must be 'ip_address'. + type: Must be '`ip_address`'. is_vip: If reserved fixed IP is a VIP @@ -333,9 +333,9 @@ def list( offset: Offset value is used to exclude the first set of records from the result - order_by: Ordering reserved fixed IP list result by name, status, updated_at, created_at - or fixed_ip_address fields of the reserved fixed IP and directions (status.asc), - default is "fixed_ip_address.asc" + order_by: Ordering reserved fixed IP list result by name, status, `updated_at`, + `created_at` or `fixed_ip_address` fields of the reserved fixed IP and + directions (status.asc), default is "`fixed_ip_address`.asc" vip_only: Set to true if the response should only list VIPs @@ -575,7 +575,7 @@ async def create( Args: network_id: Reserved fixed IP will be allocated in a subnet of this network - type: Must be 'any_subnet'. + type: Must be '`any_subnet`'. ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. @@ -616,7 +616,7 @@ async def create( network_id: Reserved fixed IP will be allocated in a subnet of this network - type: Must be 'ip_address'. + type: Must be '`ip_address`'. is_vip: If reserved fixed IP is a VIP @@ -754,9 +754,9 @@ def list( offset: Offset value is used to exclude the first set of records from the result - order_by: Ordering reserved fixed IP list result by name, status, updated_at, created_at - or fixed_ip_address fields of the reserved fixed IP and directions (status.asc), - default is "fixed_ip_address.asc" + order_by: Ordering reserved fixed IP list result by name, status, `updated_at`, + `created_at` or `fixed_ip_address` fields of the reserved fixed IP and + directions (status.asc), default is "`fixed_ip_address`.asc" vip_only: Set to true if the response should only list VIPs diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index a519821a..51a470d1 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -189,7 +189,7 @@ def list( tag_key: Filter by tag keys. tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G - --data-urlencode "tag_key_value={"key": "value"}" --url + --data-urlencode "`tag_key_value`={"key": "value"}" --url "http://localhost:1111/v1/securitygroups/1/1" extra_headers: Send extra headers @@ -540,7 +540,7 @@ def list( tag_key: Filter by tag keys. tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G - --data-urlencode "tag_key_value={"key": "value"}" --url + --data-urlencode "`tag_key_value`={"key": "value"}" --url "http://localhost:1111/v1/securitygroups/1/1" extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index e43bf03b..ed944d22 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -60,7 +60,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SSHKeyCreated: """ - To generate a key, omit the public_key parameter from the request body + To generate a key, omit the `public_key` parameter from the request body Args: project_id: Project ID @@ -74,8 +74,8 @@ def create( - If you’re uploading your own key, provide the public part here (usually found in a file like `id_ed25519.pub`). - If you want the platform to generate an Ed25519 key pair for you, leave this - field empty — the system will return the private key in the response **once - only**. + field empty — the system will return the private key in the response \\**\\**once + only\\**\\**. shared_in_project: SSH key is shared with all users in the project @@ -322,7 +322,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SSHKeyCreated: """ - To generate a key, omit the public_key parameter from the request body + To generate a key, omit the `public_key` parameter from the request body Args: project_id: Project ID @@ -336,8 +336,8 @@ async def create( - If you’re uploading your own key, provide the public part here (usually found in a file like `id_ed25519.pub`). - If you want the platform to generate an Ed25519 key pair for you, leave this - field empty — the system will return the private key in the response **once - only**. + field empty — the system will return the private key in the response \\**\\**once + only\\**\\**. shared_in_project: SSH key is shared with all users in the project diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 380212d4..ebbb391b 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -73,7 +73,7 @@ def list( from_timestamp: ISO formatted datetime string. Filter the tasks by creation date greater than or - equal to from_timestamp + equal to `from_timestamp` is_acknowledged: Filter the tasks by their acknowledgement status @@ -90,57 +90,61 @@ def list( region_id: The region ID to filter the tasks by region. Supports multiple values of kind key=value1&key=value2 - sorting: (DEPRECATED Use 'order_by' instead) Sorting by creation date. Oldest first, or + sorting: (DEPRECATED Use '`order_by`' instead) Sorting by creation date. Oldest first, or most recent first state: Filter the tasks by state. Supports multiple values of kind key=value1&key=value2 - task_type: Filter the tasks by their type one of ['activate_ddos_profile', - 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', - 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', - 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', - 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', - 'create_fip', 'create_gpu_virtual_cluster', 'create_image', - 'create_inference_instance', 'create_inference_instance_key', - 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', - 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', - 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', - 'create_reserved_fixed_ip', 'create_router', 'create_secret', - 'create_servergroup', 'create_sfs', 'create_snapshot', 'create_subnet', - 'create_vm', 'create_volume', 'deactivate_ddos_profile', - 'delete_ai_cluster_gpu', 'delete_caas_container', - 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', - 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', - 'delete_gpu_virtual_server', 'delete_image', 'delete_inference_instance', - 'delete_k8s_cluster_pool_v2', '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', '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', 'replace_lbmetadata', 'resize_k8s_cluster_v2', - 'resize_loadbalancer', 'resize_vm', 'resume_vm', 'revert_volume', - 'soft_reboot_gpu_baremetal_server', 'soft_reboot_gpu_virtual_cluster', - 'soft_reboot_gpu_virtual_server', 'soft_reboot_vm', - 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', - 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', - 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', - 'sync_private_flavors', 'update_ddos_profile', 'update_inference_instance', - 'update_inference_instance_key', 'update_k8s_cluster_v2', 'update_lbmetadata', - 'update_port_allowed_address_pairs', 'update_tags_gpu_virtual_cluster', - 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu', - 'upscale_gpu_virtual_cluster'] + task_type: Filter the tasks by their type one of ['`activate_ddos_profile`', + '`attach_bm_to_reserved_fixed_ip`', '`attach_vm_interface`', + '`attach_vm_to_reserved_fixed_ip`', '`attach_volume`', + '`create_ai_cluster_gpu`', '`create_bm`', '`create_caas_container`', + '`create_dbaas_postgres_cluster`', '`create_ddos_profile`', + '`create_faas_function`', '`create_faas_namespace`', '`create_fip`', + '`create_gpu_virtual_cluster`', '`create_image`', '`create_inference_instance`', + '`create_inference_instance_key`', '`create_k8s_cluster_pool_v2`', + '`create_k8s_cluster_v2`', '`create_l7policy`', '`create_l7rule`', + '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', + '`create_lbpool_health_monitor`', '`create_loadbalancer`', '`create_network`', + '`create_reserved_fixed_ip`', '`create_router`', '`create_secret`', + '`create_servergroup`', '`create_sfs`', '`create_snapshot`', '`create_subnet`', + '`create_vm`', '`create_volume`', '`deactivate_ddos_profile`', + '`delete_ai_cluster_gpu`', '`delete_caas_container`', + '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', + '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', + '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', '`delete_image`', + '`delete_inference_instance`', '`delete_k8s_cluster_pool_v2`', + '`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`', + '`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`', + '`replace_lbmetadata`', '`resize_k8s_cluster_v2`', '`resize_loadbalancer`', + '`resize_vm`', '`resume_vm`', '`revert_volume`', + '`soft_reboot_gpu_baremetal_server`', '`soft_reboot_gpu_virtual_cluster`', + '`soft_reboot_gpu_virtual_server`', '`soft_reboot_vm`', + '`start_gpu_baremetal_server`', '`start_gpu_virtual_cluster`', + '`start_gpu_virtual_server`', '`start_vm`', '`stop_gpu_baremetal_server`', + '`stop_gpu_virtual_cluster`', '`stop_gpu_virtual_server`', '`stop_vm`', + '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', + '`update_inference_instance`', '`update_inference_instance_key`', + '`update_k8s_cluster_v2`', '`update_lbmetadata`', + '`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`', + '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', + '`upscale_gpu_virtual_cluster`'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or - equal to to_timestamp + equal to `to_timestamp` extra_headers: Send extra headers @@ -343,7 +347,7 @@ def list( from_timestamp: ISO formatted datetime string. Filter the tasks by creation date greater than or - equal to from_timestamp + equal to `from_timestamp` is_acknowledged: Filter the tasks by their acknowledgement status @@ -360,57 +364,61 @@ def list( region_id: The region ID to filter the tasks by region. Supports multiple values of kind key=value1&key=value2 - sorting: (DEPRECATED Use 'order_by' instead) Sorting by creation date. Oldest first, or + sorting: (DEPRECATED Use '`order_by`' instead) Sorting by creation date. Oldest first, or most recent first state: Filter the tasks by state. Supports multiple values of kind key=value1&key=value2 - task_type: Filter the tasks by their type one of ['activate_ddos_profile', - 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', - 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', - 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', - 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', - 'create_fip', 'create_gpu_virtual_cluster', 'create_image', - 'create_inference_instance', 'create_inference_instance_key', - 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', - 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', - 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', - 'create_reserved_fixed_ip', 'create_router', 'create_secret', - 'create_servergroup', 'create_sfs', 'create_snapshot', 'create_subnet', - 'create_vm', 'create_volume', 'deactivate_ddos_profile', - 'delete_ai_cluster_gpu', 'delete_caas_container', - 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', - 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', - 'delete_gpu_virtual_server', 'delete_image', 'delete_inference_instance', - 'delete_k8s_cluster_pool_v2', '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', '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', 'replace_lbmetadata', 'resize_k8s_cluster_v2', - 'resize_loadbalancer', 'resize_vm', 'resume_vm', 'revert_volume', - 'soft_reboot_gpu_baremetal_server', 'soft_reboot_gpu_virtual_cluster', - 'soft_reboot_gpu_virtual_server', 'soft_reboot_vm', - 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', - 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', - 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', - 'sync_private_flavors', 'update_ddos_profile', 'update_inference_instance', - 'update_inference_instance_key', 'update_k8s_cluster_v2', 'update_lbmetadata', - 'update_port_allowed_address_pairs', 'update_tags_gpu_virtual_cluster', - 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu', - 'upscale_gpu_virtual_cluster'] + task_type: Filter the tasks by their type one of ['`activate_ddos_profile`', + '`attach_bm_to_reserved_fixed_ip`', '`attach_vm_interface`', + '`attach_vm_to_reserved_fixed_ip`', '`attach_volume`', + '`create_ai_cluster_gpu`', '`create_bm`', '`create_caas_container`', + '`create_dbaas_postgres_cluster`', '`create_ddos_profile`', + '`create_faas_function`', '`create_faas_namespace`', '`create_fip`', + '`create_gpu_virtual_cluster`', '`create_image`', '`create_inference_instance`', + '`create_inference_instance_key`', '`create_k8s_cluster_pool_v2`', + '`create_k8s_cluster_v2`', '`create_l7policy`', '`create_l7rule`', + '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', + '`create_lbpool_health_monitor`', '`create_loadbalancer`', '`create_network`', + '`create_reserved_fixed_ip`', '`create_router`', '`create_secret`', + '`create_servergroup`', '`create_sfs`', '`create_snapshot`', '`create_subnet`', + '`create_vm`', '`create_volume`', '`deactivate_ddos_profile`', + '`delete_ai_cluster_gpu`', '`delete_caas_container`', + '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', + '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', + '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', '`delete_image`', + '`delete_inference_instance`', '`delete_k8s_cluster_pool_v2`', + '`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`', + '`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`', + '`replace_lbmetadata`', '`resize_k8s_cluster_v2`', '`resize_loadbalancer`', + '`resize_vm`', '`resume_vm`', '`revert_volume`', + '`soft_reboot_gpu_baremetal_server`', '`soft_reboot_gpu_virtual_cluster`', + '`soft_reboot_gpu_virtual_server`', '`soft_reboot_vm`', + '`start_gpu_baremetal_server`', '`start_gpu_virtual_cluster`', + '`start_gpu_virtual_server`', '`start_vm`', '`stop_gpu_baremetal_server`', + '`stop_gpu_virtual_cluster`', '`stop_gpu_virtual_server`', '`stop_vm`', + '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', + '`update_inference_instance`', '`update_inference_instance_key`', + '`update_k8s_cluster_v2`', '`update_lbmetadata`', + '`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`', + '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', + '`upscale_gpu_virtual_cluster`'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or - equal to to_timestamp + equal to `to_timestamp` extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index dff0b585..4bb855df 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -71,7 +71,7 @@ def create( user_id: User ID - client_id: Client ID. Required if project_id is specified + client_id: Client ID. Required if `project_id` is specified project_id: Project ID @@ -125,7 +125,7 @@ def update( user_id: User ID - client_id: Client ID. Required if project_id is specified + client_id: Client ID. Required if `project_id` is specified project_id: Project ID @@ -287,7 +287,7 @@ async def create( user_id: User ID - client_id: Client ID. Required if project_id is specified + client_id: Client ID. Required if `project_id` is specified project_id: Project ID @@ -341,7 +341,7 @@ async def update( user_id: User ID - client_id: Client ID. Required if project_id is specified + client_id: Client ID. Required if `project_id` is specified project_id: Project ID diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 5ccab79c..dc35bbba 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -96,9 +96,9 @@ def create( source: Volume source type attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in - conjunction with instance_id_to_attach_to + conjunction with `instance_id_to_attach_to` - instance_id_to_attach_to: instance_id to attach newly-created volume to + instance_id_to_attach_to: `instance_id` to attach newly-created volume to lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the volume @@ -160,9 +160,9 @@ def create( source: Volume source type attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in - conjunction with instance_id_to_attach_to + conjunction with `instance_id_to_attach_to` - instance_id_to_attach_to: instance_id to attach newly-created volume to + instance_id_to_attach_to: `instance_id` to attach newly-created volume to lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the volume @@ -226,9 +226,9 @@ def create( source: Volume source type attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in - conjunction with instance_id_to_attach_to + conjunction with `instance_id_to_attach_to` - instance_id_to_attach_to: instance_id to attach newly-created volume to + instance_id_to_attach_to: `instance_id` to attach newly-created volume to lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the volume @@ -396,16 +396,16 @@ def list( limit: Optional. Limit the number of returned items - name_part: Filter volumes by name_part inclusion in volume name.Any substring can be used + name_part: Filter volumes by `name_part` inclusion in volume name.Any substring can be used and volumes will be returned with names containing the substring. offset: Optional. Offset value is used to exclude the first set of records from the result - tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "tag_key_value={"key": "value"}" --url + "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers @@ -860,9 +860,9 @@ async def create( source: Volume source type attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in - conjunction with instance_id_to_attach_to + conjunction with `instance_id_to_attach_to` - instance_id_to_attach_to: instance_id to attach newly-created volume to + instance_id_to_attach_to: `instance_id` to attach newly-created volume to lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the volume @@ -924,9 +924,9 @@ async def create( source: Volume source type attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in - conjunction with instance_id_to_attach_to + conjunction with `instance_id_to_attach_to` - instance_id_to_attach_to: instance_id to attach newly-created volume to + instance_id_to_attach_to: `instance_id` to attach newly-created volume to lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the volume @@ -990,9 +990,9 @@ async def create( source: Volume source type attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in - conjunction with instance_id_to_attach_to + conjunction with `instance_id_to_attach_to` - instance_id_to_attach_to: instance_id to attach newly-created volume to + instance_id_to_attach_to: `instance_id` to attach newly-created volume to lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the volume @@ -1160,16 +1160,16 @@ def list( limit: Optional. Limit the number of returned items - name_part: Filter volumes by name_part inclusion in volume name.Any substring can be used + name_part: Filter volumes by `name_part` inclusion in volume name.Any substring can be used and volumes will be returned with names containing the substring. offset: Optional. Offset value is used to exclude the first set of records from the result - tag_key: Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2 + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "tag_key_value={"key": "value"}" --url + "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" extra_headers: Send extra headers diff --git a/src/gcore/types/cloud/allowed_address_pairs.py b/src/gcore/types/cloud/allowed_address_pairs.py index 9a028363..8f3ffcab 100644 --- a/src/gcore/types/cloud/allowed_address_pairs.py +++ b/src/gcore/types/cloud/allowed_address_pairs.py @@ -9,7 +9,7 @@ class AllowedAddressPairs(BaseModel): ip_address: str - """Subnet mask or IP address of the port specified in allowed_address_pairs""" + """Subnet mask or IP address of the port specified in `allowed_address_pairs`""" mac_address: Optional[str] = None - """MAC address of the port specified in allowed_address_pairs""" + """MAC address of the port specified in `allowed_address_pairs`""" diff --git a/src/gcore/types/cloud/baremetal/baremetal_server.py b/src/gcore/types/cloud/baremetal/baremetal_server.py index 657e8887..1d491ca7 100644 --- a/src/gcore/types/cloud/baremetal/baremetal_server.py +++ b/src/gcore/types/cloud/baremetal/baremetal_server.py @@ -76,7 +76,7 @@ class BaremetalServer(BaseModel): """Bare metal server ID""" addresses: Dict[str, List[Address]] - """Map of network_name to list of addresses in that network""" + """Map of `network_name` to list of addresses in that network""" blackhole_ports: List[BlackholePort] """IP addresses of the instances that are blackholed by DDoS mitigation system""" diff --git a/src/gcore/types/cloud/baremetal/image_list_params.py b/src/gcore/types/cloud/baremetal/image_list_params.py index 09f8b505..07949b72 100644 --- a/src/gcore/types/cloud/baremetal/image_list_params.py +++ b/src/gcore/types/cloud/baremetal/image_list_params.py @@ -25,7 +25,7 @@ class ImageListParams(TypedDict, total=False): tag_key_value: str """Filter by tag key-value pairs. - Must be a valid JSON string. 'curl -G --data-urlencode 'tag_key_value={"key": + Must be a valid JSON string. 'curl -G --data-urlencode '`tag_key_value`={"key": "value"}' --url 'http://localhost:1111/v1/images/1/1'" """ diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index 47b7053b..7bfb002d 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -68,8 +68,8 @@ class ServerCreateParams(TypedDict, total=False): If you want server names to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during provisioning. - Supported placeholders are: `{ip_octets}` (last 3 octets of the IP), - `{two_ip_octets}`, and `{one_ip_octet}`. + Supported placeholders are: `{`ip_octets`}` (last 3 octets of the IP), + `{`two_ip_octets`}`, and `{`one_ip_octet`}`. """ password: str @@ -78,14 +78,14 @@ class ServerCreateParams(TypedDict, total=False): When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the - 'user_data' field to provide a script to create new users on Windows. The - password of the Admin user cannot be updated via 'user_data'. + '`user_data`' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via '`user_data`'. """ ssh_key_name: Optional[str] """ Specifies the name of the SSH keypair, created via the - /v1/ssh_keys endpoint. + [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). """ tags: TagUpdateMapParam @@ -101,9 +101,9 @@ class ServerCreateParams(TypedDict, total=False): user_data: str """String in base64 format. - For Linux instances, 'user_data' is ignored when 'password' field is provided. + For Linux instances, '`user_data`' is ignored when 'password' field is provided. For Windows instances, Admin user password is set by 'password' field and cannot - be updated via 'user_data'. Examples of the user_data: + be updated via '`user_data`'. Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ @@ -353,10 +353,10 @@ class DDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: Union[Iterable[object], int, str, None] - """Complex value. Only one of 'value' or 'field_value' must be specified.""" + """Complex value. Only one of 'value' or '`field_value`' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or 'field_value' must be specified.""" + """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" class DDOSProfile(TypedDict, total=False): diff --git a/src/gcore/types/cloud/baremetal/server_list_params.py b/src/gcore/types/cloud/baremetal/server_list_params.py index 122e6731..e7a0b35b 100644 --- a/src/gcore/types/cloud/baremetal/server_list_params.py +++ b/src/gcore/types/cloud/baremetal/server_list_params.py @@ -28,10 +28,10 @@ class ServerListParams(TypedDict, total=False): """ flavor_id: str - """Filter out instances by flavor_id. Flavor id must match exactly.""" + """Filter out instances by `flavor_id`. Flavor id must match exactly.""" flavor_prefix: str - """Filter out instances by flavor_prefix.""" + """Filter out instances by `flavor_prefix`.""" include_k8s: bool """Include managed k8s worker nodes""" @@ -72,13 +72,13 @@ class ServerListParams(TypedDict, total=False): profile_name: str """Filter result by ddos protection profile name. - Effective only with with_ddos set to true. + Effective only with `with_ddos` set to true. """ protection_status: Literal["Active", "Queued", "Error"] - """Filter result by DDoS protection_status. + """Filter result by DDoS `protection_status`. - Effective only with with_ddos set to true. (Active, Queued or Error) + Effective only with `with_ddos` set to true. (Active, Queued or Error) """ status: Literal["ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED"] @@ -87,17 +87,17 @@ class ServerListParams(TypedDict, total=False): tag_key_value: str """Optional. - Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": + Filter by tag key-value pairs. curl -G --data-urlencode "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" """ tag_value: List[str] - """Optional. Filter by tag values. ?tag_value=value1&tag_value=value2""" + """Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2""" type_ddos_profile: Literal["basic", "advanced"] """Return bare metals either only with advanced or only basic DDoS protection. - Effective only with with_ddos set to true. (advanced or basic) + Effective only with `with_ddos` set to true. (advanced or basic) """ uuid: str diff --git a/src/gcore/types/cloud/baremetal/server_rebuild_params.py b/src/gcore/types/cloud/baremetal/server_rebuild_params.py index 9bc57135..5a6e2be6 100644 --- a/src/gcore/types/cloud/baremetal/server_rebuild_params.py +++ b/src/gcore/types/cloud/baremetal/server_rebuild_params.py @@ -19,5 +19,5 @@ class ServerRebuildParams(TypedDict, total=False): """String in base64 format. Must not be passed together with 'username' or 'password'. Examples of the - user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html + `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ diff --git a/src/gcore/types/cloud/baremetal_flavor.py b/src/gcore/types/cloud/baremetal_flavor.py index e28f667d..b5967afb 100644 --- a/src/gcore/types/cloud/baremetal_flavor.py +++ b/src/gcore/types/cloud/baremetal_flavor.py @@ -37,16 +37,16 @@ class BaremetalFlavor(BaseModel): """Number of available instances of given configuration""" currency_code: Optional[str] = None - """Currency code. Shown if the include_prices query parameter if set to true""" + """Currency code. Shown if the `include_prices` query parameter if set to true""" hardware_description: Optional[Dict[str, str]] = None """Additional hardware description""" price_per_hour: Optional[float] = None - """Price per hour. Shown if the include_prices query parameter if set to true""" + """Price per hour. Shown if the `include_prices` query parameter if set to true""" price_per_month: Optional[float] = None - """Price per month. Shown if the include_prices query parameter if set to true""" + """Price per month. Shown if the `include_prices` query parameter if set to true""" price_status: Optional[Literal["error", "hide", "show"]] = None """Price status for the UI""" diff --git a/src/gcore/types/cloud/container_probe_config.py b/src/gcore/types/cloud/container_probe_config.py index 39c2f379..00e01044 100644 --- a/src/gcore/types/cloud/container_probe_config.py +++ b/src/gcore/types/cloud/container_probe_config.py @@ -13,4 +13,4 @@ class ContainerProbeConfig(BaseModel): """Whether the probe is enabled or not.""" probe: Optional[ContainerProbe] = None - """Probe configuration (exec, http_get or tcp_socket)""" + """Probe configuration (exec, `http_get` or `tcp_socket`)""" diff --git a/src/gcore/types/cloud/container_probe_config_create_param.py b/src/gcore/types/cloud/container_probe_config_create_param.py index 0ddedaae..39e562ba 100644 --- a/src/gcore/types/cloud/container_probe_config_create_param.py +++ b/src/gcore/types/cloud/container_probe_config_create_param.py @@ -14,4 +14,4 @@ class ContainerProbeConfigCreateParam(TypedDict, total=False): """Whether the probe is enabled or not.""" probe: ContainerProbeCreateParam - """Probe configuration (exec, http_get or tcp_socket)""" + """Probe configuration (exec, `http_get` or `tcp_socket`)""" diff --git a/src/gcore/types/cloud/container_scale_triggers.py b/src/gcore/types/cloud/container_scale_triggers.py index abdd43d7..ed70e633 100644 --- a/src/gcore/types/cloud/container_scale_triggers.py +++ b/src/gcore/types/cloud/container_scale_triggers.py @@ -17,13 +17,13 @@ class ContainerScaleTriggers(BaseModel): gpu_memory: Optional[ContainerScaleTriggerThreshold] = None """GPU memory trigger configuration. - Calculated by DCGM_FI_DEV_MEM_COPY_UTIL metric + Calculated by `DCGM_FI_DEV_MEM_COPY_UTIL` metric """ gpu_utilization: Optional[ContainerScaleTriggerThreshold] = None """GPU utilization trigger configuration. - Calculated by DCGM_FI_DEV_GPU_UTIL metric + Calculated by `DCGM_FI_DEV_GPU_UTIL` metric """ http: Optional[ContainerScaleTriggerRate] = None diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index bc2ceb7f..de44f4e4 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -56,7 +56,7 @@ class Instance(BaseModel): """Instance ID""" addresses: Dict[str, List[InstanceAddress]] - """Map of network_name to list of addresses in that network""" + """Map of `network_name` to list of addresses in that network""" created_at: datetime """Datetime when instance was created""" diff --git a/src/gcore/types/cloud/floating_ip_list_params.py b/src/gcore/types/cloud/floating_ip_list_params.py index 66325daf..6f0341d0 100644 --- a/src/gcore/types/cloud/floating_ip_list_params.py +++ b/src/gcore/types/cloud/floating_ip_list_params.py @@ -25,11 +25,11 @@ class FloatingIPListParams(TypedDict, total=False): """ tag_key: List[str] - """Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2""" + """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str """Optional. - Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": + Filter by tag key-value pairs. curl -G --data-urlencode "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" """ diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal_cluster.py index 95be387c..58e04497 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster.py @@ -106,7 +106,7 @@ class GPUBaremetalCluster(BaseModel): """String in base64 format. Must not be passed together with 'username' or 'password'. Examples of the - user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html + `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ username: Optional[str] = None 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 8fd160d4..e6932827 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -52,7 +52,7 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): ssh_key_name: str """ Specifies the name of the SSH keypair, created via the - /v1/ssh_keys endpoint. + [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). """ tags: TagUpdateMapParam @@ -69,7 +69,7 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): """String in base64 format. Must not be passed together with 'username' or 'password'. Examples of the - user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html + `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ username: str diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py index eddc7d1a..d3c1b9b1 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py @@ -21,7 +21,7 @@ class GPUBaremetalClusterDeleteParams(TypedDict, total=False): floatings: str """Comma separated list of floating ids that should be deleted. - Can't be used with delete_floatings. + Can't be used with `delete_floatings`. """ reserved_fixed_ips: str diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py index ef32ec82..e25da560 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py @@ -21,6 +21,6 @@ class GPUBaremetalClusterRebuildParams(TypedDict, total=False): user_data: Optional[str] """ - String in base64 format.Examples of the user_data: + String in base64 format.Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_server.py b/src/gcore/types/cloud/gpu_baremetal_cluster_server.py index beafd69c..328c2d69 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_server.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_server.py @@ -92,7 +92,7 @@ class GPUBaremetalClusterServer(BaseModel): """GPU server ID""" addresses: Dict[str, List[Address]] - """Map of network_name to list of addresses in that network""" + """Map of `network_name` to list of addresses in that network""" blackhole_ports: List[BlackholePort] """IP addresses of the instances that are blackholed by DDoS mitigation system""" diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py index 1cbd786a..eff9ad1d 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py @@ -24,7 +24,7 @@ class ImageUploadParams(TypedDict, total=False): """Image URL""" architecture: Optional[Literal["aarch64", "x86_64"]] - """Image architecture type: aarch64, x86_64""" + """Image architecture type: aarch64, `x86_64`""" cow_format: 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 6d2f4fce..094bd21e 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 @@ -58,10 +58,10 @@ class NewInterfaceExternalExtendSchemaWithDdosddosProfileField(TypedDict, total= """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or 'field_value' must be specified.""" + """Complex value. Only one of 'value' or '`field_value`' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or 'field_value' must be specified.""" + """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" class NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile(TypedDict, total=False): @@ -112,10 +112,10 @@ class NewInterfaceSpecificSubnetSchemaDDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or 'field_value' must be specified.""" + """Complex value. Only one of 'value' or '`field_value`' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or 'field_value' must be specified.""" + """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" class NewInterfaceSpecificSubnetSchemaDDOSProfile(TypedDict, total=False): @@ -158,7 +158,7 @@ class NewInterfaceAnySubnetSchema(TypedDict, total=False): """List of security group IDs""" type: str - """Must be 'any_subnet'""" + """Must be '`any_subnet`'""" class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): @@ -169,10 +169,10 @@ class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or 'field_value' must be specified.""" + """Complex value. Only one of 'value' or '`field_value`' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or 'field_value' must be specified.""" + """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" class NewInterfaceAnySubnetSchemaDDOSProfile(TypedDict, total=False): @@ -212,7 +212,7 @@ class NewInterfaceReservedFixedIPSchema(TypedDict, total=False): """List of security group IDs""" type: str - """Must be 'reserved_fixed_ip'. Union tag""" + """Must be '`reserved_fixed_ip`'. Union tag""" class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): @@ -223,10 +223,10 @@ class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or 'field_value' must be specified.""" + """Complex value. Only one of 'value' or '`field_value`' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or 'field_value' must be specified.""" + """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" class NewInterfaceReservedFixedIPSchemaDDOSProfile(TypedDict, total=False): diff --git a/src/gcore/types/cloud/gpu_baremetal_flavor.py b/src/gcore/types/cloud/gpu_baremetal_flavor.py index 50d3d93b..f334493d 100644 --- a/src/gcore/types/cloud/gpu_baremetal_flavor.py +++ b/src/gcore/types/cloud/gpu_baremetal_flavor.py @@ -95,13 +95,13 @@ class GPUBaremetalFlavorSerializerWithPricesHardwareProperties(BaseModel): class GPUBaremetalFlavorSerializerWithPricesPrice(BaseModel): currency_code: Optional[str] = None - """Currency code. Shown if the include_prices query parameter if set to true""" + """Currency code. Shown if the `include_prices` query parameter if set to true""" price_per_hour: Optional[float] = None - """Price per hour. Shown if the include_prices query parameter if set to true""" + """Price per hour. Shown if the `include_prices` query parameter if set to true""" price_per_month: Optional[float] = None - """Price per month. Shown if the include_prices query parameter if set to true""" + """Price per month. Shown if the `include_prices` query parameter if set to true""" price_status: Optional[Literal["error", "hide", "show"]] = None """Price status for the UI""" diff --git a/src/gcore/types/cloud/image.py b/src/gcore/types/cloud/image.py index 96313cdd..2ab1b799 100644 --- a/src/gcore/types/cloud/image.py +++ b/src/gcore/types/cloud/image.py @@ -70,7 +70,7 @@ class Image(BaseModel): """Image visibility. Globally visible images are public""" architecture: Optional[Literal["aarch64", "x86_64"]] = None - """An image architecture type: aarch64, x86_64""" + """An image architecture type: aarch64, `x86_64`""" creator_task_id: Optional[str] = None """Task that created this entity""" diff --git a/src/gcore/types/cloud/inference/deployment_create_params.py b/src/gcore/types/cloud/inference/deployment_create_params.py index e69a1c2a..53d35fd0 100644 --- a/src/gcore/types/cloud/inference/deployment_create_params.py +++ b/src/gcore/types/cloud/inference/deployment_create_params.py @@ -53,8 +53,8 @@ class DeploymentCreateParams(TypedDict, total=False): auth_enabled: bool """Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required - for the requests to the instance if enabled + `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is + required for the requests to the instance if enabled """ command: Optional[List[str]] @@ -78,7 +78,7 @@ class DeploymentCreateParams(TypedDict, total=False): probes: Optional[Probes] """Probes configured for all containers of the inference instance. - If probes are not provided, and the image_name is from a the Model Catalog + If probes are not provided, and the `image_name` is from a the Model Catalog registry, the default probes will be used. """ @@ -153,13 +153,13 @@ class ContainerScaleTriggers(TypedDict, total=False): gpu_memory: Optional[ContainerScaleTriggersGPUMemory] """GPU memory trigger configuration. - Calculated by DCGM_FI_DEV_MEM_COPY_UTIL metric + Calculated by `DCGM_FI_DEV_MEM_COPY_UTIL` metric """ gpu_utilization: Optional[ContainerScaleTriggersGPUUtilization] """GPU utilization trigger configuration. - Calculated by DCGM_FI_DEV_GPU_UTIL metric + Calculated by `DCGM_FI_DEV_GPU_UTIL` metric """ http: Optional[ContainerScaleTriggersHTTP] diff --git a/src/gcore/types/cloud/inference/deployment_update_params.py b/src/gcore/types/cloud/inference/deployment_update_params.py index e1a62fdf..42111525 100644 --- a/src/gcore/types/cloud/inference/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -47,8 +47,8 @@ class DeploymentUpdateParams(TypedDict, total=False): auth_enabled: bool """Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required - for the requests to the instance if enabled + `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is + required for the requests to the instance if enabled """ command: Optional[List[str]] @@ -160,13 +160,13 @@ class ContainerScaleTriggers(TypedDict, total=False): gpu_memory: Optional[ContainerScaleTriggersGPUMemory] """GPU memory trigger configuration. - Calculated by DCGM_FI_DEV_MEM_COPY_UTIL metric + Calculated by `DCGM_FI_DEV_MEM_COPY_UTIL` metric """ gpu_utilization: Optional[ContainerScaleTriggersGPUUtilization] """GPU utilization trigger configuration. - Calculated by DCGM_FI_DEV_GPU_UTIL metric + Calculated by `DCGM_FI_DEV_GPU_UTIL` metric """ http: Optional[ContainerScaleTriggersHTTP] @@ -276,7 +276,7 @@ class ProbesLivenessProbe(TypedDict, total=False): """Whether the probe is enabled or not.""" probe: ProbesLivenessProbeProbe - """Probe configuration (exec, http_get or tcp_socket)""" + """Probe configuration (exec, `http_get` or `tcp_socket`)""" class ProbesReadinessProbeProbeExec(TypedDict, total=False): @@ -337,7 +337,7 @@ class ProbesReadinessProbe(TypedDict, total=False): """Whether the probe is enabled or not.""" probe: ProbesReadinessProbeProbe - """Probe configuration (exec, http_get or tcp_socket)""" + """Probe configuration (exec, `http_get` or `tcp_socket`)""" class ProbesStartupProbeProbeExec(TypedDict, total=False): @@ -398,7 +398,7 @@ class ProbesStartupProbe(TypedDict, total=False): """Whether the probe is enabled or not.""" probe: ProbesStartupProbeProbe - """Probe configuration (exec, http_get or tcp_socket)""" + """Probe configuration (exec, `http_get` or `tcp_socket`)""" class Probes(TypedDict, total=False): diff --git a/src/gcore/types/cloud/inference/inference.py b/src/gcore/types/cloud/inference/inference.py index 450c789f..20d10c74 100644 --- a/src/gcore/types/cloud/inference/inference.py +++ b/src/gcore/types/cloud/inference/inference.py @@ -19,8 +19,8 @@ class Inference(BaseModel): auth_enabled: bool """`true` if instance uses API key authentication. - `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required - for the requests to the instance if enabled. + `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is + required for the requests to the instance if enabled. """ command: Optional[str] = None @@ -71,9 +71,7 @@ class Inference(BaseModel): """Project ID. If not provided, your default project ID will be used.""" status: Literal["ACTIVE", "DELETING", "DEPLOYING", "DISABLED", "PARTIALLYDEPLOYED", "PENDING"] - """Inference instance status. - - Value can be one of the following: + """Inference instance status. Value can be one of the following: - `DEPLOYING` - The instance is being deployed. Containers are not yet created. - `PARTIALLYDEPLOYED` - All containers have been created, but some may not be diff --git a/src/gcore/types/cloud/instance.py b/src/gcore/types/cloud/instance.py index 4521ec7e..6f049f2d 100644 --- a/src/gcore/types/cloud/instance.py +++ b/src/gcore/types/cloud/instance.py @@ -185,7 +185,7 @@ class Instance(BaseModel): """Instance ID""" addresses: Dict[str, List[Address]] - """Map of network_name to list of addresses in that network""" + """Map of `network_name` to list of addresses in that network""" blackhole_ports: List[BlackholePort] """IP addresses of the instances that are blackholed by DDoS mitigation system""" diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index a929377a..db34609e 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -78,8 +78,8 @@ class InstanceCreateParams(TypedDict, total=False): If you want the instance name to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during - provisioning. Supported placeholders are: `{ip_octets}` (last 3 octets of the - IP), `{two_ip_octets}`, and `{one_ip_octet}`. + provisioning. Supported placeholders are: `{`ip_octets`}` (last 3 octets of the + IP), `{`two_ip_octets`}`, and `{`one_ip_octet`}`. """ password: str @@ -88,8 +88,8 @@ class InstanceCreateParams(TypedDict, total=False): When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the - 'user_data' field to provide a script to create new users on Windows. The - password of the Admin user cannot be updated via 'user_data'. + '`user_data`' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via '`user_data`'. """ security_groups: Iterable[SecurityGroup] @@ -98,9 +98,7 @@ class InstanceCreateParams(TypedDict, total=False): """ servergroup_id: str - """Placement group ID for instance placement policy. - - Supported group types: + """Placement group ID for instance placement policy. Supported group types: - `anti-affinity`: Ensures instances are placed on different hosts for high availability. @@ -112,7 +110,7 @@ class InstanceCreateParams(TypedDict, total=False): ssh_key_name: Optional[str] """ Specifies the name of the SSH keypair, created via the - /v1/ssh_keys endpoint. + [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). """ tags: TagUpdateMapParam @@ -128,9 +126,9 @@ class InstanceCreateParams(TypedDict, total=False): user_data: str """String in base64 format. - For Linux instances, 'user_data' is ignored when 'password' field is provided. + For Linux instances, '`user_data`' is ignored when 'password' field is provided. For Windows instances, Admin user password is set by 'password' field and cannot - be updated via 'user_data'. Examples of the user_data: + be updated via '`user_data`'. Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ @@ -412,7 +410,7 @@ class VolumeCreateInstanceCreateNewVolumeSerializer(TypedDict, total=False): IOPS: 9000. Max bandwidth: 500 MB/s. - `ssd_lowlatency` - SSD storage optimized for low-latency and real-time processing. Max IOPS: 5000. Average latency: 300 µs. Snapshots and volume - resizing are **not** supported for `ssd_lowlatency`. + resizing are \\**\\**not\\**\\** supported for `ssd_lowlatency`. """ @@ -448,7 +446,7 @@ class VolumeCreateInstanceCreateVolumeFromImageSerializer(TypedDict, total=False size: int """Volume size in GiB. - - For instances: **specify the desired volume size explicitly**. + - For instances: \\**\\**specify the desired volume size explicitly\\**\\**. - For basic VMs: the size is set automatically based on the flavor. """ @@ -473,7 +471,7 @@ class VolumeCreateInstanceCreateVolumeFromImageSerializer(TypedDict, total=False IOPS: 9000. Max bandwidth: 500 MB/s. - `ssd_lowlatency` - SSD storage optimized for low-latency and real-time processing. Max IOPS: 5000. Average latency: 300 µs. Snapshots and volume - resizing are **not** supported for `ssd_lowlatency`. + resizing are \\**\\**not\\**\\** supported for `ssd_lowlatency`. """ @@ -573,7 +571,7 @@ class VolumeCreateInstanceCreateVolumeFromApptemplateSerializer(TypedDict, total IOPS: 9000. Max bandwidth: 500 MB/s. - `ssd_lowlatency` - SSD storage optimized for low-latency and real-time processing. Max IOPS: 5000. Average latency: 300 µs. Snapshots and volume - resizing are **not** supported for `ssd_lowlatency`. + resizing are \\**\\**not\\**\\** supported for `ssd_lowlatency`. """ diff --git a/src/gcore/types/cloud/instance_list_params.py b/src/gcore/types/cloud/instance_list_params.py index 60ff63ec..dbbbb038 100644 --- a/src/gcore/types/cloud/instance_list_params.py +++ b/src/gcore/types/cloud/instance_list_params.py @@ -37,10 +37,10 @@ class InstanceListParams(TypedDict, total=False): """Exclude instances with specified security group name""" flavor_id: str - """Filter out instances by flavor_id. Flavor id must match exactly.""" + """Filter out instances by `flavor_id`. Flavor id must match exactly.""" flavor_prefix: str - """Filter out instances by flavor_prefix.""" + """Filter out instances by `flavor_prefix`.""" include_ai: bool """Include GPU clusters' servers""" @@ -87,13 +87,13 @@ class InstanceListParams(TypedDict, total=False): profile_name: str """Filter result by ddos protection profile name. - Effective only with with_ddos set to true. + Effective only with `with_ddos` set to true. """ protection_status: Literal["Active", "Queued", "Error"] - """Filter result by DDoS protection_status. + """Filter result by DDoS `protection_status`. - if parameter is provided. Effective only with with_ddos set to true. (Active, + if parameter is provided. Effective only with `with_ddos` set to true. (Active, Queued or Error) """ @@ -120,17 +120,17 @@ class InstanceListParams(TypedDict, total=False): tag_key_value: str """Optional. - Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": + Filter by tag key-value pairs. curl -G --data-urlencode "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" """ tag_value: List[str] - """Optional. Filter by tag values. ?tag_value=value1&tag_value=value2""" + """Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2""" type_ddos_profile: Literal["basic", "advanced"] """Return bare metals either only with advanced or only basic DDoS protection. - Effective only with with_ddos set to true. (advanced or basic) + Effective only with `with_ddos` set to true. (advanced or basic) """ uuid: str diff --git a/src/gcore/types/cloud/instances/flavor_list_suitable_params.py b/src/gcore/types/cloud/instances/flavor_list_suitable_params.py index 74547aa3..3508d066 100644 --- a/src/gcore/types/cloud/instances/flavor_list_suitable_params.py +++ b/src/gcore/types/cloud/instances/flavor_list_suitable_params.py @@ -50,7 +50,10 @@ class Volume(TypedDict, total=False): """Volume snapshot ID. Mandatory if volume is created from a snapshot""" type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - """One of 'standard', 'ssd_hiiops', 'ssd_local', 'ssd_lowlatency', 'cold', 'ultra'""" + """ + One of 'standard', '`ssd_hiiops`', '`ssd_local`', '`ssd_lowlatency`', 'cold', + 'ultra' + """ volume_id: str """Volume ID. Mandatory if volume is pre-existing volume""" diff --git a/src/gcore/types/cloud/instances/image_list_params.py b/src/gcore/types/cloud/instances/image_list_params.py index 09f8b505..07949b72 100644 --- a/src/gcore/types/cloud/instances/image_list_params.py +++ b/src/gcore/types/cloud/instances/image_list_params.py @@ -25,7 +25,7 @@ class ImageListParams(TypedDict, total=False): tag_key_value: str """Filter by tag key-value pairs. - Must be a valid JSON string. 'curl -G --data-urlencode 'tag_key_value={"key": + Must be a valid JSON string. 'curl -G --data-urlencode '`tag_key_value`={"key": "value"}' --url 'http://localhost:1111/v1/images/1/1'" """ diff --git a/src/gcore/types/cloud/instances/instance_flavor.py b/src/gcore/types/cloud/instances/instance_flavor.py index 7e53296f..3c6b84ef 100644 --- a/src/gcore/types/cloud/instances/instance_flavor.py +++ b/src/gcore/types/cloud/instances/instance_flavor.py @@ -34,16 +34,16 @@ class InstanceFlavor(BaseModel): """Number of available instances of given configuration""" currency_code: Optional[str] = None - """Currency code. Shown if the include_prices query parameter if set to true""" + """Currency code. Shown if the `include_prices` query parameter if set to true""" hardware_description: Optional[Dict[str, str]] = None """Additional hardware description""" price_per_hour: Optional[float] = None - """Price per hour. Shown if the include_prices query parameter if set to true""" + """Price per hour. Shown if the `include_prices` query parameter if set to true""" price_per_month: Optional[float] = None - """Price per month. Shown if the include_prices query parameter if set to true""" + """Price per month. Shown if the `include_prices` query parameter if set to true""" price_status: Optional[Literal["error", "hide", "show"]] = None """Price status for the UI""" diff --git a/src/gcore/types/cloud/instances/interface_attach_params.py b/src/gcore/types/cloud/instances/interface_attach_params.py index 2efaba4c..42ad62d6 100644 --- a/src/gcore/types/cloud/instances/interface_attach_params.py +++ b/src/gcore/types/cloud/instances/interface_attach_params.py @@ -58,10 +58,10 @@ class NewInterfaceExternalExtendSchemaWithDdosddosProfileField(TypedDict, total= """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or 'field_value' must be specified.""" + """Complex value. Only one of 'value' or '`field_value`' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or 'field_value' must be specified.""" + """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" class NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile(TypedDict, total=False): @@ -112,10 +112,10 @@ class NewInterfaceSpecificSubnetSchemaDDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or 'field_value' must be specified.""" + """Complex value. Only one of 'value' or '`field_value`' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or 'field_value' must be specified.""" + """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" class NewInterfaceSpecificSubnetSchemaDDOSProfile(TypedDict, total=False): @@ -158,7 +158,7 @@ class NewInterfaceAnySubnetSchema(TypedDict, total=False): """List of security group IDs""" type: str - """Must be 'any_subnet'""" + """Must be '`any_subnet`'""" class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): @@ -169,10 +169,10 @@ class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or 'field_value' must be specified.""" + """Complex value. Only one of 'value' or '`field_value`' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or 'field_value' must be specified.""" + """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" class NewInterfaceAnySubnetSchemaDDOSProfile(TypedDict, total=False): @@ -212,7 +212,7 @@ class NewInterfaceReservedFixedIPSchema(TypedDict, total=False): """List of security group IDs""" type: str - """Must be 'reserved_fixed_ip'. Union tag""" + """Must be '`reserved_fixed_ip`'. Union tag""" class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): @@ -223,10 +223,10 @@ class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or 'field_value' must be specified.""" + """Complex value. Only one of 'value' or '`field_value`' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or 'field_value' must be specified.""" + """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" class NewInterfaceReservedFixedIPSchemaDDOSProfile(TypedDict, total=False): diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index dfadf6e2..c208e7fa 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -61,8 +61,9 @@ class LoadBalancerCreateParams(TypedDict, total=False): """ Preferred option to establish connectivity between load balancer and its pools members. L2 provides best performance, L3 provides less IPs usage. It is taking - effect only if instance_id + ip_address is provided, not subnet_id + ip_address, - because we're considering this as intentional subnet_id specification. + effect only if `instance_id` + `ip_address` is provided, not `subnet_id` + + `ip_address`, because we're considering this as intentional `subnet_id` + specification. """ tags: TagUpdateMapParam @@ -77,27 +78,28 @@ class LoadBalancerCreateParams(TypedDict, total=False): vip_ip_family: InterfaceIPFamily """ - IP family for load balancer subnet auto-selection if vip_network_id is specified + IP family for load balancer subnet auto-selection if `vip_network_id` is + specified """ vip_network_id: str """Network ID for load balancer. If not specified, default external network will be used. Mutually exclusive with - vip_port_id + `vip_port_id` """ vip_port_id: str """Existing Reserved Fixed IP port ID for load balancer. - Mutually exclusive with vip_network_id + Mutually exclusive with `vip_network_id` """ vip_subnet_id: str """Subnet ID for load balancer. - If not specified, any subnet from vip_network_id will be selected. Ignored when - vip_network_id is not specified. + If not specified, any subnet from `vip_network_id` will be selected. Ignored + when `vip_network_id` is not specified. """ @@ -176,7 +178,7 @@ class ListenerPoolMember(TypedDict, total=False): """true if enabled. Defaults to true""" instance_id: Optional[str] - """Either subnet_id or instance_id should be provided""" + """Either `subnet_id` or `instance_id` should be provided""" monitor_address: Optional[str] """An alternate IP address used for health monitoring of a backend member. @@ -187,11 +189,11 @@ class ListenerPoolMember(TypedDict, total=False): monitor_port: Optional[int] """An alternate protocol port used for health monitoring of a backend member. - Default is null which monitors the member protocol_port. + Default is null which monitors the member `protocol_port`. """ subnet_id: Optional[str] - """Either subnet_id or instance_id should be provided""" + """Either `subnet_id` or `instance_id` should be provided""" weight: Optional[int] """Member weight. Valid values: 0 to 256, defaults to 1""" @@ -205,7 +207,7 @@ class ListenerPoolSessionPersistence(TypedDict, total=False): """Should be set if app cookie or http cookie is used""" persistence_granularity: Optional[str] - """Subnet mask if source_ip is used. For UDP ports only""" + """Subnet mask if `source_ip` is used. For UDP ports only""" persistence_timeout: Optional[int] """Session persistence timeout. For UDP ports only""" @@ -282,7 +284,7 @@ class Listener(TypedDict, total=False): insert_x_forwarded: bool """Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. - Only used with HTTP or TERMINATED_HTTPS protocols. + Only used with HTTP or `TERMINATED_HTTPS` protocols. """ pools: Iterable[ListenerPool] @@ -290,14 +292,14 @@ class Listener(TypedDict, total=False): secret_id: str """ - ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS - listener + ID of the secret where PKCS12 file is stored for `TERMINATED_HTTPS` or + PROMETHEUS listener """ sni_secret_id: List[str] """ List of secrets IDs containing PKCS12 format certificate/key bundles for - TERMINATED_HTTPS or PROMETHEUS listeners + `TERMINATED_HTTPS` or PROMETHEUS listeners """ timeout_client_data: Optional[int] diff --git a/src/gcore/types/cloud/load_balancer_flavor_detail.py b/src/gcore/types/cloud/load_balancer_flavor_detail.py index 0d96a5e4..33eb224b 100644 --- a/src/gcore/types/cloud/load_balancer_flavor_detail.py +++ b/src/gcore/types/cloud/load_balancer_flavor_detail.py @@ -28,13 +28,13 @@ class LoadBalancerFlavorDetail(BaseModel): """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" currency_code: Optional[str] = None - """Currency code. Shown if the include_prices query parameter if set to true""" + """Currency code. Shown if the `include_prices` query parameter if set to true""" price_per_hour: Optional[float] = None - """Price per hour. Shown if the include_prices query parameter if set to true""" + """Price per hour. Shown if the `include_prices` query parameter if set to true""" price_per_month: Optional[float] = None - """Price per month. Shown if the include_prices query parameter if set to true""" + """Price per month. Shown if the `include_prices` query parameter if set to true""" price_status: Optional[Literal["error", "hide", "show"]] = None """Price status for the UI""" diff --git a/src/gcore/types/cloud/load_balancer_l7_policy.py b/src/gcore/types/cloud/load_balancer_l7_policy.py index 5e0c9a3e..4190b4e9 100644 --- a/src/gcore/types/cloud/load_balancer_l7_policy.py +++ b/src/gcore/types/cloud/load_balancer_l7_policy.py @@ -38,26 +38,26 @@ class LoadBalancerL7Policy(BaseModel): redirect_http_code: Optional[int] = None """ 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. + 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. """ redirect_pool_id: Optional[str] = None """Requests matching this policy will be redirected to the pool with this ID. - Only valid if action is REDIRECT_TO_POOL. + Only valid if action is `REDIRECT_TO_POOL`. """ redirect_prefix: Optional[str] = None """Requests matching this policy will be redirected to this Prefix URL. - Only valid if action is REDIRECT_PREFIX. + Only valid if action is `REDIRECT_PREFIX`. """ redirect_url: Optional[str] = None """Requests matching this policy will be redirected to this URL. - Only valid if action is REDIRECT_TO_URL. + Only valid if action is `REDIRECT_TO_URL`. """ region: Optional[str] = None diff --git a/src/gcore/types/cloud/load_balancer_list_params.py b/src/gcore/types/cloud/load_balancer_list_params.py index 94fe2169..eecfdab7 100644 --- a/src/gcore/types/cloud/load_balancer_list_params.py +++ b/src/gcore/types/cloud/load_balancer_list_params.py @@ -30,10 +30,10 @@ class LoadBalancerListParams(TypedDict, total=False): order_by: str """ - Ordering Load Balancer list result by name, created_at, updated_at, - operating_status, provisioning_status, vip_address, vip_ip_family and flavor - fields of the load balancer and directions (name.asc), default is - "created_at.asc" + Ordering Load Balancer list result by name, `created_at`, `updated_at`, + `operating_status`, `provisioning_status`, `vip_address`, `vip_ip_family` and + flavor fields of the load balancer and directions (name.asc), default is + "`created_at`.asc" """ show_stats: bool @@ -45,7 +45,7 @@ class LoadBalancerListParams(TypedDict, total=False): tag_key_value: str """Filter by tag key-value pairs. - Must be a valid JSON string. curl -G --data-urlencode "tag_key_value={"key": + Must be a valid JSON string. curl -G --data-urlencode "`tag_key_value`={"key": "value"}" --url "http://localhost:1111/v1/loadbalancers/1/1" """ diff --git a/src/gcore/types/cloud/load_balancer_listener_detail.py b/src/gcore/types/cloud/load_balancer_listener_detail.py index 46bec730..41d9a4c6 100644 --- a/src/gcore/types/cloud/load_balancer_listener_detail.py +++ b/src/gcore/types/cloud/load_balancer_listener_detail.py @@ -35,7 +35,7 @@ class LoadBalancerListenerDetail(BaseModel): insert_headers: object """Dictionary of additional header insertion into HTTP headers. - Only used with HTTP and TERMINATED_HTTPS protocols. + Only used with HTTP and `TERMINATED_HTTPS` protocols. """ loadbalancer_id: Optional[str] = None @@ -61,14 +61,14 @@ class LoadBalancerListenerDetail(BaseModel): secret_id: Optional[str] = None """ - ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS - load balancer + ID of the secret where PKCS12 file is stored for `TERMINATED_HTTPS` or + PROMETHEUS load balancer """ sni_secret_id: Optional[List[str]] = None """ List of secret's ID containing PKCS12 format certificate/key bundles for - TERMINATED_HTTPS or PROMETHEUS listeners + `TERMINATED_HTTPS` or PROMETHEUS listeners """ stats: Optional[LoadBalancerStatistics] = None diff --git a/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py b/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py index 390b0f1b..f4bb93b8 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py +++ b/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py @@ -28,26 +28,26 @@ class L7PolicyCreateParams(TypedDict, total=False): 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. + 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. """ redirect_pool_id: str """Requests matching this policy will be redirected to the pool withthis ID. - Only valid if action is REDIRECT_TO_POOL. + Only valid if action is `REDIRECT_TO_POOL`. """ redirect_prefix: str """Requests matching this policy will be redirected to this Prefix URL. - Only valid if action is REDIRECT_PREFIX. + Only valid if action is `REDIRECT_PREFIX`. """ redirect_url: str """Requests matching this policy will be redirected to this URL. - Only valid if action is REDIRECT_TO_URL. + Only valid if action is `REDIRECT_TO_URL`. """ tags: List[str] 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 index bd35a28c..697b0954 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py +++ b/src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py @@ -25,26 +25,26 @@ class L7PolicyReplaceParams(TypedDict, total=False): 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. + 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. """ redirect_pool_id: str """Requests matching this policy will be redirected to the pool with this ID. - Only valid if action is REDIRECT_TO_POOL. + Only valid if action is `REDIRECT_TO_POOL`. """ redirect_prefix: str """Requests matching this policy will be redirected to this Prefix URL. - Only valid if action is REDIRECT_PREFIX. + Only valid if action is `REDIRECT_PREFIX`. """ redirect_url: str """Requests matching this policy will be redirected to this URL. - Only valid if action is REDIRECT_TO_URL. + Only valid if action is `REDIRECT_TO_URL`. """ tags: List[str] diff --git a/src/gcore/types/cloud/load_balancers/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py index 338c43af..5afdc99f 100644 --- a/src/gcore/types/cloud/load_balancers/listener_create_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -38,19 +38,19 @@ class ListenerCreateParams(TypedDict, total=False): insert_x_forwarded: bool """Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. - Only used with HTTP or TERMINATED_HTTPS protocols. + Only used with HTTP or `TERMINATED_HTTPS` protocols. """ secret_id: str """ - ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS - listener + ID of the secret where PKCS12 file is stored for `TERMINATED_HTTPS` or + PROMETHEUS listener """ sni_secret_id: List[str] """ List of secrets IDs containing PKCS12 format certificate/key bundles for - TERMINATED_HTTPS or PROMETHEUS listeners + `TERMINATED_HTTPS` or PROMETHEUS listeners """ timeout_client_data: Optional[int] diff --git a/src/gcore/types/cloud/load_balancers/listener_update_params.py b/src/gcore/types/cloud/load_balancers/listener_update_params.py index 54f5c1e9..8c520b8f 100644 --- a/src/gcore/types/cloud/load_balancers/listener_update_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_update_params.py @@ -26,14 +26,14 @@ class ListenerUpdateParams(TypedDict, total=False): secret_id: Optional[str] """ - ID of the secret where PKCS12 file is stored for TERMINATED_HTTPS or PROMETHEUS - load balancer + ID of the secret where PKCS12 file is stored for `TERMINATED_HTTPS` or + PROMETHEUS load balancer """ sni_secret_id: Optional[List[str]] """ List of secret's ID containing PKCS12 format certificate/key bundfles for - TERMINATED_HTTPS or PROMETHEUS listeners + `TERMINATED_HTTPS` or PROMETHEUS listeners """ timeout_client_data: Optional[int] 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 957f4c1b..200c0f1d 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -108,7 +108,7 @@ class Member(TypedDict, total=False): """true if enabled. Defaults to true""" instance_id: Optional[str] - """Either subnet_id or instance_id should be provided""" + """Either `subnet_id` or `instance_id` should be provided""" monitor_address: Optional[str] """An alternate IP address used for health monitoring of a backend member. @@ -119,11 +119,11 @@ class Member(TypedDict, total=False): monitor_port: Optional[int] """An alternate protocol port used for health monitoring of a backend member. - Default is null which monitors the member protocol_port. + Default is null which monitors the member `protocol_port`. """ subnet_id: Optional[str] - """Either subnet_id or instance_id should be provided""" + """Either `subnet_id` or `instance_id` should be provided""" weight: Optional[int] """Member weight. Valid values: 0 to 256, defaults to 1""" @@ -137,7 +137,7 @@ class SessionPersistence(TypedDict, total=False): """Should be set if app cookie or http cookie is used""" persistence_granularity: Optional[str] - """Subnet mask if source_ip is used. For UDP ports only""" + """Subnet mask if `source_ip` is used. For UDP ports only""" persistence_timeout: Optional[int] """Session persistence timeout. For UDP ports only""" 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 0a4c2006..d02fa244 100644 --- a/src/gcore/types/cloud/load_balancers/pool_update_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_update_params.py @@ -106,7 +106,7 @@ class Member(TypedDict, total=False): """true if enabled. Defaults to true""" instance_id: Optional[str] - """Either subnet_id or instance_id should be provided""" + """Either `subnet_id` or `instance_id` should be provided""" monitor_address: Optional[str] """An alternate IP address used for health monitoring of a backend member. @@ -117,11 +117,11 @@ class Member(TypedDict, total=False): monitor_port: Optional[int] """An alternate protocol port used for health monitoring of a backend member. - Default is null which monitors the member protocol_port. + Default is null which monitors the member `protocol_port`. """ subnet_id: Optional[str] - """Either subnet_id or instance_id should be provided""" + """Either `subnet_id` or `instance_id` should be provided""" weight: Optional[int] """Member weight. Valid values: 0 to 256, defaults to 1""" @@ -135,7 +135,7 @@ class SessionPersistence(TypedDict, total=False): """Should be set if app cookie or http cookie is used""" persistence_granularity: Optional[str] - """Subnet mask if source_ip is used. For UDP ports only""" + """Subnet mask if `source_ip` is used. For UDP ports only""" persistence_timeout: Optional[int] """Session persistence timeout. For UDP ports only""" diff --git a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py index fa2e5d28..341128b5 100644 --- a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py @@ -25,7 +25,7 @@ class MemberAddParams(TypedDict, total=False): """true if enabled. Defaults to true""" instance_id: Optional[str] - """Either subnet_id or instance_id should be provided""" + """Either `subnet_id` or `instance_id` should be provided""" monitor_address: Optional[str] """An alternate IP address used for health monitoring of a backend member. @@ -36,11 +36,11 @@ class MemberAddParams(TypedDict, total=False): monitor_port: Optional[int] """An alternate protocol port used for health monitoring of a backend member. - Default is null which monitors the member protocol_port. + Default is null which monitors the member `protocol_port`. """ subnet_id: Optional[str] - """Either subnet_id or instance_id should be provided""" + """Either `subnet_id` or `instance_id` should be provided""" weight: Optional[int] """Member weight. Valid values: 0 to 256, defaults to 1""" diff --git a/src/gcore/types/cloud/member.py b/src/gcore/types/cloud/member.py index 8b87f60b..edcda79f 100644 --- a/src/gcore/types/cloud/member.py +++ b/src/gcore/types/cloud/member.py @@ -40,8 +40,8 @@ class Member(BaseModel): monitor_port: Optional[int] = None """An alternate protocol port used for health monitoring of a backend member. - Default is null which monitors the member protocol_port. + Default is null which monitors the member `protocol_port`. """ subnet_id: Optional[str] = None - """Either subnet_id or instance_id should be provided""" + """Either `subnet_id` or `instance_id` should be provided""" diff --git a/src/gcore/types/cloud/network.py b/src/gcore/types/cloud/network.py index c0010966..71f16653 100644 --- a/src/gcore/types/cloud/network.py +++ b/src/gcore/types/cloud/network.py @@ -20,7 +20,7 @@ class Network(BaseModel): """Task that created this entity""" default: Optional[bool] = None - """True if network has is_default attribute""" + """True if network has `is_default` attribute""" external: bool """True if the network `router:external` attribute""" @@ -33,7 +33,7 @@ class Network(BaseModel): port_security_enabled: bool """ - Indicates port_security_enabled status of all newly created in the network + Indicates `port_security_enabled` status of all newly created in the network ports. """ diff --git a/src/gcore/types/cloud/network_details.py b/src/gcore/types/cloud/network_details.py index 6d1ead06..1e0ad7cf 100644 --- a/src/gcore/types/cloud/network_details.py +++ b/src/gcore/types/cloud/network_details.py @@ -21,7 +21,7 @@ class NetworkDetails(BaseModel): """Task that created this entity""" default: Optional[bool] = None - """True if network has is_default attribute""" + """True if network has `is_default` attribute""" external: bool """True if the network `router:external` attribute""" @@ -34,7 +34,7 @@ class NetworkDetails(BaseModel): port_security_enabled: bool """ - Indicates port_security_enabled status of all newly created in the network + Indicates `port_security_enabled` status of all newly created in the network ports. """ diff --git a/src/gcore/types/cloud/network_list_params.py b/src/gcore/types/cloud/network_list_params.py index 036239fc..95d7c10f 100644 --- a/src/gcore/types/cloud/network_list_params.py +++ b/src/gcore/types/cloud/network_list_params.py @@ -31,11 +31,11 @@ class NetworkListParams(TypedDict, total=False): """ tag_key: List[str] - """Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2""" + """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str """Optional. - Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": + Filter by tag key-value pairs. curl -G --data-urlencode "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" """ diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index ca25a006..c9371c7a 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -30,7 +30,7 @@ class SubnetCreateParams(TypedDict, total=False): connect_to_network_router: bool """True if the network's router should get a gateway in this subnet. - Must be explicitly 'false' when gateway_ip is null. + Must be explicitly 'false' when `gateway_ip` is null. """ dns_nameservers: Optional[List[str]] diff --git a/src/gcore/types/cloud/networks/subnet_list_params.py b/src/gcore/types/cloud/networks/subnet_list_params.py index 5ce2271e..8865e006 100644 --- a/src/gcore/types/cloud/networks/subnet_list_params.py +++ b/src/gcore/types/cloud/networks/subnet_list_params.py @@ -48,11 +48,11 @@ class SubnetListParams(TypedDict, total=False): """ tag_key: List[str] - """Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2""" + """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str """Optional. - Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": + Filter by tag key-value pairs. curl -G --data-urlencode "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" """ diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py index 23e65285..83be871e 100644 --- a/src/gcore/types/cloud/region.py +++ b/src/gcore/types/cloud/region.py @@ -26,7 +26,7 @@ class Region(BaseModel): """AI service API endpoint ID""" available_volume_types: Optional[List[str]] = None - """List of available volume types, 'standard', 'ssd_hiiops', 'cold'].""" + """List of available volume types, 'standard', '`ssd_hiiops`', 'cold'].""" coordinates: Optional[Coordinates] = None """Coordinates of the region""" diff --git a/src/gcore/types/cloud/registries/user_create_multiple_params.py b/src/gcore/types/cloud/registries/user_create_multiple_params.py index e580e8dc..48dbfc44 100644 --- a/src/gcore/types/cloud/registries/user_create_multiple_params.py +++ b/src/gcore/types/cloud/registries/user_create_multiple_params.py @@ -22,11 +22,9 @@ class User(TypedDict, total=False): """User account operating time, days""" name: Required[str] - """A name for the registry user. - - Should be in lowercase, consisting only of numbers and letters, - - with maximum length of 16 characters + """ + A name for the registry user. Should be in lowercase, consisting only of numbers + and letters, with maximum length of 16 characters """ read_only: bool diff --git a/src/gcore/types/cloud/registries/user_create_params.py b/src/gcore/types/cloud/registries/user_create_params.py index a658b14c..19283e53 100644 --- a/src/gcore/types/cloud/registries/user_create_params.py +++ b/src/gcore/types/cloud/registries/user_create_params.py @@ -16,11 +16,9 @@ class UserCreateParams(TypedDict, total=False): """User account operating time, days""" name: Required[str] - """A name for the registry user. - - Should be in lowercase, consisting only of numbers and letters, - - with maximum length of 16 characters + """ + A name for the registry user. Should be in lowercase, consisting only of numbers + and letters, with maximum length of 16 characters """ read_only: bool diff --git a/src/gcore/types/cloud/registry_create_params.py b/src/gcore/types/cloud/registry_create_params.py index 2d5ecfbb..13f03cab 100644 --- a/src/gcore/types/cloud/registry_create_params.py +++ b/src/gcore/types/cloud/registry_create_params.py @@ -13,11 +13,9 @@ class RegistryCreateParams(TypedDict, total=False): region_id: int name: Required[str] - """A name for the container registry. - - Should be in lowercase, consisting only of numbers, letters and -, - - with maximum length of 24 characters + """ + A name for the container registry. Should be in lowercase, consisting only of + numbers, letters and -, with maximum length of 24 characters """ storage_limit: int diff --git a/src/gcore/types/cloud/reserved_fixed_ip_create_params.py b/src/gcore/types/cloud/reserved_fixed_ip_create_params.py index 553101d5..66f352c1 100644 --- a/src/gcore/types/cloud/reserved_fixed_ip_create_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ip_create_params.py @@ -56,7 +56,7 @@ class NewReservedFixedIPAnySubnetSerializer(TypedDict, total=False): """Reserved fixed IP will be allocated in a subnet of this network""" type: Required[Literal["any_subnet"]] - """Must be 'any_subnet'.""" + """Must be '`any_subnet`'.""" ip_family: Optional[InterfaceIPFamily] """Which subnets should be selected: IPv4, IPv6 or use dual stack.""" @@ -77,7 +77,7 @@ class NewReservedFixedIPSpecificIPAddressSerializer(TypedDict, total=False): """Reserved fixed IP will be allocated in a subnet of this network""" type: Required[Literal["ip_address"]] - """Must be 'ip_address'.""" + """Must be '`ip_address`'.""" is_vip: bool """If reserved fixed IP is a VIP""" diff --git a/src/gcore/types/cloud/reserved_fixed_ip_list_params.py b/src/gcore/types/cloud/reserved_fixed_ip_list_params.py index a3f37ace..df83a8eb 100644 --- a/src/gcore/types/cloud/reserved_fixed_ip_list_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ip_list_params.py @@ -38,9 +38,9 @@ class ReservedFixedIPListParams(TypedDict, total=False): order_by: str """ - Ordering reserved fixed IP list result by name, status, updated_at, created_at - or fixed_ip_address fields of the reserved fixed IP and directions (status.asc), - default is "fixed_ip_address.asc" + Ordering reserved fixed IP list result by name, status, `updated_at`, + `created_at` or `fixed_ip_address` fields of the reserved fixed IP and + directions (status.asc), default is "`fixed_ip_address`.asc" """ vip_only: bool diff --git a/src/gcore/types/cloud/security_group_list_params.py b/src/gcore/types/cloud/security_group_list_params.py index ba59268e..a6a7500e 100644 --- a/src/gcore/types/cloud/security_group_list_params.py +++ b/src/gcore/types/cloud/security_group_list_params.py @@ -25,6 +25,6 @@ class SecurityGroupListParams(TypedDict, total=False): tag_key_value: str """Filter by tag key-value pairs. - Must be a valid JSON string. curl -G --data-urlencode "tag_key_value={"key": + Must be a valid JSON string. curl -G --data-urlencode "`tag_key_value`={"key": "value"}" --url "http://localhost:1111/v1/securitygroups/1/1" """ diff --git a/src/gcore/types/cloud/session_persistence.py b/src/gcore/types/cloud/session_persistence.py index 0dca6a5c..e24317d3 100644 --- a/src/gcore/types/cloud/session_persistence.py +++ b/src/gcore/types/cloud/session_persistence.py @@ -16,7 +16,7 @@ class SessionPersistence(BaseModel): """Should be set if app cookie or http cookie is used""" persistence_granularity: Optional[str] = None - """Subnet mask if source_ip is used. For UDP ports only""" + """Subnet mask if `source_ip` is used. For UDP ports only""" persistence_timeout: Optional[int] = None """Session persistence timeout. For UDP ports only""" diff --git a/src/gcore/types/cloud/ssh_key_create_params.py b/src/gcore/types/cloud/ssh_key_create_params.py index 65008f58..df3d979e 100644 --- a/src/gcore/types/cloud/ssh_key_create_params.py +++ b/src/gcore/types/cloud/ssh_key_create_params.py @@ -23,8 +23,8 @@ class SSHKeyCreateParams(TypedDict, total=False): - If you’re uploading your own key, provide the public part here (usually found in a file like `id_ed25519.pub`). - If you want the platform to generate an Ed25519 key pair for you, leave this - field empty — the system will return the private key in the response **once - only**. + field empty — the system will return the private key in the response \\**\\**once + only\\**\\**. """ shared_in_project: bool diff --git a/src/gcore/types/cloud/ssh_key_created.py b/src/gcore/types/cloud/ssh_key_created.py index c334e2ed..de70dd72 100644 --- a/src/gcore/types/cloud/ssh_key_created.py +++ b/src/gcore/types/cloud/ssh_key_created.py @@ -26,14 +26,12 @@ class SSHKeyCreated(BaseModel): """The private part of an SSH key is the confidential portion of the key pair. It should never be shared or exposed. This key is used to prove your identity - when connecting to a server. - - If you omit the `public_key`, the platform will generate a key for you. The - private_key will be returned **once** in the API response. Be sure to save it - securely, as it cannot be retrieved again later. - - Best practice: Save the private key to a secure location on your machine (e.g., - `~/.ssh/id_ed25519`) and set the file permissions to be readable only by you. + when connecting to a server. If you omit the `public_key`, the platform will + generate a key for you. The `private_key` will be returned \\**\\**once\\**\\** in the + API response. Be sure to save it securely, as it cannot be retrieved again + later. Best practice: Save the private key to a secure location on your machine + (e.g., `~/.ssh/id_ed25519`) and set the file permissions to be readable only by + you. """ project_id: int diff --git a/src/gcore/types/cloud/task.py b/src/gcore/types/cloud/task.py index a61ab8a8..80fe515c 100644 --- a/src/gcore/types/cloud/task.py +++ b/src/gcore/types/cloud/task.py @@ -129,7 +129,7 @@ class Task(BaseModel): """If task was acknowledged, this field stores acknowledge timestamp""" acknowledged_by: Optional[int] = None - """If task was acknowledged, this field stores user_id of the person""" + """If task was acknowledged, this field stores `user_id` of the person""" client_id: Optional[int] = None """The client ID""" diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index f0b44a75..70ff58a2 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -15,7 +15,7 @@ class TaskListParams(TypedDict, total=False): from_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """ISO formatted datetime string. - Filter the tasks by creation date greater than or equal to from_timestamp + Filter the tasks by creation date greater than or equal to `from_timestamp` """ is_acknowledged: Optional[bool] @@ -46,7 +46,7 @@ class TaskListParams(TypedDict, total=False): """ sorting: Literal["asc", "desc"] - """(DEPRECATED Use 'order_by' instead) Sorting by creation date. + """(DEPRECATED Use '`order_by`' instead) Sorting by creation date. Oldest first, or most recent first """ @@ -59,52 +59,56 @@ class TaskListParams(TypedDict, total=False): task_type: Optional[str] """ - Filter the tasks by their type one of ['activate_ddos_profile', - 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', - 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', - 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', - 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', - 'create_fip', 'create_gpu_virtual_cluster', 'create_image', - 'create_inference_instance', 'create_inference_instance_key', - 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', - 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', - 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', - 'create_reserved_fixed_ip', 'create_router', 'create_secret', - 'create_servergroup', 'create_sfs', 'create_snapshot', 'create_subnet', - 'create_vm', 'create_volume', 'deactivate_ddos_profile', - 'delete_ai_cluster_gpu', 'delete_caas_container', - 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', - 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', - 'delete_gpu_virtual_server', 'delete_image', 'delete_inference_instance', - 'delete_k8s_cluster_pool_v2', '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', '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', 'replace_lbmetadata', 'resize_k8s_cluster_v2', - 'resize_loadbalancer', 'resize_vm', 'resume_vm', 'revert_volume', - 'soft_reboot_gpu_baremetal_server', 'soft_reboot_gpu_virtual_cluster', - 'soft_reboot_gpu_virtual_server', 'soft_reboot_vm', - 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', - 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', - 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', - 'sync_private_flavors', 'update_ddos_profile', 'update_inference_instance', - 'update_inference_instance_key', 'update_k8s_cluster_v2', 'update_lbmetadata', - 'update_port_allowed_address_pairs', 'update_tags_gpu_virtual_cluster', - 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu', - 'upscale_gpu_virtual_cluster'] + Filter the tasks by their type one of ['`activate_ddos_profile`', + '`attach_bm_to_reserved_fixed_ip`', '`attach_vm_interface`', + '`attach_vm_to_reserved_fixed_ip`', '`attach_volume`', + '`create_ai_cluster_gpu`', '`create_bm`', '`create_caas_container`', + '`create_dbaas_postgres_cluster`', '`create_ddos_profile`', + '`create_faas_function`', '`create_faas_namespace`', '`create_fip`', + '`create_gpu_virtual_cluster`', '`create_image`', '`create_inference_instance`', + '`create_inference_instance_key`', '`create_k8s_cluster_pool_v2`', + '`create_k8s_cluster_v2`', '`create_l7policy`', '`create_l7rule`', + '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', + '`create_lbpool_health_monitor`', '`create_loadbalancer`', '`create_network`', + '`create_reserved_fixed_ip`', '`create_router`', '`create_secret`', + '`create_servergroup`', '`create_sfs`', '`create_snapshot`', '`create_subnet`', + '`create_vm`', '`create_volume`', '`deactivate_ddos_profile`', + '`delete_ai_cluster_gpu`', '`delete_caas_container`', + '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', + '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', + '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', '`delete_image`', + '`delete_inference_instance`', '`delete_k8s_cluster_pool_v2`', + '`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`', + '`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`', + '`replace_lbmetadata`', '`resize_k8s_cluster_v2`', '`resize_loadbalancer`', + '`resize_vm`', '`resume_vm`', '`revert_volume`', + '`soft_reboot_gpu_baremetal_server`', '`soft_reboot_gpu_virtual_cluster`', + '`soft_reboot_gpu_virtual_server`', '`soft_reboot_vm`', + '`start_gpu_baremetal_server`', '`start_gpu_virtual_cluster`', + '`start_gpu_virtual_server`', '`start_vm`', '`stop_gpu_baremetal_server`', + '`stop_gpu_virtual_cluster`', '`stop_gpu_virtual_server`', '`stop_vm`', + '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', + '`update_inference_instance`', '`update_inference_instance_key`', + '`update_k8s_cluster_v2`', '`update_lbmetadata`', + '`update_port_allowed_address_pairs`', '`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")] """ISO formatted datetime string. - Filter the tasks by creation date less than or equal to to_timestamp + Filter the tasks by creation date less than or equal to `to_timestamp` """ diff --git a/src/gcore/types/cloud/users/role_assignment_create_params.py b/src/gcore/types/cloud/users/role_assignment_create_params.py index 684f5c8f..d5b33f73 100644 --- a/src/gcore/types/cloud/users/role_assignment_create_params.py +++ b/src/gcore/types/cloud/users/role_assignment_create_params.py @@ -16,7 +16,7 @@ class RoleAssignmentCreateParams(TypedDict, total=False): """User ID""" client_id: Optional[int] - """Client ID. Required if project_id is specified""" + """Client ID. Required if `project_id` is specified""" project_id: Optional[int] """Project ID""" diff --git a/src/gcore/types/cloud/users/role_assignment_update_params.py b/src/gcore/types/cloud/users/role_assignment_update_params.py index a444f4a2..fb9051cf 100644 --- a/src/gcore/types/cloud/users/role_assignment_update_params.py +++ b/src/gcore/types/cloud/users/role_assignment_update_params.py @@ -16,7 +16,7 @@ class RoleAssignmentUpdateParams(TypedDict, total=False): """User ID""" client_id: Optional[int] - """Client ID. Required if project_id is specified""" + """Client ID. Required if `project_id` is specified""" project_id: Optional[int] """Project ID""" diff --git a/src/gcore/types/cloud/volume_create_params.py b/src/gcore/types/cloud/volume_create_params.py index 464a9318..49b57128 100644 --- a/src/gcore/types/cloud/volume_create_params.py +++ b/src/gcore/types/cloud/volume_create_params.py @@ -37,11 +37,11 @@ class CreateVolumeFromImageSerializer(TypedDict, total=False): attachment_tag: str """Block device attachment tag (not exposed in the user tags). - Only used in conjunction with instance_id_to_attach_to + Only used in conjunction with `instance_id_to_attach_to` """ instance_id_to_attach_to: str - """instance_id to attach newly-created volume to""" + """`instance_id` to attach newly-created volume to""" lifecycle_policy_ids: Iterable[int] """ @@ -86,11 +86,11 @@ class CreateVolumeFromSnapshotSerializer(TypedDict, total=False): attachment_tag: str """Block device attachment tag (not exposed in the user tags). - Only used in conjunction with instance_id_to_attach_to + Only used in conjunction with `instance_id_to_attach_to` """ instance_id_to_attach_to: str - """instance_id to attach newly-created volume to""" + """`instance_id` to attach newly-created volume to""" lifecycle_policy_ids: Iterable[int] """ @@ -141,11 +141,11 @@ class CreateNewVolumeSerializer(TypedDict, total=False): attachment_tag: str """Block device attachment tag (not exposed in the user tags). - Only used in conjunction with instance_id_to_attach_to + Only used in conjunction with `instance_id_to_attach_to` """ instance_id_to_attach_to: str - """instance_id to attach newly-created volume to""" + """`instance_id` to attach newly-created volume to""" lifecycle_policy_ids: Iterable[int] """ diff --git a/src/gcore/types/cloud/volume_list_params.py b/src/gcore/types/cloud/volume_list_params.py index 69520d47..20730cc7 100644 --- a/src/gcore/types/cloud/volume_list_params.py +++ b/src/gcore/types/cloud/volume_list_params.py @@ -35,7 +35,7 @@ class VolumeListParams(TypedDict, total=False): name_part: str """ - Filter volumes by name_part inclusion in volume name.Any substring can be used + Filter volumes by `name_part` inclusion in volume name.Any substring can be used and volumes will be returned with names containing the substring. """ @@ -46,11 +46,11 @@ class VolumeListParams(TypedDict, total=False): """ tag_key: List[str] - """Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2""" + """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str """Optional. - Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": + Filter by tag key-value pairs. curl -G --data-urlencode "`tag_key_value`={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1" """ diff --git a/src/gcore/types/waap/__init__.py b/src/gcore/types/waap/__init__.py index 578e1aab..476d1c3e 100644 --- a/src/gcore/types/waap/__init__.py +++ b/src/gcore/types/waap/__init__.py @@ -2,7 +2,6 @@ from __future__ import annotations -from .waap_api_urls import WaapAPIURLs as WaapAPIURLs from .domain_list_params import DomainListParams as DomainListParams from .waap_domain_status import WaapDomainStatus as WaapDomainStatus from .waap_summary_domain import WaapSummaryDomain as WaapSummaryDomain diff --git a/src/gcore/types/waap/domains/setting_update_params.py b/src/gcore/types/waap/domains/setting_update_params.py index da930b6f..2336f7e1 100644 --- a/src/gcore/types/waap/domains/setting_update_params.py +++ b/src/gcore/types/waap/domains/setting_update_params.py @@ -23,6 +23,13 @@ class API(TypedDict, total=False): If your domain has a common base URL for all API paths, it can be set here """ + is_api: bool + """Indicates if the domain is an API domain. + + All requests to an API domain are treated as API requests. If this is set to + true then the `api_urls` field is ignored. + """ + class DDOS(TypedDict, total=False): burst_threshold: int diff --git a/src/gcore/types/waap/waap_api_urls.py b/src/gcore/types/waap/waap_api_urls.py deleted file mode 100644 index c49abfee..00000000 --- a/src/gcore/types/waap/waap_api_urls.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel - -__all__ = ["WaapAPIURLs"] - - -class WaapAPIURLs(BaseModel): - api_urls: Optional[List[str]] = None - """The API URLs for a domain. - - If your domain has a common base URL for all API paths, it can be set here - """ diff --git a/src/gcore/types/waap/waap_domain_settings.py b/src/gcore/types/waap/waap_domain_settings.py index 7b51d05e..de653cee 100644 --- a/src/gcore/types/waap/waap_domain_settings.py +++ b/src/gcore/types/waap/waap_domain_settings.py @@ -1,14 +1,30 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import List, Optional + from ..._models import BaseModel -from .waap_api_urls import WaapAPIURLs from .waap_domain_ddos_settings import WaapDomainDDOSSettings -__all__ = ["WaapDomainSettings"] +__all__ = ["WaapDomainSettings", "API"] + + +class API(BaseModel): + api_urls: Optional[List[str]] = None + """The API URLs for a domain. + + If your domain has a common base URL for all API paths, it can be set here + """ + + is_api: Optional[bool] = None + """Indicates if the domain is an API domain. + + All requests to an API domain are treated as API requests. If this is set to + true then the `api_urls` field is ignored. + """ class WaapDomainSettings(BaseModel): - api: WaapAPIURLs + api: API """API settings of a domain""" ddos: WaapDomainDDOSSettings diff --git a/tests/api_resources/waap/domains/test_settings.py b/tests/api_resources/waap/domains/test_settings.py index 54b94e62..4bc88a4c 100644 --- a/tests/api_resources/waap/domains/test_settings.py +++ b/tests/api_resources/waap/domains/test_settings.py @@ -28,7 +28,10 @@ def test_method_update(self, client: Gcore) -> None: def test_method_update_with_all_params(self, client: Gcore) -> None: setting = client.waap.domains.settings.update( domain_id=0, - api={"api_urls": ["api/v1/.*", "v2/.*"]}, + api={ + "api_urls": ["api/v1/.*", "v2/.*"], + "is_api": True, + }, ddos={ "burst_threshold": 30, "global_threshold": 250, @@ -106,7 +109,10 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: setting = await async_client.waap.domains.settings.update( domain_id=0, - api={"api_urls": ["api/v1/.*", "v2/.*"]}, + api={ + "api_urls": ["api/v1/.*", "v2/.*"], + "is_api": True, + }, ddos={ "burst_threshold": 30, "global_threshold": 250, From 0f0bfb84bfb653e0d50a8395a79f89520fa4420c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:44:29 +0000 Subject: [PATCH 149/592] feat(waap): add domain custom, firewall and advanced rules; custom page sets, advanced rules and tags --- .stats.yml | 4 +- api.md | 135 +++ src/gcore/resources/waap/__init__.py | 70 ++ src/gcore/resources/waap/advanced_rules.py | 135 +++ src/gcore/resources/waap/custom_page_sets.py | 817 +++++++++++++++ src/gcore/resources/waap/domains/__init__.py | 42 + .../resources/waap/domains/advanced_rules.py | 876 ++++++++++++++++ .../resources/waap/domains/custom_rules.py | 889 ++++++++++++++++ src/gcore/resources/waap/domains/domains.py | 96 ++ .../resources/waap/domains/firewall_rules.py | 884 ++++++++++++++++ src/gcore/resources/waap/organizations.py | 217 ++++ src/gcore/resources/waap/statistics.py | 225 ++++ src/gcore/resources/waap/tags.py | 233 +++++ src/gcore/resources/waap/waap.py | 225 ++++ src/gcore/types/waap/__init__.py | 31 + .../types/waap/advanced_rule_descriptor.py | 49 + .../waap/advanced_rule_descriptor_list.py | 15 + src/gcore/types/waap/block_csrf_page_data.py | 28 + .../types/waap/block_csrf_page_data_param.py | 28 + src/gcore/types/waap/block_page_data.py | 28 + src/gcore/types/waap/block_page_data_param.py | 28 + src/gcore/types/waap/captcha_page_data.py | 31 + .../types/waap/captcha_page_data_param.py | 31 + src/gcore/types/waap/client_info.py | 27 + .../types/waap/cookie_disabled_page_data.py | 18 + .../waap/cookie_disabled_page_data_param.py | 18 + src/gcore/types/waap/custom_page_set.py | 36 + .../waap/custom_page_set_create_params.py | 35 + .../types/waap/custom_page_set_list_params.py | 25 + .../waap/custom_page_set_preview_params.py | 41 + .../waap/custom_page_set_update_params.py | 35 + src/gcore/types/waap/customer_rule_state.py | 7 + src/gcore/types/waap/domains/__init__.py | 14 + src/gcore/types/waap/domains/advanced_rule.py | 83 ++ .../domains/advanced_rule_create_params.py | 80 ++ .../waap/domains/advanced_rule_list_params.py | 58 ++ .../domains/advanced_rule_update_params.py | 83 ++ src/gcore/types/waap/domains/custom_rule.py | 373 +++++++ .../waap/domains/custom_rule_create_params.py | 368 +++++++ .../custom_rule_delete_multiple_params.py | 13 + .../waap/domains/custom_rule_list_params.py | 35 + .../waap/domains/custom_rule_update_params.py | 371 +++++++ src/gcore/types/waap/domains/firewall_rule.py | 78 ++ .../domains/firewall_rule_create_params.py | 75 ++ .../firewall_rule_delete_multiple_params.py | 13 + .../waap/domains/firewall_rule_list_params.py | 33 + .../domains/firewall_rule_update_params.py | 78 ++ src/gcore/types/waap/handshake_page_data.py | 25 + .../types/waap/handshake_page_data_param.py | 25 + .../waap/javascript_disabled_page_data.py | 18 + .../javascript_disabled_page_data_param.py | 18 + src/gcore/types/waap/organization.py | 13 + .../types/waap/organization_list_params.py | 22 + src/gcore/types/waap/preview_custom_page.py | 10 + src/gcore/types/waap/quota_item.py | 13 + src/gcore/types/waap/rule_action_type.py | 7 + .../waap/statistic_get_usage_series_params.py | 25 + src/gcore/types/waap/statistic_item.py | 18 + src/gcore/types/waap/statistics_series.py | 16 + src/gcore/types/waap/tag.py | 16 + src/gcore/types/waap/tag_list_params.py | 28 + src/gcore/types/waap/waap_detailed_domain.py | 13 +- tests/api_resources/test_waap.py | 72 ++ .../waap/domains/test_advanced_rules.py | 575 ++++++++++ .../waap/domains/test_custom_rules.py | 981 ++++++++++++++++++ .../waap/domains/test_firewall_rules.py | 669 ++++++++++++ .../api_resources/waap/test_advanced_rules.py | 72 ++ .../waap/test_custom_page_sets.py | 618 +++++++++++ .../api_resources/waap/test_organizations.py | 93 ++ tests/api_resources/waap/test_statistics.py | 103 ++ tests/api_resources/waap/test_tags.py | 97 ++ 71 files changed, 10649 insertions(+), 12 deletions(-) create mode 100644 src/gcore/resources/waap/advanced_rules.py create mode 100644 src/gcore/resources/waap/custom_page_sets.py create mode 100644 src/gcore/resources/waap/domains/advanced_rules.py create mode 100644 src/gcore/resources/waap/domains/custom_rules.py create mode 100644 src/gcore/resources/waap/domains/firewall_rules.py create mode 100644 src/gcore/resources/waap/organizations.py create mode 100644 src/gcore/resources/waap/statistics.py create mode 100644 src/gcore/resources/waap/tags.py create mode 100644 src/gcore/types/waap/advanced_rule_descriptor.py create mode 100644 src/gcore/types/waap/advanced_rule_descriptor_list.py create mode 100644 src/gcore/types/waap/block_csrf_page_data.py create mode 100644 src/gcore/types/waap/block_csrf_page_data_param.py create mode 100644 src/gcore/types/waap/block_page_data.py create mode 100644 src/gcore/types/waap/block_page_data_param.py create mode 100644 src/gcore/types/waap/captcha_page_data.py create mode 100644 src/gcore/types/waap/captcha_page_data_param.py create mode 100644 src/gcore/types/waap/client_info.py create mode 100644 src/gcore/types/waap/cookie_disabled_page_data.py create mode 100644 src/gcore/types/waap/cookie_disabled_page_data_param.py create mode 100644 src/gcore/types/waap/custom_page_set.py create mode 100644 src/gcore/types/waap/custom_page_set_create_params.py create mode 100644 src/gcore/types/waap/custom_page_set_list_params.py create mode 100644 src/gcore/types/waap/custom_page_set_preview_params.py create mode 100644 src/gcore/types/waap/custom_page_set_update_params.py create mode 100644 src/gcore/types/waap/customer_rule_state.py create mode 100644 src/gcore/types/waap/domains/advanced_rule.py create mode 100644 src/gcore/types/waap/domains/advanced_rule_create_params.py create mode 100644 src/gcore/types/waap/domains/advanced_rule_list_params.py create mode 100644 src/gcore/types/waap/domains/advanced_rule_update_params.py create mode 100644 src/gcore/types/waap/domains/custom_rule.py create mode 100644 src/gcore/types/waap/domains/custom_rule_create_params.py create mode 100644 src/gcore/types/waap/domains/custom_rule_delete_multiple_params.py create mode 100644 src/gcore/types/waap/domains/custom_rule_list_params.py create mode 100644 src/gcore/types/waap/domains/custom_rule_update_params.py create mode 100644 src/gcore/types/waap/domains/firewall_rule.py create mode 100644 src/gcore/types/waap/domains/firewall_rule_create_params.py create mode 100644 src/gcore/types/waap/domains/firewall_rule_delete_multiple_params.py create mode 100644 src/gcore/types/waap/domains/firewall_rule_list_params.py create mode 100644 src/gcore/types/waap/domains/firewall_rule_update_params.py create mode 100644 src/gcore/types/waap/handshake_page_data.py create mode 100644 src/gcore/types/waap/handshake_page_data_param.py create mode 100644 src/gcore/types/waap/javascript_disabled_page_data.py create mode 100644 src/gcore/types/waap/javascript_disabled_page_data_param.py create mode 100644 src/gcore/types/waap/organization.py create mode 100644 src/gcore/types/waap/organization_list_params.py create mode 100644 src/gcore/types/waap/preview_custom_page.py create mode 100644 src/gcore/types/waap/quota_item.py create mode 100644 src/gcore/types/waap/rule_action_type.py create mode 100644 src/gcore/types/waap/statistic_get_usage_series_params.py create mode 100644 src/gcore/types/waap/statistic_item.py create mode 100644 src/gcore/types/waap/statistics_series.py create mode 100644 src/gcore/types/waap/tag.py create mode 100644 src/gcore/types/waap/tag_list_params.py create mode 100644 tests/api_resources/test_waap.py create mode 100644 tests/api_resources/waap/domains/test_advanced_rules.py create mode 100644 tests/api_resources/waap/domains/test_custom_rules.py create mode 100644 tests/api_resources/waap/domains/test_firewall_rules.py create mode 100644 tests/api_resources/waap/test_advanced_rules.py create mode 100644 tests/api_resources/waap/test_custom_page_sets.py create mode 100644 tests/api_resources/waap/test_organizations.py create mode 100644 tests/api_resources/waap/test_statistics.py create mode 100644 tests/api_resources/waap/test_tags.py diff --git a/.stats.yml b/.stats.yml index dbb5cd6e..940d86fa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 234 +configured_endpoints: 265 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-99e3a45411a9fb61f7f7390098f039250b0df0d7f9df0651b83d14ec630f94d0.yml openapi_spec_hash: 8d7f86bf413439fbd7ce9426e6c3a56e -config_hash: 9e69470eccc626746245fe5d2acc685b +config_hash: c5bfaf05e59e681224296d5438e745a4 diff --git a/api.md b/api.md index a97b7d69..980c2dd6 100644 --- a/api.md +++ b/api.md @@ -856,6 +856,10 @@ Types: ```python from gcore.types.waap import ( + ClientInfo, + CustomerRuleState, + QuotaItem, + RuleActionType, WaapDetailedDomain, WaapDomainDDOSSettings, WaapDomainSettings, @@ -864,6 +868,22 @@ from gcore.types.waap import ( ) ``` +Methods: + +- client.waap.get_account_overview() -> ClientInfo + +## Statistics + +Types: + +```python +from gcore.types.waap import StatisticItem, StatisticsSeries +``` + +Methods: + +- client.waap.statistics.get_usage_series(\*\*params) -> StatisticsSeries + ## Domains Methods: @@ -879,3 +899,118 @@ Methods: - client.waap.domains.settings.update(domain_id, \*\*params) -> None - client.waap.domains.settings.get(domain_id) -> WaapDomainSettings + +### CustomRules + +Types: + +```python +from gcore.types.waap.domains import CustomRule +``` + +Methods: + +- client.waap.domains.custom_rules.create(domain_id, \*\*params) -> CustomRule +- client.waap.domains.custom_rules.update(rule_id, \*, domain_id, \*\*params) -> None +- client.waap.domains.custom_rules.list(domain_id, \*\*params) -> SyncOffsetPage[CustomRule] +- client.waap.domains.custom_rules.delete(rule_id, \*, domain_id) -> None +- client.waap.domains.custom_rules.delete_multiple(domain_id, \*\*params) -> None +- client.waap.domains.custom_rules.get(rule_id, \*, domain_id) -> CustomRule +- client.waap.domains.custom_rules.toggle(action, \*, domain_id, rule_id) -> None + +### FirewallRules + +Types: + +```python +from gcore.types.waap.domains import FirewallRule +``` + +Methods: + +- client.waap.domains.firewall_rules.create(domain_id, \*\*params) -> FirewallRule +- client.waap.domains.firewall_rules.update(rule_id, \*, domain_id, \*\*params) -> None +- client.waap.domains.firewall_rules.list(domain_id, \*\*params) -> SyncOffsetPage[FirewallRule] +- client.waap.domains.firewall_rules.delete(rule_id, \*, domain_id) -> None +- client.waap.domains.firewall_rules.delete_multiple(domain_id, \*\*params) -> None +- client.waap.domains.firewall_rules.get(rule_id, \*, domain_id) -> FirewallRule +- client.waap.domains.firewall_rules.toggle(action, \*, domain_id, rule_id) -> None + +### AdvancedRules + +Types: + +```python +from gcore.types.waap.domains import AdvancedRule +``` + +Methods: + +- client.waap.domains.advanced_rules.create(domain_id, \*\*params) -> AdvancedRule +- client.waap.domains.advanced_rules.update(rule_id, \*, domain_id, \*\*params) -> None +- client.waap.domains.advanced_rules.list(domain_id, \*\*params) -> SyncOffsetPage[AdvancedRule] +- client.waap.domains.advanced_rules.delete(rule_id, \*, domain_id) -> None +- client.waap.domains.advanced_rules.get(rule_id, \*, domain_id) -> AdvancedRule +- client.waap.domains.advanced_rules.toggle(action, \*, domain_id, rule_id) -> None + +## CustomPageSets + +Types: + +```python +from gcore.types.waap import ( + BlockCsrfPageData, + BlockPageData, + CaptchaPageData, + CookieDisabledPageData, + CustomPageSet, + HandshakePageData, + JavascriptDisabledPageData, + PreviewCustomPage, +) +``` + +Methods: + +- client.waap.custom_page_sets.create(\*\*params) -> CustomPageSet +- client.waap.custom_page_sets.update(set_id, \*\*params) -> None +- client.waap.custom_page_sets.list(\*\*params) -> SyncOffsetPage[CustomPageSet] +- client.waap.custom_page_sets.delete(set_id) -> None +- client.waap.custom_page_sets.get(set_id) -> CustomPageSet +- client.waap.custom_page_sets.preview(\*\*params) -> PreviewCustomPage + +## AdvancedRules + +Types: + +```python +from gcore.types.waap import AdvancedRuleDescriptor, AdvancedRuleDescriptorList +``` + +Methods: + +- client.waap.advanced_rules.list() -> AdvancedRuleDescriptorList + +## Tags + +Types: + +```python +from gcore.types.waap import Tag +``` + +Methods: + +- client.waap.tags.list(\*\*params) -> SyncOffsetPage[Tag] + +## Organizations + +Types: + +```python +from gcore.types.waap import Organization +``` + +Methods: + +- client.waap.organizations.list(\*\*params) -> SyncOffsetPage[Organization] diff --git a/src/gcore/resources/waap/__init__.py b/src/gcore/resources/waap/__init__.py index e4b6cbc9..ed8d2061 100644 --- a/src/gcore/resources/waap/__init__.py +++ b/src/gcore/resources/waap/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .tags import ( + TagsResource, + AsyncTagsResource, + TagsResourceWithRawResponse, + AsyncTagsResourceWithRawResponse, + TagsResourceWithStreamingResponse, + AsyncTagsResourceWithStreamingResponse, +) from .waap import ( WaapResource, AsyncWaapResource, @@ -16,14 +24,76 @@ DomainsResourceWithStreamingResponse, AsyncDomainsResourceWithStreamingResponse, ) +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) +from .organizations import ( + OrganizationsResource, + AsyncOrganizationsResource, + OrganizationsResourceWithRawResponse, + AsyncOrganizationsResourceWithRawResponse, + OrganizationsResourceWithStreamingResponse, + AsyncOrganizationsResourceWithStreamingResponse, +) +from .advanced_rules import ( + AdvancedRulesResource, + AsyncAdvancedRulesResource, + AdvancedRulesResourceWithRawResponse, + AsyncAdvancedRulesResourceWithRawResponse, + AdvancedRulesResourceWithStreamingResponse, + AsyncAdvancedRulesResourceWithStreamingResponse, +) +from .custom_page_sets import ( + CustomPageSetsResource, + AsyncCustomPageSetsResource, + CustomPageSetsResourceWithRawResponse, + AsyncCustomPageSetsResourceWithRawResponse, + CustomPageSetsResourceWithStreamingResponse, + AsyncCustomPageSetsResourceWithStreamingResponse, +) __all__ = [ + "StatisticsResource", + "AsyncStatisticsResource", + "StatisticsResourceWithRawResponse", + "AsyncStatisticsResourceWithRawResponse", + "StatisticsResourceWithStreamingResponse", + "AsyncStatisticsResourceWithStreamingResponse", "DomainsResource", "AsyncDomainsResource", "DomainsResourceWithRawResponse", "AsyncDomainsResourceWithRawResponse", "DomainsResourceWithStreamingResponse", "AsyncDomainsResourceWithStreamingResponse", + "CustomPageSetsResource", + "AsyncCustomPageSetsResource", + "CustomPageSetsResourceWithRawResponse", + "AsyncCustomPageSetsResourceWithRawResponse", + "CustomPageSetsResourceWithStreamingResponse", + "AsyncCustomPageSetsResourceWithStreamingResponse", + "AdvancedRulesResource", + "AsyncAdvancedRulesResource", + "AdvancedRulesResourceWithRawResponse", + "AsyncAdvancedRulesResourceWithRawResponse", + "AdvancedRulesResourceWithStreamingResponse", + "AsyncAdvancedRulesResourceWithStreamingResponse", + "TagsResource", + "AsyncTagsResource", + "TagsResourceWithRawResponse", + "AsyncTagsResourceWithRawResponse", + "TagsResourceWithStreamingResponse", + "AsyncTagsResourceWithStreamingResponse", + "OrganizationsResource", + "AsyncOrganizationsResource", + "OrganizationsResourceWithRawResponse", + "AsyncOrganizationsResourceWithRawResponse", + "OrganizationsResourceWithStreamingResponse", + "AsyncOrganizationsResourceWithStreamingResponse", "WaapResource", "AsyncWaapResource", "WaapResourceWithRawResponse", diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py new file mode 100644 index 00000000..c9417f26 --- /dev/null +++ b/src/gcore/resources/waap/advanced_rules.py @@ -0,0 +1,135 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.waap.advanced_rule_descriptor_list import AdvancedRuleDescriptorList + +__all__ = ["AdvancedRulesResource", "AsyncAdvancedRulesResource"] + + +class AdvancedRulesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AdvancedRulesResourceWithRawResponse: + """ + 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 AdvancedRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AdvancedRulesResourceWithStreamingResponse: + """ + 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 AdvancedRulesResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AdvancedRuleDescriptorList: + """Retrieve an advanced rules descriptor""" + return self._get( + "/waap/v1/advanced-rules/descriptor", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AdvancedRuleDescriptorList, + ) + + +class AsyncAdvancedRulesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAdvancedRulesResourceWithRawResponse: + """ + 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 AsyncAdvancedRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAdvancedRulesResourceWithStreamingResponse: + """ + 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 AsyncAdvancedRulesResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AdvancedRuleDescriptorList: + """Retrieve an advanced rules descriptor""" + return await self._get( + "/waap/v1/advanced-rules/descriptor", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AdvancedRuleDescriptorList, + ) + + +class AdvancedRulesResourceWithRawResponse: + def __init__(self, advanced_rules: AdvancedRulesResource) -> None: + self._advanced_rules = advanced_rules + + self.list = to_raw_response_wrapper( + advanced_rules.list, + ) + + +class AsyncAdvancedRulesResourceWithRawResponse: + def __init__(self, advanced_rules: AsyncAdvancedRulesResource) -> None: + self._advanced_rules = advanced_rules + + self.list = async_to_raw_response_wrapper( + advanced_rules.list, + ) + + +class AdvancedRulesResourceWithStreamingResponse: + def __init__(self, advanced_rules: AdvancedRulesResource) -> None: + self._advanced_rules = advanced_rules + + self.list = to_streamed_response_wrapper( + advanced_rules.list, + ) + + +class AsyncAdvancedRulesResourceWithStreamingResponse: + def __init__(self, advanced_rules: AsyncAdvancedRulesResource) -> None: + self._advanced_rules = advanced_rules + + self.list = async_to_streamed_response_wrapper( + advanced_rules.list, + ) diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py new file mode 100644 index 00000000..1e5e0293 --- /dev/null +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -0,0 +1,817 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ...pagination import SyncOffsetPage, AsyncOffsetPage +from ...types.waap import ( + custom_page_set_list_params, + custom_page_set_create_params, + custom_page_set_update_params, + custom_page_set_preview_params, +) +from ..._base_client import AsyncPaginator, make_request_options +from ...types.waap.custom_page_set import CustomPageSet +from ...types.waap.preview_custom_page import PreviewCustomPage +from ...types.waap.block_page_data_param import BlockPageDataParam +from ...types.waap.captcha_page_data_param import CaptchaPageDataParam +from ...types.waap.handshake_page_data_param import HandshakePageDataParam +from ...types.waap.block_csrf_page_data_param import BlockCsrfPageDataParam +from ...types.waap.cookie_disabled_page_data_param import CookieDisabledPageDataParam +from ...types.waap.javascript_disabled_page_data_param import JavascriptDisabledPageDataParam + +__all__ = ["CustomPageSetsResource", "AsyncCustomPageSetsResource"] + + +class CustomPageSetsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CustomPageSetsResourceWithRawResponse: + """ + 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 CustomPageSetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CustomPageSetsResourceWithStreamingResponse: + """ + 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 CustomPageSetsResourceWithStreamingResponse(self) + + def create( + self, + *, + name: str, + block: Optional[BlockPageDataParam] | NotGiven = NOT_GIVEN, + block_csrf: Optional[BlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, + captcha: Optional[CaptchaPageDataParam] | NotGiven = NOT_GIVEN, + cookie_disabled: Optional[CookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, + domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, + handshake: Optional[HandshakePageDataParam] | NotGiven = NOT_GIVEN, + javascript_disabled: Optional[JavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CustomPageSet: + """Create a custom page set based on the provided data. + + For any custom page type + (block, `block_csrf`, etc) that is not provided the default page will be used. + + Args: + name: Name of the custom page set + + domains: List of domain IDs that are associated with this page set + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/waap/v1/custom-page-sets", + body=maybe_transform( + { + "name": name, + "block": block, + "block_csrf": block_csrf, + "captcha": captcha, + "cookie_disabled": cookie_disabled, + "domains": domains, + "handshake": handshake, + "javascript_disabled": javascript_disabled, + }, + custom_page_set_create_params.CustomPageSetCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomPageSet, + ) + + def update( + self, + set_id: int, + *, + block: Optional[BlockPageDataParam] | NotGiven = NOT_GIVEN, + block_csrf: Optional[BlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, + captcha: Optional[CaptchaPageDataParam] | NotGiven = NOT_GIVEN, + cookie_disabled: Optional[CookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, + domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, + handshake: Optional[HandshakePageDataParam] | NotGiven = NOT_GIVEN, + javascript_disabled: Optional[JavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Update a custom page set based on the provided parameters. + + To update a field, + provide the field with the new value. To remove a field, provide it as null. To + keep a field unaltered, do not include it in the request. Note: `name` cannot be + removed. When updating a custom page, include all the fields that you want it to + have. Any field not included will be removed. + + Args: + set_id: The ID of the custom page set + + domains: List of domain IDs that are associated with this page set + + name: Name of the custom page set + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._patch( + f"/waap/v1/custom-page-sets/{set_id}", + body=maybe_transform( + { + "block": block, + "block_csrf": block_csrf, + "captcha": captcha, + "cookie_disabled": cookie_disabled, + "domains": domains, + "handshake": handshake, + "javascript_disabled": javascript_disabled, + "name": name, + }, + custom_page_set_update_params.CustomPageSetUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + *, + ids: Iterable[int] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal["name", "-name", "id", "-id"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[CustomPageSet]: + """ + Retrieve a list of custom page sets available for use + + Args: + ids: Filter page sets based on their IDs + + limit: Number of items to return + + name: Filter page sets based on their name. Supports '\\**' as a wildcard character + + offset: Number of items to skip + + ordering: Sort the response by given field. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/waap/v1/custom-page-sets", + page=SyncOffsetPage[CustomPageSet], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "ids": ids, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + }, + custom_page_set_list_params.CustomPageSetListParams, + ), + ), + model=CustomPageSet, + ) + + def delete( + self, + set_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a custom page set + + Args: + set_id: The ID of the custom page set + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/waap/v1/custom-page-sets/{set_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + set_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, + ) -> CustomPageSet: + """ + Retrieve a custom page set based on the provided ID + + Args: + set_id: The ID of the custom page set + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/waap/v1/custom-page-sets/{set_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomPageSet, + ) + + def preview( + self, + *, + page_type: Literal[ + "block.html", + "block_csrf.html", + "captcha.html", + "cookieDisabled.html", + "handshake.html", + "javascriptDisabled.html", + ], + error: Optional[str] | NotGiven = NOT_GIVEN, + header: Optional[str] | NotGiven = NOT_GIVEN, + logo: Optional[str] | NotGiven = NOT_GIVEN, + text: Optional[str] | NotGiven = NOT_GIVEN, + title: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PreviewCustomPage: + """ + Allows to preview a custom page without creating it based on the provided type + and data + + Args: + page_type: The type of the custom page + + error: Error message + + header: The text to display in the header of the custom page + + logo: Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + + text: The text to display in the body of the custom page + + title: The text to display in the title of the custom page + + 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( + "/waap/v1/preview-custom-page", + body=maybe_transform( + { + "error": error, + "header": header, + "logo": logo, + "text": text, + "title": title, + }, + custom_page_set_preview_params.CustomPageSetPreviewParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"page_type": page_type}, custom_page_set_preview_params.CustomPageSetPreviewParams + ), + ), + cast_to=PreviewCustomPage, + ) + + +class AsyncCustomPageSetsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCustomPageSetsResourceWithRawResponse: + """ + 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 AsyncCustomPageSetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCustomPageSetsResourceWithStreamingResponse: + """ + 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 AsyncCustomPageSetsResourceWithStreamingResponse(self) + + async def create( + self, + *, + name: str, + block: Optional[BlockPageDataParam] | NotGiven = NOT_GIVEN, + block_csrf: Optional[BlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, + captcha: Optional[CaptchaPageDataParam] | NotGiven = NOT_GIVEN, + cookie_disabled: Optional[CookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, + domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, + handshake: Optional[HandshakePageDataParam] | NotGiven = NOT_GIVEN, + javascript_disabled: Optional[JavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CustomPageSet: + """Create a custom page set based on the provided data. + + For any custom page type + (block, `block_csrf`, etc) that is not provided the default page will be used. + + Args: + name: Name of the custom page set + + domains: List of domain IDs that are associated with this page set + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/waap/v1/custom-page-sets", + body=await async_maybe_transform( + { + "name": name, + "block": block, + "block_csrf": block_csrf, + "captcha": captcha, + "cookie_disabled": cookie_disabled, + "domains": domains, + "handshake": handshake, + "javascript_disabled": javascript_disabled, + }, + custom_page_set_create_params.CustomPageSetCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomPageSet, + ) + + async def update( + self, + set_id: int, + *, + block: Optional[BlockPageDataParam] | NotGiven = NOT_GIVEN, + block_csrf: Optional[BlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, + captcha: Optional[CaptchaPageDataParam] | NotGiven = NOT_GIVEN, + cookie_disabled: Optional[CookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, + domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, + handshake: Optional[HandshakePageDataParam] | NotGiven = NOT_GIVEN, + javascript_disabled: Optional[JavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Update a custom page set based on the provided parameters. + + To update a field, + provide the field with the new value. To remove a field, provide it as null. To + keep a field unaltered, do not include it in the request. Note: `name` cannot be + removed. When updating a custom page, include all the fields that you want it to + have. Any field not included will be removed. + + Args: + set_id: The ID of the custom page set + + domains: List of domain IDs that are associated with this page set + + name: Name of the custom page set + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._patch( + f"/waap/v1/custom-page-sets/{set_id}", + body=await async_maybe_transform( + { + "block": block, + "block_csrf": block_csrf, + "captcha": captcha, + "cookie_disabled": cookie_disabled, + "domains": domains, + "handshake": handshake, + "javascript_disabled": javascript_disabled, + "name": name, + }, + custom_page_set_update_params.CustomPageSetUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + *, + ids: Iterable[int] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal["name", "-name", "id", "-id"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[CustomPageSet, AsyncOffsetPage[CustomPageSet]]: + """ + Retrieve a list of custom page sets available for use + + Args: + ids: Filter page sets based on their IDs + + limit: Number of items to return + + name: Filter page sets based on their name. Supports '\\**' as a wildcard character + + offset: Number of items to skip + + ordering: Sort the response by given field. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/waap/v1/custom-page-sets", + page=AsyncOffsetPage[CustomPageSet], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "ids": ids, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + }, + custom_page_set_list_params.CustomPageSetListParams, + ), + ), + model=CustomPageSet, + ) + + async def delete( + self, + set_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a custom page set + + Args: + set_id: The ID of the custom page set + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/waap/v1/custom-page-sets/{set_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + set_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, + ) -> CustomPageSet: + """ + Retrieve a custom page set based on the provided ID + + Args: + set_id: The ID of the custom page set + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/waap/v1/custom-page-sets/{set_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomPageSet, + ) + + async def preview( + self, + *, + page_type: Literal[ + "block.html", + "block_csrf.html", + "captcha.html", + "cookieDisabled.html", + "handshake.html", + "javascriptDisabled.html", + ], + error: Optional[str] | NotGiven = NOT_GIVEN, + header: Optional[str] | NotGiven = NOT_GIVEN, + logo: Optional[str] | NotGiven = NOT_GIVEN, + text: Optional[str] | NotGiven = NOT_GIVEN, + title: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PreviewCustomPage: + """ + Allows to preview a custom page without creating it based on the provided type + and data + + Args: + page_type: The type of the custom page + + error: Error message + + header: The text to display in the header of the custom page + + logo: Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + + text: The text to display in the body of the custom page + + title: The text to display in the title of the custom page + + 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( + "/waap/v1/preview-custom-page", + body=await async_maybe_transform( + { + "error": error, + "header": header, + "logo": logo, + "text": text, + "title": title, + }, + custom_page_set_preview_params.CustomPageSetPreviewParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"page_type": page_type}, custom_page_set_preview_params.CustomPageSetPreviewParams + ), + ), + cast_to=PreviewCustomPage, + ) + + +class CustomPageSetsResourceWithRawResponse: + def __init__(self, custom_page_sets: CustomPageSetsResource) -> None: + self._custom_page_sets = custom_page_sets + + self.create = to_raw_response_wrapper( + custom_page_sets.create, + ) + self.update = to_raw_response_wrapper( + custom_page_sets.update, + ) + self.list = to_raw_response_wrapper( + custom_page_sets.list, + ) + self.delete = to_raw_response_wrapper( + custom_page_sets.delete, + ) + self.get = to_raw_response_wrapper( + custom_page_sets.get, + ) + self.preview = to_raw_response_wrapper( + custom_page_sets.preview, + ) + + +class AsyncCustomPageSetsResourceWithRawResponse: + def __init__(self, custom_page_sets: AsyncCustomPageSetsResource) -> None: + self._custom_page_sets = custom_page_sets + + self.create = async_to_raw_response_wrapper( + custom_page_sets.create, + ) + self.update = async_to_raw_response_wrapper( + custom_page_sets.update, + ) + self.list = async_to_raw_response_wrapper( + custom_page_sets.list, + ) + self.delete = async_to_raw_response_wrapper( + custom_page_sets.delete, + ) + self.get = async_to_raw_response_wrapper( + custom_page_sets.get, + ) + self.preview = async_to_raw_response_wrapper( + custom_page_sets.preview, + ) + + +class CustomPageSetsResourceWithStreamingResponse: + def __init__(self, custom_page_sets: CustomPageSetsResource) -> None: + self._custom_page_sets = custom_page_sets + + self.create = to_streamed_response_wrapper( + custom_page_sets.create, + ) + self.update = to_streamed_response_wrapper( + custom_page_sets.update, + ) + self.list = to_streamed_response_wrapper( + custom_page_sets.list, + ) + self.delete = to_streamed_response_wrapper( + custom_page_sets.delete, + ) + self.get = to_streamed_response_wrapper( + custom_page_sets.get, + ) + self.preview = to_streamed_response_wrapper( + custom_page_sets.preview, + ) + + +class AsyncCustomPageSetsResourceWithStreamingResponse: + def __init__(self, custom_page_sets: AsyncCustomPageSetsResource) -> None: + self._custom_page_sets = custom_page_sets + + self.create = async_to_streamed_response_wrapper( + custom_page_sets.create, + ) + self.update = async_to_streamed_response_wrapper( + custom_page_sets.update, + ) + self.list = async_to_streamed_response_wrapper( + custom_page_sets.list, + ) + self.delete = async_to_streamed_response_wrapper( + custom_page_sets.delete, + ) + self.get = async_to_streamed_response_wrapper( + custom_page_sets.get, + ) + self.preview = async_to_streamed_response_wrapper( + custom_page_sets.preview, + ) diff --git a/src/gcore/resources/waap/domains/__init__.py b/src/gcore/resources/waap/domains/__init__.py index 7af30ff1..67aa274d 100644 --- a/src/gcore/resources/waap/domains/__init__.py +++ b/src/gcore/resources/waap/domains/__init__.py @@ -16,6 +16,30 @@ SettingsResourceWithStreamingResponse, AsyncSettingsResourceWithStreamingResponse, ) +from .custom_rules import ( + CustomRulesResource, + AsyncCustomRulesResource, + CustomRulesResourceWithRawResponse, + AsyncCustomRulesResourceWithRawResponse, + CustomRulesResourceWithStreamingResponse, + AsyncCustomRulesResourceWithStreamingResponse, +) +from .advanced_rules import ( + AdvancedRulesResource, + AsyncAdvancedRulesResource, + AdvancedRulesResourceWithRawResponse, + AsyncAdvancedRulesResourceWithRawResponse, + AdvancedRulesResourceWithStreamingResponse, + AsyncAdvancedRulesResourceWithStreamingResponse, +) +from .firewall_rules import ( + FirewallRulesResource, + AsyncFirewallRulesResource, + FirewallRulesResourceWithRawResponse, + AsyncFirewallRulesResourceWithRawResponse, + FirewallRulesResourceWithStreamingResponse, + AsyncFirewallRulesResourceWithStreamingResponse, +) __all__ = [ "SettingsResource", @@ -24,6 +48,24 @@ "AsyncSettingsResourceWithRawResponse", "SettingsResourceWithStreamingResponse", "AsyncSettingsResourceWithStreamingResponse", + "CustomRulesResource", + "AsyncCustomRulesResource", + "CustomRulesResourceWithRawResponse", + "AsyncCustomRulesResourceWithRawResponse", + "CustomRulesResourceWithStreamingResponse", + "AsyncCustomRulesResourceWithStreamingResponse", + "FirewallRulesResource", + "AsyncFirewallRulesResource", + "FirewallRulesResourceWithRawResponse", + "AsyncFirewallRulesResourceWithRawResponse", + "FirewallRulesResourceWithStreamingResponse", + "AsyncFirewallRulesResourceWithStreamingResponse", + "AdvancedRulesResource", + "AsyncAdvancedRulesResource", + "AdvancedRulesResourceWithRawResponse", + "AsyncAdvancedRulesResourceWithRawResponse", + "AdvancedRulesResourceWithStreamingResponse", + "AsyncAdvancedRulesResourceWithStreamingResponse", "DomainsResource", "AsyncDomainsResource", "DomainsResourceWithRawResponse", diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py new file mode 100644 index 00000000..bc116dc2 --- /dev/null +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -0,0 +1,876 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.waap import RuleActionType, CustomerRuleState +from ...._base_client import AsyncPaginator, make_request_options +from ....types.waap.domains import advanced_rule_list_params, advanced_rule_create_params, advanced_rule_update_params +from ....types.waap.rule_action_type import RuleActionType +from ....types.waap.customer_rule_state import CustomerRuleState +from ....types.waap.domains.advanced_rule import AdvancedRule + +__all__ = ["AdvancedRulesResource", "AsyncAdvancedRulesResource"] + + +class AdvancedRulesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AdvancedRulesResourceWithRawResponse: + """ + 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 AdvancedRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AdvancedRulesResourceWithStreamingResponse: + """ + 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 AdvancedRulesResourceWithStreamingResponse(self) + + def create( + self, + domain_id: int, + *, + action: advanced_rule_create_params.Action, + enabled: bool, + name: str, + source: str, + description: Optional[str] | NotGiven = NOT_GIVEN, + phase: Optional[Literal["access", "header_filter", "body_filter"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AdvancedRule: + """ + Create an advanced rule + + Args: + domain_id: The domain ID + + action: The action that a WAAP rule takes when triggered + + enabled: Whether or not the rule is enabled + + name: The name assigned to the rule + + source: A CEL syntax expression that contains the rule's conditions. Allowed objects + are: request, whois, session, response, tags, `user_defined_tags`, `user_agent`, + `client_data`. More info can be found here: + https://gcore.com/docs/waap/waap-rules/advanced-rules + + description: The description assigned to the rule + + phase: The WAAP request/response phase for applying the rule. Default is "access". The + "access" phase is responsible for modifying the request before it is sent to the + origin server. The "`header_filter`" phase is responsible for modifying the HTTP + headers of a response before they are sent back to the client. The + "`body_filter`" phase is responsible for modifying the body of a response before + it is sent back to the client. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/waap/v1/domains/{domain_id}/advanced-rules", + body=maybe_transform( + { + "action": action, + "enabled": enabled, + "name": name, + "source": source, + "description": description, + "phase": phase, + }, + advanced_rule_create_params.AdvancedRuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AdvancedRule, + ) + + def update( + self, + rule_id: int, + *, + domain_id: int, + action: Optional[advanced_rule_update_params.Action] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + enabled: Optional[bool] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + phase: Optional[Literal["access", "header_filter", "body_filter"]] | NotGiven = NOT_GIVEN, + source: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Only properties present in the request will be updated + + Args: + domain_id: The domain ID + + rule_id: The advanced rule ID + + action: The action that a WAAP rule takes when triggered + + description: The description assigned to the rule + + enabled: Whether or not the rule is enabled + + name: The name assigned to the rule + + phase: The WAAP request/response phase for applying the rule. The "access" phase is + responsible for modifying the request before it is sent to the origin server. + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. The "`body_filter`" phase is + responsible for modifying the body of a response before it is sent back to the + client. + + source: A CEL syntax expression that contains the rule's conditions. Allowed objects + are: request, whois, session, response, tags, `user_defined_tags`, `user_agent`, + `client_data`. More info can be found here: + https://gcore.com/docs/waap/waap-rules/advanced-rules + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._patch( + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + body=maybe_transform( + { + "action": action, + "description": description, + "enabled": enabled, + "name": name, + "phase": phase, + "source": source, + }, + advanced_rule_update_params.AdvancedRuleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + domain_id: int, + *, + action: RuleActionType | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Optional[ + Literal[ + "id", + "name", + "description", + "enabled", + "action", + "phase", + "-id", + "-name", + "-description", + "-enabled", + "-action", + "-phase", + ] + ] + | NotGiven = NOT_GIVEN, + phase: Literal["access", "header_filter", "body_filter"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[AdvancedRule]: + """ + Retrieve a list of advanced rules assigned to a domain, offering filter, + ordering, and pagination capabilities + + Args: + domain_id: The domain ID + + action: Filter to refine results by specific actions + + description: Filter rules based on their description. Supports '\\**' as a wildcard character. + + enabled: Filter rules based on their active status + + limit: Number of items to return + + name: Filter rules based on their name. Supports '\\**' as a wildcard character. + + offset: Number of items to skip + + ordering: Determine the field to order results by + + phase: Filter rules based on the WAAP request/response phase for applying the rule. The + "access" phase is responsible for modifying the request before it is sent to the + origin server. The "`header_filter`" phase is responsible for modifying the HTTP + headers of a response before they are sent back to the client. The + "`body_filter`" phase is responsible for modifying the body of a response before + it is sent back to the client. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/advanced-rules", + page=SyncOffsetPage[AdvancedRule], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "action": action, + "description": description, + "enabled": enabled, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + "phase": phase, + }, + advanced_rule_list_params.AdvancedRuleListParams, + ), + ), + model=AdvancedRule, + ) + + def delete( + self, + rule_id: int, + *, + domain_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete an advanced rule + + Args: + domain_id: The domain ID + + rule_id: The advanced rule ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + rule_id: int, + *, + domain_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, + ) -> AdvancedRule: + """ + Retrieve a specific advanced rule assigned to a domain + + Args: + domain_id: The domain ID + + rule_id: The advanced rule ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AdvancedRule, + ) + + def toggle( + self, + action: CustomerRuleState, + *, + domain_id: int, + rule_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Toggle an advanced rule + + Args: + domain_id: The domain ID + + rule_id: The advanced rule ID + + action: Enable or disable an advanced rule + + 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 action: + raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._patch( + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncAdvancedRulesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAdvancedRulesResourceWithRawResponse: + """ + 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 AsyncAdvancedRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAdvancedRulesResourceWithStreamingResponse: + """ + 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 AsyncAdvancedRulesResourceWithStreamingResponse(self) + + async def create( + self, + domain_id: int, + *, + action: advanced_rule_create_params.Action, + enabled: bool, + name: str, + source: str, + description: Optional[str] | NotGiven = NOT_GIVEN, + phase: Optional[Literal["access", "header_filter", "body_filter"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AdvancedRule: + """ + Create an advanced rule + + Args: + domain_id: The domain ID + + action: The action that a WAAP rule takes when triggered + + enabled: Whether or not the rule is enabled + + name: The name assigned to the rule + + source: A CEL syntax expression that contains the rule's conditions. Allowed objects + are: request, whois, session, response, tags, `user_defined_tags`, `user_agent`, + `client_data`. More info can be found here: + https://gcore.com/docs/waap/waap-rules/advanced-rules + + description: The description assigned to the rule + + phase: The WAAP request/response phase for applying the rule. Default is "access". The + "access" phase is responsible for modifying the request before it is sent to the + origin server. The "`header_filter`" phase is responsible for modifying the HTTP + headers of a response before they are sent back to the client. The + "`body_filter`" phase is responsible for modifying the body of a response before + it is sent back to the client. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/waap/v1/domains/{domain_id}/advanced-rules", + body=await async_maybe_transform( + { + "action": action, + "enabled": enabled, + "name": name, + "source": source, + "description": description, + "phase": phase, + }, + advanced_rule_create_params.AdvancedRuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AdvancedRule, + ) + + async def update( + self, + rule_id: int, + *, + domain_id: int, + action: Optional[advanced_rule_update_params.Action] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + enabled: Optional[bool] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + phase: Optional[Literal["access", "header_filter", "body_filter"]] | NotGiven = NOT_GIVEN, + source: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Only properties present in the request will be updated + + Args: + domain_id: The domain ID + + rule_id: The advanced rule ID + + action: The action that a WAAP rule takes when triggered + + description: The description assigned to the rule + + enabled: Whether or not the rule is enabled + + name: The name assigned to the rule + + phase: The WAAP request/response phase for applying the rule. The "access" phase is + responsible for modifying the request before it is sent to the origin server. + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. The "`body_filter`" phase is + responsible for modifying the body of a response before it is sent back to the + client. + + source: A CEL syntax expression that contains the rule's conditions. Allowed objects + are: request, whois, session, response, tags, `user_defined_tags`, `user_agent`, + `client_data`. More info can be found here: + https://gcore.com/docs/waap/waap-rules/advanced-rules + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._patch( + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + body=await async_maybe_transform( + { + "action": action, + "description": description, + "enabled": enabled, + "name": name, + "phase": phase, + "source": source, + }, + advanced_rule_update_params.AdvancedRuleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + domain_id: int, + *, + action: RuleActionType | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Optional[ + Literal[ + "id", + "name", + "description", + "enabled", + "action", + "phase", + "-id", + "-name", + "-description", + "-enabled", + "-action", + "-phase", + ] + ] + | NotGiven = NOT_GIVEN, + phase: Literal["access", "header_filter", "body_filter"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[AdvancedRule, AsyncOffsetPage[AdvancedRule]]: + """ + Retrieve a list of advanced rules assigned to a domain, offering filter, + ordering, and pagination capabilities + + Args: + domain_id: The domain ID + + action: Filter to refine results by specific actions + + description: Filter rules based on their description. Supports '\\**' as a wildcard character. + + enabled: Filter rules based on their active status + + limit: Number of items to return + + name: Filter rules based on their name. Supports '\\**' as a wildcard character. + + offset: Number of items to skip + + ordering: Determine the field to order results by + + phase: Filter rules based on the WAAP request/response phase for applying the rule. The + "access" phase is responsible for modifying the request before it is sent to the + origin server. The "`header_filter`" phase is responsible for modifying the HTTP + headers of a response before they are sent back to the client. The + "`body_filter`" phase is responsible for modifying the body of a response before + it is sent back to the client. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/advanced-rules", + page=AsyncOffsetPage[AdvancedRule], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "action": action, + "description": description, + "enabled": enabled, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + "phase": phase, + }, + advanced_rule_list_params.AdvancedRuleListParams, + ), + ), + model=AdvancedRule, + ) + + async def delete( + self, + rule_id: int, + *, + domain_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete an advanced rule + + Args: + domain_id: The domain ID + + rule_id: The advanced rule ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + rule_id: int, + *, + domain_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, + ) -> AdvancedRule: + """ + Retrieve a specific advanced rule assigned to a domain + + Args: + domain_id: The domain ID + + rule_id: The advanced rule ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AdvancedRule, + ) + + async def toggle( + self, + action: CustomerRuleState, + *, + domain_id: int, + rule_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Toggle an advanced rule + + Args: + domain_id: The domain ID + + rule_id: The advanced rule ID + + action: Enable or disable an advanced rule + + 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 action: + raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._patch( + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AdvancedRulesResourceWithRawResponse: + def __init__(self, advanced_rules: AdvancedRulesResource) -> None: + self._advanced_rules = advanced_rules + + self.create = to_raw_response_wrapper( + advanced_rules.create, + ) + self.update = to_raw_response_wrapper( + advanced_rules.update, + ) + self.list = to_raw_response_wrapper( + advanced_rules.list, + ) + self.delete = to_raw_response_wrapper( + advanced_rules.delete, + ) + self.get = to_raw_response_wrapper( + advanced_rules.get, + ) + self.toggle = to_raw_response_wrapper( + advanced_rules.toggle, + ) + + +class AsyncAdvancedRulesResourceWithRawResponse: + def __init__(self, advanced_rules: AsyncAdvancedRulesResource) -> None: + self._advanced_rules = advanced_rules + + self.create = async_to_raw_response_wrapper( + advanced_rules.create, + ) + self.update = async_to_raw_response_wrapper( + advanced_rules.update, + ) + self.list = async_to_raw_response_wrapper( + advanced_rules.list, + ) + self.delete = async_to_raw_response_wrapper( + advanced_rules.delete, + ) + self.get = async_to_raw_response_wrapper( + advanced_rules.get, + ) + self.toggle = async_to_raw_response_wrapper( + advanced_rules.toggle, + ) + + +class AdvancedRulesResourceWithStreamingResponse: + def __init__(self, advanced_rules: AdvancedRulesResource) -> None: + self._advanced_rules = advanced_rules + + self.create = to_streamed_response_wrapper( + advanced_rules.create, + ) + self.update = to_streamed_response_wrapper( + advanced_rules.update, + ) + self.list = to_streamed_response_wrapper( + advanced_rules.list, + ) + self.delete = to_streamed_response_wrapper( + advanced_rules.delete, + ) + self.get = to_streamed_response_wrapper( + advanced_rules.get, + ) + self.toggle = to_streamed_response_wrapper( + advanced_rules.toggle, + ) + + +class AsyncAdvancedRulesResourceWithStreamingResponse: + def __init__(self, advanced_rules: AsyncAdvancedRulesResource) -> None: + self._advanced_rules = advanced_rules + + self.create = async_to_streamed_response_wrapper( + advanced_rules.create, + ) + self.update = async_to_streamed_response_wrapper( + advanced_rules.update, + ) + self.list = async_to_streamed_response_wrapper( + advanced_rules.list, + ) + self.delete = async_to_streamed_response_wrapper( + advanced_rules.delete, + ) + self.get = async_to_streamed_response_wrapper( + advanced_rules.get, + ) + self.toggle = async_to_streamed_response_wrapper( + advanced_rules.toggle, + ) diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py new file mode 100644 index 00000000..6cc7ca07 --- /dev/null +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -0,0 +1,889 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.waap import RuleActionType, CustomerRuleState +from ...._base_client import AsyncPaginator, make_request_options +from ....types.waap.domains import ( + custom_rule_list_params, + custom_rule_create_params, + custom_rule_update_params, + custom_rule_delete_multiple_params, +) +from ....types.waap.rule_action_type import RuleActionType +from ....types.waap.customer_rule_state import CustomerRuleState +from ....types.waap.domains.custom_rule import CustomRule + +__all__ = ["CustomRulesResource", "AsyncCustomRulesResource"] + + +class CustomRulesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CustomRulesResourceWithRawResponse: + """ + 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 CustomRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CustomRulesResourceWithStreamingResponse: + """ + 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 CustomRulesResourceWithStreamingResponse(self) + + def create( + self, + domain_id: int, + *, + action: custom_rule_create_params.Action, + conditions: Iterable[custom_rule_create_params.Condition], + enabled: bool, + name: str, + description: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CustomRule: + """ + Create a custom rule + + Args: + domain_id: The domain ID + + action: The action that a WAAP rule takes when triggered + + conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have + between 1 and 5 conditions. All conditions must pass for the rule to trigger + + enabled: Whether or not the rule is enabled + + name: The name assigned to the rule + + description: The description assigned to the rule + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/waap/v1/domains/{domain_id}/custom-rules", + body=maybe_transform( + { + "action": action, + "conditions": conditions, + "enabled": enabled, + "name": name, + "description": description, + }, + custom_rule_create_params.CustomRuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomRule, + ) + + def update( + self, + rule_id: int, + *, + domain_id: int, + action: Optional[custom_rule_update_params.Action] | NotGiven = NOT_GIVEN, + conditions: Optional[Iterable[custom_rule_update_params.Condition]] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + enabled: Optional[bool] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Only properties present in the request will be updated + + Args: + domain_id: The domain ID + + rule_id: The custom rule ID + + action: The action that a WAAP rule takes when triggered + + conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have + between 1 and 5 conditions. All conditions must pass for the rule to trigger + + description: The description assigned to the rule + + enabled: Whether or not the rule is enabled + + name: The name assigned to the rule + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._patch( + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + body=maybe_transform( + { + "action": action, + "conditions": conditions, + "description": description, + "enabled": enabled, + "name": name, + }, + custom_rule_update_params.CustomRuleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + domain_id: int, + *, + action: RuleActionType | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Optional[ + Literal[ + "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action" + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[CustomRule]: + """ + Extracts a list of custom rules assigned to a domain, offering filter, ordering, + and pagination capabilities + + Args: + domain_id: The domain ID + + action: Filter to refine results by specific actions + + description: Filter rules based on their description. Supports '\\**' as a wildcard character. + + enabled: Filter rules based on their active status + + limit: Number of items to return + + name: Filter rules based on their name. Supports '\\**' as a wildcard character. + + offset: Number of items to skip + + ordering: Determine the field to order results by + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/custom-rules", + page=SyncOffsetPage[CustomRule], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "action": action, + "description": description, + "enabled": enabled, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + }, + custom_rule_list_params.CustomRuleListParams, + ), + ), + model=CustomRule, + ) + + def delete( + self, + rule_id: int, + *, + domain_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a custom rule + + Args: + domain_id: The domain ID + + rule_id: The custom rule ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def delete_multiple( + self, + domain_id: int, + *, + rule_ids: Iterable[int], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete multiple WAAP rules + + Args: + domain_id: The domain ID + + rule_ids: The IDs of the rules to delete + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + body=maybe_transform( + {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + rule_id: int, + *, + domain_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, + ) -> CustomRule: + """ + Extracts a specific custom rule assigned to a domain + + Args: + domain_id: The domain ID + + rule_id: The custom rule ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomRule, + ) + + def toggle( + self, + action: CustomerRuleState, + *, + domain_id: int, + rule_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Toggle a custom rule + + Args: + domain_id: The domain ID + + rule_id: The custom rule ID + + action: Enable or disable a custom rule + + 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 action: + raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._patch( + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncCustomRulesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCustomRulesResourceWithRawResponse: + """ + 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 AsyncCustomRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCustomRulesResourceWithStreamingResponse: + """ + 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 AsyncCustomRulesResourceWithStreamingResponse(self) + + async def create( + self, + domain_id: int, + *, + action: custom_rule_create_params.Action, + conditions: Iterable[custom_rule_create_params.Condition], + enabled: bool, + name: str, + description: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CustomRule: + """ + Create a custom rule + + Args: + domain_id: The domain ID + + action: The action that a WAAP rule takes when triggered + + conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have + between 1 and 5 conditions. All conditions must pass for the rule to trigger + + enabled: Whether or not the rule is enabled + + name: The name assigned to the rule + + description: The description assigned to the rule + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/waap/v1/domains/{domain_id}/custom-rules", + body=await async_maybe_transform( + { + "action": action, + "conditions": conditions, + "enabled": enabled, + "name": name, + "description": description, + }, + custom_rule_create_params.CustomRuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomRule, + ) + + async def update( + self, + rule_id: int, + *, + domain_id: int, + action: Optional[custom_rule_update_params.Action] | NotGiven = NOT_GIVEN, + conditions: Optional[Iterable[custom_rule_update_params.Condition]] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + enabled: Optional[bool] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Only properties present in the request will be updated + + Args: + domain_id: The domain ID + + rule_id: The custom rule ID + + action: The action that a WAAP rule takes when triggered + + conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have + between 1 and 5 conditions. All conditions must pass for the rule to trigger + + description: The description assigned to the rule + + enabled: Whether or not the rule is enabled + + name: The name assigned to the rule + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._patch( + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + body=await async_maybe_transform( + { + "action": action, + "conditions": conditions, + "description": description, + "enabled": enabled, + "name": name, + }, + custom_rule_update_params.CustomRuleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + domain_id: int, + *, + action: RuleActionType | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Optional[ + Literal[ + "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action" + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[CustomRule, AsyncOffsetPage[CustomRule]]: + """ + Extracts a list of custom rules assigned to a domain, offering filter, ordering, + and pagination capabilities + + Args: + domain_id: The domain ID + + action: Filter to refine results by specific actions + + description: Filter rules based on their description. Supports '\\**' as a wildcard character. + + enabled: Filter rules based on their active status + + limit: Number of items to return + + name: Filter rules based on their name. Supports '\\**' as a wildcard character. + + offset: Number of items to skip + + ordering: Determine the field to order results by + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/custom-rules", + page=AsyncOffsetPage[CustomRule], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "action": action, + "description": description, + "enabled": enabled, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + }, + custom_rule_list_params.CustomRuleListParams, + ), + ), + model=CustomRule, + ) + + async def delete( + self, + rule_id: int, + *, + domain_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a custom rule + + Args: + domain_id: The domain ID + + rule_id: The custom rule ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def delete_multiple( + self, + domain_id: int, + *, + rule_ids: Iterable[int], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete multiple WAAP rules + + Args: + domain_id: The domain ID + + rule_ids: The IDs of the rules to delete + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + body=await async_maybe_transform( + {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + rule_id: int, + *, + domain_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, + ) -> CustomRule: + """ + Extracts a specific custom rule assigned to a domain + + Args: + domain_id: The domain ID + + rule_id: The custom rule ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomRule, + ) + + async def toggle( + self, + action: CustomerRuleState, + *, + domain_id: int, + rule_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Toggle a custom rule + + Args: + domain_id: The domain ID + + rule_id: The custom rule ID + + action: Enable or disable a custom rule + + 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 action: + raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._patch( + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class CustomRulesResourceWithRawResponse: + def __init__(self, custom_rules: CustomRulesResource) -> None: + self._custom_rules = custom_rules + + self.create = to_raw_response_wrapper( + custom_rules.create, + ) + self.update = to_raw_response_wrapper( + custom_rules.update, + ) + self.list = to_raw_response_wrapper( + custom_rules.list, + ) + self.delete = to_raw_response_wrapper( + custom_rules.delete, + ) + self.delete_multiple = to_raw_response_wrapper( + custom_rules.delete_multiple, + ) + self.get = to_raw_response_wrapper( + custom_rules.get, + ) + self.toggle = to_raw_response_wrapper( + custom_rules.toggle, + ) + + +class AsyncCustomRulesResourceWithRawResponse: + def __init__(self, custom_rules: AsyncCustomRulesResource) -> None: + self._custom_rules = custom_rules + + self.create = async_to_raw_response_wrapper( + custom_rules.create, + ) + self.update = async_to_raw_response_wrapper( + custom_rules.update, + ) + self.list = async_to_raw_response_wrapper( + custom_rules.list, + ) + self.delete = async_to_raw_response_wrapper( + custom_rules.delete, + ) + self.delete_multiple = async_to_raw_response_wrapper( + custom_rules.delete_multiple, + ) + self.get = async_to_raw_response_wrapper( + custom_rules.get, + ) + self.toggle = async_to_raw_response_wrapper( + custom_rules.toggle, + ) + + +class CustomRulesResourceWithStreamingResponse: + def __init__(self, custom_rules: CustomRulesResource) -> None: + self._custom_rules = custom_rules + + self.create = to_streamed_response_wrapper( + custom_rules.create, + ) + self.update = to_streamed_response_wrapper( + custom_rules.update, + ) + self.list = to_streamed_response_wrapper( + custom_rules.list, + ) + self.delete = to_streamed_response_wrapper( + custom_rules.delete, + ) + self.delete_multiple = to_streamed_response_wrapper( + custom_rules.delete_multiple, + ) + self.get = to_streamed_response_wrapper( + custom_rules.get, + ) + self.toggle = to_streamed_response_wrapper( + custom_rules.toggle, + ) + + +class AsyncCustomRulesResourceWithStreamingResponse: + def __init__(self, custom_rules: AsyncCustomRulesResource) -> None: + self._custom_rules = custom_rules + + self.create = async_to_streamed_response_wrapper( + custom_rules.create, + ) + self.update = async_to_streamed_response_wrapper( + custom_rules.update, + ) + self.list = async_to_streamed_response_wrapper( + custom_rules.list, + ) + self.delete = async_to_streamed_response_wrapper( + custom_rules.delete, + ) + self.delete_multiple = async_to_streamed_response_wrapper( + custom_rules.delete_multiple, + ) + self.get = async_to_streamed_response_wrapper( + custom_rules.get, + ) + self.toggle = async_to_streamed_response_wrapper( + custom_rules.toggle, + ) diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index 21085a2a..dcc0b621 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -25,8 +25,32 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) +from .custom_rules import ( + CustomRulesResource, + AsyncCustomRulesResource, + CustomRulesResourceWithRawResponse, + AsyncCustomRulesResourceWithRawResponse, + CustomRulesResourceWithStreamingResponse, + AsyncCustomRulesResourceWithStreamingResponse, +) from ....pagination import SyncOffsetPage, AsyncOffsetPage from ....types.waap import WaapDomainStatus, domain_list_params, domain_update_params +from .advanced_rules import ( + AdvancedRulesResource, + AsyncAdvancedRulesResource, + AdvancedRulesResourceWithRawResponse, + AsyncAdvancedRulesResourceWithRawResponse, + AdvancedRulesResourceWithStreamingResponse, + AsyncAdvancedRulesResourceWithStreamingResponse, +) +from .firewall_rules import ( + FirewallRulesResource, + AsyncFirewallRulesResource, + FirewallRulesResourceWithRawResponse, + AsyncFirewallRulesResourceWithRawResponse, + FirewallRulesResourceWithStreamingResponse, + AsyncFirewallRulesResourceWithStreamingResponse, +) from ...._base_client import AsyncPaginator, make_request_options from ....types.waap.waap_domain_status import WaapDomainStatus from ....types.waap.waap_summary_domain import WaapSummaryDomain @@ -40,6 +64,18 @@ class DomainsResource(SyncAPIResource): def settings(self) -> SettingsResource: return SettingsResource(self._client) + @cached_property + def custom_rules(self) -> CustomRulesResource: + return CustomRulesResource(self._client) + + @cached_property + def firewall_rules(self) -> FirewallRulesResource: + return FirewallRulesResource(self._client) + + @cached_property + def advanced_rules(self) -> AdvancedRulesResource: + return AdvancedRulesResource(self._client) + @cached_property def with_raw_response(self) -> DomainsResourceWithRawResponse: """ @@ -236,6 +272,18 @@ class AsyncDomainsResource(AsyncAPIResource): def settings(self) -> AsyncSettingsResource: return AsyncSettingsResource(self._client) + @cached_property + def custom_rules(self) -> AsyncCustomRulesResource: + return AsyncCustomRulesResource(self._client) + + @cached_property + def firewall_rules(self) -> AsyncFirewallRulesResource: + return AsyncFirewallRulesResource(self._client) + + @cached_property + def advanced_rules(self) -> AsyncAdvancedRulesResource: + return AsyncAdvancedRulesResource(self._client) + @cached_property def with_raw_response(self) -> AsyncDomainsResourceWithRawResponse: """ @@ -448,6 +496,18 @@ def __init__(self, domains: DomainsResource) -> None: def settings(self) -> SettingsResourceWithRawResponse: return SettingsResourceWithRawResponse(self._domains.settings) + @cached_property + def custom_rules(self) -> CustomRulesResourceWithRawResponse: + return CustomRulesResourceWithRawResponse(self._domains.custom_rules) + + @cached_property + def firewall_rules(self) -> FirewallRulesResourceWithRawResponse: + return FirewallRulesResourceWithRawResponse(self._domains.firewall_rules) + + @cached_property + def advanced_rules(self) -> AdvancedRulesResourceWithRawResponse: + return AdvancedRulesResourceWithRawResponse(self._domains.advanced_rules) + class AsyncDomainsResourceWithRawResponse: def __init__(self, domains: AsyncDomainsResource) -> None: @@ -470,6 +530,18 @@ def __init__(self, domains: AsyncDomainsResource) -> None: def settings(self) -> AsyncSettingsResourceWithRawResponse: return AsyncSettingsResourceWithRawResponse(self._domains.settings) + @cached_property + def custom_rules(self) -> AsyncCustomRulesResourceWithRawResponse: + return AsyncCustomRulesResourceWithRawResponse(self._domains.custom_rules) + + @cached_property + def firewall_rules(self) -> AsyncFirewallRulesResourceWithRawResponse: + return AsyncFirewallRulesResourceWithRawResponse(self._domains.firewall_rules) + + @cached_property + def advanced_rules(self) -> AsyncAdvancedRulesResourceWithRawResponse: + return AsyncAdvancedRulesResourceWithRawResponse(self._domains.advanced_rules) + class DomainsResourceWithStreamingResponse: def __init__(self, domains: DomainsResource) -> None: @@ -492,6 +564,18 @@ def __init__(self, domains: DomainsResource) -> None: def settings(self) -> SettingsResourceWithStreamingResponse: return SettingsResourceWithStreamingResponse(self._domains.settings) + @cached_property + def custom_rules(self) -> CustomRulesResourceWithStreamingResponse: + return CustomRulesResourceWithStreamingResponse(self._domains.custom_rules) + + @cached_property + def firewall_rules(self) -> FirewallRulesResourceWithStreamingResponse: + return FirewallRulesResourceWithStreamingResponse(self._domains.firewall_rules) + + @cached_property + def advanced_rules(self) -> AdvancedRulesResourceWithStreamingResponse: + return AdvancedRulesResourceWithStreamingResponse(self._domains.advanced_rules) + class AsyncDomainsResourceWithStreamingResponse: def __init__(self, domains: AsyncDomainsResource) -> None: @@ -513,3 +597,15 @@ def __init__(self, domains: AsyncDomainsResource) -> None: @cached_property def settings(self) -> AsyncSettingsResourceWithStreamingResponse: return AsyncSettingsResourceWithStreamingResponse(self._domains.settings) + + @cached_property + def custom_rules(self) -> AsyncCustomRulesResourceWithStreamingResponse: + return AsyncCustomRulesResourceWithStreamingResponse(self._domains.custom_rules) + + @cached_property + def firewall_rules(self) -> AsyncFirewallRulesResourceWithStreamingResponse: + return AsyncFirewallRulesResourceWithStreamingResponse(self._domains.firewall_rules) + + @cached_property + def advanced_rules(self) -> AsyncAdvancedRulesResourceWithStreamingResponse: + return AsyncAdvancedRulesResourceWithStreamingResponse(self._domains.advanced_rules) diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py new file mode 100644 index 00000000..3a43a5fd --- /dev/null +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -0,0 +1,884 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.waap import CustomerRuleState +from ...._base_client import AsyncPaginator, make_request_options +from ....types.waap.domains import ( + firewall_rule_list_params, + firewall_rule_create_params, + firewall_rule_update_params, + firewall_rule_delete_multiple_params, +) +from ....types.waap.customer_rule_state import CustomerRuleState +from ....types.waap.domains.firewall_rule import FirewallRule + +__all__ = ["FirewallRulesResource", "AsyncFirewallRulesResource"] + + +class FirewallRulesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FirewallRulesResourceWithRawResponse: + """ + 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 FirewallRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FirewallRulesResourceWithStreamingResponse: + """ + 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 FirewallRulesResourceWithStreamingResponse(self) + + def create( + self, + domain_id: int, + *, + action: firewall_rule_create_params.Action, + conditions: Iterable[firewall_rule_create_params.Condition], + enabled: bool, + name: str, + description: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FirewallRule: + """ + Create a firewall rule + + Args: + domain_id: The domain ID + + action: The action that a firewall rule takes when triggered + + conditions: The condition required for the WAAP engine to trigger the rule. + + enabled: Whether or not the rule is enabled + + name: The name assigned to the rule + + description: The description assigned to the rule + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/waap/v1/domains/{domain_id}/firewall-rules", + body=maybe_transform( + { + "action": action, + "conditions": conditions, + "enabled": enabled, + "name": name, + "description": description, + }, + firewall_rule_create_params.FirewallRuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FirewallRule, + ) + + def update( + self, + rule_id: int, + *, + domain_id: int, + action: Optional[firewall_rule_update_params.Action] | NotGiven = NOT_GIVEN, + conditions: Optional[Iterable[firewall_rule_update_params.Condition]] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + enabled: Optional[bool] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Only properties present in the request will be updated + + Args: + domain_id: The domain ID + + rule_id: The firewall rule ID + + action: The action that a firewall rule takes when triggered + + conditions: The condition required for the WAAP engine to trigger the rule. + + description: The description assigned to the rule + + enabled: Whether or not the rule is enabled + + name: The name assigned to the rule + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._patch( + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + body=maybe_transform( + { + "action": action, + "conditions": conditions, + "description": description, + "enabled": enabled, + "name": name, + }, + firewall_rule_update_params.FirewallRuleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + domain_id: int, + *, + action: Literal["allow", "block"] | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Optional[ + Literal[ + "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action" + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[FirewallRule]: + """ + Extracts a list of firewall rules assigned to a domain, offering filter, + ordering, and pagination capabilities + + Args: + domain_id: The domain ID + + action: Filter to refine results by specific firewall actions + + description: Filter rules based on their description. Supports '\\**' as a wildcard character. + + enabled: Filter rules based on their active status + + limit: Number of items to return + + name: Filter rules based on their name. Supports '\\**' as a wildcard character. + + offset: Number of items to skip + + ordering: Determine the field to order results by + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/firewall-rules", + page=SyncOffsetPage[FirewallRule], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "action": action, + "description": description, + "enabled": enabled, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + }, + firewall_rule_list_params.FirewallRuleListParams, + ), + ), + model=FirewallRule, + ) + + def delete( + self, + rule_id: int, + *, + domain_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a firewall rule + + Args: + domain_id: The domain ID + + rule_id: The firewall rule ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def delete_multiple( + self, + domain_id: int, + *, + rule_ids: Iterable[int], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete multiple WAAP rules + + Args: + domain_id: The domain ID + + rule_ids: The IDs of the rules to delete + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + body=maybe_transform( + {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + rule_id: int, + *, + domain_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, + ) -> FirewallRule: + """ + Extracts a specific firewall rule assigned to a domain + + Args: + domain_id: The domain ID + + rule_id: The firewall rule ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FirewallRule, + ) + + def toggle( + self, + action: CustomerRuleState, + *, + domain_id: int, + rule_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Toggle a firewall rule + + Args: + domain_id: The domain ID + + rule_id: The firewall rule ID + + action: Enable or disable a firewall rule + + 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 action: + raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._patch( + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncFirewallRulesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFirewallRulesResourceWithRawResponse: + """ + 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 AsyncFirewallRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFirewallRulesResourceWithStreamingResponse: + """ + 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 AsyncFirewallRulesResourceWithStreamingResponse(self) + + async def create( + self, + domain_id: int, + *, + action: firewall_rule_create_params.Action, + conditions: Iterable[firewall_rule_create_params.Condition], + enabled: bool, + name: str, + description: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FirewallRule: + """ + Create a firewall rule + + Args: + domain_id: The domain ID + + action: The action that a firewall rule takes when triggered + + conditions: The condition required for the WAAP engine to trigger the rule. + + enabled: Whether or not the rule is enabled + + name: The name assigned to the rule + + description: The description assigned to the rule + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/waap/v1/domains/{domain_id}/firewall-rules", + body=await async_maybe_transform( + { + "action": action, + "conditions": conditions, + "enabled": enabled, + "name": name, + "description": description, + }, + firewall_rule_create_params.FirewallRuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FirewallRule, + ) + + async def update( + self, + rule_id: int, + *, + domain_id: int, + action: Optional[firewall_rule_update_params.Action] | NotGiven = NOT_GIVEN, + conditions: Optional[Iterable[firewall_rule_update_params.Condition]] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + enabled: Optional[bool] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Only properties present in the request will be updated + + Args: + domain_id: The domain ID + + rule_id: The firewall rule ID + + action: The action that a firewall rule takes when triggered + + conditions: The condition required for the WAAP engine to trigger the rule. + + description: The description assigned to the rule + + enabled: Whether or not the rule is enabled + + name: The name assigned to the rule + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._patch( + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + body=await async_maybe_transform( + { + "action": action, + "conditions": conditions, + "description": description, + "enabled": enabled, + "name": name, + }, + firewall_rule_update_params.FirewallRuleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + domain_id: int, + *, + action: Literal["allow", "block"] | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Optional[ + Literal[ + "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action" + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[FirewallRule, AsyncOffsetPage[FirewallRule]]: + """ + Extracts a list of firewall rules assigned to a domain, offering filter, + ordering, and pagination capabilities + + Args: + domain_id: The domain ID + + action: Filter to refine results by specific firewall actions + + description: Filter rules based on their description. Supports '\\**' as a wildcard character. + + enabled: Filter rules based on their active status + + limit: Number of items to return + + name: Filter rules based on their name. Supports '\\**' as a wildcard character. + + offset: Number of items to skip + + ordering: Determine the field to order results by + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/firewall-rules", + page=AsyncOffsetPage[FirewallRule], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "action": action, + "description": description, + "enabled": enabled, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + }, + firewall_rule_list_params.FirewallRuleListParams, + ), + ), + model=FirewallRule, + ) + + async def delete( + self, + rule_id: int, + *, + domain_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a firewall rule + + Args: + domain_id: The domain ID + + rule_id: The firewall rule ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def delete_multiple( + self, + domain_id: int, + *, + rule_ids: Iterable[int], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete multiple WAAP rules + + Args: + domain_id: The domain ID + + rule_ids: The IDs of the rules to delete + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + body=await async_maybe_transform( + {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + rule_id: int, + *, + domain_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, + ) -> FirewallRule: + """ + Extracts a specific firewall rule assigned to a domain + + Args: + domain_id: The domain ID + + rule_id: The firewall rule ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FirewallRule, + ) + + async def toggle( + self, + action: CustomerRuleState, + *, + domain_id: int, + rule_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Toggle a firewall rule + + Args: + domain_id: The domain ID + + rule_id: The firewall rule ID + + action: Enable or disable a firewall rule + + 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 action: + raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._patch( + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class FirewallRulesResourceWithRawResponse: + def __init__(self, firewall_rules: FirewallRulesResource) -> None: + self._firewall_rules = firewall_rules + + self.create = to_raw_response_wrapper( + firewall_rules.create, + ) + self.update = to_raw_response_wrapper( + firewall_rules.update, + ) + self.list = to_raw_response_wrapper( + firewall_rules.list, + ) + self.delete = to_raw_response_wrapper( + firewall_rules.delete, + ) + self.delete_multiple = to_raw_response_wrapper( + firewall_rules.delete_multiple, + ) + self.get = to_raw_response_wrapper( + firewall_rules.get, + ) + self.toggle = to_raw_response_wrapper( + firewall_rules.toggle, + ) + + +class AsyncFirewallRulesResourceWithRawResponse: + def __init__(self, firewall_rules: AsyncFirewallRulesResource) -> None: + self._firewall_rules = firewall_rules + + self.create = async_to_raw_response_wrapper( + firewall_rules.create, + ) + self.update = async_to_raw_response_wrapper( + firewall_rules.update, + ) + self.list = async_to_raw_response_wrapper( + firewall_rules.list, + ) + self.delete = async_to_raw_response_wrapper( + firewall_rules.delete, + ) + self.delete_multiple = async_to_raw_response_wrapper( + firewall_rules.delete_multiple, + ) + self.get = async_to_raw_response_wrapper( + firewall_rules.get, + ) + self.toggle = async_to_raw_response_wrapper( + firewall_rules.toggle, + ) + + +class FirewallRulesResourceWithStreamingResponse: + def __init__(self, firewall_rules: FirewallRulesResource) -> None: + self._firewall_rules = firewall_rules + + self.create = to_streamed_response_wrapper( + firewall_rules.create, + ) + self.update = to_streamed_response_wrapper( + firewall_rules.update, + ) + self.list = to_streamed_response_wrapper( + firewall_rules.list, + ) + self.delete = to_streamed_response_wrapper( + firewall_rules.delete, + ) + self.delete_multiple = to_streamed_response_wrapper( + firewall_rules.delete_multiple, + ) + self.get = to_streamed_response_wrapper( + firewall_rules.get, + ) + self.toggle = to_streamed_response_wrapper( + firewall_rules.toggle, + ) + + +class AsyncFirewallRulesResourceWithStreamingResponse: + def __init__(self, firewall_rules: AsyncFirewallRulesResource) -> None: + self._firewall_rules = firewall_rules + + self.create = async_to_streamed_response_wrapper( + firewall_rules.create, + ) + self.update = async_to_streamed_response_wrapper( + firewall_rules.update, + ) + self.list = async_to_streamed_response_wrapper( + firewall_rules.list, + ) + self.delete = async_to_streamed_response_wrapper( + firewall_rules.delete, + ) + self.delete_multiple = async_to_streamed_response_wrapper( + firewall_rules.delete_multiple, + ) + self.get = async_to_streamed_response_wrapper( + firewall_rules.get, + ) + self.toggle = async_to_streamed_response_wrapper( + firewall_rules.toggle, + ) diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py new file mode 100644 index 00000000..aabadd7e --- /dev/null +++ b/src/gcore/resources/waap/organizations.py @@ -0,0 +1,217 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ...types.waap import organization_list_params +from ..._base_client import AsyncPaginator, make_request_options +from ...types.waap.organization import Organization + +__all__ = ["OrganizationsResource", "AsyncOrganizationsResource"] + + +class OrganizationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> OrganizationsResourceWithRawResponse: + """ + 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 OrganizationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> OrganizationsResourceWithStreamingResponse: + """ + 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 OrganizationsResourceWithStreamingResponse(self) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Optional[Literal["name", "id", "-name", "-id"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[Organization]: + """ + This endpoint retrieves a list of network organizations that own IP ranges as + identified by the Whois service.It supports pagination, filtering based on + various parameters, and ordering of results. + + Args: + limit: Number of items to return + + name: Filter organizations by their name. Supports '\\**' as a wildcard character. + + offset: Number of items to skip + + ordering: Determine the field to order results by + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/waap/v1/organizations", + page=SyncOffsetPage[Organization], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + }, + organization_list_params.OrganizationListParams, + ), + ), + model=Organization, + ) + + +class AsyncOrganizationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncOrganizationsResourceWithRawResponse: + """ + 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 AsyncOrganizationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncOrganizationsResourceWithStreamingResponse: + """ + 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 AsyncOrganizationsResourceWithStreamingResponse(self) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Optional[Literal["name", "id", "-name", "-id"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Organization, AsyncOffsetPage[Organization]]: + """ + This endpoint retrieves a list of network organizations that own IP ranges as + identified by the Whois service.It supports pagination, filtering based on + various parameters, and ordering of results. + + Args: + limit: Number of items to return + + name: Filter organizations by their name. Supports '\\**' as a wildcard character. + + offset: Number of items to skip + + ordering: Determine the field to order results by + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/waap/v1/organizations", + page=AsyncOffsetPage[Organization], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + }, + organization_list_params.OrganizationListParams, + ), + ), + model=Organization, + ) + + +class OrganizationsResourceWithRawResponse: + def __init__(self, organizations: OrganizationsResource) -> None: + self._organizations = organizations + + self.list = to_raw_response_wrapper( + organizations.list, + ) + + +class AsyncOrganizationsResourceWithRawResponse: + def __init__(self, organizations: AsyncOrganizationsResource) -> None: + self._organizations = organizations + + self.list = async_to_raw_response_wrapper( + organizations.list, + ) + + +class OrganizationsResourceWithStreamingResponse: + def __init__(self, organizations: OrganizationsResource) -> None: + self._organizations = organizations + + self.list = to_streamed_response_wrapper( + organizations.list, + ) + + +class AsyncOrganizationsResourceWithStreamingResponse: + def __init__(self, organizations: AsyncOrganizationsResource) -> None: + self._organizations = organizations + + self.list = async_to_streamed_response_wrapper( + organizations.list, + ) diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py new file mode 100644 index 00000000..52b41329 --- /dev/null +++ b/src/gcore/resources/waap/statistics.py @@ -0,0 +1,225 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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.waap import statistic_get_usage_series_params +from ..._base_client import make_request_options +from ...types.waap.statistics_series import StatisticsSeries + +__all__ = ["StatisticsResource", "AsyncStatisticsResource"] + + +class StatisticsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StatisticsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return StatisticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StatisticsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return StatisticsResourceWithStreamingResponse(self) + + def get_usage_series( + self, + *, + from_: Union[str, datetime], + granularity: Literal["1h", "1d"], + metrics: List[Literal["total_bytes", "total_requests"]], + to: Union[str, datetime], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StatisticsSeries: + """Retrieve statistics data as a time series. + + The `from` and `to` parameters are + rounded down and up according to the `granularity`. This means that if the + `granularity` is set to `1h`, the `from` and `to` parameters will be rounded + down and up to the nearest hour, respectively. If the `granularity` is set to + `1d`, the `from` and `to` parameters will be rounded down and up to the nearest + day, respectively. The response will include explicit 0 values for any missing + data points. + + Args: + from_: Beginning of the requested time period (ISO 8601 format, UTC) + + granularity: Duration of the time blocks into which the data will be divided. + + metrics: List of metric types to retrieve statistics for. + + to: End of the requested time period (ISO 8601 format, UTC) + + 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( + "/waap/v1/statistics/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "granularity": granularity, + "metrics": metrics, + "to": to, + }, + statistic_get_usage_series_params.StatisticGetUsageSeriesParams, + ), + ), + cast_to=StatisticsSeries, + ) + + +class AsyncStatisticsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncStatisticsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncStatisticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStatisticsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncStatisticsResourceWithStreamingResponse(self) + + async def get_usage_series( + self, + *, + from_: Union[str, datetime], + granularity: Literal["1h", "1d"], + metrics: List[Literal["total_bytes", "total_requests"]], + to: Union[str, datetime], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StatisticsSeries: + """Retrieve statistics data as a time series. + + The `from` and `to` parameters are + rounded down and up according to the `granularity`. This means that if the + `granularity` is set to `1h`, the `from` and `to` parameters will be rounded + down and up to the nearest hour, respectively. If the `granularity` is set to + `1d`, the `from` and `to` parameters will be rounded down and up to the nearest + day, respectively. The response will include explicit 0 values for any missing + data points. + + Args: + from_: Beginning of the requested time period (ISO 8601 format, UTC) + + granularity: Duration of the time blocks into which the data will be divided. + + metrics: List of metric types to retrieve statistics for. + + to: End of the requested time period (ISO 8601 format, UTC) + + 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( + "/waap/v1/statistics/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "granularity": granularity, + "metrics": metrics, + "to": to, + }, + statistic_get_usage_series_params.StatisticGetUsageSeriesParams, + ), + ), + cast_to=StatisticsSeries, + ) + + +class StatisticsResourceWithRawResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics + + self.get_usage_series = to_raw_response_wrapper( + statistics.get_usage_series, + ) + + +class AsyncStatisticsResourceWithRawResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics + + self.get_usage_series = async_to_raw_response_wrapper( + statistics.get_usage_series, + ) + + +class StatisticsResourceWithStreamingResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics + + self.get_usage_series = to_streamed_response_wrapper( + statistics.get_usage_series, + ) + + +class AsyncStatisticsResourceWithStreamingResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics + + self.get_usage_series = async_to_streamed_response_wrapper( + statistics.get_usage_series, + ) diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py new file mode 100644 index 00000000..fe6b678e --- /dev/null +++ b/src/gcore/resources/waap/tags.py @@ -0,0 +1,233 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ...types.waap import tag_list_params +from ..._base_client import AsyncPaginator, make_request_options +from ...types.waap.tag import Tag + +__all__ = ["TagsResource", "AsyncTagsResource"] + + +class TagsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TagsResourceWithRawResponse: + """ + 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 TagsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TagsResourceWithStreamingResponse: + """ + 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 TagsResourceWithStreamingResponse(self) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Optional[Literal["name", "readable_name", "reserved", "-name", "-readable_name", "-reserved"]] + | NotGiven = NOT_GIVEN, + readable_name: str | NotGiven = NOT_GIVEN, + reserved: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[Tag]: + """ + Tags are shortcuts for the rules used in WAAP policies for the creation of more + complex WAAP rules + + Args: + limit: Number of items to return + + name: Filter tags by their name. Supports '\\**' as a wildcard character. + + offset: Number of items to skip + + ordering: Determine the field to order results by + + readable_name: Filter tags by their readable name. Supports '\\**' as a wildcard character. + + reserved: Filter to include only reserved tags. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/waap/v1/tags", + page=SyncOffsetPage[Tag], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + "readable_name": readable_name, + "reserved": reserved, + }, + tag_list_params.TagListParams, + ), + ), + model=Tag, + ) + + +class AsyncTagsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTagsResourceWithRawResponse: + """ + 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 AsyncTagsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTagsResourceWithStreamingResponse: + """ + 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 AsyncTagsResourceWithStreamingResponse(self) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Optional[Literal["name", "readable_name", "reserved", "-name", "-readable_name", "-reserved"]] + | NotGiven = NOT_GIVEN, + readable_name: str | NotGiven = NOT_GIVEN, + reserved: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Tag, AsyncOffsetPage[Tag]]: + """ + Tags are shortcuts for the rules used in WAAP policies for the creation of more + complex WAAP rules + + Args: + limit: Number of items to return + + name: Filter tags by their name. Supports '\\**' as a wildcard character. + + offset: Number of items to skip + + ordering: Determine the field to order results by + + readable_name: Filter tags by their readable name. Supports '\\**' as a wildcard character. + + reserved: Filter to include only reserved tags. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/waap/v1/tags", + page=AsyncOffsetPage[Tag], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + "readable_name": readable_name, + "reserved": reserved, + }, + tag_list_params.TagListParams, + ), + ), + model=Tag, + ) + + +class TagsResourceWithRawResponse: + def __init__(self, tags: TagsResource) -> None: + self._tags = tags + + self.list = to_raw_response_wrapper( + tags.list, + ) + + +class AsyncTagsResourceWithRawResponse: + def __init__(self, tags: AsyncTagsResource) -> None: + self._tags = tags + + self.list = async_to_raw_response_wrapper( + tags.list, + ) + + +class TagsResourceWithStreamingResponse: + def __init__(self, tags: TagsResource) -> None: + self._tags = tags + + self.list = to_streamed_response_wrapper( + tags.list, + ) + + +class AsyncTagsResourceWithStreamingResponse: + def __init__(self, tags: AsyncTagsResource) -> None: + self._tags = tags + + self.list = async_to_streamed_response_wrapper( + tags.list, + ) diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index 0fc8a330..c28a767c 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -2,8 +2,50 @@ from __future__ import annotations +import httpx + +from .tags import ( + TagsResource, + AsyncTagsResource, + TagsResourceWithRawResponse, + AsyncTagsResourceWithRawResponse, + TagsResourceWithStreamingResponse, + AsyncTagsResourceWithStreamingResponse, +) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._compat import cached_property +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .organizations import ( + OrganizationsResource, + AsyncOrganizationsResource, + OrganizationsResourceWithRawResponse, + AsyncOrganizationsResourceWithRawResponse, + OrganizationsResourceWithStreamingResponse, + AsyncOrganizationsResourceWithStreamingResponse, +) +from ..._base_client import make_request_options +from .advanced_rules import ( + AdvancedRulesResource, + AsyncAdvancedRulesResource, + AdvancedRulesResourceWithRawResponse, + AsyncAdvancedRulesResourceWithRawResponse, + AdvancedRulesResourceWithStreamingResponse, + AsyncAdvancedRulesResourceWithStreamingResponse, +) from .domains.domains import ( DomainsResource, AsyncDomainsResource, @@ -12,15 +54,44 @@ DomainsResourceWithStreamingResponse, AsyncDomainsResourceWithStreamingResponse, ) +from .custom_page_sets import ( + CustomPageSetsResource, + AsyncCustomPageSetsResource, + CustomPageSetsResourceWithRawResponse, + AsyncCustomPageSetsResourceWithRawResponse, + CustomPageSetsResourceWithStreamingResponse, + AsyncCustomPageSetsResourceWithStreamingResponse, +) +from ...types.waap.client_info import ClientInfo __all__ = ["WaapResource", "AsyncWaapResource"] class WaapResource(SyncAPIResource): + @cached_property + def statistics(self) -> StatisticsResource: + return StatisticsResource(self._client) + @cached_property def domains(self) -> DomainsResource: return DomainsResource(self._client) + @cached_property + def custom_page_sets(self) -> CustomPageSetsResource: + return CustomPageSetsResource(self._client) + + @cached_property + def advanced_rules(self) -> AdvancedRulesResource: + return AdvancedRulesResource(self._client) + + @cached_property + def tags(self) -> TagsResource: + return TagsResource(self._client) + + @cached_property + def organizations(self) -> OrganizationsResource: + return OrganizationsResource(self._client) + @cached_property def with_raw_response(self) -> WaapResourceWithRawResponse: """ @@ -40,12 +111,51 @@ def with_streaming_response(self) -> WaapResourceWithStreamingResponse: """ return WaapResourceWithStreamingResponse(self) + def get_account_overview( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ClientInfo: + """Get information about WAAP service for the client""" + return self._get( + "/waap/v1/clients/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientInfo, + ) + class AsyncWaapResource(AsyncAPIResource): + @cached_property + def statistics(self) -> AsyncStatisticsResource: + return AsyncStatisticsResource(self._client) + @cached_property def domains(self) -> AsyncDomainsResource: return AsyncDomainsResource(self._client) + @cached_property + def custom_page_sets(self) -> AsyncCustomPageSetsResource: + return AsyncCustomPageSetsResource(self._client) + + @cached_property + def advanced_rules(self) -> AsyncAdvancedRulesResource: + return AsyncAdvancedRulesResource(self._client) + + @cached_property + def tags(self) -> AsyncTagsResource: + return AsyncTagsResource(self._client) + + @cached_property + def organizations(self) -> AsyncOrganizationsResource: + return AsyncOrganizationsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncWaapResourceWithRawResponse: """ @@ -65,38 +175,153 @@ def with_streaming_response(self) -> AsyncWaapResourceWithStreamingResponse: """ return AsyncWaapResourceWithStreamingResponse(self) + async def get_account_overview( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ClientInfo: + """Get information about WAAP service for the client""" + return await self._get( + "/waap/v1/clients/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientInfo, + ) + class WaapResourceWithRawResponse: def __init__(self, waap: WaapResource) -> None: self._waap = waap + self.get_account_overview = to_raw_response_wrapper( + waap.get_account_overview, + ) + + @cached_property + def statistics(self) -> StatisticsResourceWithRawResponse: + return StatisticsResourceWithRawResponse(self._waap.statistics) + @cached_property def domains(self) -> DomainsResourceWithRawResponse: return DomainsResourceWithRawResponse(self._waap.domains) + @cached_property + def custom_page_sets(self) -> CustomPageSetsResourceWithRawResponse: + return CustomPageSetsResourceWithRawResponse(self._waap.custom_page_sets) + + @cached_property + def advanced_rules(self) -> AdvancedRulesResourceWithRawResponse: + return AdvancedRulesResourceWithRawResponse(self._waap.advanced_rules) + + @cached_property + def tags(self) -> TagsResourceWithRawResponse: + return TagsResourceWithRawResponse(self._waap.tags) + + @cached_property + def organizations(self) -> OrganizationsResourceWithRawResponse: + return OrganizationsResourceWithRawResponse(self._waap.organizations) + class AsyncWaapResourceWithRawResponse: def __init__(self, waap: AsyncWaapResource) -> None: self._waap = waap + self.get_account_overview = async_to_raw_response_wrapper( + waap.get_account_overview, + ) + + @cached_property + def statistics(self) -> AsyncStatisticsResourceWithRawResponse: + return AsyncStatisticsResourceWithRawResponse(self._waap.statistics) + @cached_property def domains(self) -> AsyncDomainsResourceWithRawResponse: return AsyncDomainsResourceWithRawResponse(self._waap.domains) + @cached_property + def custom_page_sets(self) -> AsyncCustomPageSetsResourceWithRawResponse: + return AsyncCustomPageSetsResourceWithRawResponse(self._waap.custom_page_sets) + + @cached_property + def advanced_rules(self) -> AsyncAdvancedRulesResourceWithRawResponse: + return AsyncAdvancedRulesResourceWithRawResponse(self._waap.advanced_rules) + + @cached_property + def tags(self) -> AsyncTagsResourceWithRawResponse: + return AsyncTagsResourceWithRawResponse(self._waap.tags) + + @cached_property + def organizations(self) -> AsyncOrganizationsResourceWithRawResponse: + return AsyncOrganizationsResourceWithRawResponse(self._waap.organizations) + class WaapResourceWithStreamingResponse: def __init__(self, waap: WaapResource) -> None: self._waap = waap + self.get_account_overview = to_streamed_response_wrapper( + waap.get_account_overview, + ) + + @cached_property + def statistics(self) -> StatisticsResourceWithStreamingResponse: + return StatisticsResourceWithStreamingResponse(self._waap.statistics) + @cached_property def domains(self) -> DomainsResourceWithStreamingResponse: return DomainsResourceWithStreamingResponse(self._waap.domains) + @cached_property + def custom_page_sets(self) -> CustomPageSetsResourceWithStreamingResponse: + return CustomPageSetsResourceWithStreamingResponse(self._waap.custom_page_sets) + + @cached_property + def advanced_rules(self) -> AdvancedRulesResourceWithStreamingResponse: + return AdvancedRulesResourceWithStreamingResponse(self._waap.advanced_rules) + + @cached_property + def tags(self) -> TagsResourceWithStreamingResponse: + return TagsResourceWithStreamingResponse(self._waap.tags) + + @cached_property + def organizations(self) -> OrganizationsResourceWithStreamingResponse: + return OrganizationsResourceWithStreamingResponse(self._waap.organizations) + class AsyncWaapResourceWithStreamingResponse: def __init__(self, waap: AsyncWaapResource) -> None: self._waap = waap + self.get_account_overview = async_to_streamed_response_wrapper( + waap.get_account_overview, + ) + + @cached_property + def statistics(self) -> AsyncStatisticsResourceWithStreamingResponse: + return AsyncStatisticsResourceWithStreamingResponse(self._waap.statistics) + @cached_property def domains(self) -> AsyncDomainsResourceWithStreamingResponse: return AsyncDomainsResourceWithStreamingResponse(self._waap.domains) + + @cached_property + def custom_page_sets(self) -> AsyncCustomPageSetsResourceWithStreamingResponse: + return AsyncCustomPageSetsResourceWithStreamingResponse(self._waap.custom_page_sets) + + @cached_property + def advanced_rules(self) -> AsyncAdvancedRulesResourceWithStreamingResponse: + return AsyncAdvancedRulesResourceWithStreamingResponse(self._waap.advanced_rules) + + @cached_property + def tags(self) -> AsyncTagsResourceWithStreamingResponse: + return AsyncTagsResourceWithStreamingResponse(self._waap.tags) + + @cached_property + def organizations(self) -> AsyncOrganizationsResourceWithStreamingResponse: + return AsyncOrganizationsResourceWithStreamingResponse(self._waap.organizations) diff --git a/src/gcore/types/waap/__init__.py b/src/gcore/types/waap/__init__.py index 476d1c3e..25f3a6d4 100644 --- a/src/gcore/types/waap/__init__.py +++ b/src/gcore/types/waap/__init__.py @@ -2,10 +2,41 @@ from __future__ import annotations +from .tag import Tag as Tag +from .quota_item import QuotaItem as QuotaItem +from .client_info import ClientInfo as ClientInfo +from .organization import Organization as Organization +from .statistic_item import StatisticItem as StatisticItem +from .block_page_data import BlockPageData as BlockPageData +from .custom_page_set import CustomPageSet as CustomPageSet +from .tag_list_params import TagListParams as TagListParams +from .rule_action_type import RuleActionType as RuleActionType +from .captcha_page_data import CaptchaPageData as CaptchaPageData +from .statistics_series import StatisticsSeries as StatisticsSeries from .domain_list_params import DomainListParams as DomainListParams from .waap_domain_status import WaapDomainStatus as WaapDomainStatus +from .customer_rule_state import CustomerRuleState as CustomerRuleState +from .handshake_page_data import HandshakePageData as HandshakePageData +from .preview_custom_page import PreviewCustomPage as PreviewCustomPage from .waap_summary_domain import WaapSummaryDomain as WaapSummaryDomain +from .block_csrf_page_data import BlockCsrfPageData as BlockCsrfPageData from .domain_update_params import DomainUpdateParams as DomainUpdateParams from .waap_detailed_domain import WaapDetailedDomain as WaapDetailedDomain from .waap_domain_settings import WaapDomainSettings as WaapDomainSettings +from .block_page_data_param import BlockPageDataParam as BlockPageDataParam +from .captcha_page_data_param import CaptchaPageDataParam as CaptchaPageDataParam +from .advanced_rule_descriptor import AdvancedRuleDescriptor as AdvancedRuleDescriptor +from .organization_list_params import OrganizationListParams as OrganizationListParams +from .cookie_disabled_page_data import CookieDisabledPageData as CookieDisabledPageData +from .handshake_page_data_param import HandshakePageDataParam as HandshakePageDataParam from .waap_domain_ddos_settings import WaapDomainDDOSSettings as WaapDomainDDOSSettings +from .block_csrf_page_data_param import BlockCsrfPageDataParam as BlockCsrfPageDataParam +from .custom_page_set_list_params import CustomPageSetListParams as CustomPageSetListParams +from .advanced_rule_descriptor_list import AdvancedRuleDescriptorList as AdvancedRuleDescriptorList +from .custom_page_set_create_params import CustomPageSetCreateParams as CustomPageSetCreateParams +from .custom_page_set_update_params import CustomPageSetUpdateParams as CustomPageSetUpdateParams +from .javascript_disabled_page_data import JavascriptDisabledPageData as JavascriptDisabledPageData +from .custom_page_set_preview_params import CustomPageSetPreviewParams as CustomPageSetPreviewParams +from .cookie_disabled_page_data_param import CookieDisabledPageDataParam as CookieDisabledPageDataParam +from .statistic_get_usage_series_params import StatisticGetUsageSeriesParams as StatisticGetUsageSeriesParams +from .javascript_disabled_page_data_param import JavascriptDisabledPageDataParam as JavascriptDisabledPageDataParam diff --git a/src/gcore/types/waap/advanced_rule_descriptor.py b/src/gcore/types/waap/advanced_rule_descriptor.py new file mode 100644 index 00000000..c396064c --- /dev/null +++ b/src/gcore/types/waap/advanced_rule_descriptor.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["AdvancedRuleDescriptor", "Attr", "AttrArg"] + + +class AttrArg(BaseModel): + name: str + """The argument's name""" + + type: str + """The argument's type""" + + description: Optional[str] = None + """The argument's description""" + + +class Attr(BaseModel): + name: str + """The attribute's name""" + + type: str + """The attribute's type""" + + args: Optional[List[AttrArg]] = None + """A list of arguments for the attribute""" + + description: Optional[str] = None + """The attribute's description""" + + hint: Optional[str] = None + """The attribute's hint""" + + +class AdvancedRuleDescriptor(BaseModel): + name: str + """The object's name""" + + type: str + """The object's type""" + + attrs: Optional[List[Attr]] = None + """The object's attributes list""" + + description: Optional[str] = None + """The object's description""" diff --git a/src/gcore/types/waap/advanced_rule_descriptor_list.py b/src/gcore/types/waap/advanced_rule_descriptor_list.py new file mode 100644 index 00000000..3842ae7d --- /dev/null +++ b/src/gcore/types/waap/advanced_rule_descriptor_list.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .advanced_rule_descriptor import AdvancedRuleDescriptor + +__all__ = ["AdvancedRuleDescriptorList"] + + +class AdvancedRuleDescriptorList(BaseModel): + version: str + """The descriptor's version""" + + objects: Optional[List[AdvancedRuleDescriptor]] = None diff --git a/src/gcore/types/waap/block_csrf_page_data.py b/src/gcore/types/waap/block_csrf_page_data.py new file mode 100644 index 00000000..45fb8706 --- /dev/null +++ b/src/gcore/types/waap/block_csrf_page_data.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["BlockCsrfPageData"] + + +class BlockCsrfPageData(BaseModel): + enabled: bool + """Indicates whether the custom custom page is active or inactive""" + + header: Optional[str] = None + """The text to display in the header of the custom page""" + + logo: Optional[str] = None + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: Optional[str] = None + """The text to display in the body of the custom page""" + + title: Optional[str] = None + """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/block_csrf_page_data_param.py b/src/gcore/types/waap/block_csrf_page_data_param.py new file mode 100644 index 00000000..234c6ccf --- /dev/null +++ b/src/gcore/types/waap/block_csrf_page_data_param.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["BlockCsrfPageDataParam"] + + +class BlockCsrfPageDataParam(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + logo: str + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: str + """The text to display in the body of the custom page""" + + title: str + """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/block_page_data.py b/src/gcore/types/waap/block_page_data.py new file mode 100644 index 00000000..b4daf445 --- /dev/null +++ b/src/gcore/types/waap/block_page_data.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["BlockPageData"] + + +class BlockPageData(BaseModel): + enabled: bool + """Indicates whether the custom custom page is active or inactive""" + + header: Optional[str] = None + """The text to display in the header of the custom page""" + + logo: Optional[str] = None + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: Optional[str] = None + """The text to display in the body of the custom page""" + + title: Optional[str] = None + """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/block_page_data_param.py b/src/gcore/types/waap/block_page_data_param.py new file mode 100644 index 00000000..939958da --- /dev/null +++ b/src/gcore/types/waap/block_page_data_param.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["BlockPageDataParam"] + + +class BlockPageDataParam(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + logo: str + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: str + """The text to display in the body of the custom page""" + + title: str + """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/captcha_page_data.py b/src/gcore/types/waap/captcha_page_data.py new file mode 100644 index 00000000..d2281883 --- /dev/null +++ b/src/gcore/types/waap/captcha_page_data.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["CaptchaPageData"] + + +class CaptchaPageData(BaseModel): + enabled: bool + """Indicates whether the custom custom page is active or inactive""" + + error: Optional[str] = None + """Error message""" + + header: Optional[str] = None + """The text to display in the header of the custom page""" + + logo: Optional[str] = None + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: Optional[str] = None + """The text to display in the body of the custom page""" + + title: Optional[str] = None + """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/captcha_page_data_param.py b/src/gcore/types/waap/captcha_page_data_param.py new file mode 100644 index 00000000..4881c803 --- /dev/null +++ b/src/gcore/types/waap/captcha_page_data_param.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["CaptchaPageDataParam"] + + +class CaptchaPageDataParam(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + error: str + """Error message""" + + header: str + """The text to display in the header of the custom page""" + + logo: str + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: str + """The text to display in the body of the custom page""" + + title: str + """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/client_info.py b/src/gcore/types/waap/client_info.py new file mode 100644 index 00000000..988447cf --- /dev/null +++ b/src/gcore/types/waap/client_info.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional + +from ..._models import BaseModel +from .quota_item import QuotaItem + +__all__ = ["ClientInfo", "Service"] + + +class Service(BaseModel): + enabled: bool + """Whether the service is enabled""" + + +class ClientInfo(BaseModel): + id: Optional[int] = None + """The client ID""" + + features: List[str] + """List of enabled features""" + + quotas: Dict[str, QuotaItem] + """Quotas for the client""" + + service: Service + """Information about the WAAP service status""" diff --git a/src/gcore/types/waap/cookie_disabled_page_data.py b/src/gcore/types/waap/cookie_disabled_page_data.py new file mode 100644 index 00000000..3e598b1b --- /dev/null +++ b/src/gcore/types/waap/cookie_disabled_page_data.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["CookieDisabledPageData"] + + +class CookieDisabledPageData(BaseModel): + enabled: bool + """Indicates whether the custom custom page is active or inactive""" + + header: Optional[str] = None + """The text to display in the header of the custom page""" + + text: Optional[str] = None + """The text to display in the body of the custom page""" diff --git a/src/gcore/types/waap/cookie_disabled_page_data_param.py b/src/gcore/types/waap/cookie_disabled_page_data_param.py new file mode 100644 index 00000000..c56bd5d9 --- /dev/null +++ b/src/gcore/types/waap/cookie_disabled_page_data_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_extensions import Required, TypedDict + +__all__ = ["CookieDisabledPageDataParam"] + + +class CookieDisabledPageDataParam(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + text: str + """The text to display in the body of the custom page""" diff --git a/src/gcore/types/waap/custom_page_set.py b/src/gcore/types/waap/custom_page_set.py new file mode 100644 index 00000000..e8b26ae9 --- /dev/null +++ b/src/gcore/types/waap/custom_page_set.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .block_page_data import BlockPageData +from .captcha_page_data import CaptchaPageData +from .handshake_page_data import HandshakePageData +from .block_csrf_page_data import BlockCsrfPageData +from .cookie_disabled_page_data import CookieDisabledPageData +from .javascript_disabled_page_data import JavascriptDisabledPageData + +__all__ = ["CustomPageSet"] + + +class CustomPageSet(BaseModel): + id: int + """The ID of the custom page set""" + + name: str + """Name of the custom page set""" + + block: Optional[BlockPageData] = None + + block_csrf: Optional[BlockCsrfPageData] = None + + captcha: Optional[CaptchaPageData] = None + + cookie_disabled: Optional[CookieDisabledPageData] = None + + domains: Optional[List[int]] = None + """List of domain IDs that are associated with this page set""" + + handshake: Optional[HandshakePageData] = None + + javascript_disabled: Optional[JavascriptDisabledPageData] = None diff --git a/src/gcore/types/waap/custom_page_set_create_params.py b/src/gcore/types/waap/custom_page_set_create_params.py new file mode 100644 index 00000000..9ac2b9a8 --- /dev/null +++ b/src/gcore/types/waap/custom_page_set_create_params.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict + +from .block_page_data_param import BlockPageDataParam +from .captcha_page_data_param import CaptchaPageDataParam +from .handshake_page_data_param import HandshakePageDataParam +from .block_csrf_page_data_param import BlockCsrfPageDataParam +from .cookie_disabled_page_data_param import CookieDisabledPageDataParam +from .javascript_disabled_page_data_param import JavascriptDisabledPageDataParam + +__all__ = ["CustomPageSetCreateParams"] + + +class CustomPageSetCreateParams(TypedDict, total=False): + name: Required[str] + """Name of the custom page set""" + + block: Optional[BlockPageDataParam] + + block_csrf: Optional[BlockCsrfPageDataParam] + + captcha: Optional[CaptchaPageDataParam] + + cookie_disabled: Optional[CookieDisabledPageDataParam] + + domains: Optional[Iterable[int]] + """List of domain IDs that are associated with this page set""" + + handshake: Optional[HandshakePageDataParam] + + javascript_disabled: Optional[JavascriptDisabledPageDataParam] diff --git a/src/gcore/types/waap/custom_page_set_list_params.py b/src/gcore/types/waap/custom_page_set_list_params.py new file mode 100644 index 00000000..cad46fcc --- /dev/null +++ b/src/gcore/types/waap/custom_page_set_list_params.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal, TypedDict + +__all__ = ["CustomPageSetListParams"] + + +class CustomPageSetListParams(TypedDict, total=False): + ids: Iterable[int] + """Filter page sets based on their IDs""" + + limit: int + """Number of items to return""" + + name: str + """Filter page sets based on their name. Supports '\\**' as a wildcard character""" + + offset: int + """Number of items to skip""" + + ordering: Literal["name", "-name", "id", "-id"] + """Sort the response by given field.""" diff --git a/src/gcore/types/waap/custom_page_set_preview_params.py b/src/gcore/types/waap/custom_page_set_preview_params.py new file mode 100644 index 00000000..158b1a3a --- /dev/null +++ b/src/gcore/types/waap/custom_page_set_preview_params.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["CustomPageSetPreviewParams"] + + +class CustomPageSetPreviewParams(TypedDict, total=False): + page_type: Required[ + Literal[ + "block.html", + "block_csrf.html", + "captcha.html", + "cookieDisabled.html", + "handshake.html", + "javascriptDisabled.html", + ] + ] + """The type of the custom page""" + + error: Optional[str] + """Error message""" + + header: Optional[str] + """The text to display in the header of the custom page""" + + logo: Optional[str] + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: Optional[str] + """The text to display in the body of the custom page""" + + title: Optional[str] + """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/custom_page_set_update_params.py b/src/gcore/types/waap/custom_page_set_update_params.py new file mode 100644 index 00000000..2547532d --- /dev/null +++ b/src/gcore/types/waap/custom_page_set_update_params.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import TypedDict + +from .block_page_data_param import BlockPageDataParam +from .captcha_page_data_param import CaptchaPageDataParam +from .handshake_page_data_param import HandshakePageDataParam +from .block_csrf_page_data_param import BlockCsrfPageDataParam +from .cookie_disabled_page_data_param import CookieDisabledPageDataParam +from .javascript_disabled_page_data_param import JavascriptDisabledPageDataParam + +__all__ = ["CustomPageSetUpdateParams"] + + +class CustomPageSetUpdateParams(TypedDict, total=False): + block: Optional[BlockPageDataParam] + + block_csrf: Optional[BlockCsrfPageDataParam] + + captcha: Optional[CaptchaPageDataParam] + + cookie_disabled: Optional[CookieDisabledPageDataParam] + + domains: Optional[Iterable[int]] + """List of domain IDs that are associated with this page set""" + + handshake: Optional[HandshakePageDataParam] + + javascript_disabled: Optional[JavascriptDisabledPageDataParam] + + name: Optional[str] + """Name of the custom page set""" diff --git a/src/gcore/types/waap/customer_rule_state.py b/src/gcore/types/waap/customer_rule_state.py new file mode 100644 index 00000000..46b357fa --- /dev/null +++ b/src/gcore/types/waap/customer_rule_state.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["CustomerRuleState"] + +CustomerRuleState: TypeAlias = Literal["enable", "disable"] diff --git a/src/gcore/types/waap/domains/__init__.py b/src/gcore/types/waap/domains/__init__.py index 6eb0310c..181d3ca6 100644 --- a/src/gcore/types/waap/domains/__init__.py +++ b/src/gcore/types/waap/domains/__init__.py @@ -2,4 +2,18 @@ from __future__ import annotations +from .custom_rule import CustomRule as CustomRule +from .advanced_rule import AdvancedRule as AdvancedRule +from .firewall_rule import FirewallRule as FirewallRule from .setting_update_params import SettingUpdateParams as SettingUpdateParams +from .custom_rule_list_params import CustomRuleListParams as CustomRuleListParams +from .advanced_rule_list_params import AdvancedRuleListParams as AdvancedRuleListParams +from .custom_rule_create_params import CustomRuleCreateParams as CustomRuleCreateParams +from .custom_rule_update_params import CustomRuleUpdateParams as CustomRuleUpdateParams +from .firewall_rule_list_params import FirewallRuleListParams as FirewallRuleListParams +from .advanced_rule_create_params import AdvancedRuleCreateParams as AdvancedRuleCreateParams +from .advanced_rule_update_params import AdvancedRuleUpdateParams as AdvancedRuleUpdateParams +from .firewall_rule_create_params import FirewallRuleCreateParams as FirewallRuleCreateParams +from .firewall_rule_update_params import FirewallRuleUpdateParams as FirewallRuleUpdateParams +from .custom_rule_delete_multiple_params import CustomRuleDeleteMultipleParams as CustomRuleDeleteMultipleParams +from .firewall_rule_delete_multiple_params import FirewallRuleDeleteMultipleParams as FirewallRuleDeleteMultipleParams diff --git a/src/gcore/types/waap/domains/advanced_rule.py b/src/gcore/types/waap/domains/advanced_rule.py new file mode 100644 index 00000000..35587095 --- /dev/null +++ b/src/gcore/types/waap/domains/advanced_rule.py @@ -0,0 +1,83 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["AdvancedRule", "Action", "ActionBlock", "ActionTag"] + + +class ActionBlock(BaseModel): + action_duration: Optional[str] = None + """How long a rule's block action will apply to subsequent requests. + + Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or + 'd' to represent time format (seconds, minutes, hours, or days) + """ + + status_code: Optional[Literal[403, 405, 418, 429]] = None + """Designates the HTTP status code to deliver when a request is blocked.""" + + +class ActionTag(BaseModel): + tags: List[str] + """The list of user defined tags to tag the request with""" + + +class Action(BaseModel): + allow: Optional[object] = None + """The WAAP allowed the request""" + + block: Optional[ActionBlock] = None + """ + WAAP block action behavior could be configured with response status code and + action duration. + """ + + captcha: Optional[object] = None + """The WAAP presented the user with a captcha""" + + handshake: Optional[object] = None + """The WAAP performed automatic browser validation""" + + monitor: Optional[object] = None + """The WAAP monitored the request but took no action""" + + tag: Optional[ActionTag] = None + """WAAP tag action gets a list of tags to tag the request scope with""" + + +class AdvancedRule(BaseModel): + id: int + """The unique identifier for the rule""" + + action: Action + """The action that a WAAP rule takes when triggered""" + + enabled: bool + """Whether or not the rule is enabled""" + + name: str + """The name assigned to the rule""" + + source: str + """A CEL syntax expression that contains the rule's conditions. + + Allowed objects are: request, whois, session, response, tags, + `user_defined_tags`, `user_agent`, `client_data`. More info can be found here: + https://gcore.com/docs/waap/waap-rules/advanced-rules + """ + + description: Optional[str] = None + """The description assigned to the rule""" + + phase: Optional[Literal["access", "header_filter", "body_filter"]] = None + """The WAAP request/response phase for applying the rule. + + Default is "access". The "access" phase is responsible for modifying the request + before it is sent to the origin server. The "`header_filter`" phase is + responsible for modifying the HTTP headers of a response before they are sent + back to the client. The "`body_filter`" phase is responsible for modifying the + body of a response before it is sent back to the client. + """ diff --git a/src/gcore/types/waap/domains/advanced_rule_create_params.py b/src/gcore/types/waap/domains/advanced_rule_create_params.py new file mode 100644 index 00000000..52e32ad8 --- /dev/null +++ b/src/gcore/types/waap/domains/advanced_rule_create_params.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["AdvancedRuleCreateParams", "Action", "ActionBlock", "ActionTag"] + + +class AdvancedRuleCreateParams(TypedDict, total=False): + action: Required[Action] + """The action that a WAAP rule takes when triggered""" + + enabled: Required[bool] + """Whether or not the rule is enabled""" + + name: Required[str] + """The name assigned to the rule""" + + source: Required[str] + """A CEL syntax expression that contains the rule's conditions. + + Allowed objects are: request, whois, session, response, tags, + `user_defined_tags`, `user_agent`, `client_data`. More info can be found here: + https://gcore.com/docs/waap/waap-rules/advanced-rules + """ + + description: Optional[str] + """The description assigned to the rule""" + + phase: Optional[Literal["access", "header_filter", "body_filter"]] + """The WAAP request/response phase for applying the rule. + + Default is "access". The "access" phase is responsible for modifying the request + before it is sent to the origin server. The "`header_filter`" phase is + responsible for modifying the HTTP headers of a response before they are sent + back to the client. The "`body_filter`" phase is responsible for modifying the + body of a response before it is sent back to the client. + """ + + +class ActionBlock(TypedDict, total=False): + action_duration: Optional[str] + """How long a rule's block action will apply to subsequent requests. + + Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or + 'd' to represent time format (seconds, minutes, hours, or days) + """ + + status_code: Optional[Literal[403, 405, 418, 429]] + """Designates the HTTP status code to deliver when a request is blocked.""" + + +class ActionTag(TypedDict, total=False): + tags: Required[List[str]] + """The list of user defined tags to tag the request with""" + + +class Action(TypedDict, total=False): + allow: Optional[object] + """The WAAP allowed the request""" + + block: Optional[ActionBlock] + """ + WAAP block action behavior could be configured with response status code and + action duration. + """ + + captcha: Optional[object] + """The WAAP presented the user with a captcha""" + + handshake: Optional[object] + """The WAAP performed automatic browser validation""" + + monitor: Optional[object] + """The WAAP monitored the request but took no action""" + + tag: Optional[ActionTag] + """WAAP tag action gets a list of tags to tag the request scope with""" diff --git a/src/gcore/types/waap/domains/advanced_rule_list_params.py b/src/gcore/types/waap/domains/advanced_rule_list_params.py new file mode 100644 index 00000000..efb65e9e --- /dev/null +++ b/src/gcore/types/waap/domains/advanced_rule_list_params.py @@ -0,0 +1,58 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, TypedDict + +from ..rule_action_type import RuleActionType + +__all__ = ["AdvancedRuleListParams"] + + +class AdvancedRuleListParams(TypedDict, total=False): + action: RuleActionType + """Filter to refine results by specific actions""" + + description: str + """Filter rules based on their description. Supports '\\**' as a wildcard character.""" + + enabled: bool + """Filter rules based on their active status""" + + limit: int + """Number of items to return""" + + name: str + """Filter rules based on their name. Supports '\\**' as a wildcard character.""" + + offset: int + """Number of items to skip""" + + ordering: Optional[ + Literal[ + "id", + "name", + "description", + "enabled", + "action", + "phase", + "-id", + "-name", + "-description", + "-enabled", + "-action", + "-phase", + ] + ] + """Determine the field to order results by""" + + phase: Literal["access", "header_filter", "body_filter"] + """ + Filter rules based on the WAAP request/response phase for applying the rule. The + "access" phase is responsible for modifying the request before it is sent to the + origin server. The "`header_filter`" phase is responsible for modifying the HTTP + headers of a response before they are sent back to the client. The + "`body_filter`" phase is responsible for modifying the body of a response before + it is sent back to the client. + """ diff --git a/src/gcore/types/waap/domains/advanced_rule_update_params.py b/src/gcore/types/waap/domains/advanced_rule_update_params.py new file mode 100644 index 00000000..a592c6f8 --- /dev/null +++ b/src/gcore/types/waap/domains/advanced_rule_update_params.py @@ -0,0 +1,83 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["AdvancedRuleUpdateParams", "Action", "ActionBlock", "ActionTag"] + + +class AdvancedRuleUpdateParams(TypedDict, total=False): + domain_id: Required[int] + """The domain ID""" + + action: Optional[Action] + """The action that a WAAP rule takes when triggered""" + + description: Optional[str] + """The description assigned to the rule""" + + enabled: Optional[bool] + """Whether or not the rule is enabled""" + + name: Optional[str] + """The name assigned to the rule""" + + phase: Optional[Literal["access", "header_filter", "body_filter"]] + """ + The WAAP request/response phase for applying the rule. The "access" phase is + responsible for modifying the request before it is sent to the origin server. + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. The "`body_filter`" phase is + responsible for modifying the body of a response before it is sent back to the + client. + """ + + source: Optional[str] + """A CEL syntax expression that contains the rule's conditions. + + Allowed objects are: request, whois, session, response, tags, + `user_defined_tags`, `user_agent`, `client_data`. More info can be found here: + https://gcore.com/docs/waap/waap-rules/advanced-rules + """ + + +class ActionBlock(TypedDict, total=False): + action_duration: Optional[str] + """How long a rule's block action will apply to subsequent requests. + + Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or + 'd' to represent time format (seconds, minutes, hours, or days) + """ + + status_code: Optional[Literal[403, 405, 418, 429]] + """Designates the HTTP status code to deliver when a request is blocked.""" + + +class ActionTag(TypedDict, total=False): + tags: Required[List[str]] + """The list of user defined tags to tag the request with""" + + +class Action(TypedDict, total=False): + allow: Optional[object] + """The WAAP allowed the request""" + + block: Optional[ActionBlock] + """ + WAAP block action behavior could be configured with response status code and + action duration. + """ + + captcha: Optional[object] + """The WAAP presented the user with a captcha""" + + handshake: Optional[object] + """The WAAP performed automatic browser validation""" + + monitor: Optional[object] + """The WAAP monitored the request but took no action""" + + tag: Optional[ActionTag] + """WAAP tag action gets a list of tags to tag the request scope with""" diff --git a/src/gcore/types/waap/domains/custom_rule.py b/src/gcore/types/waap/domains/custom_rule.py new file mode 100644 index 00000000..d00a5348 --- /dev/null +++ b/src/gcore/types/waap/domains/custom_rule.py @@ -0,0 +1,373 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = [ + "CustomRule", + "Action", + "ActionBlock", + "ActionTag", + "Condition", + "ConditionContentType", + "ConditionCountry", + "ConditionFileExtension", + "ConditionHeader", + "ConditionHeaderExists", + "ConditionHTTPMethod", + "ConditionIP", + "ConditionIPRange", + "ConditionOrganization", + "ConditionOwnerTypes", + "ConditionRequestRate", + "ConditionResponseHeader", + "ConditionResponseHeaderExists", + "ConditionSessionRequestCount", + "ConditionTags", + "ConditionURL", + "ConditionUserAgent", + "ConditionUserDefinedTags", +] + + +class ActionBlock(BaseModel): + action_duration: Optional[str] = None + """How long a rule's block action will apply to subsequent requests. + + Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or + 'd' to represent time format (seconds, minutes, hours, or days) + """ + + status_code: Optional[Literal[403, 405, 418, 429]] = None + """Designates the HTTP status code to deliver when a request is blocked.""" + + +class ActionTag(BaseModel): + tags: List[str] + """The list of user defined tags to tag the request with""" + + +class Action(BaseModel): + allow: Optional[object] = None + """The WAAP allowed the request""" + + block: Optional[ActionBlock] = None + """ + WAAP block action behavior could be configured with response status code and + action duration. + """ + + captcha: Optional[object] = None + """The WAAP presented the user with a captcha""" + + handshake: Optional[object] = None + """The WAAP performed automatic browser validation""" + + monitor: Optional[object] = None + """The WAAP monitored the request but took no action""" + + tag: Optional[ActionTag] = None + """WAAP tag action gets a list of tags to tag the request scope with""" + + +class ConditionContentType(BaseModel): + content_type: List[str] + """The list of content types to match against""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionCountry(BaseModel): + country_code: List[str] + """ + A list of ISO 3166-1 alpha-2 formatted strings representing the countries to + match against + """ + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionFileExtension(BaseModel): + file_extension: List[str] + """The list of file extensions to match against""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionHeader(BaseModel): + header: str + """The request header name""" + + value: str + """The request header value""" + + match_type: Optional[Literal["Exact", "Contains"]] = None + """The type of matching condition for header and value.""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionHeaderExists(BaseModel): + header: str + """The request header name""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionHTTPMethod(BaseModel): + http_method: Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"] + """HTTP methods and descriptions Methods from the following RFCs are all observed: + + - RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616 + - RFC 5789: PATCH Method for HTTP + """ + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionIP(BaseModel): + ip_address: str + """A single IPv4 or IPv6 address""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionIPRange(BaseModel): + lower_bound: str + """The lower bound IPv4 or IPv6 address to match against""" + + upper_bound: str + """The upper bound IPv4 or IPv6 address to match against""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionOrganization(BaseModel): + organization: str + """The organization to match against""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionOwnerTypes(BaseModel): + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + owner_types: Optional[ + List[ + Literal[ + "COMMERCIAL", + "EDUCATIONAL", + "GOVERNMENT", + "HOSTING_SERVICES", + "ISP", + "MOBILE_NETWORK", + "NETWORK", + "RESERVED", + ] + ] + ] = None + """ + Match the type of organization that owns the IP address making an incoming + request + """ + + +class ConditionRequestRate(BaseModel): + path_pattern: str + """A regular expression matching the URL path of the incoming request""" + + requests: int + """ + The number of incoming requests over the given time that can trigger a request + rate condition + """ + + time: int + """ + The number of seconds that the WAAP measures incoming requests over before + triggering a request rate condition + """ + + http_methods: Optional[ + List[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] + ] = None + """Possible HTTP request methods that can trigger a request rate condition""" + + ips: Optional[List[str]] = None + """A list of source IPs that can trigger a request rate condition""" + + user_defined_tag: Optional[str] = None + """ + A user-defined tag that can be included in incoming requests and used to trigger + a request rate condition + """ + + +class ConditionResponseHeader(BaseModel): + header: str + """The response header name""" + + value: str + """The response header value""" + + match_type: Optional[Literal["Exact", "Contains"]] = None + """The type of matching condition for header and value.""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionResponseHeaderExists(BaseModel): + header: str + """The response header name""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionSessionRequestCount(BaseModel): + request_count: int + """The number of dynamic requests in the session""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionTags(BaseModel): + tags: List[str] + """A list of tags to match against the request tags""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionURL(BaseModel): + url: str + """The pattern to match against the request URL. + + If `match_type` is `Regex` the value must be a valid regular expression that + does not use lookahead or lookbehind constructs + """ + + match_type: Optional[Literal["Exact", "Contains", "Regex"]] = None + """The type of matching condition.""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionUserAgent(BaseModel): + user_agent: str + """The user agent value to match""" + + match_type: Optional[Literal["Exact", "Contains"]] = None + """The type of matching condition.""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionUserDefinedTags(BaseModel): + tags: List[str] + """A list of user-defined tags to match against the request tags""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class Condition(BaseModel): + content_type: Optional[ConditionContentType] = None + """Match the requested Content-Type""" + + country: Optional[ConditionCountry] = None + """Match the country that the request originated from""" + + file_extension: Optional[ConditionFileExtension] = None + """Match the incoming file extension""" + + header: Optional[ConditionHeader] = None + """Match an incoming request header""" + + header_exists: Optional[ConditionHeaderExists] = None + """Match when an incoming request header is present""" + + http_method: Optional[ConditionHTTPMethod] = None + """Match the incoming HTTP method""" + + ip: Optional[ConditionIP] = None + """Match the incoming request against a single IP address""" + + ip_range: Optional[ConditionIPRange] = None + """Match the incoming request against an IP range""" + + organization: Optional[ConditionOrganization] = None + """ + Match the organization the request originated from, as determined by a WHOIS + lookup of the requesting IP + """ + + owner_types: Optional[ConditionOwnerTypes] = None + """ + Match the type of organization that owns the IP address making an incoming + request + """ + + request_rate: Optional[ConditionRequestRate] = None + """Match the rate at which requests come in that match certain conditions""" + + response_header: Optional[ConditionResponseHeader] = None + """Match a response header""" + + response_header_exists: Optional[ConditionResponseHeaderExists] = None + """Match when a response header is present""" + + session_request_count: Optional[ConditionSessionRequestCount] = None + """Match the number of dynamic page requests made in a WAAP session""" + + tags: Optional[ConditionTags] = None + """Matches requests based on specified tags""" + + url: Optional[ConditionURL] = None + """Match the incoming request URL""" + + user_agent: Optional[ConditionUserAgent] = None + """Match the user agent making the request""" + + user_defined_tags: Optional[ConditionUserDefinedTags] = None + """Matches requests based on user-defined tags""" + + +class CustomRule(BaseModel): + id: int + """The unique identifier for the rule""" + + action: Action + """The action that a WAAP rule takes when triggered""" + + conditions: List[Condition] + """The conditions required for the WAAP engine to trigger the rule. + + Rules may have between 1 and 5 conditions. All conditions must pass for the rule + to trigger + """ + + enabled: bool + """Whether or not the rule is enabled""" + + name: str + """The name assigned to the rule""" + + description: Optional[str] = None + """The description assigned to the rule""" diff --git a/src/gcore/types/waap/domains/custom_rule_create_params.py b/src/gcore/types/waap/domains/custom_rule_create_params.py new file mode 100644 index 00000000..da009154 --- /dev/null +++ b/src/gcore/types/waap/domains/custom_rule_create_params.py @@ -0,0 +1,368 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = [ + "CustomRuleCreateParams", + "Action", + "ActionBlock", + "ActionTag", + "Condition", + "ConditionContentType", + "ConditionCountry", + "ConditionFileExtension", + "ConditionHeader", + "ConditionHeaderExists", + "ConditionHTTPMethod", + "ConditionIP", + "ConditionIPRange", + "ConditionOrganization", + "ConditionOwnerTypes", + "ConditionRequestRate", + "ConditionResponseHeader", + "ConditionResponseHeaderExists", + "ConditionSessionRequestCount", + "ConditionTags", + "ConditionURL", + "ConditionUserAgent", + "ConditionUserDefinedTags", +] + + +class CustomRuleCreateParams(TypedDict, total=False): + action: Required[Action] + """The action that a WAAP rule takes when triggered""" + + conditions: Required[Iterable[Condition]] + """The conditions required for the WAAP engine to trigger the rule. + + Rules may have between 1 and 5 conditions. All conditions must pass for the rule + to trigger + """ + + enabled: Required[bool] + """Whether or not the rule is enabled""" + + name: Required[str] + """The name assigned to the rule""" + + description: Optional[str] + """The description assigned to the rule""" + + +class ActionBlock(TypedDict, total=False): + action_duration: Optional[str] + """How long a rule's block action will apply to subsequent requests. + + Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or + 'd' to represent time format (seconds, minutes, hours, or days) + """ + + status_code: Optional[Literal[403, 405, 418, 429]] + """Designates the HTTP status code to deliver when a request is blocked.""" + + +class ActionTag(TypedDict, total=False): + tags: Required[List[str]] + """The list of user defined tags to tag the request with""" + + +class Action(TypedDict, total=False): + allow: Optional[object] + """The WAAP allowed the request""" + + block: Optional[ActionBlock] + """ + WAAP block action behavior could be configured with response status code and + action duration. + """ + + captcha: Optional[object] + """The WAAP presented the user with a captcha""" + + handshake: Optional[object] + """The WAAP performed automatic browser validation""" + + monitor: Optional[object] + """The WAAP monitored the request but took no action""" + + tag: Optional[ActionTag] + """WAAP tag action gets a list of tags to tag the request scope with""" + + +class ConditionContentType(TypedDict, total=False): + content_type: Required[List[str]] + """The list of content types to match against""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionCountry(TypedDict, total=False): + country_code: Required[List[str]] + """ + A list of ISO 3166-1 alpha-2 formatted strings representing the countries to + match against + """ + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionFileExtension(TypedDict, total=False): + file_extension: Required[List[str]] + """The list of file extensions to match against""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionHeader(TypedDict, total=False): + header: Required[str] + """The request header name""" + + value: Required[str] + """The request header value""" + + match_type: Literal["Exact", "Contains"] + """The type of matching condition for header and value.""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionHeaderExists(TypedDict, total=False): + header: Required[str] + """The request header name""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionHTTPMethod(TypedDict, total=False): + http_method: Required[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] + """HTTP methods and descriptions Methods from the following RFCs are all observed: + + - RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616 + - RFC 5789: PATCH Method for HTTP + """ + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionIP(TypedDict, total=False): + ip_address: Required[str] + """A single IPv4 or IPv6 address""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionIPRange(TypedDict, total=False): + lower_bound: Required[str] + """The lower bound IPv4 or IPv6 address to match against""" + + upper_bound: Required[str] + """The upper bound IPv4 or IPv6 address to match against""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionOrganization(TypedDict, total=False): + organization: Required[str] + """The organization to match against""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionOwnerTypes(TypedDict, total=False): + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + owner_types: List[ + Literal[ + "COMMERCIAL", + "EDUCATIONAL", + "GOVERNMENT", + "HOSTING_SERVICES", + "ISP", + "MOBILE_NETWORK", + "NETWORK", + "RESERVED", + ] + ] + """ + Match the type of organization that owns the IP address making an incoming + request + """ + + +class ConditionRequestRate(TypedDict, total=False): + path_pattern: Required[str] + """A regular expression matching the URL path of the incoming request""" + + requests: Required[int] + """ + The number of incoming requests over the given time that can trigger a request + rate condition + """ + + time: Required[int] + """ + The number of seconds that the WAAP measures incoming requests over before + triggering a request rate condition + """ + + http_methods: Optional[ + List[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] + ] + """Possible HTTP request methods that can trigger a request rate condition""" + + ips: Optional[List[str]] + """A list of source IPs that can trigger a request rate condition""" + + user_defined_tag: Optional[str] + """ + A user-defined tag that can be included in incoming requests and used to trigger + a request rate condition + """ + + +class ConditionResponseHeader(TypedDict, total=False): + header: Required[str] + """The response header name""" + + value: Required[str] + """The response header value""" + + match_type: Literal["Exact", "Contains"] + """The type of matching condition for header and value.""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionResponseHeaderExists(TypedDict, total=False): + header: Required[str] + """The response header name""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionSessionRequestCount(TypedDict, total=False): + request_count: Required[int] + """The number of dynamic requests in the session""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionTags(TypedDict, total=False): + tags: Required[List[str]] + """A list of tags to match against the request tags""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionURL(TypedDict, total=False): + url: Required[str] + """The pattern to match against the request URL. + + If `match_type` is `Regex` the value must be a valid regular expression that + does not use lookahead or lookbehind constructs + """ + + match_type: Literal["Exact", "Contains", "Regex"] + """The type of matching condition.""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionUserAgent(TypedDict, total=False): + user_agent: Required[str] + """The user agent value to match""" + + match_type: Literal["Exact", "Contains"] + """The type of matching condition.""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionUserDefinedTags(TypedDict, total=False): + tags: Required[List[str]] + """A list of user-defined tags to match against the request tags""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class Condition(TypedDict, total=False): + content_type: Optional[ConditionContentType] + """Match the requested Content-Type""" + + country: Optional[ConditionCountry] + """Match the country that the request originated from""" + + file_extension: Optional[ConditionFileExtension] + """Match the incoming file extension""" + + header: Optional[ConditionHeader] + """Match an incoming request header""" + + header_exists: Optional[ConditionHeaderExists] + """Match when an incoming request header is present""" + + http_method: Optional[ConditionHTTPMethod] + """Match the incoming HTTP method""" + + ip: Optional[ConditionIP] + """Match the incoming request against a single IP address""" + + ip_range: Optional[ConditionIPRange] + """Match the incoming request against an IP range""" + + organization: Optional[ConditionOrganization] + """ + Match the organization the request originated from, as determined by a WHOIS + lookup of the requesting IP + """ + + owner_types: Optional[ConditionOwnerTypes] + """ + Match the type of organization that owns the IP address making an incoming + request + """ + + request_rate: Optional[ConditionRequestRate] + """Match the rate at which requests come in that match certain conditions""" + + response_header: Optional[ConditionResponseHeader] + """Match a response header""" + + response_header_exists: Optional[ConditionResponseHeaderExists] + """Match when a response header is present""" + + session_request_count: Optional[ConditionSessionRequestCount] + """Match the number of dynamic page requests made in a WAAP session""" + + tags: Optional[ConditionTags] + """Matches requests based on specified tags""" + + url: Optional[ConditionURL] + """Match the incoming request URL""" + + user_agent: Optional[ConditionUserAgent] + """Match the user agent making the request""" + + user_defined_tags: Optional[ConditionUserDefinedTags] + """Matches requests based on user-defined tags""" diff --git a/src/gcore/types/waap/domains/custom_rule_delete_multiple_params.py b/src/gcore/types/waap/domains/custom_rule_delete_multiple_params.py new file mode 100644 index 00000000..2aabff0c --- /dev/null +++ b/src/gcore/types/waap/domains/custom_rule_delete_multiple_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["CustomRuleDeleteMultipleParams"] + + +class CustomRuleDeleteMultipleParams(TypedDict, total=False): + rule_ids: Required[Iterable[int]] + """The IDs of the rules to delete""" diff --git a/src/gcore/types/waap/domains/custom_rule_list_params.py b/src/gcore/types/waap/domains/custom_rule_list_params.py new file mode 100644 index 00000000..e1761e64 --- /dev/null +++ b/src/gcore/types/waap/domains/custom_rule_list_params.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, TypedDict + +from ..rule_action_type import RuleActionType + +__all__ = ["CustomRuleListParams"] + + +class CustomRuleListParams(TypedDict, total=False): + action: RuleActionType + """Filter to refine results by specific actions""" + + description: str + """Filter rules based on their description. Supports '\\**' as a wildcard character.""" + + enabled: bool + """Filter rules based on their active status""" + + limit: int + """Number of items to return""" + + name: str + """Filter rules based on their name. Supports '\\**' as a wildcard character.""" + + offset: int + """Number of items to skip""" + + ordering: Optional[ + Literal["id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action"] + ] + """Determine the field to order results by""" diff --git a/src/gcore/types/waap/domains/custom_rule_update_params.py b/src/gcore/types/waap/domains/custom_rule_update_params.py new file mode 100644 index 00000000..8a223135 --- /dev/null +++ b/src/gcore/types/waap/domains/custom_rule_update_params.py @@ -0,0 +1,371 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = [ + "CustomRuleUpdateParams", + "Action", + "ActionBlock", + "ActionTag", + "Condition", + "ConditionContentType", + "ConditionCountry", + "ConditionFileExtension", + "ConditionHeader", + "ConditionHeaderExists", + "ConditionHTTPMethod", + "ConditionIP", + "ConditionIPRange", + "ConditionOrganization", + "ConditionOwnerTypes", + "ConditionRequestRate", + "ConditionResponseHeader", + "ConditionResponseHeaderExists", + "ConditionSessionRequestCount", + "ConditionTags", + "ConditionURL", + "ConditionUserAgent", + "ConditionUserDefinedTags", +] + + +class CustomRuleUpdateParams(TypedDict, total=False): + domain_id: Required[int] + """The domain ID""" + + action: Optional[Action] + """The action that a WAAP rule takes when triggered""" + + conditions: Optional[Iterable[Condition]] + """The conditions required for the WAAP engine to trigger the rule. + + Rules may have between 1 and 5 conditions. All conditions must pass for the rule + to trigger + """ + + description: Optional[str] + """The description assigned to the rule""" + + enabled: Optional[bool] + """Whether or not the rule is enabled""" + + name: Optional[str] + """The name assigned to the rule""" + + +class ActionBlock(TypedDict, total=False): + action_duration: Optional[str] + """How long a rule's block action will apply to subsequent requests. + + Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or + 'd' to represent time format (seconds, minutes, hours, or days) + """ + + status_code: Optional[Literal[403, 405, 418, 429]] + """Designates the HTTP status code to deliver when a request is blocked.""" + + +class ActionTag(TypedDict, total=False): + tags: Required[List[str]] + """The list of user defined tags to tag the request with""" + + +class Action(TypedDict, total=False): + allow: Optional[object] + """The WAAP allowed the request""" + + block: Optional[ActionBlock] + """ + WAAP block action behavior could be configured with response status code and + action duration. + """ + + captcha: Optional[object] + """The WAAP presented the user with a captcha""" + + handshake: Optional[object] + """The WAAP performed automatic browser validation""" + + monitor: Optional[object] + """The WAAP monitored the request but took no action""" + + tag: Optional[ActionTag] + """WAAP tag action gets a list of tags to tag the request scope with""" + + +class ConditionContentType(TypedDict, total=False): + content_type: Required[List[str]] + """The list of content types to match against""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionCountry(TypedDict, total=False): + country_code: Required[List[str]] + """ + A list of ISO 3166-1 alpha-2 formatted strings representing the countries to + match against + """ + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionFileExtension(TypedDict, total=False): + file_extension: Required[List[str]] + """The list of file extensions to match against""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionHeader(TypedDict, total=False): + header: Required[str] + """The request header name""" + + value: Required[str] + """The request header value""" + + match_type: Literal["Exact", "Contains"] + """The type of matching condition for header and value.""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionHeaderExists(TypedDict, total=False): + header: Required[str] + """The request header name""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionHTTPMethod(TypedDict, total=False): + http_method: Required[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] + """HTTP methods and descriptions Methods from the following RFCs are all observed: + + - RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616 + - RFC 5789: PATCH Method for HTTP + """ + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionIP(TypedDict, total=False): + ip_address: Required[str] + """A single IPv4 or IPv6 address""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionIPRange(TypedDict, total=False): + lower_bound: Required[str] + """The lower bound IPv4 or IPv6 address to match against""" + + upper_bound: Required[str] + """The upper bound IPv4 or IPv6 address to match against""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionOrganization(TypedDict, total=False): + organization: Required[str] + """The organization to match against""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionOwnerTypes(TypedDict, total=False): + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + owner_types: List[ + Literal[ + "COMMERCIAL", + "EDUCATIONAL", + "GOVERNMENT", + "HOSTING_SERVICES", + "ISP", + "MOBILE_NETWORK", + "NETWORK", + "RESERVED", + ] + ] + """ + Match the type of organization that owns the IP address making an incoming + request + """ + + +class ConditionRequestRate(TypedDict, total=False): + path_pattern: Required[str] + """A regular expression matching the URL path of the incoming request""" + + requests: Required[int] + """ + The number of incoming requests over the given time that can trigger a request + rate condition + """ + + time: Required[int] + """ + The number of seconds that the WAAP measures incoming requests over before + triggering a request rate condition + """ + + http_methods: Optional[ + List[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] + ] + """Possible HTTP request methods that can trigger a request rate condition""" + + ips: Optional[List[str]] + """A list of source IPs that can trigger a request rate condition""" + + user_defined_tag: Optional[str] + """ + A user-defined tag that can be included in incoming requests and used to trigger + a request rate condition + """ + + +class ConditionResponseHeader(TypedDict, total=False): + header: Required[str] + """The response header name""" + + value: Required[str] + """The response header value""" + + match_type: Literal["Exact", "Contains"] + """The type of matching condition for header and value.""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionResponseHeaderExists(TypedDict, total=False): + header: Required[str] + """The response header name""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionSessionRequestCount(TypedDict, total=False): + request_count: Required[int] + """The number of dynamic requests in the session""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionTags(TypedDict, total=False): + tags: Required[List[str]] + """A list of tags to match against the request tags""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionURL(TypedDict, total=False): + url: Required[str] + """The pattern to match against the request URL. + + If `match_type` is `Regex` the value must be a valid regular expression that + does not use lookahead or lookbehind constructs + """ + + match_type: Literal["Exact", "Contains", "Regex"] + """The type of matching condition.""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionUserAgent(TypedDict, total=False): + user_agent: Required[str] + """The user agent value to match""" + + match_type: Literal["Exact", "Contains"] + """The type of matching condition.""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionUserDefinedTags(TypedDict, total=False): + tags: Required[List[str]] + """A list of user-defined tags to match against the request tags""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class Condition(TypedDict, total=False): + content_type: Optional[ConditionContentType] + """Match the requested Content-Type""" + + country: Optional[ConditionCountry] + """Match the country that the request originated from""" + + file_extension: Optional[ConditionFileExtension] + """Match the incoming file extension""" + + header: Optional[ConditionHeader] + """Match an incoming request header""" + + header_exists: Optional[ConditionHeaderExists] + """Match when an incoming request header is present""" + + http_method: Optional[ConditionHTTPMethod] + """Match the incoming HTTP method""" + + ip: Optional[ConditionIP] + """Match the incoming request against a single IP address""" + + ip_range: Optional[ConditionIPRange] + """Match the incoming request against an IP range""" + + organization: Optional[ConditionOrganization] + """ + Match the organization the request originated from, as determined by a WHOIS + lookup of the requesting IP + """ + + owner_types: Optional[ConditionOwnerTypes] + """ + Match the type of organization that owns the IP address making an incoming + request + """ + + request_rate: Optional[ConditionRequestRate] + """Match the rate at which requests come in that match certain conditions""" + + response_header: Optional[ConditionResponseHeader] + """Match a response header""" + + response_header_exists: Optional[ConditionResponseHeaderExists] + """Match when a response header is present""" + + session_request_count: Optional[ConditionSessionRequestCount] + """Match the number of dynamic page requests made in a WAAP session""" + + tags: Optional[ConditionTags] + """Matches requests based on specified tags""" + + url: Optional[ConditionURL] + """Match the incoming request URL""" + + user_agent: Optional[ConditionUserAgent] + """Match the user agent making the request""" + + user_defined_tags: Optional[ConditionUserDefinedTags] + """Matches requests based on user-defined tags""" diff --git a/src/gcore/types/waap/domains/firewall_rule.py b/src/gcore/types/waap/domains/firewall_rule.py new file mode 100644 index 00000000..97a189d8 --- /dev/null +++ b/src/gcore/types/waap/domains/firewall_rule.py @@ -0,0 +1,78 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["FirewallRule", "Action", "ActionBlock", "Condition", "ConditionIP", "ConditionIPRange"] + + +class ActionBlock(BaseModel): + action_duration: Optional[str] = None + """How long a rule's block action will apply to subsequent requests. + + Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or + 'd' to represent time format (seconds, minutes, hours, or days) + """ + + status_code: Optional[Literal[403, 405, 418, 429]] = None + """Designates the HTTP status code to deliver when a request is blocked.""" + + +class Action(BaseModel): + allow: Optional[object] = None + """The WAAP allowed the request""" + + block: Optional[ActionBlock] = None + """ + WAAP block action behavior could be configured with response status code and + action duration. + """ + + +class ConditionIP(BaseModel): + ip_address: str + """A single IPv4 or IPv6 address""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionIPRange(BaseModel): + lower_bound: str + """The lower bound IPv4 or IPv6 address to match against""" + + upper_bound: str + """The upper bound IPv4 or IPv6 address to match against""" + + negation: Optional[bool] = None + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class Condition(BaseModel): + ip: Optional[ConditionIP] = None + """Match the incoming request against a single IP address""" + + ip_range: Optional[ConditionIPRange] = None + """Match the incoming request against an IP range""" + + +class FirewallRule(BaseModel): + id: int + """The unique identifier of the rule""" + + action: Action + """The action that a firewall rule takes when triggered""" + + conditions: List[Condition] + """The condition required for the WAAP engine to trigger the rule.""" + + enabled: bool + """Whether or not the rule is enabled""" + + name: str + """The name assigned to the rule""" + + description: Optional[str] = None + """The description assigned to the rule""" diff --git a/src/gcore/types/waap/domains/firewall_rule_create_params.py b/src/gcore/types/waap/domains/firewall_rule_create_params.py new file mode 100644 index 00000000..c56a608d --- /dev/null +++ b/src/gcore/types/waap/domains/firewall_rule_create_params.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["FirewallRuleCreateParams", "Action", "ActionBlock", "Condition", "ConditionIP", "ConditionIPRange"] + + +class FirewallRuleCreateParams(TypedDict, total=False): + action: Required[Action] + """The action that a firewall rule takes when triggered""" + + conditions: Required[Iterable[Condition]] + """The condition required for the WAAP engine to trigger the rule.""" + + enabled: Required[bool] + """Whether or not the rule is enabled""" + + name: Required[str] + """The name assigned to the rule""" + + description: Optional[str] + """The description assigned to the rule""" + + +class ActionBlock(TypedDict, total=False): + action_duration: Optional[str] + """How long a rule's block action will apply to subsequent requests. + + Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or + 'd' to represent time format (seconds, minutes, hours, or days) + """ + + status_code: Optional[Literal[403, 405, 418, 429]] + """Designates the HTTP status code to deliver when a request is blocked.""" + + +class Action(TypedDict, total=False): + allow: Optional[object] + """The WAAP allowed the request""" + + block: Optional[ActionBlock] + """ + WAAP block action behavior could be configured with response status code and + action duration. + """ + + +class ConditionIP(TypedDict, total=False): + ip_address: Required[str] + """A single IPv4 or IPv6 address""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionIPRange(TypedDict, total=False): + lower_bound: Required[str] + """The lower bound IPv4 or IPv6 address to match against""" + + upper_bound: Required[str] + """The upper bound IPv4 or IPv6 address to match against""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class Condition(TypedDict, total=False): + ip: Optional[ConditionIP] + """Match the incoming request against a single IP address""" + + ip_range: Optional[ConditionIPRange] + """Match the incoming request against an IP range""" diff --git a/src/gcore/types/waap/domains/firewall_rule_delete_multiple_params.py b/src/gcore/types/waap/domains/firewall_rule_delete_multiple_params.py new file mode 100644 index 00000000..5228c20a --- /dev/null +++ b/src/gcore/types/waap/domains/firewall_rule_delete_multiple_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["FirewallRuleDeleteMultipleParams"] + + +class FirewallRuleDeleteMultipleParams(TypedDict, total=False): + rule_ids: Required[Iterable[int]] + """The IDs of the rules to delete""" diff --git a/src/gcore/types/waap/domains/firewall_rule_list_params.py b/src/gcore/types/waap/domains/firewall_rule_list_params.py new file mode 100644 index 00000000..29563ec2 --- /dev/null +++ b/src/gcore/types/waap/domains/firewall_rule_list_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["FirewallRuleListParams"] + + +class FirewallRuleListParams(TypedDict, total=False): + action: Literal["allow", "block"] + """Filter to refine results by specific firewall actions""" + + description: str + """Filter rules based on their description. Supports '\\**' as a wildcard character.""" + + enabled: bool + """Filter rules based on their active status""" + + limit: int + """Number of items to return""" + + name: str + """Filter rules based on their name. Supports '\\**' as a wildcard character.""" + + offset: int + """Number of items to skip""" + + ordering: Optional[ + Literal["id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action"] + ] + """Determine the field to order results by""" diff --git a/src/gcore/types/waap/domains/firewall_rule_update_params.py b/src/gcore/types/waap/domains/firewall_rule_update_params.py new file mode 100644 index 00000000..ca5eb4fa --- /dev/null +++ b/src/gcore/types/waap/domains/firewall_rule_update_params.py @@ -0,0 +1,78 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["FirewallRuleUpdateParams", "Action", "ActionBlock", "Condition", "ConditionIP", "ConditionIPRange"] + + +class FirewallRuleUpdateParams(TypedDict, total=False): + domain_id: Required[int] + """The domain ID""" + + action: Optional[Action] + """The action that a firewall rule takes when triggered""" + + conditions: Optional[Iterable[Condition]] + """The condition required for the WAAP engine to trigger the rule.""" + + description: Optional[str] + """The description assigned to the rule""" + + enabled: Optional[bool] + """Whether or not the rule is enabled""" + + name: Optional[str] + """The name assigned to the rule""" + + +class ActionBlock(TypedDict, total=False): + action_duration: Optional[str] + """How long a rule's block action will apply to subsequent requests. + + Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or + 'd' to represent time format (seconds, minutes, hours, or days) + """ + + status_code: Optional[Literal[403, 405, 418, 429]] + """Designates the HTTP status code to deliver when a request is blocked.""" + + +class Action(TypedDict, total=False): + allow: Optional[object] + """The WAAP allowed the request""" + + block: Optional[ActionBlock] + """ + WAAP block action behavior could be configured with response status code and + action duration. + """ + + +class ConditionIP(TypedDict, total=False): + ip_address: Required[str] + """A single IPv4 or IPv6 address""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class ConditionIPRange(TypedDict, total=False): + lower_bound: Required[str] + """The lower bound IPv4 or IPv6 address to match against""" + + upper_bound: Required[str] + """The upper bound IPv4 or IPv6 address to match against""" + + negation: bool + """Whether or not to apply a boolean NOT operation to the rule's condition""" + + +class Condition(TypedDict, total=False): + ip: Optional[ConditionIP] + """Match the incoming request against a single IP address""" + + ip_range: Optional[ConditionIPRange] + """Match the incoming request against an IP range""" diff --git a/src/gcore/types/waap/handshake_page_data.py b/src/gcore/types/waap/handshake_page_data.py new file mode 100644 index 00000000..9e27d565 --- /dev/null +++ b/src/gcore/types/waap/handshake_page_data.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["HandshakePageData"] + + +class HandshakePageData(BaseModel): + enabled: bool + """Indicates whether the custom custom page is active or inactive""" + + header: Optional[str] = None + """The text to display in the header of the custom page""" + + logo: Optional[str] = None + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + title: Optional[str] = None + """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/handshake_page_data_param.py b/src/gcore/types/waap/handshake_page_data_param.py new file mode 100644 index 00000000..bb43c216 --- /dev/null +++ b/src/gcore/types/waap/handshake_page_data_param.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["HandshakePageDataParam"] + + +class HandshakePageDataParam(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + logo: str + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + title: str + """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/javascript_disabled_page_data.py b/src/gcore/types/waap/javascript_disabled_page_data.py new file mode 100644 index 00000000..7e89d02c --- /dev/null +++ b/src/gcore/types/waap/javascript_disabled_page_data.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["JavascriptDisabledPageData"] + + +class JavascriptDisabledPageData(BaseModel): + enabled: bool + """Indicates whether the custom custom page is active or inactive""" + + header: Optional[str] = None + """The text to display in the header of the custom page""" + + text: Optional[str] = None + """The text to display in the body of the custom page""" diff --git a/src/gcore/types/waap/javascript_disabled_page_data_param.py b/src/gcore/types/waap/javascript_disabled_page_data_param.py new file mode 100644 index 00000000..49935173 --- /dev/null +++ b/src/gcore/types/waap/javascript_disabled_page_data_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_extensions import Required, TypedDict + +__all__ = ["JavascriptDisabledPageDataParam"] + + +class JavascriptDisabledPageDataParam(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + text: str + """The text to display in the body of the custom page""" diff --git a/src/gcore/types/waap/organization.py b/src/gcore/types/waap/organization.py new file mode 100644 index 00000000..8ea95b60 --- /dev/null +++ b/src/gcore/types/waap/organization.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["Organization"] + + +class Organization(BaseModel): + id: int + """The ID of an organization""" + + name: str + """The name of an organization""" diff --git a/src/gcore/types/waap/organization_list_params.py b/src/gcore/types/waap/organization_list_params.py new file mode 100644 index 00000000..979b7b27 --- /dev/null +++ b/src/gcore/types/waap/organization_list_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["OrganizationListParams"] + + +class OrganizationListParams(TypedDict, total=False): + limit: int + """Number of items to return""" + + name: str + """Filter organizations by their name. Supports '\\**' as a wildcard character.""" + + offset: int + """Number of items to skip""" + + ordering: Optional[Literal["name", "id", "-name", "-id"]] + """Determine the field to order results by""" diff --git a/src/gcore/types/waap/preview_custom_page.py b/src/gcore/types/waap/preview_custom_page.py new file mode 100644 index 00000000..499e4c2f --- /dev/null +++ b/src/gcore/types/waap/preview_custom_page.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["PreviewCustomPage"] + + +class PreviewCustomPage(BaseModel): + html: str + """HTML content of the custom page""" diff --git a/src/gcore/types/waap/quota_item.py b/src/gcore/types/waap/quota_item.py new file mode 100644 index 00000000..7a2144b2 --- /dev/null +++ b/src/gcore/types/waap/quota_item.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["QuotaItem"] + + +class QuotaItem(BaseModel): + allowed: int + """The maximum allowed number of this resource""" + + current: int + """The current number of this resource""" diff --git a/src/gcore/types/waap/rule_action_type.py b/src/gcore/types/waap/rule_action_type.py new file mode 100644 index 00000000..44a6d3ec --- /dev/null +++ b/src/gcore/types/waap/rule_action_type.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["RuleActionType"] + +RuleActionType: TypeAlias = Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] diff --git a/src/gcore/types/waap/statistic_get_usage_series_params.py b/src/gcore/types/waap/statistic_get_usage_series_params.py new file mode 100644 index 00000000..104e23a9 --- /dev/null +++ b/src/gcore/types/waap/statistic_get_usage_series_params.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetUsageSeriesParams"] + + +class StatisticGetUsageSeriesParams(TypedDict, total=False): + from_: Required[Annotated[Union[str, datetime], PropertyInfo(alias="from", format="iso8601")]] + """Beginning of the requested time period (ISO 8601 format, UTC)""" + + granularity: Required[Literal["1h", "1d"]] + """Duration of the time blocks into which the data will be divided.""" + + metrics: Required[List[Literal["total_bytes", "total_requests"]]] + """List of metric types to retrieve statistics for.""" + + to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """End of the requested time period (ISO 8601 format, UTC)""" diff --git a/src/gcore/types/waap/statistic_item.py b/src/gcore/types/waap/statistic_item.py new file mode 100644 index 00000000..db69ea06 --- /dev/null +++ b/src/gcore/types/waap/statistic_item.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["StatisticItem"] + + +class StatisticItem(BaseModel): + date_time: datetime + """The date and time for the statistic in ISO 8601 format""" + + value: int + """The value for the statistic. + + If there is no data for the given time, the value will be 0. + """ diff --git a/src/gcore/types/waap/statistics_series.py b/src/gcore/types/waap/statistics_series.py new file mode 100644 index 00000000..9f429a6a --- /dev/null +++ b/src/gcore/types/waap/statistics_series.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 .statistic_item import StatisticItem + +__all__ = ["StatisticsSeries"] + + +class StatisticsSeries(BaseModel): + total_bytes: Optional[List[StatisticItem]] = None + """Will be returned if `total_bytes` is requested in the metrics parameter""" + + total_requests: Optional[List[StatisticItem]] = None + """Will be included if `total_requests` is requested in the metrics parameter""" diff --git a/src/gcore/types/waap/tag.py b/src/gcore/types/waap/tag.py new file mode 100644 index 00000000..9e2db74e --- /dev/null +++ b/src/gcore/types/waap/tag.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["Tag"] + + +class Tag(BaseModel): + description: str + """A tag's human readable description""" + + name: str + """The name of a tag that should be used in a WAAP rule condition""" + + readable_name: str + """The display name of the tag""" diff --git a/src/gcore/types/waap/tag_list_params.py b/src/gcore/types/waap/tag_list_params.py new file mode 100644 index 00000000..5ff06753 --- /dev/null +++ b/src/gcore/types/waap/tag_list_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["TagListParams"] + + +class TagListParams(TypedDict, total=False): + limit: int + """Number of items to return""" + + name: str + """Filter tags by their name. Supports '\\**' as a wildcard character.""" + + offset: int + """Number of items to skip""" + + ordering: Optional[Literal["name", "readable_name", "reserved", "-name", "-readable_name", "-reserved"]] + """Determine the field to order results by""" + + readable_name: str + """Filter tags by their readable name. Supports '\\**' as a wildcard character.""" + + reserved: bool + """Filter to include only reserved tags.""" diff --git a/src/gcore/types/waap/waap_detailed_domain.py b/src/gcore/types/waap/waap_detailed_domain.py index c0557bd7..1f85b04f 100644 --- a/src/gcore/types/waap/waap_detailed_domain.py +++ b/src/gcore/types/waap/waap_detailed_domain.py @@ -4,17 +4,10 @@ from datetime import datetime from ..._models import BaseModel +from .quota_item import QuotaItem from .waap_domain_status import WaapDomainStatus -__all__ = ["WaapDetailedDomain", "Quotas"] - - -class Quotas(BaseModel): - allowed: int - """The maximum allowed number of this resource""" - - current: int - """The current number of this resource""" +__all__ = ["WaapDetailedDomain"] class WaapDetailedDomain(BaseModel): @@ -33,5 +26,5 @@ class WaapDetailedDomain(BaseModel): status: WaapDomainStatus """The different statuses a domain can have""" - quotas: Optional[Dict[str, Quotas]] = None + quotas: Optional[Dict[str, QuotaItem]] = None """Domain level quotas""" diff --git a/tests/api_resources/test_waap.py b/tests/api_resources/test_waap.py new file mode 100644 index 00000000..09f42bbc --- /dev/null +++ b/tests/api_resources/test_waap.py @@ -0,0 +1,72 @@ +# 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.waap import ClientInfo + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestWaap: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_account_overview(self, client: Gcore) -> None: + waap = client.waap.get_account_overview() + assert_matches_type(ClientInfo, waap, path=["response"]) + + @parametrize + def test_raw_response_get_account_overview(self, client: Gcore) -> None: + response = client.waap.with_raw_response.get_account_overview() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + waap = response.parse() + assert_matches_type(ClientInfo, waap, path=["response"]) + + @parametrize + def test_streaming_response_get_account_overview(self, client: Gcore) -> None: + with client.waap.with_streaming_response.get_account_overview() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + waap = response.parse() + assert_matches_type(ClientInfo, waap, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncWaap: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_get_account_overview(self, async_client: AsyncGcore) -> None: + waap = await async_client.waap.get_account_overview() + assert_matches_type(ClientInfo, waap, path=["response"]) + + @parametrize + async def test_raw_response_get_account_overview(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.with_raw_response.get_account_overview() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + waap = await response.parse() + assert_matches_type(ClientInfo, waap, path=["response"]) + + @parametrize + async def test_streaming_response_get_account_overview(self, async_client: AsyncGcore) -> None: + async with async_client.waap.with_streaming_response.get_account_overview() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + waap = await response.parse() + assert_matches_type(ClientInfo, waap, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_advanced_rules.py b/tests/api_resources/waap/domains/test_advanced_rules.py new file mode 100644 index 00000000..38ece191 --- /dev/null +++ b/tests/api_resources/waap/domains/test_advanced_rules.py @@ -0,0 +1,575 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap.domains import ( + AdvancedRule, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAdvancedRules: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + advanced_rule = client.waap.domains.advanced_rules.create( + domain_id=0, + action={}, + enabled=True, + name="name", + source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", + ) + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + advanced_rule = client.waap.domains.advanced_rules.create( + domain_id=0, + action={ + "allow": {}, + "block": { + "action_duration": "12h", + "status_code": 403, + }, + "captcha": {}, + "handshake": {}, + "monitor": {}, + "tag": {"tags": ["string"]}, + }, + enabled=True, + name="name", + source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", + description="description", + phase="access", + ) + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.waap.domains.advanced_rules.with_raw_response.create( + domain_id=0, + action={}, + enabled=True, + name="name", + source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = response.parse() + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.waap.domains.advanced_rules.with_streaming_response.create( + domain_id=0, + action={}, + enabled=True, + name="name", + source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = response.parse() + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + advanced_rule = client.waap.domains.advanced_rules.update( + rule_id=0, + domain_id=0, + ) + assert advanced_rule is None + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + advanced_rule = client.waap.domains.advanced_rules.update( + rule_id=0, + domain_id=0, + action={ + "allow": {}, + "block": { + "action_duration": "12h", + "status_code": 403, + }, + "captcha": {}, + "handshake": {}, + "monitor": {}, + "tag": {"tags": ["string"]}, + }, + description="description", + enabled=True, + name="name", + phase="access", + source="x", + ) + assert advanced_rule is None + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.waap.domains.advanced_rules.with_raw_response.update( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = response.parse() + assert advanced_rule is None + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.waap.domains.advanced_rules.with_streaming_response.update( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = response.parse() + assert advanced_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + advanced_rule = client.waap.domains.advanced_rules.list( + domain_id=0, + ) + assert_matches_type(SyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + advanced_rule = client.waap.domains.advanced_rules.list( + domain_id=0, + action="allow", + description="description", + enabled=True, + limit=0, + name="name", + offset=0, + ordering="id", + phase="access", + ) + assert_matches_type(SyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.domains.advanced_rules.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = response.parse() + assert_matches_type(SyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.domains.advanced_rules.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = response.parse() + assert_matches_type(SyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + advanced_rule = client.waap.domains.advanced_rules.delete( + rule_id=0, + domain_id=0, + ) + assert advanced_rule is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.waap.domains.advanced_rules.with_raw_response.delete( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = response.parse() + assert advanced_rule is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.waap.domains.advanced_rules.with_streaming_response.delete( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = response.parse() + assert advanced_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + advanced_rule = client.waap.domains.advanced_rules.get( + rule_id=0, + domain_id=0, + ) + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.domains.advanced_rules.with_raw_response.get( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = response.parse() + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.domains.advanced_rules.with_streaming_response.get( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = response.parse() + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_toggle(self, client: Gcore) -> None: + advanced_rule = client.waap.domains.advanced_rules.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) + assert advanced_rule is None + + @parametrize + def test_raw_response_toggle(self, client: Gcore) -> None: + response = client.waap.domains.advanced_rules.with_raw_response.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = response.parse() + assert advanced_rule is None + + @parametrize + def test_streaming_response_toggle(self, client: Gcore) -> None: + with client.waap.domains.advanced_rules.with_streaming_response.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = response.parse() + assert advanced_rule is None + + assert cast(Any, response.is_closed) is True + + +class TestAsyncAdvancedRules: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + advanced_rule = await async_client.waap.domains.advanced_rules.create( + domain_id=0, + action={}, + enabled=True, + name="name", + source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", + ) + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + advanced_rule = await async_client.waap.domains.advanced_rules.create( + domain_id=0, + action={ + "allow": {}, + "block": { + "action_duration": "12h", + "status_code": 403, + }, + "captcha": {}, + "handshake": {}, + "monitor": {}, + "tag": {"tags": ["string"]}, + }, + enabled=True, + name="name", + source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", + description="description", + phase="access", + ) + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.advanced_rules.with_raw_response.create( + domain_id=0, + action={}, + enabled=True, + name="name", + source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = await response.parse() + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.advanced_rules.with_streaming_response.create( + domain_id=0, + action={}, + enabled=True, + name="name", + source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = await response.parse() + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + advanced_rule = await async_client.waap.domains.advanced_rules.update( + rule_id=0, + domain_id=0, + ) + assert advanced_rule is None + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + advanced_rule = await async_client.waap.domains.advanced_rules.update( + rule_id=0, + domain_id=0, + action={ + "allow": {}, + "block": { + "action_duration": "12h", + "status_code": 403, + }, + "captcha": {}, + "handshake": {}, + "monitor": {}, + "tag": {"tags": ["string"]}, + }, + description="description", + enabled=True, + name="name", + phase="access", + source="x", + ) + assert advanced_rule is None + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.advanced_rules.with_raw_response.update( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = await response.parse() + assert advanced_rule is None + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.advanced_rules.with_streaming_response.update( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = await response.parse() + assert advanced_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + advanced_rule = await async_client.waap.domains.advanced_rules.list( + domain_id=0, + ) + assert_matches_type(AsyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + advanced_rule = await async_client.waap.domains.advanced_rules.list( + domain_id=0, + action="allow", + description="description", + enabled=True, + limit=0, + name="name", + offset=0, + ordering="id", + phase="access", + ) + assert_matches_type(AsyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.advanced_rules.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = await response.parse() + assert_matches_type(AsyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.advanced_rules.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = await response.parse() + assert_matches_type(AsyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + advanced_rule = await async_client.waap.domains.advanced_rules.delete( + rule_id=0, + domain_id=0, + ) + assert advanced_rule is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.advanced_rules.with_raw_response.delete( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = await response.parse() + assert advanced_rule is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.advanced_rules.with_streaming_response.delete( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = await response.parse() + assert advanced_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + advanced_rule = await async_client.waap.domains.advanced_rules.get( + rule_id=0, + domain_id=0, + ) + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.advanced_rules.with_raw_response.get( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = await response.parse() + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.advanced_rules.with_streaming_response.get( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = await response.parse() + assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_toggle(self, async_client: AsyncGcore) -> None: + advanced_rule = await async_client.waap.domains.advanced_rules.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) + assert advanced_rule is None + + @parametrize + async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.advanced_rules.with_raw_response.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = await response.parse() + assert advanced_rule is None + + @parametrize + async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.advanced_rules.with_streaming_response.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = await response.parse() + assert advanced_rule is None + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_custom_rules.py b/tests/api_resources/waap/domains/test_custom_rules.py new file mode 100644 index 00000000..5ee19b55 --- /dev/null +++ b/tests/api_resources/waap/domains/test_custom_rules.py @@ -0,0 +1,981 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap.domains import ( + CustomRule, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCustomRules: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + custom_rule = client.waap.domains.custom_rules.create( + domain_id=0, + action={}, + conditions=[{}], + enabled=True, + name="name", + ) + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + custom_rule = client.waap.domains.custom_rules.create( + domain_id=0, + action={ + "allow": {}, + "block": { + "action_duration": "12h", + "status_code": 403, + }, + "captcha": {}, + "handshake": {}, + "monitor": {}, + "tag": {"tags": ["string"]}, + }, + conditions=[ + { + "content_type": { + "content_type": ["string"], + "negation": True, + }, + "country": { + "country_code": ["Mv"], + "negation": True, + }, + "file_extension": { + "file_extension": ["string"], + "negation": True, + }, + "header": { + "header": "header", + "value": "value", + "match_type": "Exact", + "negation": True, + }, + "header_exists": { + "header": "header", + "negation": True, + }, + "http_method": { + "http_method": "CONNECT", + "negation": True, + }, + "ip": { + "ip_address": "192.168.1.1", + "negation": True, + }, + "ip_range": { + "lower_bound": "192.168.1.1", + "upper_bound": "192.168.1.1", + "negation": True, + }, + "organization": { + "organization": "organization", + "negation": True, + }, + "owner_types": { + "negation": True, + "owner_types": ["COMMERCIAL"], + }, + "request_rate": { + "path_pattern": "/", + "requests": 20, + "time": 1, + "http_methods": ["CONNECT"], + "ips": ["192.168.1.1"], + "user_defined_tag": "SQfNklznVLBBpr", + }, + "response_header": { + "header": "header", + "value": "value", + "match_type": "Exact", + "negation": True, + }, + "response_header_exists": { + "header": "header", + "negation": True, + }, + "session_request_count": { + "request_count": 1, + "negation": True, + }, + "tags": { + "tags": ["string"], + "negation": True, + }, + "url": { + "url": "x", + "match_type": "Exact", + "negation": True, + }, + "user_agent": { + "user_agent": "user_agent", + "match_type": "Exact", + "negation": True, + }, + "user_defined_tags": { + "tags": ["string"], + "negation": True, + }, + } + ], + enabled=True, + name="name", + description="description", + ) + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.waap.domains.custom_rules.with_raw_response.create( + domain_id=0, + action={}, + conditions=[{}], + enabled=True, + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = response.parse() + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.waap.domains.custom_rules.with_streaming_response.create( + domain_id=0, + action={}, + conditions=[{}], + enabled=True, + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = response.parse() + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + custom_rule = client.waap.domains.custom_rules.update( + rule_id=0, + domain_id=0, + ) + assert custom_rule is None + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + custom_rule = client.waap.domains.custom_rules.update( + rule_id=0, + domain_id=0, + action={ + "allow": {}, + "block": { + "action_duration": "12h", + "status_code": 403, + }, + "captcha": {}, + "handshake": {}, + "monitor": {}, + "tag": {"tags": ["string"]}, + }, + conditions=[ + { + "content_type": { + "content_type": ["string"], + "negation": True, + }, + "country": { + "country_code": ["Mv"], + "negation": True, + }, + "file_extension": { + "file_extension": ["string"], + "negation": True, + }, + "header": { + "header": "header", + "value": "value", + "match_type": "Exact", + "negation": True, + }, + "header_exists": { + "header": "header", + "negation": True, + }, + "http_method": { + "http_method": "CONNECT", + "negation": True, + }, + "ip": { + "ip_address": "192.168.1.1", + "negation": True, + }, + "ip_range": { + "lower_bound": "192.168.1.1", + "upper_bound": "192.168.1.1", + "negation": True, + }, + "organization": { + "organization": "organization", + "negation": True, + }, + "owner_types": { + "negation": True, + "owner_types": ["COMMERCIAL"], + }, + "request_rate": { + "path_pattern": "/", + "requests": 20, + "time": 1, + "http_methods": ["CONNECT"], + "ips": ["192.168.1.1"], + "user_defined_tag": "SQfNklznVLBBpr", + }, + "response_header": { + "header": "header", + "value": "value", + "match_type": "Exact", + "negation": True, + }, + "response_header_exists": { + "header": "header", + "negation": True, + }, + "session_request_count": { + "request_count": 1, + "negation": True, + }, + "tags": { + "tags": ["string"], + "negation": True, + }, + "url": { + "url": "x", + "match_type": "Exact", + "negation": True, + }, + "user_agent": { + "user_agent": "user_agent", + "match_type": "Exact", + "negation": True, + }, + "user_defined_tags": { + "tags": ["string"], + "negation": True, + }, + } + ], + description="description", + enabled=True, + name="name", + ) + assert custom_rule is None + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.waap.domains.custom_rules.with_raw_response.update( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = response.parse() + assert custom_rule is None + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.waap.domains.custom_rules.with_streaming_response.update( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = response.parse() + assert custom_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + custom_rule = client.waap.domains.custom_rules.list( + domain_id=0, + ) + assert_matches_type(SyncOffsetPage[CustomRule], custom_rule, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + custom_rule = client.waap.domains.custom_rules.list( + domain_id=0, + action="allow", + description="description", + enabled=True, + limit=0, + name="name", + offset=0, + ordering="-id", + ) + assert_matches_type(SyncOffsetPage[CustomRule], custom_rule, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.domains.custom_rules.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = response.parse() + assert_matches_type(SyncOffsetPage[CustomRule], custom_rule, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.domains.custom_rules.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = response.parse() + assert_matches_type(SyncOffsetPage[CustomRule], custom_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + custom_rule = client.waap.domains.custom_rules.delete( + rule_id=0, + domain_id=0, + ) + assert custom_rule is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.waap.domains.custom_rules.with_raw_response.delete( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = response.parse() + assert custom_rule is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.waap.domains.custom_rules.with_streaming_response.delete( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = response.parse() + assert custom_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete_multiple(self, client: Gcore) -> None: + custom_rule = client.waap.domains.custom_rules.delete_multiple( + domain_id=0, + rule_ids=[0], + ) + assert custom_rule is None + + @parametrize + def test_raw_response_delete_multiple(self, client: Gcore) -> None: + response = client.waap.domains.custom_rules.with_raw_response.delete_multiple( + domain_id=0, + rule_ids=[0], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = response.parse() + assert custom_rule is None + + @parametrize + def test_streaming_response_delete_multiple(self, client: Gcore) -> None: + with client.waap.domains.custom_rules.with_streaming_response.delete_multiple( + domain_id=0, + rule_ids=[0], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = response.parse() + assert custom_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + custom_rule = client.waap.domains.custom_rules.get( + rule_id=0, + domain_id=0, + ) + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.domains.custom_rules.with_raw_response.get( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = response.parse() + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.domains.custom_rules.with_streaming_response.get( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = response.parse() + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_toggle(self, client: Gcore) -> None: + custom_rule = client.waap.domains.custom_rules.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) + assert custom_rule is None + + @parametrize + def test_raw_response_toggle(self, client: Gcore) -> None: + response = client.waap.domains.custom_rules.with_raw_response.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = response.parse() + assert custom_rule is None + + @parametrize + def test_streaming_response_toggle(self, client: Gcore) -> None: + with client.waap.domains.custom_rules.with_streaming_response.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = response.parse() + assert custom_rule is None + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCustomRules: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + custom_rule = await async_client.waap.domains.custom_rules.create( + domain_id=0, + action={}, + conditions=[{}], + enabled=True, + name="name", + ) + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + custom_rule = await async_client.waap.domains.custom_rules.create( + domain_id=0, + action={ + "allow": {}, + "block": { + "action_duration": "12h", + "status_code": 403, + }, + "captcha": {}, + "handshake": {}, + "monitor": {}, + "tag": {"tags": ["string"]}, + }, + conditions=[ + { + "content_type": { + "content_type": ["string"], + "negation": True, + }, + "country": { + "country_code": ["Mv"], + "negation": True, + }, + "file_extension": { + "file_extension": ["string"], + "negation": True, + }, + "header": { + "header": "header", + "value": "value", + "match_type": "Exact", + "negation": True, + }, + "header_exists": { + "header": "header", + "negation": True, + }, + "http_method": { + "http_method": "CONNECT", + "negation": True, + }, + "ip": { + "ip_address": "192.168.1.1", + "negation": True, + }, + "ip_range": { + "lower_bound": "192.168.1.1", + "upper_bound": "192.168.1.1", + "negation": True, + }, + "organization": { + "organization": "organization", + "negation": True, + }, + "owner_types": { + "negation": True, + "owner_types": ["COMMERCIAL"], + }, + "request_rate": { + "path_pattern": "/", + "requests": 20, + "time": 1, + "http_methods": ["CONNECT"], + "ips": ["192.168.1.1"], + "user_defined_tag": "SQfNklznVLBBpr", + }, + "response_header": { + "header": "header", + "value": "value", + "match_type": "Exact", + "negation": True, + }, + "response_header_exists": { + "header": "header", + "negation": True, + }, + "session_request_count": { + "request_count": 1, + "negation": True, + }, + "tags": { + "tags": ["string"], + "negation": True, + }, + "url": { + "url": "x", + "match_type": "Exact", + "negation": True, + }, + "user_agent": { + "user_agent": "user_agent", + "match_type": "Exact", + "negation": True, + }, + "user_defined_tags": { + "tags": ["string"], + "negation": True, + }, + } + ], + enabled=True, + name="name", + description="description", + ) + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.custom_rules.with_raw_response.create( + domain_id=0, + action={}, + conditions=[{}], + enabled=True, + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = await response.parse() + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.custom_rules.with_streaming_response.create( + domain_id=0, + action={}, + conditions=[{}], + enabled=True, + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = await response.parse() + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + custom_rule = await async_client.waap.domains.custom_rules.update( + rule_id=0, + domain_id=0, + ) + assert custom_rule is None + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + custom_rule = await async_client.waap.domains.custom_rules.update( + rule_id=0, + domain_id=0, + action={ + "allow": {}, + "block": { + "action_duration": "12h", + "status_code": 403, + }, + "captcha": {}, + "handshake": {}, + "monitor": {}, + "tag": {"tags": ["string"]}, + }, + conditions=[ + { + "content_type": { + "content_type": ["string"], + "negation": True, + }, + "country": { + "country_code": ["Mv"], + "negation": True, + }, + "file_extension": { + "file_extension": ["string"], + "negation": True, + }, + "header": { + "header": "header", + "value": "value", + "match_type": "Exact", + "negation": True, + }, + "header_exists": { + "header": "header", + "negation": True, + }, + "http_method": { + "http_method": "CONNECT", + "negation": True, + }, + "ip": { + "ip_address": "192.168.1.1", + "negation": True, + }, + "ip_range": { + "lower_bound": "192.168.1.1", + "upper_bound": "192.168.1.1", + "negation": True, + }, + "organization": { + "organization": "organization", + "negation": True, + }, + "owner_types": { + "negation": True, + "owner_types": ["COMMERCIAL"], + }, + "request_rate": { + "path_pattern": "/", + "requests": 20, + "time": 1, + "http_methods": ["CONNECT"], + "ips": ["192.168.1.1"], + "user_defined_tag": "SQfNklznVLBBpr", + }, + "response_header": { + "header": "header", + "value": "value", + "match_type": "Exact", + "negation": True, + }, + "response_header_exists": { + "header": "header", + "negation": True, + }, + "session_request_count": { + "request_count": 1, + "negation": True, + }, + "tags": { + "tags": ["string"], + "negation": True, + }, + "url": { + "url": "x", + "match_type": "Exact", + "negation": True, + }, + "user_agent": { + "user_agent": "user_agent", + "match_type": "Exact", + "negation": True, + }, + "user_defined_tags": { + "tags": ["string"], + "negation": True, + }, + } + ], + description="description", + enabled=True, + name="name", + ) + assert custom_rule is None + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.custom_rules.with_raw_response.update( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = await response.parse() + assert custom_rule is None + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.custom_rules.with_streaming_response.update( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = await response.parse() + assert custom_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + custom_rule = await async_client.waap.domains.custom_rules.list( + domain_id=0, + ) + assert_matches_type(AsyncOffsetPage[CustomRule], custom_rule, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + custom_rule = await async_client.waap.domains.custom_rules.list( + domain_id=0, + action="allow", + description="description", + enabled=True, + limit=0, + name="name", + offset=0, + ordering="-id", + ) + assert_matches_type(AsyncOffsetPage[CustomRule], custom_rule, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.custom_rules.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = await response.parse() + assert_matches_type(AsyncOffsetPage[CustomRule], custom_rule, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.custom_rules.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = await response.parse() + assert_matches_type(AsyncOffsetPage[CustomRule], custom_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + custom_rule = await async_client.waap.domains.custom_rules.delete( + rule_id=0, + domain_id=0, + ) + assert custom_rule is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.custom_rules.with_raw_response.delete( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = await response.parse() + assert custom_rule is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.custom_rules.with_streaming_response.delete( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = await response.parse() + assert custom_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete_multiple(self, async_client: AsyncGcore) -> None: + custom_rule = await async_client.waap.domains.custom_rules.delete_multiple( + domain_id=0, + rule_ids=[0], + ) + assert custom_rule is None + + @parametrize + async def test_raw_response_delete_multiple(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.custom_rules.with_raw_response.delete_multiple( + domain_id=0, + rule_ids=[0], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = await response.parse() + assert custom_rule is None + + @parametrize + async def test_streaming_response_delete_multiple(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.custom_rules.with_streaming_response.delete_multiple( + domain_id=0, + rule_ids=[0], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = await response.parse() + assert custom_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + custom_rule = await async_client.waap.domains.custom_rules.get( + rule_id=0, + domain_id=0, + ) + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.custom_rules.with_raw_response.get( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = await response.parse() + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.custom_rules.with_streaming_response.get( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = await response.parse() + assert_matches_type(CustomRule, custom_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_toggle(self, async_client: AsyncGcore) -> None: + custom_rule = await async_client.waap.domains.custom_rules.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) + assert custom_rule is None + + @parametrize + async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.custom_rules.with_raw_response.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_rule = await response.parse() + assert custom_rule is None + + @parametrize + async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.custom_rules.with_streaming_response.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_rule = await response.parse() + assert custom_rule is None + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_firewall_rules.py b/tests/api_resources/waap/domains/test_firewall_rules.py new file mode 100644 index 00000000..6ef02a16 --- /dev/null +++ b/tests/api_resources/waap/domains/test_firewall_rules.py @@ -0,0 +1,669 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap.domains import ( + FirewallRule, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFirewallRules: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + firewall_rule = client.waap.domains.firewall_rules.create( + domain_id=0, + action={}, + conditions=[{}], + enabled=True, + name="name", + ) + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + firewall_rule = client.waap.domains.firewall_rules.create( + domain_id=0, + action={ + "allow": {}, + "block": { + "action_duration": "12h", + "status_code": 403, + }, + }, + conditions=[ + { + "ip": { + "ip_address": "192.168.1.1", + "negation": True, + }, + "ip_range": { + "lower_bound": "192.168.1.1", + "upper_bound": "192.168.1.1", + "negation": True, + }, + } + ], + enabled=True, + name="name", + description="description", + ) + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.waap.domains.firewall_rules.with_raw_response.create( + domain_id=0, + action={}, + conditions=[{}], + enabled=True, + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = response.parse() + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.waap.domains.firewall_rules.with_streaming_response.create( + domain_id=0, + action={}, + conditions=[{}], + enabled=True, + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = response.parse() + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + firewall_rule = client.waap.domains.firewall_rules.update( + rule_id=0, + domain_id=0, + ) + assert firewall_rule is None + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + firewall_rule = client.waap.domains.firewall_rules.update( + rule_id=0, + domain_id=0, + action={ + "allow": {}, + "block": { + "action_duration": "12h", + "status_code": 403, + }, + }, + conditions=[ + { + "ip": { + "ip_address": "192.168.1.1", + "negation": True, + }, + "ip_range": { + "lower_bound": "192.168.1.1", + "upper_bound": "192.168.1.1", + "negation": True, + }, + } + ], + description="description", + enabled=True, + name="name", + ) + assert firewall_rule is None + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.waap.domains.firewall_rules.with_raw_response.update( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = response.parse() + assert firewall_rule is None + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.waap.domains.firewall_rules.with_streaming_response.update( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = response.parse() + assert firewall_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + firewall_rule = client.waap.domains.firewall_rules.list( + domain_id=0, + ) + assert_matches_type(SyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + firewall_rule = client.waap.domains.firewall_rules.list( + domain_id=0, + action="allow", + description="description", + enabled=True, + limit=0, + name="name", + offset=0, + ordering="-id", + ) + assert_matches_type(SyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.domains.firewall_rules.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = response.parse() + assert_matches_type(SyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.domains.firewall_rules.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = response.parse() + assert_matches_type(SyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + firewall_rule = client.waap.domains.firewall_rules.delete( + rule_id=0, + domain_id=0, + ) + assert firewall_rule is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.waap.domains.firewall_rules.with_raw_response.delete( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = response.parse() + assert firewall_rule is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.waap.domains.firewall_rules.with_streaming_response.delete( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = response.parse() + assert firewall_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete_multiple(self, client: Gcore) -> None: + firewall_rule = client.waap.domains.firewall_rules.delete_multiple( + domain_id=0, + rule_ids=[0], + ) + assert firewall_rule is None + + @parametrize + def test_raw_response_delete_multiple(self, client: Gcore) -> None: + response = client.waap.domains.firewall_rules.with_raw_response.delete_multiple( + domain_id=0, + rule_ids=[0], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = response.parse() + assert firewall_rule is None + + @parametrize + def test_streaming_response_delete_multiple(self, client: Gcore) -> None: + with client.waap.domains.firewall_rules.with_streaming_response.delete_multiple( + domain_id=0, + rule_ids=[0], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = response.parse() + assert firewall_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + firewall_rule = client.waap.domains.firewall_rules.get( + rule_id=0, + domain_id=0, + ) + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.domains.firewall_rules.with_raw_response.get( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = response.parse() + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.domains.firewall_rules.with_streaming_response.get( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = response.parse() + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_toggle(self, client: Gcore) -> None: + firewall_rule = client.waap.domains.firewall_rules.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) + assert firewall_rule is None + + @parametrize + def test_raw_response_toggle(self, client: Gcore) -> None: + response = client.waap.domains.firewall_rules.with_raw_response.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = response.parse() + assert firewall_rule is None + + @parametrize + def test_streaming_response_toggle(self, client: Gcore) -> None: + with client.waap.domains.firewall_rules.with_streaming_response.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = response.parse() + assert firewall_rule is None + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFirewallRules: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + firewall_rule = await async_client.waap.domains.firewall_rules.create( + domain_id=0, + action={}, + conditions=[{}], + enabled=True, + name="name", + ) + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + firewall_rule = await async_client.waap.domains.firewall_rules.create( + domain_id=0, + action={ + "allow": {}, + "block": { + "action_duration": "12h", + "status_code": 403, + }, + }, + conditions=[ + { + "ip": { + "ip_address": "192.168.1.1", + "negation": True, + }, + "ip_range": { + "lower_bound": "192.168.1.1", + "upper_bound": "192.168.1.1", + "negation": True, + }, + } + ], + enabled=True, + name="name", + description="description", + ) + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.firewall_rules.with_raw_response.create( + domain_id=0, + action={}, + conditions=[{}], + enabled=True, + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = await response.parse() + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.firewall_rules.with_streaming_response.create( + domain_id=0, + action={}, + conditions=[{}], + enabled=True, + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = await response.parse() + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + firewall_rule = await async_client.waap.domains.firewall_rules.update( + rule_id=0, + domain_id=0, + ) + assert firewall_rule is None + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + firewall_rule = await async_client.waap.domains.firewall_rules.update( + rule_id=0, + domain_id=0, + action={ + "allow": {}, + "block": { + "action_duration": "12h", + "status_code": 403, + }, + }, + conditions=[ + { + "ip": { + "ip_address": "192.168.1.1", + "negation": True, + }, + "ip_range": { + "lower_bound": "192.168.1.1", + "upper_bound": "192.168.1.1", + "negation": True, + }, + } + ], + description="description", + enabled=True, + name="name", + ) + assert firewall_rule is None + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.firewall_rules.with_raw_response.update( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = await response.parse() + assert firewall_rule is None + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.firewall_rules.with_streaming_response.update( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = await response.parse() + assert firewall_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + firewall_rule = await async_client.waap.domains.firewall_rules.list( + domain_id=0, + ) + assert_matches_type(AsyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + firewall_rule = await async_client.waap.domains.firewall_rules.list( + domain_id=0, + action="allow", + description="description", + enabled=True, + limit=0, + name="name", + offset=0, + ordering="-id", + ) + assert_matches_type(AsyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.firewall_rules.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = await response.parse() + assert_matches_type(AsyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.firewall_rules.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = await response.parse() + assert_matches_type(AsyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + firewall_rule = await async_client.waap.domains.firewall_rules.delete( + rule_id=0, + domain_id=0, + ) + assert firewall_rule is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.firewall_rules.with_raw_response.delete( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = await response.parse() + assert firewall_rule is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.firewall_rules.with_streaming_response.delete( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = await response.parse() + assert firewall_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete_multiple(self, async_client: AsyncGcore) -> None: + firewall_rule = await async_client.waap.domains.firewall_rules.delete_multiple( + domain_id=0, + rule_ids=[0], + ) + assert firewall_rule is None + + @parametrize + async def test_raw_response_delete_multiple(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.firewall_rules.with_raw_response.delete_multiple( + domain_id=0, + rule_ids=[0], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = await response.parse() + assert firewall_rule is None + + @parametrize + async def test_streaming_response_delete_multiple(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.firewall_rules.with_streaming_response.delete_multiple( + domain_id=0, + rule_ids=[0], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = await response.parse() + assert firewall_rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + firewall_rule = await async_client.waap.domains.firewall_rules.get( + rule_id=0, + domain_id=0, + ) + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.firewall_rules.with_raw_response.get( + rule_id=0, + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = await response.parse() + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.firewall_rules.with_streaming_response.get( + rule_id=0, + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = await response.parse() + assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_toggle(self, async_client: AsyncGcore) -> None: + firewall_rule = await async_client.waap.domains.firewall_rules.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) + assert firewall_rule is None + + @parametrize + async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.firewall_rules.with_raw_response.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + firewall_rule = await response.parse() + assert firewall_rule is None + + @parametrize + async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.firewall_rules.with_streaming_response.toggle( + action="enable", + domain_id=0, + rule_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + firewall_rule = await response.parse() + assert firewall_rule is None + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_advanced_rules.py b/tests/api_resources/waap/test_advanced_rules.py new file mode 100644 index 00000000..3e4c03ca --- /dev/null +++ b/tests/api_resources/waap/test_advanced_rules.py @@ -0,0 +1,72 @@ +# 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.waap import AdvancedRuleDescriptorList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAdvancedRules: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + advanced_rule = client.waap.advanced_rules.list() + assert_matches_type(AdvancedRuleDescriptorList, advanced_rule, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.advanced_rules.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = response.parse() + assert_matches_type(AdvancedRuleDescriptorList, advanced_rule, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.advanced_rules.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = response.parse() + assert_matches_type(AdvancedRuleDescriptorList, advanced_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncAdvancedRules: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + advanced_rule = await async_client.waap.advanced_rules.list() + assert_matches_type(AdvancedRuleDescriptorList, advanced_rule, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.advanced_rules.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + advanced_rule = await response.parse() + assert_matches_type(AdvancedRuleDescriptorList, advanced_rule, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.advanced_rules.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + advanced_rule = await response.parse() + assert_matches_type(AdvancedRuleDescriptorList, advanced_rule, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_custom_page_sets.py b/tests/api_resources/waap/test_custom_page_sets.py new file mode 100644 index 00000000..94ff1b2c --- /dev/null +++ b/tests/api_resources/waap/test_custom_page_sets.py @@ -0,0 +1,618 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap import ( + CustomPageSet, + PreviewCustomPage, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCustomPageSets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + custom_page_set = client.waap.custom_page_sets.create( + name="x", + ) + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + custom_page_set = client.waap.custom_page_sets.create( + name="x", + block={ + "enabled": True, + "header": "xxx", + "logo": "logo", + "text": "xxxxxxxxxxxxxxxxxxxx", + "title": "xxx", + }, + block_csrf={ + "enabled": True, + "header": "xxx", + "logo": "logo", + "text": "xxxxxxxxxxxxxxxxxxxx", + "title": "xxx", + }, + captcha={ + "enabled": True, + "error": "xxxxxxxxxx", + "header": "xxx", + "logo": "logo", + "text": "xxxxxxxxxxxxxxxxxxxx", + "title": "xxx", + }, + cookie_disabled={ + "enabled": True, + "header": "xxx", + "text": "xxxxxxxxxxxxxxxxxxxx", + }, + domains=[0], + handshake={ + "enabled": True, + "header": "xxx", + "logo": "logo", + "title": "xxx", + }, + javascript_disabled={ + "enabled": True, + "header": "xxx", + "text": "xxxxxxxxxxxxxxxxxxxx", + }, + ) + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.waap.custom_page_sets.with_raw_response.create( + name="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_page_set = response.parse() + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.waap.custom_page_sets.with_streaming_response.create( + name="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_page_set = response.parse() + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + custom_page_set = client.waap.custom_page_sets.update( + set_id=0, + ) + assert custom_page_set is None + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + custom_page_set = client.waap.custom_page_sets.update( + set_id=0, + block={ + "enabled": True, + "header": "xxx", + "logo": "logo", + "text": "xxxxxxxxxxxxxxxxxxxx", + "title": "xxx", + }, + block_csrf={ + "enabled": True, + "header": "xxx", + "logo": "logo", + "text": "xxxxxxxxxxxxxxxxxxxx", + "title": "xxx", + }, + captcha={ + "enabled": True, + "error": "xxxxxxxxxx", + "header": "xxx", + "logo": "logo", + "text": "xxxxxxxxxxxxxxxxxxxx", + "title": "xxx", + }, + cookie_disabled={ + "enabled": True, + "header": "xxx", + "text": "xxxxxxxxxxxxxxxxxxxx", + }, + domains=[0], + handshake={ + "enabled": True, + "header": "xxx", + "logo": "logo", + "title": "xxx", + }, + javascript_disabled={ + "enabled": True, + "header": "xxx", + "text": "xxxxxxxxxxxxxxxxxxxx", + }, + name="x", + ) + assert custom_page_set is None + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.waap.custom_page_sets.with_raw_response.update( + set_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_page_set = response.parse() + assert custom_page_set is None + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.waap.custom_page_sets.with_streaming_response.update( + set_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_page_set = response.parse() + assert custom_page_set is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + custom_page_set = client.waap.custom_page_sets.list() + assert_matches_type(SyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + custom_page_set = client.waap.custom_page_sets.list( + ids=[0], + limit=0, + name="name", + offset=0, + ordering="name", + ) + assert_matches_type(SyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.custom_page_sets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_page_set = response.parse() + assert_matches_type(SyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.custom_page_sets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_page_set = response.parse() + assert_matches_type(SyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + custom_page_set = client.waap.custom_page_sets.delete( + 0, + ) + assert custom_page_set is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.waap.custom_page_sets.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_page_set = response.parse() + assert custom_page_set is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.waap.custom_page_sets.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_page_set = response.parse() + assert custom_page_set is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + custom_page_set = client.waap.custom_page_sets.get( + 0, + ) + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.custom_page_sets.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_page_set = response.parse() + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.custom_page_sets.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_page_set = response.parse() + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_preview(self, client: Gcore) -> None: + custom_page_set = client.waap.custom_page_sets.preview( + page_type="block.html", + ) + assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + + @parametrize + def test_method_preview_with_all_params(self, client: Gcore) -> None: + custom_page_set = client.waap.custom_page_sets.preview( + page_type="block.html", + error="xxxxxxxxxx", + header="xxx", + logo="logo", + text="xxxxxxxxxxxxxxxxxxxx", + title="xxx", + ) + assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + + @parametrize + def test_raw_response_preview(self, client: Gcore) -> None: + response = client.waap.custom_page_sets.with_raw_response.preview( + page_type="block.html", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_page_set = response.parse() + assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + + @parametrize + def test_streaming_response_preview(self, client: Gcore) -> None: + with client.waap.custom_page_sets.with_streaming_response.preview( + page_type="block.html", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_page_set = response.parse() + assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCustomPageSets: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + custom_page_set = await async_client.waap.custom_page_sets.create( + name="x", + ) + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + custom_page_set = await async_client.waap.custom_page_sets.create( + name="x", + block={ + "enabled": True, + "header": "xxx", + "logo": "logo", + "text": "xxxxxxxxxxxxxxxxxxxx", + "title": "xxx", + }, + block_csrf={ + "enabled": True, + "header": "xxx", + "logo": "logo", + "text": "xxxxxxxxxxxxxxxxxxxx", + "title": "xxx", + }, + captcha={ + "enabled": True, + "error": "xxxxxxxxxx", + "header": "xxx", + "logo": "logo", + "text": "xxxxxxxxxxxxxxxxxxxx", + "title": "xxx", + }, + cookie_disabled={ + "enabled": True, + "header": "xxx", + "text": "xxxxxxxxxxxxxxxxxxxx", + }, + domains=[0], + handshake={ + "enabled": True, + "header": "xxx", + "logo": "logo", + "title": "xxx", + }, + javascript_disabled={ + "enabled": True, + "header": "xxx", + "text": "xxxxxxxxxxxxxxxxxxxx", + }, + ) + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.custom_page_sets.with_raw_response.create( + name="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_page_set = await response.parse() + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.waap.custom_page_sets.with_streaming_response.create( + name="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_page_set = await response.parse() + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + custom_page_set = await async_client.waap.custom_page_sets.update( + set_id=0, + ) + assert custom_page_set is None + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + custom_page_set = await async_client.waap.custom_page_sets.update( + set_id=0, + block={ + "enabled": True, + "header": "xxx", + "logo": "logo", + "text": "xxxxxxxxxxxxxxxxxxxx", + "title": "xxx", + }, + block_csrf={ + "enabled": True, + "header": "xxx", + "logo": "logo", + "text": "xxxxxxxxxxxxxxxxxxxx", + "title": "xxx", + }, + captcha={ + "enabled": True, + "error": "xxxxxxxxxx", + "header": "xxx", + "logo": "logo", + "text": "xxxxxxxxxxxxxxxxxxxx", + "title": "xxx", + }, + cookie_disabled={ + "enabled": True, + "header": "xxx", + "text": "xxxxxxxxxxxxxxxxxxxx", + }, + domains=[0], + handshake={ + "enabled": True, + "header": "xxx", + "logo": "logo", + "title": "xxx", + }, + javascript_disabled={ + "enabled": True, + "header": "xxx", + "text": "xxxxxxxxxxxxxxxxxxxx", + }, + name="x", + ) + assert custom_page_set is None + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.custom_page_sets.with_raw_response.update( + set_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_page_set = await response.parse() + assert custom_page_set is None + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.waap.custom_page_sets.with_streaming_response.update( + set_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_page_set = await response.parse() + assert custom_page_set is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + custom_page_set = await async_client.waap.custom_page_sets.list() + assert_matches_type(AsyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + custom_page_set = await async_client.waap.custom_page_sets.list( + ids=[0], + limit=0, + name="name", + offset=0, + ordering="name", + ) + assert_matches_type(AsyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.custom_page_sets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_page_set = await response.parse() + assert_matches_type(AsyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.custom_page_sets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_page_set = await response.parse() + assert_matches_type(AsyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + custom_page_set = await async_client.waap.custom_page_sets.delete( + 0, + ) + assert custom_page_set is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.custom_page_sets.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_page_set = await response.parse() + assert custom_page_set is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.waap.custom_page_sets.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_page_set = await response.parse() + assert custom_page_set is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + custom_page_set = await async_client.waap.custom_page_sets.get( + 0, + ) + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.custom_page_sets.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_page_set = await response.parse() + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.custom_page_sets.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_page_set = await response.parse() + assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_preview(self, async_client: AsyncGcore) -> None: + custom_page_set = await async_client.waap.custom_page_sets.preview( + page_type="block.html", + ) + assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + + @parametrize + async def test_method_preview_with_all_params(self, async_client: AsyncGcore) -> None: + custom_page_set = await async_client.waap.custom_page_sets.preview( + page_type="block.html", + error="xxxxxxxxxx", + header="xxx", + logo="logo", + text="xxxxxxxxxxxxxxxxxxxx", + title="xxx", + ) + assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + + @parametrize + async def test_raw_response_preview(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.custom_page_sets.with_raw_response.preview( + page_type="block.html", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_page_set = await response.parse() + assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + + @parametrize + async def test_streaming_response_preview(self, async_client: AsyncGcore) -> None: + async with async_client.waap.custom_page_sets.with_streaming_response.preview( + page_type="block.html", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_page_set = await response.parse() + assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_organizations.py b/tests/api_resources/waap/test_organizations.py new file mode 100644 index 00000000..704fc03e --- /dev/null +++ b/tests/api_resources/waap/test_organizations.py @@ -0,0 +1,93 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap import Organization + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestOrganizations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + organization = client.waap.organizations.list() + assert_matches_type(SyncOffsetPage[Organization], organization, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + organization = client.waap.organizations.list( + limit=0, + name="name", + offset=0, + ordering="name", + ) + assert_matches_type(SyncOffsetPage[Organization], organization, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.organizations.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + organization = response.parse() + assert_matches_type(SyncOffsetPage[Organization], organization, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.organizations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + organization = response.parse() + assert_matches_type(SyncOffsetPage[Organization], organization, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncOrganizations: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + organization = await async_client.waap.organizations.list() + assert_matches_type(AsyncOffsetPage[Organization], organization, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + organization = await async_client.waap.organizations.list( + limit=0, + name="name", + offset=0, + ordering="name", + ) + assert_matches_type(AsyncOffsetPage[Organization], organization, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.organizations.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + organization = await response.parse() + assert_matches_type(AsyncOffsetPage[Organization], organization, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.organizations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + organization = await response.parse() + assert_matches_type(AsyncOffsetPage[Organization], organization, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_statistics.py b/tests/api_resources/waap/test_statistics.py new file mode 100644 index 00000000..0840e0eb --- /dev/null +++ b/tests/api_resources/waap/test_statistics.py @@ -0,0 +1,103 @@ +# 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._utils import parse_datetime +from gcore.types.waap import StatisticsSeries + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestStatistics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_usage_series(self, client: Gcore) -> None: + statistic = client.waap.statistics.get_usage_series( + from_=parse_datetime("2024-12-14T12:00:00Z"), + granularity="1h", + metrics=["total_bytes"], + to=parse_datetime("2024-12-14T12:00:00Z"), + ) + assert_matches_type(StatisticsSeries, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_usage_series(self, client: Gcore) -> None: + response = client.waap.statistics.with_raw_response.get_usage_series( + from_=parse_datetime("2024-12-14T12:00:00Z"), + granularity="1h", + metrics=["total_bytes"], + to=parse_datetime("2024-12-14T12:00:00Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(StatisticsSeries, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_usage_series(self, client: Gcore) -> None: + with client.waap.statistics.with_streaming_response.get_usage_series( + from_=parse_datetime("2024-12-14T12:00:00Z"), + granularity="1h", + metrics=["total_bytes"], + to=parse_datetime("2024-12-14T12:00:00Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(StatisticsSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncStatistics: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_get_usage_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.waap.statistics.get_usage_series( + from_=parse_datetime("2024-12-14T12:00:00Z"), + granularity="1h", + metrics=["total_bytes"], + to=parse_datetime("2024-12-14T12:00:00Z"), + ) + assert_matches_type(StatisticsSeries, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_usage_series(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.statistics.with_raw_response.get_usage_series( + from_=parse_datetime("2024-12-14T12:00:00Z"), + granularity="1h", + metrics=["total_bytes"], + to=parse_datetime("2024-12-14T12:00:00Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(StatisticsSeries, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_usage_series(self, async_client: AsyncGcore) -> None: + async with async_client.waap.statistics.with_streaming_response.get_usage_series( + from_=parse_datetime("2024-12-14T12:00:00Z"), + granularity="1h", + metrics=["total_bytes"], + to=parse_datetime("2024-12-14T12:00:00Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(StatisticsSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_tags.py b/tests/api_resources/waap/test_tags.py new file mode 100644 index 00000000..2c629f23 --- /dev/null +++ b/tests/api_resources/waap/test_tags.py @@ -0,0 +1,97 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap import Tag + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTags: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + tag = client.waap.tags.list() + assert_matches_type(SyncOffsetPage[Tag], tag, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + tag = client.waap.tags.list( + limit=0, + name="name", + offset=0, + ordering="name", + readable_name="readable_name", + reserved=True, + ) + assert_matches_type(SyncOffsetPage[Tag], tag, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.tags.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tag = response.parse() + assert_matches_type(SyncOffsetPage[Tag], tag, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.tags.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tag = response.parse() + assert_matches_type(SyncOffsetPage[Tag], tag, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncTags: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + tag = await async_client.waap.tags.list() + assert_matches_type(AsyncOffsetPage[Tag], tag, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + tag = await async_client.waap.tags.list( + limit=0, + name="name", + offset=0, + ordering="name", + readable_name="readable_name", + reserved=True, + ) + assert_matches_type(AsyncOffsetPage[Tag], tag, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.tags.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tag = await response.parse() + assert_matches_type(AsyncOffsetPage[Tag], tag, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.tags.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tag = await response.parse() + assert_matches_type(AsyncOffsetPage[Tag], tag, path=["response"]) + + assert cast(Any, response.is_closed) is True From 609fa2a6b13bcd58705a09504d7bb3a5bbcd3fbc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Jun 2025 12:14:15 +0000 Subject: [PATCH 150/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 940d86fa..fa2d7b09 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 265 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-99e3a45411a9fb61f7f7390098f039250b0df0d7f9df0651b83d14ec630f94d0.yml -openapi_spec_hash: 8d7f86bf413439fbd7ce9426e6c3a56e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-146154c20f00c26b9af164ab109d284c255c421e067ca31aeb9d731669c160d1.yml +openapi_spec_hash: e4caf86c986996425f06d22d09739e60 config_hash: c5bfaf05e59e681224296d5438e745a4 From 4beebc3a02943c2346cbc46edd4c278c01a45cf8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Jun 2025 22:09:31 +0000 Subject: [PATCH 151/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cloud/baremetal/servers.py | 4 +- .../gpu_baremetal_clusters.py | 4 +- .../inference/deployments/deployments.py | 52 +++++++++---------- .../resources/cloud/instances/instances.py | 8 +-- src/gcore/resources/cloud/ssh_keys.py | 8 +-- .../cloud/baremetal/server_create_params.py | 2 +- .../gpu_baremetal_cluster_create_params.py | 2 +- .../inference/deployment_create_params.py | 4 +- .../inference/deployment_update_params.py | 4 +- src/gcore/types/cloud/inference/inference.py | 4 +- .../types/cloud/instance_create_params.py | 10 ++-- .../types/cloud/ssh_key_create_params.py | 4 +- src/gcore/types/cloud/ssh_key_created.py | 9 ++-- 14 files changed, 59 insertions(+), 60 deletions(-) diff --git a/.stats.yml b/.stats.yml index fa2d7b09..9a4135ab 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 265 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-146154c20f00c26b9af164ab109d284c255c421e067ca31aeb9d731669c160d1.yml -openapi_spec_hash: e4caf86c986996425f06d22d09739e60 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b7b7aec77d8afcc1daafe4273a4df1b91bd0f6a14c8cfda737128fa5ced95c6e.yml +openapi_spec_hash: fc50ae08d09f3f70238ff08b9bb5be01 config_hash: c5bfaf05e59e681224296d5438e745a4 diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 52713d9e..7f4dbd8b 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -125,7 +125,7 @@ def create( password of the Admin user cannot be updated via '`user_data`'. ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). + [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -482,7 +482,7 @@ async def create( password of the Admin user cannot be updated via '`user_data`'. ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). + [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 9184db09..f9624f4d 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -143,7 +143,7 @@ def create( instance ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). + [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -607,7 +607,7 @@ async def create( instance ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). + [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 792b0fd2..7c26b25d 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -104,8 +104,8 @@ def create( name: Inference instance name. auth_enabled: Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is - required for the requests to the instance if enabled + `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + for the requests to the instance if enabled command: Command to be executed when running a container from an image. @@ -200,8 +200,8 @@ def update( deployment_name: Inference instance name. auth_enabled: Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is - required for the requests to the instance if enabled + `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + for the requests to the instance if enabled command: Command to be executed when running a container from an image. @@ -461,10 +461,10 @@ def start( """ This operation initializes an inference deployment after it was stopped, making it available to handle inference requests again. The instance will launch with - the \\**\\**minimum\\**\\** number of replicas defined in the scaling settings. + the **minimum** number of replicas defined in the scaling settings. - - If the minimum replicas are set to \\**\\**0\\**\\**, the instance will initially - start with \\**\\**0\\**\\** replicas. + - If the minimum replicas are set to **0**, the instance will initially start + with **0** replicas. - It will automatically scale up when it receives requests or SQS messages, according to the configured scaling rules. @@ -508,13 +508,13 @@ def stop( ) -> None: """ This operation shuts down an inference deployment, making it unavailable for - handling requests. The deployment will scale down to \\**\\**0\\**\\** replicas, - overriding any minimum replica settings. + handling requests. The deployment will scale down to **0** replicas, overriding + any minimum replica settings. - - Once stopped, the deployment will \\**\\**not\\**\\** process any inference requests - or SQS messages. - - It will \\**\\**not\\**\\** restart automatically and must be started manually. - - While stopped, the deployment will \\**\\**not\\**\\** incur any charges. + - Once stopped, the deployment will **not** process any inference requests or + SQS messages. + - It will **not** restart automatically and must be started manually. + - While stopped, the deployment will **not** incur any charges. Args: project_id: Project ID @@ -612,8 +612,8 @@ async def create( name: Inference instance name. auth_enabled: Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is - required for the requests to the instance if enabled + `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + for the requests to the instance if enabled command: Command to be executed when running a container from an image. @@ -708,8 +708,8 @@ async def update( deployment_name: Inference instance name. auth_enabled: Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is - required for the requests to the instance if enabled + `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + for the requests to the instance if enabled command: Command to be executed when running a container from an image. @@ -969,10 +969,10 @@ async def start( """ This operation initializes an inference deployment after it was stopped, making it available to handle inference requests again. The instance will launch with - the \\**\\**minimum\\**\\** number of replicas defined in the scaling settings. + the **minimum** number of replicas defined in the scaling settings. - - If the minimum replicas are set to \\**\\**0\\**\\**, the instance will initially - start with \\**\\**0\\**\\** replicas. + - If the minimum replicas are set to **0**, the instance will initially start + with **0** replicas. - It will automatically scale up when it receives requests or SQS messages, according to the configured scaling rules. @@ -1016,13 +1016,13 @@ async def stop( ) -> None: """ This operation shuts down an inference deployment, making it unavailable for - handling requests. The deployment will scale down to \\**\\**0\\**\\** replicas, - overriding any minimum replica settings. + handling requests. The deployment will scale down to **0** replicas, overriding + any minimum replica settings. - - Once stopped, the deployment will \\**\\**not\\**\\** process any inference requests - or SQS messages. - - It will \\**\\**not\\**\\** restart automatically and must be started manually. - - While stopped, the deployment will \\**\\**not\\**\\** incur any charges. + - Once stopped, the deployment will **not** process any inference requests or + SQS messages. + - It will **not** restart automatically and must be started manually. + - While stopped, the deployment will **not** incur any charges. Args: project_id: Project ID diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index e813a831..7817e2fe 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -198,7 +198,7 @@ def create( sharing if needed. ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). + [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -855,7 +855,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Instance: """ - \\**\\**Cookie Parameters\\**\\**: + **Cookie Parameters**: - `language` (str, optional): Language for the response content. Affects the `ddos_profile` field. Supported values: @@ -1204,7 +1204,7 @@ async def create( sharing if needed. ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). + [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -1861,7 +1861,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Instance: """ - \\**\\**Cookie Parameters\\**\\**: + **Cookie Parameters**: - `language` (str, optional): Language for the response content. Affects the `ddos_profile` field. Supported values: diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index ed944d22..788d415c 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -74,8 +74,8 @@ def create( - If you’re uploading your own key, provide the public part here (usually found in a file like `id_ed25519.pub`). - If you want the platform to generate an Ed25519 key pair for you, leave this - field empty — the system will return the private key in the response \\**\\**once - only\\**\\**. + field empty — the system will return the private key in the response **once + only**. shared_in_project: SSH key is shared with all users in the project @@ -336,8 +336,8 @@ async def create( - If you’re uploading your own key, provide the public part here (usually found in a file like `id_ed25519.pub`). - If you want the platform to generate an Ed25519 key pair for you, leave this - field empty — the system will return the private key in the response \\**\\**once - only\\**\\**. + field empty — the system will return the private key in the response **once + only**. shared_in_project: SSH key is shared with all users in the project diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index 7bfb002d..af3d54ae 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -85,7 +85,7 @@ class ServerCreateParams(TypedDict, total=False): ssh_key_name: Optional[str] """ Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). + [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). """ tags: TagUpdateMapParam 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 e6932827..35e4f578 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -52,7 +52,7 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): ssh_key_name: str """ Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). + [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). """ tags: TagUpdateMapParam diff --git a/src/gcore/types/cloud/inference/deployment_create_params.py b/src/gcore/types/cloud/inference/deployment_create_params.py index 53d35fd0..226f23fd 100644 --- a/src/gcore/types/cloud/inference/deployment_create_params.py +++ b/src/gcore/types/cloud/inference/deployment_create_params.py @@ -53,8 +53,8 @@ class DeploymentCreateParams(TypedDict, total=False): auth_enabled: bool """Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is - required for the requests to the instance if enabled + `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + for the requests to the instance if enabled """ command: Optional[List[str]] diff --git a/src/gcore/types/cloud/inference/deployment_update_params.py b/src/gcore/types/cloud/inference/deployment_update_params.py index 42111525..005e1304 100644 --- a/src/gcore/types/cloud/inference/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -47,8 +47,8 @@ class DeploymentUpdateParams(TypedDict, total=False): auth_enabled: bool """Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is - required for the requests to the instance if enabled + `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + for the requests to the instance if enabled """ command: Optional[List[str]] diff --git a/src/gcore/types/cloud/inference/inference.py b/src/gcore/types/cloud/inference/inference.py index 20d10c74..34dbef52 100644 --- a/src/gcore/types/cloud/inference/inference.py +++ b/src/gcore/types/cloud/inference/inference.py @@ -19,8 +19,8 @@ class Inference(BaseModel): auth_enabled: bool """`true` if instance uses API key authentication. - `"Authorization": "Bearer \\**\\**\\**\\**\\**"` or `"X-Api-Key": "\\**\\**\\**\\**\\**"` header is - required for the requests to the instance if enabled. + `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + for the requests to the instance if enabled. """ command: Optional[str] = None diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index db34609e..b4eaebeb 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -110,7 +110,7 @@ class InstanceCreateParams(TypedDict, total=False): ssh_key_name: Optional[str] """ Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](#operation/SSHKeyCollectionViewSet.post). + [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). """ tags: TagUpdateMapParam @@ -410,7 +410,7 @@ class VolumeCreateInstanceCreateNewVolumeSerializer(TypedDict, total=False): IOPS: 9000. Max bandwidth: 500 MB/s. - `ssd_lowlatency` - SSD storage optimized for low-latency and real-time processing. Max IOPS: 5000. Average latency: 300 µs. Snapshots and volume - resizing are \\**\\**not\\**\\** supported for `ssd_lowlatency`. + resizing are **not** supported for `ssd_lowlatency`. """ @@ -446,7 +446,7 @@ class VolumeCreateInstanceCreateVolumeFromImageSerializer(TypedDict, total=False size: int """Volume size in GiB. - - For instances: \\**\\**specify the desired volume size explicitly\\**\\**. + - For instances: **specify the desired volume size explicitly**. - For basic VMs: the size is set automatically based on the flavor. """ @@ -471,7 +471,7 @@ class VolumeCreateInstanceCreateVolumeFromImageSerializer(TypedDict, total=False IOPS: 9000. Max bandwidth: 500 MB/s. - `ssd_lowlatency` - SSD storage optimized for low-latency and real-time processing. Max IOPS: 5000. Average latency: 300 µs. Snapshots and volume - resizing are \\**\\**not\\**\\** supported for `ssd_lowlatency`. + resizing are **not** supported for `ssd_lowlatency`. """ @@ -571,7 +571,7 @@ class VolumeCreateInstanceCreateVolumeFromApptemplateSerializer(TypedDict, total IOPS: 9000. Max bandwidth: 500 MB/s. - `ssd_lowlatency` - SSD storage optimized for low-latency and real-time processing. Max IOPS: 5000. Average latency: 300 µs. Snapshots and volume - resizing are \\**\\**not\\**\\** supported for `ssd_lowlatency`. + resizing are **not** supported for `ssd_lowlatency`. """ diff --git a/src/gcore/types/cloud/ssh_key_create_params.py b/src/gcore/types/cloud/ssh_key_create_params.py index df3d979e..65008f58 100644 --- a/src/gcore/types/cloud/ssh_key_create_params.py +++ b/src/gcore/types/cloud/ssh_key_create_params.py @@ -23,8 +23,8 @@ class SSHKeyCreateParams(TypedDict, total=False): - If you’re uploading your own key, provide the public part here (usually found in a file like `id_ed25519.pub`). - If you want the platform to generate an Ed25519 key pair for you, leave this - field empty — the system will return the private key in the response \\**\\**once - only\\**\\**. + field empty — the system will return the private key in the response **once + only**. """ shared_in_project: bool diff --git a/src/gcore/types/cloud/ssh_key_created.py b/src/gcore/types/cloud/ssh_key_created.py index de70dd72..7e304ed8 100644 --- a/src/gcore/types/cloud/ssh_key_created.py +++ b/src/gcore/types/cloud/ssh_key_created.py @@ -27,11 +27,10 @@ class SSHKeyCreated(BaseModel): It should never be shared or exposed. This key is used to prove your identity when connecting to a server. If you omit the `public_key`, the platform will - generate a key for you. The `private_key` will be returned \\**\\**once\\**\\** in the - API response. Be sure to save it securely, as it cannot be retrieved again - later. Best practice: Save the private key to a secure location on your machine - (e.g., `~/.ssh/id_ed25519`) and set the file permissions to be readable only by - you. + generate a key for you. The `private_key` will be returned **once** in the API + response. Be sure to save it securely, as it cannot be retrieved again later. + Best practice: Save the private key to a secure location on your machine (e.g., + `~/.ssh/id_ed25519`) and set the file permissions to be readable only by you. """ project_id: int From f58b86c1fc3d6d3fb8c6ee6b38877c5646b9845f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 02:17:52 +0000 Subject: [PATCH 152/592] chore(tests): run tests in parallel --- pyproject.toml | 3 ++- requirements-dev.lock | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index fe438871..a1fdefd4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,7 @@ dev-dependencies = [ "importlib-metadata>=6.7.0", "rich>=13.7.1", "nest_asyncio==1.6.0", + "pytest-xdist>=3.6.1", ] [tool.rye.scripts] @@ -125,7 +126,7 @@ replacement = '[\1](https://github.com/G-Core/gcore-python/tree/main/\g<2>)' [tool.pytest.ini_options] testpaths = ["tests"] -addopts = "--tb=short" +addopts = "--tb=short -n auto" xfail_strict = true asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "session" diff --git a/requirements-dev.lock b/requirements-dev.lock index 045eb8c6..1db72836 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -30,6 +30,8 @@ distro==1.8.0 exceptiongroup==1.2.2 # via anyio # via pytest +execnet==2.1.1 + # via pytest-xdist filelock==3.12.4 # via virtualenv h11==0.14.0 @@ -72,7 +74,9 @@ pygments==2.18.0 pyright==1.1.399 pytest==8.3.3 # via pytest-asyncio + # via pytest-xdist pytest-asyncio==0.24.0 +pytest-xdist==3.7.0 python-dateutil==2.8.2 # via time-machine pytz==2023.3.post1 From ddf6a1fb47634ca7036b6ea80493c78161e41b33 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 02:43:24 +0000 Subject: [PATCH 153/592] fix(client): correctly parse binary response | stream --- src/gcore/_base_client.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index 8ec9e968..41e09d0e 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -1071,7 +1071,14 @@ def _process_response( ) -> ResponseT: origin = get_origin(cast_to) or cast_to - if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): + if ( + inspect.isclass(origin) + and issubclass(origin, BaseAPIResponse) + # we only want to actually return the custom BaseAPIResponse class if we're + # returning the raw response, or if we're not streaming SSE, as if we're streaming + # SSE then `cast_to` doesn't actively reflect the type we need to parse into + and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER))) + ): if not issubclass(origin, APIResponse): raise TypeError(f"API Response types must subclass {APIResponse}; Received {origin}") @@ -1574,7 +1581,14 @@ async def _process_response( ) -> ResponseT: origin = get_origin(cast_to) or cast_to - if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): + if ( + inspect.isclass(origin) + and issubclass(origin, BaseAPIResponse) + # we only want to actually return the custom BaseAPIResponse class if we're + # returning the raw response, or if we're not streaming SSE, as if we're streaming + # SSE then `cast_to` doesn't actively reflect the type we need to parse into + and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER))) + ): if not issubclass(origin, AsyncAPIResponse): raise TypeError(f"API Response types must subclass {AsyncAPIResponse}; Received {origin}") From 00646d2af5c5b17844a472ecd5dd7dd1154b7110 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 10:10:28 +0000 Subject: [PATCH 154/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9a4135ab..63c9fce3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 265 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b7b7aec77d8afcc1daafe4273a4df1b91bd0f6a14c8cfda737128fa5ced95c6e.yml -openapi_spec_hash: fc50ae08d09f3f70238ff08b9bb5be01 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ec69983f41d17b5c41a7a1b04943799b565aea2cf8b8e63ec487262f114e4ea9.yml +openapi_spec_hash: 311a942550dd9c17eb8b5ca0aedebbe1 config_hash: c5bfaf05e59e681224296d5438e745a4 From b9bad794d32108d072bfa581df7cd2e3a139cb38 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 12:14:20 +0000 Subject: [PATCH 155/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 63c9fce3..28296b94 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 265 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ec69983f41d17b5c41a7a1b04943799b565aea2cf8b8e63ec487262f114e4ea9.yml -openapi_spec_hash: 311a942550dd9c17eb8b5ca0aedebbe1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6a482835873f22f6f98508fa93f14ad7caa02009fee5a16fd23642880a0a4a88.yml +openapi_spec_hash: fbf2c5a3dc8b5e4b892902c91bcf2a66 config_hash: c5bfaf05e59e681224296d5438e745a4 From 06d04b782e9abbdec198be792e4defab23d6003e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 12:42:48 +0000 Subject: [PATCH 156/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 28296b94..8d4fdc5c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 265 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6a482835873f22f6f98508fa93f14ad7caa02009fee5a16fd23642880a0a4a88.yml -openapi_spec_hash: fbf2c5a3dc8b5e4b892902c91bcf2a66 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-eb3cc022219eaf1b5c72f5413b1873f74a267264be04caf25680d08cecbd1e4a.yml +openapi_spec_hash: 340e26fa30be153b4ae89b182a73f463 config_hash: c5bfaf05e59e681224296d5438e745a4 From 7803471d8630025f29341ab05154db4f1a24c25e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:52:47 +0000 Subject: [PATCH 157/592] feat(api): manual upload of aggregated API specs --- .stats.yml | 4 ++-- src/gcore/resources/cloud/baremetal/servers.py | 4 ++-- .../cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py | 4 ++-- src/gcore/resources/cloud/instances/instances.py | 4 ++-- src/gcore/types/cloud/baremetal/server_create_params.py | 2 +- src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py | 2 +- src/gcore/types/cloud/instance_create_params.py | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8d4fdc5c..ee2ba0b0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 265 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-eb3cc022219eaf1b5c72f5413b1873f74a267264be04caf25680d08cecbd1e4a.yml -openapi_spec_hash: 340e26fa30be153b4ae89b182a73f463 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9f277047ffe4ce427a812f083bb260ee12f69d06b101797b37763bbf28c0160e.yml +openapi_spec_hash: 7292372f2e52abf3c2ded456e1bcc9f3 config_hash: c5bfaf05e59e681224296d5438e745a4 diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 7f4dbd8b..6c4b9ade 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -125,7 +125,7 @@ def create( password of the Admin user cannot be updated via '`user_data`'. ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -482,7 +482,7 @@ async def create( password of the Admin user cannot be updated via '`user_data`'. ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index f9624f4d..8d45b05f 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -143,7 +143,7 @@ def create( instance ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -607,7 +607,7 @@ async def create( instance ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 7817e2fe..9112c6d2 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -198,7 +198,7 @@ def create( sharing if needed. ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -1204,7 +1204,7 @@ async def create( sharing if needed. ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index af3d54ae..9c6dc5d1 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -85,7 +85,7 @@ class ServerCreateParams(TypedDict, total=False): ssh_key_name: Optional[str] """ Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). """ tags: TagUpdateMapParam 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 35e4f578..210346b4 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -52,7 +52,7 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): ssh_key_name: str """ Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). """ tags: TagUpdateMapParam diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index b4eaebeb..3f6762bc 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -110,7 +110,7 @@ class InstanceCreateParams(TypedDict, total=False): ssh_key_name: Optional[str] """ Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). """ tags: TagUpdateMapParam From 2b44a14c8ce60bebfb22109405057253c50289cd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 15:38:12 +0000 Subject: [PATCH 158/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ee2ba0b0..e2ace7f0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 265 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9f277047ffe4ce427a812f083bb260ee12f69d06b101797b37763bbf28c0160e.yml -openapi_spec_hash: 7292372f2e52abf3c2ded456e1bcc9f3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b5883594159ef5544fde3856674f72adc1000c03aaf48ec8b7ba7ca9b128c66d.yml +openapi_spec_hash: beacedf1517348ed0158b7d9f530fc62 config_hash: c5bfaf05e59e681224296d5438e745a4 From 0f247a1186e2110722da6e492e9814145377306a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 02:50:29 +0000 Subject: [PATCH 159/592] chore(tests): add tests for httpx client instantiation & proxies --- tests/test_client.py | 53 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index 4a348f1a..c6b0df66 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -27,7 +27,14 @@ from gcore._models import BaseModel, FinalRequestOptions from gcore._constants import RAW_RESPONSE_HEADER from gcore._exceptions import GcoreError, APIStatusError, APITimeoutError, APIResponseValidationError -from gcore._base_client import DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, make_request_options +from gcore._base_client import ( + DEFAULT_TIMEOUT, + HTTPX_DEFAULT_TIMEOUT, + BaseClient, + DefaultHttpxClient, + DefaultAsyncHttpxClient, + make_request_options, +) from gcore.types.cloud.project_create_params import ProjectCreateParams from .utils import update_env @@ -835,6 +842,28 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert response.http_request.headers.get("x-stainless-retry-count") == "42" + def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: + # Test that the proxy environment variables are set correctly + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + + client = DefaultHttpxClient() + + mounts = tuple(client._mounts.items()) + assert len(mounts) == 1 + assert mounts[0][0].pattern == "https://" + + @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") + def test_default_client_creation(self) -> None: + # Ensure that the client can be initialized without any exceptions + DefaultHttpxClient( + verify=True, + cert=None, + trust_env=True, + http1=True, + http2=False, + limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), + ) + @pytest.mark.respx(base_url=base_url) def test_follow_redirects(self, respx_mock: MockRouter) -> None: # Test that the default follow_redirects=True allows following redirects @@ -1710,6 +1739,28 @@ async def test_main() -> None: time.sleep(0.1) + async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: + # Test that the proxy environment variables are set correctly + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + + client = DefaultAsyncHttpxClient() + + mounts = tuple(client._mounts.items()) + assert len(mounts) == 1 + assert mounts[0][0].pattern == "https://" + + @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") + async def test_default_client_creation(self) -> None: + # Ensure that the client can be initialized without any exceptions + DefaultAsyncHttpxClient( + verify=True, + cert=None, + trust_env=True, + http1=True, + http2=False, + limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), + ) + @pytest.mark.respx(base_url=base_url) async def test_follow_redirects(self, respx_mock: MockRouter) -> None: # Test that the default follow_redirects=True allows following redirects From e74c6ed97a7bf6e31445ce7f99bd4c3c4cce6b8b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 04:22:35 +0000 Subject: [PATCH 160/592] chore(internal): update conftest.py --- tests/conftest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index c8b5577d..38916e21 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + from __future__ import annotations import os From 41fc89d7fe8b7411a5f2fb00456205efb2f51e34 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 06:58:58 +0000 Subject: [PATCH 161/592] chore(ci): enable for pull requests --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b773a6a1..f6054ec3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,10 @@ on: - 'integrated/**' - 'stl-preview-head/**' - 'stl-preview-base/**' + pull_request: + branches-ignore: + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: From ee053b462ed519284bd09e8d1e9935ae1d74cd90 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 07:58:33 +0000 Subject: [PATCH 162/592] feat(waap): add domain analytics, api_paths, insights and insight_silences; and ip_info --- .stats.yml | 4 +- api.md | 280 +++-- src/gcore/resources/waap/__init__.py | 28 + src/gcore/resources/waap/advanced_rules.py | 10 +- src/gcore/resources/waap/clients.py | 135 +++ src/gcore/resources/waap/custom_page_sets.py | 120 +- src/gcore/resources/waap/domains/__init__.py | 98 ++ .../resources/waap/domains/advanced_rules.py | 44 +- .../waap/domains/analytics/__init__.py | 33 + .../waap/domains/analytics/analytics.py | 676 +++++++++++ .../waap/domains/analytics/requests.py | 378 ++++++ .../waap/domains/api_discovery/__init__.py | 33 + .../domains/api_discovery/api_discovery.py | 530 +++++++++ .../domains/api_discovery/scan_results.py | 352 ++++++ .../resources/waap/domains/api_path_groups.py | 163 +++ src/gcore/resources/waap/domains/api_paths.py | 771 +++++++++++++ .../resources/waap/domains/custom_rules.py | 44 +- src/gcore/resources/waap/domains/domains.py | 303 +++++ .../resources/waap/domains/firewall_rules.py | 38 +- .../waap/domains/insight_silences.py | 689 +++++++++++ src/gcore/resources/waap/domains/insights.py | 425 +++++++ src/gcore/resources/waap/domains/policies.py | 173 +++ src/gcore/resources/waap/domains/settings.py | 10 +- src/gcore/resources/waap/ip_info.py | 1017 +++++++++++++++++ src/gcore/resources/waap/organizations.py | 14 +- src/gcore/resources/waap/statistics.py | 10 +- src/gcore/resources/waap/tags.py | 14 +- src/gcore/resources/waap/waap.py | 74 +- src/gcore/types/waap/__init__.py | 116 +- .../waap/advanced_rule_descriptor_list.py | 15 - .../{client_info.py => client_me_response.py} | 15 +- src/gcore/types/waap/custom_page_set.py | 36 - .../waap/custom_page_set_create_params.py | 24 +- .../waap/custom_page_set_preview_params.py | 15 +- .../waap/custom_page_set_update_params.py | 24 +- .../waap/domain_list_rule_sets_response.py | 10 + src/gcore/types/waap/domains/__init__.py | 34 +- .../waap/domains/advanced_rule_list_params.py | 4 +- .../types/waap/domains/analytics/__init__.py | 5 + .../domains/analytics/request_list_params.py | 53 + .../analytics_get_event_statistics_params.py | 34 + .../analytics_list_ddos_attacks_params.py | 28 + .../analytics_list_ddos_info_params.py | 31 + .../analytics_list_event_traffic_params.py | 26 + .../analytics_list_event_traffic_response.py | 10 + .../waap/domains/api_discovery/__init__.py | 7 + .../api_discovery/scan_result_get_response.py | 29 + .../api_discovery/scan_result_list_params.py | 41 + .../scan_result_list_response.py | 29 + .../api_discovery_get_settings_response.py | 36 + .../api_discovery_scan_openapi_response.py | 10 + .../api_discovery_update_settings_params.py | 34 + .../api_discovery_update_settings_response.py | 36 + .../api_discovery_upload_openapi_params.py | 19 + .../api_discovery_upload_openapi_response.py | 10 + .../waap/domains/api_path_create_params.py | 31 + .../waap/domains/api_path_create_response.py | 50 + .../waap/domains/api_path_get_response.py | 50 + .../domains/api_path_group_list_response.py | 12 + .../waap/domains/api_path_list_params.py | 62 + .../waap/domains/api_path_list_response.py | 50 + .../waap/domains/api_path_update_params.py | 29 + .../waap/domains/custom_rule_list_params.py | 4 +- .../types/waap/domains/insight_list_params.py | 34 + .../waap/domains/insight_replace_params.py | 17 + .../domains/insight_silence_create_params.py | 28 + .../domains/insight_silence_list_params.py | 33 + .../domains/insight_silence_update_params.py | 28 + .../ip_info_get_attack_time_series_params.py | 12 + ...ip_info_get_attack_time_series_response.py | 10 + .../ip_info_get_blocked_requests_params.py | 15 + .../ip_info_get_blocked_requests_response.py | 10 + .../types/waap/ip_info_get_counts_params.py | 19 + .../ip_info_get_ddos_attack_series_params.py | 12 + src/gcore/types/waap/ip_info_get_params.py | 12 + .../waap/ip_info_get_top_sessions_params.py | 15 + .../waap/ip_info_get_top_sessions_response.py | 10 + .../types/waap/ip_info_get_top_urls_params.py | 15 + .../waap/ip_info_get_top_urls_response.py | 10 + .../ip_info_get_top_user_agents_params.py | 15 + .../ip_info_get_top_user_agents_response.py | 10 + .../ip_info_list_attacked_countries_params.py | 12 + ...p_info_list_attacked_countries_response.py | 10 + src/gcore/types/waap/quota_item.py | 13 - ...advanced_rule.py => waap_advanced_rule.py} | 6 +- ...or.py => waap_advanced_rule_descriptor.py} | 4 +- .../waap_advanced_rule_descriptor_list.py | 15 + ...e_data.py => waap_block_csrf_page_data.py} | 4 +- ....py => waap_block_csrf_page_data_param.py} | 4 +- ...k_page_data.py => waap_block_page_data.py} | 4 +- ...param.py => waap_block_page_data_param.py} | 4 +- .../types/waap/waap_blocked_statistics.py | 36 + ...page_data.py => waap_captcha_page_data.py} | 4 +- ...ram.py => waap_captcha_page_data_param.py} | 4 +- src/gcore/types/waap/waap_common_tag.py | 16 + ...a.py => waap_cookie_disabled_page_data.py} | 4 +- ...> waap_cookie_disabled_page_data_param.py} | 4 +- src/gcore/types/waap/waap_count_statistics.py | 36 + ...om_page.py => waap_custom_page_preview.py} | 4 +- src/gcore/types/waap/waap_custom_page_set.py | 36 + .../custom_rule.py => waap_custom_rule.py} | 6 +- ...on_type.py => waap_customer_rule_state.py} | 4 +- src/gcore/types/waap/waap_ddos_attack.py | 16 + src/gcore/types/waap/waap_ddos_info.py | 17 + src/gcore/types/waap/waap_detailed_domain.py | 13 +- ...ettings.py => waap_domain_api_settings.py} | 13 +- src/gcore/types/waap/waap_domain_policy.py | 29 + .../types/waap/waap_domain_settings_model.py | 15 + src/gcore/types/waap/waap_event_statistics.py | 15 + ...firewall_rule.py => waap_firewall_rule.py} | 6 +- .../waap_get_account_overview_response.py | 34 + ...ge_data.py => waap_handshake_page_data.py} | 4 +- ...m.py => waap_handshake_page_data_param.py} | 4 +- src/gcore/types/waap/waap_insight.py | 38 + src/gcore/types/waap/waap_insight_silence.py | 28 + .../waap/waap_insight_silence_sort_by.py | 9 + src/gcore/types/waap/waap_insight_sort_by.py | 20 + src/gcore/types/waap/waap_insight_status.py | 7 + .../types/waap/waap_ip_country_attack.py | 16 + .../types/waap/waap_ip_ddos_info_model.py | 23 + src/gcore/types/waap/waap_ip_info.py | 57 + src/gcore/types/waap/waap_ip_info_counts.py | 16 + ... => waap_javascript_disabled_page_data.py} | 4 +- ...ap_javascript_disabled_page_data_param.py} | 4 +- src/gcore/types/waap/waap_network_details.py | 17 + .../{organization.py => waap_organization.py} | 4 +- src/gcore/types/waap/waap_page_type.py | 9 + .../waap/waap_paginated_custom_page_set.py | 22 + .../types/waap/waap_paginated_ddos_attack.py | 22 + .../types/waap/waap_paginated_ddos_info.py | 22 + .../waap/waap_paginated_request_summary.py | 22 + .../types/waap/waap_pattern_matched_tag.py | 37 + src/gcore/types/waap/waap_policy_action.py | 7 + src/gcore/types/waap/waap_policy_mode.py | 10 + src/gcore/types/waap/waap_request_details.py | 92 ++ .../types/waap/waap_request_organization.py | 13 + src/gcore/types/waap/waap_request_summary.py | 59 + ...tomer_rule_state.py => waap_resolution.py} | 4 +- src/gcore/types/waap/waap_rule_action_type.py | 7 + .../types/waap/waap_rule_blocked_requests.py | 16 + src/gcore/types/waap/waap_rule_set.py | 41 + ...atistic_item.py => waap_statistic_item.py} | 4 +- ...cs_series.py => waap_statistics_series.py} | 10 +- src/gcore/types/waap/{tag.py => waap_tag.py} | 4 +- .../types/waap/waap_time_series_attack.py | 23 + src/gcore/types/waap/waap_top_session.py | 24 + src/gcore/types/waap/waap_top_url.py | 13 + src/gcore/types/waap/waap_top_user_agent.py | 13 + src/gcore/types/waap/waap_traffic_metrics.py | 68 ++ src/gcore/types/waap/waap_traffic_type.py | 28 + .../types/waap/waap_user_agent_details.py | 40 + tests/api_resources/test_waap.py | 14 +- .../waap/domains/analytics/__init__.py | 1 + .../waap/domains/analytics/test_requests.py | 214 ++++ .../waap/domains/api_discovery/__init__.py | 1 + .../api_discovery/test_scan_results.py | 198 ++++ .../waap/domains/test_advanced_rules.py | 48 +- .../waap/domains/test_analytics.py | 399 +++++++ .../waap/domains/test_api_discovery.py | 311 +++++ .../waap/domains/test_api_path_groups.py | 84 ++ .../waap/domains/test_api_paths.py | 507 ++++++++ .../waap/domains/test_custom_rules.py | 48 +- .../waap/domains/test_firewall_rules.py | 48 +- .../waap/domains/test_insight_silences.py | 524 +++++++++ .../waap/domains/test_insights.py | 289 +++++ .../waap/domains/test_policies.py | 106 ++ .../waap/domains/test_settings.py | 14 +- .../api_resources/waap/test_advanced_rules.py | 14 +- tests/api_resources/waap/test_clients.py | 72 ++ .../waap/test_custom_page_sets.py | 64 +- tests/api_resources/waap/test_domains.py | 63 + tests/api_resources/waap/test_ip_info.py | 630 ++++++++++ .../api_resources/waap/test_organizations.py | 18 +- tests/api_resources/waap/test_statistics.py | 14 +- tests/api_resources/waap/test_tags.py | 18 +- 175 files changed, 12155 insertions(+), 583 deletions(-) create mode 100644 src/gcore/resources/waap/clients.py create mode 100644 src/gcore/resources/waap/domains/analytics/__init__.py create mode 100644 src/gcore/resources/waap/domains/analytics/analytics.py create mode 100644 src/gcore/resources/waap/domains/analytics/requests.py create mode 100644 src/gcore/resources/waap/domains/api_discovery/__init__.py create mode 100644 src/gcore/resources/waap/domains/api_discovery/api_discovery.py create mode 100644 src/gcore/resources/waap/domains/api_discovery/scan_results.py create mode 100644 src/gcore/resources/waap/domains/api_path_groups.py create mode 100644 src/gcore/resources/waap/domains/api_paths.py create mode 100644 src/gcore/resources/waap/domains/insight_silences.py create mode 100644 src/gcore/resources/waap/domains/insights.py create mode 100644 src/gcore/resources/waap/domains/policies.py create mode 100644 src/gcore/resources/waap/ip_info.py delete mode 100644 src/gcore/types/waap/advanced_rule_descriptor_list.py rename src/gcore/types/waap/{client_info.py => client_me_response.py} (62%) delete mode 100644 src/gcore/types/waap/custom_page_set.py create mode 100644 src/gcore/types/waap/domain_list_rule_sets_response.py create mode 100644 src/gcore/types/waap/domains/analytics/__init__.py create mode 100644 src/gcore/types/waap/domains/analytics/request_list_params.py create mode 100644 src/gcore/types/waap/domains/analytics_get_event_statistics_params.py create mode 100644 src/gcore/types/waap/domains/analytics_list_ddos_attacks_params.py create mode 100644 src/gcore/types/waap/domains/analytics_list_ddos_info_params.py create mode 100644 src/gcore/types/waap/domains/analytics_list_event_traffic_params.py create mode 100644 src/gcore/types/waap/domains/analytics_list_event_traffic_response.py create mode 100644 src/gcore/types/waap/domains/api_discovery/__init__.py create mode 100644 src/gcore/types/waap/domains/api_discovery/scan_result_get_response.py create mode 100644 src/gcore/types/waap/domains/api_discovery/scan_result_list_params.py create mode 100644 src/gcore/types/waap/domains/api_discovery/scan_result_list_response.py create mode 100644 src/gcore/types/waap/domains/api_discovery_get_settings_response.py create mode 100644 src/gcore/types/waap/domains/api_discovery_scan_openapi_response.py create mode 100644 src/gcore/types/waap/domains/api_discovery_update_settings_params.py create mode 100644 src/gcore/types/waap/domains/api_discovery_update_settings_response.py create mode 100644 src/gcore/types/waap/domains/api_discovery_upload_openapi_params.py create mode 100644 src/gcore/types/waap/domains/api_discovery_upload_openapi_response.py create mode 100644 src/gcore/types/waap/domains/api_path_create_params.py create mode 100644 src/gcore/types/waap/domains/api_path_create_response.py create mode 100644 src/gcore/types/waap/domains/api_path_get_response.py create mode 100644 src/gcore/types/waap/domains/api_path_group_list_response.py create mode 100644 src/gcore/types/waap/domains/api_path_list_params.py create mode 100644 src/gcore/types/waap/domains/api_path_list_response.py create mode 100644 src/gcore/types/waap/domains/api_path_update_params.py create mode 100644 src/gcore/types/waap/domains/insight_list_params.py create mode 100644 src/gcore/types/waap/domains/insight_replace_params.py create mode 100644 src/gcore/types/waap/domains/insight_silence_create_params.py create mode 100644 src/gcore/types/waap/domains/insight_silence_list_params.py create mode 100644 src/gcore/types/waap/domains/insight_silence_update_params.py create mode 100644 src/gcore/types/waap/ip_info_get_attack_time_series_params.py create mode 100644 src/gcore/types/waap/ip_info_get_attack_time_series_response.py create mode 100644 src/gcore/types/waap/ip_info_get_blocked_requests_params.py create mode 100644 src/gcore/types/waap/ip_info_get_blocked_requests_response.py create mode 100644 src/gcore/types/waap/ip_info_get_counts_params.py create mode 100644 src/gcore/types/waap/ip_info_get_ddos_attack_series_params.py create mode 100644 src/gcore/types/waap/ip_info_get_params.py create mode 100644 src/gcore/types/waap/ip_info_get_top_sessions_params.py create mode 100644 src/gcore/types/waap/ip_info_get_top_sessions_response.py create mode 100644 src/gcore/types/waap/ip_info_get_top_urls_params.py create mode 100644 src/gcore/types/waap/ip_info_get_top_urls_response.py create mode 100644 src/gcore/types/waap/ip_info_get_top_user_agents_params.py create mode 100644 src/gcore/types/waap/ip_info_get_top_user_agents_response.py create mode 100644 src/gcore/types/waap/ip_info_list_attacked_countries_params.py create mode 100644 src/gcore/types/waap/ip_info_list_attacked_countries_response.py delete mode 100644 src/gcore/types/waap/quota_item.py rename src/gcore/types/waap/{domains/advanced_rule.py => waap_advanced_rule.py} (94%) rename src/gcore/types/waap/{advanced_rule_descriptor.py => waap_advanced_rule_descriptor.py} (89%) create mode 100644 src/gcore/types/waap/waap_advanced_rule_descriptor_list.py rename src/gcore/types/waap/{block_csrf_page_data.py => waap_block_csrf_page_data.py} (91%) rename src/gcore/types/waap/{block_csrf_page_data_param.py => waap_block_csrf_page_data_param.py} (88%) rename src/gcore/types/waap/{block_page_data.py => waap_block_page_data.py} (92%) rename src/gcore/types/waap/{block_page_data_param.py => waap_block_page_data_param.py} (89%) create mode 100644 src/gcore/types/waap/waap_blocked_statistics.py rename src/gcore/types/waap/{captcha_page_data.py => waap_captcha_page_data.py} (92%) rename src/gcore/types/waap/{captcha_page_data_param.py => waap_captcha_page_data_param.py} (89%) create mode 100644 src/gcore/types/waap/waap_common_tag.py rename src/gcore/types/waap/{cookie_disabled_page_data.py => waap_cookie_disabled_page_data.py} (83%) rename src/gcore/types/waap/{javascript_disabled_page_data_param.py => waap_cookie_disabled_page_data_param.py} (79%) create mode 100644 src/gcore/types/waap/waap_count_statistics.py rename src/gcore/types/waap/{preview_custom_page.py => waap_custom_page_preview.py} (70%) create mode 100644 src/gcore/types/waap/waap_custom_page_set.py rename src/gcore/types/waap/{domains/custom_rule.py => waap_custom_rule.py} (99%) rename src/gcore/types/waap/{rule_action_type.py => waap_customer_rule_state.py} (52%) create mode 100644 src/gcore/types/waap/waap_ddos_attack.py create mode 100644 src/gcore/types/waap/waap_ddos_info.py rename src/gcore/types/waap/{waap_domain_settings.py => waap_domain_api_settings.py} (65%) create mode 100644 src/gcore/types/waap/waap_domain_policy.py create mode 100644 src/gcore/types/waap/waap_domain_settings_model.py create mode 100644 src/gcore/types/waap/waap_event_statistics.py rename src/gcore/types/waap/{domains/firewall_rule.py => waap_firewall_rule.py} (92%) create mode 100644 src/gcore/types/waap/waap_get_account_overview_response.py rename src/gcore/types/waap/{handshake_page_data.py => waap_handshake_page_data.py} (90%) rename src/gcore/types/waap/{handshake_page_data_param.py => waap_handshake_page_data_param.py} (87%) create mode 100644 src/gcore/types/waap/waap_insight.py create mode 100644 src/gcore/types/waap/waap_insight_silence.py create mode 100644 src/gcore/types/waap/waap_insight_silence_sort_by.py create mode 100644 src/gcore/types/waap/waap_insight_sort_by.py create mode 100644 src/gcore/types/waap/waap_insight_status.py create mode 100644 src/gcore/types/waap/waap_ip_country_attack.py create mode 100644 src/gcore/types/waap/waap_ip_ddos_info_model.py create mode 100644 src/gcore/types/waap/waap_ip_info.py create mode 100644 src/gcore/types/waap/waap_ip_info_counts.py rename src/gcore/types/waap/{javascript_disabled_page_data.py => waap_javascript_disabled_page_data.py} (82%) rename src/gcore/types/waap/{cookie_disabled_page_data_param.py => waap_javascript_disabled_page_data_param.py} (78%) create mode 100644 src/gcore/types/waap/waap_network_details.py rename src/gcore/types/waap/{organization.py => waap_organization.py} (77%) create mode 100644 src/gcore/types/waap/waap_page_type.py create mode 100644 src/gcore/types/waap/waap_paginated_custom_page_set.py create mode 100644 src/gcore/types/waap/waap_paginated_ddos_attack.py create mode 100644 src/gcore/types/waap/waap_paginated_ddos_info.py create mode 100644 src/gcore/types/waap/waap_paginated_request_summary.py create mode 100644 src/gcore/types/waap/waap_pattern_matched_tag.py create mode 100644 src/gcore/types/waap/waap_policy_action.py create mode 100644 src/gcore/types/waap/waap_policy_mode.py create mode 100644 src/gcore/types/waap/waap_request_details.py create mode 100644 src/gcore/types/waap/waap_request_organization.py create mode 100644 src/gcore/types/waap/waap_request_summary.py rename src/gcore/types/waap/{customer_rule_state.py => waap_resolution.py} (58%) create mode 100644 src/gcore/types/waap/waap_rule_action_type.py create mode 100644 src/gcore/types/waap/waap_rule_blocked_requests.py create mode 100644 src/gcore/types/waap/waap_rule_set.py rename src/gcore/types/waap/{statistic_item.py => waap_statistic_item.py} (84%) rename src/gcore/types/waap/{statistics_series.py => waap_statistics_series.py} (57%) rename src/gcore/types/waap/{tag.py => waap_tag.py} (87%) create mode 100644 src/gcore/types/waap/waap_time_series_attack.py create mode 100644 src/gcore/types/waap/waap_top_session.py create mode 100644 src/gcore/types/waap/waap_top_url.py create mode 100644 src/gcore/types/waap/waap_top_user_agent.py create mode 100644 src/gcore/types/waap/waap_traffic_metrics.py create mode 100644 src/gcore/types/waap/waap_traffic_type.py create mode 100644 src/gcore/types/waap/waap_user_agent_details.py create mode 100644 tests/api_resources/waap/domains/analytics/__init__.py create mode 100644 tests/api_resources/waap/domains/analytics/test_requests.py create mode 100644 tests/api_resources/waap/domains/api_discovery/__init__.py create mode 100644 tests/api_resources/waap/domains/api_discovery/test_scan_results.py create mode 100644 tests/api_resources/waap/domains/test_analytics.py create mode 100644 tests/api_resources/waap/domains/test_api_discovery.py create mode 100644 tests/api_resources/waap/domains/test_api_path_groups.py create mode 100644 tests/api_resources/waap/domains/test_api_paths.py create mode 100644 tests/api_resources/waap/domains/test_insight_silences.py create mode 100644 tests/api_resources/waap/domains/test_insights.py create mode 100644 tests/api_resources/waap/domains/test_policies.py create mode 100644 tests/api_resources/waap/test_clients.py create mode 100644 tests/api_resources/waap/test_ip_info.py diff --git a/.stats.yml b/.stats.yml index e2ace7f0..b42d4f2b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 265 +configured_endpoints: 302 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b5883594159ef5544fde3856674f72adc1000c03aaf48ec8b7ba7ca9b128c66d.yml openapi_spec_hash: beacedf1517348ed0158b7d9f530fc62 -config_hash: c5bfaf05e59e681224296d5438e745a4 +config_hash: 62229a7a78ca1c79cb7cf61752a8df7e diff --git a/api.md b/api.md index 980c2dd6..82d3b4fb 100644 --- a/api.md +++ b/api.md @@ -856,161 +856,313 @@ Types: ```python from gcore.types.waap import ( - ClientInfo, - CustomerRuleState, - QuotaItem, - RuleActionType, + WaapAdvancedRule, + WaapAdvancedRuleDescriptor, + WaapAdvancedRuleDescriptorList, + WaapBlockCsrfPageData, + WaapBlockPageData, + WaapBlockedStatistics, + WaapCaptchaPageData, + WaapCommonTag, + WaapCookieDisabledPageData, + WaapCountStatistics, + WaapCustomPagePreview, + WaapCustomPageSet, + WaapCustomRule, + WaapCustomerRuleState, + WaapDDOSAttack, + WaapDDOSInfo, WaapDetailedDomain, + WaapDomainAPISettings, WaapDomainDDOSSettings, - WaapDomainSettings, + WaapDomainPolicy, + WaapDomainSettingsModel, WaapDomainStatus, + WaapEventStatistics, + WaapFirewallRule, + WaapHandshakePageData, + WaapInsight, + WaapInsightSilence, + WaapInsightSilenceSortBy, + WaapInsightSortBy, + WaapInsightStatus, + WaapInsightType, + WaapIPCountryAttack, + WaapIPDDOSInfoModel, + WaapIPInfo, + WaapIPInfoCounts, + WaapJavascriptDisabledPageData, + WaapNetworkDetails, + WaapOrganization, + WaapPageType, + WaapPaginatedCustomPageSet, + WaapPaginatedDDOSAttack, + WaapPaginatedDDOSInfo, + WaapPaginatedRequestSummary, + WaapPatternMatchedTag, + WaapPolicyAction, + WaapPolicyMode, + WaapRequestDetails, + WaapRequestOrganization, + WaapRequestSummary, + WaapResolution, + WaapRuleActionType, + WaapRuleBlockedRequests, + WaapRuleSet, + WaapStatisticItem, + WaapStatisticsSeries, WaapSummaryDomain, + WaapTag, + WaapTimeSeriesAttack, + WaapTopSession, + WaapTopURL, + WaapTopUserAgent, + WaapTrafficMetrics, + WaapTrafficType, + WaapUserAgentDetails, + WaapGetAccountOverviewResponse, ) ``` Methods: -- client.waap.get_account_overview() -> ClientInfo +- client.waap.get_account_overview() -> WaapGetAccountOverviewResponse -## Statistics +## Clients Types: ```python -from gcore.types.waap import StatisticItem, StatisticsSeries +from gcore.types.waap import ClientMeResponse ``` Methods: -- client.waap.statistics.get_usage_series(\*\*params) -> StatisticsSeries +- client.waap.clients.me() -> ClientMeResponse + +## Statistics + +Methods: + +- client.waap.statistics.get_usage_series(\*\*params) -> WaapStatisticsSeries ## Domains +Types: + +```python +from gcore.types.waap import DomainListRuleSetsResponse +``` + Methods: - client.waap.domains.update(domain_id, \*\*params) -> None - client.waap.domains.list(\*\*params) -> SyncOffsetPage[WaapSummaryDomain] - client.waap.domains.delete(domain_id) -> None - client.waap.domains.get(domain_id) -> WaapDetailedDomain +- client.waap.domains.list_rule_sets(domain_id) -> DomainListRuleSetsResponse ### Settings Methods: - client.waap.domains.settings.update(domain_id, \*\*params) -> None -- client.waap.domains.settings.get(domain_id) -> WaapDomainSettings +- client.waap.domains.settings.get(domain_id) -> WaapDomainSettingsModel -### CustomRules +### APIPaths Types: ```python -from gcore.types.waap.domains import CustomRule +from gcore.types.waap.domains import APIPathCreateResponse, APIPathListResponse, APIPathGetResponse ``` Methods: -- client.waap.domains.custom_rules.create(domain_id, \*\*params) -> CustomRule -- client.waap.domains.custom_rules.update(rule_id, \*, domain_id, \*\*params) -> None -- client.waap.domains.custom_rules.list(domain_id, \*\*params) -> SyncOffsetPage[CustomRule] -- client.waap.domains.custom_rules.delete(rule_id, \*, domain_id) -> None -- client.waap.domains.custom_rules.delete_multiple(domain_id, \*\*params) -> None -- client.waap.domains.custom_rules.get(rule_id, \*, domain_id) -> CustomRule -- client.waap.domains.custom_rules.toggle(action, \*, domain_id, rule_id) -> None +- client.waap.domains.api_paths.create(domain_id, \*\*params) -> APIPathCreateResponse +- client.waap.domains.api_paths.update(path_id, \*, domain_id, \*\*params) -> None +- client.waap.domains.api_paths.list(domain_id, \*\*params) -> SyncOffsetPage[APIPathListResponse] +- client.waap.domains.api_paths.delete(path_id, \*, domain_id) -> None +- client.waap.domains.api_paths.get(path_id, \*, domain_id) -> APIPathGetResponse -### FirewallRules +### APIPathGroups Types: ```python -from gcore.types.waap.domains import FirewallRule +from gcore.types.waap.domains import APIPathGroupListResponse ``` Methods: -- client.waap.domains.firewall_rules.create(domain_id, \*\*params) -> FirewallRule -- client.waap.domains.firewall_rules.update(rule_id, \*, domain_id, \*\*params) -> None -- client.waap.domains.firewall_rules.list(domain_id, \*\*params) -> SyncOffsetPage[FirewallRule] -- client.waap.domains.firewall_rules.delete(rule_id, \*, domain_id) -> None -- client.waap.domains.firewall_rules.delete_multiple(domain_id, \*\*params) -> None -- client.waap.domains.firewall_rules.get(rule_id, \*, domain_id) -> FirewallRule -- client.waap.domains.firewall_rules.toggle(action, \*, domain_id, rule_id) -> None +- client.waap.domains.api_path_groups.list(domain_id) -> APIPathGroupListResponse -### AdvancedRules +### APIDiscovery Types: ```python -from gcore.types.waap.domains import AdvancedRule +from gcore.types.waap.domains import ( + APIDiscoveryGetSettingsResponse, + APIDiscoveryScanOpenAPIResponse, + APIDiscoveryUpdateSettingsResponse, + APIDiscoveryUploadOpenAPIResponse, +) ``` Methods: -- client.waap.domains.advanced_rules.create(domain_id, \*\*params) -> AdvancedRule -- client.waap.domains.advanced_rules.update(rule_id, \*, domain_id, \*\*params) -> None -- client.waap.domains.advanced_rules.list(domain_id, \*\*params) -> SyncOffsetPage[AdvancedRule] -- client.waap.domains.advanced_rules.delete(rule_id, \*, domain_id) -> None -- client.waap.domains.advanced_rules.get(rule_id, \*, domain_id) -> AdvancedRule -- client.waap.domains.advanced_rules.toggle(action, \*, domain_id, rule_id) -> None +- client.waap.domains.api_discovery.get_settings(domain_id) -> APIDiscoveryGetSettingsResponse +- client.waap.domains.api_discovery.scan_openapi(domain_id) -> APIDiscoveryScanOpenAPIResponse +- client.waap.domains.api_discovery.update_settings(domain_id, \*\*params) -> APIDiscoveryUpdateSettingsResponse +- client.waap.domains.api_discovery.upload_openapi(domain_id, \*\*params) -> APIDiscoveryUploadOpenAPIResponse -## CustomPageSets +#### ScanResults Types: ```python -from gcore.types.waap import ( - BlockCsrfPageData, - BlockPageData, - CaptchaPageData, - CookieDisabledPageData, - CustomPageSet, - HandshakePageData, - JavascriptDisabledPageData, - PreviewCustomPage, -) +from gcore.types.waap.domains.api_discovery import ScanResultListResponse, ScanResultGetResponse ``` Methods: -- client.waap.custom_page_sets.create(\*\*params) -> CustomPageSet -- client.waap.custom_page_sets.update(set_id, \*\*params) -> None -- client.waap.custom_page_sets.list(\*\*params) -> SyncOffsetPage[CustomPageSet] -- client.waap.custom_page_sets.delete(set_id) -> None -- client.waap.custom_page_sets.get(set_id) -> CustomPageSet -- client.waap.custom_page_sets.preview(\*\*params) -> PreviewCustomPage +- client.waap.domains.api_discovery.scan_results.list(domain_id, \*\*params) -> SyncOffsetPage[ScanResultListResponse] +- client.waap.domains.api_discovery.scan_results.get(scan_id, \*, domain_id) -> ScanResultGetResponse -## AdvancedRules +### Insights -Types: +Methods: -```python -from gcore.types.waap import AdvancedRuleDescriptor, AdvancedRuleDescriptorList -``` +- client.waap.domains.insights.list(domain_id, \*\*params) -> SyncOffsetPage[WaapInsight] +- client.waap.domains.insights.get(insight_id, \*, domain_id) -> WaapInsight +- client.waap.domains.insights.replace(insight_id, \*, domain_id, \*\*params) -> WaapInsight + +### InsightSilences Methods: -- client.waap.advanced_rules.list() -> AdvancedRuleDescriptorList +- client.waap.domains.insight_silences.create(domain_id, \*\*params) -> WaapInsightSilence +- client.waap.domains.insight_silences.update(silence_id, \*, domain_id, \*\*params) -> WaapInsightSilence +- client.waap.domains.insight_silences.list(domain_id, \*\*params) -> SyncOffsetPage[WaapInsightSilence] +- client.waap.domains.insight_silences.delete(silence_id, \*, domain_id) -> None +- client.waap.domains.insight_silences.get(silence_id, \*, domain_id) -> WaapInsightSilence -## Tags +### Policies + +Methods: + +- client.waap.domains.policies.toggle(policy_id, \*, domain_id) -> WaapPolicyMode + +### Analytics Types: ```python -from gcore.types.waap import Tag +from gcore.types.waap.domains import AnalyticsListEventTrafficResponse ``` Methods: -- client.waap.tags.list(\*\*params) -> SyncOffsetPage[Tag] +- client.waap.domains.analytics.get_event_statistics(domain_id, \*\*params) -> WaapEventStatistics +- client.waap.domains.analytics.list_ddos_attacks(domain_id, \*\*params) -> SyncOffsetPage[WaapDDOSAttack] +- client.waap.domains.analytics.list_ddos_info(domain_id, \*\*params) -> SyncOffsetPage[WaapDDOSInfo] +- client.waap.domains.analytics.list_event_traffic(domain_id, \*\*params) -> AnalyticsListEventTrafficResponse + +#### Requests + +Methods: + +- client.waap.domains.analytics.requests.list(domain_id, \*\*params) -> SyncOffsetPage[WaapRequestSummary] +- client.waap.domains.analytics.requests.get(request_id, \*, domain_id) -> WaapRequestDetails + +### CustomRules + +Methods: + +- client.waap.domains.custom_rules.create(domain_id, \*\*params) -> WaapCustomRule +- client.waap.domains.custom_rules.update(rule_id, \*, domain_id, \*\*params) -> None +- client.waap.domains.custom_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapCustomRule] +- client.waap.domains.custom_rules.delete(rule_id, \*, domain_id) -> None +- client.waap.domains.custom_rules.delete_multiple(domain_id, \*\*params) -> None +- client.waap.domains.custom_rules.get(rule_id, \*, domain_id) -> WaapCustomRule +- client.waap.domains.custom_rules.toggle(action, \*, domain_id, rule_id) -> None + +### FirewallRules + +Methods: + +- client.waap.domains.firewall_rules.create(domain_id, \*\*params) -> WaapFirewallRule +- client.waap.domains.firewall_rules.update(rule_id, \*, domain_id, \*\*params) -> None +- client.waap.domains.firewall_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapFirewallRule] +- client.waap.domains.firewall_rules.delete(rule_id, \*, domain_id) -> None +- client.waap.domains.firewall_rules.delete_multiple(domain_id, \*\*params) -> None +- client.waap.domains.firewall_rules.get(rule_id, \*, domain_id) -> WaapFirewallRule +- client.waap.domains.firewall_rules.toggle(action, \*, domain_id, rule_id) -> None + +### AdvancedRules + +Methods: + +- client.waap.domains.advanced_rules.create(domain_id, \*\*params) -> WaapAdvancedRule +- client.waap.domains.advanced_rules.update(rule_id, \*, domain_id, \*\*params) -> None +- client.waap.domains.advanced_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapAdvancedRule] +- client.waap.domains.advanced_rules.delete(rule_id, \*, domain_id) -> None +- client.waap.domains.advanced_rules.get(rule_id, \*, domain_id) -> WaapAdvancedRule +- client.waap.domains.advanced_rules.toggle(action, \*, domain_id, rule_id) -> None + +## CustomPageSets + +Methods: + +- client.waap.custom_page_sets.create(\*\*params) -> WaapCustomPageSet +- client.waap.custom_page_sets.update(set_id, \*\*params) -> None +- client.waap.custom_page_sets.list(\*\*params) -> SyncOffsetPage[WaapCustomPageSet] +- client.waap.custom_page_sets.delete(set_id) -> None +- client.waap.custom_page_sets.get(set_id) -> WaapCustomPageSet +- client.waap.custom_page_sets.preview(\*\*params) -> WaapCustomPagePreview + +## AdvancedRules + +Methods: + +- client.waap.advanced_rules.list() -> WaapAdvancedRuleDescriptorList + +## Tags + +Methods: + +- client.waap.tags.list(\*\*params) -> SyncOffsetPage[WaapTag] ## Organizations +Methods: + +- client.waap.organizations.list(\*\*params) -> SyncOffsetPage[WaapOrganization] + +## IPInfo + Types: ```python -from gcore.types.waap import Organization +from gcore.types.waap import ( + IPInfoGetAttackTimeSeriesResponse, + IPInfoGetBlockedRequestsResponse, + IPInfoGetTopSessionsResponse, + IPInfoGetTopURLsResponse, + IPInfoGetTopUserAgentsResponse, + IPInfoListAttackedCountriesResponse, +) ``` Methods: -- client.waap.organizations.list(\*\*params) -> SyncOffsetPage[Organization] +- client.waap.ip_info.get(\*\*params) -> WaapIPInfo +- client.waap.ip_info.get_attack_time_series(\*\*params) -> IPInfoGetAttackTimeSeriesResponse +- client.waap.ip_info.get_blocked_requests(\*\*params) -> IPInfoGetBlockedRequestsResponse +- client.waap.ip_info.get_counts(\*\*params) -> WaapIPInfoCounts +- client.waap.ip_info.get_ddos_attack_series(\*\*params) -> WaapIPDDOSInfoModel +- client.waap.ip_info.get_top_sessions(\*\*params) -> IPInfoGetTopSessionsResponse +- client.waap.ip_info.get_top_urls(\*\*params) -> IPInfoGetTopURLsResponse +- client.waap.ip_info.get_top_user_agents(\*\*params) -> IPInfoGetTopUserAgentsResponse +- client.waap.ip_info.list_attacked_countries(\*\*params) -> IPInfoListAttackedCountriesResponse diff --git a/src/gcore/resources/waap/__init__.py b/src/gcore/resources/waap/__init__.py index ed8d2061..69655c51 100644 --- a/src/gcore/resources/waap/__init__.py +++ b/src/gcore/resources/waap/__init__.py @@ -16,6 +16,14 @@ WaapResourceWithStreamingResponse, AsyncWaapResourceWithStreamingResponse, ) +from .clients import ( + ClientsResource, + AsyncClientsResource, + ClientsResourceWithRawResponse, + AsyncClientsResourceWithRawResponse, + ClientsResourceWithStreamingResponse, + AsyncClientsResourceWithStreamingResponse, +) from .domains import ( DomainsResource, AsyncDomainsResource, @@ -24,6 +32,14 @@ DomainsResourceWithStreamingResponse, AsyncDomainsResourceWithStreamingResponse, ) +from .ip_info import ( + IPInfoResource, + AsyncIPInfoResource, + IPInfoResourceWithRawResponse, + AsyncIPInfoResourceWithRawResponse, + IPInfoResourceWithStreamingResponse, + AsyncIPInfoResourceWithStreamingResponse, +) from .statistics import ( StatisticsResource, AsyncStatisticsResource, @@ -58,6 +74,12 @@ ) __all__ = [ + "ClientsResource", + "AsyncClientsResource", + "ClientsResourceWithRawResponse", + "AsyncClientsResourceWithRawResponse", + "ClientsResourceWithStreamingResponse", + "AsyncClientsResourceWithStreamingResponse", "StatisticsResource", "AsyncStatisticsResource", "StatisticsResourceWithRawResponse", @@ -94,6 +116,12 @@ "AsyncOrganizationsResourceWithRawResponse", "OrganizationsResourceWithStreamingResponse", "AsyncOrganizationsResourceWithStreamingResponse", + "IPInfoResource", + "AsyncIPInfoResource", + "IPInfoResourceWithRawResponse", + "AsyncIPInfoResourceWithRawResponse", + "IPInfoResourceWithStreamingResponse", + "AsyncIPInfoResourceWithStreamingResponse", "WaapResource", "AsyncWaapResource", "WaapResourceWithRawResponse", diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py index c9417f26..30c32c1c 100644 --- a/src/gcore/resources/waap/advanced_rules.py +++ b/src/gcore/resources/waap/advanced_rules.py @@ -14,7 +14,7 @@ async_to_streamed_response_wrapper, ) from ..._base_client import make_request_options -from ...types.waap.advanced_rule_descriptor_list import AdvancedRuleDescriptorList +from ...types.waap.waap_advanced_rule_descriptor_list import WaapAdvancedRuleDescriptorList __all__ = ["AdvancedRulesResource", "AsyncAdvancedRulesResource"] @@ -48,14 +48,14 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AdvancedRuleDescriptorList: + ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return self._get( "/waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AdvancedRuleDescriptorList, + cast_to=WaapAdvancedRuleDescriptorList, ) @@ -88,14 +88,14 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AdvancedRuleDescriptorList: + ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return await self._get( "/waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AdvancedRuleDescriptorList, + cast_to=WaapAdvancedRuleDescriptorList, ) diff --git a/src/gcore/resources/waap/clients.py b/src/gcore/resources/waap/clients.py new file mode 100644 index 00000000..0cee8933 --- /dev/null +++ b/src/gcore/resources/waap/clients.py @@ -0,0 +1,135 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.waap.client_me_response import ClientMeResponse + +__all__ = ["ClientsResource", "AsyncClientsResource"] + + +class ClientsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ClientsResourceWithRawResponse: + """ + 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 ClientsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ClientsResourceWithStreamingResponse: + """ + 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 ClientsResourceWithStreamingResponse(self) + + def me( + 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, + ) -> ClientMeResponse: + """Get information about WAAP service for the client""" + return self._get( + "/waap/v1/clients/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientMeResponse, + ) + + +class AsyncClientsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncClientsResourceWithRawResponse: + """ + 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 AsyncClientsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncClientsResourceWithStreamingResponse: + """ + 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 AsyncClientsResourceWithStreamingResponse(self) + + async def me( + 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, + ) -> ClientMeResponse: + """Get information about WAAP service for the client""" + return await self._get( + "/waap/v1/clients/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientMeResponse, + ) + + +class ClientsResourceWithRawResponse: + def __init__(self, clients: ClientsResource) -> None: + self._clients = clients + + self.me = to_raw_response_wrapper( + clients.me, + ) + + +class AsyncClientsResourceWithRawResponse: + def __init__(self, clients: AsyncClientsResource) -> None: + self._clients = clients + + self.me = async_to_raw_response_wrapper( + clients.me, + ) + + +class ClientsResourceWithStreamingResponse: + def __init__(self, clients: ClientsResource) -> None: + self._clients = clients + + self.me = to_streamed_response_wrapper( + clients.me, + ) + + +class AsyncClientsResourceWithStreamingResponse: + def __init__(self, clients: AsyncClientsResource) -> None: + self._clients = clients + + self.me = async_to_streamed_response_wrapper( + clients.me, + ) diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index 1e5e0293..ad77a395 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -19,20 +19,22 @@ ) from ...pagination import SyncOffsetPage, AsyncOffsetPage from ...types.waap import ( + WaapPageType, custom_page_set_list_params, custom_page_set_create_params, custom_page_set_update_params, custom_page_set_preview_params, ) from ..._base_client import AsyncPaginator, make_request_options -from ...types.waap.custom_page_set import CustomPageSet -from ...types.waap.preview_custom_page import PreviewCustomPage -from ...types.waap.block_page_data_param import BlockPageDataParam -from ...types.waap.captcha_page_data_param import CaptchaPageDataParam -from ...types.waap.handshake_page_data_param import HandshakePageDataParam -from ...types.waap.block_csrf_page_data_param import BlockCsrfPageDataParam -from ...types.waap.cookie_disabled_page_data_param import CookieDisabledPageDataParam -from ...types.waap.javascript_disabled_page_data_param import JavascriptDisabledPageDataParam +from ...types.waap.waap_page_type import WaapPageType +from ...types.waap.waap_custom_page_set import WaapCustomPageSet +from ...types.waap.waap_custom_page_preview import WaapCustomPagePreview +from ...types.waap.waap_block_page_data_param import WaapBlockPageDataParam +from ...types.waap.waap_captcha_page_data_param import WaapCaptchaPageDataParam +from ...types.waap.waap_handshake_page_data_param import WaapHandshakePageDataParam +from ...types.waap.waap_block_csrf_page_data_param import WaapBlockCsrfPageDataParam +from ...types.waap.waap_cookie_disabled_page_data_param import WaapCookieDisabledPageDataParam +from ...types.waap.waap_javascript_disabled_page_data_param import WaapJavascriptDisabledPageDataParam __all__ = ["CustomPageSetsResource", "AsyncCustomPageSetsResource"] @@ -61,20 +63,20 @@ def create( self, *, name: str, - block: Optional[BlockPageDataParam] | NotGiven = NOT_GIVEN, - block_csrf: Optional[BlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, - captcha: Optional[CaptchaPageDataParam] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[CookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, + block: Optional[WaapBlockPageDataParam] | NotGiven = NOT_GIVEN, + block_csrf: Optional[WaapBlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, + captcha: Optional[WaapCaptchaPageDataParam] | NotGiven = NOT_GIVEN, + cookie_disabled: Optional[WaapCookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[HandshakePageDataParam] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[JavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, + handshake: Optional[WaapHandshakePageDataParam] | NotGiven = NOT_GIVEN, + javascript_disabled: Optional[WaapJavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CustomPageSet: + ) -> WaapCustomPageSet: """Create a custom page set based on the provided data. For any custom page type @@ -111,20 +113,20 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CustomPageSet, + cast_to=WaapCustomPageSet, ) def update( self, set_id: int, *, - block: Optional[BlockPageDataParam] | NotGiven = NOT_GIVEN, - block_csrf: Optional[BlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, - captcha: Optional[CaptchaPageDataParam] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[CookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, + block: Optional[WaapBlockPageDataParam] | NotGiven = NOT_GIVEN, + block_csrf: Optional[WaapBlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, + captcha: Optional[WaapCaptchaPageDataParam] | NotGiven = NOT_GIVEN, + cookie_disabled: Optional[WaapCookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[HandshakePageDataParam] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[JavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, + handshake: Optional[WaapHandshakePageDataParam] | NotGiven = NOT_GIVEN, + javascript_disabled: Optional[WaapJavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -192,7 +194,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[CustomPageSet]: + ) -> SyncOffsetPage[WaapCustomPageSet]: """ Retrieve a list of custom page sets available for use @@ -217,7 +219,7 @@ def list( """ return self._get_api_list( "/waap/v1/custom-page-sets", - page=SyncOffsetPage[CustomPageSet], + page=SyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -234,7 +236,7 @@ def list( custom_page_set_list_params.CustomPageSetListParams, ), ), - model=CustomPageSet, + model=WaapCustomPageSet, ) def delete( @@ -281,7 +283,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CustomPageSet: + ) -> WaapCustomPageSet: """ Retrieve a custom page set based on the provided ID @@ -301,20 +303,13 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CustomPageSet, + cast_to=WaapCustomPageSet, ) def preview( self, *, - page_type: Literal[ - "block.html", - "block_csrf.html", - "captcha.html", - "cookieDisabled.html", - "handshake.html", - "javascriptDisabled.html", - ], + page_type: WaapPageType, error: Optional[str] | NotGiven = NOT_GIVEN, header: Optional[str] | NotGiven = NOT_GIVEN, logo: Optional[str] | NotGiven = NOT_GIVEN, @@ -326,7 +321,7 @@ def preview( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PreviewCustomPage: + ) -> WaapCustomPagePreview: """ Allows to preview a custom page without creating it based on the provided type and data @@ -375,7 +370,7 @@ def preview( {"page_type": page_type}, custom_page_set_preview_params.CustomPageSetPreviewParams ), ), - cast_to=PreviewCustomPage, + cast_to=WaapCustomPagePreview, ) @@ -403,20 +398,20 @@ async def create( self, *, name: str, - block: Optional[BlockPageDataParam] | NotGiven = NOT_GIVEN, - block_csrf: Optional[BlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, - captcha: Optional[CaptchaPageDataParam] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[CookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, + block: Optional[WaapBlockPageDataParam] | NotGiven = NOT_GIVEN, + block_csrf: Optional[WaapBlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, + captcha: Optional[WaapCaptchaPageDataParam] | NotGiven = NOT_GIVEN, + cookie_disabled: Optional[WaapCookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[HandshakePageDataParam] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[JavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, + handshake: Optional[WaapHandshakePageDataParam] | NotGiven = NOT_GIVEN, + javascript_disabled: Optional[WaapJavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CustomPageSet: + ) -> WaapCustomPageSet: """Create a custom page set based on the provided data. For any custom page type @@ -453,20 +448,20 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CustomPageSet, + cast_to=WaapCustomPageSet, ) async def update( self, set_id: int, *, - block: Optional[BlockPageDataParam] | NotGiven = NOT_GIVEN, - block_csrf: Optional[BlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, - captcha: Optional[CaptchaPageDataParam] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[CookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, + block: Optional[WaapBlockPageDataParam] | NotGiven = NOT_GIVEN, + block_csrf: Optional[WaapBlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, + captcha: Optional[WaapCaptchaPageDataParam] | NotGiven = NOT_GIVEN, + cookie_disabled: Optional[WaapCookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[HandshakePageDataParam] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[JavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, + handshake: Optional[WaapHandshakePageDataParam] | NotGiven = NOT_GIVEN, + javascript_disabled: Optional[WaapJavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -534,7 +529,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[CustomPageSet, AsyncOffsetPage[CustomPageSet]]: + ) -> AsyncPaginator[WaapCustomPageSet, AsyncOffsetPage[WaapCustomPageSet]]: """ Retrieve a list of custom page sets available for use @@ -559,7 +554,7 @@ def list( """ return self._get_api_list( "/waap/v1/custom-page-sets", - page=AsyncOffsetPage[CustomPageSet], + page=AsyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -576,7 +571,7 @@ def list( custom_page_set_list_params.CustomPageSetListParams, ), ), - model=CustomPageSet, + model=WaapCustomPageSet, ) async def delete( @@ -623,7 +618,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CustomPageSet: + ) -> WaapCustomPageSet: """ Retrieve a custom page set based on the provided ID @@ -643,20 +638,13 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CustomPageSet, + cast_to=WaapCustomPageSet, ) async def preview( self, *, - page_type: Literal[ - "block.html", - "block_csrf.html", - "captcha.html", - "cookieDisabled.html", - "handshake.html", - "javascriptDisabled.html", - ], + page_type: WaapPageType, error: Optional[str] | NotGiven = NOT_GIVEN, header: Optional[str] | NotGiven = NOT_GIVEN, logo: Optional[str] | NotGiven = NOT_GIVEN, @@ -668,7 +656,7 @@ async def preview( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PreviewCustomPage: + ) -> WaapCustomPagePreview: """ Allows to preview a custom page without creating it based on the provided type and data @@ -717,7 +705,7 @@ async def preview( {"page_type": page_type}, custom_page_set_preview_params.CustomPageSetPreviewParams ), ), - cast_to=PreviewCustomPage, + cast_to=WaapCustomPagePreview, ) diff --git a/src/gcore/resources/waap/domains/__init__.py b/src/gcore/resources/waap/domains/__init__.py index 67aa274d..dda4fef7 100644 --- a/src/gcore/resources/waap/domains/__init__.py +++ b/src/gcore/resources/waap/domains/__init__.py @@ -8,6 +8,22 @@ DomainsResourceWithStreamingResponse, AsyncDomainsResourceWithStreamingResponse, ) +from .insights import ( + InsightsResource, + AsyncInsightsResource, + InsightsResourceWithRawResponse, + AsyncInsightsResourceWithRawResponse, + InsightsResourceWithStreamingResponse, + AsyncInsightsResourceWithStreamingResponse, +) +from .policies import ( + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, +) from .settings import ( SettingsResource, AsyncSettingsResource, @@ -16,6 +32,22 @@ SettingsResourceWithStreamingResponse, AsyncSettingsResourceWithStreamingResponse, ) +from .analytics import ( + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, +) +from .api_paths import ( + APIPathsResource, + AsyncAPIPathsResource, + APIPathsResourceWithRawResponse, + AsyncAPIPathsResourceWithRawResponse, + APIPathsResourceWithStreamingResponse, + AsyncAPIPathsResourceWithStreamingResponse, +) from .custom_rules import ( CustomRulesResource, AsyncCustomRulesResource, @@ -24,6 +56,14 @@ CustomRulesResourceWithStreamingResponse, AsyncCustomRulesResourceWithStreamingResponse, ) +from .api_discovery import ( + APIDiscoveryResource, + AsyncAPIDiscoveryResource, + APIDiscoveryResourceWithRawResponse, + AsyncAPIDiscoveryResourceWithRawResponse, + APIDiscoveryResourceWithStreamingResponse, + AsyncAPIDiscoveryResourceWithStreamingResponse, +) from .advanced_rules import ( AdvancedRulesResource, AsyncAdvancedRulesResource, @@ -40,6 +80,22 @@ FirewallRulesResourceWithStreamingResponse, AsyncFirewallRulesResourceWithStreamingResponse, ) +from .api_path_groups import ( + APIPathGroupsResource, + AsyncAPIPathGroupsResource, + APIPathGroupsResourceWithRawResponse, + AsyncAPIPathGroupsResourceWithRawResponse, + APIPathGroupsResourceWithStreamingResponse, + AsyncAPIPathGroupsResourceWithStreamingResponse, +) +from .insight_silences import ( + InsightSilencesResource, + AsyncInsightSilencesResource, + InsightSilencesResourceWithRawResponse, + AsyncInsightSilencesResourceWithRawResponse, + InsightSilencesResourceWithStreamingResponse, + AsyncInsightSilencesResourceWithStreamingResponse, +) __all__ = [ "SettingsResource", @@ -48,6 +104,48 @@ "AsyncSettingsResourceWithRawResponse", "SettingsResourceWithStreamingResponse", "AsyncSettingsResourceWithStreamingResponse", + "APIPathsResource", + "AsyncAPIPathsResource", + "APIPathsResourceWithRawResponse", + "AsyncAPIPathsResourceWithRawResponse", + "APIPathsResourceWithStreamingResponse", + "AsyncAPIPathsResourceWithStreamingResponse", + "APIPathGroupsResource", + "AsyncAPIPathGroupsResource", + "APIPathGroupsResourceWithRawResponse", + "AsyncAPIPathGroupsResourceWithRawResponse", + "APIPathGroupsResourceWithStreamingResponse", + "AsyncAPIPathGroupsResourceWithStreamingResponse", + "APIDiscoveryResource", + "AsyncAPIDiscoveryResource", + "APIDiscoveryResourceWithRawResponse", + "AsyncAPIDiscoveryResourceWithRawResponse", + "APIDiscoveryResourceWithStreamingResponse", + "AsyncAPIDiscoveryResourceWithStreamingResponse", + "InsightsResource", + "AsyncInsightsResource", + "InsightsResourceWithRawResponse", + "AsyncInsightsResourceWithRawResponse", + "InsightsResourceWithStreamingResponse", + "AsyncInsightsResourceWithStreamingResponse", + "InsightSilencesResource", + "AsyncInsightSilencesResource", + "InsightSilencesResourceWithRawResponse", + "AsyncInsightSilencesResourceWithRawResponse", + "InsightSilencesResourceWithStreamingResponse", + "AsyncInsightSilencesResourceWithStreamingResponse", + "PoliciesResource", + "AsyncPoliciesResource", + "PoliciesResourceWithRawResponse", + "AsyncPoliciesResourceWithRawResponse", + "PoliciesResourceWithStreamingResponse", + "AsyncPoliciesResourceWithStreamingResponse", + "AnalyticsResource", + "AsyncAnalyticsResource", + "AnalyticsResourceWithRawResponse", + "AsyncAnalyticsResourceWithRawResponse", + "AnalyticsResourceWithStreamingResponse", + "AsyncAnalyticsResourceWithStreamingResponse", "CustomRulesResource", "AsyncCustomRulesResource", "CustomRulesResourceWithRawResponse", diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index bc116dc2..6f4ff363 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -18,12 +18,12 @@ async_to_streamed_response_wrapper, ) from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.waap import RuleActionType, CustomerRuleState +from ....types.waap import WaapRuleActionType, WaapCustomerRuleState from ...._base_client import AsyncPaginator, make_request_options from ....types.waap.domains import advanced_rule_list_params, advanced_rule_create_params, advanced_rule_update_params -from ....types.waap.rule_action_type import RuleActionType -from ....types.waap.customer_rule_state import CustomerRuleState -from ....types.waap.domains.advanced_rule import AdvancedRule +from ....types.waap.waap_advanced_rule import WaapAdvancedRule +from ....types.waap.waap_rule_action_type import WaapRuleActionType +from ....types.waap.waap_customer_rule_state import WaapCustomerRuleState __all__ = ["AdvancedRulesResource", "AsyncAdvancedRulesResource"] @@ -64,7 +64,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AdvancedRule: + ) -> WaapAdvancedRule: """ Create an advanced rule @@ -115,7 +115,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AdvancedRule, + cast_to=WaapAdvancedRule, ) def update( @@ -196,7 +196,7 @@ def list( self, domain_id: int, *, - action: RuleActionType | NotGiven = NOT_GIVEN, + action: WaapRuleActionType | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, @@ -226,7 +226,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[AdvancedRule]: + ) -> SyncOffsetPage[WaapAdvancedRule]: """ Retrieve a list of advanced rules assigned to a domain, offering filter, ordering, and pagination capabilities @@ -265,7 +265,7 @@ def list( """ return self._get_api_list( f"/waap/v1/domains/{domain_id}/advanced-rules", - page=SyncOffsetPage[AdvancedRule], + page=SyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -285,7 +285,7 @@ def list( advanced_rule_list_params.AdvancedRuleListParams, ), ), - model=AdvancedRule, + model=WaapAdvancedRule, ) def delete( @@ -336,7 +336,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AdvancedRule: + ) -> WaapAdvancedRule: """ Retrieve a specific advanced rule assigned to a domain @@ -358,12 +358,12 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AdvancedRule, + cast_to=WaapAdvancedRule, ) def toggle( self, - action: CustomerRuleState, + action: WaapCustomerRuleState, *, domain_id: int, rule_id: int, @@ -440,7 +440,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AdvancedRule: + ) -> WaapAdvancedRule: """ Create an advanced rule @@ -491,7 +491,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AdvancedRule, + cast_to=WaapAdvancedRule, ) async def update( @@ -572,7 +572,7 @@ def list( self, domain_id: int, *, - action: RuleActionType | NotGiven = NOT_GIVEN, + action: WaapRuleActionType | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, @@ -602,7 +602,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[AdvancedRule, AsyncOffsetPage[AdvancedRule]]: + ) -> AsyncPaginator[WaapAdvancedRule, AsyncOffsetPage[WaapAdvancedRule]]: """ Retrieve a list of advanced rules assigned to a domain, offering filter, ordering, and pagination capabilities @@ -641,7 +641,7 @@ def list( """ return self._get_api_list( f"/waap/v1/domains/{domain_id}/advanced-rules", - page=AsyncOffsetPage[AdvancedRule], + page=AsyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -661,7 +661,7 @@ def list( advanced_rule_list_params.AdvancedRuleListParams, ), ), - model=AdvancedRule, + model=WaapAdvancedRule, ) async def delete( @@ -712,7 +712,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AdvancedRule: + ) -> WaapAdvancedRule: """ Retrieve a specific advanced rule assigned to a domain @@ -734,12 +734,12 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AdvancedRule, + cast_to=WaapAdvancedRule, ) async def toggle( self, - action: CustomerRuleState, + action: WaapCustomerRuleState, *, domain_id: int, rule_id: int, diff --git a/src/gcore/resources/waap/domains/analytics/__init__.py b/src/gcore/resources/waap/domains/analytics/__init__.py new file mode 100644 index 00000000..b52f6c07 --- /dev/null +++ b/src/gcore/resources/waap/domains/analytics/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .requests import ( + RequestsResource, + AsyncRequestsResource, + RequestsResourceWithRawResponse, + AsyncRequestsResourceWithRawResponse, + RequestsResourceWithStreamingResponse, + AsyncRequestsResourceWithStreamingResponse, +) +from .analytics import ( + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, +) + +__all__ = [ + "RequestsResource", + "AsyncRequestsResource", + "RequestsResourceWithRawResponse", + "AsyncRequestsResourceWithRawResponse", + "RequestsResourceWithStreamingResponse", + "AsyncRequestsResourceWithStreamingResponse", + "AnalyticsResource", + "AsyncAnalyticsResource", + "AnalyticsResourceWithRawResponse", + "AsyncAnalyticsResourceWithRawResponse", + "AnalyticsResourceWithStreamingResponse", + "AsyncAnalyticsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/waap/domains/analytics/analytics.py b/src/gcore/resources/waap/domains/analytics/analytics.py new file mode 100644 index 00000000..47525848 --- /dev/null +++ b/src/gcore/resources/waap/domains/analytics/analytics.py @@ -0,0 +1,676 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from .requests import ( + RequestsResource, + AsyncRequestsResource, + RequestsResourceWithRawResponse, + AsyncRequestsResourceWithRawResponse, + RequestsResourceWithStreamingResponse, + AsyncRequestsResourceWithStreamingResponse, +) +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 .....pagination import SyncOffsetPage, AsyncOffsetPage +from .....types.waap import WaapResolution +from ....._base_client import AsyncPaginator, make_request_options +from .....types.waap.domains import ( + analytics_list_ddos_info_params, + analytics_list_ddos_attacks_params, + analytics_list_event_traffic_params, + analytics_get_event_statistics_params, +) +from .....types.waap.waap_ddos_info import WaapDDOSInfo +from .....types.waap.waap_resolution import WaapResolution +from .....types.waap.waap_ddos_attack import WaapDDOSAttack +from .....types.waap.waap_event_statistics import WaapEventStatistics +from .....types.waap.domains.analytics_list_event_traffic_response import AnalyticsListEventTrafficResponse + +__all__ = ["AnalyticsResource", "AsyncAnalyticsResource"] + + +class AnalyticsResource(SyncAPIResource): + @cached_property + def requests(self) -> RequestsResource: + return RequestsResource(self._client) + + @cached_property + def with_raw_response(self) -> AnalyticsResourceWithRawResponse: + """ + 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 AnalyticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AnalyticsResourceWithStreamingResponse: + """ + 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 AnalyticsResourceWithStreamingResponse(self) + + def get_event_statistics( + self, + domain_id: int, + *, + start: Union[str, datetime], + action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | NotGiven = NOT_GIVEN, + end: Union[str, datetime] | NotGiven = NOT_GIVEN, + ip: Optional[List[str]] | NotGiven = NOT_GIVEN, + reference_id: Optional[List[str]] | NotGiven = NOT_GIVEN, + result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> WaapEventStatistics: + """ + Retrieve an domain's event statistics + + Args: + domain_id: The domain ID + + start: Filter traffic starting from a specified date in ISO 8601 format + + action: A list of action names to filter on. + + end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, + defaults to the current date and time. + + ip: A list of IPs to filter event statistics. + + reference_id: A list of reference IDs to filter event statistics. + + result: A list of results to filter event statistics. + + 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"/waap/v1/domains/{domain_id}/stats", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "start": start, + "action": action, + "end": end, + "ip": ip, + "reference_id": reference_id, + "result": result, + }, + analytics_get_event_statistics_params.AnalyticsGetEventStatisticsParams, + ), + ), + cast_to=WaapEventStatistics, + ) + + def list_ddos_attacks( + self, + domain_id: int, + *, + end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | NotGiven = NOT_GIVEN, + start_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[WaapDDOSAttack]: + """ + Retrieve a domain's DDoS attacks + + Args: + domain_id: The domain ID + + end_time: Filter attacks up to a specified end date in ISO 8601 format + + limit: Number of items to return + + offset: Number of items to skip + + ordering: Sort the response by given field. + + start_time: Filter attacks starting from a specified date in ISO 8601 format + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/ddos-attacks", + page=SyncOffsetPage[WaapDDOSAttack], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "end_time": end_time, + "limit": limit, + "offset": offset, + "ordering": ordering, + "start_time": start_time, + }, + analytics_list_ddos_attacks_params.AnalyticsListDDOSAttacksParams, + ), + ), + model=WaapDDOSAttack, + ) + + def list_ddos_info( + self, + domain_id: int, + *, + group_by: Literal["URL", "User-Agent", "IP"], + start: Union[str, datetime], + end: Union[str, datetime] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[WaapDDOSInfo]: + """ + Returns the top DDoS counts grouped by URL, User-Agent or IP + + Args: + domain_id: The domain ID + + group_by: The identity of the requests to group by + + start: Filter traffic starting from a specified date in ISO 8601 format + + end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, + defaults to the current date and time. + + limit: Number of items to return + + offset: Number of items to skip + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/ddos-info", + page=SyncOffsetPage[WaapDDOSInfo], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "group_by": group_by, + "start": start, + "end": end, + "limit": limit, + "offset": offset, + }, + analytics_list_ddos_info_params.AnalyticsListDDOSInfoParams, + ), + ), + model=WaapDDOSInfo, + ) + + def list_event_traffic( + self, + domain_id: int, + *, + resolution: WaapResolution, + start: Union[str, datetime], + end: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AnalyticsListEventTrafficResponse: + """ + Retrieves a comprehensive report on a domain's traffic statistics based on + Clickhouse. The report includes details such as API requests, blocked events, + error counts, and many more traffic-related metrics. + + Args: + domain_id: The domain ID + + resolution: Specifies the granularity of the result data. + + start: Filter traffic starting from a specified date in ISO 8601 format + + end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, + defaults to the current date and time. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/waap/v1/domains/{domain_id}/traffic", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "resolution": resolution, + "start": start, + "end": end, + }, + analytics_list_event_traffic_params.AnalyticsListEventTrafficParams, + ), + ), + cast_to=AnalyticsListEventTrafficResponse, + ) + + +class AsyncAnalyticsResource(AsyncAPIResource): + @cached_property + def requests(self) -> AsyncRequestsResource: + return AsyncRequestsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncAnalyticsResourceWithRawResponse: + """ + 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 AsyncAnalyticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAnalyticsResourceWithStreamingResponse: + """ + 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 AsyncAnalyticsResourceWithStreamingResponse(self) + + async def get_event_statistics( + self, + domain_id: int, + *, + start: Union[str, datetime], + action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | NotGiven = NOT_GIVEN, + end: Union[str, datetime] | NotGiven = NOT_GIVEN, + ip: Optional[List[str]] | NotGiven = NOT_GIVEN, + reference_id: Optional[List[str]] | NotGiven = NOT_GIVEN, + result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> WaapEventStatistics: + """ + Retrieve an domain's event statistics + + Args: + domain_id: The domain ID + + start: Filter traffic starting from a specified date in ISO 8601 format + + action: A list of action names to filter on. + + end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, + defaults to the current date and time. + + ip: A list of IPs to filter event statistics. + + reference_id: A list of reference IDs to filter event statistics. + + result: A list of results to filter event statistics. + + 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"/waap/v1/domains/{domain_id}/stats", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "start": start, + "action": action, + "end": end, + "ip": ip, + "reference_id": reference_id, + "result": result, + }, + analytics_get_event_statistics_params.AnalyticsGetEventStatisticsParams, + ), + ), + cast_to=WaapEventStatistics, + ) + + def list_ddos_attacks( + self, + domain_id: int, + *, + end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | NotGiven = NOT_GIVEN, + start_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[WaapDDOSAttack, AsyncOffsetPage[WaapDDOSAttack]]: + """ + Retrieve a domain's DDoS attacks + + Args: + domain_id: The domain ID + + end_time: Filter attacks up to a specified end date in ISO 8601 format + + limit: Number of items to return + + offset: Number of items to skip + + ordering: Sort the response by given field. + + start_time: Filter attacks starting from a specified date in ISO 8601 format + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/ddos-attacks", + page=AsyncOffsetPage[WaapDDOSAttack], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "end_time": end_time, + "limit": limit, + "offset": offset, + "ordering": ordering, + "start_time": start_time, + }, + analytics_list_ddos_attacks_params.AnalyticsListDDOSAttacksParams, + ), + ), + model=WaapDDOSAttack, + ) + + def list_ddos_info( + self, + domain_id: int, + *, + group_by: Literal["URL", "User-Agent", "IP"], + start: Union[str, datetime], + end: Union[str, datetime] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[WaapDDOSInfo, AsyncOffsetPage[WaapDDOSInfo]]: + """ + Returns the top DDoS counts grouped by URL, User-Agent or IP + + Args: + domain_id: The domain ID + + group_by: The identity of the requests to group by + + start: Filter traffic starting from a specified date in ISO 8601 format + + end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, + defaults to the current date and time. + + limit: Number of items to return + + offset: Number of items to skip + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/ddos-info", + page=AsyncOffsetPage[WaapDDOSInfo], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "group_by": group_by, + "start": start, + "end": end, + "limit": limit, + "offset": offset, + }, + analytics_list_ddos_info_params.AnalyticsListDDOSInfoParams, + ), + ), + model=WaapDDOSInfo, + ) + + async def list_event_traffic( + self, + domain_id: int, + *, + resolution: WaapResolution, + start: Union[str, datetime], + end: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AnalyticsListEventTrafficResponse: + """ + Retrieves a comprehensive report on a domain's traffic statistics based on + Clickhouse. The report includes details such as API requests, blocked events, + error counts, and many more traffic-related metrics. + + Args: + domain_id: The domain ID + + resolution: Specifies the granularity of the result data. + + start: Filter traffic starting from a specified date in ISO 8601 format + + end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, + defaults to the current date and time. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/waap/v1/domains/{domain_id}/traffic", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "resolution": resolution, + "start": start, + "end": end, + }, + analytics_list_event_traffic_params.AnalyticsListEventTrafficParams, + ), + ), + cast_to=AnalyticsListEventTrafficResponse, + ) + + +class AnalyticsResourceWithRawResponse: + def __init__(self, analytics: AnalyticsResource) -> None: + self._analytics = analytics + + self.get_event_statistics = to_raw_response_wrapper( + analytics.get_event_statistics, + ) + self.list_ddos_attacks = to_raw_response_wrapper( + analytics.list_ddos_attacks, + ) + self.list_ddos_info = to_raw_response_wrapper( + analytics.list_ddos_info, + ) + self.list_event_traffic = to_raw_response_wrapper( + analytics.list_event_traffic, + ) + + @cached_property + def requests(self) -> RequestsResourceWithRawResponse: + return RequestsResourceWithRawResponse(self._analytics.requests) + + +class AsyncAnalyticsResourceWithRawResponse: + def __init__(self, analytics: AsyncAnalyticsResource) -> None: + self._analytics = analytics + + self.get_event_statistics = async_to_raw_response_wrapper( + analytics.get_event_statistics, + ) + self.list_ddos_attacks = async_to_raw_response_wrapper( + analytics.list_ddos_attacks, + ) + self.list_ddos_info = async_to_raw_response_wrapper( + analytics.list_ddos_info, + ) + self.list_event_traffic = async_to_raw_response_wrapper( + analytics.list_event_traffic, + ) + + @cached_property + def requests(self) -> AsyncRequestsResourceWithRawResponse: + return AsyncRequestsResourceWithRawResponse(self._analytics.requests) + + +class AnalyticsResourceWithStreamingResponse: + def __init__(self, analytics: AnalyticsResource) -> None: + self._analytics = analytics + + self.get_event_statistics = to_streamed_response_wrapper( + analytics.get_event_statistics, + ) + self.list_ddos_attacks = to_streamed_response_wrapper( + analytics.list_ddos_attacks, + ) + self.list_ddos_info = to_streamed_response_wrapper( + analytics.list_ddos_info, + ) + self.list_event_traffic = to_streamed_response_wrapper( + analytics.list_event_traffic, + ) + + @cached_property + def requests(self) -> RequestsResourceWithStreamingResponse: + return RequestsResourceWithStreamingResponse(self._analytics.requests) + + +class AsyncAnalyticsResourceWithStreamingResponse: + def __init__(self, analytics: AsyncAnalyticsResource) -> None: + self._analytics = analytics + + self.get_event_statistics = async_to_streamed_response_wrapper( + analytics.get_event_statistics, + ) + self.list_ddos_attacks = async_to_streamed_response_wrapper( + analytics.list_ddos_attacks, + ) + self.list_ddos_info = async_to_streamed_response_wrapper( + analytics.list_ddos_info, + ) + self.list_event_traffic = async_to_streamed_response_wrapper( + analytics.list_event_traffic, + ) + + @cached_property + def requests(self) -> AsyncRequestsResourceWithStreamingResponse: + return AsyncRequestsResourceWithStreamingResponse(self._analytics.requests) diff --git a/src/gcore/resources/waap/domains/analytics/requests.py b/src/gcore/resources/waap/domains/analytics/requests.py new file mode 100644 index 00000000..ef0acc00 --- /dev/null +++ b/src/gcore/resources/waap/domains/analytics/requests.py @@ -0,0 +1,378 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .....pagination import SyncOffsetPage, AsyncOffsetPage +from ....._base_client import AsyncPaginator, make_request_options +from .....types.waap.domains.analytics import request_list_params +from .....types.waap.waap_traffic_type import WaapTrafficType +from .....types.waap.waap_request_details import WaapRequestDetails +from .....types.waap.waap_request_summary import WaapRequestSummary + +__all__ = ["RequestsResource", "AsyncRequestsResource"] + + +class RequestsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RequestsResourceWithRawResponse: + """ + 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 RequestsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RequestsResourceWithStreamingResponse: + """ + 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 RequestsResourceWithStreamingResponse(self) + + def list( + self, + domain_id: int, + *, + start: Union[str, datetime], + actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, + countries: List[str] | NotGiven = NOT_GIVEN, + end: Union[str, datetime] | NotGiven = NOT_GIVEN, + ip: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: str | NotGiven = NOT_GIVEN, + reference_id: str | NotGiven = NOT_GIVEN, + security_rule_name: str | NotGiven = NOT_GIVEN, + status_code: int | NotGiven = NOT_GIVEN, + traffic_types: List[WaapTrafficType] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[WaapRequestSummary]: + """ + Retrieve a domain's requests data. + + Args: + domain_id: The domain ID + + start: Filter traffic starting from a specified date in ISO 8601 format + + actions: Filter the response by actions. + + countries: Filter the response by country codes in ISO 3166-1 alpha-2 format. + + end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, + defaults to the current date and time. + + ip: Filter the response by IP. + + limit: Number of items to return + + offset: Number of items to skip + + ordering: Sort the response by given field. + + reference_id: Filter the response by reference ID. + + security_rule_name: Filter the response by security rule name. + + status_code: Filter the response by response code. + + traffic_types: Filter the response by traffic types. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/requests", + page=SyncOffsetPage[WaapRequestSummary], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "start": start, + "actions": actions, + "countries": countries, + "end": end, + "ip": ip, + "limit": limit, + "offset": offset, + "ordering": ordering, + "reference_id": reference_id, + "security_rule_name": security_rule_name, + "status_code": status_code, + "traffic_types": traffic_types, + }, + request_list_params.RequestListParams, + ), + ), + model=WaapRequestSummary, + ) + + def get( + self, + request_id: str, + *, + domain_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, + ) -> WaapRequestDetails: + """ + Retrieves all the available information for a request that matches a given + request id + + Args: + domain_id: The domain ID + + request_id: The request ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + return self._get( + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapRequestDetails, + ) + + +class AsyncRequestsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRequestsResourceWithRawResponse: + """ + 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 AsyncRequestsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRequestsResourceWithStreamingResponse: + """ + 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 AsyncRequestsResourceWithStreamingResponse(self) + + def list( + self, + domain_id: int, + *, + start: Union[str, datetime], + actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, + countries: List[str] | NotGiven = NOT_GIVEN, + end: Union[str, datetime] | NotGiven = NOT_GIVEN, + ip: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: str | NotGiven = NOT_GIVEN, + reference_id: str | NotGiven = NOT_GIVEN, + security_rule_name: str | NotGiven = NOT_GIVEN, + status_code: int | NotGiven = NOT_GIVEN, + traffic_types: List[WaapTrafficType] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[WaapRequestSummary, AsyncOffsetPage[WaapRequestSummary]]: + """ + Retrieve a domain's requests data. + + Args: + domain_id: The domain ID + + start: Filter traffic starting from a specified date in ISO 8601 format + + actions: Filter the response by actions. + + countries: Filter the response by country codes in ISO 3166-1 alpha-2 format. + + end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, + defaults to the current date and time. + + ip: Filter the response by IP. + + limit: Number of items to return + + offset: Number of items to skip + + ordering: Sort the response by given field. + + reference_id: Filter the response by reference ID. + + security_rule_name: Filter the response by security rule name. + + status_code: Filter the response by response code. + + traffic_types: Filter the response by traffic types. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/requests", + page=AsyncOffsetPage[WaapRequestSummary], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "start": start, + "actions": actions, + "countries": countries, + "end": end, + "ip": ip, + "limit": limit, + "offset": offset, + "ordering": ordering, + "reference_id": reference_id, + "security_rule_name": security_rule_name, + "status_code": status_code, + "traffic_types": traffic_types, + }, + request_list_params.RequestListParams, + ), + ), + model=WaapRequestSummary, + ) + + async def get( + self, + request_id: str, + *, + domain_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, + ) -> WaapRequestDetails: + """ + Retrieves all the available information for a request that matches a given + request id + + Args: + domain_id: The domain ID + + request_id: The request ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + return await self._get( + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapRequestDetails, + ) + + +class RequestsResourceWithRawResponse: + def __init__(self, requests: RequestsResource) -> None: + self._requests = requests + + self.list = to_raw_response_wrapper( + requests.list, + ) + self.get = to_raw_response_wrapper( + requests.get, + ) + + +class AsyncRequestsResourceWithRawResponse: + def __init__(self, requests: AsyncRequestsResource) -> None: + self._requests = requests + + self.list = async_to_raw_response_wrapper( + requests.list, + ) + self.get = async_to_raw_response_wrapper( + requests.get, + ) + + +class RequestsResourceWithStreamingResponse: + def __init__(self, requests: RequestsResource) -> None: + self._requests = requests + + self.list = to_streamed_response_wrapper( + requests.list, + ) + self.get = to_streamed_response_wrapper( + requests.get, + ) + + +class AsyncRequestsResourceWithStreamingResponse: + def __init__(self, requests: AsyncRequestsResource) -> None: + self._requests = requests + + self.list = async_to_streamed_response_wrapper( + requests.list, + ) + self.get = async_to_streamed_response_wrapper( + requests.get, + ) diff --git a/src/gcore/resources/waap/domains/api_discovery/__init__.py b/src/gcore/resources/waap/domains/api_discovery/__init__.py new file mode 100644 index 00000000..481daf30 --- /dev/null +++ b/src/gcore/resources/waap/domains/api_discovery/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .scan_results import ( + ScanResultsResource, + AsyncScanResultsResource, + ScanResultsResourceWithRawResponse, + AsyncScanResultsResourceWithRawResponse, + ScanResultsResourceWithStreamingResponse, + AsyncScanResultsResourceWithStreamingResponse, +) +from .api_discovery import ( + APIDiscoveryResource, + AsyncAPIDiscoveryResource, + APIDiscoveryResourceWithRawResponse, + AsyncAPIDiscoveryResourceWithRawResponse, + APIDiscoveryResourceWithStreamingResponse, + AsyncAPIDiscoveryResourceWithStreamingResponse, +) + +__all__ = [ + "ScanResultsResource", + "AsyncScanResultsResource", + "ScanResultsResourceWithRawResponse", + "AsyncScanResultsResourceWithRawResponse", + "ScanResultsResourceWithStreamingResponse", + "AsyncScanResultsResourceWithStreamingResponse", + "APIDiscoveryResource", + "AsyncAPIDiscoveryResource", + "APIDiscoveryResourceWithRawResponse", + "AsyncAPIDiscoveryResourceWithRawResponse", + "APIDiscoveryResourceWithStreamingResponse", + "AsyncAPIDiscoveryResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/waap/domains/api_discovery/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery/api_discovery.py new file mode 100644 index 00000000..08614a31 --- /dev/null +++ b/src/gcore/resources/waap/domains/api_discovery/api_discovery.py @@ -0,0 +1,530 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from .scan_results import ( + ScanResultsResource, + AsyncScanResultsResource, + ScanResultsResourceWithRawResponse, + AsyncScanResultsResourceWithRawResponse, + ScanResultsResourceWithStreamingResponse, + AsyncScanResultsResourceWithStreamingResponse, +) +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.waap.domains import api_discovery_upload_openapi_params, api_discovery_update_settings_params +from .....types.waap.domains.api_discovery_get_settings_response import APIDiscoveryGetSettingsResponse +from .....types.waap.domains.api_discovery_scan_openapi_response import APIDiscoveryScanOpenAPIResponse +from .....types.waap.domains.api_discovery_upload_openapi_response import APIDiscoveryUploadOpenAPIResponse +from .....types.waap.domains.api_discovery_update_settings_response import APIDiscoveryUpdateSettingsResponse + +__all__ = ["APIDiscoveryResource", "AsyncAPIDiscoveryResource"] + + +class APIDiscoveryResource(SyncAPIResource): + @cached_property + def scan_results(self) -> ScanResultsResource: + return ScanResultsResource(self._client) + + @cached_property + def with_raw_response(self) -> APIDiscoveryResourceWithRawResponse: + """ + 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 APIDiscoveryResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> APIDiscoveryResourceWithStreamingResponse: + """ + 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 APIDiscoveryResourceWithStreamingResponse(self) + + def get_settings( + self, + domain_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, + ) -> APIDiscoveryGetSettingsResponse: + """ + Retrieve the API discovery settings for a domain + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/waap/v1/domains/{domain_id}/api-discovery/settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIDiscoveryGetSettingsResponse, + ) + + def scan_openapi( + self, + domain_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, + ) -> APIDiscoveryScanOpenAPIResponse: + """Scan an API description file hosted online. + + The file must be in YAML or JSON + format and adhere to the OpenAPI specification. The location of the API + description file should be specified in the API discovery settings. + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/waap/v1/domains/{domain_id}/api-discovery/scan", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIDiscoveryScanOpenAPIResponse, + ) + + def update_settings( + self, + domain_id: int, + *, + description_file_location: Optional[str] | NotGiven = NOT_GIVEN, + description_file_scan_enabled: Optional[bool] | NotGiven = NOT_GIVEN, + description_file_scan_interval_hours: Optional[int] | NotGiven = NOT_GIVEN, + traffic_scan_enabled: Optional[bool] | NotGiven = NOT_GIVEN, + traffic_scan_interval_hours: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> APIDiscoveryUpdateSettingsResponse: + """ + Update the API discovery settings for a domain + + Args: + domain_id: The domain ID + + description_file_location: The URL of the API description file. This will be periodically scanned if + `descriptionFileScanEnabled` is enabled. Supported formats are YAML and JSON, + and it must adhere to OpenAPI versions 2, 3, or 3.1. + + description_file_scan_enabled: Indicates if periodic scan of the description file is enabled + + description_file_scan_interval_hours: The interval in hours for scanning the description file + + traffic_scan_enabled: Indicates if traffic scan is enabled + + traffic_scan_interval_hours: The interval in hours for scanning the traffic + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/waap/v1/domains/{domain_id}/api-discovery/settings", + body=maybe_transform( + { + "description_file_location": description_file_location, + "description_file_scan_enabled": description_file_scan_enabled, + "description_file_scan_interval_hours": description_file_scan_interval_hours, + "traffic_scan_enabled": traffic_scan_enabled, + "traffic_scan_interval_hours": traffic_scan_interval_hours, + }, + api_discovery_update_settings_params.APIDiscoveryUpdateSettingsParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIDiscoveryUpdateSettingsResponse, + ) + + def upload_openapi( + self, + domain_id: int, + *, + file_data: str, + file_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, + ) -> APIDiscoveryUploadOpenAPIResponse: + """ + An API description file must adhere to the OpenAPI specification and be written + in YAML or JSON format. The file name should be provided as the value for the + `file_name` parameter. The contents of the file must be base64 encoded and + supplied as the value for the `file_data` parameter. + + Args: + domain_id: The domain ID + + file_data: Base64 representation of the description file. Supported formats are YAML and + JSON, and it must adhere to OpenAPI versions 2, 3, or 3.1. + + file_name: The name of the file + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/waap/v1/domains/{domain_id}/api-discovery/upload", + body=maybe_transform( + { + "file_data": file_data, + "file_name": file_name, + }, + api_discovery_upload_openapi_params.APIDiscoveryUploadOpenAPIParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIDiscoveryUploadOpenAPIResponse, + ) + + +class AsyncAPIDiscoveryResource(AsyncAPIResource): + @cached_property + def scan_results(self) -> AsyncScanResultsResource: + return AsyncScanResultsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncAPIDiscoveryResourceWithRawResponse: + """ + 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 AsyncAPIDiscoveryResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAPIDiscoveryResourceWithStreamingResponse: + """ + 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 AsyncAPIDiscoveryResourceWithStreamingResponse(self) + + async def get_settings( + self, + domain_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, + ) -> APIDiscoveryGetSettingsResponse: + """ + Retrieve the API discovery settings for a domain + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/waap/v1/domains/{domain_id}/api-discovery/settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIDiscoveryGetSettingsResponse, + ) + + async def scan_openapi( + self, + domain_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, + ) -> APIDiscoveryScanOpenAPIResponse: + """Scan an API description file hosted online. + + The file must be in YAML or JSON + format and adhere to the OpenAPI specification. The location of the API + description file should be specified in the API discovery settings. + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/waap/v1/domains/{domain_id}/api-discovery/scan", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIDiscoveryScanOpenAPIResponse, + ) + + async def update_settings( + self, + domain_id: int, + *, + description_file_location: Optional[str] | NotGiven = NOT_GIVEN, + description_file_scan_enabled: Optional[bool] | NotGiven = NOT_GIVEN, + description_file_scan_interval_hours: Optional[int] | NotGiven = NOT_GIVEN, + traffic_scan_enabled: Optional[bool] | NotGiven = NOT_GIVEN, + traffic_scan_interval_hours: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> APIDiscoveryUpdateSettingsResponse: + """ + Update the API discovery settings for a domain + + Args: + domain_id: The domain ID + + description_file_location: The URL of the API description file. This will be periodically scanned if + `descriptionFileScanEnabled` is enabled. Supported formats are YAML and JSON, + and it must adhere to OpenAPI versions 2, 3, or 3.1. + + description_file_scan_enabled: Indicates if periodic scan of the description file is enabled + + description_file_scan_interval_hours: The interval in hours for scanning the description file + + traffic_scan_enabled: Indicates if traffic scan is enabled + + traffic_scan_interval_hours: The interval in hours for scanning the traffic + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/waap/v1/domains/{domain_id}/api-discovery/settings", + body=await async_maybe_transform( + { + "description_file_location": description_file_location, + "description_file_scan_enabled": description_file_scan_enabled, + "description_file_scan_interval_hours": description_file_scan_interval_hours, + "traffic_scan_enabled": traffic_scan_enabled, + "traffic_scan_interval_hours": traffic_scan_interval_hours, + }, + api_discovery_update_settings_params.APIDiscoveryUpdateSettingsParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIDiscoveryUpdateSettingsResponse, + ) + + async def upload_openapi( + self, + domain_id: int, + *, + file_data: str, + file_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, + ) -> APIDiscoveryUploadOpenAPIResponse: + """ + An API description file must adhere to the OpenAPI specification and be written + in YAML or JSON format. The file name should be provided as the value for the + `file_name` parameter. The contents of the file must be base64 encoded and + supplied as the value for the `file_data` parameter. + + Args: + domain_id: The domain ID + + file_data: Base64 representation of the description file. Supported formats are YAML and + JSON, and it must adhere to OpenAPI versions 2, 3, or 3.1. + + file_name: The name of the file + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/waap/v1/domains/{domain_id}/api-discovery/upload", + body=await async_maybe_transform( + { + "file_data": file_data, + "file_name": file_name, + }, + api_discovery_upload_openapi_params.APIDiscoveryUploadOpenAPIParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIDiscoveryUploadOpenAPIResponse, + ) + + +class APIDiscoveryResourceWithRawResponse: + def __init__(self, api_discovery: APIDiscoveryResource) -> None: + self._api_discovery = api_discovery + + self.get_settings = to_raw_response_wrapper( + api_discovery.get_settings, + ) + self.scan_openapi = to_raw_response_wrapper( + api_discovery.scan_openapi, + ) + self.update_settings = to_raw_response_wrapper( + api_discovery.update_settings, + ) + self.upload_openapi = to_raw_response_wrapper( + api_discovery.upload_openapi, + ) + + @cached_property + def scan_results(self) -> ScanResultsResourceWithRawResponse: + return ScanResultsResourceWithRawResponse(self._api_discovery.scan_results) + + +class AsyncAPIDiscoveryResourceWithRawResponse: + def __init__(self, api_discovery: AsyncAPIDiscoveryResource) -> None: + self._api_discovery = api_discovery + + self.get_settings = async_to_raw_response_wrapper( + api_discovery.get_settings, + ) + self.scan_openapi = async_to_raw_response_wrapper( + api_discovery.scan_openapi, + ) + self.update_settings = async_to_raw_response_wrapper( + api_discovery.update_settings, + ) + self.upload_openapi = async_to_raw_response_wrapper( + api_discovery.upload_openapi, + ) + + @cached_property + def scan_results(self) -> AsyncScanResultsResourceWithRawResponse: + return AsyncScanResultsResourceWithRawResponse(self._api_discovery.scan_results) + + +class APIDiscoveryResourceWithStreamingResponse: + def __init__(self, api_discovery: APIDiscoveryResource) -> None: + self._api_discovery = api_discovery + + self.get_settings = to_streamed_response_wrapper( + api_discovery.get_settings, + ) + self.scan_openapi = to_streamed_response_wrapper( + api_discovery.scan_openapi, + ) + self.update_settings = to_streamed_response_wrapper( + api_discovery.update_settings, + ) + self.upload_openapi = to_streamed_response_wrapper( + api_discovery.upload_openapi, + ) + + @cached_property + def scan_results(self) -> ScanResultsResourceWithStreamingResponse: + return ScanResultsResourceWithStreamingResponse(self._api_discovery.scan_results) + + +class AsyncAPIDiscoveryResourceWithStreamingResponse: + def __init__(self, api_discovery: AsyncAPIDiscoveryResource) -> None: + self._api_discovery = api_discovery + + self.get_settings = async_to_streamed_response_wrapper( + api_discovery.get_settings, + ) + self.scan_openapi = async_to_streamed_response_wrapper( + api_discovery.scan_openapi, + ) + self.update_settings = async_to_streamed_response_wrapper( + api_discovery.update_settings, + ) + self.upload_openapi = async_to_streamed_response_wrapper( + api_discovery.upload_openapi, + ) + + @cached_property + def scan_results(self) -> AsyncScanResultsResourceWithStreamingResponse: + return AsyncScanResultsResourceWithStreamingResponse(self._api_discovery.scan_results) diff --git a/src/gcore/resources/waap/domains/api_discovery/scan_results.py b/src/gcore/resources/waap/domains/api_discovery/scan_results.py new file mode 100644 index 00000000..8e8888fc --- /dev/null +++ b/src/gcore/resources/waap/domains/api_discovery/scan_results.py @@ -0,0 +1,352 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .....pagination import SyncOffsetPage, AsyncOffsetPage +from ....._base_client import AsyncPaginator, make_request_options +from .....types.waap.domains.api_discovery import scan_result_list_params +from .....types.waap.domains.api_discovery.scan_result_get_response import ScanResultGetResponse +from .....types.waap.domains.api_discovery.scan_result_list_response import ScanResultListResponse + +__all__ = ["ScanResultsResource", "AsyncScanResultsResource"] + + +class ScanResultsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ScanResultsResourceWithRawResponse: + """ + 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 ScanResultsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ScanResultsResourceWithStreamingResponse: + """ + 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 ScanResultsResourceWithStreamingResponse(self) + + def list( + self, + domain_id: int, + *, + limit: int | NotGiven = NOT_GIVEN, + message: Optional[str] | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal[ + "id", + "type", + "start_time", + "end_time", + "status", + "message", + "-id", + "-type", + "-start_time", + "-end_time", + "-status", + "-message", + ] + | NotGiven = NOT_GIVEN, + status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | NotGiven = NOT_GIVEN, + type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[ScanResultListResponse]: + """ + Get Scan Results + + Args: + domain_id: The domain ID + + limit: Number of items to return + + message: Filter by the message of the scan. Supports '\\**' as a wildcard character + + offset: Number of items to skip + + ordering: Sort the response by given field. + + status: The different statuses a task result can have + + type: The different types of scans that can be performed + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + page=SyncOffsetPage[ScanResultListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "message": message, + "offset": offset, + "ordering": ordering, + "status": status, + "type": type, + }, + scan_result_list_params.ScanResultListParams, + ), + ), + model=ScanResultListResponse, + ) + + def get( + self, + scan_id: str, + *, + domain_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, + ) -> ScanResultGetResponse: + """ + Get Scan Result + + Args: + domain_id: The domain ID + + scan_id: The scan ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not scan_id: + raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") + return self._get( + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ScanResultGetResponse, + ) + + +class AsyncScanResultsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncScanResultsResourceWithRawResponse: + """ + 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 AsyncScanResultsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncScanResultsResourceWithStreamingResponse: + """ + 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 AsyncScanResultsResourceWithStreamingResponse(self) + + def list( + self, + domain_id: int, + *, + limit: int | NotGiven = NOT_GIVEN, + message: Optional[str] | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal[ + "id", + "type", + "start_time", + "end_time", + "status", + "message", + "-id", + "-type", + "-start_time", + "-end_time", + "-status", + "-message", + ] + | NotGiven = NOT_GIVEN, + status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | NotGiven = NOT_GIVEN, + type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[ScanResultListResponse, AsyncOffsetPage[ScanResultListResponse]]: + """ + Get Scan Results + + Args: + domain_id: The domain ID + + limit: Number of items to return + + message: Filter by the message of the scan. Supports '\\**' as a wildcard character + + offset: Number of items to skip + + ordering: Sort the response by given field. + + status: The different statuses a task result can have + + type: The different types of scans that can be performed + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + page=AsyncOffsetPage[ScanResultListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "message": message, + "offset": offset, + "ordering": ordering, + "status": status, + "type": type, + }, + scan_result_list_params.ScanResultListParams, + ), + ), + model=ScanResultListResponse, + ) + + async def get( + self, + scan_id: str, + *, + domain_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, + ) -> ScanResultGetResponse: + """ + Get Scan Result + + Args: + domain_id: The domain ID + + scan_id: The scan ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not scan_id: + raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") + return await self._get( + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ScanResultGetResponse, + ) + + +class ScanResultsResourceWithRawResponse: + def __init__(self, scan_results: ScanResultsResource) -> None: + self._scan_results = scan_results + + self.list = to_raw_response_wrapper( + scan_results.list, + ) + self.get = to_raw_response_wrapper( + scan_results.get, + ) + + +class AsyncScanResultsResourceWithRawResponse: + def __init__(self, scan_results: AsyncScanResultsResource) -> None: + self._scan_results = scan_results + + self.list = async_to_raw_response_wrapper( + scan_results.list, + ) + self.get = async_to_raw_response_wrapper( + scan_results.get, + ) + + +class ScanResultsResourceWithStreamingResponse: + def __init__(self, scan_results: ScanResultsResource) -> None: + self._scan_results = scan_results + + self.list = to_streamed_response_wrapper( + scan_results.list, + ) + self.get = to_streamed_response_wrapper( + scan_results.get, + ) + + +class AsyncScanResultsResourceWithStreamingResponse: + def __init__(self, scan_results: AsyncScanResultsResource) -> None: + self._scan_results = scan_results + + self.list = async_to_streamed_response_wrapper( + scan_results.list, + ) + self.get = async_to_streamed_response_wrapper( + scan_results.get, + ) diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py new file mode 100644 index 00000000..74b54e4e --- /dev/null +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -0,0 +1,163 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.waap.domains.api_path_group_list_response import APIPathGroupListResponse + +__all__ = ["APIPathGroupsResource", "AsyncAPIPathGroupsResource"] + + +class APIPathGroupsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> APIPathGroupsResourceWithRawResponse: + """ + 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 APIPathGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> APIPathGroupsResourceWithStreamingResponse: + """ + 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 APIPathGroupsResourceWithStreamingResponse(self) + + def list( + self, + domain_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, + ) -> APIPathGroupListResponse: + """ + Retrieve a list of API path groups for a specific domain + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/waap/v1/domains/{domain_id}/api-path-groups", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIPathGroupListResponse, + ) + + +class AsyncAPIPathGroupsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAPIPathGroupsResourceWithRawResponse: + """ + 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 AsyncAPIPathGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAPIPathGroupsResourceWithStreamingResponse: + """ + 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 AsyncAPIPathGroupsResourceWithStreamingResponse(self) + + async def list( + self, + domain_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, + ) -> APIPathGroupListResponse: + """ + Retrieve a list of API path groups for a specific domain + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/waap/v1/domains/{domain_id}/api-path-groups", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIPathGroupListResponse, + ) + + +class APIPathGroupsResourceWithRawResponse: + def __init__(self, api_path_groups: APIPathGroupsResource) -> None: + self._api_path_groups = api_path_groups + + self.list = to_raw_response_wrapper( + api_path_groups.list, + ) + + +class AsyncAPIPathGroupsResourceWithRawResponse: + def __init__(self, api_path_groups: AsyncAPIPathGroupsResource) -> None: + self._api_path_groups = api_path_groups + + self.list = async_to_raw_response_wrapper( + api_path_groups.list, + ) + + +class APIPathGroupsResourceWithStreamingResponse: + def __init__(self, api_path_groups: APIPathGroupsResource) -> None: + self._api_path_groups = api_path_groups + + self.list = to_streamed_response_wrapper( + api_path_groups.list, + ) + + +class AsyncAPIPathGroupsResourceWithStreamingResponse: + def __init__(self, api_path_groups: AsyncAPIPathGroupsResource) -> None: + self._api_path_groups = api_path_groups + + self.list = async_to_streamed_response_wrapper( + api_path_groups.list, + ) diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py new file mode 100644 index 00000000..11cbcb8a --- /dev/null +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -0,0 +1,771 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.waap.domains import api_path_list_params, api_path_create_params, api_path_update_params +from ....types.waap.domains.api_path_get_response import APIPathGetResponse +from ....types.waap.domains.api_path_list_response import APIPathListResponse +from ....types.waap.domains.api_path_create_response import APIPathCreateResponse + +__all__ = ["APIPathsResource", "AsyncAPIPathsResource"] + + +class APIPathsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> APIPathsResourceWithRawResponse: + """ + 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 APIPathsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> APIPathsResourceWithStreamingResponse: + """ + 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 APIPathsResourceWithStreamingResponse(self) + + def create( + self, + domain_id: int, + *, + http_scheme: Literal["HTTP", "HTTPS"], + method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"], + path: str, + api_groups: List[str] | NotGiven = NOT_GIVEN, + api_version: str | NotGiven = NOT_GIVEN, + tags: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> APIPathCreateResponse: + """ + Create an API path for a domain + + Args: + domain_id: The domain ID + + http_scheme: The different HTTP schemes an API path can have + + method: The different methods an API path can have + + path: The API path, locations that are saved for resource IDs will be put in curly + brackets + + api_groups: An array of api groups associated with the API path + + api_version: The API version + + tags: An array of tags associated with the API path + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/waap/v1/domains/{domain_id}/api-paths", + body=maybe_transform( + { + "http_scheme": http_scheme, + "method": method, + "path": path, + "api_groups": api_groups, + "api_version": api_version, + "tags": tags, + }, + api_path_create_params.APIPathCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIPathCreateResponse, + ) + + def update( + self, + path_id: str, + *, + domain_id: int, + api_groups: List[str] | NotGiven = NOT_GIVEN, + path: str | NotGiven = NOT_GIVEN, + status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] | NotGiven = NOT_GIVEN, + tags: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Update a specific API path for a domain + + Args: + domain_id: The domain ID + + path_id: The path ID + + api_groups: An array of api groups associated with the API path + + path: The updated API path. When updating the path, variables can be renamed, path + parts can be converted to variables and vice versa. + + status: The different statuses an API path can have + + tags: An array of tags associated with the API path + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not path_id: + raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._patch( + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + body=maybe_transform( + { + "api_groups": api_groups, + "path": path, + "status": status, + "tags": tags, + }, + api_path_update_params.APIPathUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + domain_id: int, + *, + api_group: Optional[str] | NotGiven = NOT_GIVEN, + api_version: Optional[str] | NotGiven = NOT_GIVEN, + http_scheme: Optional[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, + ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] + | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal[ + "id", + "path", + "method", + "api_version", + "http_scheme", + "first_detected", + "last_detected", + "status", + "source", + "-id", + "-path", + "-method", + "-api_version", + "-http_scheme", + "-first_detected", + "-last_detected", + "-status", + "-source", + ] + | NotGiven = NOT_GIVEN, + path: Optional[str] | NotGiven = NOT_GIVEN, + source: Optional[Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"]] | NotGiven = NOT_GIVEN, + status: Optional[List[Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"]]] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[APIPathListResponse]: + """ + Retrieve a list of API paths for a specific domain + + Args: + domain_id: The domain ID + + api_group: Filter by the API group associated with the API path + + api_version: Filter by the API version + + http_scheme: The different HTTP schemes an API path can have + + ids: Filter by the path ID + + limit: Number of items to return + + method: The different methods an API path can have + + offset: Number of items to skip + + ordering: Sort the response by given field. + + path: Filter by the path. Supports '\\**' as a wildcard character + + source: The different sources an API path can have + + status: Filter by the status of the discovered API path + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/api-paths", + page=SyncOffsetPage[APIPathListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "api_group": api_group, + "api_version": api_version, + "http_scheme": http_scheme, + "ids": ids, + "limit": limit, + "method": method, + "offset": offset, + "ordering": ordering, + "path": path, + "source": source, + "status": status, + }, + api_path_list_params.APIPathListParams, + ), + ), + model=APIPathListResponse, + ) + + def delete( + self, + path_id: str, + *, + domain_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a specific API path for a domain + + Args: + domain_id: The domain ID + + path_id: The path ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not path_id: + raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + path_id: str, + *, + domain_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, + ) -> APIPathGetResponse: + """ + Retrieve a specific API path for a domain + + Args: + domain_id: The domain ID + + path_id: The path ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not path_id: + raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") + return self._get( + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIPathGetResponse, + ) + + +class AsyncAPIPathsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAPIPathsResourceWithRawResponse: + """ + 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 AsyncAPIPathsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAPIPathsResourceWithStreamingResponse: + """ + 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 AsyncAPIPathsResourceWithStreamingResponse(self) + + async def create( + self, + domain_id: int, + *, + http_scheme: Literal["HTTP", "HTTPS"], + method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"], + path: str, + api_groups: List[str] | NotGiven = NOT_GIVEN, + api_version: str | NotGiven = NOT_GIVEN, + tags: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> APIPathCreateResponse: + """ + Create an API path for a domain + + Args: + domain_id: The domain ID + + http_scheme: The different HTTP schemes an API path can have + + method: The different methods an API path can have + + path: The API path, locations that are saved for resource IDs will be put in curly + brackets + + api_groups: An array of api groups associated with the API path + + api_version: The API version + + tags: An array of tags associated with the API path + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/waap/v1/domains/{domain_id}/api-paths", + body=await async_maybe_transform( + { + "http_scheme": http_scheme, + "method": method, + "path": path, + "api_groups": api_groups, + "api_version": api_version, + "tags": tags, + }, + api_path_create_params.APIPathCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIPathCreateResponse, + ) + + async def update( + self, + path_id: str, + *, + domain_id: int, + api_groups: List[str] | NotGiven = NOT_GIVEN, + path: str | NotGiven = NOT_GIVEN, + status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] | NotGiven = NOT_GIVEN, + tags: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Update a specific API path for a domain + + Args: + domain_id: The domain ID + + path_id: The path ID + + api_groups: An array of api groups associated with the API path + + path: The updated API path. When updating the path, variables can be renamed, path + parts can be converted to variables and vice versa. + + status: The different statuses an API path can have + + tags: An array of tags associated with the API path + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not path_id: + raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._patch( + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + body=await async_maybe_transform( + { + "api_groups": api_groups, + "path": path, + "status": status, + "tags": tags, + }, + api_path_update_params.APIPathUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + domain_id: int, + *, + api_group: Optional[str] | NotGiven = NOT_GIVEN, + api_version: Optional[str] | NotGiven = NOT_GIVEN, + http_scheme: Optional[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, + ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] + | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal[ + "id", + "path", + "method", + "api_version", + "http_scheme", + "first_detected", + "last_detected", + "status", + "source", + "-id", + "-path", + "-method", + "-api_version", + "-http_scheme", + "-first_detected", + "-last_detected", + "-status", + "-source", + ] + | NotGiven = NOT_GIVEN, + path: Optional[str] | NotGiven = NOT_GIVEN, + source: Optional[Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"]] | NotGiven = NOT_GIVEN, + status: Optional[List[Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"]]] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[APIPathListResponse, AsyncOffsetPage[APIPathListResponse]]: + """ + Retrieve a list of API paths for a specific domain + + Args: + domain_id: The domain ID + + api_group: Filter by the API group associated with the API path + + api_version: Filter by the API version + + http_scheme: The different HTTP schemes an API path can have + + ids: Filter by the path ID + + limit: Number of items to return + + method: The different methods an API path can have + + offset: Number of items to skip + + ordering: Sort the response by given field. + + path: Filter by the path. Supports '\\**' as a wildcard character + + source: The different sources an API path can have + + status: Filter by the status of the discovered API path + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/api-paths", + page=AsyncOffsetPage[APIPathListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "api_group": api_group, + "api_version": api_version, + "http_scheme": http_scheme, + "ids": ids, + "limit": limit, + "method": method, + "offset": offset, + "ordering": ordering, + "path": path, + "source": source, + "status": status, + }, + api_path_list_params.APIPathListParams, + ), + ), + model=APIPathListResponse, + ) + + async def delete( + self, + path_id: str, + *, + domain_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a specific API path for a domain + + Args: + domain_id: The domain ID + + path_id: The path ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not path_id: + raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + path_id: str, + *, + domain_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, + ) -> APIPathGetResponse: + """ + Retrieve a specific API path for a domain + + Args: + domain_id: The domain ID + + path_id: The path ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not path_id: + raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") + return await self._get( + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIPathGetResponse, + ) + + +class APIPathsResourceWithRawResponse: + def __init__(self, api_paths: APIPathsResource) -> None: + self._api_paths = api_paths + + self.create = to_raw_response_wrapper( + api_paths.create, + ) + self.update = to_raw_response_wrapper( + api_paths.update, + ) + self.list = to_raw_response_wrapper( + api_paths.list, + ) + self.delete = to_raw_response_wrapper( + api_paths.delete, + ) + self.get = to_raw_response_wrapper( + api_paths.get, + ) + + +class AsyncAPIPathsResourceWithRawResponse: + def __init__(self, api_paths: AsyncAPIPathsResource) -> None: + self._api_paths = api_paths + + self.create = async_to_raw_response_wrapper( + api_paths.create, + ) + self.update = async_to_raw_response_wrapper( + api_paths.update, + ) + self.list = async_to_raw_response_wrapper( + api_paths.list, + ) + self.delete = async_to_raw_response_wrapper( + api_paths.delete, + ) + self.get = async_to_raw_response_wrapper( + api_paths.get, + ) + + +class APIPathsResourceWithStreamingResponse: + def __init__(self, api_paths: APIPathsResource) -> None: + self._api_paths = api_paths + + self.create = to_streamed_response_wrapper( + api_paths.create, + ) + self.update = to_streamed_response_wrapper( + api_paths.update, + ) + self.list = to_streamed_response_wrapper( + api_paths.list, + ) + self.delete = to_streamed_response_wrapper( + api_paths.delete, + ) + self.get = to_streamed_response_wrapper( + api_paths.get, + ) + + +class AsyncAPIPathsResourceWithStreamingResponse: + def __init__(self, api_paths: AsyncAPIPathsResource) -> None: + self._api_paths = api_paths + + self.create = async_to_streamed_response_wrapper( + api_paths.create, + ) + self.update = async_to_streamed_response_wrapper( + api_paths.update, + ) + self.list = async_to_streamed_response_wrapper( + api_paths.list, + ) + self.delete = async_to_streamed_response_wrapper( + api_paths.delete, + ) + self.get = async_to_streamed_response_wrapper( + api_paths.get, + ) diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index 6cc7ca07..0cd83bc6 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -18,7 +18,7 @@ async_to_streamed_response_wrapper, ) from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.waap import RuleActionType, CustomerRuleState +from ....types.waap import WaapRuleActionType, WaapCustomerRuleState from ...._base_client import AsyncPaginator, make_request_options from ....types.waap.domains import ( custom_rule_list_params, @@ -26,9 +26,9 @@ custom_rule_update_params, custom_rule_delete_multiple_params, ) -from ....types.waap.rule_action_type import RuleActionType -from ....types.waap.customer_rule_state import CustomerRuleState -from ....types.waap.domains.custom_rule import CustomRule +from ....types.waap.waap_custom_rule import WaapCustomRule +from ....types.waap.waap_rule_action_type import WaapRuleActionType +from ....types.waap.waap_customer_rule_state import WaapCustomerRuleState __all__ = ["CustomRulesResource", "AsyncCustomRulesResource"] @@ -68,7 +68,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CustomRule: + ) -> WaapCustomRule: """ Create a custom rule @@ -109,7 +109,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CustomRule, + cast_to=WaapCustomRule, ) def update( @@ -179,7 +179,7 @@ def list( self, domain_id: int, *, - action: RuleActionType | NotGiven = NOT_GIVEN, + action: WaapRuleActionType | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, @@ -197,7 +197,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[CustomRule]: + ) -> SyncOffsetPage[WaapCustomRule]: """ Extracts a list of custom rules assigned to a domain, offering filter, ordering, and pagination capabilities @@ -229,7 +229,7 @@ def list( """ return self._get_api_list( f"/waap/v1/domains/{domain_id}/custom-rules", - page=SyncOffsetPage[CustomRule], + page=SyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -248,7 +248,7 @@ def list( custom_rule_list_params.CustomRuleListParams, ), ), - model=CustomRule, + model=WaapCustomRule, ) def delete( @@ -339,7 +339,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CustomRule: + ) -> WaapCustomRule: """ Extracts a specific custom rule assigned to a domain @@ -361,12 +361,12 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CustomRule, + cast_to=WaapCustomRule, ) def toggle( self, - action: CustomerRuleState, + action: WaapCustomerRuleState, *, domain_id: int, rule_id: int, @@ -442,7 +442,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CustomRule: + ) -> WaapCustomRule: """ Create a custom rule @@ -483,7 +483,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CustomRule, + cast_to=WaapCustomRule, ) async def update( @@ -553,7 +553,7 @@ def list( self, domain_id: int, *, - action: RuleActionType | NotGiven = NOT_GIVEN, + action: WaapRuleActionType | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, @@ -571,7 +571,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[CustomRule, AsyncOffsetPage[CustomRule]]: + ) -> AsyncPaginator[WaapCustomRule, AsyncOffsetPage[WaapCustomRule]]: """ Extracts a list of custom rules assigned to a domain, offering filter, ordering, and pagination capabilities @@ -603,7 +603,7 @@ def list( """ return self._get_api_list( f"/waap/v1/domains/{domain_id}/custom-rules", - page=AsyncOffsetPage[CustomRule], + page=AsyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -622,7 +622,7 @@ def list( custom_rule_list_params.CustomRuleListParams, ), ), - model=CustomRule, + model=WaapCustomRule, ) async def delete( @@ -713,7 +713,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CustomRule: + ) -> WaapCustomRule: """ Extracts a specific custom rule assigned to a domain @@ -735,12 +735,12 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CustomRule, + cast_to=WaapCustomRule, ) async def toggle( self, - action: CustomerRuleState, + action: WaapCustomerRuleState, *, domain_id: int, rule_id: int, diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index dcc0b621..6a6acd31 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -7,6 +7,22 @@ import httpx +from .insights import ( + InsightsResource, + AsyncInsightsResource, + InsightsResourceWithRawResponse, + AsyncInsightsResourceWithRawResponse, + InsightsResourceWithStreamingResponse, + AsyncInsightsResourceWithStreamingResponse, +) +from .policies import ( + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, +) from .settings import ( SettingsResource, AsyncSettingsResource, @@ -17,6 +33,14 @@ ) from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ...._utils import maybe_transform, async_maybe_transform +from .api_paths import ( + APIPathsResource, + AsyncAPIPathsResource, + APIPathsResourceWithRawResponse, + AsyncAPIPathsResourceWithRawResponse, + APIPathsResourceWithStreamingResponse, + AsyncAPIPathsResourceWithStreamingResponse, +) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -52,9 +76,42 @@ AsyncFirewallRulesResourceWithStreamingResponse, ) from ...._base_client import AsyncPaginator, make_request_options +from .api_path_groups import ( + APIPathGroupsResource, + AsyncAPIPathGroupsResource, + APIPathGroupsResourceWithRawResponse, + AsyncAPIPathGroupsResourceWithRawResponse, + APIPathGroupsResourceWithStreamingResponse, + AsyncAPIPathGroupsResourceWithStreamingResponse, +) +from .insight_silences import ( + InsightSilencesResource, + AsyncInsightSilencesResource, + InsightSilencesResourceWithRawResponse, + AsyncInsightSilencesResourceWithRawResponse, + InsightSilencesResourceWithStreamingResponse, + AsyncInsightSilencesResourceWithStreamingResponse, +) +from .analytics.analytics import ( + AnalyticsResource, + AsyncAnalyticsResource, + AnalyticsResourceWithRawResponse, + AsyncAnalyticsResourceWithRawResponse, + AnalyticsResourceWithStreamingResponse, + AsyncAnalyticsResourceWithStreamingResponse, +) +from .api_discovery.api_discovery import ( + APIDiscoveryResource, + AsyncAPIDiscoveryResource, + APIDiscoveryResourceWithRawResponse, + AsyncAPIDiscoveryResourceWithRawResponse, + APIDiscoveryResourceWithStreamingResponse, + AsyncAPIDiscoveryResourceWithStreamingResponse, +) from ....types.waap.waap_domain_status import WaapDomainStatus from ....types.waap.waap_summary_domain import WaapSummaryDomain from ....types.waap.waap_detailed_domain import WaapDetailedDomain +from ....types.waap.domain_list_rule_sets_response import DomainListRuleSetsResponse __all__ = ["DomainsResource", "AsyncDomainsResource"] @@ -64,6 +121,34 @@ class DomainsResource(SyncAPIResource): def settings(self) -> SettingsResource: return SettingsResource(self._client) + @cached_property + def api_paths(self) -> APIPathsResource: + return APIPathsResource(self._client) + + @cached_property + def api_path_groups(self) -> APIPathGroupsResource: + return APIPathGroupsResource(self._client) + + @cached_property + def api_discovery(self) -> APIDiscoveryResource: + return APIDiscoveryResource(self._client) + + @cached_property + def insights(self) -> InsightsResource: + return InsightsResource(self._client) + + @cached_property + def insight_silences(self) -> InsightSilencesResource: + return InsightSilencesResource(self._client) + + @cached_property + def policies(self) -> PoliciesResource: + return PoliciesResource(self._client) + + @cached_property + def analytics(self) -> AnalyticsResource: + return AnalyticsResource(self._client) + @cached_property def custom_rules(self) -> CustomRulesResource: return CustomRulesResource(self._client) @@ -266,12 +351,73 @@ def get( cast_to=WaapDetailedDomain, ) + def list_rule_sets( + self, + domain_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, + ) -> DomainListRuleSetsResponse: + """ + Retrieve all rule sets linked to a particular domain + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/waap/v1/domains/{domain_id}/rule-sets", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DomainListRuleSetsResponse, + ) + class AsyncDomainsResource(AsyncAPIResource): @cached_property def settings(self) -> AsyncSettingsResource: return AsyncSettingsResource(self._client) + @cached_property + def api_paths(self) -> AsyncAPIPathsResource: + return AsyncAPIPathsResource(self._client) + + @cached_property + def api_path_groups(self) -> AsyncAPIPathGroupsResource: + return AsyncAPIPathGroupsResource(self._client) + + @cached_property + def api_discovery(self) -> AsyncAPIDiscoveryResource: + return AsyncAPIDiscoveryResource(self._client) + + @cached_property + def insights(self) -> AsyncInsightsResource: + return AsyncInsightsResource(self._client) + + @cached_property + def insight_silences(self) -> AsyncInsightSilencesResource: + return AsyncInsightSilencesResource(self._client) + + @cached_property + def policies(self) -> AsyncPoliciesResource: + return AsyncPoliciesResource(self._client) + + @cached_property + def analytics(self) -> AsyncAnalyticsResource: + return AsyncAnalyticsResource(self._client) + @cached_property def custom_rules(self) -> AsyncCustomRulesResource: return AsyncCustomRulesResource(self._client) @@ -474,6 +620,39 @@ async def get( cast_to=WaapDetailedDomain, ) + async def list_rule_sets( + self, + domain_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, + ) -> DomainListRuleSetsResponse: + """ + Retrieve all rule sets linked to a particular domain + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/waap/v1/domains/{domain_id}/rule-sets", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DomainListRuleSetsResponse, + ) + class DomainsResourceWithRawResponse: def __init__(self, domains: DomainsResource) -> None: @@ -491,11 +670,42 @@ def __init__(self, domains: DomainsResource) -> None: self.get = to_raw_response_wrapper( domains.get, ) + self.list_rule_sets = to_raw_response_wrapper( + domains.list_rule_sets, + ) @cached_property def settings(self) -> SettingsResourceWithRawResponse: return SettingsResourceWithRawResponse(self._domains.settings) + @cached_property + def api_paths(self) -> APIPathsResourceWithRawResponse: + return APIPathsResourceWithRawResponse(self._domains.api_paths) + + @cached_property + def api_path_groups(self) -> APIPathGroupsResourceWithRawResponse: + return APIPathGroupsResourceWithRawResponse(self._domains.api_path_groups) + + @cached_property + def api_discovery(self) -> APIDiscoveryResourceWithRawResponse: + return APIDiscoveryResourceWithRawResponse(self._domains.api_discovery) + + @cached_property + def insights(self) -> InsightsResourceWithRawResponse: + return InsightsResourceWithRawResponse(self._domains.insights) + + @cached_property + def insight_silences(self) -> InsightSilencesResourceWithRawResponse: + return InsightSilencesResourceWithRawResponse(self._domains.insight_silences) + + @cached_property + def policies(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self._domains.policies) + + @cached_property + def analytics(self) -> AnalyticsResourceWithRawResponse: + return AnalyticsResourceWithRawResponse(self._domains.analytics) + @cached_property def custom_rules(self) -> CustomRulesResourceWithRawResponse: return CustomRulesResourceWithRawResponse(self._domains.custom_rules) @@ -525,11 +735,42 @@ def __init__(self, domains: AsyncDomainsResource) -> None: self.get = async_to_raw_response_wrapper( domains.get, ) + self.list_rule_sets = async_to_raw_response_wrapper( + domains.list_rule_sets, + ) @cached_property def settings(self) -> AsyncSettingsResourceWithRawResponse: return AsyncSettingsResourceWithRawResponse(self._domains.settings) + @cached_property + def api_paths(self) -> AsyncAPIPathsResourceWithRawResponse: + return AsyncAPIPathsResourceWithRawResponse(self._domains.api_paths) + + @cached_property + def api_path_groups(self) -> AsyncAPIPathGroupsResourceWithRawResponse: + return AsyncAPIPathGroupsResourceWithRawResponse(self._domains.api_path_groups) + + @cached_property + def api_discovery(self) -> AsyncAPIDiscoveryResourceWithRawResponse: + return AsyncAPIDiscoveryResourceWithRawResponse(self._domains.api_discovery) + + @cached_property + def insights(self) -> AsyncInsightsResourceWithRawResponse: + return AsyncInsightsResourceWithRawResponse(self._domains.insights) + + @cached_property + def insight_silences(self) -> AsyncInsightSilencesResourceWithRawResponse: + return AsyncInsightSilencesResourceWithRawResponse(self._domains.insight_silences) + + @cached_property + def policies(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self._domains.policies) + + @cached_property + def analytics(self) -> AsyncAnalyticsResourceWithRawResponse: + return AsyncAnalyticsResourceWithRawResponse(self._domains.analytics) + @cached_property def custom_rules(self) -> AsyncCustomRulesResourceWithRawResponse: return AsyncCustomRulesResourceWithRawResponse(self._domains.custom_rules) @@ -559,11 +800,42 @@ def __init__(self, domains: DomainsResource) -> None: self.get = to_streamed_response_wrapper( domains.get, ) + self.list_rule_sets = to_streamed_response_wrapper( + domains.list_rule_sets, + ) @cached_property def settings(self) -> SettingsResourceWithStreamingResponse: return SettingsResourceWithStreamingResponse(self._domains.settings) + @cached_property + def api_paths(self) -> APIPathsResourceWithStreamingResponse: + return APIPathsResourceWithStreamingResponse(self._domains.api_paths) + + @cached_property + def api_path_groups(self) -> APIPathGroupsResourceWithStreamingResponse: + return APIPathGroupsResourceWithStreamingResponse(self._domains.api_path_groups) + + @cached_property + def api_discovery(self) -> APIDiscoveryResourceWithStreamingResponse: + return APIDiscoveryResourceWithStreamingResponse(self._domains.api_discovery) + + @cached_property + def insights(self) -> InsightsResourceWithStreamingResponse: + return InsightsResourceWithStreamingResponse(self._domains.insights) + + @cached_property + def insight_silences(self) -> InsightSilencesResourceWithStreamingResponse: + return InsightSilencesResourceWithStreamingResponse(self._domains.insight_silences) + + @cached_property + def policies(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self._domains.policies) + + @cached_property + def analytics(self) -> AnalyticsResourceWithStreamingResponse: + return AnalyticsResourceWithStreamingResponse(self._domains.analytics) + @cached_property def custom_rules(self) -> CustomRulesResourceWithStreamingResponse: return CustomRulesResourceWithStreamingResponse(self._domains.custom_rules) @@ -593,11 +865,42 @@ def __init__(self, domains: AsyncDomainsResource) -> None: self.get = async_to_streamed_response_wrapper( domains.get, ) + self.list_rule_sets = async_to_streamed_response_wrapper( + domains.list_rule_sets, + ) @cached_property def settings(self) -> AsyncSettingsResourceWithStreamingResponse: return AsyncSettingsResourceWithStreamingResponse(self._domains.settings) + @cached_property + def api_paths(self) -> AsyncAPIPathsResourceWithStreamingResponse: + return AsyncAPIPathsResourceWithStreamingResponse(self._domains.api_paths) + + @cached_property + def api_path_groups(self) -> AsyncAPIPathGroupsResourceWithStreamingResponse: + return AsyncAPIPathGroupsResourceWithStreamingResponse(self._domains.api_path_groups) + + @cached_property + def api_discovery(self) -> AsyncAPIDiscoveryResourceWithStreamingResponse: + return AsyncAPIDiscoveryResourceWithStreamingResponse(self._domains.api_discovery) + + @cached_property + def insights(self) -> AsyncInsightsResourceWithStreamingResponse: + return AsyncInsightsResourceWithStreamingResponse(self._domains.insights) + + @cached_property + def insight_silences(self) -> AsyncInsightSilencesResourceWithStreamingResponse: + return AsyncInsightSilencesResourceWithStreamingResponse(self._domains.insight_silences) + + @cached_property + def policies(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self._domains.policies) + + @cached_property + def analytics(self) -> AsyncAnalyticsResourceWithStreamingResponse: + return AsyncAnalyticsResourceWithStreamingResponse(self._domains.analytics) + @cached_property def custom_rules(self) -> AsyncCustomRulesResourceWithStreamingResponse: return AsyncCustomRulesResourceWithStreamingResponse(self._domains.custom_rules) diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index 3a43a5fd..a9de049a 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -18,7 +18,7 @@ async_to_streamed_response_wrapper, ) from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.waap import CustomerRuleState +from ....types.waap import WaapCustomerRuleState from ...._base_client import AsyncPaginator, make_request_options from ....types.waap.domains import ( firewall_rule_list_params, @@ -26,8 +26,8 @@ firewall_rule_update_params, firewall_rule_delete_multiple_params, ) -from ....types.waap.customer_rule_state import CustomerRuleState -from ....types.waap.domains.firewall_rule import FirewallRule +from ....types.waap.waap_firewall_rule import WaapFirewallRule +from ....types.waap.waap_customer_rule_state import WaapCustomerRuleState __all__ = ["FirewallRulesResource", "AsyncFirewallRulesResource"] @@ -67,7 +67,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FirewallRule: + ) -> WaapFirewallRule: """ Create a firewall rule @@ -107,7 +107,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FirewallRule, + cast_to=WaapFirewallRule, ) def update( @@ -194,7 +194,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[FirewallRule]: + ) -> SyncOffsetPage[WaapFirewallRule]: """ Extracts a list of firewall rules assigned to a domain, offering filter, ordering, and pagination capabilities @@ -226,7 +226,7 @@ def list( """ return self._get_api_list( f"/waap/v1/domains/{domain_id}/firewall-rules", - page=SyncOffsetPage[FirewallRule], + page=SyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -245,7 +245,7 @@ def list( firewall_rule_list_params.FirewallRuleListParams, ), ), - model=FirewallRule, + model=WaapFirewallRule, ) def delete( @@ -336,7 +336,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FirewallRule: + ) -> WaapFirewallRule: """ Extracts a specific firewall rule assigned to a domain @@ -358,12 +358,12 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FirewallRule, + cast_to=WaapFirewallRule, ) def toggle( self, - action: CustomerRuleState, + action: WaapCustomerRuleState, *, domain_id: int, rule_id: int, @@ -439,7 +439,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FirewallRule: + ) -> WaapFirewallRule: """ Create a firewall rule @@ -479,7 +479,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FirewallRule, + cast_to=WaapFirewallRule, ) async def update( @@ -566,7 +566,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[FirewallRule, AsyncOffsetPage[FirewallRule]]: + ) -> AsyncPaginator[WaapFirewallRule, AsyncOffsetPage[WaapFirewallRule]]: """ Extracts a list of firewall rules assigned to a domain, offering filter, ordering, and pagination capabilities @@ -598,7 +598,7 @@ def list( """ return self._get_api_list( f"/waap/v1/domains/{domain_id}/firewall-rules", - page=AsyncOffsetPage[FirewallRule], + page=AsyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -617,7 +617,7 @@ def list( firewall_rule_list_params.FirewallRuleListParams, ), ), - model=FirewallRule, + model=WaapFirewallRule, ) async def delete( @@ -708,7 +708,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FirewallRule: + ) -> WaapFirewallRule: """ Extracts a specific firewall rule assigned to a domain @@ -730,12 +730,12 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FirewallRule, + cast_to=WaapFirewallRule, ) async def toggle( self, - action: CustomerRuleState, + action: WaapCustomerRuleState, *, domain_id: int, rule_id: int, diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py new file mode 100644 index 00000000..5c7f7e14 --- /dev/null +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -0,0 +1,689 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Union, Optional +from datetime import datetime + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.waap import WaapInsightSilenceSortBy +from ...._base_client import AsyncPaginator, make_request_options +from ....types.waap.domains import ( + insight_silence_list_params, + insight_silence_create_params, + insight_silence_update_params, +) +from ....types.waap.waap_insight_silence import WaapInsightSilence +from ....types.waap.waap_insight_silence_sort_by import WaapInsightSilenceSortBy + +__all__ = ["InsightSilencesResource", "AsyncInsightSilencesResource"] + + +class InsightSilencesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InsightSilencesResourceWithRawResponse: + """ + 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 InsightSilencesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InsightSilencesResourceWithStreamingResponse: + """ + 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 InsightSilencesResourceWithStreamingResponse(self) + + def create( + self, + domain_id: int, + *, + author: str, + comment: str, + insight_type: str, + labels: Dict[str, str], + expire_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> WaapInsightSilence: + """Create a new insight silence for a specified domain. + + Insight silences help in + temporarily disabling certain insights based on specific criteria. + + Args: + domain_id: The domain ID + + author: The author of the silence + + comment: A comment explaining the reason for the silence + + insight_type: The slug of the insight type + + labels: A hash table of label names and values that apply to the insight silence + + expire_at: The date and time the silence expires in ISO 8601 format + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/waap/v1/domains/{domain_id}/insight-silences", + body=maybe_transform( + { + "author": author, + "comment": comment, + "insight_type": insight_type, + "labels": labels, + "expire_at": expire_at, + }, + insight_silence_create_params.InsightSilenceCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapInsightSilence, + ) + + def update( + self, + silence_id: str, + *, + domain_id: int, + author: str, + comment: str, + expire_at: Union[str, datetime, None], + labels: Dict[str, str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> WaapInsightSilence: + """ + Update an insight silence for a specific domain. + + Args: + domain_id: The domain ID + + silence_id: A generated unique identifier for the silence + + author: The author of the silence + + comment: A comment explaining the reason for the silence + + expire_at: The date and time the silence expires in ISO 8601 format + + labels: A hash table of label names and values that apply to the insight silence + + 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 silence_id: + raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") + return self._patch( + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + body=maybe_transform( + { + "author": author, + "comment": comment, + "expire_at": expire_at, + "labels": labels, + }, + insight_silence_update_params.InsightSilenceUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapInsightSilence, + ) + + def list( + self, + domain_id: int, + *, + id: Optional[List[str]] | NotGiven = NOT_GIVEN, + author: Optional[str] | NotGiven = NOT_GIVEN, + comment: Optional[str] | NotGiven = NOT_GIVEN, + insight_type: Optional[List[str]] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: WaapInsightSilenceSortBy | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[WaapInsightSilence]: + """ + Retrieve a list of insight silences for a specific domain + + Args: + domain_id: The domain ID + + id: The ID of the insight silence + + author: The author of the insight silence + + comment: The comment of the insight silence + + insight_type: The type of the insight silence + + limit: Number of items to return + + offset: Number of items to skip + + ordering: Sort the response by given field. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/insight-silences", + page=SyncOffsetPage[WaapInsightSilence], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "author": author, + "comment": comment, + "insight_type": insight_type, + "limit": limit, + "offset": offset, + "ordering": ordering, + }, + insight_silence_list_params.InsightSilenceListParams, + ), + ), + model=WaapInsightSilence, + ) + + def delete( + self, + silence_id: str, + *, + domain_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete an insight silence for a specific domain. + + Args: + domain_id: The domain ID + + silence_id: A generated unique identifier for the silence + + 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 silence_id: + raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + silence_id: str, + *, + domain_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, + ) -> WaapInsightSilence: + """ + Retrieve a specific insight silence for a specific domain + + Args: + domain_id: The domain ID + + silence_id: A generated unique identifier for the silence + + 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 silence_id: + raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") + return self._get( + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapInsightSilence, + ) + + +class AsyncInsightSilencesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInsightSilencesResourceWithRawResponse: + """ + 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 AsyncInsightSilencesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInsightSilencesResourceWithStreamingResponse: + """ + 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 AsyncInsightSilencesResourceWithStreamingResponse(self) + + async def create( + self, + domain_id: int, + *, + author: str, + comment: str, + insight_type: str, + labels: Dict[str, str], + expire_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> WaapInsightSilence: + """Create a new insight silence for a specified domain. + + Insight silences help in + temporarily disabling certain insights based on specific criteria. + + Args: + domain_id: The domain ID + + author: The author of the silence + + comment: A comment explaining the reason for the silence + + insight_type: The slug of the insight type + + labels: A hash table of label names and values that apply to the insight silence + + expire_at: The date and time the silence expires in ISO 8601 format + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/waap/v1/domains/{domain_id}/insight-silences", + body=await async_maybe_transform( + { + "author": author, + "comment": comment, + "insight_type": insight_type, + "labels": labels, + "expire_at": expire_at, + }, + insight_silence_create_params.InsightSilenceCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapInsightSilence, + ) + + async def update( + self, + silence_id: str, + *, + domain_id: int, + author: str, + comment: str, + expire_at: Union[str, datetime, None], + labels: Dict[str, str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> WaapInsightSilence: + """ + Update an insight silence for a specific domain. + + Args: + domain_id: The domain ID + + silence_id: A generated unique identifier for the silence + + author: The author of the silence + + comment: A comment explaining the reason for the silence + + expire_at: The date and time the silence expires in ISO 8601 format + + labels: A hash table of label names and values that apply to the insight silence + + 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 silence_id: + raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") + return await self._patch( + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + body=await async_maybe_transform( + { + "author": author, + "comment": comment, + "expire_at": expire_at, + "labels": labels, + }, + insight_silence_update_params.InsightSilenceUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapInsightSilence, + ) + + def list( + self, + domain_id: int, + *, + id: Optional[List[str]] | NotGiven = NOT_GIVEN, + author: Optional[str] | NotGiven = NOT_GIVEN, + comment: Optional[str] | NotGiven = NOT_GIVEN, + insight_type: Optional[List[str]] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: WaapInsightSilenceSortBy | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[WaapInsightSilence, AsyncOffsetPage[WaapInsightSilence]]: + """ + Retrieve a list of insight silences for a specific domain + + Args: + domain_id: The domain ID + + id: The ID of the insight silence + + author: The author of the insight silence + + comment: The comment of the insight silence + + insight_type: The type of the insight silence + + limit: Number of items to return + + offset: Number of items to skip + + ordering: Sort the response by given field. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/insight-silences", + page=AsyncOffsetPage[WaapInsightSilence], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "author": author, + "comment": comment, + "insight_type": insight_type, + "limit": limit, + "offset": offset, + "ordering": ordering, + }, + insight_silence_list_params.InsightSilenceListParams, + ), + ), + model=WaapInsightSilence, + ) + + async def delete( + self, + silence_id: str, + *, + domain_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete an insight silence for a specific domain. + + Args: + domain_id: The domain ID + + silence_id: A generated unique identifier for the silence + + 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 silence_id: + raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + silence_id: str, + *, + domain_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, + ) -> WaapInsightSilence: + """ + Retrieve a specific insight silence for a specific domain + + Args: + domain_id: The domain ID + + silence_id: A generated unique identifier for the silence + + 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 silence_id: + raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") + return await self._get( + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapInsightSilence, + ) + + +class InsightSilencesResourceWithRawResponse: + def __init__(self, insight_silences: InsightSilencesResource) -> None: + self._insight_silences = insight_silences + + self.create = to_raw_response_wrapper( + insight_silences.create, + ) + self.update = to_raw_response_wrapper( + insight_silences.update, + ) + self.list = to_raw_response_wrapper( + insight_silences.list, + ) + self.delete = to_raw_response_wrapper( + insight_silences.delete, + ) + self.get = to_raw_response_wrapper( + insight_silences.get, + ) + + +class AsyncInsightSilencesResourceWithRawResponse: + def __init__(self, insight_silences: AsyncInsightSilencesResource) -> None: + self._insight_silences = insight_silences + + self.create = async_to_raw_response_wrapper( + insight_silences.create, + ) + self.update = async_to_raw_response_wrapper( + insight_silences.update, + ) + self.list = async_to_raw_response_wrapper( + insight_silences.list, + ) + self.delete = async_to_raw_response_wrapper( + insight_silences.delete, + ) + self.get = async_to_raw_response_wrapper( + insight_silences.get, + ) + + +class InsightSilencesResourceWithStreamingResponse: + def __init__(self, insight_silences: InsightSilencesResource) -> None: + self._insight_silences = insight_silences + + self.create = to_streamed_response_wrapper( + insight_silences.create, + ) + self.update = to_streamed_response_wrapper( + insight_silences.update, + ) + self.list = to_streamed_response_wrapper( + insight_silences.list, + ) + self.delete = to_streamed_response_wrapper( + insight_silences.delete, + ) + self.get = to_streamed_response_wrapper( + insight_silences.get, + ) + + +class AsyncInsightSilencesResourceWithStreamingResponse: + def __init__(self, insight_silences: AsyncInsightSilencesResource) -> None: + self._insight_silences = insight_silences + + self.create = async_to_streamed_response_wrapper( + insight_silences.create, + ) + self.update = async_to_streamed_response_wrapper( + insight_silences.update, + ) + self.list = async_to_streamed_response_wrapper( + insight_silences.list, + ) + self.delete = async_to_streamed_response_wrapper( + insight_silences.delete, + ) + self.get = async_to_streamed_response_wrapper( + insight_silences.get, + ) diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py new file mode 100644 index 00000000..29bbe1b5 --- /dev/null +++ b/src/gcore/resources/waap/domains/insights.py @@ -0,0 +1,425 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.waap import WaapInsightSortBy, WaapInsightStatus +from ...._base_client import AsyncPaginator, make_request_options +from ....types.waap.domains import insight_list_params, insight_replace_params +from ....types.waap.waap_insight import WaapInsight +from ....types.waap.waap_insight_status import WaapInsightStatus +from ....types.waap.waap_insight_sort_by import WaapInsightSortBy + +__all__ = ["InsightsResource", "AsyncInsightsResource"] + + +class InsightsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InsightsResourceWithRawResponse: + """ + 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 InsightsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InsightsResourceWithStreamingResponse: + """ + 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 InsightsResourceWithStreamingResponse(self) + + def list( + self, + domain_id: int, + *, + id: Optional[List[str]] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + insight_type: Optional[List[str]] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: WaapInsightSortBy | NotGiven = NOT_GIVEN, + status: Optional[List[WaapInsightStatus]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[WaapInsight]: + """ + Retrieve a list of insights for a specific domain. + + Args: + domain_id: The domain ID + + id: The ID of the insight + + description: The description of the insight. Supports '\\**' as a wildcard. + + insight_type: The type of the insight + + limit: Number of items to return + + offset: Number of items to skip + + ordering: Sort the response by given field. + + status: The status of the insight + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/insights", + page=SyncOffsetPage[WaapInsight], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "description": description, + "insight_type": insight_type, + "limit": limit, + "offset": offset, + "ordering": ordering, + "status": status, + }, + insight_list_params.InsightListParams, + ), + ), + model=WaapInsight, + ) + + def get( + self, + insight_id: str, + *, + domain_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, + ) -> WaapInsight: + """ + Retrieve a specific insight for a specific domain. + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not insight_id: + raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") + return self._get( + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapInsight, + ) + + def replace( + self, + insight_id: str, + *, + domain_id: int, + status: WaapInsightStatus, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> WaapInsight: + """ + Update the status of an insight for a specific domain. + + Args: + domain_id: The domain ID + + insight_id: The ID of the insight + + status: The different statuses an insight can have + + 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 insight_id: + raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") + return self._put( + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + body=maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapInsight, + ) + + +class AsyncInsightsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInsightsResourceWithRawResponse: + """ + 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 AsyncInsightsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInsightsResourceWithStreamingResponse: + """ + 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 AsyncInsightsResourceWithStreamingResponse(self) + + def list( + self, + domain_id: int, + *, + id: Optional[List[str]] | NotGiven = NOT_GIVEN, + description: Optional[str] | NotGiven = NOT_GIVEN, + insight_type: Optional[List[str]] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: WaapInsightSortBy | NotGiven = NOT_GIVEN, + status: Optional[List[WaapInsightStatus]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[WaapInsight, AsyncOffsetPage[WaapInsight]]: + """ + Retrieve a list of insights for a specific domain. + + Args: + domain_id: The domain ID + + id: The ID of the insight + + description: The description of the insight. Supports '\\**' as a wildcard. + + insight_type: The type of the insight + + limit: Number of items to return + + offset: Number of items to skip + + ordering: Sort the response by given field. + + status: The status of the insight + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/insights", + page=AsyncOffsetPage[WaapInsight], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "description": description, + "insight_type": insight_type, + "limit": limit, + "offset": offset, + "ordering": ordering, + "status": status, + }, + insight_list_params.InsightListParams, + ), + ), + model=WaapInsight, + ) + + async def get( + self, + insight_id: str, + *, + domain_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, + ) -> WaapInsight: + """ + Retrieve a specific insight for a specific domain. + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not insight_id: + raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") + return await self._get( + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapInsight, + ) + + async def replace( + self, + insight_id: str, + *, + domain_id: int, + status: WaapInsightStatus, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> WaapInsight: + """ + Update the status of an insight for a specific domain. + + Args: + domain_id: The domain ID + + insight_id: The ID of the insight + + status: The different statuses an insight can have + + 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 insight_id: + raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") + return await self._put( + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + body=await async_maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapInsight, + ) + + +class InsightsResourceWithRawResponse: + def __init__(self, insights: InsightsResource) -> None: + self._insights = insights + + self.list = to_raw_response_wrapper( + insights.list, + ) + self.get = to_raw_response_wrapper( + insights.get, + ) + self.replace = to_raw_response_wrapper( + insights.replace, + ) + + +class AsyncInsightsResourceWithRawResponse: + def __init__(self, insights: AsyncInsightsResource) -> None: + self._insights = insights + + self.list = async_to_raw_response_wrapper( + insights.list, + ) + self.get = async_to_raw_response_wrapper( + insights.get, + ) + self.replace = async_to_raw_response_wrapper( + insights.replace, + ) + + +class InsightsResourceWithStreamingResponse: + def __init__(self, insights: InsightsResource) -> None: + self._insights = insights + + self.list = to_streamed_response_wrapper( + insights.list, + ) + self.get = to_streamed_response_wrapper( + insights.get, + ) + self.replace = to_streamed_response_wrapper( + insights.replace, + ) + + +class AsyncInsightsResourceWithStreamingResponse: + def __init__(self, insights: AsyncInsightsResource) -> None: + self._insights = insights + + self.list = async_to_streamed_response_wrapper( + insights.list, + ) + self.get = async_to_streamed_response_wrapper( + insights.get, + ) + self.replace = async_to_streamed_response_wrapper( + insights.replace, + ) diff --git a/src/gcore/resources/waap/domains/policies.py b/src/gcore/resources/waap/domains/policies.py new file mode 100644 index 00000000..bf9eeca9 --- /dev/null +++ b/src/gcore/resources/waap/domains/policies.py @@ -0,0 +1,173 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.waap.waap_policy_mode import WaapPolicyMode + +__all__ = ["PoliciesResource", "AsyncPoliciesResource"] + + +class PoliciesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PoliciesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return PoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return PoliciesResourceWithStreamingResponse(self) + + def toggle( + self, + policy_id: str, + *, + domain_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, + ) -> WaapPolicyMode: + """ + Modify the activation state of a policy associated with a domain + + Args: + domain_id: The domain ID + + policy_id: The ID of the policy to toggle + + 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 policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") + return self._patch( + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapPolicyMode, + ) + + +class AsyncPoliciesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncPoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncPoliciesResourceWithStreamingResponse(self) + + async def toggle( + self, + policy_id: str, + *, + domain_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, + ) -> WaapPolicyMode: + """ + Modify the activation state of a policy associated with a domain + + Args: + domain_id: The domain ID + + policy_id: The ID of the policy to toggle + + 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 policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") + return await self._patch( + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapPolicyMode, + ) + + +class PoliciesResourceWithRawResponse: + def __init__(self, policies: PoliciesResource) -> None: + self._policies = policies + + self.toggle = to_raw_response_wrapper( + policies.toggle, + ) + + +class AsyncPoliciesResourceWithRawResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: + self._policies = policies + + self.toggle = async_to_raw_response_wrapper( + policies.toggle, + ) + + +class PoliciesResourceWithStreamingResponse: + def __init__(self, policies: PoliciesResource) -> None: + self._policies = policies + + self.toggle = to_streamed_response_wrapper( + policies.toggle, + ) + + +class AsyncPoliciesResourceWithStreamingResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: + self._policies = policies + + self.toggle = async_to_streamed_response_wrapper( + policies.toggle, + ) diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py index 63bc77df..fc9cafbf 100644 --- a/src/gcore/resources/waap/domains/settings.py +++ b/src/gcore/resources/waap/domains/settings.py @@ -16,7 +16,7 @@ ) from ...._base_client import make_request_options from ....types.waap.domains import setting_update_params -from ....types.waap.waap_domain_settings import WaapDomainSettings +from ....types.waap.waap_domain_settings_model import WaapDomainSettingsModel __all__ = ["SettingsResource", "AsyncSettingsResource"] @@ -98,7 +98,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaapDomainSettings: + ) -> WaapDomainSettingsModel: """ Retrieve settings for a specific domain @@ -118,7 +118,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=WaapDomainSettings, + cast_to=WaapDomainSettingsModel, ) @@ -199,7 +199,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaapDomainSettings: + ) -> WaapDomainSettingsModel: """ Retrieve settings for a specific domain @@ -219,7 +219,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=WaapDomainSettings, + cast_to=WaapDomainSettingsModel, ) diff --git a/src/gcore/resources/waap/ip_info.py b/src/gcore/resources/waap/ip_info.py new file mode 100644 index 00000000..72de660e --- /dev/null +++ b/src/gcore/resources/waap/ip_info.py @@ -0,0 +1,1017 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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.waap import ( + ip_info_get_params, + ip_info_get_counts_params, + ip_info_get_top_urls_params, + ip_info_get_top_sessions_params, + ip_info_get_top_user_agents_params, + ip_info_get_blocked_requests_params, + ip_info_get_attack_time_series_params, + ip_info_get_ddos_attack_series_params, + ip_info_list_attacked_countries_params, +) +from ..._base_client import make_request_options +from ...types.waap.waap_ip_info import WaapIPInfo +from ...types.waap.waap_ip_info_counts import WaapIPInfoCounts +from ...types.waap.waap_ip_ddos_info_model import WaapIPDDOSInfoModel +from ...types.waap.ip_info_get_top_urls_response import IPInfoGetTopURLsResponse +from ...types.waap.ip_info_get_top_sessions_response import IPInfoGetTopSessionsResponse +from ...types.waap.ip_info_get_top_user_agents_response import IPInfoGetTopUserAgentsResponse +from ...types.waap.ip_info_get_blocked_requests_response import IPInfoGetBlockedRequestsResponse +from ...types.waap.ip_info_get_attack_time_series_response import IPInfoGetAttackTimeSeriesResponse +from ...types.waap.ip_info_list_attacked_countries_response import IPInfoListAttackedCountriesResponse + +__all__ = ["IPInfoResource", "AsyncIPInfoResource"] + + +class IPInfoResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> IPInfoResourceWithRawResponse: + """ + 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 IPInfoResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> IPInfoResourceWithStreamingResponse: + """ + 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 IPInfoResourceWithStreamingResponse(self) + + def get( + self, + *, + ip: 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, + ) -> WaapIPInfo: + """ + Fetch details about a particular IP address, including WHOIS data, risk score, + and additional tags. + + Args: + ip: The IP address to check + + 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( + "/waap/v1/ip-info/ip-info", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"ip": ip}, ip_info_get_params.IPInfoGetParams), + ), + cast_to=WaapIPInfo, + ) + + def get_attack_time_series( + self, + *, + ip: 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, + ) -> IPInfoGetAttackTimeSeriesResponse: + """ + Retrieve a time-series of attacks originating from a specified IP address. + + Args: + ip: The IP address to check + + 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( + "/waap/v1/ip-info/attack-time-series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"ip": ip}, ip_info_get_attack_time_series_params.IPInfoGetAttackTimeSeriesParams + ), + ), + cast_to=IPInfoGetAttackTimeSeriesResponse, + ) + + def get_blocked_requests( + self, + *, + domain_id: int, + ip: 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, + ) -> IPInfoGetBlockedRequestsResponse: + """ + Retrieve metrics, which enumerate blocked requests originating from a specific + IP to a domain, grouped by rule name and taken action. Each metric provides + insights into the request count blocked under a specific rule and the + corresponding action that was executed. + + Args: + domain_id: The domain ID + + ip: The IP address to check + + 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( + "/waap/v1/ip-info/blocked-requests", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "domain_id": domain_id, + "ip": ip, + }, + ip_info_get_blocked_requests_params.IPInfoGetBlockedRequestsParams, + ), + ), + cast_to=IPInfoGetBlockedRequestsResponse, + ) + + def get_counts( + self, + *, + ip: str, + domain_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> WaapIPInfoCounts: + """ + Retrieve metrics encompassing the counts of total requests, blocked requests and + unique sessions associated with a specified IP address. Metrics provide a + statistical overview, aiding in analyzing the interaction and access patterns of + the IP address in context. + + Args: + ip: The IP address to check + + domain_id: The identifier for a domain. When specified, the response will exclusively + contain data pertinent to the indicated domain, filtering out information from + other domains. + + 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( + "/waap/v1/ip-info/counts", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "ip": ip, + "domain_id": domain_id, + }, + ip_info_get_counts_params.IPInfoGetCountsParams, + ), + ), + cast_to=WaapIPInfoCounts, + ) + + def get_ddos_attack_series( + self, + *, + ip: 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, + ) -> WaapIPDDOSInfoModel: + """ + Fetch and analyze DDoS (Distributed Denial of Service) attack metrics for a + specified IP address. The endpoint provides time-series data, enabling users to + evaluate the frequency and intensity of attacks across various time intervals, + and it returns metrics in Prometheus format to offer a systematic view of DDoS + attack patterns. + + Args: + ip: The IP address to check + + 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( + "/waap/v1/ip-info/ddos", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"ip": ip}, ip_info_get_ddos_attack_series_params.IPInfoGetDDOSAttackSeriesParams + ), + ), + cast_to=WaapIPDDOSInfoModel, + ) + + def get_top_sessions( + self, + *, + domain_id: int, + ip: 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, + ) -> IPInfoGetTopSessionsResponse: + """ + Obtain the top 10 user sessions interfacing with a particular domain, identified + by IP. + + Args: + domain_id: The domain ID + + ip: The IP address to check + + 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( + "/waap/v1/ip-info/top-sessions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "domain_id": domain_id, + "ip": ip, + }, + ip_info_get_top_sessions_params.IPInfoGetTopSessionsParams, + ), + ), + cast_to=IPInfoGetTopSessionsResponse, + ) + + def get_top_urls( + self, + *, + domain_id: int, + ip: 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, + ) -> IPInfoGetTopURLsResponse: + """ + Returns a list of the top 10 URLs accessed by a specified IP address within a + specific domain. This data is vital to understand user navigation patterns, + pinpoint high-traffic pages, and facilitate more targeted enhancements or + security monitoring based on URL popularity. + + Args: + domain_id: The domain ID + + ip: The IP address to check + + 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( + "/waap/v1/ip-info/top-urls", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "domain_id": domain_id, + "ip": ip, + }, + ip_info_get_top_urls_params.IPInfoGetTopURLsParams, + ), + ), + cast_to=IPInfoGetTopURLsResponse, + ) + + def get_top_user_agents( + self, + *, + domain_id: int, + ip: 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, + ) -> IPInfoGetTopUserAgentsResponse: + """ + Retrieve the top 10 user agents interacting with a specified domain, filtered by + IP. + + Args: + domain_id: The domain ID + + ip: The IP address to check + + 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( + "/waap/v1/ip-info/top-user-agents", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "domain_id": domain_id, + "ip": ip, + }, + ip_info_get_top_user_agents_params.IPInfoGetTopUserAgentsParams, + ), + ), + cast_to=IPInfoGetTopUserAgentsResponse, + ) + + def list_attacked_countries( + self, + *, + ip: 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, + ) -> IPInfoListAttackedCountriesResponse: + """ + Retrieve a list of countries attacked by the specified IP address + + Args: + ip: The IP address to check + + 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( + "/waap/v1/ip-info/attack-map", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"ip": ip}, ip_info_list_attacked_countries_params.IPInfoListAttackedCountriesParams + ), + ), + cast_to=IPInfoListAttackedCountriesResponse, + ) + + +class AsyncIPInfoResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncIPInfoResourceWithRawResponse: + """ + 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 AsyncIPInfoResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncIPInfoResourceWithStreamingResponse: + """ + 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 AsyncIPInfoResourceWithStreamingResponse(self) + + async def get( + self, + *, + ip: 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, + ) -> WaapIPInfo: + """ + Fetch details about a particular IP address, including WHOIS data, risk score, + and additional tags. + + Args: + ip: The IP address to check + + 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( + "/waap/v1/ip-info/ip-info", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"ip": ip}, ip_info_get_params.IPInfoGetParams), + ), + cast_to=WaapIPInfo, + ) + + async def get_attack_time_series( + self, + *, + ip: 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, + ) -> IPInfoGetAttackTimeSeriesResponse: + """ + Retrieve a time-series of attacks originating from a specified IP address. + + Args: + ip: The IP address to check + + 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( + "/waap/v1/ip-info/attack-time-series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"ip": ip}, ip_info_get_attack_time_series_params.IPInfoGetAttackTimeSeriesParams + ), + ), + cast_to=IPInfoGetAttackTimeSeriesResponse, + ) + + async def get_blocked_requests( + self, + *, + domain_id: int, + ip: 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, + ) -> IPInfoGetBlockedRequestsResponse: + """ + Retrieve metrics, which enumerate blocked requests originating from a specific + IP to a domain, grouped by rule name and taken action. Each metric provides + insights into the request count blocked under a specific rule and the + corresponding action that was executed. + + Args: + domain_id: The domain ID + + ip: The IP address to check + + 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( + "/waap/v1/ip-info/blocked-requests", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "domain_id": domain_id, + "ip": ip, + }, + ip_info_get_blocked_requests_params.IPInfoGetBlockedRequestsParams, + ), + ), + cast_to=IPInfoGetBlockedRequestsResponse, + ) + + async def get_counts( + self, + *, + ip: str, + domain_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> WaapIPInfoCounts: + """ + Retrieve metrics encompassing the counts of total requests, blocked requests and + unique sessions associated with a specified IP address. Metrics provide a + statistical overview, aiding in analyzing the interaction and access patterns of + the IP address in context. + + Args: + ip: The IP address to check + + domain_id: The identifier for a domain. When specified, the response will exclusively + contain data pertinent to the indicated domain, filtering out information from + other domains. + + 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( + "/waap/v1/ip-info/counts", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "ip": ip, + "domain_id": domain_id, + }, + ip_info_get_counts_params.IPInfoGetCountsParams, + ), + ), + cast_to=WaapIPInfoCounts, + ) + + async def get_ddos_attack_series( + self, + *, + ip: 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, + ) -> WaapIPDDOSInfoModel: + """ + Fetch and analyze DDoS (Distributed Denial of Service) attack metrics for a + specified IP address. The endpoint provides time-series data, enabling users to + evaluate the frequency and intensity of attacks across various time intervals, + and it returns metrics in Prometheus format to offer a systematic view of DDoS + attack patterns. + + Args: + ip: The IP address to check + + 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( + "/waap/v1/ip-info/ddos", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"ip": ip}, ip_info_get_ddos_attack_series_params.IPInfoGetDDOSAttackSeriesParams + ), + ), + cast_to=WaapIPDDOSInfoModel, + ) + + async def get_top_sessions( + self, + *, + domain_id: int, + ip: 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, + ) -> IPInfoGetTopSessionsResponse: + """ + Obtain the top 10 user sessions interfacing with a particular domain, identified + by IP. + + Args: + domain_id: The domain ID + + ip: The IP address to check + + 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( + "/waap/v1/ip-info/top-sessions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "domain_id": domain_id, + "ip": ip, + }, + ip_info_get_top_sessions_params.IPInfoGetTopSessionsParams, + ), + ), + cast_to=IPInfoGetTopSessionsResponse, + ) + + async def get_top_urls( + self, + *, + domain_id: int, + ip: 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, + ) -> IPInfoGetTopURLsResponse: + """ + Returns a list of the top 10 URLs accessed by a specified IP address within a + specific domain. This data is vital to understand user navigation patterns, + pinpoint high-traffic pages, and facilitate more targeted enhancements or + security monitoring based on URL popularity. + + Args: + domain_id: The domain ID + + ip: The IP address to check + + 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( + "/waap/v1/ip-info/top-urls", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "domain_id": domain_id, + "ip": ip, + }, + ip_info_get_top_urls_params.IPInfoGetTopURLsParams, + ), + ), + cast_to=IPInfoGetTopURLsResponse, + ) + + async def get_top_user_agents( + self, + *, + domain_id: int, + ip: 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, + ) -> IPInfoGetTopUserAgentsResponse: + """ + Retrieve the top 10 user agents interacting with a specified domain, filtered by + IP. + + Args: + domain_id: The domain ID + + ip: The IP address to check + + 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( + "/waap/v1/ip-info/top-user-agents", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "domain_id": domain_id, + "ip": ip, + }, + ip_info_get_top_user_agents_params.IPInfoGetTopUserAgentsParams, + ), + ), + cast_to=IPInfoGetTopUserAgentsResponse, + ) + + async def list_attacked_countries( + self, + *, + ip: 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, + ) -> IPInfoListAttackedCountriesResponse: + """ + Retrieve a list of countries attacked by the specified IP address + + Args: + ip: The IP address to check + + 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( + "/waap/v1/ip-info/attack-map", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"ip": ip}, ip_info_list_attacked_countries_params.IPInfoListAttackedCountriesParams + ), + ), + cast_to=IPInfoListAttackedCountriesResponse, + ) + + +class IPInfoResourceWithRawResponse: + def __init__(self, ip_info: IPInfoResource) -> None: + self._ip_info = ip_info + + self.get = to_raw_response_wrapper( + ip_info.get, + ) + self.get_attack_time_series = to_raw_response_wrapper( + ip_info.get_attack_time_series, + ) + self.get_blocked_requests = to_raw_response_wrapper( + ip_info.get_blocked_requests, + ) + self.get_counts = to_raw_response_wrapper( + ip_info.get_counts, + ) + self.get_ddos_attack_series = to_raw_response_wrapper( + ip_info.get_ddos_attack_series, + ) + self.get_top_sessions = to_raw_response_wrapper( + ip_info.get_top_sessions, + ) + self.get_top_urls = to_raw_response_wrapper( + ip_info.get_top_urls, + ) + self.get_top_user_agents = to_raw_response_wrapper( + ip_info.get_top_user_agents, + ) + self.list_attacked_countries = to_raw_response_wrapper( + ip_info.list_attacked_countries, + ) + + +class AsyncIPInfoResourceWithRawResponse: + def __init__(self, ip_info: AsyncIPInfoResource) -> None: + self._ip_info = ip_info + + self.get = async_to_raw_response_wrapper( + ip_info.get, + ) + self.get_attack_time_series = async_to_raw_response_wrapper( + ip_info.get_attack_time_series, + ) + self.get_blocked_requests = async_to_raw_response_wrapper( + ip_info.get_blocked_requests, + ) + self.get_counts = async_to_raw_response_wrapper( + ip_info.get_counts, + ) + self.get_ddos_attack_series = async_to_raw_response_wrapper( + ip_info.get_ddos_attack_series, + ) + self.get_top_sessions = async_to_raw_response_wrapper( + ip_info.get_top_sessions, + ) + self.get_top_urls = async_to_raw_response_wrapper( + ip_info.get_top_urls, + ) + self.get_top_user_agents = async_to_raw_response_wrapper( + ip_info.get_top_user_agents, + ) + self.list_attacked_countries = async_to_raw_response_wrapper( + ip_info.list_attacked_countries, + ) + + +class IPInfoResourceWithStreamingResponse: + def __init__(self, ip_info: IPInfoResource) -> None: + self._ip_info = ip_info + + self.get = to_streamed_response_wrapper( + ip_info.get, + ) + self.get_attack_time_series = to_streamed_response_wrapper( + ip_info.get_attack_time_series, + ) + self.get_blocked_requests = to_streamed_response_wrapper( + ip_info.get_blocked_requests, + ) + self.get_counts = to_streamed_response_wrapper( + ip_info.get_counts, + ) + self.get_ddos_attack_series = to_streamed_response_wrapper( + ip_info.get_ddos_attack_series, + ) + self.get_top_sessions = to_streamed_response_wrapper( + ip_info.get_top_sessions, + ) + self.get_top_urls = to_streamed_response_wrapper( + ip_info.get_top_urls, + ) + self.get_top_user_agents = to_streamed_response_wrapper( + ip_info.get_top_user_agents, + ) + self.list_attacked_countries = to_streamed_response_wrapper( + ip_info.list_attacked_countries, + ) + + +class AsyncIPInfoResourceWithStreamingResponse: + def __init__(self, ip_info: AsyncIPInfoResource) -> None: + self._ip_info = ip_info + + self.get = async_to_streamed_response_wrapper( + ip_info.get, + ) + self.get_attack_time_series = async_to_streamed_response_wrapper( + ip_info.get_attack_time_series, + ) + self.get_blocked_requests = async_to_streamed_response_wrapper( + ip_info.get_blocked_requests, + ) + self.get_counts = async_to_streamed_response_wrapper( + ip_info.get_counts, + ) + self.get_ddos_attack_series = async_to_streamed_response_wrapper( + ip_info.get_ddos_attack_series, + ) + self.get_top_sessions = async_to_streamed_response_wrapper( + ip_info.get_top_sessions, + ) + self.get_top_urls = async_to_streamed_response_wrapper( + ip_info.get_top_urls, + ) + self.get_top_user_agents = async_to_streamed_response_wrapper( + ip_info.get_top_user_agents, + ) + self.list_attacked_countries = async_to_streamed_response_wrapper( + ip_info.list_attacked_countries, + ) diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py index aabadd7e..f36dcb35 100644 --- a/src/gcore/resources/waap/organizations.py +++ b/src/gcore/resources/waap/organizations.py @@ -20,7 +20,7 @@ from ...pagination import SyncOffsetPage, AsyncOffsetPage from ...types.waap import organization_list_params from ..._base_client import AsyncPaginator, make_request_options -from ...types.waap.organization import Organization +from ...types.waap.waap_organization import WaapOrganization __all__ = ["OrganizationsResource", "AsyncOrganizationsResource"] @@ -58,7 +58,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[Organization]: + ) -> SyncOffsetPage[WaapOrganization]: """ This endpoint retrieves a list of network organizations that own IP ranges as identified by the Whois service.It supports pagination, filtering based on @@ -83,7 +83,7 @@ def list( """ return self._get_api_list( "/waap/v1/organizations", - page=SyncOffsetPage[Organization], + page=SyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -99,7 +99,7 @@ def list( organization_list_params.OrganizationListParams, ), ), - model=Organization, + model=WaapOrganization, ) @@ -136,7 +136,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Organization, AsyncOffsetPage[Organization]]: + ) -> AsyncPaginator[WaapOrganization, AsyncOffsetPage[WaapOrganization]]: """ This endpoint retrieves a list of network organizations that own IP ranges as identified by the Whois service.It supports pagination, filtering based on @@ -161,7 +161,7 @@ def list( """ return self._get_api_list( "/waap/v1/organizations", - page=AsyncOffsetPage[Organization], + page=AsyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -177,7 +177,7 @@ def list( organization_list_params.OrganizationListParams, ), ), - model=Organization, + model=WaapOrganization, ) diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py index 52b41329..f8258bab 100644 --- a/src/gcore/resources/waap/statistics.py +++ b/src/gcore/resources/waap/statistics.py @@ -20,7 +20,7 @@ ) from ...types.waap import statistic_get_usage_series_params from ..._base_client import make_request_options -from ...types.waap.statistics_series import StatisticsSeries +from ...types.waap.waap_statistics_series import WaapStatisticsSeries __all__ = ["StatisticsResource", "AsyncStatisticsResource"] @@ -58,7 +58,7 @@ def get_usage_series( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StatisticsSeries: + ) -> WaapStatisticsSeries: """Retrieve statistics data as a time series. The `from` and `to` parameters are @@ -103,7 +103,7 @@ def get_usage_series( statistic_get_usage_series_params.StatisticGetUsageSeriesParams, ), ), - cast_to=StatisticsSeries, + cast_to=WaapStatisticsSeries, ) @@ -140,7 +140,7 @@ async def get_usage_series( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StatisticsSeries: + ) -> WaapStatisticsSeries: """Retrieve statistics data as a time series. The `from` and `to` parameters are @@ -185,7 +185,7 @@ async def get_usage_series( statistic_get_usage_series_params.StatisticGetUsageSeriesParams, ), ), - cast_to=StatisticsSeries, + cast_to=WaapStatisticsSeries, ) diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py index fe6b678e..df171560 100644 --- a/src/gcore/resources/waap/tags.py +++ b/src/gcore/resources/waap/tags.py @@ -20,7 +20,7 @@ from ...pagination import SyncOffsetPage, AsyncOffsetPage from ...types.waap import tag_list_params from ..._base_client import AsyncPaginator, make_request_options -from ...types.waap.tag import Tag +from ...types.waap.waap_tag import WaapTag __all__ = ["TagsResource", "AsyncTagsResource"] @@ -61,7 +61,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[Tag]: + ) -> SyncOffsetPage[WaapTag]: """ Tags are shortcuts for the rules used in WAAP policies for the creation of more complex WAAP rules @@ -89,7 +89,7 @@ def list( """ return self._get_api_list( "/waap/v1/tags", - page=SyncOffsetPage[Tag], + page=SyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -107,7 +107,7 @@ def list( tag_list_params.TagListParams, ), ), - model=Tag, + model=WaapTag, ) @@ -147,7 +147,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Tag, AsyncOffsetPage[Tag]]: + ) -> AsyncPaginator[WaapTag, AsyncOffsetPage[WaapTag]]: """ Tags are shortcuts for the rules used in WAAP policies for the creation of more complex WAAP rules @@ -175,7 +175,7 @@ def list( """ return self._get_api_list( "/waap/v1/tags", - page=AsyncOffsetPage[Tag], + page=AsyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -193,7 +193,7 @@ def list( tag_list_params.TagListParams, ), ), - model=Tag, + model=WaapTag, ) diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index c28a767c..dc9181ac 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -12,6 +12,22 @@ TagsResourceWithStreamingResponse, AsyncTagsResourceWithStreamingResponse, ) +from .clients import ( + ClientsResource, + AsyncClientsResource, + ClientsResourceWithRawResponse, + AsyncClientsResourceWithRawResponse, + ClientsResourceWithStreamingResponse, + AsyncClientsResourceWithStreamingResponse, +) +from .ip_info import ( + IPInfoResource, + AsyncIPInfoResource, + IPInfoResourceWithRawResponse, + AsyncIPInfoResourceWithRawResponse, + IPInfoResourceWithStreamingResponse, + AsyncIPInfoResourceWithStreamingResponse, +) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._compat import cached_property from .statistics import ( @@ -62,12 +78,16 @@ CustomPageSetsResourceWithStreamingResponse, AsyncCustomPageSetsResourceWithStreamingResponse, ) -from ...types.waap.client_info import ClientInfo +from ...types.waap.waap_get_account_overview_response import WaapGetAccountOverviewResponse __all__ = ["WaapResource", "AsyncWaapResource"] class WaapResource(SyncAPIResource): + @cached_property + def clients(self) -> ClientsResource: + return ClientsResource(self._client) + @cached_property def statistics(self) -> StatisticsResource: return StatisticsResource(self._client) @@ -92,6 +112,10 @@ def tags(self) -> TagsResource: def organizations(self) -> OrganizationsResource: return OrganizationsResource(self._client) + @cached_property + def ip_info(self) -> IPInfoResource: + return IPInfoResource(self._client) + @cached_property def with_raw_response(self) -> WaapResourceWithRawResponse: """ @@ -120,18 +144,22 @@ def get_account_overview( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ClientInfo: + ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return self._get( "/waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ClientInfo, + cast_to=WaapGetAccountOverviewResponse, ) class AsyncWaapResource(AsyncAPIResource): + @cached_property + def clients(self) -> AsyncClientsResource: + return AsyncClientsResource(self._client) + @cached_property def statistics(self) -> AsyncStatisticsResource: return AsyncStatisticsResource(self._client) @@ -156,6 +184,10 @@ def tags(self) -> AsyncTagsResource: def organizations(self) -> AsyncOrganizationsResource: return AsyncOrganizationsResource(self._client) + @cached_property + def ip_info(self) -> AsyncIPInfoResource: + return AsyncIPInfoResource(self._client) + @cached_property def with_raw_response(self) -> AsyncWaapResourceWithRawResponse: """ @@ -184,14 +216,14 @@ async def get_account_overview( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ClientInfo: + ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return await self._get( "/waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ClientInfo, + cast_to=WaapGetAccountOverviewResponse, ) @@ -203,6 +235,10 @@ def __init__(self, waap: WaapResource) -> None: waap.get_account_overview, ) + @cached_property + def clients(self) -> ClientsResourceWithRawResponse: + return ClientsResourceWithRawResponse(self._waap.clients) + @cached_property def statistics(self) -> StatisticsResourceWithRawResponse: return StatisticsResourceWithRawResponse(self._waap.statistics) @@ -227,6 +263,10 @@ def tags(self) -> TagsResourceWithRawResponse: def organizations(self) -> OrganizationsResourceWithRawResponse: return OrganizationsResourceWithRawResponse(self._waap.organizations) + @cached_property + def ip_info(self) -> IPInfoResourceWithRawResponse: + return IPInfoResourceWithRawResponse(self._waap.ip_info) + class AsyncWaapResourceWithRawResponse: def __init__(self, waap: AsyncWaapResource) -> None: @@ -236,6 +276,10 @@ def __init__(self, waap: AsyncWaapResource) -> None: waap.get_account_overview, ) + @cached_property + def clients(self) -> AsyncClientsResourceWithRawResponse: + return AsyncClientsResourceWithRawResponse(self._waap.clients) + @cached_property def statistics(self) -> AsyncStatisticsResourceWithRawResponse: return AsyncStatisticsResourceWithRawResponse(self._waap.statistics) @@ -260,6 +304,10 @@ def tags(self) -> AsyncTagsResourceWithRawResponse: def organizations(self) -> AsyncOrganizationsResourceWithRawResponse: return AsyncOrganizationsResourceWithRawResponse(self._waap.organizations) + @cached_property + def ip_info(self) -> AsyncIPInfoResourceWithRawResponse: + return AsyncIPInfoResourceWithRawResponse(self._waap.ip_info) + class WaapResourceWithStreamingResponse: def __init__(self, waap: WaapResource) -> None: @@ -269,6 +317,10 @@ def __init__(self, waap: WaapResource) -> None: waap.get_account_overview, ) + @cached_property + def clients(self) -> ClientsResourceWithStreamingResponse: + return ClientsResourceWithStreamingResponse(self._waap.clients) + @cached_property def statistics(self) -> StatisticsResourceWithStreamingResponse: return StatisticsResourceWithStreamingResponse(self._waap.statistics) @@ -293,6 +345,10 @@ def tags(self) -> TagsResourceWithStreamingResponse: def organizations(self) -> OrganizationsResourceWithStreamingResponse: return OrganizationsResourceWithStreamingResponse(self._waap.organizations) + @cached_property + def ip_info(self) -> IPInfoResourceWithStreamingResponse: + return IPInfoResourceWithStreamingResponse(self._waap.ip_info) + class AsyncWaapResourceWithStreamingResponse: def __init__(self, waap: AsyncWaapResource) -> None: @@ -302,6 +358,10 @@ def __init__(self, waap: AsyncWaapResource) -> None: waap.get_account_overview, ) + @cached_property + def clients(self) -> AsyncClientsResourceWithStreamingResponse: + return AsyncClientsResourceWithStreamingResponse(self._waap.clients) + @cached_property def statistics(self) -> AsyncStatisticsResourceWithStreamingResponse: return AsyncStatisticsResourceWithStreamingResponse(self._waap.statistics) @@ -325,3 +385,7 @@ def tags(self) -> AsyncTagsResourceWithStreamingResponse: @cached_property def organizations(self) -> AsyncOrganizationsResourceWithStreamingResponse: return AsyncOrganizationsResourceWithStreamingResponse(self._waap.organizations) + + @cached_property + def ip_info(self) -> AsyncIPInfoResourceWithStreamingResponse: + return AsyncIPInfoResourceWithStreamingResponse(self._waap.ip_info) diff --git a/src/gcore/types/waap/__init__.py b/src/gcore/types/waap/__init__.py index 25f3a6d4..f74ffde6 100644 --- a/src/gcore/types/waap/__init__.py +++ b/src/gcore/types/waap/__init__.py @@ -2,41 +2,107 @@ from __future__ import annotations -from .tag import Tag as Tag -from .quota_item import QuotaItem as QuotaItem -from .client_info import ClientInfo as ClientInfo -from .organization import Organization as Organization -from .statistic_item import StatisticItem as StatisticItem -from .block_page_data import BlockPageData as BlockPageData -from .custom_page_set import CustomPageSet as CustomPageSet +from .waap_tag import WaapTag as WaapTag +from .waap_insight import WaapInsight as WaapInsight +from .waap_ip_info import WaapIPInfo as WaapIPInfo +from .waap_top_url import WaapTopURL as WaapTopURL +from .waap_rule_set import WaapRuleSet as WaapRuleSet +from .waap_ddos_info import WaapDDOSInfo as WaapDDOSInfo +from .waap_page_type import WaapPageType as WaapPageType from .tag_list_params import TagListParams as TagListParams -from .rule_action_type import RuleActionType as RuleActionType -from .captcha_page_data import CaptchaPageData as CaptchaPageData -from .statistics_series import StatisticsSeries as StatisticsSeries +from .waap_common_tag import WaapCommonTag as WaapCommonTag +from .waap_resolution import WaapResolution as WaapResolution +from .waap_custom_rule import WaapCustomRule as WaapCustomRule +from .waap_ddos_attack import WaapDDOSAttack as WaapDDOSAttack +from .waap_policy_mode import WaapPolicyMode as WaapPolicyMode +from .waap_top_session import WaapTopSession as WaapTopSession +from .waap_organization import WaapOrganization as WaapOrganization +from .waap_traffic_type import WaapTrafficType as WaapTrafficType +from .client_me_response import ClientMeResponse as ClientMeResponse from .domain_list_params import DomainListParams as DomainListParams +from .ip_info_get_params import IPInfoGetParams as IPInfoGetParams +from .waap_advanced_rule import WaapAdvancedRule as WaapAdvancedRule +from .waap_domain_policy import WaapDomainPolicy as WaapDomainPolicy from .waap_domain_status import WaapDomainStatus as WaapDomainStatus -from .customer_rule_state import CustomerRuleState as CustomerRuleState -from .handshake_page_data import HandshakePageData as HandshakePageData -from .preview_custom_page import PreviewCustomPage as PreviewCustomPage +from .waap_firewall_rule import WaapFirewallRule as WaapFirewallRule +from .waap_policy_action import WaapPolicyAction as WaapPolicyAction +from .waap_insight_status import WaapInsightStatus as WaapInsightStatus +from .waap_ip_info_counts import WaapIPInfoCounts as WaapIPInfoCounts +from .waap_statistic_item import WaapStatisticItem as WaapStatisticItem from .waap_summary_domain import WaapSummaryDomain as WaapSummaryDomain -from .block_csrf_page_data import BlockCsrfPageData as BlockCsrfPageData +from .waap_top_user_agent import WaapTopUserAgent as WaapTopUserAgent from .domain_update_params import DomainUpdateParams as DomainUpdateParams +from .waap_block_page_data import WaapBlockPageData as WaapBlockPageData +from .waap_custom_page_set import WaapCustomPageSet as WaapCustomPageSet from .waap_detailed_domain import WaapDetailedDomain as WaapDetailedDomain -from .waap_domain_settings import WaapDomainSettings as WaapDomainSettings -from .block_page_data_param import BlockPageDataParam as BlockPageDataParam -from .captcha_page_data_param import CaptchaPageDataParam as CaptchaPageDataParam -from .advanced_rule_descriptor import AdvancedRuleDescriptor as AdvancedRuleDescriptor +from .waap_insight_silence import WaapInsightSilence as WaapInsightSilence +from .waap_insight_sort_by import WaapInsightSortBy as WaapInsightSortBy +from .waap_network_details import WaapNetworkDetails as WaapNetworkDetails +from .waap_request_details import WaapRequestDetails as WaapRequestDetails +from .waap_request_summary import WaapRequestSummary as WaapRequestSummary +from .waap_traffic_metrics import WaapTrafficMetrics as WaapTrafficMetrics +from .waap_count_statistics import WaapCountStatistics as WaapCountStatistics +from .waap_event_statistics import WaapEventStatistics as WaapEventStatistics +from .waap_rule_action_type import WaapRuleActionType as WaapRuleActionType +from .waap_captcha_page_data import WaapCaptchaPageData as WaapCaptchaPageData +from .waap_ip_country_attack import WaapIPCountryAttack as WaapIPCountryAttack +from .waap_statistics_series import WaapStatisticsSeries as WaapStatisticsSeries +from .waap_blocked_statistics import WaapBlockedStatistics as WaapBlockedStatistics +from .waap_ip_ddos_info_model import WaapIPDDOSInfoModel as WaapIPDDOSInfoModel +from .waap_time_series_attack import WaapTimeSeriesAttack as WaapTimeSeriesAttack +from .waap_user_agent_details import WaapUserAgentDetails as WaapUserAgentDetails from .organization_list_params import OrganizationListParams as OrganizationListParams -from .cookie_disabled_page_data import CookieDisabledPageData as CookieDisabledPageData -from .handshake_page_data_param import HandshakePageDataParam as HandshakePageDataParam +from .waap_custom_page_preview import WaapCustomPagePreview as WaapCustomPagePreview +from .waap_customer_rule_state import WaapCustomerRuleState as WaapCustomerRuleState +from .waap_domain_api_settings import WaapDomainAPISettings as WaapDomainAPISettings +from .waap_handshake_page_data import WaapHandshakePageData as WaapHandshakePageData +from .waap_paginated_ddos_info import WaapPaginatedDDOSInfo as WaapPaginatedDDOSInfo +from .waap_pattern_matched_tag import WaapPatternMatchedTag as WaapPatternMatchedTag +from .ip_info_get_counts_params import IPInfoGetCountsParams as IPInfoGetCountsParams +from .waap_block_csrf_page_data import WaapBlockCsrfPageData as WaapBlockCsrfPageData from .waap_domain_ddos_settings import WaapDomainDDOSSettings as WaapDomainDDOSSettings -from .block_csrf_page_data_param import BlockCsrfPageDataParam as BlockCsrfPageDataParam +from .waap_request_organization import WaapRequestOrganization as WaapRequestOrganization +from .waap_block_page_data_param import WaapBlockPageDataParam as WaapBlockPageDataParam +from .waap_domain_settings_model import WaapDomainSettingsModel as WaapDomainSettingsModel +from .waap_paginated_ddos_attack import WaapPaginatedDDOSAttack as WaapPaginatedDDOSAttack +from .waap_rule_blocked_requests import WaapRuleBlockedRequests as WaapRuleBlockedRequests from .custom_page_set_list_params import CustomPageSetListParams as CustomPageSetListParams -from .advanced_rule_descriptor_list import AdvancedRuleDescriptorList as AdvancedRuleDescriptorList +from .ip_info_get_top_urls_params import IPInfoGetTopURLsParams as IPInfoGetTopURLsParams +from .waap_captcha_page_data_param import WaapCaptchaPageDataParam as WaapCaptchaPageDataParam +from .waap_insight_silence_sort_by import WaapInsightSilenceSortBy as WaapInsightSilenceSortBy from .custom_page_set_create_params import CustomPageSetCreateParams as CustomPageSetCreateParams from .custom_page_set_update_params import CustomPageSetUpdateParams as CustomPageSetUpdateParams -from .javascript_disabled_page_data import JavascriptDisabledPageData as JavascriptDisabledPageData +from .ip_info_get_top_urls_response import IPInfoGetTopURLsResponse as IPInfoGetTopURLsResponse +from .waap_advanced_rule_descriptor import WaapAdvancedRuleDescriptor as WaapAdvancedRuleDescriptor from .custom_page_set_preview_params import CustomPageSetPreviewParams as CustomPageSetPreviewParams -from .cookie_disabled_page_data_param import CookieDisabledPageDataParam as CookieDisabledPageDataParam +from .domain_list_rule_sets_response import DomainListRuleSetsResponse as DomainListRuleSetsResponse +from .waap_cookie_disabled_page_data import WaapCookieDisabledPageData as WaapCookieDisabledPageData +from .waap_handshake_page_data_param import WaapHandshakePageDataParam as WaapHandshakePageDataParam +from .waap_paginated_custom_page_set import WaapPaginatedCustomPageSet as WaapPaginatedCustomPageSet +from .waap_paginated_request_summary import WaapPaginatedRequestSummary as WaapPaginatedRequestSummary +from .ip_info_get_top_sessions_params import IPInfoGetTopSessionsParams as IPInfoGetTopSessionsParams +from .waap_block_csrf_page_data_param import WaapBlockCsrfPageDataParam as WaapBlockCsrfPageDataParam +from .ip_info_get_top_sessions_response import IPInfoGetTopSessionsResponse as IPInfoGetTopSessionsResponse from .statistic_get_usage_series_params import StatisticGetUsageSeriesParams as StatisticGetUsageSeriesParams -from .javascript_disabled_page_data_param import JavascriptDisabledPageDataParam as JavascriptDisabledPageDataParam +from .ip_info_get_top_user_agents_params import IPInfoGetTopUserAgentsParams as IPInfoGetTopUserAgentsParams +from .waap_advanced_rule_descriptor_list import WaapAdvancedRuleDescriptorList as WaapAdvancedRuleDescriptorList +from .waap_get_account_overview_response import WaapGetAccountOverviewResponse as WaapGetAccountOverviewResponse +from .waap_javascript_disabled_page_data import WaapJavascriptDisabledPageData as WaapJavascriptDisabledPageData +from .ip_info_get_blocked_requests_params import IPInfoGetBlockedRequestsParams as IPInfoGetBlockedRequestsParams +from .ip_info_get_top_user_agents_response import IPInfoGetTopUserAgentsResponse as IPInfoGetTopUserAgentsResponse +from .waap_cookie_disabled_page_data_param import WaapCookieDisabledPageDataParam as WaapCookieDisabledPageDataParam +from .ip_info_get_attack_time_series_params import IPInfoGetAttackTimeSeriesParams as IPInfoGetAttackTimeSeriesParams +from .ip_info_get_blocked_requests_response import IPInfoGetBlockedRequestsResponse as IPInfoGetBlockedRequestsResponse +from .ip_info_get_ddos_attack_series_params import IPInfoGetDDOSAttackSeriesParams as IPInfoGetDDOSAttackSeriesParams +from .ip_info_list_attacked_countries_params import ( + IPInfoListAttackedCountriesParams as IPInfoListAttackedCountriesParams, +) +from .ip_info_get_attack_time_series_response import ( + IPInfoGetAttackTimeSeriesResponse as IPInfoGetAttackTimeSeriesResponse, +) +from .ip_info_list_attacked_countries_response import ( + IPInfoListAttackedCountriesResponse as IPInfoListAttackedCountriesResponse, +) +from .waap_javascript_disabled_page_data_param import ( + WaapJavascriptDisabledPageDataParam as WaapJavascriptDisabledPageDataParam, +) diff --git a/src/gcore/types/waap/advanced_rule_descriptor_list.py b/src/gcore/types/waap/advanced_rule_descriptor_list.py deleted file mode 100644 index 3842ae7d..00000000 --- a/src/gcore/types/waap/advanced_rule_descriptor_list.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel -from .advanced_rule_descriptor import AdvancedRuleDescriptor - -__all__ = ["AdvancedRuleDescriptorList"] - - -class AdvancedRuleDescriptorList(BaseModel): - version: str - """The descriptor's version""" - - objects: Optional[List[AdvancedRuleDescriptor]] = None diff --git a/src/gcore/types/waap/client_info.py b/src/gcore/types/waap/client_me_response.py similarity index 62% rename from src/gcore/types/waap/client_info.py rename to src/gcore/types/waap/client_me_response.py index 988447cf..15310d16 100644 --- a/src/gcore/types/waap/client_info.py +++ b/src/gcore/types/waap/client_me_response.py @@ -3,9 +3,16 @@ from typing import Dict, List, Optional from ..._models import BaseModel -from .quota_item import QuotaItem -__all__ = ["ClientInfo", "Service"] +__all__ = ["ClientMeResponse", "Quotas", "Service"] + + +class Quotas(BaseModel): + allowed: int + """The maximum allowed number of this resource""" + + current: int + """The current number of this resource""" class Service(BaseModel): @@ -13,14 +20,14 @@ class Service(BaseModel): """Whether the service is enabled""" -class ClientInfo(BaseModel): +class ClientMeResponse(BaseModel): id: Optional[int] = None """The client ID""" features: List[str] """List of enabled features""" - quotas: Dict[str, QuotaItem] + quotas: Dict[str, Quotas] """Quotas for the client""" service: Service diff --git a/src/gcore/types/waap/custom_page_set.py b/src/gcore/types/waap/custom_page_set.py deleted file mode 100644 index e8b26ae9..00000000 --- a/src/gcore/types/waap/custom_page_set.py +++ /dev/null @@ -1,36 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel -from .block_page_data import BlockPageData -from .captcha_page_data import CaptchaPageData -from .handshake_page_data import HandshakePageData -from .block_csrf_page_data import BlockCsrfPageData -from .cookie_disabled_page_data import CookieDisabledPageData -from .javascript_disabled_page_data import JavascriptDisabledPageData - -__all__ = ["CustomPageSet"] - - -class CustomPageSet(BaseModel): - id: int - """The ID of the custom page set""" - - name: str - """Name of the custom page set""" - - block: Optional[BlockPageData] = None - - block_csrf: Optional[BlockCsrfPageData] = None - - captcha: Optional[CaptchaPageData] = None - - cookie_disabled: Optional[CookieDisabledPageData] = None - - domains: Optional[List[int]] = None - """List of domain IDs that are associated with this page set""" - - handshake: Optional[HandshakePageData] = None - - javascript_disabled: Optional[JavascriptDisabledPageData] = None diff --git a/src/gcore/types/waap/custom_page_set_create_params.py b/src/gcore/types/waap/custom_page_set_create_params.py index 9ac2b9a8..d23bfa30 100644 --- a/src/gcore/types/waap/custom_page_set_create_params.py +++ b/src/gcore/types/waap/custom_page_set_create_params.py @@ -5,12 +5,12 @@ from typing import Iterable, Optional from typing_extensions import Required, TypedDict -from .block_page_data_param import BlockPageDataParam -from .captcha_page_data_param import CaptchaPageDataParam -from .handshake_page_data_param import HandshakePageDataParam -from .block_csrf_page_data_param import BlockCsrfPageDataParam -from .cookie_disabled_page_data_param import CookieDisabledPageDataParam -from .javascript_disabled_page_data_param import JavascriptDisabledPageDataParam +from .waap_block_page_data_param import WaapBlockPageDataParam +from .waap_captcha_page_data_param import WaapCaptchaPageDataParam +from .waap_handshake_page_data_param import WaapHandshakePageDataParam +from .waap_block_csrf_page_data_param import WaapBlockCsrfPageDataParam +from .waap_cookie_disabled_page_data_param import WaapCookieDisabledPageDataParam +from .waap_javascript_disabled_page_data_param import WaapJavascriptDisabledPageDataParam __all__ = ["CustomPageSetCreateParams"] @@ -19,17 +19,17 @@ class CustomPageSetCreateParams(TypedDict, total=False): name: Required[str] """Name of the custom page set""" - block: Optional[BlockPageDataParam] + block: Optional[WaapBlockPageDataParam] - block_csrf: Optional[BlockCsrfPageDataParam] + block_csrf: Optional[WaapBlockCsrfPageDataParam] - captcha: Optional[CaptchaPageDataParam] + captcha: Optional[WaapCaptchaPageDataParam] - cookie_disabled: Optional[CookieDisabledPageDataParam] + cookie_disabled: Optional[WaapCookieDisabledPageDataParam] domains: Optional[Iterable[int]] """List of domain IDs that are associated with this page set""" - handshake: Optional[HandshakePageDataParam] + handshake: Optional[WaapHandshakePageDataParam] - javascript_disabled: Optional[JavascriptDisabledPageDataParam] + javascript_disabled: Optional[WaapJavascriptDisabledPageDataParam] diff --git a/src/gcore/types/waap/custom_page_set_preview_params.py b/src/gcore/types/waap/custom_page_set_preview_params.py index 158b1a3a..668442b9 100644 --- a/src/gcore/types/waap/custom_page_set_preview_params.py +++ b/src/gcore/types/waap/custom_page_set_preview_params.py @@ -3,22 +3,15 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict + +from .waap_page_type import WaapPageType __all__ = ["CustomPageSetPreviewParams"] class CustomPageSetPreviewParams(TypedDict, total=False): - page_type: Required[ - Literal[ - "block.html", - "block_csrf.html", - "captcha.html", - "cookieDisabled.html", - "handshake.html", - "javascriptDisabled.html", - ] - ] + page_type: Required[WaapPageType] """The type of the custom page""" error: Optional[str] diff --git a/src/gcore/types/waap/custom_page_set_update_params.py b/src/gcore/types/waap/custom_page_set_update_params.py index 2547532d..ca08a24a 100644 --- a/src/gcore/types/waap/custom_page_set_update_params.py +++ b/src/gcore/types/waap/custom_page_set_update_params.py @@ -5,31 +5,31 @@ from typing import Iterable, Optional from typing_extensions import TypedDict -from .block_page_data_param import BlockPageDataParam -from .captcha_page_data_param import CaptchaPageDataParam -from .handshake_page_data_param import HandshakePageDataParam -from .block_csrf_page_data_param import BlockCsrfPageDataParam -from .cookie_disabled_page_data_param import CookieDisabledPageDataParam -from .javascript_disabled_page_data_param import JavascriptDisabledPageDataParam +from .waap_block_page_data_param import WaapBlockPageDataParam +from .waap_captcha_page_data_param import WaapCaptchaPageDataParam +from .waap_handshake_page_data_param import WaapHandshakePageDataParam +from .waap_block_csrf_page_data_param import WaapBlockCsrfPageDataParam +from .waap_cookie_disabled_page_data_param import WaapCookieDisabledPageDataParam +from .waap_javascript_disabled_page_data_param import WaapJavascriptDisabledPageDataParam __all__ = ["CustomPageSetUpdateParams"] class CustomPageSetUpdateParams(TypedDict, total=False): - block: Optional[BlockPageDataParam] + block: Optional[WaapBlockPageDataParam] - block_csrf: Optional[BlockCsrfPageDataParam] + block_csrf: Optional[WaapBlockCsrfPageDataParam] - captcha: Optional[CaptchaPageDataParam] + captcha: Optional[WaapCaptchaPageDataParam] - cookie_disabled: Optional[CookieDisabledPageDataParam] + cookie_disabled: Optional[WaapCookieDisabledPageDataParam] domains: Optional[Iterable[int]] """List of domain IDs that are associated with this page set""" - handshake: Optional[HandshakePageDataParam] + handshake: Optional[WaapHandshakePageDataParam] - javascript_disabled: Optional[JavascriptDisabledPageDataParam] + javascript_disabled: Optional[WaapJavascriptDisabledPageDataParam] name: Optional[str] """Name of the custom page set""" diff --git a/src/gcore/types/waap/domain_list_rule_sets_response.py b/src/gcore/types/waap/domain_list_rule_sets_response.py new file mode 100644 index 00000000..3a82e138 --- /dev/null +++ b/src/gcore/types/waap/domain_list_rule_sets_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .waap_rule_set import WaapRuleSet + +__all__ = ["DomainListRuleSetsResponse"] + +DomainListRuleSetsResponse: TypeAlias = List[WaapRuleSet] diff --git a/src/gcore/types/waap/domains/__init__.py b/src/gcore/types/waap/domains/__init__.py index 181d3ca6..396e620d 100644 --- a/src/gcore/types/waap/domains/__init__.py +++ b/src/gcore/types/waap/domains/__init__.py @@ -2,11 +2,16 @@ from __future__ import annotations -from .custom_rule import CustomRule as CustomRule -from .advanced_rule import AdvancedRule as AdvancedRule -from .firewall_rule import FirewallRule as FirewallRule +from .insight_list_params import InsightListParams as InsightListParams +from .api_path_list_params import APIPathListParams as APIPathListParams +from .api_path_get_response import APIPathGetResponse as APIPathGetResponse from .setting_update_params import SettingUpdateParams as SettingUpdateParams +from .api_path_create_params import APIPathCreateParams as APIPathCreateParams +from .api_path_list_response import APIPathListResponse as APIPathListResponse +from .api_path_update_params import APIPathUpdateParams as APIPathUpdateParams +from .insight_replace_params import InsightReplaceParams as InsightReplaceParams from .custom_rule_list_params import CustomRuleListParams as CustomRuleListParams +from .api_path_create_response import APIPathCreateResponse as APIPathCreateResponse from .advanced_rule_list_params import AdvancedRuleListParams as AdvancedRuleListParams from .custom_rule_create_params import CustomRuleCreateParams as CustomRuleCreateParams from .custom_rule_update_params import CustomRuleUpdateParams as CustomRuleUpdateParams @@ -15,5 +20,28 @@ from .advanced_rule_update_params import AdvancedRuleUpdateParams as AdvancedRuleUpdateParams from .firewall_rule_create_params import FirewallRuleCreateParams as FirewallRuleCreateParams from .firewall_rule_update_params import FirewallRuleUpdateParams as FirewallRuleUpdateParams +from .insight_silence_list_params import InsightSilenceListParams as InsightSilenceListParams +from .api_path_group_list_response import APIPathGroupListResponse as APIPathGroupListResponse +from .insight_silence_create_params import InsightSilenceCreateParams as InsightSilenceCreateParams +from .insight_silence_update_params import InsightSilenceUpdateParams as InsightSilenceUpdateParams +from .analytics_list_ddos_info_params import AnalyticsListDDOSInfoParams as AnalyticsListDDOSInfoParams +from .analytics_list_ddos_attacks_params import AnalyticsListDDOSAttacksParams as AnalyticsListDDOSAttacksParams from .custom_rule_delete_multiple_params import CustomRuleDeleteMultipleParams as CustomRuleDeleteMultipleParams +from .analytics_list_event_traffic_params import AnalyticsListEventTrafficParams as AnalyticsListEventTrafficParams +from .api_discovery_get_settings_response import APIDiscoveryGetSettingsResponse as APIDiscoveryGetSettingsResponse +from .api_discovery_scan_openapi_response import APIDiscoveryScanOpenAPIResponse as APIDiscoveryScanOpenAPIResponse +from .api_discovery_upload_openapi_params import APIDiscoveryUploadOpenAPIParams as APIDiscoveryUploadOpenAPIParams +from .api_discovery_update_settings_params import APIDiscoveryUpdateSettingsParams as APIDiscoveryUpdateSettingsParams from .firewall_rule_delete_multiple_params import FirewallRuleDeleteMultipleParams as FirewallRuleDeleteMultipleParams +from .analytics_get_event_statistics_params import ( + AnalyticsGetEventStatisticsParams as AnalyticsGetEventStatisticsParams, +) +from .analytics_list_event_traffic_response import ( + AnalyticsListEventTrafficResponse as AnalyticsListEventTrafficResponse, +) +from .api_discovery_upload_openapi_response import ( + APIDiscoveryUploadOpenAPIResponse as APIDiscoveryUploadOpenAPIResponse, +) +from .api_discovery_update_settings_response import ( + APIDiscoveryUpdateSettingsResponse as APIDiscoveryUpdateSettingsResponse, +) diff --git a/src/gcore/types/waap/domains/advanced_rule_list_params.py b/src/gcore/types/waap/domains/advanced_rule_list_params.py index efb65e9e..32541fae 100644 --- a/src/gcore/types/waap/domains/advanced_rule_list_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_list_params.py @@ -5,13 +5,13 @@ from typing import Optional from typing_extensions import Literal, TypedDict -from ..rule_action_type import RuleActionType +from ..waap_rule_action_type import WaapRuleActionType __all__ = ["AdvancedRuleListParams"] class AdvancedRuleListParams(TypedDict, total=False): - action: RuleActionType + action: WaapRuleActionType """Filter to refine results by specific actions""" description: str diff --git a/src/gcore/types/waap/domains/analytics/__init__.py b/src/gcore/types/waap/domains/analytics/__init__.py new file mode 100644 index 00000000..b321e43b --- /dev/null +++ b/src/gcore/types/waap/domains/analytics/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .request_list_params import RequestListParams as RequestListParams diff --git a/src/gcore/types/waap/domains/analytics/request_list_params.py b/src/gcore/types/waap/domains/analytics/request_list_params.py new file mode 100644 index 00000000..32df05dc --- /dev/null +++ b/src/gcore/types/waap/domains/analytics/request_list_params.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ....._utils import PropertyInfo +from ...waap_traffic_type import WaapTrafficType + +__all__ = ["RequestListParams"] + + +class RequestListParams(TypedDict, total=False): + start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """Filter traffic starting from a specified date in ISO 8601 format""" + + actions: List[Literal["allow", "block", "captcha", "handshake"]] + """Filter the response by actions.""" + + countries: List[str] + """Filter the response by country codes in ISO 3166-1 alpha-2 format.""" + + end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Filter traffic up to a specified end date in ISO 8601 format. + + If not provided, defaults to the current date and time. + """ + + ip: str + """Filter the response by IP.""" + + limit: int + """Number of items to return""" + + offset: int + """Number of items to skip""" + + ordering: str + """Sort the response by given field.""" + + reference_id: str + """Filter the response by reference ID.""" + + security_rule_name: str + """Filter the response by security rule name.""" + + status_code: int + """Filter the response by response code.""" + + traffic_types: List[WaapTrafficType] + """Filter the response by traffic types.""" diff --git a/src/gcore/types/waap/domains/analytics_get_event_statistics_params.py b/src/gcore/types/waap/domains/analytics_get_event_statistics_params.py new file mode 100644 index 00000000..d3a32dfb --- /dev/null +++ b/src/gcore/types/waap/domains/analytics_get_event_statistics_params.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["AnalyticsGetEventStatisticsParams"] + + +class AnalyticsGetEventStatisticsParams(TypedDict, total=False): + start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """Filter traffic starting from a specified date in ISO 8601 format""" + + action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] + """A list of action names to filter on.""" + + end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Filter traffic up to a specified end date in ISO 8601 format. + + If not provided, defaults to the current date and time. + """ + + ip: Optional[List[str]] + """A list of IPs to filter event statistics.""" + + reference_id: Optional[List[str]] + """A list of reference IDs to filter event statistics.""" + + result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] + """A list of results to filter event statistics.""" diff --git a/src/gcore/types/waap/domains/analytics_list_ddos_attacks_params.py b/src/gcore/types/waap/domains/analytics_list_ddos_attacks_params.py new file mode 100644 index 00000000..b1a39e3a --- /dev/null +++ b/src/gcore/types/waap/domains/analytics_list_ddos_attacks_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["AnalyticsListDDOSAttacksParams"] + + +class AnalyticsListDDOSAttacksParams(TypedDict, total=False): + end_time: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """Filter attacks up to a specified end date in ISO 8601 format""" + + limit: int + """Number of items to return""" + + offset: int + """Number of items to skip""" + + ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] + """Sort the response by given field.""" + + start_time: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """Filter attacks starting from a specified date in ISO 8601 format""" diff --git a/src/gcore/types/waap/domains/analytics_list_ddos_info_params.py b/src/gcore/types/waap/domains/analytics_list_ddos_info_params.py new file mode 100644 index 00000000..d6d1246d --- /dev/null +++ b/src/gcore/types/waap/domains/analytics_list_ddos_info_params.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["AnalyticsListDDOSInfoParams"] + + +class AnalyticsListDDOSInfoParams(TypedDict, total=False): + group_by: Required[Literal["URL", "User-Agent", "IP"]] + """The identity of the requests to group by""" + + start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """Filter traffic starting from a specified date in ISO 8601 format""" + + end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Filter traffic up to a specified end date in ISO 8601 format. + + If not provided, defaults to the current date and time. + """ + + limit: int + """Number of items to return""" + + offset: int + """Number of items to skip""" diff --git a/src/gcore/types/waap/domains/analytics_list_event_traffic_params.py b/src/gcore/types/waap/domains/analytics_list_event_traffic_params.py new file mode 100644 index 00000000..af582492 --- /dev/null +++ b/src/gcore/types/waap/domains/analytics_list_event_traffic_params.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo +from ..waap_resolution import WaapResolution + +__all__ = ["AnalyticsListEventTrafficParams"] + + +class AnalyticsListEventTrafficParams(TypedDict, total=False): + resolution: Required[WaapResolution] + """Specifies the granularity of the result data.""" + + start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """Filter traffic starting from a specified date in ISO 8601 format""" + + end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Filter traffic up to a specified end date in ISO 8601 format. + + If not provided, defaults to the current date and time. + """ diff --git a/src/gcore/types/waap/domains/analytics_list_event_traffic_response.py b/src/gcore/types/waap/domains/analytics_list_event_traffic_response.py new file mode 100644 index 00000000..901d6f4e --- /dev/null +++ b/src/gcore/types/waap/domains/analytics_list_event_traffic_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from ..waap_traffic_metrics import WaapTrafficMetrics + +__all__ = ["AnalyticsListEventTrafficResponse"] + +AnalyticsListEventTrafficResponse: TypeAlias = List[WaapTrafficMetrics] diff --git a/src/gcore/types/waap/domains/api_discovery/__init__.py b/src/gcore/types/waap/domains/api_discovery/__init__.py new file mode 100644 index 00000000..15260eb6 --- /dev/null +++ b/src/gcore/types/waap/domains/api_discovery/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .scan_result_list_params import ScanResultListParams as ScanResultListParams +from .scan_result_get_response import ScanResultGetResponse as ScanResultGetResponse +from .scan_result_list_response import ScanResultListResponse as ScanResultListResponse diff --git a/src/gcore/types/waap/domains/api_discovery/scan_result_get_response.py b/src/gcore/types/waap/domains/api_discovery/scan_result_get_response.py new file mode 100644 index 00000000..18b5bf69 --- /dev/null +++ b/src/gcore/types/waap/domains/api_discovery/scan_result_get_response.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["ScanResultGetResponse"] + + +class ScanResultGetResponse(BaseModel): + id: str + """The scan ID""" + + end_time: Optional[datetime] = None + """The date and time the scan ended""" + + message: str + """The message associated with the scan""" + + start_time: datetime + """The date and time the scan started""" + + status: Literal["SUCCESS", "FAILURE", "IN_PROGRESS"] + """The different statuses a task result can have""" + + type: Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"] + """The different types of scans that can be performed""" diff --git a/src/gcore/types/waap/domains/api_discovery/scan_result_list_params.py b/src/gcore/types/waap/domains/api_discovery/scan_result_list_params.py new file mode 100644 index 00000000..5909c8a8 --- /dev/null +++ b/src/gcore/types/waap/domains/api_discovery/scan_result_list_params.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["ScanResultListParams"] + + +class ScanResultListParams(TypedDict, total=False): + limit: int + """Number of items to return""" + + message: Optional[str] + """Filter by the message of the scan. Supports '\\**' as a wildcard character""" + + offset: int + """Number of items to skip""" + + ordering: Literal[ + "id", + "type", + "start_time", + "end_time", + "status", + "message", + "-id", + "-type", + "-start_time", + "-end_time", + "-status", + "-message", + ] + """Sort the response by given field.""" + + status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] + """The different statuses a task result can have""" + + type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] + """The different types of scans that can be performed""" diff --git a/src/gcore/types/waap/domains/api_discovery/scan_result_list_response.py b/src/gcore/types/waap/domains/api_discovery/scan_result_list_response.py new file mode 100644 index 00000000..81ec6ce9 --- /dev/null +++ b/src/gcore/types/waap/domains/api_discovery/scan_result_list_response.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["ScanResultListResponse"] + + +class ScanResultListResponse(BaseModel): + id: str + """The scan ID""" + + end_time: Optional[datetime] = None + """The date and time the scan ended""" + + message: str + """The message associated with the scan""" + + start_time: datetime + """The date and time the scan started""" + + status: Literal["SUCCESS", "FAILURE", "IN_PROGRESS"] + """The different statuses a task result can have""" + + type: Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"] + """The different types of scans that can be performed""" diff --git a/src/gcore/types/waap/domains/api_discovery_get_settings_response.py b/src/gcore/types/waap/domains/api_discovery_get_settings_response.py new file mode 100644 index 00000000..8150c267 --- /dev/null +++ b/src/gcore/types/waap/domains/api_discovery_get_settings_response.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["APIDiscoveryGetSettingsResponse"] + + +class APIDiscoveryGetSettingsResponse(BaseModel): + description_file_location: Optional[str] = FieldInfo(alias="descriptionFileLocation", default=None) + """The URL of the API description file. + + This will be periodically scanned if `descriptionFileScanEnabled` is enabled. + Supported formats are YAML and JSON, and it must adhere to OpenAPI versions 2, + 3, or 3.1. + """ + + description_file_scan_enabled: Optional[bool] = FieldInfo(alias="descriptionFileScanEnabled", default=None) + """Indicates if periodic scan of the description file is enabled""" + + description_file_scan_interval_hours: Optional[int] = FieldInfo( + alias="descriptionFileScanIntervalHours", default=None + ) + """The interval in hours for scanning the description file""" + + traffic_scan_enabled: Optional[bool] = FieldInfo(alias="trafficScanEnabled", default=None) + """Indicates if traffic scan is enabled. + + Traffic scan is used to discover undocumented APIs + """ + + traffic_scan_interval_hours: Optional[int] = FieldInfo(alias="trafficScanIntervalHours", default=None) + """The interval in hours for scanning the traffic""" diff --git a/src/gcore/types/waap/domains/api_discovery_scan_openapi_response.py b/src/gcore/types/waap/domains/api_discovery_scan_openapi_response.py new file mode 100644 index 00000000..3b719073 --- /dev/null +++ b/src/gcore/types/waap/domains/api_discovery_scan_openapi_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["APIDiscoveryScanOpenAPIResponse"] + + +class APIDiscoveryScanOpenAPIResponse(BaseModel): + id: str + """The task ID""" diff --git a/src/gcore/types/waap/domains/api_discovery_update_settings_params.py b/src/gcore/types/waap/domains/api_discovery_update_settings_params.py new file mode 100644 index 00000000..3274d926 --- /dev/null +++ b/src/gcore/types/waap/domains/api_discovery_update_settings_params.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["APIDiscoveryUpdateSettingsParams"] + + +class APIDiscoveryUpdateSettingsParams(TypedDict, total=False): + description_file_location: Annotated[Optional[str], PropertyInfo(alias="descriptionFileLocation")] + """The URL of the API description file. + + This will be periodically scanned if `descriptionFileScanEnabled` is enabled. + Supported formats are YAML and JSON, and it must adhere to OpenAPI versions 2, + 3, or 3.1. + """ + + description_file_scan_enabled: Annotated[Optional[bool], PropertyInfo(alias="descriptionFileScanEnabled")] + """Indicates if periodic scan of the description file is enabled""" + + description_file_scan_interval_hours: Annotated[ + Optional[int], PropertyInfo(alias="descriptionFileScanIntervalHours") + ] + """The interval in hours for scanning the description file""" + + traffic_scan_enabled: Annotated[Optional[bool], PropertyInfo(alias="trafficScanEnabled")] + """Indicates if traffic scan is enabled""" + + traffic_scan_interval_hours: Annotated[Optional[int], PropertyInfo(alias="trafficScanIntervalHours")] + """The interval in hours for scanning the traffic""" diff --git a/src/gcore/types/waap/domains/api_discovery_update_settings_response.py b/src/gcore/types/waap/domains/api_discovery_update_settings_response.py new file mode 100644 index 00000000..6663e47d --- /dev/null +++ b/src/gcore/types/waap/domains/api_discovery_update_settings_response.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["APIDiscoveryUpdateSettingsResponse"] + + +class APIDiscoveryUpdateSettingsResponse(BaseModel): + description_file_location: Optional[str] = FieldInfo(alias="descriptionFileLocation", default=None) + """The URL of the API description file. + + This will be periodically scanned if `descriptionFileScanEnabled` is enabled. + Supported formats are YAML and JSON, and it must adhere to OpenAPI versions 2, + 3, or 3.1. + """ + + description_file_scan_enabled: Optional[bool] = FieldInfo(alias="descriptionFileScanEnabled", default=None) + """Indicates if periodic scan of the description file is enabled""" + + description_file_scan_interval_hours: Optional[int] = FieldInfo( + alias="descriptionFileScanIntervalHours", default=None + ) + """The interval in hours for scanning the description file""" + + traffic_scan_enabled: Optional[bool] = FieldInfo(alias="trafficScanEnabled", default=None) + """Indicates if traffic scan is enabled. + + Traffic scan is used to discover undocumented APIs + """ + + traffic_scan_interval_hours: Optional[int] = FieldInfo(alias="trafficScanIntervalHours", default=None) + """The interval in hours for scanning the traffic""" diff --git a/src/gcore/types/waap/domains/api_discovery_upload_openapi_params.py b/src/gcore/types/waap/domains/api_discovery_upload_openapi_params.py new file mode 100644 index 00000000..0bf87add --- /dev/null +++ b/src/gcore/types/waap/domains/api_discovery_upload_openapi_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_extensions import Required, TypedDict + +__all__ = ["APIDiscoveryUploadOpenAPIParams"] + + +class APIDiscoveryUploadOpenAPIParams(TypedDict, total=False): + file_data: Required[str] + """Base64 representation of the description file. + + Supported formats are YAML and JSON, and it must adhere to OpenAPI versions 2, + 3, or 3.1. + """ + + file_name: Required[str] + """The name of the file""" diff --git a/src/gcore/types/waap/domains/api_discovery_upload_openapi_response.py b/src/gcore/types/waap/domains/api_discovery_upload_openapi_response.py new file mode 100644 index 00000000..718569a8 --- /dev/null +++ b/src/gcore/types/waap/domains/api_discovery_upload_openapi_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["APIDiscoveryUploadOpenAPIResponse"] + + +class APIDiscoveryUploadOpenAPIResponse(BaseModel): + id: str + """The task ID""" diff --git a/src/gcore/types/waap/domains/api_path_create_params.py b/src/gcore/types/waap/domains/api_path_create_params.py new file mode 100644 index 00000000..59bd8cb2 --- /dev/null +++ b/src/gcore/types/waap/domains/api_path_create_params.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["APIPathCreateParams"] + + +class APIPathCreateParams(TypedDict, total=False): + http_scheme: Required[Literal["HTTP", "HTTPS"]] + """The different HTTP schemes an API path can have""" + + method: Required[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] + """The different methods an API path can have""" + + path: Required[str] + """ + The API path, locations that are saved for resource IDs will be put in curly + brackets + """ + + api_groups: List[str] + """An array of api groups associated with the API path""" + + api_version: str + """The API version""" + + tags: List[str] + """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/api_path_create_response.py b/src/gcore/types/waap/domains/api_path_create_response.py new file mode 100644 index 00000000..2c51e410 --- /dev/null +++ b/src/gcore/types/waap/domains/api_path_create_response.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["APIPathCreateResponse"] + + +class APIPathCreateResponse(BaseModel): + id: str + """The path ID""" + + api_groups: List[str] + """An array of api groups associated with the API path""" + + api_version: str + """The API version""" + + first_detected: datetime + """The date and time in ISO 8601 format the API path was first detected.""" + + http_scheme: Literal["HTTP", "HTTPS"] + """The different HTTP schemes an API path can have""" + + last_detected: datetime + """The date and time in ISO 8601 format the API path was last detected.""" + + method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"] + """The different methods an API path can have""" + + path: str + """ + The API path, locations that are saved for resource IDs will be put in curly + brackets + """ + + request_count: int + """The number of requests for this path in the last 24 hours""" + + source: Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"] + """The different sources an API path can have""" + + status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] + """The different statuses an API path can have""" + + tags: List[str] + """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/api_path_get_response.py b/src/gcore/types/waap/domains/api_path_get_response.py new file mode 100644 index 00000000..600dfb44 --- /dev/null +++ b/src/gcore/types/waap/domains/api_path_get_response.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["APIPathGetResponse"] + + +class APIPathGetResponse(BaseModel): + id: str + """The path ID""" + + api_groups: List[str] + """An array of api groups associated with the API path""" + + api_version: str + """The API version""" + + first_detected: datetime + """The date and time in ISO 8601 format the API path was first detected.""" + + http_scheme: Literal["HTTP", "HTTPS"] + """The different HTTP schemes an API path can have""" + + last_detected: datetime + """The date and time in ISO 8601 format the API path was last detected.""" + + method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"] + """The different methods an API path can have""" + + path: str + """ + The API path, locations that are saved for resource IDs will be put in curly + brackets + """ + + request_count: int + """The number of requests for this path in the last 24 hours""" + + source: Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"] + """The different sources an API path can have""" + + status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] + """The different statuses an API path can have""" + + tags: List[str] + """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/api_path_group_list_response.py b/src/gcore/types/waap/domains/api_path_group_list_response.py new file mode 100644 index 00000000..959c76c1 --- /dev/null +++ b/src/gcore/types/waap/domains/api_path_group_list_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel + +__all__ = ["APIPathGroupListResponse"] + + +class APIPathGroupListResponse(BaseModel): + api_path_groups: List[str] + """An array of api groups associated with the API path""" diff --git a/src/gcore/types/waap/domains/api_path_list_params.py b/src/gcore/types/waap/domains/api_path_list_params.py new file mode 100644 index 00000000..31d1e176 --- /dev/null +++ b/src/gcore/types/waap/domains/api_path_list_params.py @@ -0,0 +1,62 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["APIPathListParams"] + + +class APIPathListParams(TypedDict, total=False): + api_group: Optional[str] + """Filter by the API group associated with the API path""" + + api_version: Optional[str] + """Filter by the API version""" + + http_scheme: Optional[Literal["HTTP", "HTTPS"]] + """The different HTTP schemes an API path can have""" + + ids: Optional[List[str]] + """Filter by the path ID""" + + limit: int + """Number of items to return""" + + method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] + """The different methods an API path can have""" + + offset: int + """Number of items to skip""" + + ordering: Literal[ + "id", + "path", + "method", + "api_version", + "http_scheme", + "first_detected", + "last_detected", + "status", + "source", + "-id", + "-path", + "-method", + "-api_version", + "-http_scheme", + "-first_detected", + "-last_detected", + "-status", + "-source", + ] + """Sort the response by given field.""" + + path: Optional[str] + """Filter by the path. Supports '\\**' as a wildcard character""" + + source: Optional[Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"]] + """The different sources an API path can have""" + + status: Optional[List[Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"]]] + """Filter by the status of the discovered API path""" diff --git a/src/gcore/types/waap/domains/api_path_list_response.py b/src/gcore/types/waap/domains/api_path_list_response.py new file mode 100644 index 00000000..49467f2e --- /dev/null +++ b/src/gcore/types/waap/domains/api_path_list_response.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["APIPathListResponse"] + + +class APIPathListResponse(BaseModel): + id: str + """The path ID""" + + api_groups: List[str] + """An array of api groups associated with the API path""" + + api_version: str + """The API version""" + + first_detected: datetime + """The date and time in ISO 8601 format the API path was first detected.""" + + http_scheme: Literal["HTTP", "HTTPS"] + """The different HTTP schemes an API path can have""" + + last_detected: datetime + """The date and time in ISO 8601 format the API path was last detected.""" + + method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"] + """The different methods an API path can have""" + + path: str + """ + The API path, locations that are saved for resource IDs will be put in curly + brackets + """ + + request_count: int + """The number of requests for this path in the last 24 hours""" + + source: Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"] + """The different sources an API path can have""" + + status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] + """The different statuses an API path can have""" + + tags: List[str] + """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/api_path_update_params.py b/src/gcore/types/waap/domains/api_path_update_params.py new file mode 100644 index 00000000..fcd2f8de --- /dev/null +++ b/src/gcore/types/waap/domains/api_path_update_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["APIPathUpdateParams"] + + +class APIPathUpdateParams(TypedDict, total=False): + domain_id: Required[int] + """The domain ID""" + + api_groups: List[str] + """An array of api groups associated with the API path""" + + path: str + """The updated API path. + + When updating the path, variables can be renamed, path parts can be converted to + variables and vice versa. + """ + + status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] + """The different statuses an API path can have""" + + tags: List[str] + """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/custom_rule_list_params.py b/src/gcore/types/waap/domains/custom_rule_list_params.py index e1761e64..3c3dd780 100644 --- a/src/gcore/types/waap/domains/custom_rule_list_params.py +++ b/src/gcore/types/waap/domains/custom_rule_list_params.py @@ -5,13 +5,13 @@ from typing import Optional from typing_extensions import Literal, TypedDict -from ..rule_action_type import RuleActionType +from ..waap_rule_action_type import WaapRuleActionType __all__ = ["CustomRuleListParams"] class CustomRuleListParams(TypedDict, total=False): - action: RuleActionType + action: WaapRuleActionType """Filter to refine results by specific actions""" description: str diff --git a/src/gcore/types/waap/domains/insight_list_params.py b/src/gcore/types/waap/domains/insight_list_params.py new file mode 100644 index 00000000..669c37ef --- /dev/null +++ b/src/gcore/types/waap/domains/insight_list_params.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import TypedDict + +from ..waap_insight_status import WaapInsightStatus +from ..waap_insight_sort_by import WaapInsightSortBy + +__all__ = ["InsightListParams"] + + +class InsightListParams(TypedDict, total=False): + id: Optional[List[str]] + """The ID of the insight""" + + description: Optional[str] + """The description of the insight. Supports '\\**' as a wildcard.""" + + insight_type: Optional[List[str]] + """The type of the insight""" + + limit: int + """Number of items to return""" + + offset: int + """Number of items to skip""" + + ordering: WaapInsightSortBy + """Sort the response by given field.""" + + status: Optional[List[WaapInsightStatus]] + """The status of the insight""" diff --git a/src/gcore/types/waap/domains/insight_replace_params.py b/src/gcore/types/waap/domains/insight_replace_params.py new file mode 100644 index 00000000..ba1d1eb4 --- /dev/null +++ b/src/gcore/types/waap/domains/insight_replace_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ..waap_insight_status import WaapInsightStatus + +__all__ = ["InsightReplaceParams"] + + +class InsightReplaceParams(TypedDict, total=False): + domain_id: Required[int] + """The domain ID""" + + status: Required[WaapInsightStatus] + """The different statuses an insight can have""" diff --git a/src/gcore/types/waap/domains/insight_silence_create_params.py b/src/gcore/types/waap/domains/insight_silence_create_params.py new file mode 100644 index 00000000..d4376cd1 --- /dev/null +++ b/src/gcore/types/waap/domains/insight_silence_create_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["InsightSilenceCreateParams"] + + +class InsightSilenceCreateParams(TypedDict, total=False): + author: Required[str] + """The author of the silence""" + + comment: Required[str] + """A comment explaining the reason for the silence""" + + insight_type: Required[str] + """The slug of the insight type""" + + labels: Required[Dict[str, str]] + """A hash table of label names and values that apply to the insight silence""" + + expire_at: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """The date and time the silence expires in ISO 8601 format""" diff --git a/src/gcore/types/waap/domains/insight_silence_list_params.py b/src/gcore/types/waap/domains/insight_silence_list_params.py new file mode 100644 index 00000000..e84a8e05 --- /dev/null +++ b/src/gcore/types/waap/domains/insight_silence_list_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import TypedDict + +from ..waap_insight_silence_sort_by import WaapInsightSilenceSortBy + +__all__ = ["InsightSilenceListParams"] + + +class InsightSilenceListParams(TypedDict, total=False): + id: Optional[List[str]] + """The ID of the insight silence""" + + author: Optional[str] + """The author of the insight silence""" + + comment: Optional[str] + """The comment of the insight silence""" + + insight_type: Optional[List[str]] + """The type of the insight silence""" + + limit: int + """Number of items to return""" + + offset: int + """Number of items to skip""" + + ordering: WaapInsightSilenceSortBy + """Sort the response by given field.""" diff --git a/src/gcore/types/waap/domains/insight_silence_update_params.py b/src/gcore/types/waap/domains/insight_silence_update_params.py new file mode 100644 index 00000000..23b4c0a7 --- /dev/null +++ b/src/gcore/types/waap/domains/insight_silence_update_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["InsightSilenceUpdateParams"] + + +class InsightSilenceUpdateParams(TypedDict, total=False): + domain_id: Required[int] + """The domain ID""" + + author: Required[str] + """The author of the silence""" + + comment: Required[str] + """A comment explaining the reason for the silence""" + + expire_at: Required[Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]] + """The date and time the silence expires in ISO 8601 format""" + + labels: Dict[str, str] + """A hash table of label names and values that apply to the insight silence""" diff --git a/src/gcore/types/waap/ip_info_get_attack_time_series_params.py b/src/gcore/types/waap/ip_info_get_attack_time_series_params.py new file mode 100644 index 00000000..f4705e0c --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_attack_time_series_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IPInfoGetAttackTimeSeriesParams"] + + +class IPInfoGetAttackTimeSeriesParams(TypedDict, total=False): + ip: Required[str] + """The IP address to check""" diff --git a/src/gcore/types/waap/ip_info_get_attack_time_series_response.py b/src/gcore/types/waap/ip_info_get_attack_time_series_response.py new file mode 100644 index 00000000..71faeea9 --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_attack_time_series_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .waap_time_series_attack import WaapTimeSeriesAttack + +__all__ = ["IPInfoGetAttackTimeSeriesResponse"] + +IPInfoGetAttackTimeSeriesResponse: TypeAlias = List[WaapTimeSeriesAttack] diff --git a/src/gcore/types/waap/ip_info_get_blocked_requests_params.py b/src/gcore/types/waap/ip_info_get_blocked_requests_params.py new file mode 100644 index 00000000..e3f33eb0 --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_blocked_requests_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IPInfoGetBlockedRequestsParams"] + + +class IPInfoGetBlockedRequestsParams(TypedDict, total=False): + domain_id: Required[int] + """The domain ID""" + + ip: Required[str] + """The IP address to check""" diff --git a/src/gcore/types/waap/ip_info_get_blocked_requests_response.py b/src/gcore/types/waap/ip_info_get_blocked_requests_response.py new file mode 100644 index 00000000..5cecb447 --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_blocked_requests_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .waap_rule_blocked_requests import WaapRuleBlockedRequests + +__all__ = ["IPInfoGetBlockedRequestsResponse"] + +IPInfoGetBlockedRequestsResponse: TypeAlias = List[WaapRuleBlockedRequests] diff --git a/src/gcore/types/waap/ip_info_get_counts_params.py b/src/gcore/types/waap/ip_info_get_counts_params.py new file mode 100644 index 00000000..397bf178 --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_counts_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_extensions import Required, TypedDict + +__all__ = ["IPInfoGetCountsParams"] + + +class IPInfoGetCountsParams(TypedDict, total=False): + ip: Required[str] + """The IP address to check""" + + domain_id: int + """The identifier for a domain. + + When specified, the response will exclusively contain data pertinent to the + indicated domain, filtering out information from other domains. + """ diff --git a/src/gcore/types/waap/ip_info_get_ddos_attack_series_params.py b/src/gcore/types/waap/ip_info_get_ddos_attack_series_params.py new file mode 100644 index 00000000..7d28ee62 --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_ddos_attack_series_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IPInfoGetDDOSAttackSeriesParams"] + + +class IPInfoGetDDOSAttackSeriesParams(TypedDict, total=False): + ip: Required[str] + """The IP address to check""" diff --git a/src/gcore/types/waap/ip_info_get_params.py b/src/gcore/types/waap/ip_info_get_params.py new file mode 100644 index 00000000..41da0961 --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IPInfoGetParams"] + + +class IPInfoGetParams(TypedDict, total=False): + ip: Required[str] + """The IP address to check""" diff --git a/src/gcore/types/waap/ip_info_get_top_sessions_params.py b/src/gcore/types/waap/ip_info_get_top_sessions_params.py new file mode 100644 index 00000000..5fc0e8b9 --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_top_sessions_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IPInfoGetTopSessionsParams"] + + +class IPInfoGetTopSessionsParams(TypedDict, total=False): + domain_id: Required[int] + """The domain ID""" + + ip: Required[str] + """The IP address to check""" diff --git a/src/gcore/types/waap/ip_info_get_top_sessions_response.py b/src/gcore/types/waap/ip_info_get_top_sessions_response.py new file mode 100644 index 00000000..19bd5822 --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_top_sessions_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .waap_top_session import WaapTopSession + +__all__ = ["IPInfoGetTopSessionsResponse"] + +IPInfoGetTopSessionsResponse: TypeAlias = List[WaapTopSession] diff --git a/src/gcore/types/waap/ip_info_get_top_urls_params.py b/src/gcore/types/waap/ip_info_get_top_urls_params.py new file mode 100644 index 00000000..4b7cfd47 --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_top_urls_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IPInfoGetTopURLsParams"] + + +class IPInfoGetTopURLsParams(TypedDict, total=False): + domain_id: Required[int] + """The domain ID""" + + ip: Required[str] + """The IP address to check""" diff --git a/src/gcore/types/waap/ip_info_get_top_urls_response.py b/src/gcore/types/waap/ip_info_get_top_urls_response.py new file mode 100644 index 00000000..76dc6cdb --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_top_urls_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .waap_top_url import WaapTopURL + +__all__ = ["IPInfoGetTopURLsResponse"] + +IPInfoGetTopURLsResponse: TypeAlias = List[WaapTopURL] diff --git a/src/gcore/types/waap/ip_info_get_top_user_agents_params.py b/src/gcore/types/waap/ip_info_get_top_user_agents_params.py new file mode 100644 index 00000000..70d6d1c7 --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_top_user_agents_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IPInfoGetTopUserAgentsParams"] + + +class IPInfoGetTopUserAgentsParams(TypedDict, total=False): + domain_id: Required[int] + """The domain ID""" + + ip: Required[str] + """The IP address to check""" diff --git a/src/gcore/types/waap/ip_info_get_top_user_agents_response.py b/src/gcore/types/waap/ip_info_get_top_user_agents_response.py new file mode 100644 index 00000000..883a4088 --- /dev/null +++ b/src/gcore/types/waap/ip_info_get_top_user_agents_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .waap_top_user_agent import WaapTopUserAgent + +__all__ = ["IPInfoGetTopUserAgentsResponse"] + +IPInfoGetTopUserAgentsResponse: TypeAlias = List[WaapTopUserAgent] diff --git a/src/gcore/types/waap/ip_info_list_attacked_countries_params.py b/src/gcore/types/waap/ip_info_list_attacked_countries_params.py new file mode 100644 index 00000000..f3f4d4a5 --- /dev/null +++ b/src/gcore/types/waap/ip_info_list_attacked_countries_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IPInfoListAttackedCountriesParams"] + + +class IPInfoListAttackedCountriesParams(TypedDict, total=False): + ip: Required[str] + """The IP address to check""" diff --git a/src/gcore/types/waap/ip_info_list_attacked_countries_response.py b/src/gcore/types/waap/ip_info_list_attacked_countries_response.py new file mode 100644 index 00000000..95b88508 --- /dev/null +++ b/src/gcore/types/waap/ip_info_list_attacked_countries_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .waap_ip_country_attack import WaapIPCountryAttack + +__all__ = ["IPInfoListAttackedCountriesResponse"] + +IPInfoListAttackedCountriesResponse: TypeAlias = List[WaapIPCountryAttack] diff --git a/src/gcore/types/waap/quota_item.py b/src/gcore/types/waap/quota_item.py deleted file mode 100644 index 7a2144b2..00000000 --- a/src/gcore/types/waap/quota_item.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["QuotaItem"] - - -class QuotaItem(BaseModel): - allowed: int - """The maximum allowed number of this resource""" - - current: int - """The current number of this resource""" diff --git a/src/gcore/types/waap/domains/advanced_rule.py b/src/gcore/types/waap/waap_advanced_rule.py similarity index 94% rename from src/gcore/types/waap/domains/advanced_rule.py rename to src/gcore/types/waap/waap_advanced_rule.py index 35587095..155ddeab 100644 --- a/src/gcore/types/waap/domains/advanced_rule.py +++ b/src/gcore/types/waap/waap_advanced_rule.py @@ -3,9 +3,9 @@ from typing import List, Optional from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel -__all__ = ["AdvancedRule", "Action", "ActionBlock", "ActionTag"] +__all__ = ["WaapAdvancedRule", "Action", "ActionBlock", "ActionTag"] class ActionBlock(BaseModel): @@ -48,7 +48,7 @@ class Action(BaseModel): """WAAP tag action gets a list of tags to tag the request scope with""" -class AdvancedRule(BaseModel): +class WaapAdvancedRule(BaseModel): id: int """The unique identifier for the rule""" diff --git a/src/gcore/types/waap/advanced_rule_descriptor.py b/src/gcore/types/waap/waap_advanced_rule_descriptor.py similarity index 89% rename from src/gcore/types/waap/advanced_rule_descriptor.py rename to src/gcore/types/waap/waap_advanced_rule_descriptor.py index c396064c..45425e54 100644 --- a/src/gcore/types/waap/advanced_rule_descriptor.py +++ b/src/gcore/types/waap/waap_advanced_rule_descriptor.py @@ -4,7 +4,7 @@ from ..._models import BaseModel -__all__ = ["AdvancedRuleDescriptor", "Attr", "AttrArg"] +__all__ = ["WaapAdvancedRuleDescriptor", "Attr", "AttrArg"] class AttrArg(BaseModel): @@ -35,7 +35,7 @@ class Attr(BaseModel): """The attribute's hint""" -class AdvancedRuleDescriptor(BaseModel): +class WaapAdvancedRuleDescriptor(BaseModel): 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 new file mode 100644 index 00000000..1924fee2 --- /dev/null +++ b/src/gcore/types/waap/waap_advanced_rule_descriptor_list.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .waap_advanced_rule_descriptor import WaapAdvancedRuleDescriptor + +__all__ = ["WaapAdvancedRuleDescriptorList"] + + +class WaapAdvancedRuleDescriptorList(BaseModel): + version: str + """The descriptor's version""" + + objects: Optional[List[WaapAdvancedRuleDescriptor]] = None diff --git a/src/gcore/types/waap/block_csrf_page_data.py b/src/gcore/types/waap/waap_block_csrf_page_data.py similarity index 91% rename from src/gcore/types/waap/block_csrf_page_data.py rename to src/gcore/types/waap/waap_block_csrf_page_data.py index 45fb8706..06f76225 100644 --- a/src/gcore/types/waap/block_csrf_page_data.py +++ b/src/gcore/types/waap/waap_block_csrf_page_data.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["BlockCsrfPageData"] +__all__ = ["WaapBlockCsrfPageData"] -class BlockCsrfPageData(BaseModel): +class WaapBlockCsrfPageData(BaseModel): enabled: bool """Indicates whether the custom custom page is active or inactive""" diff --git a/src/gcore/types/waap/block_csrf_page_data_param.py b/src/gcore/types/waap/waap_block_csrf_page_data_param.py similarity index 88% rename from src/gcore/types/waap/block_csrf_page_data_param.py rename to src/gcore/types/waap/waap_block_csrf_page_data_param.py index 234c6ccf..f16539b7 100644 --- a/src/gcore/types/waap/block_csrf_page_data_param.py +++ b/src/gcore/types/waap/waap_block_csrf_page_data_param.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["BlockCsrfPageDataParam"] +__all__ = ["WaapBlockCsrfPageDataParam"] -class BlockCsrfPageDataParam(TypedDict, total=False): +class WaapBlockCsrfPageDataParam(TypedDict, total=False): enabled: Required[bool] """Indicates whether the custom custom page is active or inactive""" diff --git a/src/gcore/types/waap/block_page_data.py b/src/gcore/types/waap/waap_block_page_data.py similarity index 92% rename from src/gcore/types/waap/block_page_data.py rename to src/gcore/types/waap/waap_block_page_data.py index b4daf445..b7e8d726 100644 --- a/src/gcore/types/waap/block_page_data.py +++ b/src/gcore/types/waap/waap_block_page_data.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["BlockPageData"] +__all__ = ["WaapBlockPageData"] -class BlockPageData(BaseModel): +class WaapBlockPageData(BaseModel): enabled: bool """Indicates whether the custom custom page is active or inactive""" diff --git a/src/gcore/types/waap/block_page_data_param.py b/src/gcore/types/waap/waap_block_page_data_param.py similarity index 89% rename from src/gcore/types/waap/block_page_data_param.py rename to src/gcore/types/waap/waap_block_page_data_param.py index 939958da..8ccab0f6 100644 --- a/src/gcore/types/waap/block_page_data_param.py +++ b/src/gcore/types/waap/waap_block_page_data_param.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["BlockPageDataParam"] +__all__ = ["WaapBlockPageDataParam"] -class BlockPageDataParam(TypedDict, total=False): +class WaapBlockPageDataParam(TypedDict, total=False): enabled: Required[bool] """Indicates whether the custom custom page is active or inactive""" diff --git a/src/gcore/types/waap/waap_blocked_statistics.py b/src/gcore/types/waap/waap_blocked_statistics.py new file mode 100644 index 00000000..2a4259df --- /dev/null +++ b/src/gcore/types/waap/waap_blocked_statistics.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union + +from ..._models import BaseModel + +__all__ = ["WaapBlockedStatistics"] + + +class WaapBlockedStatistics(BaseModel): + action: List[List[Union[str, int]]] + """A collection of event counts per action. + + The first item is the action's abbreviation/full action name, and the second + item is the number of events + """ + + country: List[List[Union[str, int]]] + """A collection of event counts per country of origin. + + The first item is the country's ISO 3166-1 alpha-2, and the second item is the + number of events + """ + + org: List[List[Union[str, int]]] + """A collection of event counts per organization that owns the event's client IP. + + The first item is the organization's name, and the second item is the number of + events + """ + + rule_name: List[List[Union[str, int]]] + """A collection of event counts per rule that triggered the event. + + The first item is the rule's name, and the second item is the number of events + """ diff --git a/src/gcore/types/waap/captcha_page_data.py b/src/gcore/types/waap/waap_captcha_page_data.py similarity index 92% rename from src/gcore/types/waap/captcha_page_data.py rename to src/gcore/types/waap/waap_captcha_page_data.py index d2281883..ce353113 100644 --- a/src/gcore/types/waap/captcha_page_data.py +++ b/src/gcore/types/waap/waap_captcha_page_data.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["CaptchaPageData"] +__all__ = ["WaapCaptchaPageData"] -class CaptchaPageData(BaseModel): +class WaapCaptchaPageData(BaseModel): enabled: bool """Indicates whether the custom custom page is active or inactive""" diff --git a/src/gcore/types/waap/captcha_page_data_param.py b/src/gcore/types/waap/waap_captcha_page_data_param.py similarity index 89% rename from src/gcore/types/waap/captcha_page_data_param.py rename to src/gcore/types/waap/waap_captcha_page_data_param.py index 4881c803..8010e804 100644 --- a/src/gcore/types/waap/captcha_page_data_param.py +++ b/src/gcore/types/waap/waap_captcha_page_data_param.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["CaptchaPageDataParam"] +__all__ = ["WaapCaptchaPageDataParam"] -class CaptchaPageDataParam(TypedDict, total=False): +class WaapCaptchaPageDataParam(TypedDict, total=False): enabled: Required[bool] """Indicates whether the custom custom page is active or inactive""" diff --git a/src/gcore/types/waap/waap_common_tag.py b/src/gcore/types/waap/waap_common_tag.py new file mode 100644 index 00000000..bb3a995f --- /dev/null +++ b/src/gcore/types/waap/waap_common_tag.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["WaapCommonTag"] + + +class WaapCommonTag(BaseModel): + description: str + """Tag description information""" + + display_name: str + """The tag's display name""" + + tag: str + """Tag name""" diff --git a/src/gcore/types/waap/cookie_disabled_page_data.py b/src/gcore/types/waap/waap_cookie_disabled_page_data.py similarity index 83% rename from src/gcore/types/waap/cookie_disabled_page_data.py rename to src/gcore/types/waap/waap_cookie_disabled_page_data.py index 3e598b1b..c905dc65 100644 --- a/src/gcore/types/waap/cookie_disabled_page_data.py +++ b/src/gcore/types/waap/waap_cookie_disabled_page_data.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["CookieDisabledPageData"] +__all__ = ["WaapCookieDisabledPageData"] -class CookieDisabledPageData(BaseModel): +class WaapCookieDisabledPageData(BaseModel): enabled: bool """Indicates whether the custom custom page is active or inactive""" diff --git a/src/gcore/types/waap/javascript_disabled_page_data_param.py b/src/gcore/types/waap/waap_cookie_disabled_page_data_param.py similarity index 79% rename from src/gcore/types/waap/javascript_disabled_page_data_param.py rename to src/gcore/types/waap/waap_cookie_disabled_page_data_param.py index 49935173..c24b6a7c 100644 --- a/src/gcore/types/waap/javascript_disabled_page_data_param.py +++ b/src/gcore/types/waap/waap_cookie_disabled_page_data_param.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["JavascriptDisabledPageDataParam"] +__all__ = ["WaapCookieDisabledPageDataParam"] -class JavascriptDisabledPageDataParam(TypedDict, total=False): +class WaapCookieDisabledPageDataParam(TypedDict, total=False): enabled: Required[bool] """Indicates whether the custom custom page is active or inactive""" diff --git a/src/gcore/types/waap/waap_count_statistics.py b/src/gcore/types/waap/waap_count_statistics.py new file mode 100644 index 00000000..6ae022a2 --- /dev/null +++ b/src/gcore/types/waap/waap_count_statistics.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union + +from ..._models import BaseModel + +__all__ = ["WaapCountStatistics"] + + +class WaapCountStatistics(BaseModel): + action: List[List[Union[str, int]]] + """A collection of event counts per action. + + The first item is the action's abbreviation/full action name, and the second + item is the number of events + """ + + country: List[List[Union[str, int]]] + """A collection of event counts per country of origin. + + The first item is the country's ISO 3166-1 alpha-2, and the second item is the + number of events + """ + + org: List[List[Union[str, int]]] + """A collection of event counts per organization that owns the event's client IP. + + The first item is the organization's name, and the second item is the number of + events + """ + + rule_name: List[List[Union[str, int]]] + """A collection of event counts per rule that triggered the event. + + The first item is the rule's name, and the second item is the number of events + """ diff --git a/src/gcore/types/waap/preview_custom_page.py b/src/gcore/types/waap/waap_custom_page_preview.py similarity index 70% rename from src/gcore/types/waap/preview_custom_page.py rename to src/gcore/types/waap/waap_custom_page_preview.py index 499e4c2f..cae580b3 100644 --- a/src/gcore/types/waap/preview_custom_page.py +++ b/src/gcore/types/waap/waap_custom_page_preview.py @@ -2,9 +2,9 @@ from ..._models import BaseModel -__all__ = ["PreviewCustomPage"] +__all__ = ["WaapCustomPagePreview"] -class PreviewCustomPage(BaseModel): +class WaapCustomPagePreview(BaseModel): html: str """HTML content of the custom page""" diff --git a/src/gcore/types/waap/waap_custom_page_set.py b/src/gcore/types/waap/waap_custom_page_set.py new file mode 100644 index 00000000..105256a2 --- /dev/null +++ b/src/gcore/types/waap/waap_custom_page_set.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .waap_block_page_data import WaapBlockPageData +from .waap_captcha_page_data import WaapCaptchaPageData +from .waap_handshake_page_data import WaapHandshakePageData +from .waap_block_csrf_page_data import WaapBlockCsrfPageData +from .waap_cookie_disabled_page_data import WaapCookieDisabledPageData +from .waap_javascript_disabled_page_data import WaapJavascriptDisabledPageData + +__all__ = ["WaapCustomPageSet"] + + +class WaapCustomPageSet(BaseModel): + id: int + """The ID of the custom page set""" + + name: str + """Name of the custom page set""" + + block: Optional[WaapBlockPageData] = None + + block_csrf: Optional[WaapBlockCsrfPageData] = None + + captcha: Optional[WaapCaptchaPageData] = None + + cookie_disabled: Optional[WaapCookieDisabledPageData] = None + + domains: Optional[List[int]] = None + """List of domain IDs that are associated with this page set""" + + handshake: Optional[WaapHandshakePageData] = None + + javascript_disabled: Optional[WaapJavascriptDisabledPageData] = None diff --git a/src/gcore/types/waap/domains/custom_rule.py b/src/gcore/types/waap/waap_custom_rule.py similarity index 99% rename from src/gcore/types/waap/domains/custom_rule.py rename to src/gcore/types/waap/waap_custom_rule.py index d00a5348..20e1c445 100644 --- a/src/gcore/types/waap/domains/custom_rule.py +++ b/src/gcore/types/waap/waap_custom_rule.py @@ -3,10 +3,10 @@ from typing import List, Optional from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel __all__ = [ - "CustomRule", + "WaapCustomRule", "Action", "ActionBlock", "ActionTag", @@ -349,7 +349,7 @@ class Condition(BaseModel): """Matches requests based on user-defined tags""" -class CustomRule(BaseModel): +class WaapCustomRule(BaseModel): id: int """The unique identifier for the rule""" diff --git a/src/gcore/types/waap/rule_action_type.py b/src/gcore/types/waap/waap_customer_rule_state.py similarity index 52% rename from src/gcore/types/waap/rule_action_type.py rename to src/gcore/types/waap/waap_customer_rule_state.py index 44a6d3ec..cf221d1b 100644 --- a/src/gcore/types/waap/rule_action_type.py +++ b/src/gcore/types/waap/waap_customer_rule_state.py @@ -2,6 +2,6 @@ from typing_extensions import Literal, TypeAlias -__all__ = ["RuleActionType"] +__all__ = ["WaapCustomerRuleState"] -RuleActionType: TypeAlias = Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] +WaapCustomerRuleState: TypeAlias = Literal["enable", "disable"] diff --git a/src/gcore/types/waap/waap_ddos_attack.py b/src/gcore/types/waap/waap_ddos_attack.py new file mode 100644 index 00000000..f53bef72 --- /dev/null +++ b/src/gcore/types/waap/waap_ddos_attack.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["WaapDDOSAttack"] + + +class WaapDDOSAttack(BaseModel): + end_time: Optional[datetime] = None + """End time of DDoS attack""" + + start_time: Optional[datetime] = None + """Start time of DDoS attack""" diff --git a/src/gcore/types/waap/waap_ddos_info.py b/src/gcore/types/waap/waap_ddos_info.py new file mode 100644 index 00000000..5c1f59ca --- /dev/null +++ b/src/gcore/types/waap/waap_ddos_info.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["WaapDDOSInfo"] + + +class WaapDDOSInfo(BaseModel): + count: int + """The number of requests made""" + + identity: str + """The value for the grouped by type""" + + type: Literal["URL", "IP", "User-Agent"] diff --git a/src/gcore/types/waap/waap_detailed_domain.py b/src/gcore/types/waap/waap_detailed_domain.py index 1f85b04f..c0557bd7 100644 --- a/src/gcore/types/waap/waap_detailed_domain.py +++ b/src/gcore/types/waap/waap_detailed_domain.py @@ -4,10 +4,17 @@ from datetime import datetime from ..._models import BaseModel -from .quota_item import QuotaItem from .waap_domain_status import WaapDomainStatus -__all__ = ["WaapDetailedDomain"] +__all__ = ["WaapDetailedDomain", "Quotas"] + + +class Quotas(BaseModel): + allowed: int + """The maximum allowed number of this resource""" + + current: int + """The current number of this resource""" class WaapDetailedDomain(BaseModel): @@ -26,5 +33,5 @@ class WaapDetailedDomain(BaseModel): status: WaapDomainStatus """The different statuses a domain can have""" - quotas: Optional[Dict[str, QuotaItem]] = None + quotas: Optional[Dict[str, Quotas]] = None """Domain level quotas""" diff --git a/src/gcore/types/waap/waap_domain_settings.py b/src/gcore/types/waap/waap_domain_api_settings.py similarity index 65% rename from src/gcore/types/waap/waap_domain_settings.py rename to src/gcore/types/waap/waap_domain_api_settings.py index de653cee..7a8b3077 100644 --- a/src/gcore/types/waap/waap_domain_settings.py +++ b/src/gcore/types/waap/waap_domain_api_settings.py @@ -3,12 +3,11 @@ from typing import List, Optional from ..._models import BaseModel -from .waap_domain_ddos_settings import WaapDomainDDOSSettings -__all__ = ["WaapDomainSettings", "API"] +__all__ = ["WaapDomainAPISettings"] -class API(BaseModel): +class WaapDomainAPISettings(BaseModel): api_urls: Optional[List[str]] = None """The API URLs for a domain. @@ -21,11 +20,3 @@ class API(BaseModel): All requests to an API domain are treated as API requests. If this is set to true then the `api_urls` field is ignored. """ - - -class WaapDomainSettings(BaseModel): - api: API - """API settings of a domain""" - - ddos: WaapDomainDDOSSettings - """DDoS settings for a domain.""" diff --git a/src/gcore/types/waap/waap_domain_policy.py b/src/gcore/types/waap/waap_domain_policy.py new file mode 100644 index 00000000..d6251e6b --- /dev/null +++ b/src/gcore/types/waap/waap_domain_policy.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from .waap_policy_action import WaapPolicyAction + +__all__ = ["WaapDomainPolicy"] + + +class WaapDomainPolicy(BaseModel): + id: str + """Unique identifier for the security rule""" + + action: WaapPolicyAction + """The action taken by the WAAP upon rule activation.""" + + description: str + """Detailed description of the security rule""" + + group: str + """The rule set group name to which the rule belongs""" + + mode: bool + """Indicates if the security rule is active""" + + name: str + """Name of the security rule""" + + rule_set_id: int + """Identifier of the rule set to which the rule belongs""" diff --git a/src/gcore/types/waap/waap_domain_settings_model.py b/src/gcore/types/waap/waap_domain_settings_model.py new file mode 100644 index 00000000..b287c563 --- /dev/null +++ b/src/gcore/types/waap/waap_domain_settings_model.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from .waap_domain_api_settings import WaapDomainAPISettings +from .waap_domain_ddos_settings import WaapDomainDDOSSettings + +__all__ = ["WaapDomainSettingsModel"] + + +class WaapDomainSettingsModel(BaseModel): + api: WaapDomainAPISettings + """API settings of a domain""" + + ddos: WaapDomainDDOSSettings + """DDoS settings for a domain.""" diff --git a/src/gcore/types/waap/waap_event_statistics.py b/src/gcore/types/waap/waap_event_statistics.py new file mode 100644 index 00000000..a85f6393 --- /dev/null +++ b/src/gcore/types/waap/waap_event_statistics.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from .waap_count_statistics import WaapCountStatistics +from .waap_blocked_statistics import WaapBlockedStatistics + +__all__ = ["WaapEventStatistics"] + + +class WaapEventStatistics(BaseModel): + blocked: WaapBlockedStatistics + """A collection of total numbers of events with blocked results per criteria""" + + count: WaapCountStatistics + """A collection of total numbers of events per criteria""" diff --git a/src/gcore/types/waap/domains/firewall_rule.py b/src/gcore/types/waap/waap_firewall_rule.py similarity index 92% rename from src/gcore/types/waap/domains/firewall_rule.py rename to src/gcore/types/waap/waap_firewall_rule.py index 97a189d8..fb36614b 100644 --- a/src/gcore/types/waap/domains/firewall_rule.py +++ b/src/gcore/types/waap/waap_firewall_rule.py @@ -3,9 +3,9 @@ from typing import List, Optional from typing_extensions import Literal -from ...._models import BaseModel +from ..._models import BaseModel -__all__ = ["FirewallRule", "Action", "ActionBlock", "Condition", "ConditionIP", "ConditionIPRange"] +__all__ = ["WaapFirewallRule", "Action", "ActionBlock", "Condition", "ConditionIP", "ConditionIPRange"] class ActionBlock(BaseModel): @@ -58,7 +58,7 @@ class Condition(BaseModel): """Match the incoming request against an IP range""" -class FirewallRule(BaseModel): +class WaapFirewallRule(BaseModel): id: int """The unique identifier of the rule""" diff --git a/src/gcore/types/waap/waap_get_account_overview_response.py b/src/gcore/types/waap/waap_get_account_overview_response.py new file mode 100644 index 00000000..14a8808c --- /dev/null +++ b/src/gcore/types/waap/waap_get_account_overview_response.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional + +from ..._models import BaseModel + +__all__ = ["WaapGetAccountOverviewResponse", "Quotas", "Service"] + + +class Quotas(BaseModel): + allowed: int + """The maximum allowed number of this resource""" + + current: int + """The current number of this resource""" + + +class Service(BaseModel): + enabled: bool + """Whether the service is enabled""" + + +class WaapGetAccountOverviewResponse(BaseModel): + id: Optional[int] = None + """The client ID""" + + features: List[str] + """List of enabled features""" + + quotas: Dict[str, Quotas] + """Quotas for the client""" + + service: Service + """Information about the WAAP service status""" diff --git a/src/gcore/types/waap/handshake_page_data.py b/src/gcore/types/waap/waap_handshake_page_data.py similarity index 90% rename from src/gcore/types/waap/handshake_page_data.py rename to src/gcore/types/waap/waap_handshake_page_data.py index 9e27d565..5c961a5d 100644 --- a/src/gcore/types/waap/handshake_page_data.py +++ b/src/gcore/types/waap/waap_handshake_page_data.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["HandshakePageData"] +__all__ = ["WaapHandshakePageData"] -class HandshakePageData(BaseModel): +class WaapHandshakePageData(BaseModel): enabled: bool """Indicates whether the custom custom page is active or inactive""" diff --git a/src/gcore/types/waap/handshake_page_data_param.py b/src/gcore/types/waap/waap_handshake_page_data_param.py similarity index 87% rename from src/gcore/types/waap/handshake_page_data_param.py rename to src/gcore/types/waap/waap_handshake_page_data_param.py index bb43c216..66d8217d 100644 --- a/src/gcore/types/waap/handshake_page_data_param.py +++ b/src/gcore/types/waap/waap_handshake_page_data_param.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["HandshakePageDataParam"] +__all__ = ["WaapHandshakePageDataParam"] -class HandshakePageDataParam(TypedDict, total=False): +class WaapHandshakePageDataParam(TypedDict, total=False): enabled: Required[bool] """Indicates whether the custom custom page is active or inactive""" diff --git a/src/gcore/types/waap/waap_insight.py b/src/gcore/types/waap/waap_insight.py new file mode 100644 index 00000000..6300f15a --- /dev/null +++ b/src/gcore/types/waap/waap_insight.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from datetime import datetime + +from ..._models import BaseModel +from .waap_insight_status import WaapInsightStatus + +__all__ = ["WaapInsight"] + + +class WaapInsight(BaseModel): + id: str + """A generated unique identifier for the insight""" + + description: str + """The description of the insight""" + + first_seen: datetime + """The date and time the insight was first seen in ISO 8601 format""" + + insight_type: str + """The type of the insight represented as a slug""" + + labels: Dict[str, str] + """A hash table of label names and values that apply to the insight""" + + last_seen: datetime + """The date and time the insight was last seen in ISO 8601 format""" + + last_status_change: datetime + """The date and time the insight was last seen in ISO 8601 format""" + + recommendation: str + """The recommended action to perform to resolve the insight""" + + status: WaapInsightStatus + """The different statuses an insight can have""" diff --git a/src/gcore/types/waap/waap_insight_silence.py b/src/gcore/types/waap/waap_insight_silence.py new file mode 100644 index 00000000..f2949cde --- /dev/null +++ b/src/gcore/types/waap/waap_insight_silence.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["WaapInsightSilence"] + + +class WaapInsightSilence(BaseModel): + id: str + """A generated unique identifier for the silence""" + + author: str + """The author of the silence""" + + comment: str + """A comment explaining the reason for the silence""" + + expire_at: Optional[datetime] = None + """The date and time the silence expires in ISO 8601 format""" + + insight_type: str + """The slug of the insight type""" + + labels: Dict[str, str] + """A hash table of label names and values that apply to the insight silence""" diff --git a/src/gcore/types/waap/waap_insight_silence_sort_by.py b/src/gcore/types/waap/waap_insight_silence_sort_by.py new file mode 100644 index 00000000..2bf8f08b --- /dev/null +++ b/src/gcore/types/waap/waap_insight_silence_sort_by.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["WaapInsightSilenceSortBy"] + +WaapInsightSilenceSortBy: TypeAlias = Literal[ + "id", "-id", "insight_type", "-insight_type", "comment", "-comment", "author", "-author", "expire_at", "-expire_at" +] diff --git a/src/gcore/types/waap/waap_insight_sort_by.py b/src/gcore/types/waap/waap_insight_sort_by.py new file mode 100644 index 00000000..c2d45a0a --- /dev/null +++ b/src/gcore/types/waap/waap_insight_sort_by.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["WaapInsightSortBy"] + +WaapInsightSortBy: TypeAlias = Literal[ + "id", + "-id", + "insight_type", + "-insight_type", + "first_seen", + "-first_seen", + "last_seen", + "-last_seen", + "last_status_change", + "-last_status_change", + "status", + "-status", +] diff --git a/src/gcore/types/waap/waap_insight_status.py b/src/gcore/types/waap/waap_insight_status.py new file mode 100644 index 00000000..c4cb395d --- /dev/null +++ b/src/gcore/types/waap/waap_insight_status.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["WaapInsightStatus"] + +WaapInsightStatus: TypeAlias = Literal["OPEN", "ACKED", "CLOSED"] diff --git a/src/gcore/types/waap/waap_ip_country_attack.py b/src/gcore/types/waap/waap_ip_country_attack.py new file mode 100644 index 00000000..cba448a8 --- /dev/null +++ b/src/gcore/types/waap/waap_ip_country_attack.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["WaapIPCountryAttack"] + + +class WaapIPCountryAttack(BaseModel): + count: int + """The number of attacks from the specified IP address to the country""" + + country: str + """ + An ISO 3166-1 alpha-2 formatted string representing the country that was + attacked + """ diff --git a/src/gcore/types/waap/waap_ip_ddos_info_model.py b/src/gcore/types/waap/waap_ip_ddos_info_model.py new file mode 100644 index 00000000..03be1722 --- /dev/null +++ b/src/gcore/types/waap/waap_ip_ddos_info_model.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["WaapIPDDOSInfoModel", "TimeSery"] + + +class TimeSery(BaseModel): + count: int + """The number of attacks""" + + timestamp: int + """The timestamp of the time series item as a POSIX timestamp""" + + +class WaapIPDDOSInfoModel(BaseModel): + botnet_client: bool + """Indicates if the IP is tagged as a botnet client""" + + time_series: List[TimeSery] + """The time series data for the DDoS attacks from the IP address""" diff --git a/src/gcore/types/waap/waap_ip_info.py b/src/gcore/types/waap/waap_ip_info.py new file mode 100644 index 00000000..741e7e2f --- /dev/null +++ b/src/gcore/types/waap/waap_ip_info.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["WaapIPInfo", "Whois"] + + +class Whois(BaseModel): + abuse_mail: Optional[str] = None + """The abuse mail""" + + cidr: Optional[int] = None + """The CIDR""" + + country: Optional[str] = None + """The country""" + + net_description: Optional[str] = None + """The network description""" + + net_name: Optional[str] = None + """The network name""" + + net_range: Optional[str] = None + """The network range""" + + net_type: Optional[str] = None + """The network type""" + + org_id: Optional[str] = None + """The organization ID""" + + org_name: Optional[str] = None + """The organization name""" + + owner_type: Optional[str] = None + """The owner type""" + + rir: Optional[str] = None + """The RIR""" + + state: Optional[str] = None + """The state""" + + +class WaapIPInfo(BaseModel): + risk_score: Literal["NO_RISK", "LOW", "MEDIUM", "HIGH", "EXTREME", "NOT_ENOUGH_DATA"] + """The risk score of the IP address""" + + tags: List[str] + """The tags associated with the IP address that affect the risk score""" + + whois: Whois + """The WHOIS information for the IP address""" diff --git a/src/gcore/types/waap/waap_ip_info_counts.py b/src/gcore/types/waap/waap_ip_info_counts.py new file mode 100644 index 00000000..a5a1ab97 --- /dev/null +++ b/src/gcore/types/waap/waap_ip_info_counts.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["WaapIPInfoCounts"] + + +class WaapIPInfoCounts(BaseModel): + blocked_requests: int + """The number of requests from the IP address that were blocked""" + + total_requests: int + """The total number of requests made by the IP address""" + + unique_sessions: int + """The number of unique sessions from the IP address""" diff --git a/src/gcore/types/waap/javascript_disabled_page_data.py b/src/gcore/types/waap/waap_javascript_disabled_page_data.py similarity index 82% rename from src/gcore/types/waap/javascript_disabled_page_data.py rename to src/gcore/types/waap/waap_javascript_disabled_page_data.py index 7e89d02c..641bc115 100644 --- a/src/gcore/types/waap/javascript_disabled_page_data.py +++ b/src/gcore/types/waap/waap_javascript_disabled_page_data.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["JavascriptDisabledPageData"] +__all__ = ["WaapJavascriptDisabledPageData"] -class JavascriptDisabledPageData(BaseModel): +class WaapJavascriptDisabledPageData(BaseModel): enabled: bool """Indicates whether the custom custom page is active or inactive""" diff --git a/src/gcore/types/waap/cookie_disabled_page_data_param.py b/src/gcore/types/waap/waap_javascript_disabled_page_data_param.py similarity index 78% rename from src/gcore/types/waap/cookie_disabled_page_data_param.py rename to src/gcore/types/waap/waap_javascript_disabled_page_data_param.py index c56bd5d9..fe56528b 100644 --- a/src/gcore/types/waap/cookie_disabled_page_data_param.py +++ b/src/gcore/types/waap/waap_javascript_disabled_page_data_param.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["CookieDisabledPageDataParam"] +__all__ = ["WaapJavascriptDisabledPageDataParam"] -class CookieDisabledPageDataParam(TypedDict, total=False): +class WaapJavascriptDisabledPageDataParam(TypedDict, total=False): enabled: Required[bool] """Indicates whether the custom custom page is active or inactive""" diff --git a/src/gcore/types/waap/waap_network_details.py b/src/gcore/types/waap/waap_network_details.py new file mode 100644 index 00000000..7d4c8f60 --- /dev/null +++ b/src/gcore/types/waap/waap_network_details.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel +from .waap_request_organization import WaapRequestOrganization + +__all__ = ["WaapNetworkDetails"] + + +class WaapNetworkDetails(BaseModel): + client_ip: str + """Client IP""" + + country: str + """Country code""" + + organization: WaapRequestOrganization + """Organization details""" diff --git a/src/gcore/types/waap/organization.py b/src/gcore/types/waap/waap_organization.py similarity index 77% rename from src/gcore/types/waap/organization.py rename to src/gcore/types/waap/waap_organization.py index 8ea95b60..f5f580fe 100644 --- a/src/gcore/types/waap/organization.py +++ b/src/gcore/types/waap/waap_organization.py @@ -2,10 +2,10 @@ from ..._models import BaseModel -__all__ = ["Organization"] +__all__ = ["WaapOrganization"] -class Organization(BaseModel): +class WaapOrganization(BaseModel): id: int """The ID of an organization""" diff --git a/src/gcore/types/waap/waap_page_type.py b/src/gcore/types/waap/waap_page_type.py new file mode 100644 index 00000000..17a35c3e --- /dev/null +++ b/src/gcore/types/waap/waap_page_type.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["WaapPageType"] + +WaapPageType: TypeAlias = Literal[ + "block.html", "block_csrf.html", "captcha.html", "cookieDisabled.html", "handshake.html", "javascriptDisabled.html" +] diff --git a/src/gcore/types/waap/waap_paginated_custom_page_set.py b/src/gcore/types/waap/waap_paginated_custom_page_set.py new file mode 100644 index 00000000..9cd598b5 --- /dev/null +++ b/src/gcore/types/waap/waap_paginated_custom_page_set.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .waap_custom_page_set import WaapCustomPageSet + +__all__ = ["WaapPaginatedCustomPageSet"] + + +class WaapPaginatedCustomPageSet(BaseModel): + count: int + """Number of items contain in the response""" + + limit: int + """Number of items requested in the response""" + + offset: int + """Items response offset used""" + + results: List[WaapCustomPageSet] + """List of items returned in the response following given criteria""" diff --git a/src/gcore/types/waap/waap_paginated_ddos_attack.py b/src/gcore/types/waap/waap_paginated_ddos_attack.py new file mode 100644 index 00000000..52f7c7d5 --- /dev/null +++ b/src/gcore/types/waap/waap_paginated_ddos_attack.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .waap_ddos_attack import WaapDDOSAttack + +__all__ = ["WaapPaginatedDDOSAttack"] + + +class WaapPaginatedDDOSAttack(BaseModel): + count: int + """Number of items contain in the response""" + + limit: int + """Number of items requested in the response""" + + offset: int + """Items response offset used""" + + results: List[WaapDDOSAttack] + """List of items returned in the response following given criteria""" diff --git a/src/gcore/types/waap/waap_paginated_ddos_info.py b/src/gcore/types/waap/waap_paginated_ddos_info.py new file mode 100644 index 00000000..c04f3cd1 --- /dev/null +++ b/src/gcore/types/waap/waap_paginated_ddos_info.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .waap_ddos_info import WaapDDOSInfo + +__all__ = ["WaapPaginatedDDOSInfo"] + + +class WaapPaginatedDDOSInfo(BaseModel): + count: int + """Number of items contain in the response""" + + limit: int + """Number of items requested in the response""" + + offset: int + """Items response offset used""" + + results: List[WaapDDOSInfo] + """List of items returned in the response following given criteria""" diff --git a/src/gcore/types/waap/waap_paginated_request_summary.py b/src/gcore/types/waap/waap_paginated_request_summary.py new file mode 100644 index 00000000..78a86aea --- /dev/null +++ b/src/gcore/types/waap/waap_paginated_request_summary.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .waap_request_summary import WaapRequestSummary + +__all__ = ["WaapPaginatedRequestSummary"] + + +class WaapPaginatedRequestSummary(BaseModel): + count: int + """Number of items contain in the response""" + + limit: int + """Number of items requested in the response""" + + offset: int + """Items response offset used""" + + results: List[WaapRequestSummary] + """List of items returned in the response following given criteria""" diff --git a/src/gcore/types/waap/waap_pattern_matched_tag.py b/src/gcore/types/waap/waap_pattern_matched_tag.py new file mode 100644 index 00000000..9101d3b6 --- /dev/null +++ b/src/gcore/types/waap/waap_pattern_matched_tag.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["WaapPatternMatchedTag"] + + +class WaapPatternMatchedTag(BaseModel): + description: str + """Tag description information""" + + display_name: str + """The tag's display name""" + + execution_phase: str + """ + The phase in which the tag was triggered: access -> Request, `header_filter` -> + `response_header`, `body_filter` -> `response_body` + """ + + field: str + """The entity to which the variable that triggered the tag belong to. + + For example: `request_headers`, uri, cookies etc. + """ + + field_name: str + """The name of the variable which holds the value that triggered the tag""" + + pattern_name: str + """The name of the detected regexp pattern""" + + pattern_value: str + """The pattern which triggered the tag""" + + tag: str + """Tag name""" diff --git a/src/gcore/types/waap/waap_policy_action.py b/src/gcore/types/waap/waap_policy_action.py new file mode 100644 index 00000000..3de1d5d1 --- /dev/null +++ b/src/gcore/types/waap/waap_policy_action.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["WaapPolicyAction"] + +WaapPolicyAction: TypeAlias = Literal["Allow", "Block", "Captcha", "Gateway", "Handshake", "Monitor", "Composite"] diff --git a/src/gcore/types/waap/waap_policy_mode.py b/src/gcore/types/waap/waap_policy_mode.py new file mode 100644 index 00000000..1f9af3f7 --- /dev/null +++ b/src/gcore/types/waap/waap_policy_mode.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["WaapPolicyMode"] + + +class WaapPolicyMode(BaseModel): + mode: bool + """Indicates if the security rule is active""" diff --git a/src/gcore/types/waap/waap_request_details.py b/src/gcore/types/waap/waap_request_details.py new file mode 100644 index 00000000..eff228a8 --- /dev/null +++ b/src/gcore/types/waap/waap_request_details.py @@ -0,0 +1,92 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from ..._models import BaseModel +from .waap_common_tag import WaapCommonTag +from .waap_network_details import WaapNetworkDetails +from .waap_user_agent_details import WaapUserAgentDetails +from .waap_pattern_matched_tag import WaapPatternMatchedTag + +__all__ = ["WaapRequestDetails"] + + +class WaapRequestDetails(BaseModel): + id: str + """Request ID""" + + action: str + """Request action""" + + common_tags: List[WaapCommonTag] + """List of common tags""" + + content_type: str + """Content type of request""" + + domain: str + """Domain name""" + + http_status_code: int + """Status code for http request""" + + http_version: str + """HTTP version of request""" + + incident_id: str + """ID of challenge that was generated""" + + method: str + """Request method""" + + network: WaapNetworkDetails + """Network details""" + + path: str + """Request path""" + + pattern_matched_tags: List[WaapPatternMatchedTag] + """List of shield tags""" + + query_string: str + """The query string of the request""" + + reference_id: str + """Reference ID to identify user sanction""" + + request_headers: object + """HTTP request headers""" + + request_time: str + """The time of the request""" + + request_type: str + """The type of the request that generated an event""" + + requested_domain: str + """The real domain name""" + + response_time: str + """Time took to process all request""" + + result: Literal["passed", "blocked", "suppressed", ""] + """The result of a request""" + + rule_id: str + """ID of the triggered rule""" + + rule_name: str + """Name of the triggered rule""" + + scheme: str + """The HTTP scheme of the request that generated an event""" + + session_request_count: str + """The number requests in session""" + + traffic_types: List[str] + """List of traffic types""" + + user_agent: WaapUserAgentDetails + """User agent details""" diff --git a/src/gcore/types/waap/waap_request_organization.py b/src/gcore/types/waap/waap_request_organization.py new file mode 100644 index 00000000..11fbea5c --- /dev/null +++ b/src/gcore/types/waap/waap_request_organization.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["WaapRequestOrganization"] + + +class WaapRequestOrganization(BaseModel): + name: str + """Organization name""" + + subnet: str + """Network range""" diff --git a/src/gcore/types/waap/waap_request_summary.py b/src/gcore/types/waap/waap_request_summary.py new file mode 100644 index 00000000..4588e14e --- /dev/null +++ b/src/gcore/types/waap/waap_request_summary.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["WaapRequestSummary"] + + +class WaapRequestSummary(BaseModel): + id: str + """Request's unique id""" + + action: str + """Action of the triggered rule""" + + client_ip: str + """Client's IP address.""" + + country: str + """Country code""" + + domain: str + """Domain name""" + + method: str + """HTTP method""" + + organization: str + """Organization""" + + path: str + """Request path""" + + reference_id: str + """The reference ID to a sanction that was given to a user.""" + + request_time: int + """The UNIX timestamp in ms of the date a set of traffic counters was recorded""" + + result: Literal["passed", "blocked", "suppressed", ""] + + rule_id: str + """The ID of the triggered rule.""" + + rule_name: str + """Name of the triggered rule""" + + status_code: int + """Status code for http request""" + + traffic_types: str + """Comma separated list of traffic types.""" + + user_agent: str + """User agent""" + + user_agent_client: str + """Client from parsed User agent header""" diff --git a/src/gcore/types/waap/customer_rule_state.py b/src/gcore/types/waap/waap_resolution.py similarity index 58% rename from src/gcore/types/waap/customer_rule_state.py rename to src/gcore/types/waap/waap_resolution.py index 46b357fa..0d14e1f5 100644 --- a/src/gcore/types/waap/customer_rule_state.py +++ b/src/gcore/types/waap/waap_resolution.py @@ -2,6 +2,6 @@ from typing_extensions import Literal, TypeAlias -__all__ = ["CustomerRuleState"] +__all__ = ["WaapResolution"] -CustomerRuleState: TypeAlias = Literal["enable", "disable"] +WaapResolution: TypeAlias = Literal["daily", "hourly", "minutely"] diff --git a/src/gcore/types/waap/waap_rule_action_type.py b/src/gcore/types/waap/waap_rule_action_type.py new file mode 100644 index 00000000..f7261bb4 --- /dev/null +++ b/src/gcore/types/waap/waap_rule_action_type.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["WaapRuleActionType"] + +WaapRuleActionType: TypeAlias = Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] diff --git a/src/gcore/types/waap/waap_rule_blocked_requests.py b/src/gcore/types/waap/waap_rule_blocked_requests.py new file mode 100644 index 00000000..c07342eb --- /dev/null +++ b/src/gcore/types/waap/waap_rule_blocked_requests.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["WaapRuleBlockedRequests"] + + +class WaapRuleBlockedRequests(BaseModel): + action: str + """The action taken by the rule""" + + count: int + """The number of requests blocked by the rule""" + + rule_name: str + """The name of the rule that blocked the request""" diff --git a/src/gcore/types/waap/waap_rule_set.py b/src/gcore/types/waap/waap_rule_set.py new file mode 100644 index 00000000..f161e0fe --- /dev/null +++ b/src/gcore/types/waap/waap_rule_set.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .waap_domain_policy import WaapDomainPolicy + +__all__ = ["WaapRuleSet", "Tag"] + + +class Tag(BaseModel): + id: int + """Identifier of the tag.""" + + description: str + """Detailed description of the tag.""" + + name: str + """Name of the tag.""" + + +class WaapRuleSet(BaseModel): + id: int + """Identifier of the rule set.""" + + description: str + """Detailed description of the rule set.""" + + is_active: bool + """Indicates if the rule set is currently active.""" + + name: str + """Name of the rule set.""" + + tags: List[Tag] + """Collection of tags associated with the rule set.""" + + resource_slug: Optional[str] = None + """The resource slug associated with the rule set.""" + + rules: Optional[List[WaapDomainPolicy]] = None diff --git a/src/gcore/types/waap/statistic_item.py b/src/gcore/types/waap/waap_statistic_item.py similarity index 84% rename from src/gcore/types/waap/statistic_item.py rename to src/gcore/types/waap/waap_statistic_item.py index db69ea06..9a081374 100644 --- a/src/gcore/types/waap/statistic_item.py +++ b/src/gcore/types/waap/waap_statistic_item.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["StatisticItem"] +__all__ = ["WaapStatisticItem"] -class StatisticItem(BaseModel): +class WaapStatisticItem(BaseModel): date_time: datetime """The date and time for the statistic in ISO 8601 format""" diff --git a/src/gcore/types/waap/statistics_series.py b/src/gcore/types/waap/waap_statistics_series.py similarity index 57% rename from src/gcore/types/waap/statistics_series.py rename to src/gcore/types/waap/waap_statistics_series.py index 9f429a6a..b5d884bd 100644 --- a/src/gcore/types/waap/statistics_series.py +++ b/src/gcore/types/waap/waap_statistics_series.py @@ -3,14 +3,14 @@ from typing import List, Optional from ..._models import BaseModel -from .statistic_item import StatisticItem +from .waap_statistic_item import WaapStatisticItem -__all__ = ["StatisticsSeries"] +__all__ = ["WaapStatisticsSeries"] -class StatisticsSeries(BaseModel): - total_bytes: Optional[List[StatisticItem]] = None +class WaapStatisticsSeries(BaseModel): + total_bytes: Optional[List[WaapStatisticItem]] = None """Will be returned if `total_bytes` is requested in the metrics parameter""" - total_requests: Optional[List[StatisticItem]] = None + total_requests: Optional[List[WaapStatisticItem]] = None """Will be included if `total_requests` is requested in the metrics parameter""" diff --git a/src/gcore/types/waap/tag.py b/src/gcore/types/waap/waap_tag.py similarity index 87% rename from src/gcore/types/waap/tag.py rename to src/gcore/types/waap/waap_tag.py index 9e2db74e..5ccdeae7 100644 --- a/src/gcore/types/waap/tag.py +++ b/src/gcore/types/waap/waap_tag.py @@ -2,10 +2,10 @@ from ..._models import BaseModel -__all__ = ["Tag"] +__all__ = ["WaapTag"] -class Tag(BaseModel): +class WaapTag(BaseModel): description: str """A tag's human readable description""" diff --git a/src/gcore/types/waap/waap_time_series_attack.py b/src/gcore/types/waap/waap_time_series_attack.py new file mode 100644 index 00000000..6b65e32e --- /dev/null +++ b/src/gcore/types/waap/waap_time_series_attack.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["WaapTimeSeriesAttack", "Value"] + + +class Value(BaseModel): + count: int + """The number of attacks""" + + timestamp: int + """The timestamp of the time series item as a POSIX timestamp""" + + +class WaapTimeSeriesAttack(BaseModel): + attack_type: str + """The type of attack""" + + values: List[Value] + """The time series data""" diff --git a/src/gcore/types/waap/waap_top_session.py b/src/gcore/types/waap/waap_top_session.py new file mode 100644 index 00000000..55760e27 --- /dev/null +++ b/src/gcore/types/waap/waap_top_session.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["WaapTopSession"] + + +class WaapTopSession(BaseModel): + blocked: int + """The number of blocked requests in the session""" + + duration: float + """The duration of the session in seconds""" + + requests: int + """The number of requests in the session""" + + session_id: str + """The session ID""" + + start_time: datetime + """The start time of the session as a POSIX timestamp""" diff --git a/src/gcore/types/waap/waap_top_url.py b/src/gcore/types/waap/waap_top_url.py new file mode 100644 index 00000000..88d761f8 --- /dev/null +++ b/src/gcore/types/waap/waap_top_url.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["WaapTopURL"] + + +class WaapTopURL(BaseModel): + count: int + """The number of attacks to the URL""" + + url: str + """The URL that was attacked""" diff --git a/src/gcore/types/waap/waap_top_user_agent.py b/src/gcore/types/waap/waap_top_user_agent.py new file mode 100644 index 00000000..93d28557 --- /dev/null +++ b/src/gcore/types/waap/waap_top_user_agent.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["WaapTopUserAgent"] + + +class WaapTopUserAgent(BaseModel): + count: int + """The number of requests made with the user agent""" + + user_agent: str + """The user agent that was used""" diff --git a/src/gcore/types/waap/waap_traffic_metrics.py b/src/gcore/types/waap/waap_traffic_metrics.py new file mode 100644 index 00000000..8b638066 --- /dev/null +++ b/src/gcore/types/waap/waap_traffic_metrics.py @@ -0,0 +1,68 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["WaapTrafficMetrics"] + + +class WaapTrafficMetrics(BaseModel): + timestamp: int + """UNIX timestamp indicating when the traffic data was recorded""" + + ajax: Optional[int] = None + """Number of AJAX requests made""" + + api: Optional[int] = None + """Number of API requests made""" + + custom_allowed: Optional[int] = FieldInfo(alias="customAllowed", default=None) + """Number of requests allowed through custom rules""" + + custom_blocked: Optional[int] = FieldInfo(alias="customBlocked", default=None) + """Number of requests blocked due to custom rules""" + + ddos_blocked: Optional[int] = FieldInfo(alias="ddosBlocked", default=None) + """Number of DDoS attack attempts successfully blocked""" + + monitored: Optional[int] = None + """Number of requests triggering monitoring actions""" + + origin2xx: Optional[int] = None + """Number of successful HTTP 2xx responses from the origin server""" + + origin3xx: Optional[int] = None + """Number of HTTP 3xx redirects issued by the origin server""" + + origin_error4xx: Optional[int] = FieldInfo(alias="originError4xx", default=None) + """Number of HTTP 4xx errors from the origin server""" + + origin_error5xx: Optional[int] = FieldInfo(alias="originError5xx", default=None) + """Number of HTTP 5xx errors from the origin server""" + + origin_timeout: Optional[int] = FieldInfo(alias="originTimeout", default=None) + """Number of timeouts experienced at the origin server""" + + passed_to_origin: Optional[int] = FieldInfo(alias="passedToOrigin", default=None) + """Number of requests served directly by the origin server""" + + policy_allowed: Optional[int] = FieldInfo(alias="policyAllowed", default=None) + """Number of requests allowed by security policies""" + + policy_blocked: Optional[int] = FieldInfo(alias="policyBlocked", default=None) + """Number of requests blocked by security policies""" + + response_time: Optional[int] = FieldInfo(alias="responseTime", default=None) + """Average origin server response time in milliseconds""" + + static: Optional[int] = None + """Number of static asset requests""" + + total: Optional[int] = None + """Total number of requests""" + + uncategorized: Optional[int] = None + """Requests resulting in neither blocks nor sanctions""" diff --git a/src/gcore/types/waap/waap_traffic_type.py b/src/gcore/types/waap/waap_traffic_type.py new file mode 100644 index 00000000..e65e7a9e --- /dev/null +++ b/src/gcore/types/waap/waap_traffic_type.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["WaapTrafficType"] + +WaapTrafficType: TypeAlias = Literal[ + "policy_allowed", + "policy_blocked", + "custom_rule_allowed", + "custom_blocked", + "legit_requests", + "sanctioned", + "dynamic", + "api", + "static", + "ajax", + "redirects", + "monitor", + "err_40x", + "err_50x", + "passed_to_origin", + "timeout", + "other", + "ddos", + "legit", + "monitored", +] diff --git a/src/gcore/types/waap/waap_user_agent_details.py b/src/gcore/types/waap/waap_user_agent_details.py new file mode 100644 index 00000000..8fac3465 --- /dev/null +++ b/src/gcore/types/waap/waap_user_agent_details.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["WaapUserAgentDetails"] + + +class WaapUserAgentDetails(BaseModel): + base_browser: str + """User agent browser""" + + base_browser_version: str + """User agent browser version""" + + client: str + """Client from User agent header""" + + client_type: str + """User agent client type""" + + client_version: str + """User agent client version""" + + cpu: str + """User agent cpu""" + + device: str + """User agent device""" + + device_type: str + """User agent device type""" + + full_string: str + """User agent""" + + os: str + """User agent os""" + + rendering_engine: str + """User agent engine""" diff --git a/tests/api_resources/test_waap.py b/tests/api_resources/test_waap.py index 09f42bbc..2bb0cf25 100644 --- a/tests/api_resources/test_waap.py +++ b/tests/api_resources/test_waap.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.waap import ClientInfo +from gcore.types.waap import WaapGetAccountOverviewResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,7 +20,7 @@ class TestWaap: @parametrize def test_method_get_account_overview(self, client: Gcore) -> None: waap = client.waap.get_account_overview() - assert_matches_type(ClientInfo, waap, path=["response"]) + assert_matches_type(WaapGetAccountOverviewResponse, waap, path=["response"]) @parametrize def test_raw_response_get_account_overview(self, client: Gcore) -> None: @@ -29,7 +29,7 @@ def test_raw_response_get_account_overview(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" waap = response.parse() - assert_matches_type(ClientInfo, waap, path=["response"]) + assert_matches_type(WaapGetAccountOverviewResponse, waap, path=["response"]) @parametrize def test_streaming_response_get_account_overview(self, client: Gcore) -> None: @@ -38,7 +38,7 @@ def test_streaming_response_get_account_overview(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" waap = response.parse() - assert_matches_type(ClientInfo, waap, path=["response"]) + assert_matches_type(WaapGetAccountOverviewResponse, waap, path=["response"]) assert cast(Any, response.is_closed) is True @@ -49,7 +49,7 @@ class TestAsyncWaap: @parametrize async def test_method_get_account_overview(self, async_client: AsyncGcore) -> None: waap = await async_client.waap.get_account_overview() - assert_matches_type(ClientInfo, waap, path=["response"]) + assert_matches_type(WaapGetAccountOverviewResponse, waap, path=["response"]) @parametrize async def test_raw_response_get_account_overview(self, async_client: AsyncGcore) -> None: @@ -58,7 +58,7 @@ async def test_raw_response_get_account_overview(self, async_client: AsyncGcore) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" waap = await response.parse() - assert_matches_type(ClientInfo, waap, path=["response"]) + assert_matches_type(WaapGetAccountOverviewResponse, waap, path=["response"]) @parametrize async def test_streaming_response_get_account_overview(self, async_client: AsyncGcore) -> None: @@ -67,6 +67,6 @@ async def test_streaming_response_get_account_overview(self, async_client: Async assert response.http_request.headers.get("X-Stainless-Lang") == "python" waap = await response.parse() - assert_matches_type(ClientInfo, waap, path=["response"]) + assert_matches_type(WaapGetAccountOverviewResponse, waap, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/analytics/__init__.py b/tests/api_resources/waap/domains/analytics/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/waap/domains/analytics/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/waap/domains/analytics/test_requests.py b/tests/api_resources/waap/domains/analytics/test_requests.py new file mode 100644 index 00000000..920e5527 --- /dev/null +++ b/tests/api_resources/waap/domains/analytics/test_requests.py @@ -0,0 +1,214 @@ +# 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._utils import parse_datetime +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap import WaapRequestDetails, WaapRequestSummary + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRequests: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + request = client.waap.domains.analytics.requests.list( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(SyncOffsetPage[WaapRequestSummary], request, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + request = client.waap.domains.analytics.requests.list( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + actions=["allow"], + countries=["Mv"], + end=parse_datetime("2019-12-27T18:11:19.117Z"), + ip=".:", + limit=0, + offset=0, + ordering="ordering", + reference_id="2c02efDd09B3BA1AEaDd3dCAa7aC7A37", + security_rule_name="security_rule_name", + status_code=100, + traffic_types=["policy_allowed"], + ) + assert_matches_type(SyncOffsetPage[WaapRequestSummary], request, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.domains.analytics.requests.with_raw_response.list( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + request = response.parse() + assert_matches_type(SyncOffsetPage[WaapRequestSummary], request, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.domains.analytics.requests.with_streaming_response.list( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + request = response.parse() + assert_matches_type(SyncOffsetPage[WaapRequestSummary], request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + request = client.waap.domains.analytics.requests.get( + request_id="request_id", + domain_id=0, + ) + assert_matches_type(WaapRequestDetails, request, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.domains.analytics.requests.with_raw_response.get( + request_id="request_id", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + request = response.parse() + assert_matches_type(WaapRequestDetails, request, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.domains.analytics.requests.with_streaming_response.get( + request_id="request_id", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + request = response.parse() + assert_matches_type(WaapRequestDetails, request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + client.waap.domains.analytics.requests.with_raw_response.get( + request_id="", + domain_id=0, + ) + + +class TestAsyncRequests: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + request = await async_client.waap.domains.analytics.requests.list( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(AsyncOffsetPage[WaapRequestSummary], request, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + request = await async_client.waap.domains.analytics.requests.list( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + actions=["allow"], + countries=["Mv"], + end=parse_datetime("2019-12-27T18:11:19.117Z"), + ip=".:", + limit=0, + offset=0, + ordering="ordering", + reference_id="2c02efDd09B3BA1AEaDd3dCAa7aC7A37", + security_rule_name="security_rule_name", + status_code=100, + traffic_types=["policy_allowed"], + ) + assert_matches_type(AsyncOffsetPage[WaapRequestSummary], request, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.analytics.requests.with_raw_response.list( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + request = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapRequestSummary], request, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.analytics.requests.with_streaming_response.list( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + request = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapRequestSummary], request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + request = await async_client.waap.domains.analytics.requests.get( + request_id="request_id", + domain_id=0, + ) + assert_matches_type(WaapRequestDetails, request, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.analytics.requests.with_raw_response.get( + request_id="request_id", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + request = await response.parse() + assert_matches_type(WaapRequestDetails, request, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.analytics.requests.with_streaming_response.get( + request_id="request_id", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + request = await response.parse() + assert_matches_type(WaapRequestDetails, request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + await async_client.waap.domains.analytics.requests.with_raw_response.get( + request_id="", + domain_id=0, + ) diff --git a/tests/api_resources/waap/domains/api_discovery/__init__.py b/tests/api_resources/waap/domains/api_discovery/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/waap/domains/api_discovery/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/waap/domains/api_discovery/test_scan_results.py b/tests/api_resources/waap/domains/api_discovery/test_scan_results.py new file mode 100644 index 00000000..57c11b9f --- /dev/null +++ b/tests/api_resources/waap/domains/api_discovery/test_scan_results.py @@ -0,0 +1,198 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap.domains.api_discovery import ( + ScanResultGetResponse, + ScanResultListResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestScanResults: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + scan_result = client.waap.domains.api_discovery.scan_results.list( + domain_id=0, + ) + assert_matches_type(SyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + scan_result = client.waap.domains.api_discovery.scan_results.list( + domain_id=0, + limit=0, + message="message", + offset=0, + ordering="id", + status="SUCCESS", + type="TRAFFIC_SCAN", + ) + assert_matches_type(SyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.scan_results.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + scan_result = response.parse() + assert_matches_type(SyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.scan_results.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + scan_result = response.parse() + assert_matches_type(SyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + scan_result = client.waap.domains.api_discovery.scan_results.get( + scan_id="scan_id", + domain_id=0, + ) + assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.scan_results.with_raw_response.get( + scan_id="scan_id", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + scan_result = response.parse() + assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.scan_results.with_streaming_response.get( + scan_id="scan_id", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + scan_result = response.parse() + assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): + client.waap.domains.api_discovery.scan_results.with_raw_response.get( + scan_id="", + domain_id=0, + ) + + +class TestAsyncScanResults: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + scan_result = await async_client.waap.domains.api_discovery.scan_results.list( + domain_id=0, + ) + assert_matches_type(AsyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + scan_result = await async_client.waap.domains.api_discovery.scan_results.list( + domain_id=0, + limit=0, + message="message", + offset=0, + ordering="id", + status="SUCCESS", + type="TRAFFIC_SCAN", + ) + assert_matches_type(AsyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.scan_results.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + scan_result = await response.parse() + assert_matches_type(AsyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.scan_results.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + scan_result = await response.parse() + assert_matches_type(AsyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + scan_result = await async_client.waap.domains.api_discovery.scan_results.get( + scan_id="scan_id", + domain_id=0, + ) + assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.scan_results.with_raw_response.get( + scan_id="scan_id", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + scan_result = await response.parse() + assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.scan_results.with_streaming_response.get( + scan_id="scan_id", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + scan_result = await response.parse() + assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): + await async_client.waap.domains.api_discovery.scan_results.with_raw_response.get( + scan_id="", + domain_id=0, + ) diff --git a/tests/api_resources/waap/domains/test_advanced_rules.py b/tests/api_resources/waap/domains/test_advanced_rules.py index 38ece191..17e72abe 100644 --- a/tests/api_resources/waap/domains/test_advanced_rules.py +++ b/tests/api_resources/waap/domains/test_advanced_rules.py @@ -10,9 +10,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.waap.domains import ( - AdvancedRule, -) +from gcore.types.waap import WaapAdvancedRule base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_create(self, client: Gcore) -> None: name="name", source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", ) - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -52,7 +50,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: description="description", phase="access", ) - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -67,7 +65,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" advanced_rule = response.parse() - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -82,7 +80,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = response.parse() - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -149,7 +147,7 @@ def test_method_list(self, client: Gcore) -> None: advanced_rule = client.waap.domains.advanced_rules.list( domain_id=0, ) - assert_matches_type(SyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapAdvancedRule], advanced_rule, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -164,7 +162,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: ordering="id", phase="access", ) - assert_matches_type(SyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapAdvancedRule], advanced_rule, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -175,7 +173,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = response.parse() - assert_matches_type(SyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapAdvancedRule], advanced_rule, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -186,7 +184,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = response.parse() - assert_matches_type(SyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapAdvancedRule], advanced_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -230,7 +228,7 @@ def test_method_get(self, client: Gcore) -> None: rule_id=0, domain_id=0, ) - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -242,7 +240,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = response.parse() - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -254,7 +252,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = response.parse() - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -308,7 +306,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: name="name", source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", ) - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -331,7 +329,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> description="description", phase="access", ) - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -346,7 +344,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" advanced_rule = await response.parse() - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -361,7 +359,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = await response.parse() - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -428,7 +426,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: advanced_rule = await async_client.waap.domains.advanced_rules.list( domain_id=0, ) - assert_matches_type(AsyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapAdvancedRule], advanced_rule, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -443,7 +441,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No ordering="id", phase="access", ) - assert_matches_type(AsyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapAdvancedRule], advanced_rule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -454,7 +452,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = await response.parse() - assert_matches_type(AsyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapAdvancedRule], advanced_rule, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -465,7 +463,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = await response.parse() - assert_matches_type(AsyncOffsetPage[AdvancedRule], advanced_rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapAdvancedRule], advanced_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -509,7 +507,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: rule_id=0, domain_id=0, ) - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -521,7 +519,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = await response.parse() - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -533,7 +531,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = await response.parse() - assert_matches_type(AdvancedRule, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_analytics.py b/tests/api_resources/waap/domains/test_analytics.py new file mode 100644 index 00000000..a1e5067d --- /dev/null +++ b/tests/api_resources/waap/domains/test_analytics.py @@ -0,0 +1,399 @@ +# 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._utils import parse_datetime +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap import WaapDDOSInfo, WaapDDOSAttack, WaapEventStatistics +from gcore.types.waap.domains import ( + AnalyticsListEventTrafficResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAnalytics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_event_statistics(self, client: Gcore) -> None: + analytics = client.waap.domains.analytics.get_event_statistics( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(WaapEventStatistics, analytics, path=["response"]) + + @parametrize + def test_method_get_event_statistics_with_all_params(self, client: Gcore) -> None: + analytics = client.waap.domains.analytics.get_event_statistics( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + action=["block", "captcha"], + end=parse_datetime("2019-12-27T18:11:19.117Z"), + ip=["string", "string"], + reference_id=["string", "string"], + result=["passed", "blocked"], + ) + assert_matches_type(WaapEventStatistics, analytics, path=["response"]) + + @parametrize + def test_raw_response_get_event_statistics(self, client: Gcore) -> None: + response = client.waap.domains.analytics.with_raw_response.get_event_statistics( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + analytics = response.parse() + assert_matches_type(WaapEventStatistics, analytics, path=["response"]) + + @parametrize + def test_streaming_response_get_event_statistics(self, client: Gcore) -> None: + with client.waap.domains.analytics.with_streaming_response.get_event_statistics( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + analytics = response.parse() + assert_matches_type(WaapEventStatistics, analytics, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_ddos_attacks(self, client: Gcore) -> None: + analytics = client.waap.domains.analytics.list_ddos_attacks( + domain_id=0, + ) + assert_matches_type(SyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) + + @parametrize + def test_method_list_ddos_attacks_with_all_params(self, client: Gcore) -> None: + analytics = client.waap.domains.analytics.list_ddos_attacks( + domain_id=0, + end_time=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=0, + offset=0, + ordering="start_time", + start_time=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(SyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) + + @parametrize + def test_raw_response_list_ddos_attacks(self, client: Gcore) -> None: + response = client.waap.domains.analytics.with_raw_response.list_ddos_attacks( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + analytics = response.parse() + assert_matches_type(SyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) + + @parametrize + def test_streaming_response_list_ddos_attacks(self, client: Gcore) -> None: + with client.waap.domains.analytics.with_streaming_response.list_ddos_attacks( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + analytics = response.parse() + assert_matches_type(SyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_ddos_info(self, client: Gcore) -> None: + analytics = client.waap.domains.analytics.list_ddos_info( + domain_id=0, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(SyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) + + @parametrize + def test_method_list_ddos_info_with_all_params(self, client: Gcore) -> None: + analytics = client.waap.domains.analytics.list_ddos_info( + domain_id=0, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + end=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=0, + offset=0, + ) + assert_matches_type(SyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) + + @parametrize + def test_raw_response_list_ddos_info(self, client: Gcore) -> None: + response = client.waap.domains.analytics.with_raw_response.list_ddos_info( + domain_id=0, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + analytics = response.parse() + assert_matches_type(SyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) + + @parametrize + def test_streaming_response_list_ddos_info(self, client: Gcore) -> None: + with client.waap.domains.analytics.with_streaming_response.list_ddos_info( + domain_id=0, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + analytics = response.parse() + assert_matches_type(SyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_event_traffic(self, client: Gcore) -> None: + analytics = client.waap.domains.analytics.list_event_traffic( + domain_id=0, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) + + @parametrize + def test_method_list_event_traffic_with_all_params(self, client: Gcore) -> None: + analytics = client.waap.domains.analytics.list_event_traffic( + domain_id=0, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + end=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) + + @parametrize + def test_raw_response_list_event_traffic(self, client: Gcore) -> None: + response = client.waap.domains.analytics.with_raw_response.list_event_traffic( + domain_id=0, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + analytics = response.parse() + assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) + + @parametrize + def test_streaming_response_list_event_traffic(self, client: Gcore) -> None: + with client.waap.domains.analytics.with_streaming_response.list_event_traffic( + domain_id=0, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + analytics = response.parse() + assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncAnalytics: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_get_event_statistics(self, async_client: AsyncGcore) -> None: + analytics = await async_client.waap.domains.analytics.get_event_statistics( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(WaapEventStatistics, analytics, path=["response"]) + + @parametrize + async def test_method_get_event_statistics_with_all_params(self, async_client: AsyncGcore) -> None: + analytics = await async_client.waap.domains.analytics.get_event_statistics( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + action=["block", "captcha"], + end=parse_datetime("2019-12-27T18:11:19.117Z"), + ip=["string", "string"], + reference_id=["string", "string"], + result=["passed", "blocked"], + ) + assert_matches_type(WaapEventStatistics, analytics, path=["response"]) + + @parametrize + async def test_raw_response_get_event_statistics(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.analytics.with_raw_response.get_event_statistics( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + analytics = await response.parse() + assert_matches_type(WaapEventStatistics, analytics, path=["response"]) + + @parametrize + async def test_streaming_response_get_event_statistics(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.analytics.with_streaming_response.get_event_statistics( + domain_id=0, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + analytics = await response.parse() + assert_matches_type(WaapEventStatistics, analytics, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_ddos_attacks(self, async_client: AsyncGcore) -> None: + analytics = await async_client.waap.domains.analytics.list_ddos_attacks( + domain_id=0, + ) + assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) + + @parametrize + async def test_method_list_ddos_attacks_with_all_params(self, async_client: AsyncGcore) -> None: + analytics = await async_client.waap.domains.analytics.list_ddos_attacks( + domain_id=0, + end_time=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=0, + offset=0, + ordering="start_time", + start_time=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) + + @parametrize + async def test_raw_response_list_ddos_attacks(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.analytics.with_raw_response.list_ddos_attacks( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + analytics = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) + + @parametrize + async def test_streaming_response_list_ddos_attacks(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.analytics.with_streaming_response.list_ddos_attacks( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + analytics = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_ddos_info(self, async_client: AsyncGcore) -> None: + analytics = await async_client.waap.domains.analytics.list_ddos_info( + domain_id=0, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) + + @parametrize + async def test_method_list_ddos_info_with_all_params(self, async_client: AsyncGcore) -> None: + analytics = await async_client.waap.domains.analytics.list_ddos_info( + domain_id=0, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + end=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=0, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) + + @parametrize + async def test_raw_response_list_ddos_info(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.analytics.with_raw_response.list_ddos_info( + domain_id=0, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + analytics = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) + + @parametrize + async def test_streaming_response_list_ddos_info(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.analytics.with_streaming_response.list_ddos_info( + domain_id=0, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + analytics = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_event_traffic(self, async_client: AsyncGcore) -> None: + analytics = await async_client.waap.domains.analytics.list_event_traffic( + domain_id=0, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) + + @parametrize + async def test_method_list_event_traffic_with_all_params(self, async_client: AsyncGcore) -> None: + analytics = await async_client.waap.domains.analytics.list_event_traffic( + domain_id=0, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + end=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) + + @parametrize + async def test_raw_response_list_event_traffic(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.analytics.with_raw_response.list_event_traffic( + domain_id=0, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + analytics = await response.parse() + assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) + + @parametrize + async def test_streaming_response_list_event_traffic(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.analytics.with_streaming_response.list_event_traffic( + domain_id=0, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + analytics = await response.parse() + assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_api_discovery.py b/tests/api_resources/waap/domains/test_api_discovery.py new file mode 100644 index 00000000..0cc77d1f --- /dev/null +++ b/tests/api_resources/waap/domains/test_api_discovery.py @@ -0,0 +1,311 @@ +# 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.waap.domains import ( + APIDiscoveryGetSettingsResponse, + APIDiscoveryScanOpenAPIResponse, + APIDiscoveryUploadOpenAPIResponse, + APIDiscoveryUpdateSettingsResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAPIDiscovery: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_settings(self, client: Gcore) -> None: + api_discovery = client.waap.domains.api_discovery.get_settings( + 0, + ) + assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) + + @parametrize + def test_raw_response_get_settings(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.with_raw_response.get_settings( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_discovery = response.parse() + assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) + + @parametrize + def test_streaming_response_get_settings(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.with_streaming_response.get_settings( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_discovery = response.parse() + assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_scan_openapi(self, client: Gcore) -> None: + api_discovery = client.waap.domains.api_discovery.scan_openapi( + 0, + ) + assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) + + @parametrize + def test_raw_response_scan_openapi(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.with_raw_response.scan_openapi( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_discovery = response.parse() + assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) + + @parametrize + def test_streaming_response_scan_openapi(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.with_streaming_response.scan_openapi( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_discovery = response.parse() + assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update_settings(self, client: Gcore) -> None: + api_discovery = client.waap.domains.api_discovery.update_settings( + domain_id=0, + ) + assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + + @parametrize + def test_method_update_settings_with_all_params(self, client: Gcore) -> None: + api_discovery = client.waap.domains.api_discovery.update_settings( + domain_id=0, + description_file_location="descriptionFileLocation", + description_file_scan_enabled=True, + description_file_scan_interval_hours=1, + traffic_scan_enabled=True, + traffic_scan_interval_hours=1, + ) + assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + + @parametrize + def test_raw_response_update_settings(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.with_raw_response.update_settings( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_discovery = response.parse() + assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + + @parametrize + def test_streaming_response_update_settings(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.with_streaming_response.update_settings( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_discovery = response.parse() + assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_upload_openapi(self, client: Gcore) -> None: + api_discovery = client.waap.domains.api_discovery.upload_openapi( + domain_id=0, + file_data="file_data", + file_name="file_name", + ) + assert_matches_type(APIDiscoveryUploadOpenAPIResponse, api_discovery, path=["response"]) + + @parametrize + def test_raw_response_upload_openapi(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.with_raw_response.upload_openapi( + domain_id=0, + file_data="file_data", + file_name="file_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_discovery = response.parse() + assert_matches_type(APIDiscoveryUploadOpenAPIResponse, api_discovery, path=["response"]) + + @parametrize + def test_streaming_response_upload_openapi(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.with_streaming_response.upload_openapi( + domain_id=0, + file_data="file_data", + file_name="file_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_discovery = response.parse() + assert_matches_type(APIDiscoveryUploadOpenAPIResponse, api_discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncAPIDiscovery: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_get_settings(self, async_client: AsyncGcore) -> None: + api_discovery = await async_client.waap.domains.api_discovery.get_settings( + 0, + ) + assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) + + @parametrize + async def test_raw_response_get_settings(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.with_raw_response.get_settings( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_discovery = await response.parse() + assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) + + @parametrize + async def test_streaming_response_get_settings(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.with_streaming_response.get_settings( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_discovery = await response.parse() + assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_scan_openapi(self, async_client: AsyncGcore) -> None: + api_discovery = await async_client.waap.domains.api_discovery.scan_openapi( + 0, + ) + assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) + + @parametrize + async def test_raw_response_scan_openapi(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.with_raw_response.scan_openapi( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_discovery = await response.parse() + assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) + + @parametrize + async def test_streaming_response_scan_openapi(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.with_streaming_response.scan_openapi( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_discovery = await response.parse() + assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update_settings(self, async_client: AsyncGcore) -> None: + api_discovery = await async_client.waap.domains.api_discovery.update_settings( + domain_id=0, + ) + assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + + @parametrize + async def test_method_update_settings_with_all_params(self, async_client: AsyncGcore) -> None: + api_discovery = await async_client.waap.domains.api_discovery.update_settings( + domain_id=0, + description_file_location="descriptionFileLocation", + description_file_scan_enabled=True, + description_file_scan_interval_hours=1, + traffic_scan_enabled=True, + traffic_scan_interval_hours=1, + ) + assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + + @parametrize + async def test_raw_response_update_settings(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.with_raw_response.update_settings( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_discovery = await response.parse() + assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + + @parametrize + async def test_streaming_response_update_settings(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.with_streaming_response.update_settings( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_discovery = await response.parse() + assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_upload_openapi(self, async_client: AsyncGcore) -> None: + api_discovery = await async_client.waap.domains.api_discovery.upload_openapi( + domain_id=0, + file_data="file_data", + file_name="file_name", + ) + assert_matches_type(APIDiscoveryUploadOpenAPIResponse, api_discovery, path=["response"]) + + @parametrize + async def test_raw_response_upload_openapi(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.with_raw_response.upload_openapi( + domain_id=0, + file_data="file_data", + file_name="file_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_discovery = await response.parse() + assert_matches_type(APIDiscoveryUploadOpenAPIResponse, api_discovery, path=["response"]) + + @parametrize + async def test_streaming_response_upload_openapi(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.with_streaming_response.upload_openapi( + domain_id=0, + file_data="file_data", + file_name="file_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_discovery = await response.parse() + assert_matches_type(APIDiscoveryUploadOpenAPIResponse, api_discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_api_path_groups.py b/tests/api_resources/waap/domains/test_api_path_groups.py new file mode 100644 index 00000000..39767b29 --- /dev/null +++ b/tests/api_resources/waap/domains/test_api_path_groups.py @@ -0,0 +1,84 @@ +# 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.waap.domains import APIPathGroupListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAPIPathGroups: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + api_path_group = client.waap.domains.api_path_groups.list( + 0, + ) + assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.domains.api_path_groups.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_path_group = response.parse() + assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.domains.api_path_groups.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_path_group = response.parse() + assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncAPIPathGroups: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + api_path_group = await async_client.waap.domains.api_path_groups.list( + 0, + ) + assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_path_groups.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_path_group = await response.parse() + assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_path_groups.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_path_group = await response.parse() + assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_api_paths.py b/tests/api_resources/waap/domains/test_api_paths.py new file mode 100644 index 00000000..76b67fdd --- /dev/null +++ b/tests/api_resources/waap/domains/test_api_paths.py @@ -0,0 +1,507 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap.domains import ( + APIPathGetResponse, + APIPathListResponse, + APIPathCreateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAPIPaths: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + api_path = client.waap.domains.api_paths.create( + domain_id=0, + http_scheme="HTTP", + method="GET", + path="/api/v1/paths/{path_id}", + ) + assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + api_path = client.waap.domains.api_paths.create( + domain_id=0, + http_scheme="HTTP", + method="GET", + path="/api/v1/paths/{path_id}", + api_groups=["accounts", "internal"], + api_version="v1", + tags=["sensitivedataurl", "highriskurl"], + ) + assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.waap.domains.api_paths.with_raw_response.create( + domain_id=0, + http_scheme="HTTP", + method="GET", + path="/api/v1/paths/{path_id}", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_path = response.parse() + assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.waap.domains.api_paths.with_streaming_response.create( + domain_id=0, + http_scheme="HTTP", + method="GET", + path="/api/v1/paths/{path_id}", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_path = response.parse() + assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + api_path = client.waap.domains.api_paths.update( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + assert api_path is None + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + api_path = client.waap.domains.api_paths.update( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + api_groups=["accounts", "internal"], + path="/api/v1/paths/{path_id}", + status="CONFIRMED_API", + tags=["sensitivedataurl", "highriskurl"], + ) + assert api_path is None + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.waap.domains.api_paths.with_raw_response.update( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_path = response.parse() + assert api_path is None + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.waap.domains.api_paths.with_streaming_response.update( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_path = response.parse() + assert api_path is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): + client.waap.domains.api_paths.with_raw_response.update( + path_id="", + domain_id=0, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + api_path = client.waap.domains.api_paths.list( + domain_id=0, + ) + assert_matches_type(SyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + api_path = client.waap.domains.api_paths.list( + domain_id=0, + api_group="api_group", + api_version="api_version", + http_scheme="HTTP", + ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + limit=0, + method="GET", + offset=0, + ordering="id", + path="path", + source="API_DESCRIPTION_FILE", + status=["CONFIRMED_API", "POTENTIAL_API"], + ) + assert_matches_type(SyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.domains.api_paths.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_path = response.parse() + assert_matches_type(SyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.domains.api_paths.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_path = response.parse() + assert_matches_type(SyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + api_path = client.waap.domains.api_paths.delete( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + assert api_path is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.waap.domains.api_paths.with_raw_response.delete( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_path = response.parse() + assert api_path is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.waap.domains.api_paths.with_streaming_response.delete( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_path = response.parse() + assert api_path is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): + client.waap.domains.api_paths.with_raw_response.delete( + path_id="", + domain_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + api_path = client.waap.domains.api_paths.get( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + assert_matches_type(APIPathGetResponse, api_path, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.domains.api_paths.with_raw_response.get( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_path = response.parse() + assert_matches_type(APIPathGetResponse, api_path, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.domains.api_paths.with_streaming_response.get( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_path = response.parse() + assert_matches_type(APIPathGetResponse, api_path, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): + client.waap.domains.api_paths.with_raw_response.get( + path_id="", + domain_id=0, + ) + + +class TestAsyncAPIPaths: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + api_path = await async_client.waap.domains.api_paths.create( + domain_id=0, + http_scheme="HTTP", + method="GET", + path="/api/v1/paths/{path_id}", + ) + assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + api_path = await async_client.waap.domains.api_paths.create( + domain_id=0, + http_scheme="HTTP", + method="GET", + path="/api/v1/paths/{path_id}", + api_groups=["accounts", "internal"], + api_version="v1", + tags=["sensitivedataurl", "highriskurl"], + ) + assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_paths.with_raw_response.create( + domain_id=0, + http_scheme="HTTP", + method="GET", + path="/api/v1/paths/{path_id}", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_path = await response.parse() + assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_paths.with_streaming_response.create( + domain_id=0, + http_scheme="HTTP", + method="GET", + path="/api/v1/paths/{path_id}", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_path = await response.parse() + assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + api_path = await async_client.waap.domains.api_paths.update( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + assert api_path is None + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + api_path = await async_client.waap.domains.api_paths.update( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + api_groups=["accounts", "internal"], + path="/api/v1/paths/{path_id}", + status="CONFIRMED_API", + tags=["sensitivedataurl", "highriskurl"], + ) + assert api_path is None + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_paths.with_raw_response.update( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_path = await response.parse() + assert api_path is None + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_paths.with_streaming_response.update( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_path = await response.parse() + assert api_path is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): + await async_client.waap.domains.api_paths.with_raw_response.update( + path_id="", + domain_id=0, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + api_path = await async_client.waap.domains.api_paths.list( + domain_id=0, + ) + assert_matches_type(AsyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + api_path = await async_client.waap.domains.api_paths.list( + domain_id=0, + api_group="api_group", + api_version="api_version", + http_scheme="HTTP", + ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + limit=0, + method="GET", + offset=0, + ordering="id", + path="path", + source="API_DESCRIPTION_FILE", + status=["CONFIRMED_API", "POTENTIAL_API"], + ) + assert_matches_type(AsyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_paths.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_path = await response.parse() + assert_matches_type(AsyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_paths.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_path = await response.parse() + assert_matches_type(AsyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + api_path = await async_client.waap.domains.api_paths.delete( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + assert api_path is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_paths.with_raw_response.delete( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_path = await response.parse() + assert api_path is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_paths.with_streaming_response.delete( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_path = await response.parse() + assert api_path is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): + await async_client.waap.domains.api_paths.with_raw_response.delete( + path_id="", + domain_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + api_path = await async_client.waap.domains.api_paths.get( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + assert_matches_type(APIPathGetResponse, api_path, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_paths.with_raw_response.get( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_path = await response.parse() + assert_matches_type(APIPathGetResponse, api_path, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_paths.with_streaming_response.get( + path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_path = await response.parse() + assert_matches_type(APIPathGetResponse, api_path, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): + await async_client.waap.domains.api_paths.with_raw_response.get( + path_id="", + domain_id=0, + ) diff --git a/tests/api_resources/waap/domains/test_custom_rules.py b/tests/api_resources/waap/domains/test_custom_rules.py index 5ee19b55..181f5843 100644 --- a/tests/api_resources/waap/domains/test_custom_rules.py +++ b/tests/api_resources/waap/domains/test_custom_rules.py @@ -10,9 +10,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.waap.domains import ( - CustomRule, -) +from gcore.types.waap import WaapCustomRule base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_create(self, client: Gcore) -> None: enabled=True, name="name", ) - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -137,7 +135,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: name="name", description="description", ) - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -152,7 +150,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" custom_rule = response.parse() - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -167,7 +165,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_rule = response.parse() - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -319,7 +317,7 @@ def test_method_list(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.list( domain_id=0, ) - assert_matches_type(SyncOffsetPage[CustomRule], custom_rule, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapCustomRule], custom_rule, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -333,7 +331,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: offset=0, ordering="-id", ) - assert_matches_type(SyncOffsetPage[CustomRule], custom_rule, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapCustomRule], custom_rule, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -344,7 +342,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_rule = response.parse() - assert_matches_type(SyncOffsetPage[CustomRule], custom_rule, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapCustomRule], custom_rule, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -355,7 +353,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_rule = response.parse() - assert_matches_type(SyncOffsetPage[CustomRule], custom_rule, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapCustomRule], custom_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -433,7 +431,7 @@ def test_method_get(self, client: Gcore) -> None: rule_id=0, domain_id=0, ) - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -445,7 +443,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_rule = response.parse() - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -457,7 +455,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_rule = response.parse() - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -511,7 +509,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: enabled=True, name="name", ) - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -619,7 +617,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> name="name", description="description", ) - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -634,7 +632,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" custom_rule = await response.parse() - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -649,7 +647,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_rule = await response.parse() - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -801,7 +799,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: custom_rule = await async_client.waap.domains.custom_rules.list( domain_id=0, ) - assert_matches_type(AsyncOffsetPage[CustomRule], custom_rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapCustomRule], custom_rule, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -815,7 +813,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No offset=0, ordering="-id", ) - assert_matches_type(AsyncOffsetPage[CustomRule], custom_rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapCustomRule], custom_rule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -826,7 +824,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_rule = await response.parse() - assert_matches_type(AsyncOffsetPage[CustomRule], custom_rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapCustomRule], custom_rule, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -837,7 +835,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_rule = await response.parse() - assert_matches_type(AsyncOffsetPage[CustomRule], custom_rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapCustomRule], custom_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -915,7 +913,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: rule_id=0, domain_id=0, ) - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -927,7 +925,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_rule = await response.parse() - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -939,7 +937,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_rule = await response.parse() - assert_matches_type(CustomRule, custom_rule, path=["response"]) + assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_firewall_rules.py b/tests/api_resources/waap/domains/test_firewall_rules.py index 6ef02a16..5aeb5fd6 100644 --- a/tests/api_resources/waap/domains/test_firewall_rules.py +++ b/tests/api_resources/waap/domains/test_firewall_rules.py @@ -10,9 +10,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.waap.domains import ( - FirewallRule, -) +from gcore.types.waap import WaapFirewallRule base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +27,7 @@ def test_method_create(self, client: Gcore) -> None: enabled=True, name="name", ) - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -59,7 +57,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: name="name", description="description", ) - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -74,7 +72,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" firewall_rule = response.parse() - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -89,7 +87,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall_rule = response.parse() - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -163,7 +161,7 @@ def test_method_list(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.list( domain_id=0, ) - assert_matches_type(SyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapFirewallRule], firewall_rule, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -177,7 +175,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: offset=0, ordering="-id", ) - assert_matches_type(SyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapFirewallRule], firewall_rule, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -188,7 +186,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall_rule = response.parse() - assert_matches_type(SyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapFirewallRule], firewall_rule, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -199,7 +197,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall_rule = response.parse() - assert_matches_type(SyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapFirewallRule], firewall_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -277,7 +275,7 @@ def test_method_get(self, client: Gcore) -> None: rule_id=0, domain_id=0, ) - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -289,7 +287,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall_rule = response.parse() - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -301,7 +299,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall_rule = response.parse() - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -355,7 +353,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: enabled=True, name="name", ) - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -385,7 +383,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> name="name", description="description", ) - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -400,7 +398,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" firewall_rule = await response.parse() - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -415,7 +413,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall_rule = await response.parse() - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -489,7 +487,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: firewall_rule = await async_client.waap.domains.firewall_rules.list( domain_id=0, ) - assert_matches_type(AsyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapFirewallRule], firewall_rule, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -503,7 +501,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No offset=0, ordering="-id", ) - assert_matches_type(AsyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapFirewallRule], firewall_rule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -514,7 +512,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall_rule = await response.parse() - assert_matches_type(AsyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapFirewallRule], firewall_rule, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -525,7 +523,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall_rule = await response.parse() - assert_matches_type(AsyncOffsetPage[FirewallRule], firewall_rule, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapFirewallRule], firewall_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -603,7 +601,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: rule_id=0, domain_id=0, ) - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -615,7 +613,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall_rule = await response.parse() - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -627,7 +625,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" firewall_rule = await response.parse() - assert_matches_type(FirewallRule, firewall_rule, path=["response"]) + assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_insight_silences.py b/tests/api_resources/waap/domains/test_insight_silences.py new file mode 100644 index 00000000..9d90ce31 --- /dev/null +++ b/tests/api_resources/waap/domains/test_insight_silences.py @@ -0,0 +1,524 @@ +# 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._utils import parse_datetime +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap import WaapInsightSilence + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInsightSilences: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + insight_silence = client.waap.domains.insight_silences.create( + domain_id=0, + author="author", + comment="comment", + insight_type="insight_type", + labels={"foo": "string"}, + ) + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + insight_silence = client.waap.domains.insight_silences.create( + domain_id=0, + author="author", + comment="comment", + insight_type="insight_type", + labels={"foo": "string"}, + expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.waap.domains.insight_silences.with_raw_response.create( + domain_id=0, + author="author", + comment="comment", + insight_type="insight_type", + labels={"foo": "string"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight_silence = response.parse() + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.waap.domains.insight_silences.with_streaming_response.create( + domain_id=0, + author="author", + comment="comment", + insight_type="insight_type", + labels={"foo": "string"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight_silence = response.parse() + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + insight_silence = client.waap.domains.insight_silences.update( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + author="author", + comment="comment", + expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + insight_silence = client.waap.domains.insight_silences.update( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + author="author", + comment="comment", + expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), + labels={"foo": "string"}, + ) + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.waap.domains.insight_silences.with_raw_response.update( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + author="author", + comment="comment", + expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight_silence = response.parse() + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.waap.domains.insight_silences.with_streaming_response.update( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + author="author", + comment="comment", + expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight_silence = response.parse() + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `silence_id` but received ''"): + client.waap.domains.insight_silences.with_raw_response.update( + silence_id="", + domain_id=0, + author="author", + comment="comment", + expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + insight_silence = client.waap.domains.insight_silences.list( + domain_id=0, + ) + assert_matches_type(SyncOffsetPage[WaapInsightSilence], insight_silence, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + insight_silence = client.waap.domains.insight_silences.list( + domain_id=0, + id=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + author="author", + comment="comment", + insight_type=["string", "string"], + limit=0, + offset=0, + ordering="id", + ) + assert_matches_type(SyncOffsetPage[WaapInsightSilence], insight_silence, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.domains.insight_silences.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight_silence = response.parse() + assert_matches_type(SyncOffsetPage[WaapInsightSilence], insight_silence, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.domains.insight_silences.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight_silence = response.parse() + assert_matches_type(SyncOffsetPage[WaapInsightSilence], insight_silence, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + insight_silence = client.waap.domains.insight_silences.delete( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + assert insight_silence is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.waap.domains.insight_silences.with_raw_response.delete( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight_silence = response.parse() + assert insight_silence is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.waap.domains.insight_silences.with_streaming_response.delete( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight_silence = response.parse() + assert insight_silence is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `silence_id` but received ''"): + client.waap.domains.insight_silences.with_raw_response.delete( + silence_id="", + domain_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + insight_silence = client.waap.domains.insight_silences.get( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.domains.insight_silences.with_raw_response.get( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight_silence = response.parse() + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.domains.insight_silences.with_streaming_response.get( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight_silence = response.parse() + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `silence_id` but received ''"): + client.waap.domains.insight_silences.with_raw_response.get( + silence_id="", + domain_id=0, + ) + + +class TestAsyncInsightSilences: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + insight_silence = await async_client.waap.domains.insight_silences.create( + domain_id=0, + author="author", + comment="comment", + insight_type="insight_type", + labels={"foo": "string"}, + ) + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + insight_silence = await async_client.waap.domains.insight_silences.create( + domain_id=0, + author="author", + comment="comment", + insight_type="insight_type", + labels={"foo": "string"}, + expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.insight_silences.with_raw_response.create( + domain_id=0, + author="author", + comment="comment", + insight_type="insight_type", + labels={"foo": "string"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight_silence = await response.parse() + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.insight_silences.with_streaming_response.create( + domain_id=0, + author="author", + comment="comment", + insight_type="insight_type", + labels={"foo": "string"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight_silence = await response.parse() + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + insight_silence = await async_client.waap.domains.insight_silences.update( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + author="author", + comment="comment", + expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + insight_silence = await async_client.waap.domains.insight_silences.update( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + author="author", + comment="comment", + expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), + labels={"foo": "string"}, + ) + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.insight_silences.with_raw_response.update( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + author="author", + comment="comment", + expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight_silence = await response.parse() + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.insight_silences.with_streaming_response.update( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + author="author", + comment="comment", + expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight_silence = await response.parse() + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `silence_id` but received ''"): + await async_client.waap.domains.insight_silences.with_raw_response.update( + silence_id="", + domain_id=0, + author="author", + comment="comment", + expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + insight_silence = await async_client.waap.domains.insight_silences.list( + domain_id=0, + ) + assert_matches_type(AsyncOffsetPage[WaapInsightSilence], insight_silence, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + insight_silence = await async_client.waap.domains.insight_silences.list( + domain_id=0, + id=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + author="author", + comment="comment", + insight_type=["string", "string"], + limit=0, + offset=0, + ordering="id", + ) + assert_matches_type(AsyncOffsetPage[WaapInsightSilence], insight_silence, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.insight_silences.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight_silence = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapInsightSilence], insight_silence, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.insight_silences.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight_silence = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapInsightSilence], insight_silence, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + insight_silence = await async_client.waap.domains.insight_silences.delete( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + assert insight_silence is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.insight_silences.with_raw_response.delete( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight_silence = await response.parse() + assert insight_silence is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.insight_silences.with_streaming_response.delete( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight_silence = await response.parse() + assert insight_silence is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `silence_id` but received ''"): + await async_client.waap.domains.insight_silences.with_raw_response.delete( + silence_id="", + domain_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + insight_silence = await async_client.waap.domains.insight_silences.get( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.insight_silences.with_raw_response.get( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight_silence = await response.parse() + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.insight_silences.with_streaming_response.get( + silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight_silence = await response.parse() + assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `silence_id` but received ''"): + await async_client.waap.domains.insight_silences.with_raw_response.get( + silence_id="", + domain_id=0, + ) diff --git a/tests/api_resources/waap/domains/test_insights.py b/tests/api_resources/waap/domains/test_insights.py new file mode 100644 index 00000000..b9c262cc --- /dev/null +++ b/tests/api_resources/waap/domains/test_insights.py @@ -0,0 +1,289 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap import WaapInsight + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInsights: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + insight = client.waap.domains.insights.list( + domain_id=0, + ) + assert_matches_type(SyncOffsetPage[WaapInsight], insight, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + insight = client.waap.domains.insights.list( + domain_id=0, + id=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + description="description", + insight_type=["string", "string"], + limit=0, + offset=0, + ordering="id", + status=["OPEN", "ACKED"], + ) + assert_matches_type(SyncOffsetPage[WaapInsight], insight, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.domains.insights.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight = response.parse() + assert_matches_type(SyncOffsetPage[WaapInsight], insight, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.domains.insights.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight = response.parse() + assert_matches_type(SyncOffsetPage[WaapInsight], insight, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + insight = client.waap.domains.insights.get( + insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + assert_matches_type(WaapInsight, insight, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.domains.insights.with_raw_response.get( + insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight = response.parse() + assert_matches_type(WaapInsight, insight, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.domains.insights.with_streaming_response.get( + insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight = response.parse() + assert_matches_type(WaapInsight, insight, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `insight_id` but received ''"): + client.waap.domains.insights.with_raw_response.get( + insight_id="", + domain_id=0, + ) + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + insight = client.waap.domains.insights.replace( + insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + status="OPEN", + ) + assert_matches_type(WaapInsight, insight, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.waap.domains.insights.with_raw_response.replace( + insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + status="OPEN", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight = response.parse() + assert_matches_type(WaapInsight, insight, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.waap.domains.insights.with_streaming_response.replace( + insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + status="OPEN", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight = response.parse() + assert_matches_type(WaapInsight, insight, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_replace(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `insight_id` but received ''"): + client.waap.domains.insights.with_raw_response.replace( + insight_id="", + domain_id=0, + status="OPEN", + ) + + +class TestAsyncInsights: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + insight = await async_client.waap.domains.insights.list( + domain_id=0, + ) + assert_matches_type(AsyncOffsetPage[WaapInsight], insight, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + insight = await async_client.waap.domains.insights.list( + domain_id=0, + id=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + description="description", + insight_type=["string", "string"], + limit=0, + offset=0, + ordering="id", + status=["OPEN", "ACKED"], + ) + assert_matches_type(AsyncOffsetPage[WaapInsight], insight, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.insights.with_raw_response.list( + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapInsight], insight, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.insights.with_streaming_response.list( + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapInsight], insight, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + insight = await async_client.waap.domains.insights.get( + insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + assert_matches_type(WaapInsight, insight, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.insights.with_raw_response.get( + insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight = await response.parse() + assert_matches_type(WaapInsight, insight, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.insights.with_streaming_response.get( + insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight = await response.parse() + assert_matches_type(WaapInsight, insight, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `insight_id` but received ''"): + await async_client.waap.domains.insights.with_raw_response.get( + insight_id="", + domain_id=0, + ) + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + insight = await async_client.waap.domains.insights.replace( + insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + status="OPEN", + ) + assert_matches_type(WaapInsight, insight, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.insights.with_raw_response.replace( + insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + status="OPEN", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight = await response.parse() + assert_matches_type(WaapInsight, insight, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.insights.with_streaming_response.replace( + insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + domain_id=0, + status="OPEN", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight = await response.parse() + assert_matches_type(WaapInsight, insight, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_replace(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `insight_id` but received ''"): + await async_client.waap.domains.insights.with_raw_response.replace( + insight_id="", + domain_id=0, + status="OPEN", + ) diff --git a/tests/api_resources/waap/domains/test_policies.py b/tests/api_resources/waap/domains/test_policies.py new file mode 100644 index 00000000..8686f7f4 --- /dev/null +++ b/tests/api_resources/waap/domains/test_policies.py @@ -0,0 +1,106 @@ +# 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.waap import WaapPolicyMode + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPolicies: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_toggle(self, client: Gcore) -> None: + policy = client.waap.domains.policies.toggle( + policy_id="policy_id", + domain_id=0, + ) + assert_matches_type(WaapPolicyMode, policy, path=["response"]) + + @parametrize + def test_raw_response_toggle(self, client: Gcore) -> None: + response = client.waap.domains.policies.with_raw_response.toggle( + policy_id="policy_id", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(WaapPolicyMode, policy, path=["response"]) + + @parametrize + def test_streaming_response_toggle(self, client: Gcore) -> None: + with client.waap.domains.policies.with_streaming_response.toggle( + policy_id="policy_id", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(WaapPolicyMode, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_toggle(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): + client.waap.domains.policies.with_raw_response.toggle( + policy_id="", + domain_id=0, + ) + + +class TestAsyncPolicies: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_toggle(self, async_client: AsyncGcore) -> None: + policy = await async_client.waap.domains.policies.toggle( + policy_id="policy_id", + domain_id=0, + ) + assert_matches_type(WaapPolicyMode, policy, path=["response"]) + + @parametrize + async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.policies.with_raw_response.toggle( + policy_id="policy_id", + domain_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(WaapPolicyMode, policy, path=["response"]) + + @parametrize + async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.policies.with_streaming_response.toggle( + policy_id="policy_id", + domain_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(WaapPolicyMode, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_toggle(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): + await async_client.waap.domains.policies.with_raw_response.toggle( + policy_id="", + domain_id=0, + ) diff --git a/tests/api_resources/waap/domains/test_settings.py b/tests/api_resources/waap/domains/test_settings.py index 4bc88a4c..55ebebf3 100644 --- a/tests/api_resources/waap/domains/test_settings.py +++ b/tests/api_resources/waap/domains/test_settings.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.waap import WaapDomainSettings +from gcore.types.waap import WaapDomainSettingsModel base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -68,7 +68,7 @@ def test_method_get(self, client: Gcore) -> None: setting = client.waap.domains.settings.get( 0, ) - assert_matches_type(WaapDomainSettings, setting, path=["response"]) + assert_matches_type(WaapDomainSettingsModel, setting, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -79,7 +79,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(WaapDomainSettings, setting, path=["response"]) + assert_matches_type(WaapDomainSettingsModel, setting, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -90,7 +90,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = response.parse() - assert_matches_type(WaapDomainSettings, setting, path=["response"]) + assert_matches_type(WaapDomainSettingsModel, setting, path=["response"]) assert cast(Any, response.is_closed) is True @@ -149,7 +149,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: setting = await async_client.waap.domains.settings.get( 0, ) - assert_matches_type(WaapDomainSettings, setting, path=["response"]) + assert_matches_type(WaapDomainSettingsModel, setting, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -160,7 +160,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(WaapDomainSettings, setting, path=["response"]) + assert_matches_type(WaapDomainSettingsModel, setting, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -171,6 +171,6 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" setting = await response.parse() - assert_matches_type(WaapDomainSettings, setting, path=["response"]) + assert_matches_type(WaapDomainSettingsModel, setting, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_advanced_rules.py b/tests/api_resources/waap/test_advanced_rules.py index 3e4c03ca..14744da2 100644 --- a/tests/api_resources/waap/test_advanced_rules.py +++ b/tests/api_resources/waap/test_advanced_rules.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.waap import AdvancedRuleDescriptorList +from gcore.types.waap import WaapAdvancedRuleDescriptorList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,7 +20,7 @@ class TestAdvancedRules: @parametrize def test_method_list(self, client: Gcore) -> None: advanced_rule = client.waap.advanced_rules.list() - assert_matches_type(AdvancedRuleDescriptorList, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRuleDescriptorList, advanced_rule, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -29,7 +29,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = response.parse() - assert_matches_type(AdvancedRuleDescriptorList, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRuleDescriptorList, advanced_rule, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -38,7 +38,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = response.parse() - assert_matches_type(AdvancedRuleDescriptorList, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRuleDescriptorList, advanced_rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -49,7 +49,7 @@ class TestAsyncAdvancedRules: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: advanced_rule = await async_client.waap.advanced_rules.list() - assert_matches_type(AdvancedRuleDescriptorList, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRuleDescriptorList, advanced_rule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -58,7 +58,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = await response.parse() - assert_matches_type(AdvancedRuleDescriptorList, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRuleDescriptorList, advanced_rule, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -67,6 +67,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" advanced_rule = await response.parse() - assert_matches_type(AdvancedRuleDescriptorList, advanced_rule, path=["response"]) + assert_matches_type(WaapAdvancedRuleDescriptorList, advanced_rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_clients.py b/tests/api_resources/waap/test_clients.py new file mode 100644 index 00000000..d7d83c47 --- /dev/null +++ b/tests/api_resources/waap/test_clients.py @@ -0,0 +1,72 @@ +# 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.waap import ClientMeResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestClients: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_me(self, client: Gcore) -> None: + client_ = client.waap.clients.me() + assert_matches_type(ClientMeResponse, client_, path=["response"]) + + @parametrize + def test_raw_response_me(self, client: Gcore) -> None: + response = client.waap.clients.with_raw_response.me() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client_ = response.parse() + assert_matches_type(ClientMeResponse, client_, path=["response"]) + + @parametrize + def test_streaming_response_me(self, client: Gcore) -> None: + with client.waap.clients.with_streaming_response.me() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client_ = response.parse() + assert_matches_type(ClientMeResponse, client_, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncClients: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_me(self, async_client: AsyncGcore) -> None: + client = await async_client.waap.clients.me() + assert_matches_type(ClientMeResponse, client, path=["response"]) + + @parametrize + async def test_raw_response_me(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.clients.with_raw_response.me() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client = await response.parse() + assert_matches_type(ClientMeResponse, client, path=["response"]) + + @parametrize + async def test_streaming_response_me(self, async_client: AsyncGcore) -> None: + async with async_client.waap.clients.with_streaming_response.me() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client = await response.parse() + assert_matches_type(ClientMeResponse, client, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_custom_page_sets.py b/tests/api_resources/waap/test_custom_page_sets.py index 94ff1b2c..68fda447 100644 --- a/tests/api_resources/waap/test_custom_page_sets.py +++ b/tests/api_resources/waap/test_custom_page_sets.py @@ -11,8 +11,8 @@ from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.waap import ( - CustomPageSet, - PreviewCustomPage, + WaapCustomPageSet, + WaapCustomPagePreview, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +26,7 @@ def test_method_create(self, client: Gcore) -> None: custom_page_set = client.waap.custom_page_sets.create( name="x", ) - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -72,7 +72,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "text": "xxxxxxxxxxxxxxxxxxxx", }, ) - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -83,7 +83,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" custom_page_set = response.parse() - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -94,7 +94,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = response.parse() - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) assert cast(Any, response.is_closed) is True @@ -179,7 +179,7 @@ def test_streaming_response_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: custom_page_set = client.waap.custom_page_sets.list() - assert_matches_type(SyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapCustomPageSet], custom_page_set, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -190,7 +190,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: offset=0, ordering="name", ) - assert_matches_type(SyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapCustomPageSet], custom_page_set, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -199,7 +199,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = response.parse() - assert_matches_type(SyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapCustomPageSet], custom_page_set, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -208,7 +208,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = response.parse() - assert_matches_type(SyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapCustomPageSet], custom_page_set, path=["response"]) assert cast(Any, response.is_closed) is True @@ -248,7 +248,7 @@ def test_method_get(self, client: Gcore) -> None: custom_page_set = client.waap.custom_page_sets.get( 0, ) - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -259,7 +259,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = response.parse() - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -270,7 +270,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = response.parse() - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) assert cast(Any, response.is_closed) is True @@ -279,7 +279,7 @@ def test_method_preview(self, client: Gcore) -> None: custom_page_set = client.waap.custom_page_sets.preview( page_type="block.html", ) - assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPagePreview, custom_page_set, path=["response"]) @parametrize def test_method_preview_with_all_params(self, client: Gcore) -> None: @@ -291,7 +291,7 @@ def test_method_preview_with_all_params(self, client: Gcore) -> None: text="xxxxxxxxxxxxxxxxxxxx", title="xxx", ) - assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPagePreview, custom_page_set, path=["response"]) @parametrize def test_raw_response_preview(self, client: Gcore) -> None: @@ -302,7 +302,7 @@ def test_raw_response_preview(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = response.parse() - assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPagePreview, custom_page_set, path=["response"]) @parametrize def test_streaming_response_preview(self, client: Gcore) -> None: @@ -313,7 +313,7 @@ def test_streaming_response_preview(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = response.parse() - assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPagePreview, custom_page_set, path=["response"]) assert cast(Any, response.is_closed) is True @@ -326,7 +326,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: custom_page_set = await async_client.waap.custom_page_sets.create( name="x", ) - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -372,7 +372,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "text": "xxxxxxxxxxxxxxxxxxxx", }, ) - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -383,7 +383,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" custom_page_set = await response.parse() - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -394,7 +394,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = await response.parse() - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) assert cast(Any, response.is_closed) is True @@ -479,7 +479,7 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: custom_page_set = await async_client.waap.custom_page_sets.list() - assert_matches_type(AsyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapCustomPageSet], custom_page_set, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -490,7 +490,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No offset=0, ordering="name", ) - assert_matches_type(AsyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapCustomPageSet], custom_page_set, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -499,7 +499,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = await response.parse() - assert_matches_type(AsyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapCustomPageSet], custom_page_set, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -508,7 +508,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = await response.parse() - assert_matches_type(AsyncOffsetPage[CustomPageSet], custom_page_set, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapCustomPageSet], custom_page_set, path=["response"]) assert cast(Any, response.is_closed) is True @@ -548,7 +548,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: custom_page_set = await async_client.waap.custom_page_sets.get( 0, ) - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -559,7 +559,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = await response.parse() - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -570,7 +570,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = await response.parse() - assert_matches_type(CustomPageSet, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPageSet, custom_page_set, path=["response"]) assert cast(Any, response.is_closed) is True @@ -579,7 +579,7 @@ async def test_method_preview(self, async_client: AsyncGcore) -> None: custom_page_set = await async_client.waap.custom_page_sets.preview( page_type="block.html", ) - assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPagePreview, custom_page_set, path=["response"]) @parametrize async def test_method_preview_with_all_params(self, async_client: AsyncGcore) -> None: @@ -591,7 +591,7 @@ async def test_method_preview_with_all_params(self, async_client: AsyncGcore) -> text="xxxxxxxxxxxxxxxxxxxx", title="xxx", ) - assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPagePreview, custom_page_set, path=["response"]) @parametrize async def test_raw_response_preview(self, async_client: AsyncGcore) -> None: @@ -602,7 +602,7 @@ async def test_raw_response_preview(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = await response.parse() - assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPagePreview, custom_page_set, path=["response"]) @parametrize async def test_streaming_response_preview(self, async_client: AsyncGcore) -> None: @@ -613,6 +613,6 @@ async def test_streaming_response_preview(self, async_client: AsyncGcore) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page_set = await response.parse() - assert_matches_type(PreviewCustomPage, custom_page_set, path=["response"]) + assert_matches_type(WaapCustomPagePreview, custom_page_set, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_domains.py b/tests/api_resources/waap/test_domains.py index 1f670c8e..196db9f7 100644 --- a/tests/api_resources/waap/test_domains.py +++ b/tests/api_resources/waap/test_domains.py @@ -13,6 +13,7 @@ from gcore.types.waap import ( WaapSummaryDomain, WaapDetailedDomain, + DomainListRuleSetsResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -159,6 +160,37 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_list_rule_sets(self, client: Gcore) -> None: + domain = client.waap.domains.list_rule_sets( + 0, + ) + assert_matches_type(DomainListRuleSetsResponse, domain, path=["response"]) + + @parametrize + def test_raw_response_list_rule_sets(self, client: Gcore) -> None: + response = client.waap.domains.with_raw_response.list_rule_sets( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + domain = response.parse() + assert_matches_type(DomainListRuleSetsResponse, domain, path=["response"]) + + @parametrize + def test_streaming_response_list_rule_sets(self, client: Gcore) -> None: + with client.waap.domains.with_streaming_response.list_rule_sets( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + domain = response.parse() + assert_matches_type(DomainListRuleSetsResponse, domain, path=["response"]) + + assert cast(Any, response.is_closed) is True + class TestAsyncDomains: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -300,3 +332,34 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert_matches_type(WaapDetailedDomain, domain, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_rule_sets(self, async_client: AsyncGcore) -> None: + domain = await async_client.waap.domains.list_rule_sets( + 0, + ) + assert_matches_type(DomainListRuleSetsResponse, domain, path=["response"]) + + @parametrize + async def test_raw_response_list_rule_sets(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.with_raw_response.list_rule_sets( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + domain = await response.parse() + assert_matches_type(DomainListRuleSetsResponse, domain, path=["response"]) + + @parametrize + async def test_streaming_response_list_rule_sets(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.with_streaming_response.list_rule_sets( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + domain = await response.parse() + assert_matches_type(DomainListRuleSetsResponse, domain, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_ip_info.py b/tests/api_resources/waap/test_ip_info.py new file mode 100644 index 00000000..3d8e495d --- /dev/null +++ b/tests/api_resources/waap/test_ip_info.py @@ -0,0 +1,630 @@ +# 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.waap import ( + WaapIPInfo, + WaapIPInfoCounts, + WaapIPDDOSInfoModel, + IPInfoGetTopURLsResponse, + IPInfoGetTopSessionsResponse, + IPInfoGetTopUserAgentsResponse, + IPInfoGetBlockedRequestsResponse, + IPInfoGetAttackTimeSeriesResponse, + IPInfoListAttackedCountriesResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestIPInfo: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.get( + ip="192.168.1.1", + ) + assert_matches_type(WaapIPInfo, ip_info, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.ip_info.with_raw_response.get( + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = response.parse() + assert_matches_type(WaapIPInfo, ip_info, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.ip_info.with_streaming_response.get( + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = response.parse() + assert_matches_type(WaapIPInfo, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_attack_time_series(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.get_attack_time_series( + ip="192.168.1.1", + ) + assert_matches_type(IPInfoGetAttackTimeSeriesResponse, ip_info, path=["response"]) + + @parametrize + def test_raw_response_get_attack_time_series(self, client: Gcore) -> None: + response = client.waap.ip_info.with_raw_response.get_attack_time_series( + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = response.parse() + assert_matches_type(IPInfoGetAttackTimeSeriesResponse, ip_info, path=["response"]) + + @parametrize + def test_streaming_response_get_attack_time_series(self, client: Gcore) -> None: + with client.waap.ip_info.with_streaming_response.get_attack_time_series( + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = response.parse() + assert_matches_type(IPInfoGetAttackTimeSeriesResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_blocked_requests(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.get_blocked_requests( + domain_id=0, + ip="192.168.1.1", + ) + assert_matches_type(IPInfoGetBlockedRequestsResponse, ip_info, path=["response"]) + + @parametrize + def test_raw_response_get_blocked_requests(self, client: Gcore) -> None: + response = client.waap.ip_info.with_raw_response.get_blocked_requests( + domain_id=0, + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = response.parse() + assert_matches_type(IPInfoGetBlockedRequestsResponse, ip_info, path=["response"]) + + @parametrize + def test_streaming_response_get_blocked_requests(self, client: Gcore) -> None: + with client.waap.ip_info.with_streaming_response.get_blocked_requests( + domain_id=0, + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = response.parse() + assert_matches_type(IPInfoGetBlockedRequestsResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_counts(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.get_counts( + ip="192.168.1.1", + ) + assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) + + @parametrize + def test_method_get_counts_with_all_params(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.get_counts( + ip="192.168.1.1", + domain_id=1, + ) + assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) + + @parametrize + def test_raw_response_get_counts(self, client: Gcore) -> None: + response = client.waap.ip_info.with_raw_response.get_counts( + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = response.parse() + assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) + + @parametrize + def test_streaming_response_get_counts(self, client: Gcore) -> None: + with client.waap.ip_info.with_streaming_response.get_counts( + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = response.parse() + assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_ddos_attack_series(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.get_ddos_attack_series( + ip="192.168.1.1", + ) + assert_matches_type(WaapIPDDOSInfoModel, ip_info, path=["response"]) + + @parametrize + def test_raw_response_get_ddos_attack_series(self, client: Gcore) -> None: + response = client.waap.ip_info.with_raw_response.get_ddos_attack_series( + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = response.parse() + assert_matches_type(WaapIPDDOSInfoModel, ip_info, path=["response"]) + + @parametrize + def test_streaming_response_get_ddos_attack_series(self, client: Gcore) -> None: + with client.waap.ip_info.with_streaming_response.get_ddos_attack_series( + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = response.parse() + assert_matches_type(WaapIPDDOSInfoModel, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_top_sessions(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.get_top_sessions( + domain_id=0, + ip="192.168.1.1", + ) + assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) + + @parametrize + def test_raw_response_get_top_sessions(self, client: Gcore) -> None: + response = client.waap.ip_info.with_raw_response.get_top_sessions( + domain_id=0, + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = response.parse() + assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) + + @parametrize + def test_streaming_response_get_top_sessions(self, client: Gcore) -> None: + with client.waap.ip_info.with_streaming_response.get_top_sessions( + domain_id=0, + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = response.parse() + assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_top_urls(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.get_top_urls( + domain_id=0, + ip="192.168.1.1", + ) + assert_matches_type(IPInfoGetTopURLsResponse, ip_info, path=["response"]) + + @parametrize + def test_raw_response_get_top_urls(self, client: Gcore) -> None: + response = client.waap.ip_info.with_raw_response.get_top_urls( + domain_id=0, + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = response.parse() + assert_matches_type(IPInfoGetTopURLsResponse, ip_info, path=["response"]) + + @parametrize + def test_streaming_response_get_top_urls(self, client: Gcore) -> None: + with client.waap.ip_info.with_streaming_response.get_top_urls( + domain_id=0, + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = response.parse() + assert_matches_type(IPInfoGetTopURLsResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_top_user_agents(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.get_top_user_agents( + domain_id=0, + ip="192.168.1.1", + ) + assert_matches_type(IPInfoGetTopUserAgentsResponse, ip_info, path=["response"]) + + @parametrize + def test_raw_response_get_top_user_agents(self, client: Gcore) -> None: + response = client.waap.ip_info.with_raw_response.get_top_user_agents( + domain_id=0, + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = response.parse() + assert_matches_type(IPInfoGetTopUserAgentsResponse, ip_info, path=["response"]) + + @parametrize + def test_streaming_response_get_top_user_agents(self, client: Gcore) -> None: + with client.waap.ip_info.with_streaming_response.get_top_user_agents( + domain_id=0, + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = response.parse() + assert_matches_type(IPInfoGetTopUserAgentsResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_attacked_countries(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.list_attacked_countries( + ip="192.168.1.1", + ) + assert_matches_type(IPInfoListAttackedCountriesResponse, ip_info, path=["response"]) + + @parametrize + def test_raw_response_list_attacked_countries(self, client: Gcore) -> None: + response = client.waap.ip_info.with_raw_response.list_attacked_countries( + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = response.parse() + assert_matches_type(IPInfoListAttackedCountriesResponse, ip_info, path=["response"]) + + @parametrize + def test_streaming_response_list_attacked_countries(self, client: Gcore) -> None: + with client.waap.ip_info.with_streaming_response.list_attacked_countries( + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = response.parse() + assert_matches_type(IPInfoListAttackedCountriesResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncIPInfo: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + ip_info = await async_client.waap.ip_info.get( + ip="192.168.1.1", + ) + assert_matches_type(WaapIPInfo, ip_info, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.ip_info.with_raw_response.get( + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = await response.parse() + assert_matches_type(WaapIPInfo, ip_info, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.ip_info.with_streaming_response.get( + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = await response.parse() + assert_matches_type(WaapIPInfo, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_attack_time_series(self, async_client: AsyncGcore) -> None: + ip_info = await async_client.waap.ip_info.get_attack_time_series( + ip="192.168.1.1", + ) + assert_matches_type(IPInfoGetAttackTimeSeriesResponse, ip_info, path=["response"]) + + @parametrize + async def test_raw_response_get_attack_time_series(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.ip_info.with_raw_response.get_attack_time_series( + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = await response.parse() + assert_matches_type(IPInfoGetAttackTimeSeriesResponse, ip_info, path=["response"]) + + @parametrize + async def test_streaming_response_get_attack_time_series(self, async_client: AsyncGcore) -> None: + async with async_client.waap.ip_info.with_streaming_response.get_attack_time_series( + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = await response.parse() + assert_matches_type(IPInfoGetAttackTimeSeriesResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_blocked_requests(self, async_client: AsyncGcore) -> None: + ip_info = await async_client.waap.ip_info.get_blocked_requests( + domain_id=0, + ip="192.168.1.1", + ) + assert_matches_type(IPInfoGetBlockedRequestsResponse, ip_info, path=["response"]) + + @parametrize + async def test_raw_response_get_blocked_requests(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.ip_info.with_raw_response.get_blocked_requests( + domain_id=0, + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = await response.parse() + assert_matches_type(IPInfoGetBlockedRequestsResponse, ip_info, path=["response"]) + + @parametrize + async def test_streaming_response_get_blocked_requests(self, async_client: AsyncGcore) -> None: + async with async_client.waap.ip_info.with_streaming_response.get_blocked_requests( + domain_id=0, + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = await response.parse() + assert_matches_type(IPInfoGetBlockedRequestsResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_counts(self, async_client: AsyncGcore) -> None: + ip_info = await async_client.waap.ip_info.get_counts( + ip="192.168.1.1", + ) + assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) + + @parametrize + async def test_method_get_counts_with_all_params(self, async_client: AsyncGcore) -> None: + ip_info = await async_client.waap.ip_info.get_counts( + ip="192.168.1.1", + domain_id=1, + ) + assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) + + @parametrize + async def test_raw_response_get_counts(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.ip_info.with_raw_response.get_counts( + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = await response.parse() + assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) + + @parametrize + async def test_streaming_response_get_counts(self, async_client: AsyncGcore) -> None: + async with async_client.waap.ip_info.with_streaming_response.get_counts( + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = await response.parse() + assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_ddos_attack_series(self, async_client: AsyncGcore) -> None: + ip_info = await async_client.waap.ip_info.get_ddos_attack_series( + ip="192.168.1.1", + ) + assert_matches_type(WaapIPDDOSInfoModel, ip_info, path=["response"]) + + @parametrize + async def test_raw_response_get_ddos_attack_series(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.ip_info.with_raw_response.get_ddos_attack_series( + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = await response.parse() + assert_matches_type(WaapIPDDOSInfoModel, ip_info, path=["response"]) + + @parametrize + async def test_streaming_response_get_ddos_attack_series(self, async_client: AsyncGcore) -> None: + async with async_client.waap.ip_info.with_streaming_response.get_ddos_attack_series( + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = await response.parse() + assert_matches_type(WaapIPDDOSInfoModel, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_top_sessions(self, async_client: AsyncGcore) -> None: + ip_info = await async_client.waap.ip_info.get_top_sessions( + domain_id=0, + ip="192.168.1.1", + ) + assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) + + @parametrize + async def test_raw_response_get_top_sessions(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.ip_info.with_raw_response.get_top_sessions( + domain_id=0, + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = await response.parse() + assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) + + @parametrize + async def test_streaming_response_get_top_sessions(self, async_client: AsyncGcore) -> None: + async with async_client.waap.ip_info.with_streaming_response.get_top_sessions( + domain_id=0, + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = await response.parse() + assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_top_urls(self, async_client: AsyncGcore) -> None: + ip_info = await async_client.waap.ip_info.get_top_urls( + domain_id=0, + ip="192.168.1.1", + ) + assert_matches_type(IPInfoGetTopURLsResponse, ip_info, path=["response"]) + + @parametrize + async def test_raw_response_get_top_urls(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.ip_info.with_raw_response.get_top_urls( + domain_id=0, + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = await response.parse() + assert_matches_type(IPInfoGetTopURLsResponse, ip_info, path=["response"]) + + @parametrize + async def test_streaming_response_get_top_urls(self, async_client: AsyncGcore) -> None: + async with async_client.waap.ip_info.with_streaming_response.get_top_urls( + domain_id=0, + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = await response.parse() + assert_matches_type(IPInfoGetTopURLsResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_top_user_agents(self, async_client: AsyncGcore) -> None: + ip_info = await async_client.waap.ip_info.get_top_user_agents( + domain_id=0, + ip="192.168.1.1", + ) + assert_matches_type(IPInfoGetTopUserAgentsResponse, ip_info, path=["response"]) + + @parametrize + async def test_raw_response_get_top_user_agents(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.ip_info.with_raw_response.get_top_user_agents( + domain_id=0, + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = await response.parse() + assert_matches_type(IPInfoGetTopUserAgentsResponse, ip_info, path=["response"]) + + @parametrize + async def test_streaming_response_get_top_user_agents(self, async_client: AsyncGcore) -> None: + async with async_client.waap.ip_info.with_streaming_response.get_top_user_agents( + domain_id=0, + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = await response.parse() + assert_matches_type(IPInfoGetTopUserAgentsResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_attacked_countries(self, async_client: AsyncGcore) -> None: + ip_info = await async_client.waap.ip_info.list_attacked_countries( + ip="192.168.1.1", + ) + assert_matches_type(IPInfoListAttackedCountriesResponse, ip_info, path=["response"]) + + @parametrize + async def test_raw_response_list_attacked_countries(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.ip_info.with_raw_response.list_attacked_countries( + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = await response.parse() + assert_matches_type(IPInfoListAttackedCountriesResponse, ip_info, path=["response"]) + + @parametrize + async def test_streaming_response_list_attacked_countries(self, async_client: AsyncGcore) -> None: + async with async_client.waap.ip_info.with_streaming_response.list_attacked_countries( + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = await response.parse() + assert_matches_type(IPInfoListAttackedCountriesResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_organizations.py b/tests/api_resources/waap/test_organizations.py index 704fc03e..d70ad3bb 100644 --- a/tests/api_resources/waap/test_organizations.py +++ b/tests/api_resources/waap/test_organizations.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.waap import Organization +from gcore.types.waap import WaapOrganization base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,7 +21,7 @@ class TestOrganizations: @parametrize def test_method_list(self, client: Gcore) -> None: organization = client.waap.organizations.list() - assert_matches_type(SyncOffsetPage[Organization], organization, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapOrganization], organization, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -31,7 +31,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: offset=0, ordering="name", ) - assert_matches_type(SyncOffsetPage[Organization], organization, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapOrganization], organization, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -40,7 +40,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = response.parse() - assert_matches_type(SyncOffsetPage[Organization], organization, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapOrganization], organization, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -49,7 +49,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = response.parse() - assert_matches_type(SyncOffsetPage[Organization], organization, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapOrganization], organization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -60,7 +60,7 @@ class TestAsyncOrganizations: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: organization = await async_client.waap.organizations.list() - assert_matches_type(AsyncOffsetPage[Organization], organization, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapOrganization], organization, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -70,7 +70,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No offset=0, ordering="name", ) - assert_matches_type(AsyncOffsetPage[Organization], organization, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapOrganization], organization, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -79,7 +79,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = await response.parse() - assert_matches_type(AsyncOffsetPage[Organization], organization, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapOrganization], organization, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -88,6 +88,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = await response.parse() - assert_matches_type(AsyncOffsetPage[Organization], organization, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapOrganization], organization, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_statistics.py b/tests/api_resources/waap/test_statistics.py index 0840e0eb..5eaa022b 100644 --- a/tests/api_resources/waap/test_statistics.py +++ b/tests/api_resources/waap/test_statistics.py @@ -10,7 +10,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore._utils import parse_datetime -from gcore.types.waap import StatisticsSeries +from gcore.types.waap import WaapStatisticsSeries base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +26,7 @@ def test_method_get_usage_series(self, client: Gcore) -> None: metrics=["total_bytes"], to=parse_datetime("2024-12-14T12:00:00Z"), ) - assert_matches_type(StatisticsSeries, statistic, path=["response"]) + assert_matches_type(WaapStatisticsSeries, statistic, path=["response"]) @parametrize def test_raw_response_get_usage_series(self, client: Gcore) -> None: @@ -40,7 +40,7 @@ def test_raw_response_get_usage_series(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = response.parse() - assert_matches_type(StatisticsSeries, statistic, path=["response"]) + assert_matches_type(WaapStatisticsSeries, statistic, path=["response"]) @parametrize def test_streaming_response_get_usage_series(self, client: Gcore) -> None: @@ -54,7 +54,7 @@ def test_streaming_response_get_usage_series(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = response.parse() - assert_matches_type(StatisticsSeries, statistic, path=["response"]) + assert_matches_type(WaapStatisticsSeries, statistic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -70,7 +70,7 @@ async def test_method_get_usage_series(self, async_client: AsyncGcore) -> None: metrics=["total_bytes"], to=parse_datetime("2024-12-14T12:00:00Z"), ) - assert_matches_type(StatisticsSeries, statistic, path=["response"]) + assert_matches_type(WaapStatisticsSeries, statistic, path=["response"]) @parametrize async def test_raw_response_get_usage_series(self, async_client: AsyncGcore) -> None: @@ -84,7 +84,7 @@ async def test_raw_response_get_usage_series(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = await response.parse() - assert_matches_type(StatisticsSeries, statistic, path=["response"]) + assert_matches_type(WaapStatisticsSeries, statistic, path=["response"]) @parametrize async def test_streaming_response_get_usage_series(self, async_client: AsyncGcore) -> None: @@ -98,6 +98,6 @@ async def test_streaming_response_get_usage_series(self, async_client: AsyncGcor assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = await response.parse() - assert_matches_type(StatisticsSeries, statistic, path=["response"]) + assert_matches_type(WaapStatisticsSeries, statistic, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_tags.py b/tests/api_resources/waap/test_tags.py index 2c629f23..588a1b44 100644 --- a/tests/api_resources/waap/test_tags.py +++ b/tests/api_resources/waap/test_tags.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.waap import Tag +from gcore.types.waap import WaapTag base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,7 +21,7 @@ class TestTags: @parametrize def test_method_list(self, client: Gcore) -> None: tag = client.waap.tags.list() - assert_matches_type(SyncOffsetPage[Tag], tag, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapTag], tag, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -33,7 +33,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: readable_name="readable_name", reserved=True, ) - assert_matches_type(SyncOffsetPage[Tag], tag, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapTag], tag, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -42,7 +42,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = response.parse() - assert_matches_type(SyncOffsetPage[Tag], tag, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapTag], tag, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -51,7 +51,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = response.parse() - assert_matches_type(SyncOffsetPage[Tag], tag, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapTag], tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -62,7 +62,7 @@ class TestAsyncTags: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: tag = await async_client.waap.tags.list() - assert_matches_type(AsyncOffsetPage[Tag], tag, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapTag], tag, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -74,7 +74,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No readable_name="readable_name", reserved=True, ) - assert_matches_type(AsyncOffsetPage[Tag], tag, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapTag], tag, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -83,7 +83,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = await response.parse() - assert_matches_type(AsyncOffsetPage[Tag], tag, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapTag], tag, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -92,6 +92,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = await response.parse() - assert_matches_type(AsyncOffsetPage[Tag], tag, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapTag], tag, path=["response"]) assert cast(Any, response.is_closed) is True From eabab98e40ee428dacb50c7d84d4bedbad34cb5e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 09:44:56 +0000 Subject: [PATCH 163/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 10f30916..6b7b74c5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.2.0" + ".": "0.3.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index a1fdefd4..d53aee82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.2.0" +version = "0.3.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 60d50ae3..be1b14df 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.2.0" # x-release-please-version +__version__ = "0.3.0" # x-release-please-version From 40c92712b76c231b7df976b7860b50568f02ee27 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 10:10:43 +0000 Subject: [PATCH 164/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cloud/baremetal/servers.py | 7 +- .../cloud/file_shares/file_shares.py | 15 ++-- src/gcore/resources/cloud/floating_ips.py | 7 +- .../gpu_baremetal_clusters.py | 7 +- .../cloud/gpu_baremetal_clusters/images.py | 7 +- src/gcore/resources/cloud/instances/images.py | 10 +-- .../resources/cloud/instances/instances.py | 7 +- .../cloud/load_balancers/load_balancers.py | 56 +++++++++++-- .../resources/cloud/networks/networks.py | 84 ++++++++++++++++--- src/gcore/resources/cloud/networks/subnets.py | 48 +++++++++-- .../cloud/security_groups/security_groups.py | 45 +++++++++- .../cloud/baremetal/server_create_params.py | 12 +-- src/gcore/types/cloud/ddos_profile.py | 12 ++- .../types/cloud/file_share_create_params.py | 8 +- .../types/cloud/floating_ip_create_params.py | 6 +- .../gpu_baremetal_cluster_create_params.py | 5 +- .../image_upload_params.py | 6 +- .../types/cloud/instance_create_params.py | 15 ++-- .../image_create_from_volume_params.py | 6 +- .../cloud/instances/image_upload_params.py | 6 +- .../cloud/load_balancer_create_params.py | 5 +- .../cloud/load_balancer_update_params.py | 21 +++++ .../types/cloud/network_create_params.py | 5 +- src/gcore/types/cloud/network_list_params.py | 3 + .../types/cloud/network_update_params.py | 27 +++++- .../cloud/networks/subnet_create_params.py | 5 +- .../cloud/networks/subnet_update_params.py | 22 +++++ .../cloud/security_group_update_params.py | 22 +++++ src/gcore/types/cloud/tag_update_map_param.py | 4 +- .../cloud/baremetal/test_servers.py | 10 +-- .../gpu_baremetal_clusters/test_images.py | 4 +- .../cloud/instances/test_images.py | 8 +- .../cloud/networks/test_subnets.py | 6 +- tests/api_resources/cloud/test_file_shares.py | 8 +- .../api_resources/cloud/test_floating_ips.py | 4 +- .../cloud/test_gpu_baremetal_clusters.py | 4 +- tests/api_resources/cloud/test_instances.py | 8 +- .../cloud/test_load_balancers.py | 6 +- tests/api_resources/cloud/test_networks.py | 32 +++++-- .../cloud/test_security_groups.py | 2 + 41 files changed, 426 insertions(+), 153 deletions(-) diff --git a/.stats.yml b/.stats.yml index b42d4f2b..194bd758 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b5883594159ef5544fde3856674f72adc1000c03aaf48ec8b7ba7ca9b128c66d.yml -openapi_spec_hash: beacedf1517348ed0158b7d9f530fc62 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ac4eb65ad579c94b23a363fbf0d27e49daf2fdd4c122b2f096297ff039d52365.yml +openapi_spec_hash: c1286da9cda9769c850ac41dd3216f72 config_hash: 62229a7a78ca1c79cb7cf61752a8df7e diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 6c4b9ade..8b14c8b2 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Union, Iterable, Optional +from typing import Dict, List, Union, Iterable, Optional from datetime import datetime from typing_extensions import Literal @@ -22,7 +22,6 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.baremetal import server_list_params, server_create_params, server_rebuild_params from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.baremetal.baremetal_server import BaremetalServer __all__ = ["ServersResource", "AsyncServersResource"] @@ -63,7 +62,7 @@ def create( name_template: str | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -420,7 +419,7 @@ async def create( name_template: str | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 9a9ad4bb..dea00eab 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable +from typing import Dict, Iterable from typing_extensions import Literal, overload import httpx @@ -35,7 +35,6 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.file_share import FileShare from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["FileSharesResource", "AsyncFileSharesResource"] @@ -75,7 +74,7 @@ def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -130,7 +129,7 @@ def create( protocol: Literal["NFS"], size: int, volume_type: Literal["vast_share_type"], - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -181,7 +180,7 @@ def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -504,7 +503,7 @@ async def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -559,7 +558,7 @@ async def create( protocol: Literal["NFS"], size: int, volume_type: Literal["vast_share_type"], - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -610,7 +609,7 @@ async def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index ff122671..6fab4e6c 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Optional +from typing import Dict, List, Optional import httpx @@ -22,7 +22,6 @@ from ...types.cloud.floating_ip import FloatingIP from ...types.cloud.task_id_list import TaskIDList from ...types.cloud.floating_ip_detailed import FloatingIPDetailed -from ...types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["FloatingIPsResource", "AsyncFloatingIPsResource"] @@ -54,7 +53,7 @@ def create( region_id: int | None = None, fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, port_id: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -375,7 +374,7 @@ async def create( region_id: int | None = None, fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, port_id: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 8d45b05f..c159ab44 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Dict, List, Iterable, Optional import httpx @@ -58,7 +58,6 @@ ) from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.gpu_baremetal_cluster import GPUBaremetalCluster from ....types.cloud.gpu_baremetal_cluster_server_list import GPUBaremetalClusterServerList @@ -113,7 +112,7 @@ def create( instances_count: int | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, ssh_key_name: str | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -577,7 +576,7 @@ async def create( instances_count: int | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, ssh_key_name: str | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index ef276010..d6de5b4d 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal import httpx @@ -21,7 +21,6 @@ from ....types.cloud.gpu_image import GPUImage from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.gpu_image_list import GPUImageList -from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.gpu_baremetal_clusters import image_upload_params __all__ = ["ImagesResource", "AsyncImagesResource"] @@ -191,7 +190,7 @@ def upload( os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -432,7 +431,7 @@ async def upload( os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index 605fdb8f..37713d34 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Optional +from typing import Dict, List, Optional from typing_extensions import Literal import httpx @@ -250,7 +250,7 @@ def create_from_volume( os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, source: Literal["volume"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -383,7 +383,7 @@ def upload( os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -679,7 +679,7 @@ async def create_from_volume( os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, source: Literal["volume"] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -812,7 +812,7 @@ async def upload( os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, os_version: Optional[str] | NotGiven = NOT_GIVEN, ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 9112c6d2..4ae9a115 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Union, Iterable, Optional +from typing import Dict, List, Union, Iterable, Optional from datetime import datetime from typing_extensions import Literal, overload @@ -68,7 +68,6 @@ from ....types.cloud.instance import Instance from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.instance_interface import InstanceInterface -from ....types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["InstancesResource", "AsyncInstancesResource"] @@ -125,7 +124,7 @@ def create( security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, servergroup_id: str | NotGiven = NOT_GIVEN, ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1131,7 +1130,7 @@ async def create( security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, servergroup_id: str | NotGiven = NOT_GIVEN, ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index c1debc30..50f1a16d 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Dict, List, Iterable, Optional import httpx @@ -141,7 +141,7 @@ def create( name: str | NotGiven = NOT_GIVEN, name_template: str | NotGiven = NOT_GIVEN, preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, vip_network_id: str | NotGiven = NOT_GIVEN, vip_port_id: str | NotGiven = NOT_GIVEN, @@ -240,6 +240,7 @@ def update( logging: load_balancer_update_params.Logging | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -248,8 +249,10 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LoadBalancer: """ - Rename load balancer, activate/deactivate logs or update preferred connectivity - for load balancer + Rename load balancer, activate/deactivate logging, update preferred connectivity + type and/or modify load balancer tags. The request will only process the fields + that are provided in the request body. Any fields that are not included will + remain unchanged. Args: logging: Logging configuration @@ -259,6 +262,23 @@ def update( preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools members + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -280,6 +300,7 @@ def update( "logging": logging, "name": name, "preferred_connectivity": preferred_connectivity, + "tags": tags, }, load_balancer_update_params.LoadBalancerUpdateParams, ), @@ -616,7 +637,7 @@ async def create( name: str | NotGiven = NOT_GIVEN, name_template: str | NotGiven = NOT_GIVEN, preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, vip_network_id: str | NotGiven = NOT_GIVEN, vip_port_id: str | NotGiven = NOT_GIVEN, @@ -715,6 +736,7 @@ async def update( logging: load_balancer_update_params.Logging | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -723,8 +745,10 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LoadBalancer: """ - Rename load balancer, activate/deactivate logs or update preferred connectivity - for load balancer + Rename load balancer, activate/deactivate logging, update preferred connectivity + type and/or modify load balancer tags. The request will only process the fields + that are provided in the request body. Any fields that are not included will + remain unchanged. Args: logging: Logging configuration @@ -734,6 +758,23 @@ async def update( preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools members + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -755,6 +796,7 @@ async def update( "logging": logging, "name": name, "preferred_connectivity": preferred_connectivity, + "tags": tags, }, load_balancer_update_params.LoadBalancerUpdateParams, ), diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index d980ebfa..9647db97 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List +from typing import Dict, List, Optional from typing_extensions import Literal import httpx @@ -78,7 +78,7 @@ def create( region_id: int | None = None, name: str, create_router: bool | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -142,7 +142,8 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - name: str, + name: str | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -150,8 +151,11 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Network: - """ - Change network name + """Rename network and/or update network tags. + + The request will only process the + fields that are provided in the request body. Any fields that are not included + will remain unchanged. Args: project_id: Project ID @@ -162,6 +166,23 @@ def update( name: Name. + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -178,7 +199,13 @@ def update( raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._patch( f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", - body=maybe_transform({"name": name}, network_update_params.NetworkUpdateParams), + body=maybe_transform( + { + "name": name, + "tags": tags, + }, + network_update_params.NetworkUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,6 +218,7 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, tag_key: List[str] | NotGiven = NOT_GIVEN, @@ -212,6 +240,8 @@ def list( limit: Optional. Limit the number of returned items + name: Filter networks by name + offset: Optional. Offset value is used to exclude the first set of records from the result @@ -247,6 +277,7 @@ def list( query=maybe_transform( { "limit": limit, + "name": name, "offset": offset, "order_by": order_by, "tag_key": tag_key, @@ -384,7 +415,7 @@ async def create( region_id: int | None = None, name: str, create_router: bool | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -448,7 +479,8 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - name: str, + name: str | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -456,8 +488,11 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Network: - """ - Change network name + """Rename network and/or update network tags. + + The request will only process the + fields that are provided in the request body. Any fields that are not included + will remain unchanged. Args: project_id: Project ID @@ -468,6 +503,23 @@ async def update( name: Name. + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -484,7 +536,13 @@ async def update( raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._patch( f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", - body=await async_maybe_transform({"name": name}, network_update_params.NetworkUpdateParams), + body=await async_maybe_transform( + { + "name": name, + "tags": tags, + }, + network_update_params.NetworkUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,6 +555,7 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, tag_key: List[str] | NotGiven = NOT_GIVEN, @@ -518,6 +577,8 @@ def list( limit: Optional. Limit the number of returned items + name: Filter networks by name + offset: Optional. Offset value is used to exclude the first set of records from the result @@ -553,6 +614,7 @@ def list( query=maybe_transform( { "limit": limit, + "name": name, "offset": offset, "order_by": order_by, "tag_key": tag_key, diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index b65a97e0..311bd170 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Dict, List, Iterable, Optional from typing_extensions import Literal import httpx @@ -64,7 +64,7 @@ def create( host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -159,6 +159,7 @@ def update( gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -167,7 +168,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Subnet: """ - Change subnet properties + Update subnet Args: project_id: Project ID @@ -189,6 +190,23 @@ def update( name: Name + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -212,6 +230,7 @@ def update( "gateway_ip": gateway_ip, "host_routes": host_routes, "name": name, + "tags": tags, }, subnet_update_params.SubnetUpdateParams, ), @@ -440,7 +459,7 @@ async def create( host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, ip_version: IPVersion | NotGiven = NOT_GIVEN, router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -535,6 +554,7 @@ async def update( gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -543,7 +563,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Subnet: """ - Change subnet properties + Update subnet Args: project_id: Project ID @@ -565,6 +585,23 @@ async def update( name: Name + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -588,6 +625,7 @@ async def update( "gateway_ip": gateway_ip, "host_routes": host_routes, "name": name, + "tags": tags, }, subnet_update_params.SubnetUpdateParams, ), diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 51a470d1..cddbd7a2 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable +from typing import List, Iterable, Optional import httpx @@ -33,6 +33,7 @@ ) from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.security_group import SecurityGroup +from ....types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["SecurityGroupsResource", "AsyncSecurityGroupsResource"] @@ -118,6 +119,7 @@ def update( region_id: int | None = None, changed_rules: Iterable[security_group_update_params.ChangedRule] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -126,13 +128,30 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroup: """ - Change security group + Update security group Args: changed_rules: List of rules to create or delete name: Name + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -153,6 +172,7 @@ def update( { "changed_rules": changed_rules, "name": name, + "tags": tags, }, security_group_update_params.SecurityGroupUpdateParams, ), @@ -469,6 +489,7 @@ async def update( region_id: int | None = None, changed_rules: Iterable[security_group_update_params.ChangedRule] | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -477,13 +498,30 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroup: """ - Change security group + Update security group Args: changed_rules: List of rules to create or delete name: Name + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -504,6 +542,7 @@ async def update( { "changed_rules": changed_rules, "name": name, + "tags": tags, }, security_group_update_params.SecurityGroupUpdateParams, ), diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index 9c6dc5d1..3b9981b3 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -2,11 +2,10 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..interface_ip_family import InterfaceIPFamily -from ..tag_update_map_param import TagUpdateMapParam __all__ = [ "ServerCreateParams", @@ -88,7 +87,7 @@ class ServerCreateParams(TypedDict, total=False): [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). """ - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -361,10 +360,7 @@ class DDOSProfileField(TypedDict, total=False): class DDOSProfile(TypedDict, total=False): profile_template: Required[int] - """DDoS profile template ID""" + """Advanced DDoS template ID""" - fields: Optional[Iterable[DDOSProfileField]] + fields: Iterable[DDOSProfileField] """DDoS profile parameters""" - - profile_template_name: Optional[str] - """DDoS profile template name""" diff --git a/src/gcore/types/cloud/ddos_profile.py b/src/gcore/types/cloud/ddos_profile.py index f84c69cd..bc242300 100644 --- a/src/gcore/types/cloud/ddos_profile.py +++ b/src/gcore/types/cloud/ddos_profile.py @@ -8,14 +8,20 @@ from .ddos_profile_template import DDOSProfileTemplate from .ddos_profile_option_list import DDOSProfileOptionList -__all__ = ["DDOSProfile"] +__all__ = ["DDOSProfile", "Protocol"] + + +class Protocol(BaseModel): + port: str + + protocols: List[str] class DDOSProfile(BaseModel): id: int """DDoS protection profile ID""" - profile_template: DDOSProfileTemplate + profile_template: Optional[DDOSProfileTemplate] = None """Template data""" fields: Optional[List[DDOSProfileField]] = None @@ -25,7 +31,7 @@ class DDOSProfile(BaseModel): profile_template_description: Optional[str] = None """DDoS profile template description""" - protocols: Optional[List[object]] = None + protocols: Optional[List[Protocol]] = None """List of protocols""" site: Optional[str] = None diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index 02fe341b..7958fe69 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -2,11 +2,9 @@ from __future__ import annotations -from typing import Union, Iterable +from typing import Dict, Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .tag_update_map_param import TagUpdateMapParam - __all__ = [ "FileShareCreateParams", "CreateStandardFileShareSerializer", @@ -38,7 +36,7 @@ class CreateStandardFileShareSerializer(TypedDict, total=False): access: Iterable[CreateStandardFileShareSerializerAccess] """Access Rules""" - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -90,7 +88,7 @@ class CreateVastFileShareSerializer(TypedDict, total=False): volume_type: Required[Literal["vast_share_type"]] """File share volume type""" - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/floating_ip_create_params.py b/src/gcore/types/cloud/floating_ip_create_params.py index 06936bd7..01d7f41b 100644 --- a/src/gcore/types/cloud/floating_ip_create_params.py +++ b/src/gcore/types/cloud/floating_ip_create_params.py @@ -2,11 +2,9 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import TypedDict -from .tag_update_map_param import TagUpdateMapParam - __all__ = ["FloatingIPCreateParams"] @@ -29,7 +27,7 @@ class FloatingIPCreateParams(TypedDict, total=False): If provided, the floating IP will be immediately attached to the specified port. """ - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling 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 210346b4..7a82c03b 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -2,11 +2,10 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .interface_ip_family import InterfaceIPFamily -from .tag_update_map_param import TagUpdateMapParam __all__ = [ "GPUBaremetalClusterCreateParams", @@ -55,7 +54,7 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). """ - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py index eff9ad1d..c83f5687 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py @@ -2,11 +2,9 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict -from ..tag_update_map_param import TagUpdateMapParam - __all__ = ["ImageUploadParams"] @@ -47,7 +45,7 @@ class ImageUploadParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Permission to use a ssh key in instances""" - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index 3f6762bc..0f16aa79 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -2,11 +2,10 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .interface_ip_family import InterfaceIPFamily -from .tag_update_map_param import TagUpdateMapParam __all__ = [ "InstanceCreateParams", @@ -113,7 +112,7 @@ class InstanceCreateParams(TypedDict, total=False): [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). """ - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -389,7 +388,7 @@ class VolumeCreateInstanceCreateNewVolumeSerializer(TypedDict, total=False): If not specified, a name will be generated automatically. """ - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -450,7 +449,7 @@ class VolumeCreateInstanceCreateVolumeFromImageSerializer(TypedDict, total=False - For basic VMs: the size is set automatically based on the flavor. """ - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -504,7 +503,7 @@ class VolumeCreateInstanceCreateVolumeFromSnapshotSerializer(TypedDict, total=Fa If not specified, a name will be generated automatically. """ - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -550,7 +549,7 @@ class VolumeCreateInstanceCreateVolumeFromApptemplateSerializer(TypedDict, total size: int """Volume size in GiB.""" - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -595,7 +594,7 @@ class VolumeCreateInstanceExistingVolumeSerializer(TypedDict, total=False): delete_on_termination: bool """Set to `true` to automatically delete the volume when the instance is deleted.""" - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instances/image_create_from_volume_params.py b/src/gcore/types/cloud/instances/image_create_from_volume_params.py index 358a4a7d..70dd351f 100644 --- a/src/gcore/types/cloud/instances/image_create_from_volume_params.py +++ b/src/gcore/types/cloud/instances/image_create_from_volume_params.py @@ -2,11 +2,9 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict -from ..tag_update_map_param import TagUpdateMapParam - __all__ = ["ImageCreateFromVolumeParams"] @@ -42,7 +40,7 @@ class ImageCreateFromVolumeParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Whether the image supports SSH key or not""" - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instances/image_upload_params.py b/src/gcore/types/cloud/instances/image_upload_params.py index 7a278c91..08cfe96f 100644 --- a/src/gcore/types/cloud/instances/image_upload_params.py +++ b/src/gcore/types/cloud/instances/image_upload_params.py @@ -2,11 +2,9 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict -from ..tag_update_map_param import TagUpdateMapParam - __all__ = ["ImageUploadParams"] @@ -51,7 +49,7 @@ class ImageUploadParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Whether the image supports SSH key or not""" - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index c208e7fa..6d1739de 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Union, Iterable, Optional +from typing import Dict, List, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .http_method import HTTPMethod @@ -10,7 +10,6 @@ from .lb_pool_protocol import LbPoolProtocol from .interface_ip_family import InterfaceIPFamily from .lb_listener_protocol import LbListenerProtocol -from .tag_update_map_param import TagUpdateMapParam from .lb_health_monitor_type import LbHealthMonitorType from .lb_session_persistence_type import LbSessionPersistenceType from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam @@ -66,7 +65,7 @@ class LoadBalancerCreateParams(TypedDict, total=False): specification. """ - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py index 9b7653fe..4747c719 100644 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -5,6 +5,7 @@ from typing import Optional from typing_extensions import TypedDict +from .tag_update_map_param import TagUpdateMapParam from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity @@ -28,6 +29,26 @@ class LoadBalancerUpdateParams(TypedDict, total=False): members """ + tags: Optional[TagUpdateMapParam] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ + class Logging(TypedDict, total=False): destination_region_id: Optional[int] diff --git a/src/gcore/types/cloud/network_create_params.py b/src/gcore/types/cloud/network_create_params.py index a91d5bec..da45b25c 100644 --- a/src/gcore/types/cloud/network_create_params.py +++ b/src/gcore/types/cloud/network_create_params.py @@ -2,10 +2,9 @@ from __future__ import annotations +from typing import Dict from typing_extensions import Literal, Required, TypedDict -from .tag_update_map_param import TagUpdateMapParam - __all__ = ["NetworkCreateParams"] @@ -22,7 +21,7 @@ class NetworkCreateParams(TypedDict, total=False): create_router: bool """Defaults to True""" - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/network_list_params.py b/src/gcore/types/cloud/network_list_params.py index 95d7c10f..2aaa17b2 100644 --- a/src/gcore/types/cloud/network_list_params.py +++ b/src/gcore/types/cloud/network_list_params.py @@ -18,6 +18,9 @@ class NetworkListParams(TypedDict, total=False): limit: int """Optional. Limit the number of returned items""" + name: str + """Filter networks by name""" + offset: int """Optional. diff --git a/src/gcore/types/cloud/network_update_params.py b/src/gcore/types/cloud/network_update_params.py index 8319b067..828b283c 100644 --- a/src/gcore/types/cloud/network_update_params.py +++ b/src/gcore/types/cloud/network_update_params.py @@ -2,7 +2,10 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Optional +from typing_extensions import TypedDict + +from .tag_update_map_param import TagUpdateMapParam __all__ = ["NetworkUpdateParams"] @@ -14,5 +17,25 @@ class NetworkUpdateParams(TypedDict, total=False): region_id: int """Region ID""" - name: Required[str] + name: str """Name.""" + + tags: Optional[TagUpdateMapParam] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index c9371c7a..9fd4a938 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -2,11 +2,10 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Dict, List, Iterable, Optional from typing_extensions import Required, TypedDict from ..ip_version import IPVersion -from ..tag_update_map_param import TagUpdateMapParam __all__ = ["SubnetCreateParams", "HostRoute"] @@ -60,7 +59,7 @@ class SubnetCreateParams(TypedDict, total=False): find a router created during network creation. """ - tags: TagUpdateMapParam + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index 7fb218da..2ade80c6 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -5,6 +5,8 @@ from typing import List, Iterable, Optional from typing_extensions import Required, TypedDict +from ..tag_update_map_param import TagUpdateMapParam + __all__ = ["SubnetUpdateParams", "HostRoute"] @@ -35,6 +37,26 @@ class SubnetUpdateParams(TypedDict, total=False): name: Optional[str] """Name""" + tags: Optional[TagUpdateMapParam] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ + class HostRoute(TypedDict, total=False): destination: Required[str] diff --git a/src/gcore/types/cloud/security_group_update_params.py b/src/gcore/types/cloud/security_group_update_params.py index d2118275..f94acd2b 100644 --- a/src/gcore/types/cloud/security_group_update_params.py +++ b/src/gcore/types/cloud/security_group_update_params.py @@ -5,6 +5,8 @@ from typing import Iterable, Optional from typing_extensions import Literal, Required, TypedDict +from .tag_update_map_param import TagUpdateMapParam + __all__ = ["SecurityGroupUpdateParams", "ChangedRule"] @@ -19,6 +21,26 @@ class SecurityGroupUpdateParams(TypedDict, total=False): name: str """Name""" + tags: Optional[TagUpdateMapParam] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ + class ChangedRule(TypedDict, total=False): action: Required[Literal["create", "delete"]] diff --git a/src/gcore/types/cloud/tag_update_map_param.py b/src/gcore/types/cloud/tag_update_map_param.py index a1eff214..6726649c 100644 --- a/src/gcore/types/cloud/tag_update_map_param.py +++ b/src/gcore/types/cloud/tag_update_map_param.py @@ -2,9 +2,9 @@ from __future__ import annotations -from typing import Dict +from typing import Dict, Optional from typing_extensions import TypeAlias __all__ = ["TagUpdateMapParam"] -TagUpdateMapParam: TypeAlias = Dict[str, str] +TagUpdateMapParam: TypeAlias = Dict[str, Optional[str]] diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index 347210d3..72ff981b 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -47,7 +47,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: app_config={}, apptemplate_id="apptemplate_id", ddos_profile={ - "profile_template": 1, + "profile_template": 123, "fields": [ { "base_field": 10, @@ -56,14 +56,13 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "value": "value", } ], - "profile_template_name": "profile_template_name", }, image_id="image_id", name="my-bare-metal", name_template="name_template", password="password", ssh_key_name="my-ssh-key", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, user_data="user_data", username="username", ) @@ -250,7 +249,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> app_config={}, apptemplate_id="apptemplate_id", ddos_profile={ - "profile_template": 1, + "profile_template": 123, "fields": [ { "base_field": 10, @@ -259,14 +258,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "value": "value", } ], - "profile_template_name": "profile_template_name", }, image_id="image_id", name="my-bare-metal", name_template="name_template", password="password", ssh_key_name="my-ssh-key", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, user_data="user_data", username="username", ) diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py index 30e17761..c2b357cb 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py @@ -167,7 +167,7 @@ def test_method_upload_with_all_params(self, client: Gcore) -> None: os_type="linux", os_version="19.04", ssh_key="allow", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -355,7 +355,7 @@ async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> os_type="linux", os_version="19.04", ssh_key="allow", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) diff --git a/tests/api_resources/cloud/instances/test_images.py b/tests/api_resources/cloud/instances/test_images.py index d796aec9..80a58a38 100644 --- a/tests/api_resources/cloud/instances/test_images.py +++ b/tests/api_resources/cloud/instances/test_images.py @@ -196,7 +196,7 @@ def test_method_create_from_volume_with_all_params(self, client: Gcore) -> None: os_type="linux", source="volume", ssh_key="allow", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -312,7 +312,7 @@ def test_method_upload_with_all_params(self, client: Gcore) -> None: os_type="linux", os_version="22.04", ssh_key="allow", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -529,7 +529,7 @@ async def test_method_create_from_volume_with_all_params(self, async_client: Asy os_type="linux", source="volume", ssh_key="allow", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) @@ -645,7 +645,7 @@ async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> os_type="linux", os_version="22.04", ssh_key="allow", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, image, path=["response"]) diff --git a/tests/api_resources/cloud/networks/test_subnets.py b/tests/api_resources/cloud/networks/test_subnets.py index 88244d9c..f399473c 100644 --- a/tests/api_resources/cloud/networks/test_subnets.py +++ b/tests/api_resources/cloud/networks/test_subnets.py @@ -49,7 +49,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: ], ip_version=4, router_id_to_connect="00000000-0000-4000-8000-000000000000", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, subnet, path=["response"]) @@ -110,6 +110,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: } ], name="some_name", + tags={"foo": "my-tag-value"}, ) assert_matches_type(Subnet, subnet, path=["response"]) @@ -325,7 +326,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> ], ip_version=4, router_id_to_connect="00000000-0000-4000-8000-000000000000", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, subnet, path=["response"]) @@ -386,6 +387,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> } ], name="some_name", + tags={"foo": "my-tag-value"}, ) assert_matches_type(Subnet, subnet, path=["response"]) diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index 4c547362..62cb137a 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -51,7 +51,7 @@ def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: "ip_address": "10.0.0.1", } ], - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, volume_type="default_share_type", ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -111,7 +111,7 @@ def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: protocol="NFS", size=5, volume_type="vast_share_type", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -421,7 +421,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn "ip_address": "10.0.0.1", } ], - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, volume_type="default_share_type", ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -481,7 +481,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn protocol="NFS", size=5, volume_type="vast_share_type", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, file_share, path=["response"]) diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index 38d101e5..52a54438 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -37,7 +37,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: region_id=1, fixed_ip_address="192.168.10.15", port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) @@ -331,7 +331,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> region_id=1, fixed_ip_address="192.168.10.15", port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index 5b455c80..bbb0f9ab 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -60,7 +60,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: instances_count=1, password="password", ssh_key_name="my-ssh-key", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, user_data="user_data", username="username", ) @@ -506,7 +506,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> instances_count=1, password="password", ssh_key_name="my-ssh-key", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, user_data="user_data", username="username", ) diff --git a/tests/api_resources/cloud/test_instances.py b/tests/api_resources/cloud/test_instances.py index c517c82b..6012d388 100644 --- a/tests/api_resources/cloud/test_instances.py +++ b/tests/api_resources/cloud/test_instances.py @@ -61,7 +61,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "attachment_tag": "boot", "delete_on_termination": False, "name": "boot-volume", - "tags": {"foo": "my-tag-value"}, + "tags": {"my-tag": "my-tag-value"}, "type_name": "ssd_hiiops", } ], @@ -73,7 +73,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], servergroup_id="servergroup_id", ssh_key_name="my-ssh-key", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, user_data="user_data", username="username", ) @@ -922,7 +922,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "attachment_tag": "boot", "delete_on_termination": False, "name": "boot-volume", - "tags": {"foo": "my-tag-value"}, + "tags": {"my-tag": "my-tag-value"}, "type_name": "ssd_hiiops", } ], @@ -934,7 +934,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], servergroup_id="servergroup_id", ssh_key_name="my-ssh-key", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, user_data="user_data", username="username", ) diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index a219b32d..42cc2367 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -122,7 +122,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: name="new_load_balancer", name_template="lb_name_template", preferred_connectivity="L2", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, vip_ip_family="dual", vip_network_id="ac307687-31a4-4a11-a949-6bea1b2878f5", vip_port_id="ff83e13a-b256-4be2-ba5d-028d3f0ab450", @@ -179,6 +179,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: }, name="some_name", preferred_connectivity="L2", + tags={"foo": "my-tag-value"}, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @@ -585,7 +586,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> name="new_load_balancer", name_template="lb_name_template", preferred_connectivity="L2", - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, vip_ip_family="dual", vip_network_id="ac307687-31a4-4a11-a949-6bea1b2878f5", vip_port_id="ff83e13a-b256-4be2-ba5d-028d3f0ab450", @@ -642,6 +643,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> }, name="some_name", preferred_connectivity="L2", + tags={"foo": "my-tag-value"}, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) diff --git a/tests/api_resources/cloud/test_networks.py b/tests/api_resources/cloud/test_networks.py index 7380d239..18fd0fdf 100644 --- a/tests/api_resources/cloud/test_networks.py +++ b/tests/api_resources/cloud/test_networks.py @@ -37,7 +37,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: region_id=1, name="my network", create_router=True, - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, type="vxlan", ) assert_matches_type(TaskIDList, network, path=["response"]) @@ -72,11 +72,21 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: + network = client.cloud.networks.update( + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + assert_matches_type(Network, network, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: network = client.cloud.networks.update( network_id="b39792c3-3160-4356-912e-ba396c95cdcf", project_id=1, region_id=1, name="some_name", + tags={"foo": "my-tag-value"}, ) assert_matches_type(Network, network, path=["response"]) @@ -86,7 +96,6 @@ def test_raw_response_update(self, client: Gcore) -> None: network_id="b39792c3-3160-4356-912e-ba396c95cdcf", project_id=1, region_id=1, - name="some_name", ) assert response.is_closed is True @@ -100,7 +109,6 @@ def test_streaming_response_update(self, client: Gcore) -> None: network_id="b39792c3-3160-4356-912e-ba396c95cdcf", project_id=1, region_id=1, - name="some_name", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -117,7 +125,6 @@ def test_path_params_update(self, client: Gcore) -> None: network_id="", project_id=1, region_id=1, - name="some_name", ) @parametrize @@ -134,6 +141,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, limit=1000, + name="my-network", offset=0, order_by="created_at.desc", tag_key=["key1", "key2"], @@ -279,7 +287,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> region_id=1, name="my network", create_router=True, - tags={"foo": "my-tag-value"}, + tags={"my-tag": "my-tag-value"}, type="vxlan", ) assert_matches_type(TaskIDList, network, path=["response"]) @@ -314,11 +322,21 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: + network = await async_client.cloud.networks.update( + network_id="b39792c3-3160-4356-912e-ba396c95cdcf", + project_id=1, + region_id=1, + ) + assert_matches_type(Network, network, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: network = await async_client.cloud.networks.update( network_id="b39792c3-3160-4356-912e-ba396c95cdcf", project_id=1, region_id=1, name="some_name", + tags={"foo": "my-tag-value"}, ) assert_matches_type(Network, network, path=["response"]) @@ -328,7 +346,6 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: network_id="b39792c3-3160-4356-912e-ba396c95cdcf", project_id=1, region_id=1, - name="some_name", ) assert response.is_closed is True @@ -342,7 +359,6 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None network_id="b39792c3-3160-4356-912e-ba396c95cdcf", project_id=1, region_id=1, - name="some_name", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -359,7 +375,6 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: network_id="", project_id=1, region_id=1, - name="some_name", ) @parametrize @@ -376,6 +391,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No project_id=1, region_id=1, limit=1000, + name="my-network", offset=0, order_by="created_at.desc", tag_key=["key1", "key2"], diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index 20630068..d8b88654 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -113,6 +113,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: } ], name="some_name", + tags={"foo": "my-tag-value"}, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @@ -484,6 +485,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> } ], name="some_name", + tags={"foo": "my-tag-value"}, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) From 8589a573b6e17d384b9dba64a9186f9c24048695 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 12:15:24 +0000 Subject: [PATCH 165/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 194bd758..72a98f04 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ac4eb65ad579c94b23a363fbf0d27e49daf2fdd4c122b2f096297ff039d52365.yml -openapi_spec_hash: c1286da9cda9769c850ac41dd3216f72 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c69353c2638a896685622a7bc91746002ce45c684c09f0cd59f90d193a711bfd.yml +openapi_spec_hash: 288f2041f8a716abffdbdf64ae886c63 config_hash: 62229a7a78ca1c79cb7cf61752a8df7e From 42e3c5d7350bd4b0a00819176c9d94d6bf9a2229 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 16:36:12 +0000 Subject: [PATCH 166/592] fix(waap): remove duplicate method for acct overview --- .stats.yml | 2 +- api.md | 12 -- src/gcore/resources/waap/__init__.py | 14 --- src/gcore/resources/waap/clients.py | 135 --------------------- src/gcore/resources/waap/waap.py | 32 ----- src/gcore/types/waap/__init__.py | 1 - src/gcore/types/waap/client_me_response.py | 34 ------ tests/api_resources/waap/test_clients.py | 72 ----------- 8 files changed, 1 insertion(+), 301 deletions(-) delete mode 100644 src/gcore/resources/waap/clients.py delete mode 100644 src/gcore/types/waap/client_me_response.py delete mode 100644 tests/api_resources/waap/test_clients.py diff --git a/.stats.yml b/.stats.yml index 72a98f04..0cc0367f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c69353c2638a896685622a7bc91746002ce45c684c09f0cd59f90d193a711bfd.yml openapi_spec_hash: 288f2041f8a716abffdbdf64ae886c63 -config_hash: 62229a7a78ca1c79cb7cf61752a8df7e +config_hash: 851d2f0c1f925aee3b53478d4fe311ba diff --git a/api.md b/api.md index 82d3b4fb..307d30c4 100644 --- a/api.md +++ b/api.md @@ -928,18 +928,6 @@ Methods: - client.waap.get_account_overview() -> WaapGetAccountOverviewResponse -## Clients - -Types: - -```python -from gcore.types.waap import ClientMeResponse -``` - -Methods: - -- client.waap.clients.me() -> ClientMeResponse - ## Statistics Methods: diff --git a/src/gcore/resources/waap/__init__.py b/src/gcore/resources/waap/__init__.py index 69655c51..f5020fdf 100644 --- a/src/gcore/resources/waap/__init__.py +++ b/src/gcore/resources/waap/__init__.py @@ -16,14 +16,6 @@ WaapResourceWithStreamingResponse, AsyncWaapResourceWithStreamingResponse, ) -from .clients import ( - ClientsResource, - AsyncClientsResource, - ClientsResourceWithRawResponse, - AsyncClientsResourceWithRawResponse, - ClientsResourceWithStreamingResponse, - AsyncClientsResourceWithStreamingResponse, -) from .domains import ( DomainsResource, AsyncDomainsResource, @@ -74,12 +66,6 @@ ) __all__ = [ - "ClientsResource", - "AsyncClientsResource", - "ClientsResourceWithRawResponse", - "AsyncClientsResourceWithRawResponse", - "ClientsResourceWithStreamingResponse", - "AsyncClientsResourceWithStreamingResponse", "StatisticsResource", "AsyncStatisticsResource", "StatisticsResourceWithRawResponse", diff --git a/src/gcore/resources/waap/clients.py b/src/gcore/resources/waap/clients.py deleted file mode 100644 index 0cee8933..00000000 --- a/src/gcore/resources/waap/clients.py +++ /dev/null @@ -1,135 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.waap.client_me_response import ClientMeResponse - -__all__ = ["ClientsResource", "AsyncClientsResource"] - - -class ClientsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ClientsResourceWithRawResponse: - """ - 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 ClientsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ClientsResourceWithStreamingResponse: - """ - 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 ClientsResourceWithStreamingResponse(self) - - def me( - 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, - ) -> ClientMeResponse: - """Get information about WAAP service for the client""" - return self._get( - "/waap/v1/clients/me", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ClientMeResponse, - ) - - -class AsyncClientsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncClientsResourceWithRawResponse: - """ - 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 AsyncClientsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncClientsResourceWithStreamingResponse: - """ - 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 AsyncClientsResourceWithStreamingResponse(self) - - async def me( - 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, - ) -> ClientMeResponse: - """Get information about WAAP service for the client""" - return await self._get( - "/waap/v1/clients/me", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ClientMeResponse, - ) - - -class ClientsResourceWithRawResponse: - def __init__(self, clients: ClientsResource) -> None: - self._clients = clients - - self.me = to_raw_response_wrapper( - clients.me, - ) - - -class AsyncClientsResourceWithRawResponse: - def __init__(self, clients: AsyncClientsResource) -> None: - self._clients = clients - - self.me = async_to_raw_response_wrapper( - clients.me, - ) - - -class ClientsResourceWithStreamingResponse: - def __init__(self, clients: ClientsResource) -> None: - self._clients = clients - - self.me = to_streamed_response_wrapper( - clients.me, - ) - - -class AsyncClientsResourceWithStreamingResponse: - def __init__(self, clients: AsyncClientsResource) -> None: - self._clients = clients - - self.me = async_to_streamed_response_wrapper( - clients.me, - ) diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index dc9181ac..cebf40de 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -12,14 +12,6 @@ TagsResourceWithStreamingResponse, AsyncTagsResourceWithStreamingResponse, ) -from .clients import ( - ClientsResource, - AsyncClientsResource, - ClientsResourceWithRawResponse, - AsyncClientsResourceWithRawResponse, - ClientsResourceWithStreamingResponse, - AsyncClientsResourceWithStreamingResponse, -) from .ip_info import ( IPInfoResource, AsyncIPInfoResource, @@ -84,10 +76,6 @@ class WaapResource(SyncAPIResource): - @cached_property - def clients(self) -> ClientsResource: - return ClientsResource(self._client) - @cached_property def statistics(self) -> StatisticsResource: return StatisticsResource(self._client) @@ -156,10 +144,6 @@ def get_account_overview( class AsyncWaapResource(AsyncAPIResource): - @cached_property - def clients(self) -> AsyncClientsResource: - return AsyncClientsResource(self._client) - @cached_property def statistics(self) -> AsyncStatisticsResource: return AsyncStatisticsResource(self._client) @@ -235,10 +219,6 @@ def __init__(self, waap: WaapResource) -> None: waap.get_account_overview, ) - @cached_property - def clients(self) -> ClientsResourceWithRawResponse: - return ClientsResourceWithRawResponse(self._waap.clients) - @cached_property def statistics(self) -> StatisticsResourceWithRawResponse: return StatisticsResourceWithRawResponse(self._waap.statistics) @@ -276,10 +256,6 @@ def __init__(self, waap: AsyncWaapResource) -> None: waap.get_account_overview, ) - @cached_property - def clients(self) -> AsyncClientsResourceWithRawResponse: - return AsyncClientsResourceWithRawResponse(self._waap.clients) - @cached_property def statistics(self) -> AsyncStatisticsResourceWithRawResponse: return AsyncStatisticsResourceWithRawResponse(self._waap.statistics) @@ -317,10 +293,6 @@ def __init__(self, waap: WaapResource) -> None: waap.get_account_overview, ) - @cached_property - def clients(self) -> ClientsResourceWithStreamingResponse: - return ClientsResourceWithStreamingResponse(self._waap.clients) - @cached_property def statistics(self) -> StatisticsResourceWithStreamingResponse: return StatisticsResourceWithStreamingResponse(self._waap.statistics) @@ -358,10 +330,6 @@ def __init__(self, waap: AsyncWaapResource) -> None: waap.get_account_overview, ) - @cached_property - def clients(self) -> AsyncClientsResourceWithStreamingResponse: - return AsyncClientsResourceWithStreamingResponse(self._waap.clients) - @cached_property def statistics(self) -> AsyncStatisticsResourceWithStreamingResponse: return AsyncStatisticsResourceWithStreamingResponse(self._waap.statistics) diff --git a/src/gcore/types/waap/__init__.py b/src/gcore/types/waap/__init__.py index f74ffde6..88cc7228 100644 --- a/src/gcore/types/waap/__init__.py +++ b/src/gcore/types/waap/__init__.py @@ -18,7 +18,6 @@ from .waap_top_session import WaapTopSession as WaapTopSession from .waap_organization import WaapOrganization as WaapOrganization from .waap_traffic_type import WaapTrafficType as WaapTrafficType -from .client_me_response import ClientMeResponse as ClientMeResponse from .domain_list_params import DomainListParams as DomainListParams from .ip_info_get_params import IPInfoGetParams as IPInfoGetParams from .waap_advanced_rule import WaapAdvancedRule as WaapAdvancedRule diff --git a/src/gcore/types/waap/client_me_response.py b/src/gcore/types/waap/client_me_response.py deleted file mode 100644 index 15310d16..00000000 --- a/src/gcore/types/waap/client_me_response.py +++ /dev/null @@ -1,34 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional - -from ..._models import BaseModel - -__all__ = ["ClientMeResponse", "Quotas", "Service"] - - -class Quotas(BaseModel): - allowed: int - """The maximum allowed number of this resource""" - - current: int - """The current number of this resource""" - - -class Service(BaseModel): - enabled: bool - """Whether the service is enabled""" - - -class ClientMeResponse(BaseModel): - id: Optional[int] = None - """The client ID""" - - features: List[str] - """List of enabled features""" - - quotas: Dict[str, Quotas] - """Quotas for the client""" - - service: Service - """Information about the WAAP service status""" diff --git a/tests/api_resources/waap/test_clients.py b/tests/api_resources/waap/test_clients.py deleted file mode 100644 index d7d83c47..00000000 --- a/tests/api_resources/waap/test_clients.py +++ /dev/null @@ -1,72 +0,0 @@ -# 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.waap import ClientMeResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestClients: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_me(self, client: Gcore) -> None: - client_ = client.waap.clients.me() - assert_matches_type(ClientMeResponse, client_, path=["response"]) - - @parametrize - def test_raw_response_me(self, client: Gcore) -> None: - response = client.waap.clients.with_raw_response.me() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - client_ = response.parse() - assert_matches_type(ClientMeResponse, client_, path=["response"]) - - @parametrize - def test_streaming_response_me(self, client: Gcore) -> None: - with client.waap.clients.with_streaming_response.me() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - client_ = response.parse() - assert_matches_type(ClientMeResponse, client_, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncClients: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_me(self, async_client: AsyncGcore) -> None: - client = await async_client.waap.clients.me() - assert_matches_type(ClientMeResponse, client, path=["response"]) - - @parametrize - async def test_raw_response_me(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.clients.with_raw_response.me() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - client = await response.parse() - assert_matches_type(ClientMeResponse, client, path=["response"]) - - @parametrize - async def test_streaming_response_me(self, async_client: AsyncGcore) -> None: - async with async_client.waap.clients.with_streaming_response.me() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - client = await response.parse() - assert_matches_type(ClientMeResponse, client, path=["response"]) - - assert cast(Any, response.is_closed) is True From 188f4d02e28567896f513cf7762a2108dfbb2104 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Jun 2025 02:21:43 +0000 Subject: [PATCH 167/592] chore(readme): update badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index da3f33d4..6037f07c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Gcore Python API library -[![PyPI version](https://img.shields.io/pypi/v/gcore.svg)](https://pypi.org/project/gcore/) +[![PyPI version]()](https://pypi.org/project/gcore/) The Gcore Python library provides convenient access to the Gcore REST API from any Python 3.8+ application. The library includes type definitions for all request params and response fields, From ac75d8033adffc2e8c9d4ba6b13a543df1cd3b89 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Jun 2025 06:02:43 +0000 Subject: [PATCH 168/592] fix(tests): fix: tests which call HTTP endpoints directly with the example parameters --- tests/test_client.py | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index c6b0df66..bef5cc73 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -23,9 +23,7 @@ from gcore import Gcore, AsyncGcore, APIResponseValidationError from gcore._types import Omit -from gcore._utils import maybe_transform from gcore._models import BaseModel, FinalRequestOptions -from gcore._constants import RAW_RESPONSE_HEADER from gcore._exceptions import GcoreError, APIStatusError, APITimeoutError, APIResponseValidationError from gcore._base_client import ( DEFAULT_TIMEOUT, @@ -35,7 +33,6 @@ DefaultAsyncHttpxClient, make_request_options, ) -from gcore.types.cloud.project_create_params import ProjectCreateParams from .utils import update_env @@ -735,32 +732,21 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: Gcore) -> None: respx_mock.post("/cloud/v1/projects").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - self.client.post( - "/cloud/v1/projects", - body=cast(object, maybe_transform(dict(name="New Project"), ProjectCreateParams)), - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + client.cloud.projects.with_streaming_response.create(name="New Project").__enter__() assert _get_open_connections(self.client) == 0 @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: Gcore) -> None: respx_mock.post("/cloud/v1/projects").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - self.client.post( - "/cloud/v1/projects", - body=cast(object, maybe_transform(dict(name="New Project"), ProjectCreateParams)), - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) - + client.cloud.projects.with_streaming_response.create(name="New Project").__enter__() assert _get_open_connections(self.client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @@ -1582,32 +1568,21 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, async_client: AsyncGcore) -> None: respx_mock.post("/cloud/v1/projects").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - await self.client.post( - "/cloud/v1/projects", - body=cast(object, maybe_transform(dict(name="New Project"), ProjectCreateParams)), - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + await async_client.cloud.projects.with_streaming_response.create(name="New Project").__aenter__() assert _get_open_connections(self.client) == 0 @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, async_client: AsyncGcore) -> None: respx_mock.post("/cloud/v1/projects").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - await self.client.post( - "/cloud/v1/projects", - body=cast(object, maybe_transform(dict(name="New Project"), ProjectCreateParams)), - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) - + await async_client.cloud.projects.with_streaming_response.create(name="New Project").__aenter__() assert _get_open_connections(self.client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) From 16e56acee09a4cb87d96d76e8169bec825aa41db Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Jun 2025 03:01:01 +0000 Subject: [PATCH 169/592] docs(client): fix httpx.Timeout documentation reference --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6037f07c..9a36a999 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,7 @@ client.with_options(max_retries=5).cloud.projects.create( ### Timeouts By default requests time out after 1 minute. You can configure this with a `timeout` option, -which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object: +which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object: ```python from gcore import Gcore From af735779ebf25fe50d2a72b9bd84009fb490848f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Jun 2025 14:10:04 +0000 Subject: [PATCH 170/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 13 +- .../resources/cloud/baremetal/flavors.py | 24 ++-- src/gcore/resources/cloud/baremetal/images.py | 22 ++-- .../resources/cloud/baremetal/servers.py | 36 +++--- .../resources/cloud/billing_reservations.py | 4 +- src/gcore/resources/cloud/floating_ips.py | 12 +- .../gpu_baremetal_clusters.py | 36 ++++-- .../cloud/gpu_baremetal_clusters/images.py | 8 +- .../gpu_baremetal_clusters/interfaces.py | 4 +- .../cloud/gpu_baremetal_clusters/servers.py | 12 +- .../cloud/inference/registry_credentials.py | 4 +- .../resources/cloud/inference/secrets.py | 16 +-- .../resources/cloud/instances/flavors.py | 32 ++--- src/gcore/resources/cloud/instances/images.py | 66 ++++++---- .../resources/cloud/instances/instances.py | 68 ++++++---- .../resources/cloud/instances/interfaces.py | 4 +- .../cloud/load_balancers/listeners.py | 8 +- .../cloud/load_balancers/load_balancers.py | 26 ++-- .../resources/cloud/load_balancers/metrics.py | 4 +- .../load_balancers/pools/health_monitors.py | 4 +- .../resources/cloud/networks/networks.py | 18 +-- src/gcore/resources/cloud/networks/routers.py | 36 +++--- src/gcore/resources/cloud/networks/subnets.py | 18 +-- src/gcore/resources/cloud/projects.py | 62 +++++---- src/gcore/resources/cloud/quotas/quotas.py | 12 +- src/gcore/resources/cloud/quotas/requests.py | 16 +-- .../resources/cloud/registries/artifacts.py | 8 +- .../resources/cloud/registries/registries.py | 30 ++--- .../cloud/registries/repositories.py | 8 +- src/gcore/resources/cloud/registries/tags.py | 4 +- src/gcore/resources/cloud/registries/users.py | 43 +++---- .../reserved_fixed_ips/reserved_fixed_ips.py | 40 +++--- .../resources/cloud/reserved_fixed_ips/vip.py | 20 +-- .../resources/cloud/security_groups/rules.py | 12 +- .../cloud/security_groups/security_groups.py | 64 +++++----- src/gcore/resources/cloud/tasks.py | 8 +- .../resources/cloud/users/role_assignments.py | 26 ++-- src/gcore/resources/cloud/volumes.py | 120 ++++++++++++------ .../cloud/baremetal/image_list_params.py | 6 +- .../cloud/baremetal/server_list_params.py | 6 +- .../types/cloud/floating_ip_list_params.py | 6 +- src/gcore/types/cloud/instance_list_params.py | 6 +- .../cloud/instances/image_list_params.py | 6 +- .../types/cloud/load_balancer_list_params.py | 6 +- .../cloud/load_balancer_update_params.py | 5 +- src/gcore/types/cloud/network_list_params.py | 6 +- .../types/cloud/network_update_params.py | 5 +- .../cloud/networks/router_list_params.py | 4 +- .../cloud/networks/subnet_list_params.py | 6 +- .../cloud/networks/subnet_update_params.py | 5 +- src/gcore/types/cloud/registries/__init__.py | 1 + .../user_refresh_secret_response.py | 31 +++++ .../cloud/reserved_fixed_ip_list_params.py | 4 +- .../types/cloud/security_group_list_params.py | 10 +- .../cloud/security_group_update_params.py | 5 +- src/gcore/types/cloud/volume_list_params.py | 6 +- .../cloud/registries/test_users.py | 29 +++-- .../cloud/test_security_groups.py | 12 +- 59 files changed, 611 insertions(+), 506 deletions(-) create mode 100644 src/gcore/types/cloud/registries/user_refresh_secret_response.py diff --git a/.stats.yml b/.stats.yml index 0cc0367f..11475e47 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c69353c2638a896685622a7bc91746002ce45c684c09f0cd59f90d193a711bfd.yml -openapi_spec_hash: 288f2041f8a716abffdbdf64ae886c63 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6335dff48838208c2b58720ea26dda6b46ee4e8f0cbed4a3e7839e2a85c53de4.yml +openapi_spec_hash: d9954e09f207068566e8b8f3052ac498 config_hash: 851d2f0c1f925aee3b53478d4fe311ba diff --git a/api.md b/api.md index 307d30c4..238e7d83 100644 --- a/api.md +++ b/api.md @@ -418,7 +418,7 @@ Methods: - client.cloud.security_groups.update(group_id, \*, project_id, region_id, \*\*params) -> SecurityGroup - client.cloud.security_groups.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[SecurityGroup] - client.cloud.security_groups.delete(group_id, \*, project_id, region_id) -> None -- client.cloud.security_groups.copy(group_id, \*, project_id, region_id, \*\*params) -> None +- client.cloud.security_groups.copy(group_id, \*, project_id, region_id, \*\*params) -> SecurityGroup - client.cloud.security_groups.get(group_id, \*, project_id, region_id) -> SecurityGroup - client.cloud.security_groups.revert_to_default(group_id, \*, project_id, region_id) -> SecurityGroup @@ -667,17 +667,22 @@ Methods: Types: ```python -from gcore.types.cloud.registries import RegistryUser, RegistryUserCreated, RegistryUserList +from gcore.types.cloud.registries import ( + RegistryUser, + RegistryUserCreated, + RegistryUserList, + UserRefreshSecretResponse, +) ``` Methods: -- client.cloud.registries.users.create(registry_id, \*, project_id, region_id, \*\*params) -> RegistryUser +- client.cloud.registries.users.create(registry_id, \*, project_id, region_id, \*\*params) -> RegistryUserCreated - 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.refresh_secret(user_id, \*, project_id, region_id, registry_id) -> None +- client.cloud.registries.users.refresh_secret(user_id, \*, project_id, region_id, registry_id) -> UserRefreshSecretResponse ## FileShares diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 83f7e0ea..5199c40c 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -59,11 +59,12 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> BaremetalFlavorList: - """Retrieve a list of flavors. + """List all available bare metal flavors in the specified project and region. - When the `include_prices` query parameter is - specified, the list shows prices. A client in trial mode gets all price values - as 0. If you get Pricing Error contact the support + When + `include_prices` is specified, the list includes pricing information. A client + in trial mode gets all price values as 0. If you get Pricing Error contact the + support. Args: disabled: Flag for filtering disabled flavors in the region. Defaults to true @@ -129,7 +130,8 @@ def list_suitable( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> BaremetalFlavorList: """ - List suitalbe flavors for bare metal server creation + List all flavors that are suitable for creating a bare metal server with the + specified image. Args: include_prices: Set to true if flavor listing should include flavor prices @@ -210,11 +212,12 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> BaremetalFlavorList: - """Retrieve a list of flavors. + """List all available bare metal flavors in the specified project and region. - When the `include_prices` query parameter is - specified, the list shows prices. A client in trial mode gets all price values - as 0. If you get Pricing Error contact the support + When + `include_prices` is specified, the list includes pricing information. A client + in trial mode gets all price values as 0. If you get Pricing Error contact the + support. Args: disabled: Flag for filtering disabled flavors in the region. Defaults to true @@ -280,7 +283,8 @@ async def list_suitable( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> BaremetalFlavorList: """ - List suitalbe flavors for bare metal server creation + List all flavors that are suitable for creating a bare metal server with the + specified image. Args: include_prices: Set to true if flavor listing should include flavor prices diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index d49c23a6..147ebf85 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -61,10 +61,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ImageList: - """Retrieve the available images list for bare metal servers. + """Retrieve a list of available images for bare metal servers. - Returned entities may - or may not be owned by the project + The list can be + filtered by visibility, tags, and other parameters. Returned entities may or may + not be owned by the project. Args: include_prices: Show price @@ -73,9 +74,7 @@ def list( tag_key: Filter by tag keys. - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. 'curl -G - --data-urlencode '`tag_key_value`={"key": "value"}' --url - 'http://localhost:1111/v1/images/1/1'" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. visibility: Image visibility. Globally visible images are public @@ -150,10 +149,11 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ImageList: - """Retrieve the available images list for bare metal servers. + """Retrieve a list of available images for bare metal servers. - Returned entities may - or may not be owned by the project + The list can be + filtered by visibility, tags, and other parameters. Returned entities may or may + not be owned by the project. Args: include_prices: Show price @@ -162,9 +162,7 @@ async def list( tag_key: Filter by tag keys. - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. 'curl -G - --data-urlencode '`tag_key_value`={"key": "value"}' --url - 'http://localhost:1111/v1/images/1/1'" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. visibility: Image visibility. Globally visible images are public diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 8b14c8b2..0a9601b7 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -72,8 +72,10 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - For Linux, + """Create a new bare metal server with the specified configuration. + + How to get + access: For Linux, - Use the `user_data` field to provide a [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) @@ -216,8 +218,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[BaremetalServer]: - """ - List bare metal servers + """List all bare metal servers in the specified project and region. + + Results can be + filtered by various parameters like name, status, and IP address. Args: project_id: Project ID @@ -262,9 +266,7 @@ def list( status: Filters instances by a server status, as a string. - tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "`tag_key_value`={"key": "value"}" --url - "https://example.com/cloud/v1/resource/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. tag_value: Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2 @@ -345,7 +347,7 @@ def rebuild( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Rebuild bare metal server + Rebuild a bare metal server with a new image while preserving its configuration. Args: image_id: Image ID @@ -429,8 +431,10 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - For Linux, + """Create a new bare metal server with the specified configuration. + + How to get + access: For Linux, - Use the `user_data` field to provide a [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) @@ -573,8 +577,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[BaremetalServer, AsyncOffsetPage[BaremetalServer]]: - """ - List bare metal servers + """List all bare metal servers in the specified project and region. + + Results can be + filtered by various parameters like name, status, and IP address. Args: project_id: Project ID @@ -619,9 +625,7 @@ def list( status: Filters instances by a server status, as a string. - tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "`tag_key_value`={"key": "value"}" --url - "https://example.com/cloud/v1/resource/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. tag_value: Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2 @@ -702,7 +706,7 @@ async def rebuild( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Rebuild bare metal server + Rebuild a bare metal server with a new image while preserving its configuration. Args: image_id: Image ID diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index 31855aea..0d9df747 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -160,7 +160,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> BillingReservation: """ - Get specific reservation + Get reservation Args: reservation_id: ID of the reservation @@ -316,7 +316,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> BillingReservation: """ - Get specific reservation + Get reservation Args: reservation_id: ID of the reservation diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 6fab4e6c..3bbb8930 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -140,9 +140,7 @@ def list( tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "`tag_key_value`={"key": "value"}" --url - "https://example.com/cloud/v1/resource/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. extra_headers: Send extra headers @@ -321,7 +319,7 @@ def unassign( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FloatingIP: """ - Unassign floating IP from the instance + Unassign floating IP Args: extra_headers: Send extra headers @@ -461,9 +459,7 @@ def list( tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "`tag_key_value`={"key": "value"}" --url - "https://example.com/cloud/v1/resource/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. extra_headers: Send extra headers @@ -642,7 +638,7 @@ async def unassign( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FloatingIP: """ - Unassign floating IP from the instance + Unassign floating IP Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index c159ab44..733b5770 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -122,8 +122,10 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Create bare metal GPU cluster + """Create a new GPU cluster with specified configuration. + + The cluster can be + created with one or more nodes. Args: flavor: Flavor name @@ -439,8 +441,10 @@ def rebuild( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - All cluster nodes must be specified to update the cluster image. + """Rebuild one or more nodes in a GPU cluster. + + All cluster nodes must be specified + to update the cluster image. Args: nodes: List of nodes uuids to be rebuild @@ -495,8 +499,10 @@ def resize( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Resize bare metal GPU cluster + """Change the number of nodes in a GPU cluster. + + The cluster can be scaled up or + down. Args: instances_count: Resized (total) number of instances @@ -586,8 +592,10 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Create bare metal GPU cluster + """Create a new GPU cluster with specified configuration. + + The cluster can be + created with one or more nodes. Args: flavor: Flavor name @@ -903,8 +911,10 @@ async def rebuild( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - All cluster nodes must be specified to update the cluster image. + """Rebuild one or more nodes in a GPU cluster. + + All cluster nodes must be specified + to update the cluster image. Args: nodes: List of nodes uuids to be rebuild @@ -959,8 +969,10 @@ async def resize( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Resize bare metal GPU cluster + """Change the number of nodes in a GPU cluster. + + The cluster can be scaled up or + down. Args: instances_count: Resized (total) number of instances diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index d6de5b4d..8c2d4623 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -100,7 +100,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Delete bare metal GPU image by ID + Delete bare metal GPU image Args: project_id: Project ID @@ -145,7 +145,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUImage: """ - Get bare metal GPU image by ID + Get bare metal GPU image Args: project_id: Project ID @@ -341,7 +341,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Delete bare metal GPU image by ID + Delete bare metal GPU image Args: project_id: Project ID @@ -386,7 +386,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUImage: """ - Get bare metal GPU image by ID + Get bare metal GPU image Args: project_id: Project ID diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index dc9e5249..863ffde8 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -53,7 +53,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> NetworkInterfaceList: """ - Returns the network interfaces attached to the servers in the cluster. + Retrieve a list of network interfaces attached to the GPU cluster servers. Args: extra_headers: Send extra headers @@ -113,7 +113,7 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> NetworkInterfaceList: """ - Returns the network interfaces attached to the servers in the cluster. + Retrieve a list of network interfaces attached to the GPU cluster servers. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 3127e2ec..95a67029 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -65,8 +65,10 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Delete bare metal GPU server from cluster + """Delete a specific node from a GPU cluster. + + The node must be in a state that + allows deletion. Args: delete_floatings: Set False if you do not want to delete assigned floating IPs. By default, it's @@ -550,8 +552,10 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Delete bare metal GPU server from cluster + """Delete a specific node from a GPU cluster. + + The node must be in a state that + allows deletion. Args: delete_floatings: Set False if you do not want to delete assigned floating IPs. By default, it's diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 70c0cbf6..e77bb5ea 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -253,7 +253,7 @@ def replace( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Update inference registry credential + Replace inference registry credential Args: project_id: Project ID @@ -522,7 +522,7 @@ async def replace( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Update inference registry credential + Replace inference registry credential Args: project_id: Project ID diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index c21ef45c..80ceff3b 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -58,7 +58,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> InferenceSecret: """ - Create Inference Secret + Create inference secret Args: project_id: Project ID @@ -108,7 +108,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[InferenceSecret]: - """List Secrets for Inference + """List inference secrets Args: project_id: Project ID @@ -203,7 +203,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> InferenceSecret: """ - Get Inference Secret + Get inference secret Args: project_id: Project ID @@ -245,7 +245,7 @@ def replace( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> InferenceSecret: """ - Update Inference Secret + Replace inference secret Args: project_id: Project ID @@ -319,7 +319,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> InferenceSecret: """ - Create Inference Secret + Create inference secret Args: project_id: Project ID @@ -369,7 +369,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[InferenceSecret, AsyncOffsetPage[InferenceSecret]]: - """List Secrets for Inference + """List inference secrets Args: project_id: Project ID @@ -464,7 +464,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> InferenceSecret: """ - Get Inference Secret + Get inference secret Args: project_id: Project ID @@ -506,7 +506,7 @@ async def replace( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> InferenceSecret: """ - Update Inference Secret + Replace inference secret Args: project_id: Project ID diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 4dd3898e..f27760f8 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -59,11 +59,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> InstanceFlavorList: - """Retrieve a list of flavors. + """Retrieve a list of available instance flavors in the project and region. - When the `include_prices` query parameter is - specified, the list shows prices. A client in trial mode gets all price values - as 0. If you get Pricing Error contact the support + When + `include_prices` is specified, the list includes pricing information. Trial mode + clients see all prices as 0. Contact support for pricing errors. Args: disabled: Flag for filtering disabled flavors in the region. Defaults to true @@ -168,12 +168,12 @@ def list_suitable( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> InstanceFlavorList: - """List suitable flavors for instance creation + """ + List all flavors that are suitable for instance creation based on volume + requirements. Args: - volumes: Volumes details. - - Non-important info such as names may be omitted. + volumes: Volumes details. Non-important info such as names may be omitted. include_prices: Set to true if flavor listing should include flavor prices @@ -241,11 +241,11 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> InstanceFlavorList: - """Retrieve a list of flavors. + """Retrieve a list of available instance flavors in the project and region. - When the `include_prices` query parameter is - specified, the list shows prices. A client in trial mode gets all price values - as 0. If you get Pricing Error contact the support + When + `include_prices` is specified, the list includes pricing information. Trial mode + clients see all prices as 0. Contact support for pricing errors. Args: disabled: Flag for filtering disabled flavors in the region. Defaults to true @@ -350,12 +350,12 @@ async def list_suitable( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> InstanceFlavorList: - """List suitable flavors for instance creation + """ + List all flavors that are suitable for instance creation based on volume + requirements. Args: - volumes: Volumes details. - - Non-important info such as names may be omitted. + volumes: Volumes details. Non-important info such as names may be omitted. include_prices: Set to true if flavor listing should include flavor prices diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index 37713d34..ecead38a 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -74,7 +74,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Image: """ - Update image fields + Update image properties and tags. Args: hw_firmware_type: Specifies the type of firmware with which to boot the guest. @@ -146,10 +146,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ImageList: - """Retrieve an available images list. + """Retrieve a list of available images in the project and region. - Returned entities owned by the project and - public OR shared with the client + The list can be + filtered by visibility, tags, and other parameters. Returned entities are owned + by the project or are public/shared with the client. Args: include_prices: Show price @@ -158,9 +159,7 @@ def list( tag_key: Filter by tag keys. - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. 'curl -G - --data-urlencode '`tag_key_value`={"key": "value"}' --url - 'http://localhost:1111/v1/images/1/1'" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. visibility: Image visibility. Globally visible images are public @@ -210,8 +209,10 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Delete the image + """Delete a specific image. + + The image cannot be deleted if it is used by protected + snapshots. Args: extra_headers: Send extra headers @@ -258,8 +259,10 @@ def create_from_volume( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Create image from volume + """Create a new image from a bootable volume. + + The volume must be bootable to create + an image from it. Args: name: Image name @@ -336,7 +339,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Image: """ - Get image + Retrieve detailed information about a specific image. Args: include_prices: Show price @@ -391,8 +394,10 @@ def upload( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Upload image + """Upload an image from a URL. + + The image can be configured with various properties + like OS type, architecture, and tags. Args: name: Image name @@ -503,7 +508,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Image: """ - Update image fields + Update image properties and tags. Args: hw_firmware_type: Specifies the type of firmware with which to boot the guest. @@ -575,10 +580,11 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ImageList: - """Retrieve an available images list. + """Retrieve a list of available images in the project and region. - Returned entities owned by the project and - public OR shared with the client + The list can be + filtered by visibility, tags, and other parameters. Returned entities are owned + by the project or are public/shared with the client. Args: include_prices: Show price @@ -587,9 +593,7 @@ async def list( tag_key: Filter by tag keys. - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. 'curl -G - --data-urlencode '`tag_key_value`={"key": "value"}' --url - 'http://localhost:1111/v1/images/1/1'" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. visibility: Image visibility. Globally visible images are public @@ -639,8 +643,10 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Delete the image + """Delete a specific image. + + The image cannot be deleted if it is used by protected + snapshots. Args: extra_headers: Send extra headers @@ -687,8 +693,10 @@ async def create_from_volume( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Create image from volume + """Create a new image from a bootable volume. + + The volume must be bootable to create + an image from it. Args: name: Image name @@ -765,7 +773,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Image: """ - Get image + Retrieve detailed information about a specific image. Args: include_prices: Show price @@ -820,8 +828,10 @@ async def upload( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Upload image + """Upload an image from a URL. + + The image can be configured with various properties + like OS type, architecture, and tags. Args: name: Image name diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 4ae9a115..4859c14a 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -134,8 +134,9 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - For Linux, + """Create an instance with specified configuration. + + How to get access: For Linux, - Use the `user_data` field to provide a [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) @@ -358,8 +359,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[Instance]: - """ - List instances + """List all instances in the specified project and region. + + Results can be filtered + by various parameters like name, status, and IP address. Args: project_id: Project ID @@ -414,9 +417,7 @@ def list( status: Filters instances by status. - tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "`tag_key_value`={"key": "value"}" --url - "https://example.com/cloud/v1/resource/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. tag_value: Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2 @@ -674,8 +675,10 @@ def add_to_placement_group( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Put instance into the server group + """Add an instance to a server group. + + The instance must not already be in a server + group. Bare metal servers do not support server groups. Args: servergroup_id: Anti-affinity or affinity or soft-anti-affinity server group ID. @@ -853,8 +856,11 @@ def get( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Instance: - """ - **Cookie Parameters**: + """Retrieve detailed information about a specific instance. + + The response content + language for `ddos_profile` can be controlled via the 'language' cookie + parameter. **Cookie Parameters**: - `language` (str, optional): Language for the response content. Affects the `ddos_profile` field. Supported values: @@ -952,8 +958,10 @@ def remove_from_placement_group( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Remove instance from the server group + """Remove an instance from its current server group. + + The instance must be in a + server group to be removed. Bare metal servers do not support server groups. Args: extra_headers: Send extra headers @@ -1140,8 +1148,9 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - For Linux, + """Create an instance with specified configuration. + + How to get access: For Linux, - Use the `user_data` field to provide a [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) @@ -1364,8 +1373,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Instance, AsyncOffsetPage[Instance]]: - """ - List instances + """List all instances in the specified project and region. + + Results can be filtered + by various parameters like name, status, and IP address. Args: project_id: Project ID @@ -1420,9 +1431,7 @@ def list( status: Filters instances by status. - tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "`tag_key_value`={"key": "value"}" --url - "https://example.com/cloud/v1/resource/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. tag_value: Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2 @@ -1680,8 +1689,10 @@ async def add_to_placement_group( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Put instance into the server group + """Add an instance to a server group. + + The instance must not already be in a server + group. Bare metal servers do not support server groups. Args: servergroup_id: Anti-affinity or affinity or soft-anti-affinity server group ID. @@ -1859,8 +1870,11 @@ async def get( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Instance: - """ - **Cookie Parameters**: + """Retrieve detailed information about a specific instance. + + The response content + language for `ddos_profile` can be controlled via the 'language' cookie + parameter. **Cookie Parameters**: - `language` (str, optional): Language for the response content. Affects the `ddos_profile` field. Supported values: @@ -1958,8 +1972,10 @@ async def remove_from_placement_group( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Remove instance from the server group + """Remove an instance from its current server group. + + The instance must be in a + server group to be removed. Bare metal servers do not support server groups. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 733ded71..9cc4b04f 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -59,7 +59,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> NetworkInterfaceList: """ - List network interfaces attached to the instance + List all network interfaces attached to the specified instance. Args: extra_headers: Send extra headers @@ -415,7 +415,7 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> NetworkInterfaceList: """ - List network interfaces attached to the instance + List all network interfaces attached to the specified instance. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 3198371d..2b9827b5 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -175,7 +175,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Update listener + Update load balancer listener Args: project_id: Project ID @@ -356,7 +356,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LoadBalancerListenerDetail: """ - Get listener + Get load balancer listener Args: project_id: Project ID @@ -537,7 +537,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Update listener + Update load balancer listener Args: project_id: Project ID @@ -718,7 +718,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LoadBalancerListenerDetail: """ - Get listener + Get load balancer listener Args: project_id: Project ID diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 50f1a16d..104d858f 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -264,12 +264,15 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. - Unspecified tags remain unchanged. **Examples:** + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - **Mixed operations:** @@ -355,9 +358,7 @@ def list( tag_key: Filter by tag keys. - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G - --data-urlencode "`tag_key_value`={"key": "value"}" --url - "http://localhost:1111/v1/loadbalancers/1/1" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. with_ddos: Show Advanced DDoS protection profile, if exists @@ -454,7 +455,7 @@ def failover( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Failover loadbalancer + Failover load balancer Args: force: Validate current load balancer status before failover or not. @@ -552,7 +553,7 @@ def resize( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Resize loadbalancer + Resize load balancer Args: flavor: Name of the desired flavor to resize to. @@ -760,12 +761,15 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. - Unspecified tags remain unchanged. **Examples:** + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - **Mixed operations:** @@ -851,9 +855,7 @@ def list( tag_key: Filter by tag keys. - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G - --data-urlencode "`tag_key_value`={"key": "value"}" --url - "http://localhost:1111/v1/loadbalancers/1/1" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. with_ddos: Show Advanced DDoS protection profile, if exists @@ -950,7 +952,7 @@ async def failover( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Failover loadbalancer + Failover load balancer Args: force: Validate current load balancer status before failover or not. @@ -1050,7 +1052,7 @@ async def resize( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Resize loadbalancer + Resize load balancer Args: flavor: Name of the desired flavor to resize to. diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index 7cfa283c..59df8038 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -59,7 +59,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LoadBalancerMetricsList: """ - Get loadbalancer metrics, including cpu, memory and network + Get load balancer metrics, including cpu, memory and network Args: time_interval: Time interval @@ -132,7 +132,7 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LoadBalancerMetricsList: """ - Get loadbalancer metrics, including cpu, memory and network + Get load balancer metrics, including cpu, memory and network Args: time_interval: Time interval diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index 0a63989b..3712deec 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -68,7 +68,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create Load Balancer Pool Health Monitor + Create load balancer pool health monitor Args: project_id: Project ID @@ -219,7 +219,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create Load Balancer Pool Health Monitor + Create load balancer pool health monitor Args: project_id: Project ID diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 9647db97..13f2084d 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -168,12 +168,15 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. - Unspecified tags remain unchanged. **Examples:** + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - **Mixed operations:** @@ -250,9 +253,7 @@ def list( tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "`tag_key_value`={"key": "value"}" --url - "https://example.com/cloud/v1/resource/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. extra_headers: Send extra headers @@ -505,12 +506,15 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. - Unspecified tags remain unchanged. **Examples:** + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - **Mixed operations:** @@ -587,9 +591,7 @@ def list( tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "`tag_key_value`={"key": "value"}" --url - "https://example.com/cloud/v1/resource/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 97c942f6..657982bd 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -68,7 +68,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create router + Create a new router with the specified configuration. Args: name: name of router @@ -125,7 +125,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Router: """ - Update router + Update the configuration of an existing router. Args: external_gateway_info: New external gateway. @@ -179,12 +179,12 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[Router]: """ - List routers + List all routers in the specified project and region. Args: - limit: Limit the number of returned limit request entities. + limit: Limit the number of returned routers - offset: Offset value is used to exclude the first set of records from the result. + offset: Offset value is used to exclude the first set of records from the result extra_headers: Send extra headers @@ -231,7 +231,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Delete router + Delete a specific router and all its associated resources. Args: extra_headers: Send extra headers @@ -272,7 +272,7 @@ def attach_subnet( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Router: """ - Attach subnet to router + Attach a subnet to an existing router. Args: project_id: Project ID @@ -330,7 +330,7 @@ def detach_subnet( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Router: """ - Detach subnet from router + Detach a subnet from an existing router. Args: subnet_id: Target IP is identified by it's subnet @@ -372,7 +372,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Router: """ - Get specific router + Get detailed information about a specific router. Args: extra_headers: Send extra headers @@ -435,7 +435,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create router + Create a new router with the specified configuration. Args: name: name of router @@ -492,7 +492,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Router: """ - Update router + Update the configuration of an existing router. Args: external_gateway_info: New external gateway. @@ -546,12 +546,12 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Router, AsyncOffsetPage[Router]]: """ - List routers + List all routers in the specified project and region. Args: - limit: Limit the number of returned limit request entities. + limit: Limit the number of returned routers - offset: Offset value is used to exclude the first set of records from the result. + offset: Offset value is used to exclude the first set of records from the result extra_headers: Send extra headers @@ -598,7 +598,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Delete router + Delete a specific router and all its associated resources. Args: extra_headers: Send extra headers @@ -639,7 +639,7 @@ async def attach_subnet( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Router: """ - Attach subnet to router + Attach a subnet to an existing router. Args: project_id: Project ID @@ -697,7 +697,7 @@ async def detach_subnet( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Router: """ - Detach subnet from router + Detach a subnet from an existing router. Args: subnet_id: Target IP is identified by it's subnet @@ -741,7 +741,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Router: """ - Get specific router + Get detailed information about a specific router. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 311bd170..1f61c9b2 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -192,12 +192,15 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. - Unspecified tags remain unchanged. **Examples:** + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - **Mixed operations:** @@ -293,9 +296,7 @@ def list( tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "`tag_key_value`={"key": "value"}" --url - "https://example.com/cloud/v1/resource/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. extra_headers: Send extra headers @@ -587,12 +588,15 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. - Unspecified tags remain unchanged. **Examples:** + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - **Mixed operations:** @@ -688,9 +692,7 @@ def list( tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "`tag_key_value`={"key": "value"}" --url - "https://example.com/cloud/v1/resource/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 1412cae0..383f3c3b 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -60,12 +60,13 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Project: - """Create project + """Create a new project for a client. - Args: - name: Unique project name for a client. + Project management must be enabled to perform + this operation. - Each client always has one "default" project. + Args: + name: Unique project name for a client. Each client always has one "default" project. client_id: ID associated with the client. @@ -114,8 +115,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[Project]: - """ - List projects + """Retrieve a list of projects for a client. + + Results can be filtered by name and + ordered by various fields. Args: client_id: Client ID filter for administrators. @@ -172,9 +175,11 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - All cloud resources in all regions that belong to the project will be deleted - and will not be recoverable + """Delete a project and all its associated cloud resources across all regions. + + This + operation is irreversible and cannot be undone. Default projects cannot be + deleted. Args: extra_headers: Send extra headers @@ -207,7 +212,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Project: """ - Get Project + Retrieve detailed information about a specific project. Args: extra_headers: Send extra headers @@ -241,8 +246,10 @@ def replace( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Project: - """ - Update Project + """Update project name and description. + + Project management must be enabled to + perform this operation. Args: name: Name of the entity, following a specific format. @@ -309,12 +316,13 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Project: - """Create project + """Create a new project for a client. - Args: - name: Unique project name for a client. + Project management must be enabled to perform + this operation. - Each client always has one "default" project. + Args: + name: Unique project name for a client. Each client always has one "default" project. client_id: ID associated with the client. @@ -363,8 +371,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Project, AsyncOffsetPage[Project]]: - """ - List projects + """Retrieve a list of projects for a client. + + Results can be filtered by name and + ordered by various fields. Args: client_id: Client ID filter for administrators. @@ -421,9 +431,11 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - All cloud resources in all regions that belong to the project will be deleted - and will not be recoverable + """Delete a project and all its associated cloud resources across all regions. + + This + operation is irreversible and cannot be undone. Default projects cannot be + deleted. Args: extra_headers: Send extra headers @@ -456,7 +468,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Project: """ - Get Project + Retrieve detailed information about a specific project. Args: extra_headers: Send extra headers @@ -490,8 +502,10 @@ async def replace( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Project: - """ - Update Project + """Update project name and description. + + Project management must be enabled to + perform this operation. Args: name: Name of the entity, following a specific format. diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 46f5ca02..9a9f9c82 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -63,7 +63,7 @@ def get_all( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> QuotaGetAllResponse: - """Get combined client quotas, regional and global.""" + """Get combined client quotas, including both regional and global quotas.""" return self._get( "/cloud/v2/client_quotas", options=make_request_options( @@ -85,7 +85,7 @@ def get_by_region( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> QuotaGetByRegionResponse: """ - Get a quota by region + Get quotas for a specific region and client. Args: client_id: Client ID @@ -122,7 +122,7 @@ def get_global( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> QuotaGetGlobalResponse: """ - Get global quota + Get global quotas for a specific client. Args: client_id: Client ID @@ -178,7 +178,7 @@ async def get_all( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> QuotaGetAllResponse: - """Get combined client quotas, regional and global.""" + """Get combined client quotas, including both regional and global quotas.""" return await self._get( "/cloud/v2/client_quotas", options=make_request_options( @@ -200,7 +200,7 @@ async def get_by_region( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> QuotaGetByRegionResponse: """ - Get a quota by region + Get quotas for a specific region and client. Args: client_id: Client ID @@ -237,7 +237,7 @@ async def get_global( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> QuotaGetGlobalResponse: """ - Get global quota + Get global quotas for a specific client. Args: client_id: Client ID diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 39611360..d6ba0a82 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -60,7 +60,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Create request to change quotas + Create a request to change current quotas. Args: description: Describe the reason, in general terms. @@ -108,7 +108,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[RequestListResponse]: """ - Returns a list of sent requests to change current quotas and their statuses + Get a list of sent requests to change current quotas and their statuses. Args: limit: Optional. Limit the number of returned items @@ -158,7 +158,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete request to change quotas + Delete a specific quota limit request. Args: request_id: LimitRequest ID @@ -194,7 +194,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RequestGetResponse: """ - Get request to change quota limits. + Get detailed information about a specific quota limit request. Args: request_id: LimitRequest ID @@ -252,7 +252,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Create request to change quotas + Create a request to change current quotas. Args: description: Describe the reason, in general terms. @@ -300,7 +300,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[RequestListResponse, AsyncOffsetPage[RequestListResponse]]: """ - Returns a list of sent requests to change current quotas and their statuses + Get a list of sent requests to change current quotas and their statuses. Args: limit: Optional. Limit the number of returned items @@ -350,7 +350,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete request to change quotas + Delete a specific quota limit request. Args: request_id: LimitRequest ID @@ -386,7 +386,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RequestGetResponse: """ - Get request to change quota limits. + Get detailed information about a specific quota limit request. Args: request_id: LimitRequest ID diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index f336141b..0b579ba5 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -54,7 +54,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RegistryArtifactList: """ - List artifacts + List all artifacts in a specific repository. Args: extra_headers: Send extra headers @@ -95,7 +95,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete an artifact + Delete a specific artifact from a repository. Args: extra_headers: Send extra headers @@ -159,7 +159,7 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RegistryArtifactList: """ - List artifacts + List all artifacts in a specific repository. Args: extra_headers: Send extra headers @@ -200,7 +200,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete an artifact + Delete a specific artifact from a repository. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 2d9580ce..8889d473 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -104,12 +104,11 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Registry: - """Create a registry + """ + Create a new container registry with the specified configuration. Args: - name: A name for the container registry. - - Should be in lowercase, consisting only of + name: A name for the container registry. Should be in lowercase, consisting only of numbers, letters and -, with maximum length of 24 characters storage_limit: Registry storage limit, GiB @@ -154,7 +153,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RegistryList: """ - Get registry list + List all container registries in the specified project and region. Args: extra_headers: Send extra headers @@ -191,7 +190,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete a registry + Delete a specific container registry and all its associated resources. Args: extra_headers: Send extra headers @@ -229,7 +228,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Registry: """ - Get a registry + Get detailed information about a specific container registry. Args: extra_headers: Send extra headers @@ -267,7 +266,7 @@ def resize( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Registry: """ - Resize a registry + Update the size of a container registry. Args: storage_limit: Registry storage limit, GiB @@ -344,12 +343,11 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Registry: - """Create a registry + """ + Create a new container registry with the specified configuration. Args: - name: A name for the container registry. - - Should be in lowercase, consisting only of + name: A name for the container registry. Should be in lowercase, consisting only of numbers, letters and -, with maximum length of 24 characters storage_limit: Registry storage limit, GiB @@ -394,7 +392,7 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RegistryList: """ - Get registry list + List all container registries in the specified project and region. Args: extra_headers: Send extra headers @@ -431,7 +429,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete a registry + Delete a specific container registry and all its associated resources. Args: extra_headers: Send extra headers @@ -469,7 +467,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Registry: """ - Get a registry + Get detailed information about a specific container registry. Args: extra_headers: Send extra headers @@ -507,7 +505,7 @@ async def resize( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Registry: """ - Resize a registry + Update the size of a container registry. Args: storage_limit: Registry storage limit, GiB diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index b2d9c600..74377052 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -53,7 +53,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RegistryRepositoryList: """ - List repositories + List all repositories in the container registry. Args: extra_headers: Send extra headers @@ -91,7 +91,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete a repository + Delete a specific repository from the container registry. Args: extra_headers: Send extra headers @@ -152,7 +152,7 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RegistryRepositoryList: """ - List repositories + List all repositories in the container registry. Args: extra_headers: Send extra headers @@ -190,7 +190,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete a repository + Delete a specific repository from the container registry. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index 3a8d39ea..ab35828c 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -55,7 +55,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete a tag + Delete a specific tag from an artifact. Args: extra_headers: Send extra headers @@ -123,7 +123,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete a tag + Delete a specific tag from an artifact. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index c9e1b821..f535c7dd 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -21,6 +21,7 @@ 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.user_refresh_secret_response import UserRefreshSecretResponse __all__ = ["UsersResource", "AsyncUsersResource"] @@ -61,9 +62,9 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegistryUser: + ) -> RegistryUserCreated: """ - Create a user + Create a new user for accessing the container registry. Args: duration: User account operating time, days @@ -101,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=RegistryUser, + cast_to=RegistryUserCreated, ) def update( @@ -121,7 +122,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RegistryUser: """ - Update a user + Update the configuration of a specific registry user. Args: duration: User account operating time, days @@ -169,7 +170,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RegistryUserList: """ - Get user list + List all users with access to the container registry. Args: extra_headers: Send extra headers @@ -207,7 +208,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete a user + Delete a specific user from the container registry. Args: extra_headers: Send extra headers @@ -246,7 +247,7 @@ def create_multiple( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RegistryUserCreated: """ - Batch create users + Create multiple users for accessing the container registry in a single request. Args: users: Set of users @@ -285,9 +286,9 @@ def refresh_secret( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: + ) -> UserRefreshSecretResponse: """ - Refresh a secret + Generate a new secret for a specific registry user. Args: extra_headers: Send extra headers @@ -302,13 +303,12 @@ def refresh_secret( 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() - extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=NoneType, + cast_to=UserRefreshSecretResponse, ) @@ -348,9 +348,9 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegistryUser: + ) -> RegistryUserCreated: """ - Create a user + Create a new user for accessing the container registry. Args: duration: User account operating time, days @@ -388,7 +388,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RegistryUser, + cast_to=RegistryUserCreated, ) async def update( @@ -408,7 +408,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RegistryUser: """ - Update a user + Update the configuration of a specific registry user. Args: duration: User account operating time, days @@ -456,7 +456,7 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RegistryUserList: """ - Get user list + List all users with access to the container registry. Args: extra_headers: Send extra headers @@ -494,7 +494,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete a user + Delete a specific user from the container registry. Args: extra_headers: Send extra headers @@ -533,7 +533,7 @@ async def create_multiple( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RegistryUserCreated: """ - Batch create users + Create multiple users for accessing the container registry in a single request. Args: users: Set of users @@ -572,9 +572,9 @@ async def refresh_secret( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: + ) -> UserRefreshSecretResponse: """ - Refresh a secret + Generate a new secret for a specific registry user. Args: extra_headers: Send extra headers @@ -589,13 +589,12 @@ async def refresh_secret( 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() - extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=NoneType, + cast_to=UserRefreshSecretResponse, ) diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index 6afd2869..d5b0e030 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -76,7 +76,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create reserved fixed IP + Create a new reserved fixed IP with the specified configuration. Args: type: Must be 'external' @@ -112,7 +112,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create reserved fixed IP + Create a new reserved fixed IP with the specified configuration. Args: subnet_id: Reserved fixed IP will be allocated in this subnet @@ -149,7 +149,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create reserved fixed IP + Create a new reserved fixed IP with the specified configuration. Args: network_id: Reserved fixed IP will be allocated in a subnet of this network @@ -188,7 +188,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create reserved fixed IP + Create a new reserved fixed IP with the specified configuration. Args: ip_address: Reserved fixed IP will be allocated the given IP address @@ -225,7 +225,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create reserved fixed IP + Create a new reserved fixed IP with the specified configuration. Args: port_id: Port ID to make a reserved fixed IP (for example, `vip_port_id` of the Load @@ -315,7 +315,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[ReservedFixedIP]: """ - List reserved fixed IPs + List all reserved fixed IPs in the specified project and region. Args: available_only: Set to true if the response should only list IP addresses that are not attached @@ -334,8 +334,8 @@ def list( offset: Offset value is used to exclude the first set of records from the result order_by: Ordering reserved fixed IP list result by name, status, `updated_at`, - `created_at` or `fixed_ip_address` fields of the reserved fixed IP and - directions (status.asc), default is "`fixed_ip_address`.asc" + `created_at` or `fixed_ip_address` fields and directions (status.asc), default + is "`fixed_ip_address`.asc" vip_only: Set to true if the response should only list VIPs @@ -391,7 +391,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Delete reserved fixed ip + Delete a specific reserved fixed IP and all its associated resources. Args: extra_headers: Send extra headers @@ -430,7 +430,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ReservedFixedIP: """ - Get reserved fixed IP + Get detailed information about a specific reserved fixed IP. Args: extra_headers: Send extra headers @@ -497,7 +497,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create reserved fixed IP + Create a new reserved fixed IP with the specified configuration. Args: type: Must be 'external' @@ -533,7 +533,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create reserved fixed IP + Create a new reserved fixed IP with the specified configuration. Args: subnet_id: Reserved fixed IP will be allocated in this subnet @@ -570,7 +570,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create reserved fixed IP + Create a new reserved fixed IP with the specified configuration. Args: network_id: Reserved fixed IP will be allocated in a subnet of this network @@ -609,7 +609,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create reserved fixed IP + Create a new reserved fixed IP with the specified configuration. Args: ip_address: Reserved fixed IP will be allocated the given IP address @@ -646,7 +646,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create reserved fixed IP + Create a new reserved fixed IP with the specified configuration. Args: port_id: Port ID to make a reserved fixed IP (for example, `vip_port_id` of the Load @@ -736,7 +736,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[ReservedFixedIP, AsyncOffsetPage[ReservedFixedIP]]: """ - List reserved fixed IPs + List all reserved fixed IPs in the specified project and region. Args: available_only: Set to true if the response should only list IP addresses that are not attached @@ -755,8 +755,8 @@ def list( offset: Offset value is used to exclude the first set of records from the result order_by: Ordering reserved fixed IP list result by name, status, `updated_at`, - `created_at` or `fixed_ip_address` fields of the reserved fixed IP and - directions (status.asc), default is "`fixed_ip_address`.asc" + `created_at` or `fixed_ip_address` fields and directions (status.asc), default + is "`fixed_ip_address`.asc" vip_only: Set to true if the response should only list VIPs @@ -812,7 +812,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Delete reserved fixed ip + Delete a specific reserved fixed IP and all its associated resources. Args: extra_headers: Send extra headers @@ -851,7 +851,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ReservedFixedIP: """ - Get reserved fixed IP + Get detailed information about a specific reserved fixed IP. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 5bfbd5c9..6d3c91f3 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -63,7 +63,7 @@ def list_candidate_ports( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> CandidatePortList: """ - List instance ports that are available for connecting to VIP + List all instance ports that are available for connecting to a VIP. Args: extra_headers: Send extra headers @@ -102,7 +102,7 @@ def list_connected_ports( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ConnectedPortList: """ - List instance ports that share VIP + List all instance ports that share a VIP. Args: extra_headers: Send extra headers @@ -142,7 +142,7 @@ def replace_connected_ports( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ConnectedPortList: """ - Replace ports that share VIP + Replace the list of instance ports that share a VIP. Args: port_ids: List of port IDs that will share one VIP @@ -187,7 +187,7 @@ def toggle( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ReservedFixedIP: """ - Switch VIP status of reserved fixed IP + Update the VIP status of a reserved fixed IP. Args: is_vip: If reserved fixed IP should be a VIP @@ -230,7 +230,7 @@ def update_connected_ports( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ConnectedPortList: """ - Add ports that share VIP + Add instance ports to share a VIP. Args: port_ids: List of port IDs that will share one VIP @@ -295,7 +295,7 @@ async def list_candidate_ports( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> CandidatePortList: """ - List instance ports that are available for connecting to VIP + List all instance ports that are available for connecting to a VIP. Args: extra_headers: Send extra headers @@ -334,7 +334,7 @@ async def list_connected_ports( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ConnectedPortList: """ - List instance ports that share VIP + List all instance ports that share a VIP. Args: extra_headers: Send extra headers @@ -374,7 +374,7 @@ async def replace_connected_ports( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ConnectedPortList: """ - Replace ports that share VIP + Replace the list of instance ports that share a VIP. Args: port_ids: List of port IDs that will share one VIP @@ -419,7 +419,7 @@ async def toggle( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ReservedFixedIP: """ - Switch VIP status of reserved fixed IP + Update the VIP status of a reserved fixed IP. Args: is_vip: If reserved fixed IP should be a VIP @@ -462,7 +462,7 @@ async def update_connected_ports( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> ConnectedPortList: """ - Add ports that share VIP + Add instance ports to share a VIP. Args: port_ids: List of port IDs that will share one VIP diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index 105615d6..89b27a23 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -92,7 +92,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroupRule: """ - Add new rule to security group + Add a new rule to an existing security group. Args: description: Rule description @@ -160,7 +160,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete security group rule + Delete a specific rule from a security group. Args: extra_headers: Send extra headers @@ -235,7 +235,7 @@ def replace( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroupRule: """ - Edit the security group rule: delete old and create new rule + Update the configuration of an existing security group rule. Args: direction: Ingress or egress, which is the direction in which the security group rule is @@ -363,7 +363,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroupRule: """ - Add new rule to security group + Add a new rule to an existing security group. Args: description: Rule description @@ -431,7 +431,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete security group rule + Delete a specific rule from a security group. Args: extra_headers: Send extra headers @@ -506,7 +506,7 @@ async def replace( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroupRule: """ - Edit the security group rule: delete old and create new rule + Update the configuration of an existing security group rule. Args: direction: Ingress or egress, which is the direction in which the security group rule is diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index cddbd7a2..034bbe2b 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -77,7 +77,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroup: """ - Create security group + Create a new security group with the specified configuration. Args: security_group: Security group @@ -128,7 +128,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroup: """ - Update security group + Update the configuration of an existing security group. Args: changed_rules: List of rules to create or delete @@ -137,12 +137,15 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. - Unspecified tags remain unchanged. **Examples:** + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - **Mixed operations:** @@ -199,18 +202,16 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[SecurityGroup]: """ - Get security groups + List all security groups in the specified project and region. Args: - limit: Limit the number of returned limit request entities. + limit: Limit the number of returned security groups - offset: Offset value is used to exclude the first set of records from the result. + offset: Offset value is used to exclude the first set of records from the result tag_key: Filter by tag keys. - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G - --data-urlencode "`tag_key_value`={"key": "value"}" --url - "http://localhost:1111/v1/securitygroups/1/1" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. extra_headers: Send extra headers @@ -259,7 +260,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete security group + Delete a specific security group and all its associated rules. Args: extra_headers: Send extra headers @@ -298,9 +299,9 @@ def copy( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: + ) -> SecurityGroup: """ - Create a deep copy of security group + Create a deep copy of an existing security group. Args: name: Name. @@ -319,14 +320,13 @@ def copy( region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=NoneType, + cast_to=SecurityGroup, ) def get( @@ -343,7 +343,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroup: """ - Get security group + Get detailed information about a specific security group. Args: extra_headers: Send extra headers @@ -382,7 +382,7 @@ def revert_to_default( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroup: """ - Revert security group + Revert a security group to its previous state. Args: extra_headers: Send extra headers @@ -447,7 +447,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroup: """ - Create security group + Create a new security group with the specified configuration. Args: security_group: Security group @@ -498,7 +498,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroup: """ - Update security group + Update the configuration of an existing security group. Args: changed_rules: List of rules to create or delete @@ -507,12 +507,15 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. - Unspecified tags remain unchanged. **Examples:** + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - **Mixed operations:** @@ -569,18 +572,16 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[SecurityGroup, AsyncOffsetPage[SecurityGroup]]: """ - Get security groups + List all security groups in the specified project and region. Args: - limit: Limit the number of returned limit request entities. + limit: Limit the number of returned security groups - offset: Offset value is used to exclude the first set of records from the result. + offset: Offset value is used to exclude the first set of records from the result tag_key: Filter by tag keys. - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. curl -G - --data-urlencode "`tag_key_value`={"key": "value"}" --url - "http://localhost:1111/v1/securitygroups/1/1" + tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. extra_headers: Send extra headers @@ -629,7 +630,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Delete security group + Delete a specific security group and all its associated rules. Args: extra_headers: Send extra headers @@ -668,9 +669,9 @@ async def copy( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: + ) -> SecurityGroup: """ - Create a deep copy of security group + Create a deep copy of an existing security group. Args: name: Name. @@ -689,14 +690,13 @@ async def copy( region_id = self._client._get_cloud_region_id_path_param() if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=await async_maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=NoneType, + cast_to=SecurityGroup, ) async def get( @@ -713,7 +713,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroup: """ - Get security group + Get detailed information about a specific security group. Args: extra_headers: Send extra headers @@ -752,7 +752,7 @@ async def revert_to_default( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SecurityGroup: """ - Revert security group + Revert a security group to its previous state. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index ebbb391b..c8914e5e 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -195,7 +195,7 @@ def acknowledge_all( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Acknowledge all client tasks in project or region + Acknowledge all tasks Args: project_id: Project ID @@ -241,7 +241,7 @@ def acknowledge_one( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Task: """ - Acknowledge one task on project scope + Acknowledge one task Args: task_id: Task ID @@ -469,7 +469,7 @@ async def acknowledge_all( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Acknowledge all client tasks in project or region + Acknowledge all tasks Args: project_id: Project ID @@ -515,7 +515,7 @@ async def acknowledge_one( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Task: """ - Acknowledge one task on project scope + Acknowledge one task Args: task_id: Task ID diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 4bb855df..1b09de11 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -64,7 +64,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RoleAssignment: """ - Assign role to existing user + Assign a role to an existing user in the specified scope. Args: role: User role @@ -116,7 +116,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RoleAssignmentUpdateDelete: """ - Modify role assignment to existing user + Modify an existing role assignment for a user. Args: assignment_id: Assignment ID @@ -168,12 +168,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[RoleAssignment]: - """List assignments + """ + List all role assignments in the specified scope. Args: - limit: Limit the number of returned items. - - Falls back to default of 1000 if not + limit: Limit the number of returned items. Falls back to default of 1000 if not specified. Limited by max limit value of 1000 offset: Offset value is used to exclude the first set of records from the result @@ -223,7 +222,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RoleAssignmentUpdateDelete: """ - Delete role assignment + Delete an existing role assignment. Args: assignment_id: Assignment ID @@ -280,7 +279,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RoleAssignment: """ - Assign role to existing user + Assign a role to an existing user in the specified scope. Args: role: User role @@ -332,7 +331,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RoleAssignmentUpdateDelete: """ - Modify role assignment to existing user + Modify an existing role assignment for a user. Args: assignment_id: Assignment ID @@ -384,12 +383,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[RoleAssignment, AsyncOffsetPage[RoleAssignment]]: - """List assignments + """ + List all role assignments in the specified scope. Args: - limit: Limit the number of returned items. - - Falls back to default of 1000 if not + limit: Limit the number of returned items. Falls back to default of 1000 if not specified. Limited by max limit value of 1000 offset: Offset value is used to exclude the first set of records from the result @@ -439,7 +437,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> RoleAssignmentUpdateDelete: """ - Delete role assignment + Delete an existing role assignment. Args: assignment_id: Assignment ID diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index dc35bbba..7b86a7e9 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -79,8 +79,11 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Create volume + """Create a new volume in the project and region. + + The volume can be created from + scratch, from an image, or from a snapshot. Optionally attach the volume to an + instance during creation. Args: project_id: Project ID @@ -145,8 +148,11 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Create volume + """Create a new volume in the project and region. + + The volume can be created from + scratch, from an image, or from a snapshot. Optionally attach the volume to an + instance during creation. Args: project_id: Project ID @@ -211,8 +217,11 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Create volume + """Create a new volume in the project and region. + + The volume can be created from + scratch, from an image, or from a snapshot. Optionally attach the volume to an + instance during creation. Args: project_id: Project ID @@ -320,7 +329,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Volume: """ - Rename volume + Rename a volume. Args: project_id: Project ID @@ -376,8 +385,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[Volume]: - """ - List volumes + """Retrieve a list of volumes in the project and region. + + The list can be filtered + by various parameters like bootable status, metadata/tags, attachments, instance + ID, name, and ID. Args: project_id: Project ID @@ -404,9 +416,7 @@ def list( tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "`tag_key_value`={"key": "value"}" --url - "https://example.com/cloud/v1/resource/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. extra_headers: Send extra headers @@ -461,8 +471,10 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Delete volume + """Delete a volume and all its snapshots. + + The volume must be in an available state + to be deleted. Args: project_id: Project ID @@ -573,8 +585,10 @@ def change_type( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Volume: - """ - Change volume type + """Change the type of a volume. + + The volume must not have any snapshots to change + its type. Args: project_id: Project ID @@ -673,7 +687,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Volume: """ - Get volume + Retrieve detailed information about a specific volume. Args: project_id: Project ID @@ -718,8 +732,10 @@ def resize( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Extend volume + """Increase the size of a volume. + + The new size must be greater than the current + size. Args: project_id: Project ID @@ -766,8 +782,10 @@ def revert_to_last_snapshot( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: - """ - Revert volume to it's last snapshot + """Revert a volume to its last snapshot. + + The volume must be in an available state + to be reverted. Args: project_id: Project ID @@ -843,8 +861,11 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Create volume + """Create a new volume in the project and region. + + The volume can be created from + scratch, from an image, or from a snapshot. Optionally attach the volume to an + instance during creation. Args: project_id: Project ID @@ -909,8 +930,11 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Create volume + """Create a new volume in the project and region. + + The volume can be created from + scratch, from an image, or from a snapshot. Optionally attach the volume to an + instance during creation. Args: project_id: Project ID @@ -975,8 +999,11 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Create volume + """Create a new volume in the project and region. + + The volume can be created from + scratch, from an image, or from a snapshot. Optionally attach the volume to an + instance during creation. Args: project_id: Project ID @@ -1084,7 +1111,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Volume: """ - Rename volume + Rename a volume. Args: project_id: Project ID @@ -1140,8 +1167,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Volume, AsyncOffsetPage[Volume]]: - """ - List volumes + """Retrieve a list of volumes in the project and region. + + The list can be filtered + by various parameters like bootable status, metadata/tags, attachments, instance + ID, name, and ID. Args: project_id: Project ID @@ -1168,9 +1198,7 @@ def list( tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode - "`tag_key_value`={"key": "value"}" --url - "https://example.com/cloud/v1/resource/1/1" + tag_key_value: Optional. Filter by tag key-value pairs. extra_headers: Send extra headers @@ -1225,8 +1253,10 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Delete volume + """Delete a volume and all its snapshots. + + The volume must be in an available state + to be deleted. Args: project_id: Project ID @@ -1337,8 +1367,10 @@ async def change_type( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Volume: - """ - Change volume type + """Change the type of a volume. + + The volume must not have any snapshots to change + its type. Args: project_id: Project ID @@ -1439,7 +1471,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Volume: """ - Get volume + Retrieve detailed information about a specific volume. Args: project_id: Project ID @@ -1484,8 +1516,10 @@ async def resize( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Extend volume + """Increase the size of a volume. + + The new size must be greater than the current + size. Args: project_id: Project ID @@ -1532,8 +1566,10 @@ async def revert_to_last_snapshot( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: - """ - Revert volume to it's last snapshot + """Revert a volume to its last snapshot. + + The volume must be in an available state + to be reverted. Args: project_id: Project ID diff --git a/src/gcore/types/cloud/baremetal/image_list_params.py b/src/gcore/types/cloud/baremetal/image_list_params.py index 07949b72..075fe52e 100644 --- a/src/gcore/types/cloud/baremetal/image_list_params.py +++ b/src/gcore/types/cloud/baremetal/image_list_params.py @@ -23,11 +23,7 @@ class ImageListParams(TypedDict, total=False): """Filter by tag keys.""" tag_key_value: str - """Filter by tag key-value pairs. - - Must be a valid JSON string. 'curl -G --data-urlencode '`tag_key_value`={"key": - "value"}' --url 'http://localhost:1111/v1/images/1/1'" - """ + """Filter by tag key-value pairs. Must be a valid JSON string.""" visibility: Literal["private", "public", "shared"] """Image visibility. Globally visible images are public""" diff --git a/src/gcore/types/cloud/baremetal/server_list_params.py b/src/gcore/types/cloud/baremetal/server_list_params.py index e7a0b35b..1ddb1c48 100644 --- a/src/gcore/types/cloud/baremetal/server_list_params.py +++ b/src/gcore/types/cloud/baremetal/server_list_params.py @@ -85,11 +85,7 @@ class ServerListParams(TypedDict, total=False): """Filters instances by a server status, as a string.""" tag_key_value: str - """Optional. - - Filter by tag key-value pairs. curl -G --data-urlencode "`tag_key_value`={"key": - "value"}" --url "https://example.com/cloud/v1/resource/1/1" - """ + """Optional. Filter by tag key-value pairs.""" tag_value: List[str] """Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2""" diff --git a/src/gcore/types/cloud/floating_ip_list_params.py b/src/gcore/types/cloud/floating_ip_list_params.py index 6f0341d0..825b2de1 100644 --- a/src/gcore/types/cloud/floating_ip_list_params.py +++ b/src/gcore/types/cloud/floating_ip_list_params.py @@ -28,8 +28,4 @@ class FloatingIPListParams(TypedDict, total=False): """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str - """Optional. - - Filter by tag key-value pairs. curl -G --data-urlencode "`tag_key_value`={"key": - "value"}" --url "https://example.com/cloud/v1/resource/1/1" - """ + """Optional. Filter by tag key-value pairs.""" diff --git a/src/gcore/types/cloud/instance_list_params.py b/src/gcore/types/cloud/instance_list_params.py index dbbbb038..54ca4270 100644 --- a/src/gcore/types/cloud/instance_list_params.py +++ b/src/gcore/types/cloud/instance_list_params.py @@ -118,11 +118,7 @@ class InstanceListParams(TypedDict, total=False): """Filters instances by status.""" tag_key_value: str - """Optional. - - Filter by tag key-value pairs. curl -G --data-urlencode "`tag_key_value`={"key": - "value"}" --url "https://example.com/cloud/v1/resource/1/1" - """ + """Optional. Filter by tag key-value pairs.""" tag_value: List[str] """Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2""" diff --git a/src/gcore/types/cloud/instances/image_list_params.py b/src/gcore/types/cloud/instances/image_list_params.py index 07949b72..075fe52e 100644 --- a/src/gcore/types/cloud/instances/image_list_params.py +++ b/src/gcore/types/cloud/instances/image_list_params.py @@ -23,11 +23,7 @@ class ImageListParams(TypedDict, total=False): """Filter by tag keys.""" tag_key_value: str - """Filter by tag key-value pairs. - - Must be a valid JSON string. 'curl -G --data-urlencode '`tag_key_value`={"key": - "value"}' --url 'http://localhost:1111/v1/images/1/1'" - """ + """Filter by tag key-value pairs. Must be a valid JSON string.""" visibility: Literal["private", "public", "shared"] """Image visibility. Globally visible images are public""" diff --git a/src/gcore/types/cloud/load_balancer_list_params.py b/src/gcore/types/cloud/load_balancer_list_params.py index eecfdab7..704c2eb3 100644 --- a/src/gcore/types/cloud/load_balancer_list_params.py +++ b/src/gcore/types/cloud/load_balancer_list_params.py @@ -43,11 +43,7 @@ class LoadBalancerListParams(TypedDict, total=False): """Filter by tag keys.""" tag_key_value: str - """Filter by tag key-value pairs. - - Must be a valid JSON string. curl -G --data-urlencode "`tag_key_value`={"key": - "value"}" --url "http://localhost:1111/v1/loadbalancers/1/1" - """ + """Filter by tag key-value pairs. Must be a valid JSON string.""" with_ddos: bool """Show Advanced DDoS protection profile, if exists""" diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py index 4747c719..f4b01786 100644 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -33,12 +33,15 @@ class LoadBalancerUpdateParams(TypedDict, total=False): """Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to - remove tags. Unspecified tags remain unchanged. **Examples:** + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - **Mixed operations:** diff --git a/src/gcore/types/cloud/network_list_params.py b/src/gcore/types/cloud/network_list_params.py index 2aaa17b2..fd80aecd 100644 --- a/src/gcore/types/cloud/network_list_params.py +++ b/src/gcore/types/cloud/network_list_params.py @@ -37,8 +37,4 @@ class NetworkListParams(TypedDict, total=False): """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str - """Optional. - - Filter by tag key-value pairs. curl -G --data-urlencode "`tag_key_value`={"key": - "value"}" --url "https://example.com/cloud/v1/resource/1/1" - """ + """Optional. Filter by tag key-value pairs.""" diff --git a/src/gcore/types/cloud/network_update_params.py b/src/gcore/types/cloud/network_update_params.py index 828b283c..8aa509d3 100644 --- a/src/gcore/types/cloud/network_update_params.py +++ b/src/gcore/types/cloud/network_update_params.py @@ -24,12 +24,15 @@ class NetworkUpdateParams(TypedDict, total=False): """Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to - remove tags. Unspecified tags remain unchanged. **Examples:** + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - **Mixed operations:** diff --git a/src/gcore/types/cloud/networks/router_list_params.py b/src/gcore/types/cloud/networks/router_list_params.py index 5ff04e35..4842c311 100644 --- a/src/gcore/types/cloud/networks/router_list_params.py +++ b/src/gcore/types/cloud/networks/router_list_params.py @@ -13,7 +13,7 @@ class RouterListParams(TypedDict, total=False): region_id: int limit: int - """Limit the number of returned limit request entities.""" + """Limit the number of returned routers""" offset: int - """Offset value is used to exclude the first set of records from the result.""" + """Offset value is used to exclude the first set of records from the result""" diff --git a/src/gcore/types/cloud/networks/subnet_list_params.py b/src/gcore/types/cloud/networks/subnet_list_params.py index 8865e006..ecae30b7 100644 --- a/src/gcore/types/cloud/networks/subnet_list_params.py +++ b/src/gcore/types/cloud/networks/subnet_list_params.py @@ -51,8 +51,4 @@ class SubnetListParams(TypedDict, total=False): """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str - """Optional. - - Filter by tag key-value pairs. curl -G --data-urlencode "`tag_key_value`={"key": - "value"}" --url "https://example.com/cloud/v1/resource/1/1" - """ + """Optional. Filter by tag key-value pairs.""" diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index 2ade80c6..966b3ccf 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -41,12 +41,15 @@ class SubnetUpdateParams(TypedDict, total=False): """Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to - remove tags. Unspecified tags remain unchanged. **Examples:** + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - **Mixed operations:** diff --git a/src/gcore/types/cloud/registries/__init__.py b/src/gcore/types/cloud/registries/__init__.py index 9b7535c7..a4e5934f 100644 --- a/src/gcore/types/cloud/registries/__init__.py +++ b/src/gcore/types/cloud/registries/__init__.py @@ -12,3 +12,4 @@ 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 +from .user_refresh_secret_response import UserRefreshSecretResponse as UserRefreshSecretResponse diff --git a/src/gcore/types/cloud/registries/user_refresh_secret_response.py b/src/gcore/types/cloud/registries/user_refresh_secret_response.py new file mode 100644 index 00000000..17fb1144 --- /dev/null +++ b/src/gcore/types/cloud/registries/user_refresh_secret_response.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["UserRefreshSecretResponse"] + + +class UserRefreshSecretResponse(BaseModel): + id: int + """User ID""" + + created_at: datetime + """User creation date-time""" + + duration: int + """User account operating time, days""" + + expires_at: datetime + """User operation end date-time""" + + name: str + """User name""" + + read_only: Optional[bool] = None + """Read-only user""" + + secret: Optional[str] = None + """User secret""" diff --git a/src/gcore/types/cloud/reserved_fixed_ip_list_params.py b/src/gcore/types/cloud/reserved_fixed_ip_list_params.py index df83a8eb..655ef02a 100644 --- a/src/gcore/types/cloud/reserved_fixed_ip_list_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ip_list_params.py @@ -39,8 +39,8 @@ class ReservedFixedIPListParams(TypedDict, total=False): order_by: str """ Ordering reserved fixed IP list result by name, status, `updated_at`, - `created_at` or `fixed_ip_address` fields of the reserved fixed IP and - directions (status.asc), default is "`fixed_ip_address`.asc" + `created_at` or `fixed_ip_address` fields and directions (status.asc), default + is "`fixed_ip_address`.asc" """ vip_only: bool diff --git a/src/gcore/types/cloud/security_group_list_params.py b/src/gcore/types/cloud/security_group_list_params.py index a6a7500e..8ba036cc 100644 --- a/src/gcore/types/cloud/security_group_list_params.py +++ b/src/gcore/types/cloud/security_group_list_params.py @@ -14,17 +14,13 @@ class SecurityGroupListParams(TypedDict, total=False): region_id: int limit: int - """Limit the number of returned limit request entities.""" + """Limit the number of returned security groups""" offset: int - """Offset value is used to exclude the first set of records from the result.""" + """Offset value is used to exclude the first set of records from the result""" tag_key: List[str] """Filter by tag keys.""" tag_key_value: str - """Filter by tag key-value pairs. - - Must be a valid JSON string. curl -G --data-urlencode "`tag_key_value`={"key": - "value"}" --url "http://localhost:1111/v1/securitygroups/1/1" - """ + """Filter by tag key-value pairs. Must be a valid JSON string.""" diff --git a/src/gcore/types/cloud/security_group_update_params.py b/src/gcore/types/cloud/security_group_update_params.py index f94acd2b..a63fad11 100644 --- a/src/gcore/types/cloud/security_group_update_params.py +++ b/src/gcore/types/cloud/security_group_update_params.py @@ -25,12 +25,15 @@ class SecurityGroupUpdateParams(TypedDict, total=False): """Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to - remove tags. Unspecified tags remain unchanged. **Examples:** + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - **Mixed operations:** diff --git a/src/gcore/types/cloud/volume_list_params.py b/src/gcore/types/cloud/volume_list_params.py index 20730cc7..18573ee7 100644 --- a/src/gcore/types/cloud/volume_list_params.py +++ b/src/gcore/types/cloud/volume_list_params.py @@ -49,8 +49,4 @@ class VolumeListParams(TypedDict, total=False): """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str - """Optional. - - Filter by tag key-value pairs. curl -G --data-urlencode "`tag_key_value`={"key": - "value"}" --url "https://example.com/cloud/v1/resource/1/1" - """ + """Optional. Filter by tag key-value pairs.""" diff --git a/tests/api_resources/cloud/registries/test_users.py b/tests/api_resources/cloud/registries/test_users.py index 30ea6d26..e0d56803 100644 --- a/tests/api_resources/cloud/registries/test_users.py +++ b/tests/api_resources/cloud/registries/test_users.py @@ -13,6 +13,7 @@ RegistryUser, RegistryUserList, RegistryUserCreated, + UserRefreshSecretResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +31,7 @@ def test_method_create(self, client: Gcore) -> None: duration=14, name="user1", ) - assert_matches_type(RegistryUser, user, path=["response"]) + assert_matches_type(RegistryUserCreated, user, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -43,7 +44,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: read_only=False, secret="secret", ) - assert_matches_type(RegistryUser, user, path=["response"]) + assert_matches_type(RegistryUserCreated, user, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -58,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(RegistryUser, user, path=["response"]) + assert_matches_type(RegistryUserCreated, user, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -73,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(RegistryUser, user, path=["response"]) + assert_matches_type(RegistryUserCreated, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -272,7 +273,7 @@ def test_method_refresh_secret(self, client: Gcore) -> None: region_id=0, registry_id=0, ) - assert user is None + assert_matches_type(UserRefreshSecretResponse, user, path=["response"]) @parametrize def test_raw_response_refresh_secret(self, client: Gcore) -> None: @@ -286,7 +287,7 @@ def test_raw_response_refresh_secret(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert user is None + assert_matches_type(UserRefreshSecretResponse, user, path=["response"]) @parametrize def test_streaming_response_refresh_secret(self, client: Gcore) -> None: @@ -300,7 +301,7 @@ def test_streaming_response_refresh_secret(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert user is None + assert_matches_type(UserRefreshSecretResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -317,7 +318,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: duration=14, name="user1", ) - assert_matches_type(RegistryUser, user, path=["response"]) + assert_matches_type(RegistryUserCreated, user, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -330,7 +331,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> read_only=False, secret="secret", ) - assert_matches_type(RegistryUser, user, path=["response"]) + assert_matches_type(RegistryUserCreated, user, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -345,7 +346,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(RegistryUser, user, path=["response"]) + assert_matches_type(RegistryUserCreated, user, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -360,7 +361,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(RegistryUser, user, path=["response"]) + assert_matches_type(RegistryUserCreated, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -559,7 +560,7 @@ async def test_method_refresh_secret(self, async_client: AsyncGcore) -> None: region_id=0, registry_id=0, ) - assert user is None + assert_matches_type(UserRefreshSecretResponse, user, path=["response"]) @parametrize async def test_raw_response_refresh_secret(self, async_client: AsyncGcore) -> None: @@ -573,7 +574,7 @@ async def test_raw_response_refresh_secret(self, async_client: AsyncGcore) -> No assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert user is None + assert_matches_type(UserRefreshSecretResponse, user, path=["response"]) @parametrize async def test_streaming_response_refresh_secret(self, async_client: AsyncGcore) -> None: @@ -587,6 +588,6 @@ async def test_streaming_response_refresh_secret(self, async_client: AsyncGcore) assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert user is None + assert_matches_type(UserRefreshSecretResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index d8b88654..5190081d 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -254,7 +254,7 @@ def test_method_copy(self, client: Gcore) -> None: region_id=0, name="some_name", ) - assert security_group is None + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_raw_response_copy(self, client: Gcore) -> None: @@ -268,7 +268,7 @@ def test_raw_response_copy(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_group = response.parse() - assert security_group is None + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_streaming_response_copy(self, client: Gcore) -> None: @@ -282,7 +282,7 @@ def test_streaming_response_copy(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_group = response.parse() - assert security_group is None + assert_matches_type(SecurityGroup, security_group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -626,7 +626,7 @@ async def test_method_copy(self, async_client: AsyncGcore) -> None: region_id=0, name="some_name", ) - assert security_group is None + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_raw_response_copy(self, async_client: AsyncGcore) -> None: @@ -640,7 +640,7 @@ async def test_raw_response_copy(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_group = await response.parse() - assert security_group is None + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_streaming_response_copy(self, async_client: AsyncGcore) -> None: @@ -654,7 +654,7 @@ async def test_streaming_response_copy(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_group = await response.parse() - assert security_group is None + assert_matches_type(SecurityGroup, security_group, path=["response"]) assert cast(Any, response.is_closed) is True From 9c0f47105b890f68ccf8e77633f65332d9d3db58 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Jun 2025 16:24:57 +0000 Subject: [PATCH 171/592] feat(api): aggregated API specs update --- .stats.yml | 4 +-- src/gcore/resources/cloud/ip_ranges.py | 36 ++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index 11475e47..0bae0f63 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6335dff48838208c2b58720ea26dda6b46ee4e8f0cbed4a3e7839e2a85c53de4.yml -openapi_spec_hash: d9954e09f207068566e8b8f3052ac498 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8e761e093cec076307af9cd395249c974076de7c2bb8a672f919bfc2f0264fdb.yml +openapi_spec_hash: 5be7d0cc67dba31a269661f2b620b1f5 config_hash: 851d2f0c1f925aee3b53478d4fe311ba diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index 739e19cf..12024d04 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -49,7 +49,23 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> IPRanges: - """List of all Edge Cloud Egress Public IPs.""" + """ + Returns the complete list of IPv4 and IPv6 address ranges that Cloud uses for + outbound (egress) traffic. Typical reasons to call this endpoint: + + - Host-file delivery workflows – You upload images or other assets to the Cloud + and share a download link that points to your own infrastructure. Add these + egress prefixes to your firewall or object-storage allow-list so our clients + can fetch the files without being blocked. + - Push integrations / webhooks – You subscribe to the user-actions event log and + Cloud pushes events to your listener endpoint. Whitelisting the egress IP + ranges lets you accept only traffic that originates from us. + - General security controls, audit tooling, or SIEM rules that need to verify + that traffic truly comes from the Cloud. The list is global (covers all + regions) and refreshed automatically whenever Gcore allocates new egress IP + space. The response is an array of CIDR blocks; duplicate prefixes are not + returned. + """ return self._get( "/cloud/public/v1/ipranges/egress", options=make_request_options( @@ -89,7 +105,23 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> IPRanges: - """List of all Edge Cloud Egress Public IPs.""" + """ + Returns the complete list of IPv4 and IPv6 address ranges that Cloud uses for + outbound (egress) traffic. Typical reasons to call this endpoint: + + - Host-file delivery workflows – You upload images or other assets to the Cloud + and share a download link that points to your own infrastructure. Add these + egress prefixes to your firewall or object-storage allow-list so our clients + can fetch the files without being blocked. + - Push integrations / webhooks – You subscribe to the user-actions event log and + Cloud pushes events to your listener endpoint. Whitelisting the egress IP + ranges lets you accept only traffic that originates from us. + - General security controls, audit tooling, or SIEM rules that need to verify + that traffic truly comes from the Cloud. The list is global (covers all + regions) and refreshed automatically whenever Gcore allocates new egress IP + space. The response is an array of CIDR blocks; duplicate prefixes are not + returned. + """ return await self._get( "/cloud/public/v1/ipranges/egress", options=make_request_options( From e04b731aa58bffdaefb6d4690efad39969d3d100 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Jun 2025 23:00:07 +0000 Subject: [PATCH 172/592] feat(client): add support for aiohttp --- README.md | 34 +++++++++++++++ pyproject.toml | 2 + requirements-dev.lock | 27 ++++++++++++ requirements.lock | 27 ++++++++++++ src/gcore/__init__.py | 3 +- src/gcore/_base_client.py | 22 ++++++++++ .../cloud/baremetal/test_flavors.py | 4 +- .../cloud/baremetal/test_images.py | 4 +- .../cloud/baremetal/test_servers.py | 4 +- .../cloud/file_shares/test_access_rules.py | 4 +- .../gpu_baremetal_clusters/test_flavors.py | 4 +- .../gpu_baremetal_clusters/test_images.py | 4 +- .../gpu_baremetal_clusters/test_interfaces.py | 4 +- .../gpu_baremetal_clusters/test_servers.py | 4 +- .../cloud/inference/deployments/test_logs.py | 4 +- .../cloud/inference/test_deployments.py | 4 +- .../cloud/inference/test_flavors.py | 4 +- .../cloud/inference/test_models.py | 4 +- .../inference/test_registry_credentials.py | 4 +- .../cloud/inference/test_secrets.py | 4 +- .../cloud/instances/test_flavors.py | 4 +- .../cloud/instances/test_images.py | 4 +- .../cloud/instances/test_interfaces.py | 4 +- .../cloud/instances/test_metrics.py | 4 +- .../load_balancers/l7_policies/test_rules.py | 4 +- .../pools/test_health_monitors.py | 4 +- .../load_balancers/pools/test_members.py | 4 +- .../cloud/load_balancers/test_flavors.py | 4 +- .../cloud/load_balancers/test_l7_policies.py | 4 +- .../cloud/load_balancers/test_listeners.py | 4 +- .../cloud/load_balancers/test_metrics.py | 4 +- .../cloud/load_balancers/test_pools.py | 4 +- .../cloud/load_balancers/test_statuses.py | 4 +- .../cloud/networks/test_routers.py | 4 +- .../cloud/networks/test_subnets.py | 4 +- .../cloud/quotas/test_requests.py | 4 +- .../cloud/registries/test_artifacts.py | 4 +- .../cloud/registries/test_repositories.py | 4 +- .../cloud/registries/test_tags.py | 4 +- .../cloud/registries/test_users.py | 4 +- .../cloud/reserved_fixed_ips/test_vip.py | 4 +- .../cloud/security_groups/test_rules.py | 4 +- .../cloud/test_billing_reservations.py | 4 +- tests/api_resources/cloud/test_file_shares.py | 4 +- .../api_resources/cloud/test_floating_ips.py | 4 +- .../cloud/test_gpu_baremetal_clusters.py | 4 +- tests/api_resources/cloud/test_inference.py | 4 +- tests/api_resources/cloud/test_instances.py | 4 +- tests/api_resources/cloud/test_ip_ranges.py | 4 +- .../cloud/test_load_balancers.py | 4 +- tests/api_resources/cloud/test_networks.py | 4 +- .../cloud/test_placement_groups.py | 4 +- tests/api_resources/cloud/test_projects.py | 4 +- tests/api_resources/cloud/test_quotas.py | 4 +- tests/api_resources/cloud/test_regions.py | 4 +- tests/api_resources/cloud/test_registries.py | 4 +- .../cloud/test_reserved_fixed_ips.py | 4 +- tests/api_resources/cloud/test_secrets.py | 4 +- .../cloud/test_security_groups.py | 4 +- tests/api_resources/cloud/test_ssh_keys.py | 4 +- tests/api_resources/cloud/test_tasks.py | 4 +- tests/api_resources/cloud/test_volumes.py | 4 +- .../cloud/users/test_role_assignments.py | 4 +- tests/api_resources/test_waap.py | 4 +- .../waap/domains/analytics/test_requests.py | 4 +- .../api_discovery/test_scan_results.py | 4 +- .../waap/domains/test_advanced_rules.py | 4 +- .../waap/domains/test_analytics.py | 4 +- .../waap/domains/test_api_discovery.py | 4 +- .../waap/domains/test_api_path_groups.py | 4 +- .../waap/domains/test_api_paths.py | 4 +- .../waap/domains/test_custom_rules.py | 4 +- .../waap/domains/test_firewall_rules.py | 4 +- .../waap/domains/test_insight_silences.py | 4 +- .../waap/domains/test_insights.py | 4 +- .../waap/domains/test_policies.py | 4 +- .../waap/domains/test_settings.py | 4 +- .../api_resources/waap/test_advanced_rules.py | 4 +- .../waap/test_custom_page_sets.py | 4 +- tests/api_resources/waap/test_domains.py | 4 +- tests/api_resources/waap/test_ip_info.py | 4 +- .../api_resources/waap/test_organizations.py | 4 +- tests/api_resources/waap/test_statistics.py | 4 +- tests/api_resources/waap/test_tags.py | 4 +- tests/conftest.py | 43 ++++++++++++++++--- 85 files changed, 385 insertions(+), 85 deletions(-) diff --git a/README.md b/README.md index 9a36a999..8fff56e2 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,40 @@ asyncio.run(main()) Functionality between the synchronous and asynchronous clients is otherwise identical. +### With aiohttp + +By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend. + +You can enable this by installing `aiohttp`: + +```sh +# install from PyPI +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 + + +async def main() -> None: + async with AsyncGcore( + 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( + name="New Project", + ) + print(project.id) + + +asyncio.run(main()) +``` + ## Using types Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like: diff --git a/pyproject.toml b/pyproject.toml index d53aee82..b802b19a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,8 @@ classifiers = [ Homepage = "https://github.com/G-Core/gcore-python" Repository = "https://github.com/G-Core/gcore-python" +[project.optional-dependencies] +aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"] [tool.rye] managed = true diff --git a/requirements-dev.lock b/requirements-dev.lock index 1db72836..69ce07e9 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -10,6 +10,13 @@ # universal: false -e file:. +aiohappyeyeballs==2.6.1 + # via aiohttp +aiohttp==3.12.8 + # via gcore + # via httpx-aiohttp +aiosignal==1.3.2 + # via aiohttp annotated-types==0.6.0 # via pydantic anyio==4.4.0 @@ -17,6 +24,10 @@ anyio==4.4.0 # via httpx argcomplete==3.1.2 # via nox +async-timeout==5.0.1 + # via aiohttp +attrs==25.3.0 + # via aiohttp certifi==2023.7.22 # via httpcore # via httpx @@ -34,16 +45,23 @@ execnet==2.1.1 # via pytest-xdist filelock==3.12.4 # via virtualenv +frozenlist==1.6.2 + # via aiohttp + # via aiosignal h11==0.14.0 # via httpcore httpcore==1.0.2 # via httpx httpx==0.28.1 # via gcore + # via httpx-aiohttp # via respx +httpx-aiohttp==0.1.6 + # via gcore idna==3.4 # via anyio # via httpx + # via yarl importlib-metadata==7.0.0 iniconfig==2.0.0 # via pytest @@ -51,6 +69,9 @@ markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py +multidict==6.4.4 + # via aiohttp + # via yarl mypy==1.14.1 mypy-extensions==1.0.0 # via mypy @@ -65,6 +86,9 @@ platformdirs==3.11.0 # via virtualenv pluggy==1.5.0 # via pytest +propcache==0.3.1 + # via aiohttp + # via yarl pydantic==2.10.3 # via gcore pydantic-core==2.27.1 @@ -98,11 +122,14 @@ tomli==2.0.2 typing-extensions==4.12.2 # via anyio # via gcore + # via multidict # via mypy # via pydantic # via pydantic-core # via pyright virtualenv==20.24.5 # via nox +yarl==1.20.0 + # via aiohttp zipp==3.17.0 # via importlib-metadata diff --git a/requirements.lock b/requirements.lock index 97422010..b755417d 100644 --- a/requirements.lock +++ b/requirements.lock @@ -10,11 +10,22 @@ # universal: false -e file:. +aiohappyeyeballs==2.6.1 + # via aiohttp +aiohttp==3.12.8 + # via gcore + # via httpx-aiohttp +aiosignal==1.3.2 + # via aiohttp annotated-types==0.6.0 # via pydantic anyio==4.4.0 # via gcore # via httpx +async-timeout==5.0.1 + # via aiohttp +attrs==25.3.0 + # via aiohttp certifi==2023.7.22 # via httpcore # via httpx @@ -22,15 +33,28 @@ distro==1.8.0 # via gcore exceptiongroup==1.2.2 # via anyio +frozenlist==1.6.2 + # via aiohttp + # via aiosignal h11==0.14.0 # via httpcore httpcore==1.0.2 # via httpx httpx==0.28.1 # via gcore + # via httpx-aiohttp +httpx-aiohttp==0.1.6 + # via gcore idna==3.4 # via anyio # via httpx + # via yarl +multidict==6.4.4 + # via aiohttp + # via yarl +propcache==0.3.1 + # via aiohttp + # via yarl pydantic==2.10.3 # via gcore pydantic-core==2.27.1 @@ -41,5 +65,8 @@ sniffio==1.3.0 typing-extensions==4.12.2 # via anyio # via gcore + # via multidict # via pydantic # via pydantic-core +yarl==1.20.0 + # via aiohttp diff --git a/src/gcore/__init__.py b/src/gcore/__init__.py index a3a9f6eb..83786fb8 100644 --- a/src/gcore/__init__.py +++ b/src/gcore/__init__.py @@ -26,7 +26,7 @@ UnprocessableEntityError, APIResponseValidationError, ) -from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient +from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient from ._utils._logs import setup_logging as _setup_logging __all__ = [ @@ -68,6 +68,7 @@ "DEFAULT_CONNECTION_LIMITS", "DefaultHttpxClient", "DefaultAsyncHttpxClient", + "DefaultAioHttpClient", ] if not _t.TYPE_CHECKING: diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index 41e09d0e..d531e5f0 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -1289,6 +1289,24 @@ def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) +try: + import httpx_aiohttp +except ImportError: + + class _DefaultAioHttpClient(httpx.AsyncClient): + def __init__(self, **_kwargs: Any) -> None: + raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra") +else: + + class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore + def __init__(self, **kwargs: Any) -> None: + kwargs.setdefault("timeout", DEFAULT_TIMEOUT) + kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) + kwargs.setdefault("follow_redirects", True) + + super().__init__(**kwargs) + + if TYPE_CHECKING: DefaultAsyncHttpxClient = httpx.AsyncClient """An alias to `httpx.AsyncClient` that provides the same defaults that this SDK @@ -1297,8 +1315,12 @@ def __init__(self, **kwargs: Any) -> None: This is useful because overriding the `http_client` with your own instance of `httpx.AsyncClient` will result in httpx's defaults being used, not ours. """ + + DefaultAioHttpClient = httpx.AsyncClient + """An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`.""" else: DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient + DefaultAioHttpClient = _DefaultAioHttpClient class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient): diff --git a/tests/api_resources/cloud/baremetal/test_flavors.py b/tests/api_resources/cloud/baremetal/test_flavors.py index 322c22e2..1778e4f4 100644 --- a/tests/api_resources/cloud/baremetal/test_flavors.py +++ b/tests/api_resources/cloud/baremetal/test_flavors.py @@ -112,7 +112,9 @@ def test_streaming_response_list_suitable(self, client: Gcore) -> None: class TestAsyncFlavors: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/baremetal/test_images.py b/tests/api_resources/cloud/baremetal/test_images.py index bff7624d..235f970b 100644 --- a/tests/api_resources/cloud/baremetal/test_images.py +++ b/tests/api_resources/cloud/baremetal/test_images.py @@ -66,7 +66,9 @@ def test_streaming_response_list(self, client: Gcore) -> None: class TestAsyncImages: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index 72ff981b..db10a5ea 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -220,7 +220,9 @@ def test_path_params_rebuild(self, client: Gcore) -> None: class TestAsyncServers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/file_shares/test_access_rules.py b/tests/api_resources/cloud/file_shares/test_access_rules.py index 59ad1e15..e85ffcd5 100644 --- a/tests/api_resources/cloud/file_shares/test_access_rules.py +++ b/tests/api_resources/cloud/file_shares/test_access_rules.py @@ -177,7 +177,9 @@ def test_path_params_delete(self, client: Gcore) -> None: class TestAsyncAccessRules: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py index 05585a1a..6b7e5324 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py @@ -63,7 +63,9 @@ def test_streaming_response_list(self, client: Gcore) -> None: class TestAsyncFlavors: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py index c2b357cb..e9f6c63f 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py @@ -203,7 +203,9 @@ def test_streaming_response_upload(self, client: Gcore) -> None: class TestAsyncImages: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py index bc0fc507..ec77e011 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py @@ -65,7 +65,9 @@ def test_path_params_list(self, client: Gcore) -> None: class TestAsyncInterfaces: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py index 2063267b..993a16f9 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py @@ -593,7 +593,9 @@ def test_path_params_reboot(self, client: Gcore) -> None: class TestAsyncServers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/cloud/inference/deployments/test_logs.py b/tests/api_resources/cloud/inference/deployments/test_logs.py index b23ecfa9..19fdaf11 100644 --- a/tests/api_resources/cloud/inference/deployments/test_logs.py +++ b/tests/api_resources/cloud/inference/deployments/test_logs.py @@ -74,7 +74,9 @@ def test_path_params_list(self, client: Gcore) -> None: class TestAsyncLogs: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/inference/test_deployments.py b/tests/api_resources/cloud/inference/test_deployments.py index bbce91ba..d7b21e45 100644 --- a/tests/api_resources/cloud/inference/test_deployments.py +++ b/tests/api_resources/cloud/inference/test_deployments.py @@ -620,7 +620,9 @@ def test_path_params_stop(self, client: Gcore) -> None: class TestAsyncDeployments: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/inference/test_flavors.py b/tests/api_resources/cloud/inference/test_flavors.py index cc6433e5..2de7d73e 100644 --- a/tests/api_resources/cloud/inference/test_flavors.py +++ b/tests/api_resources/cloud/inference/test_flavors.py @@ -91,7 +91,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncFlavors: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/inference/test_models.py b/tests/api_resources/cloud/inference/test_models.py index 23048376..d0f08a50 100644 --- a/tests/api_resources/cloud/inference/test_models.py +++ b/tests/api_resources/cloud/inference/test_models.py @@ -92,7 +92,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncModels: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/inference/test_registry_credentials.py b/tests/api_resources/cloud/inference/test_registry_credentials.py index 76ddb01f..e7f4b0d5 100644 --- a/tests/api_resources/cloud/inference/test_registry_credentials.py +++ b/tests/api_resources/cloud/inference/test_registry_credentials.py @@ -244,7 +244,9 @@ def test_path_params_replace(self, client: Gcore) -> None: class TestAsyncRegistryCredentials: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/inference/test_secrets.py b/tests/api_resources/cloud/inference/test_secrets.py index 1dcff8b1..62ad7207 100644 --- a/tests/api_resources/cloud/inference/test_secrets.py +++ b/tests/api_resources/cloud/inference/test_secrets.py @@ -255,7 +255,9 @@ def test_path_params_replace(self, client: Gcore) -> None: class TestAsyncSecrets: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/instances/test_flavors.py b/tests/api_resources/cloud/instances/test_flavors.py index d9766976..8efdf80d 100644 --- a/tests/api_resources/cloud/instances/test_flavors.py +++ b/tests/api_resources/cloud/instances/test_flavors.py @@ -182,7 +182,9 @@ def test_streaming_response_list_suitable(self, client: Gcore) -> None: class TestAsyncFlavors: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/instances/test_images.py b/tests/api_resources/cloud/instances/test_images.py index 80a58a38..c30fde90 100644 --- a/tests/api_resources/cloud/instances/test_images.py +++ b/tests/api_resources/cloud/instances/test_images.py @@ -348,7 +348,9 @@ def test_streaming_response_upload(self, client: Gcore) -> None: class TestAsyncImages: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/cloud/instances/test_interfaces.py b/tests/api_resources/cloud/instances/test_interfaces.py index a3b34d4c..348e946d 100644 --- a/tests/api_resources/cloud/instances/test_interfaces.py +++ b/tests/api_resources/cloud/instances/test_interfaces.py @@ -432,7 +432,9 @@ def test_path_params_detach(self, client: Gcore) -> None: class TestAsyncInterfaces: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/instances/test_metrics.py b/tests/api_resources/cloud/instances/test_metrics.py index cf5ce302..afa61520 100644 --- a/tests/api_resources/cloud/instances/test_metrics.py +++ b/tests/api_resources/cloud/instances/test_metrics.py @@ -73,7 +73,9 @@ def test_path_params_list(self, client: Gcore) -> None: class TestAsyncMetrics: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: 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 794e32f1..3d55c8a0 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 @@ -328,7 +328,9 @@ def test_path_params_replace(self, client: Gcore) -> None: class TestAsyncRules: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py b/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py index d5df2874..0fecec7c 100644 --- a/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py +++ b/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py @@ -144,7 +144,9 @@ def test_path_params_delete(self, client: Gcore) -> None: class TestAsyncHealthMonitors: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: 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 3bace5b7..3b32b30c 100644 --- a/tests/api_resources/cloud/load_balancers/pools/test_members.py +++ b/tests/api_resources/cloud/load_balancers/pools/test_members.py @@ -148,7 +148,9 @@ def test_path_params_remove(self, client: Gcore) -> None: class TestAsyncMembers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_add(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/cloud/load_balancers/test_flavors.py b/tests/api_resources/cloud/load_balancers/test_flavors.py index 33869b8d..51b2776e 100644 --- a/tests/api_resources/cloud/load_balancers/test_flavors.py +++ b/tests/api_resources/cloud/load_balancers/test_flavors.py @@ -62,7 +62,9 @@ def test_streaming_response_list(self, client: Gcore) -> None: class TestAsyncFlavors: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: 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 cfeb59dc..769aa5f8 100644 --- a/tests/api_resources/cloud/load_balancers/test_l7_policies.py +++ b/tests/api_resources/cloud/load_balancers/test_l7_policies.py @@ -269,7 +269,9 @@ def test_path_params_replace(self, client: Gcore) -> None: class TestAsyncL7Policies: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index e1ccbeeb..ac026380 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -306,7 +306,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncListeners: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/load_balancers/test_metrics.py b/tests/api_resources/cloud/load_balancers/test_metrics.py index 50b10030..39bdefed 100644 --- a/tests/api_resources/cloud/load_balancers/test_metrics.py +++ b/tests/api_resources/cloud/load_balancers/test_metrics.py @@ -73,7 +73,9 @@ def test_path_params_list(self, client: Gcore) -> None: class TestAsyncMetrics: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py index b53c75c2..004e5dd3 100644 --- a/tests/api_resources/cloud/load_balancers/test_pools.py +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -348,7 +348,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncPools: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/load_balancers/test_statuses.py b/tests/api_resources/cloud/load_balancers/test_statuses.py index 413375f0..cf38797d 100644 --- a/tests/api_resources/cloud/load_balancers/test_statuses.py +++ b/tests/api_resources/cloud/load_balancers/test_statuses.py @@ -99,7 +99,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncStatuses: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/networks/test_routers.py b/tests/api_resources/cloud/networks/test_routers.py index b8414ea9..9dfe1a80 100644 --- a/tests/api_resources/cloud/networks/test_routers.py +++ b/tests/api_resources/cloud/networks/test_routers.py @@ -399,7 +399,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncRouters: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/networks/test_subnets.py b/tests/api_resources/cloud/networks/test_subnets.py index f399473c..0680b1f7 100644 --- a/tests/api_resources/cloud/networks/test_subnets.py +++ b/tests/api_resources/cloud/networks/test_subnets.py @@ -293,7 +293,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncSubnets: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/quotas/test_requests.py b/tests/api_resources/cloud/quotas/test_requests.py index ad9a144f..ccc87ba5 100644 --- a/tests/api_resources/cloud/quotas/test_requests.py +++ b/tests/api_resources/cloud/quotas/test_requests.py @@ -237,7 +237,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncRequests: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/registries/test_artifacts.py b/tests/api_resources/cloud/registries/test_artifacts.py index ab68f23d..2d602314 100644 --- a/tests/api_resources/cloud/registries/test_artifacts.py +++ b/tests/api_resources/cloud/registries/test_artifacts.py @@ -132,7 +132,9 @@ def test_path_params_delete(self, client: Gcore) -> None: class TestAsyncArtifacts: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/registries/test_repositories.py b/tests/api_resources/cloud/registries/test_repositories.py index 6cb3d0c6..897e48d7 100644 --- a/tests/api_resources/cloud/registries/test_repositories.py +++ b/tests/api_resources/cloud/registries/test_repositories.py @@ -106,7 +106,9 @@ def test_path_params_delete(self, client: Gcore) -> None: class TestAsyncRepositories: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/registries/test_tags.py b/tests/api_resources/cloud/registries/test_tags.py index 0999b260..18010d41 100644 --- a/tests/api_resources/cloud/registries/test_tags.py +++ b/tests/api_resources/cloud/registries/test_tags.py @@ -95,7 +95,9 @@ def test_path_params_delete(self, client: Gcore) -> None: class TestAsyncTags: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/cloud/registries/test_users.py b/tests/api_resources/cloud/registries/test_users.py index e0d56803..1167b206 100644 --- a/tests/api_resources/cloud/registries/test_users.py +++ b/tests/api_resources/cloud/registries/test_users.py @@ -307,7 +307,9 @@ def test_streaming_response_refresh_secret(self, client: Gcore) -> None: class TestAsyncUsers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/reserved_fixed_ips/test_vip.py b/tests/api_resources/cloud/reserved_fixed_ips/test_vip.py index 5970928c..65011df5 100644 --- a/tests/api_resources/cloud/reserved_fixed_ips/test_vip.py +++ b/tests/api_resources/cloud/reserved_fixed_ips/test_vip.py @@ -277,7 +277,9 @@ def test_path_params_update_connected_ports(self, client: Gcore) -> None: class TestAsyncVip: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list_candidate_ports(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/cloud/security_groups/test_rules.py b/tests/api_resources/cloud/security_groups/test_rules.py index b6ac50fb..6f84f09a 100644 --- a/tests/api_resources/cloud/security_groups/test_rules.py +++ b/tests/api_resources/cloud/security_groups/test_rules.py @@ -200,7 +200,9 @@ def test_path_params_replace(self, client: Gcore) -> None: class TestAsyncRules: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_billing_reservations.py b/tests/api_resources/cloud/test_billing_reservations.py index 7463ebd1..9053b82d 100644 --- a/tests/api_resources/cloud/test_billing_reservations.py +++ b/tests/api_resources/cloud/test_billing_reservations.py @@ -95,7 +95,9 @@ def test_streaming_response_get(self, client: Gcore) -> None: class TestAsyncBillingReservations: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index 62cb137a..fca472e6 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -389,7 +389,9 @@ def test_path_params_resize(self, client: Gcore) -> None: class TestAsyncFileShares: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create_overload_1(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index 52a54438..a0772131 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -314,7 +314,9 @@ def test_path_params_unassign(self, client: Gcore) -> None: class TestAsyncFloatingIPs: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index bbb0f9ab..7c495e40 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -466,7 +466,9 @@ def test_path_params_resize(self, client: Gcore) -> None: class TestAsyncGPUBaremetalClusters: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_inference.py b/tests/api_resources/cloud/test_inference.py index b30c062e..b16c0068 100644 --- a/tests/api_resources/cloud/test_inference.py +++ b/tests/api_resources/cloud/test_inference.py @@ -44,7 +44,9 @@ def test_streaming_response_get_capacity_by_region(self, client: Gcore) -> None: class TestAsyncInference: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_get_capacity_by_region(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/cloud/test_instances.py b/tests/api_resources/cloud/test_instances.py index 6012d388..9dfe0883 100644 --- a/tests/api_resources/cloud/test_instances.py +++ b/tests/api_resources/cloud/test_instances.py @@ -883,7 +883,9 @@ def test_path_params_unassign_security_group(self, client: Gcore) -> None: class TestAsyncInstances: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_ip_ranges.py b/tests/api_resources/cloud/test_ip_ranges.py index c0545598..e7dde3b1 100644 --- a/tests/api_resources/cloud/test_ip_ranges.py +++ b/tests/api_resources/cloud/test_ip_ranges.py @@ -44,7 +44,9 @@ def test_streaming_response_list(self, client: Gcore) -> None: class TestAsyncIPRanges: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index 42cc2367..3a61a657 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -483,7 +483,9 @@ def test_path_params_resize(self, client: Gcore) -> None: class TestAsyncLoadBalancers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_networks.py b/tests/api_resources/cloud/test_networks.py index 18fd0fdf..dbd1f4d0 100644 --- a/tests/api_resources/cloud/test_networks.py +++ b/tests/api_resources/cloud/test_networks.py @@ -269,7 +269,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncNetworks: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_placement_groups.py b/tests/api_resources/cloud/test_placement_groups.py index a6962d8d..84783508 100644 --- a/tests/api_resources/cloud/test_placement_groups.py +++ b/tests/api_resources/cloud/test_placement_groups.py @@ -185,7 +185,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncPlacementGroups: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_projects.py b/tests/api_resources/cloud/test_projects.py index 9bbc7710..b01e5c29 100644 --- a/tests/api_resources/cloud/test_projects.py +++ b/tests/api_resources/cloud/test_projects.py @@ -203,7 +203,9 @@ def test_streaming_response_replace(self, client: Gcore) -> None: class TestAsyncProjects: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_quotas.py b/tests/api_resources/cloud/test_quotas.py index 788423b7..b027378e 100644 --- a/tests/api_resources/cloud/test_quotas.py +++ b/tests/api_resources/cloud/test_quotas.py @@ -109,7 +109,9 @@ def test_streaming_response_get_global(self, client: Gcore) -> None: class TestAsyncQuotas: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_get_all(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/cloud/test_regions.py b/tests/api_resources/cloud/test_regions.py index 0d00b673..9f31384c 100644 --- a/tests/api_resources/cloud/test_regions.py +++ b/tests/api_resources/cloud/test_regions.py @@ -95,7 +95,9 @@ def test_streaming_response_get(self, client: Gcore) -> None: class TestAsyncRegions: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_registries.py b/tests/api_resources/cloud/test_registries.py index 4fe48383..8d2be038 100644 --- a/tests/api_resources/cloud/test_registries.py +++ b/tests/api_resources/cloud/test_registries.py @@ -221,7 +221,9 @@ def test_streaming_response_resize(self, client: Gcore) -> None: class TestAsyncRegistries: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_reserved_fixed_ips.py b/tests/api_resources/cloud/test_reserved_fixed_ips.py index b4bf37d3..3f321ace 100644 --- a/tests/api_resources/cloud/test_reserved_fixed_ips.py +++ b/tests/api_resources/cloud/test_reserved_fixed_ips.py @@ -412,7 +412,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncReservedFixedIPs: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create_overload_1(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/cloud/test_secrets.py b/tests/api_resources/cloud/test_secrets.py index f49b1f3a..61efb25b 100644 --- a/tests/api_resources/cloud/test_secrets.py +++ b/tests/api_resources/cloud/test_secrets.py @@ -301,7 +301,9 @@ def test_streaming_response_upload_tls_certificate(self, client: Gcore) -> None: class TestAsyncSecrets: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index 5190081d..24ed373f 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -390,7 +390,9 @@ def test_path_params_revert_to_default(self, client: Gcore) -> None: class TestAsyncSecurityGroups: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_ssh_keys.py b/tests/api_resources/cloud/test_ssh_keys.py index 606308f7..e1049f06 100644 --- a/tests/api_resources/cloud/test_ssh_keys.py +++ b/tests/api_resources/cloud/test_ssh_keys.py @@ -235,7 +235,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncSSHKeys: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_tasks.py b/tests/api_resources/cloud/test_tasks.py index e28f3fde..eeb37cb3 100644 --- a/tests/api_resources/cloud/test_tasks.py +++ b/tests/api_resources/cloud/test_tasks.py @@ -172,7 +172,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncTasks: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/cloud/test_volumes.py b/tests/api_resources/cloud/test_volumes.py index 0140c029..2a263914 100644 --- a/tests/api_resources/cloud/test_volumes.py +++ b/tests/api_resources/cloud/test_volumes.py @@ -666,7 +666,9 @@ def test_path_params_revert_to_last_snapshot(self, client: Gcore) -> None: class TestAsyncVolumes: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create_overload_1(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/cloud/users/test_role_assignments.py b/tests/api_resources/cloud/users/test_role_assignments.py index f41e6762..2c74e087 100644 --- a/tests/api_resources/cloud/users/test_role_assignments.py +++ b/tests/api_resources/cloud/users/test_role_assignments.py @@ -181,7 +181,9 @@ def test_streaming_response_delete(self, client: Gcore) -> None: class TestAsyncRoleAssignments: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/test_waap.py b/tests/api_resources/test_waap.py index 2bb0cf25..f006a612 100644 --- a/tests/api_resources/test_waap.py +++ b/tests/api_resources/test_waap.py @@ -44,7 +44,9 @@ def test_streaming_response_get_account_overview(self, client: Gcore) -> None: class TestAsyncWaap: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_get_account_overview(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/waap/domains/analytics/test_requests.py b/tests/api_resources/waap/domains/analytics/test_requests.py index 920e5527..a02cc8f8 100644 --- a/tests/api_resources/waap/domains/analytics/test_requests.py +++ b/tests/api_resources/waap/domains/analytics/test_requests.py @@ -116,7 +116,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncRequests: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/waap/domains/api_discovery/test_scan_results.py b/tests/api_resources/waap/domains/api_discovery/test_scan_results.py index 57c11b9f..3778f693 100644 --- a/tests/api_resources/waap/domains/api_discovery/test_scan_results.py +++ b/tests/api_resources/waap/domains/api_discovery/test_scan_results.py @@ -109,7 +109,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncScanResults: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/waap/domains/test_advanced_rules.py b/tests/api_resources/waap/domains/test_advanced_rules.py index 17e72abe..d4eadeeb 100644 --- a/tests/api_resources/waap/domains/test_advanced_rules.py +++ b/tests/api_resources/waap/domains/test_advanced_rules.py @@ -295,7 +295,9 @@ def test_streaming_response_toggle(self, client: Gcore) -> None: class TestAsyncAdvancedRules: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/waap/domains/test_analytics.py b/tests/api_resources/waap/domains/test_analytics.py index a1e5067d..698ecf8c 100644 --- a/tests/api_resources/waap/domains/test_analytics.py +++ b/tests/api_resources/waap/domains/test_analytics.py @@ -210,7 +210,9 @@ def test_streaming_response_list_event_traffic(self, client: Gcore) -> None: class TestAsyncAnalytics: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_get_event_statistics(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/waap/domains/test_api_discovery.py b/tests/api_resources/waap/domains/test_api_discovery.py index 0cc77d1f..9f4abcc0 100644 --- a/tests/api_resources/waap/domains/test_api_discovery.py +++ b/tests/api_resources/waap/domains/test_api_discovery.py @@ -166,7 +166,9 @@ def test_streaming_response_upload_openapi(self, client: Gcore) -> None: class TestAsyncAPIDiscovery: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_get_settings(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/waap/domains/test_api_path_groups.py b/tests/api_resources/waap/domains/test_api_path_groups.py index 39767b29..1987bf0a 100644 --- a/tests/api_resources/waap/domains/test_api_path_groups.py +++ b/tests/api_resources/waap/domains/test_api_path_groups.py @@ -50,7 +50,9 @@ def test_streaming_response_list(self, client: Gcore) -> None: class TestAsyncAPIPathGroups: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/waap/domains/test_api_paths.py b/tests/api_resources/waap/domains/test_api_paths.py index 76b67fdd..23f497f1 100644 --- a/tests/api_resources/waap/domains/test_api_paths.py +++ b/tests/api_resources/waap/domains/test_api_paths.py @@ -264,7 +264,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncAPIPaths: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/waap/domains/test_custom_rules.py b/tests/api_resources/waap/domains/test_custom_rules.py index 181f5843..fa8f46dc 100644 --- a/tests/api_resources/waap/domains/test_custom_rules.py +++ b/tests/api_resources/waap/domains/test_custom_rules.py @@ -498,7 +498,9 @@ def test_streaming_response_toggle(self, client: Gcore) -> None: class TestAsyncCustomRules: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/waap/domains/test_firewall_rules.py b/tests/api_resources/waap/domains/test_firewall_rules.py index 5aeb5fd6..0d652808 100644 --- a/tests/api_resources/waap/domains/test_firewall_rules.py +++ b/tests/api_resources/waap/domains/test_firewall_rules.py @@ -342,7 +342,9 @@ def test_streaming_response_toggle(self, client: Gcore) -> None: class TestAsyncFirewallRules: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/waap/domains/test_insight_silences.py b/tests/api_resources/waap/domains/test_insight_silences.py index 9d90ce31..5b97be86 100644 --- a/tests/api_resources/waap/domains/test_insight_silences.py +++ b/tests/api_resources/waap/domains/test_insight_silences.py @@ -271,7 +271,9 @@ def test_path_params_get(self, client: Gcore) -> None: class TestAsyncInsightSilences: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/waap/domains/test_insights.py b/tests/api_resources/waap/domains/test_insights.py index b9c262cc..1f94b7d7 100644 --- a/tests/api_resources/waap/domains/test_insights.py +++ b/tests/api_resources/waap/domains/test_insights.py @@ -153,7 +153,9 @@ def test_path_params_replace(self, client: Gcore) -> None: class TestAsyncInsights: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/waap/domains/test_policies.py b/tests/api_resources/waap/domains/test_policies.py index 8686f7f4..bb043c17 100644 --- a/tests/api_resources/waap/domains/test_policies.py +++ b/tests/api_resources/waap/domains/test_policies.py @@ -61,7 +61,9 @@ def test_path_params_toggle(self, client: Gcore) -> None: class TestAsyncPolicies: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_toggle(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/waap/domains/test_settings.py b/tests/api_resources/waap/domains/test_settings.py index 55ebebf3..158273e1 100644 --- a/tests/api_resources/waap/domains/test_settings.py +++ b/tests/api_resources/waap/domains/test_settings.py @@ -96,7 +96,9 @@ def test_streaming_response_get(self, client: Gcore) -> None: class TestAsyncSettings: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/waap/test_advanced_rules.py b/tests/api_resources/waap/test_advanced_rules.py index 14744da2..d61c91af 100644 --- a/tests/api_resources/waap/test_advanced_rules.py +++ b/tests/api_resources/waap/test_advanced_rules.py @@ -44,7 +44,9 @@ def test_streaming_response_list(self, client: Gcore) -> None: class TestAsyncAdvancedRules: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/waap/test_custom_page_sets.py b/tests/api_resources/waap/test_custom_page_sets.py index 68fda447..bb2ad1ee 100644 --- a/tests/api_resources/waap/test_custom_page_sets.py +++ b/tests/api_resources/waap/test_custom_page_sets.py @@ -319,7 +319,9 @@ def test_streaming_response_preview(self, client: Gcore) -> None: class TestAsyncCustomPageSets: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/waap/test_domains.py b/tests/api_resources/waap/test_domains.py index 196db9f7..5d380b41 100644 --- a/tests/api_resources/waap/test_domains.py +++ b/tests/api_resources/waap/test_domains.py @@ -193,7 +193,9 @@ def test_streaming_response_list_rule_sets(self, client: Gcore) -> None: class TestAsyncDomains: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/waap/test_ip_info.py b/tests/api_resources/waap/test_ip_info.py index 3d8e495d..641feb39 100644 --- a/tests/api_resources/waap/test_ip_info.py +++ b/tests/api_resources/waap/test_ip_info.py @@ -328,7 +328,9 @@ def test_streaming_response_list_attacked_countries(self, client: Gcore) -> None class TestAsyncIPInfo: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/waap/test_organizations.py b/tests/api_resources/waap/test_organizations.py index d70ad3bb..d4d2c516 100644 --- a/tests/api_resources/waap/test_organizations.py +++ b/tests/api_resources/waap/test_organizations.py @@ -55,7 +55,9 @@ def test_streaming_response_list(self, client: Gcore) -> None: class TestAsyncOrganizations: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/api_resources/waap/test_statistics.py b/tests/api_resources/waap/test_statistics.py index 5eaa022b..513e819d 100644 --- a/tests/api_resources/waap/test_statistics.py +++ b/tests/api_resources/waap/test_statistics.py @@ -60,7 +60,9 @@ def test_streaming_response_get_usage_series(self, client: Gcore) -> None: class TestAsyncStatistics: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_get_usage_series(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/waap/test_tags.py b/tests/api_resources/waap/test_tags.py index 588a1b44..00753147 100644 --- a/tests/api_resources/waap/test_tags.py +++ b/tests/api_resources/waap/test_tags.py @@ -57,7 +57,9 @@ def test_streaming_response_list(self, client: Gcore) -> None: class TestAsyncTags: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + 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: diff --git a/tests/conftest.py b/tests/conftest.py index 38916e21..36a0402c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,10 +6,12 @@ import logging from typing import TYPE_CHECKING, Iterator, AsyncIterator +import httpx import pytest from pytest_asyncio import is_async_test -from gcore import Gcore, AsyncGcore +from gcore import Gcore, AsyncGcore, DefaultAioHttpClient +from gcore._utils import is_dict if TYPE_CHECKING: from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage] @@ -27,6 +29,19 @@ def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: for async_test in pytest_asyncio_tests: async_test.add_marker(session_scope_marker, append=False) + # We skip tests that use both the aiohttp client and respx_mock as respx_mock + # doesn't support custom transports. + for item in items: + if "async_client" not in item.fixturenames or "respx_mock" not in item.fixturenames: + continue + + if not hasattr(item, "callspec"): + continue + + async_client_param = item.callspec.params.get("async_client") + if is_dict(async_client_param) and async_client_param.get("http_client") == "aiohttp": + item.add_marker(pytest.mark.skip(reason="aiohttp client is not compatible with respx_mock")) + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -45,9 +60,25 @@ def client(request: FixtureRequest) -> Iterator[Gcore]: @pytest.fixture(scope="session") async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncGcore]: - strict = getattr(request, "param", True) - if not isinstance(strict, bool): - raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") - - async with AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: + param = getattr(request, "param", True) + + # defaults + strict = True + http_client: None | httpx.AsyncClient = None + + if isinstance(param, bool): + strict = param + elif is_dict(param): + strict = param.get("strict", True) + assert isinstance(strict, bool) + + http_client_type = param.get("http_client", "httpx") + if http_client_type == "aiohttp": + http_client = DefaultAioHttpClient() + else: + raise TypeError(f"Unexpected fixture parameter type {type(param)}, expected bool or dict") + + async with AsyncGcore( + base_url=base_url, api_key=api_key, _strict_response_validation=strict, http_client=http_client + ) as client: yield client From b8230eb95015f6f9e225d56962438330ca6314b7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 12:15:12 +0000 Subject: [PATCH 173/592] codegen metadata --- .stats.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0bae0f63..84861e08 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8e761e093cec076307af9cd395249c974076de7c2bb8a672f919bfc2f0264fdb.yml -openapi_spec_hash: 5be7d0cc67dba31a269661f2b620b1f5 -config_hash: 851d2f0c1f925aee3b53478d4fe311ba +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c499a9575c28f870c13772a0db8d0c62489ddf9f5f64931034c240be1eefacdc.yml +openapi_spec_hash: 90621c3e75827e66e860b01442ac94b6 +config_hash: ea790cbbc6c75b298783df8f2313d56b From 055bc26bc34278037d27a8228d3cd68bec0534f6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 14:10:45 +0000 Subject: [PATCH 174/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../waap/domains/custom_rule_create_params.py | 10 ++- .../waap/domains/custom_rule_update_params.py | 10 ++- src/gcore/types/waap/waap_custom_rule.py | 10 ++- .../waap/domains/test_custom_rules.py | 64 +++++++++---------- 5 files changed, 55 insertions(+), 43 deletions(-) diff --git a/.stats.yml b/.stats.yml index 84861e08..525f59ca 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c499a9575c28f870c13772a0db8d0c62489ddf9f5f64931034c240be1eefacdc.yml -openapi_spec_hash: 90621c3e75827e66e860b01442ac94b6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-4701f855ef372199144e38f9e834b76f3ce548793d6eb01d67fbe64662126b75.yml +openapi_spec_hash: fa885a37ceec15242fb34b5ad0d4558e config_hash: ea790cbbc6c75b298783df8f2313d56b 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 da009154..61e7618c 100644 --- a/src/gcore/types/waap/domains/custom_rule_create_params.py +++ b/src/gcore/types/waap/domains/custom_rule_create_params.py @@ -274,10 +274,14 @@ class ConditionTags(TypedDict, total=False): class ConditionURL(TypedDict, total=False): url: Required[str] - """The pattern to match against the request URL. + """ + The pattern to match against the request URL. Constraints depend on + `match_type`: - If `match_type` is `Regex` the value must be a valid regular expression that - does not use lookahead or lookbehind constructs + - **Exact/Contains**: plain text matching (e.g., `/admin`). + - **Regex**: a valid regular expression (must comply with + `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))\\*\\++,=\\//\\--\\..\\%%]+$`). Lookahead/lookbehind constructs are + forbidden. """ match_type: Literal["Exact", "Contains", "Regex"] 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 8a223135..7e5d36b0 100644 --- a/src/gcore/types/waap/domains/custom_rule_update_params.py +++ b/src/gcore/types/waap/domains/custom_rule_update_params.py @@ -277,10 +277,14 @@ class ConditionTags(TypedDict, total=False): class ConditionURL(TypedDict, total=False): url: Required[str] - """The pattern to match against the request URL. + """ + The pattern to match against the request URL. Constraints depend on + `match_type`: - If `match_type` is `Regex` the value must be a valid regular expression that - does not use lookahead or lookbehind constructs + - **Exact/Contains**: plain text matching (e.g., `/admin`). + - **Regex**: a valid regular expression (must comply with + `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))\\*\\++,=\\//\\--\\..\\%%]+$`). Lookahead/lookbehind constructs are + forbidden. """ match_type: Literal["Exact", "Contains", "Regex"] diff --git a/src/gcore/types/waap/waap_custom_rule.py b/src/gcore/types/waap/waap_custom_rule.py index 20e1c445..f273efcf 100644 --- a/src/gcore/types/waap/waap_custom_rule.py +++ b/src/gcore/types/waap/waap_custom_rule.py @@ -255,10 +255,14 @@ class ConditionTags(BaseModel): class ConditionURL(BaseModel): url: str - """The pattern to match against the request URL. + """ + The pattern to match against the request URL. Constraints depend on + `match_type`: - If `match_type` is `Regex` the value must be a valid regular expression that - does not use lookahead or lookbehind constructs + - **Exact/Contains**: plain text matching (e.g., `/admin`). + - **Regex**: a valid regular expression (must comply with + `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))\\*\\++,=\\//\\--\\..\\%%]+$`). Lookahead/lookbehind constructs are + forbidden. """ match_type: Optional[Literal["Exact", "Contains", "Regex"]] = None diff --git a/tests/api_resources/waap/domains/test_custom_rules.py b/tests/api_resources/waap/domains/test_custom_rules.py index fa8f46dc..ca4081bf 100644 --- a/tests/api_resources/waap/domains/test_custom_rules.py +++ b/tests/api_resources/waap/domains/test_custom_rules.py @@ -47,7 +47,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: conditions=[ { "content_type": { - "content_type": ["string"], + "content_type": ["application/xml"], "negation": True, }, "country": { @@ -55,17 +55,17 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "negation": True, }, "file_extension": { - "file_extension": ["string"], + "file_extension": ["pdf"], "negation": True, }, "header": { - "header": "header", + "header": "Origin", "value": "value", "match_type": "Exact", "negation": True, }, "header_exists": { - "header": "header", + "header": "Origin", "negation": True, }, "http_method": { @@ -82,7 +82,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "negation": True, }, "organization": { - "organization": "organization", + "organization": "UptimeRobot s.r.o", "negation": True, }, "owner_types": { @@ -116,17 +116,17 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "negation": True, }, "url": { - "url": "x", + "url": "/wp-admin/", "match_type": "Exact", "negation": True, }, "user_agent": { - "user_agent": "user_agent", + "user_agent": "curl/", "match_type": "Exact", "negation": True, }, "user_defined_tags": { - "tags": ["string"], + "tags": ["SQfNklznVLBBpr"], "negation": True, }, } @@ -196,7 +196,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: conditions=[ { "content_type": { - "content_type": ["string"], + "content_type": ["application/xml"], "negation": True, }, "country": { @@ -204,17 +204,17 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "negation": True, }, "file_extension": { - "file_extension": ["string"], + "file_extension": ["pdf"], "negation": True, }, "header": { - "header": "header", + "header": "Origin", "value": "value", "match_type": "Exact", "negation": True, }, "header_exists": { - "header": "header", + "header": "Origin", "negation": True, }, "http_method": { @@ -231,7 +231,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "negation": True, }, "organization": { - "organization": "organization", + "organization": "UptimeRobot s.r.o", "negation": True, }, "owner_types": { @@ -265,17 +265,17 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "negation": True, }, "url": { - "url": "x", + "url": "/wp-admin/", "match_type": "Exact", "negation": True, }, "user_agent": { - "user_agent": "user_agent", + "user_agent": "curl/", "match_type": "Exact", "negation": True, }, "user_defined_tags": { - "tags": ["string"], + "tags": ["SQfNklznVLBBpr"], "negation": True, }, } @@ -531,7 +531,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> conditions=[ { "content_type": { - "content_type": ["string"], + "content_type": ["application/xml"], "negation": True, }, "country": { @@ -539,17 +539,17 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "negation": True, }, "file_extension": { - "file_extension": ["string"], + "file_extension": ["pdf"], "negation": True, }, "header": { - "header": "header", + "header": "Origin", "value": "value", "match_type": "Exact", "negation": True, }, "header_exists": { - "header": "header", + "header": "Origin", "negation": True, }, "http_method": { @@ -566,7 +566,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "negation": True, }, "organization": { - "organization": "organization", + "organization": "UptimeRobot s.r.o", "negation": True, }, "owner_types": { @@ -600,17 +600,17 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "negation": True, }, "url": { - "url": "x", + "url": "/wp-admin/", "match_type": "Exact", "negation": True, }, "user_agent": { - "user_agent": "user_agent", + "user_agent": "curl/", "match_type": "Exact", "negation": True, }, "user_defined_tags": { - "tags": ["string"], + "tags": ["SQfNklznVLBBpr"], "negation": True, }, } @@ -680,7 +680,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> conditions=[ { "content_type": { - "content_type": ["string"], + "content_type": ["application/xml"], "negation": True, }, "country": { @@ -688,17 +688,17 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "negation": True, }, "file_extension": { - "file_extension": ["string"], + "file_extension": ["pdf"], "negation": True, }, "header": { - "header": "header", + "header": "Origin", "value": "value", "match_type": "Exact", "negation": True, }, "header_exists": { - "header": "header", + "header": "Origin", "negation": True, }, "http_method": { @@ -715,7 +715,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "negation": True, }, "organization": { - "organization": "organization", + "organization": "UptimeRobot s.r.o", "negation": True, }, "owner_types": { @@ -749,17 +749,17 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "negation": True, }, "url": { - "url": "x", + "url": "/wp-admin/", "match_type": "Exact", "negation": True, }, "user_agent": { - "user_agent": "user_agent", + "user_agent": "curl/", "match_type": "Exact", "negation": True, }, "user_defined_tags": { - "tags": ["string"], + "tags": ["SQfNklznVLBBpr"], "negation": True, }, } From df7782fcfe73b3b26e8932de8760cfc46c80cbbb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 04:44:22 +0000 Subject: [PATCH 175/592] chore(tests): skip some failing tests on the latest python versions --- tests/test_client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_client.py b/tests/test_client.py index bef5cc73..53499b05 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -191,6 +191,7 @@ def test_copy_signature(self) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" + @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") def test_copy_build_request(self) -> None: options = FinalRequestOptions(method="get", url="/foo") @@ -1013,6 +1014,7 @@ def test_copy_signature(self) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" + @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") def test_copy_build_request(self) -> None: options = FinalRequestOptions(method="get", url="/foo") From 7b1bf78e8b0225a1e0b02ac3a145833884a49102 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:57:04 +0000 Subject: [PATCH 176/592] chore(internal): updates --- .stats.yml | 4 ++-- .../cloud/inference/test_deployments.py | 8 +++---- .../cloud/quotas/test_requests.py | 24 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.stats.yml b/.stats.yml index 525f59ca..824afbdd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-4701f855ef372199144e38f9e834b76f3ce548793d6eb01d67fbe64662126b75.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1cf10e154912e670b97c12bdf6887f3ee959e4d53d6987b92e0e5d980a085f29.yml openapi_spec_hash: fa885a37ceec15242fb34b5ad0d4558e -config_hash: ea790cbbc6c75b298783df8f2313d56b +config_hash: 13858022450ab96760041d6619620b32 diff --git a/tests/api_resources/cloud/inference/test_deployments.py b/tests/api_resources/cloud/inference/test_deployments.py index d7b21e45..ad310970 100644 --- a/tests/api_resources/cloud/inference/test_deployments.py +++ b/tests/api_resources/cloud/inference/test_deployments.py @@ -233,14 +233,14 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "cooldown_period": 60, "polling_interval": 30, "triggers": { - "cpu": {"threshold": 80}, + "cpu": {"threshold": 75}, "gpu_memory": {"threshold": 80}, "gpu_utilization": {"threshold": 80}, "http": { "rate": 1, "window": 60, }, - "memory": {"threshold": 70}, + "memory": {"threshold": 80}, "sqs": { "activation_queue_length": 1, "aws_region": "us-east-1", @@ -835,14 +835,14 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "cooldown_period": 60, "polling_interval": 30, "triggers": { - "cpu": {"threshold": 80}, + "cpu": {"threshold": 75}, "gpu_memory": {"threshold": 80}, "gpu_utilization": {"threshold": 80}, "http": { "rate": 1, "window": 60, }, - "memory": {"threshold": 70}, + "memory": {"threshold": 80}, "sqs": { "activation_queue_length": 1, "aws_region": "us-east-1", diff --git a/tests/api_resources/cloud/quotas/test_requests.py b/tests/api_resources/cloud/quotas/test_requests.py index ccc87ba5..e9d3aae4 100644 --- a/tests/api_resources/cloud/quotas/test_requests.py +++ b/tests/api_resources/cloud/quotas/test_requests.py @@ -162,14 +162,14 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: request = client.cloud.quotas.requests.delete( - "request_id", + "3", ) assert request is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.quotas.requests.with_raw_response.delete( - "request_id", + "3", ) assert response.is_closed is True @@ -180,7 +180,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.quotas.requests.with_streaming_response.delete( - "request_id", + "3", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -200,14 +200,14 @@ def test_path_params_delete(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: request = client.cloud.quotas.requests.get( - "request_id", + "3", ) assert_matches_type(RequestGetResponse, request, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.quotas.requests.with_raw_response.get( - "request_id", + "3", ) assert response.is_closed is True @@ -218,7 +218,7 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.quotas.requests.with_streaming_response.get( - "request_id", + "3", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -385,14 +385,14 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: request = await async_client.cloud.quotas.requests.delete( - "request_id", + "3", ) assert request is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.quotas.requests.with_raw_response.delete( - "request_id", + "3", ) assert response.is_closed is True @@ -403,7 +403,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.quotas.requests.with_streaming_response.delete( - "request_id", + "3", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -423,14 +423,14 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: request = await async_client.cloud.quotas.requests.get( - "request_id", + "3", ) assert_matches_type(RequestGetResponse, request, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.quotas.requests.with_raw_response.get( - "request_id", + "3", ) assert response.is_closed is True @@ -441,7 +441,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.quotas.requests.with_streaming_response.get( - "request_id", + "3", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From cf310c5175d6e39ce0cbc9fc4566f410c6bddade Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Jun 2025 08:13:18 +0000 Subject: [PATCH 177/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/cloud/volumes.py | 72 ++++++++++++++++--- src/gcore/types/cloud/volume_update_params.py | 32 ++++++++- tests/api_resources/cloud/test_volumes.py | 30 +++++--- 4 files changed, 116 insertions(+), 22 deletions(-) diff --git a/.stats.yml b/.stats.yml index 824afbdd..f22045b8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1cf10e154912e670b97c12bdf6887f3ee959e4d53d6987b92e0e5d980a085f29.yml -openapi_spec_hash: fa885a37ceec15242fb34b5ad0d4558e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-381b496c557322d1e84bf8c9aadceab8af0eca97afaaab7143863736fb7dba08.yml +openapi_spec_hash: 9bba0add4c34eb48fde29469643d9aff config_hash: 13858022450ab96760041d6619620b32 diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 7b86a7e9..06159e25 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable +from typing import List, Iterable, Optional from typing_extensions import Literal, overload import httpx @@ -320,7 +320,8 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - name: str, + name: str | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -329,7 +330,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Volume: """ - Rename a volume. + Rename a volume or update tags Args: project_id: Project ID @@ -338,7 +339,27 @@ def update( volume_id: Volume ID - name: Name. + name: Name + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. extra_headers: Send extra headers @@ -356,7 +377,13 @@ def update( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._patch( f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", - body=maybe_transform({"name": name}, volume_update_params.VolumeUpdateParams), + body=maybe_transform( + { + "name": name, + "tags": tags, + }, + volume_update_params.VolumeUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1102,7 +1129,8 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - name: str, + name: str | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1111,7 +1139,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Volume: """ - Rename a volume. + Rename a volume or update tags Args: project_id: Project ID @@ -1120,7 +1148,27 @@ async def update( volume_id: Volume ID - name: Name. + name: Name + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. extra_headers: Send extra headers @@ -1138,7 +1186,13 @@ async def update( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._patch( f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", - body=await async_maybe_transform({"name": name}, volume_update_params.VolumeUpdateParams), + body=await async_maybe_transform( + { + "name": name, + "tags": tags, + }, + volume_update_params.VolumeUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/types/cloud/volume_update_params.py b/src/gcore/types/cloud/volume_update_params.py index 58439323..455e6210 100644 --- a/src/gcore/types/cloud/volume_update_params.py +++ b/src/gcore/types/cloud/volume_update_params.py @@ -2,7 +2,10 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Optional +from typing_extensions import TypedDict + +from .tag_update_map_param import TagUpdateMapParam __all__ = ["VolumeUpdateParams"] @@ -14,5 +17,28 @@ class VolumeUpdateParams(TypedDict, total=False): region_id: int """Region ID""" - name: Required[str] - """Name.""" + name: str + """Name""" + + tags: Optional[TagUpdateMapParam] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ diff --git a/tests/api_resources/cloud/test_volumes.py b/tests/api_resources/cloud/test_volumes.py index 2a263914..95d43b9f 100644 --- a/tests/api_resources/cloud/test_volumes.py +++ b/tests/api_resources/cloud/test_volumes.py @@ -209,7 +209,17 @@ def test_method_update(self, client: Gcore) -> None: volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", project_id=1, region_id=1, - name="my-resource", + ) + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + volume = client.cloud.volumes.update( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + name="some_name", + tags={"foo": "my-tag-value"}, ) assert_matches_type(Volume, volume, path=["response"]) @@ -219,7 +229,6 @@ def test_raw_response_update(self, client: Gcore) -> None: volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", project_id=1, region_id=1, - name="my-resource", ) assert response.is_closed is True @@ -233,7 +242,6 @@ def test_streaming_response_update(self, client: Gcore) -> None: volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", project_id=1, region_id=1, - name="my-resource", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -250,7 +258,6 @@ def test_path_params_update(self, client: Gcore) -> None: volume_id="", project_id=1, region_id=1, - name="my-resource", ) @parametrize @@ -858,7 +865,17 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", project_id=1, region_id=1, - name="my-resource", + ) + assert_matches_type(Volume, volume, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + volume = await async_client.cloud.volumes.update( + volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + name="some_name", + tags={"foo": "my-tag-value"}, ) assert_matches_type(Volume, volume, path=["response"]) @@ -868,7 +885,6 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", project_id=1, region_id=1, - name="my-resource", ) assert response.is_closed is True @@ -882,7 +898,6 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None volume_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", project_id=1, region_id=1, - name="my-resource", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -899,7 +914,6 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: volume_id="", project_id=1, region_id=1, - name="my-resource", ) @parametrize From fac2e0cffb15372a0ad648adef996ea08e62b974 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Jun 2025 10:10:55 +0000 Subject: [PATCH 178/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f22045b8..b3da9053 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-381b496c557322d1e84bf8c9aadceab8af0eca97afaaab7143863736fb7dba08.yml -openapi_spec_hash: 9bba0add4c34eb48fde29469643d9aff +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9bb10402e0f2bbd452c7eb2e738726c1da02e2f4c340a84d9a22b5c20adac014.yml +openapi_spec_hash: d8225066dbe62a49cad42dd4f7710794 config_hash: 13858022450ab96760041d6619620b32 From 5c91e34a7531940891571f31b462ec094c32e608 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 12:15:30 +0000 Subject: [PATCH 179/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index b3da9053..a57f9830 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9bb10402e0f2bbd452c7eb2e738726c1da02e2f4c340a84d9a22b5c20adac014.yml -openapi_spec_hash: d8225066dbe62a49cad42dd4f7710794 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7051bc15d5829927c5221604afb0511f7a1a8f57d929917d13c08ef5c974b5f4.yml +openapi_spec_hash: e971ef590ded216d1a7c11a56ca78067 config_hash: 13858022450ab96760041d6619620b32 From 330d21dc423183971780612276b8a28271aa09a8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Jun 2025 02:43:22 +0000 Subject: [PATCH 180/592] =?UTF-8?q?fix(ci):=20release-doctor=20=E2=80=94?= =?UTF-8?q?=20report=20correct=20token=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/check-release-environment | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/check-release-environment b/bin/check-release-environment index 4df2a0a0..b845b0f4 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -3,7 +3,7 @@ errors=() if [ -z "${PYPI_TOKEN}" ]; then - errors+=("The GCORE_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") + errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") fi lenErrors=${#errors[@]} From 95f45862ebdbdd8425dc2dbecaf697c7cdfdf0c3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 28 Jun 2025 08:48:01 +0000 Subject: [PATCH 181/592] chore(ci): only run for pushes and fork pull requests --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6054ec3..7eb50a15 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: timeout-minutes: 10 name: lint runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 @@ -42,6 +43,7 @@ jobs: contents: read id-token: write runs-on: depot-ubuntu-24.04 + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 @@ -62,6 +64,7 @@ jobs: timeout-minutes: 10 name: test runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 From bd64ecf7f0f3589d8043e3c6deb80170ce37fe8b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 02:38:28 +0000 Subject: [PATCH 182/592] fix(ci): correct conditional --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7eb50a15..b642078b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,14 +36,13 @@ jobs: run: ./scripts/lint upload: - if: github.repository == 'stainless-sdks/gcore-python' + if: github.repository == 'stainless-sdks/gcore-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) timeout-minutes: 10 name: upload permissions: contents: read id-token: write runs-on: depot-ubuntu-24.04 - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 From ded0a962df970bde223ca1a88f3076cd15d7c4cd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 10:11:12 +0000 Subject: [PATCH 183/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a57f9830..af340d1a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7051bc15d5829927c5221604afb0511f7a1a8f57d929917d13c08ef5c974b5f4.yml -openapi_spec_hash: e971ef590ded216d1a7c11a56ca78067 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-739daccdbf486da0806ddb7c892d037d991e743a6a536ffe0ebb1ff6ac6cd817.yml +openapi_spec_hash: 04456598c665817e9bb233d70b118f07 config_hash: 13858022450ab96760041d6619620b32 From dc83c8ec2ca3c81a56a54b1e46ced72687181f04 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 06:15:21 +0000 Subject: [PATCH 184/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index af340d1a..757399c4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 302 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-739daccdbf486da0806ddb7c892d037d991e743a6a536ffe0ebb1ff6ac6cd817.yml -openapi_spec_hash: 04456598c665817e9bb233d70b118f07 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3bd81b64cc2ef4de71b6d709296074d203d109fbe6549331480f09fd4412edd4.yml +openapi_spec_hash: 4bcd0c3053fcb13e42cf6b0d8244499f config_hash: 13858022450ab96760041d6619620b32 From b9bdd2c82f89f39d8a626fdbb93fa2f26044abbe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 11:53:41 +0000 Subject: [PATCH 185/592] refactor!: remove list suitable and list for resize from instance flavors --- .stats.yml | 4 +- api.md | 2 - .../resources/cloud/instances/flavors.py | 226 +---------------- src/gcore/types/cloud/instances/__init__.py | 2 - .../flavor_list_for_resize_params.py | 16 -- .../instances/flavor_list_suitable_params.py | 59 ----- .../cloud/instances/test_flavors.py | 234 +----------------- 7 files changed, 4 insertions(+), 539 deletions(-) delete mode 100644 src/gcore/types/cloud/instances/flavor_list_for_resize_params.py delete mode 100644 src/gcore/types/cloud/instances/flavor_list_suitable_params.py diff --git a/.stats.yml b/.stats.yml index 757399c4..56851965 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 302 +configured_endpoints: 300 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3bd81b64cc2ef4de71b6d709296074d203d109fbe6549331480f09fd4412edd4.yml openapi_spec_hash: 4bcd0c3053fcb13e42cf6b0d8244499f -config_hash: 13858022450ab96760041d6619620b32 +config_hash: 82e3bee0a1a3a3c07cd95fe80e8e2930 diff --git a/api.md b/api.md index 238e7d83..2a19927f 100644 --- a/api.md +++ b/api.md @@ -821,8 +821,6 @@ from gcore.types.cloud.instances import InstanceFlavor, InstanceFlavorList Methods: - client.cloud.instances.flavors.list(\*, project_id, region_id, \*\*params) -> InstanceFlavorList -- client.cloud.instances.flavors.list_for_resize(instance_id, \*, project_id, region_id, \*\*params) -> InstanceFlavorList -- client.cloud.instances.flavors.list_suitable(\*, project_id, region_id, \*\*params) -> InstanceFlavorList ### Interfaces diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index f27760f8..9bd7f38f 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import Iterable - import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -17,7 +15,7 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.cloud.instances import flavor_list_params, flavor_list_suitable_params, flavor_list_for_resize_params +from ....types.cloud.instances import flavor_list_params from ....types.cloud.instances.instance_flavor_list import InstanceFlavorList __all__ = ["FlavorsResource", "AsyncFlavorsResource"] @@ -106,104 +104,6 @@ def list( cast_to=InstanceFlavorList, ) - def list_for_resize( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InstanceFlavorList: - """ - List suitable flavors for instance resize - - Args: - include_prices: Set to true if flavor listing should include flavor prices - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not instance_id: - raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") - return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - {"include_prices": include_prices}, flavor_list_for_resize_params.FlavorListForResizeParams - ), - ), - cast_to=InstanceFlavorList, - ) - - def list_suitable( - self, - *, - project_id: int | None = None, - region_id: int | None = None, - volumes: Iterable[flavor_list_suitable_params.Volume], - include_prices: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InstanceFlavorList: - """ - List all flavors that are suitable for instance creation based on volume - requirements. - - Args: - volumes: Volumes details. Non-important info such as names may be omitted. - - include_prices: Set to true if flavor listing should include flavor prices - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/available_flavors", - body=maybe_transform({"volumes": volumes}, flavor_list_suitable_params.FlavorListSuitableParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - {"include_prices": include_prices}, flavor_list_suitable_params.FlavorListSuitableParams - ), - ), - cast_to=InstanceFlavorList, - ) - class AsyncFlavorsResource(AsyncAPIResource): @cached_property @@ -288,106 +188,6 @@ async def list( cast_to=InstanceFlavorList, ) - async def list_for_resize( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InstanceFlavorList: - """ - List suitable flavors for instance resize - - Args: - include_prices: Set to true if flavor listing should include flavor prices - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not instance_id: - raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") - return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/available_flavors", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"include_prices": include_prices}, flavor_list_for_resize_params.FlavorListForResizeParams - ), - ), - cast_to=InstanceFlavorList, - ) - - async def list_suitable( - self, - *, - project_id: int | None = None, - region_id: int | None = None, - volumes: Iterable[flavor_list_suitable_params.Volume], - include_prices: bool | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InstanceFlavorList: - """ - List all flavors that are suitable for instance creation based on volume - requirements. - - Args: - volumes: Volumes details. Non-important info such as names may be omitted. - - include_prices: Set to true if flavor listing should include flavor prices - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/available_flavors", - body=await async_maybe_transform( - {"volumes": volumes}, flavor_list_suitable_params.FlavorListSuitableParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"include_prices": include_prices}, flavor_list_suitable_params.FlavorListSuitableParams - ), - ), - cast_to=InstanceFlavorList, - ) - class FlavorsResourceWithRawResponse: def __init__(self, flavors: FlavorsResource) -> None: @@ -396,12 +196,6 @@ def __init__(self, flavors: FlavorsResource) -> None: self.list = to_raw_response_wrapper( flavors.list, ) - self.list_for_resize = to_raw_response_wrapper( - flavors.list_for_resize, - ) - self.list_suitable = to_raw_response_wrapper( - flavors.list_suitable, - ) class AsyncFlavorsResourceWithRawResponse: @@ -411,12 +205,6 @@ def __init__(self, flavors: AsyncFlavorsResource) -> None: self.list = async_to_raw_response_wrapper( flavors.list, ) - self.list_for_resize = async_to_raw_response_wrapper( - flavors.list_for_resize, - ) - self.list_suitable = async_to_raw_response_wrapper( - flavors.list_suitable, - ) class FlavorsResourceWithStreamingResponse: @@ -426,12 +214,6 @@ def __init__(self, flavors: FlavorsResource) -> None: self.list = to_streamed_response_wrapper( flavors.list, ) - self.list_for_resize = to_streamed_response_wrapper( - flavors.list_for_resize, - ) - self.list_suitable = to_streamed_response_wrapper( - flavors.list_suitable, - ) class AsyncFlavorsResourceWithStreamingResponse: @@ -441,9 +223,3 @@ def __init__(self, flavors: AsyncFlavorsResource) -> None: self.list = async_to_streamed_response_wrapper( flavors.list, ) - self.list_for_resize = async_to_streamed_response_wrapper( - flavors.list_for_resize, - ) - self.list_suitable = async_to_streamed_response_wrapper( - flavors.list_suitable, - ) diff --git a/src/gcore/types/cloud/instances/__init__.py b/src/gcore/types/cloud/instances/__init__.py index f275af0a..c2f77cfe 100644 --- a/src/gcore/types/cloud/instances/__init__.py +++ b/src/gcore/types/cloud/instances/__init__.py @@ -14,6 +14,4 @@ from .instance_flavor_list import InstanceFlavorList as InstanceFlavorList from .interface_attach_params import InterfaceAttachParams as InterfaceAttachParams from .interface_detach_params import InterfaceDetachParams as InterfaceDetachParams -from .flavor_list_suitable_params import FlavorListSuitableParams as FlavorListSuitableParams -from .flavor_list_for_resize_params import FlavorListForResizeParams as FlavorListForResizeParams from .image_create_from_volume_params import ImageCreateFromVolumeParams as ImageCreateFromVolumeParams diff --git a/src/gcore/types/cloud/instances/flavor_list_for_resize_params.py b/src/gcore/types/cloud/instances/flavor_list_for_resize_params.py deleted file mode 100644 index b1eb6ab1..00000000 --- a/src/gcore/types/cloud/instances/flavor_list_for_resize_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["FlavorListForResizeParams"] - - -class FlavorListForResizeParams(TypedDict, total=False): - project_id: int - - region_id: int - - include_prices: bool - """Set to true if flavor listing should include flavor prices""" diff --git a/src/gcore/types/cloud/instances/flavor_list_suitable_params.py b/src/gcore/types/cloud/instances/flavor_list_suitable_params.py deleted file mode 100644 index 3508d066..00000000 --- a/src/gcore/types/cloud/instances/flavor_list_suitable_params.py +++ /dev/null @@ -1,59 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["FlavorListSuitableParams", "Volume"] - - -class FlavorListSuitableParams(TypedDict, total=False): - project_id: int - - region_id: int - - volumes: Required[Iterable[Volume]] - """Volumes details. Non-important info such as names may be omitted.""" - - include_prices: bool - """Set to true if flavor listing should include flavor prices""" - - -class Volume(TypedDict, total=False): - source: Required[Literal["apptemplate", "existing-volume", "image", "new-volume", "snapshot"]] - """Volume source""" - - apptemplate_id: str - """App template ID. Mandatory if volume is created from marketplace template""" - - boot_index: int - """ - 0 should be set for primary boot device Unique positive values for other - bootable devices.Negative - boot prohibited - """ - - image_id: str - """Image ID. Mandatory if volume is created from image""" - - name: Optional[str] - - size: int - """Volume size. - - Must be specified when source is 'new-volume' or 'image'. If specified for - source 'snapshot' or 'existing-volume', value must be equal to respective - snapshot or volume size - """ - - snapshot_id: str - """Volume snapshot ID. Mandatory if volume is created from a snapshot""" - - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - """ - One of 'standard', '`ssd_hiiops`', '`ssd_local`', '`ssd_lowlatency`', 'cold', - 'ultra' - """ - - volume_id: str - """Volume ID. Mandatory if volume is pre-existing volume""" diff --git a/tests/api_resources/cloud/instances/test_flavors.py b/tests/api_resources/cloud/instances/test_flavors.py index 8efdf80d..51ff8119 100644 --- a/tests/api_resources/cloud/instances/test_flavors.py +++ b/tests/api_resources/cloud/instances/test_flavors.py @@ -9,9 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.instances import ( - InstanceFlavorList, -) +from gcore.types.cloud.instances import InstanceFlavorList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -65,121 +63,6 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_list_for_resize(self, client: Gcore) -> None: - flavor = client.cloud.instances.flavors.list_for_resize( - instance_id="instance_id", - project_id=0, - region_id=0, - ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - @parametrize - def test_method_list_for_resize_with_all_params(self, client: Gcore) -> None: - flavor = client.cloud.instances.flavors.list_for_resize( - instance_id="instance_id", - project_id=0, - region_id=0, - include_prices=True, - ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - @parametrize - def test_raw_response_list_for_resize(self, client: Gcore) -> None: - response = client.cloud.instances.flavors.with_raw_response.list_for_resize( - instance_id="instance_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flavor = response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - @parametrize - def test_streaming_response_list_for_resize(self, client: Gcore) -> None: - with client.cloud.instances.flavors.with_streaming_response.list_for_resize( - instance_id="instance_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flavor = response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list_for_resize(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.instances.flavors.with_raw_response.list_for_resize( - instance_id="", - project_id=0, - region_id=0, - ) - - @parametrize - def test_method_list_suitable(self, client: Gcore) -> None: - flavor = client.cloud.instances.flavors.list_suitable( - project_id=0, - region_id=0, - volumes=[{"source": "image"}], - ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - @parametrize - def test_method_list_suitable_with_all_params(self, client: Gcore) -> None: - flavor = client.cloud.instances.flavors.list_suitable( - project_id=0, - region_id=0, - volumes=[ - { - "source": "image", - "apptemplate_id": "apptemplate_id", - "boot_index": 0, - "image_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - "name": "TestVM5 Ubuntu boot image", - "size": 10, - "snapshot_id": "snapshot_id", - "type_name": "ssd_hiiops", - "volume_id": "volume_id", - } - ], - include_prices=True, - ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - @parametrize - def test_raw_response_list_suitable(self, client: Gcore) -> None: - response = client.cloud.instances.flavors.with_raw_response.list_suitable( - project_id=0, - region_id=0, - volumes=[{"source": "image"}], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flavor = response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - @parametrize - def test_streaming_response_list_suitable(self, client: Gcore) -> None: - with client.cloud.instances.flavors.with_streaming_response.list_suitable( - project_id=0, - region_id=0, - volumes=[{"source": "image"}], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flavor = response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - assert cast(Any, response.is_closed) is True - class TestAsyncFlavors: parametrize = pytest.mark.parametrize( @@ -231,118 +114,3 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(InstanceFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_list_for_resize(self, async_client: AsyncGcore) -> None: - flavor = await async_client.cloud.instances.flavors.list_for_resize( - instance_id="instance_id", - project_id=0, - region_id=0, - ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - @parametrize - async def test_method_list_for_resize_with_all_params(self, async_client: AsyncGcore) -> None: - flavor = await async_client.cloud.instances.flavors.list_for_resize( - instance_id="instance_id", - project_id=0, - region_id=0, - include_prices=True, - ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - @parametrize - async def test_raw_response_list_for_resize(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.instances.flavors.with_raw_response.list_for_resize( - instance_id="instance_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flavor = await response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - @parametrize - async def test_streaming_response_list_for_resize(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.instances.flavors.with_streaming_response.list_for_resize( - instance_id="instance_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flavor = await response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list_for_resize(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.instances.flavors.with_raw_response.list_for_resize( - instance_id="", - project_id=0, - region_id=0, - ) - - @parametrize - async def test_method_list_suitable(self, async_client: AsyncGcore) -> None: - flavor = await async_client.cloud.instances.flavors.list_suitable( - project_id=0, - region_id=0, - volumes=[{"source": "image"}], - ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - @parametrize - async def test_method_list_suitable_with_all_params(self, async_client: AsyncGcore) -> None: - flavor = await async_client.cloud.instances.flavors.list_suitable( - project_id=0, - region_id=0, - volumes=[ - { - "source": "image", - "apptemplate_id": "apptemplate_id", - "boot_index": 0, - "image_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - "name": "TestVM5 Ubuntu boot image", - "size": 10, - "snapshot_id": "snapshot_id", - "type_name": "ssd_hiiops", - "volume_id": "volume_id", - } - ], - include_prices=True, - ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - @parametrize - async def test_raw_response_list_suitable(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.instances.flavors.with_raw_response.list_suitable( - project_id=0, - region_id=0, - volumes=[{"source": "image"}], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flavor = await response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - @parametrize - async def test_streaming_response_list_suitable(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.instances.flavors.with_streaming_response.list_suitable( - project_id=0, - region_id=0, - volumes=[{"source": "image"}], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flavor = await response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) - - assert cast(Any, response.is_closed) is True From 1131ead332017eadccce3343c4a5ed277c3c51db Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 12:11:11 +0000 Subject: [PATCH 186/592] refactor(cloud)!: remove list suitable from bm flavors --- .stats.yml | 4 +- api.md | 1 - .../resources/cloud/baremetal/flavors.py | 132 +----------------- src/gcore/types/cloud/baremetal/__init__.py | 1 - .../baremetal/flavor_list_suitable_params.py | 22 --- .../cloud/baremetal/test_flavors.py | 90 ------------ 6 files changed, 3 insertions(+), 247 deletions(-) delete mode 100644 src/gcore/types/cloud/baremetal/flavor_list_suitable_params.py diff --git a/.stats.yml b/.stats.yml index 56851965..9651bace 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 300 +configured_endpoints: 299 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3bd81b64cc2ef4de71b6d709296074d203d109fbe6549331480f09fd4412edd4.yml openapi_spec_hash: 4bcd0c3053fcb13e42cf6b0d8244499f -config_hash: 82e3bee0a1a3a3c07cd95fe80e8e2930 +config_hash: 9e417d14176a0e60806f859c2a25ddd7 diff --git a/api.md b/api.md index 2a19927f..a21f7d28 100644 --- a/api.md +++ b/api.md @@ -594,7 +594,6 @@ Methods: Methods: - client.cloud.baremetal.flavors.list(\*, project_id, region_id, \*\*params) -> BaremetalFlavorList -- client.cloud.baremetal.flavors.list_suitable(\*, project_id, region_id, \*\*params) -> BaremetalFlavorList ### Servers diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 5199c40c..1645b30b 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -15,7 +15,7 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.cloud.baremetal import flavor_list_params, flavor_list_suitable_params +from ....types.cloud.baremetal import flavor_list_params from ....types.cloud.baremetal_flavor_list import BaremetalFlavorList __all__ = ["FlavorsResource", "AsyncFlavorsResource"] @@ -114,65 +114,6 @@ def list( cast_to=BaremetalFlavorList, ) - def list_suitable( - self, - *, - project_id: int | None = None, - region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, - apptemplate_id: str | NotGiven = NOT_GIVEN, - image_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BaremetalFlavorList: - """ - List all flavors that are suitable for creating a bare metal server with the - specified image. - - Args: - include_prices: Set to true if flavor listing should include flavor prices - - apptemplate_id: Apptemplate ID - - image_id: Image ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors", - body=maybe_transform( - { - "apptemplate_id": apptemplate_id, - "image_id": image_id, - }, - flavor_list_suitable_params.FlavorListSuitableParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - {"include_prices": include_prices}, flavor_list_suitable_params.FlavorListSuitableParams - ), - ), - cast_to=BaremetalFlavorList, - ) - class AsyncFlavorsResource(AsyncAPIResource): @cached_property @@ -267,65 +208,6 @@ async def list( cast_to=BaremetalFlavorList, ) - async def list_suitable( - self, - *, - project_id: int | None = None, - region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, - apptemplate_id: str | NotGiven = NOT_GIVEN, - image_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BaremetalFlavorList: - """ - List all flavors that are suitable for creating a bare metal server with the - specified image. - - Args: - include_prices: Set to true if flavor listing should include flavor prices - - apptemplate_id: Apptemplate ID - - image_id: Image ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors", - body=await async_maybe_transform( - { - "apptemplate_id": apptemplate_id, - "image_id": image_id, - }, - flavor_list_suitable_params.FlavorListSuitableParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"include_prices": include_prices}, flavor_list_suitable_params.FlavorListSuitableParams - ), - ), - cast_to=BaremetalFlavorList, - ) - class FlavorsResourceWithRawResponse: def __init__(self, flavors: FlavorsResource) -> None: @@ -334,9 +216,6 @@ def __init__(self, flavors: FlavorsResource) -> None: self.list = to_raw_response_wrapper( flavors.list, ) - self.list_suitable = to_raw_response_wrapper( - flavors.list_suitable, - ) class AsyncFlavorsResourceWithRawResponse: @@ -346,9 +225,6 @@ def __init__(self, flavors: AsyncFlavorsResource) -> None: self.list = async_to_raw_response_wrapper( flavors.list, ) - self.list_suitable = async_to_raw_response_wrapper( - flavors.list_suitable, - ) class FlavorsResourceWithStreamingResponse: @@ -358,9 +234,6 @@ def __init__(self, flavors: FlavorsResource) -> None: self.list = to_streamed_response_wrapper( flavors.list, ) - self.list_suitable = to_streamed_response_wrapper( - flavors.list_suitable, - ) class AsyncFlavorsResourceWithStreamingResponse: @@ -370,6 +243,3 @@ def __init__(self, flavors: AsyncFlavorsResource) -> None: self.list = async_to_streamed_response_wrapper( flavors.list, ) - self.list_suitable = async_to_streamed_response_wrapper( - flavors.list_suitable, - ) diff --git a/src/gcore/types/cloud/baremetal/__init__.py b/src/gcore/types/cloud/baremetal/__init__.py index 7cdfa810..5c1e9aea 100644 --- a/src/gcore/types/cloud/baremetal/__init__.py +++ b/src/gcore/types/cloud/baremetal/__init__.py @@ -10,4 +10,3 @@ from .server_rebuild_params import ServerRebuildParams as ServerRebuildParams from .baremetal_fixed_address import BaremetalFixedAddress as BaremetalFixedAddress from .baremetal_floating_address import BaremetalFloatingAddress as BaremetalFloatingAddress -from .flavor_list_suitable_params import FlavorListSuitableParams as FlavorListSuitableParams diff --git a/src/gcore/types/cloud/baremetal/flavor_list_suitable_params.py b/src/gcore/types/cloud/baremetal/flavor_list_suitable_params.py deleted file mode 100644 index ec5beb24..00000000 --- a/src/gcore/types/cloud/baremetal/flavor_list_suitable_params.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["FlavorListSuitableParams"] - - -class FlavorListSuitableParams(TypedDict, total=False): - project_id: int - - region_id: int - - include_prices: bool - """Set to true if flavor listing should include flavor prices""" - - apptemplate_id: str - """Apptemplate ID""" - - image_id: str - """Image ID""" diff --git a/tests/api_resources/cloud/baremetal/test_flavors.py b/tests/api_resources/cloud/baremetal/test_flavors.py index 1778e4f4..18da226a 100644 --- a/tests/api_resources/cloud/baremetal/test_flavors.py +++ b/tests/api_resources/cloud/baremetal/test_flavors.py @@ -65,51 +65,6 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_list_suitable(self, client: Gcore) -> None: - flavor = client.cloud.baremetal.flavors.list_suitable( - project_id=0, - region_id=0, - ) - assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) - - @parametrize - def test_method_list_suitable_with_all_params(self, client: Gcore) -> None: - flavor = client.cloud.baremetal.flavors.list_suitable( - project_id=0, - region_id=0, - include_prices=True, - apptemplate_id="apptemplate_id", - image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", - ) - assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) - - @parametrize - def test_raw_response_list_suitable(self, client: Gcore) -> None: - response = client.cloud.baremetal.flavors.with_raw_response.list_suitable( - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flavor = response.parse() - assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) - - @parametrize - def test_streaming_response_list_suitable(self, client: Gcore) -> None: - with client.cloud.baremetal.flavors.with_streaming_response.list_suitable( - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flavor = response.parse() - assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) - - assert cast(Any, response.is_closed) is True - class TestAsyncFlavors: parametrize = pytest.mark.parametrize( @@ -163,48 +118,3 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_list_suitable(self, async_client: AsyncGcore) -> None: - flavor = await async_client.cloud.baremetal.flavors.list_suitable( - project_id=0, - region_id=0, - ) - assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) - - @parametrize - async def test_method_list_suitable_with_all_params(self, async_client: AsyncGcore) -> None: - flavor = await async_client.cloud.baremetal.flavors.list_suitable( - project_id=0, - region_id=0, - include_prices=True, - apptemplate_id="apptemplate_id", - image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", - ) - assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) - - @parametrize - async def test_raw_response_list_suitable(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.baremetal.flavors.with_raw_response.list_suitable( - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flavor = await response.parse() - assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) - - @parametrize - async def test_streaming_response_list_suitable(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.baremetal.flavors.with_streaming_response.list_suitable( - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - flavor = await response.parse() - assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) - - assert cast(Any, response.is_closed) is True From bf1e2f2677af5da5a99de83c33c7fbc5f2164bd9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Jul 2025 05:28:08 +0000 Subject: [PATCH 187/592] chore(ci): change upload type --- .github/workflows/ci.yml | 18 ++++++++++++++++-- scripts/utils/upload-artifact.sh | 12 +++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b642078b..1cd880c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,10 +35,10 @@ jobs: - name: Run lints run: ./scripts/lint - upload: + build: if: github.repository == 'stainless-sdks/gcore-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) timeout-minutes: 10 - name: upload + name: build permissions: contents: read id-token: write @@ -46,6 +46,20 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Install dependencies + run: rye sync --all-features + + - name: Run build + run: rye build + - name: Get GitHub OIDC Token id: github-oidc uses: actions/github-script@v6 diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh index 6b8632b6..dcb0ac9e 100755 --- a/scripts/utils/upload-artifact.sh +++ b/scripts/utils/upload-artifact.sh @@ -1,7 +1,9 @@ #!/usr/bin/env bash set -exuo pipefail -RESPONSE=$(curl -X POST "$URL" \ +FILENAME=$(basename dist/*.whl) + +RESPONSE=$(curl -X POST "$URL?filename=$FILENAME" \ -H "Authorization: Bearer $AUTH" \ -H "Content-Type: application/json") @@ -12,13 +14,13 @@ if [[ "$SIGNED_URL" == "null" ]]; then exit 1 fi -UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \ - -H "Content-Type: application/gzip" \ - --data-binary @- "$SIGNED_URL" 2>&1) +UPLOAD_RESPONSE=$(curl -v -X PUT \ + -H "Content-Type: binary/octet-stream" \ + --data-binary "@dist/$FILENAME" "$SIGNED_URL" 2>&1) if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then echo -e "\033[32mUploaded build to Stainless storage.\033[0m" - echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/gcore-python/$SHA'\033[0m" + echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/gcore-python/$SHA/$FILENAME'\033[0m" else echo -e "\033[31mFailed to upload artifact.\033[0m" exit 1 From 9f06bf358120eb00975689303fa4380f8e44062a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Jul 2025 08:12:50 +0000 Subject: [PATCH 188/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9651bace..d2d27950 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 299 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3bd81b64cc2ef4de71b6d709296074d203d109fbe6549331480f09fd4412edd4.yml -openapi_spec_hash: 4bcd0c3053fcb13e42cf6b0d8244499f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6de27f3b3373ff39c76710f9e653246118ced81d2a1d0b96a9e78c4a540d9f12.yml +openapi_spec_hash: 9f5702a77532ce5f742965d7d5d15bfe config_hash: 9e417d14176a0e60806f859c2a25ddd7 From dfa5c0ce518138f3f846c6b5f79e1af39714d4a0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Jul 2025 14:10:21 +0000 Subject: [PATCH 189/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- .../resources/cloud/load_balancers/pools/members.py | 8 ++++++-- src/gcore/types/cloud/health_monitor.py | 7 ++++++- src/gcore/types/cloud/load_balancer_create_params.py | 7 ++++++- .../types/cloud/load_balancers/pool_create_params.py | 7 ++++++- .../types/cloud/load_balancers/pool_update_params.py | 7 ++++++- .../cloud/load_balancers/pools/member_add_params.py | 7 ++++++- src/gcore/types/cloud/member.py | 7 ++++++- .../cloud/load_balancers/pools/test_members.py | 4 ++-- .../api_resources/cloud/load_balancers/test_pools.py | 12 ++++++------ tests/api_resources/cloud/test_load_balancers.py | 8 ++++---- 11 files changed, 56 insertions(+), 22 deletions(-) diff --git a/.stats.yml b/.stats.yml index d2d27950..5d3a588f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 299 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6de27f3b3373ff39c76710f9e653246118ced81d2a1d0b96a9e78c4a540d9f12.yml -openapi_spec_hash: 9f5702a77532ce5f742965d7d5d15bfe +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a3eb777ed002489583f1ec680d7ac5638c4bf54a843d381a1c1ad5d1c9f5e967.yml +openapi_spec_hash: 3e4993495b21ba44b2969cc41cdb1221 config_hash: 9e417d14176a0e60806f859c2a25ddd7 diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 5e05941f..4f5f236a 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -78,7 +78,9 @@ def add( protocol_port: Member IP port - admin_state_up: true if enabled. Defaults to true + admin_state_up: Administrative state of the resource. When set to true, the resource is enabled + and operational. When set to false, the resource is disabled and will not + process traffic. When null is passed, the value is skipped and defaults to true. instance_id: Either `subnet_id` or `instance_id` should be provided @@ -233,7 +235,9 @@ async def add( protocol_port: Member IP port - admin_state_up: true if enabled. Defaults to true + admin_state_up: Administrative state of the resource. When set to true, the resource is enabled + and operational. When set to false, the resource is disabled and will not + process traffic. When null is passed, the value is skipped and defaults to true. instance_id: Either `subnet_id` or `instance_id` should be provided diff --git a/src/gcore/types/cloud/health_monitor.py b/src/gcore/types/cloud/health_monitor.py index 25303572..85674aa9 100644 --- a/src/gcore/types/cloud/health_monitor.py +++ b/src/gcore/types/cloud/health_monitor.py @@ -16,7 +16,12 @@ class HealthMonitor(BaseModel): """Health monitor ID""" admin_state_up: bool - """true if enabled. Defaults to true""" + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. When null is passed, the + value is skipped and defaults to true. + """ delay: int """The time, in seconds, between sending probes to members""" diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 6d1739de..5ce1b76a 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -174,7 +174,12 @@ class ListenerPoolMember(TypedDict, total=False): """Member IP port""" admin_state_up: Optional[bool] - """true if enabled. Defaults to true""" + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. When null is passed, the + value is skipped and defaults to true. + """ instance_id: Optional[str] """Either `subnet_id` or `instance_id` should be provided""" 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 200c0f1d..4cf1b7c2 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -105,7 +105,12 @@ class Member(TypedDict, total=False): """Member IP port""" admin_state_up: Optional[bool] - """true if enabled. Defaults to true""" + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. When null is passed, the + value is skipped and defaults to true. + """ instance_id: Optional[str] """Either `subnet_id` or `instance_id` should be provided""" 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 d02fa244..7d851e8f 100644 --- a/src/gcore/types/cloud/load_balancers/pool_update_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_update_params.py @@ -103,7 +103,12 @@ class Member(TypedDict, total=False): """Member IP port""" admin_state_up: Optional[bool] - """true if enabled. Defaults to true""" + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. When null is passed, the + value is skipped and defaults to true. + """ instance_id: Optional[str] """Either `subnet_id` or `instance_id` should be provided""" diff --git a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py index 341128b5..e14dca71 100644 --- a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py @@ -22,7 +22,12 @@ class MemberAddParams(TypedDict, total=False): """Member IP port""" admin_state_up: Optional[bool] - """true if enabled. Defaults to true""" + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. When null is passed, the + value is skipped and defaults to true. + """ instance_id: Optional[str] """Either `subnet_id` or `instance_id` should be provided""" diff --git a/src/gcore/types/cloud/member.py b/src/gcore/types/cloud/member.py index edcda79f..144a0eab 100644 --- a/src/gcore/types/cloud/member.py +++ b/src/gcore/types/cloud/member.py @@ -17,7 +17,12 @@ class Member(BaseModel): """Member IP address""" admin_state_up: bool - """true if enabled. Defaults to true""" + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. When null is passed, the + value is skipped and defaults to true. + """ operating_status: LoadBalancerOperatingStatus """Member operating status of the entity""" 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 3b32b30c..151b9304 100644 --- a/tests/api_resources/cloud/load_balancers/pools/test_members.py +++ b/tests/api_resources/cloud/load_balancers/pools/test_members.py @@ -36,7 +36,7 @@ def test_method_add_with_all_params(self, client: Gcore) -> None: region_id=1, address="192.168.40.33", protocol_port=80, - admin_state_up=False, + admin_state_up=True, instance_id="a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", monitor_address="monitor_address", monitor_port=0, @@ -171,7 +171,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> Non region_id=1, address="192.168.40.33", protocol_port=80, - admin_state_up=False, + admin_state_up=True, instance_id="a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", monitor_address="monitor_address", monitor_port=0, diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py index 004e5dd3..edd9b1be 100644 --- a/tests/api_resources/cloud/load_balancers/test_pools.py +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -54,7 +54,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: { "address": "192.168.1.101", "protocol_port": 8000, - "admin_state_up": False, + "admin_state_up": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", "monitor_port": 0, @@ -64,7 +64,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: { "address": "192.168.1.102", "protocol_port": 8000, - "admin_state_up": False, + "admin_state_up": True, "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", "monitor_address": "monitor_address", "monitor_port": 0, @@ -149,7 +149,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: { "address": "192.168.40.33", "protocol_port": 80, - "admin_state_up": False, + "admin_state_up": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", "monitor_port": 0, @@ -389,7 +389,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> { "address": "192.168.1.101", "protocol_port": 8000, - "admin_state_up": False, + "admin_state_up": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", "monitor_port": 0, @@ -399,7 +399,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> { "address": "192.168.1.102", "protocol_port": 8000, - "admin_state_up": False, + "admin_state_up": True, "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", "monitor_address": "monitor_address", "monitor_port": 0, @@ -484,7 +484,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> { "address": "192.168.40.33", "protocol_port": 80, - "admin_state_up": False, + "admin_state_up": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", "monitor_port": 0, diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index 3a61a657..fa8ddb3d 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -70,7 +70,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: { "address": "192.168.1.101", "protocol_port": 8000, - "admin_state_up": False, + "admin_state_up": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", "monitor_port": 0, @@ -80,7 +80,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: { "address": "192.168.1.102", "protocol_port": 8000, - "admin_state_up": False, + "admin_state_up": True, "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", "monitor_address": "monitor_address", "monitor_port": 0, @@ -536,7 +536,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> { "address": "192.168.1.101", "protocol_port": 8000, - "admin_state_up": False, + "admin_state_up": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", "monitor_port": 0, @@ -546,7 +546,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> { "address": "192.168.1.102", "protocol_port": 8000, - "admin_state_up": False, + "admin_state_up": True, "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", "monitor_address": "monitor_address", "monitor_port": 0, From 7b212e096ffca2c6e7590e80b61a631ed3909977 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Jul 2025 09:23:18 +0000 Subject: [PATCH 190/592] feat(iam): add IAM --- .stats.yml | 4 +- api.md | 43 ++ src/gcore/_client.py | 9 + src/gcore/pagination.py | 62 +- src/gcore/resources/__init__.py | 14 + src/gcore/resources/iam/__init__.py | 47 ++ src/gcore/resources/iam/api_tokens.py | 521 ++++++++++++++ src/gcore/resources/iam/iam.py | 199 ++++++ src/gcore/resources/iam/users.py | 642 ++++++++++++++++++ src/gcore/types/iam/__init__.py | 17 + src/gcore/types/iam/account_overview.py | 488 +++++++++++++ src/gcore/types/iam/api_token.py | 78 +++ src/gcore/types/iam/api_token_create.py | 15 + .../types/iam/api_token_create_params.py | 42 ++ src/gcore/types/iam/api_token_list.py | 81 +++ src/gcore/types/iam/api_token_list_params.py | 41 ++ src/gcore/types/iam/user.py | 86 +++ src/gcore/types/iam/user_detailed.py | 104 +++ src/gcore/types/iam/user_invite.py | 15 + src/gcore/types/iam/user_invite_params.py | 37 + src/gcore/types/iam/user_list_params.py | 15 + src/gcore/types/iam/user_update.py | 104 +++ src/gcore/types/iam/user_update_params.py | 52 ++ tests/api_resources/iam/__init__.py | 1 + tests/api_resources/iam/test_api_tokens.py | 356 ++++++++++ tests/api_resources/iam/test_users.py | 428 ++++++++++++ tests/api_resources/test_iam.py | 74 ++ 27 files changed, 3572 insertions(+), 3 deletions(-) create mode 100644 src/gcore/resources/iam/__init__.py create mode 100644 src/gcore/resources/iam/api_tokens.py create mode 100644 src/gcore/resources/iam/iam.py create mode 100644 src/gcore/resources/iam/users.py create mode 100644 src/gcore/types/iam/__init__.py create mode 100644 src/gcore/types/iam/account_overview.py create mode 100644 src/gcore/types/iam/api_token.py create mode 100644 src/gcore/types/iam/api_token_create.py create mode 100644 src/gcore/types/iam/api_token_create_params.py create mode 100644 src/gcore/types/iam/api_token_list.py create mode 100644 src/gcore/types/iam/api_token_list_params.py create mode 100644 src/gcore/types/iam/user.py create mode 100644 src/gcore/types/iam/user_detailed.py create mode 100644 src/gcore/types/iam/user_invite.py create mode 100644 src/gcore/types/iam/user_invite_params.py create mode 100644 src/gcore/types/iam/user_list_params.py create mode 100644 src/gcore/types/iam/user_update.py create mode 100644 src/gcore/types/iam/user_update_params.py create mode 100644 tests/api_resources/iam/__init__.py create mode 100644 tests/api_resources/iam/test_api_tokens.py create mode 100644 tests/api_resources/iam/test_users.py create mode 100644 tests/api_resources/test_iam.py diff --git a/.stats.yml b/.stats.yml index 5d3a588f..f6858de3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 299 +configured_endpoints: 309 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a3eb777ed002489583f1ec680d7ac5638c4bf54a843d381a1c1ad5d1c9f5e967.yml openapi_spec_hash: 3e4993495b21ba44b2969cc41cdb1221 -config_hash: 9e417d14176a0e60806f859c2a25ddd7 +config_hash: 708e4dbf0025978d06dedb02b94647a3 diff --git a/api.md b/api.md index a21f7d28..040eb35c 100644 --- a/api.md +++ b/api.md @@ -1156,3 +1156,46 @@ Methods: - client.waap.ip_info.get_top_urls(\*\*params) -> IPInfoGetTopURLsResponse - client.waap.ip_info.get_top_user_agents(\*\*params) -> IPInfoGetTopUserAgentsResponse - client.waap.ip_info.list_attacked_countries(\*\*params) -> IPInfoListAttackedCountriesResponse + +# Iam + +Types: + +```python +from gcore.types.iam import AccountOverview +``` + +Methods: + +- client.iam.get_account_overview() -> AccountOverview + +## APITokens + +Types: + +```python +from gcore.types.iam import APIToken, APITokenCreate, APITokenList +``` + +Methods: + +- client.iam.api_tokens.create(client_id, \*\*params) -> APITokenCreate +- client.iam.api_tokens.list(client_id, \*\*params) -> APITokenList +- client.iam.api_tokens.delete(token_id, \*, client_id) -> None +- client.iam.api_tokens.get(token_id, \*, client_id) -> APIToken + +## Users + +Types: + +```python +from gcore.types.iam import User, UserDetailed, UserInvite, UserUpdate +``` + +Methods: + +- client.iam.users.update(user_id, \*\*params) -> UserUpdate +- client.iam.users.list(\*\*params) -> SyncOffsetPageIam[User] +- client.iam.users.delete(user_id, \*, client_id) -> None +- client.iam.users.get(user_id) -> UserDetailed +- client.iam.users.invite(\*\*params) -> UserInvite diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 009df272..05954d6f 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -28,6 +28,7 @@ SyncAPIClient, AsyncAPIClient, ) +from .resources.iam import iam from .resources.waap import waap from .resources.cloud import cloud @@ -37,6 +38,7 @@ class Gcore(SyncAPIClient): cloud: cloud.CloudResource waap: waap.WaapResource + iam: iam.IamResource with_raw_response: GcoreWithRawResponse with_streaming_response: GcoreWithStreamedResponse @@ -117,6 +119,7 @@ def __init__( self.cloud = cloud.CloudResource(self) self.waap = waap.WaapResource(self) + self.iam = iam.IamResource(self) self.with_raw_response = GcoreWithRawResponse(self) self.with_streaming_response = GcoreWithStreamedResponse(self) @@ -252,6 +255,7 @@ def _make_status_error( class AsyncGcore(AsyncAPIClient): cloud: cloud.AsyncCloudResource waap: waap.AsyncWaapResource + iam: iam.AsyncIamResource with_raw_response: AsyncGcoreWithRawResponse with_streaming_response: AsyncGcoreWithStreamedResponse @@ -332,6 +336,7 @@ def __init__( self.cloud = cloud.AsyncCloudResource(self) self.waap = waap.AsyncWaapResource(self) + self.iam = iam.AsyncIamResource(self) self.with_raw_response = AsyncGcoreWithRawResponse(self) self.with_streaming_response = AsyncGcoreWithStreamedResponse(self) @@ -468,24 +473,28 @@ class GcoreWithRawResponse: def __init__(self, client: Gcore) -> None: self.cloud = cloud.CloudResourceWithRawResponse(client.cloud) self.waap = waap.WaapResourceWithRawResponse(client.waap) + self.iam = iam.IamResourceWithRawResponse(client.iam) class AsyncGcoreWithRawResponse: def __init__(self, client: AsyncGcore) -> None: self.cloud = cloud.AsyncCloudResourceWithRawResponse(client.cloud) self.waap = waap.AsyncWaapResourceWithRawResponse(client.waap) + self.iam = iam.AsyncIamResourceWithRawResponse(client.iam) class GcoreWithStreamedResponse: def __init__(self, client: Gcore) -> None: self.cloud = cloud.CloudResourceWithStreamingResponse(client.cloud) self.waap = waap.WaapResourceWithStreamingResponse(client.waap) + self.iam = iam.IamResourceWithStreamingResponse(client.iam) class AsyncGcoreWithStreamedResponse: def __init__(self, client: AsyncGcore) -> None: self.cloud = cloud.AsyncCloudResourceWithStreamingResponse(client.cloud) self.waap = waap.AsyncWaapResourceWithStreamingResponse(client.waap) + self.iam = iam.AsyncIamResourceWithStreamingResponse(client.iam) Client = Gcore diff --git a/src/gcore/pagination.py b/src/gcore/pagination.py index cf967212..870a0d3a 100644 --- a/src/gcore/pagination.py +++ b/src/gcore/pagination.py @@ -5,7 +5,7 @@ from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage -__all__ = ["SyncOffsetPage", "AsyncOffsetPage"] +__all__ = ["SyncOffsetPage", "AsyncOffsetPage", "SyncOffsetPageIam", "AsyncOffsetPageIam"] _T = TypeVar("_T") @@ -68,3 +68,63 @@ def next_page_info(self) -> Optional[PageInfo]: return PageInfo(params={"offset": current_count}) return None + + +class SyncOffsetPageIam(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + result: List[_T] + count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + result = self.result + if not result: + return [] + return result + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + count = self.count + if count is None: + return None + + if current_count < count: + return PageInfo(params={"offset": current_count}) + + return None + + +class AsyncOffsetPageIam(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + result: List[_T] + count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + result = self.result + if not result: + return [] + return result + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + count = self.count + if count is None: + return None + + if current_count < count: + return PageInfo(params={"offset": current_count}) + + return None diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py index 502dad77..ed8fc7da 100644 --- a/src/gcore/resources/__init__.py +++ b/src/gcore/resources/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .iam import ( + IamResource, + AsyncIamResource, + IamResourceWithRawResponse, + AsyncIamResourceWithRawResponse, + IamResourceWithStreamingResponse, + AsyncIamResourceWithStreamingResponse, +) from .waap import ( WaapResource, AsyncWaapResource, @@ -30,4 +38,10 @@ "AsyncWaapResourceWithRawResponse", "WaapResourceWithStreamingResponse", "AsyncWaapResourceWithStreamingResponse", + "IamResource", + "AsyncIamResource", + "IamResourceWithRawResponse", + "AsyncIamResourceWithRawResponse", + "IamResourceWithStreamingResponse", + "AsyncIamResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/iam/__init__.py b/src/gcore/resources/iam/__init__.py new file mode 100644 index 00000000..e8a7c852 --- /dev/null +++ b/src/gcore/resources/iam/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .iam import ( + IamResource, + AsyncIamResource, + IamResourceWithRawResponse, + AsyncIamResourceWithRawResponse, + IamResourceWithStreamingResponse, + AsyncIamResourceWithStreamingResponse, +) +from .users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) +from .api_tokens import ( + APITokensResource, + AsyncAPITokensResource, + APITokensResourceWithRawResponse, + AsyncAPITokensResourceWithRawResponse, + APITokensResourceWithStreamingResponse, + AsyncAPITokensResourceWithStreamingResponse, +) + +__all__ = [ + "APITokensResource", + "AsyncAPITokensResource", + "APITokensResourceWithRawResponse", + "AsyncAPITokensResourceWithRawResponse", + "APITokensResourceWithStreamingResponse", + "AsyncAPITokensResourceWithStreamingResponse", + "UsersResource", + "AsyncUsersResource", + "UsersResourceWithRawResponse", + "AsyncUsersResourceWithRawResponse", + "UsersResourceWithStreamingResponse", + "AsyncUsersResourceWithStreamingResponse", + "IamResource", + "AsyncIamResource", + "IamResourceWithRawResponse", + "AsyncIamResourceWithRawResponse", + "IamResourceWithStreamingResponse", + "AsyncIamResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py new file mode 100644 index 00000000..ecd59cb6 --- /dev/null +++ b/src/gcore/resources/iam/api_tokens.py @@ -0,0 +1,521 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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.iam import api_token_list_params, api_token_create_params +from ..._base_client import make_request_options +from ...types.iam.api_token import APIToken +from ...types.iam.api_token_list import APITokenList +from ...types.iam.api_token_create import APITokenCreate + +__all__ = ["APITokensResource", "AsyncAPITokensResource"] + + +class APITokensResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> APITokensResourceWithRawResponse: + """ + 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 APITokensResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> APITokensResourceWithStreamingResponse: + """ + 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 APITokensResourceWithStreamingResponse(self) + + def create( + self, + client_id: int, + *, + client_user: api_token_create_params.ClientUser, + exp_date: str, + name: str, + description: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> APITokenCreate: + """ + Create an API token in the current account. + + Args: + client_user: API token role. + + exp_date: Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If + null, then the API token will never expire. + + name: API token name. + + description: API token description. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/iam/clients/{client_id}/tokens", + body=maybe_transform( + { + "client_user": client_user, + "exp_date": exp_date, + "name": name, + "description": description, + }, + api_token_create_params.APITokenCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APITokenCreate, + ) + + def list( + self, + client_id: int, + *, + deleted: bool | NotGiven = NOT_GIVEN, + issued_by: int | NotGiven = NOT_GIVEN, + not_issued_by: int | NotGiven = NOT_GIVEN, + role: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> APITokenList: + """Get information about your permanent API tokens in the account. + + A user with the + Administrators role gets information about all API tokens in the account. + + Args: + deleted: The state of API tokens included in the response. + Two possible values: + + - True - API token was not deleted.\\** False - API token was deleted. + + Example, _&deleted=True_ + + issued_by: User's ID. Use to get API tokens issued by a particular user. + Example, _&`issued_by`=1234_ + + not_issued_by: User's ID. Use to get API tokens issued by anyone except a particular user. + Example, _¬_issued_by=1234_ + + role: + Group's ID. Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + + Example, _&role=Engineers_ + + 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"/iam/clients/{client_id}/tokens", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "deleted": deleted, + "issued_by": issued_by, + "not_issued_by": not_issued_by, + "role": role, + }, + api_token_list_params.APITokenListParams, + ), + ), + cast_to=APITokenList, + ) + + def delete( + self, + token_id: int, + *, + client_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Delete API token from current account. + + Ensure that the API token is not being + used by an active application. After deleting the token, all applications that + use this token will not be able to get access to your account via API. The + action cannot be reversed. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/iam/clients/{client_id}/tokens/{token_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + token_id: int, + *, + client_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, + ) -> APIToken: + """ + Get API Token + + 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"/iam/clients/{client_id}/tokens/{token_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIToken, + ) + + +class AsyncAPITokensResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAPITokensResourceWithRawResponse: + """ + 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 AsyncAPITokensResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAPITokensResourceWithStreamingResponse: + """ + 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 AsyncAPITokensResourceWithStreamingResponse(self) + + async def create( + self, + client_id: int, + *, + client_user: api_token_create_params.ClientUser, + exp_date: str, + name: str, + description: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> APITokenCreate: + """ + Create an API token in the current account. + + Args: + client_user: API token role. + + exp_date: Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If + null, then the API token will never expire. + + name: API token name. + + description: API token description. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/iam/clients/{client_id}/tokens", + body=await async_maybe_transform( + { + "client_user": client_user, + "exp_date": exp_date, + "name": name, + "description": description, + }, + api_token_create_params.APITokenCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APITokenCreate, + ) + + async def list( + self, + client_id: int, + *, + deleted: bool | NotGiven = NOT_GIVEN, + issued_by: int | NotGiven = NOT_GIVEN, + not_issued_by: int | NotGiven = NOT_GIVEN, + role: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> APITokenList: + """Get information about your permanent API tokens in the account. + + A user with the + Administrators role gets information about all API tokens in the account. + + Args: + deleted: The state of API tokens included in the response. + Two possible values: + + - True - API token was not deleted.\\** False - API token was deleted. + + Example, _&deleted=True_ + + issued_by: User's ID. Use to get API tokens issued by a particular user. + Example, _&`issued_by`=1234_ + + not_issued_by: User's ID. Use to get API tokens issued by anyone except a particular user. + Example, _¬_issued_by=1234_ + + role: + Group's ID. Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + + Example, _&role=Engineers_ + + 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"/iam/clients/{client_id}/tokens", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "deleted": deleted, + "issued_by": issued_by, + "not_issued_by": not_issued_by, + "role": role, + }, + api_token_list_params.APITokenListParams, + ), + ), + cast_to=APITokenList, + ) + + async def delete( + self, + token_id: int, + *, + client_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Delete API token from current account. + + Ensure that the API token is not being + used by an active application. After deleting the token, all applications that + use this token will not be able to get access to your account via API. The + action cannot be reversed. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/iam/clients/{client_id}/tokens/{token_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + token_id: int, + *, + client_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, + ) -> APIToken: + """ + Get API Token + + 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"/iam/clients/{client_id}/tokens/{token_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=APIToken, + ) + + +class APITokensResourceWithRawResponse: + def __init__(self, api_tokens: APITokensResource) -> None: + self._api_tokens = api_tokens + + self.create = to_raw_response_wrapper( + api_tokens.create, + ) + self.list = to_raw_response_wrapper( + api_tokens.list, + ) + self.delete = to_raw_response_wrapper( + api_tokens.delete, + ) + self.get = to_raw_response_wrapper( + api_tokens.get, + ) + + +class AsyncAPITokensResourceWithRawResponse: + def __init__(self, api_tokens: AsyncAPITokensResource) -> None: + self._api_tokens = api_tokens + + self.create = async_to_raw_response_wrapper( + api_tokens.create, + ) + self.list = async_to_raw_response_wrapper( + api_tokens.list, + ) + self.delete = async_to_raw_response_wrapper( + api_tokens.delete, + ) + self.get = async_to_raw_response_wrapper( + api_tokens.get, + ) + + +class APITokensResourceWithStreamingResponse: + def __init__(self, api_tokens: APITokensResource) -> None: + self._api_tokens = api_tokens + + self.create = to_streamed_response_wrapper( + api_tokens.create, + ) + self.list = to_streamed_response_wrapper( + api_tokens.list, + ) + self.delete = to_streamed_response_wrapper( + api_tokens.delete, + ) + self.get = to_streamed_response_wrapper( + api_tokens.get, + ) + + +class AsyncAPITokensResourceWithStreamingResponse: + def __init__(self, api_tokens: AsyncAPITokensResource) -> None: + self._api_tokens = api_tokens + + self.create = async_to_streamed_response_wrapper( + api_tokens.create, + ) + self.list = async_to_streamed_response_wrapper( + api_tokens.list, + ) + self.delete = async_to_streamed_response_wrapper( + api_tokens.delete, + ) + self.get = async_to_streamed_response_wrapper( + api_tokens.get, + ) diff --git a/src/gcore/resources/iam/iam.py b/src/gcore/resources/iam/iam.py new file mode 100644 index 00000000..54b4653f --- /dev/null +++ b/src/gcore/resources/iam/iam.py @@ -0,0 +1,199 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .users import ( + UsersResource, + AsyncUsersResource, + UsersResourceWithRawResponse, + AsyncUsersResourceWithRawResponse, + UsersResourceWithStreamingResponse, + AsyncUsersResourceWithStreamingResponse, +) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from .api_tokens import ( + APITokensResource, + AsyncAPITokensResource, + APITokensResourceWithRawResponse, + AsyncAPITokensResourceWithRawResponse, + APITokensResourceWithStreamingResponse, + AsyncAPITokensResourceWithStreamingResponse, +) +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.iam.account_overview import AccountOverview + +__all__ = ["IamResource", "AsyncIamResource"] + + +class IamResource(SyncAPIResource): + @cached_property + def api_tokens(self) -> APITokensResource: + return APITokensResource(self._client) + + @cached_property + def users(self) -> UsersResource: + return UsersResource(self._client) + + @cached_property + def with_raw_response(self) -> IamResourceWithRawResponse: + """ + 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 IamResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> IamResourceWithStreamingResponse: + """ + 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 IamResourceWithStreamingResponse(self) + + def get_account_overview( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AccountOverview: + """Get information about your profile, users and other account details.""" + return self._get( + "/iam/clients/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AccountOverview, + ) + + +class AsyncIamResource(AsyncAPIResource): + @cached_property + def api_tokens(self) -> AsyncAPITokensResource: + return AsyncAPITokensResource(self._client) + + @cached_property + def users(self) -> AsyncUsersResource: + return AsyncUsersResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncIamResourceWithRawResponse: + """ + 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 AsyncIamResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncIamResourceWithStreamingResponse: + """ + 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 AsyncIamResourceWithStreamingResponse(self) + + async def get_account_overview( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AccountOverview: + """Get information about your profile, users and other account details.""" + return await self._get( + "/iam/clients/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AccountOverview, + ) + + +class IamResourceWithRawResponse: + def __init__(self, iam: IamResource) -> None: + self._iam = iam + + self.get_account_overview = to_raw_response_wrapper( + iam.get_account_overview, + ) + + @cached_property + def api_tokens(self) -> APITokensResourceWithRawResponse: + return APITokensResourceWithRawResponse(self._iam.api_tokens) + + @cached_property + def users(self) -> UsersResourceWithRawResponse: + return UsersResourceWithRawResponse(self._iam.users) + + +class AsyncIamResourceWithRawResponse: + def __init__(self, iam: AsyncIamResource) -> None: + self._iam = iam + + self.get_account_overview = async_to_raw_response_wrapper( + iam.get_account_overview, + ) + + @cached_property + def api_tokens(self) -> AsyncAPITokensResourceWithRawResponse: + return AsyncAPITokensResourceWithRawResponse(self._iam.api_tokens) + + @cached_property + def users(self) -> AsyncUsersResourceWithRawResponse: + return AsyncUsersResourceWithRawResponse(self._iam.users) + + +class IamResourceWithStreamingResponse: + def __init__(self, iam: IamResource) -> None: + self._iam = iam + + self.get_account_overview = to_streamed_response_wrapper( + iam.get_account_overview, + ) + + @cached_property + def api_tokens(self) -> APITokensResourceWithStreamingResponse: + return APITokensResourceWithStreamingResponse(self._iam.api_tokens) + + @cached_property + def users(self) -> UsersResourceWithStreamingResponse: + return UsersResourceWithStreamingResponse(self._iam.users) + + +class AsyncIamResourceWithStreamingResponse: + def __init__(self, iam: AsyncIamResource) -> None: + self._iam = iam + + self.get_account_overview = async_to_streamed_response_wrapper( + iam.get_account_overview, + ) + + @cached_property + def api_tokens(self) -> AsyncAPITokensResourceWithStreamingResponse: + return AsyncAPITokensResourceWithStreamingResponse(self._iam.api_tokens) + + @cached_property + def users(self) -> AsyncUsersResourceWithStreamingResponse: + return AsyncUsersResourceWithStreamingResponse(self._iam.users) diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py new file mode 100644 index 00000000..8ba9d6de --- /dev/null +++ b/src/gcore/resources/iam/users.py @@ -0,0 +1,642 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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.iam import user_list_params, user_invite_params, user_update_params +from ...pagination import SyncOffsetPageIam, AsyncOffsetPageIam +from ..._base_client import AsyncPaginator, make_request_options +from ...types.iam.user import User +from ...types.iam.user_invite import UserInvite +from ...types.iam.user_update import UserUpdate +from ...types.iam.user_detailed import UserDetailed + +__all__ = ["UsersResource", "AsyncUsersResource"] + + +class UsersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> UsersResourceWithRawResponse: + """ + 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 UsersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> UsersResourceWithStreamingResponse: + """ + 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 UsersResourceWithStreamingResponse(self) + + def update( + self, + user_id: int, + *, + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | NotGiven = NOT_GIVEN, + company: str | NotGiven = NOT_GIVEN, + email: str | NotGiven = NOT_GIVEN, + groups: Iterable[user_update_params.Group] | NotGiven = NOT_GIVEN, + lang: Literal["de", "en", "ru", "zh", "az"] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + phone: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UserUpdate: + """This method updates user's details. + + Args: + auth_types: System field. + + List of auth types available for the account. + + company: User's company. + + email: User's email address. + + groups: + User's group in the current account. IAM supports 5 groups: + + - Users + - Administrators + - Engineers + - Purge and Prefetch only (API) + - Purge and Prefetch only (API+Web) + + lang: User's language. Defines language of the control panel and email messages. + + name: User's name. + + phone: User's phone. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/iam/users/{user_id}", + body=maybe_transform( + { + "auth_types": auth_types, + "company": company, + "email": email, + "groups": groups, + "lang": lang, + "name": name, + "phone": phone, + }, + user_update_params.UserUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=UserUpdate, + ) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPageIam[User]: + """Get a list of users. + + Pass a value for the `limit` parameter in your request if + you want retrieve a paginated result. Otherwise API returns a list with all + users without pagination. + + Args: + limit: The maximum number of items. + + offset: Offset relative to the beginning of list. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/iam/users", + page=SyncOffsetPageIam[User], + 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, + }, + user_list_params.UserListParams, + ), + ), + model=User, + ) + + def delete( + self, + user_id: int, + *, + client_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Revokes user's access to the specified account. + + If the specified user doesn't + have access to multiple accounts, the user is deleted. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/iam/clients/{client_id}/client-users/{user_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + user_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, + ) -> UserDetailed: + """ + Get user's details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/iam/users/{user_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=UserDetailed, + ) + + def invite( + self, + *, + client_id: int, + email: str, + user_role: user_invite_params.UserRole, + lang: Literal["de", "en", "ru", "zh", "az"] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UserInvite: + """Invite a user to the account. + + User will receive an email. The new user will + receive an invitation email with a link to create an account password, the + existing user will be notified about the invitation to the account. + + Args: + client_id: ID of account. + + email: User email. + + lang: User's language. Defines language of the control panel and email messages. + + name: User name. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/iam/clients/invite_user", + body=maybe_transform( + { + "client_id": client_id, + "email": email, + "user_role": user_role, + "lang": lang, + "name": name, + }, + user_invite_params.UserInviteParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=UserInvite, + ) + + +class AsyncUsersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: + """ + 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 AsyncUsersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: + """ + 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 AsyncUsersResourceWithStreamingResponse(self) + + async def update( + self, + user_id: int, + *, + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | NotGiven = NOT_GIVEN, + company: str | NotGiven = NOT_GIVEN, + email: str | NotGiven = NOT_GIVEN, + groups: Iterable[user_update_params.Group] | NotGiven = NOT_GIVEN, + lang: Literal["de", "en", "ru", "zh", "az"] | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + phone: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UserUpdate: + """This method updates user's details. + + Args: + auth_types: System field. + + List of auth types available for the account. + + company: User's company. + + email: User's email address. + + groups: + User's group in the current account. IAM supports 5 groups: + + - Users + - Administrators + - Engineers + - Purge and Prefetch only (API) + - Purge and Prefetch only (API+Web) + + lang: User's language. Defines language of the control panel and email messages. + + name: User's name. + + phone: User's phone. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/iam/users/{user_id}", + body=await async_maybe_transform( + { + "auth_types": auth_types, + "company": company, + "email": email, + "groups": groups, + "lang": lang, + "name": name, + "phone": phone, + }, + user_update_params.UserUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=UserUpdate, + ) + + def list( + self, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[User, AsyncOffsetPageIam[User]]: + """Get a list of users. + + Pass a value for the `limit` parameter in your request if + you want retrieve a paginated result. Otherwise API returns a list with all + users without pagination. + + Args: + limit: The maximum number of items. + + offset: Offset relative to the beginning of list. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/iam/users", + page=AsyncOffsetPageIam[User], + 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, + }, + user_list_params.UserListParams, + ), + ), + model=User, + ) + + async def delete( + self, + user_id: int, + *, + client_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Revokes user's access to the specified account. + + If the specified user doesn't + have access to multiple accounts, the user is deleted. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/iam/clients/{client_id}/client-users/{user_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + user_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, + ) -> UserDetailed: + """ + Get user's details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/iam/users/{user_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=UserDetailed, + ) + + async def invite( + self, + *, + client_id: int, + email: str, + user_role: user_invite_params.UserRole, + lang: Literal["de", "en", "ru", "zh", "az"] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UserInvite: + """Invite a user to the account. + + User will receive an email. The new user will + receive an invitation email with a link to create an account password, the + existing user will be notified about the invitation to the account. + + Args: + client_id: ID of account. + + email: User email. + + lang: User's language. Defines language of the control panel and email messages. + + name: User name. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/iam/clients/invite_user", + body=await async_maybe_transform( + { + "client_id": client_id, + "email": email, + "user_role": user_role, + "lang": lang, + "name": name, + }, + user_invite_params.UserInviteParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=UserInvite, + ) + + +class UsersResourceWithRawResponse: + def __init__(self, users: UsersResource) -> None: + self._users = users + + self.update = to_raw_response_wrapper( + users.update, + ) + self.list = to_raw_response_wrapper( + users.list, + ) + self.delete = to_raw_response_wrapper( + users.delete, + ) + self.get = to_raw_response_wrapper( + users.get, + ) + self.invite = to_raw_response_wrapper( + users.invite, + ) + + +class AsyncUsersResourceWithRawResponse: + def __init__(self, users: AsyncUsersResource) -> None: + self._users = users + + self.update = async_to_raw_response_wrapper( + users.update, + ) + self.list = async_to_raw_response_wrapper( + users.list, + ) + self.delete = async_to_raw_response_wrapper( + users.delete, + ) + self.get = async_to_raw_response_wrapper( + users.get, + ) + self.invite = async_to_raw_response_wrapper( + users.invite, + ) + + +class UsersResourceWithStreamingResponse: + def __init__(self, users: UsersResource) -> None: + self._users = users + + self.update = to_streamed_response_wrapper( + users.update, + ) + self.list = to_streamed_response_wrapper( + users.list, + ) + self.delete = to_streamed_response_wrapper( + users.delete, + ) + self.get = to_streamed_response_wrapper( + users.get, + ) + self.invite = to_streamed_response_wrapper( + users.invite, + ) + + +class AsyncUsersResourceWithStreamingResponse: + def __init__(self, users: AsyncUsersResource) -> None: + self._users = users + + self.update = async_to_streamed_response_wrapper( + users.update, + ) + self.list = async_to_streamed_response_wrapper( + users.list, + ) + self.delete = async_to_streamed_response_wrapper( + users.delete, + ) + self.get = async_to_streamed_response_wrapper( + users.get, + ) + self.invite = async_to_streamed_response_wrapper( + users.invite, + ) diff --git a/src/gcore/types/iam/__init__.py b/src/gcore/types/iam/__init__.py new file mode 100644 index 00000000..ad8745f0 --- /dev/null +++ b/src/gcore/types/iam/__init__.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .user import User as User +from .api_token import APIToken as APIToken +from .user_invite import UserInvite as UserInvite +from .user_update import UserUpdate as UserUpdate +from .user_detailed import UserDetailed as UserDetailed +from .api_token_list import APITokenList as APITokenList +from .account_overview import AccountOverview as AccountOverview +from .api_token_create import APITokenCreate as APITokenCreate +from .user_list_params import UserListParams as UserListParams +from .user_invite_params import UserInviteParams as UserInviteParams +from .user_update_params import UserUpdateParams as UserUpdateParams +from .api_token_list_params import APITokenListParams as APITokenListParams +from .api_token_create_params import APITokenCreateParams as APITokenCreateParams diff --git a/src/gcore/types/iam/account_overview.py b/src/gcore/types/iam/account_overview.py new file mode 100644 index 00000000..0f30b80b --- /dev/null +++ b/src/gcore/types/iam/account_overview.py @@ -0,0 +1,488 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "AccountOverview", + "FreeFeatures", + "FreeFeaturesCdn", + "FreeFeaturesCloud", + "FreeFeaturesDDOS", + "FreeFeaturesDNS", + "FreeFeaturesStorage", + "FreeFeaturesStreaming", + "PaidFeatures", + "PaidFeaturesCdn", + "PaidFeaturesCloud", + "PaidFeaturesDDOS", + "PaidFeaturesDNS", + "PaidFeaturesStorage", + "PaidFeaturesStreaming", + "ServiceStatuses", + "ServiceStatusesCdn", + "ServiceStatusesCloud", + "ServiceStatusesDDOS", + "ServiceStatusesDNS", + "ServiceStatusesStorage", + "ServiceStatusesStreaming", + "User", + "UserGroup", +] + + +class FreeFeaturesCdn(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" + + feature_id: Optional[int] = None + """Feature ID.""" + + free_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + name: Optional[str] = None + """Name of the feature.""" + + service: Optional[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] = None + """Service's name.""" + + +class FreeFeaturesCloud(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" + + feature_id: Optional[int] = None + """Feature ID.""" + + free_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + name: Optional[str] = None + """Name of the feature.""" + + service: Optional[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] = None + """Service's name.""" + + +class FreeFeaturesDDOS(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" + + feature_id: Optional[int] = None + """Feature ID.""" + + free_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + name: Optional[str] = None + """Name of the feature.""" + + service: Optional[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] = None + """Service's name.""" + + +class FreeFeaturesDNS(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" + + feature_id: Optional[int] = None + """Feature ID.""" + + free_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + name: Optional[str] = None + """Name of the feature.""" + + service: Optional[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] = None + """Service's name.""" + + +class FreeFeaturesStorage(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" + + feature_id: Optional[int] = None + """Feature ID.""" + + free_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + name: Optional[str] = None + """Name of the feature.""" + + service: Optional[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] = None + """Service's name.""" + + +class FreeFeaturesStreaming(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" + + feature_id: Optional[int] = None + """Feature ID.""" + + free_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + name: Optional[str] = None + """Name of the feature.""" + + service: Optional[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] = None + """Service's name.""" + + +class FreeFeatures(BaseModel): + cdn: Optional[List[FreeFeaturesCdn]] = FieldInfo(alias="CDN", default=None) + + cloud: Optional[List[FreeFeaturesCloud]] = FieldInfo(alias="CLOUD", default=None) + + ddos: Optional[List[FreeFeaturesDDOS]] = FieldInfo(alias="DDOS", default=None) + + dns: Optional[List[FreeFeaturesDNS]] = FieldInfo(alias="DNS", default=None) + + storage: Optional[List[FreeFeaturesStorage]] = FieldInfo(alias="STORAGE", default=None) + + streaming: Optional[List[FreeFeaturesStreaming]] = FieldInfo(alias="STREAMING", default=None) + + +class PaidFeaturesCdn(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" + + feature_id: Optional[int] = None + """Feature ID.""" + + name: Optional[str] = None + """Name of the feature.""" + + paid_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + service: Optional[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] = None + """Service's name.""" + + +class PaidFeaturesCloud(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" + + feature_id: Optional[int] = None + """Feature ID.""" + + name: Optional[str] = None + """Name of the feature.""" + + paid_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + service: Optional[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] = None + """Service's name.""" + + +class PaidFeaturesDDOS(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" + + feature_id: Optional[int] = None + """Feature ID.""" + + name: Optional[str] = None + """Name of the feature.""" + + paid_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + service: Optional[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] = None + """Service's name.""" + + +class PaidFeaturesDNS(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" + + feature_id: Optional[int] = None + """Feature ID.""" + + name: Optional[str] = None + """Name of the feature.""" + + paid_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + service: Optional[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] = None + """Service's name.""" + + +class PaidFeaturesStorage(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" + + feature_id: Optional[int] = None + """Feature ID.""" + + name: Optional[str] = None + """Name of the feature.""" + + paid_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + service: Optional[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] = None + """Service's name.""" + + +class PaidFeaturesStreaming(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" + + feature_id: Optional[int] = None + """Feature ID.""" + + name: Optional[str] = None + """Name of the feature.""" + + paid_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + service: Optional[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] = None + """Service's name.""" + + +class PaidFeatures(BaseModel): + cdn: Optional[List[PaidFeaturesCdn]] = FieldInfo(alias="CDN", default=None) + + cloud: Optional[List[PaidFeaturesCloud]] = FieldInfo(alias="CLOUD", default=None) + + ddos: Optional[List[PaidFeaturesDDOS]] = FieldInfo(alias="DDOS", default=None) + + dns: Optional[List[PaidFeaturesDNS]] = FieldInfo(alias="DNS", default=None) + + storage: Optional[List[PaidFeaturesStorage]] = FieldInfo(alias="STORAGE", default=None) + + streaming: Optional[List[PaidFeaturesStreaming]] = FieldInfo(alias="STREAMING", default=None) + + +class ServiceStatusesCdn(BaseModel): + enabled: Optional[bool] = None + """`true` - service is available in the Control Panel.""" + + status: Optional[Literal["new", "trial", "trialend", "active", "paused", "activating", "deleted"]] = None + """Status of the service.""" + + +class ServiceStatusesCloud(BaseModel): + enabled: Optional[bool] = None + """`true` - service is available in the Control Panel.""" + + status: Optional[Literal["new", "trial", "trialend", "active", "paused", "activating", "deleted"]] = None + """Status of the service.""" + + +class ServiceStatusesDDOS(BaseModel): + enabled: Optional[bool] = None + """`true` - service is available in the Control Panel.""" + + status: Optional[Literal["new", "trial", "trialend", "active", "paused", "activating", "deleted"]] = None + """Status of the service.""" + + +class ServiceStatusesDNS(BaseModel): + enabled: Optional[bool] = None + """`true` - service is available in the Control Panel.""" + + status: Optional[Literal["new", "trial", "trialend", "active", "paused", "activating", "deleted"]] = None + """Status of the service.""" + + +class ServiceStatusesStorage(BaseModel): + enabled: Optional[bool] = None + """`true` - service is available in the Control Panel.""" + + status: Optional[Literal["new", "trial", "trialend", "active", "paused", "activating", "deleted"]] = None + """Status of the service.""" + + +class ServiceStatusesStreaming(BaseModel): + enabled: Optional[bool] = None + """`true` - service is available in the Control Panel.""" + + status: Optional[Literal["new", "trial", "trialend", "active", "paused", "activating", "deleted"]] = None + """Status of the service.""" + + +class ServiceStatuses(BaseModel): + cdn: Optional[ServiceStatusesCdn] = FieldInfo(alias="CDN", default=None) + + cloud: Optional[ServiceStatusesCloud] = FieldInfo(alias="CLOUD", default=None) + + ddos: Optional[ServiceStatusesDDOS] = FieldInfo(alias="DDOS", default=None) + + dns: Optional[ServiceStatusesDNS] = FieldInfo(alias="DNS", default=None) + + storage: Optional[ServiceStatusesStorage] = FieldInfo(alias="STORAGE", default=None) + + streaming: Optional[ServiceStatusesStreaming] = FieldInfo(alias="STREAMING", default=None) + + +class UserGroup(BaseModel): + id: Optional[int] = None + """Group's ID: Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + """ + + name: Optional[ + Literal[ + "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" + ] + ] = None + """Group's name.""" + + +class User(BaseModel): + id: Optional[int] = None + """User's ID.""" + + activated: Optional[bool] = None + """Email confirmation: + + - `true` – user confirmed the email; + - `false` – user did not confirm the email. + """ + + auth_types: Optional[List[Literal["password", "sso", "github", "google-oauth2"]]] = None + """System field. List of auth types available for the account.""" + + client: Optional[float] = None + """User's account ID.""" + + company: Optional[str] = None + """User's company.""" + + deleted: Optional[bool] = None + """Deletion flag. If `true` then user was deleted.""" + + email: Optional[str] = None + """User's email address.""" + + groups: Optional[List[UserGroup]] = None + """User's group in the current account. IAM supports 5 groups: + + - Users + - Administrators + - Engineers + - Purge and Prefetch only (API) + - Purge and Prefetch only (API+Web) + """ + + lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None + """User's language. Defines language of the control panel and email messages.""" + + name: Optional[str] = None + """User's name.""" + + phone: Optional[str] = None + """User's phone.""" + + reseller: Optional[int] = None + """Services provider ID.""" + + sso_auth: Optional[bool] = None + """SSO authentication flag. If `true` then user can login via SAML SSO.""" + + two_fa: Optional[bool] = None + """Two-step verification: + + - `true` – user enabled two-step verification; + - `false` – user disabled two-step verification. + """ + + +class AccountOverview(BaseModel): + id: Optional[int] = None + """The account ID.""" + + bill_type: Optional[str] = None + """System field. Billing type of the account.""" + + capabilities: Optional[List[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]]] = None + """System field. List of services available for the account.""" + + company_name: Optional[str] = FieldInfo(alias="companyName", default=None) + """The company name.""" + + country_code: Optional[str] = None + """System field. The company country (ISO 3166-1 alpha-2 format).""" + + current_user: Optional[int] = FieldInfo(alias="currentUser", default=None) + """ID of the current user.""" + + custom_id: Optional[str] = None + """The account custom ID.""" + + deleted: Optional[bool] = None + """The field shows the status of the account: + + - `true` – the account has been deleted + - `false` – the account is not deleted + """ + + email: Optional[str] = None + """The account email.""" + + entry_base_domain: Optional[str] = FieldInfo(alias="entryBaseDomain", default=None) + """System field. Control panel domain.""" + + free_features: Optional[FreeFeatures] = FieldInfo(alias="freeFeatures", default=None) + """ + An object of arrays which contains information about free features available for + the requested account. + """ + + has_active_admin: Optional[bool] = None + """System field.""" + + is_test: Optional[bool] = None + """System field: + + - `true` — a test account; + - `false` — a production account. + """ + + name: Optional[str] = None + """Name of a user who registered the requested account.""" + + paid_features: Optional[PaidFeatures] = FieldInfo(alias="paidFeatures", default=None) + """ + An object of arrays which contains information about paid features available for + the requested account. + """ + + phone: Optional[str] = None + """Phone of a user who registered the requested account.""" + + service_statuses: Optional[ServiceStatuses] = FieldInfo(alias="serviceStatuses", default=None) + """ + An object of arrays which contains information about all services available for + the requested account. + """ + + signup_process: Optional[Literal["sign_up_full", "sign_up_simple"]] = None + """System field. Type of the account registration process.""" + + status: Optional[Literal["new", "trial", "trialend", "active", "integration", "paused", "preparation", "ready"]] = ( + None + ) + """Status of the account.""" + + users: Optional[List[User]] = None + """List of account users.""" + + website: Optional[str] = None + """The company website.""" diff --git a/src/gcore/types/iam/api_token.py b/src/gcore/types/iam/api_token.py new file mode 100644 index 00000000..c896a522 --- /dev/null +++ b/src/gcore/types/iam/api_token.py @@ -0,0 +1,78 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["APIToken", "ClientUser", "ClientUserRole"] + + +class ClientUserRole(BaseModel): + id: Optional[int] = None + """Group's ID: Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + """ + + name: Optional[ + Literal[ + "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" + ] + ] = None + """Group's name.""" + + +class ClientUser(BaseModel): + client_id: Optional[int] = None + """Account's ID.""" + + deleted: Optional[bool] = None + """Deletion flag. If true, then the API token was deleted.""" + + role: Optional[ClientUserRole] = None + + user_email: Optional[str] = None + """User's email who issued the API token.""" + + user_id: Optional[int] = None + """User's ID who issued the API token.""" + + user_name: Optional[str] = None + """User's name who issued the API token.""" + + +class APIToken(BaseModel): + client_user: ClientUser + + exp_date: str + """ + Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If + null, then the API token will never expire. + """ + + name: str + """API token name.""" + + id: Optional[int] = None + """API token ID.""" + + created: Optional[str] = None + """Date when the API token was issued (ISO 8086/RFC 3339 format), UTC.""" + + deleted: Optional[bool] = None + """Deletion flag. If true, then the API token was deleted.""" + + description: Optional[str] = None + """API token description.""" + + expired: Optional[bool] = None + """Expiration flag. + + If true, then the API token has expired. When an API token expires it will be + automatically deleted. + """ + + last_usage: Optional[str] = None + """Date when the API token was last used (ISO 8086/RFC 3339 format), UTC.""" diff --git a/src/gcore/types/iam/api_token_create.py b/src/gcore/types/iam/api_token_create.py new file mode 100644 index 00000000..5cfc280a --- /dev/null +++ b/src/gcore/types/iam/api_token_create.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["APITokenCreate"] + + +class APITokenCreate(BaseModel): + token: Optional[str] = None + """ + API token. Copy it, because you will not be able to get it again. We do not + store tokens. All responsibility for token storage and usage is on the issuer. + """ diff --git a/src/gcore/types/iam/api_token_create_params.py b/src/gcore/types/iam/api_token_create_params.py new file mode 100644 index 00000000..dcb3f8f3 --- /dev/null +++ b/src/gcore/types/iam/api_token_create_params.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["APITokenCreateParams", "ClientUser", "ClientUserRole"] + + +class APITokenCreateParams(TypedDict, total=False): + client_user: Required[ClientUser] + """API token role.""" + + exp_date: Required[str] + """ + Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If + null, then the API token will never expire. + """ + + name: Required[str] + """API token name.""" + + description: str + """API token description.""" + + +class ClientUserRole(TypedDict, total=False): + id: int + """Group's ID: Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + """ + + name: Literal[ + "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" + ] + """Group's name.""" + + +class ClientUser(TypedDict, total=False): + role: ClientUserRole diff --git a/src/gcore/types/iam/api_token_list.py b/src/gcore/types/iam/api_token_list.py new file mode 100644 index 00000000..7a68232a --- /dev/null +++ b/src/gcore/types/iam/api_token_list.py @@ -0,0 +1,81 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal, TypeAlias + +from ..._models import BaseModel + +__all__ = ["APITokenList", "APITokenListItem", "APITokenListItemClientUser", "APITokenListItemClientUserRole"] + + +class APITokenListItemClientUserRole(BaseModel): + id: Optional[int] = None + """Group's ID: Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + """ + + name: Optional[ + Literal[ + "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" + ] + ] = None + """Group's name.""" + + +class APITokenListItemClientUser(BaseModel): + client_id: Optional[int] = None + """Account's ID.""" + + deleted: Optional[bool] = None + """Deletion flag. If true, then the API token was deleted.""" + + role: Optional[APITokenListItemClientUserRole] = None + + user_email: Optional[str] = None + """User's email who issued the API token.""" + + user_id: Optional[int] = None + """User's ID who issued the API token.""" + + user_name: Optional[str] = None + """User's name who issued the API token.""" + + +class APITokenListItem(BaseModel): + client_user: APITokenListItemClientUser + + exp_date: str + """ + Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If + null, then the API token will never expire. + """ + + name: str + """API token name.""" + + id: Optional[int] = None + """API token ID.""" + + created: Optional[str] = None + """Date when the API token was issued (ISO 8086/RFC 3339 format), UTC.""" + + deleted: Optional[bool] = None + """Deletion flag. If true, then the API token was deleted.""" + + description: Optional[str] = None + """API token description.""" + + expired: Optional[bool] = None + """Expiration flag. + + If true, then the API token has expired. When an API token expires it will be + automatically deleted. + """ + + last_usage: Optional[str] = None + """Date when the API token was last used (ISO 8086/RFC 3339 format), UTC.""" + + +APITokenList: TypeAlias = List[APITokenListItem] diff --git a/src/gcore/types/iam/api_token_list_params.py b/src/gcore/types/iam/api_token_list_params.py new file mode 100644 index 00000000..b185e501 --- /dev/null +++ b/src/gcore/types/iam/api_token_list_params.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["APITokenListParams"] + + +class APITokenListParams(TypedDict, total=False): + deleted: bool + """The state of API tokens included in the response. + Two possible values: + + - True - API token was not deleted.\\** False - API token was deleted. + + Example, _&deleted=True_ + """ + + issued_by: int + """User's ID. + + Use to get API tokens issued by a particular user. + Example, _&`issued_by`=1234_ + """ + + not_issued_by: int + """User's ID. + + Use to get API tokens issued by anyone except a particular user. + Example, _¬_issued_by=1234_ + """ + + role: str + """Group's ID. Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + + Example, _&role=Engineers_ + """ diff --git a/src/gcore/types/iam/user.py b/src/gcore/types/iam/user.py new file mode 100644 index 00000000..15424ee4 --- /dev/null +++ b/src/gcore/types/iam/user.py @@ -0,0 +1,86 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["User", "Group"] + + +class Group(BaseModel): + id: Optional[int] = None + """Group's ID: Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + """ + + name: Optional[ + Literal[ + "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" + ] + ] = None + """Group's name.""" + + +class User(BaseModel): + id: Optional[int] = None + """User's ID.""" + + activated: Optional[bool] = None + """Email confirmation: + + - `true` – user confirmed the email; + - `false` – user did not confirm the email. + """ + + auth_types: Optional[List[Literal["password", "sso", "github", "google-oauth2"]]] = None + """System field. List of auth types available for the account.""" + + client: Optional[float] = None + """User's account ID.""" + + company: Optional[str] = None + """User's company.""" + + deleted: Optional[bool] = None + """Deletion flag. If `true` then user was deleted.""" + + email: Optional[str] = None + """User's email address.""" + + groups: Optional[List[Group]] = None + """User's group in the current account. IAM supports 5 groups: + + - Users + - Administrators + - Engineers + - Purge and Prefetch only (API) + - Purge and Prefetch only (API+Web) + """ + + lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None + """User's language. Defines language of the control panel and email messages.""" + + name: Optional[str] = None + """User's name.""" + + phone: Optional[str] = None + """User's phone.""" + + reseller: Optional[int] = None + """Services provider ID.""" + + sso_auth: Optional[bool] = None + """SSO authentication flag. If `true` then user can login via SAML SSO.""" + + two_fa: Optional[bool] = None + """Two-step verification: + + - `true` – user enabled two-step verification; + - `false` – user disabled two-step verification. + """ + + user_type: Optional[Literal["common"]] = None + """User's type.""" diff --git a/src/gcore/types/iam/user_detailed.py b/src/gcore/types/iam/user_detailed.py new file mode 100644 index 00000000..b82809a2 --- /dev/null +++ b/src/gcore/types/iam/user_detailed.py @@ -0,0 +1,104 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["UserDetailed", "ClientAndRole", "Group"] + + +class ClientAndRole(BaseModel): + client_company_name: str + + client_id: int + + user_id: int + """User's ID.""" + + user_roles: List[str] + """User role in this client.""" + + +class Group(BaseModel): + id: Optional[int] = None + """Group's ID: Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + """ + + name: Optional[ + Literal[ + "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" + ] + ] = None + """Group's name.""" + + +class UserDetailed(BaseModel): + id: Optional[int] = None + """User's ID.""" + + activated: Optional[bool] = None + """Email confirmation: + + - `true` – user confirmed the email; + - `false` – user did not confirm the email. + """ + + auth_types: Optional[List[Literal["password", "sso", "github", "google-oauth2"]]] = None + """System field. List of auth types available for the account.""" + + client: Optional[float] = None + """User's account ID.""" + + client_and_roles: Optional[List[ClientAndRole]] = None + """List of user's clients. User can access to one or more clients.""" + + company: Optional[str] = None + """User's company.""" + + deleted: Optional[bool] = None + """Deletion flag. If `true` then user was deleted.""" + + email: Optional[str] = None + """User's email address.""" + + groups: Optional[List[Group]] = None + """User's group in the current account. IAM supports 5 groups: + + - Users + - Administrators + - Engineers + - Purge and Prefetch only (API) + - Purge and Prefetch only (API+Web) + """ + + is_active: Optional[bool] = None + """User activity flag.""" + + lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None + """User's language. Defines language of the control panel and email messages.""" + + name: Optional[str] = None + """User's name.""" + + phone: Optional[str] = None + """User's phone.""" + + reseller: Optional[int] = None + """Services provider ID.""" + + sso_auth: Optional[bool] = None + """SSO authentication flag. If `true` then user can login via SAML SSO.""" + + two_fa: Optional[bool] = None + """Two-step verification: + + - `true` – user enabled two-step verification; + - `false` – user disabled two-step verification. + """ + + user_type: Optional[Literal["common", "reseller", "seller"]] = None + """User's type.""" diff --git a/src/gcore/types/iam/user_invite.py b/src/gcore/types/iam/user_invite.py new file mode 100644 index 00000000..86eea011 --- /dev/null +++ b/src/gcore/types/iam/user_invite.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["UserInvite"] + + +class UserInvite(BaseModel): + status: Optional[str] = None + """Status of the invitation.""" + + user_id: Optional[int] = None + """Invited user ID.""" diff --git a/src/gcore/types/iam/user_invite_params.py b/src/gcore/types/iam/user_invite_params.py new file mode 100644 index 00000000..8f17f566 --- /dev/null +++ b/src/gcore/types/iam/user_invite_params.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["UserInviteParams", "UserRole"] + + +class UserInviteParams(TypedDict, total=False): + client_id: Required[int] + """ID of account.""" + + email: Required[str] + """User email.""" + + user_role: Required[UserRole] + + lang: Literal["de", "en", "ru", "zh", "az"] + """User's language. Defines language of the control panel and email messages.""" + + name: str + """User name.""" + + +class UserRole(TypedDict, total=False): + id: int + """Group's ID: Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + """ + + name: Literal[ + "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" + ] + """Group's name.""" diff --git a/src/gcore/types/iam/user_list_params.py b/src/gcore/types/iam/user_list_params.py new file mode 100644 index 00000000..497bb66d --- /dev/null +++ b/src/gcore/types/iam/user_list_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["UserListParams"] + + +class UserListParams(TypedDict, total=False): + limit: int + """The maximum number of items.""" + + offset: int + """Offset relative to the beginning of list.""" diff --git a/src/gcore/types/iam/user_update.py b/src/gcore/types/iam/user_update.py new file mode 100644 index 00000000..78b75ac0 --- /dev/null +++ b/src/gcore/types/iam/user_update.py @@ -0,0 +1,104 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["UserUpdate", "ClientAndRole", "Group"] + + +class ClientAndRole(BaseModel): + client_company_name: str + + client_id: int + + user_id: int + """User's ID.""" + + user_roles: List[str] + """User role in this client.""" + + +class Group(BaseModel): + id: Optional[int] = None + """Group's ID: Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + """ + + name: Optional[ + Literal[ + "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" + ] + ] = None + """Group's name.""" + + +class UserUpdate(BaseModel): + id: Optional[int] = None + """User's ID.""" + + activated: Optional[bool] = None + """Email confirmation: + + - `true` – user confirmed the email; + - `false` – user did not confirm the email. + """ + + auth_types: Optional[List[Literal["password", "sso", "github", "google-oauth2"]]] = None + """System field. List of auth types available for the account.""" + + client: Optional[float] = None + """User's account ID.""" + + client_and_roles: Optional[List[ClientAndRole]] = None + """List of user's clients. User can access to one or more clients.""" + + company: Optional[str] = None + """User's company.""" + + deleted: Optional[bool] = None + """Deletion flag. If `true` then user was deleted.""" + + email: Optional[str] = None + """User's email address.""" + + groups: Optional[List[Group]] = None + """User's group in the current account. IAM supports 5 groups: + + - Users + - Administrators + - Engineers + - Purge and Prefetch only (API) + - Purge and Prefetch only (API+Web) + """ + + is_active: Optional[bool] = None + """User activity flag.""" + + lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None + """User's language. Defines language of the control panel and email messages.""" + + name: Optional[str] = None + """User's name.""" + + phone: Optional[str] = None + """User's phone.""" + + reseller: Optional[int] = None + """Services provider ID.""" + + sso_auth: Optional[bool] = None + """SSO authentication flag. If `true` then user can login via SAML SSO.""" + + two_fa: Optional[bool] = None + """Two-step verification: + + - `true` – user enabled two-step verification; + - `false` – user disabled two-step verification. + """ + + user_type: Optional[Literal["common", "reseller", "seller"]] = None + """User's type.""" diff --git a/src/gcore/types/iam/user_update_params.py b/src/gcore/types/iam/user_update_params.py new file mode 100644 index 00000000..6353a943 --- /dev/null +++ b/src/gcore/types/iam/user_update_params.py @@ -0,0 +1,52 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["UserUpdateParams", "Group"] + + +class UserUpdateParams(TypedDict, total=False): + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] + """System field. List of auth types available for the account.""" + + company: str + """User's company.""" + + email: str + """User's email address.""" + + groups: Iterable[Group] + """User's group in the current account. IAM supports 5 groups: + + - Users + - Administrators + - Engineers + - Purge and Prefetch only (API) + - Purge and Prefetch only (API+Web) + """ + + lang: Literal["de", "en", "ru", "zh", "az"] + """User's language. Defines language of the control panel and email messages.""" + + name: Optional[str] + """User's name.""" + + phone: Optional[str] + """User's phone.""" + + +class Group(TypedDict, total=False): + id: int + """Group's ID: Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + """ + + name: Literal[ + "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" + ] + """Group's name.""" diff --git a/tests/api_resources/iam/__init__.py b/tests/api_resources/iam/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/iam/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/iam/test_api_tokens.py b/tests/api_resources/iam/test_api_tokens.py new file mode 100644 index 00000000..4991518d --- /dev/null +++ b/tests/api_resources/iam/test_api_tokens.py @@ -0,0 +1,356 @@ +# 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.iam import APIToken, APITokenList, APITokenCreate + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAPITokens: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + api_token = client.iam.api_tokens.create( + client_id=0, + client_user={}, + exp_date="2021-01-01 12:00:00+00:00", + name="My token", + ) + assert_matches_type(APITokenCreate, api_token, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + api_token = client.iam.api_tokens.create( + client_id=0, + client_user={ + "role": { + "id": 1, + "name": "Administrators", + } + }, + exp_date="2021-01-01 12:00:00+00:00", + name="My token", + description="It's my token", + ) + assert_matches_type(APITokenCreate, api_token, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.iam.api_tokens.with_raw_response.create( + client_id=0, + client_user={}, + exp_date="2021-01-01 12:00:00+00:00", + name="My token", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_token = response.parse() + assert_matches_type(APITokenCreate, api_token, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.iam.api_tokens.with_streaming_response.create( + client_id=0, + client_user={}, + exp_date="2021-01-01 12:00:00+00:00", + name="My token", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_token = response.parse() + assert_matches_type(APITokenCreate, api_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + api_token = client.iam.api_tokens.list( + client_id=0, + ) + assert_matches_type(APITokenList, api_token, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + api_token = client.iam.api_tokens.list( + client_id=0, + deleted=True, + issued_by=0, + not_issued_by=0, + role="role", + ) + assert_matches_type(APITokenList, api_token, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.iam.api_tokens.with_raw_response.list( + client_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_token = response.parse() + assert_matches_type(APITokenList, api_token, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.iam.api_tokens.with_streaming_response.list( + client_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_token = response.parse() + assert_matches_type(APITokenList, api_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + api_token = client.iam.api_tokens.delete( + token_id=0, + client_id=0, + ) + assert api_token is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.iam.api_tokens.with_raw_response.delete( + token_id=0, + client_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_token = response.parse() + assert api_token is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.iam.api_tokens.with_streaming_response.delete( + token_id=0, + client_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_token = response.parse() + assert api_token is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + api_token = client.iam.api_tokens.get( + token_id=0, + client_id=0, + ) + assert_matches_type(APIToken, api_token, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.iam.api_tokens.with_raw_response.get( + token_id=0, + client_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_token = response.parse() + assert_matches_type(APIToken, api_token, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.iam.api_tokens.with_streaming_response.get( + token_id=0, + client_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_token = response.parse() + assert_matches_type(APIToken, api_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncAPITokens: + 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: + api_token = await async_client.iam.api_tokens.create( + client_id=0, + client_user={}, + exp_date="2021-01-01 12:00:00+00:00", + name="My token", + ) + assert_matches_type(APITokenCreate, api_token, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + api_token = await async_client.iam.api_tokens.create( + client_id=0, + client_user={ + "role": { + "id": 1, + "name": "Administrators", + } + }, + exp_date="2021-01-01 12:00:00+00:00", + name="My token", + description="It's my token", + ) + assert_matches_type(APITokenCreate, api_token, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.iam.api_tokens.with_raw_response.create( + client_id=0, + client_user={}, + exp_date="2021-01-01 12:00:00+00:00", + name="My token", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_token = await response.parse() + assert_matches_type(APITokenCreate, api_token, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.iam.api_tokens.with_streaming_response.create( + client_id=0, + client_user={}, + exp_date="2021-01-01 12:00:00+00:00", + name="My token", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_token = await response.parse() + assert_matches_type(APITokenCreate, api_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + api_token = await async_client.iam.api_tokens.list( + client_id=0, + ) + assert_matches_type(APITokenList, api_token, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + api_token = await async_client.iam.api_tokens.list( + client_id=0, + deleted=True, + issued_by=0, + not_issued_by=0, + role="role", + ) + assert_matches_type(APITokenList, api_token, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.iam.api_tokens.with_raw_response.list( + client_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_token = await response.parse() + assert_matches_type(APITokenList, api_token, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.iam.api_tokens.with_streaming_response.list( + client_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_token = await response.parse() + assert_matches_type(APITokenList, api_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + api_token = await async_client.iam.api_tokens.delete( + token_id=0, + client_id=0, + ) + assert api_token is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.iam.api_tokens.with_raw_response.delete( + token_id=0, + client_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_token = await response.parse() + assert api_token is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.iam.api_tokens.with_streaming_response.delete( + token_id=0, + client_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_token = await response.parse() + assert api_token is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + api_token = await async_client.iam.api_tokens.get( + token_id=0, + client_id=0, + ) + assert_matches_type(APIToken, api_token, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.iam.api_tokens.with_raw_response.get( + token_id=0, + client_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_token = await response.parse() + assert_matches_type(APIToken, api_token, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.iam.api_tokens.with_streaming_response.get( + token_id=0, + client_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_token = await response.parse() + assert_matches_type(APIToken, api_token, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/iam/test_users.py b/tests/api_resources/iam/test_users.py new file mode 100644 index 00000000..de972b4d --- /dev/null +++ b/tests/api_resources/iam/test_users.py @@ -0,0 +1,428 @@ +# 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.iam import ( + User, + UserInvite, + UserUpdate, + UserDetailed, +) +from gcore.pagination import SyncOffsetPageIam, AsyncOffsetPageIam + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestUsers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Gcore) -> None: + user = client.iam.users.update( + user_id=0, + ) + assert_matches_type(UserUpdate, user, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + user = client.iam.users.update( + user_id=0, + auth_types=["password"], + company="company", + email="dev@stainless.com", + groups=[ + { + "id": 1, + "name": "Administrators", + } + ], + lang="de", + name="name", + phone="phone", + ) + assert_matches_type(UserUpdate, user, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.iam.users.with_raw_response.update( + user_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(UserUpdate, user, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.iam.users.with_streaming_response.update( + user_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(UserUpdate, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + user = client.iam.users.list() + assert_matches_type(SyncOffsetPageIam[User], user, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + user = client.iam.users.list( + limit=0, + offset=0, + ) + assert_matches_type(SyncOffsetPageIam[User], user, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.iam.users.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(SyncOffsetPageIam[User], user, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.iam.users.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(SyncOffsetPageIam[User], user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + user = client.iam.users.delete( + user_id=0, + client_id=0, + ) + assert user is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.iam.users.with_raw_response.delete( + user_id=0, + client_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert user is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.iam.users.with_streaming_response.delete( + user_id=0, + client_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert user is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + user = client.iam.users.get( + 0, + ) + assert_matches_type(UserDetailed, user, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.iam.users.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(UserDetailed, user, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.iam.users.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(UserDetailed, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_invite(self, client: Gcore) -> None: + user = client.iam.users.invite( + client_id=0, + email="dev@stainless.com", + user_role={}, + ) + assert_matches_type(UserInvite, user, path=["response"]) + + @parametrize + def test_method_invite_with_all_params(self, client: Gcore) -> None: + user = client.iam.users.invite( + client_id=0, + email="dev@stainless.com", + user_role={ + "id": 1, + "name": "Administrators", + }, + lang="de", + name="name", + ) + assert_matches_type(UserInvite, user, path=["response"]) + + @parametrize + def test_raw_response_invite(self, client: Gcore) -> None: + response = client.iam.users.with_raw_response.invite( + client_id=0, + email="dev@stainless.com", + user_role={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(UserInvite, user, path=["response"]) + + @parametrize + def test_streaming_response_invite(self, client: Gcore) -> None: + with client.iam.users.with_streaming_response.invite( + client_id=0, + email="dev@stainless.com", + user_role={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(UserInvite, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncUsers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + user = await async_client.iam.users.update( + user_id=0, + ) + assert_matches_type(UserUpdate, user, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + user = await async_client.iam.users.update( + user_id=0, + auth_types=["password"], + company="company", + email="dev@stainless.com", + groups=[ + { + "id": 1, + "name": "Administrators", + } + ], + lang="de", + name="name", + phone="phone", + ) + assert_matches_type(UserUpdate, user, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.iam.users.with_raw_response.update( + user_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(UserUpdate, user, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.iam.users.with_streaming_response.update( + user_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(UserUpdate, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + user = await async_client.iam.users.list() + assert_matches_type(AsyncOffsetPageIam[User], user, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + user = await async_client.iam.users.list( + limit=0, + offset=0, + ) + assert_matches_type(AsyncOffsetPageIam[User], user, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.iam.users.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(AsyncOffsetPageIam[User], user, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.iam.users.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(AsyncOffsetPageIam[User], user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + user = await async_client.iam.users.delete( + user_id=0, + client_id=0, + ) + assert user is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.iam.users.with_raw_response.delete( + user_id=0, + client_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert user is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.iam.users.with_streaming_response.delete( + user_id=0, + client_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert user is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + user = await async_client.iam.users.get( + 0, + ) + assert_matches_type(UserDetailed, user, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.iam.users.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(UserDetailed, user, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.iam.users.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(UserDetailed, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_invite(self, async_client: AsyncGcore) -> None: + user = await async_client.iam.users.invite( + client_id=0, + email="dev@stainless.com", + user_role={}, + ) + assert_matches_type(UserInvite, user, path=["response"]) + + @parametrize + async def test_method_invite_with_all_params(self, async_client: AsyncGcore) -> None: + user = await async_client.iam.users.invite( + client_id=0, + email="dev@stainless.com", + user_role={ + "id": 1, + "name": "Administrators", + }, + lang="de", + name="name", + ) + assert_matches_type(UserInvite, user, path=["response"]) + + @parametrize + async def test_raw_response_invite(self, async_client: AsyncGcore) -> None: + response = await async_client.iam.users.with_raw_response.invite( + client_id=0, + email="dev@stainless.com", + user_role={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(UserInvite, user, path=["response"]) + + @parametrize + async def test_streaming_response_invite(self, async_client: AsyncGcore) -> None: + async with async_client.iam.users.with_streaming_response.invite( + client_id=0, + email="dev@stainless.com", + user_role={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(UserInvite, user, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_iam.py b/tests/api_resources/test_iam.py new file mode 100644 index 00000000..58a9d590 --- /dev/null +++ b/tests/api_resources/test_iam.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.iam import AccountOverview + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestIam: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_account_overview(self, client: Gcore) -> None: + iam = client.iam.get_account_overview() + assert_matches_type(AccountOverview, iam, path=["response"]) + + @parametrize + def test_raw_response_get_account_overview(self, client: Gcore) -> None: + response = client.iam.with_raw_response.get_account_overview() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + iam = response.parse() + assert_matches_type(AccountOverview, iam, path=["response"]) + + @parametrize + def test_streaming_response_get_account_overview(self, client: Gcore) -> None: + with client.iam.with_streaming_response.get_account_overview() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + iam = response.parse() + assert_matches_type(AccountOverview, iam, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncIam: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get_account_overview(self, async_client: AsyncGcore) -> None: + iam = await async_client.iam.get_account_overview() + assert_matches_type(AccountOverview, iam, path=["response"]) + + @parametrize + async def test_raw_response_get_account_overview(self, async_client: AsyncGcore) -> None: + response = await async_client.iam.with_raw_response.get_account_overview() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + iam = await response.parse() + assert_matches_type(AccountOverview, iam, path=["response"]) + + @parametrize + async def test_streaming_response_get_account_overview(self, async_client: AsyncGcore) -> None: + async with async_client.iam.with_streaming_response.get_account_overview() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + iam = await response.parse() + assert_matches_type(AccountOverview, iam, path=["response"]) + + assert cast(Any, response.is_closed) is True From 375ea1e7697d2f3da0a74d185ccea11aaf190085 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Jul 2025 09:29:46 +0000 Subject: [PATCH 191/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6b7b74c5..da59f99e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.0" + ".": "0.4.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index b802b19a..94b0198a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.3.0" +version = "0.4.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 be1b14df..bab6ec7d 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.3.0" # x-release-please-version +__version__ = "0.4.0" # x-release-please-version From e0aac1ea5e86058d4305235e4b45dbb72def728d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Jul 2025 14:08:07 +0000 Subject: [PATCH 192/592] refactor(cloud)!: refactor cloud inference models --- .stats.yml | 2 +- api.md | 69 +++-- requirements-dev.lock | 2 +- requirements.lock | 2 +- .../inference/deployments/deployments.py | 41 ++- .../cloud/inference/deployments/logs.py | 14 +- .../resources/cloud/inference/inference.py | 10 +- src/gcore/resources/cloud/inference/models.py | 31 +-- .../cloud/inference/registry_credentials.py | 32 +-- .../resources/cloud/inference/secrets.py | 9 +- src/gcore/types/cloud/__init__.py | 28 +- src/gcore/types/cloud/aws_iam_data.py | 13 - src/gcore/types/cloud/aws_iam_data_param.py | 15 -- src/gcore/types/cloud/capacity.py | 13 - .../container_probe_config_create_param.py | 17 -- .../cloud/container_probe_create_param.py | 38 --- .../container_probe_exec_create_param.py | 13 - .../container_probe_http_get_create_param.py | 25 -- ...container_probe_tcp_socket_create_param.py | 12 - src/gcore/types/cloud/container_scale.py | 25 -- .../cloud/container_scale_trigger_rate.py | 13 - .../cloud/container_scale_trigger_sqs.py | 33 --- .../container_scale_trigger_threshold.py | 10 - .../types/cloud/container_scale_triggers.py | 36 --- src/gcore/types/cloud/deploy_status.py | 13 - src/gcore/types/cloud/inference/__init__.py | 20 +- src/gcore/types/cloud/inference/container.py | 26 -- .../inference/deployment_create_params.py | 220 ++++++++++++++- .../inference/deployment_update_params.py | 15 +- .../cloud/inference/deployments/__init__.py | 1 + .../inference_deployment_log.py} | 6 +- src/gcore/types/cloud/inference/inference.py | 95 ------- .../cloud/inference/inference_deployment.py | 251 ++++++++++++++++++ ...ret.py => inference_deployment_api_key.py} | 4 +- ...talog_model_card.py => inference_model.py} | 4 +- ...l.py => inference_registry_credentials.py} | 4 +- ... inference_registry_credentials_create.py} | 4 +- .../types/cloud/inference/inference_secret.py | 13 +- .../inference/mlcatalog_order_by_choices.py | 7 - .../cloud/inference/model_list_params.py | 6 +- .../probe.py} | 18 +- .../probe_config.py} | 10 +- .../probe_exec.py} | 6 +- .../probe_http_get.py} | 6 +- .../probe_tcp_socket.py} | 6 +- .../cloud/inference/secret_create_params.py | 14 +- .../cloud/inference/secret_replace_params.py | 14 +- src/gcore/types/cloud/inference_probes.py | 19 -- ...pacity.py => inference_region_capacity.py} | 13 +- ...t.py => inference_region_capacity_list.py} | 8 +- src/gcore/types/cloud/ingress_opts_out.py | 16 -- src/gcore/types/cloud/ingress_opts_param.py | 18 -- .../cloud/inference/deployments/test_logs.py | 18 +- .../cloud/inference/test_deployments.py | 44 +-- .../cloud/inference/test_models.py | 34 +-- .../inference/test_registry_credentials.py | 44 +-- tests/api_resources/cloud/test_inference.py | 14 +- 57 files changed, 752 insertions(+), 742 deletions(-) delete mode 100644 src/gcore/types/cloud/aws_iam_data.py delete mode 100644 src/gcore/types/cloud/aws_iam_data_param.py delete mode 100644 src/gcore/types/cloud/capacity.py delete mode 100644 src/gcore/types/cloud/container_probe_config_create_param.py delete mode 100644 src/gcore/types/cloud/container_probe_create_param.py delete mode 100644 src/gcore/types/cloud/container_probe_exec_create_param.py delete mode 100644 src/gcore/types/cloud/container_probe_http_get_create_param.py delete mode 100644 src/gcore/types/cloud/container_probe_tcp_socket_create_param.py delete mode 100644 src/gcore/types/cloud/container_scale.py delete mode 100644 src/gcore/types/cloud/container_scale_trigger_rate.py delete mode 100644 src/gcore/types/cloud/container_scale_trigger_sqs.py delete mode 100644 src/gcore/types/cloud/container_scale_trigger_threshold.py delete mode 100644 src/gcore/types/cloud/container_scale_triggers.py delete mode 100644 src/gcore/types/cloud/deploy_status.py delete mode 100644 src/gcore/types/cloud/inference/container.py rename src/gcore/types/cloud/inference/{inference_log.py => deployments/inference_deployment_log.py} (75%) delete mode 100644 src/gcore/types/cloud/inference/inference.py create mode 100644 src/gcore/types/cloud/inference/inference_deployment.py rename src/gcore/types/cloud/inference/{inference_apikey_secret.py => inference_deployment_api_key.py} (76%) rename src/gcore/types/cloud/inference/{mlcatalog_model_card.py => inference_model.py} (95%) rename src/gcore/types/cloud/inference/{inference_registry_credential.py => inference_registry_credentials.py} (80%) rename src/gcore/types/cloud/inference/{inference_registry_credential_full.py => inference_registry_credentials_create.py} (80%) delete mode 100644 src/gcore/types/cloud/inference/mlcatalog_order_by_choices.py rename src/gcore/types/cloud/{container_probe.py => inference/probe.py} (62%) rename src/gcore/types/cloud/{container_probe_config.py => inference/probe_config.py} (56%) rename src/gcore/types/cloud/{container_probe_exec.py => inference/probe_exec.py} (66%) rename src/gcore/types/cloud/{container_probe_http_get.py => inference/probe_http_get.py} (83%) rename src/gcore/types/cloud/{container_probe_tcp_socket.py => inference/probe_tcp_socket.py} (56%) delete mode 100644 src/gcore/types/cloud/inference_probes.py rename src/gcore/types/cloud/{region_capacity.py => inference_region_capacity.py} (54%) rename src/gcore/types/cloud/{region_capacity_list.py => inference_region_capacity_list.py} (51%) delete mode 100644 src/gcore/types/cloud/ingress_opts_out.py delete mode 100644 src/gcore/types/cloud/ingress_opts_param.py diff --git a/.stats.yml b/.stats.yml index f6858de3..bab5e31b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 309 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a3eb777ed002489583f1ec680d7ac5638c4bf54a843d381a1c1ad5d1c9f5e967.yml openapi_spec_hash: 3e4993495b21ba44b2969cc41cdb1221 -config_hash: 708e4dbf0025978d06dedb02b94647a3 +config_hash: d7989761296bd1ae012daf7f0f53685d diff --git a/api.md b/api.md index 040eb35c..7edd31ee 100644 --- a/api.md +++ b/api.md @@ -452,36 +452,12 @@ Methods: Types: ```python -from gcore.types.cloud import ( - AwsIamData, - Capacity, - ContainerProbe, - ContainerProbeConfig, - ContainerProbeConfigCreate, - ContainerProbeCreate, - ContainerProbeExec, - ContainerProbeExecCreate, - ContainerProbeHTTPGet, - ContainerProbeHTTPGetCreate, - ContainerProbeTcpSocket, - ContainerProbeTcpSocketCreate, - ContainerScale, - ContainerScaleTriggerRate, - ContainerScaleTriggerSqs, - ContainerScaleTriggerThreshold, - ContainerScaleTriggers, - DeployStatus, - InferenceProbes, - IngressOpts, - IngressOptsOut, - RegionCapacity, - RegionCapacityList, -) +from gcore.types.cloud import InferenceRegionCapacity, InferenceRegionCapacityList ``` Methods: -- client.cloud.inference.get_capacity_by_region() -> RegionCapacityList +- client.cloud.inference.get_capacity_by_region() -> InferenceRegionCapacityList ### Flavors @@ -501,53 +477,70 @@ Methods: Types: ```python -from gcore.types.cloud.inference import MlcatalogModelCard, MlcatalogOrderByChoices +from gcore.types.cloud.inference import InferenceModel ``` Methods: -- client.cloud.inference.models.list(\*\*params) -> SyncOffsetPage[MlcatalogModelCard] -- client.cloud.inference.models.get(model_id) -> MlcatalogModelCard +- client.cloud.inference.models.list(\*\*params) -> SyncOffsetPage[InferenceModel] +- client.cloud.inference.models.get(model_id) -> InferenceModel ### Deployments Types: ```python -from gcore.types.cloud.inference import Container, Inference, InferenceApikeySecret, InferenceLog +from gcore.types.cloud.inference import ( + InferenceDeployment, + InferenceDeploymentAPIKey, + Probe, + ProbeConfig, + ProbeExec, + ProbeHTTPGet, + ProbeTcpSocket, +) ``` Methods: - client.cloud.inference.deployments.create(\*, project_id, \*\*params) -> TaskIDList - client.cloud.inference.deployments.update(deployment_name, \*, project_id, \*\*params) -> TaskIDList -- client.cloud.inference.deployments.list(\*, project_id, \*\*params) -> SyncOffsetPage[Inference] +- client.cloud.inference.deployments.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceDeployment] - client.cloud.inference.deployments.delete(deployment_name, \*, project_id) -> TaskIDList -- client.cloud.inference.deployments.get(deployment_name, \*, project_id) -> Inference -- client.cloud.inference.deployments.get_api_key(deployment_name, \*, project_id) -> InferenceApikeySecret +- client.cloud.inference.deployments.get(deployment_name, \*, project_id) -> InferenceDeployment +- client.cloud.inference.deployments.get_api_key(deployment_name, \*, project_id) -> InferenceDeploymentAPIKey - client.cloud.inference.deployments.start(deployment_name, \*, project_id) -> None - client.cloud.inference.deployments.stop(deployment_name, \*, project_id) -> None #### Logs +Types: + +```python +from gcore.types.cloud.inference.deployments import InferenceDeploymentLog +``` + Methods: -- client.cloud.inference.deployments.logs.list(deployment_name, \*, project_id, \*\*params) -> SyncOffsetPage[InferenceLog] +- client.cloud.inference.deployments.logs.list(deployment_name, \*, project_id, \*\*params) -> SyncOffsetPage[InferenceDeploymentLog] ### RegistryCredentials Types: ```python -from gcore.types.cloud.inference import InferenceRegistryCredential, InferenceRegistryCredentialFull +from gcore.types.cloud.inference import ( + InferenceRegistryCredentials, + InferenceRegistryCredentialsCreate, +) ``` Methods: -- client.cloud.inference.registry_credentials.create(\*, project_id, \*\*params) -> InferenceRegistryCredentialFull -- client.cloud.inference.registry_credentials.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceRegistryCredential] +- client.cloud.inference.registry_credentials.create(\*, project_id, \*\*params) -> InferenceRegistryCredentialsCreate +- client.cloud.inference.registry_credentials.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceRegistryCredentials] - client.cloud.inference.registry_credentials.delete(credential_name, \*, project_id) -> None -- client.cloud.inference.registry_credentials.get(credential_name, \*, project_id) -> InferenceRegistryCredential +- client.cloud.inference.registry_credentials.get(credential_name, \*, project_id) -> InferenceRegistryCredentials - client.cloud.inference.registry_credentials.replace(credential_name, \*, project_id, \*\*params) -> None ### Secrets diff --git a/requirements-dev.lock b/requirements-dev.lock index 69ce07e9..87a71d74 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -56,7 +56,7 @@ httpx==0.28.1 # via gcore # via httpx-aiohttp # via respx -httpx-aiohttp==0.1.6 +httpx-aiohttp==0.1.8 # via gcore idna==3.4 # via anyio diff --git a/requirements.lock b/requirements.lock index b755417d..1af17cde 100644 --- a/requirements.lock +++ b/requirements.lock @@ -43,7 +43,7 @@ httpcore==1.0.2 httpx==0.28.1 # via gcore # via httpx-aiohttp -httpx-aiohttp==0.1.6 +httpx-aiohttp==0.1.8 # via gcore idna==3.4 # via anyio diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 7c26b25d..e3ad72d8 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -28,9 +28,8 @@ from ....._base_client import AsyncPaginator, make_request_options from .....types.cloud.inference import deployment_list_params, deployment_create_params, deployment_update_params from .....types.cloud.task_id_list import TaskIDList -from .....types.cloud.ingress_opts_param import IngressOptsParam -from .....types.cloud.inference.inference import Inference -from .....types.cloud.inference.inference_apikey_secret import InferenceApikeySecret +from .....types.cloud.inference.inference_deployment import InferenceDeployment +from .....types.cloud.inference.inference_deployment_api_key import InferenceDeploymentAPIKey __all__ = ["DeploymentsResource", "AsyncDeploymentsResource"] @@ -73,7 +72,7 @@ def create( credentials_name: Optional[str] | NotGiven = NOT_GIVEN, description: Optional[str] | NotGiven = NOT_GIVEN, envs: Dict[str, str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN, + ingress_opts: Optional[deployment_create_params.IngressOpts] | NotGiven = NOT_GIVEN, logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN, probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN, api_timeout: Optional[int] | NotGiven = NOT_GIVEN, @@ -179,7 +178,7 @@ def update( envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, flavor_name: str | NotGiven = NOT_GIVEN, image: Optional[str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN, + ingress_opts: Optional[deployment_update_params.IngressOpts] | NotGiven = NOT_GIVEN, listening_port: Optional[int] | NotGiven = NOT_GIVEN, logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN, probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN, @@ -284,7 +283,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[Inference]: + ) -> SyncOffsetPage[InferenceDeployment]: """List inference deployments Args: @@ -309,7 +308,7 @@ def list( project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( f"/cloud/v3/inference/{project_id}/deployments", - page=SyncOffsetPage[Inference], + page=SyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -323,7 +322,7 @@ def list( deployment_list_params.DeploymentListParams, ), ), - model=Inference, + model=InferenceDeployment, ) def delete( @@ -377,7 +376,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Inference: + ) -> InferenceDeployment: """ Get inference deployment @@ -403,7 +402,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Inference, + cast_to=InferenceDeployment, ) def get_api_key( @@ -417,7 +416,7 @@ def get_api_key( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InferenceApikeySecret: + ) -> InferenceDeploymentAPIKey: """ Get inference deployment API key @@ -443,7 +442,7 @@ def get_api_key( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceApikeySecret, + cast_to=InferenceDeploymentAPIKey, ) def start( @@ -581,7 +580,7 @@ async def create( credentials_name: Optional[str] | NotGiven = NOT_GIVEN, description: Optional[str] | NotGiven = NOT_GIVEN, envs: Dict[str, str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN, + ingress_opts: Optional[deployment_create_params.IngressOpts] | NotGiven = NOT_GIVEN, logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN, probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN, api_timeout: Optional[int] | NotGiven = NOT_GIVEN, @@ -687,7 +686,7 @@ async def update( envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, flavor_name: str | NotGiven = NOT_GIVEN, image: Optional[str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN, + ingress_opts: Optional[deployment_update_params.IngressOpts] | NotGiven = NOT_GIVEN, listening_port: Optional[int] | NotGiven = NOT_GIVEN, logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN, probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN, @@ -792,7 +791,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Inference, AsyncOffsetPage[Inference]]: + ) -> AsyncPaginator[InferenceDeployment, AsyncOffsetPage[InferenceDeployment]]: """List inference deployments Args: @@ -817,7 +816,7 @@ def list( project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( f"/cloud/v3/inference/{project_id}/deployments", - page=AsyncOffsetPage[Inference], + page=AsyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -831,7 +830,7 @@ def list( deployment_list_params.DeploymentListParams, ), ), - model=Inference, + model=InferenceDeployment, ) async def delete( @@ -885,7 +884,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Inference: + ) -> InferenceDeployment: """ Get inference deployment @@ -911,7 +910,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Inference, + cast_to=InferenceDeployment, ) async def get_api_key( @@ -925,7 +924,7 @@ async def get_api_key( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InferenceApikeySecret: + ) -> InferenceDeploymentAPIKey: """ Get inference deployment API key @@ -951,7 +950,7 @@ async def get_api_key( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceApikeySecret, + cast_to=InferenceDeploymentAPIKey, ) async def start( diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index 816fd99f..1cc65006 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -20,7 +20,7 @@ from .....pagination import SyncOffsetPage, AsyncOffsetPage from ....._base_client import AsyncPaginator, make_request_options from .....types.cloud.inference.deployments import log_list_params -from .....types.cloud.inference.inference_log import InferenceLog +from .....types.cloud.inference.deployments.inference_deployment_log import InferenceDeploymentLog __all__ = ["LogsResource", "AsyncLogsResource"] @@ -60,7 +60,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[InferenceLog]: + ) -> SyncOffsetPage[InferenceDeploymentLog]: """ Get inference deployment logs @@ -92,7 +92,7 @@ def list( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", - page=SyncOffsetPage[InferenceLog], + page=SyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -108,7 +108,7 @@ def list( log_list_params.LogListParams, ), ), - model=InferenceLog, + model=InferenceDeploymentLog, ) @@ -147,7 +147,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[InferenceLog, AsyncOffsetPage[InferenceLog]]: + ) -> AsyncPaginator[InferenceDeploymentLog, AsyncOffsetPage[InferenceDeploymentLog]]: """ Get inference deployment logs @@ -179,7 +179,7 @@ def list( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", - page=AsyncOffsetPage[InferenceLog], + page=AsyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -195,7 +195,7 @@ def list( log_list_params.LogListParams, ), ), - model=InferenceLog, + model=InferenceDeploymentLog, ) diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index c29bc9b1..2e1372ad 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -54,7 +54,7 @@ DeploymentsResourceWithStreamingResponse, AsyncDeploymentsResourceWithStreamingResponse, ) -from ....types.cloud.region_capacity_list import RegionCapacityList +from ....types.cloud.inference_region_capacity_list import InferenceRegionCapacityList __all__ = ["InferenceResource", "AsyncInferenceResource"] @@ -108,14 +108,14 @@ def get_capacity_by_region( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegionCapacityList: + ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return self._get( "/cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RegionCapacityList, + cast_to=InferenceRegionCapacityList, ) @@ -168,14 +168,14 @@ async def get_capacity_by_region( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RegionCapacityList: + ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return await self._get( "/cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RegionCapacityList, + cast_to=InferenceRegionCapacityList, ) diff --git a/src/gcore/resources/cloud/inference/models.py b/src/gcore/resources/cloud/inference/models.py index ba8c7a34..b28decb5 100644 --- a/src/gcore/resources/cloud/inference/models.py +++ b/src/gcore/resources/cloud/inference/models.py @@ -2,6 +2,8 @@ from __future__ import annotations +from typing_extensions import Literal + import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -16,9 +18,8 @@ ) from ....pagination import SyncOffsetPage, AsyncOffsetPage from ...._base_client import AsyncPaginator, make_request_options -from ....types.cloud.inference import MlcatalogOrderByChoices, model_list_params -from ....types.cloud.inference.mlcatalog_model_card import MlcatalogModelCard -from ....types.cloud.inference.mlcatalog_order_by_choices import MlcatalogOrderByChoices +from ....types.cloud.inference import model_list_params +from ....types.cloud.inference.inference_model import InferenceModel __all__ = ["ModelsResource", "AsyncModelsResource"] @@ -48,14 +49,14 @@ def list( *, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - order_by: MlcatalogOrderByChoices | NotGiven = NOT_GIVEN, + order_by: Literal["name.asc", "name.desc"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[MlcatalogModelCard]: + ) -> SyncOffsetPage[InferenceModel]: """List models from catalog Args: @@ -78,7 +79,7 @@ def list( """ return self._get_api_list( "/cloud/v3/inference/models", - page=SyncOffsetPage[MlcatalogModelCard], + page=SyncOffsetPage[InferenceModel], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -93,7 +94,7 @@ def list( model_list_params.ModelListParams, ), ), - model=MlcatalogModelCard, + model=InferenceModel, ) def get( @@ -106,7 +107,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MlcatalogModelCard: + ) -> InferenceModel: """ Get model from catalog @@ -128,7 +129,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=MlcatalogModelCard, + cast_to=InferenceModel, ) @@ -157,14 +158,14 @@ def list( *, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - order_by: MlcatalogOrderByChoices | NotGiven = NOT_GIVEN, + order_by: Literal["name.asc", "name.desc"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[MlcatalogModelCard, AsyncOffsetPage[MlcatalogModelCard]]: + ) -> AsyncPaginator[InferenceModel, AsyncOffsetPage[InferenceModel]]: """List models from catalog Args: @@ -187,7 +188,7 @@ def list( """ return self._get_api_list( "/cloud/v3/inference/models", - page=AsyncOffsetPage[MlcatalogModelCard], + page=AsyncOffsetPage[InferenceModel], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -202,7 +203,7 @@ def list( model_list_params.ModelListParams, ), ), - model=MlcatalogModelCard, + model=InferenceModel, ) async def get( @@ -215,7 +216,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MlcatalogModelCard: + ) -> InferenceModel: """ Get model from catalog @@ -237,7 +238,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=MlcatalogModelCard, + cast_to=InferenceModel, ) diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index e77bb5ea..7592c9da 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -21,8 +21,8 @@ registry_credential_create_params, registry_credential_replace_params, ) -from ....types.cloud.inference.inference_registry_credential import InferenceRegistryCredential -from ....types.cloud.inference.inference_registry_credential_full import InferenceRegistryCredentialFull +from ....types.cloud.inference.inference_registry_credentials import InferenceRegistryCredentials +from ....types.cloud.inference.inference_registry_credentials_create import InferenceRegistryCredentialsCreate __all__ = ["RegistryCredentialsResource", "AsyncRegistryCredentialsResource"] @@ -61,7 +61,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InferenceRegistryCredentialFull: + ) -> InferenceRegistryCredentialsCreate: """ Create inference registry credential @@ -100,7 +100,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceRegistryCredentialFull, + cast_to=InferenceRegistryCredentialsCreate, ) def list( @@ -115,7 +115,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[InferenceRegistryCredential]: + ) -> SyncOffsetPage[InferenceRegistryCredentials]: """ List inference registry credentials @@ -139,7 +139,7 @@ def list( project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( f"/cloud/v3/inference/{project_id}/registry_credentials", - page=SyncOffsetPage[InferenceRegistryCredential], + page=SyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -153,7 +153,7 @@ def list( registry_credential_list_params.RegistryCredentialListParams, ), ), - model=InferenceRegistryCredential, + model=InferenceRegistryCredentials, ) def delete( @@ -208,7 +208,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InferenceRegistryCredential: + ) -> InferenceRegistryCredentials: """ Get inference registry credential @@ -234,7 +234,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceRegistryCredential, + cast_to=InferenceRegistryCredentials, ) def replace( @@ -330,7 +330,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InferenceRegistryCredentialFull: + ) -> InferenceRegistryCredentialsCreate: """ Create inference registry credential @@ -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=InferenceRegistryCredentialFull, + cast_to=InferenceRegistryCredentialsCreate, ) def list( @@ -384,7 +384,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[InferenceRegistryCredential, AsyncOffsetPage[InferenceRegistryCredential]]: + ) -> AsyncPaginator[InferenceRegistryCredentials, AsyncOffsetPage[InferenceRegistryCredentials]]: """ List inference registry credentials @@ -408,7 +408,7 @@ def list( project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( f"/cloud/v3/inference/{project_id}/registry_credentials", - page=AsyncOffsetPage[InferenceRegistryCredential], + page=AsyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -422,7 +422,7 @@ def list( registry_credential_list_params.RegistryCredentialListParams, ), ), - model=InferenceRegistryCredential, + model=InferenceRegistryCredentials, ) async def delete( @@ -477,7 +477,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InferenceRegistryCredential: + ) -> InferenceRegistryCredentials: """ Get inference registry credential @@ -503,7 +503,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceRegistryCredential, + cast_to=InferenceRegistryCredentials, ) async def replace( diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index 80ceff3b..275ec3f2 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -17,7 +17,6 @@ from ....pagination import SyncOffsetPage, AsyncOffsetPage from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.inference import secret_list_params, secret_create_params, secret_replace_params -from ....types.cloud.aws_iam_data_param import AwsIamDataParam from ....types.cloud.inference.inference_secret import InferenceSecret __all__ = ["SecretsResource", "AsyncSecretsResource"] @@ -47,7 +46,7 @@ def create( self, *, project_id: int | None = None, - data: AwsIamDataParam, + data: secret_create_params.Data, name: str, type: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -235,7 +234,7 @@ def replace( secret_name: str, *, project_id: int | None = None, - data: AwsIamDataParam, + data: secret_replace_params.Data, type: 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. @@ -308,7 +307,7 @@ async def create( self, *, project_id: int | None = None, - data: AwsIamDataParam, + data: secret_create_params.Data, name: str, type: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -496,7 +495,7 @@ async def replace( secret_name: str, *, project_id: int | None = None, - data: AwsIamDataParam, + data: secret_replace_params.Data, type: 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. diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 8612d016..2cb80a14 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -16,7 +16,6 @@ from .network import Network as Network from .project import Project as Project from .ssh_key import SSHKey as SSHKey -from .capacity import Capacity as Capacity from .instance import Instance as Instance from .registry import Registry as Registry from .gpu_image import GPUImage as GPUImage @@ -27,12 +26,10 @@ from .floating_ip import FloatingIP as FloatingIP from .http_method import HTTPMethod as HTTPMethod from .pool_status import PoolStatus as PoolStatus -from .aws_iam_data import AwsIamData as AwsIamData from .ddos_profile import DDOSProfile as DDOSProfile from .lb_algorithm import LbAlgorithm as LbAlgorithm from .registry_tag import RegistryTag as RegistryTag from .task_id_list import TaskIDList as TaskIDList -from .deploy_status import DeployStatus as DeployStatus from .fixed_address import FixedAddress as FixedAddress from .instance_list import InstanceList as InstanceList from .ip_assignment import IPAssignment as IPAssignment @@ -43,26 +40,19 @@ from .gpu_image_list import GPUImageList as GPUImageList from .health_monitor import HealthMonitor as HealthMonitor from .security_group import SecurityGroup as SecurityGroup -from .container_probe import ContainerProbe as ContainerProbe -from .container_scale import ContainerScale as ContainerScale from .listener_status import ListenerStatus as ListenerStatus from .network_details import NetworkDetails as NetworkDetails from .placement_group import PlacementGroup as PlacementGroup -from .region_capacity import RegionCapacity as RegionCapacity from .ssh_key_created import SSHKeyCreated as SSHKeyCreated from .baremetal_flavor import BaremetalFlavor as BaremetalFlavor from .floating_address import FloatingAddress as FloatingAddress -from .inference_probes import InferenceProbes as InferenceProbes -from .ingress_opts_out import IngressOptsOut as IngressOptsOut from .lb_pool_protocol import LbPoolProtocol as LbPoolProtocol from .task_list_params import TaskListParams as TaskListParams from .network_interface import NetworkInterface as NetworkInterface from .region_get_params import RegionGetParams as RegionGetParams from .reserved_fixed_ip import ReservedFixedIP as ReservedFixedIP -from .aws_iam_data_param import AwsIamDataParam as AwsIamDataParam from .ddos_profile_field import DDOSProfileField as DDOSProfileField from .floating_ip_status import FloatingIPStatus as FloatingIPStatus -from .ingress_opts_param import IngressOptsParam as IngressOptsParam from .instance_interface import InstanceInterface as InstanceInterface from .instance_isolation import InstanceIsolation as InstanceIsolation from .load_balancer_pool import LoadBalancerPool as LoadBalancerPool @@ -79,14 +69,12 @@ from .security_group_rule import SecurityGroupRule as SecurityGroupRule from .session_persistence import SessionPersistence as SessionPersistence from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams -from .container_probe_exec import ContainerProbeExec as ContainerProbeExec from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed from .gpu_baremetal_flavor import GPUBaremetalFlavor as GPUBaremetalFlavor from .instance_list_params import InstanceListParams as InstanceListParams from .lb_listener_protocol import LbListenerProtocol as LbListenerProtocol from .load_balancer_status import LoadBalancerStatus as LoadBalancerStatus from .placement_group_list import PlacementGroupList as PlacementGroupList -from .region_capacity_list import RegionCapacityList as RegionCapacityList from .secret_create_params import SecretCreateParams as SecretCreateParams from .secret_list_response import SecretListResponse as SecretListResponse from .tag_update_map_param import TagUpdateMapParam as TagUpdateMapParam @@ -106,7 +94,6 @@ from .project_create_params import ProjectCreateParams as ProjectCreateParams from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams -from .container_probe_config import ContainerProbeConfig as ContainerProbeConfig from .file_share_list_params import FileShareListParams as FileShareListParams from .instance_action_params import InstanceActionParams as InstanceActionParams from .instance_create_params import InstanceCreateParams as InstanceCreateParams @@ -122,8 +109,6 @@ from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams from .load_balancer_l7_policy import LoadBalancerL7Policy as LoadBalancerL7Policy from .load_balancer_pool_list import LoadBalancerPoolList as LoadBalancerPoolList -from .container_probe_http_get import ContainerProbeHTTPGet as ContainerProbeHTTPGet -from .container_scale_triggers import ContainerScaleTriggers as ContainerScaleTriggers from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList from .file_share_create_params import FileShareCreateParams as FileShareCreateParams from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams @@ -133,18 +118,17 @@ from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams from .gpu_baremetal_flavor_list import GPUBaremetalFlavorList as GPUBaremetalFlavorList +from .inference_region_capacity import InferenceRegionCapacity as InferenceRegionCapacity from .load_balancer_flavor_list import LoadBalancerFlavorList as LoadBalancerFlavorList from .load_balancer_list_params import LoadBalancerListParams as LoadBalancerListParams from .load_balancer_status_list import LoadBalancerStatusList as LoadBalancerStatusList from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams -from .container_probe_tcp_socket import ContainerProbeTcpSocket as ContainerProbeTcpSocket from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit from .load_balancer_l7_rule_list import LoadBalancerL7RuleList as LoadBalancerL7RuleList from .load_balancer_metrics_list import LoadBalancerMetricsList as LoadBalancerMetricsList from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams -from .container_scale_trigger_sqs import ContainerScaleTriggerSqs as ContainerScaleTriggerSqs from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField from .flavor_hardware_description import FlavorHardwareDescription as FlavorHardwareDescription from .instance_get_console_params import InstanceGetConsoleParams as InstanceGetConsoleParams @@ -157,8 +141,6 @@ from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams -from .container_probe_create_param import ContainerProbeCreateParam as ContainerProbeCreateParam -from .container_scale_trigger_rate import ContainerScaleTriggerRate as ContainerScaleTriggerRate from .gpu_baremetal_cluster_server import GPUBaremetalClusterServer as GPUBaremetalClusterServer from .load_balancer_l7_policy_list import LoadBalancerL7PolicyList as LoadBalancerL7PolicyList from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse @@ -168,33 +150,27 @@ from .load_balancer_listener_detail import LoadBalancerListenerDetail as LoadBalancerListenerDetail from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams +from .inference_region_capacity_list import InferenceRegionCapacityList as InferenceRegionCapacityList from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus from .billing_reservation_list_params import BillingReservationListParams as BillingReservationListParams from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams -from .container_probe_exec_create_param import ContainerProbeExecCreateParam as ContainerProbeExecCreateParam -from .container_scale_trigger_threshold import ContainerScaleTriggerThreshold as ContainerScaleTriggerThreshold from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams from .gpu_baremetal_cluster_server_list import GPUBaremetalClusterServerList as GPUBaremetalClusterServerList from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams -from .container_probe_config_create_param import ContainerProbeConfigCreateParam as ContainerProbeConfigCreateParam from .gpu_baremetal_cluster_create_params import GPUBaremetalClusterCreateParams as GPUBaremetalClusterCreateParams from .gpu_baremetal_cluster_delete_params import GPUBaremetalClusterDeleteParams as GPUBaremetalClusterDeleteParams from .gpu_baremetal_cluster_resize_params import GPUBaremetalClusterResizeParams as GPUBaremetalClusterResizeParams from .gpu_baremetal_cluster_rebuild_params import GPUBaremetalClusterRebuildParams as GPUBaremetalClusterRebuildParams from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams -from .container_probe_http_get_create_param import ContainerProbeHTTPGetCreateParam as ContainerProbeHTTPGetCreateParam from .instance_assign_security_group_params import ( InstanceAssignSecurityGroupParams as InstanceAssignSecurityGroupParams, ) from .instance_add_to_placement_group_params import ( InstanceAddToPlacementGroupParams as InstanceAddToPlacementGroupParams, ) -from .container_probe_tcp_socket_create_param import ( - ContainerProbeTcpSocketCreateParam as ContainerProbeTcpSocketCreateParam, -) from .instance_unassign_security_group_params import ( InstanceUnassignSecurityGroupParams as InstanceUnassignSecurityGroupParams, ) diff --git a/src/gcore/types/cloud/aws_iam_data.py b/src/gcore/types/cloud/aws_iam_data.py deleted file mode 100644 index 104ecba7..00000000 --- a/src/gcore/types/cloud/aws_iam_data.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["AwsIamData"] - - -class AwsIamData(BaseModel): - aws_access_key_id: str - """AWS IAM key ID.""" - - aws_secret_access_key: str - """AWS IAM secret key.""" diff --git a/src/gcore/types/cloud/aws_iam_data_param.py b/src/gcore/types/cloud/aws_iam_data_param.py deleted file mode 100644 index 412d9eed..00000000 --- a/src/gcore/types/cloud/aws_iam_data_param.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["AwsIamDataParam"] - - -class AwsIamDataParam(TypedDict, total=False): - aws_access_key_id: Required[str] - """AWS IAM key ID.""" - - aws_secret_access_key: Required[str] - """AWS IAM secret key.""" diff --git a/src/gcore/types/cloud/capacity.py b/src/gcore/types/cloud/capacity.py deleted file mode 100644 index 31d4c8ff..00000000 --- a/src/gcore/types/cloud/capacity.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["Capacity"] - - -class Capacity(BaseModel): - capacity: int - """Available capacity.""" - - flavor_name: str - """Flavor name.""" diff --git a/src/gcore/types/cloud/container_probe_config_create_param.py b/src/gcore/types/cloud/container_probe_config_create_param.py deleted file mode 100644 index 39e562ba..00000000 --- a/src/gcore/types/cloud/container_probe_config_create_param.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from .container_probe_create_param import ContainerProbeCreateParam - -__all__ = ["ContainerProbeConfigCreateParam"] - - -class ContainerProbeConfigCreateParam(TypedDict, total=False): - enabled: Required[bool] - """Whether the probe is enabled or not.""" - - probe: ContainerProbeCreateParam - """Probe configuration (exec, `http_get` or `tcp_socket`)""" diff --git a/src/gcore/types/cloud/container_probe_create_param.py b/src/gcore/types/cloud/container_probe_create_param.py deleted file mode 100644 index 5163d9ac..00000000 --- a/src/gcore/types/cloud/container_probe_create_param.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import TypedDict - -from .container_probe_exec_create_param import ContainerProbeExecCreateParam -from .container_probe_http_get_create_param import ContainerProbeHTTPGetCreateParam -from .container_probe_tcp_socket_create_param import ContainerProbeTcpSocketCreateParam - -__all__ = ["ContainerProbeCreateParam"] - - -class ContainerProbeCreateParam(TypedDict, total=False): - exec: Optional[ContainerProbeExecCreateParam] - """Exec probe configuration""" - - failure_threshold: int - """The number of consecutive probe failures that mark the container as unhealthy.""" - - http_get: Optional[ContainerProbeHTTPGetCreateParam] - """HTTP GET probe configuration""" - - initial_delay_seconds: int - """The initial delay before starting the first probe.""" - - period_seconds: int - """How often (in seconds) to perform the probe.""" - - success_threshold: int - """The number of consecutive successful probes that mark the container as healthy.""" - - tcp_socket: Optional[ContainerProbeTcpSocketCreateParam] - """TCP socket probe configuration""" - - timeout_seconds: int - """The timeout for each probe.""" diff --git a/src/gcore/types/cloud/container_probe_exec_create_param.py b/src/gcore/types/cloud/container_probe_exec_create_param.py deleted file mode 100644 index 53f1d6a5..00000000 --- a/src/gcore/types/cloud/container_probe_exec_create_param.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Required, TypedDict - -__all__ = ["ContainerProbeExecCreateParam"] - - -class ContainerProbeExecCreateParam(TypedDict, total=False): - command: Required[List[str]] - """Command to be executed inside the running container.""" diff --git a/src/gcore/types/cloud/container_probe_http_get_create_param.py b/src/gcore/types/cloud/container_probe_http_get_create_param.py deleted file mode 100644 index 94075984..00000000 --- a/src/gcore/types/cloud/container_probe_http_get_create_param.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import Required, TypedDict - -__all__ = ["ContainerProbeHTTPGetCreateParam"] - - -class ContainerProbeHTTPGetCreateParam(TypedDict, total=False): - port: Required[int] - """Port number the probe should connect to.""" - - headers: Dict[str, str] - """HTTP headers to be sent with the request.""" - - host: Optional[str] - """Host name to send HTTP request to.""" - - path: str - """The endpoint to send the HTTP request to.""" - - schema: str - """Schema to use for the HTTP request.""" diff --git a/src/gcore/types/cloud/container_probe_tcp_socket_create_param.py b/src/gcore/types/cloud/container_probe_tcp_socket_create_param.py deleted file mode 100644 index c7534ac4..00000000 --- a/src/gcore/types/cloud/container_probe_tcp_socket_create_param.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["ContainerProbeTcpSocketCreateParam"] - - -class ContainerProbeTcpSocketCreateParam(TypedDict, total=False): - port: Required[int] - """Port number to check if it's open.""" diff --git a/src/gcore/types/cloud/container_scale.py b/src/gcore/types/cloud/container_scale.py deleted file mode 100644 index 9378a9df..00000000 --- a/src/gcore/types/cloud/container_scale.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel -from .container_scale_triggers import ContainerScaleTriggers - -__all__ = ["ContainerScale"] - - -class ContainerScale(BaseModel): - cooldown_period: Optional[int] = None - """Cooldown period between scaling actions in seconds""" - - max: int - """Maximum scale for the container""" - - min: int - """Minimum scale for the container""" - - polling_interval: Optional[int] = None - """Polling interval for scaling triggers in seconds""" - - triggers: ContainerScaleTriggers - """Triggers for scaling actions""" diff --git a/src/gcore/types/cloud/container_scale_trigger_rate.py b/src/gcore/types/cloud/container_scale_trigger_rate.py deleted file mode 100644 index 6a0cfa17..00000000 --- a/src/gcore/types/cloud/container_scale_trigger_rate.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["ContainerScaleTriggerRate"] - - -class ContainerScaleTriggerRate(BaseModel): - rate: int - """Request count per 'window' seconds for the http trigger""" - - window: int - """Time window for rate calculation in seconds""" diff --git a/src/gcore/types/cloud/container_scale_trigger_sqs.py b/src/gcore/types/cloud/container_scale_trigger_sqs.py deleted file mode 100644 index 9c47d420..00000000 --- a/src/gcore/types/cloud/container_scale_trigger_sqs.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["ContainerScaleTriggerSqs"] - - -class ContainerScaleTriggerSqs(BaseModel): - activation_queue_length: int - """Number of messages for activation""" - - aws_endpoint: Optional[str] = None - """Custom AWS endpoint""" - - aws_region: str - """AWS region""" - - queue_length: int - """Number of messages for one replica""" - - queue_url: str - """SQS queue URL""" - - scale_on_delayed: bool - """Scale on delayed messages""" - - scale_on_flight: bool - """Scale on in-flight messages""" - - secret_name: str - """Auth secret name""" diff --git a/src/gcore/types/cloud/container_scale_trigger_threshold.py b/src/gcore/types/cloud/container_scale_trigger_threshold.py deleted file mode 100644 index c5ad7388..00000000 --- a/src/gcore/types/cloud/container_scale_trigger_threshold.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["ContainerScaleTriggerThreshold"] - - -class ContainerScaleTriggerThreshold(BaseModel): - threshold: int - """Threshold value for the trigger in percentage""" diff --git a/src/gcore/types/cloud/container_scale_triggers.py b/src/gcore/types/cloud/container_scale_triggers.py deleted file mode 100644 index ed70e633..00000000 --- a/src/gcore/types/cloud/container_scale_triggers.py +++ /dev/null @@ -1,36 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel -from .container_scale_trigger_sqs import ContainerScaleTriggerSqs -from .container_scale_trigger_rate import ContainerScaleTriggerRate -from .container_scale_trigger_threshold import ContainerScaleTriggerThreshold - -__all__ = ["ContainerScaleTriggers"] - - -class ContainerScaleTriggers(BaseModel): - cpu: Optional[ContainerScaleTriggerThreshold] = None - """CPU trigger configuration""" - - gpu_memory: Optional[ContainerScaleTriggerThreshold] = None - """GPU memory trigger configuration. - - Calculated by `DCGM_FI_DEV_MEM_COPY_UTIL` metric - """ - - gpu_utilization: Optional[ContainerScaleTriggerThreshold] = None - """GPU utilization trigger configuration. - - Calculated by `DCGM_FI_DEV_GPU_UTIL` metric - """ - - http: Optional[ContainerScaleTriggerRate] = None - """HTTP trigger configuration""" - - memory: Optional[ContainerScaleTriggerThreshold] = None - """Memory trigger configuration""" - - sqs: Optional[ContainerScaleTriggerSqs] = None - """SQS trigger configuration""" diff --git a/src/gcore/types/cloud/deploy_status.py b/src/gcore/types/cloud/deploy_status.py deleted file mode 100644 index 396147f9..00000000 --- a/src/gcore/types/cloud/deploy_status.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["DeployStatus"] - - -class DeployStatus(BaseModel): - ready: int - """Number of ready instances""" - - total: int - """Total number of instances""" diff --git a/src/gcore/types/cloud/inference/__init__.py b/src/gcore/types/cloud/inference/__init__.py index c6e0d9d3..e3db2b48 100644 --- a/src/gcore/types/cloud/inference/__init__.py +++ b/src/gcore/types/cloud/inference/__init__.py @@ -2,24 +2,28 @@ from __future__ import annotations -from .container import Container as Container -from .inference import Inference as Inference -from .inference_log import InferenceLog as InferenceLog +from .probe import Probe as Probe +from .probe_exec import ProbeExec as ProbeExec +from .probe_config import ProbeConfig as ProbeConfig +from .probe_http_get import ProbeHTTPGet as ProbeHTTPGet +from .inference_model import InferenceModel as InferenceModel from .inference_flavor import InferenceFlavor as InferenceFlavor from .inference_secret import InferenceSecret as InferenceSecret +from .probe_tcp_socket import ProbeTcpSocket as ProbeTcpSocket from .model_list_params import ModelListParams as ModelListParams from .flavor_list_params import FlavorListParams as FlavorListParams from .secret_list_params import SecretListParams as SecretListParams -from .mlcatalog_model_card import MlcatalogModelCard as MlcatalogModelCard +from .inference_deployment import InferenceDeployment as InferenceDeployment from .secret_create_params import SecretCreateParams as SecretCreateParams from .secret_replace_params import SecretReplaceParams as SecretReplaceParams from .deployment_list_params import DeploymentListParams as DeploymentListParams -from .inference_apikey_secret import InferenceApikeySecret as InferenceApikeySecret from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams from .deployment_update_params import DeploymentUpdateParams as DeploymentUpdateParams -from .mlcatalog_order_by_choices import MlcatalogOrderByChoices as MlcatalogOrderByChoices -from .inference_registry_credential import InferenceRegistryCredential as InferenceRegistryCredential +from .inference_deployment_api_key import InferenceDeploymentAPIKey as InferenceDeploymentAPIKey +from .inference_registry_credentials import InferenceRegistryCredentials as InferenceRegistryCredentials from .registry_credential_list_params import RegistryCredentialListParams as RegistryCredentialListParams from .registry_credential_create_params import RegistryCredentialCreateParams as RegistryCredentialCreateParams -from .inference_registry_credential_full import InferenceRegistryCredentialFull as InferenceRegistryCredentialFull from .registry_credential_replace_params import RegistryCredentialReplaceParams as RegistryCredentialReplaceParams +from .inference_registry_credentials_create import ( + InferenceRegistryCredentialsCreate as InferenceRegistryCredentialsCreate, +) diff --git a/src/gcore/types/cloud/inference/container.py b/src/gcore/types/cloud/inference/container.py deleted file mode 100644 index 20170d6c..00000000 --- a/src/gcore/types/cloud/inference/container.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ...._models import BaseModel -from ..deploy_status import DeployStatus -from ..container_scale import ContainerScale - -__all__ = ["Container"] - - -class Container(BaseModel): - address: Optional[str] = None - """Address of the inference instance""" - - deploy_status: DeployStatus - """Status of the containers deployment""" - - error_message: Optional[str] = None - """Error message if the container deployment failed""" - - region_id: int - """Region name for the container""" - - scale: ContainerScale - """Scale for the container""" diff --git a/src/gcore/types/cloud/inference/deployment_create_params.py b/src/gcore/types/cloud/inference/deployment_create_params.py index 226f23fd..801a770b 100644 --- a/src/gcore/types/cloud/inference/deployment_create_params.py +++ b/src/gcore/types/cloud/inference/deployment_create_params.py @@ -6,9 +6,7 @@ from typing_extensions import Required, Annotated, TypedDict from ...._utils import PropertyInfo -from ..ingress_opts_param import IngressOptsParam from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam -from ..container_probe_config_create_param import ContainerProbeConfigCreateParam __all__ = [ "DeploymentCreateParams", @@ -21,8 +19,24 @@ "ContainerScaleTriggersHTTP", "ContainerScaleTriggersMemory", "ContainerScaleTriggersSqs", + "IngressOpts", "Logging", "Probes", + "ProbesLivenessProbe", + "ProbesLivenessProbeProbe", + "ProbesLivenessProbeProbeExec", + "ProbesLivenessProbeProbeHTTPGet", + "ProbesLivenessProbeProbeTcpSocket", + "ProbesReadinessProbe", + "ProbesReadinessProbeProbe", + "ProbesReadinessProbeProbeExec", + "ProbesReadinessProbeProbeHTTPGet", + "ProbesReadinessProbeProbeTcpSocket", + "ProbesStartupProbe", + "ProbesStartupProbeProbe", + "ProbesStartupProbeProbeExec", + "ProbesStartupProbeProbeHTTPGet", + "ProbesStartupProbeProbeTcpSocket", ] @@ -69,7 +83,7 @@ class DeploymentCreateParams(TypedDict, total=False): envs: Dict[str, str] """Environment variables for the inference instance.""" - ingress_opts: Optional[IngressOptsParam] + ingress_opts: Optional[IngressOpts] """Ingress options for the inference instance""" logging: Optional[Logging] @@ -197,6 +211,17 @@ class Container(TypedDict, total=False): """Scale for the container""" +class IngressOpts(TypedDict, total=False): + disable_response_buffering: bool + """Disable response buffering if true. + + A client usually has a much slower connection and can not consume the response + data as fast as it is produced by an upstream application. Ingress tries to + buffer the whole response in order to release the upstream application as soon + as possible.By default, the response buffering is enabled. + """ + + class Logging(TypedDict, total=False): destination_region_id: Optional[int] """ID of the region in which the logs will be stored""" @@ -211,12 +236,195 @@ class Logging(TypedDict, total=False): """The topic name to stream logs to""" +class ProbesLivenessProbeProbeExec(TypedDict, total=False): + command: Required[List[str]] + """Command to be executed inside the running container.""" + + +class ProbesLivenessProbeProbeHTTPGet(TypedDict, total=False): + port: Required[int] + """Port number the probe should connect to.""" + + headers: Dict[str, str] + """HTTP headers to be sent with the request.""" + + host: Optional[str] + """Host name to send HTTP request to.""" + + path: str + """The endpoint to send the HTTP request to.""" + + schema: str + """Schema to use for the HTTP request.""" + + +class ProbesLivenessProbeProbeTcpSocket(TypedDict, total=False): + port: Required[int] + """Port number to check if it's open.""" + + +class ProbesLivenessProbeProbe(TypedDict, total=False): + exec: Optional[ProbesLivenessProbeProbeExec] + """Exec probe configuration""" + + failure_threshold: int + """The number of consecutive probe failures that mark the container as unhealthy.""" + + http_get: Optional[ProbesLivenessProbeProbeHTTPGet] + """HTTP GET probe configuration""" + + initial_delay_seconds: int + """The initial delay before starting the first probe.""" + + period_seconds: int + """How often (in seconds) to perform the probe.""" + + success_threshold: int + """The number of consecutive successful probes that mark the container as healthy.""" + + tcp_socket: Optional[ProbesLivenessProbeProbeTcpSocket] + """TCP socket probe configuration""" + + timeout_seconds: int + """The timeout for each probe.""" + + +class ProbesLivenessProbe(TypedDict, total=False): + enabled: Required[bool] + """Whether the probe is enabled or not.""" + + probe: ProbesLivenessProbeProbe + """Probe configuration (exec, `http_get` or `tcp_socket`)""" + + +class ProbesReadinessProbeProbeExec(TypedDict, total=False): + command: Required[List[str]] + """Command to be executed inside the running container.""" + + +class ProbesReadinessProbeProbeHTTPGet(TypedDict, total=False): + port: Required[int] + """Port number the probe should connect to.""" + + headers: Dict[str, str] + """HTTP headers to be sent with the request.""" + + host: Optional[str] + """Host name to send HTTP request to.""" + + path: str + """The endpoint to send the HTTP request to.""" + + schema: str + """Schema to use for the HTTP request.""" + + +class ProbesReadinessProbeProbeTcpSocket(TypedDict, total=False): + port: Required[int] + """Port number to check if it's open.""" + + +class ProbesReadinessProbeProbe(TypedDict, total=False): + exec: Optional[ProbesReadinessProbeProbeExec] + """Exec probe configuration""" + + failure_threshold: int + """The number of consecutive probe failures that mark the container as unhealthy.""" + + http_get: Optional[ProbesReadinessProbeProbeHTTPGet] + """HTTP GET probe configuration""" + + initial_delay_seconds: int + """The initial delay before starting the first probe.""" + + period_seconds: int + """How often (in seconds) to perform the probe.""" + + success_threshold: int + """The number of consecutive successful probes that mark the container as healthy.""" + + tcp_socket: Optional[ProbesReadinessProbeProbeTcpSocket] + """TCP socket probe configuration""" + + timeout_seconds: int + """The timeout for each probe.""" + + +class ProbesReadinessProbe(TypedDict, total=False): + enabled: Required[bool] + """Whether the probe is enabled or not.""" + + probe: ProbesReadinessProbeProbe + """Probe configuration (exec, `http_get` or `tcp_socket`)""" + + +class ProbesStartupProbeProbeExec(TypedDict, total=False): + command: Required[List[str]] + """Command to be executed inside the running container.""" + + +class ProbesStartupProbeProbeHTTPGet(TypedDict, total=False): + port: Required[int] + """Port number the probe should connect to.""" + + headers: Dict[str, str] + """HTTP headers to be sent with the request.""" + + host: Optional[str] + """Host name to send HTTP request to.""" + + path: str + """The endpoint to send the HTTP request to.""" + + schema: str + """Schema to use for the HTTP request.""" + + +class ProbesStartupProbeProbeTcpSocket(TypedDict, total=False): + port: Required[int] + """Port number to check if it's open.""" + + +class ProbesStartupProbeProbe(TypedDict, total=False): + exec: Optional[ProbesStartupProbeProbeExec] + """Exec probe configuration""" + + failure_threshold: int + """The number of consecutive probe failures that mark the container as unhealthy.""" + + http_get: Optional[ProbesStartupProbeProbeHTTPGet] + """HTTP GET probe configuration""" + + initial_delay_seconds: int + """The initial delay before starting the first probe.""" + + period_seconds: int + """How often (in seconds) to perform the probe.""" + + success_threshold: int + """The number of consecutive successful probes that mark the container as healthy.""" + + tcp_socket: Optional[ProbesStartupProbeProbeTcpSocket] + """TCP socket probe configuration""" + + timeout_seconds: int + """The timeout for each probe.""" + + +class ProbesStartupProbe(TypedDict, total=False): + enabled: Required[bool] + """Whether the probe is enabled or not.""" + + probe: ProbesStartupProbeProbe + """Probe configuration (exec, `http_get` or `tcp_socket`)""" + + class Probes(TypedDict, total=False): - liveness_probe: Optional[ContainerProbeConfigCreateParam] + liveness_probe: Optional[ProbesLivenessProbe] """Liveness probe configuration""" - readiness_probe: Optional[ContainerProbeConfigCreateParam] + readiness_probe: Optional[ProbesReadinessProbe] """Readiness probe configuration""" - startup_probe: Optional[ContainerProbeConfigCreateParam] + startup_probe: Optional[ProbesStartupProbe] """Startup 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 005e1304..5a4a0bd7 100644 --- a/src/gcore/types/cloud/inference/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -6,7 +6,6 @@ from typing_extensions import Required, Annotated, TypedDict from ...._utils import PropertyInfo -from ..ingress_opts_param import IngressOptsParam from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam __all__ = [ @@ -20,6 +19,7 @@ "ContainerScaleTriggersHTTP", "ContainerScaleTriggersMemory", "ContainerScaleTriggersSqs", + "IngressOpts", "Logging", "Probes", "ProbesLivenessProbe", @@ -77,7 +77,7 @@ class DeploymentUpdateParams(TypedDict, total=False): accessible Docker image URL can be specified. """ - ingress_opts: Optional[IngressOptsParam] + ingress_opts: Optional[IngressOpts] """Ingress options for the inference instance""" listening_port: Optional[int] @@ -204,6 +204,17 @@ class Container(TypedDict, total=False): """Scale for the container""" +class IngressOpts(TypedDict, total=False): + disable_response_buffering: bool + """Disable response buffering if true. + + A client usually has a much slower connection and can not consume the response + data as fast as it is produced by an upstream application. Ingress tries to + buffer the whole response in order to release the upstream application as soon + as possible.By default, the response buffering is enabled. + """ + + class Logging(TypedDict, total=False): destination_region_id: Optional[int] """ID of the region in which the logs will be stored""" diff --git a/src/gcore/types/cloud/inference/deployments/__init__.py b/src/gcore/types/cloud/inference/deployments/__init__.py index 344b4c92..bbef5855 100644 --- a/src/gcore/types/cloud/inference/deployments/__init__.py +++ b/src/gcore/types/cloud/inference/deployments/__init__.py @@ -3,3 +3,4 @@ from __future__ import annotations from .log_list_params import LogListParams as LogListParams +from .inference_deployment_log import InferenceDeploymentLog as InferenceDeploymentLog diff --git a/src/gcore/types/cloud/inference/inference_log.py b/src/gcore/types/cloud/inference/deployments/inference_deployment_log.py similarity index 75% rename from src/gcore/types/cloud/inference/inference_log.py rename to src/gcore/types/cloud/inference/deployments/inference_deployment_log.py index 3817bb25..1737bf1b 100644 --- a/src/gcore/types/cloud/inference/inference_log.py +++ b/src/gcore/types/cloud/inference/deployments/inference_deployment_log.py @@ -2,12 +2,12 @@ from datetime import datetime -from ...._models import BaseModel +from ....._models import BaseModel -__all__ = ["InferenceLog"] +__all__ = ["InferenceDeploymentLog"] -class InferenceLog(BaseModel): +class InferenceDeploymentLog(BaseModel): message: str """Log message.""" diff --git a/src/gcore/types/cloud/inference/inference.py b/src/gcore/types/cloud/inference/inference.py deleted file mode 100644 index 34dbef52..00000000 --- a/src/gcore/types/cloud/inference/inference.py +++ /dev/null @@ -1,95 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional -from typing_extensions import Literal - -from ..logging import Logging -from .container import Container -from ...._models import BaseModel -from ..inference_probes import InferenceProbes -from ..ingress_opts_out import IngressOptsOut - -__all__ = ["Inference"] - - -class Inference(BaseModel): - address: Optional[str] = None - """Address of the inference instance""" - - auth_enabled: bool - """`true` if instance uses API key authentication. - - `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required - for the requests to the instance if enabled. - """ - - command: Optional[str] = None - """Command to be executed when running a container from an image.""" - - containers: List[Container] - """List of containers for the inference instance""" - - created_at: Optional[str] = None - """Inference instance creation date in ISO 8601 format.""" - - credentials_name: str - """Registry credentials name""" - - description: str - """Inference instance description.""" - - envs: Optional[Dict[str, str]] = None - """Environment variables for the inference instance""" - - flavor_name: str - """Flavor name for the inference instance""" - - image: str - """Docker image for the inference instance. - - This field should contain the image name and tag in the format 'name:tag', e.g., - 'nginx:latest'. It defaults to Docker Hub as the image registry, but any - accessible Docker image URL can be specified. - """ - - ingress_opts: Optional[IngressOptsOut] = None - """Ingress options for the inference instance""" - - listening_port: int - """Listening port for the inference instance.""" - - logging: Optional[Logging] = None - """Logging configuration for the inference instance""" - - name: str - """Inference instance name.""" - - probes: Optional[InferenceProbes] = None - """Probes configured for all containers of the inference instance.""" - - project_id: int - """Project ID. If not provided, your default project ID will be used.""" - - status: Literal["ACTIVE", "DELETING", "DEPLOYING", "DISABLED", "PARTIALLYDEPLOYED", "PENDING"] - """Inference instance status. Value can be one of the following: - - - `DEPLOYING` - The instance is being deployed. Containers are not yet created. - - `PARTIALLYDEPLOYED` - All containers have been created, but some may not be - ready yet. Instances stuck in this state typically indicate either image being - pulled, or a failure of some kind. In the latter case, the `error_message` - field of the respective container object in the `containers` collection - explains the failure reason. - - `ACTIVE` - The instance is running and ready to accept requests. - - `DISABLED` - The instance is disabled and not accepting any requests. - - `PENDING` - The instance is running but scaled to zero. It will be - automatically scaled up when a request is made. - - `DELETING` - The instance is being deleted. - """ - - timeout: Optional[int] = None - """ - Specifies the duration in seconds without any requests after which the - containers will be downscaled to their minimum scale value as defined by - `scale.min`. If set, this helps in optimizing resource usage by reducing the - number of container instances during periods of inactivity. - """ diff --git a/src/gcore/types/cloud/inference/inference_deployment.py b/src/gcore/types/cloud/inference/inference_deployment.py new file mode 100644 index 00000000..4b64c717 --- /dev/null +++ b/src/gcore/types/cloud/inference/inference_deployment.py @@ -0,0 +1,251 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from ..logging import Logging +from ...._models import BaseModel +from .probe_config import ProbeConfig + +__all__ = [ + "InferenceDeployment", + "Container", + "ContainerDeployStatus", + "ContainerScale", + "ContainerScaleTriggers", + "ContainerScaleTriggersCPU", + "ContainerScaleTriggersGPUMemory", + "ContainerScaleTriggersGPUUtilization", + "ContainerScaleTriggersHTTP", + "ContainerScaleTriggersMemory", + "ContainerScaleTriggersSqs", + "IngressOpts", + "Probes", +] + + +class ContainerDeployStatus(BaseModel): + ready: int + """Number of ready instances""" + + total: int + """Total number of instances""" + + +class ContainerScaleTriggersCPU(BaseModel): + threshold: int + """Threshold value for the trigger in percentage""" + + +class ContainerScaleTriggersGPUMemory(BaseModel): + threshold: int + """Threshold value for the trigger in percentage""" + + +class ContainerScaleTriggersGPUUtilization(BaseModel): + threshold: int + """Threshold value for the trigger in percentage""" + + +class ContainerScaleTriggersHTTP(BaseModel): + rate: int + """Request count per 'window' seconds for the http trigger""" + + window: int + """Time window for rate calculation in seconds""" + + +class ContainerScaleTriggersMemory(BaseModel): + threshold: int + """Threshold value for the trigger in percentage""" + + +class ContainerScaleTriggersSqs(BaseModel): + activation_queue_length: int + """Number of messages for activation""" + + aws_endpoint: Optional[str] = None + """Custom AWS endpoint""" + + aws_region: str + """AWS region""" + + queue_length: int + """Number of messages for one replica""" + + queue_url: str + """SQS queue URL""" + + scale_on_delayed: bool + """Scale on delayed messages""" + + scale_on_flight: bool + """Scale on in-flight messages""" + + secret_name: str + """Auth secret name""" + + +class ContainerScaleTriggers(BaseModel): + cpu: Optional[ContainerScaleTriggersCPU] = None + """CPU trigger configuration""" + + gpu_memory: Optional[ContainerScaleTriggersGPUMemory] = None + """GPU memory trigger configuration. + + Calculated by `DCGM_FI_DEV_MEM_COPY_UTIL` metric + """ + + gpu_utilization: Optional[ContainerScaleTriggersGPUUtilization] = None + """GPU utilization trigger configuration. + + Calculated by `DCGM_FI_DEV_GPU_UTIL` metric + """ + + http: Optional[ContainerScaleTriggersHTTP] = None + """HTTP trigger configuration""" + + memory: Optional[ContainerScaleTriggersMemory] = None + """Memory trigger configuration""" + + sqs: Optional[ContainerScaleTriggersSqs] = None + """SQS trigger configuration""" + + +class ContainerScale(BaseModel): + cooldown_period: Optional[int] = None + """Cooldown period between scaling actions in seconds""" + + max: int + """Maximum scale for the container""" + + min: int + """Minimum scale for the container""" + + polling_interval: Optional[int] = None + """Polling interval for scaling triggers in seconds""" + + triggers: ContainerScaleTriggers + """Triggers for scaling actions""" + + +class Container(BaseModel): + address: Optional[str] = None + """Address of the inference instance""" + + deploy_status: ContainerDeployStatus + """Status of the containers deployment""" + + error_message: Optional[str] = None + """Error message if the container deployment failed""" + + region_id: int + """Region name for the container""" + + scale: ContainerScale + """Scale for the container""" + + +class IngressOpts(BaseModel): + disable_response_buffering: bool + """Disable response buffering if true. + + A client usually has a much slower connection and can not consume the response + data as fast as it is produced by an upstream application. Ingress tries to + buffer the whole response in order to release the upstream application as soon + as possible.By default, the response buffering is enabled. + """ + + +class Probes(BaseModel): + liveness_probe: Optional[ProbeConfig] = None + """Liveness probe configuration""" + + readiness_probe: Optional[ProbeConfig] = None + """Readiness probe configuration""" + + startup_probe: Optional[ProbeConfig] = None + """Startup probe configuration""" + + +class InferenceDeployment(BaseModel): + address: Optional[str] = None + """Address of the inference instance""" + + auth_enabled: bool + """`true` if instance uses API key authentication. + + `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + for the requests to the instance if enabled. + """ + + command: Optional[str] = None + """Command to be executed when running a container from an image.""" + + containers: List[Container] + """List of containers for the inference instance""" + + created_at: Optional[str] = None + """Inference instance creation date in ISO 8601 format.""" + + credentials_name: str + """Registry credentials name""" + + description: str + """Inference instance description.""" + + envs: Optional[Dict[str, str]] = None + """Environment variables for the inference instance""" + + flavor_name: str + """Flavor name for the inference instance""" + + image: str + """Docker image for the inference instance. + + This field should contain the image name and tag in the format 'name:tag', e.g., + 'nginx:latest'. It defaults to Docker Hub as the image registry, but any + accessible Docker image URL can be specified. + """ + + ingress_opts: Optional[IngressOpts] = None + """Ingress options for the inference instance""" + + listening_port: int + """Listening port for the inference instance.""" + + logging: Optional[Logging] = None + """Logging configuration for the inference instance""" + + name: str + """Inference instance name.""" + + probes: Optional[Probes] = None + """Probes configured for all containers of the inference instance.""" + + project_id: int + """Project ID. If not provided, your default project ID will be used.""" + + status: Literal["ACTIVE", "DELETING", "DEPLOYING", "DISABLED", "PARTIALLYDEPLOYED", "PENDING"] + """Inference instance status. Value can be one of the following: + + - `DEPLOYING` - The instance is being deployed. Containers are not yet created. + - `PARTIALLYDEPLOYED` - All containers have been created, but some may not be + ready yet. Instances stuck in this state typically indicate either image being + pulled, or a failure of some kind. In the latter case, the `error_message` + field of the respective container object in the `containers` collection + explains the failure reason. + - `ACTIVE` - The instance is running and ready to accept requests. + - `DISABLED` - The instance is disabled and not accepting any requests. + - `PENDING` - The instance is running but scaled to zero. It will be + automatically scaled up when a request is made. + - `DELETING` - The instance is being deleted. + """ + + timeout: Optional[int] = None + """ + Specifies the duration in seconds without any requests after which the + containers will be downscaled to their minimum scale value as defined by + `scale.min`. If set, this helps in optimizing resource usage by reducing the + number of container instances during periods of inactivity. + """ diff --git a/src/gcore/types/cloud/inference/inference_apikey_secret.py b/src/gcore/types/cloud/inference/inference_deployment_api_key.py similarity index 76% rename from src/gcore/types/cloud/inference/inference_apikey_secret.py rename to src/gcore/types/cloud/inference/inference_deployment_api_key.py index 173de155..e6df4ffa 100644 --- a/src/gcore/types/cloud/inference/inference_apikey_secret.py +++ b/src/gcore/types/cloud/inference/inference_deployment_api_key.py @@ -4,10 +4,10 @@ from ...._models import BaseModel -__all__ = ["InferenceApikeySecret"] +__all__ = ["InferenceDeploymentAPIKey"] -class InferenceApikeySecret(BaseModel): +class InferenceDeploymentAPIKey(BaseModel): secret: str """API key secret""" diff --git a/src/gcore/types/cloud/inference/mlcatalog_model_card.py b/src/gcore/types/cloud/inference/inference_model.py similarity index 95% rename from src/gcore/types/cloud/inference/mlcatalog_model_card.py rename to src/gcore/types/cloud/inference/inference_model.py index edf5546c..9de2dbe3 100644 --- a/src/gcore/types/cloud/inference/mlcatalog_model_card.py +++ b/src/gcore/types/cloud/inference/inference_model.py @@ -6,10 +6,10 @@ from ...._models import BaseModel -__all__ = ["MlcatalogModelCard"] +__all__ = ["InferenceModel"] -class MlcatalogModelCard(BaseModel): +class InferenceModel(BaseModel): id: str """Model ID.""" diff --git a/src/gcore/types/cloud/inference/inference_registry_credential.py b/src/gcore/types/cloud/inference/inference_registry_credentials.py similarity index 80% rename from src/gcore/types/cloud/inference/inference_registry_credential.py rename to src/gcore/types/cloud/inference/inference_registry_credentials.py index fcc8a469..db586719 100644 --- a/src/gcore/types/cloud/inference/inference_registry_credential.py +++ b/src/gcore/types/cloud/inference/inference_registry_credentials.py @@ -2,10 +2,10 @@ from ...._models import BaseModel -__all__ = ["InferenceRegistryCredential"] +__all__ = ["InferenceRegistryCredentials"] -class InferenceRegistryCredential(BaseModel): +class InferenceRegistryCredentials(BaseModel): name: str """Registry credential name.""" diff --git a/src/gcore/types/cloud/inference/inference_registry_credential_full.py b/src/gcore/types/cloud/inference/inference_registry_credentials_create.py similarity index 80% rename from src/gcore/types/cloud/inference/inference_registry_credential_full.py rename to src/gcore/types/cloud/inference/inference_registry_credentials_create.py index 52a449f2..ff24063f 100644 --- a/src/gcore/types/cloud/inference/inference_registry_credential_full.py +++ b/src/gcore/types/cloud/inference/inference_registry_credentials_create.py @@ -2,10 +2,10 @@ from ...._models import BaseModel -__all__ = ["InferenceRegistryCredentialFull"] +__all__ = ["InferenceRegistryCredentialsCreate"] -class InferenceRegistryCredentialFull(BaseModel): +class InferenceRegistryCredentialsCreate(BaseModel): name: str """Registry credential name.""" diff --git a/src/gcore/types/cloud/inference/inference_secret.py b/src/gcore/types/cloud/inference/inference_secret.py index f1b7bb53..17ca610a 100644 --- a/src/gcore/types/cloud/inference/inference_secret.py +++ b/src/gcore/types/cloud/inference/inference_secret.py @@ -1,13 +1,20 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from ...._models import BaseModel -from ..aws_iam_data import AwsIamData -__all__ = ["InferenceSecret"] +__all__ = ["InferenceSecret", "Data"] + + +class Data(BaseModel): + aws_access_key_id: str + """AWS IAM key ID.""" + + aws_secret_access_key: str + """AWS IAM secret key.""" class InferenceSecret(BaseModel): - data: AwsIamData + data: Data """Secret data.""" name: str diff --git a/src/gcore/types/cloud/inference/mlcatalog_order_by_choices.py b/src/gcore/types/cloud/inference/mlcatalog_order_by_choices.py deleted file mode 100644 index 6b6f1648..00000000 --- a/src/gcore/types/cloud/inference/mlcatalog_order_by_choices.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["MlcatalogOrderByChoices"] - -MlcatalogOrderByChoices: TypeAlias = Literal["name.asc", "name.desc"] diff --git a/src/gcore/types/cloud/inference/model_list_params.py b/src/gcore/types/cloud/inference/model_list_params.py index befd35b4..8bfaf71d 100644 --- a/src/gcore/types/cloud/inference/model_list_params.py +++ b/src/gcore/types/cloud/inference/model_list_params.py @@ -2,9 +2,7 @@ from __future__ import annotations -from typing_extensions import TypedDict - -from .mlcatalog_order_by_choices import MlcatalogOrderByChoices +from typing_extensions import Literal, TypedDict __all__ = ["ModelListParams"] @@ -19,5 +17,5 @@ class ModelListParams(TypedDict, total=False): Offset value is used to exclude the first set of records from the result """ - order_by: MlcatalogOrderByChoices + order_by: Literal["name.asc", "name.desc"] """Order instances by transmitted fields and directions""" diff --git a/src/gcore/types/cloud/container_probe.py b/src/gcore/types/cloud/inference/probe.py similarity index 62% rename from src/gcore/types/cloud/container_probe.py rename to src/gcore/types/cloud/inference/probe.py index 9dcc3746..952ee734 100644 --- a/src/gcore/types/cloud/container_probe.py +++ b/src/gcore/types/cloud/inference/probe.py @@ -2,22 +2,22 @@ from typing import Optional -from ..._models import BaseModel -from .container_probe_exec import ContainerProbeExec -from .container_probe_http_get import ContainerProbeHTTPGet -from .container_probe_tcp_socket import ContainerProbeTcpSocket +from ...._models import BaseModel +from .probe_exec import ProbeExec +from .probe_http_get import ProbeHTTPGet +from .probe_tcp_socket import ProbeTcpSocket -__all__ = ["ContainerProbe"] +__all__ = ["Probe"] -class ContainerProbe(BaseModel): - exec: Optional[ContainerProbeExec] = None +class Probe(BaseModel): + exec: Optional[ProbeExec] = None """Exec probe configuration""" failure_threshold: int """The number of consecutive probe failures that mark the container as unhealthy.""" - http_get: Optional[ContainerProbeHTTPGet] = None + http_get: Optional[ProbeHTTPGet] = None """HTTP GET probe configuration""" initial_delay_seconds: int @@ -29,7 +29,7 @@ class ContainerProbe(BaseModel): success_threshold: int """The number of consecutive successful probes that mark the container as healthy.""" - tcp_socket: Optional[ContainerProbeTcpSocket] = None + tcp_socket: Optional[ProbeTcpSocket] = None """TCP socket probe configuration""" timeout_seconds: int diff --git a/src/gcore/types/cloud/container_probe_config.py b/src/gcore/types/cloud/inference/probe_config.py similarity index 56% rename from src/gcore/types/cloud/container_probe_config.py rename to src/gcore/types/cloud/inference/probe_config.py index 00e01044..c4bc9eb5 100644 --- a/src/gcore/types/cloud/container_probe_config.py +++ b/src/gcore/types/cloud/inference/probe_config.py @@ -2,15 +2,15 @@ from typing import Optional -from ..._models import BaseModel -from .container_probe import ContainerProbe +from .probe import Probe +from ...._models import BaseModel -__all__ = ["ContainerProbeConfig"] +__all__ = ["ProbeConfig"] -class ContainerProbeConfig(BaseModel): +class ProbeConfig(BaseModel): enabled: bool """Whether the probe is enabled or not.""" - probe: Optional[ContainerProbe] = None + probe: Optional[Probe] = None """Probe configuration (exec, `http_get` or `tcp_socket`)""" diff --git a/src/gcore/types/cloud/container_probe_exec.py b/src/gcore/types/cloud/inference/probe_exec.py similarity index 66% rename from src/gcore/types/cloud/container_probe_exec.py rename to src/gcore/types/cloud/inference/probe_exec.py index 5d8f7c4b..8d5291f6 100644 --- a/src/gcore/types/cloud/container_probe_exec.py +++ b/src/gcore/types/cloud/inference/probe_exec.py @@ -2,11 +2,11 @@ from typing import List -from ..._models import BaseModel +from ...._models import BaseModel -__all__ = ["ContainerProbeExec"] +__all__ = ["ProbeExec"] -class ContainerProbeExec(BaseModel): +class ProbeExec(BaseModel): command: List[str] """Command to be executed inside the running container.""" diff --git a/src/gcore/types/cloud/container_probe_http_get.py b/src/gcore/types/cloud/inference/probe_http_get.py similarity index 83% rename from src/gcore/types/cloud/container_probe_http_get.py rename to src/gcore/types/cloud/inference/probe_http_get.py index a5e30713..081300f4 100644 --- a/src/gcore/types/cloud/container_probe_http_get.py +++ b/src/gcore/types/cloud/inference/probe_http_get.py @@ -4,12 +4,12 @@ from pydantic import Field as FieldInfo -from ..._models import BaseModel +from ...._models import BaseModel -__all__ = ["ContainerProbeHTTPGet"] +__all__ = ["ProbeHTTPGet"] -class ContainerProbeHTTPGet(BaseModel): +class ProbeHTTPGet(BaseModel): headers: Dict[str, str] """HTTP headers to be sent with the request.""" diff --git a/src/gcore/types/cloud/container_probe_tcp_socket.py b/src/gcore/types/cloud/inference/probe_tcp_socket.py similarity index 56% rename from src/gcore/types/cloud/container_probe_tcp_socket.py rename to src/gcore/types/cloud/inference/probe_tcp_socket.py index 91c73c79..9dbfd869 100644 --- a/src/gcore/types/cloud/container_probe_tcp_socket.py +++ b/src/gcore/types/cloud/inference/probe_tcp_socket.py @@ -1,10 +1,10 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from ..._models import BaseModel +from ...._models import BaseModel -__all__ = ["ContainerProbeTcpSocket"] +__all__ = ["ProbeTcpSocket"] -class ContainerProbeTcpSocket(BaseModel): +class ProbeTcpSocket(BaseModel): port: int """Port number to check if it's open.""" diff --git a/src/gcore/types/cloud/inference/secret_create_params.py b/src/gcore/types/cloud/inference/secret_create_params.py index 1852b8ea..b4bc1a92 100644 --- a/src/gcore/types/cloud/inference/secret_create_params.py +++ b/src/gcore/types/cloud/inference/secret_create_params.py @@ -4,16 +4,14 @@ from typing_extensions import Required, TypedDict -from ..aws_iam_data_param import AwsIamDataParam - -__all__ = ["SecretCreateParams"] +__all__ = ["SecretCreateParams", "Data"] class SecretCreateParams(TypedDict, total=False): project_id: int """Project ID""" - data: Required[AwsIamDataParam] + data: Required[Data] """Secret data.""" name: Required[str] @@ -21,3 +19,11 @@ class SecretCreateParams(TypedDict, total=False): type: Required[str] """Secret type. Currently only `aws-iam` is supported.""" + + +class Data(TypedDict, total=False): + aws_access_key_id: Required[str] + """AWS IAM key ID.""" + + aws_secret_access_key: Required[str] + """AWS IAM secret key.""" diff --git a/src/gcore/types/cloud/inference/secret_replace_params.py b/src/gcore/types/cloud/inference/secret_replace_params.py index b0ebbdfc..cc4fc67f 100644 --- a/src/gcore/types/cloud/inference/secret_replace_params.py +++ b/src/gcore/types/cloud/inference/secret_replace_params.py @@ -4,17 +4,23 @@ from typing_extensions import Required, TypedDict -from ..aws_iam_data_param import AwsIamDataParam - -__all__ = ["SecretReplaceParams"] +__all__ = ["SecretReplaceParams", "Data"] class SecretReplaceParams(TypedDict, total=False): project_id: int """Project ID""" - data: Required[AwsIamDataParam] + data: Required[Data] """Secret data.""" type: Required[str] """Secret type.""" + + +class Data(TypedDict, total=False): + aws_access_key_id: Required[str] + """AWS IAM key ID.""" + + aws_secret_access_key: Required[str] + """AWS IAM secret key.""" diff --git a/src/gcore/types/cloud/inference_probes.py b/src/gcore/types/cloud/inference_probes.py deleted file mode 100644 index 93b13259..00000000 --- a/src/gcore/types/cloud/inference_probes.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel -from .container_probe_config import ContainerProbeConfig - -__all__ = ["InferenceProbes"] - - -class InferenceProbes(BaseModel): - liveness_probe: Optional[ContainerProbeConfig] = None - """Liveness probe configuration""" - - readiness_probe: Optional[ContainerProbeConfig] = None - """Readiness probe configuration""" - - startup_probe: Optional[ContainerProbeConfig] = None - """Startup probe configuration""" diff --git a/src/gcore/types/cloud/region_capacity.py b/src/gcore/types/cloud/inference_region_capacity.py similarity index 54% rename from src/gcore/types/cloud/region_capacity.py rename to src/gcore/types/cloud/inference_region_capacity.py index 6d84da43..a10e2d6a 100644 --- a/src/gcore/types/cloud/region_capacity.py +++ b/src/gcore/types/cloud/inference_region_capacity.py @@ -2,13 +2,20 @@ from typing import List -from .capacity import Capacity from ..._models import BaseModel -__all__ = ["RegionCapacity"] +__all__ = ["InferenceRegionCapacity", "Capacity"] -class RegionCapacity(BaseModel): +class Capacity(BaseModel): + capacity: int + """Available capacity.""" + + flavor_name: str + """Flavor name.""" + + +class InferenceRegionCapacity(BaseModel): capacity: List[Capacity] """List of capacities by flavor.""" diff --git a/src/gcore/types/cloud/region_capacity_list.py b/src/gcore/types/cloud/inference_region_capacity_list.py similarity index 51% rename from src/gcore/types/cloud/region_capacity_list.py rename to src/gcore/types/cloud/inference_region_capacity_list.py index decc0299..7bfd6ca1 100644 --- a/src/gcore/types/cloud/region_capacity_list.py +++ b/src/gcore/types/cloud/inference_region_capacity_list.py @@ -3,14 +3,14 @@ from typing import List from ..._models import BaseModel -from .region_capacity import RegionCapacity +from .inference_region_capacity import InferenceRegionCapacity -__all__ = ["RegionCapacityList"] +__all__ = ["InferenceRegionCapacityList"] -class RegionCapacityList(BaseModel): +class InferenceRegionCapacityList(BaseModel): count: int """Number of objects""" - results: List[RegionCapacity] + results: List[InferenceRegionCapacity] """Objects""" diff --git a/src/gcore/types/cloud/ingress_opts_out.py b/src/gcore/types/cloud/ingress_opts_out.py deleted file mode 100644 index a360ccde..00000000 --- a/src/gcore/types/cloud/ingress_opts_out.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["IngressOptsOut"] - - -class IngressOptsOut(BaseModel): - disable_response_buffering: bool - """Disable response buffering if true. - - A client usually has a much slower connection and can not consume the response - data as fast as it is produced by an upstream application. Ingress tries to - buffer the whole response in order to release the upstream application as soon - as possible.By default, the response buffering is enabled. - """ diff --git a/src/gcore/types/cloud/ingress_opts_param.py b/src/gcore/types/cloud/ingress_opts_param.py deleted file mode 100644 index 2ea98546..00000000 --- a/src/gcore/types/cloud/ingress_opts_param.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["IngressOptsParam"] - - -class IngressOptsParam(TypedDict, total=False): - disable_response_buffering: bool - """Disable response buffering if true. - - A client usually has a much slower connection and can not consume the response - data as fast as it is produced by an upstream application. Ingress tries to - buffer the whole response in order to release the upstream application as soon - as possible.By default, the response buffering is enabled. - """ diff --git a/tests/api_resources/cloud/inference/deployments/test_logs.py b/tests/api_resources/cloud/inference/deployments/test_logs.py index 19fdaf11..154af80c 100644 --- a/tests/api_resources/cloud/inference/deployments/test_logs.py +++ b/tests/api_resources/cloud/inference/deployments/test_logs.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.inference import InferenceLog +from gcore.types.cloud.inference.deployments import InferenceDeploymentLog base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Gcore) -> None: deployment_name="my-instance", project_id=1, ) - assert_matches_type(SyncOffsetPage[InferenceLog], log, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceDeploymentLog], log, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -36,7 +36,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: order_by="time.asc", region_id=1, ) - assert_matches_type(SyncOffsetPage[InferenceLog], log, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceDeploymentLog], log, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -48,7 +48,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" log = response.parse() - assert_matches_type(SyncOffsetPage[InferenceLog], log, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceDeploymentLog], log, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -60,7 +60,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" log = response.parse() - assert_matches_type(SyncOffsetPage[InferenceLog], log, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceDeploymentLog], log, path=["response"]) assert cast(Any, response.is_closed) is True @@ -84,7 +84,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: deployment_name="my-instance", project_id=1, ) - assert_matches_type(AsyncOffsetPage[InferenceLog], log, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceDeploymentLog], log, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -96,7 +96,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No order_by="time.asc", region_id=1, ) - assert_matches_type(AsyncOffsetPage[InferenceLog], log, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceDeploymentLog], log, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -108,7 +108,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" log = await response.parse() - assert_matches_type(AsyncOffsetPage[InferenceLog], log, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceDeploymentLog], log, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -120,7 +120,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" log = await response.parse() - assert_matches_type(AsyncOffsetPage[InferenceLog], log, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceDeploymentLog], log, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/inference/test_deployments.py b/tests/api_resources/cloud/inference/test_deployments.py index ad310970..8baf3dcd 100644 --- a/tests/api_resources/cloud/inference/test_deployments.py +++ b/tests/api_resources/cloud/inference/test_deployments.py @@ -12,8 +12,8 @@ from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud import TaskIDList from gcore.types.cloud.inference import ( - Inference, - InferenceApikeySecret, + InferenceDeployment, + InferenceDeploymentAPIKey, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -373,7 +373,7 @@ def test_method_list(self, client: Gcore) -> None: deployment = client.cloud.inference.deployments.list( project_id=1, ) - assert_matches_type(SyncOffsetPage[Inference], deployment, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceDeployment], deployment, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -382,7 +382,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: limit=1000, offset=0, ) - assert_matches_type(SyncOffsetPage[Inference], deployment, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceDeployment], deployment, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -393,7 +393,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(SyncOffsetPage[Inference], deployment, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceDeployment], deployment, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -404,7 +404,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(SyncOffsetPage[Inference], deployment, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceDeployment], deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -456,7 +456,7 @@ def test_method_get(self, client: Gcore) -> None: deployment_name="my-instance", project_id=1, ) - assert_matches_type(Inference, deployment, path=["response"]) + assert_matches_type(InferenceDeployment, deployment, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -468,7 +468,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(Inference, deployment, path=["response"]) + assert_matches_type(InferenceDeployment, deployment, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -480,7 +480,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(Inference, deployment, path=["response"]) + assert_matches_type(InferenceDeployment, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -498,7 +498,7 @@ def test_method_get_api_key(self, client: Gcore) -> None: deployment_name="my-instance", project_id=1, ) - assert_matches_type(InferenceApikeySecret, deployment, path=["response"]) + assert_matches_type(InferenceDeploymentAPIKey, deployment, path=["response"]) @parametrize def test_raw_response_get_api_key(self, client: Gcore) -> None: @@ -510,7 +510,7 @@ def test_raw_response_get_api_key(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(InferenceApikeySecret, deployment, path=["response"]) + assert_matches_type(InferenceDeploymentAPIKey, deployment, path=["response"]) @parametrize def test_streaming_response_get_api_key(self, client: Gcore) -> None: @@ -522,7 +522,7 @@ def test_streaming_response_get_api_key(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(InferenceApikeySecret, deployment, path=["response"]) + assert_matches_type(InferenceDeploymentAPIKey, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -975,7 +975,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: deployment = await async_client.cloud.inference.deployments.list( project_id=1, ) - assert_matches_type(AsyncOffsetPage[Inference], deployment, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceDeployment], deployment, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -984,7 +984,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No limit=1000, offset=0, ) - assert_matches_type(AsyncOffsetPage[Inference], deployment, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceDeployment], deployment, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -995,7 +995,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(AsyncOffsetPage[Inference], deployment, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceDeployment], deployment, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -1006,7 +1006,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(AsyncOffsetPage[Inference], deployment, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceDeployment], deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1058,7 +1058,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: deployment_name="my-instance", project_id=1, ) - assert_matches_type(Inference, deployment, path=["response"]) + assert_matches_type(InferenceDeployment, deployment, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -1070,7 +1070,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(Inference, deployment, path=["response"]) + assert_matches_type(InferenceDeployment, deployment, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -1082,7 +1082,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(Inference, deployment, path=["response"]) + assert_matches_type(InferenceDeployment, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1100,7 +1100,7 @@ async def test_method_get_api_key(self, async_client: AsyncGcore) -> None: deployment_name="my-instance", project_id=1, ) - assert_matches_type(InferenceApikeySecret, deployment, path=["response"]) + assert_matches_type(InferenceDeploymentAPIKey, deployment, path=["response"]) @parametrize async def test_raw_response_get_api_key(self, async_client: AsyncGcore) -> None: @@ -1112,7 +1112,7 @@ async def test_raw_response_get_api_key(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(InferenceApikeySecret, deployment, path=["response"]) + assert_matches_type(InferenceDeploymentAPIKey, deployment, path=["response"]) @parametrize async def test_streaming_response_get_api_key(self, async_client: AsyncGcore) -> None: @@ -1124,7 +1124,7 @@ async def test_streaming_response_get_api_key(self, async_client: AsyncGcore) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(InferenceApikeySecret, deployment, path=["response"]) + assert_matches_type(InferenceDeploymentAPIKey, deployment, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/inference/test_models.py b/tests/api_resources/cloud/inference/test_models.py index d0f08a50..cde90416 100644 --- a/tests/api_resources/cloud/inference/test_models.py +++ b/tests/api_resources/cloud/inference/test_models.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.inference import MlcatalogModelCard +from gcore.types.cloud.inference import InferenceModel base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,16 +21,16 @@ class TestModels: @parametrize def test_method_list(self, client: Gcore) -> None: model = client.cloud.inference.models.list() - assert_matches_type(SyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceModel], model, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: model = client.cloud.inference.models.list( limit=1000, offset=0, - order_by="name.asc", + order_by="name.desc", ) - assert_matches_type(SyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceModel], model, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -39,7 +39,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" model = response.parse() - assert_matches_type(SyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceModel], model, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -48,7 +48,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" model = response.parse() - assert_matches_type(SyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceModel], model, path=["response"]) assert cast(Any, response.is_closed) is True @@ -57,7 +57,7 @@ def test_method_get(self, client: Gcore) -> None: model = client.cloud.inference.models.get( "model_id", ) - assert_matches_type(MlcatalogModelCard, model, path=["response"]) + assert_matches_type(InferenceModel, model, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -68,7 +68,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" model = response.parse() - assert_matches_type(MlcatalogModelCard, model, path=["response"]) + assert_matches_type(InferenceModel, model, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -79,7 +79,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" model = response.parse() - assert_matches_type(MlcatalogModelCard, model, path=["response"]) + assert_matches_type(InferenceModel, model, path=["response"]) assert cast(Any, response.is_closed) is True @@ -99,16 +99,16 @@ class TestAsyncModels: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: model = await async_client.cloud.inference.models.list() - assert_matches_type(AsyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceModel], model, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: model = await async_client.cloud.inference.models.list( limit=1000, offset=0, - order_by="name.asc", + order_by="name.desc", ) - assert_matches_type(AsyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceModel], model, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -117,7 +117,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" model = await response.parse() - assert_matches_type(AsyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceModel], model, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -126,7 +126,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" model = await response.parse() - assert_matches_type(AsyncOffsetPage[MlcatalogModelCard], model, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceModel], model, path=["response"]) assert cast(Any, response.is_closed) is True @@ -135,7 +135,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: model = await async_client.cloud.inference.models.get( "model_id", ) - assert_matches_type(MlcatalogModelCard, model, path=["response"]) + assert_matches_type(InferenceModel, model, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -146,7 +146,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" model = await response.parse() - assert_matches_type(MlcatalogModelCard, model, path=["response"]) + assert_matches_type(InferenceModel, model, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -157,7 +157,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" model = await response.parse() - assert_matches_type(MlcatalogModelCard, model, path=["response"]) + assert_matches_type(InferenceModel, model, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/inference/test_registry_credentials.py b/tests/api_resources/cloud/inference/test_registry_credentials.py index e7f4b0d5..2e745474 100644 --- a/tests/api_resources/cloud/inference/test_registry_credentials.py +++ b/tests/api_resources/cloud/inference/test_registry_credentials.py @@ -11,8 +11,8 @@ from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud.inference import ( - InferenceRegistryCredential, - InferenceRegistryCredentialFull, + InferenceRegistryCredentials, + InferenceRegistryCredentialsCreate, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +30,7 @@ def test_method_create(self, client: Gcore) -> None: registry_url="registry.example.com", username="username", ) - assert_matches_type(InferenceRegistryCredentialFull, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -45,7 +45,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" registry_credential = response.parse() - assert_matches_type(InferenceRegistryCredentialFull, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -60,7 +60,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = response.parse() - assert_matches_type(InferenceRegistryCredentialFull, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +69,7 @@ def test_method_list(self, client: Gcore) -> None: registry_credential = client.cloud.inference.registry_credentials.list( project_id=1, ) - assert_matches_type(SyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceRegistryCredentials], registry_credential, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -78,7 +78,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: limit=1000, offset=0, ) - assert_matches_type(SyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceRegistryCredentials], registry_credential, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -89,7 +89,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = response.parse() - assert_matches_type(SyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceRegistryCredentials], registry_credential, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -100,7 +100,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = response.parse() - assert_matches_type(SyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + assert_matches_type(SyncOffsetPage[InferenceRegistryCredentials], registry_credential, path=["response"]) assert cast(Any, response.is_closed) is True @@ -152,7 +152,7 @@ def test_method_get(self, client: Gcore) -> None: credential_name="docker-io", project_id=1, ) - assert_matches_type(InferenceRegistryCredential, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -164,7 +164,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = response.parse() - assert_matches_type(InferenceRegistryCredential, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -176,7 +176,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = response.parse() - assert_matches_type(InferenceRegistryCredential, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) assert cast(Any, response.is_closed) is True @@ -257,7 +257,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: registry_url="registry.example.com", username="username", ) - assert_matches_type(InferenceRegistryCredentialFull, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -272,7 +272,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" registry_credential = await response.parse() - assert_matches_type(InferenceRegistryCredentialFull, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -287,7 +287,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = await response.parse() - assert_matches_type(InferenceRegistryCredentialFull, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) assert cast(Any, response.is_closed) is True @@ -296,7 +296,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: registry_credential = await async_client.cloud.inference.registry_credentials.list( project_id=1, ) - assert_matches_type(AsyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceRegistryCredentials], registry_credential, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -305,7 +305,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No limit=1000, offset=0, ) - assert_matches_type(AsyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceRegistryCredentials], registry_credential, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -316,7 +316,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = await response.parse() - assert_matches_type(AsyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceRegistryCredentials], registry_credential, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -327,7 +327,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = await response.parse() - assert_matches_type(AsyncOffsetPage[InferenceRegistryCredential], registry_credential, path=["response"]) + assert_matches_type(AsyncOffsetPage[InferenceRegistryCredentials], registry_credential, path=["response"]) assert cast(Any, response.is_closed) is True @@ -379,7 +379,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: credential_name="docker-io", project_id=1, ) - assert_matches_type(InferenceRegistryCredential, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -391,7 +391,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = await response.parse() - assert_matches_type(InferenceRegistryCredential, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -403,7 +403,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = await response.parse() - assert_matches_type(InferenceRegistryCredential, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_inference.py b/tests/api_resources/cloud/test_inference.py index b16c0068..e9ab9978 100644 --- a/tests/api_resources/cloud/test_inference.py +++ b/tests/api_resources/cloud/test_inference.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import RegionCapacityList +from gcore.types.cloud import InferenceRegionCapacityList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,7 +20,7 @@ class TestInference: @parametrize def test_method_get_capacity_by_region(self, client: Gcore) -> None: inference = client.cloud.inference.get_capacity_by_region() - assert_matches_type(RegionCapacityList, inference, path=["response"]) + assert_matches_type(InferenceRegionCapacityList, inference, path=["response"]) @parametrize def test_raw_response_get_capacity_by_region(self, client: Gcore) -> None: @@ -29,7 +29,7 @@ def test_raw_response_get_capacity_by_region(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" inference = response.parse() - assert_matches_type(RegionCapacityList, inference, path=["response"]) + assert_matches_type(InferenceRegionCapacityList, inference, path=["response"]) @parametrize def test_streaming_response_get_capacity_by_region(self, client: Gcore) -> None: @@ -38,7 +38,7 @@ def test_streaming_response_get_capacity_by_region(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" inference = response.parse() - assert_matches_type(RegionCapacityList, inference, path=["response"]) + assert_matches_type(InferenceRegionCapacityList, inference, path=["response"]) assert cast(Any, response.is_closed) is True @@ -51,7 +51,7 @@ class TestAsyncInference: @parametrize async def test_method_get_capacity_by_region(self, async_client: AsyncGcore) -> None: inference = await async_client.cloud.inference.get_capacity_by_region() - assert_matches_type(RegionCapacityList, inference, path=["response"]) + assert_matches_type(InferenceRegionCapacityList, inference, path=["response"]) @parametrize async def test_raw_response_get_capacity_by_region(self, async_client: AsyncGcore) -> None: @@ -60,7 +60,7 @@ async def test_raw_response_get_capacity_by_region(self, async_client: AsyncGcor assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" inference = await response.parse() - assert_matches_type(RegionCapacityList, inference, path=["response"]) + assert_matches_type(InferenceRegionCapacityList, inference, path=["response"]) @parametrize async def test_streaming_response_get_capacity_by_region(self, async_client: AsyncGcore) -> None: @@ -69,6 +69,6 @@ async def test_streaming_response_get_capacity_by_region(self, async_client: Asy assert response.http_request.headers.get("X-Stainless-Lang") == "python" inference = await response.parse() - assert_matches_type(RegionCapacityList, inference, path=["response"]) + assert_matches_type(InferenceRegionCapacityList, inference, path=["response"]) assert cast(Any, response.is_closed) is True From e59abda2f11f85dc5b2d8282fb391c7ab691adf8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Jul 2025 14:11:26 +0000 Subject: [PATCH 193/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../inference/deployments/deployments.py | 42 +++++++++++++++++-- .../inference/deployment_create_params.py | 11 ++++- .../inference/deployment_update_params.py | 12 +++++- .../cloud/inference/inference_deployment.py | 3 ++ .../cloud/inference/test_deployments.py | 4 ++ 6 files changed, 68 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index bab5e31b..3c484c58 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 309 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a3eb777ed002489583f1ec680d7ac5638c4bf54a843d381a1c1ad5d1c9f5e967.yml -openapi_spec_hash: 3e4993495b21ba44b2969cc41cdb1221 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-096f1e72ce426ac0f8676ae634782d7f01990a972f0d958b7a3751a3337dfae8.yml +openapi_spec_hash: aa16fd3697e2cbe1035bd5ab6eb9ed2c config_hash: d7989761296bd1ae012daf7f0f53685d diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index e3ad72d8..6a9cbbb9 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -67,6 +67,7 @@ def create( image: str, listening_port: int, name: str, + api_keys: List[str] | NotGiven = NOT_GIVEN, auth_enabled: bool | NotGiven = NOT_GIVEN, command: Optional[List[str]] | NotGiven = NOT_GIVEN, credentials_name: Optional[str] | NotGiven = NOT_GIVEN, @@ -102,9 +103,15 @@ def create( name: Inference instance name. + api_keys: List of API keys for the inference instance. Multiple keys can be attached to + one deployment.If `auth_enabled` and `api_keys` are both specified, a + ValidationError will be raised. + auth_enabled: Set to `true` to enable API key authentication for the inference instance. `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required - for the requests to the instance if enabled + for the requests to the instance if enabled. This field is deprecated and will + be removed in the future. Use `api_keys` field instead.If `auth_enabled` and + `api_keys` are both specified, a ValidationError will be raised. command: Command to be executed when running a container from an image. @@ -147,6 +154,7 @@ def create( "image": image, "listening_port": listening_port, "name": name, + "api_keys": api_keys, "auth_enabled": auth_enabled, "command": command, "credentials_name": credentials_name, @@ -170,6 +178,7 @@ def update( deployment_name: str, *, project_id: int | None = None, + api_keys: Optional[List[str]] | NotGiven = NOT_GIVEN, auth_enabled: bool | NotGiven = NOT_GIVEN, command: Optional[List[str]] | NotGiven = NOT_GIVEN, containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, @@ -198,9 +207,16 @@ def update( deployment_name: Inference instance name. + api_keys: List of API keys for the inference instance. Multiple keys can be attached to + one deployment.If `auth_enabled` and `api_keys` are both specified, a + ValidationError will be raised.If `[]` is provided, the API keys will be removed + and auth will be disabled on the deployment. + auth_enabled: Set to `true` to enable API key authentication for the inference instance. `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required - for the requests to the instance if enabled + for the requests to the instance if enabled. This field is deprecated and will + be removed in the future. Use `api_keys` field instead.If `auth_enabled` and + `api_keys` are both specified, a ValidationError will be raised. command: Command to be executed when running a container from an image. @@ -249,6 +265,7 @@ def update( f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=maybe_transform( { + "api_keys": api_keys, "auth_enabled": auth_enabled, "command": command, "containers": containers, @@ -575,6 +592,7 @@ async def create( image: str, listening_port: int, name: str, + api_keys: List[str] | NotGiven = NOT_GIVEN, auth_enabled: bool | NotGiven = NOT_GIVEN, command: Optional[List[str]] | NotGiven = NOT_GIVEN, credentials_name: Optional[str] | NotGiven = NOT_GIVEN, @@ -610,9 +628,15 @@ async def create( name: Inference instance name. + api_keys: List of API keys for the inference instance. Multiple keys can be attached to + one deployment.If `auth_enabled` and `api_keys` are both specified, a + ValidationError will be raised. + auth_enabled: Set to `true` to enable API key authentication for the inference instance. `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required - for the requests to the instance if enabled + for the requests to the instance if enabled. This field is deprecated and will + be removed in the future. Use `api_keys` field instead.If `auth_enabled` and + `api_keys` are both specified, a ValidationError will be raised. command: Command to be executed when running a container from an image. @@ -655,6 +679,7 @@ async def create( "image": image, "listening_port": listening_port, "name": name, + "api_keys": api_keys, "auth_enabled": auth_enabled, "command": command, "credentials_name": credentials_name, @@ -678,6 +703,7 @@ async def update( deployment_name: str, *, project_id: int | None = None, + api_keys: Optional[List[str]] | NotGiven = NOT_GIVEN, auth_enabled: bool | NotGiven = NOT_GIVEN, command: Optional[List[str]] | NotGiven = NOT_GIVEN, containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, @@ -706,9 +732,16 @@ async def update( deployment_name: Inference instance name. + api_keys: List of API keys for the inference instance. Multiple keys can be attached to + one deployment.If `auth_enabled` and `api_keys` are both specified, a + ValidationError will be raised.If `[]` is provided, the API keys will be removed + and auth will be disabled on the deployment. + auth_enabled: Set to `true` to enable API key authentication for the inference instance. `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required - for the requests to the instance if enabled + for the requests to the instance if enabled. This field is deprecated and will + be removed in the future. Use `api_keys` field instead.If `auth_enabled` and + `api_keys` are both specified, a ValidationError will be raised. command: Command to be executed when running a container from an image. @@ -757,6 +790,7 @@ async def update( f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { + "api_keys": api_keys, "auth_enabled": auth_enabled, "command": command, "containers": containers, diff --git a/src/gcore/types/cloud/inference/deployment_create_params.py b/src/gcore/types/cloud/inference/deployment_create_params.py index 801a770b..38dfafb4 100644 --- a/src/gcore/types/cloud/inference/deployment_create_params.py +++ b/src/gcore/types/cloud/inference/deployment_create_params.py @@ -64,11 +64,20 @@ class DeploymentCreateParams(TypedDict, total=False): name: Required[str] """Inference instance name.""" + api_keys: List[str] + """List of API keys for the inference instance. + + Multiple keys can be attached to one deployment.If `auth_enabled` and `api_keys` + are both specified, a ValidationError will be raised. + """ + auth_enabled: bool """Set to `true` to enable API key authentication for the inference instance. `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required - for the requests to the instance if enabled + for the requests to the instance if enabled. This field is deprecated and will + be removed in the future. Use `api_keys` field instead.If `auth_enabled` and + `api_keys` are both specified, a ValidationError will be raised. """ command: Optional[List[str]] diff --git a/src/gcore/types/cloud/inference/deployment_update_params.py b/src/gcore/types/cloud/inference/deployment_update_params.py index 5a4a0bd7..e23312d9 100644 --- a/src/gcore/types/cloud/inference/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -44,11 +44,21 @@ class DeploymentUpdateParams(TypedDict, total=False): project_id: int """Project ID""" + api_keys: Optional[List[str]] + """List of API keys for the inference instance. + + Multiple keys can be attached to one deployment.If `auth_enabled` and `api_keys` + are both specified, a ValidationError will be raised.If `[]` is provided, the + API keys will be removed and auth will be disabled on the deployment. + """ + auth_enabled: bool """Set to `true` to enable API key authentication for the inference instance. `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required - for the requests to the instance if enabled + for the requests to the instance if enabled. This field is deprecated and will + be removed in the future. Use `api_keys` field instead.If `auth_enabled` and + `api_keys` are both specified, a ValidationError will be raised. """ command: Optional[List[str]] diff --git a/src/gcore/types/cloud/inference/inference_deployment.py b/src/gcore/types/cloud/inference/inference_deployment.py index 4b64c717..189b5d4c 100644 --- a/src/gcore/types/cloud/inference/inference_deployment.py +++ b/src/gcore/types/cloud/inference/inference_deployment.py @@ -249,3 +249,6 @@ class InferenceDeployment(BaseModel): `scale.min`. If set, this helps in optimizing resource usage by reducing the number of container instances during periods of inactivity. """ + + api_keys: Optional[List[str]] = None + """List of API keys for the inference instance""" diff --git a/tests/api_resources/cloud/inference/test_deployments.py b/tests/api_resources/cloud/inference/test_deployments.py index 8baf3dcd..7090d25d 100644 --- a/tests/api_resources/cloud/inference/test_deployments.py +++ b/tests/api_resources/cloud/inference/test_deployments.py @@ -81,6 +81,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: image="nginx:latest", listening_port=80, name="my-instance", + api_keys=["key1", "key2"], auth_enabled=False, command=["nginx", "-g", "daemon off;"], credentials_name="dockerhub", @@ -222,6 +223,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: deployment = client.cloud.inference.deployments.update( deployment_name="my-instance", project_id=1, + api_keys=["key1", "key2"], auth_enabled=False, command=["nginx", "-g", "daemon off;"], containers=[ @@ -683,6 +685,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> image="nginx:latest", listening_port=80, name="my-instance", + api_keys=["key1", "key2"], auth_enabled=False, command=["nginx", "-g", "daemon off;"], credentials_name="dockerhub", @@ -824,6 +827,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> deployment = await async_client.cloud.inference.deployments.update( deployment_name="my-instance", project_id=1, + api_keys=["key1", "key2"], auth_enabled=False, command=["nginx", "-g", "daemon off;"], containers=[ From e4ab6e610a7ebfbe6edcb7fd09f40a3829e12354 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 14:10:39 +0000 Subject: [PATCH 194/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3c484c58..aeb6f9fc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 309 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-096f1e72ce426ac0f8676ae634782d7f01990a972f0d958b7a3751a3337dfae8.yml -openapi_spec_hash: aa16fd3697e2cbe1035bd5ab6eb9ed2c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-01118bf60aae85a6414fbce552350c8330c9161426b534be5cb75a13b5911160.yml +openapi_spec_hash: ad50facb69ca2ada4614a3cacf823ef8 config_hash: d7989761296bd1ae012daf7f0f53685d From 6f1bdb3e4ce30b338ca308b5907bd4b72bd1cdea Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 02:40:24 +0000 Subject: [PATCH 195/592] chore(internal): bump pinned h11 dep --- requirements-dev.lock | 4 ++-- requirements.lock | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 87a71d74..85513c5a 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -48,9 +48,9 @@ filelock==3.12.4 frozenlist==1.6.2 # via aiohttp # via aiosignal -h11==0.14.0 +h11==0.16.0 # via httpcore -httpcore==1.0.2 +httpcore==1.0.9 # via httpx httpx==0.28.1 # via gcore diff --git a/requirements.lock b/requirements.lock index 1af17cde..db09fdd3 100644 --- a/requirements.lock +++ b/requirements.lock @@ -36,9 +36,9 @@ exceptiongroup==1.2.2 frozenlist==1.6.2 # via aiohttp # via aiosignal -h11==0.14.0 +h11==0.16.0 # via httpcore -httpcore==1.0.2 +httpcore==1.0.9 # via httpx httpx==0.28.1 # via gcore From 1019ae844e4c0c543da67bca4d4bccd7d4c59863 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 02:59:37 +0000 Subject: [PATCH 196/592] chore(package): mark python 3.13 as supported --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 94b0198a..3736d540 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Operating System :: OS Independent", "Operating System :: POSIX", "Operating System :: MacOS", From 91f4eded80cb1edd4f2b5a70fd3815fc62fce9dd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 17:49:33 +0000 Subject: [PATCH 197/592] feat(api): manual upload of aggregated API specs --- .stats.yml | 4 ++-- src/gcore/resources/cloud/baremetal/servers.py | 4 ++-- .../cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py | 4 ++-- src/gcore/resources/cloud/instances/instances.py | 4 ++-- src/gcore/types/cloud/baremetal/server_create_params.py | 2 +- src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py | 2 +- src/gcore/types/cloud/instance_create_params.py | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index aeb6f9fc..f5e74250 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 309 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-01118bf60aae85a6414fbce552350c8330c9161426b534be5cb75a13b5911160.yml -openapi_spec_hash: ad50facb69ca2ada4614a3cacf823ef8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2ee3dfd0a184a9bc73cd05030936d9d11319c023692b48933ad356ddfc114fa1.yml +openapi_spec_hash: fd4e8cbebd6fbf3c970afc74e33f32b9 config_hash: d7989761296bd1ae012daf7f0f53685d diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 0a9601b7..088b6321 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -126,7 +126,7 @@ def create( password of the Admin user cannot be updated via '`user_data`'. ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -485,7 +485,7 @@ async def create( password of the Admin user cannot be updated via '`user_data`'. ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 733b5770..9812fcd2 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -144,7 +144,7 @@ def create( instance ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -614,7 +614,7 @@ async def create( instance ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 4859c14a..3fd3e8a7 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -198,7 +198,7 @@ def create( sharing if needed. ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -1212,7 +1212,7 @@ async def create( sharing if needed. ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index 3b9981b3..e6afbd0b 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -84,7 +84,7 @@ class ServerCreateParams(TypedDict, total=False): ssh_key_name: Optional[str] """ Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). """ tags: Dict[str, str] 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 7a82c03b..12018f17 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -51,7 +51,7 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): ssh_key_name: str """ Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). """ tags: Dict[str, str] diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index 0f16aa79..6d84dc51 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -109,7 +109,7 @@ class InstanceCreateParams(TypedDict, total=False): ssh_key_name: Optional[str] """ Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key). + [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). """ tags: Dict[str, str] From e78e4b5797cccb77bbb6615eb13d2ad3d2960219 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Jul 2025 03:08:55 +0000 Subject: [PATCH 198/592] fix(parsing): correctly handle nested discriminated unions --- src/gcore/_models.py | 13 ++++++++----- tests/test_models.py | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/gcore/_models.py b/src/gcore/_models.py index 4f214980..528d5680 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -2,9 +2,10 @@ import os import inspect -from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast +from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast from datetime import date, datetime from typing_extensions import ( + List, Unpack, Literal, ClassVar, @@ -366,7 +367,7 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: if type_ is None: raise RuntimeError(f"Unexpected field type is None for {key}") - return construct_type(value=value, type_=type_) + return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None)) def is_basemodel(type_: type) -> bool: @@ -420,7 +421,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T: return cast(_T, construct_type(value=value, type_=type_)) -def construct_type(*, value: object, type_: object) -> object: +def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object: """Loose coercion to the expected type with construction of nested values. If the given value does not match the expected type then it is returned as-is. @@ -438,8 +439,10 @@ def construct_type(*, value: object, type_: object) -> object: type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` - if is_annotated_type(type_): - meta: tuple[Any, ...] = get_args(type_)[1:] + if metadata is not None: + meta: tuple[Any, ...] = tuple(metadata) + elif is_annotated_type(type_): + meta = get_args(type_)[1:] type_ = extract_type_arg(type_, 0) else: meta = tuple() diff --git a/tests/test_models.py b/tests/test_models.py index a153f19b..c5eb9599 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -889,3 +889,48 @@ class ModelB(BaseModel): ) assert isinstance(m, ModelB) + + +def test_nested_discriminated_union() -> None: + class InnerType1(BaseModel): + type: Literal["type_1"] + + class InnerModel(BaseModel): + inner_value: str + + class InnerType2(BaseModel): + type: Literal["type_2"] + some_inner_model: InnerModel + + class Type1(BaseModel): + base_type: Literal["base_type_1"] + value: Annotated[ + Union[ + InnerType1, + InnerType2, + ], + PropertyInfo(discriminator="type"), + ] + + class Type2(BaseModel): + base_type: Literal["base_type_2"] + + T = Annotated[ + Union[ + Type1, + Type2, + ], + PropertyInfo(discriminator="base_type"), + ] + + model = construct_type( + type_=T, + value={ + "base_type": "base_type_1", + "value": { + "type": "type_2", + }, + }, + ) + assert isinstance(model, Type1) + assert isinstance(model.value, InnerType2) From 0eda9165fe29eb51e31cedc44817215f713cc83a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Jul 2025 12:15:13 +0000 Subject: [PATCH 199/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f5e74250..9bf7616a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 309 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2ee3dfd0a184a9bc73cd05030936d9d11319c023692b48933ad356ddfc114fa1.yml -openapi_spec_hash: fd4e8cbebd6fbf3c970afc74e33f32b9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d8eb7bb5b3e242272f346e382d0100e4a1ddaca2fcb62be618af39dc913d5cd6.yml +openapi_spec_hash: 94a6e014e5bc359b2554ad3bad1ff59b config_hash: d7989761296bd1ae012daf7f0f53685d From d95711f376d4c2fd2a7c70d003c5d0bd582308a1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Jul 2025 14:18:00 +0000 Subject: [PATCH 200/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9bf7616a..724423e4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 309 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d8eb7bb5b3e242272f346e382d0100e4a1ddaca2fcb62be618af39dc913d5cd6.yml -openapi_spec_hash: 94a6e014e5bc359b2554ad3bad1ff59b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8fcee4b6e612c0aaed2afbda3a161dcab07b93b934c9e21ade9051996568a4ff.yml +openapi_spec_hash: 042d388f4c7c9ef9d9b2ad9897e0356c config_hash: d7989761296bd1ae012daf7f0f53685d From 687e4119597a553bdb12a41d3ed1de646d11e8dd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 03:13:48 +0000 Subject: [PATCH 201/592] chore(readme): fix version rendering on pypi --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8fff56e2..9198c0b9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Gcore Python API library -[![PyPI version]()](https://pypi.org/project/gcore/) + +[![PyPI version](https://img.shields.io/pypi/v/gcore.svg?label=pypi%20(stable))](https://pypi.org/project/gcore/) The Gcore Python library provides convenient access to the Gcore REST API from any Python 3.8+ application. The library includes type definitions for all request params and response fields, From 40225d5f0d866c7358497424d36f97f3c9acee8a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 09:53:45 +0000 Subject: [PATCH 202/592] feat(api): manual updates --- .stats.yml | 4 +- api.md | 5 +- src/gcore/resources/cloud/secrets.py | 238 ++---------------- src/gcore/types/cloud/__init__.py | 2 - src/gcore/types/cloud/secret_create_params.py | 66 ----- src/gcore/types/cloud/secret_list_response.py | 16 -- tests/api_resources/cloud/test_secrets.py | 169 +------------ 7 files changed, 28 insertions(+), 472 deletions(-) delete mode 100644 src/gcore/types/cloud/secret_create_params.py delete mode 100644 src/gcore/types/cloud/secret_list_response.py diff --git a/.stats.yml b/.stats.yml index 724423e4..70c79a71 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 309 +configured_endpoints: 308 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8fcee4b6e612c0aaed2afbda3a161dcab07b93b934c9e21ade9051996568a4ff.yml openapi_spec_hash: 042d388f4c7c9ef9d9b2ad9897e0356c -config_hash: d7989761296bd1ae012daf7f0f53685d +config_hash: 110ecf3b5cb2edbcab0b11d9354efe41 diff --git a/api.md b/api.md index 7edd31ee..e3e118e9 100644 --- a/api.md +++ b/api.md @@ -134,13 +134,12 @@ Methods: Types: ```python -from gcore.types.cloud import Secret, SecretListResponse +from gcore.types.cloud import Secret ``` Methods: -- client.cloud.secrets.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.secrets.list(\*, project_id, region_id, \*\*params) -> SecretListResponse +- client.cloud.secrets.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Secret] - client.cloud.secrets.delete(secret_id, \*, project_id, region_id) -> TaskIDList - client.cloud.secrets.get(secret_id, \*, project_id, region_id) -> Secret - client.cloud.secrets.upload_tls_certificate(\*, project_id, region_id, \*\*params) -> TaskIDList diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index c02861a2..5cbefb25 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -2,10 +2,8 @@ from __future__ import annotations -import typing_extensions -from typing import Union, Optional +from typing import Union from datetime import datetime -from typing_extensions import Literal import httpx @@ -19,11 +17,11 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...types.cloud import secret_list_params, secret_create_params, secret_upload_tls_certificate_params -from ..._base_client import make_request_options +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ...types.cloud import secret_list_params, secret_upload_tls_certificate_params +from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.secret import Secret from ...types.cloud.task_id_list import TaskIDList -from ...types.cloud.secret_list_response import SecretListResponse __all__ = ["SecretsResource", "AsyncSecretsResource"] @@ -48,101 +46,6 @@ def with_streaming_response(self) -> SecretsResourceWithStreamingResponse: """ return SecretsResourceWithStreamingResponse(self) - @typing_extensions.deprecated("deprecated") - def create( - self, - *, - project_id: int | None = None, - region_id: int | None = None, - name: str, - payload: str, - payload_content_encoding: Literal["base64"], - payload_content_type: str, - secret_type: Literal["certificate", "opaque", "passphrase", "private", "public", "symmetric"], - algorithm: Optional[str] | NotGiven = NOT_GIVEN, - bit_length: Optional[int] | NotGiven = NOT_GIVEN, - expiration: Optional[str] | NotGiven = NOT_GIVEN, - mode: Optional[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TaskIDList: - """ - Create secret - - Args: - project_id: Project ID - - region_id: Region ID - - name: Secret name - - payload: Secret payload. For HTTPS-terminated load balancing, provide base64 encoded - conents of a PKCS12 file. The PKCS12 file is the combined TLS certificate, key, - and intermediate certificate chain obtained from an external certificate - authority. The file can be created via openssl, e.g.'openssl pkcs12 -export - -inkey server.key -in server.crt -certfile ca-chain.crt -passout pass: -out - server.p12'The key and certificate should be PEM-encoded, and the intermediate - certificate chain should be multiple PEM-encoded certs concatenated together - - payload_content_encoding: The encoding used for the payload to be able to include it in the JSON request. - Currently only base64 is supported - - payload_content_type: The media type for the content of the payload - - secret_type: Secret type. symmetric - Used for storing byte arrays such as keys suitable for - symmetric encryption; public - Used for storing the public key of an asymmetric - keypair; private - Used for storing the private key of an asymmetric keypair; - passphrase - Used for storing plain text passphrases; certificate - Used for - storing cryptographic certificates such as X.509 certificates; opaque - Used for - backwards compatibility with previous versions of the API - - algorithm: Metadata provided by a user or system for informational purposes. - - bit_length: Metadata provided by a user or system for informational purposes. Value must be - greater than zero. - - expiration: Datetime when the secret will expire. - - mode: Metadata provided by a user or system for informational purposes. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - return self._post( - f"/cloud/v1/secrets/{project_id}/{region_id}", - body=maybe_transform( - { - "name": name, - "payload": payload, - "payload_content_encoding": payload_content_encoding, - "payload_content_type": payload_content_type, - "secret_type": secret_type, - "algorithm": algorithm, - "bit_length": bit_length, - "expiration": expiration, - "mode": mode, - }, - secret_create_params.SecretCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - def list( self, *, @@ -156,7 +59,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretListResponse: + ) -> SyncOffsetPage[Secret]: """ List secrets @@ -182,8 +85,9 @@ def list( project_id = self._client._get_cloud_project_id_path_param() if region_id is None: region_id = self._client._get_cloud_region_id_path_param() - return self._get( + return self._get_api_list( f"/cloud/v1/secrets/{project_id}/{region_id}", + page=SyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -197,7 +101,7 @@ def list( secret_list_params.SecretListParams, ), ), - cast_to=SecretListResponse, + model=Secret, ) def delete( @@ -368,102 +272,7 @@ def with_streaming_response(self) -> AsyncSecretsResourceWithStreamingResponse: """ return AsyncSecretsResourceWithStreamingResponse(self) - @typing_extensions.deprecated("deprecated") - async def create( - self, - *, - project_id: int | None = None, - region_id: int | None = None, - name: str, - payload: str, - payload_content_encoding: Literal["base64"], - payload_content_type: str, - secret_type: Literal["certificate", "opaque", "passphrase", "private", "public", "symmetric"], - algorithm: Optional[str] | NotGiven = NOT_GIVEN, - bit_length: Optional[int] | NotGiven = NOT_GIVEN, - expiration: Optional[str] | NotGiven = NOT_GIVEN, - mode: Optional[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TaskIDList: - """ - Create secret - - Args: - project_id: Project ID - - region_id: Region ID - - name: Secret name - - payload: Secret payload. For HTTPS-terminated load balancing, provide base64 encoded - conents of a PKCS12 file. The PKCS12 file is the combined TLS certificate, key, - and intermediate certificate chain obtained from an external certificate - authority. The file can be created via openssl, e.g.'openssl pkcs12 -export - -inkey server.key -in server.crt -certfile ca-chain.crt -passout pass: -out - server.p12'The key and certificate should be PEM-encoded, and the intermediate - certificate chain should be multiple PEM-encoded certs concatenated together - - payload_content_encoding: The encoding used for the payload to be able to include it in the JSON request. - Currently only base64 is supported - - payload_content_type: The media type for the content of the payload - - secret_type: Secret type. symmetric - Used for storing byte arrays such as keys suitable for - symmetric encryption; public - Used for storing the public key of an asymmetric - keypair; private - Used for storing the private key of an asymmetric keypair; - passphrase - Used for storing plain text passphrases; certificate - Used for - storing cryptographic certificates such as X.509 certificates; opaque - Used for - backwards compatibility with previous versions of the API - - algorithm: Metadata provided by a user or system for informational purposes. - - bit_length: Metadata provided by a user or system for informational purposes. Value must be - greater than zero. - - expiration: Datetime when the secret will expire. - - mode: Metadata provided by a user or system for informational purposes. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - return await self._post( - f"/cloud/v1/secrets/{project_id}/{region_id}", - body=await async_maybe_transform( - { - "name": name, - "payload": payload, - "payload_content_encoding": payload_content_encoding, - "payload_content_type": payload_content_type, - "secret_type": secret_type, - "algorithm": algorithm, - "bit_length": bit_length, - "expiration": expiration, - "mode": mode, - }, - secret_create_params.SecretCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - async def list( + def list( self, *, project_id: int | None = None, @@ -476,7 +285,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SecretListResponse: + ) -> AsyncPaginator[Secret, AsyncOffsetPage[Secret]]: """ List secrets @@ -502,14 +311,15 @@ async def list( project_id = self._client._get_cloud_project_id_path_param() if region_id is None: region_id = self._client._get_cloud_region_id_path_param() - return await self._get( + return self._get_api_list( f"/cloud/v1/secrets/{project_id}/{region_id}", + page=AsyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "limit": limit, "offset": offset, @@ -517,7 +327,7 @@ async def list( secret_list_params.SecretListParams, ), ), - cast_to=SecretListResponse, + model=Secret, ) async def delete( @@ -672,11 +482,6 @@ class SecretsResourceWithRawResponse: def __init__(self, secrets: SecretsResource) -> None: self._secrets = secrets - self.create = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - secrets.create # pyright: ignore[reportDeprecated], - ) - ) self.list = to_raw_response_wrapper( secrets.list, ) @@ -695,11 +500,6 @@ class AsyncSecretsResourceWithRawResponse: def __init__(self, secrets: AsyncSecretsResource) -> None: self._secrets = secrets - self.create = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - secrets.create # pyright: ignore[reportDeprecated], - ) - ) self.list = async_to_raw_response_wrapper( secrets.list, ) @@ -718,11 +518,6 @@ class SecretsResourceWithStreamingResponse: def __init__(self, secrets: SecretsResource) -> None: self._secrets = secrets - self.create = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - secrets.create # pyright: ignore[reportDeprecated], - ) - ) self.list = to_streamed_response_wrapper( secrets.list, ) @@ -741,11 +536,6 @@ class AsyncSecretsResourceWithStreamingResponse: def __init__(self, secrets: AsyncSecretsResource) -> None: self._secrets = secrets - self.create = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - secrets.create # pyright: ignore[reportDeprecated], - ) - ) self.list = async_to_streamed_response_wrapper( secrets.list, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 2cb80a14..050b0536 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -75,8 +75,6 @@ from .lb_listener_protocol import LbListenerProtocol as LbListenerProtocol from .load_balancer_status import LoadBalancerStatus as LoadBalancerStatus from .placement_group_list import PlacementGroupList as PlacementGroupList -from .secret_create_params import SecretCreateParams as SecretCreateParams -from .secret_list_response import SecretListResponse as SecretListResponse from .tag_update_map_param import TagUpdateMapParam as TagUpdateMapParam from .volume_create_params import VolumeCreateParams as VolumeCreateParams from .volume_delete_params import VolumeDeleteParams as VolumeDeleteParams diff --git a/src/gcore/types/cloud/secret_create_params.py b/src/gcore/types/cloud/secret_create_params.py deleted file mode 100644 index c8b2afaa..00000000 --- a/src/gcore/types/cloud/secret_create_params.py +++ /dev/null @@ -1,66 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["SecretCreateParams"] - - -class SecretCreateParams(TypedDict, total=False): - project_id: int - """Project ID""" - - region_id: int - """Region ID""" - - name: Required[str] - """Secret name""" - - payload: Required[str] - """Secret payload. - - For HTTPS-terminated load balancing, provide base64 encoded conents of a PKCS12 - file. The PKCS12 file is the combined TLS certificate, key, and intermediate - certificate chain obtained from an external certificate authority. The file can - be created via openssl, e.g.'openssl pkcs12 -export -inkey server.key -in - server.crt -certfile ca-chain.crt -passout pass: -out server.p12'The key and - certificate should be PEM-encoded, and the intermediate certificate chain should - be multiple PEM-encoded certs concatenated together - """ - - payload_content_encoding: Required[Literal["base64"]] - """The encoding used for the payload to be able to include it in the JSON request. - - Currently only base64 is supported - """ - - payload_content_type: Required[str] - """The media type for the content of the payload""" - - secret_type: Required[Literal["certificate", "opaque", "passphrase", "private", "public", "symmetric"]] - """Secret type. - - symmetric - Used for storing byte arrays such as keys suitable for symmetric - encryption; public - Used for storing the public key of an asymmetric keypair; - private - Used for storing the private key of an asymmetric keypair; - passphrase - Used for storing plain text passphrases; certificate - Used for - storing cryptographic certificates such as X.509 certificates; opaque - Used for - backwards compatibility with previous versions of the API - """ - - algorithm: Optional[str] - """Metadata provided by a user or system for informational purposes.""" - - bit_length: Optional[int] - """Metadata provided by a user or system for informational purposes. - - Value must be greater than zero. - """ - - expiration: Optional[str] - """Datetime when the secret will expire.""" - - mode: Optional[str] - """Metadata provided by a user or system for informational purposes.""" diff --git a/src/gcore/types/cloud/secret_list_response.py b/src/gcore/types/cloud/secret_list_response.py deleted file mode 100644 index b6680c6c..00000000 --- a/src/gcore/types/cloud/secret_list_response.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .secret import Secret -from ..._models import BaseModel - -__all__ = ["SecretListResponse"] - - -class SecretListResponse(BaseModel): - count: int - """Number of objects""" - - results: List[Secret] - """Objects""" diff --git a/tests/api_resources/cloud/test_secrets.py b/tests/api_resources/cloud/test_secrets.py index 61efb25b..2563b0f7 100644 --- a/tests/api_resources/cloud/test_secrets.py +++ b/tests/api_resources/cloud/test_secrets.py @@ -10,13 +10,8 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore._utils import parse_datetime -from gcore.types.cloud import ( - Secret, - TaskIDList, - SecretListResponse, -) - -# pyright: reportDeprecated=false +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import Secret, TaskIDList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,85 +19,13 @@ class TestSecrets: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @parametrize - def test_method_create(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - secret = client.cloud.secrets.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - ) - - assert_matches_type(TaskIDList, secret, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - secret = client.cloud.secrets.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - algorithm="aes", - bit_length=256, - expiration="2025-12-28T19:14:44.180394", - mode="cbc", - ) - - assert_matches_type(TaskIDList, secret, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.cloud.secrets.with_raw_response.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - secret = response.parse() - assert_matches_type(TaskIDList, secret, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.cloud.secrets.with_streaming_response.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - secret = response.parse() - assert_matches_type(TaskIDList, secret, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize def test_method_list(self, client: Gcore) -> None: secret = client.cloud.secrets.list( project_id=1, region_id=1, ) - assert_matches_type(SecretListResponse, secret, path=["response"]) + assert_matches_type(SyncOffsetPage[Secret], secret, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -112,7 +35,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: limit=1000, offset=0, ) - assert_matches_type(SecretListResponse, secret, path=["response"]) + assert_matches_type(SyncOffsetPage[Secret], secret, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -124,7 +47,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = response.parse() - assert_matches_type(SecretListResponse, secret, path=["response"]) + assert_matches_type(SyncOffsetPage[Secret], secret, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -136,7 +59,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = response.parse() - assert_matches_type(SecretListResponse, secret, path=["response"]) + assert_matches_type(SyncOffsetPage[Secret], secret, path=["response"]) assert cast(Any, response.is_closed) is True @@ -305,85 +228,13 @@ class TestAsyncSecrets: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @parametrize - async def test_method_create(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - secret = await async_client.cloud.secrets.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - ) - - assert_matches_type(TaskIDList, secret, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - secret = await async_client.cloud.secrets.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - algorithm="aes", - bit_length=256, - expiration="2025-12-28T19:14:44.180394", - mode="cbc", - ) - - assert_matches_type(TaskIDList, secret, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.cloud.secrets.with_raw_response.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - secret = await response.parse() - assert_matches_type(TaskIDList, secret, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.cloud.secrets.with_streaming_response.create( - project_id=1, - region_id=1, - name="AES key", - payload="aGVsbG8sIHRlc3Qgc3RyaW5nCg==", - payload_content_encoding="base64", - payload_content_type="application/octet-stream", - secret_type="certificate", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - secret = await response.parse() - assert_matches_type(TaskIDList, secret, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: secret = await async_client.cloud.secrets.list( project_id=1, region_id=1, ) - assert_matches_type(SecretListResponse, secret, path=["response"]) + assert_matches_type(AsyncOffsetPage[Secret], secret, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -393,7 +244,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No limit=1000, offset=0, ) - assert_matches_type(SecretListResponse, secret, path=["response"]) + assert_matches_type(AsyncOffsetPage[Secret], secret, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -405,7 +256,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = await response.parse() - assert_matches_type(SecretListResponse, secret, path=["response"]) + assert_matches_type(AsyncOffsetPage[Secret], secret, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -417,7 +268,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" secret = await response.parse() - assert_matches_type(SecretListResponse, secret, path=["response"]) + assert_matches_type(AsyncOffsetPage[Secret], secret, path=["response"]) assert cast(Any, response.is_closed) is True From fa45cb00cc2a37e0eeff0f7bc5fa2595f4733687 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 17:50:34 +0000 Subject: [PATCH 203/592] feat(fastedge): add api --- .stats.yml | 4 +- api.md | 128 +++ src/gcore/_client.py | 9 + src/gcore/pagination.py | 193 +++- src/gcore/resources/__init__.py | 14 + src/gcore/resources/fastedge/__init__.py | 103 ++ src/gcore/resources/fastedge/apps/__init__.py | 33 + src/gcore/resources/fastedge/apps/apps.py | 932 ++++++++++++++++++ src/gcore/resources/fastedge/apps/logs.py | 248 +++++ src/gcore/resources/fastedge/binaries.py | 286 ++++++ src/gcore/resources/fastedge/fastedge.py | 327 ++++++ src/gcore/resources/fastedge/kv_stores.py | 523 ++++++++++ src/gcore/resources/fastedge/secrets.py | 687 +++++++++++++ src/gcore/resources/fastedge/statistics.py | 347 +++++++ src/gcore/resources/fastedge/templates.py | 652 ++++++++++++ src/gcore/types/fastedge/__init__.py | 48 + src/gcore/types/fastedge/app.py | 81 ++ src/gcore/types/fastedge/app_create_params.py | 56 ++ src/gcore/types/fastedge/app_list_params.py | 50 + src/gcore/types/fastedge/app_param.py | 56 ++ .../types/fastedge/app_replace_params.py | 17 + src/gcore/types/fastedge/app_short.py | 60 ++ src/gcore/types/fastedge/app_update_params.py | 56 ++ src/gcore/types/fastedge/apps/__init__.py | 6 + src/gcore/types/fastedge/apps/log.py | 28 + .../types/fastedge/apps/log_list_params.py | 37 + src/gcore/types/fastedge/binary.py | 40 + .../types/fastedge/binary_list_response.py | 12 + src/gcore/types/fastedge/binary_short.py | 32 + src/gcore/types/fastedge/call_status.py | 24 + src/gcore/types/fastedge/client.py | 57 ++ src/gcore/types/fastedge/duration_stats.py | 30 + src/gcore/types/fastedge/kv_store.py | 33 + .../types/fastedge/kv_store_create_params.py | 23 + .../types/fastedge/kv_store_get_response.py | 10 + .../types/fastedge/kv_store_list_params.py | 12 + .../types/fastedge/kv_store_list_response.py | 15 + .../types/fastedge/kv_store_replace_params.py | 23 + src/gcore/types/fastedge/kv_store_short.py | 19 + src/gcore/types/fastedge/kv_store_stats.py | 26 + src/gcore/types/fastedge/secret.py | 29 + .../types/fastedge/secret_create_params.py | 27 + .../types/fastedge/secret_create_response.py | 12 + .../types/fastedge/secret_delete_params.py | 12 + .../types/fastedge/secret_list_params.py | 15 + .../types/fastedge/secret_list_response.py | 12 + .../types/fastedge/secret_replace_params.py | 27 + src/gcore/types/fastedge/secret_short.py | 21 + .../types/fastedge/secret_update_params.py | 27 + .../statistic_get_call_series_params.py | 28 + .../statistic_get_call_series_response.py | 12 + .../statistic_get_duration_series_params.py | 28 + .../statistic_get_duration_series_response.py | 12 + src/gcore/types/fastedge/template.py | 31 + .../types/fastedge/template_create_params.py | 30 + .../types/fastedge/template_delete_params.py | 12 + .../types/fastedge/template_list_params.py | 25 + .../types/fastedge/template_parameter.py | 22 + .../fastedge/template_parameter_param.py | 21 + .../types/fastedge/template_replace_params.py | 30 + src/gcore/types/fastedge/template_short.py | 27 + tests/api_resources/fastedge/__init__.py | 1 + tests/api_resources/fastedge/apps/__init__.py | 1 + .../api_resources/fastedge/apps/test_logs.py | 118 +++ tests/api_resources/fastedge/test_apps.py | 570 +++++++++++ tests/api_resources/fastedge/test_binaries.py | 198 ++++ .../api_resources/fastedge/test_kv_stores.py | 374 +++++++ tests/api_resources/fastedge/test_secrets.py | 514 ++++++++++ .../api_resources/fastedge/test_statistics.py | 220 +++++ .../api_resources/fastedge/test_templates.py | 554 +++++++++++ tests/api_resources/test_fastedge.py | 74 ++ 71 files changed, 8418 insertions(+), 3 deletions(-) create mode 100644 src/gcore/resources/fastedge/__init__.py create mode 100644 src/gcore/resources/fastedge/apps/__init__.py create mode 100644 src/gcore/resources/fastedge/apps/apps.py create mode 100644 src/gcore/resources/fastedge/apps/logs.py create mode 100644 src/gcore/resources/fastedge/binaries.py create mode 100644 src/gcore/resources/fastedge/fastedge.py create mode 100644 src/gcore/resources/fastedge/kv_stores.py create mode 100644 src/gcore/resources/fastedge/secrets.py create mode 100644 src/gcore/resources/fastedge/statistics.py create mode 100644 src/gcore/resources/fastedge/templates.py create mode 100644 src/gcore/types/fastedge/__init__.py create mode 100644 src/gcore/types/fastedge/app.py create mode 100644 src/gcore/types/fastedge/app_create_params.py create mode 100644 src/gcore/types/fastedge/app_list_params.py create mode 100644 src/gcore/types/fastedge/app_param.py create mode 100644 src/gcore/types/fastedge/app_replace_params.py create mode 100644 src/gcore/types/fastedge/app_short.py create mode 100644 src/gcore/types/fastedge/app_update_params.py create mode 100644 src/gcore/types/fastedge/apps/__init__.py create mode 100644 src/gcore/types/fastedge/apps/log.py create mode 100644 src/gcore/types/fastedge/apps/log_list_params.py create mode 100644 src/gcore/types/fastedge/binary.py create mode 100644 src/gcore/types/fastedge/binary_list_response.py create mode 100644 src/gcore/types/fastedge/binary_short.py create mode 100644 src/gcore/types/fastedge/call_status.py create mode 100644 src/gcore/types/fastedge/client.py create mode 100644 src/gcore/types/fastedge/duration_stats.py create mode 100644 src/gcore/types/fastedge/kv_store.py create mode 100644 src/gcore/types/fastedge/kv_store_create_params.py create mode 100644 src/gcore/types/fastedge/kv_store_get_response.py create mode 100644 src/gcore/types/fastedge/kv_store_list_params.py create mode 100644 src/gcore/types/fastedge/kv_store_list_response.py create mode 100644 src/gcore/types/fastedge/kv_store_replace_params.py create mode 100644 src/gcore/types/fastedge/kv_store_short.py create mode 100644 src/gcore/types/fastedge/kv_store_stats.py create mode 100644 src/gcore/types/fastedge/secret.py create mode 100644 src/gcore/types/fastedge/secret_create_params.py create mode 100644 src/gcore/types/fastedge/secret_create_response.py create mode 100644 src/gcore/types/fastedge/secret_delete_params.py create mode 100644 src/gcore/types/fastedge/secret_list_params.py create mode 100644 src/gcore/types/fastedge/secret_list_response.py create mode 100644 src/gcore/types/fastedge/secret_replace_params.py create mode 100644 src/gcore/types/fastedge/secret_short.py create mode 100644 src/gcore/types/fastedge/secret_update_params.py create mode 100644 src/gcore/types/fastedge/statistic_get_call_series_params.py create mode 100644 src/gcore/types/fastedge/statistic_get_call_series_response.py create mode 100644 src/gcore/types/fastedge/statistic_get_duration_series_params.py create mode 100644 src/gcore/types/fastedge/statistic_get_duration_series_response.py create mode 100644 src/gcore/types/fastedge/template.py create mode 100644 src/gcore/types/fastedge/template_create_params.py create mode 100644 src/gcore/types/fastedge/template_delete_params.py create mode 100644 src/gcore/types/fastedge/template_list_params.py create mode 100644 src/gcore/types/fastedge/template_parameter.py create mode 100644 src/gcore/types/fastedge/template_parameter_param.py create mode 100644 src/gcore/types/fastedge/template_replace_params.py create mode 100644 src/gcore/types/fastedge/template_short.py create mode 100644 tests/api_resources/fastedge/__init__.py create mode 100644 tests/api_resources/fastedge/apps/__init__.py create mode 100644 tests/api_resources/fastedge/apps/test_logs.py create mode 100644 tests/api_resources/fastedge/test_apps.py create mode 100644 tests/api_resources/fastedge/test_binaries.py create mode 100644 tests/api_resources/fastedge/test_kv_stores.py create mode 100644 tests/api_resources/fastedge/test_secrets.py create mode 100644 tests/api_resources/fastedge/test_statistics.py create mode 100644 tests/api_resources/fastedge/test_templates.py create mode 100644 tests/api_resources/test_fastedge.py diff --git a/.stats.yml b/.stats.yml index 70c79a71..113520b7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 308 +configured_endpoints: 337 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8fcee4b6e612c0aaed2afbda3a161dcab07b93b934c9e21ade9051996568a4ff.yml openapi_spec_hash: 042d388f4c7c9ef9d9b2ad9897e0356c -config_hash: 110ecf3b5cb2edbcab0b11d9354efe41 +config_hash: 75a2b72caefaa0a5917618c9a426e79b diff --git a/api.md b/api.md index e3e118e9..a77c6d3d 100644 --- a/api.md +++ b/api.md @@ -1191,3 +1191,131 @@ Methods: - client.iam.users.delete(user_id, \*, client_id) -> None - client.iam.users.get(user_id) -> UserDetailed - client.iam.users.invite(\*\*params) -> UserInvite + +# Fastedge + +Types: + +```python +from gcore.types.fastedge import Client +``` + +Methods: + +- client.fastedge.get_account_overview() -> Client + +## Templates + +Types: + +```python +from gcore.types.fastedge import Template, TemplateParameter, TemplateShort +``` + +Methods: + +- client.fastedge.templates.create(\*\*params) -> TemplateShort +- client.fastedge.templates.list(\*\*params) -> SyncOffsetPageFastedgeTemplates[TemplateShort] +- client.fastedge.templates.delete(id, \*\*params) -> None +- client.fastedge.templates.get(id) -> Template +- client.fastedge.templates.replace(id, \*\*params) -> TemplateShort + +## Secrets + +Types: + +```python +from gcore.types.fastedge import Secret, SecretShort, SecretCreateResponse, SecretListResponse +``` + +Methods: + +- client.fastedge.secrets.create(\*\*params) -> SecretCreateResponse +- client.fastedge.secrets.update(id, \*\*params) -> Secret +- client.fastedge.secrets.list(\*\*params) -> SecretListResponse +- client.fastedge.secrets.delete(id, \*\*params) -> None +- client.fastedge.secrets.get(id) -> Secret +- client.fastedge.secrets.replace(id, \*\*params) -> Secret + +## Binaries + +Types: + +```python +from gcore.types.fastedge import Binary, BinaryShort, BinaryListResponse +``` + +Methods: + +- client.fastedge.binaries.list() -> BinaryListResponse +- client.fastedge.binaries.delete(id) -> None +- client.fastedge.binaries.get(id) -> Binary + +## Statistics + +Types: + +```python +from gcore.types.fastedge import ( + CallStatus, + DurationStats, + StatisticGetCallSeriesResponse, + StatisticGetDurationSeriesResponse, +) +``` + +Methods: + +- client.fastedge.statistics.get_call_series(\*\*params) -> StatisticGetCallSeriesResponse +- client.fastedge.statistics.get_duration_series(\*\*params) -> StatisticGetDurationSeriesResponse + +## Apps + +Types: + +```python +from gcore.types.fastedge import App, AppShort +``` + +Methods: + +- client.fastedge.apps.create(\*\*params) -> AppShort +- client.fastedge.apps.update(id, \*\*params) -> AppShort +- client.fastedge.apps.list(\*\*params) -> SyncOffsetPageFastedgeApps[AppShort] +- client.fastedge.apps.delete(id) -> None +- client.fastedge.apps.get(id) -> App +- client.fastedge.apps.replace(id, \*\*params) -> AppShort + +### Logs + +Types: + +```python +from gcore.types.fastedge.apps import Log +``` + +Methods: + +- client.fastedge.apps.logs.list(id, \*\*params) -> SyncOffsetPageFastedgeAppLogs[Log] + +## KvStores + +Types: + +```python +from gcore.types.fastedge import ( + KvStore, + KvStoreShort, + KvStoreStats, + KvStoreListResponse, + KvStoreGetResponse, +) +``` + +Methods: + +- client.fastedge.kv_stores.create(\*\*params) -> KvStore +- client.fastedge.kv_stores.list(\*\*params) -> KvStoreListResponse +- client.fastedge.kv_stores.delete(id) -> None +- client.fastedge.kv_stores.get(id) -> KvStoreGetResponse +- client.fastedge.kv_stores.replace(id, \*\*params) -> KvStore diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 05954d6f..c009debf 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -31,6 +31,7 @@ from .resources.iam import iam from .resources.waap import waap from .resources.cloud import cloud +from .resources.fastedge import fastedge __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Gcore", "AsyncGcore", "Client", "AsyncClient"] @@ -39,6 +40,7 @@ class Gcore(SyncAPIClient): cloud: cloud.CloudResource waap: waap.WaapResource iam: iam.IamResource + fastedge: fastedge.FastedgeResource with_raw_response: GcoreWithRawResponse with_streaming_response: GcoreWithStreamedResponse @@ -120,6 +122,7 @@ def __init__( self.cloud = cloud.CloudResource(self) self.waap = waap.WaapResource(self) self.iam = iam.IamResource(self) + self.fastedge = fastedge.FastedgeResource(self) self.with_raw_response = GcoreWithRawResponse(self) self.with_streaming_response = GcoreWithStreamedResponse(self) @@ -256,6 +259,7 @@ class AsyncGcore(AsyncAPIClient): cloud: cloud.AsyncCloudResource waap: waap.AsyncWaapResource iam: iam.AsyncIamResource + fastedge: fastedge.AsyncFastedgeResource with_raw_response: AsyncGcoreWithRawResponse with_streaming_response: AsyncGcoreWithStreamedResponse @@ -337,6 +341,7 @@ def __init__( self.cloud = cloud.AsyncCloudResource(self) self.waap = waap.AsyncWaapResource(self) self.iam = iam.AsyncIamResource(self) + self.fastedge = fastedge.AsyncFastedgeResource(self) self.with_raw_response = AsyncGcoreWithRawResponse(self) self.with_streaming_response = AsyncGcoreWithStreamedResponse(self) @@ -474,6 +479,7 @@ def __init__(self, client: Gcore) -> None: self.cloud = cloud.CloudResourceWithRawResponse(client.cloud) self.waap = waap.WaapResourceWithRawResponse(client.waap) self.iam = iam.IamResourceWithRawResponse(client.iam) + self.fastedge = fastedge.FastedgeResourceWithRawResponse(client.fastedge) class AsyncGcoreWithRawResponse: @@ -481,6 +487,7 @@ def __init__(self, client: AsyncGcore) -> None: self.cloud = cloud.AsyncCloudResourceWithRawResponse(client.cloud) self.waap = waap.AsyncWaapResourceWithRawResponse(client.waap) self.iam = iam.AsyncIamResourceWithRawResponse(client.iam) + self.fastedge = fastedge.AsyncFastedgeResourceWithRawResponse(client.fastedge) class GcoreWithStreamedResponse: @@ -488,6 +495,7 @@ def __init__(self, client: Gcore) -> None: self.cloud = cloud.CloudResourceWithStreamingResponse(client.cloud) self.waap = waap.WaapResourceWithStreamingResponse(client.waap) self.iam = iam.IamResourceWithStreamingResponse(client.iam) + self.fastedge = fastedge.FastedgeResourceWithStreamingResponse(client.fastedge) class AsyncGcoreWithStreamedResponse: @@ -495,6 +503,7 @@ def __init__(self, client: AsyncGcore) -> None: self.cloud = cloud.AsyncCloudResourceWithStreamingResponse(client.cloud) self.waap = waap.AsyncWaapResourceWithStreamingResponse(client.waap) self.iam = iam.AsyncIamResourceWithStreamingResponse(client.iam) + self.fastedge = fastedge.AsyncFastedgeResourceWithStreamingResponse(client.fastedge) Client = Gcore diff --git a/src/gcore/pagination.py b/src/gcore/pagination.py index 870a0d3a..8ade3410 100644 --- a/src/gcore/pagination.py +++ b/src/gcore/pagination.py @@ -5,7 +5,18 @@ from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage -__all__ = ["SyncOffsetPage", "AsyncOffsetPage", "SyncOffsetPageIam", "AsyncOffsetPageIam"] +__all__ = [ + "SyncOffsetPage", + "AsyncOffsetPage", + "SyncOffsetPageIam", + "AsyncOffsetPageIam", + "SyncOffsetPageFastedgeApps", + "AsyncOffsetPageFastedgeApps", + "SyncOffsetPageFastedgeTemplates", + "AsyncOffsetPageFastedgeTemplates", + "SyncOffsetPageFastedgeAppLogs", + "AsyncOffsetPageFastedgeAppLogs", +] _T = TypeVar("_T") @@ -128,3 +139,183 @@ def next_page_info(self) -> Optional[PageInfo]: return PageInfo(params={"offset": current_count}) return None + + +class SyncOffsetPageFastedgeApps(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + apps: List[_T] + count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + apps = self.apps + if not apps: + return [] + return apps + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + count = self.count + if count is None: + return None + + if current_count < count: + return PageInfo(params={"offset": current_count}) + + return None + + +class AsyncOffsetPageFastedgeApps(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + apps: List[_T] + count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + apps = self.apps + if not apps: + return [] + return apps + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + count = self.count + if count is None: + return None + + if current_count < count: + return PageInfo(params={"offset": current_count}) + + return None + + +class SyncOffsetPageFastedgeTemplates(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + templates: List[_T] + count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + templates = self.templates + if not templates: + return [] + return templates + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + count = self.count + if count is None: + return None + + if current_count < count: + return PageInfo(params={"offset": current_count}) + + return None + + +class AsyncOffsetPageFastedgeTemplates(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + templates: List[_T] + count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + templates = self.templates + if not templates: + return [] + return templates + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + count = self.count + if count is None: + return None + + if current_count < count: + return PageInfo(params={"offset": current_count}) + + return None + + +class SyncOffsetPageFastedgeAppLogs(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + logs: List[_T] + total_count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + logs = self.logs + if not logs: + return [] + return logs + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + total_count = self.total_count + if total_count is None: + return None + + if current_count < total_count: + return PageInfo(params={"offset": current_count}) + + return None + + +class AsyncOffsetPageFastedgeAppLogs(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + logs: List[_T] + total_count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + logs = self.logs + if not logs: + return [] + return logs + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + total_count = self.total_count + if total_count is None: + return None + + if current_count < total_count: + return PageInfo(params={"offset": current_count}) + + return None diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py index ed8fc7da..49b65806 100644 --- a/src/gcore/resources/__init__.py +++ b/src/gcore/resources/__init__.py @@ -24,6 +24,14 @@ CloudResourceWithStreamingResponse, AsyncCloudResourceWithStreamingResponse, ) +from .fastedge import ( + FastedgeResource, + AsyncFastedgeResource, + FastedgeResourceWithRawResponse, + AsyncFastedgeResourceWithRawResponse, + FastedgeResourceWithStreamingResponse, + AsyncFastedgeResourceWithStreamingResponse, +) __all__ = [ "CloudResource", @@ -44,4 +52,10 @@ "AsyncIamResourceWithRawResponse", "IamResourceWithStreamingResponse", "AsyncIamResourceWithStreamingResponse", + "FastedgeResource", + "AsyncFastedgeResource", + "FastedgeResourceWithRawResponse", + "AsyncFastedgeResourceWithRawResponse", + "FastedgeResourceWithStreamingResponse", + "AsyncFastedgeResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/fastedge/__init__.py b/src/gcore/resources/fastedge/__init__.py new file mode 100644 index 00000000..b2597842 --- /dev/null +++ b/src/gcore/resources/fastedge/__init__.py @@ -0,0 +1,103 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .apps import ( + AppsResource, + AsyncAppsResource, + AppsResourceWithRawResponse, + AsyncAppsResourceWithRawResponse, + AppsResourceWithStreamingResponse, + AsyncAppsResourceWithStreamingResponse, +) +from .secrets import ( + SecretsResource, + AsyncSecretsResource, + SecretsResourceWithRawResponse, + AsyncSecretsResourceWithRawResponse, + SecretsResourceWithStreamingResponse, + AsyncSecretsResourceWithStreamingResponse, +) +from .binaries import ( + BinariesResource, + AsyncBinariesResource, + BinariesResourceWithRawResponse, + AsyncBinariesResourceWithRawResponse, + BinariesResourceWithStreamingResponse, + AsyncBinariesResourceWithStreamingResponse, +) +from .fastedge import ( + FastedgeResource, + AsyncFastedgeResource, + FastedgeResourceWithRawResponse, + AsyncFastedgeResourceWithRawResponse, + FastedgeResourceWithStreamingResponse, + AsyncFastedgeResourceWithStreamingResponse, +) +from .kv_stores import ( + KvStoresResource, + AsyncKvStoresResource, + KvStoresResourceWithRawResponse, + AsyncKvStoresResourceWithRawResponse, + KvStoresResourceWithStreamingResponse, + AsyncKvStoresResourceWithStreamingResponse, +) +from .templates import ( + TemplatesResource, + AsyncTemplatesResource, + TemplatesResourceWithRawResponse, + AsyncTemplatesResourceWithRawResponse, + TemplatesResourceWithStreamingResponse, + AsyncTemplatesResourceWithStreamingResponse, +) +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) + +__all__ = [ + "TemplatesResource", + "AsyncTemplatesResource", + "TemplatesResourceWithRawResponse", + "AsyncTemplatesResourceWithRawResponse", + "TemplatesResourceWithStreamingResponse", + "AsyncTemplatesResourceWithStreamingResponse", + "SecretsResource", + "AsyncSecretsResource", + "SecretsResourceWithRawResponse", + "AsyncSecretsResourceWithRawResponse", + "SecretsResourceWithStreamingResponse", + "AsyncSecretsResourceWithStreamingResponse", + "BinariesResource", + "AsyncBinariesResource", + "BinariesResourceWithRawResponse", + "AsyncBinariesResourceWithRawResponse", + "BinariesResourceWithStreamingResponse", + "AsyncBinariesResourceWithStreamingResponse", + "StatisticsResource", + "AsyncStatisticsResource", + "StatisticsResourceWithRawResponse", + "AsyncStatisticsResourceWithRawResponse", + "StatisticsResourceWithStreamingResponse", + "AsyncStatisticsResourceWithStreamingResponse", + "AppsResource", + "AsyncAppsResource", + "AppsResourceWithRawResponse", + "AsyncAppsResourceWithRawResponse", + "AppsResourceWithStreamingResponse", + "AsyncAppsResourceWithStreamingResponse", + "KvStoresResource", + "AsyncKvStoresResource", + "KvStoresResourceWithRawResponse", + "AsyncKvStoresResourceWithRawResponse", + "KvStoresResourceWithStreamingResponse", + "AsyncKvStoresResourceWithStreamingResponse", + "FastedgeResource", + "AsyncFastedgeResource", + "FastedgeResourceWithRawResponse", + "AsyncFastedgeResourceWithRawResponse", + "FastedgeResourceWithStreamingResponse", + "AsyncFastedgeResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/fastedge/apps/__init__.py b/src/gcore/resources/fastedge/apps/__init__.py new file mode 100644 index 00000000..fe734f02 --- /dev/null +++ b/src/gcore/resources/fastedge/apps/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .apps import ( + AppsResource, + AsyncAppsResource, + AppsResourceWithRawResponse, + AsyncAppsResourceWithRawResponse, + AppsResourceWithStreamingResponse, + AsyncAppsResourceWithStreamingResponse, +) +from .logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) + +__all__ = [ + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", + "AppsResource", + "AsyncAppsResource", + "AppsResourceWithRawResponse", + "AsyncAppsResourceWithRawResponse", + "AppsResourceWithStreamingResponse", + "AsyncAppsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py new file mode 100644 index 00000000..92d2662a --- /dev/null +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -0,0 +1,932 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal + +import httpx + +from .logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncOffsetPageFastedgeApps, AsyncOffsetPageFastedgeApps +from ...._base_client import AsyncPaginator, make_request_options +from ....types.fastedge import app_list_params, app_create_params, app_update_params, app_replace_params +from ....types.fastedge.app import App +from ....types.fastedge.app_short import AppShort + +__all__ = ["AppsResource", "AsyncAppsResource"] + + +class AppsResource(SyncAPIResource): + @cached_property + def logs(self) -> LogsResource: + return LogsResource(self._client) + + @cached_property + def with_raw_response(self) -> AppsResourceWithRawResponse: + """ + 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 AppsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AppsResourceWithStreamingResponse: + """ + 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 AppsResourceWithStreamingResponse(self) + + def create( + self, + *, + binary: int | NotGiven = NOT_GIVEN, + comment: str | NotGiven = NOT_GIVEN, + debug: bool | NotGiven = NOT_GIVEN, + env: Dict[str, str] | NotGiven = NOT_GIVEN, + log: Optional[Literal["kafka", "none"]] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + rsp_headers: Dict[str, str] | NotGiven = NOT_GIVEN, + secrets: Dict[str, app_create_params.Secrets] | NotGiven = NOT_GIVEN, + status: int | NotGiven = NOT_GIVEN, + stores: Dict[str, int] | NotGiven = NOT_GIVEN, + template: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AppShort: + """ + Add a new app + + Args: + binary: Binary ID + + comment: App description + + debug: Switch on logging for 30 minutes (switched off by default) + + env: Environment variables + + log: Logging channel (by default - kafka, which allows exploring logs with API) + + name: App name + + rsp_headers: Extra headers to add to the response + + secrets: Application secrets + + status: + Status code: + 0 - draft (inactive) + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + + stores: KV stores for the app + + template: Template ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/fastedge/v1/apps", + body=maybe_transform( + { + "binary": binary, + "comment": comment, + "debug": debug, + "env": env, + "log": log, + "name": name, + "rsp_headers": rsp_headers, + "secrets": secrets, + "status": status, + "stores": stores, + "template": template, + }, + app_create_params.AppCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AppShort, + ) + + def update( + self, + id: int, + *, + binary: int | NotGiven = NOT_GIVEN, + comment: str | NotGiven = NOT_GIVEN, + debug: bool | NotGiven = NOT_GIVEN, + env: Dict[str, str] | NotGiven = NOT_GIVEN, + log: Optional[Literal["kafka", "none"]] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + rsp_headers: Dict[str, str] | NotGiven = NOT_GIVEN, + secrets: Dict[str, app_update_params.Secrets] | NotGiven = NOT_GIVEN, + status: int | NotGiven = NOT_GIVEN, + stores: Dict[str, int] | NotGiven = NOT_GIVEN, + template: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AppShort: + """ + Update app + + Args: + binary: Binary ID + + comment: App description + + debug: Switch on logging for 30 minutes (switched off by default) + + env: Environment variables + + log: Logging channel (by default - kafka, which allows exploring logs with API) + + name: App name + + rsp_headers: Extra headers to add to the response + + secrets: Application secrets + + status: + Status code: + 0 - draft (inactive) + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + + stores: KV stores for the app + + template: Template ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/fastedge/v1/apps/{id}", + body=maybe_transform( + { + "binary": binary, + "comment": comment, + "debug": debug, + "env": env, + "log": log, + "name": name, + "rsp_headers": rsp_headers, + "secrets": secrets, + "status": status, + "stores": stores, + "template": template, + }, + app_update_params.AppUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AppShort, + ) + + def list( + self, + *, + api_type: Literal["wasi-http", "proxy-wasm"] | NotGiven = NOT_GIVEN, + binary: int | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal[ + "name", + "-name", + "status", + "-status", + "id", + "-id", + "template", + "-template", + "binary", + "-binary", + "plan", + "-plan", + ] + | NotGiven = NOT_GIVEN, + plan: int | NotGiven = NOT_GIVEN, + status: int | NotGiven = NOT_GIVEN, + template: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPageFastedgeApps[AppShort]: + """ + List client's apps + + Args: + api_type: + API type: + wasi-http - WASI with HTTP entry point + proxy-wasm - Proxy-Wasm app, callable from CDN + + binary: Binary ID + + limit: Limit for pagination + + name: Name of the app + + offset: Offset for pagination + + ordering: Ordering + + plan: Plan ID + + status: + Status code: + 0 - draft (inactive) + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + + template: Template ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/fastedge/v1/apps", + page=SyncOffsetPageFastedgeApps[AppShort], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "api_type": api_type, + "binary": binary, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + "plan": plan, + "status": status, + "template": template, + }, + app_list_params.AppListParams, + ), + ), + model=AppShort, + ) + + def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete app + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/fastedge/v1/apps/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> App: + """ + Get app details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/fastedge/v1/apps/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=App, + ) + + def replace( + self, + id: int, + *, + body: app_replace_params.Body | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AppShort: + """ + Update an app + + 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"/fastedge/v1/apps/{id}", + body=maybe_transform(body, app_replace_params.AppReplaceParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AppShort, + ) + + +class AsyncAppsResource(AsyncAPIResource): + @cached_property + def logs(self) -> AsyncLogsResource: + return AsyncLogsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncAppsResourceWithRawResponse: + """ + 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 AsyncAppsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAppsResourceWithStreamingResponse: + """ + 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 AsyncAppsResourceWithStreamingResponse(self) + + async def create( + self, + *, + binary: int | NotGiven = NOT_GIVEN, + comment: str | NotGiven = NOT_GIVEN, + debug: bool | NotGiven = NOT_GIVEN, + env: Dict[str, str] | NotGiven = NOT_GIVEN, + log: Optional[Literal["kafka", "none"]] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + rsp_headers: Dict[str, str] | NotGiven = NOT_GIVEN, + secrets: Dict[str, app_create_params.Secrets] | NotGiven = NOT_GIVEN, + status: int | NotGiven = NOT_GIVEN, + stores: Dict[str, int] | NotGiven = NOT_GIVEN, + template: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AppShort: + """ + Add a new app + + Args: + binary: Binary ID + + comment: App description + + debug: Switch on logging for 30 minutes (switched off by default) + + env: Environment variables + + log: Logging channel (by default - kafka, which allows exploring logs with API) + + name: App name + + rsp_headers: Extra headers to add to the response + + secrets: Application secrets + + status: + Status code: + 0 - draft (inactive) + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + + stores: KV stores for the app + + template: Template ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/fastedge/v1/apps", + body=await async_maybe_transform( + { + "binary": binary, + "comment": comment, + "debug": debug, + "env": env, + "log": log, + "name": name, + "rsp_headers": rsp_headers, + "secrets": secrets, + "status": status, + "stores": stores, + "template": template, + }, + app_create_params.AppCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AppShort, + ) + + async def update( + self, + id: int, + *, + binary: int | NotGiven = NOT_GIVEN, + comment: str | NotGiven = NOT_GIVEN, + debug: bool | NotGiven = NOT_GIVEN, + env: Dict[str, str] | NotGiven = NOT_GIVEN, + log: Optional[Literal["kafka", "none"]] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + rsp_headers: Dict[str, str] | NotGiven = NOT_GIVEN, + secrets: Dict[str, app_update_params.Secrets] | NotGiven = NOT_GIVEN, + status: int | NotGiven = NOT_GIVEN, + stores: Dict[str, int] | NotGiven = NOT_GIVEN, + template: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AppShort: + """ + Update app + + Args: + binary: Binary ID + + comment: App description + + debug: Switch on logging for 30 minutes (switched off by default) + + env: Environment variables + + log: Logging channel (by default - kafka, which allows exploring logs with API) + + name: App name + + rsp_headers: Extra headers to add to the response + + secrets: Application secrets + + status: + Status code: + 0 - draft (inactive) + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + + stores: KV stores for the app + + template: Template ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/fastedge/v1/apps/{id}", + body=await async_maybe_transform( + { + "binary": binary, + "comment": comment, + "debug": debug, + "env": env, + "log": log, + "name": name, + "rsp_headers": rsp_headers, + "secrets": secrets, + "status": status, + "stores": stores, + "template": template, + }, + app_update_params.AppUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AppShort, + ) + + def list( + self, + *, + api_type: Literal["wasi-http", "proxy-wasm"] | NotGiven = NOT_GIVEN, + binary: int | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal[ + "name", + "-name", + "status", + "-status", + "id", + "-id", + "template", + "-template", + "binary", + "-binary", + "plan", + "-plan", + ] + | NotGiven = NOT_GIVEN, + plan: int | NotGiven = NOT_GIVEN, + status: int | NotGiven = NOT_GIVEN, + template: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[AppShort, AsyncOffsetPageFastedgeApps[AppShort]]: + """ + List client's apps + + Args: + api_type: + API type: + wasi-http - WASI with HTTP entry point + proxy-wasm - Proxy-Wasm app, callable from CDN + + binary: Binary ID + + limit: Limit for pagination + + name: Name of the app + + offset: Offset for pagination + + ordering: Ordering + + plan: Plan ID + + status: + Status code: + 0 - draft (inactive) + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + + template: Template ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/fastedge/v1/apps", + page=AsyncOffsetPageFastedgeApps[AppShort], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "api_type": api_type, + "binary": binary, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + "plan": plan, + "status": status, + "template": template, + }, + app_list_params.AppListParams, + ), + ), + model=AppShort, + ) + + async def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete app + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/fastedge/v1/apps/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> App: + """ + Get app details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/fastedge/v1/apps/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=App, + ) + + async def replace( + self, + id: int, + *, + body: app_replace_params.Body | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AppShort: + """ + Update an app + + 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"/fastedge/v1/apps/{id}", + body=await async_maybe_transform(body, app_replace_params.AppReplaceParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AppShort, + ) + + +class AppsResourceWithRawResponse: + def __init__(self, apps: AppsResource) -> None: + self._apps = apps + + self.create = to_raw_response_wrapper( + apps.create, + ) + self.update = to_raw_response_wrapper( + apps.update, + ) + self.list = to_raw_response_wrapper( + apps.list, + ) + self.delete = to_raw_response_wrapper( + apps.delete, + ) + self.get = to_raw_response_wrapper( + apps.get, + ) + self.replace = to_raw_response_wrapper( + apps.replace, + ) + + @cached_property + def logs(self) -> LogsResourceWithRawResponse: + return LogsResourceWithRawResponse(self._apps.logs) + + +class AsyncAppsResourceWithRawResponse: + def __init__(self, apps: AsyncAppsResource) -> None: + self._apps = apps + + self.create = async_to_raw_response_wrapper( + apps.create, + ) + self.update = async_to_raw_response_wrapper( + apps.update, + ) + self.list = async_to_raw_response_wrapper( + apps.list, + ) + self.delete = async_to_raw_response_wrapper( + apps.delete, + ) + self.get = async_to_raw_response_wrapper( + apps.get, + ) + self.replace = async_to_raw_response_wrapper( + apps.replace, + ) + + @cached_property + def logs(self) -> AsyncLogsResourceWithRawResponse: + return AsyncLogsResourceWithRawResponse(self._apps.logs) + + +class AppsResourceWithStreamingResponse: + def __init__(self, apps: AppsResource) -> None: + self._apps = apps + + self.create = to_streamed_response_wrapper( + apps.create, + ) + self.update = to_streamed_response_wrapper( + apps.update, + ) + self.list = to_streamed_response_wrapper( + apps.list, + ) + self.delete = to_streamed_response_wrapper( + apps.delete, + ) + self.get = to_streamed_response_wrapper( + apps.get, + ) + self.replace = to_streamed_response_wrapper( + apps.replace, + ) + + @cached_property + def logs(self) -> LogsResourceWithStreamingResponse: + return LogsResourceWithStreamingResponse(self._apps.logs) + + +class AsyncAppsResourceWithStreamingResponse: + def __init__(self, apps: AsyncAppsResource) -> None: + self._apps = apps + + self.create = async_to_streamed_response_wrapper( + apps.create, + ) + self.update = async_to_streamed_response_wrapper( + apps.update, + ) + self.list = async_to_streamed_response_wrapper( + apps.list, + ) + self.delete = async_to_streamed_response_wrapper( + apps.delete, + ) + self.get = async_to_streamed_response_wrapper( + apps.get, + ) + self.replace = async_to_streamed_response_wrapper( + apps.replace, + ) + + @cached_property + def logs(self) -> AsyncLogsResourceWithStreamingResponse: + return AsyncLogsResourceWithStreamingResponse(self._apps.logs) diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py new file mode 100644 index 00000000..f43d121c --- /dev/null +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -0,0 +1,248 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....pagination import SyncOffsetPageFastedgeAppLogs, AsyncOffsetPageFastedgeAppLogs +from ...._base_client import AsyncPaginator, make_request_options +from ....types.fastedge.apps import log_list_params +from ....types.fastedge.apps.log import Log + +__all__ = ["LogsResource", "AsyncLogsResource"] + + +class LogsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> LogsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return LogsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LogsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return LogsResourceWithStreamingResponse(self) + + def list( + self, + id: int, + *, + client_ip: str | NotGiven = NOT_GIVEN, + edge: str | NotGiven = NOT_GIVEN, + from_: Union[str, datetime] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + search: str | NotGiven = NOT_GIVEN, + sort: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, + to: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPageFastedgeAppLogs[Log]: + """ + List logs for the app + + Args: + client_ip: Search by client IP + + edge: Edge name + + from_: Reporting period start time, RFC3339 format. Default 1 hour ago. + + limit: Limit for pagination + + offset: Offset for pagination + + search: Search string + + sort: Sort order (default desc) + + to: Reporting period end time, RFC3339 format. Default current time in UTC. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/fastedge/v1/apps/{id}/logs", + page=SyncOffsetPageFastedgeAppLogs[Log], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "client_ip": client_ip, + "edge": edge, + "from_": from_, + "limit": limit, + "offset": offset, + "search": search, + "sort": sort, + "to": to, + }, + log_list_params.LogListParams, + ), + ), + model=Log, + ) + + +class AsyncLogsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncLogsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncLogsResourceWithStreamingResponse(self) + + def list( + self, + id: int, + *, + client_ip: str | NotGiven = NOT_GIVEN, + edge: str | NotGiven = NOT_GIVEN, + from_: Union[str, datetime] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + search: str | NotGiven = NOT_GIVEN, + sort: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, + to: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Log, AsyncOffsetPageFastedgeAppLogs[Log]]: + """ + List logs for the app + + Args: + client_ip: Search by client IP + + edge: Edge name + + from_: Reporting period start time, RFC3339 format. Default 1 hour ago. + + limit: Limit for pagination + + offset: Offset for pagination + + search: Search string + + sort: Sort order (default desc) + + to: Reporting period end time, RFC3339 format. Default current time in UTC. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/fastedge/v1/apps/{id}/logs", + page=AsyncOffsetPageFastedgeAppLogs[Log], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "client_ip": client_ip, + "edge": edge, + "from_": from_, + "limit": limit, + "offset": offset, + "search": search, + "sort": sort, + "to": to, + }, + log_list_params.LogListParams, + ), + ), + model=Log, + ) + + +class LogsResourceWithRawResponse: + def __init__(self, logs: LogsResource) -> None: + self._logs = logs + + self.list = to_raw_response_wrapper( + logs.list, + ) + + +class AsyncLogsResourceWithRawResponse: + def __init__(self, logs: AsyncLogsResource) -> None: + self._logs = logs + + self.list = async_to_raw_response_wrapper( + logs.list, + ) + + +class LogsResourceWithStreamingResponse: + def __init__(self, logs: LogsResource) -> None: + self._logs = logs + + self.list = to_streamed_response_wrapper( + logs.list, + ) + + +class AsyncLogsResourceWithStreamingResponse: + def __init__(self, logs: AsyncLogsResource) -> None: + self._logs = logs + + self.list = async_to_streamed_response_wrapper( + logs.list, + ) diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py new file mode 100644 index 00000000..79cbd817 --- /dev/null +++ b/src/gcore/resources/fastedge/binaries.py @@ -0,0 +1,286 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.fastedge.binary import Binary +from ...types.fastedge.binary_list_response import BinaryListResponse + +__all__ = ["BinariesResource", "AsyncBinariesResource"] + + +class BinariesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> BinariesResourceWithRawResponse: + """ + 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 BinariesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BinariesResourceWithStreamingResponse: + """ + 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 BinariesResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BinaryListResponse: + """List binaries""" + return self._get( + "/fastedge/v1/binaries", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BinaryListResponse, + ) + + def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a binary + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/fastedge/v1/binaries/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Binary: + """ + Get binary + + 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"/fastedge/v1/binaries/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Binary, + ) + + +class AsyncBinariesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncBinariesResourceWithRawResponse: + """ + 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 AsyncBinariesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBinariesResourceWithStreamingResponse: + """ + 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 AsyncBinariesResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BinaryListResponse: + """List binaries""" + return await self._get( + "/fastedge/v1/binaries", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BinaryListResponse, + ) + + async def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a binary + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/fastedge/v1/binaries/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Binary: + """ + Get binary + + 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"/fastedge/v1/binaries/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Binary, + ) + + +class BinariesResourceWithRawResponse: + def __init__(self, binaries: BinariesResource) -> None: + self._binaries = binaries + + self.list = to_raw_response_wrapper( + binaries.list, + ) + self.delete = to_raw_response_wrapper( + binaries.delete, + ) + self.get = to_raw_response_wrapper( + binaries.get, + ) + + +class AsyncBinariesResourceWithRawResponse: + def __init__(self, binaries: AsyncBinariesResource) -> None: + self._binaries = binaries + + self.list = async_to_raw_response_wrapper( + binaries.list, + ) + self.delete = async_to_raw_response_wrapper( + binaries.delete, + ) + self.get = async_to_raw_response_wrapper( + binaries.get, + ) + + +class BinariesResourceWithStreamingResponse: + def __init__(self, binaries: BinariesResource) -> None: + self._binaries = binaries + + self.list = to_streamed_response_wrapper( + binaries.list, + ) + self.delete = to_streamed_response_wrapper( + binaries.delete, + ) + self.get = to_streamed_response_wrapper( + binaries.get, + ) + + +class AsyncBinariesResourceWithStreamingResponse: + def __init__(self, binaries: AsyncBinariesResource) -> None: + self._binaries = binaries + + self.list = async_to_streamed_response_wrapper( + binaries.list, + ) + self.delete = async_to_streamed_response_wrapper( + binaries.delete, + ) + self.get = async_to_streamed_response_wrapper( + binaries.get, + ) diff --git a/src/gcore/resources/fastedge/fastedge.py b/src/gcore/resources/fastedge/fastedge.py new file mode 100644 index 00000000..9b052788 --- /dev/null +++ b/src/gcore/resources/fastedge/fastedge.py @@ -0,0 +1,327 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .secrets import ( + SecretsResource, + AsyncSecretsResource, + SecretsResourceWithRawResponse, + AsyncSecretsResourceWithRawResponse, + SecretsResourceWithStreamingResponse, + AsyncSecretsResourceWithStreamingResponse, +) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .binaries import ( + BinariesResource, + AsyncBinariesResource, + BinariesResourceWithRawResponse, + AsyncBinariesResourceWithRawResponse, + BinariesResourceWithStreamingResponse, + AsyncBinariesResourceWithStreamingResponse, +) +from ..._compat import cached_property +from .apps.apps import ( + AppsResource, + AsyncAppsResource, + AppsResourceWithRawResponse, + AsyncAppsResourceWithRawResponse, + AppsResourceWithStreamingResponse, + AsyncAppsResourceWithStreamingResponse, +) +from .kv_stores import ( + KvStoresResource, + AsyncKvStoresResource, + KvStoresResourceWithRawResponse, + AsyncKvStoresResourceWithRawResponse, + KvStoresResourceWithStreamingResponse, + AsyncKvStoresResourceWithStreamingResponse, +) +from .templates import ( + TemplatesResource, + AsyncTemplatesResource, + TemplatesResourceWithRawResponse, + AsyncTemplatesResourceWithRawResponse, + TemplatesResourceWithStreamingResponse, + AsyncTemplatesResourceWithStreamingResponse, +) +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.fastedge.client import Client + +__all__ = ["FastedgeResource", "AsyncFastedgeResource"] + + +class FastedgeResource(SyncAPIResource): + @cached_property + def templates(self) -> TemplatesResource: + return TemplatesResource(self._client) + + @cached_property + def secrets(self) -> SecretsResource: + return SecretsResource(self._client) + + @cached_property + def binaries(self) -> BinariesResource: + return BinariesResource(self._client) + + @cached_property + def statistics(self) -> StatisticsResource: + return StatisticsResource(self._client) + + @cached_property + def apps(self) -> AppsResource: + return AppsResource(self._client) + + @cached_property + def kv_stores(self) -> KvStoresResource: + return KvStoresResource(self._client) + + @cached_property + def with_raw_response(self) -> FastedgeResourceWithRawResponse: + """ + 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 FastedgeResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FastedgeResourceWithStreamingResponse: + """ + 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 FastedgeResourceWithStreamingResponse(self) + + def get_account_overview( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Client: + """Get status and limits for the client""" + return self._get( + "/fastedge/v1/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Client, + ) + + +class AsyncFastedgeResource(AsyncAPIResource): + @cached_property + def templates(self) -> AsyncTemplatesResource: + return AsyncTemplatesResource(self._client) + + @cached_property + def secrets(self) -> AsyncSecretsResource: + return AsyncSecretsResource(self._client) + + @cached_property + def binaries(self) -> AsyncBinariesResource: + return AsyncBinariesResource(self._client) + + @cached_property + def statistics(self) -> AsyncStatisticsResource: + return AsyncStatisticsResource(self._client) + + @cached_property + def apps(self) -> AsyncAppsResource: + return AsyncAppsResource(self._client) + + @cached_property + def kv_stores(self) -> AsyncKvStoresResource: + return AsyncKvStoresResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncFastedgeResourceWithRawResponse: + """ + 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 AsyncFastedgeResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFastedgeResourceWithStreamingResponse: + """ + 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 AsyncFastedgeResourceWithStreamingResponse(self) + + async def get_account_overview( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Client: + """Get status and limits for the client""" + return await self._get( + "/fastedge/v1/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Client, + ) + + +class FastedgeResourceWithRawResponse: + def __init__(self, fastedge: FastedgeResource) -> None: + self._fastedge = fastedge + + self.get_account_overview = to_raw_response_wrapper( + fastedge.get_account_overview, + ) + + @cached_property + def templates(self) -> TemplatesResourceWithRawResponse: + return TemplatesResourceWithRawResponse(self._fastedge.templates) + + @cached_property + def secrets(self) -> SecretsResourceWithRawResponse: + return SecretsResourceWithRawResponse(self._fastedge.secrets) + + @cached_property + def binaries(self) -> BinariesResourceWithRawResponse: + return BinariesResourceWithRawResponse(self._fastedge.binaries) + + @cached_property + def statistics(self) -> StatisticsResourceWithRawResponse: + return StatisticsResourceWithRawResponse(self._fastedge.statistics) + + @cached_property + def apps(self) -> AppsResourceWithRawResponse: + return AppsResourceWithRawResponse(self._fastedge.apps) + + @cached_property + def kv_stores(self) -> KvStoresResourceWithRawResponse: + return KvStoresResourceWithRawResponse(self._fastedge.kv_stores) + + +class AsyncFastedgeResourceWithRawResponse: + def __init__(self, fastedge: AsyncFastedgeResource) -> None: + self._fastedge = fastedge + + self.get_account_overview = async_to_raw_response_wrapper( + fastedge.get_account_overview, + ) + + @cached_property + def templates(self) -> AsyncTemplatesResourceWithRawResponse: + return AsyncTemplatesResourceWithRawResponse(self._fastedge.templates) + + @cached_property + def secrets(self) -> AsyncSecretsResourceWithRawResponse: + return AsyncSecretsResourceWithRawResponse(self._fastedge.secrets) + + @cached_property + def binaries(self) -> AsyncBinariesResourceWithRawResponse: + return AsyncBinariesResourceWithRawResponse(self._fastedge.binaries) + + @cached_property + def statistics(self) -> AsyncStatisticsResourceWithRawResponse: + return AsyncStatisticsResourceWithRawResponse(self._fastedge.statistics) + + @cached_property + def apps(self) -> AsyncAppsResourceWithRawResponse: + return AsyncAppsResourceWithRawResponse(self._fastedge.apps) + + @cached_property + def kv_stores(self) -> AsyncKvStoresResourceWithRawResponse: + return AsyncKvStoresResourceWithRawResponse(self._fastedge.kv_stores) + + +class FastedgeResourceWithStreamingResponse: + def __init__(self, fastedge: FastedgeResource) -> None: + self._fastedge = fastedge + + self.get_account_overview = to_streamed_response_wrapper( + fastedge.get_account_overview, + ) + + @cached_property + def templates(self) -> TemplatesResourceWithStreamingResponse: + return TemplatesResourceWithStreamingResponse(self._fastedge.templates) + + @cached_property + def secrets(self) -> SecretsResourceWithStreamingResponse: + return SecretsResourceWithStreamingResponse(self._fastedge.secrets) + + @cached_property + def binaries(self) -> BinariesResourceWithStreamingResponse: + return BinariesResourceWithStreamingResponse(self._fastedge.binaries) + + @cached_property + def statistics(self) -> StatisticsResourceWithStreamingResponse: + return StatisticsResourceWithStreamingResponse(self._fastedge.statistics) + + @cached_property + def apps(self) -> AppsResourceWithStreamingResponse: + return AppsResourceWithStreamingResponse(self._fastedge.apps) + + @cached_property + def kv_stores(self) -> KvStoresResourceWithStreamingResponse: + return KvStoresResourceWithStreamingResponse(self._fastedge.kv_stores) + + +class AsyncFastedgeResourceWithStreamingResponse: + def __init__(self, fastedge: AsyncFastedgeResource) -> None: + self._fastedge = fastedge + + self.get_account_overview = async_to_streamed_response_wrapper( + fastedge.get_account_overview, + ) + + @cached_property + def templates(self) -> AsyncTemplatesResourceWithStreamingResponse: + return AsyncTemplatesResourceWithStreamingResponse(self._fastedge.templates) + + @cached_property + def secrets(self) -> AsyncSecretsResourceWithStreamingResponse: + return AsyncSecretsResourceWithStreamingResponse(self._fastedge.secrets) + + @cached_property + def binaries(self) -> AsyncBinariesResourceWithStreamingResponse: + return AsyncBinariesResourceWithStreamingResponse(self._fastedge.binaries) + + @cached_property + def statistics(self) -> AsyncStatisticsResourceWithStreamingResponse: + return AsyncStatisticsResourceWithStreamingResponse(self._fastedge.statistics) + + @cached_property + def apps(self) -> AsyncAppsResourceWithStreamingResponse: + return AsyncAppsResourceWithStreamingResponse(self._fastedge.apps) + + @cached_property + def kv_stores(self) -> AsyncKvStoresResourceWithStreamingResponse: + return AsyncKvStoresResourceWithStreamingResponse(self._fastedge.kv_stores) diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py new file mode 100644 index 00000000..cb007bbc --- /dev/null +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -0,0 +1,523 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.fastedge import kv_store_list_params, kv_store_create_params, kv_store_replace_params +from ...types.fastedge.kv_store import KvStore +from ...types.fastedge.kv_store_get_response import KvStoreGetResponse +from ...types.fastedge.kv_store_list_response import KvStoreListResponse + +__all__ = ["KvStoresResource", "AsyncKvStoresResource"] + + +class KvStoresResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> KvStoresResourceWithRawResponse: + """ + 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 KvStoresResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> KvStoresResourceWithStreamingResponse: + """ + 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 KvStoresResourceWithStreamingResponse(self) + + def create( + self, + *, + byod: kv_store_create_params.Byod | NotGiven = NOT_GIVEN, + comment: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> KvStore: + """ + Add a new KV store + + Args: + byod: BYOD (Bring Your Own Data) settings + + comment: A description of the store + + 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( + "/fastedge/v1/kv", + body=maybe_transform( + { + "byod": byod, + "comment": comment, + }, + kv_store_create_params.KvStoreCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=KvStore, + ) + + def list( + self, + *, + app_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> KvStoreListResponse: + """ + List available stores + + Args: + app_id: App ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/fastedge/v1/kv", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"app_id": app_id}, kv_store_list_params.KvStoreListParams), + ), + cast_to=KvStoreListResponse, + ) + + def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a store + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/fastedge/v1/kv/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> KvStoreGetResponse: + """ + Get store by id + + 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"/fastedge/v1/kv/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=KvStoreGetResponse, + ) + + def replace( + self, + id: int, + *, + byod: kv_store_replace_params.Byod | NotGiven = NOT_GIVEN, + comment: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> KvStore: + """ + Update a store + + Args: + byod: BYOD (Bring Your Own Data) settings + + comment: A description of the store + + 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"/fastedge/v1/kv/{id}", + body=maybe_transform( + { + "byod": byod, + "comment": comment, + }, + kv_store_replace_params.KvStoreReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=KvStore, + ) + + +class AsyncKvStoresResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncKvStoresResourceWithRawResponse: + """ + 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 AsyncKvStoresResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncKvStoresResourceWithStreamingResponse: + """ + 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 AsyncKvStoresResourceWithStreamingResponse(self) + + async def create( + self, + *, + byod: kv_store_create_params.Byod | NotGiven = NOT_GIVEN, + comment: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> KvStore: + """ + Add a new KV store + + Args: + byod: BYOD (Bring Your Own Data) settings + + comment: A description of the store + + 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( + "/fastedge/v1/kv", + body=await async_maybe_transform( + { + "byod": byod, + "comment": comment, + }, + kv_store_create_params.KvStoreCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=KvStore, + ) + + async def list( + self, + *, + app_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> KvStoreListResponse: + """ + List available stores + + Args: + app_id: App ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/fastedge/v1/kv", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"app_id": app_id}, kv_store_list_params.KvStoreListParams), + ), + cast_to=KvStoreListResponse, + ) + + async def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a store + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/fastedge/v1/kv/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> KvStoreGetResponse: + """ + Get store by id + + 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"/fastedge/v1/kv/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=KvStoreGetResponse, + ) + + async def replace( + self, + id: int, + *, + byod: kv_store_replace_params.Byod | NotGiven = NOT_GIVEN, + comment: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> KvStore: + """ + Update a store + + Args: + byod: BYOD (Bring Your Own Data) settings + + comment: A description of the store + + 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"/fastedge/v1/kv/{id}", + body=await async_maybe_transform( + { + "byod": byod, + "comment": comment, + }, + kv_store_replace_params.KvStoreReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=KvStore, + ) + + +class KvStoresResourceWithRawResponse: + def __init__(self, kv_stores: KvStoresResource) -> None: + self._kv_stores = kv_stores + + self.create = to_raw_response_wrapper( + kv_stores.create, + ) + self.list = to_raw_response_wrapper( + kv_stores.list, + ) + self.delete = to_raw_response_wrapper( + kv_stores.delete, + ) + self.get = to_raw_response_wrapper( + kv_stores.get, + ) + self.replace = to_raw_response_wrapper( + kv_stores.replace, + ) + + +class AsyncKvStoresResourceWithRawResponse: + def __init__(self, kv_stores: AsyncKvStoresResource) -> None: + self._kv_stores = kv_stores + + self.create = async_to_raw_response_wrapper( + kv_stores.create, + ) + self.list = async_to_raw_response_wrapper( + kv_stores.list, + ) + self.delete = async_to_raw_response_wrapper( + kv_stores.delete, + ) + self.get = async_to_raw_response_wrapper( + kv_stores.get, + ) + self.replace = async_to_raw_response_wrapper( + kv_stores.replace, + ) + + +class KvStoresResourceWithStreamingResponse: + def __init__(self, kv_stores: KvStoresResource) -> None: + self._kv_stores = kv_stores + + self.create = to_streamed_response_wrapper( + kv_stores.create, + ) + self.list = to_streamed_response_wrapper( + kv_stores.list, + ) + self.delete = to_streamed_response_wrapper( + kv_stores.delete, + ) + self.get = to_streamed_response_wrapper( + kv_stores.get, + ) + self.replace = to_streamed_response_wrapper( + kv_stores.replace, + ) + + +class AsyncKvStoresResourceWithStreamingResponse: + def __init__(self, kv_stores: AsyncKvStoresResource) -> None: + self._kv_stores = kv_stores + + self.create = async_to_streamed_response_wrapper( + kv_stores.create, + ) + self.list = async_to_streamed_response_wrapper( + kv_stores.list, + ) + self.delete = async_to_streamed_response_wrapper( + kv_stores.delete, + ) + self.get = async_to_streamed_response_wrapper( + kv_stores.get, + ) + self.replace = async_to_streamed_response_wrapper( + kv_stores.replace, + ) diff --git a/src/gcore/resources/fastedge/secrets.py b/src/gcore/resources/fastedge/secrets.py new file mode 100644 index 00000000..8b1e97e2 --- /dev/null +++ b/src/gcore/resources/fastedge/secrets.py @@ -0,0 +1,687 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.fastedge import ( + secret_list_params, + secret_create_params, + secret_delete_params, + secret_update_params, + secret_replace_params, +) +from ...types.fastedge.secret import Secret +from ...types.fastedge.secret_list_response import SecretListResponse +from ...types.fastedge.secret_create_response import SecretCreateResponse + +__all__ = ["SecretsResource", "AsyncSecretsResource"] + + +class SecretsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SecretsResourceWithRawResponse: + """ + 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 SecretsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SecretsResourceWithStreamingResponse: + """ + 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 SecretsResourceWithStreamingResponse(self) + + def create( + self, + *, + name: str, + comment: str | NotGiven = NOT_GIVEN, + secret_slots: Iterable[secret_create_params.SecretSlot] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecretCreateResponse: + """ + Add a new secret + + Args: + name: The unique name of the secret. + + comment: A description or comment about the secret. + + secret_slots: A list of secret slots associated with this secret. + + 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( + "/fastedge/v1/secrets", + body=maybe_transform( + { + "name": name, + "comment": comment, + "secret_slots": secret_slots, + }, + secret_create_params.SecretCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecretCreateResponse, + ) + + def update( + self, + id: int, + *, + comment: str | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + secret_slots: Iterable[secret_update_params.SecretSlot] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Secret: + """ + Update a secret + + Args: + comment: A description or comment about the secret. + + name: The unique name of the secret. + + secret_slots: A list of secret slots associated with this secret. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/fastedge/v1/secrets/{id}", + body=maybe_transform( + { + "comment": comment, + "name": name, + "secret_slots": secret_slots, + }, + secret_update_params.SecretUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Secret, + ) + + def list( + self, + *, + app_id: int | NotGiven = NOT_GIVEN, + secret_name: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecretListResponse: + """ + List available secrets + + Args: + app_id: App ID + + secret_name: Secret name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/fastedge/v1/secrets", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "app_id": app_id, + "secret_name": secret_name, + }, + secret_list_params.SecretListParams, + ), + ), + cast_to=SecretListResponse, + ) + + def delete( + self, + id: int, + *, + force: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a secret + + Args: + force: Force delete secret even if it is used in slots + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/fastedge/v1/secrets/{id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"force": force}, secret_delete_params.SecretDeleteParams), + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Secret: + """ + Get secret by id + + 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"/fastedge/v1/secrets/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Secret, + ) + + def replace( + self, + id: int, + *, + name: str, + comment: str | NotGiven = NOT_GIVEN, + secret_slots: Iterable[secret_replace_params.SecretSlot] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Secret: + """ + Update a secret + + Args: + name: The unique name of the secret. + + comment: A description or comment about the secret. + + secret_slots: A list of secret slots associated with this secret. + + 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"/fastedge/v1/secrets/{id}", + body=maybe_transform( + { + "name": name, + "comment": comment, + "secret_slots": secret_slots, + }, + secret_replace_params.SecretReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Secret, + ) + + +class AsyncSecretsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSecretsResourceWithRawResponse: + """ + 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 AsyncSecretsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSecretsResourceWithStreamingResponse: + """ + 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 AsyncSecretsResourceWithStreamingResponse(self) + + async def create( + self, + *, + name: str, + comment: str | NotGiven = NOT_GIVEN, + secret_slots: Iterable[secret_create_params.SecretSlot] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecretCreateResponse: + """ + Add a new secret + + Args: + name: The unique name of the secret. + + comment: A description or comment about the secret. + + secret_slots: A list of secret slots associated with this secret. + + 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( + "/fastedge/v1/secrets", + body=await async_maybe_transform( + { + "name": name, + "comment": comment, + "secret_slots": secret_slots, + }, + secret_create_params.SecretCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SecretCreateResponse, + ) + + async def update( + self, + id: int, + *, + comment: str | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + secret_slots: Iterable[secret_update_params.SecretSlot] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Secret: + """ + Update a secret + + Args: + comment: A description or comment about the secret. + + name: The unique name of the secret. + + secret_slots: A list of secret slots associated with this secret. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/fastedge/v1/secrets/{id}", + body=await async_maybe_transform( + { + "comment": comment, + "name": name, + "secret_slots": secret_slots, + }, + secret_update_params.SecretUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Secret, + ) + + async def list( + self, + *, + app_id: int | NotGiven = NOT_GIVEN, + secret_name: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SecretListResponse: + """ + List available secrets + + Args: + app_id: App ID + + secret_name: Secret name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/fastedge/v1/secrets", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "app_id": app_id, + "secret_name": secret_name, + }, + secret_list_params.SecretListParams, + ), + ), + cast_to=SecretListResponse, + ) + + async def delete( + self, + id: int, + *, + force: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a secret + + Args: + force: Force delete secret even if it is used in slots + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/fastedge/v1/secrets/{id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"force": force}, secret_delete_params.SecretDeleteParams), + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Secret: + """ + Get secret by id + + 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"/fastedge/v1/secrets/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Secret, + ) + + async def replace( + self, + id: int, + *, + name: str, + comment: str | NotGiven = NOT_GIVEN, + secret_slots: Iterable[secret_replace_params.SecretSlot] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Secret: + """ + Update a secret + + Args: + name: The unique name of the secret. + + comment: A description or comment about the secret. + + secret_slots: A list of secret slots associated with this secret. + + 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"/fastedge/v1/secrets/{id}", + body=await async_maybe_transform( + { + "name": name, + "comment": comment, + "secret_slots": secret_slots, + }, + secret_replace_params.SecretReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Secret, + ) + + +class SecretsResourceWithRawResponse: + def __init__(self, secrets: SecretsResource) -> None: + self._secrets = secrets + + self.create = to_raw_response_wrapper( + secrets.create, + ) + self.update = to_raw_response_wrapper( + secrets.update, + ) + self.list = to_raw_response_wrapper( + secrets.list, + ) + self.delete = to_raw_response_wrapper( + secrets.delete, + ) + self.get = to_raw_response_wrapper( + secrets.get, + ) + self.replace = to_raw_response_wrapper( + secrets.replace, + ) + + +class AsyncSecretsResourceWithRawResponse: + def __init__(self, secrets: AsyncSecretsResource) -> None: + self._secrets = secrets + + self.create = async_to_raw_response_wrapper( + secrets.create, + ) + self.update = async_to_raw_response_wrapper( + secrets.update, + ) + self.list = async_to_raw_response_wrapper( + secrets.list, + ) + self.delete = async_to_raw_response_wrapper( + secrets.delete, + ) + self.get = async_to_raw_response_wrapper( + secrets.get, + ) + self.replace = async_to_raw_response_wrapper( + secrets.replace, + ) + + +class SecretsResourceWithStreamingResponse: + def __init__(self, secrets: SecretsResource) -> None: + self._secrets = secrets + + self.create = to_streamed_response_wrapper( + secrets.create, + ) + self.update = to_streamed_response_wrapper( + secrets.update, + ) + self.list = to_streamed_response_wrapper( + secrets.list, + ) + self.delete = to_streamed_response_wrapper( + secrets.delete, + ) + self.get = to_streamed_response_wrapper( + secrets.get, + ) + self.replace = to_streamed_response_wrapper( + secrets.replace, + ) + + +class AsyncSecretsResourceWithStreamingResponse: + def __init__(self, secrets: AsyncSecretsResource) -> None: + self._secrets = secrets + + self.create = async_to_streamed_response_wrapper( + secrets.create, + ) + self.update = async_to_streamed_response_wrapper( + secrets.update, + ) + self.list = async_to_streamed_response_wrapper( + secrets.list, + ) + self.delete = async_to_streamed_response_wrapper( + secrets.delete, + ) + self.get = async_to_streamed_response_wrapper( + secrets.get, + ) + self.replace = async_to_streamed_response_wrapper( + secrets.replace, + ) diff --git a/src/gcore/resources/fastedge/statistics.py b/src/gcore/resources/fastedge/statistics.py new file mode 100644 index 00000000..1958aafc --- /dev/null +++ b/src/gcore/resources/fastedge/statistics.py @@ -0,0 +1,347 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.fastedge import statistic_get_call_series_params, statistic_get_duration_series_params +from ...types.fastedge.statistic_get_call_series_response import StatisticGetCallSeriesResponse +from ...types.fastedge.statistic_get_duration_series_response import StatisticGetDurationSeriesResponse + +__all__ = ["StatisticsResource", "AsyncStatisticsResource"] + + +class StatisticsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StatisticsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return StatisticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StatisticsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return StatisticsResourceWithStreamingResponse(self) + + def get_call_series( + self, + *, + from_: Union[str, datetime], + step: int, + to: Union[str, datetime], + id: int | NotGiven = NOT_GIVEN, + network: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StatisticGetCallSeriesResponse: + """ + Call statistics + + Args: + from_: Reporting period start time, RFC3339 format + + step: Reporting granularity, in seconds + + to: Reporting period end time (not included into reporting period), RFC3339 format + + id: App ID + + network: Network name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/fastedge/v1/stats/calls", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "step": step, + "to": to, + "id": id, + "network": network, + }, + statistic_get_call_series_params.StatisticGetCallSeriesParams, + ), + ), + cast_to=StatisticGetCallSeriesResponse, + ) + + def get_duration_series( + self, + *, + from_: Union[str, datetime], + step: int, + to: Union[str, datetime], + id: int | NotGiven = NOT_GIVEN, + network: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StatisticGetDurationSeriesResponse: + """ + Execution duration statistics + + Args: + from_: Reporting period start time, RFC3339 format + + step: Reporting granularity, in seconds + + to: Reporting period end time (not included into reporting period), RFC3339 format + + id: App ID + + network: Network name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/fastedge/v1/stats/app_duration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "step": step, + "to": to, + "id": id, + "network": network, + }, + statistic_get_duration_series_params.StatisticGetDurationSeriesParams, + ), + ), + cast_to=StatisticGetDurationSeriesResponse, + ) + + +class AsyncStatisticsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncStatisticsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncStatisticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStatisticsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncStatisticsResourceWithStreamingResponse(self) + + async def get_call_series( + self, + *, + from_: Union[str, datetime], + step: int, + to: Union[str, datetime], + id: int | NotGiven = NOT_GIVEN, + network: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StatisticGetCallSeriesResponse: + """ + Call statistics + + Args: + from_: Reporting period start time, RFC3339 format + + step: Reporting granularity, in seconds + + to: Reporting period end time (not included into reporting period), RFC3339 format + + id: App ID + + network: Network name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/fastedge/v1/stats/calls", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "step": step, + "to": to, + "id": id, + "network": network, + }, + statistic_get_call_series_params.StatisticGetCallSeriesParams, + ), + ), + cast_to=StatisticGetCallSeriesResponse, + ) + + async def get_duration_series( + self, + *, + from_: Union[str, datetime], + step: int, + to: Union[str, datetime], + id: int | NotGiven = NOT_GIVEN, + network: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StatisticGetDurationSeriesResponse: + """ + Execution duration statistics + + Args: + from_: Reporting period start time, RFC3339 format + + step: Reporting granularity, in seconds + + to: Reporting period end time (not included into reporting period), RFC3339 format + + id: App ID + + network: Network name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/fastedge/v1/stats/app_duration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "step": step, + "to": to, + "id": id, + "network": network, + }, + statistic_get_duration_series_params.StatisticGetDurationSeriesParams, + ), + ), + cast_to=StatisticGetDurationSeriesResponse, + ) + + +class StatisticsResourceWithRawResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics + + self.get_call_series = to_raw_response_wrapper( + statistics.get_call_series, + ) + self.get_duration_series = to_raw_response_wrapper( + statistics.get_duration_series, + ) + + +class AsyncStatisticsResourceWithRawResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics + + self.get_call_series = async_to_raw_response_wrapper( + statistics.get_call_series, + ) + self.get_duration_series = async_to_raw_response_wrapper( + statistics.get_duration_series, + ) + + +class StatisticsResourceWithStreamingResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics + + self.get_call_series = to_streamed_response_wrapper( + statistics.get_call_series, + ) + self.get_duration_series = to_streamed_response_wrapper( + statistics.get_duration_series, + ) + + +class AsyncStatisticsResourceWithStreamingResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics + + self.get_call_series = async_to_streamed_response_wrapper( + statistics.get_call_series, + ) + self.get_duration_series = async_to_streamed_response_wrapper( + statistics.get_duration_series, + ) diff --git a/src/gcore/resources/fastedge/templates.py b/src/gcore/resources/fastedge/templates.py new file mode 100644 index 00000000..a39e2757 --- /dev/null +++ b/src/gcore/resources/fastedge/templates.py @@ -0,0 +1,652 @@ +# 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 NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ...pagination import SyncOffsetPageFastedgeTemplates, AsyncOffsetPageFastedgeTemplates +from ..._base_client import AsyncPaginator, make_request_options +from ...types.fastedge import ( + template_list_params, + template_create_params, + template_delete_params, + template_replace_params, +) +from ...types.fastedge.template import Template +from ...types.fastedge.template_short import TemplateShort +from ...types.fastedge.template_parameter_param import TemplateParameterParam + +__all__ = ["TemplatesResource", "AsyncTemplatesResource"] + + +class TemplatesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TemplatesResourceWithRawResponse: + """ + 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 TemplatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TemplatesResourceWithStreamingResponse: + """ + 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 TemplatesResourceWithStreamingResponse(self) + + def create( + self, + *, + binary_id: int, + name: str, + owned: bool, + params: Iterable[TemplateParameterParam], + long_descr: str | NotGiven = NOT_GIVEN, + short_descr: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TemplateShort: + """ + Add template + + Args: + binary_id: Binary ID + + name: Name of the template + + owned: Is the template owned by user? + + params: Parameters + + long_descr: Long description of the template + + short_descr: Short description of the template + + 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( + "/fastedge/v1/template", + body=maybe_transform( + { + "binary_id": binary_id, + "name": name, + "owned": owned, + "params": params, + "long_descr": long_descr, + "short_descr": short_descr, + }, + template_create_params.TemplateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TemplateShort, + ) + + def list( + self, + *, + api_type: Literal["wasi-http", "proxy-wasm"] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + only_mine: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPageFastedgeTemplates[TemplateShort]: + """ + List app templates + + Args: + api_type: + API type: + wasi-http - WASI with HTTP entry point + proxy-wasm - Proxy-Wasm app, callable from CDN + + limit: Limit for pagination + + offset: Offset for pagination + + only_mine: Only my templates + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/fastedge/v1/template", + page=SyncOffsetPageFastedgeTemplates[TemplateShort], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "api_type": api_type, + "limit": limit, + "offset": offset, + "only_mine": only_mine, + }, + template_list_params.TemplateListParams, + ), + ), + model=TemplateShort, + ) + + def delete( + self, + id: int, + *, + force: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete template + + Args: + force: Force template deletion even if it is shared to groups + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/fastedge/v1/template/{id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"force": force}, template_delete_params.TemplateDeleteParams), + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Template: + """ + Get template details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/fastedge/v1/template/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Template, + ) + + def replace( + self, + id: int, + *, + binary_id: int, + name: str, + owned: bool, + params: Iterable[TemplateParameterParam], + long_descr: str | NotGiven = NOT_GIVEN, + short_descr: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TemplateShort: + """ + Update template + + Args: + binary_id: Binary ID + + name: Name of the template + + owned: Is the template owned by user? + + params: Parameters + + long_descr: Long description of the template + + short_descr: Short description of the template + + 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"/fastedge/v1/template/{id}", + body=maybe_transform( + { + "binary_id": binary_id, + "name": name, + "owned": owned, + "params": params, + "long_descr": long_descr, + "short_descr": short_descr, + }, + template_replace_params.TemplateReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TemplateShort, + ) + + +class AsyncTemplatesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTemplatesResourceWithRawResponse: + """ + 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 AsyncTemplatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTemplatesResourceWithStreamingResponse: + """ + 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 AsyncTemplatesResourceWithStreamingResponse(self) + + async def create( + self, + *, + binary_id: int, + name: str, + owned: bool, + params: Iterable[TemplateParameterParam], + long_descr: str | NotGiven = NOT_GIVEN, + short_descr: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TemplateShort: + """ + Add template + + Args: + binary_id: Binary ID + + name: Name of the template + + owned: Is the template owned by user? + + params: Parameters + + long_descr: Long description of the template + + short_descr: Short description of the template + + 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( + "/fastedge/v1/template", + body=await async_maybe_transform( + { + "binary_id": binary_id, + "name": name, + "owned": owned, + "params": params, + "long_descr": long_descr, + "short_descr": short_descr, + }, + template_create_params.TemplateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TemplateShort, + ) + + def list( + self, + *, + api_type: Literal["wasi-http", "proxy-wasm"] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + only_mine: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[TemplateShort, AsyncOffsetPageFastedgeTemplates[TemplateShort]]: + """ + List app templates + + Args: + api_type: + API type: + wasi-http - WASI with HTTP entry point + proxy-wasm - Proxy-Wasm app, callable from CDN + + limit: Limit for pagination + + offset: Offset for pagination + + only_mine: Only my templates + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/fastedge/v1/template", + page=AsyncOffsetPageFastedgeTemplates[TemplateShort], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "api_type": api_type, + "limit": limit, + "offset": offset, + "only_mine": only_mine, + }, + template_list_params.TemplateListParams, + ), + ), + model=TemplateShort, + ) + + async def delete( + self, + id: int, + *, + force: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete template + + Args: + force: Force template deletion even if it is shared to groups + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/fastedge/v1/template/{id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"force": force}, template_delete_params.TemplateDeleteParams), + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Template: + """ + Get template details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/fastedge/v1/template/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Template, + ) + + async def replace( + self, + id: int, + *, + binary_id: int, + name: str, + owned: bool, + params: Iterable[TemplateParameterParam], + long_descr: str | NotGiven = NOT_GIVEN, + short_descr: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TemplateShort: + """ + Update template + + Args: + binary_id: Binary ID + + name: Name of the template + + owned: Is the template owned by user? + + params: Parameters + + long_descr: Long description of the template + + short_descr: Short description of the template + + 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"/fastedge/v1/template/{id}", + body=await async_maybe_transform( + { + "binary_id": binary_id, + "name": name, + "owned": owned, + "params": params, + "long_descr": long_descr, + "short_descr": short_descr, + }, + template_replace_params.TemplateReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TemplateShort, + ) + + +class TemplatesResourceWithRawResponse: + def __init__(self, templates: TemplatesResource) -> None: + self._templates = templates + + self.create = to_raw_response_wrapper( + templates.create, + ) + self.list = to_raw_response_wrapper( + templates.list, + ) + self.delete = to_raw_response_wrapper( + templates.delete, + ) + self.get = to_raw_response_wrapper( + templates.get, + ) + self.replace = to_raw_response_wrapper( + templates.replace, + ) + + +class AsyncTemplatesResourceWithRawResponse: + def __init__(self, templates: AsyncTemplatesResource) -> None: + self._templates = templates + + self.create = async_to_raw_response_wrapper( + templates.create, + ) + self.list = async_to_raw_response_wrapper( + templates.list, + ) + self.delete = async_to_raw_response_wrapper( + templates.delete, + ) + self.get = async_to_raw_response_wrapper( + templates.get, + ) + self.replace = async_to_raw_response_wrapper( + templates.replace, + ) + + +class TemplatesResourceWithStreamingResponse: + def __init__(self, templates: TemplatesResource) -> None: + self._templates = templates + + self.create = to_streamed_response_wrapper( + templates.create, + ) + self.list = to_streamed_response_wrapper( + templates.list, + ) + self.delete = to_streamed_response_wrapper( + templates.delete, + ) + self.get = to_streamed_response_wrapper( + templates.get, + ) + self.replace = to_streamed_response_wrapper( + templates.replace, + ) + + +class AsyncTemplatesResourceWithStreamingResponse: + def __init__(self, templates: AsyncTemplatesResource) -> None: + self._templates = templates + + self.create = async_to_streamed_response_wrapper( + templates.create, + ) + self.list = async_to_streamed_response_wrapper( + templates.list, + ) + self.delete = async_to_streamed_response_wrapper( + templates.delete, + ) + self.get = async_to_streamed_response_wrapper( + templates.get, + ) + self.replace = async_to_streamed_response_wrapper( + templates.replace, + ) diff --git a/src/gcore/types/fastedge/__init__.py b/src/gcore/types/fastedge/__init__.py new file mode 100644 index 00000000..756a9ea0 --- /dev/null +++ b/src/gcore/types/fastedge/__init__.py @@ -0,0 +1,48 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .app import App as App +from .binary import Binary as Binary +from .client import Client as Client +from .secret import Secret as Secret +from .kv_store import KvStore as KvStore +from .template import Template as Template +from .app_param import AppParam as AppParam +from .app_short import AppShort as AppShort +from .call_status import CallStatus as CallStatus +from .binary_short import BinaryShort as BinaryShort +from .secret_short import SecretShort as SecretShort +from .duration_stats import DurationStats as DurationStats +from .kv_store_short import KvStoreShort as KvStoreShort +from .kv_store_stats import KvStoreStats as KvStoreStats +from .template_short import TemplateShort as TemplateShort +from .app_list_params import AppListParams as AppListParams +from .app_create_params import AppCreateParams as AppCreateParams +from .app_update_params import AppUpdateParams as AppUpdateParams +from .app_replace_params import AppReplaceParams as AppReplaceParams +from .secret_list_params import SecretListParams as SecretListParams +from .template_parameter import TemplateParameter as TemplateParameter +from .binary_list_response import BinaryListResponse as BinaryListResponse +from .kv_store_list_params import KvStoreListParams as KvStoreListParams +from .secret_create_params import SecretCreateParams as SecretCreateParams +from .secret_delete_params import SecretDeleteParams as SecretDeleteParams +from .secret_list_response import SecretListResponse as SecretListResponse +from .secret_update_params import SecretUpdateParams as SecretUpdateParams +from .template_list_params import TemplateListParams as TemplateListParams +from .kv_store_get_response import KvStoreGetResponse as KvStoreGetResponse +from .secret_replace_params import SecretReplaceParams as SecretReplaceParams +from .kv_store_create_params import KvStoreCreateParams as KvStoreCreateParams +from .kv_store_list_response import KvStoreListResponse as KvStoreListResponse +from .secret_create_response import SecretCreateResponse as SecretCreateResponse +from .template_create_params import TemplateCreateParams as TemplateCreateParams +from .template_delete_params import TemplateDeleteParams as TemplateDeleteParams +from .kv_store_replace_params import KvStoreReplaceParams as KvStoreReplaceParams +from .template_replace_params import TemplateReplaceParams as TemplateReplaceParams +from .template_parameter_param import TemplateParameterParam as TemplateParameterParam +from .statistic_get_call_series_params import StatisticGetCallSeriesParams as StatisticGetCallSeriesParams +from .statistic_get_call_series_response import StatisticGetCallSeriesResponse as StatisticGetCallSeriesResponse +from .statistic_get_duration_series_params import StatisticGetDurationSeriesParams as StatisticGetDurationSeriesParams +from .statistic_get_duration_series_response import ( + StatisticGetDurationSeriesResponse as StatisticGetDurationSeriesResponse, +) diff --git a/src/gcore/types/fastedge/app.py b/src/gcore/types/fastedge/app.py new file mode 100644 index 00000000..506008e0 --- /dev/null +++ b/src/gcore/types/fastedge/app.py @@ -0,0 +1,81 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["App", "Secrets"] + + +class Secrets(BaseModel): + id: int + """The unique identifier of the secret.""" + + comment: Optional[str] = None + """A description or comment about the secret.""" + + name: Optional[str] = None + """The unique name of the secret.""" + + +class App(BaseModel): + api_type: Optional[str] = None + """Wasm API type""" + + binary: Optional[int] = None + """Binary ID""" + + comment: Optional[str] = None + """App description""" + + debug_until: Optional[datetime] = None + """When debugging finishes""" + + env: Optional[Dict[str, str]] = None + """Environment variables""" + + log: Optional[Literal["kafka", "none"]] = None + """Logging channel (by default - kafka, which allows exploring logs with API)""" + + name: Optional[str] = None + """App name""" + + networks: Optional[List[str]] = None + """Networks""" + + plan: Optional[str] = None + """Plan name""" + + plan_id: Optional[int] = None + """Plan ID""" + + rsp_headers: Optional[Dict[str, str]] = None + """Extra headers to add to the response""" + + secrets: Optional[Dict[str, Secrets]] = None + """Application secrets""" + + status: Optional[int] = None + """ + Status code: + 0 - draft (inactive) + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + """ + + stores: Optional[Dict[str, int]] = None + """KV stores for the app""" + + template: Optional[int] = None + """Template ID""" + + template_name: Optional[str] = None + """Template name""" + + url: Optional[str] = None + """App URL""" diff --git a/src/gcore/types/fastedge/app_create_params.py b/src/gcore/types/fastedge/app_create_params.py new file mode 100644 index 00000000..3046b307 --- /dev/null +++ b/src/gcore/types/fastedge/app_create_params.py @@ -0,0 +1,56 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["AppCreateParams", "Secrets"] + + +class AppCreateParams(TypedDict, total=False): + binary: int + """Binary ID""" + + comment: str + """App description""" + + debug: bool + """Switch on logging for 30 minutes (switched off by default)""" + + env: Dict[str, str] + """Environment variables""" + + log: Optional[Literal["kafka", "none"]] + """Logging channel (by default - kafka, which allows exploring logs with API)""" + + name: str + """App name""" + + rsp_headers: Dict[str, str] + """Extra headers to add to the response""" + + secrets: Dict[str, Secrets] + """Application secrets""" + + status: int + """ + Status code: + 0 - draft (inactive) + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + """ + + stores: Dict[str, int] + """KV stores for the app""" + + template: int + """Template ID""" + + +class Secrets(TypedDict, total=False): + id: Required[int] + """The unique identifier of the secret.""" diff --git a/src/gcore/types/fastedge/app_list_params.py b/src/gcore/types/fastedge/app_list_params.py new file mode 100644 index 00000000..e55c8558 --- /dev/null +++ b/src/gcore/types/fastedge/app_list_params.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["AppListParams"] + + +class AppListParams(TypedDict, total=False): + api_type: Literal["wasi-http", "proxy-wasm"] + """ + API type: + wasi-http - WASI with HTTP entry point + proxy-wasm - Proxy-Wasm app, callable from CDN + """ + + binary: int + """Binary ID""" + + limit: int + """Limit for pagination""" + + name: str + """Name of the app""" + + offset: int + """Offset for pagination""" + + ordering: Literal[ + "name", "-name", "status", "-status", "id", "-id", "template", "-template", "binary", "-binary", "plan", "-plan" + ] + """Ordering""" + + plan: int + """Plan ID""" + + status: int + """ + Status code: + 0 - draft (inactive) + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + """ + + template: int + """Template ID""" diff --git a/src/gcore/types/fastedge/app_param.py b/src/gcore/types/fastedge/app_param.py new file mode 100644 index 00000000..15b1ee3d --- /dev/null +++ b/src/gcore/types/fastedge/app_param.py @@ -0,0 +1,56 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["AppParam", "Secrets"] + + +class Secrets(TypedDict, total=False): + id: Required[int] + """The unique identifier of the secret.""" + + +class AppParam(TypedDict, total=False): + binary: int + """Binary ID""" + + comment: str + """App description""" + + debug: bool + """Switch on logging for 30 minutes (switched off by default)""" + + env: Dict[str, str] + """Environment variables""" + + log: Optional[Literal["kafka", "none"]] + """Logging channel (by default - kafka, which allows exploring logs with API)""" + + name: str + """App name""" + + rsp_headers: Dict[str, str] + """Extra headers to add to the response""" + + secrets: Dict[str, Secrets] + """Application secrets""" + + status: int + """ + Status code: + 0 - draft (inactive) + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + """ + + stores: Dict[str, int] + """KV stores for the app""" + + template: int + """Template ID""" diff --git a/src/gcore/types/fastedge/app_replace_params.py b/src/gcore/types/fastedge/app_replace_params.py new file mode 100644 index 00000000..d0220c85 --- /dev/null +++ b/src/gcore/types/fastedge/app_replace_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from .app_param import AppParam + +__all__ = ["AppReplaceParams", "Body"] + + +class AppReplaceParams(TypedDict, total=False): + body: Body + + +class Body(AppParam, total=False): + pass diff --git a/src/gcore/types/fastedge/app_short.py b/src/gcore/types/fastedge/app_short.py new file mode 100644 index 00000000..e61d10f6 --- /dev/null +++ b/src/gcore/types/fastedge/app_short.py @@ -0,0 +1,60 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["AppShort"] + + +class AppShort(BaseModel): + id: int + """App ID""" + + api_type: str + """Wasm API type""" + + binary: int + """Binary ID""" + + name: str + """App name""" + + plan_id: int + """Application plan ID""" + + status: int + """ + Status code: + 0 - draft (inactive) + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + """ + + comment: Optional[str] = None + """Description of the binary""" + + debug_until: Optional[datetime] = None + """When debugging finishes""" + + networks: Optional[List[str]] = None + """Networks""" + + plan: Optional[str] = None + """Application plan name""" + + template: Optional[int] = None + """Template ID""" + + template_name: Optional[str] = None + """Template name""" + + upgradeable_to: Optional[int] = None + """ID of the binary the app can be upgraded to""" + + url: Optional[str] = None + """App URL""" diff --git a/src/gcore/types/fastedge/app_update_params.py b/src/gcore/types/fastedge/app_update_params.py new file mode 100644 index 00000000..b1c7cce8 --- /dev/null +++ b/src/gcore/types/fastedge/app_update_params.py @@ -0,0 +1,56 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["AppUpdateParams", "Secrets"] + + +class AppUpdateParams(TypedDict, total=False): + binary: int + """Binary ID""" + + comment: str + """App description""" + + debug: bool + """Switch on logging for 30 minutes (switched off by default)""" + + env: Dict[str, str] + """Environment variables""" + + log: Optional[Literal["kafka", "none"]] + """Logging channel (by default - kafka, which allows exploring logs with API)""" + + name: str + """App name""" + + rsp_headers: Dict[str, str] + """Extra headers to add to the response""" + + secrets: Dict[str, Secrets] + """Application secrets""" + + status: int + """ + Status code: + 0 - draft (inactive) + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + """ + + stores: Dict[str, int] + """KV stores for the app""" + + template: int + """Template ID""" + + +class Secrets(TypedDict, total=False): + id: Required[int] + """The unique identifier of the secret.""" diff --git a/src/gcore/types/fastedge/apps/__init__.py b/src/gcore/types/fastedge/apps/__init__.py new file mode 100644 index 00000000..b5a7180b --- /dev/null +++ b/src/gcore/types/fastedge/apps/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .log import Log as Log +from .log_list_params import LogListParams as LogListParams diff --git a/src/gcore/types/fastedge/apps/log.py b/src/gcore/types/fastedge/apps/log.py new file mode 100644 index 00000000..eb04e9de --- /dev/null +++ b/src/gcore/types/fastedge/apps/log.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["Log"] + + +class Log(BaseModel): + id: Optional[str] = None + """Id of the log""" + + app_name: Optional[str] = None + """Name of the application""" + + client_ip: Optional[str] = None + """Client IP""" + + edge: Optional[str] = None + """Edge name""" + + log: Optional[str] = None + """Log message""" + + timestamp: Optional[datetime] = None + """Timestamp of a log in RFC3339 format""" diff --git a/src/gcore/types/fastedge/apps/log_list_params.py b/src/gcore/types/fastedge/apps/log_list_params.py new file mode 100644 index 00000000..8d53640a --- /dev/null +++ b/src/gcore/types/fastedge/apps/log_list_params.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["LogListParams"] + + +class LogListParams(TypedDict, total=False): + client_ip: str + """Search by client IP""" + + edge: str + """Edge name""" + + from_: Annotated[Union[str, datetime], PropertyInfo(alias="from", format="iso8601")] + """Reporting period start time, RFC3339 format. Default 1 hour ago.""" + + limit: int + """Limit for pagination""" + + offset: int + """Offset for pagination""" + + search: str + """Search string""" + + sort: Literal["desc", "asc"] + """Sort order (default desc)""" + + to: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Reporting period end time, RFC3339 format. Default current time in UTC.""" diff --git a/src/gcore/types/fastedge/binary.py b/src/gcore/types/fastedge/binary.py new file mode 100644 index 00000000..90a96496 --- /dev/null +++ b/src/gcore/types/fastedge/binary.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Binary"] + + +class Binary(BaseModel): + id: int + """Binary ID""" + + api_type: str + """Wasm API type""" + + source: int + """ + Source language: + 0 - unknown + 1 - Rust + 2 - JavaScript + """ + + status: int + """ + Status code: + 0 - pending + 1 - compiled + 2 - compilation failed (errors available) + 3 - compilation failed (errors not available) + 4 - resulting binary exceeded the limit + 5 - unsupported source language + """ + + checksum: Optional[str] = None + """MD5 hash of the binary""" + + unref_since: Optional[str] = None + """Not used since (UTC)""" diff --git a/src/gcore/types/fastedge/binary_list_response.py b/src/gcore/types/fastedge/binary_list_response.py new file mode 100644 index 00000000..b31a96b9 --- /dev/null +++ b/src/gcore/types/fastedge/binary_list_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .binary_short import BinaryShort + +__all__ = ["BinaryListResponse"] + + +class BinaryListResponse(BaseModel): + binaries: List[BinaryShort] diff --git a/src/gcore/types/fastedge/binary_short.py b/src/gcore/types/fastedge/binary_short.py new file mode 100644 index 00000000..e9ab6732 --- /dev/null +++ b/src/gcore/types/fastedge/binary_short.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["BinaryShort"] + + +class BinaryShort(BaseModel): + id: int + """Binary ID""" + + api_type: str + """Wasm API type""" + + status: int + """ + Status code: + 0 - pending + 1 - compiled + 2 - compilation failed (errors available) + 3 - compilation failed (errors not available) + 4 - resulting binary exceeded the limit + 5 - unsupported source language + """ + + checksum: Optional[str] = None + """MD5 hash of the binary""" + + unref_since: Optional[str] = None + """Not used since (UTC)""" diff --git a/src/gcore/types/fastedge/call_status.py b/src/gcore/types/fastedge/call_status.py new file mode 100644 index 00000000..c694c963 --- /dev/null +++ b/src/gcore/types/fastedge/call_status.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["CallStatus", "CountByStatus"] + + +class CountByStatus(BaseModel): + count: int + """Number of app calls""" + + status: int + """HTTP status""" + + +class CallStatus(BaseModel): + count_by_status: List[CountByStatus] + """Count by status""" + + time: datetime + """Beginning ot reporting slot""" diff --git a/src/gcore/types/fastedge/client.py b/src/gcore/types/fastedge/client.py new file mode 100644 index 00000000..eb4d402d --- /dev/null +++ b/src/gcore/types/fastedge/client.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["Client", "Network"] + + +class Network(BaseModel): + is_default: bool + """Is network is default""" + + name: str + """Network name""" + + +class Client(BaseModel): + app_count: int + """Actual allowed number of apps""" + + app_limit: int + """Max allowed number of apps""" + + daily_consumption: int + """Actual number of calls for all apps during the current day (UTC)""" + + daily_limit: int + """Max allowed calls for all apps during a day (UTC)""" + + hourly_consumption: int + """Actual number of calls for all apps during the current hour""" + + hourly_limit: int + """Max allowed calls for all apps during an hour""" + + monthly_consumption: int + """Actual number of calls for all apps during the current calendar month (UTC)""" + + networks: List[Network] + """List of enabled networks""" + + plan_id: int + """Plan ID""" + + status: int + """ + Status code: + 1 - enabled + 2 - disabled + 3 - hourly call limit exceeded + 4 - daily call limit exceeded + 5 - suspended + """ + + plan: Optional[str] = None + """Plan name""" diff --git a/src/gcore/types/fastedge/duration_stats.py b/src/gcore/types/fastedge/duration_stats.py new file mode 100644 index 00000000..fbb08c0c --- /dev/null +++ b/src/gcore/types/fastedge/duration_stats.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["DurationStats"] + + +class DurationStats(BaseModel): + avg: int + """Average duration in usec""" + + max: int + """Max duration in usec""" + + median: int + """Median (50% percentile) duration in usec""" + + min: int + """Min duration in usec""" + + perc75: int + """75% percentile duration in usec""" + + perc90: int + """90% percentile duration in usec""" + + time: datetime + """Beginning ot reporting slot""" diff --git a/src/gcore/types/fastedge/kv_store.py b/src/gcore/types/fastedge/kv_store.py new file mode 100644 index 00000000..f63f2a27 --- /dev/null +++ b/src/gcore/types/fastedge/kv_store.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["KvStore", "Byod"] + + +class Byod(BaseModel): + prefix: str + """Key prefix""" + + url: str + """URL to connect to""" + + +class KvStore(BaseModel): + id: Optional[int] = None + """The unique identifier of the store""" + + app_count: Optional[int] = None + """The number of applications that use this store""" + + byod: Optional[Byod] = None + """BYOD (Bring Your Own Data) settings""" + + comment: Optional[str] = None + """A description of the store""" + + updated: Optional[datetime] = None + """Last update time""" diff --git a/src/gcore/types/fastedge/kv_store_create_params.py b/src/gcore/types/fastedge/kv_store_create_params.py new file mode 100644 index 00000000..d0159585 --- /dev/null +++ b/src/gcore/types/fastedge/kv_store_create_params.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["KvStoreCreateParams", "Byod"] + + +class KvStoreCreateParams(TypedDict, total=False): + byod: Byod + """BYOD (Bring Your Own Data) settings""" + + comment: str + """A description of the store""" + + +class Byod(TypedDict, total=False): + prefix: Required[str] + """Key prefix""" + + url: Required[str] + """URL to connect to""" diff --git a/src/gcore/types/fastedge/kv_store_get_response.py b/src/gcore/types/fastedge/kv_store_get_response.py new file mode 100644 index 00000000..c90559a7 --- /dev/null +++ b/src/gcore/types/fastedge/kv_store_get_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .kv_store import KvStore +from .kv_store_stats import KvStoreStats + +__all__ = ["KvStoreGetResponse"] + + +class KvStoreGetResponse(KvStore, KvStoreStats): + pass diff --git a/src/gcore/types/fastedge/kv_store_list_params.py b/src/gcore/types/fastedge/kv_store_list_params.py new file mode 100644 index 00000000..00faa0af --- /dev/null +++ b/src/gcore/types/fastedge/kv_store_list_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["KvStoreListParams"] + + +class KvStoreListParams(TypedDict, total=False): + app_id: int + """App ID""" diff --git a/src/gcore/types/fastedge/kv_store_list_response.py b/src/gcore/types/fastedge/kv_store_list_response.py new file mode 100644 index 00000000..f0dcefe9 --- /dev/null +++ b/src/gcore/types/fastedge/kv_store_list_response.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 +from .kv_store_short import KvStoreShort + +__all__ = ["KvStoreListResponse"] + + +class KvStoreListResponse(BaseModel): + count: int + """Total number of stores""" + + stores: Optional[List[KvStoreShort]] = None diff --git a/src/gcore/types/fastedge/kv_store_replace_params.py b/src/gcore/types/fastedge/kv_store_replace_params.py new file mode 100644 index 00000000..7448380f --- /dev/null +++ b/src/gcore/types/fastedge/kv_store_replace_params.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["KvStoreReplaceParams", "Byod"] + + +class KvStoreReplaceParams(TypedDict, total=False): + byod: Byod + """BYOD (Bring Your Own Data) settings""" + + comment: str + """A description of the store""" + + +class Byod(TypedDict, total=False): + prefix: Required[str] + """Key prefix""" + + url: Required[str] + """URL to connect to""" diff --git a/src/gcore/types/fastedge/kv_store_short.py b/src/gcore/types/fastedge/kv_store_short.py new file mode 100644 index 00000000..682ab377 --- /dev/null +++ b/src/gcore/types/fastedge/kv_store_short.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["KvStoreShort"] + + +class KvStoreShort(BaseModel): + id: Optional[int] = None + """The unique identifier of the store""" + + comment: Optional[str] = None + """A description of the store""" + + updated: Optional[datetime] = None + """Last update time""" diff --git a/src/gcore/types/fastedge/kv_store_stats.py b/src/gcore/types/fastedge/kv_store_stats.py new file mode 100644 index 00000000..30d5f14e --- /dev/null +++ b/src/gcore/types/fastedge/kv_store_stats.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["KvStoreStats", "Stats"] + + +class Stats(BaseModel): + cf_count: int + """Total number of Cuckoo filter entries""" + + kv_count: int + """Total number of KV entries""" + + size: int + """Total store size in bytes""" + + zset_count: int + """Total number of sorted set entries""" + + +class KvStoreStats(BaseModel): + stats: Optional[Stats] = None + """Store statistics""" diff --git a/src/gcore/types/fastedge/secret.py b/src/gcore/types/fastedge/secret.py new file mode 100644 index 00000000..bb29718f --- /dev/null +++ b/src/gcore/types/fastedge/secret.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["Secret", "SecretSlot"] + + +class SecretSlot(BaseModel): + slot: int + """Secret slot ID.""" + + checksum: Optional[str] = None + """A checksum of the secret value for integrity verification.""" + + +class Secret(BaseModel): + app_count: Optional[int] = None + """The number of applications that use this secret.""" + + comment: Optional[str] = None + """A description or comment about the secret.""" + + name: Optional[str] = None + """The unique name of the secret.""" + + secret_slots: Optional[List[SecretSlot]] = None + """A list of secret slots associated with this secret.""" diff --git a/src/gcore/types/fastedge/secret_create_params.py b/src/gcore/types/fastedge/secret_create_params.py new file mode 100644 index 00000000..861dcc02 --- /dev/null +++ b/src/gcore/types/fastedge/secret_create_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["SecretCreateParams", "SecretSlot"] + + +class SecretCreateParams(TypedDict, total=False): + name: Required[str] + """The unique name of the secret.""" + + comment: str + """A description or comment about the secret.""" + + secret_slots: Iterable[SecretSlot] + """A list of secret slots associated with this secret.""" + + +class SecretSlot(TypedDict, total=False): + slot: Required[int] + """Secret slot ID.""" + + value: str + """The value of the secret.""" diff --git a/src/gcore/types/fastedge/secret_create_response.py b/src/gcore/types/fastedge/secret_create_response.py new file mode 100644 index 00000000..39867464 --- /dev/null +++ b/src/gcore/types/fastedge/secret_create_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .secret import Secret + +__all__ = ["SecretCreateResponse"] + + +class SecretCreateResponse(Secret): + id: Optional[int] = None + """The unique identifier of the secret.""" diff --git a/src/gcore/types/fastedge/secret_delete_params.py b/src/gcore/types/fastedge/secret_delete_params.py new file mode 100644 index 00000000..3f275df7 --- /dev/null +++ b/src/gcore/types/fastedge/secret_delete_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["SecretDeleteParams"] + + +class SecretDeleteParams(TypedDict, total=False): + force: bool + """Force delete secret even if it is used in slots""" diff --git a/src/gcore/types/fastedge/secret_list_params.py b/src/gcore/types/fastedge/secret_list_params.py new file mode 100644 index 00000000..a867bb70 --- /dev/null +++ b/src/gcore/types/fastedge/secret_list_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["SecretListParams"] + + +class SecretListParams(TypedDict, total=False): + app_id: int + """App ID""" + + secret_name: str + """Secret name""" diff --git a/src/gcore/types/fastedge/secret_list_response.py b/src/gcore/types/fastedge/secret_list_response.py new file mode 100644 index 00000000..a8768eb2 --- /dev/null +++ b/src/gcore/types/fastedge/secret_list_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .secret_short import SecretShort + +__all__ = ["SecretListResponse"] + + +class SecretListResponse(BaseModel): + secrets: List[SecretShort] diff --git a/src/gcore/types/fastedge/secret_replace_params.py b/src/gcore/types/fastedge/secret_replace_params.py new file mode 100644 index 00000000..54ddc7f2 --- /dev/null +++ b/src/gcore/types/fastedge/secret_replace_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["SecretReplaceParams", "SecretSlot"] + + +class SecretReplaceParams(TypedDict, total=False): + name: Required[str] + """The unique name of the secret.""" + + comment: str + """A description or comment about the secret.""" + + secret_slots: Iterable[SecretSlot] + """A list of secret slots associated with this secret.""" + + +class SecretSlot(TypedDict, total=False): + slot: Required[int] + """Secret slot ID.""" + + value: str + """The value of the secret.""" diff --git a/src/gcore/types/fastedge/secret_short.py b/src/gcore/types/fastedge/secret_short.py new file mode 100644 index 00000000..147c604e --- /dev/null +++ b/src/gcore/types/fastedge/secret_short.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["SecretShort"] + + +class SecretShort(BaseModel): + name: str + """The unique name of the secret.""" + + id: Optional[int] = None + """The unique identifier of the secret.""" + + app_count: Optional[int] = None + """The number of applications that use this secret.""" + + comment: Optional[str] = None + """A description or comment about the secret.""" diff --git a/src/gcore/types/fastedge/secret_update_params.py b/src/gcore/types/fastedge/secret_update_params.py new file mode 100644 index 00000000..09a14344 --- /dev/null +++ b/src/gcore/types/fastedge/secret_update_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["SecretUpdateParams", "SecretSlot"] + + +class SecretUpdateParams(TypedDict, total=False): + comment: str + """A description or comment about the secret.""" + + name: str + """The unique name of the secret.""" + + secret_slots: Iterable[SecretSlot] + """A list of secret slots associated with this secret.""" + + +class SecretSlot(TypedDict, total=False): + slot: Required[int] + """Secret slot ID.""" + + value: str + """The value of the secret.""" diff --git a/src/gcore/types/fastedge/statistic_get_call_series_params.py b/src/gcore/types/fastedge/statistic_get_call_series_params.py new file mode 100644 index 00000000..a1cd6f68 --- /dev/null +++ b/src/gcore/types/fastedge/statistic_get_call_series_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetCallSeriesParams"] + + +class StatisticGetCallSeriesParams(TypedDict, total=False): + from_: Required[Annotated[Union[str, datetime], PropertyInfo(alias="from", format="iso8601")]] + """Reporting period start time, RFC3339 format""" + + step: Required[int] + """Reporting granularity, in seconds""" + + to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """Reporting period end time (not included into reporting period), RFC3339 format""" + + id: int + """App ID""" + + network: str + """Network name""" diff --git a/src/gcore/types/fastedge/statistic_get_call_series_response.py b/src/gcore/types/fastedge/statistic_get_call_series_response.py new file mode 100644 index 00000000..aa06c88e --- /dev/null +++ b/src/gcore/types/fastedge/statistic_get_call_series_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .call_status import CallStatus + +__all__ = ["StatisticGetCallSeriesResponse"] + + +class StatisticGetCallSeriesResponse(BaseModel): + stats: List[CallStatus] diff --git a/src/gcore/types/fastedge/statistic_get_duration_series_params.py b/src/gcore/types/fastedge/statistic_get_duration_series_params.py new file mode 100644 index 00000000..c9170ee8 --- /dev/null +++ b/src/gcore/types/fastedge/statistic_get_duration_series_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetDurationSeriesParams"] + + +class StatisticGetDurationSeriesParams(TypedDict, total=False): + from_: Required[Annotated[Union[str, datetime], PropertyInfo(alias="from", format="iso8601")]] + """Reporting period start time, RFC3339 format""" + + step: Required[int] + """Reporting granularity, in seconds""" + + to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """Reporting period end time (not included into reporting period), RFC3339 format""" + + id: int + """App ID""" + + network: str + """Network name""" diff --git a/src/gcore/types/fastedge/statistic_get_duration_series_response.py b/src/gcore/types/fastedge/statistic_get_duration_series_response.py new file mode 100644 index 00000000..0358ccc7 --- /dev/null +++ b/src/gcore/types/fastedge/statistic_get_duration_series_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .duration_stats import DurationStats + +__all__ = ["StatisticGetDurationSeriesResponse"] + + +class StatisticGetDurationSeriesResponse(BaseModel): + stats: List[DurationStats] diff --git a/src/gcore/types/fastedge/template.py b/src/gcore/types/fastedge/template.py new file mode 100644 index 00000000..71efe55c --- /dev/null +++ b/src/gcore/types/fastedge/template.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .template_parameter import TemplateParameter + +__all__ = ["Template"] + + +class Template(BaseModel): + api_type: str + """Wasm API type""" + + binary_id: int + """Binary ID""" + + name: str + """Name of the template""" + + owned: bool + """Is the template owned by user?""" + + params: List[TemplateParameter] + """Parameters""" + + long_descr: Optional[str] = None + """Long description of the template""" + + short_descr: Optional[str] = None + """Short description of the template""" diff --git a/src/gcore/types/fastedge/template_create_params.py b/src/gcore/types/fastedge/template_create_params.py new file mode 100644 index 00000000..e5f2ad12 --- /dev/null +++ b/src/gcore/types/fastedge/template_create_params.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +from .template_parameter_param import TemplateParameterParam + +__all__ = ["TemplateCreateParams"] + + +class TemplateCreateParams(TypedDict, total=False): + binary_id: Required[int] + """Binary ID""" + + name: Required[str] + """Name of the template""" + + owned: Required[bool] + """Is the template owned by user?""" + + params: Required[Iterable[TemplateParameterParam]] + """Parameters""" + + long_descr: str + """Long description of the template""" + + short_descr: str + """Short description of the template""" diff --git a/src/gcore/types/fastedge/template_delete_params.py b/src/gcore/types/fastedge/template_delete_params.py new file mode 100644 index 00000000..e403aa0e --- /dev/null +++ b/src/gcore/types/fastedge/template_delete_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["TemplateDeleteParams"] + + +class TemplateDeleteParams(TypedDict, total=False): + force: bool + """Force template deletion even if it is shared to groups""" diff --git a/src/gcore/types/fastedge/template_list_params.py b/src/gcore/types/fastedge/template_list_params.py new file mode 100644 index 00000000..09009d39 --- /dev/null +++ b/src/gcore/types/fastedge/template_list_params.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["TemplateListParams"] + + +class TemplateListParams(TypedDict, total=False): + api_type: Literal["wasi-http", "proxy-wasm"] + """ + API type: + wasi-http - WASI with HTTP entry point + proxy-wasm - Proxy-Wasm app, callable from CDN + """ + + limit: int + """Limit for pagination""" + + offset: int + """Offset for pagination""" + + only_mine: bool + """Only my templates""" diff --git a/src/gcore/types/fastedge/template_parameter.py b/src/gcore/types/fastedge/template_parameter.py new file mode 100644 index 00000000..efb19b95 --- /dev/null +++ b/src/gcore/types/fastedge/template_parameter.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["TemplateParameter"] + + +class TemplateParameter(BaseModel): + data_type: Literal["string", "number", "date", "time", "secret"] + """Parameter type""" + + mandatory: bool + """Is this field mandatory?""" + + name: str + """Parameter name""" + + descr: Optional[str] = None + """Parameter description""" diff --git a/src/gcore/types/fastedge/template_parameter_param.py b/src/gcore/types/fastedge/template_parameter_param.py new file mode 100644 index 00000000..6cd74dc9 --- /dev/null +++ b/src/gcore/types/fastedge/template_parameter_param.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, Required, TypedDict + +__all__ = ["TemplateParameterParam"] + + +class TemplateParameterParam(TypedDict, total=False): + data_type: Required[Literal["string", "number", "date", "time", "secret"]] + """Parameter type""" + + mandatory: Required[bool] + """Is this field mandatory?""" + + name: Required[str] + """Parameter name""" + + descr: str + """Parameter description""" diff --git a/src/gcore/types/fastedge/template_replace_params.py b/src/gcore/types/fastedge/template_replace_params.py new file mode 100644 index 00000000..214b22f6 --- /dev/null +++ b/src/gcore/types/fastedge/template_replace_params.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +from .template_parameter_param import TemplateParameterParam + +__all__ = ["TemplateReplaceParams"] + + +class TemplateReplaceParams(TypedDict, total=False): + binary_id: Required[int] + """Binary ID""" + + name: Required[str] + """Name of the template""" + + owned: Required[bool] + """Is the template owned by user?""" + + params: Required[Iterable[TemplateParameterParam]] + """Parameters""" + + long_descr: str + """Long description of the template""" + + short_descr: str + """Short description of the template""" diff --git a/src/gcore/types/fastedge/template_short.py b/src/gcore/types/fastedge/template_short.py new file mode 100644 index 00000000..feed4c89 --- /dev/null +++ b/src/gcore/types/fastedge/template_short.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["TemplateShort"] + + +class TemplateShort(BaseModel): + id: int + """Template ID""" + + api_type: str + """Wasm API type""" + + name: str + """Name of the template""" + + owned: bool + """Is the template owned by user?""" + + long_descr: Optional[str] = None + """Long description of the template""" + + short_descr: Optional[str] = None + """Short description of the template""" diff --git a/tests/api_resources/fastedge/__init__.py b/tests/api_resources/fastedge/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/fastedge/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/fastedge/apps/__init__.py b/tests/api_resources/fastedge/apps/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/fastedge/apps/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/fastedge/apps/test_logs.py b/tests/api_resources/fastedge/apps/test_logs.py new file mode 100644 index 00000000..db4a3cc3 --- /dev/null +++ b/tests/api_resources/fastedge/apps/test_logs.py @@ -0,0 +1,118 @@ +# 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._utils import parse_datetime +from gcore.pagination import SyncOffsetPageFastedgeAppLogs, AsyncOffsetPageFastedgeAppLogs +from gcore.types.fastedge.apps import Log + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLogs: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + log = client.fastedge.apps.logs.list( + id=0, + ) + assert_matches_type(SyncOffsetPageFastedgeAppLogs[Log], log, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + log = client.fastedge.apps.logs.list( + id=0, + client_ip="192.168.1.1", + edge="edge", + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=0, + offset=0, + search="search", + sort="desc", + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(SyncOffsetPageFastedgeAppLogs[Log], log, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.fastedge.apps.logs.with_raw_response.list( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + log = response.parse() + assert_matches_type(SyncOffsetPageFastedgeAppLogs[Log], log, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.fastedge.apps.logs.with_streaming_response.list( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + log = response.parse() + assert_matches_type(SyncOffsetPageFastedgeAppLogs[Log], log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncLogs: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + log = await async_client.fastedge.apps.logs.list( + id=0, + ) + assert_matches_type(AsyncOffsetPageFastedgeAppLogs[Log], log, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + log = await async_client.fastedge.apps.logs.list( + id=0, + client_ip="192.168.1.1", + edge="edge", + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=0, + offset=0, + search="search", + sort="desc", + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(AsyncOffsetPageFastedgeAppLogs[Log], log, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.apps.logs.with_raw_response.list( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + log = await response.parse() + assert_matches_type(AsyncOffsetPageFastedgeAppLogs[Log], log, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.apps.logs.with_streaming_response.list( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + log = await response.parse() + assert_matches_type(AsyncOffsetPageFastedgeAppLogs[Log], log, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/fastedge/test_apps.py b/tests/api_resources/fastedge/test_apps.py new file mode 100644 index 00000000..3cf5b982 --- /dev/null +++ b/tests/api_resources/fastedge/test_apps.py @@ -0,0 +1,570 @@ +# 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.pagination import SyncOffsetPageFastedgeApps, AsyncOffsetPageFastedgeApps +from gcore.types.fastedge import ( + App, + AppShort, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestApps: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + app = client.fastedge.apps.create() + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + app = client.fastedge.apps.create( + binary=0, + comment="comment", + debug=True, + env={ + "var1": "value1", + "var2": "value2", + }, + log="kafka", + name="name", + rsp_headers={ + "header1": "value1", + "header2": "value2", + }, + secrets={"foo": {"id": 0}}, + status=0, + stores={ + "country_allow": 1, + "ip_block": 2, + }, + template=0, + ) + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.fastedge.apps.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.fastedge.apps.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert_matches_type(AppShort, app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + app = client.fastedge.apps.update( + id=0, + ) + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + app = client.fastedge.apps.update( + id=0, + binary=0, + comment="comment", + debug=True, + env={ + "var1": "value1", + "var2": "value2", + }, + log="kafka", + name="name", + rsp_headers={ + "header1": "value1", + "header2": "value2", + }, + secrets={"foo": {"id": 0}}, + status=0, + stores={ + "country_allow": 1, + "ip_block": 2, + }, + template=0, + ) + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.fastedge.apps.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.fastedge.apps.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert_matches_type(AppShort, app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + app = client.fastedge.apps.list() + assert_matches_type(SyncOffsetPageFastedgeApps[AppShort], app, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + app = client.fastedge.apps.list( + api_type="wasi-http", + binary=0, + limit=0, + name="name", + offset=0, + ordering="name", + plan=0, + status=0, + template=0, + ) + assert_matches_type(SyncOffsetPageFastedgeApps[AppShort], app, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.fastedge.apps.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(SyncOffsetPageFastedgeApps[AppShort], app, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.fastedge.apps.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert_matches_type(SyncOffsetPageFastedgeApps[AppShort], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + app = client.fastedge.apps.delete( + 0, + ) + assert app is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.fastedge.apps.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert app is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.fastedge.apps.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert app is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + app = client.fastedge.apps.get( + 0, + ) + assert_matches_type(App, app, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.fastedge.apps.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(App, app, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.fastedge.apps.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert_matches_type(App, app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + app = client.fastedge.apps.replace( + id=0, + ) + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + app = client.fastedge.apps.replace( + id=0, + body={ + "binary": 0, + "comment": "comment", + "debug": True, + "env": { + "var1": "value1", + "var2": "value2", + }, + "log": "kafka", + "name": "name", + "rsp_headers": { + "header1": "value1", + "header2": "value2", + }, + "secrets": {"foo": {"id": 0}}, + "status": 0, + "stores": { + "country_allow": 1, + "ip_block": 2, + }, + "template": 0, + }, + ) + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.fastedge.apps.with_raw_response.replace( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.fastedge.apps.with_streaming_response.replace( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert_matches_type(AppShort, app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncApps: + 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: + app = await async_client.fastedge.apps.create() + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + app = await async_client.fastedge.apps.create( + binary=0, + comment="comment", + debug=True, + env={ + "var1": "value1", + "var2": "value2", + }, + log="kafka", + name="name", + rsp_headers={ + "header1": "value1", + "header2": "value2", + }, + secrets={"foo": {"id": 0}}, + status=0, + stores={ + "country_allow": 1, + "ip_block": 2, + }, + template=0, + ) + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.apps.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.apps.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert_matches_type(AppShort, app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + app = await async_client.fastedge.apps.update( + id=0, + ) + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + app = await async_client.fastedge.apps.update( + id=0, + binary=0, + comment="comment", + debug=True, + env={ + "var1": "value1", + "var2": "value2", + }, + log="kafka", + name="name", + rsp_headers={ + "header1": "value1", + "header2": "value2", + }, + secrets={"foo": {"id": 0}}, + status=0, + stores={ + "country_allow": 1, + "ip_block": 2, + }, + template=0, + ) + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.apps.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.apps.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert_matches_type(AppShort, app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + app = await async_client.fastedge.apps.list() + assert_matches_type(AsyncOffsetPageFastedgeApps[AppShort], app, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + app = await async_client.fastedge.apps.list( + api_type="wasi-http", + binary=0, + limit=0, + name="name", + offset=0, + ordering="name", + plan=0, + status=0, + template=0, + ) + assert_matches_type(AsyncOffsetPageFastedgeApps[AppShort], app, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.apps.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(AsyncOffsetPageFastedgeApps[AppShort], app, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.apps.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert_matches_type(AsyncOffsetPageFastedgeApps[AppShort], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + app = await async_client.fastedge.apps.delete( + 0, + ) + assert app is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.apps.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert app is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.apps.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert app is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + app = await async_client.fastedge.apps.get( + 0, + ) + assert_matches_type(App, app, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.apps.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(App, app, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.apps.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert_matches_type(App, app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + app = await async_client.fastedge.apps.replace( + id=0, + ) + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + app = await async_client.fastedge.apps.replace( + id=0, + body={ + "binary": 0, + "comment": "comment", + "debug": True, + "env": { + "var1": "value1", + "var2": "value2", + }, + "log": "kafka", + "name": "name", + "rsp_headers": { + "header1": "value1", + "header2": "value2", + }, + "secrets": {"foo": {"id": 0}}, + "status": 0, + "stores": { + "country_allow": 1, + "ip_block": 2, + }, + "template": 0, + }, + ) + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.apps.with_raw_response.replace( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(AppShort, app, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.apps.with_streaming_response.replace( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert_matches_type(AppShort, app, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/fastedge/test_binaries.py b/tests/api_resources/fastedge/test_binaries.py new file mode 100644 index 00000000..eb56f54c --- /dev/null +++ b/tests/api_resources/fastedge/test_binaries.py @@ -0,0 +1,198 @@ +# 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.fastedge import Binary, BinaryListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBinaries: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + binary = client.fastedge.binaries.list() + assert_matches_type(BinaryListResponse, binary, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.fastedge.binaries.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + binary = response.parse() + assert_matches_type(BinaryListResponse, binary, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.fastedge.binaries.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + binary = response.parse() + assert_matches_type(BinaryListResponse, binary, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + binary = client.fastedge.binaries.delete( + 0, + ) + assert binary is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.fastedge.binaries.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + binary = response.parse() + assert binary is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.fastedge.binaries.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + binary = response.parse() + assert binary is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + binary = client.fastedge.binaries.get( + 0, + ) + assert_matches_type(Binary, binary, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.fastedge.binaries.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + binary = response.parse() + assert_matches_type(Binary, binary, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.fastedge.binaries.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + binary = response.parse() + assert_matches_type(Binary, binary, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncBinaries: + 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: + binary = await async_client.fastedge.binaries.list() + assert_matches_type(BinaryListResponse, binary, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.binaries.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + binary = await response.parse() + assert_matches_type(BinaryListResponse, binary, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.binaries.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + binary = await response.parse() + assert_matches_type(BinaryListResponse, binary, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + binary = await async_client.fastedge.binaries.delete( + 0, + ) + assert binary is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.binaries.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + binary = await response.parse() + assert binary is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.binaries.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + binary = await response.parse() + assert binary is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + binary = await async_client.fastedge.binaries.get( + 0, + ) + assert_matches_type(Binary, binary, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.binaries.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + binary = await response.parse() + assert_matches_type(Binary, binary, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.binaries.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + binary = await response.parse() + assert_matches_type(Binary, binary, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/fastedge/test_kv_stores.py b/tests/api_resources/fastedge/test_kv_stores.py new file mode 100644 index 00000000..8923cf27 --- /dev/null +++ b/tests/api_resources/fastedge/test_kv_stores.py @@ -0,0 +1,374 @@ +# 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.fastedge import ( + KvStore, + KvStoreGetResponse, + KvStoreListResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestKvStores: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + kv_store = client.fastedge.kv_stores.create() + assert_matches_type(KvStore, kv_store, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + kv_store = client.fastedge.kv_stores.create( + byod={ + "prefix": "prefix", + "url": "url", + }, + comment="comment", + ) + assert_matches_type(KvStore, kv_store, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.fastedge.kv_stores.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + kv_store = response.parse() + assert_matches_type(KvStore, kv_store, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.fastedge.kv_stores.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + kv_store = response.parse() + assert_matches_type(KvStore, kv_store, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + kv_store = client.fastedge.kv_stores.list() + assert_matches_type(KvStoreListResponse, kv_store, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + kv_store = client.fastedge.kv_stores.list( + app_id=0, + ) + assert_matches_type(KvStoreListResponse, kv_store, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.fastedge.kv_stores.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + kv_store = response.parse() + assert_matches_type(KvStoreListResponse, kv_store, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.fastedge.kv_stores.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + kv_store = response.parse() + assert_matches_type(KvStoreListResponse, kv_store, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + kv_store = client.fastedge.kv_stores.delete( + 0, + ) + assert kv_store is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.fastedge.kv_stores.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + kv_store = response.parse() + assert kv_store is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.fastedge.kv_stores.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + kv_store = response.parse() + assert kv_store is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + kv_store = client.fastedge.kv_stores.get( + 0, + ) + assert_matches_type(KvStoreGetResponse, kv_store, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.fastedge.kv_stores.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + kv_store = response.parse() + assert_matches_type(KvStoreGetResponse, kv_store, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.fastedge.kv_stores.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + kv_store = response.parse() + assert_matches_type(KvStoreGetResponse, kv_store, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + kv_store = client.fastedge.kv_stores.replace( + id=0, + ) + assert_matches_type(KvStore, kv_store, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + kv_store = client.fastedge.kv_stores.replace( + id=0, + byod={ + "prefix": "prefix", + "url": "url", + }, + comment="comment", + ) + assert_matches_type(KvStore, kv_store, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.fastedge.kv_stores.with_raw_response.replace( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + kv_store = response.parse() + assert_matches_type(KvStore, kv_store, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.fastedge.kv_stores.with_streaming_response.replace( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + kv_store = response.parse() + assert_matches_type(KvStore, kv_store, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncKvStores: + 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: + kv_store = await async_client.fastedge.kv_stores.create() + assert_matches_type(KvStore, kv_store, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + kv_store = await async_client.fastedge.kv_stores.create( + byod={ + "prefix": "prefix", + "url": "url", + }, + comment="comment", + ) + assert_matches_type(KvStore, kv_store, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.kv_stores.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + kv_store = await response.parse() + assert_matches_type(KvStore, kv_store, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.kv_stores.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + kv_store = await response.parse() + assert_matches_type(KvStore, kv_store, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + kv_store = await async_client.fastedge.kv_stores.list() + assert_matches_type(KvStoreListResponse, kv_store, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + kv_store = await async_client.fastedge.kv_stores.list( + app_id=0, + ) + assert_matches_type(KvStoreListResponse, kv_store, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.kv_stores.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + kv_store = await response.parse() + assert_matches_type(KvStoreListResponse, kv_store, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.kv_stores.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + kv_store = await response.parse() + assert_matches_type(KvStoreListResponse, kv_store, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + kv_store = await async_client.fastedge.kv_stores.delete( + 0, + ) + assert kv_store is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.kv_stores.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + kv_store = await response.parse() + assert kv_store is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.kv_stores.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + kv_store = await response.parse() + assert kv_store is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + kv_store = await async_client.fastedge.kv_stores.get( + 0, + ) + assert_matches_type(KvStoreGetResponse, kv_store, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.kv_stores.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + kv_store = await response.parse() + assert_matches_type(KvStoreGetResponse, kv_store, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.kv_stores.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + kv_store = await response.parse() + assert_matches_type(KvStoreGetResponse, kv_store, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + kv_store = await async_client.fastedge.kv_stores.replace( + id=0, + ) + assert_matches_type(KvStore, kv_store, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + kv_store = await async_client.fastedge.kv_stores.replace( + id=0, + byod={ + "prefix": "prefix", + "url": "url", + }, + comment="comment", + ) + assert_matches_type(KvStore, kv_store, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.kv_stores.with_raw_response.replace( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + kv_store = await response.parse() + assert_matches_type(KvStore, kv_store, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.kv_stores.with_streaming_response.replace( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + kv_store = await response.parse() + assert_matches_type(KvStore, kv_store, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/fastedge/test_secrets.py b/tests/api_resources/fastedge/test_secrets.py new file mode 100644 index 00000000..684ff5d4 --- /dev/null +++ b/tests/api_resources/fastedge/test_secrets.py @@ -0,0 +1,514 @@ +# 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.fastedge import ( + Secret, + SecretListResponse, + SecretCreateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSecrets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + secret = client.fastedge.secrets.create( + name="name", + ) + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + secret = client.fastedge.secrets.create( + name="name", + comment="comment", + secret_slots=[ + { + "slot": 0, + "value": "value", + } + ], + ) + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.fastedge.secrets.with_raw_response.create( + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.fastedge.secrets.with_streaming_response.create( + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + secret = client.fastedge.secrets.update( + id=0, + ) + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + secret = client.fastedge.secrets.update( + id=0, + comment="comment", + name="name", + secret_slots=[ + { + "slot": 0, + "value": "value", + } + ], + ) + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.fastedge.secrets.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.fastedge.secrets.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + secret = client.fastedge.secrets.list() + assert_matches_type(SecretListResponse, secret, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + secret = client.fastedge.secrets.list( + app_id=0, + secret_name="secret_name", + ) + assert_matches_type(SecretListResponse, secret, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.fastedge.secrets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(SecretListResponse, secret, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.fastedge.secrets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(SecretListResponse, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + secret = client.fastedge.secrets.delete( + id=0, + ) + assert secret is None + + @parametrize + def test_method_delete_with_all_params(self, client: Gcore) -> None: + secret = client.fastedge.secrets.delete( + id=0, + force=True, + ) + assert secret is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.fastedge.secrets.with_raw_response.delete( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert secret is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.fastedge.secrets.with_streaming_response.delete( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert secret is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + secret = client.fastedge.secrets.get( + 0, + ) + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.fastedge.secrets.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.fastedge.secrets.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + secret = client.fastedge.secrets.replace( + id=0, + name="name", + ) + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + secret = client.fastedge.secrets.replace( + id=0, + name="name", + comment="comment", + secret_slots=[ + { + "slot": 0, + "value": "value", + } + ], + ) + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.fastedge.secrets.with_raw_response.replace( + id=0, + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.fastedge.secrets.with_streaming_response.replace( + id=0, + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncSecrets: + 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: + secret = await async_client.fastedge.secrets.create( + name="name", + ) + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + secret = await async_client.fastedge.secrets.create( + name="name", + comment="comment", + secret_slots=[ + { + "slot": 0, + "value": "value", + } + ], + ) + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.secrets.with_raw_response.create( + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.secrets.with_streaming_response.create( + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(SecretCreateResponse, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + secret = await async_client.fastedge.secrets.update( + id=0, + ) + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + secret = await async_client.fastedge.secrets.update( + id=0, + comment="comment", + name="name", + secret_slots=[ + { + "slot": 0, + "value": "value", + } + ], + ) + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.secrets.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.secrets.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + secret = await async_client.fastedge.secrets.list() + assert_matches_type(SecretListResponse, secret, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + secret = await async_client.fastedge.secrets.list( + app_id=0, + secret_name="secret_name", + ) + assert_matches_type(SecretListResponse, secret, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.secrets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(SecretListResponse, secret, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.secrets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(SecretListResponse, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + secret = await async_client.fastedge.secrets.delete( + id=0, + ) + assert secret is None + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: + secret = await async_client.fastedge.secrets.delete( + id=0, + force=True, + ) + assert secret is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.secrets.with_raw_response.delete( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert secret is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.secrets.with_streaming_response.delete( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert secret is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + secret = await async_client.fastedge.secrets.get( + 0, + ) + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.secrets.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.secrets.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + secret = await async_client.fastedge.secrets.replace( + id=0, + name="name", + ) + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + secret = await async_client.fastedge.secrets.replace( + id=0, + name="name", + comment="comment", + secret_slots=[ + { + "slot": 0, + "value": "value", + } + ], + ) + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.secrets.with_raw_response.replace( + id=0, + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + secret = await response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.secrets.with_streaming_response.replace( + id=0, + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + secret = await response.parse() + assert_matches_type(Secret, secret, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/fastedge/test_statistics.py b/tests/api_resources/fastedge/test_statistics.py new file mode 100644 index 00000000..71356be3 --- /dev/null +++ b/tests/api_resources/fastedge/test_statistics.py @@ -0,0 +1,220 @@ +# 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._utils import parse_datetime +from gcore.types.fastedge import ( + StatisticGetCallSeriesResponse, + StatisticGetDurationSeriesResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestStatistics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_call_series(self, client: Gcore) -> None: + statistic = client.fastedge.statistics.get_call_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(StatisticGetCallSeriesResponse, statistic, path=["response"]) + + @parametrize + def test_method_get_call_series_with_all_params(self, client: Gcore) -> None: + statistic = client.fastedge.statistics.get_call_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + id=0, + network="network", + ) + assert_matches_type(StatisticGetCallSeriesResponse, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_call_series(self, client: Gcore) -> None: + response = client.fastedge.statistics.with_raw_response.get_call_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(StatisticGetCallSeriesResponse, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_call_series(self, client: Gcore) -> None: + with client.fastedge.statistics.with_streaming_response.get_call_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(StatisticGetCallSeriesResponse, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_duration_series(self, client: Gcore) -> None: + statistic = client.fastedge.statistics.get_duration_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(StatisticGetDurationSeriesResponse, statistic, path=["response"]) + + @parametrize + def test_method_get_duration_series_with_all_params(self, client: Gcore) -> None: + statistic = client.fastedge.statistics.get_duration_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + id=0, + network="network", + ) + assert_matches_type(StatisticGetDurationSeriesResponse, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_duration_series(self, client: Gcore) -> None: + response = client.fastedge.statistics.with_raw_response.get_duration_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(StatisticGetDurationSeriesResponse, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_duration_series(self, client: Gcore) -> None: + with client.fastedge.statistics.with_streaming_response.get_duration_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(StatisticGetDurationSeriesResponse, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncStatistics: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get_call_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.fastedge.statistics.get_call_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(StatisticGetCallSeriesResponse, statistic, path=["response"]) + + @parametrize + async def test_method_get_call_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.fastedge.statistics.get_call_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + id=0, + network="network", + ) + assert_matches_type(StatisticGetCallSeriesResponse, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_call_series(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.statistics.with_raw_response.get_call_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(StatisticGetCallSeriesResponse, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_call_series(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.statistics.with_streaming_response.get_call_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(StatisticGetCallSeriesResponse, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_duration_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.fastedge.statistics.get_duration_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(StatisticGetDurationSeriesResponse, statistic, path=["response"]) + + @parametrize + async def test_method_get_duration_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.fastedge.statistics.get_duration_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + id=0, + network="network", + ) + assert_matches_type(StatisticGetDurationSeriesResponse, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_duration_series(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.statistics.with_raw_response.get_duration_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(StatisticGetDurationSeriesResponse, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_duration_series(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.statistics.with_streaming_response.get_duration_series( + from_=parse_datetime("2019-12-27T18:11:19.117Z"), + step=0, + to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(StatisticGetDurationSeriesResponse, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/fastedge/test_templates.py b/tests/api_resources/fastedge/test_templates.py new file mode 100644 index 00000000..3b530e74 --- /dev/null +++ b/tests/api_resources/fastedge/test_templates.py @@ -0,0 +1,554 @@ +# 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.pagination import SyncOffsetPageFastedgeTemplates, AsyncOffsetPageFastedgeTemplates +from gcore.types.fastedge import ( + Template, + TemplateShort, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTemplates: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + template = client.fastedge.templates.create( + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + } + ], + ) + assert_matches_type(TemplateShort, template, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + template = client.fastedge.templates.create( + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + "descr": "descr", + } + ], + long_descr="long_descr", + short_descr="short_descr", + ) + assert_matches_type(TemplateShort, template, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.fastedge.templates.with_raw_response.create( + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + } + ], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = response.parse() + assert_matches_type(TemplateShort, template, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.fastedge.templates.with_streaming_response.create( + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = response.parse() + assert_matches_type(TemplateShort, template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + template = client.fastedge.templates.list() + assert_matches_type(SyncOffsetPageFastedgeTemplates[TemplateShort], template, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + template = client.fastedge.templates.list( + api_type="wasi-http", + limit=0, + offset=0, + only_mine=True, + ) + assert_matches_type(SyncOffsetPageFastedgeTemplates[TemplateShort], template, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.fastedge.templates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = response.parse() + assert_matches_type(SyncOffsetPageFastedgeTemplates[TemplateShort], template, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.fastedge.templates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = response.parse() + assert_matches_type(SyncOffsetPageFastedgeTemplates[TemplateShort], template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + template = client.fastedge.templates.delete( + id=0, + ) + assert template is None + + @parametrize + def test_method_delete_with_all_params(self, client: Gcore) -> None: + template = client.fastedge.templates.delete( + id=0, + force=True, + ) + assert template is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.fastedge.templates.with_raw_response.delete( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = response.parse() + assert template is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.fastedge.templates.with_streaming_response.delete( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = response.parse() + assert template is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + template = client.fastedge.templates.get( + 0, + ) + assert_matches_type(Template, template, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.fastedge.templates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = response.parse() + assert_matches_type(Template, template, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.fastedge.templates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = response.parse() + assert_matches_type(Template, template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + template = client.fastedge.templates.replace( + id=0, + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + } + ], + ) + assert_matches_type(TemplateShort, template, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + template = client.fastedge.templates.replace( + id=0, + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + "descr": "descr", + } + ], + long_descr="long_descr", + short_descr="short_descr", + ) + assert_matches_type(TemplateShort, template, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.fastedge.templates.with_raw_response.replace( + id=0, + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + } + ], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = response.parse() + assert_matches_type(TemplateShort, template, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.fastedge.templates.with_streaming_response.replace( + id=0, + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = response.parse() + assert_matches_type(TemplateShort, template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncTemplates: + 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: + template = await async_client.fastedge.templates.create( + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + } + ], + ) + assert_matches_type(TemplateShort, template, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + template = await async_client.fastedge.templates.create( + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + "descr": "descr", + } + ], + long_descr="long_descr", + short_descr="short_descr", + ) + assert_matches_type(TemplateShort, template, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.templates.with_raw_response.create( + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + } + ], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = await response.parse() + assert_matches_type(TemplateShort, template, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.templates.with_streaming_response.create( + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = await response.parse() + assert_matches_type(TemplateShort, template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + template = await async_client.fastedge.templates.list() + assert_matches_type(AsyncOffsetPageFastedgeTemplates[TemplateShort], template, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + template = await async_client.fastedge.templates.list( + api_type="wasi-http", + limit=0, + offset=0, + only_mine=True, + ) + assert_matches_type(AsyncOffsetPageFastedgeTemplates[TemplateShort], template, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.templates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = await response.parse() + assert_matches_type(AsyncOffsetPageFastedgeTemplates[TemplateShort], template, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.templates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = await response.parse() + assert_matches_type(AsyncOffsetPageFastedgeTemplates[TemplateShort], template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + template = await async_client.fastedge.templates.delete( + id=0, + ) + assert template is None + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: + template = await async_client.fastedge.templates.delete( + id=0, + force=True, + ) + assert template is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.templates.with_raw_response.delete( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = await response.parse() + assert template is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.templates.with_streaming_response.delete( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = await response.parse() + assert template is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + template = await async_client.fastedge.templates.get( + 0, + ) + assert_matches_type(Template, template, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.templates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = await response.parse() + assert_matches_type(Template, template, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.templates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = await response.parse() + assert_matches_type(Template, template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + template = await async_client.fastedge.templates.replace( + id=0, + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + } + ], + ) + assert_matches_type(TemplateShort, template, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + template = await async_client.fastedge.templates.replace( + id=0, + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + "descr": "descr", + } + ], + long_descr="long_descr", + short_descr="short_descr", + ) + assert_matches_type(TemplateShort, template, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.templates.with_raw_response.replace( + id=0, + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + } + ], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = await response.parse() + assert_matches_type(TemplateShort, template, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.templates.with_streaming_response.replace( + id=0, + binary_id=0, + name="name", + owned=True, + params=[ + { + "data_type": "string", + "mandatory": True, + "name": "name", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = await response.parse() + assert_matches_type(TemplateShort, template, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_fastedge.py b/tests/api_resources/test_fastedge.py new file mode 100644 index 00000000..a70099a2 --- /dev/null +++ b/tests/api_resources/test_fastedge.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.fastedge import Client + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFastedge: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_account_overview(self, client: Gcore) -> None: + fastedge = client.fastedge.get_account_overview() + assert_matches_type(Client, fastedge, path=["response"]) + + @parametrize + def test_raw_response_get_account_overview(self, client: Gcore) -> None: + response = client.fastedge.with_raw_response.get_account_overview() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + fastedge = response.parse() + assert_matches_type(Client, fastedge, path=["response"]) + + @parametrize + def test_streaming_response_get_account_overview(self, client: Gcore) -> None: + with client.fastedge.with_streaming_response.get_account_overview() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + fastedge = response.parse() + assert_matches_type(Client, fastedge, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFastedge: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get_account_overview(self, async_client: AsyncGcore) -> None: + fastedge = await async_client.fastedge.get_account_overview() + assert_matches_type(Client, fastedge, path=["response"]) + + @parametrize + async def test_raw_response_get_account_overview(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.with_raw_response.get_account_overview() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + fastedge = await response.parse() + assert_matches_type(Client, fastedge, path=["response"]) + + @parametrize + async def test_streaming_response_get_account_overview(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.with_streaming_response.get_account_overview() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + fastedge = await response.parse() + assert_matches_type(Client, fastedge, path=["response"]) + + assert cast(Any, response.is_closed) is True From 918ba3129766a57e478e3bd68e09a31a8ab0d96d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 12 Jul 2025 02:19:28 +0000 Subject: [PATCH 204/592] fix(client): don't send Content-Type header on GET requests --- pyproject.toml | 2 +- src/gcore/_base_client.py | 11 +++++++++-- tests/test_client.py | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3736d540..f7865819 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ Homepage = "https://github.com/G-Core/gcore-python" Repository = "https://github.com/G-Core/gcore-python" [project.optional-dependencies] -aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"] +aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"] [tool.rye] managed = true diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index d531e5f0..66b54908 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -529,6 +529,15 @@ def _build_request( # work around https://github.com/encode/httpx/discussions/2880 kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")} + is_body_allowed = options.method.lower() != "get" + + if is_body_allowed: + kwargs["json"] = json_data if is_given(json_data) else None + kwargs["files"] = files + else: + headers.pop("Content-Type", None) + kwargs.pop("data", None) + # TODO: report this error to httpx return self._client.build_request( # pyright: ignore[reportUnknownMemberType] headers=headers, @@ -540,8 +549,6 @@ def _build_request( # so that passing a `TypedDict` doesn't cause an error. # https://github.com/microsoft/pyright/issues/3526#event-6715453066 params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None, - json=json_data if is_given(json_data) else None, - files=files, **kwargs, ) diff --git a/tests/test_client.py b/tests/test_client.py index 53499b05..b0d1e897 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -484,7 +484,7 @@ def test_request_extra_query(self) -> None: def test_multipart_repeating_array(self, client: Gcore) -> None: request = client._build_request( FinalRequestOptions.construct( - method="get", + method="post", url="/foo", headers={"Content-Type": "multipart/form-data; boundary=6b7ba517decee4a450543ea6ae821c82"}, json_data={"array": ["foo", "bar"]}, @@ -1309,7 +1309,7 @@ def test_request_extra_query(self) -> None: def test_multipart_repeating_array(self, async_client: AsyncGcore) -> None: request = async_client._build_request( FinalRequestOptions.construct( - method="get", + method="post", url="/foo", headers={"Content-Type": "multipart/form-data; boundary=6b7ba517decee4a450543ea6ae821c82"}, json_data={"array": ["foo", "bar"]}, From 922734aab07dcd4210cbda370f9bb1130749494f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 14 Jul 2025 08:14:18 +0000 Subject: [PATCH 205/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/cloud/tasks.py | 58 ++++++++++--------- .../cloud/inference/inference_deployment.py | 12 ++++ src/gcore/types/cloud/task_list_params.py | 29 +++++----- 4 files changed, 59 insertions(+), 44 deletions(-) diff --git a/.stats.yml b/.stats.yml index 113520b7..99131f6c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 337 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8fcee4b6e612c0aaed2afbda3a161dcab07b93b934c9e21ade9051996568a4ff.yml -openapi_spec_hash: 042d388f4c7c9ef9d9b2ad9897e0356c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-aaaf7e44820ece13d49099b1a41b42af0f63cf01c7eec3f048ea8fcd0052d766.yml +openapi_spec_hash: d539ad038b647e679b09b60d078cf588 config_hash: 75a2b72caefaa0a5917618c9a426e79b diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index c8914e5e..338244f7 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -102,7 +102,8 @@ def list( '`create_ai_cluster_gpu`', '`create_bm`', '`create_caas_container`', '`create_dbaas_postgres_cluster`', '`create_ddos_profile`', '`create_faas_function`', '`create_faas_namespace`', '`create_fip`', - '`create_gpu_virtual_cluster`', '`create_image`', '`create_inference_instance`', + '`create_gpu_virtual_cluster`', '`create_image`', + '`create_inference_application`', '`create_inference_instance`', '`create_inference_instance_key`', '`create_k8s_cluster_pool_v2`', '`create_k8s_cluster_v2`', '`create_l7policy`', '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', @@ -114,14 +115,14 @@ def list( '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', '`delete_image`', - '`delete_inference_instance`', '`delete_k8s_cluster_pool_v2`', - '`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_inference_application`', '`delete_inference_instance`', + '`delete_k8s_cluster_pool_v2`', '`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`', '`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`', @@ -137,11 +138,11 @@ def list( '`start_gpu_virtual_server`', '`start_vm`', '`stop_gpu_baremetal_server`', '`stop_gpu_virtual_cluster`', '`stop_gpu_virtual_server`', '`stop_vm`', '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', - '`update_inference_instance`', '`update_inference_instance_key`', - '`update_k8s_cluster_v2`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`', - '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', - '`upscale_gpu_virtual_cluster`'] + '`update_inference_application`', '`update_inference_instance`', + '`update_inference_instance_key`', '`update_k8s_cluster_v2`', + '`update_lbmetadata`', '`update_port_allowed_address_pairs`', + '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', + '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` @@ -376,7 +377,8 @@ def list( '`create_ai_cluster_gpu`', '`create_bm`', '`create_caas_container`', '`create_dbaas_postgres_cluster`', '`create_ddos_profile`', '`create_faas_function`', '`create_faas_namespace`', '`create_fip`', - '`create_gpu_virtual_cluster`', '`create_image`', '`create_inference_instance`', + '`create_gpu_virtual_cluster`', '`create_image`', + '`create_inference_application`', '`create_inference_instance`', '`create_inference_instance_key`', '`create_k8s_cluster_pool_v2`', '`create_k8s_cluster_v2`', '`create_l7policy`', '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', @@ -388,14 +390,14 @@ def list( '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', '`delete_image`', - '`delete_inference_instance`', '`delete_k8s_cluster_pool_v2`', - '`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_inference_application`', '`delete_inference_instance`', + '`delete_k8s_cluster_pool_v2`', '`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`', '`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`', @@ -411,11 +413,11 @@ def list( '`start_gpu_virtual_server`', '`start_vm`', '`stop_gpu_baremetal_server`', '`stop_gpu_virtual_cluster`', '`stop_gpu_virtual_server`', '`stop_vm`', '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', - '`update_inference_instance`', '`update_inference_instance_key`', - '`update_k8s_cluster_v2`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`', - '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', - '`upscale_gpu_virtual_cluster`'] + '`update_inference_application`', '`update_inference_instance`', + '`update_inference_instance_key`', '`update_k8s_cluster_v2`', + '`update_lbmetadata`', '`update_port_allowed_address_pairs`', + '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', + '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` diff --git a/src/gcore/types/cloud/inference/inference_deployment.py b/src/gcore/types/cloud/inference/inference_deployment.py index 189b5d4c..1cde4c63 100644 --- a/src/gcore/types/cloud/inference/inference_deployment.py +++ b/src/gcore/types/cloud/inference/inference_deployment.py @@ -20,6 +20,7 @@ "ContainerScaleTriggersMemory", "ContainerScaleTriggersSqs", "IngressOpts", + "ObjectReference", "Probes", ] @@ -157,6 +158,14 @@ class IngressOpts(BaseModel): """ +class ObjectReference(BaseModel): + kind: Literal["AppDeployment"] + """Kind of the inference object to be referenced""" + + name: str + """Name of the inference object to be referenced""" + + class Probes(BaseModel): liveness_probe: Optional[ProbeConfig] = None """Liveness probe configuration""" @@ -220,6 +229,9 @@ class InferenceDeployment(BaseModel): name: str """Inference instance name.""" + object_references: List[ObjectReference] + """Indicates to which parent object this inference belongs to.""" + probes: Optional[Probes] = None """Probes configured for all containers of the inference instance.""" diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index 70ff58a2..3835a7f4 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -65,7 +65,8 @@ class TaskListParams(TypedDict, total=False): '`create_ai_cluster_gpu`', '`create_bm`', '`create_caas_container`', '`create_dbaas_postgres_cluster`', '`create_ddos_profile`', '`create_faas_function`', '`create_faas_namespace`', '`create_fip`', - '`create_gpu_virtual_cluster`', '`create_image`', '`create_inference_instance`', + '`create_gpu_virtual_cluster`', '`create_image`', + '`create_inference_application`', '`create_inference_instance`', '`create_inference_instance_key`', '`create_k8s_cluster_pool_v2`', '`create_k8s_cluster_v2`', '`create_l7policy`', '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', @@ -77,14 +78,14 @@ class TaskListParams(TypedDict, total=False): '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', '`delete_image`', - '`delete_inference_instance`', '`delete_k8s_cluster_pool_v2`', - '`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_inference_application`', '`delete_inference_instance`', + '`delete_k8s_cluster_pool_v2`', '`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`', '`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`', @@ -100,11 +101,11 @@ class TaskListParams(TypedDict, total=False): '`start_gpu_virtual_server`', '`start_vm`', '`stop_gpu_baremetal_server`', '`stop_gpu_virtual_cluster`', '`stop_gpu_virtual_server`', '`stop_vm`', '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', - '`update_inference_instance`', '`update_inference_instance_key`', - '`update_k8s_cluster_v2`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`', - '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', - '`upscale_gpu_virtual_cluster`'] + '`update_inference_application`', '`update_inference_instance`', + '`update_inference_instance_key`', '`update_k8s_cluster_v2`', + '`update_lbmetadata`', '`update_port_allowed_address_pairs`', + '`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")] From c3f92c2e0d64aae5360246b6402897c3bf5aca86 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 14 Jul 2025 11:08:10 +0000 Subject: [PATCH 206/592] chore(client): set default timeout to be 2 mins --- .stats.yml | 2 +- README.md | 4 ++-- src/gcore/_constants.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 99131f6c..744b9838 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 337 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-aaaf7e44820ece13d49099b1a41b42af0f63cf01c7eec3f048ea8fcd0052d766.yml openapi_spec_hash: d539ad038b647e679b09b60d078cf588 -config_hash: 75a2b72caefaa0a5917618c9a426e79b +config_hash: 551cd61430c865c43b24da0e0fde6e70 diff --git a/README.md b/README.md index 9198c0b9..5114907d 100644 --- a/README.md +++ b/README.md @@ -253,7 +253,7 @@ client.with_options(max_retries=5).cloud.projects.create( ### Timeouts -By default requests time out after 1 minute. You can configure this with a `timeout` option, +By default requests time out after 2 minutes. You can configure this with a `timeout` option, which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object: ```python @@ -261,7 +261,7 @@ from gcore import Gcore # Configure the default for all requests: client = Gcore( - # 20 seconds (default is 1 minute) + # 20 seconds (default is 2 minutes) timeout=20.0, ) diff --git a/src/gcore/_constants.py b/src/gcore/_constants.py index 6ddf2c71..3d06978d 100644 --- a/src/gcore/_constants.py +++ b/src/gcore/_constants.py @@ -5,8 +5,8 @@ RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response" OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to" -# default timeout is 1 minute -DEFAULT_TIMEOUT = httpx.Timeout(timeout=60, connect=5.0) +# default timeout is 2 minutes +DEFAULT_TIMEOUT = httpx.Timeout(timeout=120, connect=5.0) DEFAULT_MAX_RETRIES = 2 DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) From 3b0d3701e71068638bd4e3284a7056e8df5d9387 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 14 Jul 2025 11:14:28 +0000 Subject: [PATCH 207/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index da59f99e..2aca35ae 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.4.0" + ".": "0.5.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index f7865819..b3f723b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.4.0" +version = "0.5.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 bab6ec7d..3ede2fba 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.4.0" # x-release-please-version +__version__ = "0.5.0" # x-release-please-version From 7136e680b6e869569148bd6537f4c69154c1518d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 02:19:07 +0000 Subject: [PATCH 208/592] feat: clean up environment call outs --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 5114907d..c6d6ca1e 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,6 @@ 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 +90,7 @@ from gcore import AsyncGcore async def main() -> None: async with AsyncGcore( - api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted + api_key="My API Key", http_client=DefaultAioHttpClient(), ) as client: project = await client.cloud.projects.create( From 7febd62a61c2d2e88a6ccd637b617198f4caefb5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Jul 2025 09:00:21 +0000 Subject: [PATCH 209/592] GCLOUD2-19725 Add cloud user actions --- .stats.yml | 4 +- api.md | 12 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/audit_logs.py | 480 ++++++++++++++++++ src/gcore/resources/cloud/cloud.py | 32 ++ src/gcore/types/cloud/__init__.py | 2 + src/gcore/types/cloud/audit_log_entry.py | 254 +++++++++ .../types/cloud/audit_log_list_params.py | 158 ++++++ tests/api_resources/cloud/test_audit_logs.py | 112 ++++ 9 files changed, 1066 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/audit_logs.py create mode 100644 src/gcore/types/cloud/audit_log_entry.py create mode 100644 src/gcore/types/cloud/audit_log_list_params.py create mode 100644 tests/api_resources/cloud/test_audit_logs.py diff --git a/.stats.yml b/.stats.yml index 744b9838..656991bb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 337 +configured_endpoints: 338 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-aaaf7e44820ece13d49099b1a41b42af0f63cf01c7eec3f048ea8fcd0052d766.yml openapi_spec_hash: d539ad038b647e679b09b60d078cf588 -config_hash: 551cd61430c865c43b24da0e0fde6e70 +config_hash: df682bec86f06bc441e405f3cb99ab11 diff --git a/api.md b/api.md index a77c6d3d..16e1c31e 100644 --- a/api.md +++ b/api.md @@ -844,6 +844,18 @@ Methods: - client.cloud.instances.metrics.list(instance_id, \*, project_id, region_id, \*\*params) -> MetricsList +## AuditLogs + +Types: + +```python +from gcore.types.cloud import AuditLogEntry +``` + +Methods: + +- client.cloud.audit_logs.list(\*\*params) -> SyncOffsetPage[AuditLogEntry] + # Waap Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 62c133cf..4529d9e8 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -112,6 +112,14 @@ IPRangesResourceWithStreamingResponse, AsyncIPRangesResourceWithStreamingResponse, ) +from .audit_logs import ( + AuditLogsResource, + AsyncAuditLogsResource, + AuditLogsResourceWithRawResponse, + AsyncAuditLogsResourceWithRawResponse, + AuditLogsResourceWithStreamingResponse, + AsyncAuditLogsResourceWithStreamingResponse, +) from .registries import ( RegistriesResource, AsyncRegistriesResource, @@ -318,6 +326,12 @@ "AsyncInstancesResourceWithRawResponse", "InstancesResourceWithStreamingResponse", "AsyncInstancesResourceWithStreamingResponse", + "AuditLogsResource", + "AsyncAuditLogsResource", + "AuditLogsResourceWithRawResponse", + "AsyncAuditLogsResourceWithRawResponse", + "AuditLogsResourceWithStreamingResponse", + "AsyncAuditLogsResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py new file mode 100644 index 00000000..b6aa9de3 --- /dev/null +++ b/src/gcore/resources/cloud/audit_logs.py @@ -0,0 +1,480 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ...types.cloud import audit_log_list_params +from ..._base_client import AsyncPaginator, make_request_options +from ...types.cloud.audit_log_entry import AuditLogEntry + +__all__ = ["AuditLogsResource", "AsyncAuditLogsResource"] + + +class AuditLogsResource(SyncAPIResource): + @cached_property + 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 AuditLogsResourceWithRawResponse(self) + + @cached_property + 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 AuditLogsResourceWithStreamingResponse(self) + + def list( + self, + *, + action_type: List[ + Literal[ + "activate", + "attach", + "change_logging_resources", + "create", + "create_access_rule", + "deactivate", + "delete", + "delete_access_rule", + "delete_metadata", + "detach", + "disable_logging", + "disable_portsecurity", + "download", + "enable_logging", + "enable_portsecurity", + "failover", + "put_into_servergroup", + "reboot", + "reboot_hard", + "rebuild", + "regenerate_credentials", + "remove_from_servergroup", + "replace_metadata", + "resize", + "resume", + "retype", + "revert", + "scale_down", + "scale_up", + "start", + "stop", + "suspend", + "update", + "update_metadata", + "upgrade", + ] + ] + | NotGiven = NOT_GIVEN, + api_group: List[ + Literal[ + "ai_cluster", + "backup_service", + "caas_container", + "caas_key", + "caas_pull_secret", + "dbaas_postgres", + "ddos_profile", + "faas_function", + "faas_key", + "faas_namespace", + "file_shares", + "floating_ip", + "image", + "inference_at_the_edge", + "instance", + "instance_isolation", + "k8s_cluster", + "k8s_cluster_template", + "k8s_pool", + "laas", + "laas_topic", + "lb_health_monitor", + "lb_l7policy", + "lb_l7rule", + "lblistener", + "lbpool", + "lbpool_member", + "lifecycle_policy", + "lifecycle_policy_volume_member", + "loadbalancer", + "network", + "port", + "project", + "quota_limit_request", + "registry", + "reservation", + "reserved_fixed_ip", + "role", + "router", + "secret", + "securitygroup", + "securitygrouprule", + "servergroup", + "shared_flavor", + "shared_image", + "shared_network", + "snapshot", + "snapshot_schedule", + "ssh_key", + "subnet", + "user", + "vip_ip_addresses", + "volume", + ] + ] + | NotGiven = NOT_GIVEN, + from_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + project_id: Iterable[int] | NotGiven = NOT_GIVEN, + region_id: Iterable[int] | NotGiven = NOT_GIVEN, + resource_id: List[str] | NotGiven = NOT_GIVEN, + search_field: str | NotGiven = NOT_GIVEN, + sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + to_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[AuditLogEntry]: + """ + Retrieve user action log for one client or a set of projects + + Args: + action_type: User action type. Several options can be specified. + + api_group: API group that requested action belongs to. Several options can be specified. + + from_timestamp: ISO formatted datetime string. Starting timestamp from which user actions are + requested + + limit: Optional. Limit the number of returned items + + offset: Optional. Offset value is used to exclude the first set of records from the + result + + order_by: Sorting by timestamp. Oldest first, or most recent first + + project_id: Project ID. Several options can be specified. + + region_id: Region ID. Several options can be specified. + + resource_id: Resource ID. Several options can be specified. + + search_field: Extra search field for common object properties such as name, IP address, or + other, depending on the `resource_type` + + sorting: (DEPRECATED Use '`order_by`' instead) Sorting by timestamp. Oldest first, or + most recent first + + to_timestamp: ISO formatted datetime string. Ending timestamp until which user actions are + requested + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v1/user_actions", + page=SyncOffsetPage[AuditLogEntry], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "action_type": action_type, + "api_group": api_group, + "from_timestamp": from_timestamp, + "limit": limit, + "offset": offset, + "order_by": order_by, + "project_id": project_id, + "region_id": region_id, + "resource_id": resource_id, + "search_field": search_field, + "sorting": sorting, + "to_timestamp": to_timestamp, + }, + audit_log_list_params.AuditLogListParams, + ), + ), + model=AuditLogEntry, + ) + + +class AsyncAuditLogsResource(AsyncAPIResource): + @cached_property + 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 AsyncAuditLogsResourceWithRawResponse(self) + + @cached_property + 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 AsyncAuditLogsResourceWithStreamingResponse(self) + + def list( + self, + *, + action_type: List[ + Literal[ + "activate", + "attach", + "change_logging_resources", + "create", + "create_access_rule", + "deactivate", + "delete", + "delete_access_rule", + "delete_metadata", + "detach", + "disable_logging", + "disable_portsecurity", + "download", + "enable_logging", + "enable_portsecurity", + "failover", + "put_into_servergroup", + "reboot", + "reboot_hard", + "rebuild", + "regenerate_credentials", + "remove_from_servergroup", + "replace_metadata", + "resize", + "resume", + "retype", + "revert", + "scale_down", + "scale_up", + "start", + "stop", + "suspend", + "update", + "update_metadata", + "upgrade", + ] + ] + | NotGiven = NOT_GIVEN, + api_group: List[ + Literal[ + "ai_cluster", + "backup_service", + "caas_container", + "caas_key", + "caas_pull_secret", + "dbaas_postgres", + "ddos_profile", + "faas_function", + "faas_key", + "faas_namespace", + "file_shares", + "floating_ip", + "image", + "inference_at_the_edge", + "instance", + "instance_isolation", + "k8s_cluster", + "k8s_cluster_template", + "k8s_pool", + "laas", + "laas_topic", + "lb_health_monitor", + "lb_l7policy", + "lb_l7rule", + "lblistener", + "lbpool", + "lbpool_member", + "lifecycle_policy", + "lifecycle_policy_volume_member", + "loadbalancer", + "network", + "port", + "project", + "quota_limit_request", + "registry", + "reservation", + "reserved_fixed_ip", + "role", + "router", + "secret", + "securitygroup", + "securitygrouprule", + "servergroup", + "shared_flavor", + "shared_image", + "shared_network", + "snapshot", + "snapshot_schedule", + "ssh_key", + "subnet", + "user", + "vip_ip_addresses", + "volume", + ] + ] + | NotGiven = NOT_GIVEN, + from_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + project_id: Iterable[int] | NotGiven = NOT_GIVEN, + region_id: Iterable[int] | NotGiven = NOT_GIVEN, + resource_id: List[str] | NotGiven = NOT_GIVEN, + search_field: str | NotGiven = NOT_GIVEN, + sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + to_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[AuditLogEntry, AsyncOffsetPage[AuditLogEntry]]: + """ + Retrieve user action log for one client or a set of projects + + Args: + action_type: User action type. Several options can be specified. + + api_group: API group that requested action belongs to. Several options can be specified. + + from_timestamp: ISO formatted datetime string. Starting timestamp from which user actions are + requested + + limit: Optional. Limit the number of returned items + + offset: Optional. Offset value is used to exclude the first set of records from the + result + + order_by: Sorting by timestamp. Oldest first, or most recent first + + project_id: Project ID. Several options can be specified. + + region_id: Region ID. Several options can be specified. + + resource_id: Resource ID. Several options can be specified. + + search_field: Extra search field for common object properties such as name, IP address, or + other, depending on the `resource_type` + + sorting: (DEPRECATED Use '`order_by`' instead) Sorting by timestamp. Oldest first, or + most recent first + + to_timestamp: ISO formatted datetime string. Ending timestamp until which user actions are + requested + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cloud/v1/user_actions", + page=AsyncOffsetPage[AuditLogEntry], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "action_type": action_type, + "api_group": api_group, + "from_timestamp": from_timestamp, + "limit": limit, + "offset": offset, + "order_by": order_by, + "project_id": project_id, + "region_id": region_id, + "resource_id": resource_id, + "search_field": search_field, + "sorting": sorting, + "to_timestamp": to_timestamp, + }, + audit_log_list_params.AuditLogListParams, + ), + ), + model=AuditLogEntry, + ) + + +class AuditLogsResourceWithRawResponse: + def __init__(self, audit_logs: AuditLogsResource) -> None: + self._audit_logs = audit_logs + + self.list = to_raw_response_wrapper( + audit_logs.list, + ) + + +class AsyncAuditLogsResourceWithRawResponse: + def __init__(self, audit_logs: AsyncAuditLogsResource) -> None: + self._audit_logs = audit_logs + + self.list = async_to_raw_response_wrapper( + audit_logs.list, + ) + + +class AuditLogsResourceWithStreamingResponse: + def __init__(self, audit_logs: AuditLogsResource) -> None: + self._audit_logs = audit_logs + + self.list = to_streamed_response_wrapper( + audit_logs.list, + ) + + +class AsyncAuditLogsResourceWithStreamingResponse: + def __init__(self, audit_logs: AsyncAuditLogsResource) -> None: + self._audit_logs = audit_logs + + self.list = async_to_streamed_response_wrapper( + audit_logs.list, + ) diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 9b07f92c..c74fbd97 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -59,6 +59,14 @@ IPRangesResourceWithStreamingResponse, AsyncIPRangesResourceWithStreamingResponse, ) +from .audit_logs import ( + AuditLogsResource, + AsyncAuditLogsResource, + AuditLogsResourceWithRawResponse, + AsyncAuditLogsResourceWithRawResponse, + AuditLogsResourceWithStreamingResponse, + AsyncAuditLogsResourceWithStreamingResponse, +) from ..._resource import SyncAPIResource, AsyncAPIResource from .users.users import ( UsersResource, @@ -273,6 +281,10 @@ def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResource: def instances(self) -> InstancesResource: return InstancesResource(self._client) + @cached_property + def audit_logs(self) -> AuditLogsResource: + return AuditLogsResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -382,6 +394,10 @@ def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResource: def instances(self) -> AsyncInstancesResource: return AsyncInstancesResource(self._client) + @cached_property + def audit_logs(self) -> AsyncAuditLogsResource: + return AsyncAuditLogsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -494,6 +510,10 @@ def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithRawResponse: def instances(self) -> InstancesResourceWithRawResponse: return InstancesResourceWithRawResponse(self._cloud.instances) + @cached_property + def audit_logs(self) -> AuditLogsResourceWithRawResponse: + return AuditLogsResourceWithRawResponse(self._cloud.audit_logs) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -587,6 +607,10 @@ def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithRawResp def instances(self) -> AsyncInstancesResourceWithRawResponse: return AsyncInstancesResourceWithRawResponse(self._cloud.instances) + @cached_property + def audit_logs(self) -> AsyncAuditLogsResourceWithRawResponse: + return AsyncAuditLogsResourceWithRawResponse(self._cloud.audit_logs) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -680,6 +704,10 @@ def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithStreamingRes def instances(self) -> InstancesResourceWithStreamingResponse: return InstancesResourceWithStreamingResponse(self._cloud.instances) + @cached_property + def audit_logs(self) -> AuditLogsResourceWithStreamingResponse: + return AuditLogsResourceWithStreamingResponse(self._cloud.audit_logs) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -772,3 +800,7 @@ def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithStreami @cached_property def instances(self) -> AsyncInstancesResourceWithStreamingResponse: return AsyncInstancesResourceWithStreamingResponse(self._cloud.instances) + + @cached_property + def audit_logs(self) -> AsyncAuditLogsResourceWithStreamingResponse: + return AsyncAuditLogsResourceWithStreamingResponse(self._cloud.audit_logs) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 050b0536..a8758fd0 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -40,6 +40,7 @@ from .gpu_image_list import GPUImageList as GPUImageList from .health_monitor import HealthMonitor as HealthMonitor from .security_group import SecurityGroup as SecurityGroup +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 @@ -81,6 +82,7 @@ from .volume_resize_params import VolumeResizeParams as VolumeResizeParams from .volume_update_params import VolumeUpdateParams as VolumeUpdateParams from .allowed_address_pairs import AllowedAddressPairs as AllowedAddressPairs +from .audit_log_list_params import AuditLogListParams as AuditLogListParams from .baremetal_flavor_list import BaremetalFlavorList as BaremetalFlavorList from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate from .gpu_baremetal_cluster import GPUBaremetalCluster as GPUBaremetalCluster diff --git a/src/gcore/types/cloud/audit_log_entry.py b/src/gcore/types/cloud/audit_log_entry.py new file mode 100644 index 00000000..810184ea --- /dev/null +++ b/src/gcore/types/cloud/audit_log_entry.py @@ -0,0 +1,254 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["AuditLogEntry", "Resource", "TotalPrice"] + + +class Resource(BaseModel): + resource_id: str + """Resource ID""" + + resource_type: Literal[ + "caas_container", + "caas_key", + "caas_pull_secret", + "dbaas_postgres", + "ddos_profile", + "external_ip", + "faas_function", + "faas_key", + "faas_namespace", + "file_shares", + "floating_ip", + "gpu_baremetal_server", + "gpu_virtual_server", + "gpuai_cluster", + "image", + "inference_api_key", + "inference_application", + "inference_instance", + "inference_registry_credentials", + "inference_secret", + "instance", + "ipu_cluster", + "k8s_cluster", + "k8s_cluster_template", + "k8s_pool", + "laas", + "laas_topic", + "lb_health_monitor", + "lb_l7policy", + "lb_l7rule", + "lblistener", + "lbpool", + "lbpool_member", + "lifecycle_policy", + "lifecycle_policy_volume_member", + "loadbalancer", + "network", + "port", + "project", + "quota_limit_request", + "registry", + "registry_repository", + "registry_repository_artifact", + "registry_repository_tag", + "registry_user", + "registry_user_sercret", + "reservation", + "role", + "router", + "secret", + "securitygroup", + "securitygrouprule", + "servergroup", + "shared_flavor", + "shared_image", + "shared_network", + "snapshot", + "snapshot_schedule", + "ssh_key", + "subnet", + "token", + "user", + "virtual_gpu_cluster", + "volume", + ] + """Resource type""" + + resource_body: Optional[object] = None + """Free-form object, resource body.""" + + search_field: Optional[str] = None + """Often used property for filtering actions. + + It can be a name, IP address, or other property, depending on the + `resource_type` + """ + + +class TotalPrice(BaseModel): + currency_code: Optional[str] = None + """Currency code (3 letter code per ISO 4217)""" + + price_per_hour: Optional[float] = None + """Total price VAT inclusive per hour""" + + price_per_month: Optional[float] = None + """Total price VAT inclusive per month (30 days)""" + + price_status: Literal["error", "hide", "show"] + """Price status for the UI""" + + +class AuditLogEntry(BaseModel): + id: str + """User action ID""" + + acknowledged: bool + """ + User action log was successfully received by its subscriber in case there is one + """ + + action_data: Optional[object] = None + """Additional information about the action""" + + action_type: Literal[ + "activate", + "attach", + "change_logging_resources", + "create", + "create_access_rule", + "deactivate", + "delete", + "delete_access_rule", + "delete_metadata", + "detach", + "disable_logging", + "disable_portsecurity", + "download", + "enable_logging", + "enable_portsecurity", + "failover", + "put_into_servergroup", + "reboot", + "reboot_hard", + "rebuild", + "regenerate_credentials", + "remove_from_servergroup", + "replace_metadata", + "resize", + "resume", + "retype", + "revert", + "scale_down", + "scale_up", + "start", + "stop", + "suspend", + "update", + "update_metadata", + "upgrade", + ] + """Action type""" + + api_group: Literal[ + "ai_cluster", + "backup_service", + "caas_container", + "caas_key", + "caas_pull_secret", + "dbaas_postgres", + "ddos_profile", + "faas_function", + "faas_key", + "faas_namespace", + "file_shares", + "floating_ip", + "image", + "inference_at_the_edge", + "instance", + "instance_isolation", + "k8s_cluster", + "k8s_cluster_template", + "k8s_pool", + "laas", + "laas_topic", + "lb_health_monitor", + "lb_l7policy", + "lb_l7rule", + "lblistener", + "lbpool", + "lbpool_member", + "lifecycle_policy", + "lifecycle_policy_volume_member", + "loadbalancer", + "network", + "port", + "project", + "quota_limit_request", + "registry", + "reservation", + "reserved_fixed_ip", + "role", + "router", + "secret", + "securitygroup", + "securitygrouprule", + "servergroup", + "shared_flavor", + "shared_image", + "shared_network", + "snapshot", + "snapshot_schedule", + "ssh_key", + "subnet", + "user", + "vip_ip_addresses", + "volume", + ] + """API group""" + + client_id: Optional[int] = None + """Client ID of the user.""" + + email: Optional[str] = None + """User email address""" + + is_complete: bool + """User action was filled with all necessary information. + + If false, then something went wrong during user action creation or update + """ + + issued_by_user_id: Optional[int] = None + """User ID who issued the token that made the request""" + + project_id: Optional[int] = None + """Project ID""" + + region_id: Optional[int] = None + """Region ID""" + + resources: List[Resource] + """Resources""" + + task_id: Optional[str] = None + """Task ID""" + + timestamp: datetime + """Datetime. Action timestamp""" + + token_id: Optional[int] = None + """Token ID""" + + total_price: Optional[TotalPrice] = None + """Total resource price VAT inclusive""" + + user_id: int + """User ID""" diff --git a/src/gcore/types/cloud/audit_log_list_params.py b/src/gcore/types/cloud/audit_log_list_params.py new file mode 100644 index 00000000..6f5ac1aa --- /dev/null +++ b/src/gcore/types/cloud/audit_log_list_params.py @@ -0,0 +1,158 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["AuditLogListParams"] + + +class AuditLogListParams(TypedDict, total=False): + action_type: List[ + Literal[ + "activate", + "attach", + "change_logging_resources", + "create", + "create_access_rule", + "deactivate", + "delete", + "delete_access_rule", + "delete_metadata", + "detach", + "disable_logging", + "disable_portsecurity", + "download", + "enable_logging", + "enable_portsecurity", + "failover", + "put_into_servergroup", + "reboot", + "reboot_hard", + "rebuild", + "regenerate_credentials", + "remove_from_servergroup", + "replace_metadata", + "resize", + "resume", + "retype", + "revert", + "scale_down", + "scale_up", + "start", + "stop", + "suspend", + "update", + "update_metadata", + "upgrade", + ] + ] + """User action type. Several options can be specified.""" + + api_group: List[ + Literal[ + "ai_cluster", + "backup_service", + "caas_container", + "caas_key", + "caas_pull_secret", + "dbaas_postgres", + "ddos_profile", + "faas_function", + "faas_key", + "faas_namespace", + "file_shares", + "floating_ip", + "image", + "inference_at_the_edge", + "instance", + "instance_isolation", + "k8s_cluster", + "k8s_cluster_template", + "k8s_pool", + "laas", + "laas_topic", + "lb_health_monitor", + "lb_l7policy", + "lb_l7rule", + "lblistener", + "lbpool", + "lbpool_member", + "lifecycle_policy", + "lifecycle_policy_volume_member", + "loadbalancer", + "network", + "port", + "project", + "quota_limit_request", + "registry", + "reservation", + "reserved_fixed_ip", + "role", + "router", + "secret", + "securitygroup", + "securitygrouprule", + "servergroup", + "shared_flavor", + "shared_image", + "shared_network", + "snapshot", + "snapshot_schedule", + "ssh_key", + "subnet", + "user", + "vip_ip_addresses", + "volume", + ] + ] + """API group that requested action belongs to. Several options can be specified.""" + + from_timestamp: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ISO formatted datetime string. + + Starting timestamp from which user actions are requested + """ + + limit: int + """Optional. Limit the number of returned items""" + + offset: int + """Optional. + + Offset value is used to exclude the first set of records from the result + """ + + order_by: Literal["asc", "desc"] + """Sorting by timestamp. Oldest first, or most recent first""" + + project_id: Iterable[int] + """Project ID. Several options can be specified.""" + + region_id: Iterable[int] + """Region ID. Several options can be specified.""" + + resource_id: List[str] + """Resource ID. Several options can be specified.""" + + search_field: str + """ + Extra search field for common object properties such as name, IP address, or + other, depending on the `resource_type` + """ + + sorting: Literal["asc", "desc"] + """(DEPRECATED Use '`order_by`' instead) Sorting by timestamp. + + Oldest first, or most recent first + """ + + to_timestamp: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ISO formatted datetime string. + + Ending timestamp until which user actions are requested + """ diff --git a/tests/api_resources/cloud/test_audit_logs.py b/tests/api_resources/cloud/test_audit_logs.py new file mode 100644 index 00000000..60dd5b14 --- /dev/null +++ b/tests/api_resources/cloud/test_audit_logs.py @@ -0,0 +1,112 @@ +# 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._utils import parse_datetime +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import AuditLogEntry + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +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.cloud.audit_logs.list() + assert_matches_type(SyncOffsetPage[AuditLogEntry], audit_log, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + audit_log = client.cloud.audit_logs.list( + action_type=["activate", "delete"], + api_group=["ai_cluster", "image"], + from_timestamp=parse_datetime("2019-11-14T10:30:32Z"), + limit=1000, + offset=0, + order_by="asc", + project_id=[1, 2, 3], + region_id=[1, 2, 3], + resource_id=["string"], + search_field="default", + sorting="asc", + to_timestamp=parse_datetime("2019-11-14T10:30:32Z"), + ) + assert_matches_type(SyncOffsetPage[AuditLogEntry], audit_log, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.audit_logs.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + audit_log = response.parse() + assert_matches_type(SyncOffsetPage[AuditLogEntry], audit_log, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.audit_logs.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + audit_log = response.parse() + assert_matches_type(SyncOffsetPage[AuditLogEntry], audit_log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +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.cloud.audit_logs.list() + assert_matches_type(AsyncOffsetPage[AuditLogEntry], audit_log, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + audit_log = await async_client.cloud.audit_logs.list( + action_type=["activate", "delete"], + api_group=["ai_cluster", "image"], + from_timestamp=parse_datetime("2019-11-14T10:30:32Z"), + limit=1000, + offset=0, + order_by="asc", + project_id=[1, 2, 3], + region_id=[1, 2, 3], + resource_id=["string"], + search_field="default", + sorting="asc", + to_timestamp=parse_datetime("2019-11-14T10:30:32Z"), + ) + assert_matches_type(AsyncOffsetPage[AuditLogEntry], audit_log, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.audit_logs.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + audit_log = await response.parse() + assert_matches_type(AsyncOffsetPage[AuditLogEntry], audit_log, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.audit_logs.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + audit_log = await response.parse() + assert_matches_type(AsyncOffsetPage[AuditLogEntry], audit_log, path=["response"]) + + assert cast(Any, response.is_closed) is True From 831fa9f1fd95cd27200295d36cf48e45edbf3a2f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Jul 2025 14:09:32 +0000 Subject: [PATCH 210/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../cloud/file_shares/file_shares.py | 73 ++++++++++++++++--- .../cloud/load_balancers/pools/members.py | 28 +++++-- .../types/cloud/file_share_update_params.py | 32 +++++++- .../cloud/load_balancer_create_params.py | 17 ++++- .../load_balancers/pool_create_params.py | 17 ++++- .../load_balancers/pool_update_params.py | 17 ++++- .../load_balancers/pools/member_add_params.py | 17 ++++- src/gcore/types/cloud/member.py | 16 +++- .../load_balancers/pools/test_members.py | 2 + .../cloud/load_balancers/test_pools.py | 6 ++ tests/api_resources/cloud/test_file_shares.py | 30 ++++++-- .../cloud/test_load_balancers.py | 4 + 13 files changed, 219 insertions(+), 44 deletions(-) diff --git a/.stats.yml b/.stats.yml index 656991bb..da5efaea 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 338 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-aaaf7e44820ece13d49099b1a41b42af0f63cf01c7eec3f048ea8fcd0052d766.yml -openapi_spec_hash: d539ad038b647e679b09b60d078cf588 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fdc1e830b90d8dea25dcbb74e8f622f6888b2d9f55ebae1aa184d847632acb6d.yml +openapi_spec_hash: 7f5e9ce2973fa77324c5b96042a7377b config_hash: df682bec86f06bc441e405f3cb99ab11 diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index dea00eab..c558d592 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable +from typing import Dict, Iterable, Optional from typing_extensions import Literal, overload import httpx @@ -35,6 +35,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.file_share import FileShare from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["FileSharesResource", "AsyncFileSharesResource"] @@ -219,7 +220,8 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - name: str, + name: str | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -228,7 +230,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FileShare: """ - Rename file share + Rename file share or update tags Args: project_id: Project ID @@ -237,7 +239,27 @@ def update( file_share_id: File Share ID - name: Name. + name: Name + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. extra_headers: Send extra headers @@ -255,7 +277,13 @@ def update( raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._patch( f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", - body=maybe_transform({"name": name}, file_share_update_params.FileShareUpdateParams), + body=maybe_transform( + { + "name": name, + "tags": tags, + }, + file_share_update_params.FileShareUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -648,7 +676,8 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - name: str, + name: str | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -657,7 +686,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> FileShare: """ - Rename file share + Rename file share or update tags Args: project_id: Project ID @@ -666,7 +695,27 @@ async def update( file_share_id: File Share ID - name: Name. + name: Name + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. extra_headers: Send extra headers @@ -684,7 +733,13 @@ async def update( raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._patch( f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", - body=await async_maybe_transform({"name": name}, file_share_update_params.FileShareUpdateParams), + body=await async_maybe_transform( + { + "name": name, + "tags": tags, + }, + file_share_update_params.FileShareUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 4f5f236a..7bf86213 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -51,7 +51,8 @@ def add( region_id: int | None = None, address: str, protocol_port: int, - admin_state_up: Optional[bool] | NotGiven = NOT_GIVEN, + admin_state_up: bool | NotGiven = NOT_GIVEN, + backup: bool | NotGiven = NOT_GIVEN, instance_id: Optional[str] | NotGiven = NOT_GIVEN, monitor_address: Optional[str] | NotGiven = NOT_GIVEN, monitor_port: Optional[int] | NotGiven = NOT_GIVEN, @@ -82,6 +83,11 @@ def add( and operational. When set to false, the resource is disabled and will not process traffic. When null is passed, the value is skipped and defaults to true. + backup: Set to true if the member is a backup member, to which traffic will be sent + exclusively when all non-backup members will be unreachable. It allows to + realize ACTIVE-BACKUP load balancing without thinking about VRRP and VIP + configuration. Default is false. + instance_id: Either `subnet_id` or `instance_id` should be provided monitor_address: An alternate IP address used for health monitoring of a backend member. Default @@ -90,9 +96,10 @@ def add( monitor_port: An alternate protocol port used for health monitoring of a backend member. Default is null which monitors the member `protocol_port`. - subnet_id: Either `subnet_id` or `instance_id` should be provided + subnet_id: `subnet_id` in which `address` is present. Either `subnet_id` or `instance_id` + should be provided - weight: Member weight. Valid values: 0 to 256, defaults to 1 + weight: Member weight. Valid values are 0 < `weight` <= 256, defaults to 1. extra_headers: Send extra headers @@ -115,6 +122,7 @@ def add( "address": address, "protocol_port": protocol_port, "admin_state_up": admin_state_up, + "backup": backup, "instance_id": instance_id, "monitor_address": monitor_address, "monitor_port": monitor_port, @@ -208,7 +216,8 @@ async def add( region_id: int | None = None, address: str, protocol_port: int, - admin_state_up: Optional[bool] | NotGiven = NOT_GIVEN, + admin_state_up: bool | NotGiven = NOT_GIVEN, + backup: bool | NotGiven = NOT_GIVEN, instance_id: Optional[str] | NotGiven = NOT_GIVEN, monitor_address: Optional[str] | NotGiven = NOT_GIVEN, monitor_port: Optional[int] | NotGiven = NOT_GIVEN, @@ -239,6 +248,11 @@ async def add( and operational. When set to false, the resource is disabled and will not process traffic. When null is passed, the value is skipped and defaults to true. + backup: Set to true if the member is a backup member, to which traffic will be sent + exclusively when all non-backup members will be unreachable. It allows to + realize ACTIVE-BACKUP load balancing without thinking about VRRP and VIP + configuration. Default is false. + instance_id: Either `subnet_id` or `instance_id` should be provided monitor_address: An alternate IP address used for health monitoring of a backend member. Default @@ -247,9 +261,10 @@ async def add( monitor_port: An alternate protocol port used for health monitoring of a backend member. Default is null which monitors the member `protocol_port`. - subnet_id: Either `subnet_id` or `instance_id` should be provided + subnet_id: `subnet_id` in which `address` is present. Either `subnet_id` or `instance_id` + should be provided - weight: Member weight. Valid values: 0 to 256, defaults to 1 + weight: Member weight. Valid values are 0 < `weight` <= 256, defaults to 1. extra_headers: Send extra headers @@ -272,6 +287,7 @@ async def add( "address": address, "protocol_port": protocol_port, "admin_state_up": admin_state_up, + "backup": backup, "instance_id": instance_id, "monitor_address": monitor_address, "monitor_port": monitor_port, diff --git a/src/gcore/types/cloud/file_share_update_params.py b/src/gcore/types/cloud/file_share_update_params.py index e5940b87..24e4b9de 100644 --- a/src/gcore/types/cloud/file_share_update_params.py +++ b/src/gcore/types/cloud/file_share_update_params.py @@ -2,7 +2,10 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Optional +from typing_extensions import TypedDict + +from .tag_update_map_param import TagUpdateMapParam __all__ = ["FileShareUpdateParams"] @@ -14,5 +17,28 @@ class FileShareUpdateParams(TypedDict, total=False): region_id: int """Region ID""" - name: Required[str] - """Name.""" + name: str + """Name""" + + tags: Optional[TagUpdateMapParam] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 5ce1b76a..ff7eb6bc 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -173,7 +173,7 @@ class ListenerPoolMember(TypedDict, total=False): protocol_port: Required[int] """Member IP port""" - admin_state_up: Optional[bool] + admin_state_up: bool """Administrative state of the resource. When set to true, the resource is enabled and operational. When set to false, @@ -181,6 +181,14 @@ class ListenerPoolMember(TypedDict, total=False): value is skipped and defaults to true. """ + backup: bool + """ + Set to true if the member is a backup member, to which traffic will be sent + exclusively when all non-backup members will be unreachable. It allows to + realize ACTIVE-BACKUP load balancing without thinking about VRRP and VIP + configuration. Default is false. + """ + instance_id: Optional[str] """Either `subnet_id` or `instance_id` should be provided""" @@ -197,10 +205,13 @@ class ListenerPoolMember(TypedDict, total=False): """ subnet_id: Optional[str] - """Either `subnet_id` or `instance_id` should be provided""" + """`subnet_id` in which `address` is present. + + Either `subnet_id` or `instance_id` should be provided + """ weight: Optional[int] - """Member weight. Valid values: 0 to 256, defaults to 1""" + """Member weight. Valid values are 0 < `weight` <= 256, defaults to 1.""" class ListenerPoolSessionPersistence(TypedDict, total=False): 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 4cf1b7c2..04f9c452 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -104,7 +104,7 @@ class Member(TypedDict, total=False): protocol_port: Required[int] """Member IP port""" - admin_state_up: Optional[bool] + admin_state_up: bool """Administrative state of the resource. When set to true, the resource is enabled and operational. When set to false, @@ -112,6 +112,14 @@ class Member(TypedDict, total=False): value is skipped and defaults to true. """ + backup: bool + """ + Set to true if the member is a backup member, to which traffic will be sent + exclusively when all non-backup members will be unreachable. It allows to + realize ACTIVE-BACKUP load balancing without thinking about VRRP and VIP + configuration. Default is false. + """ + instance_id: Optional[str] """Either `subnet_id` or `instance_id` should be provided""" @@ -128,10 +136,13 @@ class Member(TypedDict, total=False): """ subnet_id: Optional[str] - """Either `subnet_id` or `instance_id` should be provided""" + """`subnet_id` in which `address` is present. + + Either `subnet_id` or `instance_id` should be provided + """ weight: Optional[int] - """Member weight. Valid values: 0 to 256, defaults to 1""" + """Member weight. Valid values are 0 < `weight` <= 256, defaults to 1.""" class SessionPersistence(TypedDict, total=False): 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 7d851e8f..3c2f530a 100644 --- a/src/gcore/types/cloud/load_balancers/pool_update_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_update_params.py @@ -102,7 +102,7 @@ class Member(TypedDict, total=False): protocol_port: Required[int] """Member IP port""" - admin_state_up: Optional[bool] + admin_state_up: bool """Administrative state of the resource. When set to true, the resource is enabled and operational. When set to false, @@ -110,6 +110,14 @@ class Member(TypedDict, total=False): value is skipped and defaults to true. """ + backup: bool + """ + Set to true if the member is a backup member, to which traffic will be sent + exclusively when all non-backup members will be unreachable. It allows to + realize ACTIVE-BACKUP load balancing without thinking about VRRP and VIP + configuration. Default is false. + """ + instance_id: Optional[str] """Either `subnet_id` or `instance_id` should be provided""" @@ -126,10 +134,13 @@ class Member(TypedDict, total=False): """ subnet_id: Optional[str] - """Either `subnet_id` or `instance_id` should be provided""" + """`subnet_id` in which `address` is present. + + Either `subnet_id` or `instance_id` should be provided + """ weight: Optional[int] - """Member weight. Valid values: 0 to 256, defaults to 1""" + """Member weight. Valid values are 0 < `weight` <= 256, defaults to 1.""" class SessionPersistence(TypedDict, total=False): diff --git a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py index e14dca71..693351e4 100644 --- a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py @@ -21,7 +21,7 @@ class MemberAddParams(TypedDict, total=False): protocol_port: Required[int] """Member IP port""" - admin_state_up: Optional[bool] + admin_state_up: bool """Administrative state of the resource. When set to true, the resource is enabled and operational. When set to false, @@ -29,6 +29,14 @@ class MemberAddParams(TypedDict, total=False): value is skipped and defaults to true. """ + backup: bool + """ + Set to true if the member is a backup member, to which traffic will be sent + exclusively when all non-backup members will be unreachable. It allows to + realize ACTIVE-BACKUP load balancing without thinking about VRRP and VIP + configuration. Default is false. + """ + instance_id: Optional[str] """Either `subnet_id` or `instance_id` should be provided""" @@ -45,7 +53,10 @@ class MemberAddParams(TypedDict, total=False): """ subnet_id: Optional[str] - """Either `subnet_id` or `instance_id` should be provided""" + """`subnet_id` in which `address` is present. + + Either `subnet_id` or `instance_id` should be provided + """ weight: Optional[int] - """Member weight. Valid values: 0 to 256, defaults to 1""" + """Member weight. Valid values are 0 < `weight` <= 256, defaults to 1.""" diff --git a/src/gcore/types/cloud/member.py b/src/gcore/types/cloud/member.py index 144a0eab..71e0be9a 100644 --- a/src/gcore/types/cloud/member.py +++ b/src/gcore/types/cloud/member.py @@ -24,6 +24,14 @@ class Member(BaseModel): value is skipped and defaults to true. """ + backup: bool + """ + Set to true if the member is a backup member, to which traffic will be sent + exclusively when all non-backup members will be unreachable. It allows to + realize ACTIVE-BACKUP load balancing without thinking about VRRP and VIP + configuration. Default is false + """ + operating_status: LoadBalancerOperatingStatus """Member operating status of the entity""" @@ -33,8 +41,11 @@ class Member(BaseModel): provisioning_status: ProvisioningStatus """Pool member lifecycle status""" + subnet_id: Optional[str] = None + """`subnet_id` in which `address` is present.""" + weight: int - """Member weight. Valid values: 0 to 256, defaults to 1""" + """Member weight. Valid values are 0 < `weight` <= 256.""" monitor_address: Optional[str] = None """An alternate IP address used for health monitoring of a backend member. @@ -47,6 +58,3 @@ class Member(BaseModel): Default is null which monitors the member `protocol_port`. """ - - subnet_id: Optional[str] = None - """Either `subnet_id` or `instance_id` should be provided""" 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 151b9304..d6500e26 100644 --- a/tests/api_resources/cloud/load_balancers/pools/test_members.py +++ b/tests/api_resources/cloud/load_balancers/pools/test_members.py @@ -37,6 +37,7 @@ def test_method_add_with_all_params(self, client: Gcore) -> None: address="192.168.40.33", protocol_port=80, admin_state_up=True, + backup=True, instance_id="a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", monitor_address="monitor_address", monitor_port=0, @@ -172,6 +173,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> Non address="192.168.40.33", protocol_port=80, admin_state_up=True, + backup=True, instance_id="a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", monitor_address="monitor_address", monitor_port=0, diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py index edd9b1be..f926dcc0 100644 --- a/tests/api_resources/cloud/load_balancers/test_pools.py +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -55,6 +55,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "address": "192.168.1.101", "protocol_port": 8000, "admin_state_up": True, + "backup": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", "monitor_port": 0, @@ -65,6 +66,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "address": "192.168.1.102", "protocol_port": 8000, "admin_state_up": True, + "backup": True, "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", "monitor_address": "monitor_address", "monitor_port": 0, @@ -150,6 +152,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "address": "192.168.40.33", "protocol_port": 80, "admin_state_up": True, + "backup": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", "monitor_port": 0, @@ -390,6 +393,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "address": "192.168.1.101", "protocol_port": 8000, "admin_state_up": True, + "backup": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", "monitor_port": 0, @@ -400,6 +404,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "address": "192.168.1.102", "protocol_port": 8000, "admin_state_up": True, + "backup": True, "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", "monitor_address": "monitor_address", "monitor_port": 0, @@ -485,6 +490,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "address": "192.168.40.33", "protocol_port": 80, "admin_state_up": True, + "backup": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", "monitor_port": 0, diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index fca472e6..ae094982 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -155,7 +155,17 @@ def test_method_update(self, client: Gcore) -> None: file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", project_id=1, region_id=1, - name="my-resource", + ) + assert_matches_type(FileShare, file_share, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + file_share = client.cloud.file_shares.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + name="some_name", + tags={"foo": "my-tag-value"}, ) assert_matches_type(FileShare, file_share, path=["response"]) @@ -165,7 +175,6 @@ def test_raw_response_update(self, client: Gcore) -> None: file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", project_id=1, region_id=1, - name="my-resource", ) assert response.is_closed is True @@ -179,7 +188,6 @@ def test_streaming_response_update(self, client: Gcore) -> None: file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", project_id=1, region_id=1, - name="my-resource", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -196,7 +204,6 @@ def test_path_params_update(self, client: Gcore) -> None: file_share_id="", project_id=1, region_id=1, - name="my-resource", ) @parametrize @@ -527,7 +534,17 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", project_id=1, region_id=1, - name="my-resource", + ) + assert_matches_type(FileShare, file_share, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + file_share = await async_client.cloud.file_shares.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + name="some_name", + tags={"foo": "my-tag-value"}, ) assert_matches_type(FileShare, file_share, path=["response"]) @@ -537,7 +554,6 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", project_id=1, region_id=1, - name="my-resource", ) assert response.is_closed is True @@ -551,7 +567,6 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", project_id=1, region_id=1, - name="my-resource", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -568,7 +583,6 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: file_share_id="", project_id=1, region_id=1, - name="my-resource", ) @parametrize diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index fa8ddb3d..f1ba8d09 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -71,6 +71,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "address": "192.168.1.101", "protocol_port": 8000, "admin_state_up": True, + "backup": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", "monitor_port": 0, @@ -81,6 +82,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "address": "192.168.1.102", "protocol_port": 8000, "admin_state_up": True, + "backup": True, "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", "monitor_address": "monitor_address", "monitor_port": 0, @@ -537,6 +539,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "address": "192.168.1.101", "protocol_port": 8000, "admin_state_up": True, + "backup": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", "monitor_port": 0, @@ -547,6 +550,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "address": "192.168.1.102", "protocol_port": 8000, "admin_state_up": True, + "backup": True, "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", "monitor_address": "monitor_address", "monitor_port": 0, From e6c3f3aae6718d7ea079b5f00ad241d3d6743177 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 18 Jul 2025 17:12:21 +0000 Subject: [PATCH 211/592] feat(cloud): add inference api_keys subresource --- .stats.yml | 4 +- api.md | 16 + .../resources/cloud/inference/__init__.py | 14 + .../resources/cloud/inference/api_keys.py | 621 ++++++++++++++++++ .../resources/cloud/inference/inference.py | 32 + src/gcore/types/cloud/inference/__init__.py | 5 + .../cloud/inference/api_key_create_params.py | 21 + .../cloud/inference/api_key_list_params.py | 21 + .../cloud/inference/api_key_update_params.py | 16 + .../cloud/inference/inference_api_key.py | 24 + .../inference/inference_api_key_create.py | 27 + .../cloud/inference/test_api_keys.py | 466 +++++++++++++ 12 files changed, 1265 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/inference/api_keys.py create mode 100644 src/gcore/types/cloud/inference/api_key_create_params.py create mode 100644 src/gcore/types/cloud/inference/api_key_list_params.py create mode 100644 src/gcore/types/cloud/inference/api_key_update_params.py create mode 100644 src/gcore/types/cloud/inference/inference_api_key.py create mode 100644 src/gcore/types/cloud/inference/inference_api_key_create.py create mode 100644 tests/api_resources/cloud/inference/test_api_keys.py diff --git a/.stats.yml b/.stats.yml index da5efaea..050456b9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 338 +configured_endpoints: 343 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fdc1e830b90d8dea25dcbb74e8f622f6888b2d9f55ebae1aa184d847632acb6d.yml openapi_spec_hash: 7f5e9ce2973fa77324c5b96042a7377b -config_hash: df682bec86f06bc441e405f3cb99ab11 +config_hash: 50f1eb77df588cfe368eb592e927f11a diff --git a/api.md b/api.md index 16e1c31e..99c4b6b2 100644 --- a/api.md +++ b/api.md @@ -558,6 +558,22 @@ Methods: - client.cloud.inference.secrets.get(secret_name, \*, project_id) -> InferenceSecret - client.cloud.inference.secrets.replace(secret_name, \*, project_id, \*\*params) -> InferenceSecret +### APIKeys + +Types: + +```python +from gcore.types.cloud.inference import InferenceAPIKey, InferenceAPIKeyCreate +``` + +Methods: + +- client.cloud.inference.api_keys.create(\*, project_id, \*\*params) -> InferenceAPIKeyCreate +- client.cloud.inference.api_keys.update(api_key_name, \*, project_id, \*\*params) -> InferenceAPIKey +- client.cloud.inference.api_keys.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceAPIKey] +- client.cloud.inference.api_keys.delete(api_key_name, \*, project_id) -> None +- client.cloud.inference.api_keys.get(api_key_name, \*, project_id) -> InferenceAPIKey + ## PlacementGroups Types: diff --git a/src/gcore/resources/cloud/inference/__init__.py b/src/gcore/resources/cloud/inference/__init__.py index 04a7f060..d8b0c834 100644 --- a/src/gcore/resources/cloud/inference/__init__.py +++ b/src/gcore/resources/cloud/inference/__init__.py @@ -24,6 +24,14 @@ SecretsResourceWithStreamingResponse, AsyncSecretsResourceWithStreamingResponse, ) +from .api_keys import ( + APIKeysResource, + AsyncAPIKeysResource, + APIKeysResourceWithRawResponse, + AsyncAPIKeysResourceWithRawResponse, + APIKeysResourceWithStreamingResponse, + AsyncAPIKeysResourceWithStreamingResponse, +) from .inference import ( InferenceResource, AsyncInferenceResource, @@ -80,6 +88,12 @@ "AsyncSecretsResourceWithRawResponse", "SecretsResourceWithStreamingResponse", "AsyncSecretsResourceWithStreamingResponse", + "APIKeysResource", + "AsyncAPIKeysResource", + "APIKeysResourceWithRawResponse", + "AsyncAPIKeysResourceWithRawResponse", + "APIKeysResourceWithStreamingResponse", + "AsyncAPIKeysResourceWithStreamingResponse", "InferenceResource", "AsyncInferenceResource", "InferenceResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py new file mode 100644 index 00000000..98238c19 --- /dev/null +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -0,0 +1,621 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.inference import api_key_list_params, api_key_create_params, api_key_update_params +from ....types.cloud.inference.inference_api_key import InferenceAPIKey +from ....types.cloud.inference.inference_api_key_create import InferenceAPIKeyCreate + +__all__ = ["APIKeysResource", "AsyncAPIKeysResource"] + + +class APIKeysResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> APIKeysResourceWithRawResponse: + """ + 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 APIKeysResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> APIKeysResourceWithStreamingResponse: + """ + 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 APIKeysResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + name: str, + description: str | NotGiven = NOT_GIVEN, + expires_at: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceAPIKeyCreate: + """This endpoint creates a new API key for everywhere inference. + + It returs api + key's actual secret only once after creation. + + Args: + project_id: Project ID + + name: Name of the API Key. + + description: Description of the API Key. + + expires_at: Expiration date of the API Key in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._post( + f"/cloud/v3/inference/{project_id}/api_keys", + body=maybe_transform( + { + "name": name, + "description": description, + "expires_at": expires_at, + }, + api_key_create_params.APIKeyCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceAPIKeyCreate, + ) + + def update( + self, + api_key_name: str, + *, + project_id: int | None = None, + description: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceAPIKey: + """ + This endpoint updates a specific API key for everywhere inference. + + Args: + project_id: Project ID + + api_key_name: Api key name. + + description: Description of the API Key. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not api_key_name: + raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") + return self._patch( + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + body=maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceAPIKey, + ) + + def list( + self, + *, + project_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[InferenceAPIKey]: + """ + This endpoint retrieves a list of API keys for everywhere inference. + + Args: + project_id: Project ID + + limit: Optional. Limit the number of returned items + + offset: Optional. Offset value is used to exclude the first set of records from the + result + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._get_api_list( + f"/cloud/v3/inference/{project_id}/api_keys", + page=SyncOffsetPage[InferenceAPIKey], + 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, + }, + api_key_list_params.APIKeyListParams, + ), + ), + model=InferenceAPIKey, + ) + + def delete( + self, + api_key_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """This endpoint deletes a specific API key for everywhere inference. + + If the API + key is attached to any inference deployments, it will not be removed. + ConflictError will be raised + + Args: + project_id: Project ID + + api_key_name: Api key name. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not api_key_name: + raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + api_key_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceAPIKey: + """ + This endpoint retrieves a specific API key for everywhere inference. + + Args: + project_id: Project ID + + api_key_name: Api key name. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not api_key_name: + raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") + return self._get( + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceAPIKey, + ) + + +class AsyncAPIKeysResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAPIKeysResourceWithRawResponse: + """ + 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 AsyncAPIKeysResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAPIKeysResourceWithStreamingResponse: + """ + 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 AsyncAPIKeysResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + name: str, + description: str | NotGiven = NOT_GIVEN, + expires_at: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceAPIKeyCreate: + """This endpoint creates a new API key for everywhere inference. + + It returs api + key's actual secret only once after creation. + + Args: + project_id: Project ID + + name: Name of the API Key. + + description: Description of the API Key. + + expires_at: Expiration date of the API Key in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return await self._post( + f"/cloud/v3/inference/{project_id}/api_keys", + body=await async_maybe_transform( + { + "name": name, + "description": description, + "expires_at": expires_at, + }, + api_key_create_params.APIKeyCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceAPIKeyCreate, + ) + + async def update( + self, + api_key_name: str, + *, + project_id: int | None = None, + description: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceAPIKey: + """ + This endpoint updates a specific API key for everywhere inference. + + Args: + project_id: Project ID + + api_key_name: Api key name. + + description: Description of the API Key. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not api_key_name: + raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") + return await self._patch( + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + body=await async_maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceAPIKey, + ) + + def list( + self, + *, + project_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[InferenceAPIKey, AsyncOffsetPage[InferenceAPIKey]]: + """ + This endpoint retrieves a list of API keys for everywhere inference. + + Args: + project_id: Project ID + + limit: Optional. Limit the number of returned items + + offset: Optional. Offset value is used to exclude the first set of records from the + result + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._get_api_list( + f"/cloud/v3/inference/{project_id}/api_keys", + page=AsyncOffsetPage[InferenceAPIKey], + 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, + }, + api_key_list_params.APIKeyListParams, + ), + ), + model=InferenceAPIKey, + ) + + async def delete( + self, + api_key_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """This endpoint deletes a specific API key for everywhere inference. + + If the API + key is attached to any inference deployments, it will not be removed. + ConflictError will be raised + + Args: + project_id: Project ID + + api_key_name: Api key name. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not api_key_name: + raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + api_key_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceAPIKey: + """ + This endpoint retrieves a specific API key for everywhere inference. + + Args: + project_id: Project ID + + api_key_name: Api key name. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not api_key_name: + raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") + return await self._get( + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceAPIKey, + ) + + +class APIKeysResourceWithRawResponse: + def __init__(self, api_keys: APIKeysResource) -> None: + self._api_keys = api_keys + + self.create = to_raw_response_wrapper( + api_keys.create, + ) + self.update = to_raw_response_wrapper( + api_keys.update, + ) + self.list = to_raw_response_wrapper( + api_keys.list, + ) + self.delete = to_raw_response_wrapper( + api_keys.delete, + ) + self.get = to_raw_response_wrapper( + api_keys.get, + ) + + +class AsyncAPIKeysResourceWithRawResponse: + def __init__(self, api_keys: AsyncAPIKeysResource) -> None: + self._api_keys = api_keys + + self.create = async_to_raw_response_wrapper( + api_keys.create, + ) + self.update = async_to_raw_response_wrapper( + api_keys.update, + ) + self.list = async_to_raw_response_wrapper( + api_keys.list, + ) + self.delete = async_to_raw_response_wrapper( + api_keys.delete, + ) + self.get = async_to_raw_response_wrapper( + api_keys.get, + ) + + +class APIKeysResourceWithStreamingResponse: + def __init__(self, api_keys: APIKeysResource) -> None: + self._api_keys = api_keys + + self.create = to_streamed_response_wrapper( + api_keys.create, + ) + self.update = to_streamed_response_wrapper( + api_keys.update, + ) + self.list = to_streamed_response_wrapper( + api_keys.list, + ) + self.delete = to_streamed_response_wrapper( + api_keys.delete, + ) + self.get = to_streamed_response_wrapper( + api_keys.get, + ) + + +class AsyncAPIKeysResourceWithStreamingResponse: + def __init__(self, api_keys: AsyncAPIKeysResource) -> None: + self._api_keys = api_keys + + self.create = async_to_streamed_response_wrapper( + api_keys.create, + ) + self.update = async_to_streamed_response_wrapper( + api_keys.update, + ) + self.list = async_to_streamed_response_wrapper( + api_keys.list, + ) + self.delete = async_to_streamed_response_wrapper( + api_keys.delete, + ) + self.get = async_to_streamed_response_wrapper( + api_keys.get, + ) diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index 2e1372ad..d9a20993 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -28,6 +28,14 @@ SecretsResourceWithStreamingResponse, AsyncSecretsResourceWithStreamingResponse, ) +from .api_keys import ( + APIKeysResource, + AsyncAPIKeysResource, + APIKeysResourceWithRawResponse, + AsyncAPIKeysResourceWithRawResponse, + APIKeysResourceWithStreamingResponse, + AsyncAPIKeysResourceWithStreamingResponse, +) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -80,6 +88,10 @@ def registry_credentials(self) -> RegistryCredentialsResource: def secrets(self) -> SecretsResource: return SecretsResource(self._client) + @cached_property + def api_keys(self) -> APIKeysResource: + return APIKeysResource(self._client) + @cached_property def with_raw_response(self) -> InferenceResourceWithRawResponse: """ @@ -140,6 +152,10 @@ def registry_credentials(self) -> AsyncRegistryCredentialsResource: def secrets(self) -> AsyncSecretsResource: return AsyncSecretsResource(self._client) + @cached_property + def api_keys(self) -> AsyncAPIKeysResource: + return AsyncAPIKeysResource(self._client) + @cached_property def with_raw_response(self) -> AsyncInferenceResourceWithRawResponse: """ @@ -207,6 +223,10 @@ def registry_credentials(self) -> RegistryCredentialsResourceWithRawResponse: def secrets(self) -> SecretsResourceWithRawResponse: return SecretsResourceWithRawResponse(self._inference.secrets) + @cached_property + def api_keys(self) -> APIKeysResourceWithRawResponse: + return APIKeysResourceWithRawResponse(self._inference.api_keys) + class AsyncInferenceResourceWithRawResponse: def __init__(self, inference: AsyncInferenceResource) -> None: @@ -236,6 +256,10 @@ def registry_credentials(self) -> AsyncRegistryCredentialsResourceWithRawRespons def secrets(self) -> AsyncSecretsResourceWithRawResponse: return AsyncSecretsResourceWithRawResponse(self._inference.secrets) + @cached_property + def api_keys(self) -> AsyncAPIKeysResourceWithRawResponse: + return AsyncAPIKeysResourceWithRawResponse(self._inference.api_keys) + class InferenceResourceWithStreamingResponse: def __init__(self, inference: InferenceResource) -> None: @@ -265,6 +289,10 @@ def registry_credentials(self) -> RegistryCredentialsResourceWithStreamingRespon def secrets(self) -> SecretsResourceWithStreamingResponse: return SecretsResourceWithStreamingResponse(self._inference.secrets) + @cached_property + def api_keys(self) -> APIKeysResourceWithStreamingResponse: + return APIKeysResourceWithStreamingResponse(self._inference.api_keys) + class AsyncInferenceResourceWithStreamingResponse: def __init__(self, inference: AsyncInferenceResource) -> None: @@ -293,3 +321,7 @@ def registry_credentials(self) -> AsyncRegistryCredentialsResourceWithStreamingR @cached_property def secrets(self) -> AsyncSecretsResourceWithStreamingResponse: return AsyncSecretsResourceWithStreamingResponse(self._inference.secrets) + + @cached_property + def api_keys(self) -> AsyncAPIKeysResourceWithStreamingResponse: + return AsyncAPIKeysResourceWithStreamingResponse(self._inference.api_keys) diff --git a/src/gcore/types/cloud/inference/__init__.py b/src/gcore/types/cloud/inference/__init__.py index e3db2b48..e692efab 100644 --- a/src/gcore/types/cloud/inference/__init__.py +++ b/src/gcore/types/cloud/inference/__init__.py @@ -10,15 +10,20 @@ from .inference_flavor import InferenceFlavor as InferenceFlavor from .inference_secret import InferenceSecret as InferenceSecret from .probe_tcp_socket import ProbeTcpSocket as ProbeTcpSocket +from .inference_api_key import InferenceAPIKey as InferenceAPIKey from .model_list_params import ModelListParams as ModelListParams from .flavor_list_params import FlavorListParams as FlavorListParams from .secret_list_params import SecretListParams as SecretListParams +from .api_key_list_params import APIKeyListParams as APIKeyListParams from .inference_deployment import InferenceDeployment as InferenceDeployment from .secret_create_params import SecretCreateParams as SecretCreateParams +from .api_key_create_params import APIKeyCreateParams as APIKeyCreateParams +from .api_key_update_params import APIKeyUpdateParams as APIKeyUpdateParams from .secret_replace_params import SecretReplaceParams as SecretReplaceParams from .deployment_list_params import DeploymentListParams as DeploymentListParams from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams from .deployment_update_params import DeploymentUpdateParams as DeploymentUpdateParams +from .inference_api_key_create import InferenceAPIKeyCreate as InferenceAPIKeyCreate from .inference_deployment_api_key import InferenceDeploymentAPIKey as InferenceDeploymentAPIKey from .inference_registry_credentials import InferenceRegistryCredentials as InferenceRegistryCredentials from .registry_credential_list_params import RegistryCredentialListParams as RegistryCredentialListParams diff --git a/src/gcore/types/cloud/inference/api_key_create_params.py b/src/gcore/types/cloud/inference/api_key_create_params.py new file mode 100644 index 00000000..5c5ae755 --- /dev/null +++ b/src/gcore/types/cloud/inference/api_key_create_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 Required, TypedDict + +__all__ = ["APIKeyCreateParams"] + + +class APIKeyCreateParams(TypedDict, total=False): + project_id: int + """Project ID""" + + name: Required[str] + """Name of the API Key.""" + + description: str + """Description of the API Key.""" + + expires_at: str + """Expiration date of the API Key in ISO 8601 format.""" diff --git a/src/gcore/types/cloud/inference/api_key_list_params.py b/src/gcore/types/cloud/inference/api_key_list_params.py new file mode 100644 index 00000000..b6cb60ab --- /dev/null +++ b/src/gcore/types/cloud/inference/api_key_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 TypedDict + +__all__ = ["APIKeyListParams"] + + +class APIKeyListParams(TypedDict, total=False): + project_id: int + """Project ID""" + + limit: int + """Optional. Limit the number of returned items""" + + offset: int + """Optional. + + Offset value is used to exclude the first set of records from the result + """ diff --git a/src/gcore/types/cloud/inference/api_key_update_params.py b/src/gcore/types/cloud/inference/api_key_update_params.py new file mode 100644 index 00000000..409e858f --- /dev/null +++ b/src/gcore/types/cloud/inference/api_key_update_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["APIKeyUpdateParams"] + + +class APIKeyUpdateParams(TypedDict, total=False): + project_id: int + """Project ID""" + + description: Optional[str] + """Description of the API Key.""" diff --git a/src/gcore/types/cloud/inference/inference_api_key.py b/src/gcore/types/cloud/inference/inference_api_key.py new file mode 100644 index 00000000..738cdfbe --- /dev/null +++ b/src/gcore/types/cloud/inference/inference_api_key.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["InferenceAPIKey"] + + +class InferenceAPIKey(BaseModel): + created_at: str + """Timestamp when the API Key was created.""" + + deployment_names: List[str] + """List of inference deployment names to which this API Key has been attached.""" + + description: Optional[str] = None + """Description of the API Key.""" + + expires_at: Optional[str] = None + """Timestamp when the API Key will expire.""" + + name: str + """API Key name.""" diff --git a/src/gcore/types/cloud/inference/inference_api_key_create.py b/src/gcore/types/cloud/inference/inference_api_key_create.py new file mode 100644 index 00000000..d86eb844 --- /dev/null +++ b/src/gcore/types/cloud/inference/inference_api_key_create.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["InferenceAPIKeyCreate"] + + +class InferenceAPIKeyCreate(BaseModel): + created_at: str + """Timestamp when the API Key was created.""" + + deployment_names: List[str] + """List of inference deployment names to which this API Key has been attached.""" + + description: Optional[str] = None + """Description of the API Key.""" + + expires_at: Optional[str] = None + """Timestamp when the API Key will expire.""" + + name: str + """API Key name.""" + + secret: str + """The actual API Key secret.""" diff --git a/tests/api_resources/cloud/inference/test_api_keys.py b/tests/api_resources/cloud/inference/test_api_keys.py new file mode 100644 index 00000000..9921af4a --- /dev/null +++ b/tests/api_resources/cloud/inference/test_api_keys.py @@ -0,0 +1,466 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud.inference import ( + InferenceAPIKey, + InferenceAPIKeyCreate, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAPIKeys: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + api_key = client.cloud.inference.api_keys.create( + project_id=1, + name="my-api-key", + ) + assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + api_key = client.cloud.inference.api_keys.create( + project_id=1, + name="my-api-key", + description="This key is used for accessing the inference service.", + expires_at="2024-10-01T12:00:00Z", + ) + assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.inference.api_keys.with_raw_response.create( + project_id=1, + name="my-api-key", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_key = response.parse() + assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.inference.api_keys.with_streaming_response.create( + project_id=1, + name="my-api-key", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_key = response.parse() + assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + api_key = client.cloud.inference.api_keys.update( + api_key_name="aws-dev", + project_id=1, + ) + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + api_key = client.cloud.inference.api_keys.update( + api_key_name="aws-dev", + project_id=1, + description="This key is used for accessing the inference service.", + ) + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.inference.api_keys.with_raw_response.update( + api_key_name="aws-dev", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_key = response.parse() + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.inference.api_keys.with_streaming_response.update( + api_key_name="aws-dev", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_key = response.parse() + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `api_key_name` but received ''"): + client.cloud.inference.api_keys.with_raw_response.update( + api_key_name="", + project_id=1, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + api_key = client.cloud.inference.api_keys.list( + project_id=1, + ) + assert_matches_type(SyncOffsetPage[InferenceAPIKey], api_key, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + api_key = client.cloud.inference.api_keys.list( + project_id=1, + limit=100, + offset=0, + ) + assert_matches_type(SyncOffsetPage[InferenceAPIKey], api_key, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.inference.api_keys.with_raw_response.list( + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_key = response.parse() + assert_matches_type(SyncOffsetPage[InferenceAPIKey], api_key, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.inference.api_keys.with_streaming_response.list( + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_key = response.parse() + assert_matches_type(SyncOffsetPage[InferenceAPIKey], api_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + api_key = client.cloud.inference.api_keys.delete( + api_key_name="aws-dev", + project_id=1, + ) + assert api_key is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.inference.api_keys.with_raw_response.delete( + api_key_name="aws-dev", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_key = response.parse() + assert api_key is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.inference.api_keys.with_streaming_response.delete( + api_key_name="aws-dev", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_key = response.parse() + assert api_key is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `api_key_name` but received ''"): + client.cloud.inference.api_keys.with_raw_response.delete( + api_key_name="", + project_id=1, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + api_key = client.cloud.inference.api_keys.get( + api_key_name="aws-dev", + project_id=1, + ) + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.inference.api_keys.with_raw_response.get( + api_key_name="aws-dev", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_key = response.parse() + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.inference.api_keys.with_streaming_response.get( + api_key_name="aws-dev", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_key = response.parse() + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `api_key_name` but received ''"): + client.cloud.inference.api_keys.with_raw_response.get( + api_key_name="", + project_id=1, + ) + + +class TestAsyncAPIKeys: + 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: + api_key = await async_client.cloud.inference.api_keys.create( + project_id=1, + name="my-api-key", + ) + assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + api_key = await async_client.cloud.inference.api_keys.create( + project_id=1, + name="my-api-key", + description="This key is used for accessing the inference service.", + expires_at="2024-10-01T12:00:00Z", + ) + assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.api_keys.with_raw_response.create( + project_id=1, + name="my-api-key", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_key = await response.parse() + assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.api_keys.with_streaming_response.create( + project_id=1, + name="my-api-key", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_key = await response.parse() + assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + api_key = await async_client.cloud.inference.api_keys.update( + api_key_name="aws-dev", + project_id=1, + ) + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + api_key = await async_client.cloud.inference.api_keys.update( + api_key_name="aws-dev", + project_id=1, + description="This key is used for accessing the inference service.", + ) + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.api_keys.with_raw_response.update( + api_key_name="aws-dev", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_key = await response.parse() + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.api_keys.with_streaming_response.update( + api_key_name="aws-dev", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_key = await response.parse() + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `api_key_name` but received ''"): + await async_client.cloud.inference.api_keys.with_raw_response.update( + api_key_name="", + project_id=1, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + api_key = await async_client.cloud.inference.api_keys.list( + project_id=1, + ) + assert_matches_type(AsyncOffsetPage[InferenceAPIKey], api_key, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + api_key = await async_client.cloud.inference.api_keys.list( + project_id=1, + limit=100, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[InferenceAPIKey], api_key, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.api_keys.with_raw_response.list( + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_key = await response.parse() + assert_matches_type(AsyncOffsetPage[InferenceAPIKey], api_key, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.api_keys.with_streaming_response.list( + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_key = await response.parse() + assert_matches_type(AsyncOffsetPage[InferenceAPIKey], api_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + api_key = await async_client.cloud.inference.api_keys.delete( + api_key_name="aws-dev", + project_id=1, + ) + assert api_key is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.api_keys.with_raw_response.delete( + api_key_name="aws-dev", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_key = await response.parse() + assert api_key is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.api_keys.with_streaming_response.delete( + api_key_name="aws-dev", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_key = await response.parse() + assert api_key is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `api_key_name` but received ''"): + await async_client.cloud.inference.api_keys.with_raw_response.delete( + api_key_name="", + project_id=1, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + api_key = await async_client.cloud.inference.api_keys.get( + api_key_name="aws-dev", + project_id=1, + ) + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.api_keys.with_raw_response.get( + api_key_name="aws-dev", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_key = await response.parse() + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.api_keys.with_streaming_response.get( + api_key_name="aws-dev", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_key = await response.parse() + assert_matches_type(InferenceAPIKey, api_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `api_key_name` but received ''"): + await async_client.cloud.inference.api_keys.with_raw_response.get( + api_key_name="", + project_id=1, + ) From 14bace6436ed55405ddba1d10c18878f9f867b6f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 21 Jul 2025 14:07:15 +0000 Subject: [PATCH 212/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2aca35ae..4208b5cb 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.5.0" + ".": "0.6.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index b3f723b9..7563f321 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.5.0" +version = "0.6.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 3ede2fba..24893d80 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.5.0" # x-release-please-version +__version__ = "0.6.0" # x-release-please-version From 3762b1d3bcdd36a2bd91bef8f0b71eeee1d4d114 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 21 Jul 2025 14:11:45 +0000 Subject: [PATCH 213/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../cloud/file_shares/file_shares.py | 10 + .../gpu_baremetal_clusters.py | 67 ++++-- src/gcore/types/cloud/file_share.py | 40 +++- .../types/cloud/file_share_create_params.py | 16 ++ .../types/cloud/gpu_baremetal_cluster.py | 4 +- tests/api_resources/cloud/test_file_shares.py | 2 + .../cloud/test_gpu_baremetal_clusters.py | 212 ++++++++++-------- 8 files changed, 234 insertions(+), 121 deletions(-) diff --git a/.stats.yml b/.stats.yml index 050456b9..966b2dea 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 343 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fdc1e830b90d8dea25dcbb74e8f622f6888b2d9f55ebae1aa184d847632acb6d.yml -openapi_spec_hash: 7f5e9ce2973fa77324c5b96042a7377b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3fa3d2efb0278f09dfea87b861c944eb68c9eaca97c010c2ef22dff4deee6103.yml +openapi_spec_hash: 2ca3af7a449e8a11754484d95a42c4f6 config_hash: 50f1eb77df588cfe368eb592e927f11a diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index c558d592..f04a3c4f 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -130,6 +130,7 @@ def create( protocol: Literal["NFS"], size: int, volume_type: Literal["vast_share_type"], + share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -154,6 +155,8 @@ def create( volume_type: File share volume type + share_settings: Configuration settings for the share + tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Some tags are read-only and cannot be @@ -183,6 +186,7 @@ def create( access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, tags: Dict[str, str] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, + share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -205,6 +209,7 @@ def create( "access": access, "tags": tags, "volume_type": volume_type, + "share_settings": share_settings, }, file_share_create_params.FileShareCreateParams, ), @@ -586,6 +591,7 @@ async def create( protocol: Literal["NFS"], size: int, volume_type: Literal["vast_share_type"], + share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, tags: Dict[str, str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -610,6 +616,8 @@ async def create( volume_type: File share volume type + share_settings: Configuration settings for the share + tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Some tags are read-only and cannot be @@ -639,6 +647,7 @@ async def create( access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, tags: Dict[str, str] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, + share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -661,6 +670,7 @@ async def create( "access": access, "tags": tags, "volume_type": volume_type, + "share_settings": share_settings, }, file_share_create_params.FileShareCreateParams, ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 9812fcd2..b4210a71 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Dict, List, Iterable, Optional import httpx @@ -194,6 +195,7 @@ def create( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") def list( self, *, @@ -209,7 +211,8 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[GPUBaremetalCluster]: """ - List bare metal GPU clusters + Please use the `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters` + instead. Args: limit: Limit the number of returned clusters @@ -308,6 +311,7 @@ def delete( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") def get( self, cluster_id: str, @@ -322,7 +326,9 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUBaremetalCluster: """ - Get bare metal GPU cluster + Please use the + `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters/{`cluster_id`}` + instead. Args: extra_headers: Send extra headers @@ -664,6 +670,7 @@ async def create( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") def list( self, *, @@ -679,7 +686,8 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[GPUBaremetalCluster, AsyncOffsetPage[GPUBaremetalCluster]]: """ - List bare metal GPU clusters + Please use the `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters` + instead. Args: limit: Limit the number of returned clusters @@ -778,6 +786,7 @@ async def delete( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") async def get( self, cluster_id: str, @@ -792,7 +801,9 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUBaremetalCluster: """ - Get bare metal GPU cluster + Please use the + `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters/{`cluster_id`}` + instead. Args: extra_headers: Send extra headers @@ -1011,14 +1022,18 @@ def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None self.create = to_raw_response_wrapper( gpu_baremetal_clusters.create, ) - self.list = to_raw_response_wrapper( - gpu_baremetal_clusters.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + gpu_baremetal_clusters.list # pyright: ignore[reportDeprecated], + ) ) self.delete = to_raw_response_wrapper( gpu_baremetal_clusters.delete, ) - self.get = to_raw_response_wrapper( - gpu_baremetal_clusters.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + gpu_baremetal_clusters.get # pyright: ignore[reportDeprecated], + ) ) self.powercycle_all_servers = to_raw_response_wrapper( gpu_baremetal_clusters.powercycle_all_servers, @@ -1057,14 +1072,18 @@ def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> self.create = async_to_raw_response_wrapper( gpu_baremetal_clusters.create, ) - self.list = async_to_raw_response_wrapper( - gpu_baremetal_clusters.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + gpu_baremetal_clusters.list # pyright: ignore[reportDeprecated], + ) ) self.delete = async_to_raw_response_wrapper( gpu_baremetal_clusters.delete, ) - self.get = async_to_raw_response_wrapper( - gpu_baremetal_clusters.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + gpu_baremetal_clusters.get # pyright: ignore[reportDeprecated], + ) ) self.powercycle_all_servers = async_to_raw_response_wrapper( gpu_baremetal_clusters.powercycle_all_servers, @@ -1103,14 +1122,18 @@ def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None self.create = to_streamed_response_wrapper( gpu_baremetal_clusters.create, ) - self.list = to_streamed_response_wrapper( - gpu_baremetal_clusters.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + gpu_baremetal_clusters.list # pyright: ignore[reportDeprecated], + ) ) self.delete = to_streamed_response_wrapper( gpu_baremetal_clusters.delete, ) - self.get = to_streamed_response_wrapper( - gpu_baremetal_clusters.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + gpu_baremetal_clusters.get # pyright: ignore[reportDeprecated], + ) ) self.powercycle_all_servers = to_streamed_response_wrapper( gpu_baremetal_clusters.powercycle_all_servers, @@ -1149,14 +1172,18 @@ def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> self.create = async_to_streamed_response_wrapper( gpu_baremetal_clusters.create, ) - self.list = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + gpu_baremetal_clusters.list # pyright: ignore[reportDeprecated], + ) ) self.delete = async_to_streamed_response_wrapper( gpu_baremetal_clusters.delete, ) - self.get = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + gpu_baremetal_clusters.get # pyright: ignore[reportDeprecated], + ) ) self.powercycle_all_servers = async_to_streamed_response_wrapper( gpu_baremetal_clusters.powercycle_all_servers, diff --git a/src/gcore/types/cloud/file_share.py b/src/gcore/types/cloud/file_share.py index 1aa2bc60..7f19bba3 100644 --- a/src/gcore/types/cloud/file_share.py +++ b/src/gcore/types/cloud/file_share.py @@ -1,12 +1,43 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from typing_extensions import Literal +from typing import List, Union, Optional +from typing_extensions import Literal, Annotated, TypeAlias from .tag import Tag +from ..._utils import PropertyInfo from ..._models import BaseModel -__all__ = ["FileShare"] +__all__ = [ + "FileShare", + "ShareSettings", + "ShareSettingsStandardShareSettingsOutputSerializer", + "ShareSettingsVastShareSettingsOutputSerializer", +] + + +class ShareSettingsStandardShareSettingsOutputSerializer(BaseModel): + type_name: Literal["standard"] + """Standard file share type""" + + +class ShareSettingsVastShareSettingsOutputSerializer(BaseModel): + root_squash: bool + """Enables or disables root squash for NFS clients. + + - If `true`, root squash is enabled: the root user is mapped to nobody for all + file and folder management operations on the export. + - If `false`, root squash is disabled: the NFS client `root` user retains root + privileges. + """ + + type_name: Literal["vast"] + """Vast file share type""" + + +ShareSettings: TypeAlias = Annotated[ + Union[ShareSettingsStandardShareSettingsOutputSerializer, ShareSettingsVastShareSettingsOutputSerializer], + PropertyInfo(discriminator="type_name"), +] class FileShare(BaseModel): @@ -49,6 +80,9 @@ class FileShare(BaseModel): May be null if the file share was created with volume type VAST """ + share_settings: ShareSettings + """Share settings specific to the file share type""" + size: int """File share size, GiB""" diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index 7958fe69..7d6f2c49 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -11,6 +11,7 @@ "CreateStandardFileShareSerializerNetwork", "CreateStandardFileShareSerializerAccess", "CreateVastFileShareSerializer", + "CreateVastFileShareSerializerShareSettings", ] @@ -88,6 +89,9 @@ class CreateVastFileShareSerializer(TypedDict, total=False): volume_type: Required[Literal["vast_share_type"]] """File share volume type""" + share_settings: CreateVastFileShareSerializerShareSettings + """Configuration settings for the share""" + tags: Dict[str, str] """Key-value tags to associate with the resource. @@ -99,4 +103,16 @@ class CreateVastFileShareSerializer(TypedDict, total=False): """ +class CreateVastFileShareSerializerShareSettings(TypedDict, total=False): + root_squash: bool + """Enables or disables root squash for NFS clients. + + - If `true` (default), root squash is enabled: the root user is mapped to nobody + for all file and folder management operations on the export. + - If `false`, root squash is disabled: the NFS client `root` user retains root + privileges. Use this option if you trust the root user not to perform + operations that will corrupt data. + """ + + FileShareCreateParams: TypeAlias = Union[CreateStandardFileShareSerializer, CreateVastFileShareSerializer] diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal_cluster.py index 58e04497..910960ad 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster.py @@ -37,7 +37,7 @@ class GPUBaremetalCluster(BaseModel): created_at: Optional[str] = None """Datetime when the cluster was created""" - creator_task_id: str + creator_task_id: Optional[str] = None """Task that created this entity""" flavor: str @@ -46,7 +46,7 @@ class GPUBaremetalCluster(BaseModel): image_id: str """Image ID""" - image_name: str + image_name: Optional[str] = None """Image name""" interfaces: Optional[List[Interface]] = None diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index ae094982..ea13776e 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -111,6 +111,7 @@ def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: protocol="NFS", size=5, volume_type="vast_share_type", + share_settings={"root_squash": True}, tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -490,6 +491,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn protocol="NFS", size=5, volume_type="vast_share_type", + share_settings={"root_squash": True}, tags={"my-tag": "my-tag-value"}, ) assert_matches_type(TaskIDList, file_share, path=["response"]) diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index 7c495e40..02fbbaf9 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -16,6 +16,8 @@ GPUBaremetalClusterServerList, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -114,28 +116,33 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( + project_id=0, + region_id=0, + ) + assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( - project_id=0, - region_id=0, - limit=0, - offset=0, - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( + project_id=0, + region_id=0, + limit=0, + offset=0, + ) + assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.list( - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.gpu_baremetal_clusters.with_raw_response.list( + project_id=0, + region_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -144,15 +151,16 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.list( - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.gpu_baremetal_clusters.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = response.parse() + assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -216,20 +224,23 @@ def test_path_params_delete(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.get( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.get( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.get( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.gpu_baremetal_clusters.with_raw_response.get( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -238,27 +249,29 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.get( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.gpu_baremetal_clusters.with_streaming_response.get( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = response.parse() + assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.get( - cluster_id="", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.get( + cluster_id="", + project_id=0, + region_id=0, + ) @parametrize def test_method_powercycle_all_servers(self, client: Gcore) -> None: @@ -562,28 +575,33 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( + project_id=0, + region_id=0, + ) + assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( - project_id=0, - region_id=0, - limit=0, - offset=0, - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( + project_id=0, + region_id=0, + limit=0, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.list( - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.list( + project_id=0, + region_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -592,15 +610,16 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.list( - project_id=0, - region_id=0, - ) 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.gpu_baremetal_clusters.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -664,20 +683,23 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.get( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.get( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.get( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.get( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -686,27 +708,29 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.get( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) 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.gpu_baremetal_clusters.with_streaming_response.get( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = await response.parse() + assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.get( - cluster_id="", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.get( + cluster_id="", + project_id=0, + region_id=0, + ) @parametrize async def test_method_powercycle_all_servers(self, async_client: AsyncGcore) -> None: From 8f26e4b6131c8d9ad9595d98569d11e349af8526 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Jul 2025 02:25:11 +0000 Subject: [PATCH 214/592] fix(parsing): ignore empty metadata --- src/gcore/_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gcore/_models.py b/src/gcore/_models.py index 528d5680..ffcbf67b 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -439,7 +439,7 @@ def construct_type(*, value: object, type_: object, metadata: Optional[List[Any] type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` - if metadata is not None: + if metadata is not None and len(metadata) > 0: meta: tuple[Any, ...] = tuple(metadata) elif is_annotated_type(type_): meta = get_args(type_)[1:] From 12f5bc3f7e4509ae99db13a9986c7fac26be8112 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Jul 2025 16:12:24 +0000 Subject: [PATCH 215/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/waap/ip_info.py | 38 ++++-- .../waap/domains/custom_rule_create_params.py | 8 +- .../waap/domains/custom_rule_update_params.py | 8 +- .../ip_info_get_blocked_requests_params.py | 6 +- .../types/waap/ip_info_get_counts_params.py | 3 +- .../waap/ip_info_get_top_sessions_params.py | 6 +- .../types/waap/ip_info_get_top_urls_params.py | 6 +- .../ip_info_get_top_user_agents_params.py | 6 +- src/gcore/types/waap/waap_custom_rule.py | 8 +- .../waap/domains/analytics/test_requests.py | 32 +++--- .../api_discovery/test_scan_results.py | 32 +++--- .../waap/domains/test_advanced_rules.py | 96 ++++++++-------- .../waap/domains/test_analytics.py | 64 +++++------ .../waap/domains/test_api_discovery.py | 52 ++++----- .../waap/domains/test_api_path_groups.py | 12 +- .../waap/domains/test_api_paths.py | 84 +++++++------- .../waap/domains/test_custom_rules.py | 108 +++++++++--------- .../waap/domains/test_firewall_rules.py | 96 ++++++++-------- .../waap/domains/test_insight_silences.py | 84 +++++++------- .../waap/domains/test_insights.py | 48 ++++---- .../waap/domains/test_policies.py | 16 +-- .../waap/domains/test_settings.py | 28 ++--- .../waap/test_custom_page_sets.py | 8 +- tests/api_resources/waap/test_domains.py | 56 ++++----- tests/api_resources/waap/test_ip_info.py | 48 ++++---- 26 files changed, 496 insertions(+), 461 deletions(-) diff --git a/.stats.yml b/.stats.yml index 966b2dea..c90a5fcb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 343 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3fa3d2efb0278f09dfea87b861c944eb68c9eaca97c010c2ef22dff4deee6103.yml -openapi_spec_hash: 2ca3af7a449e8a11754484d95a42c4f6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-41a5ab2064dec5a2c49dd0eb8561c03eb1913c97195cbf750460247387434f2b.yml +openapi_spec_hash: e7fceb33e84631d5e4386cfb277eda23 config_hash: 50f1eb77df588cfe368eb592e927f11a diff --git a/src/gcore/resources/waap/ip_info.py b/src/gcore/resources/waap/ip_info.py index 72de660e..ab42a015 100644 --- a/src/gcore/resources/waap/ip_info.py +++ b/src/gcore/resources/waap/ip_info.py @@ -2,6 +2,8 @@ from __future__ import annotations +from typing import Optional + import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -155,7 +157,9 @@ def get_blocked_requests( corresponding action that was executed. Args: - domain_id: The domain ID + domain_id: The identifier for a domain. When specified, the response will exclusively + contain data pertinent to the indicated domain, filtering out information from + other domains. ip: The IP address to check @@ -189,7 +193,7 @@ def get_counts( self, *, ip: str, - domain_id: int | NotGiven = NOT_GIVEN, + domain_id: Optional[int] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -296,7 +300,9 @@ def get_top_sessions( by IP. Args: - domain_id: The domain ID + domain_id: The identifier for a domain. When specified, the response will exclusively + contain data pertinent to the indicated domain, filtering out information from + other domains. ip: The IP address to check @@ -345,7 +351,9 @@ def get_top_urls( security monitoring based on URL popularity. Args: - domain_id: The domain ID + domain_id: The identifier for a domain. When specified, the response will exclusively + contain data pertinent to the indicated domain, filtering out information from + other domains. ip: The IP address to check @@ -392,7 +400,9 @@ def get_top_user_agents( IP. Args: - domain_id: The domain ID + domain_id: The identifier for a domain. When specified, the response will exclusively + contain data pertinent to the indicated domain, filtering out information from + other domains. ip: The IP address to check @@ -578,7 +588,9 @@ async def get_blocked_requests( corresponding action that was executed. Args: - domain_id: The domain ID + domain_id: The identifier for a domain. When specified, the response will exclusively + contain data pertinent to the indicated domain, filtering out information from + other domains. ip: The IP address to check @@ -612,7 +624,7 @@ async def get_counts( self, *, ip: str, - domain_id: int | NotGiven = NOT_GIVEN, + domain_id: Optional[int] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -719,7 +731,9 @@ async def get_top_sessions( by IP. Args: - domain_id: The domain ID + domain_id: The identifier for a domain. When specified, the response will exclusively + contain data pertinent to the indicated domain, filtering out information from + other domains. ip: The IP address to check @@ -768,7 +782,9 @@ async def get_top_urls( security monitoring based on URL popularity. Args: - domain_id: The domain ID + domain_id: The identifier for a domain. When specified, the response will exclusively + contain data pertinent to the indicated domain, filtering out information from + other domains. ip: The IP address to check @@ -815,7 +831,9 @@ async def get_top_user_agents( IP. Args: - domain_id: The domain ID + domain_id: The identifier for a domain. When specified, the response will exclusively + contain data pertinent to the indicated domain, filtering out information from + other domains. ip: The IP address to check 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 61e7618c..3ad3b32d 100644 --- a/src/gcore/types/waap/domains/custom_rule_create_params.py +++ b/src/gcore/types/waap/domains/custom_rule_create_params.py @@ -278,10 +278,10 @@ class ConditionURL(TypedDict, total=False): The pattern to match against the request URL. Constraints depend on `match_type`: - - **Exact/Contains**: plain text matching (e.g., `/admin`). - - **Regex**: a valid regular expression (must comply with - `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))\\*\\++,=\\//\\--\\..\\%%]+$`). Lookahead/lookbehind constructs are - forbidden. + - **Exact/Contains**: plain text matching (e.g., `/admin`, must comply with + `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))\\*\\++,=\\//\\--\\..\\%%]+$`). + - **Regex**: a valid regular expression (e.g., `^/upload(/\\dd+)?/\\ww+`). + Lookahead/lookbehind constructs are forbidden. """ match_type: Literal["Exact", "Contains", "Regex"] 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 7e5d36b0..d5de1dd1 100644 --- a/src/gcore/types/waap/domains/custom_rule_update_params.py +++ b/src/gcore/types/waap/domains/custom_rule_update_params.py @@ -281,10 +281,10 @@ class ConditionURL(TypedDict, total=False): The pattern to match against the request URL. Constraints depend on `match_type`: - - **Exact/Contains**: plain text matching (e.g., `/admin`). - - **Regex**: a valid regular expression (must comply with - `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))\\*\\++,=\\//\\--\\..\\%%]+$`). Lookahead/lookbehind constructs are - forbidden. + - **Exact/Contains**: plain text matching (e.g., `/admin`, must comply with + `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))\\*\\++,=\\//\\--\\..\\%%]+$`). + - **Regex**: a valid regular expression (e.g., `^/upload(/\\dd+)?/\\ww+`). + Lookahead/lookbehind constructs are forbidden. """ match_type: Literal["Exact", "Contains", "Regex"] diff --git a/src/gcore/types/waap/ip_info_get_blocked_requests_params.py b/src/gcore/types/waap/ip_info_get_blocked_requests_params.py index e3f33eb0..eb9585dc 100644 --- a/src/gcore/types/waap/ip_info_get_blocked_requests_params.py +++ b/src/gcore/types/waap/ip_info_get_blocked_requests_params.py @@ -9,7 +9,11 @@ class IPInfoGetBlockedRequestsParams(TypedDict, total=False): domain_id: Required[int] - """The domain ID""" + """The identifier for a domain. + + When specified, the response will exclusively contain data pertinent to the + indicated domain, filtering out information from other domains. + """ ip: Required[str] """The IP address to check""" diff --git a/src/gcore/types/waap/ip_info_get_counts_params.py b/src/gcore/types/waap/ip_info_get_counts_params.py index 397bf178..47f90484 100644 --- a/src/gcore/types/waap/ip_info_get_counts_params.py +++ b/src/gcore/types/waap/ip_info_get_counts_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Required, TypedDict __all__ = ["IPInfoGetCountsParams"] @@ -11,7 +12,7 @@ class IPInfoGetCountsParams(TypedDict, total=False): ip: Required[str] """The IP address to check""" - domain_id: int + domain_id: Optional[int] """The identifier for a domain. When specified, the response will exclusively contain data pertinent to the diff --git a/src/gcore/types/waap/ip_info_get_top_sessions_params.py b/src/gcore/types/waap/ip_info_get_top_sessions_params.py index 5fc0e8b9..629d7401 100644 --- a/src/gcore/types/waap/ip_info_get_top_sessions_params.py +++ b/src/gcore/types/waap/ip_info_get_top_sessions_params.py @@ -9,7 +9,11 @@ class IPInfoGetTopSessionsParams(TypedDict, total=False): domain_id: Required[int] - """The domain ID""" + """The identifier for a domain. + + When specified, the response will exclusively contain data pertinent to the + indicated domain, filtering out information from other domains. + """ ip: Required[str] """The IP address to check""" diff --git a/src/gcore/types/waap/ip_info_get_top_urls_params.py b/src/gcore/types/waap/ip_info_get_top_urls_params.py index 4b7cfd47..1184ecaf 100644 --- a/src/gcore/types/waap/ip_info_get_top_urls_params.py +++ b/src/gcore/types/waap/ip_info_get_top_urls_params.py @@ -9,7 +9,11 @@ class IPInfoGetTopURLsParams(TypedDict, total=False): domain_id: Required[int] - """The domain ID""" + """The identifier for a domain. + + When specified, the response will exclusively contain data pertinent to the + indicated domain, filtering out information from other domains. + """ ip: Required[str] """The IP address to check""" diff --git a/src/gcore/types/waap/ip_info_get_top_user_agents_params.py b/src/gcore/types/waap/ip_info_get_top_user_agents_params.py index 70d6d1c7..162f4097 100644 --- a/src/gcore/types/waap/ip_info_get_top_user_agents_params.py +++ b/src/gcore/types/waap/ip_info_get_top_user_agents_params.py @@ -9,7 +9,11 @@ class IPInfoGetTopUserAgentsParams(TypedDict, total=False): domain_id: Required[int] - """The domain ID""" + """The identifier for a domain. + + When specified, the response will exclusively contain data pertinent to the + indicated domain, filtering out information from other domains. + """ ip: Required[str] """The IP address to check""" diff --git a/src/gcore/types/waap/waap_custom_rule.py b/src/gcore/types/waap/waap_custom_rule.py index f273efcf..af09b4dd 100644 --- a/src/gcore/types/waap/waap_custom_rule.py +++ b/src/gcore/types/waap/waap_custom_rule.py @@ -259,10 +259,10 @@ class ConditionURL(BaseModel): The pattern to match against the request URL. Constraints depend on `match_type`: - - **Exact/Contains**: plain text matching (e.g., `/admin`). - - **Regex**: a valid regular expression (must comply with - `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))\\*\\++,=\\//\\--\\..\\%%]+$`). Lookahead/lookbehind constructs are - forbidden. + - **Exact/Contains**: plain text matching (e.g., `/admin`, must comply with + `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))\\*\\++,=\\//\\--\\..\\%%]+$`). + - **Regex**: a valid regular expression (e.g., `^/upload(/\\dd+)?/\\ww+`). + Lookahead/lookbehind constructs are forbidden. """ match_type: Optional[Literal["Exact", "Contains", "Regex"]] = None diff --git a/tests/api_resources/waap/domains/analytics/test_requests.py b/tests/api_resources/waap/domains/analytics/test_requests.py index a02cc8f8..24764d63 100644 --- a/tests/api_resources/waap/domains/analytics/test_requests.py +++ b/tests/api_resources/waap/domains/analytics/test_requests.py @@ -22,7 +22,7 @@ class TestRequests: @parametrize def test_method_list(self, client: Gcore) -> None: request = client.waap.domains.analytics.requests.list( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert_matches_type(SyncOffsetPage[WaapRequestSummary], request, path=["response"]) @@ -30,7 +30,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: request = client.waap.domains.analytics.requests.list( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), actions=["allow"], countries=["Mv"], @@ -49,7 +49,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.waap.domains.analytics.requests.with_raw_response.list( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -61,7 +61,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.waap.domains.analytics.requests.with_streaming_response.list( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), ) as response: assert not response.is_closed @@ -76,7 +76,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: def test_method_get(self, client: Gcore) -> None: request = client.waap.domains.analytics.requests.get( request_id="request_id", - domain_id=0, + domain_id=1, ) assert_matches_type(WaapRequestDetails, request, path=["response"]) @@ -84,7 +84,7 @@ def test_method_get(self, client: Gcore) -> None: def test_raw_response_get(self, client: Gcore) -> None: response = client.waap.domains.analytics.requests.with_raw_response.get( request_id="request_id", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -96,7 +96,7 @@ def test_raw_response_get(self, client: Gcore) -> None: def test_streaming_response_get(self, client: Gcore) -> None: with client.waap.domains.analytics.requests.with_streaming_response.get( request_id="request_id", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -111,7 +111,7 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): client.waap.domains.analytics.requests.with_raw_response.get( request_id="", - domain_id=0, + domain_id=1, ) @@ -123,7 +123,7 @@ class TestAsyncRequests: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: request = await async_client.waap.domains.analytics.requests.list( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert_matches_type(AsyncOffsetPage[WaapRequestSummary], request, path=["response"]) @@ -131,7 +131,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: request = await async_client.waap.domains.analytics.requests.list( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), actions=["allow"], countries=["Mv"], @@ -150,7 +150,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.waap.domains.analytics.requests.with_raw_response.list( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -162,7 +162,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.waap.domains.analytics.requests.with_streaming_response.list( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), ) as response: assert not response.is_closed @@ -177,7 +177,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async def test_method_get(self, async_client: AsyncGcore) -> None: request = await async_client.waap.domains.analytics.requests.get( request_id="request_id", - domain_id=0, + domain_id=1, ) assert_matches_type(WaapRequestDetails, request, path=["response"]) @@ -185,7 +185,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.analytics.requests.with_raw_response.get( request_id="request_id", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -197,7 +197,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.analytics.requests.with_streaming_response.get( request_id="request_id", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -212,5 +212,5 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): await async_client.waap.domains.analytics.requests.with_raw_response.get( request_id="", - domain_id=0, + domain_id=1, ) diff --git a/tests/api_resources/waap/domains/api_discovery/test_scan_results.py b/tests/api_resources/waap/domains/api_discovery/test_scan_results.py index 3778f693..fd1a1125 100644 --- a/tests/api_resources/waap/domains/api_discovery/test_scan_results.py +++ b/tests/api_resources/waap/domains/api_discovery/test_scan_results.py @@ -24,14 +24,14 @@ class TestScanResults: @parametrize def test_method_list(self, client: Gcore) -> None: scan_result = client.waap.domains.api_discovery.scan_results.list( - domain_id=0, + domain_id=1, ) assert_matches_type(SyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: scan_result = client.waap.domains.api_discovery.scan_results.list( - domain_id=0, + domain_id=1, limit=0, message="message", offset=0, @@ -44,7 +44,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.waap.domains.api_discovery.scan_results.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -55,7 +55,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.waap.domains.api_discovery.scan_results.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -69,7 +69,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: def test_method_get(self, client: Gcore) -> None: scan_result = client.waap.domains.api_discovery.scan_results.get( scan_id="scan_id", - domain_id=0, + domain_id=1, ) assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) @@ -77,7 +77,7 @@ def test_method_get(self, client: Gcore) -> None: def test_raw_response_get(self, client: Gcore) -> None: response = client.waap.domains.api_discovery.scan_results.with_raw_response.get( scan_id="scan_id", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -89,7 +89,7 @@ def test_raw_response_get(self, client: Gcore) -> None: def test_streaming_response_get(self, client: Gcore) -> None: with client.waap.domains.api_discovery.scan_results.with_streaming_response.get( scan_id="scan_id", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -104,7 +104,7 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): client.waap.domains.api_discovery.scan_results.with_raw_response.get( scan_id="", - domain_id=0, + domain_id=1, ) @@ -116,14 +116,14 @@ class TestAsyncScanResults: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: scan_result = await async_client.waap.domains.api_discovery.scan_results.list( - domain_id=0, + domain_id=1, ) assert_matches_type(AsyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: scan_result = await async_client.waap.domains.api_discovery.scan_results.list( - domain_id=0, + domain_id=1, limit=0, message="message", offset=0, @@ -136,7 +136,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.waap.domains.api_discovery.scan_results.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -147,7 +147,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.waap.domains.api_discovery.scan_results.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -161,7 +161,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async def test_method_get(self, async_client: AsyncGcore) -> None: scan_result = await async_client.waap.domains.api_discovery.scan_results.get( scan_id="scan_id", - domain_id=0, + domain_id=1, ) assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) @@ -169,7 +169,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.api_discovery.scan_results.with_raw_response.get( scan_id="scan_id", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -181,7 +181,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.api_discovery.scan_results.with_streaming_response.get( scan_id="scan_id", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -196,5 +196,5 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): await async_client.waap.domains.api_discovery.scan_results.with_raw_response.get( scan_id="", - domain_id=0, + domain_id=1, ) diff --git a/tests/api_resources/waap/domains/test_advanced_rules.py b/tests/api_resources/waap/domains/test_advanced_rules.py index d4eadeeb..f4c52e19 100644 --- a/tests/api_resources/waap/domains/test_advanced_rules.py +++ b/tests/api_resources/waap/domains/test_advanced_rules.py @@ -21,7 +21,7 @@ class TestAdvancedRules: @parametrize def test_method_create(self, client: Gcore) -> None: advanced_rule = client.waap.domains.advanced_rules.create( - domain_id=0, + domain_id=1, action={}, enabled=True, name="name", @@ -32,7 +32,7 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: advanced_rule = client.waap.domains.advanced_rules.create( - domain_id=0, + domain_id=1, action={ "allow": {}, "block": { @@ -55,7 +55,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.waap.domains.advanced_rules.with_raw_response.create( - domain_id=0, + domain_id=1, action={}, enabled=True, name="name", @@ -70,7 +70,7 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.waap.domains.advanced_rules.with_streaming_response.create( - domain_id=0, + domain_id=1, action={}, enabled=True, name="name", @@ -88,7 +88,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: def test_method_update(self, client: Gcore) -> None: advanced_rule = client.waap.domains.advanced_rules.update( rule_id=0, - domain_id=0, + domain_id=1, ) assert advanced_rule is None @@ -96,7 +96,7 @@ def test_method_update(self, client: Gcore) -> None: def test_method_update_with_all_params(self, client: Gcore) -> None: advanced_rule = client.waap.domains.advanced_rules.update( rule_id=0, - domain_id=0, + domain_id=1, action={ "allow": {}, "block": { @@ -120,7 +120,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: def test_raw_response_update(self, client: Gcore) -> None: response = client.waap.domains.advanced_rules.with_raw_response.update( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -132,7 +132,7 @@ def test_raw_response_update(self, client: Gcore) -> None: def test_streaming_response_update(self, client: Gcore) -> None: with client.waap.domains.advanced_rules.with_streaming_response.update( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -145,19 +145,19 @@ def test_streaming_response_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: advanced_rule = client.waap.domains.advanced_rules.list( - domain_id=0, + domain_id=1, ) assert_matches_type(SyncOffsetPage[WaapAdvancedRule], advanced_rule, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: advanced_rule = client.waap.domains.advanced_rules.list( - domain_id=0, + domain_id=1, action="allow", - description="description", - enabled=True, + description="This rule blocks all the requests coming form a specific IP address", + enabled=False, limit=0, - name="name", + name="Block by specific IP rule", offset=0, ordering="id", phase="access", @@ -167,7 +167,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.waap.domains.advanced_rules.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -178,7 +178,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.waap.domains.advanced_rules.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -192,7 +192,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: def test_method_delete(self, client: Gcore) -> None: advanced_rule = client.waap.domains.advanced_rules.delete( rule_id=0, - domain_id=0, + domain_id=1, ) assert advanced_rule is None @@ -200,7 +200,7 @@ def test_method_delete(self, client: Gcore) -> None: def test_raw_response_delete(self, client: Gcore) -> None: response = client.waap.domains.advanced_rules.with_raw_response.delete( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -212,7 +212,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: def test_streaming_response_delete(self, client: Gcore) -> None: with client.waap.domains.advanced_rules.with_streaming_response.delete( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -226,7 +226,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: def test_method_get(self, client: Gcore) -> None: advanced_rule = client.waap.domains.advanced_rules.get( rule_id=0, - domain_id=0, + domain_id=1, ) assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @@ -234,7 +234,7 @@ def test_method_get(self, client: Gcore) -> None: def test_raw_response_get(self, client: Gcore) -> None: response = client.waap.domains.advanced_rules.with_raw_response.get( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -246,7 +246,7 @@ def test_raw_response_get(self, client: Gcore) -> None: def test_streaming_response_get(self, client: Gcore) -> None: with client.waap.domains.advanced_rules.with_streaming_response.get( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -260,7 +260,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: def test_method_toggle(self, client: Gcore) -> None: advanced_rule = client.waap.domains.advanced_rules.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) assert advanced_rule is None @@ -269,7 +269,7 @@ def test_method_toggle(self, client: Gcore) -> None: def test_raw_response_toggle(self, client: Gcore) -> None: response = client.waap.domains.advanced_rules.with_raw_response.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) @@ -282,7 +282,7 @@ def test_raw_response_toggle(self, client: Gcore) -> None: def test_streaming_response_toggle(self, client: Gcore) -> None: with client.waap.domains.advanced_rules.with_streaming_response.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) as response: assert not response.is_closed @@ -302,7 +302,7 @@ class TestAsyncAdvancedRules: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: advanced_rule = await async_client.waap.domains.advanced_rules.create( - domain_id=0, + domain_id=1, action={}, enabled=True, name="name", @@ -313,7 +313,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: advanced_rule = await async_client.waap.domains.advanced_rules.create( - domain_id=0, + domain_id=1, action={ "allow": {}, "block": { @@ -336,7 +336,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.advanced_rules.with_raw_response.create( - domain_id=0, + domain_id=1, action={}, enabled=True, name="name", @@ -351,7 +351,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.advanced_rules.with_streaming_response.create( - domain_id=0, + domain_id=1, action={}, enabled=True, name="name", @@ -369,7 +369,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None async def test_method_update(self, async_client: AsyncGcore) -> None: advanced_rule = await async_client.waap.domains.advanced_rules.update( rule_id=0, - domain_id=0, + domain_id=1, ) assert advanced_rule is None @@ -377,7 +377,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: advanced_rule = await async_client.waap.domains.advanced_rules.update( rule_id=0, - domain_id=0, + domain_id=1, action={ "allow": {}, "block": { @@ -401,7 +401,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.advanced_rules.with_raw_response.update( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -413,7 +413,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.advanced_rules.with_streaming_response.update( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -426,19 +426,19 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: advanced_rule = await async_client.waap.domains.advanced_rules.list( - domain_id=0, + domain_id=1, ) assert_matches_type(AsyncOffsetPage[WaapAdvancedRule], advanced_rule, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: advanced_rule = await async_client.waap.domains.advanced_rules.list( - domain_id=0, + domain_id=1, action="allow", - description="description", - enabled=True, + description="This rule blocks all the requests coming form a specific IP address", + enabled=False, limit=0, - name="name", + name="Block by specific IP rule", offset=0, ordering="id", phase="access", @@ -448,7 +448,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.waap.domains.advanced_rules.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -459,7 +459,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.waap.domains.advanced_rules.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -473,7 +473,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async def test_method_delete(self, async_client: AsyncGcore) -> None: advanced_rule = await async_client.waap.domains.advanced_rules.delete( rule_id=0, - domain_id=0, + domain_id=1, ) assert advanced_rule is None @@ -481,7 +481,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.advanced_rules.with_raw_response.delete( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -493,7 +493,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.advanced_rules.with_streaming_response.delete( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -507,7 +507,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None async def test_method_get(self, async_client: AsyncGcore) -> None: advanced_rule = await async_client.waap.domains.advanced_rules.get( rule_id=0, - domain_id=0, + domain_id=1, ) assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @@ -515,7 +515,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.advanced_rules.with_raw_response.get( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -527,7 +527,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.advanced_rules.with_streaming_response.get( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -541,7 +541,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async def test_method_toggle(self, async_client: AsyncGcore) -> None: advanced_rule = await async_client.waap.domains.advanced_rules.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) assert advanced_rule is None @@ -550,7 +550,7 @@ async def test_method_toggle(self, async_client: AsyncGcore) -> None: async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.advanced_rules.with_raw_response.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) @@ -563,7 +563,7 @@ async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.advanced_rules.with_streaming_response.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) as response: assert not response.is_closed diff --git a/tests/api_resources/waap/domains/test_analytics.py b/tests/api_resources/waap/domains/test_analytics.py index 698ecf8c..1d1aab74 100644 --- a/tests/api_resources/waap/domains/test_analytics.py +++ b/tests/api_resources/waap/domains/test_analytics.py @@ -25,7 +25,7 @@ class TestAnalytics: @parametrize def test_method_get_event_statistics(self, client: Gcore) -> None: analytics = client.waap.domains.analytics.get_event_statistics( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert_matches_type(WaapEventStatistics, analytics, path=["response"]) @@ -33,7 +33,7 @@ def test_method_get_event_statistics(self, client: Gcore) -> None: @parametrize def test_method_get_event_statistics_with_all_params(self, client: Gcore) -> None: analytics = client.waap.domains.analytics.get_event_statistics( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), action=["block", "captcha"], end=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -46,7 +46,7 @@ def test_method_get_event_statistics_with_all_params(self, client: Gcore) -> Non @parametrize def test_raw_response_get_event_statistics(self, client: Gcore) -> None: response = client.waap.domains.analytics.with_raw_response.get_event_statistics( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -58,7 +58,7 @@ def test_raw_response_get_event_statistics(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_event_statistics(self, client: Gcore) -> None: with client.waap.domains.analytics.with_streaming_response.get_event_statistics( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), ) as response: assert not response.is_closed @@ -72,14 +72,14 @@ def test_streaming_response_get_event_statistics(self, client: Gcore) -> None: @parametrize def test_method_list_ddos_attacks(self, client: Gcore) -> None: analytics = client.waap.domains.analytics.list_ddos_attacks( - domain_id=0, + domain_id=1, ) assert_matches_type(SyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) @parametrize def test_method_list_ddos_attacks_with_all_params(self, client: Gcore) -> None: analytics = client.waap.domains.analytics.list_ddos_attacks( - domain_id=0, + domain_id=1, end_time=parse_datetime("2019-12-27T18:11:19.117Z"), limit=0, offset=0, @@ -91,7 +91,7 @@ def test_method_list_ddos_attacks_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list_ddos_attacks(self, client: Gcore) -> None: response = client.waap.domains.analytics.with_raw_response.list_ddos_attacks( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -102,7 +102,7 @@ def test_raw_response_list_ddos_attacks(self, client: Gcore) -> None: @parametrize def test_streaming_response_list_ddos_attacks(self, client: Gcore) -> None: with client.waap.domains.analytics.with_streaming_response.list_ddos_attacks( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -115,7 +115,7 @@ def test_streaming_response_list_ddos_attacks(self, client: Gcore) -> None: @parametrize def test_method_list_ddos_info(self, client: Gcore) -> None: analytics = client.waap.domains.analytics.list_ddos_info( - domain_id=0, + domain_id=1, group_by="URL", start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -124,7 +124,7 @@ def test_method_list_ddos_info(self, client: Gcore) -> None: @parametrize def test_method_list_ddos_info_with_all_params(self, client: Gcore) -> None: analytics = client.waap.domains.analytics.list_ddos_info( - domain_id=0, + domain_id=1, group_by="URL", start=parse_datetime("2019-12-27T18:11:19.117Z"), end=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -136,7 +136,7 @@ def test_method_list_ddos_info_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list_ddos_info(self, client: Gcore) -> None: response = client.waap.domains.analytics.with_raw_response.list_ddos_info( - domain_id=0, + domain_id=1, group_by="URL", start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -149,7 +149,7 @@ def test_raw_response_list_ddos_info(self, client: Gcore) -> None: @parametrize def test_streaming_response_list_ddos_info(self, client: Gcore) -> None: with client.waap.domains.analytics.with_streaming_response.list_ddos_info( - domain_id=0, + domain_id=1, group_by="URL", start=parse_datetime("2019-12-27T18:11:19.117Z"), ) as response: @@ -164,7 +164,7 @@ def test_streaming_response_list_ddos_info(self, client: Gcore) -> None: @parametrize def test_method_list_event_traffic(self, client: Gcore) -> None: analytics = client.waap.domains.analytics.list_event_traffic( - domain_id=0, + domain_id=1, resolution="daily", start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -173,7 +173,7 @@ def test_method_list_event_traffic(self, client: Gcore) -> None: @parametrize def test_method_list_event_traffic_with_all_params(self, client: Gcore) -> None: analytics = client.waap.domains.analytics.list_event_traffic( - domain_id=0, + domain_id=1, resolution="daily", start=parse_datetime("2019-12-27T18:11:19.117Z"), end=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -183,7 +183,7 @@ def test_method_list_event_traffic_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list_event_traffic(self, client: Gcore) -> None: response = client.waap.domains.analytics.with_raw_response.list_event_traffic( - domain_id=0, + domain_id=1, resolution="daily", start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -196,7 +196,7 @@ def test_raw_response_list_event_traffic(self, client: Gcore) -> None: @parametrize def test_streaming_response_list_event_traffic(self, client: Gcore) -> None: with client.waap.domains.analytics.with_streaming_response.list_event_traffic( - domain_id=0, + domain_id=1, resolution="daily", start=parse_datetime("2019-12-27T18:11:19.117Z"), ) as response: @@ -217,7 +217,7 @@ class TestAsyncAnalytics: @parametrize async def test_method_get_event_statistics(self, async_client: AsyncGcore) -> None: analytics = await async_client.waap.domains.analytics.get_event_statistics( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert_matches_type(WaapEventStatistics, analytics, path=["response"]) @@ -225,7 +225,7 @@ async def test_method_get_event_statistics(self, async_client: AsyncGcore) -> No @parametrize async def test_method_get_event_statistics_with_all_params(self, async_client: AsyncGcore) -> None: analytics = await async_client.waap.domains.analytics.get_event_statistics( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), action=["block", "captcha"], end=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -238,7 +238,7 @@ async def test_method_get_event_statistics_with_all_params(self, async_client: A @parametrize async def test_raw_response_get_event_statistics(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.analytics.with_raw_response.get_event_statistics( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -250,7 +250,7 @@ async def test_raw_response_get_event_statistics(self, async_client: AsyncGcore) @parametrize async def test_streaming_response_get_event_statistics(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.analytics.with_streaming_response.get_event_statistics( - domain_id=0, + domain_id=1, start=parse_datetime("2019-12-27T18:11:19.117Z"), ) as response: assert not response.is_closed @@ -264,14 +264,14 @@ async def test_streaming_response_get_event_statistics(self, async_client: Async @parametrize async def test_method_list_ddos_attacks(self, async_client: AsyncGcore) -> None: analytics = await async_client.waap.domains.analytics.list_ddos_attacks( - domain_id=0, + domain_id=1, ) assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) @parametrize async def test_method_list_ddos_attacks_with_all_params(self, async_client: AsyncGcore) -> None: analytics = await async_client.waap.domains.analytics.list_ddos_attacks( - domain_id=0, + domain_id=1, end_time=parse_datetime("2019-12-27T18:11:19.117Z"), limit=0, offset=0, @@ -283,7 +283,7 @@ async def test_method_list_ddos_attacks_with_all_params(self, async_client: Asyn @parametrize async def test_raw_response_list_ddos_attacks(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.analytics.with_raw_response.list_ddos_attacks( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -294,7 +294,7 @@ async def test_raw_response_list_ddos_attacks(self, async_client: AsyncGcore) -> @parametrize async def test_streaming_response_list_ddos_attacks(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.analytics.with_streaming_response.list_ddos_attacks( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -307,7 +307,7 @@ async def test_streaming_response_list_ddos_attacks(self, async_client: AsyncGco @parametrize async def test_method_list_ddos_info(self, async_client: AsyncGcore) -> None: analytics = await async_client.waap.domains.analytics.list_ddos_info( - domain_id=0, + domain_id=1, group_by="URL", start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -316,7 +316,7 @@ async def test_method_list_ddos_info(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_ddos_info_with_all_params(self, async_client: AsyncGcore) -> None: analytics = await async_client.waap.domains.analytics.list_ddos_info( - domain_id=0, + domain_id=1, group_by="URL", start=parse_datetime("2019-12-27T18:11:19.117Z"), end=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -328,7 +328,7 @@ async def test_method_list_ddos_info_with_all_params(self, async_client: AsyncGc @parametrize async def test_raw_response_list_ddos_info(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.analytics.with_raw_response.list_ddos_info( - domain_id=0, + domain_id=1, group_by="URL", start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -341,7 +341,7 @@ async def test_raw_response_list_ddos_info(self, async_client: AsyncGcore) -> No @parametrize async def test_streaming_response_list_ddos_info(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.analytics.with_streaming_response.list_ddos_info( - domain_id=0, + domain_id=1, group_by="URL", start=parse_datetime("2019-12-27T18:11:19.117Z"), ) as response: @@ -356,7 +356,7 @@ async def test_streaming_response_list_ddos_info(self, async_client: AsyncGcore) @parametrize async def test_method_list_event_traffic(self, async_client: AsyncGcore) -> None: analytics = await async_client.waap.domains.analytics.list_event_traffic( - domain_id=0, + domain_id=1, resolution="daily", start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -365,7 +365,7 @@ async def test_method_list_event_traffic(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list_event_traffic_with_all_params(self, async_client: AsyncGcore) -> None: analytics = await async_client.waap.domains.analytics.list_event_traffic( - domain_id=0, + domain_id=1, resolution="daily", start=parse_datetime("2019-12-27T18:11:19.117Z"), end=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -375,7 +375,7 @@ async def test_method_list_event_traffic_with_all_params(self, async_client: Asy @parametrize async def test_raw_response_list_event_traffic(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.analytics.with_raw_response.list_event_traffic( - domain_id=0, + domain_id=1, resolution="daily", start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -388,7 +388,7 @@ async def test_raw_response_list_event_traffic(self, async_client: AsyncGcore) - @parametrize async def test_streaming_response_list_event_traffic(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.analytics.with_streaming_response.list_event_traffic( - domain_id=0, + domain_id=1, resolution="daily", start=parse_datetime("2019-12-27T18:11:19.117Z"), ) as response: diff --git a/tests/api_resources/waap/domains/test_api_discovery.py b/tests/api_resources/waap/domains/test_api_discovery.py index 9f4abcc0..6a1aab20 100644 --- a/tests/api_resources/waap/domains/test_api_discovery.py +++ b/tests/api_resources/waap/domains/test_api_discovery.py @@ -25,14 +25,14 @@ class TestAPIDiscovery: @parametrize def test_method_get_settings(self, client: Gcore) -> None: api_discovery = client.waap.domains.api_discovery.get_settings( - 0, + 1, ) assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) @parametrize def test_raw_response_get_settings(self, client: Gcore) -> None: response = client.waap.domains.api_discovery.with_raw_response.get_settings( - 0, + 1, ) assert response.is_closed is True @@ -43,7 +43,7 @@ def test_raw_response_get_settings(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_settings(self, client: Gcore) -> None: with client.waap.domains.api_discovery.with_streaming_response.get_settings( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -56,14 +56,14 @@ def test_streaming_response_get_settings(self, client: Gcore) -> None: @parametrize def test_method_scan_openapi(self, client: Gcore) -> None: api_discovery = client.waap.domains.api_discovery.scan_openapi( - 0, + 1, ) assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) @parametrize def test_raw_response_scan_openapi(self, client: Gcore) -> None: response = client.waap.domains.api_discovery.with_raw_response.scan_openapi( - 0, + 1, ) assert response.is_closed is True @@ -74,7 +74,7 @@ def test_raw_response_scan_openapi(self, client: Gcore) -> None: @parametrize def test_streaming_response_scan_openapi(self, client: Gcore) -> None: with client.waap.domains.api_discovery.with_streaming_response.scan_openapi( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -87,14 +87,14 @@ def test_streaming_response_scan_openapi(self, client: Gcore) -> None: @parametrize def test_method_update_settings(self, client: Gcore) -> None: api_discovery = client.waap.domains.api_discovery.update_settings( - domain_id=0, + domain_id=1, ) assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) @parametrize def test_method_update_settings_with_all_params(self, client: Gcore) -> None: api_discovery = client.waap.domains.api_discovery.update_settings( - domain_id=0, + domain_id=1, description_file_location="descriptionFileLocation", description_file_scan_enabled=True, description_file_scan_interval_hours=1, @@ -106,7 +106,7 @@ def test_method_update_settings_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_update_settings(self, client: Gcore) -> None: response = client.waap.domains.api_discovery.with_raw_response.update_settings( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -117,7 +117,7 @@ def test_raw_response_update_settings(self, client: Gcore) -> None: @parametrize def test_streaming_response_update_settings(self, client: Gcore) -> None: with client.waap.domains.api_discovery.with_streaming_response.update_settings( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -130,7 +130,7 @@ def test_streaming_response_update_settings(self, client: Gcore) -> None: @parametrize def test_method_upload_openapi(self, client: Gcore) -> None: api_discovery = client.waap.domains.api_discovery.upload_openapi( - domain_id=0, + domain_id=1, file_data="file_data", file_name="file_name", ) @@ -139,7 +139,7 @@ def test_method_upload_openapi(self, client: Gcore) -> None: @parametrize def test_raw_response_upload_openapi(self, client: Gcore) -> None: response = client.waap.domains.api_discovery.with_raw_response.upload_openapi( - domain_id=0, + domain_id=1, file_data="file_data", file_name="file_name", ) @@ -152,7 +152,7 @@ def test_raw_response_upload_openapi(self, client: Gcore) -> None: @parametrize def test_streaming_response_upload_openapi(self, client: Gcore) -> None: with client.waap.domains.api_discovery.with_streaming_response.upload_openapi( - domain_id=0, + domain_id=1, file_data="file_data", file_name="file_name", ) as response: @@ -173,14 +173,14 @@ class TestAsyncAPIDiscovery: @parametrize async def test_method_get_settings(self, async_client: AsyncGcore) -> None: api_discovery = await async_client.waap.domains.api_discovery.get_settings( - 0, + 1, ) assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) @parametrize async def test_raw_response_get_settings(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.api_discovery.with_raw_response.get_settings( - 0, + 1, ) assert response.is_closed is True @@ -191,7 +191,7 @@ async def test_raw_response_get_settings(self, async_client: AsyncGcore) -> None @parametrize async def test_streaming_response_get_settings(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.api_discovery.with_streaming_response.get_settings( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -204,14 +204,14 @@ async def test_streaming_response_get_settings(self, async_client: AsyncGcore) - @parametrize async def test_method_scan_openapi(self, async_client: AsyncGcore) -> None: api_discovery = await async_client.waap.domains.api_discovery.scan_openapi( - 0, + 1, ) assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) @parametrize async def test_raw_response_scan_openapi(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.api_discovery.with_raw_response.scan_openapi( - 0, + 1, ) assert response.is_closed is True @@ -222,7 +222,7 @@ async def test_raw_response_scan_openapi(self, async_client: AsyncGcore) -> None @parametrize async def test_streaming_response_scan_openapi(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.api_discovery.with_streaming_response.scan_openapi( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -235,14 +235,14 @@ async def test_streaming_response_scan_openapi(self, async_client: AsyncGcore) - @parametrize async def test_method_update_settings(self, async_client: AsyncGcore) -> None: api_discovery = await async_client.waap.domains.api_discovery.update_settings( - domain_id=0, + domain_id=1, ) assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) @parametrize async def test_method_update_settings_with_all_params(self, async_client: AsyncGcore) -> None: api_discovery = await async_client.waap.domains.api_discovery.update_settings( - domain_id=0, + domain_id=1, description_file_location="descriptionFileLocation", description_file_scan_enabled=True, description_file_scan_interval_hours=1, @@ -254,7 +254,7 @@ async def test_method_update_settings_with_all_params(self, async_client: AsyncG @parametrize async def test_raw_response_update_settings(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.api_discovery.with_raw_response.update_settings( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -265,7 +265,7 @@ async def test_raw_response_update_settings(self, async_client: AsyncGcore) -> N @parametrize async def test_streaming_response_update_settings(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.api_discovery.with_streaming_response.update_settings( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -278,7 +278,7 @@ async def test_streaming_response_update_settings(self, async_client: AsyncGcore @parametrize async def test_method_upload_openapi(self, async_client: AsyncGcore) -> None: api_discovery = await async_client.waap.domains.api_discovery.upload_openapi( - domain_id=0, + domain_id=1, file_data="file_data", file_name="file_name", ) @@ -287,7 +287,7 @@ async def test_method_upload_openapi(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_upload_openapi(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.api_discovery.with_raw_response.upload_openapi( - domain_id=0, + domain_id=1, file_data="file_data", file_name="file_name", ) @@ -300,7 +300,7 @@ async def test_raw_response_upload_openapi(self, async_client: AsyncGcore) -> No @parametrize async def test_streaming_response_upload_openapi(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.api_discovery.with_streaming_response.upload_openapi( - domain_id=0, + domain_id=1, file_data="file_data", file_name="file_name", ) as response: diff --git a/tests/api_resources/waap/domains/test_api_path_groups.py b/tests/api_resources/waap/domains/test_api_path_groups.py index 1987bf0a..b33f5939 100644 --- a/tests/api_resources/waap/domains/test_api_path_groups.py +++ b/tests/api_resources/waap/domains/test_api_path_groups.py @@ -20,14 +20,14 @@ class TestAPIPathGroups: @parametrize def test_method_list(self, client: Gcore) -> None: api_path_group = client.waap.domains.api_path_groups.list( - 0, + 1, ) assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.waap.domains.api_path_groups.with_raw_response.list( - 0, + 1, ) assert response.is_closed is True @@ -38,7 +38,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.waap.domains.api_path_groups.with_streaming_response.list( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -57,14 +57,14 @@ class TestAsyncAPIPathGroups: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: api_path_group = await async_client.waap.domains.api_path_groups.list( - 0, + 1, ) assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.api_path_groups.with_raw_response.list( - 0, + 1, ) assert response.is_closed is True @@ -75,7 +75,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.waap.domains.api_path_groups.with_streaming_response.list( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/waap/domains/test_api_paths.py b/tests/api_resources/waap/domains/test_api_paths.py index 23f497f1..bb76162b 100644 --- a/tests/api_resources/waap/domains/test_api_paths.py +++ b/tests/api_resources/waap/domains/test_api_paths.py @@ -25,7 +25,7 @@ class TestAPIPaths: @parametrize def test_method_create(self, client: Gcore) -> None: api_path = client.waap.domains.api_paths.create( - domain_id=0, + domain_id=1, http_scheme="HTTP", method="GET", path="/api/v1/paths/{path_id}", @@ -35,7 +35,7 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: api_path = client.waap.domains.api_paths.create( - domain_id=0, + domain_id=1, http_scheme="HTTP", method="GET", path="/api/v1/paths/{path_id}", @@ -48,7 +48,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.waap.domains.api_paths.with_raw_response.create( - domain_id=0, + domain_id=1, http_scheme="HTTP", method="GET", path="/api/v1/paths/{path_id}", @@ -62,7 +62,7 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.waap.domains.api_paths.with_streaming_response.create( - domain_id=0, + domain_id=1, http_scheme="HTTP", method="GET", path="/api/v1/paths/{path_id}", @@ -79,7 +79,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: def test_method_update(self, client: Gcore) -> None: api_path = client.waap.domains.api_paths.update( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert api_path is None @@ -87,7 +87,7 @@ def test_method_update(self, client: Gcore) -> None: def test_method_update_with_all_params(self, client: Gcore) -> None: api_path = client.waap.domains.api_paths.update( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, api_groups=["accounts", "internal"], path="/api/v1/paths/{path_id}", status="CONFIRMED_API", @@ -99,7 +99,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: def test_raw_response_update(self, client: Gcore) -> None: response = client.waap.domains.api_paths.with_raw_response.update( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -111,7 +111,7 @@ def test_raw_response_update(self, client: Gcore) -> None: def test_streaming_response_update(self, client: Gcore) -> None: with client.waap.domains.api_paths.with_streaming_response.update( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -126,20 +126,20 @@ def test_path_params_update(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): client.waap.domains.api_paths.with_raw_response.update( path_id="", - domain_id=0, + domain_id=1, ) @parametrize def test_method_list(self, client: Gcore) -> None: api_path = client.waap.domains.api_paths.list( - domain_id=0, + domain_id=1, ) assert_matches_type(SyncOffsetPage[APIPathListResponse], api_path, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: api_path = client.waap.domains.api_paths.list( - domain_id=0, + domain_id=1, api_group="api_group", api_version="api_version", http_scheme="HTTP", @@ -157,7 +157,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.waap.domains.api_paths.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -168,7 +168,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.waap.domains.api_paths.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -182,7 +182,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: def test_method_delete(self, client: Gcore) -> None: api_path = client.waap.domains.api_paths.delete( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert api_path is None @@ -190,7 +190,7 @@ def test_method_delete(self, client: Gcore) -> None: def test_raw_response_delete(self, client: Gcore) -> None: response = client.waap.domains.api_paths.with_raw_response.delete( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -202,7 +202,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: def test_streaming_response_delete(self, client: Gcore) -> None: with client.waap.domains.api_paths.with_streaming_response.delete( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -217,14 +217,14 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): client.waap.domains.api_paths.with_raw_response.delete( path_id="", - domain_id=0, + domain_id=1, ) @parametrize def test_method_get(self, client: Gcore) -> None: api_path = client.waap.domains.api_paths.get( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert_matches_type(APIPathGetResponse, api_path, path=["response"]) @@ -232,7 +232,7 @@ def test_method_get(self, client: Gcore) -> None: def test_raw_response_get(self, client: Gcore) -> None: response = client.waap.domains.api_paths.with_raw_response.get( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -244,7 +244,7 @@ def test_raw_response_get(self, client: Gcore) -> None: def test_streaming_response_get(self, client: Gcore) -> None: with client.waap.domains.api_paths.with_streaming_response.get( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -259,7 +259,7 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): client.waap.domains.api_paths.with_raw_response.get( path_id="", - domain_id=0, + domain_id=1, ) @@ -271,7 +271,7 @@ class TestAsyncAPIPaths: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: api_path = await async_client.waap.domains.api_paths.create( - domain_id=0, + domain_id=1, http_scheme="HTTP", method="GET", path="/api/v1/paths/{path_id}", @@ -281,7 +281,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: api_path = await async_client.waap.domains.api_paths.create( - domain_id=0, + domain_id=1, http_scheme="HTTP", method="GET", path="/api/v1/paths/{path_id}", @@ -294,7 +294,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.api_paths.with_raw_response.create( - domain_id=0, + domain_id=1, http_scheme="HTTP", method="GET", path="/api/v1/paths/{path_id}", @@ -308,7 +308,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.api_paths.with_streaming_response.create( - domain_id=0, + domain_id=1, http_scheme="HTTP", method="GET", path="/api/v1/paths/{path_id}", @@ -325,7 +325,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None async def test_method_update(self, async_client: AsyncGcore) -> None: api_path = await async_client.waap.domains.api_paths.update( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert api_path is None @@ -333,7 +333,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: api_path = await async_client.waap.domains.api_paths.update( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, api_groups=["accounts", "internal"], path="/api/v1/paths/{path_id}", status="CONFIRMED_API", @@ -345,7 +345,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.api_paths.with_raw_response.update( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -357,7 +357,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.api_paths.with_streaming_response.update( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -372,20 +372,20 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): await async_client.waap.domains.api_paths.with_raw_response.update( path_id="", - domain_id=0, + domain_id=1, ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: api_path = await async_client.waap.domains.api_paths.list( - domain_id=0, + domain_id=1, ) assert_matches_type(AsyncOffsetPage[APIPathListResponse], api_path, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: api_path = await async_client.waap.domains.api_paths.list( - domain_id=0, + domain_id=1, api_group="api_group", api_version="api_version", http_scheme="HTTP", @@ -403,7 +403,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.waap.domains.api_paths.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -414,7 +414,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.waap.domains.api_paths.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -428,7 +428,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async def test_method_delete(self, async_client: AsyncGcore) -> None: api_path = await async_client.waap.domains.api_paths.delete( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert api_path is None @@ -436,7 +436,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.api_paths.with_raw_response.delete( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -448,7 +448,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.api_paths.with_streaming_response.delete( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -463,14 +463,14 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): await async_client.waap.domains.api_paths.with_raw_response.delete( path_id="", - domain_id=0, + domain_id=1, ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: api_path = await async_client.waap.domains.api_paths.get( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert_matches_type(APIPathGetResponse, api_path, path=["response"]) @@ -478,7 +478,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.api_paths.with_raw_response.get( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -490,7 +490,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.api_paths.with_streaming_response.get( path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -505,5 +505,5 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): await async_client.waap.domains.api_paths.with_raw_response.get( path_id="", - domain_id=0, + domain_id=1, ) diff --git a/tests/api_resources/waap/domains/test_custom_rules.py b/tests/api_resources/waap/domains/test_custom_rules.py index ca4081bf..3da58761 100644 --- a/tests/api_resources/waap/domains/test_custom_rules.py +++ b/tests/api_resources/waap/domains/test_custom_rules.py @@ -21,7 +21,7 @@ class TestCustomRules: @parametrize def test_method_create(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.create( - domain_id=0, + domain_id=1, action={}, conditions=[{}], enabled=True, @@ -32,7 +32,7 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.create( - domain_id=0, + domain_id=1, action={ "allow": {}, "block": { @@ -140,7 +140,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.waap.domains.custom_rules.with_raw_response.create( - domain_id=0, + domain_id=1, action={}, conditions=[{}], enabled=True, @@ -155,7 +155,7 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.waap.domains.custom_rules.with_streaming_response.create( - domain_id=0, + domain_id=1, action={}, conditions=[{}], enabled=True, @@ -173,7 +173,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: def test_method_update(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.update( rule_id=0, - domain_id=0, + domain_id=1, ) assert custom_rule is None @@ -181,7 +181,7 @@ def test_method_update(self, client: Gcore) -> None: def test_method_update_with_all_params(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.update( rule_id=0, - domain_id=0, + domain_id=1, action={ "allow": {}, "block": { @@ -290,7 +290,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: def test_raw_response_update(self, client: Gcore) -> None: response = client.waap.domains.custom_rules.with_raw_response.update( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -302,7 +302,7 @@ def test_raw_response_update(self, client: Gcore) -> None: def test_streaming_response_update(self, client: Gcore) -> None: with client.waap.domains.custom_rules.with_streaming_response.update( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -315,19 +315,19 @@ def test_streaming_response_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.list( - domain_id=0, + domain_id=1, ) assert_matches_type(SyncOffsetPage[WaapCustomRule], custom_rule, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.list( - domain_id=0, + domain_id=1, action="allow", - description="description", - enabled=True, + description="This rule blocks all the requests coming form a specific IP address.", + enabled=False, limit=0, - name="name", + name="Block by specific IP rule.", offset=0, ordering="-id", ) @@ -336,7 +336,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.waap.domains.custom_rules.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -347,7 +347,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.waap.domains.custom_rules.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -361,7 +361,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: def test_method_delete(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.delete( rule_id=0, - domain_id=0, + domain_id=1, ) assert custom_rule is None @@ -369,7 +369,7 @@ def test_method_delete(self, client: Gcore) -> None: def test_raw_response_delete(self, client: Gcore) -> None: response = client.waap.domains.custom_rules.with_raw_response.delete( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -381,7 +381,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: def test_streaming_response_delete(self, client: Gcore) -> None: with client.waap.domains.custom_rules.with_streaming_response.delete( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -394,7 +394,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_method_delete_multiple(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.delete_multiple( - domain_id=0, + domain_id=1, rule_ids=[0], ) assert custom_rule is None @@ -402,7 +402,7 @@ def test_method_delete_multiple(self, client: Gcore) -> None: @parametrize def test_raw_response_delete_multiple(self, client: Gcore) -> None: response = client.waap.domains.custom_rules.with_raw_response.delete_multiple( - domain_id=0, + domain_id=1, rule_ids=[0], ) @@ -414,7 +414,7 @@ def test_raw_response_delete_multiple(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete_multiple(self, client: Gcore) -> None: with client.waap.domains.custom_rules.with_streaming_response.delete_multiple( - domain_id=0, + domain_id=1, rule_ids=[0], ) as response: assert not response.is_closed @@ -429,7 +429,7 @@ def test_streaming_response_delete_multiple(self, client: Gcore) -> None: def test_method_get(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.get( rule_id=0, - domain_id=0, + domain_id=1, ) assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @@ -437,7 +437,7 @@ def test_method_get(self, client: Gcore) -> None: def test_raw_response_get(self, client: Gcore) -> None: response = client.waap.domains.custom_rules.with_raw_response.get( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -449,7 +449,7 @@ def test_raw_response_get(self, client: Gcore) -> None: def test_streaming_response_get(self, client: Gcore) -> None: with client.waap.domains.custom_rules.with_streaming_response.get( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -463,7 +463,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: def test_method_toggle(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) assert custom_rule is None @@ -472,7 +472,7 @@ def test_method_toggle(self, client: Gcore) -> None: def test_raw_response_toggle(self, client: Gcore) -> None: response = client.waap.domains.custom_rules.with_raw_response.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) @@ -485,7 +485,7 @@ def test_raw_response_toggle(self, client: Gcore) -> None: def test_streaming_response_toggle(self, client: Gcore) -> None: with client.waap.domains.custom_rules.with_streaming_response.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) as response: assert not response.is_closed @@ -505,7 +505,7 @@ class TestAsyncCustomRules: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: custom_rule = await async_client.waap.domains.custom_rules.create( - domain_id=0, + domain_id=1, action={}, conditions=[{}], enabled=True, @@ -516,7 +516,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: custom_rule = await async_client.waap.domains.custom_rules.create( - domain_id=0, + domain_id=1, action={ "allow": {}, "block": { @@ -624,7 +624,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.custom_rules.with_raw_response.create( - domain_id=0, + domain_id=1, action={}, conditions=[{}], enabled=True, @@ -639,7 +639,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.custom_rules.with_streaming_response.create( - domain_id=0, + domain_id=1, action={}, conditions=[{}], enabled=True, @@ -657,7 +657,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None async def test_method_update(self, async_client: AsyncGcore) -> None: custom_rule = await async_client.waap.domains.custom_rules.update( rule_id=0, - domain_id=0, + domain_id=1, ) assert custom_rule is None @@ -665,7 +665,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: custom_rule = await async_client.waap.domains.custom_rules.update( rule_id=0, - domain_id=0, + domain_id=1, action={ "allow": {}, "block": { @@ -774,7 +774,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.custom_rules.with_raw_response.update( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -786,7 +786,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.custom_rules.with_streaming_response.update( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -799,19 +799,19 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: custom_rule = await async_client.waap.domains.custom_rules.list( - domain_id=0, + domain_id=1, ) assert_matches_type(AsyncOffsetPage[WaapCustomRule], custom_rule, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: custom_rule = await async_client.waap.domains.custom_rules.list( - domain_id=0, + domain_id=1, action="allow", - description="description", - enabled=True, + description="This rule blocks all the requests coming form a specific IP address.", + enabled=False, limit=0, - name="name", + name="Block by specific IP rule.", offset=0, ordering="-id", ) @@ -820,7 +820,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.waap.domains.custom_rules.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -831,7 +831,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.waap.domains.custom_rules.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -845,7 +845,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async def test_method_delete(self, async_client: AsyncGcore) -> None: custom_rule = await async_client.waap.domains.custom_rules.delete( rule_id=0, - domain_id=0, + domain_id=1, ) assert custom_rule is None @@ -853,7 +853,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.custom_rules.with_raw_response.delete( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -865,7 +865,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.custom_rules.with_streaming_response.delete( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -878,7 +878,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_method_delete_multiple(self, async_client: AsyncGcore) -> None: custom_rule = await async_client.waap.domains.custom_rules.delete_multiple( - domain_id=0, + domain_id=1, rule_ids=[0], ) assert custom_rule is None @@ -886,7 +886,7 @@ async def test_method_delete_multiple(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_delete_multiple(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.custom_rules.with_raw_response.delete_multiple( - domain_id=0, + domain_id=1, rule_ids=[0], ) @@ -898,7 +898,7 @@ async def test_raw_response_delete_multiple(self, async_client: AsyncGcore) -> N @parametrize async def test_streaming_response_delete_multiple(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.custom_rules.with_streaming_response.delete_multiple( - domain_id=0, + domain_id=1, rule_ids=[0], ) as response: assert not response.is_closed @@ -913,7 +913,7 @@ async def test_streaming_response_delete_multiple(self, async_client: AsyncGcore async def test_method_get(self, async_client: AsyncGcore) -> None: custom_rule = await async_client.waap.domains.custom_rules.get( rule_id=0, - domain_id=0, + domain_id=1, ) assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @@ -921,7 +921,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.custom_rules.with_raw_response.get( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -933,7 +933,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.custom_rules.with_streaming_response.get( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -947,7 +947,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async def test_method_toggle(self, async_client: AsyncGcore) -> None: custom_rule = await async_client.waap.domains.custom_rules.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) assert custom_rule is None @@ -956,7 +956,7 @@ async def test_method_toggle(self, async_client: AsyncGcore) -> None: async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.custom_rules.with_raw_response.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) @@ -969,7 +969,7 @@ async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.custom_rules.with_streaming_response.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) as response: assert not response.is_closed diff --git a/tests/api_resources/waap/domains/test_firewall_rules.py b/tests/api_resources/waap/domains/test_firewall_rules.py index 0d652808..6ab473ee 100644 --- a/tests/api_resources/waap/domains/test_firewall_rules.py +++ b/tests/api_resources/waap/domains/test_firewall_rules.py @@ -21,7 +21,7 @@ class TestFirewallRules: @parametrize def test_method_create(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.create( - domain_id=0, + domain_id=1, action={}, conditions=[{}], enabled=True, @@ -32,7 +32,7 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.create( - domain_id=0, + domain_id=1, action={ "allow": {}, "block": { @@ -62,7 +62,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.waap.domains.firewall_rules.with_raw_response.create( - domain_id=0, + domain_id=1, action={}, conditions=[{}], enabled=True, @@ -77,7 +77,7 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.waap.domains.firewall_rules.with_streaming_response.create( - domain_id=0, + domain_id=1, action={}, conditions=[{}], enabled=True, @@ -95,7 +95,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: def test_method_update(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.update( rule_id=0, - domain_id=0, + domain_id=1, ) assert firewall_rule is None @@ -103,7 +103,7 @@ def test_method_update(self, client: Gcore) -> None: def test_method_update_with_all_params(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.update( rule_id=0, - domain_id=0, + domain_id=1, action={ "allow": {}, "block": { @@ -134,7 +134,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: def test_raw_response_update(self, client: Gcore) -> None: response = client.waap.domains.firewall_rules.with_raw_response.update( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -146,7 +146,7 @@ def test_raw_response_update(self, client: Gcore) -> None: def test_streaming_response_update(self, client: Gcore) -> None: with client.waap.domains.firewall_rules.with_streaming_response.update( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -159,14 +159,14 @@ def test_streaming_response_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.list( - domain_id=0, + domain_id=1, ) assert_matches_type(SyncOffsetPage[WaapFirewallRule], firewall_rule, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.list( - domain_id=0, + domain_id=1, action="allow", description="description", enabled=True, @@ -180,7 +180,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.waap.domains.firewall_rules.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -191,7 +191,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.waap.domains.firewall_rules.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -205,7 +205,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: def test_method_delete(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.delete( rule_id=0, - domain_id=0, + domain_id=1, ) assert firewall_rule is None @@ -213,7 +213,7 @@ def test_method_delete(self, client: Gcore) -> None: def test_raw_response_delete(self, client: Gcore) -> None: response = client.waap.domains.firewall_rules.with_raw_response.delete( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -225,7 +225,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: def test_streaming_response_delete(self, client: Gcore) -> None: with client.waap.domains.firewall_rules.with_streaming_response.delete( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -238,7 +238,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_method_delete_multiple(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.delete_multiple( - domain_id=0, + domain_id=1, rule_ids=[0], ) assert firewall_rule is None @@ -246,7 +246,7 @@ def test_method_delete_multiple(self, client: Gcore) -> None: @parametrize def test_raw_response_delete_multiple(self, client: Gcore) -> None: response = client.waap.domains.firewall_rules.with_raw_response.delete_multiple( - domain_id=0, + domain_id=1, rule_ids=[0], ) @@ -258,7 +258,7 @@ def test_raw_response_delete_multiple(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete_multiple(self, client: Gcore) -> None: with client.waap.domains.firewall_rules.with_streaming_response.delete_multiple( - domain_id=0, + domain_id=1, rule_ids=[0], ) as response: assert not response.is_closed @@ -273,7 +273,7 @@ def test_streaming_response_delete_multiple(self, client: Gcore) -> None: def test_method_get(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.get( rule_id=0, - domain_id=0, + domain_id=1, ) assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @@ -281,7 +281,7 @@ def test_method_get(self, client: Gcore) -> None: def test_raw_response_get(self, client: Gcore) -> None: response = client.waap.domains.firewall_rules.with_raw_response.get( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -293,7 +293,7 @@ def test_raw_response_get(self, client: Gcore) -> None: def test_streaming_response_get(self, client: Gcore) -> None: with client.waap.domains.firewall_rules.with_streaming_response.get( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -307,7 +307,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: def test_method_toggle(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) assert firewall_rule is None @@ -316,7 +316,7 @@ def test_method_toggle(self, client: Gcore) -> None: def test_raw_response_toggle(self, client: Gcore) -> None: response = client.waap.domains.firewall_rules.with_raw_response.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) @@ -329,7 +329,7 @@ def test_raw_response_toggle(self, client: Gcore) -> None: def test_streaming_response_toggle(self, client: Gcore) -> None: with client.waap.domains.firewall_rules.with_streaming_response.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) as response: assert not response.is_closed @@ -349,7 +349,7 @@ class TestAsyncFirewallRules: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: firewall_rule = await async_client.waap.domains.firewall_rules.create( - domain_id=0, + domain_id=1, action={}, conditions=[{}], enabled=True, @@ -360,7 +360,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: firewall_rule = await async_client.waap.domains.firewall_rules.create( - domain_id=0, + domain_id=1, action={ "allow": {}, "block": { @@ -390,7 +390,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.firewall_rules.with_raw_response.create( - domain_id=0, + domain_id=1, action={}, conditions=[{}], enabled=True, @@ -405,7 +405,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.firewall_rules.with_streaming_response.create( - domain_id=0, + domain_id=1, action={}, conditions=[{}], enabled=True, @@ -423,7 +423,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None async def test_method_update(self, async_client: AsyncGcore) -> None: firewall_rule = await async_client.waap.domains.firewall_rules.update( rule_id=0, - domain_id=0, + domain_id=1, ) assert firewall_rule is None @@ -431,7 +431,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: firewall_rule = await async_client.waap.domains.firewall_rules.update( rule_id=0, - domain_id=0, + domain_id=1, action={ "allow": {}, "block": { @@ -462,7 +462,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.firewall_rules.with_raw_response.update( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -474,7 +474,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.firewall_rules.with_streaming_response.update( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -487,14 +487,14 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: firewall_rule = await async_client.waap.domains.firewall_rules.list( - domain_id=0, + domain_id=1, ) assert_matches_type(AsyncOffsetPage[WaapFirewallRule], firewall_rule, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: firewall_rule = await async_client.waap.domains.firewall_rules.list( - domain_id=0, + domain_id=1, action="allow", description="description", enabled=True, @@ -508,7 +508,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.waap.domains.firewall_rules.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -519,7 +519,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.waap.domains.firewall_rules.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -533,7 +533,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async def test_method_delete(self, async_client: AsyncGcore) -> None: firewall_rule = await async_client.waap.domains.firewall_rules.delete( rule_id=0, - domain_id=0, + domain_id=1, ) assert firewall_rule is None @@ -541,7 +541,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.firewall_rules.with_raw_response.delete( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -553,7 +553,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.firewall_rules.with_streaming_response.delete( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -566,7 +566,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_method_delete_multiple(self, async_client: AsyncGcore) -> None: firewall_rule = await async_client.waap.domains.firewall_rules.delete_multiple( - domain_id=0, + domain_id=1, rule_ids=[0], ) assert firewall_rule is None @@ -574,7 +574,7 @@ async def test_method_delete_multiple(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_delete_multiple(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.firewall_rules.with_raw_response.delete_multiple( - domain_id=0, + domain_id=1, rule_ids=[0], ) @@ -586,7 +586,7 @@ async def test_raw_response_delete_multiple(self, async_client: AsyncGcore) -> N @parametrize async def test_streaming_response_delete_multiple(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.firewall_rules.with_streaming_response.delete_multiple( - domain_id=0, + domain_id=1, rule_ids=[0], ) as response: assert not response.is_closed @@ -601,7 +601,7 @@ async def test_streaming_response_delete_multiple(self, async_client: AsyncGcore async def test_method_get(self, async_client: AsyncGcore) -> None: firewall_rule = await async_client.waap.domains.firewall_rules.get( rule_id=0, - domain_id=0, + domain_id=1, ) assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @@ -609,7 +609,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.firewall_rules.with_raw_response.get( rule_id=0, - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -621,7 +621,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.firewall_rules.with_streaming_response.get( rule_id=0, - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -635,7 +635,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async def test_method_toggle(self, async_client: AsyncGcore) -> None: firewall_rule = await async_client.waap.domains.firewall_rules.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) assert firewall_rule is None @@ -644,7 +644,7 @@ async def test_method_toggle(self, async_client: AsyncGcore) -> None: async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.firewall_rules.with_raw_response.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) @@ -657,7 +657,7 @@ async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.firewall_rules.with_streaming_response.toggle( action="enable", - domain_id=0, + domain_id=1, rule_id=0, ) as response: assert not response.is_closed diff --git a/tests/api_resources/waap/domains/test_insight_silences.py b/tests/api_resources/waap/domains/test_insight_silences.py index 5b97be86..a107ae79 100644 --- a/tests/api_resources/waap/domains/test_insight_silences.py +++ b/tests/api_resources/waap/domains/test_insight_silences.py @@ -22,7 +22,7 @@ class TestInsightSilences: @parametrize def test_method_create(self, client: Gcore) -> None: insight_silence = client.waap.domains.insight_silences.create( - domain_id=0, + domain_id=1, author="author", comment="comment", insight_type="insight_type", @@ -33,7 +33,7 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: insight_silence = client.waap.domains.insight_silences.create( - domain_id=0, + domain_id=1, author="author", comment="comment", insight_type="insight_type", @@ -45,7 +45,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.waap.domains.insight_silences.with_raw_response.create( - domain_id=0, + domain_id=1, author="author", comment="comment", insight_type="insight_type", @@ -60,7 +60,7 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.waap.domains.insight_silences.with_streaming_response.create( - domain_id=0, + domain_id=1, author="author", comment="comment", insight_type="insight_type", @@ -78,7 +78,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: def test_method_update(self, client: Gcore) -> None: insight_silence = client.waap.domains.insight_silences.update( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, author="author", comment="comment", expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -89,7 +89,7 @@ def test_method_update(self, client: Gcore) -> None: def test_method_update_with_all_params(self, client: Gcore) -> None: insight_silence = client.waap.domains.insight_silences.update( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, author="author", comment="comment", expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -101,7 +101,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: def test_raw_response_update(self, client: Gcore) -> None: response = client.waap.domains.insight_silences.with_raw_response.update( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, author="author", comment="comment", expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -116,7 +116,7 @@ def test_raw_response_update(self, client: Gcore) -> None: def test_streaming_response_update(self, client: Gcore) -> None: with client.waap.domains.insight_silences.with_streaming_response.update( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, author="author", comment="comment", expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -134,7 +134,7 @@ def test_path_params_update(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `silence_id` but received ''"): client.waap.domains.insight_silences.with_raw_response.update( silence_id="", - domain_id=0, + domain_id=1, author="author", comment="comment", expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -143,14 +143,14 @@ def test_path_params_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: insight_silence = client.waap.domains.insight_silences.list( - domain_id=0, + domain_id=1, ) assert_matches_type(SyncOffsetPage[WaapInsightSilence], insight_silence, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: insight_silence = client.waap.domains.insight_silences.list( - domain_id=0, + domain_id=1, id=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], author="author", comment="comment", @@ -164,7 +164,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.waap.domains.insight_silences.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -175,7 +175,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.waap.domains.insight_silences.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -189,7 +189,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: def test_method_delete(self, client: Gcore) -> None: insight_silence = client.waap.domains.insight_silences.delete( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert insight_silence is None @@ -197,7 +197,7 @@ def test_method_delete(self, client: Gcore) -> None: def test_raw_response_delete(self, client: Gcore) -> None: response = client.waap.domains.insight_silences.with_raw_response.delete( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -209,7 +209,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: def test_streaming_response_delete(self, client: Gcore) -> None: with client.waap.domains.insight_silences.with_streaming_response.delete( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -224,14 +224,14 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `silence_id` but received ''"): client.waap.domains.insight_silences.with_raw_response.delete( silence_id="", - domain_id=0, + domain_id=1, ) @parametrize def test_method_get(self, client: Gcore) -> None: insight_silence = client.waap.domains.insight_silences.get( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) @@ -239,7 +239,7 @@ def test_method_get(self, client: Gcore) -> None: def test_raw_response_get(self, client: Gcore) -> None: response = client.waap.domains.insight_silences.with_raw_response.get( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -251,7 +251,7 @@ def test_raw_response_get(self, client: Gcore) -> None: def test_streaming_response_get(self, client: Gcore) -> None: with client.waap.domains.insight_silences.with_streaming_response.get( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -266,7 +266,7 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `silence_id` but received ''"): client.waap.domains.insight_silences.with_raw_response.get( silence_id="", - domain_id=0, + domain_id=1, ) @@ -278,7 +278,7 @@ class TestAsyncInsightSilences: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: insight_silence = await async_client.waap.domains.insight_silences.create( - domain_id=0, + domain_id=1, author="author", comment="comment", insight_type="insight_type", @@ -289,7 +289,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: insight_silence = await async_client.waap.domains.insight_silences.create( - domain_id=0, + domain_id=1, author="author", comment="comment", insight_type="insight_type", @@ -301,7 +301,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.insight_silences.with_raw_response.create( - domain_id=0, + domain_id=1, author="author", comment="comment", insight_type="insight_type", @@ -316,7 +316,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.insight_silences.with_streaming_response.create( - domain_id=0, + domain_id=1, author="author", comment="comment", insight_type="insight_type", @@ -334,7 +334,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None async def test_method_update(self, async_client: AsyncGcore) -> None: insight_silence = await async_client.waap.domains.insight_silences.update( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, author="author", comment="comment", expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -345,7 +345,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: insight_silence = await async_client.waap.domains.insight_silences.update( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, author="author", comment="comment", expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -357,7 +357,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.insight_silences.with_raw_response.update( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, author="author", comment="comment", expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -372,7 +372,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.insight_silences.with_streaming_response.update( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, author="author", comment="comment", expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -390,7 +390,7 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `silence_id` but received ''"): await async_client.waap.domains.insight_silences.with_raw_response.update( silence_id="", - domain_id=0, + domain_id=1, author="author", comment="comment", expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), @@ -399,14 +399,14 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: insight_silence = await async_client.waap.domains.insight_silences.list( - domain_id=0, + domain_id=1, ) assert_matches_type(AsyncOffsetPage[WaapInsightSilence], insight_silence, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: insight_silence = await async_client.waap.domains.insight_silences.list( - domain_id=0, + domain_id=1, id=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], author="author", comment="comment", @@ -420,7 +420,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.waap.domains.insight_silences.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -431,7 +431,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.waap.domains.insight_silences.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -445,7 +445,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async def test_method_delete(self, async_client: AsyncGcore) -> None: insight_silence = await async_client.waap.domains.insight_silences.delete( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert insight_silence is None @@ -453,7 +453,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.insight_silences.with_raw_response.delete( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -465,7 +465,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.insight_silences.with_streaming_response.delete( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -480,14 +480,14 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `silence_id` but received ''"): await async_client.waap.domains.insight_silences.with_raw_response.delete( silence_id="", - domain_id=0, + domain_id=1, ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: insight_silence = await async_client.waap.domains.insight_silences.get( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) @@ -495,7 +495,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.insight_silences.with_raw_response.get( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -507,7 +507,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.insight_silences.with_streaming_response.get( silence_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -522,5 +522,5 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `silence_id` but received ''"): await async_client.waap.domains.insight_silences.with_raw_response.get( silence_id="", - domain_id=0, + domain_id=1, ) diff --git a/tests/api_resources/waap/domains/test_insights.py b/tests/api_resources/waap/domains/test_insights.py index 1f94b7d7..259e941d 100644 --- a/tests/api_resources/waap/domains/test_insights.py +++ b/tests/api_resources/waap/domains/test_insights.py @@ -21,14 +21,14 @@ class TestInsights: @parametrize def test_method_list(self, client: Gcore) -> None: insight = client.waap.domains.insights.list( - domain_id=0, + domain_id=1, ) assert_matches_type(SyncOffsetPage[WaapInsight], insight, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: insight = client.waap.domains.insights.list( - domain_id=0, + domain_id=1, id=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], description="description", insight_type=["string", "string"], @@ -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.waap.domains.insights.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -53,7 +53,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.waap.domains.insights.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -67,7 +67,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: def test_method_get(self, client: Gcore) -> None: insight = client.waap.domains.insights.get( insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert_matches_type(WaapInsight, insight, path=["response"]) @@ -75,7 +75,7 @@ def test_method_get(self, client: Gcore) -> None: def test_raw_response_get(self, client: Gcore) -> None: response = client.waap.domains.insights.with_raw_response.get( insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -87,7 +87,7 @@ def test_raw_response_get(self, client: Gcore) -> None: def test_streaming_response_get(self, client: Gcore) -> None: with client.waap.domains.insights.with_streaming_response.get( insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -102,14 +102,14 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `insight_id` but received ''"): client.waap.domains.insights.with_raw_response.get( insight_id="", - domain_id=0, + domain_id=1, ) @parametrize def test_method_replace(self, client: Gcore) -> None: insight = client.waap.domains.insights.replace( insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, status="OPEN", ) assert_matches_type(WaapInsight, insight, path=["response"]) @@ -118,7 +118,7 @@ def test_method_replace(self, client: Gcore) -> None: def test_raw_response_replace(self, client: Gcore) -> None: response = client.waap.domains.insights.with_raw_response.replace( insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, status="OPEN", ) @@ -131,7 +131,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: def test_streaming_response_replace(self, client: Gcore) -> None: with client.waap.domains.insights.with_streaming_response.replace( insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, status="OPEN", ) as response: assert not response.is_closed @@ -147,7 +147,7 @@ def test_path_params_replace(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `insight_id` but received ''"): client.waap.domains.insights.with_raw_response.replace( insight_id="", - domain_id=0, + domain_id=1, status="OPEN", ) @@ -160,14 +160,14 @@ class TestAsyncInsights: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: insight = await async_client.waap.domains.insights.list( - domain_id=0, + domain_id=1, ) assert_matches_type(AsyncOffsetPage[WaapInsight], insight, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: insight = await async_client.waap.domains.insights.list( - domain_id=0, + domain_id=1, id=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], description="description", insight_type=["string", "string"], @@ -181,7 +181,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.waap.domains.insights.with_raw_response.list( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -192,7 +192,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.waap.domains.insights.with_streaming_response.list( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -206,7 +206,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async def test_method_get(self, async_client: AsyncGcore) -> None: insight = await async_client.waap.domains.insights.get( insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert_matches_type(WaapInsight, insight, path=["response"]) @@ -214,7 +214,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.insights.with_raw_response.get( insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -226,7 +226,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.insights.with_streaming_response.get( insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -241,14 +241,14 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `insight_id` but received ''"): await async_client.waap.domains.insights.with_raw_response.get( insight_id="", - domain_id=0, + domain_id=1, ) @parametrize async def test_method_replace(self, async_client: AsyncGcore) -> None: insight = await async_client.waap.domains.insights.replace( insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, status="OPEN", ) assert_matches_type(WaapInsight, insight, path=["response"]) @@ -257,7 +257,7 @@ async def test_method_replace(self, async_client: AsyncGcore) -> None: async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.insights.with_raw_response.replace( insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, status="OPEN", ) @@ -270,7 +270,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.insights.with_streaming_response.replace( insight_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - domain_id=0, + domain_id=1, status="OPEN", ) as response: assert not response.is_closed @@ -286,6 +286,6 @@ async def test_path_params_replace(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `insight_id` but received ''"): await async_client.waap.domains.insights.with_raw_response.replace( insight_id="", - domain_id=0, + domain_id=1, status="OPEN", ) diff --git a/tests/api_resources/waap/domains/test_policies.py b/tests/api_resources/waap/domains/test_policies.py index bb043c17..690ba30a 100644 --- a/tests/api_resources/waap/domains/test_policies.py +++ b/tests/api_resources/waap/domains/test_policies.py @@ -21,7 +21,7 @@ class TestPolicies: def test_method_toggle(self, client: Gcore) -> None: policy = client.waap.domains.policies.toggle( policy_id="policy_id", - domain_id=0, + domain_id=1, ) assert_matches_type(WaapPolicyMode, policy, path=["response"]) @@ -29,7 +29,7 @@ def test_method_toggle(self, client: Gcore) -> None: def test_raw_response_toggle(self, client: Gcore) -> None: response = client.waap.domains.policies.with_raw_response.toggle( policy_id="policy_id", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -41,7 +41,7 @@ def test_raw_response_toggle(self, client: Gcore) -> None: def test_streaming_response_toggle(self, client: Gcore) -> None: with client.waap.domains.policies.with_streaming_response.toggle( policy_id="policy_id", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -56,7 +56,7 @@ def test_path_params_toggle(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): client.waap.domains.policies.with_raw_response.toggle( policy_id="", - domain_id=0, + domain_id=1, ) @@ -69,7 +69,7 @@ class TestAsyncPolicies: async def test_method_toggle(self, async_client: AsyncGcore) -> None: policy = await async_client.waap.domains.policies.toggle( policy_id="policy_id", - domain_id=0, + domain_id=1, ) assert_matches_type(WaapPolicyMode, policy, path=["response"]) @@ -77,7 +77,7 @@ async def test_method_toggle(self, async_client: AsyncGcore) -> None: async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.policies.with_raw_response.toggle( policy_id="policy_id", - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -89,7 +89,7 @@ async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.policies.with_streaming_response.toggle( policy_id="policy_id", - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -104,5 +104,5 @@ async def test_path_params_toggle(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): await async_client.waap.domains.policies.with_raw_response.toggle( policy_id="", - domain_id=0, + domain_id=1, ) diff --git a/tests/api_resources/waap/domains/test_settings.py b/tests/api_resources/waap/domains/test_settings.py index 158273e1..38e68c8e 100644 --- a/tests/api_resources/waap/domains/test_settings.py +++ b/tests/api_resources/waap/domains/test_settings.py @@ -20,14 +20,14 @@ class TestSettings: @parametrize def test_method_update(self, client: Gcore) -> None: setting = client.waap.domains.settings.update( - domain_id=0, + domain_id=1, ) assert setting is None @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: setting = client.waap.domains.settings.update( - domain_id=0, + domain_id=1, api={ "api_urls": ["api/v1/.*", "v2/.*"], "is_api": True, @@ -42,7 +42,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_update(self, client: Gcore) -> None: response = client.waap.domains.settings.with_raw_response.update( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -53,7 +53,7 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: with client.waap.domains.settings.with_streaming_response.update( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -66,14 +66,14 @@ def test_streaming_response_update(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: setting = client.waap.domains.settings.get( - 0, + 1, ) assert_matches_type(WaapDomainSettingsModel, setting, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.waap.domains.settings.with_raw_response.get( - 0, + 1, ) assert response.is_closed is True @@ -84,7 +84,7 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.waap.domains.settings.with_streaming_response.get( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -103,14 +103,14 @@ class TestAsyncSettings: @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: setting = await async_client.waap.domains.settings.update( - domain_id=0, + domain_id=1, ) assert setting is None @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: setting = await async_client.waap.domains.settings.update( - domain_id=0, + domain_id=1, api={ "api_urls": ["api/v1/.*", "v2/.*"], "is_api": True, @@ -125,7 +125,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.settings.with_raw_response.update( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -136,7 +136,7 @@ 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.waap.domains.settings.with_streaming_response.update( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -149,14 +149,14 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: setting = await async_client.waap.domains.settings.get( - 0, + 1, ) assert_matches_type(WaapDomainSettingsModel, setting, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.settings.with_raw_response.get( - 0, + 1, ) assert response.is_closed is True @@ -167,7 +167,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.waap.domains.settings.with_streaming_response.get( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/waap/test_custom_page_sets.py b/tests/api_resources/waap/test_custom_page_sets.py index bb2ad1ee..204fbc21 100644 --- a/tests/api_resources/waap/test_custom_page_sets.py +++ b/tests/api_resources/waap/test_custom_page_sets.py @@ -59,7 +59,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "header": "xxx", "text": "xxxxxxxxxxxxxxxxxxxx", }, - domains=[0], + domains=[1], handshake={ "enabled": True, "header": "xxx", @@ -136,7 +136,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "header": "xxx", "text": "xxxxxxxxxxxxxxxxxxxx", }, - domains=[0], + domains=[1], handshake={ "enabled": True, "header": "xxx", @@ -361,7 +361,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "header": "xxx", "text": "xxxxxxxxxxxxxxxxxxxx", }, - domains=[0], + domains=[1], handshake={ "enabled": True, "header": "xxx", @@ -438,7 +438,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "header": "xxx", "text": "xxxxxxxxxxxxxxxxxxxx", }, - domains=[0], + domains=[1], handshake={ "enabled": True, "header": "xxx", diff --git a/tests/api_resources/waap/test_domains.py b/tests/api_resources/waap/test_domains.py index 5d380b41..9f98cca4 100644 --- a/tests/api_resources/waap/test_domains.py +++ b/tests/api_resources/waap/test_domains.py @@ -25,14 +25,14 @@ class TestDomains: @parametrize def test_method_update(self, client: Gcore) -> None: domain = client.waap.domains.update( - domain_id=0, + domain_id=1, ) assert domain is None @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: domain = client.waap.domains.update( - domain_id=0, + domain_id=1, status="active", ) assert domain is None @@ -40,7 +40,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_update(self, client: Gcore) -> None: response = client.waap.domains.with_raw_response.update( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -51,7 +51,7 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: with client.waap.domains.with_streaming_response.update( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -69,7 +69,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: domain = client.waap.domains.list( - ids=[0], + ids=[1], limit=0, name="name", offset=0, @@ -101,14 +101,14 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: domain = client.waap.domains.delete( - 0, + 1, ) assert domain is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.waap.domains.with_raw_response.delete( - 0, + 1, ) assert response.is_closed is True @@ -119,7 +119,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.waap.domains.with_streaming_response.delete( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -132,14 +132,14 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: domain = client.waap.domains.get( - 0, + 1, ) assert_matches_type(WaapDetailedDomain, domain, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.waap.domains.with_raw_response.get( - 0, + 1, ) assert response.is_closed is True @@ -150,7 +150,7 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.waap.domains.with_streaming_response.get( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -163,14 +163,14 @@ def test_streaming_response_get(self, client: Gcore) -> None: @parametrize def test_method_list_rule_sets(self, client: Gcore) -> None: domain = client.waap.domains.list_rule_sets( - 0, + 1, ) assert_matches_type(DomainListRuleSetsResponse, domain, path=["response"]) @parametrize def test_raw_response_list_rule_sets(self, client: Gcore) -> None: response = client.waap.domains.with_raw_response.list_rule_sets( - 0, + 1, ) assert response.is_closed is True @@ -181,7 +181,7 @@ def test_raw_response_list_rule_sets(self, client: Gcore) -> None: @parametrize def test_streaming_response_list_rule_sets(self, client: Gcore) -> None: with client.waap.domains.with_streaming_response.list_rule_sets( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -200,14 +200,14 @@ class TestAsyncDomains: @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: domain = await async_client.waap.domains.update( - domain_id=0, + domain_id=1, ) assert domain is None @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: domain = await async_client.waap.domains.update( - domain_id=0, + domain_id=1, status="active", ) assert domain is None @@ -215,7 +215,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.with_raw_response.update( - domain_id=0, + domain_id=1, ) assert response.is_closed is True @@ -226,7 +226,7 @@ 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.waap.domains.with_streaming_response.update( - domain_id=0, + domain_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -244,7 +244,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: domain = await async_client.waap.domains.list( - ids=[0], + ids=[1], limit=0, name="name", offset=0, @@ -276,14 +276,14 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: domain = await async_client.waap.domains.delete( - 0, + 1, ) assert domain is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.with_raw_response.delete( - 0, + 1, ) assert response.is_closed is True @@ -294,7 +294,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.waap.domains.with_streaming_response.delete( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -307,14 +307,14 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: domain = await async_client.waap.domains.get( - 0, + 1, ) assert_matches_type(WaapDetailedDomain, domain, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.with_raw_response.get( - 0, + 1, ) assert response.is_closed is True @@ -325,7 +325,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.waap.domains.with_streaming_response.get( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -338,14 +338,14 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_rule_sets(self, async_client: AsyncGcore) -> None: domain = await async_client.waap.domains.list_rule_sets( - 0, + 1, ) assert_matches_type(DomainListRuleSetsResponse, domain, path=["response"]) @parametrize async def test_raw_response_list_rule_sets(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.with_raw_response.list_rule_sets( - 0, + 1, ) assert response.is_closed is True @@ -356,7 +356,7 @@ async def test_raw_response_list_rule_sets(self, async_client: AsyncGcore) -> No @parametrize async def test_streaming_response_list_rule_sets(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.with_streaming_response.list_rule_sets( - 0, + 1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/waap/test_ip_info.py b/tests/api_resources/waap/test_ip_info.py index 641feb39..7db54d9d 100644 --- a/tests/api_resources/waap/test_ip_info.py +++ b/tests/api_resources/waap/test_ip_info.py @@ -92,7 +92,7 @@ def test_streaming_response_get_attack_time_series(self, client: Gcore) -> None: @parametrize def test_method_get_blocked_requests(self, client: Gcore) -> None: ip_info = client.waap.ip_info.get_blocked_requests( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) assert_matches_type(IPInfoGetBlockedRequestsResponse, ip_info, path=["response"]) @@ -100,7 +100,7 @@ def test_method_get_blocked_requests(self, client: Gcore) -> None: @parametrize def test_raw_response_get_blocked_requests(self, client: Gcore) -> None: response = client.waap.ip_info.with_raw_response.get_blocked_requests( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) @@ -112,7 +112,7 @@ def test_raw_response_get_blocked_requests(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_blocked_requests(self, client: Gcore) -> None: with client.waap.ip_info.with_streaming_response.get_blocked_requests( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) as response: assert not response.is_closed @@ -196,7 +196,7 @@ def test_streaming_response_get_ddos_attack_series(self, client: Gcore) -> None: @parametrize def test_method_get_top_sessions(self, client: Gcore) -> None: ip_info = client.waap.ip_info.get_top_sessions( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) @@ -204,7 +204,7 @@ def test_method_get_top_sessions(self, client: Gcore) -> None: @parametrize def test_raw_response_get_top_sessions(self, client: Gcore) -> None: response = client.waap.ip_info.with_raw_response.get_top_sessions( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) @@ -216,7 +216,7 @@ def test_raw_response_get_top_sessions(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_top_sessions(self, client: Gcore) -> None: with client.waap.ip_info.with_streaming_response.get_top_sessions( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) as response: assert not response.is_closed @@ -230,7 +230,7 @@ def test_streaming_response_get_top_sessions(self, client: Gcore) -> None: @parametrize def test_method_get_top_urls(self, client: Gcore) -> None: ip_info = client.waap.ip_info.get_top_urls( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) assert_matches_type(IPInfoGetTopURLsResponse, ip_info, path=["response"]) @@ -238,7 +238,7 @@ def test_method_get_top_urls(self, client: Gcore) -> None: @parametrize def test_raw_response_get_top_urls(self, client: Gcore) -> None: response = client.waap.ip_info.with_raw_response.get_top_urls( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) @@ -250,7 +250,7 @@ def test_raw_response_get_top_urls(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_top_urls(self, client: Gcore) -> None: with client.waap.ip_info.with_streaming_response.get_top_urls( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) as response: assert not response.is_closed @@ -264,7 +264,7 @@ def test_streaming_response_get_top_urls(self, client: Gcore) -> None: @parametrize def test_method_get_top_user_agents(self, client: Gcore) -> None: ip_info = client.waap.ip_info.get_top_user_agents( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) assert_matches_type(IPInfoGetTopUserAgentsResponse, ip_info, path=["response"]) @@ -272,7 +272,7 @@ def test_method_get_top_user_agents(self, client: Gcore) -> None: @parametrize def test_raw_response_get_top_user_agents(self, client: Gcore) -> None: response = client.waap.ip_info.with_raw_response.get_top_user_agents( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) @@ -284,7 +284,7 @@ def test_raw_response_get_top_user_agents(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_top_user_agents(self, client: Gcore) -> None: with client.waap.ip_info.with_streaming_response.get_top_user_agents( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) as response: assert not response.is_closed @@ -397,7 +397,7 @@ async def test_streaming_response_get_attack_time_series(self, async_client: Asy @parametrize async def test_method_get_blocked_requests(self, async_client: AsyncGcore) -> None: ip_info = await async_client.waap.ip_info.get_blocked_requests( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) assert_matches_type(IPInfoGetBlockedRequestsResponse, ip_info, path=["response"]) @@ -405,7 +405,7 @@ async def test_method_get_blocked_requests(self, async_client: AsyncGcore) -> No @parametrize async def test_raw_response_get_blocked_requests(self, async_client: AsyncGcore) -> None: response = await async_client.waap.ip_info.with_raw_response.get_blocked_requests( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) @@ -417,7 +417,7 @@ async def test_raw_response_get_blocked_requests(self, async_client: AsyncGcore) @parametrize async def test_streaming_response_get_blocked_requests(self, async_client: AsyncGcore) -> None: async with async_client.waap.ip_info.with_streaming_response.get_blocked_requests( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) as response: assert not response.is_closed @@ -501,7 +501,7 @@ async def test_streaming_response_get_ddos_attack_series(self, async_client: Asy @parametrize async def test_method_get_top_sessions(self, async_client: AsyncGcore) -> None: ip_info = await async_client.waap.ip_info.get_top_sessions( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) @@ -509,7 +509,7 @@ async def test_method_get_top_sessions(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_get_top_sessions(self, async_client: AsyncGcore) -> None: response = await async_client.waap.ip_info.with_raw_response.get_top_sessions( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) @@ -521,7 +521,7 @@ async def test_raw_response_get_top_sessions(self, async_client: AsyncGcore) -> @parametrize async def test_streaming_response_get_top_sessions(self, async_client: AsyncGcore) -> None: async with async_client.waap.ip_info.with_streaming_response.get_top_sessions( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) as response: assert not response.is_closed @@ -535,7 +535,7 @@ async def test_streaming_response_get_top_sessions(self, async_client: AsyncGcor @parametrize async def test_method_get_top_urls(self, async_client: AsyncGcore) -> None: ip_info = await async_client.waap.ip_info.get_top_urls( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) assert_matches_type(IPInfoGetTopURLsResponse, ip_info, path=["response"]) @@ -543,7 +543,7 @@ async def test_method_get_top_urls(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_get_top_urls(self, async_client: AsyncGcore) -> None: response = await async_client.waap.ip_info.with_raw_response.get_top_urls( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) @@ -555,7 +555,7 @@ async def test_raw_response_get_top_urls(self, async_client: AsyncGcore) -> None @parametrize async def test_streaming_response_get_top_urls(self, async_client: AsyncGcore) -> None: async with async_client.waap.ip_info.with_streaming_response.get_top_urls( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) as response: assert not response.is_closed @@ -569,7 +569,7 @@ async def test_streaming_response_get_top_urls(self, async_client: AsyncGcore) - @parametrize async def test_method_get_top_user_agents(self, async_client: AsyncGcore) -> None: ip_info = await async_client.waap.ip_info.get_top_user_agents( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) assert_matches_type(IPInfoGetTopUserAgentsResponse, ip_info, path=["response"]) @@ -577,7 +577,7 @@ async def test_method_get_top_user_agents(self, async_client: AsyncGcore) -> Non @parametrize async def test_raw_response_get_top_user_agents(self, async_client: AsyncGcore) -> None: response = await async_client.waap.ip_info.with_raw_response.get_top_user_agents( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) @@ -589,7 +589,7 @@ async def test_raw_response_get_top_user_agents(self, async_client: AsyncGcore) @parametrize async def test_streaming_response_get_top_user_agents(self, async_client: AsyncGcore) -> None: async with async_client.waap.ip_info.with_streaming_response.get_top_user_agents( - domain_id=0, + domain_id=1, ip="192.168.1.1", ) as response: assert not response.is_closed From b736ca6b866917b4a0d33d673da106ccdfbd58ee Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 02:27:37 +0000 Subject: [PATCH 216/592] fix(parsing): parse extra field types --- src/gcore/_models.py | 25 +++++++++++++++++++++++-- tests/test_models.py | 29 ++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/gcore/_models.py b/src/gcore/_models.py index ffcbf67b..b8387ce9 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -208,14 +208,18 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] else: fields_values[name] = field_get_default(field) + extra_field_type = _get_extra_fields_type(__cls) + _extra = {} for key, value in values.items(): if key not in model_fields: + parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value + if PYDANTIC_V2: - _extra[key] = value + _extra[key] = parsed else: _fields_set.add(key) - fields_values[key] = value + fields_values[key] = parsed object.__setattr__(m, "__dict__", fields_values) @@ -370,6 +374,23 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None)) +def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None: + if not PYDANTIC_V2: + # TODO + return None + + schema = cls.__pydantic_core_schema__ + if schema["type"] == "model": + fields = schema["schema"] + if fields["type"] == "model-fields": + extras = fields.get("extras_schema") + if extras and "cls" in extras: + # mypy can't narrow the type + return extras["cls"] # type: ignore[no-any-return] + + return None + + def is_basemodel(type_: type) -> bool: """Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`""" if is_union(type_): diff --git a/tests/test_models.py b/tests/test_models.py index c5eb9599..c891c772 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,5 +1,5 @@ import json -from typing import Any, Dict, List, Union, Optional, cast +from typing import TYPE_CHECKING, Any, Dict, List, Union, Optional, cast from datetime import datetime, timezone from typing_extensions import Literal, Annotated, TypeAliasType @@ -934,3 +934,30 @@ class Type2(BaseModel): ) assert isinstance(model, Type1) assert isinstance(model.value, InnerType2) + + +@pytest.mark.skipif(not PYDANTIC_V2, reason="this is only supported in pydantic v2 for now") +def test_extra_properties() -> None: + class Item(BaseModel): + prop: int + + class Model(BaseModel): + __pydantic_extra__: Dict[str, Item] = Field(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + other: str + + if TYPE_CHECKING: + + def __getattr__(self, attr: str) -> Item: ... + + model = construct_type( + type_=Model, + value={ + "a": {"prop": 1}, + "other": "foo", + }, + ) + assert isinstance(model, Model) + assert model.a.prop == 1 + assert isinstance(model.a, Item) + assert model.other == "foo" From 2743c0f106208ff7089250661a9a05119267b8dd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Jul 2025 08:13:39 +0000 Subject: [PATCH 217/592] feat(api): aggregated API specs update --- .stats.yml | 4 +-- api.md | 2 +- .../gpu_baremetal_clusters.py | 8 ++++++ .../cloud/inference/registry_credentials.py | 10 +++---- .../gpu_baremetal_cluster_create_params.py | 9 +++++++ .../types/cloud/quota_get_all_response.py | 26 +++++++++++++++++-- .../cloud/quota_get_by_region_response.py | 26 +++++++++++++++++-- .../cloud/quotas/request_create_params.py | 13 +++++++++- .../cloud/quotas/request_get_response.py | 13 +++++++++- .../cloud/quotas/request_list_response.py | 13 +++++++++- .../inference/test_registry_credentials.py | 12 ++++----- .../cloud/quotas/test_requests.py | 4 +++ .../cloud/test_gpu_baremetal_clusters.py | 2 ++ 13 files changed, 120 insertions(+), 22 deletions(-) diff --git a/.stats.yml b/.stats.yml index c90a5fcb..e9eb700b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 343 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-41a5ab2064dec5a2c49dd0eb8561c03eb1913c97195cbf750460247387434f2b.yml -openapi_spec_hash: e7fceb33e84631d5e4386cfb277eda23 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e9b9e784385ee4f4b68bedb15549bbbaa0324481e8198b1c1b94ebd172bb852b.yml +openapi_spec_hash: cb6a5fd0fb6675937c1e0de8e103de78 config_hash: 50f1eb77df588cfe368eb592e927f11a diff --git a/api.md b/api.md index 99c4b6b2..0a24b9d8 100644 --- a/api.md +++ b/api.md @@ -540,7 +540,7 @@ Methods: - client.cloud.inference.registry_credentials.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceRegistryCredentials] - client.cloud.inference.registry_credentials.delete(credential_name, \*, project_id) -> None - client.cloud.inference.registry_credentials.get(credential_name, \*, project_id) -> InferenceRegistryCredentials -- client.cloud.inference.registry_credentials.replace(credential_name, \*, project_id, \*\*params) -> None +- client.cloud.inference.registry_credentials.replace(credential_name, \*, project_id, \*\*params) -> InferenceRegistryCredentialsCreate ### Secrets diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index b4210a71..8ebe6b68 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -112,6 +112,7 @@ def create( name: str, instances_count: int | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, + security_groups: Iterable[gpu_baremetal_cluster_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, ssh_key_name: str | NotGiven = NOT_GIVEN, tags: Dict[str, str] | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, @@ -144,6 +145,8 @@ def create( the "Admin" user on a Windows instance, a default user or a new user on a Linux instance + security_groups: Security group UUIDs + ssh_key_name: Specifies the name of the SSH keypair, created via the [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). @@ -182,6 +185,7 @@ def create( "name": name, "instances_count": instances_count, "password": password, + "security_groups": security_groups, "ssh_key_name": ssh_key_name, "tags": tags, "user_data": user_data, @@ -587,6 +591,7 @@ async def create( name: str, instances_count: int | NotGiven = NOT_GIVEN, password: str | NotGiven = NOT_GIVEN, + security_groups: Iterable[gpu_baremetal_cluster_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, ssh_key_name: str | NotGiven = NOT_GIVEN, tags: Dict[str, str] | NotGiven = NOT_GIVEN, user_data: str | NotGiven = NOT_GIVEN, @@ -619,6 +624,8 @@ async def create( the "Admin" user on a Windows instance, a default user or a new user on a Linux instance + security_groups: Security group UUIDs + ssh_key_name: Specifies the name of the SSH keypair, created via the [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). @@ -657,6 +664,7 @@ async def create( "name": name, "instances_count": instances_count, "password": password, + "security_groups": security_groups, "ssh_key_name": ssh_key_name, "tags": tags, "user_data": user_data, diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 7592c9da..f5981625 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -251,7 +251,7 @@ def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: + ) -> InferenceRegistryCredentialsCreate: """ Replace inference registry credential @@ -278,7 +278,6 @@ def replace( project_id = self._client._get_cloud_project_id_path_param() if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=maybe_transform( @@ -292,7 +291,7 @@ def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=NoneType, + cast_to=InferenceRegistryCredentialsCreate, ) @@ -520,7 +519,7 @@ async def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: + ) -> InferenceRegistryCredentialsCreate: """ Replace inference registry credential @@ -547,7 +546,6 @@ async def replace( project_id = self._client._get_cloud_project_id_path_param() if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=await async_maybe_transform( @@ -561,7 +559,7 @@ async def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=NoneType, + cast_to=InferenceRegistryCredentialsCreate, ) 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 12018f17..959700a0 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -15,6 +15,7 @@ "InterfaceCreateGPUClusterSubnetInterfaceSerializerFloatingIP", "InterfaceCreateGPUClusterAnySubnetInterfaceSerializer", "InterfaceCreateGPUClusterAnySubnetInterfaceSerializerFloatingIP", + "SecurityGroup", ] @@ -48,6 +49,9 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): instance, a default user or a new user on a Linux instance """ + security_groups: Iterable[SecurityGroup] + """Security group UUIDs""" + ssh_key_name: str """ Specifies the name of the SSH keypair, created via the @@ -152,3 +156,8 @@ class InterfaceCreateGPUClusterAnySubnetInterfaceSerializer(TypedDict, total=Fal InterfaceCreateGPUClusterSubnetInterfaceSerializer, InterfaceCreateGPUClusterAnySubnetInterfaceSerializer, ] + + +class SecurityGroup(TypedDict, total=False): + id: Required[str] + """Resource ID""" diff --git a/src/gcore/types/cloud/quota_get_all_response.py b/src/gcore/types/cloud/quota_get_all_response.py index 99ad5482..7839b777 100644 --- a/src/gcore/types/cloud/quota_get_all_response.py +++ b/src/gcore/types/cloud/quota_get_all_response.py @@ -65,10 +65,20 @@ class RegionalQuota(BaseModel): """Baremetal A100 GPU card count usage""" baremetal_gpu_count_limit: Optional[int] = None - """AI GPU bare metal servers count limit""" + """Total number of AI GPU bare metal servers. + + This field is deprecated and is now always calculated automatically as the sum + of `baremetal_gpu_a100_count_limit`, `baremetal_gpu_h100_count_limit`, + `baremetal_gpu_h200_count_limit`, and `baremetal_gpu_l40s_count_limit`. + """ baremetal_gpu_count_usage: Optional[int] = None - """AI GPU bare metal servers count usage""" + """Baremetal Gpu Count Usage. + + This field is deprecated and is now always calculated automatically as the sum + of `baremetal_gpu_a100_count_usage`, `baremetal_gpu_h100_count_usage`, + `baremetal_gpu_h200_count_usage`, and `baremetal_gpu_l40s_count_usage`. + """ baremetal_gpu_h100_count_limit: Optional[int] = None """Baremetal H100 GPU card count limit""" @@ -76,6 +86,12 @@ class RegionalQuota(BaseModel): baremetal_gpu_h100_count_usage: Optional[int] = None """Baremetal H100 GPU card count usage""" + baremetal_gpu_h200_count_limit: Optional[int] = None + """Baremetal H200 GPU card count limit""" + + baremetal_gpu_h200_count_usage: Optional[int] = None + """Baremetal H200 GPU card count usage""" + baremetal_gpu_l40s_count_limit: Optional[int] = None """Baremetal L40S GPU card count limit""" @@ -208,6 +224,12 @@ class RegionalQuota(BaseModel): gpu_virtual_h100_count_usage: Optional[int] = None """Virtual H100 GPU card count usage""" + gpu_virtual_h200_count_limit: Optional[int] = None + """Virtual H200 GPU card count limit""" + + gpu_virtual_h200_count_usage: Optional[int] = None + """Virtual H200 GPU card count usage""" + gpu_virtual_l40s_count_limit: Optional[int] = None """Virtual L40S GPU card count limit""" diff --git a/src/gcore/types/cloud/quota_get_by_region_response.py b/src/gcore/types/cloud/quota_get_by_region_response.py index 4901ce08..c81b8e5d 100644 --- a/src/gcore/types/cloud/quota_get_by_region_response.py +++ b/src/gcore/types/cloud/quota_get_by_region_response.py @@ -21,10 +21,20 @@ class QuotaGetByRegionResponse(BaseModel): """Baremetal A100 GPU card count usage""" baremetal_gpu_count_limit: Optional[int] = None - """AI GPU bare metal servers count limit""" + """Total number of AI GPU bare metal servers. + + This field is deprecated and is now always calculated automatically as the sum + of `baremetal_gpu_a100_count_limit`, `baremetal_gpu_h100_count_limit`, + `baremetal_gpu_h200_count_limit`, and `baremetal_gpu_l40s_count_limit`. + """ baremetal_gpu_count_usage: Optional[int] = None - """AI GPU bare metal servers count usage""" + """Baremetal Gpu Count Usage. + + This field is deprecated and is now always calculated automatically as the sum + of `baremetal_gpu_a100_count_usage`, `baremetal_gpu_h100_count_usage`, + `baremetal_gpu_h200_count_usage`, and `baremetal_gpu_l40s_count_usage`. + """ baremetal_gpu_h100_count_limit: Optional[int] = None """Baremetal H100 GPU card count limit""" @@ -32,6 +42,12 @@ class QuotaGetByRegionResponse(BaseModel): baremetal_gpu_h100_count_usage: Optional[int] = None """Baremetal H100 GPU card count usage""" + baremetal_gpu_h200_count_limit: Optional[int] = None + """Baremetal H200 GPU card count limit""" + + baremetal_gpu_h200_count_usage: Optional[int] = None + """Baremetal H200 GPU card count usage""" + baremetal_gpu_l40s_count_limit: Optional[int] = None """Baremetal L40S GPU card count limit""" @@ -164,6 +180,12 @@ class QuotaGetByRegionResponse(BaseModel): gpu_virtual_h100_count_usage: Optional[int] = None """Virtual H100 GPU card count usage""" + gpu_virtual_h200_count_limit: Optional[int] = None + """Virtual H200 GPU card count limit""" + + gpu_virtual_h200_count_usage: Optional[int] = None + """Virtual H200 GPU card count usage""" + gpu_virtual_l40s_count_limit: Optional[int] = None """Virtual L40S GPU card 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 6cb0aac8..09490a25 100644 --- a/src/gcore/types/cloud/quotas/request_create_params.py +++ b/src/gcore/types/cloud/quotas/request_create_params.py @@ -50,11 +50,19 @@ class RequestedLimitsRegionalLimit(TypedDict, total=False): """Baremetal A100 GPU card count limit""" baremetal_gpu_count_limit: int - """AI GPU bare metal servers count limit""" + """Total number of AI GPU bare metal servers. + + This field is deprecated and is now always calculated automatically as the sum + of `baremetal_gpu_a100_count_limit`, `baremetal_gpu_h100_count_limit`, + `baremetal_gpu_h200_count_limit`, and `baremetal_gpu_l40s_count_limit`. + """ baremetal_gpu_h100_count_limit: int """Baremetal H100 GPU card count limit""" + baremetal_gpu_h200_count_limit: int + """Baremetal H200 GPU card count limit""" + baremetal_gpu_l40s_count_limit: int """Baremetal L40S GPU card count limit""" @@ -121,6 +129,9 @@ class RequestedLimitsRegionalLimit(TypedDict, total=False): gpu_virtual_h100_count_limit: int """Virtual H100 GPU card count limit""" + gpu_virtual_h200_count_limit: int + """Virtual H200 GPU card count limit""" + gpu_virtual_l40s_count_limit: int """Virtual L40S GPU card count limit""" diff --git a/src/gcore/types/cloud/quotas/request_get_response.py b/src/gcore/types/cloud/quotas/request_get_response.py index 94a2ba19..17301847 100644 --- a/src/gcore/types/cloud/quotas/request_get_response.py +++ b/src/gcore/types/cloud/quotas/request_get_response.py @@ -39,11 +39,19 @@ class RequestedLimitsRegionalLimit(BaseModel): """Baremetal A100 GPU card count limit""" baremetal_gpu_count_limit: Optional[int] = None - """AI GPU bare metal servers count limit""" + """Total number of AI GPU bare metal servers. + + This field is deprecated and is now always calculated automatically as the sum + of `baremetal_gpu_a100_count_limit`, `baremetal_gpu_h100_count_limit`, + `baremetal_gpu_h200_count_limit`, and `baremetal_gpu_l40s_count_limit`. + """ baremetal_gpu_h100_count_limit: Optional[int] = None """Baremetal H100 GPU card count limit""" + baremetal_gpu_h200_count_limit: Optional[int] = None + """Baremetal H200 GPU card count limit""" + baremetal_gpu_l40s_count_limit: Optional[int] = None """Baremetal L40S GPU card count limit""" @@ -110,6 +118,9 @@ class RequestedLimitsRegionalLimit(BaseModel): gpu_virtual_h100_count_limit: Optional[int] = None """Virtual H100 GPU card count limit""" + gpu_virtual_h200_count_limit: Optional[int] = None + """Virtual H200 GPU card count limit""" + gpu_virtual_l40s_count_limit: Optional[int] = None """Virtual L40S GPU card count limit""" diff --git a/src/gcore/types/cloud/quotas/request_list_response.py b/src/gcore/types/cloud/quotas/request_list_response.py index b4eb90bb..e69e988c 100644 --- a/src/gcore/types/cloud/quotas/request_list_response.py +++ b/src/gcore/types/cloud/quotas/request_list_response.py @@ -39,11 +39,19 @@ class RequestedLimitsRegionalLimit(BaseModel): """Baremetal A100 GPU card count limit""" baremetal_gpu_count_limit: Optional[int] = None - """AI GPU bare metal servers count limit""" + """Total number of AI GPU bare metal servers. + + This field is deprecated and is now always calculated automatically as the sum + of `baremetal_gpu_a100_count_limit`, `baremetal_gpu_h100_count_limit`, + `baremetal_gpu_h200_count_limit`, and `baremetal_gpu_l40s_count_limit`. + """ baremetal_gpu_h100_count_limit: Optional[int] = None """Baremetal H100 GPU card count limit""" + baremetal_gpu_h200_count_limit: Optional[int] = None + """Baremetal H200 GPU card count limit""" + baremetal_gpu_l40s_count_limit: Optional[int] = None """Baremetal L40S GPU card count limit""" @@ -110,6 +118,9 @@ class RequestedLimitsRegionalLimit(BaseModel): gpu_virtual_h100_count_limit: Optional[int] = None """Virtual H100 GPU card count limit""" + gpu_virtual_h200_count_limit: Optional[int] = None + """Virtual H200 GPU card count limit""" + gpu_virtual_l40s_count_limit: Optional[int] = None """Virtual L40S GPU card count limit""" diff --git a/tests/api_resources/cloud/inference/test_registry_credentials.py b/tests/api_resources/cloud/inference/test_registry_credentials.py index 2e745474..3ebaa989 100644 --- a/tests/api_resources/cloud/inference/test_registry_credentials.py +++ b/tests/api_resources/cloud/inference/test_registry_credentials.py @@ -197,7 +197,7 @@ def test_method_replace(self, client: Gcore) -> None: registry_url="registry.example.com", username="username", ) - assert registry_credential is None + assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) @parametrize def test_raw_response_replace(self, client: Gcore) -> None: @@ -212,7 +212,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = response.parse() - assert registry_credential is None + assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: @@ -227,7 +227,7 @@ def test_streaming_response_replace(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = response.parse() - assert registry_credential is None + assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) assert cast(Any, response.is_closed) is True @@ -424,7 +424,7 @@ async def test_method_replace(self, async_client: AsyncGcore) -> None: registry_url="registry.example.com", username="username", ) - assert registry_credential is None + assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @@ -439,7 +439,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = await response.parse() - assert registry_credential is None + assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: @@ -454,7 +454,7 @@ async def test_streaming_response_replace(self, async_client: AsyncGcore) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = await response.parse() - assert registry_credential is None + assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/quotas/test_requests.py b/tests/api_resources/cloud/quotas/test_requests.py index e9d3aae4..789b986d 100644 --- a/tests/api_resources/cloud/quotas/test_requests.py +++ b/tests/api_resources/cloud/quotas/test_requests.py @@ -46,6 +46,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "baremetal_gpu_a100_count_limit": 0, "baremetal_gpu_count_limit": 0, "baremetal_gpu_h100_count_limit": 0, + "baremetal_gpu_h200_count_limit": 0, "baremetal_gpu_l40s_count_limit": 0, "baremetal_hf_count_limit": 0, "baremetal_infrastructure_count_limit": 0, @@ -68,6 +69,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "gpu_count_limit": 0, "gpu_virtual_a100_count_limit": 0, "gpu_virtual_h100_count_limit": 0, + "gpu_virtual_h200_count_limit": 0, "gpu_virtual_l40s_count_limit": 0, "image_count_limit": 0, "image_size_limit": 0, @@ -269,6 +271,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "baremetal_gpu_a100_count_limit": 0, "baremetal_gpu_count_limit": 0, "baremetal_gpu_h100_count_limit": 0, + "baremetal_gpu_h200_count_limit": 0, "baremetal_gpu_l40s_count_limit": 0, "baremetal_hf_count_limit": 0, "baremetal_infrastructure_count_limit": 0, @@ -291,6 +294,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "gpu_count_limit": 0, "gpu_virtual_a100_count_limit": 0, "gpu_virtual_h100_count_limit": 0, + "gpu_virtual_h200_count_limit": 0, "gpu_virtual_l40s_count_limit": 0, "image_count_limit": 0, "image_size_limit": 0, diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index 02fbbaf9..1cf6cb78 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -61,6 +61,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: name="my-gpu-cluster", instances_count=1, password="password", + security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], ssh_key_name="my-ssh-key", tags={"my-tag": "my-tag-value"}, user_data="user_data", @@ -520,6 +521,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> name="my-gpu-cluster", instances_count=1, password="password", + security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], ssh_key_name="my-ssh-key", tags={"my-tag": "my-tag-value"}, user_data="user_data", From a8c9b7f3368d07a6b0dbdbe3a264fd0d2cc5dcd8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Jul 2025 15:15:45 +0000 Subject: [PATCH 218/592] feat(streaming): add streaming api --- .stats.yml | 4 +- api.md | 290 ++ src/gcore/_client.py | 9 + src/gcore/pagination.py | 102 +- src/gcore/resources/__init__.py | 14 + src/gcore/resources/streaming/__init__.py | 159 + src/gcore/resources/streaming/ai_tasks.py | 1288 +++++++ src/gcore/resources/streaming/broadcasts.py | 579 +++ src/gcore/resources/streaming/directories.py | 515 +++ src/gcore/resources/streaming/players.py | 577 +++ src/gcore/resources/streaming/playlists.py | 1059 ++++++ src/gcore/resources/streaming/quality_sets.py | 331 ++ src/gcore/resources/streaming/restreams.py | 484 +++ src/gcore/resources/streaming/statistics.py | 3224 +++++++++++++++++ src/gcore/resources/streaming/streaming.py | 390 ++ .../resources/streaming/streams/__init__.py | 33 + .../resources/streaming/streams/overlays.py | 716 ++++ .../resources/streaming/streams/streams.py | 1592 ++++++++ .../resources/streaming/videos/__init__.py | 33 + .../resources/streaming/videos/subtitles.py | 623 ++++ .../resources/streaming/videos/videos.py | 1553 ++++++++ src/gcore/types/streaming/__init__.py | 143 + .../streaming/ai_contentmoderation_casm.py | 39 + .../ai_contentmoderation_hardnudity.py | 54 + .../streaming/ai_contentmoderation_nsfw.py | 39 + .../ai_contentmoderation_softnudity.py | 66 + .../streaming/ai_contentmoderation_sport.py | 39 + .../streaming/ai_contentmoderation_weapon.py | 39 + src/gcore/types/streaming/ai_task.py | 205 ++ .../streaming/ai_task_cancel_response.py | 12 + .../types/streaming/ai_task_create_params.py | 168 + .../streaming/ai_task_create_response.py | 10 + .../ai_task_get_ai_settings_params.py | 27 + .../ai_task_get_ai_settings_response.py | 12 + .../types/streaming/ai_task_get_response.py | 313 ++ .../types/streaming/ai_task_list_params.py | 50 + src/gcore/types/streaming/broadcast.py | 71 + .../streaming/broadcast_create_params.py | 76 + .../types/streaming/broadcast_list_params.py | 12 + .../streaming/broadcast_spectators_count.py | 12 + .../streaming/broadcast_update_params.py | 76 + src/gcore/types/streaming/clip.py | 78 + .../types/streaming/create_video_param.py | 214 ++ .../streaming/direct_upload_parameters.py | 33 + src/gcore/types/streaming/directories_tree.py | 19 + src/gcore/types/streaming/directory_base.py | 31 + .../streaming/directory_create_params.py | 15 + .../types/streaming/directory_get_response.py | 19 + src/gcore/types/streaming/directory_item.py | 13 + .../streaming/directory_update_params.py | 18 + src/gcore/types/streaming/directory_video.py | 13 + src/gcore/types/streaming/ffprobes.py | 25 + .../types/streaming/max_stream_series.py | 21 + src/gcore/types/streaming/meet_series.py | 23 + src/gcore/types/streaming/player.py | 114 + .../types/streaming/player_create_params.py | 18 + .../types/streaming/player_list_params.py | 12 + src/gcore/types/streaming/player_param.py | 114 + .../types/streaming/player_update_params.py | 18 + src/gcore/types/streaming/playlist.py | 102 + src/gcore/types/streaming/playlist_create.py | 12 + .../types/streaming/playlist_create_params.py | 102 + .../types/streaming/playlist_list_params.py | 12 + .../playlist_list_videos_response.py | 10 + .../types/streaming/playlist_update_params.py | 102 + src/gcore/types/streaming/playlist_video.py | 215 ++ src/gcore/types/streaming/popular_videos.py | 17 + .../quality_set_set_default_params.py | 23 + src/gcore/types/streaming/quality_sets.py | 57 + src/gcore/types/streaming/restream.py | 37 + .../types/streaming/restream_create_params.py | 41 + .../types/streaming/restream_list_params.py | 12 + .../types/streaming/restream_update_params.py | 41 + .../statistic_get_ffprobes_params.py | 22 + ...tatistic_get_live_unique_viewers_params.py | 26 + ...tistic_get_live_unique_viewers_response.py | 25 + ...tatistic_get_live_watch_time_cdn_params.py | 32 + ...ic_get_live_watch_time_total_cdn_params.py | 30 + ...statistic_get_max_streams_series_params.py | 20 + .../statistic_get_meet_series_params.py | 20 + .../statistic_get_popular_videos_params.py | 15 + .../statistic_get_storage_series_params.py | 20 + .../statistic_get_stream_series_params.py | 20 + ...statistic_get_unique_viewers_cdn_params.py | 27 + .../statistic_get_unique_viewers_params.py | 34 + .../statistic_get_views_by_browsers_params.py | 15 + .../statistic_get_views_by_country_params.py | 15 + .../statistic_get_views_by_hostname_params.py | 15 + ...ic_get_views_by_operating_system_params.py | 15 + .../statistic_get_views_by_referer_params.py | 15 + .../statistic_get_views_by_region_params.py | 15 + .../statistic_get_views_heatmap_params.py | 21 + .../streaming/statistic_get_views_params.py | 34 + ...statistic_get_vod_storage_volume_params.py | 17 + ...tic_get_vod_transcoding_duration_params.py | 17 + ...istic_get_vod_unique_viewers_cdn_params.py | 26 + ...statistic_get_vod_watch_time_cdn_params.py | 32 + ...tic_get_vod_watch_time_total_cdn_params.py | 30 + ...c_get_vod_watch_time_total_cdn_response.py | 22 + src/gcore/types/streaming/storage_series.py | 23 + src/gcore/types/streaming/stream.py | 420 +++ .../streaming/stream_create_clip_params.py | 48 + .../types/streaming/stream_create_params.py | 165 + .../streaming/stream_list_clips_response.py | 10 + .../types/streaming/stream_list_params.py | 18 + src/gcore/types/streaming/stream_series.py | 21 + .../stream_start_recording_response.py | 76 + .../types/streaming/stream_update_params.py | 169 + src/gcore/types/streaming/streams/__init__.py | 11 + src/gcore/types/streaming/streams/overlay.py | 43 + .../streams/overlay_create_params.py | 36 + .../streams/overlay_create_response.py | 10 + .../streams/overlay_list_response.py | 10 + .../streams/overlay_update_multiple_params.py | 39 + .../overlay_update_multiple_response.py | 10 + .../streams/overlay_update_params.py | 33 + src/gcore/types/streaming/subtitle.py | 12 + src/gcore/types/streaming/subtitle_base.py | 18 + .../types/streaming/subtitle_base_param.py | 18 + src/gcore/types/streaming/unique_viewers.py | 35 + .../types/streaming/unique_viewers_cdn.py | 17 + src/gcore/types/streaming/video.py | 444 +++ .../streaming/video_create_multiple_params.py | 28 + .../video_create_multiple_response.py | 10 + .../types/streaming/video_create_params.py | 13 + .../types/streaming/video_create_response.py | 10 + .../streaming/video_list_names_params.py | 13 + .../types/streaming/video_list_params.py | 59 + .../types/streaming/video_update_params.py | 214 ++ src/gcore/types/streaming/videos/__init__.py | 7 + .../videos/subtitle_create_params.py | 17 + .../videos/subtitle_list_response.py | 10 + .../videos/subtitle_update_params.py | 20 + src/gcore/types/streaming/views.py | 35 + src/gcore/types/streaming/views_by_browser.py | 17 + src/gcore/types/streaming/views_by_country.py | 19 + .../types/streaming/views_by_hostname.py | 17 + .../streaming/views_by_operating_system.py | 17 + src/gcore/types/streaming/views_by_referer.py | 17 + src/gcore/types/streaming/views_by_region.py | 19 + src/gcore/types/streaming/views_heatmap.py | 19 + .../types/streaming/vod_statistics_series.py | 21 + .../vod_total_stream_duration_series.py | 22 + tests/api_resources/streaming/__init__.py | 1 + .../streaming/streams/__init__.py | 1 + .../streaming/streams/test_overlays.py | 517 +++ .../api_resources/streaming/test_ai_tasks.py | 435 +++ .../streaming/test_broadcasts.py | 464 +++ .../streaming/test_directories.py | 360 ++ tests/api_resources/streaming/test_players.py | 501 +++ .../api_resources/streaming/test_playlists.py | 473 +++ .../streaming/test_quality_sets.py | 140 + .../api_resources/streaming/test_restreams.py | 383 ++ .../streaming/test_statistics.py | 1947 ++++++++++ tests/api_resources/streaming/test_streams.py | 781 ++++ tests/api_resources/streaming/test_videos.py | 722 ++++ .../streaming/videos/__init__.py | 1 + .../streaming/videos/test_subtitles.py | 409 +++ 158 files changed, 26621 insertions(+), 3 deletions(-) create mode 100644 src/gcore/resources/streaming/__init__.py create mode 100644 src/gcore/resources/streaming/ai_tasks.py create mode 100644 src/gcore/resources/streaming/broadcasts.py create mode 100644 src/gcore/resources/streaming/directories.py create mode 100644 src/gcore/resources/streaming/players.py create mode 100644 src/gcore/resources/streaming/playlists.py create mode 100644 src/gcore/resources/streaming/quality_sets.py create mode 100644 src/gcore/resources/streaming/restreams.py create mode 100644 src/gcore/resources/streaming/statistics.py create mode 100644 src/gcore/resources/streaming/streaming.py create mode 100644 src/gcore/resources/streaming/streams/__init__.py create mode 100644 src/gcore/resources/streaming/streams/overlays.py create mode 100644 src/gcore/resources/streaming/streams/streams.py create mode 100644 src/gcore/resources/streaming/videos/__init__.py create mode 100644 src/gcore/resources/streaming/videos/subtitles.py create mode 100644 src/gcore/resources/streaming/videos/videos.py create mode 100644 src/gcore/types/streaming/__init__.py create mode 100644 src/gcore/types/streaming/ai_contentmoderation_casm.py create mode 100644 src/gcore/types/streaming/ai_contentmoderation_hardnudity.py create mode 100644 src/gcore/types/streaming/ai_contentmoderation_nsfw.py create mode 100644 src/gcore/types/streaming/ai_contentmoderation_softnudity.py create mode 100644 src/gcore/types/streaming/ai_contentmoderation_sport.py create mode 100644 src/gcore/types/streaming/ai_contentmoderation_weapon.py create mode 100644 src/gcore/types/streaming/ai_task.py create mode 100644 src/gcore/types/streaming/ai_task_cancel_response.py create mode 100644 src/gcore/types/streaming/ai_task_create_params.py create mode 100644 src/gcore/types/streaming/ai_task_create_response.py create mode 100644 src/gcore/types/streaming/ai_task_get_ai_settings_params.py create mode 100644 src/gcore/types/streaming/ai_task_get_ai_settings_response.py create mode 100644 src/gcore/types/streaming/ai_task_get_response.py create mode 100644 src/gcore/types/streaming/ai_task_list_params.py create mode 100644 src/gcore/types/streaming/broadcast.py create mode 100644 src/gcore/types/streaming/broadcast_create_params.py create mode 100644 src/gcore/types/streaming/broadcast_list_params.py create mode 100644 src/gcore/types/streaming/broadcast_spectators_count.py create mode 100644 src/gcore/types/streaming/broadcast_update_params.py create mode 100644 src/gcore/types/streaming/clip.py create mode 100644 src/gcore/types/streaming/create_video_param.py create mode 100644 src/gcore/types/streaming/direct_upload_parameters.py create mode 100644 src/gcore/types/streaming/directories_tree.py create mode 100644 src/gcore/types/streaming/directory_base.py create mode 100644 src/gcore/types/streaming/directory_create_params.py create mode 100644 src/gcore/types/streaming/directory_get_response.py create mode 100644 src/gcore/types/streaming/directory_item.py create mode 100644 src/gcore/types/streaming/directory_update_params.py create mode 100644 src/gcore/types/streaming/directory_video.py create mode 100644 src/gcore/types/streaming/ffprobes.py create mode 100644 src/gcore/types/streaming/max_stream_series.py create mode 100644 src/gcore/types/streaming/meet_series.py create mode 100644 src/gcore/types/streaming/player.py create mode 100644 src/gcore/types/streaming/player_create_params.py create mode 100644 src/gcore/types/streaming/player_list_params.py create mode 100644 src/gcore/types/streaming/player_param.py create mode 100644 src/gcore/types/streaming/player_update_params.py create mode 100644 src/gcore/types/streaming/playlist.py create mode 100644 src/gcore/types/streaming/playlist_create.py create mode 100644 src/gcore/types/streaming/playlist_create_params.py create mode 100644 src/gcore/types/streaming/playlist_list_params.py create mode 100644 src/gcore/types/streaming/playlist_list_videos_response.py create mode 100644 src/gcore/types/streaming/playlist_update_params.py create mode 100644 src/gcore/types/streaming/playlist_video.py create mode 100644 src/gcore/types/streaming/popular_videos.py create mode 100644 src/gcore/types/streaming/quality_set_set_default_params.py create mode 100644 src/gcore/types/streaming/quality_sets.py create mode 100644 src/gcore/types/streaming/restream.py create mode 100644 src/gcore/types/streaming/restream_create_params.py create mode 100644 src/gcore/types/streaming/restream_list_params.py create mode 100644 src/gcore/types/streaming/restream_update_params.py create mode 100644 src/gcore/types/streaming/statistic_get_ffprobes_params.py create mode 100644 src/gcore/types/streaming/statistic_get_live_unique_viewers_params.py create mode 100644 src/gcore/types/streaming/statistic_get_live_unique_viewers_response.py create mode 100644 src/gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py create mode 100644 src/gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py create mode 100644 src/gcore/types/streaming/statistic_get_max_streams_series_params.py create mode 100644 src/gcore/types/streaming/statistic_get_meet_series_params.py create mode 100644 src/gcore/types/streaming/statistic_get_popular_videos_params.py create mode 100644 src/gcore/types/streaming/statistic_get_storage_series_params.py create mode 100644 src/gcore/types/streaming/statistic_get_stream_series_params.py create mode 100644 src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py create mode 100644 src/gcore/types/streaming/statistic_get_unique_viewers_params.py create mode 100644 src/gcore/types/streaming/statistic_get_views_by_browsers_params.py create mode 100644 src/gcore/types/streaming/statistic_get_views_by_country_params.py create mode 100644 src/gcore/types/streaming/statistic_get_views_by_hostname_params.py create mode 100644 src/gcore/types/streaming/statistic_get_views_by_operating_system_params.py create mode 100644 src/gcore/types/streaming/statistic_get_views_by_referer_params.py create mode 100644 src/gcore/types/streaming/statistic_get_views_by_region_params.py create mode 100644 src/gcore/types/streaming/statistic_get_views_heatmap_params.py create mode 100644 src/gcore/types/streaming/statistic_get_views_params.py create mode 100644 src/gcore/types/streaming/statistic_get_vod_storage_volume_params.py create mode 100644 src/gcore/types/streaming/statistic_get_vod_transcoding_duration_params.py create mode 100644 src/gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py create mode 100644 src/gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py create mode 100644 src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py create mode 100644 src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py create mode 100644 src/gcore/types/streaming/storage_series.py create mode 100644 src/gcore/types/streaming/stream.py create mode 100644 src/gcore/types/streaming/stream_create_clip_params.py create mode 100644 src/gcore/types/streaming/stream_create_params.py create mode 100644 src/gcore/types/streaming/stream_list_clips_response.py create mode 100644 src/gcore/types/streaming/stream_list_params.py create mode 100644 src/gcore/types/streaming/stream_series.py create mode 100644 src/gcore/types/streaming/stream_start_recording_response.py create mode 100644 src/gcore/types/streaming/stream_update_params.py create mode 100644 src/gcore/types/streaming/streams/__init__.py create mode 100644 src/gcore/types/streaming/streams/overlay.py create mode 100644 src/gcore/types/streaming/streams/overlay_create_params.py create mode 100644 src/gcore/types/streaming/streams/overlay_create_response.py create mode 100644 src/gcore/types/streaming/streams/overlay_list_response.py create mode 100644 src/gcore/types/streaming/streams/overlay_update_multiple_params.py create mode 100644 src/gcore/types/streaming/streams/overlay_update_multiple_response.py create mode 100644 src/gcore/types/streaming/streams/overlay_update_params.py create mode 100644 src/gcore/types/streaming/subtitle.py create mode 100644 src/gcore/types/streaming/subtitle_base.py create mode 100644 src/gcore/types/streaming/subtitle_base_param.py create mode 100644 src/gcore/types/streaming/unique_viewers.py create mode 100644 src/gcore/types/streaming/unique_viewers_cdn.py create mode 100644 src/gcore/types/streaming/video.py create mode 100644 src/gcore/types/streaming/video_create_multiple_params.py create mode 100644 src/gcore/types/streaming/video_create_multiple_response.py create mode 100644 src/gcore/types/streaming/video_create_params.py create mode 100644 src/gcore/types/streaming/video_create_response.py create mode 100644 src/gcore/types/streaming/video_list_names_params.py create mode 100644 src/gcore/types/streaming/video_list_params.py create mode 100644 src/gcore/types/streaming/video_update_params.py create mode 100644 src/gcore/types/streaming/videos/__init__.py create mode 100644 src/gcore/types/streaming/videos/subtitle_create_params.py create mode 100644 src/gcore/types/streaming/videos/subtitle_list_response.py create mode 100644 src/gcore/types/streaming/videos/subtitle_update_params.py create mode 100644 src/gcore/types/streaming/views.py create mode 100644 src/gcore/types/streaming/views_by_browser.py create mode 100644 src/gcore/types/streaming/views_by_country.py create mode 100644 src/gcore/types/streaming/views_by_hostname.py create mode 100644 src/gcore/types/streaming/views_by_operating_system.py create mode 100644 src/gcore/types/streaming/views_by_referer.py create mode 100644 src/gcore/types/streaming/views_by_region.py create mode 100644 src/gcore/types/streaming/views_heatmap.py create mode 100644 src/gcore/types/streaming/vod_statistics_series.py create mode 100644 src/gcore/types/streaming/vod_total_stream_duration_series.py create mode 100644 tests/api_resources/streaming/__init__.py create mode 100644 tests/api_resources/streaming/streams/__init__.py create mode 100644 tests/api_resources/streaming/streams/test_overlays.py create mode 100644 tests/api_resources/streaming/test_ai_tasks.py create mode 100644 tests/api_resources/streaming/test_broadcasts.py create mode 100644 tests/api_resources/streaming/test_directories.py create mode 100644 tests/api_resources/streaming/test_players.py create mode 100644 tests/api_resources/streaming/test_playlists.py create mode 100644 tests/api_resources/streaming/test_quality_sets.py create mode 100644 tests/api_resources/streaming/test_restreams.py create mode 100644 tests/api_resources/streaming/test_statistics.py create mode 100644 tests/api_resources/streaming/test_streams.py create mode 100644 tests/api_resources/streaming/test_videos.py create mode 100644 tests/api_resources/streaming/videos/__init__.py create mode 100644 tests/api_resources/streaming/videos/test_subtitles.py diff --git a/.stats.yml b/.stats.yml index e9eb700b..4ef1d6ee 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 343 +configured_endpoints: 431 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e9b9e784385ee4f4b68bedb15549bbbaa0324481e8198b1c1b94ebd172bb852b.yml openapi_spec_hash: cb6a5fd0fb6675937c1e0de8e103de78 -config_hash: 50f1eb77df588cfe368eb592e927f11a +config_hash: f0f3b5359ac6d0b436c731c6a0667965 diff --git a/api.md b/api.md index 0a24b9d8..060d64bb 100644 --- a/api.md +++ b/api.md @@ -1347,3 +1347,293 @@ Methods: - client.fastedge.kv_stores.delete(id) -> None - client.fastedge.kv_stores.get(id) -> KvStoreGetResponse - client.fastedge.kv_stores.replace(id, \*\*params) -> KvStore + +# Streaming + +Types: + +```python +from gcore.types.streaming import CreateVideo, Video +``` + +## AITasks + +Types: + +```python +from gcore.types.streaming import ( + AIContentmoderationCasm, + AIContentmoderationHardnudity, + AIContentmoderationNsfw, + AIContentmoderationSoftnudity, + AIContentmoderationSport, + AIContentmoderationWeapon, + AITask, + AITaskCreateResponse, + AITaskCancelResponse, + AITaskGetResponse, + AITaskGetAISettingsResponse, +) +``` + +Methods: + +- client.streaming.ai_tasks.create(\*\*params) -> AITaskCreateResponse +- client.streaming.ai_tasks.list(\*\*params) -> SyncPageStreamingAI[AITask] +- client.streaming.ai_tasks.cancel(task_id) -> AITaskCancelResponse +- client.streaming.ai_tasks.get(task_id) -> AITaskGetResponse +- client.streaming.ai_tasks.get_ai_settings(\*\*params) -> AITaskGetAISettingsResponse + +## Broadcasts + +Types: + +```python +from gcore.types.streaming import Broadcast, BroadcastSpectatorsCount +``` + +Methods: + +- client.streaming.broadcasts.create(\*\*params) -> None +- client.streaming.broadcasts.update(broadcast_id, \*\*params) -> Broadcast +- client.streaming.broadcasts.list(\*\*params) -> SyncPageStreaming[Broadcast] +- client.streaming.broadcasts.delete(broadcast_id) -> None +- client.streaming.broadcasts.get(broadcast_id) -> Broadcast +- client.streaming.broadcasts.get_spectators_count(broadcast_id) -> BroadcastSpectatorsCount + +## Directories + +Types: + +```python +from gcore.types.streaming import ( + DirectoriesTree, + DirectoryBase, + DirectoryItem, + DirectoryVideo, + DirectoryGetResponse, +) +``` + +Methods: + +- client.streaming.directories.create(\*\*params) -> DirectoryBase +- client.streaming.directories.update(directory_id, \*\*params) -> DirectoryBase +- client.streaming.directories.delete(directory_id) -> None +- client.streaming.directories.get(directory_id) -> DirectoryGetResponse +- client.streaming.directories.get_tree() -> DirectoriesTree + +## Players + +Types: + +```python +from gcore.types.streaming import Player +``` + +Methods: + +- client.streaming.players.create(\*\*params) -> None +- client.streaming.players.update(player_id, \*\*params) -> Player +- client.streaming.players.list(\*\*params) -> SyncPageStreaming[Player] +- client.streaming.players.delete(player_id) -> None +- client.streaming.players.get(player_id) -> Player +- client.streaming.players.preview(player_id) -> None + +## QualitySets + +Types: + +```python +from gcore.types.streaming import QualitySets +``` + +Methods: + +- client.streaming.quality_sets.list() -> QualitySets +- client.streaming.quality_sets.set_default(\*\*params) -> QualitySets + +## Playlists + +Types: + +```python +from gcore.types.streaming import ( + Playlist, + PlaylistCreate, + PlaylistVideo, + PlaylistListVideosResponse, +) +``` + +Methods: + +- client.streaming.playlists.create(\*\*params) -> PlaylistCreate +- client.streaming.playlists.update(playlist_id, \*\*params) -> Playlist +- client.streaming.playlists.list(\*\*params) -> SyncPageStreaming[Playlist] +- client.streaming.playlists.delete(playlist_id) -> None +- client.streaming.playlists.get(playlist_id) -> Playlist +- client.streaming.playlists.list_videos(playlist_id) -> PlaylistListVideosResponse + +## Videos + +Types: + +```python +from gcore.types.streaming import ( + DirectUploadParameters, + Subtitle, + SubtitleBase, + SubtitleBody, + SubtitleUpdate, + VideoCreateResponse, + VideoCreateMultipleResponse, +) +``` + +Methods: + +- client.streaming.videos.create(\*\*params) -> VideoCreateResponse +- client.streaming.videos.update(video_id, \*\*params) -> Video +- client.streaming.videos.list(\*\*params) -> SyncPageStreaming[Video] +- client.streaming.videos.delete(video_id) -> None +- client.streaming.videos.create_multiple(\*\*params) -> VideoCreateMultipleResponse +- client.streaming.videos.get(video_id) -> Video +- client.streaming.videos.get_parameters_for_direct_upload(video_id) -> DirectUploadParameters +- client.streaming.videos.list_names(\*\*params) -> None + +### Subtitles + +Types: + +```python +from gcore.types.streaming.videos import SubtitleListResponse +``` + +Methods: + +- client.streaming.videos.subtitles.create(video_id, \*\*params) -> Subtitle +- client.streaming.videos.subtitles.update(id, \*, video_id, \*\*params) -> SubtitleBase +- client.streaming.videos.subtitles.list(video_id) -> SubtitleListResponse +- client.streaming.videos.subtitles.delete(id, \*, video_id) -> None +- client.streaming.videos.subtitles.get(id, \*, video_id) -> Subtitle + +## Streams + +Types: + +```python +from gcore.types.streaming import ( + Clip, + Stream, + StreamListClipsResponse, + StreamStartRecordingResponse, +) +``` + +Methods: + +- client.streaming.streams.create(\*\*params) -> Stream +- client.streaming.streams.update(stream_id, \*\*params) -> Stream +- client.streaming.streams.list(\*\*params) -> SyncPageStreaming[Stream] +- client.streaming.streams.delete(stream_id) -> None +- client.streaming.streams.clear_dvr(stream_id) -> None +- client.streaming.streams.create_clip(stream_id, \*\*params) -> Clip +- client.streaming.streams.get(stream_id) -> Stream +- client.streaming.streams.list_clips(stream_id) -> StreamListClipsResponse +- client.streaming.streams.start_recording(stream_id) -> StreamStartRecordingResponse +- client.streaming.streams.stop_recording(stream_id) -> Video + +### Overlays + +Types: + +```python +from gcore.types.streaming.streams import ( + Overlay, + OverlayCreateResponse, + OverlayListResponse, + OverlayUpdateMultipleResponse, +) +``` + +Methods: + +- client.streaming.streams.overlays.create(stream_id, \*\*params) -> OverlayCreateResponse +- client.streaming.streams.overlays.update(overlay_id, \*, stream_id, \*\*params) -> Overlay +- client.streaming.streams.overlays.list(stream_id) -> OverlayListResponse +- client.streaming.streams.overlays.delete(overlay_id, \*, stream_id) -> None +- client.streaming.streams.overlays.get(overlay_id, \*, stream_id) -> Overlay +- client.streaming.streams.overlays.update_multiple(stream_id, \*\*params) -> OverlayUpdateMultipleResponse + +## Restreams + +Types: + +```python +from gcore.types.streaming import Restream +``` + +Methods: + +- client.streaming.restreams.create(\*\*params) -> None +- client.streaming.restreams.update(restream_id, \*\*params) -> Restream +- client.streaming.restreams.list(\*\*params) -> SyncPageStreaming[Restream] +- client.streaming.restreams.delete(restream_id) -> None +- client.streaming.restreams.get(restream_id) -> Restream + +## Statistics + +Types: + +```python +from gcore.types.streaming import ( + Ffprobes, + MaxStreamSeries, + MeetSeries, + PopularVideos, + StorageSeries, + StreamSeries, + UniqueViewers, + UniqueViewersCdn, + Views, + ViewsByBrowser, + ViewsByCountry, + ViewsByHostname, + ViewsByOperatingSystem, + ViewsByReferer, + ViewsByRegion, + ViewsHeatmap, + VodStatisticsSeries, + VodTotalStreamDurationSeries, + StatisticGetLiveUniqueViewersResponse, + StatisticGetVodWatchTimeTotalCdnResponse, +) +``` + +Methods: + +- client.streaming.statistics.get_ffprobes(\*\*params) -> Ffprobes +- client.streaming.statistics.get_live_unique_viewers(\*\*params) -> StatisticGetLiveUniqueViewersResponse +- client.streaming.statistics.get_live_watch_time_cdn(\*\*params) -> StreamSeries +- client.streaming.statistics.get_live_watch_time_total_cdn(\*\*params) -> VodTotalStreamDurationSeries +- client.streaming.statistics.get_max_streams_series(\*\*params) -> MaxStreamSeries +- client.streaming.statistics.get_meet_series(\*\*params) -> MeetSeries +- client.streaming.statistics.get_popular_videos(\*\*params) -> PopularVideos +- client.streaming.statistics.get_storage_series(\*\*params) -> StorageSeries +- client.streaming.statistics.get_stream_series(\*\*params) -> StreamSeries +- client.streaming.statistics.get_unique_viewers(\*\*params) -> UniqueViewers +- client.streaming.statistics.get_unique_viewers_cdn(\*\*params) -> UniqueViewersCdn +- client.streaming.statistics.get_views(\*\*params) -> Views +- client.streaming.statistics.get_views_by_browsers(\*\*params) -> ViewsByBrowser +- client.streaming.statistics.get_views_by_country(\*\*params) -> ViewsByCountry +- client.streaming.statistics.get_views_by_hostname(\*\*params) -> ViewsByHostname +- client.streaming.statistics.get_views_by_operating_system(\*\*params) -> ViewsByOperatingSystem +- client.streaming.statistics.get_views_by_referer(\*\*params) -> ViewsByReferer +- client.streaming.statistics.get_views_by_region(\*\*params) -> ViewsByRegion +- client.streaming.statistics.get_views_heatmap(\*\*params) -> ViewsHeatmap +- client.streaming.statistics.get_vod_storage_volume(\*\*params) -> VodStatisticsSeries +- client.streaming.statistics.get_vod_transcoding_duration(\*\*params) -> VodStatisticsSeries +- client.streaming.statistics.get_vod_unique_viewers_cdn(\*\*params) -> VodStatisticsSeries +- client.streaming.statistics.get_vod_watch_time_cdn(\*\*params) -> VodStatisticsSeries +- client.streaming.statistics.get_vod_watch_time_total_cdn(\*\*params) -> StatisticGetVodWatchTimeTotalCdnResponse diff --git a/src/gcore/_client.py b/src/gcore/_client.py index c009debf..6cfc9e3b 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -32,6 +32,7 @@ from .resources.waap import waap from .resources.cloud import cloud from .resources.fastedge import fastedge +from .resources.streaming import streaming __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Gcore", "AsyncGcore", "Client", "AsyncClient"] @@ -41,6 +42,7 @@ class Gcore(SyncAPIClient): waap: waap.WaapResource iam: iam.IamResource fastedge: fastedge.FastedgeResource + streaming: streaming.StreamingResource with_raw_response: GcoreWithRawResponse with_streaming_response: GcoreWithStreamedResponse @@ -123,6 +125,7 @@ def __init__( self.waap = waap.WaapResource(self) self.iam = iam.IamResource(self) self.fastedge = fastedge.FastedgeResource(self) + self.streaming = streaming.StreamingResource(self) self.with_raw_response = GcoreWithRawResponse(self) self.with_streaming_response = GcoreWithStreamedResponse(self) @@ -260,6 +263,7 @@ class AsyncGcore(AsyncAPIClient): waap: waap.AsyncWaapResource iam: iam.AsyncIamResource fastedge: fastedge.AsyncFastedgeResource + streaming: streaming.AsyncStreamingResource with_raw_response: AsyncGcoreWithRawResponse with_streaming_response: AsyncGcoreWithStreamedResponse @@ -342,6 +346,7 @@ def __init__( self.waap = waap.AsyncWaapResource(self) self.iam = iam.AsyncIamResource(self) self.fastedge = fastedge.AsyncFastedgeResource(self) + self.streaming = streaming.AsyncStreamingResource(self) self.with_raw_response = AsyncGcoreWithRawResponse(self) self.with_streaming_response = AsyncGcoreWithStreamedResponse(self) @@ -480,6 +485,7 @@ def __init__(self, client: Gcore) -> None: self.waap = waap.WaapResourceWithRawResponse(client.waap) self.iam = iam.IamResourceWithRawResponse(client.iam) self.fastedge = fastedge.FastedgeResourceWithRawResponse(client.fastedge) + self.streaming = streaming.StreamingResourceWithRawResponse(client.streaming) class AsyncGcoreWithRawResponse: @@ -488,6 +494,7 @@ def __init__(self, client: AsyncGcore) -> None: self.waap = waap.AsyncWaapResourceWithRawResponse(client.waap) self.iam = iam.AsyncIamResourceWithRawResponse(client.iam) self.fastedge = fastedge.AsyncFastedgeResourceWithRawResponse(client.fastedge) + self.streaming = streaming.AsyncStreamingResourceWithRawResponse(client.streaming) class GcoreWithStreamedResponse: @@ -496,6 +503,7 @@ def __init__(self, client: Gcore) -> None: self.waap = waap.WaapResourceWithStreamingResponse(client.waap) self.iam = iam.IamResourceWithStreamingResponse(client.iam) self.fastedge = fastedge.FastedgeResourceWithStreamingResponse(client.fastedge) + self.streaming = streaming.StreamingResourceWithStreamingResponse(client.streaming) class AsyncGcoreWithStreamedResponse: @@ -504,6 +512,7 @@ def __init__(self, client: AsyncGcore) -> None: self.waap = waap.AsyncWaapResourceWithStreamingResponse(client.waap) self.iam = iam.AsyncIamResourceWithStreamingResponse(client.iam) self.fastedge = fastedge.AsyncFastedgeResourceWithStreamingResponse(client.fastedge) + self.streaming = streaming.AsyncStreamingResourceWithStreamingResponse(client.streaming) Client = Gcore diff --git a/src/gcore/pagination.py b/src/gcore/pagination.py index 8ade3410..cbc5b3b5 100644 --- a/src/gcore/pagination.py +++ b/src/gcore/pagination.py @@ -1,8 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Generic, TypeVar, Optional +from typing import Any, List, Type, Generic, Mapping, TypeVar, Optional, cast from typing_extensions import override +from httpx import Response + +from ._utils import is_mapping +from ._models import BaseModel from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage __all__ = [ @@ -16,8 +20,14 @@ "AsyncOffsetPageFastedgeTemplates", "SyncOffsetPageFastedgeAppLogs", "AsyncOffsetPageFastedgeAppLogs", + "SyncPageStreamingAI", + "AsyncPageStreamingAI", + "SyncPageStreaming", + "AsyncPageStreaming", ] +_BaseModelT = TypeVar("_BaseModelT", bound=BaseModel) + _T = TypeVar("_T") @@ -319,3 +329,93 @@ def next_page_info(self) -> Optional[PageInfo]: return PageInfo(params={"offset": current_count}) return None + + +class SyncPageStreamingAI(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + results: List[_T] + + @override + def _get_page_items(self) -> List[_T]: + results = self.results + if not results: + return [] + return results + + @override + def next_page_info(self) -> Optional[PageInfo]: + last_page = cast("int | None", self._options.params.get("page")) or 1 + + return PageInfo(params={"page": last_page + 1}) + + +class AsyncPageStreamingAI(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + results: List[_T] + + @override + def _get_page_items(self) -> List[_T]: + results = self.results + if not results: + return [] + return results + + @override + def next_page_info(self) -> Optional[PageInfo]: + last_page = cast("int | None", self._options.params.get("page")) or 1 + + return PageInfo(params={"page": last_page + 1}) + + +class SyncPageStreaming(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + items: List[_T] + + @override + def _get_page_items(self) -> List[_T]: + items = self.items + if not items: + return [] + return items + + @override + def next_page_info(self) -> None: + """ + This page represents a response that isn't actually paginated at the API level + so there will never be a next page. + """ + return None + + @classmethod + def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003 + return cls.construct( + None, + **{ + **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}), + }, + ) + + +class AsyncPageStreaming(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + items: List[_T] + + @override + def _get_page_items(self) -> List[_T]: + items = self.items + if not items: + return [] + return items + + @override + def next_page_info(self) -> None: + """ + This page represents a response that isn't actually paginated at the API level + so there will never be a next page. + """ + return None + + @classmethod + def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003 + return cls.construct( + None, + **{ + **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}), + }, + ) diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py index 49b65806..d9a0d340 100644 --- a/src/gcore/resources/__init__.py +++ b/src/gcore/resources/__init__.py @@ -32,6 +32,14 @@ FastedgeResourceWithStreamingResponse, AsyncFastedgeResourceWithStreamingResponse, ) +from .streaming import ( + StreamingResource, + AsyncStreamingResource, + StreamingResourceWithRawResponse, + AsyncStreamingResourceWithRawResponse, + StreamingResourceWithStreamingResponse, + AsyncStreamingResourceWithStreamingResponse, +) __all__ = [ "CloudResource", @@ -58,4 +66,10 @@ "AsyncFastedgeResourceWithRawResponse", "FastedgeResourceWithStreamingResponse", "AsyncFastedgeResourceWithStreamingResponse", + "StreamingResource", + "AsyncStreamingResource", + "StreamingResourceWithRawResponse", + "AsyncStreamingResourceWithRawResponse", + "StreamingResourceWithStreamingResponse", + "AsyncStreamingResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/streaming/__init__.py b/src/gcore/resources/streaming/__init__.py new file mode 100644 index 00000000..705ade73 --- /dev/null +++ b/src/gcore/resources/streaming/__init__.py @@ -0,0 +1,159 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .videos import ( + VideosResource, + AsyncVideosResource, + VideosResourceWithRawResponse, + AsyncVideosResourceWithRawResponse, + VideosResourceWithStreamingResponse, + AsyncVideosResourceWithStreamingResponse, +) +from .players import ( + PlayersResource, + AsyncPlayersResource, + PlayersResourceWithRawResponse, + AsyncPlayersResourceWithRawResponse, + PlayersResourceWithStreamingResponse, + AsyncPlayersResourceWithStreamingResponse, +) +from .streams import ( + StreamsResource, + AsyncStreamsResource, + StreamsResourceWithRawResponse, + AsyncStreamsResourceWithRawResponse, + StreamsResourceWithStreamingResponse, + AsyncStreamsResourceWithStreamingResponse, +) +from .ai_tasks import ( + AITasksResource, + AsyncAITasksResource, + AITasksResourceWithRawResponse, + AsyncAITasksResourceWithRawResponse, + AITasksResourceWithStreamingResponse, + AsyncAITasksResourceWithStreamingResponse, +) +from .playlists import ( + PlaylistsResource, + AsyncPlaylistsResource, + PlaylistsResourceWithRawResponse, + AsyncPlaylistsResourceWithRawResponse, + PlaylistsResourceWithStreamingResponse, + AsyncPlaylistsResourceWithStreamingResponse, +) +from .restreams import ( + RestreamsResource, + AsyncRestreamsResource, + RestreamsResourceWithRawResponse, + AsyncRestreamsResourceWithRawResponse, + RestreamsResourceWithStreamingResponse, + AsyncRestreamsResourceWithStreamingResponse, +) +from .streaming import ( + StreamingResource, + AsyncStreamingResource, + StreamingResourceWithRawResponse, + AsyncStreamingResourceWithRawResponse, + StreamingResourceWithStreamingResponse, + AsyncStreamingResourceWithStreamingResponse, +) +from .broadcasts import ( + BroadcastsResource, + AsyncBroadcastsResource, + BroadcastsResourceWithRawResponse, + AsyncBroadcastsResourceWithRawResponse, + BroadcastsResourceWithStreamingResponse, + AsyncBroadcastsResourceWithStreamingResponse, +) +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) +from .directories import ( + DirectoriesResource, + AsyncDirectoriesResource, + DirectoriesResourceWithRawResponse, + AsyncDirectoriesResourceWithRawResponse, + DirectoriesResourceWithStreamingResponse, + AsyncDirectoriesResourceWithStreamingResponse, +) +from .quality_sets import ( + QualitySetsResource, + AsyncQualitySetsResource, + QualitySetsResourceWithRawResponse, + AsyncQualitySetsResourceWithRawResponse, + QualitySetsResourceWithStreamingResponse, + AsyncQualitySetsResourceWithStreamingResponse, +) + +__all__ = [ + "AITasksResource", + "AsyncAITasksResource", + "AITasksResourceWithRawResponse", + "AsyncAITasksResourceWithRawResponse", + "AITasksResourceWithStreamingResponse", + "AsyncAITasksResourceWithStreamingResponse", + "BroadcastsResource", + "AsyncBroadcastsResource", + "BroadcastsResourceWithRawResponse", + "AsyncBroadcastsResourceWithRawResponse", + "BroadcastsResourceWithStreamingResponse", + "AsyncBroadcastsResourceWithStreamingResponse", + "DirectoriesResource", + "AsyncDirectoriesResource", + "DirectoriesResourceWithRawResponse", + "AsyncDirectoriesResourceWithRawResponse", + "DirectoriesResourceWithStreamingResponse", + "AsyncDirectoriesResourceWithStreamingResponse", + "PlayersResource", + "AsyncPlayersResource", + "PlayersResourceWithRawResponse", + "AsyncPlayersResourceWithRawResponse", + "PlayersResourceWithStreamingResponse", + "AsyncPlayersResourceWithStreamingResponse", + "QualitySetsResource", + "AsyncQualitySetsResource", + "QualitySetsResourceWithRawResponse", + "AsyncQualitySetsResourceWithRawResponse", + "QualitySetsResourceWithStreamingResponse", + "AsyncQualitySetsResourceWithStreamingResponse", + "PlaylistsResource", + "AsyncPlaylistsResource", + "PlaylistsResourceWithRawResponse", + "AsyncPlaylistsResourceWithRawResponse", + "PlaylistsResourceWithStreamingResponse", + "AsyncPlaylistsResourceWithStreamingResponse", + "VideosResource", + "AsyncVideosResource", + "VideosResourceWithRawResponse", + "AsyncVideosResourceWithRawResponse", + "VideosResourceWithStreamingResponse", + "AsyncVideosResourceWithStreamingResponse", + "StreamsResource", + "AsyncStreamsResource", + "StreamsResourceWithRawResponse", + "AsyncStreamsResourceWithRawResponse", + "StreamsResourceWithStreamingResponse", + "AsyncStreamsResourceWithStreamingResponse", + "RestreamsResource", + "AsyncRestreamsResource", + "RestreamsResourceWithRawResponse", + "AsyncRestreamsResourceWithRawResponse", + "RestreamsResourceWithStreamingResponse", + "AsyncRestreamsResourceWithStreamingResponse", + "StatisticsResource", + "AsyncStatisticsResource", + "StatisticsResourceWithRawResponse", + "AsyncStatisticsResourceWithRawResponse", + "StatisticsResourceWithStreamingResponse", + "AsyncStatisticsResourceWithStreamingResponse", + "StreamingResource", + "AsyncStreamingResource", + "StreamingResourceWithRawResponse", + "AsyncStreamingResourceWithRawResponse", + "StreamingResourceWithStreamingResponse", + "AsyncStreamingResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py new file mode 100644 index 00000000..9b612e98 --- /dev/null +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -0,0 +1,1288 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 ...pagination import SyncPageStreamingAI, AsyncPageStreamingAI +from ..._base_client import AsyncPaginator, make_request_options +from ...types.streaming import ai_task_list_params, ai_task_create_params, ai_task_get_ai_settings_params +from ...types.streaming.ai_task import AITask +from ...types.streaming.ai_task_get_response import AITaskGetResponse +from ...types.streaming.ai_task_cancel_response import AITaskCancelResponse +from ...types.streaming.ai_task_create_response import AITaskCreateResponse +from ...types.streaming.ai_task_get_ai_settings_response import AITaskGetAISettingsResponse + +__all__ = ["AITasksResource", "AsyncAITasksResource"] + + +class AITasksResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AITasksResourceWithRawResponse: + """ + 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 AITasksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AITasksResourceWithStreamingResponse: + """ + 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 AITasksResourceWithStreamingResponse(self) + + def create( + self, + *, + task_name: Literal["transcription", "content-moderation"], + url: str, + audio_language: str | NotGiven = NOT_GIVEN, + category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] + | NotGiven = NOT_GIVEN, + client_entity_data: str | NotGiven = NOT_GIVEN, + client_user_id: str | NotGiven = NOT_GIVEN, + subtitles_language: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AITaskCreateResponse: + """Creating an AI task. + + This method allows you to create an AI task for VOD video + processing: + + - ASR: Transcribe video + - ASR: Translate subtitles + - CM: Sports detection + - CM: Weapon detection + - CM: Not Safe For Work (NSFW) content detection + - CM: Soft nudity detection + - CM: Hard nudity detection + - CM: Child Sexual Abuse Material (CSAM) detection + - CM: Objects recognition (soon) + ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) + How to use: + - Create an AI task, specify algoritm to use + - Get `task_id` + - Check a result using `` .../ai/tasks/{`task_id`} `` method For more detailed + information, see the description of each method separately. + + **AI Automatic Speech Recognition (ASR)** AI is instrumental in automatic video + processing for subtitles creation by using Automatic Speech Recognition (ASR) + technology to transcribe spoken words into text, which can then be translated + into multiple languages for broader accessibility. Categories: + + - `transcription` – to create subtitles/captions from audio in the original + language. + - `translation` – to transate subtitles/captions from the original language to + 99+ other languages. AI subtitle transcription and translation tools are + highly efficient, processing large volumes of audio-visual content quickly and + providing accurate transcriptions and translations with minimal human + intervention. Additionally, AI-driven solutions can significantly reduce costs + and turnaround times compared to traditional methods, making them an + invaluable resource for content creators and broadcasters aiming to reach + global audiences. Example response with positive result: + + ``` + { + "status": "SUCCESS", + "result": { + "subtitles": [ + { + "`start_time`": "00:00:00.031", + "`end_time`": "00:00:03.831", + "text": "Come on team, ..." + }, ... + ] + "vttContent": "WEBVTT\n\n1\n00:00:00.031 --> 00:00:03.831\nCome on team, ...", + "`concatenated_text`": "Come on team, ...", + "languages": [ "eng" ], + "`speech_detected`": true + } + }, ... + } + ``` + + **AI Content Moderation (CM)** The AI Content Moderation API offers a powerful + solution for analyzing video content to detect various categories of + inappropriate material. Leveraging state-of-the-art AI models, this API ensures + real-time analysis and flagging of sensitive or restricted content types, making + it an essential tool for platforms requiring stringent content moderation. + Categories: + + - `nsfw`: Quick algorithm to detect pornographic material, ensuring content is + "not-safe-for-work" or normal. + - `hard_nudity`: Detailed analisys of video which detects explicit nudity + involving genitalia. + - `soft_nudity`: Detailed video analysis that reveals both explicit and partial + nudity, including the presence of male and female faces and other uncovered + body parts. + - `child_pornography`: Detects child sexual abuse materials (CASM). + - `sport`: Recognizes various sporting activities. + - `weapon`: Identifies the presence of weapons in the video content. The AI + Content Moderation API is an invaluable tool for managing and controlling the + type of content being shared or streamed on your platform. By implementing + this API, you can ensure compliance with community guidelines and legal + requirements, as well as provide a safer environment for your users. Important + notes: + - It's allowed to analyse still images too (where applicable). Format of image: + JPEG, PNG. In that case one image is the same as video of 1 second duration. + - Not all frames in the video are used for analysis, but only key frames + (Iframe). For example, if a key frame in a video is set every ±2 seconds, then + detection will only occur at these timestamps. If an object appears and + disappears between these time stamps, it will not be detected. We are working + on a version to analyze more frames, please contact your manager or our + support team to enable this method. Example response with positive result: + + ``` + { + "status": "SUCCESS", + "result": { + "`nsfw_detected`": true, + "`detection_results`": ["nsfw"], + "frames": [{"label": "nsfw", "confidence": 1.0, "`frame_number`": 24}, ...], + }, + } + ``` + + **Additional information** Billing takes into account the duration of the + analyzed video. Or the duration until the stop tag(where applicable), if the + condition was triggered during the analysis. + + The heart of content moderation is AI, with additional services. They run on our + own infrastructure, so the files/data are not transferred anywhere to external + services. After processing, original files are also deleted from local storage + of AI. + + Read more detailed information about our solution, and architecture, and + benefits in the knowledge base and blog. + + Args: + task_name: Name of the task to be performed + + url: URL to the MP4 file to analyse. File must be publicly accessible via HTTP/HTTPS. + + audio_language: Language in original audio (transcription only). This value is used to determine + the language from which to transcribe. If this is not set, the system will run + auto language identification and the subtitles will be in the detected language. + The method also works based on AI analysis. It's fairly accurate, but if it's + wrong, then set the language explicitly. Additionally, when this is not set, we + also support recognition of alternate languages in the video (language + code-switching). Language is set by 3-letter language code according to + ISO-639-2 (bibliographic code). We can process languages: + + - 'afr': Afrikaans + - 'alb': Albanian + - 'amh': Amharic + - 'ara': Arabic + - 'arm': Armenian + - 'asm': Assamese + - 'aze': Azerbaijani + - 'bak': Bashkir + - 'baq': Basque + - 'bel': Belarusian + - 'ben': Bengali + - 'bos': Bosnian + - 'bre': Breton + - 'bul': Bulgarian + - 'bur': Myanmar + - 'cat': Catalan + - 'chi': Chinese + - 'cze': Czech + - 'dan': Danish + - 'dut': Nynorsk + - 'eng': English + - 'est': Estonian + - 'fao': Faroese + - 'fin': Finnish + - 'fre': French + - 'geo': Georgian + - 'ger': German + - 'glg': Galician + - 'gre': Greek + - 'guj': Gujarati + - 'hat': Haitian creole + - 'hau': Hausa + - 'haw': Hawaiian + - 'heb': Hebrew + - 'hin': Hindi + - 'hrv': Croatian + - 'hun': Hungarian + - 'ice': Icelandic + - 'ind': Indonesian + - 'ita': Italian + - 'jav': Javanese + - 'jpn': Japanese + - 'kan': Kannada + - 'kaz': Kazakh + - 'khm': Khmer + - 'kor': Korean + - 'lao': Lao + - 'lat': Latin + - 'lav': Latvian + - 'lin': Lingala + - 'lit': Lithuanian + - 'ltz': Luxembourgish + - 'mac': Macedonian + - 'mal': Malayalam + - 'mao': Maori + - 'mar': Marathi + - 'may': Malay + - 'mlg': Malagasy + - 'mlt': Maltese + - 'mon': Mongolian + - 'nep': Nepali + - 'dut': Dutch + - 'nor': Norwegian + - 'oci': Occitan + - 'pan': Punjabi + - 'per': Persian + - 'pol': Polish + - 'por': Portuguese + - 'pus': Pashto + - 'rum': Romanian + - 'rus': Russian + - 'san': Sanskrit + - 'sin': Sinhala + - 'slo': Slovak + - 'slv': Slovenian + - 'sna': Shona + - 'snd': Sindhi + - 'som': Somali + - 'spa': Spanish + - 'srp': Serbian + - 'sun': Sundanese + - 'swa': Swahili + - 'swe': Swedish + - 'tam': Tamil + - 'tat': Tatar + - 'tel': Telugu + - 'tgk': Tajik + - 'tgl': Tagalog + - 'tha': Thai + - 'tib': Tibetan + - 'tuk': Turkmen + - 'tur': Turkish + - 'ukr': Ukrainian + - 'urd': Urdu + - 'uzb': Uzbek + - 'vie': Vietnamese + - 'wel': Welsh + - 'yid': Yiddish + - 'yor': Yoruba + + category: Model for analysis (content-moderation only). Determines what exactly needs to + be found in the video. + + client_entity_data: Meta parameter, designed to store your own extra information about a video + entity: video source, video id, etc. It is not used in any way in video + processing. For example, if an AI-task was created automatically when you + uploaded a video with the AI auto-processing option (nudity detection, etc), + then the ID of the associated video for which the task was performed will be + explicitly indicated here. + + client_user_id: Meta parameter, designed to store your own identifier. Can be used by you to tag + requests from different end-users. It is not used in any way in video + processing. + + subtitles_language: Indicates which language it is clearly necessary to translate into. If this is + not set, the original language will be used from attribute "`audio_language`". + Please note that: + + - transcription into the original language is a free procedure, + - and translation from the original language into any other languages is a + "translation" procedure and is paid. More details in + [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + Language is set by 3-letter language code according to ISO-639-2 + (bibliographic code). + + 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( + "/streaming/ai/tasks", + body=maybe_transform( + { + "task_name": task_name, + "url": url, + "audio_language": audio_language, + "category": category, + "client_entity_data": client_entity_data, + "client_user_id": client_user_id, + "subtitles_language": subtitles_language, + }, + ai_task_create_params.AITaskCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AITaskCreateResponse, + ) + + def list( + self, + *, + date_created: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + ordering: Literal["task_id", "status", "task_name", "started_at"] | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + search: str | NotGiven = NOT_GIVEN, + status: Literal["FAILURE", "PENDING", "RECEIVED", "RETRY", "REVOKED", "STARTED", "SUCCESS"] + | NotGiven = NOT_GIVEN, + task_id: str | NotGiven = NOT_GIVEN, + task_name: Literal["transcription", "content-moderation"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncPageStreamingAI[AITask]: + """Returns a list of previously created and processed AI tasks. + + The list contains + brief information about the task and its execution status. Data is displayed + page by page. + + Args: + date_created: Time when task was created. Datetime in ISO 8601 format. + + limit: Number of results to return per page. + + ordering: Which field to use when ordering the results: `task_id`, status, and + `task_name`. Sorting is done in ascending (ASC) order. If parameter is omitted + then "`started_at` DESC" is used for ordering by default. + + page: Page to view from task list, starting from 1 + + search: This is an field for combined text search in the following fields: `task_id`, + `task_name`, status, and `task_data`. Both full and partial searches are + possible inside specified above fields. For example, you can filter tasks of a + certain category, or tasks by a specific original file. Example: + + - To filter tasks of Content Moderation NSFW method: + `GET /streaming/ai/tasks?search=nsfw` + - To filter tasks of processing video from a specific origin: + `GET /streaming/ai/tasks?search=s3.eu-west-1.amazonaws.com` + + status: Task status + + task_id: The task unique identifier to fiund + + task_name: Type of the AI task. Reflects the original API method that was used to create + the AI task. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/ai/tasks", + page=SyncPageStreamingAI[AITask], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_created": date_created, + "limit": limit, + "ordering": ordering, + "page": page, + "search": search, + "status": status, + "task_id": task_id, + "task_name": task_name, + }, + ai_task_list_params.AITaskListParams, + ), + ), + model=AITask, + ) + + def cancel( + self, + task_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AITaskCancelResponse: + """ + Stopping a previously launched AI-task without waiting for it to be fully + completed. The task will be moved to "REVOKED" status. + + 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 task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return self._post( + f"/streaming/ai/tasks/{task_id}/cancel", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AITaskCancelResponse, + ) + + def get( + self, + task_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AITaskGetResponse: + """ + This is the single method to check the execution status of an AI task, and + obtain the result of any type of AI task. Based on the results of processing, + the “result” field will contain an answer corresponding to the type of the + initially created task: + + - ASR: Transcribe video + - ASR: Translate subtitles + - CM: Sports detection + - CM: Weapon detection + - CM: Not Safe For Work (NSFW) content detection + - CM: Soft nudity detection + - CM: Hard nudity detection + - CM: Child Sexual Abuse Material (CSAM) detection + - CM: Objects recognition (soon) + - etc... (see other methods from /ai/ domain) + + A queue is used to process videos. The waiting time depends on the total number + of requests in the system, so sometimes you will have to wait. Statuses: + + - PENDING – the task is received and it is pending for available resources + - STARTED – processing has started + - SUCCESS – processing has completed successfully + - FAILURE – processing failed + - REVOKED – processing was cancelled by the user (or the system) + - RETRY – the task execution failed due to internal reasons, the task is queued + for re-execution (up to 3 times) Each task is processed in sub-stages, for + example, original language is first determined in a video, and then + transcription is performed. In such cases, the video processing status may + change from "STARTED" to "PENDING", and back. This is due to waiting for + resources for a specific processing sub-stage. In this case, the overall + percentage "progress" of video processing will reflect the full picture. + + The result data is stored for 1 month, after which it is deleted. + + For billing conditions see the corresponding methods in /ai/ domain. The task is + billed only after successful completion of the task and transition to "SUCCESS" + status. + + 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 task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return self._get( + f"/streaming/ai/tasks/{task_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AITaskGetResponse, + ) + + def get_ai_settings( + self, + *, + type: Literal["language_support"], + audio_language: str | NotGiven = NOT_GIVEN, + subtitles_language: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AITaskGetAISettingsResponse: + """ + The method for revealing basic information and advanced underlying settings that + are used when performing AI-tasks. + + Parameter sections: + + - "`language_support`" – AI Translation: check if a language pair is supported + or not for AI translation. + - this list will expand as new AI methods are added. + + **`language_support`** There are many languages available for transcription. But + not all languages can be automatically translated to and from with good quality. + In order to determine the availability of translation from the audio language to + the desired subtitle language, you can use this type of "`language_support`". AI + models are constantly improving, so this method can be used for dynamic + determination. Example: + + ``` + curl -L 'https://api.gcore.com/streaming/ai/info?type=`language_support`&`audio_language`=eng&`subtitles_language`=fre' + { "supported": true } + ``` + + Today we provide the following capabilities as below. These are the 100 + languages for which we support only transcription and translation to English. + The iso639-2b codes for these are: + `afr, sqi, amh, ara, hye, asm, aze, bak, eus, bel, ben, bos, bre, bul, mya, cat, zho, hrv, ces, dan, nld, eng, est, fao, fin, fra, glg, kat, deu, guj, hat, hau, haw, heb, hin, hun, isl, ind, ita, jpn, jav, kan, kaz, khm, kor, lao, lat, lav, lin, lit, ltz, mkd, mlg, msa, mal, mlt, mri, mar, ell, mon, nep, nor, nno, oci, pan, fas, pol, por, pus, ron, rus, san, srp, sna, snd, sin, slk, slv, som, spa, sun, swa, swe, tgl, tgk, tam, tat, tel, tha, bod, tur, tuk, ukr, urd, uzb, vie, cym, yid, yor`. + These are the 77 languages for which we support translation to other languages + and translation to: + `afr, amh, ara, hye, asm, aze, eus, bel, ben, bos, bul, mya, cat, zho, hrv, ces, dan, nld, eng, est, fin, fra, glg, kat, deu, guj, heb, hin, hun, isl, ind, ita, jpn, jav, kan, kaz, khm, kor, lao, lav, lit, mkd, mal, mlt, mar, ell, mon, nep, nno, pan, fas, pol, por, pus, ron, rus, srp, sna, snd, slk, slv, som, spa, swa, swe, tgl, tgk, tam, tel, tha, tur, ukr, urd, vie, cym, yor`. + + Args: + type: The parameters section for which parameters are requested + + audio_language: The source language from which the audio will be transcribed. Required when + `type=language_support`. Value is 3-letter language code according to ISO-639-2 + (bibliographic code), (e.g., fre for French). + + subtitles_language: The target language the text will be translated into. If omitted, the API will + return whether the `audio_language` is supported for transcription only, instead + of translation. Value is 3-letter language code according to ISO-639-2 + (bibliographic code), (e.g., fre for French). + + 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( + "/streaming/ai/info", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "type": type, + "audio_language": audio_language, + "subtitles_language": subtitles_language, + }, + ai_task_get_ai_settings_params.AITaskGetAISettingsParams, + ), + ), + cast_to=AITaskGetAISettingsResponse, + ) + + +class AsyncAITasksResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAITasksResourceWithRawResponse: + """ + 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 AsyncAITasksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAITasksResourceWithStreamingResponse: + """ + 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 AsyncAITasksResourceWithStreamingResponse(self) + + async def create( + self, + *, + task_name: Literal["transcription", "content-moderation"], + url: str, + audio_language: str | NotGiven = NOT_GIVEN, + category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] + | NotGiven = NOT_GIVEN, + client_entity_data: str | NotGiven = NOT_GIVEN, + client_user_id: str | NotGiven = NOT_GIVEN, + subtitles_language: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AITaskCreateResponse: + """Creating an AI task. + + This method allows you to create an AI task for VOD video + processing: + + - ASR: Transcribe video + - ASR: Translate subtitles + - CM: Sports detection + - CM: Weapon detection + - CM: Not Safe For Work (NSFW) content detection + - CM: Soft nudity detection + - CM: Hard nudity detection + - CM: Child Sexual Abuse Material (CSAM) detection + - CM: Objects recognition (soon) + ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) + How to use: + - Create an AI task, specify algoritm to use + - Get `task_id` + - Check a result using `` .../ai/tasks/{`task_id`} `` method For more detailed + information, see the description of each method separately. + + **AI Automatic Speech Recognition (ASR)** AI is instrumental in automatic video + processing for subtitles creation by using Automatic Speech Recognition (ASR) + technology to transcribe spoken words into text, which can then be translated + into multiple languages for broader accessibility. Categories: + + - `transcription` – to create subtitles/captions from audio in the original + language. + - `translation` – to transate subtitles/captions from the original language to + 99+ other languages. AI subtitle transcription and translation tools are + highly efficient, processing large volumes of audio-visual content quickly and + providing accurate transcriptions and translations with minimal human + intervention. Additionally, AI-driven solutions can significantly reduce costs + and turnaround times compared to traditional methods, making them an + invaluable resource for content creators and broadcasters aiming to reach + global audiences. Example response with positive result: + + ``` + { + "status": "SUCCESS", + "result": { + "subtitles": [ + { + "`start_time`": "00:00:00.031", + "`end_time`": "00:00:03.831", + "text": "Come on team, ..." + }, ... + ] + "vttContent": "WEBVTT\n\n1\n00:00:00.031 --> 00:00:03.831\nCome on team, ...", + "`concatenated_text`": "Come on team, ...", + "languages": [ "eng" ], + "`speech_detected`": true + } + }, ... + } + ``` + + **AI Content Moderation (CM)** The AI Content Moderation API offers a powerful + solution for analyzing video content to detect various categories of + inappropriate material. Leveraging state-of-the-art AI models, this API ensures + real-time analysis and flagging of sensitive or restricted content types, making + it an essential tool for platforms requiring stringent content moderation. + Categories: + + - `nsfw`: Quick algorithm to detect pornographic material, ensuring content is + "not-safe-for-work" or normal. + - `hard_nudity`: Detailed analisys of video which detects explicit nudity + involving genitalia. + - `soft_nudity`: Detailed video analysis that reveals both explicit and partial + nudity, including the presence of male and female faces and other uncovered + body parts. + - `child_pornography`: Detects child sexual abuse materials (CASM). + - `sport`: Recognizes various sporting activities. + - `weapon`: Identifies the presence of weapons in the video content. The AI + Content Moderation API is an invaluable tool for managing and controlling the + type of content being shared or streamed on your platform. By implementing + this API, you can ensure compliance with community guidelines and legal + requirements, as well as provide a safer environment for your users. Important + notes: + - It's allowed to analyse still images too (where applicable). Format of image: + JPEG, PNG. In that case one image is the same as video of 1 second duration. + - Not all frames in the video are used for analysis, but only key frames + (Iframe). For example, if a key frame in a video is set every ±2 seconds, then + detection will only occur at these timestamps. If an object appears and + disappears between these time stamps, it will not be detected. We are working + on a version to analyze more frames, please contact your manager or our + support team to enable this method. Example response with positive result: + + ``` + { + "status": "SUCCESS", + "result": { + "`nsfw_detected`": true, + "`detection_results`": ["nsfw"], + "frames": [{"label": "nsfw", "confidence": 1.0, "`frame_number`": 24}, ...], + }, + } + ``` + + **Additional information** Billing takes into account the duration of the + analyzed video. Or the duration until the stop tag(where applicable), if the + condition was triggered during the analysis. + + The heart of content moderation is AI, with additional services. They run on our + own infrastructure, so the files/data are not transferred anywhere to external + services. After processing, original files are also deleted from local storage + of AI. + + Read more detailed information about our solution, and architecture, and + benefits in the knowledge base and blog. + + Args: + task_name: Name of the task to be performed + + url: URL to the MP4 file to analyse. File must be publicly accessible via HTTP/HTTPS. + + audio_language: Language in original audio (transcription only). This value is used to determine + the language from which to transcribe. If this is not set, the system will run + auto language identification and the subtitles will be in the detected language. + The method also works based on AI analysis. It's fairly accurate, but if it's + wrong, then set the language explicitly. Additionally, when this is not set, we + also support recognition of alternate languages in the video (language + code-switching). Language is set by 3-letter language code according to + ISO-639-2 (bibliographic code). We can process languages: + + - 'afr': Afrikaans + - 'alb': Albanian + - 'amh': Amharic + - 'ara': Arabic + - 'arm': Armenian + - 'asm': Assamese + - 'aze': Azerbaijani + - 'bak': Bashkir + - 'baq': Basque + - 'bel': Belarusian + - 'ben': Bengali + - 'bos': Bosnian + - 'bre': Breton + - 'bul': Bulgarian + - 'bur': Myanmar + - 'cat': Catalan + - 'chi': Chinese + - 'cze': Czech + - 'dan': Danish + - 'dut': Nynorsk + - 'eng': English + - 'est': Estonian + - 'fao': Faroese + - 'fin': Finnish + - 'fre': French + - 'geo': Georgian + - 'ger': German + - 'glg': Galician + - 'gre': Greek + - 'guj': Gujarati + - 'hat': Haitian creole + - 'hau': Hausa + - 'haw': Hawaiian + - 'heb': Hebrew + - 'hin': Hindi + - 'hrv': Croatian + - 'hun': Hungarian + - 'ice': Icelandic + - 'ind': Indonesian + - 'ita': Italian + - 'jav': Javanese + - 'jpn': Japanese + - 'kan': Kannada + - 'kaz': Kazakh + - 'khm': Khmer + - 'kor': Korean + - 'lao': Lao + - 'lat': Latin + - 'lav': Latvian + - 'lin': Lingala + - 'lit': Lithuanian + - 'ltz': Luxembourgish + - 'mac': Macedonian + - 'mal': Malayalam + - 'mao': Maori + - 'mar': Marathi + - 'may': Malay + - 'mlg': Malagasy + - 'mlt': Maltese + - 'mon': Mongolian + - 'nep': Nepali + - 'dut': Dutch + - 'nor': Norwegian + - 'oci': Occitan + - 'pan': Punjabi + - 'per': Persian + - 'pol': Polish + - 'por': Portuguese + - 'pus': Pashto + - 'rum': Romanian + - 'rus': Russian + - 'san': Sanskrit + - 'sin': Sinhala + - 'slo': Slovak + - 'slv': Slovenian + - 'sna': Shona + - 'snd': Sindhi + - 'som': Somali + - 'spa': Spanish + - 'srp': Serbian + - 'sun': Sundanese + - 'swa': Swahili + - 'swe': Swedish + - 'tam': Tamil + - 'tat': Tatar + - 'tel': Telugu + - 'tgk': Tajik + - 'tgl': Tagalog + - 'tha': Thai + - 'tib': Tibetan + - 'tuk': Turkmen + - 'tur': Turkish + - 'ukr': Ukrainian + - 'urd': Urdu + - 'uzb': Uzbek + - 'vie': Vietnamese + - 'wel': Welsh + - 'yid': Yiddish + - 'yor': Yoruba + + category: Model for analysis (content-moderation only). Determines what exactly needs to + be found in the video. + + client_entity_data: Meta parameter, designed to store your own extra information about a video + entity: video source, video id, etc. It is not used in any way in video + processing. For example, if an AI-task was created automatically when you + uploaded a video with the AI auto-processing option (nudity detection, etc), + then the ID of the associated video for which the task was performed will be + explicitly indicated here. + + client_user_id: Meta parameter, designed to store your own identifier. Can be used by you to tag + requests from different end-users. It is not used in any way in video + processing. + + subtitles_language: Indicates which language it is clearly necessary to translate into. If this is + not set, the original language will be used from attribute "`audio_language`". + Please note that: + + - transcription into the original language is a free procedure, + - and translation from the original language into any other languages is a + "translation" procedure and is paid. More details in + [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + Language is set by 3-letter language code according to ISO-639-2 + (bibliographic code). + + 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( + "/streaming/ai/tasks", + body=await async_maybe_transform( + { + "task_name": task_name, + "url": url, + "audio_language": audio_language, + "category": category, + "client_entity_data": client_entity_data, + "client_user_id": client_user_id, + "subtitles_language": subtitles_language, + }, + ai_task_create_params.AITaskCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AITaskCreateResponse, + ) + + def list( + self, + *, + date_created: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + ordering: Literal["task_id", "status", "task_name", "started_at"] | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + search: str | NotGiven = NOT_GIVEN, + status: Literal["FAILURE", "PENDING", "RECEIVED", "RETRY", "REVOKED", "STARTED", "SUCCESS"] + | NotGiven = NOT_GIVEN, + task_id: str | NotGiven = NOT_GIVEN, + task_name: Literal["transcription", "content-moderation"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[AITask, AsyncPageStreamingAI[AITask]]: + """Returns a list of previously created and processed AI tasks. + + The list contains + brief information about the task and its execution status. Data is displayed + page by page. + + Args: + date_created: Time when task was created. Datetime in ISO 8601 format. + + limit: Number of results to return per page. + + ordering: Which field to use when ordering the results: `task_id`, status, and + `task_name`. Sorting is done in ascending (ASC) order. If parameter is omitted + then "`started_at` DESC" is used for ordering by default. + + page: Page to view from task list, starting from 1 + + search: This is an field for combined text search in the following fields: `task_id`, + `task_name`, status, and `task_data`. Both full and partial searches are + possible inside specified above fields. For example, you can filter tasks of a + certain category, or tasks by a specific original file. Example: + + - To filter tasks of Content Moderation NSFW method: + `GET /streaming/ai/tasks?search=nsfw` + - To filter tasks of processing video from a specific origin: + `GET /streaming/ai/tasks?search=s3.eu-west-1.amazonaws.com` + + status: Task status + + task_id: The task unique identifier to fiund + + task_name: Type of the AI task. Reflects the original API method that was used to create + the AI task. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/ai/tasks", + page=AsyncPageStreamingAI[AITask], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_created": date_created, + "limit": limit, + "ordering": ordering, + "page": page, + "search": search, + "status": status, + "task_id": task_id, + "task_name": task_name, + }, + ai_task_list_params.AITaskListParams, + ), + ), + model=AITask, + ) + + async def cancel( + self, + task_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AITaskCancelResponse: + """ + Stopping a previously launched AI-task without waiting for it to be fully + completed. The task will be moved to "REVOKED" status. + + 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 task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return await self._post( + f"/streaming/ai/tasks/{task_id}/cancel", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AITaskCancelResponse, + ) + + async def get( + self, + task_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AITaskGetResponse: + """ + This is the single method to check the execution status of an AI task, and + obtain the result of any type of AI task. Based on the results of processing, + the “result” field will contain an answer corresponding to the type of the + initially created task: + + - ASR: Transcribe video + - ASR: Translate subtitles + - CM: Sports detection + - CM: Weapon detection + - CM: Not Safe For Work (NSFW) content detection + - CM: Soft nudity detection + - CM: Hard nudity detection + - CM: Child Sexual Abuse Material (CSAM) detection + - CM: Objects recognition (soon) + - etc... (see other methods from /ai/ domain) + + A queue is used to process videos. The waiting time depends on the total number + of requests in the system, so sometimes you will have to wait. Statuses: + + - PENDING – the task is received and it is pending for available resources + - STARTED – processing has started + - SUCCESS – processing has completed successfully + - FAILURE – processing failed + - REVOKED – processing was cancelled by the user (or the system) + - RETRY – the task execution failed due to internal reasons, the task is queued + for re-execution (up to 3 times) Each task is processed in sub-stages, for + example, original language is first determined in a video, and then + transcription is performed. In such cases, the video processing status may + change from "STARTED" to "PENDING", and back. This is due to waiting for + resources for a specific processing sub-stage. In this case, the overall + percentage "progress" of video processing will reflect the full picture. + + The result data is stored for 1 month, after which it is deleted. + + For billing conditions see the corresponding methods in /ai/ domain. The task is + billed only after successful completion of the task and transition to "SUCCESS" + status. + + 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 task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return await self._get( + f"/streaming/ai/tasks/{task_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AITaskGetResponse, + ) + + async def get_ai_settings( + self, + *, + type: Literal["language_support"], + audio_language: str | NotGiven = NOT_GIVEN, + subtitles_language: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AITaskGetAISettingsResponse: + """ + The method for revealing basic information and advanced underlying settings that + are used when performing AI-tasks. + + Parameter sections: + + - "`language_support`" – AI Translation: check if a language pair is supported + or not for AI translation. + - this list will expand as new AI methods are added. + + **`language_support`** There are many languages available for transcription. But + not all languages can be automatically translated to and from with good quality. + In order to determine the availability of translation from the audio language to + the desired subtitle language, you can use this type of "`language_support`". AI + models are constantly improving, so this method can be used for dynamic + determination. Example: + + ``` + curl -L 'https://api.gcore.com/streaming/ai/info?type=`language_support`&`audio_language`=eng&`subtitles_language`=fre' + { "supported": true } + ``` + + Today we provide the following capabilities as below. These are the 100 + languages for which we support only transcription and translation to English. + The iso639-2b codes for these are: + `afr, sqi, amh, ara, hye, asm, aze, bak, eus, bel, ben, bos, bre, bul, mya, cat, zho, hrv, ces, dan, nld, eng, est, fao, fin, fra, glg, kat, deu, guj, hat, hau, haw, heb, hin, hun, isl, ind, ita, jpn, jav, kan, kaz, khm, kor, lao, lat, lav, lin, lit, ltz, mkd, mlg, msa, mal, mlt, mri, mar, ell, mon, nep, nor, nno, oci, pan, fas, pol, por, pus, ron, rus, san, srp, sna, snd, sin, slk, slv, som, spa, sun, swa, swe, tgl, tgk, tam, tat, tel, tha, bod, tur, tuk, ukr, urd, uzb, vie, cym, yid, yor`. + These are the 77 languages for which we support translation to other languages + and translation to: + `afr, amh, ara, hye, asm, aze, eus, bel, ben, bos, bul, mya, cat, zho, hrv, ces, dan, nld, eng, est, fin, fra, glg, kat, deu, guj, heb, hin, hun, isl, ind, ita, jpn, jav, kan, kaz, khm, kor, lao, lav, lit, mkd, mal, mlt, mar, ell, mon, nep, nno, pan, fas, pol, por, pus, ron, rus, srp, sna, snd, slk, slv, som, spa, swa, swe, tgl, tgk, tam, tel, tha, tur, ukr, urd, vie, cym, yor`. + + Args: + type: The parameters section for which parameters are requested + + audio_language: The source language from which the audio will be transcribed. Required when + `type=language_support`. Value is 3-letter language code according to ISO-639-2 + (bibliographic code), (e.g., fre for French). + + subtitles_language: The target language the text will be translated into. If omitted, the API will + return whether the `audio_language` is supported for transcription only, instead + of translation. Value is 3-letter language code according to ISO-639-2 + (bibliographic code), (e.g., fre for French). + + 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( + "/streaming/ai/info", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "type": type, + "audio_language": audio_language, + "subtitles_language": subtitles_language, + }, + ai_task_get_ai_settings_params.AITaskGetAISettingsParams, + ), + ), + cast_to=AITaskGetAISettingsResponse, + ) + + +class AITasksResourceWithRawResponse: + def __init__(self, ai_tasks: AITasksResource) -> None: + self._ai_tasks = ai_tasks + + self.create = to_raw_response_wrapper( + ai_tasks.create, + ) + self.list = to_raw_response_wrapper( + ai_tasks.list, + ) + self.cancel = to_raw_response_wrapper( + ai_tasks.cancel, + ) + self.get = to_raw_response_wrapper( + ai_tasks.get, + ) + self.get_ai_settings = to_raw_response_wrapper( + ai_tasks.get_ai_settings, + ) + + +class AsyncAITasksResourceWithRawResponse: + def __init__(self, ai_tasks: AsyncAITasksResource) -> None: + self._ai_tasks = ai_tasks + + self.create = async_to_raw_response_wrapper( + ai_tasks.create, + ) + self.list = async_to_raw_response_wrapper( + ai_tasks.list, + ) + self.cancel = async_to_raw_response_wrapper( + ai_tasks.cancel, + ) + self.get = async_to_raw_response_wrapper( + ai_tasks.get, + ) + self.get_ai_settings = async_to_raw_response_wrapper( + ai_tasks.get_ai_settings, + ) + + +class AITasksResourceWithStreamingResponse: + def __init__(self, ai_tasks: AITasksResource) -> None: + self._ai_tasks = ai_tasks + + self.create = to_streamed_response_wrapper( + ai_tasks.create, + ) + self.list = to_streamed_response_wrapper( + ai_tasks.list, + ) + self.cancel = to_streamed_response_wrapper( + ai_tasks.cancel, + ) + self.get = to_streamed_response_wrapper( + ai_tasks.get, + ) + self.get_ai_settings = to_streamed_response_wrapper( + ai_tasks.get_ai_settings, + ) + + +class AsyncAITasksResourceWithStreamingResponse: + def __init__(self, ai_tasks: AsyncAITasksResource) -> None: + self._ai_tasks = ai_tasks + + self.create = async_to_streamed_response_wrapper( + ai_tasks.create, + ) + self.list = async_to_streamed_response_wrapper( + ai_tasks.list, + ) + self.cancel = async_to_streamed_response_wrapper( + ai_tasks.cancel, + ) + self.get = async_to_streamed_response_wrapper( + ai_tasks.get, + ) + self.get_ai_settings = async_to_streamed_response_wrapper( + ai_tasks.get_ai_settings, + ) diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py new file mode 100644 index 00000000..d8ef434b --- /dev/null +++ b/src/gcore/resources/streaming/broadcasts.py @@ -0,0 +1,579 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ...pagination import SyncPageStreaming, AsyncPageStreaming +from ..._base_client import AsyncPaginator, make_request_options +from ...types.streaming import broadcast_list_params, broadcast_create_params, broadcast_update_params +from ...types.streaming.broadcast import Broadcast +from ...types.streaming.broadcast_spectators_count import BroadcastSpectatorsCount + +__all__ = ["BroadcastsResource", "AsyncBroadcastsResource"] + + +class BroadcastsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> BroadcastsResourceWithRawResponse: + """ + 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 BroadcastsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BroadcastsResourceWithStreamingResponse: + """ + 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 BroadcastsResourceWithStreamingResponse(self) + + def create( + self, + *, + broadcast: broadcast_create_params.Broadcast | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Broadcast entity is for setting up HTML video player, which serves to combine: + + - many live streams, + - advertising, + - and design in one config. If you use other players or you get streams by + direct .m3u8/.mpd links, then you will not need this entity. + + Scheme of "broadcast" entity using: + ![Scheme of "broadcast" using](https://demo-files.gvideo.io/apidocs/broadcasts.png) + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + "/streaming/broadcasts", + body=maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def update( + self, + broadcast_id: int, + *, + broadcast: broadcast_update_params.Broadcast | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Broadcast: + """ + Updates broadcast settings + + 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._patch( + f"/streaming/broadcasts/{broadcast_id}", + body=maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Broadcast, + ) + + def list( + self, + *, + page: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncPageStreaming[Broadcast]: + """ + Note: Feature "Broadcast" is outdated, soon it will be replaced by + "Multicamera". + + Returns a list of broadcasts. Please see description in POST method. + + Args: + page: Query parameter. Use it to list the paginated content + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/broadcasts", + page=SyncPageStreaming[Broadcast], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"page": page}, broadcast_list_params.BroadcastListParams), + ), + model=Broadcast, + ) + + def delete( + self, + broadcast_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete broadcast + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/streaming/broadcasts/{broadcast_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + broadcast_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, + ) -> Broadcast: + """ + Returns broadcast details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/streaming/broadcasts/{broadcast_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Broadcast, + ) + + def get_spectators_count( + self, + broadcast_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, + ) -> BroadcastSpectatorsCount: + """ + Returns number of simultaneous broadcast viewers at the current moment + + 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"/streaming/broadcasts/{broadcast_id}/spectators", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BroadcastSpectatorsCount, + ) + + +class AsyncBroadcastsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncBroadcastsResourceWithRawResponse: + """ + 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 AsyncBroadcastsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBroadcastsResourceWithStreamingResponse: + """ + 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 AsyncBroadcastsResourceWithStreamingResponse(self) + + async def create( + self, + *, + broadcast: broadcast_create_params.Broadcast | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Broadcast entity is for setting up HTML video player, which serves to combine: + + - many live streams, + - advertising, + - and design in one config. If you use other players or you get streams by + direct .m3u8/.mpd links, then you will not need this entity. + + Scheme of "broadcast" entity using: + ![Scheme of "broadcast" using](https://demo-files.gvideo.io/apidocs/broadcasts.png) + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + "/streaming/broadcasts", + body=await async_maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def update( + self, + broadcast_id: int, + *, + broadcast: broadcast_update_params.Broadcast | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Broadcast: + """ + Updates broadcast settings + + 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._patch( + f"/streaming/broadcasts/{broadcast_id}", + body=await async_maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Broadcast, + ) + + def list( + self, + *, + page: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Broadcast, AsyncPageStreaming[Broadcast]]: + """ + Note: Feature "Broadcast" is outdated, soon it will be replaced by + "Multicamera". + + Returns a list of broadcasts. Please see description in POST method. + + Args: + page: Query parameter. Use it to list the paginated content + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/broadcasts", + page=AsyncPageStreaming[Broadcast], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"page": page}, broadcast_list_params.BroadcastListParams), + ), + model=Broadcast, + ) + + async def delete( + self, + broadcast_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete broadcast + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/streaming/broadcasts/{broadcast_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + broadcast_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, + ) -> Broadcast: + """ + Returns broadcast details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/streaming/broadcasts/{broadcast_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Broadcast, + ) + + async def get_spectators_count( + self, + broadcast_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, + ) -> BroadcastSpectatorsCount: + """ + Returns number of simultaneous broadcast viewers at the current moment + + 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"/streaming/broadcasts/{broadcast_id}/spectators", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BroadcastSpectatorsCount, + ) + + +class BroadcastsResourceWithRawResponse: + def __init__(self, broadcasts: BroadcastsResource) -> None: + self._broadcasts = broadcasts + + self.create = to_raw_response_wrapper( + broadcasts.create, + ) + self.update = to_raw_response_wrapper( + broadcasts.update, + ) + self.list = to_raw_response_wrapper( + broadcasts.list, + ) + self.delete = to_raw_response_wrapper( + broadcasts.delete, + ) + self.get = to_raw_response_wrapper( + broadcasts.get, + ) + self.get_spectators_count = to_raw_response_wrapper( + broadcasts.get_spectators_count, + ) + + +class AsyncBroadcastsResourceWithRawResponse: + def __init__(self, broadcasts: AsyncBroadcastsResource) -> None: + self._broadcasts = broadcasts + + self.create = async_to_raw_response_wrapper( + broadcasts.create, + ) + self.update = async_to_raw_response_wrapper( + broadcasts.update, + ) + self.list = async_to_raw_response_wrapper( + broadcasts.list, + ) + self.delete = async_to_raw_response_wrapper( + broadcasts.delete, + ) + self.get = async_to_raw_response_wrapper( + broadcasts.get, + ) + self.get_spectators_count = async_to_raw_response_wrapper( + broadcasts.get_spectators_count, + ) + + +class BroadcastsResourceWithStreamingResponse: + def __init__(self, broadcasts: BroadcastsResource) -> None: + self._broadcasts = broadcasts + + self.create = to_streamed_response_wrapper( + broadcasts.create, + ) + self.update = to_streamed_response_wrapper( + broadcasts.update, + ) + self.list = to_streamed_response_wrapper( + broadcasts.list, + ) + self.delete = to_streamed_response_wrapper( + broadcasts.delete, + ) + self.get = to_streamed_response_wrapper( + broadcasts.get, + ) + self.get_spectators_count = to_streamed_response_wrapper( + broadcasts.get_spectators_count, + ) + + +class AsyncBroadcastsResourceWithStreamingResponse: + def __init__(self, broadcasts: AsyncBroadcastsResource) -> None: + self._broadcasts = broadcasts + + self.create = async_to_streamed_response_wrapper( + broadcasts.create, + ) + self.update = async_to_streamed_response_wrapper( + broadcasts.update, + ) + self.list = async_to_streamed_response_wrapper( + broadcasts.list, + ) + self.delete = async_to_streamed_response_wrapper( + broadcasts.delete, + ) + self.get = async_to_streamed_response_wrapper( + broadcasts.get, + ) + self.get_spectators_count = async_to_streamed_response_wrapper( + broadcasts.get_spectators_count, + ) diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py new file mode 100644 index 00000000..438d9de8 --- /dev/null +++ b/src/gcore/resources/streaming/directories.py @@ -0,0 +1,515 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.streaming import directory_create_params, directory_update_params +from ...types.streaming.directory_base import DirectoryBase +from ...types.streaming.directories_tree import DirectoriesTree +from ...types.streaming.directory_get_response import DirectoryGetResponse + +__all__ = ["DirectoriesResource", "AsyncDirectoriesResource"] + + +class DirectoriesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> DirectoriesResourceWithRawResponse: + """ + 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 DirectoriesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DirectoriesResourceWithStreamingResponse: + """ + 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 DirectoriesResourceWithStreamingResponse(self) + + def create( + self, + *, + name: str, + parent_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DirectoryBase: + """ + Use this method to create a new directory entity. + + Args: + name: Title of the directory. + + parent_id: ID of a parent directory. "null" if it's in the root. + + 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( + "/streaming/directories", + body=maybe_transform( + { + "name": name, + "parent_id": parent_id, + }, + directory_create_params.DirectoryCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DirectoryBase, + ) + + def update( + self, + directory_id: int, + *, + name: str | NotGiven = NOT_GIVEN, + parent_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DirectoryBase: + """ + Change a directory name or move to another "`parent_id`". + + Args: + name: Title of the directory. Omit this if you don't want to change. + + parent_id: ID of a parent directory. "null" if it's in the root. Omit this if you don't + want to change. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/streaming/directories/{directory_id}", + body=maybe_transform( + { + "name": name, + "parent_id": parent_id, + }, + directory_update_params.DirectoryUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DirectoryBase, + ) + + def delete( + self, + directory_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a directory **and all entities inside**. + + After its execution, all contents of the directory will be deleted recursively: + + - Subdirectories + - Videos The directory and contents are deleted permanently and irreversibly. + Therefore, it is impossible to restore files after this. For details, see the + Product Documentation. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/streaming/directories/{directory_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + directory_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, + ) -> DirectoryGetResponse: + """Complete directory structure with contents. + + The structure contains both + subfolders and videos in a continuous list. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/streaming/directories/{directory_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DirectoryGetResponse, + ) + + def get_tree( + 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, + ) -> DirectoriesTree: + """Tree structure of directories. + + This endpoint returns hierarchical data about + directories in video hosting. + """ + return self._get( + "/streaming/directories/tree", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DirectoriesTree, + ) + + +class AsyncDirectoriesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncDirectoriesResourceWithRawResponse: + """ + 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 AsyncDirectoriesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDirectoriesResourceWithStreamingResponse: + """ + 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 AsyncDirectoriesResourceWithStreamingResponse(self) + + async def create( + self, + *, + name: str, + parent_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DirectoryBase: + """ + Use this method to create a new directory entity. + + Args: + name: Title of the directory. + + parent_id: ID of a parent directory. "null" if it's in the root. + + 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( + "/streaming/directories", + body=await async_maybe_transform( + { + "name": name, + "parent_id": parent_id, + }, + directory_create_params.DirectoryCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DirectoryBase, + ) + + async def update( + self, + directory_id: int, + *, + name: str | NotGiven = NOT_GIVEN, + parent_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DirectoryBase: + """ + Change a directory name or move to another "`parent_id`". + + Args: + name: Title of the directory. Omit this if you don't want to change. + + parent_id: ID of a parent directory. "null" if it's in the root. Omit this if you don't + want to change. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/streaming/directories/{directory_id}", + body=await async_maybe_transform( + { + "name": name, + "parent_id": parent_id, + }, + directory_update_params.DirectoryUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DirectoryBase, + ) + + async def delete( + self, + directory_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a directory **and all entities inside**. + + After its execution, all contents of the directory will be deleted recursively: + + - Subdirectories + - Videos The directory and contents are deleted permanently and irreversibly. + Therefore, it is impossible to restore files after this. For details, see the + Product Documentation. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/streaming/directories/{directory_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + directory_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, + ) -> DirectoryGetResponse: + """Complete directory structure with contents. + + The structure contains both + subfolders and videos in a continuous list. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/streaming/directories/{directory_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DirectoryGetResponse, + ) + + async def get_tree( + 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, + ) -> DirectoriesTree: + """Tree structure of directories. + + This endpoint returns hierarchical data about + directories in video hosting. + """ + return await self._get( + "/streaming/directories/tree", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DirectoriesTree, + ) + + +class DirectoriesResourceWithRawResponse: + def __init__(self, directories: DirectoriesResource) -> None: + self._directories = directories + + self.create = to_raw_response_wrapper( + directories.create, + ) + self.update = to_raw_response_wrapper( + directories.update, + ) + self.delete = to_raw_response_wrapper( + directories.delete, + ) + self.get = to_raw_response_wrapper( + directories.get, + ) + self.get_tree = to_raw_response_wrapper( + directories.get_tree, + ) + + +class AsyncDirectoriesResourceWithRawResponse: + def __init__(self, directories: AsyncDirectoriesResource) -> None: + self._directories = directories + + self.create = async_to_raw_response_wrapper( + directories.create, + ) + self.update = async_to_raw_response_wrapper( + directories.update, + ) + self.delete = async_to_raw_response_wrapper( + directories.delete, + ) + self.get = async_to_raw_response_wrapper( + directories.get, + ) + self.get_tree = async_to_raw_response_wrapper( + directories.get_tree, + ) + + +class DirectoriesResourceWithStreamingResponse: + def __init__(self, directories: DirectoriesResource) -> None: + self._directories = directories + + self.create = to_streamed_response_wrapper( + directories.create, + ) + self.update = to_streamed_response_wrapper( + directories.update, + ) + self.delete = to_streamed_response_wrapper( + directories.delete, + ) + self.get = to_streamed_response_wrapper( + directories.get, + ) + self.get_tree = to_streamed_response_wrapper( + directories.get_tree, + ) + + +class AsyncDirectoriesResourceWithStreamingResponse: + def __init__(self, directories: AsyncDirectoriesResource) -> None: + self._directories = directories + + self.create = async_to_streamed_response_wrapper( + directories.create, + ) + self.update = async_to_streamed_response_wrapper( + directories.update, + ) + self.delete = async_to_streamed_response_wrapper( + directories.delete, + ) + self.get = async_to_streamed_response_wrapper( + directories.get, + ) + self.get_tree = async_to_streamed_response_wrapper( + directories.get_tree, + ) diff --git a/src/gcore/resources/streaming/players.py b/src/gcore/resources/streaming/players.py new file mode 100644 index 00000000..826e015a --- /dev/null +++ b/src/gcore/resources/streaming/players.py @@ -0,0 +1,577 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ...pagination import SyncPageStreaming, AsyncPageStreaming +from ..._base_client import AsyncPaginator, make_request_options +from ...types.streaming import Player, player_list_params, player_create_params, player_update_params +from ...types.streaming.player import Player +from ...types.streaming.player_param import PlayerParam + +__all__ = ["PlayersResource", "AsyncPlayersResource"] + + +class PlayersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PlayersResourceWithRawResponse: + """ + 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 PlayersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PlayersResourceWithStreamingResponse: + """ + 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 PlayersResourceWithStreamingResponse(self) + + def create( + self, + *, + player: PlayerParam | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Create player + + Args: + player: Set of properties for displaying videos. + + All parameters may be blank to inherit + their values from default Streaming player. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + "/streaming/players", + body=maybe_transform({"player": player}, player_create_params.PlayerCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def update( + self, + player_id: int, + *, + player: PlayerParam | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Player: + """Updates player settings + + Args: + player: Set of properties for displaying videos. + + All parameters may be blank to inherit + their values from default Streaming player. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/streaming/players/{player_id}", + body=maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Player, + ) + + def list( + self, + *, + page: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncPageStreaming[Player]: + """Returns a list of created players + + Args: + page: Query parameter. + + Use it to list the paginated content + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/players", + page=SyncPageStreaming[Player], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"page": page}, player_list_params.PlayerListParams), + ), + model=Player, + ) + + def delete( + self, + player_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete player + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/streaming/players/{player_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + player_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, + ) -> Player: + """ + Returns player settings + + 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"/streaming/players/{player_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Player, + ) + + def preview( + self, + player_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Returns player configuration in HTML + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._get( + f"/streaming/players/{player_id}/preview", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncPlayersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPlayersResourceWithRawResponse: + """ + 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 AsyncPlayersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPlayersResourceWithStreamingResponse: + """ + 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 AsyncPlayersResourceWithStreamingResponse(self) + + async def create( + self, + *, + player: PlayerParam | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Create player + + Args: + player: Set of properties for displaying videos. + + All parameters may be blank to inherit + their values from default Streaming player. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + "/streaming/players", + body=await async_maybe_transform({"player": player}, player_create_params.PlayerCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def update( + self, + player_id: int, + *, + player: PlayerParam | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Player: + """Updates player settings + + Args: + player: Set of properties for displaying videos. + + All parameters may be blank to inherit + their values from default Streaming player. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/streaming/players/{player_id}", + body=await async_maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Player, + ) + + def list( + self, + *, + page: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Player, AsyncPageStreaming[Player]]: + """Returns a list of created players + + Args: + page: Query parameter. + + Use it to list the paginated content + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/players", + page=AsyncPageStreaming[Player], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"page": page}, player_list_params.PlayerListParams), + ), + model=Player, + ) + + async def delete( + self, + player_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete player + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/streaming/players/{player_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + player_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, + ) -> Player: + """ + Returns player settings + + 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"/streaming/players/{player_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Player, + ) + + async def preview( + self, + player_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Returns player configuration in HTML + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._get( + f"/streaming/players/{player_id}/preview", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class PlayersResourceWithRawResponse: + def __init__(self, players: PlayersResource) -> None: + self._players = players + + self.create = to_raw_response_wrapper( + players.create, + ) + self.update = to_raw_response_wrapper( + players.update, + ) + self.list = to_raw_response_wrapper( + players.list, + ) + self.delete = to_raw_response_wrapper( + players.delete, + ) + self.get = to_raw_response_wrapper( + players.get, + ) + self.preview = to_raw_response_wrapper( + players.preview, + ) + + +class AsyncPlayersResourceWithRawResponse: + def __init__(self, players: AsyncPlayersResource) -> None: + self._players = players + + self.create = async_to_raw_response_wrapper( + players.create, + ) + self.update = async_to_raw_response_wrapper( + players.update, + ) + self.list = async_to_raw_response_wrapper( + players.list, + ) + self.delete = async_to_raw_response_wrapper( + players.delete, + ) + self.get = async_to_raw_response_wrapper( + players.get, + ) + self.preview = async_to_raw_response_wrapper( + players.preview, + ) + + +class PlayersResourceWithStreamingResponse: + def __init__(self, players: PlayersResource) -> None: + self._players = players + + self.create = to_streamed_response_wrapper( + players.create, + ) + self.update = to_streamed_response_wrapper( + players.update, + ) + self.list = to_streamed_response_wrapper( + players.list, + ) + self.delete = to_streamed_response_wrapper( + players.delete, + ) + self.get = to_streamed_response_wrapper( + players.get, + ) + self.preview = to_streamed_response_wrapper( + players.preview, + ) + + +class AsyncPlayersResourceWithStreamingResponse: + def __init__(self, players: AsyncPlayersResource) -> None: + self._players = players + + self.create = async_to_streamed_response_wrapper( + players.create, + ) + self.update = async_to_streamed_response_wrapper( + players.update, + ) + self.list = async_to_streamed_response_wrapper( + players.list, + ) + self.delete = async_to_streamed_response_wrapper( + players.delete, + ) + self.get = async_to_streamed_response_wrapper( + players.get, + ) + self.preview = async_to_streamed_response_wrapper( + players.preview, + ) diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py new file mode 100644 index 00000000..f8994ca0 --- /dev/null +++ b/src/gcore/resources/streaming/playlists.py @@ -0,0 +1,1059 @@ +# 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 NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ...pagination import SyncPageStreaming, AsyncPageStreaming +from ..._base_client import AsyncPaginator, make_request_options +from ...types.streaming import playlist_list_params, playlist_create_params, playlist_update_params +from ...types.streaming.playlist import Playlist +from ...types.streaming.playlist_create import PlaylistCreate +from ...types.streaming.playlist_list_videos_response import PlaylistListVideosResponse + +__all__ = ["PlaylistsResource", "AsyncPlaylistsResource"] + + +class PlaylistsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PlaylistsResourceWithRawResponse: + """ + 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 PlaylistsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PlaylistsResourceWithStreamingResponse: + """ + 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 PlaylistsResourceWithStreamingResponse(self) + + def create( + self, + *, + active: bool | NotGiven = NOT_GIVEN, + ad_id: int | NotGiven = NOT_GIVEN, + client_id: int | NotGiven = NOT_GIVEN, + client_user_id: int | NotGiven = NOT_GIVEN, + countdown: bool | NotGiven = NOT_GIVEN, + hls_cmaf_url: str | NotGiven = NOT_GIVEN, + hls_url: str | NotGiven = NOT_GIVEN, + iframe_url: str | NotGiven = NOT_GIVEN, + loop: bool | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + player_id: int | NotGiven = NOT_GIVEN, + playlist_type: Literal["live", "vod"] | NotGiven = NOT_GIVEN, + start_time: str | NotGiven = NOT_GIVEN, + video_ids: Iterable[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PlaylistCreate: + """ + Playlist is a curated collection of video content organized in a sequential + manner. This method offers several advantages and features that are typical of + live streaming but with more control over the content. Here's how it works: + + - Playlist always consists only of static VOD videos you previously uploaded to + the system. + - Playlist is always played as a "Live stream" for end-users, so without the + ability to fast forward the stream to the “future”. Manifest will contain + chunks as for live stream too. + - Playlist can be looped endlessly. In this case, all the videos in the list + will be constantly repeated through the list. + - Playlist can be programmed to be played at a specific time in the future. In + that case, before the start time there will be empty manifest. You can add new + videos to the list, remove unnecessary videos, or change the order of videos + in the list. But please pay attention to when the video list changes, it is + updated instantly on the server. This means that after saving the changed + list, the playlist will be reloaded for all users and it will start plays from + the very first element. Maximum video limit = 128 videos in a row. + + Examples of usage: + + - Looped video playback + - Scheduled playback **Looped video playback** It can be used to simulate TV + channel pre-programmed behaviour. + - Selection: Choose a series of videos, such as TV show episodes, movies, + tutorials, or any other relevant content. + - Order: Arrange the selected videos in the desired sequence, much like setting + a broadcast schedule. + - Looping: Optionally, the playlist can be set to loop, replaying the sequence + once it finishes to maintain a continuous stream. Example: + + ``` + active: true + loop: true + name: "Playlist: TV channel 'The world around us' (Programmed broadcast for 24 hours)" + ``` + + **Scheduled playback** It can be used to simulate live events such as virtual + concerts, webinars, or any special broadcasts without the logistical challenges + of an actual live stream. + + - Timing: Set specific start time, creating the illusion of a live broadcast + schedule. + - Selection: Choose a video or series of videos to be played at the specified + time. + - No Pauses: Unlike on-demand streaming where users can pause and skip, this + emulated live stream runs continuously, mirroring the constraints of + traditional live broadcasts. + + ``` + active: true + loop: false + name: "Playlist: Webinar 'Onboarding for new employees on working with the corporate portal'" + `start_time`: "2024-07-01T11:00:00Z" + ``` + + Args: + active: + Enables/Disables playlist. Has two possible values: + + - true – Playlist can be played. + - false – Playlist is disabled. No broadcast while it's desabled. + + ad_id: The advertisement ID that will be inserted into the video + + client_id: Current playlist client ID + + client_user_id: Custom field where you can specify user ID in your system + + countdown: Enables countdown before playlist start with `playlist_type: live` + + hls_cmaf_url: A URL to a master playlist HLS (master-cmaf.m3u8) with CMAF-based chunks. Chunks + are in fMP4 container. + + It is possible to use the same suffix-options as described in the "`hls_url`" + attribute. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + + hls_url: A URL to a master playlist HLS (master.m3u8) with MPEG TS container. + + 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: + `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + Please see the details in `hls_url` attribute of /videos/{id} method. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + + iframe_url: A URL to a built-in HTML video player with the video inside. It can be inserted + into an iframe on your website and the video will automatically play in all + browsers. The player can be opened or shared via this direct link. Also the + video player can be integrated into your web pages using the Iframe tag. + + Please see the details in `iframe_url` attribute of /videos/{id} method. + + loop: Enables/Disables playlist loop + + name: Playlist name + + player_id: The player ID with which the video will be played + + playlist_type: + Determines whether the playlist: + + - `live` - playlist for live-streaming + - `vod` - playlist is for video on demand access + + start_time: Playlist start time. Playlist won't be available before the specified time. + Datetime in ISO 8601 format. + + video_ids: A list of VOD IDs included in the playlist. Order of videos in a playlist + reflects the order of IDs in the array. Maximum video limit = 128. + + 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( + "/streaming/playlists", + body=maybe_transform( + { + "active": active, + "ad_id": ad_id, + "client_id": client_id, + "client_user_id": client_user_id, + "countdown": countdown, + "hls_cmaf_url": hls_cmaf_url, + "hls_url": hls_url, + "iframe_url": iframe_url, + "loop": loop, + "name": name, + "player_id": player_id, + "playlist_type": playlist_type, + "start_time": start_time, + "video_ids": video_ids, + }, + playlist_create_params.PlaylistCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PlaylistCreate, + ) + + def update( + self, + playlist_id: int, + *, + active: bool | NotGiven = NOT_GIVEN, + ad_id: int | NotGiven = NOT_GIVEN, + client_id: int | NotGiven = NOT_GIVEN, + client_user_id: int | NotGiven = NOT_GIVEN, + countdown: bool | NotGiven = NOT_GIVEN, + hls_cmaf_url: str | NotGiven = NOT_GIVEN, + hls_url: str | NotGiven = NOT_GIVEN, + iframe_url: str | NotGiven = NOT_GIVEN, + loop: bool | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + player_id: int | NotGiven = NOT_GIVEN, + playlist_type: Literal["live", "vod"] | NotGiven = NOT_GIVEN, + start_time: str | NotGiven = NOT_GIVEN, + video_ids: Iterable[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Playlist: + """Change playlist + + Args: + active: + Enables/Disables playlist. + + Has two possible values: + + - true – Playlist can be played. + - false – Playlist is disabled. No broadcast while it's desabled. + + ad_id: The advertisement ID that will be inserted into the video + + client_id: Current playlist client ID + + client_user_id: Custom field where you can specify user ID in your system + + countdown: Enables countdown before playlist start with `playlist_type: live` + + hls_cmaf_url: A URL to a master playlist HLS (master-cmaf.m3u8) with CMAF-based chunks. Chunks + are in fMP4 container. + + It is possible to use the same suffix-options as described in the "`hls_url`" + attribute. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + + hls_url: A URL to a master playlist HLS (master.m3u8) with MPEG TS container. + + 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: + `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + Please see the details in `hls_url` attribute of /videos/{id} method. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + + iframe_url: A URL to a built-in HTML video player with the video inside. It can be inserted + into an iframe on your website and the video will automatically play in all + browsers. The player can be opened or shared via this direct link. Also the + video player can be integrated into your web pages using the Iframe tag. + + Please see the details in `iframe_url` attribute of /videos/{id} method. + + loop: Enables/Disables playlist loop + + name: Playlist name + + player_id: The player ID with which the video will be played + + playlist_type: + Determines whether the playlist: + + - `live` - playlist for live-streaming + - `vod` - playlist is for video on demand access + + start_time: Playlist start time. Playlist won't be available before the specified time. + Datetime in ISO 8601 format. + + video_ids: A list of VOD IDs included in the playlist. Order of videos in a playlist + reflects the order of IDs in the array. Maximum video limit = 128. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/streaming/playlists/{playlist_id}", + body=maybe_transform( + { + "active": active, + "ad_id": ad_id, + "client_id": client_id, + "client_user_id": client_user_id, + "countdown": countdown, + "hls_cmaf_url": hls_cmaf_url, + "hls_url": hls_url, + "iframe_url": iframe_url, + "loop": loop, + "name": name, + "player_id": player_id, + "playlist_type": playlist_type, + "start_time": start_time, + "video_ids": video_ids, + }, + playlist_update_params.PlaylistUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Playlist, + ) + + def list( + self, + *, + page: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncPageStreaming[Playlist]: + """Returns a list of created playlists + + Args: + page: Query parameter. + + Use it to list the paginated content + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/playlists", + page=SyncPageStreaming[Playlist], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"page": page}, playlist_list_params.PlaylistListParams), + ), + model=Playlist, + ) + + def delete( + self, + playlist_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete playlist + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/streaming/playlists/{playlist_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + playlist_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, + ) -> Playlist: + """ + Returns a playlist details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/streaming/playlists/{playlist_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Playlist, + ) + + def list_videos( + self, + playlist_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, + ) -> PlaylistListVideosResponse: + """ + Shows ordered array of playlist videos + + 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"/streaming/playlists/{playlist_id}/videos", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PlaylistListVideosResponse, + ) + + +class AsyncPlaylistsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPlaylistsResourceWithRawResponse: + """ + 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 AsyncPlaylistsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPlaylistsResourceWithStreamingResponse: + """ + 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 AsyncPlaylistsResourceWithStreamingResponse(self) + + async def create( + self, + *, + active: bool | NotGiven = NOT_GIVEN, + ad_id: int | NotGiven = NOT_GIVEN, + client_id: int | NotGiven = NOT_GIVEN, + client_user_id: int | NotGiven = NOT_GIVEN, + countdown: bool | NotGiven = NOT_GIVEN, + hls_cmaf_url: str | NotGiven = NOT_GIVEN, + hls_url: str | NotGiven = NOT_GIVEN, + iframe_url: str | NotGiven = NOT_GIVEN, + loop: bool | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + player_id: int | NotGiven = NOT_GIVEN, + playlist_type: Literal["live", "vod"] | NotGiven = NOT_GIVEN, + start_time: str | NotGiven = NOT_GIVEN, + video_ids: Iterable[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PlaylistCreate: + """ + Playlist is a curated collection of video content organized in a sequential + manner. This method offers several advantages and features that are typical of + live streaming but with more control over the content. Here's how it works: + + - Playlist always consists only of static VOD videos you previously uploaded to + the system. + - Playlist is always played as a "Live stream" for end-users, so without the + ability to fast forward the stream to the “future”. Manifest will contain + chunks as for live stream too. + - Playlist can be looped endlessly. In this case, all the videos in the list + will be constantly repeated through the list. + - Playlist can be programmed to be played at a specific time in the future. In + that case, before the start time there will be empty manifest. You can add new + videos to the list, remove unnecessary videos, or change the order of videos + in the list. But please pay attention to when the video list changes, it is + updated instantly on the server. This means that after saving the changed + list, the playlist will be reloaded for all users and it will start plays from + the very first element. Maximum video limit = 128 videos in a row. + + Examples of usage: + + - Looped video playback + - Scheduled playback **Looped video playback** It can be used to simulate TV + channel pre-programmed behaviour. + - Selection: Choose a series of videos, such as TV show episodes, movies, + tutorials, or any other relevant content. + - Order: Arrange the selected videos in the desired sequence, much like setting + a broadcast schedule. + - Looping: Optionally, the playlist can be set to loop, replaying the sequence + once it finishes to maintain a continuous stream. Example: + + ``` + active: true + loop: true + name: "Playlist: TV channel 'The world around us' (Programmed broadcast for 24 hours)" + ``` + + **Scheduled playback** It can be used to simulate live events such as virtual + concerts, webinars, or any special broadcasts without the logistical challenges + of an actual live stream. + + - Timing: Set specific start time, creating the illusion of a live broadcast + schedule. + - Selection: Choose a video or series of videos to be played at the specified + time. + - No Pauses: Unlike on-demand streaming where users can pause and skip, this + emulated live stream runs continuously, mirroring the constraints of + traditional live broadcasts. + + ``` + active: true + loop: false + name: "Playlist: Webinar 'Onboarding for new employees on working with the corporate portal'" + `start_time`: "2024-07-01T11:00:00Z" + ``` + + Args: + active: + Enables/Disables playlist. Has two possible values: + + - true – Playlist can be played. + - false – Playlist is disabled. No broadcast while it's desabled. + + ad_id: The advertisement ID that will be inserted into the video + + client_id: Current playlist client ID + + client_user_id: Custom field where you can specify user ID in your system + + countdown: Enables countdown before playlist start with `playlist_type: live` + + hls_cmaf_url: A URL to a master playlist HLS (master-cmaf.m3u8) with CMAF-based chunks. Chunks + are in fMP4 container. + + It is possible to use the same suffix-options as described in the "`hls_url`" + attribute. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + + hls_url: A URL to a master playlist HLS (master.m3u8) with MPEG TS container. + + 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: + `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + Please see the details in `hls_url` attribute of /videos/{id} method. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + + iframe_url: A URL to a built-in HTML video player with the video inside. It can be inserted + into an iframe on your website and the video will automatically play in all + browsers. The player can be opened or shared via this direct link. Also the + video player can be integrated into your web pages using the Iframe tag. + + Please see the details in `iframe_url` attribute of /videos/{id} method. + + loop: Enables/Disables playlist loop + + name: Playlist name + + player_id: The player ID with which the video will be played + + playlist_type: + Determines whether the playlist: + + - `live` - playlist for live-streaming + - `vod` - playlist is for video on demand access + + start_time: Playlist start time. Playlist won't be available before the specified time. + Datetime in ISO 8601 format. + + video_ids: A list of VOD IDs included in the playlist. Order of videos in a playlist + reflects the order of IDs in the array. Maximum video limit = 128. + + 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( + "/streaming/playlists", + body=await async_maybe_transform( + { + "active": active, + "ad_id": ad_id, + "client_id": client_id, + "client_user_id": client_user_id, + "countdown": countdown, + "hls_cmaf_url": hls_cmaf_url, + "hls_url": hls_url, + "iframe_url": iframe_url, + "loop": loop, + "name": name, + "player_id": player_id, + "playlist_type": playlist_type, + "start_time": start_time, + "video_ids": video_ids, + }, + playlist_create_params.PlaylistCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PlaylistCreate, + ) + + async def update( + self, + playlist_id: int, + *, + active: bool | NotGiven = NOT_GIVEN, + ad_id: int | NotGiven = NOT_GIVEN, + client_id: int | NotGiven = NOT_GIVEN, + client_user_id: int | NotGiven = NOT_GIVEN, + countdown: bool | NotGiven = NOT_GIVEN, + hls_cmaf_url: str | NotGiven = NOT_GIVEN, + hls_url: str | NotGiven = NOT_GIVEN, + iframe_url: str | NotGiven = NOT_GIVEN, + loop: bool | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + player_id: int | NotGiven = NOT_GIVEN, + playlist_type: Literal["live", "vod"] | NotGiven = NOT_GIVEN, + start_time: str | NotGiven = NOT_GIVEN, + video_ids: Iterable[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Playlist: + """Change playlist + + Args: + active: + Enables/Disables playlist. + + Has two possible values: + + - true – Playlist can be played. + - false – Playlist is disabled. No broadcast while it's desabled. + + ad_id: The advertisement ID that will be inserted into the video + + client_id: Current playlist client ID + + client_user_id: Custom field where you can specify user ID in your system + + countdown: Enables countdown before playlist start with `playlist_type: live` + + hls_cmaf_url: A URL to a master playlist HLS (master-cmaf.m3u8) with CMAF-based chunks. Chunks + are in fMP4 container. + + It is possible to use the same suffix-options as described in the "`hls_url`" + attribute. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + + hls_url: A URL to a master playlist HLS (master.m3u8) with MPEG TS container. + + 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: + `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + Please see the details in `hls_url` attribute of /videos/{id} method. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + + iframe_url: A URL to a built-in HTML video player with the video inside. It can be inserted + into an iframe on your website and the video will automatically play in all + browsers. The player can be opened or shared via this direct link. Also the + video player can be integrated into your web pages using the Iframe tag. + + Please see the details in `iframe_url` attribute of /videos/{id} method. + + loop: Enables/Disables playlist loop + + name: Playlist name + + player_id: The player ID with which the video will be played + + playlist_type: + Determines whether the playlist: + + - `live` - playlist for live-streaming + - `vod` - playlist is for video on demand access + + start_time: Playlist start time. Playlist won't be available before the specified time. + Datetime in ISO 8601 format. + + video_ids: A list of VOD IDs included in the playlist. Order of videos in a playlist + reflects the order of IDs in the array. Maximum video limit = 128. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/streaming/playlists/{playlist_id}", + body=await async_maybe_transform( + { + "active": active, + "ad_id": ad_id, + "client_id": client_id, + "client_user_id": client_user_id, + "countdown": countdown, + "hls_cmaf_url": hls_cmaf_url, + "hls_url": hls_url, + "iframe_url": iframe_url, + "loop": loop, + "name": name, + "player_id": player_id, + "playlist_type": playlist_type, + "start_time": start_time, + "video_ids": video_ids, + }, + playlist_update_params.PlaylistUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Playlist, + ) + + def list( + self, + *, + page: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Playlist, AsyncPageStreaming[Playlist]]: + """Returns a list of created playlists + + Args: + page: Query parameter. + + Use it to list the paginated content + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/playlists", + page=AsyncPageStreaming[Playlist], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"page": page}, playlist_list_params.PlaylistListParams), + ), + model=Playlist, + ) + + async def delete( + self, + playlist_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete playlist + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/streaming/playlists/{playlist_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + playlist_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, + ) -> Playlist: + """ + Returns a playlist details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/streaming/playlists/{playlist_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Playlist, + ) + + async def list_videos( + self, + playlist_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, + ) -> PlaylistListVideosResponse: + """ + Shows ordered array of playlist videos + + 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"/streaming/playlists/{playlist_id}/videos", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PlaylistListVideosResponse, + ) + + +class PlaylistsResourceWithRawResponse: + def __init__(self, playlists: PlaylistsResource) -> None: + self._playlists = playlists + + self.create = to_raw_response_wrapper( + playlists.create, + ) + self.update = to_raw_response_wrapper( + playlists.update, + ) + self.list = to_raw_response_wrapper( + playlists.list, + ) + self.delete = to_raw_response_wrapper( + playlists.delete, + ) + self.get = to_raw_response_wrapper( + playlists.get, + ) + self.list_videos = to_raw_response_wrapper( + playlists.list_videos, + ) + + +class AsyncPlaylistsResourceWithRawResponse: + def __init__(self, playlists: AsyncPlaylistsResource) -> None: + self._playlists = playlists + + self.create = async_to_raw_response_wrapper( + playlists.create, + ) + self.update = async_to_raw_response_wrapper( + playlists.update, + ) + self.list = async_to_raw_response_wrapper( + playlists.list, + ) + self.delete = async_to_raw_response_wrapper( + playlists.delete, + ) + self.get = async_to_raw_response_wrapper( + playlists.get, + ) + self.list_videos = async_to_raw_response_wrapper( + playlists.list_videos, + ) + + +class PlaylistsResourceWithStreamingResponse: + def __init__(self, playlists: PlaylistsResource) -> None: + self._playlists = playlists + + self.create = to_streamed_response_wrapper( + playlists.create, + ) + self.update = to_streamed_response_wrapper( + playlists.update, + ) + self.list = to_streamed_response_wrapper( + playlists.list, + ) + self.delete = to_streamed_response_wrapper( + playlists.delete, + ) + self.get = to_streamed_response_wrapper( + playlists.get, + ) + self.list_videos = to_streamed_response_wrapper( + playlists.list_videos, + ) + + +class AsyncPlaylistsResourceWithStreamingResponse: + def __init__(self, playlists: AsyncPlaylistsResource) -> None: + self._playlists = playlists + + self.create = async_to_streamed_response_wrapper( + playlists.create, + ) + self.update = async_to_streamed_response_wrapper( + playlists.update, + ) + self.list = async_to_streamed_response_wrapper( + playlists.list, + ) + self.delete = async_to_streamed_response_wrapper( + playlists.delete, + ) + self.get = async_to_streamed_response_wrapper( + playlists.get, + ) + self.list_videos = async_to_streamed_response_wrapper( + playlists.list_videos, + ) diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py new file mode 100644 index 00000000..40bf6368 --- /dev/null +++ b/src/gcore/resources/streaming/quality_sets.py @@ -0,0 +1,331 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.streaming import quality_set_set_default_params +from ...types.streaming.quality_sets import QualitySets + +__all__ = ["QualitySetsResource", "AsyncQualitySetsResource"] + + +class QualitySetsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> QualitySetsResourceWithRawResponse: + """ + 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 QualitySetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> QualitySetsResourceWithStreamingResponse: + """ + 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 QualitySetsResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> QualitySets: + """ + Method returns a list of all custom quality sets. + + Transcoding is designed to minimize video file size while maintaining maximum + visual quality. This is done so that the video can be delivered and viewed on + any device, on any Internet connection, anywhere in the world. It's always a + compromise between video/audio quality and delivery+viewing quality (QoE). + + 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). + These values are the default for everyone. There is no need to configure + anything additional. Read more about qiality in our blog + [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality/). + ![Quality ladder](https://demo-files.gvideo.io/apidocs/`encoding_ladder`.png) + Only for those cases when, in addition to the main parameters, it is necessary + to use your own, then it is necessary to use custom quality sets. How to use: + + 1. By default custom quality set is empty – `{ "live":[],"vod":[] }` + 2. Request the use of custom quality sets from your manager or the Support Team. + 3. Please forward your requirements to us, since the parameters are set not by + you, but by our engineers. (We are working to ensure that later you can + create qualities by yourself.) + 4. Use the created quality sets through the these specified API methods. Here + are some common parameters of quality settings: + + - Resolution: Determines the size of the video frame. I.e. 720p, 1080p, 4K, etc. + - Bitrate: Refers to the amount of data processed per unit of time. + - Codec: Codec used for transcoding can significantly affect quality. Popular + codecs include H.264 (AVC), H.265 (HEVC), and AV1. + - Frame Rate: Determines how many frames per second are displayed. Common frame + rates include 24fps, 30fps, and 60fps. + - Color Depth and Chroma Subsampling: These settings determine the accuracy of + color representation in the video. + - Audio Bitrate and Codec: Don't forget about the audio :) Bitrate and codec + used for audio can also affect the overall quality. Note: Custom quality set + is a paid feature. + """ + return self._get( + "/streaming/quality_sets", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QualitySets, + ) + + def set_default( + self, + *, + live: quality_set_set_default_params.Live | NotGiven = NOT_GIVEN, + vod: quality_set_set_default_params.Vod | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> QualitySets: + """Method to set default quality set for VOD and Live transcoding. + + For changing + default quality set, specify the ID of the custom quality set from the method + GET /`quality_sets`. Default value can be reverted to the system defaults + (cleared) by setting `"id": null`. + + Live transcoding management: + + - You can specify quality set explicitly in POST /streams method, look at + attribute "`quality_set_id`". + - Otherwise these default values will be used by the system by default. VOD + transcoding management: + - You can specify quality set explicitly in POST /videos method, look at + attribute "`quality_set_id`". + - Otherwise these default values will be used by the system by default. + + 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( + "/streaming/quality_sets/default", + body=maybe_transform( + { + "live": live, + "vod": vod, + }, + quality_set_set_default_params.QualitySetSetDefaultParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QualitySets, + ) + + +class AsyncQualitySetsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncQualitySetsResourceWithRawResponse: + """ + 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 AsyncQualitySetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncQualitySetsResourceWithStreamingResponse: + """ + 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 AsyncQualitySetsResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> QualitySets: + """ + Method returns a list of all custom quality sets. + + Transcoding is designed to minimize video file size while maintaining maximum + visual quality. This is done so that the video can be delivered and viewed on + any device, on any Internet connection, anywhere in the world. It's always a + compromise between video/audio quality and delivery+viewing quality (QoE). + + 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). + These values are the default for everyone. There is no need to configure + anything additional. Read more about qiality in our blog + [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality/). + ![Quality ladder](https://demo-files.gvideo.io/apidocs/`encoding_ladder`.png) + Only for those cases when, in addition to the main parameters, it is necessary + to use your own, then it is necessary to use custom quality sets. How to use: + + 1. By default custom quality set is empty – `{ "live":[],"vod":[] }` + 2. Request the use of custom quality sets from your manager or the Support Team. + 3. Please forward your requirements to us, since the parameters are set not by + you, but by our engineers. (We are working to ensure that later you can + create qualities by yourself.) + 4. Use the created quality sets through the these specified API methods. Here + are some common parameters of quality settings: + + - Resolution: Determines the size of the video frame. I.e. 720p, 1080p, 4K, etc. + - Bitrate: Refers to the amount of data processed per unit of time. + - Codec: Codec used for transcoding can significantly affect quality. Popular + codecs include H.264 (AVC), H.265 (HEVC), and AV1. + - Frame Rate: Determines how many frames per second are displayed. Common frame + rates include 24fps, 30fps, and 60fps. + - Color Depth and Chroma Subsampling: These settings determine the accuracy of + color representation in the video. + - Audio Bitrate and Codec: Don't forget about the audio :) Bitrate and codec + used for audio can also affect the overall quality. Note: Custom quality set + is a paid feature. + """ + return await self._get( + "/streaming/quality_sets", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QualitySets, + ) + + async def set_default( + self, + *, + live: quality_set_set_default_params.Live | NotGiven = NOT_GIVEN, + vod: quality_set_set_default_params.Vod | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> QualitySets: + """Method to set default quality set for VOD and Live transcoding. + + For changing + default quality set, specify the ID of the custom quality set from the method + GET /`quality_sets`. Default value can be reverted to the system defaults + (cleared) by setting `"id": null`. + + Live transcoding management: + + - You can specify quality set explicitly in POST /streams method, look at + attribute "`quality_set_id`". + - Otherwise these default values will be used by the system by default. VOD + transcoding management: + - You can specify quality set explicitly in POST /videos method, look at + attribute "`quality_set_id`". + - Otherwise these default values will be used by the system by default. + + 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( + "/streaming/quality_sets/default", + body=await async_maybe_transform( + { + "live": live, + "vod": vod, + }, + quality_set_set_default_params.QualitySetSetDefaultParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QualitySets, + ) + + +class QualitySetsResourceWithRawResponse: + def __init__(self, quality_sets: QualitySetsResource) -> None: + self._quality_sets = quality_sets + + self.list = to_raw_response_wrapper( + quality_sets.list, + ) + self.set_default = to_raw_response_wrapper( + quality_sets.set_default, + ) + + +class AsyncQualitySetsResourceWithRawResponse: + def __init__(self, quality_sets: AsyncQualitySetsResource) -> None: + self._quality_sets = quality_sets + + self.list = async_to_raw_response_wrapper( + quality_sets.list, + ) + self.set_default = async_to_raw_response_wrapper( + quality_sets.set_default, + ) + + +class QualitySetsResourceWithStreamingResponse: + def __init__(self, quality_sets: QualitySetsResource) -> None: + self._quality_sets = quality_sets + + self.list = to_streamed_response_wrapper( + quality_sets.list, + ) + self.set_default = to_streamed_response_wrapper( + quality_sets.set_default, + ) + + +class AsyncQualitySetsResourceWithStreamingResponse: + def __init__(self, quality_sets: AsyncQualitySetsResource) -> None: + self._quality_sets = quality_sets + + self.list = async_to_streamed_response_wrapper( + quality_sets.list, + ) + self.set_default = async_to_streamed_response_wrapper( + quality_sets.set_default, + ) diff --git a/src/gcore/resources/streaming/restreams.py b/src/gcore/resources/streaming/restreams.py new file mode 100644 index 00000000..78880ed4 --- /dev/null +++ b/src/gcore/resources/streaming/restreams.py @@ -0,0 +1,484 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ...pagination import SyncPageStreaming, AsyncPageStreaming +from ..._base_client import AsyncPaginator, make_request_options +from ...types.streaming import restream_list_params, restream_create_params, restream_update_params +from ...types.streaming.restream import Restream + +__all__ = ["RestreamsResource", "AsyncRestreamsResource"] + + +class RestreamsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RestreamsResourceWithRawResponse: + """ + 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 RestreamsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RestreamsResourceWithStreamingResponse: + """ + 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 RestreamsResourceWithStreamingResponse(self) + + def create( + self, + *, + restream: restream_create_params.Restream | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Create restream + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + "/streaming/restreams", + body=maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def update( + self, + restream_id: int, + *, + restream: restream_update_params.Restream | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Restream: + """ + Updates restream settings + + 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._patch( + f"/streaming/restreams/{restream_id}", + body=maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Restream, + ) + + def list( + self, + *, + page: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncPageStreaming[Restream]: + """Returns a list of created restreams + + Args: + page: Query parameter. + + Use it to list the paginated content + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/restreams", + page=SyncPageStreaming[Restream], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"page": page}, restream_list_params.RestreamListParams), + ), + model=Restream, + ) + + def delete( + self, + restream_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete restream + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/streaming/restreams/{restream_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + restream_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, + ) -> Restream: + """ + Returns restream details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/streaming/restreams/{restream_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Restream, + ) + + +class AsyncRestreamsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRestreamsResourceWithRawResponse: + """ + 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 AsyncRestreamsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRestreamsResourceWithStreamingResponse: + """ + 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 AsyncRestreamsResourceWithStreamingResponse(self) + + async def create( + self, + *, + restream: restream_create_params.Restream | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Create restream + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + "/streaming/restreams", + body=await async_maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def update( + self, + restream_id: int, + *, + restream: restream_update_params.Restream | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Restream: + """ + Updates restream settings + + 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._patch( + f"/streaming/restreams/{restream_id}", + body=await async_maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Restream, + ) + + def list( + self, + *, + page: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Restream, AsyncPageStreaming[Restream]]: + """Returns a list of created restreams + + Args: + page: Query parameter. + + Use it to list the paginated content + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/restreams", + page=AsyncPageStreaming[Restream], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"page": page}, restream_list_params.RestreamListParams), + ), + model=Restream, + ) + + async def delete( + self, + restream_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete restream + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/streaming/restreams/{restream_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + restream_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, + ) -> Restream: + """ + Returns restream details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/streaming/restreams/{restream_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Restream, + ) + + +class RestreamsResourceWithRawResponse: + def __init__(self, restreams: RestreamsResource) -> None: + self._restreams = restreams + + self.create = to_raw_response_wrapper( + restreams.create, + ) + self.update = to_raw_response_wrapper( + restreams.update, + ) + self.list = to_raw_response_wrapper( + restreams.list, + ) + self.delete = to_raw_response_wrapper( + restreams.delete, + ) + self.get = to_raw_response_wrapper( + restreams.get, + ) + + +class AsyncRestreamsResourceWithRawResponse: + def __init__(self, restreams: AsyncRestreamsResource) -> None: + self._restreams = restreams + + self.create = async_to_raw_response_wrapper( + restreams.create, + ) + self.update = async_to_raw_response_wrapper( + restreams.update, + ) + self.list = async_to_raw_response_wrapper( + restreams.list, + ) + self.delete = async_to_raw_response_wrapper( + restreams.delete, + ) + self.get = async_to_raw_response_wrapper( + restreams.get, + ) + + +class RestreamsResourceWithStreamingResponse: + def __init__(self, restreams: RestreamsResource) -> None: + self._restreams = restreams + + self.create = to_streamed_response_wrapper( + restreams.create, + ) + self.update = to_streamed_response_wrapper( + restreams.update, + ) + self.list = to_streamed_response_wrapper( + restreams.list, + ) + self.delete = to_streamed_response_wrapper( + restreams.delete, + ) + self.get = to_streamed_response_wrapper( + restreams.get, + ) + + +class AsyncRestreamsResourceWithStreamingResponse: + def __init__(self, restreams: AsyncRestreamsResource) -> None: + self._restreams = restreams + + self.create = async_to_streamed_response_wrapper( + restreams.create, + ) + self.update = async_to_streamed_response_wrapper( + restreams.update, + ) + self.list = async_to_streamed_response_wrapper( + restreams.list, + ) + self.delete = async_to_streamed_response_wrapper( + restreams.delete, + ) + self.get = async_to_streamed_response_wrapper( + restreams.get, + ) diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py new file mode 100644 index 00000000..7a763cdc --- /dev/null +++ b/src/gcore/resources/streaming/statistics.py @@ -0,0 +1,3224 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.streaming import ( + statistic_get_views_params, + statistic_get_ffprobes_params, + statistic_get_meet_series_params, + statistic_get_stream_series_params, + statistic_get_views_heatmap_params, + statistic_get_popular_videos_params, + statistic_get_storage_series_params, + statistic_get_unique_viewers_params, + statistic_get_views_by_region_params, + statistic_get_views_by_country_params, + statistic_get_views_by_referer_params, + statistic_get_views_by_browsers_params, + statistic_get_views_by_hostname_params, + statistic_get_max_streams_series_params, + statistic_get_unique_viewers_cdn_params, + statistic_get_vod_storage_volume_params, + statistic_get_vod_watch_time_cdn_params, + statistic_get_live_unique_viewers_params, + statistic_get_live_watch_time_cdn_params, + statistic_get_vod_unique_viewers_cdn_params, + statistic_get_vod_transcoding_duration_params, + statistic_get_vod_watch_time_total_cdn_params, + statistic_get_live_watch_time_total_cdn_params, + statistic_get_views_by_operating_system_params, +) +from ...types.streaming.views import Views +from ...types.streaming.ffprobes import Ffprobes +from ...types.streaming.meet_series import MeetSeries +from ...types.streaming.stream_series import StreamSeries +from ...types.streaming.views_heatmap import ViewsHeatmap +from ...types.streaming.popular_videos import PopularVideos +from ...types.streaming.storage_series import StorageSeries +from ...types.streaming.unique_viewers import UniqueViewers +from ...types.streaming.views_by_region import ViewsByRegion +from ...types.streaming.views_by_browser import ViewsByBrowser +from ...types.streaming.views_by_country import ViewsByCountry +from ...types.streaming.views_by_referer import ViewsByReferer +from ...types.streaming.max_stream_series import MaxStreamSeries +from ...types.streaming.views_by_hostname import ViewsByHostname +from ...types.streaming.unique_viewers_cdn import UniqueViewersCdn +from ...types.streaming.vod_statistics_series import VodStatisticsSeries +from ...types.streaming.views_by_operating_system import ViewsByOperatingSystem +from ...types.streaming.vod_total_stream_duration_series import VodTotalStreamDurationSeries +from ...types.streaming.statistic_get_live_unique_viewers_response import StatisticGetLiveUniqueViewersResponse +from ...types.streaming.statistic_get_vod_watch_time_total_cdn_response import StatisticGetVodWatchTimeTotalCdnResponse + +__all__ = ["StatisticsResource", "AsyncStatisticsResource"] + + +class StatisticsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StatisticsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return StatisticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StatisticsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return StatisticsResourceWithStreamingResponse(self) + + def get_ffprobes( + self, + *, + date_from: str, + date_to: str, + stream_id: str, + interval: int | NotGiven = NOT_GIVEN, + units: Literal["second", "minute", "hour", "day", "week", "month"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Ffprobes: + """ + Aggregates data for the specified video stream in the specified time interval. + "interval" and "units" params working together to point aggregation interval. + You can use this method to watch when stream was alive in time, and when it was + off. + + Args: + date_from: Start of time frame. Format is ISO 8601. + + date_to: End of time frame. Datetime in ISO 8601 format. + + stream_id: Stream ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/streaming/statistics/ffprobe", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + "stream_id": stream_id, + "interval": interval, + "units": units, + }, + statistic_get_ffprobes_params.StatisticGetFfprobesParams, + ), + ), + cast_to=Ffprobes, + ) + + def get_live_unique_viewers( + self, + *, + from_: str, + to: str, + client_user_id: int | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + stream_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StatisticGetLiveUniqueViewersResponse: + """Calculates time series of unique viewers of Live streams via CDN. + + The statistics + are taken from the data of CDN and work regardless of which player the views + were made with. Works similar to the method `/statistics/cdn/uniqs`. But this + allows you to break down data with the specified granularity: minutes, hours, + days. Based on this method, a graph of unique views in the Customer Portal is + built. + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/`cdn_unique_viewers`.png) + + Args: + from_: Start of time frame. Format is date time in ISO 8601 + + to: End of time frame. Format is date time in ISO 8601 + + client_user_id: Filter by "`client_user_id`" + + granularity: Specifies the time interval for grouping data + + stream_id: Filter by "`stream_id`" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/streaming/statistics/stream/viewers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "client_user_id": client_user_id, + "granularity": granularity, + "stream_id": stream_id, + }, + statistic_get_live_unique_viewers_params.StatisticGetLiveUniqueViewersParams, + ), + ), + cast_to=StatisticGetLiveUniqueViewersResponse, + ) + + def get_live_watch_time_cdn( + self, + *, + from_: str, + client_user_id: int | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | NotGiven = NOT_GIVEN, + stream_id: int | NotGiven = NOT_GIVEN, + to: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StreamSeries: + """Calculates a time series of live streams watching duration in minutes. + + Views of + only those streams that meet the specified filters are summed up. The statistics + are taken from the data of CDN and work regardless of which player the views + were made with. Please note that the result for each time interval is in + minutes, it is rounded to the nearest upper integer. You cannot use the sum of + all intervals as the total watch time value; instead, use the /total method. + + Args: + from_: Start of the time period for counting minutes of watching. Format is date time + in ISO 8601. + + client_user_id: Filter by field "`client_user_id`" + + granularity: Data is grouped by the specified time interval + + stream_id: Filter by `stream_id` + + to: End of time frame. Datetime in ISO 8601 format. If omitted, then the current + time is taken + + 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( + "/streaming/statistics/stream/watching_duration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "client_user_id": client_user_id, + "granularity": granularity, + "stream_id": stream_id, + "to": to, + }, + statistic_get_live_watch_time_cdn_params.StatisticGetLiveWatchTimeCdnParams, + ), + ), + cast_to=StreamSeries, + ) + + def get_live_watch_time_total_cdn( + self, + *, + client_user_id: int | NotGiven = NOT_GIVEN, + from_: str | NotGiven = NOT_GIVEN, + stream_id: int | NotGiven = NOT_GIVEN, + to: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VodTotalStreamDurationSeries: + """Calculates the total duration of live streams watching in minutes. + + Views of only + those streams that meet the specified filters are summed up. The statistics are + taken from the data of CDN and work regardless of which player the views were + made with. + + Args: + client_user_id: Filter by field "`client_user_id`" + + from_: Start of the time period for counting minutes of watching. Format is date time + in ISO 8601. If omitted, the earliest start time for viewing is taken + + stream_id: Filter by `stream_id` + + to: End of time frame. Datetime in ISO 8601 format. If missed, then the current time + is taken + + 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( + "/streaming/statistics/stream/watching_duration/total", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "client_user_id": client_user_id, + "from_": from_, + "stream_id": stream_id, + "to": to, + }, + statistic_get_live_watch_time_total_cdn_params.StatisticGetLiveWatchTimeTotalCdnParams, + ), + ), + cast_to=VodTotalStreamDurationSeries, + ) + + def get_max_streams_series( + self, + *, + from_: str, + to: str, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> MaxStreamSeries: + """Calculates time series of the amount of simultaneous streams. + + The data is + updated near realtime. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + granularity: specifies the time interval for grouping data + + 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( + "/streaming/statistics/max_stream", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "granularity": granularity, + }, + statistic_get_max_streams_series_params.StatisticGetMaxStreamsSeriesParams, + ), + ), + cast_to=MaxStreamSeries, + ) + + def get_meet_series( + self, + *, + from_: str, + to: str, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> MeetSeries: + """Calculates time series of the transcoding minutes of all streams. + + The data is + updated near realtime. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + granularity: specifies the time interval for grouping data + + 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( + "/streaming/statistics/meet", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "granularity": granularity, + }, + statistic_get_meet_series_params.StatisticGetMeetSeriesParams, + ), + ), + cast_to=MeetSeries, + ) + + def get_popular_videos( + self, + *, + date_from: str, + date_to: 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, + ) -> PopularVideos: + """ + Aggregates the number of views for all client videos, grouping them by id and + sort from most popular to less in the built-in player. Note. This method + operates only on data collected by the built-in HTML player. It will not show + statistics if you are using another player or viewing in native OS players + through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations through + CDN (look at method /statistics/cdn/uniqs) or statistics of the players you have + chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/streaming/statistics/popular", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_popular_videos_params.StatisticGetPopularVideosParams, + ), + ), + cast_to=PopularVideos, + ) + + def get_storage_series( + self, + *, + from_: str, + to: str, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StorageSeries: + """ + Calculates time series of the size of disk space in bytes for all processed and + undeleted client videos. The data is updated every 8 hours, it does not make + sense to set the granulation less than 1 day. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + granularity: specifies the time interval for grouping data + + 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( + "/streaming/statistics/storage", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "granularity": granularity, + }, + statistic_get_storage_series_params.StatisticGetStorageSeriesParams, + ), + ), + cast_to=StorageSeries, + ) + + def get_stream_series( + self, + *, + from_: str, + to: str, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StreamSeries: + """Calculates time series of the transcoding minutes of all streams. + + The data is + updated near realtime. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + granularity: specifies the time interval for grouping data + + 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( + "/streaming/statistics/stream", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "granularity": granularity, + }, + statistic_get_stream_series_params.StatisticGetStreamSeriesParams, + ), + ), + cast_to=StreamSeries, + ) + + def get_unique_viewers( + self, + *, + date_from: str, + date_to: str, + id: str | NotGiven = NOT_GIVEN, + country: str | NotGiven = NOT_GIVEN, + event: Literal["init", "start", "watch"] | NotGiven = NOT_GIVEN, + group: List[Literal["date", "host", "os", "browser", "platform", "ip", "country", "event", "id"]] + | NotGiven = NOT_GIVEN, + host: str | NotGiven = NOT_GIVEN, + type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UniqueViewers: + """Get the number of unique viewers in the built-in player. + + Counts the number of + unique IPs. Allows flexible grouping and filtering. The fields in the response + depend on the selected grouping. Note. This method operates only on data + collected by the built-in HTML player. It will not show statistics if you are + using another player or viewing in native OS players through direct + .m3u8/.mpd/.mp4 links. For such cases, use calculations through CDN (look at + method /statistics/cdn/uniqs) or statistics of the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + id: filter by entity's id + + country: filter by country + + event: filter by event's name + + group: group=1,2,4 OR group=1&group=2&group=3 + + host: filter by host + + type: filter by entity's type + + 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( + "/streaming/statistics/uniqs", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + "id": id, + "country": country, + "event": event, + "group": group, + "host": host, + "type": type, + }, + statistic_get_unique_viewers_params.StatisticGetUniqueViewersParams, + ), + ), + cast_to=UniqueViewers, + ) + + def get_unique_viewers_cdn( + self, + *, + date_from: str, + date_to: str, + id: str | NotGiven = NOT_GIVEN, + type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UniqueViewersCdn: + """Сounts the number of unique viewers of a video entity over CDN. + + It doesn't + matter what player you used. All unique viewers for the specified period of time + are counted. **How does it work?** Calculating the number of unique viewers for + a Live stream or VOD over CDN involves aggregating and analyzing various metrics + to ensure each individual viewer is counted only once, regardless of how many + times they connect or disconnect during the stream. This method provides + statistics for any video viewing by unique users, regardless of viewing method + and a player you used. Thus, this is the most important difference from viewing + through the built-in player: + + - In method /statistics/uniqs viewers of the built-in player are tracked only. + - But this method tracks all viewers from everywhere. This method is a + combination of two other Live and VOD detailed methods. If you need detailed + information, then see the methods: `/statistics/stream/viewers` and + `/statistics/vod/viewers`. **Data Processing and Deduplication** We us IP + Address & User-Agent combination. Each unique combination of IP address and + User-Agent string might be considered a unique viewer. This approach allows to + accurately estimate the number of unique viewers. However, this is not + foolproof due to NAT (Network Address Translation) and shared networks. Thus + if your users fall under such restrictions, then the number of unique viewers + may be higher than calculated. **Why is there no "Unique Views" method?** + Based on CDN data, we can calculate the number of unique viewers only. Thus + only your player will be able to count the number of unique views (clicks on + the Play button) within the player session (i.e. how many times 1 unique + viewer clicked the Play button within a unique player's session). + + Args: + date_from: Start of time frame. Format is date time in ISO 8601. + + date_to: End of time frame. Format is date time in ISO 8601. + + id: Filter by entity's id. Put ID of a Live stream, VOD or a playlist to be + calculated. If the value is omitted, then the calculation is done for all + videos/streams of the specified type. When using this "id" parameter, be sure to + specify the "type" parameter too. If you do not specify a type, the "id" will be + ignored. + + type: Filter by entity's type + + 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( + "/streaming/statistics/cdn/uniqs", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + "id": id, + "type": type, + }, + statistic_get_unique_viewers_cdn_params.StatisticGetUniqueViewersCdnParams, + ), + ), + cast_to=UniqueViewersCdn, + ) + + def get_views( + self, + *, + date_from: str, + date_to: str, + id: str | NotGiven = NOT_GIVEN, + country: str | NotGiven = NOT_GIVEN, + event: Literal["init", "start", "watch"] | NotGiven = NOT_GIVEN, + group: List[Literal["host", "os", "browser", "platform", "ip", "country", "event", "id"]] + | NotGiven = NOT_GIVEN, + host: str | NotGiven = NOT_GIVEN, + type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Views: + """Get the number of views in the built-in player. + + Allows flexible grouping and + filtering. The fields in the response depend on the selected grouping. Note. + This method operates only on data collected by the built-in HTML player. It will + not show statistics if you are using another player or viewing in native OS + players through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations + through CDN (look at method /statistics/cdn/uniqs) or statistics of the players + you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + id: filter by entity's id + + country: filter by country + + event: filter by event's name + + group: group=1,2,4 OR group=1&group=2&group=3 + + host: filter by host + + type: filter by entity's type + + 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( + "/streaming/statistics/views", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + "id": id, + "country": country, + "event": event, + "group": group, + "host": host, + "type": type, + }, + statistic_get_views_params.StatisticGetViewsParams, + ), + ), + cast_to=Views, + ) + + def get_views_by_browsers( + self, + *, + date_from: str, + date_to: 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, + ) -> ViewsByBrowser: + """ + Aggregates the number of views for all client videos, grouping them by browsers + in the built-in player. Note. This method operates only on data collected by the + built-in HTML player. It will not show statistics if you are using another + player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For + such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) + or statistics of the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/streaming/statistics/browsers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_views_by_browsers_params.StatisticGetViewsByBrowsersParams, + ), + ), + cast_to=ViewsByBrowser, + ) + + def get_views_by_country( + self, + *, + date_from: str, + date_to: 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, + ) -> ViewsByCountry: + """ + Aggregates the number of views grouping them by country in the built-in player. + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/streaming/statistics/countries", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_views_by_country_params.StatisticGetViewsByCountryParams, + ), + ), + cast_to=ViewsByCountry, + ) + + def get_views_by_hostname( + self, + *, + date_from: str, + date_to: 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, + ) -> ViewsByHostname: + """ + Aggregates the number of views, grouping them by "host" domain name the built-in + player was embeded to. Note. This method operates only on data collected by the + built-in HTML player. It will not show statistics if you are using another + player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For + such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) + or statistics of the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/streaming/statistics/hosts", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_views_by_hostname_params.StatisticGetViewsByHostnameParams, + ), + ), + cast_to=ViewsByHostname, + ) + + def get_views_by_operating_system( + self, + *, + date_from: str, + date_to: 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, + ) -> ViewsByOperatingSystem: + """ + Aggregates the number of views for all client videos, grouping them by device + OSs in the built-in player. Note. This method operates only on data collected by + the built-in HTML player. It will not show statistics if you are using another + player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For + such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) + or statistics of the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/streaming/statistics/systems", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_views_by_operating_system_params.StatisticGetViewsByOperatingSystemParams, + ), + ), + cast_to=ViewsByOperatingSystem, + ) + + def get_views_by_referer( + self, + *, + date_from: str, + date_to: 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, + ) -> ViewsByReferer: + """ + Aggregates the number of views, grouping them by "referer" URL of pages the + built-in player was embeded to. Note. This method operates only on data + collected by the built-in HTML player. It will not show statistics if you are + using another player or viewing in native OS players through direct + .m3u8/.mpd/.mp4 links. For such cases, use calculations through CDN (look at + method /statistics/cdn/uniqs) or statistics of the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/streaming/statistics/embeds", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_views_by_referer_params.StatisticGetViewsByRefererParams, + ), + ), + cast_to=ViewsByReferer, + ) + + def get_views_by_region( + self, + *, + date_from: str, + date_to: 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, + ) -> ViewsByRegion: + """ + Aggregates the number of views grouping them by regions of countries in the + built-in player. Note. This method operates only on data collected by the + built-in HTML player. It will not show statistics if you are using another + player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For + such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) + or statistics of the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/streaming/statistics/regions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_views_by_region_params.StatisticGetViewsByRegionParams, + ), + ), + cast_to=ViewsByRegion, + ) + + def get_views_heatmap( + self, + *, + date_from: str, + date_to: str, + stream_id: str, + type: Literal["live", "vod", "playlist"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ViewsHeatmap: + """ + Shows information about what part of the video your viewers watched in the + built-in player. This way you can find out how many viewers started watching the + video, and where they stopped watching instead of watching the entire video to + the end. Has different format of response depends on query param "type". Note. + This method operates only on data collected by the built-in HTML player. It will + not show statistics if you are using another player or viewing in native OS + players through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations + through CDN (look at method /statistics/cdn/uniqs) or statistics of the players + you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + stream_id: video streaming ID + + type: entity's type + + 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( + "/streaming/statistics/heatmap", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + "stream_id": stream_id, + "type": type, + }, + statistic_get_views_heatmap_params.StatisticGetViewsHeatmapParams, + ), + ), + cast_to=ViewsHeatmap, + ) + + def get_vod_storage_volume( + self, + *, + from_: str, + to: 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, + ) -> VodStatisticsSeries: + """ + Calculates time series of the duration in minutes for all processed and + undeleted client videos. The data is updated every 8 hours, it does not make + sense to set the granulation less than 1 day. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/streaming/statistics/vod/storage_duration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + }, + statistic_get_vod_storage_volume_params.StatisticGetVodStorageVolumeParams, + ), + ), + cast_to=VodStatisticsSeries, + ) + + def get_vod_transcoding_duration( + self, + *, + from_: str, + to: 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, + ) -> VodStatisticsSeries: + """ + Calculates time series of the transcoding time in minutes for all processed + client videos. The data is updated every 8 hours, it does not make sense to set + the granulation less than 1 day. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/streaming/statistics/vod/transcoding_duration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + }, + statistic_get_vod_transcoding_duration_params.StatisticGetVodTranscodingDurationParams, + ), + ), + cast_to=VodStatisticsSeries, + ) + + def get_vod_unique_viewers_cdn( + self, + *, + from_: str, + to: str, + client_user_id: int | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + slug: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VodStatisticsSeries: + """Calculates time series of unique viewers of VOD via CDN. + + The statistics are + taken from the data of CDN and work regardless of which player the views were + made with. Works similar to the method `/statistics/cdn/uniqs`. But this allows + you to break down data with the specified granularity: minutes, hours, days. + Based on this method, a graph of unique views in the Customer Portal is built. + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/`cdn_unique_viewers`.png) + + Args: + from_: Start of time frame. Format is date time in ISO 8601 + + to: End of time frame. Format is date time in ISO 8601 + + client_user_id: Filter by user "id" + + granularity: Specifies the time interval for grouping data + + slug: Filter by video "slug" + + 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( + "/streaming/statistics/vod/viewers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "client_user_id": client_user_id, + "granularity": granularity, + "slug": slug, + }, + statistic_get_vod_unique_viewers_cdn_params.StatisticGetVodUniqueViewersCdnParams, + ), + ), + cast_to=VodStatisticsSeries, + ) + + def get_vod_watch_time_cdn( + self, + *, + from_: str, + client_user_id: int | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | NotGiven = NOT_GIVEN, + slug: str | NotGiven = NOT_GIVEN, + to: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VodStatisticsSeries: + """Calculates a time series of video watching duration in minutes. + + Views of only + those videos that meet the specified filters are summed up. The statistics are + taken from the data of CDN and work regardless of which player the views were + made with. Please note that the result for each time interval is in minutes, it + is rounded to the nearest upper integer. You cannot use the sum of all intervals + as the total watch time value; instead, use the /total method. + + Args: + from_: Start of the time period for counting minutes of watching. Format is date time + in ISO 8601. + + client_user_id: Filter by field "`client_user_id`" + + granularity: Data is grouped by the specified time interval + + slug: Filter by video's slug + + to: End of time frame. Datetime in ISO 8601 format. If omitted, then the current + time is taken. + + 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( + "/streaming/statistics/vod/watching_duration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "client_user_id": client_user_id, + "granularity": granularity, + "slug": slug, + "to": to, + }, + statistic_get_vod_watch_time_cdn_params.StatisticGetVodWatchTimeCdnParams, + ), + ), + cast_to=VodStatisticsSeries, + ) + + def get_vod_watch_time_total_cdn( + self, + *, + client_user_id: int | NotGiven = NOT_GIVEN, + from_: str | NotGiven = NOT_GIVEN, + slug: str | NotGiven = NOT_GIVEN, + to: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StatisticGetVodWatchTimeTotalCdnResponse: + """Calculates the total duration of video watching in minutes. + + Views of only those + videos that meet the specified filters are summed up. The statistics are taken + from the data of CDN and work regardless of which player the views were made + with. + + Args: + client_user_id: Filter by field "`client_user_id`" + + from_: Start of the time period for counting minutes of watching. Format is date time + in ISO 8601. If omitted, the earliest start time for viewing is taken + + slug: Filter by video's slug + + to: End of time frame. Datetime in ISO 8601 format. If omitted, then the current + time is taken + + 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( + "/streaming/statistics/vod/watching_duration/total", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "client_user_id": client_user_id, + "from_": from_, + "slug": slug, + "to": to, + }, + statistic_get_vod_watch_time_total_cdn_params.StatisticGetVodWatchTimeTotalCdnParams, + ), + ), + cast_to=StatisticGetVodWatchTimeTotalCdnResponse, + ) + + +class AsyncStatisticsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncStatisticsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncStatisticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStatisticsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncStatisticsResourceWithStreamingResponse(self) + + async def get_ffprobes( + self, + *, + date_from: str, + date_to: str, + stream_id: str, + interval: int | NotGiven = NOT_GIVEN, + units: Literal["second", "minute", "hour", "day", "week", "month"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Ffprobes: + """ + Aggregates data for the specified video stream in the specified time interval. + "interval" and "units" params working together to point aggregation interval. + You can use this method to watch when stream was alive in time, and when it was + off. + + Args: + date_from: Start of time frame. Format is ISO 8601. + + date_to: End of time frame. Datetime in ISO 8601 format. + + stream_id: Stream ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/streaming/statistics/ffprobe", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + "stream_id": stream_id, + "interval": interval, + "units": units, + }, + statistic_get_ffprobes_params.StatisticGetFfprobesParams, + ), + ), + cast_to=Ffprobes, + ) + + async def get_live_unique_viewers( + self, + *, + from_: str, + to: str, + client_user_id: int | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + stream_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StatisticGetLiveUniqueViewersResponse: + """Calculates time series of unique viewers of Live streams via CDN. + + The statistics + are taken from the data of CDN and work regardless of which player the views + were made with. Works similar to the method `/statistics/cdn/uniqs`. But this + allows you to break down data with the specified granularity: minutes, hours, + days. Based on this method, a graph of unique views in the Customer Portal is + built. + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/`cdn_unique_viewers`.png) + + Args: + from_: Start of time frame. Format is date time in ISO 8601 + + to: End of time frame. Format is date time in ISO 8601 + + client_user_id: Filter by "`client_user_id`" + + granularity: Specifies the time interval for grouping data + + stream_id: Filter by "`stream_id`" + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/streaming/statistics/stream/viewers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "client_user_id": client_user_id, + "granularity": granularity, + "stream_id": stream_id, + }, + statistic_get_live_unique_viewers_params.StatisticGetLiveUniqueViewersParams, + ), + ), + cast_to=StatisticGetLiveUniqueViewersResponse, + ) + + async def get_live_watch_time_cdn( + self, + *, + from_: str, + client_user_id: int | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | NotGiven = NOT_GIVEN, + stream_id: int | NotGiven = NOT_GIVEN, + to: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StreamSeries: + """Calculates a time series of live streams watching duration in minutes. + + Views of + only those streams that meet the specified filters are summed up. The statistics + are taken from the data of CDN and work regardless of which player the views + were made with. Please note that the result for each time interval is in + minutes, it is rounded to the nearest upper integer. You cannot use the sum of + all intervals as the total watch time value; instead, use the /total method. + + Args: + from_: Start of the time period for counting minutes of watching. Format is date time + in ISO 8601. + + client_user_id: Filter by field "`client_user_id`" + + granularity: Data is grouped by the specified time interval + + stream_id: Filter by `stream_id` + + to: End of time frame. Datetime in ISO 8601 format. If omitted, then the current + time is taken + + 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( + "/streaming/statistics/stream/watching_duration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "client_user_id": client_user_id, + "granularity": granularity, + "stream_id": stream_id, + "to": to, + }, + statistic_get_live_watch_time_cdn_params.StatisticGetLiveWatchTimeCdnParams, + ), + ), + cast_to=StreamSeries, + ) + + async def get_live_watch_time_total_cdn( + self, + *, + client_user_id: int | NotGiven = NOT_GIVEN, + from_: str | NotGiven = NOT_GIVEN, + stream_id: int | NotGiven = NOT_GIVEN, + to: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VodTotalStreamDurationSeries: + """Calculates the total duration of live streams watching in minutes. + + Views of only + those streams that meet the specified filters are summed up. The statistics are + taken from the data of CDN and work regardless of which player the views were + made with. + + Args: + client_user_id: Filter by field "`client_user_id`" + + from_: Start of the time period for counting minutes of watching. Format is date time + in ISO 8601. If omitted, the earliest start time for viewing is taken + + stream_id: Filter by `stream_id` + + to: End of time frame. Datetime in ISO 8601 format. If missed, then the current time + is taken + + 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( + "/streaming/statistics/stream/watching_duration/total", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "client_user_id": client_user_id, + "from_": from_, + "stream_id": stream_id, + "to": to, + }, + statistic_get_live_watch_time_total_cdn_params.StatisticGetLiveWatchTimeTotalCdnParams, + ), + ), + cast_to=VodTotalStreamDurationSeries, + ) + + async def get_max_streams_series( + self, + *, + from_: str, + to: str, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> MaxStreamSeries: + """Calculates time series of the amount of simultaneous streams. + + The data is + updated near realtime. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + granularity: specifies the time interval for grouping data + + 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( + "/streaming/statistics/max_stream", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "granularity": granularity, + }, + statistic_get_max_streams_series_params.StatisticGetMaxStreamsSeriesParams, + ), + ), + cast_to=MaxStreamSeries, + ) + + async def get_meet_series( + self, + *, + from_: str, + to: str, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> MeetSeries: + """Calculates time series of the transcoding minutes of all streams. + + The data is + updated near realtime. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + granularity: specifies the time interval for grouping data + + 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( + "/streaming/statistics/meet", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "granularity": granularity, + }, + statistic_get_meet_series_params.StatisticGetMeetSeriesParams, + ), + ), + cast_to=MeetSeries, + ) + + async def get_popular_videos( + self, + *, + date_from: str, + date_to: 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, + ) -> PopularVideos: + """ + Aggregates the number of views for all client videos, grouping them by id and + sort from most popular to less in the built-in player. Note. This method + operates only on data collected by the built-in HTML player. It will not show + statistics if you are using another player or viewing in native OS players + through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations through + CDN (look at method /statistics/cdn/uniqs) or statistics of the players you have + chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/streaming/statistics/popular", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_popular_videos_params.StatisticGetPopularVideosParams, + ), + ), + cast_to=PopularVideos, + ) + + async def get_storage_series( + self, + *, + from_: str, + to: str, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StorageSeries: + """ + Calculates time series of the size of disk space in bytes for all processed and + undeleted client videos. The data is updated every 8 hours, it does not make + sense to set the granulation less than 1 day. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + granularity: specifies the time interval for grouping data + + 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( + "/streaming/statistics/storage", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "granularity": granularity, + }, + statistic_get_storage_series_params.StatisticGetStorageSeriesParams, + ), + ), + cast_to=StorageSeries, + ) + + async def get_stream_series( + self, + *, + from_: str, + to: str, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StreamSeries: + """Calculates time series of the transcoding minutes of all streams. + + The data is + updated near realtime. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + granularity: specifies the time interval for grouping data + + 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( + "/streaming/statistics/stream", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "granularity": granularity, + }, + statistic_get_stream_series_params.StatisticGetStreamSeriesParams, + ), + ), + cast_to=StreamSeries, + ) + + async def get_unique_viewers( + self, + *, + date_from: str, + date_to: str, + id: str | NotGiven = NOT_GIVEN, + country: str | NotGiven = NOT_GIVEN, + event: Literal["init", "start", "watch"] | NotGiven = NOT_GIVEN, + group: List[Literal["date", "host", "os", "browser", "platform", "ip", "country", "event", "id"]] + | NotGiven = NOT_GIVEN, + host: str | NotGiven = NOT_GIVEN, + type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UniqueViewers: + """Get the number of unique viewers in the built-in player. + + Counts the number of + unique IPs. Allows flexible grouping and filtering. The fields in the response + depend on the selected grouping. Note. This method operates only on data + collected by the built-in HTML player. It will not show statistics if you are + using another player or viewing in native OS players through direct + .m3u8/.mpd/.mp4 links. For such cases, use calculations through CDN (look at + method /statistics/cdn/uniqs) or statistics of the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + id: filter by entity's id + + country: filter by country + + event: filter by event's name + + group: group=1,2,4 OR group=1&group=2&group=3 + + host: filter by host + + type: filter by entity's type + + 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( + "/streaming/statistics/uniqs", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + "id": id, + "country": country, + "event": event, + "group": group, + "host": host, + "type": type, + }, + statistic_get_unique_viewers_params.StatisticGetUniqueViewersParams, + ), + ), + cast_to=UniqueViewers, + ) + + async def get_unique_viewers_cdn( + self, + *, + date_from: str, + date_to: str, + id: str | NotGiven = NOT_GIVEN, + type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UniqueViewersCdn: + """Сounts the number of unique viewers of a video entity over CDN. + + It doesn't + matter what player you used. All unique viewers for the specified period of time + are counted. **How does it work?** Calculating the number of unique viewers for + a Live stream or VOD over CDN involves aggregating and analyzing various metrics + to ensure each individual viewer is counted only once, regardless of how many + times they connect or disconnect during the stream. This method provides + statistics for any video viewing by unique users, regardless of viewing method + and a player you used. Thus, this is the most important difference from viewing + through the built-in player: + + - In method /statistics/uniqs viewers of the built-in player are tracked only. + - But this method tracks all viewers from everywhere. This method is a + combination of two other Live and VOD detailed methods. If you need detailed + information, then see the methods: `/statistics/stream/viewers` and + `/statistics/vod/viewers`. **Data Processing and Deduplication** We us IP + Address & User-Agent combination. Each unique combination of IP address and + User-Agent string might be considered a unique viewer. This approach allows to + accurately estimate the number of unique viewers. However, this is not + foolproof due to NAT (Network Address Translation) and shared networks. Thus + if your users fall under such restrictions, then the number of unique viewers + may be higher than calculated. **Why is there no "Unique Views" method?** + Based on CDN data, we can calculate the number of unique viewers only. Thus + only your player will be able to count the number of unique views (clicks on + the Play button) within the player session (i.e. how many times 1 unique + viewer clicked the Play button within a unique player's session). + + Args: + date_from: Start of time frame. Format is date time in ISO 8601. + + date_to: End of time frame. Format is date time in ISO 8601. + + id: Filter by entity's id. Put ID of a Live stream, VOD or a playlist to be + calculated. If the value is omitted, then the calculation is done for all + videos/streams of the specified type. When using this "id" parameter, be sure to + specify the "type" parameter too. If you do not specify a type, the "id" will be + ignored. + + type: Filter by entity's type + + 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( + "/streaming/statistics/cdn/uniqs", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + "id": id, + "type": type, + }, + statistic_get_unique_viewers_cdn_params.StatisticGetUniqueViewersCdnParams, + ), + ), + cast_to=UniqueViewersCdn, + ) + + async def get_views( + self, + *, + date_from: str, + date_to: str, + id: str | NotGiven = NOT_GIVEN, + country: str | NotGiven = NOT_GIVEN, + event: Literal["init", "start", "watch"] | NotGiven = NOT_GIVEN, + group: List[Literal["host", "os", "browser", "platform", "ip", "country", "event", "id"]] + | NotGiven = NOT_GIVEN, + host: str | NotGiven = NOT_GIVEN, + type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Views: + """Get the number of views in the built-in player. + + Allows flexible grouping and + filtering. The fields in the response depend on the selected grouping. Note. + This method operates only on data collected by the built-in HTML player. It will + not show statistics if you are using another player or viewing in native OS + players through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations + through CDN (look at method /statistics/cdn/uniqs) or statistics of the players + you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + id: filter by entity's id + + country: filter by country + + event: filter by event's name + + group: group=1,2,4 OR group=1&group=2&group=3 + + host: filter by host + + type: filter by entity's type + + 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( + "/streaming/statistics/views", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + "id": id, + "country": country, + "event": event, + "group": group, + "host": host, + "type": type, + }, + statistic_get_views_params.StatisticGetViewsParams, + ), + ), + cast_to=Views, + ) + + async def get_views_by_browsers( + self, + *, + date_from: str, + date_to: 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, + ) -> ViewsByBrowser: + """ + Aggregates the number of views for all client videos, grouping them by browsers + in the built-in player. Note. This method operates only on data collected by the + built-in HTML player. It will not show statistics if you are using another + player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For + such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) + or statistics of the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/streaming/statistics/browsers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_views_by_browsers_params.StatisticGetViewsByBrowsersParams, + ), + ), + cast_to=ViewsByBrowser, + ) + + async def get_views_by_country( + self, + *, + date_from: str, + date_to: 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, + ) -> ViewsByCountry: + """ + Aggregates the number of views grouping them by country in the built-in player. + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/streaming/statistics/countries", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_views_by_country_params.StatisticGetViewsByCountryParams, + ), + ), + cast_to=ViewsByCountry, + ) + + async def get_views_by_hostname( + self, + *, + date_from: str, + date_to: 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, + ) -> ViewsByHostname: + """ + Aggregates the number of views, grouping them by "host" domain name the built-in + player was embeded to. Note. This method operates only on data collected by the + built-in HTML player. It will not show statistics if you are using another + player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For + such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) + or statistics of the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/streaming/statistics/hosts", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_views_by_hostname_params.StatisticGetViewsByHostnameParams, + ), + ), + cast_to=ViewsByHostname, + ) + + async def get_views_by_operating_system( + self, + *, + date_from: str, + date_to: 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, + ) -> ViewsByOperatingSystem: + """ + Aggregates the number of views for all client videos, grouping them by device + OSs in the built-in player. Note. This method operates only on data collected by + the built-in HTML player. It will not show statistics if you are using another + player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For + such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) + or statistics of the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/streaming/statistics/systems", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_views_by_operating_system_params.StatisticGetViewsByOperatingSystemParams, + ), + ), + cast_to=ViewsByOperatingSystem, + ) + + async def get_views_by_referer( + self, + *, + date_from: str, + date_to: 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, + ) -> ViewsByReferer: + """ + Aggregates the number of views, grouping them by "referer" URL of pages the + built-in player was embeded to. Note. This method operates only on data + collected by the built-in HTML player. It will not show statistics if you are + using another player or viewing in native OS players through direct + .m3u8/.mpd/.mp4 links. For such cases, use calculations through CDN (look at + method /statistics/cdn/uniqs) or statistics of the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/streaming/statistics/embeds", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_views_by_referer_params.StatisticGetViewsByRefererParams, + ), + ), + cast_to=ViewsByReferer, + ) + + async def get_views_by_region( + self, + *, + date_from: str, + date_to: 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, + ) -> ViewsByRegion: + """ + Aggregates the number of views grouping them by regions of countries in the + built-in player. Note. This method operates only on data collected by the + built-in HTML player. It will not show statistics if you are using another + player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For + such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) + or statistics of the players you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/streaming/statistics/regions", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + }, + statistic_get_views_by_region_params.StatisticGetViewsByRegionParams, + ), + ), + cast_to=ViewsByRegion, + ) + + async def get_views_heatmap( + self, + *, + date_from: str, + date_to: str, + stream_id: str, + type: Literal["live", "vod", "playlist"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ViewsHeatmap: + """ + Shows information about what part of the video your viewers watched in the + built-in player. This way you can find out how many viewers started watching the + video, and where they stopped watching instead of watching the entire video to + the end. Has different format of response depends on query param "type". Note. + This method operates only on data collected by the built-in HTML player. It will + not show statistics if you are using another player or viewing in native OS + players through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations + through CDN (look at method /statistics/cdn/uniqs) or statistics of the players + you have chosen. + + Args: + date_from: Start of time frame. Datetime in ISO 8601 format. + + date_to: End of time frame. Datetime in ISO 8601 format. + + stream_id: video streaming ID + + type: entity's type + + 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( + "/streaming/statistics/heatmap", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "date_from": date_from, + "date_to": date_to, + "stream_id": stream_id, + "type": type, + }, + statistic_get_views_heatmap_params.StatisticGetViewsHeatmapParams, + ), + ), + cast_to=ViewsHeatmap, + ) + + async def get_vod_storage_volume( + self, + *, + from_: str, + to: 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, + ) -> VodStatisticsSeries: + """ + Calculates time series of the duration in minutes for all processed and + undeleted client videos. The data is updated every 8 hours, it does not make + sense to set the granulation less than 1 day. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/streaming/statistics/vod/storage_duration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + }, + statistic_get_vod_storage_volume_params.StatisticGetVodStorageVolumeParams, + ), + ), + cast_to=VodStatisticsSeries, + ) + + async def get_vod_transcoding_duration( + self, + *, + from_: str, + to: 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, + ) -> VodStatisticsSeries: + """ + Calculates time series of the transcoding time in minutes for all processed + client videos. The data is updated every 8 hours, it does not make sense to set + the granulation less than 1 day. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/streaming/statistics/vod/transcoding_duration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + }, + statistic_get_vod_transcoding_duration_params.StatisticGetVodTranscodingDurationParams, + ), + ), + cast_to=VodStatisticsSeries, + ) + + async def get_vod_unique_viewers_cdn( + self, + *, + from_: str, + to: str, + client_user_id: int | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + slug: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VodStatisticsSeries: + """Calculates time series of unique viewers of VOD via CDN. + + The statistics are + taken from the data of CDN and work regardless of which player the views were + made with. Works similar to the method `/statistics/cdn/uniqs`. But this allows + you to break down data with the specified granularity: minutes, hours, days. + Based on this method, a graph of unique views in the Customer Portal is built. + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/`cdn_unique_viewers`.png) + + Args: + from_: Start of time frame. Format is date time in ISO 8601 + + to: End of time frame. Format is date time in ISO 8601 + + client_user_id: Filter by user "id" + + granularity: Specifies the time interval for grouping data + + slug: Filter by video "slug" + + 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( + "/streaming/statistics/vod/viewers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "client_user_id": client_user_id, + "granularity": granularity, + "slug": slug, + }, + statistic_get_vod_unique_viewers_cdn_params.StatisticGetVodUniqueViewersCdnParams, + ), + ), + cast_to=VodStatisticsSeries, + ) + + async def get_vod_watch_time_cdn( + self, + *, + from_: str, + client_user_id: int | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | NotGiven = NOT_GIVEN, + slug: str | NotGiven = NOT_GIVEN, + to: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VodStatisticsSeries: + """Calculates a time series of video watching duration in minutes. + + Views of only + those videos that meet the specified filters are summed up. The statistics are + taken from the data of CDN and work regardless of which player the views were + made with. Please note that the result for each time interval is in minutes, it + is rounded to the nearest upper integer. You cannot use the sum of all intervals + as the total watch time value; instead, use the /total method. + + Args: + from_: Start of the time period for counting minutes of watching. Format is date time + in ISO 8601. + + client_user_id: Filter by field "`client_user_id`" + + granularity: Data is grouped by the specified time interval + + slug: Filter by video's slug + + to: End of time frame. Datetime in ISO 8601 format. If omitted, then the current + time is taken. + + 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( + "/streaming/statistics/vod/watching_duration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "client_user_id": client_user_id, + "granularity": granularity, + "slug": slug, + "to": to, + }, + statistic_get_vod_watch_time_cdn_params.StatisticGetVodWatchTimeCdnParams, + ), + ), + cast_to=VodStatisticsSeries, + ) + + async def get_vod_watch_time_total_cdn( + self, + *, + client_user_id: int | NotGiven = NOT_GIVEN, + from_: str | NotGiven = NOT_GIVEN, + slug: str | NotGiven = NOT_GIVEN, + to: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StatisticGetVodWatchTimeTotalCdnResponse: + """Calculates the total duration of video watching in minutes. + + Views of only those + videos that meet the specified filters are summed up. The statistics are taken + from the data of CDN and work regardless of which player the views were made + with. + + Args: + client_user_id: Filter by field "`client_user_id`" + + from_: Start of the time period for counting minutes of watching. Format is date time + in ISO 8601. If omitted, the earliest start time for viewing is taken + + slug: Filter by video's slug + + to: End of time frame. Datetime in ISO 8601 format. If omitted, then the current + time is taken + + 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( + "/streaming/statistics/vod/watching_duration/total", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "client_user_id": client_user_id, + "from_": from_, + "slug": slug, + "to": to, + }, + statistic_get_vod_watch_time_total_cdn_params.StatisticGetVodWatchTimeTotalCdnParams, + ), + ), + cast_to=StatisticGetVodWatchTimeTotalCdnResponse, + ) + + +class StatisticsResourceWithRawResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics + + self.get_ffprobes = to_raw_response_wrapper( + statistics.get_ffprobes, + ) + self.get_live_unique_viewers = to_raw_response_wrapper( + statistics.get_live_unique_viewers, + ) + self.get_live_watch_time_cdn = to_raw_response_wrapper( + statistics.get_live_watch_time_cdn, + ) + self.get_live_watch_time_total_cdn = to_raw_response_wrapper( + statistics.get_live_watch_time_total_cdn, + ) + self.get_max_streams_series = to_raw_response_wrapper( + statistics.get_max_streams_series, + ) + self.get_meet_series = to_raw_response_wrapper( + statistics.get_meet_series, + ) + self.get_popular_videos = to_raw_response_wrapper( + statistics.get_popular_videos, + ) + self.get_storage_series = to_raw_response_wrapper( + statistics.get_storage_series, + ) + self.get_stream_series = to_raw_response_wrapper( + statistics.get_stream_series, + ) + self.get_unique_viewers = to_raw_response_wrapper( + statistics.get_unique_viewers, + ) + self.get_unique_viewers_cdn = to_raw_response_wrapper( + statistics.get_unique_viewers_cdn, + ) + self.get_views = to_raw_response_wrapper( + statistics.get_views, + ) + self.get_views_by_browsers = to_raw_response_wrapper( + statistics.get_views_by_browsers, + ) + self.get_views_by_country = to_raw_response_wrapper( + statistics.get_views_by_country, + ) + self.get_views_by_hostname = to_raw_response_wrapper( + statistics.get_views_by_hostname, + ) + self.get_views_by_operating_system = to_raw_response_wrapper( + statistics.get_views_by_operating_system, + ) + self.get_views_by_referer = to_raw_response_wrapper( + statistics.get_views_by_referer, + ) + self.get_views_by_region = to_raw_response_wrapper( + statistics.get_views_by_region, + ) + self.get_views_heatmap = to_raw_response_wrapper( + statistics.get_views_heatmap, + ) + self.get_vod_storage_volume = to_raw_response_wrapper( + statistics.get_vod_storage_volume, + ) + self.get_vod_transcoding_duration = to_raw_response_wrapper( + statistics.get_vod_transcoding_duration, + ) + self.get_vod_unique_viewers_cdn = to_raw_response_wrapper( + statistics.get_vod_unique_viewers_cdn, + ) + self.get_vod_watch_time_cdn = to_raw_response_wrapper( + statistics.get_vod_watch_time_cdn, + ) + self.get_vod_watch_time_total_cdn = to_raw_response_wrapper( + statistics.get_vod_watch_time_total_cdn, + ) + + +class AsyncStatisticsResourceWithRawResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics + + self.get_ffprobes = async_to_raw_response_wrapper( + statistics.get_ffprobes, + ) + self.get_live_unique_viewers = async_to_raw_response_wrapper( + statistics.get_live_unique_viewers, + ) + self.get_live_watch_time_cdn = async_to_raw_response_wrapper( + statistics.get_live_watch_time_cdn, + ) + self.get_live_watch_time_total_cdn = async_to_raw_response_wrapper( + statistics.get_live_watch_time_total_cdn, + ) + self.get_max_streams_series = async_to_raw_response_wrapper( + statistics.get_max_streams_series, + ) + self.get_meet_series = async_to_raw_response_wrapper( + statistics.get_meet_series, + ) + self.get_popular_videos = async_to_raw_response_wrapper( + statistics.get_popular_videos, + ) + self.get_storage_series = async_to_raw_response_wrapper( + statistics.get_storage_series, + ) + self.get_stream_series = async_to_raw_response_wrapper( + statistics.get_stream_series, + ) + self.get_unique_viewers = async_to_raw_response_wrapper( + statistics.get_unique_viewers, + ) + self.get_unique_viewers_cdn = async_to_raw_response_wrapper( + statistics.get_unique_viewers_cdn, + ) + self.get_views = async_to_raw_response_wrapper( + statistics.get_views, + ) + self.get_views_by_browsers = async_to_raw_response_wrapper( + statistics.get_views_by_browsers, + ) + self.get_views_by_country = async_to_raw_response_wrapper( + statistics.get_views_by_country, + ) + self.get_views_by_hostname = async_to_raw_response_wrapper( + statistics.get_views_by_hostname, + ) + self.get_views_by_operating_system = async_to_raw_response_wrapper( + statistics.get_views_by_operating_system, + ) + self.get_views_by_referer = async_to_raw_response_wrapper( + statistics.get_views_by_referer, + ) + self.get_views_by_region = async_to_raw_response_wrapper( + statistics.get_views_by_region, + ) + self.get_views_heatmap = async_to_raw_response_wrapper( + statistics.get_views_heatmap, + ) + self.get_vod_storage_volume = async_to_raw_response_wrapper( + statistics.get_vod_storage_volume, + ) + self.get_vod_transcoding_duration = async_to_raw_response_wrapper( + statistics.get_vod_transcoding_duration, + ) + self.get_vod_unique_viewers_cdn = async_to_raw_response_wrapper( + statistics.get_vod_unique_viewers_cdn, + ) + self.get_vod_watch_time_cdn = async_to_raw_response_wrapper( + statistics.get_vod_watch_time_cdn, + ) + self.get_vod_watch_time_total_cdn = async_to_raw_response_wrapper( + statistics.get_vod_watch_time_total_cdn, + ) + + +class StatisticsResourceWithStreamingResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics + + self.get_ffprobes = to_streamed_response_wrapper( + statistics.get_ffprobes, + ) + self.get_live_unique_viewers = to_streamed_response_wrapper( + statistics.get_live_unique_viewers, + ) + self.get_live_watch_time_cdn = to_streamed_response_wrapper( + statistics.get_live_watch_time_cdn, + ) + self.get_live_watch_time_total_cdn = to_streamed_response_wrapper( + statistics.get_live_watch_time_total_cdn, + ) + self.get_max_streams_series = to_streamed_response_wrapper( + statistics.get_max_streams_series, + ) + self.get_meet_series = to_streamed_response_wrapper( + statistics.get_meet_series, + ) + self.get_popular_videos = to_streamed_response_wrapper( + statistics.get_popular_videos, + ) + self.get_storage_series = to_streamed_response_wrapper( + statistics.get_storage_series, + ) + self.get_stream_series = to_streamed_response_wrapper( + statistics.get_stream_series, + ) + self.get_unique_viewers = to_streamed_response_wrapper( + statistics.get_unique_viewers, + ) + self.get_unique_viewers_cdn = to_streamed_response_wrapper( + statistics.get_unique_viewers_cdn, + ) + self.get_views = to_streamed_response_wrapper( + statistics.get_views, + ) + self.get_views_by_browsers = to_streamed_response_wrapper( + statistics.get_views_by_browsers, + ) + self.get_views_by_country = to_streamed_response_wrapper( + statistics.get_views_by_country, + ) + self.get_views_by_hostname = to_streamed_response_wrapper( + statistics.get_views_by_hostname, + ) + self.get_views_by_operating_system = to_streamed_response_wrapper( + statistics.get_views_by_operating_system, + ) + self.get_views_by_referer = to_streamed_response_wrapper( + statistics.get_views_by_referer, + ) + self.get_views_by_region = to_streamed_response_wrapper( + statistics.get_views_by_region, + ) + self.get_views_heatmap = to_streamed_response_wrapper( + statistics.get_views_heatmap, + ) + self.get_vod_storage_volume = to_streamed_response_wrapper( + statistics.get_vod_storage_volume, + ) + self.get_vod_transcoding_duration = to_streamed_response_wrapper( + statistics.get_vod_transcoding_duration, + ) + self.get_vod_unique_viewers_cdn = to_streamed_response_wrapper( + statistics.get_vod_unique_viewers_cdn, + ) + self.get_vod_watch_time_cdn = to_streamed_response_wrapper( + statistics.get_vod_watch_time_cdn, + ) + self.get_vod_watch_time_total_cdn = to_streamed_response_wrapper( + statistics.get_vod_watch_time_total_cdn, + ) + + +class AsyncStatisticsResourceWithStreamingResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics + + self.get_ffprobes = async_to_streamed_response_wrapper( + statistics.get_ffprobes, + ) + self.get_live_unique_viewers = async_to_streamed_response_wrapper( + statistics.get_live_unique_viewers, + ) + self.get_live_watch_time_cdn = async_to_streamed_response_wrapper( + statistics.get_live_watch_time_cdn, + ) + self.get_live_watch_time_total_cdn = async_to_streamed_response_wrapper( + statistics.get_live_watch_time_total_cdn, + ) + self.get_max_streams_series = async_to_streamed_response_wrapper( + statistics.get_max_streams_series, + ) + self.get_meet_series = async_to_streamed_response_wrapper( + statistics.get_meet_series, + ) + self.get_popular_videos = async_to_streamed_response_wrapper( + statistics.get_popular_videos, + ) + self.get_storage_series = async_to_streamed_response_wrapper( + statistics.get_storage_series, + ) + self.get_stream_series = async_to_streamed_response_wrapper( + statistics.get_stream_series, + ) + self.get_unique_viewers = async_to_streamed_response_wrapper( + statistics.get_unique_viewers, + ) + self.get_unique_viewers_cdn = async_to_streamed_response_wrapper( + statistics.get_unique_viewers_cdn, + ) + self.get_views = async_to_streamed_response_wrapper( + statistics.get_views, + ) + self.get_views_by_browsers = async_to_streamed_response_wrapper( + statistics.get_views_by_browsers, + ) + self.get_views_by_country = async_to_streamed_response_wrapper( + statistics.get_views_by_country, + ) + self.get_views_by_hostname = async_to_streamed_response_wrapper( + statistics.get_views_by_hostname, + ) + self.get_views_by_operating_system = async_to_streamed_response_wrapper( + statistics.get_views_by_operating_system, + ) + self.get_views_by_referer = async_to_streamed_response_wrapper( + statistics.get_views_by_referer, + ) + self.get_views_by_region = async_to_streamed_response_wrapper( + statistics.get_views_by_region, + ) + self.get_views_heatmap = async_to_streamed_response_wrapper( + statistics.get_views_heatmap, + ) + self.get_vod_storage_volume = async_to_streamed_response_wrapper( + statistics.get_vod_storage_volume, + ) + self.get_vod_transcoding_duration = async_to_streamed_response_wrapper( + statistics.get_vod_transcoding_duration, + ) + self.get_vod_unique_viewers_cdn = async_to_streamed_response_wrapper( + statistics.get_vod_unique_viewers_cdn, + ) + self.get_vod_watch_time_cdn = async_to_streamed_response_wrapper( + statistics.get_vod_watch_time_cdn, + ) + self.get_vod_watch_time_total_cdn = async_to_streamed_response_wrapper( + statistics.get_vod_watch_time_total_cdn, + ) diff --git a/src/gcore/resources/streaming/streaming.py b/src/gcore/resources/streaming/streaming.py new file mode 100644 index 00000000..11e18d2b --- /dev/null +++ b/src/gcore/resources/streaming/streaming.py @@ -0,0 +1,390 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .players import ( + PlayersResource, + AsyncPlayersResource, + PlayersResourceWithRawResponse, + AsyncPlayersResourceWithRawResponse, + PlayersResourceWithStreamingResponse, + AsyncPlayersResourceWithStreamingResponse, +) +from .ai_tasks import ( + AITasksResource, + AsyncAITasksResource, + AITasksResourceWithRawResponse, + AsyncAITasksResourceWithRawResponse, + AITasksResourceWithStreamingResponse, + AsyncAITasksResourceWithStreamingResponse, +) +from ..._compat import cached_property +from .playlists import ( + PlaylistsResource, + AsyncPlaylistsResource, + PlaylistsResourceWithRawResponse, + AsyncPlaylistsResourceWithRawResponse, + PlaylistsResourceWithStreamingResponse, + AsyncPlaylistsResourceWithStreamingResponse, +) +from .restreams import ( + RestreamsResource, + AsyncRestreamsResource, + RestreamsResourceWithRawResponse, + AsyncRestreamsResourceWithRawResponse, + RestreamsResourceWithStreamingResponse, + AsyncRestreamsResourceWithStreamingResponse, +) +from .broadcasts import ( + BroadcastsResource, + AsyncBroadcastsResource, + BroadcastsResourceWithRawResponse, + AsyncBroadcastsResourceWithRawResponse, + BroadcastsResourceWithStreamingResponse, + AsyncBroadcastsResourceWithStreamingResponse, +) +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) +from ..._resource import SyncAPIResource, AsyncAPIResource +from .directories import ( + DirectoriesResource, + AsyncDirectoriesResource, + DirectoriesResourceWithRawResponse, + AsyncDirectoriesResourceWithRawResponse, + DirectoriesResourceWithStreamingResponse, + AsyncDirectoriesResourceWithStreamingResponse, +) +from .quality_sets import ( + QualitySetsResource, + AsyncQualitySetsResource, + QualitySetsResourceWithRawResponse, + AsyncQualitySetsResourceWithRawResponse, + QualitySetsResourceWithStreamingResponse, + AsyncQualitySetsResourceWithStreamingResponse, +) +from .videos.videos import ( + VideosResource, + AsyncVideosResource, + VideosResourceWithRawResponse, + AsyncVideosResourceWithRawResponse, + VideosResourceWithStreamingResponse, + AsyncVideosResourceWithStreamingResponse, +) +from .streams.streams import ( + StreamsResource, + AsyncStreamsResource, + StreamsResourceWithRawResponse, + AsyncStreamsResourceWithRawResponse, + StreamsResourceWithStreamingResponse, + AsyncStreamsResourceWithStreamingResponse, +) + +__all__ = ["StreamingResource", "AsyncStreamingResource"] + + +class StreamingResource(SyncAPIResource): + @cached_property + def ai_tasks(self) -> AITasksResource: + return AITasksResource(self._client) + + @cached_property + def broadcasts(self) -> BroadcastsResource: + return BroadcastsResource(self._client) + + @cached_property + def directories(self) -> DirectoriesResource: + return DirectoriesResource(self._client) + + @cached_property + def players(self) -> PlayersResource: + return PlayersResource(self._client) + + @cached_property + def quality_sets(self) -> QualitySetsResource: + return QualitySetsResource(self._client) + + @cached_property + def playlists(self) -> PlaylistsResource: + return PlaylistsResource(self._client) + + @cached_property + def videos(self) -> VideosResource: + return VideosResource(self._client) + + @cached_property + def streams(self) -> StreamsResource: + return StreamsResource(self._client) + + @cached_property + def restreams(self) -> RestreamsResource: + return RestreamsResource(self._client) + + @cached_property + def statistics(self) -> StatisticsResource: + return StatisticsResource(self._client) + + @cached_property + def with_raw_response(self) -> StreamingResourceWithRawResponse: + """ + 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 StreamingResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StreamingResourceWithStreamingResponse: + """ + 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 StreamingResourceWithStreamingResponse(self) + + +class AsyncStreamingResource(AsyncAPIResource): + @cached_property + def ai_tasks(self) -> AsyncAITasksResource: + return AsyncAITasksResource(self._client) + + @cached_property + def broadcasts(self) -> AsyncBroadcastsResource: + return AsyncBroadcastsResource(self._client) + + @cached_property + def directories(self) -> AsyncDirectoriesResource: + return AsyncDirectoriesResource(self._client) + + @cached_property + def players(self) -> AsyncPlayersResource: + return AsyncPlayersResource(self._client) + + @cached_property + def quality_sets(self) -> AsyncQualitySetsResource: + return AsyncQualitySetsResource(self._client) + + @cached_property + def playlists(self) -> AsyncPlaylistsResource: + return AsyncPlaylistsResource(self._client) + + @cached_property + def videos(self) -> AsyncVideosResource: + return AsyncVideosResource(self._client) + + @cached_property + def streams(self) -> AsyncStreamsResource: + return AsyncStreamsResource(self._client) + + @cached_property + def restreams(self) -> AsyncRestreamsResource: + return AsyncRestreamsResource(self._client) + + @cached_property + def statistics(self) -> AsyncStatisticsResource: + return AsyncStatisticsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncStreamingResourceWithRawResponse: + """ + 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 AsyncStreamingResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStreamingResourceWithStreamingResponse: + """ + 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 AsyncStreamingResourceWithStreamingResponse(self) + + +class StreamingResourceWithRawResponse: + def __init__(self, streaming: StreamingResource) -> None: + self._streaming = streaming + + @cached_property + def ai_tasks(self) -> AITasksResourceWithRawResponse: + return AITasksResourceWithRawResponse(self._streaming.ai_tasks) + + @cached_property + def broadcasts(self) -> BroadcastsResourceWithRawResponse: + return BroadcastsResourceWithRawResponse(self._streaming.broadcasts) + + @cached_property + def directories(self) -> DirectoriesResourceWithRawResponse: + return DirectoriesResourceWithRawResponse(self._streaming.directories) + + @cached_property + def players(self) -> PlayersResourceWithRawResponse: + return PlayersResourceWithRawResponse(self._streaming.players) + + @cached_property + def quality_sets(self) -> QualitySetsResourceWithRawResponse: + return QualitySetsResourceWithRawResponse(self._streaming.quality_sets) + + @cached_property + def playlists(self) -> PlaylistsResourceWithRawResponse: + return PlaylistsResourceWithRawResponse(self._streaming.playlists) + + @cached_property + def videos(self) -> VideosResourceWithRawResponse: + return VideosResourceWithRawResponse(self._streaming.videos) + + @cached_property + def streams(self) -> StreamsResourceWithRawResponse: + return StreamsResourceWithRawResponse(self._streaming.streams) + + @cached_property + def restreams(self) -> RestreamsResourceWithRawResponse: + return RestreamsResourceWithRawResponse(self._streaming.restreams) + + @cached_property + def statistics(self) -> StatisticsResourceWithRawResponse: + return StatisticsResourceWithRawResponse(self._streaming.statistics) + + +class AsyncStreamingResourceWithRawResponse: + def __init__(self, streaming: AsyncStreamingResource) -> None: + self._streaming = streaming + + @cached_property + def ai_tasks(self) -> AsyncAITasksResourceWithRawResponse: + return AsyncAITasksResourceWithRawResponse(self._streaming.ai_tasks) + + @cached_property + def broadcasts(self) -> AsyncBroadcastsResourceWithRawResponse: + return AsyncBroadcastsResourceWithRawResponse(self._streaming.broadcasts) + + @cached_property + def directories(self) -> AsyncDirectoriesResourceWithRawResponse: + return AsyncDirectoriesResourceWithRawResponse(self._streaming.directories) + + @cached_property + def players(self) -> AsyncPlayersResourceWithRawResponse: + return AsyncPlayersResourceWithRawResponse(self._streaming.players) + + @cached_property + def quality_sets(self) -> AsyncQualitySetsResourceWithRawResponse: + return AsyncQualitySetsResourceWithRawResponse(self._streaming.quality_sets) + + @cached_property + def playlists(self) -> AsyncPlaylistsResourceWithRawResponse: + return AsyncPlaylistsResourceWithRawResponse(self._streaming.playlists) + + @cached_property + def videos(self) -> AsyncVideosResourceWithRawResponse: + return AsyncVideosResourceWithRawResponse(self._streaming.videos) + + @cached_property + def streams(self) -> AsyncStreamsResourceWithRawResponse: + return AsyncStreamsResourceWithRawResponse(self._streaming.streams) + + @cached_property + def restreams(self) -> AsyncRestreamsResourceWithRawResponse: + return AsyncRestreamsResourceWithRawResponse(self._streaming.restreams) + + @cached_property + def statistics(self) -> AsyncStatisticsResourceWithRawResponse: + return AsyncStatisticsResourceWithRawResponse(self._streaming.statistics) + + +class StreamingResourceWithStreamingResponse: + def __init__(self, streaming: StreamingResource) -> None: + self._streaming = streaming + + @cached_property + def ai_tasks(self) -> AITasksResourceWithStreamingResponse: + return AITasksResourceWithStreamingResponse(self._streaming.ai_tasks) + + @cached_property + def broadcasts(self) -> BroadcastsResourceWithStreamingResponse: + return BroadcastsResourceWithStreamingResponse(self._streaming.broadcasts) + + @cached_property + def directories(self) -> DirectoriesResourceWithStreamingResponse: + return DirectoriesResourceWithStreamingResponse(self._streaming.directories) + + @cached_property + def players(self) -> PlayersResourceWithStreamingResponse: + return PlayersResourceWithStreamingResponse(self._streaming.players) + + @cached_property + def quality_sets(self) -> QualitySetsResourceWithStreamingResponse: + return QualitySetsResourceWithStreamingResponse(self._streaming.quality_sets) + + @cached_property + def playlists(self) -> PlaylistsResourceWithStreamingResponse: + return PlaylistsResourceWithStreamingResponse(self._streaming.playlists) + + @cached_property + def videos(self) -> VideosResourceWithStreamingResponse: + return VideosResourceWithStreamingResponse(self._streaming.videos) + + @cached_property + def streams(self) -> StreamsResourceWithStreamingResponse: + return StreamsResourceWithStreamingResponse(self._streaming.streams) + + @cached_property + def restreams(self) -> RestreamsResourceWithStreamingResponse: + return RestreamsResourceWithStreamingResponse(self._streaming.restreams) + + @cached_property + def statistics(self) -> StatisticsResourceWithStreamingResponse: + return StatisticsResourceWithStreamingResponse(self._streaming.statistics) + + +class AsyncStreamingResourceWithStreamingResponse: + def __init__(self, streaming: AsyncStreamingResource) -> None: + self._streaming = streaming + + @cached_property + def ai_tasks(self) -> AsyncAITasksResourceWithStreamingResponse: + return AsyncAITasksResourceWithStreamingResponse(self._streaming.ai_tasks) + + @cached_property + def broadcasts(self) -> AsyncBroadcastsResourceWithStreamingResponse: + return AsyncBroadcastsResourceWithStreamingResponse(self._streaming.broadcasts) + + @cached_property + def directories(self) -> AsyncDirectoriesResourceWithStreamingResponse: + return AsyncDirectoriesResourceWithStreamingResponse(self._streaming.directories) + + @cached_property + def players(self) -> AsyncPlayersResourceWithStreamingResponse: + return AsyncPlayersResourceWithStreamingResponse(self._streaming.players) + + @cached_property + def quality_sets(self) -> AsyncQualitySetsResourceWithStreamingResponse: + return AsyncQualitySetsResourceWithStreamingResponse(self._streaming.quality_sets) + + @cached_property + def playlists(self) -> AsyncPlaylistsResourceWithStreamingResponse: + return AsyncPlaylistsResourceWithStreamingResponse(self._streaming.playlists) + + @cached_property + def videos(self) -> AsyncVideosResourceWithStreamingResponse: + return AsyncVideosResourceWithStreamingResponse(self._streaming.videos) + + @cached_property + def streams(self) -> AsyncStreamsResourceWithStreamingResponse: + return AsyncStreamsResourceWithStreamingResponse(self._streaming.streams) + + @cached_property + def restreams(self) -> AsyncRestreamsResourceWithStreamingResponse: + return AsyncRestreamsResourceWithStreamingResponse(self._streaming.restreams) + + @cached_property + def statistics(self) -> AsyncStatisticsResourceWithStreamingResponse: + return AsyncStatisticsResourceWithStreamingResponse(self._streaming.statistics) diff --git a/src/gcore/resources/streaming/streams/__init__.py b/src/gcore/resources/streaming/streams/__init__.py new file mode 100644 index 00000000..49461963 --- /dev/null +++ b/src/gcore/resources/streaming/streams/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .streams import ( + StreamsResource, + AsyncStreamsResource, + StreamsResourceWithRawResponse, + AsyncStreamsResourceWithRawResponse, + StreamsResourceWithStreamingResponse, + AsyncStreamsResourceWithStreamingResponse, +) +from .overlays import ( + OverlaysResource, + AsyncOverlaysResource, + OverlaysResourceWithRawResponse, + AsyncOverlaysResourceWithRawResponse, + OverlaysResourceWithStreamingResponse, + AsyncOverlaysResourceWithStreamingResponse, +) + +__all__ = [ + "OverlaysResource", + "AsyncOverlaysResource", + "OverlaysResourceWithRawResponse", + "AsyncOverlaysResourceWithRawResponse", + "OverlaysResourceWithStreamingResponse", + "AsyncOverlaysResourceWithStreamingResponse", + "StreamsResource", + "AsyncStreamsResource", + "StreamsResourceWithRawResponse", + "AsyncStreamsResourceWithRawResponse", + "StreamsResourceWithStreamingResponse", + "AsyncStreamsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py new file mode 100644 index 00000000..6ca214f9 --- /dev/null +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -0,0 +1,716 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.streaming.streams import overlay_create_params, overlay_update_params, overlay_update_multiple_params +from ....types.streaming.streams.overlay import Overlay +from ....types.streaming.streams.overlay_list_response import OverlayListResponse +from ....types.streaming.streams.overlay_create_response import OverlayCreateResponse +from ....types.streaming.streams.overlay_update_multiple_response import OverlayUpdateMultipleResponse + +__all__ = ["OverlaysResource", "AsyncOverlaysResource"] + + +class OverlaysResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> OverlaysResourceWithRawResponse: + """ + 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 OverlaysResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> OverlaysResourceWithStreamingResponse: + """ + 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 OverlaysResourceWithStreamingResponse(self) + + def create( + self, + stream_id: int, + *, + body: Iterable[overlay_create_params.Body] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OverlayCreateResponse: + """ + "Overlay" is a live HTML widget, which rendered and inserted over the live + stream. + + There are can be more that 1 overlay over a stream, which are small or stretched + over full frame. Overlays can have transparent areas. Frequency of update is 1 + FPS. Automatic size scaling for Adaptative Bitrate qualities is applied. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/`coffee_run_overlays`.gif) + + How to activate and use in simple steps: + + - Activate feature on your account, ask the Support Team + - Set “`html_overlay`” attribute to "true" for a stream + - Set array of overlays + - Start or restart your stream again + - Enjoy :-) For the first time an overlay should be enabled **before** start + pushing of a live stream. If you are pushing the stream already (stream is + alive and you are activating overlay for the first time), then overlay will + become active after restart pushing. Once you activate the overlay for the + stream for the first time, you can add, change, move, delete widgets on the + fly even during a live stream with no affection on a result stream. + + Tech limits: + + - Max original stream resolution = FullHD. + - It is necessary that all widgets must fit into the original frame of the + source stream (width x height). If one of the widgets does not fit into the + original frame, for example, goes 1 pixel beyond the frame, then all widgets + will be hidden. + - Attributes of overlays: + - url – should be valid http/https url + - 0 < width <= 1920 + - 0 < height <= 1080 + - 0 <= x < 1920 + - 0 <= y < 1080 + - stretch – stretch to full frame. Cannot be used with positioning attributes. + - HTML widget can be access by HTTP 80 or HTTPS 443 ports. + - HTML page code at the "url" link is read once when starting the stream only. + For dynamically updating widgets, you must use either dynamic code via + JavaScript or cause a page refresh via HTML meta tag + . + - Widgets can contain scripts, but they must be lightweight and using small + amount memory, CPU, and bandwidth. It is prohibited to run heavy scripts, + create a heavy load on the network, or run other heavy modules. Such widgets + can be stopped automatically, and the ability to insert widgets itself is + banned. + - If feature is disabled, you will receive HTTP code: 422. Error text: Feature + disabled. Contact support to enable. Please, pay attention to the content of + HTML widges you use. If you don't trust them, then you shouldn't use them, as + their result will be displayed in live stream to all users. **Will there be a + widget in the recording?** Right now overlay widgets are sent to the end + viewer in the HLS/DASH streams, but are not recorded due to technical + limitations. We are working to ensure that widgets remain in the recordings as + well. Follow the news. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/streaming/streams/{stream_id}/overlays", + body=maybe_transform(body, Iterable[overlay_create_params.Body]), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OverlayCreateResponse, + ) + + def update( + self, + overlay_id: int, + *, + stream_id: int, + height: int | NotGiven = NOT_GIVEN, + stretch: bool | NotGiven = NOT_GIVEN, + url: str | NotGiven = NOT_GIVEN, + width: int | NotGiven = NOT_GIVEN, + x: int | NotGiven = NOT_GIVEN, + y: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Overlay: + """ + Updates overlay's settings + + Args: + height: Height of the widget + + stretch: Switch of auto scaling the widget. Must not be used as "true" simultaneously + with the coordinate installation method (w, h, x, y). + + url: Valid http/https URL to an HTML page/widget + + width: Width of the widget + + x: Coordinate of left upper corner + + y: Coordinate of left upper corner + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + body=maybe_transform( + { + "height": height, + "stretch": stretch, + "url": url, + "width": width, + "x": x, + "y": y, + }, + overlay_update_params.OverlayUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Overlay, + ) + + def list( + self, + stream_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, + ) -> OverlayListResponse: + """ + Returns a list of HTML overlay widgets which are attached to a stream + + 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"/streaming/streams/{stream_id}/overlays", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OverlayListResponse, + ) + + def delete( + self, + overlay_id: int, + *, + stream_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete an overlay + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + overlay_id: int, + *, + stream_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, + ) -> Overlay: + """ + Returns overlay details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Overlay, + ) + + def update_multiple( + self, + stream_id: int, + *, + body: Iterable[overlay_update_multiple_params.Body] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OverlayUpdateMultipleResponse: + """ + Updates settings for set of overlays + + 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._patch( + f"/streaming/streams/{stream_id}/overlays", + body=maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OverlayUpdateMultipleResponse, + ) + + +class AsyncOverlaysResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncOverlaysResourceWithRawResponse: + """ + 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 AsyncOverlaysResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncOverlaysResourceWithStreamingResponse: + """ + 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 AsyncOverlaysResourceWithStreamingResponse(self) + + async def create( + self, + stream_id: int, + *, + body: Iterable[overlay_create_params.Body] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OverlayCreateResponse: + """ + "Overlay" is a live HTML widget, which rendered and inserted over the live + stream. + + There are can be more that 1 overlay over a stream, which are small or stretched + over full frame. Overlays can have transparent areas. Frequency of update is 1 + FPS. Automatic size scaling for Adaptative Bitrate qualities is applied. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/`coffee_run_overlays`.gif) + + How to activate and use in simple steps: + + - Activate feature on your account, ask the Support Team + - Set “`html_overlay`” attribute to "true" for a stream + - Set array of overlays + - Start or restart your stream again + - Enjoy :-) For the first time an overlay should be enabled **before** start + pushing of a live stream. If you are pushing the stream already (stream is + alive and you are activating overlay for the first time), then overlay will + become active after restart pushing. Once you activate the overlay for the + stream for the first time, you can add, change, move, delete widgets on the + fly even during a live stream with no affection on a result stream. + + Tech limits: + + - Max original stream resolution = FullHD. + - It is necessary that all widgets must fit into the original frame of the + source stream (width x height). If one of the widgets does not fit into the + original frame, for example, goes 1 pixel beyond the frame, then all widgets + will be hidden. + - Attributes of overlays: + - url – should be valid http/https url + - 0 < width <= 1920 + - 0 < height <= 1080 + - 0 <= x < 1920 + - 0 <= y < 1080 + - stretch – stretch to full frame. Cannot be used with positioning attributes. + - HTML widget can be access by HTTP 80 or HTTPS 443 ports. + - HTML page code at the "url" link is read once when starting the stream only. + For dynamically updating widgets, you must use either dynamic code via + JavaScript or cause a page refresh via HTML meta tag + . + - Widgets can contain scripts, but they must be lightweight and using small + amount memory, CPU, and bandwidth. It is prohibited to run heavy scripts, + create a heavy load on the network, or run other heavy modules. Such widgets + can be stopped automatically, and the ability to insert widgets itself is + banned. + - If feature is disabled, you will receive HTTP code: 422. Error text: Feature + disabled. Contact support to enable. Please, pay attention to the content of + HTML widges you use. If you don't trust them, then you shouldn't use them, as + their result will be displayed in live stream to all users. **Will there be a + widget in the recording?** Right now overlay widgets are sent to the end + viewer in the HLS/DASH streams, but are not recorded due to technical + limitations. We are working to ensure that widgets remain in the recordings as + well. Follow the news. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/streaming/streams/{stream_id}/overlays", + body=await async_maybe_transform(body, Iterable[overlay_create_params.Body]), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OverlayCreateResponse, + ) + + async def update( + self, + overlay_id: int, + *, + stream_id: int, + height: int | NotGiven = NOT_GIVEN, + stretch: bool | NotGiven = NOT_GIVEN, + url: str | NotGiven = NOT_GIVEN, + width: int | NotGiven = NOT_GIVEN, + x: int | NotGiven = NOT_GIVEN, + y: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Overlay: + """ + Updates overlay's settings + + Args: + height: Height of the widget + + stretch: Switch of auto scaling the widget. Must not be used as "true" simultaneously + with the coordinate installation method (w, h, x, y). + + url: Valid http/https URL to an HTML page/widget + + width: Width of the widget + + x: Coordinate of left upper corner + + y: Coordinate of left upper corner + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + body=await async_maybe_transform( + { + "height": height, + "stretch": stretch, + "url": url, + "width": width, + "x": x, + "y": y, + }, + overlay_update_params.OverlayUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Overlay, + ) + + async def list( + self, + stream_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, + ) -> OverlayListResponse: + """ + Returns a list of HTML overlay widgets which are attached to a stream + + 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"/streaming/streams/{stream_id}/overlays", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OverlayListResponse, + ) + + async def delete( + self, + overlay_id: int, + *, + stream_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete an overlay + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + overlay_id: int, + *, + stream_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, + ) -> Overlay: + """ + Returns overlay details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Overlay, + ) + + async def update_multiple( + self, + stream_id: int, + *, + body: Iterable[overlay_update_multiple_params.Body] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OverlayUpdateMultipleResponse: + """ + Updates settings for set of overlays + + 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._patch( + f"/streaming/streams/{stream_id}/overlays", + body=await async_maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OverlayUpdateMultipleResponse, + ) + + +class OverlaysResourceWithRawResponse: + def __init__(self, overlays: OverlaysResource) -> None: + self._overlays = overlays + + self.create = to_raw_response_wrapper( + overlays.create, + ) + self.update = to_raw_response_wrapper( + overlays.update, + ) + self.list = to_raw_response_wrapper( + overlays.list, + ) + self.delete = to_raw_response_wrapper( + overlays.delete, + ) + self.get = to_raw_response_wrapper( + overlays.get, + ) + self.update_multiple = to_raw_response_wrapper( + overlays.update_multiple, + ) + + +class AsyncOverlaysResourceWithRawResponse: + def __init__(self, overlays: AsyncOverlaysResource) -> None: + self._overlays = overlays + + self.create = async_to_raw_response_wrapper( + overlays.create, + ) + self.update = async_to_raw_response_wrapper( + overlays.update, + ) + self.list = async_to_raw_response_wrapper( + overlays.list, + ) + self.delete = async_to_raw_response_wrapper( + overlays.delete, + ) + self.get = async_to_raw_response_wrapper( + overlays.get, + ) + self.update_multiple = async_to_raw_response_wrapper( + overlays.update_multiple, + ) + + +class OverlaysResourceWithStreamingResponse: + def __init__(self, overlays: OverlaysResource) -> None: + self._overlays = overlays + + self.create = to_streamed_response_wrapper( + overlays.create, + ) + self.update = to_streamed_response_wrapper( + overlays.update, + ) + self.list = to_streamed_response_wrapper( + overlays.list, + ) + self.delete = to_streamed_response_wrapper( + overlays.delete, + ) + self.get = to_streamed_response_wrapper( + overlays.get, + ) + self.update_multiple = to_streamed_response_wrapper( + overlays.update_multiple, + ) + + +class AsyncOverlaysResourceWithStreamingResponse: + def __init__(self, overlays: AsyncOverlaysResource) -> None: + self._overlays = overlays + + self.create = async_to_streamed_response_wrapper( + overlays.create, + ) + self.update = async_to_streamed_response_wrapper( + overlays.update, + ) + self.list = async_to_streamed_response_wrapper( + overlays.list, + ) + self.delete = async_to_streamed_response_wrapper( + overlays.delete, + ) + self.get = async_to_streamed_response_wrapper( + overlays.get, + ) + self.update_multiple = async_to_streamed_response_wrapper( + overlays.update_multiple, + ) diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py new file mode 100644 index 00000000..ede9698b --- /dev/null +++ b/src/gcore/resources/streaming/streams/streams.py @@ -0,0 +1,1592 @@ +# 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 .overlays import ( + OverlaysResource, + AsyncOverlaysResource, + OverlaysResourceWithRawResponse, + AsyncOverlaysResourceWithRawResponse, + OverlaysResourceWithStreamingResponse, + AsyncOverlaysResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +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 ....pagination import SyncPageStreaming, AsyncPageStreaming +from ...._base_client import AsyncPaginator, make_request_options +from ....types.streaming import ( + stream_list_params, + stream_create_params, + stream_update_params, + stream_create_clip_params, +) +from ....types.streaming.clip import Clip +from ....types.streaming.video import Video +from ....types.streaming.stream import Stream +from ....types.streaming.stream_list_clips_response import StreamListClipsResponse +from ....types.streaming.stream_start_recording_response import StreamStartRecordingResponse + +__all__ = ["StreamsResource", "AsyncStreamsResource"] + + +class StreamsResource(SyncAPIResource): + @cached_property + def overlays(self) -> OverlaysResource: + return OverlaysResource(self._client) + + @cached_property + def with_raw_response(self) -> StreamsResourceWithRawResponse: + """ + 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 StreamsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StreamsResourceWithStreamingResponse: + """ + 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 StreamsResourceWithStreamingResponse(self) + + def create( + self, + *, + name: str, + active: bool | NotGiven = NOT_GIVEN, + auto_record: bool | NotGiven = NOT_GIVEN, + broadcast_ids: Iterable[int] | NotGiven = NOT_GIVEN, + cdn_id: int | NotGiven = NOT_GIVEN, + client_entity_data: str | NotGiven = NOT_GIVEN, + client_user_id: int | NotGiven = NOT_GIVEN, + dvr_duration: int | NotGiven = NOT_GIVEN, + dvr_enabled: bool | NotGiven = NOT_GIVEN, + hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN, + html_overlay: bool | NotGiven = NOT_GIVEN, + low_latency_enabled: bool | NotGiven = NOT_GIVEN, + projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN, + pull: bool | NotGiven = NOT_GIVEN, + quality_set_id: int | NotGiven = NOT_GIVEN, + record_type: Literal["origin", "transcoded"] | NotGiven = NOT_GIVEN, + uri: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Stream: + """ + Use this method to create a new live stream entity for broadcasting. + + The input in API may contain streams of different formats, including the most + common ones RTMP, RTMPS, SRT, HLS. Note that multicast MPEG-TS over UDP and + others are supported too, ask the Support Team please. For ingestion, you can + use both PUSH and PULL methods. Also you can use the main and backup servers, + which are geographically located in different locations. By default, any free + ingest points in the world are used. Settings have been applied that deliver + low-latency streams in the optimal way. If for some reason you need to set a + fixed ingest point, or if you need to set the main and backup ingest points in + the same region (for example, do not send streams outside the EU or US), then + contact our Support Team. + + The output is HLS and MPEG-DASH with ABR. We transcode video for you by our + cloud-based infrastructure. ABR ladder supports all qualities from SD to 8K HDR + 60fps. All our streams are Low Latency enabled. We support a delay of ±4 seconds + for video streams by utilizing Common Media Application Format (CMAF) + technology. So you obtain latency from the traditional 30-50 seconds to ±4 + seconds only by default. If you need legacy non-low-latency HLS, then look at + HLS MPEGTS delivery below. + + You have access to additional functions such as: + + - DVR + - Recording + - Live clipping + - 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. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/low-latency-football.gif) + + Args: + name: Stream name. Often used as a human-readable name for the stream, but can contain + any text you wish. The values are not unique and may be repeated. Examples: + + - Conference in July + - Stream #10003 + - Open-Air Camera #31 Backstage + - 480fd499-2de2-4988-bc1a-a4eebe9818ee + + active: Stream switch between on and off. This is not an indicator of the status "stream + is receiving and it is LIVE", but rather an on/off switch. When stream is + switched off, there is no way to process it: PULL is deactivated and PUSH will + return an error. + + - true – stream can be processed + - false – stream is off, and cannot be processed + + auto_record: Enables autotomatic recording of the stream when it started. So you don't need + to call recording manually. Result of recording is automatically added to video + hosting. For details see the /streams/`start_recording` method and in knowledge + base Values: + + - true – auto recording is enabled + - false – auto recording is disabled + + broadcast_ids: IDs of broadcasts which will include this stream + + cdn_id: ID of custom CDN resource from which the content will be delivered (only if you + know what you do) + + client_entity_data: Custom meta field designed to store your own extra information about a video + entity: video source, video id, parameters, etc. We do not use this field in any + way when processing the stream. You can store any data in any format (string, + json, etc), saved as a text string. Example: + `` client_entity_data = '{ "`seq_id`": "1234567890", "name": "John Doe", "iat": 1516239022 }' `` + + client_user_id: Custom meta field for storing the Identifier in your system. We do not use this + field in any way when processing the stream. Example: `client_user_id = 1001` + + dvr_duration: DVR duration in seconds if DVR feature is enabled for the stream. So this is + duration of how far the user can rewind the live stream. `dvr_duration` range is + [30...14400]. Maximum value is 4 hours = 14400 seconds. If you need more, ask + the Support Team please. + + dvr_enabled: + Enables DVR for the stream: + + - true – DVR is enabled + - false – DVR is disabled + + hls_mpegts_endlist_tag: Add `#EXT-X-ENDLIST` tag within .m3u8 playlist after the last segment of a live + stream when broadcast is ended. + + html_overlay: Switch on mode to insert and display real-time HTML overlay widgets on top of + live streams + + low_latency_enabled: Deprecated, always returns "true". The only exception is that the attribute can + only be used by clients that have previously used the old stream format. This + method is outdated since we've made it easier to manage streams. For your + convenience, you no longer need to set this parameter at the stage of creating a + stream. Now all streams are prepared in 2 formats simultaniously: Low Latency + and Legacy. You can get the desired output format in the attributes + "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. + + --- + + Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the + "`hls_mpegts_url`" attribute instead. + + projection: Visualization mode for 360° streams, how the stream is rendered in our web + player ONLY. If you would like to show video 360° in an external video player, + then use parameters of that video player. Modes: + + - regular – regular “flat” stream + - vr360 – display stream in 360° mode + - vr180 – display stream in 180° mode + - vr360tb – display stream in 3D 360° mode Top-Bottom + + pull: Indicates if stream is pulled from external server or not. Has two possible + values: + + - true – stream is received by PULL method. Use this when need to get stream + from external server by srt, rtmp\\ss, hls, dash, etc protocols. + - false – stream is received by PUSH method. Use this when need to send stream + from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + + quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to + your conditions. Look at GET /`quality_sets` method + + record_type: Method of recording a stream. Specifies the source from which the stream will be + recorded: original or transcoded. Types: + + - "origin" – To record RMTP/SRT/etc original clean media source. + - "transcoded" – To record the output transcoded version of the stream, + including overlays, texts, logos, etc. additional media layers. + + uri: When using PULL method, this is the URL to pull a stream from. You can specify + multiple addresses separated by a space (" "), so you can organize a backup + plan. In this case, the specified addresses will be selected one by one using + round robin scheduling. If the first address does not respond, then the next one + in the list will be automatically requested, returning to the first and so on in + a circle. Also, if the sucessfully working stream stops sending data, then the + next one will be selected according to the same scheme. After 24 hours of + inactivity of your streams we will stop PULL-ing, and will switch "active" field + to "false". Please, note that this field is for PULL only, so is not suitable + for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + + extra_headers: Send extra headers + + 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( + "/streaming/streams", + body=maybe_transform( + { + "name": name, + "active": active, + "auto_record": auto_record, + "broadcast_ids": broadcast_ids, + "cdn_id": cdn_id, + "client_entity_data": client_entity_data, + "client_user_id": client_user_id, + "dvr_duration": dvr_duration, + "dvr_enabled": dvr_enabled, + "hls_mpegts_endlist_tag": hls_mpegts_endlist_tag, + "html_overlay": html_overlay, + "low_latency_enabled": low_latency_enabled, + "projection": projection, + "pull": pull, + "quality_set_id": quality_set_id, + "record_type": record_type, + "uri": uri, + }, + stream_create_params.StreamCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Stream, + ) + + def update( + self, + stream_id: int, + *, + stream: stream_update_params.Stream | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Stream: + """ + Updates stream settings + + 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._patch( + f"/streaming/streams/{stream_id}", + body=maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Stream, + ) + + def list( + self, + *, + page: int | NotGiven = NOT_GIVEN, + with_broadcasts: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncPageStreaming[Stream]: + """Returns a list of streams. + + Args: + page: Query parameter. + + Use it to list the paginated content + + with_broadcasts: Query parameter. Set to 1 to get details of the broadcasts associated with the + stream + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/streams", + page=SyncPageStreaming[Stream], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "page": page, + "with_broadcasts": with_broadcasts, + }, + stream_list_params.StreamListParams, + ), + ), + model=Stream, + ) + + def delete( + self, + stream_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a live stream. + + After deleting the live stream, all associated data is deleted: settings, PUSH + and PULL links, video playback links, etc. Live stream information is deleted + permanently and irreversibly. Therefore, it is impossible to restore data and + files after this. But if the live had recordings, they continue to remain + independent Video entities. The "`stream_id`" parameter will simply point to a + stream that no longer exists. + + Perhaps, instead of deleting, you may use the stream deactivation: + + ``` + PATCH /videos/{`stream_id`} + { "active": false } + ``` + + For details, see the Product Documentation. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/streaming/streams/{stream_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def clear_dvr( + self, + stream_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Clear live stream DVR + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._put( + f"/streaming/streams/{stream_id}/dvr_cleanup", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def create_clip( + self, + stream_id: int, + *, + duration: int, + expiration: int | NotGiven = NOT_GIVEN, + start: int | NotGiven = NOT_GIVEN, + vod_required: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Clip: + """Create an instant clip from on-going live stream. + + Instant clips are applicable + in cases where there is no time to wait for the broadcast to be completed and + recorded. For example, for quickly cutting highlights in sport events, or + cutting an important moment in the news or live performance. + + Instant clip becomes available for viewing in the following formats: + + - HLS .m3u8, + - MP4, + - VOD in video hosting with a permanent link to watch video. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/`clip_recording_mp4_hls`.gif) + + **Clip lifetime:** Instant clips are a copy of the stream, created from a live + stream. They are stored in memory for a limited time, after which the clip + ceases to exist and you will receive a 404 on the link. Limits that you should + keep in mind: + + - The clip's lifespan is controlled by `expiration` parameter. + - The default expiration value is 1 hour. The value can be set from 1 minute to + 4 hours. + - If you want a video for longer or permanent viewing, then create a regular VOD + based on the clip. This way you can use the clip's link for the first time, + and immediately after the transcoded version is ready, you can change by + yourself it to a permanent link of VOD. + - The clip becomes available only after it is completely copied from the live + stream. So the clip will be available after `start + duration` exact time. If + you try to request it before this time, the response will be error code 425 + "Too Early". + + **Cutting a clip from a source:** In order to use clips recording feature, DVR + must be enabled for a stream: "`dvr_enabled`: true". The DVR serves as a source + for creating clips: + + - By default live stream DVR is set to 1 hour (3600 seconds). You can create an + instant clip using any segment of this time period by specifying the desired + start time and duration. + - If you create a clip, but the DVR expires, the clip will still exist for the + specified time as a copy of the stream. + + **Getting permanent VOD:** To get permanent VOD version of a live clip use this + parameter when making a request to create a clip: `vod_required: true`. Later, + when the clip is ready, grab `video_id` value from the response and query the + video by regular GET /video/{id} method. + + Args: + duration: Requested segment duration in seconds to be cut. Please, note that cutting is + based on the idea of instantly creating a clip, instead of precise timing. So + final segment may be: + + - Less than the specified value if there is less data in the DVR than the + requested segment. + - Greater than the specified value, because segment is aligned to the first and + last key frames of already stored fragment in DVR, this way -1 and +1 chunks + can be added to left and right. Duration of cutted segment cannot be greater + than DVR duration for this stream. Therefore, to change the maximum, use + "`dvr_duration`" parameter of this stream. + + expiration: Expire time of the clip via a public link. Unix timestamp in seconds, absolute + value. This is the time how long the instant clip will be stored in the server + memory and can be accessed via public HLS/MP4 links. Download and/or use the + instant clip before this time expires. After the time has expired, the clip is + deleted from memory and is no longer available via the link. You need to create + a new segment, or use `vod_required: true` attribute. If value is omitted, then + expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. + `unix timestamp = + + 3600`). Allowed range: 1m <= expiration <= 4h. Example: + `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` + + start: Starting point of the segment to cut. Unix timestamp in seconds, absolute value. + Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value + from the past is specified, it is used as the starting point for the segment to + cut. If the value is omitted, then clip will start from now. + + vod_required: Indicates if video needs to be stored also as permanent VOD + + 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"/streaming/streams/{stream_id}/clip_recording", + body=maybe_transform( + { + "duration": duration, + "expiration": expiration, + "start": start, + "vod_required": vod_required, + }, + stream_create_clip_params.StreamCreateClipParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Clip, + ) + + def get( + self, + stream_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, + ) -> Stream: + """ + Returns stream details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/streaming/streams/{stream_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Stream, + ) + + def list_clips( + self, + stream_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, + ) -> StreamListClipsResponse: + """ + Get list of non expired instant clips for a stream. + + You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs + from "`hls_master`" and "`mp4_master`". + + **How to download renditions of clips:** URLs contain "master" alias by default, + which means maximum available quality from ABR set (based on height metadata). + There is also possibility to access individual bitrates from ABR ladder. That + works for both HLS and MP4. You can replace manually "master" to a value from + renditions list in order to get exact bitrate/quality from the set. Example: + + - HLS 720p: + `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_master`.m3u8 `` + - HLS 720p: + `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_media_1_360`.m3u8 `` + - MP4 360p: + `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_master`.mp4 `` + - MP4 360p: + `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_media_1_360`.mp4 `` + + 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"/streaming/streams/{stream_id}/clip_recording", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StreamListClipsResponse, + ) + + def start_recording( + self, + stream_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, + ) -> StreamStartRecordingResponse: + """ + Start recording a stream. + + Stream will be recorded and automatically saved in our video hosting as a + separate video VOD: + + - ID of the stream from which the recording was organized is added to + "`stream_id`" field. You can find the video by that value later. + - Title of the video is based on pattern "Stream Record: {`stream_title`}, + {`recording_end_time_utc`}". + - Recording start time is stored in "`recording_started_at`" field. + - You can record the original stream or the transcoded one. Only the transcoded + version will contain overlays. Set the appropriate recording method when + creating the stream or before calling this recording method. Details in the + "`record_type`" parameter of the stream. + - If you have access to the premium feature of saving the original stream (so + not just transcoded renditions), then the link to the original file will be in + the "`origin_url`" field. Look at the description of the field how to use it. + Stream must be live for the recording to start, please check fields "live" + and/or "`backup_live`". After the recording starts, field "recording" will + switch to "true", and the recording duration in seconds will appear in the + "`recording_duration`" field. Please, keep in mind that recording doesn't + start instantly, it takes ±3-7 seconds to initialize the process after + executing this method. + + Stream recording stops when: + + - Explicit execution of the method /`stop_recording`. In this case, the file + will be completely saved and closed. When you execute the stream recording + method again, the recording will be made to a new video file. + - When sending the stream stops on the client side, or stops accidentally. In + this case, recording process is waiting for 10 seconds to resume recording: + - If the stream resumes within that period, recording will continue to the same + file. + - After that period, the file will be completely saved and closed. + - If the stream suddenly resumes after this period, the recording will go to a + new file, because old file is closed already. Please, also note that if you + have long broadcasts, the recording will be cut into 4-hour videos. This value + is fixed, but can be changed upon request to the Support Team. + + 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"/streaming/streams/{stream_id}/start_recording", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StreamStartRecordingResponse, + ) + + def stop_recording( + self, + stream_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, + ) -> Video: + """ + Stop recording a stream. + + Stream must be in "recording: true" state for recording to be stopped. + + If there was a recording, the created video entity will be returned. Otherwise + the response will be empty. Please see conditions and restrictions for recording + a stream in the description of method /`start_recording`. + + 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"/streaming/streams/{stream_id}/stop_recording", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Video, + ) + + +class AsyncStreamsResource(AsyncAPIResource): + @cached_property + def overlays(self) -> AsyncOverlaysResource: + return AsyncOverlaysResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncStreamsResourceWithRawResponse: + """ + 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 AsyncStreamsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStreamsResourceWithStreamingResponse: + """ + 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 AsyncStreamsResourceWithStreamingResponse(self) + + async def create( + self, + *, + name: str, + active: bool | NotGiven = NOT_GIVEN, + auto_record: bool | NotGiven = NOT_GIVEN, + broadcast_ids: Iterable[int] | NotGiven = NOT_GIVEN, + cdn_id: int | NotGiven = NOT_GIVEN, + client_entity_data: str | NotGiven = NOT_GIVEN, + client_user_id: int | NotGiven = NOT_GIVEN, + dvr_duration: int | NotGiven = NOT_GIVEN, + dvr_enabled: bool | NotGiven = NOT_GIVEN, + hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN, + html_overlay: bool | NotGiven = NOT_GIVEN, + low_latency_enabled: bool | NotGiven = NOT_GIVEN, + projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN, + pull: bool | NotGiven = NOT_GIVEN, + quality_set_id: int | NotGiven = NOT_GIVEN, + record_type: Literal["origin", "transcoded"] | NotGiven = NOT_GIVEN, + uri: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Stream: + """ + Use this method to create a new live stream entity for broadcasting. + + The input in API may contain streams of different formats, including the most + common ones RTMP, RTMPS, SRT, HLS. Note that multicast MPEG-TS over UDP and + others are supported too, ask the Support Team please. For ingestion, you can + use both PUSH and PULL methods. Also you can use the main and backup servers, + which are geographically located in different locations. By default, any free + ingest points in the world are used. Settings have been applied that deliver + low-latency streams in the optimal way. If for some reason you need to set a + fixed ingest point, or if you need to set the main and backup ingest points in + the same region (for example, do not send streams outside the EU or US), then + contact our Support Team. + + The output is HLS and MPEG-DASH with ABR. We transcode video for you by our + cloud-based infrastructure. ABR ladder supports all qualities from SD to 8K HDR + 60fps. All our streams are Low Latency enabled. We support a delay of ±4 seconds + for video streams by utilizing Common Media Application Format (CMAF) + technology. So you obtain latency from the traditional 30-50 seconds to ±4 + seconds only by default. If you need legacy non-low-latency HLS, then look at + HLS MPEGTS delivery below. + + You have access to additional functions such as: + + - DVR + - Recording + - Live clipping + - 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. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/low-latency-football.gif) + + Args: + name: Stream name. Often used as a human-readable name for the stream, but can contain + any text you wish. The values are not unique and may be repeated. Examples: + + - Conference in July + - Stream #10003 + - Open-Air Camera #31 Backstage + - 480fd499-2de2-4988-bc1a-a4eebe9818ee + + active: Stream switch between on and off. This is not an indicator of the status "stream + is receiving and it is LIVE", but rather an on/off switch. When stream is + switched off, there is no way to process it: PULL is deactivated and PUSH will + return an error. + + - true – stream can be processed + - false – stream is off, and cannot be processed + + auto_record: Enables autotomatic recording of the stream when it started. So you don't need + to call recording manually. Result of recording is automatically added to video + hosting. For details see the /streams/`start_recording` method and in knowledge + base Values: + + - true – auto recording is enabled + - false – auto recording is disabled + + broadcast_ids: IDs of broadcasts which will include this stream + + cdn_id: ID of custom CDN resource from which the content will be delivered (only if you + know what you do) + + client_entity_data: Custom meta field designed to store your own extra information about a video + entity: video source, video id, parameters, etc. We do not use this field in any + way when processing the stream. You can store any data in any format (string, + json, etc), saved as a text string. Example: + `` client_entity_data = '{ "`seq_id`": "1234567890", "name": "John Doe", "iat": 1516239022 }' `` + + client_user_id: Custom meta field for storing the Identifier in your system. We do not use this + field in any way when processing the stream. Example: `client_user_id = 1001` + + dvr_duration: DVR duration in seconds if DVR feature is enabled for the stream. So this is + duration of how far the user can rewind the live stream. `dvr_duration` range is + [30...14400]. Maximum value is 4 hours = 14400 seconds. If you need more, ask + the Support Team please. + + dvr_enabled: + Enables DVR for the stream: + + - true – DVR is enabled + - false – DVR is disabled + + hls_mpegts_endlist_tag: Add `#EXT-X-ENDLIST` tag within .m3u8 playlist after the last segment of a live + stream when broadcast is ended. + + html_overlay: Switch on mode to insert and display real-time HTML overlay widgets on top of + live streams + + low_latency_enabled: Deprecated, always returns "true". The only exception is that the attribute can + only be used by clients that have previously used the old stream format. This + method is outdated since we've made it easier to manage streams. For your + convenience, you no longer need to set this parameter at the stage of creating a + stream. Now all streams are prepared in 2 formats simultaniously: Low Latency + and Legacy. You can get the desired output format in the attributes + "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. + + --- + + Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the + "`hls_mpegts_url`" attribute instead. + + projection: Visualization mode for 360° streams, how the stream is rendered in our web + player ONLY. If you would like to show video 360° in an external video player, + then use parameters of that video player. Modes: + + - regular – regular “flat” stream + - vr360 – display stream in 360° mode + - vr180 – display stream in 180° mode + - vr360tb – display stream in 3D 360° mode Top-Bottom + + pull: Indicates if stream is pulled from external server or not. Has two possible + values: + + - true – stream is received by PULL method. Use this when need to get stream + from external server by srt, rtmp\\ss, hls, dash, etc protocols. + - false – stream is received by PUSH method. Use this when need to send stream + from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + + quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to + your conditions. Look at GET /`quality_sets` method + + record_type: Method of recording a stream. Specifies the source from which the stream will be + recorded: original or transcoded. Types: + + - "origin" – To record RMTP/SRT/etc original clean media source. + - "transcoded" – To record the output transcoded version of the stream, + including overlays, texts, logos, etc. additional media layers. + + uri: When using PULL method, this is the URL to pull a stream from. You can specify + multiple addresses separated by a space (" "), so you can organize a backup + plan. In this case, the specified addresses will be selected one by one using + round robin scheduling. If the first address does not respond, then the next one + in the list will be automatically requested, returning to the first and so on in + a circle. Also, if the sucessfully working stream stops sending data, then the + next one will be selected according to the same scheme. After 24 hours of + inactivity of your streams we will stop PULL-ing, and will switch "active" field + to "false". Please, note that this field is for PULL only, so is not suitable + for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + + extra_headers: Send extra headers + + 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( + "/streaming/streams", + body=await async_maybe_transform( + { + "name": name, + "active": active, + "auto_record": auto_record, + "broadcast_ids": broadcast_ids, + "cdn_id": cdn_id, + "client_entity_data": client_entity_data, + "client_user_id": client_user_id, + "dvr_duration": dvr_duration, + "dvr_enabled": dvr_enabled, + "hls_mpegts_endlist_tag": hls_mpegts_endlist_tag, + "html_overlay": html_overlay, + "low_latency_enabled": low_latency_enabled, + "projection": projection, + "pull": pull, + "quality_set_id": quality_set_id, + "record_type": record_type, + "uri": uri, + }, + stream_create_params.StreamCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Stream, + ) + + async def update( + self, + stream_id: int, + *, + stream: stream_update_params.Stream | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Stream: + """ + Updates stream settings + + 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._patch( + f"/streaming/streams/{stream_id}", + body=await async_maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Stream, + ) + + def list( + self, + *, + page: int | NotGiven = NOT_GIVEN, + with_broadcasts: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Stream, AsyncPageStreaming[Stream]]: + """Returns a list of streams. + + Args: + page: Query parameter. + + Use it to list the paginated content + + with_broadcasts: Query parameter. Set to 1 to get details of the broadcasts associated with the + stream + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/streams", + page=AsyncPageStreaming[Stream], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "page": page, + "with_broadcasts": with_broadcasts, + }, + stream_list_params.StreamListParams, + ), + ), + model=Stream, + ) + + async def delete( + self, + stream_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete a live stream. + + After deleting the live stream, all associated data is deleted: settings, PUSH + and PULL links, video playback links, etc. Live stream information is deleted + permanently and irreversibly. Therefore, it is impossible to restore data and + files after this. But if the live had recordings, they continue to remain + independent Video entities. The "`stream_id`" parameter will simply point to a + stream that no longer exists. + + Perhaps, instead of deleting, you may use the stream deactivation: + + ``` + PATCH /videos/{`stream_id`} + { "active": false } + ``` + + For details, see the Product Documentation. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/streaming/streams/{stream_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def clear_dvr( + self, + stream_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Clear live stream DVR + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._put( + f"/streaming/streams/{stream_id}/dvr_cleanup", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def create_clip( + self, + stream_id: int, + *, + duration: int, + expiration: int | NotGiven = NOT_GIVEN, + start: int | NotGiven = NOT_GIVEN, + vod_required: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Clip: + """Create an instant clip from on-going live stream. + + Instant clips are applicable + in cases where there is no time to wait for the broadcast to be completed and + recorded. For example, for quickly cutting highlights in sport events, or + cutting an important moment in the news or live performance. + + Instant clip becomes available for viewing in the following formats: + + - HLS .m3u8, + - MP4, + - VOD in video hosting with a permanent link to watch video. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/`clip_recording_mp4_hls`.gif) + + **Clip lifetime:** Instant clips are a copy of the stream, created from a live + stream. They are stored in memory for a limited time, after which the clip + ceases to exist and you will receive a 404 on the link. Limits that you should + keep in mind: + + - The clip's lifespan is controlled by `expiration` parameter. + - The default expiration value is 1 hour. The value can be set from 1 minute to + 4 hours. + - If you want a video for longer or permanent viewing, then create a regular VOD + based on the clip. This way you can use the clip's link for the first time, + and immediately after the transcoded version is ready, you can change by + yourself it to a permanent link of VOD. + - The clip becomes available only after it is completely copied from the live + stream. So the clip will be available after `start + duration` exact time. If + you try to request it before this time, the response will be error code 425 + "Too Early". + + **Cutting a clip from a source:** In order to use clips recording feature, DVR + must be enabled for a stream: "`dvr_enabled`: true". The DVR serves as a source + for creating clips: + + - By default live stream DVR is set to 1 hour (3600 seconds). You can create an + instant clip using any segment of this time period by specifying the desired + start time and duration. + - If you create a clip, but the DVR expires, the clip will still exist for the + specified time as a copy of the stream. + + **Getting permanent VOD:** To get permanent VOD version of a live clip use this + parameter when making a request to create a clip: `vod_required: true`. Later, + when the clip is ready, grab `video_id` value from the response and query the + video by regular GET /video/{id} method. + + Args: + duration: Requested segment duration in seconds to be cut. Please, note that cutting is + based on the idea of instantly creating a clip, instead of precise timing. So + final segment may be: + + - Less than the specified value if there is less data in the DVR than the + requested segment. + - Greater than the specified value, because segment is aligned to the first and + last key frames of already stored fragment in DVR, this way -1 and +1 chunks + can be added to left and right. Duration of cutted segment cannot be greater + than DVR duration for this stream. Therefore, to change the maximum, use + "`dvr_duration`" parameter of this stream. + + expiration: Expire time of the clip via a public link. Unix timestamp in seconds, absolute + value. This is the time how long the instant clip will be stored in the server + memory and can be accessed via public HLS/MP4 links. Download and/or use the + instant clip before this time expires. After the time has expired, the clip is + deleted from memory and is no longer available via the link. You need to create + a new segment, or use `vod_required: true` attribute. If value is omitted, then + expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. + `unix timestamp = + + 3600`). Allowed range: 1m <= expiration <= 4h. Example: + `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` + + start: Starting point of the segment to cut. Unix timestamp in seconds, absolute value. + Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value + from the past is specified, it is used as the starting point for the segment to + cut. If the value is omitted, then clip will start from now. + + vod_required: Indicates if video needs to be stored also as permanent VOD + + 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"/streaming/streams/{stream_id}/clip_recording", + body=await async_maybe_transform( + { + "duration": duration, + "expiration": expiration, + "start": start, + "vod_required": vod_required, + }, + stream_create_clip_params.StreamCreateClipParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Clip, + ) + + async def get( + self, + stream_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, + ) -> Stream: + """ + Returns stream details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/streaming/streams/{stream_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Stream, + ) + + async def list_clips( + self, + stream_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, + ) -> StreamListClipsResponse: + """ + Get list of non expired instant clips for a stream. + + You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs + from "`hls_master`" and "`mp4_master`". + + **How to download renditions of clips:** URLs contain "master" alias by default, + which means maximum available quality from ABR set (based on height metadata). + There is also possibility to access individual bitrates from ABR ladder. That + works for both HLS and MP4. You can replace manually "master" to a value from + renditions list in order to get exact bitrate/quality from the set. Example: + + - HLS 720p: + `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_master`.m3u8 `` + - HLS 720p: + `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_media_1_360`.m3u8 `` + - MP4 360p: + `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_master`.mp4 `` + - MP4 360p: + `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_media_1_360`.mp4 `` + + 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"/streaming/streams/{stream_id}/clip_recording", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StreamListClipsResponse, + ) + + async def start_recording( + self, + stream_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, + ) -> StreamStartRecordingResponse: + """ + Start recording a stream. + + Stream will be recorded and automatically saved in our video hosting as a + separate video VOD: + + - ID of the stream from which the recording was organized is added to + "`stream_id`" field. You can find the video by that value later. + - Title of the video is based on pattern "Stream Record: {`stream_title`}, + {`recording_end_time_utc`}". + - Recording start time is stored in "`recording_started_at`" field. + - You can record the original stream or the transcoded one. Only the transcoded + version will contain overlays. Set the appropriate recording method when + creating the stream or before calling this recording method. Details in the + "`record_type`" parameter of the stream. + - If you have access to the premium feature of saving the original stream (so + not just transcoded renditions), then the link to the original file will be in + the "`origin_url`" field. Look at the description of the field how to use it. + Stream must be live for the recording to start, please check fields "live" + and/or "`backup_live`". After the recording starts, field "recording" will + switch to "true", and the recording duration in seconds will appear in the + "`recording_duration`" field. Please, keep in mind that recording doesn't + start instantly, it takes ±3-7 seconds to initialize the process after + executing this method. + + Stream recording stops when: + + - Explicit execution of the method /`stop_recording`. In this case, the file + will be completely saved and closed. When you execute the stream recording + method again, the recording will be made to a new video file. + - When sending the stream stops on the client side, or stops accidentally. In + this case, recording process is waiting for 10 seconds to resume recording: + - If the stream resumes within that period, recording will continue to the same + file. + - After that period, the file will be completely saved and closed. + - If the stream suddenly resumes after this period, the recording will go to a + new file, because old file is closed already. Please, also note that if you + have long broadcasts, the recording will be cut into 4-hour videos. This value + is fixed, but can be changed upon request to the Support Team. + + 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"/streaming/streams/{stream_id}/start_recording", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StreamStartRecordingResponse, + ) + + async def stop_recording( + self, + stream_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, + ) -> Video: + """ + Stop recording a stream. + + Stream must be in "recording: true" state for recording to be stopped. + + If there was a recording, the created video entity will be returned. Otherwise + the response will be empty. Please see conditions and restrictions for recording + a stream in the description of method /`start_recording`. + + 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"/streaming/streams/{stream_id}/stop_recording", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Video, + ) + + +class StreamsResourceWithRawResponse: + def __init__(self, streams: StreamsResource) -> None: + self._streams = streams + + self.create = to_raw_response_wrapper( + streams.create, + ) + self.update = to_raw_response_wrapper( + streams.update, + ) + self.list = to_raw_response_wrapper( + streams.list, + ) + self.delete = to_raw_response_wrapper( + streams.delete, + ) + self.clear_dvr = to_raw_response_wrapper( + streams.clear_dvr, + ) + self.create_clip = to_raw_response_wrapper( + streams.create_clip, + ) + self.get = to_raw_response_wrapper( + streams.get, + ) + self.list_clips = to_raw_response_wrapper( + streams.list_clips, + ) + self.start_recording = to_raw_response_wrapper( + streams.start_recording, + ) + self.stop_recording = to_raw_response_wrapper( + streams.stop_recording, + ) + + @cached_property + def overlays(self) -> OverlaysResourceWithRawResponse: + return OverlaysResourceWithRawResponse(self._streams.overlays) + + +class AsyncStreamsResourceWithRawResponse: + def __init__(self, streams: AsyncStreamsResource) -> None: + self._streams = streams + + self.create = async_to_raw_response_wrapper( + streams.create, + ) + self.update = async_to_raw_response_wrapper( + streams.update, + ) + self.list = async_to_raw_response_wrapper( + streams.list, + ) + self.delete = async_to_raw_response_wrapper( + streams.delete, + ) + self.clear_dvr = async_to_raw_response_wrapper( + streams.clear_dvr, + ) + self.create_clip = async_to_raw_response_wrapper( + streams.create_clip, + ) + self.get = async_to_raw_response_wrapper( + streams.get, + ) + self.list_clips = async_to_raw_response_wrapper( + streams.list_clips, + ) + self.start_recording = async_to_raw_response_wrapper( + streams.start_recording, + ) + self.stop_recording = async_to_raw_response_wrapper( + streams.stop_recording, + ) + + @cached_property + def overlays(self) -> AsyncOverlaysResourceWithRawResponse: + return AsyncOverlaysResourceWithRawResponse(self._streams.overlays) + + +class StreamsResourceWithStreamingResponse: + def __init__(self, streams: StreamsResource) -> None: + self._streams = streams + + self.create = to_streamed_response_wrapper( + streams.create, + ) + self.update = to_streamed_response_wrapper( + streams.update, + ) + self.list = to_streamed_response_wrapper( + streams.list, + ) + self.delete = to_streamed_response_wrapper( + streams.delete, + ) + self.clear_dvr = to_streamed_response_wrapper( + streams.clear_dvr, + ) + self.create_clip = to_streamed_response_wrapper( + streams.create_clip, + ) + self.get = to_streamed_response_wrapper( + streams.get, + ) + self.list_clips = to_streamed_response_wrapper( + streams.list_clips, + ) + self.start_recording = to_streamed_response_wrapper( + streams.start_recording, + ) + self.stop_recording = to_streamed_response_wrapper( + streams.stop_recording, + ) + + @cached_property + def overlays(self) -> OverlaysResourceWithStreamingResponse: + return OverlaysResourceWithStreamingResponse(self._streams.overlays) + + +class AsyncStreamsResourceWithStreamingResponse: + def __init__(self, streams: AsyncStreamsResource) -> None: + self._streams = streams + + self.create = async_to_streamed_response_wrapper( + streams.create, + ) + self.update = async_to_streamed_response_wrapper( + streams.update, + ) + self.list = async_to_streamed_response_wrapper( + streams.list, + ) + self.delete = async_to_streamed_response_wrapper( + streams.delete, + ) + self.clear_dvr = async_to_streamed_response_wrapper( + streams.clear_dvr, + ) + self.create_clip = async_to_streamed_response_wrapper( + streams.create_clip, + ) + self.get = async_to_streamed_response_wrapper( + streams.get, + ) + self.list_clips = async_to_streamed_response_wrapper( + streams.list_clips, + ) + self.start_recording = async_to_streamed_response_wrapper( + streams.start_recording, + ) + self.stop_recording = async_to_streamed_response_wrapper( + streams.stop_recording, + ) + + @cached_property + def overlays(self) -> AsyncOverlaysResourceWithStreamingResponse: + return AsyncOverlaysResourceWithStreamingResponse(self._streams.overlays) diff --git a/src/gcore/resources/streaming/videos/__init__.py b/src/gcore/resources/streaming/videos/__init__.py new file mode 100644 index 00000000..78c3959d --- /dev/null +++ b/src/gcore/resources/streaming/videos/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .videos import ( + VideosResource, + AsyncVideosResource, + VideosResourceWithRawResponse, + AsyncVideosResourceWithRawResponse, + VideosResourceWithStreamingResponse, + AsyncVideosResourceWithStreamingResponse, +) +from .subtitles import ( + SubtitlesResource, + AsyncSubtitlesResource, + SubtitlesResourceWithRawResponse, + AsyncSubtitlesResourceWithRawResponse, + SubtitlesResourceWithStreamingResponse, + AsyncSubtitlesResourceWithStreamingResponse, +) + +__all__ = [ + "SubtitlesResource", + "AsyncSubtitlesResource", + "SubtitlesResourceWithRawResponse", + "AsyncSubtitlesResourceWithRawResponse", + "SubtitlesResourceWithStreamingResponse", + "AsyncSubtitlesResourceWithStreamingResponse", + "VideosResource", + "AsyncVideosResource", + "VideosResourceWithRawResponse", + "AsyncVideosResourceWithRawResponse", + "VideosResourceWithStreamingResponse", + "AsyncVideosResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py new file mode 100644 index 00000000..58864fc4 --- /dev/null +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -0,0 +1,623 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.streaming.videos import subtitle_create_params, subtitle_update_params +from ....types.streaming.subtitle import Subtitle +from ....types.streaming.subtitle_base import SubtitleBase +from ....types.streaming.videos.subtitle_list_response import SubtitleListResponse + +__all__ = ["SubtitlesResource", "AsyncSubtitlesResource"] + + +class SubtitlesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SubtitlesResourceWithRawResponse: + """ + 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 SubtitlesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SubtitlesResourceWithStreamingResponse: + """ + 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 SubtitlesResourceWithStreamingResponse(self) + + def create( + self, + video_id: int, + *, + body: subtitle_create_params.Body, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Subtitle: + """ + Add new subtitle/captions to a video entity. + + **Add already exist subtitles** Subtitles must be in one of the following + formats: + + - SRT – SubRip Text is described on + [wikipedia.org](https://en.wikipedia.org/wiki/SubRip#`SubRip_file_format`). + Must start from integer for sequence number. Use calidators to check the + subtitles, like + [srt-validator](https://taoning2014.github.io/srt-validator-website/index.html). + - WebVTT – Web Video Text Tracks Format is described on + [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/API/`WebVTT_API`). + Must start from "WEBVTT" header. Use validators to check the subtitles, like + [W3C](https://w3c.github.io/webvtt.js/parser.html). Language is 3-letter + language code according to ISO-639-2 (bibliographic code). Specify language + you need, or just look at our list in the attribute "`audio_language`" of + section + ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + You can add multiple subtitles in the same language, language uniqueness is + not required. Size must be up to 5Mb. + + The update time for added or changed subtitles is up to 30 seconds. Just like + videos, subtitles are cached, so it takes time to update the data. + + **AI subtitles and transcribing** It is also possible to automatically create + subtitles based on AI. Read more: + + - What is + ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + - If the option is enabled via `auto_transcribe_audio_language: auto|`, then + immediately after successful transcoding, an AI task will be automatically + created for transcription. + - If you need to translate subtitles from original language to any other, then + AI-task of subtitles translation can be applied. Use + `auto_translate_subtitles_language: default|` parameter for that. Also you can + point several languages to translate to, then a separate subtitle will be + generated for each specified language. The created AI-task(s) will be + automatically executed, and result will also be automatically attached to this + video as subtitle(s). If AI is disabled in your account, you will receive code + 422 in response. + + **Where and how subtitles are displayed?** Subtitles are became available in the + API response and in playback manifests. All added subtitles are automatically + inserted into the output manifest .m3u8. This way, subtitles become available to + any player: our player, OS built-in, or other specialized ones. You don't need + to do anything else. Read more information in the Knowledge Base. Example: + + ``` + # EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs0",NAME="English",LANGUAGE="en",AUTOSELECT=YES,URI="subs-0.m3u8" + ``` + + ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/streaming/videos/{video_id}/subtitles", + body=maybe_transform(body, subtitle_create_params.SubtitleCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Subtitle, + ) + + def update( + self, + id: int, + *, + video_id: int, + language: str | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + vtt: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SubtitleBase: + """Method to update subtitle of a video. + + You can update all or only some of fields + you need. If you want to replace the text of subtitles (i.e. found a typo in the + text, or the timing in the video changed), then: + + - download it using GET method, + - change it in an external editor, + - and update it using this PATCH method. Just like videos, subtitles are cached, + so it takes time to update the data. See POST method for details. + + Args: + language: 3-letter language code according to ISO-639-2 (bibliographic code) + + name: Name of subtitle file + + vtt: Full text of subtitles/captions, with escaped "\n" ("\r") symbol of new line + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/streaming/videos/{video_id}/subtitles/{id}", + body=maybe_transform( + { + "language": language, + "name": name, + "vtt": vtt, + }, + subtitle_update_params.SubtitleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SubtitleBase, + ) + + def list( + self, + video_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, + ) -> SubtitleListResponse: + """ + Method returns a list of all subtitles that are already attached to a video. + + 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"/streaming/videos/{video_id}/subtitles", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SubtitleListResponse, + ) + + def delete( + self, + id: int, + *, + video_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete specified video subtitle + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/streaming/videos/{video_id}/subtitles/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + video_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, + ) -> Subtitle: + """ + Returns information about a specific subtitle for a video. + + 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"/streaming/videos/{video_id}/subtitles/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Subtitle, + ) + + +class AsyncSubtitlesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSubtitlesResourceWithRawResponse: + """ + 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 AsyncSubtitlesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSubtitlesResourceWithStreamingResponse: + """ + 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 AsyncSubtitlesResourceWithStreamingResponse(self) + + async def create( + self, + video_id: int, + *, + body: subtitle_create_params.Body, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Subtitle: + """ + Add new subtitle/captions to a video entity. + + **Add already exist subtitles** Subtitles must be in one of the following + formats: + + - SRT – SubRip Text is described on + [wikipedia.org](https://en.wikipedia.org/wiki/SubRip#`SubRip_file_format`). + Must start from integer for sequence number. Use calidators to check the + subtitles, like + [srt-validator](https://taoning2014.github.io/srt-validator-website/index.html). + - WebVTT – Web Video Text Tracks Format is described on + [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/API/`WebVTT_API`). + Must start from "WEBVTT" header. Use validators to check the subtitles, like + [W3C](https://w3c.github.io/webvtt.js/parser.html). Language is 3-letter + language code according to ISO-639-2 (bibliographic code). Specify language + you need, or just look at our list in the attribute "`audio_language`" of + section + ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + You can add multiple subtitles in the same language, language uniqueness is + not required. Size must be up to 5Mb. + + The update time for added or changed subtitles is up to 30 seconds. Just like + videos, subtitles are cached, so it takes time to update the data. + + **AI subtitles and transcribing** It is also possible to automatically create + subtitles based on AI. Read more: + + - What is + ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + - If the option is enabled via `auto_transcribe_audio_language: auto|`, then + immediately after successful transcoding, an AI task will be automatically + created for transcription. + - If you need to translate subtitles from original language to any other, then + AI-task of subtitles translation can be applied. Use + `auto_translate_subtitles_language: default|` parameter for that. Also you can + point several languages to translate to, then a separate subtitle will be + generated for each specified language. The created AI-task(s) will be + automatically executed, and result will also be automatically attached to this + video as subtitle(s). If AI is disabled in your account, you will receive code + 422 in response. + + **Where and how subtitles are displayed?** Subtitles are became available in the + API response and in playback manifests. All added subtitles are automatically + inserted into the output manifest .m3u8. This way, subtitles become available to + any player: our player, OS built-in, or other specialized ones. You don't need + to do anything else. Read more information in the Knowledge Base. Example: + + ``` + # EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs0",NAME="English",LANGUAGE="en",AUTOSELECT=YES,URI="subs-0.m3u8" + ``` + + ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/streaming/videos/{video_id}/subtitles", + body=await async_maybe_transform(body, subtitle_create_params.SubtitleCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Subtitle, + ) + + async def update( + self, + id: int, + *, + video_id: int, + language: str | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + vtt: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SubtitleBase: + """Method to update subtitle of a video. + + You can update all or only some of fields + you need. If you want to replace the text of subtitles (i.e. found a typo in the + text, or the timing in the video changed), then: + + - download it using GET method, + - change it in an external editor, + - and update it using this PATCH method. Just like videos, subtitles are cached, + so it takes time to update the data. See POST method for details. + + Args: + language: 3-letter language code according to ISO-639-2 (bibliographic code) + + name: Name of subtitle file + + vtt: Full text of subtitles/captions, with escaped "\n" ("\r") symbol of new line + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/streaming/videos/{video_id}/subtitles/{id}", + body=await async_maybe_transform( + { + "language": language, + "name": name, + "vtt": vtt, + }, + subtitle_update_params.SubtitleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SubtitleBase, + ) + + async def list( + self, + video_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, + ) -> SubtitleListResponse: + """ + Method returns a list of all subtitles that are already attached to a video. + + 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"/streaming/videos/{video_id}/subtitles", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SubtitleListResponse, + ) + + async def delete( + self, + id: int, + *, + video_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Delete specified video subtitle + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/streaming/videos/{video_id}/subtitles/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + video_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, + ) -> Subtitle: + """ + Returns information about a specific subtitle for a video. + + 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"/streaming/videos/{video_id}/subtitles/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Subtitle, + ) + + +class SubtitlesResourceWithRawResponse: + def __init__(self, subtitles: SubtitlesResource) -> None: + self._subtitles = subtitles + + self.create = to_raw_response_wrapper( + subtitles.create, + ) + self.update = to_raw_response_wrapper( + subtitles.update, + ) + self.list = to_raw_response_wrapper( + subtitles.list, + ) + self.delete = to_raw_response_wrapper( + subtitles.delete, + ) + self.get = to_raw_response_wrapper( + subtitles.get, + ) + + +class AsyncSubtitlesResourceWithRawResponse: + def __init__(self, subtitles: AsyncSubtitlesResource) -> None: + self._subtitles = subtitles + + self.create = async_to_raw_response_wrapper( + subtitles.create, + ) + self.update = async_to_raw_response_wrapper( + subtitles.update, + ) + self.list = async_to_raw_response_wrapper( + subtitles.list, + ) + self.delete = async_to_raw_response_wrapper( + subtitles.delete, + ) + self.get = async_to_raw_response_wrapper( + subtitles.get, + ) + + +class SubtitlesResourceWithStreamingResponse: + def __init__(self, subtitles: SubtitlesResource) -> None: + self._subtitles = subtitles + + self.create = to_streamed_response_wrapper( + subtitles.create, + ) + self.update = to_streamed_response_wrapper( + subtitles.update, + ) + self.list = to_streamed_response_wrapper( + subtitles.list, + ) + self.delete = to_streamed_response_wrapper( + subtitles.delete, + ) + self.get = to_streamed_response_wrapper( + subtitles.get, + ) + + +class AsyncSubtitlesResourceWithStreamingResponse: + def __init__(self, subtitles: AsyncSubtitlesResource) -> None: + self._subtitles = subtitles + + self.create = async_to_streamed_response_wrapper( + subtitles.create, + ) + self.update = async_to_streamed_response_wrapper( + subtitles.update, + ) + self.list = async_to_streamed_response_wrapper( + subtitles.list, + ) + self.delete = async_to_streamed_response_wrapper( + subtitles.delete, + ) + self.get = async_to_streamed_response_wrapper( + subtitles.get, + ) diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py new file mode 100644 index 00000000..24d654e6 --- /dev/null +++ b/src/gcore/resources/streaming/videos/videos.py @@ -0,0 +1,1553 @@ +# 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 NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from .subtitles import ( + SubtitlesResource, + AsyncSubtitlesResource, + SubtitlesResourceWithRawResponse, + AsyncSubtitlesResourceWithRawResponse, + SubtitlesResourceWithStreamingResponse, + AsyncSubtitlesResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....pagination import SyncPageStreaming, AsyncPageStreaming +from ...._base_client import AsyncPaginator, make_request_options +from ....types.streaming import ( + video_list_params, + video_create_params, + video_update_params, + video_list_names_params, + video_create_multiple_params, +) +from ....types.streaming.video import Video +from ....types.streaming.create_video_param import CreateVideoParam +from ....types.streaming.video_create_response import VideoCreateResponse +from ....types.streaming.direct_upload_parameters import DirectUploadParameters +from ....types.streaming.video_create_multiple_response import VideoCreateMultipleResponse + +__all__ = ["VideosResource", "AsyncVideosResource"] + + +class VideosResource(SyncAPIResource): + @cached_property + def subtitles(self) -> SubtitlesResource: + return SubtitlesResource(self._client) + + @cached_property + def with_raw_response(self) -> VideosResourceWithRawResponse: + """ + 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 VideosResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VideosResourceWithStreamingResponse: + """ + 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 VideosResourceWithStreamingResponse(self) + + def create( + self, + *, + video: CreateVideoParam | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VideoCreateResponse: + """ + Use this method to create a new video entity. + + **Methods of creating** To upload the original video file to the server, there + are several possible scenarios: + + - **Copy from another server** – If your video is accessable via "http://", + "https://", or "sftp://" public link, then you can use this method to copy a + file from an external server. Set `origin_url` parameter with the link to the + original video file (i.e. "https://domain.com/video.mp4"). After method + execution file will be uploaded and will be sent to transcoding automatically, + you don't have to do anything else. Use extra field `origin_http_headers` if + authorization is required on the external server. + - **Direct upload from a local device** – If you need to upload video directly + from your local device or from a mobile app, then use this method. Keep + `origin_url` empty and use TUS protocol ([tus.io](https://tus.io)) to upload + file. More details are here + ["Get TUS' upload"](/docs/api-reference/streaming/videos/get-tus-parameters-for-direct-upload) + After getting the video, it is processed through the queue. There are 2 + priority criteria: global and local. Global is determined automatically by the + system as converters are ready to get next video, so your videos rarely queue + longer than usual (when you don't have a dedicated region). Local priority + works at the level of your account and you have full control over it, look at + "priority" attribute. + + **AI processing** When uploading a video, it is possible to automatically create + subtitles based on AI. Read more: + + - What is + ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + - If the option is enabled via `auto_transcribe_audio_language: auto|`, then + immediately after successful transcoding, an AI task will be automatically + created for transcription. + - If you need to translate subtitles from original language to any other, then + AI-task of subtitles translation can be applied. Use + `auto_translate_subtitles_language: default|` parameter for that. Also you can + point several languages to translate to, then a separate subtitle will be + generated for each specified language. + - How to + ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + The created AI-task(s) will be automatically executed, and result will also be + automatically attached to this video as subtitle(s). Please note that + transcription is done automatically for all videos uploaded to our video + hosting. If necessary, you can disable automatic creation of subtitles. If AI + is disabled in your account, no AI functionality is called. + + **Advanced Features** For details on the requirements for incoming original + files, and output video parameters after transcoding, refer to the Knowledge + Base documentation. By default video will be transcoded according to the + original resolution, and a quality ladder suitable for your original video will + be applied. There is no automatic upscaling; the maximum quality is taken from + the original video. If you want to upload specific files not explicitly listed + in requirements or wish to modify the standard quality ladder (i.e. decrease + quality or add new non-standard qualities), then such customization is possible. + Please reach out to us for assistance. + + Additionally, check the Knowledge Base for any supplementary information you may + need. + + 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( + "/streaming/videos", + body=maybe_transform({"video": video}, video_create_params.VideoCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VideoCreateResponse, + ) + + def update( + self, + video_id: int, + *, + name: str, + auto_transcribe_audio_language: Literal["disable", "auto", ""] | NotGiven = NOT_GIVEN, + auto_translate_subtitles_language: Literal["disable", "default", ""] | NotGiven = NOT_GIVEN, + client_user_id: int | NotGiven = NOT_GIVEN, + clip_duration_seconds: int | NotGiven = NOT_GIVEN, + clip_start_seconds: int | NotGiven = NOT_GIVEN, + custom_iframe_url: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + directory_id: int | NotGiven = NOT_GIVEN, + origin_http_headers: str | NotGiven = NOT_GIVEN, + origin_url: str | NotGiven = NOT_GIVEN, + poster: str | NotGiven = NOT_GIVEN, + priority: int | NotGiven = NOT_GIVEN, + projection: str | NotGiven = NOT_GIVEN, + quality_set_id: int | NotGiven = NOT_GIVEN, + remote_poster_url: str | NotGiven = NOT_GIVEN, + remove_poster: bool | NotGiven = NOT_GIVEN, + screenshot_id: int | NotGiven = NOT_GIVEN, + share_url: str | NotGiven = NOT_GIVEN, + source_bitrate_limit: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Video: + """Changes parameters of the video to new values. + + It's allowed to update only those + public parameters that are described in POST method to create a new “video” + entity. So it's not possible to change calculated parameters like "id", + "duration", "`hls_url`", etc. Examples of changing: + + - Name: `{ "name": "new name of the video" }` + - Move the video to a new directory: `` { "`directory_id`": 200 }`` Please note + that some parameters are used on initial step (before transcoding) only, so + after transcoding there is no use in changing their values. For example, + "`origin_url`" parameter is used for downloading an original file from a + source and never used after transcoding; or "priority" parameter is used to + set priority of processing and never used after transcoding. + + Args: + name: Video name + + auto_transcribe_audio_language: + Automatic creation of subtitles by transcribing the audio track. Values: + + - disable – Do not transcribe. + - auto – Automatically detects the activation of the option based on the + settings in your account. If generation is activated, then automatic language + detection while transcribing. + - \\ – Transcribe from specific language. Can be used to specify the exact + language spoken in the audio track, or when auto language detection fails. + Language is set by 3-letter language code according to ISO-639-2 + (bibliographic code). List of languages is available in `audio_language` + attribute of API POST /streaming/ai/transcribe . Example: + + ``` + `auto_transcribe_audio_language`: "auto" + `auto_transcribe_audio_language`: "ger" + ``` + + More details: + + - List of AI tasks – API + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/get-ai-task-result) + - Add subtitles to an exist video – API + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + + auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified + language(s). Can be used both together with `auto_transcribe_audio_language` + option only. Use it when you want to make automatic subtitles in languages other + than the original language in audio. Values: + + - disable – Do not translate. + - default – There are 3 default languages: eng,fre,ger + - \\ – Explicit language to translate to, or list of languages separated by a + comma. Look at list of available languages in description of AI ASR task + creation. If several languages are specified for translation, a separate + subtitle will be generated for each language. Example: + + ``` + `auto_translate_subtitles_language`: default + `auto_translate_subtitles_language`: eng,fre,ger + ``` + + Please note that subtitle translation is done separately and after + transcription. Thus separate AI-tasks are created for translation. + + client_user_id: Custom field where you can specify user ID in your system + + clip_duration_seconds: The length of the trimmed segment to transcode, instead of the entire length of + the video. Is only used in conjunction with specifying the start of a segment. + Transcoding duration is a number in seconds. + + clip_start_seconds: If you want to transcode only a trimmed segment of a video instead of entire + length if the video, then you can provide timecodes of starting point and + duration of a segment to process. Start encoding from is a number in seconds. + + custom_iframe_url: Deprecated. Custom URL of IFrame for video player to be used in share panel in + player. Auto generated IFrame URL provided by default + + description: Video details; not visible to the end-users + + directory_id: ID of the directory where the video should be uploaded. (beta) + + origin_http_headers: Authorization HTTP request header. Will be used as credentials to authenticate a + request to download a file (specified in "`origin_url`" parameter) on an + external server. Syntax: `Authorization: ` Examples: + + - "`origin_http_headers`": "Authorization: Basic ..." + - "`origin_http_headers`": "Authorization: Bearer ..." + - "`origin_http_headers`": "Authorization: APIKey ..." Example of usage when + downloading a file from Google Drive: + + ``` + POST https://api.gcore.com/streaming/videos + "video": { + "name": "IBC 2024 intro.mp4", + "`origin_url`": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "`origin_http_headers`": "Authorization: Bearer ABC" + } + ``` + + origin_url: URL to an original file which you want to copy from external storage. If + specified, system will download the file and will use it as video source for + transcoding. + + poster: Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several + screenshots (they will be stored in "screenshots" attribute) from which you can + select an default screenshot. This "poster" field is for uploading your own + image. Also use attribute "`screenshot_id`" to select poster as a default + screnshot. Attribute accepts single image as base64-encoded string + [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In + format: `data:[];base64,` MIME-types are image/jpeg, image/webp, and image/png + and file sizes up to 1Mb. Examples: + + - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` + - `data:image/png;base64,iVBORw0KGg...ggg==` + - `data:image/webp;base64,UklGRt.../DgAAAAA` + + priority: Priority allows you to adjust the urgency of processing some videos before + others in your account, if your algorithm requires it. For example, when there + are very urgent video and some regular ones that can wait in the queue. Value + range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest + up-priority. Default priority is 0. + + projection: + Deprecated. Regulates the video format: + + - **regular** — plays the video as usual + - **vr360** — plays the video in 360 degree mode + - **vr180** — plays the video in 180 degree mode + - **vr360tb** — plays the video in 3D 360 degree mode Top-Bottom. + + Default is regular + + quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to + your conditions. Look at GET /`quality_sets` method + + remote_poster_url: Poster URL to download from external resource, instead of uploading via "poster" + attribute. It has the same restrictions as "poster" attribute. + + remove_poster: Set it to true to remove poster + + screenshot_id: Default screenshot index. Specify an ID from the "screenshots" array, so that + the URL of the required screenshot appears in the "screenshot" attribute as the + default screenshot. By default 5 static screenshots will be taken from different + places in the video after transcoding. If the video is short, there may be fewer + screenshots. Counting from 0. A value of -1 sets the default screenshot to the + URL of your own image from the "poster" attribute. Look at "screenshot" + attribute in GET /videos/{`video_id`} for details. + + share_url: Deprecated. Custom URL or iframe displayed in the link field when a user clicks + on a sharing button in player. If empty, the link field and social network + sharing is disabled + + source_bitrate_limit: The option allows you to set the video transcoding rule so that the output + bitrate in ABR ladder is not exceeding the bitrate of the original video. + + This option is for advanced users only. + + By default `source_bitrate_limit: true` this option allows you to have the + output bitrate not more than in the original video, thus to transcode video + faster and to deliver it to end-viewers faster as well. At the same time, the + quality will be similar to the original. If for some reason you need more + byte-space in the output quality when encoding, you can set this option to + `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will + be raised from the bitrate of the original video to the maximum possible limit + specified in our the Product Documentation. For example, this may be needed + when: + + - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, + - to improve the picture quality on dynamic scenes, + - etc. The option is applied only at the video creation stage and cannot be + changed later. If you want to re-transcode the video using new value, then you + need to create and upload a new video only. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/streaming/videos/{video_id}", + body=maybe_transform( + { + "name": name, + "auto_transcribe_audio_language": auto_transcribe_audio_language, + "auto_translate_subtitles_language": auto_translate_subtitles_language, + "client_user_id": client_user_id, + "clip_duration_seconds": clip_duration_seconds, + "clip_start_seconds": clip_start_seconds, + "custom_iframe_url": custom_iframe_url, + "description": description, + "directory_id": directory_id, + "origin_http_headers": origin_http_headers, + "origin_url": origin_url, + "poster": poster, + "priority": priority, + "projection": projection, + "quality_set_id": quality_set_id, + "remote_poster_url": remote_poster_url, + "remove_poster": remove_poster, + "screenshot_id": screenshot_id, + "share_url": share_url, + "source_bitrate_limit": source_bitrate_limit, + }, + video_update_params.VideoUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Video, + ) + + def list( + self, + *, + id: str | NotGiven = NOT_GIVEN, + client_user_id: int | NotGiven = NOT_GIVEN, + fields: str | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, + search: str | NotGiven = NOT_GIVEN, + status: str | NotGiven = NOT_GIVEN, + stream_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncPageStreaming[Video]: + """ + Returns a set of videos by the given criteria. + + Args: + id: IDs of the videos to find. You can specify one or more identifiers separated by + commas. Example, ?id=1,101,1001 + + client_user_id: Find videos where "`client_user_id`" meta field is equal to the search value + + fields: Restriction to return only the specified attributes, instead of the entire + dataset. Specify, if you need to get short response. The following fields are + available for specifying: id, name, duration, status, `created_at`, + `updated_at`, `hls_url`, screenshots, `converted_videos`, priority, `stream_id`. + Example, ?fields=id,name,`hls_url` + + page: Page number. Use it to list the paginated content + + per_page: Items per page number. Use it to list the paginated content + + search: Aggregated search condition. If set, the video list is filtered by one combined + SQL criterion: + + - id={s} OR slug={s} OR name like {s} i.e. "/videos?search=1000" returns list of + videos where id=1000 or slug=1000 or name contains "1000". + + status: + Use it to get videos filtered by their status. Possible values: + + - empty + - pending + - viewable + - ready + - error + + stream_id: Find videos recorded from a specific stream, so for which "`stream_id`" field is + equal to the search value + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/videos", + page=SyncPageStreaming[Video], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "client_user_id": client_user_id, + "fields": fields, + "page": page, + "per_page": per_page, + "search": search, + "status": status, + "stream_id": stream_id, + }, + video_list_params.VideoListParams, + ), + ), + model=Video, + ) + + def delete( + self, + video_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Operation to delete video entity. + + When you delete a video, all transcoded qualities and all associated files such + as subtitles and screenshots, as well as other data, are deleted from cloud + storage. The video is deleted permanently and irreversibly. Therefore, it is + impossible to restore files after this. + + For detailed information and information on calculating your maximum monthly + storage usage, please refer to the Product Documentation. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/streaming/videos/{video_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def create_multiple( + self, + *, + fields: str | NotGiven = NOT_GIVEN, + videos: Iterable[video_create_multiple_params.Video] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VideoCreateMultipleResponse: + """Mass upload of your videos. + + Method is used to set the task of creating videos in + the form of 1 aggregated request instead of a large number of single requests. + + An additional advantage is the ability to specify subtitles in the same request. + Whereas for a normal single upload, subtitles are uploaded in separate requests. + + All videos in the request will be processed in queue in order of priority. Use + "priority" attribute and look at general description in POST /videos method. + Limits: + + - Batch max size = 500 videos. + - Max body size (payload) = 64MB. + - API connection timeout = 30 sec. + + Args: + fields: Restriction to return only the specified attributes, instead of the entire + dataset. Specify, if you need to get short response. The following fields are + available for specifying: id, name, duration, status, `created_at`, + `updated_at`, `hls_url`, screenshots, `converted_videos`, priority. Example, + ?fields=id,name,`hls_url` + + 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( + "/streaming/videos/batch", + body=maybe_transform({"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"fields": fields}, video_create_multiple_params.VideoCreateMultipleParams), + ), + cast_to=VideoCreateMultipleResponse, + ) + + def get( + self, + video_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, + ) -> Video: + """Information about a video entity. + + Contains all the data about the video: + meta-data, data for streaming and renditions, static media data, data about + original video. You can use different methods to play video: + + - `iframe_url` – a URL to a built-in HTML video player with automatically + configured video playback. + - `hls_url` – a URLs to HLS TS .m3u8 manifest, which can be played in video + players. + - `hls_cmaf_url` – a URL to HLS CMAF .m3u8 manifest with chunks in fMP4 format, + which can be played in most modern video players. + - `dash_url` – a URL to MPEG-DASH .mpd manifest, which can be played in most + modern video players. Preferable for Android and Windows devices. + - `converted_videos`/`mp4_url` – a URL to MP4 file of specific rendition. + ![Video player](https://demo-files.gvideo.io/apidocs/coffee-run-player.jpg) + + 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"/streaming/videos/{video_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Video, + ) + + def get_parameters_for_direct_upload( + self, + video_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, + ) -> DirectUploadParameters: + """ + Use this method to get TUS' session parameters: hostname of the server to + upload, secure token. The general sequence of actions for a direct upload of a + video is as follows: + + - Create video entity via POST method + ["Create video"](/docs/api-reference/streaming/videos/create-video) + - Get TUS' session parameters (you are here now) + - Upload file via TUS client, choose your implementation on + [tus.io](https://tus.io/implementations) Final endpoint for uploading is + constructed using the following template: "https://{hostname}/upload/". Also + you have to provide token, `client_id`, `video_id` as metadata too. A short + javascript example is shown below, based on tus-js-client. Variable "data" + below is the result of this API request. Please, note that we support 2.x + version only of tus-js-client. + + ``` + uploads[data.video.id] = new tus.Upload(file, { + endpoint: `https://${data.servers[0].hostname}/upload/`, + metadata: { + filename: data.video.name, + token: data.token, + `video_id`: data.video.id, + `client_id`: data.video.`client_id` + }, + onSuccess: function() { + ... + } + } + uploads[data.video.id].start(); + ``` + + 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"/streaming/videos/{video_id}/upload", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DirectUploadParameters, + ) + + def list_names( + self, + *, + ids: Iterable[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Returns names for specified video IDs + + Args: + ids: Comma-separated set of video IDs. Example, ?ids=7,17 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._get( + "/streaming/videos/names", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"ids": ids}, video_list_names_params.VideoListNamesParams), + ), + cast_to=NoneType, + ) + + +class AsyncVideosResource(AsyncAPIResource): + @cached_property + def subtitles(self) -> AsyncSubtitlesResource: + return AsyncSubtitlesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncVideosResourceWithRawResponse: + """ + 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 AsyncVideosResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVideosResourceWithStreamingResponse: + """ + 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 AsyncVideosResourceWithStreamingResponse(self) + + async def create( + self, + *, + video: CreateVideoParam | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VideoCreateResponse: + """ + Use this method to create a new video entity. + + **Methods of creating** To upload the original video file to the server, there + are several possible scenarios: + + - **Copy from another server** – If your video is accessable via "http://", + "https://", or "sftp://" public link, then you can use this method to copy a + file from an external server. Set `origin_url` parameter with the link to the + original video file (i.e. "https://domain.com/video.mp4"). After method + execution file will be uploaded and will be sent to transcoding automatically, + you don't have to do anything else. Use extra field `origin_http_headers` if + authorization is required on the external server. + - **Direct upload from a local device** – If you need to upload video directly + from your local device or from a mobile app, then use this method. Keep + `origin_url` empty and use TUS protocol ([tus.io](https://tus.io)) to upload + file. More details are here + ["Get TUS' upload"](/docs/api-reference/streaming/videos/get-tus-parameters-for-direct-upload) + After getting the video, it is processed through the queue. There are 2 + priority criteria: global and local. Global is determined automatically by the + system as converters are ready to get next video, so your videos rarely queue + longer than usual (when you don't have a dedicated region). Local priority + works at the level of your account and you have full control over it, look at + "priority" attribute. + + **AI processing** When uploading a video, it is possible to automatically create + subtitles based on AI. Read more: + + - What is + ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + - If the option is enabled via `auto_transcribe_audio_language: auto|`, then + immediately after successful transcoding, an AI task will be automatically + created for transcription. + - If you need to translate subtitles from original language to any other, then + AI-task of subtitles translation can be applied. Use + `auto_translate_subtitles_language: default|` parameter for that. Also you can + point several languages to translate to, then a separate subtitle will be + generated for each specified language. + - How to + ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + The created AI-task(s) will be automatically executed, and result will also be + automatically attached to this video as subtitle(s). Please note that + transcription is done automatically for all videos uploaded to our video + hosting. If necessary, you can disable automatic creation of subtitles. If AI + is disabled in your account, no AI functionality is called. + + **Advanced Features** For details on the requirements for incoming original + files, and output video parameters after transcoding, refer to the Knowledge + Base documentation. By default video will be transcoded according to the + original resolution, and a quality ladder suitable for your original video will + be applied. There is no automatic upscaling; the maximum quality is taken from + the original video. If you want to upload specific files not explicitly listed + in requirements or wish to modify the standard quality ladder (i.e. decrease + quality or add new non-standard qualities), then such customization is possible. + Please reach out to us for assistance. + + Additionally, check the Knowledge Base for any supplementary information you may + need. + + 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( + "/streaming/videos", + body=await async_maybe_transform({"video": video}, video_create_params.VideoCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VideoCreateResponse, + ) + + async def update( + self, + video_id: int, + *, + name: str, + auto_transcribe_audio_language: Literal["disable", "auto", ""] | NotGiven = NOT_GIVEN, + auto_translate_subtitles_language: Literal["disable", "default", ""] | NotGiven = NOT_GIVEN, + client_user_id: int | NotGiven = NOT_GIVEN, + clip_duration_seconds: int | NotGiven = NOT_GIVEN, + clip_start_seconds: int | NotGiven = NOT_GIVEN, + custom_iframe_url: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + directory_id: int | NotGiven = NOT_GIVEN, + origin_http_headers: str | NotGiven = NOT_GIVEN, + origin_url: str | NotGiven = NOT_GIVEN, + poster: str | NotGiven = NOT_GIVEN, + priority: int | NotGiven = NOT_GIVEN, + projection: str | NotGiven = NOT_GIVEN, + quality_set_id: int | NotGiven = NOT_GIVEN, + remote_poster_url: str | NotGiven = NOT_GIVEN, + remove_poster: bool | NotGiven = NOT_GIVEN, + screenshot_id: int | NotGiven = NOT_GIVEN, + share_url: str | NotGiven = NOT_GIVEN, + source_bitrate_limit: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Video: + """Changes parameters of the video to new values. + + It's allowed to update only those + public parameters that are described in POST method to create a new “video” + entity. So it's not possible to change calculated parameters like "id", + "duration", "`hls_url`", etc. Examples of changing: + + - Name: `{ "name": "new name of the video" }` + - Move the video to a new directory: `` { "`directory_id`": 200 }`` Please note + that some parameters are used on initial step (before transcoding) only, so + after transcoding there is no use in changing their values. For example, + "`origin_url`" parameter is used for downloading an original file from a + source and never used after transcoding; or "priority" parameter is used to + set priority of processing and never used after transcoding. + + Args: + name: Video name + + auto_transcribe_audio_language: + Automatic creation of subtitles by transcribing the audio track. Values: + + - disable – Do not transcribe. + - auto – Automatically detects the activation of the option based on the + settings in your account. If generation is activated, then automatic language + detection while transcribing. + - \\ – Transcribe from specific language. Can be used to specify the exact + language spoken in the audio track, or when auto language detection fails. + Language is set by 3-letter language code according to ISO-639-2 + (bibliographic code). List of languages is available in `audio_language` + attribute of API POST /streaming/ai/transcribe . Example: + + ``` + `auto_transcribe_audio_language`: "auto" + `auto_transcribe_audio_language`: "ger" + ``` + + More details: + + - List of AI tasks – API + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/get-ai-task-result) + - Add subtitles to an exist video – API + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + + auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified + language(s). Can be used both together with `auto_transcribe_audio_language` + option only. Use it when you want to make automatic subtitles in languages other + than the original language in audio. Values: + + - disable – Do not translate. + - default – There are 3 default languages: eng,fre,ger + - \\ – Explicit language to translate to, or list of languages separated by a + comma. Look at list of available languages in description of AI ASR task + creation. If several languages are specified for translation, a separate + subtitle will be generated for each language. Example: + + ``` + `auto_translate_subtitles_language`: default + `auto_translate_subtitles_language`: eng,fre,ger + ``` + + Please note that subtitle translation is done separately and after + transcription. Thus separate AI-tasks are created for translation. + + client_user_id: Custom field where you can specify user ID in your system + + clip_duration_seconds: The length of the trimmed segment to transcode, instead of the entire length of + the video. Is only used in conjunction with specifying the start of a segment. + Transcoding duration is a number in seconds. + + clip_start_seconds: If you want to transcode only a trimmed segment of a video instead of entire + length if the video, then you can provide timecodes of starting point and + duration of a segment to process. Start encoding from is a number in seconds. + + custom_iframe_url: Deprecated. Custom URL of IFrame for video player to be used in share panel in + player. Auto generated IFrame URL provided by default + + description: Video details; not visible to the end-users + + directory_id: ID of the directory where the video should be uploaded. (beta) + + origin_http_headers: Authorization HTTP request header. Will be used as credentials to authenticate a + request to download a file (specified in "`origin_url`" parameter) on an + external server. Syntax: `Authorization: ` Examples: + + - "`origin_http_headers`": "Authorization: Basic ..." + - "`origin_http_headers`": "Authorization: Bearer ..." + - "`origin_http_headers`": "Authorization: APIKey ..." Example of usage when + downloading a file from Google Drive: + + ``` + POST https://api.gcore.com/streaming/videos + "video": { + "name": "IBC 2024 intro.mp4", + "`origin_url`": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "`origin_http_headers`": "Authorization: Bearer ABC" + } + ``` + + origin_url: URL to an original file which you want to copy from external storage. If + specified, system will download the file and will use it as video source for + transcoding. + + poster: Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several + screenshots (they will be stored in "screenshots" attribute) from which you can + select an default screenshot. This "poster" field is for uploading your own + image. Also use attribute "`screenshot_id`" to select poster as a default + screnshot. Attribute accepts single image as base64-encoded string + [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In + format: `data:[];base64,` MIME-types are image/jpeg, image/webp, and image/png + and file sizes up to 1Mb. Examples: + + - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` + - `data:image/png;base64,iVBORw0KGg...ggg==` + - `data:image/webp;base64,UklGRt.../DgAAAAA` + + priority: Priority allows you to adjust the urgency of processing some videos before + others in your account, if your algorithm requires it. For example, when there + are very urgent video and some regular ones that can wait in the queue. Value + range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest + up-priority. Default priority is 0. + + projection: + Deprecated. Regulates the video format: + + - **regular** — plays the video as usual + - **vr360** — plays the video in 360 degree mode + - **vr180** — plays the video in 180 degree mode + - **vr360tb** — plays the video in 3D 360 degree mode Top-Bottom. + + Default is regular + + quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to + your conditions. Look at GET /`quality_sets` method + + remote_poster_url: Poster URL to download from external resource, instead of uploading via "poster" + attribute. It has the same restrictions as "poster" attribute. + + remove_poster: Set it to true to remove poster + + screenshot_id: Default screenshot index. Specify an ID from the "screenshots" array, so that + the URL of the required screenshot appears in the "screenshot" attribute as the + default screenshot. By default 5 static screenshots will be taken from different + places in the video after transcoding. If the video is short, there may be fewer + screenshots. Counting from 0. A value of -1 sets the default screenshot to the + URL of your own image from the "poster" attribute. Look at "screenshot" + attribute in GET /videos/{`video_id`} for details. + + share_url: Deprecated. Custom URL or iframe displayed in the link field when a user clicks + on a sharing button in player. If empty, the link field and social network + sharing is disabled + + source_bitrate_limit: The option allows you to set the video transcoding rule so that the output + bitrate in ABR ladder is not exceeding the bitrate of the original video. + + This option is for advanced users only. + + By default `source_bitrate_limit: true` this option allows you to have the + output bitrate not more than in the original video, thus to transcode video + faster and to deliver it to end-viewers faster as well. At the same time, the + quality will be similar to the original. If for some reason you need more + byte-space in the output quality when encoding, you can set this option to + `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will + be raised from the bitrate of the original video to the maximum possible limit + specified in our the Product Documentation. For example, this may be needed + when: + + - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, + - to improve the picture quality on dynamic scenes, + - etc. The option is applied only at the video creation stage and cannot be + changed later. If you want to re-transcode the video using new value, then you + need to create and upload a new video only. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/streaming/videos/{video_id}", + body=await async_maybe_transform( + { + "name": name, + "auto_transcribe_audio_language": auto_transcribe_audio_language, + "auto_translate_subtitles_language": auto_translate_subtitles_language, + "client_user_id": client_user_id, + "clip_duration_seconds": clip_duration_seconds, + "clip_start_seconds": clip_start_seconds, + "custom_iframe_url": custom_iframe_url, + "description": description, + "directory_id": directory_id, + "origin_http_headers": origin_http_headers, + "origin_url": origin_url, + "poster": poster, + "priority": priority, + "projection": projection, + "quality_set_id": quality_set_id, + "remote_poster_url": remote_poster_url, + "remove_poster": remove_poster, + "screenshot_id": screenshot_id, + "share_url": share_url, + "source_bitrate_limit": source_bitrate_limit, + }, + video_update_params.VideoUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Video, + ) + + def list( + self, + *, + id: str | NotGiven = NOT_GIVEN, + client_user_id: int | NotGiven = NOT_GIVEN, + fields: str | NotGiven = NOT_GIVEN, + page: int | NotGiven = NOT_GIVEN, + per_page: int | NotGiven = NOT_GIVEN, + search: str | NotGiven = NOT_GIVEN, + status: str | NotGiven = NOT_GIVEN, + stream_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Video, AsyncPageStreaming[Video]]: + """ + Returns a set of videos by the given criteria. + + Args: + id: IDs of the videos to find. You can specify one or more identifiers separated by + commas. Example, ?id=1,101,1001 + + client_user_id: Find videos where "`client_user_id`" meta field is equal to the search value + + fields: Restriction to return only the specified attributes, instead of the entire + dataset. Specify, if you need to get short response. The following fields are + available for specifying: id, name, duration, status, `created_at`, + `updated_at`, `hls_url`, screenshots, `converted_videos`, priority, `stream_id`. + Example, ?fields=id,name,`hls_url` + + page: Page number. Use it to list the paginated content + + per_page: Items per page number. Use it to list the paginated content + + search: Aggregated search condition. If set, the video list is filtered by one combined + SQL criterion: + + - id={s} OR slug={s} OR name like {s} i.e. "/videos?search=1000" returns list of + videos where id=1000 or slug=1000 or name contains "1000". + + status: + Use it to get videos filtered by their status. Possible values: + + - empty + - pending + - viewable + - ready + - error + + stream_id: Find videos recorded from a specific stream, so for which "`stream_id`" field is + equal to the search value + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/streaming/videos", + page=AsyncPageStreaming[Video], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "client_user_id": client_user_id, + "fields": fields, + "page": page, + "per_page": per_page, + "search": search, + "status": status, + "stream_id": stream_id, + }, + video_list_params.VideoListParams, + ), + ), + model=Video, + ) + + async def delete( + self, + video_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Operation to delete video entity. + + When you delete a video, all transcoded qualities and all associated files such + as subtitles and screenshots, as well as other data, are deleted from cloud + storage. The video is deleted permanently and irreversibly. Therefore, it is + impossible to restore files after this. + + For detailed information and information on calculating your maximum monthly + storage usage, please refer to the Product Documentation. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/streaming/videos/{video_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def create_multiple( + self, + *, + fields: str | NotGiven = NOT_GIVEN, + videos: Iterable[video_create_multiple_params.Video] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VideoCreateMultipleResponse: + """Mass upload of your videos. + + Method is used to set the task of creating videos in + the form of 1 aggregated request instead of a large number of single requests. + + An additional advantage is the ability to specify subtitles in the same request. + Whereas for a normal single upload, subtitles are uploaded in separate requests. + + All videos in the request will be processed in queue in order of priority. Use + "priority" attribute and look at general description in POST /videos method. + Limits: + + - Batch max size = 500 videos. + - Max body size (payload) = 64MB. + - API connection timeout = 30 sec. + + Args: + fields: Restriction to return only the specified attributes, instead of the entire + dataset. Specify, if you need to get short response. The following fields are + available for specifying: id, name, duration, status, `created_at`, + `updated_at`, `hls_url`, screenshots, `converted_videos`, priority. Example, + ?fields=id,name,`hls_url` + + 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( + "/streaming/videos/batch", + body=await async_maybe_transform( + {"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"fields": fields}, video_create_multiple_params.VideoCreateMultipleParams + ), + ), + cast_to=VideoCreateMultipleResponse, + ) + + async def get( + self, + video_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, + ) -> Video: + """Information about a video entity. + + Contains all the data about the video: + meta-data, data for streaming and renditions, static media data, data about + original video. You can use different methods to play video: + + - `iframe_url` – a URL to a built-in HTML video player with automatically + configured video playback. + - `hls_url` – a URLs to HLS TS .m3u8 manifest, which can be played in video + players. + - `hls_cmaf_url` – a URL to HLS CMAF .m3u8 manifest with chunks in fMP4 format, + which can be played in most modern video players. + - `dash_url` – a URL to MPEG-DASH .mpd manifest, which can be played in most + modern video players. Preferable for Android and Windows devices. + - `converted_videos`/`mp4_url` – a URL to MP4 file of specific rendition. + ![Video player](https://demo-files.gvideo.io/apidocs/coffee-run-player.jpg) + + 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"/streaming/videos/{video_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Video, + ) + + async def get_parameters_for_direct_upload( + self, + video_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, + ) -> DirectUploadParameters: + """ + Use this method to get TUS' session parameters: hostname of the server to + upload, secure token. The general sequence of actions for a direct upload of a + video is as follows: + + - Create video entity via POST method + ["Create video"](/docs/api-reference/streaming/videos/create-video) + - Get TUS' session parameters (you are here now) + - Upload file via TUS client, choose your implementation on + [tus.io](https://tus.io/implementations) Final endpoint for uploading is + constructed using the following template: "https://{hostname}/upload/". Also + you have to provide token, `client_id`, `video_id` as metadata too. A short + javascript example is shown below, based on tus-js-client. Variable "data" + below is the result of this API request. Please, note that we support 2.x + version only of tus-js-client. + + ``` + uploads[data.video.id] = new tus.Upload(file, { + endpoint: `https://${data.servers[0].hostname}/upload/`, + metadata: { + filename: data.video.name, + token: data.token, + `video_id`: data.video.id, + `client_id`: data.video.`client_id` + }, + onSuccess: function() { + ... + } + } + uploads[data.video.id].start(); + ``` + + 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"/streaming/videos/{video_id}/upload", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DirectUploadParameters, + ) + + async def list_names( + self, + *, + ids: Iterable[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Returns names for specified video IDs + + Args: + ids: Comma-separated set of video IDs. Example, ?ids=7,17 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._get( + "/streaming/videos/names", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"ids": ids}, video_list_names_params.VideoListNamesParams), + ), + cast_to=NoneType, + ) + + +class VideosResourceWithRawResponse: + def __init__(self, videos: VideosResource) -> None: + self._videos = videos + + self.create = to_raw_response_wrapper( + videos.create, + ) + self.update = to_raw_response_wrapper( + videos.update, + ) + self.list = to_raw_response_wrapper( + videos.list, + ) + self.delete = to_raw_response_wrapper( + videos.delete, + ) + self.create_multiple = to_raw_response_wrapper( + videos.create_multiple, + ) + self.get = to_raw_response_wrapper( + videos.get, + ) + self.get_parameters_for_direct_upload = to_raw_response_wrapper( + videos.get_parameters_for_direct_upload, + ) + self.list_names = to_raw_response_wrapper( + videos.list_names, + ) + + @cached_property + def subtitles(self) -> SubtitlesResourceWithRawResponse: + return SubtitlesResourceWithRawResponse(self._videos.subtitles) + + +class AsyncVideosResourceWithRawResponse: + def __init__(self, videos: AsyncVideosResource) -> None: + self._videos = videos + + self.create = async_to_raw_response_wrapper( + videos.create, + ) + self.update = async_to_raw_response_wrapper( + videos.update, + ) + self.list = async_to_raw_response_wrapper( + videos.list, + ) + self.delete = async_to_raw_response_wrapper( + videos.delete, + ) + self.create_multiple = async_to_raw_response_wrapper( + videos.create_multiple, + ) + self.get = async_to_raw_response_wrapper( + videos.get, + ) + self.get_parameters_for_direct_upload = async_to_raw_response_wrapper( + videos.get_parameters_for_direct_upload, + ) + self.list_names = async_to_raw_response_wrapper( + videos.list_names, + ) + + @cached_property + def subtitles(self) -> AsyncSubtitlesResourceWithRawResponse: + return AsyncSubtitlesResourceWithRawResponse(self._videos.subtitles) + + +class VideosResourceWithStreamingResponse: + def __init__(self, videos: VideosResource) -> None: + self._videos = videos + + self.create = to_streamed_response_wrapper( + videos.create, + ) + self.update = to_streamed_response_wrapper( + videos.update, + ) + self.list = to_streamed_response_wrapper( + videos.list, + ) + self.delete = to_streamed_response_wrapper( + videos.delete, + ) + self.create_multiple = to_streamed_response_wrapper( + videos.create_multiple, + ) + self.get = to_streamed_response_wrapper( + videos.get, + ) + self.get_parameters_for_direct_upload = to_streamed_response_wrapper( + videos.get_parameters_for_direct_upload, + ) + self.list_names = to_streamed_response_wrapper( + videos.list_names, + ) + + @cached_property + def subtitles(self) -> SubtitlesResourceWithStreamingResponse: + return SubtitlesResourceWithStreamingResponse(self._videos.subtitles) + + +class AsyncVideosResourceWithStreamingResponse: + def __init__(self, videos: AsyncVideosResource) -> None: + self._videos = videos + + self.create = async_to_streamed_response_wrapper( + videos.create, + ) + self.update = async_to_streamed_response_wrapper( + videos.update, + ) + self.list = async_to_streamed_response_wrapper( + videos.list, + ) + self.delete = async_to_streamed_response_wrapper( + videos.delete, + ) + self.create_multiple = async_to_streamed_response_wrapper( + videos.create_multiple, + ) + self.get = async_to_streamed_response_wrapper( + videos.get, + ) + self.get_parameters_for_direct_upload = async_to_streamed_response_wrapper( + videos.get_parameters_for_direct_upload, + ) + self.list_names = async_to_streamed_response_wrapper( + videos.list_names, + ) + + @cached_property + def subtitles(self) -> AsyncSubtitlesResourceWithStreamingResponse: + return AsyncSubtitlesResourceWithStreamingResponse(self._videos.subtitles) diff --git a/src/gcore/types/streaming/__init__.py b/src/gcore/types/streaming/__init__.py new file mode 100644 index 00000000..d64adf6e --- /dev/null +++ b/src/gcore/types/streaming/__init__.py @@ -0,0 +1,143 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .clip import Clip as Clip +from .video import Video as Video +from .views import Views as Views +from .player import Player as Player +from .stream import Stream as Stream +from .ai_task import AITask as AITask +from .ffprobes import Ffprobes as Ffprobes +from .playlist import Playlist as Playlist +from .restream import Restream as Restream +from .subtitle import Subtitle as Subtitle +from .broadcast import Broadcast as Broadcast +from .meet_series import MeetSeries as MeetSeries +from .player_param import PlayerParam as PlayerParam +from .quality_sets import QualitySets as QualitySets +from .stream_series import StreamSeries as StreamSeries +from .subtitle_base import SubtitleBase as SubtitleBase +from .views_heatmap import ViewsHeatmap as ViewsHeatmap +from .directory_base import DirectoryBase as DirectoryBase +from .directory_item import DirectoryItem as DirectoryItem +from .playlist_video import PlaylistVideo as PlaylistVideo +from .popular_videos import PopularVideos as PopularVideos +from .storage_series import StorageSeries as StorageSeries +from .unique_viewers import UniqueViewers as UniqueViewers +from .directory_video import DirectoryVideo as DirectoryVideo +from .playlist_create import PlaylistCreate as PlaylistCreate +from .views_by_region import ViewsByRegion as ViewsByRegion +from .directories_tree import DirectoriesTree as DirectoriesTree +from .views_by_browser import ViewsByBrowser as ViewsByBrowser +from .views_by_country import ViewsByCountry as ViewsByCountry +from .views_by_referer import ViewsByReferer as ViewsByReferer +from .max_stream_series import MaxStreamSeries as MaxStreamSeries +from .video_list_params import VideoListParams as VideoListParams +from .views_by_hostname import ViewsByHostname as ViewsByHostname +from .create_video_param import CreateVideoParam as CreateVideoParam +from .player_list_params import PlayerListParams as PlayerListParams +from .stream_list_params import StreamListParams as StreamListParams +from .unique_viewers_cdn import UniqueViewersCdn as UniqueViewersCdn +from .ai_task_list_params import AITaskListParams as AITaskListParams +from .subtitle_base_param import SubtitleBaseParam as SubtitleBaseParam +from .video_create_params import VideoCreateParams as VideoCreateParams +from .video_update_params import VideoUpdateParams as VideoUpdateParams +from .ai_task_get_response import AITaskGetResponse as AITaskGetResponse +from .player_create_params import PlayerCreateParams as PlayerCreateParams +from .player_update_params import PlayerUpdateParams as PlayerUpdateParams +from .playlist_list_params import PlaylistListParams as PlaylistListParams +from .restream_list_params import RestreamListParams as RestreamListParams +from .stream_create_params import StreamCreateParams as StreamCreateParams +from .stream_update_params import StreamUpdateParams as StreamUpdateParams +from .ai_task_create_params import AITaskCreateParams as AITaskCreateParams +from .broadcast_list_params import BroadcastListParams as BroadcastListParams +from .video_create_response import VideoCreateResponse as VideoCreateResponse +from .vod_statistics_series import VodStatisticsSeries as VodStatisticsSeries +from .directory_get_response import DirectoryGetResponse as DirectoryGetResponse +from .playlist_create_params import PlaylistCreateParams as PlaylistCreateParams +from .playlist_update_params import PlaylistUpdateParams as PlaylistUpdateParams +from .restream_create_params import RestreamCreateParams as RestreamCreateParams +from .restream_update_params import RestreamUpdateParams as RestreamUpdateParams +from .ai_task_cancel_response import AITaskCancelResponse as AITaskCancelResponse +from .ai_task_create_response import AITaskCreateResponse as AITaskCreateResponse +from .broadcast_create_params import BroadcastCreateParams as BroadcastCreateParams +from .broadcast_update_params import BroadcastUpdateParams as BroadcastUpdateParams +from .directory_create_params import DirectoryCreateParams as DirectoryCreateParams +from .directory_update_params import DirectoryUpdateParams as DirectoryUpdateParams +from .video_list_names_params import VideoListNamesParams as VideoListNamesParams +from .direct_upload_parameters import DirectUploadParameters as DirectUploadParameters +from .ai_contentmoderation_casm import AIContentmoderationCasm as AIContentmoderationCasm +from .ai_contentmoderation_nsfw import AIContentmoderationNsfw as AIContentmoderationNsfw +from .stream_create_clip_params import StreamCreateClipParams as StreamCreateClipParams +from .views_by_operating_system import ViewsByOperatingSystem as ViewsByOperatingSystem +from .ai_contentmoderation_sport import AIContentmoderationSport as AIContentmoderationSport +from .broadcast_spectators_count import BroadcastSpectatorsCount as BroadcastSpectatorsCount +from .statistic_get_views_params import StatisticGetViewsParams as StatisticGetViewsParams +from .stream_list_clips_response import StreamListClipsResponse as StreamListClipsResponse +from .ai_contentmoderation_weapon import AIContentmoderationWeapon as AIContentmoderationWeapon +from .video_create_multiple_params import VideoCreateMultipleParams as VideoCreateMultipleParams +from .playlist_list_videos_response import PlaylistListVideosResponse as PlaylistListVideosResponse +from .statistic_get_ffprobes_params import StatisticGetFfprobesParams as StatisticGetFfprobesParams +from .ai_task_get_ai_settings_params import AITaskGetAISettingsParams as AITaskGetAISettingsParams +from .quality_set_set_default_params import QualitySetSetDefaultParams as QualitySetSetDefaultParams +from .video_create_multiple_response import VideoCreateMultipleResponse as VideoCreateMultipleResponse +from .ai_contentmoderation_hardnudity import AIContentmoderationHardnudity as AIContentmoderationHardnudity +from .ai_contentmoderation_softnudity import AIContentmoderationSoftnudity as AIContentmoderationSoftnudity +from .stream_start_recording_response import StreamStartRecordingResponse as StreamStartRecordingResponse +from .ai_task_get_ai_settings_response import AITaskGetAISettingsResponse as AITaskGetAISettingsResponse +from .statistic_get_meet_series_params import StatisticGetMeetSeriesParams as StatisticGetMeetSeriesParams +from .vod_total_stream_duration_series import VodTotalStreamDurationSeries as VodTotalStreamDurationSeries +from .statistic_get_stream_series_params import StatisticGetStreamSeriesParams as StatisticGetStreamSeriesParams +from .statistic_get_views_heatmap_params import StatisticGetViewsHeatmapParams as StatisticGetViewsHeatmapParams +from .statistic_get_popular_videos_params import StatisticGetPopularVideosParams as StatisticGetPopularVideosParams +from .statistic_get_storage_series_params import StatisticGetStorageSeriesParams as StatisticGetStorageSeriesParams +from .statistic_get_unique_viewers_params import StatisticGetUniqueViewersParams as StatisticGetUniqueViewersParams +from .statistic_get_views_by_region_params import StatisticGetViewsByRegionParams as StatisticGetViewsByRegionParams +from .statistic_get_views_by_country_params import StatisticGetViewsByCountryParams as StatisticGetViewsByCountryParams +from .statistic_get_views_by_referer_params import StatisticGetViewsByRefererParams as StatisticGetViewsByRefererParams +from .statistic_get_views_by_browsers_params import ( + StatisticGetViewsByBrowsersParams as StatisticGetViewsByBrowsersParams, +) +from .statistic_get_views_by_hostname_params import ( + StatisticGetViewsByHostnameParams as StatisticGetViewsByHostnameParams, +) +from .statistic_get_max_streams_series_params import ( + StatisticGetMaxStreamsSeriesParams as StatisticGetMaxStreamsSeriesParams, +) +from .statistic_get_unique_viewers_cdn_params import ( + StatisticGetUniqueViewersCdnParams as StatisticGetUniqueViewersCdnParams, +) +from .statistic_get_vod_storage_volume_params import ( + StatisticGetVodStorageVolumeParams as StatisticGetVodStorageVolumeParams, +) +from .statistic_get_vod_watch_time_cdn_params import ( + StatisticGetVodWatchTimeCdnParams as StatisticGetVodWatchTimeCdnParams, +) +from .statistic_get_live_unique_viewers_params import ( + StatisticGetLiveUniqueViewersParams as StatisticGetLiveUniqueViewersParams, +) +from .statistic_get_live_watch_time_cdn_params import ( + StatisticGetLiveWatchTimeCdnParams as StatisticGetLiveWatchTimeCdnParams, +) +from .statistic_get_live_unique_viewers_response import ( + StatisticGetLiveUniqueViewersResponse as StatisticGetLiveUniqueViewersResponse, +) +from .statistic_get_vod_unique_viewers_cdn_params import ( + StatisticGetVodUniqueViewersCdnParams as StatisticGetVodUniqueViewersCdnParams, +) +from .statistic_get_vod_transcoding_duration_params import ( + StatisticGetVodTranscodingDurationParams as StatisticGetVodTranscodingDurationParams, +) +from .statistic_get_vod_watch_time_total_cdn_params import ( + StatisticGetVodWatchTimeTotalCdnParams as StatisticGetVodWatchTimeTotalCdnParams, +) +from .statistic_get_live_watch_time_total_cdn_params import ( + StatisticGetLiveWatchTimeTotalCdnParams as StatisticGetLiveWatchTimeTotalCdnParams, +) +from .statistic_get_views_by_operating_system_params import ( + StatisticGetViewsByOperatingSystemParams as StatisticGetViewsByOperatingSystemParams, +) +from .statistic_get_vod_watch_time_total_cdn_response import ( + StatisticGetVodWatchTimeTotalCdnResponse as StatisticGetVodWatchTimeTotalCdnResponse, +) diff --git a/src/gcore/types/streaming/ai_contentmoderation_casm.py b/src/gcore/types/streaming/ai_contentmoderation_casm.py new file mode 100644 index 00000000..be44029f --- /dev/null +++ b/src/gcore/types/streaming/ai_contentmoderation_casm.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["AIContentmoderationCasm"] + + +class AIContentmoderationCasm(BaseModel): + category: Literal["child_pornography", "sport", "weapon", "nsfw", "hard_nudity", "soft_nudity"] + """AI content moderation with child pornography detection algorithm""" + + task_name: Literal["content-moderation"] + """Name of the task to be performed""" + + url: str + """URL to the MP4 file to analyse. + + File must be publicly accessible via HTTP/HTTPS. + """ + + client_entity_data: Optional[str] = None + """ + Meta parameter, designed to store your own extra information about a video + entity: video source, video id, etc. It is not used in any way in video + processing. For example, if an AI-task was created automatically when you + uploaded a video with the AI auto-processing option (nudity detection, etc), + then the ID of the associated video for which the task was performed will be + explicitly indicated here. + """ + + client_user_id: Optional[str] = None + """Meta parameter, designed to store your own identifier. + + Can be used by you to tag requests from different end-users. It is not used in + any way in video processing. + """ diff --git a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py new file mode 100644 index 00000000..4dd49d55 --- /dev/null +++ b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py @@ -0,0 +1,54 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["AIContentmoderationHardnudity"] + + +class AIContentmoderationHardnudity(BaseModel): + category: Literal["hard_nudity", "sport", "weapon", "nsfw", "soft_nudity", "child_pornography"] + """AI content moderation with "`hard_nudity`" algorithm""" + + task_name: Literal["content-moderation"] + """Name of the task to be performed""" + + url: str + """URL to the MP4 file to analyse. + + File must be publicly accessible via HTTP/HTTPS. + """ + + client_entity_data: Optional[str] = None + """ + Meta parameter, designed to store your own extra information about a video + entity: video source, video id, etc. It is not used in any way in video + processing. For example, if an AI-task was created automatically when you + uploaded a video with the AI auto-processing option (nudity detection, etc), + then the ID of the associated video for which the task was performed will be + explicitly indicated here. + """ + + client_user_id: Optional[str] = None + """Meta parameter, designed to store your own identifier. + + Can be used by you to tag requests from different end-users. It is not used in + any way in video processing. + """ + + stop_objects: Optional[ + Literal[ + "ANUS_EXPOSED", + "BUTTOCKS_EXPOSED", + "FEMALE_BREAST_EXPOSED", + "FEMALE_GENITALIA_EXPOSED", + "MALE_BREAST_EXPOSED", + "MALE_GENITALIA_EXPOSED", + ] + ] = None + """ + Comma separated objects, and probabilities, that will cause the processing to + stop immediatelly after finding. + """ diff --git a/src/gcore/types/streaming/ai_contentmoderation_nsfw.py b/src/gcore/types/streaming/ai_contentmoderation_nsfw.py new file mode 100644 index 00000000..c2df5d03 --- /dev/null +++ b/src/gcore/types/streaming/ai_contentmoderation_nsfw.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["AIContentmoderationNsfw"] + + +class AIContentmoderationNsfw(BaseModel): + category: Literal["nsfw", "sport", "weapon", "hard_nudity", "soft_nudity", "child_pornography"] + """AI content moderation with NSFW detection algorithm""" + + task_name: Literal["content-moderation"] + """Name of the task to be performed""" + + url: str + """URL to the MP4 file to analyse. + + File must be publicly accessible via HTTP/HTTPS. + """ + + client_entity_data: Optional[str] = None + """ + Meta parameter, designed to store your own extra information about a video + entity: video source, video id, etc. It is not used in any way in video + processing. For example, if an AI-task was created automatically when you + uploaded a video with the AI auto-processing option (nudity detection, etc), + then the ID of the associated video for which the task was performed will be + explicitly indicated here. + """ + + client_user_id: Optional[str] = None + """Meta parameter, designed to store your own identifier. + + Can be used by you to tag requests from different end-users. It is not used in + any way in video processing. + """ diff --git a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py new file mode 100644 index 00000000..8c169401 --- /dev/null +++ b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py @@ -0,0 +1,66 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["AIContentmoderationSoftnudity"] + + +class AIContentmoderationSoftnudity(BaseModel): + category: Literal["soft_nudity", "sport", "weapon", "nsfw", "hard_nudity", "child_pornography"] + """AI content moderation with "`soft_nudity`" algorithm""" + + task_name: Literal["content-moderation"] + """Name of the task to be performed""" + + url: str + """URL to the MP4 file to analyse. + + File must be publicly accessible via HTTP/HTTPS. + """ + + client_entity_data: Optional[str] = None + """ + Meta parameter, designed to store your own extra information about a video + entity: video source, video id, etc. It is not used in any way in video + processing. For example, if an AI-task was created automatically when you + uploaded a video with the AI auto-processing option (nudity detection, etc), + then the ID of the associated video for which the task was performed will be + explicitly indicated here. + """ + + client_user_id: Optional[str] = None + """Meta parameter, designed to store your own identifier. + + Can be used by you to tag requests from different end-users. It is not used in + any way in video processing. + """ + + stop_objects: Optional[ + Literal[ + "ANUS_COVERED", + "ANUS_EXPOSED", + "ARMPITS_COVERED", + "ARMPITS_EXPOSED", + "BELLY_COVERED", + "BELLY_EXPOSED", + "BUTTOCKS_COVERED", + "BUTTOCKS_EXPOSED", + "FACE_FEMALE", + "FACE_MALE", + "FEET_COVERED", + "FEET_EXPOSED", + "FEMALE_BREAST_COVERED", + "FEMALE_BREAST_EXPOSED", + "FEMALE_GENITALIA_COVERED", + "FEMALE_GENITALIA_EXPOSED", + "MALE_BREAST_EXPOSED", + "MALE_GENITALIA_EXPOSED", + ] + ] = None + """ + Comma separated objects, and probabilities, that will cause the processing to + stop immediatelly after finding. + """ diff --git a/src/gcore/types/streaming/ai_contentmoderation_sport.py b/src/gcore/types/streaming/ai_contentmoderation_sport.py new file mode 100644 index 00000000..34c8974e --- /dev/null +++ b/src/gcore/types/streaming/ai_contentmoderation_sport.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["AIContentmoderationSport"] + + +class AIContentmoderationSport(BaseModel): + category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] + """AI content moderation with types of sports activity detection""" + + task_name: Literal["content-moderation"] + """Name of the task to be performed""" + + url: str + """URL to the MP4 file to analyse. + + File must be publicly accessible via HTTP/HTTPS. + """ + + client_entity_data: Optional[str] = None + """ + Meta parameter, designed to store your own extra information about a video + entity: video source, video id, etc. It is not used in any way in video + processing. For example, if an AI-task was created automatically when you + uploaded a video with the AI auto-processing option (nudity detection, etc), + then the ID of the associated video for which the task was performed will be + explicitly indicated here. + """ + + client_user_id: Optional[str] = None + """Meta parameter, designed to store your own identifier. + + Can be used by you to tag requests from different end-users. It is not used in + any way in video processing. + """ diff --git a/src/gcore/types/streaming/ai_contentmoderation_weapon.py b/src/gcore/types/streaming/ai_contentmoderation_weapon.py new file mode 100644 index 00000000..b0e8c452 --- /dev/null +++ b/src/gcore/types/streaming/ai_contentmoderation_weapon.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["AIContentmoderationWeapon"] + + +class AIContentmoderationWeapon(BaseModel): + category: Literal["weapon", "sport", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] + """AI content moderation with weapon detection algorithm""" + + task_name: Literal["content-moderation"] + """Name of the task to be performed""" + + url: str + """URL to the MP4 file to analyse. + + File must be publicly accessible via HTTP/HTTPS. + """ + + client_entity_data: Optional[str] = None + """ + Meta parameter, designed to store your own extra information about a video + entity: video source, video id, etc. It is not used in any way in video + processing. For example, if an AI-task was created automatically when you + uploaded a video with the AI auto-processing option (nudity detection, etc), + then the ID of the associated video for which the task was performed will be + explicitly indicated here. + """ + + client_user_id: Optional[str] = None + """Meta parameter, designed to store your own identifier. + + Can be used by you to tag requests from different end-users. It is not used in + any way in video processing. + """ diff --git a/src/gcore/types/streaming/ai_task.py b/src/gcore/types/streaming/ai_task.py new file mode 100644 index 00000000..acf9b2ee --- /dev/null +++ b/src/gcore/types/streaming/ai_task.py @@ -0,0 +1,205 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal, TypeAlias + +from ..._models import BaseModel +from .ai_contentmoderation_casm import AIContentmoderationCasm +from .ai_contentmoderation_nsfw import AIContentmoderationNsfw +from .ai_contentmoderation_sport import AIContentmoderationSport +from .ai_contentmoderation_weapon import AIContentmoderationWeapon +from .ai_contentmoderation_hardnudity import AIContentmoderationHardnudity +from .ai_contentmoderation_softnudity import AIContentmoderationSoftnudity + +__all__ = ["AITask", "TaskData", "TaskDataAITranscribe"] + + +class TaskDataAITranscribe(BaseModel): + task_name: Literal["transcription"] + """Name of the task to be performed""" + + url: str + """URL to the MP4 file to analyse. + + File must be publicly accessible via HTTP/HTTPS. + """ + + audio_language: Optional[str] = None + """Language in original audio (transcription only). + + This value is used to determine the language from which to transcribe. If this + is not set, the system will run auto language identification and the subtitles + will be in the detected language. The method also works based on AI analysis. + It's fairly accurate, but if it's wrong, then set the language explicitly. + Additionally, when this is not set, we also support recognition of alternate + languages in the video (language code-switching). Language is set by 3-letter + language code according to ISO-639-2 (bibliographic code). We can process + languages: + + - 'afr': Afrikaans + - 'alb': Albanian + - 'amh': Amharic + - 'ara': Arabic + - 'arm': Armenian + - 'asm': Assamese + - 'aze': Azerbaijani + - 'bak': Bashkir + - 'baq': Basque + - 'bel': Belarusian + - 'ben': Bengali + - 'bos': Bosnian + - 'bre': Breton + - 'bul': Bulgarian + - 'bur': Myanmar + - 'cat': Catalan + - 'chi': Chinese + - 'cze': Czech + - 'dan': Danish + - 'dut': Nynorsk + - 'eng': English + - 'est': Estonian + - 'fao': Faroese + - 'fin': Finnish + - 'fre': French + - 'geo': Georgian + - 'ger': German + - 'glg': Galician + - 'gre': Greek + - 'guj': Gujarati + - 'hat': Haitian creole + - 'hau': Hausa + - 'haw': Hawaiian + - 'heb': Hebrew + - 'hin': Hindi + - 'hrv': Croatian + - 'hun': Hungarian + - 'ice': Icelandic + - 'ind': Indonesian + - 'ita': Italian + - 'jav': Javanese + - 'jpn': Japanese + - 'kan': Kannada + - 'kaz': Kazakh + - 'khm': Khmer + - 'kor': Korean + - 'lao': Lao + - 'lat': Latin + - 'lav': Latvian + - 'lin': Lingala + - 'lit': Lithuanian + - 'ltz': Luxembourgish + - 'mac': Macedonian + - 'mal': Malayalam + - 'mao': Maori + - 'mar': Marathi + - 'may': Malay + - 'mlg': Malagasy + - 'mlt': Maltese + - 'mon': Mongolian + - 'nep': Nepali + - 'dut': Dutch + - 'nor': Norwegian + - 'oci': Occitan + - 'pan': Punjabi + - 'per': Persian + - 'pol': Polish + - 'por': Portuguese + - 'pus': Pashto + - 'rum': Romanian + - 'rus': Russian + - 'san': Sanskrit + - 'sin': Sinhala + - 'slo': Slovak + - 'slv': Slovenian + - 'sna': Shona + - 'snd': Sindhi + - 'som': Somali + - 'spa': Spanish + - 'srp': Serbian + - 'sun': Sundanese + - 'swa': Swahili + - 'swe': Swedish + - 'tam': Tamil + - 'tat': Tatar + - 'tel': Telugu + - 'tgk': Tajik + - 'tgl': Tagalog + - 'tha': Thai + - 'tib': Tibetan + - 'tuk': Turkmen + - 'tur': Turkish + - 'ukr': Ukrainian + - 'urd': Urdu + - 'uzb': Uzbek + - 'vie': Vietnamese + - 'wel': Welsh + - 'yid': Yiddish + - 'yor': Yoruba + """ + + client_entity_data: Optional[str] = None + """ + Meta parameter, designed to store your own extra information about a video + entity: video source, video id, etc. It is not used in any way in video + processing. For example, if an AI-task was created automatically when you + uploaded a video with the AI auto-processing option (transcribing, + translationing), then the ID of the associated video for which the task was + performed will be explicitly indicated here. + """ + + client_user_id: Optional[str] = None + """Meta parameter, designed to store your own identifier. + + Can be used by you to tag requests from different end-users. It is not used in + any way in video processing. + """ + + subtitles_language: Optional[str] = None + """ + Indicates which language it is clearly necessary to translate into. If this is + not set, the original language will be used from attribute "`audio_language`". + Please note that: + + - transcription into the original language is a free procedure, + - and translation from the original language into any other languages is a + "translation" procedure and is paid. More details in + [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + Language is set by 3-letter language code according to ISO-639-2 + (bibliographic code). + """ + + +TaskData: TypeAlias = Union[ + TaskDataAITranscribe, + AIContentmoderationNsfw, + AIContentmoderationHardnudity, + AIContentmoderationSoftnudity, + AIContentmoderationCasm, + AIContentmoderationSport, + AIContentmoderationWeapon, +] + + +class AITask(BaseModel): + progress: Optional[int] = None + """Percentage of task completed. + + A value greater than 0 means that it has been taken into operation and is being + processed. + """ + + status: Optional[Literal["PENDING", "STARTED", "SUCCESS", "FAILURE", "REVOKED", "RETRY"]] = None + """Status of processing the AI task. See GET /ai/results method for description.""" + + task_data: Optional[TaskData] = None + """ + The object will correspond to the task type that was specified in the original + request. There will be one object for transcription, another for searching for + nudity, and so on. + """ + + task_id: Optional[str] = None + """ID of the AI task""" + + task_name: Optional[Literal["content-moderation", "transcription"]] = None + """Type of AI task""" diff --git a/src/gcore/types/streaming/ai_task_cancel_response.py b/src/gcore/types/streaming/ai_task_cancel_response.py new file mode 100644 index 00000000..56197904 --- /dev/null +++ b/src/gcore/types/streaming/ai_task_cancel_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["AITaskCancelResponse"] + + +class AITaskCancelResponse(BaseModel): + result: Optional[str] = None + """A textual explicit description of the result of the operation""" diff --git a/src/gcore/types/streaming/ai_task_create_params.py b/src/gcore/types/streaming/ai_task_create_params.py new file mode 100644 index 00000000..f0fe134f --- /dev/null +++ b/src/gcore/types/streaming/ai_task_create_params.py @@ -0,0 +1,168 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["AITaskCreateParams"] + + +class AITaskCreateParams(TypedDict, total=False): + task_name: Required[Literal["transcription", "content-moderation"]] + """Name of the task to be performed""" + + url: Required[str] + """URL to the MP4 file to analyse. + + File must be publicly accessible via HTTP/HTTPS. + """ + + audio_language: str + """Language in original audio (transcription only). + + This value is used to determine the language from which to transcribe. If this + is not set, the system will run auto language identification and the subtitles + will be in the detected language. The method also works based on AI analysis. + It's fairly accurate, but if it's wrong, then set the language explicitly. + Additionally, when this is not set, we also support recognition of alternate + languages in the video (language code-switching). Language is set by 3-letter + language code according to ISO-639-2 (bibliographic code). We can process + languages: + + - 'afr': Afrikaans + - 'alb': Albanian + - 'amh': Amharic + - 'ara': Arabic + - 'arm': Armenian + - 'asm': Assamese + - 'aze': Azerbaijani + - 'bak': Bashkir + - 'baq': Basque + - 'bel': Belarusian + - 'ben': Bengali + - 'bos': Bosnian + - 'bre': Breton + - 'bul': Bulgarian + - 'bur': Myanmar + - 'cat': Catalan + - 'chi': Chinese + - 'cze': Czech + - 'dan': Danish + - 'dut': Nynorsk + - 'eng': English + - 'est': Estonian + - 'fao': Faroese + - 'fin': Finnish + - 'fre': French + - 'geo': Georgian + - 'ger': German + - 'glg': Galician + - 'gre': Greek + - 'guj': Gujarati + - 'hat': Haitian creole + - 'hau': Hausa + - 'haw': Hawaiian + - 'heb': Hebrew + - 'hin': Hindi + - 'hrv': Croatian + - 'hun': Hungarian + - 'ice': Icelandic + - 'ind': Indonesian + - 'ita': Italian + - 'jav': Javanese + - 'jpn': Japanese + - 'kan': Kannada + - 'kaz': Kazakh + - 'khm': Khmer + - 'kor': Korean + - 'lao': Lao + - 'lat': Latin + - 'lav': Latvian + - 'lin': Lingala + - 'lit': Lithuanian + - 'ltz': Luxembourgish + - 'mac': Macedonian + - 'mal': Malayalam + - 'mao': Maori + - 'mar': Marathi + - 'may': Malay + - 'mlg': Malagasy + - 'mlt': Maltese + - 'mon': Mongolian + - 'nep': Nepali + - 'dut': Dutch + - 'nor': Norwegian + - 'oci': Occitan + - 'pan': Punjabi + - 'per': Persian + - 'pol': Polish + - 'por': Portuguese + - 'pus': Pashto + - 'rum': Romanian + - 'rus': Russian + - 'san': Sanskrit + - 'sin': Sinhala + - 'slo': Slovak + - 'slv': Slovenian + - 'sna': Shona + - 'snd': Sindhi + - 'som': Somali + - 'spa': Spanish + - 'srp': Serbian + - 'sun': Sundanese + - 'swa': Swahili + - 'swe': Swedish + - 'tam': Tamil + - 'tat': Tatar + - 'tel': Telugu + - 'tgk': Tajik + - 'tgl': Tagalog + - 'tha': Thai + - 'tib': Tibetan + - 'tuk': Turkmen + - 'tur': Turkish + - 'ukr': Ukrainian + - 'urd': Urdu + - 'uzb': Uzbek + - 'vie': Vietnamese + - 'wel': Welsh + - 'yid': Yiddish + - 'yor': Yoruba + """ + + category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] + """Model for analysis (content-moderation only). + + Determines what exactly needs to be found in the video. + """ + + client_entity_data: str + """ + Meta parameter, designed to store your own extra information about a video + entity: video source, video id, etc. It is not used in any way in video + processing. For example, if an AI-task was created automatically when you + uploaded a video with the AI auto-processing option (nudity detection, etc), + then the ID of the associated video for which the task was performed will be + explicitly indicated here. + """ + + client_user_id: str + """Meta parameter, designed to store your own identifier. + + Can be used by you to tag requests from different end-users. It is not used in + any way in video processing. + """ + + subtitles_language: str + """ + Indicates which language it is clearly necessary to translate into. If this is + not set, the original language will be used from attribute "`audio_language`". + Please note that: + + - transcription into the original language is a free procedure, + - and translation from the original language into any other languages is a + "translation" procedure and is paid. More details in + [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + Language is set by 3-letter language code according to ISO-639-2 + (bibliographic code). + """ diff --git a/src/gcore/types/streaming/ai_task_create_response.py b/src/gcore/types/streaming/ai_task_create_response.py new file mode 100644 index 00000000..0a6ea96e --- /dev/null +++ b/src/gcore/types/streaming/ai_task_create_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["AITaskCreateResponse"] + + +class AITaskCreateResponse(BaseModel): + task_id: str + """ID of the created AI task, from which you can get the execution result""" diff --git a/src/gcore/types/streaming/ai_task_get_ai_settings_params.py b/src/gcore/types/streaming/ai_task_get_ai_settings_params.py new file mode 100644 index 00000000..f4c0bba3 --- /dev/null +++ b/src/gcore/types/streaming/ai_task_get_ai_settings_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["AITaskGetAISettingsParams"] + + +class AITaskGetAISettingsParams(TypedDict, total=False): + type: Required[Literal["language_support"]] + """The parameters section for which parameters are requested""" + + audio_language: str + """The source language from which the audio will be transcribed. + + Required when `type=language_support`. Value is 3-letter language code according + to ISO-639-2 (bibliographic code), (e.g., fre for French). + """ + + subtitles_language: str + """The target language the text will be translated into. + + If omitted, the API will return whether the `audio_language` is supported for + transcription only, instead of translation. Value is 3-letter language code + according to ISO-639-2 (bibliographic code), (e.g., fre for French). + """ diff --git a/src/gcore/types/streaming/ai_task_get_ai_settings_response.py b/src/gcore/types/streaming/ai_task_get_ai_settings_response.py new file mode 100644 index 00000000..2476c7f6 --- /dev/null +++ b/src/gcore/types/streaming/ai_task_get_ai_settings_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["AITaskGetAISettingsResponse"] + + +class AITaskGetAISettingsResponse(BaseModel): + supported: Optional[bool] = None + """Is the given language pair supported for transcription and translation?""" diff --git a/src/gcore/types/streaming/ai_task_get_response.py b/src/gcore/types/streaming/ai_task_get_response.py new file mode 100644 index 00000000..e9179a3c --- /dev/null +++ b/src/gcore/types/streaming/ai_task_get_response.py @@ -0,0 +1,313 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from pydantic import Field as FieldInfo + +from .ai_task import AITask +from ..._models import BaseModel + +__all__ = [ + "AITaskGetResponse", + "AITaskGetResponseProcessingTime", + "AITaskGetResponseResult", + "AITaskGetResponseResultAIResultsTranscribe", + "AITaskGetResponseResultAIResultsTranscribeSubtitle", + "AITaskGetResponseResultAIResultsContentmoderationSport", + "AITaskGetResponseResultAIResultsContentmoderationSportFrame", + "AITaskGetResponseResultAIResultsContentmoderationWeapon", + "AITaskGetResponseResultAIResultsContentmoderationWeaponFrame", + "AITaskGetResponseResultAIResultsContentmoderationNsfw", + "AITaskGetResponseResultAIResultsContentmoderationNsfwFrame", + "AITaskGetResponseResultAIResultsContentmoderationHardnudity", + "AITaskGetResponseResultAIResultsContentmoderationHardnudityFrame", + "AITaskGetResponseResultAIResultsContentmoderationSoftnudity", + "AITaskGetResponseResultAIResultsContentmoderationSoftnudityFrame", + "AITaskGetResponseResultAIResultsContentmoderationCasm", + "AITaskGetResponseResultAIResultsContentmoderationCasmFrame", + "AITaskGetResponseResultAIResultsFailure", +] + + +class AITaskGetResponseProcessingTime(BaseModel): + completed_at: Optional[str] = None + """Video processing end time. Format is date time in ISO 8601""" + + started_at: Optional[str] = None + """Video processing start time. Format is date time in ISO 8601""" + + total_time_sec: Optional[float] = None + """Duration of video processing in seconds""" + + +class AITaskGetResponseResultAIResultsTranscribeSubtitle(BaseModel): + end_time: Optional[str] = None + """End time of the phrase, when it ends in the video. Format is "HH:mm:ss.fff".""" + + start_time: Optional[str] = None + """Start time of the phrase when it is heard in the video. + + Format is "HH:mm:ss.fff". + """ + + text: Optional[str] = None + """A complete phrase that sounds during a specified period of time.""" + + +class AITaskGetResponseResultAIResultsTranscribe(BaseModel): + concatenated_text: Optional[str] = None + """Full text of the analyzed video. The value is unstructured, unformatted text.""" + + languages: Optional[List[str]] = None + """An array of language codes that were discovered and/or used in transcription. + + If the audio or subtitle language was explicitly specified in the initial + parameters, it will be copied here. For automatic detection the identified + languages will be displayed here. Also please note that for multilingual audio, + the first 5 languages are displayed in order of frequency of use. + """ + + speech_detected: Optional[bool] = None + """ + Determines whether speech was detected or not. Please note: If the task is in + "SUCCESS" status and speech was not found in the entire file, then "false" will + be indicated here and the `subtitles` field will be empty. + """ + + subtitles: Optional[List[AITaskGetResponseResultAIResultsTranscribeSubtitle]] = None + """An array of phrases divided into time intervals, in the format "json". + + Suitable when you need to display the result in chronometric form, or transfer + the text for further processing. + """ + + vtt_content: Optional[str] = FieldInfo(alias="vttContent", default=None) + """Auto generated subtitles in WebVTT format.""" + + +class AITaskGetResponseResultAIResultsContentmoderationSportFrame(BaseModel): + confidence: Optional[float] = None + """Percentage of probability of identifying the activity""" + + frame_number: Optional[int] = FieldInfo(alias="frame-number", default=None) + """Video frame number where activity was found""" + + label: Optional[str] = None + """Type of detected activity""" + + +class AITaskGetResponseResultAIResultsContentmoderationSport(BaseModel): + detection_results: Optional[ + List[ + Literal[ + "archery", + "arm wrestling", + "playing badminton", + "playing baseball", + "basketball dunk", + "bowling", + "boxing punch", + "boxing speed bag", + "catching or throwing baseball", + "catching or throwing softball", + "cricket", + "curling", + "disc golfing", + "dodgeball", + "fencing", + "football", + "golf chipping", + "golf driving", + "golf putting", + "hitting baseball", + "hockey stop", + "ice skating", + "javelin throw", + "juggling soccer ball", + "kayaking", + "kicking field goal", + "kicking soccer ball", + "playing cricket", + "playing field hockey", + "playing ice hockey", + "playing kickball", + "playing lacrosse", + "playing ping pong", + "playing polo", + "playing squash or racquetball", + "playing tennis", + "playing volleyball", + "pole vault", + "riding a bike", + "riding or walking with horse", + "roller skating", + "rowing", + "sailing", + "shooting goal (soccer)", + "skateboarding", + "skiing", + ] + ] + ] = None + + frames: Optional[List[AITaskGetResponseResultAIResultsContentmoderationSportFrame]] = None + + sport_detected: Optional[bool] = None + """A boolean value whether any sports were detected""" + + +class AITaskGetResponseResultAIResultsContentmoderationWeaponFrame(BaseModel): + confidence: Optional[float] = None + """Percentage of probability of identifying the object""" + + frame_number: Optional[int] = FieldInfo(alias="frame-number", default=None) + """Video frame number where object was found""" + + label: Optional[str] = None + """Type of detected object""" + + +class AITaskGetResponseResultAIResultsContentmoderationWeapon(BaseModel): + detection_results: Optional[List[Literal["gun", "heavy weapon", "knife"]]] = None + + frames: Optional[List[AITaskGetResponseResultAIResultsContentmoderationWeaponFrame]] = None + + weapon_detected: Optional[bool] = None + """A boolean value whether any weapon was detected""" + + +class AITaskGetResponseResultAIResultsContentmoderationNsfwFrame(BaseModel): + confidence: Optional[float] = None + """Percentage of probability of identifying the object""" + + frame_number: Optional[int] = FieldInfo(alias="frame-number", default=None) + """Video frame number where object was found""" + + label: Optional[str] = None + """Type of detected object""" + + +class AITaskGetResponseResultAIResultsContentmoderationNsfw(BaseModel): + detection_results: Optional[List[Literal["nsfw"]]] = None + + frames: Optional[List[AITaskGetResponseResultAIResultsContentmoderationNsfwFrame]] = None + + nsfw_detected: Optional[bool] = None + """A boolean value whether any Not Safe For Work content was detected""" + + +class AITaskGetResponseResultAIResultsContentmoderationHardnudityFrame(BaseModel): + confidence: Optional[float] = None + """Percentage of probability of identifying the object""" + + frame_number: Optional[int] = FieldInfo(alias="frame-number", default=None) + """Video frame number where object was found""" + + label: Optional[str] = None + """Type of detected object""" + + +class AITaskGetResponseResultAIResultsContentmoderationHardnudity(BaseModel): + detection_results: Optional[ + List[ + Literal[ + "ANUS_EXPOSED", + "BUTTOCKS_EXPOSED", + "FEMALE_BREAST_EXPOSED", + "FEMALE_GENITALIA_EXPOSED", + "MALE_BREAST_EXPOSED", + "MALE_GENITALIA_EXPOSED", + ] + ] + ] = None + + frames: Optional[List[AITaskGetResponseResultAIResultsContentmoderationHardnudityFrame]] = None + + porn_detected: Optional[bool] = None + """A boolean value whether any nudity was detected""" + + +class AITaskGetResponseResultAIResultsContentmoderationSoftnudityFrame(BaseModel): + confidence: Optional[float] = None + """Percentage of probability of identifying the object""" + + frame_number: Optional[int] = FieldInfo(alias="frame-number", default=None) + """Video frame number where object was found""" + + label: Optional[str] = None + """Type of detected object""" + + +class AITaskGetResponseResultAIResultsContentmoderationSoftnudity(BaseModel): + detection_results: Optional[ + List[ + Literal[ + "ANUS_COVERED", + "ANUS_EXPOSED", + "ARMPITS_COVERED", + "ARMPITS_EXPOSED", + "BELLY_COVERED", + "BELLY_EXPOSED", + "BUTTOCKS_COVERED", + "BUTTOCKS_EXPOSED", + "FACE_FEMALE", + "FACE_MALE", + "FEET_COVERED", + "FEET_EXPOSED", + "FEMALE_BREAST_COVERED", + "FEMALE_BREAST_EXPOSED", + "FEMALE_GENITALIA_COVERED", + "FEMALE_GENITALIA_EXPOSED", + "MALE_BREAST_EXPOSED", + "MALE_GENITALIA_EXPOSED", + ] + ] + ] = None + + frames: Optional[List[AITaskGetResponseResultAIResultsContentmoderationSoftnudityFrame]] = None + + porn_detected: Optional[bool] = None + """A boolean value whether any nudity and other body part was detected""" + + +class AITaskGetResponseResultAIResultsContentmoderationCasmFrame(BaseModel): + confidence: Optional[float] = None + """Percentage of probability of identifying the object""" + + frame_number: Optional[int] = FieldInfo(alias="frame-number", default=None) + """Video frame number where object was found""" + + label: Optional[str] = None + """Type of detected object""" + + +class AITaskGetResponseResultAIResultsContentmoderationCasm(BaseModel): + child_pornography_detected: Optional[bool] = None + """A boolean value whether child pornography was detected""" + + detection_results: Optional[List[Literal["0-2", "3-9", "10-19"]]] = None + + frames: Optional[List[AITaskGetResponseResultAIResultsContentmoderationCasmFrame]] = None + + +class AITaskGetResponseResultAIResultsFailure(BaseModel): + error: str + + +AITaskGetResponseResult: TypeAlias = Union[ + AITaskGetResponseResultAIResultsTranscribe, + AITaskGetResponseResultAIResultsContentmoderationSport, + AITaskGetResponseResultAIResultsContentmoderationWeapon, + AITaskGetResponseResultAIResultsContentmoderationNsfw, + AITaskGetResponseResultAIResultsContentmoderationHardnudity, + AITaskGetResponseResultAIResultsContentmoderationSoftnudity, + AITaskGetResponseResultAIResultsContentmoderationCasm, + AITaskGetResponseResultAIResultsFailure, +] + + +class AITaskGetResponse(AITask): + processing_time: Optional[AITaskGetResponseProcessingTime] = None + + result: Optional[AITaskGetResponseResult] = None diff --git a/src/gcore/types/streaming/ai_task_list_params.py b/src/gcore/types/streaming/ai_task_list_params.py new file mode 100644 index 00000000..b6499c1c --- /dev/null +++ b/src/gcore/types/streaming/ai_task_list_params.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["AITaskListParams"] + + +class AITaskListParams(TypedDict, total=False): + date_created: str + """Time when task was created. Datetime in ISO 8601 format.""" + + limit: int + """Number of results to return per page.""" + + ordering: Literal["task_id", "status", "task_name", "started_at"] + """ + Which field to use when ordering the results: `task_id`, status, and + `task_name`. Sorting is done in ascending (ASC) order. If parameter is omitted + then "`started_at` DESC" is used for ordering by default. + """ + + page: int + """Page to view from task list, starting from 1""" + + search: str + """ + This is an field for combined text search in the following fields: `task_id`, + `task_name`, status, and `task_data`. Both full and partial searches are + possible inside specified above fields. For example, you can filter tasks of a + certain category, or tasks by a specific original file. Example: + + - To filter tasks of Content Moderation NSFW method: + `GET /streaming/ai/tasks?search=nsfw` + - To filter tasks of processing video from a specific origin: + `GET /streaming/ai/tasks?search=s3.eu-west-1.amazonaws.com` + """ + + status: Literal["FAILURE", "PENDING", "RECEIVED", "RETRY", "REVOKED", "STARTED", "SUCCESS"] + """Task status""" + + task_id: str + """The task unique identifier to fiund""" + + task_name: Literal["transcription", "content-moderation"] + """Type of the AI task. + + Reflects the original API method that was used to create the AI task. + """ diff --git a/src/gcore/types/streaming/broadcast.py b/src/gcore/types/streaming/broadcast.py new file mode 100644 index 00000000..b2ba736b --- /dev/null +++ b/src/gcore/types/streaming/broadcast.py @@ -0,0 +1,71 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["Broadcast"] + + +class Broadcast(BaseModel): + name: str + """Broadcast name""" + + ad_id: Optional[int] = None + """ID of ad to be displayed in a live stream. + + If empty the default ad is show. If there is no default ad, no ad is shown + """ + + custom_iframe_url: Optional[str] = None + """Custom URL of iframe for video player to be shared via sharing button in player. + + Auto generated iframe URL is provided by default + """ + + pending_message: Optional[str] = None + """A custom message that is shown if broadcast status is set to pending. + + If empty, a default message is shown + """ + + player_id: Optional[int] = None + """ID of player to be used with a broadcast. If empty the default player is used""" + + poster: Optional[str] = None + """Uploaded poster file""" + + share_url: Optional[str] = None + """ + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled + """ + + show_dvr_after_finish: Optional[bool] = None + """Regulates if a DVR record is shown once a broadcast is finished. + + Has two possible values: + + - **true** — record is shown + - **false** — record isn't shown + + Default is false + """ + + status: Optional[str] = None + """ + Broadcast statuses: + **Pending** — default “Broadcast isn’t started yet” or custom message (see `pending_message` + parameter) is shown, users don't see the live stream + **Live** — broadcast is live, and viewers can see it + **Paused** — “Broadcast is paused” message is shown, users don't see the live stream + + **Finished** — “Broadcast is finished” message is shown, users don't see the + live stream + The users' browsers start displaying the message/stream immediately after you change + the broadcast status + """ + + stream_ids: Optional[List[int]] = None + """IDs of streams used in a broadcast""" diff --git a/src/gcore/types/streaming/broadcast_create_params.py b/src/gcore/types/streaming/broadcast_create_params.py new file mode 100644 index 00000000..eb7da86a --- /dev/null +++ b/src/gcore/types/streaming/broadcast_create_params.py @@ -0,0 +1,76 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["BroadcastCreateParams", "Broadcast"] + + +class BroadcastCreateParams(TypedDict, total=False): + broadcast: Broadcast + + +class Broadcast(TypedDict, total=False): + name: Required[str] + """Broadcast name""" + + ad_id: int + """ID of ad to be displayed in a live stream. + + If empty the default ad is show. If there is no default ad, no ad is shown + """ + + custom_iframe_url: str + """Custom URL of iframe for video player to be shared via sharing button in player. + + Auto generated iframe URL is provided by default + """ + + pending_message: str + """A custom message that is shown if broadcast status is set to pending. + + If empty, a default message is shown + """ + + player_id: int + """ID of player to be used with a broadcast. If empty the default player is used""" + + poster: str + """Uploaded poster file""" + + share_url: str + """ + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled + """ + + show_dvr_after_finish: bool + """Regulates if a DVR record is shown once a broadcast is finished. + + Has two possible values: + + - **true** — record is shown + - **false** — record isn't shown + + Default is false + """ + + status: str + """ + Broadcast statuses: + **Pending** — default “Broadcast isn’t started yet” or custom message (see `pending_message` + parameter) is shown, users don't see the live stream + **Live** — broadcast is live, and viewers can see it + **Paused** — “Broadcast is paused” message is shown, users don't see the live stream + + **Finished** — “Broadcast is finished” message is shown, users don't see the + live stream + The users' browsers start displaying the message/stream immediately after you change + the broadcast status + """ + + stream_ids: Iterable[int] + """IDs of streams used in a broadcast""" diff --git a/src/gcore/types/streaming/broadcast_list_params.py b/src/gcore/types/streaming/broadcast_list_params.py new file mode 100644 index 00000000..d2d93446 --- /dev/null +++ b/src/gcore/types/streaming/broadcast_list_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["BroadcastListParams"] + + +class BroadcastListParams(TypedDict, total=False): + page: int + """Query parameter. Use it to list the paginated content""" diff --git a/src/gcore/types/streaming/broadcast_spectators_count.py b/src/gcore/types/streaming/broadcast_spectators_count.py new file mode 100644 index 00000000..4b26ac98 --- /dev/null +++ b/src/gcore/types/streaming/broadcast_spectators_count.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["BroadcastSpectatorsCount"] + + +class BroadcastSpectatorsCount(BaseModel): + spectators_count: Optional[int] = None + """Number of spectators at the moment""" diff --git a/src/gcore/types/streaming/broadcast_update_params.py b/src/gcore/types/streaming/broadcast_update_params.py new file mode 100644 index 00000000..3b05f518 --- /dev/null +++ b/src/gcore/types/streaming/broadcast_update_params.py @@ -0,0 +1,76 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["BroadcastUpdateParams", "Broadcast"] + + +class BroadcastUpdateParams(TypedDict, total=False): + broadcast: Broadcast + + +class Broadcast(TypedDict, total=False): + name: Required[str] + """Broadcast name""" + + ad_id: int + """ID of ad to be displayed in a live stream. + + If empty the default ad is show. If there is no default ad, no ad is shown + """ + + custom_iframe_url: str + """Custom URL of iframe for video player to be shared via sharing button in player. + + Auto generated iframe URL is provided by default + """ + + pending_message: str + """A custom message that is shown if broadcast status is set to pending. + + If empty, a default message is shown + """ + + player_id: int + """ID of player to be used with a broadcast. If empty the default player is used""" + + poster: str + """Uploaded poster file""" + + share_url: str + """ + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled + """ + + show_dvr_after_finish: bool + """Regulates if a DVR record is shown once a broadcast is finished. + + Has two possible values: + + - **true** — record is shown + - **false** — record isn't shown + + Default is false + """ + + status: str + """ + Broadcast statuses: + **Pending** — default “Broadcast isn’t started yet” or custom message (see `pending_message` + parameter) is shown, users don't see the live stream + **Live** — broadcast is live, and viewers can see it + **Paused** — “Broadcast is paused” message is shown, users don't see the live stream + + **Finished** — “Broadcast is finished” message is shown, users don't see the + live stream + The users' browsers start displaying the message/stream immediately after you change + the broadcast status + """ + + stream_ids: Iterable[int] + """IDs of streams used in a broadcast""" diff --git a/src/gcore/types/streaming/clip.py b/src/gcore/types/streaming/clip.py new file mode 100644 index 00000000..3a8e444c --- /dev/null +++ b/src/gcore/types/streaming/clip.py @@ -0,0 +1,78 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["Clip"] + + +class Clip(BaseModel): + id: str + """ID of the clip""" + + duration: int + """ + Requested segment duration in seconds to be cut. Please, note that cutting is + based on the idea of instantly creating a clip, instead of precise timing. So + final segment may be: + + - Less than the specified value if there is less data in the DVR than the + requested segment. + - Greater than the specified value, because segment is aligned to the first and + last key frames of already stored fragment in DVR, this way -1 and +1 chunks + can be added to left and right. Duration of cutted segment cannot be greater + than DVR duration for this stream. Therefore, to change the maximum, use + "`dvr_duration`" parameter of this stream. + """ + + created_at: Optional[str] = None + """Creation date and time. Format is date time in ISO 8601""" + + expiration: Optional[int] = None + """ + Expire time of the clip via a public link. Unix timestamp in seconds, absolute + value. This is the time how long the instant clip will be stored in the server + memory and can be accessed via public HLS/MP4 links. Download and/or use the + instant clip before this time expires. After the time has expired, the clip is + deleted from memory and is no longer available via the link. You need to create + a new segment, or use `vod_required: true` attribute. If value is omitted, then + expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. + `unix timestamp = + + 3600`). Allowed range: 1m <= expiration <= 4h. Example: + `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` + """ + + hls_master: Optional[str] = None + """Link to HLS .m3u8 with immediate clip. + + The link retains same adaptive bitrate as in the stream for end viewers. For + additional restrictions, see the description of parameter "`mp4_master`". + """ + + mp4_master: Optional[str] = None + """Link to MP4 with immediate clip. + + The link points to max rendition quality. Request of the URL can return: + + - 200 OK – if the clip exists. + - 404 Not found – if the clip did not exist or has already ceased to exist. + - 425 Too early – if recording is on-going now. The file is incomplete and will + be accessible after start+duration time will come. + """ + + renditions: Optional[List[str]] = None + """List of available rendition heights""" + + start: Optional[int] = None + """ + Starting point of the segment to cut. Unix timestamp in seconds, absolute value. + Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value + from the past is specified, it is used as the starting point for the segment to + cut. If the value is omitted, then clip will start from now. + """ + + video_id: Optional[int] = None + """ID of the created video if `vod_required`=true""" + + vod_required: Optional[bool] = None + """Indicates if video needs to be stored as VOD""" diff --git a/src/gcore/types/streaming/create_video_param.py b/src/gcore/types/streaming/create_video_param.py new file mode 100644 index 00000000..a4ce231a --- /dev/null +++ b/src/gcore/types/streaming/create_video_param.py @@ -0,0 +1,214 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["CreateVideoParam"] + + +class CreateVideoParam(TypedDict, total=False): + name: Required[str] + """Video name""" + + auto_transcribe_audio_language: Literal["disable", "auto", ""] + """Automatic creation of subtitles by transcribing the audio track. Values: + + - disable – Do not transcribe. + - auto – Automatically detects the activation of the option based on the + settings in your account. If generation is activated, then automatic language + detection while transcribing. + - \\ – Transcribe from specific language. Can be used to specify the exact + language spoken in the audio track, or when auto language detection fails. + Language is set by 3-letter language code according to ISO-639-2 + (bibliographic code). List of languages is available in `audio_language` + attribute of API POST /streaming/ai/transcribe . Example: + + ``` + `auto_transcribe_audio_language`: "auto" + `auto_transcribe_audio_language`: "ger" + ``` + + More details: + + - List of AI tasks – API + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/get-ai-task-result) + - Add subtitles to an exist video – API + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + """ + + auto_translate_subtitles_language: Literal["disable", "default", ""] + """Automatic translation of auto-transcribed subtitles to the specified + language(s). + + Can be used both together with `auto_transcribe_audio_language` option only. Use + it when you want to make automatic subtitles in languages other than the + original language in audio. Values: + + - disable – Do not translate. + - default – There are 3 default languages: eng,fre,ger + - \\ – Explicit language to translate to, or list of languages separated by a + comma. Look at list of available languages in description of AI ASR task + creation. If several languages are specified for translation, a separate + subtitle will be generated for each language. Example: + + ``` + `auto_translate_subtitles_language`: default + `auto_translate_subtitles_language`: eng,fre,ger + ``` + + Please note that subtitle translation is done separately and after + transcription. Thus separate AI-tasks are created for translation. + """ + + client_user_id: int + """Custom field where you can specify user ID in your system""" + + clip_duration_seconds: int + """ + The length of the trimmed segment to transcode, instead of the entire length of + the video. Is only used in conjunction with specifying the start of a segment. + Transcoding duration is a number in seconds. + """ + + clip_start_seconds: int + """ + If you want to transcode only a trimmed segment of a video instead of entire + length if the video, then you can provide timecodes of starting point and + duration of a segment to process. Start encoding from is a number in seconds. + """ + + custom_iframe_url: str + """ + Deprecated. Custom URL of IFrame for video player to be used in share panel in + player. Auto generated IFrame URL provided by default + """ + + description: str + """Video details; not visible to the end-users""" + + directory_id: int + """ID of the directory where the video should be uploaded. (beta)""" + + origin_http_headers: str + """Authorization HTTP request header. + + Will be used as credentials to authenticate a request to download a file + (specified in "`origin_url`" parameter) on an external server. Syntax: + `Authorization: ` Examples: + + - "`origin_http_headers`": "Authorization: Basic ..." + - "`origin_http_headers`": "Authorization: Bearer ..." + - "`origin_http_headers`": "Authorization: APIKey ..." Example of usage when + downloading a file from Google Drive: + + ``` + POST https://api.gcore.com/streaming/videos + "video": { + "name": "IBC 2024 intro.mp4", + "`origin_url`": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "`origin_http_headers`": "Authorization: Bearer ABC" + } + ``` + """ + + origin_url: str + """ + URL to an original file which you want to copy from external storage. If + specified, system will download the file and will use it as video source for + transcoding. + """ + + poster: str + """ + Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several + screenshots (they will be stored in "screenshots" attribute) from which you can + select an default screenshot. This "poster" field is for uploading your own + image. Also use attribute "`screenshot_id`" to select poster as a default + screnshot. Attribute accepts single image as base64-encoded string + [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In + format: `data:[];base64,` MIME-types are image/jpeg, image/webp, and image/png + and file sizes up to 1Mb. Examples: + + - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` + - `data:image/png;base64,iVBORw0KGg...ggg==` + - `data:image/webp;base64,UklGRt.../DgAAAAA` + """ + + priority: int + """ + Priority allows you to adjust the urgency of processing some videos before + others in your account, if your algorithm requires it. For example, when there + are very urgent video and some regular ones that can wait in the queue. Value + range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest + up-priority. Default priority is 0. + """ + + projection: str + """Deprecated. Regulates the video format: + + - **regular** — plays the video as usual + - **vr360** — plays the video in 360 degree mode + - **vr180** — plays the video in 180 degree mode + - **vr360tb** — plays the video in 3D 360 degree mode Top-Bottom. + + Default is regular + """ + + quality_set_id: int + """ + Custom quality set ID for transcoding, if transcoding is required according to + your conditions. Look at GET /`quality_sets` method + """ + + remote_poster_url: str + """ + Poster URL to download from external resource, instead of uploading via "poster" + attribute. It has the same restrictions as "poster" attribute. + """ + + remove_poster: bool + """Set it to true to remove poster""" + + screenshot_id: int + """ + Default screenshot index. Specify an ID from the "screenshots" array, so that + the URL of the required screenshot appears in the "screenshot" attribute as the + default screenshot. By default 5 static screenshots will be taken from different + places in the video after transcoding. If the video is short, there may be fewer + screenshots. Counting from 0. A value of -1 sets the default screenshot to the + URL of your own image from the "poster" attribute. Look at "screenshot" + attribute in GET /videos/{`video_id`} for details. + """ + + share_url: str + """ + Deprecated. Custom URL or iframe displayed in the link field when a user clicks + on a sharing button in player. If empty, the link field and social network + sharing is disabled + """ + + source_bitrate_limit: bool + """ + The option allows you to set the video transcoding rule so that the output + bitrate in ABR ladder is not exceeding the bitrate of the original video. + + This option is for advanced users only. + + By default `source_bitrate_limit: true` this option allows you to have the + output bitrate not more than in the original video, thus to transcode video + faster and to deliver it to end-viewers faster as well. At the same time, the + quality will be similar to the original. If for some reason you need more + byte-space in the output quality when encoding, you can set this option to + `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will + be raised from the bitrate of the original video to the maximum possible limit + specified in our the Product Documentation. For example, this may be needed + when: + + - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, + - to improve the picture quality on dynamic scenes, + - etc. The option is applied only at the video creation stage and cannot be + changed later. If you want to re-transcode the video using new value, then you + need to create and upload a new video only. + """ diff --git a/src/gcore/types/streaming/direct_upload_parameters.py b/src/gcore/types/streaming/direct_upload_parameters.py new file mode 100644 index 00000000..e0ed5b82 --- /dev/null +++ b/src/gcore/types/streaming/direct_upload_parameters.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["DirectUploadParameters"] + + +class DirectUploadParameters(BaseModel): + token: Optional[str] = None + """Token""" + + servers: Optional[List[object]] = None + """An array which contains information about servers you can upload a video to. + + **Server;** type — object. + + --- + + Server has the following fields: + + - **id;** type — integer + Server ID + - **hostname;** type — string + Server hostname + """ + + video: Optional[object] = None + """Contains information about the created video. + + See the full description in the Get video request + """ diff --git a/src/gcore/types/streaming/directories_tree.py b/src/gcore/types/streaming/directories_tree.py new file mode 100644 index 00000000..54186fc2 --- /dev/null +++ b/src/gcore/types/streaming/directories_tree.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 List, Optional + +from ..._models import BaseModel +from .directory_base import DirectoryBase + +__all__ = ["DirectoriesTree", "Tree"] + + +class Tree(DirectoryBase): + descendants: Optional[List["DirectoriesTree"]] = None + """Array of subdirectories, if any.""" + + +class DirectoriesTree(BaseModel): + tree: Optional[List[Tree]] = None diff --git a/src/gcore/types/streaming/directory_base.py b/src/gcore/types/streaming/directory_base.py new file mode 100644 index 00000000..7c3372ee --- /dev/null +++ b/src/gcore/types/streaming/directory_base.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["DirectoryBase"] + + +class DirectoryBase(BaseModel): + id: Optional[int] = None + """ID of the directory""" + + created_at: Optional[str] = None + """Time of creation. Datetime in ISO 8601 format.""" + + items_count: Optional[int] = None + """Number of objects in this directory. + + Counting files and folders. The quantity is calculated only at one level (not + recursively in all subfolders). + """ + + name: Optional[str] = None + """Title of the directory""" + + parent_id: Optional[int] = None + """ID of a parent directory. "null" if it's in the root.""" + + updated_at: Optional[str] = None + """Time of last update of the directory entity. Datetime in ISO 8601 format.""" diff --git a/src/gcore/types/streaming/directory_create_params.py b/src/gcore/types/streaming/directory_create_params.py new file mode 100644 index 00000000..76ae7cdf --- /dev/null +++ b/src/gcore/types/streaming/directory_create_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["DirectoryCreateParams"] + + +class DirectoryCreateParams(TypedDict, total=False): + name: Required[str] + """Title of the directory.""" + + parent_id: int + """ID of a parent directory. "null" if it's in the root.""" diff --git a/src/gcore/types/streaming/directory_get_response.py b/src/gcore/types/streaming/directory_get_response.py new file mode 100644 index 00000000..386aede5 --- /dev/null +++ b/src/gcore/types/streaming/directory_get_response.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional + +from ..._models import BaseModel +from .directory_base import DirectoryBase +from .directory_item import DirectoryItem +from .directory_video import DirectoryVideo + +__all__ = ["DirectoryGetResponse", "Directory"] + + +class Directory(DirectoryBase): + items: Optional[List[Union[DirectoryVideo, DirectoryItem]]] = None + """Array of subdirectories, if any.""" + + +class DirectoryGetResponse(BaseModel): + directory: Optional[Directory] = None diff --git a/src/gcore/types/streaming/directory_item.py b/src/gcore/types/streaming/directory_item.py new file mode 100644 index 00000000..1a9d38c7 --- /dev/null +++ b/src/gcore/types/streaming/directory_item.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .directory_base import DirectoryBase + +__all__ = ["DirectoryItem"] + + +class DirectoryItem(DirectoryBase): + item_type: Optional[Literal["Directory"]] = None + """Type of the entity: directory, or video""" diff --git a/src/gcore/types/streaming/directory_update_params.py b/src/gcore/types/streaming/directory_update_params.py new file mode 100644 index 00000000..2543e2a1 --- /dev/null +++ b/src/gcore/types/streaming/directory_update_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_extensions import TypedDict + +__all__ = ["DirectoryUpdateParams"] + + +class DirectoryUpdateParams(TypedDict, total=False): + name: str + """Title of the directory. Omit this if you don't want to change.""" + + parent_id: int + """ID of a parent directory. + + "null" if it's in the root. Omit this if you don't want to change. + """ diff --git a/src/gcore/types/streaming/directory_video.py b/src/gcore/types/streaming/directory_video.py new file mode 100644 index 00000000..cfc276c9 --- /dev/null +++ b/src/gcore/types/streaming/directory_video.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .video import Video + +__all__ = ["DirectoryVideo"] + + +class DirectoryVideo(Video): + item_type: Optional[Literal["Video"]] = None + """Type of the entity: directory, or video""" diff --git a/src/gcore/types/streaming/ffprobes.py b/src/gcore/types/streaming/ffprobes.py new file mode 100644 index 00000000..335c99e4 --- /dev/null +++ b/src/gcore/types/streaming/ffprobes.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["Ffprobes", "Data"] + + +class Data(BaseModel): + avg_bitrate: float + + max_fps: float + + max_height: int + + max_keyframe_interval: int + + sum_frames: int + + time: str + + +class Ffprobes(BaseModel): + data: Optional[List[Data]] = None diff --git a/src/gcore/types/streaming/max_stream_series.py b/src/gcore/types/streaming/max_stream_series.py new file mode 100644 index 00000000..13cd4451 --- /dev/null +++ b/src/gcore/types/streaming/max_stream_series.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["MaxStreamSeries", "MaxStreamSeryItem", "MaxStreamSeryItemMetrics"] + + +class MaxStreamSeryItemMetrics(BaseModel): + streams: List[int] + + +class MaxStreamSeryItem(BaseModel): + client: int + + metrics: MaxStreamSeryItemMetrics + + +MaxStreamSeries: TypeAlias = List[MaxStreamSeryItem] diff --git a/src/gcore/types/streaming/meet_series.py b/src/gcore/types/streaming/meet_series.py new file mode 100644 index 00000000..1b35d0f7 --- /dev/null +++ b/src/gcore/types/streaming/meet_series.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["MeetSeries", "MeetSeryItem", "MeetSeryItemMetrics"] + + +class MeetSeryItemMetrics(BaseModel): + max_meet_usage: Optional[List[int]] = None + + meet: Optional[List[List[int]]] = None + + +class MeetSeryItem(BaseModel): + client: int + + metrics: MeetSeryItemMetrics + + +MeetSeries: TypeAlias = List[MeetSeryItem] diff --git a/src/gcore/types/streaming/player.py b/src/gcore/types/streaming/player.py new file mode 100644 index 00000000..97b74532 --- /dev/null +++ b/src/gcore/types/streaming/player.py @@ -0,0 +1,114 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Player"] + + +class Player(BaseModel): + name: str + """Player name""" + + id: Optional[int] = None + """Player ID""" + + autoplay: Optional[bool] = None + """Enables video playback right after player load: + + - **true** — video starts playing right after player loads + - **false** — video isn’t played automatically. A user must click play to start + + Default is false + """ + + bg_color: Optional[str] = None + """Color of skin background in format #AAAAAA""" + + client_id: Optional[int] = None + """Client ID""" + + custom_css: Optional[str] = None + """Custom CSS to be added to player iframe""" + + design: Optional[str] = None + """String to be rendered as JS parameters to player""" + + disable_skin: Optional[bool] = None + """Enables/Disables player skin: + + - **true** — player skin is disabled + - **false** — player skin is enabled + + Default is false + """ + + fg_color: Optional[str] = None + """Color of skin foreground (elements) in format #AAAAAA""" + + framework: Optional[str] = None + """Player framework type""" + + hover_color: Optional[str] = None + """Color of foreground elements when mouse is over in format #AAAAAA""" + + js_url: Optional[str] = None + """Player main JS file URL. Leave empty to use JS URL from the default player""" + + logo: Optional[str] = None + """URL to logo image""" + + logo_position: Optional[str] = None + """Logotype position. + Has four possible values: + + - **tl** — top left + - **tr** — top right + - **bl** — bottom left + - **br** — bottom right + + Default is null + """ + + mute: Optional[bool] = None + """Regulates the sound volume: + + - **true** — video starts with volume off + - **false** — video starts with volume on + + Default is false + """ + + save_options_to_cookies: Optional[bool] = None + """Enables/Disables saving volume and other options in cookies: + + - **true** — user settings will be saved + - **false** — user settings will not be saved + + Default is true + """ + + show_sharing: Optional[bool] = None + """Enables/Disables sharing button display: + + - **true** — sharing button is displayed + - **false** — no sharing button is displayed + + Default is true + """ + + skin_is_url: Optional[str] = None + """URL to custom skin JS file""" + + speed_control: Optional[bool] = None + """Enables/Disables speed control button display: + + - **true** — sharing button is displayed + - **false** — no sharing button is displayed + + Default is false + """ + + text_color: Optional[str] = None + """Color of skin text elements in format #AAAAAA""" diff --git a/src/gcore/types/streaming/player_create_params.py b/src/gcore/types/streaming/player_create_params.py new file mode 100644 index 00000000..721607bf --- /dev/null +++ b/src/gcore/types/streaming/player_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_extensions import TypedDict + +from .player_param import PlayerParam + +__all__ = ["PlayerCreateParams"] + + +class PlayerCreateParams(TypedDict, total=False): + player: PlayerParam + """Set of properties for displaying videos. + + All parameters may be blank to inherit their values from default Streaming + player. + """ diff --git a/src/gcore/types/streaming/player_list_params.py b/src/gcore/types/streaming/player_list_params.py new file mode 100644 index 00000000..82273cc9 --- /dev/null +++ b/src/gcore/types/streaming/player_list_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["PlayerListParams"] + + +class PlayerListParams(TypedDict, total=False): + page: int + """Query parameter. Use it to list the paginated content""" diff --git a/src/gcore/types/streaming/player_param.py b/src/gcore/types/streaming/player_param.py new file mode 100644 index 00000000..4920422f --- /dev/null +++ b/src/gcore/types/streaming/player_param.py @@ -0,0 +1,114 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["PlayerParam"] + + +class PlayerParam(TypedDict, total=False): + name: Required[str] + """Player name""" + + id: int + """Player ID""" + + autoplay: bool + """Enables video playback right after player load: + + - **true** — video starts playing right after player loads + - **false** — video isn’t played automatically. A user must click play to start + + Default is false + """ + + bg_color: str + """Color of skin background in format #AAAAAA""" + + client_id: int + """Client ID""" + + custom_css: str + """Custom CSS to be added to player iframe""" + + design: str + """String to be rendered as JS parameters to player""" + + disable_skin: bool + """Enables/Disables player skin: + + - **true** — player skin is disabled + - **false** — player skin is enabled + + Default is false + """ + + fg_color: str + """Color of skin foreground (elements) in format #AAAAAA""" + + framework: str + """Player framework type""" + + hover_color: str + """Color of foreground elements when mouse is over in format #AAAAAA""" + + js_url: str + """Player main JS file URL. Leave empty to use JS URL from the default player""" + + logo: str + """URL to logo image""" + + logo_position: str + """Logotype position. + Has four possible values: + + - **tl** — top left + - **tr** — top right + - **bl** — bottom left + - **br** — bottom right + + Default is null + """ + + mute: bool + """Regulates the sound volume: + + - **true** — video starts with volume off + - **false** — video starts with volume on + + Default is false + """ + + save_options_to_cookies: bool + """Enables/Disables saving volume and other options in cookies: + + - **true** — user settings will be saved + - **false** — user settings will not be saved + + Default is true + """ + + show_sharing: bool + """Enables/Disables sharing button display: + + - **true** — sharing button is displayed + - **false** — no sharing button is displayed + + Default is true + """ + + skin_is_url: str + """URL to custom skin JS file""" + + speed_control: bool + """Enables/Disables speed control button display: + + - **true** — sharing button is displayed + - **false** — no sharing button is displayed + + Default is false + """ + + text_color: str + """Color of skin text elements in format #AAAAAA""" diff --git a/src/gcore/types/streaming/player_update_params.py b/src/gcore/types/streaming/player_update_params.py new file mode 100644 index 00000000..fb5a12c6 --- /dev/null +++ b/src/gcore/types/streaming/player_update_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_extensions import TypedDict + +from .player_param import PlayerParam + +__all__ = ["PlayerUpdateParams"] + + +class PlayerUpdateParams(TypedDict, total=False): + player: PlayerParam + """Set of properties for displaying videos. + + All parameters may be blank to inherit their values from default Streaming + player. + """ diff --git a/src/gcore/types/streaming/playlist.py b/src/gcore/types/streaming/playlist.py new file mode 100644 index 00000000..4e814af1 --- /dev/null +++ b/src/gcore/types/streaming/playlist.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Playlist"] + + +class Playlist(BaseModel): + active: Optional[bool] = None + """Enables/Disables playlist. Has two possible values: + + - true – Playlist can be played. + - false – Playlist is disabled. No broadcast while it's desabled. + """ + + ad_id: Optional[int] = None + """The advertisement ID that will be inserted into the video""" + + client_id: Optional[int] = None + """Current playlist client ID""" + + client_user_id: Optional[int] = None + """Custom field where you can specify user ID in your system""" + + countdown: Optional[bool] = None + """Enables countdown before playlist start with `playlist_type: live`""" + + hls_cmaf_url: Optional[str] = None + """A URL to a master playlist HLS (master-cmaf.m3u8) with CMAF-based chunks. + + Chunks are in fMP4 container. + + It is possible to use the same suffix-options as described in the "`hls_url`" + attribute. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + """ + + hls_url: Optional[str] = None + """A URL to a master playlist HLS (master.m3u8) with MPEG TS container. + + 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: + `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + Please see the details in `hls_url` attribute of /videos/{id} method. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + """ + + iframe_url: Optional[str] = None + """A URL to a built-in HTML video player with the video inside. + + It can be inserted into an iframe on your website and the video will + automatically play in all browsers. The player can be opened or shared via this + direct link. Also the video player can be integrated into your web pages using + the Iframe tag. + + Please see the details in `iframe_url` attribute of /videos/{id} method. + """ + + loop: Optional[bool] = None + """Enables/Disables playlist loop""" + + name: Optional[str] = None + """Playlist name""" + + player_id: Optional[int] = None + """The player ID with which the video will be played""" + + playlist_type: Optional[Literal["live", "vod"]] = None + """Determines whether the playlist: + + - `live` - playlist for live-streaming + - `vod` - playlist is for video on demand access + """ + + start_time: Optional[str] = None + """Playlist start time. + + Playlist won't be available before the specified time. Datetime in ISO 8601 + format. + """ + + video_ids: Optional[List[int]] = None + """A list of VOD IDs included in the playlist. + + Order of videos in a playlist reflects the order of IDs in the array. Maximum + video limit = 128. + """ diff --git a/src/gcore/types/streaming/playlist_create.py b/src/gcore/types/streaming/playlist_create.py new file mode 100644 index 00000000..eae6f2a6 --- /dev/null +++ b/src/gcore/types/streaming/playlist_create.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .playlist import Playlist + +__all__ = ["PlaylistCreate"] + + +class PlaylistCreate(Playlist): + id: Optional[int] = None + """Playlist ID""" diff --git a/src/gcore/types/streaming/playlist_create_params.py b/src/gcore/types/streaming/playlist_create_params.py new file mode 100644 index 00000000..48fcffe0 --- /dev/null +++ b/src/gcore/types/streaming/playlist_create_params.py @@ -0,0 +1,102 @@ +# 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, TypedDict + +__all__ = ["PlaylistCreateParams"] + + +class PlaylistCreateParams(TypedDict, total=False): + active: bool + """Enables/Disables playlist. Has two possible values: + + - true – Playlist can be played. + - false – Playlist is disabled. No broadcast while it's desabled. + """ + + ad_id: int + """The advertisement ID that will be inserted into the video""" + + client_id: int + """Current playlist client ID""" + + client_user_id: int + """Custom field where you can specify user ID in your system""" + + countdown: bool + """Enables countdown before playlist start with `playlist_type: live`""" + + hls_cmaf_url: str + """A URL to a master playlist HLS (master-cmaf.m3u8) with CMAF-based chunks. + + Chunks are in fMP4 container. + + It is possible to use the same suffix-options as described in the "`hls_url`" + attribute. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + """ + + hls_url: str + """A URL to a master playlist HLS (master.m3u8) with MPEG TS container. + + 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: + `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + Please see the details in `hls_url` attribute of /videos/{id} method. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + """ + + iframe_url: str + """A URL to a built-in HTML video player with the video inside. + + It can be inserted into an iframe on your website and the video will + automatically play in all browsers. The player can be opened or shared via this + direct link. Also the video player can be integrated into your web pages using + the Iframe tag. + + Please see the details in `iframe_url` attribute of /videos/{id} method. + """ + + loop: bool + """Enables/Disables playlist loop""" + + name: str + """Playlist name""" + + player_id: int + """The player ID with which the video will be played""" + + playlist_type: Literal["live", "vod"] + """Determines whether the playlist: + + - `live` - playlist for live-streaming + - `vod` - playlist is for video on demand access + """ + + start_time: str + """Playlist start time. + + Playlist won't be available before the specified time. Datetime in ISO 8601 + format. + """ + + video_ids: Iterable[int] + """A list of VOD IDs included in the playlist. + + Order of videos in a playlist reflects the order of IDs in the array. Maximum + video limit = 128. + """ diff --git a/src/gcore/types/streaming/playlist_list_params.py b/src/gcore/types/streaming/playlist_list_params.py new file mode 100644 index 00000000..19934578 --- /dev/null +++ b/src/gcore/types/streaming/playlist_list_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["PlaylistListParams"] + + +class PlaylistListParams(TypedDict, total=False): + page: int + """Query parameter. Use it to list the paginated content""" diff --git a/src/gcore/types/streaming/playlist_list_videos_response.py b/src/gcore/types/streaming/playlist_list_videos_response.py new file mode 100644 index 00000000..d8b5bf93 --- /dev/null +++ b/src/gcore/types/streaming/playlist_list_videos_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .playlist_video import PlaylistVideo + +__all__ = ["PlaylistListVideosResponse"] + +PlaylistListVideosResponse: TypeAlias = List[PlaylistVideo] diff --git a/src/gcore/types/streaming/playlist_update_params.py b/src/gcore/types/streaming/playlist_update_params.py new file mode 100644 index 00000000..bf2e1489 --- /dev/null +++ b/src/gcore/types/streaming/playlist_update_params.py @@ -0,0 +1,102 @@ +# 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, TypedDict + +__all__ = ["PlaylistUpdateParams"] + + +class PlaylistUpdateParams(TypedDict, total=False): + active: bool + """Enables/Disables playlist. Has two possible values: + + - true – Playlist can be played. + - false – Playlist is disabled. No broadcast while it's desabled. + """ + + ad_id: int + """The advertisement ID that will be inserted into the video""" + + client_id: int + """Current playlist client ID""" + + client_user_id: int + """Custom field where you can specify user ID in your system""" + + countdown: bool + """Enables countdown before playlist start with `playlist_type: live`""" + + hls_cmaf_url: str + """A URL to a master playlist HLS (master-cmaf.m3u8) with CMAF-based chunks. + + Chunks are in fMP4 container. + + It is possible to use the same suffix-options as described in the "`hls_url`" + attribute. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + """ + + hls_url: str + """A URL to a master playlist HLS (master.m3u8) with MPEG TS container. + + 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: + `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + Please see the details in `hls_url` attribute of /videos/{id} method. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + """ + + iframe_url: str + """A URL to a built-in HTML video player with the video inside. + + It can be inserted into an iframe on your website and the video will + automatically play in all browsers. The player can be opened or shared via this + direct link. Also the video player can be integrated into your web pages using + the Iframe tag. + + Please see the details in `iframe_url` attribute of /videos/{id} method. + """ + + loop: bool + """Enables/Disables playlist loop""" + + name: str + """Playlist name""" + + player_id: int + """The player ID with which the video will be played""" + + playlist_type: Literal["live", "vod"] + """Determines whether the playlist: + + - `live` - playlist for live-streaming + - `vod` - playlist is for video on demand access + """ + + start_time: str + """Playlist start time. + + Playlist won't be available before the specified time. Datetime in ISO 8601 + format. + """ + + video_ids: Iterable[int] + """A list of VOD IDs included in the playlist. + + Order of videos in a playlist reflects the order of IDs in the array. Maximum + video limit = 128. + """ diff --git a/src/gcore/types/streaming/playlist_video.py b/src/gcore/types/streaming/playlist_video.py new file mode 100644 index 00000000..52c65b05 --- /dev/null +++ b/src/gcore/types/streaming/playlist_video.py @@ -0,0 +1,215 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["PlaylistVideo"] + + +class PlaylistVideo(BaseModel): + name: str + """Video name""" + + auto_transcribe_audio_language: Optional[Literal["disable", "auto", ""]] = None + """Automatic creation of subtitles by transcribing the audio track. Values: + + - disable – Do not transcribe. + - auto – Automatically detects the activation of the option based on the + settings in your account. If generation is activated, then automatic language + detection while transcribing. + - \\ – Transcribe from specific language. Can be used to specify the exact + language spoken in the audio track, or when auto language detection fails. + Language is set by 3-letter language code according to ISO-639-2 + (bibliographic code). List of languages is available in `audio_language` + attribute of API POST /streaming/ai/transcribe . Example: + + ``` + `auto_transcribe_audio_language`: "auto" + `auto_transcribe_audio_language`: "ger" + ``` + + More details: + + - List of AI tasks – API + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/get-ai-task-result) + - Add subtitles to an exist video – API + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + """ + + auto_translate_subtitles_language: Optional[Literal["disable", "default", ""]] = None + """Automatic translation of auto-transcribed subtitles to the specified + language(s). + + Can be used both together with `auto_transcribe_audio_language` option only. Use + it when you want to make automatic subtitles in languages other than the + original language in audio. Values: + + - disable – Do not translate. + - default – There are 3 default languages: eng,fre,ger + - \\ – Explicit language to translate to, or list of languages separated by a + comma. Look at list of available languages in description of AI ASR task + creation. If several languages are specified for translation, a separate + subtitle will be generated for each language. Example: + + ``` + `auto_translate_subtitles_language`: default + `auto_translate_subtitles_language`: eng,fre,ger + ``` + + Please note that subtitle translation is done separately and after + transcription. Thus separate AI-tasks are created for translation. + """ + + client_user_id: Optional[int] = None + """Custom field where you can specify user ID in your system""" + + clip_duration_seconds: Optional[int] = None + """ + The length of the trimmed segment to transcode, instead of the entire length of + the video. Is only used in conjunction with specifying the start of a segment. + Transcoding duration is a number in seconds. + """ + + clip_start_seconds: Optional[int] = None + """ + If you want to transcode only a trimmed segment of a video instead of entire + length if the video, then you can provide timecodes of starting point and + duration of a segment to process. Start encoding from is a number in seconds. + """ + + custom_iframe_url: Optional[str] = None + """ + Deprecated. Custom URL of IFrame for video player to be used in share panel in + player. Auto generated IFrame URL provided by default + """ + + description: Optional[str] = None + """Video details; not visible to the end-users""" + + directory_id: Optional[int] = None + """ID of the directory where the video should be uploaded. (beta)""" + + origin_http_headers: Optional[str] = None + """Authorization HTTP request header. + + Will be used as credentials to authenticate a request to download a file + (specified in "`origin_url`" parameter) on an external server. Syntax: + `Authorization: ` Examples: + + - "`origin_http_headers`": "Authorization: Basic ..." + - "`origin_http_headers`": "Authorization: Bearer ..." + - "`origin_http_headers`": "Authorization: APIKey ..." Example of usage when + downloading a file from Google Drive: + + ``` + POST https://api.gcore.com/streaming/videos + "video": { + "name": "IBC 2024 intro.mp4", + "`origin_url`": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "`origin_http_headers`": "Authorization: Bearer ABC" + } + ``` + """ + + origin_url: Optional[str] = None + """ + URL to an original file which you want to copy from external storage. If + specified, system will download the file and will use it as video source for + transcoding. + """ + + poster: Optional[str] = None + """ + Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several + screenshots (they will be stored in "screenshots" attribute) from which you can + select an default screenshot. This "poster" field is for uploading your own + image. Also use attribute "`screenshot_id`" to select poster as a default + screnshot. Attribute accepts single image as base64-encoded string + [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In + format: `data:[];base64,` MIME-types are image/jpeg, image/webp, and image/png + and file sizes up to 1Mb. Examples: + + - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` + - `data:image/png;base64,iVBORw0KGg...ggg==` + - `data:image/webp;base64,UklGRt.../DgAAAAA` + """ + + priority: Optional[int] = None + """ + Priority allows you to adjust the urgency of processing some videos before + others in your account, if your algorithm requires it. For example, when there + are very urgent video and some regular ones that can wait in the queue. Value + range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest + up-priority. Default priority is 0. + """ + + projection: Optional[str] = None + """Deprecated. Regulates the video format: + + - **regular** — plays the video as usual + - **vr360** — plays the video in 360 degree mode + - **vr180** — plays the video in 180 degree mode + - **vr360tb** — plays the video in 3D 360 degree mode Top-Bottom. + + Default is regular + """ + + quality_set_id: Optional[int] = None + """ + Custom quality set ID for transcoding, if transcoding is required according to + your conditions. Look at GET /`quality_sets` method + """ + + remote_poster_url: Optional[str] = None + """ + Poster URL to download from external resource, instead of uploading via "poster" + attribute. It has the same restrictions as "poster" attribute. + """ + + remove_poster: Optional[bool] = None + """Set it to true to remove poster""" + + screenshot_id: Optional[int] = None + """ + Default screenshot index. Specify an ID from the "screenshots" array, so that + the URL of the required screenshot appears in the "screenshot" attribute as the + default screenshot. By default 5 static screenshots will be taken from different + places in the video after transcoding. If the video is short, there may be fewer + screenshots. Counting from 0. A value of -1 sets the default screenshot to the + URL of your own image from the "poster" attribute. Look at "screenshot" + attribute in GET /videos/{`video_id`} for details. + """ + + share_url: Optional[str] = None + """ + Deprecated. Custom URL or iframe displayed in the link field when a user clicks + on a sharing button in player. If empty, the link field and social network + sharing is disabled + """ + + source_bitrate_limit: Optional[bool] = None + """ + The option allows you to set the video transcoding rule so that the output + bitrate in ABR ladder is not exceeding the bitrate of the original video. + + This option is for advanced users only. + + By default `source_bitrate_limit: true` this option allows you to have the + output bitrate not more than in the original video, thus to transcode video + faster and to deliver it to end-viewers faster as well. At the same time, the + quality will be similar to the original. If for some reason you need more + byte-space in the output quality when encoding, you can set this option to + `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will + be raised from the bitrate of the original video to the maximum possible limit + specified in our the Product Documentation. For example, this may be needed + when: + + - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, + - to improve the picture quality on dynamic scenes, + - etc. The option is applied only at the video creation stage and cannot be + changed later. If you want to re-transcode the video using new value, then you + need to create and upload a new video only. + """ diff --git a/src/gcore/types/streaming/popular_videos.py b/src/gcore/types/streaming/popular_videos.py new file mode 100644 index 00000000..ffe42a4b --- /dev/null +++ b/src/gcore/types/streaming/popular_videos.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["PopularVideos", "Data"] + + +class Data(BaseModel): + id: str + + views: int + + +class PopularVideos(BaseModel): + data: Optional[List[Data]] = None diff --git a/src/gcore/types/streaming/quality_set_set_default_params.py b/src/gcore/types/streaming/quality_set_set_default_params.py new file mode 100644 index 00000000..087f75df --- /dev/null +++ b/src/gcore/types/streaming/quality_set_set_default_params.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["QualitySetSetDefaultParams", "Live", "Vod"] + + +class QualitySetSetDefaultParams(TypedDict, total=False): + live: Live + + vod: Vod + + +class Live(TypedDict, total=False): + id: int + """ID of the custom quality set, or "null" for the system default""" + + +class Vod(TypedDict, total=False): + id: int + """ID of the custom quality set, or "null" for the system default""" diff --git a/src/gcore/types/streaming/quality_sets.py b/src/gcore/types/streaming/quality_sets.py new file mode 100644 index 00000000..a39b950b --- /dev/null +++ b/src/gcore/types/streaming/quality_sets.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["QualitySets", "Live", "LiveQuality", "Vod", "VodQuality"] + + +class LiveQuality(BaseModel): + id: Optional[int] = None + """ID of the quality""" + + name: Optional[str] = None + """Name of the quality""" + + +class Live(BaseModel): + id: Optional[int] = None + """ID of the custom quality set""" + + default: Optional[bool] = None + """States if this preset is default for a client profile""" + + name: Optional[str] = None + """Human readable name of the quality set""" + + qualities: Optional[List[LiveQuality]] = None + """Array of associated qualities""" + + +class VodQuality(BaseModel): + id: Optional[int] = None + """ID of the quality""" + + name: Optional[str] = None + """Name of the quality""" + + +class Vod(BaseModel): + id: Optional[int] = None + """ID of the custom quality set""" + + default: Optional[bool] = None + """States if this preset is default for a client profile""" + + name: Optional[str] = None + """Human readable name of the quality set""" + + qualities: Optional[List[VodQuality]] = None + """Array of associated qualities""" + + +class QualitySets(BaseModel): + live: Optional[List[Live]] = None + + vod: Optional[List[Vod]] = None diff --git a/src/gcore/types/streaming/restream.py b/src/gcore/types/streaming/restream.py new file mode 100644 index 00000000..16800b1d --- /dev/null +++ b/src/gcore/types/streaming/restream.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["Restream"] + + +class Restream(BaseModel): + active: Optional[bool] = None + """Enables/Disables restream. Has two possible values: + + - **true** — restream is enabled and can be started + - **false** — restream is disabled. + + Default is true + """ + + client_user_id: Optional[int] = None + """Custom field where you can specify user ID in your system""" + + live: Optional[bool] = None + """Indicates that the stream is being published. Has two possible values: + + - **true** — stream is being published + - **false** — stream isn't published + """ + + name: Optional[str] = None + """Restream name""" + + stream_id: Optional[int] = None + """ID of the stream to restream""" + + uri: Optional[str] = None + """A URL to push the stream to""" diff --git a/src/gcore/types/streaming/restream_create_params.py b/src/gcore/types/streaming/restream_create_params.py new file mode 100644 index 00000000..0d4668e4 --- /dev/null +++ b/src/gcore/types/streaming/restream_create_params.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["RestreamCreateParams", "Restream"] + + +class RestreamCreateParams(TypedDict, total=False): + restream: Restream + + +class Restream(TypedDict, total=False): + active: bool + """Enables/Disables restream. Has two possible values: + + - **true** — restream is enabled and can be started + - **false** — restream is disabled. + + Default is true + """ + + client_user_id: int + """Custom field where you can specify user ID in your system""" + + live: bool + """Indicates that the stream is being published. Has two possible values: + + - **true** — stream is being published + - **false** — stream isn't published + """ + + name: str + """Restream name""" + + stream_id: int + """ID of the stream to restream""" + + uri: str + """A URL to push the stream to""" diff --git a/src/gcore/types/streaming/restream_list_params.py b/src/gcore/types/streaming/restream_list_params.py new file mode 100644 index 00000000..2cc1b34a --- /dev/null +++ b/src/gcore/types/streaming/restream_list_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["RestreamListParams"] + + +class RestreamListParams(TypedDict, total=False): + page: int + """Query parameter. Use it to list the paginated content""" diff --git a/src/gcore/types/streaming/restream_update_params.py b/src/gcore/types/streaming/restream_update_params.py new file mode 100644 index 00000000..9d62d9f7 --- /dev/null +++ b/src/gcore/types/streaming/restream_update_params.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["RestreamUpdateParams", "Restream"] + + +class RestreamUpdateParams(TypedDict, total=False): + restream: Restream + + +class Restream(TypedDict, total=False): + active: bool + """Enables/Disables restream. Has two possible values: + + - **true** — restream is enabled and can be started + - **false** — restream is disabled. + + Default is true + """ + + client_user_id: int + """Custom field where you can specify user ID in your system""" + + live: bool + """Indicates that the stream is being published. Has two possible values: + + - **true** — stream is being published + - **false** — stream isn't published + """ + + name: str + """Restream name""" + + stream_id: int + """ID of the stream to restream""" + + uri: str + """A URL to push the stream to""" diff --git a/src/gcore/types/streaming/statistic_get_ffprobes_params.py b/src/gcore/types/streaming/statistic_get_ffprobes_params.py new file mode 100644 index 00000000..06ab6ea2 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_ffprobes_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["StatisticGetFfprobesParams"] + + +class StatisticGetFfprobesParams(TypedDict, total=False): + date_from: Required[str] + """Start of time frame. Format is ISO 8601.""" + + date_to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" + + stream_id: Required[str] + """Stream ID""" + + interval: int + + units: Literal["second", "minute", "hour", "day", "week", "month"] diff --git a/src/gcore/types/streaming/statistic_get_live_unique_viewers_params.py b/src/gcore/types/streaming/statistic_get_live_unique_viewers_params.py new file mode 100644 index 00000000..7766326f --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_live_unique_viewers_params.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetLiveUniqueViewersParams"] + + +class StatisticGetLiveUniqueViewersParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start of time frame. Format is date time in ISO 8601""" + + to: Required[str] + """End of time frame. Format is date time in ISO 8601""" + + client_user_id: int + """Filter by "`client_user_id`" """ + + granularity: Literal["1m", "5m", "15m", "1h", "1d"] + """Specifies the time interval for grouping data""" + + stream_id: int + """Filter by "`stream_id`" """ diff --git a/src/gcore/types/streaming/statistic_get_live_unique_viewers_response.py b/src/gcore/types/streaming/statistic_get_live_unique_viewers_response.py new file mode 100644 index 00000000..c56eb692 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_live_unique_viewers_response.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = [ + "StatisticGetLiveUniqueViewersResponse", + "StatisticGetLiveUniqueViewersResponseItem", + "StatisticGetLiveUniqueViewersResponseItemMetrics", +] + + +class StatisticGetLiveUniqueViewersResponseItemMetrics(BaseModel): + streams: List[int] + + +class StatisticGetLiveUniqueViewersResponseItem(BaseModel): + client: int + + metrics: StatisticGetLiveUniqueViewersResponseItemMetrics + + +StatisticGetLiveUniqueViewersResponse: TypeAlias = List[StatisticGetLiveUniqueViewersResponseItem] diff --git a/src/gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py b/src/gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py new file mode 100644 index 00000000..c7178616 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetLiveWatchTimeCdnParams"] + + +class StatisticGetLiveWatchTimeCdnParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start of the time period for counting minutes of watching. + + Format is date time in ISO 8601. + """ + + client_user_id: int + """Filter by field "`client_user_id`" """ + + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] + """Data is grouped by the specified time interval""" + + stream_id: int + """Filter by `stream_id`""" + + to: str + """End of time frame. + + Datetime in ISO 8601 format. If omitted, then the current time is taken + """ diff --git a/src/gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py b/src/gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py new file mode 100644 index 00000000..8ba977d6 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetLiveWatchTimeTotalCdnParams"] + + +class StatisticGetLiveWatchTimeTotalCdnParams(TypedDict, total=False): + client_user_id: int + """Filter by field "`client_user_id`" """ + + from_: Annotated[str, PropertyInfo(alias="from")] + """Start of the time period for counting minutes of watching. + + Format is date time in ISO 8601. If omitted, the earliest start time for viewing + is taken + """ + + stream_id: int + """Filter by `stream_id`""" + + to: str + """End of time frame. + + Datetime in ISO 8601 format. If missed, then the current time is taken + """ diff --git a/src/gcore/types/streaming/statistic_get_max_streams_series_params.py b/src/gcore/types/streaming/statistic_get_max_streams_series_params.py new file mode 100644 index 00000000..42040272 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_max_streams_series_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetMaxStreamsSeriesParams"] + + +class StatisticGetMaxStreamsSeriesParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start of time frame. Datetime in ISO 8601 format.""" + + to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" + + granularity: Literal["1m", "5m", "15m", "1h", "1d"] + """specifies the time interval for grouping data""" diff --git a/src/gcore/types/streaming/statistic_get_meet_series_params.py b/src/gcore/types/streaming/statistic_get_meet_series_params.py new file mode 100644 index 00000000..7c3e36ce --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_meet_series_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetMeetSeriesParams"] + + +class StatisticGetMeetSeriesParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start of time frame. Datetime in ISO 8601 format.""" + + to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" + + granularity: Literal["1m", "5m", "15m", "1h", "1d"] + """specifies the time interval for grouping data""" diff --git a/src/gcore/types/streaming/statistic_get_popular_videos_params.py b/src/gcore/types/streaming/statistic_get_popular_videos_params.py new file mode 100644 index 00000000..9d812241 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_popular_videos_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["StatisticGetPopularVideosParams"] + + +class StatisticGetPopularVideosParams(TypedDict, total=False): + date_from: Required[str] + """Start of time frame. Datetime in ISO 8601 format.""" + + date_to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" diff --git a/src/gcore/types/streaming/statistic_get_storage_series_params.py b/src/gcore/types/streaming/statistic_get_storage_series_params.py new file mode 100644 index 00000000..3e0b8e7b --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_storage_series_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetStorageSeriesParams"] + + +class StatisticGetStorageSeriesParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start of time frame. Datetime in ISO 8601 format.""" + + to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" + + granularity: Literal["1m", "5m", "15m", "1h", "1d"] + """specifies the time interval for grouping data""" diff --git a/src/gcore/types/streaming/statistic_get_stream_series_params.py b/src/gcore/types/streaming/statistic_get_stream_series_params.py new file mode 100644 index 00000000..c2879e08 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_stream_series_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetStreamSeriesParams"] + + +class StatisticGetStreamSeriesParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start of time frame. Datetime in ISO 8601 format.""" + + to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" + + granularity: Literal["1m", "5m", "15m", "1h", "1d"] + """specifies the time interval for grouping data""" diff --git a/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py b/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py new file mode 100644 index 00000000..3516aa24 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["StatisticGetUniqueViewersCdnParams"] + + +class StatisticGetUniqueViewersCdnParams(TypedDict, total=False): + date_from: Required[str] + """Start of time frame. Format is date time in ISO 8601.""" + + date_to: Required[str] + """End of time frame. Format is date time in ISO 8601.""" + + id: str + """Filter by entity's id. + + Put ID of a Live stream, VOD or a playlist to be calculated. If the value is + omitted, then the calculation is done for all videos/streams of the specified + type. When using this "id" parameter, be sure to specify the "type" parameter + too. If you do not specify a type, the "id" will be ignored. + """ + + type: Literal["live", "vod", "playlist"] + """Filter by entity's type""" diff --git a/src/gcore/types/streaming/statistic_get_unique_viewers_params.py b/src/gcore/types/streaming/statistic_get_unique_viewers_params.py new file mode 100644 index 00000000..4e3f3323 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_unique_viewers_params.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["StatisticGetUniqueViewersParams"] + + +class StatisticGetUniqueViewersParams(TypedDict, total=False): + date_from: Required[str] + """Start of time frame. Datetime in ISO 8601 format.""" + + date_to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" + + id: str + """filter by entity's id""" + + country: str + """filter by country""" + + event: Literal["init", "start", "watch"] + """filter by event's name""" + + group: List[Literal["date", "host", "os", "browser", "platform", "ip", "country", "event", "id"]] + """group=1,2,4 OR group=1&group=2&group=3""" + + host: str + """filter by host""" + + type: Literal["live", "vod", "playlist"] + """filter by entity's type""" diff --git a/src/gcore/types/streaming/statistic_get_views_by_browsers_params.py b/src/gcore/types/streaming/statistic_get_views_by_browsers_params.py new file mode 100644 index 00000000..48ff13e4 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_views_by_browsers_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["StatisticGetViewsByBrowsersParams"] + + +class StatisticGetViewsByBrowsersParams(TypedDict, total=False): + date_from: Required[str] + """Start of time frame. Datetime in ISO 8601 format.""" + + date_to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" diff --git a/src/gcore/types/streaming/statistic_get_views_by_country_params.py b/src/gcore/types/streaming/statistic_get_views_by_country_params.py new file mode 100644 index 00000000..1b5170ff --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_views_by_country_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["StatisticGetViewsByCountryParams"] + + +class StatisticGetViewsByCountryParams(TypedDict, total=False): + date_from: Required[str] + """Start of time frame. Datetime in ISO 8601 format.""" + + date_to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" diff --git a/src/gcore/types/streaming/statistic_get_views_by_hostname_params.py b/src/gcore/types/streaming/statistic_get_views_by_hostname_params.py new file mode 100644 index 00000000..7bd821a1 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_views_by_hostname_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["StatisticGetViewsByHostnameParams"] + + +class StatisticGetViewsByHostnameParams(TypedDict, total=False): + date_from: Required[str] + """Start of time frame. Datetime in ISO 8601 format.""" + + date_to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" diff --git a/src/gcore/types/streaming/statistic_get_views_by_operating_system_params.py b/src/gcore/types/streaming/statistic_get_views_by_operating_system_params.py new file mode 100644 index 00000000..8c7fab23 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_views_by_operating_system_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["StatisticGetViewsByOperatingSystemParams"] + + +class StatisticGetViewsByOperatingSystemParams(TypedDict, total=False): + date_from: Required[str] + """Start of time frame. Datetime in ISO 8601 format.""" + + date_to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" diff --git a/src/gcore/types/streaming/statistic_get_views_by_referer_params.py b/src/gcore/types/streaming/statistic_get_views_by_referer_params.py new file mode 100644 index 00000000..ce5fbd11 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_views_by_referer_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["StatisticGetViewsByRefererParams"] + + +class StatisticGetViewsByRefererParams(TypedDict, total=False): + date_from: Required[str] + """Start of time frame. Datetime in ISO 8601 format.""" + + date_to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" diff --git a/src/gcore/types/streaming/statistic_get_views_by_region_params.py b/src/gcore/types/streaming/statistic_get_views_by_region_params.py new file mode 100644 index 00000000..7cac8462 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_views_by_region_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["StatisticGetViewsByRegionParams"] + + +class StatisticGetViewsByRegionParams(TypedDict, total=False): + date_from: Required[str] + """Start of time frame. Datetime in ISO 8601 format.""" + + date_to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" diff --git a/src/gcore/types/streaming/statistic_get_views_heatmap_params.py b/src/gcore/types/streaming/statistic_get_views_heatmap_params.py new file mode 100644 index 00000000..0c8f3b24 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_views_heatmap_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, Required, TypedDict + +__all__ = ["StatisticGetViewsHeatmapParams"] + + +class StatisticGetViewsHeatmapParams(TypedDict, total=False): + date_from: Required[str] + """Start of time frame. Datetime in ISO 8601 format.""" + + date_to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" + + stream_id: Required[str] + """video streaming ID""" + + type: Required[Literal["live", "vod", "playlist"]] + """entity's type""" diff --git a/src/gcore/types/streaming/statistic_get_views_params.py b/src/gcore/types/streaming/statistic_get_views_params.py new file mode 100644 index 00000000..fa2f35d6 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_views_params.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["StatisticGetViewsParams"] + + +class StatisticGetViewsParams(TypedDict, total=False): + date_from: Required[str] + """Start of time frame. Datetime in ISO 8601 format.""" + + date_to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" + + id: str + """filter by entity's id""" + + country: str + """filter by country""" + + event: Literal["init", "start", "watch"] + """filter by event's name""" + + group: List[Literal["host", "os", "browser", "platform", "ip", "country", "event", "id"]] + """group=1,2,4 OR group=1&group=2&group=3""" + + host: str + """filter by host""" + + type: Literal["live", "vod", "playlist"] + """filter by entity's type""" diff --git a/src/gcore/types/streaming/statistic_get_vod_storage_volume_params.py b/src/gcore/types/streaming/statistic_get_vod_storage_volume_params.py new file mode 100644 index 00000000..ed6385c9 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_vod_storage_volume_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetVodStorageVolumeParams"] + + +class StatisticGetVodStorageVolumeParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start of time frame. Datetime in ISO 8601 format.""" + + to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" diff --git a/src/gcore/types/streaming/statistic_get_vod_transcoding_duration_params.py b/src/gcore/types/streaming/statistic_get_vod_transcoding_duration_params.py new file mode 100644 index 00000000..d845157e --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_vod_transcoding_duration_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetVodTranscodingDurationParams"] + + +class StatisticGetVodTranscodingDurationParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start of time frame. Datetime in ISO 8601 format.""" + + to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" diff --git a/src/gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py b/src/gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py new file mode 100644 index 00000000..a0ed38cb --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetVodUniqueViewersCdnParams"] + + +class StatisticGetVodUniqueViewersCdnParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start of time frame. Format is date time in ISO 8601""" + + to: Required[str] + """End of time frame. Format is date time in ISO 8601""" + + client_user_id: int + """Filter by user "id" """ + + granularity: Literal["1m", "5m", "15m", "1h", "1d"] + """Specifies the time interval for grouping data""" + + slug: str + """Filter by video "slug" """ diff --git a/src/gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py b/src/gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py new file mode 100644 index 00000000..83869ae2 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetVodWatchTimeCdnParams"] + + +class StatisticGetVodWatchTimeCdnParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start of the time period for counting minutes of watching. + + Format is date time in ISO 8601. + """ + + client_user_id: int + """Filter by field "`client_user_id`" """ + + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] + """Data is grouped by the specified time interval""" + + slug: str + """Filter by video's slug""" + + to: str + """End of time frame. + + Datetime in ISO 8601 format. If omitted, then the current time is taken. + """ diff --git a/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py b/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py new file mode 100644 index 00000000..dc7271d3 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetVodWatchTimeTotalCdnParams"] + + +class StatisticGetVodWatchTimeTotalCdnParams(TypedDict, total=False): + client_user_id: int + """Filter by field "`client_user_id`" """ + + from_: Annotated[str, PropertyInfo(alias="from")] + """Start of the time period for counting minutes of watching. + + Format is date time in ISO 8601. If omitted, the earliest start time for viewing + is taken + """ + + slug: str + """Filter by video's slug""" + + to: str + """End of time frame. + + Datetime in ISO 8601 format. If omitted, then the current time is taken + """ diff --git a/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py b/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py new file mode 100644 index 00000000..6e5e61c6 --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["StatisticGetVodWatchTimeTotalCdnResponse", "StatisticGetVodWatchTimeTotalCdnResponseItem"] + + +class StatisticGetVodWatchTimeTotalCdnResponseItem(BaseModel): + client: int + + duration: int + """count of minutes""" + + client_user_id: Optional[int] = None + + slug: Optional[str] = None + + +StatisticGetVodWatchTimeTotalCdnResponse: TypeAlias = List[StatisticGetVodWatchTimeTotalCdnResponseItem] diff --git a/src/gcore/types/streaming/storage_series.py b/src/gcore/types/streaming/storage_series.py new file mode 100644 index 00000000..64b971d9 --- /dev/null +++ b/src/gcore/types/streaming/storage_series.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["StorageSeries", "StorageSeryItem", "StorageSeryItemMetrics"] + + +class StorageSeryItemMetrics(BaseModel): + max_volume_usage: List[int] + + storage: List[List[int]] + + +class StorageSeryItem(BaseModel): + client: int + + metrics: StorageSeryItemMetrics + + +StorageSeries: TypeAlias = List[StorageSeryItem] diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py new file mode 100644 index 00000000..4aadef8a --- /dev/null +++ b/src/gcore/types/streaming/stream.py @@ -0,0 +1,420 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel +from .streams.overlay import Overlay + +__all__ = ["Stream"] + + +class Stream(BaseModel): + name: str + """ + Stream name. Often used as a human-readable name for the stream, but can contain + any text you wish. The values are not unique and may be repeated. Examples: + + - Conference in July + - Stream #10003 + - Open-Air Camera #31 Backstage + - 480fd499-2de2-4988-bc1a-a4eebe9818ee + """ + + id: Optional[int] = None + """Stream ID""" + + active: Optional[bool] = None + """Stream switch between on and off. + + This is not an indicator of the status "stream is receiving and it is LIVE", but + rather an on/off switch. When stream is switched off, there is no way to process + it: PULL is deactivated and PUSH will return an error. + + - true – stream can be processed + - false – stream is off, and cannot be processed + """ + + auto_record: Optional[bool] = None + """Enables autotomatic recording of the stream when it started. + + So you don't need to call recording manually. Result of recording is + automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base Values: + + - true – auto recording is enabled + - false – auto recording is disabled + """ + + backup_live: Optional[bool] = None + """ + State of receiving and transcoding master stream from source by backup server if + you pushing stream to "`backup_push_url`" or "`backup_push_url_srt`". Displays + the backup server status of PUSH method only. For PULL a "live" field is always + used, even when origin servers are switched using round robin scheduling (look + "uri" field for details). + """ + + backup_push_url: Optional[str] = None + """URL to PUSH master stream to our backup server using RTMP/S protocols. + + Servers for the main and backup streams are distributed geographically. Mainly + sending one stream to main server is enough. But if you need a backup stream, + then this is the field to PUSH it. To use RTMPS just manually change the + protocol name from "rtmp://" to "rtmps://". The backup logs are as follows: In + PUSH mode, you initiate sending a stream from your machine. If your stream stops + or breaks for some reason and it stops coming to the main server, then after + 3-10 seconds of waiting the stream will turn off or the backup one will be + automatically turned on, if you are pushing it too. + """ + + backup_push_url_srt: Optional[str] = None + """ + URL to PUSH master stream to our backup server using SRT protocol with the same + logic of backup-streams + """ + + broadcast_ids: Optional[List[int]] = None + """IDs of broadcasts which will include this stream""" + + cdn_id: Optional[int] = None + """ + ID of custom CDN resource from which the content will be delivered (only if you + know what you do) + """ + + client_entity_data: Optional[str] = None + """ + Custom meta field designed to store your own extra information about a video + entity: video source, video id, parameters, etc. We do not use this field in any + way when processing the stream. You can store any data in any format (string, + json, etc), saved as a text string. Example: + `` client_entity_data = '{ "`seq_id`": "1234567890", "name": "John Doe", "iat": 1516239022 }' `` + """ + + client_user_id: Optional[int] = None + """Custom meta field for storing the Identifier in your system. + + We do not use this field in any way when processing the stream. Example: + `client_user_id = 1001` + """ + + created_at: Optional[str] = None + """Datetime of creation in ISO 8601""" + + dash_url: Optional[str] = None + """MPEG-DASH output. + + URL for transcoded result stream in MPEG-DASH format, with .mpd link. Low + Latency support: YES. This is CMAF-based MPEG-DASH stream. Encoder and packager + dynamically assemble the video stream with fMP4 fragments. Chunks have ±2-4 + seconds duration depending on the settings. All chunks for DASH are transferred + through CDN using chunk transfer technology, which allows to use all the + advantages of low latency delivery of DASH. + + - by default low latency is ±4 sec, because it's stable for almost all last-mile + use cases. + - and its possible to enable ±2 sec for DASH, just ask our Support Team. + + Read more information in the article "How Low Latency streaming works" in the + Knowledge Base. + """ + + dvr_duration: Optional[int] = None + """DVR duration in seconds if DVR feature is enabled for the stream. + + So this is duration of how far the user can rewind the live stream. + `dvr_duration` range is [30...14400]. Maximum value is 4 hours = 14400 seconds. + If you need more, ask the Support Team please. + """ + + dvr_enabled: Optional[bool] = None + """Enables DVR for the stream: + + - true – DVR is enabled + - false – DVR is disabled + """ + + finished_at_primary: Optional[str] = None + """Time when the stream ended for the last time. + + Datetime in ISO 8601. After restarting the stream, this value is not reset to + "null", and the time of the last/previous end is always displayed here. That is, + when the start time is greater than the end time, it means the current session + is still ongoing and the stream has not ended yet. If you want to see all + information about acitivity of the stream, you can get it from another method + /streaming/statistics/ffprobe. This method shows aggregated activity parameters + during a time, when stream was alive and transcoded. Also you can create graphs + to see the activity. For example + /streaming/statistics/ffprobe?interval=6000&`date_from`=2023-10-01&`date_to`=2023-10-11&`stream_id`=12345 + """ + + frame_rate: Optional[float] = None + """Current FPS of the original stream, if stream is transcoding""" + + hls_cmaf_url: Optional[str] = None + """HLS output. + + URL for transcoded result of stream in HLS CMAF format, with .m3u8 link. + Recommended for use for all HLS streams. Low Latency support: YES. This is + CMAF-based HLS stream. Encoder and packager dynamically assemble the video + stream with fMP4 fragments. Chunks have ±2-4 seconds duration depending on the + settings. All chunks for LL-HLS are transferred through CDN via dividing into + parts (small segments `#EXT-X-PART` of 0.5-1.0 sec duration), which allows to + use all the advantages of low latency delivery of LL-HLS. + + - by default low latency is ±5 sec, because it's stable for almost all last-mile + use cases. + - and its possible to enable ±3 sec for LL-HLS, just ask our Support Team. + + It is also possible to use modifier-attributes, which are described in the + "`hls_mpegts_url`" field above. If you need to get MPEGTS (.ts) chunks, look at + the attribute "`hls_mpegts_url`". + + Read more information in the article "How Low Latency streaming works" in the + Knowledge Base. + """ + + hls_mpegts_endlist_tag: Optional[bool] = None + """ + Add `#EXT-X-ENDLIST` tag within .m3u8 playlist after the last segment of a live + stream when broadcast is ended. + """ + + hls_mpegts_url: Optional[str] = None + """HLS output for legacy devices. + + URL for transcoded result of stream in HLS MPEGTS (.ts) format, with .m3u8 link. + Low Latency support: NO. Some legacy devices or software may require MPEGTS + (.ts) segments as a format for streaming, so we provide this options keeping + backward compatibility with any of your existing workflows. For other cases it's + better to use "`hls_cmaf_url`" instead. You can use this legacy HLSv6 format + based on MPEGTS segmenter in parallel with main HLS CMAF. Both formats are + sharing same segments size, manifest length (DVR), etc. + + It is also possible to use additional modifier-attributes: + + - ?`get_duration_sec`=true – Adds the real segment duration in seconds to chunk + requests. A chunk duration will be automatically added to a chunk request + string with the "`duration_sec`" attribute. The value is an integer for a + length multiple of whole seconds, or a fractional number separated by a dot + for chunks that are not multiples of seconds. This attribute allows you to + determine duration in seconds at the level of analyzing the logs of CDN + requests and compare it with file size (so to use it in your analytics). Such + modifier attributes are applied manually and added to the link obtained from + this field. I.e. `` ?`get_duration_sec`=true `` Example: + `https://demo.gvideo.io/mpegts/`2675_19146`/`master_mpegts`.m3u8?`get_duration_sec`=true` + + ``` + #EXTM3U + #EXT-X-VERSION:6 + #EXT-X-TARGETDURATION:2 + ... + #EXTINF:2.000000, + #EXT-X-PROGRAM-DATE-TIME:2025-08-14T08:15:00 + seg1.ts?`duration_sec`=2 + ... + ``` + """ + + html_overlay: Optional[bool] = None + """ + Switch on mode to insert and display real-time HTML overlay widgets on top of + live streams + """ + + html_overlays: Optional[List[Overlay]] = None + """Array of HTML overlay widgets""" + + iframe_url: Optional[str] = None + """A URL to a built-in HTML web player with the stream inside. + + It can be inserted into an iframe on your website and the video will + automatically play in all browsers. Please, remember that transcoded streams + from "`hls_cmaf_url`" with .m3u8 at the end, and from "`dash_url`" with .mpd at + the end are to be played inside video players only. For example: AVplayer on + iOS, Exoplayer on Android, HTML web player in browser, etc. General bowsers like + Chrome, Firefox, etc cannot play transcoded streams with .m3u8 and .mpd at the + end. The only exception is Safari, which can only play Apple's HLS .m3u8 format + with limits. That's why you may need to use this HTML web player. Please, look + Knowledge Base for details. Example of usage on a web page: + + + """ + + live: Optional[bool] = None + """State of receiving and transcoding master stream from source by main server""" + + low_latency_enabled: Optional[bool] = None + """ + Deprecated, always returns "true". The only exception is that the attribute can + only be used by clients that have previously used the old stream format. This + method is outdated since we've made it easier to manage streams. For your + convenience, you no longer need to set this parameter at the stage of creating a + stream. Now all streams are prepared in 2 formats simultaniously: Low Latency + and Legacy. You can get the desired output format in the attributes + "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. + + --- + + Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the + "`hls_mpegts_url`" attribute instead. + """ + + projection: Optional[Literal["regular", "vr360", "vr180", "vr360tb"]] = None + """ + Visualization mode for 360° streams, how the stream is rendered in our web + player ONLY. If you would like to show video 360° in an external video player, + then use parameters of that video player. Modes: + + - regular – regular “flat” stream + - vr360 – display stream in 360° mode + - vr180 – display stream in 180° mode + - vr360tb – display stream in 3D 360° mode Top-Bottom + """ + + pull: Optional[bool] = None + """Indicates if stream is pulled from external server or not. + + Has two possible values: + + - true – stream is received by PULL method. Use this when need to get stream + from external server by srt, rtmp\\ss, hls, dash, etc protocols. + - false – stream is received by PUSH method. Use this when need to send stream + from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + """ + + push_url: Optional[str] = None + """ + URL to PUSH master stream to our main server using RTMP and RTMPS protocols. To + use RTMPS just manually change the protocol name from "rtmp://" to "rtmps://". + If you see an error like "invalid SSL certificate" try the following: + + - Make sure the push URL is correct, and it contains "rtmps://". + - If the URL looks correct but you still get an SSL error, try specifying the + port 443 in the URL. Here’s an example: + rtmps://vp-push.domain.com:443/in/stream?key. + - If you're still having trouble, then your encoder may not support RTMPS. + Double-check the documentation for your encoder. For advanced customers only: + For your complexly distributed broadcast systems, it is also possible to + additionally output an array of multi-regional ingestion points for manual + selection from them. To activate this mode, contact your manager or the + Support Team to activate the "`multi_region_push_urls`" attibute. But if you + clearly don’t understand why you need this, then it’s best to use the default + single URL in the "`push_url`" attribute. + """ + + push_url_srt: Optional[str] = None + """ + URL to PUSH master stream to our main server using SRT protocol. Use only 1 + protocol of sending a master stream: either only SRT (`push_url_srt`), or only + RTMP (`push_url`). + """ + + push_url_whip: Optional[str] = None + """URL to PUSH WebRTC stream to our server using WHIP protocol. + + **WebRTC WHIP to LL-HLS and DASH** Video Streaming supports WebRTC HTTP Ingest + Protocol (WHIP), and WebRTC to HLS/DASH converter. As a result you can stream + from web broswers natively. **WebRTC WHIP server** We have dedicated WebRTC WHIP + servers in our infrastructure. WebRTC WHIP server organizes both signaling and + receives video data. Signaling is a term to describe communication between + WebRTC endpoints, needed to initiate and maintain a session. WHIP is an open + specification for a simple signaling protocol for starting WebRTC sessions in an + outgoing direction, (i.e., streaming from your device). **WebRTC stream encoding + parameters** At least one video and audio track both must be present in the + stream: + + - Video must be encoded with H.264. + - Audio must be encoded with OPUS. Note. Specifically for WebRTC mode a method + of constant transcoding with an initial given resolution is used. This means + that if WebRTC in the end-user's browser decides to reduce the quality or + resolution of the master stream (to let say 360p) due to restrictions on the + end-user's device (network conditions, CPU consumption, etc.), the transcoder + will still continue to transcode the reduced stream to the initial resolution + (let say 1080p ABR). When the restrictions on the end-user's device are + removed, quiality will improve again. **WebRTC WHIP Client** We provide a + convenient WebRTC WHIP library for working in browsers. You can use our + library, or any other you prefer. Simple example of usage is here: + https://stackblitz.com/edit/stackblitz-starters-j2r9ar?file=index.html Also + try to use the feature in UI of the Customer Portal. In the Streaming section + inside the settings of a specific live stream, a new section "Quick start in + browser" has been added. More information in the Product Documentation on the + website. + """ + + quality_set_id: Optional[int] = None + """ + Custom quality set ID for transcoding, if transcoding is required according to + your conditions. Look at GET /`quality_sets` method + """ + + record_type: Optional[Literal["origin", "transcoded"]] = None + """Method of recording a stream. + + Specifies the source from which the stream will be recorded: original or + transcoded. Types: + + - "origin" – To record RMTP/SRT/etc original clean media source. + - "transcoded" – To record the output transcoded version of the stream, + including overlays, texts, logos, etc. additional media layers. + """ + + recording_duration: Optional[float] = None + """Duration of current recording in seconds if recording is enabled for the stream""" + + screenshot: Optional[str] = None + """ + An instant screenshot taken from a live stream, and available as a static JPEG + image. Resolution 1080 pixels wide, or less if the original stream has a lower + resolution. Screenshot is taken every 10 seconds while the stream is live. This + field contains a link to the last screenshot created by the system. Screenshot + history is not stored, so if you need a series of screenshots over time, then + download them. + """ + + started_at_backup: Optional[str] = None + """Time of the last session when backup server started receiving the stream. + + Datetime in ISO 8601 + """ + + started_at_primary: Optional[str] = None + """Time of the last session when main server started receiving the stream. + + Datetime in ISO 8601. This means that if the stream was started 1 time, then + here will be the time it was started. If the stream was started several times, + or restarted on your side, then only the time of the last session is displayed + here. + """ + + transcoded_qualities: Optional[List[str]] = None + """Array of qualities to which live stream is transcoded""" + + transcoding_speed: Optional[float] = None + """Speed of transcoding the stream. Mainly it must be 1.0 for real-time processing. + + May be less than 1.0 if your stream has problems in delivery due to your local + internet provider's conditions, or the stream does not meet stream inbound + requirements. See Knowledge Base for details. + """ + + uri: Optional[str] = None + """ + When using PULL method, this is the URL to pull a stream from. You can specify + multiple addresses separated by a space (" "), so you can organize a backup + plan. In this case, the specified addresses will be selected one by one using + round robin scheduling. If the first address does not respond, then the next one + in the list will be automatically requested, returning to the first and so on in + a circle. Also, if the sucessfully working stream stops sending data, then the + next one will be selected according to the same scheme. After 24 hours of + inactivity of your streams we will stop PULL-ing, and will switch "active" field + to "false". Please, note that this field is for PULL only, so is not suitable + for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + """ + + video_height: Optional[float] = None + """Current height of frame of the original stream, if stream is transcoding""" + + video_width: Optional[float] = None + """Current width of frame of the original stream, if stream is transcoding""" diff --git a/src/gcore/types/streaming/stream_create_clip_params.py b/src/gcore/types/streaming/stream_create_clip_params.py new file mode 100644 index 00000000..345d35b2 --- /dev/null +++ b/src/gcore/types/streaming/stream_create_clip_params.py @@ -0,0 +1,48 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["StreamCreateClipParams"] + + +class StreamCreateClipParams(TypedDict, total=False): + duration: Required[int] + """ + Requested segment duration in seconds to be cut. Please, note that cutting is + based on the idea of instantly creating a clip, instead of precise timing. So + final segment may be: + + - Less than the specified value if there is less data in the DVR than the + requested segment. + - Greater than the specified value, because segment is aligned to the first and + last key frames of already stored fragment in DVR, this way -1 and +1 chunks + can be added to left and right. Duration of cutted segment cannot be greater + than DVR duration for this stream. Therefore, to change the maximum, use + "`dvr_duration`" parameter of this stream. + """ + + expiration: int + """ + Expire time of the clip via a public link. Unix timestamp in seconds, absolute + value. This is the time how long the instant clip will be stored in the server + memory and can be accessed via public HLS/MP4 links. Download and/or use the + instant clip before this time expires. After the time has expired, the clip is + deleted from memory and is no longer available via the link. You need to create + a new segment, or use `vod_required: true` attribute. If value is omitted, then + expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. + `unix timestamp = + + 3600`). Allowed range: 1m <= expiration <= 4h. Example: + `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` + """ + + start: int + """ + Starting point of the segment to cut. Unix timestamp in seconds, absolute value. + Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value + from the past is specified, it is used as the starting point for the segment to + cut. If the value is omitted, then clip will start from now. + """ + + vod_required: bool + """Indicates if video needs to be stored also as permanent VOD""" diff --git a/src/gcore/types/streaming/stream_create_params.py b/src/gcore/types/streaming/stream_create_params.py new file mode 100644 index 00000000..827874ce --- /dev/null +++ b/src/gcore/types/streaming/stream_create_params.py @@ -0,0 +1,165 @@ +# 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, Required, TypedDict + +__all__ = ["StreamCreateParams"] + + +class StreamCreateParams(TypedDict, total=False): + name: Required[str] + """ + Stream name. Often used as a human-readable name for the stream, but can contain + any text you wish. The values are not unique and may be repeated. Examples: + + - Conference in July + - Stream #10003 + - Open-Air Camera #31 Backstage + - 480fd499-2de2-4988-bc1a-a4eebe9818ee + """ + + active: bool + """Stream switch between on and off. + + This is not an indicator of the status "stream is receiving and it is LIVE", but + rather an on/off switch. When stream is switched off, there is no way to process + it: PULL is deactivated and PUSH will return an error. + + - true – stream can be processed + - false – stream is off, and cannot be processed + """ + + auto_record: bool + """Enables autotomatic recording of the stream when it started. + + So you don't need to call recording manually. Result of recording is + automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base Values: + + - true – auto recording is enabled + - false – auto recording is disabled + """ + + broadcast_ids: Iterable[int] + """IDs of broadcasts which will include this stream""" + + cdn_id: int + """ + ID of custom CDN resource from which the content will be delivered (only if you + know what you do) + """ + + client_entity_data: str + """ + Custom meta field designed to store your own extra information about a video + entity: video source, video id, parameters, etc. We do not use this field in any + way when processing the stream. You can store any data in any format (string, + json, etc), saved as a text string. Example: + `` client_entity_data = '{ "`seq_id`": "1234567890", "name": "John Doe", "iat": 1516239022 }' `` + """ + + client_user_id: int + """Custom meta field for storing the Identifier in your system. + + We do not use this field in any way when processing the stream. Example: + `client_user_id = 1001` + """ + + dvr_duration: int + """DVR duration in seconds if DVR feature is enabled for the stream. + + So this is duration of how far the user can rewind the live stream. + `dvr_duration` range is [30...14400]. Maximum value is 4 hours = 14400 seconds. + If you need more, ask the Support Team please. + """ + + dvr_enabled: bool + """Enables DVR for the stream: + + - true – DVR is enabled + - false – DVR is disabled + """ + + hls_mpegts_endlist_tag: bool + """ + Add `#EXT-X-ENDLIST` tag within .m3u8 playlist after the last segment of a live + stream when broadcast is ended. + """ + + html_overlay: bool + """ + Switch on mode to insert and display real-time HTML overlay widgets on top of + live streams + """ + + low_latency_enabled: bool + """ + Deprecated, always returns "true". The only exception is that the attribute can + only be used by clients that have previously used the old stream format. This + method is outdated since we've made it easier to manage streams. For your + convenience, you no longer need to set this parameter at the stage of creating a + stream. Now all streams are prepared in 2 formats simultaniously: Low Latency + and Legacy. You can get the desired output format in the attributes + "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. + + --- + + Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the + "`hls_mpegts_url`" attribute instead. + """ + + projection: Literal["regular", "vr360", "vr180", "vr360tb"] + """ + Visualization mode for 360° streams, how the stream is rendered in our web + player ONLY. If you would like to show video 360° in an external video player, + then use parameters of that video player. Modes: + + - regular – regular “flat” stream + - vr360 – display stream in 360° mode + - vr180 – display stream in 180° mode + - vr360tb – display stream in 3D 360° mode Top-Bottom + """ + + pull: bool + """Indicates if stream is pulled from external server or not. + + Has two possible values: + + - true – stream is received by PULL method. Use this when need to get stream + from external server by srt, rtmp\\ss, hls, dash, etc protocols. + - false – stream is received by PUSH method. Use this when need to send stream + from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + """ + + quality_set_id: int + """ + Custom quality set ID for transcoding, if transcoding is required according to + your conditions. Look at GET /`quality_sets` method + """ + + record_type: Literal["origin", "transcoded"] + """Method of recording a stream. + + Specifies the source from which the stream will be recorded: original or + transcoded. Types: + + - "origin" – To record RMTP/SRT/etc original clean media source. + - "transcoded" – To record the output transcoded version of the stream, + including overlays, texts, logos, etc. additional media layers. + """ + + uri: str + """ + When using PULL method, this is the URL to pull a stream from. You can specify + multiple addresses separated by a space (" "), so you can organize a backup + plan. In this case, the specified addresses will be selected one by one using + round robin scheduling. If the first address does not respond, then the next one + in the list will be automatically requested, returning to the first and so on in + a circle. Also, if the sucessfully working stream stops sending data, then the + next one will be selected according to the same scheme. After 24 hours of + inactivity of your streams we will stop PULL-ing, and will switch "active" field + to "false". Please, note that this field is for PULL only, so is not suitable + for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + """ diff --git a/src/gcore/types/streaming/stream_list_clips_response.py b/src/gcore/types/streaming/stream_list_clips_response.py new file mode 100644 index 00000000..851546a7 --- /dev/null +++ b/src/gcore/types/streaming/stream_list_clips_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .clip import Clip + +__all__ = ["StreamListClipsResponse"] + +StreamListClipsResponse: TypeAlias = List[Clip] diff --git a/src/gcore/types/streaming/stream_list_params.py b/src/gcore/types/streaming/stream_list_params.py new file mode 100644 index 00000000..b0aa4a67 --- /dev/null +++ b/src/gcore/types/streaming/stream_list_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_extensions import TypedDict + +__all__ = ["StreamListParams"] + + +class StreamListParams(TypedDict, total=False): + page: int + """Query parameter. Use it to list the paginated content""" + + with_broadcasts: int + """Query parameter. + + Set to 1 to get details of the broadcasts associated with the stream + """ diff --git a/src/gcore/types/streaming/stream_series.py b/src/gcore/types/streaming/stream_series.py new file mode 100644 index 00000000..0d941224 --- /dev/null +++ b/src/gcore/types/streaming/stream_series.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["StreamSeries", "StreamSeryItem", "StreamSeryItemMetrics"] + + +class StreamSeryItemMetrics(BaseModel): + streams: List[int] + + +class StreamSeryItem(BaseModel): + client: int + + metrics: StreamSeryItemMetrics + + +StreamSeries: TypeAlias = List[StreamSeryItem] diff --git a/src/gcore/types/streaming/stream_start_recording_response.py b/src/gcore/types/streaming/stream_start_recording_response.py new file mode 100644 index 00000000..3bf41ac0 --- /dev/null +++ b/src/gcore/types/streaming/stream_start_recording_response.py @@ -0,0 +1,76 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = [ + "StreamStartRecordingResponse", + "Data", + "DataStream", + "DataStreamClient", + "Warning", + "WarningMeta", + "WarningSourceObject", +] + + +class DataStreamClient(BaseModel): + id: Optional[int] = None + """Client ID""" + + storage_limit_mb: Optional[int] = None + """Current storage limit for client by megabytes""" + + storage_usage_mb: Optional[float] = None + """Current storage usage for client by megabytes""" + + +class DataStream(BaseModel): + id: Optional[int] = None + """Stream ID""" + + client: Optional[DataStreamClient] = None + + +class Data(BaseModel): + stream: Optional[DataStream] = None + + +class WarningMeta(BaseModel): + storage_limit_mb: Optional[int] = None + """Current storage limit for client by megabytes""" + + storage_usage_mb: Optional[float] = None + """Current storage usage for client by megabytes""" + + +class WarningSourceObject(BaseModel): + id: Optional[int] = None + """Client ID""" + + type: Optional[Literal["client"]] = None + """Object type (class)""" + + +class Warning(BaseModel): + key: Optional[Literal["client_storage_almost_exceeded"]] = None + """current warning key""" + + meta: Optional[WarningMeta] = None + """storage usage state for client""" + + source_object: Optional[WarningSourceObject] = None + """Warning source object""" + + +class StreamStartRecordingResponse(BaseModel): + data: Optional[Data] = None + """Stream data""" + + errors: Optional[List[object]] = None + """List of errors received on attempt to start recording process""" + + warnings: Optional[List[Warning]] = None + """List of warnings received on starting recording process""" diff --git a/src/gcore/types/streaming/stream_update_params.py b/src/gcore/types/streaming/stream_update_params.py new file mode 100644 index 00000000..55a3430f --- /dev/null +++ b/src/gcore/types/streaming/stream_update_params.py @@ -0,0 +1,169 @@ +# 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, Required, TypedDict + +__all__ = ["StreamUpdateParams", "Stream"] + + +class StreamUpdateParams(TypedDict, total=False): + stream: Stream + + +class Stream(TypedDict, total=False): + name: Required[str] + """ + Stream name. Often used as a human-readable name for the stream, but can contain + any text you wish. The values are not unique and may be repeated. Examples: + + - Conference in July + - Stream #10003 + - Open-Air Camera #31 Backstage + - 480fd499-2de2-4988-bc1a-a4eebe9818ee + """ + + active: bool + """Stream switch between on and off. + + This is not an indicator of the status "stream is receiving and it is LIVE", but + rather an on/off switch. When stream is switched off, there is no way to process + it: PULL is deactivated and PUSH will return an error. + + - true – stream can be processed + - false – stream is off, and cannot be processed + """ + + auto_record: bool + """Enables autotomatic recording of the stream when it started. + + So you don't need to call recording manually. Result of recording is + automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base Values: + + - true – auto recording is enabled + - false – auto recording is disabled + """ + + broadcast_ids: Iterable[int] + """IDs of broadcasts which will include this stream""" + + cdn_id: int + """ + ID of custom CDN resource from which the content will be delivered (only if you + know what you do) + """ + + client_entity_data: str + """ + Custom meta field designed to store your own extra information about a video + entity: video source, video id, parameters, etc. We do not use this field in any + way when processing the stream. You can store any data in any format (string, + json, etc), saved as a text string. Example: + `` client_entity_data = '{ "`seq_id`": "1234567890", "name": "John Doe", "iat": 1516239022 }' `` + """ + + client_user_id: int + """Custom meta field for storing the Identifier in your system. + + We do not use this field in any way when processing the stream. Example: + `client_user_id = 1001` + """ + + dvr_duration: int + """DVR duration in seconds if DVR feature is enabled for the stream. + + So this is duration of how far the user can rewind the live stream. + `dvr_duration` range is [30...14400]. Maximum value is 4 hours = 14400 seconds. + If you need more, ask the Support Team please. + """ + + dvr_enabled: bool + """Enables DVR for the stream: + + - true – DVR is enabled + - false – DVR is disabled + """ + + hls_mpegts_endlist_tag: bool + """ + Add `#EXT-X-ENDLIST` tag within .m3u8 playlist after the last segment of a live + stream when broadcast is ended. + """ + + html_overlay: bool + """ + Switch on mode to insert and display real-time HTML overlay widgets on top of + live streams + """ + + low_latency_enabled: bool + """ + Deprecated, always returns "true". The only exception is that the attribute can + only be used by clients that have previously used the old stream format. This + method is outdated since we've made it easier to manage streams. For your + convenience, you no longer need to set this parameter at the stage of creating a + stream. Now all streams are prepared in 2 formats simultaniously: Low Latency + and Legacy. You can get the desired output format in the attributes + "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. + + --- + + Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the + "`hls_mpegts_url`" attribute instead. + """ + + projection: Literal["regular", "vr360", "vr180", "vr360tb"] + """ + Visualization mode for 360° streams, how the stream is rendered in our web + player ONLY. If you would like to show video 360° in an external video player, + then use parameters of that video player. Modes: + + - regular – regular “flat” stream + - vr360 – display stream in 360° mode + - vr180 – display stream in 180° mode + - vr360tb – display stream in 3D 360° mode Top-Bottom + """ + + pull: bool + """Indicates if stream is pulled from external server or not. + + Has two possible values: + + - true – stream is received by PULL method. Use this when need to get stream + from external server by srt, rtmp\\ss, hls, dash, etc protocols. + - false – stream is received by PUSH method. Use this when need to send stream + from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + """ + + quality_set_id: int + """ + Custom quality set ID for transcoding, if transcoding is required according to + your conditions. Look at GET /`quality_sets` method + """ + + record_type: Literal["origin", "transcoded"] + """Method of recording a stream. + + Specifies the source from which the stream will be recorded: original or + transcoded. Types: + + - "origin" – To record RMTP/SRT/etc original clean media source. + - "transcoded" – To record the output transcoded version of the stream, + including overlays, texts, logos, etc. additional media layers. + """ + + uri: str + """ + When using PULL method, this is the URL to pull a stream from. You can specify + multiple addresses separated by a space (" "), so you can organize a backup + plan. In this case, the specified addresses will be selected one by one using + round robin scheduling. If the first address does not respond, then the next one + in the list will be automatically requested, returning to the first and so on in + a circle. Also, if the sucessfully working stream stops sending data, then the + next one will be selected according to the same scheme. After 24 hours of + inactivity of your streams we will stop PULL-ing, and will switch "active" field + to "false". Please, note that this field is for PULL only, so is not suitable + for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + """ diff --git a/src/gcore/types/streaming/streams/__init__.py b/src/gcore/types/streaming/streams/__init__.py new file mode 100644 index 00000000..e5f7a9b0 --- /dev/null +++ b/src/gcore/types/streaming/streams/__init__.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .overlay import Overlay as Overlay +from .overlay_create_params import OverlayCreateParams as OverlayCreateParams +from .overlay_list_response import OverlayListResponse as OverlayListResponse +from .overlay_update_params import OverlayUpdateParams as OverlayUpdateParams +from .overlay_create_response import OverlayCreateResponse as OverlayCreateResponse +from .overlay_update_multiple_params import OverlayUpdateMultipleParams as OverlayUpdateMultipleParams +from .overlay_update_multiple_response import OverlayUpdateMultipleResponse as OverlayUpdateMultipleResponse diff --git a/src/gcore/types/streaming/streams/overlay.py b/src/gcore/types/streaming/streams/overlay.py new file mode 100644 index 00000000..37f36798 --- /dev/null +++ b/src/gcore/types/streaming/streams/overlay.py @@ -0,0 +1,43 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["Overlay"] + + +class Overlay(BaseModel): + id: int + """ID of the overlay""" + + created_at: str + """Datetime of creation in ISO 8601""" + + stream_id: int + """ID of a stream to which it is attached""" + + updated_at: str + """Datetime of last update in ISO 8601""" + + url: str + """Valid http/https URL to an HTML page/widget""" + + height: Optional[int] = None + """Height of the widget""" + + stretch: Optional[bool] = None + """Switch of auto scaling the widget. + + Must not be used as "true" simultaneously with the coordinate installation + method (w, h, x, y). + """ + + width: Optional[int] = None + """Width of the widget""" + + x: Optional[int] = None + """Coordinate of left upper corner""" + + y: Optional[int] = None + """Coordinate of left upper corner""" diff --git a/src/gcore/types/streaming/streams/overlay_create_params.py b/src/gcore/types/streaming/streams/overlay_create_params.py new file mode 100644 index 00000000..55614169 --- /dev/null +++ b/src/gcore/types/streaming/streams/overlay_create_params.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["OverlayCreateParams", "Body"] + + +class OverlayCreateParams(TypedDict, total=False): + body: Iterable[Body] + + +class Body(TypedDict, total=False): + url: Required[str] + """Valid http/https URL to an HTML page/widget""" + + height: int + """Height of the widget""" + + stretch: bool + """Switch of auto scaling the widget. + + Must not be used as "true" simultaneously with the coordinate installation + method (w, h, x, y). + """ + + width: int + """Width of the widget""" + + x: int + """Coordinate of left upper corner""" + + y: int + """Coordinate of left upper corner""" diff --git a/src/gcore/types/streaming/streams/overlay_create_response.py b/src/gcore/types/streaming/streams/overlay_create_response.py new file mode 100644 index 00000000..02ccd9f1 --- /dev/null +++ b/src/gcore/types/streaming/streams/overlay_create_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .overlay import Overlay + +__all__ = ["OverlayCreateResponse"] + +OverlayCreateResponse: TypeAlias = List[Overlay] diff --git a/src/gcore/types/streaming/streams/overlay_list_response.py b/src/gcore/types/streaming/streams/overlay_list_response.py new file mode 100644 index 00000000..e6dffcfb --- /dev/null +++ b/src/gcore/types/streaming/streams/overlay_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .overlay import Overlay + +__all__ = ["OverlayListResponse"] + +OverlayListResponse: TypeAlias = List[Overlay] diff --git a/src/gcore/types/streaming/streams/overlay_update_multiple_params.py b/src/gcore/types/streaming/streams/overlay_update_multiple_params.py new file mode 100644 index 00000000..c14fa0fc --- /dev/null +++ b/src/gcore/types/streaming/streams/overlay_update_multiple_params.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["OverlayUpdateMultipleParams", "Body"] + + +class OverlayUpdateMultipleParams(TypedDict, total=False): + body: Iterable[Body] + + +class Body(TypedDict, total=False): + id: Required[int] + """ID of the overlay""" + + height: int + """Height of the widget""" + + stretch: bool + """Switch of auto scaling the widget. + + Must not be used as "true" simultaneously with the coordinate installation + method (w, h, x, y). + """ + + url: str + """Valid http/https URL to an HTML page/widget""" + + width: int + """Width of the widget""" + + x: int + """Coordinate of left upper corner""" + + y: int + """Coordinate of left upper corner""" diff --git a/src/gcore/types/streaming/streams/overlay_update_multiple_response.py b/src/gcore/types/streaming/streams/overlay_update_multiple_response.py new file mode 100644 index 00000000..f5c1b68b --- /dev/null +++ b/src/gcore/types/streaming/streams/overlay_update_multiple_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .overlay import Overlay + +__all__ = ["OverlayUpdateMultipleResponse"] + +OverlayUpdateMultipleResponse: TypeAlias = List[Overlay] diff --git a/src/gcore/types/streaming/streams/overlay_update_params.py b/src/gcore/types/streaming/streams/overlay_update_params.py new file mode 100644 index 00000000..524be0ba --- /dev/null +++ b/src/gcore/types/streaming/streams/overlay_update_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["OverlayUpdateParams"] + + +class OverlayUpdateParams(TypedDict, total=False): + stream_id: Required[int] + + height: int + """Height of the widget""" + + stretch: bool + """Switch of auto scaling the widget. + + Must not be used as "true" simultaneously with the coordinate installation + method (w, h, x, y). + """ + + url: str + """Valid http/https URL to an HTML page/widget""" + + width: int + """Width of the widget""" + + x: int + """Coordinate of left upper corner""" + + y: int + """Coordinate of left upper corner""" diff --git a/src/gcore/types/streaming/subtitle.py b/src/gcore/types/streaming/subtitle.py new file mode 100644 index 00000000..6d02a260 --- /dev/null +++ b/src/gcore/types/streaming/subtitle.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .subtitle_base import SubtitleBase + +__all__ = ["Subtitle"] + + +class Subtitle(SubtitleBase): + id: Optional[int] = None + """ID of subtitle file""" diff --git a/src/gcore/types/streaming/subtitle_base.py b/src/gcore/types/streaming/subtitle_base.py new file mode 100644 index 00000000..4feac312 --- /dev/null +++ b/src/gcore/types/streaming/subtitle_base.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["SubtitleBase"] + + +class SubtitleBase(BaseModel): + language: Optional[str] = None + """3-letter language code according to ISO-639-2 (bibliographic code)""" + + name: Optional[str] = None + """Name of subtitle file""" + + vtt: Optional[str] = None + """Full text of subtitles/captions, with escaped "\n" ("\r") symbol of new line""" diff --git a/src/gcore/types/streaming/subtitle_base_param.py b/src/gcore/types/streaming/subtitle_base_param.py new file mode 100644 index 00000000..e50022f2 --- /dev/null +++ b/src/gcore/types/streaming/subtitle_base_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_extensions import TypedDict + +__all__ = ["SubtitleBaseParam"] + + +class SubtitleBaseParam(TypedDict, total=False): + language: str + """3-letter language code according to ISO-639-2 (bibliographic code)""" + + name: str + """Name of subtitle file""" + + vtt: str + """Full text of subtitles/captions, with escaped "\n" ("\r") symbol of new line""" diff --git a/src/gcore/types/streaming/unique_viewers.py b/src/gcore/types/streaming/unique_viewers.py new file mode 100644 index 00000000..0d8549c0 --- /dev/null +++ b/src/gcore/types/streaming/unique_viewers.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["UniqueViewers", "Data"] + + +class Data(BaseModel): + date: str + + unique_ips: int + + id: Optional[int] = None + + browser: Optional[str] = None + + country: Optional[str] = None + + event: Optional[str] = None + + host: Optional[str] = None + + ip: Optional[str] = None + + os: Optional[str] = None + + platform: Optional[str] = None + + type: Optional[str] = None + + +class UniqueViewers(BaseModel): + data: Optional[List[Data]] = None diff --git a/src/gcore/types/streaming/unique_viewers_cdn.py b/src/gcore/types/streaming/unique_viewers_cdn.py new file mode 100644 index 00000000..a7afa0fe --- /dev/null +++ b/src/gcore/types/streaming/unique_viewers_cdn.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["UniqueViewersCdn", "Data"] + + +class Data(BaseModel): + type: str + + uniqs: int + + +class UniqueViewersCdn(BaseModel): + data: Optional[List[Data]] = None diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py new file mode 100644 index 00000000..cb2a3026 --- /dev/null +++ b/src/gcore/types/streaming/video.py @@ -0,0 +1,444 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Video", "ConvertedVideo"] + + +class ConvertedVideo(BaseModel): + id: Optional[int] = None + """ID of the converted file of the specific quality""" + + error: Optional[str] = None + """Video processing error text in this quality""" + + height: Optional[int] = None + """Height in pixels of the converted video file of the specific quality. + + Can be `null` for audio-only files. + """ + + mp4_url: Optional[str] = None + """ + A URL to a rendition file of the specified quality in MP4 format for + downloading. + + **Download methods** For each converted video, additional download endpoints are + available under `converted_videos`/`mp4_urls`. An MP4 download enpoints: + + - /videos/{`client_id`}\\__{slug}/{filename}.mp4 + - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download + - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download={`custom_filename`} The + first option returns the file as is. The following options respond with the + header that directly tells browsers to download the file instead of playing it + in the browser. + + ``` + Content-Disposition: attachment + ``` + + The third option allows you to set a custom name for the file being downloaded. + You can optionally specify a custom filename (just name excluding the .mp4 + extension) using the download= query. Filename Constraints + + - Length: 1-255 characters + - Must NOT include the .mp4 extension (it is added automatically) + - Allowed characters: a-z, A-Z, 0-9, \\__(underscore), -(dash), .(dot) + - First character cannot be .(dot) Example valid filenames: `holiday2025`, + `_backup.final`, `clip-v1.2` + + **Default MP4 file name structure** Link to the file {filename} contains + information about the encoding method using format: `___.mp4` + + - ```– Internal quality identifier and file version. Please do not use it, can be changed at any time without any notice. + + ``` + - ```– Codec name that was used to encode the video, or audio codec if it is an audio-only file. + + ``` + - ```– Encoding bitrate in Kbps. + + ``` + - ````– Video height, or word "audio" if it is an audio-only file. + Note that this link format has been applied since 14.08.2024. If the video entity was uploaded earlier, links may have old simplified format. + Example: ``` /videos/{`client_id`}_{slug}/`qid3567v1_h264_4050_1080`.mp4 ``` + + ```` + + **Dynamic speed limiting** This mode sets different limits for different users + or for different types of content. The speed is adjusted based on requests with + the “speed” and “buffer” arguments. Example: `?speed=50k&buffer=500k` Read more + in Product Documentation in CDN section "Network limits". + + **Secure token authentication (updated)** Access to MP4 download links can be + protected using secure tokens passed as query parameters. The token generation + logic has been updated to allow fine-grained protection per file and bitrate. + Token generation uses the entire MP4 path, which ensures the token only grants + access to a specific quality/version of the video. This prevents unintended + access to other bitrate versions of an ABR stream. Token Query Parameters: + + - token: The generated hash + - expires: Expiration timestamp + - speed: (optional) Speed limit in bytes/sec, or empty string + - buffer: (optional) Buffer size in bytes, or empty string Optional (for + IP-bound tokens): + - ip: The user’s IP address Example: + `?md5=QX39c77lbQKvYgMMAvpyMQ&expires=1743167062` Read more in Product + Documentation in Streaming section "Protected temporarily link". + + **Examples** + + - Audio-only: + `` https://demo-public.gvideo.io/videos/`2675_JNnccG5l97XPxsov`/`qid3585v1_aac_128_audio`.mp4 `` + - Video: + `` https://demo-public.gvideo.io/videos/`2675_3MlggU4xDb1Ssa5Y`/`qid3567v1_h264_4050_1080`.mp4/download `` + - Video with custom download filename: + `` https://demo-public.gvideo.io/videos/`2675_XtMKxzJM6Xt7SBUV`/1080.mp4/download=`highlights_v1`.`1_2025`-05-30 `` + """ + + name: Optional[str] = None + """Specific quality name""" + + progress: Optional[int] = None + """Status of transcoding into the specific quality, from 0 to 100""" + + size: Optional[int] = None + """Size in bytes of the converted file of the specific quality. + + Can be `null` until transcoding is fully completed. + """ + + status: Optional[Literal["processing", "complete", "error"]] = None + """Status of transcoding: + + - processing – video is being transcoded to this quality, + - complete – quality is fully processed, + - error – quality processing error, see parameter "error". + """ + + width: Optional[int] = None + """Width in pixels of the converted video file of the specified quality. + + Can be `null` for audio files. + """ + + +class Video(BaseModel): + id: Optional[int] = None + """Video ID""" + + ad_id: Optional[int] = None + """ID of ad that should be shown. + + If empty the default ad is show. If there is no default ad, no ad is shownю + """ + + cdn_views: Optional[int] = None + """Total number of video views. + + It is calculated based on the analysis of all views, no matter in which player. + """ + + client_id: Optional[int] = None + """Client ID""" + + client_user_id: Optional[int] = None + """Custom meta field for storing the Identifier in your system. + + We do not use this field in any way when processing the stream. Example: + `client_user_id = 1001` + """ + + converted_videos: Optional[List[ConvertedVideo]] = None + """Array of data about each transcoded quality""" + + custom_iframe_url: Optional[str] = None + """Custom URL of Iframe for video player to be used in share panel in player. + + Auto generated Iframe URL provided by default. + """ + + dash_url: Optional[str] = None + """ + A URL to a master playlist MPEG-DASH (master.mpd) with CMAF or WebM based + chunks. Chunk type will be selected automatically for each quality: + + - CMAF for H264 and H265 codecs. + - WebM for AV1 codec. + + This URL is a link to the main manifest. But you can also manually specify + suffix-options that will allow you to change the manifest to your request: + `` /videos/{`client_id`}_{slug}/master[-min-N][-max-N][-(h264|hevc|av1)].mpd `` + List of suffix-options: + + - [-min-N] – ABR soft limitation of qualities from below. + - [-max-N] – ABR soft limitation of qualities from above. + - [-(h264|hevc|av1) – Video codec soft limitation. Applicable if the video was + transcoded into multiple codecs H264, H265 and AV1 at once, but you want to + return just 1 video codec in a manifest. Read the Product Documentation for + details. Read more what is ABR soft-limiting in the "`hls_url`" field above. + + Caution. Solely master.mpd is officially documented and intended for your use. + Any additional internal manifests, sub-manifests, parameters, chunk names, file + extensions, and related components are internal infrastructure entities. These + may undergo modifications without prior notice, in any manner or form. It is + strongly advised not to store them in your database or cache them on your end. + """ + + description: Optional[str] = None + """Additional text field for video description""" + + duration: Optional[int] = None + """Video duration in milliseconds. + + May differ from "`origin_video_duration`" value if the video was uploaded with + clipping through the parameters "`clip_start_seconds`" and + "`clip_duration_seconds`" + """ + + error: Optional[str] = None + """Video processing error text will be saved here if "status: error" """ + + hls_cmaf_url: Optional[str] = None + """A URL to a master playlist HLS (master-cmaf.m3u8) with CMAF-based chunks. + + Chunks are in fMP4 container. It's a code-agnostic container, which allows to + use any like H264, H265, AV1, etc. + + It is possible to use the same suffix-options as described in the "`hls_url`" + attribute. + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + """ + + hls_url: Optional[str] = None + """ + 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 + Apple does not support these codecs over MPEG TS, and they are not + standardized in TS-container). + + You can also manually specify suffix-options that will allow you to change the + manifest to your request: + `` /videos/{`client_id`}_{`video_slug`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + List of suffix-options: + + - [-cmaf] – getting HLS CMAF version of the manifest. Look at the `hls_cmaf_url` + field. + - [-min-N] – ABR soft limitation of qualities from below. + - [-max-N] – ABR soft limitation of qualities from above. + - [-img] – Roku trick play: to add tiles directly into .m3u8 manifest. Read the + Product Documentation for details. + - [-(h264|hevc|av1) – Video codec soft limitation. Applicable if the video was + transcoded into multiple codecs H264, H265 and AV1 at once, but you want to + return just 1 video codec in a manifest. Read the Product Documentation for + details. ABR soft-limiting: Soft limitation of the list of qualities allows + you to return not the entire list of transcoded qualities for a video, but + only those you need. For more details look at the Product Documentation. For + example, the video is available in 7 qualities from 360p to 4K, but you want + to return not more than 480p only due to the conditions of distribution of + content to a specific end-user (i.e. free account): + - 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` + + Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented + and intended for your use. Any additional internal manifests, sub-manifests, + parameters, chunk names, file extensions, and related components are internal + infrastructure entities. These may undergo modifications without prior notice, + in any manner or form. It is strongly advised not to store them in your database + or cache them on your end. + """ + + iframe_url: Optional[str] = None + """A URL to a built-in HTML video player with the video inside. + + It can be inserted into an iframe on your website and the video will + automatically play in all browsers. The player can be opened or shared via this + direct link. Also the video player can be integrated into your web pages using + the Iframe tag. Example of usage on a web page: + + + + There are some link modificators you can specify and add manually: + - ?`no_low_latency` – player is forced to use non-low-latency streams HLS MPEG TS, instead of MPEG-DASH CMAF or HLS/LL-HLS CMAF. + - ?t=(integer) – time to start playback from specified point in the video. Applicable for VOD only. + - ?`sub_lang`=(language) – force subtitles to specific language (2 letters ISO 639 code of a language). + - Read more in the Product Documentation. + """ + + name: Optional[str] = None + """ + Title of the video. Often used as a human-readable name of the video, but can + contain any text you wish. The values are not unique and may be repeated. + Examples: + + - Educational training 2024-03-29 + - Series X S3E14, The empire strikes back + - 480fd499-2de2-4988-bc1a-a4eebe9818ee + """ + + origin_size: Optional[int] = None + """Size of original file""" + + origin_url: Optional[str] = None + """ + URL to an original file from which the information for transcoding was taken. + May contain a link for scenarios: + + - If the video was downloaded from another origin + - If the video is a recording of a live stream + - Otherwise it is "null" **Copy from another server** URL to an original file + that was downloaded. Look at method "Copy from another server" in POST + /videos. **Recording of an original live stream** URL to the original + non-transcoded stream recording with original quality, saved in MP4 format. + File is created immediately after the completion of the stream recording. The + stream from which the recording was made is reflected in "`stream_id`" field. + Can be used for internal operations when a recording needs to be received + faster than the transcoded versions are ready. But this version is not + intended for public distribution. Views and downloads occur in the usual way, + like viewing an MP4 rendition. The MP4 file becomes available for downloading + when the video entity "status" changes from "new" to "pending". The file is + stored for 7 days, after which it will be automatically deleted. Format of URL + is `` /videos/_/`origin__`.mp4 `` Where: + - ```– Encoding bitrate in Kbps. + + ``` + - ```– Video height. + This is a premium feature, available only upon request through your manager or support team. + ``` + """ + + origin_video_duration: Optional[int] = None + """Original video duration in milliseconds""" + + poster: Optional[str] = None + """ + Poster is your own static image which can be displayed before the video begins + playing. This is often a frame of the video or a custom title screen. Field + contains a link to your own uploaded image. Also look at "screenshot" attribute. + """ + + poster_thumb: Optional[str] = None + """Field contains a link to minimized poster image. + + Original "poster" image is proportionally scaled to a size of 200 pixels in + height. + """ + + projection: Optional[str] = None + """Regulates the video format: + + - **regular** — plays the video as usual + - **vr360** — plays the video in 360 degree mode + - **vr180** — plays the video in 180 degree mode + - **vr360tb** — plays the video in 3D 360 degree mode Top-Bottom. + + Default is regular + """ + + recording_started_at: Optional[str] = None + """ + If the video was saved from a stream, then start time of the stream recording is + saved here. Format is date time in ISO 8601 + """ + + screenshot: Optional[str] = None + """A URL to the default screenshot is here. + + The image is selected from an array of all screenshots based on the + “`screenshot_id`” attribute. If you use your own "poster", the link to it will + be here too. Our video player uses this field to display the static image before + the video starts playing. As soon as the user hits "play" the image will go + away. If you use your own external video player, then you can use the value of + this field to set the poster/thumbnail in your player. Example: + + - `video_js`.poster: `api.screenshot` + - clappr.poster: `api.screenshot` + """ + + screenshot_id: Optional[int] = None + """ + ID of auto generated screenshots to be used for default screenshot. Counting + from 0. A value of -1 sets the "screenshot" attribute to the URL of your own + image from the "poster" attribute. + """ + + screenshots: Optional[List[str]] = None + """Array of auto generated screenshots from the video. + + By default 5 static screenshots are taken from different places in the video. If + the video is short, there may be fewer screenshots. Screenshots are created + automatically, so they may contain not very good frames from the video. To use + your own image look at "poster" attribute. + """ + + share_url: Optional[str] = None + """ + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled + """ + + slug: Optional[str] = None + """ + A unique alphanumeric identifier used in public URLs to retrieve and view the + video. It is unique for each video, generated randomly and set automatically by + the system. Format of usage in URL is \\**.../videos/{`client_id`}\\__{slug}/...\\** + Example: + + - Player: /videos/`12345_neAq1bYZ2` + - Manifest: /videos/`12345_neAq1bYZ2`/master.m3u8 + - Rendition: /videos/`12345_neAq1bYZ2`/`qid90v1_720`.mp4 + """ + + sprite: Optional[str] = None + """Link to picture with video storyboard. + + Image in JPG format. The picture is a set of rectangles with frames from the + video. Typically storyboard is used to show preview images when hovering the + video's timeline. + """ + + sprite_vtt: Optional[str] = None + """Storyboard in VTT format. + + This format implies an explicit indication of the timing and frame area from a + large sprite image. + """ + + status: Optional[Literal["empty", "pending", "viewable", "ready", "error"]] = None + """Video processing status: + + - empty – initial status, when video-entity is created, but video-file has not + yet been fully uploaded (TUS uploading, or downloading from an origin is not + finished yet) + - pending – video is in queue to be processed + - viewable – video has at least 1 quality and can already be viewed via a link, + but not all qualities are ready yet + - ready – video is completely ready, available for viewing with all qualities + - error – error while processing a video, look at "error" field + """ + + stream_id: Optional[int] = None + """If the video was saved from a stream, then ID of that stream is saved here""" + + views: Optional[int] = None + """ + Number of video views through the built-in HTML video player of the Streaming + Platform only. This attribute does not count views from other external players + and native OS players, so here may be less number of views than in + "`cdn_views`". + """ diff --git a/src/gcore/types/streaming/video_create_multiple_params.py b/src/gcore/types/streaming/video_create_multiple_params.py new file mode 100644 index 00000000..dd5662a5 --- /dev/null +++ b/src/gcore/types/streaming/video_create_multiple_params.py @@ -0,0 +1,28 @@ +# 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 .create_video_param import CreateVideoParam +from .subtitle_base_param import SubtitleBaseParam + +__all__ = ["VideoCreateMultipleParams", "Video"] + + +class VideoCreateMultipleParams(TypedDict, total=False): + fields: str + """ + Restriction to return only the specified attributes, instead of the entire + dataset. Specify, if you need to get short response. The following fields are + available for specifying: id, name, duration, status, `created_at`, + `updated_at`, `hls_url`, screenshots, `converted_videos`, priority. Example, + ?fields=id,name,`hls_url` + """ + + videos: Iterable[Video] + + +class Video(CreateVideoParam, total=False): + subtitles: Iterable[SubtitleBaseParam] diff --git a/src/gcore/types/streaming/video_create_multiple_response.py b/src/gcore/types/streaming/video_create_multiple_response.py new file mode 100644 index 00000000..e7a82f6c --- /dev/null +++ b/src/gcore/types/streaming/video_create_multiple_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .video import Video + +__all__ = ["VideoCreateMultipleResponse"] + +VideoCreateMultipleResponse: TypeAlias = List[Video] diff --git a/src/gcore/types/streaming/video_create_params.py b/src/gcore/types/streaming/video_create_params.py new file mode 100644 index 00000000..9eab6618 --- /dev/null +++ b/src/gcore/types/streaming/video_create_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from .create_video_param import CreateVideoParam + +__all__ = ["VideoCreateParams"] + + +class VideoCreateParams(TypedDict, total=False): + video: CreateVideoParam diff --git a/src/gcore/types/streaming/video_create_response.py b/src/gcore/types/streaming/video_create_response.py new file mode 100644 index 00000000..0423bc69 --- /dev/null +++ b/src/gcore/types/streaming/video_create_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .video import Video + +__all__ = ["VideoCreateResponse"] + +VideoCreateResponse: TypeAlias = List[Video] diff --git a/src/gcore/types/streaming/video_list_names_params.py b/src/gcore/types/streaming/video_list_names_params.py new file mode 100644 index 00000000..918f5050 --- /dev/null +++ b/src/gcore/types/streaming/video_list_names_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import TypedDict + +__all__ = ["VideoListNamesParams"] + + +class VideoListNamesParams(TypedDict, total=False): + ids: Iterable[int] + """Comma-separated set of video IDs. Example, ?ids=7,17""" diff --git a/src/gcore/types/streaming/video_list_params.py b/src/gcore/types/streaming/video_list_params.py new file mode 100644 index 00000000..2a7e4e9a --- /dev/null +++ b/src/gcore/types/streaming/video_list_params.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["VideoListParams"] + + +class VideoListParams(TypedDict, total=False): + id: str + """IDs of the videos to find. + + You can specify one or more identifiers separated by commas. Example, + ?id=1,101,1001 + """ + + client_user_id: int + """Find videos where "`client_user_id`" meta field is equal to the search value""" + + fields: str + """ + Restriction to return only the specified attributes, instead of the entire + dataset. Specify, if you need to get short response. The following fields are + available for specifying: id, name, duration, status, `created_at`, + `updated_at`, `hls_url`, screenshots, `converted_videos`, priority, `stream_id`. + Example, ?fields=id,name,`hls_url` + """ + + page: int + """Page number. Use it to list the paginated content""" + + per_page: int + """Items per page number. Use it to list the paginated content""" + + search: str + """Aggregated search condition. + + If set, the video list is filtered by one combined SQL criterion: + + - id={s} OR slug={s} OR name like {s} i.e. "/videos?search=1000" returns list of + videos where id=1000 or slug=1000 or name contains "1000". + """ + + status: str + """Use it to get videos filtered by their status. Possible values: + + - empty + - pending + - viewable + - ready + - error + """ + + stream_id: int + """ + Find videos recorded from a specific stream, so for which "`stream_id`" field is + equal to the search value + """ diff --git a/src/gcore/types/streaming/video_update_params.py b/src/gcore/types/streaming/video_update_params.py new file mode 100644 index 00000000..bdf6f4ec --- /dev/null +++ b/src/gcore/types/streaming/video_update_params.py @@ -0,0 +1,214 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["VideoUpdateParams"] + + +class VideoUpdateParams(TypedDict, total=False): + name: Required[str] + """Video name""" + + auto_transcribe_audio_language: Literal["disable", "auto", ""] + """Automatic creation of subtitles by transcribing the audio track. Values: + + - disable – Do not transcribe. + - auto – Automatically detects the activation of the option based on the + settings in your account. If generation is activated, then automatic language + detection while transcribing. + - \\ – Transcribe from specific language. Can be used to specify the exact + language spoken in the audio track, or when auto language detection fails. + Language is set by 3-letter language code according to ISO-639-2 + (bibliographic code). List of languages is available in `audio_language` + attribute of API POST /streaming/ai/transcribe . Example: + + ``` + `auto_transcribe_audio_language`: "auto" + `auto_transcribe_audio_language`: "ger" + ``` + + More details: + + - List of AI tasks – API + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/get-ai-task-result) + - Add subtitles to an exist video – API + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + """ + + auto_translate_subtitles_language: Literal["disable", "default", ""] + """Automatic translation of auto-transcribed subtitles to the specified + language(s). + + Can be used both together with `auto_transcribe_audio_language` option only. Use + it when you want to make automatic subtitles in languages other than the + original language in audio. Values: + + - disable – Do not translate. + - default – There are 3 default languages: eng,fre,ger + - \\ – Explicit language to translate to, or list of languages separated by a + comma. Look at list of available languages in description of AI ASR task + creation. If several languages are specified for translation, a separate + subtitle will be generated for each language. Example: + + ``` + `auto_translate_subtitles_language`: default + `auto_translate_subtitles_language`: eng,fre,ger + ``` + + Please note that subtitle translation is done separately and after + transcription. Thus separate AI-tasks are created for translation. + """ + + client_user_id: int + """Custom field where you can specify user ID in your system""" + + clip_duration_seconds: int + """ + The length of the trimmed segment to transcode, instead of the entire length of + the video. Is only used in conjunction with specifying the start of a segment. + Transcoding duration is a number in seconds. + """ + + clip_start_seconds: int + """ + If you want to transcode only a trimmed segment of a video instead of entire + length if the video, then you can provide timecodes of starting point and + duration of a segment to process. Start encoding from is a number in seconds. + """ + + custom_iframe_url: str + """ + Deprecated. Custom URL of IFrame for video player to be used in share panel in + player. Auto generated IFrame URL provided by default + """ + + description: str + """Video details; not visible to the end-users""" + + directory_id: int + """ID of the directory where the video should be uploaded. (beta)""" + + origin_http_headers: str + """Authorization HTTP request header. + + Will be used as credentials to authenticate a request to download a file + (specified in "`origin_url`" parameter) on an external server. Syntax: + `Authorization: ` Examples: + + - "`origin_http_headers`": "Authorization: Basic ..." + - "`origin_http_headers`": "Authorization: Bearer ..." + - "`origin_http_headers`": "Authorization: APIKey ..." Example of usage when + downloading a file from Google Drive: + + ``` + POST https://api.gcore.com/streaming/videos + "video": { + "name": "IBC 2024 intro.mp4", + "`origin_url`": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "`origin_http_headers`": "Authorization: Bearer ABC" + } + ``` + """ + + origin_url: str + """ + URL to an original file which you want to copy from external storage. If + specified, system will download the file and will use it as video source for + transcoding. + """ + + poster: str + """ + Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several + screenshots (they will be stored in "screenshots" attribute) from which you can + select an default screenshot. This "poster" field is for uploading your own + image. Also use attribute "`screenshot_id`" to select poster as a default + screnshot. Attribute accepts single image as base64-encoded string + [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In + format: `data:[];base64,` MIME-types are image/jpeg, image/webp, and image/png + and file sizes up to 1Mb. Examples: + + - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` + - `data:image/png;base64,iVBORw0KGg...ggg==` + - `data:image/webp;base64,UklGRt.../DgAAAAA` + """ + + priority: int + """ + Priority allows you to adjust the urgency of processing some videos before + others in your account, if your algorithm requires it. For example, when there + are very urgent video and some regular ones that can wait in the queue. Value + range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest + up-priority. Default priority is 0. + """ + + projection: str + """Deprecated. Regulates the video format: + + - **regular** — plays the video as usual + - **vr360** — plays the video in 360 degree mode + - **vr180** — plays the video in 180 degree mode + - **vr360tb** — plays the video in 3D 360 degree mode Top-Bottom. + + Default is regular + """ + + quality_set_id: int + """ + Custom quality set ID for transcoding, if transcoding is required according to + your conditions. Look at GET /`quality_sets` method + """ + + remote_poster_url: str + """ + Poster URL to download from external resource, instead of uploading via "poster" + attribute. It has the same restrictions as "poster" attribute. + """ + + remove_poster: bool + """Set it to true to remove poster""" + + screenshot_id: int + """ + Default screenshot index. Specify an ID from the "screenshots" array, so that + the URL of the required screenshot appears in the "screenshot" attribute as the + default screenshot. By default 5 static screenshots will be taken from different + places in the video after transcoding. If the video is short, there may be fewer + screenshots. Counting from 0. A value of -1 sets the default screenshot to the + URL of your own image from the "poster" attribute. Look at "screenshot" + attribute in GET /videos/{`video_id`} for details. + """ + + share_url: str + """ + Deprecated. Custom URL or iframe displayed in the link field when a user clicks + on a sharing button in player. If empty, the link field and social network + sharing is disabled + """ + + source_bitrate_limit: bool + """ + The option allows you to set the video transcoding rule so that the output + bitrate in ABR ladder is not exceeding the bitrate of the original video. + + This option is for advanced users only. + + By default `source_bitrate_limit: true` this option allows you to have the + output bitrate not more than in the original video, thus to transcode video + faster and to deliver it to end-viewers faster as well. At the same time, the + quality will be similar to the original. If for some reason you need more + byte-space in the output quality when encoding, you can set this option to + `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will + be raised from the bitrate of the original video to the maximum possible limit + specified in our the Product Documentation. For example, this may be needed + when: + + - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, + - to improve the picture quality on dynamic scenes, + - etc. The option is applied only at the video creation stage and cannot be + changed later. If you want to re-transcode the video using new value, then you + need to create and upload a new video only. + """ diff --git a/src/gcore/types/streaming/videos/__init__.py b/src/gcore/types/streaming/videos/__init__.py new file mode 100644 index 00000000..e89cb741 --- /dev/null +++ b/src/gcore/types/streaming/videos/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .subtitle_create_params import SubtitleCreateParams as SubtitleCreateParams +from .subtitle_list_response import SubtitleListResponse as SubtitleListResponse +from .subtitle_update_params import SubtitleUpdateParams as SubtitleUpdateParams diff --git a/src/gcore/types/streaming/videos/subtitle_create_params.py b/src/gcore/types/streaming/videos/subtitle_create_params.py new file mode 100644 index 00000000..7ce51724 --- /dev/null +++ b/src/gcore/types/streaming/videos/subtitle_create_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ..subtitle_base_param import SubtitleBaseParam + +__all__ = ["SubtitleCreateParams", "Body"] + + +class SubtitleCreateParams(TypedDict, total=False): + body: Required[Body] + + +class Body(SubtitleBaseParam, total=False): + pass diff --git a/src/gcore/types/streaming/videos/subtitle_list_response.py b/src/gcore/types/streaming/videos/subtitle_list_response.py new file mode 100644 index 00000000..bb683a29 --- /dev/null +++ b/src/gcore/types/streaming/videos/subtitle_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from ..subtitle import Subtitle + +__all__ = ["SubtitleListResponse"] + +SubtitleListResponse: TypeAlias = List[Subtitle] diff --git a/src/gcore/types/streaming/videos/subtitle_update_params.py b/src/gcore/types/streaming/videos/subtitle_update_params.py new file mode 100644 index 00000000..1806bfe7 --- /dev/null +++ b/src/gcore/types/streaming/videos/subtitle_update_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["SubtitleUpdateParams"] + + +class SubtitleUpdateParams(TypedDict, total=False): + video_id: Required[int] + + language: str + """3-letter language code according to ISO-639-2 (bibliographic code)""" + + name: str + """Name of subtitle file""" + + vtt: str + """Full text of subtitles/captions, with escaped "\n" ("\r") symbol of new line""" diff --git a/src/gcore/types/streaming/views.py b/src/gcore/types/streaming/views.py new file mode 100644 index 00000000..ed6b9f5d --- /dev/null +++ b/src/gcore/types/streaming/views.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["Views", "Data"] + + +class Data(BaseModel): + date: str + + type: str + + views: int + + id: Optional[int] = None + + browser: Optional[str] = None + + country: Optional[str] = None + + event: Optional[str] = None + + host: Optional[str] = None + + ip: Optional[str] = None + + os: Optional[str] = None + + platform: Optional[str] = None + + +class Views(BaseModel): + data: Optional[List[Data]] = None diff --git a/src/gcore/types/streaming/views_by_browser.py b/src/gcore/types/streaming/views_by_browser.py new file mode 100644 index 00000000..6c500eef --- /dev/null +++ b/src/gcore/types/streaming/views_by_browser.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["ViewsByBrowser", "Data"] + + +class Data(BaseModel): + browser: str + + views: int + + +class ViewsByBrowser(BaseModel): + data: Optional[List[Data]] = None diff --git a/src/gcore/types/streaming/views_by_country.py b/src/gcore/types/streaming/views_by_country.py new file mode 100644 index 00000000..32bfad49 --- /dev/null +++ b/src/gcore/types/streaming/views_by_country.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["ViewsByCountry", "Data"] + + +class Data(BaseModel): + country: str + + country_name: str + + views: int + + +class ViewsByCountry(BaseModel): + data: Optional[List[Data]] = None diff --git a/src/gcore/types/streaming/views_by_hostname.py b/src/gcore/types/streaming/views_by_hostname.py new file mode 100644 index 00000000..d71b9e95 --- /dev/null +++ b/src/gcore/types/streaming/views_by_hostname.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["ViewsByHostname", "Data"] + + +class Data(BaseModel): + host: str + + views: int + + +class ViewsByHostname(BaseModel): + data: Optional[List[Data]] = None diff --git a/src/gcore/types/streaming/views_by_operating_system.py b/src/gcore/types/streaming/views_by_operating_system.py new file mode 100644 index 00000000..4fce1e35 --- /dev/null +++ b/src/gcore/types/streaming/views_by_operating_system.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["ViewsByOperatingSystem", "Data"] + + +class Data(BaseModel): + os: str + + views: int + + +class ViewsByOperatingSystem(BaseModel): + data: Optional[List[Data]] = None diff --git a/src/gcore/types/streaming/views_by_referer.py b/src/gcore/types/streaming/views_by_referer.py new file mode 100644 index 00000000..0ba51d1a --- /dev/null +++ b/src/gcore/types/streaming/views_by_referer.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["ViewsByReferer", "Data"] + + +class Data(BaseModel): + embed_url: str + + views: int + + +class ViewsByReferer(BaseModel): + data: Optional[List[Data]] = None diff --git a/src/gcore/types/streaming/views_by_region.py b/src/gcore/types/streaming/views_by_region.py new file mode 100644 index 00000000..0a789153 --- /dev/null +++ b/src/gcore/types/streaming/views_by_region.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["ViewsByRegion", "Data"] + + +class Data(BaseModel): + region: str + + region_name: str + + views: int + + +class ViewsByRegion(BaseModel): + data: Optional[List[Data]] = None diff --git a/src/gcore/types/streaming/views_heatmap.py b/src/gcore/types/streaming/views_heatmap.py new file mode 100644 index 00000000..819d76bd --- /dev/null +++ b/src/gcore/types/streaming/views_heatmap.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["ViewsHeatmap", "Data"] + + +class Data(BaseModel): + viewers: int + + seconds: Optional[int] = None + + time: Optional[str] = None + + +class ViewsHeatmap(BaseModel): + data: Optional[List[Data]] = None diff --git a/src/gcore/types/streaming/vod_statistics_series.py b/src/gcore/types/streaming/vod_statistics_series.py new file mode 100644 index 00000000..2e82bbb3 --- /dev/null +++ b/src/gcore/types/streaming/vod_statistics_series.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["VodStatisticsSeries", "VodStatisticsSeryItem", "VodStatisticsSeryItemMetrics"] + + +class VodStatisticsSeryItemMetrics(BaseModel): + vod: List[int] + + +class VodStatisticsSeryItem(BaseModel): + client: int + + metrics: VodStatisticsSeryItemMetrics + + +VodStatisticsSeries: TypeAlias = List[VodStatisticsSeryItem] diff --git a/src/gcore/types/streaming/vod_total_stream_duration_series.py b/src/gcore/types/streaming/vod_total_stream_duration_series.py new file mode 100644 index 00000000..a938a1fe --- /dev/null +++ b/src/gcore/types/streaming/vod_total_stream_duration_series.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["VodTotalStreamDurationSeries", "VodTotalStreamDurationSeryItem"] + + +class VodTotalStreamDurationSeryItem(BaseModel): + client: int + + duration: int + """count of minutes""" + + client_user_id: Optional[int] = None + + stream_id: Optional[str] = None + + +VodTotalStreamDurationSeries: TypeAlias = List[VodTotalStreamDurationSeryItem] diff --git a/tests/api_resources/streaming/__init__.py b/tests/api_resources/streaming/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/streaming/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/streaming/streams/__init__.py b/tests/api_resources/streaming/streams/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/streaming/streams/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/streaming/streams/test_overlays.py b/tests/api_resources/streaming/streams/test_overlays.py new file mode 100644 index 00000000..dbf6f70c --- /dev/null +++ b/tests/api_resources/streaming/streams/test_overlays.py @@ -0,0 +1,517 @@ +# 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.streaming.streams import ( + Overlay, + OverlayListResponse, + OverlayCreateResponse, + OverlayUpdateMultipleResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestOverlays: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + overlay = client.streaming.streams.overlays.create( + stream_id=0, + ) + assert_matches_type(OverlayCreateResponse, overlay, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + overlay = client.streaming.streams.overlays.create( + stream_id=0, + body=[ + { + "url": "http://domain.com/myoverlay1.html", + "height": 40, + "stretch": False, + "width": 120, + "x": 30, + "y": 30, + } + ], + ) + assert_matches_type(OverlayCreateResponse, overlay, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.streaming.streams.overlays.with_raw_response.create( + stream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + overlay = response.parse() + assert_matches_type(OverlayCreateResponse, overlay, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.streaming.streams.overlays.with_streaming_response.create( + stream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + overlay = response.parse() + assert_matches_type(OverlayCreateResponse, overlay, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + overlay = client.streaming.streams.overlays.update( + overlay_id=0, + stream_id=0, + ) + assert_matches_type(Overlay, overlay, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + overlay = client.streaming.streams.overlays.update( + overlay_id=0, + stream_id=0, + height=0, + stretch=True, + url="http://domain.com/myoverlay_new_3.html", + width=0, + x=0, + y=0, + ) + assert_matches_type(Overlay, overlay, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.streaming.streams.overlays.with_raw_response.update( + overlay_id=0, + stream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + overlay = response.parse() + assert_matches_type(Overlay, overlay, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.streaming.streams.overlays.with_streaming_response.update( + overlay_id=0, + stream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + overlay = response.parse() + assert_matches_type(Overlay, overlay, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + overlay = client.streaming.streams.overlays.list( + 0, + ) + assert_matches_type(OverlayListResponse, overlay, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.streaming.streams.overlays.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + overlay = response.parse() + assert_matches_type(OverlayListResponse, overlay, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.streaming.streams.overlays.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + overlay = response.parse() + assert_matches_type(OverlayListResponse, overlay, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + overlay = client.streaming.streams.overlays.delete( + overlay_id=0, + stream_id=0, + ) + assert overlay is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.streaming.streams.overlays.with_raw_response.delete( + overlay_id=0, + stream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + overlay = response.parse() + assert overlay is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.streaming.streams.overlays.with_streaming_response.delete( + overlay_id=0, + stream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + overlay = response.parse() + assert overlay is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + overlay = client.streaming.streams.overlays.get( + overlay_id=0, + stream_id=0, + ) + assert_matches_type(Overlay, overlay, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.streaming.streams.overlays.with_raw_response.get( + overlay_id=0, + stream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + overlay = response.parse() + assert_matches_type(Overlay, overlay, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.streaming.streams.overlays.with_streaming_response.get( + overlay_id=0, + stream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + overlay = response.parse() + assert_matches_type(Overlay, overlay, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update_multiple(self, client: Gcore) -> None: + overlay = client.streaming.streams.overlays.update_multiple( + stream_id=0, + ) + assert_matches_type(OverlayUpdateMultipleResponse, overlay, path=["response"]) + + @parametrize + def test_method_update_multiple_with_all_params(self, client: Gcore) -> None: + overlay = client.streaming.streams.overlays.update_multiple( + stream_id=0, + body=[ + { + "id": 0, + "height": 0, + "stretch": True, + "url": "url", + "width": 0, + "x": 0, + "y": 0, + } + ], + ) + assert_matches_type(OverlayUpdateMultipleResponse, overlay, path=["response"]) + + @parametrize + def test_raw_response_update_multiple(self, client: Gcore) -> None: + response = client.streaming.streams.overlays.with_raw_response.update_multiple( + stream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + overlay = response.parse() + assert_matches_type(OverlayUpdateMultipleResponse, overlay, path=["response"]) + + @parametrize + def test_streaming_response_update_multiple(self, client: Gcore) -> None: + with client.streaming.streams.overlays.with_streaming_response.update_multiple( + stream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + overlay = response.parse() + assert_matches_type(OverlayUpdateMultipleResponse, overlay, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncOverlays: + 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: + overlay = await async_client.streaming.streams.overlays.create( + stream_id=0, + ) + assert_matches_type(OverlayCreateResponse, overlay, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + overlay = await async_client.streaming.streams.overlays.create( + stream_id=0, + body=[ + { + "url": "http://domain.com/myoverlay1.html", + "height": 40, + "stretch": False, + "width": 120, + "x": 30, + "y": 30, + } + ], + ) + assert_matches_type(OverlayCreateResponse, overlay, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.overlays.with_raw_response.create( + stream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + overlay = await response.parse() + assert_matches_type(OverlayCreateResponse, overlay, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.overlays.with_streaming_response.create( + stream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + overlay = await response.parse() + assert_matches_type(OverlayCreateResponse, overlay, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + overlay = await async_client.streaming.streams.overlays.update( + overlay_id=0, + stream_id=0, + ) + assert_matches_type(Overlay, overlay, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + overlay = await async_client.streaming.streams.overlays.update( + overlay_id=0, + stream_id=0, + height=0, + stretch=True, + url="http://domain.com/myoverlay_new_3.html", + width=0, + x=0, + y=0, + ) + assert_matches_type(Overlay, overlay, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.overlays.with_raw_response.update( + overlay_id=0, + stream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + overlay = await response.parse() + assert_matches_type(Overlay, overlay, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.overlays.with_streaming_response.update( + overlay_id=0, + stream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + overlay = await response.parse() + assert_matches_type(Overlay, overlay, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + overlay = await async_client.streaming.streams.overlays.list( + 0, + ) + assert_matches_type(OverlayListResponse, overlay, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.overlays.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + overlay = await response.parse() + assert_matches_type(OverlayListResponse, overlay, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.overlays.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + overlay = await response.parse() + assert_matches_type(OverlayListResponse, overlay, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + overlay = await async_client.streaming.streams.overlays.delete( + overlay_id=0, + stream_id=0, + ) + assert overlay is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.overlays.with_raw_response.delete( + overlay_id=0, + stream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + overlay = await response.parse() + assert overlay is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.overlays.with_streaming_response.delete( + overlay_id=0, + stream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + overlay = await response.parse() + assert overlay is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + overlay = await async_client.streaming.streams.overlays.get( + overlay_id=0, + stream_id=0, + ) + assert_matches_type(Overlay, overlay, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.overlays.with_raw_response.get( + overlay_id=0, + stream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + overlay = await response.parse() + assert_matches_type(Overlay, overlay, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.overlays.with_streaming_response.get( + overlay_id=0, + stream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + overlay = await response.parse() + assert_matches_type(Overlay, overlay, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update_multiple(self, async_client: AsyncGcore) -> None: + overlay = await async_client.streaming.streams.overlays.update_multiple( + stream_id=0, + ) + assert_matches_type(OverlayUpdateMultipleResponse, overlay, path=["response"]) + + @parametrize + async def test_method_update_multiple_with_all_params(self, async_client: AsyncGcore) -> None: + overlay = await async_client.streaming.streams.overlays.update_multiple( + stream_id=0, + body=[ + { + "id": 0, + "height": 0, + "stretch": True, + "url": "url", + "width": 0, + "x": 0, + "y": 0, + } + ], + ) + assert_matches_type(OverlayUpdateMultipleResponse, overlay, path=["response"]) + + @parametrize + async def test_raw_response_update_multiple(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.overlays.with_raw_response.update_multiple( + stream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + overlay = await response.parse() + assert_matches_type(OverlayUpdateMultipleResponse, overlay, path=["response"]) + + @parametrize + async def test_streaming_response_update_multiple(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.overlays.with_streaming_response.update_multiple( + stream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + overlay = await response.parse() + assert_matches_type(OverlayUpdateMultipleResponse, overlay, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_ai_tasks.py b/tests/api_resources/streaming/test_ai_tasks.py new file mode 100644 index 00000000..1e5e36d1 --- /dev/null +++ b/tests/api_resources/streaming/test_ai_tasks.py @@ -0,0 +1,435 @@ +# 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.pagination import SyncPageStreamingAI, AsyncPageStreamingAI +from gcore.types.streaming import ( + AITask, + AITaskGetResponse, + AITaskCancelResponse, + AITaskCreateResponse, + AITaskGetAISettingsResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAITasks: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + ai_task = client.streaming.ai_tasks.create( + task_name="transcription", + url="url", + ) + assert_matches_type(AITaskCreateResponse, ai_task, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + ai_task = client.streaming.ai_tasks.create( + task_name="transcription", + url="url", + audio_language="audio_language", + category="sport", + client_entity_data="client_entity_data", + client_user_id="client_user_id", + subtitles_language="subtitles_language", + ) + assert_matches_type(AITaskCreateResponse, ai_task, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.streaming.ai_tasks.with_raw_response.create( + task_name="transcription", + url="url", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ai_task = response.parse() + assert_matches_type(AITaskCreateResponse, ai_task, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.streaming.ai_tasks.with_streaming_response.create( + task_name="transcription", + url="url", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ai_task = response.parse() + assert_matches_type(AITaskCreateResponse, ai_task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + ai_task = client.streaming.ai_tasks.list() + assert_matches_type(SyncPageStreamingAI[AITask], ai_task, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + ai_task = client.streaming.ai_tasks.list( + date_created="date_created", + limit=0, + ordering="task_id", + page=0, + search="search", + status="FAILURE", + task_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + task_name="transcription", + ) + assert_matches_type(SyncPageStreamingAI[AITask], ai_task, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.streaming.ai_tasks.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ai_task = response.parse() + assert_matches_type(SyncPageStreamingAI[AITask], ai_task, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.streaming.ai_tasks.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ai_task = response.parse() + assert_matches_type(SyncPageStreamingAI[AITask], ai_task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_cancel(self, client: Gcore) -> None: + ai_task = client.streaming.ai_tasks.cancel( + "task_id", + ) + assert_matches_type(AITaskCancelResponse, ai_task, path=["response"]) + + @parametrize + def test_raw_response_cancel(self, client: Gcore) -> None: + response = client.streaming.ai_tasks.with_raw_response.cancel( + "task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ai_task = response.parse() + assert_matches_type(AITaskCancelResponse, ai_task, path=["response"]) + + @parametrize + def test_streaming_response_cancel(self, client: Gcore) -> None: + with client.streaming.ai_tasks.with_streaming_response.cancel( + "task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ai_task = response.parse() + assert_matches_type(AITaskCancelResponse, ai_task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_cancel(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + client.streaming.ai_tasks.with_raw_response.cancel( + "", + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + ai_task = client.streaming.ai_tasks.get( + "task_id", + ) + assert_matches_type(AITaskGetResponse, ai_task, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.streaming.ai_tasks.with_raw_response.get( + "task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ai_task = response.parse() + assert_matches_type(AITaskGetResponse, ai_task, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.streaming.ai_tasks.with_streaming_response.get( + "task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ai_task = response.parse() + assert_matches_type(AITaskGetResponse, ai_task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + client.streaming.ai_tasks.with_raw_response.get( + "", + ) + + @parametrize + def test_method_get_ai_settings(self, client: Gcore) -> None: + ai_task = client.streaming.ai_tasks.get_ai_settings( + type="language_support", + ) + assert_matches_type(AITaskGetAISettingsResponse, ai_task, path=["response"]) + + @parametrize + def test_method_get_ai_settings_with_all_params(self, client: Gcore) -> None: + ai_task = client.streaming.ai_tasks.get_ai_settings( + type="language_support", + audio_language="audio_language", + subtitles_language="subtitles_language", + ) + assert_matches_type(AITaskGetAISettingsResponse, ai_task, path=["response"]) + + @parametrize + def test_raw_response_get_ai_settings(self, client: Gcore) -> None: + response = client.streaming.ai_tasks.with_raw_response.get_ai_settings( + type="language_support", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ai_task = response.parse() + assert_matches_type(AITaskGetAISettingsResponse, ai_task, path=["response"]) + + @parametrize + def test_streaming_response_get_ai_settings(self, client: Gcore) -> None: + with client.streaming.ai_tasks.with_streaming_response.get_ai_settings( + type="language_support", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ai_task = response.parse() + assert_matches_type(AITaskGetAISettingsResponse, ai_task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncAITasks: + 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: + ai_task = await async_client.streaming.ai_tasks.create( + task_name="transcription", + url="url", + ) + assert_matches_type(AITaskCreateResponse, ai_task, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + ai_task = await async_client.streaming.ai_tasks.create( + task_name="transcription", + url="url", + audio_language="audio_language", + category="sport", + client_entity_data="client_entity_data", + client_user_id="client_user_id", + subtitles_language="subtitles_language", + ) + assert_matches_type(AITaskCreateResponse, ai_task, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.ai_tasks.with_raw_response.create( + task_name="transcription", + url="url", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ai_task = await response.parse() + assert_matches_type(AITaskCreateResponse, ai_task, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.ai_tasks.with_streaming_response.create( + task_name="transcription", + url="url", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ai_task = await response.parse() + assert_matches_type(AITaskCreateResponse, ai_task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + ai_task = await async_client.streaming.ai_tasks.list() + assert_matches_type(AsyncPageStreamingAI[AITask], ai_task, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + ai_task = await async_client.streaming.ai_tasks.list( + date_created="date_created", + limit=0, + ordering="task_id", + page=0, + search="search", + status="FAILURE", + task_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + task_name="transcription", + ) + assert_matches_type(AsyncPageStreamingAI[AITask], ai_task, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.ai_tasks.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ai_task = await response.parse() + assert_matches_type(AsyncPageStreamingAI[AITask], ai_task, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.ai_tasks.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ai_task = await response.parse() + assert_matches_type(AsyncPageStreamingAI[AITask], ai_task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_cancel(self, async_client: AsyncGcore) -> None: + ai_task = await async_client.streaming.ai_tasks.cancel( + "task_id", + ) + assert_matches_type(AITaskCancelResponse, ai_task, path=["response"]) + + @parametrize + async def test_raw_response_cancel(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.ai_tasks.with_raw_response.cancel( + "task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ai_task = await response.parse() + assert_matches_type(AITaskCancelResponse, ai_task, path=["response"]) + + @parametrize + async def test_streaming_response_cancel(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.ai_tasks.with_streaming_response.cancel( + "task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ai_task = await response.parse() + assert_matches_type(AITaskCancelResponse, ai_task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_cancel(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + await async_client.streaming.ai_tasks.with_raw_response.cancel( + "", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + ai_task = await async_client.streaming.ai_tasks.get( + "task_id", + ) + assert_matches_type(AITaskGetResponse, ai_task, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.ai_tasks.with_raw_response.get( + "task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ai_task = await response.parse() + assert_matches_type(AITaskGetResponse, ai_task, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.ai_tasks.with_streaming_response.get( + "task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ai_task = await response.parse() + assert_matches_type(AITaskGetResponse, ai_task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + await async_client.streaming.ai_tasks.with_raw_response.get( + "", + ) + + @parametrize + async def test_method_get_ai_settings(self, async_client: AsyncGcore) -> None: + ai_task = await async_client.streaming.ai_tasks.get_ai_settings( + type="language_support", + ) + assert_matches_type(AITaskGetAISettingsResponse, ai_task, path=["response"]) + + @parametrize + async def test_method_get_ai_settings_with_all_params(self, async_client: AsyncGcore) -> None: + ai_task = await async_client.streaming.ai_tasks.get_ai_settings( + type="language_support", + audio_language="audio_language", + subtitles_language="subtitles_language", + ) + assert_matches_type(AITaskGetAISettingsResponse, ai_task, path=["response"]) + + @parametrize + async def test_raw_response_get_ai_settings(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.ai_tasks.with_raw_response.get_ai_settings( + type="language_support", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ai_task = await response.parse() + assert_matches_type(AITaskGetAISettingsResponse, ai_task, path=["response"]) + + @parametrize + async def test_streaming_response_get_ai_settings(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.ai_tasks.with_streaming_response.get_ai_settings( + type="language_support", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ai_task = await response.parse() + assert_matches_type(AITaskGetAISettingsResponse, ai_task, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_broadcasts.py b/tests/api_resources/streaming/test_broadcasts.py new file mode 100644 index 00000000..79118259 --- /dev/null +++ b/tests/api_resources/streaming/test_broadcasts.py @@ -0,0 +1,464 @@ +# 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.pagination import SyncPageStreaming, AsyncPageStreaming +from gcore.types.streaming import ( + Broadcast, + BroadcastSpectatorsCount, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBroadcasts: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + broadcast = client.streaming.broadcasts.create() + assert broadcast is None + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + broadcast = client.streaming.broadcasts.create( + broadcast={ + "name": "Broadcast", + "ad_id": 1, + "custom_iframe_url": "", + "pending_message": "pending_message", + "player_id": 14, + "poster": "poster", + "share_url": "", + "show_dvr_after_finish": True, + "status": "live", + "stream_ids": [10], + }, + ) + assert broadcast is None + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.streaming.broadcasts.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + broadcast = response.parse() + assert broadcast is None + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.streaming.broadcasts.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + broadcast = response.parse() + assert broadcast is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + broadcast = client.streaming.broadcasts.update( + broadcast_id=0, + ) + assert_matches_type(Broadcast, broadcast, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + broadcast = client.streaming.broadcasts.update( + broadcast_id=0, + broadcast={ + "name": "Broadcast", + "ad_id": 1, + "custom_iframe_url": "", + "pending_message": "pending_message", + "player_id": 14, + "poster": "poster", + "share_url": "", + "show_dvr_after_finish": True, + "status": "live", + "stream_ids": [10], + }, + ) + assert_matches_type(Broadcast, broadcast, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.streaming.broadcasts.with_raw_response.update( + broadcast_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + broadcast = response.parse() + assert_matches_type(Broadcast, broadcast, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.streaming.broadcasts.with_streaming_response.update( + broadcast_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + broadcast = response.parse() + assert_matches_type(Broadcast, broadcast, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + broadcast = client.streaming.broadcasts.list() + assert_matches_type(SyncPageStreaming[Broadcast], broadcast, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + broadcast = client.streaming.broadcasts.list( + page=0, + ) + assert_matches_type(SyncPageStreaming[Broadcast], broadcast, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.streaming.broadcasts.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + broadcast = response.parse() + assert_matches_type(SyncPageStreaming[Broadcast], broadcast, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.streaming.broadcasts.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + broadcast = response.parse() + assert_matches_type(SyncPageStreaming[Broadcast], broadcast, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + broadcast = client.streaming.broadcasts.delete( + 0, + ) + assert broadcast is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.streaming.broadcasts.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + broadcast = response.parse() + assert broadcast is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.streaming.broadcasts.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + broadcast = response.parse() + assert broadcast is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + broadcast = client.streaming.broadcasts.get( + 0, + ) + assert_matches_type(Broadcast, broadcast, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.streaming.broadcasts.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + broadcast = response.parse() + assert_matches_type(Broadcast, broadcast, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.streaming.broadcasts.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + broadcast = response.parse() + assert_matches_type(Broadcast, broadcast, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_spectators_count(self, client: Gcore) -> None: + broadcast = client.streaming.broadcasts.get_spectators_count( + 0, + ) + assert_matches_type(BroadcastSpectatorsCount, broadcast, path=["response"]) + + @parametrize + def test_raw_response_get_spectators_count(self, client: Gcore) -> None: + response = client.streaming.broadcasts.with_raw_response.get_spectators_count( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + broadcast = response.parse() + assert_matches_type(BroadcastSpectatorsCount, broadcast, path=["response"]) + + @parametrize + def test_streaming_response_get_spectators_count(self, client: Gcore) -> None: + with client.streaming.broadcasts.with_streaming_response.get_spectators_count( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + broadcast = response.parse() + assert_matches_type(BroadcastSpectatorsCount, broadcast, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncBroadcasts: + 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: + broadcast = await async_client.streaming.broadcasts.create() + assert broadcast is None + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + broadcast = await async_client.streaming.broadcasts.create( + broadcast={ + "name": "Broadcast", + "ad_id": 1, + "custom_iframe_url": "", + "pending_message": "pending_message", + "player_id": 14, + "poster": "poster", + "share_url": "", + "show_dvr_after_finish": True, + "status": "live", + "stream_ids": [10], + }, + ) + assert broadcast is None + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.broadcasts.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + broadcast = await response.parse() + assert broadcast is None + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.broadcasts.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + broadcast = await response.parse() + assert broadcast is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + broadcast = await async_client.streaming.broadcasts.update( + broadcast_id=0, + ) + assert_matches_type(Broadcast, broadcast, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + broadcast = await async_client.streaming.broadcasts.update( + broadcast_id=0, + broadcast={ + "name": "Broadcast", + "ad_id": 1, + "custom_iframe_url": "", + "pending_message": "pending_message", + "player_id": 14, + "poster": "poster", + "share_url": "", + "show_dvr_after_finish": True, + "status": "live", + "stream_ids": [10], + }, + ) + assert_matches_type(Broadcast, broadcast, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.broadcasts.with_raw_response.update( + broadcast_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + broadcast = await response.parse() + assert_matches_type(Broadcast, broadcast, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.broadcasts.with_streaming_response.update( + broadcast_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + broadcast = await response.parse() + assert_matches_type(Broadcast, broadcast, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + broadcast = await async_client.streaming.broadcasts.list() + assert_matches_type(AsyncPageStreaming[Broadcast], broadcast, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + broadcast = await async_client.streaming.broadcasts.list( + page=0, + ) + assert_matches_type(AsyncPageStreaming[Broadcast], broadcast, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.broadcasts.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + broadcast = await response.parse() + assert_matches_type(AsyncPageStreaming[Broadcast], broadcast, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.broadcasts.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + broadcast = await response.parse() + assert_matches_type(AsyncPageStreaming[Broadcast], broadcast, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + broadcast = await async_client.streaming.broadcasts.delete( + 0, + ) + assert broadcast is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.broadcasts.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + broadcast = await response.parse() + assert broadcast is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.broadcasts.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + broadcast = await response.parse() + assert broadcast is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + broadcast = await async_client.streaming.broadcasts.get( + 0, + ) + assert_matches_type(Broadcast, broadcast, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.broadcasts.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + broadcast = await response.parse() + assert_matches_type(Broadcast, broadcast, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.broadcasts.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + broadcast = await response.parse() + assert_matches_type(Broadcast, broadcast, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_spectators_count(self, async_client: AsyncGcore) -> None: + broadcast = await async_client.streaming.broadcasts.get_spectators_count( + 0, + ) + assert_matches_type(BroadcastSpectatorsCount, broadcast, path=["response"]) + + @parametrize + async def test_raw_response_get_spectators_count(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.broadcasts.with_raw_response.get_spectators_count( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + broadcast = await response.parse() + assert_matches_type(BroadcastSpectatorsCount, broadcast, path=["response"]) + + @parametrize + async def test_streaming_response_get_spectators_count(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.broadcasts.with_streaming_response.get_spectators_count( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + broadcast = await response.parse() + assert_matches_type(BroadcastSpectatorsCount, broadcast, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_directories.py b/tests/api_resources/streaming/test_directories.py new file mode 100644 index 00000000..099d8bd6 --- /dev/null +++ b/tests/api_resources/streaming/test_directories.py @@ -0,0 +1,360 @@ +# 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.streaming import ( + DirectoryBase, + DirectoriesTree, + DirectoryGetResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDirectories: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + directory = client.streaming.directories.create( + name="New series. Season 1", + ) + assert_matches_type(DirectoryBase, directory, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + directory = client.streaming.directories.create( + name="New series. Season 1", + parent_id=100, + ) + assert_matches_type(DirectoryBase, directory, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.streaming.directories.with_raw_response.create( + name="New series. Season 1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + directory = response.parse() + assert_matches_type(DirectoryBase, directory, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.streaming.directories.with_streaming_response.create( + name="New series. Season 1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + directory = response.parse() + assert_matches_type(DirectoryBase, directory, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + directory = client.streaming.directories.update( + directory_id=0, + ) + assert_matches_type(DirectoryBase, directory, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + directory = client.streaming.directories.update( + directory_id=0, + name="New series. Season 2", + parent_id=0, + ) + assert_matches_type(DirectoryBase, directory, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.streaming.directories.with_raw_response.update( + directory_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + directory = response.parse() + assert_matches_type(DirectoryBase, directory, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.streaming.directories.with_streaming_response.update( + directory_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + directory = response.parse() + assert_matches_type(DirectoryBase, directory, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + directory = client.streaming.directories.delete( + 0, + ) + assert directory is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.streaming.directories.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + directory = response.parse() + assert directory is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.streaming.directories.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + directory = response.parse() + assert directory is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + directory = client.streaming.directories.get( + 0, + ) + assert_matches_type(DirectoryGetResponse, directory, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.streaming.directories.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + directory = response.parse() + assert_matches_type(DirectoryGetResponse, directory, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.streaming.directories.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + directory = response.parse() + assert_matches_type(DirectoryGetResponse, directory, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_tree(self, client: Gcore) -> None: + directory = client.streaming.directories.get_tree() + assert_matches_type(DirectoriesTree, directory, path=["response"]) + + @parametrize + def test_raw_response_get_tree(self, client: Gcore) -> None: + response = client.streaming.directories.with_raw_response.get_tree() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + directory = response.parse() + assert_matches_type(DirectoriesTree, directory, path=["response"]) + + @parametrize + def test_streaming_response_get_tree(self, client: Gcore) -> None: + with client.streaming.directories.with_streaming_response.get_tree() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + directory = response.parse() + assert_matches_type(DirectoriesTree, directory, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncDirectories: + 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: + directory = await async_client.streaming.directories.create( + name="New series. Season 1", + ) + assert_matches_type(DirectoryBase, directory, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + directory = await async_client.streaming.directories.create( + name="New series. Season 1", + parent_id=100, + ) + assert_matches_type(DirectoryBase, directory, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.directories.with_raw_response.create( + name="New series. Season 1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + directory = await response.parse() + assert_matches_type(DirectoryBase, directory, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.directories.with_streaming_response.create( + name="New series. Season 1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + directory = await response.parse() + assert_matches_type(DirectoryBase, directory, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + directory = await async_client.streaming.directories.update( + directory_id=0, + ) + assert_matches_type(DirectoryBase, directory, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + directory = await async_client.streaming.directories.update( + directory_id=0, + name="New series. Season 2", + parent_id=0, + ) + assert_matches_type(DirectoryBase, directory, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.directories.with_raw_response.update( + directory_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + directory = await response.parse() + assert_matches_type(DirectoryBase, directory, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.directories.with_streaming_response.update( + directory_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + directory = await response.parse() + assert_matches_type(DirectoryBase, directory, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + directory = await async_client.streaming.directories.delete( + 0, + ) + assert directory is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.directories.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + directory = await response.parse() + assert directory is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.directories.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + directory = await response.parse() + assert directory is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + directory = await async_client.streaming.directories.get( + 0, + ) + assert_matches_type(DirectoryGetResponse, directory, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.directories.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + directory = await response.parse() + assert_matches_type(DirectoryGetResponse, directory, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.directories.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + directory = await response.parse() + assert_matches_type(DirectoryGetResponse, directory, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_tree(self, async_client: AsyncGcore) -> None: + directory = await async_client.streaming.directories.get_tree() + assert_matches_type(DirectoriesTree, directory, path=["response"]) + + @parametrize + async def test_raw_response_get_tree(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.directories.with_raw_response.get_tree() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + directory = await response.parse() + assert_matches_type(DirectoriesTree, directory, path=["response"]) + + @parametrize + async def test_streaming_response_get_tree(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.directories.with_streaming_response.get_tree() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + directory = await response.parse() + assert_matches_type(DirectoriesTree, directory, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_players.py b/tests/api_resources/streaming/test_players.py new file mode 100644 index 00000000..1e7bcba9 --- /dev/null +++ b/tests/api_resources/streaming/test_players.py @@ -0,0 +1,501 @@ +# 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.pagination import SyncPageStreaming, AsyncPageStreaming +from gcore.types.streaming import Player + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPlayers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + player = client.streaming.players.create() + assert player is None + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + player = client.streaming.players.create( + player={ + "name": "name", + "id": 0, + "autoplay": True, + "bg_color": "bg_color", + "client_id": 0, + "custom_css": "custom_css", + "design": "design", + "disable_skin": True, + "fg_color": "fg_color", + "framework": "framework", + "hover_color": "hover_color", + "js_url": "js_url", + "logo": "logo", + "logo_position": "logo_position", + "mute": True, + "save_options_to_cookies": True, + "show_sharing": True, + "skin_is_url": "skin_is_url", + "speed_control": True, + "text_color": "text_color", + }, + ) + assert player is None + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.streaming.players.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + player = response.parse() + assert player is None + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.streaming.players.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + player = response.parse() + assert player is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + player = client.streaming.players.update( + player_id=0, + ) + assert_matches_type(Player, player, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + player = client.streaming.players.update( + player_id=0, + player={ + "name": "name", + "id": 0, + "autoplay": True, + "bg_color": "bg_color", + "client_id": 0, + "custom_css": "custom_css", + "design": "design", + "disable_skin": True, + "fg_color": "fg_color", + "framework": "framework", + "hover_color": "hover_color", + "js_url": "js_url", + "logo": "logo", + "logo_position": "logo_position", + "mute": True, + "save_options_to_cookies": True, + "show_sharing": True, + "skin_is_url": "skin_is_url", + "speed_control": True, + "text_color": "text_color", + }, + ) + assert_matches_type(Player, player, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.streaming.players.with_raw_response.update( + player_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + player = response.parse() + assert_matches_type(Player, player, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.streaming.players.with_streaming_response.update( + player_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + player = response.parse() + assert_matches_type(Player, player, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + player = client.streaming.players.list() + assert_matches_type(SyncPageStreaming[Player], player, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + player = client.streaming.players.list( + page=0, + ) + assert_matches_type(SyncPageStreaming[Player], player, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.streaming.players.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + player = response.parse() + assert_matches_type(SyncPageStreaming[Player], player, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.streaming.players.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + player = response.parse() + assert_matches_type(SyncPageStreaming[Player], player, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + player = client.streaming.players.delete( + 0, + ) + assert player is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.streaming.players.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + player = response.parse() + assert player is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.streaming.players.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + player = response.parse() + assert player is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + player = client.streaming.players.get( + 0, + ) + assert_matches_type(Player, player, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.streaming.players.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + player = response.parse() + assert_matches_type(Player, player, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.streaming.players.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + player = response.parse() + assert_matches_type(Player, player, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_preview(self, client: Gcore) -> None: + player = client.streaming.players.preview( + 0, + ) + assert player is None + + @parametrize + def test_raw_response_preview(self, client: Gcore) -> None: + response = client.streaming.players.with_raw_response.preview( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + player = response.parse() + assert player is None + + @parametrize + def test_streaming_response_preview(self, client: Gcore) -> None: + with client.streaming.players.with_streaming_response.preview( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + player = response.parse() + assert player is None + + assert cast(Any, response.is_closed) is True + + +class TestAsyncPlayers: + 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: + player = await async_client.streaming.players.create() + assert player is None + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + player = await async_client.streaming.players.create( + player={ + "name": "name", + "id": 0, + "autoplay": True, + "bg_color": "bg_color", + "client_id": 0, + "custom_css": "custom_css", + "design": "design", + "disable_skin": True, + "fg_color": "fg_color", + "framework": "framework", + "hover_color": "hover_color", + "js_url": "js_url", + "logo": "logo", + "logo_position": "logo_position", + "mute": True, + "save_options_to_cookies": True, + "show_sharing": True, + "skin_is_url": "skin_is_url", + "speed_control": True, + "text_color": "text_color", + }, + ) + assert player is None + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.players.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + player = await response.parse() + assert player is None + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.players.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + player = await response.parse() + assert player is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + player = await async_client.streaming.players.update( + player_id=0, + ) + assert_matches_type(Player, player, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + player = await async_client.streaming.players.update( + player_id=0, + player={ + "name": "name", + "id": 0, + "autoplay": True, + "bg_color": "bg_color", + "client_id": 0, + "custom_css": "custom_css", + "design": "design", + "disable_skin": True, + "fg_color": "fg_color", + "framework": "framework", + "hover_color": "hover_color", + "js_url": "js_url", + "logo": "logo", + "logo_position": "logo_position", + "mute": True, + "save_options_to_cookies": True, + "show_sharing": True, + "skin_is_url": "skin_is_url", + "speed_control": True, + "text_color": "text_color", + }, + ) + assert_matches_type(Player, player, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.players.with_raw_response.update( + player_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + player = await response.parse() + assert_matches_type(Player, player, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.players.with_streaming_response.update( + player_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + player = await response.parse() + assert_matches_type(Player, player, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + player = await async_client.streaming.players.list() + assert_matches_type(AsyncPageStreaming[Player], player, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + player = await async_client.streaming.players.list( + page=0, + ) + assert_matches_type(AsyncPageStreaming[Player], player, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.players.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + player = await response.parse() + assert_matches_type(AsyncPageStreaming[Player], player, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.players.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + player = await response.parse() + assert_matches_type(AsyncPageStreaming[Player], player, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + player = await async_client.streaming.players.delete( + 0, + ) + assert player is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.players.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + player = await response.parse() + assert player is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.players.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + player = await response.parse() + assert player is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + player = await async_client.streaming.players.get( + 0, + ) + assert_matches_type(Player, player, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.players.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + player = await response.parse() + assert_matches_type(Player, player, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.players.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + player = await response.parse() + assert_matches_type(Player, player, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_preview(self, async_client: AsyncGcore) -> None: + player = await async_client.streaming.players.preview( + 0, + ) + assert player is None + + @parametrize + async def test_raw_response_preview(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.players.with_raw_response.preview( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + player = await response.parse() + assert player is None + + @parametrize + async def test_streaming_response_preview(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.players.with_streaming_response.preview( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + player = await response.parse() + assert player is None + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_playlists.py b/tests/api_resources/streaming/test_playlists.py new file mode 100644 index 00000000..80644e67 --- /dev/null +++ b/tests/api_resources/streaming/test_playlists.py @@ -0,0 +1,473 @@ +# 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.pagination import SyncPageStreaming, AsyncPageStreaming +from gcore.types.streaming import ( + Playlist, + PlaylistCreate, + PlaylistListVideosResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPlaylists: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + playlist = client.streaming.playlists.create() + assert_matches_type(PlaylistCreate, playlist, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + playlist = client.streaming.playlists.create( + active=True, + ad_id=0, + client_id=0, + client_user_id=2876, + countdown=True, + hls_cmaf_url="hls_cmaf_url", + hls_url="hls_url", + iframe_url="iframe_url", + loop=False, + name="Playlist: Webinar 'Onboarding for new employees on working with the corporate portal'", + player_id=0, + playlist_type="live", + start_time="2024-07-01T11:00:00Z", + video_ids=[17800, 17801], + ) + assert_matches_type(PlaylistCreate, playlist, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.streaming.playlists.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + playlist = response.parse() + assert_matches_type(PlaylistCreate, playlist, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.streaming.playlists.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + playlist = response.parse() + assert_matches_type(PlaylistCreate, playlist, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + playlist = client.streaming.playlists.update( + playlist_id=0, + ) + assert_matches_type(Playlist, playlist, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + playlist = client.streaming.playlists.update( + playlist_id=0, + active=True, + ad_id=0, + client_id=0, + client_user_id=2876, + countdown=True, + hls_cmaf_url="hls_cmaf_url", + hls_url="hls_url", + iframe_url="iframe_url", + loop=False, + name="Playlist: Webinar 'Onboarding for new employees on working with the corporate portal'", + player_id=0, + playlist_type="live", + start_time="2024-07-01T11:00:00Z", + video_ids=[17800, 17801], + ) + assert_matches_type(Playlist, playlist, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.streaming.playlists.with_raw_response.update( + playlist_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + playlist = response.parse() + assert_matches_type(Playlist, playlist, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.streaming.playlists.with_streaming_response.update( + playlist_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + playlist = response.parse() + assert_matches_type(Playlist, playlist, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + playlist = client.streaming.playlists.list() + assert_matches_type(SyncPageStreaming[Playlist], playlist, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + playlist = client.streaming.playlists.list( + page=0, + ) + assert_matches_type(SyncPageStreaming[Playlist], playlist, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.streaming.playlists.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + playlist = response.parse() + assert_matches_type(SyncPageStreaming[Playlist], playlist, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.streaming.playlists.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + playlist = response.parse() + assert_matches_type(SyncPageStreaming[Playlist], playlist, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + playlist = client.streaming.playlists.delete( + 0, + ) + assert playlist is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.streaming.playlists.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + playlist = response.parse() + assert playlist is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.streaming.playlists.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + playlist = response.parse() + assert playlist is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + playlist = client.streaming.playlists.get( + 0, + ) + assert_matches_type(Playlist, playlist, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.streaming.playlists.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + playlist = response.parse() + assert_matches_type(Playlist, playlist, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.streaming.playlists.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + playlist = response.parse() + assert_matches_type(Playlist, playlist, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_videos(self, client: Gcore) -> None: + playlist = client.streaming.playlists.list_videos( + 0, + ) + assert_matches_type(PlaylistListVideosResponse, playlist, path=["response"]) + + @parametrize + def test_raw_response_list_videos(self, client: Gcore) -> None: + response = client.streaming.playlists.with_raw_response.list_videos( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + playlist = response.parse() + assert_matches_type(PlaylistListVideosResponse, playlist, path=["response"]) + + @parametrize + def test_streaming_response_list_videos(self, client: Gcore) -> None: + with client.streaming.playlists.with_streaming_response.list_videos( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + playlist = response.parse() + assert_matches_type(PlaylistListVideosResponse, playlist, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncPlaylists: + 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: + playlist = await async_client.streaming.playlists.create() + assert_matches_type(PlaylistCreate, playlist, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + playlist = await async_client.streaming.playlists.create( + active=True, + ad_id=0, + client_id=0, + client_user_id=2876, + countdown=True, + hls_cmaf_url="hls_cmaf_url", + hls_url="hls_url", + iframe_url="iframe_url", + loop=False, + name="Playlist: Webinar 'Onboarding for new employees on working with the corporate portal'", + player_id=0, + playlist_type="live", + start_time="2024-07-01T11:00:00Z", + video_ids=[17800, 17801], + ) + assert_matches_type(PlaylistCreate, playlist, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.playlists.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + playlist = await response.parse() + assert_matches_type(PlaylistCreate, playlist, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.playlists.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + playlist = await response.parse() + assert_matches_type(PlaylistCreate, playlist, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + playlist = await async_client.streaming.playlists.update( + playlist_id=0, + ) + assert_matches_type(Playlist, playlist, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + playlist = await async_client.streaming.playlists.update( + playlist_id=0, + active=True, + ad_id=0, + client_id=0, + client_user_id=2876, + countdown=True, + hls_cmaf_url="hls_cmaf_url", + hls_url="hls_url", + iframe_url="iframe_url", + loop=False, + name="Playlist: Webinar 'Onboarding for new employees on working with the corporate portal'", + player_id=0, + playlist_type="live", + start_time="2024-07-01T11:00:00Z", + video_ids=[17800, 17801], + ) + assert_matches_type(Playlist, playlist, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.playlists.with_raw_response.update( + playlist_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + playlist = await response.parse() + assert_matches_type(Playlist, playlist, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.playlists.with_streaming_response.update( + playlist_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + playlist = await response.parse() + assert_matches_type(Playlist, playlist, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + playlist = await async_client.streaming.playlists.list() + assert_matches_type(AsyncPageStreaming[Playlist], playlist, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + playlist = await async_client.streaming.playlists.list( + page=0, + ) + assert_matches_type(AsyncPageStreaming[Playlist], playlist, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.playlists.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + playlist = await response.parse() + assert_matches_type(AsyncPageStreaming[Playlist], playlist, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.playlists.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + playlist = await response.parse() + assert_matches_type(AsyncPageStreaming[Playlist], playlist, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + playlist = await async_client.streaming.playlists.delete( + 0, + ) + assert playlist is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.playlists.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + playlist = await response.parse() + assert playlist is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.playlists.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + playlist = await response.parse() + assert playlist is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + playlist = await async_client.streaming.playlists.get( + 0, + ) + assert_matches_type(Playlist, playlist, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.playlists.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + playlist = await response.parse() + assert_matches_type(Playlist, playlist, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.playlists.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + playlist = await response.parse() + assert_matches_type(Playlist, playlist, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_videos(self, async_client: AsyncGcore) -> None: + playlist = await async_client.streaming.playlists.list_videos( + 0, + ) + assert_matches_type(PlaylistListVideosResponse, playlist, path=["response"]) + + @parametrize + async def test_raw_response_list_videos(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.playlists.with_raw_response.list_videos( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + playlist = await response.parse() + assert_matches_type(PlaylistListVideosResponse, playlist, path=["response"]) + + @parametrize + async def test_streaming_response_list_videos(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.playlists.with_streaming_response.list_videos( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + playlist = await response.parse() + assert_matches_type(PlaylistListVideosResponse, playlist, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_quality_sets.py b/tests/api_resources/streaming/test_quality_sets.py new file mode 100644 index 00000000..f98d8092 --- /dev/null +++ b/tests/api_resources/streaming/test_quality_sets.py @@ -0,0 +1,140 @@ +# 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.streaming import QualitySets + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestQualitySets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + quality_set = client.streaming.quality_sets.list() + assert_matches_type(QualitySets, quality_set, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.streaming.quality_sets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + quality_set = response.parse() + assert_matches_type(QualitySets, quality_set, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.streaming.quality_sets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + quality_set = response.parse() + assert_matches_type(QualitySets, quality_set, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_set_default(self, client: Gcore) -> None: + quality_set = client.streaming.quality_sets.set_default() + assert_matches_type(QualitySets, quality_set, path=["response"]) + + @parametrize + def test_method_set_default_with_all_params(self, client: Gcore) -> None: + quality_set = client.streaming.quality_sets.set_default( + live={"id": 0}, + vod={"id": 0}, + ) + assert_matches_type(QualitySets, quality_set, path=["response"]) + + @parametrize + def test_raw_response_set_default(self, client: Gcore) -> None: + response = client.streaming.quality_sets.with_raw_response.set_default() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + quality_set = response.parse() + assert_matches_type(QualitySets, quality_set, path=["response"]) + + @parametrize + def test_streaming_response_set_default(self, client: Gcore) -> None: + with client.streaming.quality_sets.with_streaming_response.set_default() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + quality_set = response.parse() + assert_matches_type(QualitySets, quality_set, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncQualitySets: + 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: + quality_set = await async_client.streaming.quality_sets.list() + assert_matches_type(QualitySets, quality_set, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.quality_sets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + quality_set = await response.parse() + assert_matches_type(QualitySets, quality_set, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.quality_sets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + quality_set = await response.parse() + assert_matches_type(QualitySets, quality_set, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_set_default(self, async_client: AsyncGcore) -> None: + quality_set = await async_client.streaming.quality_sets.set_default() + assert_matches_type(QualitySets, quality_set, path=["response"]) + + @parametrize + async def test_method_set_default_with_all_params(self, async_client: AsyncGcore) -> None: + quality_set = await async_client.streaming.quality_sets.set_default( + live={"id": 0}, + vod={"id": 0}, + ) + assert_matches_type(QualitySets, quality_set, path=["response"]) + + @parametrize + async def test_raw_response_set_default(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.quality_sets.with_raw_response.set_default() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + quality_set = await response.parse() + assert_matches_type(QualitySets, quality_set, path=["response"]) + + @parametrize + async def test_streaming_response_set_default(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.quality_sets.with_streaming_response.set_default() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + quality_set = await response.parse() + assert_matches_type(QualitySets, quality_set, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_restreams.py b/tests/api_resources/streaming/test_restreams.py new file mode 100644 index 00000000..0547cf0c --- /dev/null +++ b/tests/api_resources/streaming/test_restreams.py @@ -0,0 +1,383 @@ +# 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.pagination import SyncPageStreaming, AsyncPageStreaming +from gcore.types.streaming import Restream + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRestreams: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + restream = client.streaming.restreams.create() + assert restream is None + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + restream = client.streaming.restreams.create( + restream={ + "active": True, + "client_user_id": 10, + "live": True, + "name": "first restream", + "stream_id": 20, + "uri": "rtmp://a.rtmp.youtube.com/live/k17a-13s8", + }, + ) + assert restream is None + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.streaming.restreams.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + restream = response.parse() + assert restream is None + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.streaming.restreams.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + restream = response.parse() + assert restream is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + restream = client.streaming.restreams.update( + restream_id=0, + ) + assert_matches_type(Restream, restream, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + restream = client.streaming.restreams.update( + restream_id=0, + restream={ + "active": True, + "client_user_id": 10, + "live": True, + "name": "first restream", + "stream_id": 20, + "uri": "rtmp://a.rtmp.youtube.com/live/k17a-13s8", + }, + ) + assert_matches_type(Restream, restream, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.streaming.restreams.with_raw_response.update( + restream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + restream = response.parse() + assert_matches_type(Restream, restream, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.streaming.restreams.with_streaming_response.update( + restream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + restream = response.parse() + assert_matches_type(Restream, restream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + restream = client.streaming.restreams.list() + assert_matches_type(SyncPageStreaming[Restream], restream, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + restream = client.streaming.restreams.list( + page=0, + ) + assert_matches_type(SyncPageStreaming[Restream], restream, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.streaming.restreams.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + restream = response.parse() + assert_matches_type(SyncPageStreaming[Restream], restream, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.streaming.restreams.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + restream = response.parse() + assert_matches_type(SyncPageStreaming[Restream], restream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + restream = client.streaming.restreams.delete( + 0, + ) + assert restream is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.streaming.restreams.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + restream = response.parse() + assert restream is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.streaming.restreams.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + restream = response.parse() + assert restream is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + restream = client.streaming.restreams.get( + 0, + ) + assert_matches_type(Restream, restream, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.streaming.restreams.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + restream = response.parse() + assert_matches_type(Restream, restream, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.streaming.restreams.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + restream = response.parse() + assert_matches_type(Restream, restream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRestreams: + 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: + restream = await async_client.streaming.restreams.create() + assert restream is None + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + restream = await async_client.streaming.restreams.create( + restream={ + "active": True, + "client_user_id": 10, + "live": True, + "name": "first restream", + "stream_id": 20, + "uri": "rtmp://a.rtmp.youtube.com/live/k17a-13s8", + }, + ) + assert restream is None + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.restreams.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + restream = await response.parse() + assert restream is None + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.restreams.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + restream = await response.parse() + assert restream is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + restream = await async_client.streaming.restreams.update( + restream_id=0, + ) + assert_matches_type(Restream, restream, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + restream = await async_client.streaming.restreams.update( + restream_id=0, + restream={ + "active": True, + "client_user_id": 10, + "live": True, + "name": "first restream", + "stream_id": 20, + "uri": "rtmp://a.rtmp.youtube.com/live/k17a-13s8", + }, + ) + assert_matches_type(Restream, restream, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.restreams.with_raw_response.update( + restream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + restream = await response.parse() + assert_matches_type(Restream, restream, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.restreams.with_streaming_response.update( + restream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + restream = await response.parse() + assert_matches_type(Restream, restream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + restream = await async_client.streaming.restreams.list() + assert_matches_type(AsyncPageStreaming[Restream], restream, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + restream = await async_client.streaming.restreams.list( + page=0, + ) + assert_matches_type(AsyncPageStreaming[Restream], restream, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.restreams.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + restream = await response.parse() + assert_matches_type(AsyncPageStreaming[Restream], restream, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.restreams.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + restream = await response.parse() + assert_matches_type(AsyncPageStreaming[Restream], restream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + restream = await async_client.streaming.restreams.delete( + 0, + ) + assert restream is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.restreams.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + restream = await response.parse() + assert restream is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.restreams.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + restream = await response.parse() + assert restream is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + restream = await async_client.streaming.restreams.get( + 0, + ) + assert_matches_type(Restream, restream, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.restreams.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + restream = await response.parse() + assert_matches_type(Restream, restream, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.restreams.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + restream = await response.parse() + assert_matches_type(Restream, restream, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_statistics.py b/tests/api_resources/streaming/test_statistics.py new file mode 100644 index 00000000..72546277 --- /dev/null +++ b/tests/api_resources/streaming/test_statistics.py @@ -0,0 +1,1947 @@ +# 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.streaming import ( + Views, + Ffprobes, + MeetSeries, + StreamSeries, + ViewsHeatmap, + PopularVideos, + StorageSeries, + UniqueViewers, + ViewsByRegion, + ViewsByBrowser, + ViewsByCountry, + ViewsByReferer, + MaxStreamSeries, + ViewsByHostname, + UniqueViewersCdn, + VodStatisticsSeries, + ViewsByOperatingSystem, + VodTotalStreamDurationSeries, + StatisticGetLiveUniqueViewersResponse, + StatisticGetVodWatchTimeTotalCdnResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestStatistics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_ffprobes(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_ffprobes( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + ) + assert_matches_type(Ffprobes, statistic, path=["response"]) + + @parametrize + def test_method_get_ffprobes_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_ffprobes( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + interval=0, + units="second", + ) + assert_matches_type(Ffprobes, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_ffprobes(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_ffprobes( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(Ffprobes, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_ffprobes(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_ffprobes( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(Ffprobes, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_live_unique_viewers(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_live_unique_viewers( + from_="from", + to="to", + ) + assert_matches_type(StatisticGetLiveUniqueViewersResponse, statistic, path=["response"]) + + @parametrize + def test_method_get_live_unique_viewers_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_live_unique_viewers( + from_="from", + to="to", + client_user_id=0, + granularity="1m", + stream_id=0, + ) + assert_matches_type(StatisticGetLiveUniqueViewersResponse, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_live_unique_viewers(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_live_unique_viewers( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(StatisticGetLiveUniqueViewersResponse, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_live_unique_viewers(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_live_unique_viewers( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(StatisticGetLiveUniqueViewersResponse, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_live_watch_time_cdn(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_live_watch_time_cdn( + from_="from", + ) + assert_matches_type(StreamSeries, statistic, path=["response"]) + + @parametrize + def test_method_get_live_watch_time_cdn_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_live_watch_time_cdn( + from_="from", + client_user_id=0, + granularity="1m", + stream_id=0, + to="to", + ) + assert_matches_type(StreamSeries, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_live_watch_time_cdn(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_live_watch_time_cdn( + from_="from", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(StreamSeries, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_live_watch_time_cdn(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_live_watch_time_cdn( + from_="from", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(StreamSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_live_watch_time_total_cdn(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_live_watch_time_total_cdn() + assert_matches_type(VodTotalStreamDurationSeries, statistic, path=["response"]) + + @parametrize + def test_method_get_live_watch_time_total_cdn_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_live_watch_time_total_cdn( + client_user_id=0, + from_="from", + stream_id=0, + to="to", + ) + assert_matches_type(VodTotalStreamDurationSeries, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_live_watch_time_total_cdn(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_live_watch_time_total_cdn() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(VodTotalStreamDurationSeries, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_live_watch_time_total_cdn(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_live_watch_time_total_cdn() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(VodTotalStreamDurationSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_max_streams_series(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_max_streams_series( + from_="from", + to="to", + ) + assert_matches_type(MaxStreamSeries, statistic, path=["response"]) + + @parametrize + def test_method_get_max_streams_series_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_max_streams_series( + from_="from", + to="to", + granularity="1m", + ) + assert_matches_type(MaxStreamSeries, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_max_streams_series(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_max_streams_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(MaxStreamSeries, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_max_streams_series(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_max_streams_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(MaxStreamSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_meet_series(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_meet_series( + from_="from", + to="to", + ) + assert_matches_type(MeetSeries, statistic, path=["response"]) + + @parametrize + def test_method_get_meet_series_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_meet_series( + from_="from", + to="to", + granularity="1m", + ) + assert_matches_type(MeetSeries, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_meet_series(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_meet_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(MeetSeries, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_meet_series(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_meet_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(MeetSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_popular_videos(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_popular_videos( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(PopularVideos, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_popular_videos(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_popular_videos( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(PopularVideos, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_popular_videos(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_popular_videos( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(PopularVideos, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_storage_series(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_storage_series( + from_="from", + to="to", + ) + assert_matches_type(StorageSeries, statistic, path=["response"]) + + @parametrize + def test_method_get_storage_series_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_storage_series( + from_="from", + to="to", + granularity="1m", + ) + assert_matches_type(StorageSeries, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_storage_series(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_storage_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(StorageSeries, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_storage_series(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_storage_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(StorageSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_stream_series(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_stream_series( + from_="from", + to="to", + ) + assert_matches_type(StreamSeries, statistic, path=["response"]) + + @parametrize + def test_method_get_stream_series_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_stream_series( + from_="from", + to="to", + granularity="1m", + ) + assert_matches_type(StreamSeries, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_stream_series(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_stream_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(StreamSeries, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_stream_series(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_stream_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(StreamSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_unique_viewers(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_unique_viewers( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(UniqueViewers, statistic, path=["response"]) + + @parametrize + def test_method_get_unique_viewers_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_unique_viewers( + date_from="date_from", + date_to="date_to", + id="id", + country="country", + event="init", + group=["date"], + host="host", + type="live", + ) + assert_matches_type(UniqueViewers, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_unique_viewers(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_unique_viewers( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(UniqueViewers, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_unique_viewers(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_unique_viewers( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(UniqueViewers, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_unique_viewers_cdn(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_unique_viewers_cdn( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + + @parametrize + def test_method_get_unique_viewers_cdn_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_unique_viewers_cdn( + date_from="date_from", + date_to="date_to", + id="id", + type="live", + ) + assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_unique_viewers_cdn(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_unique_viewers_cdn( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_unique_viewers_cdn(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_unique_viewers_cdn( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_views(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_views( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(Views, statistic, path=["response"]) + + @parametrize + def test_method_get_views_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_views( + date_from="date_from", + date_to="date_to", + id="id", + country="country", + event="init", + group=["host"], + host="host", + type="live", + ) + assert_matches_type(Views, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_views(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_views( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(Views, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_views(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_views( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(Views, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_views_by_browsers(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_views_by_browsers( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(ViewsByBrowser, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_views_by_browsers(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_views_by_browsers( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ViewsByBrowser, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_views_by_browsers(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_views_by_browsers( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ViewsByBrowser, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_views_by_country(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_views_by_country( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(ViewsByCountry, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_views_by_country(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_views_by_country( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ViewsByCountry, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_views_by_country(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_views_by_country( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ViewsByCountry, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_views_by_hostname(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_views_by_hostname( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(ViewsByHostname, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_views_by_hostname(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_views_by_hostname( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ViewsByHostname, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_views_by_hostname(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_views_by_hostname( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ViewsByHostname, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_views_by_operating_system(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_views_by_operating_system( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(ViewsByOperatingSystem, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_views_by_operating_system(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_views_by_operating_system( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ViewsByOperatingSystem, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_views_by_operating_system(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_views_by_operating_system( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ViewsByOperatingSystem, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_views_by_referer(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_views_by_referer( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(ViewsByReferer, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_views_by_referer(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_views_by_referer( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ViewsByReferer, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_views_by_referer(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_views_by_referer( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ViewsByReferer, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_views_by_region(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_views_by_region( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(ViewsByRegion, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_views_by_region(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_views_by_region( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ViewsByRegion, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_views_by_region(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_views_by_region( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ViewsByRegion, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_views_heatmap(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_views_heatmap( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + type="live", + ) + assert_matches_type(ViewsHeatmap, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_views_heatmap(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_views_heatmap( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + type="live", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ViewsHeatmap, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_views_heatmap(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_views_heatmap( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + type="live", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ViewsHeatmap, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_vod_storage_volume(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_vod_storage_volume( + from_="from", + to="to", + ) + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_vod_storage_volume(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_vod_storage_volume( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_vod_storage_volume(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_vod_storage_volume( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_vod_transcoding_duration(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_vod_transcoding_duration( + from_="from", + to="to", + ) + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_vod_transcoding_duration(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_vod_transcoding_duration( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_vod_transcoding_duration(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_vod_transcoding_duration( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_vod_unique_viewers_cdn(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_vod_unique_viewers_cdn( + from_="from", + to="to", + ) + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + def test_method_get_vod_unique_viewers_cdn_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_vod_unique_viewers_cdn( + from_="from", + to="to", + client_user_id=0, + granularity="1m", + slug="slug", + ) + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_vod_unique_viewers_cdn(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_vod_unique_viewers_cdn( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_vod_unique_viewers_cdn(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_vod_unique_viewers_cdn( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_vod_watch_time_cdn(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_vod_watch_time_cdn( + from_="from", + ) + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + def test_method_get_vod_watch_time_cdn_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_vod_watch_time_cdn( + from_="from", + client_user_id=0, + granularity="1m", + slug="slug", + to="to", + ) + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_vod_watch_time_cdn(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_vod_watch_time_cdn( + from_="from", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_vod_watch_time_cdn(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_vod_watch_time_cdn( + from_="from", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_vod_watch_time_total_cdn(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_vod_watch_time_total_cdn() + assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + + @parametrize + def test_method_get_vod_watch_time_total_cdn_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_vod_watch_time_total_cdn( + client_user_id=0, + from_="from", + slug="slug", + to="to", + ) + assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_vod_watch_time_total_cdn(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_vod_watch_time_total_cdn() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_vod_watch_time_total_cdn(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_vod_watch_time_total_cdn() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncStatistics: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get_ffprobes(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_ffprobes( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + ) + assert_matches_type(Ffprobes, statistic, path=["response"]) + + @parametrize + async def test_method_get_ffprobes_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_ffprobes( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + interval=0, + units="second", + ) + assert_matches_type(Ffprobes, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_ffprobes(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_ffprobes( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(Ffprobes, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_ffprobes(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_ffprobes( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(Ffprobes, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_live_unique_viewers(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_live_unique_viewers( + from_="from", + to="to", + ) + assert_matches_type(StatisticGetLiveUniqueViewersResponse, statistic, path=["response"]) + + @parametrize + async def test_method_get_live_unique_viewers_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_live_unique_viewers( + from_="from", + to="to", + client_user_id=0, + granularity="1m", + stream_id=0, + ) + assert_matches_type(StatisticGetLiveUniqueViewersResponse, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_live_unique_viewers(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_live_unique_viewers( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(StatisticGetLiveUniqueViewersResponse, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_live_unique_viewers(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_live_unique_viewers( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(StatisticGetLiveUniqueViewersResponse, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_live_watch_time_cdn(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_live_watch_time_cdn( + from_="from", + ) + assert_matches_type(StreamSeries, statistic, path=["response"]) + + @parametrize + async def test_method_get_live_watch_time_cdn_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_live_watch_time_cdn( + from_="from", + client_user_id=0, + granularity="1m", + stream_id=0, + to="to", + ) + assert_matches_type(StreamSeries, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_live_watch_time_cdn(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_live_watch_time_cdn( + from_="from", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(StreamSeries, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_live_watch_time_cdn(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_live_watch_time_cdn( + from_="from", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(StreamSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_live_watch_time_total_cdn(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_live_watch_time_total_cdn() + assert_matches_type(VodTotalStreamDurationSeries, statistic, path=["response"]) + + @parametrize + async def test_method_get_live_watch_time_total_cdn_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_live_watch_time_total_cdn( + client_user_id=0, + from_="from", + stream_id=0, + to="to", + ) + assert_matches_type(VodTotalStreamDurationSeries, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_live_watch_time_total_cdn(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_live_watch_time_total_cdn() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(VodTotalStreamDurationSeries, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_live_watch_time_total_cdn(self, async_client: AsyncGcore) -> None: + async with ( + async_client.streaming.statistics.with_streaming_response.get_live_watch_time_total_cdn() + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(VodTotalStreamDurationSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_max_streams_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_max_streams_series( + from_="from", + to="to", + ) + assert_matches_type(MaxStreamSeries, statistic, path=["response"]) + + @parametrize + async def test_method_get_max_streams_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_max_streams_series( + from_="from", + to="to", + granularity="1m", + ) + assert_matches_type(MaxStreamSeries, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_max_streams_series(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_max_streams_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(MaxStreamSeries, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_max_streams_series(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_max_streams_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(MaxStreamSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_meet_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_meet_series( + from_="from", + to="to", + ) + assert_matches_type(MeetSeries, statistic, path=["response"]) + + @parametrize + async def test_method_get_meet_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_meet_series( + from_="from", + to="to", + granularity="1m", + ) + assert_matches_type(MeetSeries, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_meet_series(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_meet_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(MeetSeries, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_meet_series(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_meet_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(MeetSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_popular_videos(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_popular_videos( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(PopularVideos, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_popular_videos(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_popular_videos( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(PopularVideos, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_popular_videos(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_popular_videos( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(PopularVideos, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_storage_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_storage_series( + from_="from", + to="to", + ) + assert_matches_type(StorageSeries, statistic, path=["response"]) + + @parametrize + async def test_method_get_storage_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_storage_series( + from_="from", + to="to", + granularity="1m", + ) + assert_matches_type(StorageSeries, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_storage_series(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_storage_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(StorageSeries, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_storage_series(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_storage_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(StorageSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_stream_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_stream_series( + from_="from", + to="to", + ) + assert_matches_type(StreamSeries, statistic, path=["response"]) + + @parametrize + async def test_method_get_stream_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_stream_series( + from_="from", + to="to", + granularity="1m", + ) + assert_matches_type(StreamSeries, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_stream_series(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_stream_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(StreamSeries, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_stream_series(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_stream_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(StreamSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_unique_viewers(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_unique_viewers( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(UniqueViewers, statistic, path=["response"]) + + @parametrize + async def test_method_get_unique_viewers_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_unique_viewers( + date_from="date_from", + date_to="date_to", + id="id", + country="country", + event="init", + group=["date"], + host="host", + type="live", + ) + assert_matches_type(UniqueViewers, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_unique_viewers(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_unique_viewers( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(UniqueViewers, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_unique_viewers(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_unique_viewers( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(UniqueViewers, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_unique_viewers_cdn(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_unique_viewers_cdn( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + + @parametrize + async def test_method_get_unique_viewers_cdn_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_unique_viewers_cdn( + date_from="date_from", + date_to="date_to", + id="id", + type="live", + ) + assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_unique_viewers_cdn(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_unique_viewers_cdn( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_unique_viewers_cdn(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_unique_viewers_cdn( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_views(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_views( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(Views, statistic, path=["response"]) + + @parametrize + async def test_method_get_views_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_views( + date_from="date_from", + date_to="date_to", + id="id", + country="country", + event="init", + group=["host"], + host="host", + type="live", + ) + assert_matches_type(Views, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_views(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_views( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(Views, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_views(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_views( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(Views, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_views_by_browsers(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_views_by_browsers( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(ViewsByBrowser, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_views_by_browsers(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_views_by_browsers( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ViewsByBrowser, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_views_by_browsers(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_views_by_browsers( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ViewsByBrowser, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_views_by_country(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_views_by_country( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(ViewsByCountry, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_views_by_country(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_views_by_country( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ViewsByCountry, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_views_by_country(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_views_by_country( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ViewsByCountry, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_views_by_hostname(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_views_by_hostname( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(ViewsByHostname, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_views_by_hostname(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_views_by_hostname( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ViewsByHostname, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_views_by_hostname(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_views_by_hostname( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ViewsByHostname, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_views_by_operating_system(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_views_by_operating_system( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(ViewsByOperatingSystem, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_views_by_operating_system(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_views_by_operating_system( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ViewsByOperatingSystem, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_views_by_operating_system(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_views_by_operating_system( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ViewsByOperatingSystem, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_views_by_referer(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_views_by_referer( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(ViewsByReferer, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_views_by_referer(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_views_by_referer( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ViewsByReferer, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_views_by_referer(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_views_by_referer( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ViewsByReferer, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_views_by_region(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_views_by_region( + date_from="date_from", + date_to="date_to", + ) + assert_matches_type(ViewsByRegion, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_views_by_region(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_views_by_region( + date_from="date_from", + date_to="date_to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ViewsByRegion, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_views_by_region(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_views_by_region( + date_from="date_from", + date_to="date_to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ViewsByRegion, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_views_heatmap(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_views_heatmap( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + type="live", + ) + assert_matches_type(ViewsHeatmap, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_views_heatmap(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_views_heatmap( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + type="live", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ViewsHeatmap, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_views_heatmap(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_views_heatmap( + date_from="date_from", + date_to="date_to", + stream_id="stream_id", + type="live", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ViewsHeatmap, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_vod_storage_volume(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_vod_storage_volume( + from_="from", + to="to", + ) + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_vod_storage_volume(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_vod_storage_volume( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_vod_storage_volume(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_vod_storage_volume( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_vod_transcoding_duration(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_vod_transcoding_duration( + from_="from", + to="to", + ) + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_vod_transcoding_duration(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_vod_transcoding_duration( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_vod_transcoding_duration(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_vod_transcoding_duration( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_vod_unique_viewers_cdn(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_vod_unique_viewers_cdn( + from_="from", + to="to", + ) + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + async def test_method_get_vod_unique_viewers_cdn_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_vod_unique_viewers_cdn( + from_="from", + to="to", + client_user_id=0, + granularity="1m", + slug="slug", + ) + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_vod_unique_viewers_cdn(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_vod_unique_viewers_cdn( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_vod_unique_viewers_cdn(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_vod_unique_viewers_cdn( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_vod_watch_time_cdn(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_vod_watch_time_cdn( + from_="from", + ) + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + async def test_method_get_vod_watch_time_cdn_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_vod_watch_time_cdn( + from_="from", + client_user_id=0, + granularity="1m", + slug="slug", + to="to", + ) + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_vod_watch_time_cdn(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_vod_watch_time_cdn( + from_="from", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_vod_watch_time_cdn(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_vod_watch_time_cdn( + from_="from", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(VodStatisticsSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_vod_watch_time_total_cdn(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_vod_watch_time_total_cdn() + assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + + @parametrize + async def test_method_get_vod_watch_time_total_cdn_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_vod_watch_time_total_cdn( + client_user_id=0, + from_="from", + slug="slug", + to="to", + ) + assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_vod_watch_time_total_cdn(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_vod_watch_time_total_cdn() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_vod_watch_time_total_cdn(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_vod_watch_time_total_cdn() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_streams.py b/tests/api_resources/streaming/test_streams.py new file mode 100644 index 00000000..324be334 --- /dev/null +++ b/tests/api_resources/streaming/test_streams.py @@ -0,0 +1,781 @@ +# 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.pagination import SyncPageStreaming, AsyncPageStreaming +from gcore.types.streaming import ( + Clip, + Video, + Stream, + StreamListClipsResponse, + StreamStartRecordingResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestStreams: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + stream = client.streaming.streams.create( + name="Live stream by user e4d0f942-f35d", + ) + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + stream = client.streaming.streams.create( + name="Live stream by user e4d0f942-f35d", + active=True, + auto_record=False, + broadcast_ids=[0], + cdn_id=0, + client_entity_data="client_entity_data", + client_user_id=1001, + dvr_duration=0, + dvr_enabled=True, + hls_mpegts_endlist_tag=True, + html_overlay=False, + low_latency_enabled=True, + projection="regular", + pull=True, + quality_set_id=0, + record_type="origin", + uri="srt://domain.com:5000/?streamid=12345", + ) + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.streaming.streams.with_raw_response.create( + name="Live stream by user e4d0f942-f35d", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = response.parse() + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.streaming.streams.with_streaming_response.create( + name="Live stream by user e4d0f942-f35d", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = response.parse() + assert_matches_type(Stream, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + stream = client.streaming.streams.update( + stream_id=0, + ) + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + stream = client.streaming.streams.update( + stream_id=0, + stream={ + "name": "Live stream by user e4d0f942-f35d", + "active": True, + "auto_record": False, + "broadcast_ids": [0], + "cdn_id": 0, + "client_entity_data": "client_entity_data", + "client_user_id": 1001, + "dvr_duration": 0, + "dvr_enabled": True, + "hls_mpegts_endlist_tag": True, + "html_overlay": False, + "low_latency_enabled": True, + "projection": "regular", + "pull": True, + "quality_set_id": 0, + "record_type": "origin", + "uri": "srt://domain.com:5000/?streamid=12345", + }, + ) + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.streaming.streams.with_raw_response.update( + stream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = response.parse() + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.streaming.streams.with_streaming_response.update( + stream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = response.parse() + assert_matches_type(Stream, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + stream = client.streaming.streams.list() + assert_matches_type(SyncPageStreaming[Stream], stream, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + stream = client.streaming.streams.list( + page=0, + with_broadcasts=0, + ) + assert_matches_type(SyncPageStreaming[Stream], stream, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.streaming.streams.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = response.parse() + assert_matches_type(SyncPageStreaming[Stream], stream, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.streaming.streams.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = response.parse() + assert_matches_type(SyncPageStreaming[Stream], stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + stream = client.streaming.streams.delete( + 0, + ) + assert stream is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.streaming.streams.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = response.parse() + assert stream is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.streaming.streams.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = response.parse() + assert stream is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_clear_dvr(self, client: Gcore) -> None: + stream = client.streaming.streams.clear_dvr( + 0, + ) + assert stream is None + + @parametrize + def test_raw_response_clear_dvr(self, client: Gcore) -> None: + response = client.streaming.streams.with_raw_response.clear_dvr( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = response.parse() + assert stream is None + + @parametrize + def test_streaming_response_clear_dvr(self, client: Gcore) -> None: + with client.streaming.streams.with_streaming_response.clear_dvr( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = response.parse() + assert stream is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_clip(self, client: Gcore) -> None: + stream = client.streaming.streams.create_clip( + stream_id=0, + duration=0, + ) + assert_matches_type(Clip, stream, path=["response"]) + + @parametrize + def test_method_create_clip_with_all_params(self, client: Gcore) -> None: + stream = client.streaming.streams.create_clip( + stream_id=0, + duration=0, + expiration=0, + start=0, + vod_required=True, + ) + assert_matches_type(Clip, stream, path=["response"]) + + @parametrize + def test_raw_response_create_clip(self, client: Gcore) -> None: + response = client.streaming.streams.with_raw_response.create_clip( + stream_id=0, + duration=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = response.parse() + assert_matches_type(Clip, stream, path=["response"]) + + @parametrize + def test_streaming_response_create_clip(self, client: Gcore) -> None: + with client.streaming.streams.with_streaming_response.create_clip( + stream_id=0, + duration=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = response.parse() + assert_matches_type(Clip, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + stream = client.streaming.streams.get( + 0, + ) + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.streaming.streams.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = response.parse() + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.streaming.streams.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = response.parse() + assert_matches_type(Stream, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_clips(self, client: Gcore) -> None: + stream = client.streaming.streams.list_clips( + 0, + ) + assert_matches_type(StreamListClipsResponse, stream, path=["response"]) + + @parametrize + def test_raw_response_list_clips(self, client: Gcore) -> None: + response = client.streaming.streams.with_raw_response.list_clips( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = response.parse() + assert_matches_type(StreamListClipsResponse, stream, path=["response"]) + + @parametrize + def test_streaming_response_list_clips(self, client: Gcore) -> None: + with client.streaming.streams.with_streaming_response.list_clips( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = response.parse() + assert_matches_type(StreamListClipsResponse, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_start_recording(self, client: Gcore) -> None: + stream = client.streaming.streams.start_recording( + 0, + ) + assert_matches_type(StreamStartRecordingResponse, stream, path=["response"]) + + @parametrize + def test_raw_response_start_recording(self, client: Gcore) -> None: + response = client.streaming.streams.with_raw_response.start_recording( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = response.parse() + assert_matches_type(StreamStartRecordingResponse, stream, path=["response"]) + + @parametrize + def test_streaming_response_start_recording(self, client: Gcore) -> None: + with client.streaming.streams.with_streaming_response.start_recording( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = response.parse() + assert_matches_type(StreamStartRecordingResponse, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_stop_recording(self, client: Gcore) -> None: + stream = client.streaming.streams.stop_recording( + 0, + ) + assert_matches_type(Video, stream, path=["response"]) + + @parametrize + def test_raw_response_stop_recording(self, client: Gcore) -> None: + response = client.streaming.streams.with_raw_response.stop_recording( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = response.parse() + assert_matches_type(Video, stream, path=["response"]) + + @parametrize + def test_streaming_response_stop_recording(self, client: Gcore) -> None: + with client.streaming.streams.with_streaming_response.stop_recording( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = response.parse() + assert_matches_type(Video, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncStreams: + 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: + stream = await async_client.streaming.streams.create( + name="Live stream by user e4d0f942-f35d", + ) + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.create( + name="Live stream by user e4d0f942-f35d", + active=True, + auto_record=False, + broadcast_ids=[0], + cdn_id=0, + client_entity_data="client_entity_data", + client_user_id=1001, + dvr_duration=0, + dvr_enabled=True, + hls_mpegts_endlist_tag=True, + html_overlay=False, + low_latency_enabled=True, + projection="regular", + pull=True, + quality_set_id=0, + record_type="origin", + uri="srt://domain.com:5000/?streamid=12345", + ) + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.with_raw_response.create( + name="Live stream by user e4d0f942-f35d", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = await response.parse() + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.with_streaming_response.create( + name="Live stream by user e4d0f942-f35d", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = await response.parse() + assert_matches_type(Stream, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.update( + stream_id=0, + ) + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.update( + stream_id=0, + stream={ + "name": "Live stream by user e4d0f942-f35d", + "active": True, + "auto_record": False, + "broadcast_ids": [0], + "cdn_id": 0, + "client_entity_data": "client_entity_data", + "client_user_id": 1001, + "dvr_duration": 0, + "dvr_enabled": True, + "hls_mpegts_endlist_tag": True, + "html_overlay": False, + "low_latency_enabled": True, + "projection": "regular", + "pull": True, + "quality_set_id": 0, + "record_type": "origin", + "uri": "srt://domain.com:5000/?streamid=12345", + }, + ) + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.with_raw_response.update( + stream_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = await response.parse() + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.with_streaming_response.update( + stream_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = await response.parse() + assert_matches_type(Stream, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.list() + assert_matches_type(AsyncPageStreaming[Stream], stream, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.list( + page=0, + with_broadcasts=0, + ) + assert_matches_type(AsyncPageStreaming[Stream], stream, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = await response.parse() + assert_matches_type(AsyncPageStreaming[Stream], stream, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = await response.parse() + assert_matches_type(AsyncPageStreaming[Stream], stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.delete( + 0, + ) + assert stream is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = await response.parse() + assert stream is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = await response.parse() + assert stream is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_clear_dvr(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.clear_dvr( + 0, + ) + assert stream is None + + @parametrize + async def test_raw_response_clear_dvr(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.with_raw_response.clear_dvr( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = await response.parse() + assert stream is None + + @parametrize + async def test_streaming_response_clear_dvr(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.with_streaming_response.clear_dvr( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = await response.parse() + assert stream is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_clip(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.create_clip( + stream_id=0, + duration=0, + ) + assert_matches_type(Clip, stream, path=["response"]) + + @parametrize + async def test_method_create_clip_with_all_params(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.create_clip( + stream_id=0, + duration=0, + expiration=0, + start=0, + vod_required=True, + ) + assert_matches_type(Clip, stream, path=["response"]) + + @parametrize + async def test_raw_response_create_clip(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.with_raw_response.create_clip( + stream_id=0, + duration=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = await response.parse() + assert_matches_type(Clip, stream, path=["response"]) + + @parametrize + async def test_streaming_response_create_clip(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.with_streaming_response.create_clip( + stream_id=0, + duration=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = await response.parse() + assert_matches_type(Clip, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.get( + 0, + ) + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = await response.parse() + assert_matches_type(Stream, stream, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = await response.parse() + assert_matches_type(Stream, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_clips(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.list_clips( + 0, + ) + assert_matches_type(StreamListClipsResponse, stream, path=["response"]) + + @parametrize + async def test_raw_response_list_clips(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.with_raw_response.list_clips( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = await response.parse() + assert_matches_type(StreamListClipsResponse, stream, path=["response"]) + + @parametrize + async def test_streaming_response_list_clips(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.with_streaming_response.list_clips( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = await response.parse() + assert_matches_type(StreamListClipsResponse, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_start_recording(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.start_recording( + 0, + ) + assert_matches_type(StreamStartRecordingResponse, stream, path=["response"]) + + @parametrize + async def test_raw_response_start_recording(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.with_raw_response.start_recording( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = await response.parse() + assert_matches_type(StreamStartRecordingResponse, stream, path=["response"]) + + @parametrize + async def test_streaming_response_start_recording(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.with_streaming_response.start_recording( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = await response.parse() + assert_matches_type(StreamStartRecordingResponse, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_stop_recording(self, async_client: AsyncGcore) -> None: + stream = await async_client.streaming.streams.stop_recording( + 0, + ) + assert_matches_type(Video, stream, path=["response"]) + + @parametrize + async def test_raw_response_stop_recording(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.with_raw_response.stop_recording( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + stream = await response.parse() + assert_matches_type(Video, stream, path=["response"]) + + @parametrize + async def test_streaming_response_stop_recording(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.with_streaming_response.stop_recording( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + stream = await response.parse() + assert_matches_type(Video, stream, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_videos.py b/tests/api_resources/streaming/test_videos.py new file mode 100644 index 00000000..a37fa288 --- /dev/null +++ b/tests/api_resources/streaming/test_videos.py @@ -0,0 +1,722 @@ +# 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.pagination import SyncPageStreaming, AsyncPageStreaming +from gcore.types.streaming import ( + Video, + VideoCreateResponse, + DirectUploadParameters, + VideoCreateMultipleResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestVideos: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + video = client.streaming.videos.create() + assert_matches_type(VideoCreateResponse, video, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + video = client.streaming.videos.create( + video={ + "name": "IBC 2025 - International Broadcasting Convention", + "auto_transcribe_audio_language": "auto", + "auto_translate_subtitles_language": "disable", + "client_user_id": 10, + "clip_duration_seconds": 60, + "clip_start_seconds": 137, + "custom_iframe_url": "custom_iframe_url", + "description": "We look forward to welcoming you at IBC2025, which will take place 12-15 September 2025.", + "directory_id": 800, + "origin_http_headers": "Authorization: Bearer ...", + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "poster": "data:image/jpeg;base64,/9j/4AA...qf/2Q==", + "priority": 0, + "projection": "regular", + "quality_set_id": 0, + "remote_poster_url": "remote_poster_url", + "remove_poster": True, + "screenshot_id": -1, + "share_url": "share_url", + "source_bitrate_limit": True, + }, + ) + assert_matches_type(VideoCreateResponse, video, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.streaming.videos.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = response.parse() + assert_matches_type(VideoCreateResponse, video, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.streaming.videos.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = response.parse() + assert_matches_type(VideoCreateResponse, video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + video = client.streaming.videos.update( + video_id=0, + name="IBC 2025 - International Broadcasting Convention", + ) + assert_matches_type(Video, video, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + video = client.streaming.videos.update( + video_id=0, + name="IBC 2025 - International Broadcasting Convention", + auto_transcribe_audio_language="auto", + auto_translate_subtitles_language="disable", + client_user_id=10, + clip_duration_seconds=60, + clip_start_seconds=137, + custom_iframe_url="custom_iframe_url", + description="We look forward to welcoming you at IBC2025, which will take place 12-15 September 2025.", + directory_id=800, + origin_http_headers="Authorization: Bearer ...", + origin_url="https://www.googleapis.com/drive/v3/files/...?alt=media", + poster="data:image/jpeg;base64,/9j/4AA...qf/2Q==", + priority=0, + projection="regular", + quality_set_id=0, + remote_poster_url="remote_poster_url", + remove_poster=True, + screenshot_id=-1, + share_url="share_url", + source_bitrate_limit=True, + ) + assert_matches_type(Video, video, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.streaming.videos.with_raw_response.update( + video_id=0, + name="IBC 2025 - International Broadcasting Convention", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = response.parse() + assert_matches_type(Video, video, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.streaming.videos.with_streaming_response.update( + video_id=0, + name="IBC 2025 - International Broadcasting Convention", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = response.parse() + assert_matches_type(Video, video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + video = client.streaming.videos.list() + assert_matches_type(SyncPageStreaming[Video], video, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + video = client.streaming.videos.list( + id="id", + client_user_id=0, + fields="fields", + page=0, + per_page=0, + search="search", + status="status", + stream_id=0, + ) + assert_matches_type(SyncPageStreaming[Video], video, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.streaming.videos.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = response.parse() + assert_matches_type(SyncPageStreaming[Video], video, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.streaming.videos.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = response.parse() + assert_matches_type(SyncPageStreaming[Video], video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + video = client.streaming.videos.delete( + 0, + ) + assert video is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.streaming.videos.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = response.parse() + assert video is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.streaming.videos.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = response.parse() + assert video is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_multiple(self, client: Gcore) -> None: + video = client.streaming.videos.create_multiple() + assert_matches_type(VideoCreateMultipleResponse, video, path=["response"]) + + @parametrize + def test_method_create_multiple_with_all_params(self, client: Gcore) -> None: + video = client.streaming.videos.create_multiple( + fields="fields", + videos=[ + { + "name": "IBC 2025 - International Broadcasting Convention", + "auto_transcribe_audio_language": "auto", + "auto_translate_subtitles_language": "disable", + "client_user_id": 10, + "clip_duration_seconds": 60, + "clip_start_seconds": 137, + "custom_iframe_url": "custom_iframe_url", + "description": "We look forward to welcoming you at IBC2025, which will take place 12-15 September 2025.", + "directory_id": 800, + "origin_http_headers": "Authorization: Bearer ...", + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "poster": "data:image/jpeg;base64,/9j/4AA...qf/2Q==", + "priority": 0, + "projection": "regular", + "quality_set_id": 0, + "remote_poster_url": "remote_poster_url", + "remove_poster": True, + "screenshot_id": -1, + "share_url": "share_url", + "source_bitrate_limit": True, + "subtitles": [ + { + "language": "eng", + "vtt": "WEBVTT\n\n1\n00:00:07.154 --> 00:00:12.736\nWe have 100 million registered users or active users who play at least once a week.\n\n2\n00:00:13.236 --> 00:00:20.198\nWe might have 80 or 100,000 playing on a given cluster.", + "name": "English (AI-generated)", + }, + { + "language": "ger", + "vtt": "WEBVTT\n\n1\n00:00:07.154 --> 00:00:12.736\nWir haben 100 Millionen registrierte Benutzer oder aktive Benutzer, die mindestens einmal pro Woche spielen.\n\n2\n00:00:13.236 --> 00:00:20.198\nWir haben vielleicht 80 oder 100.000, die auf einem bestimmten Cluster spielen.", + "name": "German (AI-translated)", + }, + ], + } + ], + ) + assert_matches_type(VideoCreateMultipleResponse, video, path=["response"]) + + @parametrize + def test_raw_response_create_multiple(self, client: Gcore) -> None: + response = client.streaming.videos.with_raw_response.create_multiple() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = response.parse() + assert_matches_type(VideoCreateMultipleResponse, video, path=["response"]) + + @parametrize + def test_streaming_response_create_multiple(self, client: Gcore) -> None: + with client.streaming.videos.with_streaming_response.create_multiple() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = response.parse() + assert_matches_type(VideoCreateMultipleResponse, video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + video = client.streaming.videos.get( + 0, + ) + assert_matches_type(Video, video, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.streaming.videos.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = response.parse() + assert_matches_type(Video, video, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.streaming.videos.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = response.parse() + assert_matches_type(Video, video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_parameters_for_direct_upload(self, client: Gcore) -> None: + video = client.streaming.videos.get_parameters_for_direct_upload( + 0, + ) + assert_matches_type(DirectUploadParameters, video, path=["response"]) + + @parametrize + def test_raw_response_get_parameters_for_direct_upload(self, client: Gcore) -> None: + response = client.streaming.videos.with_raw_response.get_parameters_for_direct_upload( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = response.parse() + assert_matches_type(DirectUploadParameters, video, path=["response"]) + + @parametrize + def test_streaming_response_get_parameters_for_direct_upload(self, client: Gcore) -> None: + with client.streaming.videos.with_streaming_response.get_parameters_for_direct_upload( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = response.parse() + assert_matches_type(DirectUploadParameters, video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_names(self, client: Gcore) -> None: + video = client.streaming.videos.list_names() + assert video is None + + @parametrize + def test_method_list_names_with_all_params(self, client: Gcore) -> None: + video = client.streaming.videos.list_names( + ids=[0], + ) + assert video is None + + @parametrize + def test_raw_response_list_names(self, client: Gcore) -> None: + response = client.streaming.videos.with_raw_response.list_names() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = response.parse() + assert video is None + + @parametrize + def test_streaming_response_list_names(self, client: Gcore) -> None: + with client.streaming.videos.with_streaming_response.list_names() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = response.parse() + assert video is None + + assert cast(Any, response.is_closed) is True + + +class TestAsyncVideos: + 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: + video = await async_client.streaming.videos.create() + assert_matches_type(VideoCreateResponse, video, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + video = await async_client.streaming.videos.create( + video={ + "name": "IBC 2025 - International Broadcasting Convention", + "auto_transcribe_audio_language": "auto", + "auto_translate_subtitles_language": "disable", + "client_user_id": 10, + "clip_duration_seconds": 60, + "clip_start_seconds": 137, + "custom_iframe_url": "custom_iframe_url", + "description": "We look forward to welcoming you at IBC2025, which will take place 12-15 September 2025.", + "directory_id": 800, + "origin_http_headers": "Authorization: Bearer ...", + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "poster": "data:image/jpeg;base64,/9j/4AA...qf/2Q==", + "priority": 0, + "projection": "regular", + "quality_set_id": 0, + "remote_poster_url": "remote_poster_url", + "remove_poster": True, + "screenshot_id": -1, + "share_url": "share_url", + "source_bitrate_limit": True, + }, + ) + assert_matches_type(VideoCreateResponse, video, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = await response.parse() + assert_matches_type(VideoCreateResponse, video, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = await response.parse() + assert_matches_type(VideoCreateResponse, video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + video = await async_client.streaming.videos.update( + video_id=0, + name="IBC 2025 - International Broadcasting Convention", + ) + assert_matches_type(Video, video, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + video = await async_client.streaming.videos.update( + video_id=0, + name="IBC 2025 - International Broadcasting Convention", + auto_transcribe_audio_language="auto", + auto_translate_subtitles_language="disable", + client_user_id=10, + clip_duration_seconds=60, + clip_start_seconds=137, + custom_iframe_url="custom_iframe_url", + description="We look forward to welcoming you at IBC2025, which will take place 12-15 September 2025.", + directory_id=800, + origin_http_headers="Authorization: Bearer ...", + origin_url="https://www.googleapis.com/drive/v3/files/...?alt=media", + poster="data:image/jpeg;base64,/9j/4AA...qf/2Q==", + priority=0, + projection="regular", + quality_set_id=0, + remote_poster_url="remote_poster_url", + remove_poster=True, + screenshot_id=-1, + share_url="share_url", + source_bitrate_limit=True, + ) + assert_matches_type(Video, video, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.with_raw_response.update( + video_id=0, + name="IBC 2025 - International Broadcasting Convention", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = await response.parse() + assert_matches_type(Video, video, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.with_streaming_response.update( + video_id=0, + name="IBC 2025 - International Broadcasting Convention", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = await response.parse() + assert_matches_type(Video, video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + video = await async_client.streaming.videos.list() + assert_matches_type(AsyncPageStreaming[Video], video, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + video = await async_client.streaming.videos.list( + id="id", + client_user_id=0, + fields="fields", + page=0, + per_page=0, + search="search", + status="status", + stream_id=0, + ) + assert_matches_type(AsyncPageStreaming[Video], video, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = await response.parse() + assert_matches_type(AsyncPageStreaming[Video], video, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = await response.parse() + assert_matches_type(AsyncPageStreaming[Video], video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + video = await async_client.streaming.videos.delete( + 0, + ) + assert video is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = await response.parse() + assert video is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = await response.parse() + assert video is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_multiple(self, async_client: AsyncGcore) -> None: + video = await async_client.streaming.videos.create_multiple() + assert_matches_type(VideoCreateMultipleResponse, video, path=["response"]) + + @parametrize + async def test_method_create_multiple_with_all_params(self, async_client: AsyncGcore) -> None: + video = await async_client.streaming.videos.create_multiple( + fields="fields", + videos=[ + { + "name": "IBC 2025 - International Broadcasting Convention", + "auto_transcribe_audio_language": "auto", + "auto_translate_subtitles_language": "disable", + "client_user_id": 10, + "clip_duration_seconds": 60, + "clip_start_seconds": 137, + "custom_iframe_url": "custom_iframe_url", + "description": "We look forward to welcoming you at IBC2025, which will take place 12-15 September 2025.", + "directory_id": 800, + "origin_http_headers": "Authorization: Bearer ...", + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "poster": "data:image/jpeg;base64,/9j/4AA...qf/2Q==", + "priority": 0, + "projection": "regular", + "quality_set_id": 0, + "remote_poster_url": "remote_poster_url", + "remove_poster": True, + "screenshot_id": -1, + "share_url": "share_url", + "source_bitrate_limit": True, + "subtitles": [ + { + "language": "eng", + "vtt": "WEBVTT\n\n1\n00:00:07.154 --> 00:00:12.736\nWe have 100 million registered users or active users who play at least once a week.\n\n2\n00:00:13.236 --> 00:00:20.198\nWe might have 80 or 100,000 playing on a given cluster.", + "name": "English (AI-generated)", + }, + { + "language": "ger", + "vtt": "WEBVTT\n\n1\n00:00:07.154 --> 00:00:12.736\nWir haben 100 Millionen registrierte Benutzer oder aktive Benutzer, die mindestens einmal pro Woche spielen.\n\n2\n00:00:13.236 --> 00:00:20.198\nWir haben vielleicht 80 oder 100.000, die auf einem bestimmten Cluster spielen.", + "name": "German (AI-translated)", + }, + ], + } + ], + ) + assert_matches_type(VideoCreateMultipleResponse, video, path=["response"]) + + @parametrize + async def test_raw_response_create_multiple(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.with_raw_response.create_multiple() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = await response.parse() + assert_matches_type(VideoCreateMultipleResponse, video, path=["response"]) + + @parametrize + async def test_streaming_response_create_multiple(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.with_streaming_response.create_multiple() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = await response.parse() + assert_matches_type(VideoCreateMultipleResponse, video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + video = await async_client.streaming.videos.get( + 0, + ) + assert_matches_type(Video, video, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = await response.parse() + assert_matches_type(Video, video, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = await response.parse() + assert_matches_type(Video, video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_parameters_for_direct_upload(self, async_client: AsyncGcore) -> None: + video = await async_client.streaming.videos.get_parameters_for_direct_upload( + 0, + ) + assert_matches_type(DirectUploadParameters, video, path=["response"]) + + @parametrize + async def test_raw_response_get_parameters_for_direct_upload(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.with_raw_response.get_parameters_for_direct_upload( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = await response.parse() + assert_matches_type(DirectUploadParameters, video, path=["response"]) + + @parametrize + async def test_streaming_response_get_parameters_for_direct_upload(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.with_streaming_response.get_parameters_for_direct_upload( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = await response.parse() + assert_matches_type(DirectUploadParameters, video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_names(self, async_client: AsyncGcore) -> None: + video = await async_client.streaming.videos.list_names() + assert video is None + + @parametrize + async def test_method_list_names_with_all_params(self, async_client: AsyncGcore) -> None: + video = await async_client.streaming.videos.list_names( + ids=[0], + ) + assert video is None + + @parametrize + async def test_raw_response_list_names(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.with_raw_response.list_names() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = await response.parse() + assert video is None + + @parametrize + async def test_streaming_response_list_names(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.with_streaming_response.list_names() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = await response.parse() + assert video is None + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/videos/__init__.py b/tests/api_resources/streaming/videos/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/streaming/videos/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/streaming/videos/test_subtitles.py b/tests/api_resources/streaming/videos/test_subtitles.py new file mode 100644 index 00000000..8997ab5b --- /dev/null +++ b/tests/api_resources/streaming/videos/test_subtitles.py @@ -0,0 +1,409 @@ +# 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.streaming import Subtitle, SubtitleBase +from gcore.types.streaming.videos import SubtitleListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSubtitles: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + subtitle = client.streaming.videos.subtitles.create( + video_id=0, + body={}, + ) + assert_matches_type(Subtitle, subtitle, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + subtitle = client.streaming.videos.subtitles.create( + video_id=0, + body={ + "language": "language", + "name": "German (AI-generated)", + "vtt": "WEBVTT\n\n1\n00:00:07.154 --> 00:00:12.736\nWir haben 100 Millionen registrierte Benutzer oder aktive Benutzer, die mindestens einmal pro Woche spielen.\n\n2\n00:00:13.236 --> 00:00:20.198\nWir haben vielleicht 80 oder 100.000, die auf einem bestimmten Cluster spielen.", + "auto_transcribe_audio_language": "auto", + "auto_translate_subtitles_language": "default", + }, + ) + assert_matches_type(Subtitle, subtitle, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.streaming.videos.subtitles.with_raw_response.create( + video_id=0, + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subtitle = response.parse() + assert_matches_type(Subtitle, subtitle, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.streaming.videos.subtitles.with_streaming_response.create( + video_id=0, + body={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subtitle = response.parse() + assert_matches_type(Subtitle, subtitle, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + subtitle = client.streaming.videos.subtitles.update( + id=0, + video_id=0, + ) + assert_matches_type(SubtitleBase, subtitle, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + subtitle = client.streaming.videos.subtitles.update( + id=0, + video_id=0, + language="ltz", + name="name", + vtt="vtt", + ) + assert_matches_type(SubtitleBase, subtitle, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.streaming.videos.subtitles.with_raw_response.update( + id=0, + video_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subtitle = response.parse() + assert_matches_type(SubtitleBase, subtitle, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.streaming.videos.subtitles.with_streaming_response.update( + id=0, + video_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subtitle = response.parse() + assert_matches_type(SubtitleBase, subtitle, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + subtitle = client.streaming.videos.subtitles.list( + 0, + ) + assert_matches_type(SubtitleListResponse, subtitle, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.streaming.videos.subtitles.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subtitle = response.parse() + assert_matches_type(SubtitleListResponse, subtitle, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.streaming.videos.subtitles.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subtitle = response.parse() + assert_matches_type(SubtitleListResponse, subtitle, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + subtitle = client.streaming.videos.subtitles.delete( + id=0, + video_id=0, + ) + assert subtitle is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.streaming.videos.subtitles.with_raw_response.delete( + id=0, + video_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subtitle = response.parse() + assert subtitle is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.streaming.videos.subtitles.with_streaming_response.delete( + id=0, + video_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subtitle = response.parse() + assert subtitle is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + subtitle = client.streaming.videos.subtitles.get( + id=0, + video_id=0, + ) + assert_matches_type(Subtitle, subtitle, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.streaming.videos.subtitles.with_raw_response.get( + id=0, + video_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subtitle = response.parse() + assert_matches_type(Subtitle, subtitle, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.streaming.videos.subtitles.with_streaming_response.get( + id=0, + video_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subtitle = response.parse() + assert_matches_type(Subtitle, subtitle, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncSubtitles: + 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: + subtitle = await async_client.streaming.videos.subtitles.create( + video_id=0, + body={}, + ) + assert_matches_type(Subtitle, subtitle, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + subtitle = await async_client.streaming.videos.subtitles.create( + video_id=0, + body={ + "language": "language", + "name": "German (AI-generated)", + "vtt": "WEBVTT\n\n1\n00:00:07.154 --> 00:00:12.736\nWir haben 100 Millionen registrierte Benutzer oder aktive Benutzer, die mindestens einmal pro Woche spielen.\n\n2\n00:00:13.236 --> 00:00:20.198\nWir haben vielleicht 80 oder 100.000, die auf einem bestimmten Cluster spielen.", + "auto_transcribe_audio_language": "auto", + "auto_translate_subtitles_language": "default", + }, + ) + assert_matches_type(Subtitle, subtitle, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.subtitles.with_raw_response.create( + video_id=0, + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subtitle = await response.parse() + assert_matches_type(Subtitle, subtitle, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.subtitles.with_streaming_response.create( + video_id=0, + body={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subtitle = await response.parse() + assert_matches_type(Subtitle, subtitle, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + subtitle = await async_client.streaming.videos.subtitles.update( + id=0, + video_id=0, + ) + assert_matches_type(SubtitleBase, subtitle, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + subtitle = await async_client.streaming.videos.subtitles.update( + id=0, + video_id=0, + language="ltz", + name="name", + vtt="vtt", + ) + assert_matches_type(SubtitleBase, subtitle, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.subtitles.with_raw_response.update( + id=0, + video_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subtitle = await response.parse() + assert_matches_type(SubtitleBase, subtitle, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.subtitles.with_streaming_response.update( + id=0, + video_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subtitle = await response.parse() + assert_matches_type(SubtitleBase, subtitle, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + subtitle = await async_client.streaming.videos.subtitles.list( + 0, + ) + assert_matches_type(SubtitleListResponse, subtitle, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.subtitles.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subtitle = await response.parse() + assert_matches_type(SubtitleListResponse, subtitle, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.subtitles.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subtitle = await response.parse() + assert_matches_type(SubtitleListResponse, subtitle, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + subtitle = await async_client.streaming.videos.subtitles.delete( + id=0, + video_id=0, + ) + assert subtitle is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.subtitles.with_raw_response.delete( + id=0, + video_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subtitle = await response.parse() + assert subtitle is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.subtitles.with_streaming_response.delete( + id=0, + video_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subtitle = await response.parse() + assert subtitle is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + subtitle = await async_client.streaming.videos.subtitles.get( + id=0, + video_id=0, + ) + assert_matches_type(Subtitle, subtitle, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.videos.subtitles.with_raw_response.get( + id=0, + video_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + subtitle = await response.parse() + assert_matches_type(Subtitle, subtitle, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.videos.subtitles.with_streaming_response.get( + id=0, + video_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + subtitle = await response.parse() + assert_matches_type(Subtitle, subtitle, path=["response"]) + + assert cast(Any, response.is_closed) is True From 6abeabe53bf956fd98b88aa755a2b5eeeba70d48 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Jul 2025 15:16:28 +0000 Subject: [PATCH 219/592] feat(cloud): add cost and usage reports --- .stats.yml | 4 +- api.md | 26 + src/gcore/resources/cloud/__init__.py | 28 + src/gcore/resources/cloud/cloud.py | 64 + src/gcore/resources/cloud/cost_reports.py | 811 +++++++++ src/gcore/resources/cloud/usage_reports.py | 337 ++++ src/gcore/types/cloud/__init__.py | 10 + .../types/cloud/cost_report_aggregated.py | 865 +++++++++ .../cloud/cost_report_aggregated_monthly.py | 865 +++++++++ src/gcore/types/cloud/cost_report_detailed.py | 1343 ++++++++++++++ ...st_report_get_aggregated_monthly_params.py | 394 ++++ .../cost_report_get_aggregated_params.py | 409 +++++ .../cloud/cost_report_get_detailed_params.py | 435 +++++ src/gcore/types/cloud/usage_report.py | 1612 +++++++++++++++++ .../types/cloud/usage_report_get_params.py | 432 +++++ .../api_resources/cloud/test_cost_reports.py | 453 +++++ .../api_resources/cloud/test_usage_reports.py | 183 ++ 17 files changed, 8269 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/cost_reports.py create mode 100644 src/gcore/resources/cloud/usage_reports.py create mode 100644 src/gcore/types/cloud/cost_report_aggregated.py create mode 100644 src/gcore/types/cloud/cost_report_aggregated_monthly.py create mode 100644 src/gcore/types/cloud/cost_report_detailed.py create mode 100644 src/gcore/types/cloud/cost_report_get_aggregated_monthly_params.py create mode 100644 src/gcore/types/cloud/cost_report_get_aggregated_params.py create mode 100644 src/gcore/types/cloud/cost_report_get_detailed_params.py create mode 100644 src/gcore/types/cloud/usage_report.py create mode 100644 src/gcore/types/cloud/usage_report_get_params.py create mode 100644 tests/api_resources/cloud/test_cost_reports.py create mode 100644 tests/api_resources/cloud/test_usage_reports.py diff --git a/.stats.yml b/.stats.yml index 4ef1d6ee..e53dc8ff 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 431 +configured_endpoints: 435 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e9b9e784385ee4f4b68bedb15549bbbaa0324481e8198b1c1b94ebd172bb852b.yml openapi_spec_hash: cb6a5fd0fb6675937c1e0de8e103de78 -config_hash: f0f3b5359ac6d0b436c731c6a0667965 +config_hash: daaf9739c48a00883985847ba3e6a2a0 diff --git a/api.md b/api.md index 060d64bb..af3383ee 100644 --- a/api.md +++ b/api.md @@ -872,6 +872,32 @@ Methods: - client.cloud.audit_logs.list(\*\*params) -> SyncOffsetPage[AuditLogEntry] +## CostReports + +Types: + +```python +from gcore.types.cloud import CostReportAggregated, CostReportAggregatedMonthly, CostReportDetailed +``` + +Methods: + +- client.cloud.cost_reports.get_aggregated(\*\*params) -> CostReportAggregated +- client.cloud.cost_reports.get_aggregated_monthly(\*\*params) -> CostReportAggregatedMonthly +- client.cloud.cost_reports.get_detailed(\*\*params) -> CostReportDetailed + +## UsageReports + +Types: + +```python +from gcore.types.cloud import UsageReport +``` + +Methods: + +- client.cloud.usage_reports.get(\*\*params) -> UsageReport + # Waap Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 4529d9e8..f77715a6 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -136,6 +136,14 @@ FileSharesResourceWithStreamingResponse, AsyncFileSharesResourceWithStreamingResponse, ) +from .cost_reports import ( + CostReportsResource, + AsyncCostReportsResource, + CostReportsResourceWithRawResponse, + AsyncCostReportsResourceWithRawResponse, + CostReportsResourceWithStreamingResponse, + AsyncCostReportsResourceWithStreamingResponse, +) from .floating_ips import ( FloatingIPsResource, AsyncFloatingIPsResource, @@ -144,6 +152,14 @@ FloatingIPsResourceWithStreamingResponse, AsyncFloatingIPsResourceWithStreamingResponse, ) +from .usage_reports import ( + UsageReportsResource, + AsyncUsageReportsResource, + UsageReportsResourceWithRawResponse, + AsyncUsageReportsResourceWithRawResponse, + UsageReportsResourceWithStreamingResponse, + AsyncUsageReportsResourceWithStreamingResponse, +) from .load_balancers import ( LoadBalancersResource, AsyncLoadBalancersResource, @@ -332,6 +348,18 @@ "AsyncAuditLogsResourceWithRawResponse", "AuditLogsResourceWithStreamingResponse", "AsyncAuditLogsResourceWithStreamingResponse", + "CostReportsResource", + "AsyncCostReportsResource", + "CostReportsResourceWithRawResponse", + "AsyncCostReportsResourceWithRawResponse", + "CostReportsResourceWithStreamingResponse", + "AsyncCostReportsResourceWithStreamingResponse", + "UsageReportsResource", + "AsyncUsageReportsResource", + "UsageReportsResourceWithRawResponse", + "AsyncUsageReportsResourceWithRawResponse", + "UsageReportsResourceWithStreamingResponse", + "AsyncUsageReportsResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index c74fbd97..3dc3eb32 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -76,6 +76,14 @@ UsersResourceWithStreamingResponse, AsyncUsersResourceWithStreamingResponse, ) +from .cost_reports import ( + CostReportsResource, + AsyncCostReportsResource, + CostReportsResourceWithRawResponse, + AsyncCostReportsResourceWithRawResponse, + CostReportsResourceWithStreamingResponse, + AsyncCostReportsResourceWithStreamingResponse, +) from .floating_ips import ( FloatingIPsResource, AsyncFloatingIPsResource, @@ -92,6 +100,14 @@ QuotasResourceWithStreamingResponse, AsyncQuotasResourceWithStreamingResponse, ) +from .usage_reports import ( + UsageReportsResource, + AsyncUsageReportsResource, + UsageReportsResourceWithRawResponse, + AsyncUsageReportsResourceWithRawResponse, + UsageReportsResourceWithStreamingResponse, + AsyncUsageReportsResourceWithStreamingResponse, +) from .placement_groups import ( PlacementGroupsResource, AsyncPlacementGroupsResource, @@ -285,6 +301,14 @@ def instances(self) -> InstancesResource: def audit_logs(self) -> AuditLogsResource: return AuditLogsResource(self._client) + @cached_property + def cost_reports(self) -> CostReportsResource: + return CostReportsResource(self._client) + + @cached_property + def usage_reports(self) -> UsageReportsResource: + return UsageReportsResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -398,6 +422,14 @@ def instances(self) -> AsyncInstancesResource: def audit_logs(self) -> AsyncAuditLogsResource: return AsyncAuditLogsResource(self._client) + @cached_property + def cost_reports(self) -> AsyncCostReportsResource: + return AsyncCostReportsResource(self._client) + + @cached_property + def usage_reports(self) -> AsyncUsageReportsResource: + return AsyncUsageReportsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -514,6 +546,14 @@ def instances(self) -> InstancesResourceWithRawResponse: def audit_logs(self) -> AuditLogsResourceWithRawResponse: return AuditLogsResourceWithRawResponse(self._cloud.audit_logs) + @cached_property + def cost_reports(self) -> CostReportsResourceWithRawResponse: + return CostReportsResourceWithRawResponse(self._cloud.cost_reports) + + @cached_property + def usage_reports(self) -> UsageReportsResourceWithRawResponse: + return UsageReportsResourceWithRawResponse(self._cloud.usage_reports) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -611,6 +651,14 @@ def instances(self) -> AsyncInstancesResourceWithRawResponse: def audit_logs(self) -> AsyncAuditLogsResourceWithRawResponse: return AsyncAuditLogsResourceWithRawResponse(self._cloud.audit_logs) + @cached_property + def cost_reports(self) -> AsyncCostReportsResourceWithRawResponse: + return AsyncCostReportsResourceWithRawResponse(self._cloud.cost_reports) + + @cached_property + def usage_reports(self) -> AsyncUsageReportsResourceWithRawResponse: + return AsyncUsageReportsResourceWithRawResponse(self._cloud.usage_reports) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -708,6 +756,14 @@ def instances(self) -> InstancesResourceWithStreamingResponse: def audit_logs(self) -> AuditLogsResourceWithStreamingResponse: return AuditLogsResourceWithStreamingResponse(self._cloud.audit_logs) + @cached_property + def cost_reports(self) -> CostReportsResourceWithStreamingResponse: + return CostReportsResourceWithStreamingResponse(self._cloud.cost_reports) + + @cached_property + def usage_reports(self) -> UsageReportsResourceWithStreamingResponse: + return UsageReportsResourceWithStreamingResponse(self._cloud.usage_reports) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -804,3 +860,11 @@ def instances(self) -> AsyncInstancesResourceWithStreamingResponse: @cached_property def audit_logs(self) -> AsyncAuditLogsResourceWithStreamingResponse: return AsyncAuditLogsResourceWithStreamingResponse(self._cloud.audit_logs) + + @cached_property + def cost_reports(self) -> AsyncCostReportsResourceWithStreamingResponse: + return AsyncCostReportsResourceWithStreamingResponse(self._cloud.cost_reports) + + @cached_property + def usage_reports(self) -> AsyncUsageReportsResourceWithStreamingResponse: + return AsyncUsageReportsResourceWithStreamingResponse(self._cloud.usage_reports) diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py new file mode 100644 index 00000000..63636c99 --- /dev/null +++ b/src/gcore/resources/cloud/cost_reports.py @@ -0,0 +1,811 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cloud import ( + cost_report_get_detailed_params, + cost_report_get_aggregated_params, + cost_report_get_aggregated_monthly_params, +) +from ..._base_client import make_request_options +from ...types.cloud.cost_report_detailed import CostReportDetailed +from ...types.cloud.cost_report_aggregated import CostReportAggregated +from ...types.cloud.cost_report_aggregated_monthly import CostReportAggregatedMonthly + +__all__ = ["CostReportsResource", "AsyncCostReportsResource"] + + +class CostReportsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CostReportsResourceWithRawResponse: + """ + 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 CostReportsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CostReportsResourceWithStreamingResponse: + """ + 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 CostReportsResourceWithStreamingResponse(self) + + def get_aggregated( + self, + *, + time_from: Union[str, datetime], + time_to: Union[str, datetime], + enable_last_day: bool | NotGiven = NOT_GIVEN, + projects: Iterable[int] | NotGiven = NOT_GIVEN, + regions: Iterable[int] | NotGiven = NOT_GIVEN, + response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, + schema_filter: cost_report_get_aggregated_params.SchemaFilter | NotGiven = NOT_GIVEN, + tags: cost_report_get_aggregated_params.Tags | NotGiven = NOT_GIVEN, + types: List[ + Literal[ + "ai_cluster", + "ai_virtual_cluster", + "backup", + "baremetal", + "basic_vm", + "containers", + "dbaas_postgresql_connection_pooler", + "dbaas_postgresql_cpu", + "dbaas_postgresql_memory", + "dbaas_postgresql_public_network", + "dbaas_postgresql_volume", + "egress_traffic", + "external_ip", + "file_share", + "floatingip", + "functions", + "functions_calls", + "functions_traffic", + "image", + "inference", + "instance", + "load_balancer", + "log_index", + "snapshot", + "volume", + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CostReportAggregated: + """Get cost report totals (aggregated costs) for a given period. + + Requested period + should not exceed 31 days. Note: This report assumes there are no active commit + features in the billing plan. If there are active commit features (pre-paid + resources) in your plan, use /v1/`reservation_cost_report`/totals, as the + results from this report will not be accurate. Receiving data from the past hour + might lead to incomplete statistics. For the most accurate data, we recommend + accessing the statistics after at least one hour. Typically, updates are + available within a 24-hour period, although the frequency can vary. Maintenance + periods or other exceptions may cause delays, potentially extending beyond 24 + hours until the servers are back online and the missing data is filled in. + + Args: + time_from: The start date of the report period (ISO 8601). The report starts from the + beginning of this day. + + time_to: The end date of the report period (ISO 8601). The report ends just before the + beginning of this day. + + enable_last_day: Expenses for the last specified day are taken into account. As the default, + False. + + projects: List of project IDs + + regions: List of region IDs. + + response_format: Format of the response (csv or json). + + schema_filter: Extended filter for field filtering. + + tags: Filter by tags + + types: List of resource types to be filtered in the report. + + 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( + "/cloud/v1/cost_report/totals", + body=maybe_transform( + { + "time_from": time_from, + "time_to": time_to, + "enable_last_day": enable_last_day, + "projects": projects, + "regions": regions, + "response_format": response_format, + "schema_filter": schema_filter, + "tags": tags, + "types": types, + }, + cost_report_get_aggregated_params.CostReportGetAggregatedParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CostReportAggregated, + ) + + def get_aggregated_monthly( + self, + *, + time_from: Union[str, datetime], + time_to: Union[str, datetime], + regions: Iterable[int] | NotGiven = NOT_GIVEN, + response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, + schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | NotGiven = NOT_GIVEN, + tags: cost_report_get_aggregated_monthly_params.Tags | NotGiven = NOT_GIVEN, + types: List[ + Literal[ + "ai_cluster", + "ai_virtual_cluster", + "backup", + "baremetal", + "basic_vm", + "containers", + "dbaas_postgresql_connection_pooler", + "dbaas_postgresql_cpu", + "dbaas_postgresql_memory", + "dbaas_postgresql_public_network", + "dbaas_postgresql_volume", + "egress_traffic", + "external_ip", + "file_share", + "floatingip", + "functions", + "functions_calls", + "functions_traffic", + "image", + "inference", + "instance", + "load_balancer", + "log_index", + "snapshot", + "volume", + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CostReportAggregatedMonthly: + """ + Retrieve a detailed cost report totals for a specified month, which includes + both commit and pay-as-you-go (overcommit) prices. Additionally, it provides the + spent billing units (e.g., hours or GB) for resources. The "`time_to`" parameter + represents all days in the specified month. Receiving data from the past hour + might lead to incomplete statistics. For the most accurate data, we recommend + accessing the statistics after at least one hour. Typically, updates are + available within a 24-hour period, although the frequency can vary. Maintenance + periods or other exceptions may cause delays, potentially extending beyond 24 + hours until the servers are back online and the missing data is filled in. + + Args: + time_from: Beginning of the period: YYYY-mm + + time_to: End of the period: YYYY-mm + + regions: List of region IDs. + + response_format: Format of the response (`csv_totals` or json). + + schema_filter: Extended filter for field filtering. + + tags: Filter by tags + + types: List of resource types to be filtered in the report. + + 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( + "/cloud/v1/reservation_cost_report/totals", + body=maybe_transform( + { + "time_from": time_from, + "time_to": time_to, + "regions": regions, + "response_format": response_format, + "schema_filter": schema_filter, + "tags": tags, + "types": types, + }, + cost_report_get_aggregated_monthly_params.CostReportGetAggregatedMonthlyParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CostReportAggregatedMonthly, + ) + + def get_detailed( + self, + *, + time_from: Union[str, datetime], + time_to: Union[str, datetime], + enable_last_day: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + projects: Iterable[int] | NotGiven = NOT_GIVEN, + regions: Iterable[int] | NotGiven = NOT_GIVEN, + response_format: Literal["csv_records", "json"] | NotGiven = NOT_GIVEN, + schema_filter: cost_report_get_detailed_params.SchemaFilter | NotGiven = NOT_GIVEN, + sorting: Iterable[cost_report_get_detailed_params.Sorting] | NotGiven = NOT_GIVEN, + tags: cost_report_get_detailed_params.Tags | NotGiven = NOT_GIVEN, + types: List[ + Literal[ + "ai_cluster", + "ai_virtual_cluster", + "backup", + "baremetal", + "basic_vm", + "containers", + "dbaas_postgresql_connection_pooler", + "dbaas_postgresql_cpu", + "dbaas_postgresql_memory", + "dbaas_postgresql_public_network", + "dbaas_postgresql_volume", + "egress_traffic", + "external_ip", + "file_share", + "floatingip", + "functions", + "functions_calls", + "functions_traffic", + "image", + "inference", + "instance", + "load_balancer", + "log_index", + "snapshot", + "volume", + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CostReportDetailed: + """Get a detailed cost report for a given period and specific resources. + + Requested + period should not exceed 31 days. Note: This report assumes there are no active + commit features in the billing plan. If there are active commit features + (pre-paid resources) in your plan, use /v1/`reservation_cost_report`/totals, as + the results from this report will not be accurate. Receiving data from the past + hour might lead to incomplete statistics. For the most accurate data, we + recommend accessing the statistics after at least one hour. Typically, updates + are available within a 24-hour period, although the frequency can vary. + Maintenance periods or other exceptions may cause delays, potentially extending + beyond 24 hours until the servers are back online and the missing data is filled + in. + + Args: + time_from: The start date of the report period (ISO 8601). The report starts from the + beginning of this day. + + time_to: The end date of the report period (ISO 8601). The report ends just before the + beginning of this day. + + enable_last_day: Expenses for the last specified day are taken into account. As the default, + False. + + limit: The response resources limit. Defaults to 10. + + offset: The response resources offset. + + projects: List of project IDs + + regions: List of region IDs. + + response_format: Format of the response (csv or json). + + schema_filter: Extended filter for field filtering. + + sorting: List of sorting filters (JSON objects) fields: project. directions: asc, desc. + + tags: Filter by tags + + types: List of resource types to be filtered in the report. + + 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( + "/cloud/v1/cost_report/resources", + body=maybe_transform( + { + "time_from": time_from, + "time_to": time_to, + "enable_last_day": enable_last_day, + "limit": limit, + "offset": offset, + "projects": projects, + "regions": regions, + "response_format": response_format, + "schema_filter": schema_filter, + "sorting": sorting, + "tags": tags, + "types": types, + }, + cost_report_get_detailed_params.CostReportGetDetailedParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CostReportDetailed, + ) + + +class AsyncCostReportsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCostReportsResourceWithRawResponse: + """ + 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 AsyncCostReportsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCostReportsResourceWithStreamingResponse: + """ + 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 AsyncCostReportsResourceWithStreamingResponse(self) + + async def get_aggregated( + self, + *, + time_from: Union[str, datetime], + time_to: Union[str, datetime], + enable_last_day: bool | NotGiven = NOT_GIVEN, + projects: Iterable[int] | NotGiven = NOT_GIVEN, + regions: Iterable[int] | NotGiven = NOT_GIVEN, + response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, + schema_filter: cost_report_get_aggregated_params.SchemaFilter | NotGiven = NOT_GIVEN, + tags: cost_report_get_aggregated_params.Tags | NotGiven = NOT_GIVEN, + types: List[ + Literal[ + "ai_cluster", + "ai_virtual_cluster", + "backup", + "baremetal", + "basic_vm", + "containers", + "dbaas_postgresql_connection_pooler", + "dbaas_postgresql_cpu", + "dbaas_postgresql_memory", + "dbaas_postgresql_public_network", + "dbaas_postgresql_volume", + "egress_traffic", + "external_ip", + "file_share", + "floatingip", + "functions", + "functions_calls", + "functions_traffic", + "image", + "inference", + "instance", + "load_balancer", + "log_index", + "snapshot", + "volume", + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CostReportAggregated: + """Get cost report totals (aggregated costs) for a given period. + + Requested period + should not exceed 31 days. Note: This report assumes there are no active commit + features in the billing plan. If there are active commit features (pre-paid + resources) in your plan, use /v1/`reservation_cost_report`/totals, as the + results from this report will not be accurate. Receiving data from the past hour + might lead to incomplete statistics. For the most accurate data, we recommend + accessing the statistics after at least one hour. Typically, updates are + available within a 24-hour period, although the frequency can vary. Maintenance + periods or other exceptions may cause delays, potentially extending beyond 24 + hours until the servers are back online and the missing data is filled in. + + Args: + time_from: The start date of the report period (ISO 8601). The report starts from the + beginning of this day. + + time_to: The end date of the report period (ISO 8601). The report ends just before the + beginning of this day. + + enable_last_day: Expenses for the last specified day are taken into account. As the default, + False. + + projects: List of project IDs + + regions: List of region IDs. + + response_format: Format of the response (csv or json). + + schema_filter: Extended filter for field filtering. + + tags: Filter by tags + + types: List of resource types to be filtered in the report. + + 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( + "/cloud/v1/cost_report/totals", + body=await async_maybe_transform( + { + "time_from": time_from, + "time_to": time_to, + "enable_last_day": enable_last_day, + "projects": projects, + "regions": regions, + "response_format": response_format, + "schema_filter": schema_filter, + "tags": tags, + "types": types, + }, + cost_report_get_aggregated_params.CostReportGetAggregatedParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CostReportAggregated, + ) + + async def get_aggregated_monthly( + self, + *, + time_from: Union[str, datetime], + time_to: Union[str, datetime], + regions: Iterable[int] | NotGiven = NOT_GIVEN, + response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, + schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | NotGiven = NOT_GIVEN, + tags: cost_report_get_aggregated_monthly_params.Tags | NotGiven = NOT_GIVEN, + types: List[ + Literal[ + "ai_cluster", + "ai_virtual_cluster", + "backup", + "baremetal", + "basic_vm", + "containers", + "dbaas_postgresql_connection_pooler", + "dbaas_postgresql_cpu", + "dbaas_postgresql_memory", + "dbaas_postgresql_public_network", + "dbaas_postgresql_volume", + "egress_traffic", + "external_ip", + "file_share", + "floatingip", + "functions", + "functions_calls", + "functions_traffic", + "image", + "inference", + "instance", + "load_balancer", + "log_index", + "snapshot", + "volume", + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CostReportAggregatedMonthly: + """ + Retrieve a detailed cost report totals for a specified month, which includes + both commit and pay-as-you-go (overcommit) prices. Additionally, it provides the + spent billing units (e.g., hours or GB) for resources. The "`time_to`" parameter + represents all days in the specified month. Receiving data from the past hour + might lead to incomplete statistics. For the most accurate data, we recommend + accessing the statistics after at least one hour. Typically, updates are + available within a 24-hour period, although the frequency can vary. Maintenance + periods or other exceptions may cause delays, potentially extending beyond 24 + hours until the servers are back online and the missing data is filled in. + + Args: + time_from: Beginning of the period: YYYY-mm + + time_to: End of the period: YYYY-mm + + regions: List of region IDs. + + response_format: Format of the response (`csv_totals` or json). + + schema_filter: Extended filter for field filtering. + + tags: Filter by tags + + types: List of resource types to be filtered in the report. + + 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( + "/cloud/v1/reservation_cost_report/totals", + body=await async_maybe_transform( + { + "time_from": time_from, + "time_to": time_to, + "regions": regions, + "response_format": response_format, + "schema_filter": schema_filter, + "tags": tags, + "types": types, + }, + cost_report_get_aggregated_monthly_params.CostReportGetAggregatedMonthlyParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CostReportAggregatedMonthly, + ) + + async def get_detailed( + self, + *, + time_from: Union[str, datetime], + time_to: Union[str, datetime], + enable_last_day: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + projects: Iterable[int] | NotGiven = NOT_GIVEN, + regions: Iterable[int] | NotGiven = NOT_GIVEN, + response_format: Literal["csv_records", "json"] | NotGiven = NOT_GIVEN, + schema_filter: cost_report_get_detailed_params.SchemaFilter | NotGiven = NOT_GIVEN, + sorting: Iterable[cost_report_get_detailed_params.Sorting] | NotGiven = NOT_GIVEN, + tags: cost_report_get_detailed_params.Tags | NotGiven = NOT_GIVEN, + types: List[ + Literal[ + "ai_cluster", + "ai_virtual_cluster", + "backup", + "baremetal", + "basic_vm", + "containers", + "dbaas_postgresql_connection_pooler", + "dbaas_postgresql_cpu", + "dbaas_postgresql_memory", + "dbaas_postgresql_public_network", + "dbaas_postgresql_volume", + "egress_traffic", + "external_ip", + "file_share", + "floatingip", + "functions", + "functions_calls", + "functions_traffic", + "image", + "inference", + "instance", + "load_balancer", + "log_index", + "snapshot", + "volume", + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CostReportDetailed: + """Get a detailed cost report for a given period and specific resources. + + Requested + period should not exceed 31 days. Note: This report assumes there are no active + commit features in the billing plan. If there are active commit features + (pre-paid resources) in your plan, use /v1/`reservation_cost_report`/totals, as + the results from this report will not be accurate. Receiving data from the past + hour might lead to incomplete statistics. For the most accurate data, we + recommend accessing the statistics after at least one hour. Typically, updates + are available within a 24-hour period, although the frequency can vary. + Maintenance periods or other exceptions may cause delays, potentially extending + beyond 24 hours until the servers are back online and the missing data is filled + in. + + Args: + time_from: The start date of the report period (ISO 8601). The report starts from the + beginning of this day. + + time_to: The end date of the report period (ISO 8601). The report ends just before the + beginning of this day. + + enable_last_day: Expenses for the last specified day are taken into account. As the default, + False. + + limit: The response resources limit. Defaults to 10. + + offset: The response resources offset. + + projects: List of project IDs + + regions: List of region IDs. + + response_format: Format of the response (csv or json). + + schema_filter: Extended filter for field filtering. + + sorting: List of sorting filters (JSON objects) fields: project. directions: asc, desc. + + tags: Filter by tags + + types: List of resource types to be filtered in the report. + + 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( + "/cloud/v1/cost_report/resources", + body=await async_maybe_transform( + { + "time_from": time_from, + "time_to": time_to, + "enable_last_day": enable_last_day, + "limit": limit, + "offset": offset, + "projects": projects, + "regions": regions, + "response_format": response_format, + "schema_filter": schema_filter, + "sorting": sorting, + "tags": tags, + "types": types, + }, + cost_report_get_detailed_params.CostReportGetDetailedParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CostReportDetailed, + ) + + +class CostReportsResourceWithRawResponse: + def __init__(self, cost_reports: CostReportsResource) -> None: + self._cost_reports = cost_reports + + self.get_aggregated = to_raw_response_wrapper( + cost_reports.get_aggregated, + ) + self.get_aggregated_monthly = to_raw_response_wrapper( + cost_reports.get_aggregated_monthly, + ) + self.get_detailed = to_raw_response_wrapper( + cost_reports.get_detailed, + ) + + +class AsyncCostReportsResourceWithRawResponse: + def __init__(self, cost_reports: AsyncCostReportsResource) -> None: + self._cost_reports = cost_reports + + self.get_aggregated = async_to_raw_response_wrapper( + cost_reports.get_aggregated, + ) + self.get_aggregated_monthly = async_to_raw_response_wrapper( + cost_reports.get_aggregated_monthly, + ) + self.get_detailed = async_to_raw_response_wrapper( + cost_reports.get_detailed, + ) + + +class CostReportsResourceWithStreamingResponse: + def __init__(self, cost_reports: CostReportsResource) -> None: + self._cost_reports = cost_reports + + self.get_aggregated = to_streamed_response_wrapper( + cost_reports.get_aggregated, + ) + self.get_aggregated_monthly = to_streamed_response_wrapper( + cost_reports.get_aggregated_monthly, + ) + self.get_detailed = to_streamed_response_wrapper( + cost_reports.get_detailed, + ) + + +class AsyncCostReportsResourceWithStreamingResponse: + def __init__(self, cost_reports: AsyncCostReportsResource) -> None: + self._cost_reports = cost_reports + + self.get_aggregated = async_to_streamed_response_wrapper( + cost_reports.get_aggregated, + ) + self.get_aggregated_monthly = async_to_streamed_response_wrapper( + cost_reports.get_aggregated_monthly, + ) + self.get_detailed = async_to_streamed_response_wrapper( + cost_reports.get_detailed, + ) diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py new file mode 100644 index 00000000..0adc0809 --- /dev/null +++ b/src/gcore/resources/cloud/usage_reports.py @@ -0,0 +1,337 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable, Optional +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cloud import usage_report_get_params +from ..._base_client import make_request_options +from ...types.cloud.usage_report import UsageReport + +__all__ = ["UsageReportsResource", "AsyncUsageReportsResource"] + + +class UsageReportsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> UsageReportsResourceWithRawResponse: + """ + 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 UsageReportsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> UsageReportsResourceWithStreamingResponse: + """ + 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 UsageReportsResourceWithStreamingResponse(self) + + def get( + self, + *, + time_from: Union[str, datetime], + time_to: Union[str, datetime], + enable_last_day: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + projects: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, + regions: Iterable[int] | NotGiven = NOT_GIVEN, + schema_filter: usage_report_get_params.SchemaFilter | NotGiven = NOT_GIVEN, + sorting: Iterable[usage_report_get_params.Sorting] | NotGiven = NOT_GIVEN, + tags: usage_report_get_params.Tags | NotGiven = NOT_GIVEN, + types: List[ + Literal[ + "ai_cluster", + "ai_virtual_cluster", + "backup", + "baremetal", + "basic_vm", + "containers", + "dbaas_postgresql_connection_pooler", + "dbaas_postgresql_cpu", + "dbaas_postgresql_memory", + "dbaas_postgresql_public_network", + "dbaas_postgresql_volume", + "egress_traffic", + "external_ip", + "file_share", + "floatingip", + "functions", + "functions_calls", + "functions_traffic", + "image", + "inference", + "instance", + "load_balancer", + "log_index", + "snapshot", + "volume", + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UsageReport: + """Receiving data from the past hour might lead to incomplete statistics. + + For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. + + Args: + time_from: The start date of the report period (ISO 8601). The report starts from the + beginning of this day. + + time_to: The end date of the report period (ISO 8601). The report ends just before the + beginning of this day. + + enable_last_day: Expenses for the last specified day are taken into account. As the default, + False. + + limit: The response resources limit. Defaults to 10. + + offset: The response resources offset. + + projects: List of project IDs + + regions: List of region IDs. + + schema_filter: Extended filter for field filtering. + + sorting: List of sorting filters (JSON objects) fields: project. directions: asc, desc. + + tags: Filter by tags + + types: List of resource types to be filtered in the report. + + 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( + "/cloud/v1/usage_report", + body=maybe_transform( + { + "time_from": time_from, + "time_to": time_to, + "enable_last_day": enable_last_day, + "limit": limit, + "offset": offset, + "projects": projects, + "regions": regions, + "schema_filter": schema_filter, + "sorting": sorting, + "tags": tags, + "types": types, + }, + usage_report_get_params.UsageReportGetParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=UsageReport, + ) + + +class AsyncUsageReportsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncUsageReportsResourceWithRawResponse: + """ + 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 AsyncUsageReportsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncUsageReportsResourceWithStreamingResponse: + """ + 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 AsyncUsageReportsResourceWithStreamingResponse(self) + + async def get( + self, + *, + time_from: Union[str, datetime], + time_to: Union[str, datetime], + enable_last_day: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + projects: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, + regions: Iterable[int] | NotGiven = NOT_GIVEN, + schema_filter: usage_report_get_params.SchemaFilter | NotGiven = NOT_GIVEN, + sorting: Iterable[usage_report_get_params.Sorting] | NotGiven = NOT_GIVEN, + tags: usage_report_get_params.Tags | NotGiven = NOT_GIVEN, + types: List[ + Literal[ + "ai_cluster", + "ai_virtual_cluster", + "backup", + "baremetal", + "basic_vm", + "containers", + "dbaas_postgresql_connection_pooler", + "dbaas_postgresql_cpu", + "dbaas_postgresql_memory", + "dbaas_postgresql_public_network", + "dbaas_postgresql_volume", + "egress_traffic", + "external_ip", + "file_share", + "floatingip", + "functions", + "functions_calls", + "functions_traffic", + "image", + "inference", + "instance", + "load_balancer", + "log_index", + "snapshot", + "volume", + ] + ] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UsageReport: + """Receiving data from the past hour might lead to incomplete statistics. + + For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. + + Args: + time_from: The start date of the report period (ISO 8601). The report starts from the + beginning of this day. + + time_to: The end date of the report period (ISO 8601). The report ends just before the + beginning of this day. + + enable_last_day: Expenses for the last specified day are taken into account. As the default, + False. + + limit: The response resources limit. Defaults to 10. + + offset: The response resources offset. + + projects: List of project IDs + + regions: List of region IDs. + + schema_filter: Extended filter for field filtering. + + sorting: List of sorting filters (JSON objects) fields: project. directions: asc, desc. + + tags: Filter by tags + + types: List of resource types to be filtered in the report. + + 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( + "/cloud/v1/usage_report", + body=await async_maybe_transform( + { + "time_from": time_from, + "time_to": time_to, + "enable_last_day": enable_last_day, + "limit": limit, + "offset": offset, + "projects": projects, + "regions": regions, + "schema_filter": schema_filter, + "sorting": sorting, + "tags": tags, + "types": types, + }, + usage_report_get_params.UsageReportGetParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=UsageReport, + ) + + +class UsageReportsResourceWithRawResponse: + def __init__(self, usage_reports: UsageReportsResource) -> None: + self._usage_reports = usage_reports + + self.get = to_raw_response_wrapper( + usage_reports.get, + ) + + +class AsyncUsageReportsResourceWithRawResponse: + def __init__(self, usage_reports: AsyncUsageReportsResource) -> None: + self._usage_reports = usage_reports + + self.get = async_to_raw_response_wrapper( + usage_reports.get, + ) + + +class UsageReportsResourceWithStreamingResponse: + def __init__(self, usage_reports: UsageReportsResource) -> None: + self._usage_reports = usage_reports + + self.get = to_streamed_response_wrapper( + usage_reports.get, + ) + + +class AsyncUsageReportsResourceWithStreamingResponse: + def __init__(self, usage_reports: AsyncUsageReportsResource) -> None: + self._usage_reports = usage_reports + + self.get = async_to_streamed_response_wrapper( + usage_reports.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index a8758fd0..9c735955 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -30,6 +30,7 @@ from .lb_algorithm import LbAlgorithm as LbAlgorithm from .registry_tag import RegistryTag as RegistryTag from .task_id_list import TaskIDList as TaskIDList +from .usage_report import UsageReport as UsageReport from .fixed_address import FixedAddress as FixedAddress from .instance_list import InstanceList as InstanceList from .ip_assignment import IPAssignment as IPAssignment @@ -70,6 +71,7 @@ from .security_group_rule import SecurityGroupRule as SecurityGroupRule from .session_persistence import SessionPersistence as SessionPersistence from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams +from .cost_report_detailed import CostReportDetailed as CostReportDetailed from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed from .gpu_baremetal_flavor import GPUBaremetalFlavor as GPUBaremetalFlavor from .instance_list_params import InstanceListParams as InstanceListParams @@ -94,6 +96,7 @@ from .project_create_params import ProjectCreateParams as ProjectCreateParams from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams +from .cost_report_aggregated import CostReportAggregated as CostReportAggregated from .file_share_list_params import FileShareListParams as FileShareListParams from .instance_action_params import InstanceActionParams as InstanceActionParams from .instance_create_params import InstanceCreateParams as InstanceCreateParams @@ -109,6 +112,7 @@ from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams from .load_balancer_l7_policy import LoadBalancerL7Policy as LoadBalancerL7Policy from .load_balancer_pool_list import LoadBalancerPoolList as LoadBalancerPoolList +from .usage_report_get_params import UsageReportGetParams as UsageReportGetParams from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList from .file_share_create_params import FileShareCreateParams as FileShareCreateParams from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams @@ -150,11 +154,14 @@ from .load_balancer_listener_detail import LoadBalancerListenerDetail as LoadBalancerListenerDetail from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams +from .cost_report_aggregated_monthly import CostReportAggregatedMonthly as CostReportAggregatedMonthly from .inference_region_capacity_list import InferenceRegionCapacityList as InferenceRegionCapacityList from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus from .billing_reservation_list_params import BillingReservationListParams as BillingReservationListParams +from .cost_report_get_detailed_params import CostReportGetDetailedParams as CostReportGetDetailedParams from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams +from .cost_report_get_aggregated_params import CostReportGetAggregatedParams as CostReportGetAggregatedParams from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams from .gpu_baremetal_cluster_server_list import GPUBaremetalClusterServerList as GPUBaremetalClusterServerList from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam @@ -174,3 +181,6 @@ from .instance_unassign_security_group_params import ( InstanceUnassignSecurityGroupParams as InstanceUnassignSecurityGroupParams, ) +from .cost_report_get_aggregated_monthly_params import ( + CostReportGetAggregatedMonthlyParams as CostReportGetAggregatedMonthlyParams, +) diff --git a/src/gcore/types/cloud/cost_report_aggregated.py b/src/gcore/types/cloud/cost_report_aggregated.py new file mode 100644 index 00000000..4697169e --- /dev/null +++ b/src/gcore/types/cloud/cost_report_aggregated.py @@ -0,0 +1,865 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, Annotated, TypeAlias + +from ..._utils import PropertyInfo +from ..._models import BaseModel + +__all__ = [ + "CostReportAggregated", + "Result", + "ResultTotalAIClusterWithCostSerializer", + "ResultTotalAIVirtualClusterWithCostSerializer", + "ResultTotalBaremetalWithCostSerializer", + "ResultTotalBasicVmWithCostSerializer", + "ResultTotalBackupWithCostSerializer", + "ResultTotalContainerWithCostSerializer", + "ResultTotalEgressTrafficWithCostSerializer", + "ResultTotalExternalIPWithCostSerializer", + "ResultTotalFileShareWithCostSerializer", + "ResultTotalFloatingIPWithCostSerializer", + "ResultTotalFunctionsWithCostSerializer", + "ResultTotalFunctionCallsWithCostSerializer", + "ResultTotalFunctionEgressTrafficWithCostSerializer", + "ResultTotalImagesWithCostSerializer", + "ResultTotalInferenceWithCostSerializer", + "ResultTotalInstanceWithCostSerializer", + "ResultTotalLoadBalancerWithCostSerializer", + "ResultTotalLogIndexWithCostSerializer", + "ResultTotalSnapshotWithCostSerializer", + "ResultTotalVolumeWithCostSerializer", + "ResultTotalDbaasPostgreSQLPoolerWithCostSerializer", + "ResultTotalDbaasPostgreSQLMemoryWithCostSerializer", + "ResultTotalDbaasPostgreSQLPublicNetworkWithCostSerializer", + "ResultTotalDbaasPostgreSqlcpuWithCostSerializer", + "ResultTotalDbaasPostgreSQLVolumeWithCostSerializer", +] + + +class ResultTotalAIClusterWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + flavor: str + """Flavor of the Baremetal GPU cluster""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["ai_cluster"] + + +class ResultTotalAIVirtualClusterWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + flavor: str + """Flavor of the Virtual GPU cluster""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["ai_virtual_cluster"] + + +class ResultTotalBaremetalWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + flavor: str + """Flavor of the bare metal server""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["baremetal"] + + +class ResultTotalBasicVmWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + flavor: str + """Flavor of the basic VM""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["basic_vm"] + + +class ResultTotalBackupWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + last_size: int + """Size of the backup in bytes""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["backup"] + + +class ResultTotalContainerWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GBS"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["containers"] + + +class ResultTotalEgressTrafficWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["bytes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + instance_type: Literal["baremetal", "vm"] + """Type of the instance""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["egress_traffic"] + + +class ResultTotalExternalIPWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["external_ip"] + + +class ResultTotalFileShareWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + file_share_type: str + """Type of the file share""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["file_share"] + + +class ResultTotalFloatingIPWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["floatingip"] + + +class ResultTotalFunctionsWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GBS"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions"] + + +class ResultTotalFunctionCallsWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["MLS"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions_calls"] + + +class ResultTotalFunctionEgressTrafficWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GB"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions_traffic"] + + +class ResultTotalImagesWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["image"] + + +class ResultTotalInferenceWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: str + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["inference"] + + +class ResultTotalInstanceWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + flavor: str + """Flavor of the instance""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["instance"] + + +class ResultTotalLoadBalancerWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + flavor: str + """Flavor of the load balancer""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["load_balancer"] + + +class ResultTotalLogIndexWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["log_index"] + + +class ResultTotalSnapshotWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["snapshot"] + + volume_type: str + """Type of the volume""" + + +class ResultTotalVolumeWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["volume"] + + volume_type: str + """Type of the volume""" + + +class ResultTotalDbaasPostgreSQLPoolerWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_connection_pooler"] + + +class ResultTotalDbaasPostgreSQLMemoryWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_memory"] + + +class ResultTotalDbaasPostgreSQLPublicNetworkWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_public_network"] + + +class ResultTotalDbaasPostgreSqlcpuWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_cpu"] + + +class ResultTotalDbaasPostgreSQLVolumeWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_volume"] + + volume_type: str + """Type of the volume""" + + +Result: TypeAlias = Annotated[ + Union[ + ResultTotalAIClusterWithCostSerializer, + ResultTotalAIVirtualClusterWithCostSerializer, + ResultTotalBaremetalWithCostSerializer, + ResultTotalBasicVmWithCostSerializer, + ResultTotalBackupWithCostSerializer, + ResultTotalContainerWithCostSerializer, + ResultTotalEgressTrafficWithCostSerializer, + ResultTotalExternalIPWithCostSerializer, + ResultTotalFileShareWithCostSerializer, + ResultTotalFloatingIPWithCostSerializer, + ResultTotalFunctionsWithCostSerializer, + ResultTotalFunctionCallsWithCostSerializer, + ResultTotalFunctionEgressTrafficWithCostSerializer, + ResultTotalImagesWithCostSerializer, + ResultTotalInferenceWithCostSerializer, + ResultTotalInstanceWithCostSerializer, + ResultTotalLoadBalancerWithCostSerializer, + ResultTotalLogIndexWithCostSerializer, + ResultTotalSnapshotWithCostSerializer, + ResultTotalVolumeWithCostSerializer, + ResultTotalDbaasPostgreSQLPoolerWithCostSerializer, + ResultTotalDbaasPostgreSQLMemoryWithCostSerializer, + ResultTotalDbaasPostgreSQLPublicNetworkWithCostSerializer, + ResultTotalDbaasPostgreSqlcpuWithCostSerializer, + ResultTotalDbaasPostgreSQLVolumeWithCostSerializer, + ], + PropertyInfo(discriminator="type"), +] + + +class CostReportAggregated(BaseModel): + count: int + """Count of returned totals""" + + price_status: Literal["error", "hide", "show"] + """Price status for the UI, type: string""" + + results: List[Result] diff --git a/src/gcore/types/cloud/cost_report_aggregated_monthly.py b/src/gcore/types/cloud/cost_report_aggregated_monthly.py new file mode 100644 index 00000000..d62de86d --- /dev/null +++ b/src/gcore/types/cloud/cost_report_aggregated_monthly.py @@ -0,0 +1,865 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, Annotated, TypeAlias + +from ..._utils import PropertyInfo +from ..._models import BaseModel + +__all__ = [ + "CostReportAggregatedMonthly", + "Result", + "ResultTotalAIClusterWithCostSerializer", + "ResultTotalAIVirtualClusterWithCostSerializer", + "ResultTotalBaremetalWithCostSerializer", + "ResultTotalBasicVmWithCostSerializer", + "ResultTotalBackupWithCostSerializer", + "ResultTotalContainerWithCostSerializer", + "ResultTotalEgressTrafficWithCostSerializer", + "ResultTotalExternalIPWithCostSerializer", + "ResultTotalFileShareWithCostSerializer", + "ResultTotalFloatingIPWithCostSerializer", + "ResultTotalFunctionsWithCostSerializer", + "ResultTotalFunctionCallsWithCostSerializer", + "ResultTotalFunctionEgressTrafficWithCostSerializer", + "ResultTotalImagesWithCostSerializer", + "ResultTotalInferenceWithCostSerializer", + "ResultTotalInstanceWithCostSerializer", + "ResultTotalLoadBalancerWithCostSerializer", + "ResultTotalLogIndexWithCostSerializer", + "ResultTotalSnapshotWithCostSerializer", + "ResultTotalVolumeWithCostSerializer", + "ResultTotalDbaasPostgreSQLPoolerWithCostSerializer", + "ResultTotalDbaasPostgreSQLMemoryWithCostSerializer", + "ResultTotalDbaasPostgreSQLPublicNetworkWithCostSerializer", + "ResultTotalDbaasPostgreSqlcpuWithCostSerializer", + "ResultTotalDbaasPostgreSQLVolumeWithCostSerializer", +] + + +class ResultTotalAIClusterWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + flavor: str + """Flavor of the Baremetal GPU cluster""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["ai_cluster"] + + +class ResultTotalAIVirtualClusterWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + flavor: str + """Flavor of the Virtual GPU cluster""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["ai_virtual_cluster"] + + +class ResultTotalBaremetalWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + flavor: str + """Flavor of the bare metal server""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["baremetal"] + + +class ResultTotalBasicVmWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + flavor: str + """Flavor of the basic VM""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["basic_vm"] + + +class ResultTotalBackupWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + last_size: int + """Size of the backup in bytes""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["backup"] + + +class ResultTotalContainerWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GBS"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["containers"] + + +class ResultTotalEgressTrafficWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["bytes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + instance_type: Literal["baremetal", "vm"] + """Type of the instance""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["egress_traffic"] + + +class ResultTotalExternalIPWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["external_ip"] + + +class ResultTotalFileShareWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + file_share_type: str + """Type of the file share""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["file_share"] + + +class ResultTotalFloatingIPWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["floatingip"] + + +class ResultTotalFunctionsWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GBS"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions"] + + +class ResultTotalFunctionCallsWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["MLS"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions_calls"] + + +class ResultTotalFunctionEgressTrafficWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GB"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions_traffic"] + + +class ResultTotalImagesWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["image"] + + +class ResultTotalInferenceWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: str + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["inference"] + + +class ResultTotalInstanceWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + flavor: str + """Flavor of the instance""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["instance"] + + +class ResultTotalLoadBalancerWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + flavor: str + """Flavor of the load balancer""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["load_balancer"] + + +class ResultTotalLogIndexWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["log_index"] + + +class ResultTotalSnapshotWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["snapshot"] + + volume_type: str + """Type of the volume""" + + +class ResultTotalVolumeWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["volume"] + + volume_type: str + """Type of the volume""" + + +class ResultTotalDbaasPostgreSQLPoolerWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_connection_pooler"] + + +class ResultTotalDbaasPostgreSQLMemoryWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_memory"] + + +class ResultTotalDbaasPostgreSQLPublicNetworkWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_public_network"] + + +class ResultTotalDbaasPostgreSqlcpuWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_cpu"] + + +class ResultTotalDbaasPostgreSQLVolumeWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_volume"] + + volume_type: str + """Type of the volume""" + + +Result: TypeAlias = Annotated[ + Union[ + ResultTotalAIClusterWithCostSerializer, + ResultTotalAIVirtualClusterWithCostSerializer, + ResultTotalBaremetalWithCostSerializer, + ResultTotalBasicVmWithCostSerializer, + ResultTotalBackupWithCostSerializer, + ResultTotalContainerWithCostSerializer, + ResultTotalEgressTrafficWithCostSerializer, + ResultTotalExternalIPWithCostSerializer, + ResultTotalFileShareWithCostSerializer, + ResultTotalFloatingIPWithCostSerializer, + ResultTotalFunctionsWithCostSerializer, + ResultTotalFunctionCallsWithCostSerializer, + ResultTotalFunctionEgressTrafficWithCostSerializer, + ResultTotalImagesWithCostSerializer, + ResultTotalInferenceWithCostSerializer, + ResultTotalInstanceWithCostSerializer, + ResultTotalLoadBalancerWithCostSerializer, + ResultTotalLogIndexWithCostSerializer, + ResultTotalSnapshotWithCostSerializer, + ResultTotalVolumeWithCostSerializer, + ResultTotalDbaasPostgreSQLPoolerWithCostSerializer, + ResultTotalDbaasPostgreSQLMemoryWithCostSerializer, + ResultTotalDbaasPostgreSQLPublicNetworkWithCostSerializer, + ResultTotalDbaasPostgreSqlcpuWithCostSerializer, + ResultTotalDbaasPostgreSQLVolumeWithCostSerializer, + ], + PropertyInfo(discriminator="type"), +] + + +class CostReportAggregatedMonthly(BaseModel): + count: int + """Total count of the totals""" + + price_status: Literal["error", "hide", "show"] + """Price status for the UI, type: string""" + + results: List[Result] diff --git a/src/gcore/types/cloud/cost_report_detailed.py b/src/gcore/types/cloud/cost_report_detailed.py new file mode 100644 index 00000000..5669ad22 --- /dev/null +++ b/src/gcore/types/cloud/cost_report_detailed.py @@ -0,0 +1,1343 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, Annotated, TypeAlias + +from ..._utils import PropertyInfo +from ..._models import BaseModel + +__all__ = [ + "CostReportDetailed", + "Result", + "ResultResourceAIClusterWithCostSerializer", + "ResultResourceAIVirtualClusterWithCostSerializer", + "ResultResourceBaremetalWithCostSerializer", + "ResultResourceBasicVmWithCostSerializer", + "ResultResourceBackupWithCostSerializer", + "ResultResourceContainerWithCostSerializer", + "ResultResourceEgressTrafficWithCostSerializer", + "ResultResourceExternalIPWithCostSerializer", + "ResultResourceFileShareWithCostSerializer", + "ResultResourceFloatingIPWithCostSerializer", + "ResultResourceFunctionsWithCostSerializer", + "ResultResourceFunctionCallsWithCostSerializer", + "ResultResourceFunctionEgressTrafficWithCostSerializer", + "ResultResourceImagesWithCostSerializer", + "ResultResourceInferenceWithCostSerializer", + "ResultResourceInstanceWithCostSerializer", + "ResultResourceLoadBalancerWithCostSerializer", + "ResultResourceLogIndexWithCostSerializer", + "ResultResourceSnapshotWithCostSerializer", + "ResultResourceVolumeWithCostSerializer", + "ResultResourceDbaasPostgreSQLPoolerWithCostSerializer", + "ResultResourceDbaasPostgreSQLMemoryWithCostSerializer", + "ResultResourceDbaasPostgreSQLPublicNetworkWithCostSerializer", + "ResultResourceDbaasPostgreSqlcpuWithCostSerializer", + "ResultResourceDbaasPostgreSQLVolumeWithCostSerializer", +] + + +class ResultResourceAIClusterWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the Baremetal GPU cluster""" + + last_name: str + """Name of the AI cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["ai_cluster"] + + uuid: str + """UUID of the Baremetal GPU cluster""" + + +class ResultResourceAIVirtualClusterWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the Virtual GPU cluster""" + + last_name: str + """Name of the AI cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["ai_virtual_cluster"] + + uuid: str + """UUID of the Virtual GPU cluster""" + + +class ResultResourceBaremetalWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the bare metal server""" + + last_name: str + """Name of the bare metal server""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["baremetal"] + + uuid: str + """UUID of the bare metal server""" + + +class ResultResourceBasicVmWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the basic VM""" + + last_name: str + """Name of the basic VM""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["basic_vm"] + + uuid: str + """UUID of the basic VM""" + + +class ResultResourceBackupWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the backup""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + last_size: int + """Size of the backup in bytes""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + schedule_id: str + """ID of the backup schedule""" + + source_volume_uuid: str + """UUID of the source volume""" + + type: Literal["backup"] + + uuid: str + """UUID of the backup""" + + +class ResultResourceContainerWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GBS"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the container""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["containers"] + + uuid: str + """UUID of the container""" + + +class ResultResourceEgressTrafficWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["bytes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + instance_type: Literal["baremetal", "vm"] + """Type of the instance""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + port_id: str + """ID of the port the traffic is associated with""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: str + """Unit of size""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["egress_traffic"] + + vm_id: str + """ID of the bare metal server the traffic is associated with""" + + instance_name: Optional[str] = None + """Name of the instance""" + + +class ResultResourceExternalIPWithCostSerializer(BaseModel): + attached_to_vm: Optional[str] = None + """ID of the VM the IP is attached to""" + + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + ip_address: str + """IP address""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + network_id: str + """ID of the network the IP is attached to""" + + port_id: str + """ID of the port the IP is associated with""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + subnet_id: str + """ID of the subnet the IP is attached to""" + + type: Literal["external_ip"] + + +class ResultResourceFileShareWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + file_share_type: str + """Type of the file share""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the file share""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + last_size: int + """Size of the file share in bytes""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: Literal["GiB"] + """Unit of size""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["file_share"] + + uuid: str + """UUID of the file share""" + + +class ResultResourceFloatingIPWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + ip_address: str + """IP address""" + + last_name: str + """Name of the floating IP""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["floatingip"] + + uuid: str + """UUID of the floating IP""" + + +class ResultResourceFunctionsWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GBS"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the function""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions"] + + uuid: str + """UUID of the function""" + + +class ResultResourceFunctionCallsWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["MLS"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the function call""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions_calls"] + + uuid: str + """UUID of the function call""" + + +class ResultResourceFunctionEgressTrafficWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GB"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the function egress traffic""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions_traffic"] + + uuid: str + """UUID of the function egress traffic""" + + +class ResultResourceImagesWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the image""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + last_size: int + """Size of the image in bytes""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: Literal["bytes"] + """Unit of size""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["image"] + + uuid: str + """UUID of the image""" + + +class ResultResourceInferenceWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: str + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the inference deployment""" + + last_name: str + """Name of the inference deployment""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["inference"] + + uuid: str + """UUID of the inference deployment""" + + +class ResultResourceInstanceWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the instance""" + + last_name: str + """Name of the instance""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["instance"] + + uuid: str + """UUID of the instance""" + + +class ResultResourceLoadBalancerWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the load balancer""" + + last_name: str + """Name of the load balancer""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["load_balancer"] + + uuid: str + """UUID of the load balancer""" + + +class ResultResourceLogIndexWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the log index""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + last_size: int + """Size of the log index in bytes""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: str + """Unit of size""" + + type: Literal["log_index"] + + uuid: Optional[str] = None + """UUID of the log index""" + + +class ResultResourceSnapshotWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the snapshot""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + last_size: int + """Size of the snapshot in bytes""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: str + """Unit of size""" + + source_volume_uuid: str + """UUID of the source volume""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["snapshot"] + + uuid: str + """UUID of the snapshot""" + + volume_type: str + """Type of the volume""" + + +class ResultResourceVolumeWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the volume""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + last_size: int + """Size of the volume in bytes""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: str + """Unit of size""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["volume"] + + uuid: str + """UUID of the volume""" + + volume_type: str + """Type of the volume""" + + attached_to_vm: Optional[str] = None + """ID of the VM the volume is attached to""" + + +class ResultResourceDbaasPostgreSQLPoolerWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_connection_pooler"] + + uuid: str + """UUID of the cluster""" + + +class ResultResourceDbaasPostgreSQLMemoryWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_memory"] + + uuid: str + """UUID of the cluster""" + + +class ResultResourceDbaasPostgreSQLPublicNetworkWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_public_network"] + + uuid: str + """UUID of the cluster""" + + +class ResultResourceDbaasPostgreSqlcpuWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_cpu"] + + uuid: str + """UUID of the cluster""" + + +class ResultResourceDbaasPostgreSQLVolumeWithCostSerializer(BaseModel): + billing_feature_name: Optional[str] = None + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + cost: Optional[float] = None + """Cost for requested period""" + + currency: Optional[str] = None + """Currency of the cost""" + + err: Optional[str] = None + """Error message""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: str + """Unit of size""" + + type: Literal["dbaas_postgresql_volume"] + + uuid: str + """UUID of the cluster""" + + volume_type: str + """Type of the volume""" + + +Result: TypeAlias = Annotated[ + Union[ + ResultResourceAIClusterWithCostSerializer, + ResultResourceAIVirtualClusterWithCostSerializer, + ResultResourceBaremetalWithCostSerializer, + ResultResourceBasicVmWithCostSerializer, + ResultResourceBackupWithCostSerializer, + ResultResourceContainerWithCostSerializer, + ResultResourceEgressTrafficWithCostSerializer, + ResultResourceExternalIPWithCostSerializer, + ResultResourceFileShareWithCostSerializer, + ResultResourceFloatingIPWithCostSerializer, + ResultResourceFunctionsWithCostSerializer, + ResultResourceFunctionCallsWithCostSerializer, + ResultResourceFunctionEgressTrafficWithCostSerializer, + ResultResourceImagesWithCostSerializer, + ResultResourceInferenceWithCostSerializer, + ResultResourceInstanceWithCostSerializer, + ResultResourceLoadBalancerWithCostSerializer, + ResultResourceLogIndexWithCostSerializer, + ResultResourceSnapshotWithCostSerializer, + ResultResourceVolumeWithCostSerializer, + ResultResourceDbaasPostgreSQLPoolerWithCostSerializer, + ResultResourceDbaasPostgreSQLMemoryWithCostSerializer, + ResultResourceDbaasPostgreSQLPublicNetworkWithCostSerializer, + ResultResourceDbaasPostgreSqlcpuWithCostSerializer, + ResultResourceDbaasPostgreSQLVolumeWithCostSerializer, + ], + PropertyInfo(discriminator="type"), +] + + +class CostReportDetailed(BaseModel): + count: int + """Count of all the resources""" + + price_status: Literal["error", "hide", "show"] + """Price status for the UI, type: string""" + + results: List[Result] 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 new file mode 100644 index 00000000..3a77c6a1 --- /dev/null +++ b/src/gcore/types/cloud/cost_report_get_aggregated_monthly_params.py @@ -0,0 +1,394 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict + +from ..._utils import PropertyInfo + +__all__ = [ + "CostReportGetAggregatedMonthlyParams", + "SchemaFilter", + "SchemaFilterSchemaFilterSnapshotSerializer", + "SchemaFilterSchemaFilterInstanceSerializer", + "SchemaFilterSchemaFilterAIClusterSerializer", + "SchemaFilterSchemaFilterAIVirtualClusterSerializer", + "SchemaFilterSchemaFilterBasicVmSerializer", + "SchemaFilterSchemaFilterBaremetalSerializer", + "SchemaFilterSchemaFilterVolumeSerializer", + "SchemaFilterSchemaFilterFileShareSerializer", + "SchemaFilterSchemaFilterImageSerializer", + "SchemaFilterSchemaFilterFloatingIPSerializer", + "SchemaFilterSchemaFilterEgressTrafficSerializer", + "SchemaFilterSchemaFilterLoadBalancerSerializer", + "SchemaFilterSchemaFilterExternalIPSerializer", + "SchemaFilterSchemaFilterBackupSerializer", + "SchemaFilterSchemaFilterLogIndexSerializer", + "SchemaFilterSchemaFilterFunctionsSerializer", + "SchemaFilterSchemaFilterFunctionsCallsSerializer", + "SchemaFilterSchemaFilterFunctionsTrafficSerializer", + "SchemaFilterSchemaFilterContainersSerializer", + "SchemaFilterSchemaFilterInferenceSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer", + "Tags", + "TagsCondition", +] + + +class CostReportGetAggregatedMonthlyParams(TypedDict, total=False): + time_from: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """Beginning of the period: YYYY-mm""" + + time_to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """End of the period: YYYY-mm""" + + regions: Iterable[int] + """List of region IDs.""" + + response_format: Literal["csv_totals", "json"] + """Format of the response (`csv_totals` or json).""" + + schema_filter: SchemaFilter + """Extended filter for field filtering.""" + + tags: Tags + """Filter by tags""" + + types: List[ + Literal[ + "ai_cluster", + "ai_virtual_cluster", + "backup", + "baremetal", + "basic_vm", + "containers", + "dbaas_postgresql_connection_pooler", + "dbaas_postgresql_cpu", + "dbaas_postgresql_memory", + "dbaas_postgresql_public_network", + "dbaas_postgresql_volume", + "egress_traffic", + "external_ip", + "file_share", + "floatingip", + "functions", + "functions_calls", + "functions_traffic", + "image", + "inference", + "instance", + "load_balancer", + "log_index", + "snapshot", + "volume", + ] + ] + """List of resource types to be filtered in the report.""" + + +class SchemaFilterSchemaFilterSnapshotSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "source_volume_uuid", "type", "uuid", "volume_type"]] + """Field name to filter by""" + + type: Required[Literal["snapshot"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterInstanceSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["instance"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterAIClusterSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["ai_cluster"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterAIVirtualClusterSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["ai_virtual_cluster"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterBasicVmSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["basic_vm"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterBaremetalSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["baremetal"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterVolumeSerializer(TypedDict, total=False): + field: Required[Literal["attached_to_vm", "last_name", "last_size", "type", "uuid", "volume_type"]] + """Field name to filter by""" + + type: Required[Literal["volume"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFileShareSerializer(TypedDict, total=False): + field: Required[Literal["file_share_type", "last_name", "last_size", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["file_share"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterImageSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["image"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFloatingIPSerializer(TypedDict, total=False): + field: Required[Literal["ip_address", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["floatingip"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterEgressTrafficSerializer(TypedDict, total=False): + field: Required[Literal["instance_name", "instance_type", "port_id", "type", "vm_id"]] + """Field name to filter by""" + + type: Required[Literal["egress_traffic"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterLoadBalancerSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["load_balancer"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterExternalIPSerializer(TypedDict, total=False): + field: Required[Literal["attached_to_vm", "ip_address", "network_id", "port_id", "subnet_id", "type"]] + """Field name to filter by""" + + type: Required[Literal["external_ip"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterBackupSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "schedule_id", "source_volume_uuid", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["backup"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterLogIndexSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["log_index"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFunctionsSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["functions"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFunctionsCallsSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["functions_calls"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFunctionsTrafficSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["functions_traffic"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterContainersSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["containers"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterInferenceSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["inference"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid", "volume_type"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_volume"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_public_network"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_cpu"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_memory"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_connection_pooler"]] + + values: Required[List[str]] + """List of field values to filter""" + + +SchemaFilter: TypeAlias = Union[ + SchemaFilterSchemaFilterSnapshotSerializer, + SchemaFilterSchemaFilterInstanceSerializer, + SchemaFilterSchemaFilterAIClusterSerializer, + SchemaFilterSchemaFilterAIVirtualClusterSerializer, + SchemaFilterSchemaFilterBasicVmSerializer, + SchemaFilterSchemaFilterBaremetalSerializer, + SchemaFilterSchemaFilterVolumeSerializer, + SchemaFilterSchemaFilterFileShareSerializer, + SchemaFilterSchemaFilterImageSerializer, + SchemaFilterSchemaFilterFloatingIPSerializer, + SchemaFilterSchemaFilterEgressTrafficSerializer, + SchemaFilterSchemaFilterLoadBalancerSerializer, + SchemaFilterSchemaFilterExternalIPSerializer, + SchemaFilterSchemaFilterBackupSerializer, + SchemaFilterSchemaFilterLogIndexSerializer, + SchemaFilterSchemaFilterFunctionsSerializer, + SchemaFilterSchemaFilterFunctionsCallsSerializer, + SchemaFilterSchemaFilterFunctionsTrafficSerializer, + SchemaFilterSchemaFilterContainersSerializer, + SchemaFilterSchemaFilterInferenceSerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer, + SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer, +] + + +class TagsCondition(TypedDict, total=False): + key: str + """The name of the tag to filter (e.g., '`os_version`').""" + + strict: bool + """Determines how strictly the tag value must match the specified value. + + If true, the tag value must exactly match the given value. If false, a less + strict match (e.g., partial or case-insensitive match) may be applied. + """ + + value: str + """The value of the tag to filter (e.g., '22.04').""" + + +class Tags(TypedDict, total=False): + conditions: Required[Iterable[TagsCondition]] + """A list of tag filtering conditions defining how tags should match.""" + + condition_type: Literal["AND", "OR"] + """Specifies whether conditions are combined using OR (default) or AND logic.""" diff --git a/src/gcore/types/cloud/cost_report_get_aggregated_params.py b/src/gcore/types/cloud/cost_report_get_aggregated_params.py new file mode 100644 index 00000000..5cd6781d --- /dev/null +++ b/src/gcore/types/cloud/cost_report_get_aggregated_params.py @@ -0,0 +1,409 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict + +from ..._utils import PropertyInfo + +__all__ = [ + "CostReportGetAggregatedParams", + "SchemaFilter", + "SchemaFilterSchemaFilterSnapshotSerializer", + "SchemaFilterSchemaFilterInstanceSerializer", + "SchemaFilterSchemaFilterAIClusterSerializer", + "SchemaFilterSchemaFilterAIVirtualClusterSerializer", + "SchemaFilterSchemaFilterBasicVmSerializer", + "SchemaFilterSchemaFilterBaremetalSerializer", + "SchemaFilterSchemaFilterVolumeSerializer", + "SchemaFilterSchemaFilterFileShareSerializer", + "SchemaFilterSchemaFilterImageSerializer", + "SchemaFilterSchemaFilterFloatingIPSerializer", + "SchemaFilterSchemaFilterEgressTrafficSerializer", + "SchemaFilterSchemaFilterLoadBalancerSerializer", + "SchemaFilterSchemaFilterExternalIPSerializer", + "SchemaFilterSchemaFilterBackupSerializer", + "SchemaFilterSchemaFilterLogIndexSerializer", + "SchemaFilterSchemaFilterFunctionsSerializer", + "SchemaFilterSchemaFilterFunctionsCallsSerializer", + "SchemaFilterSchemaFilterFunctionsTrafficSerializer", + "SchemaFilterSchemaFilterContainersSerializer", + "SchemaFilterSchemaFilterInferenceSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer", + "Tags", + "TagsCondition", +] + + +class CostReportGetAggregatedParams(TypedDict, total=False): + time_from: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """The start date of the report period (ISO 8601). + + The report starts from the beginning of this day. + """ + + time_to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """The end date of the report period (ISO 8601). + + The report ends just before the beginning of this day. + """ + + enable_last_day: bool + """Expenses for the last specified day are taken into account. + + As the default, False. + """ + + projects: Iterable[int] + """List of project IDs""" + + regions: Iterable[int] + """List of region IDs.""" + + response_format: Literal["csv_totals", "json"] + """Format of the response (csv or json).""" + + schema_filter: SchemaFilter + """Extended filter for field filtering.""" + + tags: Tags + """Filter by tags""" + + types: List[ + Literal[ + "ai_cluster", + "ai_virtual_cluster", + "backup", + "baremetal", + "basic_vm", + "containers", + "dbaas_postgresql_connection_pooler", + "dbaas_postgresql_cpu", + "dbaas_postgresql_memory", + "dbaas_postgresql_public_network", + "dbaas_postgresql_volume", + "egress_traffic", + "external_ip", + "file_share", + "floatingip", + "functions", + "functions_calls", + "functions_traffic", + "image", + "inference", + "instance", + "load_balancer", + "log_index", + "snapshot", + "volume", + ] + ] + """List of resource types to be filtered in the report.""" + + +class SchemaFilterSchemaFilterSnapshotSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "source_volume_uuid", "type", "uuid", "volume_type"]] + """Field name to filter by""" + + type: Required[Literal["snapshot"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterInstanceSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["instance"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterAIClusterSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["ai_cluster"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterAIVirtualClusterSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["ai_virtual_cluster"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterBasicVmSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["basic_vm"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterBaremetalSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["baremetal"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterVolumeSerializer(TypedDict, total=False): + field: Required[Literal["attached_to_vm", "last_name", "last_size", "type", "uuid", "volume_type"]] + """Field name to filter by""" + + type: Required[Literal["volume"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFileShareSerializer(TypedDict, total=False): + field: Required[Literal["file_share_type", "last_name", "last_size", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["file_share"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterImageSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["image"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFloatingIPSerializer(TypedDict, total=False): + field: Required[Literal["ip_address", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["floatingip"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterEgressTrafficSerializer(TypedDict, total=False): + field: Required[Literal["instance_name", "instance_type", "port_id", "type", "vm_id"]] + """Field name to filter by""" + + type: Required[Literal["egress_traffic"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterLoadBalancerSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["load_balancer"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterExternalIPSerializer(TypedDict, total=False): + field: Required[Literal["attached_to_vm", "ip_address", "network_id", "port_id", "subnet_id", "type"]] + """Field name to filter by""" + + type: Required[Literal["external_ip"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterBackupSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "schedule_id", "source_volume_uuid", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["backup"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterLogIndexSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["log_index"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFunctionsSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["functions"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFunctionsCallsSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["functions_calls"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFunctionsTrafficSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["functions_traffic"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterContainersSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["containers"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterInferenceSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["inference"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid", "volume_type"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_volume"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_public_network"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_cpu"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_memory"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_connection_pooler"]] + + values: Required[List[str]] + """List of field values to filter""" + + +SchemaFilter: TypeAlias = Union[ + SchemaFilterSchemaFilterSnapshotSerializer, + SchemaFilterSchemaFilterInstanceSerializer, + SchemaFilterSchemaFilterAIClusterSerializer, + SchemaFilterSchemaFilterAIVirtualClusterSerializer, + SchemaFilterSchemaFilterBasicVmSerializer, + SchemaFilterSchemaFilterBaremetalSerializer, + SchemaFilterSchemaFilterVolumeSerializer, + SchemaFilterSchemaFilterFileShareSerializer, + SchemaFilterSchemaFilterImageSerializer, + SchemaFilterSchemaFilterFloatingIPSerializer, + SchemaFilterSchemaFilterEgressTrafficSerializer, + SchemaFilterSchemaFilterLoadBalancerSerializer, + SchemaFilterSchemaFilterExternalIPSerializer, + SchemaFilterSchemaFilterBackupSerializer, + SchemaFilterSchemaFilterLogIndexSerializer, + SchemaFilterSchemaFilterFunctionsSerializer, + SchemaFilterSchemaFilterFunctionsCallsSerializer, + SchemaFilterSchemaFilterFunctionsTrafficSerializer, + SchemaFilterSchemaFilterContainersSerializer, + SchemaFilterSchemaFilterInferenceSerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer, + SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer, +] + + +class TagsCondition(TypedDict, total=False): + key: str + """The name of the tag to filter (e.g., '`os_version`').""" + + strict: bool + """Determines how strictly the tag value must match the specified value. + + If true, the tag value must exactly match the given value. If false, a less + strict match (e.g., partial or case-insensitive match) may be applied. + """ + + value: str + """The value of the tag to filter (e.g., '22.04').""" + + +class Tags(TypedDict, total=False): + conditions: Required[Iterable[TagsCondition]] + """A list of tag filtering conditions defining how tags should match.""" + + condition_type: Literal["AND", "OR"] + """Specifies whether conditions are combined using OR (default) or AND logic.""" diff --git a/src/gcore/types/cloud/cost_report_get_detailed_params.py b/src/gcore/types/cloud/cost_report_get_detailed_params.py new file mode 100644 index 00000000..fbadb8aa --- /dev/null +++ b/src/gcore/types/cloud/cost_report_get_detailed_params.py @@ -0,0 +1,435 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict + +from ..._utils import PropertyInfo + +__all__ = [ + "CostReportGetDetailedParams", + "SchemaFilter", + "SchemaFilterSchemaFilterSnapshotSerializer", + "SchemaFilterSchemaFilterInstanceSerializer", + "SchemaFilterSchemaFilterAIClusterSerializer", + "SchemaFilterSchemaFilterAIVirtualClusterSerializer", + "SchemaFilterSchemaFilterBasicVmSerializer", + "SchemaFilterSchemaFilterBaremetalSerializer", + "SchemaFilterSchemaFilterVolumeSerializer", + "SchemaFilterSchemaFilterFileShareSerializer", + "SchemaFilterSchemaFilterImageSerializer", + "SchemaFilterSchemaFilterFloatingIPSerializer", + "SchemaFilterSchemaFilterEgressTrafficSerializer", + "SchemaFilterSchemaFilterLoadBalancerSerializer", + "SchemaFilterSchemaFilterExternalIPSerializer", + "SchemaFilterSchemaFilterBackupSerializer", + "SchemaFilterSchemaFilterLogIndexSerializer", + "SchemaFilterSchemaFilterFunctionsSerializer", + "SchemaFilterSchemaFilterFunctionsCallsSerializer", + "SchemaFilterSchemaFilterFunctionsTrafficSerializer", + "SchemaFilterSchemaFilterContainersSerializer", + "SchemaFilterSchemaFilterInferenceSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer", + "Sorting", + "Tags", + "TagsCondition", +] + + +class CostReportGetDetailedParams(TypedDict, total=False): + time_from: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """The start date of the report period (ISO 8601). + + The report starts from the beginning of this day. + """ + + time_to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """The end date of the report period (ISO 8601). + + The report ends just before the beginning of this day. + """ + + enable_last_day: bool + """Expenses for the last specified day are taken into account. + + As the default, False. + """ + + limit: int + """The response resources limit. Defaults to 10.""" + + offset: int + """The response resources offset.""" + + projects: Iterable[int] + """List of project IDs""" + + regions: Iterable[int] + """List of region IDs.""" + + response_format: Literal["csv_records", "json"] + """Format of the response (csv or json).""" + + schema_filter: SchemaFilter + """Extended filter for field filtering.""" + + sorting: Iterable[Sorting] + """List of sorting filters (JSON objects) fields: project. directions: asc, desc.""" + + tags: Tags + """Filter by tags""" + + types: List[ + Literal[ + "ai_cluster", + "ai_virtual_cluster", + "backup", + "baremetal", + "basic_vm", + "containers", + "dbaas_postgresql_connection_pooler", + "dbaas_postgresql_cpu", + "dbaas_postgresql_memory", + "dbaas_postgresql_public_network", + "dbaas_postgresql_volume", + "egress_traffic", + "external_ip", + "file_share", + "floatingip", + "functions", + "functions_calls", + "functions_traffic", + "image", + "inference", + "instance", + "load_balancer", + "log_index", + "snapshot", + "volume", + ] + ] + """List of resource types to be filtered in the report.""" + + +class SchemaFilterSchemaFilterSnapshotSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "source_volume_uuid", "type", "uuid", "volume_type"]] + """Field name to filter by""" + + type: Required[Literal["snapshot"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterInstanceSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["instance"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterAIClusterSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["ai_cluster"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterAIVirtualClusterSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["ai_virtual_cluster"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterBasicVmSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["basic_vm"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterBaremetalSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["baremetal"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterVolumeSerializer(TypedDict, total=False): + field: Required[Literal["attached_to_vm", "last_name", "last_size", "type", "uuid", "volume_type"]] + """Field name to filter by""" + + type: Required[Literal["volume"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFileShareSerializer(TypedDict, total=False): + field: Required[Literal["file_share_type", "last_name", "last_size", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["file_share"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterImageSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["image"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFloatingIPSerializer(TypedDict, total=False): + field: Required[Literal["ip_address", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["floatingip"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterEgressTrafficSerializer(TypedDict, total=False): + field: Required[Literal["instance_name", "instance_type", "port_id", "type", "vm_id"]] + """Field name to filter by""" + + type: Required[Literal["egress_traffic"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterLoadBalancerSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["load_balancer"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterExternalIPSerializer(TypedDict, total=False): + field: Required[Literal["attached_to_vm", "ip_address", "network_id", "port_id", "subnet_id", "type"]] + """Field name to filter by""" + + type: Required[Literal["external_ip"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterBackupSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "schedule_id", "source_volume_uuid", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["backup"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterLogIndexSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["log_index"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFunctionsSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["functions"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFunctionsCallsSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["functions_calls"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFunctionsTrafficSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["functions_traffic"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterContainersSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["containers"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterInferenceSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["inference"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid", "volume_type"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_volume"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_public_network"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_cpu"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_memory"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_connection_pooler"]] + + values: Required[List[str]] + """List of field values to filter""" + + +SchemaFilter: TypeAlias = Union[ + SchemaFilterSchemaFilterSnapshotSerializer, + SchemaFilterSchemaFilterInstanceSerializer, + SchemaFilterSchemaFilterAIClusterSerializer, + SchemaFilterSchemaFilterAIVirtualClusterSerializer, + SchemaFilterSchemaFilterBasicVmSerializer, + SchemaFilterSchemaFilterBaremetalSerializer, + SchemaFilterSchemaFilterVolumeSerializer, + SchemaFilterSchemaFilterFileShareSerializer, + SchemaFilterSchemaFilterImageSerializer, + SchemaFilterSchemaFilterFloatingIPSerializer, + SchemaFilterSchemaFilterEgressTrafficSerializer, + SchemaFilterSchemaFilterLoadBalancerSerializer, + SchemaFilterSchemaFilterExternalIPSerializer, + SchemaFilterSchemaFilterBackupSerializer, + SchemaFilterSchemaFilterLogIndexSerializer, + SchemaFilterSchemaFilterFunctionsSerializer, + SchemaFilterSchemaFilterFunctionsCallsSerializer, + SchemaFilterSchemaFilterFunctionsTrafficSerializer, + SchemaFilterSchemaFilterContainersSerializer, + SchemaFilterSchemaFilterInferenceSerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer, + SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer, +] + + +class Sorting(TypedDict, total=False): + billing_value: Literal["asc", "desc"] + + first_seen: Literal["asc", "desc"] + + last_name: Literal["asc", "desc"] + + last_seen: Literal["asc", "desc"] + + project: Literal["asc", "desc"] + + region: Literal["asc", "desc"] + + type: Literal["asc", "desc"] + + +class TagsCondition(TypedDict, total=False): + key: str + """The name of the tag to filter (e.g., '`os_version`').""" + + strict: bool + """Determines how strictly the tag value must match the specified value. + + If true, the tag value must exactly match the given value. If false, a less + strict match (e.g., partial or case-insensitive match) may be applied. + """ + + value: str + """The value of the tag to filter (e.g., '22.04').""" + + +class Tags(TypedDict, total=False): + conditions: Required[Iterable[TagsCondition]] + """A list of tag filtering conditions defining how tags should match.""" + + condition_type: Literal["AND", "OR"] + """Specifies whether conditions are combined using OR (default) or AND logic.""" diff --git a/src/gcore/types/cloud/usage_report.py b/src/gcore/types/cloud/usage_report.py new file mode 100644 index 00000000..5a95c09d --- /dev/null +++ b/src/gcore/types/cloud/usage_report.py @@ -0,0 +1,1612 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, Annotated, TypeAlias + +from ..._utils import PropertyInfo +from ..._models import BaseModel + +__all__ = [ + "UsageReport", + "Resource", + "ResourceResourceAIClusterSerializer", + "ResourceResourceAIVirtualClusterSerializer", + "ResourceResourceBaremetalSerializer", + "ResourceResourceBasicVmSerializer", + "ResourceResourceBackupSerializer", + "ResourceResourceContainerSerializer", + "ResourceResourceEgressTrafficSerializer", + "ResourceResourceExternalIPSerializer", + "ResourceResourceFileShareSerializer", + "ResourceResourceFloatingIPSerializer", + "ResourceResourceFunctionsSerializer", + "ResourceResourceFunctionCallsSerializer", + "ResourceResourceFunctionEgressTrafficSerializer", + "ResourceResourceImagesSerializer", + "ResourceResourceInferenceSerializer", + "ResourceResourceInstanceSerializer", + "ResourceResourceLoadBalancerSerializer", + "ResourceResourceLogIndexSerializer", + "ResourceResourceSnapshotSerializer", + "ResourceResourceVolumeSerializer", + "ResourceResourceDbaasPostgreSQLPoolerSerializer", + "ResourceResourceDbaasPostgreSQLMemorySerializer", + "ResourceResourceDbaasPostgreSQLPublicNetworkSerializer", + "ResourceResourceDbaasPostgreSqlcpuSerializer", + "ResourceResourceDbaasPostgreSQLVolumeSerializer", + "Total", + "TotalTotalAIClusterReportItemSerializer", + "TotalTotalAIVirtualClusterReportItemSerializer", + "TotalTotalBaremetalReportItemSerializer", + "TotalTotalBasicVmReportItemSerializer", + "TotalTotalContainerReportItemSerializer", + "TotalTotalEgressTrafficReportItemSerializer", + "TotalTotalExternalIPReportItemSerializer", + "TotalTotalFileShareReportItemSerializer", + "TotalTotalFloatingIPReportItemSerializer", + "TotalTotalFunctionsReportItemSerializer", + "TotalTotalFunctionCallsReportItemSerializer", + "TotalTotalFunctionEgressTrafficReportItemSerializer", + "TotalTotalImagesReportItemSerializer", + "TotalTotalInferenceReportItemSerializer", + "TotalTotalInstanceReportItemSerializer", + "TotalTotalLoadBalancerReportItemSerializer", + "TotalTotalLogIndexReportItemSerializer", + "TotalTotalSnapshotReportItemSerializer", + "TotalTotalVolumeReportItemSerializer", + "TotalTotalDbaasPostgreSQLPoolerReportItemSerializer", + "TotalTotalDbaasPostgreSQLMemoryReportItemSerializer", + "TotalTotalDbaasPostgreSQLPublicNetworkReportItemSerializer", + "TotalTotalDbaasPostgreSqlcpuReportItemSerializer", + "TotalTotalDbaasPostgreSQLVolumeReportItemSerializer", +] + + +class ResourceResourceAIClusterSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the Baremetal GPU cluster""" + + last_name: str + """Name of the AI cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["ai_cluster"] + + uuid: str + """UUID of the Baremetal GPU cluster""" + + +class ResourceResourceAIVirtualClusterSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the Virtual GPU cluster""" + + last_name: str + """Name of the AI cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["ai_virtual_cluster"] + + uuid: str + """UUID of the Virtual GPU cluster""" + + +class ResourceResourceBaremetalSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the bare metal server""" + + last_name: str + """Name of the bare metal server""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["baremetal"] + + uuid: str + """UUID of the bare metal server""" + + +class ResourceResourceBasicVmSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the basic VM""" + + last_name: str + """Name of the basic VM""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["basic_vm"] + + uuid: str + """UUID of the basic VM""" + + +class ResourceResourceBackupSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the backup""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + last_size: int + """Size of the backup in bytes""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + schedule_id: str + """ID of the backup schedule""" + + source_volume_uuid: str + """UUID of the source volume""" + + type: Literal["backup"] + + uuid: str + """UUID of the backup""" + + +class ResourceResourceContainerSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GBS"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the container""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["containers"] + + uuid: str + """UUID of the container""" + + +class ResourceResourceEgressTrafficSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["bytes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + instance_type: Literal["baremetal", "vm"] + """Type of the instance""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + port_id: str + """ID of the port the traffic is associated with""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: str + """Unit of size""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["egress_traffic"] + + vm_id: str + """ID of the bare metal server the traffic is associated with""" + + instance_name: Optional[str] = None + """Name of the instance""" + + +class ResourceResourceExternalIPSerializer(BaseModel): + attached_to_vm: Optional[str] = None + """ID of the VM the IP is attached to""" + + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + ip_address: str + """IP address""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + network_id: str + """ID of the network the IP is attached to""" + + port_id: str + """ID of the port the IP is associated with""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + subnet_id: str + """ID of the subnet the IP is attached to""" + + type: Literal["external_ip"] + + +class ResourceResourceFileShareSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + file_share_type: str + """Type of the file share""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the file share""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + last_size: int + """Size of the file share in bytes""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: Literal["GiB"] + """Unit of size""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["file_share"] + + uuid: str + """UUID of the file share""" + + +class ResourceResourceFloatingIPSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + ip_address: str + """IP address""" + + last_name: str + """Name of the floating IP""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["floatingip"] + + uuid: str + """UUID of the floating IP""" + + +class ResourceResourceFunctionsSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GBS"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the function""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions"] + + uuid: str + """UUID of the function""" + + +class ResourceResourceFunctionCallsSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["MLS"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the function call""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions_calls"] + + uuid: str + """UUID of the function call""" + + +class ResourceResourceFunctionEgressTrafficSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GB"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the function egress traffic""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions_traffic"] + + uuid: str + """UUID of the function egress traffic""" + + +class ResourceResourceImagesSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the image""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + last_size: int + """Size of the image in bytes""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: Literal["bytes"] + """Unit of size""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["image"] + + uuid: str + """UUID of the image""" + + +class ResourceResourceInferenceSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: str + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the inference deployment""" + + last_name: str + """Name of the inference deployment""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["inference"] + + uuid: str + """UUID of the inference deployment""" + + +class ResourceResourceInstanceSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the instance""" + + last_name: str + """Name of the instance""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["instance"] + + uuid: str + """UUID of the instance""" + + +class ResourceResourceLoadBalancerSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + flavor: str + """Flavor of the load balancer""" + + last_name: str + """Name of the load balancer""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["load_balancer"] + + uuid: str + """UUID of the load balancer""" + + +class ResourceResourceLogIndexSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the log index""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + last_size: int + """Size of the log index in bytes""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: str + """Unit of size""" + + type: Literal["log_index"] + + uuid: Optional[str] = None + """UUID of the log index""" + + +class ResourceResourceSnapshotSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the snapshot""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + last_size: int + """Size of the snapshot in bytes""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: str + """Unit of size""" + + source_volume_uuid: str + """UUID of the source volume""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["snapshot"] + + uuid: str + """UUID of the snapshot""" + + volume_type: str + """Type of the volume""" + + +class ResourceResourceVolumeSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the volume""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + last_size: int + """Size of the volume in bytes""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: str + """Unit of size""" + + tags: Optional[List[Dict[str, str]]] = None + """List of tags""" + + type: Literal["volume"] + + uuid: str + """UUID of the volume""" + + volume_type: str + """Type of the volume""" + + attached_to_vm: Optional[str] = None + """ID of the VM the volume is attached to""" + + +class ResourceResourceDbaasPostgreSQLPoolerSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_connection_pooler"] + + uuid: str + """UUID of the cluster""" + + +class ResourceResourceDbaasPostgreSQLMemorySerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_memory"] + + uuid: str + """UUID of the cluster""" + + +class ResourceResourceDbaasPostgreSQLPublicNetworkSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_public_network"] + + uuid: str + """UUID of the cluster""" + + +class ResourceResourceDbaasPostgreSqlcpuSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_cpu"] + + uuid: str + """UUID of the cluster""" + + +class ResourceResourceDbaasPostgreSQLVolumeSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + first_seen: datetime + """First time the resource was seen in the given period""" + + last_name: str + """Name of the cluster""" + + last_seen: datetime + """Last time the resource was seen in the given period""" + + project_id: int + """ID of the project the resource belongs to""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + size_unit: str + """Unit of size""" + + type: Literal["dbaas_postgresql_volume"] + + uuid: str + """UUID of the cluster""" + + volume_type: str + """Type of the volume""" + + +Resource: TypeAlias = Annotated[ + Union[ + ResourceResourceAIClusterSerializer, + ResourceResourceAIVirtualClusterSerializer, + ResourceResourceBaremetalSerializer, + ResourceResourceBasicVmSerializer, + ResourceResourceBackupSerializer, + ResourceResourceContainerSerializer, + ResourceResourceEgressTrafficSerializer, + ResourceResourceExternalIPSerializer, + ResourceResourceFileShareSerializer, + ResourceResourceFloatingIPSerializer, + ResourceResourceFunctionsSerializer, + ResourceResourceFunctionCallsSerializer, + ResourceResourceFunctionEgressTrafficSerializer, + ResourceResourceImagesSerializer, + ResourceResourceInferenceSerializer, + ResourceResourceInstanceSerializer, + ResourceResourceLoadBalancerSerializer, + ResourceResourceLogIndexSerializer, + ResourceResourceSnapshotSerializer, + ResourceResourceVolumeSerializer, + ResourceResourceDbaasPostgreSQLPoolerSerializer, + ResourceResourceDbaasPostgreSQLMemorySerializer, + ResourceResourceDbaasPostgreSQLPublicNetworkSerializer, + ResourceResourceDbaasPostgreSqlcpuSerializer, + ResourceResourceDbaasPostgreSQLVolumeSerializer, + ], + PropertyInfo(discriminator="type"), +] + + +class TotalTotalAIClusterReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + flavor: str + """Flavor of the Baremetal GPU cluster""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["ai_cluster"] + + +class TotalTotalAIVirtualClusterReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + flavor: str + """Flavor of the Virtual GPU cluster""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["ai_virtual_cluster"] + + +class TotalTotalBaremetalReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + flavor: str + """Flavor of the bare metal server""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["baremetal"] + + +class TotalTotalBasicVmReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + flavor: str + """Flavor of the basic VM""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["basic_vm"] + + +class TotalTotalContainerReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GBS"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["containers"] + + +class TotalTotalEgressTrafficReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["bytes"] + """Unit of billing value""" + + instance_type: Literal["baremetal", "vm"] + """Type of the instance""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["egress_traffic"] + + +class TotalTotalExternalIPReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["external_ip"] + + +class TotalTotalFileShareReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + file_share_type: str + """Type of the file share""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["file_share"] + + +class TotalTotalFloatingIPReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["floatingip"] + + +class TotalTotalFunctionsReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GBS"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions"] + + +class TotalTotalFunctionCallsReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["MLS"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions_calls"] + + +class TotalTotalFunctionEgressTrafficReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["GB"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["functions_traffic"] + + +class TotalTotalImagesReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["image"] + + +class TotalTotalInferenceReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: str + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["inference"] + + +class TotalTotalInstanceReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + flavor: str + """Flavor of the instance""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["instance"] + + +class TotalTotalLoadBalancerReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + flavor: str + """Flavor of the load balancer""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["load_balancer"] + + +class TotalTotalLogIndexReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["log_index"] + + +class TotalTotalSnapshotReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["snapshot"] + + volume_type: str + """Type of the volume""" + + +class TotalTotalVolumeReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["volume"] + + volume_type: str + """Type of the volume""" + + +class TotalTotalDbaasPostgreSQLPoolerReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_connection_pooler"] + + +class TotalTotalDbaasPostgreSQLMemoryReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_memory"] + + +class TotalTotalDbaasPostgreSQLPublicNetworkReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_public_network"] + + +class TotalTotalDbaasPostgreSqlcpuReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["minutes"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_cpu"] + + +class TotalTotalDbaasPostgreSQLVolumeReportItemSerializer(BaseModel): + billing_metric_name: str + """Name of the billing metric""" + + billing_value: float + """Value of the billing metric""" + + billing_value_unit: Literal["gbminutes"] + """Unit of billing value""" + + region: int + """Region ID""" + + region_id: int + """Region ID""" + + type: Literal["dbaas_postgresql_volume"] + + volume_type: str + """Type of the volume""" + + +Total: TypeAlias = Annotated[ + Union[ + TotalTotalAIClusterReportItemSerializer, + TotalTotalAIVirtualClusterReportItemSerializer, + TotalTotalBaremetalReportItemSerializer, + TotalTotalBasicVmReportItemSerializer, + TotalTotalContainerReportItemSerializer, + TotalTotalEgressTrafficReportItemSerializer, + TotalTotalExternalIPReportItemSerializer, + TotalTotalFileShareReportItemSerializer, + TotalTotalFloatingIPReportItemSerializer, + TotalTotalFunctionsReportItemSerializer, + TotalTotalFunctionCallsReportItemSerializer, + TotalTotalFunctionEgressTrafficReportItemSerializer, + TotalTotalImagesReportItemSerializer, + TotalTotalInferenceReportItemSerializer, + TotalTotalInstanceReportItemSerializer, + TotalTotalLoadBalancerReportItemSerializer, + TotalTotalLogIndexReportItemSerializer, + TotalTotalSnapshotReportItemSerializer, + TotalTotalVolumeReportItemSerializer, + TotalTotalDbaasPostgreSQLPoolerReportItemSerializer, + TotalTotalDbaasPostgreSQLMemoryReportItemSerializer, + TotalTotalDbaasPostgreSQLPublicNetworkReportItemSerializer, + TotalTotalDbaasPostgreSqlcpuReportItemSerializer, + TotalTotalDbaasPostgreSQLVolumeReportItemSerializer, + ], + PropertyInfo(discriminator="type"), +] + + +class UsageReport(BaseModel): + count: int + """Total count of the resources""" + + resources: List[Resource] + + totals: List[Total] diff --git a/src/gcore/types/cloud/usage_report_get_params.py b/src/gcore/types/cloud/usage_report_get_params.py new file mode 100644 index 00000000..336bcd46 --- /dev/null +++ b/src/gcore/types/cloud/usage_report_get_params.py @@ -0,0 +1,432 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable, Optional +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict + +from ..._utils import PropertyInfo + +__all__ = [ + "UsageReportGetParams", + "SchemaFilter", + "SchemaFilterSchemaFilterSnapshotSerializer", + "SchemaFilterSchemaFilterInstanceSerializer", + "SchemaFilterSchemaFilterAIClusterSerializer", + "SchemaFilterSchemaFilterAIVirtualClusterSerializer", + "SchemaFilterSchemaFilterBasicVmSerializer", + "SchemaFilterSchemaFilterBaremetalSerializer", + "SchemaFilterSchemaFilterVolumeSerializer", + "SchemaFilterSchemaFilterFileShareSerializer", + "SchemaFilterSchemaFilterImageSerializer", + "SchemaFilterSchemaFilterFloatingIPSerializer", + "SchemaFilterSchemaFilterEgressTrafficSerializer", + "SchemaFilterSchemaFilterLoadBalancerSerializer", + "SchemaFilterSchemaFilterExternalIPSerializer", + "SchemaFilterSchemaFilterBackupSerializer", + "SchemaFilterSchemaFilterLogIndexSerializer", + "SchemaFilterSchemaFilterFunctionsSerializer", + "SchemaFilterSchemaFilterFunctionsCallsSerializer", + "SchemaFilterSchemaFilterFunctionsTrafficSerializer", + "SchemaFilterSchemaFilterContainersSerializer", + "SchemaFilterSchemaFilterInferenceSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer", + "SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer", + "Sorting", + "Tags", + "TagsCondition", +] + + +class UsageReportGetParams(TypedDict, total=False): + time_from: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """The start date of the report period (ISO 8601). + + The report starts from the beginning of this day. + """ + + time_to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """The end date of the report period (ISO 8601). + + The report ends just before the beginning of this day. + """ + + enable_last_day: bool + """Expenses for the last specified day are taken into account. + + As the default, False. + """ + + limit: int + """The response resources limit. Defaults to 10.""" + + offset: int + """The response resources offset.""" + + projects: Optional[Iterable[int]] + """List of project IDs""" + + regions: Iterable[int] + """List of region IDs.""" + + schema_filter: SchemaFilter + """Extended filter for field filtering.""" + + sorting: Iterable[Sorting] + """List of sorting filters (JSON objects) fields: project. directions: asc, desc.""" + + tags: Tags + """Filter by tags""" + + types: List[ + Literal[ + "ai_cluster", + "ai_virtual_cluster", + "backup", + "baremetal", + "basic_vm", + "containers", + "dbaas_postgresql_connection_pooler", + "dbaas_postgresql_cpu", + "dbaas_postgresql_memory", + "dbaas_postgresql_public_network", + "dbaas_postgresql_volume", + "egress_traffic", + "external_ip", + "file_share", + "floatingip", + "functions", + "functions_calls", + "functions_traffic", + "image", + "inference", + "instance", + "load_balancer", + "log_index", + "snapshot", + "volume", + ] + ] + """List of resource types to be filtered in the report.""" + + +class SchemaFilterSchemaFilterSnapshotSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "source_volume_uuid", "type", "uuid", "volume_type"]] + """Field name to filter by""" + + type: Required[Literal["snapshot"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterInstanceSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["instance"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterAIClusterSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["ai_cluster"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterAIVirtualClusterSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["ai_virtual_cluster"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterBasicVmSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["basic_vm"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterBaremetalSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["baremetal"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterVolumeSerializer(TypedDict, total=False): + field: Required[Literal["attached_to_vm", "last_name", "last_size", "type", "uuid", "volume_type"]] + """Field name to filter by""" + + type: Required[Literal["volume"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFileShareSerializer(TypedDict, total=False): + field: Required[Literal["file_share_type", "last_name", "last_size", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["file_share"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterImageSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["image"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFloatingIPSerializer(TypedDict, total=False): + field: Required[Literal["ip_address", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["floatingip"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterEgressTrafficSerializer(TypedDict, total=False): + field: Required[Literal["instance_name", "instance_type", "port_id", "type", "vm_id"]] + """Field name to filter by""" + + type: Required[Literal["egress_traffic"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterLoadBalancerSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["load_balancer"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterExternalIPSerializer(TypedDict, total=False): + field: Required[Literal["attached_to_vm", "ip_address", "network_id", "port_id", "subnet_id", "type"]] + """Field name to filter by""" + + type: Required[Literal["external_ip"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterBackupSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "schedule_id", "source_volume_uuid", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["backup"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterLogIndexSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "last_size", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["log_index"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFunctionsSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["functions"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFunctionsCallsSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["functions_calls"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterFunctionsTrafficSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["functions_traffic"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterContainersSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["containers"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterInferenceSerializer(TypedDict, total=False): + field: Required[Literal["flavor", "last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["inference"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid", "volume_type"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_volume"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_public_network"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_cpu"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_memory"]] + + values: Required[List[str]] + """List of field values to filter""" + + +class SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer(TypedDict, total=False): + field: Required[Literal["last_name", "type", "uuid"]] + """Field name to filter by""" + + type: Required[Literal["dbaas_postgresql_connection_pooler"]] + + values: Required[List[str]] + """List of field values to filter""" + + +SchemaFilter: TypeAlias = Union[ + SchemaFilterSchemaFilterSnapshotSerializer, + SchemaFilterSchemaFilterInstanceSerializer, + SchemaFilterSchemaFilterAIClusterSerializer, + SchemaFilterSchemaFilterAIVirtualClusterSerializer, + SchemaFilterSchemaFilterBasicVmSerializer, + SchemaFilterSchemaFilterBaremetalSerializer, + SchemaFilterSchemaFilterVolumeSerializer, + SchemaFilterSchemaFilterFileShareSerializer, + SchemaFilterSchemaFilterImageSerializer, + SchemaFilterSchemaFilterFloatingIPSerializer, + SchemaFilterSchemaFilterEgressTrafficSerializer, + SchemaFilterSchemaFilterLoadBalancerSerializer, + SchemaFilterSchemaFilterExternalIPSerializer, + SchemaFilterSchemaFilterBackupSerializer, + SchemaFilterSchemaFilterLogIndexSerializer, + SchemaFilterSchemaFilterFunctionsSerializer, + SchemaFilterSchemaFilterFunctionsCallsSerializer, + SchemaFilterSchemaFilterFunctionsTrafficSerializer, + SchemaFilterSchemaFilterContainersSerializer, + SchemaFilterSchemaFilterInferenceSerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer, + SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer, + SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer, +] + + +class Sorting(TypedDict, total=False): + billing_value: Literal["asc", "desc"] + + first_seen: Literal["asc", "desc"] + + last_name: Literal["asc", "desc"] + + last_seen: Literal["asc", "desc"] + + project: Literal["asc", "desc"] + + region: Literal["asc", "desc"] + + type: Literal["asc", "desc"] + + +class TagsCondition(TypedDict, total=False): + key: str + """The name of the tag to filter (e.g., '`os_version`').""" + + strict: bool + """Determines how strictly the tag value must match the specified value. + + If true, the tag value must exactly match the given value. If false, a less + strict match (e.g., partial or case-insensitive match) may be applied. + """ + + value: str + """The value of the tag to filter (e.g., '22.04').""" + + +class Tags(TypedDict, total=False): + conditions: Required[Iterable[TagsCondition]] + """A list of tag filtering conditions defining how tags should match.""" + + condition_type: Literal["AND", "OR"] + """Specifies whether conditions are combined using OR (default) or AND logic.""" diff --git a/tests/api_resources/cloud/test_cost_reports.py b/tests/api_resources/cloud/test_cost_reports.py new file mode 100644 index 00000000..c3a087fe --- /dev/null +++ b/tests/api_resources/cloud/test_cost_reports.py @@ -0,0 +1,453 @@ +# 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._utils import parse_datetime +from gcore.types.cloud import ( + CostReportDetailed, + CostReportAggregated, + CostReportAggregatedMonthly, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCostReports: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_aggregated(self, client: Gcore) -> None: + cost_report = client.cloud.cost_reports.get_aggregated( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) + assert_matches_type(CostReportAggregated, cost_report, path=["response"]) + + @parametrize + def test_method_get_aggregated_with_all_params(self, client: Gcore) -> None: + cost_report = client.cloud.cost_reports.get_aggregated( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + enable_last_day=False, + projects=[16, 17, 18, 19, 20], + regions=[1, 2, 3], + response_format="csv_totals", + schema_filter={ + "field": "flavor", + "type": "instance", + "values": ["g1-standard-1-2"], + }, + tags={ + "conditions": [ + { + "key": "os_version", + "strict": True, + "value": "22.04", + }, + { + "key": "os_version", + "strict": True, + "value": "23.04", + }, + ], + "condition_type": "OR", + }, + types=["egress_traffic", "instance"], + ) + assert_matches_type(CostReportAggregated, cost_report, path=["response"]) + + @parametrize + def test_raw_response_get_aggregated(self, client: Gcore) -> None: + response = client.cloud.cost_reports.with_raw_response.get_aggregated( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cost_report = response.parse() + assert_matches_type(CostReportAggregated, cost_report, path=["response"]) + + @parametrize + def test_streaming_response_get_aggregated(self, client: Gcore) -> None: + with client.cloud.cost_reports.with_streaming_response.get_aggregated( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cost_report = response.parse() + assert_matches_type(CostReportAggregated, cost_report, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_aggregated_monthly(self, client: Gcore) -> None: + cost_report = client.cloud.cost_reports.get_aggregated_monthly( + time_from=parse_datetime("2019-12-27T18:11:19.117Z"), + time_to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(CostReportAggregatedMonthly, cost_report, path=["response"]) + + @parametrize + def test_method_get_aggregated_monthly_with_all_params(self, client: Gcore) -> None: + cost_report = client.cloud.cost_reports.get_aggregated_monthly( + time_from=parse_datetime("2019-12-27T18:11:19.117Z"), + time_to=parse_datetime("2019-12-27T18:11:19.117Z"), + regions=[1, 2, 3], + response_format="csv_totals", + schema_filter={ + "field": "flavor", + "type": "instance", + "values": ["g1-standard-1-2"], + }, + tags={ + "conditions": [ + { + "key": "os_version", + "strict": True, + "value": "22.04", + }, + { + "key": "os_version", + "strict": True, + "value": "23.04", + }, + ], + "condition_type": "OR", + }, + types=["egress_traffic", "instance"], + ) + assert_matches_type(CostReportAggregatedMonthly, cost_report, path=["response"]) + + @parametrize + def test_raw_response_get_aggregated_monthly(self, client: Gcore) -> None: + response = client.cloud.cost_reports.with_raw_response.get_aggregated_monthly( + time_from=parse_datetime("2019-12-27T18:11:19.117Z"), + time_to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cost_report = response.parse() + assert_matches_type(CostReportAggregatedMonthly, cost_report, path=["response"]) + + @parametrize + def test_streaming_response_get_aggregated_monthly(self, client: Gcore) -> None: + with client.cloud.cost_reports.with_streaming_response.get_aggregated_monthly( + time_from=parse_datetime("2019-12-27T18:11:19.117Z"), + time_to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cost_report = response.parse() + assert_matches_type(CostReportAggregatedMonthly, cost_report, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_detailed(self, client: Gcore) -> None: + cost_report = client.cloud.cost_reports.get_detailed( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) + assert_matches_type(CostReportDetailed, cost_report, path=["response"]) + + @parametrize + def test_method_get_detailed_with_all_params(self, client: Gcore) -> None: + cost_report = client.cloud.cost_reports.get_detailed( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + enable_last_day=False, + limit=10, + offset=0, + projects=[16, 17, 18, 19, 20], + regions=[1, 2, 3], + response_format="csv_records", + schema_filter={ + "field": "flavor", + "type": "instance", + "values": ["g1-standard-1-2"], + }, + sorting=[ + { + "billing_value": "asc", + "first_seen": "asc", + "last_name": "asc", + "last_seen": "asc", + "project": "asc", + "region": "asc", + "type": "asc", + } + ], + tags={ + "conditions": [ + { + "key": "os_version", + "strict": True, + "value": "22.04", + }, + { + "key": "os_version", + "strict": True, + "value": "23.04", + }, + ], + "condition_type": "OR", + }, + types=["egress_traffic", "instance"], + ) + assert_matches_type(CostReportDetailed, cost_report, path=["response"]) + + @parametrize + def test_raw_response_get_detailed(self, client: Gcore) -> None: + response = client.cloud.cost_reports.with_raw_response.get_detailed( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cost_report = response.parse() + assert_matches_type(CostReportDetailed, cost_report, path=["response"]) + + @parametrize + def test_streaming_response_get_detailed(self, client: Gcore) -> None: + with client.cloud.cost_reports.with_streaming_response.get_detailed( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cost_report = response.parse() + assert_matches_type(CostReportDetailed, cost_report, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCostReports: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get_aggregated(self, async_client: AsyncGcore) -> None: + cost_report = await async_client.cloud.cost_reports.get_aggregated( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) + assert_matches_type(CostReportAggregated, cost_report, path=["response"]) + + @parametrize + async def test_method_get_aggregated_with_all_params(self, async_client: AsyncGcore) -> None: + cost_report = await async_client.cloud.cost_reports.get_aggregated( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + enable_last_day=False, + projects=[16, 17, 18, 19, 20], + regions=[1, 2, 3], + response_format="csv_totals", + schema_filter={ + "field": "flavor", + "type": "instance", + "values": ["g1-standard-1-2"], + }, + tags={ + "conditions": [ + { + "key": "os_version", + "strict": True, + "value": "22.04", + }, + { + "key": "os_version", + "strict": True, + "value": "23.04", + }, + ], + "condition_type": "OR", + }, + types=["egress_traffic", "instance"], + ) + assert_matches_type(CostReportAggregated, cost_report, path=["response"]) + + @parametrize + async def test_raw_response_get_aggregated(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.cost_reports.with_raw_response.get_aggregated( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cost_report = await response.parse() + assert_matches_type(CostReportAggregated, cost_report, path=["response"]) + + @parametrize + async def test_streaming_response_get_aggregated(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.cost_reports.with_streaming_response.get_aggregated( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cost_report = await response.parse() + assert_matches_type(CostReportAggregated, cost_report, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_aggregated_monthly(self, async_client: AsyncGcore) -> None: + cost_report = await async_client.cloud.cost_reports.get_aggregated_monthly( + time_from=parse_datetime("2019-12-27T18:11:19.117Z"), + time_to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(CostReportAggregatedMonthly, cost_report, path=["response"]) + + @parametrize + async def test_method_get_aggregated_monthly_with_all_params(self, async_client: AsyncGcore) -> None: + cost_report = await async_client.cloud.cost_reports.get_aggregated_monthly( + time_from=parse_datetime("2019-12-27T18:11:19.117Z"), + time_to=parse_datetime("2019-12-27T18:11:19.117Z"), + regions=[1, 2, 3], + response_format="csv_totals", + schema_filter={ + "field": "flavor", + "type": "instance", + "values": ["g1-standard-1-2"], + }, + tags={ + "conditions": [ + { + "key": "os_version", + "strict": True, + "value": "22.04", + }, + { + "key": "os_version", + "strict": True, + "value": "23.04", + }, + ], + "condition_type": "OR", + }, + types=["egress_traffic", "instance"], + ) + assert_matches_type(CostReportAggregatedMonthly, cost_report, path=["response"]) + + @parametrize + async def test_raw_response_get_aggregated_monthly(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.cost_reports.with_raw_response.get_aggregated_monthly( + time_from=parse_datetime("2019-12-27T18:11:19.117Z"), + time_to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cost_report = await response.parse() + assert_matches_type(CostReportAggregatedMonthly, cost_report, path=["response"]) + + @parametrize + async def test_streaming_response_get_aggregated_monthly(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.cost_reports.with_streaming_response.get_aggregated_monthly( + time_from=parse_datetime("2019-12-27T18:11:19.117Z"), + time_to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cost_report = await response.parse() + assert_matches_type(CostReportAggregatedMonthly, cost_report, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_detailed(self, async_client: AsyncGcore) -> None: + cost_report = await async_client.cloud.cost_reports.get_detailed( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) + assert_matches_type(CostReportDetailed, cost_report, path=["response"]) + + @parametrize + async def test_method_get_detailed_with_all_params(self, async_client: AsyncGcore) -> None: + cost_report = await async_client.cloud.cost_reports.get_detailed( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + enable_last_day=False, + limit=10, + offset=0, + projects=[16, 17, 18, 19, 20], + regions=[1, 2, 3], + response_format="csv_records", + schema_filter={ + "field": "flavor", + "type": "instance", + "values": ["g1-standard-1-2"], + }, + sorting=[ + { + "billing_value": "asc", + "first_seen": "asc", + "last_name": "asc", + "last_seen": "asc", + "project": "asc", + "region": "asc", + "type": "asc", + } + ], + tags={ + "conditions": [ + { + "key": "os_version", + "strict": True, + "value": "22.04", + }, + { + "key": "os_version", + "strict": True, + "value": "23.04", + }, + ], + "condition_type": "OR", + }, + types=["egress_traffic", "instance"], + ) + assert_matches_type(CostReportDetailed, cost_report, path=["response"]) + + @parametrize + async def test_raw_response_get_detailed(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.cost_reports.with_raw_response.get_detailed( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cost_report = await response.parse() + assert_matches_type(CostReportDetailed, cost_report, path=["response"]) + + @parametrize + async def test_streaming_response_get_detailed(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.cost_reports.with_streaming_response.get_detailed( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cost_report = await response.parse() + assert_matches_type(CostReportDetailed, cost_report, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_usage_reports.py b/tests/api_resources/cloud/test_usage_reports.py new file mode 100644 index 00000000..76b1417d --- /dev/null +++ b/tests/api_resources/cloud/test_usage_reports.py @@ -0,0 +1,183 @@ +# 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._utils import parse_datetime +from gcore.types.cloud import UsageReport + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestUsageReports: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + usage_report = client.cloud.usage_reports.get( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) + assert_matches_type(UsageReport, usage_report, path=["response"]) + + @parametrize + def test_method_get_with_all_params(self, client: Gcore) -> None: + usage_report = client.cloud.usage_reports.get( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + enable_last_day=False, + limit=10, + offset=0, + projects=[16, 17, 18, 19, 20], + regions=[1, 2, 3], + schema_filter={ + "field": "flavor", + "type": "instance", + "values": ["g1-standard-1-2"], + }, + sorting=[ + { + "billing_value": "asc", + "first_seen": "asc", + "last_name": "asc", + "last_seen": "asc", + "project": "asc", + "region": "asc", + "type": "asc", + } + ], + tags={ + "conditions": [ + { + "key": "os_version", + "strict": True, + "value": "22.04", + }, + { + "key": "os_version", + "strict": True, + "value": "23.04", + }, + ], + "condition_type": "OR", + }, + types=["egress_traffic", "instance"], + ) + assert_matches_type(UsageReport, usage_report, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.usage_reports.with_raw_response.get( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + usage_report = response.parse() + assert_matches_type(UsageReport, usage_report, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.usage_reports.with_streaming_response.get( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + usage_report = response.parse() + assert_matches_type(UsageReport, usage_report, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncUsageReports: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + usage_report = await async_client.cloud.usage_reports.get( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) + assert_matches_type(UsageReport, usage_report, path=["response"]) + + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: + usage_report = await async_client.cloud.usage_reports.get( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + enable_last_day=False, + limit=10, + offset=0, + projects=[16, 17, 18, 19, 20], + regions=[1, 2, 3], + schema_filter={ + "field": "flavor", + "type": "instance", + "values": ["g1-standard-1-2"], + }, + sorting=[ + { + "billing_value": "asc", + "first_seen": "asc", + "last_name": "asc", + "last_seen": "asc", + "project": "asc", + "region": "asc", + "type": "asc", + } + ], + tags={ + "conditions": [ + { + "key": "os_version", + "strict": True, + "value": "22.04", + }, + { + "key": "os_version", + "strict": True, + "value": "23.04", + }, + ], + "condition_type": "OR", + }, + types=["egress_traffic", "instance"], + ) + assert_matches_type(UsageReport, usage_report, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.usage_reports.with_raw_response.get( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + usage_report = await response.parse() + assert_matches_type(UsageReport, usage_report, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.usage_reports.with_streaming_response.get( + time_from=parse_datetime("2023-01-01T00:00:00Z"), + time_to=parse_datetime("2023-02-01T00:00:00Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + usage_report = await response.parse() + assert_matches_type(UsageReport, usage_report, path=["response"]) + + assert cast(Any, response.is_closed) is True From a7682e364c9c58aa3be4bbdc845a0d6d05eca8f8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Jul 2025 05:46:58 +0000 Subject: [PATCH 220/592] chore(project): add settings file for vscode --- .gitignore | 1 - .vscode/settings.json | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 87797408..95ceb189 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .prism.log -.vscode _dev __pycache__ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..5b010307 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.analysis.importFormat": "relative", +} From 050d1ee90f306fed1cae7d7d7302ce6c7c7f7a67 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 28 Jul 2025 16:12:28 +0000 Subject: [PATCH 221/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cloud/floating_ip.py | 9 --------- src/gcore/types/cloud/floating_ip_detailed.py | 9 --------- src/gcore/types/cloud/subnet.py | 2 +- 4 files changed, 3 insertions(+), 21 deletions(-) diff --git a/.stats.yml b/.stats.yml index e53dc8ff..0b92cca4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 435 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e9b9e784385ee4f4b68bedb15549bbbaa0324481e8198b1c1b94ebd172bb852b.yml -openapi_spec_hash: cb6a5fd0fb6675937c1e0de8e103de78 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ab0fe59013c4d339e8c4b80a14a7fd47f505b8d7e39b86c9aef60a5197eb397c.yml +openapi_spec_hash: eb9b067d5941f4334c192fac903df86d config_hash: daaf9739c48a00883985847ba3e6a2a0 diff --git a/src/gcore/types/cloud/floating_ip.py b/src/gcore/types/cloud/floating_ip.py index b111c43d..ffcc744a 100644 --- a/src/gcore/types/cloud/floating_ip.py +++ b/src/gcore/types/cloud/floating_ip.py @@ -20,12 +20,6 @@ class FloatingIP(BaseModel): creator_task_id: Optional[str] = None """Task that created this entity""" - dns_domain: Optional[str] = None - """This field is deprecated and can be ignored""" - - dns_name: Optional[str] = None - """This field is deprecated and can be ignored""" - fixed_ip_address: Optional[str] = None """IP address of the port the floating IP is attached to""" @@ -53,9 +47,6 @@ class FloatingIP(BaseModel): status: Optional[FloatingIPStatus] = None """Floating IP status""" - subnet_id: Optional[str] = None - """This field is deprecated and can be ignored""" - tags: List[Tag] """List of key-value tags associated with the resource. diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index de44f4e4..2f4c6a3c 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -162,12 +162,6 @@ class FloatingIPDetailed(BaseModel): creator_task_id: Optional[str] = None """Task that created this entity""" - dns_domain: Optional[str] = None - """This field is deprecated and can be ignored""" - - dns_name: Optional[str] = None - """This field is deprecated and can be ignored""" - fixed_ip_address: Optional[str] = None """IP address of the port the floating IP is attached to""" @@ -198,9 +192,6 @@ class FloatingIPDetailed(BaseModel): status: Optional[FloatingIPStatus] = None """Floating IP status""" - subnet_id: Optional[str] = None - """This field is deprecated and can be ignored""" - tags: List[Tag] """List of key-value tags associated with the resource. diff --git a/src/gcore/types/cloud/subnet.py b/src/gcore/types/cloud/subnet.py index 4d16da48..d6f0aece 100644 --- a/src/gcore/types/cloud/subnet.py +++ b/src/gcore/types/cloud/subnet.py @@ -71,7 +71,7 @@ class Subnet(BaseModel): """ has_router: Optional[bool] = None - """Subnet has router attached to it""" + """Deprecated. Always returns `false`.""" host_routes: Optional[List[Route]] = None """List of custom static routes to advertise via DHCP.""" From bf8dba11cd2e91d8797686f5accb3e6131b607cd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Jul 2025 08:13:38 +0000 Subject: [PATCH 222/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0b92cca4..131b8853 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 435 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ab0fe59013c4d339e8c4b80a14a7fd47f505b8d7e39b86c9aef60a5197eb397c.yml -openapi_spec_hash: eb9b067d5941f4334c192fac903df86d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fbb9d19be4372c25c119a6eb3d0eccef7991ea2f2f80dd24a0d11f66410a0dc7.yml +openapi_spec_hash: 236188aa22c2cc5608dd38256806829d config_hash: daaf9739c48a00883985847ba3e6a2a0 From fbd8d564c594199b7f1af71e1b39999a0bab06c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Jul 2025 10:11:23 +0000 Subject: [PATCH 223/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- api.md | 4 ++-- src/gcore/resources/iam/users.py | 16 +++++++-------- src/gcore/types/iam/__init__.py | 2 +- .../iam/{user.py => user_list_response.py} | 4 ++-- tests/api_resources/iam/test_users.py | 20 +++++++++---------- 6 files changed, 25 insertions(+), 25 deletions(-) rename src/gcore/types/iam/{user.py => user_list_response.py} (96%) diff --git a/.stats.yml b/.stats.yml index 131b8853..94043ec3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 435 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fbb9d19be4372c25c119a6eb3d0eccef7991ea2f2f80dd24a0d11f66410a0dc7.yml -openapi_spec_hash: 236188aa22c2cc5608dd38256806829d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a9da6b57df49a81e7c47a2a0fb365272782daba902d7d0151ff5132d12f75a78.yml +openapi_spec_hash: a485e882e6446a14ce5380529618d9c1 config_hash: daaf9739c48a00883985847ba3e6a2a0 diff --git a/api.md b/api.md index af3383ee..ba2855ba 100644 --- a/api.md +++ b/api.md @@ -1235,13 +1235,13 @@ Methods: Types: ```python -from gcore.types.iam import User, UserDetailed, UserInvite, UserUpdate +from gcore.types.iam import UserDetailed, UserInvite, UserUpdate, UserListResponse ``` Methods: - client.iam.users.update(user_id, \*\*params) -> UserUpdate -- client.iam.users.list(\*\*params) -> SyncOffsetPageIam[User] +- client.iam.users.list(\*\*params) -> SyncOffsetPage[UserListResponse] - client.iam.users.delete(user_id, \*, client_id) -> None - client.iam.users.get(user_id) -> UserDetailed - client.iam.users.invite(\*\*params) -> UserInvite diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index 8ba9d6de..a636398c 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -18,12 +18,12 @@ async_to_streamed_response_wrapper, ) from ...types.iam import user_list_params, user_invite_params, user_update_params -from ...pagination import SyncOffsetPageIam, AsyncOffsetPageIam +from ...pagination import SyncOffsetPage, AsyncOffsetPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.iam.user import User from ...types.iam.user_invite import UserInvite from ...types.iam.user_update import UserUpdate from ...types.iam.user_detailed import UserDetailed +from ...types.iam.user_list_response import UserListResponse __all__ = ["UsersResource", "AsyncUsersResource"] @@ -131,7 +131,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPageIam[User]: + ) -> SyncOffsetPage[UserListResponse]: """Get a list of users. Pass a value for the `limit` parameter in your request if @@ -153,7 +153,7 @@ def list( """ return self._get_api_list( "/iam/users", - page=SyncOffsetPageIam[User], + page=SyncOffsetPage[UserListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -167,7 +167,7 @@ def list( user_list_params.UserListParams, ), ), - model=User, + model=UserListResponse, ) def delete( @@ -396,7 +396,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[User, AsyncOffsetPageIam[User]]: + ) -> AsyncPaginator[UserListResponse, AsyncOffsetPage[UserListResponse]]: """Get a list of users. Pass a value for the `limit` parameter in your request if @@ -418,7 +418,7 @@ def list( """ return self._get_api_list( "/iam/users", - page=AsyncOffsetPageIam[User], + page=AsyncOffsetPage[UserListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -432,7 +432,7 @@ def list( user_list_params.UserListParams, ), ), - model=User, + model=UserListResponse, ) async def delete( diff --git a/src/gcore/types/iam/__init__.py b/src/gcore/types/iam/__init__.py index ad8745f0..d6835611 100644 --- a/src/gcore/types/iam/__init__.py +++ b/src/gcore/types/iam/__init__.py @@ -2,7 +2,6 @@ from __future__ import annotations -from .user import User as User from .api_token import APIToken as APIToken from .user_invite import UserInvite as UserInvite from .user_update import UserUpdate as UserUpdate @@ -12,6 +11,7 @@ from .api_token_create import APITokenCreate as APITokenCreate from .user_list_params import UserListParams as UserListParams from .user_invite_params import UserInviteParams as UserInviteParams +from .user_list_response import UserListResponse as UserListResponse from .user_update_params import UserUpdateParams as UserUpdateParams from .api_token_list_params import APITokenListParams as APITokenListParams from .api_token_create_params import APITokenCreateParams as APITokenCreateParams diff --git a/src/gcore/types/iam/user.py b/src/gcore/types/iam/user_list_response.py similarity index 96% rename from src/gcore/types/iam/user.py rename to src/gcore/types/iam/user_list_response.py index 15424ee4..8e010611 100644 --- a/src/gcore/types/iam/user.py +++ b/src/gcore/types/iam/user_list_response.py @@ -5,7 +5,7 @@ from ..._models import BaseModel -__all__ = ["User", "Group"] +__all__ = ["UserListResponse", "Group"] class Group(BaseModel): @@ -24,7 +24,7 @@ class Group(BaseModel): """Group's name.""" -class User(BaseModel): +class UserListResponse(BaseModel): id: Optional[int] = None """User's ID.""" diff --git a/tests/api_resources/iam/test_users.py b/tests/api_resources/iam/test_users.py index de972b4d..bdc6a44e 100644 --- a/tests/api_resources/iam/test_users.py +++ b/tests/api_resources/iam/test_users.py @@ -10,12 +10,12 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.iam import ( - User, UserInvite, UserUpdate, UserDetailed, + UserListResponse, ) -from gcore.pagination import SyncOffsetPageIam, AsyncOffsetPageIam +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -76,7 +76,7 @@ def test_streaming_response_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: user = client.iam.users.list() - assert_matches_type(SyncOffsetPageIam[User], user, path=["response"]) + assert_matches_type(SyncOffsetPage[UserListResponse], user, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -84,7 +84,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: limit=0, offset=0, ) - assert_matches_type(SyncOffsetPageIam[User], user, path=["response"]) + assert_matches_type(SyncOffsetPage[UserListResponse], user, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -93,7 +93,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(SyncOffsetPageIam[User], user, path=["response"]) + assert_matches_type(SyncOffsetPage[UserListResponse], user, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -102,7 +102,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(SyncOffsetPageIam[User], user, path=["response"]) + assert_matches_type(SyncOffsetPage[UserListResponse], user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -281,7 +281,7 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: user = await async_client.iam.users.list() - assert_matches_type(AsyncOffsetPageIam[User], user, path=["response"]) + assert_matches_type(AsyncOffsetPage[UserListResponse], user, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -289,7 +289,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No limit=0, offset=0, ) - assert_matches_type(AsyncOffsetPageIam[User], user, path=["response"]) + assert_matches_type(AsyncOffsetPage[UserListResponse], user, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -298,7 +298,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(AsyncOffsetPageIam[User], user, path=["response"]) + assert_matches_type(AsyncOffsetPage[UserListResponse], user, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -307,7 +307,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(AsyncOffsetPageIam[User], user, path=["response"]) + assert_matches_type(AsyncOffsetPage[UserListResponse], user, path=["response"]) assert cast(Any, response.is_closed) is True From 8450bf0c14ee0f5aba5a1c4433e579e7f2d2ff1d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Jul 2025 12:52:45 +0000 Subject: [PATCH 224/592] fix(iam): remove obsolete pagination scheme --- .stats.yml | 2 +- src/gcore/pagination.py | 62 ----------------------------------------- 2 files changed, 1 insertion(+), 63 deletions(-) diff --git a/.stats.yml b/.stats.yml index 94043ec3..e82da087 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 435 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a9da6b57df49a81e7c47a2a0fb365272782daba902d7d0151ff5132d12f75a78.yml openapi_spec_hash: a485e882e6446a14ce5380529618d9c1 -config_hash: daaf9739c48a00883985847ba3e6a2a0 +config_hash: a8d36aa2a82b34e645dfba704b008288 diff --git a/src/gcore/pagination.py b/src/gcore/pagination.py index cbc5b3b5..57bab8f9 100644 --- a/src/gcore/pagination.py +++ b/src/gcore/pagination.py @@ -12,8 +12,6 @@ __all__ = [ "SyncOffsetPage", "AsyncOffsetPage", - "SyncOffsetPageIam", - "AsyncOffsetPageIam", "SyncOffsetPageFastedgeApps", "AsyncOffsetPageFastedgeApps", "SyncOffsetPageFastedgeTemplates", @@ -91,66 +89,6 @@ def next_page_info(self) -> Optional[PageInfo]: return None -class SyncOffsetPageIam(BaseSyncPage[_T], BasePage[_T], Generic[_T]): - result: List[_T] - count: Optional[int] = None - - @override - def _get_page_items(self) -> List[_T]: - result = self.result - if not result: - return [] - return result - - @override - def next_page_info(self) -> Optional[PageInfo]: - offset = self._options.params.get("offset") or 0 - if not isinstance(offset, int): - raise ValueError(f'Expected "offset" param to be an integer but got {offset}') - - length = len(self._get_page_items()) - current_count = offset + length - - count = self.count - if count is None: - return None - - if current_count < count: - return PageInfo(params={"offset": current_count}) - - return None - - -class AsyncOffsetPageIam(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): - result: List[_T] - count: Optional[int] = None - - @override - def _get_page_items(self) -> List[_T]: - result = self.result - if not result: - return [] - return result - - @override - def next_page_info(self) -> Optional[PageInfo]: - offset = self._options.params.get("offset") or 0 - if not isinstance(offset, int): - raise ValueError(f'Expected "offset" param to be an integer but got {offset}') - - length = len(self._get_page_items()) - current_count = offset + length - - count = self.count - if count is None: - return None - - if current_count < count: - return PageInfo(params={"offset": current_count}) - - return None - - class SyncOffsetPageFastedgeApps(BaseSyncPage[_T], BasePage[_T], Generic[_T]): apps: List[_T] count: Optional[int] = None From 8db05fa9a2087ff3b1c6181133f92a4a9853b11e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Jul 2025 13:46:06 +0000 Subject: [PATCH 225/592] fix(iam): user model path --- .stats.yml | 2 +- api.md | 4 ++-- src/gcore/resources/iam/users.py | 14 +++++++------- src/gcore/types/iam/__init__.py | 2 +- .../iam/{user_list_response.py => user.py} | 4 ++-- tests/api_resources/iam/test_users.py | 18 +++++++++--------- 6 files changed, 22 insertions(+), 22 deletions(-) rename src/gcore/types/iam/{user_list_response.py => user.py} (96%) diff --git a/.stats.yml b/.stats.yml index e82da087..03204a21 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 435 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a9da6b57df49a81e7c47a2a0fb365272782daba902d7d0151ff5132d12f75a78.yml openapi_spec_hash: a485e882e6446a14ce5380529618d9c1 -config_hash: a8d36aa2a82b34e645dfba704b008288 +config_hash: c5da50f4a61d992c41e55e5f411c40ed diff --git a/api.md b/api.md index ba2855ba..e4f120a8 100644 --- a/api.md +++ b/api.md @@ -1235,13 +1235,13 @@ Methods: Types: ```python -from gcore.types.iam import UserDetailed, UserInvite, UserUpdate, UserListResponse +from gcore.types.iam import User, UserDetailed, UserInvite, UserUpdate ``` Methods: - client.iam.users.update(user_id, \*\*params) -> UserUpdate -- client.iam.users.list(\*\*params) -> SyncOffsetPage[UserListResponse] +- client.iam.users.list(\*\*params) -> SyncOffsetPage[User] - client.iam.users.delete(user_id, \*, client_id) -> None - client.iam.users.get(user_id) -> UserDetailed - client.iam.users.invite(\*\*params) -> UserInvite diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index a636398c..a27021c1 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -20,10 +20,10 @@ from ...types.iam import user_list_params, user_invite_params, user_update_params from ...pagination import SyncOffsetPage, AsyncOffsetPage from ..._base_client import AsyncPaginator, make_request_options +from ...types.iam.user import User from ...types.iam.user_invite import UserInvite from ...types.iam.user_update import UserUpdate from ...types.iam.user_detailed import UserDetailed -from ...types.iam.user_list_response import UserListResponse __all__ = ["UsersResource", "AsyncUsersResource"] @@ -131,7 +131,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[UserListResponse]: + ) -> SyncOffsetPage[User]: """Get a list of users. Pass a value for the `limit` parameter in your request if @@ -153,7 +153,7 @@ def list( """ return self._get_api_list( "/iam/users", - page=SyncOffsetPage[UserListResponse], + page=SyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -167,7 +167,7 @@ def list( user_list_params.UserListParams, ), ), - model=UserListResponse, + model=User, ) def delete( @@ -396,7 +396,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[UserListResponse, AsyncOffsetPage[UserListResponse]]: + ) -> AsyncPaginator[User, AsyncOffsetPage[User]]: """Get a list of users. Pass a value for the `limit` parameter in your request if @@ -418,7 +418,7 @@ def list( """ return self._get_api_list( "/iam/users", - page=AsyncOffsetPage[UserListResponse], + page=AsyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -432,7 +432,7 @@ def list( user_list_params.UserListParams, ), ), - model=UserListResponse, + model=User, ) async def delete( diff --git a/src/gcore/types/iam/__init__.py b/src/gcore/types/iam/__init__.py index d6835611..ad8745f0 100644 --- a/src/gcore/types/iam/__init__.py +++ b/src/gcore/types/iam/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations +from .user import User as User from .api_token import APIToken as APIToken from .user_invite import UserInvite as UserInvite from .user_update import UserUpdate as UserUpdate @@ -11,7 +12,6 @@ from .api_token_create import APITokenCreate as APITokenCreate from .user_list_params import UserListParams as UserListParams from .user_invite_params import UserInviteParams as UserInviteParams -from .user_list_response import UserListResponse as UserListResponse from .user_update_params import UserUpdateParams as UserUpdateParams from .api_token_list_params import APITokenListParams as APITokenListParams from .api_token_create_params import APITokenCreateParams as APITokenCreateParams diff --git a/src/gcore/types/iam/user_list_response.py b/src/gcore/types/iam/user.py similarity index 96% rename from src/gcore/types/iam/user_list_response.py rename to src/gcore/types/iam/user.py index 8e010611..15424ee4 100644 --- a/src/gcore/types/iam/user_list_response.py +++ b/src/gcore/types/iam/user.py @@ -5,7 +5,7 @@ from ..._models import BaseModel -__all__ = ["UserListResponse", "Group"] +__all__ = ["User", "Group"] class Group(BaseModel): @@ -24,7 +24,7 @@ class Group(BaseModel): """Group's name.""" -class UserListResponse(BaseModel): +class User(BaseModel): id: Optional[int] = None """User's ID.""" diff --git a/tests/api_resources/iam/test_users.py b/tests/api_resources/iam/test_users.py index bdc6a44e..bf149b6b 100644 --- a/tests/api_resources/iam/test_users.py +++ b/tests/api_resources/iam/test_users.py @@ -10,10 +10,10 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.iam import ( + User, UserInvite, UserUpdate, UserDetailed, - UserListResponse, ) from gcore.pagination import SyncOffsetPage, AsyncOffsetPage @@ -76,7 +76,7 @@ def test_streaming_response_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: user = client.iam.users.list() - assert_matches_type(SyncOffsetPage[UserListResponse], user, path=["response"]) + assert_matches_type(SyncOffsetPage[User], user, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -84,7 +84,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: limit=0, offset=0, ) - assert_matches_type(SyncOffsetPage[UserListResponse], user, path=["response"]) + assert_matches_type(SyncOffsetPage[User], user, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -93,7 +93,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(SyncOffsetPage[UserListResponse], user, path=["response"]) + assert_matches_type(SyncOffsetPage[User], user, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -102,7 +102,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(SyncOffsetPage[UserListResponse], user, path=["response"]) + assert_matches_type(SyncOffsetPage[User], user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -281,7 +281,7 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: user = await async_client.iam.users.list() - assert_matches_type(AsyncOffsetPage[UserListResponse], user, path=["response"]) + assert_matches_type(AsyncOffsetPage[User], user, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -289,7 +289,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No limit=0, offset=0, ) - assert_matches_type(AsyncOffsetPage[UserListResponse], user, path=["response"]) + assert_matches_type(AsyncOffsetPage[User], user, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -298,7 +298,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(AsyncOffsetPage[UserListResponse], user, path=["response"]) + assert_matches_type(AsyncOffsetPage[User], user, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -307,7 +307,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(AsyncOffsetPage[UserListResponse], user, path=["response"]) + assert_matches_type(AsyncOffsetPage[User], user, path=["response"]) assert cast(Any, response.is_closed) is True From b3e6ae14cc602ff054bdc7a74ee8a10fe4c0548d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Jul 2025 14:08:22 +0000 Subject: [PATCH 226/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4208b5cb..6538ca91 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.6.0" + ".": "0.8.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 7563f321..885edf5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.6.0" +version = "0.8.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 24893d80..53587cb3 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.6.0" # x-release-please-version +__version__ = "0.8.0" # x-release-please-version From f96048197f9875abd125c18f5c7b2961f7e030f8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Jul 2025 08:39:33 +0000 Subject: [PATCH 227/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 03204a21..9c027f62 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 435 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a9da6b57df49a81e7c47a2a0fb365272782daba902d7d0151ff5132d12f75a78.yml openapi_spec_hash: a485e882e6446a14ce5380529618d9c1 -config_hash: c5da50f4a61d992c41e55e5f411c40ed +config_hash: 8bf7e3b6ff2e83aa7d60484684bd22f8 From 01a5659583d07baa2e235c479d54cd2f133c6a90 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Jul 2025 22:54:26 +0000 Subject: [PATCH 228/592] feat(client): support file upload requests --- src/gcore/_base_client.py | 5 ++++- src/gcore/_files.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index 66b54908..d28b3bfe 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -532,7 +532,10 @@ def _build_request( is_body_allowed = options.method.lower() != "get" if is_body_allowed: - kwargs["json"] = json_data if is_given(json_data) else None + if isinstance(json_data, bytes): + kwargs["content"] = json_data + else: + kwargs["json"] = json_data if is_given(json_data) else None kwargs["files"] = files else: headers.pop("Content-Type", None) diff --git a/src/gcore/_files.py b/src/gcore/_files.py index 715cc207..cc14c14f 100644 --- a/src/gcore/_files.py +++ b/src/gcore/_files.py @@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes: return file if is_tuple_t(file): - return (file[0], _read_file_content(file[1]), *file[2:]) + return (file[0], read_file_content(file[1]), *file[2:]) raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") -def _read_file_content(file: FileContent) -> HttpxFileContent: +def read_file_content(file: FileContent) -> HttpxFileContent: if isinstance(file, os.PathLike): return pathlib.Path(file).read_bytes() return file @@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes: return file if is_tuple_t(file): - return (file[0], await _async_read_file_content(file[1]), *file[2:]) + return (file[0], await async_read_file_content(file[1]), *file[2:]) raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") -async def _async_read_file_content(file: FileContent) -> HttpxFileContent: +async def async_read_file_content(file: FileContent) -> HttpxFileContent: if isinstance(file, os.PathLike): return await anyio.Path(file).read_bytes() From ad1718455d07f2372991a6c316ec4674ed10aa70 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 08:14:18 +0000 Subject: [PATCH 229/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cloud/gpu_baremetal_flavor.py | 16 ++++++++++++++++ src/gcore/types/cloud/region.py | 9 ++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9c027f62..85c6d229 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 435 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a9da6b57df49a81e7c47a2a0fb365272782daba902d7d0151ff5132d12f75a78.yml -openapi_spec_hash: a485e882e6446a14ce5380529618d9c1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a29e4809875d0912d9b75ceb57a02fc83b6dfa1647356fa4d31cb6565acc44a9.yml +openapi_spec_hash: a8c53de56a1284aba5dffebbfd846441 config_hash: 8bf7e3b6ff2e83aa7d60484684bd22f8 diff --git a/src/gcore/types/cloud/gpu_baremetal_flavor.py b/src/gcore/types/cloud/gpu_baremetal_flavor.py index f334493d..9c6471c8 100644 --- a/src/gcore/types/cloud/gpu_baremetal_flavor.py +++ b/src/gcore/types/cloud/gpu_baremetal_flavor.py @@ -10,10 +10,12 @@ "GPUBaremetalFlavorSerializerWithoutPrice", "GPUBaremetalFlavorSerializerWithoutPriceHardwareDescription", "GPUBaremetalFlavorSerializerWithoutPriceHardwareProperties", + "GPUBaremetalFlavorSerializerWithoutPriceSupportedFeatures", "GPUBaremetalFlavorSerializerWithPrices", "GPUBaremetalFlavorSerializerWithPricesHardwareDescription", "GPUBaremetalFlavorSerializerWithPricesHardwareProperties", "GPUBaremetalFlavorSerializerWithPricesPrice", + "GPUBaremetalFlavorSerializerWithPricesSupportedFeatures", ] @@ -45,6 +47,10 @@ class GPUBaremetalFlavorSerializerWithoutPriceHardwareProperties(BaseModel): """GPU model""" +class GPUBaremetalFlavorSerializerWithoutPriceSupportedFeatures(BaseModel): + security_groups: bool + + class GPUBaremetalFlavorSerializerWithoutPrice(BaseModel): architecture: Optional[str] = None """Flavor architecture type""" @@ -64,6 +70,9 @@ class GPUBaremetalFlavorSerializerWithoutPrice(BaseModel): name: str """Flavor name""" + supported_features: GPUBaremetalFlavorSerializerWithoutPriceSupportedFeatures + """Set of enabled features based on the flavor's type and configuration""" + class GPUBaremetalFlavorSerializerWithPricesHardwareDescription(BaseModel): cpu: str @@ -107,6 +116,10 @@ class GPUBaremetalFlavorSerializerWithPricesPrice(BaseModel): """Price status for the UI""" +class GPUBaremetalFlavorSerializerWithPricesSupportedFeatures(BaseModel): + security_groups: bool + + class GPUBaremetalFlavorSerializerWithPrices(BaseModel): architecture: Optional[str] = None """Flavor architecture type""" @@ -129,5 +142,8 @@ class GPUBaremetalFlavorSerializerWithPrices(BaseModel): price: GPUBaremetalFlavorSerializerWithPricesPrice """Flavor price""" + supported_features: GPUBaremetalFlavorSerializerWithPricesSupportedFeatures + """Set of enabled features based on the flavor's type and configuration""" + GPUBaremetalFlavor: TypeAlias = Union[GPUBaremetalFlavorSerializerWithoutPrice, GPUBaremetalFlavorSerializerWithPrices] diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py index 83be871e..92293a26 100644 --- a/src/gcore/types/cloud/region.py +++ b/src/gcore/types/cloud/region.py @@ -40,9 +40,6 @@ class Region(BaseModel): created_on: datetime """This field is deprecated. Use `created_at` instead.""" - ddos_endpoint_id: Optional[int] = None - """DDoS endpoint ID""" - display_name: str """Human-readable region name""" @@ -70,6 +67,9 @@ class Region(BaseModel): has_dbaas: bool """Region has DBAAS service""" + has_ddos: bool + """Region has Advanced DDoS Protection capability""" + has_k8s: bool """Region has managed kubernetes capability""" @@ -99,3 +99,6 @@ class Region(BaseModel): zone: Optional[Literal["AMERICAS", "APAC", "EMEA", "RUSSIA_AND_CIS"]] = None """Geographical zone""" + + ddos_endpoint_id: Optional[int] = None + """DDoS endpoint ID""" From 814baac2b307f2942397ad40006462a4403b1be9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 12:14:52 +0000 Subject: [PATCH 230/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/cloud/cost_reports.py | 24 +++++++++ src/gcore/resources/cloud/quotas/requests.py | 22 +++----- ...st_report_get_aggregated_monthly_params.py | 3 ++ .../cost_report_get_aggregated_params.py | 3 ++ .../cloud/cost_report_get_detailed_params.py | 3 ++ .../types/cloud/quotas/request_list_params.py | 4 +- .../cloud/quotas/test_requests.py | 52 +++++-------------- .../api_resources/cloud/test_cost_reports.py | 6 +++ 9 files changed, 62 insertions(+), 59 deletions(-) diff --git a/.stats.yml b/.stats.yml index 85c6d229..28168a9c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 435 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-a29e4809875d0912d9b75ceb57a02fc83b6dfa1647356fa4d31cb6565acc44a9.yml -openapi_spec_hash: a8c53de56a1284aba5dffebbfd846441 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-46f52bae913ccca59cb78712dc498c1474f1db96c889a466758ab1dacc01c1b3.yml +openapi_spec_hash: 202b162bda8d283806b0f7fbefb6f657 config_hash: 8bf7e3b6ff2e83aa7d60484684bd22f8 diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 63636c99..b04695a9 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -60,6 +60,7 @@ def get_aggregated( projects: Iterable[int] | NotGiven = NOT_GIVEN, regions: Iterable[int] | NotGiven = NOT_GIVEN, response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, + rounding: bool | NotGiven = NOT_GIVEN, schema_filter: cost_report_get_aggregated_params.SchemaFilter | NotGiven = NOT_GIVEN, tags: cost_report_get_aggregated_params.Tags | NotGiven = NOT_GIVEN, types: List[ @@ -128,6 +129,8 @@ def get_aggregated( response_format: Format of the response (csv or json). + rounding: Round cost values to 5 decimal places. When false, returns full precision. + schema_filter: Extended filter for field filtering. tags: Filter by tags @@ -152,6 +155,7 @@ def get_aggregated( "projects": projects, "regions": regions, "response_format": response_format, + "rounding": rounding, "schema_filter": schema_filter, "tags": tags, "types": types, @@ -171,6 +175,7 @@ def get_aggregated_monthly( time_to: Union[str, datetime], regions: Iterable[int] | NotGiven = NOT_GIVEN, response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, + rounding: bool | NotGiven = NOT_GIVEN, schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | NotGiven = NOT_GIVEN, tags: cost_report_get_aggregated_monthly_params.Tags | NotGiven = NOT_GIVEN, types: List[ @@ -230,6 +235,8 @@ def get_aggregated_monthly( response_format: Format of the response (`csv_totals` or json). + rounding: Round cost values to 5 decimal places. When false, returns full precision. + schema_filter: Extended filter for field filtering. tags: Filter by tags @@ -252,6 +259,7 @@ def get_aggregated_monthly( "time_to": time_to, "regions": regions, "response_format": response_format, + "rounding": rounding, "schema_filter": schema_filter, "tags": tags, "types": types, @@ -275,6 +283,7 @@ def get_detailed( projects: Iterable[int] | NotGiven = NOT_GIVEN, regions: Iterable[int] | NotGiven = NOT_GIVEN, response_format: Literal["csv_records", "json"] | NotGiven = NOT_GIVEN, + rounding: bool | NotGiven = NOT_GIVEN, schema_filter: cost_report_get_detailed_params.SchemaFilter | NotGiven = NOT_GIVEN, sorting: Iterable[cost_report_get_detailed_params.Sorting] | NotGiven = NOT_GIVEN, tags: cost_report_get_detailed_params.Tags | NotGiven = NOT_GIVEN, @@ -349,6 +358,8 @@ def get_detailed( response_format: Format of the response (csv or json). + rounding: Round cost values to 5 decimal places. When false, returns full precision. + schema_filter: Extended filter for field filtering. sorting: List of sorting filters (JSON objects) fields: project. directions: asc, desc. @@ -377,6 +388,7 @@ def get_detailed( "projects": projects, "regions": regions, "response_format": response_format, + "rounding": rounding, "schema_filter": schema_filter, "sorting": sorting, "tags": tags, @@ -420,6 +432,7 @@ async def get_aggregated( projects: Iterable[int] | NotGiven = NOT_GIVEN, regions: Iterable[int] | NotGiven = NOT_GIVEN, response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, + rounding: bool | NotGiven = NOT_GIVEN, schema_filter: cost_report_get_aggregated_params.SchemaFilter | NotGiven = NOT_GIVEN, tags: cost_report_get_aggregated_params.Tags | NotGiven = NOT_GIVEN, types: List[ @@ -488,6 +501,8 @@ async def get_aggregated( response_format: Format of the response (csv or json). + rounding: Round cost values to 5 decimal places. When false, returns full precision. + schema_filter: Extended filter for field filtering. tags: Filter by tags @@ -512,6 +527,7 @@ async def get_aggregated( "projects": projects, "regions": regions, "response_format": response_format, + "rounding": rounding, "schema_filter": schema_filter, "tags": tags, "types": types, @@ -531,6 +547,7 @@ async def get_aggregated_monthly( time_to: Union[str, datetime], regions: Iterable[int] | NotGiven = NOT_GIVEN, response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, + rounding: bool | NotGiven = NOT_GIVEN, schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | NotGiven = NOT_GIVEN, tags: cost_report_get_aggregated_monthly_params.Tags | NotGiven = NOT_GIVEN, types: List[ @@ -590,6 +607,8 @@ async def get_aggregated_monthly( response_format: Format of the response (`csv_totals` or json). + rounding: Round cost values to 5 decimal places. When false, returns full precision. + schema_filter: Extended filter for field filtering. tags: Filter by tags @@ -612,6 +631,7 @@ async def get_aggregated_monthly( "time_to": time_to, "regions": regions, "response_format": response_format, + "rounding": rounding, "schema_filter": schema_filter, "tags": tags, "types": types, @@ -635,6 +655,7 @@ async def get_detailed( projects: Iterable[int] | NotGiven = NOT_GIVEN, regions: Iterable[int] | NotGiven = NOT_GIVEN, response_format: Literal["csv_records", "json"] | NotGiven = NOT_GIVEN, + rounding: bool | NotGiven = NOT_GIVEN, schema_filter: cost_report_get_detailed_params.SchemaFilter | NotGiven = NOT_GIVEN, sorting: Iterable[cost_report_get_detailed_params.Sorting] | NotGiven = NOT_GIVEN, tags: cost_report_get_detailed_params.Tags | NotGiven = NOT_GIVEN, @@ -709,6 +730,8 @@ async def get_detailed( response_format: Format of the response (csv or json). + rounding: Round cost values to 5 decimal places. When false, returns full precision. + schema_filter: Extended filter for field filtering. sorting: List of sorting filters (JSON objects) fields: project. directions: asc, desc. @@ -737,6 +760,7 @@ async def get_detailed( "projects": projects, "regions": regions, "response_format": response_format, + "rounding": rounding, "schema_filter": schema_filter, "sorting": sorting, "tags": tags, diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index d6ba0a82..79d4febe 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Optional +from typing import List from typing_extensions import Literal import httpx @@ -99,7 +99,7 @@ def list( *, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - status: Optional[List[Literal["done", "in progress", "rejected"]]] | NotGiven = NOT_GIVEN, + status: List[Literal["done", "in progress", "rejected"]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -148,7 +148,7 @@ def list( def delete( self, - request_id: str, + request_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. @@ -171,8 +171,6 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not request_id: - raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( f"/cloud/v2/limits_request/{request_id}", @@ -184,7 +182,7 @@ def delete( def get( self, - request_id: str, + request_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. @@ -207,8 +205,6 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not request_id: - raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return self._get( f"/cloud/v2/limits_request/{request_id}", options=make_request_options( @@ -291,7 +287,7 @@ def list( *, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - status: Optional[List[Literal["done", "in progress", "rejected"]]] | NotGiven = NOT_GIVEN, + status: List[Literal["done", "in progress", "rejected"]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -340,7 +336,7 @@ def list( async def delete( self, - request_id: str, + request_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. @@ -363,8 +359,6 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not request_id: - raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( f"/cloud/v2/limits_request/{request_id}", @@ -376,7 +370,7 @@ async def delete( async def get( self, - request_id: str, + request_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. @@ -399,8 +393,6 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not request_id: - raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return await self._get( f"/cloud/v2/limits_request/{request_id}", options=make_request_options( 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 3a77c6a1..e28efb98 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 @@ -54,6 +54,9 @@ class CostReportGetAggregatedMonthlyParams(TypedDict, total=False): response_format: Literal["csv_totals", "json"] """Format of the response (`csv_totals` or json).""" + rounding: bool + """Round cost values to 5 decimal places. When false, returns full precision.""" + schema_filter: SchemaFilter """Extended filter for field filtering.""" 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 5cd6781d..aa099ae9 100644 --- a/src/gcore/types/cloud/cost_report_get_aggregated_params.py +++ b/src/gcore/types/cloud/cost_report_get_aggregated_params.py @@ -69,6 +69,9 @@ class CostReportGetAggregatedParams(TypedDict, total=False): response_format: Literal["csv_totals", "json"] """Format of the response (csv or json).""" + rounding: bool + """Round cost values to 5 decimal places. When false, returns full precision.""" + schema_filter: SchemaFilter """Extended filter for field filtering.""" 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 fbadb8aa..f3d65950 100644 --- a/src/gcore/types/cloud/cost_report_get_detailed_params.py +++ b/src/gcore/types/cloud/cost_report_get_detailed_params.py @@ -76,6 +76,9 @@ class CostReportGetDetailedParams(TypedDict, total=False): response_format: Literal["csv_records", "json"] """Format of the response (csv or json).""" + rounding: bool + """Round cost values to 5 decimal places. When false, returns full precision.""" + schema_filter: SchemaFilter """Extended filter for field filtering.""" diff --git a/src/gcore/types/cloud/quotas/request_list_params.py b/src/gcore/types/cloud/quotas/request_list_params.py index 556abaa1..ede95106 100644 --- a/src/gcore/types/cloud/quotas/request_list_params.py +++ b/src/gcore/types/cloud/quotas/request_list_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Optional +from typing import List from typing_extensions import Literal, TypedDict __all__ = ["RequestListParams"] @@ -18,5 +18,5 @@ class RequestListParams(TypedDict, total=False): Offset value is used to exclude the first set of records from the result """ - status: Optional[List[Literal["done", "in progress", "rejected"]]] + status: List[Literal["done", "in progress", "rejected"]] """List of limit requests statuses for filtering""" diff --git a/tests/api_resources/cloud/quotas/test_requests.py b/tests/api_resources/cloud/quotas/test_requests.py index 789b986d..9b2b7487 100644 --- a/tests/api_resources/cloud/quotas/test_requests.py +++ b/tests/api_resources/cloud/quotas/test_requests.py @@ -164,14 +164,14 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: request = client.cloud.quotas.requests.delete( - "3", + 3, ) assert request is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.quotas.requests.with_raw_response.delete( - "3", + 3, ) assert response.is_closed is True @@ -182,7 +182,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.quotas.requests.with_streaming_response.delete( - "3", + 3, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -192,24 +192,17 @@ def test_streaming_response_delete(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_path_params_delete(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): - client.cloud.quotas.requests.with_raw_response.delete( - "", - ) - @parametrize def test_method_get(self, client: Gcore) -> None: request = client.cloud.quotas.requests.get( - "3", + 3, ) assert_matches_type(RequestGetResponse, request, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.quotas.requests.with_raw_response.get( - "3", + 3, ) assert response.is_closed is True @@ -220,7 +213,7 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.quotas.requests.with_streaming_response.get( - "3", + 3, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -230,13 +223,6 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_path_params_get(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): - client.cloud.quotas.requests.with_raw_response.get( - "", - ) - class TestAsyncRequests: parametrize = pytest.mark.parametrize( @@ -389,14 +375,14 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: request = await async_client.cloud.quotas.requests.delete( - "3", + 3, ) assert request is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.quotas.requests.with_raw_response.delete( - "3", + 3, ) assert response.is_closed is True @@ -407,7 +393,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.quotas.requests.with_streaming_response.delete( - "3", + 3, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -417,24 +403,17 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True - @parametrize - async def test_path_params_delete(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): - await async_client.cloud.quotas.requests.with_raw_response.delete( - "", - ) - @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: request = await async_client.cloud.quotas.requests.get( - "3", + 3, ) assert_matches_type(RequestGetResponse, request, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.quotas.requests.with_raw_response.get( - "3", + 3, ) assert response.is_closed is True @@ -445,7 +424,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.quotas.requests.with_streaming_response.get( - "3", + 3, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -454,10 +433,3 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert_matches_type(RequestGetResponse, request, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): - await async_client.cloud.quotas.requests.with_raw_response.get( - "", - ) diff --git a/tests/api_resources/cloud/test_cost_reports.py b/tests/api_resources/cloud/test_cost_reports.py index c3a087fe..b6df051a 100644 --- a/tests/api_resources/cloud/test_cost_reports.py +++ b/tests/api_resources/cloud/test_cost_reports.py @@ -39,6 +39,7 @@ def test_method_get_aggregated_with_all_params(self, client: Gcore) -> None: projects=[16, 17, 18, 19, 20], regions=[1, 2, 3], response_format="csv_totals", + rounding=True, schema_filter={ "field": "flavor", "type": "instance", @@ -104,6 +105,7 @@ def test_method_get_aggregated_monthly_with_all_params(self, client: Gcore) -> N time_to=parse_datetime("2019-12-27T18:11:19.117Z"), regions=[1, 2, 3], response_format="csv_totals", + rounding=True, schema_filter={ "field": "flavor", "type": "instance", @@ -173,6 +175,7 @@ def test_method_get_detailed_with_all_params(self, client: Gcore) -> None: projects=[16, 17, 18, 19, 20], regions=[1, 2, 3], response_format="csv_records", + rounding=True, schema_filter={ "field": "flavor", "type": "instance", @@ -257,6 +260,7 @@ async def test_method_get_aggregated_with_all_params(self, async_client: AsyncGc projects=[16, 17, 18, 19, 20], regions=[1, 2, 3], response_format="csv_totals", + rounding=True, schema_filter={ "field": "flavor", "type": "instance", @@ -322,6 +326,7 @@ async def test_method_get_aggregated_monthly_with_all_params(self, async_client: time_to=parse_datetime("2019-12-27T18:11:19.117Z"), regions=[1, 2, 3], response_format="csv_totals", + rounding=True, schema_filter={ "field": "flavor", "type": "instance", @@ -391,6 +396,7 @@ async def test_method_get_detailed_with_all_params(self, async_client: AsyncGcor projects=[16, 17, 18, 19, 20], regions=[1, 2, 3], response_format="csv_records", + rounding=True, schema_filter={ "field": "flavor", "type": "instance", From 95f8541661935865a16c0bbdca00408cffbd5fd9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 13:40:07 +0000 Subject: [PATCH 231/592] feat(security): add security api --- .stats.yml | 4 +- api.md | 56 ++ src/gcore/_client.py | 9 + src/gcore/resources/__init__.py | 14 + src/gcore/resources/security/__init__.py | 75 ++ src/gcore/resources/security/bgp_announces.py | 308 ++++++++ src/gcore/resources/security/events.py | 234 +++++++ .../resources/security/profile_templates.py | 143 ++++ src/gcore/resources/security/profiles.py | 661 ++++++++++++++++++ src/gcore/resources/security/security.py | 198 ++++++ src/gcore/types/security/__init__.py | 18 + .../security/bgp_announce_change_params.py | 16 + .../security/bgp_announce_list_params.py | 18 + .../security/bgp_announce_list_response.py | 10 + src/gcore/types/security/client_announce.py | 15 + src/gcore/types/security/client_profile.py | 56 ++ .../types/security/client_profile_template.py | 43 ++ src/gcore/types/security/client_view.py | 29 + src/gcore/types/security/event_list_params.py | 38 + .../types/security/profile_create_params.py | 24 + .../types/security/profile_list_params.py | 17 + .../types/security/profile_list_response.py | 10 + .../types/security/profile_recreate_params.py | 24 + .../types/security/profile_replace_params.py | 24 + .../profile_template_list_response.py | 10 + tests/api_resources/security/__init__.py | 1 + .../security/test_bgp_announces.py | 180 +++++ tests/api_resources/security/test_events.py | 102 +++ .../security/test_profile_templates.py | 74 ++ tests/api_resources/security/test_profiles.py | 531 ++++++++++++++ 30 files changed, 2940 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/security/__init__.py create mode 100644 src/gcore/resources/security/bgp_announces.py create mode 100644 src/gcore/resources/security/events.py create mode 100644 src/gcore/resources/security/profile_templates.py create mode 100644 src/gcore/resources/security/profiles.py create mode 100644 src/gcore/resources/security/security.py create mode 100644 src/gcore/types/security/__init__.py create mode 100644 src/gcore/types/security/bgp_announce_change_params.py create mode 100644 src/gcore/types/security/bgp_announce_list_params.py create mode 100644 src/gcore/types/security/bgp_announce_list_response.py create mode 100644 src/gcore/types/security/client_announce.py create mode 100644 src/gcore/types/security/client_profile.py create mode 100644 src/gcore/types/security/client_profile_template.py create mode 100644 src/gcore/types/security/client_view.py create mode 100644 src/gcore/types/security/event_list_params.py create mode 100644 src/gcore/types/security/profile_create_params.py create mode 100644 src/gcore/types/security/profile_list_params.py create mode 100644 src/gcore/types/security/profile_list_response.py create mode 100644 src/gcore/types/security/profile_recreate_params.py create mode 100644 src/gcore/types/security/profile_replace_params.py create mode 100644 src/gcore/types/security/profile_template_list_response.py create mode 100644 tests/api_resources/security/__init__.py create mode 100644 tests/api_resources/security/test_bgp_announces.py create mode 100644 tests/api_resources/security/test_events.py create mode 100644 tests/api_resources/security/test_profile_templates.py create mode 100644 tests/api_resources/security/test_profiles.py diff --git a/.stats.yml b/.stats.yml index 28168a9c..d977eb18 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 435 +configured_endpoints: 445 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-46f52bae913ccca59cb78712dc498c1474f1db96c889a466758ab1dacc01c1b3.yml openapi_spec_hash: 202b162bda8d283806b0f7fbefb6f657 -config_hash: 8bf7e3b6ff2e83aa7d60484684bd22f8 +config_hash: 9494c1ec9c5fd8a16b99608ef8ca3636 diff --git a/api.md b/api.md index e4f120a8..47e93017 100644 --- a/api.md +++ b/api.md @@ -1663,3 +1663,59 @@ Methods: - client.streaming.statistics.get_vod_unique_viewers_cdn(\*\*params) -> VodStatisticsSeries - client.streaming.statistics.get_vod_watch_time_cdn(\*\*params) -> VodStatisticsSeries - client.streaming.statistics.get_vod_watch_time_total_cdn(\*\*params) -> StatisticGetVodWatchTimeTotalCdnResponse + +# Security + +## Events + +Types: + +```python +from gcore.types.security import ClientView +``` + +Methods: + +- client.security.events.list(\*\*params) -> SyncOffsetPage[ClientView] + +## BgpAnnounces + +Types: + +```python +from gcore.types.security import ClientAnnounce, BgpAnnounceListResponse +``` + +Methods: + +- client.security.bgp_announces.list(\*\*params) -> BgpAnnounceListResponse +- client.security.bgp_announces.change(\*\*params) -> object + +## ProfileTemplates + +Types: + +```python +from gcore.types.security import ClientProfileTemplate, ProfileTemplateListResponse +``` + +Methods: + +- client.security.profile_templates.list() -> ProfileTemplateListResponse + +## Profiles + +Types: + +```python +from gcore.types.security import ClientProfile, ProfileListResponse +``` + +Methods: + +- client.security.profiles.create(\*\*params) -> ClientProfile +- client.security.profiles.list(\*\*params) -> ProfileListResponse +- client.security.profiles.delete(id) -> None +- client.security.profiles.get(id) -> ClientProfile +- client.security.profiles.recreate(id, \*\*params) -> ClientProfile +- client.security.profiles.replace(id, \*\*params) -> ClientProfile diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 6cfc9e3b..8521d0c7 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -32,6 +32,7 @@ from .resources.waap import waap from .resources.cloud import cloud from .resources.fastedge import fastedge +from .resources.security import security from .resources.streaming import streaming __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Gcore", "AsyncGcore", "Client", "AsyncClient"] @@ -43,6 +44,7 @@ class Gcore(SyncAPIClient): iam: iam.IamResource fastedge: fastedge.FastedgeResource streaming: streaming.StreamingResource + security: security.SecurityResource with_raw_response: GcoreWithRawResponse with_streaming_response: GcoreWithStreamedResponse @@ -126,6 +128,7 @@ def __init__( self.iam = iam.IamResource(self) self.fastedge = fastedge.FastedgeResource(self) self.streaming = streaming.StreamingResource(self) + self.security = security.SecurityResource(self) self.with_raw_response = GcoreWithRawResponse(self) self.with_streaming_response = GcoreWithStreamedResponse(self) @@ -264,6 +267,7 @@ class AsyncGcore(AsyncAPIClient): iam: iam.AsyncIamResource fastedge: fastedge.AsyncFastedgeResource streaming: streaming.AsyncStreamingResource + security: security.AsyncSecurityResource with_raw_response: AsyncGcoreWithRawResponse with_streaming_response: AsyncGcoreWithStreamedResponse @@ -347,6 +351,7 @@ def __init__( self.iam = iam.AsyncIamResource(self) self.fastedge = fastedge.AsyncFastedgeResource(self) self.streaming = streaming.AsyncStreamingResource(self) + self.security = security.AsyncSecurityResource(self) self.with_raw_response = AsyncGcoreWithRawResponse(self) self.with_streaming_response = AsyncGcoreWithStreamedResponse(self) @@ -486,6 +491,7 @@ def __init__(self, client: Gcore) -> None: self.iam = iam.IamResourceWithRawResponse(client.iam) self.fastedge = fastedge.FastedgeResourceWithRawResponse(client.fastedge) self.streaming = streaming.StreamingResourceWithRawResponse(client.streaming) + self.security = security.SecurityResourceWithRawResponse(client.security) class AsyncGcoreWithRawResponse: @@ -495,6 +501,7 @@ def __init__(self, client: AsyncGcore) -> None: self.iam = iam.AsyncIamResourceWithRawResponse(client.iam) self.fastedge = fastedge.AsyncFastedgeResourceWithRawResponse(client.fastedge) self.streaming = streaming.AsyncStreamingResourceWithRawResponse(client.streaming) + self.security = security.AsyncSecurityResourceWithRawResponse(client.security) class GcoreWithStreamedResponse: @@ -504,6 +511,7 @@ def __init__(self, client: Gcore) -> None: self.iam = iam.IamResourceWithStreamingResponse(client.iam) self.fastedge = fastedge.FastedgeResourceWithStreamingResponse(client.fastedge) self.streaming = streaming.StreamingResourceWithStreamingResponse(client.streaming) + self.security = security.SecurityResourceWithStreamingResponse(client.security) class AsyncGcoreWithStreamedResponse: @@ -513,6 +521,7 @@ def __init__(self, client: AsyncGcore) -> None: self.iam = iam.AsyncIamResourceWithStreamingResponse(client.iam) self.fastedge = fastedge.AsyncFastedgeResourceWithStreamingResponse(client.fastedge) self.streaming = streaming.AsyncStreamingResourceWithStreamingResponse(client.streaming) + self.security = security.AsyncSecurityResourceWithStreamingResponse(client.security) Client = Gcore diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py index d9a0d340..c85f01d3 100644 --- a/src/gcore/resources/__init__.py +++ b/src/gcore/resources/__init__.py @@ -32,6 +32,14 @@ FastedgeResourceWithStreamingResponse, AsyncFastedgeResourceWithStreamingResponse, ) +from .security import ( + SecurityResource, + AsyncSecurityResource, + SecurityResourceWithRawResponse, + AsyncSecurityResourceWithRawResponse, + SecurityResourceWithStreamingResponse, + AsyncSecurityResourceWithStreamingResponse, +) from .streaming import ( StreamingResource, AsyncStreamingResource, @@ -72,4 +80,10 @@ "AsyncStreamingResourceWithRawResponse", "StreamingResourceWithStreamingResponse", "AsyncStreamingResourceWithStreamingResponse", + "SecurityResource", + "AsyncSecurityResource", + "SecurityResourceWithRawResponse", + "AsyncSecurityResourceWithRawResponse", + "SecurityResourceWithStreamingResponse", + "AsyncSecurityResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/security/__init__.py b/src/gcore/resources/security/__init__.py new file mode 100644 index 00000000..a1a7a5ea --- /dev/null +++ b/src/gcore/resources/security/__init__.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) +from .profiles import ( + ProfilesResource, + AsyncProfilesResource, + ProfilesResourceWithRawResponse, + AsyncProfilesResourceWithRawResponse, + ProfilesResourceWithStreamingResponse, + AsyncProfilesResourceWithStreamingResponse, +) +from .security import ( + SecurityResource, + AsyncSecurityResource, + SecurityResourceWithRawResponse, + AsyncSecurityResourceWithRawResponse, + SecurityResourceWithStreamingResponse, + AsyncSecurityResourceWithStreamingResponse, +) +from .bgp_announces import ( + BgpAnnouncesResource, + AsyncBgpAnnouncesResource, + BgpAnnouncesResourceWithRawResponse, + AsyncBgpAnnouncesResourceWithRawResponse, + BgpAnnouncesResourceWithStreamingResponse, + AsyncBgpAnnouncesResourceWithStreamingResponse, +) +from .profile_templates import ( + ProfileTemplatesResource, + AsyncProfileTemplatesResource, + ProfileTemplatesResourceWithRawResponse, + AsyncProfileTemplatesResourceWithRawResponse, + ProfileTemplatesResourceWithStreamingResponse, + AsyncProfileTemplatesResourceWithStreamingResponse, +) + +__all__ = [ + "EventsResource", + "AsyncEventsResource", + "EventsResourceWithRawResponse", + "AsyncEventsResourceWithRawResponse", + "EventsResourceWithStreamingResponse", + "AsyncEventsResourceWithStreamingResponse", + "BgpAnnouncesResource", + "AsyncBgpAnnouncesResource", + "BgpAnnouncesResourceWithRawResponse", + "AsyncBgpAnnouncesResourceWithRawResponse", + "BgpAnnouncesResourceWithStreamingResponse", + "AsyncBgpAnnouncesResourceWithStreamingResponse", + "ProfileTemplatesResource", + "AsyncProfileTemplatesResource", + "ProfileTemplatesResourceWithRawResponse", + "AsyncProfileTemplatesResourceWithRawResponse", + "ProfileTemplatesResourceWithStreamingResponse", + "AsyncProfileTemplatesResourceWithStreamingResponse", + "ProfilesResource", + "AsyncProfilesResource", + "ProfilesResourceWithRawResponse", + "AsyncProfilesResourceWithRawResponse", + "ProfilesResourceWithStreamingResponse", + "AsyncProfilesResourceWithStreamingResponse", + "SecurityResource", + "AsyncSecurityResource", + "SecurityResourceWithRawResponse", + "AsyncSecurityResourceWithRawResponse", + "SecurityResourceWithStreamingResponse", + "AsyncSecurityResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py new file mode 100644 index 00000000..5315fbdf --- /dev/null +++ b/src/gcore/resources/security/bgp_announces.py @@ -0,0 +1,308 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.security import bgp_announce_list_params, bgp_announce_change_params +from ...types.security.bgp_announce_list_response import BgpAnnounceListResponse + +__all__ = ["BgpAnnouncesResource", "AsyncBgpAnnouncesResource"] + + +class BgpAnnouncesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> BgpAnnouncesResourceWithRawResponse: + """ + 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 BgpAnnouncesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BgpAnnouncesResourceWithStreamingResponse: + """ + 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 BgpAnnouncesResourceWithStreamingResponse(self) + + def list( + self, + *, + announced: Optional[bool] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | NotGiven = NOT_GIVEN, + origin: Optional[Literal["STATIC", "DYNAMIC"]] | NotGiven = NOT_GIVEN, + site: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BgpAnnounceListResponse: + """Get BGP announces filtered by parameters. + + Shows announces in active profiles, + meaning that to get a non-empty response, the client must have at least one + active profile. + + 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( + "/security/sifter/v2/protected_addresses/announces", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "announced": announced, + "client_id": client_id, + "origin": origin, + "site": site, + }, + bgp_announce_list_params.BgpAnnounceListParams, + ), + ), + cast_to=BgpAnnounceListResponse, + ) + + def change( + self, + *, + announce: str, + enabled: bool, + client_id: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> object: + """Change BGP announces (it can be enabled or disabled, but not created or + updated). + + Can be applied to already existing announces in active profiles, + meaning that the client must have at least one active profile. + + 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( + "/security/sifter/v2/protected_addresses/announces", + body=maybe_transform( + { + "announce": announce, + "enabled": enabled, + }, + bgp_announce_change_params.BgpAnnounceChangeParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"client_id": client_id}, bgp_announce_change_params.BgpAnnounceChangeParams), + ), + cast_to=object, + ) + + +class AsyncBgpAnnouncesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncBgpAnnouncesResourceWithRawResponse: + """ + 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 AsyncBgpAnnouncesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBgpAnnouncesResourceWithStreamingResponse: + """ + 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 AsyncBgpAnnouncesResourceWithStreamingResponse(self) + + async def list( + self, + *, + announced: Optional[bool] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | NotGiven = NOT_GIVEN, + origin: Optional[Literal["STATIC", "DYNAMIC"]] | NotGiven = NOT_GIVEN, + site: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BgpAnnounceListResponse: + """Get BGP announces filtered by parameters. + + Shows announces in active profiles, + meaning that to get a non-empty response, the client must have at least one + active profile. + + 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( + "/security/sifter/v2/protected_addresses/announces", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "announced": announced, + "client_id": client_id, + "origin": origin, + "site": site, + }, + bgp_announce_list_params.BgpAnnounceListParams, + ), + ), + cast_to=BgpAnnounceListResponse, + ) + + async def change( + self, + *, + announce: str, + enabled: bool, + client_id: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> object: + """Change BGP announces (it can be enabled or disabled, but not created or + updated). + + Can be applied to already existing announces in active profiles, + meaning that the client must have at least one active profile. + + 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( + "/security/sifter/v2/protected_addresses/announces", + body=await async_maybe_transform( + { + "announce": announce, + "enabled": enabled, + }, + bgp_announce_change_params.BgpAnnounceChangeParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"client_id": client_id}, bgp_announce_change_params.BgpAnnounceChangeParams + ), + ), + cast_to=object, + ) + + +class BgpAnnouncesResourceWithRawResponse: + def __init__(self, bgp_announces: BgpAnnouncesResource) -> None: + self._bgp_announces = bgp_announces + + self.list = to_raw_response_wrapper( + bgp_announces.list, + ) + self.change = to_raw_response_wrapper( + bgp_announces.change, + ) + + +class AsyncBgpAnnouncesResourceWithRawResponse: + def __init__(self, bgp_announces: AsyncBgpAnnouncesResource) -> None: + self._bgp_announces = bgp_announces + + self.list = async_to_raw_response_wrapper( + bgp_announces.list, + ) + self.change = async_to_raw_response_wrapper( + bgp_announces.change, + ) + + +class BgpAnnouncesResourceWithStreamingResponse: + def __init__(self, bgp_announces: BgpAnnouncesResource) -> None: + self._bgp_announces = bgp_announces + + self.list = to_streamed_response_wrapper( + bgp_announces.list, + ) + self.change = to_streamed_response_wrapper( + bgp_announces.change, + ) + + +class AsyncBgpAnnouncesResourceWithStreamingResponse: + def __init__(self, bgp_announces: AsyncBgpAnnouncesResource) -> None: + self._bgp_announces = bgp_announces + + self.list = async_to_streamed_response_wrapper( + bgp_announces.list, + ) + self.change = async_to_streamed_response_wrapper( + bgp_announces.change, + ) diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py new file mode 100644 index 00000000..86d387bb --- /dev/null +++ b/src/gcore/resources/security/events.py @@ -0,0 +1,234 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ..._base_client import AsyncPaginator, make_request_options +from ...types.security import event_list_params +from ...types.security.client_view import ClientView + +__all__ = ["EventsResource", "AsyncEventsResource"] + + +class EventsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> EventsResourceWithRawResponse: + """ + 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 EventsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> EventsResourceWithStreamingResponse: + """ + 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 EventsResourceWithStreamingResponse(self) + + def list( + self, + *, + alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | NotGiven = NOT_GIVEN, + date_from: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN, + date_to: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal[ + "attack_start_time", + "-attack_start_time", + "attack_power_bps", + "-attack_power_bps", + "attack_power_pps", + "-attack_power_pps", + "number_of_ip_involved_in_attack", + "-number_of_ip_involved_in_attack", + "alert_type", + "-alert_type", + ] + | NotGiven = NOT_GIVEN, + targeted_ip_addresses: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[ClientView]: + """ + Event Logs Clients View + + 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_api_list( + "/security/notifier/v1/event_logs", + page=SyncOffsetPage[ClientView], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "alert_type": alert_type, + "date_from": date_from, + "date_to": date_to, + "limit": limit, + "offset": offset, + "ordering": ordering, + "targeted_ip_addresses": targeted_ip_addresses, + }, + event_list_params.EventListParams, + ), + ), + model=ClientView, + ) + + +class AsyncEventsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: + """ + 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 AsyncEventsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: + """ + 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 AsyncEventsResourceWithStreamingResponse(self) + + def list( + self, + *, + alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | NotGiven = NOT_GIVEN, + date_from: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN, + date_to: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal[ + "attack_start_time", + "-attack_start_time", + "attack_power_bps", + "-attack_power_bps", + "attack_power_pps", + "-attack_power_pps", + "number_of_ip_involved_in_attack", + "-number_of_ip_involved_in_attack", + "alert_type", + "-alert_type", + ] + | NotGiven = NOT_GIVEN, + targeted_ip_addresses: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[ClientView, AsyncOffsetPage[ClientView]]: + """ + Event Logs Clients View + + 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_api_list( + "/security/notifier/v1/event_logs", + page=AsyncOffsetPage[ClientView], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "alert_type": alert_type, + "date_from": date_from, + "date_to": date_to, + "limit": limit, + "offset": offset, + "ordering": ordering, + "targeted_ip_addresses": targeted_ip_addresses, + }, + event_list_params.EventListParams, + ), + ), + model=ClientView, + ) + + +class EventsResourceWithRawResponse: + def __init__(self, events: EventsResource) -> None: + self._events = events + + self.list = to_raw_response_wrapper( + events.list, + ) + + +class AsyncEventsResourceWithRawResponse: + def __init__(self, events: AsyncEventsResource) -> None: + self._events = events + + self.list = async_to_raw_response_wrapper( + events.list, + ) + + +class EventsResourceWithStreamingResponse: + def __init__(self, events: EventsResource) -> None: + self._events = events + + self.list = to_streamed_response_wrapper( + events.list, + ) + + +class AsyncEventsResourceWithStreamingResponse: + def __init__(self, events: AsyncEventsResource) -> None: + self._events = events + + self.list = async_to_streamed_response_wrapper( + events.list, + ) diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py new file mode 100644 index 00000000..85b84ad8 --- /dev/null +++ b/src/gcore/resources/security/profile_templates.py @@ -0,0 +1,143 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.security.profile_template_list_response import ProfileTemplateListResponse + +__all__ = ["ProfileTemplatesResource", "AsyncProfileTemplatesResource"] + + +class ProfileTemplatesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ProfileTemplatesResourceWithRawResponse: + """ + 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 ProfileTemplatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ProfileTemplatesResourceWithStreamingResponse: + """ + 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 ProfileTemplatesResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ProfileTemplateListResponse: + """Get list of profile templates. + + Profile template is used as a template to create + profile. Client receives only common and created for him profile templates. + """ + return self._get( + "/security/iaas/profile-templates", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProfileTemplateListResponse, + ) + + +class AsyncProfileTemplatesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncProfileTemplatesResourceWithRawResponse: + """ + 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 AsyncProfileTemplatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncProfileTemplatesResourceWithStreamingResponse: + """ + 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 AsyncProfileTemplatesResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ProfileTemplateListResponse: + """Get list of profile templates. + + Profile template is used as a template to create + profile. Client receives only common and created for him profile templates. + """ + return await self._get( + "/security/iaas/profile-templates", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProfileTemplateListResponse, + ) + + +class ProfileTemplatesResourceWithRawResponse: + def __init__(self, profile_templates: ProfileTemplatesResource) -> None: + self._profile_templates = profile_templates + + self.list = to_raw_response_wrapper( + profile_templates.list, + ) + + +class AsyncProfileTemplatesResourceWithRawResponse: + def __init__(self, profile_templates: AsyncProfileTemplatesResource) -> None: + self._profile_templates = profile_templates + + self.list = async_to_raw_response_wrapper( + profile_templates.list, + ) + + +class ProfileTemplatesResourceWithStreamingResponse: + def __init__(self, profile_templates: ProfileTemplatesResource) -> None: + self._profile_templates = profile_templates + + self.list = to_streamed_response_wrapper( + profile_templates.list, + ) + + +class AsyncProfileTemplatesResourceWithStreamingResponse: + def __init__(self, profile_templates: AsyncProfileTemplatesResource) -> None: + self._profile_templates = profile_templates + + self.list = async_to_streamed_response_wrapper( + profile_templates.list, + ) diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py new file mode 100644 index 00000000..16668afa --- /dev/null +++ b/src/gcore/resources/security/profiles.py @@ -0,0 +1,661 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.security import ( + profile_list_params, + profile_create_params, + profile_replace_params, + profile_recreate_params, +) +from ...types.security.client_profile import ClientProfile +from ...types.security.profile_list_response import ProfileListResponse + +__all__ = ["ProfilesResource", "AsyncProfilesResource"] + + +class ProfilesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ProfilesResourceWithRawResponse: + """ + 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 ProfilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ProfilesResourceWithStreamingResponse: + """ + 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 ProfilesResourceWithStreamingResponse(self) + + def create( + self, + *, + fields: Iterable[profile_create_params.Field], + profile_template: int, + ip_address: Optional[str] | NotGiven = NOT_GIVEN, + site: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ClientProfile: + """Create protection profile. + + Protection is enabled at the same time as profile is + created + + 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( + "/security/iaas/v2/profiles", + body=maybe_transform( + { + "fields": fields, + "profile_template": profile_template, + "ip_address": ip_address, + "site": site, + }, + profile_create_params.ProfileCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + def list( + self, + *, + exclude_empty_address: bool | NotGiven = NOT_GIVEN, + include_deleted: bool | NotGiven = NOT_GIVEN, + ip_address: str | NotGiven = NOT_GIVEN, + site: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ProfileListResponse: + """Get list of protection profiles. + + Client receives only profiles created by him + + 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( + "/security/iaas/v2/profiles", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "exclude_empty_address": exclude_empty_address, + "include_deleted": include_deleted, + "ip_address": ip_address, + "site": site, + }, + profile_list_params.ProfileListParams, + ), + ), + cast_to=ProfileListResponse, + ) + + def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Delete protection profile. + + Protection is disabled at the same time as profile is + deleted + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/security/iaas/v2/profiles/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ClientProfile: + """ + Get profile by id + + 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"/security/iaas/v2/profiles/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + def recreate( + self, + id: int, + *, + fields: Iterable[profile_recreate_params.Field], + profile_template: int, + ip_address: Optional[str] | NotGiven = NOT_GIVEN, + site: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ClientProfile: + """ + Recreate profile with another profile template (for other cases use detail API) + + 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"/security/iaas/v2/profiles/{id}/recreate", + body=maybe_transform( + { + "fields": fields, + "profile_template": profile_template, + "ip_address": ip_address, + "site": site, + }, + profile_recreate_params.ProfileRecreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + def replace( + self, + id: int, + *, + fields: Iterable[profile_replace_params.Field], + profile_template: int, + ip_address: Optional[str] | NotGiven = NOT_GIVEN, + site: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ClientProfile: + """Update profile. + + Protection policies are updated at the same time as profile + updated + + 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"/security/iaas/v2/profiles/{id}", + body=maybe_transform( + { + "fields": fields, + "profile_template": profile_template, + "ip_address": ip_address, + "site": site, + }, + profile_replace_params.ProfileReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + +class AsyncProfilesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncProfilesResourceWithRawResponse: + """ + 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 AsyncProfilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncProfilesResourceWithStreamingResponse: + """ + 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 AsyncProfilesResourceWithStreamingResponse(self) + + async def create( + self, + *, + fields: Iterable[profile_create_params.Field], + profile_template: int, + ip_address: Optional[str] | NotGiven = NOT_GIVEN, + site: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ClientProfile: + """Create protection profile. + + Protection is enabled at the same time as profile is + created + + 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( + "/security/iaas/v2/profiles", + body=await async_maybe_transform( + { + "fields": fields, + "profile_template": profile_template, + "ip_address": ip_address, + "site": site, + }, + profile_create_params.ProfileCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + async def list( + self, + *, + exclude_empty_address: bool | NotGiven = NOT_GIVEN, + include_deleted: bool | NotGiven = NOT_GIVEN, + ip_address: str | NotGiven = NOT_GIVEN, + site: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ProfileListResponse: + """Get list of protection profiles. + + Client receives only profiles created by him + + 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( + "/security/iaas/v2/profiles", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "exclude_empty_address": exclude_empty_address, + "include_deleted": include_deleted, + "ip_address": ip_address, + "site": site, + }, + profile_list_params.ProfileListParams, + ), + ), + cast_to=ProfileListResponse, + ) + + async def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Delete protection profile. + + Protection is disabled at the same time as profile is + deleted + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/security/iaas/v2/profiles/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ClientProfile: + """ + Get profile by id + + 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"/security/iaas/v2/profiles/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + async def recreate( + self, + id: int, + *, + fields: Iterable[profile_recreate_params.Field], + profile_template: int, + ip_address: Optional[str] | NotGiven = NOT_GIVEN, + site: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ClientProfile: + """ + Recreate profile with another profile template (for other cases use detail API) + + 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"/security/iaas/v2/profiles/{id}/recreate", + body=await async_maybe_transform( + { + "fields": fields, + "profile_template": profile_template, + "ip_address": ip_address, + "site": site, + }, + profile_recreate_params.ProfileRecreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + async def replace( + self, + id: int, + *, + fields: Iterable[profile_replace_params.Field], + profile_template: int, + ip_address: Optional[str] | NotGiven = NOT_GIVEN, + site: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ClientProfile: + """Update profile. + + Protection policies are updated at the same time as profile + updated + + 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"/security/iaas/v2/profiles/{id}", + body=await async_maybe_transform( + { + "fields": fields, + "profile_template": profile_template, + "ip_address": ip_address, + "site": site, + }, + profile_replace_params.ProfileReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + +class ProfilesResourceWithRawResponse: + def __init__(self, profiles: ProfilesResource) -> None: + self._profiles = profiles + + self.create = to_raw_response_wrapper( + profiles.create, + ) + self.list = to_raw_response_wrapper( + profiles.list, + ) + self.delete = to_raw_response_wrapper( + profiles.delete, + ) + self.get = to_raw_response_wrapper( + profiles.get, + ) + self.recreate = to_raw_response_wrapper( + profiles.recreate, + ) + self.replace = to_raw_response_wrapper( + profiles.replace, + ) + + +class AsyncProfilesResourceWithRawResponse: + def __init__(self, profiles: AsyncProfilesResource) -> None: + self._profiles = profiles + + self.create = async_to_raw_response_wrapper( + profiles.create, + ) + self.list = async_to_raw_response_wrapper( + profiles.list, + ) + self.delete = async_to_raw_response_wrapper( + profiles.delete, + ) + self.get = async_to_raw_response_wrapper( + profiles.get, + ) + self.recreate = async_to_raw_response_wrapper( + profiles.recreate, + ) + self.replace = async_to_raw_response_wrapper( + profiles.replace, + ) + + +class ProfilesResourceWithStreamingResponse: + def __init__(self, profiles: ProfilesResource) -> None: + self._profiles = profiles + + self.create = to_streamed_response_wrapper( + profiles.create, + ) + self.list = to_streamed_response_wrapper( + profiles.list, + ) + self.delete = to_streamed_response_wrapper( + profiles.delete, + ) + self.get = to_streamed_response_wrapper( + profiles.get, + ) + self.recreate = to_streamed_response_wrapper( + profiles.recreate, + ) + self.replace = to_streamed_response_wrapper( + profiles.replace, + ) + + +class AsyncProfilesResourceWithStreamingResponse: + def __init__(self, profiles: AsyncProfilesResource) -> None: + self._profiles = profiles + + self.create = async_to_streamed_response_wrapper( + profiles.create, + ) + self.list = async_to_streamed_response_wrapper( + profiles.list, + ) + self.delete = async_to_streamed_response_wrapper( + profiles.delete, + ) + self.get = async_to_streamed_response_wrapper( + profiles.get, + ) + self.recreate = async_to_streamed_response_wrapper( + profiles.recreate, + ) + self.replace = async_to_streamed_response_wrapper( + profiles.replace, + ) diff --git a/src/gcore/resources/security/security.py b/src/gcore/resources/security/security.py new file mode 100644 index 00000000..2d0d9c11 --- /dev/null +++ b/src/gcore/resources/security/security.py @@ -0,0 +1,198 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) +from .profiles import ( + ProfilesResource, + AsyncProfilesResource, + ProfilesResourceWithRawResponse, + AsyncProfilesResourceWithRawResponse, + ProfilesResourceWithStreamingResponse, + AsyncProfilesResourceWithStreamingResponse, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from .bgp_announces import ( + BgpAnnouncesResource, + AsyncBgpAnnouncesResource, + BgpAnnouncesResourceWithRawResponse, + AsyncBgpAnnouncesResourceWithRawResponse, + BgpAnnouncesResourceWithStreamingResponse, + AsyncBgpAnnouncesResourceWithStreamingResponse, +) +from .profile_templates import ( + ProfileTemplatesResource, + AsyncProfileTemplatesResource, + ProfileTemplatesResourceWithRawResponse, + AsyncProfileTemplatesResourceWithRawResponse, + ProfileTemplatesResourceWithStreamingResponse, + AsyncProfileTemplatesResourceWithStreamingResponse, +) + +__all__ = ["SecurityResource", "AsyncSecurityResource"] + + +class SecurityResource(SyncAPIResource): + @cached_property + def events(self) -> EventsResource: + return EventsResource(self._client) + + @cached_property + def bgp_announces(self) -> BgpAnnouncesResource: + return BgpAnnouncesResource(self._client) + + @cached_property + def profile_templates(self) -> ProfileTemplatesResource: + return ProfileTemplatesResource(self._client) + + @cached_property + def profiles(self) -> ProfilesResource: + return ProfilesResource(self._client) + + @cached_property + def with_raw_response(self) -> SecurityResourceWithRawResponse: + """ + 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 SecurityResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SecurityResourceWithStreamingResponse: + """ + 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 SecurityResourceWithStreamingResponse(self) + + +class AsyncSecurityResource(AsyncAPIResource): + @cached_property + def events(self) -> AsyncEventsResource: + return AsyncEventsResource(self._client) + + @cached_property + def bgp_announces(self) -> AsyncBgpAnnouncesResource: + return AsyncBgpAnnouncesResource(self._client) + + @cached_property + def profile_templates(self) -> AsyncProfileTemplatesResource: + return AsyncProfileTemplatesResource(self._client) + + @cached_property + def profiles(self) -> AsyncProfilesResource: + return AsyncProfilesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncSecurityResourceWithRawResponse: + """ + 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 AsyncSecurityResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSecurityResourceWithStreamingResponse: + """ + 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 AsyncSecurityResourceWithStreamingResponse(self) + + +class SecurityResourceWithRawResponse: + def __init__(self, security: SecurityResource) -> None: + self._security = security + + @cached_property + def events(self) -> EventsResourceWithRawResponse: + return EventsResourceWithRawResponse(self._security.events) + + @cached_property + def bgp_announces(self) -> BgpAnnouncesResourceWithRawResponse: + return BgpAnnouncesResourceWithRawResponse(self._security.bgp_announces) + + @cached_property + def profile_templates(self) -> ProfileTemplatesResourceWithRawResponse: + return ProfileTemplatesResourceWithRawResponse(self._security.profile_templates) + + @cached_property + def profiles(self) -> ProfilesResourceWithRawResponse: + return ProfilesResourceWithRawResponse(self._security.profiles) + + +class AsyncSecurityResourceWithRawResponse: + def __init__(self, security: AsyncSecurityResource) -> None: + self._security = security + + @cached_property + def events(self) -> AsyncEventsResourceWithRawResponse: + return AsyncEventsResourceWithRawResponse(self._security.events) + + @cached_property + def bgp_announces(self) -> AsyncBgpAnnouncesResourceWithRawResponse: + return AsyncBgpAnnouncesResourceWithRawResponse(self._security.bgp_announces) + + @cached_property + def profile_templates(self) -> AsyncProfileTemplatesResourceWithRawResponse: + return AsyncProfileTemplatesResourceWithRawResponse(self._security.profile_templates) + + @cached_property + def profiles(self) -> AsyncProfilesResourceWithRawResponse: + return AsyncProfilesResourceWithRawResponse(self._security.profiles) + + +class SecurityResourceWithStreamingResponse: + def __init__(self, security: SecurityResource) -> None: + self._security = security + + @cached_property + def events(self) -> EventsResourceWithStreamingResponse: + return EventsResourceWithStreamingResponse(self._security.events) + + @cached_property + def bgp_announces(self) -> BgpAnnouncesResourceWithStreamingResponse: + return BgpAnnouncesResourceWithStreamingResponse(self._security.bgp_announces) + + @cached_property + def profile_templates(self) -> ProfileTemplatesResourceWithStreamingResponse: + return ProfileTemplatesResourceWithStreamingResponse(self._security.profile_templates) + + @cached_property + def profiles(self) -> ProfilesResourceWithStreamingResponse: + return ProfilesResourceWithStreamingResponse(self._security.profiles) + + +class AsyncSecurityResourceWithStreamingResponse: + def __init__(self, security: AsyncSecurityResource) -> None: + self._security = security + + @cached_property + def events(self) -> AsyncEventsResourceWithStreamingResponse: + return AsyncEventsResourceWithStreamingResponse(self._security.events) + + @cached_property + def bgp_announces(self) -> AsyncBgpAnnouncesResourceWithStreamingResponse: + return AsyncBgpAnnouncesResourceWithStreamingResponse(self._security.bgp_announces) + + @cached_property + def profile_templates(self) -> AsyncProfileTemplatesResourceWithStreamingResponse: + return AsyncProfileTemplatesResourceWithStreamingResponse(self._security.profile_templates) + + @cached_property + def profiles(self) -> AsyncProfilesResourceWithStreamingResponse: + return AsyncProfilesResourceWithStreamingResponse(self._security.profiles) diff --git a/src/gcore/types/security/__init__.py b/src/gcore/types/security/__init__.py new file mode 100644 index 00000000..7ec80761 --- /dev/null +++ b/src/gcore/types/security/__init__.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .client_view import ClientView as ClientView +from .client_profile import ClientProfile as ClientProfile +from .client_announce import ClientAnnounce as ClientAnnounce +from .event_list_params import EventListParams as EventListParams +from .profile_list_params import ProfileListParams as ProfileListParams +from .profile_create_params import ProfileCreateParams as ProfileCreateParams +from .profile_list_response import ProfileListResponse as ProfileListResponse +from .profile_replace_params import ProfileReplaceParams as ProfileReplaceParams +from .client_profile_template import ClientProfileTemplate as ClientProfileTemplate +from .profile_recreate_params import ProfileRecreateParams as ProfileRecreateParams +from .bgp_announce_list_params import BgpAnnounceListParams as BgpAnnounceListParams +from .bgp_announce_change_params import BgpAnnounceChangeParams as BgpAnnounceChangeParams +from .bgp_announce_list_response import BgpAnnounceListResponse as BgpAnnounceListResponse +from .profile_template_list_response import ProfileTemplateListResponse as ProfileTemplateListResponse diff --git a/src/gcore/types/security/bgp_announce_change_params.py b/src/gcore/types/security/bgp_announce_change_params.py new file mode 100644 index 00000000..ef52617b --- /dev/null +++ b/src/gcore/types/security/bgp_announce_change_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +__all__ = ["BgpAnnounceChangeParams"] + + +class BgpAnnounceChangeParams(TypedDict, total=False): + announce: Required[str] + + enabled: Required[bool] + + client_id: Optional[int] diff --git a/src/gcore/types/security/bgp_announce_list_params.py b/src/gcore/types/security/bgp_announce_list_params.py new file mode 100644 index 00000000..390464fe --- /dev/null +++ b/src/gcore/types/security/bgp_announce_list_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 Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["BgpAnnounceListParams"] + + +class BgpAnnounceListParams(TypedDict, total=False): + announced: Optional[bool] + + client_id: Optional[int] + + origin: Optional[Literal["STATIC", "DYNAMIC"]] + + site: Optional[str] diff --git a/src/gcore/types/security/bgp_announce_list_response.py b/src/gcore/types/security/bgp_announce_list_response.py new file mode 100644 index 00000000..6981ba90 --- /dev/null +++ b/src/gcore/types/security/bgp_announce_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .client_announce import ClientAnnounce + +__all__ = ["BgpAnnounceListResponse"] + +BgpAnnounceListResponse: TypeAlias = List[ClientAnnounce] diff --git a/src/gcore/types/security/client_announce.py b/src/gcore/types/security/client_announce.py new file mode 100644 index 00000000..ef276615 --- /dev/null +++ b/src/gcore/types/security/client_announce.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["ClientAnnounce"] + + +class ClientAnnounce(BaseModel): + announced: List[str] + + client_id: int + + not_announced: List[str] diff --git a/src/gcore/types/security/client_profile.py b/src/gcore/types/security/client_profile.py new file mode 100644 index 00000000..e440f21b --- /dev/null +++ b/src/gcore/types/security/client_profile.py @@ -0,0 +1,56 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional + +from ..._models import BaseModel +from .client_profile_template import ClientProfileTemplate + +__all__ = ["ClientProfile", "Field", "Options"] + + +class Field(BaseModel): + id: int + + base_field: int + + default: str + + description: str + + field_type: str + + name: str + + required: bool + + validation_schema: Dict[str, object] + + field_value: Optional[Dict[str, object]] = None + + +class Options(BaseModel): + active: bool + + bgp: bool + + price: str + + +class ClientProfile(BaseModel): + id: int + + fields: List[Field] + + options: Options + + plan: str + + profile_template: ClientProfileTemplate + + protocols: List[Dict[str, object]] + + site: str + + status: Dict[str, object] + + ip_address: Optional[str] = None diff --git a/src/gcore/types/security/client_profile_template.py b/src/gcore/types/security/client_profile_template.py new file mode 100644 index 00000000..4ea63e14 --- /dev/null +++ b/src/gcore/types/security/client_profile_template.py @@ -0,0 +1,43 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["ClientProfileTemplate", "Field"] + + +class Field(BaseModel): + id: int + + name: str + + default: Optional[str] = None + + description: Optional[str] = None + + field_type: Optional[Literal["int", "bool", "str"]] = None + + required: Optional[bool] = None + + validation_schema: Optional[Dict[str, object]] = None + + +class ClientProfileTemplate(BaseModel): + id: int + + created: datetime + + fields: List[Field] + + name: str + + version: str + + base_template: Optional[int] = None + + description: Optional[str] = None + + template_sifter: Optional[str] = None diff --git a/src/gcore/types/security/client_view.py b/src/gcore/types/security/client_view.py new file mode 100644 index 00000000..802060ab --- /dev/null +++ b/src/gcore/types/security/client_view.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["ClientView"] + + +class ClientView(BaseModel): + id: str + + alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] = None + + attack_power_bps: Optional[float] = None + + attack_power_pps: Optional[float] = None + + attack_start_time: Optional[datetime] = None + + client_id: Optional[int] = None + + notification_type: Optional[str] = None + + number_of_ip_involved_in_attack: Optional[int] = None + + targeted_ip_addresses: Optional[str] = None diff --git a/src/gcore/types/security/event_list_params.py b/src/gcore/types/security/event_list_params.py new file mode 100644 index 00000000..0bd703c3 --- /dev/null +++ b/src/gcore/types/security/event_list_params.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["EventListParams"] + + +class EventListParams(TypedDict, total=False): + alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] + + date_from: Annotated[Union[Union[str, datetime], str], PropertyInfo(format="iso8601")] + + date_to: Annotated[Union[Union[str, datetime], str], PropertyInfo(format="iso8601")] + + limit: int + + offset: int + + ordering: Literal[ + "attack_start_time", + "-attack_start_time", + "attack_power_bps", + "-attack_power_bps", + "attack_power_pps", + "-attack_power_pps", + "number_of_ip_involved_in_attack", + "-number_of_ip_involved_in_attack", + "alert_type", + "-alert_type", + ] + + targeted_ip_addresses: Optional[str] diff --git a/src/gcore/types/security/profile_create_params.py b/src/gcore/types/security/profile_create_params.py new file mode 100644 index 00000000..fbefd31e --- /dev/null +++ b/src/gcore/types/security/profile_create_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["ProfileCreateParams", "Field"] + + +class ProfileCreateParams(TypedDict, total=False): + fields: Required[Iterable[Field]] + + profile_template: Required[int] + + ip_address: Optional[str] + + site: str + + +class Field(TypedDict, total=False): + base_field: Required[int] + + field_value: Optional[Dict[str, object]] diff --git a/src/gcore/types/security/profile_list_params.py b/src/gcore/types/security/profile_list_params.py new file mode 100644 index 00000000..e54f232f --- /dev/null +++ b/src/gcore/types/security/profile_list_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ProfileListParams"] + + +class ProfileListParams(TypedDict, total=False): + exclude_empty_address: bool + + include_deleted: bool + + ip_address: str + + site: str diff --git a/src/gcore/types/security/profile_list_response.py b/src/gcore/types/security/profile_list_response.py new file mode 100644 index 00000000..816021c8 --- /dev/null +++ b/src/gcore/types/security/profile_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .client_profile import ClientProfile + +__all__ = ["ProfileListResponse"] + +ProfileListResponse: TypeAlias = List[ClientProfile] diff --git a/src/gcore/types/security/profile_recreate_params.py b/src/gcore/types/security/profile_recreate_params.py new file mode 100644 index 00000000..b8418275 --- /dev/null +++ b/src/gcore/types/security/profile_recreate_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["ProfileRecreateParams", "Field"] + + +class ProfileRecreateParams(TypedDict, total=False): + fields: Required[Iterable[Field]] + + profile_template: Required[int] + + ip_address: Optional[str] + + site: str + + +class Field(TypedDict, total=False): + base_field: Required[int] + + field_value: Optional[Dict[str, object]] diff --git a/src/gcore/types/security/profile_replace_params.py b/src/gcore/types/security/profile_replace_params.py new file mode 100644 index 00000000..d4304a67 --- /dev/null +++ b/src/gcore/types/security/profile_replace_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["ProfileReplaceParams", "Field"] + + +class ProfileReplaceParams(TypedDict, total=False): + fields: Required[Iterable[Field]] + + profile_template: Required[int] + + ip_address: Optional[str] + + site: str + + +class Field(TypedDict, total=False): + base_field: Required[int] + + field_value: Optional[Dict[str, object]] diff --git a/src/gcore/types/security/profile_template_list_response.py b/src/gcore/types/security/profile_template_list_response.py new file mode 100644 index 00000000..2264e970 --- /dev/null +++ b/src/gcore/types/security/profile_template_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .client_profile_template import ClientProfileTemplate + +__all__ = ["ProfileTemplateListResponse"] + +ProfileTemplateListResponse: TypeAlias = List[ClientProfileTemplate] diff --git a/tests/api_resources/security/__init__.py b/tests/api_resources/security/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/security/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/security/test_bgp_announces.py b/tests/api_resources/security/test_bgp_announces.py new file mode 100644 index 00000000..03b72039 --- /dev/null +++ b/tests/api_resources/security/test_bgp_announces.py @@ -0,0 +1,180 @@ +# 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.security import BgpAnnounceListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBgpAnnounces: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + bgp_announce = client.security.bgp_announces.list() + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + bgp_announce = client.security.bgp_announces.list( + announced=True, + client_id=0, + origin="STATIC", + site="x", + ) + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.security.bgp_announces.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_announce = response.parse() + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.security.bgp_announces.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_announce = response.parse() + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_change(self, client: Gcore) -> None: + bgp_announce = client.security.bgp_announces.change( + announce="192.9.9.1/32", + enabled=True, + ) + assert_matches_type(object, bgp_announce, path=["response"]) + + @parametrize + def test_method_change_with_all_params(self, client: Gcore) -> None: + bgp_announce = client.security.bgp_announces.change( + announce="192.9.9.1/32", + enabled=True, + client_id=0, + ) + assert_matches_type(object, bgp_announce, path=["response"]) + + @parametrize + def test_raw_response_change(self, client: Gcore) -> None: + response = client.security.bgp_announces.with_raw_response.change( + announce="192.9.9.1/32", + enabled=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_announce = response.parse() + assert_matches_type(object, bgp_announce, path=["response"]) + + @parametrize + def test_streaming_response_change(self, client: Gcore) -> None: + with client.security.bgp_announces.with_streaming_response.change( + announce="192.9.9.1/32", + enabled=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_announce = response.parse() + assert_matches_type(object, bgp_announce, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncBgpAnnounces: + 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: + bgp_announce = await async_client.security.bgp_announces.list() + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + bgp_announce = await async_client.security.bgp_announces.list( + announced=True, + client_id=0, + origin="STATIC", + site="x", + ) + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.security.bgp_announces.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_announce = await response.parse() + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.security.bgp_announces.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_announce = await response.parse() + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_change(self, async_client: AsyncGcore) -> None: + bgp_announce = await async_client.security.bgp_announces.change( + announce="192.9.9.1/32", + enabled=True, + ) + assert_matches_type(object, bgp_announce, path=["response"]) + + @parametrize + async def test_method_change_with_all_params(self, async_client: AsyncGcore) -> None: + bgp_announce = await async_client.security.bgp_announces.change( + announce="192.9.9.1/32", + enabled=True, + client_id=0, + ) + assert_matches_type(object, bgp_announce, path=["response"]) + + @parametrize + async def test_raw_response_change(self, async_client: AsyncGcore) -> None: + response = await async_client.security.bgp_announces.with_raw_response.change( + announce="192.9.9.1/32", + enabled=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_announce = await response.parse() + assert_matches_type(object, bgp_announce, path=["response"]) + + @parametrize + async def test_streaming_response_change(self, async_client: AsyncGcore) -> None: + async with async_client.security.bgp_announces.with_streaming_response.change( + announce="192.9.9.1/32", + enabled=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_announce = await response.parse() + assert_matches_type(object, bgp_announce, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/security/test_events.py b/tests/api_resources/security/test_events.py new file mode 100644 index 00000000..650de2cf --- /dev/null +++ b/tests/api_resources/security/test_events.py @@ -0,0 +1,102 @@ +# 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._utils import parse_datetime +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.security import ClientView + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestEvents: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + event = client.security.events.list() + assert_matches_type(SyncOffsetPage[ClientView], event, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + event = client.security.events.list( + alert_type="ddos_alert", + date_from=parse_datetime("2019-12-27T18:11:19.117Z"), + date_to=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=1, + offset=0, + ordering="attack_start_time", + targeted_ip_addresses="targeted_ip_addresses", + ) + assert_matches_type(SyncOffsetPage[ClientView], event, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.security.events.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = response.parse() + assert_matches_type(SyncOffsetPage[ClientView], event, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.security.events.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = response.parse() + assert_matches_type(SyncOffsetPage[ClientView], event, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncEvents: + 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: + event = await async_client.security.events.list() + assert_matches_type(AsyncOffsetPage[ClientView], event, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + event = await async_client.security.events.list( + alert_type="ddos_alert", + date_from=parse_datetime("2019-12-27T18:11:19.117Z"), + date_to=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=1, + offset=0, + ordering="attack_start_time", + targeted_ip_addresses="targeted_ip_addresses", + ) + assert_matches_type(AsyncOffsetPage[ClientView], event, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.security.events.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = await response.parse() + assert_matches_type(AsyncOffsetPage[ClientView], event, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.security.events.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = await response.parse() + assert_matches_type(AsyncOffsetPage[ClientView], event, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/security/test_profile_templates.py b/tests/api_resources/security/test_profile_templates.py new file mode 100644 index 00000000..7df4918f --- /dev/null +++ b/tests/api_resources/security/test_profile_templates.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.security import ProfileTemplateListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestProfileTemplates: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + profile_template = client.security.profile_templates.list() + assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.security.profile_templates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile_template = response.parse() + assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.security.profile_templates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile_template = response.parse() + assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncProfileTemplates: + 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: + profile_template = await async_client.security.profile_templates.list() + assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profile_templates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile_template = await response.parse() + assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.security.profile_templates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile_template = await response.parse() + assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/security/test_profiles.py b/tests/api_resources/security/test_profiles.py new file mode 100644 index 00000000..429291ae --- /dev/null +++ b/tests/api_resources/security/test_profiles.py @@ -0,0 +1,531 @@ +# 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.security import ( + ClientProfile, + ProfileListResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestProfiles: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + profile = client.security.profiles.create( + fields=[{"base_field": 1}], + profile_template=1, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + profile = client.security.profiles.create( + fields=[ + { + "base_field": 1, + "field_value": {"key": "bar"}, + } + ], + profile_template=1, + ip_address="123.43.2.10", + site="ED", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.security.profiles.with_raw_response.create( + fields=[{"base_field": 1}], + profile_template=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.security.profiles.with_streaming_response.create( + fields=[{"base_field": 1}], + profile_template=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + profile = client.security.profiles.list() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + profile = client.security.profiles.list( + exclude_empty_address=True, + include_deleted=True, + ip_address="ip_address", + site="site", + ) + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.security.profiles.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.security.profiles.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + profile = client.security.profiles.delete( + 0, + ) + assert profile is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.security.profiles.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert profile is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.security.profiles.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert profile is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + profile = client.security.profiles.get( + 0, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.security.profiles.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.security.profiles.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_recreate(self, client: Gcore) -> None: + profile = client.security.profiles.recreate( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_method_recreate_with_all_params(self, client: Gcore) -> None: + profile = client.security.profiles.recreate( + id=0, + fields=[ + { + "base_field": 1, + "field_value": {"key": "bar"}, + } + ], + profile_template=1, + ip_address="ip_address", + site="ED", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_raw_response_recreate(self, client: Gcore) -> None: + response = client.security.profiles.with_raw_response.recreate( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_streaming_response_recreate(self, client: Gcore) -> None: + with client.security.profiles.with_streaming_response.recreate( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + profile = client.security.profiles.replace( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + profile = client.security.profiles.replace( + id=0, + fields=[ + { + "base_field": 1, + "field_value": {"key": "bar"}, + } + ], + profile_template=1, + ip_address="ip_address", + site="ED", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.security.profiles.with_raw_response.replace( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.security.profiles.with_streaming_response.replace( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncProfiles: + 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: + profile = await async_client.security.profiles.create( + fields=[{"base_field": 1}], + profile_template=1, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.create( + fields=[ + { + "base_field": 1, + "field_value": {"key": "bar"}, + } + ], + profile_template=1, + ip_address="123.43.2.10", + site="ED", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profiles.with_raw_response.create( + fields=[{"base_field": 1}], + profile_template=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.security.profiles.with_streaming_response.create( + fields=[{"base_field": 1}], + profile_template=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.list() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.list( + exclude_empty_address=True, + include_deleted=True, + ip_address="ip_address", + site="site", + ) + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profiles.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.security.profiles.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.delete( + 0, + ) + assert profile is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profiles.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert profile is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.security.profiles.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert profile is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.get( + 0, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profiles.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.security.profiles.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_recreate(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.recreate( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_method_recreate_with_all_params(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.recreate( + id=0, + fields=[ + { + "base_field": 1, + "field_value": {"key": "bar"}, + } + ], + profile_template=1, + ip_address="ip_address", + site="ED", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_raw_response_recreate(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profiles.with_raw_response.recreate( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_streaming_response_recreate(self, async_client: AsyncGcore) -> None: + async with async_client.security.profiles.with_streaming_response.recreate( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.replace( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.replace( + id=0, + fields=[ + { + "base_field": 1, + "field_value": {"key": "bar"}, + } + ], + profile_template=1, + ip_address="ip_address", + site="ED", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profiles.with_raw_response.replace( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.security.profiles.with_streaming_response.replace( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True From e78e8725f230b1c7a05bd3bcc9599d7c15cab738 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 15:28:37 +0000 Subject: [PATCH 232/592] feat(fastedge): add binaries create method --- .stats.yml | 4 +- api.md | 1 + src/gcore/resources/fastedge/binaries.py | 82 ++++++++++++++++++- src/gcore/types/fastedge/__init__.py | 1 + .../types/fastedge/binary_create_params.py | 11 +++ tests/api_resources/fastedge/test_binaries.py | 64 ++++++++++++++- 6 files changed, 159 insertions(+), 4 deletions(-) create mode 100644 src/gcore/types/fastedge/binary_create_params.py diff --git a/.stats.yml b/.stats.yml index d977eb18..c27ad1aa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 445 +configured_endpoints: 446 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-46f52bae913ccca59cb78712dc498c1474f1db96c889a466758ab1dacc01c1b3.yml openapi_spec_hash: 202b162bda8d283806b0f7fbefb6f657 -config_hash: 9494c1ec9c5fd8a16b99608ef8ca3636 +config_hash: 4c375f9918f360ca289733f8b3a61fbb diff --git a/api.md b/api.md index 47e93017..7e793d9f 100644 --- a/api.md +++ b/api.md @@ -1301,6 +1301,7 @@ from gcore.types.fastedge import Binary, BinaryShort, BinaryListResponse Methods: +- client.fastedge.binaries.create(body, \*\*params) -> BinaryShort - client.fastedge.binaries.list() -> BinaryListResponse - client.fastedge.binaries.delete(id) -> None - client.fastedge.binaries.get(id) -> Binary diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index 79cbd817..8323efb1 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -4,7 +4,8 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._files import read_file_content, async_read_file_content +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileContent from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -15,6 +16,7 @@ ) from ..._base_client import make_request_options from ...types.fastedge.binary import Binary +from ...types.fastedge.binary_short import BinaryShort from ...types.fastedge.binary_list_response import BinaryListResponse __all__ = ["BinariesResource", "AsyncBinariesResource"] @@ -40,6 +42,39 @@ def with_streaming_response(self) -> BinariesResourceWithStreamingResponse: """ return BinariesResourceWithStreamingResponse(self) + def create( + self, + body: FileContent, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BinaryShort: + """ + Store compiled WASM binary + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} + return self._post( + "/fastedge/v1/binaries/raw", + body=read_file_content(body), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BinaryShort, + ) + def list( self, *, @@ -143,6 +178,39 @@ def with_streaming_response(self) -> AsyncBinariesResourceWithStreamingResponse: """ return AsyncBinariesResourceWithStreamingResponse(self) + async def create( + self, + body: FileContent, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BinaryShort: + """ + Store compiled WASM binary + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} + return await self._post( + "/fastedge/v1/binaries/raw", + body=await async_read_file_content(body), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BinaryShort, + ) + async def list( self, *, @@ -230,6 +298,9 @@ class BinariesResourceWithRawResponse: def __init__(self, binaries: BinariesResource) -> None: self._binaries = binaries + self.create = to_raw_response_wrapper( + binaries.create, + ) self.list = to_raw_response_wrapper( binaries.list, ) @@ -245,6 +316,9 @@ class AsyncBinariesResourceWithRawResponse: def __init__(self, binaries: AsyncBinariesResource) -> None: self._binaries = binaries + self.create = async_to_raw_response_wrapper( + binaries.create, + ) self.list = async_to_raw_response_wrapper( binaries.list, ) @@ -260,6 +334,9 @@ class BinariesResourceWithStreamingResponse: def __init__(self, binaries: BinariesResource) -> None: self._binaries = binaries + self.create = to_streamed_response_wrapper( + binaries.create, + ) self.list = to_streamed_response_wrapper( binaries.list, ) @@ -275,6 +352,9 @@ class AsyncBinariesResourceWithStreamingResponse: def __init__(self, binaries: AsyncBinariesResource) -> None: self._binaries = binaries + self.create = async_to_streamed_response_wrapper( + binaries.create, + ) self.list = async_to_streamed_response_wrapper( binaries.list, ) diff --git a/src/gcore/types/fastedge/__init__.py b/src/gcore/types/fastedge/__init__.py index 756a9ea0..b09dc9e4 100644 --- a/src/gcore/types/fastedge/__init__.py +++ b/src/gcore/types/fastedge/__init__.py @@ -23,6 +23,7 @@ from .app_replace_params import AppReplaceParams as AppReplaceParams from .secret_list_params import SecretListParams as SecretListParams from .template_parameter import TemplateParameter as TemplateParameter +from .binary_create_params import BinaryCreateParams as BinaryCreateParams from .binary_list_response import BinaryListResponse as BinaryListResponse from .kv_store_list_params import KvStoreListParams as KvStoreListParams from .secret_create_params import SecretCreateParams as SecretCreateParams diff --git a/src/gcore/types/fastedge/binary_create_params.py b/src/gcore/types/fastedge/binary_create_params.py new file mode 100644 index 00000000..8231e29a --- /dev/null +++ b/src/gcore/types/fastedge/binary_create_params.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["BinaryCreateParams"] + + +class BinaryCreateParams(TypedDict, total=False): + pass diff --git a/tests/api_resources/fastedge/test_binaries.py b/tests/api_resources/fastedge/test_binaries.py index eb56f54c..1a0f1a95 100644 --- a/tests/api_resources/fastedge/test_binaries.py +++ b/tests/api_resources/fastedge/test_binaries.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.fastedge import Binary, BinaryListResponse +from gcore.types.fastedge import Binary, BinaryShort, BinaryListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -17,6 +17,37 @@ class TestBinaries: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_create(self, client: Gcore) -> None: + binary = client.fastedge.binaries.create( + b"raw file contents", + ) + assert_matches_type(BinaryShort, binary, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.fastedge.binaries.with_raw_response.create( + b"raw file contents", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + binary = response.parse() + assert_matches_type(BinaryShort, binary, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.fastedge.binaries.with_streaming_response.create( + b"raw file contents", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + binary = response.parse() + assert_matches_type(BinaryShort, binary, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_list(self, client: Gcore) -> None: binary = client.fastedge.binaries.list() @@ -110,6 +141,37 @@ class TestAsyncBinaries: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + binary = await async_client.fastedge.binaries.create( + b"raw file contents", + ) + assert_matches_type(BinaryShort, binary, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.fastedge.binaries.with_raw_response.create( + b"raw file contents", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + binary = await response.parse() + assert_matches_type(BinaryShort, binary, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.fastedge.binaries.with_streaming_response.create( + b"raw file contents", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + binary = await response.parse() + assert_matches_type(BinaryShort, binary, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: binary = await async_client.fastedge.binaries.list() From 2e4715f0f80028d51d316072b48c7a75b64abbc9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 15:46:36 +0000 Subject: [PATCH 233/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6538ca91..6d78745c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.8.0" + ".": "0.9.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 885edf5d..8cd76b3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.8.0" +version = "0.9.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 53587cb3..648efad4 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.8.0" # x-release-please-version +__version__ = "0.9.0" # x-release-please-version From a76839dbbc323729db4b0a43d36d85152ce97f7f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 Aug 2025 08:14:21 +0000 Subject: [PATCH 234/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cloud/region.py | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index c27ad1aa..1b124c1d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 446 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-46f52bae913ccca59cb78712dc498c1474f1db96c889a466758ab1dacc01c1b3.yml -openapi_spec_hash: 202b162bda8d283806b0f7fbefb6f657 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5fcbfa903dd073dfa9dbb9a25b5c7a7a04e6fdd5fad7cbfdb726d828f2e7adfd.yml +openapi_spec_hash: a7a561f0cc4ccc7e514b891f43c2b2a2 config_hash: 4c375f9918f360ca289733f8b3a61fbb diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py index 92293a26..977637ba 100644 --- a/src/gcore/types/cloud/region.py +++ b/src/gcore/types/cloud/region.py @@ -22,9 +22,6 @@ class Region(BaseModel): access_level: Literal["core", "edge"] """The access level of the region.""" - ai_service_endpoint_id: Optional[int] = None - """AI service API endpoint ID""" - available_volume_types: Optional[List[str]] = None """List of available volume types, 'standard', '`ssd_hiiops`', 'cold'].""" From 328384f910f04cf485af32526eaaeaaca07fadfc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 Aug 2025 12:16:41 +0000 Subject: [PATCH 235/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- .../cloud/load_balancers/pools/health_monitors.py | 12 ++++++++---- .../resources/cloud/load_balancers/pools/members.py | 4 ++-- src/gcore/types/cloud/health_monitor.py | 6 ++++++ src/gcore/types/cloud/load_balancer_create_params.py | 11 ++++++++--- .../types/cloud/load_balancers/pool_create_params.py | 11 ++++++++--- .../types/cloud/load_balancers/pool_update_params.py | 11 ++++++++--- .../pools/health_monitor_create_params.py | 9 +++++++-- .../cloud/load_balancers/pools/member_add_params.py | 2 +- 9 files changed, 50 insertions(+), 20 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1b124c1d..9baad3fc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 446 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5fcbfa903dd073dfa9dbb9a25b5c7a7a04e6fdd5fad7cbfdb726d828f2e7adfd.yml -openapi_spec_hash: a7a561f0cc4ccc7e514b891f43c2b2a2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-21dade7f2034ff31578d98a7d0e769aa271906ace022862be072adc14176a108.yml +openapi_spec_hash: a6b097bcb1ea27498a93ef4d26a35f90 config_hash: 4c375f9918f360ca289733f8b3a61fbb diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index 3712deec..81aab472 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -58,7 +58,7 @@ def create( type: LbHealthMonitorType, expected_codes: Optional[str] | NotGiven = NOT_GIVEN, http_method: Optional[HTTPMethod] | NotGiven = NOT_GIVEN, - max_retries_down: Optional[int] | NotGiven = NOT_GIVEN, + max_retries_down: int | NotGiven = NOT_GIVEN, url_path: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -85,7 +85,9 @@ def create( type: Health monitor type. Once health monitor is created, cannot be changed. - expected_codes: Can only be used together with `HTTP` or `HTTPS` health monitor type. + expected_codes: Expected HTTP response codes. Can be a single code or a range of codes. Can only + be used together with `HTTP` or `HTTPS` health monitor type. For example, + 200,202,300-302,401,403,404,500-504. If not specified, the default is 200. http_method: HTTP method. Can only be used together with `HTTP` or `HTTPS` health monitor type. @@ -209,7 +211,7 @@ async def create( type: LbHealthMonitorType, expected_codes: Optional[str] | NotGiven = NOT_GIVEN, http_method: Optional[HTTPMethod] | NotGiven = NOT_GIVEN, - max_retries_down: Optional[int] | NotGiven = NOT_GIVEN, + max_retries_down: int | NotGiven = NOT_GIVEN, url_path: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -236,7 +238,9 @@ async def create( type: Health monitor type. Once health monitor is created, cannot be changed. - expected_codes: Can only be used together with `HTTP` or `HTTPS` health monitor type. + expected_codes: Expected HTTP response codes. Can be a single code or a range of codes. Can only + be used together with `HTTP` or `HTTPS` health monitor type. For example, + 200,202,300-302,401,403,404,500-504. If not specified, the default is 200. http_method: HTTP method. Can only be used together with `HTTP` or `HTTPS` health monitor type. diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 7bf86213..a2a9ba94 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -57,7 +57,7 @@ def add( monitor_address: Optional[str] | NotGiven = NOT_GIVEN, monitor_port: Optional[int] | NotGiven = NOT_GIVEN, subnet_id: Optional[str] | NotGiven = NOT_GIVEN, - weight: Optional[int] | NotGiven = NOT_GIVEN, + weight: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -222,7 +222,7 @@ async def add( monitor_address: Optional[str] | NotGiven = NOT_GIVEN, monitor_port: Optional[int] | NotGiven = NOT_GIVEN, subnet_id: Optional[str] | NotGiven = NOT_GIVEN, - weight: Optional[int] | NotGiven = NOT_GIVEN, + weight: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/types/cloud/health_monitor.py b/src/gcore/types/cloud/health_monitor.py index 85674aa9..501c3782 100644 --- a/src/gcore/types/cloud/health_monitor.py +++ b/src/gcore/types/cloud/health_monitor.py @@ -45,6 +45,12 @@ class HealthMonitor(BaseModel): """Health monitor type. Once health monitor is created, cannot be changed.""" expected_codes: Optional[str] = None + """Expected HTTP response codes. + + Can be a single code or a range of codes. Can only be used together with `HTTP` + or `HTTPS` health monitor type. For example, + 200,202,300-302,401,403,404,500-504. If not specified, the default is 200. + """ http_method: Optional[HTTPMethod] = None """HTTP method""" diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index ff7eb6bc..6b2f7564 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -147,7 +147,12 @@ class ListenerPoolHealthmonitor(TypedDict, total=False): """Health monitor type. Once health monitor is created, cannot be changed.""" expected_codes: Optional[str] - """Can only be used together with `HTTP` or `HTTPS` health monitor type.""" + """Expected HTTP response codes. + + Can be a single code or a range of codes. Can only be used together with `HTTP` + or `HTTPS` health monitor type. For example, + 200,202,300-302,401,403,404,500-504. If not specified, the default is 200. + """ http_method: Optional[HTTPMethod] """HTTP method. @@ -155,7 +160,7 @@ class ListenerPoolHealthmonitor(TypedDict, total=False): Can only be used together with `HTTP` or `HTTPS` health monitor type. """ - max_retries_down: Optional[int] + max_retries_down: int """Number of failures before the member is switched to ERROR state.""" url_path: Optional[str] @@ -210,7 +215,7 @@ class ListenerPoolMember(TypedDict, total=False): Either `subnet_id` or `instance_id` should be provided """ - weight: Optional[int] + weight: int """Member weight. Valid values are 0 < `weight` <= 256, defaults to 1.""" 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 04f9c452..28f38cf5 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -78,7 +78,12 @@ class Healthmonitor(TypedDict, total=False): """Health monitor type. Once health monitor is created, cannot be changed.""" expected_codes: Optional[str] - """Can only be used together with `HTTP` or `HTTPS` health monitor type.""" + """Expected HTTP response codes. + + Can be a single code or a range of codes. Can only be used together with `HTTP` + or `HTTPS` health monitor type. For example, + 200,202,300-302,401,403,404,500-504. If not specified, the default is 200. + """ http_method: Optional[HTTPMethod] """HTTP method. @@ -86,7 +91,7 @@ class Healthmonitor(TypedDict, total=False): Can only be used together with `HTTP` or `HTTPS` health monitor type. """ - max_retries_down: Optional[int] + max_retries_down: int """Number of failures before the member is switched to ERROR state.""" url_path: Optional[str] @@ -141,7 +146,7 @@ class Member(TypedDict, total=False): Either `subnet_id` or `instance_id` should be provided """ - weight: Optional[int] + weight: int """Member weight. Valid values are 0 < `weight` <= 256, defaults to 1.""" 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 3c2f530a..490b704e 100644 --- a/src/gcore/types/cloud/load_balancers/pool_update_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_update_params.py @@ -73,7 +73,12 @@ class Healthmonitor(TypedDict, total=False): """The maximum time to connect. Must be less than the delay value""" expected_codes: Optional[str] - """Can only be used together with `HTTP` or `HTTPS` health monitor type.""" + """Expected HTTP response codes. + + Can be a single code or a range of codes. Can only be used together with `HTTP` + or `HTTPS` health monitor type. For example, + 200,202,300-302,401,403,404,500-504. If not specified, the default is 200. + """ http_method: Optional[HTTPMethod] """HTTP method. @@ -81,7 +86,7 @@ class Healthmonitor(TypedDict, total=False): Can only be used together with `HTTP` or `HTTPS` health monitor type. """ - max_retries_down: Optional[int] + max_retries_down: int """Number of failures before the member is switched to ERROR state.""" type: Optional[LbHealthMonitorType] @@ -139,7 +144,7 @@ class Member(TypedDict, total=False): Either `subnet_id` or `instance_id` should be provided """ - weight: Optional[int] + weight: int """Member weight. Valid values are 0 < `weight` <= 256, defaults to 1.""" diff --git a/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py b/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py index 2f73578e..d8de1a60 100644 --- a/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py @@ -32,7 +32,12 @@ class HealthMonitorCreateParams(TypedDict, total=False): """Health monitor type. Once health monitor is created, cannot be changed.""" expected_codes: Optional[str] - """Can only be used together with `HTTP` or `HTTPS` health monitor type.""" + """Expected HTTP response codes. + + Can be a single code or a range of codes. Can only be used together with `HTTP` + or `HTTPS` health monitor type. For example, + 200,202,300-302,401,403,404,500-504. If not specified, the default is 200. + """ http_method: Optional[HTTPMethod] """HTTP method. @@ -40,7 +45,7 @@ class HealthMonitorCreateParams(TypedDict, total=False): Can only be used together with `HTTP` or `HTTPS` health monitor type. """ - max_retries_down: Optional[int] + max_retries_down: int """Number of failures before the member is switched to ERROR state.""" url_path: Optional[str] diff --git a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py index 693351e4..08af2d6c 100644 --- a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py @@ -58,5 +58,5 @@ class MemberAddParams(TypedDict, total=False): Either `subnet_id` or `instance_id` should be provided """ - weight: Optional[int] + weight: int """Member weight. Valid values are 0 < `weight` <= 256, defaults to 1.""" From 0107c4e17110fd9c8183a36317ae0c7b8ed0f8b6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Aug 2025 10:19:45 +0000 Subject: [PATCH 236/592] chore(internal): fix ruff target version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8cd76b3e..582fec8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -159,7 +159,7 @@ reportPrivateUsage = false [tool.ruff] line-length = 120 output-format = "grouped" -target-version = "py37" +target-version = "py38" [tool.ruff.format] docstring-code-format = true From 8b0e8c00878ab517f20fb897935c04f7076f6470 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Aug 2025 14:30:15 +0000 Subject: [PATCH 237/592] refactor(waap)!: refactor WAAP models --- .stats.yml | 4 +- api.md | 289 +++---- src/gcore/resources/waap/__init__.py | 14 + src/gcore/resources/waap/custom_page_sets.py | 74 +- src/gcore/resources/waap/domains/__init__.py | 42 +- .../resources/waap/domains/advanced_rules.py | 13 +- .../waap/domains/analytics/__init__.py | 33 - .../waap/domains/analytics/requests.py | 378 --------- .../{api_discovery => }/api_discovery.py | 351 +++++++-- .../waap/domains/api_discovery/__init__.py | 33 - .../domains/api_discovery/scan_results.py | 352 --------- .../resources/waap/domains/api_path_groups.py | 10 +- src/gcore/resources/waap/domains/api_paths.py | 32 +- .../resources/waap/domains/custom_rules.py | 13 +- src/gcore/resources/waap/domains/domains.py | 184 +++-- .../resources/waap/domains/firewall_rules.py | 8 +- .../waap/domains/insight_silences.py | 33 +- src/gcore/resources/waap/domains/insights.py | 46 +- src/gcore/resources/waap/domains/policies.py | 173 ----- .../{analytics/analytics.py => statistics.py} | 727 +++++++++++++----- src/gcore/resources/waap/insights.py | 233 ++++++ src/gcore/resources/waap/ip_info/__init__.py | 33 + .../resources/waap/{ => ip_info}/ip_info.py | 384 ++++----- src/gcore/resources/waap/ip_info/metrics.py | 203 +++++ src/gcore/resources/waap/waap.py | 48 +- src/gcore/types/waap/__init__.py | 60 +- .../waap/custom_page_set_create_params.py | 135 +++- .../waap/custom_page_set_preview_params.py | 15 +- .../waap/custom_page_set_update_params.py | 137 +++- src/gcore/types/waap/domain_list_params.py | 4 +- src/gcore/types/waap/domains/__init__.py | 46 +- .../waap/domains/advanced_rule_list_params.py | 4 +- .../types/waap/domains/analytics/__init__.py | 5 - .../analytics_list_event_traffic_response.py | 10 - .../waap/domains/api_discovery/__init__.py | 7 - .../scan_result_list_response.py | 29 - ...api_discovery_list_scan_results_params.py} | 4 +- .../api_discovery_update_settings_response.py | 36 - .../api_discovery_upload_openapi_response.py | 10 - .../waap/domains/api_path_create_response.py | 50 -- ...ist_response.py => api_path_group_list.py} | 4 +- .../waap/domains/api_path_list_response.py | 50 -- .../waap/domains/custom_rule_list_params.py | 4 +- .../types/waap/domains/insight_list_params.py | 22 +- .../waap/domains/insight_replace_params.py | 6 +- .../domains/insight_silence_list_params.py | 17 +- ...y => statistic_get_ddos_attacks_params.py} | 4 +- ...s.py => statistic_get_ddos_info_params.py} | 4 +- ...statistic_get_events_aggregated_params.py} | 4 +- ...> statistic_get_requests_series_params.py} | 32 +- ...=> statistic_get_traffic_series_params.py} | 9 +- .../statistic_get_traffic_series_response.py | 10 + .../waap/{ => domains}/waap_advanced_rule.py | 2 +- ...onse.py => waap_api_discovery_settings.py} | 4 +- ..._path_get_response.py => waap_api_path.py} | 4 +- ...et_response.py => waap_api_scan_result.py} | 6 +- .../{ => domains}/waap_blocked_statistics.py | 2 +- .../{ => domains}/waap_count_statistics.py | 2 +- .../waap/{ => domains}/waap_custom_rule.py | 2 +- .../waap/{ => domains}/waap_ddos_attack.py | 2 +- .../waap/{ => domains}/waap_ddos_info.py | 2 +- .../{ => domains}/waap_event_statistics.py | 2 +- .../waap/{ => domains}/waap_firewall_rule.py | 2 +- .../types/waap/{ => domains}/waap_insight.py | 6 +- .../{ => domains}/waap_insight_silence.py | 2 +- .../waap/domains/waap_request_details.py | 185 +++++ .../{ => domains}/waap_request_summary.py | 2 +- ...an_openapi_response.py => waap_task_id.py} | 4 +- .../{ => domains}/waap_traffic_metrics.py | 2 +- .../types/waap/insight_list_types_params.py | 28 + src/gcore/types/waap/ip_info/__init__.py | 6 + .../metric_list_params.py} | 4 +- .../waap/{ => ip_info}/waap_ip_info_counts.py | 2 +- ...arams.py => ip_info_get_ip_info_params.py} | 4 +- ...nfo.py => ip_info_get_ip_info_response.py} | 4 +- .../waap/ip_info_get_top_urls_response.py | 15 +- ...> ip_info_get_top_user_sessions_params.py} | 4 +- ...ip_info_get_top_user_sessions_response.py} | 4 +- .../types/waap/waap_block_csrf_page_data.py | 28 - .../waap/waap_block_csrf_page_data_param.py | 28 - src/gcore/types/waap/waap_block_page_data.py | 28 - .../types/waap/waap_block_page_data_param.py | 28 - .../types/waap/waap_captcha_page_data.py | 31 - .../waap/waap_captcha_page_data_param.py | 31 - src/gcore/types/waap/waap_common_tag.py | 16 - .../waap/waap_cookie_disabled_page_data.py | 18 - .../waap_cookie_disabled_page_data_param.py | 18 - src/gcore/types/waap/waap_custom_page_set.py | 126 ++- .../types/waap/waap_customer_rule_state.py | 7 - src/gcore/types/waap/waap_detailed_domain.py | 4 +- src/gcore/types/waap/waap_domain_policy.py | 29 - src/gcore/types/waap/waap_domain_status.py | 7 - .../types/waap/waap_handshake_page_data.py | 25 - .../waap/waap_handshake_page_data_param.py | 25 - .../waap/waap_insight_silence_sort_by.py | 9 - src/gcore/types/waap/waap_insight_sort_by.py | 20 - src/gcore/types/waap/waap_insight_status.py | 7 - src/gcore/types/waap/waap_insight_type.py | 33 + .../waap_javascript_disabled_page_data.py | 18 - ...aap_javascript_disabled_page_data_param.py | 18 - src/gcore/types/waap/waap_network_details.py | 17 - src/gcore/types/waap/waap_page_type.py | 9 - .../waap/waap_paginated_custom_page_set.py | 22 - .../types/waap/waap_paginated_ddos_attack.py | 22 - .../types/waap/waap_paginated_ddos_info.py | 22 - .../waap/waap_paginated_request_summary.py | 22 - .../types/waap/waap_pattern_matched_tag.py | 37 - src/gcore/types/waap/waap_policy_action.py | 7 - src/gcore/types/waap/waap_request_details.py | 92 --- .../types/waap/waap_request_organization.py | 13 - src/gcore/types/waap/waap_resolution.py | 7 - src/gcore/types/waap/waap_rule_action_type.py | 7 - src/gcore/types/waap/waap_rule_set.py | 29 +- src/gcore/types/waap/waap_summary_domain.py | 4 +- src/gcore/types/waap/waap_top_url.py | 13 - src/gcore/types/waap/waap_traffic_type.py | 28 - .../types/waap/waap_user_agent_details.py | 40 - .../waap/domains/analytics/test_requests.py | 216 ------ .../waap/domains/api_discovery/__init__.py | 1 - .../api_discovery/test_scan_results.py | 200 ----- .../waap/domains/test_advanced_rules.py | 8 +- .../waap/domains/test_analytics.py | 401 ---------- .../waap/domains/test_api_discovery.py | 232 +++++- .../waap/domains/test_api_path_groups.py | 14 +- .../waap/domains/test_api_paths.py | 50 +- .../waap/domains/test_custom_rules.py | 8 +- .../waap/domains/test_firewall_rules.py | 4 +- .../waap/domains/test_insight_silences.py | 4 +- .../waap/domains/test_insights.py | 2 +- .../waap/domains/test_policies.py | 108 --- .../waap/domains/test_statistics.py | 595 ++++++++++++++ .../analytics => ip_info}/__init__.py | 0 .../waap/ip_info/test_metrics.py | 102 +++ tests/api_resources/waap/test_domains.py | 85 ++ tests/api_resources/waap/test_insights.py | 99 +++ tests/api_resources/waap/test_ip_info.py | 245 ++---- 136 files changed, 3931 insertions(+), 4118 deletions(-) delete mode 100644 src/gcore/resources/waap/domains/analytics/__init__.py delete mode 100644 src/gcore/resources/waap/domains/analytics/requests.py rename src/gcore/resources/waap/domains/{api_discovery => }/api_discovery.py (63%) delete mode 100644 src/gcore/resources/waap/domains/api_discovery/__init__.py delete mode 100644 src/gcore/resources/waap/domains/api_discovery/scan_results.py delete mode 100644 src/gcore/resources/waap/domains/policies.py rename src/gcore/resources/waap/domains/{analytics/analytics.py => statistics.py} (52%) create mode 100644 src/gcore/resources/waap/insights.py create mode 100644 src/gcore/resources/waap/ip_info/__init__.py rename src/gcore/resources/waap/{ => ip_info}/ip_info.py (82%) create mode 100644 src/gcore/resources/waap/ip_info/metrics.py delete mode 100644 src/gcore/types/waap/domains/analytics/__init__.py delete mode 100644 src/gcore/types/waap/domains/analytics_list_event_traffic_response.py delete mode 100644 src/gcore/types/waap/domains/api_discovery/__init__.py delete mode 100644 src/gcore/types/waap/domains/api_discovery/scan_result_list_response.py rename src/gcore/types/waap/domains/{api_discovery/scan_result_list_params.py => api_discovery_list_scan_results_params.py} (89%) delete mode 100644 src/gcore/types/waap/domains/api_discovery_update_settings_response.py delete mode 100644 src/gcore/types/waap/domains/api_discovery_upload_openapi_response.py delete mode 100644 src/gcore/types/waap/domains/api_path_create_response.py rename src/gcore/types/waap/domains/{api_path_group_list_response.py => api_path_group_list.py} (74%) delete mode 100644 src/gcore/types/waap/domains/api_path_list_response.py rename src/gcore/types/waap/domains/{analytics_list_ddos_attacks_params.py => statistic_get_ddos_attacks_params.py} (88%) rename src/gcore/types/waap/domains/{analytics_list_ddos_info_params.py => statistic_get_ddos_info_params.py} (89%) rename src/gcore/types/waap/domains/{analytics_get_event_statistics_params.py => statistic_get_events_aggregated_params.py} (90%) rename src/gcore/types/waap/domains/{analytics/request_list_params.py => statistic_get_requests_series_params.py} (65%) rename src/gcore/types/waap/domains/{analytics_list_event_traffic_params.py => statistic_get_traffic_series_params.py} (71%) create mode 100644 src/gcore/types/waap/domains/statistic_get_traffic_series_response.py rename src/gcore/types/waap/{ => domains}/waap_advanced_rule.py (98%) rename src/gcore/types/waap/domains/{api_discovery_get_settings_response.py => waap_api_discovery_settings.py} (93%) rename src/gcore/types/waap/domains/{api_path_get_response.py => waap_api_path.py} (95%) rename src/gcore/types/waap/domains/{api_discovery/scan_result_get_response.py => waap_api_scan_result.py} (85%) rename src/gcore/types/waap/{ => domains}/waap_blocked_statistics.py (96%) rename src/gcore/types/waap/{ => domains}/waap_count_statistics.py (96%) rename src/gcore/types/waap/{ => domains}/waap_custom_rule.py (99%) rename src/gcore/types/waap/{ => domains}/waap_ddos_attack.py (91%) rename src/gcore/types/waap/{ => domains}/waap_ddos_info.py (91%) rename src/gcore/types/waap/{ => domains}/waap_event_statistics.py (93%) rename src/gcore/types/waap/{ => domains}/waap_firewall_rule.py (98%) rename src/gcore/types/waap/{ => domains}/waap_insight.py (89%) rename src/gcore/types/waap/{ => domains}/waap_insight_silence.py (95%) create mode 100644 src/gcore/types/waap/domains/waap_request_details.py rename src/gcore/types/waap/{ => domains}/waap_request_summary.py (97%) rename src/gcore/types/waap/domains/{api_discovery_scan_openapi_response.py => waap_task_id.py} (62%) rename src/gcore/types/waap/{ => domains}/waap_traffic_metrics.py (98%) create mode 100644 src/gcore/types/waap/insight_list_types_params.py create mode 100644 src/gcore/types/waap/ip_info/__init__.py rename src/gcore/types/waap/{ip_info_get_counts_params.py => ip_info/metric_list_params.py} (84%) rename src/gcore/types/waap/{ => ip_info}/waap_ip_info_counts.py (92%) rename src/gcore/types/waap/{ip_info_get_params.py => ip_info_get_ip_info_params.py} (72%) rename src/gcore/types/waap/{waap_ip_info.py => ip_info_get_ip_info_response.py} (93%) rename src/gcore/types/waap/{ip_info_get_top_sessions_params.py => ip_info_get_top_user_sessions_params.py} (80%) rename src/gcore/types/waap/{ip_info_get_top_sessions_response.py => ip_info_get_top_user_sessions_response.py} (63%) delete mode 100644 src/gcore/types/waap/waap_block_csrf_page_data.py delete mode 100644 src/gcore/types/waap/waap_block_csrf_page_data_param.py delete mode 100644 src/gcore/types/waap/waap_block_page_data.py delete mode 100644 src/gcore/types/waap/waap_block_page_data_param.py delete mode 100644 src/gcore/types/waap/waap_captcha_page_data.py delete mode 100644 src/gcore/types/waap/waap_captcha_page_data_param.py delete mode 100644 src/gcore/types/waap/waap_common_tag.py delete mode 100644 src/gcore/types/waap/waap_cookie_disabled_page_data.py delete mode 100644 src/gcore/types/waap/waap_cookie_disabled_page_data_param.py delete mode 100644 src/gcore/types/waap/waap_customer_rule_state.py delete mode 100644 src/gcore/types/waap/waap_domain_policy.py delete mode 100644 src/gcore/types/waap/waap_domain_status.py delete mode 100644 src/gcore/types/waap/waap_handshake_page_data.py delete mode 100644 src/gcore/types/waap/waap_handshake_page_data_param.py delete mode 100644 src/gcore/types/waap/waap_insight_silence_sort_by.py delete mode 100644 src/gcore/types/waap/waap_insight_sort_by.py delete mode 100644 src/gcore/types/waap/waap_insight_status.py create mode 100644 src/gcore/types/waap/waap_insight_type.py delete mode 100644 src/gcore/types/waap/waap_javascript_disabled_page_data.py delete mode 100644 src/gcore/types/waap/waap_javascript_disabled_page_data_param.py delete mode 100644 src/gcore/types/waap/waap_network_details.py delete mode 100644 src/gcore/types/waap/waap_page_type.py delete mode 100644 src/gcore/types/waap/waap_paginated_custom_page_set.py delete mode 100644 src/gcore/types/waap/waap_paginated_ddos_attack.py delete mode 100644 src/gcore/types/waap/waap_paginated_ddos_info.py delete mode 100644 src/gcore/types/waap/waap_paginated_request_summary.py delete mode 100644 src/gcore/types/waap/waap_pattern_matched_tag.py delete mode 100644 src/gcore/types/waap/waap_policy_action.py delete mode 100644 src/gcore/types/waap/waap_request_details.py delete mode 100644 src/gcore/types/waap/waap_request_organization.py delete mode 100644 src/gcore/types/waap/waap_resolution.py delete mode 100644 src/gcore/types/waap/waap_rule_action_type.py delete mode 100644 src/gcore/types/waap/waap_top_url.py delete mode 100644 src/gcore/types/waap/waap_traffic_type.py delete mode 100644 src/gcore/types/waap/waap_user_agent_details.py delete mode 100644 tests/api_resources/waap/domains/analytics/test_requests.py delete mode 100644 tests/api_resources/waap/domains/api_discovery/__init__.py delete mode 100644 tests/api_resources/waap/domains/api_discovery/test_scan_results.py delete mode 100644 tests/api_resources/waap/domains/test_analytics.py delete mode 100644 tests/api_resources/waap/domains/test_policies.py create mode 100644 tests/api_resources/waap/domains/test_statistics.py rename tests/api_resources/waap/{domains/analytics => ip_info}/__init__.py (100%) create mode 100644 tests/api_resources/waap/ip_info/test_metrics.py create mode 100644 tests/api_resources/waap/test_insights.py diff --git a/.stats.yml b/.stats.yml index 9baad3fc..752230f0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 446 +configured_endpoints: 447 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-21dade7f2034ff31578d98a7d0e769aa271906ace022862be072adc14176a108.yml openapi_spec_hash: a6b097bcb1ea27498a93ef4d26a35f90 -config_hash: 4c375f9918f360ca289733f8b3a61fbb +config_hash: df325da0df30a3d61767e7da67b6d8d4 diff --git a/api.md b/api.md index 7e793d9f..d81a3b14 100644 --- a/api.md +++ b/api.md @@ -903,73 +903,7 @@ Methods: Types: ```python -from gcore.types.waap import ( - WaapAdvancedRule, - WaapAdvancedRuleDescriptor, - WaapAdvancedRuleDescriptorList, - WaapBlockCsrfPageData, - WaapBlockPageData, - WaapBlockedStatistics, - WaapCaptchaPageData, - WaapCommonTag, - WaapCookieDisabledPageData, - WaapCountStatistics, - WaapCustomPagePreview, - WaapCustomPageSet, - WaapCustomRule, - WaapCustomerRuleState, - WaapDDOSAttack, - WaapDDOSInfo, - WaapDetailedDomain, - WaapDomainAPISettings, - WaapDomainDDOSSettings, - WaapDomainPolicy, - WaapDomainSettingsModel, - WaapDomainStatus, - WaapEventStatistics, - WaapFirewallRule, - WaapHandshakePageData, - WaapInsight, - WaapInsightSilence, - WaapInsightSilenceSortBy, - WaapInsightSortBy, - WaapInsightStatus, - WaapInsightType, - WaapIPCountryAttack, - WaapIPDDOSInfoModel, - WaapIPInfo, - WaapIPInfoCounts, - WaapJavascriptDisabledPageData, - WaapNetworkDetails, - WaapOrganization, - WaapPageType, - WaapPaginatedCustomPageSet, - WaapPaginatedDDOSAttack, - WaapPaginatedDDOSInfo, - WaapPaginatedRequestSummary, - WaapPatternMatchedTag, - WaapPolicyAction, - WaapPolicyMode, - WaapRequestDetails, - WaapRequestOrganization, - WaapRequestSummary, - WaapResolution, - WaapRuleActionType, - WaapRuleBlockedRequests, - WaapRuleSet, - WaapStatisticItem, - WaapStatisticsSeries, - WaapSummaryDomain, - WaapTag, - WaapTimeSeriesAttack, - WaapTopSession, - WaapTopURL, - WaapTopUserAgent, - WaapTrafficMetrics, - WaapTrafficType, - WaapUserAgentDetails, - WaapGetAccountOverviewResponse, -) +from gcore.types.waap import WaapGetAccountOverviewResponse ``` Methods: @@ -978,6 +912,12 @@ Methods: ## Statistics +Types: + +```python +from gcore.types.waap import WaapStatisticItem, WaapStatisticsSeries +``` + Methods: - client.waap.statistics.get_usage_series(\*\*params) -> WaapStatisticsSeries @@ -987,7 +927,16 @@ Methods: Types: ```python -from gcore.types.waap import DomainListRuleSetsResponse +from gcore.types.waap import ( + WaapDetailedDomain, + WaapDomainAPISettings, + WaapDomainDDOSSettings, + WaapDomainSettingsModel, + WaapPolicyMode, + WaapRuleSet, + WaapSummaryDomain, + DomainListRuleSetsResponse, +) ``` Methods: @@ -997,6 +946,7 @@ Methods: - client.waap.domains.delete(domain_id) -> None - client.waap.domains.get(domain_id) -> WaapDetailedDomain - client.waap.domains.list_rule_sets(domain_id) -> DomainListRuleSetsResponse +- client.waap.domains.toggle_policy(policy_id, \*, domain_id) -> WaapPolicyMode ### Settings @@ -1010,145 +960,164 @@ Methods: Types: ```python -from gcore.types.waap.domains import APIPathCreateResponse, APIPathListResponse, APIPathGetResponse +from gcore.types.waap.domains import WaapAPIPath ``` Methods: -- client.waap.domains.api_paths.create(domain_id, \*\*params) -> APIPathCreateResponse +- client.waap.domains.api_paths.create(domain_id, \*\*params) -> WaapAPIPath - client.waap.domains.api_paths.update(path_id, \*, domain_id, \*\*params) -> None -- client.waap.domains.api_paths.list(domain_id, \*\*params) -> SyncOffsetPage[APIPathListResponse] +- client.waap.domains.api_paths.list(domain_id, \*\*params) -> SyncOffsetPage[WaapAPIPath] - client.waap.domains.api_paths.delete(path_id, \*, domain_id) -> None -- client.waap.domains.api_paths.get(path_id, \*, domain_id) -> APIPathGetResponse +- client.waap.domains.api_paths.get(path_id, \*, domain_id) -> WaapAPIPath ### APIPathGroups Types: ```python -from gcore.types.waap.domains import APIPathGroupListResponse +from gcore.types.waap.domains import APIPathGroupList ``` Methods: -- client.waap.domains.api_path_groups.list(domain_id) -> APIPathGroupListResponse +- client.waap.domains.api_path_groups.list(domain_id) -> APIPathGroupList ### APIDiscovery Types: ```python -from gcore.types.waap.domains import ( - APIDiscoveryGetSettingsResponse, - APIDiscoveryScanOpenAPIResponse, - APIDiscoveryUpdateSettingsResponse, - APIDiscoveryUploadOpenAPIResponse, -) +from gcore.types.waap.domains import WaapAPIDiscoverySettings, WaapAPIScanResult, WaapTaskID ``` Methods: -- client.waap.domains.api_discovery.get_settings(domain_id) -> APIDiscoveryGetSettingsResponse -- client.waap.domains.api_discovery.scan_openapi(domain_id) -> APIDiscoveryScanOpenAPIResponse -- client.waap.domains.api_discovery.update_settings(domain_id, \*\*params) -> APIDiscoveryUpdateSettingsResponse -- client.waap.domains.api_discovery.upload_openapi(domain_id, \*\*params) -> APIDiscoveryUploadOpenAPIResponse +- client.waap.domains.api_discovery.get_scan_result(scan_id, \*, domain_id) -> WaapAPIScanResult +- client.waap.domains.api_discovery.get_settings(domain_id) -> WaapAPIDiscoverySettings +- client.waap.domains.api_discovery.list_scan_results(domain_id, \*\*params) -> SyncOffsetPage[WaapAPIScanResult] +- client.waap.domains.api_discovery.scan_openapi(domain_id) -> WaapTaskID +- client.waap.domains.api_discovery.update_settings(domain_id, \*\*params) -> WaapAPIDiscoverySettings +- client.waap.domains.api_discovery.upload_openapi(domain_id, \*\*params) -> WaapTaskID -#### ScanResults +### Insights Types: ```python -from gcore.types.waap.domains.api_discovery import ScanResultListResponse, ScanResultGetResponse +from gcore.types.waap.domains import WaapInsight ``` Methods: -- client.waap.domains.api_discovery.scan_results.list(domain_id, \*\*params) -> SyncOffsetPage[ScanResultListResponse] -- client.waap.domains.api_discovery.scan_results.get(scan_id, \*, domain_id) -> ScanResultGetResponse - -### Insights - -Methods: - -- client.waap.domains.insights.list(domain_id, \*\*params) -> SyncOffsetPage[WaapInsight] -- client.waap.domains.insights.get(insight_id, \*, domain_id) -> WaapInsight -- client.waap.domains.insights.replace(insight_id, \*, domain_id, \*\*params) -> WaapInsight +- client.waap.domains.insights.list(domain_id, \*\*params) -> SyncOffsetPage[WaapInsight] +- client.waap.domains.insights.get(insight_id, \*, domain_id) -> WaapInsight +- client.waap.domains.insights.replace(insight_id, \*, domain_id, \*\*params) -> WaapInsight ### InsightSilences -Methods: - -- client.waap.domains.insight_silences.create(domain_id, \*\*params) -> WaapInsightSilence -- client.waap.domains.insight_silences.update(silence_id, \*, domain_id, \*\*params) -> WaapInsightSilence -- client.waap.domains.insight_silences.list(domain_id, \*\*params) -> SyncOffsetPage[WaapInsightSilence] -- client.waap.domains.insight_silences.delete(silence_id, \*, domain_id) -> None -- client.waap.domains.insight_silences.get(silence_id, \*, domain_id) -> WaapInsightSilence +Types: -### Policies +```python +from gcore.types.waap.domains import WaapInsightSilence +``` Methods: -- client.waap.domains.policies.toggle(policy_id, \*, domain_id) -> WaapPolicyMode +- client.waap.domains.insight_silences.create(domain_id, \*\*params) -> WaapInsightSilence +- client.waap.domains.insight_silences.update(silence_id, \*, domain_id, \*\*params) -> WaapInsightSilence +- client.waap.domains.insight_silences.list(domain_id, \*\*params) -> SyncOffsetPage[WaapInsightSilence] +- client.waap.domains.insight_silences.delete(silence_id, \*, domain_id) -> None +- client.waap.domains.insight_silences.get(silence_id, \*, domain_id) -> WaapInsightSilence -### Analytics +### Statistics Types: ```python -from gcore.types.waap.domains import AnalyticsListEventTrafficResponse +from gcore.types.waap.domains import ( + WaapBlockedStatistics, + WaapCountStatistics, + WaapDDOSAttack, + WaapDDOSInfo, + WaapEventStatistics, + WaapRequestDetails, + WaapRequestSummary, + WaapTrafficMetrics, + StatisticGetTrafficSeriesResponse, +) ``` Methods: -- client.waap.domains.analytics.get_event_statistics(domain_id, \*\*params) -> WaapEventStatistics -- client.waap.domains.analytics.list_ddos_attacks(domain_id, \*\*params) -> SyncOffsetPage[WaapDDOSAttack] -- client.waap.domains.analytics.list_ddos_info(domain_id, \*\*params) -> SyncOffsetPage[WaapDDOSInfo] -- client.waap.domains.analytics.list_event_traffic(domain_id, \*\*params) -> AnalyticsListEventTrafficResponse +- client.waap.domains.statistics.get_ddos_attacks(domain_id, \*\*params) -> SyncOffsetPage[WaapDDOSAttack] +- client.waap.domains.statistics.get_ddos_info(domain_id, \*\*params) -> SyncOffsetPage[WaapDDOSInfo] +- client.waap.domains.statistics.get_events_aggregated(domain_id, \*\*params) -> WaapEventStatistics +- client.waap.domains.statistics.get_request_details(request_id, \*, domain_id) -> WaapRequestDetails +- client.waap.domains.statistics.get_requests_series(domain_id, \*\*params) -> SyncOffsetPage[WaapRequestSummary] +- client.waap.domains.statistics.get_traffic_series(domain_id, \*\*params) -> StatisticGetTrafficSeriesResponse -#### Requests - -Methods: +### CustomRules -- client.waap.domains.analytics.requests.list(domain_id, \*\*params) -> SyncOffsetPage[WaapRequestSummary] -- client.waap.domains.analytics.requests.get(request_id, \*, domain_id) -> WaapRequestDetails +Types: -### CustomRules +```python +from gcore.types.waap.domains import WaapCustomRule +``` Methods: -- client.waap.domains.custom_rules.create(domain_id, \*\*params) -> WaapCustomRule +- client.waap.domains.custom_rules.create(domain_id, \*\*params) -> WaapCustomRule - client.waap.domains.custom_rules.update(rule_id, \*, domain_id, \*\*params) -> None -- client.waap.domains.custom_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapCustomRule] +- client.waap.domains.custom_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapCustomRule] - client.waap.domains.custom_rules.delete(rule_id, \*, domain_id) -> None - client.waap.domains.custom_rules.delete_multiple(domain_id, \*\*params) -> None -- client.waap.domains.custom_rules.get(rule_id, \*, domain_id) -> WaapCustomRule +- client.waap.domains.custom_rules.get(rule_id, \*, domain_id) -> WaapCustomRule - client.waap.domains.custom_rules.toggle(action, \*, domain_id, rule_id) -> None ### FirewallRules +Types: + +```python +from gcore.types.waap.domains import WaapFirewallRule +``` + Methods: -- client.waap.domains.firewall_rules.create(domain_id, \*\*params) -> WaapFirewallRule +- client.waap.domains.firewall_rules.create(domain_id, \*\*params) -> WaapFirewallRule - client.waap.domains.firewall_rules.update(rule_id, \*, domain_id, \*\*params) -> None -- client.waap.domains.firewall_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapFirewallRule] +- client.waap.domains.firewall_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapFirewallRule] - client.waap.domains.firewall_rules.delete(rule_id, \*, domain_id) -> None - client.waap.domains.firewall_rules.delete_multiple(domain_id, \*\*params) -> None -- client.waap.domains.firewall_rules.get(rule_id, \*, domain_id) -> WaapFirewallRule +- client.waap.domains.firewall_rules.get(rule_id, \*, domain_id) -> WaapFirewallRule - client.waap.domains.firewall_rules.toggle(action, \*, domain_id, rule_id) -> None ### AdvancedRules +Types: + +```python +from gcore.types.waap.domains import WaapAdvancedRule +``` + Methods: -- client.waap.domains.advanced_rules.create(domain_id, \*\*params) -> WaapAdvancedRule +- client.waap.domains.advanced_rules.create(domain_id, \*\*params) -> WaapAdvancedRule - client.waap.domains.advanced_rules.update(rule_id, \*, domain_id, \*\*params) -> None -- client.waap.domains.advanced_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapAdvancedRule] +- client.waap.domains.advanced_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapAdvancedRule] - client.waap.domains.advanced_rules.delete(rule_id, \*, domain_id) -> None -- client.waap.domains.advanced_rules.get(rule_id, \*, domain_id) -> WaapAdvancedRule +- client.waap.domains.advanced_rules.get(rule_id, \*, domain_id) -> WaapAdvancedRule - client.waap.domains.advanced_rules.toggle(action, \*, domain_id, rule_id) -> None ## CustomPageSets +Types: + +```python +from gcore.types.waap import WaapCustomPagePreview, WaapCustomPageSet +``` + Methods: - client.waap.custom_page_sets.create(\*\*params) -> WaapCustomPageSet @@ -1160,48 +1129,96 @@ Methods: ## AdvancedRules +Types: + +```python +from gcore.types.waap import WaapAdvancedRuleDescriptor, WaapAdvancedRuleDescriptorList +``` + Methods: - client.waap.advanced_rules.list() -> WaapAdvancedRuleDescriptorList ## Tags +Types: + +```python +from gcore.types.waap import WaapTag +``` + Methods: - client.waap.tags.list(\*\*params) -> SyncOffsetPage[WaapTag] ## Organizations +Types: + +```python +from gcore.types.waap import WaapOrganization +``` + Methods: - client.waap.organizations.list(\*\*params) -> SyncOffsetPage[WaapOrganization] +## Insights + +Types: + +```python +from gcore.types.waap import WaapInsightType +``` + +Methods: + +- client.waap.insights.list_types(\*\*params) -> SyncOffsetPage[WaapInsightType] + ## IPInfo Types: ```python from gcore.types.waap import ( + WaapIPCountryAttack, + WaapIPDDOSInfoModel, + WaapRuleBlockedRequests, + WaapTimeSeriesAttack, + WaapTopSession, + WaapTopUserAgent, IPInfoGetAttackTimeSeriesResponse, IPInfoGetBlockedRequestsResponse, - IPInfoGetTopSessionsResponse, + IPInfoGetIPInfoResponse, IPInfoGetTopURLsResponse, IPInfoGetTopUserAgentsResponse, + IPInfoGetTopUserSessionsResponse, IPInfoListAttackedCountriesResponse, ) ``` Methods: -- client.waap.ip_info.get(\*\*params) -> WaapIPInfo -- client.waap.ip_info.get_attack_time_series(\*\*params) -> IPInfoGetAttackTimeSeriesResponse -- client.waap.ip_info.get_blocked_requests(\*\*params) -> IPInfoGetBlockedRequestsResponse -- client.waap.ip_info.get_counts(\*\*params) -> WaapIPInfoCounts -- client.waap.ip_info.get_ddos_attack_series(\*\*params) -> WaapIPDDOSInfoModel -- client.waap.ip_info.get_top_sessions(\*\*params) -> IPInfoGetTopSessionsResponse -- client.waap.ip_info.get_top_urls(\*\*params) -> IPInfoGetTopURLsResponse -- client.waap.ip_info.get_top_user_agents(\*\*params) -> IPInfoGetTopUserAgentsResponse -- client.waap.ip_info.list_attacked_countries(\*\*params) -> IPInfoListAttackedCountriesResponse +- client.waap.ip_info.get_attack_time_series(\*\*params) -> IPInfoGetAttackTimeSeriesResponse +- client.waap.ip_info.get_blocked_requests(\*\*params) -> IPInfoGetBlockedRequestsResponse +- client.waap.ip_info.get_ddos_attack_series(\*\*params) -> WaapIPDDOSInfoModel +- client.waap.ip_info.get_ip_info(\*\*params) -> IPInfoGetIPInfoResponse +- client.waap.ip_info.get_top_urls(\*\*params) -> IPInfoGetTopURLsResponse +- client.waap.ip_info.get_top_user_agents(\*\*params) -> IPInfoGetTopUserAgentsResponse +- client.waap.ip_info.get_top_user_sessions(\*\*params) -> IPInfoGetTopUserSessionsResponse +- client.waap.ip_info.list_attacked_countries(\*\*params) -> IPInfoListAttackedCountriesResponse + +### Metrics + +Types: + +```python +from gcore.types.waap.ip_info import WaapIPInfoCounts +``` + +Methods: + +- client.waap.ip_info.metrics.list(\*\*params) -> WaapIPInfoCounts # Iam diff --git a/src/gcore/resources/waap/__init__.py b/src/gcore/resources/waap/__init__.py index f5020fdf..cb4dfc95 100644 --- a/src/gcore/resources/waap/__init__.py +++ b/src/gcore/resources/waap/__init__.py @@ -32,6 +32,14 @@ IPInfoResourceWithStreamingResponse, AsyncIPInfoResourceWithStreamingResponse, ) +from .insights import ( + InsightsResource, + AsyncInsightsResource, + InsightsResourceWithRawResponse, + AsyncInsightsResourceWithRawResponse, + InsightsResourceWithStreamingResponse, + AsyncInsightsResourceWithStreamingResponse, +) from .statistics import ( StatisticsResource, AsyncStatisticsResource, @@ -102,6 +110,12 @@ "AsyncOrganizationsResourceWithRawResponse", "OrganizationsResourceWithStreamingResponse", "AsyncOrganizationsResourceWithStreamingResponse", + "InsightsResource", + "AsyncInsightsResource", + "InsightsResourceWithRawResponse", + "AsyncInsightsResourceWithRawResponse", + "InsightsResourceWithStreamingResponse", + "AsyncInsightsResourceWithStreamingResponse", "IPInfoResource", "AsyncIPInfoResource", "IPInfoResourceWithRawResponse", diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index ad77a395..7ce6dca4 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -19,22 +19,14 @@ ) from ...pagination import SyncOffsetPage, AsyncOffsetPage from ...types.waap import ( - WaapPageType, custom_page_set_list_params, custom_page_set_create_params, custom_page_set_update_params, custom_page_set_preview_params, ) from ..._base_client import AsyncPaginator, make_request_options -from ...types.waap.waap_page_type import WaapPageType from ...types.waap.waap_custom_page_set import WaapCustomPageSet from ...types.waap.waap_custom_page_preview import WaapCustomPagePreview -from ...types.waap.waap_block_page_data_param import WaapBlockPageDataParam -from ...types.waap.waap_captcha_page_data_param import WaapCaptchaPageDataParam -from ...types.waap.waap_handshake_page_data_param import WaapHandshakePageDataParam -from ...types.waap.waap_block_csrf_page_data_param import WaapBlockCsrfPageDataParam -from ...types.waap.waap_cookie_disabled_page_data_param import WaapCookieDisabledPageDataParam -from ...types.waap.waap_javascript_disabled_page_data_param import WaapJavascriptDisabledPageDataParam __all__ = ["CustomPageSetsResource", "AsyncCustomPageSetsResource"] @@ -63,13 +55,13 @@ def create( self, *, name: str, - block: Optional[WaapBlockPageDataParam] | NotGiven = NOT_GIVEN, - block_csrf: Optional[WaapBlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, - captcha: Optional[WaapCaptchaPageDataParam] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[WaapCookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, + block: Optional[custom_page_set_create_params.Block] | NotGiven = NOT_GIVEN, + block_csrf: Optional[custom_page_set_create_params.BlockCsrf] | NotGiven = NOT_GIVEN, + captcha: Optional[custom_page_set_create_params.Captcha] | NotGiven = NOT_GIVEN, + cookie_disabled: Optional[custom_page_set_create_params.CookieDisabled] | NotGiven = NOT_GIVEN, domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[WaapHandshakePageDataParam] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[WaapJavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, + handshake: Optional[custom_page_set_create_params.Handshake] | NotGiven = NOT_GIVEN, + javascript_disabled: Optional[custom_page_set_create_params.JavascriptDisabled] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -120,13 +112,13 @@ def update( self, set_id: int, *, - block: Optional[WaapBlockPageDataParam] | NotGiven = NOT_GIVEN, - block_csrf: Optional[WaapBlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, - captcha: Optional[WaapCaptchaPageDataParam] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[WaapCookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, + block: Optional[custom_page_set_update_params.Block] | NotGiven = NOT_GIVEN, + block_csrf: Optional[custom_page_set_update_params.BlockCsrf] | NotGiven = NOT_GIVEN, + captcha: Optional[custom_page_set_update_params.Captcha] | NotGiven = NOT_GIVEN, + cookie_disabled: Optional[custom_page_set_update_params.CookieDisabled] | NotGiven = NOT_GIVEN, domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[WaapHandshakePageDataParam] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[WaapJavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, + handshake: Optional[custom_page_set_update_params.Handshake] | NotGiven = NOT_GIVEN, + javascript_disabled: Optional[custom_page_set_update_params.JavascriptDisabled] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -309,7 +301,14 @@ def get( def preview( self, *, - page_type: WaapPageType, + page_type: Literal[ + "block.html", + "block_csrf.html", + "captcha.html", + "cookieDisabled.html", + "handshake.html", + "javascriptDisabled.html", + ], error: Optional[str] | NotGiven = NOT_GIVEN, header: Optional[str] | NotGiven = NOT_GIVEN, logo: Optional[str] | NotGiven = NOT_GIVEN, @@ -398,13 +397,13 @@ async def create( self, *, name: str, - block: Optional[WaapBlockPageDataParam] | NotGiven = NOT_GIVEN, - block_csrf: Optional[WaapBlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, - captcha: Optional[WaapCaptchaPageDataParam] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[WaapCookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, + block: Optional[custom_page_set_create_params.Block] | NotGiven = NOT_GIVEN, + block_csrf: Optional[custom_page_set_create_params.BlockCsrf] | NotGiven = NOT_GIVEN, + captcha: Optional[custom_page_set_create_params.Captcha] | NotGiven = NOT_GIVEN, + cookie_disabled: Optional[custom_page_set_create_params.CookieDisabled] | NotGiven = NOT_GIVEN, domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[WaapHandshakePageDataParam] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[WaapJavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, + handshake: Optional[custom_page_set_create_params.Handshake] | NotGiven = NOT_GIVEN, + javascript_disabled: Optional[custom_page_set_create_params.JavascriptDisabled] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -455,13 +454,13 @@ async def update( self, set_id: int, *, - block: Optional[WaapBlockPageDataParam] | NotGiven = NOT_GIVEN, - block_csrf: Optional[WaapBlockCsrfPageDataParam] | NotGiven = NOT_GIVEN, - captcha: Optional[WaapCaptchaPageDataParam] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[WaapCookieDisabledPageDataParam] | NotGiven = NOT_GIVEN, + block: Optional[custom_page_set_update_params.Block] | NotGiven = NOT_GIVEN, + block_csrf: Optional[custom_page_set_update_params.BlockCsrf] | NotGiven = NOT_GIVEN, + captcha: Optional[custom_page_set_update_params.Captcha] | NotGiven = NOT_GIVEN, + cookie_disabled: Optional[custom_page_set_update_params.CookieDisabled] | NotGiven = NOT_GIVEN, domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[WaapHandshakePageDataParam] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[WaapJavascriptDisabledPageDataParam] | NotGiven = NOT_GIVEN, + handshake: Optional[custom_page_set_update_params.Handshake] | NotGiven = NOT_GIVEN, + javascript_disabled: Optional[custom_page_set_update_params.JavascriptDisabled] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -644,7 +643,14 @@ async def get( async def preview( self, *, - page_type: WaapPageType, + page_type: Literal[ + "block.html", + "block_csrf.html", + "captcha.html", + "cookieDisabled.html", + "handshake.html", + "javascriptDisabled.html", + ], error: Optional[str] | NotGiven = NOT_GIVEN, header: Optional[str] | NotGiven = NOT_GIVEN, logo: Optional[str] | NotGiven = NOT_GIVEN, diff --git a/src/gcore/resources/waap/domains/__init__.py b/src/gcore/resources/waap/domains/__init__.py index dda4fef7..33cc8323 100644 --- a/src/gcore/resources/waap/domains/__init__.py +++ b/src/gcore/resources/waap/domains/__init__.py @@ -16,14 +16,6 @@ InsightsResourceWithStreamingResponse, AsyncInsightsResourceWithStreamingResponse, ) -from .policies import ( - PoliciesResource, - AsyncPoliciesResource, - PoliciesResourceWithRawResponse, - AsyncPoliciesResourceWithRawResponse, - PoliciesResourceWithStreamingResponse, - AsyncPoliciesResourceWithStreamingResponse, -) from .settings import ( SettingsResource, AsyncSettingsResource, @@ -32,14 +24,6 @@ SettingsResourceWithStreamingResponse, AsyncSettingsResourceWithStreamingResponse, ) -from .analytics import ( - AnalyticsResource, - AsyncAnalyticsResource, - AnalyticsResourceWithRawResponse, - AsyncAnalyticsResourceWithRawResponse, - AnalyticsResourceWithStreamingResponse, - AsyncAnalyticsResourceWithStreamingResponse, -) from .api_paths import ( APIPathsResource, AsyncAPIPathsResource, @@ -48,6 +32,14 @@ APIPathsResourceWithStreamingResponse, AsyncAPIPathsResourceWithStreamingResponse, ) +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) from .custom_rules import ( CustomRulesResource, AsyncCustomRulesResource, @@ -134,18 +126,12 @@ "AsyncInsightSilencesResourceWithRawResponse", "InsightSilencesResourceWithStreamingResponse", "AsyncInsightSilencesResourceWithStreamingResponse", - "PoliciesResource", - "AsyncPoliciesResource", - "PoliciesResourceWithRawResponse", - "AsyncPoliciesResourceWithRawResponse", - "PoliciesResourceWithStreamingResponse", - "AsyncPoliciesResourceWithStreamingResponse", - "AnalyticsResource", - "AsyncAnalyticsResource", - "AnalyticsResourceWithRawResponse", - "AsyncAnalyticsResourceWithRawResponse", - "AnalyticsResourceWithStreamingResponse", - "AsyncAnalyticsResourceWithStreamingResponse", + "StatisticsResource", + "AsyncStatisticsResource", + "StatisticsResourceWithRawResponse", + "AsyncStatisticsResourceWithRawResponse", + "StatisticsResourceWithStreamingResponse", + "AsyncStatisticsResourceWithStreamingResponse", "CustomRulesResource", "AsyncCustomRulesResource", "CustomRulesResourceWithRawResponse", diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index 6f4ff363..75992d93 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -18,12 +18,9 @@ async_to_streamed_response_wrapper, ) from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.waap import WaapRuleActionType, WaapCustomerRuleState from ...._base_client import AsyncPaginator, make_request_options from ....types.waap.domains import advanced_rule_list_params, advanced_rule_create_params, advanced_rule_update_params -from ....types.waap.waap_advanced_rule import WaapAdvancedRule -from ....types.waap.waap_rule_action_type import WaapRuleActionType -from ....types.waap.waap_customer_rule_state import WaapCustomerRuleState +from ....types.waap.domains.waap_advanced_rule import WaapAdvancedRule __all__ = ["AdvancedRulesResource", "AsyncAdvancedRulesResource"] @@ -196,7 +193,7 @@ def list( self, domain_id: int, *, - action: WaapRuleActionType | NotGiven = NOT_GIVEN, + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, @@ -363,7 +360,7 @@ def get( def toggle( self, - action: WaapCustomerRuleState, + action: Literal["enable", "disable"], *, domain_id: int, rule_id: int, @@ -572,7 +569,7 @@ def list( self, domain_id: int, *, - action: WaapRuleActionType | NotGiven = NOT_GIVEN, + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, @@ -739,7 +736,7 @@ async def get( async def toggle( self, - action: WaapCustomerRuleState, + action: Literal["enable", "disable"], *, domain_id: int, rule_id: int, diff --git a/src/gcore/resources/waap/domains/analytics/__init__.py b/src/gcore/resources/waap/domains/analytics/__init__.py deleted file mode 100644 index b52f6c07..00000000 --- a/src/gcore/resources/waap/domains/analytics/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .requests import ( - RequestsResource, - AsyncRequestsResource, - RequestsResourceWithRawResponse, - AsyncRequestsResourceWithRawResponse, - RequestsResourceWithStreamingResponse, - AsyncRequestsResourceWithStreamingResponse, -) -from .analytics import ( - AnalyticsResource, - AsyncAnalyticsResource, - AnalyticsResourceWithRawResponse, - AsyncAnalyticsResourceWithRawResponse, - AnalyticsResourceWithStreamingResponse, - AsyncAnalyticsResourceWithStreamingResponse, -) - -__all__ = [ - "RequestsResource", - "AsyncRequestsResource", - "RequestsResourceWithRawResponse", - "AsyncRequestsResourceWithRawResponse", - "RequestsResourceWithStreamingResponse", - "AsyncRequestsResourceWithStreamingResponse", - "AnalyticsResource", - "AsyncAnalyticsResource", - "AnalyticsResourceWithRawResponse", - "AsyncAnalyticsResourceWithRawResponse", - "AnalyticsResourceWithStreamingResponse", - "AsyncAnalyticsResourceWithStreamingResponse", -] diff --git a/src/gcore/resources/waap/domains/analytics/requests.py b/src/gcore/resources/waap/domains/analytics/requests.py deleted file mode 100644 index ef0acc00..00000000 --- a/src/gcore/resources/waap/domains/analytics/requests.py +++ /dev/null @@ -1,378 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union -from datetime import datetime -from typing_extensions import Literal - -import httpx - -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import maybe_transform -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .....pagination import SyncOffsetPage, AsyncOffsetPage -from ....._base_client import AsyncPaginator, make_request_options -from .....types.waap.domains.analytics import request_list_params -from .....types.waap.waap_traffic_type import WaapTrafficType -from .....types.waap.waap_request_details import WaapRequestDetails -from .....types.waap.waap_request_summary import WaapRequestSummary - -__all__ = ["RequestsResource", "AsyncRequestsResource"] - - -class RequestsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> RequestsResourceWithRawResponse: - """ - 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 RequestsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RequestsResourceWithStreamingResponse: - """ - 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 RequestsResourceWithStreamingResponse(self) - - def list( - self, - domain_id: int, - *, - start: Union[str, datetime], - actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, - countries: List[str] | NotGiven = NOT_GIVEN, - end: Union[str, datetime] | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: str | NotGiven = NOT_GIVEN, - reference_id: str | NotGiven = NOT_GIVEN, - security_rule_name: str | NotGiven = NOT_GIVEN, - status_code: int | NotGiven = NOT_GIVEN, - traffic_types: List[WaapTrafficType] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[WaapRequestSummary]: - """ - Retrieve a domain's requests data. - - Args: - domain_id: The domain ID - - start: Filter traffic starting from a specified date in ISO 8601 format - - actions: Filter the response by actions. - - countries: Filter the response by country codes in ISO 3166-1 alpha-2 format. - - end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, - defaults to the current date and time. - - ip: Filter the response by IP. - - limit: Number of items to return - - offset: Number of items to skip - - ordering: Sort the response by given field. - - reference_id: Filter the response by reference ID. - - security_rule_name: Filter the response by security rule name. - - status_code: Filter the response by response code. - - traffic_types: Filter the response by traffic types. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests", - page=SyncOffsetPage[WaapRequestSummary], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "start": start, - "actions": actions, - "countries": countries, - "end": end, - "ip": ip, - "limit": limit, - "offset": offset, - "ordering": ordering, - "reference_id": reference_id, - "security_rule_name": security_rule_name, - "status_code": status_code, - "traffic_types": traffic_types, - }, - request_list_params.RequestListParams, - ), - ), - model=WaapRequestSummary, - ) - - def get( - self, - request_id: str, - *, - domain_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, - ) -> WaapRequestDetails: - """ - Retrieves all the available information for a request that matches a given - request id - - Args: - domain_id: The domain ID - - request_id: The request ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not request_id: - raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") - return self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapRequestDetails, - ) - - -class AsyncRequestsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncRequestsResourceWithRawResponse: - """ - 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 AsyncRequestsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRequestsResourceWithStreamingResponse: - """ - 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 AsyncRequestsResourceWithStreamingResponse(self) - - def list( - self, - domain_id: int, - *, - start: Union[str, datetime], - actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, - countries: List[str] | NotGiven = NOT_GIVEN, - end: Union[str, datetime] | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: str | NotGiven = NOT_GIVEN, - reference_id: str | NotGiven = NOT_GIVEN, - security_rule_name: str | NotGiven = NOT_GIVEN, - status_code: int | NotGiven = NOT_GIVEN, - traffic_types: List[WaapTrafficType] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[WaapRequestSummary, AsyncOffsetPage[WaapRequestSummary]]: - """ - Retrieve a domain's requests data. - - Args: - domain_id: The domain ID - - start: Filter traffic starting from a specified date in ISO 8601 format - - actions: Filter the response by actions. - - countries: Filter the response by country codes in ISO 3166-1 alpha-2 format. - - end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, - defaults to the current date and time. - - ip: Filter the response by IP. - - limit: Number of items to return - - offset: Number of items to skip - - ordering: Sort the response by given field. - - reference_id: Filter the response by reference ID. - - security_rule_name: Filter the response by security rule name. - - status_code: Filter the response by response code. - - traffic_types: Filter the response by traffic types. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests", - page=AsyncOffsetPage[WaapRequestSummary], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "start": start, - "actions": actions, - "countries": countries, - "end": end, - "ip": ip, - "limit": limit, - "offset": offset, - "ordering": ordering, - "reference_id": reference_id, - "security_rule_name": security_rule_name, - "status_code": status_code, - "traffic_types": traffic_types, - }, - request_list_params.RequestListParams, - ), - ), - model=WaapRequestSummary, - ) - - async def get( - self, - request_id: str, - *, - domain_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, - ) -> WaapRequestDetails: - """ - Retrieves all the available information for a request that matches a given - request id - - Args: - domain_id: The domain ID - - request_id: The request ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not request_id: - raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") - return await self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapRequestDetails, - ) - - -class RequestsResourceWithRawResponse: - def __init__(self, requests: RequestsResource) -> None: - self._requests = requests - - self.list = to_raw_response_wrapper( - requests.list, - ) - self.get = to_raw_response_wrapper( - requests.get, - ) - - -class AsyncRequestsResourceWithRawResponse: - def __init__(self, requests: AsyncRequestsResource) -> None: - self._requests = requests - - self.list = async_to_raw_response_wrapper( - requests.list, - ) - self.get = async_to_raw_response_wrapper( - requests.get, - ) - - -class RequestsResourceWithStreamingResponse: - def __init__(self, requests: RequestsResource) -> None: - self._requests = requests - - self.list = to_streamed_response_wrapper( - requests.list, - ) - self.get = to_streamed_response_wrapper( - requests.get, - ) - - -class AsyncRequestsResourceWithStreamingResponse: - def __init__(self, requests: AsyncRequestsResource) -> None: - self._requests = requests - - self.list = async_to_streamed_response_wrapper( - requests.list, - ) - self.get = async_to_streamed_response_wrapper( - requests.get, - ) diff --git a/src/gcore/resources/waap/domains/api_discovery/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py similarity index 63% rename from src/gcore/resources/waap/domains/api_discovery/api_discovery.py rename to src/gcore/resources/waap/domains/api_discovery.py index 08614a31..6b1f7896 100644 --- a/src/gcore/resources/waap/domains/api_discovery/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -3,42 +3,35 @@ from __future__ import annotations from typing import Optional +from typing_extensions import Literal import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import maybe_transform, async_maybe_transform -from ....._compat import cached_property -from .scan_results import ( - ScanResultsResource, - AsyncScanResultsResource, - ScanResultsResourceWithRawResponse, - AsyncScanResultsResourceWithRawResponse, - ScanResultsResourceWithStreamingResponse, - AsyncScanResultsResourceWithStreamingResponse, -) -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....._base_client import make_request_options -from .....types.waap.domains import api_discovery_upload_openapi_params, api_discovery_update_settings_params -from .....types.waap.domains.api_discovery_get_settings_response import APIDiscoveryGetSettingsResponse -from .....types.waap.domains.api_discovery_scan_openapi_response import APIDiscoveryScanOpenAPIResponse -from .....types.waap.domains.api_discovery_upload_openapi_response import APIDiscoveryUploadOpenAPIResponse -from .....types.waap.domains.api_discovery_update_settings_response import APIDiscoveryUpdateSettingsResponse +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.waap.domains import ( + api_discovery_upload_openapi_params, + api_discovery_update_settings_params, + api_discovery_list_scan_results_params, +) +from ....types.waap.domains.waap_task_id import WaapTaskID +from ....types.waap.domains.waap_api_scan_result import WaapAPIScanResult +from ....types.waap.domains.waap_api_discovery_settings import WaapAPIDiscoverySettings __all__ = ["APIDiscoveryResource", "AsyncAPIDiscoveryResource"] class APIDiscoveryResource(SyncAPIResource): - @cached_property - def scan_results(self) -> ScanResultsResource: - return ScanResultsResource(self._client) - @cached_property def with_raw_response(self) -> APIDiscoveryResourceWithRawResponse: """ @@ -58,6 +51,44 @@ def with_streaming_response(self) -> APIDiscoveryResourceWithStreamingResponse: """ return APIDiscoveryResourceWithStreamingResponse(self) + def get_scan_result( + self, + scan_id: str, + *, + domain_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, + ) -> WaapAPIScanResult: + """ + Get Scan Result + + Args: + domain_id: The domain ID + + scan_id: The scan ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not scan_id: + raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") + return self._get( + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapAPIScanResult, + ) + def get_settings( self, domain_id: int, @@ -68,7 +99,7 @@ def get_settings( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIDiscoveryGetSettingsResponse: + ) -> WaapAPIDiscoverySettings: """ Retrieve the API discovery settings for a domain @@ -88,7 +119,87 @@ def get_settings( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIDiscoveryGetSettingsResponse, + cast_to=WaapAPIDiscoverySettings, + ) + + def list_scan_results( + self, + domain_id: int, + *, + limit: int | NotGiven = NOT_GIVEN, + message: Optional[str] | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal[ + "id", + "type", + "start_time", + "end_time", + "status", + "message", + "-id", + "-type", + "-start_time", + "-end_time", + "-status", + "-message", + ] + | NotGiven = NOT_GIVEN, + status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | NotGiven = NOT_GIVEN, + type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[WaapAPIScanResult]: + """ + Get Scan Results + + Args: + domain_id: The domain ID + + limit: Number of items to return + + message: Filter by the message of the scan. Supports '\\**' as a wildcard character + + offset: Number of items to skip + + ordering: Sort the response by given field. + + status: The different statuses a task result can have + + type: The different types of scans that can be performed + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + page=SyncOffsetPage[WaapAPIScanResult], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "message": message, + "offset": offset, + "ordering": ordering, + "status": status, + "type": type, + }, + api_discovery_list_scan_results_params.APIDiscoveryListScanResultsParams, + ), + ), + model=WaapAPIScanResult, ) def scan_openapi( @@ -101,7 +212,7 @@ def scan_openapi( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIDiscoveryScanOpenAPIResponse: + ) -> WaapTaskID: """Scan an API description file hosted online. The file must be in YAML or JSON @@ -124,7 +235,7 @@ def scan_openapi( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIDiscoveryScanOpenAPIResponse, + cast_to=WaapTaskID, ) def update_settings( @@ -142,7 +253,7 @@ def update_settings( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIDiscoveryUpdateSettingsResponse: + ) -> WaapAPIDiscoverySettings: """ Update the API discovery settings for a domain @@ -184,7 +295,7 @@ def update_settings( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIDiscoveryUpdateSettingsResponse, + cast_to=WaapAPIDiscoverySettings, ) def upload_openapi( @@ -199,7 +310,7 @@ def upload_openapi( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIDiscoveryUploadOpenAPIResponse: + ) -> WaapTaskID: """ An API description file must adhere to the OpenAPI specification and be written in YAML or JSON format. The file name should be provided as the value for the @@ -234,15 +345,11 @@ def upload_openapi( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIDiscoveryUploadOpenAPIResponse, + cast_to=WaapTaskID, ) class AsyncAPIDiscoveryResource(AsyncAPIResource): - @cached_property - def scan_results(self) -> AsyncScanResultsResource: - return AsyncScanResultsResource(self._client) - @cached_property def with_raw_response(self) -> AsyncAPIDiscoveryResourceWithRawResponse: """ @@ -262,6 +369,44 @@ def with_streaming_response(self) -> AsyncAPIDiscoveryResourceWithStreamingRespo """ return AsyncAPIDiscoveryResourceWithStreamingResponse(self) + async def get_scan_result( + self, + scan_id: str, + *, + domain_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, + ) -> WaapAPIScanResult: + """ + Get Scan Result + + Args: + domain_id: The domain ID + + scan_id: The scan ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not scan_id: + raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") + return await self._get( + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapAPIScanResult, + ) + async def get_settings( self, domain_id: int, @@ -272,7 +417,7 @@ async def get_settings( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIDiscoveryGetSettingsResponse: + ) -> WaapAPIDiscoverySettings: """ Retrieve the API discovery settings for a domain @@ -292,7 +437,87 @@ async def get_settings( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIDiscoveryGetSettingsResponse, + cast_to=WaapAPIDiscoverySettings, + ) + + def list_scan_results( + self, + domain_id: int, + *, + limit: int | NotGiven = NOT_GIVEN, + message: Optional[str] | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal[ + "id", + "type", + "start_time", + "end_time", + "status", + "message", + "-id", + "-type", + "-start_time", + "-end_time", + "-status", + "-message", + ] + | NotGiven = NOT_GIVEN, + status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | NotGiven = NOT_GIVEN, + type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[WaapAPIScanResult, AsyncOffsetPage[WaapAPIScanResult]]: + """ + Get Scan Results + + Args: + domain_id: The domain ID + + limit: Number of items to return + + message: Filter by the message of the scan. Supports '\\**' as a wildcard character + + offset: Number of items to skip + + ordering: Sort the response by given field. + + status: The different statuses a task result can have + + type: The different types of scans that can be performed + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + page=AsyncOffsetPage[WaapAPIScanResult], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "message": message, + "offset": offset, + "ordering": ordering, + "status": status, + "type": type, + }, + api_discovery_list_scan_results_params.APIDiscoveryListScanResultsParams, + ), + ), + model=WaapAPIScanResult, ) async def scan_openapi( @@ -305,7 +530,7 @@ async def scan_openapi( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIDiscoveryScanOpenAPIResponse: + ) -> WaapTaskID: """Scan an API description file hosted online. The file must be in YAML or JSON @@ -328,7 +553,7 @@ async def scan_openapi( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIDiscoveryScanOpenAPIResponse, + cast_to=WaapTaskID, ) async def update_settings( @@ -346,7 +571,7 @@ async def update_settings( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIDiscoveryUpdateSettingsResponse: + ) -> WaapAPIDiscoverySettings: """ Update the API discovery settings for a domain @@ -388,7 +613,7 @@ async def update_settings( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIDiscoveryUpdateSettingsResponse, + cast_to=WaapAPIDiscoverySettings, ) async def upload_openapi( @@ -403,7 +628,7 @@ async def upload_openapi( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIDiscoveryUploadOpenAPIResponse: + ) -> WaapTaskID: """ An API description file must adhere to the OpenAPI specification and be written in YAML or JSON format. The file name should be provided as the value for the @@ -438,7 +663,7 @@ async def upload_openapi( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIDiscoveryUploadOpenAPIResponse, + cast_to=WaapTaskID, ) @@ -446,9 +671,15 @@ class APIDiscoveryResourceWithRawResponse: def __init__(self, api_discovery: APIDiscoveryResource) -> None: self._api_discovery = api_discovery + self.get_scan_result = to_raw_response_wrapper( + api_discovery.get_scan_result, + ) self.get_settings = to_raw_response_wrapper( api_discovery.get_settings, ) + self.list_scan_results = to_raw_response_wrapper( + api_discovery.list_scan_results, + ) self.scan_openapi = to_raw_response_wrapper( api_discovery.scan_openapi, ) @@ -459,18 +690,20 @@ def __init__(self, api_discovery: APIDiscoveryResource) -> None: api_discovery.upload_openapi, ) - @cached_property - def scan_results(self) -> ScanResultsResourceWithRawResponse: - return ScanResultsResourceWithRawResponse(self._api_discovery.scan_results) - class AsyncAPIDiscoveryResourceWithRawResponse: def __init__(self, api_discovery: AsyncAPIDiscoveryResource) -> None: self._api_discovery = api_discovery + self.get_scan_result = async_to_raw_response_wrapper( + api_discovery.get_scan_result, + ) self.get_settings = async_to_raw_response_wrapper( api_discovery.get_settings, ) + self.list_scan_results = async_to_raw_response_wrapper( + api_discovery.list_scan_results, + ) self.scan_openapi = async_to_raw_response_wrapper( api_discovery.scan_openapi, ) @@ -481,18 +714,20 @@ def __init__(self, api_discovery: AsyncAPIDiscoveryResource) -> None: api_discovery.upload_openapi, ) - @cached_property - def scan_results(self) -> AsyncScanResultsResourceWithRawResponse: - return AsyncScanResultsResourceWithRawResponse(self._api_discovery.scan_results) - class APIDiscoveryResourceWithStreamingResponse: def __init__(self, api_discovery: APIDiscoveryResource) -> None: self._api_discovery = api_discovery + self.get_scan_result = to_streamed_response_wrapper( + api_discovery.get_scan_result, + ) self.get_settings = to_streamed_response_wrapper( api_discovery.get_settings, ) + self.list_scan_results = to_streamed_response_wrapper( + api_discovery.list_scan_results, + ) self.scan_openapi = to_streamed_response_wrapper( api_discovery.scan_openapi, ) @@ -503,18 +738,20 @@ def __init__(self, api_discovery: APIDiscoveryResource) -> None: api_discovery.upload_openapi, ) - @cached_property - def scan_results(self) -> ScanResultsResourceWithStreamingResponse: - return ScanResultsResourceWithStreamingResponse(self._api_discovery.scan_results) - class AsyncAPIDiscoveryResourceWithStreamingResponse: def __init__(self, api_discovery: AsyncAPIDiscoveryResource) -> None: self._api_discovery = api_discovery + self.get_scan_result = async_to_streamed_response_wrapper( + api_discovery.get_scan_result, + ) self.get_settings = async_to_streamed_response_wrapper( api_discovery.get_settings, ) + self.list_scan_results = async_to_streamed_response_wrapper( + api_discovery.list_scan_results, + ) self.scan_openapi = async_to_streamed_response_wrapper( api_discovery.scan_openapi, ) @@ -524,7 +761,3 @@ def __init__(self, api_discovery: AsyncAPIDiscoveryResource) -> None: self.upload_openapi = async_to_streamed_response_wrapper( api_discovery.upload_openapi, ) - - @cached_property - def scan_results(self) -> AsyncScanResultsResourceWithStreamingResponse: - return AsyncScanResultsResourceWithStreamingResponse(self._api_discovery.scan_results) diff --git a/src/gcore/resources/waap/domains/api_discovery/__init__.py b/src/gcore/resources/waap/domains/api_discovery/__init__.py deleted file mode 100644 index 481daf30..00000000 --- a/src/gcore/resources/waap/domains/api_discovery/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .scan_results import ( - ScanResultsResource, - AsyncScanResultsResource, - ScanResultsResourceWithRawResponse, - AsyncScanResultsResourceWithRawResponse, - ScanResultsResourceWithStreamingResponse, - AsyncScanResultsResourceWithStreamingResponse, -) -from .api_discovery import ( - APIDiscoveryResource, - AsyncAPIDiscoveryResource, - APIDiscoveryResourceWithRawResponse, - AsyncAPIDiscoveryResourceWithRawResponse, - APIDiscoveryResourceWithStreamingResponse, - AsyncAPIDiscoveryResourceWithStreamingResponse, -) - -__all__ = [ - "ScanResultsResource", - "AsyncScanResultsResource", - "ScanResultsResourceWithRawResponse", - "AsyncScanResultsResourceWithRawResponse", - "ScanResultsResourceWithStreamingResponse", - "AsyncScanResultsResourceWithStreamingResponse", - "APIDiscoveryResource", - "AsyncAPIDiscoveryResource", - "APIDiscoveryResourceWithRawResponse", - "AsyncAPIDiscoveryResourceWithRawResponse", - "APIDiscoveryResourceWithStreamingResponse", - "AsyncAPIDiscoveryResourceWithStreamingResponse", -] diff --git a/src/gcore/resources/waap/domains/api_discovery/scan_results.py b/src/gcore/resources/waap/domains/api_discovery/scan_results.py deleted file mode 100644 index 8e8888fc..00000000 --- a/src/gcore/resources/waap/domains/api_discovery/scan_results.py +++ /dev/null @@ -1,352 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Literal - -import httpx - -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import maybe_transform -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .....pagination import SyncOffsetPage, AsyncOffsetPage -from ....._base_client import AsyncPaginator, make_request_options -from .....types.waap.domains.api_discovery import scan_result_list_params -from .....types.waap.domains.api_discovery.scan_result_get_response import ScanResultGetResponse -from .....types.waap.domains.api_discovery.scan_result_list_response import ScanResultListResponse - -__all__ = ["ScanResultsResource", "AsyncScanResultsResource"] - - -class ScanResultsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ScanResultsResourceWithRawResponse: - """ - 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 ScanResultsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ScanResultsResourceWithStreamingResponse: - """ - 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 ScanResultsResourceWithStreamingResponse(self) - - def list( - self, - domain_id: int, - *, - limit: int | NotGiven = NOT_GIVEN, - message: Optional[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal[ - "id", - "type", - "start_time", - "end_time", - "status", - "message", - "-id", - "-type", - "-start_time", - "-end_time", - "-status", - "-message", - ] - | NotGiven = NOT_GIVEN, - status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | NotGiven = NOT_GIVEN, - type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[ScanResultListResponse]: - """ - Get Scan Results - - Args: - domain_id: The domain ID - - limit: Number of items to return - - message: Filter by the message of the scan. Supports '\\**' as a wildcard character - - offset: Number of items to skip - - ordering: Sort the response by given field. - - status: The different statuses a task result can have - - type: The different types of scans that can be performed - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", - page=SyncOffsetPage[ScanResultListResponse], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "limit": limit, - "message": message, - "offset": offset, - "ordering": ordering, - "status": status, - "type": type, - }, - scan_result_list_params.ScanResultListParams, - ), - ), - model=ScanResultListResponse, - ) - - def get( - self, - scan_id: str, - *, - domain_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, - ) -> ScanResultGetResponse: - """ - Get Scan Result - - Args: - domain_id: The domain ID - - scan_id: The scan ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not scan_id: - raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") - return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ScanResultGetResponse, - ) - - -class AsyncScanResultsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncScanResultsResourceWithRawResponse: - """ - 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 AsyncScanResultsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncScanResultsResourceWithStreamingResponse: - """ - 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 AsyncScanResultsResourceWithStreamingResponse(self) - - def list( - self, - domain_id: int, - *, - limit: int | NotGiven = NOT_GIVEN, - message: Optional[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal[ - "id", - "type", - "start_time", - "end_time", - "status", - "message", - "-id", - "-type", - "-start_time", - "-end_time", - "-status", - "-message", - ] - | NotGiven = NOT_GIVEN, - status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | NotGiven = NOT_GIVEN, - type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ScanResultListResponse, AsyncOffsetPage[ScanResultListResponse]]: - """ - Get Scan Results - - Args: - domain_id: The domain ID - - limit: Number of items to return - - message: Filter by the message of the scan. Supports '\\**' as a wildcard character - - offset: Number of items to skip - - ordering: Sort the response by given field. - - status: The different statuses a task result can have - - type: The different types of scans that can be performed - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", - page=AsyncOffsetPage[ScanResultListResponse], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "limit": limit, - "message": message, - "offset": offset, - "ordering": ordering, - "status": status, - "type": type, - }, - scan_result_list_params.ScanResultListParams, - ), - ), - model=ScanResultListResponse, - ) - - async def get( - self, - scan_id: str, - *, - domain_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, - ) -> ScanResultGetResponse: - """ - Get Scan Result - - Args: - domain_id: The domain ID - - scan_id: The scan ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not scan_id: - raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") - return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ScanResultGetResponse, - ) - - -class ScanResultsResourceWithRawResponse: - def __init__(self, scan_results: ScanResultsResource) -> None: - self._scan_results = scan_results - - self.list = to_raw_response_wrapper( - scan_results.list, - ) - self.get = to_raw_response_wrapper( - scan_results.get, - ) - - -class AsyncScanResultsResourceWithRawResponse: - def __init__(self, scan_results: AsyncScanResultsResource) -> None: - self._scan_results = scan_results - - self.list = async_to_raw_response_wrapper( - scan_results.list, - ) - self.get = async_to_raw_response_wrapper( - scan_results.get, - ) - - -class ScanResultsResourceWithStreamingResponse: - def __init__(self, scan_results: ScanResultsResource) -> None: - self._scan_results = scan_results - - self.list = to_streamed_response_wrapper( - scan_results.list, - ) - self.get = to_streamed_response_wrapper( - scan_results.get, - ) - - -class AsyncScanResultsResourceWithStreamingResponse: - def __init__(self, scan_results: AsyncScanResultsResource) -> None: - self._scan_results = scan_results - - self.list = async_to_streamed_response_wrapper( - scan_results.list, - ) - self.get = async_to_streamed_response_wrapper( - scan_results.get, - ) diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py index 74b54e4e..3e66ea27 100644 --- a/src/gcore/resources/waap/domains/api_path_groups.py +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -14,7 +14,7 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.waap.domains.api_path_group_list_response import APIPathGroupListResponse +from ....types.waap.domains.api_path_group_list import APIPathGroupList __all__ = ["APIPathGroupsResource", "AsyncAPIPathGroupsResource"] @@ -49,7 +49,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIPathGroupListResponse: + ) -> APIPathGroupList: """ Retrieve a list of API path groups for a specific domain @@ -69,7 +69,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIPathGroupListResponse, + cast_to=APIPathGroupList, ) @@ -103,7 +103,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIPathGroupListResponse: + ) -> APIPathGroupList: """ Retrieve a list of API path groups for a specific domain @@ -123,7 +123,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIPathGroupListResponse, + cast_to=APIPathGroupList, ) diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index 11cbcb8a..70381593 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -20,9 +20,7 @@ from ....pagination import SyncOffsetPage, AsyncOffsetPage from ...._base_client import AsyncPaginator, make_request_options from ....types.waap.domains import api_path_list_params, api_path_create_params, api_path_update_params -from ....types.waap.domains.api_path_get_response import APIPathGetResponse -from ....types.waap.domains.api_path_list_response import APIPathListResponse -from ....types.waap.domains.api_path_create_response import APIPathCreateResponse +from ....types.waap.domains.waap_api_path import WaapAPIPath __all__ = ["APIPathsResource", "AsyncAPIPathsResource"] @@ -63,7 +61,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIPathCreateResponse: + ) -> WaapAPIPath: """ Create an API path for a domain @@ -107,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=APIPathCreateResponse, + cast_to=WaapAPIPath, ) def update( @@ -214,7 +212,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[APIPathListResponse]: + ) -> SyncOffsetPage[WaapAPIPath]: """ Retrieve a list of API paths for a specific domain @@ -253,7 +251,7 @@ def list( """ return self._get_api_list( f"/waap/v1/domains/{domain_id}/api-paths", - page=SyncOffsetPage[APIPathListResponse], + page=SyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -276,7 +274,7 @@ def list( api_path_list_params.APIPathListParams, ), ), - model=APIPathListResponse, + model=WaapAPIPath, ) def delete( @@ -329,7 +327,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIPathGetResponse: + ) -> WaapAPIPath: """ Retrieve a specific API path for a domain @@ -353,7 +351,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIPathGetResponse, + cast_to=WaapAPIPath, ) @@ -393,7 +391,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIPathCreateResponse: + ) -> WaapAPIPath: """ Create an API path for a domain @@ -437,7 +435,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIPathCreateResponse, + cast_to=WaapAPIPath, ) async def update( @@ -544,7 +542,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[APIPathListResponse, AsyncOffsetPage[APIPathListResponse]]: + ) -> AsyncPaginator[WaapAPIPath, AsyncOffsetPage[WaapAPIPath]]: """ Retrieve a list of API paths for a specific domain @@ -583,7 +581,7 @@ def list( """ return self._get_api_list( f"/waap/v1/domains/{domain_id}/api-paths", - page=AsyncOffsetPage[APIPathListResponse], + page=AsyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -606,7 +604,7 @@ def list( api_path_list_params.APIPathListParams, ), ), - model=APIPathListResponse, + model=WaapAPIPath, ) async def delete( @@ -659,7 +657,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIPathGetResponse: + ) -> WaapAPIPath: """ Retrieve a specific API path for a domain @@ -683,7 +681,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APIPathGetResponse, + cast_to=WaapAPIPath, ) diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index 0cd83bc6..4a5acac5 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -18,7 +18,6 @@ async_to_streamed_response_wrapper, ) from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.waap import WaapRuleActionType, WaapCustomerRuleState from ...._base_client import AsyncPaginator, make_request_options from ....types.waap.domains import ( custom_rule_list_params, @@ -26,9 +25,7 @@ custom_rule_update_params, custom_rule_delete_multiple_params, ) -from ....types.waap.waap_custom_rule import WaapCustomRule -from ....types.waap.waap_rule_action_type import WaapRuleActionType -from ....types.waap.waap_customer_rule_state import WaapCustomerRuleState +from ....types.waap.domains.waap_custom_rule import WaapCustomRule __all__ = ["CustomRulesResource", "AsyncCustomRulesResource"] @@ -179,7 +176,7 @@ def list( self, domain_id: int, *, - action: WaapRuleActionType | NotGiven = NOT_GIVEN, + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, @@ -366,7 +363,7 @@ def get( def toggle( self, - action: WaapCustomerRuleState, + action: Literal["enable", "disable"], *, domain_id: int, rule_id: int, @@ -553,7 +550,7 @@ def list( self, domain_id: int, *, - action: WaapRuleActionType | NotGiven = NOT_GIVEN, + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, @@ -740,7 +737,7 @@ async def get( async def toggle( self, - action: WaapCustomerRuleState, + action: Literal["enable", "disable"], *, domain_id: int, rule_id: int, diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index 6a6acd31..ad004706 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -15,14 +15,6 @@ InsightsResourceWithStreamingResponse, AsyncInsightsResourceWithStreamingResponse, ) -from .policies import ( - PoliciesResource, - AsyncPoliciesResource, - PoliciesResourceWithRawResponse, - AsyncPoliciesResourceWithRawResponse, - PoliciesResourceWithStreamingResponse, - AsyncPoliciesResourceWithStreamingResponse, -) from .settings import ( SettingsResource, AsyncSettingsResource, @@ -42,6 +34,14 @@ AsyncAPIPathsResourceWithStreamingResponse, ) from ...._compat import cached_property +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( to_raw_response_wrapper, @@ -58,7 +58,15 @@ AsyncCustomRulesResourceWithStreamingResponse, ) from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.waap import WaapDomainStatus, domain_list_params, domain_update_params +from ....types.waap import domain_list_params, domain_update_params +from .api_discovery import ( + APIDiscoveryResource, + AsyncAPIDiscoveryResource, + APIDiscoveryResourceWithRawResponse, + AsyncAPIDiscoveryResourceWithRawResponse, + APIDiscoveryResourceWithStreamingResponse, + AsyncAPIDiscoveryResourceWithStreamingResponse, +) from .advanced_rules import ( AdvancedRulesResource, AsyncAdvancedRulesResource, @@ -92,23 +100,7 @@ InsightSilencesResourceWithStreamingResponse, AsyncInsightSilencesResourceWithStreamingResponse, ) -from .analytics.analytics import ( - AnalyticsResource, - AsyncAnalyticsResource, - AnalyticsResourceWithRawResponse, - AsyncAnalyticsResourceWithRawResponse, - AnalyticsResourceWithStreamingResponse, - AsyncAnalyticsResourceWithStreamingResponse, -) -from .api_discovery.api_discovery import ( - APIDiscoveryResource, - AsyncAPIDiscoveryResource, - APIDiscoveryResourceWithRawResponse, - AsyncAPIDiscoveryResourceWithRawResponse, - APIDiscoveryResourceWithStreamingResponse, - AsyncAPIDiscoveryResourceWithStreamingResponse, -) -from ....types.waap.waap_domain_status import WaapDomainStatus +from ....types.waap.waap_policy_mode import WaapPolicyMode from ....types.waap.waap_summary_domain import WaapSummaryDomain from ....types.waap.waap_detailed_domain import WaapDetailedDomain from ....types.waap.domain_list_rule_sets_response import DomainListRuleSetsResponse @@ -142,12 +134,8 @@ def insight_silences(self) -> InsightSilencesResource: return InsightSilencesResource(self._client) @cached_property - def policies(self) -> PoliciesResource: - return PoliciesResource(self._client) - - @cached_property - def analytics(self) -> AnalyticsResource: - return AnalyticsResource(self._client) + def statistics(self) -> StatisticsResource: + return StatisticsResource(self._client) @cached_property def custom_rules(self) -> CustomRulesResource: @@ -227,7 +215,7 @@ def list( offset: int | NotGiven = NOT_GIVEN, ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] | NotGiven = NOT_GIVEN, - status: WaapDomainStatus | NotGiven = NOT_GIVEN, + status: Literal["active", "bypass", "monitor", "locked"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -384,6 +372,44 @@ def list_rule_sets( cast_to=DomainListRuleSetsResponse, ) + def toggle_policy( + self, + policy_id: str, + *, + domain_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, + ) -> WaapPolicyMode: + """ + Modify the activation state of a policy associated with a domain + + Args: + domain_id: The domain ID + + policy_id: The ID of the policy to toggle + + 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 policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") + return self._patch( + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapPolicyMode, + ) + class AsyncDomainsResource(AsyncAPIResource): @cached_property @@ -411,12 +437,8 @@ def insight_silences(self) -> AsyncInsightSilencesResource: return AsyncInsightSilencesResource(self._client) @cached_property - def policies(self) -> AsyncPoliciesResource: - return AsyncPoliciesResource(self._client) - - @cached_property - def analytics(self) -> AsyncAnalyticsResource: - return AsyncAnalyticsResource(self._client) + def statistics(self) -> AsyncStatisticsResource: + return AsyncStatisticsResource(self._client) @cached_property def custom_rules(self) -> AsyncCustomRulesResource: @@ -496,7 +518,7 @@ def list( offset: int | NotGiven = NOT_GIVEN, ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] | NotGiven = NOT_GIVEN, - status: WaapDomainStatus | NotGiven = NOT_GIVEN, + status: Literal["active", "bypass", "monitor", "locked"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -653,6 +675,44 @@ async def list_rule_sets( cast_to=DomainListRuleSetsResponse, ) + async def toggle_policy( + self, + policy_id: str, + *, + domain_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, + ) -> WaapPolicyMode: + """ + Modify the activation state of a policy associated with a domain + + Args: + domain_id: The domain ID + + policy_id: The ID of the policy to toggle + + 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 policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") + return await self._patch( + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapPolicyMode, + ) + class DomainsResourceWithRawResponse: def __init__(self, domains: DomainsResource) -> None: @@ -673,6 +733,9 @@ def __init__(self, domains: DomainsResource) -> None: self.list_rule_sets = to_raw_response_wrapper( domains.list_rule_sets, ) + self.toggle_policy = to_raw_response_wrapper( + domains.toggle_policy, + ) @cached_property def settings(self) -> SettingsResourceWithRawResponse: @@ -699,12 +762,8 @@ def insight_silences(self) -> InsightSilencesResourceWithRawResponse: return InsightSilencesResourceWithRawResponse(self._domains.insight_silences) @cached_property - def policies(self) -> PoliciesResourceWithRawResponse: - return PoliciesResourceWithRawResponse(self._domains.policies) - - @cached_property - def analytics(self) -> AnalyticsResourceWithRawResponse: - return AnalyticsResourceWithRawResponse(self._domains.analytics) + def statistics(self) -> StatisticsResourceWithRawResponse: + return StatisticsResourceWithRawResponse(self._domains.statistics) @cached_property def custom_rules(self) -> CustomRulesResourceWithRawResponse: @@ -738,6 +797,9 @@ def __init__(self, domains: AsyncDomainsResource) -> None: self.list_rule_sets = async_to_raw_response_wrapper( domains.list_rule_sets, ) + self.toggle_policy = async_to_raw_response_wrapper( + domains.toggle_policy, + ) @cached_property def settings(self) -> AsyncSettingsResourceWithRawResponse: @@ -764,12 +826,8 @@ def insight_silences(self) -> AsyncInsightSilencesResourceWithRawResponse: return AsyncInsightSilencesResourceWithRawResponse(self._domains.insight_silences) @cached_property - def policies(self) -> AsyncPoliciesResourceWithRawResponse: - return AsyncPoliciesResourceWithRawResponse(self._domains.policies) - - @cached_property - def analytics(self) -> AsyncAnalyticsResourceWithRawResponse: - return AsyncAnalyticsResourceWithRawResponse(self._domains.analytics) + def statistics(self) -> AsyncStatisticsResourceWithRawResponse: + return AsyncStatisticsResourceWithRawResponse(self._domains.statistics) @cached_property def custom_rules(self) -> AsyncCustomRulesResourceWithRawResponse: @@ -803,6 +861,9 @@ def __init__(self, domains: DomainsResource) -> None: self.list_rule_sets = to_streamed_response_wrapper( domains.list_rule_sets, ) + self.toggle_policy = to_streamed_response_wrapper( + domains.toggle_policy, + ) @cached_property def settings(self) -> SettingsResourceWithStreamingResponse: @@ -829,12 +890,8 @@ def insight_silences(self) -> InsightSilencesResourceWithStreamingResponse: return InsightSilencesResourceWithStreamingResponse(self._domains.insight_silences) @cached_property - def policies(self) -> PoliciesResourceWithStreamingResponse: - return PoliciesResourceWithStreamingResponse(self._domains.policies) - - @cached_property - def analytics(self) -> AnalyticsResourceWithStreamingResponse: - return AnalyticsResourceWithStreamingResponse(self._domains.analytics) + def statistics(self) -> StatisticsResourceWithStreamingResponse: + return StatisticsResourceWithStreamingResponse(self._domains.statistics) @cached_property def custom_rules(self) -> CustomRulesResourceWithStreamingResponse: @@ -868,6 +925,9 @@ def __init__(self, domains: AsyncDomainsResource) -> None: self.list_rule_sets = async_to_streamed_response_wrapper( domains.list_rule_sets, ) + self.toggle_policy = async_to_streamed_response_wrapper( + domains.toggle_policy, + ) @cached_property def settings(self) -> AsyncSettingsResourceWithStreamingResponse: @@ -894,12 +954,8 @@ def insight_silences(self) -> AsyncInsightSilencesResourceWithStreamingResponse: return AsyncInsightSilencesResourceWithStreamingResponse(self._domains.insight_silences) @cached_property - def policies(self) -> AsyncPoliciesResourceWithStreamingResponse: - return AsyncPoliciesResourceWithStreamingResponse(self._domains.policies) - - @cached_property - def analytics(self) -> AsyncAnalyticsResourceWithStreamingResponse: - return AsyncAnalyticsResourceWithStreamingResponse(self._domains.analytics) + def statistics(self) -> AsyncStatisticsResourceWithStreamingResponse: + return AsyncStatisticsResourceWithStreamingResponse(self._domains.statistics) @cached_property def custom_rules(self) -> AsyncCustomRulesResourceWithStreamingResponse: diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index a9de049a..90bbe131 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -18,7 +18,6 @@ async_to_streamed_response_wrapper, ) from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.waap import WaapCustomerRuleState from ...._base_client import AsyncPaginator, make_request_options from ....types.waap.domains import ( firewall_rule_list_params, @@ -26,8 +25,7 @@ firewall_rule_update_params, firewall_rule_delete_multiple_params, ) -from ....types.waap.waap_firewall_rule import WaapFirewallRule -from ....types.waap.waap_customer_rule_state import WaapCustomerRuleState +from ....types.waap.domains.waap_firewall_rule import WaapFirewallRule __all__ = ["FirewallRulesResource", "AsyncFirewallRulesResource"] @@ -363,7 +361,7 @@ def get( def toggle( self, - action: WaapCustomerRuleState, + action: Literal["enable", "disable"], *, domain_id: int, rule_id: int, @@ -735,7 +733,7 @@ async def get( async def toggle( self, - action: WaapCustomerRuleState, + action: Literal["enable", "disable"], *, domain_id: int, rule_id: int, diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 5c7f7e14..151e3d04 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -4,6 +4,7 @@ from typing import Dict, List, Union, Optional from datetime import datetime +from typing_extensions import Literal import httpx @@ -18,15 +19,13 @@ async_to_streamed_response_wrapper, ) from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.waap import WaapInsightSilenceSortBy from ...._base_client import AsyncPaginator, make_request_options from ....types.waap.domains import ( insight_silence_list_params, insight_silence_create_params, insight_silence_update_params, ) -from ....types.waap.waap_insight_silence import WaapInsightSilence -from ....types.waap.waap_insight_silence_sort_by import WaapInsightSilenceSortBy +from ....types.waap.domains.waap_insight_silence import WaapInsightSilence __all__ = ["InsightSilencesResource", "AsyncInsightSilencesResource"] @@ -180,7 +179,19 @@ def list( insight_type: Optional[List[str]] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - ordering: WaapInsightSilenceSortBy | NotGiven = NOT_GIVEN, + ordering: Literal[ + "id", + "-id", + "insight_type", + "-insight_type", + "comment", + "-comment", + "author", + "-author", + "expire_at", + "-expire_at", + ] + | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -467,7 +478,19 @@ def list( insight_type: Optional[List[str]] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - ordering: WaapInsightSilenceSortBy | NotGiven = NOT_GIVEN, + ordering: Literal[ + "id", + "-id", + "insight_type", + "-insight_type", + "comment", + "-comment", + "author", + "-author", + "expire_at", + "-expire_at", + ] + | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 29bbe1b5..fcd628e4 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import List, Optional +from typing_extensions import Literal import httpx @@ -17,12 +18,9 @@ async_to_streamed_response_wrapper, ) from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.waap import WaapInsightSortBy, WaapInsightStatus from ...._base_client import AsyncPaginator, make_request_options from ....types.waap.domains import insight_list_params, insight_replace_params -from ....types.waap.waap_insight import WaapInsight -from ....types.waap.waap_insight_status import WaapInsightStatus -from ....types.waap.waap_insight_sort_by import WaapInsightSortBy +from ....types.waap.domains.waap_insight import WaapInsight __all__ = ["InsightsResource", "AsyncInsightsResource"] @@ -56,8 +54,22 @@ def list( insight_type: Optional[List[str]] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - ordering: WaapInsightSortBy | NotGiven = NOT_GIVEN, - status: Optional[List[WaapInsightStatus]] | NotGiven = NOT_GIVEN, + ordering: Literal[ + "id", + "-id", + "insight_type", + "-insight_type", + "first_seen", + "-first_seen", + "last_seen", + "-last_seen", + "last_status_change", + "-last_status_change", + "status", + "-status", + ] + | NotGiven = NOT_GIVEN, + status: Optional[List[Literal["OPEN", "ACKED", "CLOSED"]]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -158,7 +170,7 @@ def replace( insight_id: str, *, domain_id: int, - status: WaapInsightStatus, + status: Literal["OPEN", "ACKED", "CLOSED"], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -225,8 +237,22 @@ def list( insight_type: Optional[List[str]] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - ordering: WaapInsightSortBy | NotGiven = NOT_GIVEN, - status: Optional[List[WaapInsightStatus]] | NotGiven = NOT_GIVEN, + ordering: Literal[ + "id", + "-id", + "insight_type", + "-insight_type", + "first_seen", + "-first_seen", + "last_seen", + "-last_seen", + "last_status_change", + "-last_status_change", + "status", + "-status", + ] + | NotGiven = NOT_GIVEN, + status: Optional[List[Literal["OPEN", "ACKED", "CLOSED"]]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -327,7 +353,7 @@ async def replace( insight_id: str, *, domain_id: int, - status: WaapInsightStatus, + status: Literal["OPEN", "ACKED", "CLOSED"], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/waap/domains/policies.py b/src/gcore/resources/waap/domains/policies.py deleted file mode 100644 index bf9eeca9..00000000 --- a/src/gcore/resources/waap/domains/policies.py +++ /dev/null @@ -1,173 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.waap.waap_policy_mode import WaapPolicyMode - -__all__ = ["PoliciesResource", "AsyncPoliciesResource"] - - -class PoliciesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> PoliciesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers - """ - return PoliciesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response - """ - return PoliciesResourceWithStreamingResponse(self) - - def toggle( - self, - policy_id: str, - *, - domain_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, - ) -> WaapPolicyMode: - """ - Modify the activation state of a policy associated with a domain - - Args: - domain_id: The domain ID - - policy_id: The ID of the policy to toggle - - 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 policy_id: - raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") - return self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapPolicyMode, - ) - - -class AsyncPoliciesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers - """ - return AsyncPoliciesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response - """ - return AsyncPoliciesResourceWithStreamingResponse(self) - - async def toggle( - self, - policy_id: str, - *, - domain_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, - ) -> WaapPolicyMode: - """ - Modify the activation state of a policy associated with a domain - - Args: - domain_id: The domain ID - - policy_id: The ID of the policy to toggle - - 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 policy_id: - raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") - return await self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapPolicyMode, - ) - - -class PoliciesResourceWithRawResponse: - def __init__(self, policies: PoliciesResource) -> None: - self._policies = policies - - self.toggle = to_raw_response_wrapper( - policies.toggle, - ) - - -class AsyncPoliciesResourceWithRawResponse: - def __init__(self, policies: AsyncPoliciesResource) -> None: - self._policies = policies - - self.toggle = async_to_raw_response_wrapper( - policies.toggle, - ) - - -class PoliciesResourceWithStreamingResponse: - def __init__(self, policies: PoliciesResource) -> None: - self._policies = policies - - self.toggle = to_streamed_response_wrapper( - policies.toggle, - ) - - -class AsyncPoliciesResourceWithStreamingResponse: - def __init__(self, policies: AsyncPoliciesResource) -> None: - self._policies = policies - - self.toggle = async_to_streamed_response_wrapper( - policies.toggle, - ) diff --git a/src/gcore/resources/waap/domains/analytics/analytics.py b/src/gcore/resources/waap/domains/statistics.py similarity index 52% rename from src/gcore/resources/waap/domains/analytics/analytics.py rename to src/gcore/resources/waap/domains/statistics.py index 47525848..13776e62 100644 --- a/src/gcore/resources/waap/domains/analytics/analytics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -8,67 +8,181 @@ import httpx -from .requests import ( - RequestsResource, - AsyncRequestsResource, - RequestsResourceWithRawResponse, - AsyncRequestsResourceWithRawResponse, - RequestsResourceWithStreamingResponse, - AsyncRequestsResourceWithStreamingResponse, -) -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import maybe_transform, async_maybe_transform -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 .....pagination import SyncOffsetPage, AsyncOffsetPage -from .....types.waap import WaapResolution -from ....._base_client import AsyncPaginator, make_request_options -from .....types.waap.domains import ( - analytics_list_ddos_info_params, - analytics_list_ddos_attacks_params, - analytics_list_event_traffic_params, - analytics_get_event_statistics_params, +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.waap.domains import ( + statistic_get_ddos_info_params, + statistic_get_ddos_attacks_params, + statistic_get_traffic_series_params, + statistic_get_requests_series_params, + statistic_get_events_aggregated_params, ) -from .....types.waap.waap_ddos_info import WaapDDOSInfo -from .....types.waap.waap_resolution import WaapResolution -from .....types.waap.waap_ddos_attack import WaapDDOSAttack -from .....types.waap.waap_event_statistics import WaapEventStatistics -from .....types.waap.domains.analytics_list_event_traffic_response import AnalyticsListEventTrafficResponse - -__all__ = ["AnalyticsResource", "AsyncAnalyticsResource"] +from ....types.waap.domains.waap_ddos_info import WaapDDOSInfo +from ....types.waap.domains.waap_ddos_attack import WaapDDOSAttack +from ....types.waap.domains.waap_request_details import WaapRequestDetails +from ....types.waap.domains.waap_request_summary import WaapRequestSummary +from ....types.waap.domains.waap_event_statistics import WaapEventStatistics +from ....types.waap.domains.statistic_get_traffic_series_response import StatisticGetTrafficSeriesResponse +__all__ = ["StatisticsResource", "AsyncStatisticsResource"] -class AnalyticsResource(SyncAPIResource): - @cached_property - def requests(self) -> RequestsResource: - return RequestsResource(self._client) +class StatisticsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AnalyticsResourceWithRawResponse: + def with_raw_response(self) -> StatisticsResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ - return AnalyticsResourceWithRawResponse(self) + return StatisticsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AnalyticsResourceWithStreamingResponse: + def with_streaming_response(self) -> StatisticsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ - return AnalyticsResourceWithStreamingResponse(self) + return StatisticsResourceWithStreamingResponse(self) - def get_event_statistics( + def get_ddos_attacks( + self, + domain_id: int, + *, + end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | NotGiven = NOT_GIVEN, + start_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[WaapDDOSAttack]: + """ + Retrieve a domain's DDoS attacks + + Args: + domain_id: The domain ID + + end_time: Filter attacks up to a specified end date in ISO 8601 format + + limit: Number of items to return + + offset: Number of items to skip + + ordering: Sort the response by given field. + + start_time: Filter attacks starting from a specified date in ISO 8601 format + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/ddos-attacks", + page=SyncOffsetPage[WaapDDOSAttack], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "end_time": end_time, + "limit": limit, + "offset": offset, + "ordering": ordering, + "start_time": start_time, + }, + statistic_get_ddos_attacks_params.StatisticGetDDOSAttacksParams, + ), + ), + model=WaapDDOSAttack, + ) + + def get_ddos_info( + self, + domain_id: int, + *, + group_by: Literal["URL", "User-Agent", "IP"], + start: Union[str, datetime], + end: Union[str, datetime] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[WaapDDOSInfo]: + """ + Returns the top DDoS counts grouped by URL, User-Agent or IP + + Args: + domain_id: The domain ID + + group_by: The identity of the requests to group by + + start: Filter traffic starting from a specified date in ISO 8601 format + + end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, + defaults to the current date and time. + + limit: Number of items to return + + offset: Number of items to skip + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/ddos-info", + page=SyncOffsetPage[WaapDDOSInfo], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "group_by": group_by, + "start": start, + "end": end, + "limit": limit, + "offset": offset, + }, + statistic_get_ddos_info_params.StatisticGetDDOSInfoParams, + ), + ), + model=WaapDDOSInfo, + ) + + def get_events_aggregated( self, domain_id: int, *, @@ -128,43 +242,32 @@ def get_event_statistics( "reference_id": reference_id, "result": result, }, - analytics_get_event_statistics_params.AnalyticsGetEventStatisticsParams, + statistic_get_events_aggregated_params.StatisticGetEventsAggregatedParams, ), ), cast_to=WaapEventStatistics, ) - def list_ddos_attacks( + def get_request_details( self, - domain_id: int, + request_id: str, *, - end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | NotGiven = NOT_GIVEN, - start_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + domain_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, - ) -> SyncOffsetPage[WaapDDOSAttack]: + ) -> WaapRequestDetails: """ - Retrieve a domain's DDoS attacks + Retrieves all the available information for a request that matches a given + request id Args: domain_id: The domain ID - end_time: Filter attacks up to a specified end date in ISO 8601 format - - limit: Number of items to return - - offset: Number of items to skip - - ordering: Sort the response by given field. - - start_time: Filter attacks starting from a specified date in ISO 8601 format + request_id: The request ID extra_headers: Send extra headers @@ -174,61 +277,94 @@ def list_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks", - page=SyncOffsetPage[WaapDDOSAttack], + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + return self._get( + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "end_time": end_time, - "limit": limit, - "offset": offset, - "ordering": ordering, - "start_time": start_time, - }, - analytics_list_ddos_attacks_params.AnalyticsListDDOSAttacksParams, - ), + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=WaapDDOSAttack, + cast_to=WaapRequestDetails, ) - def list_ddos_info( + def get_requests_series( self, domain_id: int, *, - group_by: Literal["URL", "User-Agent", "IP"], start: Union[str, datetime], + actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, + countries: List[str] | NotGiven = NOT_GIVEN, end: Union[str, datetime] | NotGiven = NOT_GIVEN, + ip: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + ordering: str | NotGiven = NOT_GIVEN, + reference_id: str | NotGiven = NOT_GIVEN, + security_rule_name: str | NotGiven = NOT_GIVEN, + status_code: int | NotGiven = NOT_GIVEN, + traffic_types: List[ + Literal[ + "policy_allowed", + "policy_blocked", + "custom_rule_allowed", + "custom_blocked", + "legit_requests", + "sanctioned", + "dynamic", + "api", + "static", + "ajax", + "redirects", + "monitor", + "err_40x", + "err_50x", + "passed_to_origin", + "timeout", + "other", + "ddos", + "legit", + "monitored", + ] + ] + | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[WaapDDOSInfo]: + ) -> SyncOffsetPage[WaapRequestSummary]: """ - Returns the top DDoS counts grouped by URL, User-Agent or IP + Retrieve a domain's requests data. Args: domain_id: The domain ID - group_by: The identity of the requests to group by - start: Filter traffic starting from a specified date in ISO 8601 format + actions: Filter the response by actions. + + countries: Filter the response by country codes in ISO 3166-1 alpha-2 format. + end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, defaults to the current date and time. + ip: Filter the response by IP. + limit: Number of items to return offset: Number of items to skip + ordering: Sort the response by given field. + + reference_id: Filter the response by reference ID. + + security_rule_name: Filter the response by security rule name. + + status_code: Filter the response by response code. + + traffic_types: Filter the response by traffic types. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -238,8 +374,8 @@ def list_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info", - page=SyncOffsetPage[WaapDDOSInfo], + f"/waap/v1/domains/{domain_id}/requests", + page=SyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -247,23 +383,30 @@ def list_ddos_info( timeout=timeout, query=maybe_transform( { - "group_by": group_by, "start": start, + "actions": actions, + "countries": countries, "end": end, + "ip": ip, "limit": limit, "offset": offset, + "ordering": ordering, + "reference_id": reference_id, + "security_rule_name": security_rule_name, + "status_code": status_code, + "traffic_types": traffic_types, }, - analytics_list_ddos_info_params.AnalyticsListDDOSInfoParams, + statistic_get_requests_series_params.StatisticGetRequestsSeriesParams, ), ), - model=WaapDDOSInfo, + model=WaapRequestSummary, ) - def list_event_traffic( + def get_traffic_series( self, domain_id: int, *, - resolution: WaapResolution, + resolution: Literal["daily", "hourly", "minutely"], start: Union[str, datetime], end: Union[str, datetime] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -272,7 +415,7 @@ def list_event_traffic( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AnalyticsListEventTrafficResponse: + ) -> StatisticGetTrafficSeriesResponse: """ Retrieves a comprehensive report on a domain's traffic statistics based on Clickhouse. The report includes details such as API requests, blocked events, @@ -309,38 +452,159 @@ def list_event_traffic( "start": start, "end": end, }, - analytics_list_event_traffic_params.AnalyticsListEventTrafficParams, + statistic_get_traffic_series_params.StatisticGetTrafficSeriesParams, ), ), - cast_to=AnalyticsListEventTrafficResponse, + cast_to=StatisticGetTrafficSeriesResponse, ) -class AsyncAnalyticsResource(AsyncAPIResource): +class AsyncStatisticsResource(AsyncAPIResource): @cached_property - def requests(self) -> AsyncRequestsResource: - return AsyncRequestsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncAnalyticsResourceWithRawResponse: + def with_raw_response(self) -> AsyncStatisticsResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ - return AsyncAnalyticsResourceWithRawResponse(self) + return AsyncStatisticsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAnalyticsResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncStatisticsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ - return AsyncAnalyticsResourceWithStreamingResponse(self) + return AsyncStatisticsResourceWithStreamingResponse(self) - async def get_event_statistics( + def get_ddos_attacks( + self, + domain_id: int, + *, + end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | NotGiven = NOT_GIVEN, + start_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[WaapDDOSAttack, AsyncOffsetPage[WaapDDOSAttack]]: + """ + Retrieve a domain's DDoS attacks + + Args: + domain_id: The domain ID + + end_time: Filter attacks up to a specified end date in ISO 8601 format + + limit: Number of items to return + + offset: Number of items to skip + + ordering: Sort the response by given field. + + start_time: Filter attacks starting from a specified date in ISO 8601 format + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/ddos-attacks", + page=AsyncOffsetPage[WaapDDOSAttack], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "end_time": end_time, + "limit": limit, + "offset": offset, + "ordering": ordering, + "start_time": start_time, + }, + statistic_get_ddos_attacks_params.StatisticGetDDOSAttacksParams, + ), + ), + model=WaapDDOSAttack, + ) + + def get_ddos_info( + self, + domain_id: int, + *, + group_by: Literal["URL", "User-Agent", "IP"], + start: Union[str, datetime], + end: Union[str, datetime] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[WaapDDOSInfo, AsyncOffsetPage[WaapDDOSInfo]]: + """ + Returns the top DDoS counts grouped by URL, User-Agent or IP + + Args: + domain_id: The domain ID + + group_by: The identity of the requests to group by + + start: Filter traffic starting from a specified date in ISO 8601 format + + end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, + defaults to the current date and time. + + limit: Number of items to return + + offset: Number of items to skip + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/ddos-info", + page=AsyncOffsetPage[WaapDDOSInfo], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "group_by": group_by, + "start": start, + "end": end, + "limit": limit, + "offset": offset, + }, + statistic_get_ddos_info_params.StatisticGetDDOSInfoParams, + ), + ), + model=WaapDDOSInfo, + ) + + async def get_events_aggregated( self, domain_id: int, *, @@ -400,43 +664,32 @@ async def get_event_statistics( "reference_id": reference_id, "result": result, }, - analytics_get_event_statistics_params.AnalyticsGetEventStatisticsParams, + statistic_get_events_aggregated_params.StatisticGetEventsAggregatedParams, ), ), cast_to=WaapEventStatistics, ) - def list_ddos_attacks( + async def get_request_details( self, - domain_id: int, + request_id: str, *, - end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | NotGiven = NOT_GIVEN, - start_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + domain_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, - ) -> AsyncPaginator[WaapDDOSAttack, AsyncOffsetPage[WaapDDOSAttack]]: + ) -> WaapRequestDetails: """ - Retrieve a domain's DDoS attacks + Retrieves all the available information for a request that matches a given + request id Args: domain_id: The domain ID - end_time: Filter attacks up to a specified end date in ISO 8601 format - - limit: Number of items to return - - offset: Number of items to skip - - ordering: Sort the response by given field. - - start_time: Filter attacks starting from a specified date in ISO 8601 format + request_id: The request ID extra_headers: Send extra headers @@ -446,61 +699,94 @@ def list_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks", - page=AsyncOffsetPage[WaapDDOSAttack], + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + return await self._get( + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "end_time": end_time, - "limit": limit, - "offset": offset, - "ordering": ordering, - "start_time": start_time, - }, - analytics_list_ddos_attacks_params.AnalyticsListDDOSAttacksParams, - ), + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=WaapDDOSAttack, + cast_to=WaapRequestDetails, ) - def list_ddos_info( + def get_requests_series( self, domain_id: int, *, - group_by: Literal["URL", "User-Agent", "IP"], start: Union[str, datetime], + actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, + countries: List[str] | NotGiven = NOT_GIVEN, end: Union[str, datetime] | NotGiven = NOT_GIVEN, + ip: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + ordering: str | NotGiven = NOT_GIVEN, + reference_id: str | NotGiven = NOT_GIVEN, + security_rule_name: str | NotGiven = NOT_GIVEN, + status_code: int | NotGiven = NOT_GIVEN, + traffic_types: List[ + Literal[ + "policy_allowed", + "policy_blocked", + "custom_rule_allowed", + "custom_blocked", + "legit_requests", + "sanctioned", + "dynamic", + "api", + "static", + "ajax", + "redirects", + "monitor", + "err_40x", + "err_50x", + "passed_to_origin", + "timeout", + "other", + "ddos", + "legit", + "monitored", + ] + ] + | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[WaapDDOSInfo, AsyncOffsetPage[WaapDDOSInfo]]: + ) -> AsyncPaginator[WaapRequestSummary, AsyncOffsetPage[WaapRequestSummary]]: """ - Returns the top DDoS counts grouped by URL, User-Agent or IP + Retrieve a domain's requests data. Args: domain_id: The domain ID - group_by: The identity of the requests to group by - start: Filter traffic starting from a specified date in ISO 8601 format + actions: Filter the response by actions. + + countries: Filter the response by country codes in ISO 3166-1 alpha-2 format. + end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, defaults to the current date and time. + ip: Filter the response by IP. + limit: Number of items to return offset: Number of items to skip + ordering: Sort the response by given field. + + reference_id: Filter the response by reference ID. + + security_rule_name: Filter the response by security rule name. + + status_code: Filter the response by response code. + + traffic_types: Filter the response by traffic types. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -510,8 +796,8 @@ def list_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info", - page=AsyncOffsetPage[WaapDDOSInfo], + f"/waap/v1/domains/{domain_id}/requests", + page=AsyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -519,23 +805,30 @@ def list_ddos_info( timeout=timeout, query=maybe_transform( { - "group_by": group_by, "start": start, + "actions": actions, + "countries": countries, "end": end, + "ip": ip, "limit": limit, "offset": offset, + "ordering": ordering, + "reference_id": reference_id, + "security_rule_name": security_rule_name, + "status_code": status_code, + "traffic_types": traffic_types, }, - analytics_list_ddos_info_params.AnalyticsListDDOSInfoParams, + statistic_get_requests_series_params.StatisticGetRequestsSeriesParams, ), ), - model=WaapDDOSInfo, + model=WaapRequestSummary, ) - async def list_event_traffic( + async def get_traffic_series( self, domain_id: int, *, - resolution: WaapResolution, + resolution: Literal["daily", "hourly", "minutely"], start: Union[str, datetime], end: Union[str, datetime] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -544,7 +837,7 @@ async def list_event_traffic( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AnalyticsListEventTrafficResponse: + ) -> StatisticGetTrafficSeriesResponse: """ Retrieves a comprehensive report on a domain's traffic statistics based on Clickhouse. The report includes details such as API requests, blocked events, @@ -581,96 +874,104 @@ async def list_event_traffic( "start": start, "end": end, }, - analytics_list_event_traffic_params.AnalyticsListEventTrafficParams, + statistic_get_traffic_series_params.StatisticGetTrafficSeriesParams, ), ), - cast_to=AnalyticsListEventTrafficResponse, + cast_to=StatisticGetTrafficSeriesResponse, ) -class AnalyticsResourceWithRawResponse: - def __init__(self, analytics: AnalyticsResource) -> None: - self._analytics = analytics +class StatisticsResourceWithRawResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics - self.get_event_statistics = to_raw_response_wrapper( - analytics.get_event_statistics, + self.get_ddos_attacks = to_raw_response_wrapper( + statistics.get_ddos_attacks, ) - self.list_ddos_attacks = to_raw_response_wrapper( - analytics.list_ddos_attacks, + self.get_ddos_info = to_raw_response_wrapper( + statistics.get_ddos_info, ) - self.list_ddos_info = to_raw_response_wrapper( - analytics.list_ddos_info, + self.get_events_aggregated = to_raw_response_wrapper( + statistics.get_events_aggregated, ) - self.list_event_traffic = to_raw_response_wrapper( - analytics.list_event_traffic, + self.get_request_details = to_raw_response_wrapper( + statistics.get_request_details, + ) + self.get_requests_series = to_raw_response_wrapper( + statistics.get_requests_series, + ) + self.get_traffic_series = to_raw_response_wrapper( + statistics.get_traffic_series, ) - - @cached_property - def requests(self) -> RequestsResourceWithRawResponse: - return RequestsResourceWithRawResponse(self._analytics.requests) -class AsyncAnalyticsResourceWithRawResponse: - def __init__(self, analytics: AsyncAnalyticsResource) -> None: - self._analytics = analytics +class AsyncStatisticsResourceWithRawResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics - self.get_event_statistics = async_to_raw_response_wrapper( - analytics.get_event_statistics, + self.get_ddos_attacks = async_to_raw_response_wrapper( + statistics.get_ddos_attacks, ) - self.list_ddos_attacks = async_to_raw_response_wrapper( - analytics.list_ddos_attacks, + self.get_ddos_info = async_to_raw_response_wrapper( + statistics.get_ddos_info, ) - self.list_ddos_info = async_to_raw_response_wrapper( - analytics.list_ddos_info, + self.get_events_aggregated = async_to_raw_response_wrapper( + statistics.get_events_aggregated, ) - self.list_event_traffic = async_to_raw_response_wrapper( - analytics.list_event_traffic, + self.get_request_details = async_to_raw_response_wrapper( + statistics.get_request_details, + ) + self.get_requests_series = async_to_raw_response_wrapper( + statistics.get_requests_series, + ) + self.get_traffic_series = async_to_raw_response_wrapper( + statistics.get_traffic_series, ) - - @cached_property - def requests(self) -> AsyncRequestsResourceWithRawResponse: - return AsyncRequestsResourceWithRawResponse(self._analytics.requests) -class AnalyticsResourceWithStreamingResponse: - def __init__(self, analytics: AnalyticsResource) -> None: - self._analytics = analytics +class StatisticsResourceWithStreamingResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics - self.get_event_statistics = to_streamed_response_wrapper( - analytics.get_event_statistics, + self.get_ddos_attacks = to_streamed_response_wrapper( + statistics.get_ddos_attacks, ) - self.list_ddos_attacks = to_streamed_response_wrapper( - analytics.list_ddos_attacks, + self.get_ddos_info = to_streamed_response_wrapper( + statistics.get_ddos_info, ) - self.list_ddos_info = to_streamed_response_wrapper( - analytics.list_ddos_info, + self.get_events_aggregated = to_streamed_response_wrapper( + statistics.get_events_aggregated, ) - self.list_event_traffic = to_streamed_response_wrapper( - analytics.list_event_traffic, + self.get_request_details = to_streamed_response_wrapper( + statistics.get_request_details, + ) + self.get_requests_series = to_streamed_response_wrapper( + statistics.get_requests_series, + ) + self.get_traffic_series = to_streamed_response_wrapper( + statistics.get_traffic_series, ) - - @cached_property - def requests(self) -> RequestsResourceWithStreamingResponse: - return RequestsResourceWithStreamingResponse(self._analytics.requests) -class AsyncAnalyticsResourceWithStreamingResponse: - def __init__(self, analytics: AsyncAnalyticsResource) -> None: - self._analytics = analytics +class AsyncStatisticsResourceWithStreamingResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics - self.get_event_statistics = async_to_streamed_response_wrapper( - analytics.get_event_statistics, + self.get_ddos_attacks = async_to_streamed_response_wrapper( + statistics.get_ddos_attacks, ) - self.list_ddos_attacks = async_to_streamed_response_wrapper( - analytics.list_ddos_attacks, + self.get_ddos_info = async_to_streamed_response_wrapper( + statistics.get_ddos_info, ) - self.list_ddos_info = async_to_streamed_response_wrapper( - analytics.list_ddos_info, + self.get_events_aggregated = async_to_streamed_response_wrapper( + statistics.get_events_aggregated, ) - self.list_event_traffic = async_to_streamed_response_wrapper( - analytics.list_event_traffic, + self.get_request_details = async_to_streamed_response_wrapper( + statistics.get_request_details, + ) + self.get_requests_series = async_to_streamed_response_wrapper( + statistics.get_requests_series, + ) + self.get_traffic_series = async_to_streamed_response_wrapper( + statistics.get_traffic_series, ) - - @cached_property - def requests(self) -> AsyncRequestsResourceWithStreamingResponse: - return AsyncRequestsResourceWithStreamingResponse(self._analytics.requests) diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py new file mode 100644 index 00000000..e056e67a --- /dev/null +++ b/src/gcore/resources/waap/insights.py @@ -0,0 +1,233 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ...types.waap import insight_list_types_params +from ..._base_client import AsyncPaginator, make_request_options +from ...types.waap.waap_insight_type import WaapInsightType + +__all__ = ["InsightsResource", "AsyncInsightsResource"] + + +class InsightsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InsightsResourceWithRawResponse: + """ + 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 InsightsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InsightsResourceWithStreamingResponse: + """ + 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 InsightsResourceWithStreamingResponse(self) + + def list_types( + self, + *, + insight_frequency: Optional[int] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal["name", "-name", "slug", "-slug", "insight_frequency", "-insight_frequency"] + | NotGiven = NOT_GIVEN, + slug: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[WaapInsightType]: + """ + Insight types are generalized categories that encompass various specific + occurrences of the same kind. + + Args: + insight_frequency: Filter by the frequency of the insight type + + limit: Number of items to return + + name: Filter by the name of the insight type + + offset: Number of items to skip + + ordering: Sort the response by given field. + + slug: Filter by the slug of the insight type + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/waap/v1/security-insights/types", + page=SyncOffsetPage[WaapInsightType], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "insight_frequency": insight_frequency, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + "slug": slug, + }, + insight_list_types_params.InsightListTypesParams, + ), + ), + model=WaapInsightType, + ) + + +class AsyncInsightsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInsightsResourceWithRawResponse: + """ + 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 AsyncInsightsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInsightsResourceWithStreamingResponse: + """ + 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 AsyncInsightsResourceWithStreamingResponse(self) + + def list_types( + self, + *, + insight_frequency: Optional[int] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: Optional[str] | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + ordering: Literal["name", "-name", "slug", "-slug", "insight_frequency", "-insight_frequency"] + | NotGiven = NOT_GIVEN, + slug: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[WaapInsightType, AsyncOffsetPage[WaapInsightType]]: + """ + Insight types are generalized categories that encompass various specific + occurrences of the same kind. + + Args: + insight_frequency: Filter by the frequency of the insight type + + limit: Number of items to return + + name: Filter by the name of the insight type + + offset: Number of items to skip + + ordering: Sort the response by given field. + + slug: Filter by the slug of the insight type + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/waap/v1/security-insights/types", + page=AsyncOffsetPage[WaapInsightType], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "insight_frequency": insight_frequency, + "limit": limit, + "name": name, + "offset": offset, + "ordering": ordering, + "slug": slug, + }, + insight_list_types_params.InsightListTypesParams, + ), + ), + model=WaapInsightType, + ) + + +class InsightsResourceWithRawResponse: + def __init__(self, insights: InsightsResource) -> None: + self._insights = insights + + self.list_types = to_raw_response_wrapper( + insights.list_types, + ) + + +class AsyncInsightsResourceWithRawResponse: + def __init__(self, insights: AsyncInsightsResource) -> None: + self._insights = insights + + self.list_types = async_to_raw_response_wrapper( + insights.list_types, + ) + + +class InsightsResourceWithStreamingResponse: + def __init__(self, insights: InsightsResource) -> None: + self._insights = insights + + self.list_types = to_streamed_response_wrapper( + insights.list_types, + ) + + +class AsyncInsightsResourceWithStreamingResponse: + def __init__(self, insights: AsyncInsightsResource) -> None: + self._insights = insights + + self.list_types = async_to_streamed_response_wrapper( + insights.list_types, + ) diff --git a/src/gcore/resources/waap/ip_info/__init__.py b/src/gcore/resources/waap/ip_info/__init__.py new file mode 100644 index 00000000..98a9875c --- /dev/null +++ b/src/gcore/resources/waap/ip_info/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .ip_info import ( + IPInfoResource, + AsyncIPInfoResource, + IPInfoResourceWithRawResponse, + AsyncIPInfoResourceWithRawResponse, + IPInfoResourceWithStreamingResponse, + AsyncIPInfoResourceWithStreamingResponse, +) +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) + +__all__ = [ + "MetricsResource", + "AsyncMetricsResource", + "MetricsResourceWithRawResponse", + "AsyncMetricsResourceWithRawResponse", + "MetricsResourceWithStreamingResponse", + "AsyncMetricsResourceWithStreamingResponse", + "IPInfoResource", + "AsyncIPInfoResource", + "IPInfoResourceWithRawResponse", + "AsyncIPInfoResourceWithRawResponse", + "IPInfoResourceWithStreamingResponse", + "AsyncIPInfoResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/waap/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py similarity index 82% rename from src/gcore/resources/waap/ip_info.py rename to src/gcore/resources/waap/ip_info/ip_info.py index ab42a015..7d4d5f1b 100644 --- a/src/gcore/resources/waap/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -2,46 +2,54 @@ from __future__ import annotations -from typing import Optional - import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import maybe_transform, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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.waap import ( - ip_info_get_params, - ip_info_get_counts_params, +from ....types.waap import ( + ip_info_get_ip_info_params, ip_info_get_top_urls_params, - ip_info_get_top_sessions_params, ip_info_get_top_user_agents_params, ip_info_get_blocked_requests_params, + ip_info_get_top_user_sessions_params, ip_info_get_attack_time_series_params, ip_info_get_ddos_attack_series_params, ip_info_list_attacked_countries_params, ) -from ..._base_client import make_request_options -from ...types.waap.waap_ip_info import WaapIPInfo -from ...types.waap.waap_ip_info_counts import WaapIPInfoCounts -from ...types.waap.waap_ip_ddos_info_model import WaapIPDDOSInfoModel -from ...types.waap.ip_info_get_top_urls_response import IPInfoGetTopURLsResponse -from ...types.waap.ip_info_get_top_sessions_response import IPInfoGetTopSessionsResponse -from ...types.waap.ip_info_get_top_user_agents_response import IPInfoGetTopUserAgentsResponse -from ...types.waap.ip_info_get_blocked_requests_response import IPInfoGetBlockedRequestsResponse -from ...types.waap.ip_info_get_attack_time_series_response import IPInfoGetAttackTimeSeriesResponse -from ...types.waap.ip_info_list_attacked_countries_response import IPInfoListAttackedCountriesResponse +from ...._base_client import make_request_options +from ....types.waap.waap_ip_ddos_info_model import WaapIPDDOSInfoModel +from ....types.waap.ip_info_get_ip_info_response import IPInfoGetIPInfoResponse +from ....types.waap.ip_info_get_top_urls_response import IPInfoGetTopURLsResponse +from ....types.waap.ip_info_get_top_user_agents_response import IPInfoGetTopUserAgentsResponse +from ....types.waap.ip_info_get_blocked_requests_response import IPInfoGetBlockedRequestsResponse +from ....types.waap.ip_info_get_top_user_sessions_response import IPInfoGetTopUserSessionsResponse +from ....types.waap.ip_info_get_attack_time_series_response import IPInfoGetAttackTimeSeriesResponse +from ....types.waap.ip_info_list_attacked_countries_response import IPInfoListAttackedCountriesResponse __all__ = ["IPInfoResource", "AsyncIPInfoResource"] class IPInfoResource(SyncAPIResource): + @cached_property + def metrics(self) -> MetricsResource: + return MetricsResource(self._client) + @cached_property def with_raw_response(self) -> IPInfoResourceWithRawResponse: """ @@ -61,44 +69,6 @@ def with_streaming_response(self) -> IPInfoResourceWithStreamingResponse: """ return IPInfoResourceWithStreamingResponse(self) - def get( - self, - *, - ip: 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, - ) -> WaapIPInfo: - """ - Fetch details about a particular IP address, including WHOIS data, risk score, - and additional tags. - - Args: - ip: The IP address to check - - 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( - "/waap/v1/ip-info/ip-info", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"ip": ip}, ip_info_get_params.IPInfoGetParams), - ), - cast_to=WaapIPInfo, - ) - def get_attack_time_series( self, *, @@ -189,31 +159,27 @@ def get_blocked_requests( cast_to=IPInfoGetBlockedRequestsResponse, ) - def get_counts( + def get_ddos_attack_series( self, *, ip: str, - domain_id: Optional[int] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaapIPInfoCounts: + ) -> WaapIPDDOSInfoModel: """ - Retrieve metrics encompassing the counts of total requests, blocked requests and - unique sessions associated with a specified IP address. Metrics provide a - statistical overview, aiding in analyzing the interaction and access patterns of - the IP address in context. + Fetch and analyze DDoS (Distributed Denial of Service) attack metrics for a + specified IP address. The endpoint provides time-series data, enabling users to + evaluate the frequency and intensity of attacks across various time intervals, + and it returns metrics in Prometheus format to offer a systematic view of DDoS + attack patterns. Args: ip: The IP address to check - domain_id: The identifier for a domain. When specified, the response will exclusively - contain data pertinent to the indicated domain, filtering out information from - other domains. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -223,24 +189,20 @@ def get_counts( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/counts", + "/waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform( - { - "ip": ip, - "domain_id": domain_id, - }, - ip_info_get_counts_params.IPInfoGetCountsParams, + {"ip": ip}, ip_info_get_ddos_attack_series_params.IPInfoGetDDOSAttackSeriesParams ), ), - cast_to=WaapIPInfoCounts, + cast_to=WaapIPDDOSInfoModel, ) - def get_ddos_attack_series( + def get_ip_info( self, *, ip: str, @@ -250,13 +212,10 @@ def get_ddos_attack_series( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaapIPDDOSInfoModel: + ) -> IPInfoGetIPInfoResponse: """ - Fetch and analyze DDoS (Distributed Denial of Service) attack metrics for a - specified IP address. The endpoint provides time-series data, enabling users to - evaluate the frequency and intensity of attacks across various time intervals, - and it returns metrics in Prometheus format to offer a systematic view of DDoS - attack patterns. + Fetch details about a particular IP address, including WHOIS data, risk score, + and additional tags. Args: ip: The IP address to check @@ -270,20 +229,18 @@ def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform( - {"ip": ip}, ip_info_get_ddos_attack_series_params.IPInfoGetDDOSAttackSeriesParams - ), + query=maybe_transform({"ip": ip}, ip_info_get_ip_info_params.IPInfoGetIPInfoParams), ), - cast_to=WaapIPDDOSInfoModel, + cast_to=IPInfoGetIPInfoResponse, ) - def get_top_sessions( + def get_top_urls( self, *, domain_id: int, @@ -294,10 +251,12 @@ def get_top_sessions( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IPInfoGetTopSessionsResponse: + ) -> IPInfoGetTopURLsResponse: """ - Obtain the top 10 user sessions interfacing with a particular domain, identified - by IP. + Returns a list of the top 10 URLs accessed by a specified IP address within a + specific domain. This data is vital to understand user navigation patterns, + pinpoint high-traffic pages, and facilitate more targeted enhancements or + security monitoring based on URL popularity. Args: domain_id: The identifier for a domain. When specified, the response will exclusively @@ -315,7 +274,7 @@ def get_top_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -326,13 +285,13 @@ def get_top_sessions( "domain_id": domain_id, "ip": ip, }, - ip_info_get_top_sessions_params.IPInfoGetTopSessionsParams, + ip_info_get_top_urls_params.IPInfoGetTopURLsParams, ), ), - cast_to=IPInfoGetTopSessionsResponse, + cast_to=IPInfoGetTopURLsResponse, ) - def get_top_urls( + def get_top_user_agents( self, *, domain_id: int, @@ -343,12 +302,10 @@ def get_top_urls( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IPInfoGetTopURLsResponse: + ) -> IPInfoGetTopUserAgentsResponse: """ - Returns a list of the top 10 URLs accessed by a specified IP address within a - specific domain. This data is vital to understand user navigation patterns, - pinpoint high-traffic pages, and facilitate more targeted enhancements or - security monitoring based on URL popularity. + Retrieve the top 10 user agents interacting with a specified domain, filtered by + IP. Args: domain_id: The identifier for a domain. When specified, the response will exclusively @@ -366,7 +323,7 @@ def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -377,13 +334,13 @@ def get_top_urls( "domain_id": domain_id, "ip": ip, }, - ip_info_get_top_urls_params.IPInfoGetTopURLsParams, + ip_info_get_top_user_agents_params.IPInfoGetTopUserAgentsParams, ), ), - cast_to=IPInfoGetTopURLsResponse, + cast_to=IPInfoGetTopUserAgentsResponse, ) - def get_top_user_agents( + def get_top_user_sessions( self, *, domain_id: int, @@ -394,10 +351,10 @@ def get_top_user_agents( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IPInfoGetTopUserAgentsResponse: + ) -> IPInfoGetTopUserSessionsResponse: """ - Retrieve the top 10 user agents interacting with a specified domain, filtered by - IP. + Obtain the top 10 user sessions interfacing with a particular domain, identified + by IP. Args: domain_id: The identifier for a domain. When specified, the response will exclusively @@ -415,7 +372,7 @@ def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -426,10 +383,10 @@ def get_top_user_agents( "domain_id": domain_id, "ip": ip, }, - ip_info_get_top_user_agents_params.IPInfoGetTopUserAgentsParams, + ip_info_get_top_user_sessions_params.IPInfoGetTopUserSessionsParams, ), ), - cast_to=IPInfoGetTopUserAgentsResponse, + cast_to=IPInfoGetTopUserSessionsResponse, ) def list_attacked_countries( @@ -473,6 +430,10 @@ def list_attacked_countries( class AsyncIPInfoResource(AsyncAPIResource): + @cached_property + def metrics(self) -> AsyncMetricsResource: + return AsyncMetricsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncIPInfoResourceWithRawResponse: """ @@ -492,44 +453,6 @@ def with_streaming_response(self) -> AsyncIPInfoResourceWithStreamingResponse: """ return AsyncIPInfoResourceWithStreamingResponse(self) - async def get( - self, - *, - ip: 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, - ) -> WaapIPInfo: - """ - Fetch details about a particular IP address, including WHOIS data, risk score, - and additional tags. - - Args: - ip: The IP address to check - - 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( - "/waap/v1/ip-info/ip-info", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"ip": ip}, ip_info_get_params.IPInfoGetParams), - ), - cast_to=WaapIPInfo, - ) - async def get_attack_time_series( self, *, @@ -620,31 +543,27 @@ async def get_blocked_requests( cast_to=IPInfoGetBlockedRequestsResponse, ) - async def get_counts( + async def get_ddos_attack_series( self, *, ip: str, - domain_id: Optional[int] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaapIPInfoCounts: + ) -> WaapIPDDOSInfoModel: """ - Retrieve metrics encompassing the counts of total requests, blocked requests and - unique sessions associated with a specified IP address. Metrics provide a - statistical overview, aiding in analyzing the interaction and access patterns of - the IP address in context. + Fetch and analyze DDoS (Distributed Denial of Service) attack metrics for a + specified IP address. The endpoint provides time-series data, enabling users to + evaluate the frequency and intensity of attacks across various time intervals, + and it returns metrics in Prometheus format to offer a systematic view of DDoS + attack patterns. Args: ip: The IP address to check - domain_id: The identifier for a domain. When specified, the response will exclusively - contain data pertinent to the indicated domain, filtering out information from - other domains. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -654,24 +573,20 @@ async def get_counts( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/counts", + "/waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform( - { - "ip": ip, - "domain_id": domain_id, - }, - ip_info_get_counts_params.IPInfoGetCountsParams, + {"ip": ip}, ip_info_get_ddos_attack_series_params.IPInfoGetDDOSAttackSeriesParams ), ), - cast_to=WaapIPInfoCounts, + cast_to=WaapIPDDOSInfoModel, ) - async def get_ddos_attack_series( + async def get_ip_info( self, *, ip: str, @@ -681,13 +596,10 @@ async def get_ddos_attack_series( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WaapIPDDOSInfoModel: + ) -> IPInfoGetIPInfoResponse: """ - Fetch and analyze DDoS (Distributed Denial of Service) attack metrics for a - specified IP address. The endpoint provides time-series data, enabling users to - evaluate the frequency and intensity of attacks across various time intervals, - and it returns metrics in Prometheus format to offer a systematic view of DDoS - attack patterns. + Fetch details about a particular IP address, including WHOIS data, risk score, + and additional tags. Args: ip: The IP address to check @@ -701,20 +613,18 @@ async def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( - {"ip": ip}, ip_info_get_ddos_attack_series_params.IPInfoGetDDOSAttackSeriesParams - ), + query=await async_maybe_transform({"ip": ip}, ip_info_get_ip_info_params.IPInfoGetIPInfoParams), ), - cast_to=WaapIPDDOSInfoModel, + cast_to=IPInfoGetIPInfoResponse, ) - async def get_top_sessions( + async def get_top_urls( self, *, domain_id: int, @@ -725,10 +635,12 @@ async def get_top_sessions( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IPInfoGetTopSessionsResponse: + ) -> IPInfoGetTopURLsResponse: """ - Obtain the top 10 user sessions interfacing with a particular domain, identified - by IP. + Returns a list of the top 10 URLs accessed by a specified IP address within a + specific domain. This data is vital to understand user navigation patterns, + pinpoint high-traffic pages, and facilitate more targeted enhancements or + security monitoring based on URL popularity. Args: domain_id: The identifier for a domain. When specified, the response will exclusively @@ -746,7 +658,7 @@ async def get_top_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -757,13 +669,13 @@ async def get_top_sessions( "domain_id": domain_id, "ip": ip, }, - ip_info_get_top_sessions_params.IPInfoGetTopSessionsParams, + ip_info_get_top_urls_params.IPInfoGetTopURLsParams, ), ), - cast_to=IPInfoGetTopSessionsResponse, + cast_to=IPInfoGetTopURLsResponse, ) - async def get_top_urls( + async def get_top_user_agents( self, *, domain_id: int, @@ -774,12 +686,10 @@ async def get_top_urls( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IPInfoGetTopURLsResponse: + ) -> IPInfoGetTopUserAgentsResponse: """ - Returns a list of the top 10 URLs accessed by a specified IP address within a - specific domain. This data is vital to understand user navigation patterns, - pinpoint high-traffic pages, and facilitate more targeted enhancements or - security monitoring based on URL popularity. + Retrieve the top 10 user agents interacting with a specified domain, filtered by + IP. Args: domain_id: The identifier for a domain. When specified, the response will exclusively @@ -797,7 +707,7 @@ async def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -808,13 +718,13 @@ async def get_top_urls( "domain_id": domain_id, "ip": ip, }, - ip_info_get_top_urls_params.IPInfoGetTopURLsParams, + ip_info_get_top_user_agents_params.IPInfoGetTopUserAgentsParams, ), ), - cast_to=IPInfoGetTopURLsResponse, + cast_to=IPInfoGetTopUserAgentsResponse, ) - async def get_top_user_agents( + async def get_top_user_sessions( self, *, domain_id: int, @@ -825,10 +735,10 @@ async def get_top_user_agents( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IPInfoGetTopUserAgentsResponse: + ) -> IPInfoGetTopUserSessionsResponse: """ - Retrieve the top 10 user agents interacting with a specified domain, filtered by - IP. + Obtain the top 10 user sessions interfacing with a particular domain, identified + by IP. Args: domain_id: The identifier for a domain. When specified, the response will exclusively @@ -846,7 +756,7 @@ async def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -857,10 +767,10 @@ async def get_top_user_agents( "domain_id": domain_id, "ip": ip, }, - ip_info_get_top_user_agents_params.IPInfoGetTopUserAgentsParams, + ip_info_get_top_user_sessions_params.IPInfoGetTopUserSessionsParams, ), ), - cast_to=IPInfoGetTopUserAgentsResponse, + cast_to=IPInfoGetTopUserSessionsResponse, ) async def list_attacked_countries( @@ -907,23 +817,17 @@ class IPInfoResourceWithRawResponse: def __init__(self, ip_info: IPInfoResource) -> None: self._ip_info = ip_info - self.get = to_raw_response_wrapper( - ip_info.get, - ) self.get_attack_time_series = to_raw_response_wrapper( ip_info.get_attack_time_series, ) self.get_blocked_requests = to_raw_response_wrapper( ip_info.get_blocked_requests, ) - self.get_counts = to_raw_response_wrapper( - ip_info.get_counts, - ) self.get_ddos_attack_series = to_raw_response_wrapper( ip_info.get_ddos_attack_series, ) - self.get_top_sessions = to_raw_response_wrapper( - ip_info.get_top_sessions, + self.get_ip_info = to_raw_response_wrapper( + ip_info.get_ip_info, ) self.get_top_urls = to_raw_response_wrapper( ip_info.get_top_urls, @@ -931,32 +835,33 @@ def __init__(self, ip_info: IPInfoResource) -> None: self.get_top_user_agents = to_raw_response_wrapper( ip_info.get_top_user_agents, ) + self.get_top_user_sessions = to_raw_response_wrapper( + ip_info.get_top_user_sessions, + ) self.list_attacked_countries = to_raw_response_wrapper( ip_info.list_attacked_countries, ) + @cached_property + def metrics(self) -> MetricsResourceWithRawResponse: + return MetricsResourceWithRawResponse(self._ip_info.metrics) + class AsyncIPInfoResourceWithRawResponse: def __init__(self, ip_info: AsyncIPInfoResource) -> None: self._ip_info = ip_info - self.get = async_to_raw_response_wrapper( - ip_info.get, - ) self.get_attack_time_series = async_to_raw_response_wrapper( ip_info.get_attack_time_series, ) self.get_blocked_requests = async_to_raw_response_wrapper( ip_info.get_blocked_requests, ) - self.get_counts = async_to_raw_response_wrapper( - ip_info.get_counts, - ) self.get_ddos_attack_series = async_to_raw_response_wrapper( ip_info.get_ddos_attack_series, ) - self.get_top_sessions = async_to_raw_response_wrapper( - ip_info.get_top_sessions, + self.get_ip_info = async_to_raw_response_wrapper( + ip_info.get_ip_info, ) self.get_top_urls = async_to_raw_response_wrapper( ip_info.get_top_urls, @@ -964,32 +869,33 @@ def __init__(self, ip_info: AsyncIPInfoResource) -> None: self.get_top_user_agents = async_to_raw_response_wrapper( ip_info.get_top_user_agents, ) + self.get_top_user_sessions = async_to_raw_response_wrapper( + ip_info.get_top_user_sessions, + ) self.list_attacked_countries = async_to_raw_response_wrapper( ip_info.list_attacked_countries, ) + @cached_property + def metrics(self) -> AsyncMetricsResourceWithRawResponse: + return AsyncMetricsResourceWithRawResponse(self._ip_info.metrics) + class IPInfoResourceWithStreamingResponse: def __init__(self, ip_info: IPInfoResource) -> None: self._ip_info = ip_info - self.get = to_streamed_response_wrapper( - ip_info.get, - ) self.get_attack_time_series = to_streamed_response_wrapper( ip_info.get_attack_time_series, ) self.get_blocked_requests = to_streamed_response_wrapper( ip_info.get_blocked_requests, ) - self.get_counts = to_streamed_response_wrapper( - ip_info.get_counts, - ) self.get_ddos_attack_series = to_streamed_response_wrapper( ip_info.get_ddos_attack_series, ) - self.get_top_sessions = to_streamed_response_wrapper( - ip_info.get_top_sessions, + self.get_ip_info = to_streamed_response_wrapper( + ip_info.get_ip_info, ) self.get_top_urls = to_streamed_response_wrapper( ip_info.get_top_urls, @@ -997,32 +903,33 @@ def __init__(self, ip_info: IPInfoResource) -> None: self.get_top_user_agents = to_streamed_response_wrapper( ip_info.get_top_user_agents, ) + self.get_top_user_sessions = to_streamed_response_wrapper( + ip_info.get_top_user_sessions, + ) self.list_attacked_countries = to_streamed_response_wrapper( ip_info.list_attacked_countries, ) + @cached_property + def metrics(self) -> MetricsResourceWithStreamingResponse: + return MetricsResourceWithStreamingResponse(self._ip_info.metrics) + class AsyncIPInfoResourceWithStreamingResponse: def __init__(self, ip_info: AsyncIPInfoResource) -> None: self._ip_info = ip_info - self.get = async_to_streamed_response_wrapper( - ip_info.get, - ) self.get_attack_time_series = async_to_streamed_response_wrapper( ip_info.get_attack_time_series, ) self.get_blocked_requests = async_to_streamed_response_wrapper( ip_info.get_blocked_requests, ) - self.get_counts = async_to_streamed_response_wrapper( - ip_info.get_counts, - ) self.get_ddos_attack_series = async_to_streamed_response_wrapper( ip_info.get_ddos_attack_series, ) - self.get_top_sessions = async_to_streamed_response_wrapper( - ip_info.get_top_sessions, + self.get_ip_info = async_to_streamed_response_wrapper( + ip_info.get_ip_info, ) self.get_top_urls = async_to_streamed_response_wrapper( ip_info.get_top_urls, @@ -1030,6 +937,13 @@ def __init__(self, ip_info: AsyncIPInfoResource) -> None: self.get_top_user_agents = async_to_streamed_response_wrapper( ip_info.get_top_user_agents, ) + self.get_top_user_sessions = async_to_streamed_response_wrapper( + ip_info.get_top_user_sessions, + ) self.list_attacked_countries = async_to_streamed_response_wrapper( ip_info.list_attacked_countries, ) + + @cached_property + def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: + return AsyncMetricsResourceWithStreamingResponse(self._ip_info.metrics) diff --git a/src/gcore/resources/waap/ip_info/metrics.py b/src/gcore/resources/waap/ip_info/metrics.py new file mode 100644 index 00000000..c70d3faa --- /dev/null +++ b/src/gcore/resources/waap/ip_info/metrics.py @@ -0,0 +1,203 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.waap.ip_info import metric_list_params +from ....types.waap.ip_info.waap_ip_info_counts import WaapIPInfoCounts + +__all__ = ["MetricsResource", "AsyncMetricsResource"] + + +class MetricsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> MetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return MetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return MetricsResourceWithStreamingResponse(self) + + def list( + self, + *, + ip: str, + domain_id: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> WaapIPInfoCounts: + """ + Retrieve metrics encompassing the counts of total requests, blocked requests and + unique sessions associated with a specified IP address. Metrics provide a + statistical overview, aiding in analyzing the interaction and access patterns of + the IP address in context. + + Args: + ip: The IP address to check + + domain_id: The identifier for a domain. When specified, the response will exclusively + contain data pertinent to the indicated domain, filtering out information from + other domains. + + 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( + "/waap/v1/ip-info/counts", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "ip": ip, + "domain_id": domain_id, + }, + metric_list_params.MetricListParams, + ), + ), + cast_to=WaapIPInfoCounts, + ) + + +class AsyncMetricsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncMetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncMetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncMetricsResourceWithStreamingResponse(self) + + async def list( + self, + *, + ip: str, + domain_id: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> WaapIPInfoCounts: + """ + Retrieve metrics encompassing the counts of total requests, blocked requests and + unique sessions associated with a specified IP address. Metrics provide a + statistical overview, aiding in analyzing the interaction and access patterns of + the IP address in context. + + Args: + ip: The IP address to check + + domain_id: The identifier for a domain. When specified, the response will exclusively + contain data pertinent to the indicated domain, filtering out information from + other domains. + + 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( + "/waap/v1/ip-info/counts", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "ip": ip, + "domain_id": domain_id, + }, + metric_list_params.MetricListParams, + ), + ), + cast_to=WaapIPInfoCounts, + ) + + +class MetricsResourceWithRawResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_raw_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithRawResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_raw_response_wrapper( + metrics.list, + ) + + +class MetricsResourceWithStreamingResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_streamed_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithStreamingResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_streamed_response_wrapper( + metrics.list, + ) diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index cebf40de..3d68c41f 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -12,15 +12,15 @@ TagsResourceWithStreamingResponse, AsyncTagsResourceWithStreamingResponse, ) -from .ip_info import ( - IPInfoResource, - AsyncIPInfoResource, - IPInfoResourceWithRawResponse, - AsyncIPInfoResourceWithRawResponse, - IPInfoResourceWithStreamingResponse, - AsyncIPInfoResourceWithStreamingResponse, -) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .insights import ( + InsightsResource, + AsyncInsightsResource, + InsightsResourceWithRawResponse, + AsyncInsightsResourceWithRawResponse, + InsightsResourceWithStreamingResponse, + AsyncInsightsResourceWithStreamingResponse, +) from ..._compat import cached_property from .statistics import ( StatisticsResource, @@ -62,6 +62,14 @@ DomainsResourceWithStreamingResponse, AsyncDomainsResourceWithStreamingResponse, ) +from .ip_info.ip_info import ( + IPInfoResource, + AsyncIPInfoResource, + IPInfoResourceWithRawResponse, + AsyncIPInfoResourceWithRawResponse, + IPInfoResourceWithStreamingResponse, + AsyncIPInfoResourceWithStreamingResponse, +) from .custom_page_sets import ( CustomPageSetsResource, AsyncCustomPageSetsResource, @@ -100,6 +108,10 @@ def tags(self) -> TagsResource: def organizations(self) -> OrganizationsResource: return OrganizationsResource(self._client) + @cached_property + def insights(self) -> InsightsResource: + return InsightsResource(self._client) + @cached_property def ip_info(self) -> IPInfoResource: return IPInfoResource(self._client) @@ -168,6 +180,10 @@ def tags(self) -> AsyncTagsResource: def organizations(self) -> AsyncOrganizationsResource: return AsyncOrganizationsResource(self._client) + @cached_property + def insights(self) -> AsyncInsightsResource: + return AsyncInsightsResource(self._client) + @cached_property def ip_info(self) -> AsyncIPInfoResource: return AsyncIPInfoResource(self._client) @@ -243,6 +259,10 @@ def tags(self) -> TagsResourceWithRawResponse: def organizations(self) -> OrganizationsResourceWithRawResponse: return OrganizationsResourceWithRawResponse(self._waap.organizations) + @cached_property + def insights(self) -> InsightsResourceWithRawResponse: + return InsightsResourceWithRawResponse(self._waap.insights) + @cached_property def ip_info(self) -> IPInfoResourceWithRawResponse: return IPInfoResourceWithRawResponse(self._waap.ip_info) @@ -280,6 +300,10 @@ def tags(self) -> AsyncTagsResourceWithRawResponse: def organizations(self) -> AsyncOrganizationsResourceWithRawResponse: return AsyncOrganizationsResourceWithRawResponse(self._waap.organizations) + @cached_property + def insights(self) -> AsyncInsightsResourceWithRawResponse: + return AsyncInsightsResourceWithRawResponse(self._waap.insights) + @cached_property def ip_info(self) -> AsyncIPInfoResourceWithRawResponse: return AsyncIPInfoResourceWithRawResponse(self._waap.ip_info) @@ -317,6 +341,10 @@ def tags(self) -> TagsResourceWithStreamingResponse: def organizations(self) -> OrganizationsResourceWithStreamingResponse: return OrganizationsResourceWithStreamingResponse(self._waap.organizations) + @cached_property + def insights(self) -> InsightsResourceWithStreamingResponse: + return InsightsResourceWithStreamingResponse(self._waap.insights) + @cached_property def ip_info(self) -> IPInfoResourceWithStreamingResponse: return IPInfoResourceWithStreamingResponse(self._waap.ip_info) @@ -354,6 +382,10 @@ def tags(self) -> AsyncTagsResourceWithStreamingResponse: def organizations(self) -> AsyncOrganizationsResourceWithStreamingResponse: return AsyncOrganizationsResourceWithStreamingResponse(self._waap.organizations) + @cached_property + def insights(self) -> AsyncInsightsResourceWithStreamingResponse: + return AsyncInsightsResourceWithStreamingResponse(self._waap.insights) + @cached_property def ip_info(self) -> AsyncIPInfoResourceWithStreamingResponse: return AsyncIPInfoResourceWithStreamingResponse(self._waap.ip_info) diff --git a/src/gcore/types/waap/__init__.py b/src/gcore/types/waap/__init__.py index 88cc7228..29b9b772 100644 --- a/src/gcore/types/waap/__init__.py +++ b/src/gcore/types/waap/__init__.py @@ -3,96 +3,51 @@ from __future__ import annotations from .waap_tag import WaapTag as WaapTag -from .waap_insight import WaapInsight as WaapInsight -from .waap_ip_info import WaapIPInfo as WaapIPInfo -from .waap_top_url import WaapTopURL as WaapTopURL from .waap_rule_set import WaapRuleSet as WaapRuleSet -from .waap_ddos_info import WaapDDOSInfo as WaapDDOSInfo -from .waap_page_type import WaapPageType as WaapPageType from .tag_list_params import TagListParams as TagListParams -from .waap_common_tag import WaapCommonTag as WaapCommonTag -from .waap_resolution import WaapResolution as WaapResolution -from .waap_custom_rule import WaapCustomRule as WaapCustomRule -from .waap_ddos_attack import WaapDDOSAttack as WaapDDOSAttack from .waap_policy_mode import WaapPolicyMode as WaapPolicyMode from .waap_top_session import WaapTopSession as WaapTopSession +from .waap_insight_type import WaapInsightType as WaapInsightType from .waap_organization import WaapOrganization as WaapOrganization -from .waap_traffic_type import WaapTrafficType as WaapTrafficType from .domain_list_params import DomainListParams as DomainListParams -from .ip_info_get_params import IPInfoGetParams as IPInfoGetParams -from .waap_advanced_rule import WaapAdvancedRule as WaapAdvancedRule -from .waap_domain_policy import WaapDomainPolicy as WaapDomainPolicy -from .waap_domain_status import WaapDomainStatus as WaapDomainStatus -from .waap_firewall_rule import WaapFirewallRule as WaapFirewallRule -from .waap_policy_action import WaapPolicyAction as WaapPolicyAction -from .waap_insight_status import WaapInsightStatus as WaapInsightStatus -from .waap_ip_info_counts import WaapIPInfoCounts as WaapIPInfoCounts from .waap_statistic_item import WaapStatisticItem as WaapStatisticItem from .waap_summary_domain import WaapSummaryDomain as WaapSummaryDomain from .waap_top_user_agent import WaapTopUserAgent as WaapTopUserAgent from .domain_update_params import DomainUpdateParams as DomainUpdateParams -from .waap_block_page_data import WaapBlockPageData as WaapBlockPageData from .waap_custom_page_set import WaapCustomPageSet as WaapCustomPageSet from .waap_detailed_domain import WaapDetailedDomain as WaapDetailedDomain -from .waap_insight_silence import WaapInsightSilence as WaapInsightSilence -from .waap_insight_sort_by import WaapInsightSortBy as WaapInsightSortBy -from .waap_network_details import WaapNetworkDetails as WaapNetworkDetails -from .waap_request_details import WaapRequestDetails as WaapRequestDetails -from .waap_request_summary import WaapRequestSummary as WaapRequestSummary -from .waap_traffic_metrics import WaapTrafficMetrics as WaapTrafficMetrics -from .waap_count_statistics import WaapCountStatistics as WaapCountStatistics -from .waap_event_statistics import WaapEventStatistics as WaapEventStatistics -from .waap_rule_action_type import WaapRuleActionType as WaapRuleActionType -from .waap_captcha_page_data import WaapCaptchaPageData as WaapCaptchaPageData from .waap_ip_country_attack import WaapIPCountryAttack as WaapIPCountryAttack from .waap_statistics_series import WaapStatisticsSeries as WaapStatisticsSeries -from .waap_blocked_statistics import WaapBlockedStatistics as WaapBlockedStatistics from .waap_ip_ddos_info_model import WaapIPDDOSInfoModel as WaapIPDDOSInfoModel from .waap_time_series_attack import WaapTimeSeriesAttack as WaapTimeSeriesAttack -from .waap_user_agent_details import WaapUserAgentDetails as WaapUserAgentDetails from .organization_list_params import OrganizationListParams as OrganizationListParams from .waap_custom_page_preview import WaapCustomPagePreview as WaapCustomPagePreview -from .waap_customer_rule_state import WaapCustomerRuleState as WaapCustomerRuleState from .waap_domain_api_settings import WaapDomainAPISettings as WaapDomainAPISettings -from .waap_handshake_page_data import WaapHandshakePageData as WaapHandshakePageData -from .waap_paginated_ddos_info import WaapPaginatedDDOSInfo as WaapPaginatedDDOSInfo -from .waap_pattern_matched_tag import WaapPatternMatchedTag as WaapPatternMatchedTag -from .ip_info_get_counts_params import IPInfoGetCountsParams as IPInfoGetCountsParams -from .waap_block_csrf_page_data import WaapBlockCsrfPageData as WaapBlockCsrfPageData +from .insight_list_types_params import InsightListTypesParams as InsightListTypesParams from .waap_domain_ddos_settings import WaapDomainDDOSSettings as WaapDomainDDOSSettings -from .waap_request_organization import WaapRequestOrganization as WaapRequestOrganization -from .waap_block_page_data_param import WaapBlockPageDataParam as WaapBlockPageDataParam +from .ip_info_get_ip_info_params import IPInfoGetIPInfoParams as IPInfoGetIPInfoParams from .waap_domain_settings_model import WaapDomainSettingsModel as WaapDomainSettingsModel -from .waap_paginated_ddos_attack import WaapPaginatedDDOSAttack as WaapPaginatedDDOSAttack from .waap_rule_blocked_requests import WaapRuleBlockedRequests as WaapRuleBlockedRequests from .custom_page_set_list_params import CustomPageSetListParams as CustomPageSetListParams from .ip_info_get_top_urls_params import IPInfoGetTopURLsParams as IPInfoGetTopURLsParams -from .waap_captcha_page_data_param import WaapCaptchaPageDataParam as WaapCaptchaPageDataParam -from .waap_insight_silence_sort_by import WaapInsightSilenceSortBy as WaapInsightSilenceSortBy +from .ip_info_get_ip_info_response import IPInfoGetIPInfoResponse as IPInfoGetIPInfoResponse from .custom_page_set_create_params import CustomPageSetCreateParams as CustomPageSetCreateParams from .custom_page_set_update_params import CustomPageSetUpdateParams as CustomPageSetUpdateParams from .ip_info_get_top_urls_response import IPInfoGetTopURLsResponse as IPInfoGetTopURLsResponse from .waap_advanced_rule_descriptor import WaapAdvancedRuleDescriptor as WaapAdvancedRuleDescriptor from .custom_page_set_preview_params import CustomPageSetPreviewParams as CustomPageSetPreviewParams from .domain_list_rule_sets_response import DomainListRuleSetsResponse as DomainListRuleSetsResponse -from .waap_cookie_disabled_page_data import WaapCookieDisabledPageData as WaapCookieDisabledPageData -from .waap_handshake_page_data_param import WaapHandshakePageDataParam as WaapHandshakePageDataParam -from .waap_paginated_custom_page_set import WaapPaginatedCustomPageSet as WaapPaginatedCustomPageSet -from .waap_paginated_request_summary import WaapPaginatedRequestSummary as WaapPaginatedRequestSummary -from .ip_info_get_top_sessions_params import IPInfoGetTopSessionsParams as IPInfoGetTopSessionsParams -from .waap_block_csrf_page_data_param import WaapBlockCsrfPageDataParam as WaapBlockCsrfPageDataParam -from .ip_info_get_top_sessions_response import IPInfoGetTopSessionsResponse as IPInfoGetTopSessionsResponse from .statistic_get_usage_series_params import StatisticGetUsageSeriesParams as StatisticGetUsageSeriesParams from .ip_info_get_top_user_agents_params import IPInfoGetTopUserAgentsParams as IPInfoGetTopUserAgentsParams from .waap_advanced_rule_descriptor_list import WaapAdvancedRuleDescriptorList as WaapAdvancedRuleDescriptorList from .waap_get_account_overview_response import WaapGetAccountOverviewResponse as WaapGetAccountOverviewResponse -from .waap_javascript_disabled_page_data import WaapJavascriptDisabledPageData as WaapJavascriptDisabledPageData from .ip_info_get_blocked_requests_params import IPInfoGetBlockedRequestsParams as IPInfoGetBlockedRequestsParams from .ip_info_get_top_user_agents_response import IPInfoGetTopUserAgentsResponse as IPInfoGetTopUserAgentsResponse -from .waap_cookie_disabled_page_data_param import WaapCookieDisabledPageDataParam as WaapCookieDisabledPageDataParam +from .ip_info_get_top_user_sessions_params import IPInfoGetTopUserSessionsParams as IPInfoGetTopUserSessionsParams from .ip_info_get_attack_time_series_params import IPInfoGetAttackTimeSeriesParams as IPInfoGetAttackTimeSeriesParams from .ip_info_get_blocked_requests_response import IPInfoGetBlockedRequestsResponse as IPInfoGetBlockedRequestsResponse from .ip_info_get_ddos_attack_series_params import IPInfoGetDDOSAttackSeriesParams as IPInfoGetDDOSAttackSeriesParams +from .ip_info_get_top_user_sessions_response import IPInfoGetTopUserSessionsResponse as IPInfoGetTopUserSessionsResponse from .ip_info_list_attacked_countries_params import ( IPInfoListAttackedCountriesParams as IPInfoListAttackedCountriesParams, ) @@ -102,6 +57,3 @@ from .ip_info_list_attacked_countries_response import ( IPInfoListAttackedCountriesResponse as IPInfoListAttackedCountriesResponse, ) -from .waap_javascript_disabled_page_data_param import ( - WaapJavascriptDisabledPageDataParam as WaapJavascriptDisabledPageDataParam, -) diff --git a/src/gcore/types/waap/custom_page_set_create_params.py b/src/gcore/types/waap/custom_page_set_create_params.py index d23bfa30..89636eb5 100644 --- a/src/gcore/types/waap/custom_page_set_create_params.py +++ b/src/gcore/types/waap/custom_page_set_create_params.py @@ -5,31 +5,138 @@ from typing import Iterable, Optional from typing_extensions import Required, TypedDict -from .waap_block_page_data_param import WaapBlockPageDataParam -from .waap_captcha_page_data_param import WaapCaptchaPageDataParam -from .waap_handshake_page_data_param import WaapHandshakePageDataParam -from .waap_block_csrf_page_data_param import WaapBlockCsrfPageDataParam -from .waap_cookie_disabled_page_data_param import WaapCookieDisabledPageDataParam -from .waap_javascript_disabled_page_data_param import WaapJavascriptDisabledPageDataParam - -__all__ = ["CustomPageSetCreateParams"] +__all__ = [ + "CustomPageSetCreateParams", + "Block", + "BlockCsrf", + "Captcha", + "CookieDisabled", + "Handshake", + "JavascriptDisabled", +] class CustomPageSetCreateParams(TypedDict, total=False): name: Required[str] """Name of the custom page set""" - block: Optional[WaapBlockPageDataParam] + block: Optional[Block] - block_csrf: Optional[WaapBlockCsrfPageDataParam] + block_csrf: Optional[BlockCsrf] - captcha: Optional[WaapCaptchaPageDataParam] + captcha: Optional[Captcha] - cookie_disabled: Optional[WaapCookieDisabledPageDataParam] + cookie_disabled: Optional[CookieDisabled] domains: Optional[Iterable[int]] """List of domain IDs that are associated with this page set""" - handshake: Optional[WaapHandshakePageDataParam] + handshake: Optional[Handshake] + + javascript_disabled: Optional[JavascriptDisabled] + + +class Block(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + logo: str + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: str + """The text to display in the body of the custom page""" + + title: str + """The text to display in the title of the custom page""" + + +class BlockCsrf(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + logo: str + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: str + """The text to display in the body of the custom page""" + + title: str + """The text to display in the title of the custom page""" + + +class Captcha(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + error: str + """Error message""" + + header: str + """The text to display in the header of the custom page""" + + logo: str + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: str + """The text to display in the body of the custom page""" + + title: str + """The text to display in the title of the custom page""" + + +class CookieDisabled(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + text: str + """The text to display in the body of the custom page""" + + +class Handshake(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + logo: str + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + title: str + """The text to display in the title of the custom page""" + + +class JavascriptDisabled(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" - javascript_disabled: Optional[WaapJavascriptDisabledPageDataParam] + text: str + """The text to display in the body of the custom page""" diff --git a/src/gcore/types/waap/custom_page_set_preview_params.py b/src/gcore/types/waap/custom_page_set_preview_params.py index 668442b9..158b1a3a 100644 --- a/src/gcore/types/waap/custom_page_set_preview_params.py +++ b/src/gcore/types/waap/custom_page_set_preview_params.py @@ -3,15 +3,22 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Required, TypedDict - -from .waap_page_type import WaapPageType +from typing_extensions import Literal, Required, TypedDict __all__ = ["CustomPageSetPreviewParams"] class CustomPageSetPreviewParams(TypedDict, total=False): - page_type: Required[WaapPageType] + page_type: Required[ + Literal[ + "block.html", + "block_csrf.html", + "captcha.html", + "cookieDisabled.html", + "handshake.html", + "javascriptDisabled.html", + ] + ] """The type of the custom page""" error: Optional[str] diff --git a/src/gcore/types/waap/custom_page_set_update_params.py b/src/gcore/types/waap/custom_page_set_update_params.py index ca08a24a..44279a3e 100644 --- a/src/gcore/types/waap/custom_page_set_update_params.py +++ b/src/gcore/types/waap/custom_page_set_update_params.py @@ -3,33 +3,140 @@ from __future__ import annotations from typing import Iterable, Optional -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict -from .waap_block_page_data_param import WaapBlockPageDataParam -from .waap_captcha_page_data_param import WaapCaptchaPageDataParam -from .waap_handshake_page_data_param import WaapHandshakePageDataParam -from .waap_block_csrf_page_data_param import WaapBlockCsrfPageDataParam -from .waap_cookie_disabled_page_data_param import WaapCookieDisabledPageDataParam -from .waap_javascript_disabled_page_data_param import WaapJavascriptDisabledPageDataParam - -__all__ = ["CustomPageSetUpdateParams"] +__all__ = [ + "CustomPageSetUpdateParams", + "Block", + "BlockCsrf", + "Captcha", + "CookieDisabled", + "Handshake", + "JavascriptDisabled", +] class CustomPageSetUpdateParams(TypedDict, total=False): - block: Optional[WaapBlockPageDataParam] + block: Optional[Block] - block_csrf: Optional[WaapBlockCsrfPageDataParam] + block_csrf: Optional[BlockCsrf] - captcha: Optional[WaapCaptchaPageDataParam] + captcha: Optional[Captcha] - cookie_disabled: Optional[WaapCookieDisabledPageDataParam] + cookie_disabled: Optional[CookieDisabled] domains: Optional[Iterable[int]] """List of domain IDs that are associated with this page set""" - handshake: Optional[WaapHandshakePageDataParam] + handshake: Optional[Handshake] - javascript_disabled: Optional[WaapJavascriptDisabledPageDataParam] + javascript_disabled: Optional[JavascriptDisabled] name: Optional[str] """Name of the custom page set""" + + +class Block(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + logo: str + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: str + """The text to display in the body of the custom page""" + + title: str + """The text to display in the title of the custom page""" + + +class BlockCsrf(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + logo: str + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: str + """The text to display in the body of the custom page""" + + title: str + """The text to display in the title of the custom page""" + + +class Captcha(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + error: str + """Error message""" + + header: str + """The text to display in the header of the custom page""" + + logo: str + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: str + """The text to display in the body of the custom page""" + + title: str + """The text to display in the title of the custom page""" + + +class CookieDisabled(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + text: str + """The text to display in the body of the custom page""" + + +class Handshake(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + logo: str + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + title: str + """The text to display in the title of the custom page""" + + +class JavascriptDisabled(TypedDict, total=False): + enabled: Required[bool] + """Indicates whether the custom custom page is active or inactive""" + + header: str + """The text to display in the header of the custom page""" + + text: str + """The text to display in the body of the custom page""" diff --git a/src/gcore/types/waap/domain_list_params.py b/src/gcore/types/waap/domain_list_params.py index 9e3412ff..c0d65852 100644 --- a/src/gcore/types/waap/domain_list_params.py +++ b/src/gcore/types/waap/domain_list_params.py @@ -5,8 +5,6 @@ from typing import Iterable from typing_extensions import Literal, TypedDict -from .waap_domain_status import WaapDomainStatus - __all__ = ["DomainListParams"] @@ -26,5 +24,5 @@ class DomainListParams(TypedDict, total=False): ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] """Sort the response by given field.""" - status: WaapDomainStatus + status: Literal["active", "bypass", "monitor", "locked"] """The different statuses a domain can have""" diff --git a/src/gcore/types/waap/domains/__init__.py b/src/gcore/types/waap/domains/__init__.py index 396e620d..905ada2a 100644 --- a/src/gcore/types/waap/domains/__init__.py +++ b/src/gcore/types/waap/domains/__init__.py @@ -2,16 +2,30 @@ from __future__ import annotations +from .waap_insight import WaapInsight as WaapInsight +from .waap_task_id import WaapTaskID as WaapTaskID +from .waap_api_path import WaapAPIPath as WaapAPIPath +from .waap_ddos_info import WaapDDOSInfo as WaapDDOSInfo +from .waap_custom_rule import WaapCustomRule as WaapCustomRule +from .waap_ddos_attack import WaapDDOSAttack as WaapDDOSAttack +from .waap_advanced_rule import WaapAdvancedRule as WaapAdvancedRule +from .waap_firewall_rule import WaapFirewallRule as WaapFirewallRule +from .api_path_group_list import APIPathGroupList as APIPathGroupList from .insight_list_params import InsightListParams as InsightListParams from .api_path_list_params import APIPathListParams as APIPathListParams -from .api_path_get_response import APIPathGetResponse as APIPathGetResponse +from .waap_api_scan_result import WaapAPIScanResult as WaapAPIScanResult +from .waap_insight_silence import WaapInsightSilence as WaapInsightSilence +from .waap_request_details import WaapRequestDetails as WaapRequestDetails +from .waap_request_summary import WaapRequestSummary as WaapRequestSummary +from .waap_traffic_metrics import WaapTrafficMetrics as WaapTrafficMetrics from .setting_update_params import SettingUpdateParams as SettingUpdateParams +from .waap_count_statistics import WaapCountStatistics as WaapCountStatistics +from .waap_event_statistics import WaapEventStatistics as WaapEventStatistics from .api_path_create_params import APIPathCreateParams as APIPathCreateParams -from .api_path_list_response import APIPathListResponse as APIPathListResponse from .api_path_update_params import APIPathUpdateParams as APIPathUpdateParams from .insight_replace_params import InsightReplaceParams as InsightReplaceParams from .custom_rule_list_params import CustomRuleListParams as CustomRuleListParams -from .api_path_create_response import APIPathCreateResponse as APIPathCreateResponse +from .waap_blocked_statistics import WaapBlockedStatistics as WaapBlockedStatistics from .advanced_rule_list_params import AdvancedRuleListParams as AdvancedRuleListParams from .custom_rule_create_params import CustomRuleCreateParams as CustomRuleCreateParams from .custom_rule_update_params import CustomRuleUpdateParams as CustomRuleUpdateParams @@ -21,27 +35,23 @@ from .firewall_rule_create_params import FirewallRuleCreateParams as FirewallRuleCreateParams from .firewall_rule_update_params import FirewallRuleUpdateParams as FirewallRuleUpdateParams from .insight_silence_list_params import InsightSilenceListParams as InsightSilenceListParams -from .api_path_group_list_response import APIPathGroupListResponse as APIPathGroupListResponse +from .waap_api_discovery_settings import WaapAPIDiscoverySettings as WaapAPIDiscoverySettings from .insight_silence_create_params import InsightSilenceCreateParams as InsightSilenceCreateParams from .insight_silence_update_params import InsightSilenceUpdateParams as InsightSilenceUpdateParams -from .analytics_list_ddos_info_params import AnalyticsListDDOSInfoParams as AnalyticsListDDOSInfoParams -from .analytics_list_ddos_attacks_params import AnalyticsListDDOSAttacksParams as AnalyticsListDDOSAttacksParams +from .statistic_get_ddos_info_params import StatisticGetDDOSInfoParams as StatisticGetDDOSInfoParams +from .statistic_get_ddos_attacks_params import StatisticGetDDOSAttacksParams as StatisticGetDDOSAttacksParams from .custom_rule_delete_multiple_params import CustomRuleDeleteMultipleParams as CustomRuleDeleteMultipleParams -from .analytics_list_event_traffic_params import AnalyticsListEventTrafficParams as AnalyticsListEventTrafficParams -from .api_discovery_get_settings_response import APIDiscoveryGetSettingsResponse as APIDiscoveryGetSettingsResponse -from .api_discovery_scan_openapi_response import APIDiscoveryScanOpenAPIResponse as APIDiscoveryScanOpenAPIResponse from .api_discovery_upload_openapi_params import APIDiscoveryUploadOpenAPIParams as APIDiscoveryUploadOpenAPIParams +from .statistic_get_traffic_series_params import StatisticGetTrafficSeriesParams as StatisticGetTrafficSeriesParams from .api_discovery_update_settings_params import APIDiscoveryUpdateSettingsParams as APIDiscoveryUpdateSettingsParams from .firewall_rule_delete_multiple_params import FirewallRuleDeleteMultipleParams as FirewallRuleDeleteMultipleParams -from .analytics_get_event_statistics_params import ( - AnalyticsGetEventStatisticsParams as AnalyticsGetEventStatisticsParams, +from .statistic_get_requests_series_params import StatisticGetRequestsSeriesParams as StatisticGetRequestsSeriesParams +from .statistic_get_traffic_series_response import ( + StatisticGetTrafficSeriesResponse as StatisticGetTrafficSeriesResponse, ) -from .analytics_list_event_traffic_response import ( - AnalyticsListEventTrafficResponse as AnalyticsListEventTrafficResponse, +from .api_discovery_list_scan_results_params import ( + APIDiscoveryListScanResultsParams as APIDiscoveryListScanResultsParams, ) -from .api_discovery_upload_openapi_response import ( - APIDiscoveryUploadOpenAPIResponse as APIDiscoveryUploadOpenAPIResponse, -) -from .api_discovery_update_settings_response import ( - APIDiscoveryUpdateSettingsResponse as APIDiscoveryUpdateSettingsResponse, +from .statistic_get_events_aggregated_params import ( + StatisticGetEventsAggregatedParams as StatisticGetEventsAggregatedParams, ) diff --git a/src/gcore/types/waap/domains/advanced_rule_list_params.py b/src/gcore/types/waap/domains/advanced_rule_list_params.py index 32541fae..385857d7 100644 --- a/src/gcore/types/waap/domains/advanced_rule_list_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_list_params.py @@ -5,13 +5,11 @@ from typing import Optional from typing_extensions import Literal, TypedDict -from ..waap_rule_action_type import WaapRuleActionType - __all__ = ["AdvancedRuleListParams"] class AdvancedRuleListParams(TypedDict, total=False): - action: WaapRuleActionType + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] """Filter to refine results by specific actions""" description: str diff --git a/src/gcore/types/waap/domains/analytics/__init__.py b/src/gcore/types/waap/domains/analytics/__init__.py deleted file mode 100644 index b321e43b..00000000 --- a/src/gcore/types/waap/domains/analytics/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .request_list_params import RequestListParams as RequestListParams diff --git a/src/gcore/types/waap/domains/analytics_list_event_traffic_response.py b/src/gcore/types/waap/domains/analytics_list_event_traffic_response.py deleted file mode 100644 index 901d6f4e..00000000 --- a/src/gcore/types/waap/domains/analytics_list_event_traffic_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import TypeAlias - -from ..waap_traffic_metrics import WaapTrafficMetrics - -__all__ = ["AnalyticsListEventTrafficResponse"] - -AnalyticsListEventTrafficResponse: TypeAlias = List[WaapTrafficMetrics] diff --git a/src/gcore/types/waap/domains/api_discovery/__init__.py b/src/gcore/types/waap/domains/api_discovery/__init__.py deleted file mode 100644 index 15260eb6..00000000 --- a/src/gcore/types/waap/domains/api_discovery/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .scan_result_list_params import ScanResultListParams as ScanResultListParams -from .scan_result_get_response import ScanResultGetResponse as ScanResultGetResponse -from .scan_result_list_response import ScanResultListResponse as ScanResultListResponse diff --git a/src/gcore/types/waap/domains/api_discovery/scan_result_list_response.py b/src/gcore/types/waap/domains/api_discovery/scan_result_list_response.py deleted file mode 100644 index 81ec6ce9..00000000 --- a/src/gcore/types/waap/domains/api_discovery/scan_result_list_response.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ....._models import BaseModel - -__all__ = ["ScanResultListResponse"] - - -class ScanResultListResponse(BaseModel): - id: str - """The scan ID""" - - end_time: Optional[datetime] = None - """The date and time the scan ended""" - - message: str - """The message associated with the scan""" - - start_time: datetime - """The date and time the scan started""" - - status: Literal["SUCCESS", "FAILURE", "IN_PROGRESS"] - """The different statuses a task result can have""" - - type: Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"] - """The different types of scans that can be performed""" diff --git a/src/gcore/types/waap/domains/api_discovery/scan_result_list_params.py b/src/gcore/types/waap/domains/api_discovery_list_scan_results_params.py similarity index 89% rename from src/gcore/types/waap/domains/api_discovery/scan_result_list_params.py rename to src/gcore/types/waap/domains/api_discovery_list_scan_results_params.py index 5909c8a8..51007c19 100644 --- a/src/gcore/types/waap/domains/api_discovery/scan_result_list_params.py +++ b/src/gcore/types/waap/domains/api_discovery_list_scan_results_params.py @@ -5,10 +5,10 @@ from typing import Optional from typing_extensions import Literal, TypedDict -__all__ = ["ScanResultListParams"] +__all__ = ["APIDiscoveryListScanResultsParams"] -class ScanResultListParams(TypedDict, total=False): +class APIDiscoveryListScanResultsParams(TypedDict, total=False): limit: int """Number of items to return""" diff --git a/src/gcore/types/waap/domains/api_discovery_update_settings_response.py b/src/gcore/types/waap/domains/api_discovery_update_settings_response.py deleted file mode 100644 index 6663e47d..00000000 --- a/src/gcore/types/waap/domains/api_discovery_update_settings_response.py +++ /dev/null @@ -1,36 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = ["APIDiscoveryUpdateSettingsResponse"] - - -class APIDiscoveryUpdateSettingsResponse(BaseModel): - description_file_location: Optional[str] = FieldInfo(alias="descriptionFileLocation", default=None) - """The URL of the API description file. - - This will be periodically scanned if `descriptionFileScanEnabled` is enabled. - Supported formats are YAML and JSON, and it must adhere to OpenAPI versions 2, - 3, or 3.1. - """ - - description_file_scan_enabled: Optional[bool] = FieldInfo(alias="descriptionFileScanEnabled", default=None) - """Indicates if periodic scan of the description file is enabled""" - - description_file_scan_interval_hours: Optional[int] = FieldInfo( - alias="descriptionFileScanIntervalHours", default=None - ) - """The interval in hours for scanning the description file""" - - traffic_scan_enabled: Optional[bool] = FieldInfo(alias="trafficScanEnabled", default=None) - """Indicates if traffic scan is enabled. - - Traffic scan is used to discover undocumented APIs - """ - - traffic_scan_interval_hours: Optional[int] = FieldInfo(alias="trafficScanIntervalHours", default=None) - """The interval in hours for scanning the traffic""" diff --git a/src/gcore/types/waap/domains/api_discovery_upload_openapi_response.py b/src/gcore/types/waap/domains/api_discovery_upload_openapi_response.py deleted file mode 100644 index 718569a8..00000000 --- a/src/gcore/types/waap/domains/api_discovery_upload_openapi_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ...._models import BaseModel - -__all__ = ["APIDiscoveryUploadOpenAPIResponse"] - - -class APIDiscoveryUploadOpenAPIResponse(BaseModel): - id: str - """The task ID""" diff --git a/src/gcore/types/waap/domains/api_path_create_response.py b/src/gcore/types/waap/domains/api_path_create_response.py deleted file mode 100644 index 2c51e410..00000000 --- a/src/gcore/types/waap/domains/api_path_create_response.py +++ /dev/null @@ -1,50 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["APIPathCreateResponse"] - - -class APIPathCreateResponse(BaseModel): - id: str - """The path ID""" - - api_groups: List[str] - """An array of api groups associated with the API path""" - - api_version: str - """The API version""" - - first_detected: datetime - """The date and time in ISO 8601 format the API path was first detected.""" - - http_scheme: Literal["HTTP", "HTTPS"] - """The different HTTP schemes an API path can have""" - - last_detected: datetime - """The date and time in ISO 8601 format the API path was last detected.""" - - method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"] - """The different methods an API path can have""" - - path: str - """ - The API path, locations that are saved for resource IDs will be put in curly - brackets - """ - - request_count: int - """The number of requests for this path in the last 24 hours""" - - source: Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"] - """The different sources an API path can have""" - - status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] - """The different statuses an API path can have""" - - tags: List[str] - """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/api_path_group_list_response.py b/src/gcore/types/waap/domains/api_path_group_list.py similarity index 74% rename from src/gcore/types/waap/domains/api_path_group_list_response.py rename to src/gcore/types/waap/domains/api_path_group_list.py index 959c76c1..6ecc6b55 100644 --- a/src/gcore/types/waap/domains/api_path_group_list_response.py +++ b/src/gcore/types/waap/domains/api_path_group_list.py @@ -4,9 +4,9 @@ from ...._models import BaseModel -__all__ = ["APIPathGroupListResponse"] +__all__ = ["APIPathGroupList"] -class APIPathGroupListResponse(BaseModel): +class APIPathGroupList(BaseModel): api_path_groups: List[str] """An array of api groups associated with the API path""" diff --git a/src/gcore/types/waap/domains/api_path_list_response.py b/src/gcore/types/waap/domains/api_path_list_response.py deleted file mode 100644 index 49467f2e..00000000 --- a/src/gcore/types/waap/domains/api_path_list_response.py +++ /dev/null @@ -1,50 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from datetime import datetime -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["APIPathListResponse"] - - -class APIPathListResponse(BaseModel): - id: str - """The path ID""" - - api_groups: List[str] - """An array of api groups associated with the API path""" - - api_version: str - """The API version""" - - first_detected: datetime - """The date and time in ISO 8601 format the API path was first detected.""" - - http_scheme: Literal["HTTP", "HTTPS"] - """The different HTTP schemes an API path can have""" - - last_detected: datetime - """The date and time in ISO 8601 format the API path was last detected.""" - - method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"] - """The different methods an API path can have""" - - path: str - """ - The API path, locations that are saved for resource IDs will be put in curly - brackets - """ - - request_count: int - """The number of requests for this path in the last 24 hours""" - - source: Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"] - """The different sources an API path can have""" - - status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] - """The different statuses an API path can have""" - - tags: List[str] - """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/custom_rule_list_params.py b/src/gcore/types/waap/domains/custom_rule_list_params.py index 3c3dd780..876668ca 100644 --- a/src/gcore/types/waap/domains/custom_rule_list_params.py +++ b/src/gcore/types/waap/domains/custom_rule_list_params.py @@ -5,13 +5,11 @@ from typing import Optional from typing_extensions import Literal, TypedDict -from ..waap_rule_action_type import WaapRuleActionType - __all__ = ["CustomRuleListParams"] class CustomRuleListParams(TypedDict, total=False): - action: WaapRuleActionType + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] """Filter to refine results by specific actions""" description: str diff --git a/src/gcore/types/waap/domains/insight_list_params.py b/src/gcore/types/waap/domains/insight_list_params.py index 669c37ef..d0f6c156 100644 --- a/src/gcore/types/waap/domains/insight_list_params.py +++ b/src/gcore/types/waap/domains/insight_list_params.py @@ -3,10 +3,7 @@ from __future__ import annotations from typing import List, Optional -from typing_extensions import TypedDict - -from ..waap_insight_status import WaapInsightStatus -from ..waap_insight_sort_by import WaapInsightSortBy +from typing_extensions import Literal, TypedDict __all__ = ["InsightListParams"] @@ -27,8 +24,21 @@ class InsightListParams(TypedDict, total=False): offset: int """Number of items to skip""" - ordering: WaapInsightSortBy + ordering: Literal[ + "id", + "-id", + "insight_type", + "-insight_type", + "first_seen", + "-first_seen", + "last_seen", + "-last_seen", + "last_status_change", + "-last_status_change", + "status", + "-status", + ] """Sort the response by given field.""" - status: Optional[List[WaapInsightStatus]] + status: Optional[List[Literal["OPEN", "ACKED", "CLOSED"]]] """The status of the insight""" diff --git a/src/gcore/types/waap/domains/insight_replace_params.py b/src/gcore/types/waap/domains/insight_replace_params.py index ba1d1eb4..18ded249 100644 --- a/src/gcore/types/waap/domains/insight_replace_params.py +++ b/src/gcore/types/waap/domains/insight_replace_params.py @@ -2,9 +2,7 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict - -from ..waap_insight_status import WaapInsightStatus +from typing_extensions import Literal, Required, TypedDict __all__ = ["InsightReplaceParams"] @@ -13,5 +11,5 @@ class InsightReplaceParams(TypedDict, total=False): domain_id: Required[int] """The domain ID""" - status: Required[WaapInsightStatus] + status: Required[Literal["OPEN", "ACKED", "CLOSED"]] """The different statuses an insight can have""" diff --git a/src/gcore/types/waap/domains/insight_silence_list_params.py b/src/gcore/types/waap/domains/insight_silence_list_params.py index e84a8e05..b36d9315 100644 --- a/src/gcore/types/waap/domains/insight_silence_list_params.py +++ b/src/gcore/types/waap/domains/insight_silence_list_params.py @@ -3,9 +3,7 @@ from __future__ import annotations from typing import List, Optional -from typing_extensions import TypedDict - -from ..waap_insight_silence_sort_by import WaapInsightSilenceSortBy +from typing_extensions import Literal, TypedDict __all__ = ["InsightSilenceListParams"] @@ -29,5 +27,16 @@ class InsightSilenceListParams(TypedDict, total=False): offset: int """Number of items to skip""" - ordering: WaapInsightSilenceSortBy + ordering: Literal[ + "id", + "-id", + "insight_type", + "-insight_type", + "comment", + "-comment", + "author", + "-author", + "expire_at", + "-expire_at", + ] """Sort the response by given field.""" diff --git a/src/gcore/types/waap/domains/analytics_list_ddos_attacks_params.py b/src/gcore/types/waap/domains/statistic_get_ddos_attacks_params.py similarity index 88% rename from src/gcore/types/waap/domains/analytics_list_ddos_attacks_params.py rename to src/gcore/types/waap/domains/statistic_get_ddos_attacks_params.py index b1a39e3a..d56610af 100644 --- a/src/gcore/types/waap/domains/analytics_list_ddos_attacks_params.py +++ b/src/gcore/types/waap/domains/statistic_get_ddos_attacks_params.py @@ -8,10 +8,10 @@ from ...._utils import PropertyInfo -__all__ = ["AnalyticsListDDOSAttacksParams"] +__all__ = ["StatisticGetDDOSAttacksParams"] -class AnalyticsListDDOSAttacksParams(TypedDict, total=False): +class StatisticGetDDOSAttacksParams(TypedDict, total=False): end_time: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """Filter attacks up to a specified end date in ISO 8601 format""" diff --git a/src/gcore/types/waap/domains/analytics_list_ddos_info_params.py b/src/gcore/types/waap/domains/statistic_get_ddos_info_params.py similarity index 89% rename from src/gcore/types/waap/domains/analytics_list_ddos_info_params.py rename to src/gcore/types/waap/domains/statistic_get_ddos_info_params.py index d6d1246d..399c4044 100644 --- a/src/gcore/types/waap/domains/analytics_list_ddos_info_params.py +++ b/src/gcore/types/waap/domains/statistic_get_ddos_info_params.py @@ -8,10 +8,10 @@ from ...._utils import PropertyInfo -__all__ = ["AnalyticsListDDOSInfoParams"] +__all__ = ["StatisticGetDDOSInfoParams"] -class AnalyticsListDDOSInfoParams(TypedDict, total=False): +class StatisticGetDDOSInfoParams(TypedDict, total=False): group_by: Required[Literal["URL", "User-Agent", "IP"]] """The identity of the requests to group by""" diff --git a/src/gcore/types/waap/domains/analytics_get_event_statistics_params.py b/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py similarity index 90% rename from src/gcore/types/waap/domains/analytics_get_event_statistics_params.py rename to src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py index d3a32dfb..cdf4b82d 100644 --- a/src/gcore/types/waap/domains/analytics_get_event_statistics_params.py +++ b/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py @@ -8,10 +8,10 @@ from ...._utils import PropertyInfo -__all__ = ["AnalyticsGetEventStatisticsParams"] +__all__ = ["StatisticGetEventsAggregatedParams"] -class AnalyticsGetEventStatisticsParams(TypedDict, total=False): +class StatisticGetEventsAggregatedParams(TypedDict, total=False): start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """Filter traffic starting from a specified date in ISO 8601 format""" diff --git a/src/gcore/types/waap/domains/analytics/request_list_params.py b/src/gcore/types/waap/domains/statistic_get_requests_series_params.py similarity index 65% rename from src/gcore/types/waap/domains/analytics/request_list_params.py rename to src/gcore/types/waap/domains/statistic_get_requests_series_params.py index 32df05dc..6007c368 100644 --- a/src/gcore/types/waap/domains/analytics/request_list_params.py +++ b/src/gcore/types/waap/domains/statistic_get_requests_series_params.py @@ -6,13 +6,12 @@ from datetime import datetime from typing_extensions import Literal, Required, Annotated, TypedDict -from ....._utils import PropertyInfo -from ...waap_traffic_type import WaapTrafficType +from ...._utils import PropertyInfo -__all__ = ["RequestListParams"] +__all__ = ["StatisticGetRequestsSeriesParams"] -class RequestListParams(TypedDict, total=False): +class StatisticGetRequestsSeriesParams(TypedDict, total=False): start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """Filter traffic starting from a specified date in ISO 8601 format""" @@ -49,5 +48,28 @@ class RequestListParams(TypedDict, total=False): status_code: int """Filter the response by response code.""" - traffic_types: List[WaapTrafficType] + traffic_types: List[ + Literal[ + "policy_allowed", + "policy_blocked", + "custom_rule_allowed", + "custom_blocked", + "legit_requests", + "sanctioned", + "dynamic", + "api", + "static", + "ajax", + "redirects", + "monitor", + "err_40x", + "err_50x", + "passed_to_origin", + "timeout", + "other", + "ddos", + "legit", + "monitored", + ] + ] """Filter the response by traffic types.""" diff --git a/src/gcore/types/waap/domains/analytics_list_event_traffic_params.py b/src/gcore/types/waap/domains/statistic_get_traffic_series_params.py similarity index 71% rename from src/gcore/types/waap/domains/analytics_list_event_traffic_params.py rename to src/gcore/types/waap/domains/statistic_get_traffic_series_params.py index af582492..11bb32df 100644 --- a/src/gcore/types/waap/domains/analytics_list_event_traffic_params.py +++ b/src/gcore/types/waap/domains/statistic_get_traffic_series_params.py @@ -4,16 +4,15 @@ from typing import Union from datetime import datetime -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from ...._utils import PropertyInfo -from ..waap_resolution import WaapResolution -__all__ = ["AnalyticsListEventTrafficParams"] +__all__ = ["StatisticGetTrafficSeriesParams"] -class AnalyticsListEventTrafficParams(TypedDict, total=False): - resolution: Required[WaapResolution] +class StatisticGetTrafficSeriesParams(TypedDict, total=False): + resolution: Required[Literal["daily", "hourly", "minutely"]] """Specifies the granularity of the result data.""" start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] diff --git a/src/gcore/types/waap/domains/statistic_get_traffic_series_response.py b/src/gcore/types/waap/domains/statistic_get_traffic_series_response.py new file mode 100644 index 00000000..2be7468d --- /dev/null +++ b/src/gcore/types/waap/domains/statistic_get_traffic_series_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .waap_traffic_metrics import WaapTrafficMetrics + +__all__ = ["StatisticGetTrafficSeriesResponse"] + +StatisticGetTrafficSeriesResponse: TypeAlias = List[WaapTrafficMetrics] diff --git a/src/gcore/types/waap/waap_advanced_rule.py b/src/gcore/types/waap/domains/waap_advanced_rule.py similarity index 98% rename from src/gcore/types/waap/waap_advanced_rule.py rename to src/gcore/types/waap/domains/waap_advanced_rule.py index 155ddeab..5b6d5d07 100644 --- a/src/gcore/types/waap/waap_advanced_rule.py +++ b/src/gcore/types/waap/domains/waap_advanced_rule.py @@ -3,7 +3,7 @@ from typing import List, Optional from typing_extensions import Literal -from ..._models import BaseModel +from ...._models import BaseModel __all__ = ["WaapAdvancedRule", "Action", "ActionBlock", "ActionTag"] diff --git a/src/gcore/types/waap/domains/api_discovery_get_settings_response.py b/src/gcore/types/waap/domains/waap_api_discovery_settings.py similarity index 93% rename from src/gcore/types/waap/domains/api_discovery_get_settings_response.py rename to src/gcore/types/waap/domains/waap_api_discovery_settings.py index 8150c267..efcf0a0d 100644 --- a/src/gcore/types/waap/domains/api_discovery_get_settings_response.py +++ b/src/gcore/types/waap/domains/waap_api_discovery_settings.py @@ -6,10 +6,10 @@ from ...._models import BaseModel -__all__ = ["APIDiscoveryGetSettingsResponse"] +__all__ = ["WaapAPIDiscoverySettings"] -class APIDiscoveryGetSettingsResponse(BaseModel): +class WaapAPIDiscoverySettings(BaseModel): 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/api_path_get_response.py b/src/gcore/types/waap/domains/waap_api_path.py similarity index 95% rename from src/gcore/types/waap/domains/api_path_get_response.py rename to src/gcore/types/waap/domains/waap_api_path.py index 600dfb44..5b4622d1 100644 --- a/src/gcore/types/waap/domains/api_path_get_response.py +++ b/src/gcore/types/waap/domains/waap_api_path.py @@ -6,10 +6,10 @@ from ...._models import BaseModel -__all__ = ["APIPathGetResponse"] +__all__ = ["WaapAPIPath"] -class APIPathGetResponse(BaseModel): +class WaapAPIPath(BaseModel): id: str """The path ID""" diff --git a/src/gcore/types/waap/domains/api_discovery/scan_result_get_response.py b/src/gcore/types/waap/domains/waap_api_scan_result.py similarity index 85% rename from src/gcore/types/waap/domains/api_discovery/scan_result_get_response.py rename to src/gcore/types/waap/domains/waap_api_scan_result.py index 18b5bf69..408230c8 100644 --- a/src/gcore/types/waap/domains/api_discovery/scan_result_get_response.py +++ b/src/gcore/types/waap/domains/waap_api_scan_result.py @@ -4,12 +4,12 @@ from datetime import datetime from typing_extensions import Literal -from ....._models import BaseModel +from ...._models import BaseModel -__all__ = ["ScanResultGetResponse"] +__all__ = ["WaapAPIScanResult"] -class ScanResultGetResponse(BaseModel): +class WaapAPIScanResult(BaseModel): id: str """The scan ID""" diff --git a/src/gcore/types/waap/waap_blocked_statistics.py b/src/gcore/types/waap/domains/waap_blocked_statistics.py similarity index 96% rename from src/gcore/types/waap/waap_blocked_statistics.py rename to src/gcore/types/waap/domains/waap_blocked_statistics.py index 2a4259df..ae06354b 100644 --- a/src/gcore/types/waap/waap_blocked_statistics.py +++ b/src/gcore/types/waap/domains/waap_blocked_statistics.py @@ -2,7 +2,7 @@ from typing import List, Union -from ..._models import BaseModel +from ...._models import BaseModel __all__ = ["WaapBlockedStatistics"] diff --git a/src/gcore/types/waap/waap_count_statistics.py b/src/gcore/types/waap/domains/waap_count_statistics.py similarity index 96% rename from src/gcore/types/waap/waap_count_statistics.py rename to src/gcore/types/waap/domains/waap_count_statistics.py index 6ae022a2..eea255ff 100644 --- a/src/gcore/types/waap/waap_count_statistics.py +++ b/src/gcore/types/waap/domains/waap_count_statistics.py @@ -2,7 +2,7 @@ from typing import List, Union -from ..._models import BaseModel +from ...._models import BaseModel __all__ = ["WaapCountStatistics"] diff --git a/src/gcore/types/waap/waap_custom_rule.py b/src/gcore/types/waap/domains/waap_custom_rule.py similarity index 99% rename from src/gcore/types/waap/waap_custom_rule.py rename to src/gcore/types/waap/domains/waap_custom_rule.py index af09b4dd..3ee80d02 100644 --- a/src/gcore/types/waap/waap_custom_rule.py +++ b/src/gcore/types/waap/domains/waap_custom_rule.py @@ -3,7 +3,7 @@ from typing import List, Optional from typing_extensions import Literal -from ..._models import BaseModel +from ...._models import BaseModel __all__ = [ "WaapCustomRule", diff --git a/src/gcore/types/waap/waap_ddos_attack.py b/src/gcore/types/waap/domains/waap_ddos_attack.py similarity index 91% rename from src/gcore/types/waap/waap_ddos_attack.py rename to src/gcore/types/waap/domains/waap_ddos_attack.py index f53bef72..fe777348 100644 --- a/src/gcore/types/waap/waap_ddos_attack.py +++ b/src/gcore/types/waap/domains/waap_ddos_attack.py @@ -3,7 +3,7 @@ from typing import Optional from datetime import datetime -from ..._models import BaseModel +from ...._models import BaseModel __all__ = ["WaapDDOSAttack"] diff --git a/src/gcore/types/waap/waap_ddos_info.py b/src/gcore/types/waap/domains/waap_ddos_info.py similarity index 91% rename from src/gcore/types/waap/waap_ddos_info.py rename to src/gcore/types/waap/domains/waap_ddos_info.py index 5c1f59ca..2633e56d 100644 --- a/src/gcore/types/waap/waap_ddos_info.py +++ b/src/gcore/types/waap/domains/waap_ddos_info.py @@ -2,7 +2,7 @@ from typing_extensions import Literal -from ..._models import BaseModel +from ...._models import BaseModel __all__ = ["WaapDDOSInfo"] diff --git a/src/gcore/types/waap/waap_event_statistics.py b/src/gcore/types/waap/domains/waap_event_statistics.py similarity index 93% rename from src/gcore/types/waap/waap_event_statistics.py rename to src/gcore/types/waap/domains/waap_event_statistics.py index a85f6393..26f34fba 100644 --- a/src/gcore/types/waap/waap_event_statistics.py +++ b/src/gcore/types/waap/domains/waap_event_statistics.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from ..._models import BaseModel +from ...._models import BaseModel from .waap_count_statistics import WaapCountStatistics from .waap_blocked_statistics import WaapBlockedStatistics diff --git a/src/gcore/types/waap/waap_firewall_rule.py b/src/gcore/types/waap/domains/waap_firewall_rule.py similarity index 98% rename from src/gcore/types/waap/waap_firewall_rule.py rename to src/gcore/types/waap/domains/waap_firewall_rule.py index fb36614b..88deda6e 100644 --- a/src/gcore/types/waap/waap_firewall_rule.py +++ b/src/gcore/types/waap/domains/waap_firewall_rule.py @@ -3,7 +3,7 @@ from typing import List, Optional from typing_extensions import Literal -from ..._models import BaseModel +from ...._models import BaseModel __all__ = ["WaapFirewallRule", "Action", "ActionBlock", "Condition", "ConditionIP", "ConditionIPRange"] diff --git a/src/gcore/types/waap/waap_insight.py b/src/gcore/types/waap/domains/waap_insight.py similarity index 89% rename from src/gcore/types/waap/waap_insight.py rename to src/gcore/types/waap/domains/waap_insight.py index 6300f15a..9beca2a1 100644 --- a/src/gcore/types/waap/waap_insight.py +++ b/src/gcore/types/waap/domains/waap_insight.py @@ -2,9 +2,9 @@ from typing import Dict from datetime import datetime +from typing_extensions import Literal -from ..._models import BaseModel -from .waap_insight_status import WaapInsightStatus +from ...._models import BaseModel __all__ = ["WaapInsight"] @@ -34,5 +34,5 @@ class WaapInsight(BaseModel): recommendation: str """The recommended action to perform to resolve the insight""" - status: WaapInsightStatus + status: Literal["OPEN", "ACKED", "CLOSED"] """The different statuses an insight can have""" diff --git a/src/gcore/types/waap/waap_insight_silence.py b/src/gcore/types/waap/domains/waap_insight_silence.py similarity index 95% rename from src/gcore/types/waap/waap_insight_silence.py rename to src/gcore/types/waap/domains/waap_insight_silence.py index f2949cde..de1a7522 100644 --- a/src/gcore/types/waap/waap_insight_silence.py +++ b/src/gcore/types/waap/domains/waap_insight_silence.py @@ -3,7 +3,7 @@ from typing import Dict, Optional from datetime import datetime -from ..._models import BaseModel +from ...._models import BaseModel __all__ = ["WaapInsightSilence"] diff --git a/src/gcore/types/waap/domains/waap_request_details.py b/src/gcore/types/waap/domains/waap_request_details.py new file mode 100644 index 00000000..29b4b30c --- /dev/null +++ b/src/gcore/types/waap/domains/waap_request_details.py @@ -0,0 +1,185 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["WaapRequestDetails", "CommonTag", "Network", "NetworkOrganization", "PatternMatchedTag", "UserAgent"] + + +class CommonTag(BaseModel): + description: str + """Tag description information""" + + display_name: str + """The tag's display name""" + + tag: str + """Tag name""" + + +class NetworkOrganization(BaseModel): + name: str + """Organization name""" + + subnet: str + """Network range""" + + +class Network(BaseModel): + client_ip: str + """Client IP""" + + country: str + """Country code""" + + organization: NetworkOrganization + """Organization details""" + + +class PatternMatchedTag(BaseModel): + description: str + """Tag description information""" + + display_name: str + """The tag's display name""" + + execution_phase: str + """ + The phase in which the tag was triggered: access -> Request, `header_filter` -> + `response_header`, `body_filter` -> `response_body` + """ + + field: str + """The entity to which the variable that triggered the tag belong to. + + For example: `request_headers`, uri, cookies etc. + """ + + field_name: str + """The name of the variable which holds the value that triggered the tag""" + + pattern_name: str + """The name of the detected regexp pattern""" + + pattern_value: str + """The pattern which triggered the tag""" + + tag: str + """Tag name""" + + +class UserAgent(BaseModel): + base_browser: str + """User agent browser""" + + base_browser_version: str + """User agent browser version""" + + client: str + """Client from User agent header""" + + client_type: str + """User agent client type""" + + client_version: str + """User agent client version""" + + cpu: str + """User agent cpu""" + + device: str + """User agent device""" + + device_type: str + """User agent device type""" + + full_string: str + """User agent""" + + os: str + """User agent os""" + + rendering_engine: str + """User agent engine""" + + +class WaapRequestDetails(BaseModel): + id: str + """Request ID""" + + action: str + """Request action""" + + common_tags: List[CommonTag] + """List of common tags""" + + content_type: str + """Content type of request""" + + domain: str + """Domain name""" + + http_status_code: int + """Status code for http request""" + + http_version: str + """HTTP version of request""" + + incident_id: str + """ID of challenge that was generated""" + + method: str + """Request method""" + + network: Network + """Network details""" + + path: str + """Request path""" + + pattern_matched_tags: List[PatternMatchedTag] + """List of shield tags""" + + query_string: str + """The query string of the request""" + + reference_id: str + """Reference ID to identify user sanction""" + + request_headers: object + """HTTP request headers""" + + request_time: str + """The time of the request""" + + request_type: str + """The type of the request that generated an event""" + + requested_domain: str + """The real domain name""" + + response_time: str + """Time took to process all request""" + + result: Literal["passed", "blocked", "suppressed", ""] + """The result of a request""" + + rule_id: str + """ID of the triggered rule""" + + rule_name: str + """Name of the triggered rule""" + + scheme: str + """The HTTP scheme of the request that generated an event""" + + session_request_count: str + """The number requests in session""" + + traffic_types: List[str] + """List of traffic types""" + + user_agent: UserAgent + """User agent details""" diff --git a/src/gcore/types/waap/waap_request_summary.py b/src/gcore/types/waap/domains/waap_request_summary.py similarity index 97% rename from src/gcore/types/waap/waap_request_summary.py rename to src/gcore/types/waap/domains/waap_request_summary.py index 4588e14e..f82873b7 100644 --- a/src/gcore/types/waap/waap_request_summary.py +++ b/src/gcore/types/waap/domains/waap_request_summary.py @@ -2,7 +2,7 @@ from typing_extensions import Literal -from ..._models import BaseModel +from ...._models import BaseModel __all__ = ["WaapRequestSummary"] diff --git a/src/gcore/types/waap/domains/api_discovery_scan_openapi_response.py b/src/gcore/types/waap/domains/waap_task_id.py similarity index 62% rename from src/gcore/types/waap/domains/api_discovery_scan_openapi_response.py rename to src/gcore/types/waap/domains/waap_task_id.py index 3b719073..97b9d44b 100644 --- a/src/gcore/types/waap/domains/api_discovery_scan_openapi_response.py +++ b/src/gcore/types/waap/domains/waap_task_id.py @@ -2,9 +2,9 @@ from ...._models import BaseModel -__all__ = ["APIDiscoveryScanOpenAPIResponse"] +__all__ = ["WaapTaskID"] -class APIDiscoveryScanOpenAPIResponse(BaseModel): +class WaapTaskID(BaseModel): id: str """The task ID""" diff --git a/src/gcore/types/waap/waap_traffic_metrics.py b/src/gcore/types/waap/domains/waap_traffic_metrics.py similarity index 98% rename from src/gcore/types/waap/waap_traffic_metrics.py rename to src/gcore/types/waap/domains/waap_traffic_metrics.py index 8b638066..072e1366 100644 --- a/src/gcore/types/waap/waap_traffic_metrics.py +++ b/src/gcore/types/waap/domains/waap_traffic_metrics.py @@ -4,7 +4,7 @@ from pydantic import Field as FieldInfo -from ..._models import BaseModel +from ...._models import BaseModel __all__ = ["WaapTrafficMetrics"] diff --git a/src/gcore/types/waap/insight_list_types_params.py b/src/gcore/types/waap/insight_list_types_params.py new file mode 100644 index 00000000..534f2cc2 --- /dev/null +++ b/src/gcore/types/waap/insight_list_types_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["InsightListTypesParams"] + + +class InsightListTypesParams(TypedDict, total=False): + insight_frequency: Optional[int] + """Filter by the frequency of the insight type""" + + limit: int + """Number of items to return""" + + name: Optional[str] + """Filter by the name of the insight type""" + + offset: int + """Number of items to skip""" + + ordering: Literal["name", "-name", "slug", "-slug", "insight_frequency", "-insight_frequency"] + """Sort the response by given field.""" + + slug: Optional[str] + """Filter by the slug of the insight type""" diff --git a/src/gcore/types/waap/ip_info/__init__.py b/src/gcore/types/waap/ip_info/__init__.py new file mode 100644 index 00000000..ed4c6baa --- /dev/null +++ b/src/gcore/types/waap/ip_info/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .metric_list_params import MetricListParams as MetricListParams +from .waap_ip_info_counts import WaapIPInfoCounts as WaapIPInfoCounts diff --git a/src/gcore/types/waap/ip_info_get_counts_params.py b/src/gcore/types/waap/ip_info/metric_list_params.py similarity index 84% rename from src/gcore/types/waap/ip_info_get_counts_params.py rename to src/gcore/types/waap/ip_info/metric_list_params.py index 47f90484..bfa030d6 100644 --- a/src/gcore/types/waap/ip_info_get_counts_params.py +++ b/src/gcore/types/waap/ip_info/metric_list_params.py @@ -5,10 +5,10 @@ from typing import Optional from typing_extensions import Required, TypedDict -__all__ = ["IPInfoGetCountsParams"] +__all__ = ["MetricListParams"] -class IPInfoGetCountsParams(TypedDict, total=False): +class MetricListParams(TypedDict, total=False): ip: Required[str] """The IP address to check""" diff --git a/src/gcore/types/waap/waap_ip_info_counts.py b/src/gcore/types/waap/ip_info/waap_ip_info_counts.py similarity index 92% rename from src/gcore/types/waap/waap_ip_info_counts.py rename to src/gcore/types/waap/ip_info/waap_ip_info_counts.py index a5a1ab97..7f1229fd 100644 --- a/src/gcore/types/waap/waap_ip_info_counts.py +++ b/src/gcore/types/waap/ip_info/waap_ip_info_counts.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from ..._models import BaseModel +from ...._models import BaseModel __all__ = ["WaapIPInfoCounts"] diff --git a/src/gcore/types/waap/ip_info_get_params.py b/src/gcore/types/waap/ip_info_get_ip_info_params.py similarity index 72% rename from src/gcore/types/waap/ip_info_get_params.py rename to src/gcore/types/waap/ip_info_get_ip_info_params.py index 41da0961..549abb8b 100644 --- a/src/gcore/types/waap/ip_info_get_params.py +++ b/src/gcore/types/waap/ip_info_get_ip_info_params.py @@ -4,9 +4,9 @@ from typing_extensions import Required, TypedDict -__all__ = ["IPInfoGetParams"] +__all__ = ["IPInfoGetIPInfoParams"] -class IPInfoGetParams(TypedDict, total=False): +class IPInfoGetIPInfoParams(TypedDict, total=False): ip: Required[str] """The IP address to check""" diff --git a/src/gcore/types/waap/waap_ip_info.py b/src/gcore/types/waap/ip_info_get_ip_info_response.py similarity index 93% rename from src/gcore/types/waap/waap_ip_info.py rename to src/gcore/types/waap/ip_info_get_ip_info_response.py index 741e7e2f..82fc8e8d 100644 --- a/src/gcore/types/waap/waap_ip_info.py +++ b/src/gcore/types/waap/ip_info_get_ip_info_response.py @@ -5,7 +5,7 @@ from ..._models import BaseModel -__all__ = ["WaapIPInfo", "Whois"] +__all__ = ["IPInfoGetIPInfoResponse", "Whois"] class Whois(BaseModel): @@ -46,7 +46,7 @@ class Whois(BaseModel): """The state""" -class WaapIPInfo(BaseModel): +class IPInfoGetIPInfoResponse(BaseModel): risk_score: Literal["NO_RISK", "LOW", "MEDIUM", "HIGH", "EXTREME", "NOT_ENOUGH_DATA"] """The risk score of the IP address""" diff --git a/src/gcore/types/waap/ip_info_get_top_urls_response.py b/src/gcore/types/waap/ip_info_get_top_urls_response.py index 76dc6cdb..0db2c8ce 100644 --- a/src/gcore/types/waap/ip_info_get_top_urls_response.py +++ b/src/gcore/types/waap/ip_info_get_top_urls_response.py @@ -3,8 +3,17 @@ from typing import List from typing_extensions import TypeAlias -from .waap_top_url import WaapTopURL +from ..._models import BaseModel -__all__ = ["IPInfoGetTopURLsResponse"] +__all__ = ["IPInfoGetTopURLsResponse", "IPInfoGetTopURLsResponseItem"] -IPInfoGetTopURLsResponse: TypeAlias = List[WaapTopURL] + +class IPInfoGetTopURLsResponseItem(BaseModel): + count: int + """The number of attacks to the URL""" + + url: str + """The URL that was attacked""" + + +IPInfoGetTopURLsResponse: TypeAlias = List[IPInfoGetTopURLsResponseItem] diff --git a/src/gcore/types/waap/ip_info_get_top_sessions_params.py b/src/gcore/types/waap/ip_info_get_top_user_sessions_params.py similarity index 80% rename from src/gcore/types/waap/ip_info_get_top_sessions_params.py rename to src/gcore/types/waap/ip_info_get_top_user_sessions_params.py index 629d7401..d9988114 100644 --- a/src/gcore/types/waap/ip_info_get_top_sessions_params.py +++ b/src/gcore/types/waap/ip_info_get_top_user_sessions_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["IPInfoGetTopSessionsParams"] +__all__ = ["IPInfoGetTopUserSessionsParams"] -class IPInfoGetTopSessionsParams(TypedDict, total=False): +class IPInfoGetTopUserSessionsParams(TypedDict, total=False): domain_id: Required[int] """The identifier for a domain. diff --git a/src/gcore/types/waap/ip_info_get_top_sessions_response.py b/src/gcore/types/waap/ip_info_get_top_user_sessions_response.py similarity index 63% rename from src/gcore/types/waap/ip_info_get_top_sessions_response.py rename to src/gcore/types/waap/ip_info_get_top_user_sessions_response.py index 19bd5822..21dbbf07 100644 --- a/src/gcore/types/waap/ip_info_get_top_sessions_response.py +++ b/src/gcore/types/waap/ip_info_get_top_user_sessions_response.py @@ -5,6 +5,6 @@ from .waap_top_session import WaapTopSession -__all__ = ["IPInfoGetTopSessionsResponse"] +__all__ = ["IPInfoGetTopUserSessionsResponse"] -IPInfoGetTopSessionsResponse: TypeAlias = List[WaapTopSession] +IPInfoGetTopUserSessionsResponse: TypeAlias = List[WaapTopSession] diff --git a/src/gcore/types/waap/waap_block_csrf_page_data.py b/src/gcore/types/waap/waap_block_csrf_page_data.py deleted file mode 100644 index 06f76225..00000000 --- a/src/gcore/types/waap/waap_block_csrf_page_data.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["WaapBlockCsrfPageData"] - - -class WaapBlockCsrfPageData(BaseModel): - enabled: bool - """Indicates whether the custom custom page is active or inactive""" - - header: Optional[str] = None - """The text to display in the header of the custom page""" - - logo: Optional[str] = None - """ - Supported image types are JPEG, PNG and JPG, size is limited to width 450px, - height 130px. This should be a base 64 encoding of the full HTML img tag - compatible image, with the header included. - """ - - text: Optional[str] = None - """The text to display in the body of the custom page""" - - title: Optional[str] = None - """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/waap_block_csrf_page_data_param.py b/src/gcore/types/waap/waap_block_csrf_page_data_param.py deleted file mode 100644 index f16539b7..00000000 --- a/src/gcore/types/waap/waap_block_csrf_page_data_param.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["WaapBlockCsrfPageDataParam"] - - -class WaapBlockCsrfPageDataParam(TypedDict, total=False): - enabled: Required[bool] - """Indicates whether the custom custom page is active or inactive""" - - header: str - """The text to display in the header of the custom page""" - - logo: str - """ - Supported image types are JPEG, PNG and JPG, size is limited to width 450px, - height 130px. This should be a base 64 encoding of the full HTML img tag - compatible image, with the header included. - """ - - text: str - """The text to display in the body of the custom page""" - - title: str - """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/waap_block_page_data.py b/src/gcore/types/waap/waap_block_page_data.py deleted file mode 100644 index b7e8d726..00000000 --- a/src/gcore/types/waap/waap_block_page_data.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["WaapBlockPageData"] - - -class WaapBlockPageData(BaseModel): - enabled: bool - """Indicates whether the custom custom page is active or inactive""" - - header: Optional[str] = None - """The text to display in the header of the custom page""" - - logo: Optional[str] = None - """ - Supported image types are JPEG, PNG and JPG, size is limited to width 450px, - height 130px. This should be a base 64 encoding of the full HTML img tag - compatible image, with the header included. - """ - - text: Optional[str] = None - """The text to display in the body of the custom page""" - - title: Optional[str] = None - """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/waap_block_page_data_param.py b/src/gcore/types/waap/waap_block_page_data_param.py deleted file mode 100644 index 8ccab0f6..00000000 --- a/src/gcore/types/waap/waap_block_page_data_param.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["WaapBlockPageDataParam"] - - -class WaapBlockPageDataParam(TypedDict, total=False): - enabled: Required[bool] - """Indicates whether the custom custom page is active or inactive""" - - header: str - """The text to display in the header of the custom page""" - - logo: str - """ - Supported image types are JPEG, PNG and JPG, size is limited to width 450px, - height 130px. This should be a base 64 encoding of the full HTML img tag - compatible image, with the header included. - """ - - text: str - """The text to display in the body of the custom page""" - - title: str - """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/waap_captcha_page_data.py b/src/gcore/types/waap/waap_captcha_page_data.py deleted file mode 100644 index ce353113..00000000 --- a/src/gcore/types/waap/waap_captcha_page_data.py +++ /dev/null @@ -1,31 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["WaapCaptchaPageData"] - - -class WaapCaptchaPageData(BaseModel): - enabled: bool - """Indicates whether the custom custom page is active or inactive""" - - error: Optional[str] = None - """Error message""" - - header: Optional[str] = None - """The text to display in the header of the custom page""" - - logo: Optional[str] = None - """ - Supported image types are JPEG, PNG and JPG, size is limited to width 450px, - height 130px. This should be a base 64 encoding of the full HTML img tag - compatible image, with the header included. - """ - - text: Optional[str] = None - """The text to display in the body of the custom page""" - - title: Optional[str] = None - """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/waap_captcha_page_data_param.py b/src/gcore/types/waap/waap_captcha_page_data_param.py deleted file mode 100644 index 8010e804..00000000 --- a/src/gcore/types/waap/waap_captcha_page_data_param.py +++ /dev/null @@ -1,31 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["WaapCaptchaPageDataParam"] - - -class WaapCaptchaPageDataParam(TypedDict, total=False): - enabled: Required[bool] - """Indicates whether the custom custom page is active or inactive""" - - error: str - """Error message""" - - header: str - """The text to display in the header of the custom page""" - - logo: str - """ - Supported image types are JPEG, PNG and JPG, size is limited to width 450px, - height 130px. This should be a base 64 encoding of the full HTML img tag - compatible image, with the header included. - """ - - text: str - """The text to display in the body of the custom page""" - - title: str - """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/waap_common_tag.py b/src/gcore/types/waap/waap_common_tag.py deleted file mode 100644 index bb3a995f..00000000 --- a/src/gcore/types/waap/waap_common_tag.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["WaapCommonTag"] - - -class WaapCommonTag(BaseModel): - description: str - """Tag description information""" - - display_name: str - """The tag's display name""" - - tag: str - """Tag name""" diff --git a/src/gcore/types/waap/waap_cookie_disabled_page_data.py b/src/gcore/types/waap/waap_cookie_disabled_page_data.py deleted file mode 100644 index c905dc65..00000000 --- a/src/gcore/types/waap/waap_cookie_disabled_page_data.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["WaapCookieDisabledPageData"] - - -class WaapCookieDisabledPageData(BaseModel): - enabled: bool - """Indicates whether the custom custom page is active or inactive""" - - header: Optional[str] = None - """The text to display in the header of the custom page""" - - text: Optional[str] = None - """The text to display in the body of the custom page""" diff --git a/src/gcore/types/waap/waap_cookie_disabled_page_data_param.py b/src/gcore/types/waap/waap_cookie_disabled_page_data_param.py deleted file mode 100644 index c24b6a7c..00000000 --- a/src/gcore/types/waap/waap_cookie_disabled_page_data_param.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["WaapCookieDisabledPageDataParam"] - - -class WaapCookieDisabledPageDataParam(TypedDict, total=False): - enabled: Required[bool] - """Indicates whether the custom custom page is active or inactive""" - - header: str - """The text to display in the header of the custom page""" - - text: str - """The text to display in the body of the custom page""" diff --git a/src/gcore/types/waap/waap_custom_page_set.py b/src/gcore/types/waap/waap_custom_page_set.py index 105256a2..bade75d9 100644 --- a/src/gcore/types/waap/waap_custom_page_set.py +++ b/src/gcore/types/waap/waap_custom_page_set.py @@ -3,14 +3,114 @@ from typing import List, Optional from ..._models import BaseModel -from .waap_block_page_data import WaapBlockPageData -from .waap_captcha_page_data import WaapCaptchaPageData -from .waap_handshake_page_data import WaapHandshakePageData -from .waap_block_csrf_page_data import WaapBlockCsrfPageData -from .waap_cookie_disabled_page_data import WaapCookieDisabledPageData -from .waap_javascript_disabled_page_data import WaapJavascriptDisabledPageData -__all__ = ["WaapCustomPageSet"] +__all__ = ["WaapCustomPageSet", "Block", "BlockCsrf", "Captcha", "CookieDisabled", "Handshake", "JavascriptDisabled"] + + +class Block(BaseModel): + enabled: bool + """Indicates whether the custom custom page is active or inactive""" + + header: Optional[str] = None + """The text to display in the header of the custom page""" + + logo: Optional[str] = None + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: Optional[str] = None + """The text to display in the body of the custom page""" + + title: Optional[str] = None + """The text to display in the title of the custom page""" + + +class BlockCsrf(BaseModel): + enabled: bool + """Indicates whether the custom custom page is active or inactive""" + + header: Optional[str] = None + """The text to display in the header of the custom page""" + + logo: Optional[str] = None + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: Optional[str] = None + """The text to display in the body of the custom page""" + + title: Optional[str] = None + """The text to display in the title of the custom page""" + + +class Captcha(BaseModel): + enabled: bool + """Indicates whether the custom custom page is active or inactive""" + + error: Optional[str] = None + """Error message""" + + header: Optional[str] = None + """The text to display in the header of the custom page""" + + logo: Optional[str] = None + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + text: Optional[str] = None + """The text to display in the body of the custom page""" + + title: Optional[str] = None + """The text to display in the title of the custom page""" + + +class CookieDisabled(BaseModel): + enabled: bool + """Indicates whether the custom custom page is active or inactive""" + + header: Optional[str] = None + """The text to display in the header of the custom page""" + + text: Optional[str] = None + """The text to display in the body of the custom page""" + + +class Handshake(BaseModel): + enabled: bool + """Indicates whether the custom custom page is active or inactive""" + + header: Optional[str] = None + """The text to display in the header of the custom page""" + + logo: Optional[str] = None + """ + Supported image types are JPEG, PNG and JPG, size is limited to width 450px, + height 130px. This should be a base 64 encoding of the full HTML img tag + compatible image, with the header included. + """ + + title: Optional[str] = None + """The text to display in the title of the custom page""" + + +class JavascriptDisabled(BaseModel): + enabled: bool + """Indicates whether the custom custom page is active or inactive""" + + header: Optional[str] = None + """The text to display in the header of the custom page""" + + text: Optional[str] = None + """The text to display in the body of the custom page""" class WaapCustomPageSet(BaseModel): @@ -20,17 +120,17 @@ class WaapCustomPageSet(BaseModel): name: str """Name of the custom page set""" - block: Optional[WaapBlockPageData] = None + block: Optional[Block] = None - block_csrf: Optional[WaapBlockCsrfPageData] = None + block_csrf: Optional[BlockCsrf] = None - captcha: Optional[WaapCaptchaPageData] = None + captcha: Optional[Captcha] = None - cookie_disabled: Optional[WaapCookieDisabledPageData] = None + cookie_disabled: Optional[CookieDisabled] = None domains: Optional[List[int]] = None """List of domain IDs that are associated with this page set""" - handshake: Optional[WaapHandshakePageData] = None + handshake: Optional[Handshake] = None - javascript_disabled: Optional[WaapJavascriptDisabledPageData] = None + javascript_disabled: Optional[JavascriptDisabled] = None diff --git a/src/gcore/types/waap/waap_customer_rule_state.py b/src/gcore/types/waap/waap_customer_rule_state.py deleted file mode 100644 index cf221d1b..00000000 --- a/src/gcore/types/waap/waap_customer_rule_state.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["WaapCustomerRuleState"] - -WaapCustomerRuleState: TypeAlias = Literal["enable", "disable"] diff --git a/src/gcore/types/waap/waap_detailed_domain.py b/src/gcore/types/waap/waap_detailed_domain.py index c0557bd7..9e12ccee 100644 --- a/src/gcore/types/waap/waap_detailed_domain.py +++ b/src/gcore/types/waap/waap_detailed_domain.py @@ -2,9 +2,9 @@ from typing import Dict, Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel -from .waap_domain_status import WaapDomainStatus __all__ = ["WaapDetailedDomain", "Quotas"] @@ -30,7 +30,7 @@ class WaapDetailedDomain(BaseModel): name: str """The domain name""" - status: WaapDomainStatus + status: Literal["active", "bypass", "monitor", "locked"] """The different statuses a domain can have""" quotas: Optional[Dict[str, Quotas]] = None diff --git a/src/gcore/types/waap/waap_domain_policy.py b/src/gcore/types/waap/waap_domain_policy.py deleted file mode 100644 index d6251e6b..00000000 --- a/src/gcore/types/waap/waap_domain_policy.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel -from .waap_policy_action import WaapPolicyAction - -__all__ = ["WaapDomainPolicy"] - - -class WaapDomainPolicy(BaseModel): - id: str - """Unique identifier for the security rule""" - - action: WaapPolicyAction - """The action taken by the WAAP upon rule activation.""" - - description: str - """Detailed description of the security rule""" - - group: str - """The rule set group name to which the rule belongs""" - - mode: bool - """Indicates if the security rule is active""" - - name: str - """Name of the security rule""" - - rule_set_id: int - """Identifier of the rule set to which the rule belongs""" diff --git a/src/gcore/types/waap/waap_domain_status.py b/src/gcore/types/waap/waap_domain_status.py deleted file mode 100644 index 37591819..00000000 --- a/src/gcore/types/waap/waap_domain_status.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["WaapDomainStatus"] - -WaapDomainStatus: TypeAlias = Literal["active", "bypass", "monitor", "locked"] diff --git a/src/gcore/types/waap/waap_handshake_page_data.py b/src/gcore/types/waap/waap_handshake_page_data.py deleted file mode 100644 index 5c961a5d..00000000 --- a/src/gcore/types/waap/waap_handshake_page_data.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["WaapHandshakePageData"] - - -class WaapHandshakePageData(BaseModel): - enabled: bool - """Indicates whether the custom custom page is active or inactive""" - - header: Optional[str] = None - """The text to display in the header of the custom page""" - - logo: Optional[str] = None - """ - Supported image types are JPEG, PNG and JPG, size is limited to width 450px, - height 130px. This should be a base 64 encoding of the full HTML img tag - compatible image, with the header included. - """ - - title: Optional[str] = None - """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/waap_handshake_page_data_param.py b/src/gcore/types/waap/waap_handshake_page_data_param.py deleted file mode 100644 index 66d8217d..00000000 --- a/src/gcore/types/waap/waap_handshake_page_data_param.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["WaapHandshakePageDataParam"] - - -class WaapHandshakePageDataParam(TypedDict, total=False): - enabled: Required[bool] - """Indicates whether the custom custom page is active or inactive""" - - header: str - """The text to display in the header of the custom page""" - - logo: str - """ - Supported image types are JPEG, PNG and JPG, size is limited to width 450px, - height 130px. This should be a base 64 encoding of the full HTML img tag - compatible image, with the header included. - """ - - title: str - """The text to display in the title of the custom page""" diff --git a/src/gcore/types/waap/waap_insight_silence_sort_by.py b/src/gcore/types/waap/waap_insight_silence_sort_by.py deleted file mode 100644 index 2bf8f08b..00000000 --- a/src/gcore/types/waap/waap_insight_silence_sort_by.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["WaapInsightSilenceSortBy"] - -WaapInsightSilenceSortBy: TypeAlias = Literal[ - "id", "-id", "insight_type", "-insight_type", "comment", "-comment", "author", "-author", "expire_at", "-expire_at" -] diff --git a/src/gcore/types/waap/waap_insight_sort_by.py b/src/gcore/types/waap/waap_insight_sort_by.py deleted file mode 100644 index c2d45a0a..00000000 --- a/src/gcore/types/waap/waap_insight_sort_by.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["WaapInsightSortBy"] - -WaapInsightSortBy: TypeAlias = Literal[ - "id", - "-id", - "insight_type", - "-insight_type", - "first_seen", - "-first_seen", - "last_seen", - "-last_seen", - "last_status_change", - "-last_status_change", - "status", - "-status", -] diff --git a/src/gcore/types/waap/waap_insight_status.py b/src/gcore/types/waap/waap_insight_status.py deleted file mode 100644 index c4cb395d..00000000 --- a/src/gcore/types/waap/waap_insight_status.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["WaapInsightStatus"] - -WaapInsightStatus: TypeAlias = Literal["OPEN", "ACKED", "CLOSED"] diff --git a/src/gcore/types/waap/waap_insight_type.py b/src/gcore/types/waap/waap_insight_type.py new file mode 100644 index 00000000..29055cc0 --- /dev/null +++ b/src/gcore/types/waap/waap_insight_type.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["WaapInsightType"] + + +class WaapInsightType(BaseModel): + description: str + """The description of the insight type""" + + insight_frequency: int + """The frequency of the insight type""" + + insight_grouping_dimensions: List[str] + """The grouping dimensions of the insight type""" + + insight_template: str + """The insight template""" + + labels: List[str] + """The labels of the insight type""" + + name: str + """The name of the insight type""" + + recommendation_template: str + """The recommendation template""" + + slug: str + """The slug of the insight type""" diff --git a/src/gcore/types/waap/waap_javascript_disabled_page_data.py b/src/gcore/types/waap/waap_javascript_disabled_page_data.py deleted file mode 100644 index 641bc115..00000000 --- a/src/gcore/types/waap/waap_javascript_disabled_page_data.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["WaapJavascriptDisabledPageData"] - - -class WaapJavascriptDisabledPageData(BaseModel): - enabled: bool - """Indicates whether the custom custom page is active or inactive""" - - header: Optional[str] = None - """The text to display in the header of the custom page""" - - text: Optional[str] = None - """The text to display in the body of the custom page""" diff --git a/src/gcore/types/waap/waap_javascript_disabled_page_data_param.py b/src/gcore/types/waap/waap_javascript_disabled_page_data_param.py deleted file mode 100644 index fe56528b..00000000 --- a/src/gcore/types/waap/waap_javascript_disabled_page_data_param.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["WaapJavascriptDisabledPageDataParam"] - - -class WaapJavascriptDisabledPageDataParam(TypedDict, total=False): - enabled: Required[bool] - """Indicates whether the custom custom page is active or inactive""" - - header: str - """The text to display in the header of the custom page""" - - text: str - """The text to display in the body of the custom page""" diff --git a/src/gcore/types/waap/waap_network_details.py b/src/gcore/types/waap/waap_network_details.py deleted file mode 100644 index 7d4c8f60..00000000 --- a/src/gcore/types/waap/waap_network_details.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel -from .waap_request_organization import WaapRequestOrganization - -__all__ = ["WaapNetworkDetails"] - - -class WaapNetworkDetails(BaseModel): - client_ip: str - """Client IP""" - - country: str - """Country code""" - - organization: WaapRequestOrganization - """Organization details""" diff --git a/src/gcore/types/waap/waap_page_type.py b/src/gcore/types/waap/waap_page_type.py deleted file mode 100644 index 17a35c3e..00000000 --- a/src/gcore/types/waap/waap_page_type.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["WaapPageType"] - -WaapPageType: TypeAlias = Literal[ - "block.html", "block_csrf.html", "captcha.html", "cookieDisabled.html", "handshake.html", "javascriptDisabled.html" -] diff --git a/src/gcore/types/waap/waap_paginated_custom_page_set.py b/src/gcore/types/waap/waap_paginated_custom_page_set.py deleted file mode 100644 index 9cd598b5..00000000 --- a/src/gcore/types/waap/waap_paginated_custom_page_set.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .waap_custom_page_set import WaapCustomPageSet - -__all__ = ["WaapPaginatedCustomPageSet"] - - -class WaapPaginatedCustomPageSet(BaseModel): - count: int - """Number of items contain in the response""" - - limit: int - """Number of items requested in the response""" - - offset: int - """Items response offset used""" - - results: List[WaapCustomPageSet] - """List of items returned in the response following given criteria""" diff --git a/src/gcore/types/waap/waap_paginated_ddos_attack.py b/src/gcore/types/waap/waap_paginated_ddos_attack.py deleted file mode 100644 index 52f7c7d5..00000000 --- a/src/gcore/types/waap/waap_paginated_ddos_attack.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .waap_ddos_attack import WaapDDOSAttack - -__all__ = ["WaapPaginatedDDOSAttack"] - - -class WaapPaginatedDDOSAttack(BaseModel): - count: int - """Number of items contain in the response""" - - limit: int - """Number of items requested in the response""" - - offset: int - """Items response offset used""" - - results: List[WaapDDOSAttack] - """List of items returned in the response following given criteria""" diff --git a/src/gcore/types/waap/waap_paginated_ddos_info.py b/src/gcore/types/waap/waap_paginated_ddos_info.py deleted file mode 100644 index c04f3cd1..00000000 --- a/src/gcore/types/waap/waap_paginated_ddos_info.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .waap_ddos_info import WaapDDOSInfo - -__all__ = ["WaapPaginatedDDOSInfo"] - - -class WaapPaginatedDDOSInfo(BaseModel): - count: int - """Number of items contain in the response""" - - limit: int - """Number of items requested in the response""" - - offset: int - """Items response offset used""" - - results: List[WaapDDOSInfo] - """List of items returned in the response following given criteria""" diff --git a/src/gcore/types/waap/waap_paginated_request_summary.py b/src/gcore/types/waap/waap_paginated_request_summary.py deleted file mode 100644 index 78a86aea..00000000 --- a/src/gcore/types/waap/waap_paginated_request_summary.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .waap_request_summary import WaapRequestSummary - -__all__ = ["WaapPaginatedRequestSummary"] - - -class WaapPaginatedRequestSummary(BaseModel): - count: int - """Number of items contain in the response""" - - limit: int - """Number of items requested in the response""" - - offset: int - """Items response offset used""" - - results: List[WaapRequestSummary] - """List of items returned in the response following given criteria""" diff --git a/src/gcore/types/waap/waap_pattern_matched_tag.py b/src/gcore/types/waap/waap_pattern_matched_tag.py deleted file mode 100644 index 9101d3b6..00000000 --- a/src/gcore/types/waap/waap_pattern_matched_tag.py +++ /dev/null @@ -1,37 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["WaapPatternMatchedTag"] - - -class WaapPatternMatchedTag(BaseModel): - description: str - """Tag description information""" - - display_name: str - """The tag's display name""" - - execution_phase: str - """ - The phase in which the tag was triggered: access -> Request, `header_filter` -> - `response_header`, `body_filter` -> `response_body` - """ - - field: str - """The entity to which the variable that triggered the tag belong to. - - For example: `request_headers`, uri, cookies etc. - """ - - field_name: str - """The name of the variable which holds the value that triggered the tag""" - - pattern_name: str - """The name of the detected regexp pattern""" - - pattern_value: str - """The pattern which triggered the tag""" - - tag: str - """Tag name""" diff --git a/src/gcore/types/waap/waap_policy_action.py b/src/gcore/types/waap/waap_policy_action.py deleted file mode 100644 index 3de1d5d1..00000000 --- a/src/gcore/types/waap/waap_policy_action.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["WaapPolicyAction"] - -WaapPolicyAction: TypeAlias = Literal["Allow", "Block", "Captcha", "Gateway", "Handshake", "Monitor", "Composite"] diff --git a/src/gcore/types/waap/waap_request_details.py b/src/gcore/types/waap/waap_request_details.py deleted file mode 100644 index eff228a8..00000000 --- a/src/gcore/types/waap/waap_request_details.py +++ /dev/null @@ -1,92 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import Literal - -from ..._models import BaseModel -from .waap_common_tag import WaapCommonTag -from .waap_network_details import WaapNetworkDetails -from .waap_user_agent_details import WaapUserAgentDetails -from .waap_pattern_matched_tag import WaapPatternMatchedTag - -__all__ = ["WaapRequestDetails"] - - -class WaapRequestDetails(BaseModel): - id: str - """Request ID""" - - action: str - """Request action""" - - common_tags: List[WaapCommonTag] - """List of common tags""" - - content_type: str - """Content type of request""" - - domain: str - """Domain name""" - - http_status_code: int - """Status code for http request""" - - http_version: str - """HTTP version of request""" - - incident_id: str - """ID of challenge that was generated""" - - method: str - """Request method""" - - network: WaapNetworkDetails - """Network details""" - - path: str - """Request path""" - - pattern_matched_tags: List[WaapPatternMatchedTag] - """List of shield tags""" - - query_string: str - """The query string of the request""" - - reference_id: str - """Reference ID to identify user sanction""" - - request_headers: object - """HTTP request headers""" - - request_time: str - """The time of the request""" - - request_type: str - """The type of the request that generated an event""" - - requested_domain: str - """The real domain name""" - - response_time: str - """Time took to process all request""" - - result: Literal["passed", "blocked", "suppressed", ""] - """The result of a request""" - - rule_id: str - """ID of the triggered rule""" - - rule_name: str - """Name of the triggered rule""" - - scheme: str - """The HTTP scheme of the request that generated an event""" - - session_request_count: str - """The number requests in session""" - - traffic_types: List[str] - """List of traffic types""" - - user_agent: WaapUserAgentDetails - """User agent details""" diff --git a/src/gcore/types/waap/waap_request_organization.py b/src/gcore/types/waap/waap_request_organization.py deleted file mode 100644 index 11fbea5c..00000000 --- a/src/gcore/types/waap/waap_request_organization.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["WaapRequestOrganization"] - - -class WaapRequestOrganization(BaseModel): - name: str - """Organization name""" - - subnet: str - """Network range""" diff --git a/src/gcore/types/waap/waap_resolution.py b/src/gcore/types/waap/waap_resolution.py deleted file mode 100644 index 0d14e1f5..00000000 --- a/src/gcore/types/waap/waap_resolution.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["WaapResolution"] - -WaapResolution: TypeAlias = Literal["daily", "hourly", "minutely"] diff --git a/src/gcore/types/waap/waap_rule_action_type.py b/src/gcore/types/waap/waap_rule_action_type.py deleted file mode 100644 index f7261bb4..00000000 --- a/src/gcore/types/waap/waap_rule_action_type.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["WaapRuleActionType"] - -WaapRuleActionType: TypeAlias = Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] diff --git a/src/gcore/types/waap/waap_rule_set.py b/src/gcore/types/waap/waap_rule_set.py index f161e0fe..25de7087 100644 --- a/src/gcore/types/waap/waap_rule_set.py +++ b/src/gcore/types/waap/waap_rule_set.py @@ -1,11 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Optional +from typing_extensions import Literal from ..._models import BaseModel -from .waap_domain_policy import WaapDomainPolicy -__all__ = ["WaapRuleSet", "Tag"] +__all__ = ["WaapRuleSet", "Tag", "Rule"] class Tag(BaseModel): @@ -19,6 +19,29 @@ class Tag(BaseModel): """Name of the tag.""" +class Rule(BaseModel): + id: str + """Unique identifier for the security rule""" + + action: Literal["Allow", "Block", "Captcha", "Gateway", "Handshake", "Monitor", "Composite"] + """The action taken by the WAAP upon rule activation.""" + + description: str + """Detailed description of the security rule""" + + group: str + """The rule set group name to which the rule belongs""" + + mode: bool + """Indicates if the security rule is active""" + + name: str + """Name of the security rule""" + + rule_set_id: int + """Identifier of the rule set to which the rule belongs""" + + class WaapRuleSet(BaseModel): id: int """Identifier of the rule set.""" @@ -38,4 +61,4 @@ class WaapRuleSet(BaseModel): resource_slug: Optional[str] = None """The resource slug associated with the rule set.""" - rules: Optional[List[WaapDomainPolicy]] = None + rules: Optional[List[Rule]] = None diff --git a/src/gcore/types/waap/waap_summary_domain.py b/src/gcore/types/waap/waap_summary_domain.py index b9354d2e..78549e71 100644 --- a/src/gcore/types/waap/waap_summary_domain.py +++ b/src/gcore/types/waap/waap_summary_domain.py @@ -2,9 +2,9 @@ from typing import Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel -from .waap_domain_status import WaapDomainStatus __all__ = ["WaapSummaryDomain"] @@ -22,5 +22,5 @@ class WaapSummaryDomain(BaseModel): name: str """The domain name""" - status: WaapDomainStatus + status: Literal["active", "bypass", "monitor", "locked"] """The different statuses a domain can have""" diff --git a/src/gcore/types/waap/waap_top_url.py b/src/gcore/types/waap/waap_top_url.py deleted file mode 100644 index 88d761f8..00000000 --- a/src/gcore/types/waap/waap_top_url.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["WaapTopURL"] - - -class WaapTopURL(BaseModel): - count: int - """The number of attacks to the URL""" - - url: str - """The URL that was attacked""" diff --git a/src/gcore/types/waap/waap_traffic_type.py b/src/gcore/types/waap/waap_traffic_type.py deleted file mode 100644 index e65e7a9e..00000000 --- a/src/gcore/types/waap/waap_traffic_type.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["WaapTrafficType"] - -WaapTrafficType: TypeAlias = Literal[ - "policy_allowed", - "policy_blocked", - "custom_rule_allowed", - "custom_blocked", - "legit_requests", - "sanctioned", - "dynamic", - "api", - "static", - "ajax", - "redirects", - "monitor", - "err_40x", - "err_50x", - "passed_to_origin", - "timeout", - "other", - "ddos", - "legit", - "monitored", -] diff --git a/src/gcore/types/waap/waap_user_agent_details.py b/src/gcore/types/waap/waap_user_agent_details.py deleted file mode 100644 index 8fac3465..00000000 --- a/src/gcore/types/waap/waap_user_agent_details.py +++ /dev/null @@ -1,40 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["WaapUserAgentDetails"] - - -class WaapUserAgentDetails(BaseModel): - base_browser: str - """User agent browser""" - - base_browser_version: str - """User agent browser version""" - - client: str - """Client from User agent header""" - - client_type: str - """User agent client type""" - - client_version: str - """User agent client version""" - - cpu: str - """User agent cpu""" - - device: str - """User agent device""" - - device_type: str - """User agent device type""" - - full_string: str - """User agent""" - - os: str - """User agent os""" - - rendering_engine: str - """User agent engine""" diff --git a/tests/api_resources/waap/domains/analytics/test_requests.py b/tests/api_resources/waap/domains/analytics/test_requests.py deleted file mode 100644 index 24764d63..00000000 --- a/tests/api_resources/waap/domains/analytics/test_requests.py +++ /dev/null @@ -1,216 +0,0 @@ -# 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._utils import parse_datetime -from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.waap import WaapRequestDetails, WaapRequestSummary - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestRequests: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Gcore) -> None: - request = client.waap.domains.analytics.requests.list( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert_matches_type(SyncOffsetPage[WaapRequestSummary], request, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Gcore) -> None: - request = client.waap.domains.analytics.requests.list( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - actions=["allow"], - countries=["Mv"], - end=parse_datetime("2019-12-27T18:11:19.117Z"), - ip=".:", - limit=0, - offset=0, - ordering="ordering", - reference_id="2c02efDd09B3BA1AEaDd3dCAa7aC7A37", - security_rule_name="security_rule_name", - status_code=100, - traffic_types=["policy_allowed"], - ) - assert_matches_type(SyncOffsetPage[WaapRequestSummary], request, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Gcore) -> None: - response = client.waap.domains.analytics.requests.with_raw_response.list( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - request = response.parse() - assert_matches_type(SyncOffsetPage[WaapRequestSummary], request, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Gcore) -> None: - with client.waap.domains.analytics.requests.with_streaming_response.list( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - request = response.parse() - assert_matches_type(SyncOffsetPage[WaapRequestSummary], request, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_get(self, client: Gcore) -> None: - request = client.waap.domains.analytics.requests.get( - request_id="request_id", - domain_id=1, - ) - assert_matches_type(WaapRequestDetails, request, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Gcore) -> None: - response = client.waap.domains.analytics.requests.with_raw_response.get( - request_id="request_id", - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - request = response.parse() - assert_matches_type(WaapRequestDetails, request, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Gcore) -> None: - with client.waap.domains.analytics.requests.with_streaming_response.get( - request_id="request_id", - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - request = response.parse() - assert_matches_type(WaapRequestDetails, request, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): - client.waap.domains.analytics.requests.with_raw_response.get( - request_id="", - domain_id=1, - ) - - -class TestAsyncRequests: - 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: - request = await async_client.waap.domains.analytics.requests.list( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert_matches_type(AsyncOffsetPage[WaapRequestSummary], request, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - request = await async_client.waap.domains.analytics.requests.list( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - actions=["allow"], - countries=["Mv"], - end=parse_datetime("2019-12-27T18:11:19.117Z"), - ip=".:", - limit=0, - offset=0, - ordering="ordering", - reference_id="2c02efDd09B3BA1AEaDd3dCAa7aC7A37", - security_rule_name="security_rule_name", - status_code=100, - traffic_types=["policy_allowed"], - ) - assert_matches_type(AsyncOffsetPage[WaapRequestSummary], request, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.analytics.requests.with_raw_response.list( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - request = await response.parse() - assert_matches_type(AsyncOffsetPage[WaapRequestSummary], request, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.analytics.requests.with_streaming_response.list( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - request = await response.parse() - assert_matches_type(AsyncOffsetPage[WaapRequestSummary], request, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_get(self, async_client: AsyncGcore) -> None: - request = await async_client.waap.domains.analytics.requests.get( - request_id="request_id", - domain_id=1, - ) - assert_matches_type(WaapRequestDetails, request, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.analytics.requests.with_raw_response.get( - request_id="request_id", - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - request = await response.parse() - assert_matches_type(WaapRequestDetails, request, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.analytics.requests.with_streaming_response.get( - request_id="request_id", - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - request = await response.parse() - assert_matches_type(WaapRequestDetails, request, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): - await async_client.waap.domains.analytics.requests.with_raw_response.get( - request_id="", - domain_id=1, - ) diff --git a/tests/api_resources/waap/domains/api_discovery/__init__.py b/tests/api_resources/waap/domains/api_discovery/__init__.py deleted file mode 100644 index fd8019a9..00000000 --- a/tests/api_resources/waap/domains/api_discovery/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/waap/domains/api_discovery/test_scan_results.py b/tests/api_resources/waap/domains/api_discovery/test_scan_results.py deleted file mode 100644 index fd1a1125..00000000 --- a/tests/api_resources/waap/domains/api_discovery/test_scan_results.py +++ /dev/null @@ -1,200 +0,0 @@ -# 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.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.waap.domains.api_discovery import ( - ScanResultGetResponse, - ScanResultListResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestScanResults: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Gcore) -> None: - scan_result = client.waap.domains.api_discovery.scan_results.list( - domain_id=1, - ) - assert_matches_type(SyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Gcore) -> None: - scan_result = client.waap.domains.api_discovery.scan_results.list( - domain_id=1, - limit=0, - message="message", - offset=0, - ordering="id", - status="SUCCESS", - type="TRAFFIC_SCAN", - ) - assert_matches_type(SyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Gcore) -> None: - response = client.waap.domains.api_discovery.scan_results.with_raw_response.list( - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - scan_result = response.parse() - assert_matches_type(SyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Gcore) -> None: - with client.waap.domains.api_discovery.scan_results.with_streaming_response.list( - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - scan_result = response.parse() - assert_matches_type(SyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_get(self, client: Gcore) -> None: - scan_result = client.waap.domains.api_discovery.scan_results.get( - scan_id="scan_id", - domain_id=1, - ) - assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Gcore) -> None: - response = client.waap.domains.api_discovery.scan_results.with_raw_response.get( - scan_id="scan_id", - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - scan_result = response.parse() - assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Gcore) -> None: - with client.waap.domains.api_discovery.scan_results.with_streaming_response.get( - scan_id="scan_id", - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - scan_result = response.parse() - assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): - client.waap.domains.api_discovery.scan_results.with_raw_response.get( - scan_id="", - domain_id=1, - ) - - -class TestAsyncScanResults: - 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: - scan_result = await async_client.waap.domains.api_discovery.scan_results.list( - domain_id=1, - ) - assert_matches_type(AsyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - scan_result = await async_client.waap.domains.api_discovery.scan_results.list( - domain_id=1, - limit=0, - message="message", - offset=0, - ordering="id", - status="SUCCESS", - type="TRAFFIC_SCAN", - ) - assert_matches_type(AsyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.api_discovery.scan_results.with_raw_response.list( - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - scan_result = await response.parse() - assert_matches_type(AsyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.api_discovery.scan_results.with_streaming_response.list( - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - scan_result = await response.parse() - assert_matches_type(AsyncOffsetPage[ScanResultListResponse], scan_result, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_get(self, async_client: AsyncGcore) -> None: - scan_result = await async_client.waap.domains.api_discovery.scan_results.get( - scan_id="scan_id", - domain_id=1, - ) - assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.api_discovery.scan_results.with_raw_response.get( - scan_id="scan_id", - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - scan_result = await response.parse() - assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.api_discovery.scan_results.with_streaming_response.get( - scan_id="scan_id", - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - scan_result = await response.parse() - assert_matches_type(ScanResultGetResponse, scan_result, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): - await async_client.waap.domains.api_discovery.scan_results.with_raw_response.get( - scan_id="", - domain_id=1, - ) diff --git a/tests/api_resources/waap/domains/test_advanced_rules.py b/tests/api_resources/waap/domains/test_advanced_rules.py index f4c52e19..bb99d81b 100644 --- a/tests/api_resources/waap/domains/test_advanced_rules.py +++ b/tests/api_resources/waap/domains/test_advanced_rules.py @@ -10,7 +10,9 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.waap import WaapAdvancedRule +from gcore.types.waap.domains import ( + WaapAdvancedRule, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -153,7 +155,7 @@ def test_method_list(self, client: Gcore) -> None: def test_method_list_with_all_params(self, client: Gcore) -> None: advanced_rule = client.waap.domains.advanced_rules.list( domain_id=1, - action="allow", + action="block", description="This rule blocks all the requests coming form a specific IP address", enabled=False, limit=0, @@ -434,7 +436,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: advanced_rule = await async_client.waap.domains.advanced_rules.list( domain_id=1, - action="allow", + action="block", description="This rule blocks all the requests coming form a specific IP address", enabled=False, limit=0, diff --git a/tests/api_resources/waap/domains/test_analytics.py b/tests/api_resources/waap/domains/test_analytics.py deleted file mode 100644 index 1d1aab74..00000000 --- a/tests/api_resources/waap/domains/test_analytics.py +++ /dev/null @@ -1,401 +0,0 @@ -# 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._utils import parse_datetime -from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.waap import WaapDDOSInfo, WaapDDOSAttack, WaapEventStatistics -from gcore.types.waap.domains import ( - AnalyticsListEventTrafficResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAnalytics: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_get_event_statistics(self, client: Gcore) -> None: - analytics = client.waap.domains.analytics.get_event_statistics( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert_matches_type(WaapEventStatistics, analytics, path=["response"]) - - @parametrize - def test_method_get_event_statistics_with_all_params(self, client: Gcore) -> None: - analytics = client.waap.domains.analytics.get_event_statistics( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - action=["block", "captcha"], - end=parse_datetime("2019-12-27T18:11:19.117Z"), - ip=["string", "string"], - reference_id=["string", "string"], - result=["passed", "blocked"], - ) - assert_matches_type(WaapEventStatistics, analytics, path=["response"]) - - @parametrize - def test_raw_response_get_event_statistics(self, client: Gcore) -> None: - response = client.waap.domains.analytics.with_raw_response.get_event_statistics( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - analytics = response.parse() - assert_matches_type(WaapEventStatistics, analytics, path=["response"]) - - @parametrize - def test_streaming_response_get_event_statistics(self, client: Gcore) -> None: - with client.waap.domains.analytics.with_streaming_response.get_event_statistics( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - analytics = response.parse() - assert_matches_type(WaapEventStatistics, analytics, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_list_ddos_attacks(self, client: Gcore) -> None: - analytics = client.waap.domains.analytics.list_ddos_attacks( - domain_id=1, - ) - assert_matches_type(SyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) - - @parametrize - def test_method_list_ddos_attacks_with_all_params(self, client: Gcore) -> None: - analytics = client.waap.domains.analytics.list_ddos_attacks( - domain_id=1, - end_time=parse_datetime("2019-12-27T18:11:19.117Z"), - limit=0, - offset=0, - ordering="start_time", - start_time=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert_matches_type(SyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) - - @parametrize - def test_raw_response_list_ddos_attacks(self, client: Gcore) -> None: - response = client.waap.domains.analytics.with_raw_response.list_ddos_attacks( - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - analytics = response.parse() - assert_matches_type(SyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) - - @parametrize - def test_streaming_response_list_ddos_attacks(self, client: Gcore) -> None: - with client.waap.domains.analytics.with_streaming_response.list_ddos_attacks( - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - analytics = response.parse() - assert_matches_type(SyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_list_ddos_info(self, client: Gcore) -> None: - analytics = client.waap.domains.analytics.list_ddos_info( - domain_id=1, - group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert_matches_type(SyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) - - @parametrize - def test_method_list_ddos_info_with_all_params(self, client: Gcore) -> None: - analytics = client.waap.domains.analytics.list_ddos_info( - domain_id=1, - group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - end=parse_datetime("2019-12-27T18:11:19.117Z"), - limit=0, - offset=0, - ) - assert_matches_type(SyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) - - @parametrize - def test_raw_response_list_ddos_info(self, client: Gcore) -> None: - response = client.waap.domains.analytics.with_raw_response.list_ddos_info( - domain_id=1, - group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - analytics = response.parse() - assert_matches_type(SyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) - - @parametrize - def test_streaming_response_list_ddos_info(self, client: Gcore) -> None: - with client.waap.domains.analytics.with_streaming_response.list_ddos_info( - domain_id=1, - group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - analytics = response.parse() - assert_matches_type(SyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_list_event_traffic(self, client: Gcore) -> None: - analytics = client.waap.domains.analytics.list_event_traffic( - domain_id=1, - resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) - - @parametrize - def test_method_list_event_traffic_with_all_params(self, client: Gcore) -> None: - analytics = client.waap.domains.analytics.list_event_traffic( - domain_id=1, - resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - end=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) - - @parametrize - def test_raw_response_list_event_traffic(self, client: Gcore) -> None: - response = client.waap.domains.analytics.with_raw_response.list_event_traffic( - domain_id=1, - resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - analytics = response.parse() - assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) - - @parametrize - def test_streaming_response_list_event_traffic(self, client: Gcore) -> None: - with client.waap.domains.analytics.with_streaming_response.list_event_traffic( - domain_id=1, - resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - analytics = response.parse() - assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncAnalytics: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_get_event_statistics(self, async_client: AsyncGcore) -> None: - analytics = await async_client.waap.domains.analytics.get_event_statistics( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert_matches_type(WaapEventStatistics, analytics, path=["response"]) - - @parametrize - async def test_method_get_event_statistics_with_all_params(self, async_client: AsyncGcore) -> None: - analytics = await async_client.waap.domains.analytics.get_event_statistics( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - action=["block", "captcha"], - end=parse_datetime("2019-12-27T18:11:19.117Z"), - ip=["string", "string"], - reference_id=["string", "string"], - result=["passed", "blocked"], - ) - assert_matches_type(WaapEventStatistics, analytics, path=["response"]) - - @parametrize - async def test_raw_response_get_event_statistics(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.analytics.with_raw_response.get_event_statistics( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - analytics = await response.parse() - assert_matches_type(WaapEventStatistics, analytics, path=["response"]) - - @parametrize - async def test_streaming_response_get_event_statistics(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.analytics.with_streaming_response.get_event_statistics( - domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - analytics = await response.parse() - assert_matches_type(WaapEventStatistics, analytics, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_list_ddos_attacks(self, async_client: AsyncGcore) -> None: - analytics = await async_client.waap.domains.analytics.list_ddos_attacks( - domain_id=1, - ) - assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) - - @parametrize - async def test_method_list_ddos_attacks_with_all_params(self, async_client: AsyncGcore) -> None: - analytics = await async_client.waap.domains.analytics.list_ddos_attacks( - domain_id=1, - end_time=parse_datetime("2019-12-27T18:11:19.117Z"), - limit=0, - offset=0, - ordering="start_time", - start_time=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) - - @parametrize - async def test_raw_response_list_ddos_attacks(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.analytics.with_raw_response.list_ddos_attacks( - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - analytics = await response.parse() - assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) - - @parametrize - async def test_streaming_response_list_ddos_attacks(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.analytics.with_streaming_response.list_ddos_attacks( - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - analytics = await response.parse() - assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], analytics, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_list_ddos_info(self, async_client: AsyncGcore) -> None: - analytics = await async_client.waap.domains.analytics.list_ddos_info( - domain_id=1, - group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) - - @parametrize - async def test_method_list_ddos_info_with_all_params(self, async_client: AsyncGcore) -> None: - analytics = await async_client.waap.domains.analytics.list_ddos_info( - domain_id=1, - group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - end=parse_datetime("2019-12-27T18:11:19.117Z"), - limit=0, - offset=0, - ) - assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) - - @parametrize - async def test_raw_response_list_ddos_info(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.analytics.with_raw_response.list_ddos_info( - domain_id=1, - group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - analytics = await response.parse() - assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) - - @parametrize - async def test_streaming_response_list_ddos_info(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.analytics.with_streaming_response.list_ddos_info( - domain_id=1, - group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - analytics = await response.parse() - assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], analytics, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_list_event_traffic(self, async_client: AsyncGcore) -> None: - analytics = await async_client.waap.domains.analytics.list_event_traffic( - domain_id=1, - resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) - - @parametrize - async def test_method_list_event_traffic_with_all_params(self, async_client: AsyncGcore) -> None: - analytics = await async_client.waap.domains.analytics.list_event_traffic( - domain_id=1, - resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - end=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) - - @parametrize - async def test_raw_response_list_event_traffic(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.analytics.with_raw_response.list_event_traffic( - domain_id=1, - resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - analytics = await response.parse() - assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) - - @parametrize - async def test_streaming_response_list_event_traffic(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.analytics.with_streaming_response.list_event_traffic( - domain_id=1, - resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - analytics = await response.parse() - assert_matches_type(AnalyticsListEventTrafficResponse, analytics, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_api_discovery.py b/tests/api_resources/waap/domains/test_api_discovery.py index 6a1aab20..7fd4e461 100644 --- a/tests/api_resources/waap/domains/test_api_discovery.py +++ b/tests/api_resources/waap/domains/test_api_discovery.py @@ -9,11 +9,11 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.waap.domains import ( - APIDiscoveryGetSettingsResponse, - APIDiscoveryScanOpenAPIResponse, - APIDiscoveryUploadOpenAPIResponse, - APIDiscoveryUpdateSettingsResponse, + WaapTaskID, + WaapAPIScanResult, + WaapAPIDiscoverySettings, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,12 +22,54 @@ class TestAPIDiscovery: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_get_scan_result(self, client: Gcore) -> None: + api_discovery = client.waap.domains.api_discovery.get_scan_result( + scan_id="scan_id", + domain_id=1, + ) + assert_matches_type(WaapAPIScanResult, api_discovery, path=["response"]) + + @parametrize + def test_raw_response_get_scan_result(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.with_raw_response.get_scan_result( + scan_id="scan_id", + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_discovery = response.parse() + assert_matches_type(WaapAPIScanResult, api_discovery, path=["response"]) + + @parametrize + def test_streaming_response_get_scan_result(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.with_streaming_response.get_scan_result( + scan_id="scan_id", + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_discovery = response.parse() + assert_matches_type(WaapAPIScanResult, api_discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_scan_result(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): + client.waap.domains.api_discovery.with_raw_response.get_scan_result( + scan_id="", + domain_id=1, + ) + @parametrize def test_method_get_settings(self, client: Gcore) -> None: api_discovery = client.waap.domains.api_discovery.get_settings( 1, ) - assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) @parametrize def test_raw_response_get_settings(self, client: Gcore) -> None: @@ -38,7 +80,7 @@ def test_raw_response_get_settings(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = response.parse() - assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) @parametrize def test_streaming_response_get_settings(self, client: Gcore) -> None: @@ -49,7 +91,51 @@ def test_streaming_response_get_settings(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = response.parse() - assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_scan_results(self, client: Gcore) -> None: + api_discovery = client.waap.domains.api_discovery.list_scan_results( + domain_id=1, + ) + assert_matches_type(SyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) + + @parametrize + def test_method_list_scan_results_with_all_params(self, client: Gcore) -> None: + api_discovery = client.waap.domains.api_discovery.list_scan_results( + domain_id=1, + limit=0, + message="message", + offset=0, + ordering="id", + status="SUCCESS", + type="TRAFFIC_SCAN", + ) + assert_matches_type(SyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) + + @parametrize + def test_raw_response_list_scan_results(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.with_raw_response.list_scan_results( + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_discovery = response.parse() + assert_matches_type(SyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) + + @parametrize + def test_streaming_response_list_scan_results(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.with_streaming_response.list_scan_results( + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_discovery = response.parse() + assert_matches_type(SyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) assert cast(Any, response.is_closed) is True @@ -58,7 +144,7 @@ def test_method_scan_openapi(self, client: Gcore) -> None: api_discovery = client.waap.domains.api_discovery.scan_openapi( 1, ) - assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) + assert_matches_type(WaapTaskID, api_discovery, path=["response"]) @parametrize def test_raw_response_scan_openapi(self, client: Gcore) -> None: @@ -69,7 +155,7 @@ def test_raw_response_scan_openapi(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = response.parse() - assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) + assert_matches_type(WaapTaskID, api_discovery, path=["response"]) @parametrize def test_streaming_response_scan_openapi(self, client: Gcore) -> None: @@ -80,7 +166,7 @@ def test_streaming_response_scan_openapi(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = response.parse() - assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) + assert_matches_type(WaapTaskID, api_discovery, path=["response"]) assert cast(Any, response.is_closed) is True @@ -89,7 +175,7 @@ def test_method_update_settings(self, client: Gcore) -> None: api_discovery = client.waap.domains.api_discovery.update_settings( domain_id=1, ) - assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) @parametrize def test_method_update_settings_with_all_params(self, client: Gcore) -> None: @@ -101,7 +187,7 @@ def test_method_update_settings_with_all_params(self, client: Gcore) -> None: traffic_scan_enabled=True, traffic_scan_interval_hours=1, ) - assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) @parametrize def test_raw_response_update_settings(self, client: Gcore) -> None: @@ -112,7 +198,7 @@ def test_raw_response_update_settings(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = response.parse() - assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) @parametrize def test_streaming_response_update_settings(self, client: Gcore) -> None: @@ -123,7 +209,7 @@ def test_streaming_response_update_settings(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = response.parse() - assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) assert cast(Any, response.is_closed) is True @@ -134,7 +220,7 @@ def test_method_upload_openapi(self, client: Gcore) -> None: file_data="file_data", file_name="file_name", ) - assert_matches_type(APIDiscoveryUploadOpenAPIResponse, api_discovery, path=["response"]) + assert_matches_type(WaapTaskID, api_discovery, path=["response"]) @parametrize def test_raw_response_upload_openapi(self, client: Gcore) -> None: @@ -147,7 +233,7 @@ def test_raw_response_upload_openapi(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = response.parse() - assert_matches_type(APIDiscoveryUploadOpenAPIResponse, api_discovery, path=["response"]) + assert_matches_type(WaapTaskID, api_discovery, path=["response"]) @parametrize def test_streaming_response_upload_openapi(self, client: Gcore) -> None: @@ -160,7 +246,7 @@ def test_streaming_response_upload_openapi(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = response.parse() - assert_matches_type(APIDiscoveryUploadOpenAPIResponse, api_discovery, path=["response"]) + assert_matches_type(WaapTaskID, api_discovery, path=["response"]) assert cast(Any, response.is_closed) is True @@ -170,12 +256,54 @@ class TestAsyncAPIDiscovery: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) + @parametrize + async def test_method_get_scan_result(self, async_client: AsyncGcore) -> None: + api_discovery = await async_client.waap.domains.api_discovery.get_scan_result( + scan_id="scan_id", + domain_id=1, + ) + assert_matches_type(WaapAPIScanResult, api_discovery, path=["response"]) + + @parametrize + async def test_raw_response_get_scan_result(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.with_raw_response.get_scan_result( + scan_id="scan_id", + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_discovery = await response.parse() + assert_matches_type(WaapAPIScanResult, api_discovery, path=["response"]) + + @parametrize + async def test_streaming_response_get_scan_result(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.with_streaming_response.get_scan_result( + scan_id="scan_id", + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_discovery = await response.parse() + assert_matches_type(WaapAPIScanResult, api_discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_scan_result(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): + await async_client.waap.domains.api_discovery.with_raw_response.get_scan_result( + scan_id="", + domain_id=1, + ) + @parametrize async def test_method_get_settings(self, async_client: AsyncGcore) -> None: api_discovery = await async_client.waap.domains.api_discovery.get_settings( 1, ) - assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) @parametrize async def test_raw_response_get_settings(self, async_client: AsyncGcore) -> None: @@ -186,7 +314,7 @@ async def test_raw_response_get_settings(self, async_client: AsyncGcore) -> None assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = await response.parse() - assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) @parametrize async def test_streaming_response_get_settings(self, async_client: AsyncGcore) -> None: @@ -197,7 +325,51 @@ async def test_streaming_response_get_settings(self, async_client: AsyncGcore) - assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = await response.parse() - assert_matches_type(APIDiscoveryGetSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_scan_results(self, async_client: AsyncGcore) -> None: + api_discovery = await async_client.waap.domains.api_discovery.list_scan_results( + domain_id=1, + ) + assert_matches_type(AsyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) + + @parametrize + async def test_method_list_scan_results_with_all_params(self, async_client: AsyncGcore) -> None: + api_discovery = await async_client.waap.domains.api_discovery.list_scan_results( + domain_id=1, + limit=0, + message="message", + offset=0, + ordering="id", + status="SUCCESS", + type="TRAFFIC_SCAN", + ) + assert_matches_type(AsyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) + + @parametrize + async def test_raw_response_list_scan_results(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.with_raw_response.list_scan_results( + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + api_discovery = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) + + @parametrize + async def test_streaming_response_list_scan_results(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.with_streaming_response.list_scan_results( + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + api_discovery = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) assert cast(Any, response.is_closed) is True @@ -206,7 +378,7 @@ async def test_method_scan_openapi(self, async_client: AsyncGcore) -> None: api_discovery = await async_client.waap.domains.api_discovery.scan_openapi( 1, ) - assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) + assert_matches_type(WaapTaskID, api_discovery, path=["response"]) @parametrize async def test_raw_response_scan_openapi(self, async_client: AsyncGcore) -> None: @@ -217,7 +389,7 @@ async def test_raw_response_scan_openapi(self, async_client: AsyncGcore) -> None assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = await response.parse() - assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) + assert_matches_type(WaapTaskID, api_discovery, path=["response"]) @parametrize async def test_streaming_response_scan_openapi(self, async_client: AsyncGcore) -> None: @@ -228,7 +400,7 @@ async def test_streaming_response_scan_openapi(self, async_client: AsyncGcore) - assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = await response.parse() - assert_matches_type(APIDiscoveryScanOpenAPIResponse, api_discovery, path=["response"]) + assert_matches_type(WaapTaskID, api_discovery, path=["response"]) assert cast(Any, response.is_closed) is True @@ -237,7 +409,7 @@ async def test_method_update_settings(self, async_client: AsyncGcore) -> None: api_discovery = await async_client.waap.domains.api_discovery.update_settings( domain_id=1, ) - assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) @parametrize async def test_method_update_settings_with_all_params(self, async_client: AsyncGcore) -> None: @@ -249,7 +421,7 @@ async def test_method_update_settings_with_all_params(self, async_client: AsyncG traffic_scan_enabled=True, traffic_scan_interval_hours=1, ) - assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) @parametrize async def test_raw_response_update_settings(self, async_client: AsyncGcore) -> None: @@ -260,7 +432,7 @@ async def test_raw_response_update_settings(self, async_client: AsyncGcore) -> N assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = await response.parse() - assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) @parametrize async def test_streaming_response_update_settings(self, async_client: AsyncGcore) -> None: @@ -271,7 +443,7 @@ async def test_streaming_response_update_settings(self, async_client: AsyncGcore assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = await response.parse() - assert_matches_type(APIDiscoveryUpdateSettingsResponse, api_discovery, path=["response"]) + assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) assert cast(Any, response.is_closed) is True @@ -282,7 +454,7 @@ async def test_method_upload_openapi(self, async_client: AsyncGcore) -> None: file_data="file_data", file_name="file_name", ) - assert_matches_type(APIDiscoveryUploadOpenAPIResponse, api_discovery, path=["response"]) + assert_matches_type(WaapTaskID, api_discovery, path=["response"]) @parametrize async def test_raw_response_upload_openapi(self, async_client: AsyncGcore) -> None: @@ -295,7 +467,7 @@ async def test_raw_response_upload_openapi(self, async_client: AsyncGcore) -> No assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = await response.parse() - assert_matches_type(APIDiscoveryUploadOpenAPIResponse, api_discovery, path=["response"]) + assert_matches_type(WaapTaskID, api_discovery, path=["response"]) @parametrize async def test_streaming_response_upload_openapi(self, async_client: AsyncGcore) -> None: @@ -308,6 +480,6 @@ async def test_streaming_response_upload_openapi(self, async_client: AsyncGcore) assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_discovery = await response.parse() - assert_matches_type(APIDiscoveryUploadOpenAPIResponse, api_discovery, path=["response"]) + assert_matches_type(WaapTaskID, api_discovery, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_api_path_groups.py b/tests/api_resources/waap/domains/test_api_path_groups.py index b33f5939..d194ade6 100644 --- a/tests/api_resources/waap/domains/test_api_path_groups.py +++ b/tests/api_resources/waap/domains/test_api_path_groups.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.waap.domains import APIPathGroupListResponse +from gcore.types.waap.domains import APIPathGroupList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,7 +22,7 @@ def test_method_list(self, client: Gcore) -> None: api_path_group = client.waap.domains.api_path_groups.list( 1, ) - assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) + assert_matches_type(APIPathGroupList, api_path_group, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -33,7 +33,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path_group = response.parse() - assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) + assert_matches_type(APIPathGroupList, api_path_group, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -44,7 +44,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path_group = response.parse() - assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) + assert_matches_type(APIPathGroupList, api_path_group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -59,7 +59,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: api_path_group = await async_client.waap.domains.api_path_groups.list( 1, ) - assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) + assert_matches_type(APIPathGroupList, api_path_group, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -70,7 +70,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path_group = await response.parse() - assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) + assert_matches_type(APIPathGroupList, api_path_group, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -81,6 +81,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path_group = await response.parse() - assert_matches_type(APIPathGroupListResponse, api_path_group, path=["response"]) + assert_matches_type(APIPathGroupList, api_path_group, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_api_paths.py b/tests/api_resources/waap/domains/test_api_paths.py index bb76162b..18cc8e93 100644 --- a/tests/api_resources/waap/domains/test_api_paths.py +++ b/tests/api_resources/waap/domains/test_api_paths.py @@ -10,11 +10,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.waap.domains import ( - APIPathGetResponse, - APIPathListResponse, - APIPathCreateResponse, -) +from gcore.types.waap.domains import WaapAPIPath base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +26,7 @@ def test_method_create(self, client: Gcore) -> None: method="GET", path="/api/v1/paths/{path_id}", ) - assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -43,7 +39,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: api_version="v1", tags=["sensitivedataurl", "highriskurl"], ) - assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -57,7 +53,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" api_path = response.parse() - assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -71,7 +67,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path = response.parse() - assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) assert cast(Any, response.is_closed) is True @@ -134,7 +130,7 @@ def test_method_list(self, client: Gcore) -> None: api_path = client.waap.domains.api_paths.list( domain_id=1, ) - assert_matches_type(SyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapAPIPath], api_path, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -152,7 +148,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: source="API_DESCRIPTION_FILE", status=["CONFIRMED_API", "POTENTIAL_API"], ) - assert_matches_type(SyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapAPIPath], api_path, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -163,7 +159,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path = response.parse() - assert_matches_type(SyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapAPIPath], api_path, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -174,7 +170,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path = response.parse() - assert_matches_type(SyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + assert_matches_type(SyncOffsetPage[WaapAPIPath], api_path, path=["response"]) assert cast(Any, response.is_closed) is True @@ -226,7 +222,7 @@ def test_method_get(self, client: Gcore) -> None: path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", domain_id=1, ) - assert_matches_type(APIPathGetResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -238,7 +234,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path = response.parse() - assert_matches_type(APIPathGetResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -250,7 +246,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path = response.parse() - assert_matches_type(APIPathGetResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) assert cast(Any, response.is_closed) is True @@ -276,7 +272,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: method="GET", path="/api/v1/paths/{path_id}", ) - assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -289,7 +285,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> api_version="v1", tags=["sensitivedataurl", "highriskurl"], ) - assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -303,7 +299,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" api_path = await response.parse() - assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -317,7 +313,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path = await response.parse() - assert_matches_type(APIPathCreateResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) assert cast(Any, response.is_closed) is True @@ -380,7 +376,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: api_path = await async_client.waap.domains.api_paths.list( domain_id=1, ) - assert_matches_type(AsyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapAPIPath], api_path, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -398,7 +394,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No source="API_DESCRIPTION_FILE", status=["CONFIRMED_API", "POTENTIAL_API"], ) - assert_matches_type(AsyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapAPIPath], api_path, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -409,7 +405,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path = await response.parse() - assert_matches_type(AsyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapAPIPath], api_path, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -420,7 +416,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path = await response.parse() - assert_matches_type(AsyncOffsetPage[APIPathListResponse], api_path, path=["response"]) + assert_matches_type(AsyncOffsetPage[WaapAPIPath], api_path, path=["response"]) assert cast(Any, response.is_closed) is True @@ -472,7 +468,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: path_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", domain_id=1, ) - assert_matches_type(APIPathGetResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -484,7 +480,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path = await response.parse() - assert_matches_type(APIPathGetResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -496,7 +492,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_path = await response.parse() - assert_matches_type(APIPathGetResponse, api_path, path=["response"]) + assert_matches_type(WaapAPIPath, api_path, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_custom_rules.py b/tests/api_resources/waap/domains/test_custom_rules.py index 3da58761..70f4c5b2 100644 --- a/tests/api_resources/waap/domains/test_custom_rules.py +++ b/tests/api_resources/waap/domains/test_custom_rules.py @@ -10,7 +10,9 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.waap import WaapCustomRule +from gcore.types.waap.domains import ( + WaapCustomRule, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -323,7 +325,7 @@ def test_method_list(self, client: Gcore) -> None: def test_method_list_with_all_params(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.list( domain_id=1, - action="allow", + action="block", description="This rule blocks all the requests coming form a specific IP address.", enabled=False, limit=0, @@ -807,7 +809,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: custom_rule = await async_client.waap.domains.custom_rules.list( domain_id=1, - action="allow", + action="block", description="This rule blocks all the requests coming form a specific IP address.", enabled=False, limit=0, diff --git a/tests/api_resources/waap/domains/test_firewall_rules.py b/tests/api_resources/waap/domains/test_firewall_rules.py index 6ab473ee..0be72d1a 100644 --- a/tests/api_resources/waap/domains/test_firewall_rules.py +++ b/tests/api_resources/waap/domains/test_firewall_rules.py @@ -10,7 +10,9 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.waap import WaapFirewallRule +from gcore.types.waap.domains import ( + WaapFirewallRule, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/waap/domains/test_insight_silences.py b/tests/api_resources/waap/domains/test_insight_silences.py index a107ae79..cd1d687a 100644 --- a/tests/api_resources/waap/domains/test_insight_silences.py +++ b/tests/api_resources/waap/domains/test_insight_silences.py @@ -11,7 +11,9 @@ from tests.utils import assert_matches_type from gcore._utils import parse_datetime from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.waap import WaapInsightSilence +from gcore.types.waap.domains import ( + WaapInsightSilence, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/waap/domains/test_insights.py b/tests/api_resources/waap/domains/test_insights.py index 259e941d..2e2f83b1 100644 --- a/tests/api_resources/waap/domains/test_insights.py +++ b/tests/api_resources/waap/domains/test_insights.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.waap import WaapInsight +from gcore.types.waap.domains import WaapInsight base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/waap/domains/test_policies.py b/tests/api_resources/waap/domains/test_policies.py deleted file mode 100644 index 690ba30a..00000000 --- a/tests/api_resources/waap/domains/test_policies.py +++ /dev/null @@ -1,108 +0,0 @@ -# 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.waap import WaapPolicyMode - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestPolicies: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_toggle(self, client: Gcore) -> None: - policy = client.waap.domains.policies.toggle( - policy_id="policy_id", - domain_id=1, - ) - assert_matches_type(WaapPolicyMode, policy, path=["response"]) - - @parametrize - def test_raw_response_toggle(self, client: Gcore) -> None: - response = client.waap.domains.policies.with_raw_response.toggle( - policy_id="policy_id", - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = response.parse() - assert_matches_type(WaapPolicyMode, policy, path=["response"]) - - @parametrize - def test_streaming_response_toggle(self, client: Gcore) -> None: - with client.waap.domains.policies.with_streaming_response.toggle( - policy_id="policy_id", - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - policy = response.parse() - assert_matches_type(WaapPolicyMode, policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_toggle(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): - client.waap.domains.policies.with_raw_response.toggle( - policy_id="", - domain_id=1, - ) - - -class TestAsyncPolicies: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_toggle(self, async_client: AsyncGcore) -> None: - policy = await async_client.waap.domains.policies.toggle( - policy_id="policy_id", - domain_id=1, - ) - assert_matches_type(WaapPolicyMode, policy, path=["response"]) - - @parametrize - async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.policies.with_raw_response.toggle( - policy_id="policy_id", - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = await response.parse() - assert_matches_type(WaapPolicyMode, policy, path=["response"]) - - @parametrize - async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.policies.with_streaming_response.toggle( - policy_id="policy_id", - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - policy = await response.parse() - assert_matches_type(WaapPolicyMode, policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_toggle(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): - await async_client.waap.domains.policies.with_raw_response.toggle( - policy_id="", - domain_id=1, - ) diff --git a/tests/api_resources/waap/domains/test_statistics.py b/tests/api_resources/waap/domains/test_statistics.py new file mode 100644 index 00000000..11ac75e3 --- /dev/null +++ b/tests/api_resources/waap/domains/test_statistics.py @@ -0,0 +1,595 @@ +# 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._utils import parse_datetime +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap.domains import ( + WaapDDOSInfo, + WaapDDOSAttack, + WaapRequestDetails, + WaapRequestSummary, + WaapEventStatistics, + StatisticGetTrafficSeriesResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestStatistics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_ddos_attacks(self, client: Gcore) -> None: + statistic = client.waap.domains.statistics.get_ddos_attacks( + domain_id=1, + ) + assert_matches_type(SyncOffsetPage[WaapDDOSAttack], statistic, path=["response"]) + + @parametrize + def test_method_get_ddos_attacks_with_all_params(self, client: Gcore) -> None: + statistic = client.waap.domains.statistics.get_ddos_attacks( + domain_id=1, + end_time=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=0, + offset=0, + ordering="start_time", + start_time=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(SyncOffsetPage[WaapDDOSAttack], statistic, path=["response"]) + + @parametrize + def test_raw_response_get_ddos_attacks(self, client: Gcore) -> None: + response = client.waap.domains.statistics.with_raw_response.get_ddos_attacks( + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(SyncOffsetPage[WaapDDOSAttack], statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_ddos_attacks(self, client: Gcore) -> None: + with client.waap.domains.statistics.with_streaming_response.get_ddos_attacks( + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(SyncOffsetPage[WaapDDOSAttack], statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_ddos_info(self, client: Gcore) -> None: + statistic = client.waap.domains.statistics.get_ddos_info( + domain_id=1, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(SyncOffsetPage[WaapDDOSInfo], statistic, path=["response"]) + + @parametrize + def test_method_get_ddos_info_with_all_params(self, client: Gcore) -> None: + statistic = client.waap.domains.statistics.get_ddos_info( + domain_id=1, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + end=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=0, + offset=0, + ) + assert_matches_type(SyncOffsetPage[WaapDDOSInfo], statistic, path=["response"]) + + @parametrize + def test_raw_response_get_ddos_info(self, client: Gcore) -> None: + response = client.waap.domains.statistics.with_raw_response.get_ddos_info( + domain_id=1, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(SyncOffsetPage[WaapDDOSInfo], statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_ddos_info(self, client: Gcore) -> None: + with client.waap.domains.statistics.with_streaming_response.get_ddos_info( + domain_id=1, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(SyncOffsetPage[WaapDDOSInfo], statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_events_aggregated(self, client: Gcore) -> None: + statistic = client.waap.domains.statistics.get_events_aggregated( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(WaapEventStatistics, statistic, path=["response"]) + + @parametrize + def test_method_get_events_aggregated_with_all_params(self, client: Gcore) -> None: + statistic = client.waap.domains.statistics.get_events_aggregated( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + action=["block", "captcha"], + end=parse_datetime("2019-12-27T18:11:19.117Z"), + ip=["string", "string"], + reference_id=["string", "string"], + result=["passed", "blocked"], + ) + assert_matches_type(WaapEventStatistics, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_events_aggregated(self, client: Gcore) -> None: + response = client.waap.domains.statistics.with_raw_response.get_events_aggregated( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(WaapEventStatistics, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_events_aggregated(self, client: Gcore) -> None: + with client.waap.domains.statistics.with_streaming_response.get_events_aggregated( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(WaapEventStatistics, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_request_details(self, client: Gcore) -> None: + statistic = client.waap.domains.statistics.get_request_details( + request_id="request_id", + domain_id=1, + ) + assert_matches_type(WaapRequestDetails, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_request_details(self, client: Gcore) -> None: + response = client.waap.domains.statistics.with_raw_response.get_request_details( + request_id="request_id", + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(WaapRequestDetails, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_request_details(self, client: Gcore) -> None: + with client.waap.domains.statistics.with_streaming_response.get_request_details( + request_id="request_id", + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(WaapRequestDetails, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_request_details(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + client.waap.domains.statistics.with_raw_response.get_request_details( + request_id="", + domain_id=1, + ) + + @parametrize + def test_method_get_requests_series(self, client: Gcore) -> None: + statistic = client.waap.domains.statistics.get_requests_series( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(SyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) + + @parametrize + def test_method_get_requests_series_with_all_params(self, client: Gcore) -> None: + statistic = client.waap.domains.statistics.get_requests_series( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + actions=["allow"], + countries=["Mv"], + end=parse_datetime("2019-12-27T18:11:19.117Z"), + ip=".:", + limit=0, + offset=0, + ordering="ordering", + reference_id="2c02efDd09B3BA1AEaDd3dCAa7aC7A37", + security_rule_name="security_rule_name", + status_code=100, + traffic_types=["policy_allowed"], + ) + assert_matches_type(SyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) + + @parametrize + def test_raw_response_get_requests_series(self, client: Gcore) -> None: + response = client.waap.domains.statistics.with_raw_response.get_requests_series( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(SyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_requests_series(self, client: Gcore) -> None: + with client.waap.domains.statistics.with_streaming_response.get_requests_series( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(SyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_traffic_series(self, client: Gcore) -> None: + statistic = client.waap.domains.statistics.get_traffic_series( + domain_id=1, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) + + @parametrize + def test_method_get_traffic_series_with_all_params(self, client: Gcore) -> None: + statistic = client.waap.domains.statistics.get_traffic_series( + domain_id=1, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + end=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_traffic_series(self, client: Gcore) -> None: + response = client.waap.domains.statistics.with_raw_response.get_traffic_series( + domain_id=1, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_traffic_series(self, client: Gcore) -> None: + with client.waap.domains.statistics.with_streaming_response.get_traffic_series( + domain_id=1, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncStatistics: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get_ddos_attacks(self, async_client: AsyncGcore) -> None: + statistic = await async_client.waap.domains.statistics.get_ddos_attacks( + domain_id=1, + ) + assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], statistic, path=["response"]) + + @parametrize + async def test_method_get_ddos_attacks_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.waap.domains.statistics.get_ddos_attacks( + domain_id=1, + end_time=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=0, + offset=0, + ordering="start_time", + start_time=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_ddos_attacks(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.statistics.with_raw_response.get_ddos_attacks( + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_ddos_attacks(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.statistics.with_streaming_response.get_ddos_attacks( + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_ddos_info(self, async_client: AsyncGcore) -> None: + statistic = await async_client.waap.domains.statistics.get_ddos_info( + domain_id=1, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], statistic, path=["response"]) + + @parametrize + async def test_method_get_ddos_info_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.waap.domains.statistics.get_ddos_info( + domain_id=1, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + end=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=0, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_ddos_info(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.statistics.with_raw_response.get_ddos_info( + domain_id=1, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_ddos_info(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.statistics.with_streaming_response.get_ddos_info( + domain_id=1, + group_by="URL", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_events_aggregated(self, async_client: AsyncGcore) -> None: + statistic = await async_client.waap.domains.statistics.get_events_aggregated( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(WaapEventStatistics, statistic, path=["response"]) + + @parametrize + async def test_method_get_events_aggregated_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.waap.domains.statistics.get_events_aggregated( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + action=["block", "captcha"], + end=parse_datetime("2019-12-27T18:11:19.117Z"), + ip=["string", "string"], + reference_id=["string", "string"], + result=["passed", "blocked"], + ) + assert_matches_type(WaapEventStatistics, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_events_aggregated(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.statistics.with_raw_response.get_events_aggregated( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(WaapEventStatistics, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_events_aggregated(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.statistics.with_streaming_response.get_events_aggregated( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(WaapEventStatistics, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_request_details(self, async_client: AsyncGcore) -> None: + statistic = await async_client.waap.domains.statistics.get_request_details( + request_id="request_id", + domain_id=1, + ) + assert_matches_type(WaapRequestDetails, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_request_details(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.statistics.with_raw_response.get_request_details( + request_id="request_id", + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(WaapRequestDetails, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_request_details(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.statistics.with_streaming_response.get_request_details( + request_id="request_id", + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(WaapRequestDetails, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_request_details(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + await async_client.waap.domains.statistics.with_raw_response.get_request_details( + request_id="", + domain_id=1, + ) + + @parametrize + async def test_method_get_requests_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.waap.domains.statistics.get_requests_series( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(AsyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) + + @parametrize + async def test_method_get_requests_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.waap.domains.statistics.get_requests_series( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + actions=["allow"], + countries=["Mv"], + end=parse_datetime("2019-12-27T18:11:19.117Z"), + ip=".:", + limit=0, + offset=0, + ordering="ordering", + reference_id="2c02efDd09B3BA1AEaDd3dCAa7aC7A37", + security_rule_name="security_rule_name", + status_code=100, + traffic_types=["policy_allowed"], + ) + assert_matches_type(AsyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_requests_series(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.statistics.with_raw_response.get_requests_series( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_requests_series(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.statistics.with_streaming_response.get_requests_series( + domain_id=1, + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_traffic_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.waap.domains.statistics.get_traffic_series( + domain_id=1, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) + + @parametrize + async def test_method_get_traffic_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.waap.domains.statistics.get_traffic_series( + domain_id=1, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + end=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_traffic_series(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.statistics.with_raw_response.get_traffic_series( + domain_id=1, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_traffic_series(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.statistics.with_streaming_response.get_traffic_series( + domain_id=1, + resolution="daily", + start=parse_datetime("2019-12-27T18:11:19.117Z"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/analytics/__init__.py b/tests/api_resources/waap/ip_info/__init__.py similarity index 100% rename from tests/api_resources/waap/domains/analytics/__init__.py rename to tests/api_resources/waap/ip_info/__init__.py diff --git a/tests/api_resources/waap/ip_info/test_metrics.py b/tests/api_resources/waap/ip_info/test_metrics.py new file mode 100644 index 00000000..70fb8543 --- /dev/null +++ b/tests/api_resources/waap/ip_info/test_metrics.py @@ -0,0 +1,102 @@ +# 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.waap.ip_info import WaapIPInfoCounts + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestMetrics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + metric = client.waap.ip_info.metrics.list( + ip="192.168.1.1", + ) + assert_matches_type(WaapIPInfoCounts, metric, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + metric = client.waap.ip_info.metrics.list( + ip="192.168.1.1", + domain_id=1, + ) + assert_matches_type(WaapIPInfoCounts, metric, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.ip_info.metrics.with_raw_response.list( + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = response.parse() + assert_matches_type(WaapIPInfoCounts, metric, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.ip_info.metrics.with_streaming_response.list( + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = response.parse() + assert_matches_type(WaapIPInfoCounts, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncMetrics: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + metric = await async_client.waap.ip_info.metrics.list( + ip="192.168.1.1", + ) + assert_matches_type(WaapIPInfoCounts, metric, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + metric = await async_client.waap.ip_info.metrics.list( + ip="192.168.1.1", + domain_id=1, + ) + assert_matches_type(WaapIPInfoCounts, metric, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.ip_info.metrics.with_raw_response.list( + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = await response.parse() + assert_matches_type(WaapIPInfoCounts, metric, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.ip_info.metrics.with_streaming_response.list( + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = await response.parse() + assert_matches_type(WaapIPInfoCounts, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_domains.py b/tests/api_resources/waap/test_domains.py index 9f98cca4..8c4234e4 100644 --- a/tests/api_resources/waap/test_domains.py +++ b/tests/api_resources/waap/test_domains.py @@ -11,6 +11,7 @@ from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.waap import ( + WaapPolicyMode, WaapSummaryDomain, WaapDetailedDomain, DomainListRuleSetsResponse, @@ -191,6 +192,48 @@ def test_streaming_response_list_rule_sets(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_toggle_policy(self, client: Gcore) -> None: + domain = client.waap.domains.toggle_policy( + policy_id="policy_id", + domain_id=1, + ) + assert_matches_type(WaapPolicyMode, domain, path=["response"]) + + @parametrize + def test_raw_response_toggle_policy(self, client: Gcore) -> None: + response = client.waap.domains.with_raw_response.toggle_policy( + policy_id="policy_id", + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + domain = response.parse() + assert_matches_type(WaapPolicyMode, domain, path=["response"]) + + @parametrize + def test_streaming_response_toggle_policy(self, client: Gcore) -> None: + with client.waap.domains.with_streaming_response.toggle_policy( + policy_id="policy_id", + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + domain = response.parse() + assert_matches_type(WaapPolicyMode, domain, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_toggle_policy(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): + client.waap.domains.with_raw_response.toggle_policy( + policy_id="", + domain_id=1, + ) + class TestAsyncDomains: parametrize = pytest.mark.parametrize( @@ -365,3 +408,45 @@ async def test_streaming_response_list_rule_sets(self, async_client: AsyncGcore) assert_matches_type(DomainListRuleSetsResponse, domain, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_toggle_policy(self, async_client: AsyncGcore) -> None: + domain = await async_client.waap.domains.toggle_policy( + policy_id="policy_id", + domain_id=1, + ) + assert_matches_type(WaapPolicyMode, domain, path=["response"]) + + @parametrize + async def test_raw_response_toggle_policy(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.with_raw_response.toggle_policy( + policy_id="policy_id", + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + domain = await response.parse() + assert_matches_type(WaapPolicyMode, domain, path=["response"]) + + @parametrize + async def test_streaming_response_toggle_policy(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.with_streaming_response.toggle_policy( + policy_id="policy_id", + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + domain = await response.parse() + assert_matches_type(WaapPolicyMode, domain, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_toggle_policy(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): + await async_client.waap.domains.with_raw_response.toggle_policy( + policy_id="", + domain_id=1, + ) diff --git a/tests/api_resources/waap/test_insights.py b/tests/api_resources/waap/test_insights.py new file mode 100644 index 00000000..009e880c --- /dev/null +++ b/tests/api_resources/waap/test_insights.py @@ -0,0 +1,99 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap import WaapInsightType + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInsights: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list_types(self, client: Gcore) -> None: + insight = client.waap.insights.list_types() + assert_matches_type(SyncOffsetPage[WaapInsightType], insight, path=["response"]) + + @parametrize + def test_method_list_types_with_all_params(self, client: Gcore) -> None: + insight = client.waap.insights.list_types( + insight_frequency=1, + limit=0, + name="name", + offset=0, + ordering="name", + slug="slug", + ) + assert_matches_type(SyncOffsetPage[WaapInsightType], insight, path=["response"]) + + @parametrize + def test_raw_response_list_types(self, client: Gcore) -> None: + response = client.waap.insights.with_raw_response.list_types() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight = response.parse() + assert_matches_type(SyncOffsetPage[WaapInsightType], insight, path=["response"]) + + @parametrize + def test_streaming_response_list_types(self, client: Gcore) -> None: + with client.waap.insights.with_streaming_response.list_types() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight = response.parse() + assert_matches_type(SyncOffsetPage[WaapInsightType], insight, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncInsights: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list_types(self, async_client: AsyncGcore) -> None: + insight = await async_client.waap.insights.list_types() + assert_matches_type(AsyncOffsetPage[WaapInsightType], insight, path=["response"]) + + @parametrize + async def test_method_list_types_with_all_params(self, async_client: AsyncGcore) -> None: + insight = await async_client.waap.insights.list_types( + insight_frequency=1, + limit=0, + name="name", + offset=0, + ordering="name", + slug="slug", + ) + assert_matches_type(AsyncOffsetPage[WaapInsightType], insight, path=["response"]) + + @parametrize + async def test_raw_response_list_types(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.insights.with_raw_response.list_types() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + insight = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapInsightType], insight, path=["response"]) + + @parametrize + async def test_streaming_response_list_types(self, async_client: AsyncGcore) -> None: + async with async_client.waap.insights.with_streaming_response.list_types() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + insight = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapInsightType], insight, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/test_ip_info.py b/tests/api_resources/waap/test_ip_info.py index 7db54d9d..49b4f4f3 100644 --- a/tests/api_resources/waap/test_ip_info.py +++ b/tests/api_resources/waap/test_ip_info.py @@ -10,13 +10,12 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.waap import ( - WaapIPInfo, - WaapIPInfoCounts, WaapIPDDOSInfoModel, + IPInfoGetIPInfoResponse, IPInfoGetTopURLsResponse, - IPInfoGetTopSessionsResponse, IPInfoGetTopUserAgentsResponse, IPInfoGetBlockedRequestsResponse, + IPInfoGetTopUserSessionsResponse, IPInfoGetAttackTimeSeriesResponse, IPInfoListAttackedCountriesResponse, ) @@ -27,37 +26,6 @@ class TestIPInfo: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @parametrize - def test_method_get(self, client: Gcore) -> None: - ip_info = client.waap.ip_info.get( - ip="192.168.1.1", - ) - assert_matches_type(WaapIPInfo, ip_info, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Gcore) -> None: - response = client.waap.ip_info.with_raw_response.get( - ip="192.168.1.1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ip_info = response.parse() - assert_matches_type(WaapIPInfo, ip_info, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Gcore) -> None: - with client.waap.ip_info.with_streaming_response.get( - ip="192.168.1.1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ip_info = response.parse() - assert_matches_type(WaapIPInfo, ip_info, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize def test_method_get_attack_time_series(self, client: Gcore) -> None: ip_info = client.waap.ip_info.get_attack_time_series( @@ -123,45 +91,6 @@ def test_streaming_response_get_blocked_requests(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_get_counts(self, client: Gcore) -> None: - ip_info = client.waap.ip_info.get_counts( - ip="192.168.1.1", - ) - assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) - - @parametrize - def test_method_get_counts_with_all_params(self, client: Gcore) -> None: - ip_info = client.waap.ip_info.get_counts( - ip="192.168.1.1", - domain_id=1, - ) - assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) - - @parametrize - def test_raw_response_get_counts(self, client: Gcore) -> None: - response = client.waap.ip_info.with_raw_response.get_counts( - ip="192.168.1.1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ip_info = response.parse() - assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) - - @parametrize - def test_streaming_response_get_counts(self, client: Gcore) -> None: - with client.waap.ip_info.with_streaming_response.get_counts( - ip="192.168.1.1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ip_info = response.parse() - assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize def test_method_get_ddos_attack_series(self, client: Gcore) -> None: ip_info = client.waap.ip_info.get_ddos_attack_series( @@ -194,36 +123,33 @@ def test_streaming_response_get_ddos_attack_series(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_get_top_sessions(self, client: Gcore) -> None: - ip_info = client.waap.ip_info.get_top_sessions( - domain_id=1, + def test_method_get_ip_info(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.get_ip_info( ip="192.168.1.1", ) - assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) + assert_matches_type(IPInfoGetIPInfoResponse, ip_info, path=["response"]) @parametrize - def test_raw_response_get_top_sessions(self, client: Gcore) -> None: - response = client.waap.ip_info.with_raw_response.get_top_sessions( - domain_id=1, + def test_raw_response_get_ip_info(self, client: Gcore) -> None: + response = client.waap.ip_info.with_raw_response.get_ip_info( ip="192.168.1.1", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_info = response.parse() - assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) + assert_matches_type(IPInfoGetIPInfoResponse, ip_info, path=["response"]) @parametrize - def test_streaming_response_get_top_sessions(self, client: Gcore) -> None: - with client.waap.ip_info.with_streaming_response.get_top_sessions( - domain_id=1, + def test_streaming_response_get_ip_info(self, client: Gcore) -> None: + with client.waap.ip_info.with_streaming_response.get_ip_info( ip="192.168.1.1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_info = response.parse() - assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) + assert_matches_type(IPInfoGetIPInfoResponse, ip_info, path=["response"]) assert cast(Any, response.is_closed) is True @@ -296,73 +222,76 @@ def test_streaming_response_get_top_user_agents(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_list_attacked_countries(self, client: Gcore) -> None: - ip_info = client.waap.ip_info.list_attacked_countries( + def test_method_get_top_user_sessions(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.get_top_user_sessions( + domain_id=1, ip="192.168.1.1", ) - assert_matches_type(IPInfoListAttackedCountriesResponse, ip_info, path=["response"]) + assert_matches_type(IPInfoGetTopUserSessionsResponse, ip_info, path=["response"]) @parametrize - def test_raw_response_list_attacked_countries(self, client: Gcore) -> None: - response = client.waap.ip_info.with_raw_response.list_attacked_countries( + def test_raw_response_get_top_user_sessions(self, client: Gcore) -> None: + response = client.waap.ip_info.with_raw_response.get_top_user_sessions( + domain_id=1, ip="192.168.1.1", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_info = response.parse() - assert_matches_type(IPInfoListAttackedCountriesResponse, ip_info, path=["response"]) + assert_matches_type(IPInfoGetTopUserSessionsResponse, ip_info, path=["response"]) @parametrize - def test_streaming_response_list_attacked_countries(self, client: Gcore) -> None: - with client.waap.ip_info.with_streaming_response.list_attacked_countries( + def test_streaming_response_get_top_user_sessions(self, client: Gcore) -> None: + with client.waap.ip_info.with_streaming_response.get_top_user_sessions( + domain_id=1, ip="192.168.1.1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_info = response.parse() - assert_matches_type(IPInfoListAttackedCountriesResponse, ip_info, path=["response"]) + assert_matches_type(IPInfoGetTopUserSessionsResponse, ip_info, path=["response"]) assert cast(Any, response.is_closed) is True - -class TestAsyncIPInfo: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - @parametrize - async def test_method_get(self, async_client: AsyncGcore) -> None: - ip_info = await async_client.waap.ip_info.get( + def test_method_list_attacked_countries(self, client: Gcore) -> None: + ip_info = client.waap.ip_info.list_attacked_countries( ip="192.168.1.1", ) - assert_matches_type(WaapIPInfo, ip_info, path=["response"]) + assert_matches_type(IPInfoListAttackedCountriesResponse, ip_info, path=["response"]) @parametrize - async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.ip_info.with_raw_response.get( + def test_raw_response_list_attacked_countries(self, client: Gcore) -> None: + response = client.waap.ip_info.with_raw_response.list_attacked_countries( ip="192.168.1.1", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ip_info = await response.parse() - assert_matches_type(WaapIPInfo, ip_info, path=["response"]) + ip_info = response.parse() + assert_matches_type(IPInfoListAttackedCountriesResponse, ip_info, path=["response"]) @parametrize - async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.waap.ip_info.with_streaming_response.get( + def test_streaming_response_list_attacked_countries(self, client: Gcore) -> None: + with client.waap.ip_info.with_streaming_response.list_attacked_countries( ip="192.168.1.1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ip_info = await response.parse() - assert_matches_type(WaapIPInfo, ip_info, path=["response"]) + ip_info = response.parse() + assert_matches_type(IPInfoListAttackedCountriesResponse, ip_info, path=["response"]) assert cast(Any, response.is_closed) is True + +class TestAsyncIPInfo: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + @parametrize async def test_method_get_attack_time_series(self, async_client: AsyncGcore) -> None: ip_info = await async_client.waap.ip_info.get_attack_time_series( @@ -428,45 +357,6 @@ async def test_streaming_response_get_blocked_requests(self, async_client: Async assert cast(Any, response.is_closed) is True - @parametrize - async def test_method_get_counts(self, async_client: AsyncGcore) -> None: - ip_info = await async_client.waap.ip_info.get_counts( - ip="192.168.1.1", - ) - assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) - - @parametrize - async def test_method_get_counts_with_all_params(self, async_client: AsyncGcore) -> None: - ip_info = await async_client.waap.ip_info.get_counts( - ip="192.168.1.1", - domain_id=1, - ) - assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) - - @parametrize - async def test_raw_response_get_counts(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.ip_info.with_raw_response.get_counts( - ip="192.168.1.1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ip_info = await response.parse() - assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) - - @parametrize - async def test_streaming_response_get_counts(self, async_client: AsyncGcore) -> None: - async with async_client.waap.ip_info.with_streaming_response.get_counts( - ip="192.168.1.1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ip_info = await response.parse() - assert_matches_type(WaapIPInfoCounts, ip_info, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize async def test_method_get_ddos_attack_series(self, async_client: AsyncGcore) -> None: ip_info = await async_client.waap.ip_info.get_ddos_attack_series( @@ -499,36 +389,33 @@ async def test_streaming_response_get_ddos_attack_series(self, async_client: Asy assert cast(Any, response.is_closed) is True @parametrize - async def test_method_get_top_sessions(self, async_client: AsyncGcore) -> None: - ip_info = await async_client.waap.ip_info.get_top_sessions( - domain_id=1, + async def test_method_get_ip_info(self, async_client: AsyncGcore) -> None: + ip_info = await async_client.waap.ip_info.get_ip_info( ip="192.168.1.1", ) - assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) + assert_matches_type(IPInfoGetIPInfoResponse, ip_info, path=["response"]) @parametrize - async def test_raw_response_get_top_sessions(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.ip_info.with_raw_response.get_top_sessions( - domain_id=1, + async def test_raw_response_get_ip_info(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.ip_info.with_raw_response.get_ip_info( ip="192.168.1.1", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_info = await response.parse() - assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) + assert_matches_type(IPInfoGetIPInfoResponse, ip_info, path=["response"]) @parametrize - async def test_streaming_response_get_top_sessions(self, async_client: AsyncGcore) -> None: - async with async_client.waap.ip_info.with_streaming_response.get_top_sessions( - domain_id=1, + async def test_streaming_response_get_ip_info(self, async_client: AsyncGcore) -> None: + async with async_client.waap.ip_info.with_streaming_response.get_ip_info( ip="192.168.1.1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_info = await response.parse() - assert_matches_type(IPInfoGetTopSessionsResponse, ip_info, path=["response"]) + assert_matches_type(IPInfoGetIPInfoResponse, ip_info, path=["response"]) assert cast(Any, response.is_closed) is True @@ -600,6 +487,40 @@ async def test_streaming_response_get_top_user_agents(self, async_client: AsyncG assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_get_top_user_sessions(self, async_client: AsyncGcore) -> None: + ip_info = await async_client.waap.ip_info.get_top_user_sessions( + domain_id=1, + ip="192.168.1.1", + ) + assert_matches_type(IPInfoGetTopUserSessionsResponse, ip_info, path=["response"]) + + @parametrize + async def test_raw_response_get_top_user_sessions(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.ip_info.with_raw_response.get_top_user_sessions( + domain_id=1, + ip="192.168.1.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_info = await response.parse() + assert_matches_type(IPInfoGetTopUserSessionsResponse, ip_info, path=["response"]) + + @parametrize + async def test_streaming_response_get_top_user_sessions(self, async_client: AsyncGcore) -> None: + async with async_client.waap.ip_info.with_streaming_response.get_top_user_sessions( + domain_id=1, + ip="192.168.1.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_info = await response.parse() + assert_matches_type(IPInfoGetTopUserSessionsResponse, ip_info, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_list_attacked_countries(self, async_client: AsyncGcore) -> None: ip_info = await async_client.waap.ip_info.list_attacked_countries( From 2868f0208c54015066b9c0a61d3c3e8129391352 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 7 Aug 2025 09:03:13 +0000 Subject: [PATCH 238/592] fix(security)!: rename bgp_announces change() to toggle() --- .stats.yml | 2 +- api.md | 2 +- src/gcore/resources/security/bgp_announces.py | 30 ++++++++--------- src/gcore/types/security/__init__.py | 2 +- ...arams.py => bgp_announce_toggle_params.py} | 4 +-- .../security/test_bgp_announces.py | 32 +++++++++---------- 6 files changed, 36 insertions(+), 36 deletions(-) rename src/gcore/types/security/{bgp_announce_change_params.py => bgp_announce_toggle_params.py} (75%) diff --git a/.stats.yml b/.stats.yml index 752230f0..f90e5151 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 447 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-21dade7f2034ff31578d98a7d0e769aa271906ace022862be072adc14176a108.yml openapi_spec_hash: a6b097bcb1ea27498a93ef4d26a35f90 -config_hash: df325da0df30a3d61767e7da67b6d8d4 +config_hash: 2f0d48b4e32c9c906836a67e06a1d72b diff --git a/api.md b/api.md index d81a3b14..a06f05f4 100644 --- a/api.md +++ b/api.md @@ -1707,7 +1707,7 @@ from gcore.types.security import ClientAnnounce, BgpAnnounceListResponse Methods: - client.security.bgp_announces.list(\*\*params) -> BgpAnnounceListResponse -- client.security.bgp_announces.change(\*\*params) -> object +- client.security.bgp_announces.toggle(\*\*params) -> object ## ProfileTemplates diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index 5315fbdf..43947fab 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -18,7 +18,7 @@ async_to_streamed_response_wrapper, ) from ..._base_client import make_request_options -from ...types.security import bgp_announce_list_params, bgp_announce_change_params +from ...types.security import bgp_announce_list_params, bgp_announce_toggle_params from ...types.security.bgp_announce_list_response import BgpAnnounceListResponse __all__ = ["BgpAnnouncesResource", "AsyncBgpAnnouncesResource"] @@ -93,7 +93,7 @@ def list( cast_to=BgpAnnounceListResponse, ) - def change( + def toggle( self, *, announce: str, @@ -128,14 +128,14 @@ def change( "announce": announce, "enabled": enabled, }, - bgp_announce_change_params.BgpAnnounceChangeParams, + bgp_announce_toggle_params.BgpAnnounceToggleParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform({"client_id": client_id}, bgp_announce_change_params.BgpAnnounceChangeParams), + query=maybe_transform({"client_id": client_id}, bgp_announce_toggle_params.BgpAnnounceToggleParams), ), cast_to=object, ) @@ -210,7 +210,7 @@ async def list( cast_to=BgpAnnounceListResponse, ) - async def change( + async def toggle( self, *, announce: str, @@ -245,7 +245,7 @@ async def change( "announce": announce, "enabled": enabled, }, - bgp_announce_change_params.BgpAnnounceChangeParams, + bgp_announce_toggle_params.BgpAnnounceToggleParams, ), options=make_request_options( extra_headers=extra_headers, @@ -253,7 +253,7 @@ async def change( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform( - {"client_id": client_id}, bgp_announce_change_params.BgpAnnounceChangeParams + {"client_id": client_id}, bgp_announce_toggle_params.BgpAnnounceToggleParams ), ), cast_to=object, @@ -267,8 +267,8 @@ def __init__(self, bgp_announces: BgpAnnouncesResource) -> None: self.list = to_raw_response_wrapper( bgp_announces.list, ) - self.change = to_raw_response_wrapper( - bgp_announces.change, + self.toggle = to_raw_response_wrapper( + bgp_announces.toggle, ) @@ -279,8 +279,8 @@ def __init__(self, bgp_announces: AsyncBgpAnnouncesResource) -> None: self.list = async_to_raw_response_wrapper( bgp_announces.list, ) - self.change = async_to_raw_response_wrapper( - bgp_announces.change, + self.toggle = async_to_raw_response_wrapper( + bgp_announces.toggle, ) @@ -291,8 +291,8 @@ def __init__(self, bgp_announces: BgpAnnouncesResource) -> None: self.list = to_streamed_response_wrapper( bgp_announces.list, ) - self.change = to_streamed_response_wrapper( - bgp_announces.change, + self.toggle = to_streamed_response_wrapper( + bgp_announces.toggle, ) @@ -303,6 +303,6 @@ def __init__(self, bgp_announces: AsyncBgpAnnouncesResource) -> None: self.list = async_to_streamed_response_wrapper( bgp_announces.list, ) - self.change = async_to_streamed_response_wrapper( - bgp_announces.change, + self.toggle = async_to_streamed_response_wrapper( + bgp_announces.toggle, ) diff --git a/src/gcore/types/security/__init__.py b/src/gcore/types/security/__init__.py index 7ec80761..4994ea70 100644 --- a/src/gcore/types/security/__init__.py +++ b/src/gcore/types/security/__init__.py @@ -13,6 +13,6 @@ from .client_profile_template import ClientProfileTemplate as ClientProfileTemplate from .profile_recreate_params import ProfileRecreateParams as ProfileRecreateParams from .bgp_announce_list_params import BgpAnnounceListParams as BgpAnnounceListParams -from .bgp_announce_change_params import BgpAnnounceChangeParams as BgpAnnounceChangeParams from .bgp_announce_list_response import BgpAnnounceListResponse as BgpAnnounceListResponse +from .bgp_announce_toggle_params import BgpAnnounceToggleParams as BgpAnnounceToggleParams from .profile_template_list_response import ProfileTemplateListResponse as ProfileTemplateListResponse diff --git a/src/gcore/types/security/bgp_announce_change_params.py b/src/gcore/types/security/bgp_announce_toggle_params.py similarity index 75% rename from src/gcore/types/security/bgp_announce_change_params.py rename to src/gcore/types/security/bgp_announce_toggle_params.py index ef52617b..4c5dd1b6 100644 --- a/src/gcore/types/security/bgp_announce_change_params.py +++ b/src/gcore/types/security/bgp_announce_toggle_params.py @@ -5,10 +5,10 @@ from typing import Optional from typing_extensions import Required, TypedDict -__all__ = ["BgpAnnounceChangeParams"] +__all__ = ["BgpAnnounceToggleParams"] -class BgpAnnounceChangeParams(TypedDict, total=False): +class BgpAnnounceToggleParams(TypedDict, total=False): announce: Required[str] enabled: Required[bool] diff --git a/tests/api_resources/security/test_bgp_announces.py b/tests/api_resources/security/test_bgp_announces.py index 03b72039..c1115976 100644 --- a/tests/api_resources/security/test_bgp_announces.py +++ b/tests/api_resources/security/test_bgp_announces.py @@ -53,16 +53,16 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_change(self, client: Gcore) -> None: - bgp_announce = client.security.bgp_announces.change( + def test_method_toggle(self, client: Gcore) -> None: + bgp_announce = client.security.bgp_announces.toggle( announce="192.9.9.1/32", enabled=True, ) assert_matches_type(object, bgp_announce, path=["response"]) @parametrize - def test_method_change_with_all_params(self, client: Gcore) -> None: - bgp_announce = client.security.bgp_announces.change( + def test_method_toggle_with_all_params(self, client: Gcore) -> None: + bgp_announce = client.security.bgp_announces.toggle( announce="192.9.9.1/32", enabled=True, client_id=0, @@ -70,8 +70,8 @@ def test_method_change_with_all_params(self, client: Gcore) -> None: assert_matches_type(object, bgp_announce, path=["response"]) @parametrize - def test_raw_response_change(self, client: Gcore) -> None: - response = client.security.bgp_announces.with_raw_response.change( + def test_raw_response_toggle(self, client: Gcore) -> None: + response = client.security.bgp_announces.with_raw_response.toggle( announce="192.9.9.1/32", enabled=True, ) @@ -82,8 +82,8 @@ def test_raw_response_change(self, client: Gcore) -> None: assert_matches_type(object, bgp_announce, path=["response"]) @parametrize - def test_streaming_response_change(self, client: Gcore) -> None: - with client.security.bgp_announces.with_streaming_response.change( + def test_streaming_response_toggle(self, client: Gcore) -> None: + with client.security.bgp_announces.with_streaming_response.toggle( announce="192.9.9.1/32", enabled=True, ) as response: @@ -137,16 +137,16 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert cast(Any, response.is_closed) is True @parametrize - async def test_method_change(self, async_client: AsyncGcore) -> None: - bgp_announce = await async_client.security.bgp_announces.change( + async def test_method_toggle(self, async_client: AsyncGcore) -> None: + bgp_announce = await async_client.security.bgp_announces.toggle( announce="192.9.9.1/32", enabled=True, ) assert_matches_type(object, bgp_announce, path=["response"]) @parametrize - async def test_method_change_with_all_params(self, async_client: AsyncGcore) -> None: - bgp_announce = await async_client.security.bgp_announces.change( + async def test_method_toggle_with_all_params(self, async_client: AsyncGcore) -> None: + bgp_announce = await async_client.security.bgp_announces.toggle( announce="192.9.9.1/32", enabled=True, client_id=0, @@ -154,8 +154,8 @@ async def test_method_change_with_all_params(self, async_client: AsyncGcore) -> assert_matches_type(object, bgp_announce, path=["response"]) @parametrize - async def test_raw_response_change(self, async_client: AsyncGcore) -> None: - response = await async_client.security.bgp_announces.with_raw_response.change( + async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: + response = await async_client.security.bgp_announces.with_raw_response.toggle( announce="192.9.9.1/32", enabled=True, ) @@ -166,8 +166,8 @@ async def test_raw_response_change(self, async_client: AsyncGcore) -> None: assert_matches_type(object, bgp_announce, path=["response"]) @parametrize - async def test_streaming_response_change(self, async_client: AsyncGcore) -> None: - async with async_client.security.bgp_announces.with_streaming_response.change( + async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: + async with async_client.security.bgp_announces.with_streaming_response.toggle( announce="192.9.9.1/32", enabled=True, ) as response: From 2c17f3d817199d93a233c9bb56725f30246e5f7b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 7 Aug 2025 16:16:33 +0000 Subject: [PATCH 239/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6d78745c..091cfb12 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.9.0" + ".": "0.10.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 582fec8f..66959330 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.9.0" +version = "0.10.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 648efad4..4eb294cb 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.9.0" # x-release-please-version +__version__ = "0.10.0" # x-release-please-version From 51d7e7a709b19edafcf0f8a81dbfd5073c4de249 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 8 Aug 2025 09:16:42 +0000 Subject: [PATCH 240/592] feat(cloud): use PATCH /v2/lbpools --- .stats.yml | 2 +- api.md | 2 +- .../cloud/load_balancers/pools/pools.py | 40 +++++++++++++++---- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index f90e5151..6e711bd3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 447 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-21dade7f2034ff31578d98a7d0e769aa271906ace022862be072adc14176a108.yml openapi_spec_hash: a6b097bcb1ea27498a93ef4d26a35f90 -config_hash: 2f0d48b4e32c9c906836a67e06a1d72b +config_hash: 0eef23ac91befdd529503f40af5ea9b1 diff --git a/api.md b/api.md index a06f05f4..0cf5ec57 100644 --- a/api.md +++ b/api.md @@ -258,7 +258,7 @@ Methods: Methods: - client.cloud.load_balancers.pools.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.pools.update(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.pools.update(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.pools.list(\*, project_id, region_id, \*\*params) -> LoadBalancerPoolList - client.cloud.load_balancers.pools.delete(pool_id, \*, project_id, region_id) -> TaskIDList - client.cloud.load_balancers.pools.get(pool_id, \*, project_id, region_id) -> LoadBalancerPool diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 96e3e2fa..c0df516c 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -199,9 +199,21 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Changes provided here will overwrite existing load balancer pool settings. - Undefined fields will be kept as is. Complex objects need to be specified fully, - they will be overwritten. + Updates the specified load balancer pool with the provided changes. + **Behavior:** + + - Simple fields (strings, numbers, booleans) will be updated if provided + - Complex objects (nested structures like members, health monitors, etc.) must + be specified completely - partial updates are not supported for these objects + - Undefined fields will remain unchanged + - If no change is detected for a specific field compared to the current pool + state, that field will be skipped + - If no changes are detected at all across all fields, no task will be created + and an empty task list will be returned **Examples of complex objects that + require full specification:** + - Pool members: All member properties must be provided when updating members + - Health monitors: Complete health monitor configuration must be specified + - Session persistence: Full session persistence settings must be included Args: project_id: Project ID @@ -250,7 +262,7 @@ def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._patch( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=maybe_transform( { "ca_secret_id": ca_secret_id, @@ -580,9 +592,21 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Changes provided here will overwrite existing load balancer pool settings. - Undefined fields will be kept as is. Complex objects need to be specified fully, - they will be overwritten. + Updates the specified load balancer pool with the provided changes. + **Behavior:** + + - Simple fields (strings, numbers, booleans) will be updated if provided + - Complex objects (nested structures like members, health monitors, etc.) must + be specified completely - partial updates are not supported for these objects + - Undefined fields will remain unchanged + - If no change is detected for a specific field compared to the current pool + state, that field will be skipped + - If no changes are detected at all across all fields, no task will be created + and an empty task list will be returned **Examples of complex objects that + require full specification:** + - Pool members: All member properties must be provided when updating members + - Health monitors: Complete health monitor configuration must be specified + - Session persistence: Full session persistence settings must be included Args: project_id: Project ID @@ -631,7 +655,7 @@ async def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._patch( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=await async_maybe_transform( { "ca_secret_id": ca_secret_id, From 23b813a560aa1d625014303db5798af0aba91e24 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 8 Aug 2025 18:24:19 +0000 Subject: [PATCH 241/592] chore: update @stainless-api/prism-cli to v5.15.0 --- scripts/mock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mock b/scripts/mock index d2814ae6..0b28f6ea 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" fi From fdb42ca3da69c206e4758dba357c7109486adefd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 9 Aug 2025 05:49:22 +0000 Subject: [PATCH 242/592] chore(internal): detect breaking changes when removing endpoints --- .github/workflows/detect-breaking-changes.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/detect-breaking-changes.yml b/.github/workflows/detect-breaking-changes.yml index 2803e06e..e16b5001 100644 --- a/.github/workflows/detect-breaking-changes.yml +++ b/.github/workflows/detect-breaking-changes.yml @@ -32,4 +32,8 @@ jobs: rye sync --all-features - name: Detect breaking changes - run: ./scripts/detect-breaking-changes ${{ github.event.pull_request.base.sha }} \ No newline at end of file + run: | + # Try to check out previous versions of the breaking change detection script. This ensures that + # we still detect breaking changes when entire files and their tests are removed. + git checkout "${{ github.event.pull_request.base.sha }}" -- ./scripts/detect-breaking-changes 2>/dev/null || true + ./scripts/detect-breaking-changes ${{ github.event.pull_request.base.sha }} \ No newline at end of file From 9ebfd20b8eaffd8648cab7a601575317138b163c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 9 Aug 2025 05:53:35 +0000 Subject: [PATCH 243/592] chore(internal): update comment in script --- scripts/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test b/scripts/test index 2b878456..dbeda2d2 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! prism_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the prism command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" echo exit 1 From 07f702c4b7941807e14b0054607a41fd1dd9a7b2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 13:22:37 +0000 Subject: [PATCH 244/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 9 +- src/gcore/resources/cloud/cost_reports.py | 40 ++++---- .../cloud/file_shares/file_shares.py | 36 ++++++-- .../cloud/inference/registry_credentials.py | 17 ++-- src/gcore/resources/cloud/tasks.py | 92 +++++++++---------- .../resources/cloud/users/role_assignments.py | 9 +- .../cloud/baremetal/server_create_params.py | 11 ++- ...st_report_get_aggregated_monthly_params.py | 15 +-- src/gcore/types/cloud/ddos_profile.py | 20 ++-- src/gcore/types/cloud/ddos_profile_field.py | 29 ++++-- .../types/cloud/ddos_profile_option_list.py | 13 +-- src/gcore/types/cloud/ddos_profile_status.py | 4 +- .../types/cloud/ddos_profile_template.py | 10 +- .../cloud/ddos_profile_template_field.py | 15 ++- src/gcore/types/cloud/file_share.py | 2 +- .../types/cloud/file_share_create_params.py | 14 ++- src/gcore/types/cloud/inference/__init__.py | 3 - .../inference_registry_credentials_create.py | 22 ----- src/gcore/types/cloud/task_list_params.py | 46 +++++----- .../types/cloud/users/role_assignment.py | 3 +- .../users/role_assignment_create_params.py | 6 +- .../users/role_assignment_update_params.py | 6 +- .../inference/test_registry_credentials.py | 25 +++-- .../api_resources/cloud/test_cost_reports.py | 40 +++----- tests/api_resources/cloud/test_file_shares.py | 14 ++- 26 files changed, 266 insertions(+), 239 deletions(-) delete mode 100644 src/gcore/types/cloud/inference/inference_registry_credentials_create.py diff --git a/.stats.yml b/.stats.yml index 6e711bd3..787177c7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 447 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-21dade7f2034ff31578d98a7d0e769aa271906ace022862be072adc14176a108.yml -openapi_spec_hash: a6b097bcb1ea27498a93ef4d26a35f90 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8adebc369a231e1ce31d1d812970d147bc22fdbd5373aeea53722091e03cc889.yml +openapi_spec_hash: 08ee188ad64ee8fb77128276b5f81467 config_hash: 0eef23ac91befdd529503f40af5ea9b1 diff --git a/api.md b/api.md index 0cf5ec57..80ad08e0 100644 --- a/api.md +++ b/api.md @@ -528,19 +528,16 @@ Methods: Types: ```python -from gcore.types.cloud.inference import ( - InferenceRegistryCredentials, - InferenceRegistryCredentialsCreate, -) +from gcore.types.cloud.inference import InferenceRegistryCredentials ``` Methods: -- client.cloud.inference.registry_credentials.create(\*, project_id, \*\*params) -> InferenceRegistryCredentialsCreate +- client.cloud.inference.registry_credentials.create(\*, project_id, \*\*params) -> InferenceRegistryCredentials - client.cloud.inference.registry_credentials.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceRegistryCredentials] - client.cloud.inference.registry_credentials.delete(credential_name, \*, project_id) -> None - client.cloud.inference.registry_credentials.get(credential_name, \*, project_id) -> InferenceRegistryCredentials -- client.cloud.inference.registry_credentials.replace(credential_name, \*, project_id, \*\*params) -> InferenceRegistryCredentialsCreate +- client.cloud.inference.registry_credentials.replace(credential_name, \*, project_id, \*\*params) -> InferenceRegistryCredentials ### Secrets diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index b04695a9..36075dd6 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -171,13 +171,13 @@ def get_aggregated( def get_aggregated_monthly( self, *, - time_from: Union[str, datetime], - time_to: Union[str, datetime], regions: Iterable[int] | NotGiven = NOT_GIVEN, response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, rounding: bool | NotGiven = NOT_GIVEN, schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | NotGiven = NOT_GIVEN, tags: cost_report_get_aggregated_monthly_params.Tags | NotGiven = NOT_GIVEN, + time_from: Union[str, datetime] | NotGiven = NOT_GIVEN, + time_to: Union[str, datetime] | NotGiven = NOT_GIVEN, types: List[ Literal[ "ai_cluster", @@ -208,6 +208,7 @@ def get_aggregated_monthly( ] ] | NotGiven = NOT_GIVEN, + year_month: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -227,10 +228,6 @@ def get_aggregated_monthly( hours until the servers are back online and the missing data is filled in. Args: - time_from: Beginning of the period: YYYY-mm - - time_to: End of the period: YYYY-mm - regions: List of region IDs. response_format: Format of the response (`csv_totals` or json). @@ -241,8 +238,14 @@ def get_aggregated_monthly( tags: Filter by tags + time_from: Deprecated. Use `year_month` instead. Beginning of the period: YYYY-mm + + time_to: Deprecated. Use `year_month` instead. End of the period: YYYY-mm + types: List of resource types to be filtered in the report. + year_month: Year and month in the format YYYY-MM + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -255,14 +258,15 @@ def get_aggregated_monthly( "/cloud/v1/reservation_cost_report/totals", body=maybe_transform( { - "time_from": time_from, - "time_to": time_to, "regions": regions, "response_format": response_format, "rounding": rounding, "schema_filter": schema_filter, "tags": tags, + "time_from": time_from, + "time_to": time_to, "types": types, + "year_month": year_month, }, cost_report_get_aggregated_monthly_params.CostReportGetAggregatedMonthlyParams, ), @@ -543,13 +547,13 @@ async def get_aggregated( async def get_aggregated_monthly( self, *, - time_from: Union[str, datetime], - time_to: Union[str, datetime], regions: Iterable[int] | NotGiven = NOT_GIVEN, response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, rounding: bool | NotGiven = NOT_GIVEN, schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | NotGiven = NOT_GIVEN, tags: cost_report_get_aggregated_monthly_params.Tags | NotGiven = NOT_GIVEN, + time_from: Union[str, datetime] | NotGiven = NOT_GIVEN, + time_to: Union[str, datetime] | NotGiven = NOT_GIVEN, types: List[ Literal[ "ai_cluster", @@ -580,6 +584,7 @@ async def get_aggregated_monthly( ] ] | NotGiven = NOT_GIVEN, + year_month: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -599,10 +604,6 @@ async def get_aggregated_monthly( hours until the servers are back online and the missing data is filled in. Args: - time_from: Beginning of the period: YYYY-mm - - time_to: End of the period: YYYY-mm - regions: List of region IDs. response_format: Format of the response (`csv_totals` or json). @@ -613,8 +614,14 @@ async def get_aggregated_monthly( tags: Filter by tags + time_from: Deprecated. Use `year_month` instead. Beginning of the period: YYYY-mm + + time_to: Deprecated. Use `year_month` instead. End of the period: YYYY-mm + types: List of resource types to be filtered in the report. + year_month: Year and month in the format YYYY-MM + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -627,14 +634,15 @@ async def get_aggregated_monthly( "/cloud/v1/reservation_cost_report/totals", body=await async_maybe_transform( { - "time_from": time_from, - "time_to": time_to, "regions": regions, "response_format": response_format, "rounding": rounding, "schema_filter": schema_filter, "tags": tags, + "time_from": time_from, + "time_to": time_to, "types": types, + "year_month": year_month, }, cost_report_get_aggregated_monthly_params.CostReportGetAggregatedMonthlyParams, ), diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index f04a3c4f..71c1c9d8 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -76,6 +76,7 @@ def create( size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, tags: Dict[str, str] | NotGiven = NOT_GIVEN, + type_name: Literal["standard"] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -108,7 +109,9 @@ def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - volume_type: File share volume type + type_name: Standard file share type + + volume_type: Deprecated. Use `type_name` instead. extra_headers: Send extra headers @@ -129,9 +132,10 @@ def create( name: str, protocol: Literal["NFS"], size: int, - volume_type: Literal["vast_share_type"], share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, tags: Dict[str, str] | NotGiven = NOT_GIVEN, + type_name: Literal["vast"] | NotGiven = NOT_GIVEN, + volume_type: Literal["vast_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -153,8 +157,6 @@ def create( size: File share size - volume_type: File share volume type - share_settings: Configuration settings for the share tags: Key-value tags to associate with the resource. A tag is a key-value pair that @@ -163,6 +165,10 @@ def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. + type_name: Vast file share type + + volume_type: Deprecated. Use `type_name` instead. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -173,7 +179,7 @@ def create( """ ... - @required_args(["name", "network", "protocol", "size"], ["name", "protocol", "size", "volume_type"]) + @required_args(["name", "network", "protocol", "size"], ["name", "protocol", "size"]) def create( self, *, @@ -185,6 +191,7 @@ def create( size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, tags: Dict[str, str] | NotGiven = NOT_GIVEN, + type_name: Literal["standard"] | Literal["vast"] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -208,6 +215,7 @@ def create( "size": size, "access": access, "tags": tags, + "type_name": type_name, "volume_type": volume_type, "share_settings": share_settings, }, @@ -537,6 +545,7 @@ async def create( size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, tags: Dict[str, str] | NotGiven = NOT_GIVEN, + type_name: Literal["standard"] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -569,7 +578,9 @@ async def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - volume_type: File share volume type + type_name: Standard file share type + + volume_type: Deprecated. Use `type_name` instead. extra_headers: Send extra headers @@ -590,9 +601,10 @@ async def create( name: str, protocol: Literal["NFS"], size: int, - volume_type: Literal["vast_share_type"], share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, tags: Dict[str, str] | NotGiven = NOT_GIVEN, + type_name: Literal["vast"] | NotGiven = NOT_GIVEN, + volume_type: Literal["vast_share_type"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -614,8 +626,6 @@ async def create( size: File share size - volume_type: File share volume type - share_settings: Configuration settings for the share tags: Key-value tags to associate with the resource. A tag is a key-value pair that @@ -624,6 +634,10 @@ async def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. + type_name: Vast file share type + + volume_type: Deprecated. Use `type_name` instead. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -634,7 +648,7 @@ async def create( """ ... - @required_args(["name", "network", "protocol", "size"], ["name", "protocol", "size", "volume_type"]) + @required_args(["name", "network", "protocol", "size"], ["name", "protocol", "size"]) async def create( self, *, @@ -646,6 +660,7 @@ async def create( size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, tags: Dict[str, str] | NotGiven = NOT_GIVEN, + type_name: Literal["standard"] | Literal["vast"] | NotGiven = NOT_GIVEN, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -669,6 +684,7 @@ async def create( "size": size, "access": access, "tags": tags, + "type_name": type_name, "volume_type": volume_type, "share_settings": share_settings, }, diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index f5981625..6dd78f70 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -22,7 +22,6 @@ registry_credential_replace_params, ) from ....types.cloud.inference.inference_registry_credentials import InferenceRegistryCredentials -from ....types.cloud.inference.inference_registry_credentials_create import InferenceRegistryCredentialsCreate __all__ = ["RegistryCredentialsResource", "AsyncRegistryCredentialsResource"] @@ -61,7 +60,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InferenceRegistryCredentialsCreate: + ) -> InferenceRegistryCredentials: """ Create inference registry credential @@ -100,7 +99,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceRegistryCredentialsCreate, + cast_to=InferenceRegistryCredentials, ) def list( @@ -251,7 +250,7 @@ def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InferenceRegistryCredentialsCreate: + ) -> InferenceRegistryCredentials: """ Replace inference registry credential @@ -291,7 +290,7 @@ def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceRegistryCredentialsCreate, + cast_to=InferenceRegistryCredentials, ) @@ -329,7 +328,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InferenceRegistryCredentialsCreate: + ) -> InferenceRegistryCredentials: """ Create inference registry credential @@ -368,7 +367,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceRegistryCredentialsCreate, + cast_to=InferenceRegistryCredentials, ) def list( @@ -519,7 +518,7 @@ async def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InferenceRegistryCredentialsCreate: + ) -> InferenceRegistryCredentials: """ Replace inference registry credential @@ -559,7 +558,7 @@ async def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceRegistryCredentialsCreate, + cast_to=InferenceRegistryCredentials, ) diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 338244f7..63bc78f7 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -104,25 +104,25 @@ def list( '`create_faas_function`', '`create_faas_namespace`', '`create_fip`', '`create_gpu_virtual_cluster`', '`create_image`', '`create_inference_application`', '`create_inference_instance`', - '`create_inference_instance_key`', '`create_k8s_cluster_pool_v2`', - '`create_k8s_cluster_v2`', '`create_l7policy`', '`create_l7rule`', - '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', - '`create_lbpool_health_monitor`', '`create_loadbalancer`', '`create_network`', - '`create_reserved_fixed_ip`', '`create_router`', '`create_secret`', - '`create_servergroup`', '`create_sfs`', '`create_snapshot`', '`create_subnet`', - '`create_vm`', '`create_volume`', '`deactivate_ddos_profile`', - '`delete_ai_cluster_gpu`', '`delete_caas_container`', - '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', - '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', - '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', '`delete_image`', - '`delete_inference_application`', '`delete_inference_instance`', - '`delete_k8s_cluster_pool_v2`', '`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`', + '`create_k8s_cluster_pool_v2`', '`create_k8s_cluster_v2`', '`create_l7policy`', + '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', + '`create_lbpool`', '`create_lbpool_health_monitor`', '`create_loadbalancer`', + '`create_network`', '`create_reserved_fixed_ip`', '`create_router`', + '`create_secret`', '`create_servergroup`', '`create_sfs`', '`create_snapshot`', + '`create_subnet`', '`create_vm`', '`create_volume`', + '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', + '`delete_caas_container`', '`delete_dbaas_postgres_cluster`', + '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', + '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', + '`delete_image`', '`delete_inference_application`', + '`delete_inference_instance`', '`delete_k8s_cluster_pool_v2`', + '`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`', '`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`', @@ -139,10 +139,10 @@ 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_inference_instance_key`', '`update_k8s_cluster_v2`', - '`update_lbmetadata`', '`update_port_allowed_address_pairs`', - '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', - '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] + '`update_k8s_cluster_v2`', '`update_lbmetadata`', + '`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`', + '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', + '`upscale_gpu_virtual_cluster`'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` @@ -379,25 +379,25 @@ def list( '`create_faas_function`', '`create_faas_namespace`', '`create_fip`', '`create_gpu_virtual_cluster`', '`create_image`', '`create_inference_application`', '`create_inference_instance`', - '`create_inference_instance_key`', '`create_k8s_cluster_pool_v2`', - '`create_k8s_cluster_v2`', '`create_l7policy`', '`create_l7rule`', - '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', - '`create_lbpool_health_monitor`', '`create_loadbalancer`', '`create_network`', - '`create_reserved_fixed_ip`', '`create_router`', '`create_secret`', - '`create_servergroup`', '`create_sfs`', '`create_snapshot`', '`create_subnet`', - '`create_vm`', '`create_volume`', '`deactivate_ddos_profile`', - '`delete_ai_cluster_gpu`', '`delete_caas_container`', - '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', - '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', - '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', '`delete_image`', - '`delete_inference_application`', '`delete_inference_instance`', - '`delete_k8s_cluster_pool_v2`', '`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`', + '`create_k8s_cluster_pool_v2`', '`create_k8s_cluster_v2`', '`create_l7policy`', + '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', + '`create_lbpool`', '`create_lbpool_health_monitor`', '`create_loadbalancer`', + '`create_network`', '`create_reserved_fixed_ip`', '`create_router`', + '`create_secret`', '`create_servergroup`', '`create_sfs`', '`create_snapshot`', + '`create_subnet`', '`create_vm`', '`create_volume`', + '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', + '`delete_caas_container`', '`delete_dbaas_postgres_cluster`', + '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', + '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', + '`delete_image`', '`delete_inference_application`', + '`delete_inference_instance`', '`delete_k8s_cluster_pool_v2`', + '`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`', '`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`', @@ -414,10 +414,10 @@ 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_inference_instance_key`', '`update_k8s_cluster_v2`', - '`update_lbmetadata`', '`update_port_allowed_address_pairs`', - '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', - '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] + '`update_k8s_cluster_v2`', '`update_lbmetadata`', + '`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`', + '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', + '`upscale_gpu_virtual_cluster`'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 1b09de11..5294d3a7 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import Optional +from typing_extensions import Literal import httpx @@ -52,7 +53,7 @@ def with_streaming_response(self) -> RoleAssignmentsResourceWithStreamingRespons def create( self, *, - role: str, + role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"], user_id: int, client_id: Optional[int] | NotGiven = NOT_GIVEN, project_id: Optional[int] | NotGiven = NOT_GIVEN, @@ -104,7 +105,7 @@ def update( self, assignment_id: int, *, - role: str, + role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"], user_id: int, client_id: Optional[int] | NotGiven = NOT_GIVEN, project_id: Optional[int] | NotGiven = NOT_GIVEN, @@ -267,7 +268,7 @@ def with_streaming_response(self) -> AsyncRoleAssignmentsResourceWithStreamingRe async def create( self, *, - role: str, + role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"], user_id: int, client_id: Optional[int] | NotGiven = NOT_GIVEN, project_id: Optional[int] | NotGiven = NOT_GIVEN, @@ -319,7 +320,7 @@ async def update( self, assignment_id: int, *, - role: str, + role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"], user_id: int, client_id: Optional[int] | NotGiven = NOT_GIVEN, project_id: Optional[int] | NotGiven = NOT_GIVEN, diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index e6afbd0b..ba955d3b 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -346,10 +346,10 @@ class InterfaceCreateBareMetalReservedFixedIPInterfaceSerializer(TypedDict, tota class DDOSProfileField(TypedDict, total=False): base_field: Optional[int] - """ID of DDoS profile field""" + """Unique identifier of the DDoS protection field being configured""" field_name: Optional[str] - """Name of DDoS profile field""" + """Human-readable name of the DDoS protection field being configured""" field_value: Union[Iterable[object], int, str, None] """Complex value. Only one of 'value' or '`field_value`' must be specified.""" @@ -360,7 +360,10 @@ class DDOSProfileField(TypedDict, total=False): class DDOSProfile(TypedDict, total=False): profile_template: Required[int] - """Advanced DDoS template ID""" + """Unique identifier of the DDoS protection template to use for this profile""" fields: Iterable[DDOSProfileField] - """DDoS profile parameters""" + """ + List of field configurations that customize the protection parameters for this + profile + """ 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 e28efb98..4a257226 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 @@ -42,12 +42,6 @@ class CostReportGetAggregatedMonthlyParams(TypedDict, total=False): - time_from: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - """Beginning of the period: YYYY-mm""" - - time_to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - """End of the period: YYYY-mm""" - regions: Iterable[int] """List of region IDs.""" @@ -63,6 +57,12 @@ class CostReportGetAggregatedMonthlyParams(TypedDict, total=False): tags: Tags """Filter by tags""" + time_from: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Deprecated. Use `year_month` instead. Beginning of the period: YYYY-mm""" + + time_to: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Deprecated. Use `year_month` instead. End of the period: YYYY-mm""" + types: List[ Literal[ "ai_cluster", @@ -94,6 +94,9 @@ class CostReportGetAggregatedMonthlyParams(TypedDict, total=False): ] """List of resource types to be filtered in the report.""" + year_month: str + """Year and month in the format YYYY-MM""" + class SchemaFilterSchemaFilterSnapshotSerializer(TypedDict, total=False): field: Required[Literal["last_name", "last_size", "source_volume_uuid", "type", "uuid", "volume_type"]] diff --git a/src/gcore/types/cloud/ddos_profile.py b/src/gcore/types/cloud/ddos_profile.py index bc242300..2db25f56 100644 --- a/src/gcore/types/cloud/ddos_profile.py +++ b/src/gcore/types/cloud/ddos_profile.py @@ -13,27 +13,33 @@ class Protocol(BaseModel): port: str + """Network port number for which protocols are configured""" protocols: List[str] + """List of network protocols enabled on the specified port""" class DDOSProfile(BaseModel): id: int - """DDoS protection profile ID""" + """Unique identifier for the DDoS protection profile""" - profile_template: Optional[DDOSProfileTemplate] = None - """Template data""" + fields: List[DDOSProfileField] + """List of configured field values for the protection profile""" - fields: Optional[List[DDOSProfileField]] = None + options: DDOSProfileOptionList + """Configuration options controlling profile activation and BGP routing""" - options: Optional[DDOSProfileOptionList] = None + profile_template: Optional[DDOSProfileTemplate] = None + """Complete template configuration data used for this profile""" profile_template_description: Optional[str] = None - """DDoS profile template description""" + """Detailed description of the protection template used for this profile""" protocols: Optional[List[Protocol]] = None - """List of protocols""" + """List of network protocols and ports configured for protection""" site: Optional[str] = None + """Geographic site identifier where the protection is deployed""" status: Optional[DDOSProfileStatus] = None + """Current operational status and any error information for the profile""" diff --git a/src/gcore/types/cloud/ddos_profile_field.py b/src/gcore/types/cloud/ddos_profile_field.py index 6ec1b6c8..f0d03515 100644 --- a/src/gcore/types/cloud/ddos_profile_field.py +++ b/src/gcore/types/cloud/ddos_profile_field.py @@ -9,23 +9,36 @@ class DDOSProfileField(BaseModel): id: int + """Unique identifier for the DDoS protection field""" - default: object - - description: str - - field_value: object + base_field: Optional[int] = None + """ID of DDoS profile field""" - name: str + default: Optional[str] = None + """Predefined default value for the field if not specified""" - base_field: Optional[int] = None + description: Optional[str] = None + """Detailed description explaining the field's purpose and usage guidelines""" field_name: Optional[str] = None + """Name of DDoS profile field""" field_type: Optional[str] = None + """Data type classification of the field (e.g., string, integer, array)""" + + field_value: object + """Complex value. Only one of 'value' or '`field_value`' must be specified.""" + + name: str + """Human-readable name of the protection field""" required: Optional[bool] = None + """ + Indicates whether this field must be provided when creating a protection profile + """ - validation_schema: Optional[object] = None + validation_schema: object + """JSON schema defining validation rules and constraints for the field value""" value: Optional[str] = None + """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" diff --git a/src/gcore/types/cloud/ddos_profile_option_list.py b/src/gcore/types/cloud/ddos_profile_option_list.py index d3638aa9..cd7729a0 100644 --- a/src/gcore/types/cloud/ddos_profile_option_list.py +++ b/src/gcore/types/cloud/ddos_profile_option_list.py @@ -1,15 +1,16 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional - from ..._models import BaseModel __all__ = ["DDOSProfileOptionList"] class DDOSProfileOptionList(BaseModel): - active: Optional[bool] = None - """Activate profile.""" + active: bool + """ + Controls whether the DDoS protection profile is enabled and actively protecting + the resource + """ - bgp: Optional[bool] = None - """Activate BGP protocol.""" + bgp: bool + """Enables Border Gateway Protocol (BGP) routing for DDoS protection traffic""" diff --git a/src/gcore/types/cloud/ddos_profile_status.py b/src/gcore/types/cloud/ddos_profile_status.py index b6b7ea5f..d76982fd 100644 --- a/src/gcore/types/cloud/ddos_profile_status.py +++ b/src/gcore/types/cloud/ddos_profile_status.py @@ -7,7 +7,7 @@ class DDOSProfileStatus(BaseModel): error_description: str - """Description of the error, if it exists""" + """Detailed error message describing any issues with the profile operation""" status: str - """Profile status""" + """Current operational status of the DDoS protection profile""" diff --git a/src/gcore/types/cloud/ddos_profile_template.py b/src/gcore/types/cloud/ddos_profile_template.py index f3154487..5fcaa343 100644 --- a/src/gcore/types/cloud/ddos_profile_template.py +++ b/src/gcore/types/cloud/ddos_profile_template.py @@ -10,9 +10,13 @@ class DDOSProfileTemplate(BaseModel): id: int - - name: str + """Unique identifier for the DDoS protection template""" description: Optional[str] = None + """Detailed description explaining the template's purpose and use cases""" - fields: Optional[List[DDOSProfileTemplateField]] = None + fields: List[DDOSProfileTemplateField] + """List of configurable fields that define the template's protection parameters""" + + name: str + """Human-readable name of the protection template""" diff --git a/src/gcore/types/cloud/ddos_profile_template_field.py b/src/gcore/types/cloud/ddos_profile_template_field.py index df9a9078..96256752 100644 --- a/src/gcore/types/cloud/ddos_profile_template_field.py +++ b/src/gcore/types/cloud/ddos_profile_template_field.py @@ -9,15 +9,24 @@ class DDOSProfileTemplateField(BaseModel): id: int - - name: str + """Unique identifier for the DDoS protection field""" default: Optional[str] = None + """Predefined default value for the field if not specified""" description: Optional[str] = None + """Detailed description explaining the field's purpose and usage guidelines""" field_type: Optional[str] = None + """Data type classification of the field (e.g., string, integer, array)""" + + name: str + """Human-readable name of the protection field""" required: Optional[bool] = None + """ + Indicates whether this field must be provided when creating a protection profile + """ - validation_schema: Optional[object] = None + validation_schema: object + """JSON schema defining validation rules and constraints for the field value""" diff --git a/src/gcore/types/cloud/file_share.py b/src/gcore/types/cloud/file_share.py index 7f19bba3..63bf7603 100644 --- a/src/gcore/types/cloud/file_share.py +++ b/src/gcore/types/cloud/file_share.py @@ -145,4 +145,4 @@ class FileShare(BaseModel): """File share type name""" volume_type: Literal["default_share_type", "vast_share_type"] - """File share disk type""" + """Deprecated. Use `type_name` instead. File share disk type""" diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index 7d6f2c49..4c26cfd7 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -47,8 +47,11 @@ class CreateStandardFileShareSerializer(TypedDict, total=False): values. """ + type_name: Literal["standard"] + """Standard file share type""" + volume_type: Literal["default_share_type"] - """File share volume type""" + """Deprecated. Use `type_name` instead.""" class CreateStandardFileShareSerializerNetwork(TypedDict, total=False): @@ -86,9 +89,6 @@ class CreateVastFileShareSerializer(TypedDict, total=False): size: Required[int] """File share size""" - volume_type: Required[Literal["vast_share_type"]] - """File share volume type""" - share_settings: CreateVastFileShareSerializerShareSettings """Configuration settings for the share""" @@ -102,6 +102,12 @@ class CreateVastFileShareSerializer(TypedDict, total=False): values. """ + type_name: Literal["vast"] + """Vast file share type""" + + volume_type: Literal["vast_share_type"] + """Deprecated. Use `type_name` instead.""" + class CreateVastFileShareSerializerShareSettings(TypedDict, total=False): root_squash: bool diff --git a/src/gcore/types/cloud/inference/__init__.py b/src/gcore/types/cloud/inference/__init__.py index e692efab..19ceb1f7 100644 --- a/src/gcore/types/cloud/inference/__init__.py +++ b/src/gcore/types/cloud/inference/__init__.py @@ -29,6 +29,3 @@ from .registry_credential_list_params import RegistryCredentialListParams as RegistryCredentialListParams from .registry_credential_create_params import RegistryCredentialCreateParams as RegistryCredentialCreateParams from .registry_credential_replace_params import RegistryCredentialReplaceParams as RegistryCredentialReplaceParams -from .inference_registry_credentials_create import ( - InferenceRegistryCredentialsCreate as InferenceRegistryCredentialsCreate, -) diff --git a/src/gcore/types/cloud/inference/inference_registry_credentials_create.py b/src/gcore/types/cloud/inference/inference_registry_credentials_create.py deleted file mode 100644 index ff24063f..00000000 --- a/src/gcore/types/cloud/inference/inference_registry_credentials_create.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ...._models import BaseModel - -__all__ = ["InferenceRegistryCredentialsCreate"] - - -class InferenceRegistryCredentialsCreate(BaseModel): - name: str - """Registry credential name.""" - - password: str - """Registry password.""" - - project_id: int - """Project ID to which the inference registry credentials belongs.""" - - registry_url: str - """Registry URL.""" - - username: str - """Registry username.""" diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index 3835a7f4..22a319d3 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -67,25 +67,25 @@ class TaskListParams(TypedDict, total=False): '`create_faas_function`', '`create_faas_namespace`', '`create_fip`', '`create_gpu_virtual_cluster`', '`create_image`', '`create_inference_application`', '`create_inference_instance`', - '`create_inference_instance_key`', '`create_k8s_cluster_pool_v2`', - '`create_k8s_cluster_v2`', '`create_l7policy`', '`create_l7rule`', - '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', - '`create_lbpool_health_monitor`', '`create_loadbalancer`', '`create_network`', - '`create_reserved_fixed_ip`', '`create_router`', '`create_secret`', - '`create_servergroup`', '`create_sfs`', '`create_snapshot`', '`create_subnet`', - '`create_vm`', '`create_volume`', '`deactivate_ddos_profile`', - '`delete_ai_cluster_gpu`', '`delete_caas_container`', - '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', - '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', - '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', '`delete_image`', - '`delete_inference_application`', '`delete_inference_instance`', - '`delete_k8s_cluster_pool_v2`', '`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`', + '`create_k8s_cluster_pool_v2`', '`create_k8s_cluster_v2`', '`create_l7policy`', + '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', + '`create_lbpool`', '`create_lbpool_health_monitor`', '`create_loadbalancer`', + '`create_network`', '`create_reserved_fixed_ip`', '`create_router`', + '`create_secret`', '`create_servergroup`', '`create_sfs`', '`create_snapshot`', + '`create_subnet`', '`create_vm`', '`create_volume`', + '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', + '`delete_caas_container`', '`delete_dbaas_postgres_cluster`', + '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', + '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', + '`delete_image`', '`delete_inference_application`', + '`delete_inference_instance`', '`delete_k8s_cluster_pool_v2`', + '`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`', '`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`', @@ -102,10 +102,10 @@ 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_inference_instance_key`', '`update_k8s_cluster_v2`', - '`update_lbmetadata`', '`update_port_allowed_address_pairs`', - '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', - '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] + '`update_k8s_cluster_v2`', '`update_lbmetadata`', + '`update_port_allowed_address_pairs`', '`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")] diff --git a/src/gcore/types/cloud/users/role_assignment.py b/src/gcore/types/cloud/users/role_assignment.py index 774c5ede..03497395 100644 --- a/src/gcore/types/cloud/users/role_assignment.py +++ b/src/gcore/types/cloud/users/role_assignment.py @@ -2,6 +2,7 @@ from typing import Optional from datetime import datetime +from typing_extensions import Literal from ...._models import BaseModel @@ -23,7 +24,7 @@ class RoleAssignment(BaseModel): project_id: Optional[int] = None """Project ID""" - role: str + role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"] """User role""" updated_at: Optional[datetime] = None diff --git a/src/gcore/types/cloud/users/role_assignment_create_params.py b/src/gcore/types/cloud/users/role_assignment_create_params.py index d5b33f73..3799fac3 100644 --- a/src/gcore/types/cloud/users/role_assignment_create_params.py +++ b/src/gcore/types/cloud/users/role_assignment_create_params.py @@ -3,13 +3,15 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["RoleAssignmentCreateParams"] class RoleAssignmentCreateParams(TypedDict, total=False): - role: Required[str] + role: Required[ + Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"] + ] """User role""" user_id: Required[int] diff --git a/src/gcore/types/cloud/users/role_assignment_update_params.py b/src/gcore/types/cloud/users/role_assignment_update_params.py index fb9051cf..10b6dc82 100644 --- a/src/gcore/types/cloud/users/role_assignment_update_params.py +++ b/src/gcore/types/cloud/users/role_assignment_update_params.py @@ -3,13 +3,15 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["RoleAssignmentUpdateParams"] class RoleAssignmentUpdateParams(TypedDict, total=False): - role: Required[str] + role: Required[ + Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"] + ] """User role""" user_id: Required[int] diff --git a/tests/api_resources/cloud/inference/test_registry_credentials.py b/tests/api_resources/cloud/inference/test_registry_credentials.py index 3ebaa989..2726feb8 100644 --- a/tests/api_resources/cloud/inference/test_registry_credentials.py +++ b/tests/api_resources/cloud/inference/test_registry_credentials.py @@ -12,7 +12,6 @@ from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud.inference import ( InferenceRegistryCredentials, - InferenceRegistryCredentialsCreate, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +29,7 @@ def test_method_create(self, client: Gcore) -> None: registry_url="registry.example.com", username="username", ) - assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -45,7 +44,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" registry_credential = response.parse() - assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -60,7 +59,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = response.parse() - assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) assert cast(Any, response.is_closed) is True @@ -197,7 +196,7 @@ def test_method_replace(self, client: Gcore) -> None: registry_url="registry.example.com", username="username", ) - assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) @parametrize def test_raw_response_replace(self, client: Gcore) -> None: @@ -212,7 +211,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = response.parse() - assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: @@ -227,7 +226,7 @@ def test_streaming_response_replace(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = response.parse() - assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) assert cast(Any, response.is_closed) is True @@ -257,7 +256,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: registry_url="registry.example.com", username="username", ) - assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -272,7 +271,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" registry_credential = await response.parse() - assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -287,7 +286,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = await response.parse() - assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) assert cast(Any, response.is_closed) is True @@ -424,7 +423,7 @@ async def test_method_replace(self, async_client: AsyncGcore) -> None: registry_url="registry.example.com", username="username", ) - assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @@ -439,7 +438,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = await response.parse() - assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: @@ -454,7 +453,7 @@ async def test_streaming_response_replace(self, async_client: AsyncGcore) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" registry_credential = await response.parse() - assert_matches_type(InferenceRegistryCredentialsCreate, registry_credential, path=["response"]) + assert_matches_type(InferenceRegistryCredentials, registry_credential, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_cost_reports.py b/tests/api_resources/cloud/test_cost_reports.py index b6df051a..1e3a60b8 100644 --- a/tests/api_resources/cloud/test_cost_reports.py +++ b/tests/api_resources/cloud/test_cost_reports.py @@ -92,17 +92,12 @@ def test_streaming_response_get_aggregated(self, client: Gcore) -> None: @parametrize def test_method_get_aggregated_monthly(self, client: Gcore) -> None: - cost_report = client.cloud.cost_reports.get_aggregated_monthly( - time_from=parse_datetime("2019-12-27T18:11:19.117Z"), - time_to=parse_datetime("2019-12-27T18:11:19.117Z"), - ) + cost_report = client.cloud.cost_reports.get_aggregated_monthly() assert_matches_type(CostReportAggregatedMonthly, cost_report, path=["response"]) @parametrize def test_method_get_aggregated_monthly_with_all_params(self, client: Gcore) -> None: cost_report = client.cloud.cost_reports.get_aggregated_monthly( - time_from=parse_datetime("2019-12-27T18:11:19.117Z"), - time_to=parse_datetime("2019-12-27T18:11:19.117Z"), regions=[1, 2, 3], response_format="csv_totals", rounding=True, @@ -126,16 +121,16 @@ def test_method_get_aggregated_monthly_with_all_params(self, client: Gcore) -> N ], "condition_type": "OR", }, + time_from=parse_datetime("2019-12-27T18:11:19.117Z"), + time_to=parse_datetime("2019-12-27T18:11:19.117Z"), types=["egress_traffic", "instance"], + year_month="2024-08", ) assert_matches_type(CostReportAggregatedMonthly, cost_report, path=["response"]) @parametrize def test_raw_response_get_aggregated_monthly(self, client: Gcore) -> None: - response = client.cloud.cost_reports.with_raw_response.get_aggregated_monthly( - time_from=parse_datetime("2019-12-27T18:11:19.117Z"), - time_to=parse_datetime("2019-12-27T18:11:19.117Z"), - ) + response = client.cloud.cost_reports.with_raw_response.get_aggregated_monthly() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -144,10 +139,7 @@ def test_raw_response_get_aggregated_monthly(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_aggregated_monthly(self, client: Gcore) -> None: - with client.cloud.cost_reports.with_streaming_response.get_aggregated_monthly( - time_from=parse_datetime("2019-12-27T18:11:19.117Z"), - time_to=parse_datetime("2019-12-27T18:11:19.117Z"), - ) as response: + with client.cloud.cost_reports.with_streaming_response.get_aggregated_monthly() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -313,17 +305,12 @@ async def test_streaming_response_get_aggregated(self, async_client: AsyncGcore) @parametrize async def test_method_get_aggregated_monthly(self, async_client: AsyncGcore) -> None: - cost_report = await async_client.cloud.cost_reports.get_aggregated_monthly( - time_from=parse_datetime("2019-12-27T18:11:19.117Z"), - time_to=parse_datetime("2019-12-27T18:11:19.117Z"), - ) + cost_report = await async_client.cloud.cost_reports.get_aggregated_monthly() assert_matches_type(CostReportAggregatedMonthly, cost_report, path=["response"]) @parametrize async def test_method_get_aggregated_monthly_with_all_params(self, async_client: AsyncGcore) -> None: cost_report = await async_client.cloud.cost_reports.get_aggregated_monthly( - time_from=parse_datetime("2019-12-27T18:11:19.117Z"), - time_to=parse_datetime("2019-12-27T18:11:19.117Z"), regions=[1, 2, 3], response_format="csv_totals", rounding=True, @@ -347,16 +334,16 @@ async def test_method_get_aggregated_monthly_with_all_params(self, async_client: ], "condition_type": "OR", }, + time_from=parse_datetime("2019-12-27T18:11:19.117Z"), + time_to=parse_datetime("2019-12-27T18:11:19.117Z"), types=["egress_traffic", "instance"], + year_month="2024-08", ) assert_matches_type(CostReportAggregatedMonthly, cost_report, path=["response"]) @parametrize async def test_raw_response_get_aggregated_monthly(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.cost_reports.with_raw_response.get_aggregated_monthly( - time_from=parse_datetime("2019-12-27T18:11:19.117Z"), - time_to=parse_datetime("2019-12-27T18:11:19.117Z"), - ) + response = await async_client.cloud.cost_reports.with_raw_response.get_aggregated_monthly() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -365,10 +352,7 @@ async def test_raw_response_get_aggregated_monthly(self, async_client: AsyncGcor @parametrize async def test_streaming_response_get_aggregated_monthly(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.cost_reports.with_streaming_response.get_aggregated_monthly( - time_from=parse_datetime("2019-12-27T18:11:19.117Z"), - time_to=parse_datetime("2019-12-27T18:11:19.117Z"), - ) as response: + async with async_client.cloud.cost_reports.with_streaming_response.get_aggregated_monthly() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index ea13776e..8e02d137 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -52,6 +52,7 @@ def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: } ], tags={"my-tag": "my-tag-value"}, + type_name="standard", volume_type="default_share_type", ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -98,7 +99,6 @@ def test_method_create_overload_2(self, client: Gcore) -> None: name="test-share-file-system", protocol="NFS", size=5, - volume_type="vast_share_type", ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -110,9 +110,10 @@ def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: name="test-share-file-system", protocol="NFS", size=5, - volume_type="vast_share_type", share_settings={"root_squash": True}, tags={"my-tag": "my-tag-value"}, + type_name="vast", + volume_type="vast_share_type", ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -124,7 +125,6 @@ def test_raw_response_create_overload_2(self, client: Gcore) -> None: name="test-share-file-system", protocol="NFS", size=5, - volume_type="vast_share_type", ) assert response.is_closed is True @@ -140,7 +140,6 @@ def test_streaming_response_create_overload_2(self, client: Gcore) -> None: name="test-share-file-system", protocol="NFS", size=5, - volume_type="vast_share_type", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -432,6 +431,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn } ], tags={"my-tag": "my-tag-value"}, + type_name="standard", volume_type="default_share_type", ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -478,7 +478,6 @@ async def test_method_create_overload_2(self, async_client: AsyncGcore) -> None: name="test-share-file-system", protocol="NFS", size=5, - volume_type="vast_share_type", ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -490,9 +489,10 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn name="test-share-file-system", protocol="NFS", size=5, - volume_type="vast_share_type", share_settings={"root_squash": True}, tags={"my-tag": "my-tag-value"}, + type_name="vast", + volume_type="vast_share_type", ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -504,7 +504,6 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncGcore) -> name="test-share-file-system", protocol="NFS", size=5, - volume_type="vast_share_type", ) assert response.is_closed is True @@ -520,7 +519,6 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncGco name="test-share-file-system", protocol="NFS", size=5, - volume_type="vast_share_type", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From d0797d56d0155d9c8224f61be11ccdd134ff5cb9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:11:59 +0000 Subject: [PATCH 245/592] codegen metadata --- .stats.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 787177c7..751321a0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 447 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8adebc369a231e1ce31d1d812970d147bc22fdbd5373aeea53722091e03cc889.yml -openapi_spec_hash: 08ee188ad64ee8fb77128276b5f81467 -config_hash: 0eef23ac91befdd529503f40af5ea9b1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7abc0646357543434a6421be732f519f1652f9aa91cfba61222db12d8b1a75ed.yml +openapi_spec_hash: 1681e0cb073ef1a1920f2a264d6cc9f9 +config_hash: eb094235667354755611c899f117c90b From 223c6a90d64cbcd9348c5de69911ed22e31f807d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 14:11:29 +0000 Subject: [PATCH 246/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 751321a0..cef90ff8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 447 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7abc0646357543434a6421be732f519f1652f9aa91cfba61222db12d8b1a75ed.yml -openapi_spec_hash: 1681e0cb073ef1a1920f2a264d6cc9f9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b3e59732e94d4b7ddc185b704f188588308082551d33be14fe81f1b462365219.yml +openapi_spec_hash: 66c8f39a31d94ae4b0cfa5702607985f config_hash: eb094235667354755611c899f117c90b From c63686d25b8cd6bfbc678a0211bff5539aac4898 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 09:17:10 +0000 Subject: [PATCH 247/592] feat(cloud)!: support inference applications --- .stats.yml | 4 +- api.md | 50 +- .../resources/cloud/inference/__init__.py | 28 +- .../cloud/inference/applications/__init__.py | 47 ++ .../inference/applications/applications.py | 134 ++++ .../inference/applications/deployments.py | 649 ++++++++++++++++++ .../cloud/inference/applications/templates.py | 238 +++++++ .../resources/cloud/inference/inference.py | 64 +- src/gcore/resources/cloud/inference/models.py | 290 -------- src/gcore/types/cloud/inference/__init__.py | 2 - .../cloud/inference/applications/__init__.py | 12 + .../applications/deployment_create_params.py | 66 ++ .../applications/deployment_patch_params.py | 60 ++ .../inference_application_deployment.py | 111 +++ .../inference_application_deployment_list.py | 16 + .../inference_application_template.py | 94 +++ .../inference_application_template_list.py | 16 + .../types/cloud/inference/inference_model.py | 65 -- .../cloud/inference/model_list_params.py | 21 - .../cloud/inference/applications/__init__.py | 1 + .../applications/test_deployments.py | 568 +++++++++++++++ .../inference/applications/test_templates.py | 150 ++++ .../cloud/inference/test_models.py | 169 ----- 23 files changed, 2247 insertions(+), 608 deletions(-) create mode 100644 src/gcore/resources/cloud/inference/applications/__init__.py create mode 100644 src/gcore/resources/cloud/inference/applications/applications.py create mode 100644 src/gcore/resources/cloud/inference/applications/deployments.py create mode 100644 src/gcore/resources/cloud/inference/applications/templates.py delete mode 100644 src/gcore/resources/cloud/inference/models.py create mode 100644 src/gcore/types/cloud/inference/applications/__init__.py create mode 100644 src/gcore/types/cloud/inference/applications/deployment_create_params.py create mode 100644 src/gcore/types/cloud/inference/applications/deployment_patch_params.py create mode 100644 src/gcore/types/cloud/inference/applications/inference_application_deployment.py create mode 100644 src/gcore/types/cloud/inference/applications/inference_application_deployment_list.py create mode 100644 src/gcore/types/cloud/inference/applications/inference_application_template.py create mode 100644 src/gcore/types/cloud/inference/applications/inference_application_template_list.py delete mode 100644 src/gcore/types/cloud/inference/inference_model.py delete mode 100644 src/gcore/types/cloud/inference/model_list_params.py create mode 100644 tests/api_resources/cloud/inference/applications/__init__.py create mode 100644 tests/api_resources/cloud/inference/applications/test_deployments.py create mode 100644 tests/api_resources/cloud/inference/applications/test_templates.py delete mode 100644 tests/api_resources/cloud/inference/test_models.py diff --git a/.stats.yml b/.stats.yml index cef90ff8..31dbe47a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 447 +configured_endpoints: 452 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b3e59732e94d4b7ddc185b704f188588308082551d33be14fe81f1b462365219.yml openapi_spec_hash: 66c8f39a31d94ae4b0cfa5702607985f -config_hash: eb094235667354755611c899f117c90b +config_hash: 53d4a93c7ccdf3ccc66101454420c415 diff --git a/api.md b/api.md index 80ad08e0..4c75ce29 100644 --- a/api.md +++ b/api.md @@ -471,19 +471,6 @@ Methods: - client.cloud.inference.flavors.list(\*\*params) -> SyncOffsetPage[InferenceFlavor] - client.cloud.inference.flavors.get(flavor_name) -> InferenceFlavor -### Models - -Types: - -```python -from gcore.types.cloud.inference import InferenceModel -``` - -Methods: - -- client.cloud.inference.models.list(\*\*params) -> SyncOffsetPage[InferenceModel] -- client.cloud.inference.models.get(model_id) -> InferenceModel - ### Deployments Types: @@ -571,6 +558,43 @@ Methods: - client.cloud.inference.api_keys.delete(api_key_name, \*, project_id) -> None - client.cloud.inference.api_keys.get(api_key_name, \*, project_id) -> InferenceAPIKey +### Applications + +#### Deployments + +Types: + +```python +from gcore.types.cloud.inference.applications import ( + InferenceApplicationDeployment, + InferenceApplicationDeploymentList, +) +``` + +Methods: + +- client.cloud.inference.applications.deployments.create(\*, project_id, \*\*params) -> TaskIDList +- client.cloud.inference.applications.deployments.list(\*, project_id) -> InferenceApplicationDeploymentList +- client.cloud.inference.applications.deployments.delete(deployment_name, \*, project_id) -> TaskIDList +- client.cloud.inference.applications.deployments.get(deployment_name, \*, project_id) -> InferenceApplicationDeployment +- client.cloud.inference.applications.deployments.patch(deployment_name, \*, project_id, \*\*params) -> TaskIDList + +#### Templates + +Types: + +```python +from gcore.types.cloud.inference.applications import ( + InferenceApplicationTemplate, + InferenceApplicationTemplateList, +) +``` + +Methods: + +- client.cloud.inference.applications.templates.list() -> InferenceApplicationTemplateList +- client.cloud.inference.applications.templates.get(application_name) -> InferenceApplicationTemplate + ## PlacementGroups Types: diff --git a/src/gcore/resources/cloud/inference/__init__.py b/src/gcore/resources/cloud/inference/__init__.py index d8b0c834..a3cd64c3 100644 --- a/src/gcore/resources/cloud/inference/__init__.py +++ b/src/gcore/resources/cloud/inference/__init__.py @@ -1,13 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .models import ( - ModelsResource, - AsyncModelsResource, - ModelsResourceWithRawResponse, - AsyncModelsResourceWithRawResponse, - ModelsResourceWithStreamingResponse, - AsyncModelsResourceWithStreamingResponse, -) from .flavors import ( FlavorsResource, AsyncFlavorsResource, @@ -48,6 +40,14 @@ DeploymentsResourceWithStreamingResponse, AsyncDeploymentsResourceWithStreamingResponse, ) +from .applications import ( + ApplicationsResource, + AsyncApplicationsResource, + ApplicationsResourceWithRawResponse, + AsyncApplicationsResourceWithRawResponse, + ApplicationsResourceWithStreamingResponse, + AsyncApplicationsResourceWithStreamingResponse, +) from .registry_credentials import ( RegistryCredentialsResource, AsyncRegistryCredentialsResource, @@ -64,12 +64,6 @@ "AsyncFlavorsResourceWithRawResponse", "FlavorsResourceWithStreamingResponse", "AsyncFlavorsResourceWithStreamingResponse", - "ModelsResource", - "AsyncModelsResource", - "ModelsResourceWithRawResponse", - "AsyncModelsResourceWithRawResponse", - "ModelsResourceWithStreamingResponse", - "AsyncModelsResourceWithStreamingResponse", "DeploymentsResource", "AsyncDeploymentsResource", "DeploymentsResourceWithRawResponse", @@ -94,6 +88,12 @@ "AsyncAPIKeysResourceWithRawResponse", "APIKeysResourceWithStreamingResponse", "AsyncAPIKeysResourceWithStreamingResponse", + "ApplicationsResource", + "AsyncApplicationsResource", + "ApplicationsResourceWithRawResponse", + "AsyncApplicationsResourceWithRawResponse", + "ApplicationsResourceWithStreamingResponse", + "AsyncApplicationsResourceWithStreamingResponse", "InferenceResource", "AsyncInferenceResource", "InferenceResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/inference/applications/__init__.py b/src/gcore/resources/cloud/inference/applications/__init__.py new file mode 100644 index 00000000..a84524c1 --- /dev/null +++ b/src/gcore/resources/cloud/inference/applications/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .templates import ( + TemplatesResource, + AsyncTemplatesResource, + TemplatesResourceWithRawResponse, + AsyncTemplatesResourceWithRawResponse, + TemplatesResourceWithStreamingResponse, + AsyncTemplatesResourceWithStreamingResponse, +) +from .deployments import ( + DeploymentsResource, + AsyncDeploymentsResource, + DeploymentsResourceWithRawResponse, + AsyncDeploymentsResourceWithRawResponse, + DeploymentsResourceWithStreamingResponse, + AsyncDeploymentsResourceWithStreamingResponse, +) +from .applications import ( + ApplicationsResource, + AsyncApplicationsResource, + ApplicationsResourceWithRawResponse, + AsyncApplicationsResourceWithRawResponse, + ApplicationsResourceWithStreamingResponse, + AsyncApplicationsResourceWithStreamingResponse, +) + +__all__ = [ + "DeploymentsResource", + "AsyncDeploymentsResource", + "DeploymentsResourceWithRawResponse", + "AsyncDeploymentsResourceWithRawResponse", + "DeploymentsResourceWithStreamingResponse", + "AsyncDeploymentsResourceWithStreamingResponse", + "TemplatesResource", + "AsyncTemplatesResource", + "TemplatesResourceWithRawResponse", + "AsyncTemplatesResourceWithRawResponse", + "TemplatesResourceWithStreamingResponse", + "AsyncTemplatesResourceWithStreamingResponse", + "ApplicationsResource", + "AsyncApplicationsResource", + "ApplicationsResourceWithRawResponse", + "AsyncApplicationsResourceWithRawResponse", + "ApplicationsResourceWithStreamingResponse", + "AsyncApplicationsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/inference/applications/applications.py b/src/gcore/resources/cloud/inference/applications/applications.py new file mode 100644 index 00000000..05a3a528 --- /dev/null +++ b/src/gcore/resources/cloud/inference/applications/applications.py @@ -0,0 +1,134 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .templates import ( + TemplatesResource, + AsyncTemplatesResource, + TemplatesResourceWithRawResponse, + AsyncTemplatesResourceWithRawResponse, + TemplatesResourceWithStreamingResponse, + AsyncTemplatesResourceWithStreamingResponse, +) +from ....._compat import cached_property +from .deployments import ( + DeploymentsResource, + AsyncDeploymentsResource, + DeploymentsResourceWithRawResponse, + AsyncDeploymentsResourceWithRawResponse, + DeploymentsResourceWithStreamingResponse, + AsyncDeploymentsResourceWithStreamingResponse, +) +from ....._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["ApplicationsResource", "AsyncApplicationsResource"] + + +class ApplicationsResource(SyncAPIResource): + @cached_property + def deployments(self) -> DeploymentsResource: + return DeploymentsResource(self._client) + + @cached_property + def templates(self) -> TemplatesResource: + return TemplatesResource(self._client) + + @cached_property + def with_raw_response(self) -> ApplicationsResourceWithRawResponse: + """ + 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 ApplicationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ApplicationsResourceWithStreamingResponse: + """ + 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 ApplicationsResourceWithStreamingResponse(self) + + +class AsyncApplicationsResource(AsyncAPIResource): + @cached_property + def deployments(self) -> AsyncDeploymentsResource: + return AsyncDeploymentsResource(self._client) + + @cached_property + def templates(self) -> AsyncTemplatesResource: + return AsyncTemplatesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncApplicationsResourceWithRawResponse: + """ + 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 AsyncApplicationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncApplicationsResourceWithStreamingResponse: + """ + 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 AsyncApplicationsResourceWithStreamingResponse(self) + + +class ApplicationsResourceWithRawResponse: + def __init__(self, applications: ApplicationsResource) -> None: + self._applications = applications + + @cached_property + def deployments(self) -> DeploymentsResourceWithRawResponse: + return DeploymentsResourceWithRawResponse(self._applications.deployments) + + @cached_property + def templates(self) -> TemplatesResourceWithRawResponse: + return TemplatesResourceWithRawResponse(self._applications.templates) + + +class AsyncApplicationsResourceWithRawResponse: + def __init__(self, applications: AsyncApplicationsResource) -> None: + self._applications = applications + + @cached_property + def deployments(self) -> AsyncDeploymentsResourceWithRawResponse: + return AsyncDeploymentsResourceWithRawResponse(self._applications.deployments) + + @cached_property + def templates(self) -> AsyncTemplatesResourceWithRawResponse: + return AsyncTemplatesResourceWithRawResponse(self._applications.templates) + + +class ApplicationsResourceWithStreamingResponse: + def __init__(self, applications: ApplicationsResource) -> None: + self._applications = applications + + @cached_property + def deployments(self) -> DeploymentsResourceWithStreamingResponse: + return DeploymentsResourceWithStreamingResponse(self._applications.deployments) + + @cached_property + def templates(self) -> TemplatesResourceWithStreamingResponse: + return TemplatesResourceWithStreamingResponse(self._applications.templates) + + +class AsyncApplicationsResourceWithStreamingResponse: + def __init__(self, applications: AsyncApplicationsResource) -> None: + self._applications = applications + + @cached_property + def deployments(self) -> AsyncDeploymentsResourceWithStreamingResponse: + return AsyncDeploymentsResourceWithStreamingResponse(self._applications.deployments) + + @cached_property + def templates(self) -> AsyncTemplatesResourceWithStreamingResponse: + return AsyncTemplatesResourceWithStreamingResponse(self._applications.templates) diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py new file mode 100644 index 00000000..c41e0b5e --- /dev/null +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -0,0 +1,649 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.inference.applications import deployment_patch_params, deployment_create_params +from .....types.cloud.inference.applications.inference_application_deployment import InferenceApplicationDeployment +from .....types.cloud.inference.applications.inference_application_deployment_list import ( + InferenceApplicationDeploymentList, +) + +__all__ = ["DeploymentsResource", "AsyncDeploymentsResource"] + + +class DeploymentsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> DeploymentsResourceWithRawResponse: + """ + 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 DeploymentsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DeploymentsResourceWithStreamingResponse: + """ + 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 DeploymentsResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + application_name: str, + components_configuration: Dict[str, deployment_create_params.ComponentsConfiguration], + name: str, + regions: Iterable[int], + api_keys: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Creates a new application deployment based on a selected catalog application. + Specify the desired deployment name, target regions, and configuration for each + component. The platform will provision the necessary resources and initialize + the application accordingly. + + Args: + project_id: Project ID + + application_name: Identifier of the application from the catalog + + components_configuration: Mapping of component names to their configuration (e.g., `"model": {...}`) + + name: Desired name for the new deployment + + regions: Geographical regions where the deployment should be created + + api_keys: List of API keys for the application + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._post( + f"/cloud/v3/inference/applications/{project_id}/deployments", + body=maybe_transform( + { + "application_name": application_name, + "components_configuration": components_configuration, + "name": name, + "regions": regions, + "api_keys": api_keys, + }, + deployment_create_params.DeploymentCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceApplicationDeploymentList: + """ + Returns a list of your application deployments, including deployment names, + associated catalog applications, regions, component configurations, and current + status. Useful for monitoring and managing all active AI application instances. + + Args: + project_id: Project ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._get( + f"/cloud/v3/inference/applications/{project_id}/deployments", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceApplicationDeploymentList, + ) + + def delete( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Deletes an existing application deployment along with all associated resources. + This action will permanently remove the deployment and **terminate all related + inference instances** that are part of the application. + + Args: + project_id: Project ID + + deployment_name: Name of deployment + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return self._delete( + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceApplicationDeployment: + """Retrieves detailed information about a specific application deployment. + + The + response includes the catalog application it was created from, deployment name, + active regions, configuration of each component, and the current status of the + deployment. + + Args: + project_id: Project ID + + deployment_name: Name of deployment + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return self._get( + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceApplicationDeployment, + ) + + def patch( + self, + deployment_name: str, + *, + project_id: int | None = None, + api_keys: List[str] | NotGiven = NOT_GIVEN, + components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] + | NotGiven = NOT_GIVEN, + regions: Iterable[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + 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 an existing application deployment. + + You can modify the target regions + and update configurations for individual components. To disable a component, set + its value to null. Only the provided fields will be updated; all others remain + unchanged. + + Args: + project_id: Project ID + + deployment_name: Name of deployment + + api_keys: List of API keys for the application + + components_configuration: Mapping of component names to their configuration (e.g., `"model": {...}`) + + regions: Geographical regions to be updated for the deployment + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return self._patch( + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + body=maybe_transform( + { + "api_keys": api_keys, + "components_configuration": components_configuration, + "regions": regions, + }, + deployment_patch_params.DeploymentPatchParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncDeploymentsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncDeploymentsResourceWithRawResponse: + """ + 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 AsyncDeploymentsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDeploymentsResourceWithStreamingResponse: + """ + 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 AsyncDeploymentsResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + application_name: str, + components_configuration: Dict[str, deployment_create_params.ComponentsConfiguration], + name: str, + regions: Iterable[int], + api_keys: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Creates a new application deployment based on a selected catalog application. + Specify the desired deployment name, target regions, and configuration for each + component. The platform will provision the necessary resources and initialize + the application accordingly. + + Args: + project_id: Project ID + + application_name: Identifier of the application from the catalog + + components_configuration: Mapping of component names to their configuration (e.g., `"model": {...}`) + + name: Desired name for the new deployment + + regions: Geographical regions where the deployment should be created + + api_keys: List of API keys for the application + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return await self._post( + f"/cloud/v3/inference/applications/{project_id}/deployments", + body=await async_maybe_transform( + { + "application_name": application_name, + "components_configuration": components_configuration, + "name": name, + "regions": regions, + "api_keys": api_keys, + }, + deployment_create_params.DeploymentCreateParams, + ), + 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, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceApplicationDeploymentList: + """ + Returns a list of your application deployments, including deployment names, + associated catalog applications, regions, component configurations, and current + status. Useful for monitoring and managing all active AI application instances. + + Args: + project_id: Project ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return await self._get( + f"/cloud/v3/inference/applications/{project_id}/deployments", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceApplicationDeploymentList, + ) + + async def delete( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Deletes an existing application deployment along with all associated resources. + This action will permanently remove the deployment and **terminate all related + inference instances** that are part of the application. + + Args: + project_id: Project ID + + deployment_name: Name of deployment + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return await self._delete( + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + deployment_name: str, + *, + project_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceApplicationDeployment: + """Retrieves detailed information about a specific application deployment. + + The + response includes the catalog application it was created from, deployment name, + active regions, configuration of each component, and the current status of the + deployment. + + Args: + project_id: Project ID + + deployment_name: Name of deployment + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return await self._get( + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceApplicationDeployment, + ) + + async def patch( + self, + deployment_name: str, + *, + project_id: int | None = None, + api_keys: List[str] | NotGiven = NOT_GIVEN, + components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] + | NotGiven = NOT_GIVEN, + regions: Iterable[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + 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 an existing application deployment. + + You can modify the target regions + and update configurations for individual components. To disable a component, set + its value to null. Only the provided fields will be updated; all others remain + unchanged. + + Args: + project_id: Project ID + + deployment_name: Name of deployment + + api_keys: List of API keys for the application + + components_configuration: Mapping of component names to their configuration (e.g., `"model": {...}`) + + regions: Geographical regions to be updated for the deployment + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return await self._patch( + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + body=await async_maybe_transform( + { + "api_keys": api_keys, + "components_configuration": components_configuration, + "regions": regions, + }, + deployment_patch_params.DeploymentPatchParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class DeploymentsResourceWithRawResponse: + def __init__(self, deployments: DeploymentsResource) -> None: + self._deployments = deployments + + self.create = to_raw_response_wrapper( + deployments.create, + ) + self.list = to_raw_response_wrapper( + deployments.list, + ) + self.delete = to_raw_response_wrapper( + deployments.delete, + ) + self.get = to_raw_response_wrapper( + deployments.get, + ) + self.patch = to_raw_response_wrapper( + deployments.patch, + ) + + +class AsyncDeploymentsResourceWithRawResponse: + def __init__(self, deployments: AsyncDeploymentsResource) -> None: + self._deployments = deployments + + self.create = async_to_raw_response_wrapper( + deployments.create, + ) + self.list = async_to_raw_response_wrapper( + deployments.list, + ) + self.delete = async_to_raw_response_wrapper( + deployments.delete, + ) + self.get = async_to_raw_response_wrapper( + deployments.get, + ) + self.patch = async_to_raw_response_wrapper( + deployments.patch, + ) + + +class DeploymentsResourceWithStreamingResponse: + def __init__(self, deployments: DeploymentsResource) -> None: + self._deployments = deployments + + self.create = to_streamed_response_wrapper( + deployments.create, + ) + self.list = to_streamed_response_wrapper( + deployments.list, + ) + self.delete = to_streamed_response_wrapper( + deployments.delete, + ) + self.get = to_streamed_response_wrapper( + deployments.get, + ) + self.patch = to_streamed_response_wrapper( + deployments.patch, + ) + + +class AsyncDeploymentsResourceWithStreamingResponse: + def __init__(self, deployments: AsyncDeploymentsResource) -> None: + self._deployments = deployments + + self.create = async_to_streamed_response_wrapper( + deployments.create, + ) + self.list = async_to_streamed_response_wrapper( + deployments.list, + ) + self.delete = async_to_streamed_response_wrapper( + deployments.delete, + ) + self.get = async_to_streamed_response_wrapper( + deployments.get, + ) + self.patch = async_to_streamed_response_wrapper( + deployments.patch, + ) diff --git a/src/gcore/resources/cloud/inference/applications/templates.py b/src/gcore/resources/cloud/inference/applications/templates.py new file mode 100644 index 00000000..1c475cb8 --- /dev/null +++ b/src/gcore/resources/cloud/inference/applications/templates.py @@ -0,0 +1,238 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.cloud.inference.applications.inference_application_template import InferenceApplicationTemplate +from .....types.cloud.inference.applications.inference_application_template_list import InferenceApplicationTemplateList + +__all__ = ["TemplatesResource", "AsyncTemplatesResource"] + + +class TemplatesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TemplatesResourceWithRawResponse: + """ + 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 TemplatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TemplatesResourceWithStreamingResponse: + """ + 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 TemplatesResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceApplicationTemplateList: + """ + Returns a list of available machine learning application templates from the + catalog. Each template includes metadata such as name, description, cover image, + documentation, tags, and a set of configurable components (e.g., `model`, `ui`). + Components define parameters, supported deployment flavors, and other attributes + required to create a fully functional application deployment. + """ + return self._get( + "/cloud/v3/inference/applications/catalog", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceApplicationTemplateList, + ) + + def get( + self, + application_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, + ) -> InferenceApplicationTemplate: + """ + Retrieves detailed information about a specific machine learning application + template from the catalog. The response includes the application’s metadata, + documentation, tags, and a complete set of components with configuration + options, compatible flavors, and deployment capabilities — all necessary for + building and customizing an AI application. + + Args: + application_name: Name of application in catalog + + 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 application_name: + raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") + return self._get( + f"/cloud/v3/inference/applications/catalog/{application_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceApplicationTemplate, + ) + + +class AsyncTemplatesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTemplatesResourceWithRawResponse: + """ + 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 AsyncTemplatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTemplatesResourceWithStreamingResponse: + """ + 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 AsyncTemplatesResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InferenceApplicationTemplateList: + """ + Returns a list of available machine learning application templates from the + catalog. Each template includes metadata such as name, description, cover image, + documentation, tags, and a set of configurable components (e.g., `model`, `ui`). + Components define parameters, supported deployment flavors, and other attributes + required to create a fully functional application deployment. + """ + return await self._get( + "/cloud/v3/inference/applications/catalog", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceApplicationTemplateList, + ) + + async def get( + self, + application_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, + ) -> InferenceApplicationTemplate: + """ + Retrieves detailed information about a specific machine learning application + template from the catalog. The response includes the application’s metadata, + documentation, tags, and a complete set of components with configuration + options, compatible flavors, and deployment capabilities — all necessary for + building and customizing an AI application. + + Args: + application_name: Name of application in catalog + + 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 application_name: + raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") + return await self._get( + f"/cloud/v3/inference/applications/catalog/{application_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InferenceApplicationTemplate, + ) + + +class TemplatesResourceWithRawResponse: + def __init__(self, templates: TemplatesResource) -> None: + self._templates = templates + + self.list = to_raw_response_wrapper( + templates.list, + ) + self.get = to_raw_response_wrapper( + templates.get, + ) + + +class AsyncTemplatesResourceWithRawResponse: + def __init__(self, templates: AsyncTemplatesResource) -> None: + self._templates = templates + + self.list = async_to_raw_response_wrapper( + templates.list, + ) + self.get = async_to_raw_response_wrapper( + templates.get, + ) + + +class TemplatesResourceWithStreamingResponse: + def __init__(self, templates: TemplatesResource) -> None: + self._templates = templates + + self.list = to_streamed_response_wrapper( + templates.list, + ) + self.get = to_streamed_response_wrapper( + templates.get, + ) + + +class AsyncTemplatesResourceWithStreamingResponse: + def __init__(self, templates: AsyncTemplatesResource) -> None: + self._templates = templates + + self.list = async_to_streamed_response_wrapper( + templates.list, + ) + self.get = async_to_streamed_response_wrapper( + templates.get, + ) diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index d9a20993..103c70f1 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -4,14 +4,6 @@ import httpx -from .models import ( - ModelsResource, - AsyncModelsResource, - ModelsResourceWithRawResponse, - AsyncModelsResourceWithRawResponse, - ModelsResourceWithStreamingResponse, - AsyncModelsResourceWithStreamingResponse, -) from .flavors import ( FlavorsResource, AsyncFlavorsResource, @@ -62,6 +54,14 @@ DeploymentsResourceWithStreamingResponse, AsyncDeploymentsResourceWithStreamingResponse, ) +from .applications.applications import ( + ApplicationsResource, + AsyncApplicationsResource, + ApplicationsResourceWithRawResponse, + AsyncApplicationsResourceWithRawResponse, + ApplicationsResourceWithStreamingResponse, + AsyncApplicationsResourceWithStreamingResponse, +) from ....types.cloud.inference_region_capacity_list import InferenceRegionCapacityList __all__ = ["InferenceResource", "AsyncInferenceResource"] @@ -72,10 +72,6 @@ class InferenceResource(SyncAPIResource): def flavors(self) -> FlavorsResource: return FlavorsResource(self._client) - @cached_property - def models(self) -> ModelsResource: - return ModelsResource(self._client) - @cached_property def deployments(self) -> DeploymentsResource: return DeploymentsResource(self._client) @@ -92,6 +88,10 @@ def secrets(self) -> SecretsResource: def api_keys(self) -> APIKeysResource: return APIKeysResource(self._client) + @cached_property + def applications(self) -> ApplicationsResource: + return ApplicationsResource(self._client) + @cached_property def with_raw_response(self) -> InferenceResourceWithRawResponse: """ @@ -136,10 +136,6 @@ class AsyncInferenceResource(AsyncAPIResource): def flavors(self) -> AsyncFlavorsResource: return AsyncFlavorsResource(self._client) - @cached_property - def models(self) -> AsyncModelsResource: - return AsyncModelsResource(self._client) - @cached_property def deployments(self) -> AsyncDeploymentsResource: return AsyncDeploymentsResource(self._client) @@ -156,6 +152,10 @@ def secrets(self) -> AsyncSecretsResource: def api_keys(self) -> AsyncAPIKeysResource: return AsyncAPIKeysResource(self._client) + @cached_property + def applications(self) -> AsyncApplicationsResource: + return AsyncApplicationsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncInferenceResourceWithRawResponse: """ @@ -207,10 +207,6 @@ def __init__(self, inference: InferenceResource) -> None: def flavors(self) -> FlavorsResourceWithRawResponse: return FlavorsResourceWithRawResponse(self._inference.flavors) - @cached_property - def models(self) -> ModelsResourceWithRawResponse: - return ModelsResourceWithRawResponse(self._inference.models) - @cached_property def deployments(self) -> DeploymentsResourceWithRawResponse: return DeploymentsResourceWithRawResponse(self._inference.deployments) @@ -227,6 +223,10 @@ def secrets(self) -> SecretsResourceWithRawResponse: def api_keys(self) -> APIKeysResourceWithRawResponse: return APIKeysResourceWithRawResponse(self._inference.api_keys) + @cached_property + def applications(self) -> ApplicationsResourceWithRawResponse: + return ApplicationsResourceWithRawResponse(self._inference.applications) + class AsyncInferenceResourceWithRawResponse: def __init__(self, inference: AsyncInferenceResource) -> None: @@ -240,10 +240,6 @@ def __init__(self, inference: AsyncInferenceResource) -> None: def flavors(self) -> AsyncFlavorsResourceWithRawResponse: return AsyncFlavorsResourceWithRawResponse(self._inference.flavors) - @cached_property - def models(self) -> AsyncModelsResourceWithRawResponse: - return AsyncModelsResourceWithRawResponse(self._inference.models) - @cached_property def deployments(self) -> AsyncDeploymentsResourceWithRawResponse: return AsyncDeploymentsResourceWithRawResponse(self._inference.deployments) @@ -260,6 +256,10 @@ def secrets(self) -> AsyncSecretsResourceWithRawResponse: def api_keys(self) -> AsyncAPIKeysResourceWithRawResponse: return AsyncAPIKeysResourceWithRawResponse(self._inference.api_keys) + @cached_property + def applications(self) -> AsyncApplicationsResourceWithRawResponse: + return AsyncApplicationsResourceWithRawResponse(self._inference.applications) + class InferenceResourceWithStreamingResponse: def __init__(self, inference: InferenceResource) -> None: @@ -273,10 +273,6 @@ def __init__(self, inference: InferenceResource) -> None: def flavors(self) -> FlavorsResourceWithStreamingResponse: return FlavorsResourceWithStreamingResponse(self._inference.flavors) - @cached_property - def models(self) -> ModelsResourceWithStreamingResponse: - return ModelsResourceWithStreamingResponse(self._inference.models) - @cached_property def deployments(self) -> DeploymentsResourceWithStreamingResponse: return DeploymentsResourceWithStreamingResponse(self._inference.deployments) @@ -293,6 +289,10 @@ def secrets(self) -> SecretsResourceWithStreamingResponse: def api_keys(self) -> APIKeysResourceWithStreamingResponse: return APIKeysResourceWithStreamingResponse(self._inference.api_keys) + @cached_property + def applications(self) -> ApplicationsResourceWithStreamingResponse: + return ApplicationsResourceWithStreamingResponse(self._inference.applications) + class AsyncInferenceResourceWithStreamingResponse: def __init__(self, inference: AsyncInferenceResource) -> None: @@ -306,10 +306,6 @@ def __init__(self, inference: AsyncInferenceResource) -> None: def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse: return AsyncFlavorsResourceWithStreamingResponse(self._inference.flavors) - @cached_property - def models(self) -> AsyncModelsResourceWithStreamingResponse: - return AsyncModelsResourceWithStreamingResponse(self._inference.models) - @cached_property def deployments(self) -> AsyncDeploymentsResourceWithStreamingResponse: return AsyncDeploymentsResourceWithStreamingResponse(self._inference.deployments) @@ -325,3 +321,7 @@ def secrets(self) -> AsyncSecretsResourceWithStreamingResponse: @cached_property def api_keys(self) -> AsyncAPIKeysResourceWithStreamingResponse: return AsyncAPIKeysResourceWithStreamingResponse(self._inference.api_keys) + + @cached_property + def applications(self) -> AsyncApplicationsResourceWithStreamingResponse: + return AsyncApplicationsResourceWithStreamingResponse(self._inference.applications) diff --git a/src/gcore/resources/cloud/inference/models.py b/src/gcore/resources/cloud/inference/models.py deleted file mode 100644 index b28decb5..00000000 --- a/src/gcore/resources/cloud/inference/models.py +++ /dev/null @@ -1,290 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ...._base_client import AsyncPaginator, make_request_options -from ....types.cloud.inference import model_list_params -from ....types.cloud.inference.inference_model import InferenceModel - -__all__ = ["ModelsResource", "AsyncModelsResource"] - - -class ModelsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ModelsResourceWithRawResponse: - """ - 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 ModelsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ModelsResourceWithStreamingResponse: - """ - 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 ModelsResourceWithStreamingResponse(self) - - def list( - self, - *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["name.asc", "name.desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[InferenceModel]: - """List models from catalog - - Args: - limit: Optional. - - Limit the number of returned items - - offset: Optional. Offset value is used to exclude the first set of records from the - result - - order_by: Order instances by transmitted fields and directions - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - "/cloud/v3/inference/models", - page=SyncOffsetPage[InferenceModel], - 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, - }, - model_list_params.ModelListParams, - ), - ), - model=InferenceModel, - ) - - def get( - self, - model_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InferenceModel: - """ - Get model from catalog - - Args: - model_id: Model ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not model_id: - raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}") - return self._get( - f"/cloud/v3/inference/models/{model_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=InferenceModel, - ) - - -class AsyncModelsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncModelsResourceWithRawResponse: - """ - 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 AsyncModelsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncModelsResourceWithStreamingResponse: - """ - 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 AsyncModelsResourceWithStreamingResponse(self) - - def list( - self, - *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["name.asc", "name.desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[InferenceModel, AsyncOffsetPage[InferenceModel]]: - """List models from catalog - - Args: - limit: Optional. - - Limit the number of returned items - - offset: Optional. Offset value is used to exclude the first set of records from the - result - - order_by: Order instances by transmitted fields and directions - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - "/cloud/v3/inference/models", - page=AsyncOffsetPage[InferenceModel], - 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, - }, - model_list_params.ModelListParams, - ), - ), - model=InferenceModel, - ) - - async def get( - self, - model_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InferenceModel: - """ - Get model from catalog - - Args: - model_id: Model ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not model_id: - raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}") - return await self._get( - f"/cloud/v3/inference/models/{model_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=InferenceModel, - ) - - -class ModelsResourceWithRawResponse: - def __init__(self, models: ModelsResource) -> None: - self._models = models - - self.list = to_raw_response_wrapper( - models.list, - ) - self.get = to_raw_response_wrapper( - models.get, - ) - - -class AsyncModelsResourceWithRawResponse: - def __init__(self, models: AsyncModelsResource) -> None: - self._models = models - - self.list = async_to_raw_response_wrapper( - models.list, - ) - self.get = async_to_raw_response_wrapper( - models.get, - ) - - -class ModelsResourceWithStreamingResponse: - def __init__(self, models: ModelsResource) -> None: - self._models = models - - self.list = to_streamed_response_wrapper( - models.list, - ) - self.get = to_streamed_response_wrapper( - models.get, - ) - - -class AsyncModelsResourceWithStreamingResponse: - def __init__(self, models: AsyncModelsResource) -> None: - self._models = models - - self.list = async_to_streamed_response_wrapper( - models.list, - ) - self.get = async_to_streamed_response_wrapper( - models.get, - ) diff --git a/src/gcore/types/cloud/inference/__init__.py b/src/gcore/types/cloud/inference/__init__.py index 19ceb1f7..95023b65 100644 --- a/src/gcore/types/cloud/inference/__init__.py +++ b/src/gcore/types/cloud/inference/__init__.py @@ -6,12 +6,10 @@ from .probe_exec import ProbeExec as ProbeExec from .probe_config import ProbeConfig as ProbeConfig from .probe_http_get import ProbeHTTPGet as ProbeHTTPGet -from .inference_model import InferenceModel as InferenceModel from .inference_flavor import InferenceFlavor as InferenceFlavor from .inference_secret import InferenceSecret as InferenceSecret from .probe_tcp_socket import ProbeTcpSocket as ProbeTcpSocket from .inference_api_key import InferenceAPIKey as InferenceAPIKey -from .model_list_params import ModelListParams as ModelListParams from .flavor_list_params import FlavorListParams as FlavorListParams from .secret_list_params import SecretListParams as SecretListParams from .api_key_list_params import APIKeyListParams as APIKeyListParams diff --git a/src/gcore/types/cloud/inference/applications/__init__.py b/src/gcore/types/cloud/inference/applications/__init__.py new file mode 100644 index 00000000..1671486c --- /dev/null +++ b/src/gcore/types/cloud/inference/applications/__init__.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .deployment_patch_params import DeploymentPatchParams as DeploymentPatchParams +from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams +from .inference_application_template import InferenceApplicationTemplate as InferenceApplicationTemplate +from .inference_application_deployment import InferenceApplicationDeployment as InferenceApplicationDeployment +from .inference_application_template_list import InferenceApplicationTemplateList as InferenceApplicationTemplateList +from .inference_application_deployment_list import ( + InferenceApplicationDeploymentList as InferenceApplicationDeploymentList, +) diff --git a/src/gcore/types/cloud/inference/applications/deployment_create_params.py b/src/gcore/types/cloud/inference/applications/deployment_create_params.py new file mode 100644 index 00000000..a66d843f --- /dev/null +++ b/src/gcore/types/cloud/inference/applications/deployment_create_params.py @@ -0,0 +1,66 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable +from typing_extensions import Required, TypedDict + +__all__ = [ + "DeploymentCreateParams", + "ComponentsConfiguration", + "ComponentsConfigurationScale", + "ComponentsConfigurationParameterOverrides", +] + + +class DeploymentCreateParams(TypedDict, total=False): + project_id: int + """Project ID""" + + application_name: Required[str] + """Identifier of the application from the catalog""" + + components_configuration: Required[Dict[str, ComponentsConfiguration]] + """Mapping of component names to their configuration (e.g., `"model": {...}`)""" + + name: Required[str] + """Desired name for the new deployment""" + + regions: Required[Iterable[int]] + """Geographical regions where the deployment should be created""" + + api_keys: List[str] + """List of API keys for the application""" + + +class ComponentsConfigurationScale(TypedDict, total=False): + max: Required[int] + """Maximum number of replicas the container can be scaled up to""" + + min: Required[int] + """Minimum number of replicas the component can be scaled down to""" + + +class ComponentsConfigurationParameterOverrides(TypedDict, total=False): + value: Required[str] + """New value assigned to the overridden parameter""" + + +class ComponentsConfiguration(TypedDict, total=False): + exposed: Required[bool] + """ + Whether the component should be exposed via a public endpoint (e.g., for + external inference/API access). + """ + + flavor: Required[str] + """ + Specifies the compute configuration (e.g., CPU/GPU size) to be used for the + component. + """ + + scale: Required[ComponentsConfigurationScale] + """Scaling parameters of the component""" + + parameter_overrides: Dict[str, ComponentsConfigurationParameterOverrides] + """Map of parameter overrides for customization""" diff --git a/src/gcore/types/cloud/inference/applications/deployment_patch_params.py b/src/gcore/types/cloud/inference/applications/deployment_patch_params.py new file mode 100644 index 00000000..1283ee91 --- /dev/null +++ b/src/gcore/types/cloud/inference/applications/deployment_patch_params.py @@ -0,0 +1,60 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = [ + "DeploymentPatchParams", + "ComponentsConfiguration", + "ComponentsConfigurationParameterOverrides", + "ComponentsConfigurationScale", +] + + +class DeploymentPatchParams(TypedDict, total=False): + project_id: int + """Project ID""" + + api_keys: List[str] + """List of API keys for the application""" + + components_configuration: Dict[str, Optional[ComponentsConfiguration]] + """Mapping of component names to their configuration (e.g., `"model": {...}`)""" + + regions: Iterable[int] + """Geographical regions to be updated for the deployment""" + + +class ComponentsConfigurationParameterOverrides(TypedDict, total=False): + value: Required[str] + """New value assigned to the overridden parameter""" + + +class ComponentsConfigurationScale(TypedDict, total=False): + max: int + """Maximum number of replicas the container can be scaled up to""" + + min: int + """Minimum number of replicas the component can be scaled down to""" + + +class ComponentsConfiguration(TypedDict, total=False): + exposed: bool + """ + Whether the component should be exposed via a public endpoint (e.g., for + external inference/API access). + """ + + flavor: str + """ + Specifies the compute configuration (e.g., CPU/GPU size) to be used for the + component. + """ + + parameter_overrides: Dict[str, Optional[ComponentsConfigurationParameterOverrides]] + """Map of parameter overrides for customization""" + + scale: ComponentsConfigurationScale + """Scaling parameters of the component""" diff --git a/src/gcore/types/cloud/inference/applications/inference_application_deployment.py b/src/gcore/types/cloud/inference/applications/inference_application_deployment.py new file mode 100644 index 00000000..b6333e6b --- /dev/null +++ b/src/gcore/types/cloud/inference/applications/inference_application_deployment.py @@ -0,0 +1,111 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = [ + "InferenceApplicationDeployment", + "ComponentsConfiguration", + "ComponentsConfigurationParameterOverrides", + "ComponentsConfigurationScale", + "Status", + "StatusComponentInferences", + "StatusExposeAddresses", + "StatusRegion", + "StatusRegionComponents", +] + + +class ComponentsConfigurationParameterOverrides(BaseModel): + value: str + """New value assigned to the overridden parameter""" + + +class ComponentsConfigurationScale(BaseModel): + max: int + """Maximum number of replicas the container can be scaled up to""" + + min: int + """Minimum number of replicas the component can be scaled down to""" + + +class ComponentsConfiguration(BaseModel): + exposed: bool + """Indicates if the component will obtain a public address""" + + flavor: str + """Chosen flavor or variant of the component""" + + parameter_overrides: Dict[str, ComponentsConfigurationParameterOverrides] + """Map of parameter overrides for customization""" + + scale: ComponentsConfigurationScale + """Scaling parameters of the component""" + + +class StatusComponentInferences(BaseModel): + flavor: str + """Flavor of the inference""" + + name: str + """Name of the inference""" + + +class StatusExposeAddresses(BaseModel): + address: str + """Global access endpoint for the component""" + + +class StatusRegionComponents(BaseModel): + error: str + """Error message if the component is in an error state""" + + status: str + """Current state of the component in a specific region""" + + +class StatusRegion(BaseModel): + components: Dict[str, StatusRegionComponents] + """Mapping of component names to their status in the region""" + + region_id: int + """Region ID""" + + status: str + """Current state of the deployment in a specific region""" + + +class Status(BaseModel): + component_inferences: Dict[str, StatusComponentInferences] + """Map of components and their inferences""" + + consolidated_status: Literal["Active", "Failed", "PartiallyDeployed", "Unknown"] + """High-level summary of the deployment status across all regions""" + + expose_addresses: Dict[str, StatusExposeAddresses] + """Map of component keys to their global access endpoints""" + + regions: List[StatusRegion] + """Status details for each deployment region""" + + +class InferenceApplicationDeployment(BaseModel): + api_keys: List[str] + """List of API keys for the application""" + + application_name: str + """Identifier of the application template from the catalog""" + + components_configuration: Dict[str, ComponentsConfiguration] + """Mapping of component names to their configuration (e.g., `"model": {...}`)""" + + name: str + """Unique identifier of the deployment""" + + regions: List[int] + """Geographical regions where the deployment is active""" + + status: Status + """Current state of the deployment across regions""" diff --git a/src/gcore/types/cloud/inference/applications/inference_application_deployment_list.py b/src/gcore/types/cloud/inference/applications/inference_application_deployment_list.py new file mode 100644 index 00000000..dd9a5c74 --- /dev/null +++ b/src/gcore/types/cloud/inference/applications/inference_application_deployment_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ....._models import BaseModel +from .inference_application_deployment import InferenceApplicationDeployment + +__all__ = ["InferenceApplicationDeploymentList"] + + +class InferenceApplicationDeploymentList(BaseModel): + count: int + """Number of objects""" + + results: List[InferenceApplicationDeployment] + """Objects""" diff --git a/src/gcore/types/cloud/inference/applications/inference_application_template.py b/src/gcore/types/cloud/inference/applications/inference_application_template.py new file mode 100644 index 00000000..c69602e2 --- /dev/null +++ b/src/gcore/types/cloud/inference/applications/inference_application_template.py @@ -0,0 +1,94 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["InferenceApplicationTemplate", "Components", "ComponentsParameters", "ComponentsSuitableFlavor"] + + +class ComponentsParameters(BaseModel): + default_value: str + """Default value assigned if not provided""" + + description: str + """Description of the parameter's purpose""" + + display_name: str + """User-friendly name of the parameter""" + + enum_values: Optional[List[str]] = None + """Allowed values when type is "enum" """ + + max_value: Optional[str] = None + """Maximum value (applies to integer and float types)""" + + min_value: Optional[str] = None + """Minimum value (applies to integer and float types)""" + + pattern: Optional[str] = None + """Regexp pattern when type is "string" """ + + required: bool + """Indicates is parameter mandatory""" + + type: Literal["enum", "float", "integer", "string"] + """Determines the type of the parameter""" + + +class ComponentsSuitableFlavor(BaseModel): + name: str + """Name of the flavor""" + + +class Components(BaseModel): + description: str + """Summary of the component's functionality""" + + display_name: str + """Human-readable name of the component""" + + exposable: bool + """ + Indicates whether this component can expose a public-facing endpoint (e.g., for + inference or API access). + """ + + license_url: str + """URL to the component's license information""" + + parameters: Dict[str, ComponentsParameters] + """Configurable parameters for the component""" + + readme: str + """Detailed documentation or usage instructions""" + + required: bool + """Specifies if the component is required for the application""" + + suitable_flavors: List[ComponentsSuitableFlavor] + """List of compatible flavors or configurations""" + + +class InferenceApplicationTemplate(BaseModel): + components: Dict[str, Components] + """Configurable components of the application""" + + cover_url: str + """URL to the application's cover image""" + + description: str + """Brief overview of the application""" + + display_name: str + """Human-readable name of the application""" + + name: str + """Unique application identifier in the catalog""" + + readme: str + """Detailed documentation or instructions""" + + tags: Dict[str, str] + """Categorization key-value pairs""" diff --git a/src/gcore/types/cloud/inference/applications/inference_application_template_list.py b/src/gcore/types/cloud/inference/applications/inference_application_template_list.py new file mode 100644 index 00000000..582dd0ed --- /dev/null +++ b/src/gcore/types/cloud/inference/applications/inference_application_template_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ....._models import BaseModel +from .inference_application_template import InferenceApplicationTemplate + +__all__ = ["InferenceApplicationTemplateList"] + + +class InferenceApplicationTemplateList(BaseModel): + count: int + """Number of objects""" + + results: List[InferenceApplicationTemplate] + """Objects""" diff --git a/src/gcore/types/cloud/inference/inference_model.py b/src/gcore/types/cloud/inference/inference_model.py deleted file mode 100644 index 9de2dbe3..00000000 --- a/src/gcore/types/cloud/inference/inference_model.py +++ /dev/null @@ -1,65 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel - -__all__ = ["InferenceModel"] - - -class InferenceModel(BaseModel): - id: str - """Model ID.""" - - category: Optional[str] = None - """Category of the model.""" - - default_flavor_name: Optional[str] = None - """Default flavor for the model.""" - - description: str - """Description of the model.""" - - developer: Optional[str] = None - """Developer of the model.""" - - documentation_page: Optional[str] = None - """Path to the documentation page.""" - - eula_url: Optional[str] = None - """URL to the EULA text.""" - - example_curl_request: Optional[str] = None - """Example curl request to the model.""" - - has_eula: bool - """Whether the model has an EULA.""" - - image_registry_id: Optional[str] = None - """Image registry of the model.""" - - image_url: str - """Image URL of the model.""" - - inference_backend: Optional[str] = None - """Describing underlying inference engine.""" - - inference_frontend: Optional[str] = None - """Describing model frontend type.""" - - api_model_id: Optional[str] = FieldInfo(alias="model_id", default=None) - """Model name to perform inference call.""" - - name: str - """Name of the model.""" - - openai_compatibility: Optional[str] = None - """OpenAI compatibility level.""" - - port: int - """Port on which the model runs.""" - - version: Optional[str] = None - """Version of the model.""" diff --git a/src/gcore/types/cloud/inference/model_list_params.py b/src/gcore/types/cloud/inference/model_list_params.py deleted file mode 100644 index 8bfaf71d..00000000 --- a/src/gcore/types/cloud/inference/model_list_params.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["ModelListParams"] - - -class ModelListParams(TypedDict, total=False): - limit: int - """Optional. Limit the number of returned items""" - - offset: int - """Optional. - - Offset value is used to exclude the first set of records from the result - """ - - order_by: Literal["name.asc", "name.desc"] - """Order instances by transmitted fields and directions""" diff --git a/tests/api_resources/cloud/inference/applications/__init__.py b/tests/api_resources/cloud/inference/applications/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/inference/applications/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/inference/applications/test_deployments.py b/tests/api_resources/cloud/inference/applications/test_deployments.py new file mode 100644 index 00000000..850cc9e8 --- /dev/null +++ b/tests/api_resources/cloud/inference/applications/test_deployments.py @@ -0,0 +1,568 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.inference.applications import ( + InferenceApplicationDeployment, + InferenceApplicationDeploymentList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDeployments: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + deployment = client.cloud.inference.applications.deployments.create( + project_id=1, + application_name="demo-app", + components_configuration={ + "model": { + "exposed": True, + "flavor": "inference-16vcpu-232gib-1xh100-80gb", + "scale": { + "max": 1, + "min": 1, + }, + } + }, + name="name", + regions=[1, 2], + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + deployment = client.cloud.inference.applications.deployments.create( + project_id=1, + application_name="demo-app", + components_configuration={ + "model": { + "exposed": True, + "flavor": "inference-16vcpu-232gib-1xh100-80gb", + "scale": { + "max": 1, + "min": 1, + }, + "parameter_overrides": {"foo": {"value": "value"}}, + } + }, + name="name", + regions=[1, 2], + api_keys=["key1", "key2"], + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.inference.applications.deployments.with_raw_response.create( + project_id=1, + application_name="demo-app", + components_configuration={ + "model": { + "exposed": True, + "flavor": "inference-16vcpu-232gib-1xh100-80gb", + "scale": { + "max": 1, + "min": 1, + }, + } + }, + name="name", + regions=[1, 2], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.inference.applications.deployments.with_streaming_response.create( + project_id=1, + application_name="demo-app", + components_configuration={ + "model": { + "exposed": True, + "flavor": "inference-16vcpu-232gib-1xh100-80gb", + "scale": { + "max": 1, + "min": 1, + }, + } + }, + name="name", + regions=[1, 2], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + deployment = client.cloud.inference.applications.deployments.list( + project_id=1, + ) + assert_matches_type(InferenceApplicationDeploymentList, deployment, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.inference.applications.deployments.with_raw_response.list( + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(InferenceApplicationDeploymentList, deployment, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.inference.applications.deployments.with_streaming_response.list( + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert_matches_type(InferenceApplicationDeploymentList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + deployment = client.cloud.inference.applications.deployments.delete( + deployment_name="deployment_name", + project_id=1, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.inference.applications.deployments.with_raw_response.delete( + deployment_name="deployment_name", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.inference.applications.deployments.with_streaming_response.delete( + deployment_name="deployment_name", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + client.cloud.inference.applications.deployments.with_raw_response.delete( + deployment_name="", + project_id=1, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + deployment = client.cloud.inference.applications.deployments.get( + deployment_name="deployment_name", + project_id=1, + ) + assert_matches_type(InferenceApplicationDeployment, deployment, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.inference.applications.deployments.with_raw_response.get( + deployment_name="deployment_name", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(InferenceApplicationDeployment, deployment, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.inference.applications.deployments.with_streaming_response.get( + deployment_name="deployment_name", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert_matches_type(InferenceApplicationDeployment, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + client.cloud.inference.applications.deployments.with_raw_response.get( + deployment_name="", + project_id=1, + ) + + @parametrize + def test_method_patch(self, client: Gcore) -> None: + deployment = client.cloud.inference.applications.deployments.patch( + deployment_name="deployment_name", + project_id=1, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_method_patch_with_all_params(self, client: Gcore) -> None: + deployment = client.cloud.inference.applications.deployments.patch( + deployment_name="deployment_name", + project_id=1, + api_keys=["key1", "key2"], + components_configuration={ + "model": { + "exposed": True, + "flavor": "flavor", + "parameter_overrides": {"foo": {"value": "value"}}, + "scale": { + "max": 2, + "min": 0, + }, + } + }, + regions=[1, 2], + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_raw_response_patch(self, client: Gcore) -> None: + response = client.cloud.inference.applications.deployments.with_raw_response.patch( + deployment_name="deployment_name", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_streaming_response_patch(self, client: Gcore) -> None: + with client.cloud.inference.applications.deployments.with_streaming_response.patch( + deployment_name="deployment_name", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_patch(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + client.cloud.inference.applications.deployments.with_raw_response.patch( + deployment_name="", + project_id=1, + ) + + +class TestAsyncDeployments: + 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: + deployment = await async_client.cloud.inference.applications.deployments.create( + project_id=1, + application_name="demo-app", + components_configuration={ + "model": { + "exposed": True, + "flavor": "inference-16vcpu-232gib-1xh100-80gb", + "scale": { + "max": 1, + "min": 1, + }, + } + }, + name="name", + regions=[1, 2], + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.applications.deployments.create( + project_id=1, + application_name="demo-app", + components_configuration={ + "model": { + "exposed": True, + "flavor": "inference-16vcpu-232gib-1xh100-80gb", + "scale": { + "max": 1, + "min": 1, + }, + "parameter_overrides": {"foo": {"value": "value"}}, + } + }, + name="name", + regions=[1, 2], + api_keys=["key1", "key2"], + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.applications.deployments.with_raw_response.create( + project_id=1, + application_name="demo-app", + components_configuration={ + "model": { + "exposed": True, + "flavor": "inference-16vcpu-232gib-1xh100-80gb", + "scale": { + "max": 1, + "min": 1, + }, + } + }, + name="name", + regions=[1, 2], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.applications.deployments.with_streaming_response.create( + project_id=1, + application_name="demo-app", + components_configuration={ + "model": { + "exposed": True, + "flavor": "inference-16vcpu-232gib-1xh100-80gb", + "scale": { + "max": 1, + "min": 1, + }, + } + }, + name="name", + regions=[1, 2], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.applications.deployments.list( + project_id=1, + ) + assert_matches_type(InferenceApplicationDeploymentList, deployment, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.applications.deployments.with_raw_response.list( + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(InferenceApplicationDeploymentList, deployment, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.applications.deployments.with_streaming_response.list( + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert_matches_type(InferenceApplicationDeploymentList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.applications.deployments.delete( + deployment_name="deployment_name", + project_id=1, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.applications.deployments.with_raw_response.delete( + deployment_name="deployment_name", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.applications.deployments.with_streaming_response.delete( + deployment_name="deployment_name", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + await async_client.cloud.inference.applications.deployments.with_raw_response.delete( + deployment_name="", + project_id=1, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.applications.deployments.get( + deployment_name="deployment_name", + project_id=1, + ) + assert_matches_type(InferenceApplicationDeployment, deployment, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.applications.deployments.with_raw_response.get( + deployment_name="deployment_name", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(InferenceApplicationDeployment, deployment, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.applications.deployments.with_streaming_response.get( + deployment_name="deployment_name", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert_matches_type(InferenceApplicationDeployment, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + await async_client.cloud.inference.applications.deployments.with_raw_response.get( + deployment_name="", + project_id=1, + ) + + @parametrize + async def test_method_patch(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.applications.deployments.patch( + deployment_name="deployment_name", + project_id=1, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_method_patch_with_all_params(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.applications.deployments.patch( + deployment_name="deployment_name", + project_id=1, + api_keys=["key1", "key2"], + components_configuration={ + "model": { + "exposed": True, + "flavor": "flavor", + "parameter_overrides": {"foo": {"value": "value"}}, + "scale": { + "max": 2, + "min": 0, + }, + } + }, + regions=[1, 2], + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_raw_response_patch(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.applications.deployments.with_raw_response.patch( + deployment_name="deployment_name", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_streaming_response_patch(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.applications.deployments.with_streaming_response.patch( + deployment_name="deployment_name", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_patch(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + await async_client.cloud.inference.applications.deployments.with_raw_response.patch( + deployment_name="", + project_id=1, + ) diff --git a/tests/api_resources/cloud/inference/applications/test_templates.py b/tests/api_resources/cloud/inference/applications/test_templates.py new file mode 100644 index 00000000..aa0bfed8 --- /dev/null +++ b/tests/api_resources/cloud/inference/applications/test_templates.py @@ -0,0 +1,150 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.inference.applications import InferenceApplicationTemplate, InferenceApplicationTemplateList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTemplates: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + template = client.cloud.inference.applications.templates.list() + assert_matches_type(InferenceApplicationTemplateList, template, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.inference.applications.templates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = response.parse() + assert_matches_type(InferenceApplicationTemplateList, template, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.inference.applications.templates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = response.parse() + assert_matches_type(InferenceApplicationTemplateList, template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + template = client.cloud.inference.applications.templates.get( + "26f1kl-.n.71", + ) + assert_matches_type(InferenceApplicationTemplate, template, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.inference.applications.templates.with_raw_response.get( + "26f1kl-.n.71", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = response.parse() + assert_matches_type(InferenceApplicationTemplate, template, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.inference.applications.templates.with_streaming_response.get( + "26f1kl-.n.71", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = response.parse() + assert_matches_type(InferenceApplicationTemplate, template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `application_name` but received ''"): + client.cloud.inference.applications.templates.with_raw_response.get( + "", + ) + + +class TestAsyncTemplates: + 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: + template = await async_client.cloud.inference.applications.templates.list() + assert_matches_type(InferenceApplicationTemplateList, template, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.applications.templates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = await response.parse() + assert_matches_type(InferenceApplicationTemplateList, template, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.applications.templates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = await response.parse() + assert_matches_type(InferenceApplicationTemplateList, template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + template = await async_client.cloud.inference.applications.templates.get( + "26f1kl-.n.71", + ) + assert_matches_type(InferenceApplicationTemplate, template, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.applications.templates.with_raw_response.get( + "26f1kl-.n.71", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + template = await response.parse() + assert_matches_type(InferenceApplicationTemplate, template, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.applications.templates.with_streaming_response.get( + "26f1kl-.n.71", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + template = await response.parse() + assert_matches_type(InferenceApplicationTemplate, template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `application_name` but received ''"): + await async_client.cloud.inference.applications.templates.with_raw_response.get( + "", + ) diff --git a/tests/api_resources/cloud/inference/test_models.py b/tests/api_resources/cloud/inference/test_models.py deleted file mode 100644 index cde90416..00000000 --- a/tests/api_resources/cloud/inference/test_models.py +++ /dev/null @@ -1,169 +0,0 @@ -# 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.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.cloud.inference import InferenceModel - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestModels: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Gcore) -> None: - model = client.cloud.inference.models.list() - assert_matches_type(SyncOffsetPage[InferenceModel], model, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Gcore) -> None: - model = client.cloud.inference.models.list( - limit=1000, - offset=0, - order_by="name.desc", - ) - assert_matches_type(SyncOffsetPage[InferenceModel], model, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.inference.models.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - model = response.parse() - assert_matches_type(SyncOffsetPage[InferenceModel], model, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.inference.models.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - model = response.parse() - assert_matches_type(SyncOffsetPage[InferenceModel], model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_get(self, client: Gcore) -> None: - model = client.cloud.inference.models.get( - "model_id", - ) - assert_matches_type(InferenceModel, model, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.inference.models.with_raw_response.get( - "model_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - model = response.parse() - assert_matches_type(InferenceModel, model, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.inference.models.with_streaming_response.get( - "model_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - model = response.parse() - assert_matches_type(InferenceModel, model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_id` but received ''"): - client.cloud.inference.models.with_raw_response.get( - "", - ) - - -class TestAsyncModels: - 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: - model = await async_client.cloud.inference.models.list() - assert_matches_type(AsyncOffsetPage[InferenceModel], model, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - model = await async_client.cloud.inference.models.list( - limit=1000, - offset=0, - order_by="name.desc", - ) - assert_matches_type(AsyncOffsetPage[InferenceModel], model, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.inference.models.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - model = await response.parse() - assert_matches_type(AsyncOffsetPage[InferenceModel], model, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.inference.models.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - model = await response.parse() - assert_matches_type(AsyncOffsetPage[InferenceModel], model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_get(self, async_client: AsyncGcore) -> None: - model = await async_client.cloud.inference.models.get( - "model_id", - ) - assert_matches_type(InferenceModel, model, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.inference.models.with_raw_response.get( - "model_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - model = await response.parse() - assert_matches_type(InferenceModel, model, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.inference.models.with_streaming_response.get( - "model_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - model = await response.parse() - assert_matches_type(InferenceModel, model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_id` but received ''"): - await async_client.cloud.inference.models.with_raw_response.get( - "", - ) From 1a2e2690473c4049a9e0a39268b35c1da73190f9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 10:11:20 +0000 Subject: [PATCH 248/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../inference/deployments/deployments.py | 27 ++++-- .../cloud/inference/test_deployments.py | 96 +++++++++++-------- 3 files changed, 75 insertions(+), 52 deletions(-) diff --git a/.stats.yml b/.stats.yml index 31dbe47a..52c3fb91 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 452 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b3e59732e94d4b7ddc185b704f188588308082551d33be14fe81f1b462365219.yml -openapi_spec_hash: 66c8f39a31d94ae4b0cfa5702607985f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-969139542b16b893e81be1cca6eb7e0f9e00580a967619d2b7cbfa3def58d3b6.yml +openapi_spec_hash: 089f68a73d401049586c04b4296caeaa config_hash: 53d4a93c7ccdf3ccc66101454420c415 diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 6a9cbbb9..9a3b7bf8 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Dict, List, Iterable, Optional import httpx @@ -422,6 +423,7 @@ def get( cast_to=InferenceDeployment, ) + @typing_extensions.deprecated("deprecated") def get_api_key( self, deployment_name: str, @@ -947,6 +949,7 @@ async def get( cast_to=InferenceDeployment, ) + @typing_extensions.deprecated("deprecated") async def get_api_key( self, deployment_name: str, @@ -1103,8 +1106,10 @@ def __init__(self, deployments: DeploymentsResource) -> None: self.get = to_raw_response_wrapper( deployments.get, ) - self.get_api_key = to_raw_response_wrapper( - deployments.get_api_key, + self.get_api_key = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + deployments.get_api_key # pyright: ignore[reportDeprecated], + ) ) self.start = to_raw_response_wrapper( deployments.start, @@ -1137,8 +1142,10 @@ def __init__(self, deployments: AsyncDeploymentsResource) -> None: self.get = async_to_raw_response_wrapper( deployments.get, ) - self.get_api_key = async_to_raw_response_wrapper( - deployments.get_api_key, + self.get_api_key = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + deployments.get_api_key # pyright: ignore[reportDeprecated], + ) ) self.start = async_to_raw_response_wrapper( deployments.start, @@ -1171,8 +1178,10 @@ def __init__(self, deployments: DeploymentsResource) -> None: self.get = to_streamed_response_wrapper( deployments.get, ) - self.get_api_key = to_streamed_response_wrapper( - deployments.get_api_key, + self.get_api_key = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + deployments.get_api_key # pyright: ignore[reportDeprecated], + ) ) self.start = to_streamed_response_wrapper( deployments.start, @@ -1205,8 +1214,10 @@ def __init__(self, deployments: AsyncDeploymentsResource) -> None: self.get = async_to_streamed_response_wrapper( deployments.get, ) - self.get_api_key = async_to_streamed_response_wrapper( - deployments.get_api_key, + self.get_api_key = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + deployments.get_api_key # pyright: ignore[reportDeprecated], + ) ) self.start = async_to_streamed_response_wrapper( deployments.start, diff --git a/tests/api_resources/cloud/inference/test_deployments.py b/tests/api_resources/cloud/inference/test_deployments.py index 7090d25d..6b9b0802 100644 --- a/tests/api_resources/cloud/inference/test_deployments.py +++ b/tests/api_resources/cloud/inference/test_deployments.py @@ -16,6 +16,8 @@ InferenceDeploymentAPIKey, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -496,18 +498,21 @@ def test_path_params_get(self, client: Gcore) -> None: @parametrize def test_method_get_api_key(self, client: Gcore) -> None: - deployment = client.cloud.inference.deployments.get_api_key( - deployment_name="my-instance", - project_id=1, - ) + with pytest.warns(DeprecationWarning): + deployment = client.cloud.inference.deployments.get_api_key( + deployment_name="my-instance", + project_id=1, + ) + assert_matches_type(InferenceDeploymentAPIKey, deployment, path=["response"]) @parametrize def test_raw_response_get_api_key(self, client: Gcore) -> None: - response = client.cloud.inference.deployments.with_raw_response.get_api_key( - deployment_name="my-instance", - project_id=1, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.inference.deployments.with_raw_response.get_api_key( + deployment_name="my-instance", + project_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -516,25 +521,27 @@ def test_raw_response_get_api_key(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_api_key(self, client: Gcore) -> None: - with client.cloud.inference.deployments.with_streaming_response.get_api_key( - deployment_name="my-instance", - project_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.inference.deployments.with_streaming_response.get_api_key( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - deployment = response.parse() - assert_matches_type(InferenceDeploymentAPIKey, deployment, path=["response"]) + deployment = response.parse() + assert_matches_type(InferenceDeploymentAPIKey, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get_api_key(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): - client.cloud.inference.deployments.with_raw_response.get_api_key( - deployment_name="", - project_id=1, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + client.cloud.inference.deployments.with_raw_response.get_api_key( + deployment_name="", + project_id=1, + ) @parametrize def test_method_start(self, client: Gcore) -> None: @@ -1100,18 +1107,21 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_get_api_key(self, async_client: AsyncGcore) -> None: - deployment = await async_client.cloud.inference.deployments.get_api_key( - deployment_name="my-instance", - project_id=1, - ) + with pytest.warns(DeprecationWarning): + deployment = await async_client.cloud.inference.deployments.get_api_key( + deployment_name="my-instance", + project_id=1, + ) + assert_matches_type(InferenceDeploymentAPIKey, deployment, path=["response"]) @parametrize async def test_raw_response_get_api_key(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.inference.deployments.with_raw_response.get_api_key( - deployment_name="my-instance", - project_id=1, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.inference.deployments.with_raw_response.get_api_key( + deployment_name="my-instance", + project_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1120,25 +1130,27 @@ async def test_raw_response_get_api_key(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get_api_key(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.inference.deployments.with_streaming_response.get_api_key( - deployment_name="my-instance", - project_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.cloud.inference.deployments.with_streaming_response.get_api_key( + deployment_name="my-instance", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - deployment = await response.parse() - assert_matches_type(InferenceDeploymentAPIKey, deployment, path=["response"]) + deployment = await response.parse() + assert_matches_type(InferenceDeploymentAPIKey, deployment, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get_api_key(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): - await async_client.cloud.inference.deployments.with_raw_response.get_api_key( - deployment_name="", - project_id=1, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + await async_client.cloud.inference.deployments.with_raw_response.get_api_key( + deployment_name="", + project_id=1, + ) @parametrize async def test_method_start(self, async_client: AsyncGcore) -> None: From 01ac8c1173b7a6fcfb2253dbca8bf345430cc515 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 14:11:53 +0000 Subject: [PATCH 249/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 52c3fb91..80cf3f9d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 452 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-969139542b16b893e81be1cca6eb7e0f9e00580a967619d2b7cbfa3def58d3b6.yml -openapi_spec_hash: 089f68a73d401049586c04b4296caeaa +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2759f8cfd08f3fae0172ba6e9949be87b6072b75a5e16516b4d33a914d73b1c6.yml +openapi_spec_hash: 2eb719332c26084fd869e1da83adb259 config_hash: 53d4a93c7ccdf3ccc66101454420c415 From ffa108ad8b00b9ce3574bcfcd5bb518e0a37c6c9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 Aug 2025 07:36:21 +0000 Subject: [PATCH 250/592] chore(internal): improve breaking change detection --- .github/workflows/detect-breaking-changes.yml | 3 + pyproject.toml | 1 + requirements-dev.lock | 3 + scripts/detect-breaking-changes.py | 79 +++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 scripts/detect-breaking-changes.py diff --git a/.github/workflows/detect-breaking-changes.yml b/.github/workflows/detect-breaking-changes.yml index e16b5001..4640f451 100644 --- a/.github/workflows/detect-breaking-changes.yml +++ b/.github/workflows/detect-breaking-changes.yml @@ -30,6 +30,9 @@ jobs: - name: Install dependencies run: | rye sync --all-features + - name: Detect removed symbols + run: | + rye run python scripts/detect-breaking-changes.py "${{ github.event.pull_request.base.sha }}" - name: Detect breaking changes run: | diff --git a/pyproject.toml b/pyproject.toml index 66959330..e44f7cea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ dev-dependencies = [ "rich>=13.7.1", "nest_asyncio==1.6.0", "pytest-xdist>=3.6.1", + "griffe>=1", ] [tool.rye.scripts] diff --git a/requirements-dev.lock b/requirements-dev.lock index 85513c5a..9b0a8e90 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -31,6 +31,8 @@ attrs==25.3.0 certifi==2023.7.22 # via httpcore # via httpx +colorama==0.4.6 + # via griffe colorlog==6.7.0 # via nox dirty-equals==0.6.0 @@ -48,6 +50,7 @@ filelock==3.12.4 frozenlist==1.6.2 # via aiohttp # via aiosignal +griffe==1.12.1 h11==0.16.0 # via httpcore httpcore==1.0.9 diff --git a/scripts/detect-breaking-changes.py b/scripts/detect-breaking-changes.py new file mode 100644 index 00000000..bc61aeaf --- /dev/null +++ b/scripts/detect-breaking-changes.py @@ -0,0 +1,79 @@ +from __future__ import annotations + +import sys +from typing import Iterator +from pathlib import Path + +import rich +import griffe +from rich.text import Text +from rich.style import Style + + +def public_members(obj: griffe.Object | griffe.Alias) -> dict[str, griffe.Object | griffe.Alias]: + if isinstance(obj, griffe.Alias): + # ignore imports for now, they're technically part of the public API + # but we don't have good preventative measures in place to prevent + # changing them + return {} + + return {name: value for name, value in obj.all_members.items() if not name.startswith("_")} + + +def find_breaking_changes( + new_obj: griffe.Object | griffe.Alias, + old_obj: griffe.Object | griffe.Alias, + *, + path: list[str], +) -> Iterator[Text | str]: + new_members = public_members(new_obj) + old_members = public_members(old_obj) + + for name, old_member in old_members.items(): + if isinstance(old_member, griffe.Alias) and len(path) > 2: + # ignore imports in `/types/` for now, they're technically part of the public API + # but we don't have good preventative measures in place to prevent changing them + continue + + new_member = new_members.get(name) + if new_member is None: + cls_name = old_member.__class__.__name__ + yield Text(f"({cls_name})", style=Style(color="rgb(119, 119, 119)")) + yield from [" " for _ in range(10 - len(cls_name))] + yield f" {'.'.join(path)}.{name}" + yield "\n" + continue + + yield from find_breaking_changes(new_member, old_member, path=[*path, name]) + + +def main() -> None: + try: + against_ref = sys.argv[1] + except IndexError as err: + raise RuntimeError("You must specify a base ref to run breaking change detection against") from err + + package = griffe.load( + "gcore", + search_paths=[Path(__file__).parent.parent.joinpath("src")], + ) + old_package = griffe.load_git( + "gcore", + ref=against_ref, + search_paths=["src"], + ) + assert isinstance(package, griffe.Module) + assert isinstance(old_package, griffe.Module) + + output = list(find_breaking_changes(package, old_package, path=["gcore"])) + if output: + rich.print(Text("Breaking changes detected!", style=Style(color="rgb(165, 79, 87)"))) + rich.print() + + for text in output: + rich.print(text, end="") + + sys.exit(1) + + +main() From fd2ba1043a97ee466746acd015d96865b624bb83 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 Aug 2025 09:10:46 +0000 Subject: [PATCH 251/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 80cf3f9d..03abc5c8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 452 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2759f8cfd08f3fae0172ba6e9949be87b6072b75a5e16516b4d33a914d73b1c6.yml openapi_spec_hash: 2eb719332c26084fd869e1da83adb259 -config_hash: 53d4a93c7ccdf3ccc66101454420c415 +config_hash: 565957e0355c1358b339e38fdc8f7342 From 3e97afe3135e1faedd0dbd76464a872fc14112ff Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 Aug 2025 15:16:07 +0000 Subject: [PATCH 252/592] feat(api): api update --- .stats.yml | 4 +- api.md | 136 ++ src/gcore/_client.py | 9 + src/gcore/resources/__init__.py | 14 + src/gcore/resources/dns/__init__.py | 75 + src/gcore/resources/dns/dns.py | 374 +++++ src/gcore/resources/dns/locations.py | 288 ++++ src/gcore/resources/dns/metrics.py | 214 +++ src/gcore/resources/dns/pickers/__init__.py | 33 + src/gcore/resources/dns/pickers/pickers.py | 167 ++ src/gcore/resources/dns/pickers/presets.py | 135 ++ src/gcore/resources/dns/zones/__init__.py | 47 + src/gcore/resources/dns/zones/dnssec.py | 248 +++ src/gcore/resources/dns/zones/rrsets.py | 1005 +++++++++++ src/gcore/resources/dns/zones/zones.py | 1493 +++++++++++++++++ src/gcore/types/dns/__init__.py | 31 + .../dns/dns_get_account_overview_response.py | 39 + src/gcore/types/dns/dns_label_name.py | 13 + .../types/dns/dns_location_translations.py | 11 + src/gcore/types/dns/dns_lookup_params.py | 15 + src/gcore/types/dns/dns_lookup_response.py | 21 + src/gcore/types/dns/dns_name_server.py | 17 + .../dns/location_list_continents_response.py | 10 + .../dns/location_list_countries_response.py | 10 + .../dns/location_list_regions_response.py | 10 + src/gcore/types/dns/location_list_response.py | 16 + src/gcore/types/dns/metric_list_params.py | 22 + src/gcore/types/dns/metric_list_response.py | 7 + src/gcore/types/dns/picker_list_response.py | 10 + src/gcore/types/dns/pickers/__init__.py | 5 + .../types/dns/pickers/preset_list_response.py | 10 + .../zone_check_delegation_status_response.py | 20 + src/gcore/types/dns/zone_create_params.py | 59 + src/gcore/types/dns/zone_create_response.py | 13 + src/gcore/types/dns/zone_export_response.py | 11 + src/gcore/types/dns/zone_get_response.py | 104 ++ .../types/dns/zone_get_statistics_params.py | 43 + .../types/dns/zone_get_statistics_response.py | 19 + src/gcore/types/dns/zone_import_params.py | 32 + src/gcore/types/dns/zone_import_response.py | 26 + src/gcore/types/dns/zone_list_params.py | 56 + src/gcore/types/dns/zone_list_response.py | 103 ++ src/gcore/types/dns/zone_update_params.py | 61 + src/gcore/types/dns/zones/__init__.py | 15 + src/gcore/types/dns/zones/dns_failover_log.py | 19 + src/gcore/types/dns/zones/dns_output_rrset.py | 123 ++ .../types/dns/zones/dnssec_get_response.py | 38 + .../types/dns/zones/dnssec_update_params.py | 11 + .../types/dns/zones/dnssec_update_response.py | 38 + .../types/dns/zones/rrset_create_params.py | 82 + .../zones/rrset_get_failover_logs_params.py | 21 + .../zones/rrset_get_failover_logs_response.py | 15 + .../types/dns/zones/rrset_list_params.py | 21 + .../types/dns/zones/rrset_list_response.py | 14 + .../types/dns/zones/rrset_update_params.py | 82 + tests/api_resources/dns/__init__.py | 1 + tests/api_resources/dns/pickers/__init__.py | 1 + .../api_resources/dns/pickers/test_presets.py | 74 + tests/api_resources/dns/test_locations.py | 229 +++ tests/api_resources/dns/test_metrics.py | 89 + tests/api_resources/dns/test_pickers.py | 74 + tests/api_resources/dns/test_zones.py | 987 +++++++++++ tests/api_resources/dns/zones/__init__.py | 1 + tests/api_resources/dns/zones/test_dnssec.py | 192 +++ tests/api_resources/dns/zones/test_rrsets.py | 872 ++++++++++ tests/api_resources/test_dns.py | 140 ++ 66 files changed, 8173 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/dns/__init__.py create mode 100644 src/gcore/resources/dns/dns.py create mode 100644 src/gcore/resources/dns/locations.py create mode 100644 src/gcore/resources/dns/metrics.py create mode 100644 src/gcore/resources/dns/pickers/__init__.py create mode 100644 src/gcore/resources/dns/pickers/pickers.py create mode 100644 src/gcore/resources/dns/pickers/presets.py create mode 100644 src/gcore/resources/dns/zones/__init__.py create mode 100644 src/gcore/resources/dns/zones/dnssec.py create mode 100644 src/gcore/resources/dns/zones/rrsets.py create mode 100644 src/gcore/resources/dns/zones/zones.py create mode 100644 src/gcore/types/dns/__init__.py create mode 100644 src/gcore/types/dns/dns_get_account_overview_response.py create mode 100644 src/gcore/types/dns/dns_label_name.py create mode 100644 src/gcore/types/dns/dns_location_translations.py create mode 100644 src/gcore/types/dns/dns_lookup_params.py create mode 100644 src/gcore/types/dns/dns_lookup_response.py create mode 100644 src/gcore/types/dns/dns_name_server.py create mode 100644 src/gcore/types/dns/location_list_continents_response.py create mode 100644 src/gcore/types/dns/location_list_countries_response.py create mode 100644 src/gcore/types/dns/location_list_regions_response.py create mode 100644 src/gcore/types/dns/location_list_response.py create mode 100644 src/gcore/types/dns/metric_list_params.py create mode 100644 src/gcore/types/dns/metric_list_response.py create mode 100644 src/gcore/types/dns/picker_list_response.py create mode 100644 src/gcore/types/dns/pickers/__init__.py create mode 100644 src/gcore/types/dns/pickers/preset_list_response.py create mode 100644 src/gcore/types/dns/zone_check_delegation_status_response.py create mode 100644 src/gcore/types/dns/zone_create_params.py create mode 100644 src/gcore/types/dns/zone_create_response.py create mode 100644 src/gcore/types/dns/zone_export_response.py create mode 100644 src/gcore/types/dns/zone_get_response.py create mode 100644 src/gcore/types/dns/zone_get_statistics_params.py create mode 100644 src/gcore/types/dns/zone_get_statistics_response.py create mode 100644 src/gcore/types/dns/zone_import_params.py create mode 100644 src/gcore/types/dns/zone_import_response.py create mode 100644 src/gcore/types/dns/zone_list_params.py create mode 100644 src/gcore/types/dns/zone_list_response.py create mode 100644 src/gcore/types/dns/zone_update_params.py create mode 100644 src/gcore/types/dns/zones/__init__.py create mode 100644 src/gcore/types/dns/zones/dns_failover_log.py create mode 100644 src/gcore/types/dns/zones/dns_output_rrset.py create mode 100644 src/gcore/types/dns/zones/dnssec_get_response.py create mode 100644 src/gcore/types/dns/zones/dnssec_update_params.py create mode 100644 src/gcore/types/dns/zones/dnssec_update_response.py create mode 100644 src/gcore/types/dns/zones/rrset_create_params.py create mode 100644 src/gcore/types/dns/zones/rrset_get_failover_logs_params.py create mode 100644 src/gcore/types/dns/zones/rrset_get_failover_logs_response.py create mode 100644 src/gcore/types/dns/zones/rrset_list_params.py create mode 100644 src/gcore/types/dns/zones/rrset_list_response.py create mode 100644 src/gcore/types/dns/zones/rrset_update_params.py create mode 100644 tests/api_resources/dns/__init__.py create mode 100644 tests/api_resources/dns/pickers/__init__.py create mode 100644 tests/api_resources/dns/pickers/test_presets.py create mode 100644 tests/api_resources/dns/test_locations.py create mode 100644 tests/api_resources/dns/test_metrics.py create mode 100644 tests/api_resources/dns/test_pickers.py create mode 100644 tests/api_resources/dns/test_zones.py create mode 100644 tests/api_resources/dns/zones/__init__.py create mode 100644 tests/api_resources/dns/zones/test_dnssec.py create mode 100644 tests/api_resources/dns/zones/test_rrsets.py create mode 100644 tests/api_resources/test_dns.py diff --git a/.stats.yml b/.stats.yml index 03abc5c8..b9503f4b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 452 +configured_endpoints: 480 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2759f8cfd08f3fae0172ba6e9949be87b6072b75a5e16516b4d33a914d73b1c6.yml openapi_spec_hash: 2eb719332c26084fd869e1da83adb259 -config_hash: 565957e0355c1358b339e38fdc8f7342 +config_hash: 5f09daa6ebce3d121a6b0c92a0ea1195 diff --git a/api.md b/api.md index 4c75ce29..208268cd 100644 --- a/api.md +++ b/api.md @@ -1758,3 +1758,139 @@ Methods: - client.security.profiles.get(id) -> ClientProfile - client.security.profiles.recreate(id, \*\*params) -> ClientProfile - client.security.profiles.replace(id, \*\*params) -> ClientProfile + +# DNS + +Types: + +```python +from gcore.types.dns import DNSGetAccountOverviewResponse, DNSLookupResponse +``` + +Methods: + +- client.dns.get_account_overview() -> DNSGetAccountOverviewResponse +- client.dns.lookup(\*\*params) -> DNSLookupResponse + +## Locations + +Types: + +```python +from gcore.types.dns import ( + DNSLocationTranslations, + LocationListResponse, + LocationListContinentsResponse, + LocationListCountriesResponse, + LocationListRegionsResponse, +) +``` + +Methods: + +- client.dns.locations.list() -> LocationListResponse +- client.dns.locations.list_continents() -> LocationListContinentsResponse +- client.dns.locations.list_countries() -> LocationListCountriesResponse +- client.dns.locations.list_regions() -> LocationListRegionsResponse + +## Metrics + +Types: + +```python +from gcore.types.dns import MetricListResponse +``` + +Methods: + +- client.dns.metrics.list(\*\*params) -> str + +## Pickers + +Types: + +```python +from gcore.types.dns import DNSLabelName, PickerListResponse +``` + +Methods: + +- client.dns.pickers.list() -> PickerListResponse + +### Presets + +Types: + +```python +from gcore.types.dns.pickers import PresetListResponse +``` + +Methods: + +- client.dns.pickers.presets.list() -> PresetListResponse + +## Zones + +Types: + +```python +from gcore.types.dns import ( + DNSNameServer, + ZoneCreateResponse, + ZoneListResponse, + ZoneCheckDelegationStatusResponse, + ZoneExportResponse, + ZoneGetResponse, + ZoneGetStatisticsResponse, + ZoneImportResponse, +) +``` + +Methods: + +- client.dns.zones.create(\*\*params) -> ZoneCreateResponse +- client.dns.zones.update(path_name, \*\*params) -> object +- client.dns.zones.list(\*\*params) -> ZoneListResponse +- client.dns.zones.delete(name) -> object +- client.dns.zones.check_delegation_status(name) -> ZoneCheckDelegationStatusResponse +- client.dns.zones.disable(name) -> object +- client.dns.zones.enable(name) -> object +- client.dns.zones.export(zone_name) -> ZoneExportResponse +- client.dns.zones.get(name) -> ZoneGetResponse +- client.dns.zones.get_statistics(name, \*\*params) -> ZoneGetStatisticsResponse +- client.dns.zones.import\_(zone_name, \*\*params) -> ZoneImportResponse + +### Dnssec + +Types: + +```python +from gcore.types.dns.zones import DnssecUpdateResponse, DnssecGetResponse +``` + +Methods: + +- client.dns.zones.dnssec.update(name, \*\*params) -> DnssecUpdateResponse +- client.dns.zones.dnssec.get(name) -> DnssecGetResponse + +### Rrsets + +Types: + +```python +from gcore.types.dns.zones import ( + DNSFailoverLog, + DNSOutputRrset, + RrsetListResponse, + RrsetGetFailoverLogsResponse, +) +``` + +Methods: + +- client.dns.zones.rrsets.create(rrset_type, \*, zone_name, rrset_name, \*\*params) -> DNSOutputRrset +- client.dns.zones.rrsets.update(rrset_type, \*, zone_name, rrset_name, \*\*params) -> DNSOutputRrset +- client.dns.zones.rrsets.list(zone_name, \*\*params) -> RrsetListResponse +- client.dns.zones.rrsets.delete(rrset_type, \*, zone_name, rrset_name) -> object +- client.dns.zones.rrsets.get(rrset_type, \*, zone_name, rrset_name) -> DNSOutputRrset +- client.dns.zones.rrsets.get_failover_logs(rrset_type, \*, zone_name, rrset_name, \*\*params) -> RrsetGetFailoverLogsResponse diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 8521d0c7..03876d8b 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -28,6 +28,7 @@ SyncAPIClient, AsyncAPIClient, ) +from .resources.dns import dns from .resources.iam import iam from .resources.waap import waap from .resources.cloud import cloud @@ -45,6 +46,7 @@ class Gcore(SyncAPIClient): fastedge: fastedge.FastedgeResource streaming: streaming.StreamingResource security: security.SecurityResource + dns: dns.DNSResource with_raw_response: GcoreWithRawResponse with_streaming_response: GcoreWithStreamedResponse @@ -129,6 +131,7 @@ def __init__( self.fastedge = fastedge.FastedgeResource(self) self.streaming = streaming.StreamingResource(self) self.security = security.SecurityResource(self) + self.dns = dns.DNSResource(self) self.with_raw_response = GcoreWithRawResponse(self) self.with_streaming_response = GcoreWithStreamedResponse(self) @@ -268,6 +271,7 @@ class AsyncGcore(AsyncAPIClient): fastedge: fastedge.AsyncFastedgeResource streaming: streaming.AsyncStreamingResource security: security.AsyncSecurityResource + dns: dns.AsyncDNSResource with_raw_response: AsyncGcoreWithRawResponse with_streaming_response: AsyncGcoreWithStreamedResponse @@ -352,6 +356,7 @@ def __init__( self.fastedge = fastedge.AsyncFastedgeResource(self) self.streaming = streaming.AsyncStreamingResource(self) self.security = security.AsyncSecurityResource(self) + self.dns = dns.AsyncDNSResource(self) self.with_raw_response = AsyncGcoreWithRawResponse(self) self.with_streaming_response = AsyncGcoreWithStreamedResponse(self) @@ -492,6 +497,7 @@ def __init__(self, client: Gcore) -> None: self.fastedge = fastedge.FastedgeResourceWithRawResponse(client.fastedge) self.streaming = streaming.StreamingResourceWithRawResponse(client.streaming) self.security = security.SecurityResourceWithRawResponse(client.security) + self.dns = dns.DNSResourceWithRawResponse(client.dns) class AsyncGcoreWithRawResponse: @@ -502,6 +508,7 @@ def __init__(self, client: AsyncGcore) -> None: self.fastedge = fastedge.AsyncFastedgeResourceWithRawResponse(client.fastedge) self.streaming = streaming.AsyncStreamingResourceWithRawResponse(client.streaming) self.security = security.AsyncSecurityResourceWithRawResponse(client.security) + self.dns = dns.AsyncDNSResourceWithRawResponse(client.dns) class GcoreWithStreamedResponse: @@ -512,6 +519,7 @@ def __init__(self, client: Gcore) -> None: self.fastedge = fastedge.FastedgeResourceWithStreamingResponse(client.fastedge) self.streaming = streaming.StreamingResourceWithStreamingResponse(client.streaming) self.security = security.SecurityResourceWithStreamingResponse(client.security) + self.dns = dns.DNSResourceWithStreamingResponse(client.dns) class AsyncGcoreWithStreamedResponse: @@ -522,6 +530,7 @@ def __init__(self, client: AsyncGcore) -> None: self.fastedge = fastedge.AsyncFastedgeResourceWithStreamingResponse(client.fastedge) self.streaming = streaming.AsyncStreamingResourceWithStreamingResponse(client.streaming) self.security = security.AsyncSecurityResourceWithStreamingResponse(client.security) + self.dns = dns.AsyncDNSResourceWithStreamingResponse(client.dns) Client = Gcore diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py index c85f01d3..7f795ef0 100644 --- a/src/gcore/resources/__init__.py +++ b/src/gcore/resources/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .dns import ( + DNSResource, + AsyncDNSResource, + DNSResourceWithRawResponse, + AsyncDNSResourceWithRawResponse, + DNSResourceWithStreamingResponse, + AsyncDNSResourceWithStreamingResponse, +) from .iam import ( IamResource, AsyncIamResource, @@ -86,4 +94,10 @@ "AsyncSecurityResourceWithRawResponse", "SecurityResourceWithStreamingResponse", "AsyncSecurityResourceWithStreamingResponse", + "DNSResource", + "AsyncDNSResource", + "DNSResourceWithRawResponse", + "AsyncDNSResourceWithRawResponse", + "DNSResourceWithStreamingResponse", + "AsyncDNSResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/dns/__init__.py b/src/gcore/resources/dns/__init__.py new file mode 100644 index 00000000..12d75f5f --- /dev/null +++ b/src/gcore/resources/dns/__init__.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .dns import ( + DNSResource, + AsyncDNSResource, + DNSResourceWithRawResponse, + AsyncDNSResourceWithRawResponse, + DNSResourceWithStreamingResponse, + AsyncDNSResourceWithStreamingResponse, +) +from .zones import ( + ZonesResource, + AsyncZonesResource, + ZonesResourceWithRawResponse, + AsyncZonesResourceWithRawResponse, + ZonesResourceWithStreamingResponse, + AsyncZonesResourceWithStreamingResponse, +) +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) +from .pickers import ( + PickersResource, + AsyncPickersResource, + PickersResourceWithRawResponse, + AsyncPickersResourceWithRawResponse, + PickersResourceWithStreamingResponse, + AsyncPickersResourceWithStreamingResponse, +) +from .locations import ( + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, +) + +__all__ = [ + "LocationsResource", + "AsyncLocationsResource", + "LocationsResourceWithRawResponse", + "AsyncLocationsResourceWithRawResponse", + "LocationsResourceWithStreamingResponse", + "AsyncLocationsResourceWithStreamingResponse", + "MetricsResource", + "AsyncMetricsResource", + "MetricsResourceWithRawResponse", + "AsyncMetricsResourceWithRawResponse", + "MetricsResourceWithStreamingResponse", + "AsyncMetricsResourceWithStreamingResponse", + "PickersResource", + "AsyncPickersResource", + "PickersResourceWithRawResponse", + "AsyncPickersResourceWithRawResponse", + "PickersResourceWithStreamingResponse", + "AsyncPickersResourceWithStreamingResponse", + "ZonesResource", + "AsyncZonesResource", + "ZonesResourceWithRawResponse", + "AsyncZonesResourceWithRawResponse", + "ZonesResourceWithStreamingResponse", + "AsyncZonesResourceWithStreamingResponse", + "DNSResource", + "AsyncDNSResource", + "DNSResourceWithRawResponse", + "AsyncDNSResourceWithRawResponse", + "DNSResourceWithStreamingResponse", + "AsyncDNSResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py new file mode 100644 index 00000000..3e6485d0 --- /dev/null +++ b/src/gcore/resources/dns/dns.py @@ -0,0 +1,374 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from .locations import ( + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, +) +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 dns_lookup_params +from .zones.zones import ( + ZonesResource, + AsyncZonesResource, + ZonesResourceWithRawResponse, + AsyncZonesResourceWithRawResponse, + ZonesResourceWithStreamingResponse, + AsyncZonesResourceWithStreamingResponse, +) +from ..._base_client import make_request_options +from .pickers.pickers import ( + PickersResource, + AsyncPickersResource, + PickersResourceWithRawResponse, + AsyncPickersResourceWithRawResponse, + PickersResourceWithStreamingResponse, + AsyncPickersResourceWithStreamingResponse, +) +from ...types.dns.dns_lookup_response import DNSLookupResponse +from ...types.dns.dns_get_account_overview_response import DNSGetAccountOverviewResponse + +__all__ = ["DNSResource", "AsyncDNSResource"] + + +class DNSResource(SyncAPIResource): + @cached_property + def locations(self) -> LocationsResource: + return LocationsResource(self._client) + + @cached_property + def metrics(self) -> MetricsResource: + return MetricsResource(self._client) + + @cached_property + def pickers(self) -> PickersResource: + return PickersResource(self._client) + + @cached_property + def zones(self) -> ZonesResource: + return ZonesResource(self._client) + + @cached_property + def with_raw_response(self) -> DNSResourceWithRawResponse: + """ + 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 DNSResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DNSResourceWithStreamingResponse: + """ + 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 DNSResourceWithStreamingResponse(self) + + def get_account_overview( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DNSGetAccountOverviewResponse: + """Get info about client""" + return self._get( + "/dns/v2/platform/info", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSGetAccountOverviewResponse, + ) + + def lookup( + self, + *, + name: str | NotGiven = NOT_GIVEN, + request_server: Literal["authoritative_dns", "google", "cloudflare", "open_dns", "quad9", "gcore"] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DNSLookupResponse: + """ + Get the dns records from a specific domain or ip. + + Args: + name: Domain name + + request_server: Server that will be used as resolver + + 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/lookup", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "name": name, + "request_server": request_server, + }, + dns_lookup_params.DNSLookupParams, + ), + ), + cast_to=DNSLookupResponse, + ) + + +class AsyncDNSResource(AsyncAPIResource): + @cached_property + def locations(self) -> AsyncLocationsResource: + return AsyncLocationsResource(self._client) + + @cached_property + def metrics(self) -> AsyncMetricsResource: + return AsyncMetricsResource(self._client) + + @cached_property + def pickers(self) -> AsyncPickersResource: + return AsyncPickersResource(self._client) + + @cached_property + def zones(self) -> AsyncZonesResource: + return AsyncZonesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncDNSResourceWithRawResponse: + """ + 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 AsyncDNSResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDNSResourceWithStreamingResponse: + """ + 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 AsyncDNSResourceWithStreamingResponse(self) + + async def get_account_overview( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DNSGetAccountOverviewResponse: + """Get info about client""" + return await self._get( + "/dns/v2/platform/info", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSGetAccountOverviewResponse, + ) + + async def lookup( + self, + *, + name: str | NotGiven = NOT_GIVEN, + request_server: Literal["authoritative_dns", "google", "cloudflare", "open_dns", "quad9", "gcore"] + | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DNSLookupResponse: + """ + Get the dns records from a specific domain or ip. + + Args: + name: Domain name + + request_server: Server that will be used as resolver + + 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/lookup", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "name": name, + "request_server": request_server, + }, + dns_lookup_params.DNSLookupParams, + ), + ), + cast_to=DNSLookupResponse, + ) + + +class DNSResourceWithRawResponse: + def __init__(self, dns: DNSResource) -> None: + self._dns = dns + + self.get_account_overview = to_raw_response_wrapper( + dns.get_account_overview, + ) + self.lookup = to_raw_response_wrapper( + dns.lookup, + ) + + @cached_property + def locations(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self._dns.locations) + + @cached_property + def metrics(self) -> MetricsResourceWithRawResponse: + return MetricsResourceWithRawResponse(self._dns.metrics) + + @cached_property + def pickers(self) -> PickersResourceWithRawResponse: + return PickersResourceWithRawResponse(self._dns.pickers) + + @cached_property + def zones(self) -> ZonesResourceWithRawResponse: + return ZonesResourceWithRawResponse(self._dns.zones) + + +class AsyncDNSResourceWithRawResponse: + def __init__(self, dns: AsyncDNSResource) -> None: + self._dns = dns + + self.get_account_overview = async_to_raw_response_wrapper( + dns.get_account_overview, + ) + self.lookup = async_to_raw_response_wrapper( + dns.lookup, + ) + + @cached_property + def locations(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self._dns.locations) + + @cached_property + def metrics(self) -> AsyncMetricsResourceWithRawResponse: + return AsyncMetricsResourceWithRawResponse(self._dns.metrics) + + @cached_property + def pickers(self) -> AsyncPickersResourceWithRawResponse: + return AsyncPickersResourceWithRawResponse(self._dns.pickers) + + @cached_property + def zones(self) -> AsyncZonesResourceWithRawResponse: + return AsyncZonesResourceWithRawResponse(self._dns.zones) + + +class DNSResourceWithStreamingResponse: + def __init__(self, dns: DNSResource) -> None: + self._dns = dns + + self.get_account_overview = to_streamed_response_wrapper( + dns.get_account_overview, + ) + self.lookup = to_streamed_response_wrapper( + dns.lookup, + ) + + @cached_property + def locations(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self._dns.locations) + + @cached_property + def metrics(self) -> MetricsResourceWithStreamingResponse: + return MetricsResourceWithStreamingResponse(self._dns.metrics) + + @cached_property + def pickers(self) -> PickersResourceWithStreamingResponse: + return PickersResourceWithStreamingResponse(self._dns.pickers) + + @cached_property + def zones(self) -> ZonesResourceWithStreamingResponse: + return ZonesResourceWithStreamingResponse(self._dns.zones) + + +class AsyncDNSResourceWithStreamingResponse: + def __init__(self, dns: AsyncDNSResource) -> None: + self._dns = dns + + self.get_account_overview = async_to_streamed_response_wrapper( + dns.get_account_overview, + ) + self.lookup = async_to_streamed_response_wrapper( + dns.lookup, + ) + + @cached_property + def locations(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self._dns.locations) + + @cached_property + def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: + return AsyncMetricsResourceWithStreamingResponse(self._dns.metrics) + + @cached_property + def pickers(self) -> AsyncPickersResourceWithStreamingResponse: + return AsyncPickersResourceWithStreamingResponse(self._dns.pickers) + + @cached_property + def zones(self) -> AsyncZonesResourceWithStreamingResponse: + return AsyncZonesResourceWithStreamingResponse(self._dns.zones) diff --git a/src/gcore/resources/dns/locations.py b/src/gcore/resources/dns/locations.py new file mode 100644 index 00000000..20dcea5a --- /dev/null +++ b/src/gcore/resources/dns/locations.py @@ -0,0 +1,288 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.dns.location_list_response import LocationListResponse +from ...types.dns.location_list_regions_response import LocationListRegionsResponse +from ...types.dns.location_list_countries_response import LocationListCountriesResponse +from ...types.dns.location_list_continents_response import LocationListContinentsResponse + +__all__ = ["LocationsResource", "AsyncLocationsResource"] + + +class LocationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> LocationsResourceWithRawResponse: + """ + 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 LocationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: + """ + 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 LocationsResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LocationListResponse: + """List of All locations continents/countries/regions.""" + return self._get( + "/dns/v2/locations", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LocationListResponse, + ) + + def list_continents( + 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, + ) -> LocationListContinentsResponse: + """List of All locations continents.""" + return self._get( + "/dns/v2/locations/continents", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LocationListContinentsResponse, + ) + + def list_countries( + 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, + ) -> LocationListCountriesResponse: + """List of All locations countries.""" + return self._get( + "/dns/v2/locations/countries", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LocationListCountriesResponse, + ) + + def list_regions( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LocationListRegionsResponse: + """List of All locations regions.""" + return self._get( + "/dns/v2/locations/regions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LocationListRegionsResponse, + ) + + +class AsyncLocationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncLocationsResourceWithRawResponse: + """ + 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 AsyncLocationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse: + """ + 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 AsyncLocationsResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LocationListResponse: + """List of All locations continents/countries/regions.""" + return await self._get( + "/dns/v2/locations", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LocationListResponse, + ) + + async def list_continents( + 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, + ) -> LocationListContinentsResponse: + """List of All locations continents.""" + return await self._get( + "/dns/v2/locations/continents", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LocationListContinentsResponse, + ) + + async def list_countries( + 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, + ) -> LocationListCountriesResponse: + """List of All locations countries.""" + return await self._get( + "/dns/v2/locations/countries", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LocationListCountriesResponse, + ) + + async def list_regions( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LocationListRegionsResponse: + """List of All locations regions.""" + return await self._get( + "/dns/v2/locations/regions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LocationListRegionsResponse, + ) + + +class LocationsResourceWithRawResponse: + def __init__(self, locations: LocationsResource) -> None: + self._locations = locations + + self.list = to_raw_response_wrapper( + locations.list, + ) + self.list_continents = to_raw_response_wrapper( + locations.list_continents, + ) + self.list_countries = to_raw_response_wrapper( + locations.list_countries, + ) + self.list_regions = to_raw_response_wrapper( + locations.list_regions, + ) + + +class AsyncLocationsResourceWithRawResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: + self._locations = locations + + self.list = async_to_raw_response_wrapper( + locations.list, + ) + self.list_continents = async_to_raw_response_wrapper( + locations.list_continents, + ) + self.list_countries = async_to_raw_response_wrapper( + locations.list_countries, + ) + self.list_regions = async_to_raw_response_wrapper( + locations.list_regions, + ) + + +class LocationsResourceWithStreamingResponse: + def __init__(self, locations: LocationsResource) -> None: + self._locations = locations + + self.list = to_streamed_response_wrapper( + locations.list, + ) + self.list_continents = to_streamed_response_wrapper( + locations.list_continents, + ) + self.list_countries = to_streamed_response_wrapper( + locations.list_countries, + ) + self.list_regions = to_streamed_response_wrapper( + locations.list_regions, + ) + + +class AsyncLocationsResourceWithStreamingResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: + self._locations = locations + + self.list = async_to_streamed_response_wrapper( + locations.list, + ) + self.list_continents = async_to_streamed_response_wrapper( + locations.list_continents, + ) + self.list_countries = async_to_streamed_response_wrapper( + locations.list_countries, + ) + self.list_regions = async_to_streamed_response_wrapper( + locations.list_regions, + ) diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py new file mode 100644 index 00000000..790f074f --- /dev/null +++ b/src/gcore/resources/dns/metrics.py @@ -0,0 +1,214 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 metric_list_params +from ..._base_client import make_request_options + +__all__ = ["MetricsResource", "AsyncMetricsResource"] + + +class MetricsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> MetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return MetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return MetricsResourceWithStreamingResponse(self) + + def list( + self, + *, + client_ids: Iterable[int] | NotGiven = NOT_GIVEN, + zone_names: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> str: + """ + Example of success response: + + ``` + # HELP `healthcheck_state` The `healthcheck_state` metric reflects the state of a specific monitor after conducting a health check + # TYPE `healthcheck_state` gauge + `healthcheck_state`{`client_id`="1",`monitor_id`="431",`monitor_locations`="us-east-1,us-west-1",`monitor_name`="test-monitor-1",`monitor_type`="http",`rrset_name`="rrset-name1",`rrset_type`="rrset-type1",`zone_name`="zone-name1"} 0 + `healthcheck_state`{`client_id`="1",`monitor_id`="4871",`monitor_locations`="fr-1,fr-2",`monitor_name`="test-monitor-2",`monitor_type`="tcp",`rrset_name`="rrset-name2",`rrset_type`="rrset-type2",`zone_name`="zone-name2"} 1 + `healthcheck_state`{`client_id`="2",`monitor_id`="7123",`monitor_locations`="ua-1,ua-2",`monitor_name`="test-monitor-3",`monitor_type`="icmp",`rrset_name`="rrset-name3",`rrset_type`="rrset-type3",`zone_name`="zone-name3"} 0 + ``` + + Args: + client_ids: Admin and technical user can specify `client_id` to get metrics for particular + client. Ignored for client + + zone_names: Admin and technical user can specify `monitor_id` to get metrics for particular + zone. Ignored for client + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "plain/text", **(extra_headers or {})} + return self._get( + "/dns/v2/monitor/metrics", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "client_ids": client_ids, + "zone_names": zone_names, + }, + metric_list_params.MetricListParams, + ), + ), + cast_to=str, + ) + + +class AsyncMetricsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncMetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncMetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncMetricsResourceWithStreamingResponse(self) + + async def list( + self, + *, + client_ids: Iterable[int] | NotGiven = NOT_GIVEN, + zone_names: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> str: + """ + Example of success response: + + ``` + # HELP `healthcheck_state` The `healthcheck_state` metric reflects the state of a specific monitor after conducting a health check + # TYPE `healthcheck_state` gauge + `healthcheck_state`{`client_id`="1",`monitor_id`="431",`monitor_locations`="us-east-1,us-west-1",`monitor_name`="test-monitor-1",`monitor_type`="http",`rrset_name`="rrset-name1",`rrset_type`="rrset-type1",`zone_name`="zone-name1"} 0 + `healthcheck_state`{`client_id`="1",`monitor_id`="4871",`monitor_locations`="fr-1,fr-2",`monitor_name`="test-monitor-2",`monitor_type`="tcp",`rrset_name`="rrset-name2",`rrset_type`="rrset-type2",`zone_name`="zone-name2"} 1 + `healthcheck_state`{`client_id`="2",`monitor_id`="7123",`monitor_locations`="ua-1,ua-2",`monitor_name`="test-monitor-3",`monitor_type`="icmp",`rrset_name`="rrset-name3",`rrset_type`="rrset-type3",`zone_name`="zone-name3"} 0 + ``` + + Args: + client_ids: Admin and technical user can specify `client_id` to get metrics for particular + client. Ignored for client + + zone_names: Admin and technical user can specify `monitor_id` to get metrics for particular + zone. Ignored for client + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "plain/text", **(extra_headers or {})} + return await self._get( + "/dns/v2/monitor/metrics", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "client_ids": client_ids, + "zone_names": zone_names, + }, + metric_list_params.MetricListParams, + ), + ), + cast_to=str, + ) + + +class MetricsResourceWithRawResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_raw_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithRawResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_raw_response_wrapper( + metrics.list, + ) + + +class MetricsResourceWithStreamingResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_streamed_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithStreamingResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_streamed_response_wrapper( + metrics.list, + ) diff --git a/src/gcore/resources/dns/pickers/__init__.py b/src/gcore/resources/dns/pickers/__init__.py new file mode 100644 index 00000000..27d063d8 --- /dev/null +++ b/src/gcore/resources/dns/pickers/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .pickers import ( + PickersResource, + AsyncPickersResource, + PickersResourceWithRawResponse, + AsyncPickersResourceWithRawResponse, + PickersResourceWithStreamingResponse, + AsyncPickersResourceWithStreamingResponse, +) +from .presets import ( + PresetsResource, + AsyncPresetsResource, + PresetsResourceWithRawResponse, + AsyncPresetsResourceWithRawResponse, + PresetsResourceWithStreamingResponse, + AsyncPresetsResourceWithStreamingResponse, +) + +__all__ = [ + "PresetsResource", + "AsyncPresetsResource", + "PresetsResourceWithRawResponse", + "AsyncPresetsResourceWithRawResponse", + "PresetsResourceWithStreamingResponse", + "AsyncPresetsResourceWithStreamingResponse", + "PickersResource", + "AsyncPickersResource", + "PickersResourceWithRawResponse", + "AsyncPickersResourceWithRawResponse", + "PickersResourceWithStreamingResponse", + "AsyncPickersResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/dns/pickers/pickers.py b/src/gcore/resources/dns/pickers/pickers.py new file mode 100644 index 00000000..3078c7f2 --- /dev/null +++ b/src/gcore/resources/dns/pickers/pickers.py @@ -0,0 +1,167 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .presets import ( + PresetsResource, + AsyncPresetsResource, + PresetsResourceWithRawResponse, + AsyncPresetsResourceWithRawResponse, + PresetsResourceWithStreamingResponse, + AsyncPresetsResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.dns.picker_list_response import PickerListResponse + +__all__ = ["PickersResource", "AsyncPickersResource"] + + +class PickersResource(SyncAPIResource): + @cached_property + def presets(self) -> PresetsResource: + return PresetsResource(self._client) + + @cached_property + def with_raw_response(self) -> PickersResourceWithRawResponse: + """ + 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 PickersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PickersResourceWithStreamingResponse: + """ + 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 PickersResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PickerListResponse: + """Returns list of picker""" + return self._get( + "/dns/v2/pickers", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PickerListResponse, + ) + + +class AsyncPickersResource(AsyncAPIResource): + @cached_property + def presets(self) -> AsyncPresetsResource: + return AsyncPresetsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncPickersResourceWithRawResponse: + """ + 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 AsyncPickersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPickersResourceWithStreamingResponse: + """ + 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 AsyncPickersResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PickerListResponse: + """Returns list of picker""" + return await self._get( + "/dns/v2/pickers", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PickerListResponse, + ) + + +class PickersResourceWithRawResponse: + def __init__(self, pickers: PickersResource) -> None: + self._pickers = pickers + + self.list = to_raw_response_wrapper( + pickers.list, + ) + + @cached_property + def presets(self) -> PresetsResourceWithRawResponse: + return PresetsResourceWithRawResponse(self._pickers.presets) + + +class AsyncPickersResourceWithRawResponse: + def __init__(self, pickers: AsyncPickersResource) -> None: + self._pickers = pickers + + self.list = async_to_raw_response_wrapper( + pickers.list, + ) + + @cached_property + def presets(self) -> AsyncPresetsResourceWithRawResponse: + return AsyncPresetsResourceWithRawResponse(self._pickers.presets) + + +class PickersResourceWithStreamingResponse: + def __init__(self, pickers: PickersResource) -> None: + self._pickers = pickers + + self.list = to_streamed_response_wrapper( + pickers.list, + ) + + @cached_property + def presets(self) -> PresetsResourceWithStreamingResponse: + return PresetsResourceWithStreamingResponse(self._pickers.presets) + + +class AsyncPickersResourceWithStreamingResponse: + def __init__(self, pickers: AsyncPickersResource) -> None: + self._pickers = pickers + + self.list = async_to_streamed_response_wrapper( + pickers.list, + ) + + @cached_property + def presets(self) -> AsyncPresetsResourceWithStreamingResponse: + return AsyncPresetsResourceWithStreamingResponse(self._pickers.presets) diff --git a/src/gcore/resources/dns/pickers/presets.py b/src/gcore/resources/dns/pickers/presets.py new file mode 100644 index 00000000..aebd10ff --- /dev/null +++ b/src/gcore/resources/dns/pickers/presets.py @@ -0,0 +1,135 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.dns.pickers.preset_list_response import PresetListResponse + +__all__ = ["PresetsResource", "AsyncPresetsResource"] + + +class PresetsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PresetsResourceWithRawResponse: + """ + 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 PresetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PresetsResourceWithStreamingResponse: + """ + 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 PresetsResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PresetListResponse: + """Returns list of picker preset""" + return self._get( + "/dns/v2/pickers/presets", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PresetListResponse, + ) + + +class AsyncPresetsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPresetsResourceWithRawResponse: + """ + 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 AsyncPresetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPresetsResourceWithStreamingResponse: + """ + 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 AsyncPresetsResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PresetListResponse: + """Returns list of picker preset""" + return await self._get( + "/dns/v2/pickers/presets", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PresetListResponse, + ) + + +class PresetsResourceWithRawResponse: + def __init__(self, presets: PresetsResource) -> None: + self._presets = presets + + self.list = to_raw_response_wrapper( + presets.list, + ) + + +class AsyncPresetsResourceWithRawResponse: + def __init__(self, presets: AsyncPresetsResource) -> None: + self._presets = presets + + self.list = async_to_raw_response_wrapper( + presets.list, + ) + + +class PresetsResourceWithStreamingResponse: + def __init__(self, presets: PresetsResource) -> None: + self._presets = presets + + self.list = to_streamed_response_wrapper( + presets.list, + ) + + +class AsyncPresetsResourceWithStreamingResponse: + def __init__(self, presets: AsyncPresetsResource) -> None: + self._presets = presets + + self.list = async_to_streamed_response_wrapper( + presets.list, + ) diff --git a/src/gcore/resources/dns/zones/__init__.py b/src/gcore/resources/dns/zones/__init__.py new file mode 100644 index 00000000..056d22ea --- /dev/null +++ b/src/gcore/resources/dns/zones/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .zones import ( + ZonesResource, + AsyncZonesResource, + ZonesResourceWithRawResponse, + AsyncZonesResourceWithRawResponse, + ZonesResourceWithStreamingResponse, + AsyncZonesResourceWithStreamingResponse, +) +from .dnssec import ( + DnssecResource, + AsyncDnssecResource, + DnssecResourceWithRawResponse, + AsyncDnssecResourceWithRawResponse, + DnssecResourceWithStreamingResponse, + AsyncDnssecResourceWithStreamingResponse, +) +from .rrsets import ( + RrsetsResource, + AsyncRrsetsResource, + RrsetsResourceWithRawResponse, + AsyncRrsetsResourceWithRawResponse, + RrsetsResourceWithStreamingResponse, + AsyncRrsetsResourceWithStreamingResponse, +) + +__all__ = [ + "DnssecResource", + "AsyncDnssecResource", + "DnssecResourceWithRawResponse", + "AsyncDnssecResourceWithRawResponse", + "DnssecResourceWithStreamingResponse", + "AsyncDnssecResourceWithStreamingResponse", + "RrsetsResource", + "AsyncRrsetsResource", + "RrsetsResourceWithRawResponse", + "AsyncRrsetsResourceWithRawResponse", + "RrsetsResourceWithStreamingResponse", + "AsyncRrsetsResourceWithStreamingResponse", + "ZonesResource", + "AsyncZonesResource", + "ZonesResourceWithRawResponse", + "AsyncZonesResourceWithRawResponse", + "ZonesResourceWithStreamingResponse", + "AsyncZonesResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/dns/zones/dnssec.py b/src/gcore/resources/dns/zones/dnssec.py new file mode 100644 index 00000000..8c747071 --- /dev/null +++ b/src/gcore/resources/dns/zones/dnssec.py @@ -0,0 +1,248 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.dns.zones import dnssec_update_params +from ....types.dns.zones.dnssec_get_response import DnssecGetResponse +from ....types.dns.zones.dnssec_update_response import DnssecUpdateResponse + +__all__ = ["DnssecResource", "AsyncDnssecResource"] + + +class DnssecResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> DnssecResourceWithRawResponse: + """ + 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 DnssecResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DnssecResourceWithStreamingResponse: + """ + 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 DnssecResourceWithStreamingResponse(self) + + def update( + self, + name: str, + *, + enabled: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DnssecUpdateResponse: + """ + Enable or disable DNSSEC for a DNS zone. + + 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._patch( + f"/dns/v2/zones/{name}/dnssec", + body=maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DnssecUpdateResponse, + ) + + def get( + 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, + ) -> DnssecGetResponse: + """ + Get DNSSEC DS for a DNS zone. + + 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/zones/{name}/dnssec", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DnssecGetResponse, + ) + + +class AsyncDnssecResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncDnssecResourceWithRawResponse: + """ + 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 AsyncDnssecResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDnssecResourceWithStreamingResponse: + """ + 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 AsyncDnssecResourceWithStreamingResponse(self) + + async def update( + self, + name: str, + *, + enabled: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DnssecUpdateResponse: + """ + Enable or disable DNSSEC for a DNS zone. + + 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._patch( + f"/dns/v2/zones/{name}/dnssec", + body=await async_maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DnssecUpdateResponse, + ) + + async def get( + 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, + ) -> DnssecGetResponse: + """ + Get DNSSEC DS for a DNS zone. + + 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/zones/{name}/dnssec", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DnssecGetResponse, + ) + + +class DnssecResourceWithRawResponse: + def __init__(self, dnssec: DnssecResource) -> None: + self._dnssec = dnssec + + self.update = to_raw_response_wrapper( + dnssec.update, + ) + self.get = to_raw_response_wrapper( + dnssec.get, + ) + + +class AsyncDnssecResourceWithRawResponse: + def __init__(self, dnssec: AsyncDnssecResource) -> None: + self._dnssec = dnssec + + self.update = async_to_raw_response_wrapper( + dnssec.update, + ) + self.get = async_to_raw_response_wrapper( + dnssec.get, + ) + + +class DnssecResourceWithStreamingResponse: + def __init__(self, dnssec: DnssecResource) -> None: + self._dnssec = dnssec + + self.update = to_streamed_response_wrapper( + dnssec.update, + ) + self.get = to_streamed_response_wrapper( + dnssec.get, + ) + + +class AsyncDnssecResourceWithStreamingResponse: + def __init__(self, dnssec: AsyncDnssecResource) -> None: + self._dnssec = dnssec + + self.update = async_to_streamed_response_wrapper( + dnssec.update, + ) + self.get = async_to_streamed_response_wrapper( + dnssec.get, + ) diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py new file mode 100644 index 00000000..01bc0728 --- /dev/null +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -0,0 +1,1005 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.dns.zones import ( + rrset_list_params, + rrset_create_params, + rrset_update_params, + rrset_get_failover_logs_params, +) +from ....types.dns.zones.dns_output_rrset import DNSOutputRrset +from ....types.dns.zones.rrset_list_response import RrsetListResponse +from ....types.dns.zones.rrset_get_failover_logs_response import RrsetGetFailoverLogsResponse + +__all__ = ["RrsetsResource", "AsyncRrsetsResource"] + + +class RrsetsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RrsetsResourceWithRawResponse: + """ + 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 RrsetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RrsetsResourceWithStreamingResponse: + """ + 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 RrsetsResourceWithStreamingResponse(self) + + def create( + self, + rrset_type: str, + *, + zone_name: str, + rrset_name: str, + resource_records: Iterable[rrset_create_params.ResourceRecord], + meta: Dict[str, object] | NotGiven = NOT_GIVEN, + pickers: Iterable[rrset_create_params.Picker] | NotGiven = NOT_GIVEN, + ttl: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DNSOutputRrset: + """ + Add the RRSet to the zone specified by zoneName, RRSets can be configured to be + either dynamic or static. + + ### Static RRsets + + Staticly configured RRSets provide DNS responses as is. + + ### Dynamic RRsets + + Dynamic RRSets have picker configuration defined thus it's possible to finely + customize DNS response. Picking rules are defined on the RRSet level as a list + of selectors, filters and mutators. Picker considers different resource records + metadata, requestor IP, and other event-feeds like monitoring. Picker + configuration is an ordered list defined by "pickers" attribute. Requestor IP is + determined by EDNS Client Subnet (ECS) if defined, otherwise - by + client/recursor IP. Selector pickers are used in the specified order until the + first match, in case of match - all next selectors are bypassed. Filters or + mutators are applied to the match according to the order they are specified. For + example, sort records by proximity to user, shuffle based on weights and return + not more than 3: + `"pickers": [ { "type": "geodistance" }, { "type": "`weighted_shuffle`" }, { "type": "`first_n`", "limit": 3 } ]` + + #### geodns filter + + A resource record is included in the answer if resource record's metadata + matches requestor info. For each resource record in RRSet, the following + metadata is considered (in the order specified): + + - `ip` - list of network addresses in CIDR format, e.g. + `["192.168.15.150/25", "2003:de:2016::/48"]`; + - `asn` - list of autonomous system numbers, e.g. `[1234, 5678]`; + - `regions` - list of region codes, e.g. `["de-bw", "de-by"]`; + - `countries` - list of country codes, e.g. `["de", "lu", "lt"]`; + - `continents` - list of continent codes, e.g. + `["af", "an", "eu", "as", "na", "sa", "oc"]`. If there is a record (or + multiple) with metadata matched IP, it's used as a response. If not - asn, + then country and then continent are checked for a match. If there is no match, + then the behaviour is defined by _strict_ parameter of the filter. Example: + `"pickers": [ { "type": "geodns", "strict": true } ]` + + ##### Strict parameter + + `strict: true` means that if no records percolate through the geodns filter it + returns no answers. `strict: false` means that if no records percolate through + the geodns filter, all records are passed over. + + #### asn selector + + Resource records which ASN metadata matches ASN of the requestor are picked by + this selector, and passed to the next non-selector picker, if there is no + match - next configured picker starts with all records. Example: + `"pickers": [ {"type": "asn"} ]` + + #### country selector + + Resource records which country metadata matches country of the requestor are + picked by this selector, and passed to the next non-selector picker, if there is + no match - next configured picker starts with all records. Example: + `"pickers": [ { "type": "country" } ]` + + #### continent selector + + Resource records which continent metadata matches continent of the requestor are + picked by this selector, and passed to the next non-selector picker, if there is + no match - next configured picker starts with all records. Example: + `"pickers": [ { "type": "continent" } ]` + + #### region selector + + Resource records which region metadata matches region of the requestor are + picked by this selector, and passed to the next non-selector picker, if there is + no match - next configured picker starts with all records. e.g. `fr-nor` for + France/Normandy. Example: `"pickers": [ { "type": "region" } ]` + + #### ip selector + + Resource records which IP metadata matches IP of the requestor are picked by + this selector, and passed to the next non-selector picker, if there is no + match - next configured picker starts with all records. Maximum 100 subnets are + allowed to specify in meta of RR. Example: `"pickers": [ { "type": "ip" } ]` + + #### default selector + + When enabled, records marked as default are selected: + `"meta": {"default": true}`. Example: + `"pickers": [ { "type": "geodns", "strict": false }, { "type": "default" }, { "type": "`first_n`", "limit": 2 } ]` + + #### geodistance mutator + + The resource records are rearranged in ascending order based on the distance (in + meters) from requestor to the coordinates specified in latlong metadata. + Distance is calculated using Haversine formula. The "nearest" to the user's IP + RR goes first. The records without latlong metadata come last. e.g. for Berlin + `[52.520008, 13.404954]`.; In this configuration the only "nearest" to the + requestor record to be returned: + `"pickers": [ { "type": "geodistance" }, { "type": "`first_n`", "limit": 1 } ]` + + #### `weighted_shuffle` mutator + + The resource records are rearranged in random order based on the `weight` + metadata. Default weight (if not specified) is 50. Example: + `"pickers": [ { "type": "`weighted_shuffle`" } ]` + + #### `first_n` filter + + Slices first N (N specified as a limit parameter value) resource records. + Example: `"pickers": [ { "type": "`first_n`", "limit": 1 } ]` returns only the + first resource record. + + ##### limit parameter + + Can be a positive value for a specific limit. Use zero or leave it blank to + indicate no limits. + + Args: + resource_records: List of resource record from rrset + + meta: Meta information for rrset + + pickers: Set of pickers + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + if not rrset_name: + raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") + if not rrset_type: + raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") + return self._post( + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + body=maybe_transform( + { + "resource_records": resource_records, + "meta": meta, + "pickers": pickers, + "ttl": ttl, + }, + rrset_create_params.RrsetCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSOutputRrset, + ) + + def update( + self, + rrset_type: str, + *, + zone_name: str, + rrset_name: str, + resource_records: Iterable[rrset_update_params.ResourceRecord], + meta: Dict[str, object] | NotGiven = NOT_GIVEN, + pickers: Iterable[rrset_update_params.Picker] | NotGiven = NOT_GIVEN, + ttl: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DNSOutputRrset: + """ + Create/update RRset. + + Args: + resource_records: List of resource record from rrset + + meta: Meta information for rrset + + pickers: Set of pickers + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + if not rrset_name: + raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") + if not rrset_type: + raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") + return self._put( + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + body=maybe_transform( + { + "resource_records": resource_records, + "meta": meta, + "pickers": pickers, + "ttl": ttl, + }, + rrset_update_params.RrsetUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSOutputRrset, + ) + + def list( + self, + zone_name: str, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: str | NotGiven = NOT_GIVEN, + order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RrsetListResponse: + """ + List of RRset. + + 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 + """ + if not zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + return self._get( + f"/dns/v2/zones/{zone_name}/rrsets", + 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, + }, + rrset_list_params.RrsetListParams, + ), + ), + cast_to=RrsetListResponse, + ) + + def delete( + self, + rrset_type: str, + *, + zone_name: str, + rrset_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, + ) -> object: + """ + Delete RRset. + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + if not rrset_name: + raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") + if not rrset_type: + raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") + return self._delete( + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def get( + self, + rrset_type: str, + *, + zone_name: str, + rrset_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, + ) -> DNSOutputRrset: + """ + Particular RRset item info + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + if not rrset_name: + raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") + if not rrset_type: + raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") + return self._get( + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSOutputRrset, + ) + + def get_failover_logs( + self, + rrset_type: str, + *, + zone_name: str, + rrset_name: str, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RrsetGetFailoverLogsResponse: + """ + Get failover history for the RRset + + Args: + limit: Max number of records in response + + offset: Amount of records to skip before beginning to write in response. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + if not rrset_name: + raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") + if not rrset_type: + raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") + return self._get( + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + 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, + }, + rrset_get_failover_logs_params.RrsetGetFailoverLogsParams, + ), + ), + cast_to=RrsetGetFailoverLogsResponse, + ) + + +class AsyncRrsetsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRrsetsResourceWithRawResponse: + """ + 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 AsyncRrsetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRrsetsResourceWithStreamingResponse: + """ + 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 AsyncRrsetsResourceWithStreamingResponse(self) + + async def create( + self, + rrset_type: str, + *, + zone_name: str, + rrset_name: str, + resource_records: Iterable[rrset_create_params.ResourceRecord], + meta: Dict[str, object] | NotGiven = NOT_GIVEN, + pickers: Iterable[rrset_create_params.Picker] | NotGiven = NOT_GIVEN, + ttl: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DNSOutputRrset: + """ + Add the RRSet to the zone specified by zoneName, RRSets can be configured to be + either dynamic or static. + + ### Static RRsets + + Staticly configured RRSets provide DNS responses as is. + + ### Dynamic RRsets + + Dynamic RRSets have picker configuration defined thus it's possible to finely + customize DNS response. Picking rules are defined on the RRSet level as a list + of selectors, filters and mutators. Picker considers different resource records + metadata, requestor IP, and other event-feeds like monitoring. Picker + configuration is an ordered list defined by "pickers" attribute. Requestor IP is + determined by EDNS Client Subnet (ECS) if defined, otherwise - by + client/recursor IP. Selector pickers are used in the specified order until the + first match, in case of match - all next selectors are bypassed. Filters or + mutators are applied to the match according to the order they are specified. For + example, sort records by proximity to user, shuffle based on weights and return + not more than 3: + `"pickers": [ { "type": "geodistance" }, { "type": "`weighted_shuffle`" }, { "type": "`first_n`", "limit": 3 } ]` + + #### geodns filter + + A resource record is included in the answer if resource record's metadata + matches requestor info. For each resource record in RRSet, the following + metadata is considered (in the order specified): + + - `ip` - list of network addresses in CIDR format, e.g. + `["192.168.15.150/25", "2003:de:2016::/48"]`; + - `asn` - list of autonomous system numbers, e.g. `[1234, 5678]`; + - `regions` - list of region codes, e.g. `["de-bw", "de-by"]`; + - `countries` - list of country codes, e.g. `["de", "lu", "lt"]`; + - `continents` - list of continent codes, e.g. + `["af", "an", "eu", "as", "na", "sa", "oc"]`. If there is a record (or + multiple) with metadata matched IP, it's used as a response. If not - asn, + then country and then continent are checked for a match. If there is no match, + then the behaviour is defined by _strict_ parameter of the filter. Example: + `"pickers": [ { "type": "geodns", "strict": true } ]` + + ##### Strict parameter + + `strict: true` means that if no records percolate through the geodns filter it + returns no answers. `strict: false` means that if no records percolate through + the geodns filter, all records are passed over. + + #### asn selector + + Resource records which ASN metadata matches ASN of the requestor are picked by + this selector, and passed to the next non-selector picker, if there is no + match - next configured picker starts with all records. Example: + `"pickers": [ {"type": "asn"} ]` + + #### country selector + + Resource records which country metadata matches country of the requestor are + picked by this selector, and passed to the next non-selector picker, if there is + no match - next configured picker starts with all records. Example: + `"pickers": [ { "type": "country" } ]` + + #### continent selector + + Resource records which continent metadata matches continent of the requestor are + picked by this selector, and passed to the next non-selector picker, if there is + no match - next configured picker starts with all records. Example: + `"pickers": [ { "type": "continent" } ]` + + #### region selector + + Resource records which region metadata matches region of the requestor are + picked by this selector, and passed to the next non-selector picker, if there is + no match - next configured picker starts with all records. e.g. `fr-nor` for + France/Normandy. Example: `"pickers": [ { "type": "region" } ]` + + #### ip selector + + Resource records which IP metadata matches IP of the requestor are picked by + this selector, and passed to the next non-selector picker, if there is no + match - next configured picker starts with all records. Maximum 100 subnets are + allowed to specify in meta of RR. Example: `"pickers": [ { "type": "ip" } ]` + + #### default selector + + When enabled, records marked as default are selected: + `"meta": {"default": true}`. Example: + `"pickers": [ { "type": "geodns", "strict": false }, { "type": "default" }, { "type": "`first_n`", "limit": 2 } ]` + + #### geodistance mutator + + The resource records are rearranged in ascending order based on the distance (in + meters) from requestor to the coordinates specified in latlong metadata. + Distance is calculated using Haversine formula. The "nearest" to the user's IP + RR goes first. The records without latlong metadata come last. e.g. for Berlin + `[52.520008, 13.404954]`.; In this configuration the only "nearest" to the + requestor record to be returned: + `"pickers": [ { "type": "geodistance" }, { "type": "`first_n`", "limit": 1 } ]` + + #### `weighted_shuffle` mutator + + The resource records are rearranged in random order based on the `weight` + metadata. Default weight (if not specified) is 50. Example: + `"pickers": [ { "type": "`weighted_shuffle`" } ]` + + #### `first_n` filter + + Slices first N (N specified as a limit parameter value) resource records. + Example: `"pickers": [ { "type": "`first_n`", "limit": 1 } ]` returns only the + first resource record. + + ##### limit parameter + + Can be a positive value for a specific limit. Use zero or leave it blank to + indicate no limits. + + Args: + resource_records: List of resource record from rrset + + meta: Meta information for rrset + + pickers: Set of pickers + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + if not rrset_name: + raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") + if not rrset_type: + raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") + return await self._post( + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + body=await async_maybe_transform( + { + "resource_records": resource_records, + "meta": meta, + "pickers": pickers, + "ttl": ttl, + }, + rrset_create_params.RrsetCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSOutputRrset, + ) + + async def update( + self, + rrset_type: str, + *, + zone_name: str, + rrset_name: str, + resource_records: Iterable[rrset_update_params.ResourceRecord], + meta: Dict[str, object] | NotGiven = NOT_GIVEN, + pickers: Iterable[rrset_update_params.Picker] | NotGiven = NOT_GIVEN, + ttl: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DNSOutputRrset: + """ + Create/update RRset. + + Args: + resource_records: List of resource record from rrset + + meta: Meta information for rrset + + pickers: Set of pickers + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + if not rrset_name: + raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") + if not rrset_type: + raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") + return await self._put( + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + body=await async_maybe_transform( + { + "resource_records": resource_records, + "meta": meta, + "pickers": pickers, + "ttl": ttl, + }, + rrset_update_params.RrsetUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSOutputRrset, + ) + + async def list( + self, + zone_name: str, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: str | NotGiven = NOT_GIVEN, + order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RrsetListResponse: + """ + List of RRset. + + 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 + """ + if not zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + return await self._get( + f"/dns/v2/zones/{zone_name}/rrsets", + 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, + }, + rrset_list_params.RrsetListParams, + ), + ), + cast_to=RrsetListResponse, + ) + + async def delete( + self, + rrset_type: str, + *, + zone_name: str, + rrset_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, + ) -> object: + """ + Delete RRset. + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + if not rrset_name: + raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") + if not rrset_type: + raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") + return await self._delete( + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + 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, + rrset_type: str, + *, + zone_name: str, + rrset_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, + ) -> DNSOutputRrset: + """ + Particular RRset item info + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + if not rrset_name: + raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") + if not rrset_type: + raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") + return await self._get( + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSOutputRrset, + ) + + async def get_failover_logs( + self, + rrset_type: str, + *, + zone_name: str, + rrset_name: str, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> RrsetGetFailoverLogsResponse: + """ + Get failover history for the RRset + + Args: + limit: Max number of records in response + + offset: Amount of records to skip before beginning to write in response. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + if not rrset_name: + raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") + if not rrset_type: + raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") + return await self._get( + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + 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, + }, + rrset_get_failover_logs_params.RrsetGetFailoverLogsParams, + ), + ), + cast_to=RrsetGetFailoverLogsResponse, + ) + + +class RrsetsResourceWithRawResponse: + def __init__(self, rrsets: RrsetsResource) -> None: + self._rrsets = rrsets + + self.create = to_raw_response_wrapper( + rrsets.create, + ) + self.update = to_raw_response_wrapper( + rrsets.update, + ) + self.list = to_raw_response_wrapper( + rrsets.list, + ) + self.delete = to_raw_response_wrapper( + rrsets.delete, + ) + self.get = to_raw_response_wrapper( + rrsets.get, + ) + self.get_failover_logs = to_raw_response_wrapper( + rrsets.get_failover_logs, + ) + + +class AsyncRrsetsResourceWithRawResponse: + def __init__(self, rrsets: AsyncRrsetsResource) -> None: + self._rrsets = rrsets + + self.create = async_to_raw_response_wrapper( + rrsets.create, + ) + self.update = async_to_raw_response_wrapper( + rrsets.update, + ) + self.list = async_to_raw_response_wrapper( + rrsets.list, + ) + self.delete = async_to_raw_response_wrapper( + rrsets.delete, + ) + self.get = async_to_raw_response_wrapper( + rrsets.get, + ) + self.get_failover_logs = async_to_raw_response_wrapper( + rrsets.get_failover_logs, + ) + + +class RrsetsResourceWithStreamingResponse: + def __init__(self, rrsets: RrsetsResource) -> None: + self._rrsets = rrsets + + self.create = to_streamed_response_wrapper( + rrsets.create, + ) + self.update = to_streamed_response_wrapper( + rrsets.update, + ) + self.list = to_streamed_response_wrapper( + rrsets.list, + ) + self.delete = to_streamed_response_wrapper( + rrsets.delete, + ) + self.get = to_streamed_response_wrapper( + rrsets.get, + ) + self.get_failover_logs = to_streamed_response_wrapper( + rrsets.get_failover_logs, + ) + + +class AsyncRrsetsResourceWithStreamingResponse: + def __init__(self, rrsets: AsyncRrsetsResource) -> None: + self._rrsets = rrsets + + self.create = async_to_streamed_response_wrapper( + rrsets.create, + ) + self.update = async_to_streamed_response_wrapper( + rrsets.update, + ) + self.list = async_to_streamed_response_wrapper( + rrsets.list, + ) + self.delete = async_to_streamed_response_wrapper( + rrsets.delete, + ) + self.get = async_to_streamed_response_wrapper( + rrsets.get, + ) + self.get_failover_logs = async_to_streamed_response_wrapper( + rrsets.get_failover_logs, + ) diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py new file mode 100644 index 00000000..bdc41acc --- /dev/null +++ b/src/gcore/resources/dns/zones/zones.py @@ -0,0 +1,1493 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Union, Iterable +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from .dnssec import ( + DnssecResource, + AsyncDnssecResource, + DnssecResourceWithRawResponse, + AsyncDnssecResourceWithRawResponse, + DnssecResourceWithStreamingResponse, + AsyncDnssecResourceWithStreamingResponse, +) +from .rrsets import ( + RrsetsResource, + AsyncRrsetsResource, + RrsetsResourceWithRawResponse, + AsyncRrsetsResourceWithRawResponse, + RrsetsResourceWithStreamingResponse, + AsyncRrsetsResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 ( + zone_list_params, + zone_create_params, + zone_import_params, + zone_update_params, + zone_get_statistics_params, +) +from ...._base_client import make_request_options +from ....types.dns.zone_get_response import ZoneGetResponse +from ....types.dns.zone_list_response import ZoneListResponse +from ....types.dns.zone_create_response import ZoneCreateResponse +from ....types.dns.zone_export_response import ZoneExportResponse +from ....types.dns.zone_import_response import ZoneImportResponse +from ....types.dns.zone_get_statistics_response import ZoneGetStatisticsResponse +from ....types.dns.zone_check_delegation_status_response import ZoneCheckDelegationStatusResponse + +__all__ = ["ZonesResource", "AsyncZonesResource"] + + +class ZonesResource(SyncAPIResource): + @cached_property + def dnssec(self) -> DnssecResource: + return DnssecResource(self._client) + + @cached_property + def rrsets(self) -> RrsetsResource: + return RrsetsResource(self._client) + + @cached_property + def with_raw_response(self) -> ZonesResourceWithRawResponse: + """ + 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 ZonesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ZonesResourceWithStreamingResponse: + """ + 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 ZonesResourceWithStreamingResponse(self) + + def create( + self, + *, + name: str, + contact: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expiry: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | NotGiven = NOT_GIVEN, + nx_ttl: int | NotGiven = NOT_GIVEN, + primary_server: str | NotGiven = NOT_GIVEN, + refresh: int | NotGiven = NOT_GIVEN, + retry: int | NotGiven = NOT_GIVEN, + serial: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ZoneCreateResponse: + """ + Add DNS zone. + + Args: + name: name of DNS zone + + contact: email address of the administrator responsible for this zone + + enabled: If a zone is disabled, then its records will not be resolved on dns servers + + expiry: number of seconds after which secondary name servers should stop answering + request for this zone + + meta: arbitrarily data of zone in json format you can specify `webhook` url and + `webhook_method` here webhook will get a map with three arrays: for created, + updated and deleted rrsets `webhook_method` can be omitted, POST will be used by + default + + nx_ttl: Time To Live of cache + + primary_server: primary master name server for zone + + refresh: number of seconds after which secondary name servers should query the master for + the SOA record, to detect zone changes. + + retry: number of seconds after which secondary name servers should retry to request the + serial number + + serial: Serial number for this zone or Timestamp of zone modification moment. If a + secondary name server slaved to this one observes an increase in this number, + the slave will assume that the zone has been updated and initiate a zone + transfer. + + 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/zones", + body=maybe_transform( + { + "name": name, + "contact": contact, + "enabled": enabled, + "expiry": expiry, + "meta": meta, + "nx_ttl": nx_ttl, + "primary_server": primary_server, + "refresh": refresh, + "retry": retry, + "serial": serial, + }, + zone_create_params.ZoneCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ZoneCreateResponse, + ) + + def update( + self, + path_name: str, + *, + body_name: str, + contact: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expiry: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | NotGiven = NOT_GIVEN, + nx_ttl: int | NotGiven = NOT_GIVEN, + primary_server: str | NotGiven = NOT_GIVEN, + refresh: int | NotGiven = NOT_GIVEN, + retry: int | NotGiven = NOT_GIVEN, + serial: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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 DNS zone and SOA record. + + Args: + body_name: name of DNS zone + + contact: email address of the administrator responsible for this zone + + enabled: If a zone is disabled, then its records will not be resolved on dns servers + + expiry: number of seconds after which secondary name servers should stop answering + request for this zone + + meta: arbitrarily data of zone in json format you can specify `webhook` url and + `webhook_method` here webhook will get a map with three arrays: for created, + updated and deleted rrsets `webhook_method` can be omitted, POST will be used by + default + + nx_ttl: Time To Live of cache + + primary_server: primary master name server for zone + + refresh: number of seconds after which secondary name servers should query the master for + the SOA record, to detect zone changes. + + retry: number of seconds after which secondary name servers should retry to request the + serial number + + serial: Serial number for this zone or Timestamp of zone modification moment. If a + secondary name server slaved to this one observes an increase in this number, + the slave will assume that the zone has been updated and initiate a zone + transfer. + + 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 path_name: + raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") + return self._put( + f"/dns/v2/zones/{path_name}", + body=maybe_transform( + { + "body_name": body_name, + "contact": contact, + "enabled": enabled, + "expiry": expiry, + "meta": meta, + "nx_ttl": nx_ttl, + "primary_server": primary_server, + "refresh": refresh, + "retry": retry, + "serial": serial, + }, + zone_update_params.ZoneUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def list( + self, + *, + id: Iterable[int] | NotGiven = NOT_GIVEN, + case_sensitive: bool | NotGiven = NOT_GIVEN, + client_id: Iterable[int] | NotGiven = NOT_GIVEN, + dynamic: bool | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + exact_match: bool | NotGiven = NOT_GIVEN, + healthcheck: bool | NotGiven = NOT_GIVEN, + iam_reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: str | NotGiven = NOT_GIVEN, + order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, + status: str | NotGiven = NOT_GIVEN, + updated_at_from: Union[str, datetime] | NotGiven = NOT_GIVEN, + updated_at_to: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ZoneListResponse: + """Show created zones with pagination managed by limit and offset params. + + All query + params are optional. + + Args: + id: to pass several ids `id=1&id=3&id=5...` + + client_id: to pass several `client_ids` `client_id=1&`client_id`=3&`client_id`=5...` + + dynamic: Zones with dynamic RRsets + + healthcheck: Zones with RRsets that have healthchecks + + limit: Max number of records in response + + name: to pass several names `name=first&name=second...` + + 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/zones", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "case_sensitive": case_sensitive, + "client_id": client_id, + "dynamic": dynamic, + "enabled": enabled, + "exact_match": exact_match, + "healthcheck": healthcheck, + "iam_reseller_id": iam_reseller_id, + "limit": limit, + "name": name, + "offset": offset, + "order_by": order_by, + "order_direction": order_direction, + "reseller_id": reseller_id, + "status": status, + "updated_at_from": updated_at_from, + "updated_at_to": updated_at_to, + }, + zone_list_params.ZoneListParams, + ), + ), + cast_to=ZoneListResponse, + ) + + def delete( + 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, + ) -> object: + """ + Delete DNS zone and its records and raws. + + 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._delete( + f"/dns/v2/zones/{name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def check_delegation_status( + 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, + ) -> ZoneCheckDelegationStatusResponse: + """Returns delegation status for specified domain name. + + This endpoint has rate + limit. + + 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._post( + f"/dns/v2/analyze/{name}/delegation-status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ZoneCheckDelegationStatusResponse, + ) + + def disable( + 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, + ) -> object: + """ + Disable DNS zone. + + 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._patch( + f"/dns/v2/zones/{name}/disable", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def enable( + 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, + ) -> object: + """ + Enable DNS zone. + + 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._patch( + f"/dns/v2/zones/{name}/enable", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + def export( + self, + zone_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, + ) -> ZoneExportResponse: + """ + Export zone to bind9 format. + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + return self._get( + f"/dns/v2/zones/{zone_name}/export", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ZoneExportResponse, + ) + + def get( + 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, + ) -> ZoneGetResponse: + """ + Zone info by zone name. + + 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/zones/{name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ZoneGetResponse, + ) + + def get_statistics( + self, + name: str, + *, + from_: int | NotGiven = NOT_GIVEN, + granularity: str | NotGiven = NOT_GIVEN, + record_type: str | NotGiven = NOT_GIVEN, + to: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ZoneGetStatisticsResponse: + """Statistics of DNS zone in common and by record types. + + To get summary statistics + for all zones use `all` instead of zone name in path. Note: Consumption + statistics is updated in near real-time as a standard practice. However, the + frequency of updates can vary, but they are typically available within a 30 + minutes period. Exceptions, such as maintenance periods, may delay data beyond + 30 minutes until servers resume and backfill missing statistics. + + Args: + from_: + Beginning of the requested time period (Unix Timestamp, UTC.) In a query string: + &from=1709068637 + + granularity: Granularity parameter string is a sequence of decimal numbers, each with + optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid + time units are "s", "m", "h". + + record_type: + DNS record type. Possible values: + + - A + - AAAA + - NS + - CNAME + - MX + - TXT + - SVCB + - HTTPS + + to: + End of the requested time period (Unix Timestamp, UTC.) In a query string: + &to=1709673437 + + 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/zones/{name}/statistics", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "granularity": granularity, + "record_type": record_type, + "to": to, + }, + zone_get_statistics_params.ZoneGetStatisticsParams, + ), + ), + cast_to=ZoneGetStatisticsResponse, + ) + + def import_( + self, + zone_name: str, + *, + body: object | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ZoneImportResponse: + """Import zone in bind9 format. + + Args: + body: Read reads up to len(p) bytes into p. + + It returns the number of bytes read (0 <= + n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may + use all of p as scratch space during the call. If some data is available but not + len(p) bytes, Read conventionally returns what is available instead of waiting + for more. When Read encounters an error or end-of-file condition after + successfully reading n > 0 bytes, it returns the number of bytes read. It may + return the (non-nil) error from the same call or return the error (and n == 0) + from a subsequent call. An instance of this general case is that a Reader + returning a non-zero number of bytes at the end of the input stream may return + either err == EOF or err == nil. The next Read should return 0, EOF. Callers + should always process the n > 0 bytes returned before considering the error err. + Doing so correctly handles I/O errors that happen after reading some bytes and + also both of the allowed EOF behaviors. If len(p) == 0, Read should always + return n == 0. It may return a non-nil error if some error condition is known, + such as EOF. Implementations of Read are discouraged from returning a zero byte + count with a nil error, except when len(p) == 0. Callers should treat a return + of 0 and nil as indicating that nothing happened; in particular it does not + indicate EOF. Implementations must not retain p. + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + return self._post( + f"/dns/v2/zones/{zone_name}/import", + body=maybe_transform(body, zone_import_params.ZoneImportParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ZoneImportResponse, + ) + + +class AsyncZonesResource(AsyncAPIResource): + @cached_property + def dnssec(self) -> AsyncDnssecResource: + return AsyncDnssecResource(self._client) + + @cached_property + def rrsets(self) -> AsyncRrsetsResource: + return AsyncRrsetsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncZonesResourceWithRawResponse: + """ + 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 AsyncZonesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncZonesResourceWithStreamingResponse: + """ + 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 AsyncZonesResourceWithStreamingResponse(self) + + async def create( + self, + *, + name: str, + contact: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expiry: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | NotGiven = NOT_GIVEN, + nx_ttl: int | NotGiven = NOT_GIVEN, + primary_server: str | NotGiven = NOT_GIVEN, + refresh: int | NotGiven = NOT_GIVEN, + retry: int | NotGiven = NOT_GIVEN, + serial: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ZoneCreateResponse: + """ + Add DNS zone. + + Args: + name: name of DNS zone + + contact: email address of the administrator responsible for this zone + + enabled: If a zone is disabled, then its records will not be resolved on dns servers + + expiry: number of seconds after which secondary name servers should stop answering + request for this zone + + meta: arbitrarily data of zone in json format you can specify `webhook` url and + `webhook_method` here webhook will get a map with three arrays: for created, + updated and deleted rrsets `webhook_method` can be omitted, POST will be used by + default + + nx_ttl: Time To Live of cache + + primary_server: primary master name server for zone + + refresh: number of seconds after which secondary name servers should query the master for + the SOA record, to detect zone changes. + + retry: number of seconds after which secondary name servers should retry to request the + serial number + + serial: Serial number for this zone or Timestamp of zone modification moment. If a + secondary name server slaved to this one observes an increase in this number, + the slave will assume that the zone has been updated and initiate a zone + transfer. + + 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/zones", + body=await async_maybe_transform( + { + "name": name, + "contact": contact, + "enabled": enabled, + "expiry": expiry, + "meta": meta, + "nx_ttl": nx_ttl, + "primary_server": primary_server, + "refresh": refresh, + "retry": retry, + "serial": serial, + }, + zone_create_params.ZoneCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ZoneCreateResponse, + ) + + async def update( + self, + path_name: str, + *, + body_name: str, + contact: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expiry: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | NotGiven = NOT_GIVEN, + nx_ttl: int | NotGiven = NOT_GIVEN, + primary_server: str | NotGiven = NOT_GIVEN, + refresh: int | NotGiven = NOT_GIVEN, + retry: int | NotGiven = NOT_GIVEN, + serial: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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 DNS zone and SOA record. + + Args: + body_name: name of DNS zone + + contact: email address of the administrator responsible for this zone + + enabled: If a zone is disabled, then its records will not be resolved on dns servers + + expiry: number of seconds after which secondary name servers should stop answering + request for this zone + + meta: arbitrarily data of zone in json format you can specify `webhook` url and + `webhook_method` here webhook will get a map with three arrays: for created, + updated and deleted rrsets `webhook_method` can be omitted, POST will be used by + default + + nx_ttl: Time To Live of cache + + primary_server: primary master name server for zone + + refresh: number of seconds after which secondary name servers should query the master for + the SOA record, to detect zone changes. + + retry: number of seconds after which secondary name servers should retry to request the + serial number + + serial: Serial number for this zone or Timestamp of zone modification moment. If a + secondary name server slaved to this one observes an increase in this number, + the slave will assume that the zone has been updated and initiate a zone + transfer. + + 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 path_name: + raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") + return await self._put( + f"/dns/v2/zones/{path_name}", + body=await async_maybe_transform( + { + "body_name": body_name, + "contact": contact, + "enabled": enabled, + "expiry": expiry, + "meta": meta, + "nx_ttl": nx_ttl, + "primary_server": primary_server, + "refresh": refresh, + "retry": retry, + "serial": serial, + }, + zone_update_params.ZoneUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def list( + self, + *, + id: Iterable[int] | NotGiven = NOT_GIVEN, + case_sensitive: bool | NotGiven = NOT_GIVEN, + client_id: Iterable[int] | NotGiven = NOT_GIVEN, + dynamic: bool | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + exact_match: bool | NotGiven = NOT_GIVEN, + healthcheck: bool | NotGiven = NOT_GIVEN, + iam_reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: str | NotGiven = NOT_GIVEN, + order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, + status: str | NotGiven = NOT_GIVEN, + updated_at_from: Union[str, datetime] | NotGiven = NOT_GIVEN, + updated_at_to: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ZoneListResponse: + """Show created zones with pagination managed by limit and offset params. + + All query + params are optional. + + Args: + id: to pass several ids `id=1&id=3&id=5...` + + client_id: to pass several `client_ids` `client_id=1&`client_id`=3&`client_id`=5...` + + dynamic: Zones with dynamic RRsets + + healthcheck: Zones with RRsets that have healthchecks + + limit: Max number of records in response + + name: to pass several names `name=first&name=second...` + + 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/zones", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "id": id, + "case_sensitive": case_sensitive, + "client_id": client_id, + "dynamic": dynamic, + "enabled": enabled, + "exact_match": exact_match, + "healthcheck": healthcheck, + "iam_reseller_id": iam_reseller_id, + "limit": limit, + "name": name, + "offset": offset, + "order_by": order_by, + "order_direction": order_direction, + "reseller_id": reseller_id, + "status": status, + "updated_at_from": updated_at_from, + "updated_at_to": updated_at_to, + }, + zone_list_params.ZoneListParams, + ), + ), + cast_to=ZoneListResponse, + ) + + async def delete( + 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, + ) -> object: + """ + Delete DNS zone and its records and raws. + + 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._delete( + f"/dns/v2/zones/{name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def check_delegation_status( + 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, + ) -> ZoneCheckDelegationStatusResponse: + """Returns delegation status for specified domain name. + + This endpoint has rate + limit. + + 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._post( + f"/dns/v2/analyze/{name}/delegation-status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ZoneCheckDelegationStatusResponse, + ) + + async def disable( + 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, + ) -> object: + """ + Disable DNS zone. + + 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._patch( + f"/dns/v2/zones/{name}/disable", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def enable( + 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, + ) -> object: + """ + Enable DNS zone. + + 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._patch( + f"/dns/v2/zones/{name}/enable", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + async def export( + self, + zone_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, + ) -> ZoneExportResponse: + """ + Export zone to bind9 format. + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + return await self._get( + f"/dns/v2/zones/{zone_name}/export", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ZoneExportResponse, + ) + + async def get( + 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, + ) -> ZoneGetResponse: + """ + Zone info by zone name. + + 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/zones/{name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ZoneGetResponse, + ) + + async def get_statistics( + self, + name: str, + *, + from_: int | NotGiven = NOT_GIVEN, + granularity: str | NotGiven = NOT_GIVEN, + record_type: str | NotGiven = NOT_GIVEN, + to: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ZoneGetStatisticsResponse: + """Statistics of DNS zone in common and by record types. + + To get summary statistics + for all zones use `all` instead of zone name in path. Note: Consumption + statistics is updated in near real-time as a standard practice. However, the + frequency of updates can vary, but they are typically available within a 30 + minutes period. Exceptions, such as maintenance periods, may delay data beyond + 30 minutes until servers resume and backfill missing statistics. + + Args: + from_: + Beginning of the requested time period (Unix Timestamp, UTC.) In a query string: + &from=1709068637 + + granularity: Granularity parameter string is a sequence of decimal numbers, each with + optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid + time units are "s", "m", "h". + + record_type: + DNS record type. Possible values: + + - A + - AAAA + - NS + - CNAME + - MX + - TXT + - SVCB + - HTTPS + + to: + End of the requested time period (Unix Timestamp, UTC.) In a query string: + &to=1709673437 + + 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/zones/{name}/statistics", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "granularity": granularity, + "record_type": record_type, + "to": to, + }, + zone_get_statistics_params.ZoneGetStatisticsParams, + ), + ), + cast_to=ZoneGetStatisticsResponse, + ) + + async def import_( + self, + zone_name: str, + *, + body: object | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ZoneImportResponse: + """Import zone in bind9 format. + + Args: + body: Read reads up to len(p) bytes into p. + + It returns the number of bytes read (0 <= + n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may + use all of p as scratch space during the call. If some data is available but not + len(p) bytes, Read conventionally returns what is available instead of waiting + for more. When Read encounters an error or end-of-file condition after + successfully reading n > 0 bytes, it returns the number of bytes read. It may + return the (non-nil) error from the same call or return the error (and n == 0) + from a subsequent call. An instance of this general case is that a Reader + returning a non-zero number of bytes at the end of the input stream may return + either err == EOF or err == nil. The next Read should return 0, EOF. Callers + should always process the n > 0 bytes returned before considering the error err. + Doing so correctly handles I/O errors that happen after reading some bytes and + also both of the allowed EOF behaviors. If len(p) == 0, Read should always + return n == 0. It may return a non-nil error if some error condition is known, + such as EOF. Implementations of Read are discouraged from returning a zero byte + count with a nil error, except when len(p) == 0. Callers should treat a return + of 0 and nil as indicating that nothing happened; in particular it does not + indicate EOF. Implementations must not retain p. + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + return await self._post( + f"/dns/v2/zones/{zone_name}/import", + body=await async_maybe_transform(body, zone_import_params.ZoneImportParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ZoneImportResponse, + ) + + +class ZonesResourceWithRawResponse: + def __init__(self, zones: ZonesResource) -> None: + self._zones = zones + + self.create = to_raw_response_wrapper( + zones.create, + ) + self.update = to_raw_response_wrapper( + zones.update, + ) + self.list = to_raw_response_wrapper( + zones.list, + ) + self.delete = to_raw_response_wrapper( + zones.delete, + ) + self.check_delegation_status = to_raw_response_wrapper( + zones.check_delegation_status, + ) + self.disable = to_raw_response_wrapper( + zones.disable, + ) + self.enable = to_raw_response_wrapper( + zones.enable, + ) + self.export = to_raw_response_wrapper( + zones.export, + ) + self.get = to_raw_response_wrapper( + zones.get, + ) + self.get_statistics = to_raw_response_wrapper( + zones.get_statistics, + ) + self.import_ = to_raw_response_wrapper( + zones.import_, + ) + + @cached_property + def dnssec(self) -> DnssecResourceWithRawResponse: + return DnssecResourceWithRawResponse(self._zones.dnssec) + + @cached_property + def rrsets(self) -> RrsetsResourceWithRawResponse: + return RrsetsResourceWithRawResponse(self._zones.rrsets) + + +class AsyncZonesResourceWithRawResponse: + def __init__(self, zones: AsyncZonesResource) -> None: + self._zones = zones + + self.create = async_to_raw_response_wrapper( + zones.create, + ) + self.update = async_to_raw_response_wrapper( + zones.update, + ) + self.list = async_to_raw_response_wrapper( + zones.list, + ) + self.delete = async_to_raw_response_wrapper( + zones.delete, + ) + self.check_delegation_status = async_to_raw_response_wrapper( + zones.check_delegation_status, + ) + self.disable = async_to_raw_response_wrapper( + zones.disable, + ) + self.enable = async_to_raw_response_wrapper( + zones.enable, + ) + self.export = async_to_raw_response_wrapper( + zones.export, + ) + self.get = async_to_raw_response_wrapper( + zones.get, + ) + self.get_statistics = async_to_raw_response_wrapper( + zones.get_statistics, + ) + self.import_ = async_to_raw_response_wrapper( + zones.import_, + ) + + @cached_property + def dnssec(self) -> AsyncDnssecResourceWithRawResponse: + return AsyncDnssecResourceWithRawResponse(self._zones.dnssec) + + @cached_property + def rrsets(self) -> AsyncRrsetsResourceWithRawResponse: + return AsyncRrsetsResourceWithRawResponse(self._zones.rrsets) + + +class ZonesResourceWithStreamingResponse: + def __init__(self, zones: ZonesResource) -> None: + self._zones = zones + + self.create = to_streamed_response_wrapper( + zones.create, + ) + self.update = to_streamed_response_wrapper( + zones.update, + ) + self.list = to_streamed_response_wrapper( + zones.list, + ) + self.delete = to_streamed_response_wrapper( + zones.delete, + ) + self.check_delegation_status = to_streamed_response_wrapper( + zones.check_delegation_status, + ) + self.disable = to_streamed_response_wrapper( + zones.disable, + ) + self.enable = to_streamed_response_wrapper( + zones.enable, + ) + self.export = to_streamed_response_wrapper( + zones.export, + ) + self.get = to_streamed_response_wrapper( + zones.get, + ) + self.get_statistics = to_streamed_response_wrapper( + zones.get_statistics, + ) + self.import_ = to_streamed_response_wrapper( + zones.import_, + ) + + @cached_property + def dnssec(self) -> DnssecResourceWithStreamingResponse: + return DnssecResourceWithStreamingResponse(self._zones.dnssec) + + @cached_property + def rrsets(self) -> RrsetsResourceWithStreamingResponse: + return RrsetsResourceWithStreamingResponse(self._zones.rrsets) + + +class AsyncZonesResourceWithStreamingResponse: + def __init__(self, zones: AsyncZonesResource) -> None: + self._zones = zones + + self.create = async_to_streamed_response_wrapper( + zones.create, + ) + self.update = async_to_streamed_response_wrapper( + zones.update, + ) + self.list = async_to_streamed_response_wrapper( + zones.list, + ) + self.delete = async_to_streamed_response_wrapper( + zones.delete, + ) + self.check_delegation_status = async_to_streamed_response_wrapper( + zones.check_delegation_status, + ) + self.disable = async_to_streamed_response_wrapper( + zones.disable, + ) + self.enable = async_to_streamed_response_wrapper( + zones.enable, + ) + self.export = async_to_streamed_response_wrapper( + zones.export, + ) + self.get = async_to_streamed_response_wrapper( + zones.get, + ) + self.get_statistics = async_to_streamed_response_wrapper( + zones.get_statistics, + ) + self.import_ = async_to_streamed_response_wrapper( + zones.import_, + ) + + @cached_property + def dnssec(self) -> AsyncDnssecResourceWithStreamingResponse: + return AsyncDnssecResourceWithStreamingResponse(self._zones.dnssec) + + @cached_property + def rrsets(self) -> AsyncRrsetsResourceWithStreamingResponse: + return AsyncRrsetsResourceWithStreamingResponse(self._zones.rrsets) diff --git a/src/gcore/types/dns/__init__.py b/src/gcore/types/dns/__init__.py new file mode 100644 index 00000000..86e0f4f8 --- /dev/null +++ b/src/gcore/types/dns/__init__.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .dns_label_name import DNSLabelName as DNSLabelName +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 .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 .zone_update_params import ZoneUpdateParams as ZoneUpdateParams +from .dns_lookup_response import DNSLookupResponse as DNSLookupResponse +from .metric_list_response import MetricListResponse as MetricListResponse +from .picker_list_response import PickerListResponse as PickerListResponse +from .zone_create_response import ZoneCreateResponse as ZoneCreateResponse +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_location_translations import DNSLocationTranslations as DNSLocationTranslations +from .zone_get_statistics_params import ZoneGetStatisticsParams as ZoneGetStatisticsParams +from .zone_get_statistics_response import ZoneGetStatisticsResponse as ZoneGetStatisticsResponse +from .location_list_regions_response import LocationListRegionsResponse as LocationListRegionsResponse +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 +from .zone_check_delegation_status_response import ( + ZoneCheckDelegationStatusResponse as ZoneCheckDelegationStatusResponse, +) diff --git a/src/gcore/types/dns/dns_get_account_overview_response.py b/src/gcore/types/dns/dns_get_account_overview_response.py new file mode 100644 index 00000000..35e11fef --- /dev/null +++ b/src/gcore/types/dns/dns_get_account_overview_response.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["DNSGetAccountOverviewResponse", "Client", "Settings"] + + +class Client(BaseModel): + client_id: Optional[int] = None + + enabled: Optional[bool] = None + + reseller: Optional[int] = None + + status: Optional[str] = None + + tariff_id: Optional[int] = None + + tariff_name: Optional[str] = None + """TariffName""" + + +class Settings(BaseModel): + contact: Optional[str] = None + + name_server_1: Optional[str] = None + + name_server_2: Optional[str] = None + + +class DNSGetAccountOverviewResponse(BaseModel): + client: Optional[Client] = FieldInfo(alias="Client", default=None) + """Client""" + + settings: Optional[Settings] = None diff --git a/src/gcore/types/dns/dns_label_name.py b/src/gcore/types/dns/dns_label_name.py new file mode 100644 index 00000000..39d3d6be --- /dev/null +++ b/src/gcore/types/dns/dns_label_name.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["DNSLabelName"] + + +class DNSLabelName(BaseModel): + label: Optional[str] = None + + name: Optional[str] = None diff --git a/src/gcore/types/dns/dns_location_translations.py b/src/gcore/types/dns/dns_location_translations.py new file mode 100644 index 00000000..39548849 --- /dev/null +++ b/src/gcore/types/dns/dns_location_translations.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from ..._models import BaseModel + +__all__ = ["DNSLocationTranslations"] + + +class DNSLocationTranslations(BaseModel): + names: Optional[Dict[str, str]] = None diff --git a/src/gcore/types/dns/dns_lookup_params.py b/src/gcore/types/dns/dns_lookup_params.py new file mode 100644 index 00000000..69e0e8ad --- /dev/null +++ b/src/gcore/types/dns/dns_lookup_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["DNSLookupParams"] + + +class DNSLookupParams(TypedDict, total=False): + name: str + """Domain name""" + + request_server: Literal["authoritative_dns", "google", "cloudflare", "open_dns", "quad9", "gcore"] + """Server that will be used as resolver""" diff --git a/src/gcore/types/dns/dns_lookup_response.py b/src/gcore/types/dns/dns_lookup_response.py new file mode 100644 index 00000000..f6c13c57 --- /dev/null +++ b/src/gcore/types/dns/dns_lookup_response.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["DNSLookupResponse", "DNSLookupResponseItem"] + + +class DNSLookupResponseItem(BaseModel): + content: Optional[List[str]] = None + + name: Optional[str] = None + + ttl: Optional[int] = None + + type: Optional[str] = None + + +DNSLookupResponse: TypeAlias = List[DNSLookupResponseItem] diff --git a/src/gcore/types/dns/dns_name_server.py b/src/gcore/types/dns/dns_name_server.py new file mode 100644 index 00000000..619c4943 --- /dev/null +++ b/src/gcore/types/dns/dns_name_server.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["DNSNameServer"] + + +class DNSNameServer(BaseModel): + ipv4_addresses: Optional[List[str]] = FieldInfo(alias="ipv4Addresses", default=None) + + ipv6_addresses: Optional[List[str]] = FieldInfo(alias="ipv6Addresses", default=None) + + name: Optional[str] = None diff --git a/src/gcore/types/dns/location_list_continents_response.py b/src/gcore/types/dns/location_list_continents_response.py new file mode 100644 index 00000000..09e5397e --- /dev/null +++ b/src/gcore/types/dns/location_list_continents_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +from .dns_location_translations import DNSLocationTranslations + +__all__ = ["LocationListContinentsResponse"] + +LocationListContinentsResponse: TypeAlias = Dict[str, DNSLocationTranslations] diff --git a/src/gcore/types/dns/location_list_countries_response.py b/src/gcore/types/dns/location_list_countries_response.py new file mode 100644 index 00000000..4ea48d98 --- /dev/null +++ b/src/gcore/types/dns/location_list_countries_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +from .dns_location_translations import DNSLocationTranslations + +__all__ = ["LocationListCountriesResponse"] + +LocationListCountriesResponse: TypeAlias = Dict[str, DNSLocationTranslations] diff --git a/src/gcore/types/dns/location_list_regions_response.py b/src/gcore/types/dns/location_list_regions_response.py new file mode 100644 index 00000000..b6f68a7b --- /dev/null +++ b/src/gcore/types/dns/location_list_regions_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +from .dns_location_translations import DNSLocationTranslations + +__all__ = ["LocationListRegionsResponse"] + +LocationListRegionsResponse: TypeAlias = Dict[str, DNSLocationTranslations] diff --git a/src/gcore/types/dns/location_list_response.py b/src/gcore/types/dns/location_list_response.py new file mode 100644 index 00000000..d76f5f7e --- /dev/null +++ b/src/gcore/types/dns/location_list_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from ..._models import BaseModel +from .dns_location_translations import DNSLocationTranslations + +__all__ = ["LocationListResponse"] + + +class LocationListResponse(BaseModel): + continents: Optional[Dict[str, DNSLocationTranslations]] = None + + countries: Optional[Dict[str, DNSLocationTranslations]] = None + + regions: Optional[Dict[str, DNSLocationTranslations]] = None diff --git a/src/gcore/types/dns/metric_list_params.py b/src/gcore/types/dns/metric_list_params.py new file mode 100644 index 00000000..d6c0f850 --- /dev/null +++ b/src/gcore/types/dns/metric_list_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import TypedDict + +__all__ = ["MetricListParams"] + + +class MetricListParams(TypedDict, total=False): + client_ids: Iterable[int] + """ + Admin and technical user can specify `client_id` to get metrics for particular + client. Ignored for client + """ + + zone_names: List[str] + """ + Admin and technical user can specify `monitor_id` to get metrics for particular + zone. Ignored for client + """ diff --git a/src/gcore/types/dns/metric_list_response.py b/src/gcore/types/dns/metric_list_response.py new file mode 100644 index 00000000..54fa0de0 --- /dev/null +++ b/src/gcore/types/dns/metric_list_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["MetricListResponse"] + +MetricListResponse: TypeAlias = str diff --git a/src/gcore/types/dns/picker_list_response.py b/src/gcore/types/dns/picker_list_response.py new file mode 100644 index 00000000..99a3ab8d --- /dev/null +++ b/src/gcore/types/dns/picker_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .dns_label_name import DNSLabelName + +__all__ = ["PickerListResponse"] + +PickerListResponse: TypeAlias = List[DNSLabelName] diff --git a/src/gcore/types/dns/pickers/__init__.py b/src/gcore/types/dns/pickers/__init__.py new file mode 100644 index 00000000..1041654d --- /dev/null +++ b/src/gcore/types/dns/pickers/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .preset_list_response import PresetListResponse as PresetListResponse diff --git a/src/gcore/types/dns/pickers/preset_list_response.py b/src/gcore/types/dns/pickers/preset_list_response.py new file mode 100644 index 00000000..47ea0e01 --- /dev/null +++ b/src/gcore/types/dns/pickers/preset_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List +from typing_extensions import TypeAlias + +from ..dns_label_name import DNSLabelName + +__all__ = ["PresetListResponse"] + +PresetListResponse: TypeAlias = Dict[str, List[DNSLabelName]] diff --git a/src/gcore/types/dns/zone_check_delegation_status_response.py b/src/gcore/types/dns/zone_check_delegation_status_response.py new file mode 100644 index 00000000..ae89139a --- /dev/null +++ b/src/gcore/types/dns/zone_check_delegation_status_response.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .dns_name_server import DNSNameServer + +__all__ = ["ZoneCheckDelegationStatusResponse"] + + +class ZoneCheckDelegationStatusResponse(BaseModel): + authoritative_name_servers: Optional[List[DNSNameServer]] = None + + gcore_authorized_count: Optional[int] = None + + is_whitelabel_delegation: Optional[bool] = None + + non_gcore_authorized_count: Optional[int] = None + + zone_exists: Optional[bool] = None diff --git a/src/gcore/types/dns/zone_create_params.py b/src/gcore/types/dns/zone_create_params.py new file mode 100644 index 00000000..893ee168 --- /dev/null +++ b/src/gcore/types/dns/zone_create_params.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import Required, TypedDict + +__all__ = ["ZoneCreateParams"] + + +class ZoneCreateParams(TypedDict, total=False): + name: Required[str] + """name of DNS zone""" + + contact: str + """email address of the administrator responsible for this zone""" + + enabled: bool + """If a zone is disabled, then its records will not be resolved on dns servers""" + + expiry: int + """ + number of seconds after which secondary name servers should stop answering + request for this zone + """ + + meta: Dict[str, object] + """ + arbitrarily data of zone in json format you can specify `webhook` url and + `webhook_method` here webhook will get a map with three arrays: for created, + updated and deleted rrsets `webhook_method` can be omitted, POST will be used by + default + """ + + nx_ttl: int + """Time To Live of cache""" + + primary_server: str + """primary master name server for zone""" + + refresh: int + """ + number of seconds after which secondary name servers should query the master for + the SOA record, to detect zone changes. + """ + + retry: int + """ + number of seconds after which secondary name servers should retry to request the + serial number + """ + + serial: int + """ + Serial number for this zone or Timestamp of zone modification moment. If a + secondary name server slaved to this one observes an increase in this number, + the slave will assume that the zone has been updated and initiate a zone + transfer. + """ diff --git a/src/gcore/types/dns/zone_create_response.py b/src/gcore/types/dns/zone_create_response.py new file mode 100644 index 00000000..24191c26 --- /dev/null +++ b/src/gcore/types/dns/zone_create_response.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["ZoneCreateResponse"] + + +class ZoneCreateResponse(BaseModel): + id: Optional[int] = None + + warnings: Optional[List[str]] = None diff --git a/src/gcore/types/dns/zone_export_response.py b/src/gcore/types/dns/zone_export_response.py new file mode 100644 index 00000000..89ec6d3e --- /dev/null +++ b/src/gcore/types/dns/zone_export_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__ = ["ZoneExportResponse"] + + +class ZoneExportResponse(BaseModel): + raw_zone: Optional[str] = None diff --git a/src/gcore/types/dns/zone_get_response.py b/src/gcore/types/dns/zone_get_response.py new file mode 100644 index 00000000..1f43e8ca --- /dev/null +++ b/src/gcore/types/dns/zone_get_response.py @@ -0,0 +1,104 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["ZoneGetResponse", "Zone", "ZoneRecord", "ZoneRrsetsAmount", "ZoneRrsetsAmountDynamic"] + + +class ZoneRecord(BaseModel): + name: Optional[str] = None + + short_answers: Optional[List[str]] = None + + ttl: Optional[int] = None + + type: Optional[str] = None + + +class ZoneRrsetsAmountDynamic(BaseModel): + healthcheck: Optional[int] = None + """Amount of RRsets with enabled healthchecks""" + + total: Optional[int] = None + """Total amount of dynamic RRsets in zone""" + + +class ZoneRrsetsAmount(BaseModel): + dynamic: Optional[ZoneRrsetsAmountDynamic] = None + """Amount of dynamic RRsets in zone""" + + static: Optional[int] = None + """Amount of static RRsets in zone""" + + total: Optional[int] = None + """Total amount of RRsets in zone""" + + +class Zone(BaseModel): + id: Optional[int] = None + """ + ID of zone. This field usually is omitted in response and available only in case + of getting deleted zones by admin. + """ + + contact: Optional[str] = None + """email address of the administrator responsible for this zone""" + + dnssec_enabled: Optional[bool] = None + """ + describe dnssec status true means dnssec is enabled for the zone false means + dnssec is disabled for the zone + """ + + expiry: Optional[int] = None + """ + number of seconds after which secondary name servers should stop answering + request for this zone + """ + + meta: Optional[object] = None + """arbitrarily data of zone in json format""" + + name: Optional[str] = None + """name of DNS zone""" + + nx_ttl: Optional[int] = None + """Time To Live of cache""" + + primary_server: Optional[str] = None + """primary master name server for zone""" + + records: Optional[List[ZoneRecord]] = None + + refresh: Optional[int] = None + """ + number of seconds after which secondary name servers should query the master for + the SOA record, to detect zone changes. + """ + + retry: Optional[int] = None + """ + number of seconds after which secondary name servers should retry to request the + serial number + """ + + rrsets_amount: Optional[ZoneRrsetsAmount] = None + + serial: Optional[int] = None + """ + Serial number for this zone or Timestamp of zone modification moment. If a + secondary name server slaved to this one observes an increase in this number, + the slave will assume that the zone has been updated and initiate a zone + transfer. + """ + + status: Optional[str] = None + + +class ZoneGetResponse(BaseModel): + zone: Optional[Zone] = FieldInfo(alias="Zone", default=None) + """swagger: model""" diff --git a/src/gcore/types/dns/zone_get_statistics_params.py b/src/gcore/types/dns/zone_get_statistics_params.py new file mode 100644 index 00000000..ee528101 --- /dev/null +++ b/src/gcore/types/dns/zone_get_statistics_params.py @@ -0,0 +1,43 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ZoneGetStatisticsParams"] + + +class ZoneGetStatisticsParams(TypedDict, total=False): + from_: Annotated[int, PropertyInfo(alias="from")] + """ + Beginning of the requested time period (Unix Timestamp, UTC.) In a query string: + &from=1709068637 + """ + + granularity: str + """ + Granularity parameter string is a sequence of decimal numbers, each with + optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid + time units are "s", "m", "h". + """ + + record_type: str + """DNS record type. Possible values: + + - A + - AAAA + - NS + - CNAME + - MX + - TXT + - SVCB + - HTTPS + """ + + to: int + """ + End of the requested time period (Unix Timestamp, UTC.) In a query string: + &to=1709673437 + """ diff --git a/src/gcore/types/dns/zone_get_statistics_response.py b/src/gcore/types/dns/zone_get_statistics_response.py new file mode 100644 index 00000000..6798692d --- /dev/null +++ b/src/gcore/types/dns/zone_get_statistics_response.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["ZoneGetStatisticsResponse"] + + +class ZoneGetStatisticsResponse(BaseModel): + requests: Optional[object] = None + """ + Requests amount (values) for particular zone fractionated by time intervals + (keys). Example of response: + `{ "requests": { "1598608080000": 14716, "1598608140000": 51167, "1598608200000": 53432, "1598611020000": 51050, "1598611080000": 52611, "1598611140000": 46884 } }` + """ + + total: Optional[int] = None + """Total - sum of all values""" diff --git a/src/gcore/types/dns/zone_import_params.py b/src/gcore/types/dns/zone_import_params.py new file mode 100644 index 00000000..ca009f38 --- /dev/null +++ b/src/gcore/types/dns/zone_import_params.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ZoneImportParams"] + + +class ZoneImportParams(TypedDict, total=False): + body: object + """Read reads up to len(p) bytes into p. + + It returns the number of bytes read (0 <= n <= len(p)) and any error + encountered. Even if Read returns n < len(p), it may use all of p as scratch + space during the call. If some data is available but not len(p) bytes, Read + conventionally returns what is available instead of waiting for more. When Read + encounters an error or end-of-file condition after successfully reading n > 0 + bytes, it returns the number of bytes read. It may return the (non-nil) error + from the same call or return the error (and n == 0) from a subsequent call. An + instance of this general case is that a Reader returning a non-zero number of + bytes at the end of the input stream may return either err == EOF or err == nil. + The next Read should return 0, EOF. Callers should always process the n > 0 + bytes returned before considering the error err. Doing so correctly handles I/O + errors that happen after reading some bytes and also both of the allowed EOF + behaviors. If len(p) == 0, Read should always return n == 0. It may return a + non-nil error if some error condition is known, such as EOF. Implementations of + Read are discouraged from returning a zero byte count with a nil error, except + when len(p) == 0. Callers should treat a return of 0 and nil as indicating that + nothing happened; in particular it does not indicate EOF. Implementations must + not retain p. + """ diff --git a/src/gcore/types/dns/zone_import_response.py b/src/gcore/types/dns/zone_import_response.py new file mode 100644 index 00000000..d3a365ed --- /dev/null +++ b/src/gcore/types/dns/zone_import_response.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from ..._models import BaseModel + +__all__ = ["ZoneImportResponse", "Imported"] + + +class Imported(BaseModel): + qtype: Optional[int] = None + + resource_records: Optional[int] = None + + rrsets: Optional[int] = None + + skipped_resource_records: Optional[int] = None + + +class ZoneImportResponse(BaseModel): + imported: Optional[Imported] = None + """ImportedRRSets - import statistics""" + + success: Optional[bool] = None + + warnings: Optional[Dict[str, Dict[str, str]]] = None diff --git a/src/gcore/types/dns/zone_list_params.py b/src/gcore/types/dns/zone_list_params.py new file mode 100644 index 00000000..f5e809b5 --- /dev/null +++ b/src/gcore/types/dns/zone_list_params.py @@ -0,0 +1,56 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ZoneListParams"] + + +class ZoneListParams(TypedDict, total=False): + id: Iterable[int] + """to pass several ids `id=1&id=3&id=5...`""" + + case_sensitive: bool + + client_id: Iterable[int] + """to pass several `client_ids` `client_id=1&`client_id`=3&`client_id`=5...`""" + + dynamic: bool + """Zones with dynamic RRsets""" + + enabled: bool + + exact_match: bool + + healthcheck: bool + """Zones with RRsets that have healthchecks""" + + iam_reseller_id: Iterable[int] + + limit: int + """Max number of records in response""" + + name: List[str] + """to pass several names `name=first&name=second...`""" + + 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""" + + reseller_id: Iterable[int] + + status: str + + updated_at_from: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + + updated_at_to: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] diff --git a/src/gcore/types/dns/zone_list_response.py b/src/gcore/types/dns/zone_list_response.py new file mode 100644 index 00000000..3bd194de --- /dev/null +++ b/src/gcore/types/dns/zone_list_response.py @@ -0,0 +1,103 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["ZoneListResponse", "Zone", "ZoneRecord", "ZoneRrsetsAmount", "ZoneRrsetsAmountDynamic"] + + +class ZoneRecord(BaseModel): + name: Optional[str] = None + + short_answers: Optional[List[str]] = None + + ttl: Optional[int] = None + + type: Optional[str] = None + + +class ZoneRrsetsAmountDynamic(BaseModel): + healthcheck: Optional[int] = None + """Amount of RRsets with enabled healthchecks""" + + total: Optional[int] = None + """Total amount of dynamic RRsets in zone""" + + +class ZoneRrsetsAmount(BaseModel): + dynamic: Optional[ZoneRrsetsAmountDynamic] = None + """Amount of dynamic RRsets in zone""" + + static: Optional[int] = None + """Amount of static RRsets in zone""" + + total: Optional[int] = None + """Total amount of RRsets in zone""" + + +class Zone(BaseModel): + id: Optional[int] = None + """ + ID of zone. This field usually is omitted in response and available only in case + of getting deleted zones by admin. + """ + + contact: Optional[str] = None + """email address of the administrator responsible for this zone""" + + dnssec_enabled: Optional[bool] = None + """ + describe dnssec status true means dnssec is enabled for the zone false means + dnssec is disabled for the zone + """ + + expiry: Optional[int] = None + """ + number of seconds after which secondary name servers should stop answering + request for this zone + """ + + meta: Optional[object] = None + """arbitrarily data of zone in json format""" + + name: Optional[str] = None + """name of DNS zone""" + + nx_ttl: Optional[int] = None + """Time To Live of cache""" + + primary_server: Optional[str] = None + """primary master name server for zone""" + + records: Optional[List[ZoneRecord]] = None + + refresh: Optional[int] = None + """ + number of seconds after which secondary name servers should query the master for + the SOA record, to detect zone changes. + """ + + retry: Optional[int] = None + """ + number of seconds after which secondary name servers should retry to request the + serial number + """ + + rrsets_amount: Optional[ZoneRrsetsAmount] = None + + serial: Optional[int] = None + """ + Serial number for this zone or Timestamp of zone modification moment. If a + secondary name server slaved to this one observes an increase in this number, + the slave will assume that the zone has been updated and initiate a zone + transfer. + """ + + status: Optional[str] = None + + +class ZoneListResponse(BaseModel): + total_amount: Optional[int] = None + + zones: Optional[List[Zone]] = None diff --git a/src/gcore/types/dns/zone_update_params.py b/src/gcore/types/dns/zone_update_params.py new file mode 100644 index 00000000..7ea73f7f --- /dev/null +++ b/src/gcore/types/dns/zone_update_params.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ZoneUpdateParams"] + + +class ZoneUpdateParams(TypedDict, total=False): + body_name: Required[Annotated[str, PropertyInfo(alias="name")]] + """name of DNS zone""" + + contact: str + """email address of the administrator responsible for this zone""" + + enabled: bool + """If a zone is disabled, then its records will not be resolved on dns servers""" + + expiry: int + """ + number of seconds after which secondary name servers should stop answering + request for this zone + """ + + meta: Dict[str, object] + """ + arbitrarily data of zone in json format you can specify `webhook` url and + `webhook_method` here webhook will get a map with three arrays: for created, + updated and deleted rrsets `webhook_method` can be omitted, POST will be used by + default + """ + + nx_ttl: int + """Time To Live of cache""" + + primary_server: str + """primary master name server for zone""" + + refresh: int + """ + number of seconds after which secondary name servers should query the master for + the SOA record, to detect zone changes. + """ + + retry: int + """ + number of seconds after which secondary name servers should retry to request the + serial number + """ + + serial: int + """ + Serial number for this zone or Timestamp of zone modification moment. If a + secondary name server slaved to this one observes an increase in this number, + the slave will assume that the zone has been updated and initiate a zone + transfer. + """ diff --git a/src/gcore/types/dns/zones/__init__.py b/src/gcore/types/dns/zones/__init__.py new file mode 100644 index 00000000..5f06e205 --- /dev/null +++ b/src/gcore/types/dns/zones/__init__.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .dns_failover_log import DNSFailoverLog as DNSFailoverLog +from .dns_output_rrset import DNSOutputRrset as DNSOutputRrset +from .rrset_list_params import RrsetListParams as RrsetListParams +from .dnssec_get_response import DnssecGetResponse as DnssecGetResponse +from .rrset_create_params import RrsetCreateParams as RrsetCreateParams +from .rrset_list_response import RrsetListResponse as RrsetListResponse +from .rrset_update_params import RrsetUpdateParams as RrsetUpdateParams +from .dnssec_update_params import DnssecUpdateParams as DnssecUpdateParams +from .dnssec_update_response import DnssecUpdateResponse as DnssecUpdateResponse +from .rrset_get_failover_logs_params import RrsetGetFailoverLogsParams as RrsetGetFailoverLogsParams +from .rrset_get_failover_logs_response import RrsetGetFailoverLogsResponse as RrsetGetFailoverLogsResponse diff --git a/src/gcore/types/dns/zones/dns_failover_log.py b/src/gcore/types/dns/zones/dns_failover_log.py new file mode 100644 index 00000000..a329325a --- /dev/null +++ b/src/gcore/types/dns/zones/dns_failover_log.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ...._models import BaseModel + +__all__ = ["DNSFailoverLog", "DNSFailoverLogItem"] + + +class DNSFailoverLogItem(BaseModel): + action: Optional[str] = None + + address: Optional[str] = None + + time: Optional[int] = None + + +DNSFailoverLog: TypeAlias = List[DNSFailoverLogItem] diff --git a/src/gcore/types/dns/zones/dns_output_rrset.py b/src/gcore/types/dns/zones/dns_output_rrset.py new file mode 100644 index 00000000..8ff63143 --- /dev/null +++ b/src/gcore/types/dns/zones/dns_output_rrset.py @@ -0,0 +1,123 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["DNSOutputRrset", "ResourceRecord", "Picker", "Warning"] + + +class ResourceRecord(BaseModel): + content: List[object] + """ + Content of resource record The exact length of the array depends on the type of + rrset, each individual record parameter must be a separate element of the array. + For example + + - SRV-record: `[100, 1, 5061, "example.com"]` + - CNAME-record: `[ "the.target.domain" ]` + - A-record: `[ "1.2.3.4", "5.6.7.8" ]` + - AAAA-record: `[ "2001:db8::1", "2001:db8::2" ]` + - MX-record: `[ "mail1.example.com", "mail2.example.com" ]` + - SVCB/HTTPS-record: + `[ 1, ".", ["alpn", "h3", "h2"], [ "port", 1443 ], [ "ipv4hint", "10.0.0.1" ], [ "ech", "AEn+DQBFKwAgACABWIHUGj4u+PIggYXcR5JF0gYk3dCRioBW8uJq9H4mKAAIAAEAAQABAANAEnB1YmxpYy50bHMtZWNoLmRldgAA" ] ]` + """ + + id: Optional[int] = None + + enabled: Optional[bool] = None + + meta: Optional[Dict[str, object]] = None + """ + Meta information for record Map with string key and any valid json as value, + with valid keys + + 1. `asn` (array of int) + 2. `continents` (array of string) + 3. `countries` (array of string) + 4. `latlong` (array of float64, latitude and longitude) + 5. `fallback` (bool) + 6. `backup` (bool) + 7. `notes` (string) + 8. `weight` (float) + 9. `ip` (string) Some keys are reserved for balancing, @see + https://api.gcore.com/dns/v2/info/meta This meta will be used to decide which + resource record should pass through filters from the filter set + """ + + +class Picker(BaseModel): + type: Literal[ + "geodns", "asn", "country", "continent", "region", "ip", "geodistance", "weighted_shuffle", "default", "first_n" + ] + """Filter type""" + + limit: Optional[int] = None + """ + Limits the number of records returned by the filter Can be a positive value for + a specific limit. Use zero or leave it blank to indicate no limits. + """ + + strict: Optional[bool] = None + """ + if strict=false, then the filter will return all records if no records match the + filter + """ + + +class Warning(BaseModel): + key: Optional[str] = None + + message: Optional[str] = None + + +class DNSOutputRrset(BaseModel): + name: str + + resource_records: List[ResourceRecord] + """List of resource record from rrset""" + + type: Literal["A", "AAAA", "NS", "CNAME", "MX", "TXT", "SRV", "SOA"] + """RRSet type""" + + filter_set_id: Optional[int] = None + + meta: Optional[Dict[str, object]] = None + """Meta information for rrset. + + Map with string key and any valid json as value, with valid keys + + 1. `failover` (object, beta feature, might be changed in the future) can have + fields 1.1. `protocol` (string, required, HTTP, TCP, UDP, ICMP) 1.2. `port` + (int, required, 1-65535) 1.3. `frequency` (int, required, in seconds 10-3600) + 1.4. `timeout` (int, required, in seconds 1-10), 1.5. `method` (string, only + for protocol=HTTP) 1.6. `command` (string, bytes to be sent only for + protocol=TCP/UDP) 1.7. `url` (string, only for protocol=HTTP) 1.8. `tls` + (bool, only for protocol=HTTP) 1.9. `regexp` (string regex to match, only for + non-ICMP) 1.10. `http_status_code` (int, only for protocol=HTTP) 1.11. `host` + (string, only for protocol=HTTP) + 2. `geodns_link` (string) - name of the geodns link to use, if previously set, + must re-send when updating or CDN integration will be removed for this RRSet + """ + + pickers: Optional[List[Picker]] = None + """Set of pickers""" + + ttl: Optional[int] = None + + updated_at: Optional[datetime] = None + """Timestamp marshals/unmarshals date and time as timestamp in json""" + + warning: Optional[str] = None + """ + Warning about some possible side effects without strictly disallowing operations + on rrset readonly Deprecated: use Warnings instead + """ + + warnings: Optional[List[Warning]] = None + """ + Warning about some possible side effects without strictly disallowing operations + on rrset readonly + """ diff --git a/src/gcore/types/dns/zones/dnssec_get_response.py b/src/gcore/types/dns/zones/dnssec_get_response.py new file mode 100644 index 00000000..b4220914 --- /dev/null +++ b/src/gcore/types/dns/zones/dnssec_get_response.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["DnssecGetResponse"] + + +class DnssecGetResponse(BaseModel): + algorithm: Optional[str] = None + """Specifies the algorithm used for the key.""" + + digest: Optional[str] = None + """Represents the hashed value of the DS record.""" + + digest_algorithm: Optional[str] = None + """Specifies the algorithm used to generate the digest.""" + + digest_type: Optional[str] = None + """Specifies the type of the digest algorithm used.""" + + ds: Optional[str] = None + """Represents the complete DS record.""" + + flags: Optional[int] = None + """Represents the flag for DNSSEC record.""" + + key_tag: Optional[int] = None + """Represents the identifier of the DNSKEY record.""" + + key_type: Optional[str] = None + """Specifies the type of the key used in the algorithm.""" + + public_key: Optional[str] = None + """Represents the public key used in the DS record.""" + + uuid: Optional[str] = None diff --git a/src/gcore/types/dns/zones/dnssec_update_params.py b/src/gcore/types/dns/zones/dnssec_update_params.py new file mode 100644 index 00000000..68249d14 --- /dev/null +++ b/src/gcore/types/dns/zones/dnssec_update_params.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["DnssecUpdateParams"] + + +class DnssecUpdateParams(TypedDict, total=False): + enabled: bool diff --git a/src/gcore/types/dns/zones/dnssec_update_response.py b/src/gcore/types/dns/zones/dnssec_update_response.py new file mode 100644 index 00000000..e552fd18 --- /dev/null +++ b/src/gcore/types/dns/zones/dnssec_update_response.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["DnssecUpdateResponse"] + + +class DnssecUpdateResponse(BaseModel): + algorithm: Optional[str] = None + """Specifies the algorithm used for the key.""" + + digest: Optional[str] = None + """Represents the hashed value of the DS record.""" + + digest_algorithm: Optional[str] = None + """Specifies the algorithm used to generate the digest.""" + + digest_type: Optional[str] = None + """Specifies the type of the digest algorithm used.""" + + ds: Optional[str] = None + """Represents the complete DS record.""" + + flags: Optional[int] = None + """Represents the flag for DNSSEC record.""" + + key_tag: Optional[int] = None + """Represents the identifier of the DNSKEY record.""" + + key_type: Optional[str] = None + """Specifies the type of the key used in the algorithm.""" + + message: Optional[str] = None + + public_key: Optional[str] = None + """Represents the public key used in the DS record.""" diff --git a/src/gcore/types/dns/zones/rrset_create_params.py b/src/gcore/types/dns/zones/rrset_create_params.py new file mode 100644 index 00000000..16facb7e --- /dev/null +++ b/src/gcore/types/dns/zones/rrset_create_params.py @@ -0,0 +1,82 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["RrsetCreateParams", "ResourceRecord", "Picker"] + + +class RrsetCreateParams(TypedDict, total=False): + zone_name: Required[Annotated[str, PropertyInfo(alias="zoneName")]] + + rrset_name: Required[Annotated[str, PropertyInfo(alias="rrsetName")]] + + resource_records: Required[Iterable[ResourceRecord]] + """List of resource record from rrset""" + + meta: Dict[str, object] + """Meta information for rrset""" + + pickers: Iterable[Picker] + """Set of pickers""" + + ttl: int + + +class ResourceRecord(TypedDict, total=False): + content: Required[Iterable[object]] + """ + Content of resource record The exact length of the array depends on the type of + rrset, each individual record parameter must be a separate element of the array. + For example + + - SRV-record: `[100, 1, 5061, "example.com"]` + - CNAME-record: `[ "the.target.domain" ]` + - A-record: `[ "1.2.3.4", "5.6.7.8" ]` + - AAAA-record: `[ "2001:db8::1", "2001:db8::2" ]` + - MX-record: `[ "mail1.example.com", "mail2.example.com" ]` + - SVCB/HTTPS-record: + `[ 1, ".", ["alpn", "h3", "h2"], [ "port", 1443 ], [ "ipv4hint", "10.0.0.1" ], [ "ech", "AEn+DQBFKwAgACABWIHUGj4u+PIggYXcR5JF0gYk3dCRioBW8uJq9H4mKAAIAAEAAQABAANAEnB1YmxpYy50bHMtZWNoLmRldgAA" ] ]` + """ + + enabled: bool + + meta: Dict[str, object] + """ + This meta will be used to decide which resource record should pass through + filters from the filter set + """ + + +class Picker(TypedDict, total=False): + type: Required[ + Literal[ + "geodns", + "asn", + "country", + "continent", + "region", + "ip", + "geodistance", + "weighted_shuffle", + "default", + "first_n", + ] + ] + """Filter type""" + + limit: int + """ + Limits the number of records returned by the filter Can be a positive value for + a specific limit. Use zero or leave it blank to indicate no limits. + """ + + strict: bool + """ + if strict=false, then the filter will return all records if no records match the + filter + """ diff --git a/src/gcore/types/dns/zones/rrset_get_failover_logs_params.py b/src/gcore/types/dns/zones/rrset_get_failover_logs_params.py new file mode 100644 index 00000000..191c1b76 --- /dev/null +++ b/src/gcore/types/dns/zones/rrset_get_failover_logs_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 Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["RrsetGetFailoverLogsParams"] + + +class RrsetGetFailoverLogsParams(TypedDict, total=False): + zone_name: Required[Annotated[str, PropertyInfo(alias="zoneName")]] + + rrset_name: Required[Annotated[str, PropertyInfo(alias="rrsetName")]] + + limit: int + """Max number of records in response""" + + offset: int + """Amount of records to skip before beginning to write in response.""" diff --git a/src/gcore/types/dns/zones/rrset_get_failover_logs_response.py b/src/gcore/types/dns/zones/rrset_get_failover_logs_response.py new file mode 100644 index 00000000..97a59100 --- /dev/null +++ b/src/gcore/types/dns/zones/rrset_get_failover_logs_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel +from .dns_failover_log import DNSFailoverLog + +__all__ = ["RrsetGetFailoverLogsResponse"] + + +class RrsetGetFailoverLogsResponse(BaseModel): + log: Optional[DNSFailoverLog] = None + """FailoverLog""" + + total_amount: Optional[int] = None diff --git a/src/gcore/types/dns/zones/rrset_list_params.py b/src/gcore/types/dns/zones/rrset_list_params.py new file mode 100644 index 00000000..39df19ef --- /dev/null +++ b/src/gcore/types/dns/zones/rrset_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__ = ["RrsetListParams"] + + +class RrsetListParams(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/zones/rrset_list_response.py b/src/gcore/types/dns/zones/rrset_list_response.py new file mode 100644 index 00000000..1909ef98 --- /dev/null +++ b/src/gcore/types/dns/zones/rrset_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_output_rrset import DNSOutputRrset + +__all__ = ["RrsetListResponse"] + + +class RrsetListResponse(BaseModel): + rrsets: Optional[List[DNSOutputRrset]] = None + + total_amount: Optional[int] = None diff --git a/src/gcore/types/dns/zones/rrset_update_params.py b/src/gcore/types/dns/zones/rrset_update_params.py new file mode 100644 index 00000000..3f91030f --- /dev/null +++ b/src/gcore/types/dns/zones/rrset_update_params.py @@ -0,0 +1,82 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["RrsetUpdateParams", "ResourceRecord", "Picker"] + + +class RrsetUpdateParams(TypedDict, total=False): + zone_name: Required[Annotated[str, PropertyInfo(alias="zoneName")]] + + rrset_name: Required[Annotated[str, PropertyInfo(alias="rrsetName")]] + + resource_records: Required[Iterable[ResourceRecord]] + """List of resource record from rrset""" + + meta: Dict[str, object] + """Meta information for rrset""" + + pickers: Iterable[Picker] + """Set of pickers""" + + ttl: int + + +class ResourceRecord(TypedDict, total=False): + content: Required[Iterable[object]] + """ + Content of resource record The exact length of the array depends on the type of + rrset, each individual record parameter must be a separate element of the array. + For example + + - SRV-record: `[100, 1, 5061, "example.com"]` + - CNAME-record: `[ "the.target.domain" ]` + - A-record: `[ "1.2.3.4", "5.6.7.8" ]` + - AAAA-record: `[ "2001:db8::1", "2001:db8::2" ]` + - MX-record: `[ "mail1.example.com", "mail2.example.com" ]` + - SVCB/HTTPS-record: + `[ 1, ".", ["alpn", "h3", "h2"], [ "port", 1443 ], [ "ipv4hint", "10.0.0.1" ], [ "ech", "AEn+DQBFKwAgACABWIHUGj4u+PIggYXcR5JF0gYk3dCRioBW8uJq9H4mKAAIAAEAAQABAANAEnB1YmxpYy50bHMtZWNoLmRldgAA" ] ]` + """ + + enabled: bool + + meta: Dict[str, object] + """ + This meta will be used to decide which resource record should pass through + filters from the filter set + """ + + +class Picker(TypedDict, total=False): + type: Required[ + Literal[ + "geodns", + "asn", + "country", + "continent", + "region", + "ip", + "geodistance", + "weighted_shuffle", + "default", + "first_n", + ] + ] + """Filter type""" + + limit: int + """ + Limits the number of records returned by the filter Can be a positive value for + a specific limit. Use zero or leave it blank to indicate no limits. + """ + + strict: bool + """ + if strict=false, then the filter will return all records if no records match the + filter + """ diff --git a/tests/api_resources/dns/__init__.py b/tests/api_resources/dns/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/dns/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/dns/pickers/__init__.py b/tests/api_resources/dns/pickers/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/dns/pickers/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/dns/pickers/test_presets.py b/tests/api_resources/dns/pickers/test_presets.py new file mode 100644 index 00000000..3622687a --- /dev/null +++ b/tests/api_resources/dns/pickers/test_presets.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.dns.pickers import PresetListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPresets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + preset = client.dns.pickers.presets.list() + assert_matches_type(PresetListResponse, preset, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.dns.pickers.presets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + preset = response.parse() + assert_matches_type(PresetListResponse, preset, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.dns.pickers.presets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + preset = response.parse() + assert_matches_type(PresetListResponse, preset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncPresets: + 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: + preset = await async_client.dns.pickers.presets.list() + assert_matches_type(PresetListResponse, preset, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.pickers.presets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + preset = await response.parse() + assert_matches_type(PresetListResponse, preset, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.dns.pickers.presets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + preset = await response.parse() + assert_matches_type(PresetListResponse, preset, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dns/test_locations.py b/tests/api_resources/dns/test_locations.py new file mode 100644 index 00000000..185d35d1 --- /dev/null +++ b/tests/api_resources/dns/test_locations.py @@ -0,0 +1,229 @@ +# 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 ( + LocationListResponse, + LocationListRegionsResponse, + LocationListCountriesResponse, + LocationListContinentsResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLocations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + location = client.dns.locations.list() + assert_matches_type(LocationListResponse, location, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.dns.locations.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = response.parse() + assert_matches_type(LocationListResponse, location, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.dns.locations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = response.parse() + assert_matches_type(LocationListResponse, location, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_continents(self, client: Gcore) -> None: + location = client.dns.locations.list_continents() + assert_matches_type(LocationListContinentsResponse, location, path=["response"]) + + @parametrize + def test_raw_response_list_continents(self, client: Gcore) -> None: + response = client.dns.locations.with_raw_response.list_continents() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = response.parse() + assert_matches_type(LocationListContinentsResponse, location, path=["response"]) + + @parametrize + def test_streaming_response_list_continents(self, client: Gcore) -> None: + with client.dns.locations.with_streaming_response.list_continents() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = response.parse() + assert_matches_type(LocationListContinentsResponse, location, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_countries(self, client: Gcore) -> None: + location = client.dns.locations.list_countries() + assert_matches_type(LocationListCountriesResponse, location, path=["response"]) + + @parametrize + def test_raw_response_list_countries(self, client: Gcore) -> None: + response = client.dns.locations.with_raw_response.list_countries() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = response.parse() + assert_matches_type(LocationListCountriesResponse, location, path=["response"]) + + @parametrize + def test_streaming_response_list_countries(self, client: Gcore) -> None: + with client.dns.locations.with_streaming_response.list_countries() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = response.parse() + assert_matches_type(LocationListCountriesResponse, location, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_regions(self, client: Gcore) -> None: + location = client.dns.locations.list_regions() + assert_matches_type(LocationListRegionsResponse, location, path=["response"]) + + @parametrize + def test_raw_response_list_regions(self, client: Gcore) -> None: + response = client.dns.locations.with_raw_response.list_regions() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = response.parse() + assert_matches_type(LocationListRegionsResponse, location, path=["response"]) + + @parametrize + def test_streaming_response_list_regions(self, client: Gcore) -> None: + with client.dns.locations.with_streaming_response.list_regions() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = response.parse() + assert_matches_type(LocationListRegionsResponse, location, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncLocations: + 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: + location = await async_client.dns.locations.list() + assert_matches_type(LocationListResponse, location, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.locations.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = await response.parse() + assert_matches_type(LocationListResponse, location, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.dns.locations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = await response.parse() + assert_matches_type(LocationListResponse, location, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_continents(self, async_client: AsyncGcore) -> None: + location = await async_client.dns.locations.list_continents() + assert_matches_type(LocationListContinentsResponse, location, path=["response"]) + + @parametrize + async def test_raw_response_list_continents(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.locations.with_raw_response.list_continents() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = await response.parse() + assert_matches_type(LocationListContinentsResponse, location, path=["response"]) + + @parametrize + async def test_streaming_response_list_continents(self, async_client: AsyncGcore) -> None: + async with async_client.dns.locations.with_streaming_response.list_continents() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = await response.parse() + assert_matches_type(LocationListContinentsResponse, location, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_countries(self, async_client: AsyncGcore) -> None: + location = await async_client.dns.locations.list_countries() + assert_matches_type(LocationListCountriesResponse, location, path=["response"]) + + @parametrize + async def test_raw_response_list_countries(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.locations.with_raw_response.list_countries() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = await response.parse() + assert_matches_type(LocationListCountriesResponse, location, path=["response"]) + + @parametrize + async def test_streaming_response_list_countries(self, async_client: AsyncGcore) -> None: + async with async_client.dns.locations.with_streaming_response.list_countries() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = await response.parse() + assert_matches_type(LocationListCountriesResponse, location, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_regions(self, async_client: AsyncGcore) -> None: + location = await async_client.dns.locations.list_regions() + assert_matches_type(LocationListRegionsResponse, location, path=["response"]) + + @parametrize + async def test_raw_response_list_regions(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.locations.with_raw_response.list_regions() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = await response.parse() + assert_matches_type(LocationListRegionsResponse, location, path=["response"]) + + @parametrize + async def test_streaming_response_list_regions(self, async_client: AsyncGcore) -> None: + async with async_client.dns.locations.with_streaming_response.list_regions() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = await response.parse() + assert_matches_type(LocationListRegionsResponse, location, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dns/test_metrics.py b/tests/api_resources/dns/test_metrics.py new file mode 100644 index 00000000..a07fb783 --- /dev/null +++ b/tests/api_resources/dns/test_metrics.py @@ -0,0 +1,89 @@ +# 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 + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestMetrics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + metric = client.dns.metrics.list() + assert_matches_type(str, metric, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + metric = client.dns.metrics.list( + client_ids=[0], + zone_names=["string"], + ) + assert_matches_type(str, metric, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.dns.metrics.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = response.parse() + assert_matches_type(str, metric, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.dns.metrics.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = response.parse() + assert_matches_type(str, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncMetrics: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + metric = await async_client.dns.metrics.list() + assert_matches_type(str, metric, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + metric = await async_client.dns.metrics.list( + client_ids=[0], + zone_names=["string"], + ) + assert_matches_type(str, metric, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.metrics.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = await response.parse() + assert_matches_type(str, metric, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.dns.metrics.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = await response.parse() + assert_matches_type(str, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dns/test_pickers.py b/tests/api_resources/dns/test_pickers.py new file mode 100644 index 00000000..68d2d832 --- /dev/null +++ b/tests/api_resources/dns/test_pickers.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.dns import PickerListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPickers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + picker = client.dns.pickers.list() + assert_matches_type(PickerListResponse, picker, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.dns.pickers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + picker = response.parse() + assert_matches_type(PickerListResponse, picker, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.dns.pickers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + picker = response.parse() + assert_matches_type(PickerListResponse, picker, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncPickers: + 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: + picker = await async_client.dns.pickers.list() + assert_matches_type(PickerListResponse, picker, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.pickers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + picker = await response.parse() + assert_matches_type(PickerListResponse, picker, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.dns.pickers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + picker = await response.parse() + assert_matches_type(PickerListResponse, picker, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dns/test_zones.py b/tests/api_resources/dns/test_zones.py new file mode 100644 index 00000000..30cee43d --- /dev/null +++ b/tests/api_resources/dns/test_zones.py @@ -0,0 +1,987 @@ +# 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._utils import parse_datetime +from gcore.types.dns import ( + ZoneGetResponse, + ZoneListResponse, + ZoneCreateResponse, + ZoneExportResponse, + ZoneImportResponse, + ZoneGetStatisticsResponse, + ZoneCheckDelegationStatusResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestZones: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + zone = client.dns.zones.create( + name="example.com", + ) + assert_matches_type(ZoneCreateResponse, zone, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + zone = client.dns.zones.create( + name="example.com", + contact="contact", + enabled=True, + expiry=0, + meta={"foo": {}}, + nx_ttl=0, + primary_server="primary_server", + refresh=0, + retry=0, + serial=0, + ) + assert_matches_type(ZoneCreateResponse, zone, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.create( + name="example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = response.parse() + assert_matches_type(ZoneCreateResponse, zone, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.create( + name="example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = response.parse() + assert_matches_type(ZoneCreateResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + zone = client.dns.zones.update( + path_name="name", + body_name="example.com", + ) + assert_matches_type(object, zone, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + zone = client.dns.zones.update( + path_name="name", + body_name="example.com", + contact="contact", + enabled=True, + expiry=0, + meta={"foo": {}}, + nx_ttl=0, + primary_server="primary_server", + refresh=0, + retry=0, + serial=0, + ) + assert_matches_type(object, zone, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.update( + path_name="name", + body_name="example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = response.parse() + assert_matches_type(object, zone, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.update( + path_name="name", + body_name="example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = response.parse() + assert_matches_type(object, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_name` but received ''"): + client.dns.zones.with_raw_response.update( + path_name="", + body_name="example.com", + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + zone = client.dns.zones.list() + assert_matches_type(ZoneListResponse, zone, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + zone = client.dns.zones.list( + id=[0], + case_sensitive=True, + client_id=[0], + dynamic=True, + enabled=True, + exact_match=True, + healthcheck=True, + iam_reseller_id=[0], + limit=0, + name=["string"], + offset=0, + order_by="order_by", + order_direction="asc", + reseller_id=[0], + status="status", + updated_at_from=parse_datetime("2019-12-27T18:11:19.117Z"), + updated_at_to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(ZoneListResponse, zone, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = response.parse() + assert_matches_type(ZoneListResponse, zone, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = response.parse() + assert_matches_type(ZoneListResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + zone = client.dns.zones.delete( + "name", + ) + assert_matches_type(object, zone, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.delete( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = response.parse() + assert_matches_type(object, zone, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.delete( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = response.parse() + assert_matches_type(object, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + client.dns.zones.with_raw_response.delete( + "", + ) + + @parametrize + def test_method_check_delegation_status(self, client: Gcore) -> None: + zone = client.dns.zones.check_delegation_status( + "name", + ) + assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) + + @parametrize + def test_raw_response_check_delegation_status(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.check_delegation_status( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = response.parse() + assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) + + @parametrize + def test_streaming_response_check_delegation_status(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.check_delegation_status( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = response.parse() + assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_check_delegation_status(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + client.dns.zones.with_raw_response.check_delegation_status( + "", + ) + + @parametrize + def test_method_disable(self, client: Gcore) -> None: + zone = client.dns.zones.disable( + "name", + ) + assert_matches_type(object, zone, path=["response"]) + + @parametrize + def test_raw_response_disable(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.disable( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = response.parse() + assert_matches_type(object, zone, path=["response"]) + + @parametrize + def test_streaming_response_disable(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.disable( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = response.parse() + assert_matches_type(object, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_disable(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + client.dns.zones.with_raw_response.disable( + "", + ) + + @parametrize + def test_method_enable(self, client: Gcore) -> None: + zone = client.dns.zones.enable( + "name", + ) + assert_matches_type(object, zone, path=["response"]) + + @parametrize + def test_raw_response_enable(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.enable( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = response.parse() + assert_matches_type(object, zone, path=["response"]) + + @parametrize + def test_streaming_response_enable(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.enable( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = response.parse() + assert_matches_type(object, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_enable(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + client.dns.zones.with_raw_response.enable( + "", + ) + + @parametrize + def test_method_export(self, client: Gcore) -> None: + zone = client.dns.zones.export( + "zoneName", + ) + assert_matches_type(ZoneExportResponse, zone, path=["response"]) + + @parametrize + def test_raw_response_export(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.export( + "zoneName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = response.parse() + assert_matches_type(ZoneExportResponse, zone, path=["response"]) + + @parametrize + def test_streaming_response_export(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.export( + "zoneName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = response.parse() + assert_matches_type(ZoneExportResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_export(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + client.dns.zones.with_raw_response.export( + "", + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + zone = client.dns.zones.get( + "name", + ) + assert_matches_type(ZoneGetResponse, zone, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.get( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = response.parse() + assert_matches_type(ZoneGetResponse, zone, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.get( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = response.parse() + assert_matches_type(ZoneGetResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + client.dns.zones.with_raw_response.get( + "", + ) + + @parametrize + def test_method_get_statistics(self, client: Gcore) -> None: + zone = client.dns.zones.get_statistics( + name="name", + ) + assert_matches_type(ZoneGetStatisticsResponse, zone, path=["response"]) + + @parametrize + def test_method_get_statistics_with_all_params(self, client: Gcore) -> None: + zone = client.dns.zones.get_statistics( + name="name", + from_=0, + granularity="granularity", + record_type="record_type", + to=0, + ) + assert_matches_type(ZoneGetStatisticsResponse, zone, path=["response"]) + + @parametrize + def test_raw_response_get_statistics(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.get_statistics( + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = response.parse() + assert_matches_type(ZoneGetStatisticsResponse, zone, path=["response"]) + + @parametrize + def test_streaming_response_get_statistics(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.get_statistics( + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = response.parse() + assert_matches_type(ZoneGetStatisticsResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_statistics(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + client.dns.zones.with_raw_response.get_statistics( + name="", + ) + + @parametrize + def test_method_import(self, client: Gcore) -> None: + zone = client.dns.zones.import_( + zone_name="zoneName", + ) + assert_matches_type(ZoneImportResponse, zone, path=["response"]) + + @parametrize + def test_method_import_with_all_params(self, client: Gcore) -> None: + zone = client.dns.zones.import_( + zone_name="zoneName", + body={}, + ) + assert_matches_type(ZoneImportResponse, zone, path=["response"]) + + @parametrize + def test_raw_response_import(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.import_( + zone_name="zoneName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = response.parse() + assert_matches_type(ZoneImportResponse, zone, path=["response"]) + + @parametrize + def test_streaming_response_import(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.import_( + zone_name="zoneName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = response.parse() + assert_matches_type(ZoneImportResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_import(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + client.dns.zones.with_raw_response.import_( + zone_name="", + ) + + +class TestAsyncZones: + 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: + zone = await async_client.dns.zones.create( + name="example.com", + ) + assert_matches_type(ZoneCreateResponse, zone, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.create( + name="example.com", + contact="contact", + enabled=True, + expiry=0, + meta={"foo": {}}, + nx_ttl=0, + primary_server="primary_server", + refresh=0, + retry=0, + serial=0, + ) + assert_matches_type(ZoneCreateResponse, zone, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.create( + name="example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(ZoneCreateResponse, zone, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.create( + name="example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(ZoneCreateResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.update( + path_name="name", + body_name="example.com", + ) + assert_matches_type(object, zone, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.update( + path_name="name", + body_name="example.com", + contact="contact", + enabled=True, + expiry=0, + meta={"foo": {}}, + nx_ttl=0, + primary_server="primary_server", + refresh=0, + retry=0, + serial=0, + ) + assert_matches_type(object, zone, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.update( + path_name="name", + body_name="example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(object, zone, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.update( + path_name="name", + body_name="example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(object, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_name` but received ''"): + await async_client.dns.zones.with_raw_response.update( + path_name="", + body_name="example.com", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.list() + assert_matches_type(ZoneListResponse, zone, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.list( + id=[0], + case_sensitive=True, + client_id=[0], + dynamic=True, + enabled=True, + exact_match=True, + healthcheck=True, + iam_reseller_id=[0], + limit=0, + name=["string"], + offset=0, + order_by="order_by", + order_direction="asc", + reseller_id=[0], + status="status", + updated_at_from=parse_datetime("2019-12-27T18:11:19.117Z"), + updated_at_to=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(ZoneListResponse, zone, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(ZoneListResponse, zone, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(ZoneListResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.delete( + "name", + ) + assert_matches_type(object, zone, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.delete( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(object, zone, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.delete( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(object, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + await async_client.dns.zones.with_raw_response.delete( + "", + ) + + @parametrize + async def test_method_check_delegation_status(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.check_delegation_status( + "name", + ) + assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) + + @parametrize + async def test_raw_response_check_delegation_status(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.check_delegation_status( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) + + @parametrize + async def test_streaming_response_check_delegation_status(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.check_delegation_status( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_check_delegation_status(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + await async_client.dns.zones.with_raw_response.check_delegation_status( + "", + ) + + @parametrize + async def test_method_disable(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.disable( + "name", + ) + assert_matches_type(object, zone, path=["response"]) + + @parametrize + async def test_raw_response_disable(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.disable( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(object, zone, path=["response"]) + + @parametrize + async def test_streaming_response_disable(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.disable( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(object, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_disable(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + await async_client.dns.zones.with_raw_response.disable( + "", + ) + + @parametrize + async def test_method_enable(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.enable( + "name", + ) + assert_matches_type(object, zone, path=["response"]) + + @parametrize + async def test_raw_response_enable(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.enable( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(object, zone, path=["response"]) + + @parametrize + async def test_streaming_response_enable(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.enable( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(object, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_enable(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + await async_client.dns.zones.with_raw_response.enable( + "", + ) + + @parametrize + async def test_method_export(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.export( + "zoneName", + ) + assert_matches_type(ZoneExportResponse, zone, path=["response"]) + + @parametrize + async def test_raw_response_export(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.export( + "zoneName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(ZoneExportResponse, zone, path=["response"]) + + @parametrize + async def test_streaming_response_export(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.export( + "zoneName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(ZoneExportResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_export(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + await async_client.dns.zones.with_raw_response.export( + "", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.get( + "name", + ) + assert_matches_type(ZoneGetResponse, zone, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.get( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(ZoneGetResponse, zone, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.get( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(ZoneGetResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + await async_client.dns.zones.with_raw_response.get( + "", + ) + + @parametrize + async def test_method_get_statistics(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.get_statistics( + name="name", + ) + assert_matches_type(ZoneGetStatisticsResponse, zone, path=["response"]) + + @parametrize + async def test_method_get_statistics_with_all_params(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.get_statistics( + name="name", + from_=0, + granularity="granularity", + record_type="record_type", + to=0, + ) + assert_matches_type(ZoneGetStatisticsResponse, zone, path=["response"]) + + @parametrize + async def test_raw_response_get_statistics(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.get_statistics( + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(ZoneGetStatisticsResponse, zone, path=["response"]) + + @parametrize + async def test_streaming_response_get_statistics(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.get_statistics( + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(ZoneGetStatisticsResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_statistics(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + await async_client.dns.zones.with_raw_response.get_statistics( + name="", + ) + + @parametrize + async def test_method_import(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.import_( + zone_name="zoneName", + ) + assert_matches_type(ZoneImportResponse, zone, path=["response"]) + + @parametrize + async def test_method_import_with_all_params(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.import_( + zone_name="zoneName", + body={}, + ) + assert_matches_type(ZoneImportResponse, zone, path=["response"]) + + @parametrize + async def test_raw_response_import(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.import_( + zone_name="zoneName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(ZoneImportResponse, zone, path=["response"]) + + @parametrize + async def test_streaming_response_import(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.import_( + zone_name="zoneName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(ZoneImportResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_import(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + await async_client.dns.zones.with_raw_response.import_( + zone_name="", + ) diff --git a/tests/api_resources/dns/zones/__init__.py b/tests/api_resources/dns/zones/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/dns/zones/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/dns/zones/test_dnssec.py b/tests/api_resources/dns/zones/test_dnssec.py new file mode 100644 index 00000000..063bb6fc --- /dev/null +++ b/tests/api_resources/dns/zones/test_dnssec.py @@ -0,0 +1,192 @@ +# 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.zones import DnssecGetResponse, DnssecUpdateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDnssec: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Gcore) -> None: + dnssec = client.dns.zones.dnssec.update( + name="name", + ) + assert_matches_type(DnssecUpdateResponse, dnssec, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + dnssec = client.dns.zones.dnssec.update( + name="name", + enabled=True, + ) + assert_matches_type(DnssecUpdateResponse, dnssec, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.dns.zones.dnssec.with_raw_response.update( + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dnssec = response.parse() + assert_matches_type(DnssecUpdateResponse, dnssec, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.dns.zones.dnssec.with_streaming_response.update( + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dnssec = response.parse() + assert_matches_type(DnssecUpdateResponse, dnssec, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + client.dns.zones.dnssec.with_raw_response.update( + name="", + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + dnssec = client.dns.zones.dnssec.get( + "name", + ) + assert_matches_type(DnssecGetResponse, dnssec, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.dns.zones.dnssec.with_raw_response.get( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dnssec = response.parse() + assert_matches_type(DnssecGetResponse, dnssec, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.dns.zones.dnssec.with_streaming_response.get( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dnssec = response.parse() + assert_matches_type(DnssecGetResponse, dnssec, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + client.dns.zones.dnssec.with_raw_response.get( + "", + ) + + +class TestAsyncDnssec: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + dnssec = await async_client.dns.zones.dnssec.update( + name="name", + ) + assert_matches_type(DnssecUpdateResponse, dnssec, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + dnssec = await async_client.dns.zones.dnssec.update( + name="name", + enabled=True, + ) + assert_matches_type(DnssecUpdateResponse, dnssec, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.dnssec.with_raw_response.update( + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dnssec = await response.parse() + assert_matches_type(DnssecUpdateResponse, dnssec, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.dnssec.with_streaming_response.update( + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dnssec = await response.parse() + assert_matches_type(DnssecUpdateResponse, dnssec, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + await async_client.dns.zones.dnssec.with_raw_response.update( + name="", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + dnssec = await async_client.dns.zones.dnssec.get( + "name", + ) + assert_matches_type(DnssecGetResponse, dnssec, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.dnssec.with_raw_response.get( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dnssec = await response.parse() + assert_matches_type(DnssecGetResponse, dnssec, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.dnssec.with_streaming_response.get( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dnssec = await response.parse() + assert_matches_type(DnssecGetResponse, dnssec, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + await async_client.dns.zones.dnssec.with_raw_response.get( + "", + ) diff --git a/tests/api_resources/dns/zones/test_rrsets.py b/tests/api_resources/dns/zones/test_rrsets.py new file mode 100644 index 00000000..7485d00e --- /dev/null +++ b/tests/api_resources/dns/zones/test_rrsets.py @@ -0,0 +1,872 @@ +# 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.zones import ( + DNSOutputRrset, + RrsetListResponse, + RrsetGetFailoverLogsResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRrsets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + rrset = client.dns.zones.rrsets.create( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + rrset = client.dns.zones.rrsets.create( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[ + { + "content": [{}], + "enabled": True, + "meta": {"foo": {}}, + } + ], + meta={}, + pickers=[ + { + "type": "geodns", + "limit": 0, + "strict": True, + } + ], + ttl=0, + ) + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.dns.zones.rrsets.with_raw_response.create( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.dns.zones.rrsets.with_streaming_response.create( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + client.dns.zones.rrsets.with_raw_response.create( + rrset_type="rrsetType", + zone_name="", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): + client.dns.zones.rrsets.with_raw_response.create( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="", + resource_records=[{"content": [{}]}], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): + client.dns.zones.rrsets.with_raw_response.create( + rrset_type="", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + @parametrize + def test_method_update(self, client: Gcore) -> None: + rrset = client.dns.zones.rrsets.update( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + rrset = client.dns.zones.rrsets.update( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[ + { + "content": [{}], + "enabled": True, + "meta": {"foo": {}}, + } + ], + meta={}, + pickers=[ + { + "type": "geodns", + "limit": 0, + "strict": True, + } + ], + ttl=0, + ) + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.dns.zones.rrsets.with_raw_response.update( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.dns.zones.rrsets.with_streaming_response.update( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + client.dns.zones.rrsets.with_raw_response.update( + rrset_type="rrsetType", + zone_name="", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): + client.dns.zones.rrsets.with_raw_response.update( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="", + resource_records=[{"content": [{}]}], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): + client.dns.zones.rrsets.with_raw_response.update( + rrset_type="", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + rrset = client.dns.zones.rrsets.list( + zone_name="zoneName", + ) + assert_matches_type(RrsetListResponse, rrset, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + rrset = client.dns.zones.rrsets.list( + zone_name="zoneName", + limit=0, + offset=0, + order_by="order_by", + order_direction="asc", + ) + assert_matches_type(RrsetListResponse, rrset, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.dns.zones.rrsets.with_raw_response.list( + zone_name="zoneName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = response.parse() + assert_matches_type(RrsetListResponse, rrset, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.dns.zones.rrsets.with_streaming_response.list( + zone_name="zoneName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = response.parse() + assert_matches_type(RrsetListResponse, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + client.dns.zones.rrsets.with_raw_response.list( + zone_name="", + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + rrset = client.dns.zones.rrsets.delete( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) + assert_matches_type(object, rrset, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.dns.zones.rrsets.with_raw_response.delete( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = response.parse() + assert_matches_type(object, rrset, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.dns.zones.rrsets.with_streaming_response.delete( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = response.parse() + assert_matches_type(object, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + client.dns.zones.rrsets.with_raw_response.delete( + rrset_type="rrsetType", + zone_name="", + rrset_name="rrsetName", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): + client.dns.zones.rrsets.with_raw_response.delete( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): + client.dns.zones.rrsets.with_raw_response.delete( + rrset_type="", + zone_name="zoneName", + rrset_name="rrsetName", + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + rrset = client.dns.zones.rrsets.get( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.dns.zones.rrsets.with_raw_response.get( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.dns.zones.rrsets.with_streaming_response.get( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + client.dns.zones.rrsets.with_raw_response.get( + rrset_type="rrsetType", + zone_name="", + rrset_name="rrsetName", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): + client.dns.zones.rrsets.with_raw_response.get( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): + client.dns.zones.rrsets.with_raw_response.get( + rrset_type="", + zone_name="zoneName", + rrset_name="rrsetName", + ) + + @parametrize + def test_method_get_failover_logs(self, client: Gcore) -> None: + rrset = client.dns.zones.rrsets.get_failover_logs( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) + assert_matches_type(RrsetGetFailoverLogsResponse, rrset, path=["response"]) + + @parametrize + def test_method_get_failover_logs_with_all_params(self, client: Gcore) -> None: + rrset = client.dns.zones.rrsets.get_failover_logs( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + limit=0, + offset=0, + ) + assert_matches_type(RrsetGetFailoverLogsResponse, rrset, path=["response"]) + + @parametrize + def test_raw_response_get_failover_logs(self, client: Gcore) -> None: + response = client.dns.zones.rrsets.with_raw_response.get_failover_logs( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = response.parse() + assert_matches_type(RrsetGetFailoverLogsResponse, rrset, path=["response"]) + + @parametrize + def test_streaming_response_get_failover_logs(self, client: Gcore) -> None: + with client.dns.zones.rrsets.with_streaming_response.get_failover_logs( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = response.parse() + assert_matches_type(RrsetGetFailoverLogsResponse, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_failover_logs(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + client.dns.zones.rrsets.with_raw_response.get_failover_logs( + rrset_type="rrsetType", + zone_name="", + rrset_name="rrsetName", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): + client.dns.zones.rrsets.with_raw_response.get_failover_logs( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): + client.dns.zones.rrsets.with_raw_response.get_failover_logs( + rrset_type="", + zone_name="zoneName", + rrset_name="rrsetName", + ) + + +class TestAsyncRrsets: + 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: + rrset = await async_client.dns.zones.rrsets.create( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.create( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[ + { + "content": [{}], + "enabled": True, + "meta": {"foo": {}}, + } + ], + meta={}, + pickers=[ + { + "type": "geodns", + "limit": 0, + "strict": True, + } + ], + ttl=0, + ) + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.rrsets.with_raw_response.create( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = await response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.rrsets.with_streaming_response.create( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = await response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.create( + rrset_type="rrsetType", + zone_name="", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.create( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="", + resource_records=[{"content": [{}]}], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.create( + rrset_type="", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.update( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.update( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[ + { + "content": [{}], + "enabled": True, + "meta": {"foo": {}}, + } + ], + meta={}, + pickers=[ + { + "type": "geodns", + "limit": 0, + "strict": True, + } + ], + ttl=0, + ) + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.rrsets.with_raw_response.update( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = await response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.rrsets.with_streaming_response.update( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = await response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.update( + rrset_type="rrsetType", + zone_name="", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.update( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="", + resource_records=[{"content": [{}]}], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.update( + rrset_type="", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.list( + zone_name="zoneName", + ) + assert_matches_type(RrsetListResponse, rrset, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.list( + zone_name="zoneName", + limit=0, + offset=0, + order_by="order_by", + order_direction="asc", + ) + assert_matches_type(RrsetListResponse, rrset, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.rrsets.with_raw_response.list( + zone_name="zoneName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = await response.parse() + assert_matches_type(RrsetListResponse, rrset, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.rrsets.with_streaming_response.list( + zone_name="zoneName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = await response.parse() + assert_matches_type(RrsetListResponse, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.list( + zone_name="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.delete( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) + assert_matches_type(object, rrset, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.rrsets.with_raw_response.delete( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = await response.parse() + assert_matches_type(object, rrset, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.rrsets.with_streaming_response.delete( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = await response.parse() + assert_matches_type(object, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.delete( + rrset_type="rrsetType", + zone_name="", + rrset_name="rrsetName", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.delete( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.delete( + rrset_type="", + zone_name="zoneName", + rrset_name="rrsetName", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.get( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.rrsets.with_raw_response.get( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = await response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.rrsets.with_streaming_response.get( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = await response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.get( + rrset_type="rrsetType", + zone_name="", + rrset_name="rrsetName", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.get( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.get( + rrset_type="", + zone_name="zoneName", + rrset_name="rrsetName", + ) + + @parametrize + async def test_method_get_failover_logs(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.get_failover_logs( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) + assert_matches_type(RrsetGetFailoverLogsResponse, rrset, path=["response"]) + + @parametrize + async def test_method_get_failover_logs_with_all_params(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.get_failover_logs( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + limit=0, + offset=0, + ) + assert_matches_type(RrsetGetFailoverLogsResponse, rrset, path=["response"]) + + @parametrize + async def test_raw_response_get_failover_logs(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.rrsets.with_raw_response.get_failover_logs( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = await response.parse() + assert_matches_type(RrsetGetFailoverLogsResponse, rrset, path=["response"]) + + @parametrize + async def test_streaming_response_get_failover_logs(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.rrsets.with_streaming_response.get_failover_logs( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = await response.parse() + assert_matches_type(RrsetGetFailoverLogsResponse, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_failover_logs(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.get_failover_logs( + rrset_type="rrsetType", + zone_name="", + rrset_name="rrsetName", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.get_failover_logs( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.get_failover_logs( + rrset_type="", + zone_name="zoneName", + rrset_name="rrsetName", + ) diff --git a/tests/api_resources/test_dns.py b/tests/api_resources/test_dns.py new file mode 100644 index 00000000..11bfbc7b --- /dev/null +++ b/tests/api_resources/test_dns.py @@ -0,0 +1,140 @@ +# 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 DNSLookupResponse, DNSGetAccountOverviewResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDNS: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_account_overview(self, client: Gcore) -> None: + dns = client.dns.get_account_overview() + assert_matches_type(DNSGetAccountOverviewResponse, dns, path=["response"]) + + @parametrize + def test_raw_response_get_account_overview(self, client: Gcore) -> None: + response = client.dns.with_raw_response.get_account_overview() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dns = response.parse() + assert_matches_type(DNSGetAccountOverviewResponse, dns, path=["response"]) + + @parametrize + def test_streaming_response_get_account_overview(self, client: Gcore) -> None: + with client.dns.with_streaming_response.get_account_overview() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dns = response.parse() + assert_matches_type(DNSGetAccountOverviewResponse, dns, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_lookup(self, client: Gcore) -> None: + dns = client.dns.lookup() + assert_matches_type(DNSLookupResponse, dns, path=["response"]) + + @parametrize + def test_method_lookup_with_all_params(self, client: Gcore) -> None: + dns = client.dns.lookup( + name="name", + request_server="authoritative_dns", + ) + assert_matches_type(DNSLookupResponse, dns, path=["response"]) + + @parametrize + def test_raw_response_lookup(self, client: Gcore) -> None: + response = client.dns.with_raw_response.lookup() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dns = response.parse() + assert_matches_type(DNSLookupResponse, dns, path=["response"]) + + @parametrize + def test_streaming_response_lookup(self, client: Gcore) -> None: + with client.dns.with_streaming_response.lookup() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dns = response.parse() + assert_matches_type(DNSLookupResponse, dns, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncDNS: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get_account_overview(self, async_client: AsyncGcore) -> None: + dns = await async_client.dns.get_account_overview() + assert_matches_type(DNSGetAccountOverviewResponse, dns, path=["response"]) + + @parametrize + async def test_raw_response_get_account_overview(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.with_raw_response.get_account_overview() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dns = await response.parse() + assert_matches_type(DNSGetAccountOverviewResponse, dns, path=["response"]) + + @parametrize + async def test_streaming_response_get_account_overview(self, async_client: AsyncGcore) -> None: + async with async_client.dns.with_streaming_response.get_account_overview() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dns = await response.parse() + assert_matches_type(DNSGetAccountOverviewResponse, dns, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_lookup(self, async_client: AsyncGcore) -> None: + dns = await async_client.dns.lookup() + assert_matches_type(DNSLookupResponse, dns, path=["response"]) + + @parametrize + async def test_method_lookup_with_all_params(self, async_client: AsyncGcore) -> None: + dns = await async_client.dns.lookup( + name="name", + request_server="authoritative_dns", + ) + assert_matches_type(DNSLookupResponse, dns, path=["response"]) + + @parametrize + async def test_raw_response_lookup(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.with_raw_response.lookup() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + dns = await response.parse() + assert_matches_type(DNSLookupResponse, dns, path=["response"]) + + @parametrize + async def test_streaming_response_lookup(self, async_client: AsyncGcore) -> None: + async with async_client.dns.with_streaming_response.lookup() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + dns = await response.parse() + assert_matches_type(DNSLookupResponse, dns, path=["response"]) + + assert cast(Any, response.is_closed) is True From 2346fdef671ccbde23776df95e5a69ecfc588be6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 06:56:37 +0000 Subject: [PATCH 253/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index b9503f4b..adca4794 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 480 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2759f8cfd08f3fae0172ba6e9949be87b6072b75a5e16516b4d33a914d73b1c6.yml openapi_spec_hash: 2eb719332c26084fd869e1da83adb259 -config_hash: 5f09daa6ebce3d121a6b0c92a0ea1195 +config_hash: 74ca8403bcab2df8661c8a948a59bd0f From ecf1d3a97aee314a68316e9c8184745ba36d5abb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 08:43:13 +0000 Subject: [PATCH 254/592] feat(api): aggregated API specs update --- .stats.yml | 4 +-- api.md | 1 - src/gcore/types/waap/domains/__init__.py | 1 - .../waap/domains/waap_count_statistics.py | 36 ------------------- .../waap/domains/waap_event_statistics.py | 36 +++++++++++++++++-- 5 files changed, 35 insertions(+), 43 deletions(-) delete mode 100644 src/gcore/types/waap/domains/waap_count_statistics.py diff --git a/.stats.yml b/.stats.yml index adca4794..ed529c50 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 480 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2759f8cfd08f3fae0172ba6e9949be87b6072b75a5e16516b4d33a914d73b1c6.yml -openapi_spec_hash: 2eb719332c26084fd869e1da83adb259 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-cffdda88ed6f3057fa907bc82d95d805e77e066617df19a756b573cb95425cbe.yml +openapi_spec_hash: c3cd6fa8bc58b2114976ab33d362d0a9 config_hash: 74ca8403bcab2df8661c8a948a59bd0f diff --git a/api.md b/api.md index 208268cd..6167d032 100644 --- a/api.md +++ b/api.md @@ -1058,7 +1058,6 @@ Types: ```python from gcore.types.waap.domains import ( WaapBlockedStatistics, - WaapCountStatistics, WaapDDOSAttack, WaapDDOSInfo, WaapEventStatistics, diff --git a/src/gcore/types/waap/domains/__init__.py b/src/gcore/types/waap/domains/__init__.py index 905ada2a..ecd5f716 100644 --- a/src/gcore/types/waap/domains/__init__.py +++ b/src/gcore/types/waap/domains/__init__.py @@ -19,7 +19,6 @@ from .waap_request_summary import WaapRequestSummary as WaapRequestSummary from .waap_traffic_metrics import WaapTrafficMetrics as WaapTrafficMetrics from .setting_update_params import SettingUpdateParams as SettingUpdateParams -from .waap_count_statistics import WaapCountStatistics as WaapCountStatistics from .waap_event_statistics import WaapEventStatistics as WaapEventStatistics from .api_path_create_params import APIPathCreateParams as APIPathCreateParams from .api_path_update_params import APIPathUpdateParams as APIPathUpdateParams diff --git a/src/gcore/types/waap/domains/waap_count_statistics.py b/src/gcore/types/waap/domains/waap_count_statistics.py deleted file mode 100644 index eea255ff..00000000 --- a/src/gcore/types/waap/domains/waap_count_statistics.py +++ /dev/null @@ -1,36 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union - -from ...._models import BaseModel - -__all__ = ["WaapCountStatistics"] - - -class WaapCountStatistics(BaseModel): - action: List[List[Union[str, int]]] - """A collection of event counts per action. - - The first item is the action's abbreviation/full action name, and the second - item is the number of events - """ - - country: List[List[Union[str, int]]] - """A collection of event counts per country of origin. - - The first item is the country's ISO 3166-1 alpha-2, and the second item is the - number of events - """ - - org: List[List[Union[str, int]]] - """A collection of event counts per organization that owns the event's client IP. - - The first item is the organization's name, and the second item is the number of - events - """ - - rule_name: List[List[Union[str, int]]] - """A collection of event counts per rule that triggered the event. - - The first item is the rule's name, and the second item is the number of events - """ diff --git a/src/gcore/types/waap/domains/waap_event_statistics.py b/src/gcore/types/waap/domains/waap_event_statistics.py index 26f34fba..1e743ba5 100644 --- a/src/gcore/types/waap/domains/waap_event_statistics.py +++ b/src/gcore/types/waap/domains/waap_event_statistics.py @@ -1,15 +1,45 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import List, Union + from ...._models import BaseModel -from .waap_count_statistics import WaapCountStatistics from .waap_blocked_statistics import WaapBlockedStatistics -__all__ = ["WaapEventStatistics"] +__all__ = ["WaapEventStatistics", "Count"] + + +class Count(BaseModel): + action: List[List[Union[str, int]]] + """A collection of event counts per action. + + The first item is the action's abbreviation/full action name, and the second + item is the number of events + """ + + country: List[List[Union[str, int]]] + """A collection of event counts per country of origin. + + The first item is the country's ISO 3166-1 alpha-2, and the second item is the + number of events + """ + + org: List[List[Union[str, int]]] + """A collection of event counts per organization that owns the event's client IP. + + The first item is the organization's name, and the second item is the number of + events + """ + + rule_name: List[List[Union[str, int]]] + """A collection of event counts per rule that triggered the event. + + The first item is the rule's name, and the second item is the number of events + """ class WaapEventStatistics(BaseModel): blocked: WaapBlockedStatistics """A collection of total numbers of events with blocked results per criteria""" - count: WaapCountStatistics + count: Count """A collection of total numbers of events per criteria""" From 29504f1ed96e9ce93c3cfc45a91cece29328a8c3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 14:33:43 +0000 Subject: [PATCH 255/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/resources/streaming/ai_tasks.py | 4 ++-- src/gcore/resources/streaming/quality_sets.py | 12 +++++------ src/gcore/resources/streaming/statistics.py | 8 ++++---- .../resources/streaming/streams/overlays.py | 4 ++-- .../resources/streaming/streams/streams.py | 20 +++++++++---------- .../resources/streaming/videos/subtitles.py | 16 +++++++-------- .../resources/streaming/videos/videos.py | 12 +++++------ .../types/streaming/create_video_param.py | 4 ++-- src/gcore/types/streaming/playlist_video.py | 4 ++-- src/gcore/types/streaming/stream.py | 4 ++-- src/gcore/types/streaming/video.py | 8 ++++---- .../types/streaming/video_update_params.py | 4 ++-- 13 files changed, 52 insertions(+), 52 deletions(-) diff --git a/.stats.yml b/.stats.yml index ed529c50..db40d8ec 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 480 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-cffdda88ed6f3057fa907bc82d95d805e77e066617df19a756b573cb95425cbe.yml -openapi_spec_hash: c3cd6fa8bc58b2114976ab33d362d0a9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-93ef21f9c0af3c3ab2009ae6ca08995933804f90db347eeab2decafe0f31d59f.yml +openapi_spec_hash: f151bc9cb835b3dab4f91b094b25d320 config_hash: 74ca8403bcab2df8661c8a948a59bd0f diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 9b612e98..da164ad4 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -564,7 +564,7 @@ def get_ai_settings( determination. Example: ``` - curl -L 'https://api.gcore.com/streaming/ai/info?type=`language_support`&`audio_language`=eng&`subtitles_language`=fre' + curl -L 'https://api.gcore.com/streaming/ai/info?type=language_support&audio_language=eng&subtitles_language=fre' { "supported": true } ``` @@ -1152,7 +1152,7 @@ async def get_ai_settings( determination. Example: ``` - curl -L 'https://api.gcore.com/streaming/ai/info?type=`language_support`&`audio_language`=eng&`subtitles_language`=fre' + curl -L 'https://api.gcore.com/streaming/ai/info?type=language_support&audio_language=eng&subtitles_language=fre' { "supported": true } ``` diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index 40bf6368..80e051f3 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -66,9 +66,9 @@ def list( These values are the default for everyone. There is no need to configure anything additional. Read more about qiality in our blog [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality/). - ![Quality ladder](https://demo-files.gvideo.io/apidocs/`encoding_ladder`.png) - Only for those cases when, in addition to the main parameters, it is necessary - to use your own, then it is necessary to use custom quality sets. How to use: + ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) Only + for those cases when, in addition to the main parameters, it is necessary to use + your own, then it is necessary to use custom quality sets. How to use: 1. By default custom quality set is empty – `{ "live":[],"vod":[] }` 2. Request the use of custom quality sets from your manager or the Support Team. @@ -197,9 +197,9 @@ async def list( These values are the default for everyone. There is no need to configure anything additional. Read more about qiality in our blog [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality/). - ![Quality ladder](https://demo-files.gvideo.io/apidocs/`encoding_ladder`.png) - Only for those cases when, in addition to the main parameters, it is necessary - to use your own, then it is necessary to use custom quality sets. How to use: + ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) Only + for those cases when, in addition to the main parameters, it is necessary to use + your own, then it is necessary to use custom quality sets. How to use: 1. By default custom quality set is empty – `{ "live":[],"vod":[] }` 2. Request the use of custom quality sets from your manager or the Support Team. diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 7a763cdc..084ee9c2 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -168,7 +168,7 @@ def get_live_unique_viewers( allows you to break down data with the specified granularity: minutes, hours, days. Based on this method, a graph of unique views in the Customer Portal is built. - ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/`cdn_unique_viewers`.png) + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/cdn_unique_viewers.png) Args: from_: Start of time frame. Format is date time in ISO 8601 @@ -1321,7 +1321,7 @@ def get_vod_unique_viewers_cdn( made with. Works similar to the method `/statistics/cdn/uniqs`. But this allows you to break down data with the specified granularity: minutes, hours, days. Based on this method, a graph of unique views in the Customer Portal is built. - ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/`cdn_unique_viewers`.png) + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/cdn_unique_viewers.png) Args: from_: Start of time frame. Format is date time in ISO 8601 @@ -1590,7 +1590,7 @@ async def get_live_unique_viewers( allows you to break down data with the specified granularity: minutes, hours, days. Based on this method, a graph of unique views in the Customer Portal is built. - ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/`cdn_unique_viewers`.png) + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/cdn_unique_viewers.png) Args: from_: Start of time frame. Format is date time in ISO 8601 @@ -2743,7 +2743,7 @@ async def get_vod_unique_viewers_cdn( made with. Works similar to the method `/statistics/cdn/uniqs`. But this allows you to break down data with the specified granularity: minutes, hours, days. Based on this method, a graph of unique views in the Customer Portal is built. - ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/`cdn_unique_viewers`.png) + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/cdn_unique_viewers.png) Args: from_: Start of time frame. Format is date time in ISO 8601 diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index 6ca214f9..88bf963c 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -65,7 +65,7 @@ def create( There are can be more that 1 overlay over a stream, which are small or stretched over full frame. Overlays can have transparent areas. Frequency of update is 1 FPS. Automatic size scaling for Adaptative Bitrate qualities is applied. - ![HTML Overlays](https://demo-files.gvideo.io/apidocs/`coffee_run_overlays`.gif) + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/coffee_run_overlays.gif) How to activate and use in simple steps: @@ -362,7 +362,7 @@ async def create( There are can be more that 1 overlay over a stream, which are small or stretched over full frame. Overlays can have transparent areas. Frequency of update is 1 FPS. Automatic size scaling for Adaptative Bitrate qualities is applied. - ![HTML Overlays](https://demo-files.gvideo.io/apidocs/`coffee_run_overlays`.gif) + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/coffee_run_overlays.gif) How to activate and use in simple steps: diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index ede9698b..a1596fc9 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -462,7 +462,7 @@ def create_clip( - HLS .m3u8, - MP4, - VOD in video hosting with a permanent link to watch video. - ![HTML Overlays](https://demo-files.gvideo.io/apidocs/`clip_recording_mp4_hls`.gif) + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) **Clip lifetime:** Instant clips are a copy of the stream, created from a live stream. They are stored in memory for a limited time, after which the clip @@ -606,13 +606,13 @@ def list_clips( renditions list in order to get exact bitrate/quality from the set. Example: - HLS 720p: - `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_master`.m3u8 `` + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.m3u8` - HLS 720p: - `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_media_1_360`.m3u8 `` + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_media_1_360.m3u8` - MP4 360p: - `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_master`.mp4 `` + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.mp4` - MP4 360p: - `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_media_1_360`.mp4 `` + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_media_1_360.mp4` Args: extra_headers: Send extra headers @@ -1157,7 +1157,7 @@ async def create_clip( - HLS .m3u8, - MP4, - VOD in video hosting with a permanent link to watch video. - ![HTML Overlays](https://demo-files.gvideo.io/apidocs/`clip_recording_mp4_hls`.gif) + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) **Clip lifetime:** Instant clips are a copy of the stream, created from a live stream. They are stored in memory for a limited time, after which the clip @@ -1301,13 +1301,13 @@ async def list_clips( renditions list in order to get exact bitrate/quality from the set. Example: - HLS 720p: - `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_master`.m3u8 `` + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.m3u8` - HLS 720p: - `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_media_1_360`.m3u8 `` + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_media_1_360.m3u8` - MP4 360p: - `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_master`.mp4 `` + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.mp4` - MP4 360p: - `` https://CID.domain.com/rec/`111_1000`/`rec_d7bsli54p8n4_qsid42_media_1_360`.mp4 `` + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_media_1_360.mp4` Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 58864fc4..bceb7701 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -62,12 +62,12 @@ def create( formats: - SRT – SubRip Text is described on - [wikipedia.org](https://en.wikipedia.org/wiki/SubRip#`SubRip_file_format`). - Must start from integer for sequence number. Use calidators to check the - subtitles, like + [wikipedia.org](https://en.wikipedia.org/wiki/SubRip#SubRip_file_format). Must + start from integer for sequence number. Use calidators to check the subtitles, + like [srt-validator](https://taoning2014.github.io/srt-validator-website/index.html). - WebVTT – Web Video Text Tracks Format is described on - [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/API/`WebVTT_API`). + [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API). Must start from "WEBVTT" header. Use validators to check the subtitles, like [W3C](https://w3c.github.io/webvtt.js/parser.html). Language is 3-letter language code according to ISO-639-2 (bibliographic code). Specify language @@ -320,12 +320,12 @@ async def create( formats: - SRT – SubRip Text is described on - [wikipedia.org](https://en.wikipedia.org/wiki/SubRip#`SubRip_file_format`). - Must start from integer for sequence number. Use calidators to check the - subtitles, like + [wikipedia.org](https://en.wikipedia.org/wiki/SubRip#SubRip_file_format). Must + start from integer for sequence number. Use calidators to check the subtitles, + like [srt-validator](https://taoning2014.github.io/srt-validator-website/index.html). - WebVTT – Web Video Text Tracks Format is described on - [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/API/`WebVTT_API`). + [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API). Must start from "WEBVTT" header. Use validators to check the subtitles, like [W3C](https://w3c.github.io/webvtt.js/parser.html). Language is 3-letter language code according to ISO-639-2 (bibliographic code). Specify language diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index 24d654e6..4e788ab9 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -117,7 +117,7 @@ def create( point several languages to translate to, then a separate subtitle will be generated for each specified language. - How to - ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). The created AI-task(s) will be automatically executed, and result will also be automatically attached to this video as subtitle(s). Please note that transcription is done automatically for all videos uploaded to our video @@ -225,9 +225,9 @@ def update( More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/get-ai-task-result) + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified language(s). Can be used both together with `auto_transcribe_audio_language` @@ -802,7 +802,7 @@ async def create( point several languages to translate to, then a separate subtitle will be generated for each specified language. - How to - ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). The created AI-task(s) will be automatically executed, and result will also be automatically attached to this video as subtitle(s). Please note that transcription is done automatically for all videos uploaded to our video @@ -910,9 +910,9 @@ async def update( More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/get-ai-task-result) + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified language(s). Can be used both together with `auto_transcribe_audio_language` diff --git a/src/gcore/types/streaming/create_video_param.py b/src/gcore/types/streaming/create_video_param.py index a4ce231a..1b280a26 100644 --- a/src/gcore/types/streaming/create_video_param.py +++ b/src/gcore/types/streaming/create_video_param.py @@ -32,9 +32,9 @@ class CreateVideoParam(TypedDict, total=False): More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/get-ai-task-result) + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). """ auto_translate_subtitles_language: Literal["disable", "default", ""] diff --git a/src/gcore/types/streaming/playlist_video.py b/src/gcore/types/streaming/playlist_video.py index 52c65b05..7a011218 100644 --- a/src/gcore/types/streaming/playlist_video.py +++ b/src/gcore/types/streaming/playlist_video.py @@ -33,9 +33,9 @@ class PlaylistVideo(BaseModel): More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/get-ai-task-result) + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). """ auto_translate_subtitles_language: Optional[Literal["disable", "default", ""]] = None diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py index 4aadef8a..a6fd3361 100644 --- a/src/gcore/types/streaming/stream.py +++ b/src/gcore/types/streaming/stream.py @@ -203,7 +203,7 @@ class Stream(BaseModel): requests and compare it with file size (so to use it in your analytics). Such modifier attributes are applied manually and added to the link obtained from this field. I.e. `` ?`get_duration_sec`=true `` Example: - `https://demo.gvideo.io/mpegts/`2675_19146`/`master_mpegts`.m3u8?`get_duration_sec`=true` + `https://demo.gvideo.io/mpegts/2675_19146/master_mpegts.m3u8?get_duration_sec=true` ``` #EXTM3U @@ -239,7 +239,7 @@ class Stream(BaseModel): with limits. That's why you may need to use this HTML web player. Please, look Knowledge Base for details. Example of usage on a web page: - + """ live: Optional[bool] = None diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py index cb2a3026..c34ebcbf 100644 --- a/src/gcore/types/streaming/video.py +++ b/src/gcore/types/streaming/video.py @@ -92,11 +92,11 @@ class ConvertedVideo(BaseModel): **Examples** - Audio-only: - `` https://demo-public.gvideo.io/videos/`2675_JNnccG5l97XPxsov`/`qid3585v1_aac_128_audio`.mp4 `` + `https://demo-public.gvideo.io/videos/2675_JNnccG5l97XPxsov/qid3585v1_aac_128_audio.mp4` - Video: - `` https://demo-public.gvideo.io/videos/`2675_3MlggU4xDb1Ssa5Y`/`qid3567v1_h264_4050_1080`.mp4/download `` + `https://demo-public.gvideo.io/videos/2675_3MlggU4xDb1Ssa5Y/qid3567v1_h264_4050_1080.mp4/download` - Video with custom download filename: - `` https://demo-public.gvideo.io/videos/`2675_XtMKxzJM6Xt7SBUV`/1080.mp4/download=`highlights_v1`.`1_2025`-05-30 `` + `https://demo-public.gvideo.io/videos/2675_XtMKxzJM6Xt7SBUV/1080.mp4/download=highlights_v1.1_2025-05-30` """ name: Optional[str] = None @@ -270,7 +270,7 @@ class Video(BaseModel): direct link. Also the video player can be integrated into your web pages using the Iframe tag. Example of usage on a web page: - + There are some link modificators you can specify and add manually: - ?`no_low_latency` – player is forced to use non-low-latency streams HLS MPEG TS, instead of MPEG-DASH CMAF or HLS/LL-HLS CMAF. diff --git a/src/gcore/types/streaming/video_update_params.py b/src/gcore/types/streaming/video_update_params.py index bdf6f4ec..b5facd04 100644 --- a/src/gcore/types/streaming/video_update_params.py +++ b/src/gcore/types/streaming/video_update_params.py @@ -32,9 +32,9 @@ class VideoUpdateParams(TypedDict, total=False): More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/get-ai-task-result) + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/subtitles/add-subtitle). + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). """ auto_translate_subtitles_language: Literal["disable", "default", ""] From 51e89a313116bc399985dc40d46228b4228bb1f3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 Aug 2025 08:23:35 +0000 Subject: [PATCH 256/592] chore: update github action --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1cd880c7..50910217 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: run: ./scripts/lint build: - if: github.repository == 'stainless-sdks/gcore-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork timeout-minutes: 10 name: build permissions: @@ -61,12 +61,14 @@ jobs: run: rye build - name: Get GitHub OIDC Token + if: github.repository == 'stainless-sdks/gcore-python' id: github-oidc uses: actions/github-script@v6 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Upload tarball + if: github.repository == 'stainless-sdks/gcore-python' env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} From 5bed9c9d00c5b29b8b3c32951d9f02da84c79cb8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 Aug 2025 09:07:54 +0000 Subject: [PATCH 257/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index db40d8ec..e44cff31 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 480 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-93ef21f9c0af3c3ab2009ae6ca08995933804f90db347eeab2decafe0f31d59f.yml openapi_spec_hash: f151bc9cb835b3dab4f91b094b25d320 -config_hash: 74ca8403bcab2df8661c8a948a59bd0f +config_hash: dbf10aa8f50ffee4df7ed95b2b42f9a9 From 18e9e1434fe6e1b071b167be4dcc2fb455c62dd6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 Aug 2025 14:28:43 +0000 Subject: [PATCH 258/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/dns/metrics.py | 20 ++++----- src/gcore/resources/streaming/ai_tasks.py | 32 +++++++------- src/gcore/resources/streaming/playlists.py | 12 ++--- .../resources/streaming/streams/streams.py | 12 ++--- .../resources/streaming/videos/videos.py | 44 +++++++++---------- .../types/streaming/create_video_param.py | 12 ++--- src/gcore/types/streaming/playlist.py | 2 +- .../types/streaming/playlist_create_params.py | 2 +- .../types/streaming/playlist_update_params.py | 2 +- src/gcore/types/streaming/playlist_video.py | 12 ++--- src/gcore/types/streaming/stream.py | 6 +-- .../types/streaming/stream_create_params.py | 2 +- .../types/streaming/stream_update_params.py | 2 +- src/gcore/types/streaming/video.py | 10 ++--- .../types/streaming/video_update_params.py | 12 ++--- 16 files changed, 93 insertions(+), 93 deletions(-) diff --git a/.stats.yml b/.stats.yml index e44cff31..4657825d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 480 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-93ef21f9c0af3c3ab2009ae6ca08995933804f90db347eeab2decafe0f31d59f.yml -openapi_spec_hash: f151bc9cb835b3dab4f91b094b25d320 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ad822cb823f7d765256dbd87b46bcf24f039041956282c13ff404e66845f5343.yml +openapi_spec_hash: 2b59f389c7eeec147f29ee1f22a54a55 config_hash: dbf10aa8f50ffee4df7ed95b2b42f9a9 diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index 790f074f..ca9b754a 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -58,11 +58,11 @@ def list( Example of success response: ``` - # HELP `healthcheck_state` The `healthcheck_state` metric reflects the state of a specific monitor after conducting a health check - # TYPE `healthcheck_state` gauge - `healthcheck_state`{`client_id`="1",`monitor_id`="431",`monitor_locations`="us-east-1,us-west-1",`monitor_name`="test-monitor-1",`monitor_type`="http",`rrset_name`="rrset-name1",`rrset_type`="rrset-type1",`zone_name`="zone-name1"} 0 - `healthcheck_state`{`client_id`="1",`monitor_id`="4871",`monitor_locations`="fr-1,fr-2",`monitor_name`="test-monitor-2",`monitor_type`="tcp",`rrset_name`="rrset-name2",`rrset_type`="rrset-type2",`zone_name`="zone-name2"} 1 - `healthcheck_state`{`client_id`="2",`monitor_id`="7123",`monitor_locations`="ua-1,ua-2",`monitor_name`="test-monitor-3",`monitor_type`="icmp",`rrset_name`="rrset-name3",`rrset_type`="rrset-type3",`zone_name`="zone-name3"} 0 + # HELP healthcheck_state The `healthcheck_state` metric reflects the state of a specific monitor after conducting a health check + # TYPE healthcheck_state gauge + healthcheck_state{client_id="1",monitor_id="431",monitor_locations="us-east-1,us-west-1",monitor_name="test-monitor-1",monitor_type="http",rrset_name="rrset-name1",rrset_type="rrset-type1",zone_name="zone-name1"} 0 + healthcheck_state{client_id="1",monitor_id="4871",monitor_locations="fr-1,fr-2",monitor_name="test-monitor-2",monitor_type="tcp",rrset_name="rrset-name2",rrset_type="rrset-type2",zone_name="zone-name2"} 1 + healthcheck_state{client_id="2",monitor_id="7123",monitor_locations="ua-1,ua-2",monitor_name="test-monitor-3",monitor_type="icmp",rrset_name="rrset-name3",rrset_type="rrset-type3",zone_name="zone-name3"} 0 ``` Args: @@ -136,11 +136,11 @@ async def list( Example of success response: ``` - # HELP `healthcheck_state` The `healthcheck_state` metric reflects the state of a specific monitor after conducting a health check - # TYPE `healthcheck_state` gauge - `healthcheck_state`{`client_id`="1",`monitor_id`="431",`monitor_locations`="us-east-1,us-west-1",`monitor_name`="test-monitor-1",`monitor_type`="http",`rrset_name`="rrset-name1",`rrset_type`="rrset-type1",`zone_name`="zone-name1"} 0 - `healthcheck_state`{`client_id`="1",`monitor_id`="4871",`monitor_locations`="fr-1,fr-2",`monitor_name`="test-monitor-2",`monitor_type`="tcp",`rrset_name`="rrset-name2",`rrset_type`="rrset-type2",`zone_name`="zone-name2"} 1 - `healthcheck_state`{`client_id`="2",`monitor_id`="7123",`monitor_locations`="ua-1,ua-2",`monitor_name`="test-monitor-3",`monitor_type`="icmp",`rrset_name`="rrset-name3",`rrset_type`="rrset-type3",`zone_name`="zone-name3"} 0 + # HELP healthcheck_state The `healthcheck_state` metric reflects the state of a specific monitor after conducting a health check + # TYPE healthcheck_state gauge + healthcheck_state{client_id="1",monitor_id="431",monitor_locations="us-east-1,us-west-1",monitor_name="test-monitor-1",monitor_type="http",rrset_name="rrset-name1",rrset_type="rrset-type1",zone_name="zone-name1"} 0 + healthcheck_state{client_id="1",monitor_id="4871",monitor_locations="fr-1,fr-2",monitor_name="test-monitor-2",monitor_type="tcp",rrset_name="rrset-name2",rrset_type="rrset-type2",zone_name="zone-name2"} 1 + healthcheck_state{client_id="2",monitor_id="7123",monitor_locations="ua-1,ua-2",monitor_name="test-monitor-3",monitor_type="icmp",rrset_name="rrset-name3",rrset_type="rrset-type3",zone_name="zone-name3"} 0 ``` Args: diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index da164ad4..300984bb 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -84,7 +84,7 @@ def create( How to use: - Create an AI task, specify algoritm to use - Get `task_id` - - Check a result using `` .../ai/tasks/{`task_id`} `` method For more detailed + - Check a result using `.../ai/tasks/{task_id}` method For more detailed information, see the description of each method separately. **AI Automatic Speech Recognition (ASR)** AI is instrumental in automatic video @@ -109,15 +109,15 @@ def create( "result": { "subtitles": [ { - "`start_time`": "00:00:00.031", - "`end_time`": "00:00:03.831", + "start_time": "00:00:00.031", + "end_time": "00:00:03.831", "text": "Come on team, ..." }, ... ] "vttContent": "WEBVTT\n\n1\n00:00:00.031 --> 00:00:03.831\nCome on team, ...", - "`concatenated_text`": "Come on team, ...", + "concatenated_text": "Come on team, ...", "languages": [ "eng" ], - "`speech_detected`": true + "speech_detected": true } }, ... } @@ -158,9 +158,9 @@ def create( { "status": "SUCCESS", "result": { - "`nsfw_detected`": true, - "`detection_results`": ["nsfw"], - "frames": [{"label": "nsfw", "confidence": 1.0, "`frame_number`": 24}, ...], + "nsfw_detected": true, + "detection_results": ["nsfw"], + "frames": [{"label": "nsfw", "confidence": 1.0, "frame_number": 24}, ...], }, } ``` @@ -672,7 +672,7 @@ async def create( How to use: - Create an AI task, specify algoritm to use - Get `task_id` - - Check a result using `` .../ai/tasks/{`task_id`} `` method For more detailed + - Check a result using `.../ai/tasks/{task_id}` method For more detailed information, see the description of each method separately. **AI Automatic Speech Recognition (ASR)** AI is instrumental in automatic video @@ -697,15 +697,15 @@ async def create( "result": { "subtitles": [ { - "`start_time`": "00:00:00.031", - "`end_time`": "00:00:03.831", + "start_time": "00:00:00.031", + "end_time": "00:00:03.831", "text": "Come on team, ..." }, ... ] "vttContent": "WEBVTT\n\n1\n00:00:00.031 --> 00:00:03.831\nCome on team, ...", - "`concatenated_text`": "Come on team, ...", + "concatenated_text": "Come on team, ...", "languages": [ "eng" ], - "`speech_detected`": true + "speech_detected": true } }, ... } @@ -746,9 +746,9 @@ async def create( { "status": "SUCCESS", "result": { - "`nsfw_detected`": true, - "`detection_results`": ["nsfw"], - "frames": [{"label": "nsfw", "confidence": 1.0, "`frame_number`": 24}, ...], + "nsfw_detected": true, + "detection_results": ["nsfw"], + "frames": [{"label": "nsfw", "confidence": 1.0, "frame_number": 24}, ...], }, } ``` diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index f8994ca0..6335e017 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -125,7 +125,7 @@ def create( active: true loop: false name: "Playlist: Webinar 'Onboarding for new employees on working with the corporate portal'" - `start_time`: "2024-07-01T11:00:00Z" + start_time: "2024-07-01T11:00:00Z" ``` Args: @@ -160,7 +160,7 @@ def create( 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: - `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented @@ -291,7 +291,7 @@ def update( 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: - `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented @@ -593,7 +593,7 @@ async def create( active: true loop: false name: "Playlist: Webinar 'Onboarding for new employees on working with the corporate portal'" - `start_time`: "2024-07-01T11:00:00Z" + start_time: "2024-07-01T11:00:00Z" ``` Args: @@ -628,7 +628,7 @@ async def create( 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: - `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented @@ -759,7 +759,7 @@ async def update( 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: - `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index a1596fc9..303565c7 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -162,7 +162,7 @@ def create( entity: video source, video id, parameters, etc. We do not use this field in any way when processing the stream. You can store any data in any format (string, json, etc), saved as a text string. Example: - `` client_entity_data = '{ "`seq_id`": "1234567890", "name": "John Doe", "iat": 1516239022 }' `` + `client_entity_data = '{ "seq_id": "1234567890", "name": "John Doe", "iat": 1516239022 }'` client_user_id: Custom meta field for storing the Identifier in your system. We do not use this field in any way when processing the stream. Example: `client_user_id = 1001` @@ -379,8 +379,8 @@ def delete( Perhaps, instead of deleting, you may use the stream deactivation: ``` - PATCH /videos/{`stream_id`} - { "active": false } + PATCH / videos / {stream_id} + {"active": false} ``` For details, see the Product Documentation. @@ -857,7 +857,7 @@ async def create( entity: video source, video id, parameters, etc. We do not use this field in any way when processing the stream. You can store any data in any format (string, json, etc), saved as a text string. Example: - `` client_entity_data = '{ "`seq_id`": "1234567890", "name": "John Doe", "iat": 1516239022 }' `` + `client_entity_data = '{ "seq_id": "1234567890", "name": "John Doe", "iat": 1516239022 }'` client_user_id: Custom meta field for storing the Identifier in your system. We do not use this field in any way when processing the stream. Example: `client_user_id = 1001` @@ -1074,8 +1074,8 @@ async def delete( Perhaps, instead of deleting, you may use the stream deactivation: ``` - PATCH /videos/{`stream_id`} - { "active": false } + PATCH / videos / {stream_id} + {"active": false} ``` For details, see the Product Documentation. diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index 4e788ab9..2789c54d 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -194,9 +194,9 @@ def update( "duration", "`hls_url`", etc. Examples of changing: - Name: `{ "name": "new name of the video" }` - - Move the video to a new directory: `` { "`directory_id`": 200 }`` Please note - that some parameters are used on initial step (before transcoding) only, so - after transcoding there is no use in changing their values. For example, + - Move the video to a new directory: ` { "directory_id": 200 }` Please note that + some parameters are used on initial step (before transcoding) only, so after + transcoding there is no use in changing their values. For example, "`origin_url`" parameter is used for downloading an original file from a source and never used after transcoding; or "priority" parameter is used to set priority of processing and never used after transcoding. @@ -218,8 +218,8 @@ def update( attribute of API POST /streaming/ai/transcribe . Example: ``` - `auto_transcribe_audio_language`: "auto" - `auto_transcribe_audio_language`: "ger" + auto_transcribe_audio_language: "auto" + auto_transcribe_audio_language: "ger" ``` More details: @@ -242,8 +242,8 @@ def update( subtitle will be generated for each language. Example: ``` - `auto_translate_subtitles_language`: default - `auto_translate_subtitles_language`: eng,fre,ger + auto_translate_subtitles_language: default + auto_translate_subtitles_language: eng,fre,ger ``` Please note that subtitle translation is done separately and after @@ -279,8 +279,8 @@ def update( POST https://api.gcore.com/streaming/videos "video": { "name": "IBC 2024 intro.mp4", - "`origin_url`": "https://www.googleapis.com/drive/v3/files/...?alt=media", - "`origin_http_headers`": "Authorization: Bearer ABC" + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "origin_http_headers": "Authorization: Bearer ABC" } ``` @@ -662,8 +662,8 @@ def get_parameters_for_direct_upload( metadata: { filename: data.video.name, token: data.token, - `video_id`: data.video.id, - `client_id`: data.video.`client_id` + video_id: data.video.id, + client_id: data.video.client_id }, onSuccess: function() { ... @@ -879,9 +879,9 @@ async def update( "duration", "`hls_url`", etc. Examples of changing: - Name: `{ "name": "new name of the video" }` - - Move the video to a new directory: `` { "`directory_id`": 200 }`` Please note - that some parameters are used on initial step (before transcoding) only, so - after transcoding there is no use in changing their values. For example, + - Move the video to a new directory: ` { "directory_id": 200 }` Please note that + some parameters are used on initial step (before transcoding) only, so after + transcoding there is no use in changing their values. For example, "`origin_url`" parameter is used for downloading an original file from a source and never used after transcoding; or "priority" parameter is used to set priority of processing and never used after transcoding. @@ -903,8 +903,8 @@ async def update( attribute of API POST /streaming/ai/transcribe . Example: ``` - `auto_transcribe_audio_language`: "auto" - `auto_transcribe_audio_language`: "ger" + auto_transcribe_audio_language: "auto" + auto_transcribe_audio_language: "ger" ``` More details: @@ -927,8 +927,8 @@ async def update( subtitle will be generated for each language. Example: ``` - `auto_translate_subtitles_language`: default - `auto_translate_subtitles_language`: eng,fre,ger + auto_translate_subtitles_language: default + auto_translate_subtitles_language: eng,fre,ger ``` Please note that subtitle translation is done separately and after @@ -964,8 +964,8 @@ async def update( POST https://api.gcore.com/streaming/videos "video": { "name": "IBC 2024 intro.mp4", - "`origin_url`": "https://www.googleapis.com/drive/v3/files/...?alt=media", - "`origin_http_headers`": "Authorization: Bearer ABC" + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "origin_http_headers": "Authorization: Bearer ABC" } ``` @@ -1351,8 +1351,8 @@ async def get_parameters_for_direct_upload( metadata: { filename: data.video.name, token: data.token, - `video_id`: data.video.id, - `client_id`: data.video.`client_id` + video_id: data.video.id, + client_id: data.video.client_id }, onSuccess: function() { ... diff --git a/src/gcore/types/streaming/create_video_param.py b/src/gcore/types/streaming/create_video_param.py index 1b280a26..dd0156bf 100644 --- a/src/gcore/types/streaming/create_video_param.py +++ b/src/gcore/types/streaming/create_video_param.py @@ -25,8 +25,8 @@ class CreateVideoParam(TypedDict, total=False): attribute of API POST /streaming/ai/transcribe . Example: ``` - `auto_transcribe_audio_language`: "auto" - `auto_transcribe_audio_language`: "ger" + auto_transcribe_audio_language: "auto" + auto_transcribe_audio_language: "ger" ``` More details: @@ -53,8 +53,8 @@ class CreateVideoParam(TypedDict, total=False): subtitle will be generated for each language. Example: ``` - `auto_translate_subtitles_language`: default - `auto_translate_subtitles_language`: eng,fre,ger + auto_translate_subtitles_language: default + auto_translate_subtitles_language: eng,fre,ger ``` Please note that subtitle translation is done separately and after @@ -106,8 +106,8 @@ class CreateVideoParam(TypedDict, total=False): POST https://api.gcore.com/streaming/videos "video": { "name": "IBC 2024 intro.mp4", - "`origin_url`": "https://www.googleapis.com/drive/v3/files/...?alt=media", - "`origin_http_headers`": "Authorization: Bearer ABC" + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "origin_http_headers": "Authorization: Bearer ABC" } ``` """ diff --git a/src/gcore/types/streaming/playlist.py b/src/gcore/types/streaming/playlist.py index 4e814af1..677306e0 100644 --- a/src/gcore/types/streaming/playlist.py +++ b/src/gcore/types/streaming/playlist.py @@ -49,7 +49,7 @@ class Playlist(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: - `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented diff --git a/src/gcore/types/streaming/playlist_create_params.py b/src/gcore/types/streaming/playlist_create_params.py index 48fcffe0..f8043bbe 100644 --- a/src/gcore/types/streaming/playlist_create_params.py +++ b/src/gcore/types/streaming/playlist_create_params.py @@ -49,7 +49,7 @@ class PlaylistCreateParams(TypedDict, total=False): 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: - `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented diff --git a/src/gcore/types/streaming/playlist_update_params.py b/src/gcore/types/streaming/playlist_update_params.py index bf2e1489..a8f2a06e 100644 --- a/src/gcore/types/streaming/playlist_update_params.py +++ b/src/gcore/types/streaming/playlist_update_params.py @@ -49,7 +49,7 @@ class PlaylistUpdateParams(TypedDict, total=False): 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: - `` /playlists/{`client_id`}_{`playlist_id`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented diff --git a/src/gcore/types/streaming/playlist_video.py b/src/gcore/types/streaming/playlist_video.py index 7a011218..e1c19d60 100644 --- a/src/gcore/types/streaming/playlist_video.py +++ b/src/gcore/types/streaming/playlist_video.py @@ -26,8 +26,8 @@ class PlaylistVideo(BaseModel): attribute of API POST /streaming/ai/transcribe . Example: ``` - `auto_transcribe_audio_language`: "auto" - `auto_transcribe_audio_language`: "ger" + auto_transcribe_audio_language: "auto" + auto_transcribe_audio_language: "ger" ``` More details: @@ -54,8 +54,8 @@ class PlaylistVideo(BaseModel): subtitle will be generated for each language. Example: ``` - `auto_translate_subtitles_language`: default - `auto_translate_subtitles_language`: eng,fre,ger + auto_translate_subtitles_language: default + auto_translate_subtitles_language: eng,fre,ger ``` Please note that subtitle translation is done separately and after @@ -107,8 +107,8 @@ class PlaylistVideo(BaseModel): POST https://api.gcore.com/streaming/videos "video": { "name": "IBC 2024 intro.mp4", - "`origin_url`": "https://www.googleapis.com/drive/v3/files/...?alt=media", - "`origin_http_headers`": "Authorization: Bearer ABC" + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "origin_http_headers": "Authorization: Bearer ABC" } ``` """ diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py index a6fd3361..f2fca186 100644 --- a/src/gcore/types/streaming/stream.py +++ b/src/gcore/types/streaming/stream.py @@ -89,7 +89,7 @@ class Stream(BaseModel): entity: video source, video id, parameters, etc. We do not use this field in any way when processing the stream. You can store any data in any format (string, json, etc), saved as a text string. Example: - `` client_entity_data = '{ "`seq_id`": "1234567890", "name": "John Doe", "iat": 1516239022 }' `` + `client_entity_data = '{ "seq_id": "1234567890", "name": "John Doe", "iat": 1516239022 }'` """ client_user_id: Optional[int] = None @@ -202,7 +202,7 @@ class Stream(BaseModel): determine duration in seconds at the level of analyzing the logs of CDN requests and compare it with file size (so to use it in your analytics). Such modifier attributes are applied manually and added to the link obtained from - this field. I.e. `` ?`get_duration_sec`=true `` Example: + this field. I.e. `?get_duration_sec=true` Example: `https://demo.gvideo.io/mpegts/2675_19146/master_mpegts.m3u8?get_duration_sec=true` ``` @@ -212,7 +212,7 @@ class Stream(BaseModel): ... #EXTINF:2.000000, #EXT-X-PROGRAM-DATE-TIME:2025-08-14T08:15:00 - seg1.ts?`duration_sec`=2 + seg1.ts?duration_sec=2 ... ``` """ diff --git a/src/gcore/types/streaming/stream_create_params.py b/src/gcore/types/streaming/stream_create_params.py index 827874ce..8c19a2d0 100644 --- a/src/gcore/types/streaming/stream_create_params.py +++ b/src/gcore/types/streaming/stream_create_params.py @@ -57,7 +57,7 @@ class StreamCreateParams(TypedDict, total=False): entity: video source, video id, parameters, etc. We do not use this field in any way when processing the stream. You can store any data in any format (string, json, etc), saved as a text string. Example: - `` client_entity_data = '{ "`seq_id`": "1234567890", "name": "John Doe", "iat": 1516239022 }' `` + `client_entity_data = '{ "seq_id": "1234567890", "name": "John Doe", "iat": 1516239022 }'` """ client_user_id: int diff --git a/src/gcore/types/streaming/stream_update_params.py b/src/gcore/types/streaming/stream_update_params.py index 55a3430f..0f30b641 100644 --- a/src/gcore/types/streaming/stream_update_params.py +++ b/src/gcore/types/streaming/stream_update_params.py @@ -61,7 +61,7 @@ class Stream(TypedDict, total=False): entity: video source, video id, parameters, etc. We do not use this field in any way when processing the stream. You can store any data in any format (string, json, etc), saved as a text string. Example: - `` client_entity_data = '{ "`seq_id`": "1234567890", "name": "John Doe", "iat": 1516239022 }' `` + `client_entity_data = '{ "seq_id": "1234567890", "name": "John Doe", "iat": 1516239022 }'` """ client_user_id: int diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py index c34ebcbf..61cd5d10 100644 --- a/src/gcore/types/streaming/video.py +++ b/src/gcore/types/streaming/video.py @@ -64,7 +64,7 @@ class ConvertedVideo(BaseModel): ``` - ````– Video height, or word "audio" if it is an audio-only file. Note that this link format has been applied since 14.08.2024. If the video entity was uploaded earlier, links may have old simplified format. - Example: ``` /videos/{`client_id`}_{slug}/`qid3567v1_h264_4050_1080`.mp4 ``` + Example: ``` /videos/{client_id}_{slug}/qid3567v1_h264_4050_1080.mp4 ``` ```` @@ -171,8 +171,8 @@ 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 `` - List of suffix-options: + `/videos/{client_id}_{slug}/master[-min-N][-max-N][-(h264|hevc|av1)].mpd` List + of suffix-options: - [-min-N] – ABR soft limitation of qualities from below. - [-max-N] – ABR soft limitation of qualities from above. @@ -231,7 +231,7 @@ class Video(BaseModel): You can also manually specify suffix-options that will allow you to change the manifest to your request: - `` /videos/{`client_id`}_{`video_slug`}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 `` + `/videos/{client_id}_{video_slug}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` List of suffix-options: - [-cmaf] – getting HLS CMAF version of the manifest. Look at the `hls_cmaf_url` @@ -312,7 +312,7 @@ class Video(BaseModel): like viewing an MP4 rendition. The MP4 file becomes available for downloading when the video entity "status" changes from "new" to "pending". The file is stored for 7 days, after which it will be automatically deleted. Format of URL - is `` /videos/_/`origin__`.mp4 `` Where: + is `/videos/_/origin__.mp4` Where: - ```– Encoding bitrate in Kbps. ``` diff --git a/src/gcore/types/streaming/video_update_params.py b/src/gcore/types/streaming/video_update_params.py index b5facd04..c358f0d4 100644 --- a/src/gcore/types/streaming/video_update_params.py +++ b/src/gcore/types/streaming/video_update_params.py @@ -25,8 +25,8 @@ class VideoUpdateParams(TypedDict, total=False): attribute of API POST /streaming/ai/transcribe . Example: ``` - `auto_transcribe_audio_language`: "auto" - `auto_transcribe_audio_language`: "ger" + auto_transcribe_audio_language: "auto" + auto_transcribe_audio_language: "ger" ``` More details: @@ -53,8 +53,8 @@ class VideoUpdateParams(TypedDict, total=False): subtitle will be generated for each language. Example: ``` - `auto_translate_subtitles_language`: default - `auto_translate_subtitles_language`: eng,fre,ger + auto_translate_subtitles_language: default + auto_translate_subtitles_language: eng,fre,ger ``` Please note that subtitle translation is done separately and after @@ -106,8 +106,8 @@ class VideoUpdateParams(TypedDict, total=False): POST https://api.gcore.com/streaming/videos "video": { "name": "IBC 2024 intro.mp4", - "`origin_url`": "https://www.googleapis.com/drive/v3/files/...?alt=media", - "`origin_http_headers`": "Authorization: Bearer ABC" + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "origin_http_headers": "Authorization: Bearer ABC" } ``` """ From d8b3951b618a77bf33e100c82d95d37ddc078e98 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 24 Aug 2025 02:39:02 +0000 Subject: [PATCH 259/592] chore(internal): codegen related update --- src/gcore/types/streaming/max_stream_series.py | 10 +++++----- src/gcore/types/streaming/meet_series.py | 10 +++++----- src/gcore/types/streaming/storage_series.py | 10 +++++----- src/gcore/types/streaming/stream_series.py | 10 +++++----- src/gcore/types/streaming/vod_statistics_series.py | 10 +++++----- .../streaming/vod_total_stream_duration_series.py | 6 +++--- src/gcore/types/waap/waap_ip_ddos_info_model.py | 6 +++--- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/gcore/types/streaming/max_stream_series.py b/src/gcore/types/streaming/max_stream_series.py index 13cd4451..bd2166bf 100644 --- a/src/gcore/types/streaming/max_stream_series.py +++ b/src/gcore/types/streaming/max_stream_series.py @@ -5,17 +5,17 @@ from ..._models import BaseModel -__all__ = ["MaxStreamSeries", "MaxStreamSeryItem", "MaxStreamSeryItemMetrics"] +__all__ = ["MaxStreamSeries", "MaxStreamSeriesItem", "MaxStreamSeriesItemMetrics"] -class MaxStreamSeryItemMetrics(BaseModel): +class MaxStreamSeriesItemMetrics(BaseModel): streams: List[int] -class MaxStreamSeryItem(BaseModel): +class MaxStreamSeriesItem(BaseModel): client: int - metrics: MaxStreamSeryItemMetrics + metrics: MaxStreamSeriesItemMetrics -MaxStreamSeries: TypeAlias = List[MaxStreamSeryItem] +MaxStreamSeries: TypeAlias = List[MaxStreamSeriesItem] diff --git a/src/gcore/types/streaming/meet_series.py b/src/gcore/types/streaming/meet_series.py index 1b35d0f7..cc71be98 100644 --- a/src/gcore/types/streaming/meet_series.py +++ b/src/gcore/types/streaming/meet_series.py @@ -5,19 +5,19 @@ from ..._models import BaseModel -__all__ = ["MeetSeries", "MeetSeryItem", "MeetSeryItemMetrics"] +__all__ = ["MeetSeries", "MeetSeriesItem", "MeetSeriesItemMetrics"] -class MeetSeryItemMetrics(BaseModel): +class MeetSeriesItemMetrics(BaseModel): max_meet_usage: Optional[List[int]] = None meet: Optional[List[List[int]]] = None -class MeetSeryItem(BaseModel): +class MeetSeriesItem(BaseModel): client: int - metrics: MeetSeryItemMetrics + metrics: MeetSeriesItemMetrics -MeetSeries: TypeAlias = List[MeetSeryItem] +MeetSeries: TypeAlias = List[MeetSeriesItem] diff --git a/src/gcore/types/streaming/storage_series.py b/src/gcore/types/streaming/storage_series.py index 64b971d9..34d459e0 100644 --- a/src/gcore/types/streaming/storage_series.py +++ b/src/gcore/types/streaming/storage_series.py @@ -5,19 +5,19 @@ from ..._models import BaseModel -__all__ = ["StorageSeries", "StorageSeryItem", "StorageSeryItemMetrics"] +__all__ = ["StorageSeries", "StorageSeriesItem", "StorageSeriesItemMetrics"] -class StorageSeryItemMetrics(BaseModel): +class StorageSeriesItemMetrics(BaseModel): max_volume_usage: List[int] storage: List[List[int]] -class StorageSeryItem(BaseModel): +class StorageSeriesItem(BaseModel): client: int - metrics: StorageSeryItemMetrics + metrics: StorageSeriesItemMetrics -StorageSeries: TypeAlias = List[StorageSeryItem] +StorageSeries: TypeAlias = List[StorageSeriesItem] diff --git a/src/gcore/types/streaming/stream_series.py b/src/gcore/types/streaming/stream_series.py index 0d941224..4e14f573 100644 --- a/src/gcore/types/streaming/stream_series.py +++ b/src/gcore/types/streaming/stream_series.py @@ -5,17 +5,17 @@ from ..._models import BaseModel -__all__ = ["StreamSeries", "StreamSeryItem", "StreamSeryItemMetrics"] +__all__ = ["StreamSeries", "StreamSeriesItem", "StreamSeriesItemMetrics"] -class StreamSeryItemMetrics(BaseModel): +class StreamSeriesItemMetrics(BaseModel): streams: List[int] -class StreamSeryItem(BaseModel): +class StreamSeriesItem(BaseModel): client: int - metrics: StreamSeryItemMetrics + metrics: StreamSeriesItemMetrics -StreamSeries: TypeAlias = List[StreamSeryItem] +StreamSeries: TypeAlias = List[StreamSeriesItem] diff --git a/src/gcore/types/streaming/vod_statistics_series.py b/src/gcore/types/streaming/vod_statistics_series.py index 2e82bbb3..7b268b3f 100644 --- a/src/gcore/types/streaming/vod_statistics_series.py +++ b/src/gcore/types/streaming/vod_statistics_series.py @@ -5,17 +5,17 @@ from ..._models import BaseModel -__all__ = ["VodStatisticsSeries", "VodStatisticsSeryItem", "VodStatisticsSeryItemMetrics"] +__all__ = ["VodStatisticsSeries", "VodStatisticsSeriesItem", "VodStatisticsSeriesItemMetrics"] -class VodStatisticsSeryItemMetrics(BaseModel): +class VodStatisticsSeriesItemMetrics(BaseModel): vod: List[int] -class VodStatisticsSeryItem(BaseModel): +class VodStatisticsSeriesItem(BaseModel): client: int - metrics: VodStatisticsSeryItemMetrics + metrics: VodStatisticsSeriesItemMetrics -VodStatisticsSeries: TypeAlias = List[VodStatisticsSeryItem] +VodStatisticsSeries: TypeAlias = List[VodStatisticsSeriesItem] diff --git a/src/gcore/types/streaming/vod_total_stream_duration_series.py b/src/gcore/types/streaming/vod_total_stream_duration_series.py index a938a1fe..28dc7dda 100644 --- a/src/gcore/types/streaming/vod_total_stream_duration_series.py +++ b/src/gcore/types/streaming/vod_total_stream_duration_series.py @@ -5,10 +5,10 @@ from ..._models import BaseModel -__all__ = ["VodTotalStreamDurationSeries", "VodTotalStreamDurationSeryItem"] +__all__ = ["VodTotalStreamDurationSeries", "VodTotalStreamDurationSeriesItem"] -class VodTotalStreamDurationSeryItem(BaseModel): +class VodTotalStreamDurationSeriesItem(BaseModel): client: int duration: int @@ -19,4 +19,4 @@ class VodTotalStreamDurationSeryItem(BaseModel): stream_id: Optional[str] = None -VodTotalStreamDurationSeries: TypeAlias = List[VodTotalStreamDurationSeryItem] +VodTotalStreamDurationSeries: TypeAlias = List[VodTotalStreamDurationSeriesItem] diff --git a/src/gcore/types/waap/waap_ip_ddos_info_model.py b/src/gcore/types/waap/waap_ip_ddos_info_model.py index 03be1722..14450304 100644 --- a/src/gcore/types/waap/waap_ip_ddos_info_model.py +++ b/src/gcore/types/waap/waap_ip_ddos_info_model.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["WaapIPDDOSInfoModel", "TimeSery"] +__all__ = ["WaapIPDDOSInfoModel", "TimeSeries"] -class TimeSery(BaseModel): +class TimeSeries(BaseModel): count: int """The number of attacks""" @@ -19,5 +19,5 @@ class WaapIPDDOSInfoModel(BaseModel): botnet_client: bool """Indicates if the IP is tagged as a botnet client""" - time_series: List[TimeSery] + time_series: List[TimeSeries] """The time series data for the DDoS attacks from the IP address""" From 73d01ca77f82ec177527bef6acb7644c008ba759 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 25 Aug 2025 15:50:34 +0000 Subject: [PATCH 260/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/streaming/ai_tasks.py | 62 +++++----- src/gcore/resources/streaming/playlists.py | 28 ++--- .../resources/streaming/streams/streams.py | 6 +- .../resources/streaming/videos/subtitles.py | 38 ++++--- .../resources/streaming/videos/videos.py | 106 +++++++++--------- src/gcore/types/streaming/clip.py | 3 +- .../types/streaming/create_video_param.py | 13 ++- src/gcore/types/streaming/playlist_video.py | 13 ++- src/gcore/types/streaming/stream.py | 2 +- .../streaming/stream_create_clip_params.py | 3 +- src/gcore/types/streaming/video.py | 41 +++---- .../types/streaming/video_update_params.py | 13 ++- 13 files changed, 171 insertions(+), 161 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4657825d..8a25c8b5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 480 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ad822cb823f7d765256dbd87b46bcf24f039041956282c13ff404e66845f5343.yml -openapi_spec_hash: 2b59f389c7eeec147f29ee1f22a54a55 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d1c3af0d3ce4bed858f5842b6424cfe34bbb3f171c2c9c430ce61d66f67bfe61.yml +openapi_spec_hash: ef10e695dec5e8d70b4c63468fc87214 config_hash: dbf10aa8f50ffee4df7ed95b2b42f9a9 diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 300984bb..4dafc6bd 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -105,21 +105,21 @@ def create( ``` { - "status": "SUCCESS", - "result": { - "subtitles": [ - { - "start_time": "00:00:00.031", - "end_time": "00:00:03.831", - "text": "Come on team, ..." - }, ... - ] - "vttContent": "WEBVTT\n\n1\n00:00:00.031 --> 00:00:03.831\nCome on team, ...", - "concatenated_text": "Come on team, ...", - "languages": [ "eng" ], - "speech_detected": true - } - }, ... + "status": "SUCCESS", + "result": { + "subtitles": [ + { + "start_time": "00:00:00.031", + "end_time": "00:00:03.831", + "text": "Come on team, ..." + }, ... + ] + "vttContent": "WEBVTT\n\n1\n00:00:00.031 --> 00:00:03.831\nCome on team, ...", + "concatenated_text": "Come on team, ...", + "languages": [ "eng" ], + "speech_detected": true + } + }, ... } ``` @@ -565,6 +565,7 @@ def get_ai_settings( ``` curl -L 'https://api.gcore.com/streaming/ai/info?type=language_support&audio_language=eng&subtitles_language=fre' + { "supported": true } ``` @@ -693,21 +694,21 @@ async def create( ``` { - "status": "SUCCESS", - "result": { - "subtitles": [ - { - "start_time": "00:00:00.031", - "end_time": "00:00:03.831", - "text": "Come on team, ..." - }, ... - ] - "vttContent": "WEBVTT\n\n1\n00:00:00.031 --> 00:00:03.831\nCome on team, ...", - "concatenated_text": "Come on team, ...", - "languages": [ "eng" ], - "speech_detected": true - } - }, ... + "status": "SUCCESS", + "result": { + "subtitles": [ + { + "start_time": "00:00:00.031", + "end_time": "00:00:03.831", + "text": "Come on team, ..." + }, ... + ] + "vttContent": "WEBVTT\n\n1\n00:00:00.031 --> 00:00:03.831\nCome on team, ...", + "concatenated_text": "Come on team, ...", + "languages": [ "eng" ], + "speech_detected": true + } + }, ... } ``` @@ -1153,6 +1154,7 @@ async def get_ai_settings( ``` curl -L 'https://api.gcore.com/streaming/ai/info?type=language_support&audio_language=eng&subtitles_language=fre' + { "supported": true } ``` diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index 6335e017..fba76526 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -104,9 +104,9 @@ def create( once it finishes to maintain a continuous stream. Example: ``` - active: true - loop: true - name: "Playlist: TV channel 'The world around us' (Programmed broadcast for 24 hours)" + active: true + loop: true + name: "Playlist: TV channel 'The world around us' (Programmed broadcast for 24 hours)" ``` **Scheduled playback** It can be used to simulate live events such as virtual @@ -122,10 +122,10 @@ def create( traditional live broadcasts. ``` - active: true - loop: false - name: "Playlist: Webinar 'Onboarding for new employees on working with the corporate portal'" - start_time: "2024-07-01T11:00:00Z" + active: true + loop: false + name: "Playlist: Webinar 'Onboarding for new employees on working with the corporate portal'" + start_time: "2024-07-01T11:00:00Z" ``` Args: @@ -572,9 +572,9 @@ async def create( once it finishes to maintain a continuous stream. Example: ``` - active: true - loop: true - name: "Playlist: TV channel 'The world around us' (Programmed broadcast for 24 hours)" + active: true + loop: true + name: "Playlist: TV channel 'The world around us' (Programmed broadcast for 24 hours)" ``` **Scheduled playback** It can be used to simulate live events such as virtual @@ -590,10 +590,10 @@ async def create( traditional live broadcasts. ``` - active: true - loop: false - name: "Playlist: Webinar 'Onboarding for new employees on working with the corporate portal'" - start_time: "2024-07-01T11:00:00Z" + active: true + loop: false + name: "Playlist: Webinar 'Onboarding for new employees on working with the corporate portal'" + start_time: "2024-07-01T11:00:00Z" ``` Args: diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 303565c7..2b048223 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -516,7 +516,8 @@ def create_clip( deleted from memory and is no longer available via the link. You need to create a new segment, or use `vod_required: true` attribute. If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. - `unix timestamp = + + 3600`). Allowed range: 1m <= expiration <= 4h. Example: + `unix timestamp = + + 3600`). Allowed range: 1m <= expiration + <= 4h. Example: `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` start: Starting point of the segment to cut. Unix timestamp in seconds, absolute value. @@ -1211,7 +1212,8 @@ async def create_clip( deleted from memory and is no longer available via the link. You need to create a new segment, or use `vod_required: true` attribute. If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. - `unix timestamp = + + 3600`). Allowed range: 1m <= expiration <= 4h. Example: + `unix timestamp = + + 3600`). Allowed range: 1m <= expiration + <= 4h. Example: `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` start: Starting point of the segment to cut. Unix timestamp in seconds, absolute value. diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index bceb7701..e5823d43 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -85,17 +85,18 @@ def create( - What is ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). - - If the option is enabled via `auto_transcribe_audio_language: auto|`, then - immediately after successful transcoding, an AI task will be automatically - created for transcription. + - If the option is enabled via + `auto_transcribe_audio_language: auto|`, then immediately after + successful transcoding, an AI task will be automatically created for + transcription. - If you need to translate subtitles from original language to any other, then AI-task of subtitles translation can be applied. Use - `auto_translate_subtitles_language: default|` parameter for that. Also you can - point several languages to translate to, then a separate subtitle will be - generated for each specified language. The created AI-task(s) will be - automatically executed, and result will also be automatically attached to this - video as subtitle(s). If AI is disabled in your account, you will receive code - 422 in response. + `auto_translate_subtitles_language: default|` parameter for + that. Also you can point several languages to translate to, then a separate + subtitle will be generated for each specified language. The created AI-task(s) + will be automatically executed, and result will also be automatically attached + to this video as subtitle(s). If AI is disabled in your account, you will + receive code 422 in response. **Where and how subtitles are displayed?** Subtitles are became available in the API response and in playback manifests. All added subtitles are automatically @@ -343,17 +344,18 @@ async def create( - What is ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). - - If the option is enabled via `auto_transcribe_audio_language: auto|`, then - immediately after successful transcoding, an AI task will be automatically - created for transcription. + - If the option is enabled via + `auto_transcribe_audio_language: auto|`, then immediately after + successful transcoding, an AI task will be automatically created for + transcription. - If you need to translate subtitles from original language to any other, then AI-task of subtitles translation can be applied. Use - `auto_translate_subtitles_language: default|` parameter for that. Also you can - point several languages to translate to, then a separate subtitle will be - generated for each specified language. The created AI-task(s) will be - automatically executed, and result will also be automatically attached to this - video as subtitle(s). If AI is disabled in your account, you will receive code - 422 in response. + `auto_translate_subtitles_language: default|` parameter for + that. Also you can point several languages to translate to, then a separate + subtitle will be generated for each specified language. The created AI-task(s) + will be automatically executed, and result will also be automatically attached + to this video as subtitle(s). If AI is disabled in your account, you will + receive code 422 in response. **Where and how subtitles are displayed?** Subtitles are became available in the API response and in playback manifests. All added subtitles are automatically diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index 2789c54d..bee81322 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -108,14 +108,15 @@ def create( - What is ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). - - If the option is enabled via `auto_transcribe_audio_language: auto|`, then - immediately after successful transcoding, an AI task will be automatically - created for transcription. + - If the option is enabled via + `auto_transcribe_audio_language: auto|`, then immediately after + successful transcoding, an AI task will be automatically created for + transcription. - If you need to translate subtitles from original language to any other, then AI-task of subtitles translation can be applied. Use - `auto_translate_subtitles_language: default|` parameter for that. Also you can - point several languages to translate to, then a separate subtitle will be - generated for each specified language. + `auto_translate_subtitles_language: default|` parameter for + that. Also you can point several languages to translate to, then a separate + subtitle will be generated for each specified language. - How to ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). The created AI-task(s) will be automatically executed, and result will also be @@ -268,7 +269,8 @@ def update( origin_http_headers: Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file (specified in "`origin_url`" parameter) on an - external server. Syntax: `Authorization: ` Examples: + external server. Syntax: + `Authorization: ` Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -277,10 +279,11 @@ def update( ``` POST https://api.gcore.com/streaming/videos + "video": { - "name": "IBC 2024 intro.mp4", - "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", - "origin_http_headers": "Authorization: Bearer ABC" + "name": "IBC 2024 intro.mp4", + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "origin_http_headers": "Authorization: Bearer ABC" } ``` @@ -295,8 +298,8 @@ def update( image. Also use attribute "`screenshot_id`" to select poster as a default screnshot. Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, image/webp, and image/png - and file sizes up to 1Mb. Examples: + format: `data:[];base64,` MIME-types are image/jpeg, + image/webp, and image/png and file sizes up to 1Mb. Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` @@ -657,19 +660,19 @@ def get_parameters_for_direct_upload( version only of tus-js-client. ``` - uploads[data.video.id] = new tus.Upload(file, { - endpoint: `https://${data.servers[0].hostname}/upload/`, - metadata: { - filename: data.video.name, - token: data.token, - video_id: data.video.id, - client_id: data.video.client_id - }, - onSuccess: function() { - ... - } - } - uploads[data.video.id].start(); + uploads[data.video.id] = new tus.Upload(file, { + endpoint: `https://${data.servers[0].hostname}/upload/`, + metadata: { + filename: data.video.name, + token: data.token, + video_id: data.video.id, + client_id: data.video.client_id + }, + onSuccess: function() { + ... + } + } + uploads[data.video.id].start(); ``` Args: @@ -793,14 +796,15 @@ async def create( - What is ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). - - If the option is enabled via `auto_transcribe_audio_language: auto|`, then - immediately after successful transcoding, an AI task will be automatically - created for transcription. + - If the option is enabled via + `auto_transcribe_audio_language: auto|`, then immediately after + successful transcoding, an AI task will be automatically created for + transcription. - If you need to translate subtitles from original language to any other, then AI-task of subtitles translation can be applied. Use - `auto_translate_subtitles_language: default|` parameter for that. Also you can - point several languages to translate to, then a separate subtitle will be - generated for each specified language. + `auto_translate_subtitles_language: default|` parameter for + that. Also you can point several languages to translate to, then a separate + subtitle will be generated for each specified language. - How to ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). The created AI-task(s) will be automatically executed, and result will also be @@ -953,7 +957,8 @@ async def update( origin_http_headers: Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file (specified in "`origin_url`" parameter) on an - external server. Syntax: `Authorization: ` Examples: + external server. Syntax: + `Authorization: ` Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -962,10 +967,11 @@ async def update( ``` POST https://api.gcore.com/streaming/videos + "video": { - "name": "IBC 2024 intro.mp4", - "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", - "origin_http_headers": "Authorization: Bearer ABC" + "name": "IBC 2024 intro.mp4", + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "origin_http_headers": "Authorization: Bearer ABC" } ``` @@ -980,8 +986,8 @@ async def update( image. Also use attribute "`screenshot_id`" to select poster as a default screnshot. Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, image/webp, and image/png - and file sizes up to 1Mb. Examples: + format: `data:[];base64,` MIME-types are image/jpeg, + image/webp, and image/png and file sizes up to 1Mb. Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` @@ -1346,19 +1352,19 @@ async def get_parameters_for_direct_upload( version only of tus-js-client. ``` - uploads[data.video.id] = new tus.Upload(file, { - endpoint: `https://${data.servers[0].hostname}/upload/`, - metadata: { - filename: data.video.name, - token: data.token, - video_id: data.video.id, - client_id: data.video.client_id - }, - onSuccess: function() { - ... - } - } - uploads[data.video.id].start(); + uploads[data.video.id] = new tus.Upload(file, { + endpoint: `https://${data.servers[0].hostname}/upload/`, + metadata: { + filename: data.video.name, + token: data.token, + video_id: data.video.id, + client_id: data.video.client_id + }, + onSuccess: function() { + ... + } + } + uploads[data.video.id].start(); ``` Args: diff --git a/src/gcore/types/streaming/clip.py b/src/gcore/types/streaming/clip.py index 3a8e444c..f5c0135a 100644 --- a/src/gcore/types/streaming/clip.py +++ b/src/gcore/types/streaming/clip.py @@ -38,7 +38,8 @@ class Clip(BaseModel): deleted from memory and is no longer available via the link. You need to create a new segment, or use `vod_required: true` attribute. If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. - `unix timestamp = + + 3600`). Allowed range: 1m <= expiration <= 4h. Example: + `unix timestamp = + + 3600`). Allowed range: 1m <= expiration + <= 4h. Example: `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` """ diff --git a/src/gcore/types/streaming/create_video_param.py b/src/gcore/types/streaming/create_video_param.py index dd0156bf..836ecbe5 100644 --- a/src/gcore/types/streaming/create_video_param.py +++ b/src/gcore/types/streaming/create_video_param.py @@ -95,7 +95,7 @@ class CreateVideoParam(TypedDict, total=False): Will be used as credentials to authenticate a request to download a file (specified in "`origin_url`" parameter) on an external server. Syntax: - `Authorization: ` Examples: + `Authorization: ` Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -104,10 +104,11 @@ class CreateVideoParam(TypedDict, total=False): ``` POST https://api.gcore.com/streaming/videos + "video": { - "name": "IBC 2024 intro.mp4", - "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", - "origin_http_headers": "Authorization: Bearer ABC" + "name": "IBC 2024 intro.mp4", + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "origin_http_headers": "Authorization: Bearer ABC" } ``` """ @@ -128,8 +129,8 @@ class CreateVideoParam(TypedDict, total=False): image. Also use attribute "`screenshot_id`" to select poster as a default screnshot. Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, image/webp, and image/png - and file sizes up to 1Mb. Examples: + format: `data:[];base64,` MIME-types are image/jpeg, + image/webp, and image/png and file sizes up to 1Mb. Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` diff --git a/src/gcore/types/streaming/playlist_video.py b/src/gcore/types/streaming/playlist_video.py index e1c19d60..d1b6e241 100644 --- a/src/gcore/types/streaming/playlist_video.py +++ b/src/gcore/types/streaming/playlist_video.py @@ -96,7 +96,7 @@ class PlaylistVideo(BaseModel): Will be used as credentials to authenticate a request to download a file (specified in "`origin_url`" parameter) on an external server. Syntax: - `Authorization: ` Examples: + `Authorization: ` Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -105,10 +105,11 @@ class PlaylistVideo(BaseModel): ``` POST https://api.gcore.com/streaming/videos + "video": { - "name": "IBC 2024 intro.mp4", - "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", - "origin_http_headers": "Authorization: Bearer ABC" + "name": "IBC 2024 intro.mp4", + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "origin_http_headers": "Authorization: Bearer ABC" } ``` """ @@ -129,8 +130,8 @@ class PlaylistVideo(BaseModel): image. Also use attribute "`screenshot_id`" to select poster as a default screnshot. Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, image/webp, and image/png - and file sizes up to 1Mb. Examples: + format: `data:[];base64,` MIME-types are image/jpeg, + image/webp, and image/png and file sizes up to 1Mb. Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py index f2fca186..4fdc6e54 100644 --- a/src/gcore/types/streaming/stream.py +++ b/src/gcore/types/streaming/stream.py @@ -202,7 +202,7 @@ class Stream(BaseModel): determine duration in seconds at the level of analyzing the logs of CDN requests and compare it with file size (so to use it in your analytics). Such modifier attributes are applied manually and added to the link obtained from - this field. I.e. `?get_duration_sec=true` Example: + this field. I.e. `?get_duration_sec=true` Example: `https://demo.gvideo.io/mpegts/2675_19146/master_mpegts.m3u8?get_duration_sec=true` ``` diff --git a/src/gcore/types/streaming/stream_create_clip_params.py b/src/gcore/types/streaming/stream_create_clip_params.py index 345d35b2..e8f0b107 100644 --- a/src/gcore/types/streaming/stream_create_clip_params.py +++ b/src/gcore/types/streaming/stream_create_clip_params.py @@ -32,7 +32,8 @@ class StreamCreateClipParams(TypedDict, total=False): deleted from memory and is no longer available via the link. You need to create a new segment, or use `vod_required: true` attribute. If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. - `unix timestamp = + + 3600`). Allowed range: 1m <= expiration <= 4h. Example: + `unix timestamp = + + 3600`). Allowed range: 1m <= expiration + <= 4h. Example: `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` """ diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py index 61cd5d10..2ed91392 100644 --- a/src/gcore/types/streaming/video.py +++ b/src/gcore/types/streaming/video.py @@ -37,7 +37,7 @@ class ConvertedVideo(BaseModel): in the browser. ``` - Content-Disposition: attachment + Content-Disposition: attachment ``` The third option allows you to set a custom name for the file being downloaded. @@ -51,22 +51,18 @@ class ConvertedVideo(BaseModel): `_backup.final`, `clip-v1.2` **Default MP4 file name structure** Link to the file {filename} contains - information about the encoding method using format: `___.mp4` - - - ```– Internal quality identifier and file version. Please do not use it, can be changed at any time without any notice. - - ``` - - ```– Codec name that was used to encode the video, or audio codec if it is an audio-only file. - - ``` - - ```– Encoding bitrate in Kbps. - - ``` - - ````– Video height, or word "audio" if it is an audio-only file. - Note that this link format has been applied since 14.08.2024. If the video entity was uploaded earlier, links may have old simplified format. - Example: ``` /videos/{client_id}_{slug}/qid3567v1_h264_4050_1080.mp4 ``` - - ```` + information about the encoding method using format: + `___.mp4` + + - `` – Internal quality identifier and file version. Please do + not use it, can be changed at any time without any notice. + - `` – Codec name that was used to encode the video, or audio codec if it + is an audio-only file. + - `` – Encoding bitrate in Kbps. + - `` – Video height, or word "audio" if it is an audio-only file. Note + that this link format has been applied since 14.08.2024. If the video entity + was uploaded earlier, links may have old simplified format. Example: + `/videos/{client_id}_{slug}/qid3567v1_h264_4050_1080.mp4` **Dynamic speed limiting** This mode sets different limits for different users or for different types of content. The speed is adjusted based on requests with @@ -312,13 +308,10 @@ class Video(BaseModel): like viewing an MP4 rendition. The MP4 file becomes available for downloading when the video entity "status" changes from "new" to "pending". The file is stored for 7 days, after which it will be automatically deleted. Format of URL - is `/videos/_/origin__.mp4` Where: - - ```– Encoding bitrate in Kbps. - - ``` - - ```– Video height. - This is a premium feature, available only upon request through your manager or support team. - ``` + is `/videos/_/origin__.mp4` Where: + - `` – Encoding bitrate in Kbps. + - `` – Video height. This is a premium feature, available only upon + request through your manager or support team. """ origin_video_duration: Optional[int] = None diff --git a/src/gcore/types/streaming/video_update_params.py b/src/gcore/types/streaming/video_update_params.py index c358f0d4..94c6ca2c 100644 --- a/src/gcore/types/streaming/video_update_params.py +++ b/src/gcore/types/streaming/video_update_params.py @@ -95,7 +95,7 @@ class VideoUpdateParams(TypedDict, total=False): Will be used as credentials to authenticate a request to download a file (specified in "`origin_url`" parameter) on an external server. Syntax: - `Authorization: ` Examples: + `Authorization: ` Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -104,10 +104,11 @@ class VideoUpdateParams(TypedDict, total=False): ``` POST https://api.gcore.com/streaming/videos + "video": { - "name": "IBC 2024 intro.mp4", - "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", - "origin_http_headers": "Authorization: Bearer ABC" + "name": "IBC 2024 intro.mp4", + "origin_url": "https://www.googleapis.com/drive/v3/files/...?alt=media", + "origin_http_headers": "Authorization: Bearer ABC" } ``` """ @@ -128,8 +129,8 @@ class VideoUpdateParams(TypedDict, total=False): image. Also use attribute "`screenshot_id`" to select poster as a default screnshot. Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, image/webp, and image/png - and file sizes up to 1Mb. Examples: + format: `data:[];base64,` MIME-types are image/jpeg, + image/webp, and image/png and file sizes up to 1Mb. Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` From f079b6c69bf0b21577dd56ed09b20209d9a70008 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 06:22:26 +0000 Subject: [PATCH 261/592] chore(internal): change ci workflow machines --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50910217..fd5753ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: permissions: contents: read id-token: write - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 From b5211be5ae3637a00251888c9a47edf41cdd6fba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 10:10:20 +0000 Subject: [PATCH 262/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/waap/domains/advanced_rules.py | 4 +- src/gcore/resources/waap/domains/api_paths.py | 4 +- .../resources/waap/domains/custom_rules.py | 4 +- src/gcore/resources/waap/domains/domains.py | 8 +- .../resources/waap/domains/firewall_rules.py | 4 +- src/gcore/resources/waap/domains/insights.py | 4 +- .../resources/waap/domains/statistics.py | 80 ++++++++-------- src/gcore/types/waap/domain_list_params.py | 2 +- src/gcore/types/waap/domain_update_params.py | 2 +- .../domains/advanced_rule_create_params.py | 5 +- .../domains/advanced_rule_update_params.py | 3 +- .../waap/domains/api_path_update_params.py | 2 +- .../waap/domains/custom_rule_create_params.py | 11 +-- .../waap/domains/custom_rule_update_params.py | 9 +- .../domains/firewall_rule_create_params.py | 5 +- .../domains/firewall_rule_update_params.py | 3 +- .../waap/domains/insight_replace_params.py | 2 +- .../domains/statistic_get_ddos_info_params.py | 15 ++- .../statistic_get_events_aggregated_params.py | 15 ++- .../statistic_get_requests_series_params.py | 15 ++- .../statistic_get_traffic_series_params.py | 15 ++- .../types/waap/domains/waap_advanced_rule.py | 5 +- src/gcore/types/waap/domains/waap_api_path.py | 8 +- .../waap/domains/waap_api_scan_result.py | 4 +- .../types/waap/domains/waap_custom_rule.py | 11 +-- .../types/waap/domains/waap_firewall_rule.py | 5 +- src/gcore/types/waap/domains/waap_insight.py | 2 +- .../waap/domains/waap_request_details.py | 6 +- src/gcore/types/waap/waap_rule_set.py | 2 +- .../waap/domains/test_advanced_rules.py | 24 ++--- .../waap/domains/test_custom_rules.py | 20 ++-- .../waap/domains/test_firewall_rules.py | 32 +++---- .../waap/domains/test_statistics.py | 92 +++++++++---------- .../waap/test_custom_page_sets.py | 4 +- tests/api_resources/waap/test_domains.py | 4 +- .../api_resources/waap/test_organizations.py | 4 +- tests/api_resources/waap/test_tags.py | 8 +- 38 files changed, 216 insertions(+), 231 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8a25c8b5..79be4d72 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 480 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d1c3af0d3ce4bed858f5842b6424cfe34bbb3f171c2c9c430ce61d66f67bfe61.yml -openapi_spec_hash: ef10e695dec5e8d70b4c63468fc87214 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5486e95e5adc26944665ee4213dafb148ea3875e2641d04ad7f1ca4330f09785.yml +openapi_spec_hash: e9e3325ca367d257b8dcb79d7ddb7310 config_hash: dbf10aa8f50ffee4df7ed95b2b42f9a9 diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index 75992d93..e22a838f 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -68,7 +68,7 @@ def create( Args: domain_id: The domain ID - action: The action that a WAAP rule takes when triggered + action: The action that the rule takes when triggered enabled: Whether or not the rule is enabled @@ -444,7 +444,7 @@ async def create( Args: domain_id: The domain ID - action: The action that a WAAP rule takes when triggered + action: The action that the rule takes when triggered enabled: Whether or not the rule is enabled diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index 70381593..5e227404 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -137,7 +137,7 @@ def update( path: The updated API path. When updating the path, variables can be renamed, path parts can be converted to variables and vice versa. - status: The different statuses an API path can have + status: The status of the discovered API path tags: An array of tags associated with the API path @@ -467,7 +467,7 @@ async def update( path: The updated API path. When updating the path, variables can be renamed, path parts can be converted to variables and vice versa. - status: The different statuses an API path can have + status: The status of the discovered API path tags: An array of tags associated with the API path diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index 4a5acac5..f175a192 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -72,7 +72,7 @@ def create( Args: domain_id: The domain ID - action: The action that a WAAP rule takes when triggered + action: The action that the rule takes when triggered conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger @@ -446,7 +446,7 @@ async def create( Args: domain_id: The domain ID - action: The action that a WAAP rule takes when triggered + action: The action that the rule takes when triggered conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index ad004706..cf4135cc 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -186,7 +186,7 @@ def update( Args: domain_id: The domain ID - status: Domain statuses that can be used when updating a domain + status: The current status of the domain extra_headers: Send extra headers @@ -237,7 +237,7 @@ def list( ordering: Sort the response by given field. - status: The different statuses a domain can have + status: Filter domains based on the domain status extra_headers: Send extra headers @@ -489,7 +489,7 @@ async def update( Args: domain_id: The domain ID - status: Domain statuses that can be used when updating a domain + status: The current status of the domain extra_headers: Send extra headers @@ -540,7 +540,7 @@ def list( ordering: Sort the response by given field. - status: The different statuses a domain can have + status: Filter domains based on the domain status extra_headers: Send extra headers diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index 90bbe131..b8600359 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -72,7 +72,7 @@ def create( Args: domain_id: The domain ID - action: The action that a firewall rule takes when triggered + action: The action that the rule takes when triggered conditions: The condition required for the WAAP engine to trigger the rule. @@ -444,7 +444,7 @@ async def create( Args: domain_id: The domain ID - action: The action that a firewall rule takes when triggered + action: The action that the rule takes when triggered conditions: The condition required for the WAAP engine to trigger the rule. diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index fcd628e4..40fa6d8b 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -186,7 +186,7 @@ def replace( insight_id: The ID of the insight - status: The different statuses an insight can have + status: The status of the insight extra_headers: Send extra headers @@ -369,7 +369,7 @@ async def replace( insight_id: The ID of the insight - status: The different statuses an insight can have + status: The status of the insight extra_headers: Send extra headers diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index 13776e62..6031bdfd 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -124,8 +124,8 @@ def get_ddos_info( domain_id: int, *, group_by: Literal["URL", "User-Agent", "IP"], - start: Union[str, datetime], - end: Union[str, datetime] | NotGiven = NOT_GIVEN, + start: str, + end: Optional[str] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -143,10 +143,10 @@ def get_ddos_info( group_by: The identity of the requests to group by - start: Filter traffic starting from a specified date in ISO 8601 format + start: Filter data items starting from a specified date in ISO 8601 format - end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, - defaults to the current date and time. + end: Filter data items up to a specified end date in ISO 8601 format. If not + provided, defaults to the current date and time. limit: Number of items to return @@ -186,9 +186,9 @@ def get_events_aggregated( self, domain_id: int, *, - start: Union[str, datetime], + start: str, action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | NotGiven = NOT_GIVEN, - end: Union[str, datetime] | NotGiven = NOT_GIVEN, + end: Optional[str] | NotGiven = NOT_GIVEN, ip: Optional[List[str]] | NotGiven = NOT_GIVEN, reference_id: Optional[List[str]] | NotGiven = NOT_GIVEN, result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | NotGiven = NOT_GIVEN, @@ -205,12 +205,12 @@ def get_events_aggregated( Args: domain_id: The domain ID - start: Filter traffic starting from a specified date in ISO 8601 format + start: Filter data items starting from a specified date in ISO 8601 format action: A list of action names to filter on. - end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, - defaults to the current date and time. + end: Filter data items up to a specified end date in ISO 8601 format. If not + provided, defaults to the current date and time. ip: A list of IPs to filter event statistics. @@ -291,10 +291,10 @@ def get_requests_series( self, domain_id: int, *, - start: Union[str, datetime], + start: str, actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, countries: List[str] | NotGiven = NOT_GIVEN, - end: Union[str, datetime] | NotGiven = NOT_GIVEN, + end: Optional[str] | NotGiven = NOT_GIVEN, ip: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, @@ -340,14 +340,14 @@ def get_requests_series( Args: domain_id: The domain ID - start: Filter traffic starting from a specified date in ISO 8601 format + start: Filter data items starting from a specified date in ISO 8601 format actions: Filter the response by actions. countries: Filter the response by country codes in ISO 3166-1 alpha-2 format. - end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, - defaults to the current date and time. + end: Filter data items up to a specified end date in ISO 8601 format. If not + provided, defaults to the current date and time. ip: Filter the response by IP. @@ -407,8 +407,8 @@ def get_traffic_series( domain_id: int, *, resolution: Literal["daily", "hourly", "minutely"], - start: Union[str, datetime], - end: Union[str, datetime] | NotGiven = NOT_GIVEN, + start: str, + end: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -426,10 +426,10 @@ def get_traffic_series( resolution: Specifies the granularity of the result data. - start: Filter traffic starting from a specified date in ISO 8601 format + start: Filter data items starting from a specified date in ISO 8601 format - end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, - defaults to the current date and time. + end: Filter data items up to a specified end date in ISO 8601 format. If not + provided, defaults to the current date and time. extra_headers: Send extra headers @@ -546,8 +546,8 @@ def get_ddos_info( domain_id: int, *, group_by: Literal["URL", "User-Agent", "IP"], - start: Union[str, datetime], - end: Union[str, datetime] | NotGiven = NOT_GIVEN, + start: str, + end: Optional[str] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -565,10 +565,10 @@ def get_ddos_info( group_by: The identity of the requests to group by - start: Filter traffic starting from a specified date in ISO 8601 format + start: Filter data items starting from a specified date in ISO 8601 format - end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, - defaults to the current date and time. + end: Filter data items up to a specified end date in ISO 8601 format. If not + provided, defaults to the current date and time. limit: Number of items to return @@ -608,9 +608,9 @@ async def get_events_aggregated( self, domain_id: int, *, - start: Union[str, datetime], + start: str, action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | NotGiven = NOT_GIVEN, - end: Union[str, datetime] | NotGiven = NOT_GIVEN, + end: Optional[str] | NotGiven = NOT_GIVEN, ip: Optional[List[str]] | NotGiven = NOT_GIVEN, reference_id: Optional[List[str]] | NotGiven = NOT_GIVEN, result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | NotGiven = NOT_GIVEN, @@ -627,12 +627,12 @@ async def get_events_aggregated( Args: domain_id: The domain ID - start: Filter traffic starting from a specified date in ISO 8601 format + start: Filter data items starting from a specified date in ISO 8601 format action: A list of action names to filter on. - end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, - defaults to the current date and time. + end: Filter data items up to a specified end date in ISO 8601 format. If not + provided, defaults to the current date and time. ip: A list of IPs to filter event statistics. @@ -713,10 +713,10 @@ def get_requests_series( self, domain_id: int, *, - start: Union[str, datetime], + start: str, actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, countries: List[str] | NotGiven = NOT_GIVEN, - end: Union[str, datetime] | NotGiven = NOT_GIVEN, + end: Optional[str] | NotGiven = NOT_GIVEN, ip: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, @@ -762,14 +762,14 @@ def get_requests_series( Args: domain_id: The domain ID - start: Filter traffic starting from a specified date in ISO 8601 format + start: Filter data items starting from a specified date in ISO 8601 format actions: Filter the response by actions. countries: Filter the response by country codes in ISO 3166-1 alpha-2 format. - end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, - defaults to the current date and time. + end: Filter data items up to a specified end date in ISO 8601 format. If not + provided, defaults to the current date and time. ip: Filter the response by IP. @@ -829,8 +829,8 @@ async def get_traffic_series( domain_id: int, *, resolution: Literal["daily", "hourly", "minutely"], - start: Union[str, datetime], - end: Union[str, datetime] | NotGiven = NOT_GIVEN, + start: str, + end: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -848,10 +848,10 @@ async def get_traffic_series( resolution: Specifies the granularity of the result data. - start: Filter traffic starting from a specified date in ISO 8601 format + start: Filter data items starting from a specified date in ISO 8601 format - end: Filter traffic up to a specified end date in ISO 8601 format. If not provided, - defaults to the current date and time. + end: Filter data items up to a specified end date in ISO 8601 format. If not + provided, defaults to the current date and time. extra_headers: Send extra headers diff --git a/src/gcore/types/waap/domain_list_params.py b/src/gcore/types/waap/domain_list_params.py index c0d65852..767d4eaa 100644 --- a/src/gcore/types/waap/domain_list_params.py +++ b/src/gcore/types/waap/domain_list_params.py @@ -25,4 +25,4 @@ class DomainListParams(TypedDict, total=False): """Sort the response by given field.""" status: Literal["active", "bypass", "monitor", "locked"] - """The different statuses a domain can have""" + """Filter domains based on the domain status""" diff --git a/src/gcore/types/waap/domain_update_params.py b/src/gcore/types/waap/domain_update_params.py index a9b8d477..cd2134bd 100644 --- a/src/gcore/types/waap/domain_update_params.py +++ b/src/gcore/types/waap/domain_update_params.py @@ -9,4 +9,4 @@ class DomainUpdateParams(TypedDict, total=False): status: Literal["active", "monitor"] - """Domain statuses that can be used when updating a domain""" + """The current status of the domain""" diff --git a/src/gcore/types/waap/domains/advanced_rule_create_params.py b/src/gcore/types/waap/domains/advanced_rule_create_params.py index 52e32ad8..266bc5d0 100644 --- a/src/gcore/types/waap/domains/advanced_rule_create_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_create_params.py @@ -10,7 +10,7 @@ class AdvancedRuleCreateParams(TypedDict, total=False): action: Required[Action] - """The action that a WAAP rule takes when triggered""" + """The action that the rule takes when triggered""" enabled: Required[bool] """Whether or not the rule is enabled""" @@ -45,7 +45,8 @@ class ActionBlock(TypedDict, total=False): """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or - 'd' to represent time format (seconds, minutes, hours, or days) + 'd' to represent time format (seconds, minutes, hours, or days). Empty time + intervals are not allowed. """ status_code: Optional[Literal[403, 405, 418, 429]] 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 a592c6f8..7f2fef03 100644 --- a/src/gcore/types/waap/domains/advanced_rule_update_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_update_params.py @@ -48,7 +48,8 @@ class ActionBlock(TypedDict, total=False): """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or - 'd' to represent time format (seconds, minutes, hours, or days) + 'd' to represent time format (seconds, minutes, hours, or days). Empty time + intervals are not allowed. """ status_code: Optional[Literal[403, 405, 418, 429]] diff --git a/src/gcore/types/waap/domains/api_path_update_params.py b/src/gcore/types/waap/domains/api_path_update_params.py index fcd2f8de..99f3abf3 100644 --- a/src/gcore/types/waap/domains/api_path_update_params.py +++ b/src/gcore/types/waap/domains/api_path_update_params.py @@ -23,7 +23,7 @@ class APIPathUpdateParams(TypedDict, total=False): """ status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] - """The different statuses an API path can have""" + """The status of the discovered API path""" tags: List[str] """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/custom_rule_create_params.py b/src/gcore/types/waap/domains/custom_rule_create_params.py index 3ad3b32d..3bb3ed5a 100644 --- a/src/gcore/types/waap/domains/custom_rule_create_params.py +++ b/src/gcore/types/waap/domains/custom_rule_create_params.py @@ -34,7 +34,7 @@ class CustomRuleCreateParams(TypedDict, total=False): action: Required[Action] - """The action that a WAAP rule takes when triggered""" + """The action that the rule takes when triggered""" conditions: Required[Iterable[Condition]] """The conditions required for the WAAP engine to trigger the rule. @@ -58,7 +58,8 @@ class ActionBlock(TypedDict, total=False): """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or - 'd' to represent time format (seconds, minutes, hours, or days) + 'd' to represent time format (seconds, minutes, hours, or days). Empty time + intervals are not allowed. """ status_code: Optional[Literal[403, 405, 418, 429]] @@ -144,11 +145,7 @@ class ConditionHeaderExists(TypedDict, total=False): class ConditionHTTPMethod(TypedDict, total=False): http_method: Required[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] - """HTTP methods and descriptions Methods from the following RFCs are all observed: - - - RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616 - - RFC 5789: PATCH Method for HTTP - """ + """HTTP methods of a request""" negation: bool """Whether or not to apply a boolean NOT operation to the rule's condition""" 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 d5de1dd1..9ac6c266 100644 --- a/src/gcore/types/waap/domains/custom_rule_update_params.py +++ b/src/gcore/types/waap/domains/custom_rule_update_params.py @@ -61,7 +61,8 @@ class ActionBlock(TypedDict, total=False): """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or - 'd' to represent time format (seconds, minutes, hours, or days) + 'd' to represent time format (seconds, minutes, hours, or days). Empty time + intervals are not allowed. """ status_code: Optional[Literal[403, 405, 418, 429]] @@ -147,11 +148,7 @@ class ConditionHeaderExists(TypedDict, total=False): class ConditionHTTPMethod(TypedDict, total=False): http_method: Required[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] - """HTTP methods and descriptions Methods from the following RFCs are all observed: - - - RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616 - - RFC 5789: PATCH Method for HTTP - """ + """HTTP methods of a request""" negation: bool """Whether or not to apply a boolean NOT operation to the rule's condition""" 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 c56a608d..84b671fb 100644 --- a/src/gcore/types/waap/domains/firewall_rule_create_params.py +++ b/src/gcore/types/waap/domains/firewall_rule_create_params.py @@ -10,7 +10,7 @@ class FirewallRuleCreateParams(TypedDict, total=False): action: Required[Action] - """The action that a firewall rule takes when triggered""" + """The action that the rule takes when triggered""" conditions: Required[Iterable[Condition]] """The condition required for the WAAP engine to trigger the rule.""" @@ -30,7 +30,8 @@ class ActionBlock(TypedDict, total=False): """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or - 'd' to represent time format (seconds, minutes, hours, or days) + 'd' to represent time format (seconds, minutes, hours, or days). Empty time + intervals are not allowed. """ status_code: Optional[Literal[403, 405, 418, 429]] 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 ca5eb4fa..478d257c 100644 --- a/src/gcore/types/waap/domains/firewall_rule_update_params.py +++ b/src/gcore/types/waap/domains/firewall_rule_update_params.py @@ -33,7 +33,8 @@ class ActionBlock(TypedDict, total=False): """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or - 'd' to represent time format (seconds, minutes, hours, or days) + 'd' to represent time format (seconds, minutes, hours, or days). Empty time + intervals are not allowed. """ status_code: Optional[Literal[403, 405, 418, 429]] diff --git a/src/gcore/types/waap/domains/insight_replace_params.py b/src/gcore/types/waap/domains/insight_replace_params.py index 18ded249..46dc81b4 100644 --- a/src/gcore/types/waap/domains/insight_replace_params.py +++ b/src/gcore/types/waap/domains/insight_replace_params.py @@ -12,4 +12,4 @@ class InsightReplaceParams(TypedDict, total=False): """The domain ID""" status: Required[Literal["OPEN", "ACKED", "CLOSED"]] - """The different statuses an insight can have""" + """The status of the insight""" diff --git a/src/gcore/types/waap/domains/statistic_get_ddos_info_params.py b/src/gcore/types/waap/domains/statistic_get_ddos_info_params.py index 399c4044..3b8406b8 100644 --- a/src/gcore/types/waap/domains/statistic_get_ddos_info_params.py +++ b/src/gcore/types/waap/domains/statistic_get_ddos_info_params.py @@ -2,11 +2,8 @@ from __future__ import annotations -from typing import Union -from datetime import datetime -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ...._utils import PropertyInfo +from typing import Optional +from typing_extensions import Literal, Required, TypedDict __all__ = ["StatisticGetDDOSInfoParams"] @@ -15,11 +12,11 @@ class StatisticGetDDOSInfoParams(TypedDict, total=False): group_by: Required[Literal["URL", "User-Agent", "IP"]] """The identity of the requests to group by""" - start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - """Filter traffic starting from a specified date in ISO 8601 format""" + start: Required[str] + """Filter data items starting from a specified date in ISO 8601 format""" - end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """Filter traffic up to a specified end date in ISO 8601 format. + end: Optional[str] + """Filter data items up to a specified end date in ISO 8601 format. If not provided, defaults to the current date and time. """ diff --git a/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py b/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py index cdf4b82d..08ac1c8c 100644 --- a/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py +++ b/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py @@ -2,24 +2,21 @@ from __future__ import annotations -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ...._utils import PropertyInfo +from typing import List, Optional +from typing_extensions import Literal, Required, TypedDict __all__ = ["StatisticGetEventsAggregatedParams"] class StatisticGetEventsAggregatedParams(TypedDict, total=False): - start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - """Filter traffic starting from a specified date in ISO 8601 format""" + start: Required[str] + """Filter data items starting from a specified date in ISO 8601 format""" action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] """A list of action names to filter on.""" - end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """Filter traffic up to a specified end date in ISO 8601 format. + end: Optional[str] + """Filter data items up to a specified end date in ISO 8601 format. If not provided, defaults to the current date and time. """ diff --git a/src/gcore/types/waap/domains/statistic_get_requests_series_params.py b/src/gcore/types/waap/domains/statistic_get_requests_series_params.py index 6007c368..79c24568 100644 --- a/src/gcore/types/waap/domains/statistic_get_requests_series_params.py +++ b/src/gcore/types/waap/domains/statistic_get_requests_series_params.py @@ -2,18 +2,15 @@ from __future__ import annotations -from typing import List, Union -from datetime import datetime -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ...._utils import PropertyInfo +from typing import List, Optional +from typing_extensions import Literal, Required, TypedDict __all__ = ["StatisticGetRequestsSeriesParams"] class StatisticGetRequestsSeriesParams(TypedDict, total=False): - start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - """Filter traffic starting from a specified date in ISO 8601 format""" + start: Required[str] + """Filter data items starting from a specified date in ISO 8601 format""" actions: List[Literal["allow", "block", "captcha", "handshake"]] """Filter the response by actions.""" @@ -21,8 +18,8 @@ class StatisticGetRequestsSeriesParams(TypedDict, total=False): countries: List[str] """Filter the response by country codes in ISO 3166-1 alpha-2 format.""" - end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """Filter traffic up to a specified end date in ISO 8601 format. + end: Optional[str] + """Filter data items up to a specified end date in ISO 8601 format. If not provided, defaults to the current date and time. """ diff --git a/src/gcore/types/waap/domains/statistic_get_traffic_series_params.py b/src/gcore/types/waap/domains/statistic_get_traffic_series_params.py index 11bb32df..18b815fb 100644 --- a/src/gcore/types/waap/domains/statistic_get_traffic_series_params.py +++ b/src/gcore/types/waap/domains/statistic_get_traffic_series_params.py @@ -2,11 +2,8 @@ from __future__ import annotations -from typing import Union -from datetime import datetime -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ...._utils import PropertyInfo +from typing import Optional +from typing_extensions import Literal, Required, TypedDict __all__ = ["StatisticGetTrafficSeriesParams"] @@ -15,11 +12,11 @@ class StatisticGetTrafficSeriesParams(TypedDict, total=False): resolution: Required[Literal["daily", "hourly", "minutely"]] """Specifies the granularity of the result data.""" - start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - """Filter traffic starting from a specified date in ISO 8601 format""" + start: Required[str] + """Filter data items starting from a specified date in ISO 8601 format""" - end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """Filter traffic up to a specified end date in ISO 8601 format. + end: Optional[str] + """Filter data items up to a specified end date in ISO 8601 format. If not provided, defaults to the current date and time. """ diff --git a/src/gcore/types/waap/domains/waap_advanced_rule.py b/src/gcore/types/waap/domains/waap_advanced_rule.py index 5b6d5d07..fc264a1a 100644 --- a/src/gcore/types/waap/domains/waap_advanced_rule.py +++ b/src/gcore/types/waap/domains/waap_advanced_rule.py @@ -13,7 +13,8 @@ class ActionBlock(BaseModel): """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or - 'd' to represent time format (seconds, minutes, hours, or days) + 'd' to represent time format (seconds, minutes, hours, or days). Empty time + intervals are not allowed. """ status_code: Optional[Literal[403, 405, 418, 429]] = None @@ -53,7 +54,7 @@ class WaapAdvancedRule(BaseModel): """The unique identifier for the rule""" action: Action - """The action that a WAAP rule takes when triggered""" + """The action that the rule takes when triggered""" enabled: bool """Whether or not the rule is enabled""" diff --git a/src/gcore/types/waap/domains/waap_api_path.py b/src/gcore/types/waap/domains/waap_api_path.py index 5b4622d1..23abac76 100644 --- a/src/gcore/types/waap/domains/waap_api_path.py +++ b/src/gcore/types/waap/domains/waap_api_path.py @@ -23,13 +23,13 @@ class WaapAPIPath(BaseModel): """The date and time in ISO 8601 format the API path was first detected.""" http_scheme: Literal["HTTP", "HTTPS"] - """The different HTTP schemes an API path can have""" + """The HTTP version of the API path""" last_detected: datetime """The date and time in ISO 8601 format the API path was last detected.""" method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"] - """The different methods an API path can have""" + """The API RESTful method""" path: str """ @@ -41,10 +41,10 @@ class WaapAPIPath(BaseModel): """The number of requests for this path in the last 24 hours""" source: Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"] - """The different sources an API path can have""" + """The source of the discovered API""" status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] - """The different statuses an API path can have""" + """The status of the discovered API path""" tags: List[str] """An array of tags associated with the API path""" 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 408230c8..9e8b7efc 100644 --- a/src/gcore/types/waap/domains/waap_api_scan_result.py +++ b/src/gcore/types/waap/domains/waap_api_scan_result.py @@ -23,7 +23,7 @@ class WaapAPIScanResult(BaseModel): """The date and time the scan started""" status: Literal["SUCCESS", "FAILURE", "IN_PROGRESS"] - """The different statuses a task result can have""" + """The status of the scan""" type: Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"] - """The different types of scans that can be performed""" + """The type of scan""" diff --git a/src/gcore/types/waap/domains/waap_custom_rule.py b/src/gcore/types/waap/domains/waap_custom_rule.py index 3ee80d02..aec81343 100644 --- a/src/gcore/types/waap/domains/waap_custom_rule.py +++ b/src/gcore/types/waap/domains/waap_custom_rule.py @@ -37,7 +37,8 @@ class ActionBlock(BaseModel): """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or - 'd' to represent time format (seconds, minutes, hours, or days) + 'd' to represent time format (seconds, minutes, hours, or days). Empty time + intervals are not allowed. """ status_code: Optional[Literal[403, 405, 418, 429]] = None @@ -123,11 +124,7 @@ class ConditionHeaderExists(BaseModel): class ConditionHTTPMethod(BaseModel): http_method: Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"] - """HTTP methods and descriptions Methods from the following RFCs are all observed: - - - RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616 - - RFC 5789: PATCH Method for HTTP - """ + """HTTP methods of a request""" negation: Optional[bool] = None """Whether or not to apply a boolean NOT operation to the rule's condition""" @@ -358,7 +355,7 @@ class WaapCustomRule(BaseModel): """The unique identifier for the rule""" action: Action - """The action that a WAAP rule takes when triggered""" + """The action that the rule takes when triggered""" conditions: List[Condition] """The conditions required for the WAAP engine to trigger the rule. diff --git a/src/gcore/types/waap/domains/waap_firewall_rule.py b/src/gcore/types/waap/domains/waap_firewall_rule.py index 88deda6e..d9ffa8dc 100644 --- a/src/gcore/types/waap/domains/waap_firewall_rule.py +++ b/src/gcore/types/waap/domains/waap_firewall_rule.py @@ -13,7 +13,8 @@ class ActionBlock(BaseModel): """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or - 'd' to represent time format (seconds, minutes, hours, or days) + 'd' to represent time format (seconds, minutes, hours, or days). Empty time + intervals are not allowed. """ status_code: Optional[Literal[403, 405, 418, 429]] = None @@ -63,7 +64,7 @@ class WaapFirewallRule(BaseModel): """The unique identifier of the rule""" action: Action - """The action that a firewall rule takes when triggered""" + """The action that the rule takes when triggered""" conditions: List[Condition] """The condition required for the WAAP engine to trigger the rule.""" diff --git a/src/gcore/types/waap/domains/waap_insight.py b/src/gcore/types/waap/domains/waap_insight.py index 9beca2a1..f5ca2825 100644 --- a/src/gcore/types/waap/domains/waap_insight.py +++ b/src/gcore/types/waap/domains/waap_insight.py @@ -35,4 +35,4 @@ class WaapInsight(BaseModel): """The recommended action to perform to resolve the insight""" status: Literal["OPEN", "ACKED", "CLOSED"] - """The different statuses an insight can have""" + """The status of the insight""" diff --git a/src/gcore/types/waap/domains/waap_request_details.py b/src/gcore/types/waap/domains/waap_request_details.py index 29b4b30c..7b560704 100644 --- a/src/gcore/types/waap/domains/waap_request_details.py +++ b/src/gcore/types/waap/domains/waap_request_details.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import Dict, List from typing_extensions import Literal from ...._models import BaseModel @@ -148,7 +148,7 @@ class WaapRequestDetails(BaseModel): reference_id: str """Reference ID to identify user sanction""" - request_headers: object + request_headers: Dict[str, object] """HTTP request headers""" request_time: str @@ -182,4 +182,4 @@ class WaapRequestDetails(BaseModel): """List of traffic types""" user_agent: UserAgent - """User agent details""" + """User agent""" diff --git a/src/gcore/types/waap/waap_rule_set.py b/src/gcore/types/waap/waap_rule_set.py index 25de7087..e5e33e10 100644 --- a/src/gcore/types/waap/waap_rule_set.py +++ b/src/gcore/types/waap/waap_rule_set.py @@ -24,7 +24,7 @@ class Rule(BaseModel): """Unique identifier for the security rule""" action: Literal["Allow", "Block", "Captcha", "Gateway", "Handshake", "Monitor", "Composite"] - """The action taken by the WAAP upon rule activation.""" + """Specifies the action taken by the WAAP upon rule activation""" description: str """Detailed description of the security rule""" diff --git a/tests/api_resources/waap/domains/test_advanced_rules.py b/tests/api_resources/waap/domains/test_advanced_rules.py index bb99d81b..fe8f806f 100644 --- a/tests/api_resources/waap/domains/test_advanced_rules.py +++ b/tests/api_resources/waap/domains/test_advanced_rules.py @@ -26,7 +26,7 @@ def test_method_create(self, client: Gcore) -> None: domain_id=1, action={}, enabled=True, - name="name", + name="Block foobar bot", source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", ) assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @@ -47,7 +47,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "tag": {"tags": ["string"]}, }, enabled=True, - name="name", + name="Block foobar bot", source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", description="description", phase="access", @@ -60,7 +60,7 @@ def test_raw_response_create(self, client: Gcore) -> None: domain_id=1, action={}, enabled=True, - name="name", + name="Block foobar bot", source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", ) @@ -75,7 +75,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: domain_id=1, action={}, enabled=True, - name="name", + name="Block foobar bot", source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", ) as response: assert not response.is_closed @@ -112,7 +112,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: }, description="description", enabled=True, - name="name", + name="Block foobar bot", phase="access", source="x", ) @@ -161,7 +161,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: limit=0, name="Block by specific IP rule", offset=0, - ordering="id", + ordering="-id", phase="access", ) assert_matches_type(SyncOffsetPage[WaapAdvancedRule], advanced_rule, path=["response"]) @@ -307,7 +307,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: domain_id=1, action={}, enabled=True, - name="name", + name="Block foobar bot", source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", ) assert_matches_type(WaapAdvancedRule, advanced_rule, path=["response"]) @@ -328,7 +328,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "tag": {"tags": ["string"]}, }, enabled=True, - name="name", + name="Block foobar bot", source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", description="description", phase="access", @@ -341,7 +341,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: domain_id=1, action={}, enabled=True, - name="name", + name="Block foobar bot", source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", ) @@ -356,7 +356,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None domain_id=1, action={}, enabled=True, - name="name", + name="Block foobar bot", source="request.rate_limit([], '.*events', 5, 200, [], [], '', 'ip') and not ('mb-web-ui' in request.headers['Cookie'] or 'mb-mobile-ios' in request.headers['Cookie'] or 'session-token' in request.headers['Cookie']) and not request.headers['session']", ) as response: assert not response.is_closed @@ -393,7 +393,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> }, description="description", enabled=True, - name="name", + name="Block foobar bot", phase="access", source="x", ) @@ -442,7 +442,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No limit=0, name="Block by specific IP rule", offset=0, - ordering="id", + ordering="-id", phase="access", ) assert_matches_type(AsyncOffsetPage[WaapAdvancedRule], advanced_rule, path=["response"]) diff --git a/tests/api_resources/waap/domains/test_custom_rules.py b/tests/api_resources/waap/domains/test_custom_rules.py index 70f4c5b2..62327ad7 100644 --- a/tests/api_resources/waap/domains/test_custom_rules.py +++ b/tests/api_resources/waap/domains/test_custom_rules.py @@ -27,7 +27,7 @@ def test_method_create(self, client: Gcore) -> None: action={}, conditions=[{}], enabled=True, - name="name", + name="Block foobar bot", ) assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @@ -134,7 +134,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: } ], enabled=True, - name="name", + name="Block foobar bot", description="description", ) assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @@ -146,7 +146,7 @@ def test_raw_response_create(self, client: Gcore) -> None: action={}, conditions=[{}], enabled=True, - name="name", + name="Block foobar bot", ) assert response.is_closed is True @@ -161,7 +161,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: action={}, conditions=[{}], enabled=True, - name="name", + name="Block foobar bot", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -284,7 +284,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: ], description="description", enabled=True, - name="name", + name="Block foobar bot", ) assert custom_rule is None @@ -511,7 +511,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: action={}, conditions=[{}], enabled=True, - name="name", + name="Block foobar bot", ) assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @@ -618,7 +618,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> } ], enabled=True, - name="name", + name="Block foobar bot", description="description", ) assert_matches_type(WaapCustomRule, custom_rule, path=["response"]) @@ -630,7 +630,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: action={}, conditions=[{}], enabled=True, - name="name", + name="Block foobar bot", ) assert response.is_closed is True @@ -645,7 +645,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None action={}, conditions=[{}], enabled=True, - name="name", + name="Block foobar bot", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -768,7 +768,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> ], description="description", enabled=True, - name="name", + name="Block foobar bot", ) assert custom_rule is None diff --git a/tests/api_resources/waap/domains/test_firewall_rules.py b/tests/api_resources/waap/domains/test_firewall_rules.py index 0be72d1a..72064193 100644 --- a/tests/api_resources/waap/domains/test_firewall_rules.py +++ b/tests/api_resources/waap/domains/test_firewall_rules.py @@ -27,7 +27,7 @@ def test_method_create(self, client: Gcore) -> None: action={}, conditions=[{}], enabled=True, - name="name", + name="Block foobar bot", ) assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @@ -56,7 +56,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: } ], enabled=True, - name="name", + name="Block foobar bot", description="description", ) assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @@ -68,7 +68,7 @@ def test_raw_response_create(self, client: Gcore) -> None: action={}, conditions=[{}], enabled=True, - name="name", + name="Block foobar bot", ) assert response.is_closed is True @@ -83,7 +83,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: action={}, conditions=[{}], enabled=True, - name="name", + name="Block foobar bot", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -128,7 +128,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: ], description="description", enabled=True, - name="name", + name="Block foobar bot", ) assert firewall_rule is None @@ -170,10 +170,10 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.list( domain_id=1, action="allow", - description="description", - enabled=True, + description="This rule blocks all the requests coming form a specific IP address.", + enabled=False, limit=0, - name="name", + name="Block by specific IP rule.", offset=0, ordering="-id", ) @@ -355,7 +355,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: action={}, conditions=[{}], enabled=True, - name="name", + name="Block foobar bot", ) assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @@ -384,7 +384,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> } ], enabled=True, - name="name", + name="Block foobar bot", description="description", ) assert_matches_type(WaapFirewallRule, firewall_rule, path=["response"]) @@ -396,7 +396,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: action={}, conditions=[{}], enabled=True, - name="name", + name="Block foobar bot", ) assert response.is_closed is True @@ -411,7 +411,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None action={}, conditions=[{}], enabled=True, - name="name", + name="Block foobar bot", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -456,7 +456,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> ], description="description", enabled=True, - name="name", + name="Block foobar bot", ) assert firewall_rule is None @@ -498,10 +498,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No firewall_rule = await async_client.waap.domains.firewall_rules.list( domain_id=1, action="allow", - description="description", - enabled=True, + description="This rule blocks all the requests coming form a specific IP address.", + enabled=False, limit=0, - name="name", + name="Block by specific IP rule.", offset=0, ordering="-id", ) diff --git a/tests/api_resources/waap/domains/test_statistics.py b/tests/api_resources/waap/domains/test_statistics.py index 11ac75e3..f46a30a2 100644 --- a/tests/api_resources/waap/domains/test_statistics.py +++ b/tests/api_resources/waap/domains/test_statistics.py @@ -37,11 +37,11 @@ def test_method_get_ddos_attacks(self, client: Gcore) -> None: def test_method_get_ddos_attacks_with_all_params(self, client: Gcore) -> None: statistic = client.waap.domains.statistics.get_ddos_attacks( domain_id=1, - end_time=parse_datetime("2019-12-27T18:11:19.117Z"), + end_time=parse_datetime("2024-04-27T13:00:00Z"), limit=0, offset=0, ordering="start_time", - start_time=parse_datetime("2019-12-27T18:11:19.117Z"), + start_time=parse_datetime("2024-04-26T13:32:49Z"), ) assert_matches_type(SyncOffsetPage[WaapDDOSAttack], statistic, path=["response"]) @@ -74,7 +74,7 @@ def test_method_get_ddos_info(self, client: Gcore) -> None: statistic = client.waap.domains.statistics.get_ddos_info( domain_id=1, group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert_matches_type(SyncOffsetPage[WaapDDOSInfo], statistic, path=["response"]) @@ -83,8 +83,8 @@ def test_method_get_ddos_info_with_all_params(self, client: Gcore) -> None: statistic = client.waap.domains.statistics.get_ddos_info( domain_id=1, group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - end=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", + end="2024-04-14T12:00:00Z", limit=0, offset=0, ) @@ -95,7 +95,7 @@ def test_raw_response_get_ddos_info(self, client: Gcore) -> None: response = client.waap.domains.statistics.with_raw_response.get_ddos_info( domain_id=1, group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert response.is_closed is True @@ -108,7 +108,7 @@ def test_streaming_response_get_ddos_info(self, client: Gcore) -> None: with client.waap.domains.statistics.with_streaming_response.get_ddos_info( domain_id=1, group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -122,7 +122,7 @@ def test_streaming_response_get_ddos_info(self, client: Gcore) -> None: def test_method_get_events_aggregated(self, client: Gcore) -> None: statistic = client.waap.domains.statistics.get_events_aggregated( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert_matches_type(WaapEventStatistics, statistic, path=["response"]) @@ -130,9 +130,9 @@ def test_method_get_events_aggregated(self, client: Gcore) -> None: def test_method_get_events_aggregated_with_all_params(self, client: Gcore) -> None: statistic = client.waap.domains.statistics.get_events_aggregated( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", action=["block", "captcha"], - end=parse_datetime("2019-12-27T18:11:19.117Z"), + end="2024-04-14T12:00:00Z", ip=["string", "string"], reference_id=["string", "string"], result=["passed", "blocked"], @@ -143,7 +143,7 @@ def test_method_get_events_aggregated_with_all_params(self, client: Gcore) -> No def test_raw_response_get_events_aggregated(self, client: Gcore) -> None: response = client.waap.domains.statistics.with_raw_response.get_events_aggregated( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert response.is_closed is True @@ -155,7 +155,7 @@ def test_raw_response_get_events_aggregated(self, client: Gcore) -> None: def test_streaming_response_get_events_aggregated(self, client: Gcore) -> None: with client.waap.domains.statistics.with_streaming_response.get_events_aggregated( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -211,7 +211,7 @@ def test_path_params_get_request_details(self, client: Gcore) -> None: def test_method_get_requests_series(self, client: Gcore) -> None: statistic = client.waap.domains.statistics.get_requests_series( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert_matches_type(SyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) @@ -219,15 +219,15 @@ def test_method_get_requests_series(self, client: Gcore) -> None: def test_method_get_requests_series_with_all_params(self, client: Gcore) -> None: statistic = client.waap.domains.statistics.get_requests_series( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", actions=["allow"], countries=["Mv"], - end=parse_datetime("2019-12-27T18:11:19.117Z"), + end="2024-04-14T12:00:00Z", ip=".:", limit=0, offset=0, ordering="ordering", - reference_id="2c02efDd09B3BA1AEaDd3dCAa7aC7A37", + reference_id="ad07c06f19054e484974fa22e9fb6bb1", security_rule_name="security_rule_name", status_code=100, traffic_types=["policy_allowed"], @@ -238,7 +238,7 @@ def test_method_get_requests_series_with_all_params(self, client: Gcore) -> None def test_raw_response_get_requests_series(self, client: Gcore) -> None: response = client.waap.domains.statistics.with_raw_response.get_requests_series( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert response.is_closed is True @@ -250,7 +250,7 @@ def test_raw_response_get_requests_series(self, client: Gcore) -> None: def test_streaming_response_get_requests_series(self, client: Gcore) -> None: with client.waap.domains.statistics.with_streaming_response.get_requests_series( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -265,7 +265,7 @@ def test_method_get_traffic_series(self, client: Gcore) -> None: statistic = client.waap.domains.statistics.get_traffic_series( domain_id=1, resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) @@ -274,8 +274,8 @@ def test_method_get_traffic_series_with_all_params(self, client: Gcore) -> None: statistic = client.waap.domains.statistics.get_traffic_series( domain_id=1, resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - end=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", + end="2024-04-14T12:00:00Z", ) assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) @@ -284,7 +284,7 @@ def test_raw_response_get_traffic_series(self, client: Gcore) -> None: response = client.waap.domains.statistics.with_raw_response.get_traffic_series( domain_id=1, resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert response.is_closed is True @@ -297,7 +297,7 @@ def test_streaming_response_get_traffic_series(self, client: Gcore) -> None: with client.waap.domains.statistics.with_streaming_response.get_traffic_series( domain_id=1, resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -324,11 +324,11 @@ async def test_method_get_ddos_attacks(self, async_client: AsyncGcore) -> None: async def test_method_get_ddos_attacks_with_all_params(self, async_client: AsyncGcore) -> None: statistic = await async_client.waap.domains.statistics.get_ddos_attacks( domain_id=1, - end_time=parse_datetime("2019-12-27T18:11:19.117Z"), + end_time=parse_datetime("2024-04-27T13:00:00Z"), limit=0, offset=0, ordering="start_time", - start_time=parse_datetime("2019-12-27T18:11:19.117Z"), + start_time=parse_datetime("2024-04-26T13:32:49Z"), ) assert_matches_type(AsyncOffsetPage[WaapDDOSAttack], statistic, path=["response"]) @@ -361,7 +361,7 @@ async def test_method_get_ddos_info(self, async_client: AsyncGcore) -> None: statistic = await async_client.waap.domains.statistics.get_ddos_info( domain_id=1, group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert_matches_type(AsyncOffsetPage[WaapDDOSInfo], statistic, path=["response"]) @@ -370,8 +370,8 @@ async def test_method_get_ddos_info_with_all_params(self, async_client: AsyncGco statistic = await async_client.waap.domains.statistics.get_ddos_info( domain_id=1, group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - end=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", + end="2024-04-14T12:00:00Z", limit=0, offset=0, ) @@ -382,7 +382,7 @@ async def test_raw_response_get_ddos_info(self, async_client: AsyncGcore) -> Non response = await async_client.waap.domains.statistics.with_raw_response.get_ddos_info( domain_id=1, group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert response.is_closed is True @@ -395,7 +395,7 @@ async def test_streaming_response_get_ddos_info(self, async_client: AsyncGcore) async with async_client.waap.domains.statistics.with_streaming_response.get_ddos_info( domain_id=1, group_by="URL", - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -409,7 +409,7 @@ async def test_streaming_response_get_ddos_info(self, async_client: AsyncGcore) async def test_method_get_events_aggregated(self, async_client: AsyncGcore) -> None: statistic = await async_client.waap.domains.statistics.get_events_aggregated( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert_matches_type(WaapEventStatistics, statistic, path=["response"]) @@ -417,9 +417,9 @@ async def test_method_get_events_aggregated(self, async_client: AsyncGcore) -> N async def test_method_get_events_aggregated_with_all_params(self, async_client: AsyncGcore) -> None: statistic = await async_client.waap.domains.statistics.get_events_aggregated( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", action=["block", "captcha"], - end=parse_datetime("2019-12-27T18:11:19.117Z"), + end="2024-04-14T12:00:00Z", ip=["string", "string"], reference_id=["string", "string"], result=["passed", "blocked"], @@ -430,7 +430,7 @@ async def test_method_get_events_aggregated_with_all_params(self, async_client: async def test_raw_response_get_events_aggregated(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.statistics.with_raw_response.get_events_aggregated( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert response.is_closed is True @@ -442,7 +442,7 @@ async def test_raw_response_get_events_aggregated(self, async_client: AsyncGcore async def test_streaming_response_get_events_aggregated(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.statistics.with_streaming_response.get_events_aggregated( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -498,7 +498,7 @@ async def test_path_params_get_request_details(self, async_client: AsyncGcore) - async def test_method_get_requests_series(self, async_client: AsyncGcore) -> None: statistic = await async_client.waap.domains.statistics.get_requests_series( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert_matches_type(AsyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) @@ -506,15 +506,15 @@ async def test_method_get_requests_series(self, async_client: AsyncGcore) -> Non async def test_method_get_requests_series_with_all_params(self, async_client: AsyncGcore) -> None: statistic = await async_client.waap.domains.statistics.get_requests_series( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", actions=["allow"], countries=["Mv"], - end=parse_datetime("2019-12-27T18:11:19.117Z"), + end="2024-04-14T12:00:00Z", ip=".:", limit=0, offset=0, ordering="ordering", - reference_id="2c02efDd09B3BA1AEaDd3dCAa7aC7A37", + reference_id="ad07c06f19054e484974fa22e9fb6bb1", security_rule_name="security_rule_name", status_code=100, traffic_types=["policy_allowed"], @@ -525,7 +525,7 @@ async def test_method_get_requests_series_with_all_params(self, async_client: As async def test_raw_response_get_requests_series(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.statistics.with_raw_response.get_requests_series( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert response.is_closed is True @@ -537,7 +537,7 @@ async def test_raw_response_get_requests_series(self, async_client: AsyncGcore) async def test_streaming_response_get_requests_series(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.statistics.with_streaming_response.get_requests_series( domain_id=1, - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -552,7 +552,7 @@ async def test_method_get_traffic_series(self, async_client: AsyncGcore) -> None statistic = await async_client.waap.domains.statistics.get_traffic_series( domain_id=1, resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) @@ -561,8 +561,8 @@ async def test_method_get_traffic_series_with_all_params(self, async_client: Asy statistic = await async_client.waap.domains.statistics.get_traffic_series( domain_id=1, resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), - end=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", + end="2024-04-14T12:00:00Z", ) assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) @@ -571,7 +571,7 @@ async def test_raw_response_get_traffic_series(self, async_client: AsyncGcore) - response = await async_client.waap.domains.statistics.with_raw_response.get_traffic_series( domain_id=1, resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) assert response.is_closed is True @@ -584,7 +584,7 @@ async def test_streaming_response_get_traffic_series(self, async_client: AsyncGc async with async_client.waap.domains.statistics.with_streaming_response.get_traffic_series( domain_id=1, resolution="daily", - start=parse_datetime("2019-12-27T18:11:19.117Z"), + start="2024-04-13T00:00:00+01:00", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/waap/test_custom_page_sets.py b/tests/api_resources/waap/test_custom_page_sets.py index 204fbc21..1d26207e 100644 --- a/tests/api_resources/waap/test_custom_page_sets.py +++ b/tests/api_resources/waap/test_custom_page_sets.py @@ -186,7 +186,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: custom_page_set = client.waap.custom_page_sets.list( ids=[0], limit=0, - name="name", + name="*example", offset=0, ordering="name", ) @@ -488,7 +488,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No custom_page_set = await async_client.waap.custom_page_sets.list( ids=[0], limit=0, - name="name", + name="*example", offset=0, ordering="name", ) diff --git a/tests/api_resources/waap/test_domains.py b/tests/api_resources/waap/test_domains.py index 8c4234e4..f311215b 100644 --- a/tests/api_resources/waap/test_domains.py +++ b/tests/api_resources/waap/test_domains.py @@ -72,7 +72,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: domain = client.waap.domains.list( ids=[1], limit=0, - name="name", + name="*example.com", offset=0, ordering="id", status="active", @@ -289,7 +289,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No domain = await async_client.waap.domains.list( ids=[1], limit=0, - name="name", + name="*example.com", offset=0, ordering="id", status="active", diff --git a/tests/api_resources/waap/test_organizations.py b/tests/api_resources/waap/test_organizations.py index d4d2c516..ce01cf82 100644 --- a/tests/api_resources/waap/test_organizations.py +++ b/tests/api_resources/waap/test_organizations.py @@ -27,7 +27,7 @@ def test_method_list(self, client: Gcore) -> None: def test_method_list_with_all_params(self, client: Gcore) -> None: organization = client.waap.organizations.list( limit=0, - name="name", + name="Comcast", offset=0, ordering="name", ) @@ -68,7 +68,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: organization = await async_client.waap.organizations.list( limit=0, - name="name", + name="Comcast", offset=0, ordering="name", ) diff --git a/tests/api_resources/waap/test_tags.py b/tests/api_resources/waap/test_tags.py index 00753147..cb4474d8 100644 --- a/tests/api_resources/waap/test_tags.py +++ b/tests/api_resources/waap/test_tags.py @@ -27,10 +27,10 @@ def test_method_list(self, client: Gcore) -> None: def test_method_list_with_all_params(self, client: Gcore) -> None: tag = client.waap.tags.list( limit=0, - name="name", + name="xss", offset=0, ordering="name", - readable_name="readable_name", + readable_name="Cross-Site Scripting", reserved=True, ) assert_matches_type(SyncOffsetPage[WaapTag], tag, path=["response"]) @@ -70,10 +70,10 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: tag = await async_client.waap.tags.list( limit=0, - name="name", + name="xss", offset=0, ordering="name", - readable_name="readable_name", + readable_name="Cross-Site Scripting", reserved=True, ) assert_matches_type(AsyncOffsetPage[WaapTag], tag, path=["response"]) From ed8118698dc8c6d1b1e56cffc822d4c0270297fc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 14:01:56 +0000 Subject: [PATCH 263/592] chore(internal): codegen related update --- requirements-dev.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 9b0a8e90..252c0b2d 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -50,7 +50,7 @@ filelock==3.12.4 frozenlist==1.6.2 # via aiohttp # via aiosignal -griffe==1.12.1 +griffe==1.13.0 h11==0.16.0 # via httpcore httpcore==1.0.9 From 29b5dc884638015e81287201d7c9cb9c309711c2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 14:07:07 +0000 Subject: [PATCH 264/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../gpu_baremetal_clusters.py | 72 ++- .../load_balancers/pools/health_monitors.py | 24 +- .../cloud/load_balancers/pools/members.py | 34 +- .../cloud/load_balancer_create_params.py | 20 +- .../load_balancers/pool_create_params.py | 20 +- .../load_balancers/pool_update_params.py | 20 +- .../load_balancers/pools/member_add_params.py | 20 +- src/gcore/types/cloud/member.py | 20 +- src/gcore/types/cloud/task_id_list.py | 9 +- .../cloud/test_gpu_baremetal_clusters.py | 434 ++++++++++-------- 11 files changed, 435 insertions(+), 242 deletions(-) diff --git a/.stats.yml b/.stats.yml index 79be4d72..246dfa1e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 480 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5486e95e5adc26944665ee4213dafb148ea3875e2641d04ad7f1ca4330f09785.yml -openapi_spec_hash: e9e3325ca367d257b8dcb79d7ddb7310 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b3e8627835034514e1b765433a2f9bf72929f65149bc4293e31c7867795e56da.yml +openapi_spec_hash: fb2f2a05368ea82cba2d937eac0a5e8e config_hash: dbf10aa8f50ffee4df7ed95b2b42f9a9 diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 8ebe6b68..27cb4d94 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -101,6 +101,7 @@ def with_streaming_response(self) -> GPUBaremetalClustersResourceWithStreamingRe """ return GPUBaremetalClustersResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def create( self, *, @@ -127,7 +128,8 @@ def create( """Create a new GPU cluster with specified configuration. The cluster can be - created with one or more nodes. + created with one or more nodes. Please use the + `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters` endpoint instead. Args: flavor: Flavor name @@ -254,6 +256,7 @@ def list( model=GPUBaremetalCluster, ) + @typing_extensions.deprecated("deprecated") def delete( self, cluster_id: str, @@ -270,8 +273,11 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Delete bare metal GPU cluster + """Deletes given bare metal GPU cluster. + + Please use the + `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters/{`cluster_id`}` + instead. Args: delete_floatings: True if it is required to delete floating IPs assigned to the servers. Can't be @@ -580,6 +586,7 @@ def with_streaming_response(self) -> AsyncGPUBaremetalClustersResourceWithStream """ return AsyncGPUBaremetalClustersResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def create( self, *, @@ -606,7 +613,8 @@ async def create( """Create a new GPU cluster with specified configuration. The cluster can be - created with one or more nodes. + created with one or more nodes. Please use the + `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters` endpoint instead. Args: flavor: Flavor name @@ -733,6 +741,7 @@ def list( model=GPUBaremetalCluster, ) + @typing_extensions.deprecated("deprecated") async def delete( self, cluster_id: str, @@ -749,8 +758,11 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """ - Delete bare metal GPU cluster + """Deletes given bare metal GPU cluster. + + Please use the + `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters/{`cluster_id`}` + instead. Args: delete_floatings: True if it is required to delete floating IPs assigned to the servers. Can't be @@ -1027,16 +1039,20 @@ class GPUBaremetalClustersResourceWithRawResponse: def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None: self._gpu_baremetal_clusters = gpu_baremetal_clusters - self.create = to_raw_response_wrapper( - gpu_baremetal_clusters.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + gpu_baremetal_clusters.create # pyright: ignore[reportDeprecated], + ) ) self.list = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( gpu_baremetal_clusters.list # pyright: ignore[reportDeprecated], ) ) - self.delete = to_raw_response_wrapper( - gpu_baremetal_clusters.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + gpu_baremetal_clusters.delete # pyright: ignore[reportDeprecated], + ) ) self.get = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( @@ -1077,16 +1093,20 @@ class AsyncGPUBaremetalClustersResourceWithRawResponse: def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> None: self._gpu_baremetal_clusters = gpu_baremetal_clusters - self.create = async_to_raw_response_wrapper( - gpu_baremetal_clusters.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + gpu_baremetal_clusters.create # pyright: ignore[reportDeprecated], + ) ) self.list = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( gpu_baremetal_clusters.list # pyright: ignore[reportDeprecated], ) ) - self.delete = async_to_raw_response_wrapper( - gpu_baremetal_clusters.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + gpu_baremetal_clusters.delete # pyright: ignore[reportDeprecated], + ) ) self.get = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( @@ -1127,16 +1147,20 @@ class GPUBaremetalClustersResourceWithStreamingResponse: def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None: self._gpu_baremetal_clusters = gpu_baremetal_clusters - self.create = to_streamed_response_wrapper( - gpu_baremetal_clusters.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + gpu_baremetal_clusters.create # pyright: ignore[reportDeprecated], + ) ) self.list = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( gpu_baremetal_clusters.list # pyright: ignore[reportDeprecated], ) ) - self.delete = to_streamed_response_wrapper( - gpu_baremetal_clusters.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + gpu_baremetal_clusters.delete # pyright: ignore[reportDeprecated], + ) ) self.get = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( @@ -1177,16 +1201,20 @@ class AsyncGPUBaremetalClustersResourceWithStreamingResponse: def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> None: self._gpu_baremetal_clusters = gpu_baremetal_clusters - self.create = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + gpu_baremetal_clusters.create # pyright: ignore[reportDeprecated], + ) ) self.list = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( gpu_baremetal_clusters.list # pyright: ignore[reportDeprecated], ) ) - self.delete = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + gpu_baremetal_clusters.delete # pyright: ignore[reportDeprecated], + ) ) self.get = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index 81aab472..bae1858c 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -68,7 +68,10 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create load balancer pool health monitor + Creates a health monitor for a load balancer pool to automatically check the + health status of pool members. The health monitor performs periodic checks on + pool members and removes unhealthy members from rotation, ensuring only healthy + servers receive traffic. Args: project_id: Project ID @@ -145,8 +148,11 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: - """ - Delete load balancer pool health monitor + """Removes the health monitor from a load balancer pool. + + After deletion, the pool + will no longer perform automatic health checks on its members, and all members + will remain in rotation regardless of their actual health status. Args: project_id: Project ID @@ -221,7 +227,10 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Create load balancer pool health monitor + Creates a health monitor for a load balancer pool to automatically check the + health status of pool members. The health monitor performs periodic checks on + pool members and removes unhealthy members from rotation, ensuring only healthy + servers receive traffic. Args: project_id: Project ID @@ -298,8 +307,11 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: - """ - Delete load balancer pool health monitor + """Removes the health monitor from a load balancer pool. + + After deletion, the pool + will no longer perform automatic health checks on its members, and all members + will remain in rotation regardless of their actual health status. Args: project_id: Project ID diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index a2a9ba94..05091a8b 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -99,7 +99,22 @@ def add( subnet_id: `subnet_id` in which `address` is present. Either `subnet_id` or `instance_id` should be provided - weight: Member weight. Valid values are 0 < `weight` <= 256, defaults to 1. + weight: Member weight. Valid values are 0 < `weight` <= 256, defaults to 1. Controls + traffic distribution based on the pool's load balancing algorithm: + + - `ROUND_ROBIN`: Distributes connections to each member in turn according to + weights. Higher weight = more turns in the cycle. Example: weights 3 vs 1 = + ~75% vs ~25% of requests. + - `LEAST_CONNECTIONS`: Sends new connections to the member with fewest active + connections, performing round-robin within groups of the same normalized load. + Higher weight = allowed to hold more simultaneous connections before being + considered 'more loaded'. Example: weights 2 vs 1 means 20 vs 10 active + connections is treated as balanced. + - `SOURCE_IP`: Routes clients consistently to the same member by hashing client + source IP; hash result is modulo total weight of running members. Higher + weight = more hash buckets, so more client IPs map to that member. Example: + weights 2 vs 1 = roughly two-thirds of distinct client IPs map to the + higher-weight member. extra_headers: Send extra headers @@ -264,7 +279,22 @@ async def add( subnet_id: `subnet_id` in which `address` is present. Either `subnet_id` or `instance_id` should be provided - weight: Member weight. Valid values are 0 < `weight` <= 256, defaults to 1. + weight: Member weight. Valid values are 0 < `weight` <= 256, defaults to 1. Controls + traffic distribution based on the pool's load balancing algorithm: + + - `ROUND_ROBIN`: Distributes connections to each member in turn according to + weights. Higher weight = more turns in the cycle. Example: weights 3 vs 1 = + ~75% vs ~25% of requests. + - `LEAST_CONNECTIONS`: Sends new connections to the member with fewest active + connections, performing round-robin within groups of the same normalized load. + Higher weight = allowed to hold more simultaneous connections before being + considered 'more loaded'. Example: weights 2 vs 1 means 20 vs 10 active + connections is treated as balanced. + - `SOURCE_IP`: Routes clients consistently to the same member by hashing client + source IP; hash result is modulo total weight of running members. Higher + weight = more hash buckets, so more client IPs map to that member. Example: + weights 2 vs 1 = roughly two-thirds of distinct client IPs map to the + higher-weight member. extra_headers: Send extra headers diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 6b2f7564..d3951c2d 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -216,7 +216,25 @@ class ListenerPoolMember(TypedDict, total=False): """ weight: int - """Member weight. Valid values are 0 < `weight` <= 256, defaults to 1.""" + """Member weight. + + Valid values are 0 < `weight` <= 256, defaults to 1. Controls traffic + distribution based on the pool's load balancing algorithm: + + - `ROUND_ROBIN`: Distributes connections to each member in turn according to + weights. Higher weight = more turns in the cycle. Example: weights 3 vs 1 = + ~75% vs ~25% of requests. + - `LEAST_CONNECTIONS`: Sends new connections to the member with fewest active + connections, performing round-robin within groups of the same normalized load. + Higher weight = allowed to hold more simultaneous connections before being + considered 'more loaded'. Example: weights 2 vs 1 means 20 vs 10 active + connections is treated as balanced. + - `SOURCE_IP`: Routes clients consistently to the same member by hashing client + source IP; hash result is modulo total weight of running members. Higher + weight = more hash buckets, so more client IPs map to that member. Example: + weights 2 vs 1 = roughly two-thirds of distinct client IPs map to the + higher-weight member. + """ class ListenerPoolSessionPersistence(TypedDict, total=False): 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 28f38cf5..b19fb813 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -147,7 +147,25 @@ class Member(TypedDict, total=False): """ weight: int - """Member weight. Valid values are 0 < `weight` <= 256, defaults to 1.""" + """Member weight. + + Valid values are 0 < `weight` <= 256, defaults to 1. Controls traffic + distribution based on the pool's load balancing algorithm: + + - `ROUND_ROBIN`: Distributes connections to each member in turn according to + weights. Higher weight = more turns in the cycle. Example: weights 3 vs 1 = + ~75% vs ~25% of requests. + - `LEAST_CONNECTIONS`: Sends new connections to the member with fewest active + connections, performing round-robin within groups of the same normalized load. + Higher weight = allowed to hold more simultaneous connections before being + considered 'more loaded'. Example: weights 2 vs 1 means 20 vs 10 active + connections is treated as balanced. + - `SOURCE_IP`: Routes clients consistently to the same member by hashing client + source IP; hash result is modulo total weight of running members. Higher + weight = more hash buckets, so more client IPs map to that member. Example: + weights 2 vs 1 = roughly two-thirds of distinct client IPs map to the + higher-weight member. + """ class SessionPersistence(TypedDict, total=False): 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 490b704e..088d3cec 100644 --- a/src/gcore/types/cloud/load_balancers/pool_update_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_update_params.py @@ -145,7 +145,25 @@ class Member(TypedDict, total=False): """ weight: int - """Member weight. Valid values are 0 < `weight` <= 256, defaults to 1.""" + """Member weight. + + Valid values are 0 < `weight` <= 256, defaults to 1. Controls traffic + distribution based on the pool's load balancing algorithm: + + - `ROUND_ROBIN`: Distributes connections to each member in turn according to + weights. Higher weight = more turns in the cycle. Example: weights 3 vs 1 = + ~75% vs ~25% of requests. + - `LEAST_CONNECTIONS`: Sends new connections to the member with fewest active + connections, performing round-robin within groups of the same normalized load. + Higher weight = allowed to hold more simultaneous connections before being + considered 'more loaded'. Example: weights 2 vs 1 means 20 vs 10 active + connections is treated as balanced. + - `SOURCE_IP`: Routes clients consistently to the same member by hashing client + source IP; hash result is modulo total weight of running members. Higher + weight = more hash buckets, so more client IPs map to that member. Example: + weights 2 vs 1 = roughly two-thirds of distinct client IPs map to the + higher-weight member. + """ class SessionPersistence(TypedDict, total=False): diff --git a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py index 08af2d6c..7b62edc9 100644 --- a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/member_add_params.py @@ -59,4 +59,22 @@ class MemberAddParams(TypedDict, total=False): """ weight: int - """Member weight. Valid values are 0 < `weight` <= 256, defaults to 1.""" + """Member weight. + + Valid values are 0 < `weight` <= 256, defaults to 1. Controls traffic + distribution based on the pool's load balancing algorithm: + + - `ROUND_ROBIN`: Distributes connections to each member in turn according to + weights. Higher weight = more turns in the cycle. Example: weights 3 vs 1 = + ~75% vs ~25% of requests. + - `LEAST_CONNECTIONS`: Sends new connections to the member with fewest active + connections, performing round-robin within groups of the same normalized load. + Higher weight = allowed to hold more simultaneous connections before being + considered 'more loaded'. Example: weights 2 vs 1 means 20 vs 10 active + connections is treated as balanced. + - `SOURCE_IP`: Routes clients consistently to the same member by hashing client + source IP; hash result is modulo total weight of running members. Higher + weight = more hash buckets, so more client IPs map to that member. Example: + weights 2 vs 1 = roughly two-thirds of distinct client IPs map to the + higher-weight member. + """ diff --git a/src/gcore/types/cloud/member.py b/src/gcore/types/cloud/member.py index 71e0be9a..98acfa1e 100644 --- a/src/gcore/types/cloud/member.py +++ b/src/gcore/types/cloud/member.py @@ -45,7 +45,25 @@ class Member(BaseModel): """`subnet_id` in which `address` is present.""" weight: int - """Member weight. Valid values are 0 < `weight` <= 256.""" + """Member weight. + + Valid values are 0 < `weight` <= 256, defaults to 1. Controls traffic + distribution based on the pool's load balancing algorithm: + + - `ROUND_ROBIN`: Distributes connections to each member in turn according to + weights. Higher weight = more turns in the cycle. Example: weights 3 vs 1 = + ~75% vs ~25% of requests. + - `LEAST_CONNECTIONS`: Sends new connections to the member with fewest active + connections, performing round-robin within groups of the same normalized load. + Higher weight = allowed to hold more simultaneous connections before being + considered 'more loaded'. Example: weights 2 vs 1 means 20 vs 10 active + connections is treated as balanced. + - `SOURCE_IP`: Routes clients consistently to the same member by hashing client + source IP; hash result is modulo total weight of running members. Higher + weight = more hash buckets, so more client IPs map to that member. Example: + weights 2 vs 1 = roughly two-thirds of distinct client IPs map to the + higher-weight member. + """ monitor_address: Optional[str] = None """An alternate IP address used for health monitoring of a backend member. diff --git a/src/gcore/types/cloud/task_id_list.py b/src/gcore/types/cloud/task_id_list.py index 957deed7..7796e645 100644 --- a/src/gcore/types/cloud/task_id_list.py +++ b/src/gcore/types/cloud/task_id_list.py @@ -9,4 +9,11 @@ class TaskIDList(BaseModel): tasks: List[str] - """List of task IDs""" + """List of task IDs representing asynchronous operations. + + Use these IDs to monitor operation progress: + + - `GET /v1/tasks/{`task_id`}` - Check individual task status and details Poll + task status until completion (`FINISHED`/`ERROR`) before proceeding with + dependent operations. + """ diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index 1cf6cb78..2795d56b 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -26,65 +26,70 @@ class TestGPUBaremetalClusters: @parametrize def test_method_create(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( + project_id=0, + region_id=0, + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - "floating_ip": {"source": "new"}, - "interface_name": "interface_name", - } - ], - name="my-gpu-cluster", - instances_count=1, - password="password", - security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], - ssh_key_name="my-ssh-key", - tags={"my-tag": "my-tag-value"}, - user_data="user_data", - username="username", - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( + project_id=0, + region_id=0, + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + "floating_ip": {"source": "new"}, + "interface_name": "interface_name", + } + ], + name="my-gpu-cluster", + instances_count=1, + password="password", + security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], + ssh_key_name="my-ssh-key", + tags={"my-tag": "my-tag-value"}, + user_data="user_data", + username="username", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.gpu_baremetal_clusters.with_raw_response.create( + project_id=0, + region_id=0, + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -93,25 +98,26 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.gpu_baremetal_clusters.with_streaming_response.create( + project_id=0, + region_id=0, + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -167,32 +173,37 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize def test_method_delete_with_all_params(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - delete_floatings=True, - floatings="floatings", - reserved_fixed_ips="reserved_fixed_ips", - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + delete_floatings=True, + floatings="floatings", + reserved_fixed_ips="reserved_fixed_ips", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -201,27 +212,29 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.gpu_baremetal_clusters.with_streaming_response.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.delete( - cluster_id="", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + cluster_id="", + project_id=0, + region_id=0, + ) @parametrize def test_method_get(self, client: Gcore) -> None: @@ -486,65 +499,70 @@ class TestAsyncGPUBaremetalClusters: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( + project_id=0, + region_id=0, + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - "floating_ip": {"source": "new"}, - "interface_name": "interface_name", - } - ], - name="my-gpu-cluster", - instances_count=1, - password="password", - security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], - ssh_key_name="my-ssh-key", - tags={"my-tag": "my-tag-value"}, - user_data="user_data", - username="username", - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( + project_id=0, + region_id=0, + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + "floating_ip": {"source": "new"}, + "interface_name": "interface_name", + } + ], + name="my-gpu-cluster", + instances_count=1, + password="password", + security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], + ssh_key_name="my-ssh-key", + tags={"my-tag": "my-tag-value"}, + user_data="user_data", + username="username", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.create( + project_id=0, + region_id=0, + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -553,25 +571,26 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) 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.gpu_baremetal_clusters.with_streaming_response.create( + project_id=0, + region_id=0, + flavor="bm3-ai-1xlarge-h100-80-8", + image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", + interfaces=[ + { + "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", + "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", + "type": "subnet", + } + ], + name="my-gpu-cluster", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -627,32 +646,37 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - delete_floatings=True, - floatings="floatings", - reserved_fixed_ips="reserved_fixed_ips", - ) + with pytest.warns(DeprecationWarning): + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + delete_floatings=True, + floatings="floatings", + reserved_fixed_ips="reserved_fixed_ips", + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -661,27 +685,29 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) 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.gpu_baremetal_clusters.with_streaming_response.delete( + cluster_id="cluster_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.delete( - cluster_id="", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + cluster_id="", + project_id=0, + region_id=0, + ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: From 053c3f7b97002fbca5c4da2d791f646060e3d660 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 16:07:31 +0000 Subject: [PATCH 265/592] fix: avoid newer type syntax --- src/gcore/_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gcore/_models.py b/src/gcore/_models.py index b8387ce9..92f7c10b 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -304,7 +304,7 @@ def model_dump( exclude_none=exclude_none, ) - return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped + return cast("dict[str, Any]", json_safe(dumped)) if mode == "json" else dumped @override def model_dump_json( From b02e78722bd22296c839dcf1d18ea10b6554d19c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 21:57:39 +0000 Subject: [PATCH 266/592] chore(internal): update pyright exclude list --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index e44f7cea..91ce7891 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -149,6 +149,7 @@ exclude = [ "_dev", ".venv", ".nox", + ".git", ] reportImplicitOverride = true From 25eb37367d55831211e3883bac50e827af2b39d7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 14:41:27 +0000 Subject: [PATCH 267/592] chore(internal): minor formatting change --- .../gpu_baremetal_clusters.py | 32 +++++++++---------- .../inference/deployments/deployments.py | 8 ++--- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 27cb4d94..f6167f79 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -1041,22 +1041,22 @@ def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None self.create = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( - gpu_baremetal_clusters.create # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.create, # pyright: ignore[reportDeprecated], ) ) self.list = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( - gpu_baremetal_clusters.list # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.list, # pyright: ignore[reportDeprecated], ) ) self.delete = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( - gpu_baremetal_clusters.delete # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.delete, # pyright: ignore[reportDeprecated], ) ) self.get = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( - gpu_baremetal_clusters.get # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.get, # pyright: ignore[reportDeprecated], ) ) self.powercycle_all_servers = to_raw_response_wrapper( @@ -1095,22 +1095,22 @@ def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> self.create = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( - gpu_baremetal_clusters.create # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.create, # pyright: ignore[reportDeprecated], ) ) self.list = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( - gpu_baremetal_clusters.list # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.list, # pyright: ignore[reportDeprecated], ) ) self.delete = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( - gpu_baremetal_clusters.delete # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.delete, # pyright: ignore[reportDeprecated], ) ) self.get = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( - gpu_baremetal_clusters.get # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.get, # pyright: ignore[reportDeprecated], ) ) self.powercycle_all_servers = async_to_raw_response_wrapper( @@ -1149,22 +1149,22 @@ def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None self.create = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( - gpu_baremetal_clusters.create # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.create, # pyright: ignore[reportDeprecated], ) ) self.list = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( - gpu_baremetal_clusters.list # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.list, # pyright: ignore[reportDeprecated], ) ) self.delete = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( - gpu_baremetal_clusters.delete # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.delete, # pyright: ignore[reportDeprecated], ) ) self.get = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( - gpu_baremetal_clusters.get # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.get, # pyright: ignore[reportDeprecated], ) ) self.powercycle_all_servers = to_streamed_response_wrapper( @@ -1203,22 +1203,22 @@ def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> self.create = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( - gpu_baremetal_clusters.create # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.create, # pyright: ignore[reportDeprecated], ) ) self.list = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( - gpu_baremetal_clusters.list # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.list, # pyright: ignore[reportDeprecated], ) ) self.delete = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( - gpu_baremetal_clusters.delete # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.delete, # pyright: ignore[reportDeprecated], ) ) self.get = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( - gpu_baremetal_clusters.get # pyright: ignore[reportDeprecated], + gpu_baremetal_clusters.get, # pyright: ignore[reportDeprecated], ) ) self.powercycle_all_servers = async_to_streamed_response_wrapper( diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 9a3b7bf8..a195c324 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -1108,7 +1108,7 @@ def __init__(self, deployments: DeploymentsResource) -> None: ) self.get_api_key = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( - deployments.get_api_key # pyright: ignore[reportDeprecated], + deployments.get_api_key, # pyright: ignore[reportDeprecated], ) ) self.start = to_raw_response_wrapper( @@ -1144,7 +1144,7 @@ def __init__(self, deployments: AsyncDeploymentsResource) -> None: ) self.get_api_key = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( - deployments.get_api_key # pyright: ignore[reportDeprecated], + deployments.get_api_key, # pyright: ignore[reportDeprecated], ) ) self.start = async_to_raw_response_wrapper( @@ -1180,7 +1180,7 @@ def __init__(self, deployments: DeploymentsResource) -> None: ) self.get_api_key = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( - deployments.get_api_key # pyright: ignore[reportDeprecated], + deployments.get_api_key, # pyright: ignore[reportDeprecated], ) ) self.start = to_streamed_response_wrapper( @@ -1216,7 +1216,7 @@ def __init__(self, deployments: AsyncDeploymentsResource) -> None: ) self.get_api_key = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( - deployments.get_api_key # pyright: ignore[reportDeprecated], + deployments.get_api_key, # pyright: ignore[reportDeprecated], ) ) self.start = async_to_streamed_response_wrapper( From 65084969898016462112cb2cc707f389c4c179c6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 28 Aug 2025 12:58:00 +0000 Subject: [PATCH 268/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- .../dns/dns_get_account_overview_response.py | 24 +++---------------- src/gcore/types/dns/zone_get_response.py | 4 +++- src/gcore/types/dns/zone_list_response.py | 2 ++ 4 files changed, 10 insertions(+), 24 deletions(-) diff --git a/.stats.yml b/.stats.yml index 246dfa1e..b6106eef 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 480 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b3e8627835034514e1b765433a2f9bf72929f65149bc4293e31c7867795e56da.yml -openapi_spec_hash: fb2f2a05368ea82cba2d937eac0a5e8e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c04f3964598a95c86f56053432aba58cab66efa11c8633f58a89b2f904d033c9.yml +openapi_spec_hash: c52e47aa1d3bab4796afb927c78b0f4e config_hash: dbf10aa8f50ffee4df7ed95b2b42f9a9 diff --git a/src/gcore/types/dns/dns_get_account_overview_response.py b/src/gcore/types/dns/dns_get_account_overview_response.py index 35e11fef..6f91a78e 100644 --- a/src/gcore/types/dns/dns_get_account_overview_response.py +++ b/src/gcore/types/dns/dns_get_account_overview_response.py @@ -6,25 +6,10 @@ from ..._models import BaseModel -__all__ = ["DNSGetAccountOverviewResponse", "Client", "Settings"] +__all__ = ["DNSGetAccountOverviewResponse", "Info"] -class Client(BaseModel): - client_id: Optional[int] = None - - enabled: Optional[bool] = None - - reseller: Optional[int] = None - - status: Optional[str] = None - - tariff_id: Optional[int] = None - - tariff_name: Optional[str] = None - """TariffName""" - - -class Settings(BaseModel): +class Info(BaseModel): contact: Optional[str] = None name_server_1: Optional[str] = None @@ -33,7 +18,4 @@ class Settings(BaseModel): class DNSGetAccountOverviewResponse(BaseModel): - client: Optional[Client] = FieldInfo(alias="Client", default=None) - """Client""" - - settings: Optional[Settings] = None + info: Optional[Info] = FieldInfo(alias="Info", default=None) diff --git a/src/gcore/types/dns/zone_get_response.py b/src/gcore/types/dns/zone_get_response.py index 1f43e8ca..912d6f73 100644 --- a/src/gcore/types/dns/zone_get_response.py +++ b/src/gcore/types/dns/zone_get_response.py @@ -45,6 +45,8 @@ class Zone(BaseModel): of getting deleted zones by admin. """ + client_id: Optional[int] = None + contact: Optional[str] = None """email address of the administrator responsible for this zone""" @@ -101,4 +103,4 @@ class Zone(BaseModel): class ZoneGetResponse(BaseModel): zone: Optional[Zone] = FieldInfo(alias="Zone", default=None) - """swagger: model""" + """OutputZone""" diff --git a/src/gcore/types/dns/zone_list_response.py b/src/gcore/types/dns/zone_list_response.py index 3bd194de..6a3826f3 100644 --- a/src/gcore/types/dns/zone_list_response.py +++ b/src/gcore/types/dns/zone_list_response.py @@ -43,6 +43,8 @@ class Zone(BaseModel): of getting deleted zones by admin. """ + client_id: Optional[int] = None + contact: Optional[str] = None """email address of the administrator responsible for this zone""" From 7c9fc1dd19bbac7a3430b9f156042dbe228d6b46 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 28 Aug 2025 14:26:47 +0000 Subject: [PATCH 269/592] feat(cloud)!: migrate baremetal gpu cluster from v1 to v3 --- .stats.yml | 4 +- api.md | 43 +- .../cloud/gpu_baremetal_clusters/flavors.py | 2 +- .../gpu_baremetal_clusters.py | 372 +++++----- .../cloud/gpu_baremetal_clusters/servers.py | 163 ++++- src/gcore/types/cloud/__init__.py | 4 - .../types/cloud/gpu_baremetal_cluster.py | 175 +++-- .../gpu_baremetal_cluster_create_params.py | 169 +++-- .../gpu_baremetal_cluster_delete_params.py | 22 +- .../gpu_baremetal_cluster_list_params.py | 17 +- .../gpu_baremetal_cluster_server_list.py | 16 - .../cloud/gpu_baremetal_clusters/__init__.py | 6 + .../gpu_baremetal_cluster_server.py | 74 ++ .../gpu_baremetal_cluster_server_v1.py} | 20 +- .../gpu_baremetal_cluster_server_v1_list.py | 16 + .../gpu_baremetal_flavor.py | 2 +- .../gpu_baremetal_flavor_list.py | 2 +- .../server_list_params.py | 21 + .../gpu_baremetal_clusters/test_flavors.py | 2 +- .../gpu_baremetal_clusters/test_servers.py | 145 +++- .../cloud/test_gpu_baremetal_clusters.py | 636 ++++++++---------- 21 files changed, 1085 insertions(+), 826 deletions(-) delete mode 100644 src/gcore/types/cloud/gpu_baremetal_cluster_server_list.py create mode 100644 src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py rename src/gcore/types/cloud/{gpu_baremetal_cluster_server.py => gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1.py} (91%) create mode 100644 src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1_list.py rename src/gcore/types/cloud/{ => gpu_baremetal_clusters}/gpu_baremetal_flavor.py (99%) rename src/gcore/types/cloud/{ => gpu_baremetal_clusters}/gpu_baremetal_flavor_list.py (91%) create mode 100644 src/gcore/types/cloud/gpu_baremetal_clusters/server_list_params.py diff --git a/.stats.yml b/.stats.yml index b6106eef..5ac155f6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 480 +configured_endpoints: 481 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c04f3964598a95c86f56053432aba58cab66efa11c8633f58a89b2f904d033c9.yml openapi_spec_hash: c52e47aa1d3bab4796afb927c78b0f4e -config_hash: dbf10aa8f50ffee4df7ed95b2b42f9a9 +config_hash: 5601e8aebf3c8606867a46bf79b1fd28 diff --git a/api.md b/api.md index 6167d032..79effe95 100644 --- a/api.md +++ b/api.md @@ -761,23 +761,17 @@ Methods: Types: ```python -from gcore.types.cloud import ( - GPUBaremetalCluster, - GPUBaremetalClusterServer, - GPUBaremetalClusterServerList, - GPUBaremetalFlavor, - GPUBaremetalFlavorList, -) +from gcore.types.cloud import GPUBaremetalCluster ``` Methods: -- client.cloud.gpu_baremetal_clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalCluster] -- client.cloud.gpu_baremetal_clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.get(cluster_id, \*, project_id, region_id) -> GPUBaremetalCluster -- client.cloud.gpu_baremetal_clusters.powercycle_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerList -- client.cloud.gpu_baremetal_clusters.reboot_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerList +- client.cloud.gpu_baremetal_clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalCluster] +- client.cloud.gpu_baremetal_clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.get(cluster_id, \*, project_id, region_id) -> GPUBaremetalCluster +- client.cloud.gpu_baremetal_clusters.powercycle_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List +- client.cloud.gpu_baremetal_clusters.reboot_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List - client.cloud.gpu_baremetal_clusters.rebuild(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.resize(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList @@ -789,20 +783,37 @@ Methods: ### Servers +Types: + +```python +from gcore.types.cloud.gpu_baremetal_clusters import ( + GPUBaremetalClusterServer, + GPUBaremetalClusterServerV1, + GPUBaremetalClusterServerV1List, +) +``` + Methods: +- client.cloud.gpu_baremetal_clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalClusterServer] - client.cloud.gpu_baremetal_clusters.servers.delete(instance_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.servers.attach_interface(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.servers.detach_interface(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.servers.get_console(instance_id, \*, project_id, region_id) -> Console -- client.cloud.gpu_baremetal_clusters.servers.powercycle(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServer -- client.cloud.gpu_baremetal_clusters.servers.reboot(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServer +- client.cloud.gpu_baremetal_clusters.servers.powercycle(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 +- client.cloud.gpu_baremetal_clusters.servers.reboot(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 ### Flavors +Types: + +```python +from gcore.types.cloud.gpu_baremetal_clusters import GPUBaremetalFlavor, GPUBaremetalFlavorList +``` + Methods: -- client.cloud.gpu_baremetal_clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUBaremetalFlavorList +- client.cloud.gpu_baremetal_clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUBaremetalFlavorList ### Images diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index abe8d9ef..2c4563b5 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -16,7 +16,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.gpu_baremetal_clusters import flavor_list_params -from ....types.cloud.gpu_baremetal_flavor_list import GPUBaremetalFlavorList +from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_flavor_list import GPUBaremetalFlavorList __all__ = ["FlavorsResource", "AsyncFlavorsResource"] diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index f6167f79..8daaf242 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -2,8 +2,8 @@ from __future__ import annotations -import typing_extensions -from typing import Dict, List, Iterable, Optional +from typing import Dict, List, Optional +from typing_extensions import Literal import httpx @@ -60,7 +60,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.gpu_baremetal_cluster import GPUBaremetalCluster -from ....types.cloud.gpu_baremetal_cluster_server_list import GPUBaremetalClusterServerList +from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_cluster_server_v1_list import GPUBaremetalClusterServerV1List __all__ = ["GPUBaremetalClustersResource", "AsyncGPUBaremetalClustersResource"] @@ -101,7 +101,6 @@ def with_streaming_response(self) -> GPUBaremetalClustersResourceWithStreamingRe """ return GPUBaremetalClustersResourceWithStreamingResponse(self) - @typing_extensions.deprecated("deprecated") def create( self, *, @@ -109,15 +108,10 @@ def create( region_id: int | None = None, flavor: str, image_id: str, - interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface], name: str, - instances_count: int | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - security_groups: Iterable[gpu_baremetal_cluster_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, - ssh_key_name: str | NotGiven = NOT_GIVEN, + servers_count: int, + servers_settings: gpu_baremetal_cluster_create_params.ServersSettings, tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -125,32 +119,23 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """Create a new GPU cluster with specified configuration. - - The cluster can be - created with one or more nodes. Please use the - `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters` endpoint instead. + """ + Create a new bare metal GPU cluster with the specified configuration. Args: - flavor: Flavor name - - image_id: Image ID + project_id: Project ID - interfaces: A list of network interfaces for the server. You can create one or more - interfaces - private, public, or both. + region_id: Region ID - name: GPU Cluster name + flavor: Cluster flavor ID - instances_count: Number of servers to create + image_id: System image ID - password: A password for a bare metal server. This parameter is used to set a password for - the "Admin" user on a Windows instance, a default user or a new user on a Linux - instance + name: Cluster name - security_groups: Security group UUIDs + servers_count: Number of servers in the cluster - ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). + servers_settings: Configuration settings for the servers in the cluster tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -158,13 +143,6 @@ def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - user_data: String in base64 format. Must not be passed together with 'username' or - 'password'. Examples of the `user_data`: - https://cloudinit.readthedocs.io/en/latest/topics/examples.html - - username: A name of a new user in the Linux instance. It may be passed with a 'password' - parameter - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -178,20 +156,15 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=maybe_transform( { "flavor": flavor, "image_id": image_id, - "interfaces": interfaces, "name": name, - "instances_count": instances_count, - "password": password, - "security_groups": security_groups, - "ssh_key_name": ssh_key_name, + "servers_count": servers_count, + "servers_settings": servers_settings, "tags": tags, - "user_data": user_data, - "username": username, }, gpu_baremetal_cluster_create_params.GPUBaremetalClusterCreateParams, ), @@ -201,13 +174,13 @@ def create( cast_to=TaskIDList, ) - @typing_extensions.deprecated("deprecated") def list( self, *, project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, + managed_by: List[Literal["k8s", "user"]] | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -217,13 +190,22 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncOffsetPage[GPUBaremetalCluster]: """ - Please use the `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters` - instead. + List all bare metal GPU clusters in the specified project and region. Args: - limit: Limit the number of returned clusters + project_id: Project ID + + region_id: Region ID + + limit: Limit of items on a single page + + managed_by: Specifies the entity responsible for managing the resource. - offset: Offset value is used to exclude the first set of records from the result + - `user`: The resource (cluster) is created and maintained directly by the user. + - `k8s`: The resource is created and maintained automatically by Managed + Kubernetes service + + offset: Offset in results list extra_headers: Send extra headers @@ -238,7 +220,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=SyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -248,6 +230,7 @@ def list( query=maybe_transform( { "limit": limit, + "managed_by": managed_by, "offset": offset, }, gpu_baremetal_cluster_list_params.GPUBaremetalClusterListParams, @@ -256,16 +239,15 @@ def list( model=GPUBaremetalCluster, ) - @typing_extensions.deprecated("deprecated") def delete( self, cluster_id: str, *, project_id: int | None = None, region_id: int | None = None, - delete_floatings: bool | NotGiven = NOT_GIVEN, - floatings: str | NotGiven = NOT_GIVEN, - reserved_fixed_ips: str | NotGiven = NOT_GIVEN, + all_floating_ips: bool | NotGiven = NOT_GIVEN, + floating_ip_ids: List[str] | NotGiven = NOT_GIVEN, + reserved_fixed_ip_ids: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -273,20 +255,22 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """Deletes given bare metal GPU cluster. - - Please use the - `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters/{`cluster_id`}` - instead. + """ + Delete a bare metal GPU cluster and all its associated resources. Args: - delete_floatings: True if it is required to delete floating IPs assigned to the servers. Can't be - used with floatings. + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier - floatings: Comma separated list of floating ids that should be deleted. Can't be used with - `delete_floatings`. + all_floating_ips: Flag indicating whether the floating ips associated with server / cluster are + deleted - reserved_fixed_ips: Comma separated list of port IDs to be deleted with the servers + floating_ip_ids: Optional list of floating ips to be deleted + + reserved_fixed_ip_ids: Optional list of reserved fixed ips to be deleted extra_headers: Send extra headers @@ -303,7 +287,7 @@ def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._delete( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -311,9 +295,9 @@ def delete( timeout=timeout, query=maybe_transform( { - "delete_floatings": delete_floatings, - "floatings": floatings, - "reserved_fixed_ips": reserved_fixed_ips, + "all_floating_ips": all_floating_ips, + "floating_ip_ids": floating_ip_ids, + "reserved_fixed_ip_ids": reserved_fixed_ip_ids, }, gpu_baremetal_cluster_delete_params.GPUBaremetalClusterDeleteParams, ), @@ -321,7 +305,6 @@ def delete( cast_to=TaskIDList, ) - @typing_extensions.deprecated("deprecated") def get( self, cluster_id: str, @@ -336,11 +319,15 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUBaremetalCluster: """ - Please use the - `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters/{`cluster_id`}` - instead. + Get detailed information about a specific bare metal GPU cluster. Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -356,7 +343,7 @@ def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -375,7 +362,7 @@ def powercycle_all_servers( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUBaremetalClusterServerList: + ) -> GPUBaremetalClusterServerV1List: """ Stops and then starts all cluster servers, effectively performing a hard reboot. @@ -399,7 +386,7 @@ def powercycle_all_servers( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUBaremetalClusterServerList, + cast_to=GPUBaremetalClusterServerV1List, ) def reboot_all_servers( @@ -414,7 +401,7 @@ def reboot_all_servers( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUBaremetalClusterServerList: + ) -> GPUBaremetalClusterServerV1List: """ Reboot all bare metal GPU cluster servers @@ -438,7 +425,7 @@ def reboot_all_servers( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUBaremetalClusterServerList, + cast_to=GPUBaremetalClusterServerV1List, ) def rebuild( @@ -586,7 +573,6 @@ def with_streaming_response(self) -> AsyncGPUBaremetalClustersResourceWithStream """ return AsyncGPUBaremetalClustersResourceWithStreamingResponse(self) - @typing_extensions.deprecated("deprecated") async def create( self, *, @@ -594,15 +580,10 @@ async def create( region_id: int | None = None, flavor: str, image_id: str, - interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface], name: str, - instances_count: int | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - security_groups: Iterable[gpu_baremetal_cluster_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, - ssh_key_name: str | NotGiven = NOT_GIVEN, + servers_count: int, + servers_settings: gpu_baremetal_cluster_create_params.ServersSettings, tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -610,32 +591,23 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """Create a new GPU cluster with specified configuration. - - The cluster can be - created with one or more nodes. Please use the - `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters` endpoint instead. + """ + Create a new bare metal GPU cluster with the specified configuration. Args: - flavor: Flavor name - - image_id: Image ID + project_id: Project ID - interfaces: A list of network interfaces for the server. You can create one or more - interfaces - private, public, or both. + region_id: Region ID - name: GPU Cluster name + flavor: Cluster flavor ID - instances_count: Number of servers to create + image_id: System image ID - password: A password for a bare metal server. This parameter is used to set a password for - the "Admin" user on a Windows instance, a default user or a new user on a Linux - instance + name: Cluster name - security_groups: Security group UUIDs + servers_count: Number of servers in the cluster - ssh_key_name: Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). + servers_settings: Configuration settings for the servers in the cluster tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for @@ -643,13 +615,6 @@ async def create( modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - user_data: String in base64 format. Must not be passed together with 'username' or - 'password'. Examples of the `user_data`: - https://cloudinit.readthedocs.io/en/latest/topics/examples.html - - username: A name of a new user in the Linux instance. It may be passed with a 'password' - parameter - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -663,20 +628,15 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=await async_maybe_transform( { "flavor": flavor, "image_id": image_id, - "interfaces": interfaces, "name": name, - "instances_count": instances_count, - "password": password, - "security_groups": security_groups, - "ssh_key_name": ssh_key_name, + "servers_count": servers_count, + "servers_settings": servers_settings, "tags": tags, - "user_data": user_data, - "username": username, }, gpu_baremetal_cluster_create_params.GPUBaremetalClusterCreateParams, ), @@ -686,13 +646,13 @@ async def create( cast_to=TaskIDList, ) - @typing_extensions.deprecated("deprecated") def list( self, *, project_id: int | None = None, region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, + managed_by: List[Literal["k8s", "user"]] | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -702,13 +662,22 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[GPUBaremetalCluster, AsyncOffsetPage[GPUBaremetalCluster]]: """ - Please use the `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters` - instead. + List all bare metal GPU clusters in the specified project and region. Args: - limit: Limit the number of returned clusters + project_id: Project ID + + region_id: Region ID + + limit: Limit of items on a single page + + managed_by: Specifies the entity responsible for managing the resource. - offset: Offset value is used to exclude the first set of records from the result + - `user`: The resource (cluster) is created and maintained directly by the user. + - `k8s`: The resource is created and maintained automatically by Managed + Kubernetes service + + offset: Offset in results list extra_headers: Send extra headers @@ -723,7 +692,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=AsyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -733,6 +702,7 @@ def list( query=maybe_transform( { "limit": limit, + "managed_by": managed_by, "offset": offset, }, gpu_baremetal_cluster_list_params.GPUBaremetalClusterListParams, @@ -741,16 +711,15 @@ def list( model=GPUBaremetalCluster, ) - @typing_extensions.deprecated("deprecated") async def delete( self, cluster_id: str, *, project_id: int | None = None, region_id: int | None = None, - delete_floatings: bool | NotGiven = NOT_GIVEN, - floatings: str | NotGiven = NOT_GIVEN, - reserved_fixed_ips: str | NotGiven = NOT_GIVEN, + all_floating_ips: bool | NotGiven = NOT_GIVEN, + floating_ip_ids: List[str] | NotGiven = NOT_GIVEN, + reserved_fixed_ip_ids: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -758,20 +727,22 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: - """Deletes given bare metal GPU cluster. - - Please use the - `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters/{`cluster_id`}` - instead. + """ + Delete a bare metal GPU cluster and all its associated resources. Args: - delete_floatings: True if it is required to delete floating IPs assigned to the servers. Can't be - used with floatings. + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier - floatings: Comma separated list of floating ids that should be deleted. Can't be used with - `delete_floatings`. + all_floating_ips: Flag indicating whether the floating ips associated with server / cluster are + deleted - reserved_fixed_ips: Comma separated list of port IDs to be deleted with the servers + floating_ip_ids: Optional list of floating ips to be deleted + + reserved_fixed_ip_ids: Optional list of reserved fixed ips to be deleted extra_headers: Send extra headers @@ -788,7 +759,7 @@ async def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._delete( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -796,9 +767,9 @@ async def delete( timeout=timeout, query=await async_maybe_transform( { - "delete_floatings": delete_floatings, - "floatings": floatings, - "reserved_fixed_ips": reserved_fixed_ips, + "all_floating_ips": all_floating_ips, + "floating_ip_ids": floating_ip_ids, + "reserved_fixed_ip_ids": reserved_fixed_ip_ids, }, gpu_baremetal_cluster_delete_params.GPUBaremetalClusterDeleteParams, ), @@ -806,7 +777,6 @@ async def delete( cast_to=TaskIDList, ) - @typing_extensions.deprecated("deprecated") async def get( self, cluster_id: str, @@ -821,11 +791,15 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> GPUBaremetalCluster: """ - Please use the - `/v3/gpu/baremetal/{`project_id`}/{`region_id`}/clusters/{`cluster_id`}` - instead. + Get detailed information about a specific bare metal GPU cluster. Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -841,7 +815,7 @@ async def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -860,7 +834,7 @@ async def powercycle_all_servers( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUBaremetalClusterServerList: + ) -> GPUBaremetalClusterServerV1List: """ Stops and then starts all cluster servers, effectively performing a hard reboot. @@ -884,7 +858,7 @@ async def powercycle_all_servers( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUBaremetalClusterServerList, + cast_to=GPUBaremetalClusterServerV1List, ) async def reboot_all_servers( @@ -899,7 +873,7 @@ async def reboot_all_servers( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUBaremetalClusterServerList: + ) -> GPUBaremetalClusterServerV1List: """ Reboot all bare metal GPU cluster servers @@ -923,7 +897,7 @@ async def reboot_all_servers( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUBaremetalClusterServerList, + cast_to=GPUBaremetalClusterServerV1List, ) async def rebuild( @@ -1039,25 +1013,17 @@ class GPUBaremetalClustersResourceWithRawResponse: def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None: self._gpu_baremetal_clusters = gpu_baremetal_clusters - self.create = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - gpu_baremetal_clusters.create, # pyright: ignore[reportDeprecated], - ) + self.create = to_raw_response_wrapper( + gpu_baremetal_clusters.create, ) - self.list = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - gpu_baremetal_clusters.list, # pyright: ignore[reportDeprecated], - ) + self.list = to_raw_response_wrapper( + gpu_baremetal_clusters.list, ) - self.delete = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - gpu_baremetal_clusters.delete, # pyright: ignore[reportDeprecated], - ) + self.delete = to_raw_response_wrapper( + gpu_baremetal_clusters.delete, ) - self.get = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - gpu_baremetal_clusters.get, # pyright: ignore[reportDeprecated], - ) + self.get = to_raw_response_wrapper( + gpu_baremetal_clusters.get, ) self.powercycle_all_servers = to_raw_response_wrapper( gpu_baremetal_clusters.powercycle_all_servers, @@ -1093,25 +1059,17 @@ class AsyncGPUBaremetalClustersResourceWithRawResponse: def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> None: self._gpu_baremetal_clusters = gpu_baremetal_clusters - self.create = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - gpu_baremetal_clusters.create, # pyright: ignore[reportDeprecated], - ) + self.create = async_to_raw_response_wrapper( + gpu_baremetal_clusters.create, ) - self.list = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - gpu_baremetal_clusters.list, # pyright: ignore[reportDeprecated], - ) + self.list = async_to_raw_response_wrapper( + gpu_baremetal_clusters.list, ) - self.delete = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - gpu_baremetal_clusters.delete, # pyright: ignore[reportDeprecated], - ) + self.delete = async_to_raw_response_wrapper( + gpu_baremetal_clusters.delete, ) - self.get = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - gpu_baremetal_clusters.get, # pyright: ignore[reportDeprecated], - ) + self.get = async_to_raw_response_wrapper( + gpu_baremetal_clusters.get, ) self.powercycle_all_servers = async_to_raw_response_wrapper( gpu_baremetal_clusters.powercycle_all_servers, @@ -1147,25 +1105,17 @@ class GPUBaremetalClustersResourceWithStreamingResponse: def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None: self._gpu_baremetal_clusters = gpu_baremetal_clusters - self.create = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - gpu_baremetal_clusters.create, # pyright: ignore[reportDeprecated], - ) + self.create = to_streamed_response_wrapper( + gpu_baremetal_clusters.create, ) - self.list = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - gpu_baremetal_clusters.list, # pyright: ignore[reportDeprecated], - ) + self.list = to_streamed_response_wrapper( + gpu_baremetal_clusters.list, ) - self.delete = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - gpu_baremetal_clusters.delete, # pyright: ignore[reportDeprecated], - ) + self.delete = to_streamed_response_wrapper( + gpu_baremetal_clusters.delete, ) - self.get = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - gpu_baremetal_clusters.get, # pyright: ignore[reportDeprecated], - ) + self.get = to_streamed_response_wrapper( + gpu_baremetal_clusters.get, ) self.powercycle_all_servers = to_streamed_response_wrapper( gpu_baremetal_clusters.powercycle_all_servers, @@ -1201,25 +1151,17 @@ class AsyncGPUBaremetalClustersResourceWithStreamingResponse: def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> None: self._gpu_baremetal_clusters = gpu_baremetal_clusters - self.create = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - gpu_baremetal_clusters.create, # pyright: ignore[reportDeprecated], - ) + self.create = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.create, ) - self.list = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - gpu_baremetal_clusters.list, # pyright: ignore[reportDeprecated], - ) + self.list = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.list, ) - self.delete = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - gpu_baremetal_clusters.delete, # pyright: ignore[reportDeprecated], - ) + self.delete = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.delete, ) - self.get = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - gpu_baremetal_clusters.get, # pyright: ignore[reportDeprecated], - ) + self.get = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.get, ) self.powercycle_all_servers = async_to_streamed_response_wrapper( gpu_baremetal_clusters.powercycle_all_servers, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 95a67029..138889a4 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -17,15 +17,18 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.console import Console from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.gpu_baremetal_clusters import ( + server_list_params, server_delete_params, server_attach_interface_params, server_detach_interface_params, ) -from ....types.cloud.gpu_baremetal_cluster_server import GPUBaremetalClusterServer +from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_cluster_server import GPUBaremetalClusterServer +from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_cluster_server_v1 import GPUBaremetalClusterServerV1 __all__ = ["ServersResource", "AsyncServersResource"] @@ -50,6 +53,70 @@ def with_streaming_response(self) -> ServersResourceWithStreamingResponse: """ return ServersResourceWithStreamingResponse(self) + def list( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[GPUBaremetalClusterServer]: + """List all servers in a bare metal GPU cluster. + + Results can be filtered and + paginated. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + limit: Limit of items on a single page + + offset: Offset in results list + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._get_api_list( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + page=SyncOffsetPage[GPUBaremetalClusterServer], + 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, + }, + server_list_params.ServerListParams, + ), + ), + model=GPUBaremetalClusterServer, + ) + def delete( self, instance_id: str, @@ -450,7 +517,7 @@ def powercycle( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUBaremetalClusterServer: + ) -> GPUBaremetalClusterServerV1: """ Stops and then starts the server, effectively performing a hard reboot. @@ -474,7 +541,7 @@ def powercycle( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUBaremetalClusterServer, + cast_to=GPUBaremetalClusterServerV1, ) def reboot( @@ -489,7 +556,7 @@ def reboot( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUBaremetalClusterServer: + ) -> GPUBaremetalClusterServerV1: """ Reboot one bare metal GPU cluster server @@ -513,7 +580,7 @@ def reboot( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUBaremetalClusterServer, + cast_to=GPUBaremetalClusterServerV1, ) @@ -537,6 +604,70 @@ def with_streaming_response(self) -> AsyncServersResourceWithStreamingResponse: """ return AsyncServersResourceWithStreamingResponse(self) + def list( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[GPUBaremetalClusterServer, AsyncOffsetPage[GPUBaremetalClusterServer]]: + """List all servers in a bare metal GPU cluster. + + Results can be filtered and + paginated. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + limit: Limit of items on a single page + + offset: Offset in results list + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._get_api_list( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + page=AsyncOffsetPage[GPUBaremetalClusterServer], + 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, + }, + server_list_params.ServerListParams, + ), + ), + model=GPUBaremetalClusterServer, + ) + async def delete( self, instance_id: str, @@ -939,7 +1070,7 @@ async def powercycle( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUBaremetalClusterServer: + ) -> GPUBaremetalClusterServerV1: """ Stops and then starts the server, effectively performing a hard reboot. @@ -963,7 +1094,7 @@ async def powercycle( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUBaremetalClusterServer, + cast_to=GPUBaremetalClusterServerV1, ) async def reboot( @@ -978,7 +1109,7 @@ async def reboot( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> GPUBaremetalClusterServer: + ) -> GPUBaremetalClusterServerV1: """ Reboot one bare metal GPU cluster server @@ -1002,7 +1133,7 @@ async def reboot( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=GPUBaremetalClusterServer, + cast_to=GPUBaremetalClusterServerV1, ) @@ -1010,6 +1141,9 @@ class ServersResourceWithRawResponse: def __init__(self, servers: ServersResource) -> None: self._servers = servers + self.list = to_raw_response_wrapper( + servers.list, + ) self.delete = to_raw_response_wrapper( servers.delete, ) @@ -1034,6 +1168,9 @@ class AsyncServersResourceWithRawResponse: def __init__(self, servers: AsyncServersResource) -> None: self._servers = servers + self.list = async_to_raw_response_wrapper( + servers.list, + ) self.delete = async_to_raw_response_wrapper( servers.delete, ) @@ -1058,6 +1195,9 @@ class ServersResourceWithStreamingResponse: def __init__(self, servers: ServersResource) -> None: self._servers = servers + self.list = to_streamed_response_wrapper( + servers.list, + ) self.delete = to_streamed_response_wrapper( servers.delete, ) @@ -1082,6 +1222,9 @@ class AsyncServersResourceWithStreamingResponse: def __init__(self, servers: AsyncServersResource) -> None: self._servers = servers + self.list = async_to_streamed_response_wrapper( + servers.list, + ) self.delete = async_to_streamed_response_wrapper( servers.delete, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 9c735955..8ef5d635 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -73,7 +73,6 @@ from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams from .cost_report_detailed import CostReportDetailed as CostReportDetailed from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed -from .gpu_baremetal_flavor import GPUBaremetalFlavor as GPUBaremetalFlavor from .instance_list_params import InstanceListParams as InstanceListParams from .lb_listener_protocol import LbListenerProtocol as LbListenerProtocol from .load_balancer_status import LoadBalancerStatus as LoadBalancerStatus @@ -121,7 +120,6 @@ from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams -from .gpu_baremetal_flavor_list import GPUBaremetalFlavorList as GPUBaremetalFlavorList from .inference_region_capacity import InferenceRegionCapacity as InferenceRegionCapacity from .load_balancer_flavor_list import LoadBalancerFlavorList as LoadBalancerFlavorList from .load_balancer_list_params import LoadBalancerListParams as LoadBalancerListParams @@ -145,7 +143,6 @@ from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams -from .gpu_baremetal_cluster_server import GPUBaremetalClusterServer as GPUBaremetalClusterServer from .load_balancer_l7_policy_list import LoadBalancerL7PolicyList as LoadBalancerL7PolicyList from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams @@ -163,7 +160,6 @@ from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams from .cost_report_get_aggregated_params import CostReportGetAggregatedParams as CostReportGetAggregatedParams from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams -from .gpu_baremetal_cluster_server_list import GPUBaremetalClusterServerList as GPUBaremetalClusterServerList from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal_cluster.py index 910960ad..aa310a9b 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster.py @@ -1,78 +1,133 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from typing_extensions import Literal +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, Annotated, TypeAlias from .tag import Tag +from ..._utils import PropertyInfo from ..._models import BaseModel -from .gpu_baremetal_cluster_server import GPUBaremetalClusterServer -__all__ = ["GPUBaremetalCluster", "Interface"] +__all__ = [ + "GPUBaremetalCluster", + "ServersSettings", + "ServersSettingsInterface", + "ServersSettingsInterfaceExternalInterfaceOutputSerializer", + "ServersSettingsInterfaceSubnetInterfaceOutputSerializer", + "ServersSettingsInterfaceSubnetInterfaceOutputSerializerFloatingIP", + "ServersSettingsInterfaceAnySubnetInterfaceOutputSerializer", + "ServersSettingsInterfaceAnySubnetInterfaceOutputSerializerFloatingIP", + "ServersSettingsSecurityGroup", +] -class Interface(BaseModel): - network_id: str - """Network ID""" +class ServersSettingsInterfaceExternalInterfaceOutputSerializer(BaseModel): + ip_family: Literal["dual", "ipv4", "ipv6"] + """Which subnets should be selected: IPv4, IPv6, or use dual stack.""" + + name: Optional[str] = None + """Interface name""" + + type: Literal["external"] + + +class ServersSettingsInterfaceSubnetInterfaceOutputSerializerFloatingIP(BaseModel): + source: Literal["new"] - port_id: str + +class ServersSettingsInterfaceSubnetInterfaceOutputSerializer(BaseModel): + floating_ip: Optional[ServersSettingsInterfaceSubnetInterfaceOutputSerializerFloatingIP] = None + """Floating IP config for this subnet attachment""" + + name: Optional[str] = None + """Interface name""" + + network_id: str """Network ID the subnet belongs to. Port will be plugged in this network""" subnet_id: str - """Port is assigned to IP address from the subnet""" + """Port is assigned an IP address from this subnet""" - type: str - """Network type""" + type: Literal["subnet"] -class GPUBaremetalCluster(BaseModel): - cluster_id: str - """GPU Cluster ID""" +class ServersSettingsInterfaceAnySubnetInterfaceOutputSerializerFloatingIP(BaseModel): + source: Literal["new"] - cluster_name: str - """GPU Cluster Name""" - cluster_status: Literal["ACTIVE", "ERROR", "PENDING", "SUSPENDED"] - """GPU Cluster status""" +class ServersSettingsInterfaceAnySubnetInterfaceOutputSerializer(BaseModel): + floating_ip: Optional[ServersSettingsInterfaceAnySubnetInterfaceOutputSerializerFloatingIP] = None + """Floating IP config for this subnet attachment""" - created_at: Optional[str] = None - """Datetime when the cluster was created""" + ip_address: Optional[str] = None + """Fixed IP address""" - creator_task_id: Optional[str] = None - """Task that created this entity""" + ip_family: Literal["dual", "ipv4", "ipv6"] + """Which subnets should be selected: IPv4, IPv6, or use dual stack""" - flavor: str - """Flavor ID is the same as the name""" + name: Optional[str] = None + """Interface name""" - image_id: str - """Image ID""" + network_id: str + """Network ID the subnet belongs to. Port will be plugged in this network""" - image_name: Optional[str] = None - """Image name""" + type: Literal["any_subnet"] - interfaces: Optional[List[Interface]] = None - """Networks managed by user and associated with the cluster""" - password: Optional[str] = None - """A password for a bare metal server. +ServersSettingsInterface: TypeAlias = Annotated[ + Union[ + ServersSettingsInterfaceExternalInterfaceOutputSerializer, + ServersSettingsInterfaceSubnetInterfaceOutputSerializer, + ServersSettingsInterfaceAnySubnetInterfaceOutputSerializer, + ], + PropertyInfo(discriminator="type"), +] - This parameter is used to set a password for the "Admin" user on a Windows - instance, a default user or a new user on a Linux instance - """ - project_id: int - """Project ID""" +class ServersSettingsSecurityGroup(BaseModel): + name: str + """Name.""" - region: str - """Region name""" - region_id: int - """Region ID""" +class ServersSettings(BaseModel): + interfaces: List[ServersSettingsInterface] - servers: List[GPUBaremetalClusterServer] - """GPU cluster servers""" + security_groups: List[ServersSettingsSecurityGroup] + """Security groups names""" ssh_key_name: Optional[str] = None - """Keypair name to inject into new cluster(s)""" + """SSH key name""" + + user_data: Optional[str] = None + """Optional custom user data (Base64-encoded) Mutually exclusive with 'password'.""" + + +class GPUBaremetalCluster(BaseModel): + id: str + """Cluster unique identifier""" + + created_at: datetime + """Cluster creation date time""" + + flavor: str + """Cluster flavor name""" + + managed_by: Literal["k8s", "user"] + """User type managing the resource""" + + name: str + """Cluster name""" + + servers_count: int + """Cluster servers count""" + + servers_ids: List[str] + """List of cluster nodes""" + + servers_settings: ServersSettings + + status: Literal["active", "deleting", "error", "new", "resizing"] + """Cluster status""" tags: List[Tag] """List of key-value tags associated with the resource. @@ -84,33 +139,5 @@ class GPUBaremetalCluster(BaseModel): values. """ - task_id: Optional[str] = None - """Task ID associated with the cluster""" - - task_status: Literal[ - "CLUSTER_CLEAN_UP", - "CLUSTER_RESIZE", - "CLUSTER_RESUME", - "CLUSTER_SUSPEND", - "ERROR", - "FINISHED", - "IPU_SERVERS", - "NETWORK", - "POPLAR_SERVERS", - "POST_DEPLOY_SETUP", - "VIPU_CONTROLLER", - ] - """Task status""" - - user_data: Optional[str] = None - """String in base64 format. - - Must not be passed together with 'username' or 'password'. Examples of the - `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html - """ - - username: Optional[str] = None - """A name of a new user in the Linux instance. - - It may be passed with a 'password' parameter - """ + updated_at: Optional[datetime] = None + """Cluster update date time""" 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 959700a0..2dd61b2c 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -2,61 +2,44 @@ from __future__ import annotations -from typing import Dict, Union, Iterable, Optional +from typing import Dict, Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .interface_ip_family import InterfaceIPFamily - __all__ = [ "GPUBaremetalClusterCreateParams", - "Interface", - "InterfaceCreateGPUClusterExternalInterfaceSerializer", - "InterfaceCreateGPUClusterSubnetInterfaceSerializer", - "InterfaceCreateGPUClusterSubnetInterfaceSerializerFloatingIP", - "InterfaceCreateGPUClusterAnySubnetInterfaceSerializer", - "InterfaceCreateGPUClusterAnySubnetInterfaceSerializerFloatingIP", - "SecurityGroup", + "ServersSettings", + "ServersSettingsInterface", + "ServersSettingsInterfaceExternalInterfaceInputSerializer", + "ServersSettingsInterfaceSubnetInterfaceInputSerializer", + "ServersSettingsInterfaceSubnetInterfaceInputSerializerFloatingIP", + "ServersSettingsInterfaceAnySubnetInterfaceInputSerializer", + "ServersSettingsInterfaceAnySubnetInterfaceInputSerializerFloatingIP", + "ServersSettingsCredentials", + "ServersSettingsSecurityGroup", ] class GPUBaremetalClusterCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" flavor: Required[str] - """Flavor name""" + """Cluster flavor ID""" image_id: Required[str] - """Image ID""" - - interfaces: Required[Iterable[Interface]] - """A list of network interfaces for the server. - - You can create one or more interfaces - private, public, or both. - """ + """System image ID""" name: Required[str] - """GPU Cluster name""" + """Cluster name""" - instances_count: int - """Number of servers to create""" + servers_count: Required[int] + """Number of servers in the cluster""" - password: str - """A password for a bare metal server. - - This parameter is used to set a password for the "Admin" user on a Windows - instance, a default user or a new user on a Linux instance - """ - - security_groups: Iterable[SecurityGroup] - """Security group UUIDs""" - - ssh_key_name: str - """ - Specifies the name of the SSH keypair, created via the - [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). - """ + servers_settings: Required[ServersSettings] + """Configuration settings for the servers in the cluster""" tags: Dict[str, str] """Key-value tags to associate with the resource. @@ -68,96 +51,96 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): values. """ - user_data: str - """String in base64 format. - - Must not be passed together with 'username' or 'password'. Examples of the - `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html - """ - - username: str - """A name of a new user in the Linux instance. - - It may be passed with a 'password' parameter - """ - -class InterfaceCreateGPUClusterExternalInterfaceSerializer(TypedDict, total=False): +class ServersSettingsInterfaceExternalInterfaceInputSerializer(TypedDict, total=False): type: Required[Literal["external"]] - """A public IP address will be assigned to the server.""" - interface_name: str - """Interface name. + ip_family: Literal["dual", "ipv4", "ipv6"] + """Which subnets should be selected: IPv4, IPv6, or use dual stack.""" - Defaults to `null` and is returned as `null` in the API response if not set. - """ - - ip_family: Optional[InterfaceIPFamily] - """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" + name: str + """Interface name""" -class InterfaceCreateGPUClusterSubnetInterfaceSerializerFloatingIP(TypedDict, total=False): +class ServersSettingsInterfaceSubnetInterfaceInputSerializerFloatingIP(TypedDict, total=False): source: Required[Literal["new"]] -class InterfaceCreateGPUClusterSubnetInterfaceSerializer(TypedDict, total=False): +class ServersSettingsInterfaceSubnetInterfaceInputSerializer(TypedDict, total=False): network_id: Required[str] - """The network where the server will be connected.""" + """Network ID the subnet belongs to. Port will be plugged in this network""" subnet_id: Required[str] - """The server will get an IP address from this subnet.""" + """Port is assigned an IP address from this subnet""" type: Required[Literal["subnet"]] - """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. - """ - - floating_ip: InterfaceCreateGPUClusterSubnetInterfaceSerializerFloatingIP + floating_ip: ServersSettingsInterfaceSubnetInterfaceInputSerializerFloatingIP """Floating IP config for this subnet attachment""" - interface_name: str - """Interface name. - - Defaults to `null` and is returned as `null` in the API response if not set. - """ + name: str + """Interface name""" -class InterfaceCreateGPUClusterAnySubnetInterfaceSerializerFloatingIP(TypedDict, total=False): +class ServersSettingsInterfaceAnySubnetInterfaceInputSerializerFloatingIP(TypedDict, total=False): source: Required[Literal["new"]] -class InterfaceCreateGPUClusterAnySubnetInterfaceSerializer(TypedDict, total=False): +class ServersSettingsInterfaceAnySubnetInterfaceInputSerializer(TypedDict, total=False): network_id: Required[str] - """The network where the server will be connected.""" + """Network ID the subnet belongs to. Port will be plugged in this network""" type: Required[Literal["any_subnet"]] - """Server will be attached to a subnet with the largest count of free IPs.""" - floating_ip: InterfaceCreateGPUClusterAnySubnetInterfaceSerializerFloatingIP - """Allows the server to have a public IP that can be reached from the internet.""" + floating_ip: ServersSettingsInterfaceAnySubnetInterfaceInputSerializerFloatingIP + """Floating IP config for this subnet attachment""" - interface_name: str - """Interface name. + ip_family: Literal["dual", "ipv4", "ipv6"] + """Which subnets should be selected: IPv4, IPv6, or use dual stack""" + + name: str + """Interface name""" - Defaults to `null` and is returned as `null` in the API response if not set. - """ - ip_address: str - """You can specify a specific IP address from your subnet.""" +ServersSettingsInterface: TypeAlias = Union[ + ServersSettingsInterfaceExternalInterfaceInputSerializer, + ServersSettingsInterfaceSubnetInterfaceInputSerializer, + ServersSettingsInterfaceAnySubnetInterfaceInputSerializer, +] - ip_family: InterfaceIPFamily - """Specify `ipv4`, `ipv6`, or `dual` to enable both.""" +class ServersSettingsCredentials(TypedDict, total=False): + password: str + """Used to set the password for the specified 'username' on Linux instances. -Interface: TypeAlias = Union[ - InterfaceCreateGPUClusterExternalInterfaceSerializer, - InterfaceCreateGPUClusterSubnetInterfaceSerializer, - InterfaceCreateGPUClusterAnySubnetInterfaceSerializer, -] + If 'username' is not provided, the password is applied to the default user of + the image. Mutually exclusive with '`user_data`' - only one can be specified. + """ + + ssh_key_name: str + """ + Specifies the name of the SSH keypair, created via the + [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). + """ + + username: str + """The 'username' and 'password' fields create a new user on the system""" -class SecurityGroup(TypedDict, total=False): +class ServersSettingsSecurityGroup(TypedDict, total=False): id: Required[str] """Resource ID""" + + +class ServersSettings(TypedDict, total=False): + interfaces: Required[Iterable[ServersSettingsInterface]] + """Subnet IPs and floating IPs""" + + credentials: ServersSettingsCredentials + """Optional server access credentials""" + + security_groups: Iterable[ServersSettingsSecurityGroup] + """List of security groups UUIDs""" + + user_data: str + """Optional custom user data (Base64-encoded)""" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py index d3c1b9b1..e68a7962 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import List from typing_extensions import TypedDict __all__ = ["GPUBaremetalClusterDeleteParams"] @@ -9,20 +10,19 @@ class GPUBaremetalClusterDeleteParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" - delete_floatings: bool - """True if it is required to delete floating IPs assigned to the servers. - - Can't be used with floatings. + all_floating_ips: bool """ - - floatings: str - """Comma separated list of floating ids that should be deleted. - - Can't be used with `delete_floatings`. + Flag indicating whether the floating ips associated with server / cluster are + deleted """ - reserved_fixed_ips: str - """Comma separated list of port IDs to be deleted with the servers""" + floating_ip_ids: List[str] + """Optional list of floating ips to be deleted""" + + reserved_fixed_ip_ids: List[str] + """Optional list of reserved fixed ips to be deleted""" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py index 98549a17..8112f690 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py @@ -2,18 +2,29 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing import List +from typing_extensions import Literal, TypedDict __all__ = ["GPUBaremetalClusterListParams"] class GPUBaremetalClusterListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" limit: int - """Limit the number of returned clusters""" + """Limit of items on a single page""" + + managed_by: List[Literal["k8s", "user"]] + """Specifies the entity responsible for managing the resource. + + - `user`: The resource (cluster) is created and maintained directly by the user. + - `k8s`: The resource is created and maintained automatically by Managed + Kubernetes service + """ offset: int - """Offset value is used to exclude the first set of records from the result""" + """Offset in results list""" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_server_list.py b/src/gcore/types/cloud/gpu_baremetal_cluster_server_list.py deleted file mode 100644 index 01c531f5..00000000 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_server_list.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .gpu_baremetal_cluster_server import GPUBaremetalClusterServer - -__all__ = ["GPUBaremetalClusterServerList"] - - -class GPUBaremetalClusterServerList(BaseModel): - count: int - """Number of objects""" - - results: List[GPUBaremetalClusterServer] - """Objects""" diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py b/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py index 7d30e274..30aeddac 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py @@ -3,7 +3,13 @@ from __future__ import annotations from .flavor_list_params import FlavorListParams as FlavorListParams +from .server_list_params import ServerListParams as ServerListParams from .image_upload_params import ImageUploadParams as ImageUploadParams +from .gpu_baremetal_flavor import GPUBaremetalFlavor as GPUBaremetalFlavor from .server_delete_params import ServerDeleteParams as ServerDeleteParams +from .gpu_baremetal_flavor_list import GPUBaremetalFlavorList as GPUBaremetalFlavorList +from .gpu_baremetal_cluster_server import GPUBaremetalClusterServer as GPUBaremetalClusterServer from .server_attach_interface_params import ServerAttachInterfaceParams as ServerAttachInterfaceParams from .server_detach_interface_params import ServerDetachInterfaceParams as ServerDetachInterfaceParams +from .gpu_baremetal_cluster_server_v1 import GPUBaremetalClusterServerV1 as GPUBaremetalClusterServerV1 +from .gpu_baremetal_cluster_server_v1_list import GPUBaremetalClusterServerV1List as GPUBaremetalClusterServerV1List diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py new file mode 100644 index 00000000..58a99830 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..tag import Tag +from ...._models import BaseModel + +__all__ = ["GPUBaremetalClusterServer", "SecurityGroup"] + + +class SecurityGroup(BaseModel): + name: str + """Name.""" + + +class GPUBaremetalClusterServer(BaseModel): + id: str + """Server unique identifier""" + + created_at: datetime + """Server creation date and time""" + + flavor: str + """Unique flavor identifier""" + + image_id: Optional[str] = None + """Server's image UUID""" + + ip_addresses: List[str] + """List of IP addresses""" + + name: str + """Server's name generated using cluster's name""" + + security_groups: List[SecurityGroup] + """Security groups names""" + + ssh_key_name: Optional[str] = None + """SSH key pair assigned to the server""" + + status: Literal[ + "ACTIVE", + "BUILD", + "DELETED", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PASSWORD", + "PAUSED", + "REBOOT", + "REBUILD", + "RESCUE", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "UNKNOWN", + "VERIFY_RESIZE", + ] + """Current server status""" + + tags: List[Tag] + """User defined tags""" + + task_id: Optional[str] = None + """Identifier of the task currently modifying the GPU cluster""" + + updated_at: datetime + """Server update date and time""" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_server.py b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1.py similarity index 91% rename from src/gcore/types/cloud/gpu_baremetal_cluster_server.py rename to src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1.py index 328c2d69..72debc0b 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_server.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1.py @@ -4,17 +4,17 @@ from datetime import datetime from typing_extensions import Literal, TypeAlias -from .tag import Tag -from ..._models import BaseModel -from .ddos_profile import DDOSProfile -from .fixed_address import FixedAddress -from .blackhole_port import BlackholePort -from .floating_address import FloatingAddress -from .instance_isolation import InstanceIsolation -from .fixed_address_short import FixedAddressShort +from ..tag import Tag +from ...._models import BaseModel +from ..ddos_profile import DDOSProfile +from ..fixed_address import FixedAddress +from ..blackhole_port import BlackholePort +from ..floating_address import FloatingAddress +from ..instance_isolation import InstanceIsolation +from ..fixed_address_short import FixedAddressShort __all__ = [ - "GPUBaremetalClusterServer", + "GPUBaremetalClusterServerV1", "Address", "FixedIPAssignment", "Flavor", @@ -87,7 +87,7 @@ class SecurityGroup(BaseModel): """Name.""" -class GPUBaremetalClusterServer(BaseModel): +class GPUBaremetalClusterServerV1(BaseModel): id: str """GPU server ID""" diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1_list.py b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1_list.py new file mode 100644 index 00000000..a6c6a2f2 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .gpu_baremetal_cluster_server_v1 import GPUBaremetalClusterServerV1 + +__all__ = ["GPUBaremetalClusterServerV1List"] + + +class GPUBaremetalClusterServerV1List(BaseModel): + count: int + """Number of objects""" + + results: List[GPUBaremetalClusterServerV1] + """Objects""" diff --git a/src/gcore/types/cloud/gpu_baremetal_flavor.py b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor.py similarity index 99% rename from src/gcore/types/cloud/gpu_baremetal_flavor.py rename to src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor.py index 9c6471c8..19278108 100644 --- a/src/gcore/types/cloud/gpu_baremetal_flavor.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor.py @@ -3,7 +3,7 @@ from typing import Union, Optional from typing_extensions import Literal, TypeAlias -from ..._models import BaseModel +from ...._models import BaseModel __all__ = [ "GPUBaremetalFlavor", diff --git a/src/gcore/types/cloud/gpu_baremetal_flavor_list.py b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor_list.py similarity index 91% rename from src/gcore/types/cloud/gpu_baremetal_flavor_list.py rename to src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor_list.py index 8b241544..2cc4ee84 100644 --- a/src/gcore/types/cloud/gpu_baremetal_flavor_list.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor_list.py @@ -2,7 +2,7 @@ from typing import List -from ..._models import BaseModel +from ...._models import BaseModel from .gpu_baremetal_flavor import GPUBaremetalFlavor __all__ = ["GPUBaremetalFlavorList"] diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_list_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/server_list_params.py new file mode 100644 index 00000000..c9b5caf4 --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/server_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 TypedDict + +__all__ = ["ServerListParams"] + + +class ServerListParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + limit: int + """Limit of items on a single page""" + + offset: int + """Offset in results list""" diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py index 6b7e5324..9cb9018c 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import GPUBaremetalFlavorList +from gcore.types.cloud.gpu_baremetal_clusters import GPUBaremetalFlavorList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py index 993a16f9..d191b740 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py @@ -9,7 +9,12 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import Console, TaskIDList, GPUBaremetalClusterServer +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import Console, TaskIDList +from gcore.types.cloud.gpu_baremetal_clusters import ( + GPUBaremetalClusterServer, + GPUBaremetalClusterServerV1, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -17,6 +22,63 @@ class TestServers: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_list(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + assert_matches_type(SyncOffsetPage[GPUBaremetalClusterServer], server, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + server = client.cloud.gpu_baremetal_clusters.servers.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + limit=10, + offset=0, + ) + assert_matches_type(SyncOffsetPage[GPUBaremetalClusterServer], server, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(SyncOffsetPage[GPUBaremetalClusterServer], server, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(SyncOffsetPage[GPUBaremetalClusterServer], server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.servers.with_raw_response.list( + cluster_id="", + project_id=1, + region_id=7, + ) + @parametrize def test_method_delete(self, client: Gcore) -> None: server = client.cloud.gpu_baremetal_clusters.servers.delete( @@ -506,7 +568,7 @@ def test_method_powercycle(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1, server, path=["response"]) @parametrize def test_raw_response_powercycle(self, client: Gcore) -> None: @@ -519,7 +581,7 @@ def test_raw_response_powercycle(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = response.parse() - assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1, server, path=["response"]) @parametrize def test_streaming_response_powercycle(self, client: Gcore) -> None: @@ -532,7 +594,7 @@ def test_streaming_response_powercycle(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = response.parse() - assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1, server, path=["response"]) assert cast(Any, response.is_closed) is True @@ -552,7 +614,7 @@ def test_method_reboot(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1, server, path=["response"]) @parametrize def test_raw_response_reboot(self, client: Gcore) -> None: @@ -565,7 +627,7 @@ def test_raw_response_reboot(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = response.parse() - assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1, server, path=["response"]) @parametrize def test_streaming_response_reboot(self, client: Gcore) -> None: @@ -578,7 +640,7 @@ def test_streaming_response_reboot(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = response.parse() - assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1, server, path=["response"]) assert cast(Any, response.is_closed) is True @@ -597,6 +659,63 @@ class TestAsyncServers: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + assert_matches_type(AsyncOffsetPage[GPUBaremetalClusterServer], server, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_baremetal_clusters.servers.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + limit=10, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[GPUBaremetalClusterServer], server, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUBaremetalClusterServer], server, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUBaremetalClusterServer], server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.list( + cluster_id="", + project_id=1, + region_id=7, + ) + @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: server = await async_client.cloud.gpu_baremetal_clusters.servers.delete( @@ -1086,7 +1205,7 @@ async def test_method_powercycle(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1, server, path=["response"]) @parametrize async def test_raw_response_powercycle(self, async_client: AsyncGcore) -> None: @@ -1099,7 +1218,7 @@ async def test_raw_response_powercycle(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = await response.parse() - assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1, server, path=["response"]) @parametrize async def test_streaming_response_powercycle(self, async_client: AsyncGcore) -> None: @@ -1112,7 +1231,7 @@ async def test_streaming_response_powercycle(self, async_client: AsyncGcore) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = await response.parse() - assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1, server, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1132,7 +1251,7 @@ async def test_method_reboot(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1, server, path=["response"]) @parametrize async def test_raw_response_reboot(self, async_client: AsyncGcore) -> None: @@ -1145,7 +1264,7 @@ async def test_raw_response_reboot(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = await response.parse() - assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1, server, path=["response"]) @parametrize async def test_streaming_response_reboot(self, async_client: AsyncGcore) -> None: @@ -1158,7 +1277,7 @@ async def test_streaming_response_reboot(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" server = await response.parse() - assert_matches_type(GPUBaremetalClusterServer, server, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1, server, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index 2795d56b..b63a3e8f 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -13,10 +13,8 @@ from gcore.types.cloud import ( TaskIDList, GPUBaremetalCluster, - GPUBaremetalClusterServerList, ) - -# pyright: reportDeprecated=false +from gcore.types.cloud.gpu_baremetal_clusters import GPUBaremetalClusterServerV1List base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,70 +24,57 @@ class TestGPUBaremetalClusters: @parametrize def test_method_create(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) - + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + image_id="3793c250-0b3b-4678-bab3-e11afbc29657", + name="gpu-cluster-1", + servers_count=3, + servers_settings={"interfaces": [{"type": "external"}]}, + ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + image_id="3793c250-0b3b-4678-bab3-e11afbc29657", + name="gpu-cluster-1", + servers_count=3, + servers_settings={ + "interfaces": [ { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - "floating_ip": {"source": "new"}, - "interface_name": "interface_name", + "type": "external", + "ip_family": "ipv4", + "name": "eth0", } ], - name="my-gpu-cluster", - instances_count=1, - password="password", - security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], - ssh_key_name="my-ssh-key", - tags={"my-tag": "my-tag-value"}, - user_data="user_data", - username="username", - ) - + "credentials": { + "password": "securepassword", + "ssh_key_name": "my-ssh-key", + "username": "admin", + }, + "security_groups": [{"id": "b4849ffa-89f2-45a1-951f-0ae5b7809d98"}], + "user_data": "eyJ0ZXN0IjogImRhdGEifQ==", + }, + tags={"my-tag": "my-tag-value"}, + ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.cloud.gpu_baremetal_clusters.with_raw_response.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) + response = client.cloud.gpu_baremetal_clusters.with_raw_response.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + image_id="3793c250-0b3b-4678-bab3-e11afbc29657", + name="gpu-cluster-1", + servers_count=3, + servers_settings={"interfaces": [{"type": "external"}]}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -98,58 +83,48 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.cloud.gpu_baremetal_clusters.with_streaming_response.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.cloud.gpu_baremetal_clusters.with_streaming_response.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + image_id="3793c250-0b3b-4678-bab3-e11afbc29657", + name="gpu-cluster-1", + servers_count=3, + servers_settings={"interfaces": [{"type": "external"}]}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_list(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( - project_id=0, - region_id=0, - ) - + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( + project_id=1, + region_id=7, + ) assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( - project_id=0, - region_id=0, - limit=0, - offset=0, - ) - + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( + project_id=1, + region_id=7, + limit=10, + managed_by=["k8s"], + offset=0, + ) assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.cloud.gpu_baremetal_clusters.with_raw_response.list( - project_id=0, - region_id=0, - ) + response = client.cloud.gpu_baremetal_clusters.with_raw_response.list( + project_id=1, + region_id=7, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -158,52 +133,46 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.cloud.gpu_baremetal_clusters.with_streaming_response.list( - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.cloud.gpu_baremetal_clusters.with_streaming_response.list( + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = response.parse() + assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) - + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize def test_method_delete_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - delete_floatings=True, - floatings="floatings", - reserved_fixed_ips="reserved_fixed_ips", - ) - + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + all_floating_ips=True, + floating_ip_ids=["e4a01208-d6ac-4304-bf86-3028154b070a"], + reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], + ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.cloud.gpu_baremetal_clusters.with_raw_response.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) + response = client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -212,49 +181,44 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.cloud.gpu_baremetal_clusters.with_streaming_response.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.cloud.gpu_baremetal_clusters.with_streaming_response.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.delete( - cluster_id="", - project_id=0, - region_id=0, - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + cluster_id="", + project_id=1, + region_id=7, + ) @parametrize def test_method_get(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.get( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) - + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.get( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.cloud.gpu_baremetal_clusters.with_raw_response.get( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) + response = client.cloud.gpu_baremetal_clusters.with_raw_response.get( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -263,29 +227,27 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.cloud.gpu_baremetal_clusters.with_streaming_response.get( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.cloud.gpu_baremetal_clusters.with_streaming_response.get( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = response.parse() + assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.get( - cluster_id="", - project_id=0, - region_id=0, - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.get( + cluster_id="", + project_id=1, + region_id=7, + ) @parametrize def test_method_powercycle_all_servers(self, client: Gcore) -> None: @@ -294,7 +256,7 @@ def test_method_powercycle_all_servers(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) @parametrize def test_raw_response_powercycle_all_servers(self, client: Gcore) -> None: @@ -307,7 +269,7 @@ def test_raw_response_powercycle_all_servers(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) @parametrize def test_streaming_response_powercycle_all_servers(self, client: Gcore) -> None: @@ -320,7 +282,7 @@ def test_streaming_response_powercycle_all_servers(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -340,7 +302,7 @@ def test_method_reboot_all_servers(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) @parametrize def test_raw_response_reboot_all_servers(self, client: Gcore) -> None: @@ -353,7 +315,7 @@ def test_raw_response_reboot_all_servers(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) @parametrize def test_streaming_response_reboot_all_servers(self, client: Gcore) -> None: @@ -366,7 +328,7 @@ def test_streaming_response_reboot_all_servers(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -499,70 +461,57 @@ class TestAsyncGPUBaremetalClusters: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) - + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + image_id="3793c250-0b3b-4678-bab3-e11afbc29657", + name="gpu-cluster-1", + servers_count=3, + servers_settings={"interfaces": [{"type": "external"}]}, + ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + image_id="3793c250-0b3b-4678-bab3-e11afbc29657", + name="gpu-cluster-1", + servers_count=3, + servers_settings={ + "interfaces": [ { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - "floating_ip": {"source": "new"}, - "interface_name": "interface_name", + "type": "external", + "ip_family": "ipv4", + "name": "eth0", } ], - name="my-gpu-cluster", - instances_count=1, - password="password", - security_groups=[{"id": "ae74714c-c380-48b4-87f8-758d656cdad6"}], - ssh_key_name="my-ssh-key", - tags={"my-tag": "my-tag-value"}, - user_data="user_data", - username="username", - ) - + "credentials": { + "password": "securepassword", + "ssh_key_name": "my-ssh-key", + "username": "admin", + }, + "security_groups": [{"id": "b4849ffa-89f2-45a1-951f-0ae5b7809d98"}], + "user_data": "eyJ0ZXN0IjogImRhdGEifQ==", + }, + tags={"my-tag": "my-tag-value"}, + ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + image_id="3793c250-0b3b-4678-bab3-e11afbc29657", + name="gpu-cluster-1", + servers_count=3, + servers_settings={"interfaces": [{"type": "external"}]}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -571,58 +520,48 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.create( - project_id=0, - region_id=0, - flavor="bm3-ai-1xlarge-h100-80-8", - image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", - interfaces=[ - { - "network_id": "024a29e9-b4b7-4c91-9a46-505be123d9f8", - "subnet_id": "91200a6c-07e0-42aa-98da-32d1f6545ae7", - "type": "subnet", - } - ], - name="my-gpu-cluster", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + image_id="3793c250-0b3b-4678-bab3-e11afbc29657", + name="gpu-cluster-1", + servers_count=3, + servers_settings={"interfaces": [{"type": "external"}]}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( - project_id=0, - region_id=0, - ) - + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( + project_id=1, + region_id=7, + ) assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( - project_id=0, - region_id=0, - limit=0, - offset=0, - ) - + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( + project_id=1, + region_id=7, + limit=10, + managed_by=["k8s"], + offset=0, + ) assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.list( - project_id=0, - region_id=0, - ) + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.list( + project_id=1, + region_id=7, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -631,52 +570,46 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.list( - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.list( + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) - + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - delete_floatings=True, - floatings="floatings", - reserved_fixed_ips="reserved_fixed_ips", - ) - + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + all_floating_ips=True, + floating_ip_ids=["e4a01208-d6ac-4304-bf86-3028154b070a"], + reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], + ) assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -685,49 +618,44 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.delete( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.delete( - cluster_id="", - project_id=0, - region_id=0, - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + cluster_id="", + project_id=1, + region_id=7, + ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.get( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) - + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.get( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.get( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.get( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -736,29 +664,27 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.get( - cluster_id="cluster_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.get( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + gpu_baremetal_cluster = await response.parse() + assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.get( - cluster_id="", - project_id=0, - region_id=0, - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.get( + cluster_id="", + project_id=1, + region_id=7, + ) @parametrize async def test_method_powercycle_all_servers(self, async_client: AsyncGcore) -> None: @@ -767,7 +693,7 @@ async def test_method_powercycle_all_servers(self, async_client: AsyncGcore) -> project_id=0, region_id=0, ) - assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_raw_response_powercycle_all_servers(self, async_client: AsyncGcore) -> None: @@ -780,7 +706,7 @@ async def test_raw_response_powercycle_all_servers(self, async_client: AsyncGcor assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_streaming_response_powercycle_all_servers(self, async_client: AsyncGcore) -> None: @@ -793,7 +719,7 @@ async def test_streaming_response_powercycle_all_servers(self, async_client: Asy assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -813,7 +739,7 @@ async def test_method_reboot_all_servers(self, async_client: AsyncGcore) -> None project_id=0, region_id=0, ) - assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_raw_response_reboot_all_servers(self, async_client: AsyncGcore) -> None: @@ -826,7 +752,7 @@ async def test_raw_response_reboot_all_servers(self, async_client: AsyncGcore) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) @parametrize async def test_streaming_response_reboot_all_servers(self, async_client: AsyncGcore) -> None: @@ -839,7 +765,7 @@ async def test_streaming_response_reboot_all_servers(self, async_client: AsyncGc assert response.http_request.headers.get("X-Stainless-Lang") == "python" gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUBaremetalClusterServerList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) assert cast(Any, response.is_closed) is True From 4996312c88dba2adeee21bcf339e7057f1ba4926 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 28 Aug 2025 16:11:28 +0000 Subject: [PATCH 270/592] feat(api): aggregated API specs update --- .stats.yml | 6 +- api.md | 4 - src/gcore/resources/streaming/ai_tasks.py | 44 +++---- src/gcore/resources/streaming/statistics.py | 118 ------------------ .../resources/streaming/streams/overlays.py | 8 +- .../resources/streaming/streams/streams.py | 8 +- .../resources/streaming/videos/subtitles.py | 8 +- .../resources/streaming/videos/videos.py | 16 +-- src/gcore/types/streaming/__init__.py | 4 - .../streaming/ai_contentmoderation_casm.py | 39 ------ .../ai_contentmoderation_hardnudity.py | 2 +- .../streaming/ai_contentmoderation_nsfw.py | 2 +- .../ai_contentmoderation_softnudity.py | 2 +- .../streaming/ai_contentmoderation_sport.py | 2 +- .../streaming/ai_contentmoderation_weapon.py | 39 ------ src/gcore/types/streaming/ai_task.py | 6 +- .../types/streaming/ai_task_create_params.py | 4 +- .../types/streaming/ai_task_get_response.py | 46 ------- .../types/streaming/create_video_param.py | 4 +- src/gcore/types/streaming/meet_series.py | 23 ---- src/gcore/types/streaming/playlist_video.py | 4 +- .../statistic_get_meet_series_params.py | 20 --- src/gcore/types/streaming/stream.py | 42 +++++-- src/gcore/types/streaming/video.py | 52 +++++--- .../types/streaming/video_update_params.py | 4 +- .../streaming/test_statistics.py | 87 ------------- 26 files changed, 117 insertions(+), 477 deletions(-) delete mode 100644 src/gcore/types/streaming/ai_contentmoderation_casm.py delete mode 100644 src/gcore/types/streaming/ai_contentmoderation_weapon.py delete mode 100644 src/gcore/types/streaming/meet_series.py delete mode 100644 src/gcore/types/streaming/statistic_get_meet_series_params.py diff --git a/.stats.yml b/.stats.yml index 5ac155f6..76078ac3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 481 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c04f3964598a95c86f56053432aba58cab66efa11c8633f58a89b2f904d033c9.yml -openapi_spec_hash: c52e47aa1d3bab4796afb927c78b0f4e +configured_endpoints: 480 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f5f96c7fd251561ab250a43dc2ad1c09be4abd69b12c51b990d4c76c1381a551.yml +openapi_spec_hash: e2fbb8bc507a9ade0550e9a6c4a90ed5 config_hash: 5601e8aebf3c8606867a46bf79b1fd28 diff --git a/api.md b/api.md index 79effe95..19e0c15d 100644 --- a/api.md +++ b/api.md @@ -1437,12 +1437,10 @@ Types: ```python from gcore.types.streaming import ( - AIContentmoderationCasm, AIContentmoderationHardnudity, AIContentmoderationNsfw, AIContentmoderationSoftnudity, AIContentmoderationSport, - AIContentmoderationWeapon, AITask, AITaskCreateResponse, AITaskCancelResponse, @@ -1665,7 +1663,6 @@ Types: from gcore.types.streaming import ( Ffprobes, MaxStreamSeries, - MeetSeries, PopularVideos, StorageSeries, StreamSeries, @@ -1693,7 +1690,6 @@ Methods: - client.streaming.statistics.get_live_watch_time_cdn(\*\*params) -> StreamSeries - client.streaming.statistics.get_live_watch_time_total_cdn(\*\*params) -> VodTotalStreamDurationSeries - client.streaming.statistics.get_max_streams_series(\*\*params) -> MaxStreamSeries -- client.streaming.statistics.get_meet_series(\*\*params) -> MeetSeries - client.streaming.statistics.get_popular_videos(\*\*params) -> PopularVideos - client.streaming.statistics.get_storage_series(\*\*params) -> StorageSeries - client.streaming.statistics.get_stream_series(\*\*params) -> StreamSeries diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 4dafc6bd..0b63144c 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -54,8 +54,7 @@ def create( task_name: Literal["transcription", "content-moderation"], url: str, audio_language: str | NotGiven = NOT_GIVEN, - category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] - | NotGiven = NOT_GIVEN, + category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | NotGiven = NOT_GIVEN, client_entity_data: str | NotGiven = NOT_GIVEN, client_user_id: str | NotGiven = NOT_GIVEN, subtitles_language: str | NotGiven = NOT_GIVEN, @@ -74,11 +73,9 @@ def create( - ASR: Transcribe video - ASR: Translate subtitles - CM: Sports detection - - CM: Weapon detection - CM: Not Safe For Work (NSFW) content detection - CM: Soft nudity detection - CM: Hard nudity detection - - CM: Child Sexual Abuse Material (CSAM) detection - CM: Objects recognition (soon) ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) How to use: @@ -137,14 +134,11 @@ def create( - `soft_nudity`: Detailed video analysis that reveals both explicit and partial nudity, including the presence of male and female faces and other uncovered body parts. - - `child_pornography`: Detects child sexual abuse materials (CASM). - - `sport`: Recognizes various sporting activities. - - `weapon`: Identifies the presence of weapons in the video content. The AI - Content Moderation API is an invaluable tool for managing and controlling the - type of content being shared or streamed on your platform. By implementing - this API, you can ensure compliance with community guidelines and legal - requirements, as well as provide a safer environment for your users. Important - notes: + - `sport`: Recognizes various sporting activities. The AI Content Moderation API + is an invaluable tool for managing and controlling the type of content being + shared or streamed on your platform. By implementing this API, you can ensure + compliance with community guidelines and legal requirements, as well as + provide a safer environment for your users. Important notes: - It's allowed to analyse still images too (where applicable). Format of image: JPEG, PNG. In that case one image is the same as video of 1 second duration. - Not all frames in the video are used for analysis, but only key frames @@ -312,7 +306,7 @@ def create( - transcription into the original language is a free procedure, - and translation from the original language into any other languages is a "translation" procedure and is paid. More details in - [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + [POST /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task). Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). @@ -484,11 +478,9 @@ def get( - ASR: Transcribe video - ASR: Translate subtitles - CM: Sports detection - - CM: Weapon detection - CM: Not Safe For Work (NSFW) content detection - CM: Soft nudity detection - CM: Hard nudity detection - - CM: Child Sexual Abuse Material (CSAM) detection - CM: Objects recognition (soon) - etc... (see other methods from /ai/ domain) @@ -643,8 +635,7 @@ async def create( task_name: Literal["transcription", "content-moderation"], url: str, audio_language: str | NotGiven = NOT_GIVEN, - category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] - | NotGiven = NOT_GIVEN, + category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | NotGiven = NOT_GIVEN, client_entity_data: str | NotGiven = NOT_GIVEN, client_user_id: str | NotGiven = NOT_GIVEN, subtitles_language: str | NotGiven = NOT_GIVEN, @@ -663,11 +654,9 @@ async def create( - ASR: Transcribe video - ASR: Translate subtitles - CM: Sports detection - - CM: Weapon detection - CM: Not Safe For Work (NSFW) content detection - CM: Soft nudity detection - CM: Hard nudity detection - - CM: Child Sexual Abuse Material (CSAM) detection - CM: Objects recognition (soon) ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) How to use: @@ -726,14 +715,11 @@ async def create( - `soft_nudity`: Detailed video analysis that reveals both explicit and partial nudity, including the presence of male and female faces and other uncovered body parts. - - `child_pornography`: Detects child sexual abuse materials (CASM). - - `sport`: Recognizes various sporting activities. - - `weapon`: Identifies the presence of weapons in the video content. The AI - Content Moderation API is an invaluable tool for managing and controlling the - type of content being shared or streamed on your platform. By implementing - this API, you can ensure compliance with community guidelines and legal - requirements, as well as provide a safer environment for your users. Important - notes: + - `sport`: Recognizes various sporting activities. The AI Content Moderation API + is an invaluable tool for managing and controlling the type of content being + shared or streamed on your platform. By implementing this API, you can ensure + compliance with community guidelines and legal requirements, as well as + provide a safer environment for your users. Important notes: - It's allowed to analyse still images too (where applicable). Format of image: JPEG, PNG. In that case one image is the same as video of 1 second duration. - Not all frames in the video are used for analysis, but only key frames @@ -901,7 +887,7 @@ async def create( - transcription into the original language is a free procedure, - and translation from the original language into any other languages is a "translation" procedure and is paid. More details in - [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + [POST /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task). Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). @@ -1073,11 +1059,9 @@ async def get( - ASR: Transcribe video - ASR: Translate subtitles - CM: Sports detection - - CM: Weapon detection - CM: Not Safe For Work (NSFW) content detection - CM: Soft nudity detection - CM: Hard nudity detection - - CM: Child Sexual Abuse Material (CSAM) detection - CM: Objects recognition (soon) - etc... (see other methods from /ai/ domain) diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 084ee9c2..4e8cb182 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -21,7 +21,6 @@ from ...types.streaming import ( statistic_get_views_params, statistic_get_ffprobes_params, - statistic_get_meet_series_params, statistic_get_stream_series_params, statistic_get_views_heatmap_params, statistic_get_popular_videos_params, @@ -46,7 +45,6 @@ ) from ...types.streaming.views import Views from ...types.streaming.ffprobes import Ffprobes -from ...types.streaming.meet_series import MeetSeries from ...types.streaming.stream_series import StreamSeries from ...types.streaming.views_heatmap import ViewsHeatmap from ...types.streaming.popular_videos import PopularVideos @@ -388,58 +386,6 @@ def get_max_streams_series( cast_to=MaxStreamSeries, ) - def get_meet_series( - self, - *, - from_: str, - to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MeetSeries: - """Calculates time series of the transcoding minutes of all streams. - - The data is - updated near realtime. - - Args: - from_: Start of time frame. Datetime in ISO 8601 format. - - to: End of time frame. Datetime in ISO 8601 format. - - granularity: specifies the time interval for grouping data - - 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( - "/streaming/statistics/meet", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "from_": from_, - "to": to, - "granularity": granularity, - }, - statistic_get_meet_series_params.StatisticGetMeetSeriesParams, - ), - ), - cast_to=MeetSeries, - ) - def get_popular_videos( self, *, @@ -1810,58 +1756,6 @@ async def get_max_streams_series( cast_to=MaxStreamSeries, ) - async def get_meet_series( - self, - *, - from_: str, - to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MeetSeries: - """Calculates time series of the transcoding minutes of all streams. - - The data is - updated near realtime. - - Args: - from_: Start of time frame. Datetime in ISO 8601 format. - - to: End of time frame. Datetime in ISO 8601 format. - - granularity: specifies the time interval for grouping data - - 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( - "/streaming/statistics/meet", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "from_": from_, - "to": to, - "granularity": granularity, - }, - statistic_get_meet_series_params.StatisticGetMeetSeriesParams, - ), - ), - cast_to=MeetSeries, - ) - async def get_popular_videos( self, *, @@ -2931,9 +2825,6 @@ def __init__(self, statistics: StatisticsResource) -> None: self.get_max_streams_series = to_raw_response_wrapper( statistics.get_max_streams_series, ) - self.get_meet_series = to_raw_response_wrapper( - statistics.get_meet_series, - ) self.get_popular_videos = to_raw_response_wrapper( statistics.get_popular_videos, ) @@ -3009,9 +2900,6 @@ def __init__(self, statistics: AsyncStatisticsResource) -> None: self.get_max_streams_series = async_to_raw_response_wrapper( statistics.get_max_streams_series, ) - self.get_meet_series = async_to_raw_response_wrapper( - statistics.get_meet_series, - ) self.get_popular_videos = async_to_raw_response_wrapper( statistics.get_popular_videos, ) @@ -3087,9 +2975,6 @@ def __init__(self, statistics: StatisticsResource) -> None: self.get_max_streams_series = to_streamed_response_wrapper( statistics.get_max_streams_series, ) - self.get_meet_series = to_streamed_response_wrapper( - statistics.get_meet_series, - ) self.get_popular_videos = to_streamed_response_wrapper( statistics.get_popular_videos, ) @@ -3165,9 +3050,6 @@ def __init__(self, statistics: AsyncStatisticsResource) -> None: self.get_max_streams_series = async_to_streamed_response_wrapper( statistics.get_max_streams_series, ) - self.get_meet_series = async_to_streamed_response_wrapper( - statistics.get_meet_series, - ) self.get_popular_videos = async_to_streamed_response_wrapper( statistics.get_popular_videos, ) diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index 88bf963c..f52cfee4 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -150,7 +150,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Overlay: """ - Updates overlay's settings + Updates overlay settings Args: height: Height of the widget @@ -270,7 +270,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Overlay: """ - Returns overlay details + Get overlay details Args: extra_headers: Send extra headers @@ -447,7 +447,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Overlay: """ - Updates overlay's settings + Updates overlay settings Args: height: Height of the widget @@ -567,7 +567,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Overlay: """ - Returns overlay details + Get overlay details Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 2b048223..e2006722 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -113,7 +113,7 @@ def create( for video streams by utilizing Common Media Application Format (CMAF) technology. So you obtain latency from the traditional 30-50 seconds to ±4 seconds only by default. If you need legacy non-low-latency HLS, then look at - HLS MPEGTS delivery below. + HLS MPEG-TS delivery below. You have access to additional functions such as: @@ -318,7 +318,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncPageStreaming[Stream]: - """Returns a list of streams. + """Returns a list of streams Args: page: Query parameter. @@ -809,7 +809,7 @@ async def create( for video streams by utilizing Common Media Application Format (CMAF) technology. So you obtain latency from the traditional 30-50 seconds to ±4 seconds only by default. If you need legacy non-low-latency HLS, then look at - HLS MPEGTS delivery below. + HLS MPEG-TS delivery below. You have access to additional functions such as: @@ -1014,7 +1014,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Stream, AsyncPageStreaming[Stream]]: - """Returns a list of streams. + """Returns a list of streams Args: page: Query parameter. diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index e5823d43..4e59615e 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -73,7 +73,7 @@ def create( language code according to ISO-639-2 (bibliographic code). Specify language you need, or just look at our list in the attribute "`audio_language`" of section - ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). You can add multiple subtitles in the same language, language uniqueness is not required. Size must be up to 5Mb. @@ -84,7 +84,7 @@ def create( subtitles based on AI. Read more: - What is - ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). - If the option is enabled via `auto_transcribe_audio_language: auto|`, then immediately after successful transcoding, an AI task will be automatically created for @@ -332,7 +332,7 @@ async def create( language code according to ISO-639-2 (bibliographic code). Specify language you need, or just look at our list in the attribute "`audio_language`" of section - ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). You can add multiple subtitles in the same language, language uniqueness is not required. Size must be up to 5Mb. @@ -343,7 +343,7 @@ async def create( subtitles based on AI. Read more: - What is - ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). - If the option is enabled via `auto_transcribe_audio_language: auto|`, then immediately after successful transcoding, an AI task will be automatically created for diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index bee81322..c77320db 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -107,7 +107,7 @@ def create( subtitles based on AI. Read more: - What is - ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). - If the option is enabled via `auto_transcribe_audio_language: auto|`, then immediately after successful transcoding, an AI task will be automatically created for @@ -118,7 +118,7 @@ def create( that. Also you can point several languages to translate to, then a separate subtitle will be generated for each specified language. - How to - ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + ["add AI-generated subtitles to an exist video"](/docs/api-reference/streaming/subtitles/add-subtitle). The created AI-task(s) will be automatically executed, and result will also be automatically attached to this video as subtitle(s). Please note that transcription is done automatically for all videos uploaded to our video @@ -226,9 +226,9 @@ def update( More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) + [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified language(s). Can be used both together with `auto_transcribe_audio_language` @@ -795,7 +795,7 @@ async def create( subtitles based on AI. Read more: - What is - ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). - If the option is enabled via `auto_transcribe_audio_language: auto|`, then immediately after successful transcoding, an AI task will be automatically created for @@ -806,7 +806,7 @@ async def create( that. Also you can point several languages to translate to, then a separate subtitle will be generated for each specified language. - How to - ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + ["add AI-generated subtitles to an exist video"](/docs/api-reference/streaming/subtitles/add-subtitle). The created AI-task(s) will be automatically executed, and result will also be automatically attached to this video as subtitle(s). Please note that transcription is done automatically for all videos uploaded to our video @@ -914,9 +914,9 @@ async def update( More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) + [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified language(s). Can be used both together with `auto_transcribe_audio_language` diff --git a/src/gcore/types/streaming/__init__.py b/src/gcore/types/streaming/__init__.py index d64adf6e..b58b2e1d 100644 --- a/src/gcore/types/streaming/__init__.py +++ b/src/gcore/types/streaming/__init__.py @@ -13,7 +13,6 @@ from .restream import Restream as Restream from .subtitle import Subtitle as Subtitle from .broadcast import Broadcast as Broadcast -from .meet_series import MeetSeries as MeetSeries from .player_param import PlayerParam as PlayerParam from .quality_sets import QualitySets as QualitySets from .stream_series import StreamSeries as StreamSeries @@ -67,7 +66,6 @@ from .directory_update_params import DirectoryUpdateParams as DirectoryUpdateParams from .video_list_names_params import VideoListNamesParams as VideoListNamesParams from .direct_upload_parameters import DirectUploadParameters as DirectUploadParameters -from .ai_contentmoderation_casm import AIContentmoderationCasm as AIContentmoderationCasm from .ai_contentmoderation_nsfw import AIContentmoderationNsfw as AIContentmoderationNsfw from .stream_create_clip_params import StreamCreateClipParams as StreamCreateClipParams from .views_by_operating_system import ViewsByOperatingSystem as ViewsByOperatingSystem @@ -75,7 +73,6 @@ from .broadcast_spectators_count import BroadcastSpectatorsCount as BroadcastSpectatorsCount from .statistic_get_views_params import StatisticGetViewsParams as StatisticGetViewsParams from .stream_list_clips_response import StreamListClipsResponse as StreamListClipsResponse -from .ai_contentmoderation_weapon import AIContentmoderationWeapon as AIContentmoderationWeapon from .video_create_multiple_params import VideoCreateMultipleParams as VideoCreateMultipleParams from .playlist_list_videos_response import PlaylistListVideosResponse as PlaylistListVideosResponse from .statistic_get_ffprobes_params import StatisticGetFfprobesParams as StatisticGetFfprobesParams @@ -86,7 +83,6 @@ from .ai_contentmoderation_softnudity import AIContentmoderationSoftnudity as AIContentmoderationSoftnudity from .stream_start_recording_response import StreamStartRecordingResponse as StreamStartRecordingResponse from .ai_task_get_ai_settings_response import AITaskGetAISettingsResponse as AITaskGetAISettingsResponse -from .statistic_get_meet_series_params import StatisticGetMeetSeriesParams as StatisticGetMeetSeriesParams from .vod_total_stream_duration_series import VodTotalStreamDurationSeries as VodTotalStreamDurationSeries from .statistic_get_stream_series_params import StatisticGetStreamSeriesParams as StatisticGetStreamSeriesParams from .statistic_get_views_heatmap_params import StatisticGetViewsHeatmapParams as StatisticGetViewsHeatmapParams diff --git a/src/gcore/types/streaming/ai_contentmoderation_casm.py b/src/gcore/types/streaming/ai_contentmoderation_casm.py deleted file mode 100644 index be44029f..00000000 --- a/src/gcore/types/streaming/ai_contentmoderation_casm.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["AIContentmoderationCasm"] - - -class AIContentmoderationCasm(BaseModel): - category: Literal["child_pornography", "sport", "weapon", "nsfw", "hard_nudity", "soft_nudity"] - """AI content moderation with child pornography detection algorithm""" - - task_name: Literal["content-moderation"] - """Name of the task to be performed""" - - url: str - """URL to the MP4 file to analyse. - - File must be publicly accessible via HTTP/HTTPS. - """ - - client_entity_data: Optional[str] = None - """ - Meta parameter, designed to store your own extra information about a video - entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. - """ - - client_user_id: Optional[str] = None - """Meta parameter, designed to store your own identifier. - - Can be used by you to tag requests from different end-users. It is not used in - any way in video processing. - """ diff --git a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py index 4dd49d55..61517f1a 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py +++ b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py @@ -9,7 +9,7 @@ class AIContentmoderationHardnudity(BaseModel): - category: Literal["hard_nudity", "sport", "weapon", "nsfw", "soft_nudity", "child_pornography"] + category: Literal["hard_nudity", "sport", "nsfw", "soft_nudity"] """AI content moderation with "`hard_nudity`" algorithm""" task_name: Literal["content-moderation"] diff --git a/src/gcore/types/streaming/ai_contentmoderation_nsfw.py b/src/gcore/types/streaming/ai_contentmoderation_nsfw.py index c2df5d03..e7c3436b 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_nsfw.py +++ b/src/gcore/types/streaming/ai_contentmoderation_nsfw.py @@ -9,7 +9,7 @@ class AIContentmoderationNsfw(BaseModel): - category: Literal["nsfw", "sport", "weapon", "hard_nudity", "soft_nudity", "child_pornography"] + category: Literal["nsfw", "sport", "hard_nudity", "soft_nudity"] """AI content moderation with NSFW detection algorithm""" task_name: Literal["content-moderation"] diff --git a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py index 8c169401..5c0b7f3c 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py +++ b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py @@ -9,7 +9,7 @@ class AIContentmoderationSoftnudity(BaseModel): - category: Literal["soft_nudity", "sport", "weapon", "nsfw", "hard_nudity", "child_pornography"] + category: Literal["soft_nudity", "sport", "nsfw", "hard_nudity"] """AI content moderation with "`soft_nudity`" algorithm""" task_name: Literal["content-moderation"] diff --git a/src/gcore/types/streaming/ai_contentmoderation_sport.py b/src/gcore/types/streaming/ai_contentmoderation_sport.py index 34c8974e..78c5b629 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_sport.py +++ b/src/gcore/types/streaming/ai_contentmoderation_sport.py @@ -9,7 +9,7 @@ class AIContentmoderationSport(BaseModel): - category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] + category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] """AI content moderation with types of sports activity detection""" task_name: Literal["content-moderation"] diff --git a/src/gcore/types/streaming/ai_contentmoderation_weapon.py b/src/gcore/types/streaming/ai_contentmoderation_weapon.py deleted file mode 100644 index b0e8c452..00000000 --- a/src/gcore/types/streaming/ai_contentmoderation_weapon.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["AIContentmoderationWeapon"] - - -class AIContentmoderationWeapon(BaseModel): - category: Literal["weapon", "sport", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] - """AI content moderation with weapon detection algorithm""" - - task_name: Literal["content-moderation"] - """Name of the task to be performed""" - - url: str - """URL to the MP4 file to analyse. - - File must be publicly accessible via HTTP/HTTPS. - """ - - client_entity_data: Optional[str] = None - """ - Meta parameter, designed to store your own extra information about a video - entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. - """ - - client_user_id: Optional[str] = None - """Meta parameter, designed to store your own identifier. - - Can be used by you to tag requests from different end-users. It is not used in - any way in video processing. - """ diff --git a/src/gcore/types/streaming/ai_task.py b/src/gcore/types/streaming/ai_task.py index acf9b2ee..fd114dea 100644 --- a/src/gcore/types/streaming/ai_task.py +++ b/src/gcore/types/streaming/ai_task.py @@ -4,10 +4,8 @@ from typing_extensions import Literal, TypeAlias from ..._models import BaseModel -from .ai_contentmoderation_casm import AIContentmoderationCasm from .ai_contentmoderation_nsfw import AIContentmoderationNsfw from .ai_contentmoderation_sport import AIContentmoderationSport -from .ai_contentmoderation_weapon import AIContentmoderationWeapon from .ai_contentmoderation_hardnudity import AIContentmoderationHardnudity from .ai_contentmoderation_softnudity import AIContentmoderationSoftnudity @@ -163,7 +161,7 @@ class TaskDataAITranscribe(BaseModel): - transcription into the original language is a free procedure, - and translation from the original language into any other languages is a "translation" procedure and is paid. More details in - [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + [POST /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task). Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). """ @@ -174,9 +172,7 @@ class TaskDataAITranscribe(BaseModel): AIContentmoderationNsfw, AIContentmoderationHardnudity, AIContentmoderationSoftnudity, - AIContentmoderationCasm, AIContentmoderationSport, - AIContentmoderationWeapon, ] diff --git a/src/gcore/types/streaming/ai_task_create_params.py b/src/gcore/types/streaming/ai_task_create_params.py index f0fe134f..11bddf89 100644 --- a/src/gcore/types/streaming/ai_task_create_params.py +++ b/src/gcore/types/streaming/ai_task_create_params.py @@ -130,7 +130,7 @@ class AITaskCreateParams(TypedDict, total=False): - 'yor': Yoruba """ - category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] + category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] """Model for analysis (content-moderation only). Determines what exactly needs to be found in the video. @@ -162,7 +162,7 @@ class AITaskCreateParams(TypedDict, total=False): - transcription into the original language is a free procedure, - and translation from the original language into any other languages is a "translation" procedure and is paid. More details in - [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + [POST /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task). Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). """ diff --git a/src/gcore/types/streaming/ai_task_get_response.py b/src/gcore/types/streaming/ai_task_get_response.py index e9179a3c..8bd63299 100644 --- a/src/gcore/types/streaming/ai_task_get_response.py +++ b/src/gcore/types/streaming/ai_task_get_response.py @@ -16,16 +16,12 @@ "AITaskGetResponseResultAIResultsTranscribeSubtitle", "AITaskGetResponseResultAIResultsContentmoderationSport", "AITaskGetResponseResultAIResultsContentmoderationSportFrame", - "AITaskGetResponseResultAIResultsContentmoderationWeapon", - "AITaskGetResponseResultAIResultsContentmoderationWeaponFrame", "AITaskGetResponseResultAIResultsContentmoderationNsfw", "AITaskGetResponseResultAIResultsContentmoderationNsfwFrame", "AITaskGetResponseResultAIResultsContentmoderationHardnudity", "AITaskGetResponseResultAIResultsContentmoderationHardnudityFrame", "AITaskGetResponseResultAIResultsContentmoderationSoftnudity", "AITaskGetResponseResultAIResultsContentmoderationSoftnudityFrame", - "AITaskGetResponseResultAIResultsContentmoderationCasm", - "AITaskGetResponseResultAIResultsContentmoderationCasmFrame", "AITaskGetResponseResultAIResultsFailure", ] @@ -157,26 +153,6 @@ class AITaskGetResponseResultAIResultsContentmoderationSport(BaseModel): """A boolean value whether any sports were detected""" -class AITaskGetResponseResultAIResultsContentmoderationWeaponFrame(BaseModel): - confidence: Optional[float] = None - """Percentage of probability of identifying the object""" - - frame_number: Optional[int] = FieldInfo(alias="frame-number", default=None) - """Video frame number where object was found""" - - label: Optional[str] = None - """Type of detected object""" - - -class AITaskGetResponseResultAIResultsContentmoderationWeapon(BaseModel): - detection_results: Optional[List[Literal["gun", "heavy weapon", "knife"]]] = None - - frames: Optional[List[AITaskGetResponseResultAIResultsContentmoderationWeaponFrame]] = None - - weapon_detected: Optional[bool] = None - """A boolean value whether any weapon was detected""" - - class AITaskGetResponseResultAIResultsContentmoderationNsfwFrame(BaseModel): confidence: Optional[float] = None """Percentage of probability of identifying the object""" @@ -271,26 +247,6 @@ class AITaskGetResponseResultAIResultsContentmoderationSoftnudity(BaseModel): """A boolean value whether any nudity and other body part was detected""" -class AITaskGetResponseResultAIResultsContentmoderationCasmFrame(BaseModel): - confidence: Optional[float] = None - """Percentage of probability of identifying the object""" - - frame_number: Optional[int] = FieldInfo(alias="frame-number", default=None) - """Video frame number where object was found""" - - label: Optional[str] = None - """Type of detected object""" - - -class AITaskGetResponseResultAIResultsContentmoderationCasm(BaseModel): - child_pornography_detected: Optional[bool] = None - """A boolean value whether child pornography was detected""" - - detection_results: Optional[List[Literal["0-2", "3-9", "10-19"]]] = None - - frames: Optional[List[AITaskGetResponseResultAIResultsContentmoderationCasmFrame]] = None - - class AITaskGetResponseResultAIResultsFailure(BaseModel): error: str @@ -298,11 +254,9 @@ class AITaskGetResponseResultAIResultsFailure(BaseModel): AITaskGetResponseResult: TypeAlias = Union[ AITaskGetResponseResultAIResultsTranscribe, AITaskGetResponseResultAIResultsContentmoderationSport, - AITaskGetResponseResultAIResultsContentmoderationWeapon, AITaskGetResponseResultAIResultsContentmoderationNsfw, AITaskGetResponseResultAIResultsContentmoderationHardnudity, AITaskGetResponseResultAIResultsContentmoderationSoftnudity, - AITaskGetResponseResultAIResultsContentmoderationCasm, AITaskGetResponseResultAIResultsFailure, ] diff --git a/src/gcore/types/streaming/create_video_param.py b/src/gcore/types/streaming/create_video_param.py index 836ecbe5..aed1f153 100644 --- a/src/gcore/types/streaming/create_video_param.py +++ b/src/gcore/types/streaming/create_video_param.py @@ -32,9 +32,9 @@ class CreateVideoParam(TypedDict, total=False): More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) + [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). """ auto_translate_subtitles_language: Literal["disable", "default", ""] diff --git a/src/gcore/types/streaming/meet_series.py b/src/gcore/types/streaming/meet_series.py deleted file mode 100644 index cc71be98..00000000 --- a/src/gcore/types/streaming/meet_series.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import TypeAlias - -from ..._models import BaseModel - -__all__ = ["MeetSeries", "MeetSeriesItem", "MeetSeriesItemMetrics"] - - -class MeetSeriesItemMetrics(BaseModel): - max_meet_usage: Optional[List[int]] = None - - meet: Optional[List[List[int]]] = None - - -class MeetSeriesItem(BaseModel): - client: int - - metrics: MeetSeriesItemMetrics - - -MeetSeries: TypeAlias = List[MeetSeriesItem] diff --git a/src/gcore/types/streaming/playlist_video.py b/src/gcore/types/streaming/playlist_video.py index d1b6e241..309b5362 100644 --- a/src/gcore/types/streaming/playlist_video.py +++ b/src/gcore/types/streaming/playlist_video.py @@ -33,9 +33,9 @@ class PlaylistVideo(BaseModel): More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) + [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). """ auto_translate_subtitles_language: Optional[Literal["disable", "default", ""]] = None diff --git a/src/gcore/types/streaming/statistic_get_meet_series_params.py b/src/gcore/types/streaming/statistic_get_meet_series_params.py deleted file mode 100644 index 7c3e36ce..00000000 --- a/src/gcore/types/streaming/statistic_get_meet_series_params.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["StatisticGetMeetSeriesParams"] - - -class StatisticGetMeetSeriesParams(TypedDict, total=False): - from_: Required[Annotated[str, PropertyInfo(alias="from")]] - """Start of time frame. Datetime in ISO 8601 format.""" - - to: Required[str] - """End of time frame. Datetime in ISO 8601 format.""" - - granularity: Literal["1m", "5m", "15m", "1h", "1d"] - """specifies the time interval for grouping data""" diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py index 4fdc6e54..9d49c2c5 100644 --- a/src/gcore/types/streaming/stream.py +++ b/src/gcore/types/streaming/stream.py @@ -168,7 +168,7 @@ class Stream(BaseModel): - and its possible to enable ±3 sec for LL-HLS, just ask our Support Team. It is also possible to use modifier-attributes, which are described in the - "`hls_mpegts_url`" field above. If you need to get MPEGTS (.ts) chunks, look at + "`hls_mpegts_url`" field above. If you need to get MPEG-TS (.ts) chunks, look at the attribute "`hls_mpegts_url`". Read more information in the article "How Low Latency streaming works" in the @@ -184,13 +184,13 @@ class Stream(BaseModel): hls_mpegts_url: Optional[str] = None """HLS output for legacy devices. - URL for transcoded result of stream in HLS MPEGTS (.ts) format, with .m3u8 link. - Low Latency support: NO. Some legacy devices or software may require MPEGTS - (.ts) segments as a format for streaming, so we provide this options keeping - backward compatibility with any of your existing workflows. For other cases it's - better to use "`hls_cmaf_url`" instead. You can use this legacy HLSv6 format - based on MPEGTS segmenter in parallel with main HLS CMAF. Both formats are - sharing same segments size, manifest length (DVR), etc. + URL for transcoded result of stream in HLS MPEG-TS (.ts) format, with .m3u8 + link. Low Latency support: NO. Some legacy devices or software may require + MPEG-TS (.ts) segments as a format for streaming, so we provide this options + keeping backward compatibility with any of your existing workflows. For other + cases it's better to use "`hls_cmaf_url`" instead. You can use this legacy HLSv6 + format based on MPEG-TS segmenter in parallel with main HLS CMAF. Both formats + are sharing same segments size, manifest length (DVR), etc. It is also possible to use additional modifier-attributes: @@ -288,6 +288,9 @@ class Stream(BaseModel): """ URL to PUSH master stream to our main server using RTMP and RTMPS protocols. To use RTMPS just manually change the protocol name from "rtmp://" to "rtmps://". + Use only 1 protocol of sending a master stream: eitheronly RTMP/S (`push_url`), + or only SRT (`push_url_srt`). + If you see an error like "invalid SSL certificate" try the following: - Make sure the push URL is correct, and it contains "rtmps://". @@ -307,8 +310,27 @@ class Stream(BaseModel): push_url_srt: Optional[str] = None """ URL to PUSH master stream to our main server using SRT protocol. Use only 1 - protocol of sending a master stream: either only SRT (`push_url_srt`), or only - RTMP (`push_url`). + protocol of sending a master stream: eitheronly RTMP/S (`push_url`), or only SRT + (`push_url_srt`). + + **Setup SRT latency on your sender side** SRT is designed as a low-latency + transport protocol, but real networks are not always stable and in some cases + the end-to-end path from the venue to the ingest point can be long. For this + reason, it is important to configure the latency parameter carefully to match + the actual network conditions. Small latency values may lead to packet loss when + jitter or retransmissions occur, while very large values introduce unnecessary + end-to-end delay. \\**Incorrect or low default value is one of the most common + reasons for packet loss, frames loss, and bad picture.\\** + + We therefore recommend setting latency manually rather than relying on the + default, to ensure the buffer is correctly sized for your environment. A + practical range is 400–2000 ms, with the exact value chosen based on RTT, + jitter, and expected packet loss. Be sure to check and test SRT settings on your + sender side. The default values do not take into account your specific scenarios + and do not work well. If necessary, ask us and we will help you. + + See more information and best practices about SRT protocol in the Product + Documentation. """ push_url_whip: Optional[str] = None diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py index 2ed91392..42fff728 100644 --- a/src/gcore/types/streaming/video.py +++ b/src/gcore/types/streaming/video.py @@ -32,23 +32,50 @@ class ConvertedVideo(BaseModel): - /videos/{`client_id`}\\__{slug}/{filename}.mp4 - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download={`custom_filename`} The - first option returns the file as is. The following options respond with the - header that directly tells browsers to download the file instead of playing it - in the browser. + first option returns the file as is. Response will be: ``` - Content-Disposition: attachment + GET .mp4 + ... + content-type: video/mp4 + ``` + + 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 ``` The third option allows you to set a custom name for the file being downloaded. You can optionally specify a custom filename (just name excluding the .mp4 - extension) using the download= query. Filename Constraints + extension) using the download= query. Filename constraints: - Length: 1-255 characters - Must NOT include the .mp4 extension (it is added automatically) - Allowed characters: a-z, A-Z, 0-9, \\__(underscore), -(dash), .(dot) - - First character cannot be .(dot) Example valid filenames: `holiday2025`, - `_backup.final`, `clip-v1.2` + - First character cannot be .(dot) + - 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 + ``` + + Examples: + + - Video: + `https://demo-public.gvideo.io/videos/2675_1OFgHZ1FWZNNvx1A/qid3567v1_h264_4050_1080.mp4/download` + - Video with custom download filename: + `https://demo-public.gvideo.io/videos/2675_1OFgHZ1FWZNNvx1A/qid3567v1_h264_4050_1080.mp4/download=highlights_v1.1_2025-05-30` **Default MP4 file name structure** Link to the file {filename} contains information about the encoding method using format: @@ -84,15 +111,6 @@ class ConvertedVideo(BaseModel): - ip: The user’s IP address Example: `?md5=QX39c77lbQKvYgMMAvpyMQ&expires=1743167062` Read more in Product Documentation in Streaming section "Protected temporarily link". - - **Examples** - - - Audio-only: - `https://demo-public.gvideo.io/videos/2675_JNnccG5l97XPxsov/qid3585v1_aac_128_audio.mp4` - - Video: - `https://demo-public.gvideo.io/videos/2675_3MlggU4xDb1Ssa5Y/qid3567v1_h264_4050_1080.mp4/download` - - Video with custom download filename: - `https://demo-public.gvideo.io/videos/2675_XtMKxzJM6Xt7SBUV/1080.mp4/download=highlights_v1.1_2025-05-30` """ name: Optional[str] = None @@ -269,7 +287,7 @@ class Video(BaseModel): There are some link modificators you can specify and add manually: - - ?`no_low_latency` – player is forced to use non-low-latency streams HLS MPEG TS, instead of MPEG-DASH CMAF or HLS/LL-HLS CMAF. + - ?`no_low_latency` – player is forced to use non-low-latency streams HLS MPEG-TS, instead of MPEG-DASH CMAF or HLS/LL-HLS CMAF. - ?t=(integer) – time to start playback from specified point in the video. Applicable for VOD only. - ?`sub_lang`=(language) – force subtitles to specific language (2 letters ISO 639 code of a language). - Read more in the Product Documentation. diff --git a/src/gcore/types/streaming/video_update_params.py b/src/gcore/types/streaming/video_update_params.py index 94c6ca2c..db5ed39f 100644 --- a/src/gcore/types/streaming/video_update_params.py +++ b/src/gcore/types/streaming/video_update_params.py @@ -32,9 +32,9 @@ class VideoUpdateParams(TypedDict, total=False): More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) + [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). """ auto_translate_subtitles_language: Literal["disable", "default", ""] diff --git a/tests/api_resources/streaming/test_statistics.py b/tests/api_resources/streaming/test_statistics.py index 72546277..bae1314e 100644 --- a/tests/api_resources/streaming/test_statistics.py +++ b/tests/api_resources/streaming/test_statistics.py @@ -12,7 +12,6 @@ from gcore.types.streaming import ( Views, Ffprobes, - MeetSeries, StreamSeries, ViewsHeatmap, PopularVideos, @@ -251,49 +250,6 @@ def test_streaming_response_get_max_streams_series(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_get_meet_series(self, client: Gcore) -> None: - statistic = client.streaming.statistics.get_meet_series( - from_="from", - to="to", - ) - assert_matches_type(MeetSeries, statistic, path=["response"]) - - @parametrize - def test_method_get_meet_series_with_all_params(self, client: Gcore) -> None: - statistic = client.streaming.statistics.get_meet_series( - from_="from", - to="to", - granularity="1m", - ) - assert_matches_type(MeetSeries, statistic, path=["response"]) - - @parametrize - def test_raw_response_get_meet_series(self, client: Gcore) -> None: - response = client.streaming.statistics.with_raw_response.get_meet_series( - from_="from", - to="to", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - statistic = response.parse() - assert_matches_type(MeetSeries, statistic, path=["response"]) - - @parametrize - def test_streaming_response_get_meet_series(self, client: Gcore) -> None: - with client.streaming.statistics.with_streaming_response.get_meet_series( - from_="from", - to="to", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - statistic = response.parse() - assert_matches_type(MeetSeries, statistic, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize def test_method_get_popular_videos(self, client: Gcore) -> None: statistic = client.streaming.statistics.get_popular_videos( @@ -1209,49 +1165,6 @@ async def test_streaming_response_get_max_streams_series(self, async_client: Asy assert cast(Any, response.is_closed) is True - @parametrize - async def test_method_get_meet_series(self, async_client: AsyncGcore) -> None: - statistic = await async_client.streaming.statistics.get_meet_series( - from_="from", - to="to", - ) - assert_matches_type(MeetSeries, statistic, path=["response"]) - - @parametrize - async def test_method_get_meet_series_with_all_params(self, async_client: AsyncGcore) -> None: - statistic = await async_client.streaming.statistics.get_meet_series( - from_="from", - to="to", - granularity="1m", - ) - assert_matches_type(MeetSeries, statistic, path=["response"]) - - @parametrize - async def test_raw_response_get_meet_series(self, async_client: AsyncGcore) -> None: - response = await async_client.streaming.statistics.with_raw_response.get_meet_series( - from_="from", - to="to", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - statistic = await response.parse() - assert_matches_type(MeetSeries, statistic, path=["response"]) - - @parametrize - async def test_streaming_response_get_meet_series(self, async_client: AsyncGcore) -> None: - async with async_client.streaming.statistics.with_streaming_response.get_meet_series( - from_="from", - to="to", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - statistic = await response.parse() - assert_matches_type(MeetSeries, statistic, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize async def test_method_get_popular_videos(self, async_client: AsyncGcore) -> None: statistic = await async_client.streaming.statistics.get_popular_videos( From a8d030f670c34a6a0b94fb9963ea3833bfbe68ca Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 29 Aug 2025 10:10:33 +0000 Subject: [PATCH 271/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/_client.py | 10 +- src/gcore/resources/cloud/audit_logs.py | 8 +- .../resources/cloud/baremetal/flavors.py | 8 +- src/gcore/resources/cloud/baremetal/images.py | 8 +- .../resources/cloud/baremetal/servers.py | 36 +++- .../resources/cloud/billing_reservations.py | 16 +- src/gcore/resources/cloud/cost_reports.py | 24 ++- .../cloud/file_shares/access_rules.py | 24 ++- .../cloud/file_shares/file_shares.py | 48 +++-- src/gcore/resources/cloud/floating_ips.py | 48 +++-- .../cloud/gpu_baremetal_clusters/flavors.py | 8 +- .../gpu_baremetal_clusters.py | 64 ++++-- .../cloud/gpu_baremetal_clusters/images.py | 32 ++- .../gpu_baremetal_clusters/interfaces.py | 8 +- .../cloud/gpu_baremetal_clusters/servers.py | 56 ++++-- .../resources/cloud/inference/api_keys.py | 40 +++- .../inference/applications/deployments.py | 40 +++- .../cloud/inference/applications/templates.py | 16 +- .../inference/deployments/deployments.py | 64 ++++-- .../cloud/inference/deployments/logs.py | 8 +- .../resources/cloud/inference/flavors.py | 16 +- .../resources/cloud/inference/inference.py | 8 +- .../cloud/inference/registry_credentials.py | 40 +++- .../resources/cloud/inference/secrets.py | 40 +++- .../resources/cloud/instances/flavors.py | 8 +- src/gcore/resources/cloud/instances/images.py | 48 +++-- .../resources/cloud/instances/instances.py | 112 ++++++++--- .../resources/cloud/instances/interfaces.py | 24 ++- .../resources/cloud/instances/metrics.py | 8 +- src/gcore/resources/cloud/ip_ranges.py | 8 +- .../resources/cloud/load_balancers/flavors.py | 8 +- .../load_balancers/l7_policies/l7_policies.py | 40 +++- .../cloud/load_balancers/l7_policies/rules.py | 40 +++- .../cloud/load_balancers/listeners.py | 40 +++- .../cloud/load_balancers/load_balancers.py | 56 ++++-- .../resources/cloud/load_balancers/metrics.py | 8 +- .../load_balancers/pools/health_monitors.py | 16 +- .../cloud/load_balancers/pools/members.py | 16 +- .../cloud/load_balancers/pools/pools.py | 40 +++- .../cloud/load_balancers/statuses.py | 16 +- .../resources/cloud/networks/networks.py | 40 +++- src/gcore/resources/cloud/networks/routers.py | 56 ++++-- src/gcore/resources/cloud/networks/subnets.py | 40 +++- src/gcore/resources/cloud/placement_groups.py | 32 ++- src/gcore/resources/cloud/projects.py | 32 ++- src/gcore/resources/cloud/quotas/quotas.py | 24 ++- src/gcore/resources/cloud/quotas/requests.py | 32 ++- src/gcore/resources/cloud/regions.py | 12 +- .../resources/cloud/registries/artifacts.py | 16 +- .../resources/cloud/registries/registries.py | 40 +++- .../cloud/registries/repositories.py | 16 +- src/gcore/resources/cloud/registries/tags.py | 8 +- src/gcore/resources/cloud/registries/users.py | 48 +++-- .../reserved_fixed_ips/reserved_fixed_ips.py | 32 ++- .../resources/cloud/reserved_fixed_ips/vip.py | 40 +++- src/gcore/resources/cloud/secrets.py | 32 ++- .../resources/cloud/security_groups/rules.py | 24 ++- .../cloud/security_groups/security_groups.py | 56 ++++-- src/gcore/resources/cloud/ssh_keys.py | 40 +++- src/gcore/resources/cloud/tasks.py | 28 ++- src/gcore/resources/cloud/usage_reports.py | 8 +- .../resources/cloud/users/role_assignments.py | 32 ++- src/gcore/resources/cloud/volumes.py | 80 ++++++-- src/gcore/resources/dns/dns.py | 12 +- src/gcore/resources/dns/locations.py | 28 ++- src/gcore/resources/dns/metrics.py | 8 +- src/gcore/resources/dns/pickers/pickers.py | 4 +- src/gcore/resources/dns/pickers/presets.py | 8 +- src/gcore/resources/dns/zones/dnssec.py | 16 +- src/gcore/resources/dns/zones/rrsets.py | 48 +++-- src/gcore/resources/dns/zones/zones.py | 80 +++++--- src/gcore/resources/fastedge/apps/apps.py | 40 ++-- src/gcore/resources/fastedge/apps/logs.py | 8 +- src/gcore/resources/fastedge/binaries.py | 32 ++- src/gcore/resources/fastedge/fastedge.py | 4 +- src/gcore/resources/fastedge/kv_stores.py | 32 ++- src/gcore/resources/fastedge/secrets.py | 48 +++-- src/gcore/resources/fastedge/statistics.py | 16 +- src/gcore/resources/fastedge/templates.py | 40 +++- src/gcore/resources/iam/api_tokens.py | 32 ++- src/gcore/resources/iam/iam.py | 4 +- src/gcore/resources/iam/users.py | 36 +++- src/gcore/resources/security/bgp_announces.py | 16 +- src/gcore/resources/security/events.py | 8 +- .../resources/security/profile_templates.py | 8 +- src/gcore/resources/security/profiles.py | 48 +++-- src/gcore/resources/streaming/ai_tasks.py | 28 ++- src/gcore/resources/streaming/broadcasts.py | 48 +++-- src/gcore/resources/streaming/directories.py | 40 +++- src/gcore/resources/streaming/players.py | 40 ++-- src/gcore/resources/streaming/playlists.py | 48 +++-- src/gcore/resources/streaming/quality_sets.py | 16 +- src/gcore/resources/streaming/restreams.py | 40 +++- src/gcore/resources/streaming/statistics.py | 184 +++++++++++++----- .../resources/streaming/streams/overlays.py | 48 +++-- .../resources/streaming/streams/streams.py | 72 +++++-- .../resources/streaming/videos/subtitles.py | 40 +++- .../resources/streaming/videos/videos.py | 56 ++++-- src/gcore/resources/waap/advanced_rules.py | 8 +- src/gcore/resources/waap/custom_page_sets.py | 48 +++-- .../resources/waap/domains/advanced_rules.py | 48 +++-- .../resources/waap/domains/api_discovery.py | 48 +++-- .../resources/waap/domains/api_path_groups.py | 8 +- src/gcore/resources/waap/domains/api_paths.py | 40 +++- .../resources/waap/domains/custom_rules.py | 56 ++++-- src/gcore/resources/waap/domains/domains.py | 44 +++-- .../resources/waap/domains/firewall_rules.py | 56 ++++-- .../waap/domains/insight_silences.py | 40 +++- src/gcore/resources/waap/domains/insights.py | 24 ++- src/gcore/resources/waap/domains/settings.py | 16 +- .../resources/waap/domains/statistics.py | 48 +++-- src/gcore/resources/waap/insights.py | 8 +- src/gcore/resources/waap/ip_info/ip_info.py | 64 ++++-- src/gcore/resources/waap/ip_info/metrics.py | 8 +- src/gcore/resources/waap/organizations.py | 8 +- src/gcore/resources/waap/statistics.py | 8 +- src/gcore/resources/waap/tags.py | 4 +- src/gcore/resources/waap/waap.py | 4 +- .../cloud/baremetal/server_rebuild_params.py | 2 + .../cloud/baremetal/test_servers.py | 56 +++--- 121 files changed, 2820 insertions(+), 992 deletions(-) diff --git a/.stats.yml b/.stats.yml index 76078ac3..5f3f505d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 480 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f5f96c7fd251561ab250a43dc2ad1c09be4abd69b12c51b990d4c76c1381a551.yml -openapi_spec_hash: e2fbb8bc507a9ade0550e9a6c4a90ed5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1a7494f99877ef48b0e33fb55f803ff97fe3618d2379c345c9393afad72c9e90.yml +openapi_spec_hash: 8ae4c37eea00eed48dce435bfe4c69c7 config_hash: 5601e8aebf3c8606867a46bf79b1fd28 diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 03876d8b..87f69758 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -111,6 +111,7 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") + self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -194,7 +195,7 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( + client = self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -207,6 +208,8 @@ def copy( default_query=params, **_extra_kwargs, ) + client._base_url_overridden = self._base_url_overridden or base_url is not None + return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) @@ -336,6 +339,7 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") + self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -419,7 +423,7 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( + client = self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -432,6 +436,8 @@ def copy( default_query=params, **_extra_kwargs, ) + client._base_url_overridden = self._base_url_overridden or base_url is not None + return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index b6aa9de3..c7e757e0 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -206,7 +206,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions", + "/cloud/v1/user_actions" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/user_actions", page=SyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, @@ -415,7 +417,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions", + "/cloud/v1/user_actions" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/user_actions", page=AsyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 1645b30b..91474de4 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -93,7 +93,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -187,7 +189,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index 147ebf85..d8e870d7 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -91,7 +91,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -179,7 +181,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 088b6321..b5dba5c6 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -156,7 +156,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -294,7 +296,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", page=SyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -350,6 +354,12 @@ def rebuild( Rebuild a bare metal server with a new image while preserving its configuration. Args: + project_id: Project ID + + region_id: Region ID + + server_id: Server ID + image_id: Image ID user_data: String in base64 format. Must not be passed together with 'username' or @@ -371,7 +381,9 @@ def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=maybe_transform( { "image_id": image_id, @@ -515,7 +527,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -653,7 +667,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", page=AsyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -709,6 +725,12 @@ async def rebuild( Rebuild a bare metal server with a new image while preserving its configuration. Args: + project_id: Project ID + + region_id: Region ID + + server_id: Server ID + image_id: Image ID user_data: String in base64 format. Must not be passed together with 'username' or @@ -730,7 +752,9 @@ async def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=await async_maybe_transform( { "image_id": image_id, diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index 0d9df747..ae49d667 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -120,7 +120,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations", + "/cloud/v1/reservations" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservations", page=SyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,7 +280,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations", + "/cloud/v1/reservations" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservations", page=AsyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -330,7 +336,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 36075dd6..910b8fa7 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -146,7 +146,9 @@ def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/totals", body=maybe_transform( { "time_from": time_from, @@ -255,7 +257,9 @@ def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", body=maybe_transform( { "regions": regions, @@ -381,7 +385,9 @@ def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/resources", body=maybe_transform( { "time_from": time_from, @@ -522,7 +528,9 @@ async def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/totals", body=await async_maybe_transform( { "time_from": time_from, @@ -631,7 +639,9 @@ async def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", body=await async_maybe_transform( { "regions": regions, @@ -757,7 +767,9 @@ async def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/resources", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index 21ba3f40..5efd03fb 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -88,7 +88,9 @@ def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=maybe_transform( { "access_mode": access_mode, @@ -140,7 +142,9 @@ def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,7 +195,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -263,7 +269,9 @@ async def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=await async_maybe_transform( { "access_mode": access_mode, @@ -315,7 +323,9 @@ async def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -366,7 +376,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 71c1c9d8..bf7e7b62 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -206,7 +206,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -289,7 +291,9 @@ def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=maybe_transform( { "name": name, @@ -349,7 +353,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", page=SyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -407,7 +413,9 @@ def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -452,7 +460,9 @@ def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -500,7 +510,9 @@ def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -675,7 +687,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -758,7 +772,9 @@ async def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=await async_maybe_transform( { "name": name, @@ -818,7 +834,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", page=AsyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -876,7 +894,9 @@ async def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -921,7 +941,9 @@ async def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -969,7 +991,9 @@ async def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=await async_maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 3bbb8930..b35573d4 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -94,7 +94,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", body=maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -155,7 +157,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", page=SyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -207,7 +211,9 @@ def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -252,7 +258,9 @@ def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=maybe_transform( { "port_id": port_id, @@ -298,7 +306,9 @@ def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -337,7 +347,9 @@ def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -413,7 +425,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", body=await async_maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -474,7 +488,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", page=AsyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -526,7 +542,9 @@ async def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -571,7 +589,9 @@ async def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=await async_maybe_transform( { "port_id": port_id, @@ -617,7 +637,9 @@ async def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -656,7 +678,9 @@ async def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index 2c4563b5..6d594b3b 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -80,7 +80,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -157,7 +159,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 8daaf242..ec7f0279 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -156,7 +156,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=maybe_transform( { "flavor": flavor, @@ -220,7 +222,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=SyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -287,7 +291,9 @@ def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -343,7 +349,9 @@ def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,7 +390,9 @@ def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -421,7 +431,9 @@ def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,7 +485,9 @@ def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=maybe_transform( { "nodes": nodes, @@ -525,7 +539,9 @@ def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, @@ -628,7 +644,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=await async_maybe_transform( { "flavor": flavor, @@ -692,7 +710,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=AsyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -759,7 +779,9 @@ async def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -815,7 +837,9 @@ async def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -854,7 +878,9 @@ async def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -893,7 +919,9 @@ async def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -945,7 +973,9 @@ async def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=await async_maybe_transform( { "nodes": nodes, @@ -997,7 +1027,9 @@ async def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=await async_maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 8c2d4623..249c8d3f 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -79,7 +79,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -124,7 +126,9 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -169,7 +173,9 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +250,9 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=maybe_transform( { "name": name, @@ -320,7 +328,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -365,7 +375,9 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -410,7 +422,9 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,7 +499,9 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index 863ffde8..ad75df3e 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -71,7 +71,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -131,7 +133,9 @@ async def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 138889a4..11af8877 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -99,7 +99,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=SyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -158,7 +160,9 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -393,7 +397,9 @@ def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -452,7 +458,9 @@ def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -498,7 +506,9 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -537,7 +547,9 @@ def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -576,7 +588,9 @@ def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -650,7 +664,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=AsyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -709,7 +725,9 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -946,7 +964,9 @@ async def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -1005,7 +1025,9 @@ async def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, @@ -1051,7 +1073,9 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1090,7 +1114,9 @@ async def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1129,7 +1155,9 @@ async def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py index 98238c19..f9f5ccb9 100644 --- a/src/gcore/resources/cloud/inference/api_keys.py +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -84,7 +84,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", body=maybe_transform( { "name": name, @@ -135,7 +137,9 @@ def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -178,7 +182,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", page=SyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -233,7 +239,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,7 +281,9 @@ def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -340,7 +350,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", body=await async_maybe_transform( { "name": name, @@ -391,7 +403,9 @@ async def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=await async_maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -434,7 +448,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", page=AsyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -489,7 +505,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,7 +547,9 @@ async def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index c41e0b5e..7de9a1e7 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -93,7 +93,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", body=maybe_transform( { "application_name": application_name, @@ -140,7 +142,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,7 +186,9 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,7 +232,9 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -280,7 +288,9 @@ def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -362,7 +372,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", body=await async_maybe_transform( { "application_name": application_name, @@ -409,7 +421,9 @@ async def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -451,7 +465,9 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -495,7 +511,9 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -549,7 +567,9 @@ async def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, diff --git a/src/gcore/resources/cloud/inference/applications/templates.py b/src/gcore/resources/cloud/inference/applications/templates.py index 1c475cb8..664203be 100644 --- a/src/gcore/resources/cloud/inference/applications/templates.py +++ b/src/gcore/resources/cloud/inference/applications/templates.py @@ -58,7 +58,9 @@ def list( required to create a fully functional application deployment. """ return self._get( - "/cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -97,7 +99,9 @@ def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -143,7 +147,9 @@ async def list( required to create a fully functional application deployment. """ return await self._get( - "/cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,7 +188,9 @@ async def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return await self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index a195c324..81ee0ef0 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -147,7 +147,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", body=maybe_transform( { "containers": containers, @@ -263,7 +265,9 @@ def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -325,7 +329,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", page=SyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -376,7 +382,9 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -416,7 +424,9 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -457,7 +467,9 @@ def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -505,7 +517,9 @@ def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -553,7 +567,9 @@ def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -673,7 +689,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", body=await async_maybe_transform( { "containers": containers, @@ -789,7 +807,9 @@ async def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, @@ -851,7 +871,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", page=AsyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -902,7 +924,9 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -942,7 +966,9 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -983,7 +1009,9 @@ async def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1031,7 +1059,9 @@ async def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1079,7 +1109,9 @@ async def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index 1cc65006..2ee0666e 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -91,7 +91,9 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=SyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, @@ -178,7 +180,9 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=AsyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index d273b19b..8dcc3e62 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -73,7 +73,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/flavors", page=SyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -119,7 +121,9 @@ def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return self._get( - f"/cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -178,7 +182,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/flavors", page=AsyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -224,7 +230,9 @@ async def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return await self._get( - f"/cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index 103c70f1..b116b08f 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -123,7 +123,9 @@ def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return self._get( - "/cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +189,9 @@ async def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return await self._get( - "/cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 6dd78f70..9d5a4072 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -86,7 +86,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", body=maybe_transform( { "name": name, @@ -137,7 +139,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", page=SyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -189,7 +193,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -229,7 +235,9 @@ def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -278,7 +286,9 @@ def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=maybe_transform( { "password": password, @@ -354,7 +364,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", body=await async_maybe_transform( { "name": name, @@ -405,7 +417,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", page=AsyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -457,7 +471,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,7 +513,9 @@ async def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -546,7 +564,9 @@ async def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=await async_maybe_transform( { "password": password, diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index 275ec3f2..ed312faa 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -79,7 +79,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", body=maybe_transform( { "data": data, @@ -130,7 +132,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", page=SyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -182,7 +186,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -222,7 +228,9 @@ def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -268,7 +276,9 @@ def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", body=maybe_transform( { "data": data, @@ -340,7 +350,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", body=await async_maybe_transform( { "data": data, @@ -391,7 +403,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", page=AsyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -443,7 +457,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -483,7 +499,9 @@ async def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,7 +547,9 @@ async def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", body=await async_maybe_transform( { "data": data, diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 9bd7f38f..3bf61d85 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -85,7 +85,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -169,7 +171,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index ecead38a..949b6e9c 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -110,7 +110,9 @@ def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", body=maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -176,7 +178,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -230,7 +234,9 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -302,7 +308,9 @@ def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -359,7 +367,9 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -442,7 +452,9 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -544,7 +556,9 @@ async def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", body=await async_maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -610,7 +624,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -664,7 +680,9 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -736,7 +754,9 @@ async def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -793,7 +813,9 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -876,7 +898,9 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 3fd3e8a7..ccdeb3bb 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -228,7 +228,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -295,7 +297,9 @@ def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -444,7 +448,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", page=SyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -538,7 +544,9 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -647,7 +655,9 @@ def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=maybe_transform( { "action": action, @@ -698,7 +708,9 @@ def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -751,7 +763,9 @@ def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=maybe_transform( { "name": name, @@ -797,7 +811,9 @@ def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -836,7 +852,9 @@ def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -890,7 +908,9 @@ def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -932,7 +952,9 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -979,7 +1001,9 @@ def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1021,7 +1045,9 @@ def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1071,7 +1097,9 @@ def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=maybe_transform( { "name": name, @@ -1242,7 +1270,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -1309,7 +1339,9 @@ async def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1458,7 +1490,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", page=AsyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -1552,7 +1586,9 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1661,7 +1697,9 @@ async def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=await async_maybe_transform( { "action": action, @@ -1712,7 +1750,9 @@ async def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=await async_maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -1765,7 +1805,9 @@ async def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=await async_maybe_transform( { "name": name, @@ -1811,7 +1853,9 @@ async def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1850,7 +1894,9 @@ async def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1904,7 +1950,9 @@ async def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1946,7 +1994,9 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1993,7 +2043,9 @@ async def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2035,7 +2087,9 @@ async def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=await async_maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -2085,7 +2139,9 @@ async def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 9cc4b04f..20e0c0f8 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -77,7 +77,9 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -307,7 +309,9 @@ def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -366,7 +370,9 @@ def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -433,7 +439,9 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -663,7 +671,9 @@ async def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -722,7 +732,9 @@ async def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index fa058434..03ffbcd1 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -87,7 +87,9 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -166,7 +168,9 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index 12024d04..b0d0c62e 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -67,7 +67,9 @@ def list( returned. """ return self._get( - "/cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +125,9 @@ async def list( returned. """ return await self._get( - "/cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index 48ba2c61..d104d723 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -76,7 +76,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -143,7 +145,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index 602694d4..05e91176 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 @@ -119,7 +119,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", body=maybe_transform( { "action": action, @@ -169,7 +171,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -208,7 +212,9 @@ def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -247,7 +253,9 @@ def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -315,7 +323,9 @@ def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=maybe_transform( { "action": action, @@ -421,7 +431,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", body=await async_maybe_transform( { "action": action, @@ -471,7 +483,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -510,7 +524,9 @@ async def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -549,7 +565,9 @@ async def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -617,7 +635,9 @@ async def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=await async_maybe_transform( { "action": action, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py index b9201807..dd9cbacf 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -107,7 +107,9 @@ def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=maybe_transform( { "compare_type": compare_type, @@ -157,7 +159,9 @@ def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +203,9 @@ def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -241,7 +247,9 @@ def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -313,7 +321,9 @@ def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=maybe_transform( { "compare_type": compare_type, @@ -413,7 +423,9 @@ async def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=await async_maybe_transform( { "compare_type": compare_type, @@ -463,7 +475,9 @@ async def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -505,7 +519,9 @@ async def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,7 +563,9 @@ async def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -619,7 +637,9 @@ async def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=await async_maybe_transform( { "compare_type": compare_type, diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 2b9827b5..35fdabbc 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -127,7 +127,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", body=maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -219,7 +221,9 @@ def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -279,7 +283,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -334,7 +340,9 @@ def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,7 +390,9 @@ def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -489,7 +499,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", body=await async_maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -581,7 +593,9 @@ async def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=await async_maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -641,7 +655,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -696,7 +712,9 @@ async def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -744,7 +762,9 @@ async def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 104d858f..01115e01 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -207,7 +207,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -297,7 +299,9 @@ def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=maybe_transform( { "logging": logging, @@ -375,7 +379,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", page=SyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -433,7 +439,9 @@ def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -475,7 +483,9 @@ def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -521,7 +531,9 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -573,7 +585,9 @@ def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -704,7 +718,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -794,7 +810,9 @@ async def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=await async_maybe_transform( { "logging": logging, @@ -872,7 +890,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", page=AsyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -930,7 +950,9 @@ async def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -972,7 +994,9 @@ async def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=await async_maybe_transform( {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams ), @@ -1020,7 +1044,9 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1072,7 +1098,9 @@ async def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index 59df8038..dd0dedd2 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -81,7 +81,9 @@ def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -154,7 +156,9 @@ async def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index bae1858c..417ae8b0 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -115,7 +115,9 @@ def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=maybe_transform( { "delay": delay, @@ -177,7 +179,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -274,7 +278,9 @@ async def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=await async_maybe_transform( { "delay": delay, @@ -336,7 +342,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 05091a8b..37faaa3a 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -131,7 +131,9 @@ def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=maybe_transform( { "address": address, @@ -195,7 +197,9 @@ def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -311,7 +315,9 @@ async def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=await async_maybe_transform( { "address": address, @@ -375,7 +381,9 @@ async def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index c0df516c..01abaebd 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -147,7 +147,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", body=maybe_transform( { "lb_algorithm": lb_algorithm, @@ -262,7 +264,9 @@ def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=maybe_transform( { "ca_secret_id": ca_secret_id, @@ -328,7 +332,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -384,7 +390,9 @@ def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -429,7 +437,9 @@ def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -540,7 +550,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", body=await async_maybe_transform( { "lb_algorithm": lb_algorithm, @@ -655,7 +667,9 @@ async def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=await async_maybe_transform( { "ca_secret_id": ca_secret_id, @@ -721,7 +735,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -777,7 +793,9 @@ async def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -822,7 +840,9 @@ async def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 5579e857..e99f90c9 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -69,7 +69,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -108,7 +110,9 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -165,7 +169,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -204,7 +210,9 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 13f2084d..8ee516ed 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -120,7 +120,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -201,7 +203,9 @@ def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=maybe_transform( { "name": name, @@ -268,7 +272,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", page=SyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -328,7 +334,9 @@ def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -373,7 +381,9 @@ def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -458,7 +468,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -539,7 +551,9 @@ async def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=await async_maybe_transform( { "name": name, @@ -606,7 +620,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", page=AsyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -666,7 +682,9 @@ async def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -711,7 +729,9 @@ async def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 657982bd..93596051 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -92,7 +92,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -149,7 +151,9 @@ def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=maybe_transform( { "external_gateway_info": external_gateway_info, @@ -199,7 +203,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", page=SyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -249,7 +255,9 @@ def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,7 +309,9 @@ def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=maybe_transform( { "subnet_id": subnet_id, @@ -350,7 +360,9 @@ def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=maybe_transform({"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -390,7 +402,9 @@ def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -459,7 +473,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -516,7 +532,9 @@ async def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=await async_maybe_transform( { "external_gateway_info": external_gateway_info, @@ -566,7 +584,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", page=AsyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -616,7 +636,9 @@ async def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -668,7 +690,9 @@ async def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=await async_maybe_transform( { "subnet_id": subnet_id, @@ -717,7 +741,9 @@ async def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=await async_maybe_transform( {"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams ), @@ -759,7 +785,9 @@ async def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 1f61c9b2..b2e20f56 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -125,7 +125,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", body=maybe_transform( { "cidr": cidr, @@ -225,7 +227,9 @@ def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=maybe_transform( { "dns_nameservers": dns_nameservers, @@ -311,7 +315,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", page=SyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -372,7 +378,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -417,7 +425,9 @@ def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -521,7 +531,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", body=await async_maybe_transform( { "cidr": cidr, @@ -621,7 +633,9 @@ async def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=await async_maybe_transform( { "dns_nameservers": dns_nameservers, @@ -707,7 +721,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", page=AsyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -768,7 +784,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -813,7 +831,9 @@ async def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 31777c13..4c3a5142 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -80,7 +80,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -123,7 +125,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -162,7 +166,9 @@ def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -201,7 +207,9 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -264,7 +272,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -307,7 +317,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -346,7 +358,9 @@ async def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -385,7 +399,9 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 383f3c3b..0603b072 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -83,7 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", body=maybe_transform( { "name": name, @@ -142,7 +142,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", page=SyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -193,7 +193,9 @@ def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._delete( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,7 +228,9 @@ def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,7 +271,9 @@ def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._put( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", body=maybe_transform( { "name": name, @@ -339,7 +345,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", body=await async_maybe_transform( { "name": name, @@ -398,7 +404,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", page=AsyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -449,7 +455,9 @@ async def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._delete( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -482,7 +490,9 @@ async def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,7 +533,9 @@ async def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._put( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 9a9f9c82..17a7d75a 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -65,7 +65,9 @@ def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return self._get( - "/cloud/v2/client_quotas", + "/cloud/v2/client_quotas" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -103,7 +105,9 @@ def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -136,7 +140,9 @@ def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -180,7 +186,9 @@ async def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return await self._get( - "/cloud/v2/client_quotas", + "/cloud/v2/client_quotas" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -218,7 +226,9 @@ async def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -251,7 +261,9 @@ async def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 79d4febe..4c49c8b0 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -79,7 +79,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", body=maybe_transform( { "description": description, @@ -127,7 +129,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", page=SyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -173,7 +177,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -206,7 +212,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,7 +275,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", body=await async_maybe_transform( { "description": description, @@ -315,7 +325,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", page=AsyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -361,7 +373,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +408,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index b49adfcd..df9da044 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -86,7 +86,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions", + "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", page=SyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -139,7 +139,9 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -213,7 +215,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions", + "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", page=AsyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -266,7 +268,9 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index 0b579ba5..77496af1 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -72,7 +72,9 @@ def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -116,7 +118,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -177,7 +181,9 @@ async def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -221,7 +227,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 8889d473..b8623cf3 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -126,7 +126,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -169,7 +171,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -207,7 +211,9 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +250,9 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -284,7 +292,9 @@ def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=maybe_transform({"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -365,7 +375,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -408,7 +420,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -446,7 +460,9 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -483,7 +499,9 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,7 +541,9 @@ async def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=await async_maybe_transform( {"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams ), diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index 74377052..452755d2 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -69,7 +69,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -110,7 +112,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -168,7 +172,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -209,7 +215,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index ab35828c..7bed1478 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -78,7 +78,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -146,7 +148,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index f535c7dd..8c402baf 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -89,7 +89,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=maybe_transform( { "duration": duration, @@ -142,7 +144,9 @@ def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=maybe_transform( { "duration": duration, @@ -186,7 +190,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -225,7 +231,9 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -265,7 +273,9 @@ def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -304,7 +314,9 @@ def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -375,7 +387,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=await async_maybe_transform( { "duration": duration, @@ -428,7 +442,9 @@ async def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=await async_maybe_transform( { "duration": duration, @@ -472,7 +488,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -511,7 +529,9 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -551,7 +571,9 @@ async def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=await async_maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -590,7 +612,9 @@ async def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index d5b0e030..1cd099f6 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -274,7 +274,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=maybe_transform( { "type": type, @@ -352,7 +354,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=SyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -409,7 +413,9 @@ def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -448,7 +454,9 @@ def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -695,7 +703,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=await async_maybe_transform( { "type": type, @@ -773,7 +783,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=AsyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -830,7 +842,9 @@ async def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -869,7 +883,9 @@ async def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 6d3c91f3..3b0df23d 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -81,7 +81,9 @@ def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -120,7 +122,9 @@ def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -162,7 +166,9 @@ def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -207,7 +213,9 @@ def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -250,7 +258,9 @@ def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), @@ -313,7 +323,9 @@ async def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -352,7 +364,9 @@ async def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +408,9 @@ async def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -439,7 +455,9 @@ async def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=await async_maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -482,7 +500,9 @@ async def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 5cbefb25..dabef59a 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -86,7 +86,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", page=SyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -142,7 +144,9 @@ def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +191,9 @@ def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -236,7 +242,9 @@ def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -312,7 +320,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", page=AsyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -368,7 +378,9 @@ async def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -413,7 +425,9 @@ async def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -462,7 +476,9 @@ async def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index 89b27a23..c69d2608 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -126,7 +126,9 @@ def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=maybe_transform( { "description": description, @@ -179,7 +181,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,7 +277,9 @@ def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=maybe_transform( { "direction": direction, @@ -397,7 +403,9 @@ async def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=await async_maybe_transform( { "description": description, @@ -450,7 +458,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -544,7 +554,9 @@ async def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=await async_maybe_transform( { "direction": direction, diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 034bbe2b..25164fad 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -97,7 +97,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", body=maybe_transform( { "security_group": security_group, @@ -170,7 +172,9 @@ def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=maybe_transform( { "changed_rules": changed_rules, @@ -226,7 +230,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", page=SyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -279,7 +285,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -321,7 +329,9 @@ def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -361,7 +371,9 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -400,7 +412,9 @@ def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,7 +481,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", body=await async_maybe_transform( { "security_group": security_group, @@ -540,7 +556,9 @@ async def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=await async_maybe_transform( { "changed_rules": changed_rules, @@ -596,7 +614,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", page=AsyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -649,7 +669,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -691,7 +713,9 @@ async def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=await async_maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -731,7 +755,9 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -770,7 +796,9 @@ async def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 788d415c..30ef2830 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -90,7 +90,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", body=maybe_transform( { "name": name, @@ -141,7 +143,9 @@ def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=maybe_transform({"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -186,7 +190,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", page=SyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -239,7 +245,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -279,7 +287,9 @@ def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -352,7 +362,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", body=await async_maybe_transform( { "name": name, @@ -403,7 +415,9 @@ async def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=await async_maybe_transform( {"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams ), @@ -450,7 +464,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", page=AsyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -503,7 +519,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -543,7 +561,9 @@ async def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 63bc78f7..c0866b41 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -156,7 +156,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks", + "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", page=SyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -213,7 +213,9 @@ def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -258,7 +260,9 @@ def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -293,7 +297,9 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -431,7 +437,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks", + "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", page=AsyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -488,7 +494,9 @@ async def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -533,7 +541,9 @@ async def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -568,7 +578,9 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index 0adc0809..48387eda 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -139,7 +139,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/usage_report", + "/cloud/v1/usage_report" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/usage_report", body=maybe_transform( { "time_from": time_from, @@ -277,7 +279,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/usage_report", + "/cloud/v1/usage_report" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/usage_report", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 5294d3a7..0318b8fc 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -85,7 +85,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", body=maybe_transform( { "role": role, @@ -139,7 +141,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", body=maybe_transform( { "role": role, @@ -191,7 +195,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", page=SyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -237,7 +243,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ return self._delete( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,7 +308,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", body=await async_maybe_transform( { "role": role, @@ -354,7 +364,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", body=await async_maybe_transform( { "role": role, @@ -406,7 +418,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", page=AsyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -452,7 +466,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ return await self._delete( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 06159e25..f856856c 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -292,7 +292,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", body=maybe_transform( { "image_id": image_id, @@ -376,7 +378,9 @@ def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=maybe_transform( { "name": name, @@ -458,7 +462,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", page=SyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -527,7 +533,9 @@ def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -584,7 +592,9 @@ def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=maybe_transform( { "instance_id": instance_id, @@ -641,7 +651,9 @@ def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=maybe_transform({"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -690,7 +702,9 @@ def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -738,7 +752,9 @@ def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -788,7 +804,9 @@ def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -837,7 +855,9 @@ def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1101,7 +1121,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", body=await async_maybe_transform( { "image_id": image_id, @@ -1185,7 +1207,9 @@ async def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=await async_maybe_transform( { "name": name, @@ -1267,7 +1291,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", page=AsyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -1336,7 +1362,9 @@ async def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1393,7 +1421,9 @@ async def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=await async_maybe_transform( { "instance_id": instance_id, @@ -1450,7 +1480,9 @@ async def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=await async_maybe_transform( {"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams ), @@ -1501,7 +1533,9 @@ async def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=await async_maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -1549,7 +1583,9 @@ async def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1599,7 +1635,9 @@ async def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=await async_maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1648,7 +1686,9 @@ async def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py index 3e6485d0..612cd629 100644 --- a/src/gcore/resources/dns/dns.py +++ b/src/gcore/resources/dns/dns.py @@ -104,7 +104,9 @@ def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return self._get( - "/dns/v2/platform/info", + "/dns/v2/platform/info" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -141,7 +143,7 @@ def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/lookup", + "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -207,7 +209,9 @@ async def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return await self._get( - "/dns/v2/platform/info", + "/dns/v2/platform/info" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +248,7 @@ async def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/lookup", + "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/locations.py b/src/gcore/resources/dns/locations.py index 20dcea5a..c58907a8 100644 --- a/src/gcore/resources/dns/locations.py +++ b/src/gcore/resources/dns/locations.py @@ -54,7 +54,7 @@ def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return self._get( - "/dns/v2/locations", + "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -73,7 +73,9 @@ def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return self._get( - "/dns/v2/locations/continents", + "/dns/v2/locations/continents" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -92,7 +94,9 @@ def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return self._get( - "/dns/v2/locations/countries", + "/dns/v2/locations/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -111,7 +115,9 @@ def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return self._get( - "/dns/v2/locations/regions", + "/dns/v2/locations/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -151,7 +157,7 @@ async def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return await self._get( - "/dns/v2/locations", + "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -170,7 +176,9 @@ async def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return await self._get( - "/dns/v2/locations/continents", + "/dns/v2/locations/continents" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -189,7 +197,9 @@ async def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return await self._get( - "/dns/v2/locations/countries", + "/dns/v2/locations/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -208,7 +218,9 @@ async def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return await self._get( - "/dns/v2/locations/regions", + "/dns/v2/locations/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index ca9b754a..53764f64 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -82,7 +82,9 @@ def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return self._get( - "/dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -160,7 +162,9 @@ async def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return await self._get( - "/dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/pickers/pickers.py b/src/gcore/resources/dns/pickers/pickers.py index 3078c7f2..599a2450 100644 --- a/src/gcore/resources/dns/pickers/pickers.py +++ b/src/gcore/resources/dns/pickers/pickers.py @@ -63,7 +63,7 @@ def list( ) -> PickerListResponse: """Returns list of picker""" return self._get( - "/dns/v2/pickers", + "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -107,7 +107,7 @@ async def list( ) -> PickerListResponse: """Returns list of picker""" return await self._get( - "/dns/v2/pickers", + "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/pickers/presets.py b/src/gcore/resources/dns/pickers/presets.py index aebd10ff..09f7d53b 100644 --- a/src/gcore/resources/dns/pickers/presets.py +++ b/src/gcore/resources/dns/pickers/presets.py @@ -51,7 +51,9 @@ def list( ) -> PresetListResponse: """Returns list of picker preset""" return self._get( - "/dns/v2/pickers/presets", + "/dns/v2/pickers/presets" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -91,7 +93,9 @@ async def list( ) -> PresetListResponse: """Returns list of picker preset""" return await self._get( - "/dns/v2/pickers/presets", + "/dns/v2/pickers/presets" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/dnssec.py b/src/gcore/resources/dns/zones/dnssec.py index 8c747071..8f283155 100644 --- a/src/gcore/resources/dns/zones/dnssec.py +++ b/src/gcore/resources/dns/zones/dnssec.py @@ -69,7 +69,9 @@ def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", body=maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -103,7 +105,9 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -158,7 +162,9 @@ async def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", body=await async_maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -192,7 +198,9 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index 01bc0728..74c966e0 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -205,7 +205,9 @@ def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -263,7 +265,9 @@ def update( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -317,7 +321,9 @@ def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -368,7 +374,9 @@ def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -407,7 +415,9 @@ def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -452,7 +462,9 @@ def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -644,7 +656,9 @@ async def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, @@ -702,7 +716,9 @@ async def update( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, @@ -756,7 +772,9 @@ async def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -807,7 +825,9 @@ async def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -846,7 +866,9 @@ async def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -891,7 +913,9 @@ async def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index bdc41acc..fa37f45e 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -143,7 +143,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", body=maybe_transform( { "name": name, @@ -230,7 +230,9 @@ def update( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return self._put( - f"/dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{path_name}", body=maybe_transform( { "body_name": body_name, @@ -312,7 +314,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -370,7 +372,9 @@ def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._delete( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -405,7 +409,9 @@ def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._post( - f"/dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -438,7 +444,9 @@ def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -471,7 +479,9 @@ def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -504,7 +514,9 @@ def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -537,7 +549,9 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -604,7 +618,9 @@ def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -670,7 +686,9 @@ def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._post( - f"/dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", body=maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -769,7 +787,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", body=await async_maybe_transform( { "name": name, @@ -856,7 +874,9 @@ async def update( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return await self._put( - f"/dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{path_name}", body=await async_maybe_transform( { "body_name": body_name, @@ -938,7 +958,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -996,7 +1016,9 @@ async def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._delete( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1031,7 +1053,9 @@ async def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._post( - f"/dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1064,7 +1088,9 @@ async def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1097,7 +1123,9 @@ async def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1130,7 +1158,9 @@ async def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1163,7 +1193,9 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1230,7 +1262,9 @@ async def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1296,7 +1330,9 @@ async def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", body=await async_maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index 92d2662a..a72cd50f 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -121,7 +121,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", body=maybe_transform( { "binary": binary, @@ -208,7 +208,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=maybe_transform( { "binary": binary, @@ -305,7 +307,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", page=SyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -355,7 +357,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -386,7 +390,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -418,7 +424,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -514,7 +522,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", body=await async_maybe_transform( { "binary": binary, @@ -601,7 +609,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=await async_maybe_transform( { "binary": binary, @@ -698,7 +708,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", page=AsyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -748,7 +758,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -779,7 +791,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -811,7 +825,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=await async_maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py index f43d121c..b61bcfd9 100644 --- a/src/gcore/resources/fastedge/apps/logs.py +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -94,7 +94,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", page=SyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, @@ -187,7 +189,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", page=AsyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index 8323efb1..bdda5fd9 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -67,7 +67,9 @@ def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return self._post( - "/fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries/raw", body=read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -87,7 +89,9 @@ def list( ) -> BinaryListResponse: """List binaries""" return self._get( - "/fastedge/v1/binaries", + "/fastedge/v1/binaries" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +123,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -150,7 +156,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,7 +211,9 @@ async def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return await self._post( - "/fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries/raw", body=await async_read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -223,7 +233,9 @@ async def list( ) -> BinaryListResponse: """List binaries""" return await self._get( - "/fastedge/v1/binaries", + "/fastedge/v1/binaries" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -255,7 +267,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -286,7 +300,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/fastedge.py b/src/gcore/resources/fastedge/fastedge.py index 9b052788..e52b5216 100644 --- a/src/gcore/resources/fastedge/fastedge.py +++ b/src/gcore/resources/fastedge/fastedge.py @@ -123,7 +123,7 @@ def get_account_overview( ) -> Client: """Get status and limits for the client""" return self._get( - "/fastedge/v1/me", + "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +187,7 @@ async def get_account_overview( ) -> Client: """Get status and limits for the client""" return await self._get( - "/fastedge/v1/me", + "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py index cb007bbc..17cd738d 100644 --- a/src/gcore/resources/fastedge/kv_stores.py +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -72,7 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", body=maybe_transform( { "byod": byod, @@ -112,7 +112,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -148,7 +148,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -179,7 +181,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,7 +220,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", body=maybe_transform( { "byod": byod, @@ -280,7 +286,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", body=await async_maybe_transform( { "byod": byod, @@ -320,7 +326,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -356,7 +362,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,7 +395,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,7 +434,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", body=await async_maybe_transform( { "byod": byod, diff --git a/src/gcore/resources/fastedge/secrets.py b/src/gcore/resources/fastedge/secrets.py index 8b1e97e2..beee5a6a 100644 --- a/src/gcore/resources/fastedge/secrets.py +++ b/src/gcore/resources/fastedge/secrets.py @@ -83,7 +83,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", body=maybe_transform( { "name": name, @@ -131,7 +133,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=maybe_transform( { "comment": comment, @@ -175,7 +179,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -220,7 +226,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -255,7 +263,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -295,7 +305,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=maybe_transform( { "name": name, @@ -363,7 +375,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", body=await async_maybe_transform( { "name": name, @@ -411,7 +425,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "comment": comment, @@ -455,7 +471,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -500,7 +518,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -535,7 +555,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -575,7 +597,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/fastedge/statistics.py b/src/gcore/resources/fastedge/statistics.py index 1958aafc..9bc2a7ba 100644 --- a/src/gcore/resources/fastedge/statistics.py +++ b/src/gcore/resources/fastedge/statistics.py @@ -83,7 +83,9 @@ def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -141,7 +143,9 @@ def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -220,7 +224,9 @@ async def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -278,7 +284,9 @@ async def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/fastedge/templates.py b/src/gcore/resources/fastedge/templates.py index a39e2757..78413275 100644 --- a/src/gcore/resources/fastedge/templates.py +++ b/src/gcore/resources/fastedge/templates.py @@ -93,7 +93,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", body=maybe_transform( { "binary_id": binary_id, @@ -149,7 +151,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", page=SyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -197,7 +201,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -232,7 +238,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,7 +289,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", body=maybe_transform( { "binary_id": binary_id, @@ -361,7 +371,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", body=await async_maybe_transform( { "binary_id": binary_id, @@ -417,7 +429,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", page=AsyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -465,7 +479,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -500,7 +516,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -549,7 +567,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", body=await async_maybe_transform( { "binary_id": binary_id, diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index ecd59cb6..8e771ad5 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -80,7 +80,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", body=maybe_transform( { "client_user": client_user, @@ -147,7 +149,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -196,7 +200,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,7 +234,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -293,7 +301,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", body=await async_maybe_transform( { "client_user": client_user, @@ -360,7 +370,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -409,7 +421,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +455,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/iam.py b/src/gcore/resources/iam/iam.py index 54b4653f..e6fb22d8 100644 --- a/src/gcore/resources/iam/iam.py +++ b/src/gcore/resources/iam/iam.py @@ -75,7 +75,7 @@ def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return self._get( - "/iam/clients/me", + "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +123,7 @@ async def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return await self._get( - "/iam/clients/me", + "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index a27021c1..5f0cf949 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -101,7 +101,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", body=maybe_transform( { "auth_types": auth_types, @@ -152,7 +154,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users", + "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", page=SyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -198,7 +200,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -229,7 +233,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -275,7 +281,9 @@ def invite( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/iam/clients/invite_user", + "/iam/clients/invite_user" + if self._client._base_url_overridden + else "https://api.gcore.com//iam/clients/invite_user", body=maybe_transform( { "client_id": client_id, @@ -366,7 +374,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", body=await async_maybe_transform( { "auth_types": auth_types, @@ -417,7 +427,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users", + "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", page=AsyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -463,7 +473,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -494,7 +506,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -540,7 +554,9 @@ async def invite( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/iam/clients/invite_user", + "/iam/clients/invite_user" + if self._client._base_url_overridden + else "https://api.gcore.com//iam/clients/invite_user", body=await async_maybe_transform( { "client_id": client_id, diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index 43947fab..fdbb1d33 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -74,7 +74,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -122,7 +124,9 @@ def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", body=maybe_transform( { "announce": announce, @@ -191,7 +195,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -239,7 +245,9 @@ async def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", body=await async_maybe_transform( { "announce": announce, diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py index 86d387bb..98c34908 100644 --- a/src/gcore/resources/security/events.py +++ b/src/gcore/resources/security/events.py @@ -88,7 +88,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs" + if self._client._base_url_overridden + else "https://api.gcore.com//security/notifier/v1/event_logs", page=SyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs" + if self._client._base_url_overridden + else "https://api.gcore.com//security/notifier/v1/event_logs", page=AsyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py index 85b84ad8..79719fd7 100644 --- a/src/gcore/resources/security/profile_templates.py +++ b/src/gcore/resources/security/profile_templates.py @@ -55,7 +55,9 @@ def list( profile. Client receives only common and created for him profile templates. """ return self._get( - "/security/iaas/profile-templates", + "/security/iaas/profile-templates" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -99,7 +101,9 @@ async def list( profile. Client receives only common and created for him profile templates. """ return await self._get( - "/security/iaas/profile-templates", + "/security/iaas/profile-templates" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index 16668afa..b3cd1183 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -78,7 +78,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", body=maybe_transform( { "fields": fields, @@ -122,7 +124,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -168,7 +172,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +205,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -234,7 +242,9 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", body=maybe_transform( { "fields": fields, @@ -280,7 +290,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", body=maybe_transform( { "fields": fields, @@ -346,7 +358,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", body=await async_maybe_transform( { "fields": fields, @@ -390,7 +404,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -436,7 +452,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,7 +485,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -502,7 +522,9 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", body=await async_maybe_transform( { "fields": fields, @@ -548,7 +570,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", body=await async_maybe_transform( { "fields": fields, diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 0b63144c..02cb29a4 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -319,7 +319,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", body=maybe_transform( { "task_name": task_name, @@ -400,7 +400,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", page=SyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -451,7 +451,9 @@ def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -518,7 +520,9 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -590,7 +594,7 @@ def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/ai/info", + "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -900,7 +904,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", body=await async_maybe_transform( { "task_name": task_name, @@ -981,7 +985,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", page=AsyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -1032,7 +1036,9 @@ async def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1099,7 +1105,9 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1171,7 +1179,7 @@ async def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/ai/info", + "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index d8ef434b..9461d5b2 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -76,7 +76,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", body=maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,7 +111,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", body=maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -146,7 +150,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", page=SyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -183,7 +189,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -214,7 +222,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -245,7 +255,9 @@ def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -306,7 +318,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -339,7 +353,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -376,7 +392,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", page=AsyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -413,7 +431,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -444,7 +464,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -475,7 +497,9 @@ async def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 438d9de8..345cfc7a 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -72,7 +72,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/directories", + "/streaming/directories" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories", body=maybe_transform( { "name": name, @@ -117,7 +119,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", body=maybe_transform( { "name": name, @@ -163,7 +167,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -196,7 +202,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -219,7 +227,9 @@ def get_tree( directories in video hosting. """ return self._get( - "/streaming/directories/tree", + "/streaming/directories/tree" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,7 +286,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/directories", + "/streaming/directories" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories", body=await async_maybe_transform( { "name": name, @@ -321,7 +333,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", body=await async_maybe_transform( { "name": name, @@ -367,7 +381,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -400,7 +416,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -423,7 +441,9 @@ async def get_tree( directories in video hosting. """ return await self._get( - "/streaming/directories/tree", + "/streaming/directories/tree" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/players.py b/src/gcore/resources/streaming/players.py index 826e015a..942e32b9 100644 --- a/src/gcore/resources/streaming/players.py +++ b/src/gcore/resources/streaming/players.py @@ -72,7 +72,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", body=maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,7 +109,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", body=maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -144,7 +146,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", page=SyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -181,7 +183,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -212,7 +216,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +250,9 @@ def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - f"/streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,7 +309,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", body=await async_maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -338,7 +346,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", body=await async_maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -373,7 +383,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", page=AsyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -410,7 +420,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +453,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,7 +487,9 @@ async def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - f"/streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index fba76526..c9b9c691 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -204,7 +204,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", body=maybe_transform( { "active": active, @@ -335,7 +337,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", body=maybe_transform( { "active": active, @@ -388,7 +392,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", page=SyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -425,7 +431,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -456,7 +464,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -487,7 +497,9 @@ def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -672,7 +684,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", body=await async_maybe_transform( { "active": active, @@ -803,7 +817,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", body=await async_maybe_transform( { "active": active, @@ -856,7 +872,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", page=AsyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -893,7 +911,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -924,7 +944,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -955,7 +977,9 @@ async def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index 80e051f3..1e44d42a 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -91,7 +91,9 @@ def list( is a paid feature. """ return self._get( - "/streaming/quality_sets", + "/streaming/quality_sets" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -137,7 +139,9 @@ def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - "/streaming/quality_sets/default", + "/streaming/quality_sets/default" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets/default", body=maybe_transform( { "live": live, @@ -222,7 +226,9 @@ async def list( is a paid feature. """ return await self._get( - "/streaming/quality_sets", + "/streaming/quality_sets" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -268,7 +274,9 @@ async def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - "/streaming/quality_sets/default", + "/streaming/quality_sets/default" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets/default", body=await async_maybe_transform( { "live": live, diff --git a/src/gcore/resources/streaming/restreams.py b/src/gcore/resources/streaming/restreams.py index 78880ed4..1d703166 100644 --- a/src/gcore/resources/streaming/restreams.py +++ b/src/gcore/resources/streaming/restreams.py @@ -67,7 +67,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", body=maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -100,7 +102,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", body=maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -135,7 +139,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", page=SyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -172,7 +178,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,7 +211,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -256,7 +266,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", body=await async_maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -289,7 +301,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", body=await async_maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -324,7 +338,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", page=AsyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -361,7 +377,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +410,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 4e8cb182..2b5e440d 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -123,7 +123,9 @@ def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -188,7 +190,9 @@ def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -254,7 +258,9 @@ def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -315,7 +321,9 @@ def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -368,7 +376,9 @@ def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/max_stream", + "/streaming/statistics/max_stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -421,7 +431,9 @@ def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/popular", + "/streaming/statistics/popular" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -472,7 +484,9 @@ def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/storage", + "/streaming/statistics/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -524,7 +538,9 @@ def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream", + "/streaming/statistics/stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -597,7 +613,9 @@ def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/uniqs", + "/streaming/statistics/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -684,7 +702,9 @@ def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -758,7 +778,9 @@ def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/views", + "/streaming/statistics/views" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -815,7 +837,9 @@ def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/browsers", + "/streaming/statistics/browsers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -866,7 +890,9 @@ def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/countries", + "/streaming/statistics/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -917,7 +943,9 @@ def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/hosts", + "/streaming/statistics/hosts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -968,7 +996,9 @@ def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/systems", + "/streaming/statistics/systems" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1019,7 +1049,9 @@ def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/embeds", + "/streaming/statistics/embeds" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1070,7 +1102,9 @@ def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/regions", + "/streaming/statistics/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1130,7 +1164,9 @@ def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/heatmap", + "/streaming/statistics/heatmap" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1180,7 +1216,9 @@ def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1228,7 +1266,9 @@ def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1289,7 +1329,9 @@ def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1355,7 +1397,9 @@ def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1416,7 +1460,9 @@ def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1493,7 +1539,9 @@ async def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1558,7 +1606,9 @@ async def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1624,7 +1674,9 @@ async def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1685,7 +1737,9 @@ async def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1738,7 +1792,9 @@ async def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/max_stream", + "/streaming/statistics/max_stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1791,7 +1847,9 @@ async def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/popular", + "/streaming/statistics/popular" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1842,7 +1900,9 @@ async def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/storage", + "/streaming/statistics/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1894,7 +1954,9 @@ async def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream", + "/streaming/statistics/stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1967,7 +2029,9 @@ async def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/uniqs", + "/streaming/statistics/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2054,7 +2118,9 @@ async def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2128,7 +2194,9 @@ async def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/views", + "/streaming/statistics/views" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2185,7 +2253,9 @@ async def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/browsers", + "/streaming/statistics/browsers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2236,7 +2306,9 @@ async def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/countries", + "/streaming/statistics/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2287,7 +2359,9 @@ async def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/hosts", + "/streaming/statistics/hosts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2338,7 +2412,9 @@ async def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/systems", + "/streaming/statistics/systems" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2389,7 +2465,9 @@ async def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/embeds", + "/streaming/statistics/embeds" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2440,7 +2518,9 @@ async def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/regions", + "/streaming/statistics/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2500,7 +2580,9 @@ async def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/heatmap", + "/streaming/statistics/heatmap" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2550,7 +2632,9 @@ async def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2598,7 +2682,9 @@ async def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2659,7 +2745,9 @@ async def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2725,7 +2813,9 @@ async def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2786,7 +2876,9 @@ async def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index f52cfee4..58dfaf62 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -123,7 +123,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -175,7 +177,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", body=maybe_transform( { "height": height, @@ -217,7 +221,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,7 +256,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -282,7 +290,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -314,7 +324,9 @@ def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -420,7 +432,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -472,7 +486,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", body=await async_maybe_transform( { "height": height, @@ -514,7 +530,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,7 +565,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -579,7 +599,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -611,7 +633,9 @@ async def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index e2006722..53784a3a 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -244,7 +244,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", body=maybe_transform( { "name": name, @@ -298,7 +298,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", body=maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -337,7 +339,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", page=SyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -396,7 +398,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -428,7 +432,9 @@ def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -536,7 +542,9 @@ def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", body=maybe_transform( { "duration": duration, @@ -576,7 +584,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -625,7 +635,9 @@ def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -693,7 +705,9 @@ def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -730,7 +744,9 @@ def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -940,7 +956,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", body=await async_maybe_transform( { "name": name, @@ -994,7 +1010,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", body=await async_maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1033,7 +1051,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", page=AsyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -1092,7 +1110,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1124,7 +1144,9 @@ async def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1232,7 +1254,9 @@ async def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", body=await async_maybe_transform( { "duration": duration, @@ -1272,7 +1296,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1321,7 +1347,9 @@ async def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1389,7 +1417,9 @@ async def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1426,7 +1456,9 @@ async def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 4e59615e..165594a4 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -120,7 +120,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", body=maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -170,7 +172,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", body=maybe_transform( { "language": language, @@ -209,7 +213,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,7 +248,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -274,7 +282,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -379,7 +389,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", body=await async_maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -429,7 +441,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", body=await async_maybe_transform( { "language": language, @@ -468,7 +482,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -501,7 +517,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -533,7 +551,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index c77320db..3b1cfbef 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -148,7 +148,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", body=maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -371,7 +371,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", body=maybe_transform( { "name": name, @@ -467,7 +469,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", page=SyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -524,7 +526,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -575,7 +579,9 @@ def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos/batch", + "/streaming/videos/batch" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/batch", body=maybe_transform({"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, @@ -625,7 +631,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -685,7 +693,9 @@ def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -719,7 +729,9 @@ def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - "/streaming/videos/names", + "/streaming/videos/names" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -836,7 +848,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", body=await async_maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1059,7 +1071,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", body=await async_maybe_transform( { "name": name, @@ -1155,7 +1169,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", page=AsyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -1212,7 +1226,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1263,7 +1279,9 @@ async def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos/batch", + "/streaming/videos/batch" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/batch", body=await async_maybe_transform( {"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams ), @@ -1317,7 +1335,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1377,7 +1397,9 @@ async def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1411,7 +1433,9 @@ async def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - "/streaming/videos/names", + "/streaming/videos/names" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py index 30c32c1c..96f15cca 100644 --- a/src/gcore/resources/waap/advanced_rules.py +++ b/src/gcore/resources/waap/advanced_rules.py @@ -51,7 +51,9 @@ def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return self._get( - "/waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -91,7 +93,9 @@ async def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return await self._get( - "/waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index 7ce6dca4..9be46769 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -88,7 +88,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", body=maybe_transform( { "name": name, @@ -152,7 +154,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", body=maybe_transform( { "block": block, @@ -210,7 +214,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", page=SyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -258,7 +264,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -291,7 +299,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -349,7 +359,9 @@ def preview( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/preview-custom-page", body=maybe_transform( { "error": error, @@ -430,7 +442,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", body=await async_maybe_transform( { "name": name, @@ -494,7 +508,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", body=await async_maybe_transform( { "block": block, @@ -552,7 +568,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", page=AsyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -600,7 +618,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -633,7 +653,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -691,7 +713,9 @@ async def preview( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/preview-custom-page", body=await async_maybe_transform( { "error": error, diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index e22a838f..6afde6d6 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -97,7 +97,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", body=maybe_transform( { "action": action, @@ -171,7 +173,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -261,7 +265,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", page=SyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -315,7 +321,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -351,7 +359,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -393,7 +403,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,7 +485,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", body=await async_maybe_transform( { "action": action, @@ -547,7 +561,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -637,7 +653,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", page=AsyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -691,7 +709,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -727,7 +747,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -769,7 +791,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py index 6b1f7896..ccd8a883 100644 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -82,7 +82,9 @@ def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -115,7 +117,9 @@ def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -180,7 +184,9 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", page=SyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -231,7 +237,9 @@ def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,7 +289,9 @@ def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", body=maybe_transform( { "description_file_location": description_file_location, @@ -334,7 +344,9 @@ def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", body=maybe_transform( { "file_data": file_data, @@ -400,7 +412,9 @@ async def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -433,7 +447,9 @@ async def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -498,7 +514,9 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", page=AsyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -549,7 +567,9 @@ async def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -599,7 +619,9 @@ async def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", body=await async_maybe_transform( { "description_file_location": description_file_location, @@ -652,7 +674,9 @@ async def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", body=await async_maybe_transform( { "file_data": file_data, diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py index 3e66ea27..cf0c40e5 100644 --- a/src/gcore/resources/waap/domains/api_path_groups.py +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -65,7 +65,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +121,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index 5e227404..028c8e14 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -90,7 +90,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", body=maybe_transform( { "http_scheme": http_scheme, @@ -153,7 +155,9 @@ def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", body=maybe_transform( { "api_groups": api_groups, @@ -250,7 +254,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", page=SyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -309,7 +315,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -347,7 +355,9 @@ def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -420,7 +430,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", body=await async_maybe_transform( { "http_scheme": http_scheme, @@ -483,7 +495,9 @@ async def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", body=await async_maybe_transform( { "api_groups": api_groups, @@ -580,7 +594,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", page=AsyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -639,7 +655,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -677,7 +695,9 @@ async def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index f175a192..adc81b2b 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -92,7 +92,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", body=maybe_transform( { "action": action, @@ -155,7 +157,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -225,7 +229,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", page=SyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -278,7 +284,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -315,7 +323,9 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -354,7 +364,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -396,7 +408,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -466,7 +480,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", body=await async_maybe_transform( { "action": action, @@ -529,7 +545,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -599,7 +617,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", page=AsyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -652,7 +672,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -689,7 +711,9 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -728,7 +752,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -770,7 +796,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index cf4135cc..6e0e3bac 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -198,7 +198,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", body=maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -248,7 +250,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains", + "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", page=SyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -299,7 +301,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -332,7 +336,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -365,7 +371,9 @@ def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -403,7 +411,9 @@ def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -501,7 +511,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", body=await async_maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -551,7 +563,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains", + "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", page=AsyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -602,7 +614,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -635,7 +649,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -668,7 +684,9 @@ async def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -706,7 +724,9 @@ async def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index b8600359..bf624cf0 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -91,7 +91,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", body=maybe_transform( { "action": action, @@ -153,7 +155,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -223,7 +227,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", page=SyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -276,7 +282,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -313,7 +321,9 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -352,7 +362,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +406,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -463,7 +477,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", body=await async_maybe_transform( { "action": action, @@ -525,7 +541,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -595,7 +613,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", page=AsyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -648,7 +668,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -685,7 +707,9 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -724,7 +748,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -766,7 +792,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 151e3d04..94496352 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -93,7 +93,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", body=maybe_transform( { "author": author, @@ -153,7 +155,9 @@ def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=maybe_transform( { "author": author, @@ -228,7 +232,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", page=SyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -283,7 +289,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -321,7 +329,9 @@ def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +402,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", body=await async_maybe_transform( { "author": author, @@ -452,7 +464,9 @@ async def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=await async_maybe_transform( { "author": author, @@ -527,7 +541,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", page=AsyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -582,7 +598,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -620,7 +638,9 @@ async def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 40fa6d8b..233d5b57 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -106,7 +106,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", page=SyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -158,7 +160,9 @@ def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +203,9 @@ def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", body=maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -289,7 +295,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", page=AsyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -341,7 +349,9 @@ async def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,7 +392,9 @@ async def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", body=await async_maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py index fc9cafbf..17c719c1 100644 --- a/src/gcore/resources/waap/domains/settings.py +++ b/src/gcore/resources/waap/domains/settings.py @@ -74,7 +74,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", body=maybe_transform( { "api": api, @@ -114,7 +116,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -175,7 +179,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", body=await async_maybe_transform( { "api": api, @@ -215,7 +221,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index 6031bdfd..901b0b92 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -98,7 +98,9 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", page=SyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -161,7 +163,9 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", page=SyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -227,7 +231,9 @@ def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -280,7 +286,9 @@ def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -374,7 +382,9 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", page=SyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -440,7 +450,9 @@ def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -520,7 +532,9 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", page=AsyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -583,7 +597,9 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", page=AsyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -649,7 +665,9 @@ async def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -702,7 +720,9 @@ async def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -796,7 +816,9 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", page=AsyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -862,7 +884,9 @@ async def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index e056e67a..0634ffef 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -88,7 +88,9 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types", + "/waap/v1/security-insights/types" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/security-insights/types", page=SyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types", + "/waap/v1/security-insights/types" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/security-insights/types", page=AsyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/ip_info/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py index 7d4d5f1b..12c7beb8 100644 --- a/src/gcore/resources/waap/ip_info/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -95,7 +95,9 @@ def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -142,7 +144,9 @@ def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -189,7 +193,9 @@ def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -229,7 +235,9 @@ def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -274,7 +282,9 @@ def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -323,7 +333,9 @@ def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -372,7 +384,9 @@ def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -415,7 +429,9 @@ def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -479,7 +495,9 @@ async def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -526,7 +544,9 @@ async def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -573,7 +593,9 @@ async def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -613,7 +635,9 @@ async def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -658,7 +682,9 @@ async def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -707,7 +733,9 @@ async def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -756,7 +784,9 @@ async def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -799,7 +829,9 @@ async def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/ip_info/metrics.py b/src/gcore/resources/waap/ip_info/metrics.py index c70d3faa..32f17c80 100644 --- a/src/gcore/resources/waap/ip_info/metrics.py +++ b/src/gcore/resources/waap/ip_info/metrics.py @@ -77,7 +77,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -149,7 +151,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py index f36dcb35..ffe33962 100644 --- a/src/gcore/resources/waap/organizations.py +++ b/src/gcore/resources/waap/organizations.py @@ -82,7 +82,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations", + "/waap/v1/organizations" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/organizations", page=SyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, @@ -160,7 +162,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations", + "/waap/v1/organizations" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/organizations", page=AsyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py index f8258bab..5f64899e 100644 --- a/src/gcore/resources/waap/statistics.py +++ b/src/gcore/resources/waap/statistics.py @@ -87,7 +87,9 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/statistics/series", + "/waap/v1/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -169,7 +171,9 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/statistics/series", + "/waap/v1/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py index df171560..f2ced3d7 100644 --- a/src/gcore/resources/waap/tags.py +++ b/src/gcore/resources/waap/tags.py @@ -88,7 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags", + "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", page=SyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags", + "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", page=AsyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index 3d68c41f..4f621d4e 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -147,7 +147,7 @@ def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return self._get( - "/waap/v1/clients/me", + "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -219,7 +219,7 @@ async def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return await self._get( - "/waap/v1/clients/me", + "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/types/cloud/baremetal/server_rebuild_params.py b/src/gcore/types/cloud/baremetal/server_rebuild_params.py index 5a6e2be6..9addcb49 100644 --- a/src/gcore/types/cloud/baremetal/server_rebuild_params.py +++ b/src/gcore/types/cloud/baremetal/server_rebuild_params.py @@ -9,8 +9,10 @@ class ServerRebuildParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" image_id: str """Image ID""" diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index db10a5ea..355896d0 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -164,18 +164,18 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_rebuild(self, client: Gcore) -> None: server = client.cloud.baremetal.servers.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, server, path=["response"]) @parametrize def test_method_rebuild_with_all_params(self, client: Gcore) -> None: server = client.cloud.baremetal.servers.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", user_data="aGVsbG9fd29ybGQ=", ) @@ -184,9 +184,9 @@ def test_method_rebuild_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_rebuild(self, client: Gcore) -> None: response = client.cloud.baremetal.servers.with_raw_response.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -197,9 +197,9 @@ def test_raw_response_rebuild(self, client: Gcore) -> None: @parametrize def test_streaming_response_rebuild(self, client: Gcore) -> None: with client.cloud.baremetal.servers.with_streaming_response.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -214,8 +214,8 @@ def test_path_params_rebuild(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): client.cloud.baremetal.servers.with_raw_response.rebuild( server_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @@ -368,18 +368,18 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_rebuild(self, async_client: AsyncGcore) -> None: server = await async_client.cloud.baremetal.servers.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, server, path=["response"]) @parametrize async def test_method_rebuild_with_all_params(self, async_client: AsyncGcore) -> None: server = await async_client.cloud.baremetal.servers.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", user_data="aGVsbG9fd29ybGQ=", ) @@ -388,9 +388,9 @@ async def test_method_rebuild_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_rebuild(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.baremetal.servers.with_raw_response.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -401,9 +401,9 @@ async def test_raw_response_rebuild(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_rebuild(self, async_client: AsyncGcore) -> None: async with async_client.cloud.baremetal.servers.with_streaming_response.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -418,6 +418,6 @@ async def test_path_params_rebuild(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): await async_client.cloud.baremetal.servers.with_raw_response.rebuild( server_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) From e61e402c5a08fc41bb0fd2ca8bbcb45c03d13079 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 29 Aug 2025 12:01:28 +0000 Subject: [PATCH 272/592] feat(cloud): add managed k8s --- .stats.yml | 4 +- api.md | 74 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + src/gcore/resources/cloud/k8s/__init__.py | 47 + .../resources/cloud/k8s/clusters/__init__.py | 47 + .../resources/cloud/k8s/clusters/clusters.py | 1427 +++++++++++++++++ .../resources/cloud/k8s/clusters/nodes.py | 299 ++++ .../cloud/k8s/clusters/pools/__init__.py | 33 + .../cloud/k8s/clusters/pools/nodes.py | 311 ++++ .../cloud/k8s/clusters/pools/pools.py | 894 +++++++++++ src/gcore/resources/cloud/k8s/flavors.py | 213 +++ src/gcore/resources/cloud/k8s/k8s.py | 237 +++ src/gcore/types/cloud/__init__.py | 2 + src/gcore/types/cloud/k8s/__init__.py | 13 + .../types/cloud/k8s/cluster_create_params.py | 299 ++++ .../types/cloud/k8s/cluster_delete_params.py | 16 + .../types/cloud/k8s/cluster_update_params.py | 203 +++ .../types/cloud/k8s/cluster_upgrade_params.py | 16 + .../types/cloud/k8s/clusters/__init__.py | 10 + .../cloud/k8s/clusters/k8s_cluster_pool.py | 66 + .../k8s/clusters/k8s_cluster_pool_list.py | 16 + .../cloud/k8s/clusters/node_list_params.py | 16 + .../cloud/k8s/clusters/pool_create_params.py | 53 + .../cloud/k8s/clusters/pool_resize_params.py | 18 + .../cloud/k8s/clusters/pool_update_params.py | 34 + .../cloud/k8s/clusters/pools/__init__.py | 5 + .../k8s/clusters/pools/node_list_params.py | 18 + .../types/cloud/k8s/flavor_list_params.py | 19 + src/gcore/types/cloud/k8s/k8s_cluster.py | 209 +++ .../cloud/k8s/k8s_cluster_certificate.py | 13 + .../types/cloud/k8s/k8s_cluster_kubeconfig.py | 19 + src/gcore/types/cloud/k8s/k8s_cluster_list.py | 16 + src/gcore/types/cloud/k8s_cluster_version.py | 10 + .../types/cloud/k8s_cluster_version_list.py | 16 + tests/api_resources/cloud/k8s/__init__.py | 1 + .../cloud/k8s/clusters/__init__.py | 1 + .../cloud/k8s/clusters/pools/__init__.py | 1 + .../cloud/k8s/clusters/pools/test_nodes.py | 306 ++++ .../cloud/k8s/clusters/test_nodes.py | 252 +++ .../cloud/k8s/clusters/test_pools.py | 786 +++++++++ .../api_resources/cloud/k8s/test_clusters.py | 1168 ++++++++++++++ tests/api_resources/cloud/k8s/test_flavors.py | 112 ++ tests/api_resources/cloud/test_k8s.py | 92 ++ 44 files changed, 7436 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/k8s/__init__.py create mode 100644 src/gcore/resources/cloud/k8s/clusters/__init__.py create mode 100644 src/gcore/resources/cloud/k8s/clusters/clusters.py create mode 100644 src/gcore/resources/cloud/k8s/clusters/nodes.py create mode 100644 src/gcore/resources/cloud/k8s/clusters/pools/__init__.py create mode 100644 src/gcore/resources/cloud/k8s/clusters/pools/nodes.py create mode 100644 src/gcore/resources/cloud/k8s/clusters/pools/pools.py create mode 100644 src/gcore/resources/cloud/k8s/flavors.py create mode 100644 src/gcore/resources/cloud/k8s/k8s.py create mode 100644 src/gcore/types/cloud/k8s/__init__.py create mode 100644 src/gcore/types/cloud/k8s/cluster_create_params.py create mode 100644 src/gcore/types/cloud/k8s/cluster_delete_params.py create mode 100644 src/gcore/types/cloud/k8s/cluster_update_params.py create mode 100644 src/gcore/types/cloud/k8s/cluster_upgrade_params.py create mode 100644 src/gcore/types/cloud/k8s/clusters/__init__.py create mode 100644 src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool.py create mode 100644 src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py create mode 100644 src/gcore/types/cloud/k8s/clusters/node_list_params.py create mode 100644 src/gcore/types/cloud/k8s/clusters/pool_create_params.py create mode 100644 src/gcore/types/cloud/k8s/clusters/pool_resize_params.py create mode 100644 src/gcore/types/cloud/k8s/clusters/pool_update_params.py create mode 100644 src/gcore/types/cloud/k8s/clusters/pools/__init__.py create mode 100644 src/gcore/types/cloud/k8s/clusters/pools/node_list_params.py create mode 100644 src/gcore/types/cloud/k8s/flavor_list_params.py create mode 100644 src/gcore/types/cloud/k8s/k8s_cluster.py create mode 100644 src/gcore/types/cloud/k8s/k8s_cluster_certificate.py create mode 100644 src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py create mode 100644 src/gcore/types/cloud/k8s/k8s_cluster_list.py create mode 100644 src/gcore/types/cloud/k8s_cluster_version.py create mode 100644 src/gcore/types/cloud/k8s_cluster_version_list.py create mode 100644 tests/api_resources/cloud/k8s/__init__.py create mode 100644 tests/api_resources/cloud/k8s/clusters/__init__.py create mode 100644 tests/api_resources/cloud/k8s/clusters/pools/__init__.py create mode 100644 tests/api_resources/cloud/k8s/clusters/pools/test_nodes.py create mode 100644 tests/api_resources/cloud/k8s/clusters/test_nodes.py create mode 100644 tests/api_resources/cloud/k8s/clusters/test_pools.py create mode 100644 tests/api_resources/cloud/k8s/test_clusters.py create mode 100644 tests/api_resources/cloud/k8s/test_flavors.py create mode 100644 tests/api_resources/cloud/test_k8s.py diff --git a/.stats.yml b/.stats.yml index 5f3f505d..2184224a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 480 +configured_endpoints: 501 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1a7494f99877ef48b0e33fb55f803ff97fe3618d2379c345c9393afad72c9e90.yml openapi_spec_hash: 8ae4c37eea00eed48dce435bfe4c69c7 -config_hash: 5601e8aebf3c8606867a46bf79b1fd28 +config_hash: 9d0ce90d14c257c153d93d848144a8da diff --git a/api.md b/api.md index 19e0c15d..cd189332 100644 --- a/api.md +++ b/api.md @@ -892,6 +892,80 @@ Methods: - client.cloud.instances.metrics.list(instance_id, \*, project_id, region_id, \*\*params) -> MetricsList +## K8s + +Types: + +```python +from gcore.types.cloud import K8sClusterVersion, K8sClusterVersionList +``` + +Methods: + +- client.cloud.k8s.list_versions(\*, project_id, region_id) -> K8sClusterVersionList + +### Flavors + +Methods: + +- client.cloud.k8s.flavors.list(\*, project_id, region_id, \*\*params) -> BaremetalFlavorList + +### Clusters + +Types: + +```python +from gcore.types.cloud.k8s import ( + K8sCluster, + K8sClusterCertificate, + K8sClusterKubeconfig, + K8sClusterList, +) +``` + +Methods: + +- client.cloud.k8s.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.k8s.clusters.update(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.k8s.clusters.list(\*, project_id, region_id) -> K8sClusterList +- client.cloud.k8s.clusters.delete(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.k8s.clusters.get(cluster_name, \*, project_id, region_id) -> K8sCluster +- client.cloud.k8s.clusters.get_certificate(cluster_name, \*, project_id, region_id) -> K8sClusterCertificate +- client.cloud.k8s.clusters.get_kubeconfig(cluster_name, \*, project_id, region_id) -> K8sClusterKubeconfig +- client.cloud.k8s.clusters.list_versions_for_upgrade(cluster_name, \*, project_id, region_id) -> K8sClusterVersionList +- client.cloud.k8s.clusters.upgrade(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList + +#### Nodes + +Methods: + +- client.cloud.k8s.clusters.nodes.list(cluster_name, \*, project_id, region_id, \*\*params) -> InstanceList +- client.cloud.k8s.clusters.nodes.delete(instance_id, \*, project_id, region_id, cluster_name) -> None + +#### Pools + +Types: + +```python +from gcore.types.cloud.k8s.clusters import K8sClusterPool, K8sClusterPoolList +``` + +Methods: + +- client.cloud.k8s.clusters.pools.create(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.k8s.clusters.pools.update(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> K8sClusterPool +- client.cloud.k8s.clusters.pools.list(cluster_name, \*, project_id, region_id) -> K8sClusterPoolList +- client.cloud.k8s.clusters.pools.delete(pool_name, \*, project_id, region_id, cluster_name) -> TaskIDList +- client.cloud.k8s.clusters.pools.get(pool_name, \*, project_id, region_id, cluster_name) -> K8sClusterPool +- client.cloud.k8s.clusters.pools.resize(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> TaskIDList + +##### Nodes + +Methods: + +- client.cloud.k8s.clusters.pools.nodes.list(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> InstanceList +- client.cloud.k8s.clusters.pools.nodes.delete(instance_id, \*, project_id, region_id, cluster_name, pool_name) -> None + ## AuditLogs Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index f77715a6..c78945ec 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .k8s import ( + K8sResource, + AsyncK8sResource, + K8sResourceWithRawResponse, + AsyncK8sResourceWithRawResponse, + K8sResourceWithStreamingResponse, + AsyncK8sResourceWithStreamingResponse, +) from .cloud import ( CloudResource, AsyncCloudResource, @@ -342,6 +350,12 @@ "AsyncInstancesResourceWithRawResponse", "InstancesResourceWithStreamingResponse", "AsyncInstancesResourceWithStreamingResponse", + "K8sResource", + "AsyncK8sResource", + "K8sResourceWithRawResponse", + "AsyncK8sResourceWithRawResponse", + "K8sResourceWithStreamingResponse", + "AsyncK8sResourceWithStreamingResponse", "AuditLogsResource", "AsyncAuditLogsResource", "AuditLogsResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 3dc3eb32..bd70d20c 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -10,6 +10,14 @@ TasksResourceWithStreamingResponse, AsyncTasksResourceWithStreamingResponse, ) +from .k8s.k8s import ( + K8sResource, + AsyncK8sResource, + K8sResourceWithRawResponse, + AsyncK8sResourceWithRawResponse, + K8sResourceWithStreamingResponse, + AsyncK8sResourceWithStreamingResponse, +) from .regions import ( RegionsResource, AsyncRegionsResource, @@ -297,6 +305,10 @@ def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResource: def instances(self) -> InstancesResource: return InstancesResource(self._client) + @cached_property + def k8s(self) -> K8sResource: + return K8sResource(self._client) + @cached_property def audit_logs(self) -> AuditLogsResource: return AuditLogsResource(self._client) @@ -418,6 +430,10 @@ def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResource: def instances(self) -> AsyncInstancesResource: return AsyncInstancesResource(self._client) + @cached_property + def k8s(self) -> AsyncK8sResource: + return AsyncK8sResource(self._client) + @cached_property def audit_logs(self) -> AsyncAuditLogsResource: return AsyncAuditLogsResource(self._client) @@ -542,6 +558,10 @@ def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithRawResponse: def instances(self) -> InstancesResourceWithRawResponse: return InstancesResourceWithRawResponse(self._cloud.instances) + @cached_property + def k8s(self) -> K8sResourceWithRawResponse: + return K8sResourceWithRawResponse(self._cloud.k8s) + @cached_property def audit_logs(self) -> AuditLogsResourceWithRawResponse: return AuditLogsResourceWithRawResponse(self._cloud.audit_logs) @@ -647,6 +667,10 @@ def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithRawResp def instances(self) -> AsyncInstancesResourceWithRawResponse: return AsyncInstancesResourceWithRawResponse(self._cloud.instances) + @cached_property + def k8s(self) -> AsyncK8sResourceWithRawResponse: + return AsyncK8sResourceWithRawResponse(self._cloud.k8s) + @cached_property def audit_logs(self) -> AsyncAuditLogsResourceWithRawResponse: return AsyncAuditLogsResourceWithRawResponse(self._cloud.audit_logs) @@ -752,6 +776,10 @@ def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithStreamingRes def instances(self) -> InstancesResourceWithStreamingResponse: return InstancesResourceWithStreamingResponse(self._cloud.instances) + @cached_property + def k8s(self) -> K8sResourceWithStreamingResponse: + return K8sResourceWithStreamingResponse(self._cloud.k8s) + @cached_property def audit_logs(self) -> AuditLogsResourceWithStreamingResponse: return AuditLogsResourceWithStreamingResponse(self._cloud.audit_logs) @@ -857,6 +885,10 @@ def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithStreami def instances(self) -> AsyncInstancesResourceWithStreamingResponse: return AsyncInstancesResourceWithStreamingResponse(self._cloud.instances) + @cached_property + def k8s(self) -> AsyncK8sResourceWithStreamingResponse: + return AsyncK8sResourceWithStreamingResponse(self._cloud.k8s) + @cached_property def audit_logs(self) -> AsyncAuditLogsResourceWithStreamingResponse: return AsyncAuditLogsResourceWithStreamingResponse(self._cloud.audit_logs) diff --git a/src/gcore/resources/cloud/k8s/__init__.py b/src/gcore/resources/cloud/k8s/__init__.py new file mode 100644 index 00000000..6b5f189d --- /dev/null +++ b/src/gcore/resources/cloud/k8s/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .k8s import ( + K8sResource, + AsyncK8sResource, + K8sResourceWithRawResponse, + AsyncK8sResourceWithRawResponse, + K8sResourceWithStreamingResponse, + AsyncK8sResourceWithStreamingResponse, +) +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) + +__all__ = [ + "FlavorsResource", + "AsyncFlavorsResource", + "FlavorsResourceWithRawResponse", + "AsyncFlavorsResourceWithRawResponse", + "FlavorsResourceWithStreamingResponse", + "AsyncFlavorsResourceWithStreamingResponse", + "ClustersResource", + "AsyncClustersResource", + "ClustersResourceWithRawResponse", + "AsyncClustersResourceWithRawResponse", + "ClustersResourceWithStreamingResponse", + "AsyncClustersResourceWithStreamingResponse", + "K8sResource", + "AsyncK8sResource", + "K8sResourceWithRawResponse", + "AsyncK8sResourceWithRawResponse", + "K8sResourceWithStreamingResponse", + "AsyncK8sResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/k8s/clusters/__init__.py b/src/gcore/resources/cloud/k8s/clusters/__init__.py new file mode 100644 index 00000000..3da4e5a1 --- /dev/null +++ b/src/gcore/resources/cloud/k8s/clusters/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .nodes import ( + NodesResource, + AsyncNodesResource, + NodesResourceWithRawResponse, + AsyncNodesResourceWithRawResponse, + NodesResourceWithStreamingResponse, + AsyncNodesResourceWithStreamingResponse, +) +from .pools import ( + PoolsResource, + AsyncPoolsResource, + PoolsResourceWithRawResponse, + AsyncPoolsResourceWithRawResponse, + PoolsResourceWithStreamingResponse, + AsyncPoolsResourceWithStreamingResponse, +) +from .clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) + +__all__ = [ + "NodesResource", + "AsyncNodesResource", + "NodesResourceWithRawResponse", + "AsyncNodesResourceWithRawResponse", + "NodesResourceWithStreamingResponse", + "AsyncNodesResourceWithStreamingResponse", + "PoolsResource", + "AsyncPoolsResource", + "PoolsResourceWithRawResponse", + "AsyncPoolsResourceWithRawResponse", + "PoolsResourceWithStreamingResponse", + "AsyncPoolsResourceWithStreamingResponse", + "ClustersResource", + "AsyncClustersResource", + "ClustersResourceWithRawResponse", + "AsyncClustersResourceWithRawResponse", + "ClustersResourceWithStreamingResponse", + "AsyncClustersResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py new file mode 100644 index 00000000..198ead21 --- /dev/null +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -0,0 +1,1427 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable, Optional + +import httpx + +from .nodes import ( + NodesResource, + AsyncNodesResource, + NodesResourceWithRawResponse, + AsyncNodesResourceWithRawResponse, + NodesResourceWithStreamingResponse, + AsyncNodesResourceWithStreamingResponse, +) +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from .pools.pools import ( + PoolsResource, + AsyncPoolsResource, + PoolsResourceWithRawResponse, + AsyncPoolsResourceWithRawResponse, + PoolsResourceWithStreamingResponse, + AsyncPoolsResourceWithStreamingResponse, +) +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.cloud.k8s import ( + cluster_create_params, + cluster_delete_params, + cluster_update_params, + cluster_upgrade_params, +) +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.k8s.k8s_cluster import K8sCluster +from .....types.cloud.k8s.k8s_cluster_list import K8sClusterList +from .....types.cloud.k8s_cluster_version_list import K8sClusterVersionList +from .....types.cloud.k8s.k8s_cluster_kubeconfig import K8sClusterKubeconfig +from .....types.cloud.k8s.k8s_cluster_certificate import K8sClusterCertificate + +__all__ = ["ClustersResource", "AsyncClustersResource"] + + +class ClustersResource(SyncAPIResource): + @cached_property + def nodes(self) -> NodesResource: + return NodesResource(self._client) + + @cached_property + def pools(self) -> PoolsResource: + return PoolsResource(self._client) + + @cached_property + def with_raw_response(self) -> ClustersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return ClustersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ClustersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return ClustersResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + keypair: str, + name: str, + pools: Iterable[cluster_create_params.Pool], + version: str, + authentication: Optional[cluster_create_params.Authentication] | NotGiven = NOT_GIVEN, + autoscaler_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + cni: Optional[cluster_create_params.Cni] | NotGiven = NOT_GIVEN, + csi: cluster_create_params.Csi | NotGiven = NOT_GIVEN, + ddos_profile: Optional[cluster_create_params.DDOSProfile] | NotGiven = NOT_GIVEN, + fixed_network: Optional[str] | NotGiven = NOT_GIVEN, + fixed_subnet: Optional[str] | NotGiven = NOT_GIVEN, + is_ipv6: Optional[bool] | NotGiven = NOT_GIVEN, + logging: Optional[cluster_create_params.Logging] | NotGiven = NOT_GIVEN, + pods_ip_pool: Optional[str] | NotGiven = NOT_GIVEN, + pods_ipv6_pool: Optional[str] | NotGiven = NOT_GIVEN, + services_ip_pool: Optional[str] | NotGiven = NOT_GIVEN, + services_ipv6_pool: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create k8s cluster + + Args: + keypair: The keypair of the cluster + + name: The name of the cluster + + pools: The pools of the cluster + + version: The version of the k8s cluster + + authentication: Authentication settings + + autoscaler_config: Cluster autoscaler configuration. It allows you to override the default + cluster-autoscaler parameters provided by the platform with your preferred + values. Supported parameters (in alphabetical order): + + - balance-similar-node-groups (boolean: true/false) - Detect similar node groups + and balance the number of nodes between them. + - expander (string: random, most-pods, least-waste, price, priority, grpc) - + Type of node group expander to be used in scale up. Specifying multiple values + separated by commas will call the expanders in succession until there is only + one option remaining. + - expendable-pods-priority-cutoff (float) - Pods with priority below cutoff will + be expendable. They can be killed without any consideration during scale down + and they don't cause scale up. Pods with null priority (PodPriority disabled) + are non expendable. + - ignore-daemonsets-utilization (boolean: true/false) - Should CA ignore + DaemonSet pods when calculating resource utilization for scaling down. + - max-empty-bulk-delete (integer) - Maximum number of empty nodes that can be + deleted at the same time. + - max-graceful-termination-sec (integer) - Maximum number of seconds CA waits + for pod termination when trying to scale down a node. + - max-node-provision-time (duration: e.g., '15m') - The default maximum time CA + waits for node to be provisioned - the value can be overridden per node group. + - max-total-unready-percentage (float) - Maximum percentage of unready nodes in + the cluster. After this is exceeded, CA halts operations. + - new-pod-scale-up-delay (duration: e.g., '10s') - Pods less than this old will + not be considered for scale-up. Can be increased for individual pods through + annotation. + - ok-total-unready-count (integer) - Number of allowed unready nodes, + irrespective of max-total-unready-percentage. + - scale-down-delay-after-add (duration: e.g., '10m') - How long after scale up + that scale down evaluation resumes. + - scale-down-delay-after-delete (duration: e.g., '10s') - How long after node + deletion that scale down evaluation resumes. + - scale-down-delay-after-failure (duration: e.g., '3m') - How long after scale + down failure that scale down evaluation resumes. + - scale-down-enabled (boolean: true/false) - Should CA scale down the cluster. + - scale-down-unneeded-time (duration: e.g., '10m') - How long a node should be + unneeded before it is eligible for scale down. + - scale-down-unready-time (duration: e.g., '20m') - How long an unready node + should be unneeded before it is eligible for scale down. + - scale-down-utilization-threshold (float) - The maximum value between the sum + of cpu requests and sum of memory requests of all pods running on the node + divided by node's corresponding allocatable resource, below which a node can + be considered for scale down. + - scan-interval (duration: e.g., '10s') - How often cluster is reevaluated for + scale up or down. + - skip-nodes-with-custom-controller-pods (boolean: true/false) - If true cluster + autoscaler will never delete nodes with pods owned by custom controllers. + - skip-nodes-with-local-storage (boolean: true/false) - If true cluster + autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir + or HostPath. + - skip-nodes-with-system-pods (boolean: true/false) - If true cluster autoscaler + will never delete nodes with pods from kube-system (except for DaemonSet or + mirror pods). + + cni: Cluster CNI settings + + csi: Container Storage Interface (CSI) driver settings + + ddos_profile: Advanced DDoS Protection profile + + fixed_network: The network of the cluster + + fixed_subnet: The subnet of the cluster + + is_ipv6: Enable public v6 address + + logging: Logging configuration + + pods_ip_pool: The IP pool for the pods + + pods_ipv6_pool: The IPv6 pool for the pods + + services_ip_pool: The IP pool for the services + + services_ipv6_pool: The IPv6 pool for the services + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + body=maybe_transform( + { + "keypair": keypair, + "name": name, + "pools": pools, + "version": version, + "authentication": authentication, + "autoscaler_config": autoscaler_config, + "cni": cni, + "csi": csi, + "ddos_profile": ddos_profile, + "fixed_network": fixed_network, + "fixed_subnet": fixed_subnet, + "is_ipv6": is_ipv6, + "logging": logging, + "pods_ip_pool": pods_ip_pool, + "pods_ipv6_pool": pods_ipv6_pool, + "services_ip_pool": services_ip_pool, + "services_ipv6_pool": services_ipv6_pool, + }, + cluster_create_params.ClusterCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + authentication: Optional[cluster_update_params.Authentication] | NotGiven = NOT_GIVEN, + autoscaler_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + cni: Optional[cluster_update_params.Cni] | NotGiven = NOT_GIVEN, + ddos_profile: Optional[cluster_update_params.DDOSProfile] | NotGiven = NOT_GIVEN, + logging: Optional[cluster_update_params.Logging] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Update k8s cluster + + Args: + authentication: Authentication settings + + autoscaler_config: Cluster autoscaler configuration. It allows you to override the default + cluster-autoscaler parameters provided by the platform with your preferred + values. Supported parameters (in alphabetical order): + + - balance-similar-node-groups (boolean: true/false) - Detect similar node groups + and balance the number of nodes between them. + - expander (string: random, most-pods, least-waste, price, priority, grpc) - + Type of node group expander to be used in scale up. Specifying multiple values + separated by commas will call the expanders in succession until there is only + one option remaining. + - expendable-pods-priority-cutoff (float) - Pods with priority below cutoff will + be expendable. They can be killed without any consideration during scale down + and they don't cause scale up. Pods with null priority (PodPriority disabled) + are non expendable. + - ignore-daemonsets-utilization (boolean: true/false) - Should CA ignore + DaemonSet pods when calculating resource utilization for scaling down. + - max-empty-bulk-delete (integer) - Maximum number of empty nodes that can be + deleted at the same time. + - max-graceful-termination-sec (integer) - Maximum number of seconds CA waits + for pod termination when trying to scale down a node. + - max-node-provision-time (duration: e.g., '15m') - The default maximum time CA + waits for node to be provisioned - the value can be overridden per node group. + - max-total-unready-percentage (float) - Maximum percentage of unready nodes in + the cluster. After this is exceeded, CA halts operations. + - new-pod-scale-up-delay (duration: e.g., '10s') - Pods less than this old will + not be considered for scale-up. Can be increased for individual pods through + annotation. + - ok-total-unready-count (integer) - Number of allowed unready nodes, + irrespective of max-total-unready-percentage. + - scale-down-delay-after-add (duration: e.g., '10m') - How long after scale up + that scale down evaluation resumes. + - scale-down-delay-after-delete (duration: e.g., '10s') - How long after node + deletion that scale down evaluation resumes. + - scale-down-delay-after-failure (duration: e.g., '3m') - How long after scale + down failure that scale down evaluation resumes. + - scale-down-enabled (boolean: true/false) - Should CA scale down the cluster. + - scale-down-unneeded-time (duration: e.g., '10m') - How long a node should be + unneeded before it is eligible for scale down. + - scale-down-unready-time (duration: e.g., '20m') - How long an unready node + should be unneeded before it is eligible for scale down. + - scale-down-utilization-threshold (float) - The maximum value between the sum + of cpu requests and sum of memory requests of all pods running on the node + divided by node's corresponding allocatable resource, below which a node can + be considered for scale down. + - scan-interval (duration: e.g., '10s') - How often cluster is reevaluated for + scale up or down. + - skip-nodes-with-custom-controller-pods (boolean: true/false) - If true cluster + autoscaler will never delete nodes with pods owned by custom controllers. + - skip-nodes-with-local-storage (boolean: true/false) - If true cluster + autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir + or HostPath. + - skip-nodes-with-system-pods (boolean: true/false) - If true cluster autoscaler + will never delete nodes with pods from kube-system (except for DaemonSet or + mirror pods). + + cni: Cluster CNI settings + + ddos_profile: Advanced DDoS Protection profile + + logging: Logging configuration + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._patch( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + body=maybe_transform( + { + "authentication": authentication, + "autoscaler_config": autoscaler_config, + "cni": cni, + "ddos_profile": ddos_profile, + "logging": logging, + }, + cluster_update_params.ClusterUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterList: + """ + List k8s clusters + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterList, + ) + + def delete( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + volumes: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete k8s cluster + + Args: + volumes: Comma separated list of volume IDs to be deleted with the cluster + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._delete( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"volumes": volumes}, cluster_delete_params.ClusterDeleteParams), + ), + cast_to=TaskIDList, + ) + + def get( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sCluster: + """ + Get k8s cluster + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sCluster, + ) + + def get_certificate( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterCertificate: + """ + Get k8s cluster CA certificate + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterCertificate, + ) + + def get_kubeconfig( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterKubeconfig: + """ + Get k8s cluster kubeconfig + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterKubeconfig, + ) + + def list_versions_for_upgrade( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterVersionList: + """ + List available k8s cluster versions for upgrade + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterVersionList, + ) + + def upgrade( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + version: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Upgrade k8s cluster + + Args: + version: Target k8s cluster version + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._post( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + body=maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncClustersResource(AsyncAPIResource): + @cached_property + def nodes(self) -> AsyncNodesResource: + return AsyncNodesResource(self._client) + + @cached_property + def pools(self) -> AsyncPoolsResource: + return AsyncPoolsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncClustersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncClustersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncClustersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncClustersResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + keypair: str, + name: str, + pools: Iterable[cluster_create_params.Pool], + version: str, + authentication: Optional[cluster_create_params.Authentication] | NotGiven = NOT_GIVEN, + autoscaler_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + cni: Optional[cluster_create_params.Cni] | NotGiven = NOT_GIVEN, + csi: cluster_create_params.Csi | NotGiven = NOT_GIVEN, + ddos_profile: Optional[cluster_create_params.DDOSProfile] | NotGiven = NOT_GIVEN, + fixed_network: Optional[str] | NotGiven = NOT_GIVEN, + fixed_subnet: Optional[str] | NotGiven = NOT_GIVEN, + is_ipv6: Optional[bool] | NotGiven = NOT_GIVEN, + logging: Optional[cluster_create_params.Logging] | NotGiven = NOT_GIVEN, + pods_ip_pool: Optional[str] | NotGiven = NOT_GIVEN, + pods_ipv6_pool: Optional[str] | NotGiven = NOT_GIVEN, + services_ip_pool: Optional[str] | NotGiven = NOT_GIVEN, + services_ipv6_pool: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create k8s cluster + + Args: + keypair: The keypair of the cluster + + name: The name of the cluster + + pools: The pools of the cluster + + version: The version of the k8s cluster + + authentication: Authentication settings + + autoscaler_config: Cluster autoscaler configuration. It allows you to override the default + cluster-autoscaler parameters provided by the platform with your preferred + values. Supported parameters (in alphabetical order): + + - balance-similar-node-groups (boolean: true/false) - Detect similar node groups + and balance the number of nodes between them. + - expander (string: random, most-pods, least-waste, price, priority, grpc) - + Type of node group expander to be used in scale up. Specifying multiple values + separated by commas will call the expanders in succession until there is only + one option remaining. + - expendable-pods-priority-cutoff (float) - Pods with priority below cutoff will + be expendable. They can be killed without any consideration during scale down + and they don't cause scale up. Pods with null priority (PodPriority disabled) + are non expendable. + - ignore-daemonsets-utilization (boolean: true/false) - Should CA ignore + DaemonSet pods when calculating resource utilization for scaling down. + - max-empty-bulk-delete (integer) - Maximum number of empty nodes that can be + deleted at the same time. + - max-graceful-termination-sec (integer) - Maximum number of seconds CA waits + for pod termination when trying to scale down a node. + - max-node-provision-time (duration: e.g., '15m') - The default maximum time CA + waits for node to be provisioned - the value can be overridden per node group. + - max-total-unready-percentage (float) - Maximum percentage of unready nodes in + the cluster. After this is exceeded, CA halts operations. + - new-pod-scale-up-delay (duration: e.g., '10s') - Pods less than this old will + not be considered for scale-up. Can be increased for individual pods through + annotation. + - ok-total-unready-count (integer) - Number of allowed unready nodes, + irrespective of max-total-unready-percentage. + - scale-down-delay-after-add (duration: e.g., '10m') - How long after scale up + that scale down evaluation resumes. + - scale-down-delay-after-delete (duration: e.g., '10s') - How long after node + deletion that scale down evaluation resumes. + - scale-down-delay-after-failure (duration: e.g., '3m') - How long after scale + down failure that scale down evaluation resumes. + - scale-down-enabled (boolean: true/false) - Should CA scale down the cluster. + - scale-down-unneeded-time (duration: e.g., '10m') - How long a node should be + unneeded before it is eligible for scale down. + - scale-down-unready-time (duration: e.g., '20m') - How long an unready node + should be unneeded before it is eligible for scale down. + - scale-down-utilization-threshold (float) - The maximum value between the sum + of cpu requests and sum of memory requests of all pods running on the node + divided by node's corresponding allocatable resource, below which a node can + be considered for scale down. + - scan-interval (duration: e.g., '10s') - How often cluster is reevaluated for + scale up or down. + - skip-nodes-with-custom-controller-pods (boolean: true/false) - If true cluster + autoscaler will never delete nodes with pods owned by custom controllers. + - skip-nodes-with-local-storage (boolean: true/false) - If true cluster + autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir + or HostPath. + - skip-nodes-with-system-pods (boolean: true/false) - If true cluster autoscaler + will never delete nodes with pods from kube-system (except for DaemonSet or + mirror pods). + + cni: Cluster CNI settings + + csi: Container Storage Interface (CSI) driver settings + + ddos_profile: Advanced DDoS Protection profile + + fixed_network: The network of the cluster + + fixed_subnet: The subnet of the cluster + + is_ipv6: Enable public v6 address + + logging: Logging configuration + + pods_ip_pool: The IP pool for the pods + + pods_ipv6_pool: The IPv6 pool for the pods + + services_ip_pool: The IP pool for the services + + services_ipv6_pool: The IPv6 pool for the services + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "keypair": keypair, + "name": name, + "pools": pools, + "version": version, + "authentication": authentication, + "autoscaler_config": autoscaler_config, + "cni": cni, + "csi": csi, + "ddos_profile": ddos_profile, + "fixed_network": fixed_network, + "fixed_subnet": fixed_subnet, + "is_ipv6": is_ipv6, + "logging": logging, + "pods_ip_pool": pods_ip_pool, + "pods_ipv6_pool": pods_ipv6_pool, + "services_ip_pool": services_ip_pool, + "services_ipv6_pool": services_ipv6_pool, + }, + cluster_create_params.ClusterCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + authentication: Optional[cluster_update_params.Authentication] | NotGiven = NOT_GIVEN, + autoscaler_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + cni: Optional[cluster_update_params.Cni] | NotGiven = NOT_GIVEN, + ddos_profile: Optional[cluster_update_params.DDOSProfile] | NotGiven = NOT_GIVEN, + logging: Optional[cluster_update_params.Logging] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Update k8s cluster + + Args: + authentication: Authentication settings + + autoscaler_config: Cluster autoscaler configuration. It allows you to override the default + cluster-autoscaler parameters provided by the platform with your preferred + values. Supported parameters (in alphabetical order): + + - balance-similar-node-groups (boolean: true/false) - Detect similar node groups + and balance the number of nodes between them. + - expander (string: random, most-pods, least-waste, price, priority, grpc) - + Type of node group expander to be used in scale up. Specifying multiple values + separated by commas will call the expanders in succession until there is only + one option remaining. + - expendable-pods-priority-cutoff (float) - Pods with priority below cutoff will + be expendable. They can be killed without any consideration during scale down + and they don't cause scale up. Pods with null priority (PodPriority disabled) + are non expendable. + - ignore-daemonsets-utilization (boolean: true/false) - Should CA ignore + DaemonSet pods when calculating resource utilization for scaling down. + - max-empty-bulk-delete (integer) - Maximum number of empty nodes that can be + deleted at the same time. + - max-graceful-termination-sec (integer) - Maximum number of seconds CA waits + for pod termination when trying to scale down a node. + - max-node-provision-time (duration: e.g., '15m') - The default maximum time CA + waits for node to be provisioned - the value can be overridden per node group. + - max-total-unready-percentage (float) - Maximum percentage of unready nodes in + the cluster. After this is exceeded, CA halts operations. + - new-pod-scale-up-delay (duration: e.g., '10s') - Pods less than this old will + not be considered for scale-up. Can be increased for individual pods through + annotation. + - ok-total-unready-count (integer) - Number of allowed unready nodes, + irrespective of max-total-unready-percentage. + - scale-down-delay-after-add (duration: e.g., '10m') - How long after scale up + that scale down evaluation resumes. + - scale-down-delay-after-delete (duration: e.g., '10s') - How long after node + deletion that scale down evaluation resumes. + - scale-down-delay-after-failure (duration: e.g., '3m') - How long after scale + down failure that scale down evaluation resumes. + - scale-down-enabled (boolean: true/false) - Should CA scale down the cluster. + - scale-down-unneeded-time (duration: e.g., '10m') - How long a node should be + unneeded before it is eligible for scale down. + - scale-down-unready-time (duration: e.g., '20m') - How long an unready node + should be unneeded before it is eligible for scale down. + - scale-down-utilization-threshold (float) - The maximum value between the sum + of cpu requests and sum of memory requests of all pods running on the node + divided by node's corresponding allocatable resource, below which a node can + be considered for scale down. + - scan-interval (duration: e.g., '10s') - How often cluster is reevaluated for + scale up or down. + - skip-nodes-with-custom-controller-pods (boolean: true/false) - If true cluster + autoscaler will never delete nodes with pods owned by custom controllers. + - skip-nodes-with-local-storage (boolean: true/false) - If true cluster + autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir + or HostPath. + - skip-nodes-with-system-pods (boolean: true/false) - If true cluster autoscaler + will never delete nodes with pods from kube-system (except for DaemonSet or + mirror pods). + + cni: Cluster CNI settings + + ddos_profile: Advanced DDoS Protection profile + + logging: Logging configuration + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._patch( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + body=await async_maybe_transform( + { + "authentication": authentication, + "autoscaler_config": autoscaler_config, + "cni": cni, + "ddos_profile": ddos_profile, + "logging": logging, + }, + cluster_update_params.ClusterUpdateParams, + ), + 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, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterList: + """ + List k8s clusters + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterList, + ) + + async def delete( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + volumes: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Delete k8s cluster + + Args: + volumes: Comma separated list of volume IDs to be deleted with the cluster + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._delete( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"volumes": volumes}, cluster_delete_params.ClusterDeleteParams), + ), + cast_to=TaskIDList, + ) + + async def get( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sCluster: + """ + Get k8s cluster + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sCluster, + ) + + async def get_certificate( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterCertificate: + """ + Get k8s cluster CA certificate + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterCertificate, + ) + + async def get_kubeconfig( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterKubeconfig: + """ + Get k8s cluster kubeconfig + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterKubeconfig, + ) + + async def list_versions_for_upgrade( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterVersionList: + """ + List available k8s cluster versions for upgrade + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterVersionList, + ) + + async def upgrade( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + version: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Upgrade k8s cluster + + Args: + version: Target k8s cluster version + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._post( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + body=await async_maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class ClustersResourceWithRawResponse: + def __init__(self, clusters: ClustersResource) -> None: + self._clusters = clusters + + self.create = to_raw_response_wrapper( + clusters.create, + ) + self.update = to_raw_response_wrapper( + clusters.update, + ) + self.list = to_raw_response_wrapper( + clusters.list, + ) + self.delete = to_raw_response_wrapper( + clusters.delete, + ) + self.get = to_raw_response_wrapper( + clusters.get, + ) + self.get_certificate = to_raw_response_wrapper( + clusters.get_certificate, + ) + self.get_kubeconfig = to_raw_response_wrapper( + clusters.get_kubeconfig, + ) + self.list_versions_for_upgrade = to_raw_response_wrapper( + clusters.list_versions_for_upgrade, + ) + self.upgrade = to_raw_response_wrapper( + clusters.upgrade, + ) + + @cached_property + def nodes(self) -> NodesResourceWithRawResponse: + return NodesResourceWithRawResponse(self._clusters.nodes) + + @cached_property + def pools(self) -> PoolsResourceWithRawResponse: + return PoolsResourceWithRawResponse(self._clusters.pools) + + +class AsyncClustersResourceWithRawResponse: + def __init__(self, clusters: AsyncClustersResource) -> None: + self._clusters = clusters + + self.create = async_to_raw_response_wrapper( + clusters.create, + ) + self.update = async_to_raw_response_wrapper( + clusters.update, + ) + self.list = async_to_raw_response_wrapper( + clusters.list, + ) + self.delete = async_to_raw_response_wrapper( + clusters.delete, + ) + self.get = async_to_raw_response_wrapper( + clusters.get, + ) + self.get_certificate = async_to_raw_response_wrapper( + clusters.get_certificate, + ) + self.get_kubeconfig = async_to_raw_response_wrapper( + clusters.get_kubeconfig, + ) + self.list_versions_for_upgrade = async_to_raw_response_wrapper( + clusters.list_versions_for_upgrade, + ) + self.upgrade = async_to_raw_response_wrapper( + clusters.upgrade, + ) + + @cached_property + def nodes(self) -> AsyncNodesResourceWithRawResponse: + return AsyncNodesResourceWithRawResponse(self._clusters.nodes) + + @cached_property + def pools(self) -> AsyncPoolsResourceWithRawResponse: + return AsyncPoolsResourceWithRawResponse(self._clusters.pools) + + +class ClustersResourceWithStreamingResponse: + def __init__(self, clusters: ClustersResource) -> None: + self._clusters = clusters + + self.create = to_streamed_response_wrapper( + clusters.create, + ) + self.update = to_streamed_response_wrapper( + clusters.update, + ) + self.list = to_streamed_response_wrapper( + clusters.list, + ) + self.delete = to_streamed_response_wrapper( + clusters.delete, + ) + self.get = to_streamed_response_wrapper( + clusters.get, + ) + self.get_certificate = to_streamed_response_wrapper( + clusters.get_certificate, + ) + self.get_kubeconfig = to_streamed_response_wrapper( + clusters.get_kubeconfig, + ) + self.list_versions_for_upgrade = to_streamed_response_wrapper( + clusters.list_versions_for_upgrade, + ) + self.upgrade = to_streamed_response_wrapper( + clusters.upgrade, + ) + + @cached_property + def nodes(self) -> NodesResourceWithStreamingResponse: + return NodesResourceWithStreamingResponse(self._clusters.nodes) + + @cached_property + def pools(self) -> PoolsResourceWithStreamingResponse: + return PoolsResourceWithStreamingResponse(self._clusters.pools) + + +class AsyncClustersResourceWithStreamingResponse: + def __init__(self, clusters: AsyncClustersResource) -> None: + self._clusters = clusters + + self.create = async_to_streamed_response_wrapper( + clusters.create, + ) + self.update = async_to_streamed_response_wrapper( + clusters.update, + ) + self.list = async_to_streamed_response_wrapper( + clusters.list, + ) + self.delete = async_to_streamed_response_wrapper( + clusters.delete, + ) + self.get = async_to_streamed_response_wrapper( + clusters.get, + ) + self.get_certificate = async_to_streamed_response_wrapper( + clusters.get_certificate, + ) + self.get_kubeconfig = async_to_streamed_response_wrapper( + clusters.get_kubeconfig, + ) + self.list_versions_for_upgrade = async_to_streamed_response_wrapper( + clusters.list_versions_for_upgrade, + ) + self.upgrade = async_to_streamed_response_wrapper( + clusters.upgrade, + ) + + @cached_property + def nodes(self) -> AsyncNodesResourceWithStreamingResponse: + return AsyncNodesResourceWithStreamingResponse(self._clusters.nodes) + + @cached_property + def pools(self) -> AsyncPoolsResourceWithStreamingResponse: + return AsyncPoolsResourceWithStreamingResponse(self._clusters.pools) diff --git a/src/gcore/resources/cloud/k8s/clusters/nodes.py b/src/gcore/resources/cloud/k8s/clusters/nodes.py new file mode 100644 index 00000000..d04a0586 --- /dev/null +++ b/src/gcore/resources/cloud/k8s/clusters/nodes.py @@ -0,0 +1,299 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.cloud.k8s.clusters import node_list_params +from .....types.cloud.instance_list import InstanceList + +__all__ = ["NodesResource", "AsyncNodesResource"] + + +class NodesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> NodesResourceWithRawResponse: + """ + 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 NodesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> NodesResourceWithStreamingResponse: + """ + 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 NodesResourceWithStreamingResponse(self) + + def list( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + with_ddos: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceList: + """ + List k8s cluster nodes + + Args: + with_ddos: Include DDoS profile information if set to true. Default is false. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"with_ddos": with_ddos}, node_list_params.NodeListParams), + ), + cast_to=InstanceList, + ) + + def delete( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + After deletion, the node will be automatically recreated to maintain the desired + pool size. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncNodesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncNodesResourceWithRawResponse: + """ + 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 AsyncNodesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncNodesResourceWithStreamingResponse: + """ + 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 AsyncNodesResourceWithStreamingResponse(self) + + async def list( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + with_ddos: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceList: + """ + List k8s cluster nodes + + Args: + with_ddos: Include DDoS profile information if set to true. Default is false. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"with_ddos": with_ddos}, node_list_params.NodeListParams), + ), + cast_to=InstanceList, + ) + + async def delete( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + After deletion, the node will be automatically recreated to maintain the desired + pool size. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class NodesResourceWithRawResponse: + def __init__(self, nodes: NodesResource) -> None: + self._nodes = nodes + + self.list = to_raw_response_wrapper( + nodes.list, + ) + self.delete = to_raw_response_wrapper( + nodes.delete, + ) + + +class AsyncNodesResourceWithRawResponse: + def __init__(self, nodes: AsyncNodesResource) -> None: + self._nodes = nodes + + self.list = async_to_raw_response_wrapper( + nodes.list, + ) + self.delete = async_to_raw_response_wrapper( + nodes.delete, + ) + + +class NodesResourceWithStreamingResponse: + def __init__(self, nodes: NodesResource) -> None: + self._nodes = nodes + + self.list = to_streamed_response_wrapper( + nodes.list, + ) + self.delete = to_streamed_response_wrapper( + nodes.delete, + ) + + +class AsyncNodesResourceWithStreamingResponse: + def __init__(self, nodes: AsyncNodesResource) -> None: + self._nodes = nodes + + self.list = async_to_streamed_response_wrapper( + nodes.list, + ) + self.delete = async_to_streamed_response_wrapper( + nodes.delete, + ) diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/__init__.py b/src/gcore/resources/cloud/k8s/clusters/pools/__init__.py new file mode 100644 index 00000000..c255bb3b --- /dev/null +++ b/src/gcore/resources/cloud/k8s/clusters/pools/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .nodes import ( + NodesResource, + AsyncNodesResource, + NodesResourceWithRawResponse, + AsyncNodesResourceWithRawResponse, + NodesResourceWithStreamingResponse, + AsyncNodesResourceWithStreamingResponse, +) +from .pools import ( + PoolsResource, + AsyncPoolsResource, + PoolsResourceWithRawResponse, + AsyncPoolsResourceWithRawResponse, + PoolsResourceWithStreamingResponse, + AsyncPoolsResourceWithStreamingResponse, +) + +__all__ = [ + "NodesResource", + "AsyncNodesResource", + "NodesResourceWithRawResponse", + "AsyncNodesResourceWithRawResponse", + "NodesResourceWithStreamingResponse", + "AsyncNodesResourceWithStreamingResponse", + "PoolsResource", + "AsyncPoolsResource", + "PoolsResourceWithRawResponse", + "AsyncPoolsResourceWithRawResponse", + "PoolsResourceWithStreamingResponse", + "AsyncPoolsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py new file mode 100644 index 00000000..8ff64793 --- /dev/null +++ b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py @@ -0,0 +1,311 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ......_types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ......_utils import maybe_transform, async_maybe_transform +from ......_compat import cached_property +from ......_resource import SyncAPIResource, AsyncAPIResource +from ......_response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ......_base_client import make_request_options +from ......types.cloud.instance_list import InstanceList +from ......types.cloud.k8s.clusters.pools import node_list_params + +__all__ = ["NodesResource", "AsyncNodesResource"] + + +class NodesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> NodesResourceWithRawResponse: + """ + 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 NodesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> NodesResourceWithStreamingResponse: + """ + 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 NodesResourceWithStreamingResponse(self) + + def list( + self, + pool_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_name: str, + with_ddos: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceList: + """ + List k8s cluster pool nodes + + Args: + with_ddos: Include DDoS profile information if set to true. Default is false. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not pool_name: + raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") + return self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"with_ddos": with_ddos}, node_list_params.NodeListParams), + ), + cast_to=InstanceList, + ) + + def delete( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_name: str, + pool_name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + After deletion, the node will be automatically recreated to maintain the desired + pool size. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not pool_name: + raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncNodesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncNodesResourceWithRawResponse: + """ + 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 AsyncNodesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncNodesResourceWithStreamingResponse: + """ + 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 AsyncNodesResourceWithStreamingResponse(self) + + async def list( + self, + pool_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_name: str, + with_ddos: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InstanceList: + """ + List k8s cluster pool nodes + + Args: + with_ddos: Include DDoS profile information if set to true. Default is false. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not pool_name: + raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") + return await self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"with_ddos": with_ddos}, node_list_params.NodeListParams), + ), + cast_to=InstanceList, + ) + + async def delete( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_name: str, + pool_name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + After deletion, the node will be automatically recreated to maintain the desired + pool size. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not pool_name: + raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class NodesResourceWithRawResponse: + def __init__(self, nodes: NodesResource) -> None: + self._nodes = nodes + + self.list = to_raw_response_wrapper( + nodes.list, + ) + self.delete = to_raw_response_wrapper( + nodes.delete, + ) + + +class AsyncNodesResourceWithRawResponse: + def __init__(self, nodes: AsyncNodesResource) -> None: + self._nodes = nodes + + self.list = async_to_raw_response_wrapper( + nodes.list, + ) + self.delete = async_to_raw_response_wrapper( + nodes.delete, + ) + + +class NodesResourceWithStreamingResponse: + def __init__(self, nodes: NodesResource) -> None: + self._nodes = nodes + + self.list = to_streamed_response_wrapper( + nodes.list, + ) + self.delete = to_streamed_response_wrapper( + nodes.delete, + ) + + +class AsyncNodesResourceWithStreamingResponse: + def __init__(self, nodes: AsyncNodesResource) -> None: + self._nodes = nodes + + self.list = async_to_streamed_response_wrapper( + nodes.list, + ) + self.delete = async_to_streamed_response_wrapper( + nodes.delete, + ) diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py new file mode 100644 index 00000000..b60e3039 --- /dev/null +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -0,0 +1,894 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal + +import httpx + +from .nodes import ( + NodesResource, + AsyncNodesResource, + NodesResourceWithRawResponse, + AsyncNodesResourceWithRawResponse, + NodesResourceWithStreamingResponse, + AsyncNodesResourceWithStreamingResponse, +) +from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ......_utils import maybe_transform, async_maybe_transform +from ......_compat import cached_property +from ......_resource import SyncAPIResource, AsyncAPIResource +from ......_response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ......_base_client import make_request_options +from ......types.cloud.k8s.clusters import pool_create_params, pool_resize_params, pool_update_params +from ......types.cloud.task_id_list import TaskIDList +from ......types.cloud.k8s.clusters.k8s_cluster_pool import K8sClusterPool +from ......types.cloud.k8s.clusters.k8s_cluster_pool_list import K8sClusterPoolList + +__all__ = ["PoolsResource", "AsyncPoolsResource"] + + +class PoolsResource(SyncAPIResource): + @cached_property + def nodes(self) -> NodesResource: + return NodesResource(self._client) + + @cached_property + def with_raw_response(self) -> PoolsResourceWithRawResponse: + """ + 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 PoolsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PoolsResourceWithStreamingResponse: + """ + 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 PoolsResourceWithStreamingResponse(self) + + def create( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor_id: str, + min_node_count: int, + name: str, + auto_healing_enabled: Optional[bool] | NotGiven = NOT_GIVEN, + boot_volume_size: Optional[int] | NotGiven = NOT_GIVEN, + boot_volume_type: Optional[Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]] + | NotGiven = NOT_GIVEN, + crio_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + is_public_ipv4: Optional[bool] | NotGiven = NOT_GIVEN, + kubelet_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + labels: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + max_node_count: Optional[int] | NotGiven = NOT_GIVEN, + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | NotGiven = NOT_GIVEN, + taints: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create k8s cluster pool + + Args: + flavor_id: Flavor ID + + min_node_count: Minimum node count + + name: Pool's name + + auto_healing_enabled: Enable auto healing + + boot_volume_size: Boot volume size + + boot_volume_type: Boot volume type + + crio_config: Cri-o configuration for pool nodes + + is_public_ipv4: Enable public v4 address + + kubelet_config: Kubelet configuration for pool nodes + + labels: Labels applied to the cluster pool + + max_node_count: Maximum node count + + servergroup_policy: Server group policy: anti-affinity, soft-anti-affinity or affinity + + taints: Taints applied to the cluster pool + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._post( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + body=maybe_transform( + { + "flavor_id": flavor_id, + "min_node_count": min_node_count, + "name": name, + "auto_healing_enabled": auto_healing_enabled, + "boot_volume_size": boot_volume_size, + "boot_volume_type": boot_volume_type, + "crio_config": crio_config, + "is_public_ipv4": is_public_ipv4, + "kubelet_config": kubelet_config, + "labels": labels, + "max_node_count": max_node_count, + "servergroup_policy": servergroup_policy, + "taints": taints, + }, + pool_create_params.PoolCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + pool_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_name: str, + auto_healing_enabled: Optional[bool] | NotGiven = NOT_GIVEN, + labels: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + max_node_count: Optional[int] | NotGiven = NOT_GIVEN, + min_node_count: Optional[int] | NotGiven = NOT_GIVEN, + node_count: Optional[int] | NotGiven = NOT_GIVEN, + taints: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterPool: + """ + Update k8s cluster pool + + Args: + auto_healing_enabled: Enable/disable auto healing + + labels: Labels applied to the cluster pool + + max_node_count: Maximum node count + + min_node_count: Minimum node count + + node_count: Current node count + + taints: Taints applied to the cluster pool + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not pool_name: + raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") + return self._patch( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + body=maybe_transform( + { + "auto_healing_enabled": auto_healing_enabled, + "labels": labels, + "max_node_count": max_node_count, + "min_node_count": min_node_count, + "node_count": node_count, + "taints": taints, + }, + pool_update_params.PoolUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterPool, + ) + + def list( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterPoolList: + """ + List k8s cluster pools + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterPoolList, + ) + + def delete( + self, + pool_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_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, + ) -> TaskIDList: + """ + Delete k8s cluster pool + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not pool_name: + raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") + return self._delete( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + pool_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_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, + ) -> K8sClusterPool: + """ + Get k8s cluster pool + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not pool_name: + raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") + return self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterPool, + ) + + def resize( + self, + pool_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_name: str, + node_count: 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, + ) -> TaskIDList: + """ + Resize k8s cluster pool + + Args: + node_count: Target node count + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not pool_name: + raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") + return self._post( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + body=maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncPoolsResource(AsyncAPIResource): + @cached_property + def nodes(self) -> AsyncNodesResource: + return AsyncNodesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncPoolsResourceWithRawResponse: + """ + 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 AsyncPoolsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPoolsResourceWithStreamingResponse: + """ + 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 AsyncPoolsResourceWithStreamingResponse(self) + + async def create( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor_id: str, + min_node_count: int, + name: str, + auto_healing_enabled: Optional[bool] | NotGiven = NOT_GIVEN, + boot_volume_size: Optional[int] | NotGiven = NOT_GIVEN, + boot_volume_type: Optional[Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]] + | NotGiven = NOT_GIVEN, + crio_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + is_public_ipv4: Optional[bool] | NotGiven = NOT_GIVEN, + kubelet_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + labels: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + max_node_count: Optional[int] | NotGiven = NOT_GIVEN, + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | NotGiven = NOT_GIVEN, + taints: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TaskIDList: + """ + Create k8s cluster pool + + Args: + flavor_id: Flavor ID + + min_node_count: Minimum node count + + name: Pool's name + + auto_healing_enabled: Enable auto healing + + boot_volume_size: Boot volume size + + boot_volume_type: Boot volume type + + crio_config: Cri-o configuration for pool nodes + + is_public_ipv4: Enable public v4 address + + kubelet_config: Kubelet configuration for pool nodes + + labels: Labels applied to the cluster pool + + max_node_count: Maximum node count + + servergroup_policy: Server group policy: anti-affinity, soft-anti-affinity or affinity + + taints: Taints applied to the cluster pool + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._post( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + body=await async_maybe_transform( + { + "flavor_id": flavor_id, + "min_node_count": min_node_count, + "name": name, + "auto_healing_enabled": auto_healing_enabled, + "boot_volume_size": boot_volume_size, + "boot_volume_type": boot_volume_type, + "crio_config": crio_config, + "is_public_ipv4": is_public_ipv4, + "kubelet_config": kubelet_config, + "labels": labels, + "max_node_count": max_node_count, + "servergroup_policy": servergroup_policy, + "taints": taints, + }, + pool_create_params.PoolCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + pool_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_name: str, + auto_healing_enabled: Optional[bool] | NotGiven = NOT_GIVEN, + labels: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + max_node_count: Optional[int] | NotGiven = NOT_GIVEN, + min_node_count: Optional[int] | NotGiven = NOT_GIVEN, + node_count: Optional[int] | NotGiven = NOT_GIVEN, + taints: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterPool: + """ + Update k8s cluster pool + + Args: + auto_healing_enabled: Enable/disable auto healing + + labels: Labels applied to the cluster pool + + max_node_count: Maximum node count + + min_node_count: Minimum node count + + node_count: Current node count + + taints: Taints applied to the cluster pool + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not pool_name: + raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") + return await self._patch( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + body=await async_maybe_transform( + { + "auto_healing_enabled": auto_healing_enabled, + "labels": labels, + "max_node_count": max_node_count, + "min_node_count": min_node_count, + "node_count": node_count, + "taints": taints, + }, + pool_update_params.PoolUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterPool, + ) + + async def list( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterPoolList: + """ + List k8s cluster pools + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterPoolList, + ) + + async def delete( + self, + pool_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_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, + ) -> TaskIDList: + """ + Delete k8s cluster pool + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not pool_name: + raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") + return await self._delete( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + pool_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_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, + ) -> K8sClusterPool: + """ + Get k8s cluster pool + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not pool_name: + raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") + return await self._get( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterPool, + ) + + async def resize( + self, + pool_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_name: str, + node_count: 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, + ) -> TaskIDList: + """ + Resize k8s cluster pool + + Args: + node_count: Target node count + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not pool_name: + raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") + return await self._post( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + body=await async_maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class PoolsResourceWithRawResponse: + def __init__(self, pools: PoolsResource) -> None: + self._pools = pools + + self.create = to_raw_response_wrapper( + pools.create, + ) + self.update = to_raw_response_wrapper( + pools.update, + ) + self.list = to_raw_response_wrapper( + pools.list, + ) + self.delete = to_raw_response_wrapper( + pools.delete, + ) + self.get = to_raw_response_wrapper( + pools.get, + ) + self.resize = to_raw_response_wrapper( + pools.resize, + ) + + @cached_property + def nodes(self) -> NodesResourceWithRawResponse: + return NodesResourceWithRawResponse(self._pools.nodes) + + +class AsyncPoolsResourceWithRawResponse: + def __init__(self, pools: AsyncPoolsResource) -> None: + self._pools = pools + + self.create = async_to_raw_response_wrapper( + pools.create, + ) + self.update = async_to_raw_response_wrapper( + pools.update, + ) + self.list = async_to_raw_response_wrapper( + pools.list, + ) + self.delete = async_to_raw_response_wrapper( + pools.delete, + ) + self.get = async_to_raw_response_wrapper( + pools.get, + ) + self.resize = async_to_raw_response_wrapper( + pools.resize, + ) + + @cached_property + def nodes(self) -> AsyncNodesResourceWithRawResponse: + return AsyncNodesResourceWithRawResponse(self._pools.nodes) + + +class PoolsResourceWithStreamingResponse: + def __init__(self, pools: PoolsResource) -> None: + self._pools = pools + + self.create = to_streamed_response_wrapper( + pools.create, + ) + self.update = to_streamed_response_wrapper( + pools.update, + ) + self.list = to_streamed_response_wrapper( + pools.list, + ) + self.delete = to_streamed_response_wrapper( + pools.delete, + ) + self.get = to_streamed_response_wrapper( + pools.get, + ) + self.resize = to_streamed_response_wrapper( + pools.resize, + ) + + @cached_property + def nodes(self) -> NodesResourceWithStreamingResponse: + return NodesResourceWithStreamingResponse(self._pools.nodes) + + +class AsyncPoolsResourceWithStreamingResponse: + def __init__(self, pools: AsyncPoolsResource) -> None: + self._pools = pools + + self.create = async_to_streamed_response_wrapper( + pools.create, + ) + self.update = async_to_streamed_response_wrapper( + pools.update, + ) + self.list = async_to_streamed_response_wrapper( + pools.list, + ) + self.delete = async_to_streamed_response_wrapper( + pools.delete, + ) + self.get = async_to_streamed_response_wrapper( + pools.get, + ) + self.resize = async_to_streamed_response_wrapper( + pools.resize, + ) + + @cached_property + def nodes(self) -> AsyncNodesResourceWithStreamingResponse: + return AsyncNodesResourceWithStreamingResponse(self._pools.nodes) diff --git a/src/gcore/resources/cloud/k8s/flavors.py b/src/gcore/resources/cloud/k8s/flavors.py new file mode 100644 index 00000000..cd456f26 --- /dev/null +++ b/src/gcore/resources/cloud/k8s/flavors.py @@ -0,0 +1,213 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.k8s import flavor_list_params +from ....types.cloud.baremetal_flavor_list import BaremetalFlavorList + +__all__ = ["FlavorsResource", "AsyncFlavorsResource"] + + +class FlavorsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FlavorsResourceWithRawResponse: + """ + 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 FlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: + """ + 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 FlavorsResourceWithStreamingResponse(self) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + exclude_gpu: bool | NotGiven = NOT_GIVEN, + include_prices: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BaremetalFlavorList: + """Retrieve a list of flavors for k8s pool. + + When the `include_prices` query + parameter is specified, the list shows prices. A client in trial mode gets all + price values as 0. If you get Pricing Error contact the support + + Args: + exclude_gpu: Set to false to include GPU flavors. Default is True. + + include_prices: Set to true to include flavor prices. Default is False. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "exclude_gpu": exclude_gpu, + "include_prices": include_prices, + }, + flavor_list_params.FlavorListParams, + ), + ), + cast_to=BaremetalFlavorList, + ) + + +class AsyncFlavorsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFlavorsResourceWithRawResponse: + """ + 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 AsyncFlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: + """ + 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 AsyncFlavorsResourceWithStreamingResponse(self) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + exclude_gpu: bool | NotGiven = NOT_GIVEN, + include_prices: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BaremetalFlavorList: + """Retrieve a list of flavors for k8s pool. + + When the `include_prices` query + parameter is specified, the list shows prices. A client in trial mode gets all + price values as 0. If you get Pricing Error contact the support + + Args: + exclude_gpu: Set to false to include GPU flavors. Default is True. + + include_prices: Set to true to include flavor prices. Default is False. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "exclude_gpu": exclude_gpu, + "include_prices": include_prices, + }, + flavor_list_params.FlavorListParams, + ), + ), + cast_to=BaremetalFlavorList, + ) + + +class FlavorsResourceWithRawResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_raw_response_wrapper( + flavors.list, + ) + + +class AsyncFlavorsResourceWithRawResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_raw_response_wrapper( + flavors.list, + ) + + +class FlavorsResourceWithStreamingResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_streamed_response_wrapper( + flavors.list, + ) + + +class AsyncFlavorsResourceWithStreamingResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_streamed_response_wrapper( + flavors.list, + ) diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py new file mode 100644 index 00000000..c193fccd --- /dev/null +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -0,0 +1,237 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from .clusters.clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) +from ....types.cloud.k8s_cluster_version_list import K8sClusterVersionList + +__all__ = ["K8sResource", "AsyncK8sResource"] + + +class K8sResource(SyncAPIResource): + @cached_property + def flavors(self) -> FlavorsResource: + return FlavorsResource(self._client) + + @cached_property + def clusters(self) -> ClustersResource: + return ClustersResource(self._client) + + @cached_property + def with_raw_response(self) -> K8sResourceWithRawResponse: + """ + 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 K8sResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> K8sResourceWithStreamingResponse: + """ + 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 K8sResourceWithStreamingResponse(self) + + def list_versions( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterVersionList: + """ + List available k8s cluster versions for creation + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterVersionList, + ) + + +class AsyncK8sResource(AsyncAPIResource): + @cached_property + def flavors(self) -> AsyncFlavorsResource: + return AsyncFlavorsResource(self._client) + + @cached_property + def clusters(self) -> AsyncClustersResource: + return AsyncClustersResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncK8sResourceWithRawResponse: + """ + 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 AsyncK8sResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncK8sResourceWithStreamingResponse: + """ + 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 AsyncK8sResourceWithStreamingResponse(self) + + async def list_versions( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> K8sClusterVersionList: + """ + List available k8s cluster versions for creation + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8sClusterVersionList, + ) + + +class K8sResourceWithRawResponse: + def __init__(self, k8s: K8sResource) -> None: + self._k8s = k8s + + self.list_versions = to_raw_response_wrapper( + k8s.list_versions, + ) + + @cached_property + def flavors(self) -> FlavorsResourceWithRawResponse: + return FlavorsResourceWithRawResponse(self._k8s.flavors) + + @cached_property + def clusters(self) -> ClustersResourceWithRawResponse: + return ClustersResourceWithRawResponse(self._k8s.clusters) + + +class AsyncK8sResourceWithRawResponse: + def __init__(self, k8s: AsyncK8sResource) -> None: + self._k8s = k8s + + self.list_versions = async_to_raw_response_wrapper( + k8s.list_versions, + ) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithRawResponse: + return AsyncFlavorsResourceWithRawResponse(self._k8s.flavors) + + @cached_property + def clusters(self) -> AsyncClustersResourceWithRawResponse: + return AsyncClustersResourceWithRawResponse(self._k8s.clusters) + + +class K8sResourceWithStreamingResponse: + def __init__(self, k8s: K8sResource) -> None: + self._k8s = k8s + + self.list_versions = to_streamed_response_wrapper( + k8s.list_versions, + ) + + @cached_property + def flavors(self) -> FlavorsResourceWithStreamingResponse: + return FlavorsResourceWithStreamingResponse(self._k8s.flavors) + + @cached_property + def clusters(self) -> ClustersResourceWithStreamingResponse: + return ClustersResourceWithStreamingResponse(self._k8s.clusters) + + +class AsyncK8sResourceWithStreamingResponse: + def __init__(self, k8s: AsyncK8sResource) -> None: + self._k8s = k8s + + self.list_versions = async_to_streamed_response_wrapper( + k8s.list_versions, + ) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse: + return AsyncFlavorsResourceWithStreamingResponse(self._k8s.flavors) + + @cached_property + def clusters(self) -> AsyncClustersResourceWithStreamingResponse: + return AsyncClustersResourceWithStreamingResponse(self._k8s.clusters) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 8ef5d635..586c4473 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -65,6 +65,7 @@ from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .fixed_address_short import FixedAddressShort as FixedAddressShort from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily +from .k8s_cluster_version import K8sClusterVersion as K8sClusterVersion from .network_list_params import NetworkListParams as NetworkListParams from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus @@ -116,6 +117,7 @@ from .file_share_create_params import FileShareCreateParams as FileShareCreateParams from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams from .file_share_update_params import FileShareUpdateParams as FileShareUpdateParams +from .k8s_cluster_version_list import K8sClusterVersionList as K8sClusterVersionList from .load_balancer_get_params import LoadBalancerGetParams as LoadBalancerGetParams from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams diff --git a/src/gcore/types/cloud/k8s/__init__.py b/src/gcore/types/cloud/k8s/__init__.py new file mode 100644 index 00000000..2ce45d68 --- /dev/null +++ b/src/gcore/types/cloud/k8s/__init__.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .k8s_cluster import K8sCluster as K8sCluster +from .k8s_cluster_list import K8sClusterList as K8sClusterList +from .flavor_list_params import FlavorListParams as FlavorListParams +from .cluster_create_params import ClusterCreateParams as ClusterCreateParams +from .cluster_delete_params import ClusterDeleteParams as ClusterDeleteParams +from .cluster_update_params import ClusterUpdateParams as ClusterUpdateParams +from .cluster_upgrade_params import ClusterUpgradeParams as ClusterUpgradeParams +from .k8s_cluster_kubeconfig import K8sClusterKubeconfig as K8sClusterKubeconfig +from .k8s_cluster_certificate import K8sClusterCertificate as K8sClusterCertificate diff --git a/src/gcore/types/cloud/k8s/cluster_create_params.py b/src/gcore/types/cloud/k8s/cluster_create_params.py new file mode 100644 index 00000000..d7c9497b --- /dev/null +++ b/src/gcore/types/cloud/k8s/cluster_create_params.py @@ -0,0 +1,299 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam + +__all__ = [ + "ClusterCreateParams", + "Pool", + "Authentication", + "AuthenticationOidc", + "Cni", + "CniCilium", + "Csi", + "CsiNfs", + "DDOSProfile", + "DDOSProfileField", + "Logging", +] + + +class ClusterCreateParams(TypedDict, total=False): + project_id: int + + region_id: int + + keypair: Required[str] + """The keypair of the cluster""" + + name: Required[str] + """The name of the cluster""" + + pools: Required[Iterable[Pool]] + """The pools of the cluster""" + + version: Required[str] + """The version of the k8s cluster""" + + authentication: Optional[Authentication] + """Authentication settings""" + + autoscaler_config: Optional[Dict[str, str]] + """ + Cluster autoscaler configuration. It allows you to override the default + cluster-autoscaler parameters provided by the platform with your preferred + values. Supported parameters (in alphabetical order): + + - balance-similar-node-groups (boolean: true/false) - Detect similar node groups + and balance the number of nodes between them. + - expander (string: random, most-pods, least-waste, price, priority, grpc) - + Type of node group expander to be used in scale up. Specifying multiple values + separated by commas will call the expanders in succession until there is only + one option remaining. + - expendable-pods-priority-cutoff (float) - Pods with priority below cutoff will + be expendable. They can be killed without any consideration during scale down + and they don't cause scale up. Pods with null priority (PodPriority disabled) + are non expendable. + - ignore-daemonsets-utilization (boolean: true/false) - Should CA ignore + DaemonSet pods when calculating resource utilization for scaling down. + - max-empty-bulk-delete (integer) - Maximum number of empty nodes that can be + deleted at the same time. + - max-graceful-termination-sec (integer) - Maximum number of seconds CA waits + for pod termination when trying to scale down a node. + - max-node-provision-time (duration: e.g., '15m') - The default maximum time CA + waits for node to be provisioned - the value can be overridden per node group. + - max-total-unready-percentage (float) - Maximum percentage of unready nodes in + the cluster. After this is exceeded, CA halts operations. + - new-pod-scale-up-delay (duration: e.g., '10s') - Pods less than this old will + not be considered for scale-up. Can be increased for individual pods through + annotation. + - ok-total-unready-count (integer) - Number of allowed unready nodes, + irrespective of max-total-unready-percentage. + - scale-down-delay-after-add (duration: e.g., '10m') - How long after scale up + that scale down evaluation resumes. + - scale-down-delay-after-delete (duration: e.g., '10s') - How long after node + deletion that scale down evaluation resumes. + - scale-down-delay-after-failure (duration: e.g., '3m') - How long after scale + down failure that scale down evaluation resumes. + - scale-down-enabled (boolean: true/false) - Should CA scale down the cluster. + - scale-down-unneeded-time (duration: e.g., '10m') - How long a node should be + unneeded before it is eligible for scale down. + - scale-down-unready-time (duration: e.g., '20m') - How long an unready node + should be unneeded before it is eligible for scale down. + - scale-down-utilization-threshold (float) - The maximum value between the sum + of cpu requests and sum of memory requests of all pods running on the node + divided by node's corresponding allocatable resource, below which a node can + be considered for scale down. + - scan-interval (duration: e.g., '10s') - How often cluster is reevaluated for + scale up or down. + - skip-nodes-with-custom-controller-pods (boolean: true/false) - If true cluster + autoscaler will never delete nodes with pods owned by custom controllers. + - skip-nodes-with-local-storage (boolean: true/false) - If true cluster + autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir + or HostPath. + - skip-nodes-with-system-pods (boolean: true/false) - If true cluster autoscaler + will never delete nodes with pods from kube-system (except for DaemonSet or + mirror pods). + """ + + cni: Optional[Cni] + """Cluster CNI settings""" + + csi: Csi + """Container Storage Interface (CSI) driver settings""" + + ddos_profile: Optional[DDOSProfile] + """Advanced DDoS Protection profile""" + + fixed_network: Optional[str] + """The network of the cluster""" + + fixed_subnet: Optional[str] + """The subnet of the cluster""" + + is_ipv6: Optional[bool] + """Enable public v6 address""" + + logging: Optional[Logging] + """Logging configuration""" + + pods_ip_pool: Optional[str] + """The IP pool for the pods""" + + pods_ipv6_pool: Optional[str] + """The IPv6 pool for the pods""" + + services_ip_pool: Optional[str] + """The IP pool for the services""" + + services_ipv6_pool: Optional[str] + """The IPv6 pool for the services""" + + +class Pool(TypedDict, total=False): + flavor_id: Required[str] + """Flavor ID""" + + min_node_count: Required[int] + """Minimum node count""" + + name: Required[str] + """Pool's name""" + + auto_healing_enabled: Optional[bool] + """Enable auto healing""" + + boot_volume_size: Optional[int] + """Boot volume size""" + + boot_volume_type: Optional[Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]] + """Boot volume type""" + + crio_config: Optional[Dict[str, str]] + """Cri-o configuration for pool nodes""" + + is_public_ipv4: Optional[bool] + """Enable public v4 address""" + + kubelet_config: Optional[Dict[str, str]] + """Kubelet configuration for pool nodes""" + + labels: Optional[Dict[str, str]] + """Labels applied to the cluster pool""" + + max_node_count: Optional[int] + """Maximum node count""" + + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] + """Server group policy: anti-affinity, soft-anti-affinity or affinity""" + + taints: Optional[Dict[str, str]] + """Taints applied to the cluster pool""" + + +class AuthenticationOidc(TypedDict, total=False): + client_id: Optional[str] + """Client ID""" + + groups_claim: Optional[str] + """JWT claim to use as the user's group""" + + groups_prefix: Optional[str] + """Prefix prepended to group claims""" + + issuer_url: Optional[str] + """Issuer URL""" + + required_claims: Optional[Dict[str, str]] + """Key-value pairs that describe required claims in the token""" + + signing_algs: Optional[ + List[Literal["ES256", "ES384", "ES512", "PS256", "PS384", "PS512", "RS256", "RS384", "RS512"]] + ] + """Accepted signing algorithms""" + + username_claim: Optional[str] + """JWT claim to use as the user name""" + + username_prefix: Optional[str] + """Prefix prepended to username claims to prevent clashes""" + + +class Authentication(TypedDict, total=False): + oidc: Optional[AuthenticationOidc] + """OIDC authentication settings""" + + +class CniCilium(TypedDict, total=False): + encryption: bool + """Wireguard encryption""" + + hubble_relay: bool + """Hubble Relay""" + + hubble_ui: bool + """Hubble UI""" + + lb_acceleration: bool + """LoadBalancer acceleration""" + + lb_mode: Literal["dsr", "hybrid", "snat"] + """LoadBalancer mode""" + + mask_size: int + """Mask size for IPv4""" + + mask_size_v6: int + """Mask size for IPv6""" + + routing_mode: Literal["native", "tunnel"] + """Routing mode""" + + tunnel: Literal["", "geneve", "vxlan"] + """CNI provider""" + + +class Cni(TypedDict, total=False): + cilium: Optional[CniCilium] + """Cilium settings""" + + provider: Literal["calico", "cilium"] + """CNI provider""" + + +class CsiNfs(TypedDict, total=False): + vast_enabled: bool + """Enable or disable VAST NFS integration. + + The default value is `false`. When set to `true`, a dedicated StorageClass will + be created in the cluster for each VAST NFS file share defined in the cloud. All + file shares created prior to cluster creation will be available immediately, + while those created afterward may take a few minutes for to appear. + """ + + +class Csi(TypedDict, total=False): + nfs: CsiNfs + """NFS CSI driver settings""" + + +class DDOSProfileField(TypedDict, total=False): + base_field: Required[int] + + field_value: object + """Complex value. Only one of 'value' or '`field_value`' must be specified""" + + value: Optional[str] + """Basic value. Only one of 'value' or '`field_value`' must be specified""" + + +class DDOSProfile(TypedDict, total=False): + enabled: Required[bool] + """Enable advanced DDoS protection""" + + fields: Iterable[DDOSProfileField] + """DDoS profile parameters""" + + profile_template: Optional[int] + """DDoS profile template ID""" + + profile_template_name: Optional[str] + """DDoS profile template name""" + + +class Logging(TypedDict, total=False): + destination_region_id: Optional[int] + """Destination region id to which the logs will be written""" + + enabled: bool + """Enable/disable forwarding logs to LaaS""" + + retention_policy: Optional[LaasIndexRetentionPolicyParam] + """The logs retention policy""" + + topic_name: Optional[str] + """The topic name to which the logs will be written""" diff --git a/src/gcore/types/cloud/k8s/cluster_delete_params.py b/src/gcore/types/cloud/k8s/cluster_delete_params.py new file mode 100644 index 00000000..49b5e580 --- /dev/null +++ b/src/gcore/types/cloud/k8s/cluster_delete_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ClusterDeleteParams"] + + +class ClusterDeleteParams(TypedDict, total=False): + project_id: int + + region_id: int + + volumes: str + """Comma separated list of volume IDs to be deleted with the cluster""" diff --git a/src/gcore/types/cloud/k8s/cluster_update_params.py b/src/gcore/types/cloud/k8s/cluster_update_params.py new file mode 100644 index 00000000..74a40789 --- /dev/null +++ b/src/gcore/types/cloud/k8s/cluster_update_params.py @@ -0,0 +1,203 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam + +__all__ = [ + "ClusterUpdateParams", + "Authentication", + "AuthenticationOidc", + "Cni", + "CniCilium", + "DDOSProfile", + "DDOSProfileField", + "Logging", +] + + +class ClusterUpdateParams(TypedDict, total=False): + project_id: int + + region_id: int + + authentication: Optional[Authentication] + """Authentication settings""" + + autoscaler_config: Optional[Dict[str, str]] + """ + Cluster autoscaler configuration. It allows you to override the default + cluster-autoscaler parameters provided by the platform with your preferred + values. Supported parameters (in alphabetical order): + + - balance-similar-node-groups (boolean: true/false) - Detect similar node groups + and balance the number of nodes between them. + - expander (string: random, most-pods, least-waste, price, priority, grpc) - + Type of node group expander to be used in scale up. Specifying multiple values + separated by commas will call the expanders in succession until there is only + one option remaining. + - expendable-pods-priority-cutoff (float) - Pods with priority below cutoff will + be expendable. They can be killed without any consideration during scale down + and they don't cause scale up. Pods with null priority (PodPriority disabled) + are non expendable. + - ignore-daemonsets-utilization (boolean: true/false) - Should CA ignore + DaemonSet pods when calculating resource utilization for scaling down. + - max-empty-bulk-delete (integer) - Maximum number of empty nodes that can be + deleted at the same time. + - max-graceful-termination-sec (integer) - Maximum number of seconds CA waits + for pod termination when trying to scale down a node. + - max-node-provision-time (duration: e.g., '15m') - The default maximum time CA + waits for node to be provisioned - the value can be overridden per node group. + - max-total-unready-percentage (float) - Maximum percentage of unready nodes in + the cluster. After this is exceeded, CA halts operations. + - new-pod-scale-up-delay (duration: e.g., '10s') - Pods less than this old will + not be considered for scale-up. Can be increased for individual pods through + annotation. + - ok-total-unready-count (integer) - Number of allowed unready nodes, + irrespective of max-total-unready-percentage. + - scale-down-delay-after-add (duration: e.g., '10m') - How long after scale up + that scale down evaluation resumes. + - scale-down-delay-after-delete (duration: e.g., '10s') - How long after node + deletion that scale down evaluation resumes. + - scale-down-delay-after-failure (duration: e.g., '3m') - How long after scale + down failure that scale down evaluation resumes. + - scale-down-enabled (boolean: true/false) - Should CA scale down the cluster. + - scale-down-unneeded-time (duration: e.g., '10m') - How long a node should be + unneeded before it is eligible for scale down. + - scale-down-unready-time (duration: e.g., '20m') - How long an unready node + should be unneeded before it is eligible for scale down. + - scale-down-utilization-threshold (float) - The maximum value between the sum + of cpu requests and sum of memory requests of all pods running on the node + divided by node's corresponding allocatable resource, below which a node can + be considered for scale down. + - scan-interval (duration: e.g., '10s') - How often cluster is reevaluated for + scale up or down. + - skip-nodes-with-custom-controller-pods (boolean: true/false) - If true cluster + autoscaler will never delete nodes with pods owned by custom controllers. + - skip-nodes-with-local-storage (boolean: true/false) - If true cluster + autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir + or HostPath. + - skip-nodes-with-system-pods (boolean: true/false) - If true cluster autoscaler + will never delete nodes with pods from kube-system (except for DaemonSet or + mirror pods). + """ + + cni: Optional[Cni] + """Cluster CNI settings""" + + ddos_profile: Optional[DDOSProfile] + """Advanced DDoS Protection profile""" + + logging: Optional[Logging] + """Logging configuration""" + + +class AuthenticationOidc(TypedDict, total=False): + client_id: Optional[str] + """Client ID""" + + groups_claim: Optional[str] + """JWT claim to use as the user's group""" + + groups_prefix: Optional[str] + """Prefix prepended to group claims""" + + issuer_url: Optional[str] + """Issuer URL""" + + required_claims: Optional[Dict[str, str]] + """Key-value pairs that describe required claims in the token""" + + signing_algs: Optional[ + List[Literal["ES256", "ES384", "ES512", "PS256", "PS384", "PS512", "RS256", "RS384", "RS512"]] + ] + """Accepted signing algorithms""" + + username_claim: Optional[str] + """JWT claim to use as the user name""" + + username_prefix: Optional[str] + """Prefix prepended to username claims to prevent clashes""" + + +class Authentication(TypedDict, total=False): + oidc: Optional[AuthenticationOidc] + """OIDC authentication settings""" + + +class CniCilium(TypedDict, total=False): + encryption: bool + """Wireguard encryption""" + + hubble_relay: bool + """Hubble Relay""" + + hubble_ui: bool + """Hubble UI""" + + lb_acceleration: bool + """LoadBalancer acceleration""" + + lb_mode: Literal["dsr", "hybrid", "snat"] + """LoadBalancer mode""" + + mask_size: int + """Mask size for IPv4""" + + mask_size_v6: int + """Mask size for IPv6""" + + routing_mode: Literal["native", "tunnel"] + """Routing mode""" + + tunnel: Literal["", "geneve", "vxlan"] + """CNI provider""" + + +class Cni(TypedDict, total=False): + cilium: Optional[CniCilium] + """Cilium settings""" + + provider: Literal["calico", "cilium"] + """CNI provider""" + + +class DDOSProfileField(TypedDict, total=False): + base_field: Required[int] + + field_value: object + """Complex value. Only one of 'value' or '`field_value`' must be specified""" + + value: Optional[str] + """Basic value. Only one of 'value' or '`field_value`' must be specified""" + + +class DDOSProfile(TypedDict, total=False): + enabled: Required[bool] + """Enable advanced DDoS protection""" + + fields: Iterable[DDOSProfileField] + """DDoS profile parameters""" + + profile_template: Optional[int] + """DDoS profile template ID""" + + profile_template_name: Optional[str] + """DDoS profile template name""" + + +class Logging(TypedDict, total=False): + destination_region_id: Optional[int] + """Destination region id to which the logs will be written""" + + enabled: bool + """Enable/disable forwarding logs to LaaS""" + + retention_policy: Optional[LaasIndexRetentionPolicyParam] + """The logs retention policy""" + + topic_name: Optional[str] + """The topic name to which the logs will be written""" diff --git a/src/gcore/types/cloud/k8s/cluster_upgrade_params.py b/src/gcore/types/cloud/k8s/cluster_upgrade_params.py new file mode 100644 index 00000000..5301fc15 --- /dev/null +++ b/src/gcore/types/cloud/k8s/cluster_upgrade_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ClusterUpgradeParams"] + + +class ClusterUpgradeParams(TypedDict, total=False): + project_id: int + + region_id: int + + version: Required[str] + """Target k8s cluster version""" diff --git a/src/gcore/types/cloud/k8s/clusters/__init__.py b/src/gcore/types/cloud/k8s/clusters/__init__.py new file mode 100644 index 00000000..0ffb0b08 --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .k8s_cluster_pool import K8sClusterPool as K8sClusterPool +from .node_list_params import NodeListParams as NodeListParams +from .pool_create_params import PoolCreateParams as PoolCreateParams +from .pool_resize_params import PoolResizeParams as PoolResizeParams +from .pool_update_params import PoolUpdateParams as PoolUpdateParams +from .k8s_cluster_pool_list import K8sClusterPoolList as K8sClusterPoolList diff --git a/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool.py b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool.py new file mode 100644 index 00000000..d8aa59e6 --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool.py @@ -0,0 +1,66 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from ....._models import BaseModel + +__all__ = ["K8sClusterPool"] + + +class K8sClusterPool(BaseModel): + id: str + """UUID of the cluster pool""" + + auto_healing_enabled: bool + """Indicates the status of auto healing""" + + boot_volume_size: int + """Size of the boot volume""" + + boot_volume_type: str + """Type of the boot volume""" + + created_at: str + """Date of function creation""" + + crio_config: Dict[str, str] + """Crio configuration for pool nodes""" + + flavor_id: str + """ID of the cluster pool flavor""" + + is_public_ipv4: bool + """Indicates if the pool is public""" + + kubelet_config: Dict[str, str] + """Kubelet configuration for pool nodes""" + + labels: Dict[str, str] + """Labels applied to the cluster pool""" + + max_node_count: int + """Maximum node count in the cluster pool""" + + min_node_count: int + """Minimum node count in the cluster pool""" + + name: str + """Name of the cluster pool""" + + node_count: int + """Node count in the cluster pool""" + + status: str + """Status of the cluster pool""" + + taints: Dict[str, str] + """Taints applied to the cluster pool""" + + servergroup_id: Optional[str] = None + """Server group ID""" + + servergroup_name: Optional[str] = None + """Server group name""" + + servergroup_policy: Optional[str] = None + """Anti-affinity, affinity or soft-anti-affinity server group policy""" diff --git a/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py new file mode 100644 index 00000000..9ec5299d --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ....._models import BaseModel +from .k8s_cluster_pool import K8sClusterPool + +__all__ = ["K8sClusterPoolList"] + + +class K8sClusterPoolList(BaseModel): + count: int + """Number of objects""" + + results: List[K8sClusterPool] + """Objects""" diff --git a/src/gcore/types/cloud/k8s/clusters/node_list_params.py b/src/gcore/types/cloud/k8s/clusters/node_list_params.py new file mode 100644 index 00000000..027c6cf4 --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/node_list_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["NodeListParams"] + + +class NodeListParams(TypedDict, total=False): + project_id: int + + region_id: int + + with_ddos: bool + """Include DDoS profile information if set to true. Default is false.""" diff --git a/src/gcore/types/cloud/k8s/clusters/pool_create_params.py b/src/gcore/types/cloud/k8s/clusters/pool_create_params.py new file mode 100644 index 00000000..f7b626a9 --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/pool_create_params.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["PoolCreateParams"] + + +class PoolCreateParams(TypedDict, total=False): + project_id: int + + region_id: int + + flavor_id: Required[str] + """Flavor ID""" + + min_node_count: Required[int] + """Minimum node count""" + + name: Required[str] + """Pool's name""" + + auto_healing_enabled: Optional[bool] + """Enable auto healing""" + + boot_volume_size: Optional[int] + """Boot volume size""" + + boot_volume_type: Optional[Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]] + """Boot volume type""" + + crio_config: Optional[Dict[str, str]] + """Cri-o configuration for pool nodes""" + + is_public_ipv4: Optional[bool] + """Enable public v4 address""" + + kubelet_config: Optional[Dict[str, str]] + """Kubelet configuration for pool nodes""" + + labels: Optional[Dict[str, str]] + """Labels applied to the cluster pool""" + + max_node_count: Optional[int] + """Maximum node count""" + + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] + """Server group policy: anti-affinity, soft-anti-affinity or affinity""" + + taints: Optional[Dict[str, str]] + """Taints applied to the cluster pool""" diff --git a/src/gcore/types/cloud/k8s/clusters/pool_resize_params.py b/src/gcore/types/cloud/k8s/clusters/pool_resize_params.py new file mode 100644 index 00000000..60450f3e --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/pool_resize_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_extensions import Required, TypedDict + +__all__ = ["PoolResizeParams"] + + +class PoolResizeParams(TypedDict, total=False): + project_id: int + + region_id: int + + cluster_name: Required[str] + + node_count: Required[int] + """Target node count""" diff --git a/src/gcore/types/cloud/k8s/clusters/pool_update_params.py b/src/gcore/types/cloud/k8s/clusters/pool_update_params.py new file mode 100644 index 00000000..877e80ca --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/pool_update_params.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["PoolUpdateParams"] + + +class PoolUpdateParams(TypedDict, total=False): + project_id: int + + region_id: int + + cluster_name: Required[str] + + auto_healing_enabled: Optional[bool] + """Enable/disable auto healing""" + + labels: Optional[Dict[str, str]] + """Labels applied to the cluster pool""" + + max_node_count: Optional[int] + """Maximum node count""" + + min_node_count: Optional[int] + """Minimum node count""" + + node_count: Optional[int] + """Current node count""" + + taints: Optional[Dict[str, str]] + """Taints applied to the cluster pool""" diff --git a/src/gcore/types/cloud/k8s/clusters/pools/__init__.py b/src/gcore/types/cloud/k8s/clusters/pools/__init__.py new file mode 100644 index 00000000..b0b7da06 --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/pools/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .node_list_params import NodeListParams as NodeListParams diff --git a/src/gcore/types/cloud/k8s/clusters/pools/node_list_params.py b/src/gcore/types/cloud/k8s/clusters/pools/node_list_params.py new file mode 100644 index 00000000..9a31c51b --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/pools/node_list_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_extensions import Required, TypedDict + +__all__ = ["NodeListParams"] + + +class NodeListParams(TypedDict, total=False): + project_id: int + + region_id: int + + cluster_name: Required[str] + + with_ddos: bool + """Include DDoS profile information if set to true. Default is false.""" diff --git a/src/gcore/types/cloud/k8s/flavor_list_params.py b/src/gcore/types/cloud/k8s/flavor_list_params.py new file mode 100644 index 00000000..26890db9 --- /dev/null +++ b/src/gcore/types/cloud/k8s/flavor_list_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_extensions import TypedDict + +__all__ = ["FlavorListParams"] + + +class FlavorListParams(TypedDict, total=False): + project_id: int + + region_id: int + + exclude_gpu: bool + """Set to false to include GPU flavors. Default is True.""" + + include_prices: bool + """Set to true to include flavor prices. Default is False.""" diff --git a/src/gcore/types/cloud/k8s/k8s_cluster.py b/src/gcore/types/cloud/k8s/k8s_cluster.py new file mode 100644 index 00000000..621ef6e5 --- /dev/null +++ b/src/gcore/types/cloud/k8s/k8s_cluster.py @@ -0,0 +1,209 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..logging import Logging +from ...._models import BaseModel +from .clusters.k8s_cluster_pool import K8sClusterPool + +__all__ = [ + "K8sCluster", + "Csi", + "CsiNfs", + "Authentication", + "AuthenticationOidc", + "Cni", + "CniCilium", + "DDOSProfile", + "DDOSProfileField", +] + + +class CsiNfs(BaseModel): + vast_enabled: bool + """Indicates the status of VAST NFS integration""" + + +class Csi(BaseModel): + nfs: CsiNfs + """NFS settings""" + + +class AuthenticationOidc(BaseModel): + client_id: Optional[str] = None + """Client ID""" + + groups_claim: Optional[str] = None + """JWT claim to use as the user's group""" + + groups_prefix: Optional[str] = None + """Prefix prepended to group claims""" + + issuer_url: Optional[str] = None + """Issuer URL""" + + required_claims: Optional[Dict[str, str]] = None + """Key-value pairs that describe required claims in the token""" + + signing_algs: Optional[ + List[Literal["ES256", "ES384", "ES512", "PS256", "PS384", "PS512", "RS256", "RS384", "RS512"]] + ] = None + """Accepted signing algorithms""" + + username_claim: Optional[str] = None + """JWT claim to use as the user name""" + + username_prefix: Optional[str] = None + """Prefix prepended to username claims to prevent clashes""" + + +class Authentication(BaseModel): + kubeconfig_created_at: Optional[datetime] = None + """Kubeconfig creation date""" + + kubeconfig_expires_at: Optional[datetime] = None + """Kubeconfig expiration date""" + + oidc: Optional[AuthenticationOidc] = None + """OIDC authentication settings""" + + +class CniCilium(BaseModel): + encryption: Optional[bool] = None + """Wireguard encryption""" + + hubble_relay: Optional[bool] = None + """Hubble Relay""" + + hubble_ui: Optional[bool] = None + """Hubble UI""" + + lb_acceleration: Optional[bool] = None + """LoadBalancer acceleration""" + + lb_mode: Optional[Literal["dsr", "hybrid", "snat"]] = None + """LoadBalancer mode""" + + mask_size: Optional[int] = None + """Mask size for IPv4""" + + mask_size_v6: Optional[int] = None + """Mask size for IPv6""" + + routing_mode: Optional[Literal["native", "tunnel"]] = None + """Routing mode""" + + tunnel: Optional[Literal["", "geneve", "vxlan"]] = None + """CNI provider""" + + +class Cni(BaseModel): + cilium: Optional[CniCilium] = None + """Cilium settings""" + + provider: Optional[Literal["calico", "cilium"]] = None + """CNI provider""" + + +class DDOSProfileField(BaseModel): + base_field: int + + field_value: Optional[object] = None + """Complex value. Only one of 'value' or '`field_value`' must be specified""" + + value: Optional[str] = None + """Basic value. Only one of 'value' or '`field_value`' must be specified""" + + +class DDOSProfile(BaseModel): + enabled: bool + """Enable advanced DDoS protection""" + + fields: Optional[List[DDOSProfileField]] = None + """DDoS profile parameters""" + + profile_template: Optional[int] = None + """DDoS profile template ID""" + + profile_template_name: Optional[str] = None + """DDoS profile template name""" + + +class K8sCluster(BaseModel): + id: str + """Cluster pool uuid""" + + created_at: str + """Function creation date""" + + csi: Csi + """Cluster CSI settings""" + + is_public: bool + """Cluster is public""" + + keypair: str + """Keypair""" + + logging: Optional[Logging] = None + """Logging configuration""" + + name: str + """Name""" + + pools: List[K8sClusterPool] + """pools""" + + status: Literal["Deleting", "Provisioned", "Provisioning"] + """Status""" + + version: str + """K8s version""" + + authentication: Optional[Authentication] = None + """Cluster authentication settings""" + + autoscaler_config: Optional[Dict[str, str]] = None + """ + Cluster autoscaler configuration. It contains overrides to the default + cluster-autoscaler parameters provided by the platform. + """ + + cni: Optional[Cni] = None + """Cluster CNI settings""" + + creator_task_id: Optional[str] = None + """Task that created this entity""" + + ddos_profile: Optional[DDOSProfile] = None + """Advanced DDoS Protection profile""" + + fixed_network: Optional[str] = None + """Fixed network id""" + + fixed_subnet: Optional[str] = None + """Fixed subnet id""" + + is_ipv6: Optional[bool] = None + """Enable public v6 address""" + + pods_ip_pool: Optional[str] = None + """The IP pool for the pods""" + + pods_ipv6_pool: Optional[str] = None + """The IPv6 pool for the pods""" + + services_ip_pool: Optional[str] = None + """The IP pool for the services""" + + services_ipv6_pool: Optional[str] = None + """The IPv6 pool for the services""" + + task_id: Optional[str] = None + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. + """ diff --git a/src/gcore/types/cloud/k8s/k8s_cluster_certificate.py b/src/gcore/types/cloud/k8s/k8s_cluster_certificate.py new file mode 100644 index 00000000..c7965b6c --- /dev/null +++ b/src/gcore/types/cloud/k8s/k8s_cluster_certificate.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ...._models import BaseModel + +__all__ = ["K8sClusterCertificate"] + + +class K8sClusterCertificate(BaseModel): + certificate: str + """Cluster CA certificate""" + + key: str + """Cluster CA private key""" diff --git a/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py b/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py new file mode 100644 index 00000000..38aaabe4 --- /dev/null +++ b/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["K8sClusterKubeconfig"] + + +class K8sClusterKubeconfig(BaseModel): + config: str + """Cluster kubeconfig""" + + created_at: Optional[datetime] = None + """Kubeconfig creation date""" + + expires_at: Optional[datetime] = None + """Kubeconfig expiration date""" diff --git a/src/gcore/types/cloud/k8s/k8s_cluster_list.py b/src/gcore/types/cloud/k8s/k8s_cluster_list.py new file mode 100644 index 00000000..b3ed3df7 --- /dev/null +++ b/src/gcore/types/cloud/k8s/k8s_cluster_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .k8s_cluster import K8sCluster + +__all__ = ["K8sClusterList"] + + +class K8sClusterList(BaseModel): + count: int + """Number of objects""" + + results: List[K8sCluster] + """Objects""" diff --git a/src/gcore/types/cloud/k8s_cluster_version.py b/src/gcore/types/cloud/k8s_cluster_version.py new file mode 100644 index 00000000..6f8c1ddf --- /dev/null +++ b/src/gcore/types/cloud/k8s_cluster_version.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["K8sClusterVersion"] + + +class K8sClusterVersion(BaseModel): + version: str + """List of supported Kubernetes cluster versions""" diff --git a/src/gcore/types/cloud/k8s_cluster_version_list.py b/src/gcore/types/cloud/k8s_cluster_version_list.py new file mode 100644 index 00000000..27a17073 --- /dev/null +++ b/src/gcore/types/cloud/k8s_cluster_version_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .k8s_cluster_version import K8sClusterVersion + +__all__ = ["K8sClusterVersionList"] + + +class K8sClusterVersionList(BaseModel): + count: int + """Number of objects""" + + results: List[K8sClusterVersion] + """Objects""" diff --git a/tests/api_resources/cloud/k8s/__init__.py b/tests/api_resources/cloud/k8s/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/k8s/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/k8s/clusters/__init__.py b/tests/api_resources/cloud/k8s/clusters/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/k8s/clusters/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/k8s/clusters/pools/__init__.py b/tests/api_resources/cloud/k8s/clusters/pools/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/k8s/clusters/pools/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/k8s/clusters/pools/test_nodes.py b/tests/api_resources/cloud/k8s/clusters/pools/test_nodes.py new file mode 100644 index 00000000..1f283cc8 --- /dev/null +++ b/tests/api_resources/cloud/k8s/clusters/pools/test_nodes.py @@ -0,0 +1,306 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import InstanceList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestNodes: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + node = client.cloud.k8s.clusters.pools.nodes.list( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert_matches_type(InstanceList, node, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + node = client.cloud.k8s.clusters.pools.nodes.list( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + with_ddos=True, + ) + assert_matches_type(InstanceList, node, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.pools.nodes.with_raw_response.list( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + node = response.parse() + assert_matches_type(InstanceList, node, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.pools.nodes.with_streaming_response.list( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + node = response.parse() + assert_matches_type(InstanceList, node, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.pools.nodes.with_raw_response.list( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): + client.cloud.k8s.clusters.pools.nodes.with_raw_response.list( + pool_name="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + node = client.cloud.k8s.clusters.pools.nodes.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + pool_name="pool_name", + ) + assert node is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + pool_name="pool_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + node = response.parse() + assert node is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.pools.nodes.with_streaming_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + pool_name="pool_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + node = response.parse() + assert node is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="", + pool_name="pool_name", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): + client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + pool_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( + instance_id="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + pool_name="pool_name", + ) + + +class TestAsyncNodes: + 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: + node = await async_client.cloud.k8s.clusters.pools.nodes.list( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert_matches_type(InstanceList, node, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + node = await async_client.cloud.k8s.clusters.pools.nodes.list( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + with_ddos=True, + ) + assert_matches_type(InstanceList, node, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.list( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + node = await response.parse() + assert_matches_type(InstanceList, node, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.pools.nodes.with_streaming_response.list( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + node = await response.parse() + assert_matches_type(InstanceList, node, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.list( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.list( + pool_name="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + node = await async_client.cloud.k8s.clusters.pools.nodes.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + pool_name="pool_name", + ) + assert node is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + pool_name="pool_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + node = await response.parse() + assert node is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.pools.nodes.with_streaming_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + pool_name="pool_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + node = await response.parse() + assert node is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="", + pool_name="pool_name", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + pool_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( + instance_id="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + pool_name="pool_name", + ) diff --git a/tests/api_resources/cloud/k8s/clusters/test_nodes.py b/tests/api_resources/cloud/k8s/clusters/test_nodes.py new file mode 100644 index 00000000..624fdf56 --- /dev/null +++ b/tests/api_resources/cloud/k8s/clusters/test_nodes.py @@ -0,0 +1,252 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import InstanceList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestNodes: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + node = client.cloud.k8s.clusters.nodes.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(InstanceList, node, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + node = client.cloud.k8s.clusters.nodes.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + with_ddos=True, + ) + assert_matches_type(InstanceList, node, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.nodes.with_raw_response.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + node = response.parse() + assert_matches_type(InstanceList, node, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.nodes.with_streaming_response.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + node = response.parse() + assert_matches_type(InstanceList, node, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.nodes.with_raw_response.list( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + node = client.cloud.k8s.clusters.nodes.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert node is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.nodes.with_raw_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + node = response.parse() + assert node is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.nodes.with_streaming_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + node = response.parse() + assert node is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.nodes.with_raw_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.k8s.clusters.nodes.with_raw_response.delete( + instance_id="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + +class TestAsyncNodes: + 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: + node = await async_client.cloud.k8s.clusters.nodes.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(InstanceList, node, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + node = await async_client.cloud.k8s.clusters.nodes.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + with_ddos=True, + ) + assert_matches_type(InstanceList, node, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.nodes.with_raw_response.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + node = await response.parse() + assert_matches_type(InstanceList, node, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.nodes.with_streaming_response.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + node = await response.parse() + assert_matches_type(InstanceList, node, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.nodes.with_raw_response.list( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + node = await async_client.cloud.k8s.clusters.nodes.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert node is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.nodes.with_raw_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + node = await response.parse() + assert node is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.nodes.with_streaming_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + node = await response.parse() + assert node is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.nodes.with_raw_response.delete( + instance_id="instance_id", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.k8s.clusters.nodes.with_raw_response.delete( + instance_id="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) diff --git a/tests/api_resources/cloud/k8s/clusters/test_pools.py b/tests/api_resources/cloud/k8s/clusters/test_pools.py new file mode 100644 index 00000000..e8e7e5b8 --- /dev/null +++ b/tests/api_resources/cloud/k8s/clusters/test_pools.py @@ -0,0 +1,786 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.k8s.clusters import ( + K8sClusterPool, + K8sClusterPoolList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPools: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + pool = client.cloud.k8s.clusters.pools.create( + cluster_name="cluster_name", + project_id=0, + region_id=0, + flavor_id="g1-standard-1-2", + min_node_count=3, + name="my-pool", + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + pool = client.cloud.k8s.clusters.pools.create( + cluster_name="cluster_name", + project_id=0, + region_id=0, + flavor_id="g1-standard-1-2", + min_node_count=3, + name="my-pool", + auto_healing_enabled=True, + boot_volume_size=50, + boot_volume_type="ssd_hiiops", + crio_config={"default-ulimits": "nofile=1024:2048"}, + is_public_ipv4=True, + kubelet_config={"podMaxPids": "4096"}, + labels={"my-label": "foo"}, + max_node_count=5, + servergroup_policy="affinity", + taints={"my-taint": "bar:NoSchedule"}, + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.pools.with_raw_response.create( + cluster_name="cluster_name", + project_id=0, + region_id=0, + flavor_id="g1-standard-1-2", + min_node_count=3, + name="my-pool", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.pools.with_streaming_response.create( + cluster_name="cluster_name", + project_id=0, + region_id=0, + flavor_id="g1-standard-1-2", + min_node_count=3, + name="my-pool", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.pools.with_raw_response.create( + cluster_name="", + project_id=0, + region_id=0, + flavor_id="g1-standard-1-2", + min_node_count=3, + name="my-pool", + ) + + @parametrize + def test_method_update(self, client: Gcore) -> None: + pool = client.cloud.k8s.clusters.pools.update( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + pool = client.cloud.k8s.clusters.pools.update( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + auto_healing_enabled=True, + labels={"my-label": "foo"}, + max_node_count=3, + min_node_count=1, + node_count=2, + taints={"my-taint": "bar:NoSchedule"}, + ) + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.pools.with_raw_response.update( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.pools.with_streaming_response.update( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.pools.with_raw_response.update( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): + client.cloud.k8s.clusters.pools.with_raw_response.update( + pool_name="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + pool = client.cloud.k8s.clusters.pools.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(K8sClusterPoolList, pool, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.pools.with_raw_response.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(K8sClusterPoolList, pool, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.pools.with_streaming_response.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(K8sClusterPoolList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.pools.with_raw_response.list( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + pool = client.cloud.k8s.clusters.pools.delete( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.pools.with_raw_response.delete( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.pools.with_streaming_response.delete( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.pools.with_raw_response.delete( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): + client.cloud.k8s.clusters.pools.with_raw_response.delete( + pool_name="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + pool = client.cloud.k8s.clusters.pools.get( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.pools.with_raw_response.get( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.pools.with_streaming_response.get( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.pools.with_raw_response.get( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): + client.cloud.k8s.clusters.pools.with_raw_response.get( + pool_name="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + @parametrize + def test_method_resize(self, client: Gcore) -> None: + pool = client.cloud.k8s.clusters.pools.resize( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + node_count=2, + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_raw_response_resize(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.pools.with_raw_response.resize( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + node_count=2, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + def test_streaming_response_resize(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.pools.with_streaming_response.resize( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + node_count=2, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_resize(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.pools.with_raw_response.resize( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="", + node_count=2, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): + client.cloud.k8s.clusters.pools.with_raw_response.resize( + pool_name="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + node_count=2, + ) + + +class TestAsyncPools: + 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: + pool = await async_client.cloud.k8s.clusters.pools.create( + cluster_name="cluster_name", + project_id=0, + region_id=0, + flavor_id="g1-standard-1-2", + min_node_count=3, + name="my-pool", + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.k8s.clusters.pools.create( + cluster_name="cluster_name", + project_id=0, + region_id=0, + flavor_id="g1-standard-1-2", + min_node_count=3, + name="my-pool", + auto_healing_enabled=True, + boot_volume_size=50, + boot_volume_type="ssd_hiiops", + crio_config={"default-ulimits": "nofile=1024:2048"}, + is_public_ipv4=True, + kubelet_config={"podMaxPids": "4096"}, + labels={"my-label": "foo"}, + max_node_count=5, + servergroup_policy="affinity", + taints={"my-taint": "bar:NoSchedule"}, + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.pools.with_raw_response.create( + cluster_name="cluster_name", + project_id=0, + region_id=0, + flavor_id="g1-standard-1-2", + min_node_count=3, + name="my-pool", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.pools.with_streaming_response.create( + cluster_name="cluster_name", + project_id=0, + region_id=0, + flavor_id="g1-standard-1-2", + min_node_count=3, + name="my-pool", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.with_raw_response.create( + cluster_name="", + project_id=0, + region_id=0, + flavor_id="g1-standard-1-2", + min_node_count=3, + name="my-pool", + ) + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.k8s.clusters.pools.update( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.k8s.clusters.pools.update( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + auto_healing_enabled=True, + labels={"my-label": "foo"}, + max_node_count=3, + min_node_count=1, + node_count=2, + taints={"my-taint": "bar:NoSchedule"}, + ) + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.pools.with_raw_response.update( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.pools.with_streaming_response.update( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.with_raw_response.update( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.with_raw_response.update( + pool_name="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.k8s.clusters.pools.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(K8sClusterPoolList, pool, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.pools.with_raw_response.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(K8sClusterPoolList, pool, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.pools.with_streaming_response.list( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(K8sClusterPoolList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.with_raw_response.list( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.k8s.clusters.pools.delete( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.pools.with_raw_response.delete( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.pools.with_streaming_response.delete( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.with_raw_response.delete( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.with_raw_response.delete( + pool_name="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.k8s.clusters.pools.get( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.pools.with_raw_response.get( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.pools.with_streaming_response.get( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(K8sClusterPool, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.with_raw_response.get( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.with_raw_response.get( + pool_name="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + @parametrize + async def test_method_resize(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.k8s.clusters.pools.resize( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + node_count=2, + ) + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.pools.with_raw_response.resize( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + node_count=2, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + @parametrize + async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.pools.with_streaming_response.resize( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="cluster_name", + node_count=2, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(TaskIDList, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_resize(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.with_raw_response.resize( + pool_name="pool_name", + project_id=0, + region_id=0, + cluster_name="", + node_count=2, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): + await async_client.cloud.k8s.clusters.pools.with_raw_response.resize( + pool_name="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + node_count=2, + ) diff --git a/tests/api_resources/cloud/k8s/test_clusters.py b/tests/api_resources/cloud/k8s/test_clusters.py new file mode 100644 index 00000000..1cb521cd --- /dev/null +++ b/tests/api_resources/cloud/k8s/test_clusters.py @@ -0,0 +1,1168 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import TaskIDList, K8sClusterVersionList +from gcore.types.cloud.k8s import ( + K8sCluster, + K8sClusterList, + K8sClusterKubeconfig, + K8sClusterCertificate, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestClusters: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + cluster = client.cloud.k8s.clusters.create( + project_id=0, + region_id=0, + keypair="some_keypair", + name="string", + pools=[ + { + "flavor_id": "g1-standard-1-2", + "min_node_count": 3, + "name": "my-pool", + } + ], + version="1.28.1", + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + cluster = client.cloud.k8s.clusters.create( + project_id=0, + region_id=0, + keypair="some_keypair", + name="string", + pools=[ + { + "flavor_id": "g1-standard-1-2", + "min_node_count": 3, + "name": "my-pool", + "auto_healing_enabled": True, + "boot_volume_size": 50, + "boot_volume_type": "ssd_hiiops", + "crio_config": {"default-ulimits": "nofile=1024:2048"}, + "is_public_ipv4": True, + "kubelet_config": {"podMaxPids": "4096"}, + "labels": {"my-label": "foo"}, + "max_node_count": 5, + "servergroup_policy": "affinity", + "taints": {"my-taint": "bar:NoSchedule"}, + } + ], + version="1.28.1", + authentication={ + "oidc": { + "client_id": "kubernetes", + "groups_claim": "groups", + "groups_prefix": "oidc:", + "issuer_url": "https://accounts.provider.example", + "required_claims": {"claim": "value"}, + "signing_algs": ["RS256", "RS512"], + "username_claim": "sub", + "username_prefix": "oidc:", + } + }, + autoscaler_config={"scale-down-unneeded-time": "5m"}, + cni={ + "cilium": { + "encryption": True, + "hubble_relay": True, + "hubble_ui": True, + "lb_acceleration": True, + "lb_mode": "snat", + "mask_size": 24, + "mask_size_v6": 120, + "routing_mode": "tunnel", + "tunnel": "geneve", + }, + "provider": "cilium", + }, + csi={"nfs": {"vast_enabled": True}}, + ddos_profile={ + "enabled": True, + "fields": [ + { + "base_field": 10, + "field_value": [45046, 45047], + "value": "value", + } + ], + "profile_template": 29, + "profile_template_name": "profile_template_name", + }, + fixed_network="3fa85f64-5717-4562-b3fc-2c963f66afa6", + fixed_subnet="3fa85f64-5717-4562-b3fc-2c963f66afa6", + is_ipv6=True, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + pods_ip_pool="172.16.0.0/18", + pods_ipv6_pool="2a03:90c0:88:393::/64", + services_ip_pool="172.24.0.0/18", + services_ipv6_pool="2a03:90c0:88:381::/108", + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.with_raw_response.create( + project_id=0, + region_id=0, + keypair="some_keypair", + name="string", + pools=[ + { + "flavor_id": "g1-standard-1-2", + "min_node_count": 3, + "name": "my-pool", + } + ], + version="1.28.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.with_streaming_response.create( + project_id=0, + region_id=0, + keypair="some_keypair", + name="string", + pools=[ + { + "flavor_id": "g1-standard-1-2", + "min_node_count": 3, + "name": "my-pool", + } + ], + version="1.28.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + cluster = client.cloud.k8s.clusters.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + cluster = client.cloud.k8s.clusters.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + authentication={ + "oidc": { + "client_id": "kubernetes", + "groups_claim": "groups", + "groups_prefix": "oidc:", + "issuer_url": "https://accounts.provider.example", + "required_claims": {"claim": "value"}, + "signing_algs": ["RS256", "RS512"], + "username_claim": "sub", + "username_prefix": "oidc:", + } + }, + autoscaler_config={"scale-down-unneeded-time": "5m"}, + cni={ + "cilium": { + "encryption": True, + "hubble_relay": True, + "hubble_ui": True, + "lb_acceleration": True, + "lb_mode": "snat", + "mask_size": 24, + "mask_size_v6": 120, + "routing_mode": "tunnel", + "tunnel": "geneve", + }, + "provider": "cilium", + }, + ddos_profile={ + "enabled": True, + "fields": [ + { + "base_field": 10, + "field_value": [45046, 45047], + "value": "value", + } + ], + "profile_template": 29, + "profile_template_name": "profile_template_name", + }, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.with_raw_response.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.with_streaming_response.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.with_raw_response.update( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + cluster = client.cloud.k8s.clusters.list( + project_id=0, + region_id=0, + ) + assert_matches_type(K8sClusterList, cluster, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(K8sClusterList, cluster, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(K8sClusterList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + cluster = client.cloud.k8s.clusters.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_method_delete_with_all_params(self, client: Gcore) -> None: + cluster = client.cloud.k8s.clusters.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + volumes="volumes", + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.with_raw_response.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.with_streaming_response.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.with_raw_response.delete( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + cluster = client.cloud.k8s.clusters.get( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(K8sCluster, cluster, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.with_raw_response.get( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(K8sCluster, cluster, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.with_streaming_response.get( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(K8sCluster, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.with_raw_response.get( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get_certificate(self, client: Gcore) -> None: + cluster = client.cloud.k8s.clusters.get_certificate( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(K8sClusterCertificate, cluster, path=["response"]) + + @parametrize + def test_raw_response_get_certificate(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.with_raw_response.get_certificate( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(K8sClusterCertificate, cluster, path=["response"]) + + @parametrize + def test_streaming_response_get_certificate(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.with_streaming_response.get_certificate( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(K8sClusterCertificate, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_certificate(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.with_raw_response.get_certificate( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get_kubeconfig(self, client: Gcore) -> None: + cluster = client.cloud.k8s.clusters.get_kubeconfig( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(K8sClusterKubeconfig, cluster, path=["response"]) + + @parametrize + def test_raw_response_get_kubeconfig(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.with_raw_response.get_kubeconfig( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(K8sClusterKubeconfig, cluster, path=["response"]) + + @parametrize + def test_streaming_response_get_kubeconfig(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.with_streaming_response.get_kubeconfig( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(K8sClusterKubeconfig, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_kubeconfig(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.with_raw_response.get_kubeconfig( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_list_versions_for_upgrade(self, client: Gcore) -> None: + cluster = client.cloud.k8s.clusters.list_versions_for_upgrade( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(K8sClusterVersionList, cluster, path=["response"]) + + @parametrize + def test_raw_response_list_versions_for_upgrade(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.with_raw_response.list_versions_for_upgrade( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(K8sClusterVersionList, cluster, path=["response"]) + + @parametrize + def test_streaming_response_list_versions_for_upgrade(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.with_streaming_response.list_versions_for_upgrade( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(K8sClusterVersionList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list_versions_for_upgrade(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.with_raw_response.list_versions_for_upgrade( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_upgrade(self, client: Gcore) -> None: + cluster = client.cloud.k8s.clusters.upgrade( + cluster_name="cluster_name", + project_id=0, + region_id=0, + version="v1.28.1", + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_raw_response_upgrade(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.with_raw_response.upgrade( + cluster_name="cluster_name", + project_id=0, + region_id=0, + version="v1.28.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_streaming_response_upgrade(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.with_streaming_response.upgrade( + cluster_name="cluster_name", + project_id=0, + region_id=0, + version="v1.28.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_upgrade(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.k8s.clusters.with_raw_response.upgrade( + cluster_name="", + project_id=0, + region_id=0, + version="v1.28.1", + ) + + +class TestAsyncClusters: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.k8s.clusters.create( + project_id=0, + region_id=0, + keypair="some_keypair", + name="string", + pools=[ + { + "flavor_id": "g1-standard-1-2", + "min_node_count": 3, + "name": "my-pool", + } + ], + version="1.28.1", + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.k8s.clusters.create( + project_id=0, + region_id=0, + keypair="some_keypair", + name="string", + pools=[ + { + "flavor_id": "g1-standard-1-2", + "min_node_count": 3, + "name": "my-pool", + "auto_healing_enabled": True, + "boot_volume_size": 50, + "boot_volume_type": "ssd_hiiops", + "crio_config": {"default-ulimits": "nofile=1024:2048"}, + "is_public_ipv4": True, + "kubelet_config": {"podMaxPids": "4096"}, + "labels": {"my-label": "foo"}, + "max_node_count": 5, + "servergroup_policy": "affinity", + "taints": {"my-taint": "bar:NoSchedule"}, + } + ], + version="1.28.1", + authentication={ + "oidc": { + "client_id": "kubernetes", + "groups_claim": "groups", + "groups_prefix": "oidc:", + "issuer_url": "https://accounts.provider.example", + "required_claims": {"claim": "value"}, + "signing_algs": ["RS256", "RS512"], + "username_claim": "sub", + "username_prefix": "oidc:", + } + }, + autoscaler_config={"scale-down-unneeded-time": "5m"}, + cni={ + "cilium": { + "encryption": True, + "hubble_relay": True, + "hubble_ui": True, + "lb_acceleration": True, + "lb_mode": "snat", + "mask_size": 24, + "mask_size_v6": 120, + "routing_mode": "tunnel", + "tunnel": "geneve", + }, + "provider": "cilium", + }, + csi={"nfs": {"vast_enabled": True}}, + ddos_profile={ + "enabled": True, + "fields": [ + { + "base_field": 10, + "field_value": [45046, 45047], + "value": "value", + } + ], + "profile_template": 29, + "profile_template_name": "profile_template_name", + }, + fixed_network="3fa85f64-5717-4562-b3fc-2c963f66afa6", + fixed_subnet="3fa85f64-5717-4562-b3fc-2c963f66afa6", + is_ipv6=True, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + pods_ip_pool="172.16.0.0/18", + pods_ipv6_pool="2a03:90c0:88:393::/64", + services_ip_pool="172.24.0.0/18", + services_ipv6_pool="2a03:90c0:88:381::/108", + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.with_raw_response.create( + project_id=0, + region_id=0, + keypair="some_keypair", + name="string", + pools=[ + { + "flavor_id": "g1-standard-1-2", + "min_node_count": 3, + "name": "my-pool", + } + ], + version="1.28.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.with_streaming_response.create( + project_id=0, + region_id=0, + keypair="some_keypair", + name="string", + pools=[ + { + "flavor_id": "g1-standard-1-2", + "min_node_count": 3, + "name": "my-pool", + } + ], + version="1.28.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.k8s.clusters.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.k8s.clusters.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + authentication={ + "oidc": { + "client_id": "kubernetes", + "groups_claim": "groups", + "groups_prefix": "oidc:", + "issuer_url": "https://accounts.provider.example", + "required_claims": {"claim": "value"}, + "signing_algs": ["RS256", "RS512"], + "username_claim": "sub", + "username_prefix": "oidc:", + } + }, + autoscaler_config={"scale-down-unneeded-time": "5m"}, + cni={ + "cilium": { + "encryption": True, + "hubble_relay": True, + "hubble_ui": True, + "lb_acceleration": True, + "lb_mode": "snat", + "mask_size": 24, + "mask_size_v6": 120, + "routing_mode": "tunnel", + "tunnel": "geneve", + }, + "provider": "cilium", + }, + ddos_profile={ + "enabled": True, + "fields": [ + { + "base_field": 10, + "field_value": [45046, 45047], + "value": "value", + } + ], + "profile_template": 29, + "profile_template_name": "profile_template_name", + }, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.with_raw_response.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.with_streaming_response.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.with_raw_response.update( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.k8s.clusters.list( + project_id=0, + region_id=0, + ) + assert_matches_type(K8sClusterList, cluster, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(K8sClusterList, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(K8sClusterList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.k8s.clusters.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.k8s.clusters.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + volumes="volumes", + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.with_raw_response.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.with_streaming_response.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.with_raw_response.delete( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.k8s.clusters.get( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(K8sCluster, cluster, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.with_raw_response.get( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(K8sCluster, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.with_streaming_response.get( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(K8sCluster, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.with_raw_response.get( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get_certificate(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.k8s.clusters.get_certificate( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(K8sClusterCertificate, cluster, path=["response"]) + + @parametrize + async def test_raw_response_get_certificate(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.with_raw_response.get_certificate( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(K8sClusterCertificate, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_get_certificate(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.with_streaming_response.get_certificate( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(K8sClusterCertificate, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_certificate(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.with_raw_response.get_certificate( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get_kubeconfig(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.k8s.clusters.get_kubeconfig( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(K8sClusterKubeconfig, cluster, path=["response"]) + + @parametrize + async def test_raw_response_get_kubeconfig(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.with_raw_response.get_kubeconfig( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(K8sClusterKubeconfig, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_get_kubeconfig(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.with_streaming_response.get_kubeconfig( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(K8sClusterKubeconfig, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_kubeconfig(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.with_raw_response.get_kubeconfig( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.k8s.clusters.list_versions_for_upgrade( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(K8sClusterVersionList, cluster, path=["response"]) + + @parametrize + async def test_raw_response_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.with_raw_response.list_versions_for_upgrade( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(K8sClusterVersionList, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.with_streaming_response.list_versions_for_upgrade( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(K8sClusterVersionList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.with_raw_response.list_versions_for_upgrade( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_upgrade(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.k8s.clusters.upgrade( + cluster_name="cluster_name", + project_id=0, + region_id=0, + version="v1.28.1", + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_raw_response_upgrade(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.with_raw_response.upgrade( + cluster_name="cluster_name", + project_id=0, + region_id=0, + version="v1.28.1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_upgrade(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.with_streaming_response.upgrade( + cluster_name="cluster_name", + project_id=0, + region_id=0, + version="v1.28.1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_upgrade(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.k8s.clusters.with_raw_response.upgrade( + cluster_name="", + project_id=0, + region_id=0, + version="v1.28.1", + ) diff --git a/tests/api_resources/cloud/k8s/test_flavors.py b/tests/api_resources/cloud/k8s/test_flavors.py new file mode 100644 index 00000000..4aabd062 --- /dev/null +++ b/tests/api_resources/cloud/k8s/test_flavors.py @@ -0,0 +1,112 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import BaremetalFlavorList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFlavors: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + flavor = client.cloud.k8s.flavors.list( + project_id=0, + region_id=0, + ) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + flavor = client.cloud.k8s.flavors.list( + project_id=0, + region_id=0, + exclude_gpu=True, + include_prices=True, + ) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.k8s.flavors.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = response.parse() + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.k8s.flavors.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = response.parse() + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFlavors: + 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: + flavor = await async_client.cloud.k8s.flavors.list( + project_id=0, + region_id=0, + ) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.k8s.flavors.list( + project_id=0, + region_id=0, + exclude_gpu=True, + include_prices=True, + ) + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.flavors.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = await response.parse() + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.flavors.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = await response.parse() + assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_k8s.py b/tests/api_resources/cloud/test_k8s.py new file mode 100644 index 00000000..6bd73971 --- /dev/null +++ b/tests/api_resources/cloud/test_k8s.py @@ -0,0 +1,92 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import K8sClusterVersionList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestK8s: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list_versions(self, client: Gcore) -> None: + k8 = client.cloud.k8s.list_versions( + project_id=0, + region_id=0, + ) + assert_matches_type(K8sClusterVersionList, k8, path=["response"]) + + @parametrize + def test_raw_response_list_versions(self, client: Gcore) -> None: + response = client.cloud.k8s.with_raw_response.list_versions( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + k8 = response.parse() + assert_matches_type(K8sClusterVersionList, k8, path=["response"]) + + @parametrize + def test_streaming_response_list_versions(self, client: Gcore) -> None: + with client.cloud.k8s.with_streaming_response.list_versions( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + k8 = response.parse() + assert_matches_type(K8sClusterVersionList, k8, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncK8s: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list_versions(self, async_client: AsyncGcore) -> None: + k8 = await async_client.cloud.k8s.list_versions( + project_id=0, + region_id=0, + ) + assert_matches_type(K8sClusterVersionList, k8, path=["response"]) + + @parametrize + async def test_raw_response_list_versions(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.with_raw_response.list_versions( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + k8 = await response.parse() + assert_matches_type(K8sClusterVersionList, k8, path=["response"]) + + @parametrize + async def test_streaming_response_list_versions(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.with_streaming_response.list_versions( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + k8 = await response.parse() + assert_matches_type(K8sClusterVersionList, k8, path=["response"]) + + assert cast(Any, response.is_closed) is True From c25f15801f45520a5ea88a394c6806cb06601be4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 29 Aug 2025 12:09:28 +0000 Subject: [PATCH 273/592] fix(waap): fix component name --- .stats.yml | 2 +- api.md | 1 + src/gcore/types/waap/domains/__init__.py | 1 + .../waap/domains/waap_count_statistics.py | 36 +++++++++++++++++++ .../waap/domains/waap_event_statistics.py | 36 ++----------------- 5 files changed, 42 insertions(+), 34 deletions(-) create mode 100644 src/gcore/types/waap/domains/waap_count_statistics.py diff --git a/.stats.yml b/.stats.yml index 2184224a..d620c339 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 501 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1a7494f99877ef48b0e33fb55f803ff97fe3618d2379c345c9393afad72c9e90.yml openapi_spec_hash: 8ae4c37eea00eed48dce435bfe4c69c7 -config_hash: 9d0ce90d14c257c153d93d848144a8da +config_hash: 65f8c27ffbdf12f24eb5e494694697b5 diff --git a/api.md b/api.md index cd189332..b492d989 100644 --- a/api.md +++ b/api.md @@ -1143,6 +1143,7 @@ Types: ```python from gcore.types.waap.domains import ( WaapBlockedStatistics, + WaapCountStatistics, WaapDDOSAttack, WaapDDOSInfo, WaapEventStatistics, diff --git a/src/gcore/types/waap/domains/__init__.py b/src/gcore/types/waap/domains/__init__.py index ecd5f716..905ada2a 100644 --- a/src/gcore/types/waap/domains/__init__.py +++ b/src/gcore/types/waap/domains/__init__.py @@ -19,6 +19,7 @@ from .waap_request_summary import WaapRequestSummary as WaapRequestSummary from .waap_traffic_metrics import WaapTrafficMetrics as WaapTrafficMetrics from .setting_update_params import SettingUpdateParams as SettingUpdateParams +from .waap_count_statistics import WaapCountStatistics as WaapCountStatistics from .waap_event_statistics import WaapEventStatistics as WaapEventStatistics from .api_path_create_params import APIPathCreateParams as APIPathCreateParams from .api_path_update_params import APIPathUpdateParams as APIPathUpdateParams diff --git a/src/gcore/types/waap/domains/waap_count_statistics.py b/src/gcore/types/waap/domains/waap_count_statistics.py new file mode 100644 index 00000000..eea255ff --- /dev/null +++ b/src/gcore/types/waap/domains/waap_count_statistics.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union + +from ...._models import BaseModel + +__all__ = ["WaapCountStatistics"] + + +class WaapCountStatistics(BaseModel): + action: List[List[Union[str, int]]] + """A collection of event counts per action. + + The first item is the action's abbreviation/full action name, and the second + item is the number of events + """ + + country: List[List[Union[str, int]]] + """A collection of event counts per country of origin. + + The first item is the country's ISO 3166-1 alpha-2, and the second item is the + number of events + """ + + org: List[List[Union[str, int]]] + """A collection of event counts per organization that owns the event's client IP. + + The first item is the organization's name, and the second item is the number of + events + """ + + rule_name: List[List[Union[str, int]]] + """A collection of event counts per rule that triggered the event. + + The first item is the rule's name, and the second item is the number of events + """ diff --git a/src/gcore/types/waap/domains/waap_event_statistics.py b/src/gcore/types/waap/domains/waap_event_statistics.py index 1e743ba5..26f34fba 100644 --- a/src/gcore/types/waap/domains/waap_event_statistics.py +++ b/src/gcore/types/waap/domains/waap_event_statistics.py @@ -1,45 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union - from ...._models import BaseModel +from .waap_count_statistics import WaapCountStatistics from .waap_blocked_statistics import WaapBlockedStatistics -__all__ = ["WaapEventStatistics", "Count"] - - -class Count(BaseModel): - action: List[List[Union[str, int]]] - """A collection of event counts per action. - - The first item is the action's abbreviation/full action name, and the second - item is the number of events - """ - - country: List[List[Union[str, int]]] - """A collection of event counts per country of origin. - - The first item is the country's ISO 3166-1 alpha-2, and the second item is the - number of events - """ - - org: List[List[Union[str, int]]] - """A collection of event counts per organization that owns the event's client IP. - - The first item is the organization's name, and the second item is the number of - events - """ - - rule_name: List[List[Union[str, int]]] - """A collection of event counts per rule that triggered the event. - - The first item is the rule's name, and the second item is the number of events - """ +__all__ = ["WaapEventStatistics"] class WaapEventStatistics(BaseModel): blocked: WaapBlockedStatistics """A collection of total numbers of events with blocked results per criteria""" - count: Count + count: WaapCountStatistics """A collection of total numbers of events per criteria""" From 74d924c6e2f8e353823fa4a7f65586a634b4e576 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 29 Aug 2025 15:16:13 +0000 Subject: [PATCH 274/592] fix(dns): fix dns methods --- .stats.yml | 2 +- api.md | 4 +- src/gcore/resources/dns/zones/rrsets.py | 266 +++++++-------- src/gcore/resources/dns/zones/zones.py | 314 +++++++++--------- src/gcore/types/dns/__init__.py | 2 +- ...pdate_params.py => zone_replace_params.py} | 4 +- src/gcore/types/dns/zones/__init__.py | 2 +- ...date_params.py => rrset_replace_params.py} | 4 +- tests/api_resources/dns/test_zones.py | 222 ++++++------- tests/api_resources/dns/zones/test_rrsets.py | 246 +++++++------- 10 files changed, 533 insertions(+), 533 deletions(-) rename src/gcore/types/dns/{zone_update_params.py => zone_replace_params.py} (95%) rename src/gcore/types/dns/zones/{rrset_update_params.py => rrset_replace_params.py} (95%) diff --git a/.stats.yml b/.stats.yml index d620c339..f5d1947a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 501 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1a7494f99877ef48b0e33fb55f803ff97fe3618d2379c345c9393afad72c9e90.yml openapi_spec_hash: 8ae4c37eea00eed48dce435bfe4c69c7 -config_hash: 65f8c27ffbdf12f24eb5e494694697b5 +config_hash: 7b3f93431b88defdad37f39dfa1a4fed diff --git a/api.md b/api.md index b492d989..933a1fad 100644 --- a/api.md +++ b/api.md @@ -1930,7 +1930,6 @@ from gcore.types.dns import ( Methods: - client.dns.zones.create(\*\*params) -> ZoneCreateResponse -- client.dns.zones.update(path_name, \*\*params) -> object - client.dns.zones.list(\*\*params) -> ZoneListResponse - client.dns.zones.delete(name) -> object - client.dns.zones.check_delegation_status(name) -> ZoneCheckDelegationStatusResponse @@ -1940,6 +1939,7 @@ Methods: - client.dns.zones.get(name) -> ZoneGetResponse - client.dns.zones.get_statistics(name, \*\*params) -> ZoneGetStatisticsResponse - client.dns.zones.import\_(zone_name, \*\*params) -> ZoneImportResponse +- client.dns.zones.replace(path_name, \*\*params) -> object ### Dnssec @@ -1970,8 +1970,8 @@ from gcore.types.dns.zones import ( Methods: - client.dns.zones.rrsets.create(rrset_type, \*, zone_name, rrset_name, \*\*params) -> DNSOutputRrset -- client.dns.zones.rrsets.update(rrset_type, \*, zone_name, rrset_name, \*\*params) -> DNSOutputRrset - client.dns.zones.rrsets.list(zone_name, \*\*params) -> RrsetListResponse - client.dns.zones.rrsets.delete(rrset_type, \*, zone_name, rrset_name) -> object - client.dns.zones.rrsets.get(rrset_type, \*, zone_name, rrset_name) -> DNSOutputRrset - 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 diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index 74c966e0..93697456 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -21,7 +21,7 @@ from ....types.dns.zones import ( rrset_list_params, rrset_create_params, - rrset_update_params, + rrset_replace_params, rrset_get_failover_logs_params, ) from ....types.dns.zones.dns_output_rrset import DNSOutputRrset @@ -223,66 +223,6 @@ def create( cast_to=DNSOutputRrset, ) - def update( - self, - rrset_type: str, - *, - zone_name: str, - rrset_name: str, - resource_records: Iterable[rrset_update_params.ResourceRecord], - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - pickers: Iterable[rrset_update_params.Picker] | NotGiven = NOT_GIVEN, - ttl: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSOutputRrset: - """ - Create/update RRset. - - Args: - resource_records: List of resource record from rrset - - meta: Meta information for rrset - - pickers: Set of pickers - - 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 zone_name: - raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") - if not rrset_name: - raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") - if not rrset_type: - raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") - return self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", - body=maybe_transform( - { - "resource_records": resource_records, - "meta": meta, - "pickers": pickers, - "ttl": ttl, - }, - rrset_update_params.RrsetUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=DNSOutputRrset, - ) - def list( self, zone_name: str, @@ -481,6 +421,66 @@ def get_failover_logs( cast_to=RrsetGetFailoverLogsResponse, ) + def replace( + self, + rrset_type: str, + *, + zone_name: str, + rrset_name: str, + resource_records: Iterable[rrset_replace_params.ResourceRecord], + meta: Dict[str, object] | NotGiven = NOT_GIVEN, + pickers: Iterable[rrset_replace_params.Picker] | NotGiven = NOT_GIVEN, + ttl: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DNSOutputRrset: + """ + Create/update RRset. + + Args: + resource_records: List of resource record from rrset + + meta: Meta information for rrset + + pickers: Set of pickers + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + if not rrset_name: + raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") + if not rrset_type: + raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") + return self._put( + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + body=maybe_transform( + { + "resource_records": resource_records, + "meta": meta, + "pickers": pickers, + "ttl": ttl, + }, + rrset_replace_params.RrsetReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSOutputRrset, + ) + class AsyncRrsetsResource(AsyncAPIResource): @cached_property @@ -674,66 +674,6 @@ async def create( cast_to=DNSOutputRrset, ) - async def update( - self, - rrset_type: str, - *, - zone_name: str, - rrset_name: str, - resource_records: Iterable[rrset_update_params.ResourceRecord], - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - pickers: Iterable[rrset_update_params.Picker] | NotGiven = NOT_GIVEN, - ttl: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DNSOutputRrset: - """ - Create/update RRset. - - Args: - resource_records: List of resource record from rrset - - meta: Meta information for rrset - - pickers: Set of pickers - - 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 zone_name: - raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") - if not rrset_name: - raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") - if not rrset_type: - raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") - return await self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", - body=await async_maybe_transform( - { - "resource_records": resource_records, - "meta": meta, - "pickers": pickers, - "ttl": ttl, - }, - rrset_update_params.RrsetUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=DNSOutputRrset, - ) - async def list( self, zone_name: str, @@ -932,6 +872,66 @@ async def get_failover_logs( cast_to=RrsetGetFailoverLogsResponse, ) + async def replace( + self, + rrset_type: str, + *, + zone_name: str, + rrset_name: str, + resource_records: Iterable[rrset_replace_params.ResourceRecord], + meta: Dict[str, object] | NotGiven = NOT_GIVEN, + pickers: Iterable[rrset_replace_params.Picker] | NotGiven = NOT_GIVEN, + ttl: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DNSOutputRrset: + """ + Create/update RRset. + + Args: + resource_records: List of resource record from rrset + + meta: Meta information for rrset + + pickers: Set of pickers + + 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 zone_name: + raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") + if not rrset_name: + raise ValueError(f"Expected a non-empty value for `rrset_name` but received {rrset_name!r}") + if not rrset_type: + raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") + return await self._put( + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + body=await async_maybe_transform( + { + "resource_records": resource_records, + "meta": meta, + "pickers": pickers, + "ttl": ttl, + }, + rrset_replace_params.RrsetReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSOutputRrset, + ) + class RrsetsResourceWithRawResponse: def __init__(self, rrsets: RrsetsResource) -> None: @@ -940,9 +940,6 @@ def __init__(self, rrsets: RrsetsResource) -> None: self.create = to_raw_response_wrapper( rrsets.create, ) - self.update = to_raw_response_wrapper( - rrsets.update, - ) self.list = to_raw_response_wrapper( rrsets.list, ) @@ -955,6 +952,9 @@ def __init__(self, rrsets: RrsetsResource) -> None: self.get_failover_logs = to_raw_response_wrapper( rrsets.get_failover_logs, ) + self.replace = to_raw_response_wrapper( + rrsets.replace, + ) class AsyncRrsetsResourceWithRawResponse: @@ -964,9 +964,6 @@ def __init__(self, rrsets: AsyncRrsetsResource) -> None: self.create = async_to_raw_response_wrapper( rrsets.create, ) - self.update = async_to_raw_response_wrapper( - rrsets.update, - ) self.list = async_to_raw_response_wrapper( rrsets.list, ) @@ -979,6 +976,9 @@ def __init__(self, rrsets: AsyncRrsetsResource) -> None: self.get_failover_logs = async_to_raw_response_wrapper( rrsets.get_failover_logs, ) + self.replace = async_to_raw_response_wrapper( + rrsets.replace, + ) class RrsetsResourceWithStreamingResponse: @@ -988,9 +988,6 @@ def __init__(self, rrsets: RrsetsResource) -> None: self.create = to_streamed_response_wrapper( rrsets.create, ) - self.update = to_streamed_response_wrapper( - rrsets.update, - ) self.list = to_streamed_response_wrapper( rrsets.list, ) @@ -1003,6 +1000,9 @@ def __init__(self, rrsets: RrsetsResource) -> None: self.get_failover_logs = to_streamed_response_wrapper( rrsets.get_failover_logs, ) + self.replace = to_streamed_response_wrapper( + rrsets.replace, + ) class AsyncRrsetsResourceWithStreamingResponse: @@ -1012,9 +1012,6 @@ def __init__(self, rrsets: AsyncRrsetsResource) -> None: self.create = async_to_streamed_response_wrapper( rrsets.create, ) - self.update = async_to_streamed_response_wrapper( - rrsets.update, - ) self.list = async_to_streamed_response_wrapper( rrsets.list, ) @@ -1027,3 +1024,6 @@ def __init__(self, rrsets: AsyncRrsetsResource) -> None: self.get_failover_logs = async_to_streamed_response_wrapper( rrsets.get_failover_logs, ) + self.replace = async_to_streamed_response_wrapper( + rrsets.replace, + ) diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index fa37f45e..88387455 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -38,7 +38,7 @@ zone_list_params, zone_create_params, zone_import_params, - zone_update_params, + zone_replace_params, zone_get_statistics_params, ) from ...._base_client import make_request_options @@ -165,95 +165,6 @@ def create( cast_to=ZoneCreateResponse, ) - def update( - self, - path_name: str, - *, - body_name: str, - contact: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expiry: int | NotGiven = NOT_GIVEN, - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - nx_ttl: int | NotGiven = NOT_GIVEN, - primary_server: str | NotGiven = NOT_GIVEN, - refresh: int | NotGiven = NOT_GIVEN, - retry: int | NotGiven = NOT_GIVEN, - serial: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this 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 DNS zone and SOA record. - - Args: - body_name: name of DNS zone - - contact: email address of the administrator responsible for this zone - - enabled: If a zone is disabled, then its records will not be resolved on dns servers - - expiry: number of seconds after which secondary name servers should stop answering - request for this zone - - meta: arbitrarily data of zone in json format you can specify `webhook` url and - `webhook_method` here webhook will get a map with three arrays: for created, - updated and deleted rrsets `webhook_method` can be omitted, POST will be used by - default - - nx_ttl: Time To Live of cache - - primary_server: primary master name server for zone - - refresh: number of seconds after which secondary name servers should query the master for - the SOA record, to detect zone changes. - - retry: number of seconds after which secondary name servers should retry to request the - serial number - - serial: Serial number for this zone or Timestamp of zone modification moment. If a - secondary name server slaved to this one observes an increase in this number, - the slave will assume that the zone has been updated and initiate a zone - transfer. - - 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 path_name: - raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") - return self._put( - f"/dns/v2/zones/{path_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{path_name}", - body=maybe_transform( - { - "body_name": body_name, - "contact": contact, - "enabled": enabled, - "expiry": expiry, - "meta": meta, - "nx_ttl": nx_ttl, - "primary_server": primary_server, - "refresh": refresh, - "retry": retry, - "serial": serial, - }, - zone_update_params.ZoneUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - def list( self, *, @@ -696,39 +607,11 @@ def import_( cast_to=ZoneImportResponse, ) - -class AsyncZonesResource(AsyncAPIResource): - @cached_property - def dnssec(self) -> AsyncDnssecResource: - return AsyncDnssecResource(self._client) - - @cached_property - def rrsets(self) -> AsyncRrsetsResource: - return AsyncRrsetsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncZonesResourceWithRawResponse: - """ - 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 AsyncZonesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncZonesResourceWithStreamingResponse: - """ - 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 AsyncZonesResourceWithStreamingResponse(self) - - async def create( + def replace( self, + path_name: str, *, - name: str, + body_name: str, contact: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expiry: int | NotGiven = NOT_GIVEN, @@ -744,12 +627,12 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ZoneCreateResponse: + ) -> object: """ - Add DNS zone. + Update DNS zone and SOA record. Args: - name: name of DNS zone + body_name: name of DNS zone contact: email address of the administrator responsible for this zone @@ -786,11 +669,15 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._post( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", - body=await async_maybe_transform( + if not path_name: + raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") + return self._put( + f"/dns/v2/zones/{path_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{path_name}", + body=maybe_transform( { - "name": name, + "body_name": body_name, "contact": contact, "enabled": enabled, "expiry": expiry, @@ -801,19 +688,47 @@ async def create( "retry": retry, "serial": serial, }, - zone_create_params.ZoneCreateParams, + zone_replace_params.ZoneReplaceParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ZoneCreateResponse, + cast_to=object, ) - async def update( + +class AsyncZonesResource(AsyncAPIResource): + @cached_property + def dnssec(self) -> AsyncDnssecResource: + return AsyncDnssecResource(self._client) + + @cached_property + def rrsets(self) -> AsyncRrsetsResource: + return AsyncRrsetsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncZonesResourceWithRawResponse: + """ + 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 AsyncZonesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncZonesResourceWithStreamingResponse: + """ + 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 AsyncZonesResourceWithStreamingResponse(self) + + async def create( self, - path_name: str, *, - body_name: str, + name: str, contact: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expiry: int | NotGiven = NOT_GIVEN, @@ -829,12 +744,12 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> ZoneCreateResponse: """ - Update DNS zone and SOA record. + Add DNS zone. Args: - body_name: name of DNS zone + name: name of DNS zone contact: email address of the administrator responsible for this zone @@ -871,15 +786,11 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not path_name: - raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") - return await self._put( - f"/dns/v2/zones/{path_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{path_name}", + return await self._post( + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", body=await async_maybe_transform( { - "body_name": body_name, + "name": name, "contact": contact, "enabled": enabled, "expiry": expiry, @@ -890,12 +801,12 @@ async def update( "retry": retry, "serial": serial, }, - zone_update_params.ZoneUpdateParams, + zone_create_params.ZoneCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=ZoneCreateResponse, ) async def list( @@ -1340,6 +1251,95 @@ async def import_( cast_to=ZoneImportResponse, ) + async def replace( + self, + path_name: str, + *, + body_name: str, + contact: str | NotGiven = NOT_GIVEN, + enabled: bool | NotGiven = NOT_GIVEN, + expiry: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | NotGiven = NOT_GIVEN, + nx_ttl: int | NotGiven = NOT_GIVEN, + primary_server: str | NotGiven = NOT_GIVEN, + refresh: int | NotGiven = NOT_GIVEN, + retry: int | NotGiven = NOT_GIVEN, + serial: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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 DNS zone and SOA record. + + Args: + body_name: name of DNS zone + + contact: email address of the administrator responsible for this zone + + enabled: If a zone is disabled, then its records will not be resolved on dns servers + + expiry: number of seconds after which secondary name servers should stop answering + request for this zone + + meta: arbitrarily data of zone in json format you can specify `webhook` url and + `webhook_method` here webhook will get a map with three arrays: for created, + updated and deleted rrsets `webhook_method` can be omitted, POST will be used by + default + + nx_ttl: Time To Live of cache + + primary_server: primary master name server for zone + + refresh: number of seconds after which secondary name servers should query the master for + the SOA record, to detect zone changes. + + retry: number of seconds after which secondary name servers should retry to request the + serial number + + serial: Serial number for this zone or Timestamp of zone modification moment. If a + secondary name server slaved to this one observes an increase in this number, + the slave will assume that the zone has been updated and initiate a zone + transfer. + + 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 path_name: + raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") + return await self._put( + f"/dns/v2/zones/{path_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{path_name}", + body=await async_maybe_transform( + { + "body_name": body_name, + "contact": contact, + "enabled": enabled, + "expiry": expiry, + "meta": meta, + "nx_ttl": nx_ttl, + "primary_server": primary_server, + "refresh": refresh, + "retry": retry, + "serial": serial, + }, + zone_replace_params.ZoneReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + class ZonesResourceWithRawResponse: def __init__(self, zones: ZonesResource) -> None: @@ -1348,9 +1348,6 @@ def __init__(self, zones: ZonesResource) -> None: self.create = to_raw_response_wrapper( zones.create, ) - self.update = to_raw_response_wrapper( - zones.update, - ) self.list = to_raw_response_wrapper( zones.list, ) @@ -1378,6 +1375,9 @@ def __init__(self, zones: ZonesResource) -> None: self.import_ = to_raw_response_wrapper( zones.import_, ) + self.replace = to_raw_response_wrapper( + zones.replace, + ) @cached_property def dnssec(self) -> DnssecResourceWithRawResponse: @@ -1395,9 +1395,6 @@ def __init__(self, zones: AsyncZonesResource) -> None: self.create = async_to_raw_response_wrapper( zones.create, ) - self.update = async_to_raw_response_wrapper( - zones.update, - ) self.list = async_to_raw_response_wrapper( zones.list, ) @@ -1425,6 +1422,9 @@ def __init__(self, zones: AsyncZonesResource) -> None: self.import_ = async_to_raw_response_wrapper( zones.import_, ) + self.replace = async_to_raw_response_wrapper( + zones.replace, + ) @cached_property def dnssec(self) -> AsyncDnssecResourceWithRawResponse: @@ -1442,9 +1442,6 @@ def __init__(self, zones: ZonesResource) -> None: self.create = to_streamed_response_wrapper( zones.create, ) - self.update = to_streamed_response_wrapper( - zones.update, - ) self.list = to_streamed_response_wrapper( zones.list, ) @@ -1472,6 +1469,9 @@ def __init__(self, zones: ZonesResource) -> None: self.import_ = to_streamed_response_wrapper( zones.import_, ) + self.replace = to_streamed_response_wrapper( + zones.replace, + ) @cached_property def dnssec(self) -> DnssecResourceWithStreamingResponse: @@ -1489,9 +1489,6 @@ def __init__(self, zones: AsyncZonesResource) -> None: self.create = async_to_streamed_response_wrapper( zones.create, ) - self.update = async_to_streamed_response_wrapper( - zones.update, - ) self.list = async_to_streamed_response_wrapper( zones.list, ) @@ -1519,6 +1516,9 @@ def __init__(self, zones: AsyncZonesResource) -> None: self.import_ = async_to_streamed_response_wrapper( zones.import_, ) + self.replace = async_to_streamed_response_wrapper( + zones.replace, + ) @cached_property def dnssec(self) -> AsyncDnssecResourceWithStreamingResponse: diff --git a/src/gcore/types/dns/__init__.py b/src/gcore/types/dns/__init__.py index 86e0f4f8..f72384a3 100644 --- a/src/gcore/types/dns/__init__.py +++ b/src/gcore/types/dns/__init__.py @@ -11,8 +11,8 @@ 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 .zone_update_params import ZoneUpdateParams as ZoneUpdateParams from .dns_lookup_response import DNSLookupResponse as DNSLookupResponse +from .zone_replace_params import ZoneReplaceParams as ZoneReplaceParams from .metric_list_response import MetricListResponse as MetricListResponse from .picker_list_response import PickerListResponse as PickerListResponse from .zone_create_response import ZoneCreateResponse as ZoneCreateResponse diff --git a/src/gcore/types/dns/zone_update_params.py b/src/gcore/types/dns/zone_replace_params.py similarity index 95% rename from src/gcore/types/dns/zone_update_params.py rename to src/gcore/types/dns/zone_replace_params.py index 7ea73f7f..43ab2045 100644 --- a/src/gcore/types/dns/zone_update_params.py +++ b/src/gcore/types/dns/zone_replace_params.py @@ -7,10 +7,10 @@ from ..._utils import PropertyInfo -__all__ = ["ZoneUpdateParams"] +__all__ = ["ZoneReplaceParams"] -class ZoneUpdateParams(TypedDict, total=False): +class ZoneReplaceParams(TypedDict, total=False): body_name: Required[Annotated[str, PropertyInfo(alias="name")]] """name of DNS zone""" diff --git a/src/gcore/types/dns/zones/__init__.py b/src/gcore/types/dns/zones/__init__.py index 5f06e205..23fa909e 100644 --- a/src/gcore/types/dns/zones/__init__.py +++ b/src/gcore/types/dns/zones/__init__.py @@ -8,8 +8,8 @@ from .dnssec_get_response import DnssecGetResponse as DnssecGetResponse from .rrset_create_params import RrsetCreateParams as RrsetCreateParams from .rrset_list_response import RrsetListResponse as RrsetListResponse -from .rrset_update_params import RrsetUpdateParams as RrsetUpdateParams from .dnssec_update_params import DnssecUpdateParams as DnssecUpdateParams +from .rrset_replace_params import RrsetReplaceParams as RrsetReplaceParams from .dnssec_update_response import DnssecUpdateResponse as DnssecUpdateResponse from .rrset_get_failover_logs_params import RrsetGetFailoverLogsParams as RrsetGetFailoverLogsParams from .rrset_get_failover_logs_response import RrsetGetFailoverLogsResponse as RrsetGetFailoverLogsResponse diff --git a/src/gcore/types/dns/zones/rrset_update_params.py b/src/gcore/types/dns/zones/rrset_replace_params.py similarity index 95% rename from src/gcore/types/dns/zones/rrset_update_params.py rename to src/gcore/types/dns/zones/rrset_replace_params.py index 3f91030f..e258f9b9 100644 --- a/src/gcore/types/dns/zones/rrset_update_params.py +++ b/src/gcore/types/dns/zones/rrset_replace_params.py @@ -7,10 +7,10 @@ from ...._utils import PropertyInfo -__all__ = ["RrsetUpdateParams", "ResourceRecord", "Picker"] +__all__ = ["RrsetReplaceParams", "ResourceRecord", "Picker"] -class RrsetUpdateParams(TypedDict, total=False): +class RrsetReplaceParams(TypedDict, total=False): zone_name: Required[Annotated[str, PropertyInfo(alias="zoneName")]] rrset_name: Required[Annotated[str, PropertyInfo(alias="rrsetName")]] diff --git a/tests/api_resources/dns/test_zones.py b/tests/api_resources/dns/test_zones.py index 30cee43d..cdb8d744 100644 --- a/tests/api_resources/dns/test_zones.py +++ b/tests/api_resources/dns/test_zones.py @@ -73,65 +73,6 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_update(self, client: Gcore) -> None: - zone = client.dns.zones.update( - path_name="name", - body_name="example.com", - ) - assert_matches_type(object, zone, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Gcore) -> None: - zone = client.dns.zones.update( - path_name="name", - body_name="example.com", - contact="contact", - enabled=True, - expiry=0, - meta={"foo": {}}, - nx_ttl=0, - primary_server="primary_server", - refresh=0, - retry=0, - serial=0, - ) - assert_matches_type(object, zone, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Gcore) -> None: - response = client.dns.zones.with_raw_response.update( - path_name="name", - body_name="example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - zone = response.parse() - assert_matches_type(object, zone, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Gcore) -> None: - with client.dns.zones.with_streaming_response.update( - path_name="name", - body_name="example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - zone = response.parse() - assert_matches_type(object, zone, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_name` but received ''"): - client.dns.zones.with_raw_response.update( - path_name="", - body_name="example.com", - ) - @parametrize def test_method_list(self, client: Gcore) -> None: zone = client.dns.zones.list() @@ -503,23 +444,19 @@ def test_path_params_import(self, client: Gcore) -> None: zone_name="", ) - -class TestAsyncZones: - 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: - zone = await async_client.dns.zones.create( - name="example.com", + def test_method_replace(self, client: Gcore) -> None: + zone = client.dns.zones.replace( + path_name="name", + body_name="example.com", ) - assert_matches_type(ZoneCreateResponse, zone, path=["response"]) + assert_matches_type(object, zone, path=["response"]) @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - zone = await async_client.dns.zones.create( - name="example.com", + def test_method_replace_with_all_params(self, client: Gcore) -> None: + zone = client.dns.zones.replace( + path_name="name", + body_name="example.com", contact="contact", enabled=True, expiry=0, @@ -530,45 +467,59 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> retry=0, serial=0, ) - assert_matches_type(ZoneCreateResponse, zone, path=["response"]) + assert_matches_type(object, zone, path=["response"]) @parametrize - async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.dns.zones.with_raw_response.create( - name="example.com", + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.replace( + path_name="name", + body_name="example.com", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - zone = await response.parse() - assert_matches_type(ZoneCreateResponse, zone, path=["response"]) + zone = response.parse() + assert_matches_type(object, zone, path=["response"]) @parametrize - async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.dns.zones.with_streaming_response.create( - name="example.com", + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.replace( + path_name="name", + body_name="example.com", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - zone = await response.parse() - assert_matches_type(ZoneCreateResponse, zone, path=["response"]) + zone = response.parse() + assert_matches_type(object, zone, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize - async def test_method_update(self, async_client: AsyncGcore) -> None: - zone = await async_client.dns.zones.update( - path_name="name", - body_name="example.com", + def test_path_params_replace(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_name` but received ''"): + client.dns.zones.with_raw_response.replace( + path_name="", + body_name="example.com", + ) + + +class TestAsyncZones: + 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: + zone = await async_client.dns.zones.create( + name="example.com", ) - assert_matches_type(object, zone, path=["response"]) + assert_matches_type(ZoneCreateResponse, zone, path=["response"]) @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - zone = await async_client.dns.zones.update( - path_name="name", - body_name="example.com", + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.create( + name="example.com", contact="contact", enabled=True, expiry=0, @@ -579,42 +530,32 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> retry=0, serial=0, ) - assert_matches_type(object, zone, path=["response"]) + assert_matches_type(ZoneCreateResponse, zone, path=["response"]) @parametrize - async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.dns.zones.with_raw_response.update( - path_name="name", - body_name="example.com", + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.create( + name="example.com", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" zone = await response.parse() - assert_matches_type(object, zone, path=["response"]) + assert_matches_type(ZoneCreateResponse, zone, path=["response"]) @parametrize - async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.dns.zones.with_streaming_response.update( - path_name="name", - body_name="example.com", + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.create( + name="example.com", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" zone = await response.parse() - assert_matches_type(object, zone, path=["response"]) + assert_matches_type(ZoneCreateResponse, zone, path=["response"]) assert cast(Any, response.is_closed) is True - @parametrize - async def test_path_params_update(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_name` but received ''"): - await async_client.dns.zones.with_raw_response.update( - path_name="", - body_name="example.com", - ) - @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: zone = await async_client.dns.zones.list() @@ -985,3 +926,62 @@ async def test_path_params_import(self, async_client: AsyncGcore) -> None: await async_client.dns.zones.with_raw_response.import_( zone_name="", ) + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.replace( + path_name="name", + body_name="example.com", + ) + assert_matches_type(object, zone, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.replace( + path_name="name", + body_name="example.com", + contact="contact", + enabled=True, + expiry=0, + meta={"foo": {}}, + nx_ttl=0, + primary_server="primary_server", + refresh=0, + retry=0, + serial=0, + ) + assert_matches_type(object, zone, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.replace( + path_name="name", + body_name="example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(object, zone, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.replace( + path_name="name", + body_name="example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(object, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_replace(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_name` but received ''"): + await async_client.dns.zones.with_raw_response.replace( + path_name="", + body_name="example.com", + ) diff --git a/tests/api_resources/dns/zones/test_rrsets.py b/tests/api_resources/dns/zones/test_rrsets.py index 7485d00e..5012b630 100644 --- a/tests/api_resources/dns/zones/test_rrsets.py +++ b/tests/api_resources/dns/zones/test_rrsets.py @@ -112,97 +112,6 @@ def test_path_params_create(self, client: Gcore) -> None: resource_records=[{"content": [{}]}], ) - @parametrize - def test_method_update(self, client: Gcore) -> None: - rrset = client.dns.zones.rrsets.update( - rrset_type="rrsetType", - zone_name="zoneName", - rrset_name="rrsetName", - resource_records=[{"content": [{}]}], - ) - assert_matches_type(DNSOutputRrset, rrset, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Gcore) -> None: - rrset = client.dns.zones.rrsets.update( - rrset_type="rrsetType", - zone_name="zoneName", - rrset_name="rrsetName", - resource_records=[ - { - "content": [{}], - "enabled": True, - "meta": {"foo": {}}, - } - ], - meta={}, - pickers=[ - { - "type": "geodns", - "limit": 0, - "strict": True, - } - ], - ttl=0, - ) - assert_matches_type(DNSOutputRrset, rrset, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Gcore) -> None: - response = client.dns.zones.rrsets.with_raw_response.update( - rrset_type="rrsetType", - zone_name="zoneName", - rrset_name="rrsetName", - resource_records=[{"content": [{}]}], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rrset = response.parse() - assert_matches_type(DNSOutputRrset, rrset, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Gcore) -> None: - with client.dns.zones.rrsets.with_streaming_response.update( - rrset_type="rrsetType", - zone_name="zoneName", - rrset_name="rrsetName", - resource_records=[{"content": [{}]}], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rrset = response.parse() - assert_matches_type(DNSOutputRrset, rrset, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): - client.dns.zones.rrsets.with_raw_response.update( - rrset_type="rrsetType", - zone_name="", - rrset_name="rrsetName", - resource_records=[{"content": [{}]}], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): - client.dns.zones.rrsets.with_raw_response.update( - rrset_type="rrsetType", - zone_name="zoneName", - rrset_name="", - resource_records=[{"content": [{}]}], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): - client.dns.zones.rrsets.with_raw_response.update( - rrset_type="", - zone_name="zoneName", - rrset_name="rrsetName", - resource_records=[{"content": [{}]}], - ) - @parametrize def test_method_list(self, client: Gcore) -> None: rrset = client.dns.zones.rrsets.list( @@ -443,15 +352,9 @@ def test_path_params_get_failover_logs(self, client: Gcore) -> None: rrset_name="rrsetName", ) - -class TestAsyncRrsets: - 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: - rrset = await async_client.dns.zones.rrsets.create( + def test_method_replace(self, client: Gcore) -> None: + rrset = client.dns.zones.rrsets.replace( rrset_type="rrsetType", zone_name="zoneName", rrset_name="rrsetName", @@ -460,8 +363,8 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: assert_matches_type(DNSOutputRrset, rrset, path=["response"]) @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - rrset = await async_client.dns.zones.rrsets.create( + def test_method_replace_with_all_params(self, client: Gcore) -> None: + rrset = client.dns.zones.rrsets.replace( rrset_type="rrsetType", zone_name="zoneName", rrset_name="rrsetName", @@ -485,8 +388,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> assert_matches_type(DNSOutputRrset, rrset, path=["response"]) @parametrize - async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.dns.zones.rrsets.with_raw_response.create( + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.dns.zones.rrsets.with_raw_response.replace( rrset_type="rrsetType", zone_name="zoneName", rrset_name="rrsetName", @@ -495,12 +398,12 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rrset = await response.parse() + rrset = response.parse() assert_matches_type(DNSOutputRrset, rrset, path=["response"]) @parametrize - async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.dns.zones.rrsets.with_streaming_response.create( + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.dns.zones.rrsets.with_streaming_response.replace( rrset_type="rrsetType", zone_name="zoneName", rrset_name="rrsetName", @@ -509,15 +412,15 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rrset = await response.parse() + rrset = response.parse() assert_matches_type(DNSOutputRrset, rrset, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_create(self, async_client: AsyncGcore) -> None: + def test_path_params_replace(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): - await async_client.dns.zones.rrsets.with_raw_response.create( + client.dns.zones.rrsets.with_raw_response.replace( rrset_type="rrsetType", zone_name="", rrset_name="rrsetName", @@ -525,7 +428,7 @@ async def test_path_params_create(self, async_client: AsyncGcore) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): - await async_client.dns.zones.rrsets.with_raw_response.create( + client.dns.zones.rrsets.with_raw_response.replace( rrset_type="rrsetType", zone_name="zoneName", rrset_name="", @@ -533,16 +436,22 @@ async def test_path_params_create(self, async_client: AsyncGcore) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): - await async_client.dns.zones.rrsets.with_raw_response.create( + client.dns.zones.rrsets.with_raw_response.replace( rrset_type="", zone_name="zoneName", rrset_name="rrsetName", resource_records=[{"content": [{}]}], ) + +class TestAsyncRrsets: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + @parametrize - async def test_method_update(self, async_client: AsyncGcore) -> None: - rrset = await async_client.dns.zones.rrsets.update( + async def test_method_create(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.create( rrset_type="rrsetType", zone_name="zoneName", rrset_name="rrsetName", @@ -551,8 +460,8 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: assert_matches_type(DNSOutputRrset, rrset, path=["response"]) @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - rrset = await async_client.dns.zones.rrsets.update( + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.create( rrset_type="rrsetType", zone_name="zoneName", rrset_name="rrsetName", @@ -576,8 +485,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> assert_matches_type(DNSOutputRrset, rrset, path=["response"]) @parametrize - async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.dns.zones.rrsets.with_raw_response.update( + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.rrsets.with_raw_response.create( rrset_type="rrsetType", zone_name="zoneName", rrset_name="rrsetName", @@ -590,8 +499,8 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: assert_matches_type(DNSOutputRrset, rrset, path=["response"]) @parametrize - async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.dns.zones.rrsets.with_streaming_response.update( + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.rrsets.with_streaming_response.create( rrset_type="rrsetType", zone_name="zoneName", rrset_name="rrsetName", @@ -606,9 +515,9 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_update(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 `zone_name` but received ''"): - await async_client.dns.zones.rrsets.with_raw_response.update( + await async_client.dns.zones.rrsets.with_raw_response.create( rrset_type="rrsetType", zone_name="", rrset_name="rrsetName", @@ -616,7 +525,7 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): - await async_client.dns.zones.rrsets.with_raw_response.update( + await async_client.dns.zones.rrsets.with_raw_response.create( rrset_type="rrsetType", zone_name="zoneName", rrset_name="", @@ -624,7 +533,7 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): - await async_client.dns.zones.rrsets.with_raw_response.update( + await async_client.dns.zones.rrsets.with_raw_response.create( rrset_type="", zone_name="zoneName", rrset_name="rrsetName", @@ -870,3 +779,94 @@ async def test_path_params_get_failover_logs(self, async_client: AsyncGcore) -> zone_name="zoneName", rrset_name="rrsetName", ) + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.replace( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + rrset = await async_client.dns.zones.rrsets.replace( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[ + { + "content": [{}], + "enabled": True, + "meta": {"foo": {}}, + } + ], + meta={}, + pickers=[ + { + "type": "geodns", + "limit": 0, + "strict": True, + } + ], + ttl=0, + ) + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.rrsets.with_raw_response.replace( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rrset = await response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.rrsets.with_streaming_response.replace( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rrset = await response.parse() + assert_matches_type(DNSOutputRrset, rrset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_replace(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.replace( + rrset_type="rrsetType", + zone_name="", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_name` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.replace( + rrset_type="rrsetType", + zone_name="zoneName", + rrset_name="", + resource_records=[{"content": [{}]}], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rrset_type` but received ''"): + await async_client.dns.zones.rrsets.with_raw_response.replace( + rrset_type="", + zone_name="zoneName", + rrset_name="rrsetName", + resource_records=[{"content": [{}]}], + ) From 14919db042a6c29627626f1b4b9cb8f80029ae81 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 29 Aug 2025 19:21:55 +0000 Subject: [PATCH 275/592] chore(internal): add Sequence related utils --- src/gcore/_types.py | 36 +++++++++++++++++++++++++++++++++++- src/gcore/_utils/__init__.py | 1 + src/gcore/_utils/_typing.py | 5 +++++ tests/utils.py | 10 +++++++++- 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/gcore/_types.py b/src/gcore/_types.py index aafdc14b..078ad89a 100644 --- a/src/gcore/_types.py +++ b/src/gcore/_types.py @@ -13,10 +13,21 @@ Mapping, TypeVar, Callable, + Iterator, Optional, Sequence, ) -from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable +from typing_extensions import ( + Set, + Literal, + Protocol, + TypeAlias, + TypedDict, + SupportsIndex, + overload, + override, + runtime_checkable, +) import httpx import pydantic @@ -217,3 +228,26 @@ class _GenericAlias(Protocol): class HttpxSendArgs(TypedDict, total=False): auth: httpx.Auth follow_redirects: bool + + +_T_co = TypeVar("_T_co", covariant=True) + + +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 + class SequenceNotStr(Protocol[_T_co]): + @overload + def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... + @overload + 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 + # deserializing our custom sequence type + SequenceNotStr = Sequence diff --git a/src/gcore/_utils/__init__.py b/src/gcore/_utils/__init__.py index d4fda26f..ca547ce5 100644 --- a/src/gcore/_utils/__init__.py +++ b/src/gcore/_utils/__init__.py @@ -38,6 +38,7 @@ extract_type_arg as extract_type_arg, is_iterable_type as is_iterable_type, is_required_type as is_required_type, + is_sequence_type as is_sequence_type, is_annotated_type as is_annotated_type, is_type_alias_type as is_type_alias_type, strip_annotated_type as strip_annotated_type, diff --git a/src/gcore/_utils/_typing.py b/src/gcore/_utils/_typing.py index 1bac9542..845cd6b2 100644 --- a/src/gcore/_utils/_typing.py +++ b/src/gcore/_utils/_typing.py @@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool: return (get_origin(typ) or typ) == list +def is_sequence_type(typ: type) -> bool: + origin = get_origin(typ) or typ + return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence + + def is_iterable_type(typ: type) -> bool: """If the given type is `typing.Iterable[T]`""" origin = get_origin(typ) or typ diff --git a/tests/utils.py b/tests/utils.py index 6a13fa7d..b8fe77cf 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -4,7 +4,7 @@ import inspect import traceback import contextlib -from typing import Any, TypeVar, Iterator, cast +from typing import Any, TypeVar, Iterator, Sequence, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type @@ -15,6 +15,7 @@ is_list_type, is_union_type, extract_type_arg, + is_sequence_type, is_annotated_type, is_type_alias_type, ) @@ -71,6 +72,13 @@ def assert_matches_type( if is_list_type(type_): return _assert_list_type(type_, value) + if is_sequence_type(type_): + assert isinstance(value, Sequence) + inner_type = get_args(type_)[0] + for entry in value: # type: ignore + assert_type(inner_type, entry) # type: ignore + return + if origin == str: assert isinstance(value, str) elif origin == int: From a33855671603775cb5c2b1b92362a985d81e9a6b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 15:18:03 +0000 Subject: [PATCH 276/592] feat(types): replace List[str] with SequenceNotStr in params --- src/gcore/_utils/_transform.py | 6 +++ src/gcore/resources/cloud/audit_logs.py | 6 +-- src/gcore/resources/cloud/baremetal/images.py | 7 ++- .../resources/cloud/baremetal/servers.py | 8 +-- src/gcore/resources/cloud/floating_ips.py | 8 +-- .../gpu_baremetal_clusters.py | 14 ++--- .../inference/applications/deployments.py | 12 ++--- .../inference/deployments/deployments.py | 20 ++++---- src/gcore/resources/cloud/instances/images.py | 8 +-- .../resources/cloud/instances/instances.py | 8 +-- .../load_balancers/l7_policies/l7_policies.py | 11 ++-- .../cloud/load_balancers/l7_policies/rules.py | 11 ++-- .../cloud/load_balancers/listeners.py | 20 ++++---- .../cloud/load_balancers/load_balancers.py | 8 +-- .../resources/cloud/networks/networks.py | 8 +-- src/gcore/resources/cloud/networks/subnets.py | 16 +++--- .../resources/cloud/reserved_fixed_ips/vip.py | 12 ++--- .../cloud/security_groups/security_groups.py | 12 ++--- src/gcore/resources/cloud/volumes.py | 8 +-- src/gcore/resources/dns/metrics.py | 8 +-- src/gcore/resources/dns/zones/zones.py | 8 +-- src/gcore/resources/waap/domains/api_paths.py | 22 ++++---- .../waap/domains/insight_silences.py | 12 ++--- src/gcore/resources/waap/domains/insights.py | 10 ++-- .../resources/waap/domains/statistics.py | 14 ++--- .../types/cloud/audit_log_list_params.py | 3 +- .../cloud/baremetal/image_list_params.py | 5 +- .../cloud/baremetal/server_list_params.py | 5 +- ...st_report_get_aggregated_monthly_params.py | 51 ++++++++++--------- .../cost_report_get_aggregated_params.py | 51 ++++++++++--------- .../cloud/cost_report_get_detailed_params.py | 51 ++++++++++--------- .../types/cloud/floating_ip_list_params.py | 5 +- .../gpu_baremetal_cluster_delete_params.py | 7 +-- .../gpu_baremetal_cluster_rebuild_params.py | 6 ++- .../applications/deployment_create_params.py | 6 ++- .../applications/deployment_patch_params.py | 6 ++- .../inference/deployment_create_params.py | 13 ++--- .../inference/deployment_update_params.py | 13 ++--- .../instance_assign_security_group_params.py | 6 ++- src/gcore/types/cloud/instance_list_params.py | 5 +- ...instance_unassign_security_group_params.py | 6 ++- .../cloud/instances/image_list_params.py | 5 +- .../cloud/load_balancer_create_params.py | 7 +-- .../types/cloud/load_balancer_list_params.py | 5 +- .../l7_policies/rule_create_params.py | 5 +- .../l7_policies/rule_replace_params.py | 5 +- .../load_balancers/l7_policy_create_params.py | 5 +- .../l7_policy_replace_params.py | 5 +- .../load_balancers/listener_create_params.py | 7 +-- .../load_balancers/listener_update_params.py | 8 +-- src/gcore/types/cloud/network_list_params.py | 5 +- .../cloud/networks/subnet_create_params.py | 5 +- .../cloud/networks/subnet_list_params.py | 5 +- .../cloud/networks/subnet_update_params.py | 5 +- .../vip_replace_connected_ports_params.py | 5 +- .../vip_update_connected_ports_params.py | 5 +- .../cloud/security_group_create_params.py | 6 ++- .../types/cloud/security_group_list_params.py | 5 +- .../types/cloud/usage_report_get_params.py | 51 ++++++++++--------- src/gcore/types/cloud/volume_list_params.py | 5 +- src/gcore/types/dns/metric_list_params.py | 6 ++- src/gcore/types/dns/zone_list_params.py | 5 +- .../domains/advanced_rule_create_params.py | 6 ++- .../domains/advanced_rule_update_params.py | 6 ++- .../waap/domains/api_path_create_params.py | 7 +-- .../waap/domains/api_path_list_params.py | 4 +- .../waap/domains/api_path_update_params.py | 7 +-- .../waap/domains/custom_rule_create_params.py | 16 +++--- .../waap/domains/custom_rule_update_params.py | 16 +++--- .../types/waap/domains/insight_list_params.py | 6 ++- .../domains/insight_silence_list_params.py | 8 +-- .../waap/domains/setting_update_params.py | 5 +- .../statistic_get_events_aggregated_params.py | 6 ++- .../statistic_get_requests_series_params.py | 4 +- 74 files changed, 417 insertions(+), 350 deletions(-) diff --git a/src/gcore/_utils/_transform.py b/src/gcore/_utils/_transform.py index b0cc20a7..f0bcefd4 100644 --- a/src/gcore/_utils/_transform.py +++ b/src/gcore/_utils/_transform.py @@ -16,6 +16,7 @@ lru_cache, is_mapping, is_iterable, + is_sequence, ) from .._files import is_base64_file_input from ._typing import ( @@ -24,6 +25,7 @@ extract_type_arg, is_iterable_type, is_required_type, + is_sequence_type, is_annotated_type, strip_annotated_type, ) @@ -184,6 +186,8 @@ def _transform_recursive( (is_list_type(stripped_type) and is_list(data)) # Iterable[T] or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) + # Sequence[T] + or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str)) ): # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually # intended as an iterable, so we don't transform it. @@ -346,6 +350,8 @@ async def _async_transform_recursive( (is_list_type(stripped_type) and is_list(data)) # Iterable[T] or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) + # Sequence[T] + or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str)) ): # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually # intended as an iterable, so we don't transform it. diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index c7e757e0..1f4ae40e 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -153,7 +153,7 @@ def list( order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, project_id: Iterable[int] | NotGiven = NOT_GIVEN, region_id: Iterable[int] | NotGiven = NOT_GIVEN, - resource_id: List[str] | NotGiven = NOT_GIVEN, + resource_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, search_field: str | NotGiven = NOT_GIVEN, sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, to_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -364,7 +364,7 @@ def list( order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, project_id: Iterable[int] | NotGiven = NOT_GIVEN, region_id: Iterable[int] | NotGiven = NOT_GIVEN, - resource_id: List[str] | NotGiven = NOT_GIVEN, + resource_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, search_field: str | NotGiven = NOT_GIVEN, sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, to_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index d8e870d7..ecc0adc3 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -2,12 +2,11 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -51,7 +50,7 @@ def list( region_id: int | None = None, include_prices: bool | NotGiven = NOT_GIVEN, private: str | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -141,7 +140,7 @@ async def list( region_id: int | None = None, include_prices: bool | NotGiven = NOT_GIVEN, private: str | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index b5dba5c6..86bbf8ce 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable, Optional +from typing import Dict, Union, Iterable, Optional from datetime import datetime from typing_extensions import Literal import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -208,7 +208,7 @@ def list( ] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, - tag_value: List[str] | NotGiven = NOT_GIVEN, + tag_value: SequenceNotStr[str] | NotGiven = NOT_GIVEN, type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, uuid: str | NotGiven = NOT_GIVEN, with_ddos: bool | NotGiven = NOT_GIVEN, @@ -579,7 +579,7 @@ def list( ] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, - tag_value: List[str] | NotGiven = NOT_GIVEN, + tag_value: SequenceNotStr[str] | NotGiven = NOT_GIVEN, type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, uuid: str | NotGiven = NOT_GIVEN, with_ddos: bool | NotGiven = NOT_GIVEN, diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index b35573d4..9362d7cc 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -2,11 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Optional +from typing import Dict, Optional import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -118,7 +118,7 @@ def list( region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -449,7 +449,7 @@ def list( region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index ec7f0279..99c7b1ee 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -31,7 +31,7 @@ ServersResourceWithStreamingResponse, AsyncServersResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from .interfaces import ( @@ -250,8 +250,8 @@ def delete( project_id: int | None = None, region_id: int | None = None, all_floating_ips: bool | NotGiven = NOT_GIVEN, - floating_ip_ids: List[str] | NotGiven = NOT_GIVEN, - reserved_fixed_ip_ids: List[str] | NotGiven = NOT_GIVEN, + floating_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + reserved_fixed_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -446,7 +446,7 @@ def rebuild( *, project_id: int | None = None, region_id: int | None = None, - nodes: List[str], + nodes: SequenceNotStr[str], image_id: Optional[str] | NotGiven = NOT_GIVEN, user_data: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -738,8 +738,8 @@ async def delete( project_id: int | None = None, region_id: int | None = None, all_floating_ips: bool | NotGiven = NOT_GIVEN, - floating_ip_ids: List[str] | NotGiven = NOT_GIVEN, - reserved_fixed_ip_ids: List[str] | NotGiven = NOT_GIVEN, + floating_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + reserved_fixed_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -934,7 +934,7 @@ async def rebuild( *, project_id: int | None = None, region_id: int | None = None, - nodes: List[str], + nodes: SequenceNotStr[str], image_id: Optional[str] | NotGiven = NOT_GIVEN, user_data: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index 7de9a1e7..43b6893f 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -2,11 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional +from typing import Dict, Iterable, Optional import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -55,7 +55,7 @@ def create( components_configuration: Dict[str, deployment_create_params.ComponentsConfiguration], name: str, regions: Iterable[int], - api_keys: List[str] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -246,7 +246,7 @@ def patch( deployment_name: str, *, project_id: int | None = None, - api_keys: List[str] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] | NotGiven = NOT_GIVEN, regions: Iterable[int] | NotGiven = NOT_GIVEN, @@ -334,7 +334,7 @@ async def create( components_configuration: Dict[str, deployment_create_params.ComponentsConfiguration], name: str, regions: Iterable[int], - api_keys: List[str] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -525,7 +525,7 @@ async def patch( deployment_name: str, *, project_id: int | None = None, - api_keys: List[str] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] | NotGiven = NOT_GIVEN, regions: Iterable[int] | NotGiven = NOT_GIVEN, diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 81ee0ef0..0cccc581 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -3,7 +3,7 @@ from __future__ import annotations import typing_extensions -from typing import Dict, List, Iterable, Optional +from typing import Dict, Iterable, Optional import httpx @@ -15,7 +15,7 @@ LogsResourceWithStreamingResponse, AsyncLogsResourceWithStreamingResponse, ) -from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -68,9 +68,9 @@ def create( image: str, listening_port: int, name: str, - api_keys: List[str] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[List[str]] | NotGiven = NOT_GIVEN, + command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, credentials_name: Optional[str] | NotGiven = NOT_GIVEN, description: Optional[str] | NotGiven = NOT_GIVEN, envs: Dict[str, str] | NotGiven = NOT_GIVEN, @@ -181,9 +181,9 @@ def update( deployment_name: str, *, project_id: int | None = None, - api_keys: Optional[List[str]] | NotGiven = NOT_GIVEN, + api_keys: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[List[str]] | NotGiven = NOT_GIVEN, + command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, credentials_name: Optional[str] | NotGiven = NOT_GIVEN, description: Optional[str] | NotGiven = NOT_GIVEN, @@ -610,9 +610,9 @@ async def create( image: str, listening_port: int, name: str, - api_keys: List[str] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[List[str]] | NotGiven = NOT_GIVEN, + command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, credentials_name: Optional[str] | NotGiven = NOT_GIVEN, description: Optional[str] | NotGiven = NOT_GIVEN, envs: Dict[str, str] | NotGiven = NOT_GIVEN, @@ -723,9 +723,9 @@ async def update( deployment_name: str, *, project_id: int | None = None, - api_keys: Optional[List[str]] | NotGiven = NOT_GIVEN, + api_keys: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[List[str]] | NotGiven = NOT_GIVEN, + command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, credentials_name: Optional[str] | NotGiven = NOT_GIVEN, description: Optional[str] | NotGiven = NOT_GIVEN, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index 949b6e9c..b45fd614 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import Dict, List, Optional +from typing import Dict, Optional from typing_extensions import Literal import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -138,7 +138,7 @@ def list( region_id: int | None = None, include_prices: bool | NotGiven = NOT_GIVEN, private: str | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -584,7 +584,7 @@ async def list( region_id: int | None = None, include_prices: bool | NotGiven = NOT_GIVEN, private: str | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index ccdeb3bb..dde03b4b 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable, Optional +from typing import Dict, Union, Iterable, Optional from datetime import datetime from typing_extensions import Literal, overload @@ -32,7 +32,7 @@ MetricsResourceWithStreamingResponse, AsyncMetricsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr from ...._utils import required_args, maybe_transform, async_maybe_transform from ...._compat import cached_property from .interfaces import ( @@ -351,7 +351,7 @@ def list( ] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, - tag_value: List[str] | NotGiven = NOT_GIVEN, + tag_value: SequenceNotStr[str] | NotGiven = NOT_GIVEN, type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, uuid: str | NotGiven = NOT_GIVEN, with_ddos: bool | NotGiven = NOT_GIVEN, @@ -1393,7 +1393,7 @@ def list( ] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, - tag_value: List[str] | NotGiven = NOT_GIVEN, + tag_value: SequenceNotStr[str] | NotGiven = NOT_GIVEN, type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, uuid: str | NotGiven = NOT_GIVEN, with_ddos: bool | NotGiven = NOT_GIVEN, 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 05e91176..d7cce84f 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 @@ -2,7 +2,6 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal import httpx @@ -15,7 +14,7 @@ RulesResourceWithStreamingResponse, AsyncRulesResourceWithStreamingResponse, ) -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -71,7 +70,7 @@ def create( redirect_pool_id: str | NotGiven = NOT_GIVEN, redirect_prefix: str | NotGiven = NOT_GIVEN, redirect_url: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -275,7 +274,7 @@ def replace( redirect_pool_id: str | NotGiven = NOT_GIVEN, redirect_prefix: str | NotGiven = NOT_GIVEN, redirect_url: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -383,7 +382,7 @@ async def create( redirect_pool_id: str | NotGiven = NOT_GIVEN, redirect_prefix: str | NotGiven = NOT_GIVEN, redirect_url: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -587,7 +586,7 @@ async def replace( redirect_pool_id: str | NotGiven = NOT_GIVEN, redirect_prefix: str | NotGiven = NOT_GIVEN, redirect_url: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, 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 dd9cbacf..b83bb590 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -2,12 +2,11 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -66,7 +65,7 @@ def create( value: str, invert: bool | NotGiven = NOT_GIVEN, key: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -266,7 +265,7 @@ def replace( compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | NotGiven = NOT_GIVEN, invert: bool | NotGiven = NOT_GIVEN, key: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, type: Literal[ "COOKIE", "FILE_TYPE", @@ -382,7 +381,7 @@ async def create( value: str, invert: bool | NotGiven = NOT_GIVEN, key: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -582,7 +581,7 @@ async def replace( compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | NotGiven = NOT_GIVEN, invert: bool | NotGiven = NOT_GIVEN, key: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, type: Literal[ "COOKIE", "FILE_TYPE", diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 35fdabbc..abbb5e77 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -2,11 +2,11 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -61,11 +61,11 @@ def create( name: str, protocol: LbListenerProtocol, protocol_port: int, - allowed_cidrs: Optional[List[str]] | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, connection_limit: int | NotGiven = NOT_GIVEN, insert_x_forwarded: bool | NotGiven = NOT_GIVEN, secret_id: str | NotGiven = NOT_GIVEN, - sni_secret_id: List[str] | NotGiven = NOT_GIVEN, + sni_secret_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, @@ -160,11 +160,11 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - allowed_cidrs: Optional[List[str]] | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, connection_limit: int | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, secret_id: Optional[str] | NotGiven = NOT_GIVEN, - sni_secret_id: Optional[List[str]] | NotGiven = NOT_GIVEN, + sni_secret_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, @@ -433,11 +433,11 @@ async def create( name: str, protocol: LbListenerProtocol, protocol_port: int, - allowed_cidrs: Optional[List[str]] | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, connection_limit: int | NotGiven = NOT_GIVEN, insert_x_forwarded: bool | NotGiven = NOT_GIVEN, secret_id: str | NotGiven = NOT_GIVEN, - sni_secret_id: List[str] | NotGiven = NOT_GIVEN, + sni_secret_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, @@ -532,11 +532,11 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - allowed_cidrs: Optional[List[str]] | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, connection_limit: int | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, secret_id: Optional[str] | NotGiven = NOT_GIVEN, - sni_secret_id: Optional[List[str]] | NotGiven = NOT_GIVEN, + sni_secret_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 01115e01..9a8070b5 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional +from typing import Dict, Iterable, Optional import httpx @@ -30,7 +30,7 @@ StatusesResourceWithStreamingResponse, AsyncStatusesResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from .listeners import ( ListenersResource, @@ -329,7 +329,7 @@ def list( offset: int | NotGiven = NOT_GIVEN, order_by: str | NotGiven = NOT_GIVEN, show_stats: bool | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, with_ddos: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -840,7 +840,7 @@ def list( offset: int | NotGiven = NOT_GIVEN, order_by: str | NotGiven = NOT_GIVEN, show_stats: bool | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, with_ddos: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 8ee516ed..235648f0 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Optional +from typing import Dict, Optional from typing_extensions import Literal import httpx @@ -23,7 +23,7 @@ SubnetsResourceWithStreamingResponse, AsyncSubnetsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -228,7 +228,7 @@ def list( name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -576,7 +576,7 @@ def list( name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index b2e20f56..aef9bb2a 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Literal import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -58,7 +58,7 @@ def create( name: str, network_id: str, connect_to_network_router: bool | NotGiven = NOT_GIVEN, - dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, + dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, enable_dhcp: bool | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, @@ -156,7 +156,7 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, + dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, @@ -270,7 +270,7 @@ def list( "updated_at.desc", ] | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -464,7 +464,7 @@ async def create( name: str, network_id: str, connect_to_network_router: bool | NotGiven = NOT_GIVEN, - dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, + dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, enable_dhcp: bool | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, @@ -562,7 +562,7 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - dns_nameservers: Optional[List[str]] | NotGiven = NOT_GIVEN, + dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, @@ -676,7 +676,7 @@ def list( "updated_at.desc", ] | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 3b0df23d..22757eba 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -2,11 +2,9 @@ from __future__ import annotations -from typing import List - import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -137,7 +135,7 @@ def replace_connected_ports( *, project_id: int | None = None, region_id: int | None = None, - port_ids: List[str] | NotGiven = NOT_GIVEN, + port_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -229,7 +227,7 @@ def update_connected_ports( *, project_id: int | None = None, region_id: int | None = None, - port_ids: List[str] | NotGiven = NOT_GIVEN, + port_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -379,7 +377,7 @@ async def replace_connected_ports( *, project_id: int | None = None, region_id: int | None = None, - port_ids: List[str] | NotGiven = NOT_GIVEN, + port_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -471,7 +469,7 @@ async def update_connected_ports( *, project_id: int | None = None, region_id: int | None = None, - port_ids: List[str] | NotGiven = NOT_GIVEN, + port_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 25164fad..0e24383b 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional import httpx @@ -14,7 +14,7 @@ RulesResourceWithStreamingResponse, AsyncRulesResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -68,7 +68,7 @@ def create( project_id: int | None = None, region_id: int | None = None, security_group: security_group_create_params.SecurityGroup, - instances: List[str] | NotGiven = NOT_GIVEN, + instances: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -196,7 +196,7 @@ def list( region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -452,7 +452,7 @@ async def create( project_id: int | None = None, region_id: int | None = None, security_group: security_group_create_params.SecurityGroup, - instances: List[str] | NotGiven = NOT_GIVEN, + instances: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -580,7 +580,7 @@ def list( region_id: int | None = None, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index f856856c..74756335 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Literal, overload import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr from ..._utils import required_args, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -407,7 +407,7 @@ def list( limit: int | NotGiven = NOT_GIVEN, name_part: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -1236,7 +1236,7 @@ def list( limit: int | NotGiven = NOT_GIVEN, name_part: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, - tag_key: List[str] | NotGiven = NOT_GIVEN, + tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, tag_key_value: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index 53764f64..b9bf45a5 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -2,11 +2,11 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -46,7 +46,7 @@ def list( self, *, client_ids: Iterable[int] | NotGiven = NOT_GIVEN, - zone_names: List[str] | NotGiven = NOT_GIVEN, + zone_names: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -126,7 +126,7 @@ async def list( self, *, client_ids: Iterable[int] | NotGiven = NOT_GIVEN, - zone_names: List[str] | NotGiven = NOT_GIVEN, + zone_names: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 88387455..31b815a3 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable +from typing import Dict, Union, Iterable from datetime import datetime from typing_extensions import Literal @@ -24,7 +24,7 @@ RrsetsResourceWithStreamingResponse, AsyncRrsetsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -177,7 +177,7 @@ def list( healthcheck: bool | NotGiven = NOT_GIVEN, iam_reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, - name: List[str] | NotGiven = NOT_GIVEN, + name: SequenceNotStr[str] | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: str | NotGiven = NOT_GIVEN, order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, @@ -821,7 +821,7 @@ async def list( healthcheck: bool | NotGiven = NOT_GIVEN, iam_reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, - name: List[str] | NotGiven = NOT_GIVEN, + name: SequenceNotStr[str] | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: str | NotGiven = NOT_GIVEN, order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index 028c8e14..d372c33b 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -52,9 +52,9 @@ def create( http_scheme: Literal["HTTP", "HTTPS"], method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"], path: str, - api_groups: List[str] | NotGiven = NOT_GIVEN, + api_groups: SequenceNotStr[str] | NotGiven = NOT_GIVEN, api_version: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -115,10 +115,10 @@ def update( path_id: str, *, domain_id: int, - api_groups: List[str] | NotGiven = NOT_GIVEN, + api_groups: SequenceNotStr[str] | NotGiven = NOT_GIVEN, path: str | NotGiven = NOT_GIVEN, status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -180,7 +180,7 @@ def list( api_group: Optional[str] | NotGiven = NOT_GIVEN, api_version: Optional[str] | NotGiven = NOT_GIVEN, http_scheme: Optional[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, - ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] | NotGiven = NOT_GIVEN, @@ -392,9 +392,9 @@ async def create( http_scheme: Literal["HTTP", "HTTPS"], method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"], path: str, - api_groups: List[str] | NotGiven = NOT_GIVEN, + api_groups: SequenceNotStr[str] | NotGiven = NOT_GIVEN, api_version: str | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -455,10 +455,10 @@ async def update( path_id: str, *, domain_id: int, - api_groups: List[str] | NotGiven = NOT_GIVEN, + api_groups: SequenceNotStr[str] | NotGiven = NOT_GIVEN, path: str | NotGiven = NOT_GIVEN, status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] | NotGiven = NOT_GIVEN, - tags: List[str] | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -520,7 +520,7 @@ def list( api_group: Optional[str] | NotGiven = NOT_GIVEN, api_version: Optional[str] | NotGiven = NOT_GIVEN, http_scheme: Optional[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, - ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] | NotGiven = NOT_GIVEN, diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 94496352..98372746 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import Dict, List, Union, Optional +from typing import Dict, Union, Optional from datetime import datetime from typing_extensions import Literal import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -177,10 +177,10 @@ def list( self, domain_id: int, *, - id: Optional[List[str]] | NotGiven = NOT_GIVEN, + id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, author: Optional[str] | NotGiven = NOT_GIVEN, comment: Optional[str] | NotGiven = NOT_GIVEN, - insight_type: Optional[List[str]] | NotGiven = NOT_GIVEN, + insight_type: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, ordering: Literal[ @@ -486,10 +486,10 @@ def list( self, domain_id: int, *, - id: Optional[List[str]] | NotGiven = NOT_GIVEN, + id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, author: Optional[str] | NotGiven = NOT_GIVEN, comment: Optional[str] | NotGiven = NOT_GIVEN, - insight_type: Optional[List[str]] | NotGiven = NOT_GIVEN, + insight_type: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, ordering: Literal[ diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 233d5b57..7633f059 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -49,9 +49,9 @@ def list( self, domain_id: int, *, - id: Optional[List[str]] | NotGiven = NOT_GIVEN, + id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, description: Optional[str] | NotGiven = NOT_GIVEN, - insight_type: Optional[List[str]] | NotGiven = NOT_GIVEN, + insight_type: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, ordering: Literal[ @@ -238,9 +238,9 @@ def list( self, domain_id: int, *, - id: Optional[List[str]] | NotGiven = NOT_GIVEN, + id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, description: Optional[str] | NotGiven = NOT_GIVEN, - insight_type: Optional[List[str]] | NotGiven = NOT_GIVEN, + insight_type: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, ordering: Literal[ diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index 901b0b92..517d55f6 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -8,7 +8,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -193,8 +193,8 @@ def get_events_aggregated( start: str, action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | NotGiven = NOT_GIVEN, end: Optional[str] | NotGiven = NOT_GIVEN, - ip: Optional[List[str]] | NotGiven = NOT_GIVEN, - reference_id: Optional[List[str]] | NotGiven = NOT_GIVEN, + ip: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, + reference_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -301,7 +301,7 @@ def get_requests_series( *, start: str, actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, - countries: List[str] | NotGiven = NOT_GIVEN, + countries: SequenceNotStr[str] | NotGiven = NOT_GIVEN, end: Optional[str] | NotGiven = NOT_GIVEN, ip: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, @@ -627,8 +627,8 @@ async def get_events_aggregated( start: str, action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | NotGiven = NOT_GIVEN, end: Optional[str] | NotGiven = NOT_GIVEN, - ip: Optional[List[str]] | NotGiven = NOT_GIVEN, - reference_id: Optional[List[str]] | NotGiven = NOT_GIVEN, + ip: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, + reference_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -735,7 +735,7 @@ def get_requests_series( *, start: str, actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, - countries: List[str] | NotGiven = NOT_GIVEN, + countries: SequenceNotStr[str] | NotGiven = NOT_GIVEN, end: Optional[str] | NotGiven = NOT_GIVEN, ip: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, diff --git a/src/gcore/types/cloud/audit_log_list_params.py b/src/gcore/types/cloud/audit_log_list_params.py index 6f5ac1aa..09a75554 100644 --- a/src/gcore/types/cloud/audit_log_list_params.py +++ b/src/gcore/types/cloud/audit_log_list_params.py @@ -6,6 +6,7 @@ from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict +from ..._types import SequenceNotStr from ..._utils import PropertyInfo __all__ = ["AuditLogListParams"] @@ -136,7 +137,7 @@ class AuditLogListParams(TypedDict, total=False): region_id: Iterable[int] """Region ID. Several options can be specified.""" - resource_id: List[str] + resource_id: SequenceNotStr[str] """Resource ID. Several options can be specified.""" search_field: str diff --git a/src/gcore/types/cloud/baremetal/image_list_params.py b/src/gcore/types/cloud/baremetal/image_list_params.py index 075fe52e..1e1d2903 100644 --- a/src/gcore/types/cloud/baremetal/image_list_params.py +++ b/src/gcore/types/cloud/baremetal/image_list_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal, TypedDict +from ...._types import SequenceNotStr + __all__ = ["ImageListParams"] @@ -19,7 +20,7 @@ class ImageListParams(TypedDict, total=False): private: str """Any value to show private images""" - tag_key: List[str] + tag_key: SequenceNotStr[str] """Filter by tag keys.""" tag_key_value: str diff --git a/src/gcore/types/cloud/baremetal/server_list_params.py b/src/gcore/types/cloud/baremetal/server_list_params.py index 1ddb1c48..75547dff 100644 --- a/src/gcore/types/cloud/baremetal/server_list_params.py +++ b/src/gcore/types/cloud/baremetal/server_list_params.py @@ -2,10 +2,11 @@ from __future__ import annotations -from typing import List, Union +from typing import Union from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict +from ...._types import SequenceNotStr from ...._utils import PropertyInfo __all__ = ["ServerListParams"] @@ -87,7 +88,7 @@ class ServerListParams(TypedDict, total=False): tag_key_value: str """Optional. Filter by tag key-value pairs.""" - tag_value: List[str] + tag_value: SequenceNotStr[str] """Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2""" type_ddos_profile: Literal["basic", "advanced"] 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 4a257226..6b9a4389 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 @@ -6,6 +6,7 @@ from datetime import datetime from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from ..._types import SequenceNotStr from ..._utils import PropertyInfo __all__ = [ @@ -104,7 +105,7 @@ class SchemaFilterSchemaFilterSnapshotSerializer(TypedDict, total=False): type: Required[Literal["snapshot"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -114,7 +115,7 @@ class SchemaFilterSchemaFilterInstanceSerializer(TypedDict, total=False): type: Required[Literal["instance"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -124,7 +125,7 @@ class SchemaFilterSchemaFilterAIClusterSerializer(TypedDict, total=False): type: Required[Literal["ai_cluster"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -134,7 +135,7 @@ class SchemaFilterSchemaFilterAIVirtualClusterSerializer(TypedDict, total=False) type: Required[Literal["ai_virtual_cluster"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -144,7 +145,7 @@ class SchemaFilterSchemaFilterBasicVmSerializer(TypedDict, total=False): type: Required[Literal["basic_vm"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -154,7 +155,7 @@ class SchemaFilterSchemaFilterBaremetalSerializer(TypedDict, total=False): type: Required[Literal["baremetal"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -164,7 +165,7 @@ class SchemaFilterSchemaFilterVolumeSerializer(TypedDict, total=False): type: Required[Literal["volume"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -174,7 +175,7 @@ class SchemaFilterSchemaFilterFileShareSerializer(TypedDict, total=False): type: Required[Literal["file_share"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -184,7 +185,7 @@ class SchemaFilterSchemaFilterImageSerializer(TypedDict, total=False): type: Required[Literal["image"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -194,7 +195,7 @@ class SchemaFilterSchemaFilterFloatingIPSerializer(TypedDict, total=False): type: Required[Literal["floatingip"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -204,7 +205,7 @@ class SchemaFilterSchemaFilterEgressTrafficSerializer(TypedDict, total=False): type: Required[Literal["egress_traffic"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -214,7 +215,7 @@ class SchemaFilterSchemaFilterLoadBalancerSerializer(TypedDict, total=False): type: Required[Literal["load_balancer"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -224,7 +225,7 @@ class SchemaFilterSchemaFilterExternalIPSerializer(TypedDict, total=False): type: Required[Literal["external_ip"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -234,7 +235,7 @@ class SchemaFilterSchemaFilterBackupSerializer(TypedDict, total=False): type: Required[Literal["backup"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -244,7 +245,7 @@ class SchemaFilterSchemaFilterLogIndexSerializer(TypedDict, total=False): type: Required[Literal["log_index"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -254,7 +255,7 @@ class SchemaFilterSchemaFilterFunctionsSerializer(TypedDict, total=False): type: Required[Literal["functions"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -264,7 +265,7 @@ class SchemaFilterSchemaFilterFunctionsCallsSerializer(TypedDict, total=False): type: Required[Literal["functions_calls"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -274,7 +275,7 @@ class SchemaFilterSchemaFilterFunctionsTrafficSerializer(TypedDict, total=False) type: Required[Literal["functions_traffic"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -284,7 +285,7 @@ class SchemaFilterSchemaFilterContainersSerializer(TypedDict, total=False): type: Required[Literal["containers"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -294,7 +295,7 @@ class SchemaFilterSchemaFilterInferenceSerializer(TypedDict, total=False): type: Required[Literal["inference"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -304,7 +305,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer(TypedDict, total=F type: Required[Literal["dbaas_postgresql_volume"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -314,7 +315,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer(TypedDict, type: Required[Literal["dbaas_postgresql_public_network"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -324,7 +325,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer(TypedDict, total=Fals type: Required[Literal["dbaas_postgresql_cpu"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -334,7 +335,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer(TypedDict, total=F type: Required[Literal["dbaas_postgresql_memory"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -344,7 +345,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer(TypedDict, total=F type: Required[Literal["dbaas_postgresql_connection_pooler"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" 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 aa099ae9..1d79bba8 100644 --- a/src/gcore/types/cloud/cost_report_get_aggregated_params.py +++ b/src/gcore/types/cloud/cost_report_get_aggregated_params.py @@ -6,6 +6,7 @@ from datetime import datetime from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from ..._types import SequenceNotStr from ..._utils import PropertyInfo __all__ = [ @@ -116,7 +117,7 @@ class SchemaFilterSchemaFilterSnapshotSerializer(TypedDict, total=False): type: Required[Literal["snapshot"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -126,7 +127,7 @@ class SchemaFilterSchemaFilterInstanceSerializer(TypedDict, total=False): type: Required[Literal["instance"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -136,7 +137,7 @@ class SchemaFilterSchemaFilterAIClusterSerializer(TypedDict, total=False): type: Required[Literal["ai_cluster"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -146,7 +147,7 @@ class SchemaFilterSchemaFilterAIVirtualClusterSerializer(TypedDict, total=False) type: Required[Literal["ai_virtual_cluster"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -156,7 +157,7 @@ class SchemaFilterSchemaFilterBasicVmSerializer(TypedDict, total=False): type: Required[Literal["basic_vm"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -166,7 +167,7 @@ class SchemaFilterSchemaFilterBaremetalSerializer(TypedDict, total=False): type: Required[Literal["baremetal"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -176,7 +177,7 @@ class SchemaFilterSchemaFilterVolumeSerializer(TypedDict, total=False): type: Required[Literal["volume"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -186,7 +187,7 @@ class SchemaFilterSchemaFilterFileShareSerializer(TypedDict, total=False): type: Required[Literal["file_share"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -196,7 +197,7 @@ class SchemaFilterSchemaFilterImageSerializer(TypedDict, total=False): type: Required[Literal["image"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -206,7 +207,7 @@ class SchemaFilterSchemaFilterFloatingIPSerializer(TypedDict, total=False): type: Required[Literal["floatingip"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -216,7 +217,7 @@ class SchemaFilterSchemaFilterEgressTrafficSerializer(TypedDict, total=False): type: Required[Literal["egress_traffic"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -226,7 +227,7 @@ class SchemaFilterSchemaFilterLoadBalancerSerializer(TypedDict, total=False): type: Required[Literal["load_balancer"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -236,7 +237,7 @@ class SchemaFilterSchemaFilterExternalIPSerializer(TypedDict, total=False): type: Required[Literal["external_ip"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -246,7 +247,7 @@ class SchemaFilterSchemaFilterBackupSerializer(TypedDict, total=False): type: Required[Literal["backup"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -256,7 +257,7 @@ class SchemaFilterSchemaFilterLogIndexSerializer(TypedDict, total=False): type: Required[Literal["log_index"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -266,7 +267,7 @@ class SchemaFilterSchemaFilterFunctionsSerializer(TypedDict, total=False): type: Required[Literal["functions"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -276,7 +277,7 @@ class SchemaFilterSchemaFilterFunctionsCallsSerializer(TypedDict, total=False): type: Required[Literal["functions_calls"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -286,7 +287,7 @@ class SchemaFilterSchemaFilterFunctionsTrafficSerializer(TypedDict, total=False) type: Required[Literal["functions_traffic"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -296,7 +297,7 @@ class SchemaFilterSchemaFilterContainersSerializer(TypedDict, total=False): type: Required[Literal["containers"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -306,7 +307,7 @@ class SchemaFilterSchemaFilterInferenceSerializer(TypedDict, total=False): type: Required[Literal["inference"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -316,7 +317,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer(TypedDict, total=F type: Required[Literal["dbaas_postgresql_volume"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -326,7 +327,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer(TypedDict, type: Required[Literal["dbaas_postgresql_public_network"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -336,7 +337,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer(TypedDict, total=Fals type: Required[Literal["dbaas_postgresql_cpu"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -346,7 +347,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer(TypedDict, total=F type: Required[Literal["dbaas_postgresql_memory"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -356,7 +357,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer(TypedDict, total=F type: Required[Literal["dbaas_postgresql_connection_pooler"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" 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 f3d65950..a55d3a37 100644 --- a/src/gcore/types/cloud/cost_report_get_detailed_params.py +++ b/src/gcore/types/cloud/cost_report_get_detailed_params.py @@ -6,6 +6,7 @@ from datetime import datetime from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from ..._types import SequenceNotStr from ..._utils import PropertyInfo __all__ = [ @@ -126,7 +127,7 @@ class SchemaFilterSchemaFilterSnapshotSerializer(TypedDict, total=False): type: Required[Literal["snapshot"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -136,7 +137,7 @@ class SchemaFilterSchemaFilterInstanceSerializer(TypedDict, total=False): type: Required[Literal["instance"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -146,7 +147,7 @@ class SchemaFilterSchemaFilterAIClusterSerializer(TypedDict, total=False): type: Required[Literal["ai_cluster"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -156,7 +157,7 @@ class SchemaFilterSchemaFilterAIVirtualClusterSerializer(TypedDict, total=False) type: Required[Literal["ai_virtual_cluster"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -166,7 +167,7 @@ class SchemaFilterSchemaFilterBasicVmSerializer(TypedDict, total=False): type: Required[Literal["basic_vm"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -176,7 +177,7 @@ class SchemaFilterSchemaFilterBaremetalSerializer(TypedDict, total=False): type: Required[Literal["baremetal"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -186,7 +187,7 @@ class SchemaFilterSchemaFilterVolumeSerializer(TypedDict, total=False): type: Required[Literal["volume"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -196,7 +197,7 @@ class SchemaFilterSchemaFilterFileShareSerializer(TypedDict, total=False): type: Required[Literal["file_share"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -206,7 +207,7 @@ class SchemaFilterSchemaFilterImageSerializer(TypedDict, total=False): type: Required[Literal["image"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -216,7 +217,7 @@ class SchemaFilterSchemaFilterFloatingIPSerializer(TypedDict, total=False): type: Required[Literal["floatingip"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -226,7 +227,7 @@ class SchemaFilterSchemaFilterEgressTrafficSerializer(TypedDict, total=False): type: Required[Literal["egress_traffic"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -236,7 +237,7 @@ class SchemaFilterSchemaFilterLoadBalancerSerializer(TypedDict, total=False): type: Required[Literal["load_balancer"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -246,7 +247,7 @@ class SchemaFilterSchemaFilterExternalIPSerializer(TypedDict, total=False): type: Required[Literal["external_ip"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -256,7 +257,7 @@ class SchemaFilterSchemaFilterBackupSerializer(TypedDict, total=False): type: Required[Literal["backup"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -266,7 +267,7 @@ class SchemaFilterSchemaFilterLogIndexSerializer(TypedDict, total=False): type: Required[Literal["log_index"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -276,7 +277,7 @@ class SchemaFilterSchemaFilterFunctionsSerializer(TypedDict, total=False): type: Required[Literal["functions"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -286,7 +287,7 @@ class SchemaFilterSchemaFilterFunctionsCallsSerializer(TypedDict, total=False): type: Required[Literal["functions_calls"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -296,7 +297,7 @@ class SchemaFilterSchemaFilterFunctionsTrafficSerializer(TypedDict, total=False) type: Required[Literal["functions_traffic"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -306,7 +307,7 @@ class SchemaFilterSchemaFilterContainersSerializer(TypedDict, total=False): type: Required[Literal["containers"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -316,7 +317,7 @@ class SchemaFilterSchemaFilterInferenceSerializer(TypedDict, total=False): type: Required[Literal["inference"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -326,7 +327,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer(TypedDict, total=F type: Required[Literal["dbaas_postgresql_volume"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -336,7 +337,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer(TypedDict, type: Required[Literal["dbaas_postgresql_public_network"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -346,7 +347,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer(TypedDict, total=Fals type: Required[Literal["dbaas_postgresql_cpu"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -356,7 +357,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer(TypedDict, total=F type: Required[Literal["dbaas_postgresql_memory"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -366,7 +367,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer(TypedDict, total=F type: Required[Literal["dbaas_postgresql_connection_pooler"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" diff --git a/src/gcore/types/cloud/floating_ip_list_params.py b/src/gcore/types/cloud/floating_ip_list_params.py index 825b2de1..97017a38 100644 --- a/src/gcore/types/cloud/floating_ip_list_params.py +++ b/src/gcore/types/cloud/floating_ip_list_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import TypedDict +from ..._types import SequenceNotStr + __all__ = ["FloatingIPListParams"] @@ -24,7 +25,7 @@ class FloatingIPListParams(TypedDict, total=False): Offset value is used to exclude the first set of records from the result """ - tag_key: List[str] + tag_key: SequenceNotStr[str] """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py index e68a7962..fb7b3ace 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import TypedDict +from ..._types import SequenceNotStr + __all__ = ["GPUBaremetalClusterDeleteParams"] @@ -21,8 +22,8 @@ class GPUBaremetalClusterDeleteParams(TypedDict, total=False): deleted """ - floating_ip_ids: List[str] + floating_ip_ids: SequenceNotStr[str] """Optional list of floating ips to be deleted""" - reserved_fixed_ip_ids: List[str] + reserved_fixed_ip_ids: SequenceNotStr[str] """Optional list of reserved fixed ips to be deleted""" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py index e25da560..f4d27f43 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import Required, TypedDict +from ..._types import SequenceNotStr + __all__ = ["GPUBaremetalClusterRebuildParams"] @@ -13,7 +15,7 @@ class GPUBaremetalClusterRebuildParams(TypedDict, total=False): region_id: int - nodes: Required[List[str]] + nodes: Required[SequenceNotStr[str]] """List of nodes uuids to be rebuild""" image_id: Optional[str] 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 a66d843f..537480cf 100644 --- a/src/gcore/types/cloud/inference/applications/deployment_create_params.py +++ b/src/gcore/types/cloud/inference/applications/deployment_create_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Iterable +from typing import Dict, Iterable from typing_extensions import Required, TypedDict +from ....._types import SequenceNotStr + __all__ = [ "DeploymentCreateParams", "ComponentsConfiguration", @@ -29,7 +31,7 @@ class DeploymentCreateParams(TypedDict, total=False): regions: Required[Iterable[int]] """Geographical regions where the deployment should be created""" - api_keys: List[str] + api_keys: SequenceNotStr[str] """List of API keys for the application""" diff --git a/src/gcore/types/cloud/inference/applications/deployment_patch_params.py b/src/gcore/types/cloud/inference/applications/deployment_patch_params.py index 1283ee91..0ce4395d 100644 --- a/src/gcore/types/cloud/inference/applications/deployment_patch_params.py +++ b/src/gcore/types/cloud/inference/applications/deployment_patch_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Required, TypedDict +from ....._types import SequenceNotStr + __all__ = [ "DeploymentPatchParams", "ComponentsConfiguration", @@ -17,7 +19,7 @@ class DeploymentPatchParams(TypedDict, total=False): project_id: int """Project ID""" - api_keys: List[str] + api_keys: SequenceNotStr[str] """List of API keys for the application""" components_configuration: Dict[str, Optional[ComponentsConfiguration]] diff --git a/src/gcore/types/cloud/inference/deployment_create_params.py b/src/gcore/types/cloud/inference/deployment_create_params.py index 38dfafb4..9886738e 100644 --- a/src/gcore/types/cloud/inference/deployment_create_params.py +++ b/src/gcore/types/cloud/inference/deployment_create_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Required, Annotated, TypedDict +from ...._types import SequenceNotStr from ...._utils import PropertyInfo from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam @@ -64,7 +65,7 @@ class DeploymentCreateParams(TypedDict, total=False): name: Required[str] """Inference instance name.""" - api_keys: List[str] + api_keys: SequenceNotStr[str] """List of API keys for the inference instance. Multiple keys can be attached to one deployment.If `auth_enabled` and `api_keys` @@ -80,7 +81,7 @@ class DeploymentCreateParams(TypedDict, total=False): `api_keys` are both specified, a ValidationError will be raised. """ - command: Optional[List[str]] + command: Optional[SequenceNotStr[str]] """Command to be executed when running a container from an image.""" credentials_name: Optional[str] @@ -246,7 +247,7 @@ class Logging(TypedDict, total=False): class ProbesLivenessProbeProbeExec(TypedDict, total=False): - command: Required[List[str]] + command: Required[SequenceNotStr[str]] """Command to be executed inside the running container.""" @@ -307,7 +308,7 @@ class ProbesLivenessProbe(TypedDict, total=False): class ProbesReadinessProbeProbeExec(TypedDict, total=False): - command: Required[List[str]] + command: Required[SequenceNotStr[str]] """Command to be executed inside the running container.""" @@ -368,7 +369,7 @@ class ProbesReadinessProbe(TypedDict, total=False): class ProbesStartupProbeProbeExec(TypedDict, total=False): - command: Required[List[str]] + command: Required[SequenceNotStr[str]] """Command to be executed inside the running container.""" diff --git a/src/gcore/types/cloud/inference/deployment_update_params.py b/src/gcore/types/cloud/inference/deployment_update_params.py index e23312d9..047799c7 100644 --- a/src/gcore/types/cloud/inference/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Required, Annotated, TypedDict +from ...._types import SequenceNotStr from ...._utils import PropertyInfo from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam @@ -44,7 +45,7 @@ class DeploymentUpdateParams(TypedDict, total=False): project_id: int """Project ID""" - api_keys: Optional[List[str]] + api_keys: Optional[SequenceNotStr[str]] """List of API keys for the inference instance. Multiple keys can be attached to one deployment.If `auth_enabled` and `api_keys` @@ -61,7 +62,7 @@ class DeploymentUpdateParams(TypedDict, total=False): `api_keys` are both specified, a ValidationError will be raised. """ - command: Optional[List[str]] + command: Optional[SequenceNotStr[str]] """Command to be executed when running a container from an image.""" containers: Optional[Iterable[Container]] @@ -240,7 +241,7 @@ class Logging(TypedDict, total=False): class ProbesLivenessProbeProbeExec(TypedDict, total=False): - command: List[str] + command: SequenceNotStr[str] """Command to be executed inside the running container.""" @@ -301,7 +302,7 @@ class ProbesLivenessProbe(TypedDict, total=False): class ProbesReadinessProbeProbeExec(TypedDict, total=False): - command: List[str] + command: SequenceNotStr[str] """Command to be executed inside the running container.""" @@ -362,7 +363,7 @@ class ProbesReadinessProbe(TypedDict, total=False): class ProbesStartupProbeProbeExec(TypedDict, total=False): - command: List[str] + command: SequenceNotStr[str] """Command to be executed inside the running container.""" 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 4947252e..a9af1025 100644 --- a/src/gcore/types/cloud/instance_assign_security_group_params.py +++ b/src/gcore/types/cloud/instance_assign_security_group_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict +from ..._types import SequenceNotStr + __all__ = ["InstanceAssignSecurityGroupParams", "PortsSecurityGroupName"] @@ -24,5 +26,5 @@ class PortsSecurityGroupName(TypedDict, total=False): port_id: Required[Optional[str]] """Port ID. If None, security groups will be applied to all ports""" - security_group_names: Required[List[str]] + security_group_names: Required[SequenceNotStr[str]] """List of security group names""" diff --git a/src/gcore/types/cloud/instance_list_params.py b/src/gcore/types/cloud/instance_list_params.py index 54ca4270..17c76f8f 100644 --- a/src/gcore/types/cloud/instance_list_params.py +++ b/src/gcore/types/cloud/instance_list_params.py @@ -2,10 +2,11 @@ from __future__ import annotations -from typing import List, Union +from typing import Union from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict +from ..._types import SequenceNotStr from ..._utils import PropertyInfo __all__ = ["InstanceListParams"] @@ -120,7 +121,7 @@ class InstanceListParams(TypedDict, total=False): tag_key_value: str """Optional. Filter by tag key-value pairs.""" - tag_value: List[str] + tag_value: SequenceNotStr[str] """Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2""" type_ddos_profile: Literal["basic", "advanced"] 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 0ff60506..17e978a7 100644 --- a/src/gcore/types/cloud/instance_unassign_security_group_params.py +++ b/src/gcore/types/cloud/instance_unassign_security_group_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict +from ..._types import SequenceNotStr + __all__ = ["InstanceUnassignSecurityGroupParams", "PortsSecurityGroupName"] @@ -24,5 +26,5 @@ class PortsSecurityGroupName(TypedDict, total=False): port_id: Required[Optional[str]] """Port ID. If None, security groups will be applied to all ports""" - security_group_names: Required[List[str]] + security_group_names: Required[SequenceNotStr[str]] """List of security group names""" diff --git a/src/gcore/types/cloud/instances/image_list_params.py b/src/gcore/types/cloud/instances/image_list_params.py index 075fe52e..1e1d2903 100644 --- a/src/gcore/types/cloud/instances/image_list_params.py +++ b/src/gcore/types/cloud/instances/image_list_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal, TypedDict +from ...._types import SequenceNotStr + __all__ = ["ImageListParams"] @@ -19,7 +20,7 @@ class ImageListParams(TypedDict, total=False): private: str """Any value to show private images""" - tag_key: List[str] + tag_key: SequenceNotStr[str] """Filter by tag keys.""" tag_key_value: str diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index d3951c2d..7a4c3051 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict +from ..._types import SequenceNotStr from .http_method import HTTPMethod from .lb_algorithm import LbAlgorithm from .lb_pool_protocol import LbPoolProtocol @@ -313,7 +314,7 @@ class Listener(TypedDict, total=False): protocol_port: Required[int] """Protocol port""" - allowed_cidrs: Optional[List[str]] + allowed_cidrs: Optional[SequenceNotStr[str]] """Network CIDRs from which service will be accessible""" connection_limit: int @@ -334,7 +335,7 @@ class Listener(TypedDict, total=False): PROMETHEUS listener """ - sni_secret_id: List[str] + sni_secret_id: SequenceNotStr[str] """ List of secrets IDs containing PKCS12 format certificate/key bundles for `TERMINATED_HTTPS` or PROMETHEUS listeners diff --git a/src/gcore/types/cloud/load_balancer_list_params.py b/src/gcore/types/cloud/load_balancer_list_params.py index 704c2eb3..81ab5ea7 100644 --- a/src/gcore/types/cloud/load_balancer_list_params.py +++ b/src/gcore/types/cloud/load_balancer_list_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import TypedDict +from ..._types import SequenceNotStr + __all__ = ["LoadBalancerListParams"] @@ -39,7 +40,7 @@ class LoadBalancerListParams(TypedDict, total=False): show_stats: bool """Show statistics""" - tag_key: List[str] + tag_key: SequenceNotStr[str] """Filter by tag keys.""" tag_key_value: str 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 c7209f66..a15d72e2 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 @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal, Required, TypedDict +from ....._types import SequenceNotStr + __all__ = ["RuleCreateParams"] @@ -46,5 +47,5 @@ class RuleCreateParams(TypedDict, total=False): For example, the name of the cookie to evaluate. """ - tags: List[str] + 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 f2c7004b..4694d1b8 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 @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal, Required, TypedDict +from ....._types import SequenceNotStr + __all__ = ["RuleReplaceParams"] @@ -31,7 +32,7 @@ class RuleReplaceParams(TypedDict, total=False): For example, the name of the cookie to evaluate. """ - tags: List[str] + tags: SequenceNotStr[str] """A list of simple strings assigned to the l7 rule""" type: Literal[ diff --git a/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py b/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py index f4bb93b8..2ffea9c0 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py +++ b/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal, Required, TypedDict +from ...._types import SequenceNotStr + __all__ = ["L7PolicyCreateParams"] @@ -50,5 +51,5 @@ class L7PolicyCreateParams(TypedDict, total=False): Only valid if action is `REDIRECT_TO_URL`. """ - tags: List[str] + tags: SequenceNotStr[str] """A list of simple strings assigned to the resource.""" 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 index 697b0954..2ed23ebc 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py +++ b/src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal, Required, TypedDict +from ...._types import SequenceNotStr + __all__ = ["L7PolicyReplaceParams"] @@ -47,5 +48,5 @@ class L7PolicyReplaceParams(TypedDict, total=False): Only valid if action is `REDIRECT_TO_URL`. """ - tags: List[str] + tags: SequenceNotStr[str] """A list of simple strings assigned to the resource.""" diff --git a/src/gcore/types/cloud/load_balancers/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py index 5afdc99f..7f7bf451 100644 --- a/src/gcore/types/cloud/load_balancers/listener_create_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict +from ...._types import SequenceNotStr from ..lb_listener_protocol import LbListenerProtocol __all__ = ["ListenerCreateParams", "UserList"] @@ -29,7 +30,7 @@ class ListenerCreateParams(TypedDict, total=False): protocol_port: Required[int] """Protocol port""" - allowed_cidrs: Optional[List[str]] + allowed_cidrs: Optional[SequenceNotStr[str]] """Network CIDRs from which service will be accessible""" connection_limit: int @@ -47,7 +48,7 @@ class ListenerCreateParams(TypedDict, total=False): PROMETHEUS listener """ - sni_secret_id: List[str] + sni_secret_id: SequenceNotStr[str] """ List of secrets IDs containing PKCS12 format certificate/key bundles for `TERMINATED_HTTPS` or PROMETHEUS listeners diff --git a/src/gcore/types/cloud/load_balancers/listener_update_params.py b/src/gcore/types/cloud/load_balancers/listener_update_params.py index 8c520b8f..492c990d 100644 --- a/src/gcore/types/cloud/load_balancers/listener_update_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_update_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict +from ...._types import SequenceNotStr + __all__ = ["ListenerUpdateParams", "UserList"] @@ -15,7 +17,7 @@ class ListenerUpdateParams(TypedDict, total=False): region_id: int """Region ID""" - allowed_cidrs: Optional[List[str]] + allowed_cidrs: Optional[SequenceNotStr[str]] """Network CIDRs from which service will be accessible""" connection_limit: int @@ -30,7 +32,7 @@ class ListenerUpdateParams(TypedDict, total=False): PROMETHEUS load balancer """ - sni_secret_id: Optional[List[str]] + sni_secret_id: Optional[SequenceNotStr[str]] """ List of secret's ID containing PKCS12 format certificate/key bundfles for `TERMINATED_HTTPS` or PROMETHEUS listeners diff --git a/src/gcore/types/cloud/network_list_params.py b/src/gcore/types/cloud/network_list_params.py index fd80aecd..a690ab5b 100644 --- a/src/gcore/types/cloud/network_list_params.py +++ b/src/gcore/types/cloud/network_list_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal, TypedDict +from ..._types import SequenceNotStr + __all__ = ["NetworkListParams"] @@ -33,7 +34,7 @@ class NetworkListParams(TypedDict, total=False): directions (`created_at.desc`). """ - tag_key: List[str] + tag_key: SequenceNotStr[str] """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index 9fd4a938..6d8b3749 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Required, TypedDict +from ...._types import SequenceNotStr from ..ip_version import IPVersion __all__ = ["SubnetCreateParams", "HostRoute"] @@ -32,7 +33,7 @@ class SubnetCreateParams(TypedDict, total=False): Must be explicitly 'false' when `gateway_ip` is null. """ - dns_nameservers: Optional[List[str]] + dns_nameservers: Optional[SequenceNotStr[str]] """List IP addresses of DNS servers to advertise via DHCP.""" enable_dhcp: bool diff --git a/src/gcore/types/cloud/networks/subnet_list_params.py b/src/gcore/types/cloud/networks/subnet_list_params.py index ecae30b7..4327998f 100644 --- a/src/gcore/types/cloud/networks/subnet_list_params.py +++ b/src/gcore/types/cloud/networks/subnet_list_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal, TypedDict +from ...._types import SequenceNotStr + __all__ = ["SubnetListParams"] @@ -47,7 +48,7 @@ class SubnetListParams(TypedDict, total=False): directions (`name.asc`). """ - tag_key: List[str] + tag_key: SequenceNotStr[str] """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index 966b3ccf..455119cc 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict +from ...._types import SequenceNotStr from ..tag_update_map_param import TagUpdateMapParam __all__ = ["SubnetUpdateParams", "HostRoute"] @@ -17,7 +18,7 @@ class SubnetUpdateParams(TypedDict, total=False): region_id: int """Region ID""" - dns_nameservers: Optional[List[str]] + dns_nameservers: Optional[SequenceNotStr[str]] """List IP addresses of DNS servers to advertise via DHCP.""" enable_dhcp: Optional[bool] diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py b/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py index 84c497bb..cb8aa477 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import TypedDict +from ...._types import SequenceNotStr + __all__ = ["VipReplaceConnectedPortsParams"] @@ -13,5 +14,5 @@ class VipReplaceConnectedPortsParams(TypedDict, total=False): region_id: int - port_ids: List[str] + port_ids: SequenceNotStr[str] """List of port IDs that will share one VIP""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py b/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py index d93b4303..d11d10a0 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import TypedDict +from ...._types import SequenceNotStr + __all__ = ["VipUpdateConnectedPortsParams"] @@ -13,5 +14,5 @@ class VipUpdateConnectedPortsParams(TypedDict, total=False): region_id: int - port_ids: List[str] + port_ids: SequenceNotStr[str] """List of port IDs that will share one VIP""" diff --git a/src/gcore/types/cloud/security_group_create_params.py b/src/gcore/types/cloud/security_group_create_params.py index 4431da3c..4721a5dc 100644 --- a/src/gcore/types/cloud/security_group_create_params.py +++ b/src/gcore/types/cloud/security_group_create_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Literal, Required, TypedDict +from ..._types import SequenceNotStr + __all__ = ["SecurityGroupCreateParams", "SecurityGroup", "SecurityGroupSecurityGroupRule"] @@ -16,7 +18,7 @@ class SecurityGroupCreateParams(TypedDict, total=False): security_group: Required[SecurityGroup] """Security group""" - instances: List[str] + instances: SequenceNotStr[str] """List of instances""" diff --git a/src/gcore/types/cloud/security_group_list_params.py b/src/gcore/types/cloud/security_group_list_params.py index 8ba036cc..676a5d48 100644 --- a/src/gcore/types/cloud/security_group_list_params.py +++ b/src/gcore/types/cloud/security_group_list_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import TypedDict +from ..._types import SequenceNotStr + __all__ = ["SecurityGroupListParams"] @@ -19,7 +20,7 @@ class SecurityGroupListParams(TypedDict, total=False): offset: int """Offset value is used to exclude the first set of records from the result""" - tag_key: List[str] + tag_key: SequenceNotStr[str] """Filter by tag keys.""" tag_key_value: str diff --git a/src/gcore/types/cloud/usage_report_get_params.py b/src/gcore/types/cloud/usage_report_get_params.py index 336bcd46..ea7a3e0e 100644 --- a/src/gcore/types/cloud/usage_report_get_params.py +++ b/src/gcore/types/cloud/usage_report_get_params.py @@ -6,6 +6,7 @@ from datetime import datetime from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from ..._types import SequenceNotStr from ..._utils import PropertyInfo __all__ = [ @@ -120,7 +121,7 @@ class SchemaFilterSchemaFilterSnapshotSerializer(TypedDict, total=False): type: Required[Literal["snapshot"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -130,7 +131,7 @@ class SchemaFilterSchemaFilterInstanceSerializer(TypedDict, total=False): type: Required[Literal["instance"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -140,7 +141,7 @@ class SchemaFilterSchemaFilterAIClusterSerializer(TypedDict, total=False): type: Required[Literal["ai_cluster"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -150,7 +151,7 @@ class SchemaFilterSchemaFilterAIVirtualClusterSerializer(TypedDict, total=False) type: Required[Literal["ai_virtual_cluster"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -160,7 +161,7 @@ class SchemaFilterSchemaFilterBasicVmSerializer(TypedDict, total=False): type: Required[Literal["basic_vm"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -170,7 +171,7 @@ class SchemaFilterSchemaFilterBaremetalSerializer(TypedDict, total=False): type: Required[Literal["baremetal"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -180,7 +181,7 @@ class SchemaFilterSchemaFilterVolumeSerializer(TypedDict, total=False): type: Required[Literal["volume"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -190,7 +191,7 @@ class SchemaFilterSchemaFilterFileShareSerializer(TypedDict, total=False): type: Required[Literal["file_share"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -200,7 +201,7 @@ class SchemaFilterSchemaFilterImageSerializer(TypedDict, total=False): type: Required[Literal["image"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -210,7 +211,7 @@ class SchemaFilterSchemaFilterFloatingIPSerializer(TypedDict, total=False): type: Required[Literal["floatingip"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -220,7 +221,7 @@ class SchemaFilterSchemaFilterEgressTrafficSerializer(TypedDict, total=False): type: Required[Literal["egress_traffic"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -230,7 +231,7 @@ class SchemaFilterSchemaFilterLoadBalancerSerializer(TypedDict, total=False): type: Required[Literal["load_balancer"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -240,7 +241,7 @@ class SchemaFilterSchemaFilterExternalIPSerializer(TypedDict, total=False): type: Required[Literal["external_ip"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -250,7 +251,7 @@ class SchemaFilterSchemaFilterBackupSerializer(TypedDict, total=False): type: Required[Literal["backup"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -260,7 +261,7 @@ class SchemaFilterSchemaFilterLogIndexSerializer(TypedDict, total=False): type: Required[Literal["log_index"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -270,7 +271,7 @@ class SchemaFilterSchemaFilterFunctionsSerializer(TypedDict, total=False): type: Required[Literal["functions"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -280,7 +281,7 @@ class SchemaFilterSchemaFilterFunctionsCallsSerializer(TypedDict, total=False): type: Required[Literal["functions_calls"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -290,7 +291,7 @@ class SchemaFilterSchemaFilterFunctionsTrafficSerializer(TypedDict, total=False) type: Required[Literal["functions_traffic"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -300,7 +301,7 @@ class SchemaFilterSchemaFilterContainersSerializer(TypedDict, total=False): type: Required[Literal["containers"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -310,7 +311,7 @@ class SchemaFilterSchemaFilterInferenceSerializer(TypedDict, total=False): type: Required[Literal["inference"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -320,7 +321,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLVolumeSerializer(TypedDict, total=F type: Required[Literal["dbaas_postgresql_volume"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -330,7 +331,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLPublicNetworkSerializer(TypedDict, type: Required[Literal["dbaas_postgresql_public_network"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -340,7 +341,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSqlcpuSerializer(TypedDict, total=Fals type: Required[Literal["dbaas_postgresql_cpu"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -350,7 +351,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLMemorySerializer(TypedDict, total=F type: Required[Literal["dbaas_postgresql_memory"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" @@ -360,7 +361,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer(TypedDict, total=F type: Required[Literal["dbaas_postgresql_connection_pooler"]] - values: Required[List[str]] + values: Required[SequenceNotStr[str]] """List of field values to filter""" diff --git a/src/gcore/types/cloud/volume_list_params.py b/src/gcore/types/cloud/volume_list_params.py index 18573ee7..11fac11f 100644 --- a/src/gcore/types/cloud/volume_list_params.py +++ b/src/gcore/types/cloud/volume_list_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import TypedDict +from ..._types import SequenceNotStr + __all__ = ["VolumeListParams"] @@ -45,7 +46,7 @@ class VolumeListParams(TypedDict, total=False): Offset value is used to exclude the first set of records from the result """ - tag_key: List[str] + tag_key: SequenceNotStr[str] """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str diff --git a/src/gcore/types/dns/metric_list_params.py b/src/gcore/types/dns/metric_list_params.py index d6c0f850..46e9a926 100644 --- a/src/gcore/types/dns/metric_list_params.py +++ b/src/gcore/types/dns/metric_list_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Iterable from typing_extensions import TypedDict +from ..._types import SequenceNotStr + __all__ = ["MetricListParams"] @@ -15,7 +17,7 @@ class MetricListParams(TypedDict, total=False): client. Ignored for client """ - zone_names: List[str] + zone_names: SequenceNotStr[str] """ Admin and technical user can specify `monitor_id` to get metrics for particular zone. Ignored for client diff --git a/src/gcore/types/dns/zone_list_params.py b/src/gcore/types/dns/zone_list_params.py index f5e809b5..256ed922 100644 --- a/src/gcore/types/dns/zone_list_params.py +++ b/src/gcore/types/dns/zone_list_params.py @@ -2,10 +2,11 @@ from __future__ import annotations -from typing import List, Union, Iterable +from typing import Union, Iterable from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict +from ..._types import SequenceNotStr from ..._utils import PropertyInfo __all__ = ["ZoneListParams"] @@ -35,7 +36,7 @@ class ZoneListParams(TypedDict, total=False): limit: int """Max number of records in response""" - name: List[str] + name: SequenceNotStr[str] """to pass several names `name=first&name=second...`""" offset: int 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 266bc5d0..a1edf88a 100644 --- a/src/gcore/types/waap/domains/advanced_rule_create_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_create_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import Literal, Required, TypedDict +from ...._types import SequenceNotStr + __all__ = ["AdvancedRuleCreateParams", "Action", "ActionBlock", "ActionTag"] @@ -54,7 +56,7 @@ class ActionBlock(TypedDict, total=False): class ActionTag(TypedDict, total=False): - tags: Required[List[str]] + tags: Required[SequenceNotStr[str]] """The list of user defined tags to tag the request with""" diff --git a/src/gcore/types/waap/domains/advanced_rule_update_params.py b/src/gcore/types/waap/domains/advanced_rule_update_params.py index 7f2fef03..f158d460 100644 --- a/src/gcore/types/waap/domains/advanced_rule_update_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_update_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import Literal, Required, TypedDict +from ...._types import SequenceNotStr + __all__ = ["AdvancedRuleUpdateParams", "Action", "ActionBlock", "ActionTag"] @@ -57,7 +59,7 @@ class ActionBlock(TypedDict, total=False): class ActionTag(TypedDict, total=False): - tags: Required[List[str]] + tags: Required[SequenceNotStr[str]] """The list of user defined tags to tag the request with""" diff --git a/src/gcore/types/waap/domains/api_path_create_params.py b/src/gcore/types/waap/domains/api_path_create_params.py index 59bd8cb2..bec29966 100644 --- a/src/gcore/types/waap/domains/api_path_create_params.py +++ b/src/gcore/types/waap/domains/api_path_create_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal, Required, TypedDict +from ...._types import SequenceNotStr + __all__ = ["APIPathCreateParams"] @@ -21,11 +22,11 @@ class APIPathCreateParams(TypedDict, total=False): brackets """ - api_groups: List[str] + api_groups: SequenceNotStr[str] """An array of api groups associated with the API path""" api_version: str """The API version""" - tags: List[str] + tags: SequenceNotStr[str] """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/api_path_list_params.py b/src/gcore/types/waap/domains/api_path_list_params.py index 31d1e176..b819dc8b 100644 --- a/src/gcore/types/waap/domains/api_path_list_params.py +++ b/src/gcore/types/waap/domains/api_path_list_params.py @@ -5,6 +5,8 @@ from typing import List, Optional from typing_extensions import Literal, TypedDict +from ...._types import SequenceNotStr + __all__ = ["APIPathListParams"] @@ -18,7 +20,7 @@ class APIPathListParams(TypedDict, total=False): http_scheme: Optional[Literal["HTTP", "HTTPS"]] """The different HTTP schemes an API path can have""" - ids: Optional[List[str]] + ids: Optional[SequenceNotStr[str]] """Filter by the path ID""" limit: int diff --git a/src/gcore/types/waap/domains/api_path_update_params.py b/src/gcore/types/waap/domains/api_path_update_params.py index 99f3abf3..71c995ba 100644 --- a/src/gcore/types/waap/domains/api_path_update_params.py +++ b/src/gcore/types/waap/domains/api_path_update_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import Literal, Required, TypedDict +from ...._types import SequenceNotStr + __all__ = ["APIPathUpdateParams"] @@ -12,7 +13,7 @@ class APIPathUpdateParams(TypedDict, total=False): domain_id: Required[int] """The domain ID""" - api_groups: List[str] + api_groups: SequenceNotStr[str] """An array of api groups associated with the API path""" path: str @@ -25,5 +26,5 @@ class APIPathUpdateParams(TypedDict, total=False): status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] """The status of the discovered API path""" - tags: List[str] + tags: SequenceNotStr[str] """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/custom_rule_create_params.py b/src/gcore/types/waap/domains/custom_rule_create_params.py index 3bb3ed5a..13bd6574 100644 --- a/src/gcore/types/waap/domains/custom_rule_create_params.py +++ b/src/gcore/types/waap/domains/custom_rule_create_params.py @@ -5,6 +5,8 @@ from typing import List, Iterable, Optional from typing_extensions import Literal, Required, TypedDict +from ...._types import SequenceNotStr + __all__ = [ "CustomRuleCreateParams", "Action", @@ -67,7 +69,7 @@ class ActionBlock(TypedDict, total=False): class ActionTag(TypedDict, total=False): - tags: Required[List[str]] + tags: Required[SequenceNotStr[str]] """The list of user defined tags to tag the request with""" @@ -95,7 +97,7 @@ class Action(TypedDict, total=False): class ConditionContentType(TypedDict, total=False): - content_type: Required[List[str]] + content_type: Required[SequenceNotStr[str]] """The list of content types to match against""" negation: bool @@ -103,7 +105,7 @@ class ConditionContentType(TypedDict, total=False): class ConditionCountry(TypedDict, total=False): - country_code: Required[List[str]] + country_code: Required[SequenceNotStr[str]] """ A list of ISO 3166-1 alpha-2 formatted strings representing the countries to match against @@ -114,7 +116,7 @@ class ConditionCountry(TypedDict, total=False): class ConditionFileExtension(TypedDict, total=False): - file_extension: Required[List[str]] + file_extension: Required[SequenceNotStr[str]] """The list of file extensions to match against""" negation: bool @@ -221,7 +223,7 @@ class ConditionRequestRate(TypedDict, total=False): ] """Possible HTTP request methods that can trigger a request rate condition""" - ips: Optional[List[str]] + ips: Optional[SequenceNotStr[str]] """A list of source IPs that can trigger a request rate condition""" user_defined_tag: Optional[str] @@ -262,7 +264,7 @@ class ConditionSessionRequestCount(TypedDict, total=False): class ConditionTags(TypedDict, total=False): - tags: Required[List[str]] + tags: Required[SequenceNotStr[str]] """A list of tags to match against the request tags""" negation: bool @@ -300,7 +302,7 @@ class ConditionUserAgent(TypedDict, total=False): class ConditionUserDefinedTags(TypedDict, total=False): - tags: Required[List[str]] + tags: Required[SequenceNotStr[str]] """A list of user-defined tags to match against the request tags""" negation: bool 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 9ac6c266..2978bc66 100644 --- a/src/gcore/types/waap/domains/custom_rule_update_params.py +++ b/src/gcore/types/waap/domains/custom_rule_update_params.py @@ -5,6 +5,8 @@ from typing import List, Iterable, Optional from typing_extensions import Literal, Required, TypedDict +from ...._types import SequenceNotStr + __all__ = [ "CustomRuleUpdateParams", "Action", @@ -70,7 +72,7 @@ class ActionBlock(TypedDict, total=False): class ActionTag(TypedDict, total=False): - tags: Required[List[str]] + tags: Required[SequenceNotStr[str]] """The list of user defined tags to tag the request with""" @@ -98,7 +100,7 @@ class Action(TypedDict, total=False): class ConditionContentType(TypedDict, total=False): - content_type: Required[List[str]] + content_type: Required[SequenceNotStr[str]] """The list of content types to match against""" negation: bool @@ -106,7 +108,7 @@ class ConditionContentType(TypedDict, total=False): class ConditionCountry(TypedDict, total=False): - country_code: Required[List[str]] + country_code: Required[SequenceNotStr[str]] """ A list of ISO 3166-1 alpha-2 formatted strings representing the countries to match against @@ -117,7 +119,7 @@ class ConditionCountry(TypedDict, total=False): class ConditionFileExtension(TypedDict, total=False): - file_extension: Required[List[str]] + file_extension: Required[SequenceNotStr[str]] """The list of file extensions to match against""" negation: bool @@ -224,7 +226,7 @@ class ConditionRequestRate(TypedDict, total=False): ] """Possible HTTP request methods that can trigger a request rate condition""" - ips: Optional[List[str]] + ips: Optional[SequenceNotStr[str]] """A list of source IPs that can trigger a request rate condition""" user_defined_tag: Optional[str] @@ -265,7 +267,7 @@ class ConditionSessionRequestCount(TypedDict, total=False): class ConditionTags(TypedDict, total=False): - tags: Required[List[str]] + tags: Required[SequenceNotStr[str]] """A list of tags to match against the request tags""" negation: bool @@ -303,7 +305,7 @@ class ConditionUserAgent(TypedDict, total=False): class ConditionUserDefinedTags(TypedDict, total=False): - tags: Required[List[str]] + tags: Required[SequenceNotStr[str]] """A list of user-defined tags to match against the request tags""" negation: bool diff --git a/src/gcore/types/waap/domains/insight_list_params.py b/src/gcore/types/waap/domains/insight_list_params.py index d0f6c156..7163f181 100644 --- a/src/gcore/types/waap/domains/insight_list_params.py +++ b/src/gcore/types/waap/domains/insight_list_params.py @@ -5,17 +5,19 @@ from typing import List, Optional from typing_extensions import Literal, TypedDict +from ...._types import SequenceNotStr + __all__ = ["InsightListParams"] class InsightListParams(TypedDict, total=False): - id: Optional[List[str]] + id: Optional[SequenceNotStr[str]] """The ID of the insight""" description: Optional[str] """The description of the insight. Supports '\\**' as a wildcard.""" - insight_type: Optional[List[str]] + insight_type: Optional[SequenceNotStr[str]] """The type of the insight""" limit: int diff --git a/src/gcore/types/waap/domains/insight_silence_list_params.py b/src/gcore/types/waap/domains/insight_silence_list_params.py index b36d9315..affcad4d 100644 --- a/src/gcore/types/waap/domains/insight_silence_list_params.py +++ b/src/gcore/types/waap/domains/insight_silence_list_params.py @@ -2,14 +2,16 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import Literal, TypedDict +from ...._types import SequenceNotStr + __all__ = ["InsightSilenceListParams"] class InsightSilenceListParams(TypedDict, total=False): - id: Optional[List[str]] + id: Optional[SequenceNotStr[str]] """The ID of the insight silence""" author: Optional[str] @@ -18,7 +20,7 @@ class InsightSilenceListParams(TypedDict, total=False): comment: Optional[str] """The comment of the insight silence""" - insight_type: Optional[List[str]] + insight_type: Optional[SequenceNotStr[str]] """The type of the insight silence""" limit: int diff --git a/src/gcore/types/waap/domains/setting_update_params.py b/src/gcore/types/waap/domains/setting_update_params.py index 2336f7e1..2b3ea5de 100644 --- a/src/gcore/types/waap/domains/setting_update_params.py +++ b/src/gcore/types/waap/domains/setting_update_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import TypedDict +from ...._types import SequenceNotStr + __all__ = ["SettingUpdateParams", "API", "DDOS"] @@ -17,7 +18,7 @@ class SettingUpdateParams(TypedDict, total=False): class API(TypedDict, total=False): - api_urls: List[str] + api_urls: SequenceNotStr[str] """The API URLs for a domain. If your domain has a common base URL for all API paths, it can be set here diff --git a/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py b/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py index 08ac1c8c..ff19e38c 100644 --- a/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py +++ b/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py @@ -5,6 +5,8 @@ from typing import List, Optional from typing_extensions import Literal, Required, TypedDict +from ...._types import SequenceNotStr + __all__ = ["StatisticGetEventsAggregatedParams"] @@ -21,10 +23,10 @@ class StatisticGetEventsAggregatedParams(TypedDict, total=False): If not provided, defaults to the current date and time. """ - ip: Optional[List[str]] + ip: Optional[SequenceNotStr[str]] """A list of IPs to filter event statistics.""" - reference_id: Optional[List[str]] + reference_id: Optional[SequenceNotStr[str]] """A list of reference IDs to filter event statistics.""" result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] diff --git a/src/gcore/types/waap/domains/statistic_get_requests_series_params.py b/src/gcore/types/waap/domains/statistic_get_requests_series_params.py index 79c24568..ef36b532 100644 --- a/src/gcore/types/waap/domains/statistic_get_requests_series_params.py +++ b/src/gcore/types/waap/domains/statistic_get_requests_series_params.py @@ -5,6 +5,8 @@ from typing import List, Optional from typing_extensions import Literal, Required, TypedDict +from ...._types import SequenceNotStr + __all__ = ["StatisticGetRequestsSeriesParams"] @@ -15,7 +17,7 @@ class StatisticGetRequestsSeriesParams(TypedDict, total=False): actions: List[Literal["allow", "block", "captcha", "handshake"]] """Filter the response by actions.""" - countries: List[str] + countries: SequenceNotStr[str] """Filter the response by country codes in ISO 3166-1 alpha-2 format.""" end: Optional[str] From eeaf5c27811d0c92997ec4c5766c0c1068eed9a9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 08:12:29 +0000 Subject: [PATCH 277/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/streaming/quality_sets.py | 4 +- .../resources/streaming/streams/streams.py | 58 ++++--------- src/gcore/types/streaming/stream.py | 83 +++++++++++-------- .../types/streaming/stream_create_params.py | 30 ++----- .../types/streaming/stream_update_params.py | 30 ++----- tests/api_resources/streaming/test_streams.py | 4 - 7 files changed, 85 insertions(+), 128 deletions(-) diff --git a/.stats.yml b/.stats.yml index f5d1947a..be28c55f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 501 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1a7494f99877ef48b0e33fb55f803ff97fe3618d2379c345c9393afad72c9e90.yml -openapi_spec_hash: 8ae4c37eea00eed48dce435bfe4c69c7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9173422927bf0e2262cf3450beee33d3e5d626259c2ca4318e9ab90cd960f969.yml +openapi_spec_hash: eaabed55b018d1b396a1f1c644383ecf config_hash: 7b3f93431b88defdad37f39dfa1a4fed diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index 1e44d42a..a80ce0b3 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -65,7 +65,7 @@ def list( [documentation](https://gcore.com/docs/streaming-platform/live-streams-and-videos-protocols-and-codecs/output-parameters-after-transcoding-bitrate-frame-rate-and-codecs). These values are the default for everyone. There is no need to configure anything additional. Read more about qiality in our blog - [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality/). + [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality). ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) Only for those cases when, in addition to the main parameters, it is necessary to use your own, then it is necessary to use custom quality sets. How to use: @@ -200,7 +200,7 @@ async def list( [documentation](https://gcore.com/docs/streaming-platform/live-streams-and-videos-protocols-and-codecs/output-parameters-after-transcoding-bitrate-frame-rate-and-codecs). These values are the default for everyone. There is no need to configure anything additional. Read more about qiality in our blog - [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality/). + [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality). ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) Only for those cases when, in addition to the main parameters, it is necessary to use your own, then it is necessary to use custom quality sets. How to use: diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 53784a3a..06bc5dcc 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -80,7 +80,6 @@ def create( dvr_enabled: bool | NotGiven = NOT_GIVEN, hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN, html_overlay: bool | NotGiven = NOT_GIVEN, - low_latency_enabled: bool | NotGiven = NOT_GIVEN, projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN, pull: bool | NotGiven = NOT_GIVEN, quality_set_id: int | NotGiven = NOT_GIVEN, @@ -184,19 +183,6 @@ def create( html_overlay: Switch on mode to insert and display real-time HTML overlay widgets on top of live streams - low_latency_enabled: Deprecated, always returns "true". The only exception is that the attribute can - only be used by clients that have previously used the old stream format. This - method is outdated since we've made it easier to manage streams. For your - convenience, you no longer need to set this parameter at the stage of creating a - stream. Now all streams are prepared in 2 formats simultaniously: Low Latency - and Legacy. You can get the desired output format in the attributes - "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. - - --- - - Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the - "`hls_mpegts_url`" attribute instead. - projection: Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, then use parameters of that video player. Modes: @@ -210,9 +196,10 @@ def create( values: - true – stream is received by PULL method. Use this when need to get stream - from external server by srt, rtmp\\ss, hls, dash, etc protocols. + from external server. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + from end-device to our Streaming Platform, i.e. from your encoder, mobile app + or OBS Studio. quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to your conditions. Look at GET /`quality_sets` method @@ -230,10 +217,11 @@ def create( round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 24 hours of - inactivity of your streams we will stop PULL-ing, and will switch "active" field - to "false". Please, note that this field is for PULL only, so is not suitable - for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 2 hours of + inactivity of your original stream, the system stops PULL requests and the + stream is deactivated (the "active" field switches to "false"). Please, note + that this field is for PULL only, so is not suitable for PUSH. Look at fields + "`push_url`" and "`push_url_srt`" from GET method. extra_headers: Send extra headers @@ -258,7 +246,6 @@ def create( "dvr_enabled": dvr_enabled, "hls_mpegts_endlist_tag": hls_mpegts_endlist_tag, "html_overlay": html_overlay, - "low_latency_enabled": low_latency_enabled, "projection": projection, "pull": pull, "quality_set_id": quality_set_id, @@ -792,7 +779,6 @@ async def create( dvr_enabled: bool | NotGiven = NOT_GIVEN, hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN, html_overlay: bool | NotGiven = NOT_GIVEN, - low_latency_enabled: bool | NotGiven = NOT_GIVEN, projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN, pull: bool | NotGiven = NOT_GIVEN, quality_set_id: int | NotGiven = NOT_GIVEN, @@ -896,19 +882,6 @@ async def create( html_overlay: Switch on mode to insert and display real-time HTML overlay widgets on top of live streams - low_latency_enabled: Deprecated, always returns "true". The only exception is that the attribute can - only be used by clients that have previously used the old stream format. This - method is outdated since we've made it easier to manage streams. For your - convenience, you no longer need to set this parameter at the stage of creating a - stream. Now all streams are prepared in 2 formats simultaniously: Low Latency - and Legacy. You can get the desired output format in the attributes - "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. - - --- - - Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the - "`hls_mpegts_url`" attribute instead. - projection: Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, then use parameters of that video player. Modes: @@ -922,9 +895,10 @@ async def create( values: - true – stream is received by PULL method. Use this when need to get stream - from external server by srt, rtmp\\ss, hls, dash, etc protocols. + from external server. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + from end-device to our Streaming Platform, i.e. from your encoder, mobile app + or OBS Studio. quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to your conditions. Look at GET /`quality_sets` method @@ -942,10 +916,11 @@ async def create( round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 24 hours of - inactivity of your streams we will stop PULL-ing, and will switch "active" field - to "false". Please, note that this field is for PULL only, so is not suitable - for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 2 hours of + inactivity of your original stream, the system stops PULL requests and the + stream is deactivated (the "active" field switches to "false"). Please, note + that this field is for PULL only, so is not suitable for PUSH. Look at fields + "`push_url`" and "`push_url_srt`" from GET method. extra_headers: Send extra headers @@ -970,7 +945,6 @@ async def create( "dvr_enabled": dvr_enabled, "hls_mpegts_endlist_tag": hls_mpegts_endlist_tag, "html_overlay": html_overlay, - "low_latency_enabled": low_latency_enabled, "projection": projection, "pull": pull, "quality_set_id": quality_set_id, diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py index 9d49c2c5..903a1515 100644 --- a/src/gcore/types/streaming/stream.py +++ b/src/gcore/types/streaming/stream.py @@ -245,22 +245,6 @@ class Stream(BaseModel): live: Optional[bool] = None """State of receiving and transcoding master stream from source by main server""" - low_latency_enabled: Optional[bool] = None - """ - Deprecated, always returns "true". The only exception is that the attribute can - only be used by clients that have previously used the old stream format. This - method is outdated since we've made it easier to manage streams. For your - convenience, you no longer need to set this parameter at the stage of creating a - stream. Now all streams are prepared in 2 formats simultaniously: Low Latency - and Legacy. You can get the desired output format in the attributes - "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. - - --- - - Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the - "`hls_mpegts_url`" attribute instead. - """ - projection: Optional[Literal["regular", "vr360", "vr180", "vr360tb"]] = None """ Visualization mode for 360° streams, how the stream is rendered in our web @@ -279,9 +263,10 @@ class Stream(BaseModel): Has two possible values: - true – stream is received by PULL method. Use this when need to get stream - from external server by srt, rtmp\\ss, hls, dash, etc protocols. + from external server. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + from end-device to our Streaming Platform, i.e. from your encoder, mobile app + or OBS Studio. """ push_url: Optional[str] = None @@ -298,13 +283,23 @@ class Stream(BaseModel): port 443 in the URL. Here’s an example: rtmps://vp-push.domain.com:443/in/stream?key. - If you're still having trouble, then your encoder may not support RTMPS. - Double-check the documentation for your encoder. For advanced customers only: - For your complexly distributed broadcast systems, it is also possible to - additionally output an array of multi-regional ingestion points for manual - selection from them. To activate this mode, contact your manager or the - Support Team to activate the "`multi_region_push_urls`" attibute. But if you - clearly don’t understand why you need this, then it’s best to use the default - single URL in the "`push_url`" attribute. + 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. For + example, transcoding process will fail if: + + - you are pushing primary and backup RTMP to the same single `push_url` + simultaneously + - you are pushing RTMP to `push_url` and SRT to `push_url_srt` simultaneously + + For advanced customers only: For your complexly distributed broadcast systems, + it is also possible to additionally output an array of multi-regional ingestion + points for manual selection from them. To activate this mode, contact your + manager or the Support Team to activate the "`multi_region_push_urls`" attibute. + But if you clearly don’t understand why you need this, then it’s best to use the + default single URL in the "`push_url`" attribute. """ push_url_srt: Optional[str] = None @@ -329,6 +324,15 @@ class Stream(BaseModel): sender side. The default values do not take into account your specific scenarios and do not work well. If necessary, ask us and we will help you. + Please note that 1 connection and 1 protocol can be used at a single moment in + time per unique stream key input. Trying to send 2+ connection requests into + `push_url_srt` to once, or 2+ protocols at once will not lead to a result. For + example, transcoding process will fail if: + + - you are pushing primary and backup SRT to the same single `push_url_srt` + simultaneously + - you are pushing RTMP to `push_url` and SRT to `push_url_srt` simultaneously + See more information and best practices about SRT protocol in the Product Documentation. """ @@ -343,9 +347,9 @@ class Stream(BaseModel): receives video data. Signaling is a term to describe communication between WebRTC endpoints, needed to initiate and maintain a session. WHIP is an open specification for a simple signaling protocol for starting WebRTC sessions in an - outgoing direction, (i.e., streaming from your device). **WebRTC stream encoding - parameters** At least one video and audio track both must be present in the - stream: + outgoing direction, (i.e., streaming from your device). There is the primary + link only for WHIP, so no backup link. **WebRTC stream encoding parameters** At + least one video and audio track both must be present in the stream: - Video must be encoded with H.264. - Audio must be encoded with OPUS. Note. Specifically for WebRTC mode a method @@ -361,8 +365,18 @@ class Stream(BaseModel): https://stackblitz.com/edit/stackblitz-starters-j2r9ar?file=index.html Also try to use the feature in UI of the Customer Portal. In the Streaming section inside the settings of a specific live stream, a new section "Quick start in - browser" has been added. More information in the Product Documentation on the - website. + browser" has been added. + + Please note that 1 connection and 1 protocol can be used at a single moment in + time per unique stream key input. Trying to send 2+ connection requests into + `push_url_whip` to once, or 2+ protocols at once will not lead to a result. For + example, transcoding process will fail if: + + - you are pushing primary and backup WHIP to the same single `push_url_whip` + simultaneously + - you are pushing WHIP to `push_url_whip` and RTMP to `push_url` simultaneously + + More information in the Product Documentation on the website. """ quality_set_id: Optional[int] = None @@ -429,10 +443,11 @@ class Stream(BaseModel): round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 24 hours of - inactivity of your streams we will stop PULL-ing, and will switch "active" field - to "false". Please, note that this field is for PULL only, so is not suitable - for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 2 hours of + inactivity of your original stream, the system stops PULL requests and the + stream is deactivated (the "active" field switches to "false"). Please, note + that this field is for PULL only, so is not suitable for PUSH. Look at fields + "`push_url`" and "`push_url_srt`" from GET method. """ video_height: Optional[float] = None diff --git a/src/gcore/types/streaming/stream_create_params.py b/src/gcore/types/streaming/stream_create_params.py index 8c19a2d0..a8254826 100644 --- a/src/gcore/types/streaming/stream_create_params.py +++ b/src/gcore/types/streaming/stream_create_params.py @@ -94,22 +94,6 @@ class StreamCreateParams(TypedDict, total=False): live streams """ - low_latency_enabled: bool - """ - Deprecated, always returns "true". The only exception is that the attribute can - only be used by clients that have previously used the old stream format. This - method is outdated since we've made it easier to manage streams. For your - convenience, you no longer need to set this parameter at the stage of creating a - stream. Now all streams are prepared in 2 formats simultaniously: Low Latency - and Legacy. You can get the desired output format in the attributes - "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. - - --- - - Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the - "`hls_mpegts_url`" attribute instead. - """ - projection: Literal["regular", "vr360", "vr180", "vr360tb"] """ Visualization mode for 360° streams, how the stream is rendered in our web @@ -128,9 +112,10 @@ class StreamCreateParams(TypedDict, total=False): Has two possible values: - true – stream is received by PULL method. Use this when need to get stream - from external server by srt, rtmp\\ss, hls, dash, etc protocols. + from external server. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + from end-device to our Streaming Platform, i.e. from your encoder, mobile app + or OBS Studio. """ quality_set_id: int @@ -158,8 +143,9 @@ class StreamCreateParams(TypedDict, total=False): round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 24 hours of - inactivity of your streams we will stop PULL-ing, and will switch "active" field - to "false". Please, note that this field is for PULL only, so is not suitable - for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 2 hours of + inactivity of your original stream, the system stops PULL requests and the + stream is deactivated (the "active" field switches to "false"). Please, note + that this field is for PULL only, so is not suitable for PUSH. Look at fields + "`push_url`" and "`push_url_srt`" from GET method. """ diff --git a/src/gcore/types/streaming/stream_update_params.py b/src/gcore/types/streaming/stream_update_params.py index 0f30b641..ecff938d 100644 --- a/src/gcore/types/streaming/stream_update_params.py +++ b/src/gcore/types/streaming/stream_update_params.py @@ -98,22 +98,6 @@ class Stream(TypedDict, total=False): live streams """ - low_latency_enabled: bool - """ - Deprecated, always returns "true". The only exception is that the attribute can - only be used by clients that have previously used the old stream format. This - method is outdated since we've made it easier to manage streams. For your - convenience, you no longer need to set this parameter at the stage of creating a - stream. Now all streams are prepared in 2 formats simultaniously: Low Latency - and Legacy. You can get the desired output format in the attributes - "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. - - --- - - Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the - "`hls_mpegts_url`" attribute instead. - """ - projection: Literal["regular", "vr360", "vr180", "vr360tb"] """ Visualization mode for 360° streams, how the stream is rendered in our web @@ -132,9 +116,10 @@ class Stream(TypedDict, total=False): Has two possible values: - true – stream is received by PULL method. Use this when need to get stream - from external server by srt, rtmp\\ss, hls, dash, etc protocols. + from external server. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + from end-device to our Streaming Platform, i.e. from your encoder, mobile app + or OBS Studio. """ quality_set_id: int @@ -162,8 +147,9 @@ class Stream(TypedDict, total=False): round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 24 hours of - inactivity of your streams we will stop PULL-ing, and will switch "active" field - to "false". Please, note that this field is for PULL only, so is not suitable - for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 2 hours of + inactivity of your original stream, the system stops PULL requests and the + stream is deactivated (the "active" field switches to "false"). Please, note + that this field is for PULL only, so is not suitable for PUSH. Look at fields + "`push_url`" and "`push_url_srt`" from GET method. """ diff --git a/tests/api_resources/streaming/test_streams.py b/tests/api_resources/streaming/test_streams.py index 324be334..dfe61205 100644 --- a/tests/api_resources/streaming/test_streams.py +++ b/tests/api_resources/streaming/test_streams.py @@ -45,7 +45,6 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: dvr_enabled=True, hls_mpegts_endlist_tag=True, html_overlay=False, - low_latency_enabled=True, projection="regular", pull=True, quality_set_id=0, @@ -101,7 +100,6 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "dvr_enabled": True, "hls_mpegts_endlist_tag": True, "html_overlay": False, - "low_latency_enabled": True, "projection": "regular", "pull": True, "quality_set_id": 0, @@ -426,7 +424,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> dvr_enabled=True, hls_mpegts_endlist_tag=True, html_overlay=False, - low_latency_enabled=True, projection="regular", pull=True, quality_set_id=0, @@ -482,7 +479,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "dvr_enabled": True, "hls_mpegts_endlist_tag": True, "html_overlay": False, - "low_latency_enabled": True, "projection": "regular", "pull": True, "quality_set_id": 0, From 46f1d6fb68c47fa99aac2702a8fc912be9395d17 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 14:09:58 +0000 Subject: [PATCH 278/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/waap/domains/waap_request_details.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index be28c55f..746d6821 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 501 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9173422927bf0e2262cf3450beee33d3e5d626259c2ca4318e9ab90cd960f969.yml -openapi_spec_hash: eaabed55b018d1b396a1f1c644383ecf +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6cf45f76c0a95bd78ec005813bc629157eb2dec4d4c763da0ba86f443c58022a.yml +openapi_spec_hash: 06925eca25df017eb66d26ea49c75257 config_hash: 7b3f93431b88defdad37f39dfa1a4fed diff --git a/src/gcore/types/waap/domains/waap_request_details.py b/src/gcore/types/waap/domains/waap_request_details.py index 7b560704..e3a1d9cd 100644 --- a/src/gcore/types/waap/domains/waap_request_details.py +++ b/src/gcore/types/waap/domains/waap_request_details.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Dict, List +from datetime import datetime from typing_extensions import Literal from ...._models import BaseModel @@ -151,7 +152,7 @@ class WaapRequestDetails(BaseModel): request_headers: Dict[str, object] """HTTP request headers""" - request_time: str + request_time: datetime """The time of the request""" request_type: str From 94a429873d4b6a59a23842fbfc9c09d5737a71b7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 21:06:08 +0000 Subject: [PATCH 279/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 746d6821..ead185e9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 501 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6cf45f76c0a95bd78ec005813bc629157eb2dec4d4c763da0ba86f443c58022a.yml openapi_spec_hash: 06925eca25df017eb66d26ea49c75257 -config_hash: 7b3f93431b88defdad37f39dfa1a4fed +config_hash: 012908fbfd9f4caa4e9d8caae876a8ce From e343c4fdd102789b7da7c3651e7c3a422f78dfa5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 21:06:45 +0000 Subject: [PATCH 280/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index ead185e9..a14a9da3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 501 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6cf45f76c0a95bd78ec005813bc629157eb2dec4d4c763da0ba86f443c58022a.yml openapi_spec_hash: 06925eca25df017eb66d26ea49c75257 -config_hash: 012908fbfd9f4caa4e9d8caae876a8ce +config_hash: bfa6d8a193ef1f135cede939f6f5b9e9 From 409d6e4921341a16293ae35dcfb3617588ed9e36 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 21:57:13 +0000 Subject: [PATCH 281/592] feat: improve future compat with pydantic v3 --- src/gcore/_base_client.py | 6 +- src/gcore/_compat.py | 96 ++++++++--------- src/gcore/_models.py | 80 +++++++------- src/gcore/_utils/__init__.py | 10 +- src/gcore/_utils/_compat.py | 45 ++++++++ src/gcore/_utils/_datetime_parse.py | 136 ++++++++++++++++++++++++ src/gcore/_utils/_transform.py | 6 +- src/gcore/_utils/_typing.py | 2 +- src/gcore/_utils/_utils.py | 1 - tests/test_models.py | 48 ++++----- tests/test_transform.py | 16 +-- tests/test_utils/test_datetime_parse.py | 110 +++++++++++++++++++ tests/utils.py | 8 +- 13 files changed, 432 insertions(+), 132 deletions(-) create mode 100644 src/gcore/_utils/_compat.py create mode 100644 src/gcore/_utils/_datetime_parse.py create mode 100644 tests/test_utils/test_datetime_parse.py diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index d28b3bfe..b4fe9249 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -59,7 +59,7 @@ ModelBuilderProtocol, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping -from ._compat import PYDANTIC_V2, model_copy, model_dump +from ._compat import PYDANTIC_V1, model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( APIResponse, @@ -232,7 +232,7 @@ def _set_private_attributes( model: Type[_T], options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None: self.__pydantic_private__ = {} self._model = model @@ -320,7 +320,7 @@ def _set_private_attributes( client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None: self.__pydantic_private__ = {} self._model = model diff --git a/src/gcore/_compat.py b/src/gcore/_compat.py index 92d9ee61..bdef67f0 100644 --- a/src/gcore/_compat.py +++ b/src/gcore/_compat.py @@ -12,14 +12,13 @@ _T = TypeVar("_T") _ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel) -# --------------- Pydantic v2 compatibility --------------- +# --------------- Pydantic v2, v3 compatibility --------------- # Pyright incorrectly reports some of our functions as overriding a method when they don't # pyright: reportIncompatibleMethodOverride=false -PYDANTIC_V2 = pydantic.VERSION.startswith("2.") +PYDANTIC_V1 = pydantic.VERSION.startswith("1.") -# v1 re-exports if TYPE_CHECKING: def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001 @@ -44,90 +43,92 @@ def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001 ... else: - if PYDANTIC_V2: - from pydantic.v1.typing import ( + # v1 re-exports + if PYDANTIC_V1: + from pydantic.typing import ( get_args as get_args, is_union as is_union, get_origin as get_origin, is_typeddict as is_typeddict, is_literal_type as is_literal_type, ) - from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime + from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime else: - from pydantic.typing import ( + from ._utils import ( get_args as get_args, is_union as is_union, get_origin as get_origin, + parse_date as parse_date, is_typeddict as is_typeddict, + parse_datetime as parse_datetime, is_literal_type as is_literal_type, ) - from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime # refactored config if TYPE_CHECKING: from pydantic import ConfigDict as ConfigDict else: - if PYDANTIC_V2: - from pydantic import ConfigDict - else: + if PYDANTIC_V1: # TODO: provide an error message here? ConfigDict = None + else: + from pydantic import ConfigDict as ConfigDict # renamed methods / properties def parse_obj(model: type[_ModelT], value: object) -> _ModelT: - if PYDANTIC_V2: - return model.model_validate(value) - else: + if PYDANTIC_V1: return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + else: + return model.model_validate(value) def field_is_required(field: FieldInfo) -> bool: - if PYDANTIC_V2: - return field.is_required() - return field.required # type: ignore + if PYDANTIC_V1: + return field.required # type: ignore + return field.is_required() def field_get_default(field: FieldInfo) -> Any: value = field.get_default() - if PYDANTIC_V2: - from pydantic_core import PydanticUndefined - - if value == PydanticUndefined: - return None + if PYDANTIC_V1: return value + from pydantic_core import PydanticUndefined + + if value == PydanticUndefined: + return None return value def field_outer_type(field: FieldInfo) -> Any: - if PYDANTIC_V2: - return field.annotation - return field.outer_type_ # type: ignore + if PYDANTIC_V1: + return field.outer_type_ # type: ignore + return field.annotation def get_model_config(model: type[pydantic.BaseModel]) -> Any: - if PYDANTIC_V2: - return model.model_config - return model.__config__ # type: ignore + if PYDANTIC_V1: + return model.__config__ # type: ignore + return model.model_config def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]: - if PYDANTIC_V2: - return model.model_fields - return model.__fields__ # type: ignore + if PYDANTIC_V1: + return model.__fields__ # type: ignore + return model.model_fields def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT: - if PYDANTIC_V2: - return model.model_copy(deep=deep) - return model.copy(deep=deep) # type: ignore + if PYDANTIC_V1: + return model.copy(deep=deep) # type: ignore + return model.model_copy(deep=deep) def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: - if PYDANTIC_V2: - return model.model_dump_json(indent=indent) - return model.json(indent=indent) # type: ignore + if PYDANTIC_V1: + return model.json(indent=indent) # type: ignore + return model.model_dump_json(indent=indent) def model_dump( @@ -139,14 +140,14 @@ def model_dump( warnings: bool = True, mode: Literal["json", "python"] = "python", ) -> dict[str, Any]: - if PYDANTIC_V2 or hasattr(model, "model_dump"): + if (not PYDANTIC_V1) or hasattr(model, "model_dump"): return model.model_dump( mode=mode, exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 - warnings=warnings if PYDANTIC_V2 else True, + warnings=True if PYDANTIC_V1 else warnings, ) return cast( "dict[str, Any]", @@ -159,9 +160,9 @@ def model_dump( def model_parse(model: type[_ModelT], data: Any) -> _ModelT: - if PYDANTIC_V2: - return model.model_validate(data) - return model.parse_obj(data) # pyright: ignore[reportDeprecated] + if PYDANTIC_V1: + return model.parse_obj(data) # pyright: ignore[reportDeprecated] + return model.model_validate(data) # generic models @@ -170,17 +171,16 @@ def model_parse(model: type[_ModelT], data: Any) -> _ModelT: class GenericModel(pydantic.BaseModel): ... else: - if PYDANTIC_V2: + if PYDANTIC_V1: + import pydantic.generics + + class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... + else: # there no longer needs to be a distinction in v2 but # we still have to create our own subclass to avoid # inconsistent MRO ordering errors class GenericModel(pydantic.BaseModel): ... - else: - import pydantic.generics - - class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... - # cached properties if TYPE_CHECKING: diff --git a/src/gcore/_models.py b/src/gcore/_models.py index 92f7c10b..3a6017ef 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -50,7 +50,7 @@ strip_annotated_type, ) from ._compat import ( - PYDANTIC_V2, + PYDANTIC_V1, ConfigDict, GenericModel as BaseGenericModel, get_args, @@ -81,11 +81,7 @@ class _ConfigProtocol(Protocol): class BaseModel(pydantic.BaseModel): - if PYDANTIC_V2: - model_config: ClassVar[ConfigDict] = ConfigDict( - extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) - ) - else: + if PYDANTIC_V1: @property @override @@ -95,6 +91,10 @@ def model_fields_set(self) -> set[str]: class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] extra: Any = pydantic.Extra.allow # type: ignore + else: + model_config: ClassVar[ConfigDict] = ConfigDict( + extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) + ) def to_dict( self, @@ -215,25 +215,25 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] if key not in model_fields: parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value - if PYDANTIC_V2: - _extra[key] = parsed - else: + if PYDANTIC_V1: _fields_set.add(key) fields_values[key] = parsed + else: + _extra[key] = parsed object.__setattr__(m, "__dict__", fields_values) - if PYDANTIC_V2: - # these properties are copied from Pydantic's `model_construct()` method - object.__setattr__(m, "__pydantic_private__", None) - object.__setattr__(m, "__pydantic_extra__", _extra) - object.__setattr__(m, "__pydantic_fields_set__", _fields_set) - else: + if PYDANTIC_V1: # init_private_attributes() does not exist in v2 m._init_private_attributes() # type: ignore # copied from Pydantic v1's `construct()` method object.__setattr__(m, "__fields_set__", _fields_set) + else: + # these properties are copied from Pydantic's `model_construct()` method + object.__setattr__(m, "__pydantic_private__", None) + object.__setattr__(m, "__pydantic_extra__", _extra) + object.__setattr__(m, "__pydantic_fields_set__", _fields_set) return m @@ -243,7 +243,7 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] # although not in practice model_construct = construct - if not PYDANTIC_V2: + if PYDANTIC_V1: # we define aliases for some of the new pydantic v2 methods so # that we can just document these methods without having to specify # a specific pydantic version as some users may not know which @@ -363,10 +363,10 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: if value is None: return field_get_default(field) - if PYDANTIC_V2: - type_ = field.annotation - else: + if PYDANTIC_V1: type_ = cast(type, field.outer_type_) # type: ignore + else: + type_ = field.annotation # type: ignore if type_ is None: raise RuntimeError(f"Unexpected field type is None for {key}") @@ -375,7 +375,7 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None: - if not PYDANTIC_V2: + if PYDANTIC_V1: # TODO return None @@ -628,30 +628,30 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, for variant in get_args(union): variant = strip_annotated_type(variant) if is_basemodel_type(variant): - if PYDANTIC_V2: - field = _extract_field_schema_pv2(variant, discriminator_field_name) - if not field: + if PYDANTIC_V1: + field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + if not field_info: continue # Note: if one variant defines an alias then they all should - discriminator_alias = field.get("serialization_alias") - - field_schema = field["schema"] + discriminator_alias = field_info.alias - if field_schema["type"] == "literal": - for entry in cast("LiteralSchema", field_schema)["expected"]: + if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): + for entry in get_args(annotation): if isinstance(entry, str): mapping[entry] = variant else: - field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] - if not field_info: + field = _extract_field_schema_pv2(variant, discriminator_field_name) + if not field: continue # Note: if one variant defines an alias then they all should - discriminator_alias = field_info.alias + discriminator_alias = field.get("serialization_alias") - if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): - for entry in get_args(annotation): + field_schema = field["schema"] + + if field_schema["type"] == "literal": + for entry in cast("LiteralSchema", field_schema)["expected"]: if isinstance(entry, str): mapping[entry] = variant @@ -714,7 +714,7 @@ class GenericModel(BaseGenericModel, BaseModel): pass -if PYDANTIC_V2: +if not PYDANTIC_V1: from pydantic import TypeAdapter as _TypeAdapter _CachedTypeAdapter = cast("TypeAdapter[object]", lru_cache(maxsize=None)(_TypeAdapter)) @@ -782,12 +782,12 @@ class FinalRequestOptions(pydantic.BaseModel): json_data: Union[Body, None] = None extra_json: Union[AnyMapping, None] = None - if PYDANTIC_V2: - model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) - else: + if PYDANTIC_V1: class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] arbitrary_types_allowed: bool = True + else: + model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) def get_max_retries(self, max_retries: int) -> int: if isinstance(self.max_retries, NotGiven): @@ -820,9 +820,9 @@ def construct( # type: ignore key: strip_not_given(value) for key, value in values.items() } - if PYDANTIC_V2: - return super().model_construct(_fields_set, **kwargs) - return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated] + if PYDANTIC_V1: + return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated] + return super().model_construct(_fields_set, **kwargs) if not TYPE_CHECKING: # type checkers incorrectly complain about this assignment diff --git a/src/gcore/_utils/__init__.py b/src/gcore/_utils/__init__.py index ca547ce5..dc64e29a 100644 --- a/src/gcore/_utils/__init__.py +++ b/src/gcore/_utils/__init__.py @@ -10,7 +10,6 @@ lru_cache as lru_cache, is_mapping as is_mapping, is_tuple_t as is_tuple_t, - parse_date as parse_date, is_iterable as is_iterable, is_sequence as is_sequence, coerce_float as coerce_float, @@ -23,7 +22,6 @@ coerce_boolean as coerce_boolean, coerce_integer as coerce_integer, file_from_path as file_from_path, - parse_datetime as parse_datetime, strip_not_given as strip_not_given, deepcopy_minimal as deepcopy_minimal, get_async_library as get_async_library, @@ -32,6 +30,13 @@ maybe_coerce_boolean as maybe_coerce_boolean, maybe_coerce_integer as maybe_coerce_integer, ) +from ._compat import ( + get_args as get_args, + is_union as is_union, + get_origin as get_origin, + is_typeddict as is_typeddict, + is_literal_type as is_literal_type, +) from ._typing import ( is_list_type as is_list_type, is_union_type as is_union_type, @@ -56,3 +61,4 @@ function_has_argument as function_has_argument, assert_signatures_in_sync as assert_signatures_in_sync, ) +from ._datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime diff --git a/src/gcore/_utils/_compat.py b/src/gcore/_utils/_compat.py new file mode 100644 index 00000000..dd703233 --- /dev/null +++ b/src/gcore/_utils/_compat.py @@ -0,0 +1,45 @@ +from __future__ import annotations + +import sys +import typing_extensions +from typing import Any, Type, Union, Literal, Optional +from datetime import date, datetime +from typing_extensions import get_args as _get_args, get_origin as _get_origin + +from .._types import StrBytesIntFloat +from ._datetime_parse import parse_date as _parse_date, parse_datetime as _parse_datetime + +_LITERAL_TYPES = {Literal, typing_extensions.Literal} + + +def get_args(tp: type[Any]) -> tuple[Any, ...]: + return _get_args(tp) + + +def get_origin(tp: type[Any]) -> type[Any] | None: + return _get_origin(tp) + + +def is_union(tp: Optional[Type[Any]]) -> bool: + if sys.version_info < (3, 10): + return tp is Union # type: ignore[comparison-overlap] + else: + import types + + return tp is Union or tp is types.UnionType + + +def is_typeddict(tp: Type[Any]) -> bool: + return typing_extensions.is_typeddict(tp) + + +def is_literal_type(tp: Type[Any]) -> bool: + return get_origin(tp) in _LITERAL_TYPES + + +def parse_date(value: Union[date, StrBytesIntFloat]) -> date: + return _parse_date(value) + + +def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: + return _parse_datetime(value) diff --git a/src/gcore/_utils/_datetime_parse.py b/src/gcore/_utils/_datetime_parse.py new file mode 100644 index 00000000..7cb9d9e6 --- /dev/null +++ b/src/gcore/_utils/_datetime_parse.py @@ -0,0 +1,136 @@ +""" +This file contains code from https://github.com/pydantic/pydantic/blob/main/pydantic/v1/datetime_parse.py +without the Pydantic v1 specific errors. +""" + +from __future__ import annotations + +import re +from typing import Dict, Union, Optional +from datetime import date, datetime, timezone, timedelta + +from .._types import StrBytesIntFloat + +date_expr = r"(?P\d{4})-(?P\d{1,2})-(?P\d{1,2})" +time_expr = ( + r"(?P\d{1,2}):(?P\d{1,2})" + r"(?::(?P\d{1,2})(?:\.(?P\d{1,6})\d{0,6})?)?" + r"(?PZ|[+-]\d{2}(?::?\d{2})?)?$" +) + +date_re = re.compile(f"{date_expr}$") +datetime_re = re.compile(f"{date_expr}[T ]{time_expr}") + + +EPOCH = datetime(1970, 1, 1) +# if greater than this, the number is in ms, if less than or equal it's in seconds +# (in seconds this is 11th October 2603, in ms it's 20th August 1970) +MS_WATERSHED = int(2e10) +# slightly more than datetime.max in ns - (datetime.max - EPOCH).total_seconds() * 1e9 +MAX_NUMBER = int(3e20) + + +def _get_numeric(value: StrBytesIntFloat, native_expected_type: str) -> Union[None, int, float]: + if isinstance(value, (int, float)): + return value + try: + return float(value) + except ValueError: + return None + except TypeError: + raise TypeError(f"invalid type; expected {native_expected_type}, string, bytes, int or float") from None + + +def _from_unix_seconds(seconds: Union[int, float]) -> datetime: + if seconds > MAX_NUMBER: + return datetime.max + elif seconds < -MAX_NUMBER: + return datetime.min + + while abs(seconds) > MS_WATERSHED: + seconds /= 1000 + dt = EPOCH + timedelta(seconds=seconds) + return dt.replace(tzinfo=timezone.utc) + + +def _parse_timezone(value: Optional[str]) -> Union[None, int, timezone]: + if value == "Z": + return timezone.utc + elif value is not None: + offset_mins = int(value[-2:]) if len(value) > 3 else 0 + offset = 60 * int(value[1:3]) + offset_mins + if value[0] == "-": + offset = -offset + return timezone(timedelta(minutes=offset)) + else: + return None + + +def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: + """ + Parse a datetime/int/float/string and return a datetime.datetime. + + This function supports time zone offsets. When the input contains one, + the output uses a timezone with a fixed offset from UTC. + + Raise ValueError if the input is well formatted but not a valid datetime. + Raise ValueError if the input isn't well formatted. + """ + if isinstance(value, datetime): + return value + + number = _get_numeric(value, "datetime") + if number is not None: + return _from_unix_seconds(number) + + if isinstance(value, bytes): + value = value.decode() + + assert not isinstance(value, (float, int)) + + match = datetime_re.match(value) + if match is None: + raise ValueError("invalid datetime format") + + kw = match.groupdict() + if kw["microsecond"]: + kw["microsecond"] = kw["microsecond"].ljust(6, "0") + + tzinfo = _parse_timezone(kw.pop("tzinfo")) + kw_: Dict[str, Union[None, int, timezone]] = {k: int(v) for k, v in kw.items() if v is not None} + kw_["tzinfo"] = tzinfo + + return datetime(**kw_) # type: ignore + + +def parse_date(value: Union[date, StrBytesIntFloat]) -> date: + """ + Parse a date/int/float/string and return a datetime.date. + + Raise ValueError if the input is well formatted but not a valid date. + Raise ValueError if the input isn't well formatted. + """ + if isinstance(value, date): + if isinstance(value, datetime): + return value.date() + else: + return value + + number = _get_numeric(value, "date") + if number is not None: + return _from_unix_seconds(number).date() + + if isinstance(value, bytes): + value = value.decode() + + assert not isinstance(value, (float, int)) + match = date_re.match(value) + if match is None: + raise ValueError("invalid date format") + + kw = {k: int(v) for k, v in match.groupdict().items()} + + try: + return date(**kw) + except ValueError: + raise ValueError("invalid date format") from None diff --git a/src/gcore/_utils/_transform.py b/src/gcore/_utils/_transform.py index f0bcefd4..c19124f0 100644 --- a/src/gcore/_utils/_transform.py +++ b/src/gcore/_utils/_transform.py @@ -19,6 +19,7 @@ is_sequence, ) from .._files import is_base64_file_input +from ._compat import get_origin, is_typeddict from ._typing import ( is_list_type, is_union_type, @@ -29,7 +30,6 @@ is_annotated_type, strip_annotated_type, ) -from .._compat import get_origin, model_dump, is_typeddict _T = TypeVar("_T") @@ -169,6 +169,8 @@ def _transform_recursive( Defaults to the same value as the `annotation` argument. """ + from .._compat import model_dump + if inner_type is None: inner_type = annotation @@ -333,6 +335,8 @@ async def _async_transform_recursive( Defaults to the same value as the `annotation` argument. """ + from .._compat import model_dump + if inner_type is None: inner_type = annotation diff --git a/src/gcore/_utils/_typing.py b/src/gcore/_utils/_typing.py index 845cd6b2..193109f3 100644 --- a/src/gcore/_utils/_typing.py +++ b/src/gcore/_utils/_typing.py @@ -15,7 +15,7 @@ from ._utils import lru_cache from .._types import InheritsGeneric -from .._compat import is_union as _is_union +from ._compat import is_union as _is_union def is_annotated_type(typ: type) -> bool: diff --git a/src/gcore/_utils/_utils.py b/src/gcore/_utils/_utils.py index ea3cf3f2..f0818595 100644 --- a/src/gcore/_utils/_utils.py +++ b/src/gcore/_utils/_utils.py @@ -22,7 +22,6 @@ import sniffio from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike -from .._compat import parse_date as parse_date, parse_datetime as parse_datetime _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) diff --git a/tests/test_models.py b/tests/test_models.py index c891c772..7b21d517 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -8,7 +8,7 @@ from pydantic import Field from gcore._utils import PropertyInfo -from gcore._compat import PYDANTIC_V2, parse_obj, model_dump, model_json +from gcore._compat import PYDANTIC_V1, parse_obj, model_dump, model_json from gcore._models import BaseModel, construct_type @@ -294,12 +294,12 @@ class Model(BaseModel): assert cast(bool, m.foo) is True m = Model.construct(foo={"name": 3}) - if PYDANTIC_V2: - assert isinstance(m.foo, Submodel1) - assert m.foo.name == 3 # type: ignore - else: + if PYDANTIC_V1: assert isinstance(m.foo, Submodel2) assert m.foo.name == "3" + else: + assert isinstance(m.foo, Submodel1) + assert m.foo.name == 3 # type: ignore def test_list_of_unions() -> None: @@ -426,10 +426,10 @@ class Model(BaseModel): expected = datetime(2019, 12, 27, 18, 11, 19, 117000, tzinfo=timezone.utc) - if PYDANTIC_V2: - expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' - else: + if PYDANTIC_V1: expected_json = '{"created_at": "2019-12-27T18:11:19.117000+00:00"}' + else: + expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' model = Model.construct(created_at="2019-12-27T18:11:19.117Z") assert model.created_at == expected @@ -531,7 +531,7 @@ class Model2(BaseModel): assert m4.to_dict(mode="python") == {"created_at": datetime.fromisoformat(time_str)} assert m4.to_dict(mode="json") == {"created_at": time_str} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): m.to_dict(warnings=False) @@ -556,7 +556,7 @@ class Model(BaseModel): assert m3.model_dump() == {"foo": None} assert m3.model_dump(exclude_none=True) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): m.model_dump(round_trip=True) @@ -580,10 +580,10 @@ class Model(BaseModel): assert json.loads(m.to_json()) == {"FOO": "hello"} assert json.loads(m.to_json(use_api_names=False)) == {"foo": "hello"} - if PYDANTIC_V2: - assert m.to_json(indent=None) == '{"FOO":"hello"}' - else: + if PYDANTIC_V1: assert m.to_json(indent=None) == '{"FOO": "hello"}' + else: + assert m.to_json(indent=None) == '{"FOO":"hello"}' m2 = Model() assert json.loads(m2.to_json()) == {} @@ -595,7 +595,7 @@ class Model(BaseModel): assert json.loads(m3.to_json()) == {"FOO": None} assert json.loads(m3.to_json(exclude_none=True)) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): m.to_json(warnings=False) @@ -622,7 +622,7 @@ class Model(BaseModel): assert json.loads(m3.model_dump_json()) == {"foo": None} assert json.loads(m3.model_dump_json(exclude_none=True)) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): m.model_dump_json(round_trip=True) @@ -679,12 +679,12 @@ class B(BaseModel): ) assert isinstance(m, A) assert m.type == "a" - if PYDANTIC_V2: - assert m.data == 100 # type: ignore[comparison-overlap] - else: + if PYDANTIC_V1: # pydantic v1 automatically converts inputs to strings # if the expected type is a str assert m.data == "100" + else: + assert m.data == 100 # type: ignore[comparison-overlap] def test_discriminated_unions_unknown_variant() -> None: @@ -768,12 +768,12 @@ class B(BaseModel): ) assert isinstance(m, A) assert m.foo_type == "a" - if PYDANTIC_V2: - assert m.data == 100 # type: ignore[comparison-overlap] - else: + if PYDANTIC_V1: # pydantic v1 automatically converts inputs to strings # if the expected type is a str assert m.data == "100" + else: + assert m.data == 100 # type: ignore[comparison-overlap] def test_discriminated_unions_overlapping_discriminators_invalid_data() -> None: @@ -833,7 +833,7 @@ class B(BaseModel): assert UnionType.__discriminator__ is discriminator -@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +@pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") def test_type_alias_type() -> None: Alias = TypeAliasType("Alias", str) # pyright: ignore @@ -849,7 +849,7 @@ class Model(BaseModel): assert m.union == "bar" -@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +@pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") def test_field_named_cls() -> None: class Model(BaseModel): cls: str @@ -936,7 +936,7 @@ class Type2(BaseModel): assert isinstance(model.value, InnerType2) -@pytest.mark.skipif(not PYDANTIC_V2, reason="this is only supported in pydantic v2 for now") +@pytest.mark.skipif(PYDANTIC_V1, reason="this is only supported in pydantic v2 for now") def test_extra_properties() -> None: class Item(BaseModel): prop: int diff --git a/tests/test_transform.py b/tests/test_transform.py index 987047c5..a2beb233 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -15,7 +15,7 @@ parse_datetime, async_transform as _async_transform, ) -from gcore._compat import PYDANTIC_V2 +from gcore._compat import PYDANTIC_V1 from gcore._models import BaseModel _T = TypeVar("_T") @@ -189,7 +189,7 @@ class DateModel(BaseModel): @pytest.mark.asyncio async def test_iso8601_format(use_async: bool) -> None: dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") - tz = "Z" if PYDANTIC_V2 else "+00:00" + tz = "+00:00" if PYDANTIC_V1 else "Z" assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] @@ -297,11 +297,11 @@ async def test_pydantic_unknown_field(use_async: bool) -> None: @pytest.mark.asyncio async def test_pydantic_mismatched_types(use_async: bool) -> None: model = MyModel.construct(foo=True) - if PYDANTIC_V2: + if PYDANTIC_V1: + params = await transform(model, Any, use_async) + else: with pytest.warns(UserWarning): params = await transform(model, Any, use_async) - else: - params = await transform(model, Any, use_async) assert cast(Any, params) == {"foo": True} @@ -309,11 +309,11 @@ async def test_pydantic_mismatched_types(use_async: bool) -> None: @pytest.mark.asyncio async def test_pydantic_mismatched_object_type(use_async: bool) -> None: model = MyModel.construct(foo=MyModel.construct(hello="world")) - if PYDANTIC_V2: + if PYDANTIC_V1: + params = await transform(model, Any, use_async) + else: with pytest.warns(UserWarning): params = await transform(model, Any, use_async) - else: - params = await transform(model, Any, use_async) assert cast(Any, params) == {"foo": {"hello": "world"}} diff --git a/tests/test_utils/test_datetime_parse.py b/tests/test_utils/test_datetime_parse.py new file mode 100644 index 00000000..2762807e --- /dev/null +++ b/tests/test_utils/test_datetime_parse.py @@ -0,0 +1,110 @@ +""" +Copied from https://github.com/pydantic/pydantic/blob/v1.10.22/tests/test_datetime_parse.py +with modifications so it works without pydantic v1 imports. +""" + +from typing import Type, Union +from datetime import date, datetime, timezone, timedelta + +import pytest + +from gcore._utils import parse_date, parse_datetime + + +def create_tz(minutes: int) -> timezone: + return timezone(timedelta(minutes=minutes)) + + +@pytest.mark.parametrize( + "value,result", + [ + # Valid inputs + ("1494012444.883309", date(2017, 5, 5)), + (b"1494012444.883309", date(2017, 5, 5)), + (1_494_012_444.883_309, date(2017, 5, 5)), + ("1494012444", date(2017, 5, 5)), + (1_494_012_444, date(2017, 5, 5)), + (0, date(1970, 1, 1)), + ("2012-04-23", date(2012, 4, 23)), + (b"2012-04-23", date(2012, 4, 23)), + ("2012-4-9", date(2012, 4, 9)), + (date(2012, 4, 9), date(2012, 4, 9)), + (datetime(2012, 4, 9, 12, 15), date(2012, 4, 9)), + # Invalid inputs + ("x20120423", ValueError), + ("2012-04-56", ValueError), + (19_999_999_999, date(2603, 10, 11)), # just before watershed + (20_000_000_001, date(1970, 8, 20)), # just after watershed + (1_549_316_052, date(2019, 2, 4)), # nowish in s + (1_549_316_052_104, date(2019, 2, 4)), # nowish in ms + (1_549_316_052_104_324, date(2019, 2, 4)), # nowish in μs + (1_549_316_052_104_324_096, date(2019, 2, 4)), # nowish in ns + ("infinity", date(9999, 12, 31)), + ("inf", date(9999, 12, 31)), + (float("inf"), date(9999, 12, 31)), + ("infinity ", date(9999, 12, 31)), + (int("1" + "0" * 100), date(9999, 12, 31)), + (1e1000, date(9999, 12, 31)), + ("-infinity", date(1, 1, 1)), + ("-inf", date(1, 1, 1)), + ("nan", ValueError), + ], +) +def test_date_parsing(value: Union[str, bytes, int, float], result: Union[date, Type[Exception]]) -> None: + if type(result) == type and issubclass(result, Exception): # pyright: ignore[reportUnnecessaryIsInstance] + with pytest.raises(result): + parse_date(value) + else: + assert parse_date(value) == result + + +@pytest.mark.parametrize( + "value,result", + [ + # Valid inputs + # values in seconds + ("1494012444.883309", datetime(2017, 5, 5, 19, 27, 24, 883_309, tzinfo=timezone.utc)), + (1_494_012_444.883_309, datetime(2017, 5, 5, 19, 27, 24, 883_309, tzinfo=timezone.utc)), + ("1494012444", datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + (b"1494012444", datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + (1_494_012_444, datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + # values in ms + ("1494012444000.883309", datetime(2017, 5, 5, 19, 27, 24, 883, tzinfo=timezone.utc)), + ("-1494012444000.883309", datetime(1922, 8, 29, 4, 32, 35, 999117, tzinfo=timezone.utc)), + (1_494_012_444_000, datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + ("2012-04-23T09:15:00", datetime(2012, 4, 23, 9, 15)), + ("2012-4-9 4:8:16", datetime(2012, 4, 9, 4, 8, 16)), + ("2012-04-23T09:15:00Z", datetime(2012, 4, 23, 9, 15, 0, 0, timezone.utc)), + ("2012-4-9 4:8:16-0320", datetime(2012, 4, 9, 4, 8, 16, 0, create_tz(-200))), + ("2012-04-23T10:20:30.400+02:30", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(150))), + ("2012-04-23T10:20:30.400+02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(120))), + ("2012-04-23T10:20:30.400-02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(-120))), + (b"2012-04-23T10:20:30.400-02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(-120))), + (datetime(2017, 5, 5), datetime(2017, 5, 5)), + (0, datetime(1970, 1, 1, 0, 0, 0, tzinfo=timezone.utc)), + # Invalid inputs + ("x20120423091500", ValueError), + ("2012-04-56T09:15:90", ValueError), + ("2012-04-23T11:05:00-25:00", ValueError), + (19_999_999_999, datetime(2603, 10, 11, 11, 33, 19, tzinfo=timezone.utc)), # just before watershed + (20_000_000_001, datetime(1970, 8, 20, 11, 33, 20, 1000, tzinfo=timezone.utc)), # just after watershed + (1_549_316_052, datetime(2019, 2, 4, 21, 34, 12, 0, tzinfo=timezone.utc)), # nowish in s + (1_549_316_052_104, datetime(2019, 2, 4, 21, 34, 12, 104_000, tzinfo=timezone.utc)), # nowish in ms + (1_549_316_052_104_324, datetime(2019, 2, 4, 21, 34, 12, 104_324, tzinfo=timezone.utc)), # nowish in μs + (1_549_316_052_104_324_096, datetime(2019, 2, 4, 21, 34, 12, 104_324, tzinfo=timezone.utc)), # nowish in ns + ("infinity", datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("inf", datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("inf ", datetime(9999, 12, 31, 23, 59, 59, 999999)), + (1e50, datetime(9999, 12, 31, 23, 59, 59, 999999)), + (float("inf"), datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("-infinity", datetime(1, 1, 1, 0, 0)), + ("-inf", datetime(1, 1, 1, 0, 0)), + ("nan", ValueError), + ], +) +def test_datetime_parsing(value: Union[str, bytes, int, float], result: Union[datetime, Type[Exception]]) -> None: + if type(result) == type and issubclass(result, Exception): # pyright: ignore[reportUnnecessaryIsInstance] + with pytest.raises(result): + parse_datetime(value) + else: + assert parse_datetime(value) == result diff --git a/tests/utils.py b/tests/utils.py index b8fe77cf..a391741f 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -19,7 +19,7 @@ is_annotated_type, is_type_alias_type, ) -from gcore._compat import PYDANTIC_V2, field_outer_type, get_model_fields +from gcore._compat import PYDANTIC_V1, field_outer_type, get_model_fields from gcore._models import BaseModel BaseModelT = TypeVar("BaseModelT", bound=BaseModel) @@ -28,12 +28,12 @@ def assert_matches_model(model: type[BaseModelT], value: BaseModelT, *, path: list[str]) -> bool: for name, field in get_model_fields(model).items(): field_value = getattr(value, name) - if PYDANTIC_V2: - allow_none = False - else: + if PYDANTIC_V1: # in v1 nullability was structured differently # https://docs.pydantic.dev/2.0/migration/#required-optional-and-nullable-fields allow_none = getattr(field, "allow_none", False) + else: + allow_none = False assert_matches_type( field_outer_type(field), From 6ad415f0196a75b83820f2c43a14c6d54095091e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 12:14:43 +0000 Subject: [PATCH 282/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/security/client_profile.py | 2 +- src/gcore/types/security/profile_create_params.py | 4 ++-- src/gcore/types/security/profile_recreate_params.py | 4 ++-- src/gcore/types/security/profile_replace_params.py | 4 ++-- tests/api_resources/security/test_profiles.py | 12 ++++++------ 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.stats.yml b/.stats.yml index a14a9da3..495f5fa3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 501 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6cf45f76c0a95bd78ec005813bc629157eb2dec4d4c763da0ba86f443c58022a.yml -openapi_spec_hash: 06925eca25df017eb66d26ea49c75257 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-dc5c08578a9efed580060a51136cc90b2b8ecfcff7aba8640d9f2fff77c6f46d.yml +openapi_spec_hash: 6fc8deee26b06e7cffea56b5c52214e9 config_hash: bfa6d8a193ef1f135cede939f6f5b9e9 diff --git a/src/gcore/types/security/client_profile.py b/src/gcore/types/security/client_profile.py index e440f21b..e02111b5 100644 --- a/src/gcore/types/security/client_profile.py +++ b/src/gcore/types/security/client_profile.py @@ -25,7 +25,7 @@ class Field(BaseModel): validation_schema: Dict[str, object] - field_value: Optional[Dict[str, object]] = None + field_value: Optional[object] = None class Options(BaseModel): diff --git a/src/gcore/types/security/profile_create_params.py b/src/gcore/types/security/profile_create_params.py index fbefd31e..93470b58 100644 --- a/src/gcore/types/security/profile_create_params.py +++ b/src/gcore/types/security/profile_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileCreateParams", "Field"] @@ -21,4 +21,4 @@ class ProfileCreateParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Optional[Dict[str, object]] + field_value: Optional[object] diff --git a/src/gcore/types/security/profile_recreate_params.py b/src/gcore/types/security/profile_recreate_params.py index b8418275..25c39d5f 100644 --- a/src/gcore/types/security/profile_recreate_params.py +++ b/src/gcore/types/security/profile_recreate_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileRecreateParams", "Field"] @@ -21,4 +21,4 @@ class ProfileRecreateParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Optional[Dict[str, object]] + field_value: Optional[object] diff --git a/src/gcore/types/security/profile_replace_params.py b/src/gcore/types/security/profile_replace_params.py index d4304a67..770c3f68 100644 --- a/src/gcore/types/security/profile_replace_params.py +++ b/src/gcore/types/security/profile_replace_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileReplaceParams", "Field"] @@ -21,4 +21,4 @@ class ProfileReplaceParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Optional[Dict[str, object]] + field_value: Optional[object] diff --git a/tests/api_resources/security/test_profiles.py b/tests/api_resources/security/test_profiles.py index 429291ae..ae9ed3b3 100644 --- a/tests/api_resources/security/test_profiles.py +++ b/tests/api_resources/security/test_profiles.py @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: fields=[ { "base_field": 1, - "field_value": {"key": "bar"}, + "field_value": {}, } ], profile_template=1, @@ -182,7 +182,7 @@ def test_method_recreate_with_all_params(self, client: Gcore) -> None: fields=[ { "base_field": 1, - "field_value": {"key": "bar"}, + "field_value": {}, } ], profile_template=1, @@ -235,7 +235,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: fields=[ { "base_field": 1, - "field_value": {"key": "bar"}, + "field_value": {}, } ], profile_template=1, @@ -292,7 +292,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> fields=[ { "base_field": 1, - "field_value": {"key": "bar"}, + "field_value": {}, } ], profile_template=1, @@ -440,7 +440,7 @@ async def test_method_recreate_with_all_params(self, async_client: AsyncGcore) - fields=[ { "base_field": 1, - "field_value": {"key": "bar"}, + "field_value": {}, } ], profile_template=1, @@ -493,7 +493,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> fields=[ { "base_field": 1, - "field_value": {"key": "bar"}, + "field_value": {}, } ], profile_template=1, From 23043f4faf1cd27ca6472105cafaf0cb3b485ed3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 14:50:54 +0000 Subject: [PATCH 283/592] chore(internal): move mypy configurations to `pyproject.toml` file --- mypy.ini | 50 ------------------------------------------------ pyproject.toml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 50 deletions(-) delete mode 100644 mypy.ini diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 1ee5b556..00000000 --- a/mypy.ini +++ /dev/null @@ -1,50 +0,0 @@ -[mypy] -pretty = True -show_error_codes = True - -# Exclude _files.py because mypy isn't smart enough to apply -# the correct type narrowing and as this is an internal module -# it's fine to just use Pyright. -# -# We also exclude our `tests` as mypy doesn't always infer -# types correctly and Pyright will still catch any type errors. -exclude = ^(src/gcore/_files\.py|_dev/.*\.py|tests/.*)$ - -strict_equality = True -implicit_reexport = True -check_untyped_defs = True -no_implicit_optional = True - -warn_return_any = True -warn_unreachable = True -warn_unused_configs = True - -# Turn these options off as it could cause conflicts -# with the Pyright options. -warn_unused_ignores = False -warn_redundant_casts = False - -disallow_any_generics = True -disallow_untyped_defs = True -disallow_untyped_calls = True -disallow_subclassing_any = True -disallow_incomplete_defs = True -disallow_untyped_decorators = True -cache_fine_grained = True - -# By default, mypy reports an error if you assign a value to the result -# of a function call that doesn't return anything. We do this in our test -# cases: -# ``` -# result = ... -# assert result is None -# ``` -# Changing this codegen to make mypy happy would increase complexity -# and would not be worth it. -disable_error_code = func-returns-value,overload-cannot-match - -# https://github.com/python/mypy/issues/12162 -[mypy.overrides] -module = "black.files.*" -ignore_errors = true -ignore_missing_imports = true diff --git a/pyproject.toml b/pyproject.toml index 91ce7891..4cbb7e74 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -158,6 +158,58 @@ reportOverlappingOverload = false reportImportCycles = false reportPrivateUsage = false +[tool.mypy] +pretty = true +show_error_codes = true + +# Exclude _files.py because mypy isn't smart enough to apply +# the correct type narrowing and as this is an internal module +# it's fine to just use Pyright. +# +# We also exclude our `tests` as mypy doesn't always infer +# types correctly and Pyright will still catch any type errors. +exclude = ['src/gcore/_files.py', '_dev/.*.py', 'tests/.*'] + +strict_equality = true +implicit_reexport = true +check_untyped_defs = true +no_implicit_optional = true + +warn_return_any = true +warn_unreachable = true +warn_unused_configs = true + +# Turn these options off as it could cause conflicts +# with the Pyright options. +warn_unused_ignores = false +warn_redundant_casts = false + +disallow_any_generics = true +disallow_untyped_defs = true +disallow_untyped_calls = true +disallow_subclassing_any = true +disallow_incomplete_defs = true +disallow_untyped_decorators = true +cache_fine_grained = true + +# By default, mypy reports an error if you assign a value to the result +# of a function call that doesn't return anything. We do this in our test +# cases: +# ``` +# result = ... +# assert result is None +# ``` +# Changing this codegen to make mypy happy would increase complexity +# and would not be worth it. +disable_error_code = "func-returns-value,overload-cannot-match" + +# https://github.com/python/mypy/issues/12162 +[[tool.mypy.overrides]] +module = "black.files.*" +ignore_errors = true +ignore_missing_imports = true + + [tool.ruff] line-length = 120 output-format = "grouped" From 3548c92311565c9fd4988cff667ce1c9a8b6a55b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 20:41:48 +0000 Subject: [PATCH 284/592] feat(api): manual updates --- .stats.yml | 6 +++--- src/gcore/types/security/client_profile.py | 4 ++-- src/gcore/types/security/profile_create_params.py | 4 ++-- src/gcore/types/security/profile_recreate_params.py | 4 ++-- src/gcore/types/security/profile_replace_params.py | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index 495f5fa3..0291ac23 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 501 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-dc5c08578a9efed580060a51136cc90b2b8ecfcff7aba8640d9f2fff77c6f46d.yml -openapi_spec_hash: 6fc8deee26b06e7cffea56b5c52214e9 -config_hash: bfa6d8a193ef1f135cede939f6f5b9e9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-efd5495399fc306a35e490c3872afae6e9d9bcb61eec361fc0ef035e5e42af8b.yml +openapi_spec_hash: ccb1fb7d018b724fd61c3afc68fcd7a5 +config_hash: e289f026dd629f593737c3201e919d26 diff --git a/src/gcore/types/security/client_profile.py b/src/gcore/types/security/client_profile.py index e02111b5..ce945292 100644 --- a/src/gcore/types/security/client_profile.py +++ b/src/gcore/types/security/client_profile.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Optional +from typing import Dict, List, Union, Optional from ..._models import BaseModel from .client_profile_template import ClientProfileTemplate @@ -25,7 +25,7 @@ class Field(BaseModel): validation_schema: Dict[str, object] - field_value: Optional[object] = None + field_value: Union[object, object, object, object, object, object, None] = None class Options(BaseModel): diff --git a/src/gcore/types/security/profile_create_params.py b/src/gcore/types/security/profile_create_params.py index 93470b58..84a9e894 100644 --- a/src/gcore/types/security/profile_create_params.py +++ b/src/gcore/types/security/profile_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Union, Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileCreateParams", "Field"] @@ -21,4 +21,4 @@ class ProfileCreateParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Optional[object] + field_value: Union[object, object, object, object, object, object, None] diff --git a/src/gcore/types/security/profile_recreate_params.py b/src/gcore/types/security/profile_recreate_params.py index 25c39d5f..55c658cb 100644 --- a/src/gcore/types/security/profile_recreate_params.py +++ b/src/gcore/types/security/profile_recreate_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Union, Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileRecreateParams", "Field"] @@ -21,4 +21,4 @@ class ProfileRecreateParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Optional[object] + field_value: Union[object, object, object, object, object, object, None] diff --git a/src/gcore/types/security/profile_replace_params.py b/src/gcore/types/security/profile_replace_params.py index 770c3f68..10af9a9b 100644 --- a/src/gcore/types/security/profile_replace_params.py +++ b/src/gcore/types/security/profile_replace_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Union, Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileReplaceParams", "Field"] @@ -21,4 +21,4 @@ class ProfileReplaceParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Optional[object] + field_value: Union[object, object, object, object, object, object, None] From 1913ae319f51ae7b195c5ef680e63b6517c84bff Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 5 Sep 2025 10:59:50 +0000 Subject: [PATCH 285/592] feat(s3): add object storage --- .stats.yml | 8 +- api.md | 97 +++ src/gcore/_client.py | 19 +- src/gcore/resources/__init__.py | 14 + src/gcore/resources/cloud/audit_logs.py | 8 +- .../resources/cloud/baremetal/flavors.py | 8 +- src/gcore/resources/cloud/baremetal/images.py | 8 +- .../resources/cloud/baremetal/servers.py | 36 +- .../resources/cloud/billing_reservations.py | 16 +- src/gcore/resources/cloud/cost_reports.py | 24 +- .../cloud/file_shares/access_rules.py | 24 +- .../cloud/file_shares/file_shares.py | 48 +- src/gcore/resources/cloud/floating_ips.py | 48 +- .../cloud/gpu_baremetal_clusters/flavors.py | 8 +- .../gpu_baremetal_clusters.py | 64 +- .../cloud/gpu_baremetal_clusters/images.py | 32 +- .../gpu_baremetal_clusters/interfaces.py | 8 +- .../cloud/gpu_baremetal_clusters/servers.py | 56 +- .../resources/cloud/inference/api_keys.py | 40 +- .../inference/applications/deployments.py | 40 +- .../cloud/inference/applications/templates.py | 16 +- .../inference/deployments/deployments.py | 64 +- .../cloud/inference/deployments/logs.py | 8 +- .../resources/cloud/inference/flavors.py | 16 +- .../resources/cloud/inference/inference.py | 8 +- .../cloud/inference/registry_credentials.py | 40 +- .../resources/cloud/inference/secrets.py | 40 +- .../resources/cloud/instances/flavors.py | 8 +- src/gcore/resources/cloud/instances/images.py | 48 +- .../resources/cloud/instances/instances.py | 112 +-- .../resources/cloud/instances/interfaces.py | 24 +- .../resources/cloud/instances/metrics.py | 8 +- src/gcore/resources/cloud/ip_ranges.py | 8 +- .../resources/cloud/k8s/clusters/clusters.py | 72 +- .../resources/cloud/k8s/clusters/nodes.py | 16 +- .../cloud/k8s/clusters/pools/nodes.py | 16 +- .../cloud/k8s/clusters/pools/pools.py | 48 +- src/gcore/resources/cloud/k8s/flavors.py | 8 +- src/gcore/resources/cloud/k8s/k8s.py | 8 +- .../resources/cloud/load_balancers/flavors.py | 8 +- .../load_balancers/l7_policies/l7_policies.py | 40 +- .../cloud/load_balancers/l7_policies/rules.py | 40 +- .../cloud/load_balancers/listeners.py | 40 +- .../cloud/load_balancers/load_balancers.py | 56 +- .../resources/cloud/load_balancers/metrics.py | 8 +- .../load_balancers/pools/health_monitors.py | 16 +- .../cloud/load_balancers/pools/members.py | 16 +- .../cloud/load_balancers/pools/pools.py | 40 +- .../cloud/load_balancers/statuses.py | 16 +- .../resources/cloud/networks/networks.py | 40 +- src/gcore/resources/cloud/networks/routers.py | 56 +- src/gcore/resources/cloud/networks/subnets.py | 40 +- src/gcore/resources/cloud/placement_groups.py | 32 +- src/gcore/resources/cloud/projects.py | 32 +- src/gcore/resources/cloud/quotas/quotas.py | 24 +- src/gcore/resources/cloud/quotas/requests.py | 32 +- src/gcore/resources/cloud/regions.py | 12 +- .../resources/cloud/registries/artifacts.py | 16 +- .../resources/cloud/registries/registries.py | 40 +- .../cloud/registries/repositories.py | 16 +- src/gcore/resources/cloud/registries/tags.py | 8 +- src/gcore/resources/cloud/registries/users.py | 48 +- .../reserved_fixed_ips/reserved_fixed_ips.py | 32 +- .../resources/cloud/reserved_fixed_ips/vip.py | 40 +- src/gcore/resources/cloud/secrets.py | 32 +- .../resources/cloud/security_groups/rules.py | 24 +- .../cloud/security_groups/security_groups.py | 56 +- src/gcore/resources/cloud/ssh_keys.py | 40 +- src/gcore/resources/cloud/tasks.py | 28 +- src/gcore/resources/cloud/usage_reports.py | 8 +- .../resources/cloud/users/role_assignments.py | 32 +- src/gcore/resources/cloud/volumes.py | 80 +- src/gcore/resources/dns/dns.py | 12 +- src/gcore/resources/dns/locations.py | 28 +- src/gcore/resources/dns/metrics.py | 8 +- src/gcore/resources/dns/pickers/pickers.py | 4 +- src/gcore/resources/dns/pickers/presets.py | 8 +- src/gcore/resources/dns/zones/dnssec.py | 16 +- src/gcore/resources/dns/zones/rrsets.py | 48 +- src/gcore/resources/dns/zones/zones.py | 80 +- src/gcore/resources/fastedge/apps/apps.py | 40 +- src/gcore/resources/fastedge/apps/logs.py | 8 +- src/gcore/resources/fastedge/binaries.py | 32 +- src/gcore/resources/fastedge/fastedge.py | 4 +- src/gcore/resources/fastedge/kv_stores.py | 32 +- src/gcore/resources/fastedge/secrets.py | 48 +- src/gcore/resources/fastedge/statistics.py | 16 +- src/gcore/resources/fastedge/templates.py | 40 +- src/gcore/resources/iam/api_tokens.py | 32 +- src/gcore/resources/iam/iam.py | 4 +- src/gcore/resources/iam/users.py | 36 +- src/gcore/resources/security/bgp_announces.py | 16 +- src/gcore/resources/security/events.py | 8 +- .../resources/security/profile_templates.py | 8 +- src/gcore/resources/security/profiles.py | 48 +- src/gcore/resources/storage/__init__.py | 75 ++ .../resources/storage/buckets/__init__.py | 61 ++ .../resources/storage/buckets/buckets.py | 350 +++++++++ src/gcore/resources/storage/buckets/cors.py | 261 +++++++ .../resources/storage/buckets/lifecycle.py | 264 +++++++ src/gcore/resources/storage/buckets/policy.py | 331 ++++++++ src/gcore/resources/storage/credentials.py | 193 +++++ src/gcore/resources/storage/locations.py | 143 ++++ src/gcore/resources/storage/statistics.py | 364 +++++++++ src/gcore/resources/storage/storage.py | 715 ++++++++++++++++++ src/gcore/resources/streaming/ai_tasks.py | 72 +- src/gcore/resources/streaming/broadcasts.py | 48 +- src/gcore/resources/streaming/directories.py | 40 +- src/gcore/resources/streaming/players.py | 40 +- src/gcore/resources/streaming/playlists.py | 48 +- src/gcore/resources/streaming/quality_sets.py | 20 +- src/gcore/resources/streaming/restreams.py | 40 +- src/gcore/resources/streaming/statistics.py | 302 ++++---- .../resources/streaming/streams/overlays.py | 56 +- .../resources/streaming/streams/streams.py | 138 ++-- .../resources/streaming/videos/subtitles.py | 48 +- .../resources/streaming/videos/videos.py | 72 +- src/gcore/resources/waap/advanced_rules.py | 8 +- src/gcore/resources/waap/custom_page_sets.py | 48 +- .../resources/waap/domains/advanced_rules.py | 48 +- .../resources/waap/domains/api_discovery.py | 48 +- .../resources/waap/domains/api_path_groups.py | 8 +- src/gcore/resources/waap/domains/api_paths.py | 40 +- .../resources/waap/domains/custom_rules.py | 56 +- src/gcore/resources/waap/domains/domains.py | 44 +- .../resources/waap/domains/firewall_rules.py | 56 +- .../waap/domains/insight_silences.py | 40 +- src/gcore/resources/waap/domains/insights.py | 24 +- src/gcore/resources/waap/domains/settings.py | 16 +- .../resources/waap/domains/statistics.py | 48 +- src/gcore/resources/waap/insights.py | 8 +- src/gcore/resources/waap/ip_info/ip_info.py | 64 +- src/gcore/resources/waap/ip_info/metrics.py | 8 +- src/gcore/resources/waap/organizations.py | 8 +- src/gcore/resources/waap/statistics.py | 8 +- src/gcore/resources/waap/tags.py | 4 +- src/gcore/resources/waap/waap.py | 4 +- .../cloud/baremetal/server_rebuild_params.py | 2 - .../dns/dns_get_account_overview_response.py | 24 +- src/gcore/types/dns/zone_get_response.py | 4 +- src/gcore/types/dns/zone_list_response.py | 2 - src/gcore/types/security/client_profile.py | 4 +- .../types/security/profile_create_params.py | 4 +- .../types/security/profile_recreate_params.py | 4 +- .../types/security/profile_replace_params.py | 4 +- src/gcore/types/storage/__init__.py | 17 + src/gcore/types/storage/buckets/__init__.py | 8 + .../storage/buckets/cor_create_params.py | 16 + .../buckets/lifecycle_create_params.py | 13 + .../storage/buckets/storage_bucket_cors.py | 17 + .../storage/buckets/storage_bucket_policy.py | 13 + .../storage/credential_recreate_params.py | 19 + .../types/storage/location_list_response.py | 10 + .../statistic_get_usage_aggregated_params.py | 24 + .../statistic_get_usage_series_params.py | 38 + .../statistic_get_usage_series_response.py | 12 + src/gcore/types/storage/storage.py | 68 ++ src/gcore/types/storage/storage_location.py | 24 + .../types/storage/storage_restore_params.py | 11 + .../types/storage/storage_update_params.py | 13 + .../types/storage/storage_usage_series.py | 201 +++++ .../types/storage/storage_usage_total.py | 54 ++ src/gcore/types/streaming/__init__.py | 4 + .../streaming/ai_contentmoderation_casm.py | 39 + .../ai_contentmoderation_hardnudity.py | 2 +- .../streaming/ai_contentmoderation_nsfw.py | 2 +- .../ai_contentmoderation_softnudity.py | 2 +- .../streaming/ai_contentmoderation_sport.py | 2 +- .../streaming/ai_contentmoderation_weapon.py | 39 + src/gcore/types/streaming/ai_task.py | 6 +- .../types/streaming/ai_task_create_params.py | 4 +- .../types/streaming/ai_task_get_response.py | 46 ++ .../types/streaming/create_video_param.py | 4 +- src/gcore/types/streaming/meet_series.py | 23 + src/gcore/types/streaming/playlist_video.py | 4 +- .../statistic_get_meet_series_params.py | 20 + src/gcore/types/streaming/stream.py | 125 ++- .../types/streaming/stream_create_params.py | 30 +- .../types/streaming/stream_update_params.py | 30 +- src/gcore/types/streaming/video.py | 52 +- .../types/streaming/video_update_params.py | 4 +- .../waap/domains/waap_request_details.py | 3 +- .../cloud/baremetal/test_servers.py | 56 +- tests/api_resources/security/test_profiles.py | 12 +- tests/api_resources/storage/__init__.py | 1 + .../api_resources/storage/buckets/__init__.py | 1 + .../storage/buckets/test_cors.py | 210 +++++ .../storage/buckets/test_lifecycle.py | 208 +++++ .../storage/buckets/test_policy.py | 276 +++++++ tests/api_resources/storage/test_buckets.py | 190 +++++ .../api_resources/storage/test_credentials.py | 110 +++ tests/api_resources/storage/test_locations.py | 74 ++ .../api_resources/storage/test_statistics.py | 173 +++++ .../streaming/test_statistics.py | 87 +++ tests/api_resources/streaming/test_streams.py | 4 + tests/api_resources/test_storage.py | 442 +++++++++++ 196 files changed, 6789 insertions(+), 3169 deletions(-) create mode 100644 src/gcore/resources/storage/__init__.py create mode 100644 src/gcore/resources/storage/buckets/__init__.py create mode 100644 src/gcore/resources/storage/buckets/buckets.py create mode 100644 src/gcore/resources/storage/buckets/cors.py create mode 100644 src/gcore/resources/storage/buckets/lifecycle.py create mode 100644 src/gcore/resources/storage/buckets/policy.py create mode 100644 src/gcore/resources/storage/credentials.py create mode 100644 src/gcore/resources/storage/locations.py create mode 100644 src/gcore/resources/storage/statistics.py create mode 100644 src/gcore/resources/storage/storage.py create mode 100644 src/gcore/types/storage/__init__.py create mode 100644 src/gcore/types/storage/buckets/__init__.py create mode 100644 src/gcore/types/storage/buckets/cor_create_params.py create mode 100644 src/gcore/types/storage/buckets/lifecycle_create_params.py create mode 100644 src/gcore/types/storage/buckets/storage_bucket_cors.py create mode 100644 src/gcore/types/storage/buckets/storage_bucket_policy.py create mode 100644 src/gcore/types/storage/credential_recreate_params.py create mode 100644 src/gcore/types/storage/location_list_response.py create mode 100644 src/gcore/types/storage/statistic_get_usage_aggregated_params.py create mode 100644 src/gcore/types/storage/statistic_get_usage_series_params.py create mode 100644 src/gcore/types/storage/statistic_get_usage_series_response.py create mode 100644 src/gcore/types/storage/storage.py create mode 100644 src/gcore/types/storage/storage_location.py create mode 100644 src/gcore/types/storage/storage_restore_params.py create mode 100644 src/gcore/types/storage/storage_update_params.py create mode 100644 src/gcore/types/storage/storage_usage_series.py create mode 100644 src/gcore/types/storage/storage_usage_total.py create mode 100644 src/gcore/types/streaming/ai_contentmoderation_casm.py create mode 100644 src/gcore/types/streaming/ai_contentmoderation_weapon.py create mode 100644 src/gcore/types/streaming/meet_series.py create mode 100644 src/gcore/types/streaming/statistic_get_meet_series_params.py create mode 100644 tests/api_resources/storage/__init__.py create mode 100644 tests/api_resources/storage/buckets/__init__.py create mode 100644 tests/api_resources/storage/buckets/test_cors.py create mode 100644 tests/api_resources/storage/buckets/test_lifecycle.py create mode 100644 tests/api_resources/storage/buckets/test_policy.py create mode 100644 tests/api_resources/storage/test_buckets.py create mode 100644 tests/api_resources/storage/test_credentials.py create mode 100644 tests/api_resources/storage/test_locations.py create mode 100644 tests/api_resources/storage/test_statistics.py create mode 100644 tests/api_resources/test_storage.py diff --git a/.stats.yml b/.stats.yml index 0291ac23..7d1db259 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 501 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-efd5495399fc306a35e490c3872afae6e9d9bcb61eec361fc0ef035e5e42af8b.yml -openapi_spec_hash: ccb1fb7d018b724fd61c3afc68fcd7a5 -config_hash: e289f026dd629f593737c3201e919d26 +configured_endpoints: 521 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-664d36cf113c38753b432dbec7550105ddae608da5e88b856b9ae69cf704369a.yml +openapi_spec_hash: fb2f2a05368ea82cba2d937eac0a5e8e +config_hash: 296feeb9e44105df95628b9989e56273 diff --git a/api.md b/api.md index 933a1fad..f87e79df 100644 --- a/api.md +++ b/api.md @@ -1512,10 +1512,12 @@ Types: ```python from gcore.types.streaming import ( + AIContentmoderationCasm, AIContentmoderationHardnudity, AIContentmoderationNsfw, AIContentmoderationSoftnudity, AIContentmoderationSport, + AIContentmoderationWeapon, AITask, AITaskCreateResponse, AITaskCancelResponse, @@ -1738,6 +1740,7 @@ Types: from gcore.types.streaming import ( Ffprobes, MaxStreamSeries, + MeetSeries, PopularVideos, StorageSeries, StreamSeries, @@ -1765,6 +1768,7 @@ Methods: - client.streaming.statistics.get_live_watch_time_cdn(\*\*params) -> StreamSeries - client.streaming.statistics.get_live_watch_time_total_cdn(\*\*params) -> VodTotalStreamDurationSeries - client.streaming.statistics.get_max_streams_series(\*\*params) -> MaxStreamSeries +- client.streaming.statistics.get_meet_series(\*\*params) -> MeetSeries - client.streaming.statistics.get_popular_videos(\*\*params) -> PopularVideos - client.streaming.statistics.get_storage_series(\*\*params) -> StorageSeries - client.streaming.statistics.get_stream_series(\*\*params) -> StreamSeries @@ -1975,3 +1979,96 @@ Methods: - client.dns.zones.rrsets.get(rrset_type, \*, zone_name, rrset_name) -> DNSOutputRrset - 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 + +# Storage + +Types: + +```python +from gcore.types.storage import Storage +``` + +Methods: + +- client.storage.update(storage_id, \*\*params) -> Storage +- client.storage.delete(storage_id) -> None +- client.storage.get(storage_id) -> Storage +- client.storage.link_ssh_key(key_id, \*, storage_id) -> None +- client.storage.restore(storage_id, \*\*params) -> None +- client.storage.unlink_ssh_key(key_id, \*, storage_id) -> None + +## Locations + +Types: + +```python +from gcore.types.storage import StorageLocation, LocationListResponse +``` + +Methods: + +- client.storage.locations.list() -> LocationListResponse + +## Statistics + +Types: + +```python +from gcore.types.storage import ( + StorageUsageSeries, + StorageUsageTotal, + StatisticGetUsageSeriesResponse, +) +``` + +Methods: + +- client.storage.statistics.get_usage_aggregated(\*\*params) -> StorageUsageTotal +- client.storage.statistics.get_usage_series(\*\*params) -> StatisticGetUsageSeriesResponse + +## Credentials + +Methods: + +- client.storage.credentials.recreate(storage_id, \*\*params) -> Storage + +## Buckets + +Methods: + +- client.storage.buckets.create(bucket_name, \*, storage_id) -> None +- client.storage.buckets.delete(bucket_name, \*, storage_id) -> None + +### Cors + +Types: + +```python +from gcore.types.storage.buckets import StorageBucketCors +``` + +Methods: + +- client.storage.buckets.cors.create(bucket_name, \*, storage_id, \*\*params) -> None +- client.storage.buckets.cors.get(bucket_name, \*, storage_id) -> StorageBucketCors + +### Lifecycle + +Methods: + +- client.storage.buckets.lifecycle.create(bucket_name, \*, storage_id, \*\*params) -> None +- client.storage.buckets.lifecycle.delete(bucket_name, \*, storage_id) -> None + +### Policy + +Types: + +```python +from gcore.types.storage.buckets import StorageBucketPolicy +``` + +Methods: + +- client.storage.buckets.policy.create(bucket_name, \*, storage_id) -> None +- client.storage.buckets.policy.delete(bucket_name, \*, storage_id) -> None +- client.storage.buckets.policy.get(bucket_name, \*, storage_id) -> StorageBucketPolicy diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 87f69758..fb66fd59 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -32,6 +32,7 @@ from .resources.iam import iam from .resources.waap import waap from .resources.cloud import cloud +from .resources.storage import storage from .resources.fastedge import fastedge from .resources.security import security from .resources.streaming import streaming @@ -47,6 +48,7 @@ class Gcore(SyncAPIClient): streaming: streaming.StreamingResource security: security.SecurityResource dns: dns.DNSResource + storage: storage.StorageResource with_raw_response: GcoreWithRawResponse with_streaming_response: GcoreWithStreamedResponse @@ -111,7 +113,6 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") - self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -133,6 +134,7 @@ def __init__( self.streaming = streaming.StreamingResource(self) self.security = security.SecurityResource(self) self.dns = dns.DNSResource(self) + self.storage = storage.StorageResource(self) self.with_raw_response = GcoreWithRawResponse(self) self.with_streaming_response = GcoreWithStreamedResponse(self) @@ -195,7 +197,7 @@ def copy( params = set_default_query http_client = http_client or self._client - client = self.__class__( + return self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -208,8 +210,6 @@ def copy( default_query=params, **_extra_kwargs, ) - client._base_url_overridden = self._base_url_overridden or base_url is not None - return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) @@ -275,6 +275,7 @@ class AsyncGcore(AsyncAPIClient): streaming: streaming.AsyncStreamingResource security: security.AsyncSecurityResource dns: dns.AsyncDNSResource + storage: storage.AsyncStorageResource with_raw_response: AsyncGcoreWithRawResponse with_streaming_response: AsyncGcoreWithStreamedResponse @@ -339,7 +340,6 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") - self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -361,6 +361,7 @@ def __init__( self.streaming = streaming.AsyncStreamingResource(self) self.security = security.AsyncSecurityResource(self) self.dns = dns.AsyncDNSResource(self) + self.storage = storage.AsyncStorageResource(self) self.with_raw_response = AsyncGcoreWithRawResponse(self) self.with_streaming_response = AsyncGcoreWithStreamedResponse(self) @@ -423,7 +424,7 @@ def copy( params = set_default_query http_client = http_client or self._client - client = self.__class__( + return self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -436,8 +437,6 @@ def copy( default_query=params, **_extra_kwargs, ) - client._base_url_overridden = self._base_url_overridden or base_url is not None - return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) @@ -504,6 +503,7 @@ def __init__(self, client: Gcore) -> None: self.streaming = streaming.StreamingResourceWithRawResponse(client.streaming) self.security = security.SecurityResourceWithRawResponse(client.security) self.dns = dns.DNSResourceWithRawResponse(client.dns) + self.storage = storage.StorageResourceWithRawResponse(client.storage) class AsyncGcoreWithRawResponse: @@ -515,6 +515,7 @@ def __init__(self, client: AsyncGcore) -> None: self.streaming = streaming.AsyncStreamingResourceWithRawResponse(client.streaming) self.security = security.AsyncSecurityResourceWithRawResponse(client.security) self.dns = dns.AsyncDNSResourceWithRawResponse(client.dns) + self.storage = storage.AsyncStorageResourceWithRawResponse(client.storage) class GcoreWithStreamedResponse: @@ -526,6 +527,7 @@ def __init__(self, client: Gcore) -> None: self.streaming = streaming.StreamingResourceWithStreamingResponse(client.streaming) self.security = security.SecurityResourceWithStreamingResponse(client.security) self.dns = dns.DNSResourceWithStreamingResponse(client.dns) + self.storage = storage.StorageResourceWithStreamingResponse(client.storage) class AsyncGcoreWithStreamedResponse: @@ -537,6 +539,7 @@ def __init__(self, client: AsyncGcore) -> None: self.streaming = streaming.AsyncStreamingResourceWithStreamingResponse(client.streaming) self.security = security.AsyncSecurityResourceWithStreamingResponse(client.security) self.dns = dns.AsyncDNSResourceWithStreamingResponse(client.dns) + self.storage = storage.AsyncStorageResourceWithStreamingResponse(client.storage) Client = Gcore diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py index 7f795ef0..e8e92c1e 100644 --- a/src/gcore/resources/__init__.py +++ b/src/gcore/resources/__init__.py @@ -32,6 +32,14 @@ CloudResourceWithStreamingResponse, AsyncCloudResourceWithStreamingResponse, ) +from .storage import ( + StorageResource, + AsyncStorageResource, + StorageResourceWithRawResponse, + AsyncStorageResourceWithRawResponse, + StorageResourceWithStreamingResponse, + AsyncStorageResourceWithStreamingResponse, +) from .fastedge import ( FastedgeResource, AsyncFastedgeResource, @@ -100,4 +108,10 @@ "AsyncDNSResourceWithRawResponse", "DNSResourceWithStreamingResponse", "AsyncDNSResourceWithStreamingResponse", + "StorageResource", + "AsyncStorageResource", + "StorageResourceWithRawResponse", + "AsyncStorageResourceWithRawResponse", + "StorageResourceWithStreamingResponse", + "AsyncStorageResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index 1f4ae40e..1dad329f 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -206,9 +206,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/user_actions", + "/cloud/v1/user_actions", page=SyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, @@ -417,9 +415,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/user_actions", + "/cloud/v1/user_actions", page=AsyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 91474de4..1645b30b 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -93,9 +93,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -189,9 +187,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index ecc0adc3..a6a22954 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -90,9 +90,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -180,9 +178,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 86bbf8ce..feb1aa95 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -156,9 +156,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -296,9 +294,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", page=SyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -354,12 +350,6 @@ def rebuild( Rebuild a bare metal server with a new image while preserving its configuration. Args: - project_id: Project ID - - region_id: Region ID - - server_id: Server ID - image_id: Image ID user_data: String in base64 format. Must not be passed together with 'username' or @@ -381,9 +371,7 @@ def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=maybe_transform( { "image_id": image_id, @@ -527,9 +515,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -667,9 +653,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", page=AsyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -725,12 +709,6 @@ async def rebuild( Rebuild a bare metal server with a new image while preserving its configuration. Args: - project_id: Project ID - - region_id: Region ID - - server_id: Server ID - image_id: Image ID user_data: String in base64 format. Must not be passed together with 'username' or @@ -752,9 +730,7 @@ async def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=await async_maybe_transform( { "image_id": image_id, diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index ae49d667..0d9df747 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -120,9 +120,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservations", + "/cloud/v1/reservations", page=SyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -176,9 +174,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v1/reservations/{reservation_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -280,9 +276,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservations", + "/cloud/v1/reservations", page=AsyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -336,9 +330,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v1/reservations/{reservation_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 910b8fa7..36075dd6 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -146,9 +146,7 @@ def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals", body=maybe_transform( { "time_from": time_from, @@ -257,9 +255,7 @@ def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/reservation_cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals", body=maybe_transform( { "regions": regions, @@ -385,9 +381,7 @@ def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/resources" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources", body=maybe_transform( { "time_from": time_from, @@ -528,9 +522,7 @@ async def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals", body=await async_maybe_transform( { "time_from": time_from, @@ -639,9 +631,7 @@ async def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/reservation_cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals", body=await async_maybe_transform( { "regions": regions, @@ -767,9 +757,7 @@ async def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/resources" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index 5efd03fb..21ba3f40 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -88,9 +88,7 @@ def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=maybe_transform( { "access_mode": access_mode, @@ -142,9 +140,7 @@ def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -195,9 +191,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -269,9 +263,7 @@ async def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=await async_maybe_transform( { "access_mode": access_mode, @@ -323,9 +315,7 @@ async def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -376,9 +366,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index bf7e7b62..71c1c9d8 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -206,9 +206,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -291,9 +289,7 @@ def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=maybe_transform( { "name": name, @@ -353,9 +349,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", page=SyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -413,9 +407,7 @@ def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -460,9 +452,7 @@ def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -510,9 +500,7 @@ def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -687,9 +675,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -772,9 +758,7 @@ async def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=await async_maybe_transform( { "name": name, @@ -834,9 +818,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", page=AsyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -894,9 +876,7 @@ async def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -941,9 +921,7 @@ async def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -991,9 +969,7 @@ async def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=await async_maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 9362d7cc..2815f3cb 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -94,9 +94,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", body=maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -157,9 +155,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", page=SyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -211,9 +207,7 @@ def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -258,9 +252,7 @@ def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=maybe_transform( { "port_id": port_id, @@ -306,9 +298,7 @@ def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -347,9 +337,7 @@ def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +413,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", body=await async_maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -488,9 +474,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", page=AsyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -542,9 +526,7 @@ async def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -589,9 +571,7 @@ async def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=await async_maybe_transform( { "port_id": port_id, @@ -637,9 +617,7 @@ async def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -678,9 +656,7 @@ async def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index 6d594b3b..2c4563b5 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -80,9 +80,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -159,9 +157,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 99c7b1ee..67bcd343 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -156,9 +156,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=maybe_transform( { "flavor": flavor, @@ -222,9 +220,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=SyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -291,9 +287,7 @@ def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -349,9 +343,7 @@ def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +382,7 @@ def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -431,9 +421,7 @@ def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,9 +473,7 @@ def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=maybe_transform( { "nodes": nodes, @@ -539,9 +525,7 @@ def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, @@ -644,9 +628,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=await async_maybe_transform( { "flavor": flavor, @@ -710,9 +692,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=AsyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -779,9 +759,7 @@ async def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -837,9 +815,7 @@ async def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -878,9 +854,7 @@ async def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -919,9 +893,7 @@ async def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -973,9 +945,7 @@ async def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=await async_maybe_transform( { "nodes": nodes, @@ -1027,9 +997,7 @@ async def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=await async_maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 249c8d3f..8c2d4623 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -79,9 +79,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -126,9 +124,7 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -173,9 +169,7 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +244,7 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=maybe_transform( { "name": name, @@ -328,9 +320,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -375,9 +365,7 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -422,9 +410,7 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -499,9 +485,7 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index ad75df3e..863ffde8 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -71,9 +71,7 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -133,9 +131,7 @@ async def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 11af8877..138889a4 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -99,9 +99,7 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=SyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -160,9 +158,7 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -397,9 +393,7 @@ def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -458,9 +452,7 @@ def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -506,9 +498,7 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,9 +537,7 @@ def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -588,9 +576,7 @@ def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -664,9 +650,7 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=AsyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -725,9 +709,7 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -964,9 +946,7 @@ async def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -1025,9 +1005,7 @@ async def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, @@ -1073,9 +1051,7 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1114,9 +1090,7 @@ async def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1155,9 +1129,7 @@ async def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py index f9f5ccb9..98238c19 100644 --- a/src/gcore/resources/cloud/inference/api_keys.py +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -84,9 +84,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", body=maybe_transform( { "name": name, @@ -137,9 +135,7 @@ def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -182,9 +178,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", page=SyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -239,9 +233,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,9 +273,7 @@ def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,9 +340,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", body=await async_maybe_transform( { "name": name, @@ -403,9 +391,7 @@ async def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=await async_maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -448,9 +434,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", page=AsyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -505,9 +489,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,9 +529,7 @@ async def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index 43b6893f..845bffce 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -93,9 +93,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", body=maybe_transform( { "application_name": application_name, @@ -142,9 +140,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -186,9 +182,7 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -232,9 +226,7 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -288,9 +280,7 @@ def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -372,9 +362,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", body=await async_maybe_transform( { "application_name": application_name, @@ -421,9 +409,7 @@ async def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -465,9 +451,7 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -511,9 +495,7 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -567,9 +549,7 @@ async def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, diff --git a/src/gcore/resources/cloud/inference/applications/templates.py b/src/gcore/resources/cloud/inference/applications/templates.py index 664203be..1c475cb8 100644 --- a/src/gcore/resources/cloud/inference/applications/templates.py +++ b/src/gcore/resources/cloud/inference/applications/templates.py @@ -58,9 +58,7 @@ def list( required to create a fully functional application deployment. """ return self._get( - "/cloud/v3/inference/applications/catalog" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -99,9 +97,7 @@ def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -147,9 +143,7 @@ async def list( required to create a fully functional application deployment. """ return await self._get( - "/cloud/v3/inference/applications/catalog" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -188,9 +182,7 @@ async def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return await self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 0cccc581..3a4e4629 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -147,9 +147,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", body=maybe_transform( { "containers": containers, @@ -265,9 +263,7 @@ def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -329,9 +325,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", page=SyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -382,9 +376,7 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,9 +416,7 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,9 +457,7 @@ def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,9 +505,7 @@ def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -567,9 +553,7 @@ def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -689,9 +673,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", body=await async_maybe_transform( { "containers": containers, @@ -807,9 +789,7 @@ async def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, @@ -871,9 +851,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", page=AsyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -924,9 +902,7 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -966,9 +942,7 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1009,9 +983,7 @@ async def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1059,9 +1031,7 @@ async def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1109,9 +1079,7 @@ async def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index 2ee0666e..1cc65006 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -91,9 +91,7 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=SyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, @@ -180,9 +178,7 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=AsyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index 8dcc3e62..d273b19b 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -73,9 +73,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors", page=SyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -121,9 +119,7 @@ def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return self._get( - f"/cloud/v3/inference/flavors/{flavor_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,9 +178,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors", page=AsyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -230,9 +224,7 @@ async def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return await self._get( - f"/cloud/v3/inference/flavors/{flavor_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index b116b08f..103c70f1 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -123,9 +123,7 @@ def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return self._get( - "/cloud/v3/inference/capacity" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -189,9 +187,7 @@ async def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return await self._get( - "/cloud/v3/inference/capacity" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 9d5a4072..6dd78f70 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -86,9 +86,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", body=maybe_transform( { "name": name, @@ -139,9 +137,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", page=SyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -193,9 +189,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -235,9 +229,7 @@ def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -286,9 +278,7 @@ def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=maybe_transform( { "password": password, @@ -364,9 +354,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", body=await async_maybe_transform( { "name": name, @@ -417,9 +405,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", page=AsyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -471,9 +457,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -513,9 +497,7 @@ async def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -564,9 +546,7 @@ async def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=await async_maybe_transform( { "password": password, diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index ed312faa..275ec3f2 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -79,9 +79,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", body=maybe_transform( { "data": data, @@ -132,9 +130,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", page=SyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -186,9 +182,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,9 +222,7 @@ def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,9 +268,7 @@ def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", body=maybe_transform( { "data": data, @@ -350,9 +340,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", body=await async_maybe_transform( { "data": data, @@ -403,9 +391,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", page=AsyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -457,9 +443,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -499,9 +483,7 @@ async def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,9 +529,7 @@ async def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", body=await async_maybe_transform( { "data": data, diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 3bf61d85..9bd7f38f 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -85,9 +85,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -171,9 +169,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index b45fd614..af8e82a7 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -110,9 +110,7 @@ def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", body=maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -178,9 +176,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -234,9 +230,7 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -308,9 +302,7 @@ def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -367,9 +359,7 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -452,9 +442,7 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -556,9 +544,7 @@ async def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", body=await async_maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -624,9 +610,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -680,9 +664,7 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -754,9 +736,7 @@ async def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -813,9 +793,7 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -898,9 +876,7 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index dde03b4b..77fbc20b 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -228,9 +228,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -297,9 +295,7 @@ def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -448,9 +444,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}", page=SyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -544,9 +538,7 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -655,9 +647,7 @@ def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=maybe_transform( { "action": action, @@ -708,9 +698,7 @@ def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -763,9 +751,7 @@ def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=maybe_transform( { "name": name, @@ -811,9 +797,7 @@ def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -852,9 +836,7 @@ def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -908,9 +890,7 @@ def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -952,9 +932,7 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1001,9 +979,7 @@ def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1045,9 +1021,7 @@ def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1097,9 +1071,7 @@ def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=maybe_transform( { "name": name, @@ -1270,9 +1242,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -1339,9 +1309,7 @@ async def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1490,9 +1458,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}", page=AsyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -1586,9 +1552,7 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1697,9 +1661,7 @@ async def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=await async_maybe_transform( { "action": action, @@ -1750,9 +1712,7 @@ async def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=await async_maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -1805,9 +1765,7 @@ async def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=await async_maybe_transform( { "name": name, @@ -1853,9 +1811,7 @@ async def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1894,9 +1850,7 @@ async def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1950,9 +1904,7 @@ async def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1994,9 +1946,7 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2043,9 +1993,7 @@ async def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2087,9 +2035,7 @@ async def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=await async_maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -2139,9 +2085,7 @@ async def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 20e0c0f8..9cc4b04f 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -77,9 +77,7 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -309,9 +307,7 @@ def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -370,9 +366,7 @@ def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -439,9 +433,7 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -671,9 +663,7 @@ async def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -732,9 +722,7 @@ async def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index 03ffbcd1..fa058434 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -87,9 +87,7 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -168,9 +166,7 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index b0d0c62e..12024d04 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -67,9 +67,7 @@ def list( returned. """ return self._get( - "/cloud/public/v1/ipranges/egress" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -125,9 +123,7 @@ async def list( returned. """ return await self._get( - "/cloud/public/v1/ipranges/egress" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index 198ead21..a778a3b9 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -210,9 +210,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", body=maybe_transform( { "keypair": keypair, @@ -341,9 +339,7 @@ def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=maybe_transform( { "authentication": authentication, @@ -389,9 +385,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -433,9 +427,7 @@ def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -478,9 +470,7 @@ def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -519,9 +509,7 @@ def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -560,9 +548,7 @@ def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -601,9 +587,7 @@ def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -645,9 +629,7 @@ def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -817,9 +799,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", body=await async_maybe_transform( { "keypair": keypair, @@ -948,9 +928,7 @@ async def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=await async_maybe_transform( { "authentication": authentication, @@ -996,9 +974,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1040,9 +1016,7 @@ async def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1085,9 +1059,7 @@ async def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1126,9 +1098,7 @@ async def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1167,9 +1137,7 @@ async def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1208,9 +1176,7 @@ async def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1252,9 +1218,7 @@ async def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=await async_maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/clusters/nodes.py b/src/gcore/resources/cloud/k8s/clusters/nodes.py index d04a0586..b3bd95d8 100644 --- a/src/gcore/resources/cloud/k8s/clusters/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/nodes.py @@ -76,9 +76,7 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -126,9 +124,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,9 +187,7 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -241,9 +235,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py index 8ff64793..903c428e 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py @@ -79,9 +79,7 @@ def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -132,9 +130,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -200,9 +196,7 @@ async def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -253,9 +247,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index b60e3039..0cb81d5a 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -130,9 +130,7 @@ def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=maybe_transform( { "flavor_id": flavor_id, @@ -210,9 +208,7 @@ def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -262,9 +258,7 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -306,9 +300,7 @@ def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,9 +342,7 @@ def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -397,9 +387,7 @@ def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -504,9 +492,7 @@ async def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=await async_maybe_transform( { "flavor_id": flavor_id, @@ -584,9 +570,7 @@ async def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=await async_maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -636,9 +620,7 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -680,9 +662,7 @@ async def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -724,9 +704,7 @@ async def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -771,9 +749,7 @@ async def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=await async_maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/flavors.py b/src/gcore/resources/cloud/k8s/flavors.py index cd456f26..71781231 100644 --- a/src/gcore/resources/cloud/k8s/flavors.py +++ b/src/gcore/resources/cloud/k8s/flavors.py @@ -79,9 +79,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -157,9 +155,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index c193fccd..ad74c5fd 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -92,9 +92,7 @@ def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -159,9 +157,7 @@ async def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index d104d723..48ba2c61 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -76,9 +76,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -145,9 +143,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index d7cce84f..1b2bde53 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py @@ -118,9 +118,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", body=maybe_transform( { "action": action, @@ -170,9 +168,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +207,7 @@ def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -252,9 +246,7 @@ def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -322,9 +314,7 @@ def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=maybe_transform( { "action": action, @@ -430,9 +420,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", body=await async_maybe_transform( { "action": action, @@ -482,9 +470,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,9 +509,7 @@ async def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -564,9 +548,7 @@ async def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -634,9 +616,7 @@ async def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=await async_maybe_transform( { "action": action, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py index b83bb590..34063a17 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -106,9 +106,7 @@ def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=maybe_transform( { "compare_type": compare_type, @@ -158,9 +156,7 @@ def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -202,9 +198,7 @@ def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -246,9 +240,7 @@ def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -320,9 +312,7 @@ def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=maybe_transform( { "compare_type": compare_type, @@ -422,9 +412,7 @@ async def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=await async_maybe_transform( { "compare_type": compare_type, @@ -474,9 +462,7 @@ async def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -518,9 +504,7 @@ async def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -562,9 +546,7 @@ async def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -636,9 +618,7 @@ async def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=await async_maybe_transform( { "compare_type": compare_type, diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index abbb5e77..bf760cfb 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -127,9 +127,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -221,9 +219,7 @@ def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -283,9 +279,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -340,9 +334,7 @@ def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +382,7 @@ def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -499,9 +489,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=await async_maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -593,9 +581,7 @@ async def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=await async_maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -655,9 +641,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -712,9 +696,7 @@ async def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -762,9 +744,7 @@ async def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 9a8070b5..f50f4ce5 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -207,9 +207,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -299,9 +297,7 @@ def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=maybe_transform( { "logging": logging, @@ -379,9 +375,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", page=SyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -439,9 +433,7 @@ def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -483,9 +475,7 @@ def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -531,9 +521,7 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -585,9 +573,7 @@ def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -718,9 +704,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -810,9 +794,7 @@ async def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=await async_maybe_transform( { "logging": logging, @@ -890,9 +872,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", page=AsyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -950,9 +930,7 @@ async def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -994,9 +972,7 @@ async def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=await async_maybe_transform( {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams ), @@ -1044,9 +1020,7 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1098,9 +1072,7 @@ async def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index dd0dedd2..59df8038 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -81,9 +81,7 @@ def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -156,9 +154,7 @@ async def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index 417ae8b0..bae1858c 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -115,9 +115,7 @@ def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=maybe_transform( { "delay": delay, @@ -179,9 +177,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -278,9 +274,7 @@ async def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=await async_maybe_transform( { "delay": delay, @@ -342,9 +336,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 37faaa3a..05091a8b 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -131,9 +131,7 @@ def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=maybe_transform( { "address": address, @@ -197,9 +195,7 @@ def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -315,9 +311,7 @@ async def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=await async_maybe_transform( { "address": address, @@ -381,9 +375,7 @@ async def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 01abaebd..c0df516c 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -147,9 +147,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", body=maybe_transform( { "lb_algorithm": lb_algorithm, @@ -264,9 +262,7 @@ def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=maybe_transform( { "ca_secret_id": ca_secret_id, @@ -332,9 +328,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -390,9 +384,7 @@ def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -437,9 +429,7 @@ def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -550,9 +540,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", body=await async_maybe_transform( { "lb_algorithm": lb_algorithm, @@ -667,9 +655,7 @@ async def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=await async_maybe_transform( { "ca_secret_id": ca_secret_id, @@ -735,9 +721,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -793,9 +777,7 @@ async def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -840,9 +822,7 @@ async def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index e99f90c9..5579e857 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -69,9 +69,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -110,9 +108,7 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -169,9 +165,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -210,9 +204,7 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 235648f0..2fda130e 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -120,9 +120,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -203,9 +201,7 @@ def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=maybe_transform( { "name": name, @@ -272,9 +268,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", page=SyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -334,9 +328,7 @@ def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -381,9 +373,7 @@ def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -468,9 +458,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -551,9 +539,7 @@ async def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=await async_maybe_transform( { "name": name, @@ -620,9 +606,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", page=AsyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -682,9 +666,7 @@ async def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -729,9 +711,7 @@ async def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 93596051..657982bd 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -92,9 +92,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -151,9 +149,7 @@ def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=maybe_transform( { "external_gateway_info": external_gateway_info, @@ -203,9 +199,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", page=SyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -255,9 +249,7 @@ def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -309,9 +301,7 @@ def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=maybe_transform( { "subnet_id": subnet_id, @@ -360,9 +350,7 @@ def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=maybe_transform({"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -402,9 +390,7 @@ def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,9 +459,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -532,9 +516,7 @@ async def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=await async_maybe_transform( { "external_gateway_info": external_gateway_info, @@ -584,9 +566,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", page=AsyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -636,9 +616,7 @@ async def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -690,9 +668,7 @@ async def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=await async_maybe_transform( { "subnet_id": subnet_id, @@ -741,9 +717,7 @@ async def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=await async_maybe_transform( {"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams ), @@ -785,9 +759,7 @@ async def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index aef9bb2a..b781c2e3 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -125,9 +125,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", body=maybe_transform( { "cidr": cidr, @@ -227,9 +225,7 @@ def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=maybe_transform( { "dns_nameservers": dns_nameservers, @@ -315,9 +311,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", page=SyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -378,9 +372,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +417,7 @@ def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -531,9 +521,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", body=await async_maybe_transform( { "cidr": cidr, @@ -633,9 +621,7 @@ async def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=await async_maybe_transform( { "dns_nameservers": dns_nameservers, @@ -721,9 +707,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", page=AsyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -784,9 +768,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -831,9 +813,7 @@ async def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 4c3a5142..31777c13 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -80,9 +80,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -125,9 +123,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -166,9 +162,7 @@ def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -207,9 +201,7 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -272,9 +264,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -317,9 +307,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -358,9 +346,7 @@ async def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -399,9 +385,7 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 0603b072..383f3c3b 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -83,7 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", body=maybe_transform( { "name": name, @@ -142,7 +142,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", page=SyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -193,9 +193,7 @@ def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._delete( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,9 +226,7 @@ def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -271,9 +267,7 @@ def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._put( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", body=maybe_transform( { "name": name, @@ -345,7 +339,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", body=await async_maybe_transform( { "name": name, @@ -404,7 +398,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", page=AsyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -455,9 +449,7 @@ async def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._delete( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -490,9 +482,7 @@ async def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -533,9 +523,7 @@ async def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._put( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 17a7d75a..9a9f9c82 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -65,9 +65,7 @@ def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return self._get( - "/cloud/v2/client_quotas" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/client_quotas", + "/cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -105,9 +103,7 @@ def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -140,9 +136,7 @@ def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/global_quotas/{client_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -186,9 +180,7 @@ async def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return await self._get( - "/cloud/v2/client_quotas" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/client_quotas", + "/cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,9 +218,7 @@ async def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -261,9 +251,7 @@ async def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/global_quotas/{client_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 4c49c8b0..79d4febe 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -79,9 +79,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", body=maybe_transform( { "description": description, @@ -129,9 +127,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", page=SyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -177,9 +173,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -212,9 +206,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -275,9 +267,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", body=await async_maybe_transform( { "description": description, @@ -325,9 +315,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", page=AsyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -373,9 +361,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -408,9 +394,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index df9da044..b49adfcd 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -86,7 +86,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", + "/cloud/v1/regions", page=SyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -139,9 +139,7 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/regions/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -215,7 +213,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", + "/cloud/v1/regions", page=AsyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -268,9 +266,7 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/regions/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index 77496af1..0b579ba5 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -72,9 +72,7 @@ def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -118,9 +116,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,9 +177,7 @@ async def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -227,9 +221,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index b8623cf3..8889d473 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -126,9 +126,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -171,9 +169,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +207,7 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +244,7 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -292,9 +284,7 @@ def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=maybe_transform({"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -375,9 +365,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -420,9 +408,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -460,9 +446,7 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -499,9 +483,7 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -541,9 +523,7 @@ async def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=await async_maybe_transform( {"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams ), diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index 452755d2..74377052 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -69,9 +69,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -112,9 +110,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -172,9 +168,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -215,9 +209,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index 7bed1478..ab35828c 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -78,9 +78,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,9 +146,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index 8c402baf..f535c7dd 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -89,9 +89,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=maybe_transform( { "duration": duration, @@ -144,9 +142,7 @@ def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=maybe_transform( { "duration": duration, @@ -190,9 +186,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -231,9 +225,7 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,9 +265,7 @@ def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -314,9 +304,7 @@ def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,9 +375,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=await async_maybe_transform( { "duration": duration, @@ -442,9 +428,7 @@ async def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=await async_maybe_transform( { "duration": duration, @@ -488,9 +472,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,9 +511,7 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -571,9 +551,7 @@ async def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=await async_maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -612,9 +590,7 @@ async def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index 1cd099f6..d5b0e030 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -274,9 +274,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=maybe_transform( { "type": type, @@ -354,9 +352,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=SyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -413,9 +409,7 @@ def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -454,9 +448,7 @@ def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -703,9 +695,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=await async_maybe_transform( { "type": type, @@ -783,9 +773,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=AsyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -842,9 +830,7 @@ async def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -883,9 +869,7 @@ async def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 22757eba..1d6c76e2 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -79,9 +79,7 @@ def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -120,9 +118,7 @@ def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -164,9 +160,7 @@ def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -211,9 +205,7 @@ def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -256,9 +248,7 @@ def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), @@ -321,9 +311,7 @@ async def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -362,9 +350,7 @@ async def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -406,9 +392,7 @@ async def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -453,9 +437,7 @@ async def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=await async_maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -498,9 +480,7 @@ async def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index dabef59a..5cbefb25 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -86,9 +86,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}", page=SyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -144,9 +142,7 @@ def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,9 +187,7 @@ def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,9 +236,7 @@ def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -320,9 +312,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}", page=AsyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -378,9 +368,7 @@ async def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +413,7 @@ async def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -476,9 +462,7 @@ async def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index c69d2608..89b27a23 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -126,9 +126,7 @@ def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=maybe_transform( { "description": description, @@ -181,9 +179,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -277,9 +273,7 @@ def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=maybe_transform( { "direction": direction, @@ -403,9 +397,7 @@ async def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=await async_maybe_transform( { "description": description, @@ -458,9 +450,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -554,9 +544,7 @@ async def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=await async_maybe_transform( { "direction": direction, diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 0e24383b..ac4d9bc3 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -97,9 +97,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", body=maybe_transform( { "security_group": security_group, @@ -172,9 +170,7 @@ def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=maybe_transform( { "changed_rules": changed_rules, @@ -230,9 +226,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", page=SyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -285,9 +279,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -329,9 +321,7 @@ def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -371,9 +361,7 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -412,9 +400,7 @@ def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -481,9 +467,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", body=await async_maybe_transform( { "security_group": security_group, @@ -556,9 +540,7 @@ async def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=await async_maybe_transform( { "changed_rules": changed_rules, @@ -614,9 +596,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", page=AsyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -669,9 +649,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -713,9 +691,7 @@ async def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=await async_maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -755,9 +731,7 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -796,9 +770,7 @@ async def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 30ef2830..788d415c 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -90,9 +90,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", body=maybe_transform( { "name": name, @@ -143,9 +141,7 @@ def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=maybe_transform({"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -190,9 +186,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", page=SyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -245,9 +239,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -287,9 +279,7 @@ def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -362,9 +352,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", body=await async_maybe_transform( { "name": name, @@ -415,9 +403,7 @@ async def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=await async_maybe_transform( {"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams ), @@ -464,9 +450,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", page=AsyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -519,9 +503,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -561,9 +543,7 @@ async def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index c0866b41..63bc78f7 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -156,7 +156,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", + "/cloud/v1/tasks", page=SyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -213,9 +213,7 @@ def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v1/tasks/acknowledge_all" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -260,9 +258,7 @@ def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -297,9 +293,7 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/cloud/v1/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -437,7 +431,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", + "/cloud/v1/tasks", page=AsyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -494,9 +488,7 @@ async def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v1/tasks/acknowledge_all" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -541,9 +533,7 @@ async def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -578,9 +568,7 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/cloud/v1/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index 48387eda..0adc0809 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -139,9 +139,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/usage_report" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/usage_report", + "/cloud/v1/usage_report", body=maybe_transform( { "time_from": time_from, @@ -279,9 +277,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/usage_report" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/usage_report", + "/cloud/v1/usage_report", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 0318b8fc..5294d3a7 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -85,9 +85,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", body=maybe_transform( { "role": role, @@ -141,9 +139,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", body=maybe_transform( { "role": role, @@ -195,9 +191,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", page=SyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -243,9 +237,7 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ return self._delete( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -308,9 +300,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", body=await async_maybe_transform( { "role": role, @@ -364,9 +354,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", body=await async_maybe_transform( { "role": role, @@ -418,9 +406,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", page=AsyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -466,9 +452,7 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ return await self._delete( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 74756335..ed0babaa 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -292,9 +292,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", body=maybe_transform( { "image_id": image_id, @@ -378,9 +376,7 @@ def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=maybe_transform( { "name": name, @@ -462,9 +458,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", page=SyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -533,9 +527,7 @@ def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -592,9 +584,7 @@ def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=maybe_transform( { "instance_id": instance_id, @@ -651,9 +641,7 @@ def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=maybe_transform({"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -702,9 +690,7 @@ def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -752,9 +738,7 @@ def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -804,9 +788,7 @@ def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -855,9 +837,7 @@ def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1121,9 +1101,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", body=await async_maybe_transform( { "image_id": image_id, @@ -1207,9 +1185,7 @@ async def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=await async_maybe_transform( { "name": name, @@ -1291,9 +1267,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", page=AsyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -1362,9 +1336,7 @@ async def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1421,9 +1393,7 @@ async def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=await async_maybe_transform( { "instance_id": instance_id, @@ -1480,9 +1450,7 @@ async def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=await async_maybe_transform( {"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams ), @@ -1533,9 +1501,7 @@ async def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=await async_maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -1583,9 +1549,7 @@ async def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1635,9 +1599,7 @@ async def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=await async_maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1686,9 +1648,7 @@ async def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py index 612cd629..3e6485d0 100644 --- a/src/gcore/resources/dns/dns.py +++ b/src/gcore/resources/dns/dns.py @@ -104,9 +104,7 @@ def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return self._get( - "/dns/v2/platform/info" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/platform/info", + "/dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -143,7 +141,7 @@ def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", + "/dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -209,9 +207,7 @@ async def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return await self._get( - "/dns/v2/platform/info" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/platform/info", + "/dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -248,7 +244,7 @@ async def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", + "/dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/locations.py b/src/gcore/resources/dns/locations.py index c58907a8..20dcea5a 100644 --- a/src/gcore/resources/dns/locations.py +++ b/src/gcore/resources/dns/locations.py @@ -54,7 +54,7 @@ def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return self._get( - "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", + "/dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -73,9 +73,7 @@ def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return self._get( - "/dns/v2/locations/continents" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/continents", + "/dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -94,9 +92,7 @@ def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return self._get( - "/dns/v2/locations/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/countries", + "/dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -115,9 +111,7 @@ def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return self._get( - "/dns/v2/locations/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/regions", + "/dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -157,7 +151,7 @@ async def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return await self._get( - "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", + "/dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -176,9 +170,7 @@ async def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return await self._get( - "/dns/v2/locations/continents" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/continents", + "/dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -197,9 +189,7 @@ async def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return await self._get( - "/dns/v2/locations/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/countries", + "/dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -218,9 +208,7 @@ async def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return await self._get( - "/dns/v2/locations/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/regions", + "/dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index b9bf45a5..8eef7aeb 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -82,9 +82,7 @@ def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return self._get( - "/dns/v2/monitor/metrics" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -162,9 +160,7 @@ async def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return await self._get( - "/dns/v2/monitor/metrics" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/pickers/pickers.py b/src/gcore/resources/dns/pickers/pickers.py index 599a2450..3078c7f2 100644 --- a/src/gcore/resources/dns/pickers/pickers.py +++ b/src/gcore/resources/dns/pickers/pickers.py @@ -63,7 +63,7 @@ def list( ) -> PickerListResponse: """Returns list of picker""" return self._get( - "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", + "/dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -107,7 +107,7 @@ async def list( ) -> PickerListResponse: """Returns list of picker""" return await self._get( - "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", + "/dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/pickers/presets.py b/src/gcore/resources/dns/pickers/presets.py index 09f7d53b..aebd10ff 100644 --- a/src/gcore/resources/dns/pickers/presets.py +++ b/src/gcore/resources/dns/pickers/presets.py @@ -51,9 +51,7 @@ def list( ) -> PresetListResponse: """Returns list of picker preset""" return self._get( - "/dns/v2/pickers/presets" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/pickers/presets", + "/dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -93,9 +91,7 @@ async def list( ) -> PresetListResponse: """Returns list of picker preset""" return await self._get( - "/dns/v2/pickers/presets" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/pickers/presets", + "/dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/dnssec.py b/src/gcore/resources/dns/zones/dnssec.py index 8f283155..8c747071 100644 --- a/src/gcore/resources/dns/zones/dnssec.py +++ b/src/gcore/resources/dns/zones/dnssec.py @@ -69,9 +69,7 @@ def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", body=maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -105,9 +103,7 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -162,9 +158,7 @@ async def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", body=await async_maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -198,9 +192,7 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index 93697456..e1d136b1 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -205,9 +205,7 @@ def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -261,9 +259,7 @@ def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/rrsets" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -314,9 +310,7 @@ def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -355,9 +349,7 @@ def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,9 +394,7 @@ def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -463,9 +453,7 @@ def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -656,9 +644,7 @@ async def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, @@ -712,9 +698,7 @@ async def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/rrsets" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -765,9 +749,7 @@ async def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -806,9 +788,7 @@ async def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -853,9 +833,7 @@ async def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -914,9 +892,7 @@ async def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 31b815a3..75e11dde 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -143,7 +143,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", body=maybe_transform( { "name": name, @@ -225,7 +225,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -283,9 +283,7 @@ def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._delete( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -320,9 +318,7 @@ def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._post( - f"/dns/v2/analyze/{name}/delegation-status" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -355,9 +351,7 @@ def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/disable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +384,7 @@ def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/enable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +417,7 @@ def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/export" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -460,9 +450,7 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,9 +517,7 @@ def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/statistics" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -597,9 +583,7 @@ def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._post( - f"/dns/v2/zones/{zone_name}/import" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import", body=maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -672,9 +656,7 @@ def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return self._put( - f"/dns/v2/zones/{path_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}", body=maybe_transform( { "body_name": body_name, @@ -787,7 +769,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", body=await async_maybe_transform( { "name": name, @@ -869,7 +851,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -927,9 +909,7 @@ async def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._delete( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -964,9 +944,7 @@ async def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._post( - f"/dns/v2/analyze/{name}/delegation-status" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -999,9 +977,7 @@ async def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/disable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1034,9 +1010,7 @@ async def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/enable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1069,9 +1043,7 @@ async def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/export" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1104,9 +1076,7 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1173,9 +1143,7 @@ async def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/statistics" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1241,9 +1209,7 @@ async def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/import" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import", body=await async_maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1316,9 +1282,7 @@ async def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return await self._put( - f"/dns/v2/zones/{path_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}", body=await async_maybe_transform( { "body_name": body_name, diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index a72cd50f..92d2662a 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -121,7 +121,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", body=maybe_transform( { "binary": binary, @@ -208,9 +208,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=maybe_transform( { "binary": binary, @@ -307,7 +305,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", page=SyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -357,9 +355,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +386,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,9 +418,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -522,7 +514,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", body=await async_maybe_transform( { "binary": binary, @@ -609,9 +601,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=await async_maybe_transform( { "binary": binary, @@ -708,7 +698,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", page=AsyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -758,9 +748,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -791,9 +779,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -825,9 +811,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=await async_maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py index b61bcfd9..f43d121c 100644 --- a/src/gcore/resources/fastedge/apps/logs.py +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -94,9 +94,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs", page=SyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, @@ -189,9 +187,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs", page=AsyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index bdda5fd9..8323efb1 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -67,9 +67,7 @@ def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return self._post( - "/fastedge/v1/binaries/raw" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw", body=read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -89,9 +87,7 @@ def list( ) -> BinaryListResponse: """List binaries""" return self._get( - "/fastedge/v1/binaries" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries", + "/fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,9 +119,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -156,9 +150,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +203,7 @@ async def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return await self._post( - "/fastedge/v1/binaries/raw" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw", body=await async_read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -233,9 +223,7 @@ async def list( ) -> BinaryListResponse: """List binaries""" return await self._get( - "/fastedge/v1/binaries" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries", + "/fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,9 +255,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,9 +286,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/fastedge.py b/src/gcore/resources/fastedge/fastedge.py index e52b5216..9b052788 100644 --- a/src/gcore/resources/fastedge/fastedge.py +++ b/src/gcore/resources/fastedge/fastedge.py @@ -123,7 +123,7 @@ def get_account_overview( ) -> Client: """Get status and limits for the client""" return self._get( - "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", + "/fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +187,7 @@ async def get_account_overview( ) -> Client: """Get status and limits for the client""" return await self._get( - "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", + "/fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py index 17cd738d..cb007bbc 100644 --- a/src/gcore/resources/fastedge/kv_stores.py +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -72,7 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", body=maybe_transform( { "byod": byod, @@ -112,7 +112,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -148,9 +148,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,9 +179,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -220,9 +216,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", body=maybe_transform( { "byod": byod, @@ -286,7 +280,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", body=await async_maybe_transform( { "byod": byod, @@ -326,7 +320,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -362,9 +356,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -395,9 +387,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -434,9 +424,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", body=await async_maybe_transform( { "byod": byod, diff --git a/src/gcore/resources/fastedge/secrets.py b/src/gcore/resources/fastedge/secrets.py index beee5a6a..8b1e97e2 100644 --- a/src/gcore/resources/fastedge/secrets.py +++ b/src/gcore/resources/fastedge/secrets.py @@ -83,9 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", body=maybe_transform( { "name": name, @@ -133,9 +131,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=maybe_transform( { "comment": comment, @@ -179,9 +175,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -226,9 +220,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -263,9 +255,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -305,9 +295,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=maybe_transform( { "name": name, @@ -375,9 +363,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", body=await async_maybe_transform( { "name": name, @@ -425,9 +411,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "comment": comment, @@ -471,9 +455,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -518,9 +500,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -555,9 +535,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -597,9 +575,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/fastedge/statistics.py b/src/gcore/resources/fastedge/statistics.py index 9bc2a7ba..1958aafc 100644 --- a/src/gcore/resources/fastedge/statistics.py +++ b/src/gcore/resources/fastedge/statistics.py @@ -83,9 +83,7 @@ def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/calls" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -143,9 +141,7 @@ def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/app_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -224,9 +220,7 @@ async def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/calls" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -284,9 +278,7 @@ async def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/app_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/fastedge/templates.py b/src/gcore/resources/fastedge/templates.py index 78413275..a39e2757 100644 --- a/src/gcore/resources/fastedge/templates.py +++ b/src/gcore/resources/fastedge/templates.py @@ -93,9 +93,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", body=maybe_transform( { "binary_id": binary_id, @@ -151,9 +149,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", page=SyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -201,9 +197,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -238,9 +232,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -289,9 +281,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", body=maybe_transform( { "binary_id": binary_id, @@ -371,9 +361,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", body=await async_maybe_transform( { "binary_id": binary_id, @@ -429,9 +417,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", page=AsyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -479,9 +465,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -516,9 +500,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -567,9 +549,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", body=await async_maybe_transform( { "binary_id": binary_id, diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index 8e771ad5..ecd59cb6 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -80,9 +80,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", body=maybe_transform( { "client_user": client_user, @@ -149,9 +147,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -200,9 +196,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -234,9 +228,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,9 +293,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", body=await async_maybe_transform( { "client_user": client_user, @@ -370,9 +360,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -421,9 +409,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -455,9 +441,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/iam.py b/src/gcore/resources/iam/iam.py index e6fb22d8..54b4653f 100644 --- a/src/gcore/resources/iam/iam.py +++ b/src/gcore/resources/iam/iam.py @@ -75,7 +75,7 @@ def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return self._get( - "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", + "/iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +123,7 @@ async def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return await self._get( - "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", + "/iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index 5f0cf949..a27021c1 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -101,9 +101,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", body=maybe_transform( { "auth_types": auth_types, @@ -154,7 +152,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", + "/iam/users", page=SyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -200,9 +198,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -233,9 +229,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,9 +275,7 @@ def invite( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/iam/clients/invite_user" - if self._client._base_url_overridden - else "https://api.gcore.com//iam/clients/invite_user", + "/iam/clients/invite_user", body=maybe_transform( { "client_id": client_id, @@ -374,9 +366,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", body=await async_maybe_transform( { "auth_types": auth_types, @@ -427,7 +417,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", + "/iam/users", page=AsyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -473,9 +463,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -506,9 +494,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -554,9 +540,7 @@ async def invite( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/iam/clients/invite_user" - if self._client._base_url_overridden - else "https://api.gcore.com//iam/clients/invite_user", + "/iam/clients/invite_user", body=await async_maybe_transform( { "client_id": client_id, diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index fdbb1d33..43947fab 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -74,9 +74,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -124,9 +122,7 @@ def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", body=maybe_transform( { "announce": announce, @@ -195,9 +191,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -245,9 +239,7 @@ async def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", body=await async_maybe_transform( { "announce": announce, diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py index 98c34908..86d387bb 100644 --- a/src/gcore/resources/security/events.py +++ b/src/gcore/resources/security/events.py @@ -88,9 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs" - if self._client._base_url_overridden - else "https://api.gcore.com//security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs", page=SyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, @@ -176,9 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs" - if self._client._base_url_overridden - else "https://api.gcore.com//security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs", page=AsyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py index 79719fd7..85b84ad8 100644 --- a/src/gcore/resources/security/profile_templates.py +++ b/src/gcore/resources/security/profile_templates.py @@ -55,9 +55,7 @@ def list( profile. Client receives only common and created for him profile templates. """ return self._get( - "/security/iaas/profile-templates" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/profile-templates", + "/security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -101,9 +99,7 @@ async def list( profile. Client receives only common and created for him profile templates. """ return await self._get( - "/security/iaas/profile-templates" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/profile-templates", + "/security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index b3cd1183..16668afa 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -78,9 +78,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", body=maybe_transform( { "fields": fields, @@ -124,9 +122,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -172,9 +168,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -205,9 +199,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,9 +234,7 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}/recreate" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate", body=maybe_transform( { "fields": fields, @@ -290,9 +280,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", body=maybe_transform( { "fields": fields, @@ -358,9 +346,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", body=await async_maybe_transform( { "fields": fields, @@ -404,9 +390,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -452,9 +436,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,9 +467,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -522,9 +502,7 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}/recreate" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate", body=await async_maybe_transform( { "fields": fields, @@ -570,9 +548,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", body=await async_maybe_transform( { "fields": fields, diff --git a/src/gcore/resources/storage/__init__.py b/src/gcore/resources/storage/__init__.py new file mode 100644 index 00000000..00eb3797 --- /dev/null +++ b/src/gcore/resources/storage/__init__.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .buckets import ( + BucketsResource, + AsyncBucketsResource, + BucketsResourceWithRawResponse, + AsyncBucketsResourceWithRawResponse, + BucketsResourceWithStreamingResponse, + AsyncBucketsResourceWithStreamingResponse, +) +from .storage import ( + StorageResource, + AsyncStorageResource, + StorageResourceWithRawResponse, + AsyncStorageResourceWithRawResponse, + StorageResourceWithStreamingResponse, + AsyncStorageResourceWithStreamingResponse, +) +from .locations import ( + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, +) +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) +from .credentials import ( + CredentialsResource, + AsyncCredentialsResource, + CredentialsResourceWithRawResponse, + AsyncCredentialsResourceWithRawResponse, + CredentialsResourceWithStreamingResponse, + AsyncCredentialsResourceWithStreamingResponse, +) + +__all__ = [ + "LocationsResource", + "AsyncLocationsResource", + "LocationsResourceWithRawResponse", + "AsyncLocationsResourceWithRawResponse", + "LocationsResourceWithStreamingResponse", + "AsyncLocationsResourceWithStreamingResponse", + "StatisticsResource", + "AsyncStatisticsResource", + "StatisticsResourceWithRawResponse", + "AsyncStatisticsResourceWithRawResponse", + "StatisticsResourceWithStreamingResponse", + "AsyncStatisticsResourceWithStreamingResponse", + "CredentialsResource", + "AsyncCredentialsResource", + "CredentialsResourceWithRawResponse", + "AsyncCredentialsResourceWithRawResponse", + "CredentialsResourceWithStreamingResponse", + "AsyncCredentialsResourceWithStreamingResponse", + "BucketsResource", + "AsyncBucketsResource", + "BucketsResourceWithRawResponse", + "AsyncBucketsResourceWithRawResponse", + "BucketsResourceWithStreamingResponse", + "AsyncBucketsResourceWithStreamingResponse", + "StorageResource", + "AsyncStorageResource", + "StorageResourceWithRawResponse", + "AsyncStorageResourceWithRawResponse", + "StorageResourceWithStreamingResponse", + "AsyncStorageResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/storage/buckets/__init__.py b/src/gcore/resources/storage/buckets/__init__.py new file mode 100644 index 00000000..2ec8d4d5 --- /dev/null +++ b/src/gcore/resources/storage/buckets/__init__.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .cors import ( + CorsResource, + AsyncCorsResource, + CorsResourceWithRawResponse, + AsyncCorsResourceWithRawResponse, + CorsResourceWithStreamingResponse, + AsyncCorsResourceWithStreamingResponse, +) +from .policy import ( + PolicyResource, + AsyncPolicyResource, + PolicyResourceWithRawResponse, + AsyncPolicyResourceWithRawResponse, + PolicyResourceWithStreamingResponse, + AsyncPolicyResourceWithStreamingResponse, +) +from .buckets import ( + BucketsResource, + AsyncBucketsResource, + BucketsResourceWithRawResponse, + AsyncBucketsResourceWithRawResponse, + BucketsResourceWithStreamingResponse, + AsyncBucketsResourceWithStreamingResponse, +) +from .lifecycle import ( + LifecycleResource, + AsyncLifecycleResource, + LifecycleResourceWithRawResponse, + AsyncLifecycleResourceWithRawResponse, + LifecycleResourceWithStreamingResponse, + AsyncLifecycleResourceWithStreamingResponse, +) + +__all__ = [ + "CorsResource", + "AsyncCorsResource", + "CorsResourceWithRawResponse", + "AsyncCorsResourceWithRawResponse", + "CorsResourceWithStreamingResponse", + "AsyncCorsResourceWithStreamingResponse", + "LifecycleResource", + "AsyncLifecycleResource", + "LifecycleResourceWithRawResponse", + "AsyncLifecycleResourceWithRawResponse", + "LifecycleResourceWithStreamingResponse", + "AsyncLifecycleResourceWithStreamingResponse", + "PolicyResource", + "AsyncPolicyResource", + "PolicyResourceWithRawResponse", + "AsyncPolicyResourceWithRawResponse", + "PolicyResourceWithStreamingResponse", + "AsyncPolicyResourceWithStreamingResponse", + "BucketsResource", + "AsyncBucketsResource", + "BucketsResourceWithRawResponse", + "AsyncBucketsResourceWithRawResponse", + "BucketsResourceWithStreamingResponse", + "AsyncBucketsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py new file mode 100644 index 00000000..f857f350 --- /dev/null +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -0,0 +1,350 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .cors import ( + CorsResource, + AsyncCorsResource, + CorsResourceWithRawResponse, + AsyncCorsResourceWithRawResponse, + CorsResourceWithStreamingResponse, + AsyncCorsResourceWithStreamingResponse, +) +from .policy import ( + PolicyResource, + AsyncPolicyResource, + PolicyResourceWithRawResponse, + AsyncPolicyResourceWithRawResponse, + PolicyResourceWithStreamingResponse, + AsyncPolicyResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from .lifecycle import ( + LifecycleResource, + AsyncLifecycleResource, + LifecycleResourceWithRawResponse, + AsyncLifecycleResourceWithRawResponse, + LifecycleResourceWithStreamingResponse, + AsyncLifecycleResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options + +__all__ = ["BucketsResource", "AsyncBucketsResource"] + + +class BucketsResource(SyncAPIResource): + @cached_property + def cors(self) -> CorsResource: + return CorsResource(self._client) + + @cached_property + def lifecycle(self) -> LifecycleResource: + return LifecycleResource(self._client) + + @cached_property + def policy(self) -> PolicyResource: + return PolicyResource(self._client) + + @cached_property + def with_raw_response(self) -> BucketsResourceWithRawResponse: + """ + 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 BucketsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BucketsResourceWithStreamingResponse: + """ + 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 BucketsResourceWithStreamingResponse(self) + + def create( + self, + bucket_name: str, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Creates a new bucket within an S3 storage. + + Only applicable to S3-compatible + storages. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def delete( + self, + bucket_name: str, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Removes a bucket from an S3 storage. + + The bucket must be empty before deletion. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncBucketsResource(AsyncAPIResource): + @cached_property + def cors(self) -> AsyncCorsResource: + return AsyncCorsResource(self._client) + + @cached_property + def lifecycle(self) -> AsyncLifecycleResource: + return AsyncLifecycleResource(self._client) + + @cached_property + def policy(self) -> AsyncPolicyResource: + return AsyncPolicyResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncBucketsResourceWithRawResponse: + """ + 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 AsyncBucketsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBucketsResourceWithStreamingResponse: + """ + 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 AsyncBucketsResourceWithStreamingResponse(self) + + async def create( + self, + bucket_name: str, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Creates a new bucket within an S3 storage. + + Only applicable to S3-compatible + storages. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def delete( + self, + bucket_name: str, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Removes a bucket from an S3 storage. + + The bucket must be empty before deletion. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class BucketsResourceWithRawResponse: + def __init__(self, buckets: BucketsResource) -> None: + self._buckets = buckets + + self.create = to_raw_response_wrapper( + buckets.create, + ) + self.delete = to_raw_response_wrapper( + buckets.delete, + ) + + @cached_property + def cors(self) -> CorsResourceWithRawResponse: + return CorsResourceWithRawResponse(self._buckets.cors) + + @cached_property + def lifecycle(self) -> LifecycleResourceWithRawResponse: + return LifecycleResourceWithRawResponse(self._buckets.lifecycle) + + @cached_property + def policy(self) -> PolicyResourceWithRawResponse: + return PolicyResourceWithRawResponse(self._buckets.policy) + + +class AsyncBucketsResourceWithRawResponse: + def __init__(self, buckets: AsyncBucketsResource) -> None: + self._buckets = buckets + + self.create = async_to_raw_response_wrapper( + buckets.create, + ) + self.delete = async_to_raw_response_wrapper( + buckets.delete, + ) + + @cached_property + def cors(self) -> AsyncCorsResourceWithRawResponse: + return AsyncCorsResourceWithRawResponse(self._buckets.cors) + + @cached_property + def lifecycle(self) -> AsyncLifecycleResourceWithRawResponse: + return AsyncLifecycleResourceWithRawResponse(self._buckets.lifecycle) + + @cached_property + def policy(self) -> AsyncPolicyResourceWithRawResponse: + return AsyncPolicyResourceWithRawResponse(self._buckets.policy) + + +class BucketsResourceWithStreamingResponse: + def __init__(self, buckets: BucketsResource) -> None: + self._buckets = buckets + + self.create = to_streamed_response_wrapper( + buckets.create, + ) + self.delete = to_streamed_response_wrapper( + buckets.delete, + ) + + @cached_property + def cors(self) -> CorsResourceWithStreamingResponse: + return CorsResourceWithStreamingResponse(self._buckets.cors) + + @cached_property + def lifecycle(self) -> LifecycleResourceWithStreamingResponse: + return LifecycleResourceWithStreamingResponse(self._buckets.lifecycle) + + @cached_property + def policy(self) -> PolicyResourceWithStreamingResponse: + return PolicyResourceWithStreamingResponse(self._buckets.policy) + + +class AsyncBucketsResourceWithStreamingResponse: + def __init__(self, buckets: AsyncBucketsResource) -> None: + self._buckets = buckets + + self.create = async_to_streamed_response_wrapper( + buckets.create, + ) + self.delete = async_to_streamed_response_wrapper( + buckets.delete, + ) + + @cached_property + def cors(self) -> AsyncCorsResourceWithStreamingResponse: + return AsyncCorsResourceWithStreamingResponse(self._buckets.cors) + + @cached_property + def lifecycle(self) -> AsyncLifecycleResourceWithStreamingResponse: + return AsyncLifecycleResourceWithStreamingResponse(self._buckets.lifecycle) + + @cached_property + def policy(self) -> AsyncPolicyResourceWithStreamingResponse: + return AsyncPolicyResourceWithStreamingResponse(self._buckets.policy) diff --git a/src/gcore/resources/storage/buckets/cors.py b/src/gcore/resources/storage/buckets/cors.py new file mode 100644 index 00000000..01736f36 --- /dev/null +++ b/src/gcore/resources/storage/buckets/cors.py @@ -0,0 +1,261 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.storage.buckets import cor_create_params +from ....types.storage.buckets.storage_bucket_cors import StorageBucketCors + +__all__ = ["CorsResource", "AsyncCorsResource"] + + +class CorsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CorsResourceWithRawResponse: + """ + 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 CorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CorsResourceWithStreamingResponse: + """ + 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 CorsResourceWithStreamingResponse(self) + + def create( + self, + bucket_name: str, + *, + storage_id: int, + allowed_origins: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Configures Cross-Origin Resource Sharing (CORS) rules for an S3 bucket, allowing + web applications from specified domains to access bucket resources directly from + browsers. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + body=maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + bucket_name: str, + *, + storage_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, + ) -> StorageBucketCors: + """ + Retrieves the current Cross-Origin Resource Sharing (CORS) configuration for an + S3 bucket, showing which domains are allowed to access the bucket from web + browsers. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + return self._get( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StorageBucketCors, + ) + + +class AsyncCorsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCorsResourceWithRawResponse: + """ + 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 AsyncCorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCorsResourceWithStreamingResponse: + """ + 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 AsyncCorsResourceWithStreamingResponse(self) + + async def create( + self, + bucket_name: str, + *, + storage_id: int, + allowed_origins: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Configures Cross-Origin Resource Sharing (CORS) rules for an S3 bucket, allowing + web applications from specified domains to access bucket resources directly from + browsers. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + body=await async_maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + bucket_name: str, + *, + storage_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, + ) -> StorageBucketCors: + """ + Retrieves the current Cross-Origin Resource Sharing (CORS) configuration for an + S3 bucket, showing which domains are allowed to access the bucket from web + browsers. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + return await self._get( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StorageBucketCors, + ) + + +class CorsResourceWithRawResponse: + def __init__(self, cors: CorsResource) -> None: + self._cors = cors + + self.create = to_raw_response_wrapper( + cors.create, + ) + self.get = to_raw_response_wrapper( + cors.get, + ) + + +class AsyncCorsResourceWithRawResponse: + def __init__(self, cors: AsyncCorsResource) -> None: + self._cors = cors + + self.create = async_to_raw_response_wrapper( + cors.create, + ) + self.get = async_to_raw_response_wrapper( + cors.get, + ) + + +class CorsResourceWithStreamingResponse: + def __init__(self, cors: CorsResource) -> None: + self._cors = cors + + self.create = to_streamed_response_wrapper( + cors.create, + ) + self.get = to_streamed_response_wrapper( + cors.get, + ) + + +class AsyncCorsResourceWithStreamingResponse: + def __init__(self, cors: AsyncCorsResource) -> None: + self._cors = cors + + self.create = async_to_streamed_response_wrapper( + cors.create, + ) + self.get = async_to_streamed_response_wrapper( + cors.get, + ) diff --git a/src/gcore/resources/storage/buckets/lifecycle.py b/src/gcore/resources/storage/buckets/lifecycle.py new file mode 100644 index 00000000..ac68c1c6 --- /dev/null +++ b/src/gcore/resources/storage/buckets/lifecycle.py @@ -0,0 +1,264 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.storage.buckets import lifecycle_create_params + +__all__ = ["LifecycleResource", "AsyncLifecycleResource"] + + +class LifecycleResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> LifecycleResourceWithRawResponse: + """ + 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 LifecycleResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LifecycleResourceWithStreamingResponse: + """ + 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 LifecycleResourceWithStreamingResponse(self) + + def create( + self, + bucket_name: str, + *, + storage_id: int, + expiration_days: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Configures automatic object expiration rules for an S3 bucket. + + Objects older + than the specified number of days will be automatically deleted to manage + storage costs and compliance. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + body=maybe_transform({"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def delete( + self, + bucket_name: str, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Removes all lifecycle rules from an S3 bucket, disabling automatic object + expiration. Objects will no longer be automatically deleted based on age. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncLifecycleResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncLifecycleResourceWithRawResponse: + """ + 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 AsyncLifecycleResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLifecycleResourceWithStreamingResponse: + """ + 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 AsyncLifecycleResourceWithStreamingResponse(self) + + async def create( + self, + bucket_name: str, + *, + storage_id: int, + expiration_days: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Configures automatic object expiration rules for an S3 bucket. + + Objects older + than the specified number of days will be automatically deleted to manage + storage costs and compliance. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + body=await async_maybe_transform( + {"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def delete( + self, + bucket_name: str, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Removes all lifecycle rules from an S3 bucket, disabling automatic object + expiration. Objects will no longer be automatically deleted based on age. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class LifecycleResourceWithRawResponse: + def __init__(self, lifecycle: LifecycleResource) -> None: + self._lifecycle = lifecycle + + self.create = to_raw_response_wrapper( + lifecycle.create, + ) + self.delete = to_raw_response_wrapper( + lifecycle.delete, + ) + + +class AsyncLifecycleResourceWithRawResponse: + def __init__(self, lifecycle: AsyncLifecycleResource) -> None: + self._lifecycle = lifecycle + + self.create = async_to_raw_response_wrapper( + lifecycle.create, + ) + self.delete = async_to_raw_response_wrapper( + lifecycle.delete, + ) + + +class LifecycleResourceWithStreamingResponse: + def __init__(self, lifecycle: LifecycleResource) -> None: + self._lifecycle = lifecycle + + self.create = to_streamed_response_wrapper( + lifecycle.create, + ) + self.delete = to_streamed_response_wrapper( + lifecycle.delete, + ) + + +class AsyncLifecycleResourceWithStreamingResponse: + def __init__(self, lifecycle: AsyncLifecycleResource) -> None: + self._lifecycle = lifecycle + + self.create = async_to_streamed_response_wrapper( + lifecycle.create, + ) + self.delete = async_to_streamed_response_wrapper( + lifecycle.delete, + ) diff --git a/src/gcore/resources/storage/buckets/policy.py b/src/gcore/resources/storage/buckets/policy.py new file mode 100644 index 00000000..0a81929e --- /dev/null +++ b/src/gcore/resources/storage/buckets/policy.py @@ -0,0 +1,331 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.storage.buckets.storage_bucket_policy import StorageBucketPolicy + +__all__ = ["PolicyResource", "AsyncPolicyResource"] + + +class PolicyResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PolicyResourceWithRawResponse: + """ + 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 PolicyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PolicyResourceWithStreamingResponse: + """ + 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 PolicyResourceWithStreamingResponse(self) + + def create( + self, + bucket_name: str, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Creates or updates access policy for an S3 bucket, controlling permissions for + bucket operations. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def delete( + self, + bucket_name: str, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Removes the access policy from an S3 bucket, reverting to default permissions. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + bucket_name: str, + *, + storage_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, + ) -> StorageBucketPolicy: + """ + Retrieves the current access policy configuration for an S3 bucket. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + return self._get( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StorageBucketPolicy, + ) + + +class AsyncPolicyResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPolicyResourceWithRawResponse: + """ + 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 AsyncPolicyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPolicyResourceWithStreamingResponse: + """ + 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 AsyncPolicyResourceWithStreamingResponse(self) + + async def create( + self, + bucket_name: str, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Creates or updates access policy for an S3 bucket, controlling permissions for + bucket operations. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def delete( + self, + bucket_name: str, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Removes the access policy from an S3 bucket, reverting to default permissions. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + bucket_name: str, + *, + storage_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, + ) -> StorageBucketPolicy: + """ + Retrieves the current access policy configuration for an S3 bucket. + + 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 bucket_name: + raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") + return await self._get( + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StorageBucketPolicy, + ) + + +class PolicyResourceWithRawResponse: + def __init__(self, policy: PolicyResource) -> None: + self._policy = policy + + self.create = to_raw_response_wrapper( + policy.create, + ) + self.delete = to_raw_response_wrapper( + policy.delete, + ) + self.get = to_raw_response_wrapper( + policy.get, + ) + + +class AsyncPolicyResourceWithRawResponse: + def __init__(self, policy: AsyncPolicyResource) -> None: + self._policy = policy + + self.create = async_to_raw_response_wrapper( + policy.create, + ) + self.delete = async_to_raw_response_wrapper( + policy.delete, + ) + self.get = async_to_raw_response_wrapper( + policy.get, + ) + + +class PolicyResourceWithStreamingResponse: + def __init__(self, policy: PolicyResource) -> None: + self._policy = policy + + self.create = to_streamed_response_wrapper( + policy.create, + ) + self.delete = to_streamed_response_wrapper( + policy.delete, + ) + self.get = to_streamed_response_wrapper( + policy.get, + ) + + +class AsyncPolicyResourceWithStreamingResponse: + def __init__(self, policy: AsyncPolicyResource) -> None: + self._policy = policy + + self.create = async_to_streamed_response_wrapper( + policy.create, + ) + self.delete = async_to_streamed_response_wrapper( + policy.delete, + ) + self.get = async_to_streamed_response_wrapper( + policy.get, + ) diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py new file mode 100644 index 00000000..4a934ab4 --- /dev/null +++ b/src/gcore/resources/storage/credentials.py @@ -0,0 +1,193 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.storage import credential_recreate_params +from ...types.storage.storage import Storage + +__all__ = ["CredentialsResource", "AsyncCredentialsResource"] + + +class CredentialsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CredentialsResourceWithRawResponse: + """ + 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 CredentialsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CredentialsResourceWithStreamingResponse: + """ + 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 CredentialsResourceWithStreamingResponse(self) + + def recreate( + self, + storage_id: int, + *, + delete_sftp_password: bool | NotGiven = NOT_GIVEN, + generate_s3_keys: bool | NotGiven = NOT_GIVEN, + generate_sftp_password: bool | NotGiven = NOT_GIVEN, + reset_sftp_keys: bool | NotGiven = NOT_GIVEN, + sftp_password: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Storage: + """ + Generates new access credentials for the storage (S3 keys for S3 storage, SFTP + password for SFTP storage). + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/storage/provisioning/v1/storage/{storage_id}/credentials", + body=maybe_transform( + { + "delete_sftp_password": delete_sftp_password, + "generate_s3_keys": generate_s3_keys, + "generate_sftp_password": generate_sftp_password, + "reset_sftp_keys": reset_sftp_keys, + "sftp_password": sftp_password, + }, + credential_recreate_params.CredentialRecreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Storage, + ) + + +class AsyncCredentialsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCredentialsResourceWithRawResponse: + """ + 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 AsyncCredentialsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCredentialsResourceWithStreamingResponse: + """ + 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 AsyncCredentialsResourceWithStreamingResponse(self) + + async def recreate( + self, + storage_id: int, + *, + delete_sftp_password: bool | NotGiven = NOT_GIVEN, + generate_s3_keys: bool | NotGiven = NOT_GIVEN, + generate_sftp_password: bool | NotGiven = NOT_GIVEN, + reset_sftp_keys: bool | NotGiven = NOT_GIVEN, + sftp_password: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Storage: + """ + Generates new access credentials for the storage (S3 keys for S3 storage, SFTP + password for SFTP storage). + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/storage/provisioning/v1/storage/{storage_id}/credentials", + body=await async_maybe_transform( + { + "delete_sftp_password": delete_sftp_password, + "generate_s3_keys": generate_s3_keys, + "generate_sftp_password": generate_sftp_password, + "reset_sftp_keys": reset_sftp_keys, + "sftp_password": sftp_password, + }, + credential_recreate_params.CredentialRecreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Storage, + ) + + +class CredentialsResourceWithRawResponse: + def __init__(self, credentials: CredentialsResource) -> None: + self._credentials = credentials + + self.recreate = to_raw_response_wrapper( + credentials.recreate, + ) + + +class AsyncCredentialsResourceWithRawResponse: + def __init__(self, credentials: AsyncCredentialsResource) -> None: + self._credentials = credentials + + self.recreate = async_to_raw_response_wrapper( + credentials.recreate, + ) + + +class CredentialsResourceWithStreamingResponse: + def __init__(self, credentials: CredentialsResource) -> None: + self._credentials = credentials + + self.recreate = to_streamed_response_wrapper( + credentials.recreate, + ) + + +class AsyncCredentialsResourceWithStreamingResponse: + def __init__(self, credentials: AsyncCredentialsResource) -> None: + self._credentials = credentials + + self.recreate = async_to_streamed_response_wrapper( + credentials.recreate, + ) diff --git a/src/gcore/resources/storage/locations.py b/src/gcore/resources/storage/locations.py new file mode 100644 index 00000000..2157074d --- /dev/null +++ b/src/gcore/resources/storage/locations.py @@ -0,0 +1,143 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.storage.location_list_response import LocationListResponse + +__all__ = ["LocationsResource", "AsyncLocationsResource"] + + +class LocationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> LocationsResourceWithRawResponse: + """ + 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 LocationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: + """ + 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 LocationsResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LocationListResponse: + """Returns available storage locations where you can create storages. + + Each location + represents a geographic region with specific data center facilities. + """ + return self._get( + "/storage/provisioning/v1/location", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LocationListResponse, + ) + + +class AsyncLocationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncLocationsResourceWithRawResponse: + """ + 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 AsyncLocationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse: + """ + 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 AsyncLocationsResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> LocationListResponse: + """Returns available storage locations where you can create storages. + + Each location + represents a geographic region with specific data center facilities. + """ + return await self._get( + "/storage/provisioning/v1/location", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LocationListResponse, + ) + + +class LocationsResourceWithRawResponse: + def __init__(self, locations: LocationsResource) -> None: + self._locations = locations + + self.list = to_raw_response_wrapper( + locations.list, + ) + + +class AsyncLocationsResourceWithRawResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: + self._locations = locations + + self.list = async_to_raw_response_wrapper( + locations.list, + ) + + +class LocationsResourceWithStreamingResponse: + def __init__(self, locations: LocationsResource) -> None: + self._locations = locations + + self.list = to_streamed_response_wrapper( + locations.list, + ) + + +class AsyncLocationsResourceWithStreamingResponse: + def __init__(self, locations: AsyncLocationsResource) -> None: + self._locations = locations + + self.list = async_to_streamed_response_wrapper( + locations.list, + ) diff --git a/src/gcore/resources/storage/statistics.py b/src/gcore/resources/storage/statistics.py new file mode 100644 index 00000000..8e385298 --- /dev/null +++ b/src/gcore/resources/storage/statistics.py @@ -0,0 +1,364 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.storage import statistic_get_usage_series_params, statistic_get_usage_aggregated_params +from ...types.storage.storage_usage_total import StorageUsageTotal +from ...types.storage.statistic_get_usage_series_response import StatisticGetUsageSeriesResponse + +__all__ = ["StatisticsResource", "AsyncStatisticsResource"] + + +class StatisticsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StatisticsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return StatisticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StatisticsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return StatisticsResourceWithStreamingResponse(self) + + def get_usage_aggregated( + self, + *, + from_: str | NotGiven = NOT_GIVEN, + locations: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + storages: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + to: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StorageUsageTotal: + """ + Consumption statistics is updated in near real-time as a standard practice. + However, the frequency of updates can vary, but they are typically available + within a 60 minutes period. Exceptions, such as maintenance periods, may delay + data beyond 60 minutes until servers resume and backfill missing statistics. + + Shows storage total usage data in filtered by storages, locations and interval. + + Args: + from_: a From date filter + + locations: a Locations list of filter + + storages: a Storages list of filter + + to: a To date filter + + 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( + "/storage/stats/v1/storage/usage/total", + body=maybe_transform( + { + "from_": from_, + "locations": locations, + "storages": storages, + "to": to, + }, + statistic_get_usage_aggregated_params.StatisticGetUsageAggregatedParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StorageUsageTotal, + ) + + def get_usage_series( + self, + *, + from_: str | NotGiven = NOT_GIVEN, + granularity: str | NotGiven = NOT_GIVEN, + locations: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + source: int | NotGiven = NOT_GIVEN, + storages: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + to: str | NotGiven = NOT_GIVEN, + ts_string: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StatisticGetUsageSeriesResponse: + """ + Consumption statistics is updated in near real-time as a standard practice. + However, the frequency of updates can vary, but they are typically available + within a 60 minutes period. Exceptions, such as maintenance periods, may delay + data beyond 60 minutes until servers resume and backfill missing statistics. + + Shows storage usage data in series format filtered by clients, storages and + interval. + + Args: + from_: a From date filter + + granularity: a Granularity is period of time for grouping data Valid values are: 1h, 12h, 24h + + locations: a Locations list of filter + + source: a Source is deprecated parameter + + storages: a Storages list of filter + + to: a To date filter + + ts_string: a TsString is configurator of response time format switch response from unix + time format to RFC3339 (2006-01-02T15:04:05Z07:00) + + 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( + "/storage/stats/v1/storage/usage/series", + body=maybe_transform( + { + "from_": from_, + "granularity": granularity, + "locations": locations, + "source": source, + "storages": storages, + "to": to, + "ts_string": ts_string, + }, + statistic_get_usage_series_params.StatisticGetUsageSeriesParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StatisticGetUsageSeriesResponse, + ) + + +class AsyncStatisticsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncStatisticsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncStatisticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStatisticsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncStatisticsResourceWithStreamingResponse(self) + + async def get_usage_aggregated( + self, + *, + from_: str | NotGiven = NOT_GIVEN, + locations: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + storages: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + to: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StorageUsageTotal: + """ + Consumption statistics is updated in near real-time as a standard practice. + However, the frequency of updates can vary, but they are typically available + within a 60 minutes period. Exceptions, such as maintenance periods, may delay + data beyond 60 minutes until servers resume and backfill missing statistics. + + Shows storage total usage data in filtered by storages, locations and interval. + + Args: + from_: a From date filter + + locations: a Locations list of filter + + storages: a Storages list of filter + + to: a To date filter + + 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( + "/storage/stats/v1/storage/usage/total", + body=await async_maybe_transform( + { + "from_": from_, + "locations": locations, + "storages": storages, + "to": to, + }, + statistic_get_usage_aggregated_params.StatisticGetUsageAggregatedParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StorageUsageTotal, + ) + + async def get_usage_series( + self, + *, + from_: str | NotGiven = NOT_GIVEN, + granularity: str | NotGiven = NOT_GIVEN, + locations: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + source: int | NotGiven = NOT_GIVEN, + storages: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + to: str | NotGiven = NOT_GIVEN, + ts_string: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> StatisticGetUsageSeriesResponse: + """ + Consumption statistics is updated in near real-time as a standard practice. + However, the frequency of updates can vary, but they are typically available + within a 60 minutes period. Exceptions, such as maintenance periods, may delay + data beyond 60 minutes until servers resume and backfill missing statistics. + + Shows storage usage data in series format filtered by clients, storages and + interval. + + Args: + from_: a From date filter + + granularity: a Granularity is period of time for grouping data Valid values are: 1h, 12h, 24h + + locations: a Locations list of filter + + source: a Source is deprecated parameter + + storages: a Storages list of filter + + to: a To date filter + + ts_string: a TsString is configurator of response time format switch response from unix + time format to RFC3339 (2006-01-02T15:04:05Z07:00) + + 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( + "/storage/stats/v1/storage/usage/series", + body=await async_maybe_transform( + { + "from_": from_, + "granularity": granularity, + "locations": locations, + "source": source, + "storages": storages, + "to": to, + "ts_string": ts_string, + }, + statistic_get_usage_series_params.StatisticGetUsageSeriesParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=StatisticGetUsageSeriesResponse, + ) + + +class StatisticsResourceWithRawResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics + + self.get_usage_aggregated = to_raw_response_wrapper( + statistics.get_usage_aggregated, + ) + self.get_usage_series = to_raw_response_wrapper( + statistics.get_usage_series, + ) + + +class AsyncStatisticsResourceWithRawResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics + + self.get_usage_aggregated = async_to_raw_response_wrapper( + statistics.get_usage_aggregated, + ) + self.get_usage_series = async_to_raw_response_wrapper( + statistics.get_usage_series, + ) + + +class StatisticsResourceWithStreamingResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics + + self.get_usage_aggregated = to_streamed_response_wrapper( + statistics.get_usage_aggregated, + ) + self.get_usage_series = to_streamed_response_wrapper( + statistics.get_usage_series, + ) + + +class AsyncStatisticsResourceWithStreamingResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics + + self.get_usage_aggregated = async_to_streamed_response_wrapper( + statistics.get_usage_aggregated, + ) + self.get_usage_series = async_to_streamed_response_wrapper( + statistics.get_usage_series, + ) diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py new file mode 100644 index 00000000..81655ebd --- /dev/null +++ b/src/gcore/resources/storage/storage.py @@ -0,0 +1,715 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from .locations import ( + LocationsResource, + AsyncLocationsResource, + LocationsResourceWithRawResponse, + AsyncLocationsResourceWithRawResponse, + LocationsResourceWithStreamingResponse, + AsyncLocationsResourceWithStreamingResponse, +) +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .credentials import ( + CredentialsResource, + AsyncCredentialsResource, + CredentialsResourceWithRawResponse, + AsyncCredentialsResourceWithRawResponse, + CredentialsResourceWithStreamingResponse, + AsyncCredentialsResourceWithStreamingResponse, +) +from ..._base_client import make_request_options +from ...types.storage import storage_update_params, storage_restore_params +from .buckets.buckets import ( + BucketsResource, + AsyncBucketsResource, + BucketsResourceWithRawResponse, + AsyncBucketsResourceWithRawResponse, + BucketsResourceWithStreamingResponse, + AsyncBucketsResourceWithStreamingResponse, +) +from ...types.storage.storage import Storage + +__all__ = ["StorageResource", "AsyncStorageResource"] + + +class StorageResource(SyncAPIResource): + @cached_property + def locations(self) -> LocationsResource: + return LocationsResource(self._client) + + @cached_property + def statistics(self) -> StatisticsResource: + return StatisticsResource(self._client) + + @cached_property + def credentials(self) -> CredentialsResource: + return CredentialsResource(self._client) + + @cached_property + def buckets(self) -> BucketsResource: + return BucketsResource(self._client) + + @cached_property + def with_raw_response(self) -> StorageResourceWithRawResponse: + """ + 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 StorageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StorageResourceWithStreamingResponse: + """ + 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 StorageResourceWithStreamingResponse(self) + + def update( + self, + storage_id: int, + *, + expires: str | NotGiven = NOT_GIVEN, + server_alias: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Storage: + """ + Updates storage configuration such as expiration date and server alias. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/storage/provisioning/v1/storage/{storage_id}", + body=maybe_transform( + { + "expires": expires, + "server_alias": server_alias, + }, + storage_update_params.StorageUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Storage, + ) + + def delete( + self, + storage_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Permanently deletes a storage and all its data. + + This action cannot be undone. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/storage/provisioning/v1/storage/{storage_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + storage_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, + ) -> Storage: + """ + Retrieves detailed information about a specific storage including its + configuration, credentials, and current status. + + 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"/storage/provisioning/v1/storage/{storage_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Storage, + ) + + def link_ssh_key( + self, + key_id: int, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Associates an SSH public key with an SFTP storage, enabling passwordless + authentication. Only works with SFTP storage types - not applicable to + S3-compatible storage. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def restore( + self, + storage_id: int, + *, + client_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Restores a previously deleted S3 storage if it was deleted within the last 2 + weeks. SFTP storages cannot be restored. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/storage/provisioning/v1/storage/{storage_id}/restore", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"client_id": client_id}, storage_restore_params.StorageRestoreParams), + ), + cast_to=NoneType, + ) + + def unlink_ssh_key( + self, + key_id: int, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Removes SSH key association from an SFTP storage, disabling passwordless + authentication for that key. The key itself remains available for other + storages. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class AsyncStorageResource(AsyncAPIResource): + @cached_property + def locations(self) -> AsyncLocationsResource: + return AsyncLocationsResource(self._client) + + @cached_property + def statistics(self) -> AsyncStatisticsResource: + return AsyncStatisticsResource(self._client) + + @cached_property + def credentials(self) -> AsyncCredentialsResource: + return AsyncCredentialsResource(self._client) + + @cached_property + def buckets(self) -> AsyncBucketsResource: + return AsyncBucketsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncStorageResourceWithRawResponse: + """ + 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 AsyncStorageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStorageResourceWithStreamingResponse: + """ + 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 AsyncStorageResourceWithStreamingResponse(self) + + async def update( + self, + storage_id: int, + *, + expires: str | NotGiven = NOT_GIVEN, + server_alias: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Storage: + """ + Updates storage configuration such as expiration date and server alias. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/storage/provisioning/v1/storage/{storage_id}", + body=await async_maybe_transform( + { + "expires": expires, + "server_alias": server_alias, + }, + storage_update_params.StorageUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Storage, + ) + + async def delete( + self, + storage_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """Permanently deletes a storage and all its data. + + This action cannot be undone. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/storage/provisioning/v1/storage/{storage_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + storage_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, + ) -> Storage: + """ + Retrieves detailed information about a specific storage including its + configuration, credentials, and current status. + + 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"/storage/provisioning/v1/storage/{storage_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Storage, + ) + + async def link_ssh_key( + self, + key_id: int, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Associates an SSH public key with an SFTP storage, enabling passwordless + authentication. Only works with SFTP storage types - not applicable to + S3-compatible storage. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def restore( + self, + storage_id: int, + *, + client_id: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Restores a previously deleted S3 storage if it was deleted within the last 2 + weeks. SFTP storages cannot be restored. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/storage/provisioning/v1/storage/{storage_id}/restore", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"client_id": client_id}, storage_restore_params.StorageRestoreParams + ), + ), + cast_to=NoneType, + ) + + async def unlink_ssh_key( + self, + key_id: int, + *, + storage_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Removes SSH key association from an SFTP storage, disabling passwordless + authentication for that key. The key itself remains available for other + storages. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + +class StorageResourceWithRawResponse: + def __init__(self, storage: StorageResource) -> None: + self._storage = storage + + self.update = to_raw_response_wrapper( + storage.update, + ) + self.delete = to_raw_response_wrapper( + storage.delete, + ) + self.get = to_raw_response_wrapper( + storage.get, + ) + self.link_ssh_key = to_raw_response_wrapper( + storage.link_ssh_key, + ) + self.restore = to_raw_response_wrapper( + storage.restore, + ) + self.unlink_ssh_key = to_raw_response_wrapper( + storage.unlink_ssh_key, + ) + + @cached_property + def locations(self) -> LocationsResourceWithRawResponse: + return LocationsResourceWithRawResponse(self._storage.locations) + + @cached_property + def statistics(self) -> StatisticsResourceWithRawResponse: + return StatisticsResourceWithRawResponse(self._storage.statistics) + + @cached_property + def credentials(self) -> CredentialsResourceWithRawResponse: + return CredentialsResourceWithRawResponse(self._storage.credentials) + + @cached_property + def buckets(self) -> BucketsResourceWithRawResponse: + return BucketsResourceWithRawResponse(self._storage.buckets) + + +class AsyncStorageResourceWithRawResponse: + def __init__(self, storage: AsyncStorageResource) -> None: + self._storage = storage + + self.update = async_to_raw_response_wrapper( + storage.update, + ) + self.delete = async_to_raw_response_wrapper( + storage.delete, + ) + self.get = async_to_raw_response_wrapper( + storage.get, + ) + self.link_ssh_key = async_to_raw_response_wrapper( + storage.link_ssh_key, + ) + self.restore = async_to_raw_response_wrapper( + storage.restore, + ) + self.unlink_ssh_key = async_to_raw_response_wrapper( + storage.unlink_ssh_key, + ) + + @cached_property + def locations(self) -> AsyncLocationsResourceWithRawResponse: + return AsyncLocationsResourceWithRawResponse(self._storage.locations) + + @cached_property + def statistics(self) -> AsyncStatisticsResourceWithRawResponse: + return AsyncStatisticsResourceWithRawResponse(self._storage.statistics) + + @cached_property + def credentials(self) -> AsyncCredentialsResourceWithRawResponse: + return AsyncCredentialsResourceWithRawResponse(self._storage.credentials) + + @cached_property + def buckets(self) -> AsyncBucketsResourceWithRawResponse: + return AsyncBucketsResourceWithRawResponse(self._storage.buckets) + + +class StorageResourceWithStreamingResponse: + def __init__(self, storage: StorageResource) -> None: + self._storage = storage + + self.update = to_streamed_response_wrapper( + storage.update, + ) + self.delete = to_streamed_response_wrapper( + storage.delete, + ) + self.get = to_streamed_response_wrapper( + storage.get, + ) + self.link_ssh_key = to_streamed_response_wrapper( + storage.link_ssh_key, + ) + self.restore = to_streamed_response_wrapper( + storage.restore, + ) + self.unlink_ssh_key = to_streamed_response_wrapper( + storage.unlink_ssh_key, + ) + + @cached_property + def locations(self) -> LocationsResourceWithStreamingResponse: + return LocationsResourceWithStreamingResponse(self._storage.locations) + + @cached_property + def statistics(self) -> StatisticsResourceWithStreamingResponse: + return StatisticsResourceWithStreamingResponse(self._storage.statistics) + + @cached_property + def credentials(self) -> CredentialsResourceWithStreamingResponse: + return CredentialsResourceWithStreamingResponse(self._storage.credentials) + + @cached_property + def buckets(self) -> BucketsResourceWithStreamingResponse: + return BucketsResourceWithStreamingResponse(self._storage.buckets) + + +class AsyncStorageResourceWithStreamingResponse: + def __init__(self, storage: AsyncStorageResource) -> None: + self._storage = storage + + self.update = async_to_streamed_response_wrapper( + storage.update, + ) + self.delete = async_to_streamed_response_wrapper( + storage.delete, + ) + self.get = async_to_streamed_response_wrapper( + storage.get, + ) + self.link_ssh_key = async_to_streamed_response_wrapper( + storage.link_ssh_key, + ) + self.restore = async_to_streamed_response_wrapper( + storage.restore, + ) + self.unlink_ssh_key = async_to_streamed_response_wrapper( + storage.unlink_ssh_key, + ) + + @cached_property + def locations(self) -> AsyncLocationsResourceWithStreamingResponse: + return AsyncLocationsResourceWithStreamingResponse(self._storage.locations) + + @cached_property + def statistics(self) -> AsyncStatisticsResourceWithStreamingResponse: + return AsyncStatisticsResourceWithStreamingResponse(self._storage.statistics) + + @cached_property + def credentials(self) -> AsyncCredentialsResourceWithStreamingResponse: + return AsyncCredentialsResourceWithStreamingResponse(self._storage.credentials) + + @cached_property + def buckets(self) -> AsyncBucketsResourceWithStreamingResponse: + return AsyncBucketsResourceWithStreamingResponse(self._storage.buckets) diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 02cb29a4..4dafc6bd 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -54,7 +54,8 @@ def create( task_name: Literal["transcription", "content-moderation"], url: str, audio_language: str | NotGiven = NOT_GIVEN, - category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | NotGiven = NOT_GIVEN, + category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] + | NotGiven = NOT_GIVEN, client_entity_data: str | NotGiven = NOT_GIVEN, client_user_id: str | NotGiven = NOT_GIVEN, subtitles_language: str | NotGiven = NOT_GIVEN, @@ -73,9 +74,11 @@ def create( - ASR: Transcribe video - ASR: Translate subtitles - CM: Sports detection + - CM: Weapon detection - CM: Not Safe For Work (NSFW) content detection - CM: Soft nudity detection - CM: Hard nudity detection + - CM: Child Sexual Abuse Material (CSAM) detection - CM: Objects recognition (soon) ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) How to use: @@ -134,11 +137,14 @@ def create( - `soft_nudity`: Detailed video analysis that reveals both explicit and partial nudity, including the presence of male and female faces and other uncovered body parts. - - `sport`: Recognizes various sporting activities. The AI Content Moderation API - is an invaluable tool for managing and controlling the type of content being - shared or streamed on your platform. By implementing this API, you can ensure - compliance with community guidelines and legal requirements, as well as - provide a safer environment for your users. Important notes: + - `child_pornography`: Detects child sexual abuse materials (CASM). + - `sport`: Recognizes various sporting activities. + - `weapon`: Identifies the presence of weapons in the video content. The AI + Content Moderation API is an invaluable tool for managing and controlling the + type of content being shared or streamed on your platform. By implementing + this API, you can ensure compliance with community guidelines and legal + requirements, as well as provide a safer environment for your users. Important + notes: - It's allowed to analyse still images too (where applicable). Format of image: JPEG, PNG. In that case one image is the same as video of 1 second duration. - Not all frames in the video are used for analysis, but only key frames @@ -306,7 +312,7 @@ def create( - transcription into the original language is a free procedure, - and translation from the original language into any other languages is a "translation" procedure and is paid. More details in - [POST /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task). + [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). @@ -319,7 +325,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", body=maybe_transform( { "task_name": task_name, @@ -400,7 +406,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", page=SyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -451,9 +457,7 @@ def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/streaming/ai/tasks/{task_id}/cancel" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -480,9 +484,11 @@ def get( - ASR: Transcribe video - ASR: Translate subtitles - CM: Sports detection + - CM: Weapon detection - CM: Not Safe For Work (NSFW) content detection - CM: Soft nudity detection - CM: Hard nudity detection + - CM: Child Sexual Abuse Material (CSAM) detection - CM: Objects recognition (soon) - etc... (see other methods from /ai/ domain) @@ -520,9 +526,7 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/streaming/ai/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -594,7 +598,7 @@ def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", + "/streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -639,7 +643,8 @@ async def create( task_name: Literal["transcription", "content-moderation"], url: str, audio_language: str | NotGiven = NOT_GIVEN, - category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | NotGiven = NOT_GIVEN, + category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] + | NotGiven = NOT_GIVEN, client_entity_data: str | NotGiven = NOT_GIVEN, client_user_id: str | NotGiven = NOT_GIVEN, subtitles_language: str | NotGiven = NOT_GIVEN, @@ -658,9 +663,11 @@ async def create( - ASR: Transcribe video - ASR: Translate subtitles - CM: Sports detection + - CM: Weapon detection - CM: Not Safe For Work (NSFW) content detection - CM: Soft nudity detection - CM: Hard nudity detection + - CM: Child Sexual Abuse Material (CSAM) detection - CM: Objects recognition (soon) ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) How to use: @@ -719,11 +726,14 @@ async def create( - `soft_nudity`: Detailed video analysis that reveals both explicit and partial nudity, including the presence of male and female faces and other uncovered body parts. - - `sport`: Recognizes various sporting activities. The AI Content Moderation API - is an invaluable tool for managing and controlling the type of content being - shared or streamed on your platform. By implementing this API, you can ensure - compliance with community guidelines and legal requirements, as well as - provide a safer environment for your users. Important notes: + - `child_pornography`: Detects child sexual abuse materials (CASM). + - `sport`: Recognizes various sporting activities. + - `weapon`: Identifies the presence of weapons in the video content. The AI + Content Moderation API is an invaluable tool for managing and controlling the + type of content being shared or streamed on your platform. By implementing + this API, you can ensure compliance with community guidelines and legal + requirements, as well as provide a safer environment for your users. Important + notes: - It's allowed to analyse still images too (where applicable). Format of image: JPEG, PNG. In that case one image is the same as video of 1 second duration. - Not all frames in the video are used for analysis, but only key frames @@ -891,7 +901,7 @@ async def create( - transcription into the original language is a free procedure, - and translation from the original language into any other languages is a "translation" procedure and is paid. More details in - [POST /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task). + [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). @@ -904,7 +914,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", body=await async_maybe_transform( { "task_name": task_name, @@ -985,7 +995,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", page=AsyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -1036,9 +1046,7 @@ async def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/streaming/ai/tasks/{task_id}/cancel" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1065,9 +1073,11 @@ async def get( - ASR: Transcribe video - ASR: Translate subtitles - CM: Sports detection + - CM: Weapon detection - CM: Not Safe For Work (NSFW) content detection - CM: Soft nudity detection - CM: Hard nudity detection + - CM: Child Sexual Abuse Material (CSAM) detection - CM: Objects recognition (soon) - etc... (see other methods from /ai/ domain) @@ -1105,9 +1115,7 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/streaming/ai/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1179,7 +1187,7 @@ async def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", + "/streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index 9461d5b2..d8ef434b 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -76,9 +76,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", body=maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -111,9 +109,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", body=maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -150,9 +146,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", page=SyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -189,9 +183,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -222,9 +214,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -255,9 +245,7 @@ def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -318,9 +306,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -353,9 +339,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -392,9 +376,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", page=AsyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -431,9 +413,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -464,9 +444,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,9 +475,7 @@ async def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 345cfc7a..438d9de8 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -72,9 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/directories" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories", + "/streaming/directories", body=maybe_transform( { "name": name, @@ -119,9 +117,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", body=maybe_transform( { "name": name, @@ -167,9 +163,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -202,9 +196,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -227,9 +219,7 @@ def get_tree( directories in video hosting. """ return self._get( - "/streaming/directories/tree" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories/tree", + "/streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -286,9 +276,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/directories" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories", + "/streaming/directories", body=await async_maybe_transform( { "name": name, @@ -333,9 +321,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", body=await async_maybe_transform( { "name": name, @@ -381,9 +367,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -416,9 +400,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,9 +423,7 @@ async def get_tree( directories in video hosting. """ return await self._get( - "/streaming/directories/tree" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories/tree", + "/streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/players.py b/src/gcore/resources/streaming/players.py index 942e32b9..826e015a 100644 --- a/src/gcore/resources/streaming/players.py +++ b/src/gcore/resources/streaming/players.py @@ -72,7 +72,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", body=maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,9 +109,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", body=maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -146,7 +144,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", page=SyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -183,9 +181,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,9 +212,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +244,7 @@ def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - f"/streaming/players/{player_id}/preview" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -309,7 +301,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", body=await async_maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -346,9 +338,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", body=await async_maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -383,7 +373,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", page=AsyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -420,9 +410,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -453,9 +441,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -487,9 +473,7 @@ async def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - f"/streaming/players/{player_id}/preview" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index c9b9c691..fba76526 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -204,9 +204,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", body=maybe_transform( { "active": active, @@ -337,9 +335,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", body=maybe_transform( { "active": active, @@ -392,9 +388,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", page=SyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -431,9 +425,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -464,9 +456,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,9 +487,7 @@ def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}/videos" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -684,9 +672,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", body=await async_maybe_transform( { "active": active, @@ -817,9 +803,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", body=await async_maybe_transform( { "active": active, @@ -872,9 +856,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", page=AsyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -911,9 +893,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -944,9 +924,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -977,9 +955,7 @@ async def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}/videos" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index a80ce0b3..80e051f3 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -65,7 +65,7 @@ def list( [documentation](https://gcore.com/docs/streaming-platform/live-streams-and-videos-protocols-and-codecs/output-parameters-after-transcoding-bitrate-frame-rate-and-codecs). These values are the default for everyone. There is no need to configure anything additional. Read more about qiality in our blog - [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality). + [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality/). ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) Only for those cases when, in addition to the main parameters, it is necessary to use your own, then it is necessary to use custom quality sets. How to use: @@ -91,9 +91,7 @@ def list( is a paid feature. """ return self._get( - "/streaming/quality_sets" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets", + "/streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -139,9 +137,7 @@ def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - "/streaming/quality_sets/default" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets/default", + "/streaming/quality_sets/default", body=maybe_transform( { "live": live, @@ -200,7 +196,7 @@ async def list( [documentation](https://gcore.com/docs/streaming-platform/live-streams-and-videos-protocols-and-codecs/output-parameters-after-transcoding-bitrate-frame-rate-and-codecs). These values are the default for everyone. There is no need to configure anything additional. Read more about qiality in our blog - [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality). + [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality/). ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) Only for those cases when, in addition to the main parameters, it is necessary to use your own, then it is necessary to use custom quality sets. How to use: @@ -226,9 +222,7 @@ async def list( is a paid feature. """ return await self._get( - "/streaming/quality_sets" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets", + "/streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -274,9 +268,7 @@ async def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - "/streaming/quality_sets/default" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets/default", + "/streaming/quality_sets/default", body=await async_maybe_transform( { "live": live, diff --git a/src/gcore/resources/streaming/restreams.py b/src/gcore/resources/streaming/restreams.py index 1d703166..78880ed4 100644 --- a/src/gcore/resources/streaming/restreams.py +++ b/src/gcore/resources/streaming/restreams.py @@ -67,9 +67,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", body=maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -102,9 +100,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", body=maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -139,9 +135,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", page=SyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -178,9 +172,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +203,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -266,9 +256,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", body=await async_maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -301,9 +289,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", body=await async_maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -338,9 +324,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", page=AsyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -377,9 +361,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -410,9 +392,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 2b5e440d..084ee9c2 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -21,6 +21,7 @@ from ...types.streaming import ( statistic_get_views_params, statistic_get_ffprobes_params, + statistic_get_meet_series_params, statistic_get_stream_series_params, statistic_get_views_heatmap_params, statistic_get_popular_videos_params, @@ -45,6 +46,7 @@ ) from ...types.streaming.views import Views from ...types.streaming.ffprobes import Ffprobes +from ...types.streaming.meet_series import MeetSeries from ...types.streaming.stream_series import StreamSeries from ...types.streaming.views_heatmap import ViewsHeatmap from ...types.streaming.popular_videos import PopularVideos @@ -123,9 +125,7 @@ def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/ffprobe" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -190,9 +190,7 @@ def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -258,9 +256,7 @@ def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -321,9 +317,7 @@ def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -376,9 +370,7 @@ def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/max_stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/max_stream", + "/streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -396,6 +388,58 @@ def get_max_streams_series( cast_to=MaxStreamSeries, ) + def get_meet_series( + self, + *, + from_: str, + to: str, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> MeetSeries: + """Calculates time series of the transcoding minutes of all streams. + + The data is + updated near realtime. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + granularity: specifies the time interval for grouping data + + 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( + "/streaming/statistics/meet", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "granularity": granularity, + }, + statistic_get_meet_series_params.StatisticGetMeetSeriesParams, + ), + ), + cast_to=MeetSeries, + ) + def get_popular_videos( self, *, @@ -431,9 +475,7 @@ def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/popular" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/popular", + "/streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -484,9 +526,7 @@ def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/storage", + "/streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -538,9 +578,7 @@ def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream", + "/streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -613,9 +651,7 @@ def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/uniqs", + "/streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -702,9 +738,7 @@ def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/cdn/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -778,9 +812,7 @@ def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/views" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/views", + "/streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -837,9 +869,7 @@ def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/browsers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/browsers", + "/streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -890,9 +920,7 @@ def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/countries", + "/streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -943,9 +971,7 @@ def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/hosts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/hosts", + "/streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -996,9 +1022,7 @@ def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/systems" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/systems", + "/streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1049,9 +1073,7 @@ def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/embeds" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/embeds", + "/streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1102,9 +1124,7 @@ def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/regions", + "/streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1164,9 +1184,7 @@ def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/heatmap" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/heatmap", + "/streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1216,9 +1234,7 @@ def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/storage_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1266,9 +1282,7 @@ def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/transcoding_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1329,9 +1343,7 @@ def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1397,9 +1409,7 @@ def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1460,9 +1470,7 @@ def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1539,9 +1547,7 @@ async def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/ffprobe" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1606,9 +1612,7 @@ async def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1674,9 +1678,7 @@ async def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1737,9 +1739,7 @@ async def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1792,9 +1792,7 @@ async def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/max_stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/max_stream", + "/streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1812,6 +1810,58 @@ async def get_max_streams_series( cast_to=MaxStreamSeries, ) + async def get_meet_series( + self, + *, + from_: str, + to: str, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> MeetSeries: + """Calculates time series of the transcoding minutes of all streams. + + The data is + updated near realtime. + + Args: + from_: Start of time frame. Datetime in ISO 8601 format. + + to: End of time frame. Datetime in ISO 8601 format. + + granularity: specifies the time interval for grouping data + + 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( + "/streaming/statistics/meet", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "granularity": granularity, + }, + statistic_get_meet_series_params.StatisticGetMeetSeriesParams, + ), + ), + cast_to=MeetSeries, + ) + async def get_popular_videos( self, *, @@ -1847,9 +1897,7 @@ async def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/popular" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/popular", + "/streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1900,9 +1948,7 @@ async def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/storage", + "/streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1954,9 +2000,7 @@ async def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream", + "/streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2029,9 +2073,7 @@ async def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/uniqs", + "/streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2118,9 +2160,7 @@ async def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/cdn/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2194,9 +2234,7 @@ async def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/views" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/views", + "/streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2253,9 +2291,7 @@ async def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/browsers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/browsers", + "/streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2306,9 +2342,7 @@ async def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/countries", + "/streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2359,9 +2393,7 @@ async def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/hosts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/hosts", + "/streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2412,9 +2444,7 @@ async def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/systems" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/systems", + "/streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2465,9 +2495,7 @@ async def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/embeds" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/embeds", + "/streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2518,9 +2546,7 @@ async def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/regions", + "/streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2580,9 +2606,7 @@ async def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/heatmap" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/heatmap", + "/streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2632,9 +2656,7 @@ async def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/storage_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2682,9 +2704,7 @@ async def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/transcoding_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2745,9 +2765,7 @@ async def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2813,9 +2831,7 @@ async def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2876,9 +2892,7 @@ async def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2917,6 +2931,9 @@ def __init__(self, statistics: StatisticsResource) -> None: self.get_max_streams_series = to_raw_response_wrapper( statistics.get_max_streams_series, ) + self.get_meet_series = to_raw_response_wrapper( + statistics.get_meet_series, + ) self.get_popular_videos = to_raw_response_wrapper( statistics.get_popular_videos, ) @@ -2992,6 +3009,9 @@ def __init__(self, statistics: AsyncStatisticsResource) -> None: self.get_max_streams_series = async_to_raw_response_wrapper( statistics.get_max_streams_series, ) + self.get_meet_series = async_to_raw_response_wrapper( + statistics.get_meet_series, + ) self.get_popular_videos = async_to_raw_response_wrapper( statistics.get_popular_videos, ) @@ -3067,6 +3087,9 @@ def __init__(self, statistics: StatisticsResource) -> None: self.get_max_streams_series = to_streamed_response_wrapper( statistics.get_max_streams_series, ) + self.get_meet_series = to_streamed_response_wrapper( + statistics.get_meet_series, + ) self.get_popular_videos = to_streamed_response_wrapper( statistics.get_popular_videos, ) @@ -3142,6 +3165,9 @@ def __init__(self, statistics: AsyncStatisticsResource) -> None: self.get_max_streams_series = async_to_streamed_response_wrapper( statistics.get_max_streams_series, ) + self.get_meet_series = async_to_streamed_response_wrapper( + statistics.get_meet_series, + ) self.get_popular_videos = async_to_streamed_response_wrapper( statistics.get_popular_videos, ) diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index 58dfaf62..88bf963c 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -123,9 +123,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -152,7 +150,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Overlay: """ - Updates overlay settings + Updates overlay's settings Args: height: Height of the widget @@ -177,9 +175,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", body=maybe_transform( { "height": height, @@ -221,9 +217,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -256,9 +250,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -278,7 +270,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Overlay: """ - Get overlay details + Returns overlay details Args: extra_headers: Send extra headers @@ -290,9 +282,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -324,9 +314,7 @@ def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -432,9 +420,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -461,7 +447,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Overlay: """ - Updates overlay settings + Updates overlay's settings Args: height: Height of the widget @@ -486,9 +472,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", body=await async_maybe_transform( { "height": height, @@ -530,9 +514,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -565,9 +547,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -587,7 +567,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Overlay: """ - Get overlay details + Returns overlay details Args: extra_headers: Send extra headers @@ -599,9 +579,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -633,9 +611,7 @@ async def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 06bc5dcc..2b048223 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -80,6 +80,7 @@ def create( dvr_enabled: bool | NotGiven = NOT_GIVEN, hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN, html_overlay: bool | NotGiven = NOT_GIVEN, + low_latency_enabled: bool | NotGiven = NOT_GIVEN, projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN, pull: bool | NotGiven = NOT_GIVEN, quality_set_id: int | NotGiven = NOT_GIVEN, @@ -112,7 +113,7 @@ def create( for video streams by utilizing Common Media Application Format (CMAF) technology. So you obtain latency from the traditional 30-50 seconds to ±4 seconds only by default. If you need legacy non-low-latency HLS, then look at - HLS MPEG-TS delivery below. + HLS MPEGTS delivery below. You have access to additional functions such as: @@ -183,6 +184,19 @@ def create( html_overlay: Switch on mode to insert and display real-time HTML overlay widgets on top of live streams + low_latency_enabled: Deprecated, always returns "true". The only exception is that the attribute can + only be used by clients that have previously used the old stream format. This + method is outdated since we've made it easier to manage streams. For your + convenience, you no longer need to set this parameter at the stage of creating a + stream. Now all streams are prepared in 2 formats simultaniously: Low Latency + and Legacy. You can get the desired output format in the attributes + "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. + + --- + + Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the + "`hls_mpegts_url`" attribute instead. + projection: Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, then use parameters of that video player. Modes: @@ -196,10 +210,9 @@ def create( values: - true – stream is received by PULL method. Use this when need to get stream - from external server. + from external server by srt, rtmp\\ss, hls, dash, etc protocols. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from your encoder, mobile app - or OBS Studio. + from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to your conditions. Look at GET /`quality_sets` method @@ -217,11 +230,10 @@ def create( round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 24 hours of + inactivity of your streams we will stop PULL-ing, and will switch "active" field + to "false". Please, note that this field is for PULL only, so is not suitable + for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. extra_headers: Send extra headers @@ -232,7 +244,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", body=maybe_transform( { "name": name, @@ -246,6 +258,7 @@ def create( "dvr_enabled": dvr_enabled, "hls_mpegts_endlist_tag": hls_mpegts_endlist_tag, "html_overlay": html_overlay, + "low_latency_enabled": low_latency_enabled, "projection": projection, "pull": pull, "quality_set_id": quality_set_id, @@ -285,9 +298,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", body=maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -307,7 +318,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncPageStreaming[Stream]: - """Returns a list of streams + """Returns a list of streams. Args: page: Query parameter. @@ -326,7 +337,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", page=SyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -385,9 +396,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -419,9 +428,7 @@ def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,9 +536,7 @@ def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", body=maybe_transform( { "duration": duration, @@ -571,9 +576,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -622,9 +625,7 @@ def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -692,9 +693,7 @@ def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/start_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -731,9 +730,7 @@ def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/stop_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -779,6 +776,7 @@ async def create( dvr_enabled: bool | NotGiven = NOT_GIVEN, hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN, html_overlay: bool | NotGiven = NOT_GIVEN, + low_latency_enabled: bool | NotGiven = NOT_GIVEN, projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN, pull: bool | NotGiven = NOT_GIVEN, quality_set_id: int | NotGiven = NOT_GIVEN, @@ -811,7 +809,7 @@ async def create( for video streams by utilizing Common Media Application Format (CMAF) technology. So you obtain latency from the traditional 30-50 seconds to ±4 seconds only by default. If you need legacy non-low-latency HLS, then look at - HLS MPEG-TS delivery below. + HLS MPEGTS delivery below. You have access to additional functions such as: @@ -882,6 +880,19 @@ async def create( html_overlay: Switch on mode to insert and display real-time HTML overlay widgets on top of live streams + low_latency_enabled: Deprecated, always returns "true". The only exception is that the attribute can + only be used by clients that have previously used the old stream format. This + method is outdated since we've made it easier to manage streams. For your + convenience, you no longer need to set this parameter at the stage of creating a + stream. Now all streams are prepared in 2 formats simultaniously: Low Latency + and Legacy. You can get the desired output format in the attributes + "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. + + --- + + Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the + "`hls_mpegts_url`" attribute instead. + projection: Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, then use parameters of that video player. Modes: @@ -895,10 +906,9 @@ async def create( values: - true – stream is received by PULL method. Use this when need to get stream - from external server. + from external server by srt, rtmp\\ss, hls, dash, etc protocols. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from your encoder, mobile app - or OBS Studio. + from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to your conditions. Look at GET /`quality_sets` method @@ -916,11 +926,10 @@ async def create( round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 24 hours of + inactivity of your streams we will stop PULL-ing, and will switch "active" field + to "false". Please, note that this field is for PULL only, so is not suitable + for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. extra_headers: Send extra headers @@ -931,7 +940,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", body=await async_maybe_transform( { "name": name, @@ -945,6 +954,7 @@ async def create( "dvr_enabled": dvr_enabled, "hls_mpegts_endlist_tag": hls_mpegts_endlist_tag, "html_overlay": html_overlay, + "low_latency_enabled": low_latency_enabled, "projection": projection, "pull": pull, "quality_set_id": quality_set_id, @@ -984,9 +994,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", body=await async_maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1006,7 +1014,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Stream, AsyncPageStreaming[Stream]]: - """Returns a list of streams + """Returns a list of streams. Args: page: Query parameter. @@ -1025,7 +1033,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", page=AsyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -1084,9 +1092,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1118,9 +1124,7 @@ async def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1228,9 +1232,7 @@ async def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", body=await async_maybe_transform( { "duration": duration, @@ -1270,9 +1272,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1321,9 +1321,7 @@ async def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1391,9 +1389,7 @@ async def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/start_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1430,9 +1426,7 @@ async def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/stop_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 165594a4..e5823d43 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -73,7 +73,7 @@ def create( language code according to ISO-639-2 (bibliographic code). Specify language you need, or just look at our list in the attribute "`audio_language`" of section - ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). You can add multiple subtitles in the same language, language uniqueness is not required. Size must be up to 5Mb. @@ -84,7 +84,7 @@ def create( subtitles based on AI. Read more: - What is - ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). - If the option is enabled via `auto_transcribe_audio_language: auto|`, then immediately after successful transcoding, an AI task will be automatically created for @@ -120,9 +120,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", body=maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -172,9 +170,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", body=maybe_transform( { "language": language, @@ -213,9 +209,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -248,9 +242,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -282,9 +274,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -342,7 +332,7 @@ async def create( language code according to ISO-639-2 (bibliographic code). Specify language you need, or just look at our list in the attribute "`audio_language`" of section - ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). You can add multiple subtitles in the same language, language uniqueness is not required. Size must be up to 5Mb. @@ -353,7 +343,7 @@ async def create( subtitles based on AI. Read more: - What is - ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). - If the option is enabled via `auto_transcribe_audio_language: auto|`, then immediately after successful transcoding, an AI task will be automatically created for @@ -389,9 +379,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", body=await async_maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -441,9 +429,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", body=await async_maybe_transform( { "language": language, @@ -482,9 +468,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,9 +501,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -551,9 +533,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index 3b1cfbef..bee81322 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -107,7 +107,7 @@ def create( subtitles based on AI. Read more: - What is - ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). - If the option is enabled via `auto_transcribe_audio_language: auto|`, then immediately after successful transcoding, an AI task will be automatically created for @@ -118,7 +118,7 @@ def create( that. Also you can point several languages to translate to, then a separate subtitle will be generated for each specified language. - How to - ["add AI-generated subtitles to an exist video"](/docs/api-reference/streaming/subtitles/add-subtitle). + ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). The created AI-task(s) will be automatically executed, and result will also be automatically attached to this video as subtitle(s). Please note that transcription is done automatically for all videos uploaded to our video @@ -148,7 +148,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", body=maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -226,9 +226,9 @@ def update( More details: - List of AI tasks – API - [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified language(s). Can be used both together with `auto_transcribe_audio_language` @@ -371,9 +371,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", body=maybe_transform( { "name": name, @@ -469,7 +467,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", page=SyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -526,9 +524,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -579,9 +575,7 @@ def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos/batch" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/batch", + "/streaming/videos/batch", body=maybe_transform({"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, @@ -631,9 +625,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -693,9 +685,7 @@ def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -729,9 +719,7 @@ def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - "/streaming/videos/names" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/names", + "/streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -807,7 +795,7 @@ async def create( subtitles based on AI. Read more: - What is - ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). - If the option is enabled via `auto_transcribe_audio_language: auto|`, then immediately after successful transcoding, an AI task will be automatically created for @@ -818,7 +806,7 @@ async def create( that. Also you can point several languages to translate to, then a separate subtitle will be generated for each specified language. - How to - ["add AI-generated subtitles to an exist video"](/docs/api-reference/streaming/subtitles/add-subtitle). + ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). The created AI-task(s) will be automatically executed, and result will also be automatically attached to this video as subtitle(s). Please note that transcription is done automatically for all videos uploaded to our video @@ -848,7 +836,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", body=await async_maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -926,9 +914,9 @@ async def update( More details: - List of AI tasks – API - [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified language(s). Can be used both together with `auto_transcribe_audio_language` @@ -1071,9 +1059,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", body=await async_maybe_transform( { "name": name, @@ -1169,7 +1155,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", page=AsyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -1226,9 +1212,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1279,9 +1263,7 @@ async def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos/batch" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/batch", + "/streaming/videos/batch", body=await async_maybe_transform( {"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams ), @@ -1335,9 +1317,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1397,9 +1377,7 @@ async def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1433,9 +1411,7 @@ async def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - "/streaming/videos/names" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/names", + "/streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py index 96f15cca..30c32c1c 100644 --- a/src/gcore/resources/waap/advanced_rules.py +++ b/src/gcore/resources/waap/advanced_rules.py @@ -51,9 +51,7 @@ def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return self._get( - "/waap/v1/advanced-rules/descriptor" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -93,9 +91,7 @@ async def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return await self._get( - "/waap/v1/advanced-rules/descriptor" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index 9be46769..7ce6dca4 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -88,9 +88,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", body=maybe_transform( { "name": name, @@ -154,9 +152,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", body=maybe_transform( { "block": block, @@ -214,9 +210,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", page=SyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -264,9 +258,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -299,9 +291,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -359,9 +349,7 @@ def preview( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/preview-custom-page" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page", body=maybe_transform( { "error": error, @@ -442,9 +430,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", body=await async_maybe_transform( { "name": name, @@ -508,9 +494,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", body=await async_maybe_transform( { "block": block, @@ -568,9 +552,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", page=AsyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -618,9 +600,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -653,9 +633,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -713,9 +691,7 @@ async def preview( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/preview-custom-page" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page", body=await async_maybe_transform( { "error": error, diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index 6afde6d6..e22a838f 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -97,9 +97,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", body=maybe_transform( { "action": action, @@ -173,9 +171,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -265,9 +261,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", page=SyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -321,9 +315,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -359,9 +351,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -403,9 +393,7 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,9 +473,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", body=await async_maybe_transform( { "action": action, @@ -561,9 +547,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -653,9 +637,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", page=AsyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -709,9 +691,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -747,9 +727,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -791,9 +769,7 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py index ccd8a883..6b1f7896 100644 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -82,9 +82,7 @@ def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -117,9 +115,7 @@ def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -184,9 +180,7 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", page=SyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -237,9 +231,7 @@ def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -289,9 +281,7 @@ def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", body=maybe_transform( { "description_file_location": description_file_location, @@ -344,9 +334,7 @@ def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload", body=maybe_transform( { "file_data": file_data, @@ -412,9 +400,7 @@ async def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -447,9 +433,7 @@ async def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -514,9 +498,7 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", page=AsyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -567,9 +549,7 @@ async def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -619,9 +599,7 @@ async def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", body=await async_maybe_transform( { "description_file_location": description_file_location, @@ -674,9 +652,7 @@ async def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload", body=await async_maybe_transform( { "file_data": file_data, diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py index cf0c40e5..3e66ea27 100644 --- a/src/gcore/resources/waap/domains/api_path_groups.py +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -65,9 +65,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -121,9 +119,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index d372c33b..fc1dd68c 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -90,9 +90,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", body=maybe_transform( { "http_scheme": http_scheme, @@ -155,9 +153,7 @@ def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", body=maybe_transform( { "api_groups": api_groups, @@ -254,9 +250,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", page=SyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -315,9 +309,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -355,9 +347,7 @@ def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -430,9 +420,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", body=await async_maybe_transform( { "http_scheme": http_scheme, @@ -495,9 +483,7 @@ async def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", body=await async_maybe_transform( { "api_groups": api_groups, @@ -594,9 +580,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", page=AsyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -655,9 +639,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -695,9 +677,7 @@ async def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index adc81b2b..f175a192 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -92,9 +92,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", body=maybe_transform( { "action": action, @@ -157,9 +155,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -229,9 +225,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", page=SyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -284,9 +278,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -323,9 +315,7 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -364,9 +354,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -408,9 +396,7 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -480,9 +466,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", body=await async_maybe_transform( { "action": action, @@ -545,9 +529,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -617,9 +599,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", page=AsyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -672,9 +652,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -711,9 +689,7 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -752,9 +728,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -796,9 +770,7 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index 6e0e3bac..cf4135cc 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -198,9 +198,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", body=maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -250,7 +248,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", + "/waap/v1/domains", page=SyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -301,9 +299,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -336,9 +332,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -371,9 +365,7 @@ def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/rule-sets" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -411,9 +403,7 @@ def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -511,9 +501,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", body=await async_maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -563,7 +551,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", + "/waap/v1/domains", page=AsyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -614,9 +602,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -649,9 +635,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -684,9 +668,7 @@ async def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/rule-sets" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -724,9 +706,7 @@ async def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index bf624cf0..b8600359 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -91,9 +91,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", body=maybe_transform( { "action": action, @@ -155,9 +153,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -227,9 +223,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", page=SyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -282,9 +276,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -321,9 +313,7 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -362,9 +352,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -406,9 +394,7 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -477,9 +463,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", body=await async_maybe_transform( { "action": action, @@ -541,9 +525,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -613,9 +595,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", page=AsyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -668,9 +648,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -707,9 +685,7 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -748,9 +724,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -792,9 +766,7 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 98372746..577332e9 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -93,9 +93,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", body=maybe_transform( { "author": author, @@ -155,9 +153,7 @@ def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=maybe_transform( { "author": author, @@ -232,9 +228,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", page=SyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -289,9 +283,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -329,9 +321,7 @@ def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,9 +392,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", body=await async_maybe_transform( { "author": author, @@ -464,9 +452,7 @@ async def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=await async_maybe_transform( { "author": author, @@ -541,9 +527,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", page=AsyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -598,9 +582,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -638,9 +620,7 @@ async def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 7633f059..8fb4ab52 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -106,9 +106,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights", page=SyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -160,9 +158,7 @@ def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,9 +199,7 @@ def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", body=maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -295,9 +289,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights", page=AsyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -349,9 +341,7 @@ async def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,9 +382,7 @@ async def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", body=await async_maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py index 17c719c1..fc9cafbf 100644 --- a/src/gcore/resources/waap/domains/settings.py +++ b/src/gcore/resources/waap/domains/settings.py @@ -74,9 +74,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", body=maybe_transform( { "api": api, @@ -116,9 +114,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -179,9 +175,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", body=await async_maybe_transform( { "api": api, @@ -221,9 +215,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index 517d55f6..f23b048b 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -98,9 +98,7 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks", page=SyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -163,9 +161,7 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info", page=SyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -231,9 +227,7 @@ def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/stats" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -286,9 +280,7 @@ def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,9 +374,7 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests", page=SyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -450,9 +440,7 @@ def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/traffic" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -532,9 +520,7 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks", page=AsyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -597,9 +583,7 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info", page=AsyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -665,9 +649,7 @@ async def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/stats" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -720,9 +702,7 @@ async def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -816,9 +796,7 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests", page=AsyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -884,9 +862,7 @@ async def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/traffic" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index 0634ffef..e056e67a 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -88,9 +88,7 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/security-insights/types", + "/waap/v1/security-insights/types", page=SyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, @@ -176,9 +174,7 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/security-insights/types", + "/waap/v1/security-insights/types", page=AsyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/ip_info/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py index 12c7beb8..7d4d5f1b 100644 --- a/src/gcore/resources/waap/ip_info/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -95,9 +95,7 @@ def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-time-series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -144,9 +142,7 @@ def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/blocked-requests" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -193,9 +189,7 @@ def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ddos" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -235,9 +229,7 @@ def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ip-info" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -282,9 +274,7 @@ def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-urls" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -333,9 +323,7 @@ def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-user-agents" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -384,9 +372,7 @@ def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-sessions" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -429,9 +415,7 @@ def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-map" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -495,9 +479,7 @@ async def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-time-series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -544,9 +526,7 @@ async def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/blocked-requests" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -593,9 +573,7 @@ async def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ddos" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -635,9 +613,7 @@ async def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ip-info" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -682,9 +658,7 @@ async def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-urls" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -733,9 +707,7 @@ async def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-user-agents" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -784,9 +756,7 @@ async def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-sessions" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -829,9 +799,7 @@ async def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-map" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/ip_info/metrics.py b/src/gcore/resources/waap/ip_info/metrics.py index 32f17c80..c70d3faa 100644 --- a/src/gcore/resources/waap/ip_info/metrics.py +++ b/src/gcore/resources/waap/ip_info/metrics.py @@ -77,9 +77,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/counts" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -151,9 +149,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/counts" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py index ffe33962..f36dcb35 100644 --- a/src/gcore/resources/waap/organizations.py +++ b/src/gcore/resources/waap/organizations.py @@ -82,9 +82,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/organizations", + "/waap/v1/organizations", page=SyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, @@ -162,9 +160,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/organizations", + "/waap/v1/organizations", page=AsyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py index 5f64899e..f8258bab 100644 --- a/src/gcore/resources/waap/statistics.py +++ b/src/gcore/resources/waap/statistics.py @@ -87,9 +87,7 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/statistics/series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/statistics/series", + "/waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -171,9 +169,7 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/statistics/series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/statistics/series", + "/waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py index f2ced3d7..df171560 100644 --- a/src/gcore/resources/waap/tags.py +++ b/src/gcore/resources/waap/tags.py @@ -88,7 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", + "/waap/v1/tags", page=SyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", + "/waap/v1/tags", page=AsyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index 4f621d4e..3d68c41f 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -147,7 +147,7 @@ def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return self._get( - "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", + "/waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -219,7 +219,7 @@ async def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return await self._get( - "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", + "/waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/types/cloud/baremetal/server_rebuild_params.py b/src/gcore/types/cloud/baremetal/server_rebuild_params.py index 9addcb49..5a6e2be6 100644 --- a/src/gcore/types/cloud/baremetal/server_rebuild_params.py +++ b/src/gcore/types/cloud/baremetal/server_rebuild_params.py @@ -9,10 +9,8 @@ class ServerRebuildParams(TypedDict, total=False): project_id: int - """Project ID""" region_id: int - """Region ID""" image_id: str """Image ID""" diff --git a/src/gcore/types/dns/dns_get_account_overview_response.py b/src/gcore/types/dns/dns_get_account_overview_response.py index 6f91a78e..35e11fef 100644 --- a/src/gcore/types/dns/dns_get_account_overview_response.py +++ b/src/gcore/types/dns/dns_get_account_overview_response.py @@ -6,10 +6,25 @@ from ..._models import BaseModel -__all__ = ["DNSGetAccountOverviewResponse", "Info"] +__all__ = ["DNSGetAccountOverviewResponse", "Client", "Settings"] -class Info(BaseModel): +class Client(BaseModel): + client_id: Optional[int] = None + + enabled: Optional[bool] = None + + reseller: Optional[int] = None + + status: Optional[str] = None + + tariff_id: Optional[int] = None + + tariff_name: Optional[str] = None + """TariffName""" + + +class Settings(BaseModel): contact: Optional[str] = None name_server_1: Optional[str] = None @@ -18,4 +33,7 @@ class Info(BaseModel): class DNSGetAccountOverviewResponse(BaseModel): - info: Optional[Info] = FieldInfo(alias="Info", default=None) + client: Optional[Client] = FieldInfo(alias="Client", default=None) + """Client""" + + settings: Optional[Settings] = None diff --git a/src/gcore/types/dns/zone_get_response.py b/src/gcore/types/dns/zone_get_response.py index 912d6f73..1f43e8ca 100644 --- a/src/gcore/types/dns/zone_get_response.py +++ b/src/gcore/types/dns/zone_get_response.py @@ -45,8 +45,6 @@ class Zone(BaseModel): of getting deleted zones by admin. """ - client_id: Optional[int] = None - contact: Optional[str] = None """email address of the administrator responsible for this zone""" @@ -103,4 +101,4 @@ class Zone(BaseModel): class ZoneGetResponse(BaseModel): zone: Optional[Zone] = FieldInfo(alias="Zone", default=None) - """OutputZone""" + """swagger: model""" diff --git a/src/gcore/types/dns/zone_list_response.py b/src/gcore/types/dns/zone_list_response.py index 6a3826f3..3bd194de 100644 --- a/src/gcore/types/dns/zone_list_response.py +++ b/src/gcore/types/dns/zone_list_response.py @@ -43,8 +43,6 @@ class Zone(BaseModel): of getting deleted zones by admin. """ - client_id: Optional[int] = None - contact: Optional[str] = None """email address of the administrator responsible for this zone""" diff --git a/src/gcore/types/security/client_profile.py b/src/gcore/types/security/client_profile.py index ce945292..e440f21b 100644 --- a/src/gcore/types/security/client_profile.py +++ b/src/gcore/types/security/client_profile.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, List, Optional from ..._models import BaseModel from .client_profile_template import ClientProfileTemplate @@ -25,7 +25,7 @@ class Field(BaseModel): validation_schema: Dict[str, object] - field_value: Union[object, object, object, object, object, object, None] = None + field_value: Optional[Dict[str, object]] = None class Options(BaseModel): diff --git a/src/gcore/types/security/profile_create_params.py b/src/gcore/types/security/profile_create_params.py index 84a9e894..fbefd31e 100644 --- a/src/gcore/types/security/profile_create_params.py +++ b/src/gcore/types/security/profile_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileCreateParams", "Field"] @@ -21,4 +21,4 @@ class ProfileCreateParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Union[object, object, object, object, object, object, None] + field_value: Optional[Dict[str, object]] diff --git a/src/gcore/types/security/profile_recreate_params.py b/src/gcore/types/security/profile_recreate_params.py index 55c658cb..b8418275 100644 --- a/src/gcore/types/security/profile_recreate_params.py +++ b/src/gcore/types/security/profile_recreate_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileRecreateParams", "Field"] @@ -21,4 +21,4 @@ class ProfileRecreateParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Union[object, object, object, object, object, object, None] + field_value: Optional[Dict[str, object]] diff --git a/src/gcore/types/security/profile_replace_params.py b/src/gcore/types/security/profile_replace_params.py index 10af9a9b..d4304a67 100644 --- a/src/gcore/types/security/profile_replace_params.py +++ b/src/gcore/types/security/profile_replace_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileReplaceParams", "Field"] @@ -21,4 +21,4 @@ class ProfileReplaceParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Union[object, object, object, object, object, object, None] + field_value: Optional[Dict[str, object]] diff --git a/src/gcore/types/storage/__init__.py b/src/gcore/types/storage/__init__.py new file mode 100644 index 00000000..af3eaed9 --- /dev/null +++ b/src/gcore/types/storage/__init__.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .storage import Storage as Storage +from .storage_location import StorageLocation as StorageLocation +from .storage_usage_total import StorageUsageTotal as StorageUsageTotal +from .storage_usage_series import StorageUsageSeries as StorageUsageSeries +from .storage_update_params import StorageUpdateParams as StorageUpdateParams +from .location_list_response import LocationListResponse as LocationListResponse +from .storage_restore_params import StorageRestoreParams as StorageRestoreParams +from .credential_recreate_params import CredentialRecreateParams as CredentialRecreateParams +from .statistic_get_usage_series_params import StatisticGetUsageSeriesParams as StatisticGetUsageSeriesParams +from .statistic_get_usage_series_response import StatisticGetUsageSeriesResponse as StatisticGetUsageSeriesResponse +from .statistic_get_usage_aggregated_params import ( + StatisticGetUsageAggregatedParams as StatisticGetUsageAggregatedParams, +) diff --git a/src/gcore/types/storage/buckets/__init__.py b/src/gcore/types/storage/buckets/__init__.py new file mode 100644 index 00000000..f5dc4bb9 --- /dev/null +++ b/src/gcore/types/storage/buckets/__init__.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .cor_create_params import CorCreateParams as CorCreateParams +from .storage_bucket_cors import StorageBucketCors as StorageBucketCors +from .storage_bucket_policy import StorageBucketPolicy as StorageBucketPolicy +from .lifecycle_create_params import LifecycleCreateParams as LifecycleCreateParams diff --git a/src/gcore/types/storage/buckets/cor_create_params.py b/src/gcore/types/storage/buckets/cor_create_params.py new file mode 100644 index 00000000..23555c21 --- /dev/null +++ b/src/gcore/types/storage/buckets/cor_create_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ...._types import SequenceNotStr +from ...._utils import PropertyInfo + +__all__ = ["CorCreateParams"] + + +class CorCreateParams(TypedDict, total=False): + storage_id: Required[int] + + allowed_origins: Annotated[SequenceNotStr[str], PropertyInfo(alias="allowedOrigins")] diff --git a/src/gcore/types/storage/buckets/lifecycle_create_params.py b/src/gcore/types/storage/buckets/lifecycle_create_params.py new file mode 100644 index 00000000..f2ff054b --- /dev/null +++ b/src/gcore/types/storage/buckets/lifecycle_create_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LifecycleCreateParams"] + + +class LifecycleCreateParams(TypedDict, total=False): + storage_id: Required[int] + + expiration_days: int diff --git a/src/gcore/types/storage/buckets/storage_bucket_cors.py b/src/gcore/types/storage/buckets/storage_bucket_cors.py new file mode 100644 index 00000000..20a62c1d --- /dev/null +++ b/src/gcore/types/storage/buckets/storage_bucket_cors.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["StorageBucketCors", "Data"] + + +class Data(BaseModel): + allowed_origins: Optional[List[str]] = FieldInfo(alias="allowedOrigins", default=None) + + +class StorageBucketCors(BaseModel): + data: Optional[Data] = None diff --git a/src/gcore/types/storage/buckets/storage_bucket_policy.py b/src/gcore/types/storage/buckets/storage_bucket_policy.py new file mode 100644 index 00000000..6535a173 --- /dev/null +++ b/src/gcore/types/storage/buckets/storage_bucket_policy.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = ["StorageBucketPolicy"] + + +class StorageBucketPolicy(BaseModel): + enabled_http_access: Optional[bool] = FieldInfo(alias="enabledHttpAccess", default=None) diff --git a/src/gcore/types/storage/credential_recreate_params.py b/src/gcore/types/storage/credential_recreate_params.py new file mode 100644 index 00000000..6ddf0375 --- /dev/null +++ b/src/gcore/types/storage/credential_recreate_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_extensions import TypedDict + +__all__ = ["CredentialRecreateParams"] + + +class CredentialRecreateParams(TypedDict, total=False): + delete_sftp_password: bool + + generate_s3_keys: bool + + generate_sftp_password: bool + + reset_sftp_keys: bool + + sftp_password: str diff --git a/src/gcore/types/storage/location_list_response.py b/src/gcore/types/storage/location_list_response.py new file mode 100644 index 00000000..f95d0e5c --- /dev/null +++ b/src/gcore/types/storage/location_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .storage_location import StorageLocation + +__all__ = ["LocationListResponse"] + +LocationListResponse: TypeAlias = List[StorageLocation] diff --git a/src/gcore/types/storage/statistic_get_usage_aggregated_params.py b/src/gcore/types/storage/statistic_get_usage_aggregated_params.py new file mode 100644 index 00000000..b57d67a3 --- /dev/null +++ b/src/gcore/types/storage/statistic_get_usage_aggregated_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetUsageAggregatedParams"] + + +class StatisticGetUsageAggregatedParams(TypedDict, total=False): + from_: Annotated[str, PropertyInfo(alias="from")] + """a From date filter""" + + locations: SequenceNotStr[str] + """a Locations list of filter""" + + storages: SequenceNotStr[str] + """a Storages list of filter""" + + to: str + """a To date filter""" diff --git a/src/gcore/types/storage/statistic_get_usage_series_params.py b/src/gcore/types/storage/statistic_get_usage_series_params.py new file mode 100644 index 00000000..860ee30d --- /dev/null +++ b/src/gcore/types/storage/statistic_get_usage_series_params.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetUsageSeriesParams"] + + +class StatisticGetUsageSeriesParams(TypedDict, total=False): + from_: Annotated[str, PropertyInfo(alias="from")] + """a From date filter""" + + granularity: str + """ + a Granularity is period of time for grouping data Valid values are: 1h, 12h, 24h + """ + + locations: SequenceNotStr[str] + """a Locations list of filter""" + + source: int + """a Source is deprecated parameter""" + + storages: SequenceNotStr[str] + """a Storages list of filter""" + + to: str + """a To date filter""" + + ts_string: bool + """ + a TsString is configurator of response time format switch response from unix + time format to RFC3339 (2006-01-02T15:04:05Z07:00) + """ diff --git a/src/gcore/types/storage/statistic_get_usage_series_response.py b/src/gcore/types/storage/statistic_get_usage_series_response.py new file mode 100644 index 00000000..a5bf6ea8 --- /dev/null +++ b/src/gcore/types/storage/statistic_get_usage_series_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .storage_usage_series import StorageUsageSeries + +__all__ = ["StatisticGetUsageSeriesResponse"] + + +class StatisticGetUsageSeriesResponse(BaseModel): + data: Optional[StorageUsageSeries] = None diff --git a/src/gcore/types/storage/storage.py b/src/gcore/types/storage/storage.py new file mode 100644 index 00000000..c05b5906 --- /dev/null +++ b/src/gcore/types/storage/storage.py @@ -0,0 +1,68 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Storage", "Credentials", "CredentialsKey", "CredentialsS3"] + + +class CredentialsKey(BaseModel): + id: Optional[int] = None + + created_at: Optional[str] = None + + name: Optional[str] = None + + +class CredentialsS3(BaseModel): + access_key: Optional[str] = None + + secret_key: Optional[str] = None + + +class Credentials(BaseModel): + keys: Optional[List[CredentialsKey]] = None + + s3: Optional[CredentialsS3] = None + + sftp_password: Optional[str] = None + + +class Storage(BaseModel): + id: Optional[int] = None + + address: Optional[str] = None + + can_restore: Optional[bool] = None + + client_id: Optional[int] = None + + created_at: Optional[str] = None + + credentials: Optional[Credentials] = None + + custom_config_file: Optional[bool] = None + + deleted_at: Optional[str] = None + + disable_http: Optional[bool] = None + + expires: Optional[str] = None + + location: Optional[ + Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"] + ] = None + + name: Optional[str] = None + + provisioning_status: Optional[str] = None + + reseller_id: Optional[int] = None + + rewrite_rules: Optional[Dict[str, str]] = None + + server_alias: Optional[str] = None + + type: Optional[Literal["sftp", "s3"]] = None diff --git a/src/gcore/types/storage/storage_location.py b/src/gcore/types/storage/storage_location.py new file mode 100644 index 00000000..f5135296 --- /dev/null +++ b/src/gcore/types/storage/storage_location.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["StorageLocation"] + + +class StorageLocation(BaseModel): + id: Optional[int] = None + + address: Optional[str] = None + + allow_for_new_storage: Optional[Literal["deny", "allow"]] = None + """ + Indicates whether new storage can be created in this location: `allow` enables + storage creation, `deny` prevents it + """ + + name: Optional[Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"]] = None + + type: Optional[Literal["s3", "sftp"]] = None diff --git a/src/gcore/types/storage/storage_restore_params.py b/src/gcore/types/storage/storage_restore_params.py new file mode 100644 index 00000000..632405ec --- /dev/null +++ b/src/gcore/types/storage/storage_restore_params.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["StorageRestoreParams"] + + +class StorageRestoreParams(TypedDict, total=False): + client_id: int diff --git a/src/gcore/types/storage/storage_update_params.py b/src/gcore/types/storage/storage_update_params.py new file mode 100644 index 00000000..f9cef8d7 --- /dev/null +++ b/src/gcore/types/storage/storage_update_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["StorageUpdateParams"] + + +class StorageUpdateParams(TypedDict, total=False): + expires: str + + server_alias: str diff --git a/src/gcore/types/storage/storage_usage_series.py b/src/gcore/types/storage/storage_usage_series.py new file mode 100644 index 00000000..75a2f9a9 --- /dev/null +++ b/src/gcore/types/storage/storage_usage_series.py @@ -0,0 +1,201 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional + +from ..._models import BaseModel + +__all__ = ["StorageUsageSeries", "Clients", "ClientsLocations", "ClientsLocationsStorages"] + + +class ClientsLocationsStorages(BaseModel): + buckets_series: Optional[Dict[str, List[List[object]]]] = None + """ + a BucketsSeries is max bucket files count for grouped period + {name:[[timestamp, count]]} + """ + + file_quantity_sum_max: Optional[int] = None + """a FileQuantitySumMax is max sum of files quantity for grouped period""" + + name: Optional[str] = None + """a Name of storage""" + + requests_in_series: Optional[List[List[object]]] = None + """ + a RequestsInSeries is sum of incoming requests for grouped period + [[timestamp, count]] + """ + + requests_in_sum: Optional[int] = None + """a RequestsInSum is sum of incoming requests for grouped period""" + + requests_out_edges_series: Optional[List[List[object]]] = None + """ + a RequestsOutWoEdgesSeries is sum of out requests (only edges) for grouped + period [[timestamp, count]] + """ + + requests_out_edges_sum: Optional[int] = None + """a RequestsOutEdgesSum is sum of out edges requests for grouped period""" + + requests_out_wo_edges_series: Optional[List[List[object]]] = None + """ + a RequestsOutWoEdgesSeries is sum of out requests (without edges) for grouped + period [[timestamp, count]] + """ + + requests_out_wo_edges_sum: Optional[int] = None + """a RequestsOutWoEdgesSum is sum of out no edges requests for grouped period""" + + requests_series: Optional[List[List[object]]] = None + """a RequestsSeries is sum of out requests for grouped period [[timestamp, count]]""" + + requests_sum: Optional[int] = None + """a RequestsSum is sum of all requests for grouped period""" + + size_bytes_hour_series: Optional[List[List[object]]] = None + """ + a SizeBytesHourSeries is value that displays how many bytes were stored per hour + [[timestamp, count]] + """ + + size_max_series: Optional[List[List[object]]] = None + """a SizeMaxSeries is max of files size for grouped period [[timestamp, count]]""" + + size_mean_series: Optional[List[List[object]]] = None + """a SizeMeanSeries is mean of files size for grouped period [[timestamp, count]]""" + + size_sum_bytes_hour: Optional[int] = None + """a SizeSumBytesHour is sum of bytes hour for grouped period""" + + size_sum_max: Optional[int] = None + """a SizeSumMax is max sum of all files sizes for grouped period""" + + size_sum_mean: Optional[int] = None + """a SizeSumMean is mean sum of all files sizes for grouped period""" + + traffic_in_series: Optional[List[List[object]]] = None + """ + a TrafficInSeries is sum of incoming traffic bytes for grouped period + [[timestamp, count]] + """ + + traffic_in_sum: Optional[int] = None + """a TrafficInSum is sum of incoming traffic for grouped period""" + + traffic_out_edges_series: Optional[List[List[object]]] = None + """ + a TrafficOutWoEdgesSeries is sum of out traffic bytes (only edges) for grouped + period [[timestamp, count]] + """ + + traffic_out_edges_sum: Optional[int] = None + """a TrafficOutEdgesSum is sum of out edges traffic for grouped period""" + + traffic_out_wo_edges_series: Optional[List[List[object]]] = None + """ + a TrafficOutWoEdgesSeries is sum of out traffic bytes (without edges) for + grouped period [[timestamp, count]] + """ + + traffic_out_wo_edges_sum: Optional[int] = None + """a TrafficOutWoEdgesSum is sum of out no edges traffic for grouped period""" + + traffic_series: Optional[List[List[object]]] = None + """a TrafficSeries is sum of traffic bytes for grouped period [[timestamp, count]]""" + + traffic_sum: Optional[int] = None + """a TrafficSum is sum of all traffic for grouped period""" + + +class ClientsLocations(BaseModel): + file_quantity_sum_max: Optional[int] = None + """a FileQuantitySumMax is max sum of files quantity for grouped period""" + + name: Optional[str] = None + """a Name of location""" + + requests_in_sum: Optional[int] = None + """a RequestsInSum is sum of incoming requests for grouped period""" + + requests_out_edges_sum: Optional[int] = None + """a RequestsOutEdgesSum is sum of out edges requests for grouped period""" + + requests_out_wo_edges_sum: Optional[int] = None + """a RequestsOutWoEdgesSum is sum of out no edges requests for grouped period""" + + requests_sum: Optional[int] = None + """a RequestsSum is sum of all requests for grouped period""" + + size_sum_bytes_hour: Optional[int] = None + """a SizeSumBytesHour is sum of bytes hour for grouped period""" + + size_sum_max: Optional[int] = None + """a SizeSumMax is max sum of all files sizes for grouped period""" + + size_sum_mean: Optional[int] = None + """a SizeSumMean is mean sum of all files sizes for grouped period""" + + storages: Optional[Dict[str, ClientsLocationsStorages]] = None + """a Storages grouped data""" + + traffic_in_sum: Optional[int] = None + """a TrafficInSum is sum of incoming traffic for grouped period""" + + traffic_out_edges_sum: Optional[int] = None + """a TrafficOutEdgesSum is sum of out edges traffic for grouped period""" + + traffic_out_wo_edges_sum: Optional[int] = None + """a TrafficOutWoEdgesSum is sum of out no edges traffic for grouped period""" + + traffic_sum: Optional[int] = None + """a TrafficSum is sum of all traffic for grouped period""" + + +class Clients(BaseModel): + id: Optional[int] = None + """an ID of client""" + + file_quantity_sum_max: Optional[int] = None + """a FileQuantitySumMax is max sum of files quantity for grouped period""" + + locations: Optional[Dict[str, ClientsLocations]] = None + """a Locations grouped data""" + + requests_in_sum: Optional[int] = None + """a RequestsInSum is sum of incoming requests for grouped period""" + + requests_out_edges_sum: Optional[int] = None + """a RequestsOutEdgesSum is sum of out edges requests for grouped period""" + + requests_out_wo_edges_sum: Optional[int] = None + """a RequestsOutWoEdgesSum is sum of out no edges requests for grouped period""" + + requests_sum: Optional[int] = None + """a RequestsSum is sum of all requests for grouped period""" + + size_sum_bytes_hour: Optional[int] = None + """a SizeSumBytesHour is sum of bytes hour for grouped period""" + + size_sum_max: Optional[int] = None + """a SizeSumMax is max sum of all files sizes for grouped period""" + + size_sum_mean: Optional[int] = None + """a SizeSumMean is mean sum of all files sizes for grouped period""" + + traffic_in_sum: Optional[int] = None + """a TrafficInSum is sum of incoming traffic for grouped period""" + + traffic_out_edges_sum: Optional[int] = None + """a TrafficOutEdgesSum is sum of out edges traffic for grouped period""" + + traffic_out_wo_edges_sum: Optional[int] = None + """a TrafficOutWoEdgesSum is sum of out no edges traffic for grouped period""" + + traffic_sum: Optional[int] = None + """a TrafficSum is sum of all traffic for grouped period""" + + +class StorageUsageSeries(BaseModel): + clients: Optional[Dict[str, Clients]] = None + """a Clients grouped data""" diff --git a/src/gcore/types/storage/storage_usage_total.py b/src/gcore/types/storage/storage_usage_total.py new file mode 100644 index 00000000..9f2e5f46 --- /dev/null +++ b/src/gcore/types/storage/storage_usage_total.py @@ -0,0 +1,54 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["StorageUsageTotal", "Data", "DataMetrics"] + + +class DataMetrics(BaseModel): + file_quantity_sum_max: Optional[int] = None + """a FileQuantitySumMax is max sum of files quantity for grouped period""" + + requests_in_sum: Optional[int] = None + """a RequestsInSum is sum of incoming requests for grouped period""" + + requests_out_edges_sum: Optional[int] = None + """a RequestsOutEdgesSum is sum of out edges requests for grouped period""" + + requests_out_wo_edges_sum: Optional[int] = None + """a RequestsOutWoEdgesSum is sum of out no edges requests for grouped period""" + + requests_sum: Optional[int] = None + """a RequestsSum is sum of all requests for grouped period""" + + size_sum_bytes_hour: Optional[int] = None + """a SizeSumBytesHour is sum of bytes hour for grouped period""" + + size_sum_max: Optional[int] = None + """a SizeSumMax is max sum of all files sizes for grouped period""" + + size_sum_mean: Optional[int] = None + """a SizeSumMean is mean sum of all files sizes for grouped period""" + + traffic_in_sum: Optional[int] = None + """a TrafficInSum is sum of incoming traffic for grouped period""" + + traffic_out_edges_sum: Optional[int] = None + """a TrafficOutEdgesSum is sum of out edges traffic for grouped period""" + + traffic_out_wo_edges_sum: Optional[int] = None + """a TrafficOutWoEdgesSum is sum of out no edges traffic for grouped period""" + + traffic_sum: Optional[int] = None + """a TrafficSum is sum of all traffic for grouped period""" + + +class Data(BaseModel): + metrics: Optional[DataMetrics] = None + + +class StorageUsageTotal(BaseModel): + data: Optional[List[Data]] = None + """StorageUsageTotalRes for response""" diff --git a/src/gcore/types/streaming/__init__.py b/src/gcore/types/streaming/__init__.py index b58b2e1d..d64adf6e 100644 --- a/src/gcore/types/streaming/__init__.py +++ b/src/gcore/types/streaming/__init__.py @@ -13,6 +13,7 @@ from .restream import Restream as Restream from .subtitle import Subtitle as Subtitle from .broadcast import Broadcast as Broadcast +from .meet_series import MeetSeries as MeetSeries from .player_param import PlayerParam as PlayerParam from .quality_sets import QualitySets as QualitySets from .stream_series import StreamSeries as StreamSeries @@ -66,6 +67,7 @@ from .directory_update_params import DirectoryUpdateParams as DirectoryUpdateParams from .video_list_names_params import VideoListNamesParams as VideoListNamesParams from .direct_upload_parameters import DirectUploadParameters as DirectUploadParameters +from .ai_contentmoderation_casm import AIContentmoderationCasm as AIContentmoderationCasm from .ai_contentmoderation_nsfw import AIContentmoderationNsfw as AIContentmoderationNsfw from .stream_create_clip_params import StreamCreateClipParams as StreamCreateClipParams from .views_by_operating_system import ViewsByOperatingSystem as ViewsByOperatingSystem @@ -73,6 +75,7 @@ from .broadcast_spectators_count import BroadcastSpectatorsCount as BroadcastSpectatorsCount from .statistic_get_views_params import StatisticGetViewsParams as StatisticGetViewsParams from .stream_list_clips_response import StreamListClipsResponse as StreamListClipsResponse +from .ai_contentmoderation_weapon import AIContentmoderationWeapon as AIContentmoderationWeapon from .video_create_multiple_params import VideoCreateMultipleParams as VideoCreateMultipleParams from .playlist_list_videos_response import PlaylistListVideosResponse as PlaylistListVideosResponse from .statistic_get_ffprobes_params import StatisticGetFfprobesParams as StatisticGetFfprobesParams @@ -83,6 +86,7 @@ from .ai_contentmoderation_softnudity import AIContentmoderationSoftnudity as AIContentmoderationSoftnudity from .stream_start_recording_response import StreamStartRecordingResponse as StreamStartRecordingResponse from .ai_task_get_ai_settings_response import AITaskGetAISettingsResponse as AITaskGetAISettingsResponse +from .statistic_get_meet_series_params import StatisticGetMeetSeriesParams as StatisticGetMeetSeriesParams from .vod_total_stream_duration_series import VodTotalStreamDurationSeries as VodTotalStreamDurationSeries from .statistic_get_stream_series_params import StatisticGetStreamSeriesParams as StatisticGetStreamSeriesParams from .statistic_get_views_heatmap_params import StatisticGetViewsHeatmapParams as StatisticGetViewsHeatmapParams diff --git a/src/gcore/types/streaming/ai_contentmoderation_casm.py b/src/gcore/types/streaming/ai_contentmoderation_casm.py new file mode 100644 index 00000000..be44029f --- /dev/null +++ b/src/gcore/types/streaming/ai_contentmoderation_casm.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["AIContentmoderationCasm"] + + +class AIContentmoderationCasm(BaseModel): + category: Literal["child_pornography", "sport", "weapon", "nsfw", "hard_nudity", "soft_nudity"] + """AI content moderation with child pornography detection algorithm""" + + task_name: Literal["content-moderation"] + """Name of the task to be performed""" + + url: str + """URL to the MP4 file to analyse. + + File must be publicly accessible via HTTP/HTTPS. + """ + + client_entity_data: Optional[str] = None + """ + Meta parameter, designed to store your own extra information about a video + entity: video source, video id, etc. It is not used in any way in video + processing. For example, if an AI-task was created automatically when you + uploaded a video with the AI auto-processing option (nudity detection, etc), + then the ID of the associated video for which the task was performed will be + explicitly indicated here. + """ + + client_user_id: Optional[str] = None + """Meta parameter, designed to store your own identifier. + + Can be used by you to tag requests from different end-users. It is not used in + any way in video processing. + """ diff --git a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py index 61517f1a..4dd49d55 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py +++ b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py @@ -9,7 +9,7 @@ class AIContentmoderationHardnudity(BaseModel): - category: Literal["hard_nudity", "sport", "nsfw", "soft_nudity"] + category: Literal["hard_nudity", "sport", "weapon", "nsfw", "soft_nudity", "child_pornography"] """AI content moderation with "`hard_nudity`" algorithm""" task_name: Literal["content-moderation"] diff --git a/src/gcore/types/streaming/ai_contentmoderation_nsfw.py b/src/gcore/types/streaming/ai_contentmoderation_nsfw.py index e7c3436b..c2df5d03 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_nsfw.py +++ b/src/gcore/types/streaming/ai_contentmoderation_nsfw.py @@ -9,7 +9,7 @@ class AIContentmoderationNsfw(BaseModel): - category: Literal["nsfw", "sport", "hard_nudity", "soft_nudity"] + category: Literal["nsfw", "sport", "weapon", "hard_nudity", "soft_nudity", "child_pornography"] """AI content moderation with NSFW detection algorithm""" task_name: Literal["content-moderation"] diff --git a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py index 5c0b7f3c..8c169401 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py +++ b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py @@ -9,7 +9,7 @@ class AIContentmoderationSoftnudity(BaseModel): - category: Literal["soft_nudity", "sport", "nsfw", "hard_nudity"] + category: Literal["soft_nudity", "sport", "weapon", "nsfw", "hard_nudity", "child_pornography"] """AI content moderation with "`soft_nudity`" algorithm""" task_name: Literal["content-moderation"] diff --git a/src/gcore/types/streaming/ai_contentmoderation_sport.py b/src/gcore/types/streaming/ai_contentmoderation_sport.py index 78c5b629..34c8974e 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_sport.py +++ b/src/gcore/types/streaming/ai_contentmoderation_sport.py @@ -9,7 +9,7 @@ class AIContentmoderationSport(BaseModel): - category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] + category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] """AI content moderation with types of sports activity detection""" task_name: Literal["content-moderation"] diff --git a/src/gcore/types/streaming/ai_contentmoderation_weapon.py b/src/gcore/types/streaming/ai_contentmoderation_weapon.py new file mode 100644 index 00000000..b0e8c452 --- /dev/null +++ b/src/gcore/types/streaming/ai_contentmoderation_weapon.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["AIContentmoderationWeapon"] + + +class AIContentmoderationWeapon(BaseModel): + category: Literal["weapon", "sport", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] + """AI content moderation with weapon detection algorithm""" + + task_name: Literal["content-moderation"] + """Name of the task to be performed""" + + url: str + """URL to the MP4 file to analyse. + + File must be publicly accessible via HTTP/HTTPS. + """ + + client_entity_data: Optional[str] = None + """ + Meta parameter, designed to store your own extra information about a video + entity: video source, video id, etc. It is not used in any way in video + processing. For example, if an AI-task was created automatically when you + uploaded a video with the AI auto-processing option (nudity detection, etc), + then the ID of the associated video for which the task was performed will be + explicitly indicated here. + """ + + client_user_id: Optional[str] = None + """Meta parameter, designed to store your own identifier. + + Can be used by you to tag requests from different end-users. It is not used in + any way in video processing. + """ diff --git a/src/gcore/types/streaming/ai_task.py b/src/gcore/types/streaming/ai_task.py index fd114dea..acf9b2ee 100644 --- a/src/gcore/types/streaming/ai_task.py +++ b/src/gcore/types/streaming/ai_task.py @@ -4,8 +4,10 @@ from typing_extensions import Literal, TypeAlias from ..._models import BaseModel +from .ai_contentmoderation_casm import AIContentmoderationCasm from .ai_contentmoderation_nsfw import AIContentmoderationNsfw from .ai_contentmoderation_sport import AIContentmoderationSport +from .ai_contentmoderation_weapon import AIContentmoderationWeapon from .ai_contentmoderation_hardnudity import AIContentmoderationHardnudity from .ai_contentmoderation_softnudity import AIContentmoderationSoftnudity @@ -161,7 +163,7 @@ class TaskDataAITranscribe(BaseModel): - transcription into the original language is a free procedure, - and translation from the original language into any other languages is a "translation" procedure and is paid. More details in - [POST /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task). + [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). """ @@ -172,7 +174,9 @@ class TaskDataAITranscribe(BaseModel): AIContentmoderationNsfw, AIContentmoderationHardnudity, AIContentmoderationSoftnudity, + AIContentmoderationCasm, AIContentmoderationSport, + AIContentmoderationWeapon, ] diff --git a/src/gcore/types/streaming/ai_task_create_params.py b/src/gcore/types/streaming/ai_task_create_params.py index 11bddf89..f0fe134f 100644 --- a/src/gcore/types/streaming/ai_task_create_params.py +++ b/src/gcore/types/streaming/ai_task_create_params.py @@ -130,7 +130,7 @@ class AITaskCreateParams(TypedDict, total=False): - 'yor': Yoruba """ - category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] + category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] """Model for analysis (content-moderation only). Determines what exactly needs to be found in the video. @@ -162,7 +162,7 @@ class AITaskCreateParams(TypedDict, total=False): - transcription into the original language is a free procedure, - and translation from the original language into any other languages is a "translation" procedure and is paid. More details in - [POST /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task). + [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). """ diff --git a/src/gcore/types/streaming/ai_task_get_response.py b/src/gcore/types/streaming/ai_task_get_response.py index 8bd63299..e9179a3c 100644 --- a/src/gcore/types/streaming/ai_task_get_response.py +++ b/src/gcore/types/streaming/ai_task_get_response.py @@ -16,12 +16,16 @@ "AITaskGetResponseResultAIResultsTranscribeSubtitle", "AITaskGetResponseResultAIResultsContentmoderationSport", "AITaskGetResponseResultAIResultsContentmoderationSportFrame", + "AITaskGetResponseResultAIResultsContentmoderationWeapon", + "AITaskGetResponseResultAIResultsContentmoderationWeaponFrame", "AITaskGetResponseResultAIResultsContentmoderationNsfw", "AITaskGetResponseResultAIResultsContentmoderationNsfwFrame", "AITaskGetResponseResultAIResultsContentmoderationHardnudity", "AITaskGetResponseResultAIResultsContentmoderationHardnudityFrame", "AITaskGetResponseResultAIResultsContentmoderationSoftnudity", "AITaskGetResponseResultAIResultsContentmoderationSoftnudityFrame", + "AITaskGetResponseResultAIResultsContentmoderationCasm", + "AITaskGetResponseResultAIResultsContentmoderationCasmFrame", "AITaskGetResponseResultAIResultsFailure", ] @@ -153,6 +157,26 @@ class AITaskGetResponseResultAIResultsContentmoderationSport(BaseModel): """A boolean value whether any sports were detected""" +class AITaskGetResponseResultAIResultsContentmoderationWeaponFrame(BaseModel): + confidence: Optional[float] = None + """Percentage of probability of identifying the object""" + + frame_number: Optional[int] = FieldInfo(alias="frame-number", default=None) + """Video frame number where object was found""" + + label: Optional[str] = None + """Type of detected object""" + + +class AITaskGetResponseResultAIResultsContentmoderationWeapon(BaseModel): + detection_results: Optional[List[Literal["gun", "heavy weapon", "knife"]]] = None + + frames: Optional[List[AITaskGetResponseResultAIResultsContentmoderationWeaponFrame]] = None + + weapon_detected: Optional[bool] = None + """A boolean value whether any weapon was detected""" + + class AITaskGetResponseResultAIResultsContentmoderationNsfwFrame(BaseModel): confidence: Optional[float] = None """Percentage of probability of identifying the object""" @@ -247,6 +271,26 @@ class AITaskGetResponseResultAIResultsContentmoderationSoftnudity(BaseModel): """A boolean value whether any nudity and other body part was detected""" +class AITaskGetResponseResultAIResultsContentmoderationCasmFrame(BaseModel): + confidence: Optional[float] = None + """Percentage of probability of identifying the object""" + + frame_number: Optional[int] = FieldInfo(alias="frame-number", default=None) + """Video frame number where object was found""" + + label: Optional[str] = None + """Type of detected object""" + + +class AITaskGetResponseResultAIResultsContentmoderationCasm(BaseModel): + child_pornography_detected: Optional[bool] = None + """A boolean value whether child pornography was detected""" + + detection_results: Optional[List[Literal["0-2", "3-9", "10-19"]]] = None + + frames: Optional[List[AITaskGetResponseResultAIResultsContentmoderationCasmFrame]] = None + + class AITaskGetResponseResultAIResultsFailure(BaseModel): error: str @@ -254,9 +298,11 @@ class AITaskGetResponseResultAIResultsFailure(BaseModel): AITaskGetResponseResult: TypeAlias = Union[ AITaskGetResponseResultAIResultsTranscribe, AITaskGetResponseResultAIResultsContentmoderationSport, + AITaskGetResponseResultAIResultsContentmoderationWeapon, AITaskGetResponseResultAIResultsContentmoderationNsfw, AITaskGetResponseResultAIResultsContentmoderationHardnudity, AITaskGetResponseResultAIResultsContentmoderationSoftnudity, + AITaskGetResponseResultAIResultsContentmoderationCasm, AITaskGetResponseResultAIResultsFailure, ] diff --git a/src/gcore/types/streaming/create_video_param.py b/src/gcore/types/streaming/create_video_param.py index aed1f153..836ecbe5 100644 --- a/src/gcore/types/streaming/create_video_param.py +++ b/src/gcore/types/streaming/create_video_param.py @@ -32,9 +32,9 @@ class CreateVideoParam(TypedDict, total=False): More details: - List of AI tasks – API - [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). """ auto_translate_subtitles_language: Literal["disable", "default", ""] diff --git a/src/gcore/types/streaming/meet_series.py b/src/gcore/types/streaming/meet_series.py new file mode 100644 index 00000000..cc71be98 --- /dev/null +++ b/src/gcore/types/streaming/meet_series.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["MeetSeries", "MeetSeriesItem", "MeetSeriesItemMetrics"] + + +class MeetSeriesItemMetrics(BaseModel): + max_meet_usage: Optional[List[int]] = None + + meet: Optional[List[List[int]]] = None + + +class MeetSeriesItem(BaseModel): + client: int + + metrics: MeetSeriesItemMetrics + + +MeetSeries: TypeAlias = List[MeetSeriesItem] diff --git a/src/gcore/types/streaming/playlist_video.py b/src/gcore/types/streaming/playlist_video.py index 309b5362..d1b6e241 100644 --- a/src/gcore/types/streaming/playlist_video.py +++ b/src/gcore/types/streaming/playlist_video.py @@ -33,9 +33,9 @@ class PlaylistVideo(BaseModel): More details: - List of AI tasks – API - [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). """ auto_translate_subtitles_language: Optional[Literal["disable", "default", ""]] = None diff --git a/src/gcore/types/streaming/statistic_get_meet_series_params.py b/src/gcore/types/streaming/statistic_get_meet_series_params.py new file mode 100644 index 00000000..7c3e36ce --- /dev/null +++ b/src/gcore/types/streaming/statistic_get_meet_series_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetMeetSeriesParams"] + + +class StatisticGetMeetSeriesParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start of time frame. Datetime in ISO 8601 format.""" + + to: Required[str] + """End of time frame. Datetime in ISO 8601 format.""" + + granularity: Literal["1m", "5m", "15m", "1h", "1d"] + """specifies the time interval for grouping data""" diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py index 903a1515..4fdc6e54 100644 --- a/src/gcore/types/streaming/stream.py +++ b/src/gcore/types/streaming/stream.py @@ -168,7 +168,7 @@ class Stream(BaseModel): - and its possible to enable ±3 sec for LL-HLS, just ask our Support Team. It is also possible to use modifier-attributes, which are described in the - "`hls_mpegts_url`" field above. If you need to get MPEG-TS (.ts) chunks, look at + "`hls_mpegts_url`" field above. If you need to get MPEGTS (.ts) chunks, look at the attribute "`hls_mpegts_url`". Read more information in the article "How Low Latency streaming works" in the @@ -184,13 +184,13 @@ class Stream(BaseModel): hls_mpegts_url: Optional[str] = None """HLS output for legacy devices. - URL for transcoded result of stream in HLS MPEG-TS (.ts) format, with .m3u8 - link. Low Latency support: NO. Some legacy devices or software may require - MPEG-TS (.ts) segments as a format for streaming, so we provide this options - keeping backward compatibility with any of your existing workflows. For other - cases it's better to use "`hls_cmaf_url`" instead. You can use this legacy HLSv6 - format based on MPEG-TS segmenter in parallel with main HLS CMAF. Both formats - are sharing same segments size, manifest length (DVR), etc. + URL for transcoded result of stream in HLS MPEGTS (.ts) format, with .m3u8 link. + Low Latency support: NO. Some legacy devices or software may require MPEGTS + (.ts) segments as a format for streaming, so we provide this options keeping + backward compatibility with any of your existing workflows. For other cases it's + better to use "`hls_cmaf_url`" instead. You can use this legacy HLSv6 format + based on MPEGTS segmenter in parallel with main HLS CMAF. Both formats are + sharing same segments size, manifest length (DVR), etc. It is also possible to use additional modifier-attributes: @@ -245,6 +245,22 @@ class Stream(BaseModel): live: Optional[bool] = None """State of receiving and transcoding master stream from source by main server""" + low_latency_enabled: Optional[bool] = None + """ + Deprecated, always returns "true". The only exception is that the attribute can + only be used by clients that have previously used the old stream format. This + method is outdated since we've made it easier to manage streams. For your + convenience, you no longer need to set this parameter at the stage of creating a + stream. Now all streams are prepared in 2 formats simultaniously: Low Latency + and Legacy. You can get the desired output format in the attributes + "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. + + --- + + Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the + "`hls_mpegts_url`" attribute instead. + """ + projection: Optional[Literal["regular", "vr360", "vr180", "vr360tb"]] = None """ Visualization mode for 360° streams, how the stream is rendered in our web @@ -263,19 +279,15 @@ class Stream(BaseModel): Has two possible values: - true – stream is received by PULL method. Use this when need to get stream - from external server. + from external server by srt, rtmp\\ss, hls, dash, etc protocols. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from your encoder, mobile app - or OBS Studio. + from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. """ push_url: Optional[str] = None """ URL to PUSH master stream to our main server using RTMP and RTMPS protocols. To use RTMPS just manually change the protocol name from "rtmp://" to "rtmps://". - Use only 1 protocol of sending a master stream: eitheronly RTMP/S (`push_url`), - or only SRT (`push_url_srt`). - If you see an error like "invalid SSL certificate" try the following: - Make sure the push URL is correct, and it contains "rtmps://". @@ -283,58 +295,20 @@ class Stream(BaseModel): port 443 in the URL. Here’s an example: rtmps://vp-push.domain.com:443/in/stream?key. - If you're still having trouble, then your encoder may not support RTMPS. - 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. For - example, transcoding process will fail if: - - - you are pushing primary and backup RTMP to the same single `push_url` - simultaneously - - you are pushing RTMP to `push_url` and SRT to `push_url_srt` simultaneously - - For advanced customers only: For your complexly distributed broadcast systems, - it is also possible to additionally output an array of multi-regional ingestion - points for manual selection from them. To activate this mode, contact your - manager or the Support Team to activate the "`multi_region_push_urls`" attibute. - But if you clearly don’t understand why you need this, then it’s best to use the - default single URL in the "`push_url`" attribute. + Double-check the documentation for your encoder. For advanced customers only: + For your complexly distributed broadcast systems, it is also possible to + additionally output an array of multi-regional ingestion points for manual + selection from them. To activate this mode, contact your manager or the + Support Team to activate the "`multi_region_push_urls`" attibute. But if you + clearly don’t understand why you need this, then it’s best to use the default + single URL in the "`push_url`" attribute. """ push_url_srt: Optional[str] = None """ URL to PUSH master stream to our main server using SRT protocol. Use only 1 - protocol of sending a master stream: eitheronly RTMP/S (`push_url`), or only SRT - (`push_url_srt`). - - **Setup SRT latency on your sender side** SRT is designed as a low-latency - transport protocol, but real networks are not always stable and in some cases - the end-to-end path from the venue to the ingest point can be long. For this - reason, it is important to configure the latency parameter carefully to match - the actual network conditions. Small latency values may lead to packet loss when - jitter or retransmissions occur, while very large values introduce unnecessary - end-to-end delay. \\**Incorrect or low default value is one of the most common - reasons for packet loss, frames loss, and bad picture.\\** - - We therefore recommend setting latency manually rather than relying on the - default, to ensure the buffer is correctly sized for your environment. A - practical range is 400–2000 ms, with the exact value chosen based on RTT, - jitter, and expected packet loss. Be sure to check and test SRT settings on your - sender side. The default values do not take into account your specific scenarios - and do not work well. If necessary, ask us and we will help you. - - Please note that 1 connection and 1 protocol can be used at a single moment in - time per unique stream key input. Trying to send 2+ connection requests into - `push_url_srt` to once, or 2+ protocols at once will not lead to a result. For - example, transcoding process will fail if: - - - you are pushing primary and backup SRT to the same single `push_url_srt` - simultaneously - - you are pushing RTMP to `push_url` and SRT to `push_url_srt` simultaneously - - See more information and best practices about SRT protocol in the Product - Documentation. + protocol of sending a master stream: either only SRT (`push_url_srt`), or only + RTMP (`push_url`). """ push_url_whip: Optional[str] = None @@ -347,9 +321,9 @@ class Stream(BaseModel): receives video data. Signaling is a term to describe communication between WebRTC endpoints, needed to initiate and maintain a session. WHIP is an open specification for a simple signaling protocol for starting WebRTC sessions in an - outgoing direction, (i.e., streaming from your device). There is the primary - link only for WHIP, so no backup link. **WebRTC stream encoding parameters** At - least one video and audio track both must be present in the stream: + outgoing direction, (i.e., streaming from your device). **WebRTC stream encoding + parameters** At least one video and audio track both must be present in the + stream: - Video must be encoded with H.264. - Audio must be encoded with OPUS. Note. Specifically for WebRTC mode a method @@ -365,18 +339,8 @@ class Stream(BaseModel): https://stackblitz.com/edit/stackblitz-starters-j2r9ar?file=index.html Also try to use the feature in UI of the Customer Portal. In the Streaming section inside the settings of a specific live stream, a new section "Quick start in - browser" has been added. - - Please note that 1 connection and 1 protocol can be used at a single moment in - time per unique stream key input. Trying to send 2+ connection requests into - `push_url_whip` to once, or 2+ protocols at once will not lead to a result. For - example, transcoding process will fail if: - - - you are pushing primary and backup WHIP to the same single `push_url_whip` - simultaneously - - you are pushing WHIP to `push_url_whip` and RTMP to `push_url` simultaneously - - More information in the Product Documentation on the website. + browser" has been added. More information in the Product Documentation on the + website. """ quality_set_id: Optional[int] = None @@ -443,11 +407,10 @@ class Stream(BaseModel): round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 24 hours of + inactivity of your streams we will stop PULL-ing, and will switch "active" field + to "false". Please, note that this field is for PULL only, so is not suitable + for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. """ video_height: Optional[float] = None diff --git a/src/gcore/types/streaming/stream_create_params.py b/src/gcore/types/streaming/stream_create_params.py index a8254826..8c19a2d0 100644 --- a/src/gcore/types/streaming/stream_create_params.py +++ b/src/gcore/types/streaming/stream_create_params.py @@ -94,6 +94,22 @@ class StreamCreateParams(TypedDict, total=False): live streams """ + low_latency_enabled: bool + """ + Deprecated, always returns "true". The only exception is that the attribute can + only be used by clients that have previously used the old stream format. This + method is outdated since we've made it easier to manage streams. For your + convenience, you no longer need to set this parameter at the stage of creating a + stream. Now all streams are prepared in 2 formats simultaniously: Low Latency + and Legacy. You can get the desired output format in the attributes + "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. + + --- + + Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the + "`hls_mpegts_url`" attribute instead. + """ + projection: Literal["regular", "vr360", "vr180", "vr360tb"] """ Visualization mode for 360° streams, how the stream is rendered in our web @@ -112,10 +128,9 @@ class StreamCreateParams(TypedDict, total=False): Has two possible values: - true – stream is received by PULL method. Use this when need to get stream - from external server. + from external server by srt, rtmp\\ss, hls, dash, etc protocols. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from your encoder, mobile app - or OBS Studio. + from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. """ quality_set_id: int @@ -143,9 +158,8 @@ class StreamCreateParams(TypedDict, total=False): round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 24 hours of + inactivity of your streams we will stop PULL-ing, and will switch "active" field + to "false". Please, note that this field is for PULL only, so is not suitable + for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. """ diff --git a/src/gcore/types/streaming/stream_update_params.py b/src/gcore/types/streaming/stream_update_params.py index ecff938d..0f30b641 100644 --- a/src/gcore/types/streaming/stream_update_params.py +++ b/src/gcore/types/streaming/stream_update_params.py @@ -98,6 +98,22 @@ class Stream(TypedDict, total=False): live streams """ + low_latency_enabled: bool + """ + Deprecated, always returns "true". The only exception is that the attribute can + only be used by clients that have previously used the old stream format. This + method is outdated since we've made it easier to manage streams. For your + convenience, you no longer need to set this parameter at the stage of creating a + stream. Now all streams are prepared in 2 formats simultaniously: Low Latency + and Legacy. You can get the desired output format in the attributes + "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. + + --- + + Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the + "`hls_mpegts_url`" attribute instead. + """ + projection: Literal["regular", "vr360", "vr180", "vr360tb"] """ Visualization mode for 360° streams, how the stream is rendered in our web @@ -116,10 +132,9 @@ class Stream(TypedDict, total=False): Has two possible values: - true – stream is received by PULL method. Use this when need to get stream - from external server. + from external server by srt, rtmp\\ss, hls, dash, etc protocols. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from your encoder, mobile app - or OBS Studio. + from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. """ quality_set_id: int @@ -147,9 +162,8 @@ class Stream(TypedDict, total=False): round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 24 hours of + inactivity of your streams we will stop PULL-ing, and will switch "active" field + to "false". Please, note that this field is for PULL only, so is not suitable + for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. """ diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py index 42fff728..2ed91392 100644 --- a/src/gcore/types/streaming/video.py +++ b/src/gcore/types/streaming/video.py @@ -32,50 +32,23 @@ class ConvertedVideo(BaseModel): - /videos/{`client_id`}\\__{slug}/{filename}.mp4 - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download={`custom_filename`} The - first option returns the file as is. Response will be: + first option returns the file as is. The following options respond with the + header that directly tells browsers to download the file instead of playing it + in the browser. ``` - GET .mp4 - ... - content-type: video/mp4 - ``` - - 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 + Content-Disposition: attachment ``` The third option allows you to set a custom name for the file being downloaded. You can optionally specify a custom filename (just name excluding the .mp4 - extension) using the download= query. Filename constraints: + extension) using the download= query. Filename Constraints - Length: 1-255 characters - Must NOT include the .mp4 extension (it is added automatically) - Allowed characters: a-z, A-Z, 0-9, \\__(underscore), -(dash), .(dot) - - First character cannot be .(dot) - - 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 - ``` - - Examples: - - - Video: - `https://demo-public.gvideo.io/videos/2675_1OFgHZ1FWZNNvx1A/qid3567v1_h264_4050_1080.mp4/download` - - Video with custom download filename: - `https://demo-public.gvideo.io/videos/2675_1OFgHZ1FWZNNvx1A/qid3567v1_h264_4050_1080.mp4/download=highlights_v1.1_2025-05-30` + - First character cannot be .(dot) Example valid filenames: `holiday2025`, + `_backup.final`, `clip-v1.2` **Default MP4 file name structure** Link to the file {filename} contains information about the encoding method using format: @@ -111,6 +84,15 @@ class ConvertedVideo(BaseModel): - ip: The user’s IP address Example: `?md5=QX39c77lbQKvYgMMAvpyMQ&expires=1743167062` Read more in Product Documentation in Streaming section "Protected temporarily link". + + **Examples** + + - Audio-only: + `https://demo-public.gvideo.io/videos/2675_JNnccG5l97XPxsov/qid3585v1_aac_128_audio.mp4` + - Video: + `https://demo-public.gvideo.io/videos/2675_3MlggU4xDb1Ssa5Y/qid3567v1_h264_4050_1080.mp4/download` + - Video with custom download filename: + `https://demo-public.gvideo.io/videos/2675_XtMKxzJM6Xt7SBUV/1080.mp4/download=highlights_v1.1_2025-05-30` """ name: Optional[str] = None @@ -287,7 +269,7 @@ class Video(BaseModel): There are some link modificators you can specify and add manually: - - ?`no_low_latency` – player is forced to use non-low-latency streams HLS MPEG-TS, instead of MPEG-DASH CMAF or HLS/LL-HLS CMAF. + - ?`no_low_latency` – player is forced to use non-low-latency streams HLS MPEG TS, instead of MPEG-DASH CMAF or HLS/LL-HLS CMAF. - ?t=(integer) – time to start playback from specified point in the video. Applicable for VOD only. - ?`sub_lang`=(language) – force subtitles to specific language (2 letters ISO 639 code of a language). - Read more in the Product Documentation. diff --git a/src/gcore/types/streaming/video_update_params.py b/src/gcore/types/streaming/video_update_params.py index db5ed39f..94c6ca2c 100644 --- a/src/gcore/types/streaming/video_update_params.py +++ b/src/gcore/types/streaming/video_update_params.py @@ -32,9 +32,9 @@ class VideoUpdateParams(TypedDict, total=False): More details: - List of AI tasks – API - [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) + [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). + [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). """ auto_translate_subtitles_language: Literal["disable", "default", ""] diff --git a/src/gcore/types/waap/domains/waap_request_details.py b/src/gcore/types/waap/domains/waap_request_details.py index e3a1d9cd..7b560704 100644 --- a/src/gcore/types/waap/domains/waap_request_details.py +++ b/src/gcore/types/waap/domains/waap_request_details.py @@ -1,7 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Dict, List -from datetime import datetime from typing_extensions import Literal from ...._models import BaseModel @@ -152,7 +151,7 @@ class WaapRequestDetails(BaseModel): request_headers: Dict[str, object] """HTTP request headers""" - request_time: datetime + request_time: str """The time of the request""" request_type: str diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index 355896d0..db10a5ea 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -164,18 +164,18 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_rebuild(self, client: Gcore) -> None: server = client.cloud.baremetal.servers.rebuild( - server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, + server_id="server_id", + project_id=0, + region_id=0, ) assert_matches_type(TaskIDList, server, path=["response"]) @parametrize def test_method_rebuild_with_all_params(self, client: Gcore) -> None: server = client.cloud.baremetal.servers.rebuild( - server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, + server_id="server_id", + project_id=0, + region_id=0, image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", user_data="aGVsbG9fd29ybGQ=", ) @@ -184,9 +184,9 @@ def test_method_rebuild_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_rebuild(self, client: Gcore) -> None: response = client.cloud.baremetal.servers.with_raw_response.rebuild( - server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, + server_id="server_id", + project_id=0, + region_id=0, ) assert response.is_closed is True @@ -197,9 +197,9 @@ def test_raw_response_rebuild(self, client: Gcore) -> None: @parametrize def test_streaming_response_rebuild(self, client: Gcore) -> None: with client.cloud.baremetal.servers.with_streaming_response.rebuild( - server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, + server_id="server_id", + project_id=0, + region_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -214,8 +214,8 @@ def test_path_params_rebuild(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): client.cloud.baremetal.servers.with_raw_response.rebuild( server_id="", - project_id=1, - region_id=1, + project_id=0, + region_id=0, ) @@ -368,18 +368,18 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_rebuild(self, async_client: AsyncGcore) -> None: server = await async_client.cloud.baremetal.servers.rebuild( - server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, + server_id="server_id", + project_id=0, + region_id=0, ) assert_matches_type(TaskIDList, server, path=["response"]) @parametrize async def test_method_rebuild_with_all_params(self, async_client: AsyncGcore) -> None: server = await async_client.cloud.baremetal.servers.rebuild( - server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, + server_id="server_id", + project_id=0, + region_id=0, image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", user_data="aGVsbG9fd29ybGQ=", ) @@ -388,9 +388,9 @@ async def test_method_rebuild_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_rebuild(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.baremetal.servers.with_raw_response.rebuild( - server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, + server_id="server_id", + project_id=0, + region_id=0, ) assert response.is_closed is True @@ -401,9 +401,9 @@ async def test_raw_response_rebuild(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_rebuild(self, async_client: AsyncGcore) -> None: async with async_client.cloud.baremetal.servers.with_streaming_response.rebuild( - server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, + server_id="server_id", + project_id=0, + region_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -418,6 +418,6 @@ async def test_path_params_rebuild(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): await async_client.cloud.baremetal.servers.with_raw_response.rebuild( server_id="", - project_id=1, - region_id=1, + project_id=0, + region_id=0, ) diff --git a/tests/api_resources/security/test_profiles.py b/tests/api_resources/security/test_profiles.py index ae9ed3b3..429291ae 100644 --- a/tests/api_resources/security/test_profiles.py +++ b/tests/api_resources/security/test_profiles.py @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: fields=[ { "base_field": 1, - "field_value": {}, + "field_value": {"key": "bar"}, } ], profile_template=1, @@ -182,7 +182,7 @@ def test_method_recreate_with_all_params(self, client: Gcore) -> None: fields=[ { "base_field": 1, - "field_value": {}, + "field_value": {"key": "bar"}, } ], profile_template=1, @@ -235,7 +235,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: fields=[ { "base_field": 1, - "field_value": {}, + "field_value": {"key": "bar"}, } ], profile_template=1, @@ -292,7 +292,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> fields=[ { "base_field": 1, - "field_value": {}, + "field_value": {"key": "bar"}, } ], profile_template=1, @@ -440,7 +440,7 @@ async def test_method_recreate_with_all_params(self, async_client: AsyncGcore) - fields=[ { "base_field": 1, - "field_value": {}, + "field_value": {"key": "bar"}, } ], profile_template=1, @@ -493,7 +493,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> fields=[ { "base_field": 1, - "field_value": {}, + "field_value": {"key": "bar"}, } ], profile_template=1, diff --git a/tests/api_resources/storage/__init__.py b/tests/api_resources/storage/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/storage/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/storage/buckets/__init__.py b/tests/api_resources/storage/buckets/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/storage/buckets/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/storage/buckets/test_cors.py b/tests/api_resources/storage/buckets/test_cors.py new file mode 100644 index 00000000..737ec118 --- /dev/null +++ b/tests/api_resources/storage/buckets/test_cors.py @@ -0,0 +1,210 @@ +# 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.storage.buckets import StorageBucketCors + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCors: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + cor = client.storage.buckets.cors.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert cor is None + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + cor = client.storage.buckets.cors.create( + bucket_name="bucket_name", + storage_id=0, + allowed_origins=["string"], + ) + assert cor is None + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.storage.buckets.cors.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cor = response.parse() + assert cor is None + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.storage.buckets.cors.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cor = response.parse() + assert cor is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.cors.with_raw_response.create( + bucket_name="", + storage_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + cor = client.storage.buckets.cors.get( + bucket_name="bucket_name", + storage_id=0, + ) + assert_matches_type(StorageBucketCors, cor, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.storage.buckets.cors.with_raw_response.get( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cor = response.parse() + assert_matches_type(StorageBucketCors, cor, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.storage.buckets.cors.with_streaming_response.get( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cor = response.parse() + assert_matches_type(StorageBucketCors, cor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.cors.with_raw_response.get( + bucket_name="", + storage_id=0, + ) + + +class TestAsyncCors: + 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: + cor = await async_client.storage.buckets.cors.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert cor is None + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + cor = await async_client.storage.buckets.cors.create( + bucket_name="bucket_name", + storage_id=0, + allowed_origins=["string"], + ) + assert cor is None + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.buckets.cors.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cor = await response.parse() + assert cor is None + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.storage.buckets.cors.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cor = await response.parse() + assert cor is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.cors.with_raw_response.create( + bucket_name="", + storage_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + cor = await async_client.storage.buckets.cors.get( + bucket_name="bucket_name", + storage_id=0, + ) + assert_matches_type(StorageBucketCors, cor, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.buckets.cors.with_raw_response.get( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cor = await response.parse() + assert_matches_type(StorageBucketCors, cor, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.storage.buckets.cors.with_streaming_response.get( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cor = await response.parse() + assert_matches_type(StorageBucketCors, cor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.cors.with_raw_response.get( + bucket_name="", + storage_id=0, + ) diff --git a/tests/api_resources/storage/buckets/test_lifecycle.py b/tests/api_resources/storage/buckets/test_lifecycle.py new file mode 100644 index 00000000..8f88d86d --- /dev/null +++ b/tests/api_resources/storage/buckets/test_lifecycle.py @@ -0,0 +1,208 @@ +# 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 + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLifecycle: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + lifecycle = client.storage.buckets.lifecycle.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert lifecycle is None + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + lifecycle = client.storage.buckets.lifecycle.create( + bucket_name="bucket_name", + storage_id=0, + expiration_days=0, + ) + assert lifecycle is None + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.storage.buckets.lifecycle.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lifecycle = response.parse() + assert lifecycle is None + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.storage.buckets.lifecycle.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lifecycle = response.parse() + assert lifecycle is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.lifecycle.with_raw_response.create( + bucket_name="", + storage_id=0, + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + lifecycle = client.storage.buckets.lifecycle.delete( + bucket_name="bucket_name", + storage_id=0, + ) + assert lifecycle is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.storage.buckets.lifecycle.with_raw_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lifecycle = response.parse() + assert lifecycle is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.storage.buckets.lifecycle.with_streaming_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lifecycle = response.parse() + assert lifecycle is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.lifecycle.with_raw_response.delete( + bucket_name="", + storage_id=0, + ) + + +class TestAsyncLifecycle: + 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: + lifecycle = await async_client.storage.buckets.lifecycle.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert lifecycle is None + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + lifecycle = await async_client.storage.buckets.lifecycle.create( + bucket_name="bucket_name", + storage_id=0, + expiration_days=0, + ) + assert lifecycle is None + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.buckets.lifecycle.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lifecycle = await response.parse() + assert lifecycle is None + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.storage.buckets.lifecycle.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lifecycle = await response.parse() + assert lifecycle is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.lifecycle.with_raw_response.create( + bucket_name="", + storage_id=0, + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + lifecycle = await async_client.storage.buckets.lifecycle.delete( + bucket_name="bucket_name", + storage_id=0, + ) + assert lifecycle is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.buckets.lifecycle.with_raw_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lifecycle = await response.parse() + assert lifecycle is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.storage.buckets.lifecycle.with_streaming_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lifecycle = await response.parse() + assert lifecycle is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.lifecycle.with_raw_response.delete( + bucket_name="", + storage_id=0, + ) diff --git a/tests/api_resources/storage/buckets/test_policy.py b/tests/api_resources/storage/buckets/test_policy.py new file mode 100644 index 00000000..667d4ec6 --- /dev/null +++ b/tests/api_resources/storage/buckets/test_policy.py @@ -0,0 +1,276 @@ +# 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.storage.buckets import StorageBucketPolicy + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPolicy: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + policy = client.storage.buckets.policy.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert policy is None + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.storage.buckets.policy.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert policy is None + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.storage.buckets.policy.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert policy is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.policy.with_raw_response.create( + bucket_name="", + storage_id=0, + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + policy = client.storage.buckets.policy.delete( + bucket_name="bucket_name", + storage_id=0, + ) + assert policy is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.storage.buckets.policy.with_raw_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert policy is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.storage.buckets.policy.with_streaming_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert policy is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.policy.with_raw_response.delete( + bucket_name="", + storage_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + policy = client.storage.buckets.policy.get( + bucket_name="bucket_name", + storage_id=0, + ) + assert_matches_type(StorageBucketPolicy, policy, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.storage.buckets.policy.with_raw_response.get( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(StorageBucketPolicy, policy, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.storage.buckets.policy.with_streaming_response.get( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(StorageBucketPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.policy.with_raw_response.get( + bucket_name="", + storage_id=0, + ) + + +class TestAsyncPolicy: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + policy = await async_client.storage.buckets.policy.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert policy is None + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.buckets.policy.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert policy is None + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.storage.buckets.policy.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert policy is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.policy.with_raw_response.create( + bucket_name="", + storage_id=0, + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + policy = await async_client.storage.buckets.policy.delete( + bucket_name="bucket_name", + storage_id=0, + ) + assert policy is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.buckets.policy.with_raw_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert policy is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.storage.buckets.policy.with_streaming_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert policy is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.policy.with_raw_response.delete( + bucket_name="", + storage_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + policy = await async_client.storage.buckets.policy.get( + bucket_name="bucket_name", + storage_id=0, + ) + assert_matches_type(StorageBucketPolicy, policy, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.buckets.policy.with_raw_response.get( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(StorageBucketPolicy, policy, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.storage.buckets.policy.with_streaming_response.get( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(StorageBucketPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.policy.with_raw_response.get( + bucket_name="", + storage_id=0, + ) diff --git a/tests/api_resources/storage/test_buckets.py b/tests/api_resources/storage/test_buckets.py new file mode 100644 index 00000000..904e7818 --- /dev/null +++ b/tests/api_resources/storage/test_buckets.py @@ -0,0 +1,190 @@ +# 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 + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBuckets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + bucket = client.storage.buckets.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert bucket is None + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.storage.buckets.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bucket = response.parse() + assert bucket is None + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.storage.buckets.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bucket = response.parse() + assert bucket is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.with_raw_response.create( + bucket_name="", + storage_id=0, + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + bucket = client.storage.buckets.delete( + bucket_name="bucket_name", + storage_id=0, + ) + assert bucket is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.storage.buckets.with_raw_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bucket = response.parse() + assert bucket is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.storage.buckets.with_streaming_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bucket = response.parse() + assert bucket is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.with_raw_response.delete( + bucket_name="", + storage_id=0, + ) + + +class TestAsyncBuckets: + 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: + bucket = await async_client.storage.buckets.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert bucket is None + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.buckets.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bucket = await response.parse() + assert bucket is None + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.storage.buckets.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bucket = await response.parse() + assert bucket is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.with_raw_response.create( + bucket_name="", + storage_id=0, + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + bucket = await async_client.storage.buckets.delete( + bucket_name="bucket_name", + storage_id=0, + ) + assert bucket is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.buckets.with_raw_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bucket = await response.parse() + assert bucket is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.storage.buckets.with_streaming_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bucket = await response.parse() + assert bucket is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.with_raw_response.delete( + bucket_name="", + storage_id=0, + ) diff --git a/tests/api_resources/storage/test_credentials.py b/tests/api_resources/storage/test_credentials.py new file mode 100644 index 00000000..8f02e9d0 --- /dev/null +++ b/tests/api_resources/storage/test_credentials.py @@ -0,0 +1,110 @@ +# 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.storage import Storage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCredentials: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_recreate(self, client: Gcore) -> None: + credential = client.storage.credentials.recreate( + storage_id=0, + ) + assert_matches_type(Storage, credential, path=["response"]) + + @parametrize + def test_method_recreate_with_all_params(self, client: Gcore) -> None: + credential = client.storage.credentials.recreate( + storage_id=0, + delete_sftp_password=True, + generate_s3_keys=True, + generate_sftp_password=True, + reset_sftp_keys=True, + sftp_password="sftp_password", + ) + assert_matches_type(Storage, credential, path=["response"]) + + @parametrize + def test_raw_response_recreate(self, client: Gcore) -> None: + response = client.storage.credentials.with_raw_response.recreate( + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + credential = response.parse() + assert_matches_type(Storage, credential, path=["response"]) + + @parametrize + def test_streaming_response_recreate(self, client: Gcore) -> None: + with client.storage.credentials.with_streaming_response.recreate( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + credential = response.parse() + assert_matches_type(Storage, credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCredentials: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_recreate(self, async_client: AsyncGcore) -> None: + credential = await async_client.storage.credentials.recreate( + storage_id=0, + ) + assert_matches_type(Storage, credential, path=["response"]) + + @parametrize + async def test_method_recreate_with_all_params(self, async_client: AsyncGcore) -> None: + credential = await async_client.storage.credentials.recreate( + storage_id=0, + delete_sftp_password=True, + generate_s3_keys=True, + generate_sftp_password=True, + reset_sftp_keys=True, + sftp_password="sftp_password", + ) + assert_matches_type(Storage, credential, path=["response"]) + + @parametrize + async def test_raw_response_recreate(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.credentials.with_raw_response.recreate( + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + credential = await response.parse() + assert_matches_type(Storage, credential, path=["response"]) + + @parametrize + async def test_streaming_response_recreate(self, async_client: AsyncGcore) -> None: + async with async_client.storage.credentials.with_streaming_response.recreate( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + credential = await response.parse() + assert_matches_type(Storage, credential, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/storage/test_locations.py b/tests/api_resources/storage/test_locations.py new file mode 100644 index 00000000..bc4d0d8c --- /dev/null +++ b/tests/api_resources/storage/test_locations.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.storage import LocationListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLocations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + location = client.storage.locations.list() + assert_matches_type(LocationListResponse, location, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.storage.locations.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = response.parse() + assert_matches_type(LocationListResponse, location, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.storage.locations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = response.parse() + assert_matches_type(LocationListResponse, location, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncLocations: + 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: + location = await async_client.storage.locations.list() + assert_matches_type(LocationListResponse, location, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.locations.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + location = await response.parse() + assert_matches_type(LocationListResponse, location, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.storage.locations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + location = await response.parse() + assert_matches_type(LocationListResponse, location, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/storage/test_statistics.py b/tests/api_resources/storage/test_statistics.py new file mode 100644 index 00000000..3ab66324 --- /dev/null +++ b/tests/api_resources/storage/test_statistics.py @@ -0,0 +1,173 @@ +# 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.storage import ( + StorageUsageTotal, + StatisticGetUsageSeriesResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestStatistics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_usage_aggregated(self, client: Gcore) -> None: + statistic = client.storage.statistics.get_usage_aggregated() + assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + + @parametrize + def test_method_get_usage_aggregated_with_all_params(self, client: Gcore) -> None: + statistic = client.storage.statistics.get_usage_aggregated( + from_="2006-01-02", + locations=["s-ed1", "s-drc2", "s-sgc1"], + storages=["123-myStorage"], + to="2006-01-02", + ) + assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_usage_aggregated(self, client: Gcore) -> None: + response = client.storage.statistics.with_raw_response.get_usage_aggregated() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_usage_aggregated(self, client: Gcore) -> None: + with client.storage.statistics.with_streaming_response.get_usage_aggregated() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_usage_series(self, client: Gcore) -> None: + statistic = client.storage.statistics.get_usage_series() + assert_matches_type(StatisticGetUsageSeriesResponse, statistic, path=["response"]) + + @parametrize + def test_method_get_usage_series_with_all_params(self, client: Gcore) -> None: + statistic = client.storage.statistics.get_usage_series( + from_="2006-01-02", + granularity="12h", + locations=["s-ed1", "s-drc2", "s-sgc1"], + source=0, + storages=["123-myStorage"], + to="2006-01-02", + ts_string=True, + ) + assert_matches_type(StatisticGetUsageSeriesResponse, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_usage_series(self, client: Gcore) -> None: + response = client.storage.statistics.with_raw_response.get_usage_series() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(StatisticGetUsageSeriesResponse, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_usage_series(self, client: Gcore) -> None: + with client.storage.statistics.with_streaming_response.get_usage_series() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(StatisticGetUsageSeriesResponse, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncStatistics: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get_usage_aggregated(self, async_client: AsyncGcore) -> None: + statistic = await async_client.storage.statistics.get_usage_aggregated() + assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + + @parametrize + async def test_method_get_usage_aggregated_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.storage.statistics.get_usage_aggregated( + from_="2006-01-02", + locations=["s-ed1", "s-drc2", "s-sgc1"], + storages=["123-myStorage"], + to="2006-01-02", + ) + assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_usage_aggregated(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.statistics.with_raw_response.get_usage_aggregated() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_usage_aggregated(self, async_client: AsyncGcore) -> None: + async with async_client.storage.statistics.with_streaming_response.get_usage_aggregated() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_usage_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.storage.statistics.get_usage_series() + assert_matches_type(StatisticGetUsageSeriesResponse, statistic, path=["response"]) + + @parametrize + async def test_method_get_usage_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.storage.statistics.get_usage_series( + from_="2006-01-02", + granularity="12h", + locations=["s-ed1", "s-drc2", "s-sgc1"], + source=0, + storages=["123-myStorage"], + to="2006-01-02", + ts_string=True, + ) + assert_matches_type(StatisticGetUsageSeriesResponse, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_usage_series(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.statistics.with_raw_response.get_usage_series() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(StatisticGetUsageSeriesResponse, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_usage_series(self, async_client: AsyncGcore) -> None: + async with async_client.storage.statistics.with_streaming_response.get_usage_series() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(StatisticGetUsageSeriesResponse, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_statistics.py b/tests/api_resources/streaming/test_statistics.py index bae1314e..72546277 100644 --- a/tests/api_resources/streaming/test_statistics.py +++ b/tests/api_resources/streaming/test_statistics.py @@ -12,6 +12,7 @@ from gcore.types.streaming import ( Views, Ffprobes, + MeetSeries, StreamSeries, ViewsHeatmap, PopularVideos, @@ -250,6 +251,49 @@ def test_streaming_response_get_max_streams_series(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_get_meet_series(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_meet_series( + from_="from", + to="to", + ) + assert_matches_type(MeetSeries, statistic, path=["response"]) + + @parametrize + def test_method_get_meet_series_with_all_params(self, client: Gcore) -> None: + statistic = client.streaming.statistics.get_meet_series( + from_="from", + to="to", + granularity="1m", + ) + assert_matches_type(MeetSeries, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_meet_series(self, client: Gcore) -> None: + response = client.streaming.statistics.with_raw_response.get_meet_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(MeetSeries, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_meet_series(self, client: Gcore) -> None: + with client.streaming.statistics.with_streaming_response.get_meet_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(MeetSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_get_popular_videos(self, client: Gcore) -> None: statistic = client.streaming.statistics.get_popular_videos( @@ -1165,6 +1209,49 @@ async def test_streaming_response_get_max_streams_series(self, async_client: Asy assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_get_meet_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_meet_series( + from_="from", + to="to", + ) + assert_matches_type(MeetSeries, statistic, path=["response"]) + + @parametrize + async def test_method_get_meet_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.streaming.statistics.get_meet_series( + from_="from", + to="to", + granularity="1m", + ) + assert_matches_type(MeetSeries, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_meet_series(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.statistics.with_raw_response.get_meet_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(MeetSeries, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_meet_series(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.statistics.with_streaming_response.get_meet_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(MeetSeries, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_get_popular_videos(self, async_client: AsyncGcore) -> None: statistic = await async_client.streaming.statistics.get_popular_videos( diff --git a/tests/api_resources/streaming/test_streams.py b/tests/api_resources/streaming/test_streams.py index dfe61205..324be334 100644 --- a/tests/api_resources/streaming/test_streams.py +++ b/tests/api_resources/streaming/test_streams.py @@ -45,6 +45,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: dvr_enabled=True, hls_mpegts_endlist_tag=True, html_overlay=False, + low_latency_enabled=True, projection="regular", pull=True, quality_set_id=0, @@ -100,6 +101,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "dvr_enabled": True, "hls_mpegts_endlist_tag": True, "html_overlay": False, + "low_latency_enabled": True, "projection": "regular", "pull": True, "quality_set_id": 0, @@ -424,6 +426,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> dvr_enabled=True, hls_mpegts_endlist_tag=True, html_overlay=False, + low_latency_enabled=True, projection="regular", pull=True, quality_set_id=0, @@ -479,6 +482,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "dvr_enabled": True, "hls_mpegts_endlist_tag": True, "html_overlay": False, + "low_latency_enabled": True, "projection": "regular", "pull": True, "quality_set_id": 0, diff --git a/tests/api_resources/test_storage.py b/tests/api_resources/test_storage.py new file mode 100644 index 00000000..c2e1b409 --- /dev/null +++ b/tests/api_resources/test_storage.py @@ -0,0 +1,442 @@ +# 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.storage import Storage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestStorage: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Gcore) -> None: + storage = client.storage.update( + storage_id=0, + ) + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + storage = client.storage.update( + storage_id=0, + expires="expires", + server_alias="server_alias", + ) + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.storage.with_raw_response.update( + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = response.parse() + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.storage.with_streaming_response.update( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = response.parse() + assert_matches_type(Storage, storage, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + storage = client.storage.delete( + 0, + ) + assert storage is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.storage.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = response.parse() + assert storage is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.storage.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = response.parse() + assert storage is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + storage = client.storage.get( + 0, + ) + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.storage.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = response.parse() + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.storage.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = response.parse() + assert_matches_type(Storage, storage, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_link_ssh_key(self, client: Gcore) -> None: + storage = client.storage.link_ssh_key( + key_id=0, + storage_id=0, + ) + assert storage is None + + @parametrize + def test_raw_response_link_ssh_key(self, client: Gcore) -> None: + response = client.storage.with_raw_response.link_ssh_key( + key_id=0, + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = response.parse() + assert storage is None + + @parametrize + def test_streaming_response_link_ssh_key(self, client: Gcore) -> None: + with client.storage.with_streaming_response.link_ssh_key( + key_id=0, + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = response.parse() + assert storage is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_restore(self, client: Gcore) -> None: + storage = client.storage.restore( + storage_id=0, + ) + assert storage is None + + @parametrize + def test_method_restore_with_all_params(self, client: Gcore) -> None: + storage = client.storage.restore( + storage_id=0, + client_id=0, + ) + assert storage is None + + @parametrize + def test_raw_response_restore(self, client: Gcore) -> None: + response = client.storage.with_raw_response.restore( + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = response.parse() + assert storage is None + + @parametrize + def test_streaming_response_restore(self, client: Gcore) -> None: + with client.storage.with_streaming_response.restore( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = response.parse() + assert storage is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_unlink_ssh_key(self, client: Gcore) -> None: + storage = client.storage.unlink_ssh_key( + key_id=0, + storage_id=0, + ) + assert storage is None + + @parametrize + def test_raw_response_unlink_ssh_key(self, client: Gcore) -> None: + response = client.storage.with_raw_response.unlink_ssh_key( + key_id=0, + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = response.parse() + assert storage is None + + @parametrize + def test_streaming_response_unlink_ssh_key(self, client: Gcore) -> None: + with client.storage.with_streaming_response.unlink_ssh_key( + key_id=0, + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = response.parse() + assert storage is None + + assert cast(Any, response.is_closed) is True + + +class TestAsyncStorage: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + storage = await async_client.storage.update( + storage_id=0, + ) + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + storage = await async_client.storage.update( + storage_id=0, + expires="expires", + server_alias="server_alias", + ) + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.with_raw_response.update( + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = await response.parse() + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.storage.with_streaming_response.update( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert_matches_type(Storage, storage, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + storage = await async_client.storage.delete( + 0, + ) + assert storage is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = await response.parse() + assert storage is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.storage.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert storage is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + storage = await async_client.storage.get( + 0, + ) + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = await response.parse() + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.storage.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert_matches_type(Storage, storage, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_link_ssh_key(self, async_client: AsyncGcore) -> None: + storage = await async_client.storage.link_ssh_key( + key_id=0, + storage_id=0, + ) + assert storage is None + + @parametrize + async def test_raw_response_link_ssh_key(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.with_raw_response.link_ssh_key( + key_id=0, + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = await response.parse() + assert storage is None + + @parametrize + async def test_streaming_response_link_ssh_key(self, async_client: AsyncGcore) -> None: + async with async_client.storage.with_streaming_response.link_ssh_key( + key_id=0, + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert storage is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_restore(self, async_client: AsyncGcore) -> None: + storage = await async_client.storage.restore( + storage_id=0, + ) + assert storage is None + + @parametrize + async def test_method_restore_with_all_params(self, async_client: AsyncGcore) -> None: + storage = await async_client.storage.restore( + storage_id=0, + client_id=0, + ) + assert storage is None + + @parametrize + async def test_raw_response_restore(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.with_raw_response.restore( + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = await response.parse() + assert storage is None + + @parametrize + async def test_streaming_response_restore(self, async_client: AsyncGcore) -> None: + async with async_client.storage.with_streaming_response.restore( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert storage is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_unlink_ssh_key(self, async_client: AsyncGcore) -> None: + storage = await async_client.storage.unlink_ssh_key( + key_id=0, + storage_id=0, + ) + assert storage is None + + @parametrize + async def test_raw_response_unlink_ssh_key(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.with_raw_response.unlink_ssh_key( + key_id=0, + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = await response.parse() + assert storage is None + + @parametrize + async def test_streaming_response_unlink_ssh_key(self, async_client: AsyncGcore) -> None: + async with async_client.storage.with_streaming_response.unlink_ssh_key( + key_id=0, + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert storage is None + + assert cast(Any, response.is_closed) is True From a694aa2515261526437dd3ed4806e2e03c13ca66 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 5 Sep 2025 13:56:47 +0000 Subject: [PATCH 286/592] feat(api): manual upload of aggregated API specs --- .stats.yml | 6 +- api.md | 17 +- src/gcore/_client.py | 10 +- src/gcore/resources/cloud/audit_logs.py | 8 +- .../resources/cloud/baremetal/flavors.py | 8 +- src/gcore/resources/cloud/baremetal/images.py | 8 +- .../resources/cloud/baremetal/servers.py | 36 ++- .../resources/cloud/billing_reservations.py | 16 +- src/gcore/resources/cloud/cost_reports.py | 24 +- .../cloud/file_shares/access_rules.py | 24 +- .../cloud/file_shares/file_shares.py | 48 ++- src/gcore/resources/cloud/floating_ips.py | 48 ++- .../cloud/gpu_baremetal_clusters/flavors.py | 8 +- .../gpu_baremetal_clusters.py | 64 +++- .../cloud/gpu_baremetal_clusters/images.py | 32 +- .../gpu_baremetal_clusters/interfaces.py | 8 +- .../cloud/gpu_baremetal_clusters/servers.py | 56 +++- .../resources/cloud/inference/api_keys.py | 40 ++- .../inference/applications/deployments.py | 40 ++- .../cloud/inference/applications/templates.py | 16 +- .../inference/deployments/deployments.py | 64 +++- .../cloud/inference/deployments/logs.py | 8 +- .../resources/cloud/inference/flavors.py | 16 +- .../resources/cloud/inference/inference.py | 8 +- .../cloud/inference/registry_credentials.py | 40 ++- .../resources/cloud/inference/secrets.py | 40 ++- .../resources/cloud/instances/flavors.py | 8 +- src/gcore/resources/cloud/instances/images.py | 48 ++- .../resources/cloud/instances/instances.py | 112 +++++-- .../resources/cloud/instances/interfaces.py | 24 +- .../resources/cloud/instances/metrics.py | 8 +- src/gcore/resources/cloud/ip_ranges.py | 8 +- .../resources/cloud/k8s/clusters/clusters.py | 72 +++-- .../resources/cloud/k8s/clusters/nodes.py | 16 +- .../cloud/k8s/clusters/pools/nodes.py | 16 +- .../cloud/k8s/clusters/pools/pools.py | 48 ++- src/gcore/resources/cloud/k8s/flavors.py | 8 +- src/gcore/resources/cloud/k8s/k8s.py | 8 +- .../resources/cloud/load_balancers/flavors.py | 8 +- .../load_balancers/l7_policies/l7_policies.py | 40 ++- .../cloud/load_balancers/l7_policies/rules.py | 40 ++- .../cloud/load_balancers/listeners.py | 40 ++- .../cloud/load_balancers/load_balancers.py | 56 +++- .../resources/cloud/load_balancers/metrics.py | 8 +- .../load_balancers/pools/health_monitors.py | 16 +- .../cloud/load_balancers/pools/members.py | 16 +- .../cloud/load_balancers/pools/pools.py | 40 ++- .../cloud/load_balancers/statuses.py | 16 +- .../resources/cloud/networks/networks.py | 40 ++- src/gcore/resources/cloud/networks/routers.py | 56 +++- src/gcore/resources/cloud/networks/subnets.py | 40 ++- src/gcore/resources/cloud/placement_groups.py | 32 +- src/gcore/resources/cloud/projects.py | 32 +- src/gcore/resources/cloud/quotas/quotas.py | 24 +- src/gcore/resources/cloud/quotas/requests.py | 32 +- src/gcore/resources/cloud/regions.py | 12 +- .../resources/cloud/registries/artifacts.py | 16 +- .../resources/cloud/registries/registries.py | 40 ++- .../cloud/registries/repositories.py | 16 +- src/gcore/resources/cloud/registries/tags.py | 8 +- src/gcore/resources/cloud/registries/users.py | 48 ++- .../reserved_fixed_ips/reserved_fixed_ips.py | 32 +- .../resources/cloud/reserved_fixed_ips/vip.py | 40 ++- src/gcore/resources/cloud/secrets.py | 32 +- .../resources/cloud/security_groups/rules.py | 24 +- .../cloud/security_groups/security_groups.py | 56 +++- src/gcore/resources/cloud/ssh_keys.py | 40 ++- src/gcore/resources/cloud/tasks.py | 28 +- src/gcore/resources/cloud/usage_reports.py | 8 +- .../resources/cloud/users/role_assignments.py | 32 +- src/gcore/resources/cloud/volumes.py | 80 +++-- src/gcore/resources/dns/dns.py | 12 +- src/gcore/resources/dns/locations.py | 28 +- src/gcore/resources/dns/metrics.py | 8 +- src/gcore/resources/dns/pickers/pickers.py | 4 +- src/gcore/resources/dns/pickers/presets.py | 8 +- src/gcore/resources/dns/zones/dnssec.py | 16 +- src/gcore/resources/dns/zones/rrsets.py | 48 ++- src/gcore/resources/dns/zones/zones.py | 80 +++-- src/gcore/resources/fastedge/apps/apps.py | 40 ++- src/gcore/resources/fastedge/apps/logs.py | 8 +- src/gcore/resources/fastedge/binaries.py | 32 +- src/gcore/resources/fastedge/fastedge.py | 4 +- src/gcore/resources/fastedge/kv_stores.py | 32 +- src/gcore/resources/fastedge/secrets.py | 48 ++- src/gcore/resources/fastedge/statistics.py | 16 +- src/gcore/resources/fastedge/templates.py | 40 ++- src/gcore/resources/iam/api_tokens.py | 32 +- src/gcore/resources/iam/iam.py | 4 +- src/gcore/resources/iam/users.py | 36 ++- src/gcore/resources/security/bgp_announces.py | 16 +- src/gcore/resources/security/events.py | 8 +- .../resources/security/profile_templates.py | 8 +- src/gcore/resources/security/profiles.py | 48 ++- .../resources/storage/buckets/buckets.py | 146 ++++++++- src/gcore/resources/storage/buckets/cors.py | 20 +- .../resources/storage/buckets/lifecycle.py | 44 ++- src/gcore/resources/storage/buckets/policy.py | 64 ++-- src/gcore/resources/storage/credentials.py | 36 ++- src/gcore/resources/storage/locations.py | 36 ++- src/gcore/resources/storage/statistics.py | 16 +- src/gcore/resources/storage/storage.py | 305 +++++++++++++++++- src/gcore/resources/streaming/ai_tasks.py | 72 ++--- src/gcore/resources/streaming/broadcasts.py | 48 ++- src/gcore/resources/streaming/directories.py | 40 ++- src/gcore/resources/streaming/players.py | 40 ++- src/gcore/resources/streaming/playlists.py | 48 ++- src/gcore/resources/streaming/quality_sets.py | 20 +- src/gcore/resources/streaming/restreams.py | 40 ++- src/gcore/resources/streaming/statistics.py | 302 ++++++++--------- .../resources/streaming/streams/overlays.py | 56 +++- .../resources/streaming/streams/streams.py | 138 ++++---- .../resources/streaming/videos/subtitles.py | 48 ++- .../resources/streaming/videos/videos.py | 72 +++-- src/gcore/resources/waap/advanced_rules.py | 8 +- src/gcore/resources/waap/custom_page_sets.py | 48 ++- .../resources/waap/domains/advanced_rules.py | 48 ++- .../resources/waap/domains/api_discovery.py | 48 ++- .../resources/waap/domains/api_path_groups.py | 8 +- src/gcore/resources/waap/domains/api_paths.py | 40 ++- .../resources/waap/domains/custom_rules.py | 56 +++- src/gcore/resources/waap/domains/domains.py | 44 ++- .../resources/waap/domains/firewall_rules.py | 56 +++- .../waap/domains/insight_silences.py | 40 ++- src/gcore/resources/waap/domains/insights.py | 24 +- src/gcore/resources/waap/domains/settings.py | 16 +- .../resources/waap/domains/statistics.py | 48 ++- src/gcore/resources/waap/insights.py | 8 +- src/gcore/resources/waap/ip_info/ip_info.py | 64 +++- src/gcore/resources/waap/ip_info/metrics.py | 8 +- src/gcore/resources/waap/organizations.py | 8 +- src/gcore/resources/waap/statistics.py | 8 +- src/gcore/resources/waap/tags.py | 4 +- src/gcore/resources/waap/waap.py | 4 +- .../cloud/baremetal/server_rebuild_params.py | 2 + .../dns/dns_get_account_overview_response.py | 24 +- src/gcore/types/dns/zone_get_response.py | 4 +- src/gcore/types/dns/zone_list_response.py | 2 + src/gcore/types/security/client_profile.py | 4 +- .../types/security/profile_create_params.py | 4 +- .../types/security/profile_recreate_params.py | 4 +- .../types/security/profile_replace_params.py | 4 +- src/gcore/types/storage/__init__.py | 3 + src/gcore/types/storage/bucket_list_params.py | 15 + src/gcore/types/storage/buckets/__init__.py | 1 + .../storage/buckets/cor_create_params.py | 1 + .../buckets/lifecycle_create_params.py | 5 + .../storage/buckets/policy_get_response.py | 7 + .../storage/buckets/storage_bucket_cors.py | 13 +- .../storage/buckets/storage_bucket_policy.py | 10 +- .../storage/credential_recreate_params.py | 17 + src/gcore/types/storage/storage.py | 67 +++- src/gcore/types/storage/storage_bucket.py | 15 + .../types/storage/storage_list_params.py | 39 +++ src/gcore/types/storage/storage_location.py | 12 +- .../types/storage/storage_update_params.py | 5 + src/gcore/types/streaming/__init__.py | 4 - .../streaming/ai_contentmoderation_casm.py | 39 --- .../ai_contentmoderation_hardnudity.py | 2 +- .../streaming/ai_contentmoderation_nsfw.py | 2 +- .../ai_contentmoderation_softnudity.py | 2 +- .../streaming/ai_contentmoderation_sport.py | 2 +- .../streaming/ai_contentmoderation_weapon.py | 39 --- src/gcore/types/streaming/ai_task.py | 6 +- .../types/streaming/ai_task_create_params.py | 4 +- .../types/streaming/ai_task_get_response.py | 46 --- .../types/streaming/create_video_param.py | 4 +- src/gcore/types/streaming/meet_series.py | 23 -- src/gcore/types/streaming/playlist_video.py | 4 +- .../statistic_get_meet_series_params.py | 20 -- src/gcore/types/streaming/stream.py | 125 ++++--- .../types/streaming/stream_create_params.py | 30 +- .../types/streaming/stream_update_params.py | 30 +- src/gcore/types/streaming/video.py | 52 ++- .../types/streaming/video_update_params.py | 4 +- .../waap/domains/waap_request_details.py | 3 +- .../cloud/baremetal/test_servers.py | 56 ++-- tests/api_resources/security/test_profiles.py | 12 +- .../storage/buckets/test_cors.py | 4 +- .../storage/buckets/test_lifecycle.py | 4 +- .../storage/buckets/test_policy.py | 14 +- tests/api_resources/storage/test_buckets.py | 83 +++++ .../api_resources/storage/test_credentials.py | 12 +- tests/api_resources/storage/test_locations.py | 38 ++- .../streaming/test_statistics.py | 87 ----- tests/api_resources/streaming/test_streams.py | 4 - tests/api_resources/test_storage.py | 141 +++++++- 187 files changed, 4208 insertions(+), 1818 deletions(-) create mode 100644 src/gcore/types/storage/bucket_list_params.py create mode 100644 src/gcore/types/storage/buckets/policy_get_response.py create mode 100644 src/gcore/types/storage/storage_bucket.py create mode 100644 src/gcore/types/storage/storage_list_params.py delete mode 100644 src/gcore/types/streaming/ai_contentmoderation_casm.py delete mode 100644 src/gcore/types/streaming/ai_contentmoderation_weapon.py delete mode 100644 src/gcore/types/streaming/meet_series.py delete mode 100644 src/gcore/types/streaming/statistic_get_meet_series_params.py diff --git a/.stats.yml b/.stats.yml index 7d1db259..21de9121 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 521 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-664d36cf113c38753b432dbec7550105ddae608da5e88b856b9ae69cf704369a.yml -openapi_spec_hash: fb2f2a05368ea82cba2d937eac0a5e8e +configured_endpoints: 523 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-efd5495399fc306a35e490c3872afae6e9d9bcb61eec361fc0ef035e5e42af8b.yml +openapi_spec_hash: ccb1fb7d018b724fd61c3afc68fcd7a5 config_hash: 296feeb9e44105df95628b9989e56273 diff --git a/api.md b/api.md index f87e79df..8892a0ea 100644 --- a/api.md +++ b/api.md @@ -1512,12 +1512,10 @@ Types: ```python from gcore.types.streaming import ( - AIContentmoderationCasm, AIContentmoderationHardnudity, AIContentmoderationNsfw, AIContentmoderationSoftnudity, AIContentmoderationSport, - AIContentmoderationWeapon, AITask, AITaskCreateResponse, AITaskCancelResponse, @@ -1740,7 +1738,6 @@ Types: from gcore.types.streaming import ( Ffprobes, MaxStreamSeries, - MeetSeries, PopularVideos, StorageSeries, StreamSeries, @@ -1768,7 +1765,6 @@ Methods: - client.streaming.statistics.get_live_watch_time_cdn(\*\*params) -> StreamSeries - client.streaming.statistics.get_live_watch_time_total_cdn(\*\*params) -> VodTotalStreamDurationSeries - client.streaming.statistics.get_max_streams_series(\*\*params) -> MaxStreamSeries -- client.streaming.statistics.get_meet_series(\*\*params) -> MeetSeries - client.streaming.statistics.get_popular_videos(\*\*params) -> PopularVideos - client.streaming.statistics.get_storage_series(\*\*params) -> StorageSeries - client.streaming.statistics.get_stream_series(\*\*params) -> StreamSeries @@ -1990,7 +1986,9 @@ from gcore.types.storage import Storage Methods: +- client.storage.create() -> Storage - client.storage.update(storage_id, \*\*params) -> Storage +- client.storage.list(\*\*params) -> SyncOffsetPage[Storage] - client.storage.delete(storage_id) -> None - client.storage.get(storage_id) -> Storage - client.storage.link_ssh_key(key_id, \*, storage_id) -> None @@ -2034,9 +2032,16 @@ Methods: ## Buckets +Types: + +```python +from gcore.types.storage import StorageBucket +``` + Methods: - client.storage.buckets.create(bucket_name, \*, storage_id) -> None +- client.storage.buckets.list(storage_id, \*\*params) -> SyncOffsetPage[StorageBucket] - client.storage.buckets.delete(bucket_name, \*, storage_id) -> None ### Cors @@ -2064,11 +2069,11 @@ Methods: Types: ```python -from gcore.types.storage.buckets import StorageBucketPolicy +from gcore.types.storage.buckets import StorageBucketPolicy, PolicyGetResponse ``` Methods: - client.storage.buckets.policy.create(bucket_name, \*, storage_id) -> None - client.storage.buckets.policy.delete(bucket_name, \*, storage_id) -> None -- client.storage.buckets.policy.get(bucket_name, \*, storage_id) -> StorageBucketPolicy +- client.storage.buckets.policy.get(bucket_name, \*, storage_id) -> PolicyGetResponse diff --git a/src/gcore/_client.py b/src/gcore/_client.py index fb66fd59..94bb9d2b 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -113,6 +113,7 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") + self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -197,7 +198,7 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( + client = self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -210,6 +211,8 @@ def copy( default_query=params, **_extra_kwargs, ) + client._base_url_overridden = self._base_url_overridden or base_url is not None + return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) @@ -340,6 +343,7 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") + self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -424,7 +428,7 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( + client = self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -437,6 +441,8 @@ def copy( default_query=params, **_extra_kwargs, ) + client._base_url_overridden = self._base_url_overridden or base_url is not None + return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index 1dad329f..1f4ae40e 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -206,7 +206,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions", + "/cloud/v1/user_actions" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/user_actions", page=SyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, @@ -415,7 +417,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions", + "/cloud/v1/user_actions" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/user_actions", page=AsyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 1645b30b..91474de4 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -93,7 +93,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -187,7 +189,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index a6a22954..ecc0adc3 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -90,7 +90,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -178,7 +180,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index feb1aa95..86bbf8ce 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -156,7 +156,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -294,7 +296,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", page=SyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -350,6 +354,12 @@ def rebuild( Rebuild a bare metal server with a new image while preserving its configuration. Args: + project_id: Project ID + + region_id: Region ID + + server_id: Server ID + image_id: Image ID user_data: String in base64 format. Must not be passed together with 'username' or @@ -371,7 +381,9 @@ def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=maybe_transform( { "image_id": image_id, @@ -515,7 +527,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -653,7 +667,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", page=AsyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -709,6 +725,12 @@ async def rebuild( Rebuild a bare metal server with a new image while preserving its configuration. Args: + project_id: Project ID + + region_id: Region ID + + server_id: Server ID + image_id: Image ID user_data: String in base64 format. Must not be passed together with 'username' or @@ -730,7 +752,9 @@ async def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=await async_maybe_transform( { "image_id": image_id, diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index 0d9df747..ae49d667 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -120,7 +120,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations", + "/cloud/v1/reservations" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservations", page=SyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,7 +280,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations", + "/cloud/v1/reservations" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservations", page=AsyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -330,7 +336,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 36075dd6..910b8fa7 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -146,7 +146,9 @@ def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/totals", body=maybe_transform( { "time_from": time_from, @@ -255,7 +257,9 @@ def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", body=maybe_transform( { "regions": regions, @@ -381,7 +385,9 @@ def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/resources", body=maybe_transform( { "time_from": time_from, @@ -522,7 +528,9 @@ async def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/totals", body=await async_maybe_transform( { "time_from": time_from, @@ -631,7 +639,9 @@ async def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", body=await async_maybe_transform( { "regions": regions, @@ -757,7 +767,9 @@ async def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/resources", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index 21ba3f40..5efd03fb 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -88,7 +88,9 @@ def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=maybe_transform( { "access_mode": access_mode, @@ -140,7 +142,9 @@ def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,7 +195,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -263,7 +269,9 @@ async def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=await async_maybe_transform( { "access_mode": access_mode, @@ -315,7 +323,9 @@ async def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -366,7 +376,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 71c1c9d8..bf7e7b62 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -206,7 +206,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -289,7 +291,9 @@ def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=maybe_transform( { "name": name, @@ -349,7 +353,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", page=SyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -407,7 +413,9 @@ def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -452,7 +460,9 @@ def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -500,7 +510,9 @@ def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -675,7 +687,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -758,7 +772,9 @@ async def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=await async_maybe_transform( { "name": name, @@ -818,7 +834,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", page=AsyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -876,7 +894,9 @@ async def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -921,7 +941,9 @@ async def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -969,7 +991,9 @@ async def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=await async_maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 2815f3cb..9362d7cc 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -94,7 +94,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", body=maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -155,7 +157,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", page=SyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -207,7 +211,9 @@ def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -252,7 +258,9 @@ def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=maybe_transform( { "port_id": port_id, @@ -298,7 +306,9 @@ def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -337,7 +347,9 @@ def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -413,7 +425,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", body=await async_maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -474,7 +488,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", page=AsyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -526,7 +542,9 @@ async def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -571,7 +589,9 @@ async def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=await async_maybe_transform( { "port_id": port_id, @@ -617,7 +637,9 @@ async def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -656,7 +678,9 @@ async def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index 2c4563b5..6d594b3b 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -80,7 +80,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -157,7 +159,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 67bcd343..99c7b1ee 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -156,7 +156,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=maybe_transform( { "flavor": flavor, @@ -220,7 +222,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=SyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -287,7 +291,9 @@ def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -343,7 +349,9 @@ def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,7 +390,9 @@ def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -421,7 +431,9 @@ def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,7 +485,9 @@ def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=maybe_transform( { "nodes": nodes, @@ -525,7 +539,9 @@ def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, @@ -628,7 +644,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=await async_maybe_transform( { "flavor": flavor, @@ -692,7 +710,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=AsyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -759,7 +779,9 @@ async def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -815,7 +837,9 @@ async def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -854,7 +878,9 @@ async def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -893,7 +919,9 @@ async def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -945,7 +973,9 @@ async def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=await async_maybe_transform( { "nodes": nodes, @@ -997,7 +1027,9 @@ async def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=await async_maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 8c2d4623..249c8d3f 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -79,7 +79,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -124,7 +126,9 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -169,7 +173,9 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +250,9 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=maybe_transform( { "name": name, @@ -320,7 +328,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -365,7 +375,9 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -410,7 +422,9 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,7 +499,9 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index 863ffde8..ad75df3e 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -71,7 +71,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -131,7 +133,9 @@ async def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 138889a4..11af8877 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -99,7 +99,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=SyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -158,7 +160,9 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -393,7 +397,9 @@ def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -452,7 +458,9 @@ def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -498,7 +506,9 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -537,7 +547,9 @@ def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -576,7 +588,9 @@ def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -650,7 +664,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=AsyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -709,7 +725,9 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -946,7 +964,9 @@ async def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -1005,7 +1025,9 @@ async def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, @@ -1051,7 +1073,9 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1090,7 +1114,9 @@ async def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1129,7 +1155,9 @@ async def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py index 98238c19..f9f5ccb9 100644 --- a/src/gcore/resources/cloud/inference/api_keys.py +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -84,7 +84,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", body=maybe_transform( { "name": name, @@ -135,7 +137,9 @@ def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -178,7 +182,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", page=SyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -233,7 +239,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,7 +281,9 @@ def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -340,7 +350,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", body=await async_maybe_transform( { "name": name, @@ -391,7 +403,9 @@ async def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=await async_maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -434,7 +448,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", page=AsyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -489,7 +505,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,7 +547,9 @@ async def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index 845bffce..43b6893f 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -93,7 +93,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", body=maybe_transform( { "application_name": application_name, @@ -140,7 +142,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,7 +186,9 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,7 +232,9 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -280,7 +288,9 @@ def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -362,7 +372,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", body=await async_maybe_transform( { "application_name": application_name, @@ -409,7 +421,9 @@ async def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -451,7 +465,9 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -495,7 +511,9 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -549,7 +567,9 @@ async def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, diff --git a/src/gcore/resources/cloud/inference/applications/templates.py b/src/gcore/resources/cloud/inference/applications/templates.py index 1c475cb8..664203be 100644 --- a/src/gcore/resources/cloud/inference/applications/templates.py +++ b/src/gcore/resources/cloud/inference/applications/templates.py @@ -58,7 +58,9 @@ def list( required to create a fully functional application deployment. """ return self._get( - "/cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -97,7 +99,9 @@ def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -143,7 +147,9 @@ async def list( required to create a fully functional application deployment. """ return await self._get( - "/cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,7 +188,9 @@ async def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return await self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 3a4e4629..0cccc581 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -147,7 +147,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", body=maybe_transform( { "containers": containers, @@ -263,7 +265,9 @@ def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -325,7 +329,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", page=SyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -376,7 +382,9 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -416,7 +424,9 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -457,7 +467,9 @@ def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -505,7 +517,9 @@ def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -553,7 +567,9 @@ def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -673,7 +689,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", body=await async_maybe_transform( { "containers": containers, @@ -789,7 +807,9 @@ async def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, @@ -851,7 +871,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", page=AsyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -902,7 +924,9 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -942,7 +966,9 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -983,7 +1009,9 @@ async def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1031,7 +1059,9 @@ async def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1079,7 +1109,9 @@ async def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index 1cc65006..2ee0666e 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -91,7 +91,9 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=SyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, @@ -178,7 +180,9 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=AsyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index d273b19b..8dcc3e62 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -73,7 +73,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/flavors", page=SyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -119,7 +121,9 @@ def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return self._get( - f"/cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -178,7 +182,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/flavors", page=AsyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -224,7 +230,9 @@ async def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return await self._get( - f"/cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index 103c70f1..b116b08f 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -123,7 +123,9 @@ def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return self._get( - "/cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +189,9 @@ async def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return await self._get( - "/cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 6dd78f70..9d5a4072 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -86,7 +86,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", body=maybe_transform( { "name": name, @@ -137,7 +139,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", page=SyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -189,7 +193,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -229,7 +235,9 @@ def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -278,7 +286,9 @@ def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=maybe_transform( { "password": password, @@ -354,7 +364,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", body=await async_maybe_transform( { "name": name, @@ -405,7 +417,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", page=AsyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -457,7 +471,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,7 +513,9 @@ async def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -546,7 +564,9 @@ async def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=await async_maybe_transform( { "password": password, diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index 275ec3f2..ed312faa 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -79,7 +79,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", body=maybe_transform( { "data": data, @@ -130,7 +132,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", page=SyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -182,7 +186,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -222,7 +228,9 @@ def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -268,7 +276,9 @@ def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", body=maybe_transform( { "data": data, @@ -340,7 +350,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", body=await async_maybe_transform( { "data": data, @@ -391,7 +403,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", page=AsyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -443,7 +457,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -483,7 +499,9 @@ async def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,7 +547,9 @@ async def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", body=await async_maybe_transform( { "data": data, diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 9bd7f38f..3bf61d85 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -85,7 +85,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -169,7 +171,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index af8e82a7..b45fd614 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -110,7 +110,9 @@ def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", body=maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -176,7 +178,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -230,7 +234,9 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -302,7 +308,9 @@ def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -359,7 +367,9 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -442,7 +452,9 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -544,7 +556,9 @@ async def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", body=await async_maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -610,7 +624,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -664,7 +680,9 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -736,7 +754,9 @@ async def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -793,7 +813,9 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -876,7 +898,9 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 77fbc20b..dde03b4b 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -228,7 +228,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -295,7 +297,9 @@ def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -444,7 +448,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", page=SyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -538,7 +544,9 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -647,7 +655,9 @@ def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=maybe_transform( { "action": action, @@ -698,7 +708,9 @@ def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -751,7 +763,9 @@ def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=maybe_transform( { "name": name, @@ -797,7 +811,9 @@ def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -836,7 +852,9 @@ def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -890,7 +908,9 @@ def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -932,7 +952,9 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -979,7 +1001,9 @@ def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1021,7 +1045,9 @@ def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1071,7 +1097,9 @@ def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=maybe_transform( { "name": name, @@ -1242,7 +1270,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -1309,7 +1339,9 @@ async def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1458,7 +1490,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", page=AsyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -1552,7 +1586,9 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1661,7 +1697,9 @@ async def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=await async_maybe_transform( { "action": action, @@ -1712,7 +1750,9 @@ async def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=await async_maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -1765,7 +1805,9 @@ async def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=await async_maybe_transform( { "name": name, @@ -1811,7 +1853,9 @@ async def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1850,7 +1894,9 @@ async def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1904,7 +1950,9 @@ async def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1946,7 +1994,9 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1993,7 +2043,9 @@ async def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2035,7 +2087,9 @@ async def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=await async_maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -2085,7 +2139,9 @@ async def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 9cc4b04f..20e0c0f8 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -77,7 +77,9 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -307,7 +309,9 @@ def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -366,7 +370,9 @@ def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -433,7 +439,9 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -663,7 +671,9 @@ async def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -722,7 +732,9 @@ async def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index fa058434..03ffbcd1 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -87,7 +87,9 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -166,7 +168,9 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index 12024d04..b0d0c62e 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -67,7 +67,9 @@ def list( returned. """ return self._get( - "/cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +125,9 @@ async def list( returned. """ return await self._get( - "/cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index a778a3b9..198ead21 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -210,7 +210,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", body=maybe_transform( { "keypair": keypair, @@ -339,7 +341,9 @@ def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=maybe_transform( { "authentication": authentication, @@ -385,7 +389,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -427,7 +433,9 @@ def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -470,7 +478,9 @@ def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -509,7 +519,9 @@ def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -548,7 +560,9 @@ def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -587,7 +601,9 @@ def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -629,7 +645,9 @@ def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -799,7 +817,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", body=await async_maybe_transform( { "keypair": keypair, @@ -928,7 +948,9 @@ async def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=await async_maybe_transform( { "authentication": authentication, @@ -974,7 +996,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1016,7 +1040,9 @@ async def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1059,7 +1085,9 @@ async def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1098,7 +1126,9 @@ async def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1137,7 +1167,9 @@ async def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1176,7 +1208,9 @@ async def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1218,7 +1252,9 @@ async def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=await async_maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/clusters/nodes.py b/src/gcore/resources/cloud/k8s/clusters/nodes.py index b3bd95d8..d04a0586 100644 --- a/src/gcore/resources/cloud/k8s/clusters/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/nodes.py @@ -76,7 +76,9 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -124,7 +126,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +191,9 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -235,7 +241,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py index 903c428e..8ff64793 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py @@ -79,7 +79,9 @@ def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -130,7 +132,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -196,7 +200,9 @@ async def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -247,7 +253,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 0cb81d5a..b60e3039 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -130,7 +130,9 @@ def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=maybe_transform( { "flavor_id": flavor_id, @@ -208,7 +210,9 @@ def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -258,7 +262,9 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,7 +306,9 @@ def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -342,7 +350,9 @@ def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,7 +397,9 @@ def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -492,7 +504,9 @@ async def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=await async_maybe_transform( { "flavor_id": flavor_id, @@ -570,7 +584,9 @@ async def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=await async_maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -620,7 +636,9 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -662,7 +680,9 @@ async def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -704,7 +724,9 @@ async def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -749,7 +771,9 @@ async def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=await async_maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/flavors.py b/src/gcore/resources/cloud/k8s/flavors.py index 71781231..cd456f26 100644 --- a/src/gcore/resources/cloud/k8s/flavors.py +++ b/src/gcore/resources/cloud/k8s/flavors.py @@ -79,7 +79,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -155,7 +157,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index ad74c5fd..c193fccd 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -92,7 +92,9 @@ def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -157,7 +159,9 @@ async def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index 48ba2c61..d104d723 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -76,7 +76,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -143,7 +145,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index 1b2bde53..d7cce84f 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py @@ -118,7 +118,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", body=maybe_transform( { "action": action, @@ -168,7 +170,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -207,7 +211,9 @@ def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -246,7 +252,9 @@ def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -314,7 +322,9 @@ def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=maybe_transform( { "action": action, @@ -420,7 +430,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", body=await async_maybe_transform( { "action": action, @@ -470,7 +482,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -509,7 +523,9 @@ async def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -548,7 +564,9 @@ async def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -616,7 +634,9 @@ async def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=await async_maybe_transform( { "action": action, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py index 34063a17..b83bb590 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -106,7 +106,9 @@ def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=maybe_transform( { "compare_type": compare_type, @@ -156,7 +158,9 @@ def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -198,7 +202,9 @@ def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -240,7 +246,9 @@ def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -312,7 +320,9 @@ def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=maybe_transform( { "compare_type": compare_type, @@ -412,7 +422,9 @@ async def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=await async_maybe_transform( { "compare_type": compare_type, @@ -462,7 +474,9 @@ async def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -504,7 +518,9 @@ async def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -546,7 +562,9 @@ async def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -618,7 +636,9 @@ async def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=await async_maybe_transform( { "compare_type": compare_type, diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index bf760cfb..abbb5e77 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -127,7 +127,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", body=maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -219,7 +221,9 @@ def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -279,7 +283,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -334,7 +340,9 @@ def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,7 +390,9 @@ def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -489,7 +499,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", body=await async_maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -581,7 +593,9 @@ async def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=await async_maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -641,7 +655,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -696,7 +712,9 @@ async def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -744,7 +762,9 @@ async def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index f50f4ce5..9a8070b5 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -207,7 +207,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -297,7 +299,9 @@ def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=maybe_transform( { "logging": logging, @@ -375,7 +379,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", page=SyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -433,7 +439,9 @@ def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -475,7 +483,9 @@ def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -521,7 +531,9 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -573,7 +585,9 @@ def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -704,7 +718,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -794,7 +810,9 @@ async def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=await async_maybe_transform( { "logging": logging, @@ -872,7 +890,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", page=AsyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -930,7 +950,9 @@ async def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -972,7 +994,9 @@ async def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=await async_maybe_transform( {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams ), @@ -1020,7 +1044,9 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1072,7 +1098,9 @@ async def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index 59df8038..dd0dedd2 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -81,7 +81,9 @@ def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -154,7 +156,9 @@ async def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index bae1858c..417ae8b0 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -115,7 +115,9 @@ def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=maybe_transform( { "delay": delay, @@ -177,7 +179,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -274,7 +278,9 @@ async def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=await async_maybe_transform( { "delay": delay, @@ -336,7 +342,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 05091a8b..37faaa3a 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -131,7 +131,9 @@ def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=maybe_transform( { "address": address, @@ -195,7 +197,9 @@ def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -311,7 +315,9 @@ async def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=await async_maybe_transform( { "address": address, @@ -375,7 +381,9 @@ async def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index c0df516c..01abaebd 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -147,7 +147,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", body=maybe_transform( { "lb_algorithm": lb_algorithm, @@ -262,7 +264,9 @@ def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=maybe_transform( { "ca_secret_id": ca_secret_id, @@ -328,7 +332,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -384,7 +390,9 @@ def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -429,7 +437,9 @@ def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -540,7 +550,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", body=await async_maybe_transform( { "lb_algorithm": lb_algorithm, @@ -655,7 +667,9 @@ async def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=await async_maybe_transform( { "ca_secret_id": ca_secret_id, @@ -721,7 +735,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -777,7 +793,9 @@ async def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -822,7 +840,9 @@ async def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 5579e857..e99f90c9 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -69,7 +69,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -108,7 +110,9 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -165,7 +169,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -204,7 +210,9 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 2fda130e..235648f0 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -120,7 +120,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -201,7 +203,9 @@ def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=maybe_transform( { "name": name, @@ -268,7 +272,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", page=SyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -328,7 +334,9 @@ def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -373,7 +381,9 @@ def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -458,7 +468,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -539,7 +551,9 @@ async def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=await async_maybe_transform( { "name": name, @@ -606,7 +620,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", page=AsyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -666,7 +682,9 @@ async def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -711,7 +729,9 @@ async def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 657982bd..93596051 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -92,7 +92,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -149,7 +151,9 @@ def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=maybe_transform( { "external_gateway_info": external_gateway_info, @@ -199,7 +203,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", page=SyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -249,7 +255,9 @@ def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,7 +309,9 @@ def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=maybe_transform( { "subnet_id": subnet_id, @@ -350,7 +360,9 @@ def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=maybe_transform({"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -390,7 +402,9 @@ def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -459,7 +473,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -516,7 +532,9 @@ async def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=await async_maybe_transform( { "external_gateway_info": external_gateway_info, @@ -566,7 +584,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", page=AsyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -616,7 +636,9 @@ async def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -668,7 +690,9 @@ async def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=await async_maybe_transform( { "subnet_id": subnet_id, @@ -717,7 +741,9 @@ async def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=await async_maybe_transform( {"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams ), @@ -759,7 +785,9 @@ async def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index b781c2e3..aef9bb2a 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -125,7 +125,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", body=maybe_transform( { "cidr": cidr, @@ -225,7 +227,9 @@ def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=maybe_transform( { "dns_nameservers": dns_nameservers, @@ -311,7 +315,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", page=SyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -372,7 +378,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -417,7 +425,9 @@ def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -521,7 +531,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", body=await async_maybe_transform( { "cidr": cidr, @@ -621,7 +633,9 @@ async def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=await async_maybe_transform( { "dns_nameservers": dns_nameservers, @@ -707,7 +721,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", page=AsyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -768,7 +784,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -813,7 +831,9 @@ async def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 31777c13..4c3a5142 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -80,7 +80,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -123,7 +125,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -162,7 +166,9 @@ def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -201,7 +207,9 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -264,7 +272,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -307,7 +317,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -346,7 +358,9 @@ async def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -385,7 +399,9 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 383f3c3b..0603b072 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -83,7 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", body=maybe_transform( { "name": name, @@ -142,7 +142,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", page=SyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -193,7 +193,9 @@ def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._delete( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,7 +228,9 @@ def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,7 +271,9 @@ def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._put( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", body=maybe_transform( { "name": name, @@ -339,7 +345,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", body=await async_maybe_transform( { "name": name, @@ -398,7 +404,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", page=AsyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -449,7 +455,9 @@ async def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._delete( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -482,7 +490,9 @@ async def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,7 +533,9 @@ async def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._put( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 9a9f9c82..17a7d75a 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -65,7 +65,9 @@ def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return self._get( - "/cloud/v2/client_quotas", + "/cloud/v2/client_quotas" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -103,7 +105,9 @@ def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -136,7 +140,9 @@ def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -180,7 +186,9 @@ async def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return await self._get( - "/cloud/v2/client_quotas", + "/cloud/v2/client_quotas" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -218,7 +226,9 @@ async def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -251,7 +261,9 @@ async def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 79d4febe..4c49c8b0 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -79,7 +79,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", body=maybe_transform( { "description": description, @@ -127,7 +129,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", page=SyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -173,7 +177,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -206,7 +212,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,7 +275,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", body=await async_maybe_transform( { "description": description, @@ -315,7 +325,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", page=AsyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -361,7 +373,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +408,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index b49adfcd..df9da044 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -86,7 +86,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions", + "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", page=SyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -139,7 +139,9 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -213,7 +215,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions", + "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", page=AsyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -266,7 +268,9 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index 0b579ba5..77496af1 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -72,7 +72,9 @@ def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -116,7 +118,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -177,7 +181,9 @@ async def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -221,7 +227,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 8889d473..b8623cf3 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -126,7 +126,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -169,7 +171,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -207,7 +211,9 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +250,9 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -284,7 +292,9 @@ def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=maybe_transform({"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -365,7 +375,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -408,7 +420,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -446,7 +460,9 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -483,7 +499,9 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,7 +541,9 @@ async def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=await async_maybe_transform( {"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams ), diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index 74377052..452755d2 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -69,7 +69,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -110,7 +112,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -168,7 +172,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -209,7 +215,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index ab35828c..7bed1478 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -78,7 +78,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -146,7 +148,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index f535c7dd..8c402baf 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -89,7 +89,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=maybe_transform( { "duration": duration, @@ -142,7 +144,9 @@ def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=maybe_transform( { "duration": duration, @@ -186,7 +190,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -225,7 +231,9 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -265,7 +273,9 @@ def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -304,7 +314,9 @@ def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -375,7 +387,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=await async_maybe_transform( { "duration": duration, @@ -428,7 +442,9 @@ async def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=await async_maybe_transform( { "duration": duration, @@ -472,7 +488,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -511,7 +529,9 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -551,7 +571,9 @@ async def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=await async_maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -590,7 +612,9 @@ async def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index d5b0e030..1cd099f6 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -274,7 +274,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=maybe_transform( { "type": type, @@ -352,7 +354,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=SyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -409,7 +413,9 @@ def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -448,7 +454,9 @@ def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -695,7 +703,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=await async_maybe_transform( { "type": type, @@ -773,7 +783,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=AsyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -830,7 +842,9 @@ async def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -869,7 +883,9 @@ async def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 1d6c76e2..22757eba 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -79,7 +79,9 @@ def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -118,7 +120,9 @@ def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -160,7 +164,9 @@ def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -205,7 +211,9 @@ def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -248,7 +256,9 @@ def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), @@ -311,7 +321,9 @@ async def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,7 +362,9 @@ async def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +406,9 @@ async def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -437,7 +453,9 @@ async def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=await async_maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -480,7 +498,9 @@ async def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 5cbefb25..dabef59a 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -86,7 +86,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", page=SyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -142,7 +144,9 @@ def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +191,9 @@ def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -236,7 +242,9 @@ def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -312,7 +320,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", page=AsyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -368,7 +378,9 @@ async def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -413,7 +425,9 @@ async def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -462,7 +476,9 @@ async def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index 89b27a23..c69d2608 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -126,7 +126,9 @@ def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=maybe_transform( { "description": description, @@ -179,7 +181,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,7 +277,9 @@ def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=maybe_transform( { "direction": direction, @@ -397,7 +403,9 @@ async def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=await async_maybe_transform( { "description": description, @@ -450,7 +458,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -544,7 +554,9 @@ async def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=await async_maybe_transform( { "direction": direction, diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index ac4d9bc3..0e24383b 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -97,7 +97,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", body=maybe_transform( { "security_group": security_group, @@ -170,7 +172,9 @@ def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=maybe_transform( { "changed_rules": changed_rules, @@ -226,7 +230,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", page=SyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -279,7 +285,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -321,7 +329,9 @@ def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -361,7 +371,9 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -400,7 +412,9 @@ def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,7 +481,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", body=await async_maybe_transform( { "security_group": security_group, @@ -540,7 +556,9 @@ async def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=await async_maybe_transform( { "changed_rules": changed_rules, @@ -596,7 +614,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", page=AsyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -649,7 +669,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -691,7 +713,9 @@ async def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=await async_maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -731,7 +755,9 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -770,7 +796,9 @@ async def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 788d415c..30ef2830 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -90,7 +90,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", body=maybe_transform( { "name": name, @@ -141,7 +143,9 @@ def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=maybe_transform({"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -186,7 +190,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", page=SyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -239,7 +245,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -279,7 +287,9 @@ def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -352,7 +362,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", body=await async_maybe_transform( { "name": name, @@ -403,7 +415,9 @@ async def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=await async_maybe_transform( {"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams ), @@ -450,7 +464,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", page=AsyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -503,7 +519,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -543,7 +561,9 @@ async def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 63bc78f7..c0866b41 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -156,7 +156,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks", + "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", page=SyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -213,7 +213,9 @@ def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -258,7 +260,9 @@ def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -293,7 +297,9 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -431,7 +437,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks", + "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", page=AsyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -488,7 +494,9 @@ async def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -533,7 +541,9 @@ async def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -568,7 +578,9 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index 0adc0809..48387eda 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -139,7 +139,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/usage_report", + "/cloud/v1/usage_report" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/usage_report", body=maybe_transform( { "time_from": time_from, @@ -277,7 +279,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/usage_report", + "/cloud/v1/usage_report" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/usage_report", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 5294d3a7..0318b8fc 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -85,7 +85,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", body=maybe_transform( { "role": role, @@ -139,7 +141,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", body=maybe_transform( { "role": role, @@ -191,7 +195,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", page=SyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -237,7 +243,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ return self._delete( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,7 +308,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", body=await async_maybe_transform( { "role": role, @@ -354,7 +364,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", body=await async_maybe_transform( { "role": role, @@ -406,7 +418,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", page=AsyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -452,7 +466,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ return await self._delete( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index ed0babaa..74756335 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -292,7 +292,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", body=maybe_transform( { "image_id": image_id, @@ -376,7 +378,9 @@ def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=maybe_transform( { "name": name, @@ -458,7 +462,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", page=SyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -527,7 +533,9 @@ def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -584,7 +592,9 @@ def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=maybe_transform( { "instance_id": instance_id, @@ -641,7 +651,9 @@ def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=maybe_transform({"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -690,7 +702,9 @@ def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -738,7 +752,9 @@ def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -788,7 +804,9 @@ def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -837,7 +855,9 @@ def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1101,7 +1121,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", body=await async_maybe_transform( { "image_id": image_id, @@ -1185,7 +1207,9 @@ async def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=await async_maybe_transform( { "name": name, @@ -1267,7 +1291,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", page=AsyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -1336,7 +1362,9 @@ async def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1393,7 +1421,9 @@ async def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=await async_maybe_transform( { "instance_id": instance_id, @@ -1450,7 +1480,9 @@ async def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=await async_maybe_transform( {"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams ), @@ -1501,7 +1533,9 @@ async def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=await async_maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -1549,7 +1583,9 @@ async def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1599,7 +1635,9 @@ async def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=await async_maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1648,7 +1686,9 @@ async def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py index 3e6485d0..612cd629 100644 --- a/src/gcore/resources/dns/dns.py +++ b/src/gcore/resources/dns/dns.py @@ -104,7 +104,9 @@ def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return self._get( - "/dns/v2/platform/info", + "/dns/v2/platform/info" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -141,7 +143,7 @@ def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/lookup", + "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -207,7 +209,9 @@ async def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return await self._get( - "/dns/v2/platform/info", + "/dns/v2/platform/info" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +248,7 @@ async def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/lookup", + "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/locations.py b/src/gcore/resources/dns/locations.py index 20dcea5a..c58907a8 100644 --- a/src/gcore/resources/dns/locations.py +++ b/src/gcore/resources/dns/locations.py @@ -54,7 +54,7 @@ def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return self._get( - "/dns/v2/locations", + "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -73,7 +73,9 @@ def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return self._get( - "/dns/v2/locations/continents", + "/dns/v2/locations/continents" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -92,7 +94,9 @@ def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return self._get( - "/dns/v2/locations/countries", + "/dns/v2/locations/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -111,7 +115,9 @@ def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return self._get( - "/dns/v2/locations/regions", + "/dns/v2/locations/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -151,7 +157,7 @@ async def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return await self._get( - "/dns/v2/locations", + "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -170,7 +176,9 @@ async def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return await self._get( - "/dns/v2/locations/continents", + "/dns/v2/locations/continents" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -189,7 +197,9 @@ async def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return await self._get( - "/dns/v2/locations/countries", + "/dns/v2/locations/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -208,7 +218,9 @@ async def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return await self._get( - "/dns/v2/locations/regions", + "/dns/v2/locations/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index 8eef7aeb..b9bf45a5 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -82,7 +82,9 @@ def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return self._get( - "/dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -160,7 +162,9 @@ async def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return await self._get( - "/dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/pickers/pickers.py b/src/gcore/resources/dns/pickers/pickers.py index 3078c7f2..599a2450 100644 --- a/src/gcore/resources/dns/pickers/pickers.py +++ b/src/gcore/resources/dns/pickers/pickers.py @@ -63,7 +63,7 @@ def list( ) -> PickerListResponse: """Returns list of picker""" return self._get( - "/dns/v2/pickers", + "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -107,7 +107,7 @@ async def list( ) -> PickerListResponse: """Returns list of picker""" return await self._get( - "/dns/v2/pickers", + "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/pickers/presets.py b/src/gcore/resources/dns/pickers/presets.py index aebd10ff..09f7d53b 100644 --- a/src/gcore/resources/dns/pickers/presets.py +++ b/src/gcore/resources/dns/pickers/presets.py @@ -51,7 +51,9 @@ def list( ) -> PresetListResponse: """Returns list of picker preset""" return self._get( - "/dns/v2/pickers/presets", + "/dns/v2/pickers/presets" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -91,7 +93,9 @@ async def list( ) -> PresetListResponse: """Returns list of picker preset""" return await self._get( - "/dns/v2/pickers/presets", + "/dns/v2/pickers/presets" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/dnssec.py b/src/gcore/resources/dns/zones/dnssec.py index 8c747071..8f283155 100644 --- a/src/gcore/resources/dns/zones/dnssec.py +++ b/src/gcore/resources/dns/zones/dnssec.py @@ -69,7 +69,9 @@ def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", body=maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -103,7 +105,9 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -158,7 +162,9 @@ async def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", body=await async_maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -192,7 +198,9 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index e1d136b1..93697456 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -205,7 +205,9 @@ def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -259,7 +261,9 @@ def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -310,7 +314,9 @@ def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -349,7 +355,9 @@ def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +402,9 @@ def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -453,7 +463,9 @@ def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -644,7 +656,9 @@ async def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, @@ -698,7 +712,9 @@ async def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -749,7 +765,9 @@ async def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -788,7 +806,9 @@ async def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -833,7 +853,9 @@ async def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -892,7 +914,9 @@ async def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 75e11dde..31b815a3 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -143,7 +143,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", body=maybe_transform( { "name": name, @@ -225,7 +225,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -283,7 +283,9 @@ def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._delete( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -318,7 +320,9 @@ def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._post( - f"/dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -351,7 +355,9 @@ def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -384,7 +390,9 @@ def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -417,7 +425,9 @@ def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -450,7 +460,9 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,7 +529,9 @@ def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -583,7 +597,9 @@ def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._post( - f"/dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", body=maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -656,7 +672,9 @@ def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return self._put( - f"/dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{path_name}", body=maybe_transform( { "body_name": body_name, @@ -769,7 +787,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", body=await async_maybe_transform( { "name": name, @@ -851,7 +869,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -909,7 +927,9 @@ async def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._delete( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -944,7 +964,9 @@ async def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._post( - f"/dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -977,7 +999,9 @@ async def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1010,7 +1034,9 @@ async def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1043,7 +1069,9 @@ async def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1076,7 +1104,9 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1143,7 +1173,9 @@ async def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1209,7 +1241,9 @@ async def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", body=await async_maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1282,7 +1316,9 @@ async def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return await self._put( - f"/dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{path_name}", body=await async_maybe_transform( { "body_name": body_name, diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index 92d2662a..a72cd50f 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -121,7 +121,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", body=maybe_transform( { "binary": binary, @@ -208,7 +208,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=maybe_transform( { "binary": binary, @@ -305,7 +307,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", page=SyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -355,7 +357,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -386,7 +390,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -418,7 +424,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -514,7 +522,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", body=await async_maybe_transform( { "binary": binary, @@ -601,7 +609,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=await async_maybe_transform( { "binary": binary, @@ -698,7 +708,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", page=AsyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -748,7 +758,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -779,7 +791,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -811,7 +825,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=await async_maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py index f43d121c..b61bcfd9 100644 --- a/src/gcore/resources/fastedge/apps/logs.py +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -94,7 +94,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", page=SyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, @@ -187,7 +189,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", page=AsyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index 8323efb1..bdda5fd9 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -67,7 +67,9 @@ def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return self._post( - "/fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries/raw", body=read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -87,7 +89,9 @@ def list( ) -> BinaryListResponse: """List binaries""" return self._get( - "/fastedge/v1/binaries", + "/fastedge/v1/binaries" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +123,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -150,7 +156,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,7 +211,9 @@ async def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return await self._post( - "/fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries/raw", body=await async_read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -223,7 +233,9 @@ async def list( ) -> BinaryListResponse: """List binaries""" return await self._get( - "/fastedge/v1/binaries", + "/fastedge/v1/binaries" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -255,7 +267,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -286,7 +300,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/fastedge.py b/src/gcore/resources/fastedge/fastedge.py index 9b052788..e52b5216 100644 --- a/src/gcore/resources/fastedge/fastedge.py +++ b/src/gcore/resources/fastedge/fastedge.py @@ -123,7 +123,7 @@ def get_account_overview( ) -> Client: """Get status and limits for the client""" return self._get( - "/fastedge/v1/me", + "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +187,7 @@ async def get_account_overview( ) -> Client: """Get status and limits for the client""" return await self._get( - "/fastedge/v1/me", + "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py index cb007bbc..17cd738d 100644 --- a/src/gcore/resources/fastedge/kv_stores.py +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -72,7 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", body=maybe_transform( { "byod": byod, @@ -112,7 +112,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -148,7 +148,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -179,7 +181,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,7 +220,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", body=maybe_transform( { "byod": byod, @@ -280,7 +286,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", body=await async_maybe_transform( { "byod": byod, @@ -320,7 +326,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -356,7 +362,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,7 +395,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,7 +434,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", body=await async_maybe_transform( { "byod": byod, diff --git a/src/gcore/resources/fastedge/secrets.py b/src/gcore/resources/fastedge/secrets.py index 8b1e97e2..beee5a6a 100644 --- a/src/gcore/resources/fastedge/secrets.py +++ b/src/gcore/resources/fastedge/secrets.py @@ -83,7 +83,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", body=maybe_transform( { "name": name, @@ -131,7 +133,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=maybe_transform( { "comment": comment, @@ -175,7 +179,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -220,7 +226,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -255,7 +263,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -295,7 +305,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=maybe_transform( { "name": name, @@ -363,7 +375,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", body=await async_maybe_transform( { "name": name, @@ -411,7 +425,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "comment": comment, @@ -455,7 +471,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -500,7 +518,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -535,7 +555,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -575,7 +597,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/fastedge/statistics.py b/src/gcore/resources/fastedge/statistics.py index 1958aafc..9bc2a7ba 100644 --- a/src/gcore/resources/fastedge/statistics.py +++ b/src/gcore/resources/fastedge/statistics.py @@ -83,7 +83,9 @@ def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -141,7 +143,9 @@ def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -220,7 +224,9 @@ async def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -278,7 +284,9 @@ async def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/fastedge/templates.py b/src/gcore/resources/fastedge/templates.py index a39e2757..78413275 100644 --- a/src/gcore/resources/fastedge/templates.py +++ b/src/gcore/resources/fastedge/templates.py @@ -93,7 +93,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", body=maybe_transform( { "binary_id": binary_id, @@ -149,7 +151,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", page=SyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -197,7 +201,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -232,7 +238,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,7 +289,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", body=maybe_transform( { "binary_id": binary_id, @@ -361,7 +371,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", body=await async_maybe_transform( { "binary_id": binary_id, @@ -417,7 +429,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", page=AsyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -465,7 +479,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -500,7 +516,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -549,7 +567,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", body=await async_maybe_transform( { "binary_id": binary_id, diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index ecd59cb6..8e771ad5 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -80,7 +80,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", body=maybe_transform( { "client_user": client_user, @@ -147,7 +149,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -196,7 +200,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,7 +234,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -293,7 +301,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", body=await async_maybe_transform( { "client_user": client_user, @@ -360,7 +370,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -409,7 +421,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +455,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/iam.py b/src/gcore/resources/iam/iam.py index 54b4653f..e6fb22d8 100644 --- a/src/gcore/resources/iam/iam.py +++ b/src/gcore/resources/iam/iam.py @@ -75,7 +75,7 @@ def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return self._get( - "/iam/clients/me", + "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +123,7 @@ async def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return await self._get( - "/iam/clients/me", + "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index a27021c1..5f0cf949 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -101,7 +101,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", body=maybe_transform( { "auth_types": auth_types, @@ -152,7 +154,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users", + "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", page=SyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -198,7 +200,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -229,7 +233,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -275,7 +281,9 @@ def invite( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/iam/clients/invite_user", + "/iam/clients/invite_user" + if self._client._base_url_overridden + else "https://api.gcore.com//iam/clients/invite_user", body=maybe_transform( { "client_id": client_id, @@ -366,7 +374,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", body=await async_maybe_transform( { "auth_types": auth_types, @@ -417,7 +427,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users", + "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", page=AsyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -463,7 +473,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -494,7 +506,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -540,7 +554,9 @@ async def invite( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/iam/clients/invite_user", + "/iam/clients/invite_user" + if self._client._base_url_overridden + else "https://api.gcore.com//iam/clients/invite_user", body=await async_maybe_transform( { "client_id": client_id, diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index 43947fab..fdbb1d33 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -74,7 +74,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -122,7 +124,9 @@ def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", body=maybe_transform( { "announce": announce, @@ -191,7 +195,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -239,7 +245,9 @@ async def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", body=await async_maybe_transform( { "announce": announce, diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py index 86d387bb..98c34908 100644 --- a/src/gcore/resources/security/events.py +++ b/src/gcore/resources/security/events.py @@ -88,7 +88,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs" + if self._client._base_url_overridden + else "https://api.gcore.com//security/notifier/v1/event_logs", page=SyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs" + if self._client._base_url_overridden + else "https://api.gcore.com//security/notifier/v1/event_logs", page=AsyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py index 85b84ad8..79719fd7 100644 --- a/src/gcore/resources/security/profile_templates.py +++ b/src/gcore/resources/security/profile_templates.py @@ -55,7 +55,9 @@ def list( profile. Client receives only common and created for him profile templates. """ return self._get( - "/security/iaas/profile-templates", + "/security/iaas/profile-templates" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -99,7 +101,9 @@ async def list( profile. Client receives only common and created for him profile templates. """ return await self._get( - "/security/iaas/profile-templates", + "/security/iaas/profile-templates" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index 16668afa..b3cd1183 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -78,7 +78,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", body=maybe_transform( { "fields": fields, @@ -122,7 +124,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -168,7 +172,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +205,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -234,7 +242,9 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", body=maybe_transform( { "fields": fields, @@ -280,7 +290,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", body=maybe_transform( { "fields": fields, @@ -346,7 +358,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", body=await async_maybe_transform( { "fields": fields, @@ -390,7 +404,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -436,7 +452,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,7 +485,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -502,7 +522,9 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", body=await async_maybe_transform( { "fields": fields, @@ -548,7 +570,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", body=await async_maybe_transform( { "fields": fields, diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index f857f350..c3e7df90 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -21,6 +21,7 @@ AsyncPolicyResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._utils import maybe_transform from .lifecycle import ( LifecycleResource, AsyncLifecycleResource, @@ -37,7 +38,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.storage import bucket_list_params +from ....types.storage.storage_bucket import StorageBucket __all__ = ["BucketsResource", "AsyncBucketsResource"] @@ -104,13 +108,68 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=NoneType, ) + def list( + self, + storage_id: int, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[StorageBucket]: + """Returns the list of buckets for the storage in a wrapped response. + + Response + format: count: total number of buckets (independent of pagination) results: + current page of buckets according to limit/offset + + Args: + limit: Max number of records in response + + offset: Number of records to skip before beginning to write in response. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", + page=SyncOffsetPage[StorageBucket], + 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, + }, + bucket_list_params.BucketListParams, + ), + ), + model=StorageBucket, + ) + def delete( self, bucket_name: str, @@ -125,7 +184,8 @@ def delete( ) -> None: """Removes a bucket from an S3 storage. - The bucket must be empty before deletion. + All objects in the bucket will be + automatically deleted before the bucket is removed. Args: extra_headers: Send extra headers @@ -140,7 +200,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -210,13 +272,68 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=NoneType, ) + def list( + self, + storage_id: int, + *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[StorageBucket, AsyncOffsetPage[StorageBucket]]: + """Returns the list of buckets for the storage in a wrapped response. + + Response + format: count: total number of buckets (independent of pagination) results: + current page of buckets according to limit/offset + + Args: + limit: Max number of records in response + + offset: Number of records to skip before beginning to write in response. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", + page=AsyncOffsetPage[StorageBucket], + 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, + }, + bucket_list_params.BucketListParams, + ), + ), + model=StorageBucket, + ) + async def delete( self, bucket_name: str, @@ -231,7 +348,8 @@ async def delete( ) -> None: """Removes a bucket from an S3 storage. - The bucket must be empty before deletion. + All objects in the bucket will be + automatically deleted before the bucket is removed. Args: extra_headers: Send extra headers @@ -246,7 +364,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -261,6 +381,9 @@ def __init__(self, buckets: BucketsResource) -> None: self.create = to_raw_response_wrapper( buckets.create, ) + self.list = to_raw_response_wrapper( + buckets.list, + ) self.delete = to_raw_response_wrapper( buckets.delete, ) @@ -285,6 +408,9 @@ def __init__(self, buckets: AsyncBucketsResource) -> None: self.create = async_to_raw_response_wrapper( buckets.create, ) + self.list = async_to_raw_response_wrapper( + buckets.list, + ) self.delete = async_to_raw_response_wrapper( buckets.delete, ) @@ -309,6 +435,9 @@ def __init__(self, buckets: BucketsResource) -> None: self.create = to_streamed_response_wrapper( buckets.create, ) + self.list = to_streamed_response_wrapper( + buckets.list, + ) self.delete = to_streamed_response_wrapper( buckets.delete, ) @@ -333,6 +462,9 @@ def __init__(self, buckets: AsyncBucketsResource) -> None: self.create = async_to_streamed_response_wrapper( buckets.create, ) + self.list = async_to_streamed_response_wrapper( + buckets.list, + ) self.delete = async_to_streamed_response_wrapper( buckets.delete, ) diff --git a/src/gcore/resources/storage/buckets/cors.py b/src/gcore/resources/storage/buckets/cors.py index 01736f36..7a44bd1e 100644 --- a/src/gcore/resources/storage/buckets/cors.py +++ b/src/gcore/resources/storage/buckets/cors.py @@ -60,6 +60,8 @@ def create( browsers. Args: + allowed_origins: List of allowed origins for CORS requests + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -72,7 +74,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,7 +113,9 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -156,6 +162,8 @@ async def create( browsers. Args: + allowed_origins: List of allowed origins for CORS requests + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -168,7 +176,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=await async_maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -205,7 +215,9 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/lifecycle.py b/src/gcore/resources/storage/buckets/lifecycle.py index ac68c1c6..8e7f3d81 100644 --- a/src/gcore/resources/storage/buckets/lifecycle.py +++ b/src/gcore/resources/storage/buckets/lifecycle.py @@ -53,13 +53,19 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: - """Configures automatic object expiration rules for an S3 bucket. + """Sets up automatic object expiration for an S3 bucket. - Objects older - than the specified number of days will be automatically deleted to manage - storage costs and compliance. + All objects in the bucket + will be automatically deleted after the specified number of days to help manage + storage costs and meet compliance requirements. This applies a global lifecycle + rule to the entire bucket - all existing and future objects will be subject to + the expiration policy. Args: + expiration_days: Number of days after which objects will be automatically deleted from the + bucket. Must be a positive integer. Common values: 30 for monthly cleanup, 365 + for yearly retention. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -72,7 +78,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=maybe_transform({"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,7 +117,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -150,13 +160,19 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: - """Configures automatic object expiration rules for an S3 bucket. + """Sets up automatic object expiration for an S3 bucket. - Objects older - than the specified number of days will be automatically deleted to manage - storage costs and compliance. + All objects in the bucket + will be automatically deleted after the specified number of days to help manage + storage costs and meet compliance requirements. This applies a global lifecycle + rule to the entire bucket - all existing and future objects will be subject to + the expiration policy. Args: + expiration_days: Number of days after which objects will be automatically deleted from the + bucket. Must be a positive integer. Common values: 30 for monthly cleanup, 365 + for yearly retention. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -169,7 +185,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=await async_maybe_transform( {"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams ), @@ -208,7 +226,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/policy.py b/src/gcore/resources/storage/buckets/policy.py index 0a81929e..7b89c11b 100644 --- a/src/gcore/resources/storage/buckets/policy.py +++ b/src/gcore/resources/storage/buckets/policy.py @@ -14,7 +14,7 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.storage.buckets.storage_bucket_policy import StorageBucketPolicy +from ....types.storage.buckets.policy_get_response import PolicyGetResponse __all__ = ["PolicyResource", "AsyncPolicyResource"] @@ -52,8 +52,11 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Creates or updates access policy for an S3 bucket, controlling permissions for - bucket operations. + Applies a public read policy to the S3 bucket, allowing anonymous users to + download/access all objects in the bucket via HTTP GET requests. This makes the + bucket suitable for static website hosting, public file sharing, or CDN + integration. Only grants read access - users cannot upload, modify, or delete + objects without proper authentication. Args: extra_headers: Send extra headers @@ -68,7 +71,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -88,7 +93,10 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Removes the access policy from an S3 bucket, reverting to default permissions. + Removes the public read policy from an S3 bucket, making all objects private and + accessible only with proper authentication credentials. After this operation, + anonymous users will no longer be able to access bucket contents via HTTP + requests. Args: extra_headers: Send extra headers @@ -103,7 +111,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -121,9 +131,10 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StorageBucketPolicy: + ) -> PolicyGetResponse: """ - Retrieves the current access policy configuration for an S3 bucket. + Returns whether the S3 bucket is currently configured for public read access. + Shows if anonymous users can download objects from the bucket via HTTP requests. Args: extra_headers: Send extra headers @@ -137,11 +148,13 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StorageBucketPolicy, + cast_to=PolicyGetResponse, ) @@ -178,8 +191,11 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Creates or updates access policy for an S3 bucket, controlling permissions for - bucket operations. + Applies a public read policy to the S3 bucket, allowing anonymous users to + download/access all objects in the bucket via HTTP GET requests. This makes the + bucket suitable for static website hosting, public file sharing, or CDN + integration. Only grants read access - users cannot upload, modify, or delete + objects without proper authentication. Args: extra_headers: Send extra headers @@ -194,7 +210,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -214,7 +232,10 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Removes the access policy from an S3 bucket, reverting to default permissions. + Removes the public read policy from an S3 bucket, making all objects private and + accessible only with proper authentication credentials. After this operation, + anonymous users will no longer be able to access bucket contents via HTTP + requests. Args: extra_headers: Send extra headers @@ -229,7 +250,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -247,9 +270,10 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StorageBucketPolicy: + ) -> PolicyGetResponse: """ - Retrieves the current access policy configuration for an S3 bucket. + Returns whether the S3 bucket is currently configured for public read access. + Shows if anonymous users can download objects from the bucket via HTTP requests. Args: extra_headers: Send extra headers @@ -263,11 +287,13 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StorageBucketPolicy, + cast_to=PolicyGetResponse, ) diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index 4a934ab4..ef93c1d2 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -62,6 +62,20 @@ def recreate( password for SFTP storage). Args: + delete_sftp_password: Remove the SFTP password, disabling password authentication. Only applicable to + SFTP storage type. + + generate_s3_keys: Generate new S3 access and secret keys for S3 storage. Only applicable to S3 + storage type. + + generate_sftp_password: Generate a new random password for SFTP access. Only applicable to SFTP storage + type. + + reset_sftp_keys: Reset/remove all SSH keys associated with the SFTP storage. Only applicable to + SFTP storage type. + + sftp_password: Set a custom password for SFTP access. Only applicable to SFTP storage type. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -71,7 +85,9 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", body=maybe_transform( { "delete_sftp_password": delete_sftp_password, @@ -130,6 +146,20 @@ async def recreate( password for SFTP storage). Args: + delete_sftp_password: Remove the SFTP password, disabling password authentication. Only applicable to + SFTP storage type. + + generate_s3_keys: Generate new S3 access and secret keys for S3 storage. Only applicable to S3 + storage type. + + generate_sftp_password: Generate a new random password for SFTP access. Only applicable to SFTP storage + type. + + reset_sftp_keys: Reset/remove all SSH keys associated with the SFTP storage. Only applicable to + SFTP storage type. + + sftp_password: Set a custom password for SFTP access. Only applicable to SFTP storage type. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -139,7 +169,9 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", body=await async_maybe_transform( { "delete_sftp_password": delete_sftp_password, diff --git a/src/gcore/resources/storage/locations.py b/src/gcore/resources/storage/locations.py index 2157074d..5093da49 100644 --- a/src/gcore/resources/storage/locations.py +++ b/src/gcore/resources/storage/locations.py @@ -2,6 +2,8 @@ from __future__ import annotations +import typing_extensions + import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -39,6 +41,7 @@ def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: """ return LocationsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def list( self, *, @@ -55,7 +58,9 @@ def list( represents a geographic region with specific data center facilities. """ return self._get( - "/storage/provisioning/v1/location", + "/storage/provisioning/v1/location" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v1/location", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -83,6 +88,7 @@ def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse """ return AsyncLocationsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def list( self, *, @@ -99,7 +105,9 @@ async def list( represents a geographic region with specific data center facilities. """ return await self._get( - "/storage/provisioning/v1/location", + "/storage/provisioning/v1/location" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v1/location", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -111,8 +119,10 @@ class LocationsResourceWithRawResponse: def __init__(self, locations: LocationsResource) -> None: self._locations = locations - self.list = to_raw_response_wrapper( - locations.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + locations.list, # pyright: ignore[reportDeprecated], + ) ) @@ -120,8 +130,10 @@ class AsyncLocationsResourceWithRawResponse: def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations - self.list = async_to_raw_response_wrapper( - locations.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + locations.list, # pyright: ignore[reportDeprecated], + ) ) @@ -129,8 +141,10 @@ class LocationsResourceWithStreamingResponse: def __init__(self, locations: LocationsResource) -> None: self._locations = locations - self.list = to_streamed_response_wrapper( - locations.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + locations.list, # pyright: ignore[reportDeprecated], + ) ) @@ -138,6 +152,8 @@ class AsyncLocationsResourceWithStreamingResponse: def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations - self.list = async_to_streamed_response_wrapper( - locations.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + locations.list, # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/gcore/resources/storage/statistics.py b/src/gcore/resources/storage/statistics.py index 8e385298..56c42409 100644 --- a/src/gcore/resources/storage/statistics.py +++ b/src/gcore/resources/storage/statistics.py @@ -82,7 +82,9 @@ def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/total", body=maybe_transform( { "from_": from_, @@ -149,7 +151,9 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/series", body=maybe_transform( { "from_": from_, @@ -229,7 +233,9 @@ async def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/total", body=await async_maybe_transform( { "from_": from_, @@ -296,7 +302,9 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/series", body=await async_maybe_transform( { "from_": from_, diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index 81655ebd..e82a2b90 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -2,6 +2,8 @@ from __future__ import annotations +from typing_extensions import Literal + import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven @@ -38,8 +40,9 @@ CredentialsResourceWithStreamingResponse, AsyncCredentialsResourceWithStreamingResponse, ) -from ..._base_client import make_request_options -from ...types.storage import storage_update_params, storage_restore_params +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ..._base_client import AsyncPaginator, make_request_options +from ...types.storage import storage_list_params, storage_update_params, storage_restore_params from .buckets.buckets import ( BucketsResource, AsyncBucketsResource, @@ -89,6 +92,30 @@ def with_streaming_response(self) -> StorageResourceWithStreamingResponse: """ return StorageResourceWithStreamingResponse(self) + def create( + 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, + ) -> Storage: + """ + Creates a new storage instance (S3 or SFTP) in the specified location and + returns the storage details including credentials. + """ + return self._post( + "/storage/provisioning/v2/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/storage", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Storage, + ) + def update( self, storage_id: int, @@ -106,6 +133,11 @@ def update( Updates storage configuration such as expiration date and server alias. Args: + expires: ISO 8601 timestamp when the storage should expire. Leave empty to remove + expiration. + + server_alias: Custom domain alias for accessing the storage. Leave empty to remove alias. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -115,7 +147,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", body=maybe_transform( { "expires": expires, @@ -129,6 +163,90 @@ def update( cast_to=Storage, ) + def list( + self, + *, + id: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + location: str | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: str | NotGiven = NOT_GIVEN, + order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + show_deleted: bool | NotGiven = NOT_GIVEN, + status: Literal["active", "suspended", "deleted", "pending"] | NotGiven = NOT_GIVEN, + type: Literal["s3", "sftp"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncOffsetPage[Storage]: + """ + Returns storages with the same filtering and pagination as v2, but in a + simplified response shape for easier client consumption. Response format: count: + total number of storages matching the filter (independent of pagination) + results: the current page of storages according to limit/offset + + Args: + id: Filter by storage ID + + limit: Max number of records in response + + location: Filter by storage location/region + + name: Filter by storage name (exact match) + + offset: Number of records to skip before beginning to write in response. + + order_by: Field name to sort by + + order_direction: Ascending or descending order + + show_deleted: Include deleted storages in the response + + status: Filter by storage status + + type: Filter by storage type + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/storage/provisioning/v3/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v3/storage", + page=SyncOffsetPage[Storage], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "limit": limit, + "location": location, + "name": name, + "offset": offset, + "order_by": order_by, + "order_direction": order_direction, + "show_deleted": show_deleted, + "status": status, + "type": type, + }, + storage_list_params.StorageListParams, + ), + ), + model=Storage, + ) + def delete( self, storage_id: int, @@ -155,7 +273,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +307,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -222,7 +344,9 @@ def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -256,7 +380,9 @@ def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -295,7 +421,9 @@ def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -339,6 +467,30 @@ def with_streaming_response(self) -> AsyncStorageResourceWithStreamingResponse: """ return AsyncStorageResourceWithStreamingResponse(self) + async def create( + 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, + ) -> Storage: + """ + Creates a new storage instance (S3 or SFTP) in the specified location and + returns the storage details including credentials. + """ + return await self._post( + "/storage/provisioning/v2/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/storage", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Storage, + ) + async def update( self, storage_id: int, @@ -356,6 +508,11 @@ async def update( Updates storage configuration such as expiration date and server alias. Args: + expires: ISO 8601 timestamp when the storage should expire. Leave empty to remove + expiration. + + server_alias: Custom domain alias for accessing the storage. Leave empty to remove alias. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -365,7 +522,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", body=await async_maybe_transform( { "expires": expires, @@ -379,6 +538,90 @@ async def update( cast_to=Storage, ) + def list( + self, + *, + id: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + location: str | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, + order_by: str | NotGiven = NOT_GIVEN, + order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + show_deleted: bool | NotGiven = NOT_GIVEN, + status: Literal["active", "suspended", "deleted", "pending"] | NotGiven = NOT_GIVEN, + type: Literal["s3", "sftp"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[Storage, AsyncOffsetPage[Storage]]: + """ + Returns storages with the same filtering and pagination as v2, but in a + simplified response shape for easier client consumption. Response format: count: + total number of storages matching the filter (independent of pagination) + results: the current page of storages according to limit/offset + + Args: + id: Filter by storage ID + + limit: Max number of records in response + + location: Filter by storage location/region + + name: Filter by storage name (exact match) + + offset: Number of records to skip before beginning to write in response. + + order_by: Field name to sort by + + order_direction: Ascending or descending order + + show_deleted: Include deleted storages in the response + + status: Filter by storage status + + type: Filter by storage type + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/storage/provisioning/v3/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v3/storage", + page=AsyncOffsetPage[Storage], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "limit": limit, + "location": location, + "name": name, + "offset": offset, + "order_by": order_by, + "order_direction": order_direction, + "show_deleted": show_deleted, + "status": status, + "type": type, + }, + storage_list_params.StorageListParams, + ), + ), + model=Storage, + ) + async def delete( self, storage_id: int, @@ -405,7 +648,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -437,7 +682,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -472,7 +719,9 @@ async def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -506,7 +755,9 @@ async def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -547,7 +798,9 @@ async def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -559,9 +812,15 @@ class StorageResourceWithRawResponse: def __init__(self, storage: StorageResource) -> None: self._storage = storage + self.create = to_raw_response_wrapper( + storage.create, + ) self.update = to_raw_response_wrapper( storage.update, ) + self.list = to_raw_response_wrapper( + storage.list, + ) self.delete = to_raw_response_wrapper( storage.delete, ) @@ -599,9 +858,15 @@ class AsyncStorageResourceWithRawResponse: def __init__(self, storage: AsyncStorageResource) -> None: self._storage = storage + self.create = async_to_raw_response_wrapper( + storage.create, + ) self.update = async_to_raw_response_wrapper( storage.update, ) + self.list = async_to_raw_response_wrapper( + storage.list, + ) self.delete = async_to_raw_response_wrapper( storage.delete, ) @@ -639,9 +904,15 @@ class StorageResourceWithStreamingResponse: def __init__(self, storage: StorageResource) -> None: self._storage = storage + self.create = to_streamed_response_wrapper( + storage.create, + ) self.update = to_streamed_response_wrapper( storage.update, ) + self.list = to_streamed_response_wrapper( + storage.list, + ) self.delete = to_streamed_response_wrapper( storage.delete, ) @@ -679,9 +950,15 @@ class AsyncStorageResourceWithStreamingResponse: def __init__(self, storage: AsyncStorageResource) -> None: self._storage = storage + self.create = async_to_streamed_response_wrapper( + storage.create, + ) self.update = async_to_streamed_response_wrapper( storage.update, ) + self.list = async_to_streamed_response_wrapper( + storage.list, + ) self.delete = async_to_streamed_response_wrapper( storage.delete, ) diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 4dafc6bd..02cb29a4 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -54,8 +54,7 @@ def create( task_name: Literal["transcription", "content-moderation"], url: str, audio_language: str | NotGiven = NOT_GIVEN, - category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] - | NotGiven = NOT_GIVEN, + category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | NotGiven = NOT_GIVEN, client_entity_data: str | NotGiven = NOT_GIVEN, client_user_id: str | NotGiven = NOT_GIVEN, subtitles_language: str | NotGiven = NOT_GIVEN, @@ -74,11 +73,9 @@ def create( - ASR: Transcribe video - ASR: Translate subtitles - CM: Sports detection - - CM: Weapon detection - CM: Not Safe For Work (NSFW) content detection - CM: Soft nudity detection - CM: Hard nudity detection - - CM: Child Sexual Abuse Material (CSAM) detection - CM: Objects recognition (soon) ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) How to use: @@ -137,14 +134,11 @@ def create( - `soft_nudity`: Detailed video analysis that reveals both explicit and partial nudity, including the presence of male and female faces and other uncovered body parts. - - `child_pornography`: Detects child sexual abuse materials (CASM). - - `sport`: Recognizes various sporting activities. - - `weapon`: Identifies the presence of weapons in the video content. The AI - Content Moderation API is an invaluable tool for managing and controlling the - type of content being shared or streamed on your platform. By implementing - this API, you can ensure compliance with community guidelines and legal - requirements, as well as provide a safer environment for your users. Important - notes: + - `sport`: Recognizes various sporting activities. The AI Content Moderation API + is an invaluable tool for managing and controlling the type of content being + shared or streamed on your platform. By implementing this API, you can ensure + compliance with community guidelines and legal requirements, as well as + provide a safer environment for your users. Important notes: - It's allowed to analyse still images too (where applicable). Format of image: JPEG, PNG. In that case one image is the same as video of 1 second duration. - Not all frames in the video are used for analysis, but only key frames @@ -312,7 +306,7 @@ def create( - transcription into the original language is a free procedure, - and translation from the original language into any other languages is a "translation" procedure and is paid. More details in - [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + [POST /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task). Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). @@ -325,7 +319,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", body=maybe_transform( { "task_name": task_name, @@ -406,7 +400,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", page=SyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -457,7 +451,9 @@ def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -484,11 +480,9 @@ def get( - ASR: Transcribe video - ASR: Translate subtitles - CM: Sports detection - - CM: Weapon detection - CM: Not Safe For Work (NSFW) content detection - CM: Soft nudity detection - CM: Hard nudity detection - - CM: Child Sexual Abuse Material (CSAM) detection - CM: Objects recognition (soon) - etc... (see other methods from /ai/ domain) @@ -526,7 +520,9 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -598,7 +594,7 @@ def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/ai/info", + "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -643,8 +639,7 @@ async def create( task_name: Literal["transcription", "content-moderation"], url: str, audio_language: str | NotGiven = NOT_GIVEN, - category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] - | NotGiven = NOT_GIVEN, + category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | NotGiven = NOT_GIVEN, client_entity_data: str | NotGiven = NOT_GIVEN, client_user_id: str | NotGiven = NOT_GIVEN, subtitles_language: str | NotGiven = NOT_GIVEN, @@ -663,11 +658,9 @@ async def create( - ASR: Transcribe video - ASR: Translate subtitles - CM: Sports detection - - CM: Weapon detection - CM: Not Safe For Work (NSFW) content detection - CM: Soft nudity detection - CM: Hard nudity detection - - CM: Child Sexual Abuse Material (CSAM) detection - CM: Objects recognition (soon) ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) How to use: @@ -726,14 +719,11 @@ async def create( - `soft_nudity`: Detailed video analysis that reveals both explicit and partial nudity, including the presence of male and female faces and other uncovered body parts. - - `child_pornography`: Detects child sexual abuse materials (CASM). - - `sport`: Recognizes various sporting activities. - - `weapon`: Identifies the presence of weapons in the video content. The AI - Content Moderation API is an invaluable tool for managing and controlling the - type of content being shared or streamed on your platform. By implementing - this API, you can ensure compliance with community guidelines and legal - requirements, as well as provide a safer environment for your users. Important - notes: + - `sport`: Recognizes various sporting activities. The AI Content Moderation API + is an invaluable tool for managing and controlling the type of content being + shared or streamed on your platform. By implementing this API, you can ensure + compliance with community guidelines and legal requirements, as well as + provide a safer environment for your users. Important notes: - It's allowed to analyse still images too (where applicable). Format of image: JPEG, PNG. In that case one image is the same as video of 1 second duration. - Not all frames in the video are used for analysis, but only key frames @@ -901,7 +891,7 @@ async def create( - transcription into the original language is a free procedure, - and translation from the original language into any other languages is a "translation" procedure and is paid. More details in - [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + [POST /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task). Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). @@ -914,7 +904,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", body=await async_maybe_transform( { "task_name": task_name, @@ -995,7 +985,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", page=AsyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -1046,7 +1036,9 @@ async def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1073,11 +1065,9 @@ async def get( - ASR: Transcribe video - ASR: Translate subtitles - CM: Sports detection - - CM: Weapon detection - CM: Not Safe For Work (NSFW) content detection - CM: Soft nudity detection - CM: Hard nudity detection - - CM: Child Sexual Abuse Material (CSAM) detection - CM: Objects recognition (soon) - etc... (see other methods from /ai/ domain) @@ -1115,7 +1105,9 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1187,7 +1179,7 @@ async def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/ai/info", + "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index d8ef434b..9461d5b2 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -76,7 +76,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", body=maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,7 +111,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", body=maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -146,7 +150,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", page=SyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -183,7 +189,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -214,7 +222,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -245,7 +255,9 @@ def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -306,7 +318,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -339,7 +353,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -376,7 +392,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", page=AsyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -413,7 +431,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -444,7 +464,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -475,7 +497,9 @@ async def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 438d9de8..345cfc7a 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -72,7 +72,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/directories", + "/streaming/directories" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories", body=maybe_transform( { "name": name, @@ -117,7 +119,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", body=maybe_transform( { "name": name, @@ -163,7 +167,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -196,7 +202,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -219,7 +227,9 @@ def get_tree( directories in video hosting. """ return self._get( - "/streaming/directories/tree", + "/streaming/directories/tree" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,7 +286,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/directories", + "/streaming/directories" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories", body=await async_maybe_transform( { "name": name, @@ -321,7 +333,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", body=await async_maybe_transform( { "name": name, @@ -367,7 +381,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -400,7 +416,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -423,7 +441,9 @@ async def get_tree( directories in video hosting. """ return await self._get( - "/streaming/directories/tree", + "/streaming/directories/tree" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/players.py b/src/gcore/resources/streaming/players.py index 826e015a..942e32b9 100644 --- a/src/gcore/resources/streaming/players.py +++ b/src/gcore/resources/streaming/players.py @@ -72,7 +72,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", body=maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,7 +109,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", body=maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -144,7 +146,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", page=SyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -181,7 +183,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -212,7 +216,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +250,9 @@ def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - f"/streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,7 +309,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", body=await async_maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -338,7 +346,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", body=await async_maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -373,7 +383,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", page=AsyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -410,7 +420,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +453,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,7 +487,9 @@ async def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - f"/streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index fba76526..c9b9c691 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -204,7 +204,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", body=maybe_transform( { "active": active, @@ -335,7 +337,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", body=maybe_transform( { "active": active, @@ -388,7 +392,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", page=SyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -425,7 +431,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -456,7 +464,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -487,7 +497,9 @@ def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -672,7 +684,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", body=await async_maybe_transform( { "active": active, @@ -803,7 +817,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", body=await async_maybe_transform( { "active": active, @@ -856,7 +872,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", page=AsyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -893,7 +911,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -924,7 +944,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -955,7 +977,9 @@ async def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index 80e051f3..a80ce0b3 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -65,7 +65,7 @@ def list( [documentation](https://gcore.com/docs/streaming-platform/live-streams-and-videos-protocols-and-codecs/output-parameters-after-transcoding-bitrate-frame-rate-and-codecs). These values are the default for everyone. There is no need to configure anything additional. Read more about qiality in our blog - [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality/). + [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality). ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) Only for those cases when, in addition to the main parameters, it is necessary to use your own, then it is necessary to use custom quality sets. How to use: @@ -91,7 +91,9 @@ def list( is a paid feature. """ return self._get( - "/streaming/quality_sets", + "/streaming/quality_sets" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -137,7 +139,9 @@ def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - "/streaming/quality_sets/default", + "/streaming/quality_sets/default" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets/default", body=maybe_transform( { "live": live, @@ -196,7 +200,7 @@ async def list( [documentation](https://gcore.com/docs/streaming-platform/live-streams-and-videos-protocols-and-codecs/output-parameters-after-transcoding-bitrate-frame-rate-and-codecs). These values are the default for everyone. There is no need to configure anything additional. Read more about qiality in our blog - [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality/). + [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality). ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) Only for those cases when, in addition to the main parameters, it is necessary to use your own, then it is necessary to use custom quality sets. How to use: @@ -222,7 +226,9 @@ async def list( is a paid feature. """ return await self._get( - "/streaming/quality_sets", + "/streaming/quality_sets" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -268,7 +274,9 @@ async def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - "/streaming/quality_sets/default", + "/streaming/quality_sets/default" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets/default", body=await async_maybe_transform( { "live": live, diff --git a/src/gcore/resources/streaming/restreams.py b/src/gcore/resources/streaming/restreams.py index 78880ed4..1d703166 100644 --- a/src/gcore/resources/streaming/restreams.py +++ b/src/gcore/resources/streaming/restreams.py @@ -67,7 +67,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", body=maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -100,7 +102,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", body=maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -135,7 +139,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", page=SyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -172,7 +178,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,7 +211,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -256,7 +266,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", body=await async_maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -289,7 +301,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", body=await async_maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -324,7 +338,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", page=AsyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -361,7 +377,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +410,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 084ee9c2..2b5e440d 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -21,7 +21,6 @@ from ...types.streaming import ( statistic_get_views_params, statistic_get_ffprobes_params, - statistic_get_meet_series_params, statistic_get_stream_series_params, statistic_get_views_heatmap_params, statistic_get_popular_videos_params, @@ -46,7 +45,6 @@ ) from ...types.streaming.views import Views from ...types.streaming.ffprobes import Ffprobes -from ...types.streaming.meet_series import MeetSeries from ...types.streaming.stream_series import StreamSeries from ...types.streaming.views_heatmap import ViewsHeatmap from ...types.streaming.popular_videos import PopularVideos @@ -125,7 +123,9 @@ def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -190,7 +190,9 @@ def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -256,7 +258,9 @@ def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -317,7 +321,9 @@ def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -370,7 +376,9 @@ def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/max_stream", + "/streaming/statistics/max_stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -388,58 +396,6 @@ def get_max_streams_series( cast_to=MaxStreamSeries, ) - def get_meet_series( - self, - *, - from_: str, - to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MeetSeries: - """Calculates time series of the transcoding minutes of all streams. - - The data is - updated near realtime. - - Args: - from_: Start of time frame. Datetime in ISO 8601 format. - - to: End of time frame. Datetime in ISO 8601 format. - - granularity: specifies the time interval for grouping data - - 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( - "/streaming/statistics/meet", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "from_": from_, - "to": to, - "granularity": granularity, - }, - statistic_get_meet_series_params.StatisticGetMeetSeriesParams, - ), - ), - cast_to=MeetSeries, - ) - def get_popular_videos( self, *, @@ -475,7 +431,9 @@ def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/popular", + "/streaming/statistics/popular" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -526,7 +484,9 @@ def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/storage", + "/streaming/statistics/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -578,7 +538,9 @@ def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream", + "/streaming/statistics/stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -651,7 +613,9 @@ def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/uniqs", + "/streaming/statistics/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -738,7 +702,9 @@ def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -812,7 +778,9 @@ def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/views", + "/streaming/statistics/views" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -869,7 +837,9 @@ def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/browsers", + "/streaming/statistics/browsers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -920,7 +890,9 @@ def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/countries", + "/streaming/statistics/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -971,7 +943,9 @@ def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/hosts", + "/streaming/statistics/hosts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1022,7 +996,9 @@ def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/systems", + "/streaming/statistics/systems" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1073,7 +1049,9 @@ def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/embeds", + "/streaming/statistics/embeds" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1124,7 +1102,9 @@ def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/regions", + "/streaming/statistics/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1184,7 +1164,9 @@ def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/heatmap", + "/streaming/statistics/heatmap" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1234,7 +1216,9 @@ def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1282,7 +1266,9 @@ def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1343,7 +1329,9 @@ def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1409,7 +1397,9 @@ def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1470,7 +1460,9 @@ def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1547,7 +1539,9 @@ async def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1612,7 +1606,9 @@ async def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1678,7 +1674,9 @@ async def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1739,7 +1737,9 @@ async def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1792,7 +1792,9 @@ async def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/max_stream", + "/streaming/statistics/max_stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1810,58 +1812,6 @@ async def get_max_streams_series( cast_to=MaxStreamSeries, ) - async def get_meet_series( - self, - *, - from_: str, - to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MeetSeries: - """Calculates time series of the transcoding minutes of all streams. - - The data is - updated near realtime. - - Args: - from_: Start of time frame. Datetime in ISO 8601 format. - - to: End of time frame. Datetime in ISO 8601 format. - - granularity: specifies the time interval for grouping data - - 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( - "/streaming/statistics/meet", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "from_": from_, - "to": to, - "granularity": granularity, - }, - statistic_get_meet_series_params.StatisticGetMeetSeriesParams, - ), - ), - cast_to=MeetSeries, - ) - async def get_popular_videos( self, *, @@ -1897,7 +1847,9 @@ async def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/popular", + "/streaming/statistics/popular" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1948,7 +1900,9 @@ async def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/storage", + "/streaming/statistics/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2000,7 +1954,9 @@ async def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream", + "/streaming/statistics/stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2073,7 +2029,9 @@ async def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/uniqs", + "/streaming/statistics/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2160,7 +2118,9 @@ async def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2234,7 +2194,9 @@ async def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/views", + "/streaming/statistics/views" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2291,7 +2253,9 @@ async def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/browsers", + "/streaming/statistics/browsers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2342,7 +2306,9 @@ async def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/countries", + "/streaming/statistics/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2393,7 +2359,9 @@ async def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/hosts", + "/streaming/statistics/hosts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2444,7 +2412,9 @@ async def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/systems", + "/streaming/statistics/systems" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2495,7 +2465,9 @@ async def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/embeds", + "/streaming/statistics/embeds" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2546,7 +2518,9 @@ async def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/regions", + "/streaming/statistics/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2606,7 +2580,9 @@ async def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/heatmap", + "/streaming/statistics/heatmap" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2656,7 +2632,9 @@ async def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2704,7 +2682,9 @@ async def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2765,7 +2745,9 @@ async def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2831,7 +2813,9 @@ async def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2892,7 +2876,9 @@ async def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2931,9 +2917,6 @@ def __init__(self, statistics: StatisticsResource) -> None: self.get_max_streams_series = to_raw_response_wrapper( statistics.get_max_streams_series, ) - self.get_meet_series = to_raw_response_wrapper( - statistics.get_meet_series, - ) self.get_popular_videos = to_raw_response_wrapper( statistics.get_popular_videos, ) @@ -3009,9 +2992,6 @@ def __init__(self, statistics: AsyncStatisticsResource) -> None: self.get_max_streams_series = async_to_raw_response_wrapper( statistics.get_max_streams_series, ) - self.get_meet_series = async_to_raw_response_wrapper( - statistics.get_meet_series, - ) self.get_popular_videos = async_to_raw_response_wrapper( statistics.get_popular_videos, ) @@ -3087,9 +3067,6 @@ def __init__(self, statistics: StatisticsResource) -> None: self.get_max_streams_series = to_streamed_response_wrapper( statistics.get_max_streams_series, ) - self.get_meet_series = to_streamed_response_wrapper( - statistics.get_meet_series, - ) self.get_popular_videos = to_streamed_response_wrapper( statistics.get_popular_videos, ) @@ -3165,9 +3142,6 @@ def __init__(self, statistics: AsyncStatisticsResource) -> None: self.get_max_streams_series = async_to_streamed_response_wrapper( statistics.get_max_streams_series, ) - self.get_meet_series = async_to_streamed_response_wrapper( - statistics.get_meet_series, - ) self.get_popular_videos = async_to_streamed_response_wrapper( statistics.get_popular_videos, ) diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index 88bf963c..58dfaf62 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -123,7 +123,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -150,7 +152,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Overlay: """ - Updates overlay's settings + Updates overlay settings Args: height: Height of the widget @@ -175,7 +177,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", body=maybe_transform( { "height": height, @@ -217,7 +221,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,7 +256,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -270,7 +278,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Overlay: """ - Returns overlay details + Get overlay details Args: extra_headers: Send extra headers @@ -282,7 +290,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -314,7 +324,9 @@ def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -420,7 +432,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -447,7 +461,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Overlay: """ - Updates overlay's settings + Updates overlay settings Args: height: Height of the widget @@ -472,7 +486,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", body=await async_maybe_transform( { "height": height, @@ -514,7 +530,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,7 +565,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -567,7 +587,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Overlay: """ - Returns overlay details + Get overlay details Args: extra_headers: Send extra headers @@ -579,7 +599,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -611,7 +633,9 @@ async def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 2b048223..06bc5dcc 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -80,7 +80,6 @@ def create( dvr_enabled: bool | NotGiven = NOT_GIVEN, hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN, html_overlay: bool | NotGiven = NOT_GIVEN, - low_latency_enabled: bool | NotGiven = NOT_GIVEN, projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN, pull: bool | NotGiven = NOT_GIVEN, quality_set_id: int | NotGiven = NOT_GIVEN, @@ -113,7 +112,7 @@ def create( for video streams by utilizing Common Media Application Format (CMAF) technology. So you obtain latency from the traditional 30-50 seconds to ±4 seconds only by default. If you need legacy non-low-latency HLS, then look at - HLS MPEGTS delivery below. + HLS MPEG-TS delivery below. You have access to additional functions such as: @@ -184,19 +183,6 @@ def create( html_overlay: Switch on mode to insert and display real-time HTML overlay widgets on top of live streams - low_latency_enabled: Deprecated, always returns "true". The only exception is that the attribute can - only be used by clients that have previously used the old stream format. This - method is outdated since we've made it easier to manage streams. For your - convenience, you no longer need to set this parameter at the stage of creating a - stream. Now all streams are prepared in 2 formats simultaniously: Low Latency - and Legacy. You can get the desired output format in the attributes - "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. - - --- - - Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the - "`hls_mpegts_url`" attribute instead. - projection: Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, then use parameters of that video player. Modes: @@ -210,9 +196,10 @@ def create( values: - true – stream is received by PULL method. Use this when need to get stream - from external server by srt, rtmp\\ss, hls, dash, etc protocols. + from external server. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + from end-device to our Streaming Platform, i.e. from your encoder, mobile app + or OBS Studio. quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to your conditions. Look at GET /`quality_sets` method @@ -230,10 +217,11 @@ def create( round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 24 hours of - inactivity of your streams we will stop PULL-ing, and will switch "active" field - to "false". Please, note that this field is for PULL only, so is not suitable - for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 2 hours of + inactivity of your original stream, the system stops PULL requests and the + stream is deactivated (the "active" field switches to "false"). Please, note + that this field is for PULL only, so is not suitable for PUSH. Look at fields + "`push_url`" and "`push_url_srt`" from GET method. extra_headers: Send extra headers @@ -244,7 +232,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", body=maybe_transform( { "name": name, @@ -258,7 +246,6 @@ def create( "dvr_enabled": dvr_enabled, "hls_mpegts_endlist_tag": hls_mpegts_endlist_tag, "html_overlay": html_overlay, - "low_latency_enabled": low_latency_enabled, "projection": projection, "pull": pull, "quality_set_id": quality_set_id, @@ -298,7 +285,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", body=maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -318,7 +307,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncPageStreaming[Stream]: - """Returns a list of streams. + """Returns a list of streams Args: page: Query parameter. @@ -337,7 +326,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", page=SyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -396,7 +385,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -428,7 +419,9 @@ def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -536,7 +529,9 @@ def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", body=maybe_transform( { "duration": duration, @@ -576,7 +571,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -625,7 +622,9 @@ def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -693,7 +692,9 @@ def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -730,7 +731,9 @@ def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -776,7 +779,6 @@ async def create( dvr_enabled: bool | NotGiven = NOT_GIVEN, hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN, html_overlay: bool | NotGiven = NOT_GIVEN, - low_latency_enabled: bool | NotGiven = NOT_GIVEN, projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN, pull: bool | NotGiven = NOT_GIVEN, quality_set_id: int | NotGiven = NOT_GIVEN, @@ -809,7 +811,7 @@ async def create( for video streams by utilizing Common Media Application Format (CMAF) technology. So you obtain latency from the traditional 30-50 seconds to ±4 seconds only by default. If you need legacy non-low-latency HLS, then look at - HLS MPEGTS delivery below. + HLS MPEG-TS delivery below. You have access to additional functions such as: @@ -880,19 +882,6 @@ async def create( html_overlay: Switch on mode to insert and display real-time HTML overlay widgets on top of live streams - low_latency_enabled: Deprecated, always returns "true". The only exception is that the attribute can - only be used by clients that have previously used the old stream format. This - method is outdated since we've made it easier to manage streams. For your - convenience, you no longer need to set this parameter at the stage of creating a - stream. Now all streams are prepared in 2 formats simultaniously: Low Latency - and Legacy. You can get the desired output format in the attributes - "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. - - --- - - Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the - "`hls_mpegts_url`" attribute instead. - projection: Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, then use parameters of that video player. Modes: @@ -906,9 +895,10 @@ async def create( values: - true – stream is received by PULL method. Use this when need to get stream - from external server by srt, rtmp\\ss, hls, dash, etc protocols. + from external server. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + from end-device to our Streaming Platform, i.e. from your encoder, mobile app + or OBS Studio. quality_set_id: Custom quality set ID for transcoding, if transcoding is required according to your conditions. Look at GET /`quality_sets` method @@ -926,10 +916,11 @@ async def create( round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 24 hours of - inactivity of your streams we will stop PULL-ing, and will switch "active" field - to "false". Please, note that this field is for PULL only, so is not suitable - for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 2 hours of + inactivity of your original stream, the system stops PULL requests and the + stream is deactivated (the "active" field switches to "false"). Please, note + that this field is for PULL only, so is not suitable for PUSH. Look at fields + "`push_url`" and "`push_url_srt`" from GET method. extra_headers: Send extra headers @@ -940,7 +931,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", body=await async_maybe_transform( { "name": name, @@ -954,7 +945,6 @@ async def create( "dvr_enabled": dvr_enabled, "hls_mpegts_endlist_tag": hls_mpegts_endlist_tag, "html_overlay": html_overlay, - "low_latency_enabled": low_latency_enabled, "projection": projection, "pull": pull, "quality_set_id": quality_set_id, @@ -994,7 +984,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", body=await async_maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1014,7 +1006,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[Stream, AsyncPageStreaming[Stream]]: - """Returns a list of streams. + """Returns a list of streams Args: page: Query parameter. @@ -1033,7 +1025,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", page=AsyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -1092,7 +1084,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1124,7 +1118,9 @@ async def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1232,7 +1228,9 @@ async def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", body=await async_maybe_transform( { "duration": duration, @@ -1272,7 +1270,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1321,7 +1321,9 @@ async def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1389,7 +1391,9 @@ async def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1426,7 +1430,9 @@ async def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index e5823d43..165594a4 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -73,7 +73,7 @@ def create( language code according to ISO-639-2 (bibliographic code). Specify language you need, or just look at our list in the attribute "`audio_language`" of section - ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). You can add multiple subtitles in the same language, language uniqueness is not required. Size must be up to 5Mb. @@ -84,7 +84,7 @@ def create( subtitles based on AI. Read more: - What is - ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). - If the option is enabled via `auto_transcribe_audio_language: auto|`, then immediately after successful transcoding, an AI task will be automatically created for @@ -120,7 +120,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", body=maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -170,7 +172,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", body=maybe_transform( { "language": language, @@ -209,7 +213,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,7 +248,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -274,7 +282,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -332,7 +342,7 @@ async def create( language code according to ISO-639-2 (bibliographic code). Specify language you need, or just look at our list in the attribute "`audio_language`" of section - ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). You can add multiple subtitles in the same language, language uniqueness is not required. Size must be up to 5Mb. @@ -343,7 +353,7 @@ async def create( subtitles based on AI. Read more: - What is - ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). - If the option is enabled via `auto_transcribe_audio_language: auto|`, then immediately after successful transcoding, an AI task will be automatically created for @@ -379,7 +389,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", body=await async_maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -429,7 +441,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", body=await async_maybe_transform( { "language": language, @@ -468,7 +482,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -501,7 +517,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -533,7 +551,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index bee81322..3b1cfbef 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -107,7 +107,7 @@ def create( subtitles based on AI. Read more: - What is - ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). - If the option is enabled via `auto_transcribe_audio_language: auto|`, then immediately after successful transcoding, an AI task will be automatically created for @@ -118,7 +118,7 @@ def create( that. Also you can point several languages to translate to, then a separate subtitle will be generated for each specified language. - How to - ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + ["add AI-generated subtitles to an exist video"](/docs/api-reference/streaming/subtitles/add-subtitle). The created AI-task(s) will be automatically executed, and result will also be automatically attached to this video as subtitle(s). Please note that transcription is done automatically for all videos uploaded to our video @@ -148,7 +148,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", body=maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -226,9 +226,9 @@ def update( More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) + [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified language(s). Can be used both together with `auto_transcribe_audio_language` @@ -371,7 +371,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", body=maybe_transform( { "name": name, @@ -467,7 +469,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", page=SyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -524,7 +526,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -575,7 +579,9 @@ def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos/batch", + "/streaming/videos/batch" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/batch", body=maybe_transform({"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, @@ -625,7 +631,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -685,7 +693,9 @@ def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -719,7 +729,9 @@ def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - "/streaming/videos/names", + "/streaming/videos/names" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -795,7 +807,7 @@ async def create( subtitles based on AI. Read more: - What is - ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). - If the option is enabled via `auto_transcribe_audio_language: auto|`, then immediately after successful transcoding, an AI task will be automatically created for @@ -806,7 +818,7 @@ async def create( that. Also you can point several languages to translate to, then a separate subtitle will be generated for each specified language. - How to - ["add AI-generated subtitles to an exist video"](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + ["add AI-generated subtitles to an exist video"](/docs/api-reference/streaming/subtitles/add-subtitle). The created AI-task(s) will be automatically executed, and result will also be automatically attached to this video as subtitle(s). Please note that transcription is done automatically for all videos uploaded to our video @@ -836,7 +848,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", body=await async_maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -914,9 +926,9 @@ async def update( More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) + [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified language(s). Can be used both together with `auto_transcribe_audio_language` @@ -1059,7 +1071,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", body=await async_maybe_transform( { "name": name, @@ -1155,7 +1169,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", page=AsyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -1212,7 +1226,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1263,7 +1279,9 @@ async def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos/batch", + "/streaming/videos/batch" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/batch", body=await async_maybe_transform( {"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams ), @@ -1317,7 +1335,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1377,7 +1397,9 @@ async def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1411,7 +1433,9 @@ async def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - "/streaming/videos/names", + "/streaming/videos/names" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py index 30c32c1c..96f15cca 100644 --- a/src/gcore/resources/waap/advanced_rules.py +++ b/src/gcore/resources/waap/advanced_rules.py @@ -51,7 +51,9 @@ def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return self._get( - "/waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -91,7 +93,9 @@ async def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return await self._get( - "/waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index 7ce6dca4..9be46769 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -88,7 +88,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", body=maybe_transform( { "name": name, @@ -152,7 +154,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", body=maybe_transform( { "block": block, @@ -210,7 +214,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", page=SyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -258,7 +264,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -291,7 +299,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -349,7 +359,9 @@ def preview( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/preview-custom-page", body=maybe_transform( { "error": error, @@ -430,7 +442,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", body=await async_maybe_transform( { "name": name, @@ -494,7 +508,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", body=await async_maybe_transform( { "block": block, @@ -552,7 +568,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", page=AsyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -600,7 +618,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -633,7 +653,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -691,7 +713,9 @@ async def preview( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/preview-custom-page", body=await async_maybe_transform( { "error": error, diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index e22a838f..6afde6d6 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -97,7 +97,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", body=maybe_transform( { "action": action, @@ -171,7 +173,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -261,7 +265,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", page=SyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -315,7 +321,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -351,7 +359,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -393,7 +403,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,7 +485,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", body=await async_maybe_transform( { "action": action, @@ -547,7 +561,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -637,7 +653,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", page=AsyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -691,7 +709,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -727,7 +747,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -769,7 +791,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py index 6b1f7896..ccd8a883 100644 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -82,7 +82,9 @@ def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -115,7 +117,9 @@ def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -180,7 +184,9 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", page=SyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -231,7 +237,9 @@ def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,7 +289,9 @@ def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", body=maybe_transform( { "description_file_location": description_file_location, @@ -334,7 +344,9 @@ def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", body=maybe_transform( { "file_data": file_data, @@ -400,7 +412,9 @@ async def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -433,7 +447,9 @@ async def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -498,7 +514,9 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", page=AsyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -549,7 +567,9 @@ async def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -599,7 +619,9 @@ async def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", body=await async_maybe_transform( { "description_file_location": description_file_location, @@ -652,7 +674,9 @@ async def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", body=await async_maybe_transform( { "file_data": file_data, diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py index 3e66ea27..cf0c40e5 100644 --- a/src/gcore/resources/waap/domains/api_path_groups.py +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -65,7 +65,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +121,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index fc1dd68c..d372c33b 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -90,7 +90,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", body=maybe_transform( { "http_scheme": http_scheme, @@ -153,7 +155,9 @@ def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", body=maybe_transform( { "api_groups": api_groups, @@ -250,7 +254,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", page=SyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -309,7 +315,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -347,7 +355,9 @@ def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -420,7 +430,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", body=await async_maybe_transform( { "http_scheme": http_scheme, @@ -483,7 +495,9 @@ async def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", body=await async_maybe_transform( { "api_groups": api_groups, @@ -580,7 +594,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", page=AsyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -639,7 +655,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -677,7 +695,9 @@ async def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index f175a192..adc81b2b 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -92,7 +92,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", body=maybe_transform( { "action": action, @@ -155,7 +157,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -225,7 +229,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", page=SyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -278,7 +284,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -315,7 +323,9 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -354,7 +364,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -396,7 +408,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -466,7 +480,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", body=await async_maybe_transform( { "action": action, @@ -529,7 +545,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -599,7 +617,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", page=AsyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -652,7 +672,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -689,7 +711,9 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -728,7 +752,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -770,7 +796,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index cf4135cc..6e0e3bac 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -198,7 +198,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", body=maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -248,7 +250,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains", + "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", page=SyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -299,7 +301,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -332,7 +336,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -365,7 +371,9 @@ def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -403,7 +411,9 @@ def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -501,7 +511,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", body=await async_maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -551,7 +563,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains", + "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", page=AsyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -602,7 +614,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -635,7 +649,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -668,7 +684,9 @@ async def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -706,7 +724,9 @@ async def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index b8600359..bf624cf0 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -91,7 +91,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", body=maybe_transform( { "action": action, @@ -153,7 +155,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -223,7 +227,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", page=SyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -276,7 +282,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -313,7 +321,9 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -352,7 +362,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +406,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -463,7 +477,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", body=await async_maybe_transform( { "action": action, @@ -525,7 +541,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -595,7 +613,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", page=AsyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -648,7 +668,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -685,7 +707,9 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -724,7 +748,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -766,7 +792,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 577332e9..98372746 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -93,7 +93,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", body=maybe_transform( { "author": author, @@ -153,7 +155,9 @@ def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=maybe_transform( { "author": author, @@ -228,7 +232,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", page=SyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -283,7 +289,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -321,7 +329,9 @@ def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +402,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", body=await async_maybe_transform( { "author": author, @@ -452,7 +464,9 @@ async def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=await async_maybe_transform( { "author": author, @@ -527,7 +541,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", page=AsyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -582,7 +598,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -620,7 +638,9 @@ async def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 8fb4ab52..7633f059 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -106,7 +106,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", page=SyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -158,7 +160,9 @@ def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +203,9 @@ def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", body=maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -289,7 +295,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", page=AsyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -341,7 +349,9 @@ async def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,7 +392,9 @@ async def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", body=await async_maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py index fc9cafbf..17c719c1 100644 --- a/src/gcore/resources/waap/domains/settings.py +++ b/src/gcore/resources/waap/domains/settings.py @@ -74,7 +74,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", body=maybe_transform( { "api": api, @@ -114,7 +116,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -175,7 +179,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", body=await async_maybe_transform( { "api": api, @@ -215,7 +221,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index f23b048b..517d55f6 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -98,7 +98,9 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", page=SyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -161,7 +163,9 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", page=SyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -227,7 +231,9 @@ def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -280,7 +286,9 @@ def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -374,7 +382,9 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", page=SyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -440,7 +450,9 @@ def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -520,7 +532,9 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", page=AsyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -583,7 +597,9 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", page=AsyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -649,7 +665,9 @@ async def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -702,7 +720,9 @@ async def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -796,7 +816,9 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", page=AsyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -862,7 +884,9 @@ async def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index e056e67a..0634ffef 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -88,7 +88,9 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types", + "/waap/v1/security-insights/types" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/security-insights/types", page=SyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types", + "/waap/v1/security-insights/types" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/security-insights/types", page=AsyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/ip_info/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py index 7d4d5f1b..12c7beb8 100644 --- a/src/gcore/resources/waap/ip_info/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -95,7 +95,9 @@ def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -142,7 +144,9 @@ def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -189,7 +193,9 @@ def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -229,7 +235,9 @@ def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -274,7 +282,9 @@ def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -323,7 +333,9 @@ def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -372,7 +384,9 @@ def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -415,7 +429,9 @@ def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -479,7 +495,9 @@ async def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -526,7 +544,9 @@ async def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -573,7 +593,9 @@ async def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -613,7 +635,9 @@ async def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -658,7 +682,9 @@ async def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -707,7 +733,9 @@ async def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -756,7 +784,9 @@ async def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -799,7 +829,9 @@ async def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/ip_info/metrics.py b/src/gcore/resources/waap/ip_info/metrics.py index c70d3faa..32f17c80 100644 --- a/src/gcore/resources/waap/ip_info/metrics.py +++ b/src/gcore/resources/waap/ip_info/metrics.py @@ -77,7 +77,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -149,7 +151,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py index f36dcb35..ffe33962 100644 --- a/src/gcore/resources/waap/organizations.py +++ b/src/gcore/resources/waap/organizations.py @@ -82,7 +82,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations", + "/waap/v1/organizations" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/organizations", page=SyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, @@ -160,7 +162,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations", + "/waap/v1/organizations" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/organizations", page=AsyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py index f8258bab..5f64899e 100644 --- a/src/gcore/resources/waap/statistics.py +++ b/src/gcore/resources/waap/statistics.py @@ -87,7 +87,9 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/statistics/series", + "/waap/v1/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -169,7 +171,9 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/statistics/series", + "/waap/v1/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py index df171560..f2ced3d7 100644 --- a/src/gcore/resources/waap/tags.py +++ b/src/gcore/resources/waap/tags.py @@ -88,7 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags", + "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", page=SyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags", + "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", page=AsyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index 3d68c41f..4f621d4e 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -147,7 +147,7 @@ def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return self._get( - "/waap/v1/clients/me", + "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -219,7 +219,7 @@ async def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return await self._get( - "/waap/v1/clients/me", + "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/types/cloud/baremetal/server_rebuild_params.py b/src/gcore/types/cloud/baremetal/server_rebuild_params.py index 5a6e2be6..9addcb49 100644 --- a/src/gcore/types/cloud/baremetal/server_rebuild_params.py +++ b/src/gcore/types/cloud/baremetal/server_rebuild_params.py @@ -9,8 +9,10 @@ class ServerRebuildParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" image_id: str """Image ID""" diff --git a/src/gcore/types/dns/dns_get_account_overview_response.py b/src/gcore/types/dns/dns_get_account_overview_response.py index 35e11fef..6f91a78e 100644 --- a/src/gcore/types/dns/dns_get_account_overview_response.py +++ b/src/gcore/types/dns/dns_get_account_overview_response.py @@ -6,25 +6,10 @@ from ..._models import BaseModel -__all__ = ["DNSGetAccountOverviewResponse", "Client", "Settings"] +__all__ = ["DNSGetAccountOverviewResponse", "Info"] -class Client(BaseModel): - client_id: Optional[int] = None - - enabled: Optional[bool] = None - - reseller: Optional[int] = None - - status: Optional[str] = None - - tariff_id: Optional[int] = None - - tariff_name: Optional[str] = None - """TariffName""" - - -class Settings(BaseModel): +class Info(BaseModel): contact: Optional[str] = None name_server_1: Optional[str] = None @@ -33,7 +18,4 @@ class Settings(BaseModel): class DNSGetAccountOverviewResponse(BaseModel): - client: Optional[Client] = FieldInfo(alias="Client", default=None) - """Client""" - - settings: Optional[Settings] = None + info: Optional[Info] = FieldInfo(alias="Info", default=None) diff --git a/src/gcore/types/dns/zone_get_response.py b/src/gcore/types/dns/zone_get_response.py index 1f43e8ca..912d6f73 100644 --- a/src/gcore/types/dns/zone_get_response.py +++ b/src/gcore/types/dns/zone_get_response.py @@ -45,6 +45,8 @@ class Zone(BaseModel): of getting deleted zones by admin. """ + client_id: Optional[int] = None + contact: Optional[str] = None """email address of the administrator responsible for this zone""" @@ -101,4 +103,4 @@ class Zone(BaseModel): class ZoneGetResponse(BaseModel): zone: Optional[Zone] = FieldInfo(alias="Zone", default=None) - """swagger: model""" + """OutputZone""" diff --git a/src/gcore/types/dns/zone_list_response.py b/src/gcore/types/dns/zone_list_response.py index 3bd194de..6a3826f3 100644 --- a/src/gcore/types/dns/zone_list_response.py +++ b/src/gcore/types/dns/zone_list_response.py @@ -43,6 +43,8 @@ class Zone(BaseModel): of getting deleted zones by admin. """ + client_id: Optional[int] = None + contact: Optional[str] = None """email address of the administrator responsible for this zone""" diff --git a/src/gcore/types/security/client_profile.py b/src/gcore/types/security/client_profile.py index e440f21b..ce945292 100644 --- a/src/gcore/types/security/client_profile.py +++ b/src/gcore/types/security/client_profile.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Optional +from typing import Dict, List, Union, Optional from ..._models import BaseModel from .client_profile_template import ClientProfileTemplate @@ -25,7 +25,7 @@ class Field(BaseModel): validation_schema: Dict[str, object] - field_value: Optional[Dict[str, object]] = None + field_value: Union[object, object, object, object, object, object, None] = None class Options(BaseModel): diff --git a/src/gcore/types/security/profile_create_params.py b/src/gcore/types/security/profile_create_params.py index fbefd31e..84a9e894 100644 --- a/src/gcore/types/security/profile_create_params.py +++ b/src/gcore/types/security/profile_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Union, Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileCreateParams", "Field"] @@ -21,4 +21,4 @@ class ProfileCreateParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Optional[Dict[str, object]] + field_value: Union[object, object, object, object, object, object, None] diff --git a/src/gcore/types/security/profile_recreate_params.py b/src/gcore/types/security/profile_recreate_params.py index b8418275..55c658cb 100644 --- a/src/gcore/types/security/profile_recreate_params.py +++ b/src/gcore/types/security/profile_recreate_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Union, Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileRecreateParams", "Field"] @@ -21,4 +21,4 @@ class ProfileRecreateParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Optional[Dict[str, object]] + field_value: Union[object, object, object, object, object, object, None] diff --git a/src/gcore/types/security/profile_replace_params.py b/src/gcore/types/security/profile_replace_params.py index d4304a67..10af9a9b 100644 --- a/src/gcore/types/security/profile_replace_params.py +++ b/src/gcore/types/security/profile_replace_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Union, Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileReplaceParams", "Field"] @@ -21,4 +21,4 @@ class ProfileReplaceParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Optional[Dict[str, object]] + field_value: Union[object, object, object, object, object, object, None] diff --git a/src/gcore/types/storage/__init__.py b/src/gcore/types/storage/__init__.py index af3eaed9..a323c939 100644 --- a/src/gcore/types/storage/__init__.py +++ b/src/gcore/types/storage/__init__.py @@ -3,7 +3,10 @@ from __future__ import annotations from .storage import Storage as Storage +from .storage_bucket import StorageBucket as StorageBucket from .storage_location import StorageLocation as StorageLocation +from .bucket_list_params import BucketListParams as BucketListParams +from .storage_list_params import StorageListParams as StorageListParams from .storage_usage_total import StorageUsageTotal as StorageUsageTotal from .storage_usage_series import StorageUsageSeries as StorageUsageSeries from .storage_update_params import StorageUpdateParams as StorageUpdateParams diff --git a/src/gcore/types/storage/bucket_list_params.py b/src/gcore/types/storage/bucket_list_params.py new file mode 100644 index 00000000..2914e870 --- /dev/null +++ b/src/gcore/types/storage/bucket_list_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["BucketListParams"] + + +class BucketListParams(TypedDict, total=False): + limit: int + """Max number of records in response""" + + offset: int + """Number of records to skip before beginning to write in response.""" diff --git a/src/gcore/types/storage/buckets/__init__.py b/src/gcore/types/storage/buckets/__init__.py index f5dc4bb9..30ee64dd 100644 --- a/src/gcore/types/storage/buckets/__init__.py +++ b/src/gcore/types/storage/buckets/__init__.py @@ -3,6 +3,7 @@ from __future__ import annotations from .cor_create_params import CorCreateParams as CorCreateParams +from .policy_get_response import PolicyGetResponse as PolicyGetResponse from .storage_bucket_cors import StorageBucketCors as StorageBucketCors from .storage_bucket_policy import StorageBucketPolicy as StorageBucketPolicy from .lifecycle_create_params import LifecycleCreateParams as LifecycleCreateParams diff --git a/src/gcore/types/storage/buckets/cor_create_params.py b/src/gcore/types/storage/buckets/cor_create_params.py index 23555c21..fde3011d 100644 --- a/src/gcore/types/storage/buckets/cor_create_params.py +++ b/src/gcore/types/storage/buckets/cor_create_params.py @@ -14,3 +14,4 @@ class CorCreateParams(TypedDict, total=False): storage_id: Required[int] allowed_origins: Annotated[SequenceNotStr[str], PropertyInfo(alias="allowedOrigins")] + """List of allowed origins for CORS requests""" diff --git a/src/gcore/types/storage/buckets/lifecycle_create_params.py b/src/gcore/types/storage/buckets/lifecycle_create_params.py index f2ff054b..ca31b5cd 100644 --- a/src/gcore/types/storage/buckets/lifecycle_create_params.py +++ b/src/gcore/types/storage/buckets/lifecycle_create_params.py @@ -11,3 +11,8 @@ class LifecycleCreateParams(TypedDict, total=False): storage_id: Required[int] expiration_days: int + """ + Number of days after which objects will be automatically deleted from the + bucket. Must be a positive integer. Common values: 30 for monthly cleanup, 365 + for yearly retention. + """ diff --git a/src/gcore/types/storage/buckets/policy_get_response.py b/src/gcore/types/storage/buckets/policy_get_response.py new file mode 100644 index 00000000..c65505ce --- /dev/null +++ b/src/gcore/types/storage/buckets/policy_get_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["PolicyGetResponse"] + +PolicyGetResponse: TypeAlias = bool diff --git a/src/gcore/types/storage/buckets/storage_bucket_cors.py b/src/gcore/types/storage/buckets/storage_bucket_cors.py index 20a62c1d..0cb18124 100644 --- a/src/gcore/types/storage/buckets/storage_bucket_cors.py +++ b/src/gcore/types/storage/buckets/storage_bucket_cors.py @@ -6,12 +6,13 @@ from ...._models import BaseModel -__all__ = ["StorageBucketCors", "Data"] - - -class Data(BaseModel): - allowed_origins: Optional[List[str]] = FieldInfo(alias="allowedOrigins", default=None) +__all__ = ["StorageBucketCors"] class StorageBucketCors(BaseModel): - data: Optional[Data] = None + allowed_origins: Optional[List[str]] = FieldInfo(alias="allowedOrigins", default=None) + """ + List of allowed origins for Cross-Origin Resource Sharing (CORS) requests. + Contains domains/URLs that are permitted to make cross-origin requests to this + bucket. + """ diff --git a/src/gcore/types/storage/buckets/storage_bucket_policy.py b/src/gcore/types/storage/buckets/storage_bucket_policy.py index 6535a173..ea5bac8f 100644 --- a/src/gcore/types/storage/buckets/storage_bucket_policy.py +++ b/src/gcore/types/storage/buckets/storage_bucket_policy.py @@ -1,13 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional - -from pydantic import Field as FieldInfo - -from ...._models import BaseModel +from typing_extensions import TypeAlias __all__ = ["StorageBucketPolicy"] - -class StorageBucketPolicy(BaseModel): - enabled_http_access: Optional[bool] = FieldInfo(alias="enabledHttpAccess", default=None) +StorageBucketPolicy: TypeAlias = bool diff --git a/src/gcore/types/storage/credential_recreate_params.py b/src/gcore/types/storage/credential_recreate_params.py index 6ddf0375..d0b7c608 100644 --- a/src/gcore/types/storage/credential_recreate_params.py +++ b/src/gcore/types/storage/credential_recreate_params.py @@ -9,11 +9,28 @@ class CredentialRecreateParams(TypedDict, total=False): delete_sftp_password: bool + """Remove the SFTP password, disabling password authentication. + + Only applicable to SFTP storage type. + """ generate_s3_keys: bool + """Generate new S3 access and secret keys for S3 storage. + + Only applicable to S3 storage type. + """ generate_sftp_password: bool + """Generate a new random password for SFTP access. + + Only applicable to SFTP storage type. + """ reset_sftp_keys: bool + """Reset/remove all SSH keys associated with the SFTP storage. + + Only applicable to SFTP storage type. + """ sftp_password: str + """Set a custom password for SFTP access. Only applicable to SFTP storage type.""" diff --git a/src/gcore/types/storage/storage.py b/src/gcore/types/storage/storage.py index c05b5906..6c02f31b 100644 --- a/src/gcore/types/storage/storage.py +++ b/src/gcore/types/storage/storage.py @@ -10,59 +10,92 @@ class CredentialsKey(BaseModel): id: Optional[int] = None + """Unique identifier for the SSH key""" created_at: Optional[str] = None + """ISO 8601 timestamp when the SSH key was created""" name: Optional[str] = None + """User-defined name for the SSH key""" class CredentialsS3(BaseModel): access_key: Optional[str] = None + """S3-compatible access key identifier for authentication""" secret_key: Optional[str] = None + """S3-compatible secret key for authentication (keep secure)""" class Credentials(BaseModel): keys: Optional[List[CredentialsKey]] = None + """SSH public keys associated with SFTP storage for passwordless authentication""" s3: Optional[CredentialsS3] = None sftp_password: Optional[str] = None + """ + Generated or user-provided password for SFTP access (only present for SFTP + storage type) + """ class Storage(BaseModel): - id: Optional[int] = None + id: int + """Unique identifier for the storage instance""" - address: Optional[str] = None + address: str + """Full hostname/address for accessing the storage endpoint""" - can_restore: Optional[bool] = None + client_id: int + """Client identifier who owns this storage""" - client_id: Optional[int] = None + created_at: str + """ISO 8601 timestamp when the storage was created""" - created_at: Optional[str] = None + location: Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"] + """Geographic location code where the storage is provisioned""" + + name: str + """User-defined name for the storage instance""" + + provisioning_status: Literal["creating", "ok", "updating", "deleting", "deleted"] + """Current provisioning status of the storage instance""" + + reseller_id: int + """Reseller technical client ID associated with the client""" + + type: Literal["sftp", "s3"] + """ + Storage protocol type - either S3-compatible object storage or SFTP file + transfer + """ + + can_restore: Optional[bool] = None + """ + Whether this storage can be restored if deleted (S3 storages only, within 2 + weeks) + """ credentials: Optional[Credentials] = None custom_config_file: Optional[bool] = None + """Whether custom configuration file is used for this storage""" deleted_at: Optional[str] = None + """ + ISO 8601 timestamp when the storage was deleted (only present for deleted + storages) + """ disable_http: Optional[bool] = None + """Whether HTTP access is disabled for this storage (HTTPS only)""" expires: Optional[str] = None - - location: Optional[ - Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"] - ] = None - - name: Optional[str] = None - - provisioning_status: Optional[str] = None - - reseller_id: Optional[int] = None + """ISO 8601 timestamp when the storage will expire (if set)""" rewrite_rules: Optional[Dict[str, str]] = None + """Custom URL rewrite rules for the storage (admin-configurable)""" server_alias: Optional[str] = None - - type: Optional[Literal["sftp", "s3"]] = None + """Custom domain alias for accessing the storage""" diff --git a/src/gcore/types/storage/storage_bucket.py b/src/gcore/types/storage/storage_bucket.py new file mode 100644 index 00000000..83f79de5 --- /dev/null +++ b/src/gcore/types/storage/storage_bucket.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["StorageBucket"] + + +class StorageBucket(BaseModel): + name: str + """Name of the S3 bucket""" + + lifecycle: Optional[int] = None + """Lifecycle policy expiration days (zero if not set)""" diff --git a/src/gcore/types/storage/storage_list_params.py b/src/gcore/types/storage/storage_list_params.py new file mode 100644 index 00000000..830c81c9 --- /dev/null +++ b/src/gcore/types/storage/storage_list_params.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["StorageListParams"] + + +class StorageListParams(TypedDict, total=False): + id: str + """Filter by storage ID""" + + limit: int + """Max number of records in response""" + + location: str + """Filter by storage location/region""" + + name: str + """Filter by storage name (exact match)""" + + offset: int + """Number 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""" + + show_deleted: bool + """Include deleted storages in the response""" + + status: Literal["active", "suspended", "deleted", "pending"] + """Filter by storage status""" + + type: Literal["s3", "sftp"] + """Filter by storage type""" diff --git a/src/gcore/types/storage/storage_location.py b/src/gcore/types/storage/storage_location.py index f5135296..4805e86b 100644 --- a/src/gcore/types/storage/storage_location.py +++ b/src/gcore/types/storage/storage_location.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional from typing_extensions import Literal from ..._models import BaseModel @@ -9,16 +8,17 @@ class StorageLocation(BaseModel): - id: Optional[int] = None + id: int - address: Optional[str] = None + address: str + """Full hostname/address for accessing the storage endpoint""" - allow_for_new_storage: Optional[Literal["deny", "allow"]] = None + allow_for_new_storage: Literal["deny", "allow"] """ Indicates whether new storage can be created in this location: `allow` enables storage creation, `deny` prevents it """ - name: Optional[Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"]] = None + name: Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"] - type: Optional[Literal["s3", "sftp"]] = None + type: Literal["s3", "sftp"] diff --git a/src/gcore/types/storage/storage_update_params.py b/src/gcore/types/storage/storage_update_params.py index f9cef8d7..5454b294 100644 --- a/src/gcore/types/storage/storage_update_params.py +++ b/src/gcore/types/storage/storage_update_params.py @@ -9,5 +9,10 @@ class StorageUpdateParams(TypedDict, total=False): expires: str + """ISO 8601 timestamp when the storage should expire. + + Leave empty to remove expiration. + """ server_alias: str + """Custom domain alias for accessing the storage. Leave empty to remove alias.""" diff --git a/src/gcore/types/streaming/__init__.py b/src/gcore/types/streaming/__init__.py index d64adf6e..b58b2e1d 100644 --- a/src/gcore/types/streaming/__init__.py +++ b/src/gcore/types/streaming/__init__.py @@ -13,7 +13,6 @@ from .restream import Restream as Restream from .subtitle import Subtitle as Subtitle from .broadcast import Broadcast as Broadcast -from .meet_series import MeetSeries as MeetSeries from .player_param import PlayerParam as PlayerParam from .quality_sets import QualitySets as QualitySets from .stream_series import StreamSeries as StreamSeries @@ -67,7 +66,6 @@ from .directory_update_params import DirectoryUpdateParams as DirectoryUpdateParams from .video_list_names_params import VideoListNamesParams as VideoListNamesParams from .direct_upload_parameters import DirectUploadParameters as DirectUploadParameters -from .ai_contentmoderation_casm import AIContentmoderationCasm as AIContentmoderationCasm from .ai_contentmoderation_nsfw import AIContentmoderationNsfw as AIContentmoderationNsfw from .stream_create_clip_params import StreamCreateClipParams as StreamCreateClipParams from .views_by_operating_system import ViewsByOperatingSystem as ViewsByOperatingSystem @@ -75,7 +73,6 @@ from .broadcast_spectators_count import BroadcastSpectatorsCount as BroadcastSpectatorsCount from .statistic_get_views_params import StatisticGetViewsParams as StatisticGetViewsParams from .stream_list_clips_response import StreamListClipsResponse as StreamListClipsResponse -from .ai_contentmoderation_weapon import AIContentmoderationWeapon as AIContentmoderationWeapon from .video_create_multiple_params import VideoCreateMultipleParams as VideoCreateMultipleParams from .playlist_list_videos_response import PlaylistListVideosResponse as PlaylistListVideosResponse from .statistic_get_ffprobes_params import StatisticGetFfprobesParams as StatisticGetFfprobesParams @@ -86,7 +83,6 @@ from .ai_contentmoderation_softnudity import AIContentmoderationSoftnudity as AIContentmoderationSoftnudity from .stream_start_recording_response import StreamStartRecordingResponse as StreamStartRecordingResponse from .ai_task_get_ai_settings_response import AITaskGetAISettingsResponse as AITaskGetAISettingsResponse -from .statistic_get_meet_series_params import StatisticGetMeetSeriesParams as StatisticGetMeetSeriesParams from .vod_total_stream_duration_series import VodTotalStreamDurationSeries as VodTotalStreamDurationSeries from .statistic_get_stream_series_params import StatisticGetStreamSeriesParams as StatisticGetStreamSeriesParams from .statistic_get_views_heatmap_params import StatisticGetViewsHeatmapParams as StatisticGetViewsHeatmapParams diff --git a/src/gcore/types/streaming/ai_contentmoderation_casm.py b/src/gcore/types/streaming/ai_contentmoderation_casm.py deleted file mode 100644 index be44029f..00000000 --- a/src/gcore/types/streaming/ai_contentmoderation_casm.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["AIContentmoderationCasm"] - - -class AIContentmoderationCasm(BaseModel): - category: Literal["child_pornography", "sport", "weapon", "nsfw", "hard_nudity", "soft_nudity"] - """AI content moderation with child pornography detection algorithm""" - - task_name: Literal["content-moderation"] - """Name of the task to be performed""" - - url: str - """URL to the MP4 file to analyse. - - File must be publicly accessible via HTTP/HTTPS. - """ - - client_entity_data: Optional[str] = None - """ - Meta parameter, designed to store your own extra information about a video - entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. - """ - - client_user_id: Optional[str] = None - """Meta parameter, designed to store your own identifier. - - Can be used by you to tag requests from different end-users. It is not used in - any way in video processing. - """ diff --git a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py index 4dd49d55..61517f1a 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py +++ b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py @@ -9,7 +9,7 @@ class AIContentmoderationHardnudity(BaseModel): - category: Literal["hard_nudity", "sport", "weapon", "nsfw", "soft_nudity", "child_pornography"] + category: Literal["hard_nudity", "sport", "nsfw", "soft_nudity"] """AI content moderation with "`hard_nudity`" algorithm""" task_name: Literal["content-moderation"] diff --git a/src/gcore/types/streaming/ai_contentmoderation_nsfw.py b/src/gcore/types/streaming/ai_contentmoderation_nsfw.py index c2df5d03..e7c3436b 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_nsfw.py +++ b/src/gcore/types/streaming/ai_contentmoderation_nsfw.py @@ -9,7 +9,7 @@ class AIContentmoderationNsfw(BaseModel): - category: Literal["nsfw", "sport", "weapon", "hard_nudity", "soft_nudity", "child_pornography"] + category: Literal["nsfw", "sport", "hard_nudity", "soft_nudity"] """AI content moderation with NSFW detection algorithm""" task_name: Literal["content-moderation"] diff --git a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py index 8c169401..5c0b7f3c 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py +++ b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py @@ -9,7 +9,7 @@ class AIContentmoderationSoftnudity(BaseModel): - category: Literal["soft_nudity", "sport", "weapon", "nsfw", "hard_nudity", "child_pornography"] + category: Literal["soft_nudity", "sport", "nsfw", "hard_nudity"] """AI content moderation with "`soft_nudity`" algorithm""" task_name: Literal["content-moderation"] diff --git a/src/gcore/types/streaming/ai_contentmoderation_sport.py b/src/gcore/types/streaming/ai_contentmoderation_sport.py index 34c8974e..78c5b629 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_sport.py +++ b/src/gcore/types/streaming/ai_contentmoderation_sport.py @@ -9,7 +9,7 @@ class AIContentmoderationSport(BaseModel): - category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] + category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] """AI content moderation with types of sports activity detection""" task_name: Literal["content-moderation"] diff --git a/src/gcore/types/streaming/ai_contentmoderation_weapon.py b/src/gcore/types/streaming/ai_contentmoderation_weapon.py deleted file mode 100644 index b0e8c452..00000000 --- a/src/gcore/types/streaming/ai_contentmoderation_weapon.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["AIContentmoderationWeapon"] - - -class AIContentmoderationWeapon(BaseModel): - category: Literal["weapon", "sport", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] - """AI content moderation with weapon detection algorithm""" - - task_name: Literal["content-moderation"] - """Name of the task to be performed""" - - url: str - """URL to the MP4 file to analyse. - - File must be publicly accessible via HTTP/HTTPS. - """ - - client_entity_data: Optional[str] = None - """ - Meta parameter, designed to store your own extra information about a video - entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. - """ - - client_user_id: Optional[str] = None - """Meta parameter, designed to store your own identifier. - - Can be used by you to tag requests from different end-users. It is not used in - any way in video processing. - """ diff --git a/src/gcore/types/streaming/ai_task.py b/src/gcore/types/streaming/ai_task.py index acf9b2ee..fd114dea 100644 --- a/src/gcore/types/streaming/ai_task.py +++ b/src/gcore/types/streaming/ai_task.py @@ -4,10 +4,8 @@ from typing_extensions import Literal, TypeAlias from ..._models import BaseModel -from .ai_contentmoderation_casm import AIContentmoderationCasm from .ai_contentmoderation_nsfw import AIContentmoderationNsfw from .ai_contentmoderation_sport import AIContentmoderationSport -from .ai_contentmoderation_weapon import AIContentmoderationWeapon from .ai_contentmoderation_hardnudity import AIContentmoderationHardnudity from .ai_contentmoderation_softnudity import AIContentmoderationSoftnudity @@ -163,7 +161,7 @@ class TaskDataAITranscribe(BaseModel): - transcription into the original language is a free procedure, - and translation from the original language into any other languages is a "translation" procedure and is paid. More details in - [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + [POST /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task). Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). """ @@ -174,9 +172,7 @@ class TaskDataAITranscribe(BaseModel): AIContentmoderationNsfw, AIContentmoderationHardnudity, AIContentmoderationSoftnudity, - AIContentmoderationCasm, AIContentmoderationSport, - AIContentmoderationWeapon, ] diff --git a/src/gcore/types/streaming/ai_task_create_params.py b/src/gcore/types/streaming/ai_task_create_params.py index f0fe134f..11bddf89 100644 --- a/src/gcore/types/streaming/ai_task_create_params.py +++ b/src/gcore/types/streaming/ai_task_create_params.py @@ -130,7 +130,7 @@ class AITaskCreateParams(TypedDict, total=False): - 'yor': Yoruba """ - category: Literal["sport", "weapon", "nsfw", "hard_nudity", "soft_nudity", "child_pornography"] + category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] """Model for analysis (content-moderation only). Determines what exactly needs to be found in the video. @@ -162,7 +162,7 @@ class AITaskCreateParams(TypedDict, total=False): - transcription into the original language is a free procedure, - and translation from the original language into any other languages is a "translation" procedure and is paid. More details in - [POST /ai/tasks#transcribe](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task). + [POST /streaming/ai/tasks#transcribe](/docs/api-reference/streaming/ai/create-ai-asr-task). Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). """ diff --git a/src/gcore/types/streaming/ai_task_get_response.py b/src/gcore/types/streaming/ai_task_get_response.py index e9179a3c..8bd63299 100644 --- a/src/gcore/types/streaming/ai_task_get_response.py +++ b/src/gcore/types/streaming/ai_task_get_response.py @@ -16,16 +16,12 @@ "AITaskGetResponseResultAIResultsTranscribeSubtitle", "AITaskGetResponseResultAIResultsContentmoderationSport", "AITaskGetResponseResultAIResultsContentmoderationSportFrame", - "AITaskGetResponseResultAIResultsContentmoderationWeapon", - "AITaskGetResponseResultAIResultsContentmoderationWeaponFrame", "AITaskGetResponseResultAIResultsContentmoderationNsfw", "AITaskGetResponseResultAIResultsContentmoderationNsfwFrame", "AITaskGetResponseResultAIResultsContentmoderationHardnudity", "AITaskGetResponseResultAIResultsContentmoderationHardnudityFrame", "AITaskGetResponseResultAIResultsContentmoderationSoftnudity", "AITaskGetResponseResultAIResultsContentmoderationSoftnudityFrame", - "AITaskGetResponseResultAIResultsContentmoderationCasm", - "AITaskGetResponseResultAIResultsContentmoderationCasmFrame", "AITaskGetResponseResultAIResultsFailure", ] @@ -157,26 +153,6 @@ class AITaskGetResponseResultAIResultsContentmoderationSport(BaseModel): """A boolean value whether any sports were detected""" -class AITaskGetResponseResultAIResultsContentmoderationWeaponFrame(BaseModel): - confidence: Optional[float] = None - """Percentage of probability of identifying the object""" - - frame_number: Optional[int] = FieldInfo(alias="frame-number", default=None) - """Video frame number where object was found""" - - label: Optional[str] = None - """Type of detected object""" - - -class AITaskGetResponseResultAIResultsContentmoderationWeapon(BaseModel): - detection_results: Optional[List[Literal["gun", "heavy weapon", "knife"]]] = None - - frames: Optional[List[AITaskGetResponseResultAIResultsContentmoderationWeaponFrame]] = None - - weapon_detected: Optional[bool] = None - """A boolean value whether any weapon was detected""" - - class AITaskGetResponseResultAIResultsContentmoderationNsfwFrame(BaseModel): confidence: Optional[float] = None """Percentage of probability of identifying the object""" @@ -271,26 +247,6 @@ class AITaskGetResponseResultAIResultsContentmoderationSoftnudity(BaseModel): """A boolean value whether any nudity and other body part was detected""" -class AITaskGetResponseResultAIResultsContentmoderationCasmFrame(BaseModel): - confidence: Optional[float] = None - """Percentage of probability of identifying the object""" - - frame_number: Optional[int] = FieldInfo(alias="frame-number", default=None) - """Video frame number where object was found""" - - label: Optional[str] = None - """Type of detected object""" - - -class AITaskGetResponseResultAIResultsContentmoderationCasm(BaseModel): - child_pornography_detected: Optional[bool] = None - """A boolean value whether child pornography was detected""" - - detection_results: Optional[List[Literal["0-2", "3-9", "10-19"]]] = None - - frames: Optional[List[AITaskGetResponseResultAIResultsContentmoderationCasmFrame]] = None - - class AITaskGetResponseResultAIResultsFailure(BaseModel): error: str @@ -298,11 +254,9 @@ class AITaskGetResponseResultAIResultsFailure(BaseModel): AITaskGetResponseResult: TypeAlias = Union[ AITaskGetResponseResultAIResultsTranscribe, AITaskGetResponseResultAIResultsContentmoderationSport, - AITaskGetResponseResultAIResultsContentmoderationWeapon, AITaskGetResponseResultAIResultsContentmoderationNsfw, AITaskGetResponseResultAIResultsContentmoderationHardnudity, AITaskGetResponseResultAIResultsContentmoderationSoftnudity, - AITaskGetResponseResultAIResultsContentmoderationCasm, AITaskGetResponseResultAIResultsFailure, ] diff --git a/src/gcore/types/streaming/create_video_param.py b/src/gcore/types/streaming/create_video_param.py index 836ecbe5..aed1f153 100644 --- a/src/gcore/types/streaming/create_video_param.py +++ b/src/gcore/types/streaming/create_video_param.py @@ -32,9 +32,9 @@ class CreateVideoParam(TypedDict, total=False): More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) + [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). """ auto_translate_subtitles_language: Literal["disable", "default", ""] diff --git a/src/gcore/types/streaming/meet_series.py b/src/gcore/types/streaming/meet_series.py deleted file mode 100644 index cc71be98..00000000 --- a/src/gcore/types/streaming/meet_series.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import TypeAlias - -from ..._models import BaseModel - -__all__ = ["MeetSeries", "MeetSeriesItem", "MeetSeriesItemMetrics"] - - -class MeetSeriesItemMetrics(BaseModel): - max_meet_usage: Optional[List[int]] = None - - meet: Optional[List[List[int]]] = None - - -class MeetSeriesItem(BaseModel): - client: int - - metrics: MeetSeriesItemMetrics - - -MeetSeries: TypeAlias = List[MeetSeriesItem] diff --git a/src/gcore/types/streaming/playlist_video.py b/src/gcore/types/streaming/playlist_video.py index d1b6e241..309b5362 100644 --- a/src/gcore/types/streaming/playlist_video.py +++ b/src/gcore/types/streaming/playlist_video.py @@ -33,9 +33,9 @@ class PlaylistVideo(BaseModel): More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) + [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). """ auto_translate_subtitles_language: Optional[Literal["disable", "default", ""]] = None diff --git a/src/gcore/types/streaming/statistic_get_meet_series_params.py b/src/gcore/types/streaming/statistic_get_meet_series_params.py deleted file mode 100644 index 7c3e36ce..00000000 --- a/src/gcore/types/streaming/statistic_get_meet_series_params.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["StatisticGetMeetSeriesParams"] - - -class StatisticGetMeetSeriesParams(TypedDict, total=False): - from_: Required[Annotated[str, PropertyInfo(alias="from")]] - """Start of time frame. Datetime in ISO 8601 format.""" - - to: Required[str] - """End of time frame. Datetime in ISO 8601 format.""" - - granularity: Literal["1m", "5m", "15m", "1h", "1d"] - """specifies the time interval for grouping data""" diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py index 4fdc6e54..903a1515 100644 --- a/src/gcore/types/streaming/stream.py +++ b/src/gcore/types/streaming/stream.py @@ -168,7 +168,7 @@ class Stream(BaseModel): - and its possible to enable ±3 sec for LL-HLS, just ask our Support Team. It is also possible to use modifier-attributes, which are described in the - "`hls_mpegts_url`" field above. If you need to get MPEGTS (.ts) chunks, look at + "`hls_mpegts_url`" field above. If you need to get MPEG-TS (.ts) chunks, look at the attribute "`hls_mpegts_url`". Read more information in the article "How Low Latency streaming works" in the @@ -184,13 +184,13 @@ class Stream(BaseModel): hls_mpegts_url: Optional[str] = None """HLS output for legacy devices. - URL for transcoded result of stream in HLS MPEGTS (.ts) format, with .m3u8 link. - Low Latency support: NO. Some legacy devices or software may require MPEGTS - (.ts) segments as a format for streaming, so we provide this options keeping - backward compatibility with any of your existing workflows. For other cases it's - better to use "`hls_cmaf_url`" instead. You can use this legacy HLSv6 format - based on MPEGTS segmenter in parallel with main HLS CMAF. Both formats are - sharing same segments size, manifest length (DVR), etc. + URL for transcoded result of stream in HLS MPEG-TS (.ts) format, with .m3u8 + link. Low Latency support: NO. Some legacy devices or software may require + MPEG-TS (.ts) segments as a format for streaming, so we provide this options + keeping backward compatibility with any of your existing workflows. For other + cases it's better to use "`hls_cmaf_url`" instead. You can use this legacy HLSv6 + format based on MPEG-TS segmenter in parallel with main HLS CMAF. Both formats + are sharing same segments size, manifest length (DVR), etc. It is also possible to use additional modifier-attributes: @@ -245,22 +245,6 @@ class Stream(BaseModel): live: Optional[bool] = None """State of receiving and transcoding master stream from source by main server""" - low_latency_enabled: Optional[bool] = None - """ - Deprecated, always returns "true". The only exception is that the attribute can - only be used by clients that have previously used the old stream format. This - method is outdated since we've made it easier to manage streams. For your - convenience, you no longer need to set this parameter at the stage of creating a - stream. Now all streams are prepared in 2 formats simultaniously: Low Latency - and Legacy. You can get the desired output format in the attributes - "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. - - --- - - Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the - "`hls_mpegts_url`" attribute instead. - """ - projection: Optional[Literal["regular", "vr360", "vr180", "vr360tb"]] = None """ Visualization mode for 360° streams, how the stream is rendered in our web @@ -279,15 +263,19 @@ class Stream(BaseModel): Has two possible values: - true – stream is received by PULL method. Use this when need to get stream - from external server by srt, rtmp\\ss, hls, dash, etc protocols. + from external server. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + from end-device to our Streaming Platform, i.e. from your encoder, mobile app + or OBS Studio. """ push_url: Optional[str] = None """ URL to PUSH master stream to our main server using RTMP and RTMPS protocols. To use RTMPS just manually change the protocol name from "rtmp://" to "rtmps://". + Use only 1 protocol of sending a master stream: eitheronly RTMP/S (`push_url`), + or only SRT (`push_url_srt`). + If you see an error like "invalid SSL certificate" try the following: - Make sure the push URL is correct, and it contains "rtmps://". @@ -295,20 +283,58 @@ class Stream(BaseModel): port 443 in the URL. Here’s an example: rtmps://vp-push.domain.com:443/in/stream?key. - If you're still having trouble, then your encoder may not support RTMPS. - Double-check the documentation for your encoder. For advanced customers only: - For your complexly distributed broadcast systems, it is also possible to - additionally output an array of multi-regional ingestion points for manual - selection from them. To activate this mode, contact your manager or the - Support Team to activate the "`multi_region_push_urls`" attibute. But if you - clearly don’t understand why you need this, then it’s best to use the default - single URL in the "`push_url`" attribute. + 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. For + example, transcoding process will fail if: + + - you are pushing primary and backup RTMP to the same single `push_url` + simultaneously + - you are pushing RTMP to `push_url` and SRT to `push_url_srt` simultaneously + + For advanced customers only: For your complexly distributed broadcast systems, + it is also possible to additionally output an array of multi-regional ingestion + points for manual selection from them. To activate this mode, contact your + manager or the Support Team to activate the "`multi_region_push_urls`" attibute. + But if you clearly don’t understand why you need this, then it’s best to use the + default single URL in the "`push_url`" attribute. """ push_url_srt: Optional[str] = None """ URL to PUSH master stream to our main server using SRT protocol. Use only 1 - protocol of sending a master stream: either only SRT (`push_url_srt`), or only - RTMP (`push_url`). + protocol of sending a master stream: eitheronly RTMP/S (`push_url`), or only SRT + (`push_url_srt`). + + **Setup SRT latency on your sender side** SRT is designed as a low-latency + transport protocol, but real networks are not always stable and in some cases + the end-to-end path from the venue to the ingest point can be long. For this + reason, it is important to configure the latency parameter carefully to match + the actual network conditions. Small latency values may lead to packet loss when + jitter or retransmissions occur, while very large values introduce unnecessary + end-to-end delay. \\**Incorrect or low default value is one of the most common + reasons for packet loss, frames loss, and bad picture.\\** + + We therefore recommend setting latency manually rather than relying on the + default, to ensure the buffer is correctly sized for your environment. A + practical range is 400–2000 ms, with the exact value chosen based on RTT, + jitter, and expected packet loss. Be sure to check and test SRT settings on your + sender side. The default values do not take into account your specific scenarios + and do not work well. If necessary, ask us and we will help you. + + Please note that 1 connection and 1 protocol can be used at a single moment in + time per unique stream key input. Trying to send 2+ connection requests into + `push_url_srt` to once, or 2+ protocols at once will not lead to a result. For + example, transcoding process will fail if: + + - you are pushing primary and backup SRT to the same single `push_url_srt` + simultaneously + - you are pushing RTMP to `push_url` and SRT to `push_url_srt` simultaneously + + See more information and best practices about SRT protocol in the Product + Documentation. """ push_url_whip: Optional[str] = None @@ -321,9 +347,9 @@ class Stream(BaseModel): receives video data. Signaling is a term to describe communication between WebRTC endpoints, needed to initiate and maintain a session. WHIP is an open specification for a simple signaling protocol for starting WebRTC sessions in an - outgoing direction, (i.e., streaming from your device). **WebRTC stream encoding - parameters** At least one video and audio track both must be present in the - stream: + outgoing direction, (i.e., streaming from your device). There is the primary + link only for WHIP, so no backup link. **WebRTC stream encoding parameters** At + least one video and audio track both must be present in the stream: - Video must be encoded with H.264. - Audio must be encoded with OPUS. Note. Specifically for WebRTC mode a method @@ -339,8 +365,18 @@ class Stream(BaseModel): https://stackblitz.com/edit/stackblitz-starters-j2r9ar?file=index.html Also try to use the feature in UI of the Customer Portal. In the Streaming section inside the settings of a specific live stream, a new section "Quick start in - browser" has been added. More information in the Product Documentation on the - website. + browser" has been added. + + Please note that 1 connection and 1 protocol can be used at a single moment in + time per unique stream key input. Trying to send 2+ connection requests into + `push_url_whip` to once, or 2+ protocols at once will not lead to a result. For + example, transcoding process will fail if: + + - you are pushing primary and backup WHIP to the same single `push_url_whip` + simultaneously + - you are pushing WHIP to `push_url_whip` and RTMP to `push_url` simultaneously + + More information in the Product Documentation on the website. """ quality_set_id: Optional[int] = None @@ -407,10 +443,11 @@ class Stream(BaseModel): round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 24 hours of - inactivity of your streams we will stop PULL-ing, and will switch "active" field - to "false". Please, note that this field is for PULL only, so is not suitable - for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 2 hours of + inactivity of your original stream, the system stops PULL requests and the + stream is deactivated (the "active" field switches to "false"). Please, note + that this field is for PULL only, so is not suitable for PUSH. Look at fields + "`push_url`" and "`push_url_srt`" from GET method. """ video_height: Optional[float] = None diff --git a/src/gcore/types/streaming/stream_create_params.py b/src/gcore/types/streaming/stream_create_params.py index 8c19a2d0..a8254826 100644 --- a/src/gcore/types/streaming/stream_create_params.py +++ b/src/gcore/types/streaming/stream_create_params.py @@ -94,22 +94,6 @@ class StreamCreateParams(TypedDict, total=False): live streams """ - low_latency_enabled: bool - """ - Deprecated, always returns "true". The only exception is that the attribute can - only be used by clients that have previously used the old stream format. This - method is outdated since we've made it easier to manage streams. For your - convenience, you no longer need to set this parameter at the stage of creating a - stream. Now all streams are prepared in 2 formats simultaniously: Low Latency - and Legacy. You can get the desired output format in the attributes - "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. - - --- - - Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the - "`hls_mpegts_url`" attribute instead. - """ - projection: Literal["regular", "vr360", "vr180", "vr360tb"] """ Visualization mode for 360° streams, how the stream is rendered in our web @@ -128,9 +112,10 @@ class StreamCreateParams(TypedDict, total=False): Has two possible values: - true – stream is received by PULL method. Use this when need to get stream - from external server by srt, rtmp\\ss, hls, dash, etc protocols. + from external server. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + from end-device to our Streaming Platform, i.e. from your encoder, mobile app + or OBS Studio. """ quality_set_id: int @@ -158,8 +143,9 @@ class StreamCreateParams(TypedDict, total=False): round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 24 hours of - inactivity of your streams we will stop PULL-ing, and will switch "active" field - to "false". Please, note that this field is for PULL only, so is not suitable - for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 2 hours of + inactivity of your original stream, the system stops PULL requests and the + stream is deactivated (the "active" field switches to "false"). Please, note + that this field is for PULL only, so is not suitable for PUSH. Look at fields + "`push_url`" and "`push_url_srt`" from GET method. """ diff --git a/src/gcore/types/streaming/stream_update_params.py b/src/gcore/types/streaming/stream_update_params.py index 0f30b641..ecff938d 100644 --- a/src/gcore/types/streaming/stream_update_params.py +++ b/src/gcore/types/streaming/stream_update_params.py @@ -98,22 +98,6 @@ class Stream(TypedDict, total=False): live streams """ - low_latency_enabled: bool - """ - Deprecated, always returns "true". The only exception is that the attribute can - only be used by clients that have previously used the old stream format. This - method is outdated since we've made it easier to manage streams. For your - convenience, you no longer need to set this parameter at the stage of creating a - stream. Now all streams are prepared in 2 formats simultaniously: Low Latency - and Legacy. You can get the desired output format in the attributes - "`dash_url`", "`hls_cmaf_url`", "`hls_mpegts_url`". Or use them all at once. - - --- - - Note: Links /streams/{id}/playlist.m3u8 are depricated too. Use value of the - "`hls_mpegts_url`" attribute instead. - """ - projection: Literal["regular", "vr360", "vr180", "vr360tb"] """ Visualization mode for 360° streams, how the stream is rendered in our web @@ -132,9 +116,10 @@ class Stream(TypedDict, total=False): Has two possible values: - true – stream is received by PULL method. Use this when need to get stream - from external server by srt, rtmp\\ss, hls, dash, etc protocols. + from external server. - false – stream is received by PUSH method. Use this when need to send stream - from end-device to our Streaming Platform, i.e. from mobile app or OBS Studio. + from end-device to our Streaming Platform, i.e. from your encoder, mobile app + or OBS Studio. """ quality_set_id: int @@ -162,8 +147,9 @@ class Stream(TypedDict, total=False): round robin scheduling. If the first address does not respond, then the next one in the list will be automatically requested, returning to the first and so on in a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 24 hours of - inactivity of your streams we will stop PULL-ing, and will switch "active" field - to "false". Please, note that this field is for PULL only, so is not suitable - for PUSH. Look at fields "`push_url`" and "`push_url_srt`" from GET method. + next one will be selected according to the same scheme. After 2 hours of + inactivity of your original stream, the system stops PULL requests and the + stream is deactivated (the "active" field switches to "false"). Please, note + that this field is for PULL only, so is not suitable for PUSH. Look at fields + "`push_url`" and "`push_url_srt`" from GET method. """ diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py index 2ed91392..42fff728 100644 --- a/src/gcore/types/streaming/video.py +++ b/src/gcore/types/streaming/video.py @@ -32,23 +32,50 @@ class ConvertedVideo(BaseModel): - /videos/{`client_id`}\\__{slug}/{filename}.mp4 - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download={`custom_filename`} The - first option returns the file as is. The following options respond with the - header that directly tells browsers to download the file instead of playing it - in the browser. + first option returns the file as is. Response will be: ``` - Content-Disposition: attachment + GET .mp4 + ... + content-type: video/mp4 + ``` + + 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 ``` The third option allows you to set a custom name for the file being downloaded. You can optionally specify a custom filename (just name excluding the .mp4 - extension) using the download= query. Filename Constraints + extension) using the download= query. Filename constraints: - Length: 1-255 characters - Must NOT include the .mp4 extension (it is added automatically) - Allowed characters: a-z, A-Z, 0-9, \\__(underscore), -(dash), .(dot) - - First character cannot be .(dot) Example valid filenames: `holiday2025`, - `_backup.final`, `clip-v1.2` + - First character cannot be .(dot) + - 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 + ``` + + Examples: + + - Video: + `https://demo-public.gvideo.io/videos/2675_1OFgHZ1FWZNNvx1A/qid3567v1_h264_4050_1080.mp4/download` + - Video with custom download filename: + `https://demo-public.gvideo.io/videos/2675_1OFgHZ1FWZNNvx1A/qid3567v1_h264_4050_1080.mp4/download=highlights_v1.1_2025-05-30` **Default MP4 file name structure** Link to the file {filename} contains information about the encoding method using format: @@ -84,15 +111,6 @@ class ConvertedVideo(BaseModel): - ip: The user’s IP address Example: `?md5=QX39c77lbQKvYgMMAvpyMQ&expires=1743167062` Read more in Product Documentation in Streaming section "Protected temporarily link". - - **Examples** - - - Audio-only: - `https://demo-public.gvideo.io/videos/2675_JNnccG5l97XPxsov/qid3585v1_aac_128_audio.mp4` - - Video: - `https://demo-public.gvideo.io/videos/2675_3MlggU4xDb1Ssa5Y/qid3567v1_h264_4050_1080.mp4/download` - - Video with custom download filename: - `https://demo-public.gvideo.io/videos/2675_XtMKxzJM6Xt7SBUV/1080.mp4/download=highlights_v1.1_2025-05-30` """ name: Optional[str] = None @@ -269,7 +287,7 @@ class Video(BaseModel): There are some link modificators you can specify and add manually: - - ?`no_low_latency` – player is forced to use non-low-latency streams HLS MPEG TS, instead of MPEG-DASH CMAF or HLS/LL-HLS CMAF. + - ?`no_low_latency` – player is forced to use non-low-latency streams HLS MPEG-TS, instead of MPEG-DASH CMAF or HLS/LL-HLS CMAF. - ?t=(integer) – time to start playback from specified point in the video. Applicable for VOD only. - ?`sub_lang`=(language) – force subtitles to specific language (2 letters ISO 639 code of a language). - Read more in the Product Documentation. diff --git a/src/gcore/types/streaming/video_update_params.py b/src/gcore/types/streaming/video_update_params.py index 94c6ca2c..db5ed39f 100644 --- a/src/gcore/types/streaming/video_update_params.py +++ b/src/gcore/types/streaming/video_update_params.py @@ -32,9 +32,9 @@ class VideoUpdateParams(TypedDict, total=False): More details: - List of AI tasks – API - [GET /streaming/ai/tasks](https://api.gcore.com/docs/streaming#tag/AI/operation/get_ai_results) + [GET /streaming/ai/tasks](/docs/api-reference/streaming/ai/get-list-of-ai-tasks) - Add subtitles to an exist video – API - [POST /streaming/videos/{`video_id`}/subtitles](https://api.gcore.com/docs/streaming#tag/Subtitles/operation/post_api_videos_video_id_subtitles). + [POST /streaming/videos/{`video_id`}/subtitles](/docs/api-reference/streaming/subtitles/add-subtitle). """ auto_translate_subtitles_language: Literal["disable", "default", ""] diff --git a/src/gcore/types/waap/domains/waap_request_details.py b/src/gcore/types/waap/domains/waap_request_details.py index 7b560704..e3a1d9cd 100644 --- a/src/gcore/types/waap/domains/waap_request_details.py +++ b/src/gcore/types/waap/domains/waap_request_details.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Dict, List +from datetime import datetime from typing_extensions import Literal from ...._models import BaseModel @@ -151,7 +152,7 @@ class WaapRequestDetails(BaseModel): request_headers: Dict[str, object] """HTTP request headers""" - request_time: str + request_time: datetime """The time of the request""" request_type: str diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index db10a5ea..355896d0 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -164,18 +164,18 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_rebuild(self, client: Gcore) -> None: server = client.cloud.baremetal.servers.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, server, path=["response"]) @parametrize def test_method_rebuild_with_all_params(self, client: Gcore) -> None: server = client.cloud.baremetal.servers.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", user_data="aGVsbG9fd29ybGQ=", ) @@ -184,9 +184,9 @@ def test_method_rebuild_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_rebuild(self, client: Gcore) -> None: response = client.cloud.baremetal.servers.with_raw_response.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -197,9 +197,9 @@ def test_raw_response_rebuild(self, client: Gcore) -> None: @parametrize def test_streaming_response_rebuild(self, client: Gcore) -> None: with client.cloud.baremetal.servers.with_streaming_response.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -214,8 +214,8 @@ def test_path_params_rebuild(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): client.cloud.baremetal.servers.with_raw_response.rebuild( server_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @@ -368,18 +368,18 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_rebuild(self, async_client: AsyncGcore) -> None: server = await async_client.cloud.baremetal.servers.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, server, path=["response"]) @parametrize async def test_method_rebuild_with_all_params(self, async_client: AsyncGcore) -> None: server = await async_client.cloud.baremetal.servers.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, image_id="b5b4d65d-945f-4b98-ab6f-332319c724ef", user_data="aGVsbG9fd29ybGQ=", ) @@ -388,9 +388,9 @@ async def test_method_rebuild_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_rebuild(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.baremetal.servers.with_raw_response.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -401,9 +401,9 @@ async def test_raw_response_rebuild(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_rebuild(self, async_client: AsyncGcore) -> None: async with async_client.cloud.baremetal.servers.with_streaming_response.rebuild( - server_id="server_id", - project_id=0, - region_id=0, + server_id="024a29e-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -418,6 +418,6 @@ async def test_path_params_rebuild(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): await async_client.cloud.baremetal.servers.with_raw_response.rebuild( server_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) diff --git a/tests/api_resources/security/test_profiles.py b/tests/api_resources/security/test_profiles.py index 429291ae..ae9ed3b3 100644 --- a/tests/api_resources/security/test_profiles.py +++ b/tests/api_resources/security/test_profiles.py @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: fields=[ { "base_field": 1, - "field_value": {"key": "bar"}, + "field_value": {}, } ], profile_template=1, @@ -182,7 +182,7 @@ def test_method_recreate_with_all_params(self, client: Gcore) -> None: fields=[ { "base_field": 1, - "field_value": {"key": "bar"}, + "field_value": {}, } ], profile_template=1, @@ -235,7 +235,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: fields=[ { "base_field": 1, - "field_value": {"key": "bar"}, + "field_value": {}, } ], profile_template=1, @@ -292,7 +292,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> fields=[ { "base_field": 1, - "field_value": {"key": "bar"}, + "field_value": {}, } ], profile_template=1, @@ -440,7 +440,7 @@ async def test_method_recreate_with_all_params(self, async_client: AsyncGcore) - fields=[ { "base_field": 1, - "field_value": {"key": "bar"}, + "field_value": {}, } ], profile_template=1, @@ -493,7 +493,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> fields=[ { "base_field": 1, - "field_value": {"key": "bar"}, + "field_value": {}, } ], profile_template=1, diff --git a/tests/api_resources/storage/buckets/test_cors.py b/tests/api_resources/storage/buckets/test_cors.py index 737ec118..a3f12c76 100644 --- a/tests/api_resources/storage/buckets/test_cors.py +++ b/tests/api_resources/storage/buckets/test_cors.py @@ -30,7 +30,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: cor = client.storage.buckets.cors.create( bucket_name="bucket_name", storage_id=0, - allowed_origins=["string"], + allowed_origins=["https://example.com", "https://app.example.com", "*"], ) assert cor is None @@ -129,7 +129,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> cor = await async_client.storage.buckets.cors.create( bucket_name="bucket_name", storage_id=0, - allowed_origins=["string"], + allowed_origins=["https://example.com", "https://app.example.com", "*"], ) assert cor is None diff --git a/tests/api_resources/storage/buckets/test_lifecycle.py b/tests/api_resources/storage/buckets/test_lifecycle.py index 8f88d86d..52e01c12 100644 --- a/tests/api_resources/storage/buckets/test_lifecycle.py +++ b/tests/api_resources/storage/buckets/test_lifecycle.py @@ -28,7 +28,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: lifecycle = client.storage.buckets.lifecycle.create( bucket_name="bucket_name", storage_id=0, - expiration_days=0, + expiration_days=30, ) assert lifecycle is None @@ -127,7 +127,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> lifecycle = await async_client.storage.buckets.lifecycle.create( bucket_name="bucket_name", storage_id=0, - expiration_days=0, + expiration_days=30, ) assert lifecycle is None diff --git a/tests/api_resources/storage/buckets/test_policy.py b/tests/api_resources/storage/buckets/test_policy.py index 667d4ec6..fd0a5c06 100644 --- a/tests/api_resources/storage/buckets/test_policy.py +++ b/tests/api_resources/storage/buckets/test_policy.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.storage.buckets import StorageBucketPolicy +from gcore.types.storage.buckets import PolicyGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -107,7 +107,7 @@ def test_method_get(self, client: Gcore) -> None: bucket_name="bucket_name", storage_id=0, ) - assert_matches_type(StorageBucketPolicy, policy, path=["response"]) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -119,7 +119,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(StorageBucketPolicy, policy, path=["response"]) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -131,7 +131,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(StorageBucketPolicy, policy, path=["response"]) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -239,7 +239,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: bucket_name="bucket_name", storage_id=0, ) - assert_matches_type(StorageBucketPolicy, policy, path=["response"]) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -251,7 +251,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(StorageBucketPolicy, policy, path=["response"]) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -263,7 +263,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(StorageBucketPolicy, policy, path=["response"]) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/storage/test_buckets.py b/tests/api_resources/storage/test_buckets.py index 904e7818..79eb3f8a 100644 --- a/tests/api_resources/storage/test_buckets.py +++ b/tests/api_resources/storage/test_buckets.py @@ -8,6 +8,9 @@ import pytest from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.storage import StorageBucket base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -57,6 +60,46 @@ def test_path_params_create(self, client: Gcore) -> None: storage_id=0, ) + @parametrize + def test_method_list(self, client: Gcore) -> None: + bucket = client.storage.buckets.list( + storage_id=0, + ) + assert_matches_type(SyncOffsetPage[StorageBucket], bucket, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + bucket = client.storage.buckets.list( + storage_id=0, + limit=1, + offset=0, + ) + assert_matches_type(SyncOffsetPage[StorageBucket], bucket, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.storage.buckets.with_raw_response.list( + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bucket = response.parse() + assert_matches_type(SyncOffsetPage[StorageBucket], bucket, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.storage.buckets.with_streaming_response.list( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bucket = response.parse() + assert_matches_type(SyncOffsetPage[StorageBucket], bucket, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_delete(self, client: Gcore) -> None: bucket = client.storage.buckets.delete( @@ -147,6 +190,46 @@ async def test_path_params_create(self, async_client: AsyncGcore) -> None: storage_id=0, ) + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + bucket = await async_client.storage.buckets.list( + storage_id=0, + ) + assert_matches_type(AsyncOffsetPage[StorageBucket], bucket, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + bucket = await async_client.storage.buckets.list( + storage_id=0, + limit=1, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[StorageBucket], bucket, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.buckets.with_raw_response.list( + storage_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bucket = await response.parse() + assert_matches_type(AsyncOffsetPage[StorageBucket], bucket, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.storage.buckets.with_streaming_response.list( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bucket = await response.parse() + assert_matches_type(AsyncOffsetPage[StorageBucket], bucket, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: bucket = await async_client.storage.buckets.delete( diff --git a/tests/api_resources/storage/test_credentials.py b/tests/api_resources/storage/test_credentials.py index 8f02e9d0..caf6bc59 100644 --- a/tests/api_resources/storage/test_credentials.py +++ b/tests/api_resources/storage/test_credentials.py @@ -28,11 +28,11 @@ def test_method_recreate(self, client: Gcore) -> None: def test_method_recreate_with_all_params(self, client: Gcore) -> None: credential = client.storage.credentials.recreate( storage_id=0, - delete_sftp_password=True, + delete_sftp_password=False, generate_s3_keys=True, generate_sftp_password=True, - reset_sftp_keys=True, - sftp_password="sftp_password", + reset_sftp_keys=False, + sftp_password="MyNewSecurePassword123", ) assert_matches_type(Storage, credential, path=["response"]) @@ -77,11 +77,11 @@ async def test_method_recreate(self, async_client: AsyncGcore) -> None: async def test_method_recreate_with_all_params(self, async_client: AsyncGcore) -> None: credential = await async_client.storage.credentials.recreate( storage_id=0, - delete_sftp_password=True, + delete_sftp_password=False, generate_s3_keys=True, generate_sftp_password=True, - reset_sftp_keys=True, - sftp_password="sftp_password", + reset_sftp_keys=False, + sftp_password="MyNewSecurePassword123", ) assert_matches_type(Storage, credential, path=["response"]) diff --git a/tests/api_resources/storage/test_locations.py b/tests/api_resources/storage/test_locations.py index bc4d0d8c..f00cc23f 100644 --- a/tests/api_resources/storage/test_locations.py +++ b/tests/api_resources/storage/test_locations.py @@ -11,6 +11,8 @@ from tests.utils import assert_matches_type from gcore.types.storage import LocationListResponse +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,12 +21,15 @@ class TestLocations: @parametrize def test_method_list(self, client: Gcore) -> None: - location = client.storage.locations.list() + with pytest.warns(DeprecationWarning): + location = client.storage.locations.list() + assert_matches_type(LocationListResponse, location, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.storage.locations.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = client.storage.locations.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -33,12 +38,13 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.storage.locations.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.locations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - location = response.parse() - assert_matches_type(LocationListResponse, location, path=["response"]) + location = response.parse() + assert_matches_type(LocationListResponse, location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -50,12 +56,15 @@ class TestAsyncLocations: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - location = await async_client.storage.locations.list() + with pytest.warns(DeprecationWarning): + location = await async_client.storage.locations.list() + assert_matches_type(LocationListResponse, location, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.locations.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = await async_client.storage.locations.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -64,11 +73,12 @@ 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.storage.locations.with_streaming_response.list() 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.storage.locations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - location = await response.parse() - assert_matches_type(LocationListResponse, location, path=["response"]) + location = await response.parse() + assert_matches_type(LocationListResponse, location, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_statistics.py b/tests/api_resources/streaming/test_statistics.py index 72546277..bae1314e 100644 --- a/tests/api_resources/streaming/test_statistics.py +++ b/tests/api_resources/streaming/test_statistics.py @@ -12,7 +12,6 @@ from gcore.types.streaming import ( Views, Ffprobes, - MeetSeries, StreamSeries, ViewsHeatmap, PopularVideos, @@ -251,49 +250,6 @@ def test_streaming_response_get_max_streams_series(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_get_meet_series(self, client: Gcore) -> None: - statistic = client.streaming.statistics.get_meet_series( - from_="from", - to="to", - ) - assert_matches_type(MeetSeries, statistic, path=["response"]) - - @parametrize - def test_method_get_meet_series_with_all_params(self, client: Gcore) -> None: - statistic = client.streaming.statistics.get_meet_series( - from_="from", - to="to", - granularity="1m", - ) - assert_matches_type(MeetSeries, statistic, path=["response"]) - - @parametrize - def test_raw_response_get_meet_series(self, client: Gcore) -> None: - response = client.streaming.statistics.with_raw_response.get_meet_series( - from_="from", - to="to", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - statistic = response.parse() - assert_matches_type(MeetSeries, statistic, path=["response"]) - - @parametrize - def test_streaming_response_get_meet_series(self, client: Gcore) -> None: - with client.streaming.statistics.with_streaming_response.get_meet_series( - from_="from", - to="to", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - statistic = response.parse() - assert_matches_type(MeetSeries, statistic, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize def test_method_get_popular_videos(self, client: Gcore) -> None: statistic = client.streaming.statistics.get_popular_videos( @@ -1209,49 +1165,6 @@ async def test_streaming_response_get_max_streams_series(self, async_client: Asy assert cast(Any, response.is_closed) is True - @parametrize - async def test_method_get_meet_series(self, async_client: AsyncGcore) -> None: - statistic = await async_client.streaming.statistics.get_meet_series( - from_="from", - to="to", - ) - assert_matches_type(MeetSeries, statistic, path=["response"]) - - @parametrize - async def test_method_get_meet_series_with_all_params(self, async_client: AsyncGcore) -> None: - statistic = await async_client.streaming.statistics.get_meet_series( - from_="from", - to="to", - granularity="1m", - ) - assert_matches_type(MeetSeries, statistic, path=["response"]) - - @parametrize - async def test_raw_response_get_meet_series(self, async_client: AsyncGcore) -> None: - response = await async_client.streaming.statistics.with_raw_response.get_meet_series( - from_="from", - to="to", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - statistic = await response.parse() - assert_matches_type(MeetSeries, statistic, path=["response"]) - - @parametrize - async def test_streaming_response_get_meet_series(self, async_client: AsyncGcore) -> None: - async with async_client.streaming.statistics.with_streaming_response.get_meet_series( - from_="from", - to="to", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - statistic = await response.parse() - assert_matches_type(MeetSeries, statistic, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize async def test_method_get_popular_videos(self, async_client: AsyncGcore) -> None: statistic = await async_client.streaming.statistics.get_popular_videos( diff --git a/tests/api_resources/streaming/test_streams.py b/tests/api_resources/streaming/test_streams.py index 324be334..dfe61205 100644 --- a/tests/api_resources/streaming/test_streams.py +++ b/tests/api_resources/streaming/test_streams.py @@ -45,7 +45,6 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: dvr_enabled=True, hls_mpegts_endlist_tag=True, html_overlay=False, - low_latency_enabled=True, projection="regular", pull=True, quality_set_id=0, @@ -101,7 +100,6 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "dvr_enabled": True, "hls_mpegts_endlist_tag": True, "html_overlay": False, - "low_latency_enabled": True, "projection": "regular", "pull": True, "quality_set_id": 0, @@ -426,7 +424,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> dvr_enabled=True, hls_mpegts_endlist_tag=True, html_overlay=False, - low_latency_enabled=True, projection="regular", pull=True, quality_set_id=0, @@ -482,7 +479,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "dvr_enabled": True, "hls_mpegts_endlist_tag": True, "html_overlay": False, - "low_latency_enabled": True, "projection": "regular", "pull": True, "quality_set_id": 0, diff --git a/tests/api_resources/test_storage.py b/tests/api_resources/test_storage.py index c2e1b409..76464310 100644 --- a/tests/api_resources/test_storage.py +++ b/tests/api_resources/test_storage.py @@ -9,6 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.storage import Storage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -17,6 +18,31 @@ class TestStorage: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_create(self, client: Gcore) -> None: + storage = client.storage.create() + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.storage.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = response.parse() + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.storage.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = response.parse() + assert_matches_type(Storage, storage, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_update(self, client: Gcore) -> None: storage = client.storage.update( @@ -28,8 +54,8 @@ def test_method_update(self, client: Gcore) -> None: def test_method_update_with_all_params(self, client: Gcore) -> None: storage = client.storage.update( storage_id=0, - expires="expires", - server_alias="server_alias", + expires="2026-12-31 23:59:59+00:00", + server_alias="my-storage.company.com", ) assert_matches_type(Storage, storage, path=["response"]) @@ -57,6 +83,47 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_list(self, client: Gcore) -> None: + storage = client.storage.list() + assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + storage = client.storage.list( + id="id", + limit=1, + location="location", + name="name", + offset=0, + order_by="order_by", + order_direction="asc", + show_deleted=True, + status="active", + type="s3", + ) + assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.storage.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = response.parse() + assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.storage.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = response.parse() + assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_delete(self, client: Gcore) -> None: storage = client.storage.delete( @@ -232,6 +299,31 @@ class TestAsyncStorage: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + storage = await async_client.storage.create() + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = await response.parse() + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.storage.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert_matches_type(Storage, storage, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: storage = await async_client.storage.update( @@ -243,8 +335,8 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: storage = await async_client.storage.update( storage_id=0, - expires="expires", - server_alias="server_alias", + expires="2026-12-31 23:59:59+00:00", + server_alias="my-storage.company.com", ) assert_matches_type(Storage, storage, path=["response"]) @@ -272,6 +364,47 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + storage = await async_client.storage.list() + assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + storage = await async_client.storage.list( + id="id", + limit=1, + location="location", + name="name", + offset=0, + order_by="order_by", + order_direction="asc", + show_deleted=True, + status="active", + type="s3", + ) + assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.storage.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + storage = await response.parse() + assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.storage.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: storage = await async_client.storage.delete( From ddfd3887beefa8d028a3a725083c138c31295df0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 5 Sep 2025 15:26:29 +0000 Subject: [PATCH 287/592] chore(internal): codegen related update --- requirements-dev.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 252c0b2d..f1a7cb90 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -50,7 +50,7 @@ filelock==3.12.4 frozenlist==1.6.2 # via aiohttp # via aiosignal -griffe==1.13.0 +griffe==1.14.0 h11==0.16.0 # via httpcore httpcore==1.0.9 From c250eec7433db1a225c1db6f6e25f21f5a648868 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 5 Sep 2025 21:27:56 +0000 Subject: [PATCH 288/592] chore(tests): simplify `get_platform` test `nest_asyncio` is archived and broken on some platforms so it's not worth keeping in our test suite. --- pyproject.toml | 1 - requirements-dev.lock | 3 +-- tests/test_client.py | 53 +++++-------------------------------------- 3 files changed, 7 insertions(+), 50 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4cbb7e74..fde59029 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,7 +56,6 @@ dev-dependencies = [ "dirty-equals>=0.6.0", "importlib-metadata>=6.7.0", "rich>=13.7.1", - "nest_asyncio==1.6.0", "pytest-xdist>=3.6.1", "griffe>=1", ] diff --git a/requirements-dev.lock b/requirements-dev.lock index f1a7cb90..235f57cd 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -50,7 +50,7 @@ filelock==3.12.4 frozenlist==1.6.2 # via aiohttp # via aiosignal -griffe==1.14.0 +griffe==1.13.0 h11==0.16.0 # via httpcore httpcore==1.0.9 @@ -78,7 +78,6 @@ multidict==6.4.4 mypy==1.14.1 mypy-extensions==1.0.0 # via mypy -nest-asyncio==1.6.0 nodeenv==1.8.0 # via pyright nox==2023.4.22 diff --git a/tests/test_client.py b/tests/test_client.py index b0d1e897..17903dc2 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -6,13 +6,10 @@ import os import sys import json -import time import asyncio import inspect -import subprocess import tracemalloc from typing import Any, Union, cast -from textwrap import dedent from unittest import mock from typing_extensions import Literal @@ -23,14 +20,17 @@ from gcore import Gcore, AsyncGcore, APIResponseValidationError from gcore._types import Omit +from gcore._utils import asyncify from gcore._models import BaseModel, FinalRequestOptions from gcore._exceptions import GcoreError, APIStatusError, APITimeoutError, APIResponseValidationError from gcore._base_client import ( DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, + OtherPlatform, DefaultHttpxClient, DefaultAsyncHttpxClient, + get_platform, make_request_options, ) @@ -1671,50 +1671,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert response.http_request.headers.get("x-stainless-retry-count") == "42" - def test_get_platform(self) -> None: - # A previous implementation of asyncify could leave threads unterminated when - # used with nest_asyncio. - # - # Since nest_asyncio.apply() is global and cannot be un-applied, this - # test is run in a separate process to avoid affecting other tests. - test_code = dedent(""" - import asyncio - import nest_asyncio - import threading - - from gcore._utils import asyncify - from gcore._base_client import get_platform - - async def test_main() -> None: - result = await asyncify(get_platform)() - print(result) - for thread in threading.enumerate(): - print(thread.name) - - nest_asyncio.apply() - asyncio.run(test_main()) - """) - with subprocess.Popen( - [sys.executable, "-c", test_code], - text=True, - ) as process: - timeout = 10 # seconds - - start_time = time.monotonic() - while True: - return_code = process.poll() - if return_code is not None: - if return_code != 0: - raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") - - # success - break - - if time.monotonic() - start_time > timeout: - process.kill() - raise AssertionError("calling get_platform using asyncify resulted in a hung process") - - time.sleep(0.1) + async def test_get_platform(self) -> None: + platform = await asyncify(get_platform)() + assert isinstance(platform, (str, OtherPlatform)) async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly From 09a319bcfd8cf1d93c550c84bf89cb3f269a0fb8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 08:13:11 +0000 Subject: [PATCH 289/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- .../gpu_baremetal_clusters.py | 10 ++++++++++ .../gpu_baremetal_cluster_delete_params.py | 6 ++++++ src/gcore/types/cloud/project.py | 18 +++++++++--------- .../cloud/test_gpu_baremetal_clusters.py | 2 ++ 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index 21de9121..685e654d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-efd5495399fc306a35e490c3872afae6e9d9bcb61eec361fc0ef035e5e42af8b.yml -openapi_spec_hash: ccb1fb7d018b724fd61c3afc68fcd7a5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-38d8aa4ef1f49052e095528dde5dde792be9d238f5aa5d391a185a12a1764afe.yml +openapi_spec_hash: 4d944c7b954eba8dadbc8d6f1823a4d4 config_hash: 296feeb9e44105df95628b9989e56273 diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 99c7b1ee..7fb94685 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -250,6 +250,7 @@ def delete( project_id: int | None = None, region_id: int | None = None, all_floating_ips: bool | NotGiven = NOT_GIVEN, + all_reserved_fixed_ips: bool | NotGiven = NOT_GIVEN, floating_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, reserved_fixed_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -272,6 +273,9 @@ def delete( all_floating_ips: Flag indicating whether the floating ips associated with server / cluster are deleted + all_reserved_fixed_ips: Flag indicating whether the reserved fixed ips associated with server / cluster + are deleted + floating_ip_ids: Optional list of floating ips to be deleted reserved_fixed_ip_ids: Optional list of reserved fixed ips to be deleted @@ -302,6 +306,7 @@ def delete( query=maybe_transform( { "all_floating_ips": all_floating_ips, + "all_reserved_fixed_ips": all_reserved_fixed_ips, "floating_ip_ids": floating_ip_ids, "reserved_fixed_ip_ids": reserved_fixed_ip_ids, }, @@ -738,6 +743,7 @@ async def delete( project_id: int | None = None, region_id: int | None = None, all_floating_ips: bool | NotGiven = NOT_GIVEN, + all_reserved_fixed_ips: bool | NotGiven = NOT_GIVEN, floating_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, reserved_fixed_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -760,6 +766,9 @@ async def delete( all_floating_ips: Flag indicating whether the floating ips associated with server / cluster are deleted + all_reserved_fixed_ips: Flag indicating whether the reserved fixed ips associated with server / cluster + are deleted + floating_ip_ids: Optional list of floating ips to be deleted reserved_fixed_ip_ids: Optional list of reserved fixed ips to be deleted @@ -790,6 +799,7 @@ async def delete( query=await async_maybe_transform( { "all_floating_ips": all_floating_ips, + "all_reserved_fixed_ips": all_reserved_fixed_ips, "floating_ip_ids": floating_ip_ids, "reserved_fixed_ip_ids": reserved_fixed_ip_ids, }, diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py index fb7b3ace..dc737d14 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py @@ -22,6 +22,12 @@ class GPUBaremetalClusterDeleteParams(TypedDict, total=False): deleted """ + all_reserved_fixed_ips: bool + """ + Flag indicating whether the reserved fixed ips associated with server / cluster + are deleted + """ + floating_ip_ids: SequenceNotStr[str] """Optional list of floating ips to be deleted""" diff --git a/src/gcore/types/cloud/project.py b/src/gcore/types/cloud/project.py index 8d978657..ce547c1a 100644 --- a/src/gcore/types/cloud/project.py +++ b/src/gcore/types/cloud/project.py @@ -18,6 +18,15 @@ class Project(BaseModel): created_at: datetime """Datetime of creation, which is automatically generated.""" + deleted_at: Optional[datetime] = None + """ + Datetime of deletion, which is automatically generated if the project is + deleted. + """ + + description: Optional[str] = None + """Description of the project.""" + is_default: bool """Indicates if the project is the default one. @@ -30,15 +39,6 @@ class Project(BaseModel): state: str """The state of the project.""" - deleted_at: Optional[datetime] = None - """ - Datetime of deletion, which is automatically generated if the project is - deleted. - """ - - description: Optional[str] = None - """Description of the project.""" - task_id: Optional[str] = None """The UUID of the active task that currently holds a lock on the resource. diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index b63a3e8f..b6a7547c 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -161,6 +161,7 @@ def test_method_delete_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=7, all_floating_ips=True, + all_reserved_fixed_ips=True, floating_ip_ids=["e4a01208-d6ac-4304-bf86-3028154b070a"], reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], ) @@ -598,6 +599,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> project_id=1, region_id=7, all_floating_ips=True, + all_reserved_fixed_ips=True, floating_ip_ids=["e4a01208-d6ac-4304-bf86-3028154b070a"], reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], ) From 58eee4d6e2f27ce4962c2fd8a63702ac1f13183d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:10:48 +0000 Subject: [PATCH 290/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 2 +- .../cloud/gpu_baremetal_clusters/servers.py | 105 +++++++++++++++++- src/gcore/resources/storage/storage.py | 84 +++++++++++++- .../server_list_params.py | 56 +++++++++- src/gcore/types/storage/__init__.py | 1 + .../types/storage/storage_create_params.py | 44 ++++++++ .../gpu_baremetal_clusters/test_servers.py | 15 +++ tests/api_resources/test_storage.py | 62 +++++++++-- 9 files changed, 359 insertions(+), 14 deletions(-) create mode 100644 src/gcore/types/storage/storage_create_params.py diff --git a/.stats.yml b/.stats.yml index 685e654d..1f8cea50 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-38d8aa4ef1f49052e095528dde5dde792be9d238f5aa5d391a185a12a1764afe.yml -openapi_spec_hash: 4d944c7b954eba8dadbc8d6f1823a4d4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-82710e4affc54069c75e3620abaab301786e7afd7b76433ea54da62a4b6e9b7d.yml +openapi_spec_hash: 9651b07f3ca9fa4b3e7f17ab08aa9d43 config_hash: 296feeb9e44105df95628b9989e56273 diff --git a/api.md b/api.md index 8892a0ea..0b6af1ed 100644 --- a/api.md +++ b/api.md @@ -1986,7 +1986,7 @@ from gcore.types.storage import Storage Methods: -- client.storage.create() -> Storage +- client.storage.create(\*\*params) -> Storage - client.storage.update(storage_id, \*\*params) -> Storage - client.storage.list(\*\*params) -> SyncOffsetPage[Storage] - client.storage.delete(storage_id) -> None diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 11af8877..a2a4c102 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -2,12 +2,13 @@ from __future__ import annotations -from typing import Iterable +from typing import Union, Iterable +from datetime import datetime from typing_extensions import Literal, overload import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -59,8 +60,33 @@ def list( *, project_id: int | None = None, region_id: int | None = None, + changed_before: Union[str, datetime] | NotGiven = NOT_GIVEN, + changed_since: Union[str, datetime] | NotGiven = NOT_GIVEN, + ip_address: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] | NotGiven = NOT_GIVEN, + status: Literal[ + "ACTIVE", + "BUILD", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PAUSED", + "REBOOT", + "REBUILD", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "VERIFY_RESIZE", + ] + | NotGiven = NOT_GIVEN, + uuids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -80,10 +106,28 @@ def list( cluster_id: Cluster unique identifier + changed_before: Filters the results to include only servers whose last change timestamp is less + than the specified datetime. Format: ISO 8601. + + changed_since: Filters the results to include only servers whose last change timestamp is + greater than or equal to the specified datetime. Format: ISO 8601. + + ip_address: Filter servers by ip address. + limit: Limit of items on a single page + name: Filter servers by name. You can provide a full or partial name, servers with + matching names will be returned. For example, entering 'test' will return all + servers that contain 'test' in their name. + offset: Offset in results list + order_by: Order field + + status: Filters servers by status. + + uuids: Filter servers by uuid. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -110,8 +154,15 @@ def list( timeout=timeout, query=maybe_transform( { + "changed_before": changed_before, + "changed_since": changed_since, + "ip_address": ip_address, "limit": limit, + "name": name, "offset": offset, + "order_by": order_by, + "status": status, + "uuids": uuids, }, server_list_params.ServerListParams, ), @@ -624,8 +675,33 @@ def list( *, project_id: int | None = None, region_id: int | None = None, + changed_before: Union[str, datetime] | NotGiven = NOT_GIVEN, + changed_since: Union[str, datetime] | NotGiven = NOT_GIVEN, + ip_address: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, + order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] | NotGiven = NOT_GIVEN, + status: Literal[ + "ACTIVE", + "BUILD", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PAUSED", + "REBOOT", + "REBUILD", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "VERIFY_RESIZE", + ] + | NotGiven = NOT_GIVEN, + uuids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -645,10 +721,28 @@ def list( cluster_id: Cluster unique identifier + changed_before: Filters the results to include only servers whose last change timestamp is less + than the specified datetime. Format: ISO 8601. + + changed_since: Filters the results to include only servers whose last change timestamp is + greater than or equal to the specified datetime. Format: ISO 8601. + + ip_address: Filter servers by ip address. + limit: Limit of items on a single page + name: Filter servers by name. You can provide a full or partial name, servers with + matching names will be returned. For example, entering 'test' will return all + servers that contain 'test' in their name. + offset: Offset in results list + order_by: Order field + + status: Filters servers by status. + + uuids: Filter servers by uuid. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -675,8 +769,15 @@ def list( timeout=timeout, query=maybe_transform( { + "changed_before": changed_before, + "changed_since": changed_since, + "ip_address": ip_address, "limit": limit, + "name": name, "offset": offset, + "order_by": order_by, + "status": status, + "uuids": uuids, }, server_list_params.ServerListParams, ), diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index e82a2b90..04037ddc 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -42,7 +42,7 @@ ) from ...pagination import SyncOffsetPage, AsyncOffsetPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.storage import storage_list_params, storage_update_params, storage_restore_params +from ...types.storage import storage_list_params, storage_create_params, storage_update_params, storage_restore_params from .buckets.buckets import ( BucketsResource, AsyncBucketsResource, @@ -95,6 +95,11 @@ def with_streaming_response(self) -> StorageResourceWithStreamingResponse: def create( self, *, + location: Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"], + name: str, + type: Literal["sftp", "s3"], + generate_sftp_password: bool | NotGiven = NOT_GIVEN, + sftp_password: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -105,11 +110,47 @@ def create( """ Creates a new storage instance (S3 or SFTP) in the specified location and returns the storage details including credentials. + + Args: + location: Geographic location where the storage will be provisioned. Each location + represents a specific data center region. + + name: Unique storage name identifier. Must contain only letters, numbers, dashes, and + underscores. Cannot be empty and must be less than 256 characters. + + type: Storage protocol type. Choose 's3' for S3-compatible object storage with API + access, or `sftp` for SFTP file transfer protocol. + + generate_sftp_password: Automatically generate a secure password for SFTP storage access. Only + applicable when type is `sftp`. When `true`, a random password will be generated + and returned in the response. + + sftp_password: Custom password for SFTP storage access. Only applicable when type is `sftp`. If + not provided and `generate_sftp_password` is `false`, no password authentication + will be available. + + 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( "/storage/provisioning/v2/storage" if self._client._base_url_overridden else "https://api.gcore.com//storage/provisioning/v2/storage", + body=maybe_transform( + { + "location": location, + "name": name, + "type": type, + "generate_sftp_password": generate_sftp_password, + "sftp_password": sftp_password, + }, + storage_create_params.StorageCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -470,6 +511,11 @@ def with_streaming_response(self) -> AsyncStorageResourceWithStreamingResponse: async def create( self, *, + location: Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"], + name: str, + type: Literal["sftp", "s3"], + generate_sftp_password: bool | NotGiven = NOT_GIVEN, + sftp_password: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -480,11 +526,47 @@ async def create( """ Creates a new storage instance (S3 or SFTP) in the specified location and returns the storage details including credentials. + + Args: + location: Geographic location where the storage will be provisioned. Each location + represents a specific data center region. + + name: Unique storage name identifier. Must contain only letters, numbers, dashes, and + underscores. Cannot be empty and must be less than 256 characters. + + type: Storage protocol type. Choose 's3' for S3-compatible object storage with API + access, or `sftp` for SFTP file transfer protocol. + + generate_sftp_password: Automatically generate a secure password for SFTP storage access. Only + applicable when type is `sftp`. When `true`, a random password will be generated + and returned in the response. + + sftp_password: Custom password for SFTP storage access. Only applicable when type is `sftp`. If + not provided and `generate_sftp_password` is `false`, no password authentication + will be available. + + 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( "/storage/provisioning/v2/storage" if self._client._base_url_overridden else "https://api.gcore.com//storage/provisioning/v2/storage", + body=await async_maybe_transform( + { + "location": location, + "name": name, + "type": type, + "generate_sftp_password": generate_sftp_password, + "sftp_password": sftp_password, + }, + storage_create_params.StorageCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_list_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/server_list_params.py index c9b5caf4..35c7f374 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/server_list_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/server_list_params.py @@ -2,7 +2,12 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing import Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ...._types import SequenceNotStr +from ...._utils import PropertyInfo __all__ = ["ServerListParams"] @@ -14,8 +19,57 @@ class ServerListParams(TypedDict, total=False): region_id: int """Region ID""" + changed_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Filters the results to include only servers whose last change timestamp is less + than the specified datetime. Format: ISO 8601. + """ + + changed_since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Filters the results to include only servers whose last change timestamp is + greater than or equal to the specified datetime. Format: ISO 8601. + """ + + ip_address: str + """Filter servers by ip address.""" + limit: int """Limit of items on a single page""" + name: str + """Filter servers by name. + + You can provide a full or partial name, servers with matching names will be + returned. For example, entering 'test' will return all servers that contain + 'test' in their name. + """ + offset: int """Offset in results list""" + + order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] + """Order field""" + + status: Literal[ + "ACTIVE", + "BUILD", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PAUSED", + "REBOOT", + "REBUILD", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "VERIFY_RESIZE", + ] + """Filters servers by status.""" + + uuids: SequenceNotStr[str] + """Filter servers by uuid.""" diff --git a/src/gcore/types/storage/__init__.py b/src/gcore/types/storage/__init__.py index a323c939..136dbb5b 100644 --- a/src/gcore/types/storage/__init__.py +++ b/src/gcore/types/storage/__init__.py @@ -9,6 +9,7 @@ from .storage_list_params import StorageListParams as StorageListParams from .storage_usage_total import StorageUsageTotal as StorageUsageTotal from .storage_usage_series import StorageUsageSeries as StorageUsageSeries +from .storage_create_params import StorageCreateParams as StorageCreateParams from .storage_update_params import StorageUpdateParams as StorageUpdateParams from .location_list_response import LocationListResponse as LocationListResponse from .storage_restore_params import StorageRestoreParams as StorageRestoreParams diff --git a/src/gcore/types/storage/storage_create_params.py b/src/gcore/types/storage/storage_create_params.py new file mode 100644 index 00000000..b3a6cc62 --- /dev/null +++ b/src/gcore/types/storage/storage_create_params.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["StorageCreateParams"] + + +class StorageCreateParams(TypedDict, total=False): + location: Required[Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"]] + """Geographic location where the storage will be provisioned. + + Each location represents a specific data center region. + """ + + name: Required[str] + """Unique storage name identifier. + + Must contain only letters, numbers, dashes, and underscores. Cannot be empty and + must be less than 256 characters. + """ + + type: Required[Literal["sftp", "s3"]] + """Storage protocol type. + + Choose 's3' for S3-compatible object storage with API access, or `sftp` for SFTP + file transfer protocol. + """ + + generate_sftp_password: bool + """Automatically generate a secure password for SFTP storage access. + + Only applicable when type is `sftp`. When `true`, a random password will be + generated and returned in the response. + """ + + sftp_password: str + """Custom password for SFTP storage access. + + Only applicable when type is `sftp`. If not provided and + `generate_sftp_password` is `false`, no password authentication will be + available. + """ diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py index d191b740..204a8ffb 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py @@ -9,6 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type +from gcore._utils import parse_datetime from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud import Console, TaskIDList from gcore.types.cloud.gpu_baremetal_clusters import ( @@ -37,8 +38,15 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, + changed_before=parse_datetime("2025-10-01T12:00:00Z"), + changed_since=parse_datetime("2025-10-01T12:00:00Z"), + ip_address="237.84.2.178", limit=10, + name="name", offset=0, + order_by="created_at.asc", + status="ACTIVE", + uuids=["string"], ) assert_matches_type(SyncOffsetPage[GPUBaremetalClusterServer], server, path=["response"]) @@ -674,8 +682,15 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, + changed_before=parse_datetime("2025-10-01T12:00:00Z"), + changed_since=parse_datetime("2025-10-01T12:00:00Z"), + ip_address="237.84.2.178", limit=10, + name="name", offset=0, + order_by="created_at.asc", + status="ACTIVE", + uuids=["string"], ) assert_matches_type(AsyncOffsetPage[GPUBaremetalClusterServer], server, path=["response"]) diff --git a/tests/api_resources/test_storage.py b/tests/api_resources/test_storage.py index 76464310..3a087e65 100644 --- a/tests/api_resources/test_storage.py +++ b/tests/api_resources/test_storage.py @@ -10,7 +10,9 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.storage import Storage +from gcore.types.storage import ( + Storage, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,12 +22,31 @@ class TestStorage: @parametrize def test_method_create(self, client: Gcore) -> None: - storage = client.storage.create() + storage = client.storage.create( + location="s-ed1", + name="my-storage-prod", + type="s3", + ) + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + storage = client.storage.create( + location="s-ed1", + name="my-storage-prod", + type="s3", + generate_sftp_password=True, + sftp_password="sftp_password", + ) assert_matches_type(Storage, storage, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.storage.with_raw_response.create() + response = client.storage.with_raw_response.create( + location="s-ed1", + name="my-storage-prod", + type="s3", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -34,7 +55,11 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.storage.with_streaming_response.create() as response: + with client.storage.with_streaming_response.create( + location="s-ed1", + name="my-storage-prod", + type="s3", + ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -301,12 +326,31 @@ class TestAsyncStorage: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.create() + storage = await async_client.storage.create( + location="s-ed1", + name="my-storage-prod", + type="s3", + ) + assert_matches_type(Storage, storage, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + storage = await async_client.storage.create( + location="s-ed1", + name="my-storage-prod", + type="s3", + generate_sftp_password=True, + sftp_password="sftp_password", + ) assert_matches_type(Storage, storage, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.with_raw_response.create() + response = await async_client.storage.with_raw_response.create( + location="s-ed1", + name="my-storage-prod", + type="s3", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -315,7 +359,11 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.storage.with_streaming_response.create() as response: + async with async_client.storage.with_streaming_response.create( + location="s-ed1", + name="my-storage-prod", + type="s3", + ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From 8a31501ef89bc7409bfe6a405ba85a895045369e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 15:51:18 +0000 Subject: [PATCH 291/592] feat(storage): make list storage locations paginated --- .stats.yml | 2 +- api.md | 22 ++-- .../resources/storage/buckets/buckets.py | 14 +-- src/gcore/resources/storage/buckets/cors.py | 10 +- src/gcore/resources/storage/locations.py | 105 ++++++++++++------ src/gcore/resources/storage/statistics.py | 10 +- src/gcore/types/storage/__init__.py | 10 +- .../storage/{storage_bucket.py => bucket.py} | 4 +- src/gcore/types/storage/buckets/__init__.py | 4 +- ...{storage_bucket_cors.py => bucket_cors.py} | 4 +- ...rage_bucket_policy.py => bucket_policy.py} | 4 +- src/gcore/types/storage/location.py | 24 ++++ .../types/storage/location_list_params.py | 13 +++ .../types/storage/location_list_response.py | 10 -- .../statistic_get_usage_series_response.py | 4 +- src/gcore/types/storage/storage_location.py | 24 ---- ...torage_usage_series.py => usage_series.py} | 4 +- ...{storage_usage_total.py => usage_total.py} | 4 +- .../storage/buckets/test_cors.py | 14 +-- tests/api_resources/storage/test_buckets.py | 18 +-- tests/api_resources/storage/test_locations.py | 61 +++++----- .../api_resources/storage/test_statistics.py | 18 +-- 22 files changed, 212 insertions(+), 171 deletions(-) rename src/gcore/types/storage/{storage_bucket.py => bucket.py} (83%) rename src/gcore/types/storage/buckets/{storage_bucket_cors.py => bucket_cors.py} (87%) rename src/gcore/types/storage/buckets/{storage_bucket_policy.py => bucket_policy.py} (64%) create mode 100644 src/gcore/types/storage/location.py create mode 100644 src/gcore/types/storage/location_list_params.py delete mode 100644 src/gcore/types/storage/location_list_response.py delete mode 100644 src/gcore/types/storage/storage_location.py rename src/gcore/types/storage/{storage_usage_series.py => usage_series.py} (98%) rename src/gcore/types/storage/{storage_usage_total.py => usage_total.py} (95%) diff --git a/.stats.yml b/.stats.yml index 1f8cea50..7ece6522 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-82710e4affc54069c75e3620abaab301786e7afd7b76433ea54da62a4b6e9b7d.yml openapi_spec_hash: 9651b07f3ca9fa4b3e7f17ab08aa9d43 -config_hash: 296feeb9e44105df95628b9989e56273 +config_hash: 73d242df5d8f0213f2bd62cd792080b5 diff --git a/api.md b/api.md index 0b6af1ed..57501eeb 100644 --- a/api.md +++ b/api.md @@ -2000,28 +2000,24 @@ Methods: Types: ```python -from gcore.types.storage import StorageLocation, LocationListResponse +from gcore.types.storage import Location ``` Methods: -- client.storage.locations.list() -> LocationListResponse +- client.storage.locations.list(\*\*params) -> SyncOffsetPage[Location] ## Statistics Types: ```python -from gcore.types.storage import ( - StorageUsageSeries, - StorageUsageTotal, - StatisticGetUsageSeriesResponse, -) +from gcore.types.storage import UsageSeries, UsageTotal, StatisticGetUsageSeriesResponse ``` Methods: -- client.storage.statistics.get_usage_aggregated(\*\*params) -> StorageUsageTotal +- client.storage.statistics.get_usage_aggregated(\*\*params) -> UsageTotal - client.storage.statistics.get_usage_series(\*\*params) -> StatisticGetUsageSeriesResponse ## Credentials @@ -2035,13 +2031,13 @@ Methods: Types: ```python -from gcore.types.storage import StorageBucket +from gcore.types.storage import Bucket ``` Methods: - client.storage.buckets.create(bucket_name, \*, storage_id) -> None -- client.storage.buckets.list(storage_id, \*\*params) -> SyncOffsetPage[StorageBucket] +- client.storage.buckets.list(storage_id, \*\*params) -> SyncOffsetPage[Bucket] - client.storage.buckets.delete(bucket_name, \*, storage_id) -> None ### Cors @@ -2049,13 +2045,13 @@ Methods: Types: ```python -from gcore.types.storage.buckets import StorageBucketCors +from gcore.types.storage.buckets import BucketCors ``` Methods: - client.storage.buckets.cors.create(bucket_name, \*, storage_id, \*\*params) -> None -- client.storage.buckets.cors.get(bucket_name, \*, storage_id) -> StorageBucketCors +- client.storage.buckets.cors.get(bucket_name, \*, storage_id) -> BucketCors ### Lifecycle @@ -2069,7 +2065,7 @@ Methods: Types: ```python -from gcore.types.storage.buckets import StorageBucketPolicy, PolicyGetResponse +from gcore.types.storage.buckets import BucketPolicy, PolicyGetResponse ``` Methods: diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index c3e7df90..cd7d3047 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -41,7 +41,7 @@ from ....pagination import SyncOffsetPage, AsyncOffsetPage from ...._base_client import AsyncPaginator, make_request_options from ....types.storage import bucket_list_params -from ....types.storage.storage_bucket import StorageBucket +from ....types.storage.bucket import Bucket __all__ = ["BucketsResource", "AsyncBucketsResource"] @@ -129,7 +129,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncOffsetPage[StorageBucket]: + ) -> SyncOffsetPage[Bucket]: """Returns the list of buckets for the storage in a wrapped response. Response @@ -153,7 +153,7 @@ def list( f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" if self._client._base_url_overridden else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", - page=SyncOffsetPage[StorageBucket], + page=SyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -167,7 +167,7 @@ def list( bucket_list_params.BucketListParams, ), ), - model=StorageBucket, + model=Bucket, ) def delete( @@ -293,7 +293,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[StorageBucket, AsyncOffsetPage[StorageBucket]]: + ) -> AsyncPaginator[Bucket, AsyncOffsetPage[Bucket]]: """Returns the list of buckets for the storage in a wrapped response. Response @@ -317,7 +317,7 @@ def list( f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" if self._client._base_url_overridden else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", - page=AsyncOffsetPage[StorageBucket], + page=AsyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -331,7 +331,7 @@ def list( bucket_list_params.BucketListParams, ), ), - model=StorageBucket, + model=Bucket, ) async def delete( diff --git a/src/gcore/resources/storage/buckets/cors.py b/src/gcore/resources/storage/buckets/cors.py index 7a44bd1e..d00928da 100644 --- a/src/gcore/resources/storage/buckets/cors.py +++ b/src/gcore/resources/storage/buckets/cors.py @@ -16,7 +16,7 @@ ) from ...._base_client import make_request_options from ....types.storage.buckets import cor_create_params -from ....types.storage.buckets.storage_bucket_cors import StorageBucketCors +from ....types.storage.buckets.bucket_cors import BucketCors __all__ = ["CorsResource", "AsyncCorsResource"] @@ -95,7 +95,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StorageBucketCors: + ) -> BucketCors: """ Retrieves the current Cross-Origin Resource Sharing (CORS) configuration for an S3 bucket, showing which domains are allowed to access the bucket from web @@ -119,7 +119,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StorageBucketCors, + cast_to=BucketCors, ) @@ -197,7 +197,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StorageBucketCors: + ) -> BucketCors: """ Retrieves the current Cross-Origin Resource Sharing (CORS) configuration for an S3 bucket, showing which domains are allowed to access the bucket from web @@ -221,7 +221,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StorageBucketCors, + cast_to=BucketCors, ) diff --git a/src/gcore/resources/storage/locations.py b/src/gcore/resources/storage/locations.py index 5093da49..9d7c6670 100644 --- a/src/gcore/resources/storage/locations.py +++ b/src/gcore/resources/storage/locations.py @@ -2,11 +2,10 @@ from __future__ import annotations -import typing_extensions - import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -15,8 +14,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._base_client import make_request_options -from ...types.storage.location_list_response import LocationListResponse +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ..._base_client import AsyncPaginator, make_request_options +from ...types.storage import location_list_params +from ...types.storage.location import Location __all__ = ["LocationsResource", "AsyncLocationsResource"] @@ -41,30 +42,51 @@ def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: """ return LocationsResourceWithStreamingResponse(self) - @typing_extensions.deprecated("deprecated") def list( self, *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LocationListResponse: + ) -> SyncOffsetPage[Location]: """Returns available storage locations where you can create storages. Each location represents a geographic region with specific data center facilities. + + 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( - "/storage/provisioning/v1/location" + return self._get_api_list( + "/storage/provisioning/v2/locations" if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v1/location", + else "https://api.gcore.com//storage/provisioning/v2/locations", + page=SyncOffsetPage[Location], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + }, + location_list_params.LocationListParams, + ), ), - cast_to=LocationListResponse, + model=Location, ) @@ -88,30 +110,51 @@ def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse """ return AsyncLocationsResourceWithStreamingResponse(self) - @typing_extensions.deprecated("deprecated") - async def list( + def list( self, *, + limit: int | NotGiven = NOT_GIVEN, + offset: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> LocationListResponse: + ) -> AsyncPaginator[Location, AsyncOffsetPage[Location]]: """Returns available storage locations where you can create storages. Each location represents a geographic region with specific data center facilities. + + 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( - "/storage/provisioning/v1/location" + return self._get_api_list( + "/storage/provisioning/v2/locations" if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v1/location", + else "https://api.gcore.com//storage/provisioning/v2/locations", + page=AsyncOffsetPage[Location], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + }, + location_list_params.LocationListParams, + ), ), - cast_to=LocationListResponse, + model=Location, ) @@ -119,10 +162,8 @@ class LocationsResourceWithRawResponse: def __init__(self, locations: LocationsResource) -> None: self._locations = locations - self.list = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - locations.list, # pyright: ignore[reportDeprecated], - ) + self.list = to_raw_response_wrapper( + locations.list, ) @@ -130,10 +171,8 @@ class AsyncLocationsResourceWithRawResponse: def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations - self.list = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - locations.list, # pyright: ignore[reportDeprecated], - ) + self.list = async_to_raw_response_wrapper( + locations.list, ) @@ -141,10 +180,8 @@ class LocationsResourceWithStreamingResponse: def __init__(self, locations: LocationsResource) -> None: self._locations = locations - self.list = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - locations.list, # pyright: ignore[reportDeprecated], - ) + self.list = to_streamed_response_wrapper( + locations.list, ) @@ -152,8 +189,6 @@ class AsyncLocationsResourceWithStreamingResponse: def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations - self.list = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - locations.list, # pyright: ignore[reportDeprecated], - ) + self.list = async_to_streamed_response_wrapper( + locations.list, ) diff --git a/src/gcore/resources/storage/statistics.py b/src/gcore/resources/storage/statistics.py index 56c42409..334749eb 100644 --- a/src/gcore/resources/storage/statistics.py +++ b/src/gcore/resources/storage/statistics.py @@ -16,7 +16,7 @@ ) from ..._base_client import make_request_options from ...types.storage import statistic_get_usage_series_params, statistic_get_usage_aggregated_params -from ...types.storage.storage_usage_total import StorageUsageTotal +from ...types.storage.usage_total import UsageTotal from ...types.storage.statistic_get_usage_series_response import StatisticGetUsageSeriesResponse __all__ = ["StatisticsResource", "AsyncStatisticsResource"] @@ -55,7 +55,7 @@ def get_usage_aggregated( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StorageUsageTotal: + ) -> UsageTotal: """ Consumption statistics is updated in near real-time as a standard practice. However, the frequency of updates can vary, but they are typically available @@ -97,7 +97,7 @@ def get_usage_aggregated( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StorageUsageTotal, + cast_to=UsageTotal, ) def get_usage_series( @@ -206,7 +206,7 @@ async def get_usage_aggregated( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StorageUsageTotal: + ) -> UsageTotal: """ Consumption statistics is updated in near real-time as a standard practice. However, the frequency of updates can vary, but they are typically available @@ -248,7 +248,7 @@ async def get_usage_aggregated( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StorageUsageTotal, + cast_to=UsageTotal, ) async def get_usage_series( diff --git a/src/gcore/types/storage/__init__.py b/src/gcore/types/storage/__init__.py index 136dbb5b..81dc1638 100644 --- a/src/gcore/types/storage/__init__.py +++ b/src/gcore/types/storage/__init__.py @@ -2,16 +2,16 @@ from __future__ import annotations +from .bucket import Bucket as Bucket from .storage import Storage as Storage -from .storage_bucket import StorageBucket as StorageBucket -from .storage_location import StorageLocation as StorageLocation +from .location import Location as Location +from .usage_total import UsageTotal as UsageTotal +from .usage_series import UsageSeries as UsageSeries from .bucket_list_params import BucketListParams as BucketListParams from .storage_list_params import StorageListParams as StorageListParams -from .storage_usage_total import StorageUsageTotal as StorageUsageTotal -from .storage_usage_series import StorageUsageSeries as StorageUsageSeries +from .location_list_params import LocationListParams as LocationListParams from .storage_create_params import StorageCreateParams as StorageCreateParams from .storage_update_params import StorageUpdateParams as StorageUpdateParams -from .location_list_response import LocationListResponse as LocationListResponse from .storage_restore_params import StorageRestoreParams as StorageRestoreParams from .credential_recreate_params import CredentialRecreateParams as CredentialRecreateParams from .statistic_get_usage_series_params import StatisticGetUsageSeriesParams as StatisticGetUsageSeriesParams diff --git a/src/gcore/types/storage/storage_bucket.py b/src/gcore/types/storage/bucket.py similarity index 83% rename from src/gcore/types/storage/storage_bucket.py rename to src/gcore/types/storage/bucket.py index 83f79de5..e2cc7ae4 100644 --- a/src/gcore/types/storage/storage_bucket.py +++ b/src/gcore/types/storage/bucket.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["StorageBucket"] +__all__ = ["Bucket"] -class StorageBucket(BaseModel): +class Bucket(BaseModel): name: str """Name of the S3 bucket""" diff --git a/src/gcore/types/storage/buckets/__init__.py b/src/gcore/types/storage/buckets/__init__.py index 30ee64dd..f8f1f5fb 100644 --- a/src/gcore/types/storage/buckets/__init__.py +++ b/src/gcore/types/storage/buckets/__init__.py @@ -2,8 +2,8 @@ from __future__ import annotations +from .bucket_cors import BucketCors as BucketCors +from .bucket_policy import BucketPolicy as BucketPolicy from .cor_create_params import CorCreateParams as CorCreateParams from .policy_get_response import PolicyGetResponse as PolicyGetResponse -from .storage_bucket_cors import StorageBucketCors as StorageBucketCors -from .storage_bucket_policy import StorageBucketPolicy as StorageBucketPolicy from .lifecycle_create_params import LifecycleCreateParams as LifecycleCreateParams diff --git a/src/gcore/types/storage/buckets/storage_bucket_cors.py b/src/gcore/types/storage/buckets/bucket_cors.py similarity index 87% rename from src/gcore/types/storage/buckets/storage_bucket_cors.py rename to src/gcore/types/storage/buckets/bucket_cors.py index 0cb18124..42a3e527 100644 --- a/src/gcore/types/storage/buckets/storage_bucket_cors.py +++ b/src/gcore/types/storage/buckets/bucket_cors.py @@ -6,10 +6,10 @@ from ...._models import BaseModel -__all__ = ["StorageBucketCors"] +__all__ = ["BucketCors"] -class StorageBucketCors(BaseModel): +class BucketCors(BaseModel): 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/buckets/storage_bucket_policy.py b/src/gcore/types/storage/buckets/bucket_policy.py similarity index 64% rename from src/gcore/types/storage/buckets/storage_bucket_policy.py rename to src/gcore/types/storage/buckets/bucket_policy.py index ea5bac8f..597b80f3 100644 --- a/src/gcore/types/storage/buckets/storage_bucket_policy.py +++ b/src/gcore/types/storage/buckets/bucket_policy.py @@ -2,6 +2,6 @@ from typing_extensions import TypeAlias -__all__ = ["StorageBucketPolicy"] +__all__ = ["BucketPolicy"] -StorageBucketPolicy: TypeAlias = bool +BucketPolicy: TypeAlias = bool diff --git a/src/gcore/types/storage/location.py b/src/gcore/types/storage/location.py new file mode 100644 index 00000000..0dda2627 --- /dev/null +++ b/src/gcore/types/storage/location.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["Location"] + + +class Location(BaseModel): + address: str + """Full hostname/address for accessing the storage endpoint in this location""" + + allow_for_new_storage: Literal["deny", "allow"] + """Indicates whether new storage can be created in this location""" + + name: str + """Location code (region identifier)""" + + title: str + """Human-readable title for the location""" + + type: Literal["s3", "sftp"] + """Storage protocol type supported in this location""" diff --git a/src/gcore/types/storage/location_list_params.py b/src/gcore/types/storage/location_list_params.py new file mode 100644 index 00000000..89fa8d59 --- /dev/null +++ b/src/gcore/types/storage/location_list_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["LocationListParams"] + + +class LocationListParams(TypedDict, total=False): + limit: int + + offset: int diff --git a/src/gcore/types/storage/location_list_response.py b/src/gcore/types/storage/location_list_response.py deleted file mode 100644 index f95d0e5c..00000000 --- a/src/gcore/types/storage/location_list_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import TypeAlias - -from .storage_location import StorageLocation - -__all__ = ["LocationListResponse"] - -LocationListResponse: TypeAlias = List[StorageLocation] diff --git a/src/gcore/types/storage/statistic_get_usage_series_response.py b/src/gcore/types/storage/statistic_get_usage_series_response.py index a5bf6ea8..9d5d292e 100644 --- a/src/gcore/types/storage/statistic_get_usage_series_response.py +++ b/src/gcore/types/storage/statistic_get_usage_series_response.py @@ -3,10 +3,10 @@ from typing import Optional from ..._models import BaseModel -from .storage_usage_series import StorageUsageSeries +from .usage_series import UsageSeries __all__ = ["StatisticGetUsageSeriesResponse"] class StatisticGetUsageSeriesResponse(BaseModel): - data: Optional[StorageUsageSeries] = None + data: Optional[UsageSeries] = None diff --git a/src/gcore/types/storage/storage_location.py b/src/gcore/types/storage/storage_location.py deleted file mode 100644 index 4805e86b..00000000 --- a/src/gcore/types/storage/storage_location.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["StorageLocation"] - - -class StorageLocation(BaseModel): - id: int - - address: str - """Full hostname/address for accessing the storage endpoint""" - - allow_for_new_storage: Literal["deny", "allow"] - """ - Indicates whether new storage can be created in this location: `allow` enables - storage creation, `deny` prevents it - """ - - name: Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"] - - type: Literal["s3", "sftp"] diff --git a/src/gcore/types/storage/storage_usage_series.py b/src/gcore/types/storage/usage_series.py similarity index 98% rename from src/gcore/types/storage/storage_usage_series.py rename to src/gcore/types/storage/usage_series.py index 75a2f9a9..dbddf56c 100644 --- a/src/gcore/types/storage/storage_usage_series.py +++ b/src/gcore/types/storage/usage_series.py @@ -4,7 +4,7 @@ from ..._models import BaseModel -__all__ = ["StorageUsageSeries", "Clients", "ClientsLocations", "ClientsLocationsStorages"] +__all__ = ["UsageSeries", "Clients", "ClientsLocations", "ClientsLocationsStorages"] class ClientsLocationsStorages(BaseModel): @@ -196,6 +196,6 @@ class Clients(BaseModel): """a TrafficSum is sum of all traffic for grouped period""" -class StorageUsageSeries(BaseModel): +class UsageSeries(BaseModel): clients: Optional[Dict[str, Clients]] = None """a Clients grouped data""" diff --git a/src/gcore/types/storage/storage_usage_total.py b/src/gcore/types/storage/usage_total.py similarity index 95% rename from src/gcore/types/storage/storage_usage_total.py rename to src/gcore/types/storage/usage_total.py index 9f2e5f46..ae2288f7 100644 --- a/src/gcore/types/storage/storage_usage_total.py +++ b/src/gcore/types/storage/usage_total.py @@ -4,7 +4,7 @@ from ..._models import BaseModel -__all__ = ["StorageUsageTotal", "Data", "DataMetrics"] +__all__ = ["UsageTotal", "Data", "DataMetrics"] class DataMetrics(BaseModel): @@ -49,6 +49,6 @@ class Data(BaseModel): metrics: Optional[DataMetrics] = None -class StorageUsageTotal(BaseModel): +class UsageTotal(BaseModel): data: Optional[List[Data]] = None """StorageUsageTotalRes for response""" diff --git a/tests/api_resources/storage/buckets/test_cors.py b/tests/api_resources/storage/buckets/test_cors.py index a3f12c76..d9bc87a6 100644 --- a/tests/api_resources/storage/buckets/test_cors.py +++ b/tests/api_resources/storage/buckets/test_cors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.storage.buckets import StorageBucketCors +from gcore.types.storage.buckets import BucketCors base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -74,7 +74,7 @@ def test_method_get(self, client: Gcore) -> None: bucket_name="bucket_name", storage_id=0, ) - assert_matches_type(StorageBucketCors, cor, path=["response"]) + assert_matches_type(BucketCors, cor, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -86,7 +86,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cor = response.parse() - assert_matches_type(StorageBucketCors, cor, path=["response"]) + assert_matches_type(BucketCors, cor, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -98,7 +98,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cor = response.parse() - assert_matches_type(StorageBucketCors, cor, path=["response"]) + assert_matches_type(BucketCors, cor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -173,7 +173,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: bucket_name="bucket_name", storage_id=0, ) - assert_matches_type(StorageBucketCors, cor, path=["response"]) + assert_matches_type(BucketCors, cor, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -185,7 +185,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cor = await response.parse() - assert_matches_type(StorageBucketCors, cor, path=["response"]) + assert_matches_type(BucketCors, cor, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -197,7 +197,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cor = await response.parse() - assert_matches_type(StorageBucketCors, cor, path=["response"]) + assert_matches_type(BucketCors, cor, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/storage/test_buckets.py b/tests/api_resources/storage/test_buckets.py index 79eb3f8a..eabe5253 100644 --- a/tests/api_resources/storage/test_buckets.py +++ b/tests/api_resources/storage/test_buckets.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.storage import StorageBucket +from gcore.types.storage import Bucket base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -65,7 +65,7 @@ def test_method_list(self, client: Gcore) -> None: bucket = client.storage.buckets.list( storage_id=0, ) - assert_matches_type(SyncOffsetPage[StorageBucket], bucket, path=["response"]) + assert_matches_type(SyncOffsetPage[Bucket], bucket, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -74,7 +74,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: limit=1, offset=0, ) - assert_matches_type(SyncOffsetPage[StorageBucket], bucket, path=["response"]) + assert_matches_type(SyncOffsetPage[Bucket], bucket, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -85,7 +85,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bucket = response.parse() - assert_matches_type(SyncOffsetPage[StorageBucket], bucket, path=["response"]) + assert_matches_type(SyncOffsetPage[Bucket], bucket, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -96,7 +96,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bucket = response.parse() - assert_matches_type(SyncOffsetPage[StorageBucket], bucket, path=["response"]) + assert_matches_type(SyncOffsetPage[Bucket], bucket, path=["response"]) assert cast(Any, response.is_closed) is True @@ -195,7 +195,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: bucket = await async_client.storage.buckets.list( storage_id=0, ) - assert_matches_type(AsyncOffsetPage[StorageBucket], bucket, path=["response"]) + assert_matches_type(AsyncOffsetPage[Bucket], bucket, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -204,7 +204,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No limit=1, offset=0, ) - assert_matches_type(AsyncOffsetPage[StorageBucket], bucket, path=["response"]) + assert_matches_type(AsyncOffsetPage[Bucket], bucket, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -215,7 +215,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bucket = await response.parse() - assert_matches_type(AsyncOffsetPage[StorageBucket], bucket, path=["response"]) + assert_matches_type(AsyncOffsetPage[Bucket], bucket, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -226,7 +226,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bucket = await response.parse() - assert_matches_type(AsyncOffsetPage[StorageBucket], bucket, path=["response"]) + assert_matches_type(AsyncOffsetPage[Bucket], bucket, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/storage/test_locations.py b/tests/api_resources/storage/test_locations.py index f00cc23f..f076ff9b 100644 --- a/tests/api_resources/storage/test_locations.py +++ b/tests/api_resources/storage/test_locations.py @@ -9,9 +9,8 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.storage import LocationListResponse - -# pyright: reportDeprecated=false +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.storage import Location base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,30 +20,34 @@ class TestLocations: @parametrize def test_method_list(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - location = client.storage.locations.list() + location = client.storage.locations.list() + assert_matches_type(SyncOffsetPage[Location], location, path=["response"]) - assert_matches_type(LocationListResponse, location, path=["response"]) + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + location = client.storage.locations.list( + limit=1, + offset=0, + ) + assert_matches_type(SyncOffsetPage[Location], location, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.storage.locations.with_raw_response.list() + response = client.storage.locations.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = response.parse() - assert_matches_type(LocationListResponse, location, path=["response"]) + assert_matches_type(SyncOffsetPage[Location], location, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.storage.locations.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.storage.locations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - location = response.parse() - assert_matches_type(LocationListResponse, location, path=["response"]) + location = response.parse() + assert_matches_type(SyncOffsetPage[Location], location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -56,29 +59,33 @@ class TestAsyncLocations: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - location = await async_client.storage.locations.list() + location = await async_client.storage.locations.list() + assert_matches_type(AsyncOffsetPage[Location], location, path=["response"]) - assert_matches_type(LocationListResponse, location, path=["response"]) + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + location = await async_client.storage.locations.list( + limit=1, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[Location], location, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.storage.locations.with_raw_response.list() + response = await async_client.storage.locations.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = await response.parse() - assert_matches_type(LocationListResponse, location, path=["response"]) + assert_matches_type(AsyncOffsetPage[Location], location, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.storage.locations.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + async with async_client.storage.locations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - location = await response.parse() - assert_matches_type(LocationListResponse, location, path=["response"]) + location = await response.parse() + assert_matches_type(AsyncOffsetPage[Location], location, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/storage/test_statistics.py b/tests/api_resources/storage/test_statistics.py index 3ab66324..4c4739fd 100644 --- a/tests/api_resources/storage/test_statistics.py +++ b/tests/api_resources/storage/test_statistics.py @@ -10,7 +10,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.storage import ( - StorageUsageTotal, + UsageTotal, StatisticGetUsageSeriesResponse, ) @@ -23,7 +23,7 @@ class TestStatistics: @parametrize def test_method_get_usage_aggregated(self, client: Gcore) -> None: statistic = client.storage.statistics.get_usage_aggregated() - assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + assert_matches_type(UsageTotal, statistic, path=["response"]) @parametrize def test_method_get_usage_aggregated_with_all_params(self, client: Gcore) -> None: @@ -33,7 +33,7 @@ def test_method_get_usage_aggregated_with_all_params(self, client: Gcore) -> Non storages=["123-myStorage"], to="2006-01-02", ) - assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + assert_matches_type(UsageTotal, statistic, path=["response"]) @parametrize def test_raw_response_get_usage_aggregated(self, client: Gcore) -> None: @@ -42,7 +42,7 @@ def test_raw_response_get_usage_aggregated(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = response.parse() - assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + assert_matches_type(UsageTotal, statistic, path=["response"]) @parametrize def test_streaming_response_get_usage_aggregated(self, client: Gcore) -> None: @@ -51,7 +51,7 @@ def test_streaming_response_get_usage_aggregated(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = response.parse() - assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + assert_matches_type(UsageTotal, statistic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -102,7 +102,7 @@ class TestAsyncStatistics: @parametrize async def test_method_get_usage_aggregated(self, async_client: AsyncGcore) -> None: statistic = await async_client.storage.statistics.get_usage_aggregated() - assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + assert_matches_type(UsageTotal, statistic, path=["response"]) @parametrize async def test_method_get_usage_aggregated_with_all_params(self, async_client: AsyncGcore) -> None: @@ -112,7 +112,7 @@ async def test_method_get_usage_aggregated_with_all_params(self, async_client: A storages=["123-myStorage"], to="2006-01-02", ) - assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + assert_matches_type(UsageTotal, statistic, path=["response"]) @parametrize async def test_raw_response_get_usage_aggregated(self, async_client: AsyncGcore) -> None: @@ -121,7 +121,7 @@ async def test_raw_response_get_usage_aggregated(self, async_client: AsyncGcore) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = await response.parse() - assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + assert_matches_type(UsageTotal, statistic, path=["response"]) @parametrize async def test_streaming_response_get_usage_aggregated(self, async_client: AsyncGcore) -> None: @@ -130,7 +130,7 @@ async def test_streaming_response_get_usage_aggregated(self, async_client: Async assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = await response.parse() - assert_matches_type(StorageUsageTotal, statistic, path=["response"]) + assert_matches_type(UsageTotal, statistic, path=["response"]) assert cast(Any, response.is_closed) is True From 470e1fcbcbfaa013e36f402a6b48fc3392fc9375 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 16:55:59 +0000 Subject: [PATCH 292/592] feat(api): update field_value type --- .stats.yml | 4 ++-- src/gcore/types/cloud/baremetal/server_create_params.py | 3 +-- src/gcore/types/security/client_profile.py | 4 ++-- src/gcore/types/security/profile_create_params.py | 4 ++-- src/gcore/types/security/profile_recreate_params.py | 4 ++-- src/gcore/types/security/profile_replace_params.py | 4 ++-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7ece6522..eff2b60c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-82710e4affc54069c75e3620abaab301786e7afd7b76433ea54da62a4b6e9b7d.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5978cf09d36496b59aafeffdb04a0e4c10652b85ce18b3803c03362db8ae4715.yml openapi_spec_hash: 9651b07f3ca9fa4b3e7f17ab08aa9d43 -config_hash: 73d242df5d8f0213f2bd62cd792080b5 +config_hash: 53f1995f46a0e2f7e747e65bafa3d6e0 diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index ba955d3b..ba70700a 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -351,8 +351,7 @@ class DDOSProfileField(TypedDict, total=False): field_name: Optional[str] """Human-readable name of the DDoS protection field being configured""" - field_value: Union[Iterable[object], int, str, None] - """Complex value. Only one of 'value' or '`field_value`' must be specified.""" + field_value: object value: Optional[str] """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" diff --git a/src/gcore/types/security/client_profile.py b/src/gcore/types/security/client_profile.py index ce945292..e02111b5 100644 --- a/src/gcore/types/security/client_profile.py +++ b/src/gcore/types/security/client_profile.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, List, Optional from ..._models import BaseModel from .client_profile_template import ClientProfileTemplate @@ -25,7 +25,7 @@ class Field(BaseModel): validation_schema: Dict[str, object] - field_value: Union[object, object, object, object, object, object, None] = None + field_value: Optional[object] = None class Options(BaseModel): diff --git a/src/gcore/types/security/profile_create_params.py b/src/gcore/types/security/profile_create_params.py index 84a9e894..d4bd6d61 100644 --- a/src/gcore/types/security/profile_create_params.py +++ b/src/gcore/types/security/profile_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileCreateParams", "Field"] @@ -21,4 +21,4 @@ class ProfileCreateParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Union[object, object, object, object, object, object, None] + field_value: object diff --git a/src/gcore/types/security/profile_recreate_params.py b/src/gcore/types/security/profile_recreate_params.py index 55c658cb..e1dd3d10 100644 --- a/src/gcore/types/security/profile_recreate_params.py +++ b/src/gcore/types/security/profile_recreate_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileRecreateParams", "Field"] @@ -21,4 +21,4 @@ class ProfileRecreateParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Union[object, object, object, object, object, object, None] + field_value: object diff --git a/src/gcore/types/security/profile_replace_params.py b/src/gcore/types/security/profile_replace_params.py index 10af9a9b..9684dffd 100644 --- a/src/gcore/types/security/profile_replace_params.py +++ b/src/gcore/types/security/profile_replace_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict __all__ = ["ProfileReplaceParams", "Field"] @@ -21,4 +21,4 @@ class ProfileReplaceParams(TypedDict, total=False): class Field(TypedDict, total=False): base_field: Required[int] - field_value: Union[object, object, object, object, object, object, None] + field_value: object From 3b32eff4dc06350cfba161bdc91de0fc5a8f099e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 20:05:19 +0000 Subject: [PATCH 293/592] fix(types): add missing types to method arguments --- .../cloud/gpu_baremetal_clusters/servers.py | 12 ++++++++++++ src/gcore/resources/cloud/instances/interfaces.py | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index a2a4c102..5dbf5590 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -424,11 +424,17 @@ def attach_interface( project_id: int | None = None, region_id: int | None = None, ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile + | server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile + | server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | NotGiven = NOT_GIVEN, interface_name: str | NotGiven = NOT_GIVEN, ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, port_group: int | NotGiven = NOT_GIVEN, security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] + | Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] + | Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, subnet_id: str | NotGiven = NOT_GIVEN, @@ -1041,11 +1047,17 @@ async def attach_interface( project_id: int | None = None, region_id: int | None = None, ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile + | server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile + | server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | NotGiven = NOT_GIVEN, interface_name: str | NotGiven = NOT_GIVEN, ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, port_group: int | NotGiven = NOT_GIVEN, security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] + | Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] + | Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, subnet_id: str | NotGiven = NOT_GIVEN, diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 20e0c0f8..8fc5e453 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -285,11 +285,17 @@ def attach( project_id: int | None = None, region_id: int | None = None, ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile + | interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile + | interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | NotGiven = NOT_GIVEN, interface_name: str | NotGiven = NOT_GIVEN, ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, port_group: int | NotGiven = NOT_GIVEN, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, subnet_id: str | NotGiven = NOT_GIVEN, @@ -647,11 +653,17 @@ async def attach( project_id: int | None = None, region_id: int | None = None, ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile + | interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile + | interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | NotGiven = NOT_GIVEN, interface_name: str | NotGiven = NOT_GIVEN, ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, port_group: int | NotGiven = NOT_GIVEN, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] | NotGiven = NOT_GIVEN, type: str | NotGiven = NOT_GIVEN, subnet_id: str | NotGiven = NOT_GIVEN, From 770080b27877f2026d0334450382ff614f4ce5f9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 12:15:31 +0000 Subject: [PATCH 294/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/resources/cloud/file_shares/access_rules.py | 4 ++-- src/gcore/resources/cloud/file_shares/file_shares.py | 8 ++++---- .../cloud/load_balancers/l7_policies/l7_policies.py | 4 ++-- src/gcore/types/cloud/file_share.py | 2 +- src/gcore/types/cloud/file_share_create_params.py | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.stats.yml b/.stats.yml index eff2b60c..1a99b1fc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5978cf09d36496b59aafeffdb04a0e4c10652b85ce18b3803c03362db8ae4715.yml -openapi_spec_hash: 9651b07f3ca9fa4b3e7f17ab08aa9d43 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-980828aac2b68640a51810b417790a65e149f9a50327bf0e2c9a87afcbf9be2e.yml +openapi_spec_hash: 60043e5edb408f10e9fcb8b9a618a2ce config_hash: 53f1995f46a0e2f7e747e65bafa3d6e0 diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index 5efd03fb..c7c23710 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -118,7 +118,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AccessRuleList: """ - Get file share access rules + List file share access rules Args: project_id: Project ID @@ -299,7 +299,7 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AccessRuleList: """ - Get file share access rules + List file share access rules Args: project_id: Project ID diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index bf7e7b62..b35b9ea8 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -99,7 +99,7 @@ def create( protocol: File share protocol - size: File share size + size: File share size in GiB access: Access Rules @@ -155,7 +155,7 @@ def create( protocol: File share protocol - size: File share size + size: File share size in GiB share_settings: Configuration settings for the share @@ -580,7 +580,7 @@ async def create( protocol: File share protocol - size: File share size + size: File share size in GiB access: Access Rules @@ -636,7 +636,7 @@ async def create( protocol: File share protocol - size: File share size + size: File share size in GiB share_settings: Configuration settings for the share 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 d7cce84f..cd0db02e 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 @@ -283,7 +283,7 @@ def replace( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Replace load balancer L7 policy properties + Replace load balancer L7 policy Args: action: Action @@ -595,7 +595,7 @@ async def replace( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> TaskIDList: """ - Replace load balancer L7 policy properties + Replace load balancer L7 policy Args: action: Action diff --git a/src/gcore/types/cloud/file_share.py b/src/gcore/types/cloud/file_share.py index 63bf7603..288e66db 100644 --- a/src/gcore/types/cloud/file_share.py +++ b/src/gcore/types/cloud/file_share.py @@ -84,7 +84,7 @@ class FileShare(BaseModel): """Share settings specific to the file share type""" size: int - """File share size, GiB""" + """File share size in GiB""" status: Literal[ "available", diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index 4c26cfd7..90fb2abc 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -32,7 +32,7 @@ class CreateStandardFileShareSerializer(TypedDict, total=False): """File share protocol""" size: Required[int] - """File share size""" + """File share size in GiB""" access: Iterable[CreateStandardFileShareSerializerAccess] """Access Rules""" @@ -87,7 +87,7 @@ class CreateVastFileShareSerializer(TypedDict, total=False): """File share protocol""" size: Required[int] - """File share size""" + """File share size in GiB""" share_settings: CreateVastFileShareSerializerShareSettings """Configuration settings for the share""" From e0689d5330237be3b3c92e7c3aca6a01ac67ad59 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 14:38:43 +0000 Subject: [PATCH 295/592] feat(api): manual upload of aggregated API specs --- .stats.yml | 4 +- src/gcore/_client.py | 10 +- src/gcore/resources/cloud/audit_logs.py | 8 +- .../resources/cloud/baremetal/flavors.py | 8 +- src/gcore/resources/cloud/baremetal/images.py | 8 +- .../resources/cloud/baremetal/servers.py | 24 +-- .../resources/cloud/billing_reservations.py | 16 +- src/gcore/resources/cloud/cost_reports.py | 24 +-- .../cloud/file_shares/access_rules.py | 24 +-- .../cloud/file_shares/file_shares.py | 48 ++--- src/gcore/resources/cloud/floating_ips.py | 48 ++--- .../cloud/gpu_baremetal_clusters/flavors.py | 8 +- .../gpu_baremetal_clusters.py | 64 ++---- .../cloud/gpu_baremetal_clusters/images.py | 32 +-- .../gpu_baremetal_clusters/interfaces.py | 8 +- .../cloud/gpu_baremetal_clusters/servers.py | 56 ++---- .../resources/cloud/inference/api_keys.py | 40 +--- .../inference/applications/deployments.py | 40 +--- .../cloud/inference/applications/templates.py | 16 +- .../inference/deployments/deployments.py | 64 ++---- .../cloud/inference/deployments/logs.py | 8 +- .../resources/cloud/inference/flavors.py | 16 +- .../resources/cloud/inference/inference.py | 8 +- .../cloud/inference/registry_credentials.py | 40 +--- .../resources/cloud/inference/secrets.py | 40 +--- .../resources/cloud/instances/flavors.py | 8 +- src/gcore/resources/cloud/instances/images.py | 48 ++--- .../resources/cloud/instances/instances.py | 112 +++-------- .../resources/cloud/instances/interfaces.py | 24 +-- .../resources/cloud/instances/metrics.py | 8 +- src/gcore/resources/cloud/ip_ranges.py | 8 +- .../resources/cloud/k8s/clusters/clusters.py | 72 ++----- .../resources/cloud/k8s/clusters/nodes.py | 16 +- .../cloud/k8s/clusters/pools/nodes.py | 16 +- .../cloud/k8s/clusters/pools/pools.py | 48 ++--- src/gcore/resources/cloud/k8s/flavors.py | 8 +- src/gcore/resources/cloud/k8s/k8s.py | 8 +- .../resources/cloud/load_balancers/flavors.py | 8 +- .../load_balancers/l7_policies/l7_policies.py | 40 +--- .../cloud/load_balancers/l7_policies/rules.py | 40 +--- .../cloud/load_balancers/listeners.py | 40 +--- .../cloud/load_balancers/load_balancers.py | 56 ++---- .../resources/cloud/load_balancers/metrics.py | 8 +- .../load_balancers/pools/health_monitors.py | 16 +- .../cloud/load_balancers/pools/members.py | 16 +- .../cloud/load_balancers/pools/pools.py | 40 +--- .../cloud/load_balancers/statuses.py | 16 +- .../resources/cloud/networks/networks.py | 40 +--- src/gcore/resources/cloud/networks/routers.py | 56 ++---- src/gcore/resources/cloud/networks/subnets.py | 40 +--- src/gcore/resources/cloud/placement_groups.py | 32 +-- src/gcore/resources/cloud/projects.py | 32 +-- src/gcore/resources/cloud/quotas/quotas.py | 24 +-- src/gcore/resources/cloud/quotas/requests.py | 32 +-- src/gcore/resources/cloud/regions.py | 12 +- .../resources/cloud/registries/artifacts.py | 16 +- .../resources/cloud/registries/registries.py | 40 +--- .../cloud/registries/repositories.py | 16 +- src/gcore/resources/cloud/registries/tags.py | 8 +- src/gcore/resources/cloud/registries/users.py | 48 ++--- .../reserved_fixed_ips/reserved_fixed_ips.py | 32 +-- .../resources/cloud/reserved_fixed_ips/vip.py | 40 +--- src/gcore/resources/cloud/secrets.py | 32 +-- .../resources/cloud/security_groups/rules.py | 24 +-- .../cloud/security_groups/security_groups.py | 56 ++---- src/gcore/resources/cloud/ssh_keys.py | 40 +--- src/gcore/resources/cloud/tasks.py | 28 +-- src/gcore/resources/cloud/usage_reports.py | 8 +- .../resources/cloud/users/role_assignments.py | 32 +-- src/gcore/resources/cloud/volumes.py | 80 ++------ src/gcore/resources/dns/dns.py | 12 +- src/gcore/resources/dns/locations.py | 28 +-- src/gcore/resources/dns/metrics.py | 8 +- src/gcore/resources/dns/pickers/pickers.py | 4 +- src/gcore/resources/dns/pickers/presets.py | 8 +- src/gcore/resources/dns/zones/dnssec.py | 16 +- src/gcore/resources/dns/zones/rrsets.py | 48 ++--- src/gcore/resources/dns/zones/zones.py | 80 +++----- src/gcore/resources/fastedge/apps/apps.py | 40 ++-- src/gcore/resources/fastedge/apps/logs.py | 8 +- src/gcore/resources/fastedge/binaries.py | 32 +-- src/gcore/resources/fastedge/fastedge.py | 4 +- src/gcore/resources/fastedge/kv_stores.py | 32 +-- src/gcore/resources/fastedge/secrets.py | 48 ++--- src/gcore/resources/fastedge/statistics.py | 16 +- src/gcore/resources/fastedge/templates.py | 40 +--- src/gcore/resources/iam/api_tokens.py | 32 +-- src/gcore/resources/iam/iam.py | 4 +- src/gcore/resources/iam/users.py | 36 +--- src/gcore/resources/security/bgp_announces.py | 16 +- src/gcore/resources/security/events.py | 8 +- .../resources/security/profile_templates.py | 8 +- src/gcore/resources/security/profiles.py | 48 ++--- .../resources/storage/buckets/buckets.py | 24 +-- src/gcore/resources/storage/buckets/cors.py | 16 +- .../resources/storage/buckets/lifecycle.py | 16 +- src/gcore/resources/storage/buckets/policy.py | 24 +-- src/gcore/resources/storage/credentials.py | 8 +- src/gcore/resources/storage/locations.py | 8 +- src/gcore/resources/storage/statistics.py | 16 +- src/gcore/resources/storage/storage.py | 64 ++---- src/gcore/resources/streaming/ai_tasks.py | 28 +-- src/gcore/resources/streaming/broadcasts.py | 48 ++--- src/gcore/resources/streaming/directories.py | 40 +--- src/gcore/resources/streaming/players.py | 40 ++-- src/gcore/resources/streaming/playlists.py | 48 ++--- src/gcore/resources/streaming/quality_sets.py | 16 +- src/gcore/resources/streaming/restreams.py | 40 +--- src/gcore/resources/streaming/statistics.py | 184 +++++------------- .../resources/streaming/streams/overlays.py | 48 ++--- .../resources/streaming/streams/streams.py | 72 ++----- .../resources/streaming/videos/subtitles.py | 40 +--- .../resources/streaming/videos/videos.py | 56 ++---- src/gcore/resources/waap/advanced_rules.py | 8 +- src/gcore/resources/waap/custom_page_sets.py | 48 ++--- .../resources/waap/domains/advanced_rules.py | 48 ++--- .../resources/waap/domains/api_discovery.py | 48 ++--- .../resources/waap/domains/api_path_groups.py | 8 +- src/gcore/resources/waap/domains/api_paths.py | 40 +--- .../resources/waap/domains/custom_rules.py | 56 ++---- src/gcore/resources/waap/domains/domains.py | 44 ++--- .../resources/waap/domains/firewall_rules.py | 56 ++---- .../waap/domains/insight_silences.py | 40 +--- src/gcore/resources/waap/domains/insights.py | 24 +-- src/gcore/resources/waap/domains/settings.py | 16 +- .../resources/waap/domains/statistics.py | 48 ++--- src/gcore/resources/waap/insights.py | 8 +- src/gcore/resources/waap/ip_info/ip_info.py | 64 ++---- src/gcore/resources/waap/ip_info/metrics.py | 8 +- src/gcore/resources/waap/organizations.py | 8 +- src/gcore/resources/waap/statistics.py | 8 +- src/gcore/resources/waap/tags.py | 4 +- src/gcore/resources/waap/waap.py | 4 +- 133 files changed, 1050 insertions(+), 3036 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1a99b1fc..6209bbc0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-980828aac2b68640a51810b417790a65e149f9a50327bf0e2c9a87afcbf9be2e.yml -openapi_spec_hash: 60043e5edb408f10e9fcb8b9a618a2ce +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69c2f202e608b625930fb755ef34ae2fa30acce4fa987889e10402324aaf689e.yml +openapi_spec_hash: f6aa7b95639f6eb639e408ad321f2861 config_hash: 53f1995f46a0e2f7e747e65bafa3d6e0 diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 94bb9d2b..fb66fd59 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -113,7 +113,6 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") - self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -198,7 +197,7 @@ def copy( params = set_default_query http_client = http_client or self._client - client = self.__class__( + return self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -211,8 +210,6 @@ def copy( default_query=params, **_extra_kwargs, ) - client._base_url_overridden = self._base_url_overridden or base_url is not None - return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) @@ -343,7 +340,6 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") - self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -428,7 +424,7 @@ def copy( params = set_default_query http_client = http_client or self._client - client = self.__class__( + return self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -441,8 +437,6 @@ def copy( default_query=params, **_extra_kwargs, ) - client._base_url_overridden = self._base_url_overridden or base_url is not None - return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index 1f4ae40e..1dad329f 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -206,9 +206,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/user_actions", + "/cloud/v1/user_actions", page=SyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, @@ -417,9 +415,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/user_actions", + "/cloud/v1/user_actions", page=AsyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 91474de4..1645b30b 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -93,9 +93,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -189,9 +187,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index ecc0adc3..a6a22954 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -90,9 +90,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -180,9 +178,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 86bbf8ce..57060e27 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -156,9 +156,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -296,9 +294,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", page=SyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -381,9 +377,7 @@ def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=maybe_transform( { "image_id": image_id, @@ -527,9 +521,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -667,9 +659,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", page=AsyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -752,9 +742,7 @@ async def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=await async_maybe_transform( { "image_id": image_id, diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index ae49d667..0d9df747 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -120,9 +120,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservations", + "/cloud/v1/reservations", page=SyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -176,9 +174,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v1/reservations/{reservation_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -280,9 +276,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservations", + "/cloud/v1/reservations", page=AsyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -336,9 +330,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v1/reservations/{reservation_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 910b8fa7..36075dd6 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -146,9 +146,7 @@ def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals", body=maybe_transform( { "time_from": time_from, @@ -257,9 +255,7 @@ def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/reservation_cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals", body=maybe_transform( { "regions": regions, @@ -385,9 +381,7 @@ def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/resources" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources", body=maybe_transform( { "time_from": time_from, @@ -528,9 +522,7 @@ async def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals", body=await async_maybe_transform( { "time_from": time_from, @@ -639,9 +631,7 @@ async def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/reservation_cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals", body=await async_maybe_transform( { "regions": regions, @@ -767,9 +757,7 @@ async def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/resources" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index c7c23710..34cc65ee 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -88,9 +88,7 @@ def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=maybe_transform( { "access_mode": access_mode, @@ -142,9 +140,7 @@ def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -195,9 +191,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -269,9 +263,7 @@ async def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=await async_maybe_transform( { "access_mode": access_mode, @@ -323,9 +315,7 @@ async def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -376,9 +366,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index b35b9ea8..99a806d5 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -206,9 +206,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -291,9 +289,7 @@ def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=maybe_transform( { "name": name, @@ -353,9 +349,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", page=SyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -413,9 +407,7 @@ def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -460,9 +452,7 @@ def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -510,9 +500,7 @@ def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -687,9 +675,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -772,9 +758,7 @@ async def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=await async_maybe_transform( { "name": name, @@ -834,9 +818,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", page=AsyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -894,9 +876,7 @@ async def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -941,9 +921,7 @@ async def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -991,9 +969,7 @@ async def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=await async_maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 9362d7cc..2815f3cb 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -94,9 +94,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", body=maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -157,9 +155,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", page=SyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -211,9 +207,7 @@ def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -258,9 +252,7 @@ def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=maybe_transform( { "port_id": port_id, @@ -306,9 +298,7 @@ def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -347,9 +337,7 @@ def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +413,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", body=await async_maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -488,9 +474,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", page=AsyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -542,9 +526,7 @@ async def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -589,9 +571,7 @@ async def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=await async_maybe_transform( { "port_id": port_id, @@ -637,9 +617,7 @@ async def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -678,9 +656,7 @@ async def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index 6d594b3b..2c4563b5 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -80,9 +80,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -159,9 +157,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 7fb94685..526babdf 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -156,9 +156,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=maybe_transform( { "flavor": flavor, @@ -222,9 +220,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=SyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -295,9 +291,7 @@ def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -354,9 +348,7 @@ def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -395,9 +387,7 @@ def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -436,9 +426,7 @@ def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -490,9 +478,7 @@ def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=maybe_transform( { "nodes": nodes, @@ -544,9 +530,7 @@ def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, @@ -649,9 +633,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=await async_maybe_transform( { "flavor": flavor, @@ -715,9 +697,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=AsyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -788,9 +768,7 @@ async def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -847,9 +825,7 @@ async def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -888,9 +864,7 @@ async def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -929,9 +903,7 @@ async def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -983,9 +955,7 @@ async def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=await async_maybe_transform( { "nodes": nodes, @@ -1037,9 +1007,7 @@ async def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=await async_maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 249c8d3f..8c2d4623 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -79,9 +79,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -126,9 +124,7 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -173,9 +169,7 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +244,7 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=maybe_transform( { "name": name, @@ -328,9 +320,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -375,9 +365,7 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -422,9 +410,7 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -499,9 +485,7 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index ad75df3e..863ffde8 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -71,9 +71,7 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -133,9 +131,7 @@ async def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 5dbf5590..adda6989 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -143,9 +143,7 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=SyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -211,9 +209,7 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -454,9 +450,7 @@ def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -515,9 +509,7 @@ def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -563,9 +555,7 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -604,9 +594,7 @@ def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -645,9 +633,7 @@ def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -764,9 +750,7 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=AsyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -832,9 +816,7 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1077,9 +1059,7 @@ async def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -1138,9 +1118,7 @@ async def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, @@ -1186,9 +1164,7 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1227,9 +1203,7 @@ async def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1268,9 +1242,7 @@ async def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py index f9f5ccb9..98238c19 100644 --- a/src/gcore/resources/cloud/inference/api_keys.py +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -84,9 +84,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", body=maybe_transform( { "name": name, @@ -137,9 +135,7 @@ def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -182,9 +178,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", page=SyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -239,9 +233,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,9 +273,7 @@ def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,9 +340,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", body=await async_maybe_transform( { "name": name, @@ -403,9 +391,7 @@ async def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=await async_maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -448,9 +434,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", page=AsyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -505,9 +489,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,9 +529,7 @@ async def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index 43b6893f..845bffce 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -93,9 +93,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", body=maybe_transform( { "application_name": application_name, @@ -142,9 +140,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -186,9 +182,7 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -232,9 +226,7 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -288,9 +280,7 @@ def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -372,9 +362,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", body=await async_maybe_transform( { "application_name": application_name, @@ -421,9 +409,7 @@ async def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -465,9 +451,7 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -511,9 +495,7 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -567,9 +549,7 @@ async def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, diff --git a/src/gcore/resources/cloud/inference/applications/templates.py b/src/gcore/resources/cloud/inference/applications/templates.py index 664203be..1c475cb8 100644 --- a/src/gcore/resources/cloud/inference/applications/templates.py +++ b/src/gcore/resources/cloud/inference/applications/templates.py @@ -58,9 +58,7 @@ def list( required to create a fully functional application deployment. """ return self._get( - "/cloud/v3/inference/applications/catalog" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -99,9 +97,7 @@ def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -147,9 +143,7 @@ async def list( required to create a fully functional application deployment. """ return await self._get( - "/cloud/v3/inference/applications/catalog" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -188,9 +182,7 @@ async def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return await self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 0cccc581..3a4e4629 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -147,9 +147,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", body=maybe_transform( { "containers": containers, @@ -265,9 +263,7 @@ def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -329,9 +325,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", page=SyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -382,9 +376,7 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,9 +416,7 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,9 +457,7 @@ def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,9 +505,7 @@ def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -567,9 +553,7 @@ def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -689,9 +673,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", body=await async_maybe_transform( { "containers": containers, @@ -807,9 +789,7 @@ async def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, @@ -871,9 +851,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", page=AsyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -924,9 +902,7 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -966,9 +942,7 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1009,9 +983,7 @@ async def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1059,9 +1031,7 @@ async def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1109,9 +1079,7 @@ async def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index 2ee0666e..1cc65006 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -91,9 +91,7 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=SyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, @@ -180,9 +178,7 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=AsyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index 8dcc3e62..d273b19b 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -73,9 +73,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors", page=SyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -121,9 +119,7 @@ def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return self._get( - f"/cloud/v3/inference/flavors/{flavor_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,9 +178,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors", page=AsyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -230,9 +224,7 @@ async def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return await self._get( - f"/cloud/v3/inference/flavors/{flavor_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index b116b08f..103c70f1 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -123,9 +123,7 @@ def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return self._get( - "/cloud/v3/inference/capacity" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -189,9 +187,7 @@ async def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return await self._get( - "/cloud/v3/inference/capacity" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 9d5a4072..6dd78f70 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -86,9 +86,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", body=maybe_transform( { "name": name, @@ -139,9 +137,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", page=SyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -193,9 +189,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -235,9 +229,7 @@ def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -286,9 +278,7 @@ def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=maybe_transform( { "password": password, @@ -364,9 +354,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", body=await async_maybe_transform( { "name": name, @@ -417,9 +405,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", page=AsyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -471,9 +457,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -513,9 +497,7 @@ async def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -564,9 +546,7 @@ async def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=await async_maybe_transform( { "password": password, diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index ed312faa..275ec3f2 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -79,9 +79,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", body=maybe_transform( { "data": data, @@ -132,9 +130,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", page=SyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -186,9 +182,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,9 +222,7 @@ def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,9 +268,7 @@ def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", body=maybe_transform( { "data": data, @@ -350,9 +340,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", body=await async_maybe_transform( { "data": data, @@ -403,9 +391,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", page=AsyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -457,9 +443,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -499,9 +483,7 @@ async def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,9 +529,7 @@ async def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", body=await async_maybe_transform( { "data": data, diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 3bf61d85..9bd7f38f 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -85,9 +85,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -171,9 +169,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index b45fd614..af8e82a7 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -110,9 +110,7 @@ def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", body=maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -178,9 +176,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -234,9 +230,7 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -308,9 +302,7 @@ def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -367,9 +359,7 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -452,9 +442,7 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -556,9 +544,7 @@ async def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", body=await async_maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -624,9 +610,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -680,9 +664,7 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -754,9 +736,7 @@ async def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -813,9 +793,7 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -898,9 +876,7 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index dde03b4b..77fbc20b 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -228,9 +228,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -297,9 +295,7 @@ def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -448,9 +444,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}", page=SyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -544,9 +538,7 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -655,9 +647,7 @@ def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=maybe_transform( { "action": action, @@ -708,9 +698,7 @@ def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -763,9 +751,7 @@ def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=maybe_transform( { "name": name, @@ -811,9 +797,7 @@ def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -852,9 +836,7 @@ def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -908,9 +890,7 @@ def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -952,9 +932,7 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1001,9 +979,7 @@ def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1045,9 +1021,7 @@ def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1097,9 +1071,7 @@ def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=maybe_transform( { "name": name, @@ -1270,9 +1242,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -1339,9 +1309,7 @@ async def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1490,9 +1458,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}", page=AsyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -1586,9 +1552,7 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1697,9 +1661,7 @@ async def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=await async_maybe_transform( { "action": action, @@ -1750,9 +1712,7 @@ async def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=await async_maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -1805,9 +1765,7 @@ async def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=await async_maybe_transform( { "name": name, @@ -1853,9 +1811,7 @@ async def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1894,9 +1850,7 @@ async def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1950,9 +1904,7 @@ async def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1994,9 +1946,7 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2043,9 +1993,7 @@ async def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2087,9 +2035,7 @@ async def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=await async_maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -2139,9 +2085,7 @@ async def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 8fc5e453..61fe4266 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -77,9 +77,7 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -315,9 +313,7 @@ def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -376,9 +372,7 @@ def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -445,9 +439,7 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -683,9 +675,7 @@ async def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -744,9 +734,7 @@ async def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index 03ffbcd1..fa058434 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -87,9 +87,7 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -168,9 +166,7 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index b0d0c62e..12024d04 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -67,9 +67,7 @@ def list( returned. """ return self._get( - "/cloud/public/v1/ipranges/egress" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -125,9 +123,7 @@ async def list( returned. """ return await self._get( - "/cloud/public/v1/ipranges/egress" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index 198ead21..a778a3b9 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -210,9 +210,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", body=maybe_transform( { "keypair": keypair, @@ -341,9 +339,7 @@ def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=maybe_transform( { "authentication": authentication, @@ -389,9 +385,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -433,9 +427,7 @@ def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -478,9 +470,7 @@ def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -519,9 +509,7 @@ def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -560,9 +548,7 @@ def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -601,9 +587,7 @@ def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -645,9 +629,7 @@ def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -817,9 +799,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", body=await async_maybe_transform( { "keypair": keypair, @@ -948,9 +928,7 @@ async def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=await async_maybe_transform( { "authentication": authentication, @@ -996,9 +974,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1040,9 +1016,7 @@ async def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1085,9 +1059,7 @@ async def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1126,9 +1098,7 @@ async def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1167,9 +1137,7 @@ async def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1208,9 +1176,7 @@ async def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1252,9 +1218,7 @@ async def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=await async_maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/clusters/nodes.py b/src/gcore/resources/cloud/k8s/clusters/nodes.py index d04a0586..b3bd95d8 100644 --- a/src/gcore/resources/cloud/k8s/clusters/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/nodes.py @@ -76,9 +76,7 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -126,9 +124,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,9 +187,7 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -241,9 +235,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py index 8ff64793..903c428e 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py @@ -79,9 +79,7 @@ def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -132,9 +130,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -200,9 +196,7 @@ async def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -253,9 +247,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index b60e3039..0cb81d5a 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -130,9 +130,7 @@ def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=maybe_transform( { "flavor_id": flavor_id, @@ -210,9 +208,7 @@ def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -262,9 +258,7 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -306,9 +300,7 @@ def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,9 +342,7 @@ def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -397,9 +387,7 @@ def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -504,9 +492,7 @@ async def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=await async_maybe_transform( { "flavor_id": flavor_id, @@ -584,9 +570,7 @@ async def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=await async_maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -636,9 +620,7 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -680,9 +662,7 @@ async def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -724,9 +704,7 @@ async def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -771,9 +749,7 @@ async def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=await async_maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/flavors.py b/src/gcore/resources/cloud/k8s/flavors.py index cd456f26..71781231 100644 --- a/src/gcore/resources/cloud/k8s/flavors.py +++ b/src/gcore/resources/cloud/k8s/flavors.py @@ -79,9 +79,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -157,9 +155,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index c193fccd..ad74c5fd 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -92,9 +92,7 @@ def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -159,9 +157,7 @@ async def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index d104d723..48ba2c61 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -76,9 +76,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -145,9 +143,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index cd0db02e..c78be82d 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py @@ -118,9 +118,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", body=maybe_transform( { "action": action, @@ -170,9 +168,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +207,7 @@ def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -252,9 +246,7 @@ def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -322,9 +314,7 @@ def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=maybe_transform( { "action": action, @@ -430,9 +420,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", body=await async_maybe_transform( { "action": action, @@ -482,9 +470,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,9 +509,7 @@ async def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -564,9 +548,7 @@ async def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -634,9 +616,7 @@ async def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=await async_maybe_transform( { "action": action, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py index b83bb590..34063a17 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -106,9 +106,7 @@ def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=maybe_transform( { "compare_type": compare_type, @@ -158,9 +156,7 @@ def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -202,9 +198,7 @@ def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -246,9 +240,7 @@ def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -320,9 +312,7 @@ def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=maybe_transform( { "compare_type": compare_type, @@ -422,9 +412,7 @@ async def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=await async_maybe_transform( { "compare_type": compare_type, @@ -474,9 +462,7 @@ async def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -518,9 +504,7 @@ async def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -562,9 +546,7 @@ async def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -636,9 +618,7 @@ async def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=await async_maybe_transform( { "compare_type": compare_type, diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index abbb5e77..bf760cfb 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -127,9 +127,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -221,9 +219,7 @@ def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -283,9 +279,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -340,9 +334,7 @@ def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +382,7 @@ def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -499,9 +489,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=await async_maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -593,9 +581,7 @@ async def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=await async_maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -655,9 +641,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -712,9 +696,7 @@ async def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -762,9 +744,7 @@ async def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 9a8070b5..f50f4ce5 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -207,9 +207,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -299,9 +297,7 @@ def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=maybe_transform( { "logging": logging, @@ -379,9 +375,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", page=SyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -439,9 +433,7 @@ def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -483,9 +475,7 @@ def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -531,9 +521,7 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -585,9 +573,7 @@ def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -718,9 +704,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -810,9 +794,7 @@ async def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=await async_maybe_transform( { "logging": logging, @@ -890,9 +872,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", page=AsyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -950,9 +930,7 @@ async def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -994,9 +972,7 @@ async def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=await async_maybe_transform( {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams ), @@ -1044,9 +1020,7 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1098,9 +1072,7 @@ async def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index dd0dedd2..59df8038 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -81,9 +81,7 @@ def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -156,9 +154,7 @@ async def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index 417ae8b0..bae1858c 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -115,9 +115,7 @@ def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=maybe_transform( { "delay": delay, @@ -179,9 +177,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -278,9 +274,7 @@ async def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=await async_maybe_transform( { "delay": delay, @@ -342,9 +336,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 37faaa3a..05091a8b 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -131,9 +131,7 @@ def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=maybe_transform( { "address": address, @@ -197,9 +195,7 @@ def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -315,9 +311,7 @@ async def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=await async_maybe_transform( { "address": address, @@ -381,9 +375,7 @@ async def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 01abaebd..c0df516c 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -147,9 +147,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", body=maybe_transform( { "lb_algorithm": lb_algorithm, @@ -264,9 +262,7 @@ def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=maybe_transform( { "ca_secret_id": ca_secret_id, @@ -332,9 +328,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -390,9 +384,7 @@ def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -437,9 +429,7 @@ def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -550,9 +540,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", body=await async_maybe_transform( { "lb_algorithm": lb_algorithm, @@ -667,9 +655,7 @@ async def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=await async_maybe_transform( { "ca_secret_id": ca_secret_id, @@ -735,9 +721,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -793,9 +777,7 @@ async def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -840,9 +822,7 @@ async def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index e99f90c9..5579e857 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -69,9 +69,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -110,9 +108,7 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -169,9 +165,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -210,9 +204,7 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 235648f0..2fda130e 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -120,9 +120,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -203,9 +201,7 @@ def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=maybe_transform( { "name": name, @@ -272,9 +268,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", page=SyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -334,9 +328,7 @@ def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -381,9 +373,7 @@ def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -468,9 +458,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -551,9 +539,7 @@ async def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=await async_maybe_transform( { "name": name, @@ -620,9 +606,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", page=AsyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -682,9 +666,7 @@ async def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -729,9 +711,7 @@ async def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 93596051..657982bd 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -92,9 +92,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -151,9 +149,7 @@ def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=maybe_transform( { "external_gateway_info": external_gateway_info, @@ -203,9 +199,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", page=SyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -255,9 +249,7 @@ def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -309,9 +301,7 @@ def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=maybe_transform( { "subnet_id": subnet_id, @@ -360,9 +350,7 @@ def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=maybe_transform({"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -402,9 +390,7 @@ def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,9 +459,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -532,9 +516,7 @@ async def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=await async_maybe_transform( { "external_gateway_info": external_gateway_info, @@ -584,9 +566,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", page=AsyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -636,9 +616,7 @@ async def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -690,9 +668,7 @@ async def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=await async_maybe_transform( { "subnet_id": subnet_id, @@ -741,9 +717,7 @@ async def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=await async_maybe_transform( {"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams ), @@ -785,9 +759,7 @@ async def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index aef9bb2a..b781c2e3 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -125,9 +125,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", body=maybe_transform( { "cidr": cidr, @@ -227,9 +225,7 @@ def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=maybe_transform( { "dns_nameservers": dns_nameservers, @@ -315,9 +311,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", page=SyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -378,9 +372,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +417,7 @@ def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -531,9 +521,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", body=await async_maybe_transform( { "cidr": cidr, @@ -633,9 +621,7 @@ async def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=await async_maybe_transform( { "dns_nameservers": dns_nameservers, @@ -721,9 +707,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", page=AsyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -784,9 +768,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -831,9 +813,7 @@ async def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 4c3a5142..31777c13 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -80,9 +80,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -125,9 +123,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -166,9 +162,7 @@ def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -207,9 +201,7 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -272,9 +264,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -317,9 +307,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -358,9 +346,7 @@ async def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -399,9 +385,7 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 0603b072..383f3c3b 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -83,7 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", body=maybe_transform( { "name": name, @@ -142,7 +142,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", page=SyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -193,9 +193,7 @@ def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._delete( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,9 +226,7 @@ def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -271,9 +267,7 @@ def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._put( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", body=maybe_transform( { "name": name, @@ -345,7 +339,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", body=await async_maybe_transform( { "name": name, @@ -404,7 +398,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", page=AsyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -455,9 +449,7 @@ async def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._delete( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -490,9 +482,7 @@ async def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -533,9 +523,7 @@ async def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._put( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 17a7d75a..9a9f9c82 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -65,9 +65,7 @@ def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return self._get( - "/cloud/v2/client_quotas" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/client_quotas", + "/cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -105,9 +103,7 @@ def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -140,9 +136,7 @@ def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/global_quotas/{client_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -186,9 +180,7 @@ async def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return await self._get( - "/cloud/v2/client_quotas" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/client_quotas", + "/cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,9 +218,7 @@ async def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -261,9 +251,7 @@ async def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/global_quotas/{client_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 4c49c8b0..79d4febe 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -79,9 +79,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", body=maybe_transform( { "description": description, @@ -129,9 +127,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", page=SyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -177,9 +173,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -212,9 +206,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -275,9 +267,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", body=await async_maybe_transform( { "description": description, @@ -325,9 +315,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", page=AsyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -373,9 +361,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -408,9 +394,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index df9da044..b49adfcd 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -86,7 +86,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", + "/cloud/v1/regions", page=SyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -139,9 +139,7 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/regions/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -215,7 +213,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", + "/cloud/v1/regions", page=AsyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -268,9 +266,7 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/regions/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index 77496af1..0b579ba5 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -72,9 +72,7 @@ def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -118,9 +116,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,9 +177,7 @@ async def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -227,9 +221,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index b8623cf3..8889d473 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -126,9 +126,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -171,9 +169,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +207,7 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +244,7 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -292,9 +284,7 @@ def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=maybe_transform({"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -375,9 +365,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -420,9 +408,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -460,9 +446,7 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -499,9 +483,7 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -541,9 +523,7 @@ async def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=await async_maybe_transform( {"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams ), diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index 452755d2..74377052 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -69,9 +69,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -112,9 +110,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -172,9 +168,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -215,9 +209,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index 7bed1478..ab35828c 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -78,9 +78,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,9 +146,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index 8c402baf..f535c7dd 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -89,9 +89,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=maybe_transform( { "duration": duration, @@ -144,9 +142,7 @@ def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=maybe_transform( { "duration": duration, @@ -190,9 +186,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -231,9 +225,7 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,9 +265,7 @@ def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -314,9 +304,7 @@ def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,9 +375,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=await async_maybe_transform( { "duration": duration, @@ -442,9 +428,7 @@ async def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=await async_maybe_transform( { "duration": duration, @@ -488,9 +472,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,9 +511,7 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -571,9 +551,7 @@ async def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=await async_maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -612,9 +590,7 @@ async def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index 1cd099f6..d5b0e030 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -274,9 +274,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=maybe_transform( { "type": type, @@ -354,9 +352,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=SyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -413,9 +409,7 @@ def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -454,9 +448,7 @@ def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -703,9 +695,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=await async_maybe_transform( { "type": type, @@ -783,9 +773,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=AsyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -842,9 +830,7 @@ async def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -883,9 +869,7 @@ async def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 22757eba..1d6c76e2 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -79,9 +79,7 @@ def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -120,9 +118,7 @@ def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -164,9 +160,7 @@ def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -211,9 +205,7 @@ def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -256,9 +248,7 @@ def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), @@ -321,9 +311,7 @@ async def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -362,9 +350,7 @@ async def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -406,9 +392,7 @@ async def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -453,9 +437,7 @@ async def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=await async_maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -498,9 +480,7 @@ async def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index dabef59a..5cbefb25 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -86,9 +86,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}", page=SyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -144,9 +142,7 @@ def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,9 +187,7 @@ def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,9 +236,7 @@ def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -320,9 +312,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}", page=AsyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -378,9 +368,7 @@ async def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +413,7 @@ async def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -476,9 +462,7 @@ async def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index c69d2608..89b27a23 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -126,9 +126,7 @@ def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=maybe_transform( { "description": description, @@ -181,9 +179,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -277,9 +273,7 @@ def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=maybe_transform( { "direction": direction, @@ -403,9 +397,7 @@ async def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=await async_maybe_transform( { "description": description, @@ -458,9 +450,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -554,9 +544,7 @@ async def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=await async_maybe_transform( { "direction": direction, diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 0e24383b..ac4d9bc3 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -97,9 +97,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", body=maybe_transform( { "security_group": security_group, @@ -172,9 +170,7 @@ def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=maybe_transform( { "changed_rules": changed_rules, @@ -230,9 +226,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", page=SyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -285,9 +279,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -329,9 +321,7 @@ def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -371,9 +361,7 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -412,9 +400,7 @@ def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -481,9 +467,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", body=await async_maybe_transform( { "security_group": security_group, @@ -556,9 +540,7 @@ async def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=await async_maybe_transform( { "changed_rules": changed_rules, @@ -614,9 +596,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", page=AsyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -669,9 +649,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -713,9 +691,7 @@ async def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=await async_maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -755,9 +731,7 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -796,9 +770,7 @@ async def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 30ef2830..788d415c 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -90,9 +90,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", body=maybe_transform( { "name": name, @@ -143,9 +141,7 @@ def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=maybe_transform({"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -190,9 +186,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", page=SyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -245,9 +239,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -287,9 +279,7 @@ def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -362,9 +352,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", body=await async_maybe_transform( { "name": name, @@ -415,9 +403,7 @@ async def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=await async_maybe_transform( {"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams ), @@ -464,9 +450,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", page=AsyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -519,9 +503,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -561,9 +543,7 @@ async def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index c0866b41..63bc78f7 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -156,7 +156,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", + "/cloud/v1/tasks", page=SyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -213,9 +213,7 @@ def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v1/tasks/acknowledge_all" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -260,9 +258,7 @@ def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -297,9 +293,7 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/cloud/v1/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -437,7 +431,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", + "/cloud/v1/tasks", page=AsyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -494,9 +488,7 @@ async def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v1/tasks/acknowledge_all" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -541,9 +533,7 @@ async def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -578,9 +568,7 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/cloud/v1/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index 48387eda..0adc0809 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -139,9 +139,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/usage_report" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/usage_report", + "/cloud/v1/usage_report", body=maybe_transform( { "time_from": time_from, @@ -279,9 +277,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/usage_report" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/usage_report", + "/cloud/v1/usage_report", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 0318b8fc..5294d3a7 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -85,9 +85,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", body=maybe_transform( { "role": role, @@ -141,9 +139,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", body=maybe_transform( { "role": role, @@ -195,9 +191,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", page=SyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -243,9 +237,7 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ return self._delete( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -308,9 +300,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", body=await async_maybe_transform( { "role": role, @@ -364,9 +354,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", body=await async_maybe_transform( { "role": role, @@ -418,9 +406,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", page=AsyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -466,9 +452,7 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ return await self._delete( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 74756335..ed0babaa 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -292,9 +292,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", body=maybe_transform( { "image_id": image_id, @@ -378,9 +376,7 @@ def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=maybe_transform( { "name": name, @@ -462,9 +458,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", page=SyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -533,9 +527,7 @@ def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -592,9 +584,7 @@ def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=maybe_transform( { "instance_id": instance_id, @@ -651,9 +641,7 @@ def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=maybe_transform({"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -702,9 +690,7 @@ def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -752,9 +738,7 @@ def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -804,9 +788,7 @@ def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -855,9 +837,7 @@ def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1121,9 +1101,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", body=await async_maybe_transform( { "image_id": image_id, @@ -1207,9 +1185,7 @@ async def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=await async_maybe_transform( { "name": name, @@ -1291,9 +1267,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", page=AsyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -1362,9 +1336,7 @@ async def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1421,9 +1393,7 @@ async def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=await async_maybe_transform( { "instance_id": instance_id, @@ -1480,9 +1450,7 @@ async def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=await async_maybe_transform( {"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams ), @@ -1533,9 +1501,7 @@ async def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=await async_maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -1583,9 +1549,7 @@ async def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1635,9 +1599,7 @@ async def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=await async_maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1686,9 +1648,7 @@ async def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py index 612cd629..3e6485d0 100644 --- a/src/gcore/resources/dns/dns.py +++ b/src/gcore/resources/dns/dns.py @@ -104,9 +104,7 @@ def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return self._get( - "/dns/v2/platform/info" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/platform/info", + "/dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -143,7 +141,7 @@ def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", + "/dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -209,9 +207,7 @@ async def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return await self._get( - "/dns/v2/platform/info" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/platform/info", + "/dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -248,7 +244,7 @@ async def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", + "/dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/locations.py b/src/gcore/resources/dns/locations.py index c58907a8..20dcea5a 100644 --- a/src/gcore/resources/dns/locations.py +++ b/src/gcore/resources/dns/locations.py @@ -54,7 +54,7 @@ def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return self._get( - "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", + "/dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -73,9 +73,7 @@ def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return self._get( - "/dns/v2/locations/continents" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/continents", + "/dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -94,9 +92,7 @@ def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return self._get( - "/dns/v2/locations/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/countries", + "/dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -115,9 +111,7 @@ def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return self._get( - "/dns/v2/locations/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/regions", + "/dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -157,7 +151,7 @@ async def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return await self._get( - "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", + "/dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -176,9 +170,7 @@ async def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return await self._get( - "/dns/v2/locations/continents" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/continents", + "/dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -197,9 +189,7 @@ async def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return await self._get( - "/dns/v2/locations/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/countries", + "/dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -218,9 +208,7 @@ async def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return await self._get( - "/dns/v2/locations/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/regions", + "/dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index b9bf45a5..8eef7aeb 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -82,9 +82,7 @@ def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return self._get( - "/dns/v2/monitor/metrics" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -162,9 +160,7 @@ async def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return await self._get( - "/dns/v2/monitor/metrics" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/pickers/pickers.py b/src/gcore/resources/dns/pickers/pickers.py index 599a2450..3078c7f2 100644 --- a/src/gcore/resources/dns/pickers/pickers.py +++ b/src/gcore/resources/dns/pickers/pickers.py @@ -63,7 +63,7 @@ def list( ) -> PickerListResponse: """Returns list of picker""" return self._get( - "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", + "/dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -107,7 +107,7 @@ async def list( ) -> PickerListResponse: """Returns list of picker""" return await self._get( - "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", + "/dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/pickers/presets.py b/src/gcore/resources/dns/pickers/presets.py index 09f7d53b..aebd10ff 100644 --- a/src/gcore/resources/dns/pickers/presets.py +++ b/src/gcore/resources/dns/pickers/presets.py @@ -51,9 +51,7 @@ def list( ) -> PresetListResponse: """Returns list of picker preset""" return self._get( - "/dns/v2/pickers/presets" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/pickers/presets", + "/dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -93,9 +91,7 @@ async def list( ) -> PresetListResponse: """Returns list of picker preset""" return await self._get( - "/dns/v2/pickers/presets" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/pickers/presets", + "/dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/dnssec.py b/src/gcore/resources/dns/zones/dnssec.py index 8f283155..8c747071 100644 --- a/src/gcore/resources/dns/zones/dnssec.py +++ b/src/gcore/resources/dns/zones/dnssec.py @@ -69,9 +69,7 @@ def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", body=maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -105,9 +103,7 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -162,9 +158,7 @@ async def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", body=await async_maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -198,9 +192,7 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index 93697456..e1d136b1 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -205,9 +205,7 @@ def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -261,9 +259,7 @@ def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/rrsets" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -314,9 +310,7 @@ def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -355,9 +349,7 @@ def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,9 +394,7 @@ def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -463,9 +453,7 @@ def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -656,9 +644,7 @@ async def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, @@ -712,9 +698,7 @@ async def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/rrsets" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -765,9 +749,7 @@ async def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -806,9 +788,7 @@ async def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -853,9 +833,7 @@ async def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -914,9 +892,7 @@ async def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 31b815a3..75e11dde 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -143,7 +143,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", body=maybe_transform( { "name": name, @@ -225,7 +225,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -283,9 +283,7 @@ def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._delete( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -320,9 +318,7 @@ def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._post( - f"/dns/v2/analyze/{name}/delegation-status" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -355,9 +351,7 @@ def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/disable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +384,7 @@ def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/enable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +417,7 @@ def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/export" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -460,9 +450,7 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,9 +517,7 @@ def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/statistics" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -597,9 +583,7 @@ def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._post( - f"/dns/v2/zones/{zone_name}/import" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import", body=maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -672,9 +656,7 @@ def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return self._put( - f"/dns/v2/zones/{path_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}", body=maybe_transform( { "body_name": body_name, @@ -787,7 +769,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", body=await async_maybe_transform( { "name": name, @@ -869,7 +851,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -927,9 +909,7 @@ async def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._delete( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -964,9 +944,7 @@ async def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._post( - f"/dns/v2/analyze/{name}/delegation-status" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -999,9 +977,7 @@ async def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/disable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1034,9 +1010,7 @@ async def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/enable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1069,9 +1043,7 @@ async def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/export" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1104,9 +1076,7 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1173,9 +1143,7 @@ async def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/statistics" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1241,9 +1209,7 @@ async def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/import" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import", body=await async_maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1316,9 +1282,7 @@ async def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return await self._put( - f"/dns/v2/zones/{path_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}", body=await async_maybe_transform( { "body_name": body_name, diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index a72cd50f..92d2662a 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -121,7 +121,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", body=maybe_transform( { "binary": binary, @@ -208,9 +208,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=maybe_transform( { "binary": binary, @@ -307,7 +305,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", page=SyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -357,9 +355,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +386,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,9 +418,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -522,7 +514,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", body=await async_maybe_transform( { "binary": binary, @@ -609,9 +601,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=await async_maybe_transform( { "binary": binary, @@ -708,7 +698,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", page=AsyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -758,9 +748,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -791,9 +779,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -825,9 +811,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=await async_maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py index b61bcfd9..f43d121c 100644 --- a/src/gcore/resources/fastedge/apps/logs.py +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -94,9 +94,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs", page=SyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, @@ -189,9 +187,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs", page=AsyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index bdda5fd9..8323efb1 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -67,9 +67,7 @@ def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return self._post( - "/fastedge/v1/binaries/raw" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw", body=read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -89,9 +87,7 @@ def list( ) -> BinaryListResponse: """List binaries""" return self._get( - "/fastedge/v1/binaries" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries", + "/fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,9 +119,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -156,9 +150,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +203,7 @@ async def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return await self._post( - "/fastedge/v1/binaries/raw" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw", body=await async_read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -233,9 +223,7 @@ async def list( ) -> BinaryListResponse: """List binaries""" return await self._get( - "/fastedge/v1/binaries" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries", + "/fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,9 +255,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,9 +286,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/fastedge.py b/src/gcore/resources/fastedge/fastedge.py index e52b5216..9b052788 100644 --- a/src/gcore/resources/fastedge/fastedge.py +++ b/src/gcore/resources/fastedge/fastedge.py @@ -123,7 +123,7 @@ def get_account_overview( ) -> Client: """Get status and limits for the client""" return self._get( - "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", + "/fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +187,7 @@ async def get_account_overview( ) -> Client: """Get status and limits for the client""" return await self._get( - "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", + "/fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py index 17cd738d..cb007bbc 100644 --- a/src/gcore/resources/fastedge/kv_stores.py +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -72,7 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", body=maybe_transform( { "byod": byod, @@ -112,7 +112,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -148,9 +148,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,9 +179,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -220,9 +216,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", body=maybe_transform( { "byod": byod, @@ -286,7 +280,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", body=await async_maybe_transform( { "byod": byod, @@ -326,7 +320,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -362,9 +356,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -395,9 +387,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -434,9 +424,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", body=await async_maybe_transform( { "byod": byod, diff --git a/src/gcore/resources/fastedge/secrets.py b/src/gcore/resources/fastedge/secrets.py index beee5a6a..8b1e97e2 100644 --- a/src/gcore/resources/fastedge/secrets.py +++ b/src/gcore/resources/fastedge/secrets.py @@ -83,9 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", body=maybe_transform( { "name": name, @@ -133,9 +131,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=maybe_transform( { "comment": comment, @@ -179,9 +175,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -226,9 +220,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -263,9 +255,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -305,9 +295,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=maybe_transform( { "name": name, @@ -375,9 +363,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", body=await async_maybe_transform( { "name": name, @@ -425,9 +411,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "comment": comment, @@ -471,9 +455,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -518,9 +500,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -555,9 +535,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -597,9 +575,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/fastedge/statistics.py b/src/gcore/resources/fastedge/statistics.py index 9bc2a7ba..1958aafc 100644 --- a/src/gcore/resources/fastedge/statistics.py +++ b/src/gcore/resources/fastedge/statistics.py @@ -83,9 +83,7 @@ def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/calls" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -143,9 +141,7 @@ def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/app_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -224,9 +220,7 @@ async def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/calls" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -284,9 +278,7 @@ async def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/app_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/fastedge/templates.py b/src/gcore/resources/fastedge/templates.py index 78413275..a39e2757 100644 --- a/src/gcore/resources/fastedge/templates.py +++ b/src/gcore/resources/fastedge/templates.py @@ -93,9 +93,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", body=maybe_transform( { "binary_id": binary_id, @@ -151,9 +149,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", page=SyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -201,9 +197,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -238,9 +232,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -289,9 +281,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", body=maybe_transform( { "binary_id": binary_id, @@ -371,9 +361,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", body=await async_maybe_transform( { "binary_id": binary_id, @@ -429,9 +417,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", page=AsyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -479,9 +465,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -516,9 +500,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -567,9 +549,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", body=await async_maybe_transform( { "binary_id": binary_id, diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index 8e771ad5..ecd59cb6 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -80,9 +80,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", body=maybe_transform( { "client_user": client_user, @@ -149,9 +147,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -200,9 +196,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -234,9 +228,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,9 +293,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", body=await async_maybe_transform( { "client_user": client_user, @@ -370,9 +360,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -421,9 +409,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -455,9 +441,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/iam.py b/src/gcore/resources/iam/iam.py index e6fb22d8..54b4653f 100644 --- a/src/gcore/resources/iam/iam.py +++ b/src/gcore/resources/iam/iam.py @@ -75,7 +75,7 @@ def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return self._get( - "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", + "/iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +123,7 @@ async def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return await self._get( - "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", + "/iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index 5f0cf949..a27021c1 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -101,9 +101,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", body=maybe_transform( { "auth_types": auth_types, @@ -154,7 +152,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", + "/iam/users", page=SyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -200,9 +198,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -233,9 +229,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,9 +275,7 @@ def invite( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/iam/clients/invite_user" - if self._client._base_url_overridden - else "https://api.gcore.com//iam/clients/invite_user", + "/iam/clients/invite_user", body=maybe_transform( { "client_id": client_id, @@ -374,9 +366,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", body=await async_maybe_transform( { "auth_types": auth_types, @@ -427,7 +417,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", + "/iam/users", page=AsyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -473,9 +463,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -506,9 +494,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -554,9 +540,7 @@ async def invite( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/iam/clients/invite_user" - if self._client._base_url_overridden - else "https://api.gcore.com//iam/clients/invite_user", + "/iam/clients/invite_user", body=await async_maybe_transform( { "client_id": client_id, diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index fdbb1d33..43947fab 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -74,9 +74,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -124,9 +122,7 @@ def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", body=maybe_transform( { "announce": announce, @@ -195,9 +191,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -245,9 +239,7 @@ async def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", body=await async_maybe_transform( { "announce": announce, diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py index 98c34908..86d387bb 100644 --- a/src/gcore/resources/security/events.py +++ b/src/gcore/resources/security/events.py @@ -88,9 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs" - if self._client._base_url_overridden - else "https://api.gcore.com//security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs", page=SyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, @@ -176,9 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs" - if self._client._base_url_overridden - else "https://api.gcore.com//security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs", page=AsyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py index 79719fd7..85b84ad8 100644 --- a/src/gcore/resources/security/profile_templates.py +++ b/src/gcore/resources/security/profile_templates.py @@ -55,9 +55,7 @@ def list( profile. Client receives only common and created for him profile templates. """ return self._get( - "/security/iaas/profile-templates" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/profile-templates", + "/security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -101,9 +99,7 @@ async def list( profile. Client receives only common and created for him profile templates. """ return await self._get( - "/security/iaas/profile-templates" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/profile-templates", + "/security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index b3cd1183..16668afa 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -78,9 +78,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", body=maybe_transform( { "fields": fields, @@ -124,9 +122,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -172,9 +168,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -205,9 +199,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,9 +234,7 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}/recreate" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate", body=maybe_transform( { "fields": fields, @@ -290,9 +280,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", body=maybe_transform( { "fields": fields, @@ -358,9 +346,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", body=await async_maybe_transform( { "fields": fields, @@ -404,9 +390,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -452,9 +436,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,9 +467,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -522,9 +502,7 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}/recreate" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate", body=await async_maybe_transform( { "fields": fields, @@ -570,9 +548,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", body=await async_maybe_transform( { "fields": fields, diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index cd7d3047..d8c41393 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -108,9 +108,7 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -150,9 +148,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets", page=SyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, @@ -200,9 +196,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -272,9 +266,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -314,9 +306,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets", page=AsyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, @@ -364,9 +354,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/cors.py b/src/gcore/resources/storage/buckets/cors.py index d00928da..3869e78e 100644 --- a/src/gcore/resources/storage/buckets/cors.py +++ b/src/gcore/resources/storage/buckets/cors.py @@ -74,9 +74,7 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -113,9 +111,7 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -176,9 +172,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=await async_maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -215,9 +209,7 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/lifecycle.py b/src/gcore/resources/storage/buckets/lifecycle.py index 8e7f3d81..a4940ef7 100644 --- a/src/gcore/resources/storage/buckets/lifecycle.py +++ b/src/gcore/resources/storage/buckets/lifecycle.py @@ -78,9 +78,7 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=maybe_transform({"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -117,9 +115,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -185,9 +181,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=await async_maybe_transform( {"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams ), @@ -226,9 +220,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/policy.py b/src/gcore/resources/storage/buckets/policy.py index 7b89c11b..f84d2653 100644 --- a/src/gcore/resources/storage/buckets/policy.py +++ b/src/gcore/resources/storage/buckets/policy.py @@ -71,9 +71,7 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -111,9 +109,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,9 +144,7 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -210,9 +204,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +242,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -287,9 +277,7 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index ef93c1d2..5cc7224a 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -85,9 +85,7 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials", body=maybe_transform( { "delete_sftp_password": delete_sftp_password, @@ -169,9 +167,7 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials", body=await async_maybe_transform( { "delete_sftp_password": delete_sftp_password, diff --git a/src/gcore/resources/storage/locations.py b/src/gcore/resources/storage/locations.py index 9d7c6670..5e2a2d96 100644 --- a/src/gcore/resources/storage/locations.py +++ b/src/gcore/resources/storage/locations.py @@ -69,9 +69,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v2/locations" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v2/locations", + "/storage/provisioning/v2/locations", page=SyncOffsetPage[Location], options=make_request_options( extra_headers=extra_headers, @@ -137,9 +135,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v2/locations" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v2/locations", + "/storage/provisioning/v2/locations", page=AsyncOffsetPage[Location], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/storage/statistics.py b/src/gcore/resources/storage/statistics.py index 334749eb..980c1410 100644 --- a/src/gcore/resources/storage/statistics.py +++ b/src/gcore/resources/storage/statistics.py @@ -82,9 +82,7 @@ def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/total" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total", body=maybe_transform( { "from_": from_, @@ -151,9 +149,7 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/series" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series", body=maybe_transform( { "from_": from_, @@ -233,9 +229,7 @@ async def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/total" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total", body=await async_maybe_transform( { "from_": from_, @@ -302,9 +296,7 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/series" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series", body=await async_maybe_transform( { "from_": from_, diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index 04037ddc..4f0b3a82 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -138,9 +138,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/provisioning/v2/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v2/storage", + "/storage/provisioning/v2/storage", body=maybe_transform( { "location": location, @@ -188,9 +186,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", body=maybe_transform( { "expires": expires, @@ -260,9 +256,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v3/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v3/storage", + "/storage/provisioning/v3/storage", page=SyncOffsetPage[Storage], options=make_request_options( extra_headers=extra_headers, @@ -314,9 +308,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -348,9 +340,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -385,9 +375,7 @@ def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -421,9 +409,7 @@ def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -462,9 +448,7 @@ def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -554,9 +538,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/provisioning/v2/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v2/storage", + "/storage/provisioning/v2/storage", body=await async_maybe_transform( { "location": location, @@ -604,9 +586,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", body=await async_maybe_transform( { "expires": expires, @@ -676,9 +656,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v3/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v3/storage", + "/storage/provisioning/v3/storage", page=AsyncOffsetPage[Storage], options=make_request_options( extra_headers=extra_headers, @@ -730,9 +708,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -764,9 +740,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -801,9 +775,7 @@ async def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -837,9 +809,7 @@ async def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -880,9 +850,7 @@ async def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 02cb29a4..0b63144c 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -319,7 +319,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", body=maybe_transform( { "task_name": task_name, @@ -400,7 +400,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", page=SyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -451,9 +451,7 @@ def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/streaming/ai/tasks/{task_id}/cancel" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -520,9 +518,7 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/streaming/ai/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -594,7 +590,7 @@ def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", + "/streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -904,7 +900,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", body=await async_maybe_transform( { "task_name": task_name, @@ -985,7 +981,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", page=AsyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -1036,9 +1032,7 @@ async def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/streaming/ai/tasks/{task_id}/cancel" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1105,9 +1099,7 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/streaming/ai/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1179,7 +1171,7 @@ async def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", + "/streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index 9461d5b2..d8ef434b 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -76,9 +76,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", body=maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -111,9 +109,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", body=maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -150,9 +146,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", page=SyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -189,9 +183,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -222,9 +214,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -255,9 +245,7 @@ def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -318,9 +306,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -353,9 +339,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -392,9 +376,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", page=AsyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -431,9 +413,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -464,9 +444,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,9 +475,7 @@ async def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 345cfc7a..438d9de8 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -72,9 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/directories" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories", + "/streaming/directories", body=maybe_transform( { "name": name, @@ -119,9 +117,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", body=maybe_transform( { "name": name, @@ -167,9 +163,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -202,9 +196,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -227,9 +219,7 @@ def get_tree( directories in video hosting. """ return self._get( - "/streaming/directories/tree" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories/tree", + "/streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -286,9 +276,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/directories" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories", + "/streaming/directories", body=await async_maybe_transform( { "name": name, @@ -333,9 +321,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", body=await async_maybe_transform( { "name": name, @@ -381,9 +367,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -416,9 +400,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,9 +423,7 @@ async def get_tree( directories in video hosting. """ return await self._get( - "/streaming/directories/tree" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories/tree", + "/streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/players.py b/src/gcore/resources/streaming/players.py index 942e32b9..826e015a 100644 --- a/src/gcore/resources/streaming/players.py +++ b/src/gcore/resources/streaming/players.py @@ -72,7 +72,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", body=maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,9 +109,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", body=maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -146,7 +144,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", page=SyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -183,9 +181,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,9 +212,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +244,7 @@ def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - f"/streaming/players/{player_id}/preview" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -309,7 +301,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", body=await async_maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -346,9 +338,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", body=await async_maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -383,7 +373,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", page=AsyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -420,9 +410,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -453,9 +441,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -487,9 +473,7 @@ async def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - f"/streaming/players/{player_id}/preview" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index c9b9c691..fba76526 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -204,9 +204,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", body=maybe_transform( { "active": active, @@ -337,9 +335,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", body=maybe_transform( { "active": active, @@ -392,9 +388,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", page=SyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -431,9 +425,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -464,9 +456,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,9 +487,7 @@ def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}/videos" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -684,9 +672,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", body=await async_maybe_transform( { "active": active, @@ -817,9 +803,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", body=await async_maybe_transform( { "active": active, @@ -872,9 +856,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", page=AsyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -911,9 +893,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -944,9 +924,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -977,9 +955,7 @@ async def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}/videos" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index a80ce0b3..825c12da 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -91,9 +91,7 @@ def list( is a paid feature. """ return self._get( - "/streaming/quality_sets" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets", + "/streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -139,9 +137,7 @@ def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - "/streaming/quality_sets/default" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets/default", + "/streaming/quality_sets/default", body=maybe_transform( { "live": live, @@ -226,9 +222,7 @@ async def list( is a paid feature. """ return await self._get( - "/streaming/quality_sets" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets", + "/streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -274,9 +268,7 @@ async def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - "/streaming/quality_sets/default" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets/default", + "/streaming/quality_sets/default", body=await async_maybe_transform( { "live": live, diff --git a/src/gcore/resources/streaming/restreams.py b/src/gcore/resources/streaming/restreams.py index 1d703166..78880ed4 100644 --- a/src/gcore/resources/streaming/restreams.py +++ b/src/gcore/resources/streaming/restreams.py @@ -67,9 +67,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", body=maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -102,9 +100,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", body=maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -139,9 +135,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", page=SyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -178,9 +172,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +203,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -266,9 +256,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", body=await async_maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -301,9 +289,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", body=await async_maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -338,9 +324,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", page=AsyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -377,9 +361,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -410,9 +392,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 2b5e440d..4e8cb182 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -123,9 +123,7 @@ def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/ffprobe" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -190,9 +188,7 @@ def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -258,9 +254,7 @@ def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -321,9 +315,7 @@ def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -376,9 +368,7 @@ def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/max_stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/max_stream", + "/streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -431,9 +421,7 @@ def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/popular" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/popular", + "/streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -484,9 +472,7 @@ def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/storage", + "/streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -538,9 +524,7 @@ def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream", + "/streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -613,9 +597,7 @@ def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/uniqs", + "/streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -702,9 +684,7 @@ def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/cdn/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -778,9 +758,7 @@ def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/views" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/views", + "/streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -837,9 +815,7 @@ def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/browsers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/browsers", + "/streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -890,9 +866,7 @@ def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/countries", + "/streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -943,9 +917,7 @@ def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/hosts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/hosts", + "/streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -996,9 +968,7 @@ def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/systems" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/systems", + "/streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1049,9 +1019,7 @@ def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/embeds" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/embeds", + "/streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1102,9 +1070,7 @@ def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/regions", + "/streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1164,9 +1130,7 @@ def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/heatmap" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/heatmap", + "/streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1216,9 +1180,7 @@ def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/storage_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1266,9 +1228,7 @@ def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/transcoding_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1329,9 +1289,7 @@ def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1397,9 +1355,7 @@ def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1460,9 +1416,7 @@ def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1539,9 +1493,7 @@ async def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/ffprobe" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1606,9 +1558,7 @@ async def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1674,9 +1624,7 @@ async def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1737,9 +1685,7 @@ async def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1792,9 +1738,7 @@ async def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/max_stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/max_stream", + "/streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1847,9 +1791,7 @@ async def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/popular" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/popular", + "/streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1900,9 +1842,7 @@ async def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/storage", + "/streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1954,9 +1894,7 @@ async def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream", + "/streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2029,9 +1967,7 @@ async def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/uniqs", + "/streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2118,9 +2054,7 @@ async def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/cdn/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2194,9 +2128,7 @@ async def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/views" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/views", + "/streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2253,9 +2185,7 @@ async def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/browsers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/browsers", + "/streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2306,9 +2236,7 @@ async def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/countries", + "/streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2359,9 +2287,7 @@ async def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/hosts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/hosts", + "/streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2412,9 +2338,7 @@ async def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/systems" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/systems", + "/streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2465,9 +2389,7 @@ async def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/embeds" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/embeds", + "/streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2518,9 +2440,7 @@ async def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/regions", + "/streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2580,9 +2500,7 @@ async def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/heatmap" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/heatmap", + "/streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2632,9 +2550,7 @@ async def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/storage_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2682,9 +2598,7 @@ async def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/transcoding_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2745,9 +2659,7 @@ async def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2813,9 +2725,7 @@ async def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2876,9 +2786,7 @@ async def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index 58dfaf62..f52cfee4 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -123,9 +123,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -177,9 +175,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", body=maybe_transform( { "height": height, @@ -221,9 +217,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -256,9 +250,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -290,9 +282,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -324,9 +314,7 @@ def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -432,9 +420,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -486,9 +472,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", body=await async_maybe_transform( { "height": height, @@ -530,9 +514,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -565,9 +547,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -599,9 +579,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -633,9 +611,7 @@ async def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 06bc5dcc..30c0c23b 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -232,7 +232,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", body=maybe_transform( { "name": name, @@ -285,9 +285,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", body=maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -326,7 +324,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", page=SyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -385,9 +383,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -419,9 +415,7 @@ def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,9 +523,7 @@ def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", body=maybe_transform( { "duration": duration, @@ -571,9 +563,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -622,9 +612,7 @@ def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -692,9 +680,7 @@ def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/start_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -731,9 +717,7 @@ def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/stop_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -931,7 +915,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", body=await async_maybe_transform( { "name": name, @@ -984,9 +968,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", body=await async_maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1025,7 +1007,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", page=AsyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -1084,9 +1066,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1118,9 +1098,7 @@ async def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1228,9 +1206,7 @@ async def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", body=await async_maybe_transform( { "duration": duration, @@ -1270,9 +1246,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1321,9 +1295,7 @@ async def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1391,9 +1363,7 @@ async def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/start_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1430,9 +1400,7 @@ async def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/stop_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 165594a4..4e59615e 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -120,9 +120,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", body=maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -172,9 +170,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", body=maybe_transform( { "language": language, @@ -213,9 +209,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -248,9 +242,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -282,9 +274,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -389,9 +379,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", body=await async_maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -441,9 +429,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", body=await async_maybe_transform( { "language": language, @@ -482,9 +468,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,9 +501,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -551,9 +533,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index 3b1cfbef..c77320db 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -148,7 +148,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", body=maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -371,9 +371,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", body=maybe_transform( { "name": name, @@ -469,7 +467,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", page=SyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -526,9 +524,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -579,9 +575,7 @@ def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos/batch" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/batch", + "/streaming/videos/batch", body=maybe_transform({"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, @@ -631,9 +625,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -693,9 +685,7 @@ def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -729,9 +719,7 @@ def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - "/streaming/videos/names" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/names", + "/streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -848,7 +836,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", body=await async_maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1071,9 +1059,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", body=await async_maybe_transform( { "name": name, @@ -1169,7 +1155,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", page=AsyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -1226,9 +1212,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1279,9 +1263,7 @@ async def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos/batch" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/batch", + "/streaming/videos/batch", body=await async_maybe_transform( {"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams ), @@ -1335,9 +1317,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1397,9 +1377,7 @@ async def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1433,9 +1411,7 @@ async def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - "/streaming/videos/names" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/names", + "/streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py index 96f15cca..30c32c1c 100644 --- a/src/gcore/resources/waap/advanced_rules.py +++ b/src/gcore/resources/waap/advanced_rules.py @@ -51,9 +51,7 @@ def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return self._get( - "/waap/v1/advanced-rules/descriptor" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -93,9 +91,7 @@ async def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return await self._get( - "/waap/v1/advanced-rules/descriptor" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index 9be46769..7ce6dca4 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -88,9 +88,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", body=maybe_transform( { "name": name, @@ -154,9 +152,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", body=maybe_transform( { "block": block, @@ -214,9 +210,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", page=SyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -264,9 +258,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -299,9 +291,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -359,9 +349,7 @@ def preview( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/preview-custom-page" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page", body=maybe_transform( { "error": error, @@ -442,9 +430,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", body=await async_maybe_transform( { "name": name, @@ -508,9 +494,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", body=await async_maybe_transform( { "block": block, @@ -568,9 +552,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", page=AsyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -618,9 +600,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -653,9 +633,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -713,9 +691,7 @@ async def preview( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/preview-custom-page" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page", body=await async_maybe_transform( { "error": error, diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index 6afde6d6..e22a838f 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -97,9 +97,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", body=maybe_transform( { "action": action, @@ -173,9 +171,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -265,9 +261,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", page=SyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -321,9 +315,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -359,9 +351,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -403,9 +393,7 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,9 +473,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", body=await async_maybe_transform( { "action": action, @@ -561,9 +547,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -653,9 +637,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", page=AsyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -709,9 +691,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -747,9 +727,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -791,9 +769,7 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py index ccd8a883..6b1f7896 100644 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -82,9 +82,7 @@ def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -117,9 +115,7 @@ def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -184,9 +180,7 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", page=SyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -237,9 +231,7 @@ def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -289,9 +281,7 @@ def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", body=maybe_transform( { "description_file_location": description_file_location, @@ -344,9 +334,7 @@ def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload", body=maybe_transform( { "file_data": file_data, @@ -412,9 +400,7 @@ async def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -447,9 +433,7 @@ async def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -514,9 +498,7 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", page=AsyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -567,9 +549,7 @@ async def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -619,9 +599,7 @@ async def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", body=await async_maybe_transform( { "description_file_location": description_file_location, @@ -674,9 +652,7 @@ async def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload", body=await async_maybe_transform( { "file_data": file_data, diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py index cf0c40e5..3e66ea27 100644 --- a/src/gcore/resources/waap/domains/api_path_groups.py +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -65,9 +65,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -121,9 +119,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index d372c33b..fc1dd68c 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -90,9 +90,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", body=maybe_transform( { "http_scheme": http_scheme, @@ -155,9 +153,7 @@ def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", body=maybe_transform( { "api_groups": api_groups, @@ -254,9 +250,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", page=SyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -315,9 +309,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -355,9 +347,7 @@ def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -430,9 +420,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", body=await async_maybe_transform( { "http_scheme": http_scheme, @@ -495,9 +483,7 @@ async def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", body=await async_maybe_transform( { "api_groups": api_groups, @@ -594,9 +580,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", page=AsyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -655,9 +639,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -695,9 +677,7 @@ async def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index adc81b2b..f175a192 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -92,9 +92,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", body=maybe_transform( { "action": action, @@ -157,9 +155,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -229,9 +225,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", page=SyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -284,9 +278,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -323,9 +315,7 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -364,9 +354,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -408,9 +396,7 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -480,9 +466,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", body=await async_maybe_transform( { "action": action, @@ -545,9 +529,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -617,9 +599,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", page=AsyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -672,9 +652,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -711,9 +689,7 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -752,9 +728,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -796,9 +770,7 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index 6e0e3bac..cf4135cc 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -198,9 +198,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", body=maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -250,7 +248,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", + "/waap/v1/domains", page=SyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -301,9 +299,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -336,9 +332,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -371,9 +365,7 @@ def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/rule-sets" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -411,9 +403,7 @@ def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -511,9 +501,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", body=await async_maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -563,7 +551,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", + "/waap/v1/domains", page=AsyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -614,9 +602,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -649,9 +635,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -684,9 +668,7 @@ async def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/rule-sets" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -724,9 +706,7 @@ async def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index bf624cf0..b8600359 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -91,9 +91,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", body=maybe_transform( { "action": action, @@ -155,9 +153,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -227,9 +223,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", page=SyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -282,9 +276,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -321,9 +313,7 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -362,9 +352,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -406,9 +394,7 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -477,9 +463,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", body=await async_maybe_transform( { "action": action, @@ -541,9 +525,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -613,9 +595,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", page=AsyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -668,9 +648,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -707,9 +685,7 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -748,9 +724,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -792,9 +766,7 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 98372746..577332e9 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -93,9 +93,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", body=maybe_transform( { "author": author, @@ -155,9 +153,7 @@ def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=maybe_transform( { "author": author, @@ -232,9 +228,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", page=SyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -289,9 +283,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -329,9 +321,7 @@ def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,9 +392,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", body=await async_maybe_transform( { "author": author, @@ -464,9 +452,7 @@ async def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=await async_maybe_transform( { "author": author, @@ -541,9 +527,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", page=AsyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -598,9 +582,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -638,9 +620,7 @@ async def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 7633f059..8fb4ab52 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -106,9 +106,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights", page=SyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -160,9 +158,7 @@ def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,9 +199,7 @@ def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", body=maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -295,9 +289,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights", page=AsyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -349,9 +341,7 @@ async def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,9 +382,7 @@ async def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", body=await async_maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py index 17c719c1..fc9cafbf 100644 --- a/src/gcore/resources/waap/domains/settings.py +++ b/src/gcore/resources/waap/domains/settings.py @@ -74,9 +74,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", body=maybe_transform( { "api": api, @@ -116,9 +114,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -179,9 +175,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", body=await async_maybe_transform( { "api": api, @@ -221,9 +215,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index 517d55f6..f23b048b 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -98,9 +98,7 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks", page=SyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -163,9 +161,7 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info", page=SyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -231,9 +227,7 @@ def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/stats" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -286,9 +280,7 @@ def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,9 +374,7 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests", page=SyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -450,9 +440,7 @@ def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/traffic" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -532,9 +520,7 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks", page=AsyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -597,9 +583,7 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info", page=AsyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -665,9 +649,7 @@ async def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/stats" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -720,9 +702,7 @@ async def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -816,9 +796,7 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests", page=AsyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -884,9 +862,7 @@ async def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/traffic" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index 0634ffef..e056e67a 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -88,9 +88,7 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/security-insights/types", + "/waap/v1/security-insights/types", page=SyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, @@ -176,9 +174,7 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/security-insights/types", + "/waap/v1/security-insights/types", page=AsyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/ip_info/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py index 12c7beb8..7d4d5f1b 100644 --- a/src/gcore/resources/waap/ip_info/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -95,9 +95,7 @@ def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-time-series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -144,9 +142,7 @@ def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/blocked-requests" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -193,9 +189,7 @@ def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ddos" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -235,9 +229,7 @@ def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ip-info" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -282,9 +274,7 @@ def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-urls" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -333,9 +323,7 @@ def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-user-agents" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -384,9 +372,7 @@ def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-sessions" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -429,9 +415,7 @@ def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-map" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -495,9 +479,7 @@ async def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-time-series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -544,9 +526,7 @@ async def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/blocked-requests" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -593,9 +573,7 @@ async def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ddos" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -635,9 +613,7 @@ async def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ip-info" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -682,9 +658,7 @@ async def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-urls" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -733,9 +707,7 @@ async def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-user-agents" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -784,9 +756,7 @@ async def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-sessions" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -829,9 +799,7 @@ async def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-map" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/ip_info/metrics.py b/src/gcore/resources/waap/ip_info/metrics.py index 32f17c80..c70d3faa 100644 --- a/src/gcore/resources/waap/ip_info/metrics.py +++ b/src/gcore/resources/waap/ip_info/metrics.py @@ -77,9 +77,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/counts" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -151,9 +149,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/counts" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py index ffe33962..f36dcb35 100644 --- a/src/gcore/resources/waap/organizations.py +++ b/src/gcore/resources/waap/organizations.py @@ -82,9 +82,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/organizations", + "/waap/v1/organizations", page=SyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, @@ -162,9 +160,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/organizations", + "/waap/v1/organizations", page=AsyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py index 5f64899e..f8258bab 100644 --- a/src/gcore/resources/waap/statistics.py +++ b/src/gcore/resources/waap/statistics.py @@ -87,9 +87,7 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/statistics/series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/statistics/series", + "/waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -171,9 +169,7 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/statistics/series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/statistics/series", + "/waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py index f2ced3d7..df171560 100644 --- a/src/gcore/resources/waap/tags.py +++ b/src/gcore/resources/waap/tags.py @@ -88,7 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", + "/waap/v1/tags", page=SyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", + "/waap/v1/tags", page=AsyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index 4f621d4e..3d68c41f 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -147,7 +147,7 @@ def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return self._get( - "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", + "/waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -219,7 +219,7 @@ async def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return await self._get( - "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", + "/waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), From e8693c48db51184b55c63b3e31300f2c11365984 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 15:36:02 +0000 Subject: [PATCH 296/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 091cfb12..f7014c35 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.10.0" + ".": "0.11.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index fde59029..44653817 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.10.0" +version = "0.11.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 4eb294cb..1ef4a3a8 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.10.0" # x-release-please-version +__version__ = "0.11.0" # x-release-please-version From bb03ca410f6edbe4f97c3a3ccdc18cd95432c535 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 17:30:36 +0000 Subject: [PATCH 297/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 6209bbc0..bf5c162d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69c2f202e608b625930fb755ef34ae2fa30acce4fa987889e10402324aaf689e.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-eca22164d9482d49887776d39a5e74fb55cc36d40d3f524336aa26433514386e.yml openapi_spec_hash: f6aa7b95639f6eb639e408ad321f2861 config_hash: 53f1995f46a0e2f7e747e65bafa3d6e0 From 49a043f29499b24201d5a96432a32cd2b132490a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Sep 2025 14:09:52 +0000 Subject: [PATCH 298/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/storage/storage.py | 49 +++++++---- .../types/storage/storage_update_params.py | 6 +- tests/api_resources/test_storage.py | 88 +++++++++++-------- 4 files changed, 89 insertions(+), 58 deletions(-) diff --git a/.stats.yml b/.stats.yml index bf5c162d..44649ae2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-eca22164d9482d49887776d39a5e74fb55cc36d40d3f524336aa26433514386e.yml -openapi_spec_hash: f6aa7b95639f6eb639e408ad321f2861 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5b7d4df0da50df13bda0d0112b026c0b40e26462f8d7e0013ac3286c27a458bd.yml +openapi_spec_hash: 2ad55753d983df577077b3ce156ac4ca config_hash: 53f1995f46a0e2f7e747e65bafa3d6e0 diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index 4f0b3a82..0a53e7b4 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing_extensions import Literal import httpx @@ -155,6 +156,7 @@ def create( cast_to=Storage, ) + @typing_extensions.deprecated("deprecated") def update( self, storage_id: int, @@ -168,12 +170,15 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Storage: - """ - Updates storage configuration such as expiration date and server alias. + """Updates storage configuration such as expiration date and server alias. + + Note: + Prefer PATCH /provisioning/v2/storage/{`storage_id`} that uses correct HTTP + method for updating the storage. Args: - expires: ISO 8601 timestamp when the storage should expire. Leave empty to remove - expiration. + expires: Duration when the storage should expire in format like "2 years 6 months 2 weeks + 3 days 5 hours 10 minutes 15 seconds". Leave empty to remove expiration. server_alias: Custom domain alias for accessing the storage. Leave empty to remove alias. @@ -555,6 +560,7 @@ async def create( cast_to=Storage, ) + @typing_extensions.deprecated("deprecated") async def update( self, storage_id: int, @@ -568,12 +574,15 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Storage: - """ - Updates storage configuration such as expiration date and server alias. + """Updates storage configuration such as expiration date and server alias. + + Note: + Prefer PATCH /provisioning/v2/storage/{`storage_id`} that uses correct HTTP + method for updating the storage. Args: - expires: ISO 8601 timestamp when the storage should expire. Leave empty to remove - expiration. + expires: Duration when the storage should expire in format like "2 years 6 months 2 weeks + 3 days 5 hours 10 minutes 15 seconds". Leave empty to remove expiration. server_alias: Custom domain alias for accessing the storage. Leave empty to remove alias. @@ -865,8 +874,10 @@ def __init__(self, storage: StorageResource) -> None: self.create = to_raw_response_wrapper( storage.create, ) - self.update = to_raw_response_wrapper( - storage.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + storage.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_raw_response_wrapper( storage.list, @@ -911,8 +922,10 @@ def __init__(self, storage: AsyncStorageResource) -> None: self.create = async_to_raw_response_wrapper( storage.create, ) - self.update = async_to_raw_response_wrapper( - storage.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + storage.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_raw_response_wrapper( storage.list, @@ -957,8 +970,10 @@ def __init__(self, storage: StorageResource) -> None: self.create = to_streamed_response_wrapper( storage.create, ) - self.update = to_streamed_response_wrapper( - storage.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + storage.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_streamed_response_wrapper( storage.list, @@ -1003,8 +1018,10 @@ def __init__(self, storage: AsyncStorageResource) -> None: self.create = async_to_streamed_response_wrapper( storage.create, ) - self.update = async_to_streamed_response_wrapper( - storage.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + storage.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_streamed_response_wrapper( storage.list, diff --git a/src/gcore/types/storage/storage_update_params.py b/src/gcore/types/storage/storage_update_params.py index 5454b294..5e57b95e 100644 --- a/src/gcore/types/storage/storage_update_params.py +++ b/src/gcore/types/storage/storage_update_params.py @@ -9,9 +9,9 @@ class StorageUpdateParams(TypedDict, total=False): expires: str - """ISO 8601 timestamp when the storage should expire. - - Leave empty to remove expiration. + """ + Duration when the storage should expire in format like "2 years 6 months 2 weeks + 3 days 5 hours 10 minutes 15 seconds". Leave empty to remove expiration. """ server_alias: str diff --git a/tests/api_resources/test_storage.py b/tests/api_resources/test_storage.py index 3a087e65..64bcf6af 100644 --- a/tests/api_resources/test_storage.py +++ b/tests/api_resources/test_storage.py @@ -14,6 +14,8 @@ Storage, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -70,25 +72,30 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: - storage = client.storage.update( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.update( + storage_id=0, + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - storage = client.storage.update( - storage_id=0, - expires="2026-12-31 23:59:59+00:00", - server_alias="my-storage.company.com", - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.update( + storage_id=0, + expires="2 years 6 months 2 weeks 3 days 5 hours 10 minutes 15 seconds", + server_alias="my-storage.company.com", + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.storage.with_raw_response.update( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.with_raw_response.update( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -97,14 +104,15 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.storage.with_streaming_response.update( - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.with_streaming_response.update( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = response.parse() - assert_matches_type(Storage, storage, path=["response"]) + storage = response.parse() + assert_matches_type(Storage, storage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -374,25 +382,30 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.update( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.update( + storage_id=0, + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.update( - storage_id=0, - expires="2026-12-31 23:59:59+00:00", - server_alias="my-storage.company.com", - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.update( + storage_id=0, + expires="2 years 6 months 2 weeks 3 days 5 hours 10 minutes 15 seconds", + server_alias="my-storage.company.com", + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.with_raw_response.update( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.with_raw_response.update( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -401,14 +414,15 @@ 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.storage.with_streaming_response.update( - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - storage = await response.parse() - assert_matches_type(Storage, storage, path=["response"]) + with pytest.warns(DeprecationWarning): + async with async_client.storage.with_streaming_response.update( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert_matches_type(Storage, storage, path=["response"]) assert cast(Any, response.is_closed) is True From 467cd9d55b2a5e833ccb3eb7144d731e68edf215 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Sep 2025 14:56:52 +0000 Subject: [PATCH 299/592] refactor(storage): use v2 endpoint --- .stats.yml | 2 +- api.md | 2 +- src/gcore/resources/storage/storage.py | 57 +++++------- .../types/storage/storage_update_params.py | 6 +- tests/api_resources/test_storage.py | 88 ++++++++----------- 5 files changed, 64 insertions(+), 91 deletions(-) diff --git a/.stats.yml b/.stats.yml index 44649ae2..49b653d1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5b7d4df0da50df13bda0d0112b026c0b40e26462f8d7e0013ac3286c27a458bd.yml openapi_spec_hash: 2ad55753d983df577077b3ce156ac4ca -config_hash: 53f1995f46a0e2f7e747e65bafa3d6e0 +config_hash: 73d9d2f32b40b5d9a536fde242531415 diff --git a/api.md b/api.md index 57501eeb..7a3fa350 100644 --- a/api.md +++ b/api.md @@ -1987,7 +1987,7 @@ from gcore.types.storage import Storage Methods: - client.storage.create(\*\*params) -> Storage -- client.storage.update(storage_id, \*\*params) -> Storage +- client.storage.update(storage_id, \*\*params) -> Storage - client.storage.list(\*\*params) -> SyncOffsetPage[Storage] - client.storage.delete(storage_id) -> None - client.storage.get(storage_id) -> Storage diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index 0a53e7b4..9326bb88 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -2,7 +2,6 @@ from __future__ import annotations -import typing_extensions from typing_extensions import Literal import httpx @@ -156,7 +155,6 @@ def create( cast_to=Storage, ) - @typing_extensions.deprecated("deprecated") def update( self, storage_id: int, @@ -172,15 +170,14 @@ def update( ) -> Storage: """Updates storage configuration such as expiration date and server alias. - Note: - Prefer PATCH /provisioning/v2/storage/{`storage_id`} that uses correct HTTP - method for updating the storage. + Used for + SFTP storages. Args: - expires: Duration when the storage should expire in format like "2 years 6 months 2 weeks - 3 days 5 hours 10 minutes 15 seconds". Leave empty to remove expiration. + expires: Duration when the storage should expire in format like "1 years 6 months 2 weeks + 3 days 5 hours 10 minutes 15 seconds". Set empty to remove expiration. - server_alias: Custom domain alias for accessing the storage. Leave empty to remove alias. + server_alias: Custom domain alias for accessing the storage. Set empty to remove alias. extra_headers: Send extra headers @@ -190,8 +187,8 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - return self._post( - f"/storage/provisioning/v1/storage/{storage_id}", + return self._patch( + f"/storage/provisioning/v2/storage/{storage_id}", body=maybe_transform( { "expires": expires, @@ -560,7 +557,6 @@ async def create( cast_to=Storage, ) - @typing_extensions.deprecated("deprecated") async def update( self, storage_id: int, @@ -576,15 +572,14 @@ async def update( ) -> Storage: """Updates storage configuration such as expiration date and server alias. - Note: - Prefer PATCH /provisioning/v2/storage/{`storage_id`} that uses correct HTTP - method for updating the storage. + Used for + SFTP storages. Args: - expires: Duration when the storage should expire in format like "2 years 6 months 2 weeks - 3 days 5 hours 10 minutes 15 seconds". Leave empty to remove expiration. + expires: Duration when the storage should expire in format like "1 years 6 months 2 weeks + 3 days 5 hours 10 minutes 15 seconds". Set empty to remove expiration. - server_alias: Custom domain alias for accessing the storage. Leave empty to remove alias. + server_alias: Custom domain alias for accessing the storage. Set empty to remove alias. extra_headers: Send extra headers @@ -594,8 +589,8 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}", + return await self._patch( + f"/storage/provisioning/v2/storage/{storage_id}", body=await async_maybe_transform( { "expires": expires, @@ -874,10 +869,8 @@ def __init__(self, storage: StorageResource) -> None: self.create = to_raw_response_wrapper( storage.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - storage.update, # pyright: ignore[reportDeprecated], - ) + self.update = to_raw_response_wrapper( + storage.update, ) self.list = to_raw_response_wrapper( storage.list, @@ -922,10 +915,8 @@ def __init__(self, storage: AsyncStorageResource) -> None: self.create = async_to_raw_response_wrapper( storage.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - storage.update, # pyright: ignore[reportDeprecated], - ) + self.update = async_to_raw_response_wrapper( + storage.update, ) self.list = async_to_raw_response_wrapper( storage.list, @@ -970,10 +961,8 @@ def __init__(self, storage: StorageResource) -> None: self.create = to_streamed_response_wrapper( storage.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - storage.update, # pyright: ignore[reportDeprecated], - ) + self.update = to_streamed_response_wrapper( + storage.update, ) self.list = to_streamed_response_wrapper( storage.list, @@ -1018,10 +1007,8 @@ def __init__(self, storage: AsyncStorageResource) -> None: self.create = async_to_streamed_response_wrapper( storage.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - storage.update, # pyright: ignore[reportDeprecated], - ) + self.update = async_to_streamed_response_wrapper( + storage.update, ) self.list = async_to_streamed_response_wrapper( storage.list, diff --git a/src/gcore/types/storage/storage_update_params.py b/src/gcore/types/storage/storage_update_params.py index 5e57b95e..c7127a28 100644 --- a/src/gcore/types/storage/storage_update_params.py +++ b/src/gcore/types/storage/storage_update_params.py @@ -10,9 +10,9 @@ class StorageUpdateParams(TypedDict, total=False): expires: str """ - Duration when the storage should expire in format like "2 years 6 months 2 weeks - 3 days 5 hours 10 minutes 15 seconds". Leave empty to remove expiration. + Duration when the storage should expire in format like "1 years 6 months 2 weeks + 3 days 5 hours 10 minutes 15 seconds". Set empty to remove expiration. """ server_alias: str - """Custom domain alias for accessing the storage. Leave empty to remove alias.""" + """Custom domain alias for accessing the storage. Set empty to remove alias.""" diff --git a/tests/api_resources/test_storage.py b/tests/api_resources/test_storage.py index 64bcf6af..b66d14c9 100644 --- a/tests/api_resources/test_storage.py +++ b/tests/api_resources/test_storage.py @@ -14,8 +14,6 @@ Storage, ) -# pyright: reportDeprecated=false - base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -72,30 +70,25 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - storage = client.storage.update( - storage_id=0, - ) - + storage = client.storage.update( + storage_id=0, + ) assert_matches_type(Storage, storage, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - storage = client.storage.update( - storage_id=0, - expires="2 years 6 months 2 weeks 3 days 5 hours 10 minutes 15 seconds", - server_alias="my-storage.company.com", - ) - + storage = client.storage.update( + storage_id=0, + expires="1 years 6 months", + server_alias="my-storage.company.com", + ) assert_matches_type(Storage, storage, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.storage.with_raw_response.update( - storage_id=0, - ) + response = client.storage.with_raw_response.update( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -104,15 +97,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.storage.with_streaming_response.update( - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.storage.with_streaming_response.update( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = response.parse() - assert_matches_type(Storage, storage, path=["response"]) + storage = response.parse() + assert_matches_type(Storage, storage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -382,30 +374,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): - storage = await async_client.storage.update( - storage_id=0, - ) - + storage = await async_client.storage.update( + storage_id=0, + ) assert_matches_type(Storage, storage, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - storage = await async_client.storage.update( - storage_id=0, - expires="2 years 6 months 2 weeks 3 days 5 hours 10 minutes 15 seconds", - server_alias="my-storage.company.com", - ) - + storage = await async_client.storage.update( + storage_id=0, + expires="1 years 6 months", + server_alias="my-storage.company.com", + ) assert_matches_type(Storage, storage, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.storage.with_raw_response.update( - storage_id=0, - ) + response = await async_client.storage.with_raw_response.update( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -414,15 +401,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.storage.with_streaming_response.update( - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - storage = await response.parse() - assert_matches_type(Storage, storage, path=["response"]) + async with async_client.storage.with_streaming_response.update( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert_matches_type(Storage, storage, path=["response"]) assert cast(Any, response.is_closed) is True From a07306c8c7c6c2c5c10557b03aa21544116c1911 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Sep 2025 16:26:04 +0000 Subject: [PATCH 300/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 49b653d1..c37b0d3c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5b7d4df0da50df13bda0d0112b026c0b40e26462f8d7e0013ac3286c27a458bd.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fa5e3eb5c4c01c6be5a8d036640779fa59a1931c596245748ed28601213caa3b.yml openapi_spec_hash: 2ad55753d983df577077b3ce156ac4ca -config_hash: 73d9d2f32b40b5d9a536fde242531415 +config_hash: ad247337a057a08be4b3fee16d342259 From 7967d52894c886c4a8c09ad4f621ae1360597eb6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Sep 2025 20:18:34 +0000 Subject: [PATCH 301/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index c37b0d3c..2d2c70a6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fa5e3eb5c4c01c6be5a8d036640779fa59a1931c596245748ed28601213caa3b.yml openapi_spec_hash: 2ad55753d983df577077b3ce156ac4ca -config_hash: ad247337a057a08be4b3fee16d342259 +config_hash: b12a0fdb9d698155a6d9f01cccf0567f From ab829a57f14f36248beabb525322eacc85a2589e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 09:00:44 +0000 Subject: [PATCH 302/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 2d2c70a6..bf75ef97 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fa5e3eb5c4c01c6be5a8d036640779fa59a1931c596245748ed28601213caa3b.yml openapi_spec_hash: 2ad55753d983df577077b3ce156ac4ca -config_hash: b12a0fdb9d698155a6d9f01cccf0567f +config_hash: 94a708396796faa210065e6aa3afebc2 From 75c173d5b8dcf0edf0ec7b4fab1011c7502cc5af Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 09:33:49 +0000 Subject: [PATCH 303/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f7014c35..a7130553 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.11.0" + ".": "0.12.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 44653817..8ab3dc78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.11.0" +version = "0.12.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 1ef4a3a8..7f12d5d7 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.11.0" # x-release-please-version +__version__ = "0.12.0" # x-release-please-version From 05b319aec4f2bef20fa8a4192513d51332c27b07 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 10:19:23 +0000 Subject: [PATCH 304/592] fix(waap)!: model references --- .stats.yml | 2 +- api.md | 5 +++-- src/gcore/resources/waap/ip_info/ip_info.py | 10 +++++----- src/gcore/types/waap/__init__.py | 3 ++- .../types/waap/ip_info_get_top_urls_response.py | 15 +++------------ ...fo_get_ip_info_response.py => waap_ip_info.py} | 4 ++-- src/gcore/types/waap/waap_top_url.py | 13 +++++++++++++ tests/api_resources/waap/test_ip_info.py | 14 +++++++------- 8 files changed, 36 insertions(+), 30 deletions(-) rename src/gcore/types/waap/{ip_info_get_ip_info_response.py => waap_ip_info.py} (93%) create mode 100644 src/gcore/types/waap/waap_top_url.py diff --git a/.stats.yml b/.stats.yml index bf75ef97..6b134832 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fa5e3eb5c4c01c6be5a8d036640779fa59a1931c596245748ed28601213caa3b.yml openapi_spec_hash: 2ad55753d983df577077b3ce156ac4ca -config_hash: 94a708396796faa210065e6aa3afebc2 +config_hash: 48160a994660f9410c8552e51274bef9 diff --git a/api.md b/api.md index 7a3fa350..813dbe4c 100644 --- a/api.md +++ b/api.md @@ -1289,13 +1289,14 @@ Types: from gcore.types.waap import ( WaapIPCountryAttack, WaapIPDDOSInfoModel, + WaapIPInfo, WaapRuleBlockedRequests, WaapTimeSeriesAttack, WaapTopSession, + WaapTopURL, WaapTopUserAgent, IPInfoGetAttackTimeSeriesResponse, IPInfoGetBlockedRequestsResponse, - IPInfoGetIPInfoResponse, IPInfoGetTopURLsResponse, IPInfoGetTopUserAgentsResponse, IPInfoGetTopUserSessionsResponse, @@ -1308,7 +1309,7 @@ Methods: - client.waap.ip_info.get_attack_time_series(\*\*params) -> IPInfoGetAttackTimeSeriesResponse - client.waap.ip_info.get_blocked_requests(\*\*params) -> IPInfoGetBlockedRequestsResponse - client.waap.ip_info.get_ddos_attack_series(\*\*params) -> WaapIPDDOSInfoModel -- client.waap.ip_info.get_ip_info(\*\*params) -> IPInfoGetIPInfoResponse +- client.waap.ip_info.get_ip_info(\*\*params) -> WaapIPInfo - client.waap.ip_info.get_top_urls(\*\*params) -> IPInfoGetTopURLsResponse - client.waap.ip_info.get_top_user_agents(\*\*params) -> IPInfoGetTopUserAgentsResponse - client.waap.ip_info.get_top_user_sessions(\*\*params) -> IPInfoGetTopUserSessionsResponse diff --git a/src/gcore/resources/waap/ip_info/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py index 7d4d5f1b..e721bf7d 100644 --- a/src/gcore/resources/waap/ip_info/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -33,8 +33,8 @@ ip_info_list_attacked_countries_params, ) from ...._base_client import make_request_options +from ....types.waap.waap_ip_info import WaapIPInfo from ....types.waap.waap_ip_ddos_info_model import WaapIPDDOSInfoModel -from ....types.waap.ip_info_get_ip_info_response import IPInfoGetIPInfoResponse from ....types.waap.ip_info_get_top_urls_response import IPInfoGetTopURLsResponse from ....types.waap.ip_info_get_top_user_agents_response import IPInfoGetTopUserAgentsResponse from ....types.waap.ip_info_get_blocked_requests_response import IPInfoGetBlockedRequestsResponse @@ -212,7 +212,7 @@ def get_ip_info( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IPInfoGetIPInfoResponse: + ) -> WaapIPInfo: """ Fetch details about a particular IP address, including WHOIS data, risk score, and additional tags. @@ -237,7 +237,7 @@ def get_ip_info( timeout=timeout, query=maybe_transform({"ip": ip}, ip_info_get_ip_info_params.IPInfoGetIPInfoParams), ), - cast_to=IPInfoGetIPInfoResponse, + cast_to=WaapIPInfo, ) def get_top_urls( @@ -596,7 +596,7 @@ async def get_ip_info( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IPInfoGetIPInfoResponse: + ) -> WaapIPInfo: """ Fetch details about a particular IP address, including WHOIS data, risk score, and additional tags. @@ -621,7 +621,7 @@ async def get_ip_info( timeout=timeout, query=await async_maybe_transform({"ip": ip}, ip_info_get_ip_info_params.IPInfoGetIPInfoParams), ), - cast_to=IPInfoGetIPInfoResponse, + cast_to=WaapIPInfo, ) async def get_top_urls( diff --git a/src/gcore/types/waap/__init__.py b/src/gcore/types/waap/__init__.py index 29b9b772..b90f2d8b 100644 --- a/src/gcore/types/waap/__init__.py +++ b/src/gcore/types/waap/__init__.py @@ -3,6 +3,8 @@ from __future__ import annotations from .waap_tag import WaapTag as WaapTag +from .waap_ip_info import WaapIPInfo as WaapIPInfo +from .waap_top_url import WaapTopURL as WaapTopURL from .waap_rule_set import WaapRuleSet as WaapRuleSet from .tag_list_params import TagListParams as TagListParams from .waap_policy_mode import WaapPolicyMode as WaapPolicyMode @@ -30,7 +32,6 @@ from .waap_rule_blocked_requests import WaapRuleBlockedRequests as WaapRuleBlockedRequests from .custom_page_set_list_params import CustomPageSetListParams as CustomPageSetListParams from .ip_info_get_top_urls_params import IPInfoGetTopURLsParams as IPInfoGetTopURLsParams -from .ip_info_get_ip_info_response import IPInfoGetIPInfoResponse as IPInfoGetIPInfoResponse from .custom_page_set_create_params import CustomPageSetCreateParams as CustomPageSetCreateParams from .custom_page_set_update_params import CustomPageSetUpdateParams as CustomPageSetUpdateParams from .ip_info_get_top_urls_response import IPInfoGetTopURLsResponse as IPInfoGetTopURLsResponse diff --git a/src/gcore/types/waap/ip_info_get_top_urls_response.py b/src/gcore/types/waap/ip_info_get_top_urls_response.py index 0db2c8ce..76dc6cdb 100644 --- a/src/gcore/types/waap/ip_info_get_top_urls_response.py +++ b/src/gcore/types/waap/ip_info_get_top_urls_response.py @@ -3,17 +3,8 @@ from typing import List from typing_extensions import TypeAlias -from ..._models import BaseModel +from .waap_top_url import WaapTopURL -__all__ = ["IPInfoGetTopURLsResponse", "IPInfoGetTopURLsResponseItem"] +__all__ = ["IPInfoGetTopURLsResponse"] - -class IPInfoGetTopURLsResponseItem(BaseModel): - count: int - """The number of attacks to the URL""" - - url: str - """The URL that was attacked""" - - -IPInfoGetTopURLsResponse: TypeAlias = List[IPInfoGetTopURLsResponseItem] +IPInfoGetTopURLsResponse: TypeAlias = List[WaapTopURL] diff --git a/src/gcore/types/waap/ip_info_get_ip_info_response.py b/src/gcore/types/waap/waap_ip_info.py similarity index 93% rename from src/gcore/types/waap/ip_info_get_ip_info_response.py rename to src/gcore/types/waap/waap_ip_info.py index 82fc8e8d..741e7e2f 100644 --- a/src/gcore/types/waap/ip_info_get_ip_info_response.py +++ b/src/gcore/types/waap/waap_ip_info.py @@ -5,7 +5,7 @@ from ..._models import BaseModel -__all__ = ["IPInfoGetIPInfoResponse", "Whois"] +__all__ = ["WaapIPInfo", "Whois"] class Whois(BaseModel): @@ -46,7 +46,7 @@ class Whois(BaseModel): """The state""" -class IPInfoGetIPInfoResponse(BaseModel): +class WaapIPInfo(BaseModel): risk_score: Literal["NO_RISK", "LOW", "MEDIUM", "HIGH", "EXTREME", "NOT_ENOUGH_DATA"] """The risk score of the IP address""" diff --git a/src/gcore/types/waap/waap_top_url.py b/src/gcore/types/waap/waap_top_url.py new file mode 100644 index 00000000..88d761f8 --- /dev/null +++ b/src/gcore/types/waap/waap_top_url.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["WaapTopURL"] + + +class WaapTopURL(BaseModel): + count: int + """The number of attacks to the URL""" + + url: str + """The URL that was attacked""" diff --git a/tests/api_resources/waap/test_ip_info.py b/tests/api_resources/waap/test_ip_info.py index 49b4f4f3..e3b42484 100644 --- a/tests/api_resources/waap/test_ip_info.py +++ b/tests/api_resources/waap/test_ip_info.py @@ -10,8 +10,8 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.waap import ( + WaapIPInfo, WaapIPDDOSInfoModel, - IPInfoGetIPInfoResponse, IPInfoGetTopURLsResponse, IPInfoGetTopUserAgentsResponse, IPInfoGetBlockedRequestsResponse, @@ -127,7 +127,7 @@ def test_method_get_ip_info(self, client: Gcore) -> None: ip_info = client.waap.ip_info.get_ip_info( ip="192.168.1.1", ) - assert_matches_type(IPInfoGetIPInfoResponse, ip_info, path=["response"]) + assert_matches_type(WaapIPInfo, ip_info, path=["response"]) @parametrize def test_raw_response_get_ip_info(self, client: Gcore) -> None: @@ -138,7 +138,7 @@ def test_raw_response_get_ip_info(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_info = response.parse() - assert_matches_type(IPInfoGetIPInfoResponse, ip_info, path=["response"]) + assert_matches_type(WaapIPInfo, ip_info, path=["response"]) @parametrize def test_streaming_response_get_ip_info(self, client: Gcore) -> None: @@ -149,7 +149,7 @@ def test_streaming_response_get_ip_info(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_info = response.parse() - assert_matches_type(IPInfoGetIPInfoResponse, ip_info, path=["response"]) + assert_matches_type(WaapIPInfo, ip_info, path=["response"]) assert cast(Any, response.is_closed) is True @@ -393,7 +393,7 @@ async def test_method_get_ip_info(self, async_client: AsyncGcore) -> None: ip_info = await async_client.waap.ip_info.get_ip_info( ip="192.168.1.1", ) - assert_matches_type(IPInfoGetIPInfoResponse, ip_info, path=["response"]) + assert_matches_type(WaapIPInfo, ip_info, path=["response"]) @parametrize async def test_raw_response_get_ip_info(self, async_client: AsyncGcore) -> None: @@ -404,7 +404,7 @@ async def test_raw_response_get_ip_info(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_info = await response.parse() - assert_matches_type(IPInfoGetIPInfoResponse, ip_info, path=["response"]) + assert_matches_type(WaapIPInfo, ip_info, path=["response"]) @parametrize async def test_streaming_response_get_ip_info(self, async_client: AsyncGcore) -> None: @@ -415,7 +415,7 @@ async def test_streaming_response_get_ip_info(self, async_client: AsyncGcore) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" ip_info = await response.parse() - assert_matches_type(IPInfoGetIPInfoResponse, ip_info, path=["response"]) + assert_matches_type(WaapIPInfo, ip_info, path=["response"]) assert cast(Any, response.is_closed) is True From 49bbf323b2ceedd8f2786dead7ab68823cd7398b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 10:20:04 +0000 Subject: [PATCH 305/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 6b134832..f9d63b57 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fa5e3eb5c4c01c6be5a8d036640779fa59a1931c596245748ed28601213caa3b.yml openapi_spec_hash: 2ad55753d983df577077b3ce156ac4ca -config_hash: 48160a994660f9410c8552e51274bef9 +config_hash: 28b1157595821f9f0eb3e9f3ea690703 From 8c529d3b0ea05fa58e33d9d237233c2006496a42 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 14:10:22 +0000 Subject: [PATCH 306/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/cloud/floating_ips.py | 24 +++++ .../api_resources/cloud/test_floating_ips.py | 88 +++++++++---------- 3 files changed, 70 insertions(+), 46 deletions(-) diff --git a/.stats.yml b/.stats.yml index f9d63b57..108f1671 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-fa5e3eb5c4c01c6be5a8d036640779fa59a1931c596245748ed28601213caa3b.yml -openapi_spec_hash: 2ad55753d983df577077b3ce156ac4ca +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b0e93e2128f920111ddf34b3de83232ca518082c681daff1f6277e578a10ad86.yml +openapi_spec_hash: e76f6f0cf1c92f2944aa3daed70bed0f config_hash: 28b1157595821f9f0eb3e9f3ea690703 diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 2815f3cb..d96ef242 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -192,6 +192,12 @@ def delete( Delete floating IP Args: + project_id: Project ID + + region_id: Region ID + + floating_ip_id: Floating IP ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -283,6 +289,12 @@ def get( Get floating IP Args: + project_id: Project ID + + region_id: Region ID + + floating_ip_id: Floating IP ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -511,6 +523,12 @@ async def delete( Delete floating IP Args: + project_id: Project ID + + region_id: Region ID + + floating_ip_id: Floating IP ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -602,6 +620,12 @@ async def get( Get floating IP Args: + project_id: Project ID + + region_id: Region ID + + floating_ip_id: Floating IP ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index a0772131..70598a35 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -116,18 +116,18 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: floating_ip = client.cloud.floating_ips.delete( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.floating_ips.with_raw_response.delete( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -138,9 +138,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.floating_ips.with_streaming_response.delete( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -155,8 +155,8 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): client.cloud.floating_ips.with_raw_response.delete( floating_ip_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize @@ -223,18 +223,18 @@ def test_path_params_assign(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: floating_ip = client.cloud.floating_ips.get( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, ) assert_matches_type(FloatingIP, floating_ip, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.floating_ips.with_raw_response.get( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -245,9 +245,9 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.floating_ips.with_streaming_response.get( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -262,8 +262,8 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): client.cloud.floating_ips.with_raw_response.get( floating_ip_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize @@ -412,18 +412,18 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: floating_ip = await async_client.cloud.floating_ips.delete( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.floating_ips.with_raw_response.delete( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -434,9 +434,9 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.floating_ips.with_streaming_response.delete( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -451,8 +451,8 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): await async_client.cloud.floating_ips.with_raw_response.delete( floating_ip_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize @@ -519,18 +519,18 @@ async def test_path_params_assign(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: floating_ip = await async_client.cloud.floating_ips.get( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, ) assert_matches_type(FloatingIP, floating_ip, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.floating_ips.with_raw_response.get( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -541,9 +541,9 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.cloud.floating_ips.with_streaming_response.get( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -558,8 +558,8 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): await async_client.cloud.floating_ips.with_raw_response.get( floating_ip_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize From 81fbfcc77965061d63c8bb33cc856a893fbdc27e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 14:20:24 +0000 Subject: [PATCH 307/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 108f1671..0821216a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b0e93e2128f920111ddf34b3de83232ca518082c681daff1f6277e578a10ad86.yml -openapi_spec_hash: e76f6f0cf1c92f2944aa3daed70bed0f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-698f6e25022abbe89e2e5e1dd25d882f75001f469dd8a6ff26cbf726eadd9bc2.yml +openapi_spec_hash: 5999cb3b726ce1b7b3d44594bddf8d25 config_hash: 28b1157595821f9f0eb3e9f3ea690703 From 571a85850a8c9f537890b83e0beb24c1495a8179 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Sep 2025 08:11:59 +0000 Subject: [PATCH 308/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cloud/floating_ip.py | 2 +- src/gcore/types/cloud/floating_ip_detailed.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0821216a..1c9e09d4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-698f6e25022abbe89e2e5e1dd25d882f75001f469dd8a6ff26cbf726eadd9bc2.yml -openapi_spec_hash: 5999cb3b726ce1b7b3d44594bddf8d25 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-73daaa52c3abe2ede71458fb16b9c50e20fbb16133b90b3e7b7f516277532da5.yml +openapi_spec_hash: e226b124391b1e9f62b9c1ddae64d5c9 config_hash: 28b1157595821f9f0eb3e9f3ea690703 diff --git a/src/gcore/types/cloud/floating_ip.py b/src/gcore/types/cloud/floating_ip.py index ffcc744a..61d3995d 100644 --- a/src/gcore/types/cloud/floating_ip.py +++ b/src/gcore/types/cloud/floating_ip.py @@ -11,7 +11,7 @@ class FloatingIP(BaseModel): - id: Optional[str] = None + id: str """Floating IP ID""" created_at: datetime diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index 2f4c6a3c..1692fc87 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -153,7 +153,7 @@ class Instance(BaseModel): class FloatingIPDetailed(BaseModel): - id: Optional[str] = None + id: str """Floating IP ID""" created_at: datetime From 28dba4eccce00e56ce3dce3ae6b16de94c775b7a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Sep 2025 13:02:07 +0000 Subject: [PATCH 309/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/_client.py | 10 +- src/gcore/resources/cloud/audit_logs.py | 8 +- .../resources/cloud/baremetal/flavors.py | 8 +- src/gcore/resources/cloud/baremetal/images.py | 8 +- .../resources/cloud/baremetal/servers.py | 24 ++- .../resources/cloud/billing_reservations.py | 16 +- src/gcore/resources/cloud/cost_reports.py | 24 ++- .../cloud/file_shares/access_rules.py | 24 ++- .../cloud/file_shares/file_shares.py | 48 +++-- src/gcore/resources/cloud/floating_ips.py | 48 +++-- .../cloud/gpu_baremetal_clusters/flavors.py | 8 +- .../gpu_baremetal_clusters.py | 64 ++++-- .../cloud/gpu_baremetal_clusters/images.py | 32 ++- .../gpu_baremetal_clusters/interfaces.py | 8 +- .../cloud/gpu_baremetal_clusters/servers.py | 56 ++++-- .../resources/cloud/inference/api_keys.py | 40 +++- .../inference/applications/deployments.py | 40 +++- .../cloud/inference/applications/templates.py | 16 +- .../inference/deployments/deployments.py | 64 ++++-- .../cloud/inference/deployments/logs.py | 8 +- .../resources/cloud/inference/flavors.py | 16 +- .../resources/cloud/inference/inference.py | 8 +- .../cloud/inference/registry_credentials.py | 40 +++- .../resources/cloud/inference/secrets.py | 40 +++- .../resources/cloud/instances/flavors.py | 8 +- src/gcore/resources/cloud/instances/images.py | 48 +++-- .../resources/cloud/instances/instances.py | 112 ++++++++--- .../resources/cloud/instances/interfaces.py | 24 ++- .../resources/cloud/instances/metrics.py | 8 +- src/gcore/resources/cloud/ip_ranges.py | 8 +- .../resources/cloud/k8s/clusters/clusters.py | 72 +++++-- .../resources/cloud/k8s/clusters/nodes.py | 16 +- .../cloud/k8s/clusters/pools/nodes.py | 16 +- .../cloud/k8s/clusters/pools/pools.py | 48 +++-- src/gcore/resources/cloud/k8s/flavors.py | 8 +- src/gcore/resources/cloud/k8s/k8s.py | 8 +- .../resources/cloud/load_balancers/flavors.py | 8 +- .../load_balancers/l7_policies/l7_policies.py | 40 +++- .../cloud/load_balancers/l7_policies/rules.py | 40 +++- .../cloud/load_balancers/listeners.py | 40 +++- .../cloud/load_balancers/load_balancers.py | 56 ++++-- .../resources/cloud/load_balancers/metrics.py | 8 +- .../load_balancers/pools/health_monitors.py | 16 +- .../cloud/load_balancers/pools/members.py | 16 +- .../cloud/load_balancers/pools/pools.py | 40 +++- .../cloud/load_balancers/statuses.py | 16 +- .../resources/cloud/networks/networks.py | 40 +++- src/gcore/resources/cloud/networks/routers.py | 56 ++++-- src/gcore/resources/cloud/networks/subnets.py | 40 +++- src/gcore/resources/cloud/placement_groups.py | 32 ++- src/gcore/resources/cloud/projects.py | 32 ++- src/gcore/resources/cloud/quotas/quotas.py | 24 ++- src/gcore/resources/cloud/quotas/requests.py | 32 ++- src/gcore/resources/cloud/regions.py | 12 +- .../resources/cloud/registries/artifacts.py | 16 +- .../resources/cloud/registries/registries.py | 40 +++- .../cloud/registries/repositories.py | 16 +- src/gcore/resources/cloud/registries/tags.py | 8 +- src/gcore/resources/cloud/registries/users.py | 48 +++-- .../reserved_fixed_ips/reserved_fixed_ips.py | 32 ++- .../resources/cloud/reserved_fixed_ips/vip.py | 40 +++- src/gcore/resources/cloud/secrets.py | 32 ++- .../resources/cloud/security_groups/rules.py | 24 ++- .../cloud/security_groups/security_groups.py | 56 ++++-- src/gcore/resources/cloud/ssh_keys.py | 40 +++- src/gcore/resources/cloud/tasks.py | 28 ++- src/gcore/resources/cloud/usage_reports.py | 8 +- .../resources/cloud/users/role_assignments.py | 32 ++- src/gcore/resources/cloud/volumes.py | 80 ++++++-- src/gcore/resources/dns/dns.py | 12 +- src/gcore/resources/dns/locations.py | 28 ++- src/gcore/resources/dns/metrics.py | 8 +- src/gcore/resources/dns/pickers/pickers.py | 4 +- src/gcore/resources/dns/pickers/presets.py | 8 +- src/gcore/resources/dns/zones/dnssec.py | 16 +- src/gcore/resources/dns/zones/rrsets.py | 48 +++-- src/gcore/resources/dns/zones/zones.py | 80 +++++--- src/gcore/resources/fastedge/apps/apps.py | 40 ++-- src/gcore/resources/fastedge/apps/logs.py | 8 +- src/gcore/resources/fastedge/binaries.py | 32 ++- src/gcore/resources/fastedge/fastedge.py | 4 +- src/gcore/resources/fastedge/kv_stores.py | 32 ++- src/gcore/resources/fastedge/secrets.py | 48 +++-- src/gcore/resources/fastedge/statistics.py | 16 +- src/gcore/resources/fastedge/templates.py | 40 +++- src/gcore/resources/iam/api_tokens.py | 32 ++- src/gcore/resources/iam/iam.py | 4 +- src/gcore/resources/iam/users.py | 36 +++- src/gcore/resources/security/bgp_announces.py | 16 +- src/gcore/resources/security/events.py | 8 +- .../resources/security/profile_templates.py | 8 +- src/gcore/resources/security/profiles.py | 48 +++-- .../resources/storage/buckets/buckets.py | 24 ++- src/gcore/resources/storage/buckets/cors.py | 16 +- .../resources/storage/buckets/lifecycle.py | 16 +- src/gcore/resources/storage/buckets/policy.py | 24 ++- src/gcore/resources/storage/credentials.py | 8 +- src/gcore/resources/storage/locations.py | 8 +- src/gcore/resources/storage/statistics.py | 16 +- src/gcore/resources/storage/storage.py | 64 ++++-- src/gcore/resources/streaming/ai_tasks.py | 28 ++- src/gcore/resources/streaming/broadcasts.py | 48 +++-- src/gcore/resources/streaming/directories.py | 40 +++- src/gcore/resources/streaming/players.py | 40 ++-- src/gcore/resources/streaming/playlists.py | 48 +++-- src/gcore/resources/streaming/quality_sets.py | 16 +- src/gcore/resources/streaming/restreams.py | 40 +++- src/gcore/resources/streaming/statistics.py | 184 +++++++++++++----- .../resources/streaming/streams/overlays.py | 48 +++-- .../resources/streaming/streams/streams.py | 72 +++++-- .../resources/streaming/videos/subtitles.py | 40 +++- .../resources/streaming/videos/videos.py | 56 ++++-- src/gcore/resources/waap/advanced_rules.py | 8 +- src/gcore/resources/waap/custom_page_sets.py | 48 +++-- .../resources/waap/domains/advanced_rules.py | 48 +++-- .../resources/waap/domains/api_discovery.py | 48 +++-- .../resources/waap/domains/api_path_groups.py | 8 +- src/gcore/resources/waap/domains/api_paths.py | 40 +++- .../resources/waap/domains/custom_rules.py | 56 ++++-- src/gcore/resources/waap/domains/domains.py | 44 +++-- .../resources/waap/domains/firewall_rules.py | 56 ++++-- .../waap/domains/insight_silences.py | 40 +++- src/gcore/resources/waap/domains/insights.py | 24 ++- src/gcore/resources/waap/domains/settings.py | 16 +- .../resources/waap/domains/statistics.py | 48 +++-- src/gcore/resources/waap/insights.py | 8 +- src/gcore/resources/waap/ip_info/ip_info.py | 64 ++++-- src/gcore/resources/waap/ip_info/metrics.py | 8 +- src/gcore/resources/waap/organizations.py | 8 +- src/gcore/resources/waap/statistics.py | 8 +- src/gcore/resources/waap/tags.py | 4 +- src/gcore/resources/waap/waap.py | 4 +- 133 files changed, 3036 insertions(+), 1050 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1c9e09d4..623270eb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-73daaa52c3abe2ede71458fb16b9c50e20fbb16133b90b3e7b7f516277532da5.yml -openapi_spec_hash: e226b124391b1e9f62b9c1ddae64d5c9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5d5a213a2cafe76bf32aee1ad65af4e90d3d00b4d6fc90672aaf5e8f66f3f132.yml +openapi_spec_hash: 92b967214f53666d69d5cc9df277376e config_hash: 28b1157595821f9f0eb3e9f3ea690703 diff --git a/src/gcore/_client.py b/src/gcore/_client.py index fb66fd59..94bb9d2b 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -113,6 +113,7 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") + self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -197,7 +198,7 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( + client = self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -210,6 +211,8 @@ def copy( default_query=params, **_extra_kwargs, ) + client._base_url_overridden = self._base_url_overridden or base_url is not None + return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) @@ -340,6 +343,7 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") + self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -424,7 +428,7 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( + client = self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -437,6 +441,8 @@ def copy( default_query=params, **_extra_kwargs, ) + client._base_url_overridden = self._base_url_overridden or base_url is not None + return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index 1dad329f..1f4ae40e 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -206,7 +206,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions", + "/cloud/v1/user_actions" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/user_actions", page=SyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, @@ -415,7 +417,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions", + "/cloud/v1/user_actions" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/user_actions", page=AsyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 1645b30b..91474de4 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -93,7 +93,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -187,7 +189,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index a6a22954..ecc0adc3 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -90,7 +90,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -178,7 +180,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 57060e27..86bbf8ce 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -156,7 +156,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -294,7 +296,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", page=SyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -377,7 +381,9 @@ def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=maybe_transform( { "image_id": image_id, @@ -521,7 +527,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -659,7 +667,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", page=AsyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -742,7 +752,9 @@ async def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=await async_maybe_transform( { "image_id": image_id, diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index 0d9df747..ae49d667 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -120,7 +120,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations", + "/cloud/v1/reservations" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservations", page=SyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,7 +280,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations", + "/cloud/v1/reservations" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservations", page=AsyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -330,7 +336,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 36075dd6..910b8fa7 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -146,7 +146,9 @@ def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/totals", body=maybe_transform( { "time_from": time_from, @@ -255,7 +257,9 @@ def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", body=maybe_transform( { "regions": regions, @@ -381,7 +385,9 @@ def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/resources", body=maybe_transform( { "time_from": time_from, @@ -522,7 +528,9 @@ async def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/totals", body=await async_maybe_transform( { "time_from": time_from, @@ -631,7 +639,9 @@ async def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", body=await async_maybe_transform( { "regions": regions, @@ -757,7 +767,9 @@ async def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/resources", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index 34cc65ee..c7c23710 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -88,7 +88,9 @@ def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=maybe_transform( { "access_mode": access_mode, @@ -140,7 +142,9 @@ def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,7 +195,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -263,7 +269,9 @@ async def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=await async_maybe_transform( { "access_mode": access_mode, @@ -315,7 +323,9 @@ async def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -366,7 +376,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 99a806d5..b35b9ea8 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -206,7 +206,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -289,7 +291,9 @@ def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=maybe_transform( { "name": name, @@ -349,7 +353,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", page=SyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -407,7 +413,9 @@ def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -452,7 +460,9 @@ def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -500,7 +510,9 @@ def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -675,7 +687,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -758,7 +772,9 @@ async def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=await async_maybe_transform( { "name": name, @@ -818,7 +834,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", page=AsyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -876,7 +894,9 @@ async def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -921,7 +941,9 @@ async def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -969,7 +991,9 @@ async def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=await async_maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index d96ef242..aa221e8e 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -94,7 +94,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", body=maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -155,7 +157,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", page=SyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -213,7 +217,9 @@ def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -258,7 +264,9 @@ def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=maybe_transform( { "port_id": port_id, @@ -310,7 +318,9 @@ def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -349,7 +359,9 @@ def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,7 +437,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", body=await async_maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -486,7 +500,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", page=AsyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -544,7 +560,9 @@ async def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -589,7 +607,9 @@ async def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=await async_maybe_transform( { "port_id": port_id, @@ -641,7 +661,9 @@ async def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -680,7 +702,9 @@ async def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index 2c4563b5..6d594b3b 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -80,7 +80,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -157,7 +159,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 526babdf..7fb94685 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -156,7 +156,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=maybe_transform( { "flavor": flavor, @@ -220,7 +222,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=SyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -291,7 +295,9 @@ def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -348,7 +354,9 @@ def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,7 +395,9 @@ def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -426,7 +436,9 @@ def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -478,7 +490,9 @@ def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=maybe_transform( { "nodes": nodes, @@ -530,7 +544,9 @@ def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, @@ -633,7 +649,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=await async_maybe_transform( { "flavor": flavor, @@ -697,7 +715,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=AsyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -768,7 +788,9 @@ async def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -825,7 +847,9 @@ async def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -864,7 +888,9 @@ async def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -903,7 +929,9 @@ async def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -955,7 +983,9 @@ async def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=await async_maybe_transform( { "nodes": nodes, @@ -1007,7 +1037,9 @@ async def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=await async_maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 8c2d4623..249c8d3f 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -79,7 +79,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -124,7 +126,9 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -169,7 +173,9 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +250,9 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=maybe_transform( { "name": name, @@ -320,7 +328,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -365,7 +375,9 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -410,7 +422,9 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,7 +499,9 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index 863ffde8..ad75df3e 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -71,7 +71,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -131,7 +133,9 @@ async def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index adda6989..5dbf5590 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -143,7 +143,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=SyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -209,7 +211,9 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -450,7 +454,9 @@ def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -509,7 +515,9 @@ def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -555,7 +563,9 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -594,7 +604,9 @@ def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -633,7 +645,9 @@ def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -750,7 +764,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=AsyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -816,7 +832,9 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1059,7 +1077,9 @@ async def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -1118,7 +1138,9 @@ async def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, @@ -1164,7 +1186,9 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1203,7 +1227,9 @@ async def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1242,7 +1268,9 @@ async def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py index 98238c19..f9f5ccb9 100644 --- a/src/gcore/resources/cloud/inference/api_keys.py +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -84,7 +84,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", body=maybe_transform( { "name": name, @@ -135,7 +137,9 @@ def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -178,7 +182,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", page=SyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -233,7 +239,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,7 +281,9 @@ def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -340,7 +350,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", body=await async_maybe_transform( { "name": name, @@ -391,7 +403,9 @@ async def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=await async_maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -434,7 +448,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", page=AsyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -489,7 +505,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,7 +547,9 @@ async def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index 845bffce..43b6893f 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -93,7 +93,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", body=maybe_transform( { "application_name": application_name, @@ -140,7 +142,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,7 +186,9 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,7 +232,9 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -280,7 +288,9 @@ def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -362,7 +372,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", body=await async_maybe_transform( { "application_name": application_name, @@ -409,7 +421,9 @@ async def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -451,7 +465,9 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -495,7 +511,9 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -549,7 +567,9 @@ async def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, diff --git a/src/gcore/resources/cloud/inference/applications/templates.py b/src/gcore/resources/cloud/inference/applications/templates.py index 1c475cb8..664203be 100644 --- a/src/gcore/resources/cloud/inference/applications/templates.py +++ b/src/gcore/resources/cloud/inference/applications/templates.py @@ -58,7 +58,9 @@ def list( required to create a fully functional application deployment. """ return self._get( - "/cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -97,7 +99,9 @@ def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -143,7 +147,9 @@ async def list( required to create a fully functional application deployment. """ return await self._get( - "/cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,7 +188,9 @@ async def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return await self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 3a4e4629..0cccc581 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -147,7 +147,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", body=maybe_transform( { "containers": containers, @@ -263,7 +265,9 @@ def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -325,7 +329,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", page=SyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -376,7 +382,9 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -416,7 +424,9 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -457,7 +467,9 @@ def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -505,7 +517,9 @@ def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -553,7 +567,9 @@ def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -673,7 +689,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", body=await async_maybe_transform( { "containers": containers, @@ -789,7 +807,9 @@ async def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, @@ -851,7 +871,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", page=AsyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -902,7 +924,9 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -942,7 +966,9 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -983,7 +1009,9 @@ async def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1031,7 +1059,9 @@ async def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1079,7 +1109,9 @@ async def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index 1cc65006..2ee0666e 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -91,7 +91,9 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=SyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, @@ -178,7 +180,9 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=AsyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index d273b19b..8dcc3e62 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -73,7 +73,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/flavors", page=SyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -119,7 +121,9 @@ def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return self._get( - f"/cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -178,7 +182,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/flavors", page=AsyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -224,7 +230,9 @@ async def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return await self._get( - f"/cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index 103c70f1..b116b08f 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -123,7 +123,9 @@ def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return self._get( - "/cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +189,9 @@ async def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return await self._get( - "/cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 6dd78f70..9d5a4072 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -86,7 +86,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", body=maybe_transform( { "name": name, @@ -137,7 +139,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", page=SyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -189,7 +193,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -229,7 +235,9 @@ def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -278,7 +286,9 @@ def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=maybe_transform( { "password": password, @@ -354,7 +364,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", body=await async_maybe_transform( { "name": name, @@ -405,7 +417,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", page=AsyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -457,7 +471,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,7 +513,9 @@ async def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -546,7 +564,9 @@ async def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=await async_maybe_transform( { "password": password, diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index 275ec3f2..ed312faa 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -79,7 +79,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", body=maybe_transform( { "data": data, @@ -130,7 +132,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", page=SyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -182,7 +186,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -222,7 +228,9 @@ def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -268,7 +276,9 @@ def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", body=maybe_transform( { "data": data, @@ -340,7 +350,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", body=await async_maybe_transform( { "data": data, @@ -391,7 +403,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", page=AsyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -443,7 +457,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -483,7 +499,9 @@ async def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,7 +547,9 @@ async def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", body=await async_maybe_transform( { "data": data, diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 9bd7f38f..3bf61d85 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -85,7 +85,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -169,7 +171,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index af8e82a7..b45fd614 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -110,7 +110,9 @@ def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", body=maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -176,7 +178,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -230,7 +234,9 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -302,7 +308,9 @@ def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -359,7 +367,9 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -442,7 +452,9 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -544,7 +556,9 @@ async def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", body=await async_maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -610,7 +624,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -664,7 +680,9 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -736,7 +754,9 @@ async def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -793,7 +813,9 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -876,7 +898,9 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 77fbc20b..dde03b4b 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -228,7 +228,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -295,7 +297,9 @@ def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -444,7 +448,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", page=SyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -538,7 +544,9 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -647,7 +655,9 @@ def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=maybe_transform( { "action": action, @@ -698,7 +708,9 @@ def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -751,7 +763,9 @@ def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=maybe_transform( { "name": name, @@ -797,7 +811,9 @@ def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -836,7 +852,9 @@ def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -890,7 +908,9 @@ def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -932,7 +952,9 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -979,7 +1001,9 @@ def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1021,7 +1045,9 @@ def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1071,7 +1097,9 @@ def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=maybe_transform( { "name": name, @@ -1242,7 +1270,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -1309,7 +1339,9 @@ async def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1458,7 +1490,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", page=AsyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -1552,7 +1586,9 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1661,7 +1697,9 @@ async def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=await async_maybe_transform( { "action": action, @@ -1712,7 +1750,9 @@ async def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=await async_maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -1765,7 +1805,9 @@ async def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=await async_maybe_transform( { "name": name, @@ -1811,7 +1853,9 @@ async def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1850,7 +1894,9 @@ async def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1904,7 +1950,9 @@ async def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1946,7 +1994,9 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1993,7 +2043,9 @@ async def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2035,7 +2087,9 @@ async def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=await async_maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -2085,7 +2139,9 @@ async def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 61fe4266..8fc5e453 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -77,7 +77,9 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -313,7 +315,9 @@ def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -372,7 +376,9 @@ def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -439,7 +445,9 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -675,7 +683,9 @@ async def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -734,7 +744,9 @@ async def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index fa058434..03ffbcd1 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -87,7 +87,9 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -166,7 +168,9 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index 12024d04..b0d0c62e 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -67,7 +67,9 @@ def list( returned. """ return self._get( - "/cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +125,9 @@ async def list( returned. """ return await self._get( - "/cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index a778a3b9..198ead21 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -210,7 +210,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", body=maybe_transform( { "keypair": keypair, @@ -339,7 +341,9 @@ def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=maybe_transform( { "authentication": authentication, @@ -385,7 +389,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -427,7 +433,9 @@ def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -470,7 +478,9 @@ def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -509,7 +519,9 @@ def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -548,7 +560,9 @@ def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -587,7 +601,9 @@ def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -629,7 +645,9 @@ def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -799,7 +817,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", body=await async_maybe_transform( { "keypair": keypair, @@ -928,7 +948,9 @@ async def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=await async_maybe_transform( { "authentication": authentication, @@ -974,7 +996,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1016,7 +1040,9 @@ async def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1059,7 +1085,9 @@ async def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1098,7 +1126,9 @@ async def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1137,7 +1167,9 @@ async def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1176,7 +1208,9 @@ async def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1218,7 +1252,9 @@ async def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=await async_maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/clusters/nodes.py b/src/gcore/resources/cloud/k8s/clusters/nodes.py index b3bd95d8..d04a0586 100644 --- a/src/gcore/resources/cloud/k8s/clusters/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/nodes.py @@ -76,7 +76,9 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -124,7 +126,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +191,9 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -235,7 +241,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py index 903c428e..8ff64793 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py @@ -79,7 +79,9 @@ def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -130,7 +132,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -196,7 +200,9 @@ async def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -247,7 +253,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 0cb81d5a..b60e3039 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -130,7 +130,9 @@ def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=maybe_transform( { "flavor_id": flavor_id, @@ -208,7 +210,9 @@ def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -258,7 +262,9 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,7 +306,9 @@ def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -342,7 +350,9 @@ def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,7 +397,9 @@ def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -492,7 +504,9 @@ async def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=await async_maybe_transform( { "flavor_id": flavor_id, @@ -570,7 +584,9 @@ async def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=await async_maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -620,7 +636,9 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -662,7 +680,9 @@ async def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -704,7 +724,9 @@ async def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -749,7 +771,9 @@ async def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=await async_maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/flavors.py b/src/gcore/resources/cloud/k8s/flavors.py index 71781231..cd456f26 100644 --- a/src/gcore/resources/cloud/k8s/flavors.py +++ b/src/gcore/resources/cloud/k8s/flavors.py @@ -79,7 +79,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -155,7 +157,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index ad74c5fd..c193fccd 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -92,7 +92,9 @@ def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -157,7 +159,9 @@ async def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index 48ba2c61..d104d723 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -76,7 +76,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -143,7 +145,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index c78be82d..cd0db02e 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py @@ -118,7 +118,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", body=maybe_transform( { "action": action, @@ -168,7 +170,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -207,7 +211,9 @@ def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -246,7 +252,9 @@ def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -314,7 +322,9 @@ def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=maybe_transform( { "action": action, @@ -420,7 +430,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", body=await async_maybe_transform( { "action": action, @@ -470,7 +482,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -509,7 +523,9 @@ async def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -548,7 +564,9 @@ async def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -616,7 +634,9 @@ async def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=await async_maybe_transform( { "action": action, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py index 34063a17..b83bb590 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -106,7 +106,9 @@ def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=maybe_transform( { "compare_type": compare_type, @@ -156,7 +158,9 @@ def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -198,7 +202,9 @@ def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -240,7 +246,9 @@ def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -312,7 +320,9 @@ def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=maybe_transform( { "compare_type": compare_type, @@ -412,7 +422,9 @@ async def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=await async_maybe_transform( { "compare_type": compare_type, @@ -462,7 +474,9 @@ async def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -504,7 +518,9 @@ async def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -546,7 +562,9 @@ async def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -618,7 +636,9 @@ async def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=await async_maybe_transform( { "compare_type": compare_type, diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index bf760cfb..abbb5e77 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -127,7 +127,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", body=maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -219,7 +221,9 @@ def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -279,7 +283,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -334,7 +340,9 @@ def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,7 +390,9 @@ def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -489,7 +499,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", body=await async_maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -581,7 +593,9 @@ async def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=await async_maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -641,7 +655,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -696,7 +712,9 @@ async def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -744,7 +762,9 @@ async def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index f50f4ce5..9a8070b5 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -207,7 +207,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -297,7 +299,9 @@ def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=maybe_transform( { "logging": logging, @@ -375,7 +379,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", page=SyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -433,7 +439,9 @@ def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -475,7 +483,9 @@ def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -521,7 +531,9 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -573,7 +585,9 @@ def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -704,7 +718,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -794,7 +810,9 @@ async def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=await async_maybe_transform( { "logging": logging, @@ -872,7 +890,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", page=AsyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -930,7 +950,9 @@ async def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -972,7 +994,9 @@ async def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=await async_maybe_transform( {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams ), @@ -1020,7 +1044,9 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1072,7 +1098,9 @@ async def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index 59df8038..dd0dedd2 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -81,7 +81,9 @@ def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -154,7 +156,9 @@ async def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index bae1858c..417ae8b0 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -115,7 +115,9 @@ def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=maybe_transform( { "delay": delay, @@ -177,7 +179,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -274,7 +278,9 @@ async def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=await async_maybe_transform( { "delay": delay, @@ -336,7 +342,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 05091a8b..37faaa3a 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -131,7 +131,9 @@ def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=maybe_transform( { "address": address, @@ -195,7 +197,9 @@ def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -311,7 +315,9 @@ async def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=await async_maybe_transform( { "address": address, @@ -375,7 +381,9 @@ async def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index c0df516c..01abaebd 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -147,7 +147,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", body=maybe_transform( { "lb_algorithm": lb_algorithm, @@ -262,7 +264,9 @@ def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=maybe_transform( { "ca_secret_id": ca_secret_id, @@ -328,7 +332,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -384,7 +390,9 @@ def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -429,7 +437,9 @@ def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -540,7 +550,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", body=await async_maybe_transform( { "lb_algorithm": lb_algorithm, @@ -655,7 +667,9 @@ async def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=await async_maybe_transform( { "ca_secret_id": ca_secret_id, @@ -721,7 +735,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -777,7 +793,9 @@ async def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -822,7 +840,9 @@ async def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 5579e857..e99f90c9 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -69,7 +69,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -108,7 +110,9 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -165,7 +169,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -204,7 +210,9 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 2fda130e..235648f0 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -120,7 +120,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -201,7 +203,9 @@ def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=maybe_transform( { "name": name, @@ -268,7 +272,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", page=SyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -328,7 +334,9 @@ def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -373,7 +381,9 @@ def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -458,7 +468,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -539,7 +551,9 @@ async def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=await async_maybe_transform( { "name": name, @@ -606,7 +620,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", page=AsyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -666,7 +682,9 @@ async def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -711,7 +729,9 @@ async def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 657982bd..93596051 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -92,7 +92,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -149,7 +151,9 @@ def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=maybe_transform( { "external_gateway_info": external_gateway_info, @@ -199,7 +203,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", page=SyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -249,7 +255,9 @@ def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,7 +309,9 @@ def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=maybe_transform( { "subnet_id": subnet_id, @@ -350,7 +360,9 @@ def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=maybe_transform({"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -390,7 +402,9 @@ def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -459,7 +473,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -516,7 +532,9 @@ async def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=await async_maybe_transform( { "external_gateway_info": external_gateway_info, @@ -566,7 +584,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", page=AsyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -616,7 +636,9 @@ async def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -668,7 +690,9 @@ async def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=await async_maybe_transform( { "subnet_id": subnet_id, @@ -717,7 +741,9 @@ async def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=await async_maybe_transform( {"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams ), @@ -759,7 +785,9 @@ async def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index b781c2e3..aef9bb2a 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -125,7 +125,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", body=maybe_transform( { "cidr": cidr, @@ -225,7 +227,9 @@ def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=maybe_transform( { "dns_nameservers": dns_nameservers, @@ -311,7 +315,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", page=SyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -372,7 +378,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -417,7 +425,9 @@ def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -521,7 +531,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", body=await async_maybe_transform( { "cidr": cidr, @@ -621,7 +633,9 @@ async def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=await async_maybe_transform( { "dns_nameservers": dns_nameservers, @@ -707,7 +721,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", page=AsyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -768,7 +784,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -813,7 +831,9 @@ async def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 31777c13..4c3a5142 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -80,7 +80,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -123,7 +125,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -162,7 +166,9 @@ def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -201,7 +207,9 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -264,7 +272,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -307,7 +317,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -346,7 +358,9 @@ async def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -385,7 +399,9 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 383f3c3b..0603b072 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -83,7 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", body=maybe_transform( { "name": name, @@ -142,7 +142,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", page=SyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -193,7 +193,9 @@ def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._delete( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,7 +228,9 @@ def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,7 +271,9 @@ def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._put( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", body=maybe_transform( { "name": name, @@ -339,7 +345,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", body=await async_maybe_transform( { "name": name, @@ -398,7 +404,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", page=AsyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -449,7 +455,9 @@ async def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._delete( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -482,7 +490,9 @@ async def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,7 +533,9 @@ async def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._put( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 9a9f9c82..17a7d75a 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -65,7 +65,9 @@ def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return self._get( - "/cloud/v2/client_quotas", + "/cloud/v2/client_quotas" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -103,7 +105,9 @@ def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -136,7 +140,9 @@ def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -180,7 +186,9 @@ async def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return await self._get( - "/cloud/v2/client_quotas", + "/cloud/v2/client_quotas" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -218,7 +226,9 @@ async def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -251,7 +261,9 @@ async def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 79d4febe..4c49c8b0 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -79,7 +79,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", body=maybe_transform( { "description": description, @@ -127,7 +129,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", page=SyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -173,7 +177,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -206,7 +212,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,7 +275,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", body=await async_maybe_transform( { "description": description, @@ -315,7 +325,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", page=AsyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -361,7 +373,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +408,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index b49adfcd..df9da044 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -86,7 +86,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions", + "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", page=SyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -139,7 +139,9 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -213,7 +215,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions", + "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", page=AsyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -266,7 +268,9 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index 0b579ba5..77496af1 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -72,7 +72,9 @@ def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -116,7 +118,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -177,7 +181,9 @@ async def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -221,7 +227,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 8889d473..b8623cf3 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -126,7 +126,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -169,7 +171,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -207,7 +211,9 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +250,9 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -284,7 +292,9 @@ def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=maybe_transform({"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -365,7 +375,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -408,7 +420,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -446,7 +460,9 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -483,7 +499,9 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,7 +541,9 @@ async def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=await async_maybe_transform( {"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams ), diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index 74377052..452755d2 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -69,7 +69,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -110,7 +112,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -168,7 +172,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -209,7 +215,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index ab35828c..7bed1478 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -78,7 +78,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -146,7 +148,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index f535c7dd..8c402baf 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -89,7 +89,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=maybe_transform( { "duration": duration, @@ -142,7 +144,9 @@ def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=maybe_transform( { "duration": duration, @@ -186,7 +190,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -225,7 +231,9 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -265,7 +273,9 @@ def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -304,7 +314,9 @@ def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -375,7 +387,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=await async_maybe_transform( { "duration": duration, @@ -428,7 +442,9 @@ async def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=await async_maybe_transform( { "duration": duration, @@ -472,7 +488,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -511,7 +529,9 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -551,7 +571,9 @@ async def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=await async_maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -590,7 +612,9 @@ async def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index d5b0e030..1cd099f6 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -274,7 +274,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=maybe_transform( { "type": type, @@ -352,7 +354,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=SyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -409,7 +413,9 @@ def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -448,7 +454,9 @@ def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -695,7 +703,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=await async_maybe_transform( { "type": type, @@ -773,7 +783,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=AsyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -830,7 +842,9 @@ async def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -869,7 +883,9 @@ async def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 1d6c76e2..22757eba 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -79,7 +79,9 @@ def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -118,7 +120,9 @@ def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -160,7 +164,9 @@ def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -205,7 +211,9 @@ def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -248,7 +256,9 @@ def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), @@ -311,7 +321,9 @@ async def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,7 +362,9 @@ async def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +406,9 @@ async def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -437,7 +453,9 @@ async def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=await async_maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -480,7 +498,9 @@ async def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 5cbefb25..dabef59a 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -86,7 +86,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", page=SyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -142,7 +144,9 @@ def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +191,9 @@ def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -236,7 +242,9 @@ def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -312,7 +320,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", page=AsyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -368,7 +378,9 @@ async def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -413,7 +425,9 @@ async def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -462,7 +476,9 @@ async def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index 89b27a23..c69d2608 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -126,7 +126,9 @@ def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=maybe_transform( { "description": description, @@ -179,7 +181,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,7 +277,9 @@ def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=maybe_transform( { "direction": direction, @@ -397,7 +403,9 @@ async def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=await async_maybe_transform( { "description": description, @@ -450,7 +458,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -544,7 +554,9 @@ async def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=await async_maybe_transform( { "direction": direction, diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index ac4d9bc3..0e24383b 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -97,7 +97,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", body=maybe_transform( { "security_group": security_group, @@ -170,7 +172,9 @@ def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=maybe_transform( { "changed_rules": changed_rules, @@ -226,7 +230,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", page=SyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -279,7 +285,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -321,7 +329,9 @@ def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -361,7 +371,9 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -400,7 +412,9 @@ def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,7 +481,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", body=await async_maybe_transform( { "security_group": security_group, @@ -540,7 +556,9 @@ async def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=await async_maybe_transform( { "changed_rules": changed_rules, @@ -596,7 +614,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", page=AsyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -649,7 +669,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -691,7 +713,9 @@ async def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=await async_maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -731,7 +755,9 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -770,7 +796,9 @@ async def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 788d415c..30ef2830 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -90,7 +90,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", body=maybe_transform( { "name": name, @@ -141,7 +143,9 @@ def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=maybe_transform({"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -186,7 +190,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", page=SyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -239,7 +245,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -279,7 +287,9 @@ def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -352,7 +362,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", body=await async_maybe_transform( { "name": name, @@ -403,7 +415,9 @@ async def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=await async_maybe_transform( {"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams ), @@ -450,7 +464,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", page=AsyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -503,7 +519,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -543,7 +561,9 @@ async def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 63bc78f7..c0866b41 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -156,7 +156,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks", + "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", page=SyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -213,7 +213,9 @@ def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -258,7 +260,9 @@ def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -293,7 +297,9 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -431,7 +437,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks", + "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", page=AsyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -488,7 +494,9 @@ async def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -533,7 +541,9 @@ async def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -568,7 +578,9 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index 0adc0809..48387eda 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -139,7 +139,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/usage_report", + "/cloud/v1/usage_report" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/usage_report", body=maybe_transform( { "time_from": time_from, @@ -277,7 +279,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/usage_report", + "/cloud/v1/usage_report" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/usage_report", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 5294d3a7..0318b8fc 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -85,7 +85,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", body=maybe_transform( { "role": role, @@ -139,7 +141,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", body=maybe_transform( { "role": role, @@ -191,7 +195,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", page=SyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -237,7 +243,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ return self._delete( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,7 +308,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", body=await async_maybe_transform( { "role": role, @@ -354,7 +364,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", body=await async_maybe_transform( { "role": role, @@ -406,7 +418,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", page=AsyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -452,7 +466,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ return await self._delete( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index ed0babaa..74756335 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -292,7 +292,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", body=maybe_transform( { "image_id": image_id, @@ -376,7 +378,9 @@ def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=maybe_transform( { "name": name, @@ -458,7 +462,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", page=SyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -527,7 +533,9 @@ def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -584,7 +592,9 @@ def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=maybe_transform( { "instance_id": instance_id, @@ -641,7 +651,9 @@ def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=maybe_transform({"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -690,7 +702,9 @@ def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -738,7 +752,9 @@ def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -788,7 +804,9 @@ def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -837,7 +855,9 @@ def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1101,7 +1121,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", body=await async_maybe_transform( { "image_id": image_id, @@ -1185,7 +1207,9 @@ async def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=await async_maybe_transform( { "name": name, @@ -1267,7 +1291,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", page=AsyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -1336,7 +1362,9 @@ async def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1393,7 +1421,9 @@ async def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=await async_maybe_transform( { "instance_id": instance_id, @@ -1450,7 +1480,9 @@ async def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=await async_maybe_transform( {"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams ), @@ -1501,7 +1533,9 @@ async def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=await async_maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -1549,7 +1583,9 @@ async def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1599,7 +1635,9 @@ async def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=await async_maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1648,7 +1686,9 @@ async def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py index 3e6485d0..612cd629 100644 --- a/src/gcore/resources/dns/dns.py +++ b/src/gcore/resources/dns/dns.py @@ -104,7 +104,9 @@ def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return self._get( - "/dns/v2/platform/info", + "/dns/v2/platform/info" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -141,7 +143,7 @@ def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/lookup", + "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -207,7 +209,9 @@ async def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return await self._get( - "/dns/v2/platform/info", + "/dns/v2/platform/info" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +248,7 @@ async def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/lookup", + "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/locations.py b/src/gcore/resources/dns/locations.py index 20dcea5a..c58907a8 100644 --- a/src/gcore/resources/dns/locations.py +++ b/src/gcore/resources/dns/locations.py @@ -54,7 +54,7 @@ def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return self._get( - "/dns/v2/locations", + "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -73,7 +73,9 @@ def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return self._get( - "/dns/v2/locations/continents", + "/dns/v2/locations/continents" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -92,7 +94,9 @@ def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return self._get( - "/dns/v2/locations/countries", + "/dns/v2/locations/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -111,7 +115,9 @@ def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return self._get( - "/dns/v2/locations/regions", + "/dns/v2/locations/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -151,7 +157,7 @@ async def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return await self._get( - "/dns/v2/locations", + "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -170,7 +176,9 @@ async def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return await self._get( - "/dns/v2/locations/continents", + "/dns/v2/locations/continents" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -189,7 +197,9 @@ async def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return await self._get( - "/dns/v2/locations/countries", + "/dns/v2/locations/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -208,7 +218,9 @@ async def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return await self._get( - "/dns/v2/locations/regions", + "/dns/v2/locations/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index 8eef7aeb..b9bf45a5 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -82,7 +82,9 @@ def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return self._get( - "/dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -160,7 +162,9 @@ async def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return await self._get( - "/dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/pickers/pickers.py b/src/gcore/resources/dns/pickers/pickers.py index 3078c7f2..599a2450 100644 --- a/src/gcore/resources/dns/pickers/pickers.py +++ b/src/gcore/resources/dns/pickers/pickers.py @@ -63,7 +63,7 @@ def list( ) -> PickerListResponse: """Returns list of picker""" return self._get( - "/dns/v2/pickers", + "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -107,7 +107,7 @@ async def list( ) -> PickerListResponse: """Returns list of picker""" return await self._get( - "/dns/v2/pickers", + "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/pickers/presets.py b/src/gcore/resources/dns/pickers/presets.py index aebd10ff..09f7d53b 100644 --- a/src/gcore/resources/dns/pickers/presets.py +++ b/src/gcore/resources/dns/pickers/presets.py @@ -51,7 +51,9 @@ def list( ) -> PresetListResponse: """Returns list of picker preset""" return self._get( - "/dns/v2/pickers/presets", + "/dns/v2/pickers/presets" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -91,7 +93,9 @@ async def list( ) -> PresetListResponse: """Returns list of picker preset""" return await self._get( - "/dns/v2/pickers/presets", + "/dns/v2/pickers/presets" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/dnssec.py b/src/gcore/resources/dns/zones/dnssec.py index 8c747071..8f283155 100644 --- a/src/gcore/resources/dns/zones/dnssec.py +++ b/src/gcore/resources/dns/zones/dnssec.py @@ -69,7 +69,9 @@ def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", body=maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -103,7 +105,9 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -158,7 +162,9 @@ async def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", body=await async_maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -192,7 +198,9 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index e1d136b1..93697456 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -205,7 +205,9 @@ def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -259,7 +261,9 @@ def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -310,7 +314,9 @@ def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -349,7 +355,9 @@ def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +402,9 @@ def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -453,7 +463,9 @@ def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -644,7 +656,9 @@ async def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, @@ -698,7 +712,9 @@ async def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -749,7 +765,9 @@ async def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -788,7 +806,9 @@ async def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -833,7 +853,9 @@ async def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -892,7 +914,9 @@ async def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 75e11dde..31b815a3 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -143,7 +143,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", body=maybe_transform( { "name": name, @@ -225,7 +225,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -283,7 +283,9 @@ def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._delete( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -318,7 +320,9 @@ def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._post( - f"/dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -351,7 +355,9 @@ def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -384,7 +390,9 @@ def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -417,7 +425,9 @@ def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -450,7 +460,9 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,7 +529,9 @@ def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -583,7 +597,9 @@ def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._post( - f"/dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", body=maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -656,7 +672,9 @@ def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return self._put( - f"/dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{path_name}", body=maybe_transform( { "body_name": body_name, @@ -769,7 +787,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", body=await async_maybe_transform( { "name": name, @@ -851,7 +869,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -909,7 +927,9 @@ async def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._delete( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -944,7 +964,9 @@ async def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._post( - f"/dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -977,7 +999,9 @@ async def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1010,7 +1034,9 @@ async def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1043,7 +1069,9 @@ async def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1076,7 +1104,9 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1143,7 +1173,9 @@ async def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1209,7 +1241,9 @@ async def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", body=await async_maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1282,7 +1316,9 @@ async def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return await self._put( - f"/dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{path_name}", body=await async_maybe_transform( { "body_name": body_name, diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index 92d2662a..a72cd50f 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -121,7 +121,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", body=maybe_transform( { "binary": binary, @@ -208,7 +208,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=maybe_transform( { "binary": binary, @@ -305,7 +307,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", page=SyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -355,7 +357,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -386,7 +390,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -418,7 +424,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -514,7 +522,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", body=await async_maybe_transform( { "binary": binary, @@ -601,7 +609,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=await async_maybe_transform( { "binary": binary, @@ -698,7 +708,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", page=AsyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -748,7 +758,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -779,7 +791,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -811,7 +825,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=await async_maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py index f43d121c..b61bcfd9 100644 --- a/src/gcore/resources/fastedge/apps/logs.py +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -94,7 +94,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", page=SyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, @@ -187,7 +189,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", page=AsyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index 8323efb1..bdda5fd9 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -67,7 +67,9 @@ def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return self._post( - "/fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries/raw", body=read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -87,7 +89,9 @@ def list( ) -> BinaryListResponse: """List binaries""" return self._get( - "/fastedge/v1/binaries", + "/fastedge/v1/binaries" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +123,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -150,7 +156,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,7 +211,9 @@ async def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return await self._post( - "/fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries/raw", body=await async_read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -223,7 +233,9 @@ async def list( ) -> BinaryListResponse: """List binaries""" return await self._get( - "/fastedge/v1/binaries", + "/fastedge/v1/binaries" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -255,7 +267,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -286,7 +300,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/fastedge.py b/src/gcore/resources/fastedge/fastedge.py index 9b052788..e52b5216 100644 --- a/src/gcore/resources/fastedge/fastedge.py +++ b/src/gcore/resources/fastedge/fastedge.py @@ -123,7 +123,7 @@ def get_account_overview( ) -> Client: """Get status and limits for the client""" return self._get( - "/fastedge/v1/me", + "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +187,7 @@ async def get_account_overview( ) -> Client: """Get status and limits for the client""" return await self._get( - "/fastedge/v1/me", + "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py index cb007bbc..17cd738d 100644 --- a/src/gcore/resources/fastedge/kv_stores.py +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -72,7 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", body=maybe_transform( { "byod": byod, @@ -112,7 +112,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -148,7 +148,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -179,7 +181,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,7 +220,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", body=maybe_transform( { "byod": byod, @@ -280,7 +286,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", body=await async_maybe_transform( { "byod": byod, @@ -320,7 +326,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -356,7 +362,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,7 +395,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,7 +434,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", body=await async_maybe_transform( { "byod": byod, diff --git a/src/gcore/resources/fastedge/secrets.py b/src/gcore/resources/fastedge/secrets.py index 8b1e97e2..beee5a6a 100644 --- a/src/gcore/resources/fastedge/secrets.py +++ b/src/gcore/resources/fastedge/secrets.py @@ -83,7 +83,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", body=maybe_transform( { "name": name, @@ -131,7 +133,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=maybe_transform( { "comment": comment, @@ -175,7 +179,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -220,7 +226,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -255,7 +263,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -295,7 +305,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=maybe_transform( { "name": name, @@ -363,7 +375,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", body=await async_maybe_transform( { "name": name, @@ -411,7 +425,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "comment": comment, @@ -455,7 +471,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -500,7 +518,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -535,7 +555,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -575,7 +597,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/fastedge/statistics.py b/src/gcore/resources/fastedge/statistics.py index 1958aafc..9bc2a7ba 100644 --- a/src/gcore/resources/fastedge/statistics.py +++ b/src/gcore/resources/fastedge/statistics.py @@ -83,7 +83,9 @@ def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -141,7 +143,9 @@ def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -220,7 +224,9 @@ async def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -278,7 +284,9 @@ async def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/fastedge/templates.py b/src/gcore/resources/fastedge/templates.py index a39e2757..78413275 100644 --- a/src/gcore/resources/fastedge/templates.py +++ b/src/gcore/resources/fastedge/templates.py @@ -93,7 +93,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", body=maybe_transform( { "binary_id": binary_id, @@ -149,7 +151,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", page=SyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -197,7 +201,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -232,7 +238,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,7 +289,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", body=maybe_transform( { "binary_id": binary_id, @@ -361,7 +371,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", body=await async_maybe_transform( { "binary_id": binary_id, @@ -417,7 +429,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", page=AsyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -465,7 +479,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -500,7 +516,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -549,7 +567,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", body=await async_maybe_transform( { "binary_id": binary_id, diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index ecd59cb6..8e771ad5 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -80,7 +80,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", body=maybe_transform( { "client_user": client_user, @@ -147,7 +149,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -196,7 +200,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,7 +234,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -293,7 +301,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", body=await async_maybe_transform( { "client_user": client_user, @@ -360,7 +370,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -409,7 +421,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +455,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/iam.py b/src/gcore/resources/iam/iam.py index 54b4653f..e6fb22d8 100644 --- a/src/gcore/resources/iam/iam.py +++ b/src/gcore/resources/iam/iam.py @@ -75,7 +75,7 @@ def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return self._get( - "/iam/clients/me", + "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +123,7 @@ async def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return await self._get( - "/iam/clients/me", + "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index a27021c1..5f0cf949 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -101,7 +101,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", body=maybe_transform( { "auth_types": auth_types, @@ -152,7 +154,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users", + "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", page=SyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -198,7 +200,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -229,7 +233,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -275,7 +281,9 @@ def invite( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/iam/clients/invite_user", + "/iam/clients/invite_user" + if self._client._base_url_overridden + else "https://api.gcore.com//iam/clients/invite_user", body=maybe_transform( { "client_id": client_id, @@ -366,7 +374,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", body=await async_maybe_transform( { "auth_types": auth_types, @@ -417,7 +427,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users", + "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", page=AsyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -463,7 +473,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -494,7 +506,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -540,7 +554,9 @@ async def invite( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/iam/clients/invite_user", + "/iam/clients/invite_user" + if self._client._base_url_overridden + else "https://api.gcore.com//iam/clients/invite_user", body=await async_maybe_transform( { "client_id": client_id, diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index 43947fab..fdbb1d33 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -74,7 +74,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -122,7 +124,9 @@ def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", body=maybe_transform( { "announce": announce, @@ -191,7 +195,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -239,7 +245,9 @@ async def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", body=await async_maybe_transform( { "announce": announce, diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py index 86d387bb..98c34908 100644 --- a/src/gcore/resources/security/events.py +++ b/src/gcore/resources/security/events.py @@ -88,7 +88,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs" + if self._client._base_url_overridden + else "https://api.gcore.com//security/notifier/v1/event_logs", page=SyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs" + if self._client._base_url_overridden + else "https://api.gcore.com//security/notifier/v1/event_logs", page=AsyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py index 85b84ad8..79719fd7 100644 --- a/src/gcore/resources/security/profile_templates.py +++ b/src/gcore/resources/security/profile_templates.py @@ -55,7 +55,9 @@ def list( profile. Client receives only common and created for him profile templates. """ return self._get( - "/security/iaas/profile-templates", + "/security/iaas/profile-templates" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -99,7 +101,9 @@ async def list( profile. Client receives only common and created for him profile templates. """ return await self._get( - "/security/iaas/profile-templates", + "/security/iaas/profile-templates" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index 16668afa..b3cd1183 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -78,7 +78,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", body=maybe_transform( { "fields": fields, @@ -122,7 +124,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -168,7 +172,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +205,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -234,7 +242,9 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", body=maybe_transform( { "fields": fields, @@ -280,7 +290,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", body=maybe_transform( { "fields": fields, @@ -346,7 +358,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", body=await async_maybe_transform( { "fields": fields, @@ -390,7 +404,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -436,7 +452,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,7 +485,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -502,7 +522,9 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", body=await async_maybe_transform( { "fields": fields, @@ -548,7 +570,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", body=await async_maybe_transform( { "fields": fields, diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index d8c41393..cd7d3047 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -108,7 +108,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,7 +150,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets", + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", page=SyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, @@ -196,7 +200,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -266,7 +272,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -306,7 +314,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets", + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", page=AsyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, @@ -354,7 +364,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/cors.py b/src/gcore/resources/storage/buckets/cors.py index 3869e78e..d00928da 100644 --- a/src/gcore/resources/storage/buckets/cors.py +++ b/src/gcore/resources/storage/buckets/cors.py @@ -74,7 +74,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -111,7 +113,9 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -172,7 +176,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=await async_maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -209,7 +215,9 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/lifecycle.py b/src/gcore/resources/storage/buckets/lifecycle.py index a4940ef7..8e7f3d81 100644 --- a/src/gcore/resources/storage/buckets/lifecycle.py +++ b/src/gcore/resources/storage/buckets/lifecycle.py @@ -78,7 +78,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=maybe_transform({"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -115,7 +117,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,7 +185,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=await async_maybe_transform( {"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams ), @@ -220,7 +226,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/policy.py b/src/gcore/resources/storage/buckets/policy.py index f84d2653..7b89c11b 100644 --- a/src/gcore/resources/storage/buckets/policy.py +++ b/src/gcore/resources/storage/buckets/policy.py @@ -71,7 +71,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -109,7 +111,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -144,7 +148,9 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -204,7 +210,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,7 +250,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -277,7 +287,9 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index 5cc7224a..ef93c1d2 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -85,7 +85,9 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", body=maybe_transform( { "delete_sftp_password": delete_sftp_password, @@ -167,7 +169,9 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", body=await async_maybe_transform( { "delete_sftp_password": delete_sftp_password, diff --git a/src/gcore/resources/storage/locations.py b/src/gcore/resources/storage/locations.py index 5e2a2d96..9d7c6670 100644 --- a/src/gcore/resources/storage/locations.py +++ b/src/gcore/resources/storage/locations.py @@ -69,7 +69,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v2/locations", + "/storage/provisioning/v2/locations" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/locations", page=SyncOffsetPage[Location], options=make_request_options( extra_headers=extra_headers, @@ -135,7 +137,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v2/locations", + "/storage/provisioning/v2/locations" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/locations", page=AsyncOffsetPage[Location], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/storage/statistics.py b/src/gcore/resources/storage/statistics.py index 980c1410..334749eb 100644 --- a/src/gcore/resources/storage/statistics.py +++ b/src/gcore/resources/storage/statistics.py @@ -82,7 +82,9 @@ def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/total", body=maybe_transform( { "from_": from_, @@ -149,7 +151,9 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/series", body=maybe_transform( { "from_": from_, @@ -229,7 +233,9 @@ async def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/total", body=await async_maybe_transform( { "from_": from_, @@ -296,7 +302,9 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/series", body=await async_maybe_transform( { "from_": from_, diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index 9326bb88..e56f0531 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -138,7 +138,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/provisioning/v2/storage", + "/storage/provisioning/v2/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/storage", body=maybe_transform( { "location": location, @@ -188,7 +190,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/storage/provisioning/v2/storage/{storage_id}", + f"/storage/provisioning/v2/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}", body=maybe_transform( { "expires": expires, @@ -258,7 +262,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v3/storage", + "/storage/provisioning/v3/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v3/storage", page=SyncOffsetPage[Storage], options=make_request_options( extra_headers=extra_headers, @@ -310,7 +316,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -342,7 +350,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -377,7 +387,9 @@ def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -411,7 +423,9 @@ def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -450,7 +464,9 @@ def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -540,7 +556,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/provisioning/v2/storage", + "/storage/provisioning/v2/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/storage", body=await async_maybe_transform( { "location": location, @@ -590,7 +608,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/storage/provisioning/v2/storage/{storage_id}", + f"/storage/provisioning/v2/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}", body=await async_maybe_transform( { "expires": expires, @@ -660,7 +680,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v3/storage", + "/storage/provisioning/v3/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v3/storage", page=AsyncOffsetPage[Storage], options=make_request_options( extra_headers=extra_headers, @@ -712,7 +734,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -744,7 +768,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -779,7 +805,9 @@ async def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -813,7 +841,9 @@ async def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -854,7 +884,9 @@ async def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 0b63144c..02cb29a4 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -319,7 +319,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", body=maybe_transform( { "task_name": task_name, @@ -400,7 +400,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", page=SyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -451,7 +451,9 @@ def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -518,7 +520,9 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -590,7 +594,7 @@ def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/ai/info", + "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -900,7 +904,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", body=await async_maybe_transform( { "task_name": task_name, @@ -981,7 +985,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", page=AsyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -1032,7 +1036,9 @@ async def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1099,7 +1105,9 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1171,7 +1179,7 @@ async def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/ai/info", + "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index d8ef434b..9461d5b2 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -76,7 +76,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", body=maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,7 +111,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", body=maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -146,7 +150,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", page=SyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -183,7 +189,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -214,7 +222,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -245,7 +255,9 @@ def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -306,7 +318,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -339,7 +353,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -376,7 +392,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", page=AsyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -413,7 +431,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -444,7 +464,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -475,7 +497,9 @@ async def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 438d9de8..345cfc7a 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -72,7 +72,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/directories", + "/streaming/directories" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories", body=maybe_transform( { "name": name, @@ -117,7 +119,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", body=maybe_transform( { "name": name, @@ -163,7 +167,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -196,7 +202,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -219,7 +227,9 @@ def get_tree( directories in video hosting. """ return self._get( - "/streaming/directories/tree", + "/streaming/directories/tree" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,7 +286,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/directories", + "/streaming/directories" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories", body=await async_maybe_transform( { "name": name, @@ -321,7 +333,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", body=await async_maybe_transform( { "name": name, @@ -367,7 +381,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -400,7 +416,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -423,7 +441,9 @@ async def get_tree( directories in video hosting. """ return await self._get( - "/streaming/directories/tree", + "/streaming/directories/tree" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/players.py b/src/gcore/resources/streaming/players.py index 826e015a..942e32b9 100644 --- a/src/gcore/resources/streaming/players.py +++ b/src/gcore/resources/streaming/players.py @@ -72,7 +72,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", body=maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,7 +109,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", body=maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -144,7 +146,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", page=SyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -181,7 +183,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -212,7 +216,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +250,9 @@ def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - f"/streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,7 +309,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", body=await async_maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -338,7 +346,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", body=await async_maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -373,7 +383,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", page=AsyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -410,7 +420,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +453,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,7 +487,9 @@ async def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - f"/streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index fba76526..c9b9c691 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -204,7 +204,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", body=maybe_transform( { "active": active, @@ -335,7 +337,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", body=maybe_transform( { "active": active, @@ -388,7 +392,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", page=SyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -425,7 +431,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -456,7 +464,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -487,7 +497,9 @@ def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -672,7 +684,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", body=await async_maybe_transform( { "active": active, @@ -803,7 +817,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", body=await async_maybe_transform( { "active": active, @@ -856,7 +872,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", page=AsyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -893,7 +911,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -924,7 +944,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -955,7 +977,9 @@ async def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index 825c12da..a80ce0b3 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -91,7 +91,9 @@ def list( is a paid feature. """ return self._get( - "/streaming/quality_sets", + "/streaming/quality_sets" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -137,7 +139,9 @@ def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - "/streaming/quality_sets/default", + "/streaming/quality_sets/default" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets/default", body=maybe_transform( { "live": live, @@ -222,7 +226,9 @@ async def list( is a paid feature. """ return await self._get( - "/streaming/quality_sets", + "/streaming/quality_sets" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -268,7 +274,9 @@ async def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - "/streaming/quality_sets/default", + "/streaming/quality_sets/default" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets/default", body=await async_maybe_transform( { "live": live, diff --git a/src/gcore/resources/streaming/restreams.py b/src/gcore/resources/streaming/restreams.py index 78880ed4..1d703166 100644 --- a/src/gcore/resources/streaming/restreams.py +++ b/src/gcore/resources/streaming/restreams.py @@ -67,7 +67,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", body=maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -100,7 +102,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", body=maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -135,7 +139,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", page=SyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -172,7 +178,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,7 +211,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -256,7 +266,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", body=await async_maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -289,7 +301,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", body=await async_maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -324,7 +338,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", page=AsyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -361,7 +377,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +410,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 4e8cb182..2b5e440d 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -123,7 +123,9 @@ def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -188,7 +190,9 @@ def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -254,7 +258,9 @@ def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -315,7 +321,9 @@ def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -368,7 +376,9 @@ def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/max_stream", + "/streaming/statistics/max_stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -421,7 +431,9 @@ def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/popular", + "/streaming/statistics/popular" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -472,7 +484,9 @@ def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/storage", + "/streaming/statistics/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -524,7 +538,9 @@ def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream", + "/streaming/statistics/stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -597,7 +613,9 @@ def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/uniqs", + "/streaming/statistics/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -684,7 +702,9 @@ def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -758,7 +778,9 @@ def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/views", + "/streaming/statistics/views" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -815,7 +837,9 @@ def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/browsers", + "/streaming/statistics/browsers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -866,7 +890,9 @@ def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/countries", + "/streaming/statistics/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -917,7 +943,9 @@ def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/hosts", + "/streaming/statistics/hosts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -968,7 +996,9 @@ def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/systems", + "/streaming/statistics/systems" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1019,7 +1049,9 @@ def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/embeds", + "/streaming/statistics/embeds" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1070,7 +1102,9 @@ def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/regions", + "/streaming/statistics/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1130,7 +1164,9 @@ def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/heatmap", + "/streaming/statistics/heatmap" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1180,7 +1216,9 @@ def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1228,7 +1266,9 @@ def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1289,7 +1329,9 @@ def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1355,7 +1397,9 @@ def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1416,7 +1460,9 @@ def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1493,7 +1539,9 @@ async def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1558,7 +1606,9 @@ async def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1624,7 +1674,9 @@ async def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1685,7 +1737,9 @@ async def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1738,7 +1792,9 @@ async def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/max_stream", + "/streaming/statistics/max_stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1791,7 +1847,9 @@ async def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/popular", + "/streaming/statistics/popular" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1842,7 +1900,9 @@ async def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/storage", + "/streaming/statistics/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1894,7 +1954,9 @@ async def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream", + "/streaming/statistics/stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1967,7 +2029,9 @@ async def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/uniqs", + "/streaming/statistics/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2054,7 +2118,9 @@ async def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2128,7 +2194,9 @@ async def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/views", + "/streaming/statistics/views" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2185,7 +2253,9 @@ async def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/browsers", + "/streaming/statistics/browsers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2236,7 +2306,9 @@ async def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/countries", + "/streaming/statistics/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2287,7 +2359,9 @@ async def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/hosts", + "/streaming/statistics/hosts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2338,7 +2412,9 @@ async def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/systems", + "/streaming/statistics/systems" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2389,7 +2465,9 @@ async def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/embeds", + "/streaming/statistics/embeds" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2440,7 +2518,9 @@ async def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/regions", + "/streaming/statistics/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2500,7 +2580,9 @@ async def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/heatmap", + "/streaming/statistics/heatmap" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2550,7 +2632,9 @@ async def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2598,7 +2682,9 @@ async def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2659,7 +2745,9 @@ async def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2725,7 +2813,9 @@ async def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2786,7 +2876,9 @@ async def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index f52cfee4..58dfaf62 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -123,7 +123,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -175,7 +177,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", body=maybe_transform( { "height": height, @@ -217,7 +221,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,7 +256,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -282,7 +290,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -314,7 +324,9 @@ def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -420,7 +432,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -472,7 +486,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", body=await async_maybe_transform( { "height": height, @@ -514,7 +530,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,7 +565,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -579,7 +599,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -611,7 +633,9 @@ async def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 30c0c23b..06bc5dcc 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -232,7 +232,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", body=maybe_transform( { "name": name, @@ -285,7 +285,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", body=maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -324,7 +326,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", page=SyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -383,7 +385,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -415,7 +419,9 @@ def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,7 +529,9 @@ def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", body=maybe_transform( { "duration": duration, @@ -563,7 +571,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -612,7 +622,9 @@ def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -680,7 +692,9 @@ def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -717,7 +731,9 @@ def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -915,7 +931,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", body=await async_maybe_transform( { "name": name, @@ -968,7 +984,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", body=await async_maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1007,7 +1025,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", page=AsyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -1066,7 +1084,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1098,7 +1118,9 @@ async def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1206,7 +1228,9 @@ async def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", body=await async_maybe_transform( { "duration": duration, @@ -1246,7 +1270,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1295,7 +1321,9 @@ async def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1363,7 +1391,9 @@ async def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1400,7 +1430,9 @@ async def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 4e59615e..165594a4 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -120,7 +120,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", body=maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -170,7 +172,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", body=maybe_transform( { "language": language, @@ -209,7 +213,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,7 +248,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -274,7 +282,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -379,7 +389,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", body=await async_maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -429,7 +441,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", body=await async_maybe_transform( { "language": language, @@ -468,7 +482,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -501,7 +517,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -533,7 +551,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index c77320db..3b1cfbef 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -148,7 +148,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", body=maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -371,7 +371,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", body=maybe_transform( { "name": name, @@ -467,7 +469,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", page=SyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -524,7 +526,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -575,7 +579,9 @@ def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos/batch", + "/streaming/videos/batch" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/batch", body=maybe_transform({"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, @@ -625,7 +631,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -685,7 +693,9 @@ def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -719,7 +729,9 @@ def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - "/streaming/videos/names", + "/streaming/videos/names" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -836,7 +848,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", body=await async_maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1059,7 +1071,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", body=await async_maybe_transform( { "name": name, @@ -1155,7 +1169,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", page=AsyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -1212,7 +1226,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1263,7 +1279,9 @@ async def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos/batch", + "/streaming/videos/batch" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/batch", body=await async_maybe_transform( {"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams ), @@ -1317,7 +1335,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1377,7 +1397,9 @@ async def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1411,7 +1433,9 @@ async def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - "/streaming/videos/names", + "/streaming/videos/names" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py index 30c32c1c..96f15cca 100644 --- a/src/gcore/resources/waap/advanced_rules.py +++ b/src/gcore/resources/waap/advanced_rules.py @@ -51,7 +51,9 @@ def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return self._get( - "/waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -91,7 +93,9 @@ async def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return await self._get( - "/waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index 7ce6dca4..9be46769 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -88,7 +88,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", body=maybe_transform( { "name": name, @@ -152,7 +154,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", body=maybe_transform( { "block": block, @@ -210,7 +214,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", page=SyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -258,7 +264,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -291,7 +299,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -349,7 +359,9 @@ def preview( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/preview-custom-page", body=maybe_transform( { "error": error, @@ -430,7 +442,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", body=await async_maybe_transform( { "name": name, @@ -494,7 +508,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", body=await async_maybe_transform( { "block": block, @@ -552,7 +568,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", page=AsyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -600,7 +618,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -633,7 +653,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -691,7 +713,9 @@ async def preview( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/preview-custom-page", body=await async_maybe_transform( { "error": error, diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index e22a838f..6afde6d6 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -97,7 +97,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", body=maybe_transform( { "action": action, @@ -171,7 +173,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -261,7 +265,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", page=SyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -315,7 +321,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -351,7 +359,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -393,7 +403,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,7 +485,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", body=await async_maybe_transform( { "action": action, @@ -547,7 +561,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -637,7 +653,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", page=AsyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -691,7 +709,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -727,7 +747,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -769,7 +791,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py index 6b1f7896..ccd8a883 100644 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -82,7 +82,9 @@ def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -115,7 +117,9 @@ def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -180,7 +184,9 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", page=SyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -231,7 +237,9 @@ def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,7 +289,9 @@ def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", body=maybe_transform( { "description_file_location": description_file_location, @@ -334,7 +344,9 @@ def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", body=maybe_transform( { "file_data": file_data, @@ -400,7 +412,9 @@ async def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -433,7 +447,9 @@ async def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -498,7 +514,9 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", page=AsyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -549,7 +567,9 @@ async def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -599,7 +619,9 @@ async def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", body=await async_maybe_transform( { "description_file_location": description_file_location, @@ -652,7 +674,9 @@ async def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", body=await async_maybe_transform( { "file_data": file_data, diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py index 3e66ea27..cf0c40e5 100644 --- a/src/gcore/resources/waap/domains/api_path_groups.py +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -65,7 +65,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +121,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index fc1dd68c..d372c33b 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -90,7 +90,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", body=maybe_transform( { "http_scheme": http_scheme, @@ -153,7 +155,9 @@ def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", body=maybe_transform( { "api_groups": api_groups, @@ -250,7 +254,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", page=SyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -309,7 +315,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -347,7 +355,9 @@ def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -420,7 +430,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", body=await async_maybe_transform( { "http_scheme": http_scheme, @@ -483,7 +495,9 @@ async def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", body=await async_maybe_transform( { "api_groups": api_groups, @@ -580,7 +594,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", page=AsyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -639,7 +655,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -677,7 +695,9 @@ async def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index f175a192..adc81b2b 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -92,7 +92,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", body=maybe_transform( { "action": action, @@ -155,7 +157,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -225,7 +229,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", page=SyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -278,7 +284,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -315,7 +323,9 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -354,7 +364,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -396,7 +408,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -466,7 +480,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", body=await async_maybe_transform( { "action": action, @@ -529,7 +545,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -599,7 +617,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", page=AsyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -652,7 +672,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -689,7 +711,9 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -728,7 +752,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -770,7 +796,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index cf4135cc..6e0e3bac 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -198,7 +198,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", body=maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -248,7 +250,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains", + "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", page=SyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -299,7 +301,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -332,7 +336,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -365,7 +371,9 @@ def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -403,7 +411,9 @@ def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -501,7 +511,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", body=await async_maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -551,7 +563,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains", + "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", page=AsyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -602,7 +614,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -635,7 +649,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -668,7 +684,9 @@ async def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -706,7 +724,9 @@ async def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index b8600359..bf624cf0 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -91,7 +91,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", body=maybe_transform( { "action": action, @@ -153,7 +155,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -223,7 +227,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", page=SyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -276,7 +282,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -313,7 +321,9 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -352,7 +362,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +406,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -463,7 +477,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", body=await async_maybe_transform( { "action": action, @@ -525,7 +541,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -595,7 +613,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", page=AsyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -648,7 +668,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -685,7 +707,9 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -724,7 +748,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -766,7 +792,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 577332e9..98372746 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -93,7 +93,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", body=maybe_transform( { "author": author, @@ -153,7 +155,9 @@ def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=maybe_transform( { "author": author, @@ -228,7 +232,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", page=SyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -283,7 +289,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -321,7 +329,9 @@ def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +402,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", body=await async_maybe_transform( { "author": author, @@ -452,7 +464,9 @@ async def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=await async_maybe_transform( { "author": author, @@ -527,7 +541,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", page=AsyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -582,7 +598,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -620,7 +638,9 @@ async def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 8fb4ab52..7633f059 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -106,7 +106,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", page=SyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -158,7 +160,9 @@ def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +203,9 @@ def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", body=maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -289,7 +295,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", page=AsyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -341,7 +349,9 @@ async def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,7 +392,9 @@ async def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", body=await async_maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py index fc9cafbf..17c719c1 100644 --- a/src/gcore/resources/waap/domains/settings.py +++ b/src/gcore/resources/waap/domains/settings.py @@ -74,7 +74,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", body=maybe_transform( { "api": api, @@ -114,7 +116,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -175,7 +179,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", body=await async_maybe_transform( { "api": api, @@ -215,7 +221,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index f23b048b..517d55f6 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -98,7 +98,9 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", page=SyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -161,7 +163,9 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", page=SyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -227,7 +231,9 @@ def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -280,7 +286,9 @@ def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -374,7 +382,9 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", page=SyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -440,7 +450,9 @@ def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -520,7 +532,9 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", page=AsyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -583,7 +597,9 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", page=AsyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -649,7 +665,9 @@ async def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -702,7 +720,9 @@ async def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -796,7 +816,9 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", page=AsyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -862,7 +884,9 @@ async def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index e056e67a..0634ffef 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -88,7 +88,9 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types", + "/waap/v1/security-insights/types" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/security-insights/types", page=SyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types", + "/waap/v1/security-insights/types" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/security-insights/types", page=AsyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/ip_info/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py index e721bf7d..e1a6fa7c 100644 --- a/src/gcore/resources/waap/ip_info/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -95,7 +95,9 @@ def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -142,7 +144,9 @@ def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -189,7 +193,9 @@ def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -229,7 +235,9 @@ def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -274,7 +282,9 @@ def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -323,7 +333,9 @@ def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -372,7 +384,9 @@ def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -415,7 +429,9 @@ def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -479,7 +495,9 @@ async def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -526,7 +544,9 @@ async def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -573,7 +593,9 @@ async def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -613,7 +635,9 @@ async def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -658,7 +682,9 @@ async def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -707,7 +733,9 @@ async def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -756,7 +784,9 @@ async def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -799,7 +829,9 @@ async def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/ip_info/metrics.py b/src/gcore/resources/waap/ip_info/metrics.py index c70d3faa..32f17c80 100644 --- a/src/gcore/resources/waap/ip_info/metrics.py +++ b/src/gcore/resources/waap/ip_info/metrics.py @@ -77,7 +77,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -149,7 +151,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py index f36dcb35..ffe33962 100644 --- a/src/gcore/resources/waap/organizations.py +++ b/src/gcore/resources/waap/organizations.py @@ -82,7 +82,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations", + "/waap/v1/organizations" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/organizations", page=SyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, @@ -160,7 +162,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations", + "/waap/v1/organizations" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/organizations", page=AsyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py index f8258bab..5f64899e 100644 --- a/src/gcore/resources/waap/statistics.py +++ b/src/gcore/resources/waap/statistics.py @@ -87,7 +87,9 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/statistics/series", + "/waap/v1/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -169,7 +171,9 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/statistics/series", + "/waap/v1/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py index df171560..f2ced3d7 100644 --- a/src/gcore/resources/waap/tags.py +++ b/src/gcore/resources/waap/tags.py @@ -88,7 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags", + "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", page=SyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags", + "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", page=AsyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index 3d68c41f..4f621d4e 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -147,7 +147,7 @@ def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return self._get( - "/waap/v1/clients/me", + "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -219,7 +219,7 @@ async def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return await self._get( - "/waap/v1/clients/me", + "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), From 831281077e0efcfa27b8f7f3adae2baa9017a0ec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Sep 2025 14:24:29 +0000 Subject: [PATCH 310/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/_client.py | 10 +- src/gcore/resources/cloud/audit_logs.py | 8 +- .../resources/cloud/baremetal/flavors.py | 8 +- src/gcore/resources/cloud/baremetal/images.py | 8 +- .../resources/cloud/baremetal/servers.py | 24 +-- .../resources/cloud/billing_reservations.py | 16 +- src/gcore/resources/cloud/cost_reports.py | 24 +-- .../cloud/file_shares/access_rules.py | 24 +-- .../cloud/file_shares/file_shares.py | 48 ++--- src/gcore/resources/cloud/floating_ips.py | 48 ++--- .../cloud/gpu_baremetal_clusters/flavors.py | 8 +- .../gpu_baremetal_clusters.py | 64 ++---- .../cloud/gpu_baremetal_clusters/images.py | 32 +-- .../gpu_baremetal_clusters/interfaces.py | 8 +- .../cloud/gpu_baremetal_clusters/servers.py | 56 ++---- .../resources/cloud/inference/api_keys.py | 40 +--- .../inference/applications/deployments.py | 40 +--- .../cloud/inference/applications/templates.py | 16 +- .../inference/deployments/deployments.py | 64 ++---- .../cloud/inference/deployments/logs.py | 8 +- .../resources/cloud/inference/flavors.py | 16 +- .../resources/cloud/inference/inference.py | 8 +- .../cloud/inference/registry_credentials.py | 40 +--- .../resources/cloud/inference/secrets.py | 40 +--- .../resources/cloud/instances/flavors.py | 8 +- src/gcore/resources/cloud/instances/images.py | 48 ++--- .../resources/cloud/instances/instances.py | 112 +++-------- .../resources/cloud/instances/interfaces.py | 24 +-- .../resources/cloud/instances/metrics.py | 8 +- src/gcore/resources/cloud/ip_ranges.py | 8 +- .../resources/cloud/k8s/clusters/clusters.py | 72 ++----- .../resources/cloud/k8s/clusters/nodes.py | 16 +- .../cloud/k8s/clusters/pools/nodes.py | 16 +- .../cloud/k8s/clusters/pools/pools.py | 48 ++--- src/gcore/resources/cloud/k8s/flavors.py | 8 +- src/gcore/resources/cloud/k8s/k8s.py | 8 +- .../resources/cloud/load_balancers/flavors.py | 8 +- .../load_balancers/l7_policies/l7_policies.py | 40 +--- .../cloud/load_balancers/l7_policies/rules.py | 40 +--- .../cloud/load_balancers/listeners.py | 40 +--- .../cloud/load_balancers/load_balancers.py | 56 ++---- .../resources/cloud/load_balancers/metrics.py | 8 +- .../load_balancers/pools/health_monitors.py | 16 +- .../cloud/load_balancers/pools/members.py | 16 +- .../cloud/load_balancers/pools/pools.py | 40 +--- .../cloud/load_balancers/statuses.py | 16 +- .../resources/cloud/networks/networks.py | 40 +--- src/gcore/resources/cloud/networks/routers.py | 56 ++---- src/gcore/resources/cloud/networks/subnets.py | 40 +--- src/gcore/resources/cloud/placement_groups.py | 32 +-- src/gcore/resources/cloud/projects.py | 32 +-- src/gcore/resources/cloud/quotas/quotas.py | 24 +-- src/gcore/resources/cloud/quotas/requests.py | 32 +-- src/gcore/resources/cloud/regions.py | 12 +- .../resources/cloud/registries/artifacts.py | 16 +- .../resources/cloud/registries/registries.py | 40 +--- .../cloud/registries/repositories.py | 16 +- src/gcore/resources/cloud/registries/tags.py | 8 +- src/gcore/resources/cloud/registries/users.py | 48 ++--- .../reserved_fixed_ips/reserved_fixed_ips.py | 32 +-- .../resources/cloud/reserved_fixed_ips/vip.py | 40 +--- src/gcore/resources/cloud/secrets.py | 32 +-- .../resources/cloud/security_groups/rules.py | 24 +-- .../cloud/security_groups/security_groups.py | 56 ++---- src/gcore/resources/cloud/ssh_keys.py | 40 +--- src/gcore/resources/cloud/tasks.py | 28 +-- src/gcore/resources/cloud/usage_reports.py | 8 +- .../resources/cloud/users/role_assignments.py | 32 +-- src/gcore/resources/cloud/volumes.py | 80 ++------ src/gcore/resources/dns/dns.py | 12 +- src/gcore/resources/dns/locations.py | 28 +-- src/gcore/resources/dns/metrics.py | 8 +- src/gcore/resources/dns/pickers/pickers.py | 4 +- src/gcore/resources/dns/pickers/presets.py | 8 +- src/gcore/resources/dns/zones/dnssec.py | 16 +- src/gcore/resources/dns/zones/rrsets.py | 48 ++--- src/gcore/resources/dns/zones/zones.py | 80 +++----- src/gcore/resources/fastedge/apps/apps.py | 40 ++-- src/gcore/resources/fastedge/apps/logs.py | 8 +- src/gcore/resources/fastedge/binaries.py | 32 +-- src/gcore/resources/fastedge/fastedge.py | 4 +- src/gcore/resources/fastedge/kv_stores.py | 32 +-- src/gcore/resources/fastedge/secrets.py | 48 ++--- src/gcore/resources/fastedge/statistics.py | 16 +- src/gcore/resources/fastedge/templates.py | 40 +--- src/gcore/resources/iam/api_tokens.py | 32 +-- src/gcore/resources/iam/iam.py | 4 +- src/gcore/resources/iam/users.py | 36 +--- src/gcore/resources/security/bgp_announces.py | 16 +- src/gcore/resources/security/events.py | 8 +- .../resources/security/profile_templates.py | 8 +- src/gcore/resources/security/profiles.py | 48 ++--- .../resources/storage/buckets/buckets.py | 24 +-- src/gcore/resources/storage/buckets/cors.py | 16 +- .../resources/storage/buckets/lifecycle.py | 16 +- src/gcore/resources/storage/buckets/policy.py | 24 +-- src/gcore/resources/storage/credentials.py | 8 +- src/gcore/resources/storage/locations.py | 8 +- src/gcore/resources/storage/statistics.py | 16 +- src/gcore/resources/storage/storage.py | 64 ++---- src/gcore/resources/streaming/ai_tasks.py | 28 +-- src/gcore/resources/streaming/broadcasts.py | 48 ++--- src/gcore/resources/streaming/directories.py | 40 +--- src/gcore/resources/streaming/players.py | 40 ++-- src/gcore/resources/streaming/playlists.py | 48 ++--- src/gcore/resources/streaming/quality_sets.py | 16 +- src/gcore/resources/streaming/restreams.py | 40 +--- src/gcore/resources/streaming/statistics.py | 184 +++++------------- .../resources/streaming/streams/overlays.py | 48 ++--- .../resources/streaming/streams/streams.py | 72 ++----- .../resources/streaming/videos/subtitles.py | 40 +--- .../resources/streaming/videos/videos.py | 56 ++---- src/gcore/resources/waap/advanced_rules.py | 8 +- src/gcore/resources/waap/custom_page_sets.py | 48 ++--- .../resources/waap/domains/advanced_rules.py | 48 ++--- .../resources/waap/domains/api_discovery.py | 48 ++--- .../resources/waap/domains/api_path_groups.py | 8 +- src/gcore/resources/waap/domains/api_paths.py | 40 +--- .../resources/waap/domains/custom_rules.py | 56 ++---- src/gcore/resources/waap/domains/domains.py | 44 ++--- .../resources/waap/domains/firewall_rules.py | 56 ++---- .../waap/domains/insight_silences.py | 40 +--- src/gcore/resources/waap/domains/insights.py | 24 +-- src/gcore/resources/waap/domains/settings.py | 16 +- .../resources/waap/domains/statistics.py | 48 ++--- src/gcore/resources/waap/insights.py | 8 +- src/gcore/resources/waap/ip_info/ip_info.py | 64 ++---- src/gcore/resources/waap/ip_info/metrics.py | 8 +- src/gcore/resources/waap/organizations.py | 8 +- src/gcore/resources/waap/statistics.py | 8 +- src/gcore/resources/waap/tags.py | 4 +- src/gcore/resources/waap/waap.py | 4 +- 133 files changed, 1050 insertions(+), 3036 deletions(-) diff --git a/.stats.yml b/.stats.yml index 623270eb..a8e94942 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5d5a213a2cafe76bf32aee1ad65af4e90d3d00b4d6fc90672aaf5e8f66f3f132.yml -openapi_spec_hash: 92b967214f53666d69d5cc9df277376e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-41a0bfcc37b5bb42a72fc8a83fd2206024930816e6ae11496b66be03436db20c.yml +openapi_spec_hash: 6d1a8bbafd395b9cb8caa31890a4b0bc config_hash: 28b1157595821f9f0eb3e9f3ea690703 diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 94bb9d2b..fb66fd59 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -113,7 +113,6 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") - self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -198,7 +197,7 @@ def copy( params = set_default_query http_client = http_client or self._client - client = self.__class__( + return self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -211,8 +210,6 @@ def copy( default_query=params, **_extra_kwargs, ) - client._base_url_overridden = self._base_url_overridden or base_url is not None - return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) @@ -343,7 +340,6 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") - self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -428,7 +424,7 @@ def copy( params = set_default_query http_client = http_client or self._client - client = self.__class__( + return self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -441,8 +437,6 @@ def copy( default_query=params, **_extra_kwargs, ) - client._base_url_overridden = self._base_url_overridden or base_url is not None - return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index 1f4ae40e..1dad329f 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -206,9 +206,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/user_actions", + "/cloud/v1/user_actions", page=SyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, @@ -417,9 +415,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/user_actions", + "/cloud/v1/user_actions", page=AsyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 91474de4..1645b30b 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -93,9 +93,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -189,9 +187,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index ecc0adc3..a6a22954 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -90,9 +90,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -180,9 +178,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 86bbf8ce..57060e27 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -156,9 +156,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -296,9 +294,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", page=SyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -381,9 +377,7 @@ def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=maybe_transform( { "image_id": image_id, @@ -527,9 +521,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -667,9 +659,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", page=AsyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -752,9 +742,7 @@ async def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=await async_maybe_transform( { "image_id": image_id, diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index ae49d667..0d9df747 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -120,9 +120,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservations", + "/cloud/v1/reservations", page=SyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -176,9 +174,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v1/reservations/{reservation_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -280,9 +276,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservations", + "/cloud/v1/reservations", page=AsyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -336,9 +330,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v1/reservations/{reservation_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 910b8fa7..36075dd6 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -146,9 +146,7 @@ def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals", body=maybe_transform( { "time_from": time_from, @@ -257,9 +255,7 @@ def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/reservation_cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals", body=maybe_transform( { "regions": regions, @@ -385,9 +381,7 @@ def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/resources" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources", body=maybe_transform( { "time_from": time_from, @@ -528,9 +522,7 @@ async def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals", body=await async_maybe_transform( { "time_from": time_from, @@ -639,9 +631,7 @@ async def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/reservation_cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals", body=await async_maybe_transform( { "regions": regions, @@ -767,9 +757,7 @@ async def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/resources" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index c7c23710..34cc65ee 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -88,9 +88,7 @@ def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=maybe_transform( { "access_mode": access_mode, @@ -142,9 +140,7 @@ def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -195,9 +191,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -269,9 +263,7 @@ async def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=await async_maybe_transform( { "access_mode": access_mode, @@ -323,9 +315,7 @@ async def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -376,9 +366,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index b35b9ea8..99a806d5 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -206,9 +206,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -291,9 +289,7 @@ def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=maybe_transform( { "name": name, @@ -353,9 +349,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", page=SyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -413,9 +407,7 @@ def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -460,9 +452,7 @@ def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -510,9 +500,7 @@ def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -687,9 +675,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -772,9 +758,7 @@ async def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=await async_maybe_transform( { "name": name, @@ -834,9 +818,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", page=AsyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -894,9 +876,7 @@ async def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -941,9 +921,7 @@ async def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -991,9 +969,7 @@ async def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=await async_maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index aa221e8e..d96ef242 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -94,9 +94,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", body=maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -157,9 +155,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", page=SyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -217,9 +213,7 @@ def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -264,9 +258,7 @@ def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=maybe_transform( { "port_id": port_id, @@ -318,9 +310,7 @@ def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -359,9 +349,7 @@ def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -437,9 +425,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", body=await async_maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -500,9 +486,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", page=AsyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -560,9 +544,7 @@ async def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -607,9 +589,7 @@ async def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=await async_maybe_transform( { "port_id": port_id, @@ -661,9 +641,7 @@ async def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -702,9 +680,7 @@ async def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index 6d594b3b..2c4563b5 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -80,9 +80,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -159,9 +157,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 7fb94685..526babdf 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -156,9 +156,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=maybe_transform( { "flavor": flavor, @@ -222,9 +220,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=SyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -295,9 +291,7 @@ def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -354,9 +348,7 @@ def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -395,9 +387,7 @@ def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -436,9 +426,7 @@ def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -490,9 +478,7 @@ def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=maybe_transform( { "nodes": nodes, @@ -544,9 +530,7 @@ def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, @@ -649,9 +633,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=await async_maybe_transform( { "flavor": flavor, @@ -715,9 +697,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=AsyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -788,9 +768,7 @@ async def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -847,9 +825,7 @@ async def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -888,9 +864,7 @@ async def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -929,9 +903,7 @@ async def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -983,9 +955,7 @@ async def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=await async_maybe_transform( { "nodes": nodes, @@ -1037,9 +1007,7 @@ async def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=await async_maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 249c8d3f..8c2d4623 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -79,9 +79,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -126,9 +124,7 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -173,9 +169,7 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +244,7 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=maybe_transform( { "name": name, @@ -328,9 +320,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -375,9 +365,7 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -422,9 +410,7 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -499,9 +485,7 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index ad75df3e..863ffde8 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -71,9 +71,7 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -133,9 +131,7 @@ async def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 5dbf5590..adda6989 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -143,9 +143,7 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=SyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -211,9 +209,7 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -454,9 +450,7 @@ def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -515,9 +509,7 @@ def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -563,9 +555,7 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -604,9 +594,7 @@ def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -645,9 +633,7 @@ def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -764,9 +750,7 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=AsyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -832,9 +816,7 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1077,9 +1059,7 @@ async def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -1138,9 +1118,7 @@ async def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, @@ -1186,9 +1164,7 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1227,9 +1203,7 @@ async def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1268,9 +1242,7 @@ async def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py index f9f5ccb9..98238c19 100644 --- a/src/gcore/resources/cloud/inference/api_keys.py +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -84,9 +84,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", body=maybe_transform( { "name": name, @@ -137,9 +135,7 @@ def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -182,9 +178,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", page=SyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -239,9 +233,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,9 +273,7 @@ def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,9 +340,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", body=await async_maybe_transform( { "name": name, @@ -403,9 +391,7 @@ async def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=await async_maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -448,9 +434,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", page=AsyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -505,9 +489,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,9 +529,7 @@ async def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index 43b6893f..845bffce 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -93,9 +93,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", body=maybe_transform( { "application_name": application_name, @@ -142,9 +140,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -186,9 +182,7 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -232,9 +226,7 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -288,9 +280,7 @@ def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -372,9 +362,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", body=await async_maybe_transform( { "application_name": application_name, @@ -421,9 +409,7 @@ async def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -465,9 +451,7 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -511,9 +495,7 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -567,9 +549,7 @@ async def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, diff --git a/src/gcore/resources/cloud/inference/applications/templates.py b/src/gcore/resources/cloud/inference/applications/templates.py index 664203be..1c475cb8 100644 --- a/src/gcore/resources/cloud/inference/applications/templates.py +++ b/src/gcore/resources/cloud/inference/applications/templates.py @@ -58,9 +58,7 @@ def list( required to create a fully functional application deployment. """ return self._get( - "/cloud/v3/inference/applications/catalog" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -99,9 +97,7 @@ def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -147,9 +143,7 @@ async def list( required to create a fully functional application deployment. """ return await self._get( - "/cloud/v3/inference/applications/catalog" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -188,9 +182,7 @@ async def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return await self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 0cccc581..3a4e4629 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -147,9 +147,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", body=maybe_transform( { "containers": containers, @@ -265,9 +263,7 @@ def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -329,9 +325,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", page=SyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -382,9 +376,7 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,9 +416,7 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,9 +457,7 @@ def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,9 +505,7 @@ def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -567,9 +553,7 @@ def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -689,9 +673,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", body=await async_maybe_transform( { "containers": containers, @@ -807,9 +789,7 @@ async def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, @@ -871,9 +851,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", page=AsyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -924,9 +902,7 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -966,9 +942,7 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1009,9 +983,7 @@ async def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1059,9 +1031,7 @@ async def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1109,9 +1079,7 @@ async def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index 2ee0666e..1cc65006 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -91,9 +91,7 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=SyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, @@ -180,9 +178,7 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=AsyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index 8dcc3e62..d273b19b 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -73,9 +73,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors", page=SyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -121,9 +119,7 @@ def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return self._get( - f"/cloud/v3/inference/flavors/{flavor_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,9 +178,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors", page=AsyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -230,9 +224,7 @@ async def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return await self._get( - f"/cloud/v3/inference/flavors/{flavor_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index b116b08f..103c70f1 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -123,9 +123,7 @@ def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return self._get( - "/cloud/v3/inference/capacity" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -189,9 +187,7 @@ async def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return await self._get( - "/cloud/v3/inference/capacity" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 9d5a4072..6dd78f70 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -86,9 +86,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", body=maybe_transform( { "name": name, @@ -139,9 +137,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", page=SyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -193,9 +189,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -235,9 +229,7 @@ def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -286,9 +278,7 @@ def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=maybe_transform( { "password": password, @@ -364,9 +354,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", body=await async_maybe_transform( { "name": name, @@ -417,9 +405,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", page=AsyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -471,9 +457,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -513,9 +497,7 @@ async def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -564,9 +546,7 @@ async def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=await async_maybe_transform( { "password": password, diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index ed312faa..275ec3f2 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -79,9 +79,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", body=maybe_transform( { "data": data, @@ -132,9 +130,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", page=SyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -186,9 +182,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,9 +222,7 @@ def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,9 +268,7 @@ def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", body=maybe_transform( { "data": data, @@ -350,9 +340,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", body=await async_maybe_transform( { "data": data, @@ -403,9 +391,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", page=AsyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -457,9 +443,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -499,9 +483,7 @@ async def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,9 +529,7 @@ async def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", body=await async_maybe_transform( { "data": data, diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 3bf61d85..9bd7f38f 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -85,9 +85,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -171,9 +169,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index b45fd614..af8e82a7 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -110,9 +110,7 @@ def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", body=maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -178,9 +176,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -234,9 +230,7 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -308,9 +302,7 @@ def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -367,9 +359,7 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -452,9 +442,7 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -556,9 +544,7 @@ async def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", body=await async_maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -624,9 +610,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -680,9 +664,7 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -754,9 +736,7 @@ async def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -813,9 +793,7 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -898,9 +876,7 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index dde03b4b..77fbc20b 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -228,9 +228,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -297,9 +295,7 @@ def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -448,9 +444,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}", page=SyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -544,9 +538,7 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -655,9 +647,7 @@ def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=maybe_transform( { "action": action, @@ -708,9 +698,7 @@ def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -763,9 +751,7 @@ def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=maybe_transform( { "name": name, @@ -811,9 +797,7 @@ def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -852,9 +836,7 @@ def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -908,9 +890,7 @@ def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -952,9 +932,7 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1001,9 +979,7 @@ def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1045,9 +1021,7 @@ def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1097,9 +1071,7 @@ def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=maybe_transform( { "name": name, @@ -1270,9 +1242,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -1339,9 +1309,7 @@ async def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1490,9 +1458,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}", page=AsyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -1586,9 +1552,7 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1697,9 +1661,7 @@ async def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=await async_maybe_transform( { "action": action, @@ -1750,9 +1712,7 @@ async def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=await async_maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -1805,9 +1765,7 @@ async def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=await async_maybe_transform( { "name": name, @@ -1853,9 +1811,7 @@ async def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1894,9 +1850,7 @@ async def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1950,9 +1904,7 @@ async def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1994,9 +1946,7 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2043,9 +1993,7 @@ async def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2087,9 +2035,7 @@ async def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=await async_maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -2139,9 +2085,7 @@ async def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 8fc5e453..61fe4266 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -77,9 +77,7 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -315,9 +313,7 @@ def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -376,9 +372,7 @@ def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -445,9 +439,7 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -683,9 +675,7 @@ async def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -744,9 +734,7 @@ async def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index 03ffbcd1..fa058434 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -87,9 +87,7 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -168,9 +166,7 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index b0d0c62e..12024d04 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -67,9 +67,7 @@ def list( returned. """ return self._get( - "/cloud/public/v1/ipranges/egress" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -125,9 +123,7 @@ async def list( returned. """ return await self._get( - "/cloud/public/v1/ipranges/egress" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index 198ead21..a778a3b9 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -210,9 +210,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", body=maybe_transform( { "keypair": keypair, @@ -341,9 +339,7 @@ def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=maybe_transform( { "authentication": authentication, @@ -389,9 +385,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -433,9 +427,7 @@ def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -478,9 +470,7 @@ def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -519,9 +509,7 @@ def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -560,9 +548,7 @@ def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -601,9 +587,7 @@ def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -645,9 +629,7 @@ def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -817,9 +799,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", body=await async_maybe_transform( { "keypair": keypair, @@ -948,9 +928,7 @@ async def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=await async_maybe_transform( { "authentication": authentication, @@ -996,9 +974,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1040,9 +1016,7 @@ async def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1085,9 +1059,7 @@ async def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1126,9 +1098,7 @@ async def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1167,9 +1137,7 @@ async def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1208,9 +1176,7 @@ async def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1252,9 +1218,7 @@ async def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=await async_maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/clusters/nodes.py b/src/gcore/resources/cloud/k8s/clusters/nodes.py index d04a0586..b3bd95d8 100644 --- a/src/gcore/resources/cloud/k8s/clusters/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/nodes.py @@ -76,9 +76,7 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -126,9 +124,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,9 +187,7 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -241,9 +235,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py index 8ff64793..903c428e 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py @@ -79,9 +79,7 @@ def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -132,9 +130,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -200,9 +196,7 @@ async def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -253,9 +247,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index b60e3039..0cb81d5a 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -130,9 +130,7 @@ def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=maybe_transform( { "flavor_id": flavor_id, @@ -210,9 +208,7 @@ def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -262,9 +258,7 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -306,9 +300,7 @@ def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,9 +342,7 @@ def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -397,9 +387,7 @@ def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -504,9 +492,7 @@ async def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=await async_maybe_transform( { "flavor_id": flavor_id, @@ -584,9 +570,7 @@ async def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=await async_maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -636,9 +620,7 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -680,9 +662,7 @@ async def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -724,9 +704,7 @@ async def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -771,9 +749,7 @@ async def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=await async_maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/flavors.py b/src/gcore/resources/cloud/k8s/flavors.py index cd456f26..71781231 100644 --- a/src/gcore/resources/cloud/k8s/flavors.py +++ b/src/gcore/resources/cloud/k8s/flavors.py @@ -79,9 +79,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -157,9 +155,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index c193fccd..ad74c5fd 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -92,9 +92,7 @@ def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -159,9 +157,7 @@ async def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index d104d723..48ba2c61 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -76,9 +76,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -145,9 +143,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index cd0db02e..c78be82d 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py @@ -118,9 +118,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", body=maybe_transform( { "action": action, @@ -170,9 +168,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +207,7 @@ def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -252,9 +246,7 @@ def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -322,9 +314,7 @@ def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=maybe_transform( { "action": action, @@ -430,9 +420,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", body=await async_maybe_transform( { "action": action, @@ -482,9 +470,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,9 +509,7 @@ async def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -564,9 +548,7 @@ async def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -634,9 +616,7 @@ async def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=await async_maybe_transform( { "action": action, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py index b83bb590..34063a17 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -106,9 +106,7 @@ def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=maybe_transform( { "compare_type": compare_type, @@ -158,9 +156,7 @@ def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -202,9 +198,7 @@ def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -246,9 +240,7 @@ def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -320,9 +312,7 @@ def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=maybe_transform( { "compare_type": compare_type, @@ -422,9 +412,7 @@ async def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=await async_maybe_transform( { "compare_type": compare_type, @@ -474,9 +462,7 @@ async def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -518,9 +504,7 @@ async def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -562,9 +546,7 @@ async def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -636,9 +618,7 @@ async def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=await async_maybe_transform( { "compare_type": compare_type, diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index abbb5e77..bf760cfb 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -127,9 +127,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -221,9 +219,7 @@ def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -283,9 +279,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -340,9 +334,7 @@ def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +382,7 @@ def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -499,9 +489,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=await async_maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -593,9 +581,7 @@ async def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=await async_maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -655,9 +641,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -712,9 +696,7 @@ async def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -762,9 +744,7 @@ async def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 9a8070b5..f50f4ce5 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -207,9 +207,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -299,9 +297,7 @@ def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=maybe_transform( { "logging": logging, @@ -379,9 +375,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", page=SyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -439,9 +433,7 @@ def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -483,9 +475,7 @@ def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -531,9 +521,7 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -585,9 +573,7 @@ def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -718,9 +704,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -810,9 +794,7 @@ async def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=await async_maybe_transform( { "logging": logging, @@ -890,9 +872,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", page=AsyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -950,9 +930,7 @@ async def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -994,9 +972,7 @@ async def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=await async_maybe_transform( {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams ), @@ -1044,9 +1020,7 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1098,9 +1072,7 @@ async def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index dd0dedd2..59df8038 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -81,9 +81,7 @@ def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -156,9 +154,7 @@ async def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index 417ae8b0..bae1858c 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -115,9 +115,7 @@ def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=maybe_transform( { "delay": delay, @@ -179,9 +177,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -278,9 +274,7 @@ async def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=await async_maybe_transform( { "delay": delay, @@ -342,9 +336,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 37faaa3a..05091a8b 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -131,9 +131,7 @@ def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=maybe_transform( { "address": address, @@ -197,9 +195,7 @@ def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -315,9 +311,7 @@ async def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=await async_maybe_transform( { "address": address, @@ -381,9 +375,7 @@ async def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 01abaebd..c0df516c 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -147,9 +147,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", body=maybe_transform( { "lb_algorithm": lb_algorithm, @@ -264,9 +262,7 @@ def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=maybe_transform( { "ca_secret_id": ca_secret_id, @@ -332,9 +328,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -390,9 +384,7 @@ def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -437,9 +429,7 @@ def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -550,9 +540,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", body=await async_maybe_transform( { "lb_algorithm": lb_algorithm, @@ -667,9 +655,7 @@ async def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=await async_maybe_transform( { "ca_secret_id": ca_secret_id, @@ -735,9 +721,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -793,9 +777,7 @@ async def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -840,9 +822,7 @@ async def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index e99f90c9..5579e857 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -69,9 +69,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -110,9 +108,7 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -169,9 +165,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -210,9 +204,7 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 235648f0..2fda130e 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -120,9 +120,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -203,9 +201,7 @@ def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=maybe_transform( { "name": name, @@ -272,9 +268,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", page=SyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -334,9 +328,7 @@ def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -381,9 +373,7 @@ def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -468,9 +458,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -551,9 +539,7 @@ async def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=await async_maybe_transform( { "name": name, @@ -620,9 +606,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", page=AsyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -682,9 +666,7 @@ async def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -729,9 +711,7 @@ async def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 93596051..657982bd 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -92,9 +92,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -151,9 +149,7 @@ def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=maybe_transform( { "external_gateway_info": external_gateway_info, @@ -203,9 +199,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", page=SyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -255,9 +249,7 @@ def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -309,9 +301,7 @@ def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=maybe_transform( { "subnet_id": subnet_id, @@ -360,9 +350,7 @@ def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=maybe_transform({"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -402,9 +390,7 @@ def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,9 +459,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -532,9 +516,7 @@ async def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=await async_maybe_transform( { "external_gateway_info": external_gateway_info, @@ -584,9 +566,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", page=AsyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -636,9 +616,7 @@ async def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -690,9 +668,7 @@ async def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=await async_maybe_transform( { "subnet_id": subnet_id, @@ -741,9 +717,7 @@ async def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=await async_maybe_transform( {"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams ), @@ -785,9 +759,7 @@ async def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index aef9bb2a..b781c2e3 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -125,9 +125,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", body=maybe_transform( { "cidr": cidr, @@ -227,9 +225,7 @@ def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=maybe_transform( { "dns_nameservers": dns_nameservers, @@ -315,9 +311,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", page=SyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -378,9 +372,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +417,7 @@ def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -531,9 +521,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", body=await async_maybe_transform( { "cidr": cidr, @@ -633,9 +621,7 @@ async def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=await async_maybe_transform( { "dns_nameservers": dns_nameservers, @@ -721,9 +707,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", page=AsyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -784,9 +768,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -831,9 +813,7 @@ async def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 4c3a5142..31777c13 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -80,9 +80,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -125,9 +123,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -166,9 +162,7 @@ def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -207,9 +201,7 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -272,9 +264,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -317,9 +307,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -358,9 +346,7 @@ async def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -399,9 +385,7 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 0603b072..383f3c3b 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -83,7 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", body=maybe_transform( { "name": name, @@ -142,7 +142,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", page=SyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -193,9 +193,7 @@ def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._delete( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,9 +226,7 @@ def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -271,9 +267,7 @@ def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._put( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", body=maybe_transform( { "name": name, @@ -345,7 +339,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", body=await async_maybe_transform( { "name": name, @@ -404,7 +398,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", page=AsyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -455,9 +449,7 @@ async def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._delete( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -490,9 +482,7 @@ async def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -533,9 +523,7 @@ async def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._put( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 17a7d75a..9a9f9c82 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -65,9 +65,7 @@ def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return self._get( - "/cloud/v2/client_quotas" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/client_quotas", + "/cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -105,9 +103,7 @@ def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -140,9 +136,7 @@ def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/global_quotas/{client_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -186,9 +180,7 @@ async def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return await self._get( - "/cloud/v2/client_quotas" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/client_quotas", + "/cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,9 +218,7 @@ async def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -261,9 +251,7 @@ async def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/global_quotas/{client_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 4c49c8b0..79d4febe 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -79,9 +79,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", body=maybe_transform( { "description": description, @@ -129,9 +127,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", page=SyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -177,9 +173,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -212,9 +206,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -275,9 +267,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", body=await async_maybe_transform( { "description": description, @@ -325,9 +315,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", page=AsyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -373,9 +361,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -408,9 +394,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index df9da044..b49adfcd 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -86,7 +86,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", + "/cloud/v1/regions", page=SyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -139,9 +139,7 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/regions/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -215,7 +213,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", + "/cloud/v1/regions", page=AsyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -268,9 +266,7 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/regions/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index 77496af1..0b579ba5 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -72,9 +72,7 @@ def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -118,9 +116,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,9 +177,7 @@ async def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -227,9 +221,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index b8623cf3..8889d473 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -126,9 +126,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -171,9 +169,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +207,7 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +244,7 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -292,9 +284,7 @@ def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=maybe_transform({"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -375,9 +365,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -420,9 +408,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -460,9 +446,7 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -499,9 +483,7 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -541,9 +523,7 @@ async def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=await async_maybe_transform( {"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams ), diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index 452755d2..74377052 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -69,9 +69,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -112,9 +110,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -172,9 +168,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -215,9 +209,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index 7bed1478..ab35828c 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -78,9 +78,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,9 +146,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index 8c402baf..f535c7dd 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -89,9 +89,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=maybe_transform( { "duration": duration, @@ -144,9 +142,7 @@ def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=maybe_transform( { "duration": duration, @@ -190,9 +186,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -231,9 +225,7 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,9 +265,7 @@ def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -314,9 +304,7 @@ def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,9 +375,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=await async_maybe_transform( { "duration": duration, @@ -442,9 +428,7 @@ async def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=await async_maybe_transform( { "duration": duration, @@ -488,9 +472,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,9 +511,7 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -571,9 +551,7 @@ async def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=await async_maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -612,9 +590,7 @@ async def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index 1cd099f6..d5b0e030 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -274,9 +274,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=maybe_transform( { "type": type, @@ -354,9 +352,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=SyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -413,9 +409,7 @@ def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -454,9 +448,7 @@ def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -703,9 +695,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=await async_maybe_transform( { "type": type, @@ -783,9 +773,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=AsyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -842,9 +830,7 @@ async def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -883,9 +869,7 @@ async def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 22757eba..1d6c76e2 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -79,9 +79,7 @@ def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -120,9 +118,7 @@ def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -164,9 +160,7 @@ def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -211,9 +205,7 @@ def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -256,9 +248,7 @@ def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), @@ -321,9 +311,7 @@ async def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -362,9 +350,7 @@ async def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -406,9 +392,7 @@ async def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -453,9 +437,7 @@ async def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=await async_maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -498,9 +480,7 @@ async def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index dabef59a..5cbefb25 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -86,9 +86,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}", page=SyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -144,9 +142,7 @@ def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,9 +187,7 @@ def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,9 +236,7 @@ def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -320,9 +312,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}", page=AsyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -378,9 +368,7 @@ async def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +413,7 @@ async def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -476,9 +462,7 @@ async def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index c69d2608..89b27a23 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -126,9 +126,7 @@ def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=maybe_transform( { "description": description, @@ -181,9 +179,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -277,9 +273,7 @@ def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=maybe_transform( { "direction": direction, @@ -403,9 +397,7 @@ async def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=await async_maybe_transform( { "description": description, @@ -458,9 +450,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -554,9 +544,7 @@ async def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=await async_maybe_transform( { "direction": direction, diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 0e24383b..ac4d9bc3 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -97,9 +97,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", body=maybe_transform( { "security_group": security_group, @@ -172,9 +170,7 @@ def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=maybe_transform( { "changed_rules": changed_rules, @@ -230,9 +226,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", page=SyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -285,9 +279,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -329,9 +321,7 @@ def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -371,9 +361,7 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -412,9 +400,7 @@ def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -481,9 +467,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", body=await async_maybe_transform( { "security_group": security_group, @@ -556,9 +540,7 @@ async def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=await async_maybe_transform( { "changed_rules": changed_rules, @@ -614,9 +596,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", page=AsyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -669,9 +649,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -713,9 +691,7 @@ async def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=await async_maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -755,9 +731,7 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -796,9 +770,7 @@ async def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 30ef2830..788d415c 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -90,9 +90,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", body=maybe_transform( { "name": name, @@ -143,9 +141,7 @@ def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=maybe_transform({"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -190,9 +186,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", page=SyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -245,9 +239,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -287,9 +279,7 @@ def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -362,9 +352,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", body=await async_maybe_transform( { "name": name, @@ -415,9 +403,7 @@ async def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=await async_maybe_transform( {"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams ), @@ -464,9 +450,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", page=AsyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -519,9 +503,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -561,9 +543,7 @@ async def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index c0866b41..63bc78f7 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -156,7 +156,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", + "/cloud/v1/tasks", page=SyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -213,9 +213,7 @@ def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v1/tasks/acknowledge_all" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -260,9 +258,7 @@ def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -297,9 +293,7 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/cloud/v1/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -437,7 +431,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", + "/cloud/v1/tasks", page=AsyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -494,9 +488,7 @@ async def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v1/tasks/acknowledge_all" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -541,9 +533,7 @@ async def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -578,9 +568,7 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/cloud/v1/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index 48387eda..0adc0809 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -139,9 +139,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/usage_report" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/usage_report", + "/cloud/v1/usage_report", body=maybe_transform( { "time_from": time_from, @@ -279,9 +277,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/usage_report" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/usage_report", + "/cloud/v1/usage_report", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 0318b8fc..5294d3a7 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -85,9 +85,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", body=maybe_transform( { "role": role, @@ -141,9 +139,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", body=maybe_transform( { "role": role, @@ -195,9 +191,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", page=SyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -243,9 +237,7 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ return self._delete( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -308,9 +300,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", body=await async_maybe_transform( { "role": role, @@ -364,9 +354,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", body=await async_maybe_transform( { "role": role, @@ -418,9 +406,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", page=AsyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -466,9 +452,7 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ return await self._delete( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 74756335..ed0babaa 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -292,9 +292,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", body=maybe_transform( { "image_id": image_id, @@ -378,9 +376,7 @@ def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=maybe_transform( { "name": name, @@ -462,9 +458,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", page=SyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -533,9 +527,7 @@ def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -592,9 +584,7 @@ def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=maybe_transform( { "instance_id": instance_id, @@ -651,9 +641,7 @@ def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=maybe_transform({"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -702,9 +690,7 @@ def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -752,9 +738,7 @@ def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -804,9 +788,7 @@ def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -855,9 +837,7 @@ def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1121,9 +1101,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", body=await async_maybe_transform( { "image_id": image_id, @@ -1207,9 +1185,7 @@ async def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=await async_maybe_transform( { "name": name, @@ -1291,9 +1267,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", page=AsyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -1362,9 +1336,7 @@ async def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1421,9 +1393,7 @@ async def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=await async_maybe_transform( { "instance_id": instance_id, @@ -1480,9 +1450,7 @@ async def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=await async_maybe_transform( {"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams ), @@ -1533,9 +1501,7 @@ async def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=await async_maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -1583,9 +1549,7 @@ async def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1635,9 +1599,7 @@ async def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=await async_maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1686,9 +1648,7 @@ async def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py index 612cd629..3e6485d0 100644 --- a/src/gcore/resources/dns/dns.py +++ b/src/gcore/resources/dns/dns.py @@ -104,9 +104,7 @@ def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return self._get( - "/dns/v2/platform/info" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/platform/info", + "/dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -143,7 +141,7 @@ def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", + "/dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -209,9 +207,7 @@ async def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return await self._get( - "/dns/v2/platform/info" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/platform/info", + "/dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -248,7 +244,7 @@ async def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", + "/dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/locations.py b/src/gcore/resources/dns/locations.py index c58907a8..20dcea5a 100644 --- a/src/gcore/resources/dns/locations.py +++ b/src/gcore/resources/dns/locations.py @@ -54,7 +54,7 @@ def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return self._get( - "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", + "/dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -73,9 +73,7 @@ def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return self._get( - "/dns/v2/locations/continents" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/continents", + "/dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -94,9 +92,7 @@ def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return self._get( - "/dns/v2/locations/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/countries", + "/dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -115,9 +111,7 @@ def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return self._get( - "/dns/v2/locations/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/regions", + "/dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -157,7 +151,7 @@ async def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return await self._get( - "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", + "/dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -176,9 +170,7 @@ async def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return await self._get( - "/dns/v2/locations/continents" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/continents", + "/dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -197,9 +189,7 @@ async def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return await self._get( - "/dns/v2/locations/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/countries", + "/dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -218,9 +208,7 @@ async def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return await self._get( - "/dns/v2/locations/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/regions", + "/dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index b9bf45a5..8eef7aeb 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -82,9 +82,7 @@ def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return self._get( - "/dns/v2/monitor/metrics" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -162,9 +160,7 @@ async def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return await self._get( - "/dns/v2/monitor/metrics" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/pickers/pickers.py b/src/gcore/resources/dns/pickers/pickers.py index 599a2450..3078c7f2 100644 --- a/src/gcore/resources/dns/pickers/pickers.py +++ b/src/gcore/resources/dns/pickers/pickers.py @@ -63,7 +63,7 @@ def list( ) -> PickerListResponse: """Returns list of picker""" return self._get( - "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", + "/dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -107,7 +107,7 @@ async def list( ) -> PickerListResponse: """Returns list of picker""" return await self._get( - "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", + "/dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/pickers/presets.py b/src/gcore/resources/dns/pickers/presets.py index 09f7d53b..aebd10ff 100644 --- a/src/gcore/resources/dns/pickers/presets.py +++ b/src/gcore/resources/dns/pickers/presets.py @@ -51,9 +51,7 @@ def list( ) -> PresetListResponse: """Returns list of picker preset""" return self._get( - "/dns/v2/pickers/presets" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/pickers/presets", + "/dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -93,9 +91,7 @@ async def list( ) -> PresetListResponse: """Returns list of picker preset""" return await self._get( - "/dns/v2/pickers/presets" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/pickers/presets", + "/dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/dnssec.py b/src/gcore/resources/dns/zones/dnssec.py index 8f283155..8c747071 100644 --- a/src/gcore/resources/dns/zones/dnssec.py +++ b/src/gcore/resources/dns/zones/dnssec.py @@ -69,9 +69,7 @@ def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", body=maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -105,9 +103,7 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -162,9 +158,7 @@ async def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", body=await async_maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -198,9 +192,7 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index 93697456..e1d136b1 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -205,9 +205,7 @@ def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -261,9 +259,7 @@ def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/rrsets" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -314,9 +310,7 @@ def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -355,9 +349,7 @@ def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,9 +394,7 @@ def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -463,9 +453,7 @@ def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -656,9 +644,7 @@ async def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, @@ -712,9 +698,7 @@ async def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/rrsets" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -765,9 +749,7 @@ async def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -806,9 +788,7 @@ async def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -853,9 +833,7 @@ async def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -914,9 +892,7 @@ async def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 31b815a3..75e11dde 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -143,7 +143,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", body=maybe_transform( { "name": name, @@ -225,7 +225,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -283,9 +283,7 @@ def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._delete( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -320,9 +318,7 @@ def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._post( - f"/dns/v2/analyze/{name}/delegation-status" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -355,9 +351,7 @@ def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/disable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +384,7 @@ def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/enable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +417,7 @@ def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/export" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -460,9 +450,7 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,9 +517,7 @@ def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/statistics" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -597,9 +583,7 @@ def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._post( - f"/dns/v2/zones/{zone_name}/import" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import", body=maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -672,9 +656,7 @@ def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return self._put( - f"/dns/v2/zones/{path_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}", body=maybe_transform( { "body_name": body_name, @@ -787,7 +769,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", body=await async_maybe_transform( { "name": name, @@ -869,7 +851,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -927,9 +909,7 @@ async def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._delete( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -964,9 +944,7 @@ async def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._post( - f"/dns/v2/analyze/{name}/delegation-status" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -999,9 +977,7 @@ async def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/disable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1034,9 +1010,7 @@ async def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/enable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1069,9 +1043,7 @@ async def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/export" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1104,9 +1076,7 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1173,9 +1143,7 @@ async def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/statistics" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1241,9 +1209,7 @@ async def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/import" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import", body=await async_maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1316,9 +1282,7 @@ async def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return await self._put( - f"/dns/v2/zones/{path_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}", body=await async_maybe_transform( { "body_name": body_name, diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index a72cd50f..92d2662a 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -121,7 +121,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", body=maybe_transform( { "binary": binary, @@ -208,9 +208,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=maybe_transform( { "binary": binary, @@ -307,7 +305,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", page=SyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -357,9 +355,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +386,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,9 +418,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -522,7 +514,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", body=await async_maybe_transform( { "binary": binary, @@ -609,9 +601,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=await async_maybe_transform( { "binary": binary, @@ -708,7 +698,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", page=AsyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -758,9 +748,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -791,9 +779,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -825,9 +811,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=await async_maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py index b61bcfd9..f43d121c 100644 --- a/src/gcore/resources/fastedge/apps/logs.py +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -94,9 +94,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs", page=SyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, @@ -189,9 +187,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs", page=AsyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index bdda5fd9..8323efb1 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -67,9 +67,7 @@ def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return self._post( - "/fastedge/v1/binaries/raw" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw", body=read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -89,9 +87,7 @@ def list( ) -> BinaryListResponse: """List binaries""" return self._get( - "/fastedge/v1/binaries" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries", + "/fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,9 +119,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -156,9 +150,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +203,7 @@ async def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return await self._post( - "/fastedge/v1/binaries/raw" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw", body=await async_read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -233,9 +223,7 @@ async def list( ) -> BinaryListResponse: """List binaries""" return await self._get( - "/fastedge/v1/binaries" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries", + "/fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,9 +255,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,9 +286,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/fastedge.py b/src/gcore/resources/fastedge/fastedge.py index e52b5216..9b052788 100644 --- a/src/gcore/resources/fastedge/fastedge.py +++ b/src/gcore/resources/fastedge/fastedge.py @@ -123,7 +123,7 @@ def get_account_overview( ) -> Client: """Get status and limits for the client""" return self._get( - "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", + "/fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +187,7 @@ async def get_account_overview( ) -> Client: """Get status and limits for the client""" return await self._get( - "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", + "/fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py index 17cd738d..cb007bbc 100644 --- a/src/gcore/resources/fastedge/kv_stores.py +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -72,7 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", body=maybe_transform( { "byod": byod, @@ -112,7 +112,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -148,9 +148,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,9 +179,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -220,9 +216,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", body=maybe_transform( { "byod": byod, @@ -286,7 +280,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", body=await async_maybe_transform( { "byod": byod, @@ -326,7 +320,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -362,9 +356,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -395,9 +387,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -434,9 +424,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", body=await async_maybe_transform( { "byod": byod, diff --git a/src/gcore/resources/fastedge/secrets.py b/src/gcore/resources/fastedge/secrets.py index beee5a6a..8b1e97e2 100644 --- a/src/gcore/resources/fastedge/secrets.py +++ b/src/gcore/resources/fastedge/secrets.py @@ -83,9 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", body=maybe_transform( { "name": name, @@ -133,9 +131,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=maybe_transform( { "comment": comment, @@ -179,9 +175,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -226,9 +220,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -263,9 +255,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -305,9 +295,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=maybe_transform( { "name": name, @@ -375,9 +363,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", body=await async_maybe_transform( { "name": name, @@ -425,9 +411,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "comment": comment, @@ -471,9 +455,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -518,9 +500,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -555,9 +535,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -597,9 +575,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/fastedge/statistics.py b/src/gcore/resources/fastedge/statistics.py index 9bc2a7ba..1958aafc 100644 --- a/src/gcore/resources/fastedge/statistics.py +++ b/src/gcore/resources/fastedge/statistics.py @@ -83,9 +83,7 @@ def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/calls" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -143,9 +141,7 @@ def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/app_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -224,9 +220,7 @@ async def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/calls" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -284,9 +278,7 @@ async def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/app_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/fastedge/templates.py b/src/gcore/resources/fastedge/templates.py index 78413275..a39e2757 100644 --- a/src/gcore/resources/fastedge/templates.py +++ b/src/gcore/resources/fastedge/templates.py @@ -93,9 +93,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", body=maybe_transform( { "binary_id": binary_id, @@ -151,9 +149,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", page=SyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -201,9 +197,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -238,9 +232,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -289,9 +281,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", body=maybe_transform( { "binary_id": binary_id, @@ -371,9 +361,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", body=await async_maybe_transform( { "binary_id": binary_id, @@ -429,9 +417,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", page=AsyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -479,9 +465,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -516,9 +500,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -567,9 +549,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", body=await async_maybe_transform( { "binary_id": binary_id, diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index 8e771ad5..ecd59cb6 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -80,9 +80,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", body=maybe_transform( { "client_user": client_user, @@ -149,9 +147,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -200,9 +196,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -234,9 +228,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,9 +293,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", body=await async_maybe_transform( { "client_user": client_user, @@ -370,9 +360,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -421,9 +409,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -455,9 +441,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/iam.py b/src/gcore/resources/iam/iam.py index e6fb22d8..54b4653f 100644 --- a/src/gcore/resources/iam/iam.py +++ b/src/gcore/resources/iam/iam.py @@ -75,7 +75,7 @@ def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return self._get( - "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", + "/iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +123,7 @@ async def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return await self._get( - "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", + "/iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index 5f0cf949..a27021c1 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -101,9 +101,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", body=maybe_transform( { "auth_types": auth_types, @@ -154,7 +152,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", + "/iam/users", page=SyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -200,9 +198,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -233,9 +229,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,9 +275,7 @@ def invite( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/iam/clients/invite_user" - if self._client._base_url_overridden - else "https://api.gcore.com//iam/clients/invite_user", + "/iam/clients/invite_user", body=maybe_transform( { "client_id": client_id, @@ -374,9 +366,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", body=await async_maybe_transform( { "auth_types": auth_types, @@ -427,7 +417,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", + "/iam/users", page=AsyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -473,9 +463,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -506,9 +494,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -554,9 +540,7 @@ async def invite( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/iam/clients/invite_user" - if self._client._base_url_overridden - else "https://api.gcore.com//iam/clients/invite_user", + "/iam/clients/invite_user", body=await async_maybe_transform( { "client_id": client_id, diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index fdbb1d33..43947fab 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -74,9 +74,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -124,9 +122,7 @@ def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", body=maybe_transform( { "announce": announce, @@ -195,9 +191,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -245,9 +239,7 @@ async def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", body=await async_maybe_transform( { "announce": announce, diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py index 98c34908..86d387bb 100644 --- a/src/gcore/resources/security/events.py +++ b/src/gcore/resources/security/events.py @@ -88,9 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs" - if self._client._base_url_overridden - else "https://api.gcore.com//security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs", page=SyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, @@ -176,9 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs" - if self._client._base_url_overridden - else "https://api.gcore.com//security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs", page=AsyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py index 79719fd7..85b84ad8 100644 --- a/src/gcore/resources/security/profile_templates.py +++ b/src/gcore/resources/security/profile_templates.py @@ -55,9 +55,7 @@ def list( profile. Client receives only common and created for him profile templates. """ return self._get( - "/security/iaas/profile-templates" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/profile-templates", + "/security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -101,9 +99,7 @@ async def list( profile. Client receives only common and created for him profile templates. """ return await self._get( - "/security/iaas/profile-templates" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/profile-templates", + "/security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index b3cd1183..16668afa 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -78,9 +78,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", body=maybe_transform( { "fields": fields, @@ -124,9 +122,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -172,9 +168,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -205,9 +199,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,9 +234,7 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}/recreate" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate", body=maybe_transform( { "fields": fields, @@ -290,9 +280,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", body=maybe_transform( { "fields": fields, @@ -358,9 +346,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", body=await async_maybe_transform( { "fields": fields, @@ -404,9 +390,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -452,9 +436,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,9 +467,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -522,9 +502,7 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}/recreate" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate", body=await async_maybe_transform( { "fields": fields, @@ -570,9 +548,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", body=await async_maybe_transform( { "fields": fields, diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index cd7d3047..d8c41393 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -108,9 +108,7 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -150,9 +148,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets", page=SyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, @@ -200,9 +196,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -272,9 +266,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -314,9 +306,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets", page=AsyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, @@ -364,9 +354,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/cors.py b/src/gcore/resources/storage/buckets/cors.py index d00928da..3869e78e 100644 --- a/src/gcore/resources/storage/buckets/cors.py +++ b/src/gcore/resources/storage/buckets/cors.py @@ -74,9 +74,7 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -113,9 +111,7 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -176,9 +172,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=await async_maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -215,9 +209,7 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/lifecycle.py b/src/gcore/resources/storage/buckets/lifecycle.py index 8e7f3d81..a4940ef7 100644 --- a/src/gcore/resources/storage/buckets/lifecycle.py +++ b/src/gcore/resources/storage/buckets/lifecycle.py @@ -78,9 +78,7 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=maybe_transform({"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -117,9 +115,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -185,9 +181,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=await async_maybe_transform( {"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams ), @@ -226,9 +220,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/policy.py b/src/gcore/resources/storage/buckets/policy.py index 7b89c11b..f84d2653 100644 --- a/src/gcore/resources/storage/buckets/policy.py +++ b/src/gcore/resources/storage/buckets/policy.py @@ -71,9 +71,7 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -111,9 +109,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,9 +144,7 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -210,9 +204,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +242,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -287,9 +277,7 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index ef93c1d2..5cc7224a 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -85,9 +85,7 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials", body=maybe_transform( { "delete_sftp_password": delete_sftp_password, @@ -169,9 +167,7 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials", body=await async_maybe_transform( { "delete_sftp_password": delete_sftp_password, diff --git a/src/gcore/resources/storage/locations.py b/src/gcore/resources/storage/locations.py index 9d7c6670..5e2a2d96 100644 --- a/src/gcore/resources/storage/locations.py +++ b/src/gcore/resources/storage/locations.py @@ -69,9 +69,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v2/locations" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v2/locations", + "/storage/provisioning/v2/locations", page=SyncOffsetPage[Location], options=make_request_options( extra_headers=extra_headers, @@ -137,9 +135,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v2/locations" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v2/locations", + "/storage/provisioning/v2/locations", page=AsyncOffsetPage[Location], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/storage/statistics.py b/src/gcore/resources/storage/statistics.py index 334749eb..980c1410 100644 --- a/src/gcore/resources/storage/statistics.py +++ b/src/gcore/resources/storage/statistics.py @@ -82,9 +82,7 @@ def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/total" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total", body=maybe_transform( { "from_": from_, @@ -151,9 +149,7 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/series" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series", body=maybe_transform( { "from_": from_, @@ -233,9 +229,7 @@ async def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/total" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total", body=await async_maybe_transform( { "from_": from_, @@ -302,9 +296,7 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/series" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series", body=await async_maybe_transform( { "from_": from_, diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index e56f0531..9326bb88 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -138,9 +138,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/provisioning/v2/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v2/storage", + "/storage/provisioning/v2/storage", body=maybe_transform( { "location": location, @@ -190,9 +188,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/storage/provisioning/v2/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}", + f"/storage/provisioning/v2/storage/{storage_id}", body=maybe_transform( { "expires": expires, @@ -262,9 +258,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v3/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v3/storage", + "/storage/provisioning/v3/storage", page=SyncOffsetPage[Storage], options=make_request_options( extra_headers=extra_headers, @@ -316,9 +310,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,9 +342,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,9 +377,7 @@ def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -423,9 +411,7 @@ def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -464,9 +450,7 @@ def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -556,9 +540,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/provisioning/v2/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v2/storage", + "/storage/provisioning/v2/storage", body=await async_maybe_transform( { "location": location, @@ -608,9 +590,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/storage/provisioning/v2/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}", + f"/storage/provisioning/v2/storage/{storage_id}", body=await async_maybe_transform( { "expires": expires, @@ -680,9 +660,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v3/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v3/storage", + "/storage/provisioning/v3/storage", page=AsyncOffsetPage[Storage], options=make_request_options( extra_headers=extra_headers, @@ -734,9 +712,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -768,9 +744,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -805,9 +779,7 @@ async def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -841,9 +813,7 @@ async def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -884,9 +854,7 @@ async def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 02cb29a4..0b63144c 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -319,7 +319,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", body=maybe_transform( { "task_name": task_name, @@ -400,7 +400,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", page=SyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -451,9 +451,7 @@ def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/streaming/ai/tasks/{task_id}/cancel" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -520,9 +518,7 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/streaming/ai/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -594,7 +590,7 @@ def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", + "/streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -904,7 +900,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", body=await async_maybe_transform( { "task_name": task_name, @@ -985,7 +981,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", page=AsyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -1036,9 +1032,7 @@ async def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/streaming/ai/tasks/{task_id}/cancel" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1105,9 +1099,7 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/streaming/ai/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1179,7 +1171,7 @@ async def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", + "/streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index 9461d5b2..d8ef434b 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -76,9 +76,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", body=maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -111,9 +109,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", body=maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -150,9 +146,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", page=SyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -189,9 +183,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -222,9 +214,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -255,9 +245,7 @@ def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -318,9 +306,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -353,9 +339,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -392,9 +376,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", page=AsyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -431,9 +413,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -464,9 +444,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,9 +475,7 @@ async def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 345cfc7a..438d9de8 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -72,9 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/directories" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories", + "/streaming/directories", body=maybe_transform( { "name": name, @@ -119,9 +117,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", body=maybe_transform( { "name": name, @@ -167,9 +163,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -202,9 +196,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -227,9 +219,7 @@ def get_tree( directories in video hosting. """ return self._get( - "/streaming/directories/tree" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories/tree", + "/streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -286,9 +276,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/directories" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories", + "/streaming/directories", body=await async_maybe_transform( { "name": name, @@ -333,9 +321,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", body=await async_maybe_transform( { "name": name, @@ -381,9 +367,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -416,9 +400,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,9 +423,7 @@ async def get_tree( directories in video hosting. """ return await self._get( - "/streaming/directories/tree" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories/tree", + "/streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/players.py b/src/gcore/resources/streaming/players.py index 942e32b9..826e015a 100644 --- a/src/gcore/resources/streaming/players.py +++ b/src/gcore/resources/streaming/players.py @@ -72,7 +72,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", body=maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,9 +109,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", body=maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -146,7 +144,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", page=SyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -183,9 +181,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,9 +212,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +244,7 @@ def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - f"/streaming/players/{player_id}/preview" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -309,7 +301,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", body=await async_maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -346,9 +338,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", body=await async_maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -383,7 +373,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", page=AsyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -420,9 +410,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -453,9 +441,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -487,9 +473,7 @@ async def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - f"/streaming/players/{player_id}/preview" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index c9b9c691..fba76526 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -204,9 +204,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", body=maybe_transform( { "active": active, @@ -337,9 +335,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", body=maybe_transform( { "active": active, @@ -392,9 +388,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", page=SyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -431,9 +425,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -464,9 +456,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,9 +487,7 @@ def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}/videos" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -684,9 +672,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", body=await async_maybe_transform( { "active": active, @@ -817,9 +803,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", body=await async_maybe_transform( { "active": active, @@ -872,9 +856,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", page=AsyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -911,9 +893,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -944,9 +924,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -977,9 +955,7 @@ async def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}/videos" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index a80ce0b3..825c12da 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -91,9 +91,7 @@ def list( is a paid feature. """ return self._get( - "/streaming/quality_sets" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets", + "/streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -139,9 +137,7 @@ def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - "/streaming/quality_sets/default" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets/default", + "/streaming/quality_sets/default", body=maybe_transform( { "live": live, @@ -226,9 +222,7 @@ async def list( is a paid feature. """ return await self._get( - "/streaming/quality_sets" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets", + "/streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -274,9 +268,7 @@ async def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - "/streaming/quality_sets/default" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets/default", + "/streaming/quality_sets/default", body=await async_maybe_transform( { "live": live, diff --git a/src/gcore/resources/streaming/restreams.py b/src/gcore/resources/streaming/restreams.py index 1d703166..78880ed4 100644 --- a/src/gcore/resources/streaming/restreams.py +++ b/src/gcore/resources/streaming/restreams.py @@ -67,9 +67,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", body=maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -102,9 +100,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", body=maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -139,9 +135,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", page=SyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -178,9 +172,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +203,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -266,9 +256,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", body=await async_maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -301,9 +289,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", body=await async_maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -338,9 +324,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", page=AsyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -377,9 +361,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -410,9 +392,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 2b5e440d..4e8cb182 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -123,9 +123,7 @@ def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/ffprobe" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -190,9 +188,7 @@ def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -258,9 +254,7 @@ def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -321,9 +315,7 @@ def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -376,9 +368,7 @@ def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/max_stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/max_stream", + "/streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -431,9 +421,7 @@ def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/popular" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/popular", + "/streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -484,9 +472,7 @@ def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/storage", + "/streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -538,9 +524,7 @@ def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream", + "/streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -613,9 +597,7 @@ def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/uniqs", + "/streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -702,9 +684,7 @@ def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/cdn/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -778,9 +758,7 @@ def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/views" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/views", + "/streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -837,9 +815,7 @@ def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/browsers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/browsers", + "/streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -890,9 +866,7 @@ def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/countries", + "/streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -943,9 +917,7 @@ def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/hosts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/hosts", + "/streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -996,9 +968,7 @@ def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/systems" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/systems", + "/streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1049,9 +1019,7 @@ def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/embeds" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/embeds", + "/streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1102,9 +1070,7 @@ def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/regions", + "/streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1164,9 +1130,7 @@ def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/heatmap" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/heatmap", + "/streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1216,9 +1180,7 @@ def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/storage_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1266,9 +1228,7 @@ def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/transcoding_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1329,9 +1289,7 @@ def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1397,9 +1355,7 @@ def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1460,9 +1416,7 @@ def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1539,9 +1493,7 @@ async def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/ffprobe" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1606,9 +1558,7 @@ async def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1674,9 +1624,7 @@ async def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1737,9 +1685,7 @@ async def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1792,9 +1738,7 @@ async def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/max_stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/max_stream", + "/streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1847,9 +1791,7 @@ async def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/popular" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/popular", + "/streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1900,9 +1842,7 @@ async def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/storage", + "/streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1954,9 +1894,7 @@ async def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream", + "/streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2029,9 +1967,7 @@ async def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/uniqs", + "/streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2118,9 +2054,7 @@ async def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/cdn/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2194,9 +2128,7 @@ async def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/views" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/views", + "/streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2253,9 +2185,7 @@ async def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/browsers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/browsers", + "/streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2306,9 +2236,7 @@ async def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/countries", + "/streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2359,9 +2287,7 @@ async def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/hosts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/hosts", + "/streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2412,9 +2338,7 @@ async def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/systems" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/systems", + "/streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2465,9 +2389,7 @@ async def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/embeds" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/embeds", + "/streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2518,9 +2440,7 @@ async def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/regions", + "/streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2580,9 +2500,7 @@ async def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/heatmap" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/heatmap", + "/streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2632,9 +2550,7 @@ async def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/storage_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2682,9 +2598,7 @@ async def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/transcoding_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2745,9 +2659,7 @@ async def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2813,9 +2725,7 @@ async def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2876,9 +2786,7 @@ async def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index 58dfaf62..f52cfee4 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -123,9 +123,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -177,9 +175,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", body=maybe_transform( { "height": height, @@ -221,9 +217,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -256,9 +250,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -290,9 +282,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -324,9 +314,7 @@ def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -432,9 +420,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -486,9 +472,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", body=await async_maybe_transform( { "height": height, @@ -530,9 +514,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -565,9 +547,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -599,9 +579,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -633,9 +611,7 @@ async def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 06bc5dcc..30c0c23b 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -232,7 +232,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", body=maybe_transform( { "name": name, @@ -285,9 +285,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", body=maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -326,7 +324,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", page=SyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -385,9 +383,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -419,9 +415,7 @@ def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,9 +523,7 @@ def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", body=maybe_transform( { "duration": duration, @@ -571,9 +563,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -622,9 +612,7 @@ def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -692,9 +680,7 @@ def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/start_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -731,9 +717,7 @@ def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/stop_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -931,7 +915,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", body=await async_maybe_transform( { "name": name, @@ -984,9 +968,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", body=await async_maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1025,7 +1007,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", page=AsyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -1084,9 +1066,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1118,9 +1098,7 @@ async def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1228,9 +1206,7 @@ async def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", body=await async_maybe_transform( { "duration": duration, @@ -1270,9 +1246,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1321,9 +1295,7 @@ async def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1391,9 +1363,7 @@ async def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/start_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1430,9 +1400,7 @@ async def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/stop_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 165594a4..4e59615e 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -120,9 +120,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", body=maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -172,9 +170,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", body=maybe_transform( { "language": language, @@ -213,9 +209,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -248,9 +242,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -282,9 +274,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -389,9 +379,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", body=await async_maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -441,9 +429,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", body=await async_maybe_transform( { "language": language, @@ -482,9 +468,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,9 +501,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -551,9 +533,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index 3b1cfbef..c77320db 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -148,7 +148,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", body=maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -371,9 +371,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", body=maybe_transform( { "name": name, @@ -469,7 +467,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", page=SyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -526,9 +524,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -579,9 +575,7 @@ def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos/batch" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/batch", + "/streaming/videos/batch", body=maybe_transform({"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, @@ -631,9 +625,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -693,9 +685,7 @@ def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -729,9 +719,7 @@ def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - "/streaming/videos/names" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/names", + "/streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -848,7 +836,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", body=await async_maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1071,9 +1059,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", body=await async_maybe_transform( { "name": name, @@ -1169,7 +1155,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", page=AsyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -1226,9 +1212,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1279,9 +1263,7 @@ async def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos/batch" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/batch", + "/streaming/videos/batch", body=await async_maybe_transform( {"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams ), @@ -1335,9 +1317,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1397,9 +1377,7 @@ async def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1433,9 +1411,7 @@ async def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - "/streaming/videos/names" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/names", + "/streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py index 96f15cca..30c32c1c 100644 --- a/src/gcore/resources/waap/advanced_rules.py +++ b/src/gcore/resources/waap/advanced_rules.py @@ -51,9 +51,7 @@ def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return self._get( - "/waap/v1/advanced-rules/descriptor" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -93,9 +91,7 @@ async def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return await self._get( - "/waap/v1/advanced-rules/descriptor" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index 9be46769..7ce6dca4 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -88,9 +88,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", body=maybe_transform( { "name": name, @@ -154,9 +152,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", body=maybe_transform( { "block": block, @@ -214,9 +210,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", page=SyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -264,9 +258,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -299,9 +291,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -359,9 +349,7 @@ def preview( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/preview-custom-page" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page", body=maybe_transform( { "error": error, @@ -442,9 +430,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", body=await async_maybe_transform( { "name": name, @@ -508,9 +494,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", body=await async_maybe_transform( { "block": block, @@ -568,9 +552,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", page=AsyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -618,9 +600,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -653,9 +633,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -713,9 +691,7 @@ async def preview( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/preview-custom-page" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page", body=await async_maybe_transform( { "error": error, diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index 6afde6d6..e22a838f 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -97,9 +97,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", body=maybe_transform( { "action": action, @@ -173,9 +171,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -265,9 +261,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", page=SyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -321,9 +315,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -359,9 +351,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -403,9 +393,7 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,9 +473,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", body=await async_maybe_transform( { "action": action, @@ -561,9 +547,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -653,9 +637,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", page=AsyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -709,9 +691,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -747,9 +727,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -791,9 +769,7 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py index ccd8a883..6b1f7896 100644 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -82,9 +82,7 @@ def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -117,9 +115,7 @@ def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -184,9 +180,7 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", page=SyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -237,9 +231,7 @@ def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -289,9 +281,7 @@ def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", body=maybe_transform( { "description_file_location": description_file_location, @@ -344,9 +334,7 @@ def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload", body=maybe_transform( { "file_data": file_data, @@ -412,9 +400,7 @@ async def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -447,9 +433,7 @@ async def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -514,9 +498,7 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", page=AsyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -567,9 +549,7 @@ async def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -619,9 +599,7 @@ async def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", body=await async_maybe_transform( { "description_file_location": description_file_location, @@ -674,9 +652,7 @@ async def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload", body=await async_maybe_transform( { "file_data": file_data, diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py index cf0c40e5..3e66ea27 100644 --- a/src/gcore/resources/waap/domains/api_path_groups.py +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -65,9 +65,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -121,9 +119,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index d372c33b..fc1dd68c 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -90,9 +90,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", body=maybe_transform( { "http_scheme": http_scheme, @@ -155,9 +153,7 @@ def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", body=maybe_transform( { "api_groups": api_groups, @@ -254,9 +250,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", page=SyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -315,9 +309,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -355,9 +347,7 @@ def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -430,9 +420,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", body=await async_maybe_transform( { "http_scheme": http_scheme, @@ -495,9 +483,7 @@ async def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", body=await async_maybe_transform( { "api_groups": api_groups, @@ -594,9 +580,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", page=AsyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -655,9 +639,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -695,9 +677,7 @@ async def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index adc81b2b..f175a192 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -92,9 +92,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", body=maybe_transform( { "action": action, @@ -157,9 +155,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -229,9 +225,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", page=SyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -284,9 +278,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -323,9 +315,7 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -364,9 +354,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -408,9 +396,7 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -480,9 +466,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", body=await async_maybe_transform( { "action": action, @@ -545,9 +529,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -617,9 +599,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", page=AsyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -672,9 +652,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -711,9 +689,7 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -752,9 +728,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -796,9 +770,7 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index 6e0e3bac..cf4135cc 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -198,9 +198,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", body=maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -250,7 +248,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", + "/waap/v1/domains", page=SyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -301,9 +299,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -336,9 +332,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -371,9 +365,7 @@ def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/rule-sets" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -411,9 +403,7 @@ def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -511,9 +501,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", body=await async_maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -563,7 +551,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", + "/waap/v1/domains", page=AsyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -614,9 +602,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -649,9 +635,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -684,9 +668,7 @@ async def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/rule-sets" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -724,9 +706,7 @@ async def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index bf624cf0..b8600359 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -91,9 +91,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", body=maybe_transform( { "action": action, @@ -155,9 +153,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -227,9 +223,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", page=SyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -282,9 +276,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -321,9 +313,7 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -362,9 +352,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -406,9 +394,7 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -477,9 +463,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", body=await async_maybe_transform( { "action": action, @@ -541,9 +525,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -613,9 +595,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", page=AsyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -668,9 +648,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -707,9 +685,7 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -748,9 +724,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -792,9 +766,7 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 98372746..577332e9 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -93,9 +93,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", body=maybe_transform( { "author": author, @@ -155,9 +153,7 @@ def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=maybe_transform( { "author": author, @@ -232,9 +228,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", page=SyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -289,9 +283,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -329,9 +321,7 @@ def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,9 +392,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", body=await async_maybe_transform( { "author": author, @@ -464,9 +452,7 @@ async def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=await async_maybe_transform( { "author": author, @@ -541,9 +527,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", page=AsyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -598,9 +582,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -638,9 +620,7 @@ async def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 7633f059..8fb4ab52 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -106,9 +106,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights", page=SyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -160,9 +158,7 @@ def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,9 +199,7 @@ def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", body=maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -295,9 +289,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights", page=AsyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -349,9 +341,7 @@ async def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,9 +382,7 @@ async def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", body=await async_maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py index 17c719c1..fc9cafbf 100644 --- a/src/gcore/resources/waap/domains/settings.py +++ b/src/gcore/resources/waap/domains/settings.py @@ -74,9 +74,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", body=maybe_transform( { "api": api, @@ -116,9 +114,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -179,9 +175,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", body=await async_maybe_transform( { "api": api, @@ -221,9 +215,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index 517d55f6..f23b048b 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -98,9 +98,7 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks", page=SyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -163,9 +161,7 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info", page=SyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -231,9 +227,7 @@ def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/stats" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -286,9 +280,7 @@ def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,9 +374,7 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests", page=SyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -450,9 +440,7 @@ def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/traffic" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -532,9 +520,7 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks", page=AsyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -597,9 +583,7 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info", page=AsyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -665,9 +649,7 @@ async def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/stats" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -720,9 +702,7 @@ async def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -816,9 +796,7 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests", page=AsyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -884,9 +862,7 @@ async def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/traffic" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index 0634ffef..e056e67a 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -88,9 +88,7 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/security-insights/types", + "/waap/v1/security-insights/types", page=SyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, @@ -176,9 +174,7 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/security-insights/types", + "/waap/v1/security-insights/types", page=AsyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/ip_info/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py index e1a6fa7c..e721bf7d 100644 --- a/src/gcore/resources/waap/ip_info/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -95,9 +95,7 @@ def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-time-series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -144,9 +142,7 @@ def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/blocked-requests" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -193,9 +189,7 @@ def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ddos" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -235,9 +229,7 @@ def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ip-info" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -282,9 +274,7 @@ def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-urls" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -333,9 +323,7 @@ def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-user-agents" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -384,9 +372,7 @@ def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-sessions" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -429,9 +415,7 @@ def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-map" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -495,9 +479,7 @@ async def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-time-series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -544,9 +526,7 @@ async def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/blocked-requests" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -593,9 +573,7 @@ async def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ddos" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -635,9 +613,7 @@ async def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ip-info" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -682,9 +658,7 @@ async def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-urls" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -733,9 +707,7 @@ async def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-user-agents" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -784,9 +756,7 @@ async def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-sessions" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -829,9 +799,7 @@ async def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-map" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/ip_info/metrics.py b/src/gcore/resources/waap/ip_info/metrics.py index 32f17c80..c70d3faa 100644 --- a/src/gcore/resources/waap/ip_info/metrics.py +++ b/src/gcore/resources/waap/ip_info/metrics.py @@ -77,9 +77,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/counts" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -151,9 +149,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/counts" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py index ffe33962..f36dcb35 100644 --- a/src/gcore/resources/waap/organizations.py +++ b/src/gcore/resources/waap/organizations.py @@ -82,9 +82,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/organizations", + "/waap/v1/organizations", page=SyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, @@ -162,9 +160,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/organizations", + "/waap/v1/organizations", page=AsyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py index 5f64899e..f8258bab 100644 --- a/src/gcore/resources/waap/statistics.py +++ b/src/gcore/resources/waap/statistics.py @@ -87,9 +87,7 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/statistics/series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/statistics/series", + "/waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -171,9 +169,7 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/statistics/series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/statistics/series", + "/waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py index f2ced3d7..df171560 100644 --- a/src/gcore/resources/waap/tags.py +++ b/src/gcore/resources/waap/tags.py @@ -88,7 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", + "/waap/v1/tags", page=SyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", + "/waap/v1/tags", page=AsyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index 4f621d4e..3d68c41f 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -147,7 +147,7 @@ def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return self._get( - "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", + "/waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -219,7 +219,7 @@ async def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return await self._get( - "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", + "/waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), From b2d70cb6c3dc628f94a81c8afb19d654dedec6b2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 15 Sep 2025 10:11:08 +0000 Subject: [PATCH 311/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a8e94942..710ee8c8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-41a0bfcc37b5bb42a72fc8a83fd2206024930816e6ae11496b66be03436db20c.yml -openapi_spec_hash: 6d1a8bbafd395b9cb8caa31890a4b0bc +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-895dff64a4fa6d606c244d55ff0e53446c580eaa1df3b1589a2d5087ebebaf49.yml +openapi_spec_hash: d8c1b66c7165f1f896dfd0ddeb8f9d3e config_hash: 28b1157595821f9f0eb3e9f3ea690703 From b78048e326359f6b983bbddbcf35fcf2862e842a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 04:04:22 +0000 Subject: [PATCH 312/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 710ee8c8..4957dddd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-895dff64a4fa6d606c244d55ff0e53446c580eaa1df3b1589a2d5087ebebaf49.yml openapi_spec_hash: d8c1b66c7165f1f896dfd0ddeb8f9d3e -config_hash: 28b1157595821f9f0eb3e9f3ea690703 +config_hash: 028fbcd5b4de4521ae051c04cf50d217 From a5f8938a5f80a514c5267164d2f4b991153e1d68 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 04:25:52 +0000 Subject: [PATCH 313/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 4957dddd..8e0edbcc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-895dff64a4fa6d606c244d55ff0e53446c580eaa1df3b1589a2d5087ebebaf49.yml openapi_spec_hash: d8c1b66c7165f1f896dfd0ddeb8f9d3e -config_hash: 028fbcd5b4de4521ae051c04cf50d217 +config_hash: 54cc733438deaab24435d7c4226f02d7 From 0ea14fd54d5e7da8280e2fa3f32ffd1c09050c9f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 06:13:14 +0000 Subject: [PATCH 314/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8e0edbcc..f153347f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-895dff64a4fa6d606c244d55ff0e53446c580eaa1df3b1589a2d5087ebebaf49.yml -openapi_spec_hash: d8c1b66c7165f1f896dfd0ddeb8f9d3e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e7516303f903fe1c8f61ff65cf87e17eab9417800b0592277e00aaeac8c8a658.yml +openapi_spec_hash: f4070c11c3c295565ec28aea7f8f6058 config_hash: 54cc733438deaab24435d7c4226f02d7 From 57a98344b21720e5f91ad2acd6155feb1e4893b8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 08:03:17 +0000 Subject: [PATCH 315/592] feat(api): aggregated API specs update --- .stats.yml | 6 +- api.md | 2 - src/gcore/resources/dns/zones/zones.py | 83 ------------------- src/gcore/types/dns/__init__.py | 4 - src/gcore/types/dns/dns_name_server.py | 17 ---- .../zone_check_delegation_status_response.py | 20 ----- tests/api_resources/dns/test_zones.py | 77 ----------------- 7 files changed, 3 insertions(+), 206 deletions(-) delete mode 100644 src/gcore/types/dns/dns_name_server.py delete mode 100644 src/gcore/types/dns/zone_check_delegation_status_response.py diff --git a/.stats.yml b/.stats.yml index f153347f..28c67d19 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 523 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e7516303f903fe1c8f61ff65cf87e17eab9417800b0592277e00aaeac8c8a658.yml -openapi_spec_hash: f4070c11c3c295565ec28aea7f8f6058 +configured_endpoints: 522 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3721d496395e684887e9ba0386375910a4fe68253893ccfce4e79c2e8a5b84af.yml +openapi_spec_hash: f95b9f70ed1b3b8230ef3a092c6acedd config_hash: 54cc733438deaab24435d7c4226f02d7 diff --git a/api.md b/api.md index 813dbe4c..8bddc6dc 100644 --- a/api.md +++ b/api.md @@ -1920,7 +1920,6 @@ from gcore.types.dns import ( DNSNameServer, ZoneCreateResponse, ZoneListResponse, - ZoneCheckDelegationStatusResponse, ZoneExportResponse, ZoneGetResponse, ZoneGetStatisticsResponse, @@ -1933,7 +1932,6 @@ Methods: - client.dns.zones.create(\*\*params) -> ZoneCreateResponse - client.dns.zones.list(\*\*params) -> ZoneListResponse - client.dns.zones.delete(name) -> object -- client.dns.zones.check_delegation_status(name) -> ZoneCheckDelegationStatusResponse - client.dns.zones.disable(name) -> object - client.dns.zones.enable(name) -> object - client.dns.zones.export(zone_name) -> ZoneExportResponse diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 75e11dde..e5ab591d 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -48,7 +48,6 @@ from ....types.dns.zone_export_response import ZoneExportResponse from ....types.dns.zone_import_response import ZoneImportResponse from ....types.dns.zone_get_statistics_response import ZoneGetStatisticsResponse -from ....types.dns.zone_check_delegation_status_response import ZoneCheckDelegationStatusResponse __all__ = ["ZonesResource", "AsyncZonesResource"] @@ -290,41 +289,6 @@ def delete( cast_to=object, ) - def check_delegation_status( - 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, - ) -> ZoneCheckDelegationStatusResponse: - """Returns delegation status for specified domain name. - - This endpoint has rate - limit. - - 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._post( - f"/dns/v2/analyze/{name}/delegation-status", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ZoneCheckDelegationStatusResponse, - ) - def disable( self, name: str, @@ -916,41 +880,6 @@ async def delete( cast_to=object, ) - async def check_delegation_status( - 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, - ) -> ZoneCheckDelegationStatusResponse: - """Returns delegation status for specified domain name. - - This endpoint has rate - limit. - - 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._post( - f"/dns/v2/analyze/{name}/delegation-status", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ZoneCheckDelegationStatusResponse, - ) - async def disable( self, name: str, @@ -1318,9 +1247,6 @@ def __init__(self, zones: ZonesResource) -> None: self.delete = to_raw_response_wrapper( zones.delete, ) - self.check_delegation_status = to_raw_response_wrapper( - zones.check_delegation_status, - ) self.disable = to_raw_response_wrapper( zones.disable, ) @@ -1365,9 +1291,6 @@ def __init__(self, zones: AsyncZonesResource) -> None: self.delete = async_to_raw_response_wrapper( zones.delete, ) - self.check_delegation_status = async_to_raw_response_wrapper( - zones.check_delegation_status, - ) self.disable = async_to_raw_response_wrapper( zones.disable, ) @@ -1412,9 +1335,6 @@ def __init__(self, zones: ZonesResource) -> None: self.delete = to_streamed_response_wrapper( zones.delete, ) - self.check_delegation_status = to_streamed_response_wrapper( - zones.check_delegation_status, - ) self.disable = to_streamed_response_wrapper( zones.disable, ) @@ -1459,9 +1379,6 @@ def __init__(self, zones: AsyncZonesResource) -> None: self.delete = async_to_streamed_response_wrapper( zones.delete, ) - self.check_delegation_status = async_to_streamed_response_wrapper( - zones.check_delegation_status, - ) self.disable = async_to_streamed_response_wrapper( zones.disable, ) diff --git a/src/gcore/types/dns/__init__.py b/src/gcore/types/dns/__init__.py index f72384a3..e41ca78e 100644 --- a/src/gcore/types/dns/__init__.py +++ b/src/gcore/types/dns/__init__.py @@ -3,7 +3,6 @@ from __future__ import annotations from .dns_label_name import DNSLabelName as DNSLabelName -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 .zone_get_response import ZoneGetResponse as ZoneGetResponse @@ -26,6 +25,3 @@ 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 -from .zone_check_delegation_status_response import ( - ZoneCheckDelegationStatusResponse as ZoneCheckDelegationStatusResponse, -) diff --git a/src/gcore/types/dns/dns_name_server.py b/src/gcore/types/dns/dns_name_server.py deleted file mode 100644 index 619c4943..00000000 --- a/src/gcore/types/dns/dns_name_server.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["DNSNameServer"] - - -class DNSNameServer(BaseModel): - ipv4_addresses: Optional[List[str]] = FieldInfo(alias="ipv4Addresses", default=None) - - ipv6_addresses: Optional[List[str]] = FieldInfo(alias="ipv6Addresses", default=None) - - name: Optional[str] = None diff --git a/src/gcore/types/dns/zone_check_delegation_status_response.py b/src/gcore/types/dns/zone_check_delegation_status_response.py deleted file mode 100644 index ae89139a..00000000 --- a/src/gcore/types/dns/zone_check_delegation_status_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel -from .dns_name_server import DNSNameServer - -__all__ = ["ZoneCheckDelegationStatusResponse"] - - -class ZoneCheckDelegationStatusResponse(BaseModel): - authoritative_name_servers: Optional[List[DNSNameServer]] = None - - gcore_authorized_count: Optional[int] = None - - is_whitelabel_delegation: Optional[bool] = None - - non_gcore_authorized_count: Optional[int] = None - - zone_exists: Optional[bool] = None diff --git a/tests/api_resources/dns/test_zones.py b/tests/api_resources/dns/test_zones.py index cdb8d744..466834c7 100644 --- a/tests/api_resources/dns/test_zones.py +++ b/tests/api_resources/dns/test_zones.py @@ -17,7 +17,6 @@ ZoneExportResponse, ZoneImportResponse, ZoneGetStatisticsResponse, - ZoneCheckDelegationStatusResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -159,44 +158,6 @@ def test_path_params_delete(self, client: Gcore) -> None: "", ) - @parametrize - def test_method_check_delegation_status(self, client: Gcore) -> None: - zone = client.dns.zones.check_delegation_status( - "name", - ) - assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) - - @parametrize - def test_raw_response_check_delegation_status(self, client: Gcore) -> None: - response = client.dns.zones.with_raw_response.check_delegation_status( - "name", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - zone = response.parse() - assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) - - @parametrize - def test_streaming_response_check_delegation_status(self, client: Gcore) -> None: - with client.dns.zones.with_streaming_response.check_delegation_status( - "name", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - zone = response.parse() - assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_check_delegation_status(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): - client.dns.zones.with_raw_response.check_delegation_status( - "", - ) - @parametrize def test_method_disable(self, client: Gcore) -> None: zone = client.dns.zones.disable( @@ -642,44 +603,6 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: "", ) - @parametrize - async def test_method_check_delegation_status(self, async_client: AsyncGcore) -> None: - zone = await async_client.dns.zones.check_delegation_status( - "name", - ) - assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) - - @parametrize - async def test_raw_response_check_delegation_status(self, async_client: AsyncGcore) -> None: - response = await async_client.dns.zones.with_raw_response.check_delegation_status( - "name", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - zone = await response.parse() - assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) - - @parametrize - async def test_streaming_response_check_delegation_status(self, async_client: AsyncGcore) -> None: - async with async_client.dns.zones.with_streaming_response.check_delegation_status( - "name", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - zone = await response.parse() - assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_check_delegation_status(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): - await async_client.dns.zones.with_raw_response.check_delegation_status( - "", - ) - @parametrize async def test_method_disable(self, async_client: AsyncGcore) -> None: zone = await async_client.dns.zones.disable( From 52dd8d19fcd19c793d0229cac96e881561721f11 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 08:29:12 +0000 Subject: [PATCH 316/592] feat(cloud): support floating IPs update --- .stats.yml | 4 +- api.md | 1 + src/gcore/resources/cloud/floating_ips.py | 154 +++++++++++++++++- src/gcore/types/cloud/__init__.py | 1 + .../types/cloud/floating_ip_update_params.py | 41 +++++ .../api_resources/cloud/test_floating_ips.py | 112 +++++++++++++ 6 files changed, 310 insertions(+), 3 deletions(-) create mode 100644 src/gcore/types/cloud/floating_ip_update_params.py diff --git a/.stats.yml b/.stats.yml index 28c67d19..e7c17a4a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 522 +configured_endpoints: 523 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3721d496395e684887e9ba0386375910a4fe68253893ccfce4e79c2e8a5b84af.yml openapi_spec_hash: f95b9f70ed1b3b8230ef3a092c6acedd -config_hash: 54cc733438deaab24435d7c4226f02d7 +config_hash: b0843ba896a2b11b93b1e2f7088fd0c6 diff --git a/api.md b/api.md index 8bddc6dc..1488d6ea 100644 --- a/api.md +++ b/api.md @@ -397,6 +397,7 @@ from gcore.types.cloud import FloatingIPDetailed Methods: - client.cloud.floating_ips.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.floating_ips.update(floating_ip_id, \*, project_id, region_id, \*\*params) -> FloatingIP - client.cloud.floating_ips.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[FloatingIPDetailed] - client.cloud.floating_ips.delete(floating_ip_id, \*, project_id, region_id) -> TaskIDList - client.cloud.floating_ips.assign(floating_ip_id, \*, project_id, region_id, \*\*params) -> FloatingIP diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index d96ef242..65a07509 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -17,11 +17,17 @@ async_to_streamed_response_wrapper, ) from ...pagination import SyncOffsetPage, AsyncOffsetPage -from ...types.cloud import floating_ip_list_params, floating_ip_assign_params, floating_ip_create_params +from ...types.cloud import ( + floating_ip_list_params, + floating_ip_assign_params, + floating_ip_create_params, + floating_ip_update_params, +) from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.floating_ip import FloatingIP from ...types.cloud.task_id_list import TaskIDList from ...types.cloud.floating_ip_detailed import FloatingIPDetailed +from ...types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["FloatingIPsResource", "AsyncFloatingIPsResource"] @@ -109,6 +115,73 @@ def create( cast_to=TaskIDList, ) + def update( + self, + floating_ip_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FloatingIP: + """ + Update floating IP + + Args: + project_id: Project ID + + region_id: Region ID + + floating_ip_id: Floating IP ID + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not floating_ip_id: + raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") + return self._patch( + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + body=maybe_transform({"tags": tags}, floating_ip_update_params.FloatingIPUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FloatingIP, + ) + def list( self, *, @@ -440,6 +513,73 @@ async def create( cast_to=TaskIDList, ) + async def update( + self, + floating_ip_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FloatingIP: + """ + Update floating IP + + Args: + project_id: Project ID + + region_id: Region ID + + floating_ip_id: Floating IP ID + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not floating_ip_id: + raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") + return await self._patch( + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + body=await async_maybe_transform({"tags": tags}, floating_ip_update_params.FloatingIPUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FloatingIP, + ) + def list( self, *, @@ -695,6 +835,9 @@ def __init__(self, floating_ips: FloatingIPsResource) -> None: self.create = to_raw_response_wrapper( floating_ips.create, ) + self.update = to_raw_response_wrapper( + floating_ips.update, + ) self.list = to_raw_response_wrapper( floating_ips.list, ) @@ -719,6 +862,9 @@ def __init__(self, floating_ips: AsyncFloatingIPsResource) -> None: self.create = async_to_raw_response_wrapper( floating_ips.create, ) + self.update = async_to_raw_response_wrapper( + floating_ips.update, + ) self.list = async_to_raw_response_wrapper( floating_ips.list, ) @@ -743,6 +889,9 @@ def __init__(self, floating_ips: FloatingIPsResource) -> None: self.create = to_streamed_response_wrapper( floating_ips.create, ) + self.update = to_streamed_response_wrapper( + floating_ips.update, + ) self.list = to_streamed_response_wrapper( floating_ips.list, ) @@ -767,6 +916,9 @@ def __init__(self, floating_ips: AsyncFloatingIPsResource) -> None: self.create = async_to_streamed_response_wrapper( floating_ips.create, ) + self.update = async_to_streamed_response_wrapper( + floating_ips.update, + ) self.list = async_to_streamed_response_wrapper( floating_ips.list, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 586c4473..21972950 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -122,6 +122,7 @@ from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams +from .floating_ip_update_params import FloatingIPUpdateParams as FloatingIPUpdateParams from .inference_region_capacity import InferenceRegionCapacity as InferenceRegionCapacity from .load_balancer_flavor_list import LoadBalancerFlavorList as LoadBalancerFlavorList from .load_balancer_list_params import LoadBalancerListParams as LoadBalancerListParams diff --git a/src/gcore/types/cloud/floating_ip_update_params.py b/src/gcore/types/cloud/floating_ip_update_params.py new file mode 100644 index 00000000..79377f4b --- /dev/null +++ b/src/gcore/types/cloud/floating_ip_update_params.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +from .tag_update_map_param import TagUpdateMapParam + +__all__ = ["FloatingIPUpdateParams"] + + +class FloatingIPUpdateParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + tags: Optional[TagUpdateMapParam] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index 70598a35..4b31820b 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -67,6 +67,62 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_update(self, client: Gcore) -> None: + floating_ip = client.cloud.floating_ips.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + floating_ip = client.cloud.floating_ips.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.floating_ips.with_raw_response.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.floating_ips.with_streaming_response.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + client.cloud.floating_ips.with_raw_response.update( + floating_ip_id="", + project_id=1, + region_id=1, + ) + @parametrize def test_method_list(self, client: Gcore) -> None: floating_ip = client.cloud.floating_ips.list( @@ -363,6 +419,62 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + floating_ip = await async_client.cloud.floating_ips.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + floating_ip = await async_client.cloud.floating_ips.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.floating_ips.with_raw_response.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + floating_ip = await response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.floating_ips.with_streaming_response.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + floating_ip = await response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + await async_client.cloud.floating_ips.with_raw_response.update( + floating_ip_id="", + project_id=1, + region_id=1, + ) + @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: floating_ip = await async_client.cloud.floating_ips.list( From 5066cabcf3fc05bef385c48182ef112e8ad2bc71 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 13:15:37 +0000 Subject: [PATCH 317/592] feat(dns): replace post with get in check delegation status --- .stats.yml | 4 +- api.md | 2 + src/gcore/resources/dns/zones/zones.py | 83 +++++++++++++++++++ src/gcore/types/dns/__init__.py | 4 + src/gcore/types/dns/dns_name_server.py | 17 ++++ .../zone_check_delegation_status_response.py | 20 +++++ tests/api_resources/dns/test_zones.py | 77 +++++++++++++++++ 7 files changed, 205 insertions(+), 2 deletions(-) create mode 100644 src/gcore/types/dns/dns_name_server.py create mode 100644 src/gcore/types/dns/zone_check_delegation_status_response.py diff --git a/.stats.yml b/.stats.yml index e7c17a4a..8d64ea87 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 523 +configured_endpoints: 524 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3721d496395e684887e9ba0386375910a4fe68253893ccfce4e79c2e8a5b84af.yml openapi_spec_hash: f95b9f70ed1b3b8230ef3a092c6acedd -config_hash: b0843ba896a2b11b93b1e2f7088fd0c6 +config_hash: bfac9dcd59fec1e54559dc11fcba758e diff --git a/api.md b/api.md index 1488d6ea..56d6038b 100644 --- a/api.md +++ b/api.md @@ -1921,6 +1921,7 @@ from gcore.types.dns import ( DNSNameServer, ZoneCreateResponse, ZoneListResponse, + ZoneCheckDelegationStatusResponse, ZoneExportResponse, ZoneGetResponse, ZoneGetStatisticsResponse, @@ -1933,6 +1934,7 @@ Methods: - client.dns.zones.create(\*\*params) -> ZoneCreateResponse - client.dns.zones.list(\*\*params) -> ZoneListResponse - client.dns.zones.delete(name) -> object +- client.dns.zones.check_delegation_status(name) -> ZoneCheckDelegationStatusResponse - client.dns.zones.disable(name) -> object - client.dns.zones.enable(name) -> object - client.dns.zones.export(zone_name) -> ZoneExportResponse diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index e5ab591d..2bef8d84 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -48,6 +48,7 @@ from ....types.dns.zone_export_response import ZoneExportResponse from ....types.dns.zone_import_response import ZoneImportResponse from ....types.dns.zone_get_statistics_response import ZoneGetStatisticsResponse +from ....types.dns.zone_check_delegation_status_response import ZoneCheckDelegationStatusResponse __all__ = ["ZonesResource", "AsyncZonesResource"] @@ -289,6 +290,41 @@ def delete( cast_to=object, ) + def check_delegation_status( + 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, + ) -> ZoneCheckDelegationStatusResponse: + """Returns delegation status for specified domain name. + + This endpoint has rate + limit. + + 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/analyze/{name}/delegation-status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ZoneCheckDelegationStatusResponse, + ) + def disable( self, name: str, @@ -880,6 +916,41 @@ async def delete( cast_to=object, ) + async def check_delegation_status( + 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, + ) -> ZoneCheckDelegationStatusResponse: + """Returns delegation status for specified domain name. + + This endpoint has rate + limit. + + 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/analyze/{name}/delegation-status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ZoneCheckDelegationStatusResponse, + ) + async def disable( self, name: str, @@ -1247,6 +1318,9 @@ def __init__(self, zones: ZonesResource) -> None: self.delete = to_raw_response_wrapper( zones.delete, ) + self.check_delegation_status = to_raw_response_wrapper( + zones.check_delegation_status, + ) self.disable = to_raw_response_wrapper( zones.disable, ) @@ -1291,6 +1365,9 @@ def __init__(self, zones: AsyncZonesResource) -> None: self.delete = async_to_raw_response_wrapper( zones.delete, ) + self.check_delegation_status = async_to_raw_response_wrapper( + zones.check_delegation_status, + ) self.disable = async_to_raw_response_wrapper( zones.disable, ) @@ -1335,6 +1412,9 @@ def __init__(self, zones: ZonesResource) -> None: self.delete = to_streamed_response_wrapper( zones.delete, ) + self.check_delegation_status = to_streamed_response_wrapper( + zones.check_delegation_status, + ) self.disable = to_streamed_response_wrapper( zones.disable, ) @@ -1379,6 +1459,9 @@ def __init__(self, zones: AsyncZonesResource) -> None: self.delete = async_to_streamed_response_wrapper( zones.delete, ) + self.check_delegation_status = async_to_streamed_response_wrapper( + zones.check_delegation_status, + ) self.disable = async_to_streamed_response_wrapper( zones.disable, ) diff --git a/src/gcore/types/dns/__init__.py b/src/gcore/types/dns/__init__.py index e41ca78e..f72384a3 100644 --- a/src/gcore/types/dns/__init__.py +++ b/src/gcore/types/dns/__init__.py @@ -3,6 +3,7 @@ from __future__ import annotations from .dns_label_name import DNSLabelName as DNSLabelName +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 .zone_get_response import ZoneGetResponse as ZoneGetResponse @@ -25,3 +26,6 @@ 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 +from .zone_check_delegation_status_response import ( + ZoneCheckDelegationStatusResponse as ZoneCheckDelegationStatusResponse, +) diff --git a/src/gcore/types/dns/dns_name_server.py b/src/gcore/types/dns/dns_name_server.py new file mode 100644 index 00000000..619c4943 --- /dev/null +++ b/src/gcore/types/dns/dns_name_server.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["DNSNameServer"] + + +class DNSNameServer(BaseModel): + ipv4_addresses: Optional[List[str]] = FieldInfo(alias="ipv4Addresses", default=None) + + ipv6_addresses: Optional[List[str]] = FieldInfo(alias="ipv6Addresses", default=None) + + name: Optional[str] = None diff --git a/src/gcore/types/dns/zone_check_delegation_status_response.py b/src/gcore/types/dns/zone_check_delegation_status_response.py new file mode 100644 index 00000000..ae89139a --- /dev/null +++ b/src/gcore/types/dns/zone_check_delegation_status_response.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .dns_name_server import DNSNameServer + +__all__ = ["ZoneCheckDelegationStatusResponse"] + + +class ZoneCheckDelegationStatusResponse(BaseModel): + authoritative_name_servers: Optional[List[DNSNameServer]] = None + + gcore_authorized_count: Optional[int] = None + + is_whitelabel_delegation: Optional[bool] = None + + non_gcore_authorized_count: Optional[int] = None + + zone_exists: Optional[bool] = None diff --git a/tests/api_resources/dns/test_zones.py b/tests/api_resources/dns/test_zones.py index 466834c7..cdb8d744 100644 --- a/tests/api_resources/dns/test_zones.py +++ b/tests/api_resources/dns/test_zones.py @@ -17,6 +17,7 @@ ZoneExportResponse, ZoneImportResponse, ZoneGetStatisticsResponse, + ZoneCheckDelegationStatusResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -158,6 +159,44 @@ def test_path_params_delete(self, client: Gcore) -> None: "", ) + @parametrize + def test_method_check_delegation_status(self, client: Gcore) -> None: + zone = client.dns.zones.check_delegation_status( + "name", + ) + assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) + + @parametrize + def test_raw_response_check_delegation_status(self, client: Gcore) -> None: + response = client.dns.zones.with_raw_response.check_delegation_status( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = response.parse() + assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) + + @parametrize + def test_streaming_response_check_delegation_status(self, client: Gcore) -> None: + with client.dns.zones.with_streaming_response.check_delegation_status( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = response.parse() + assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_check_delegation_status(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + client.dns.zones.with_raw_response.check_delegation_status( + "", + ) + @parametrize def test_method_disable(self, client: Gcore) -> None: zone = client.dns.zones.disable( @@ -603,6 +642,44 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: "", ) + @parametrize + async def test_method_check_delegation_status(self, async_client: AsyncGcore) -> None: + zone = await async_client.dns.zones.check_delegation_status( + "name", + ) + assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) + + @parametrize + async def test_raw_response_check_delegation_status(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.zones.with_raw_response.check_delegation_status( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + zone = await response.parse() + assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) + + @parametrize + async def test_streaming_response_check_delegation_status(self, async_client: AsyncGcore) -> None: + async with async_client.dns.zones.with_streaming_response.check_delegation_status( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + zone = await response.parse() + assert_matches_type(ZoneCheckDelegationStatusResponse, zone, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_check_delegation_status(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + await async_client.dns.zones.with_raw_response.check_delegation_status( + "", + ) + @parametrize async def test_method_disable(self, async_client: AsyncGcore) -> None: zone = await async_client.dns.zones.disable( From 79391d1b2d970a10f5d172d0339260950e3c1349 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 15:18:32 +0000 Subject: [PATCH 318/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a7130553..d52d2b97 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.12.0" + ".": "0.13.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8ab3dc78..fc8fa408 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.12.0" +version = "0.13.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 7f12d5d7..30d62a13 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.12.0" # x-release-please-version +__version__ = "0.13.0" # x-release-please-version From af0b02b3a7194a4c2d533d326bd610a474fc5343 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 16:11:48 +0000 Subject: [PATCH 319/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8d64ea87..4d863aff 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3721d496395e684887e9ba0386375910a4fe68253893ccfce4e79c2e8a5b84af.yml -openapi_spec_hash: f95b9f70ed1b3b8230ef3a092c6acedd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1f1d68f6c5fa67afbf457aab0fb67b8494e97339aed4e7865f0dcc86b56bf522.yml +openapi_spec_hash: 53a6dc99201cbcc637dae930ed4b4e45 config_hash: bfac9dcd59fec1e54559dc11fcba758e From 53a526de2870ef9ed7a8a5f4f5ec2fb6ead773f4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 19:15:31 +0000 Subject: [PATCH 320/592] chore(internal): update pydantic dependency --- requirements-dev.lock | 7 +++++-- requirements.lock | 7 +++++-- src/gcore/_models.py | 14 ++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 235f57cd..8b62e881 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -91,9 +91,9 @@ pluggy==1.5.0 propcache==0.3.1 # via aiohttp # via yarl -pydantic==2.10.3 +pydantic==2.11.9 # via gcore -pydantic-core==2.27.1 +pydantic-core==2.33.2 # via pydantic pygments==2.18.0 # via rich @@ -129,6 +129,9 @@ typing-extensions==4.12.2 # via pydantic # via pydantic-core # via pyright + # via typing-inspection +typing-inspection==0.4.1 + # via pydantic virtualenv==20.24.5 # via nox yarl==1.20.0 diff --git a/requirements.lock b/requirements.lock index db09fdd3..b9e884ce 100644 --- a/requirements.lock +++ b/requirements.lock @@ -55,9 +55,9 @@ multidict==6.4.4 propcache==0.3.1 # via aiohttp # via yarl -pydantic==2.10.3 +pydantic==2.11.9 # via gcore -pydantic-core==2.27.1 +pydantic-core==2.33.2 # via pydantic sniffio==1.3.0 # via anyio @@ -68,5 +68,8 @@ typing-extensions==4.12.2 # via multidict # via pydantic # via pydantic-core + # via typing-inspection +typing-inspection==0.4.1 + # via pydantic yarl==1.20.0 # via aiohttp diff --git a/src/gcore/_models.py b/src/gcore/_models.py index 3a6017ef..6a3cd1d2 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -256,7 +256,7 @@ def model_dump( mode: Literal["json", "python"] | str = "python", include: IncEx | None = None, exclude: IncEx | None = None, - by_alias: bool = False, + by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, @@ -264,6 +264,7 @@ def model_dump( warnings: bool | Literal["none", "warn", "error"] = True, context: dict[str, Any] | None = None, serialize_as_any: bool = False, + fallback: Callable[[Any], Any] | None = None, ) -> dict[str, Any]: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump @@ -295,10 +296,12 @@ def model_dump( raise ValueError("context is only supported in Pydantic v2") if serialize_as_any != False: raise ValueError("serialize_as_any is only supported in Pydantic v2") + if fallback is not None: + raise ValueError("fallback is only supported in Pydantic v2") dumped = super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, - by_alias=by_alias, + by_alias=by_alias if by_alias is not None else False, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, @@ -313,13 +316,14 @@ def model_dump_json( indent: int | None = None, include: IncEx | None = None, exclude: IncEx | None = None, - by_alias: bool = False, + by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, context: dict[str, Any] | None = None, + fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, ) -> str: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json @@ -348,11 +352,13 @@ def model_dump_json( raise ValueError("context is only supported in Pydantic v2") if serialize_as_any != False: raise ValueError("serialize_as_any is only supported in Pydantic v2") + if fallback is not None: + raise ValueError("fallback is only supported in Pydantic v2") return super().json( # type: ignore[reportDeprecated] indent=indent, include=include, exclude=exclude, - by_alias=by_alias, + by_alias=by_alias if by_alias is not None else False, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, From 503cbaf78a0755dc99124a5c36cf222176294d89 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Sep 2025 10:10:35 +0000 Subject: [PATCH 321/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../cloud/file_shares/file_shares.py | 8 ++++ src/gcore/types/cloud/file_share.py | 4 ++ .../types/cloud/file_share_create_params.py | 20 ++++++++++ .../types/cloud/file_share_update_params.py | 39 ++++++++++++++++++- tests/api_resources/cloud/test_file_shares.py | 22 ++++++++++- 6 files changed, 91 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4d863aff..fea0da28 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1f1d68f6c5fa67afbf457aab0fb67b8494e97339aed4e7865f0dcc86b56bf522.yml -openapi_spec_hash: 53a6dc99201cbcc637dae930ed4b4e45 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b473743ee0ba83806f1c8fad37c8dc55062a7d64b726e4ce2ee7e6ed679500a0.yml +openapi_spec_hash: 990a444fc9f47cee9b92c1fc8915f6ac config_hash: bfac9dcd59fec1e54559dc11fcba758e diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 99a806d5..ab93dea4 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -234,6 +234,7 @@ def update( project_id: int | None = None, region_id: int | None = None, name: str | NotGiven = NOT_GIVEN, + share_settings: file_share_update_params.ShareSettings | NotGiven = NOT_GIVEN, tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -254,6 +255,8 @@ def update( name: Name + share_settings: Configuration settings for the share + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and @@ -293,6 +296,7 @@ def update( body=maybe_transform( { "name": name, + "share_settings": share_settings, "tags": tags, }, file_share_update_params.FileShareUpdateParams, @@ -703,6 +707,7 @@ async def update( project_id: int | None = None, region_id: int | None = None, name: str | NotGiven = NOT_GIVEN, + share_settings: file_share_update_params.ShareSettings | NotGiven = NOT_GIVEN, tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -723,6 +728,8 @@ async def update( name: Name + share_settings: Configuration settings for the share + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and @@ -762,6 +769,7 @@ async def update( body=await async_maybe_transform( { "name": name, + "share_settings": share_settings, "tags": tags, }, file_share_update_params.FileShareUpdateParams, diff --git a/src/gcore/types/cloud/file_share.py b/src/gcore/types/cloud/file_share.py index 288e66db..a334740b 100644 --- a/src/gcore/types/cloud/file_share.py +++ b/src/gcore/types/cloud/file_share.py @@ -21,6 +21,10 @@ class ShareSettingsStandardShareSettingsOutputSerializer(BaseModel): class ShareSettingsVastShareSettingsOutputSerializer(BaseModel): + allowed_characters: Optional[Literal["LCD", "NPL"]] = None + + path_length: Optional[Literal["LCD", "NPL"]] = None + root_squash: bool """Enables or disables root squash for NFS clients. diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index 90fb2abc..c1c8624b 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -110,6 +110,26 @@ class CreateVastFileShareSerializer(TypedDict, total=False): class CreateVastFileShareSerializerShareSettings(TypedDict, total=False): + allowed_characters: Literal["LCD", "NPL"] + """Determines which characters are allowed in file names. Choose between: + + - Lowest Common Denominator (LCD), allows only characters allowed by all VAST + Cluster-supported protocols + - Native Protocol Limit (NPL), imposes no limitation beyond that of the client + protocol. + """ + + path_length: Literal["LCD", "NPL"] + """Affects the maximum limit of file path component name length. Choose between: + + - Lowest Common Denominator (LCD), imposes the lowest common denominator file + length limit of all VAST Cluster-supported protocols. With this (default) + option, the limitation on the length of a single component of the path is 255 + characters + - Native Protocol Limit (NPL), imposes no limitation beyond that of the client + protocol. + """ + root_squash: bool """Enables or disables root squash for NFS clients. diff --git a/src/gcore/types/cloud/file_share_update_params.py b/src/gcore/types/cloud/file_share_update_params.py index 24e4b9de..a51b8aa0 100644 --- a/src/gcore/types/cloud/file_share_update_params.py +++ b/src/gcore/types/cloud/file_share_update_params.py @@ -3,11 +3,11 @@ from __future__ import annotations from typing import Optional -from typing_extensions import TypedDict +from typing_extensions import Literal, TypedDict from .tag_update_map_param import TagUpdateMapParam -__all__ = ["FileShareUpdateParams"] +__all__ = ["FileShareUpdateParams", "ShareSettings"] class FileShareUpdateParams(TypedDict, total=False): @@ -20,6 +20,9 @@ class FileShareUpdateParams(TypedDict, total=False): name: str """Name""" + share_settings: ShareSettings + """Configuration settings for the share""" + tags: Optional[TagUpdateMapParam] """Update key-value tags using JSON Merge Patch semantics (RFC 7386). @@ -42,3 +45,35 @@ class FileShareUpdateParams(TypedDict, total=False): - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ + + +class ShareSettings(TypedDict, total=False): + allowed_characters: Literal["LCD", "NPL"] + """Determines which characters are allowed in file names. Choose between: + + - Lowest Common Denominator (LCD), allows only characters allowed by all VAST + Cluster-supported protocols + - Native Protocol Limit (NPL), imposes no limitation beyond that of the client + protocol. + """ + + path_length: Literal["LCD", "NPL"] + """Affects the maximum limit of file path component name length. Choose between: + + - Lowest Common Denominator (LCD), imposes the lowest common denominator file + length limit of all VAST Cluster-supported protocols. With this (default) + option, the limitation on the length of a single component of the path is 255 + characters + - Native Protocol Limit (NPL), imposes no limitation beyond that of the client + protocol. + """ + + root_squash: bool + """Enables or disables root squash for NFS clients. + + - If `true` (default), root squash is enabled: the root user is mapped to nobody + for all file and folder management operations on the export. + - If `false`, root squash is disabled: the NFS client `root` user retains root + privileges. Use this option if you trust the root user not to perform + operations that will corrupt data. + """ diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index 8e02d137..262d8a4a 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -110,7 +110,11 @@ def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: name="test-share-file-system", protocol="NFS", size=5, - share_settings={"root_squash": True}, + share_settings={ + "allowed_characters": "LCD", + "path_length": "LCD", + "root_squash": True, + }, tags={"my-tag": "my-tag-value"}, type_name="vast", volume_type="vast_share_type", @@ -165,6 +169,11 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, name="some_name", + share_settings={ + "allowed_characters": "LCD", + "path_length": "LCD", + "root_squash": True, + }, tags={"foo": "my-tag-value"}, ) assert_matches_type(FileShare, file_share, path=["response"]) @@ -489,7 +498,11 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn name="test-share-file-system", protocol="NFS", size=5, - share_settings={"root_squash": True}, + share_settings={ + "allowed_characters": "LCD", + "path_length": "LCD", + "root_squash": True, + }, tags={"my-tag": "my-tag-value"}, type_name="vast", volume_type="vast_share_type", @@ -544,6 +557,11 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> project_id=1, region_id=1, name="some_name", + share_settings={ + "allowed_characters": "LCD", + "path_length": "LCD", + "root_squash": True, + }, tags={"foo": "my-tag-value"}, ) assert_matches_type(FileShare, file_share, path=["response"]) From 10bee8601c9a9e35ad3a102172b13a2724a65aba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Sep 2025 13:38:22 +0000 Subject: [PATCH 322/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index fea0da28..12d70d76 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b473743ee0ba83806f1c8fad37c8dc55062a7d64b726e4ce2ee7e6ed679500a0.yml openapi_spec_hash: 990a444fc9f47cee9b92c1fc8915f6ac -config_hash: bfac9dcd59fec1e54559dc11fcba758e +config_hash: b2097de8bb0184ce4379a853a61ef740 From c2bfab513e4c958d3b30c2af6ae01e3c0fdec19a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Sep 2025 15:01:47 +0000 Subject: [PATCH 323/592] chore(types): change optional parameter type from NotGiven to Omit --- src/gcore/__init__.py | 4 +- src/gcore/_base_client.py | 18 +- src/gcore/_client.py | 16 +- src/gcore/_qs.py | 14 +- src/gcore/_types.py | 29 +- src/gcore/_utils/_transform.py | 4 +- src/gcore/_utils/_utils.py | 8 +- src/gcore/resources/cloud/audit_logs.py | 54 ++-- .../resources/cloud/baremetal/flavors.py | 30 +- src/gcore/resources/cloud/baremetal/images.py | 26 +- .../resources/cloud/baremetal/servers.py | 150 +++++----- .../resources/cloud/billing_reservations.py | 58 ++-- src/gcore/resources/cloud/cost_reports.py | 126 ++++----- .../cloud/file_shares/access_rules.py | 14 +- .../cloud/file_shares/file_shares.py | 118 ++++---- src/gcore/resources/cloud/floating_ips.py | 66 ++--- .../cloud/gpu_baremetal_clusters/flavors.py | 14 +- .../gpu_baremetal_clusters.py | 74 ++--- .../cloud/gpu_baremetal_clusters/images.py | 50 ++-- .../gpu_baremetal_clusters/interfaces.py | 6 +- .../cloud/gpu_baremetal_clusters/servers.py | 214 +++++++------- .../resources/cloud/inference/api_keys.py | 42 +-- .../inference/applications/deployments.py | 40 ++- .../cloud/inference/applications/templates.py | 10 +- .../inference/deployments/deployments.py | 138 ++++----- .../cloud/inference/deployments/logs.py | 22 +- .../resources/cloud/inference/flavors.py | 18 +- .../resources/cloud/inference/inference.py | 6 +- .../cloud/inference/registry_credentials.py | 30 +- .../resources/cloud/inference/secrets.py | 30 +- .../resources/cloud/instances/flavors.py | 22 +- src/gcore/resources/cloud/instances/images.py | 150 +++++----- .../resources/cloud/instances/instances.py | 258 ++++++++--------- .../resources/cloud/instances/interfaces.py | 162 +++++------ .../resources/cloud/instances/metrics.py | 6 +- src/gcore/resources/cloud/ip_ranges.py | 6 +- .../resources/cloud/k8s/clusters/clusters.py | 114 ++++---- .../resources/cloud/k8s/clusters/nodes.py | 14 +- .../cloud/k8s/clusters/pools/nodes.py | 14 +- .../cloud/k8s/clusters/pools/pools.py | 90 +++--- src/gcore/resources/cloud/k8s/flavors.py | 14 +- src/gcore/resources/cloud/k8s/k8s.py | 6 +- .../resources/cloud/load_balancers/flavors.py | 10 +- .../load_balancers/l7_policies/l7_policies.py | 78 +++--- .../cloud/load_balancers/l7_policies/rules.py | 58 ++-- .../cloud/load_balancers/listeners.py | 106 +++---- .../cloud/load_balancers/load_balancers.py | 146 +++++----- .../resources/cloud/load_balancers/metrics.py | 6 +- .../load_balancers/pools/health_monitors.py | 26 +- .../cloud/load_balancers/pools/members.py | 38 +-- .../cloud/load_balancers/pools/pools.py | 126 ++++----- .../cloud/load_balancers/statuses.py | 10 +- .../resources/cloud/networks/networks.py | 66 ++--- src/gcore/resources/cloud/networks/routers.py | 66 ++--- src/gcore/resources/cloud/networks/subnets.py | 102 +++---- src/gcore/resources/cloud/placement_groups.py | 18 +- src/gcore/resources/cloud/projects.py | 62 ++--- src/gcore/resources/cloud/quotas/quotas.py | 14 +- src/gcore/resources/cloud/quotas/requests.py | 34 +-- src/gcore/resources/cloud/regions.py | 36 ++- .../resources/cloud/registries/artifacts.py | 10 +- .../resources/cloud/registries/registries.py | 30 +- .../cloud/registries/repositories.py | 10 +- src/gcore/resources/cloud/registries/tags.py | 6 +- src/gcore/resources/cloud/registries/users.py | 38 +-- .../reserved_fixed_ips/reserved_fixed_ips.py | 122 ++++---- .../resources/cloud/reserved_fixed_ips/vip.py | 30 +- src/gcore/resources/cloud/secrets.py | 30 +- .../resources/cloud/security_groups/rules.py | 74 ++--- .../cloud/security_groups/security_groups.py | 62 ++--- src/gcore/resources/cloud/ssh_keys.py | 42 +-- src/gcore/resources/cloud/tasks.py | 70 ++--- src/gcore/resources/cloud/usage_reports.py | 42 +-- .../resources/cloud/users/role_assignments.py | 50 ++-- src/gcore/resources/cloud/volumes.py | 214 +++++++------- src/gcore/resources/dns/dns.py | 18 +- src/gcore/resources/dns/locations.py | 18 +- src/gcore/resources/dns/metrics.py | 14 +- src/gcore/resources/dns/pickers/pickers.py | 6 +- src/gcore/resources/dns/pickers/presets.py | 6 +- src/gcore/resources/dns/zones/dnssec.py | 14 +- src/gcore/resources/dns/zones/rrsets.py | 74 ++--- src/gcore/resources/dns/zones/zones.py | 206 +++++++------- src/gcore/resources/fastedge/apps/apps.py | 154 +++++----- src/gcore/resources/fastedge/apps/logs.py | 38 +-- src/gcore/resources/fastedge/binaries.py | 18 +- src/gcore/resources/fastedge/fastedge.py | 6 +- src/gcore/resources/fastedge/kv_stores.py | 42 +-- src/gcore/resources/fastedge/secrets.py | 66 ++--- src/gcore/resources/fastedge/statistics.py | 26 +- src/gcore/resources/fastedge/templates.py | 58 ++-- src/gcore/resources/iam/api_tokens.py | 38 +-- src/gcore/resources/iam/iam.py | 6 +- src/gcore/resources/iam/users.py | 66 ++--- src/gcore/resources/security/bgp_announces.py | 30 +- src/gcore/resources/security/events.py | 34 +-- .../resources/security/profile_templates.py | 6 +- src/gcore/resources/security/profiles.py | 66 ++--- .../resources/storage/buckets/buckets.py | 22 +- src/gcore/resources/storage/buckets/cors.py | 14 +- .../resources/storage/buckets/lifecycle.py | 14 +- src/gcore/resources/storage/buckets/policy.py | 14 +- src/gcore/resources/storage/credentials.py | 26 +- src/gcore/resources/storage/locations.py | 14 +- src/gcore/resources/storage/statistics.py | 54 ++-- src/gcore/resources/storage/storage.py | 94 +++---- src/gcore/resources/streaming/ai_tasks.py | 84 +++--- src/gcore/resources/streaming/broadcasts.py | 38 +-- src/gcore/resources/streaming/directories.py | 34 +-- src/gcore/resources/streaming/players.py | 38 +-- src/gcore/resources/streaming/playlists.py | 142 +++++----- src/gcore/resources/streaming/quality_sets.py | 18 +- src/gcore/resources/streaming/restreams.py | 34 +-- src/gcore/resources/streaming/statistics.py | 262 +++++++++--------- .../resources/streaming/streams/overlays.py | 58 ++-- .../resources/streaming/streams/streams.py | 126 ++++----- .../resources/streaming/videos/subtitles.py | 34 +-- .../resources/streaming/videos/videos.py | 158 +++++------ src/gcore/resources/waap/advanced_rules.py | 6 +- src/gcore/resources/waap/custom_page_sets.py | 126 ++++----- .../resources/waap/domains/advanced_rules.py | 90 +++--- .../resources/waap/domains/api_discovery.py | 70 ++--- .../resources/waap/domains/api_path_groups.py | 6 +- src/gcore/resources/waap/domains/api_paths.py | 98 ++++--- .../resources/waap/domains/custom_rules.py | 82 +++--- src/gcore/resources/waap/domains/domains.py | 56 ++-- .../resources/waap/domains/firewall_rules.py | 82 +++--- .../waap/domains/insight_silences.py | 58 ++-- src/gcore/resources/waap/domains/insights.py | 42 +-- src/gcore/resources/waap/domains/settings.py | 18 +- .../resources/waap/domains/statistics.py | 126 ++++----- src/gcore/resources/waap/insights.py | 32 +-- src/gcore/resources/waap/ip_info/ip_info.py | 34 +-- src/gcore/resources/waap/ip_info/metrics.py | 10 +- src/gcore/resources/waap/organizations.py | 22 +- src/gcore/resources/waap/statistics.py | 6 +- src/gcore/resources/waap/tags.py | 30 +- src/gcore/resources/waap/waap.py | 6 +- tests/test_transform.py | 11 +- 139 files changed, 3697 insertions(+), 3719 deletions(-) diff --git a/src/gcore/__init__.py b/src/gcore/__init__.py index 83786fb8..833abff8 100644 --- a/src/gcore/__init__.py +++ b/src/gcore/__init__.py @@ -3,7 +3,7 @@ import typing as _t from . import types -from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes +from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given from ._utils import file_from_path from ._client import Gcore, Client, Stream, Timeout, Transport, AsyncGcore, AsyncClient, AsyncStream, RequestOptions from ._models import BaseModel @@ -38,7 +38,9 @@ "ProxiesTypes", "NotGiven", "NOT_GIVEN", + "not_given", "Omit", + "omit", "GcoreError", "APIError", "APIStatusError", diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index b4fe9249..b68aa376 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -42,7 +42,6 @@ from ._qs import Querystring from ._files import to_httpx_files, async_to_httpx_files from ._types import ( - NOT_GIVEN, Body, Omit, Query, @@ -57,6 +56,7 @@ RequestOptions, HttpxRequestFiles, ModelBuilderProtocol, + not_given, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping from ._compat import PYDANTIC_V1, model_copy, model_dump @@ -145,9 +145,9 @@ def __init__( def __init__( self, *, - url: URL | NotGiven = NOT_GIVEN, - json: Body | NotGiven = NOT_GIVEN, - params: Query | NotGiven = NOT_GIVEN, + url: URL | NotGiven = not_given, + json: Body | NotGiven = not_given, + params: Query | NotGiven = not_given, ) -> None: self.url = url self.json = json @@ -595,7 +595,7 @@ def _maybe_override_cast_to(self, cast_to: type[ResponseT], options: FinalReques # we internally support defining a temporary header to override the # default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response` # see _response.py for implementation details - override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, NOT_GIVEN) + override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given) if is_given(override_cast_to): options.headers = headers return cast(Type[ResponseT], override_cast_to) @@ -825,7 +825,7 @@ def __init__( version: str, base_url: str | URL, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, @@ -1356,7 +1356,7 @@ def __init__( base_url: str | URL, _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, @@ -1818,8 +1818,8 @@ def make_request_options( extra_query: Query | None = None, extra_body: Body | None = None, idempotency_key: str | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - post_parser: PostParser | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + post_parser: PostParser | NotGiven = not_given, ) -> RequestOptions: """Create a dict of type RequestOptions without keys of NotGiven values.""" options: RequestOptions = {} diff --git a/src/gcore/_client.py b/src/gcore/_client.py index fb66fd59..837f0881 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Union, Mapping +from typing import Any, Mapping from typing_extensions import Self, override import httpx @@ -11,13 +11,13 @@ from . import _exceptions from ._qs import Querystring from ._types import ( - NOT_GIVEN, Omit, Timeout, NotGiven, Transport, ProxiesTypes, RequestOptions, + not_given, ) from ._utils import is_given, get_async_library, maybe_coerce_integer from ._version import __version__ @@ -66,7 +66,7 @@ def __init__( cloud_region_id: int | None = None, cloud_polling_interval_seconds: int | None = 3, base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -166,9 +166,9 @@ def copy( cloud_region_id: int | None = None, cloud_polling_interval_seconds: int | None = None, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -293,7 +293,7 @@ def __init__( cloud_region_id: int | None = None, cloud_polling_interval_seconds: int | None = 3, base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -393,9 +393,9 @@ def copy( cloud_region_id: int | None = None, cloud_polling_interval_seconds: int | None = None, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, diff --git a/src/gcore/_qs.py b/src/gcore/_qs.py index 274320ca..ada6fd3f 100644 --- a/src/gcore/_qs.py +++ b/src/gcore/_qs.py @@ -4,7 +4,7 @@ from urllib.parse import parse_qs, urlencode from typing_extensions import Literal, get_args -from ._types import NOT_GIVEN, NotGiven, NotGivenOr +from ._types import NotGiven, not_given from ._utils import flatten _T = TypeVar("_T") @@ -41,8 +41,8 @@ def stringify( self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> str: return urlencode( self.stringify_items( @@ -56,8 +56,8 @@ def stringify_items( self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> list[tuple[str, str]]: opts = Options( qs=self, @@ -143,8 +143,8 @@ def __init__( self, qs: Querystring = _qs, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> None: self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format diff --git a/src/gcore/_types.py b/src/gcore/_types.py index 078ad89a..7ed4155b 100644 --- a/src/gcore/_types.py +++ b/src/gcore/_types.py @@ -117,18 +117,21 @@ class RequestOptions(TypedDict, total=False): # Sentinel class used until PEP 0661 is accepted class NotGiven: """ - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different behavior). + For parameters with a meaningful None value, we need to distinguish between + the user explicitly passing None, and the user not passing the parameter at + all. + + User code shouldn't need to use not_given directly. For example: ```py - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... + def create(timeout: Timeout | None | NotGiven = not_given): ... - get(timeout=1) # 1s timeout - get(timeout=None) # No timeout - get() # Default timeout behavior, which may not be statically known at the method definition. + create(timeout=1) # 1s timeout + create(timeout=None) # No timeout + create() # Default timeout behavior ``` """ @@ -140,13 +143,14 @@ def __repr__(self) -> str: return "NOT_GIVEN" -NotGivenOr = Union[_T, NotGiven] +not_given = NotGiven() +# for backwards compatibility: NOT_GIVEN = NotGiven() class Omit: - """In certain situations you need to be able to represent a case where a default value has - to be explicitly removed and `None` is not an appropriate substitute, for example: + """ + To explicitly omit something from being sent in a request, use `omit`. ```py # as the default `Content-Type` header is `application/json` that will be sent @@ -156,8 +160,8 @@ class Omit: # to look something like: 'multipart/form-data; boundary=0d8382fcf5f8c3be01ca2e11002d2983' client.post(..., headers={"Content-Type": "multipart/form-data"}) - # instead you can remove the default `application/json` header by passing Omit - client.post(..., headers={"Content-Type": Omit()}) + # instead you can remove the default `application/json` header by passing omit + client.post(..., headers={"Content-Type": omit}) ``` """ @@ -165,6 +169,9 @@ def __bool__(self) -> Literal[False]: return False +omit = Omit() + + @runtime_checkable class ModelBuilderProtocol(Protocol): @classmethod diff --git a/src/gcore/_utils/_transform.py b/src/gcore/_utils/_transform.py index c19124f0..52075492 100644 --- a/src/gcore/_utils/_transform.py +++ b/src/gcore/_utils/_transform.py @@ -268,7 +268,7 @@ def _transform_typeddict( annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): if not is_given(value): - # we don't need to include `NotGiven` values here as they'll + # we don't need to include omitted values here as they'll # be stripped out before the request is sent anyway continue @@ -434,7 +434,7 @@ async def _async_transform_typeddict( annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): if not is_given(value): - # we don't need to include `NotGiven` values here as they'll + # we don't need to include omitted values here as they'll # be stripped out before the request is sent anyway continue diff --git a/src/gcore/_utils/_utils.py b/src/gcore/_utils/_utils.py index f0818595..50d59269 100644 --- a/src/gcore/_utils/_utils.py +++ b/src/gcore/_utils/_utils.py @@ -21,7 +21,7 @@ import sniffio -from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike +from .._types import Omit, NotGiven, FileTypes, HeadersLike _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) @@ -63,7 +63,7 @@ def _extract_items( try: key = path[index] except IndexError: - if isinstance(obj, NotGiven): + if not is_given(obj): # no value was provided - we can safely ignore return [] @@ -126,8 +126,8 @@ def _extract_items( return [] -def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]: - return not isinstance(obj, NotGiven) +def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: + return not isinstance(obj, NotGiven) and not isinstance(obj, Omit) # Type safe methods for narrowing types with TypeVars. diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index 1dad329f..0e942e4e 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -88,7 +88,7 @@ def list( "upgrade", ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, api_group: List[ Literal[ "ai_cluster", @@ -146,23 +146,23 @@ def list( "volume", ] ] - | NotGiven = NOT_GIVEN, - from_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - project_id: Iterable[int] | NotGiven = NOT_GIVEN, - region_id: Iterable[int] | NotGiven = NOT_GIVEN, - resource_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - search_field: str | NotGiven = NOT_GIVEN, - sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - to_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, + | Omit = omit, + from_timestamp: Union[str, datetime] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["asc", "desc"] | Omit = omit, + project_id: Iterable[int] | Omit = omit, + region_id: Iterable[int] | Omit = omit, + resource_id: SequenceNotStr[str] | Omit = omit, + search_field: str | Omit = omit, + sorting: Literal["asc", "desc"] | Omit = omit, + to_timestamp: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[AuditLogEntry]: """ Retrieve user action log for one client or a set of projects @@ -297,7 +297,7 @@ def list( "upgrade", ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, api_group: List[ Literal[ "ai_cluster", @@ -355,23 +355,23 @@ def list( "volume", ] ] - | NotGiven = NOT_GIVEN, - from_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - project_id: Iterable[int] | NotGiven = NOT_GIVEN, - region_id: Iterable[int] | NotGiven = NOT_GIVEN, - resource_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - search_field: str | NotGiven = NOT_GIVEN, - sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - to_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, + | Omit = omit, + from_timestamp: Union[str, datetime] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["asc", "desc"] | Omit = omit, + project_id: Iterable[int] | Omit = omit, + region_id: Iterable[int] | Omit = omit, + resource_id: SequenceNotStr[str] | Omit = omit, + search_field: str | Omit = omit, + sorting: Literal["asc", "desc"] | Omit = omit, + to_timestamp: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AuditLogEntry, AsyncOffsetPage[AuditLogEntry]]: """ Retrieve user action log for one client or a set of projects diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 1645b30b..454b0c7f 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -46,18 +46,18 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - disabled: bool | NotGiven = NOT_GIVEN, - exclude_linux: bool | NotGiven = NOT_GIVEN, - exclude_windows: bool | NotGiven = NOT_GIVEN, - include_capacity: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, - include_reservation_stock: bool | NotGiven = NOT_GIVEN, + disabled: bool | Omit = omit, + exclude_linux: bool | Omit = omit, + exclude_windows: bool | Omit = omit, + include_capacity: bool | Omit = omit, + include_prices: bool | Omit = omit, + include_reservation_stock: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BaremetalFlavorList: """List all available bare metal flavors in the specified project and region. @@ -140,18 +140,18 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - disabled: bool | NotGiven = NOT_GIVEN, - exclude_linux: bool | NotGiven = NOT_GIVEN, - exclude_windows: bool | NotGiven = NOT_GIVEN, - include_capacity: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, - include_reservation_stock: bool | NotGiven = NOT_GIVEN, + disabled: bool | Omit = omit, + exclude_linux: bool | Omit = omit, + exclude_windows: bool | Omit = omit, + include_capacity: bool | Omit = omit, + include_prices: bool | Omit = omit, + include_reservation_stock: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BaremetalFlavorList: """List all available bare metal flavors in the specified project and region. diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index a6a22954..16f4d22c 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -48,17 +48,17 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, - private: str | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + include_prices: bool | Omit = omit, + private: str | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, + visibility: Literal["private", "public", "shared"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ImageList: """Retrieve a list of available images for bare metal servers. @@ -136,17 +136,17 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, - private: str | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + include_prices: bool | Omit = omit, + private: str | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, + visibility: Literal["private", "public", "shared"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ImageList: """Retrieve a list of available images for bare metal servers. diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 57060e27..00a36c69 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -8,7 +8,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -54,23 +54,23 @@ def create( region_id: int | None = None, flavor: str, interfaces: Iterable[server_create_params.Interface], - app_config: Optional[object] | NotGiven = NOT_GIVEN, - apptemplate_id: str | NotGiven = NOT_GIVEN, - ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, - image_id: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, + app_config: Optional[object] | Omit = omit, + apptemplate_id: str | Omit = omit, + ddos_profile: server_create_params.DDOSProfile | Omit = omit, + image_id: str | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + password: str | Omit = omit, + ssh_key_name: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + user_data: str | Omit = omit, + username: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new bare metal server with the specified configuration. @@ -186,37 +186,37 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN, - changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN, - flavor_id: str | NotGiven = NOT_GIVEN, - flavor_prefix: str | NotGiven = NOT_GIVEN, - include_k8s: bool | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - only_isolated: bool | NotGiven = NOT_GIVEN, - only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN, + changes_before: Union[str, datetime] | Omit = omit, + changes_since: Union[str, datetime] | Omit = omit, + flavor_id: str | Omit = omit, + flavor_prefix: str | Omit = omit, + include_k8s: bool | Omit = omit, + ip: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + only_isolated: bool | Omit = omit, + only_with_fixed_external_ip: bool | Omit = omit, order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] - | NotGiven = NOT_GIVEN, - profile_name: str | NotGiven = NOT_GIVEN, - protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN, + | Omit = omit, + profile_name: str | Omit = omit, + protection_status: Literal["Active", "Queued", "Error"] | Omit = omit, status: Literal[ "ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED" ] - | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - tag_value: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, - uuid: str | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, - with_interfaces_name: bool | NotGiven = NOT_GIVEN, + | Omit = omit, + tag_key_value: str | Omit = omit, + tag_value: SequenceNotStr[str] | Omit = omit, + type_ddos_profile: Literal["basic", "advanced"] | Omit = omit, + uuid: str | Omit = omit, + with_ddos: bool | Omit = omit, + with_interfaces_name: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[BaremetalServer]: """List all bare metal servers in the specified project and region. @@ -337,14 +337,14 @@ def rebuild( *, project_id: int | None = None, region_id: int | None = None, - image_id: str | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, + image_id: str | Omit = omit, + user_data: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Rebuild a bare metal server with a new image while preserving its configuration. @@ -419,23 +419,23 @@ async def create( region_id: int | None = None, flavor: str, interfaces: Iterable[server_create_params.Interface], - app_config: Optional[object] | NotGiven = NOT_GIVEN, - apptemplate_id: str | NotGiven = NOT_GIVEN, - ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, - image_id: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, + app_config: Optional[object] | Omit = omit, + apptemplate_id: str | Omit = omit, + ddos_profile: server_create_params.DDOSProfile | Omit = omit, + image_id: str | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + password: str | Omit = omit, + ssh_key_name: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + user_data: str | Omit = omit, + username: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new bare metal server with the specified configuration. @@ -551,37 +551,37 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN, - changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN, - flavor_id: str | NotGiven = NOT_GIVEN, - flavor_prefix: str | NotGiven = NOT_GIVEN, - include_k8s: bool | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - only_isolated: bool | NotGiven = NOT_GIVEN, - only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN, + changes_before: Union[str, datetime] | Omit = omit, + changes_since: Union[str, datetime] | Omit = omit, + flavor_id: str | Omit = omit, + flavor_prefix: str | Omit = omit, + include_k8s: bool | Omit = omit, + ip: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + only_isolated: bool | Omit = omit, + only_with_fixed_external_ip: bool | Omit = omit, order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] - | NotGiven = NOT_GIVEN, - profile_name: str | NotGiven = NOT_GIVEN, - protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN, + | Omit = omit, + profile_name: str | Omit = omit, + protection_status: Literal["Active", "Queued", "Error"] | Omit = omit, status: Literal[ "ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED" ] - | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - tag_value: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, - uuid: str | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, - with_interfaces_name: bool | NotGiven = NOT_GIVEN, + | Omit = omit, + tag_key_value: str | Omit = omit, + tag_value: SequenceNotStr[str] | Omit = omit, + type_ddos_profile: Literal["basic", "advanced"] | Omit = omit, + uuid: str | Omit = omit, + with_ddos: bool | Omit = omit, + with_interfaces_name: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[BaremetalServer, AsyncOffsetPage[BaremetalServer]]: """List all bare metal servers in the specified project and region. @@ -702,14 +702,14 @@ async def rebuild( *, project_id: int | None = None, region_id: int | None = None, - image_id: str | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, + image_id: str | Omit = omit, + user_data: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Rebuild a bare metal server with a new image while preserving its configuration. diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index 0d9df747..c25bd06c 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -49,15 +49,15 @@ def with_streaming_response(self) -> BillingReservationsResourceWithStreamingRes def list( self, *, - activated_from: Union[str, date] | NotGiven = NOT_GIVEN, - activated_to: Union[str, date] | NotGiven = NOT_GIVEN, - created_from: Union[str, datetime] | NotGiven = NOT_GIVEN, - created_to: Union[str, datetime] | NotGiven = NOT_GIVEN, - deactivated_from: Union[str, date] | NotGiven = NOT_GIVEN, - deactivated_to: Union[str, date] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - metric_name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + activated_from: Union[str, date] | Omit = omit, + activated_to: Union[str, date] | Omit = omit, + created_from: Union[str, datetime] | Omit = omit, + created_to: Union[str, datetime] | Omit = omit, + deactivated_from: Union[str, date] | Omit = omit, + deactivated_to: Union[str, date] | Omit = omit, + limit: int | Omit = omit, + metric_name: str | Omit = omit, + offset: int | Omit = omit, order_by: Literal[ "active_from.asc", "active_from.desc", @@ -66,20 +66,20 @@ def list( "created_at.asc", "created_at.desc", ] - | NotGiven = NOT_GIVEN, - region_id: int | NotGiven = NOT_GIVEN, + | Omit = omit, + region_id: int | Omit = omit, status: List[ Literal[ "ACTIVATED", "APPROVED", "COPIED", "CREATED", "EXPIRED", "REJECTED", "RESERVED", "WAITING_FOR_PAYMENT" ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[BillingReservation]: """ List reservations @@ -157,7 +157,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BillingReservation: """ Get reservation @@ -205,15 +205,15 @@ def with_streaming_response(self) -> AsyncBillingReservationsResourceWithStreami def list( self, *, - activated_from: Union[str, date] | NotGiven = NOT_GIVEN, - activated_to: Union[str, date] | NotGiven = NOT_GIVEN, - created_from: Union[str, datetime] | NotGiven = NOT_GIVEN, - created_to: Union[str, datetime] | NotGiven = NOT_GIVEN, - deactivated_from: Union[str, date] | NotGiven = NOT_GIVEN, - deactivated_to: Union[str, date] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - metric_name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + activated_from: Union[str, date] | Omit = omit, + activated_to: Union[str, date] | Omit = omit, + created_from: Union[str, datetime] | Omit = omit, + created_to: Union[str, datetime] | Omit = omit, + deactivated_from: Union[str, date] | Omit = omit, + deactivated_to: Union[str, date] | Omit = omit, + limit: int | Omit = omit, + metric_name: str | Omit = omit, + offset: int | Omit = omit, order_by: Literal[ "active_from.asc", "active_from.desc", @@ -222,20 +222,20 @@ def list( "created_at.asc", "created_at.desc", ] - | NotGiven = NOT_GIVEN, - region_id: int | NotGiven = NOT_GIVEN, + | Omit = omit, + region_id: int | Omit = omit, status: List[ Literal[ "ACTIVATED", "APPROVED", "COPIED", "CREATED", "EXPIRED", "REJECTED", "RESERVED", "WAITING_FOR_PAYMENT" ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[BillingReservation, AsyncOffsetPage[BillingReservation]]: """ List reservations @@ -313,7 +313,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BillingReservation: """ Get reservation diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 36075dd6..d5bb66c1 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -56,13 +56,13 @@ def get_aggregated( *, time_from: Union[str, datetime], time_to: Union[str, datetime], - enable_last_day: bool | NotGiven = NOT_GIVEN, - projects: Iterable[int] | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, - rounding: bool | NotGiven = NOT_GIVEN, - schema_filter: cost_report_get_aggregated_params.SchemaFilter | NotGiven = NOT_GIVEN, - tags: cost_report_get_aggregated_params.Tags | NotGiven = NOT_GIVEN, + enable_last_day: bool | Omit = omit, + projects: Iterable[int] | Omit = omit, + regions: Iterable[int] | Omit = omit, + response_format: Literal["csv_totals", "json"] | Omit = omit, + rounding: bool | Omit = omit, + schema_filter: cost_report_get_aggregated_params.SchemaFilter | Omit = omit, + tags: cost_report_get_aggregated_params.Tags | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -92,13 +92,13 @@ def get_aggregated( "volume", ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CostReportAggregated: """Get cost report totals (aggregated costs) for a given period. @@ -171,13 +171,13 @@ def get_aggregated( def get_aggregated_monthly( self, *, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, - rounding: bool | NotGiven = NOT_GIVEN, - schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | NotGiven = NOT_GIVEN, - tags: cost_report_get_aggregated_monthly_params.Tags | NotGiven = NOT_GIVEN, - time_from: Union[str, datetime] | NotGiven = NOT_GIVEN, - time_to: Union[str, datetime] | NotGiven = NOT_GIVEN, + regions: Iterable[int] | Omit = omit, + response_format: Literal["csv_totals", "json"] | Omit = omit, + rounding: bool | Omit = omit, + schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | Omit = omit, + tags: cost_report_get_aggregated_monthly_params.Tags | Omit = omit, + time_from: Union[str, datetime] | Omit = omit, + time_to: Union[str, datetime] | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -207,14 +207,14 @@ def get_aggregated_monthly( "volume", ] ] - | NotGiven = NOT_GIVEN, - year_month: str | NotGiven = NOT_GIVEN, + | Omit = omit, + year_month: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CostReportAggregatedMonthly: """ Retrieve a detailed cost report totals for a specified month, which includes @@ -281,16 +281,16 @@ def get_detailed( *, time_from: Union[str, datetime], time_to: Union[str, datetime], - enable_last_day: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - projects: Iterable[int] | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - response_format: Literal["csv_records", "json"] | NotGiven = NOT_GIVEN, - rounding: bool | NotGiven = NOT_GIVEN, - schema_filter: cost_report_get_detailed_params.SchemaFilter | NotGiven = NOT_GIVEN, - sorting: Iterable[cost_report_get_detailed_params.Sorting] | NotGiven = NOT_GIVEN, - tags: cost_report_get_detailed_params.Tags | NotGiven = NOT_GIVEN, + enable_last_day: bool | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + projects: Iterable[int] | Omit = omit, + regions: Iterable[int] | Omit = omit, + response_format: Literal["csv_records", "json"] | Omit = omit, + rounding: bool | Omit = omit, + schema_filter: cost_report_get_detailed_params.SchemaFilter | Omit = omit, + sorting: Iterable[cost_report_get_detailed_params.Sorting] | Omit = omit, + tags: cost_report_get_detailed_params.Tags | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -320,13 +320,13 @@ def get_detailed( "volume", ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CostReportDetailed: """Get a detailed cost report for a given period and specific resources. @@ -432,13 +432,13 @@ async def get_aggregated( *, time_from: Union[str, datetime], time_to: Union[str, datetime], - enable_last_day: bool | NotGiven = NOT_GIVEN, - projects: Iterable[int] | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, - rounding: bool | NotGiven = NOT_GIVEN, - schema_filter: cost_report_get_aggregated_params.SchemaFilter | NotGiven = NOT_GIVEN, - tags: cost_report_get_aggregated_params.Tags | NotGiven = NOT_GIVEN, + enable_last_day: bool | Omit = omit, + projects: Iterable[int] | Omit = omit, + regions: Iterable[int] | Omit = omit, + response_format: Literal["csv_totals", "json"] | Omit = omit, + rounding: bool | Omit = omit, + schema_filter: cost_report_get_aggregated_params.SchemaFilter | Omit = omit, + tags: cost_report_get_aggregated_params.Tags | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -468,13 +468,13 @@ async def get_aggregated( "volume", ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CostReportAggregated: """Get cost report totals (aggregated costs) for a given period. @@ -547,13 +547,13 @@ async def get_aggregated( async def get_aggregated_monthly( self, *, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, - rounding: bool | NotGiven = NOT_GIVEN, - schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | NotGiven = NOT_GIVEN, - tags: cost_report_get_aggregated_monthly_params.Tags | NotGiven = NOT_GIVEN, - time_from: Union[str, datetime] | NotGiven = NOT_GIVEN, - time_to: Union[str, datetime] | NotGiven = NOT_GIVEN, + regions: Iterable[int] | Omit = omit, + response_format: Literal["csv_totals", "json"] | Omit = omit, + rounding: bool | Omit = omit, + schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | Omit = omit, + tags: cost_report_get_aggregated_monthly_params.Tags | Omit = omit, + time_from: Union[str, datetime] | Omit = omit, + time_to: Union[str, datetime] | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -583,14 +583,14 @@ async def get_aggregated_monthly( "volume", ] ] - | NotGiven = NOT_GIVEN, - year_month: str | NotGiven = NOT_GIVEN, + | Omit = omit, + year_month: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CostReportAggregatedMonthly: """ Retrieve a detailed cost report totals for a specified month, which includes @@ -657,16 +657,16 @@ async def get_detailed( *, time_from: Union[str, datetime], time_to: Union[str, datetime], - enable_last_day: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - projects: Iterable[int] | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - response_format: Literal["csv_records", "json"] | NotGiven = NOT_GIVEN, - rounding: bool | NotGiven = NOT_GIVEN, - schema_filter: cost_report_get_detailed_params.SchemaFilter | NotGiven = NOT_GIVEN, - sorting: Iterable[cost_report_get_detailed_params.Sorting] | NotGiven = NOT_GIVEN, - tags: cost_report_get_detailed_params.Tags | NotGiven = NOT_GIVEN, + enable_last_day: bool | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + projects: Iterable[int] | Omit = omit, + regions: Iterable[int] | Omit = omit, + response_format: Literal["csv_records", "json"] | Omit = omit, + rounding: bool | Omit = omit, + schema_filter: cost_report_get_detailed_params.SchemaFilter | Omit = omit, + sorting: Iterable[cost_report_get_detailed_params.Sorting] | Omit = omit, + tags: cost_report_get_detailed_params.Tags | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -696,13 +696,13 @@ async def get_detailed( "volume", ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CostReportDetailed: """Get a detailed cost report for a given period and specific resources. diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index 34cc65ee..6750a7c5 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Query, Headers, NoneType, NotGiven, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -57,7 +57,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccessRule: """ Create file share access rule @@ -113,7 +113,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccessRuleList: """ List file share access rules @@ -159,7 +159,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete file share access rule @@ -232,7 +232,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccessRule: """ Create file share access rule @@ -288,7 +288,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccessRuleList: """ List file share access rules @@ -334,7 +334,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete file share access rule diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index ab93dea4..3d18dec1 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import required_args, maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -74,16 +74,16 @@ def create( network: file_share_create_params.CreateStandardFileShareSerializerNetwork, protocol: Literal["NFS"], size: int, - access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type_name: Literal["standard"] | NotGiven = NOT_GIVEN, - volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, + access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type_name: Literal["standard"] | Omit = omit, + volume_type: Literal["default_share_type"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create file share @@ -132,16 +132,16 @@ def create( name: str, protocol: Literal["NFS"], size: int, - share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type_name: Literal["vast"] | NotGiven = NOT_GIVEN, - volume_type: Literal["vast_share_type"] | NotGiven = NOT_GIVEN, + share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type_name: Literal["vast"] | Omit = omit, + volume_type: Literal["vast_share_type"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create file share @@ -186,20 +186,20 @@ def create( project_id: int | None = None, region_id: int | None = None, name: str, - network: file_share_create_params.CreateStandardFileShareSerializerNetwork | NotGiven = NOT_GIVEN, + network: file_share_create_params.CreateStandardFileShareSerializerNetwork | Omit = omit, protocol: Literal["NFS"], size: int, - access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type_name: Literal["standard"] | Literal["vast"] | NotGiven = NOT_GIVEN, - volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, - share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, + access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type_name: Literal["standard"] | Literal["vast"] | Omit = omit, + volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | Omit = omit, + share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -233,15 +233,15 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, - share_settings: file_share_update_params.ShareSettings | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + share_settings: file_share_update_params.ShareSettings | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileShare: """ Rename file share or update tags @@ -312,16 +312,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - type_name: Literal["standard", "vast"] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + type_name: Literal["standard", "vast"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[FileShare]: """ List file shares @@ -384,7 +384,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete file share @@ -429,7 +429,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileShare: """ Get file share @@ -475,7 +475,7 @@ def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Resize file share @@ -547,16 +547,16 @@ async def create( network: file_share_create_params.CreateStandardFileShareSerializerNetwork, protocol: Literal["NFS"], size: int, - access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type_name: Literal["standard"] | NotGiven = NOT_GIVEN, - volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, + access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type_name: Literal["standard"] | Omit = omit, + volume_type: Literal["default_share_type"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create file share @@ -605,16 +605,16 @@ async def create( name: str, protocol: Literal["NFS"], size: int, - share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type_name: Literal["vast"] | NotGiven = NOT_GIVEN, - volume_type: Literal["vast_share_type"] | NotGiven = NOT_GIVEN, + share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type_name: Literal["vast"] | Omit = omit, + volume_type: Literal["vast_share_type"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create file share @@ -659,20 +659,20 @@ async def create( project_id: int | None = None, region_id: int | None = None, name: str, - network: file_share_create_params.CreateStandardFileShareSerializerNetwork | NotGiven = NOT_GIVEN, + network: file_share_create_params.CreateStandardFileShareSerializerNetwork | Omit = omit, protocol: Literal["NFS"], size: int, - access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type_name: Literal["standard"] | Literal["vast"] | NotGiven = NOT_GIVEN, - volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, - share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, + access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type_name: Literal["standard"] | Literal["vast"] | Omit = omit, + volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | Omit = omit, + share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -706,15 +706,15 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, - share_settings: file_share_update_params.ShareSettings | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + share_settings: file_share_update_params.ShareSettings | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileShare: """ Rename file share or update tags @@ -785,16 +785,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - type_name: Literal["standard", "vast"] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + type_name: Literal["standard", "vast"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[FileShare, AsyncOffsetPage[FileShare]]: """ List file shares @@ -857,7 +857,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete file share @@ -902,7 +902,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileShare: """ Get file share @@ -948,7 +948,7 @@ async def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Resize file share diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 65a07509..c27c64fb 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -57,15 +57,15 @@ def create( *, project_id: int | None = None, region_id: int | None = None, - fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, - port_id: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + fixed_ip_address: Optional[str] | Omit = omit, + port_id: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create floating IP @@ -121,13 +121,13 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Update floating IP @@ -187,16 +187,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[FloatingIPDetailed]: """ List floating IPs @@ -259,7 +259,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete floating IP @@ -300,13 +300,13 @@ def assign( project_id: int | None = None, region_id: int | None = None, port_id: str, - fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, + fixed_ip_address: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Assign floating IP to instance or loadbalancer @@ -356,7 +356,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Get floating IP @@ -401,7 +401,7 @@ def unassign( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Unassign floating IP @@ -455,15 +455,15 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, - fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, - port_id: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + fixed_ip_address: Optional[str] | Omit = omit, + port_id: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create floating IP @@ -519,13 +519,13 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Update floating IP @@ -585,16 +585,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[FloatingIPDetailed, AsyncOffsetPage[FloatingIPDetailed]]: """ List floating IPs @@ -657,7 +657,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete floating IP @@ -698,13 +698,13 @@ async def assign( project_id: int | None = None, region_id: int | None = None, port_id: str, - fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, + fixed_ip_address: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Assign floating IP to instance or loadbalancer @@ -754,7 +754,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Get floating IP @@ -799,7 +799,7 @@ async def unassign( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Unassign floating IP diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index 2c4563b5..19df3189 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -46,14 +46,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - hide_disabled: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, + hide_disabled: bool | Omit = omit, + include_prices: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalFlavorList: """ List bare metal GPU flavors @@ -123,14 +123,14 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - hide_disabled: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, + hide_disabled: bool | Omit = omit, + include_prices: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalFlavorList: """ List bare metal GPU flavors diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 526babdf..248d96c7 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -31,7 +31,7 @@ ServersResourceWithStreamingResponse, AsyncServersResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from .interfaces import ( @@ -111,13 +111,13 @@ def create( name: str, servers_count: int, servers_settings: gpu_baremetal_cluster_create_params.ServersSettings, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new bare metal GPU cluster with the specified configuration. @@ -179,15 +179,15 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - managed_by: List[Literal["k8s", "user"]] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + managed_by: List[Literal["k8s", "user"]] | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[GPUBaremetalCluster]: """ List all bare metal GPU clusters in the specified project and region. @@ -245,16 +245,16 @@ def delete( *, project_id: int | None = None, region_id: int | None = None, - all_floating_ips: bool | NotGiven = NOT_GIVEN, - all_reserved_fixed_ips: bool | NotGiven = NOT_GIVEN, - floating_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - reserved_fixed_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + all_floating_ips: bool | Omit = omit, + all_reserved_fixed_ips: bool | Omit = omit, + floating_ip_ids: SequenceNotStr[str] | Omit = omit, + reserved_fixed_ip_ids: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete a bare metal GPU cluster and all its associated resources. @@ -321,7 +321,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalCluster: """ Get detailed information about a specific bare metal GPU cluster. @@ -366,7 +366,7 @@ def powercycle_all_servers( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1List: """ Stops and then starts all cluster servers, effectively performing a hard reboot. @@ -405,7 +405,7 @@ def reboot_all_servers( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1List: """ Reboot all bare metal GPU cluster servers @@ -440,14 +440,14 @@ def rebuild( project_id: int | None = None, region_id: int | None = None, nodes: SequenceNotStr[str], - image_id: Optional[str] | NotGiven = NOT_GIVEN, - user_data: Optional[str] | NotGiven = NOT_GIVEN, + image_id: Optional[str] | Omit = omit, + user_data: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Rebuild one or more nodes in a GPU cluster. @@ -505,7 +505,7 @@ def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Change the number of nodes in a GPU cluster. @@ -588,13 +588,13 @@ async def create( name: str, servers_count: int, servers_settings: gpu_baremetal_cluster_create_params.ServersSettings, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new bare metal GPU cluster with the specified configuration. @@ -656,15 +656,15 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - managed_by: List[Literal["k8s", "user"]] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + managed_by: List[Literal["k8s", "user"]] | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[GPUBaremetalCluster, AsyncOffsetPage[GPUBaremetalCluster]]: """ List all bare metal GPU clusters in the specified project and region. @@ -722,16 +722,16 @@ async def delete( *, project_id: int | None = None, region_id: int | None = None, - all_floating_ips: bool | NotGiven = NOT_GIVEN, - all_reserved_fixed_ips: bool | NotGiven = NOT_GIVEN, - floating_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - reserved_fixed_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + all_floating_ips: bool | Omit = omit, + all_reserved_fixed_ips: bool | Omit = omit, + floating_ip_ids: SequenceNotStr[str] | Omit = omit, + reserved_fixed_ip_ids: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete a bare metal GPU cluster and all its associated resources. @@ -798,7 +798,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalCluster: """ Get detailed information about a specific bare metal GPU cluster. @@ -843,7 +843,7 @@ async def powercycle_all_servers( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1List: """ Stops and then starts all cluster servers, effectively performing a hard reboot. @@ -882,7 +882,7 @@ async def reboot_all_servers( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1List: """ Reboot all bare metal GPU cluster servers @@ -917,14 +917,14 @@ async def rebuild( project_id: int | None = None, region_id: int | None = None, nodes: SequenceNotStr[str], - image_id: Optional[str] | NotGiven = NOT_GIVEN, - user_data: Optional[str] | NotGiven = NOT_GIVEN, + image_id: Optional[str] | Omit = omit, + user_data: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Rebuild one or more nodes in a GPU cluster. @@ -982,7 +982,7 @@ async def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Change the number of nodes in a GPU cluster. diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 8c2d4623..5e2003c2 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -56,7 +56,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUImageList: """ List bare metal GPU images @@ -97,7 +97,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete bare metal GPU image @@ -142,7 +142,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUImage: """ Get bare metal GPU image @@ -183,20 +183,20 @@ def upload( region_id: int | None = None, name: str, url: str, - architecture: Optional[Literal["aarch64", "x86_64"]] | NotGiven = NOT_GIVEN, - cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - os_distro: Optional[str] | NotGiven = NOT_GIVEN, - os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, - os_version: Optional[str] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + architecture: Optional[Literal["aarch64", "x86_64"]] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Optional[Literal["linux", "windows"]] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Upload new bare metal GPU image @@ -297,7 +297,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUImageList: """ List bare metal GPU images @@ -338,7 +338,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete bare metal GPU image @@ -383,7 +383,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUImage: """ Get bare metal GPU image @@ -424,20 +424,20 @@ async def upload( region_id: int | None = None, name: str, url: str, - architecture: Optional[Literal["aarch64", "x86_64"]] | NotGiven = NOT_GIVEN, - cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - os_distro: Optional[str] | NotGiven = NOT_GIVEN, - os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, - os_version: Optional[str] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + architecture: Optional[Literal["aarch64", "x86_64"]] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Optional[Literal["linux", "windows"]] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Upload new bare metal GPU image diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index 863ffde8..63371d8e 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -50,7 +50,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> NetworkInterfaceList: """ Retrieve a list of network interfaces attached to the GPU cluster servers. @@ -110,7 +110,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> NetworkInterfaceList: """ Retrieve a list of network interfaces attached to the GPU cluster servers. diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index adda6989..fb1a210e 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -8,7 +8,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -60,13 +60,13 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - changed_before: Union[str, datetime] | NotGiven = NOT_GIVEN, - changed_since: Union[str, datetime] | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] | NotGiven = NOT_GIVEN, + changed_before: Union[str, datetime] | Omit = omit, + changed_since: Union[str, datetime] | Omit = omit, + ip_address: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] | Omit = omit, status: Literal[ "ACTIVE", "BUILD", @@ -85,14 +85,14 @@ def list( "SUSPENDED", "VERIFY_RESIZE", ] - | NotGiven = NOT_GIVEN, - uuids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + uuids: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[GPUBaremetalClusterServer]: """List all servers in a bare metal GPU cluster. @@ -175,13 +175,13 @@ def delete( project_id: int | None = None, region_id: int | None = None, cluster_id: str, - delete_floatings: bool | NotGiven = NOT_GIVEN, + delete_floatings: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a specific node from a GPU cluster. @@ -227,20 +227,19 @@ def attach_interface( *, project_id: int | None = None, region_id: int | None = None, - ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -276,18 +275,18 @@ def attach_interface( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -323,19 +322,19 @@ def attach_interface( project_id: int | None = None, region_id: int | None = None, network_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -373,19 +372,18 @@ def attach_interface( project_id: int | None = None, region_id: int | None = None, port_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -423,25 +421,25 @@ def attach_interface( | server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] | Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -484,7 +482,7 @@ def detach_interface( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Detach interface from bare metal GPU cluster server @@ -534,7 +532,7 @@ def get_console( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Console: """ Get bare metal GPU cluster server console URL @@ -573,7 +571,7 @@ def powercycle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1: """ Stops and then starts the server, effectively performing a hard reboot. @@ -612,7 +610,7 @@ def reboot( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1: """ Reboot one bare metal GPU cluster server @@ -667,13 +665,13 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - changed_before: Union[str, datetime] | NotGiven = NOT_GIVEN, - changed_since: Union[str, datetime] | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] | NotGiven = NOT_GIVEN, + changed_before: Union[str, datetime] | Omit = omit, + changed_since: Union[str, datetime] | Omit = omit, + ip_address: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] | Omit = omit, status: Literal[ "ACTIVE", "BUILD", @@ -692,14 +690,14 @@ def list( "SUSPENDED", "VERIFY_RESIZE", ] - | NotGiven = NOT_GIVEN, - uuids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + uuids: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[GPUBaremetalClusterServer, AsyncOffsetPage[GPUBaremetalClusterServer]]: """List all servers in a bare metal GPU cluster. @@ -782,13 +780,13 @@ async def delete( project_id: int | None = None, region_id: int | None = None, cluster_id: str, - delete_floatings: bool | NotGiven = NOT_GIVEN, + delete_floatings: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a specific node from a GPU cluster. @@ -836,20 +834,19 @@ async def attach_interface( *, project_id: int | None = None, region_id: int | None = None, - ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -885,18 +882,18 @@ async def attach_interface( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -932,19 +929,19 @@ async def attach_interface( project_id: int | None = None, region_id: int | None = None, network_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -982,19 +979,18 @@ async def attach_interface( project_id: int | None = None, region_id: int | None = None, port_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -1032,25 +1028,25 @@ async def attach_interface( | server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] | Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -1093,7 +1089,7 @@ async def detach_interface( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Detach interface from bare metal GPU cluster server @@ -1143,7 +1139,7 @@ async def get_console( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Console: """ Get bare metal GPU cluster server console URL @@ -1182,7 +1178,7 @@ async def powercycle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1: """ Stops and then starts the server, effectively performing a hard reboot. @@ -1221,7 +1217,7 @@ async def reboot( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1: """ Reboot one bare metal GPU cluster server diff --git a/src/gcore/resources/cloud/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py index 98238c19..fcd8860c 100644 --- a/src/gcore/resources/cloud/inference/api_keys.py +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -50,14 +50,14 @@ def create( *, project_id: int | None = None, name: str, - description: str | NotGiven = NOT_GIVEN, - expires_at: str | NotGiven = NOT_GIVEN, + description: str | Omit = omit, + expires_at: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceAPIKeyCreate: """This endpoint creates a new API key for everywhere inference. @@ -104,13 +104,13 @@ def update( api_key_name: str, *, project_id: int | None = None, - description: Optional[str] | NotGiven = NOT_GIVEN, + description: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceAPIKey: """ This endpoint updates a specific API key for everywhere inference. @@ -147,14 +147,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[InferenceAPIKey]: """ This endpoint retrieves a list of API keys for everywhere inference. @@ -206,7 +206,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """This endpoint deletes a specific API key for everywhere inference. @@ -250,7 +250,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceAPIKey: """ This endpoint retrieves a specific API key for everywhere inference. @@ -306,14 +306,14 @@ async def create( *, project_id: int | None = None, name: str, - description: str | NotGiven = NOT_GIVEN, - expires_at: str | NotGiven = NOT_GIVEN, + description: str | Omit = omit, + expires_at: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceAPIKeyCreate: """This endpoint creates a new API key for everywhere inference. @@ -360,13 +360,13 @@ async def update( api_key_name: str, *, project_id: int | None = None, - description: Optional[str] | NotGiven = NOT_GIVEN, + description: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceAPIKey: """ This endpoint updates a specific API key for everywhere inference. @@ -403,14 +403,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InferenceAPIKey, AsyncOffsetPage[InferenceAPIKey]]: """ This endpoint retrieves a list of API keys for everywhere inference. @@ -462,7 +462,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """This endpoint deletes a specific API key for everywhere inference. @@ -506,7 +506,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceAPIKey: """ This endpoint retrieves a specific API key for everywhere inference. diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index 845bffce..7b62f2c2 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -6,7 +6,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -55,13 +55,13 @@ def create( components_configuration: Dict[str, deployment_create_params.ComponentsConfiguration], name: str, regions: Iterable[int], - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Creates a new application deployment based on a selected catalog application. @@ -119,7 +119,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationDeploymentList: """ Returns a list of your application deployments, including deployment names, @@ -157,7 +157,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Deletes an existing application deployment along with all associated resources. @@ -199,7 +199,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationDeployment: """Retrieves detailed information about a specific application deployment. @@ -238,16 +238,15 @@ def patch( deployment_name: str, *, project_id: int | None = None, - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] - | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | Omit = omit, + components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] | Omit = omit, + regions: Iterable[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Updates an existing application deployment. @@ -324,13 +323,13 @@ async def create( components_configuration: Dict[str, deployment_create_params.ComponentsConfiguration], name: str, regions: Iterable[int], - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Creates a new application deployment based on a selected catalog application. @@ -388,7 +387,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationDeploymentList: """ Returns a list of your application deployments, including deployment names, @@ -426,7 +425,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Deletes an existing application deployment along with all associated resources. @@ -468,7 +467,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationDeployment: """Retrieves detailed information about a specific application deployment. @@ -507,16 +506,15 @@ async def patch( deployment_name: str, *, project_id: int | None = None, - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] - | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | Omit = omit, + components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] | Omit = omit, + regions: Iterable[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Updates an existing application deployment. diff --git a/src/gcore/resources/cloud/inference/applications/templates.py b/src/gcore/resources/cloud/inference/applications/templates.py index 1c475cb8..d888a399 100644 --- a/src/gcore/resources/cloud/inference/applications/templates.py +++ b/src/gcore/resources/cloud/inference/applications/templates.py @@ -4,7 +4,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._types import Body, Query, Headers, NotGiven, not_given from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource from ....._response import ( @@ -48,7 +48,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationTemplateList: """ Returns a list of available machine learning application templates from the @@ -74,7 +74,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationTemplate: """ Retrieves detailed information about a specific machine learning application @@ -133,7 +133,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationTemplateList: """ Returns a list of available machine learning application templates from the @@ -159,7 +159,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationTemplate: """ Retrieves detailed information about a specific machine learning application diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 3a4e4629..0521e2e5 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -15,7 +15,7 @@ LogsResourceWithStreamingResponse, AsyncLogsResourceWithStreamingResponse, ) -from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ....._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -68,22 +68,22 @@ def create( image: str, listening_port: int, name: str, - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - credentials_name: Optional[str] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - envs: Dict[str, str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[deployment_create_params.IngressOpts] | NotGiven = NOT_GIVEN, - logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN, - probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN, - api_timeout: Optional[int] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | Omit = omit, + auth_enabled: bool | Omit = omit, + command: Optional[SequenceNotStr[str]] | Omit = omit, + credentials_name: Optional[str] | Omit = omit, + description: Optional[str] | Omit = omit, + envs: Dict[str, str] | Omit = omit, + ingress_opts: Optional[deployment_create_params.IngressOpts] | Omit = omit, + logging: Optional[deployment_create_params.Logging] | Omit = omit, + probes: Optional[deployment_create_params.Probes] | Omit = omit, + api_timeout: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create inference deployment @@ -179,26 +179,26 @@ def update( deployment_name: str, *, project_id: int | None = None, - api_keys: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, - credentials_name: Optional[str] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - flavor_name: str | NotGiven = NOT_GIVEN, - image: Optional[str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[deployment_update_params.IngressOpts] | NotGiven = NOT_GIVEN, - listening_port: Optional[int] | NotGiven = NOT_GIVEN, - logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN, - probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN, - api_timeout: Optional[int] | NotGiven = NOT_GIVEN, + api_keys: Optional[SequenceNotStr[str]] | Omit = omit, + auth_enabled: bool | Omit = omit, + command: Optional[SequenceNotStr[str]] | Omit = omit, + containers: Optional[Iterable[deployment_update_params.Container]] | Omit = omit, + credentials_name: Optional[str] | Omit = omit, + description: Optional[str] | Omit = omit, + envs: Optional[Dict[str, str]] | Omit = omit, + flavor_name: str | Omit = omit, + image: Optional[str] | Omit = omit, + ingress_opts: Optional[deployment_update_params.IngressOpts] | Omit = omit, + listening_port: Optional[int] | Omit = omit, + logging: Optional[deployment_update_params.Logging] | Omit = omit, + probes: Optional[deployment_update_params.Probes] | Omit = omit, + api_timeout: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Update inference deployment @@ -293,14 +293,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[InferenceDeployment]: """List inference deployments @@ -353,7 +353,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete inference deployment @@ -393,7 +393,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceDeployment: """ Get inference deployment @@ -434,7 +434,7 @@ def get_api_key( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceDeploymentAPIKey: """ Get inference deployment API key @@ -474,7 +474,7 @@ def start( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ This operation initializes an inference deployment after it was stopped, making @@ -522,7 +522,7 @@ def stop( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ This operation shuts down an inference deployment, making it unavailable for @@ -594,22 +594,22 @@ async def create( image: str, listening_port: int, name: str, - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - credentials_name: Optional[str] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - envs: Dict[str, str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[deployment_create_params.IngressOpts] | NotGiven = NOT_GIVEN, - logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN, - probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN, - api_timeout: Optional[int] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | Omit = omit, + auth_enabled: bool | Omit = omit, + command: Optional[SequenceNotStr[str]] | Omit = omit, + credentials_name: Optional[str] | Omit = omit, + description: Optional[str] | Omit = omit, + envs: Dict[str, str] | Omit = omit, + ingress_opts: Optional[deployment_create_params.IngressOpts] | Omit = omit, + logging: Optional[deployment_create_params.Logging] | Omit = omit, + probes: Optional[deployment_create_params.Probes] | Omit = omit, + api_timeout: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create inference deployment @@ -705,26 +705,26 @@ async def update( deployment_name: str, *, project_id: int | None = None, - api_keys: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, - credentials_name: Optional[str] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - flavor_name: str | NotGiven = NOT_GIVEN, - image: Optional[str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[deployment_update_params.IngressOpts] | NotGiven = NOT_GIVEN, - listening_port: Optional[int] | NotGiven = NOT_GIVEN, - logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN, - probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN, - api_timeout: Optional[int] | NotGiven = NOT_GIVEN, + api_keys: Optional[SequenceNotStr[str]] | Omit = omit, + auth_enabled: bool | Omit = omit, + command: Optional[SequenceNotStr[str]] | Omit = omit, + containers: Optional[Iterable[deployment_update_params.Container]] | Omit = omit, + credentials_name: Optional[str] | Omit = omit, + description: Optional[str] | Omit = omit, + envs: Optional[Dict[str, str]] | Omit = omit, + flavor_name: str | Omit = omit, + image: Optional[str] | Omit = omit, + ingress_opts: Optional[deployment_update_params.IngressOpts] | Omit = omit, + listening_port: Optional[int] | Omit = omit, + logging: Optional[deployment_update_params.Logging] | Omit = omit, + probes: Optional[deployment_update_params.Probes] | Omit = omit, + api_timeout: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Update inference deployment @@ -819,14 +819,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InferenceDeployment, AsyncOffsetPage[InferenceDeployment]]: """List inference deployments @@ -879,7 +879,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete inference deployment @@ -919,7 +919,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceDeployment: """ Get inference deployment @@ -960,7 +960,7 @@ async def get_api_key( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceDeploymentAPIKey: """ Get inference deployment API key @@ -1000,7 +1000,7 @@ async def start( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ This operation initializes an inference deployment after it was stopped, making @@ -1048,7 +1048,7 @@ async def stop( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ This operation shuts down an inference deployment, making it unavailable for diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index 1cc65006..3a46cbd0 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -7,7 +7,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ....._utils import maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -50,16 +50,16 @@ def list( deployment_name: str, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["time.asc", "time.desc"] | NotGiven = NOT_GIVEN, - region_id: Optional[int] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["time.asc", "time.desc"] | Omit = omit, + region_id: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[InferenceDeploymentLog]: """ Get inference deployment logs @@ -137,16 +137,16 @@ def list( deployment_name: str, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["time.asc", "time.desc"] | NotGiven = NOT_GIVEN, - region_id: Optional[int] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["time.asc", "time.desc"] | Omit = omit, + region_id: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InferenceDeploymentLog, AsyncOffsetPage[InferenceDeploymentLog]]: """ Get inference deployment logs diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index d273b19b..c9934320 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -45,14 +45,14 @@ def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[InferenceFlavor]: """List inference flavors @@ -100,7 +100,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceFlavor: """ Get inference flavor @@ -150,14 +150,14 @@ def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InferenceFlavor, AsyncOffsetPage[InferenceFlavor]]: """List inference flavors @@ -205,7 +205,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceFlavor: """ Get inference flavor diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index 103c70f1..86dd2f3c 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -28,7 +28,7 @@ APIKeysResourceWithStreamingResponse, AsyncAPIKeysResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -119,7 +119,7 @@ def get_capacity_by_region( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return self._get( @@ -183,7 +183,7 @@ async def get_capacity_by_region( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return await self._get( diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 6dd78f70..c34dfc0a 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -59,7 +59,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegistryCredentials: """ Create inference registry credential @@ -106,14 +106,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[InferenceRegistryCredentials]: """ List inference registry credentials @@ -165,7 +165,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete inference registry credential @@ -206,7 +206,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegistryCredentials: """ Get inference registry credential @@ -249,7 +249,7 @@ def replace( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegistryCredentials: """ Replace inference registry credential @@ -327,7 +327,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegistryCredentials: """ Create inference registry credential @@ -374,14 +374,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InferenceRegistryCredentials, AsyncOffsetPage[InferenceRegistryCredentials]]: """ List inference registry credentials @@ -433,7 +433,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete inference registry credential @@ -474,7 +474,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegistryCredentials: """ Get inference registry credential @@ -517,7 +517,7 @@ async def replace( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegistryCredentials: """ Replace inference registry credential diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index 275ec3f2..6b168d22 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -54,7 +54,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceSecret: """ Create inference secret @@ -98,14 +98,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[InferenceSecret]: """List inference secrets @@ -158,7 +158,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete Inference Secret @@ -199,7 +199,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceSecret: """ Get inference secret @@ -241,7 +241,7 @@ def replace( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceSecret: """ Replace inference secret @@ -315,7 +315,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceSecret: """ Create inference secret @@ -359,14 +359,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InferenceSecret, AsyncOffsetPage[InferenceSecret]]: """List inference secrets @@ -419,7 +419,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete Inference Secret @@ -460,7 +460,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceSecret: """ Get inference secret @@ -502,7 +502,7 @@ async def replace( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceSecret: """ Replace inference secret diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 9bd7f38f..23ba0073 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -46,16 +46,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - disabled: bool | NotGiven = NOT_GIVEN, - exclude_linux: bool | NotGiven = NOT_GIVEN, - exclude_windows: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, + disabled: bool | Omit = omit, + exclude_linux: bool | Omit = omit, + exclude_windows: bool | Omit = omit, + include_prices: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceFlavorList: """Retrieve a list of available instance flavors in the project and region. @@ -130,16 +130,16 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - disabled: bool | NotGiven = NOT_GIVEN, - exclude_linux: bool | NotGiven = NOT_GIVEN, - exclude_windows: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, + disabled: bool | Omit = omit, + exclude_linux: bool | Omit = omit, + exclude_windows: bool | Omit = omit, + include_prices: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceFlavorList: """Retrieve a list of available instance flavors in the project and region. diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index af8e82a7..c23fde30 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -59,19 +59,19 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, - hw_machine_type: Literal["pc", "q35"] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + hw_firmware_type: Literal["bios", "uefi"] | Omit = omit, + hw_machine_type: Literal["pc", "q35"] | Omit = omit, + is_baremetal: bool | Omit = omit, + name: str | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Image: """ Update image properties and tags. @@ -134,17 +134,17 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, - private: str | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + include_prices: bool | Omit = omit, + private: str | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, + visibility: Literal["private", "public", "shared"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ImageList: """Retrieve a list of available images in the project and region. @@ -207,7 +207,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a specific image. @@ -244,20 +244,20 @@ def create_from_volume( region_id: int | None = None, name: str, volume_id: str, - architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - source: Literal["volume"] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + architecture: Literal["aarch64", "x86_64"] | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + hw_machine_type: Optional[Literal["pc", "q35"]] | Omit = omit, + is_baremetal: bool | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + source: Literal["volume"] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new image from a bootable volume. @@ -330,13 +330,13 @@ def get( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, + include_prices: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Image: """ Retrieve detailed information about a specific image. @@ -377,22 +377,22 @@ def upload( region_id: int | None = None, name: str, url: str, - architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - os_distro: Optional[str] | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - os_version: Optional[str] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + architecture: Literal["aarch64", "x86_64"] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + hw_machine_type: Optional[Literal["pc", "q35"]] | Omit = omit, + is_baremetal: bool | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Upload an image from a URL. @@ -493,19 +493,19 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, - hw_machine_type: Literal["pc", "q35"] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + hw_firmware_type: Literal["bios", "uefi"] | Omit = omit, + hw_machine_type: Literal["pc", "q35"] | Omit = omit, + is_baremetal: bool | Omit = omit, + name: str | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Image: """ Update image properties and tags. @@ -568,17 +568,17 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, - private: str | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + include_prices: bool | Omit = omit, + private: str | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, + visibility: Literal["private", "public", "shared"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ImageList: """Retrieve a list of available images in the project and region. @@ -641,7 +641,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a specific image. @@ -678,20 +678,20 @@ async def create_from_volume( region_id: int | None = None, name: str, volume_id: str, - architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - source: Literal["volume"] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + architecture: Literal["aarch64", "x86_64"] | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + hw_machine_type: Optional[Literal["pc", "q35"]] | Omit = omit, + is_baremetal: bool | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + source: Literal["volume"] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new image from a bootable volume. @@ -764,13 +764,13 @@ async def get( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, + include_prices: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Image: """ Retrieve detailed information about a specific image. @@ -811,22 +811,22 @@ async def upload( region_id: int | None = None, name: str, url: str, - architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - os_distro: Optional[str] | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - os_version: Optional[str] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + architecture: Literal["aarch64", "x86_64"] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + hw_machine_type: Optional[Literal["pc", "q35"]] | Omit = omit, + is_baremetal: bool | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Upload an image from a URL. diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 77fbc20b..a0dd4e65 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -32,7 +32,7 @@ MetricsResourceWithStreamingResponse, AsyncMetricsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import required_args, maybe_transform, async_maybe_transform from ...._compat import cached_property from .interfaces import ( @@ -116,23 +116,23 @@ def create( flavor: str, interfaces: Iterable[instance_create_params.Interface], volumes: Iterable[instance_create_params.Volume], - allow_app_ports: bool | NotGiven = NOT_GIVEN, - configuration: Optional[object] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, - servergroup_id: str | NotGiven = NOT_GIVEN, - ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, + allow_app_ports: bool | Omit = omit, + configuration: Optional[object] | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + password: str | Omit = omit, + security_groups: Iterable[instance_create_params.SecurityGroup] | Omit = omit, + servergroup_id: str | Omit = omit, + ssh_key_name: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + user_data: str | Omit = omit, + username: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create an instance with specified configuration. @@ -266,7 +266,7 @@ def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Instance: """ Rename instance @@ -308,25 +308,25 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - available_floating: bool | NotGiven = NOT_GIVEN, - changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN, - changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN, - exclude_flavor_prefix: str | NotGiven = NOT_GIVEN, - exclude_secgroup: str | NotGiven = NOT_GIVEN, - flavor_id: str | NotGiven = NOT_GIVEN, - flavor_prefix: str | NotGiven = NOT_GIVEN, - include_ai: bool | NotGiven = NOT_GIVEN, - include_baremetal: bool | NotGiven = NOT_GIVEN, - include_k8s: bool | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - only_isolated: bool | NotGiven = NOT_GIVEN, - only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN, - order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, - profile_name: str | NotGiven = NOT_GIVEN, - protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN, + available_floating: bool | Omit = omit, + changes_before: Union[str, datetime] | Omit = omit, + changes_since: Union[str, datetime] | Omit = omit, + exclude_flavor_prefix: str | Omit = omit, + exclude_secgroup: str | Omit = omit, + flavor_id: str | Omit = omit, + flavor_prefix: str | Omit = omit, + include_ai: bool | Omit = omit, + include_baremetal: bool | Omit = omit, + include_k8s: bool | Omit = omit, + ip: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + only_isolated: bool | Omit = omit, + only_with_fixed_external_ip: bool | Omit = omit, + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | Omit = omit, + profile_name: str | Omit = omit, + protection_status: Literal["Active", "Queued", "Error"] | Omit = omit, status: Literal[ "ACTIVE", "BUILD", @@ -345,19 +345,19 @@ def list( "SUSPENDED", "VERIFY_RESIZE", ] - | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - tag_value: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, - uuid: str | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, - with_interfaces_name: bool | NotGiven = NOT_GIVEN, + | Omit = omit, + tag_key_value: str | Omit = omit, + tag_value: SequenceNotStr[str] | Omit = omit, + type_ddos_profile: Literal["basic", "advanced"] | Omit = omit, + uuid: str | Omit = omit, + with_ddos: bool | Omit = omit, + with_interfaces_name: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Instance]: """List all instances in the specified project and region. @@ -492,16 +492,16 @@ def delete( *, project_id: int | None = None, region_id: int | None = None, - delete_floatings: bool | NotGiven = NOT_GIVEN, - floatings: str | NotGiven = NOT_GIVEN, - reserved_fixed_ips: str | NotGiven = NOT_GIVEN, - volumes: str | NotGiven = NOT_GIVEN, + delete_floatings: bool | Omit = omit, + floatings: str | Omit = omit, + reserved_fixed_ips: str | Omit = omit, + volumes: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete instance @@ -565,13 +565,13 @@ def action( project_id: int | None = None, region_id: int | None = None, action: Literal["start"], - activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + activate_profile: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ The action can be one of: start, stop, reboot, powercycle, suspend or resume. @@ -605,7 +605,7 @@ def action( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ The action can be one of: start, stop, reboot, powercycle, suspend or resume. @@ -632,13 +632,13 @@ def action( project_id: int | None = None, region_id: int | None = None, action: Literal["start"] | Literal["reboot", "reboot_hard", "resume", "stop", "suspend"], - activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + activate_profile: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -673,7 +673,7 @@ def add_to_placement_group( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Add an instance to a server group. @@ -715,15 +715,15 @@ def assign_security_group( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, + name: str | Omit = omit, ports_security_group_names: Iterable[instance_assign_security_group_params.PortsSecurityGroupName] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Assign the security group to the server. @@ -776,7 +776,7 @@ def disable_port_security( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceInterface: """ Disable port security for instance interface @@ -815,7 +815,7 @@ def enable_port_security( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceInterface: """ Enable port security for instance interface @@ -854,7 +854,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Instance: """Retrieve detailed information about a specific instance. @@ -903,13 +903,13 @@ def get_console( *, project_id: int | None = None, region_id: int | None = None, - console_type: str | NotGiven = NOT_GIVEN, + console_type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Console: """ Get instance console URL @@ -956,7 +956,7 @@ def remove_from_placement_group( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Remove an instance from its current server group. @@ -998,7 +998,7 @@ def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Change flavor of the instance @@ -1035,15 +1035,15 @@ def unassign_security_group( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, + name: str | Omit = omit, ports_security_group_names: Iterable[instance_unassign_security_group_params.PortsSecurityGroupName] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Un-assign the security group to the server. @@ -1130,23 +1130,23 @@ async def create( flavor: str, interfaces: Iterable[instance_create_params.Interface], volumes: Iterable[instance_create_params.Volume], - allow_app_ports: bool | NotGiven = NOT_GIVEN, - configuration: Optional[object] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, - servergroup_id: str | NotGiven = NOT_GIVEN, - ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, + allow_app_ports: bool | Omit = omit, + configuration: Optional[object] | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + password: str | Omit = omit, + security_groups: Iterable[instance_create_params.SecurityGroup] | Omit = omit, + servergroup_id: str | Omit = omit, + ssh_key_name: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + user_data: str | Omit = omit, + username: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create an instance with specified configuration. @@ -1280,7 +1280,7 @@ async def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Instance: """ Rename instance @@ -1322,25 +1322,25 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - available_floating: bool | NotGiven = NOT_GIVEN, - changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN, - changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN, - exclude_flavor_prefix: str | NotGiven = NOT_GIVEN, - exclude_secgroup: str | NotGiven = NOT_GIVEN, - flavor_id: str | NotGiven = NOT_GIVEN, - flavor_prefix: str | NotGiven = NOT_GIVEN, - include_ai: bool | NotGiven = NOT_GIVEN, - include_baremetal: bool | NotGiven = NOT_GIVEN, - include_k8s: bool | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - only_isolated: bool | NotGiven = NOT_GIVEN, - only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN, - order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, - profile_name: str | NotGiven = NOT_GIVEN, - protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN, + available_floating: bool | Omit = omit, + changes_before: Union[str, datetime] | Omit = omit, + changes_since: Union[str, datetime] | Omit = omit, + exclude_flavor_prefix: str | Omit = omit, + exclude_secgroup: str | Omit = omit, + flavor_id: str | Omit = omit, + flavor_prefix: str | Omit = omit, + include_ai: bool | Omit = omit, + include_baremetal: bool | Omit = omit, + include_k8s: bool | Omit = omit, + ip: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + only_isolated: bool | Omit = omit, + only_with_fixed_external_ip: bool | Omit = omit, + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | Omit = omit, + profile_name: str | Omit = omit, + protection_status: Literal["Active", "Queued", "Error"] | Omit = omit, status: Literal[ "ACTIVE", "BUILD", @@ -1359,19 +1359,19 @@ def list( "SUSPENDED", "VERIFY_RESIZE", ] - | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - tag_value: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, - uuid: str | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, - with_interfaces_name: bool | NotGiven = NOT_GIVEN, + | Omit = omit, + tag_key_value: str | Omit = omit, + tag_value: SequenceNotStr[str] | Omit = omit, + type_ddos_profile: Literal["basic", "advanced"] | Omit = omit, + uuid: str | Omit = omit, + with_ddos: bool | Omit = omit, + with_interfaces_name: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Instance, AsyncOffsetPage[Instance]]: """List all instances in the specified project and region. @@ -1506,16 +1506,16 @@ async def delete( *, project_id: int | None = None, region_id: int | None = None, - delete_floatings: bool | NotGiven = NOT_GIVEN, - floatings: str | NotGiven = NOT_GIVEN, - reserved_fixed_ips: str | NotGiven = NOT_GIVEN, - volumes: str | NotGiven = NOT_GIVEN, + delete_floatings: bool | Omit = omit, + floatings: str | Omit = omit, + reserved_fixed_ips: str | Omit = omit, + volumes: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete instance @@ -1579,13 +1579,13 @@ async def action( project_id: int | None = None, region_id: int | None = None, action: Literal["start"], - activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + activate_profile: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ The action can be one of: start, stop, reboot, powercycle, suspend or resume. @@ -1619,7 +1619,7 @@ async def action( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ The action can be one of: start, stop, reboot, powercycle, suspend or resume. @@ -1646,13 +1646,13 @@ async def action( project_id: int | None = None, region_id: int | None = None, action: Literal["start"] | Literal["reboot", "reboot_hard", "resume", "stop", "suspend"], - activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + activate_profile: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -1687,7 +1687,7 @@ async def add_to_placement_group( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Add an instance to a server group. @@ -1729,15 +1729,15 @@ async def assign_security_group( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, + name: str | Omit = omit, ports_security_group_names: Iterable[instance_assign_security_group_params.PortsSecurityGroupName] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Assign the security group to the server. @@ -1790,7 +1790,7 @@ async def disable_port_security( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceInterface: """ Disable port security for instance interface @@ -1829,7 +1829,7 @@ async def enable_port_security( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceInterface: """ Enable port security for instance interface @@ -1868,7 +1868,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Instance: """Retrieve detailed information about a specific instance. @@ -1917,13 +1917,13 @@ async def get_console( *, project_id: int | None = None, region_id: int | None = None, - console_type: str | NotGiven = NOT_GIVEN, + console_type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Console: """ Get instance console URL @@ -1970,7 +1970,7 @@ async def remove_from_placement_group( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Remove an instance from its current server group. @@ -2012,7 +2012,7 @@ async def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Change flavor of the instance @@ -2049,15 +2049,15 @@ async def unassign_security_group( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, + name: str | Omit = omit, ports_security_group_names: Iterable[instance_unassign_security_group_params.PortsSecurityGroupName] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Un-assign the security group to the server. diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 61fe4266..261241ba 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -56,7 +56,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> NetworkInterfaceList: """ List all network interfaces attached to the specified instance. @@ -91,20 +91,19 @@ def attach( *, project_id: int | None = None, region_id: int | None = None, - ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -140,18 +139,17 @@ def attach( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, - security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -187,19 +185,18 @@ def attach( project_id: int | None = None, region_id: int | None = None, network_id: str, - ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, - security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -237,18 +234,17 @@ def attach( project_id: int | None = None, region_id: int | None = None, port_id: str, - ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, - security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -286,25 +282,25 @@ def attach( | interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] | Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -347,7 +343,7 @@ def detach( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Detach interface from instance @@ -418,7 +414,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> NetworkInterfaceList: """ List all network interfaces attached to the specified instance. @@ -453,20 +449,19 @@ async def attach( *, project_id: int | None = None, region_id: int | None = None, - ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -502,18 +497,17 @@ async def attach( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, - security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -549,19 +543,18 @@ async def attach( project_id: int | None = None, region_id: int | None = None, network_id: str, - ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, - security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -599,18 +592,17 @@ async def attach( project_id: int | None = None, region_id: int | None = None, port_id: str, - ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, - security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -648,25 +640,25 @@ async def attach( | interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] | Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -709,7 +701,7 @@ async def detach( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Detach interface from instance diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index fa058434..c24b208c 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -56,7 +56,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> MetricsList: """ Get instance metrics, including cpu, memory, network and disk metrics @@ -135,7 +135,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> MetricsList: """ Get instance metrics, including cpu, memory, network and disk metrics diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index 12024d04..fe7f9a68 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -47,7 +47,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPRanges: """ Returns the complete list of IPv4 and IPv6 address ranges that Cloud uses for @@ -103,7 +103,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPRanges: """ Returns the complete list of IPv4 and IPv6 address ranges that Cloud uses for diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index a778a3b9..2ab3669e 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -14,7 +14,7 @@ NodesResourceWithStreamingResponse, AsyncNodesResourceWithStreamingResponse, ) -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from .pools.pools import ( @@ -86,25 +86,25 @@ def create( name: str, pools: Iterable[cluster_create_params.Pool], version: str, - authentication: Optional[cluster_create_params.Authentication] | NotGiven = NOT_GIVEN, - autoscaler_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - cni: Optional[cluster_create_params.Cni] | NotGiven = NOT_GIVEN, - csi: cluster_create_params.Csi | NotGiven = NOT_GIVEN, - ddos_profile: Optional[cluster_create_params.DDOSProfile] | NotGiven = NOT_GIVEN, - fixed_network: Optional[str] | NotGiven = NOT_GIVEN, - fixed_subnet: Optional[str] | NotGiven = NOT_GIVEN, - is_ipv6: Optional[bool] | NotGiven = NOT_GIVEN, - logging: Optional[cluster_create_params.Logging] | NotGiven = NOT_GIVEN, - pods_ip_pool: Optional[str] | NotGiven = NOT_GIVEN, - pods_ipv6_pool: Optional[str] | NotGiven = NOT_GIVEN, - services_ip_pool: Optional[str] | NotGiven = NOT_GIVEN, - services_ipv6_pool: Optional[str] | NotGiven = NOT_GIVEN, + authentication: Optional[cluster_create_params.Authentication] | Omit = omit, + autoscaler_config: Optional[Dict[str, str]] | Omit = omit, + cni: Optional[cluster_create_params.Cni] | Omit = omit, + csi: cluster_create_params.Csi | Omit = omit, + ddos_profile: Optional[cluster_create_params.DDOSProfile] | Omit = omit, + fixed_network: Optional[str] | Omit = omit, + fixed_subnet: Optional[str] | Omit = omit, + is_ipv6: Optional[bool] | Omit = omit, + logging: Optional[cluster_create_params.Logging] | Omit = omit, + pods_ip_pool: Optional[str] | Omit = omit, + pods_ipv6_pool: Optional[str] | Omit = omit, + services_ip_pool: Optional[str] | Omit = omit, + services_ipv6_pool: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create k8s cluster @@ -245,17 +245,17 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - authentication: Optional[cluster_update_params.Authentication] | NotGiven = NOT_GIVEN, - autoscaler_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - cni: Optional[cluster_update_params.Cni] | NotGiven = NOT_GIVEN, - ddos_profile: Optional[cluster_update_params.DDOSProfile] | NotGiven = NOT_GIVEN, - logging: Optional[cluster_update_params.Logging] | NotGiven = NOT_GIVEN, + authentication: Optional[cluster_update_params.Authentication] | Omit = omit, + autoscaler_config: Optional[Dict[str, str]] | Omit = omit, + cni: Optional[cluster_update_params.Cni] | Omit = omit, + ddos_profile: Optional[cluster_update_params.DDOSProfile] | Omit = omit, + logging: Optional[cluster_update_params.Logging] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Update k8s cluster @@ -366,7 +366,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterList: """ List k8s clusters @@ -398,13 +398,13 @@ def delete( *, project_id: int | None = None, region_id: int | None = None, - volumes: str | NotGiven = NOT_GIVEN, + volumes: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete k8s cluster @@ -449,7 +449,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sCluster: """ Get k8s cluster @@ -488,7 +488,7 @@ def get_certificate( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterCertificate: """ Get k8s cluster CA certificate @@ -527,7 +527,7 @@ def get_kubeconfig( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterKubeconfig: """ Get k8s cluster kubeconfig @@ -566,7 +566,7 @@ def list_versions_for_upgrade( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterVersionList: """ List available k8s cluster versions for upgrade @@ -606,7 +606,7 @@ def upgrade( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Upgrade k8s cluster @@ -675,25 +675,25 @@ async def create( name: str, pools: Iterable[cluster_create_params.Pool], version: str, - authentication: Optional[cluster_create_params.Authentication] | NotGiven = NOT_GIVEN, - autoscaler_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - cni: Optional[cluster_create_params.Cni] | NotGiven = NOT_GIVEN, - csi: cluster_create_params.Csi | NotGiven = NOT_GIVEN, - ddos_profile: Optional[cluster_create_params.DDOSProfile] | NotGiven = NOT_GIVEN, - fixed_network: Optional[str] | NotGiven = NOT_GIVEN, - fixed_subnet: Optional[str] | NotGiven = NOT_GIVEN, - is_ipv6: Optional[bool] | NotGiven = NOT_GIVEN, - logging: Optional[cluster_create_params.Logging] | NotGiven = NOT_GIVEN, - pods_ip_pool: Optional[str] | NotGiven = NOT_GIVEN, - pods_ipv6_pool: Optional[str] | NotGiven = NOT_GIVEN, - services_ip_pool: Optional[str] | NotGiven = NOT_GIVEN, - services_ipv6_pool: Optional[str] | NotGiven = NOT_GIVEN, + authentication: Optional[cluster_create_params.Authentication] | Omit = omit, + autoscaler_config: Optional[Dict[str, str]] | Omit = omit, + cni: Optional[cluster_create_params.Cni] | Omit = omit, + csi: cluster_create_params.Csi | Omit = omit, + ddos_profile: Optional[cluster_create_params.DDOSProfile] | Omit = omit, + fixed_network: Optional[str] | Omit = omit, + fixed_subnet: Optional[str] | Omit = omit, + is_ipv6: Optional[bool] | Omit = omit, + logging: Optional[cluster_create_params.Logging] | Omit = omit, + pods_ip_pool: Optional[str] | Omit = omit, + pods_ipv6_pool: Optional[str] | Omit = omit, + services_ip_pool: Optional[str] | Omit = omit, + services_ipv6_pool: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create k8s cluster @@ -834,17 +834,17 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - authentication: Optional[cluster_update_params.Authentication] | NotGiven = NOT_GIVEN, - autoscaler_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - cni: Optional[cluster_update_params.Cni] | NotGiven = NOT_GIVEN, - ddos_profile: Optional[cluster_update_params.DDOSProfile] | NotGiven = NOT_GIVEN, - logging: Optional[cluster_update_params.Logging] | NotGiven = NOT_GIVEN, + authentication: Optional[cluster_update_params.Authentication] | Omit = omit, + autoscaler_config: Optional[Dict[str, str]] | Omit = omit, + cni: Optional[cluster_update_params.Cni] | Omit = omit, + ddos_profile: Optional[cluster_update_params.DDOSProfile] | Omit = omit, + logging: Optional[cluster_update_params.Logging] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Update k8s cluster @@ -955,7 +955,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterList: """ List k8s clusters @@ -987,13 +987,13 @@ async def delete( *, project_id: int | None = None, region_id: int | None = None, - volumes: str | NotGiven = NOT_GIVEN, + volumes: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete k8s cluster @@ -1038,7 +1038,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sCluster: """ Get k8s cluster @@ -1077,7 +1077,7 @@ async def get_certificate( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterCertificate: """ Get k8s cluster CA certificate @@ -1116,7 +1116,7 @@ async def get_kubeconfig( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterKubeconfig: """ Get k8s cluster kubeconfig @@ -1155,7 +1155,7 @@ async def list_versions_for_upgrade( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterVersionList: """ List available k8s cluster versions for upgrade @@ -1195,7 +1195,7 @@ async def upgrade( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Upgrade k8s cluster diff --git a/src/gcore/resources/cloud/k8s/clusters/nodes.py b/src/gcore/resources/cloud/k8s/clusters/nodes.py index b3bd95d8..4518d8b9 100644 --- a/src/gcore/resources/cloud/k8s/clusters/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/nodes.py @@ -4,7 +4,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ....._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -47,13 +47,13 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - with_ddos: bool | NotGiven = NOT_GIVEN, + with_ddos: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceList: """ List k8s cluster nodes @@ -99,7 +99,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ After deletion, the node will be automatically recreated to maintain the desired @@ -158,13 +158,13 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - with_ddos: bool | NotGiven = NOT_GIVEN, + with_ddos: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceList: """ List k8s cluster nodes @@ -210,7 +210,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ After deletion, the node will be automatically recreated to maintain the desired diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py index 903c428e..797c0e6e 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py @@ -4,7 +4,7 @@ import httpx -from ......_types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ......_types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ......_utils import maybe_transform, async_maybe_transform from ......_compat import cached_property from ......_resource import SyncAPIResource, AsyncAPIResource @@ -48,13 +48,13 @@ def list( project_id: int | None = None, region_id: int | None = None, cluster_name: str, - with_ddos: bool | NotGiven = NOT_GIVEN, + with_ddos: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceList: """ List k8s cluster pool nodes @@ -103,7 +103,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ After deletion, the node will be automatically recreated to maintain the desired @@ -165,13 +165,13 @@ async def list( project_id: int | None = None, region_id: int | None = None, cluster_name: str, - with_ddos: bool | NotGiven = NOT_GIVEN, + with_ddos: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceList: """ List k8s cluster pool nodes @@ -220,7 +220,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ After deletion, the node will be automatically recreated to maintain the desired diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 0cb81d5a..18e410c3 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -15,7 +15,7 @@ NodesResourceWithStreamingResponse, AsyncNodesResourceWithStreamingResponse, ) -from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ......_types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ......_utils import maybe_transform, async_maybe_transform from ......_compat import cached_property from ......_resource import SyncAPIResource, AsyncAPIResource @@ -67,23 +67,23 @@ def create( flavor_id: str, min_node_count: int, name: str, - auto_healing_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - boot_volume_size: Optional[int] | NotGiven = NOT_GIVEN, + auto_healing_enabled: Optional[bool] | Omit = omit, + boot_volume_size: Optional[int] | Omit = omit, boot_volume_type: Optional[Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]] - | NotGiven = NOT_GIVEN, - crio_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - is_public_ipv4: Optional[bool] | NotGiven = NOT_GIVEN, - kubelet_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - labels: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - max_node_count: Optional[int] | NotGiven = NOT_GIVEN, - servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | NotGiven = NOT_GIVEN, - taints: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + | Omit = omit, + crio_config: Optional[Dict[str, str]] | Omit = omit, + is_public_ipv4: Optional[bool] | Omit = omit, + kubelet_config: Optional[Dict[str, str]] | Omit = omit, + labels: Optional[Dict[str, str]] | Omit = omit, + max_node_count: Optional[int] | Omit = omit, + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | Omit = omit, + taints: Optional[Dict[str, str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create k8s cluster pool @@ -162,18 +162,18 @@ def update( project_id: int | None = None, region_id: int | None = None, cluster_name: str, - auto_healing_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - labels: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - max_node_count: Optional[int] | NotGiven = NOT_GIVEN, - min_node_count: Optional[int] | NotGiven = NOT_GIVEN, - node_count: Optional[int] | NotGiven = NOT_GIVEN, - taints: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + auto_healing_enabled: Optional[bool] | Omit = omit, + labels: Optional[Dict[str, str]] | Omit = omit, + max_node_count: Optional[int] | Omit = omit, + min_node_count: Optional[int] | Omit = omit, + node_count: Optional[int] | Omit = omit, + taints: Optional[Dict[str, str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterPool: """ Update k8s cluster pool @@ -237,7 +237,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterPoolList: """ List k8s cluster pools @@ -277,7 +277,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete k8s cluster pool @@ -319,7 +319,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterPool: """ Get k8s cluster pool @@ -362,7 +362,7 @@ def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Resize k8s cluster pool @@ -429,23 +429,23 @@ async def create( flavor_id: str, min_node_count: int, name: str, - auto_healing_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - boot_volume_size: Optional[int] | NotGiven = NOT_GIVEN, + auto_healing_enabled: Optional[bool] | Omit = omit, + boot_volume_size: Optional[int] | Omit = omit, boot_volume_type: Optional[Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]] - | NotGiven = NOT_GIVEN, - crio_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - is_public_ipv4: Optional[bool] | NotGiven = NOT_GIVEN, - kubelet_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - labels: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - max_node_count: Optional[int] | NotGiven = NOT_GIVEN, - servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | NotGiven = NOT_GIVEN, - taints: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + | Omit = omit, + crio_config: Optional[Dict[str, str]] | Omit = omit, + is_public_ipv4: Optional[bool] | Omit = omit, + kubelet_config: Optional[Dict[str, str]] | Omit = omit, + labels: Optional[Dict[str, str]] | Omit = omit, + max_node_count: Optional[int] | Omit = omit, + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | Omit = omit, + taints: Optional[Dict[str, str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create k8s cluster pool @@ -524,18 +524,18 @@ async def update( project_id: int | None = None, region_id: int | None = None, cluster_name: str, - auto_healing_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - labels: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - max_node_count: Optional[int] | NotGiven = NOT_GIVEN, - min_node_count: Optional[int] | NotGiven = NOT_GIVEN, - node_count: Optional[int] | NotGiven = NOT_GIVEN, - taints: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + auto_healing_enabled: Optional[bool] | Omit = omit, + labels: Optional[Dict[str, str]] | Omit = omit, + max_node_count: Optional[int] | Omit = omit, + min_node_count: Optional[int] | Omit = omit, + node_count: Optional[int] | Omit = omit, + taints: Optional[Dict[str, str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterPool: """ Update k8s cluster pool @@ -599,7 +599,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterPoolList: """ List k8s cluster pools @@ -639,7 +639,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete k8s cluster pool @@ -681,7 +681,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterPool: """ Get k8s cluster pool @@ -724,7 +724,7 @@ async def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Resize k8s cluster pool diff --git a/src/gcore/resources/cloud/k8s/flavors.py b/src/gcore/resources/cloud/k8s/flavors.py index 71781231..0823633e 100644 --- a/src/gcore/resources/cloud/k8s/flavors.py +++ b/src/gcore/resources/cloud/k8s/flavors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -46,14 +46,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - exclude_gpu: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, + exclude_gpu: bool | Omit = omit, + include_prices: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BaremetalFlavorList: """Retrieve a list of flavors for k8s pool. @@ -122,14 +122,14 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - exclude_gpu: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, + exclude_gpu: bool | Omit = omit, + include_prices: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BaremetalFlavorList: """Retrieve a list of flavors for k8s pool. diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index ad74c5fd..f3ac5aff 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -12,7 +12,7 @@ FlavorsResourceWithStreamingResponse, AsyncFlavorsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -73,7 +73,7 @@ def list_versions( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterVersionList: """ List available k8s cluster versions for creation @@ -138,7 +138,7 @@ async def list_versions( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterVersionList: """ List available k8s cluster versions for creation diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index 48ba2c61..8d126cd7 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -46,13 +46,13 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, + include_prices: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerFlavorList: """Retrieve a list of load balancer flavors. @@ -113,13 +113,13 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, + include_prices: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerFlavorList: """Retrieve a list of load balancer flavors. diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index c78be82d..17a2a8ea 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py @@ -14,7 +14,7 @@ RulesResourceWithStreamingResponse, AsyncRulesResourceWithStreamingResponse, ) -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -64,19 +64,19 @@ def create( region_id: int | None = None, action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], listener_id: str, - name: str | NotGiven = NOT_GIVEN, - position: int | NotGiven = NOT_GIVEN, - redirect_http_code: int | NotGiven = NOT_GIVEN, - redirect_pool_id: str | NotGiven = NOT_GIVEN, - redirect_prefix: str | NotGiven = NOT_GIVEN, - redirect_url: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + redirect_pool_id: str | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_url: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer L7 policy @@ -149,7 +149,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7PolicyList: """ List load balancer L7 policies @@ -186,7 +186,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer L7 policy @@ -225,7 +225,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7Policy: """ Get load balancer L7 policy @@ -260,19 +260,19 @@ def replace( project_id: int | None = None, region_id: int | None = None, action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], - name: str | NotGiven = NOT_GIVEN, - position: int | NotGiven = NOT_GIVEN, - redirect_http_code: int | NotGiven = NOT_GIVEN, - redirect_pool_id: str | NotGiven = NOT_GIVEN, - redirect_prefix: str | NotGiven = NOT_GIVEN, - redirect_url: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + redirect_pool_id: str | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_url: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Replace load balancer L7 policy @@ -366,19 +366,19 @@ async def create( region_id: int | None = None, action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], listener_id: str, - name: str | NotGiven = NOT_GIVEN, - position: int | NotGiven = NOT_GIVEN, - redirect_http_code: int | NotGiven = NOT_GIVEN, - redirect_pool_id: str | NotGiven = NOT_GIVEN, - redirect_prefix: str | NotGiven = NOT_GIVEN, - redirect_url: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + redirect_pool_id: str | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_url: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer L7 policy @@ -451,7 +451,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7PolicyList: """ List load balancer L7 policies @@ -488,7 +488,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer L7 policy @@ -527,7 +527,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7Policy: """ Get load balancer L7 policy @@ -562,19 +562,19 @@ async def replace( project_id: int | None = None, region_id: int | None = None, action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], - name: str | NotGiven = NOT_GIVEN, - position: int | NotGiven = NOT_GIVEN, - redirect_http_code: int | NotGiven = NOT_GIVEN, - redirect_pool_id: str | NotGiven = NOT_GIVEN, - redirect_prefix: str | NotGiven = NOT_GIVEN, - redirect_url: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + redirect_pool_id: str | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_url: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Replace load balancer L7 policy diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py index 34063a17..c4ba95fd 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -6,7 +6,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -63,15 +63,15 @@ def create( "SSL_VERIFY_RESULT", ], value: str, - invert: bool | NotGiven = NOT_GIVEN, - key: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + invert: bool | Omit = omit, + key: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer L7 rule @@ -135,7 +135,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7RuleList: """ List load balancer L7 policy rules @@ -175,7 +175,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer L7 rule @@ -217,7 +217,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7Rule: """ Get load balancer L7 rule @@ -254,10 +254,10 @@ def replace( project_id: int | None = None, region_id: int | None = None, l7policy_id: str, - compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | NotGiven = NOT_GIVEN, - invert: bool | NotGiven = NOT_GIVEN, - key: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | Omit = omit, + invert: bool | Omit = omit, + key: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, type: Literal[ "COOKIE", "FILE_TYPE", @@ -268,14 +268,14 @@ def replace( "SSL_DN_FIELD", "SSL_VERIFY_RESULT", ] - | NotGiven = NOT_GIVEN, - value: str | NotGiven = NOT_GIVEN, + | Omit = omit, + value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Replace load balancer L7 rule properties @@ -369,15 +369,15 @@ async def create( "SSL_VERIFY_RESULT", ], value: str, - invert: bool | NotGiven = NOT_GIVEN, - key: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + invert: bool | Omit = omit, + key: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer L7 rule @@ -441,7 +441,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7RuleList: """ List load balancer L7 policy rules @@ -481,7 +481,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer L7 rule @@ -523,7 +523,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7Rule: """ Get load balancer L7 rule @@ -560,10 +560,10 @@ async def replace( project_id: int | None = None, region_id: int | None = None, l7policy_id: str, - compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | NotGiven = NOT_GIVEN, - invert: bool | NotGiven = NOT_GIVEN, - key: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | Omit = omit, + invert: bool | Omit = omit, + key: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, type: Literal[ "COOKIE", "FILE_TYPE", @@ -574,14 +574,14 @@ async def replace( "SSL_DN_FIELD", "SSL_VERIFY_RESULT", ] - | NotGiven = NOT_GIVEN, - value: str | NotGiven = NOT_GIVEN, + | Omit = omit, + value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Replace load balancer L7 rule properties diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index bf760cfb..8959a6b4 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -61,21 +61,21 @@ def create( name: str, protocol: LbListenerProtocol, protocol_port: int, - allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - connection_limit: int | NotGiven = NOT_GIVEN, - insert_x_forwarded: bool | NotGiven = NOT_GIVEN, - secret_id: str | NotGiven = NOT_GIVEN, - sni_secret_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - user_list: Iterable[listener_create_params.UserList] | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, + connection_limit: int | Omit = omit, + insert_x_forwarded: bool | Omit = omit, + secret_id: str | Omit = omit, + sni_secret_id: SequenceNotStr[str] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + user_list: Iterable[listener_create_params.UserList] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer listener @@ -158,21 +158,21 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - connection_limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - sni_secret_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - user_list: Optional[Iterable[listener_update_params.UserList]] | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, + connection_limit: int | Omit = omit, + name: str | Omit = omit, + secret_id: Optional[str] | Omit = omit, + sni_secret_id: Optional[SequenceNotStr[str]] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + user_list: Optional[Iterable[listener_update_params.UserList]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Update load balancer listener @@ -245,14 +245,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - loadbalancer_id: str | NotGiven = NOT_GIVEN, - show_stats: bool | NotGiven = NOT_GIVEN, + loadbalancer_id: str | Omit = omit, + show_stats: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerListenerList: """ List load balancer listeners @@ -307,7 +307,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer listener @@ -347,13 +347,13 @@ def get( *, project_id: int | None = None, region_id: int | None = None, - show_stats: bool | NotGiven = NOT_GIVEN, + show_stats: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerListenerDetail: """ Get load balancer listener @@ -423,21 +423,21 @@ async def create( name: str, protocol: LbListenerProtocol, protocol_port: int, - allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - connection_limit: int | NotGiven = NOT_GIVEN, - insert_x_forwarded: bool | NotGiven = NOT_GIVEN, - secret_id: str | NotGiven = NOT_GIVEN, - sni_secret_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - user_list: Iterable[listener_create_params.UserList] | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, + connection_limit: int | Omit = omit, + insert_x_forwarded: bool | Omit = omit, + secret_id: str | Omit = omit, + sni_secret_id: SequenceNotStr[str] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + user_list: Iterable[listener_create_params.UserList] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer listener @@ -520,21 +520,21 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - connection_limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - sni_secret_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - user_list: Optional[Iterable[listener_update_params.UserList]] | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, + connection_limit: int | Omit = omit, + name: str | Omit = omit, + secret_id: Optional[str] | Omit = omit, + sni_secret_id: Optional[SequenceNotStr[str]] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + user_list: Optional[Iterable[listener_update_params.UserList]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Update load balancer listener @@ -607,14 +607,14 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - loadbalancer_id: str | NotGiven = NOT_GIVEN, - show_stats: bool | NotGiven = NOT_GIVEN, + loadbalancer_id: str | Omit = omit, + show_stats: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerListenerList: """ List load balancer listeners @@ -669,7 +669,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer listener @@ -709,13 +709,13 @@ async def get( *, project_id: int | None = None, region_id: int | None = None, - show_stats: bool | NotGiven = NOT_GIVEN, + show_stats: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerListenerDetail: """ Get load balancer listener diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index f50f4ce5..b95d3332 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -30,7 +30,7 @@ StatusesResourceWithStreamingResponse, AsyncStatusesResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from .listeners import ( ListenersResource, @@ -134,24 +134,24 @@ def create( *, project_id: int | None = None, region_id: int | None = None, - flavor: str | NotGiven = NOT_GIVEN, - floating_ip: load_balancer_create_params.FloatingIP | NotGiven = NOT_GIVEN, - listeners: Iterable[load_balancer_create_params.Listener] | NotGiven = NOT_GIVEN, - logging: load_balancer_create_params.Logging | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, - vip_network_id: str | NotGiven = NOT_GIVEN, - vip_port_id: str | NotGiven = NOT_GIVEN, - vip_subnet_id: str | NotGiven = NOT_GIVEN, + flavor: str | Omit = omit, + floating_ip: load_balancer_create_params.FloatingIP | Omit = omit, + listeners: Iterable[load_balancer_create_params.Listener] | Omit = omit, + logging: load_balancer_create_params.Logging | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Dict[str, str] | Omit = omit, + vip_ip_family: InterfaceIPFamily | Omit = omit, + vip_network_id: str | Omit = omit, + vip_port_id: str | Omit = omit, + vip_subnet_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer @@ -237,16 +237,16 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - logging: load_balancer_update_params.Logging | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + logging: load_balancer_update_params.Logging | Omit = omit, + name: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancer: """ Rename load balancer, activate/deactivate logging, update preferred connectivity @@ -318,22 +318,22 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - assigned_floating: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - logging_enabled: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - show_stats: bool | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, + assigned_floating: bool | Omit = omit, + limit: int | Omit = omit, + logging_enabled: bool | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + show_stats: bool | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, + with_ddos: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[LoadBalancer]: """ List load balancers @@ -412,7 +412,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer @@ -446,13 +446,13 @@ def failover( *, project_id: int | None = None, region_id: int | None = None, - force: bool | NotGiven = NOT_GIVEN, + force: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Failover load balancer @@ -489,14 +489,14 @@ def get( *, project_id: int | None = None, region_id: int | None = None, - show_stats: bool | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, + show_stats: bool | Omit = omit, + with_ddos: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancer: """ Get load balancer @@ -550,7 +550,7 @@ def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Resize load balancer @@ -631,24 +631,24 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, - flavor: str | NotGiven = NOT_GIVEN, - floating_ip: load_balancer_create_params.FloatingIP | NotGiven = NOT_GIVEN, - listeners: Iterable[load_balancer_create_params.Listener] | NotGiven = NOT_GIVEN, - logging: load_balancer_create_params.Logging | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, - vip_network_id: str | NotGiven = NOT_GIVEN, - vip_port_id: str | NotGiven = NOT_GIVEN, - vip_subnet_id: str | NotGiven = NOT_GIVEN, + flavor: str | Omit = omit, + floating_ip: load_balancer_create_params.FloatingIP | Omit = omit, + listeners: Iterable[load_balancer_create_params.Listener] | Omit = omit, + logging: load_balancer_create_params.Logging | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Dict[str, str] | Omit = omit, + vip_ip_family: InterfaceIPFamily | Omit = omit, + vip_network_id: str | Omit = omit, + vip_port_id: str | Omit = omit, + vip_subnet_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer @@ -734,16 +734,16 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - logging: load_balancer_update_params.Logging | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + logging: load_balancer_update_params.Logging | Omit = omit, + name: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancer: """ Rename load balancer, activate/deactivate logging, update preferred connectivity @@ -815,22 +815,22 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - assigned_floating: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - logging_enabled: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - show_stats: bool | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, + assigned_floating: bool | Omit = omit, + limit: int | Omit = omit, + logging_enabled: bool | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + show_stats: bool | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, + with_ddos: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[LoadBalancer, AsyncOffsetPage[LoadBalancer]]: """ List load balancers @@ -909,7 +909,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer @@ -943,13 +943,13 @@ async def failover( *, project_id: int | None = None, region_id: int | None = None, - force: bool | NotGiven = NOT_GIVEN, + force: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Failover load balancer @@ -988,14 +988,14 @@ async def get( *, project_id: int | None = None, region_id: int | None = None, - show_stats: bool | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, + show_stats: bool | Omit = omit, + with_ddos: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancer: """ Get load balancer @@ -1049,7 +1049,7 @@ async def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Resize load balancer diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index 59df8038..38ecf843 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -56,7 +56,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerMetricsList: """ Get load balancer metrics, including cpu, memory and network @@ -129,7 +129,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerMetricsList: """ Get load balancer metrics, including cpu, memory and network diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index bae1858c..cc1baa93 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -6,7 +6,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ....._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -56,16 +56,16 @@ def create( max_retries: int, api_timeout: int, type: LbHealthMonitorType, - expected_codes: Optional[str] | NotGiven = NOT_GIVEN, - http_method: Optional[HTTPMethod] | NotGiven = NOT_GIVEN, - max_retries_down: int | NotGiven = NOT_GIVEN, - url_path: Optional[str] | NotGiven = NOT_GIVEN, + expected_codes: Optional[str] | Omit = omit, + http_method: Optional[HTTPMethod] | Omit = omit, + max_retries_down: int | Omit = omit, + url_path: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Creates a health monitor for a load balancer pool to automatically check the @@ -146,7 +146,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Removes the health monitor from a load balancer pool. @@ -215,16 +215,16 @@ async def create( max_retries: int, api_timeout: int, type: LbHealthMonitorType, - expected_codes: Optional[str] | NotGiven = NOT_GIVEN, - http_method: Optional[HTTPMethod] | NotGiven = NOT_GIVEN, - max_retries_down: int | NotGiven = NOT_GIVEN, - url_path: Optional[str] | NotGiven = NOT_GIVEN, + expected_codes: Optional[str] | Omit = omit, + http_method: Optional[HTTPMethod] | Omit = omit, + max_retries_down: int | Omit = omit, + url_path: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Creates a health monitor for a load balancer pool to automatically check the @@ -305,7 +305,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Removes the health monitor from a load balancer pool. diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 05091a8b..29d440f7 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -6,7 +6,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -51,19 +51,19 @@ def add( region_id: int | None = None, address: str, protocol_port: int, - admin_state_up: bool | NotGiven = NOT_GIVEN, - backup: bool | NotGiven = NOT_GIVEN, - instance_id: Optional[str] | NotGiven = NOT_GIVEN, - monitor_address: Optional[str] | NotGiven = NOT_GIVEN, - monitor_port: Optional[int] | NotGiven = NOT_GIVEN, - subnet_id: Optional[str] | NotGiven = NOT_GIVEN, - weight: int | NotGiven = NOT_GIVEN, + admin_state_up: bool | Omit = omit, + backup: bool | Omit = omit, + instance_id: Optional[str] | Omit = omit, + monitor_address: Optional[str] | Omit = omit, + monitor_port: Optional[int] | Omit = omit, + subnet_id: Optional[str] | Omit = omit, + weight: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer pool member @@ -164,7 +164,7 @@ def remove( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer pool member @@ -231,19 +231,19 @@ async def add( region_id: int | None = None, address: str, protocol_port: int, - admin_state_up: bool | NotGiven = NOT_GIVEN, - backup: bool | NotGiven = NOT_GIVEN, - instance_id: Optional[str] | NotGiven = NOT_GIVEN, - monitor_address: Optional[str] | NotGiven = NOT_GIVEN, - monitor_port: Optional[int] | NotGiven = NOT_GIVEN, - subnet_id: Optional[str] | NotGiven = NOT_GIVEN, - weight: int | NotGiven = NOT_GIVEN, + admin_state_up: bool | Omit = omit, + backup: bool | Omit = omit, + instance_id: Optional[str] | Omit = omit, + monitor_address: Optional[str] | Omit = omit, + monitor_port: Optional[int] | Omit = omit, + subnet_id: Optional[str] | Omit = omit, + weight: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer pool member @@ -344,7 +344,7 @@ async def remove( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer pool member diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index c0df516c..0db4b88d 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -14,7 +14,7 @@ MembersResourceWithStreamingResponse, AsyncMembersResourceWithStreamingResponse, ) -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -80,23 +80,23 @@ def create( lb_algorithm: LbAlgorithm, name: str, protocol: LbPoolProtocol, - ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - healthmonitor: Optional[pool_create_params.Healthmonitor] | NotGiven = NOT_GIVEN, - listener_id: Optional[str] | NotGiven = NOT_GIVEN, - loadbalancer_id: Optional[str] | NotGiven = NOT_GIVEN, - members: Optional[Iterable[pool_create_params.Member]] | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - session_persistence: Optional[pool_create_params.SessionPersistence] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + ca_secret_id: Optional[str] | Omit = omit, + crl_secret_id: Optional[str] | Omit = omit, + healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, + listener_id: Optional[str] | Omit = omit, + loadbalancer_id: Optional[str] | Omit = omit, + members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, + secret_id: Optional[str] | Omit = omit, + session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer pool @@ -179,24 +179,24 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - healthmonitor: Optional[pool_update_params.Healthmonitor] | NotGiven = NOT_GIVEN, - lb_algorithm: LbAlgorithm | NotGiven = NOT_GIVEN, - members: Optional[Iterable[pool_update_params.Member]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - protocol: LbPoolProtocol | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - session_persistence: Optional[pool_update_params.SessionPersistence] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + ca_secret_id: Optional[str] | Omit = omit, + crl_secret_id: Optional[str] | Omit = omit, + healthmonitor: Optional[pool_update_params.Healthmonitor] | Omit = omit, + lb_algorithm: LbAlgorithm | Omit = omit, + members: Optional[Iterable[pool_update_params.Member]] | Omit = omit, + name: str | Omit = omit, + protocol: LbPoolProtocol | Omit = omit, + secret_id: Optional[str] | Omit = omit, + session_persistence: Optional[pool_update_params.SessionPersistence] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Updates the specified load balancer pool with the provided changes. @@ -291,15 +291,15 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - details: bool | NotGiven = NOT_GIVEN, - listener_id: str | NotGiven = NOT_GIVEN, - loadbalancer_id: str | NotGiven = NOT_GIVEN, + details: bool | Omit = omit, + listener_id: str | Omit = omit, + loadbalancer_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerPoolList: """ List load balancer pools @@ -357,7 +357,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer pool @@ -402,7 +402,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerPool: """ Get load balancer pool @@ -473,23 +473,23 @@ async def create( lb_algorithm: LbAlgorithm, name: str, protocol: LbPoolProtocol, - ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - healthmonitor: Optional[pool_create_params.Healthmonitor] | NotGiven = NOT_GIVEN, - listener_id: Optional[str] | NotGiven = NOT_GIVEN, - loadbalancer_id: Optional[str] | NotGiven = NOT_GIVEN, - members: Optional[Iterable[pool_create_params.Member]] | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - session_persistence: Optional[pool_create_params.SessionPersistence] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + ca_secret_id: Optional[str] | Omit = omit, + crl_secret_id: Optional[str] | Omit = omit, + healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, + listener_id: Optional[str] | Omit = omit, + loadbalancer_id: Optional[str] | Omit = omit, + members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, + secret_id: Optional[str] | Omit = omit, + session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer pool @@ -572,24 +572,24 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - healthmonitor: Optional[pool_update_params.Healthmonitor] | NotGiven = NOT_GIVEN, - lb_algorithm: LbAlgorithm | NotGiven = NOT_GIVEN, - members: Optional[Iterable[pool_update_params.Member]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - protocol: LbPoolProtocol | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - session_persistence: Optional[pool_update_params.SessionPersistence] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + ca_secret_id: Optional[str] | Omit = omit, + crl_secret_id: Optional[str] | Omit = omit, + healthmonitor: Optional[pool_update_params.Healthmonitor] | Omit = omit, + lb_algorithm: LbAlgorithm | Omit = omit, + members: Optional[Iterable[pool_update_params.Member]] | Omit = omit, + name: str | Omit = omit, + protocol: LbPoolProtocol | Omit = omit, + secret_id: Optional[str] | Omit = omit, + session_persistence: Optional[pool_update_params.SessionPersistence] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Updates the specified load balancer pool with the provided changes. @@ -684,15 +684,15 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - details: bool | NotGiven = NOT_GIVEN, - listener_id: str | NotGiven = NOT_GIVEN, - loadbalancer_id: str | NotGiven = NOT_GIVEN, + details: bool | Omit = omit, + listener_id: str | Omit = omit, + loadbalancer_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerPoolList: """ List load balancer pools @@ -750,7 +750,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer pool @@ -795,7 +795,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerPool: """ Get load balancer pool diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 5579e857..624132ba 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -50,7 +50,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerStatusList: """ List load balancers statuses @@ -87,7 +87,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerStatus: """ Get load balancer status @@ -146,7 +146,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerStatusList: """ List load balancers statuses @@ -183,7 +183,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerStatus: """ Get load balancer status diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 2fda130e..fe4cf9c4 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -23,7 +23,7 @@ SubnetsResourceWithStreamingResponse, AsyncSubnetsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -77,15 +77,15 @@ def create( project_id: int | None = None, region_id: int | None = None, name: str, - create_router: bool | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, + create_router: bool | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type: Literal["vlan", "vxlan"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create network @@ -142,14 +142,14 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Network: """Rename network and/or update network tags. @@ -220,18 +220,18 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Network]: """ List networks @@ -301,7 +301,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete network @@ -346,7 +346,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Network: """ Get network @@ -415,15 +415,15 @@ async def create( project_id: int | None = None, region_id: int | None = None, name: str, - create_router: bool | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, + create_router: bool | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type: Literal["vlan", "vxlan"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create network @@ -480,14 +480,14 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Network: """Rename network and/or update network tags. @@ -558,18 +558,18 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Network, AsyncOffsetPage[Network]]: """ List networks @@ -639,7 +639,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete network @@ -684,7 +684,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Network: """ Get network diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 657982bd..52cf6cf8 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -57,15 +57,15 @@ def create( project_id: int | None = None, region_id: int | None = None, name: str, - external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, - interfaces: Optional[Iterable[router_create_params.Interface]] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[router_create_params.Route]] | NotGiven = NOT_GIVEN, + external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | Omit = omit, + interfaces: Optional[Iterable[router_create_params.Interface]] | Omit = omit, + routes: Optional[Iterable[router_create_params.Route]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new router with the specified configuration. @@ -114,15 +114,15 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[router_update_params.Route]] | NotGiven = NOT_GIVEN, + external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | Omit = omit, + name: Optional[str] | Omit = omit, + routes: Optional[Iterable[router_update_params.Route]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Update the configuration of an existing router. @@ -169,14 +169,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Router]: """ List all routers in the specified project and region. @@ -228,7 +228,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete a specific router and all its associated resources. @@ -263,13 +263,13 @@ def attach_subnet( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ip_address: str | NotGiven = NOT_GIVEN, + ip_address: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Attach a subnet to an existing router. @@ -327,7 +327,7 @@ def detach_subnet( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Detach a subnet from an existing router. @@ -369,7 +369,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Get detailed information about a specific router. @@ -424,15 +424,15 @@ async def create( project_id: int | None = None, region_id: int | None = None, name: str, - external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, - interfaces: Optional[Iterable[router_create_params.Interface]] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[router_create_params.Route]] | NotGiven = NOT_GIVEN, + external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | Omit = omit, + interfaces: Optional[Iterable[router_create_params.Interface]] | Omit = omit, + routes: Optional[Iterable[router_create_params.Route]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new router with the specified configuration. @@ -481,15 +481,15 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[router_update_params.Route]] | NotGiven = NOT_GIVEN, + external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | Omit = omit, + name: Optional[str] | Omit = omit, + routes: Optional[Iterable[router_update_params.Route]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Update the configuration of an existing router. @@ -536,14 +536,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Router, AsyncOffsetPage[Router]]: """ List all routers in the specified project and region. @@ -595,7 +595,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete a specific router and all its associated resources. @@ -630,13 +630,13 @@ async def attach_subnet( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ip_address: str | NotGiven = NOT_GIVEN, + ip_address: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Attach a subnet to an existing router. @@ -694,7 +694,7 @@ async def detach_subnet( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Detach a subnet from an existing router. @@ -738,7 +738,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Get detailed information about a specific router. diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index b781c2e3..1067a023 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -57,20 +57,20 @@ def create( cidr: str, name: str, network_id: str, - connect_to_network_router: bool | NotGiven = NOT_GIVEN, - dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - enable_dhcp: bool | NotGiven = NOT_GIVEN, - gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, - ip_version: IPVersion | NotGiven = NOT_GIVEN, - router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + connect_to_network_router: bool | Omit = omit, + dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, + enable_dhcp: bool | Omit = omit, + gateway_ip: Optional[str] | Omit = omit, + host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | Omit = omit, + ip_version: IPVersion | Omit = omit, + router_id_to_connect: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create subnet @@ -154,18 +154,18 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, - gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, + enable_dhcp: Optional[bool] | Omit = omit, + gateway_ip: Optional[str] | Omit = omit, + host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | Omit = omit, + name: Optional[str] | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subnet: """ Update subnet @@ -248,9 +248,9 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + network_id: str | Omit = omit, + offset: int | Omit = omit, order_by: Literal[ "available_ips.asc", "available_ips.desc", @@ -265,15 +265,15 @@ def list( "updated_at.asc", "updated_at.desc", ] - | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Subnet]: """ List subnets @@ -344,7 +344,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete subnet @@ -390,7 +390,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subnet: """ Get subnet @@ -453,20 +453,20 @@ async def create( cidr: str, name: str, network_id: str, - connect_to_network_router: bool | NotGiven = NOT_GIVEN, - dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - enable_dhcp: bool | NotGiven = NOT_GIVEN, - gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, - ip_version: IPVersion | NotGiven = NOT_GIVEN, - router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + connect_to_network_router: bool | Omit = omit, + dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, + enable_dhcp: bool | Omit = omit, + gateway_ip: Optional[str] | Omit = omit, + host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | Omit = omit, + ip_version: IPVersion | Omit = omit, + router_id_to_connect: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create subnet @@ -550,18 +550,18 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, - gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, + enable_dhcp: Optional[bool] | Omit = omit, + gateway_ip: Optional[str] | Omit = omit, + host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | Omit = omit, + name: Optional[str] | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subnet: """ Update subnet @@ -644,9 +644,9 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + network_id: str | Omit = omit, + offset: int | Omit = omit, order_by: Literal[ "available_ips.asc", "available_ips.desc", @@ -661,15 +661,15 @@ def list( "updated_at.asc", "updated_at.desc", ] - | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Subnet, AsyncOffsetPage[Subnet]]: """ List subnets @@ -740,7 +740,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete subnet @@ -786,7 +786,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subnet: """ Get subnet diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 31777c13..bb5119c8 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -57,7 +57,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlacementGroup: """ Create an affinity or anti-affinity or soft-anti-affinity placement group @@ -104,7 +104,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlacementGroupList: """ List placement groups @@ -141,7 +141,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete placement group @@ -180,7 +180,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlacementGroup: """ Get placement group @@ -241,7 +241,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlacementGroup: """ Create an affinity or anti-affinity or soft-anti-affinity placement group @@ -288,7 +288,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlacementGroupList: """ List placement groups @@ -325,7 +325,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete placement group @@ -364,7 +364,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlacementGroup: """ Get placement group diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 383f3c3b..cb6c69b4 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -50,15 +50,15 @@ def create( self, *, name: str, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - state: Optional[str] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, + description: Optional[str] | Omit = omit, + state: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """Create a new project for a client. @@ -102,18 +102,18 @@ def create( def list( self, *, - client_id: int | NotGiven = NOT_GIVEN, - include_deleted: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, + client_id: int | Omit = omit, + include_deleted: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Project]: """Retrieve a list of projects for a client. @@ -173,7 +173,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a project and all its associated cloud resources across all regions. @@ -209,7 +209,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Retrieve detailed information about a specific project. @@ -238,13 +238,13 @@ def replace( *, project_id: int | None = None, name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, + description: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """Update project name and description. @@ -306,15 +306,15 @@ async def create( self, *, name: str, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - state: Optional[str] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, + description: Optional[str] | Omit = omit, + state: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """Create a new project for a client. @@ -358,18 +358,18 @@ async def create( def list( self, *, - client_id: int | NotGiven = NOT_GIVEN, - include_deleted: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, + client_id: int | Omit = omit, + include_deleted: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Project, AsyncOffsetPage[Project]]: """Retrieve a list of projects for a client. @@ -429,7 +429,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a project and all its associated cloud resources across all regions. @@ -465,7 +465,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Retrieve detailed information about a specific project. @@ -494,13 +494,13 @@ async def replace( *, project_id: int | None = None, name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, + description: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """Update project name and description. diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 9a9f9c82..915d900d 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -12,7 +12,7 @@ RequestsResourceWithStreamingResponse, AsyncRequestsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -61,7 +61,7 @@ def get_all( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return self._get( @@ -82,7 +82,7 @@ def get_by_region( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QuotaGetByRegionResponse: """ Get quotas for a specific region and client. @@ -119,7 +119,7 @@ def get_global( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QuotaGetGlobalResponse: """ Get global quotas for a specific client. @@ -176,7 +176,7 @@ async def get_all( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return await self._get( @@ -197,7 +197,7 @@ async def get_by_region( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QuotaGetByRegionResponse: """ Get quotas for a specific region and client. @@ -234,7 +234,7 @@ async def get_global( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QuotaGetGlobalResponse: """ Get global quotas for a specific client. diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 79d4febe..6857110a 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -51,13 +51,13 @@ def create( *, description: str, requested_limits: request_create_params.RequestedLimits, - client_id: int | NotGiven = NOT_GIVEN, + client_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Create a request to change current quotas. @@ -97,15 +97,15 @@ def create( def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - status: List[Literal["done", "in progress", "rejected"]] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + status: List[Literal["done", "in progress", "rejected"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[RequestListResponse]: """ Get a list of sent requests to change current quotas and their statuses. @@ -155,7 +155,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific quota limit request. @@ -189,7 +189,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RequestGetResponse: """ Get detailed information about a specific quota limit request. @@ -239,13 +239,13 @@ async def create( *, description: str, requested_limits: request_create_params.RequestedLimits, - client_id: int | NotGiven = NOT_GIVEN, + client_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Create a request to change current quotas. @@ -285,15 +285,15 @@ async def create( def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - status: List[Literal["done", "in progress", "rejected"]] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + status: List[Literal["done", "in progress", "rejected"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[RequestListResponse, AsyncOffsetPage[RequestListResponse]]: """ Get a list of sent requests to change current quotas and their statuses. @@ -343,7 +343,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific quota limit request. @@ -377,7 +377,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RequestGetResponse: """ Get detailed information about a specific quota limit request. diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index b49adfcd..b9d06835 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -47,18 +47,17 @@ def with_streaming_response(self) -> RegionsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] - | NotGiven = NOT_GIVEN, - product: Literal["containers", "inference"] | NotGiven = NOT_GIVEN, - show_volume_types: bool | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] | Omit = omit, + product: Literal["containers", "inference"] | Omit = omit, + show_volume_types: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Region]: """List regions @@ -111,13 +110,13 @@ def get( self, *, region_id: int | None = None, - show_volume_types: bool | NotGiven = NOT_GIVEN, + show_volume_types: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Region: """ Get region @@ -174,18 +173,17 @@ def with_streaming_response(self) -> AsyncRegionsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] - | NotGiven = NOT_GIVEN, - product: Literal["containers", "inference"] | NotGiven = NOT_GIVEN, - show_volume_types: bool | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] | Omit = omit, + product: Literal["containers", "inference"] | Omit = omit, + show_volume_types: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Region, AsyncOffsetPage[Region]]: """List regions @@ -238,13 +236,13 @@ async def get( self, *, region_id: int | None = None, - show_volume_types: bool | NotGiven = NOT_GIVEN, + show_volume_types: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Region: """ Get region diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index 0b579ba5..4b07607a 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Query, Headers, NoneType, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -51,7 +51,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryArtifactList: """ List all artifacts in a specific repository. @@ -92,7 +92,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific artifact from a repository. @@ -156,7 +156,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryArtifactList: """ List all artifacts in a specific repository. @@ -197,7 +197,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific artifact from a repository. diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 8889d473..9ed4f0ec 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -20,7 +20,7 @@ UsersResourceWithStreamingResponse, AsyncUsersResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from .artifacts import ( ArtifactsResource, @@ -96,13 +96,13 @@ def create( project_id: int | None = None, region_id: int | None = None, name: str, - storage_limit: int | NotGiven = NOT_GIVEN, + storage_limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Registry: """ Create a new container registry with the specified configuration. @@ -150,7 +150,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryList: """ List all container registries in the specified project and region. @@ -187,7 +187,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific container registry and all its associated resources. @@ -225,7 +225,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Registry: """ Get detailed information about a specific container registry. @@ -257,13 +257,13 @@ def resize( *, project_id: int | None = None, region_id: int | None = None, - storage_limit: int | NotGiven = NOT_GIVEN, + storage_limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Registry: """ Update the size of a container registry. @@ -335,13 +335,13 @@ async def create( project_id: int | None = None, region_id: int | None = None, name: str, - storage_limit: int | NotGiven = NOT_GIVEN, + storage_limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Registry: """ Create a new container registry with the specified configuration. @@ -389,7 +389,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryList: """ List all container registries in the specified project and region. @@ -426,7 +426,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific container registry and all its associated resources. @@ -464,7 +464,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Registry: """ Get detailed information about a specific container registry. @@ -496,13 +496,13 @@ async def resize( *, project_id: int | None = None, region_id: int | None = None, - storage_limit: int | NotGiven = NOT_GIVEN, + storage_limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Registry: """ Update the size of a container registry. diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index 74377052..d0c860a9 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Query, Headers, NoneType, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -50,7 +50,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryRepositoryList: """ List all repositories in the container registry. @@ -88,7 +88,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific repository from the container registry. @@ -149,7 +149,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryRepositoryList: """ List all repositories in the container registry. @@ -187,7 +187,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific repository from the container registry. diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index ab35828c..74f68017 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Query, Headers, NoneType, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -52,7 +52,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific tag from an artifact. @@ -120,7 +120,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific tag from an artifact. diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index f535c7dd..110b6d2b 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -54,14 +54,14 @@ def create( region_id: int | None = None, duration: int, name: str, - read_only: bool | NotGiven = NOT_GIVEN, - secret: str | NotGiven = NOT_GIVEN, + read_only: bool | Omit = omit, + secret: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUserCreated: """ Create a new user for accessing the container registry. @@ -113,13 +113,13 @@ def update( region_id: int | None = None, registry_id: int, duration: int, - read_only: bool | NotGiven = NOT_GIVEN, + read_only: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUser: """ Update the configuration of a specific registry user. @@ -167,7 +167,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUserList: """ List all users with access to the container registry. @@ -205,7 +205,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific user from the container registry. @@ -244,7 +244,7 @@ def create_multiple( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUserCreated: """ Create multiple users for accessing the container registry in a single request. @@ -285,7 +285,7 @@ def refresh_secret( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserRefreshSecretResponse: """ Generate a new secret for a specific registry user. @@ -340,14 +340,14 @@ async def create( region_id: int | None = None, duration: int, name: str, - read_only: bool | NotGiven = NOT_GIVEN, - secret: str | NotGiven = NOT_GIVEN, + read_only: bool | Omit = omit, + secret: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUserCreated: """ Create a new user for accessing the container registry. @@ -399,13 +399,13 @@ async def update( region_id: int | None = None, registry_id: int, duration: int, - read_only: bool | NotGiven = NOT_GIVEN, + read_only: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUser: """ Update the configuration of a specific registry user. @@ -453,7 +453,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUserList: """ List all users with access to the container registry. @@ -491,7 +491,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific user from the container registry. @@ -530,7 +530,7 @@ async def create_multiple( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUserCreated: """ Create multiple users for accessing the container registry in a single request. @@ -571,7 +571,7 @@ async def refresh_secret( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserRefreshSecretResponse: """ Generate a new secret for a specific registry user. diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index d5b0e030..c76170a1 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -15,7 +15,7 @@ VipResourceWithStreamingResponse, AsyncVipResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import required_args, maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -66,14 +66,14 @@ def create( project_id: int | None = None, region_id: int | None = None, type: Literal["external"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -103,13 +103,13 @@ def create( region_id: int | None = None, subnet_id: str, type: Literal["subnet"], - is_vip: bool | NotGiven = NOT_GIVEN, + is_vip: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -139,14 +139,14 @@ def create( region_id: int | None = None, network_id: str, type: Literal["any_subnet"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -179,13 +179,13 @@ def create( ip_address: str, network_id: str, type: Literal["ip_address"], - is_vip: bool | NotGiven = NOT_GIVEN, + is_vip: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -222,7 +222,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -256,18 +256,18 @@ def create( project_id: int | None = None, region_id: int | None = None, type: Literal["external"] | Literal["subnet"] | Literal["any_subnet"] | Literal["ip_address"] | Literal["port"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + ip_address: str | Omit = omit, + port_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -298,21 +298,21 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - available_only: bool | NotGiven = NOT_GIVEN, - device_id: str | NotGiven = NOT_GIVEN, - external_only: bool | NotGiven = NOT_GIVEN, - internal_only: bool | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - vip_only: bool | NotGiven = NOT_GIVEN, + available_only: bool | Omit = omit, + device_id: str | Omit = omit, + external_only: bool | Omit = omit, + internal_only: bool | Omit = omit, + ip_address: str | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + vip_only: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[ReservedFixedIP]: """ List all reserved fixed IPs in the specified project and region. @@ -388,7 +388,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete a specific reserved fixed IP and all its associated resources. @@ -427,7 +427,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ReservedFixedIP: """ Get detailed information about a specific reserved fixed IP. @@ -487,14 +487,14 @@ async def create( project_id: int | None = None, region_id: int | None = None, type: Literal["external"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -524,13 +524,13 @@ async def create( region_id: int | None = None, subnet_id: str, type: Literal["subnet"], - is_vip: bool | NotGiven = NOT_GIVEN, + is_vip: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -560,14 +560,14 @@ async def create( region_id: int | None = None, network_id: str, type: Literal["any_subnet"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -600,13 +600,13 @@ async def create( ip_address: str, network_id: str, type: Literal["ip_address"], - is_vip: bool | NotGiven = NOT_GIVEN, + is_vip: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -643,7 +643,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -677,18 +677,18 @@ async def create( project_id: int | None = None, region_id: int | None = None, type: Literal["external"] | Literal["subnet"] | Literal["any_subnet"] | Literal["ip_address"] | Literal["port"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + ip_address: str | Omit = omit, + port_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -719,21 +719,21 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - available_only: bool | NotGiven = NOT_GIVEN, - device_id: str | NotGiven = NOT_GIVEN, - external_only: bool | NotGiven = NOT_GIVEN, - internal_only: bool | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - vip_only: bool | NotGiven = NOT_GIVEN, + available_only: bool | Omit = omit, + device_id: str | Omit = omit, + external_only: bool | Omit = omit, + internal_only: bool | Omit = omit, + ip_address: str | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + vip_only: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ReservedFixedIP, AsyncOffsetPage[ReservedFixedIP]]: """ List all reserved fixed IPs in the specified project and region. @@ -809,7 +809,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete a specific reserved fixed IP and all its associated resources. @@ -848,7 +848,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ReservedFixedIP: """ Get detailed information about a specific reserved fixed IP. diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 1d6c76e2..966a51e0 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -58,7 +58,7 @@ def list_candidate_ports( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CandidatePortList: """ List all instance ports that are available for connecting to a VIP. @@ -97,7 +97,7 @@ def list_connected_ports( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ List all instance ports that share a VIP. @@ -131,13 +131,13 @@ def replace_connected_ports( *, project_id: int | None = None, region_id: int | None = None, - port_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + port_ids: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ Replace the list of instance ports that share a VIP. @@ -182,7 +182,7 @@ def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ReservedFixedIP: """ Update the VIP status of a reserved fixed IP. @@ -219,13 +219,13 @@ def update_connected_ports( *, project_id: int | None = None, region_id: int | None = None, - port_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + port_ids: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ Add instance ports to share a VIP. @@ -290,7 +290,7 @@ async def list_candidate_ports( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CandidatePortList: """ List all instance ports that are available for connecting to a VIP. @@ -329,7 +329,7 @@ async def list_connected_ports( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ List all instance ports that share a VIP. @@ -363,13 +363,13 @@ async def replace_connected_ports( *, project_id: int | None = None, region_id: int | None = None, - port_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + port_ids: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ Replace the list of instance ports that share a VIP. @@ -414,7 +414,7 @@ async def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ReservedFixedIP: """ Update the VIP status of a reserved fixed IP. @@ -451,13 +451,13 @@ async def update_connected_ports( *, project_id: int | None = None, region_id: int | None = None, - port_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + port_ids: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ Add instance ports to share a VIP. diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 5cbefb25..e23a92ad 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -51,14 +51,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Secret]: """ List secrets @@ -115,7 +115,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete secret @@ -160,7 +160,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Get secret @@ -201,13 +201,13 @@ def upload_tls_certificate( region_id: int | None = None, name: str, payload: secret_upload_tls_certificate_params.Payload, - expiration: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + expiration: Union[str, datetime, None] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create secret @@ -277,14 +277,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Secret, AsyncOffsetPage[Secret]]: """ List secrets @@ -341,7 +341,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete secret @@ -386,7 +386,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Get secret @@ -427,13 +427,13 @@ async def upload_tls_certificate( region_id: int | None = None, name: str, payload: secret_upload_tls_certificate_params.Payload, - expiration: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + expiration: Union[str, datetime, None] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create secret diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index 89b27a23..aacd3921 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -50,11 +50,11 @@ def create( *, project_id: int | None = None, region_id: int | None = None, - description: str | NotGiven = NOT_GIVEN, - direction: Literal["egress", "ingress"] | NotGiven = NOT_GIVEN, - ethertype: Literal["IPv4", "IPv6"] | NotGiven = NOT_GIVEN, - port_range_max: Optional[int] | NotGiven = NOT_GIVEN, - port_range_min: Optional[int] | NotGiven = NOT_GIVEN, + description: str | Omit = omit, + direction: Literal["egress", "ingress"] | Omit = omit, + ethertype: Literal["IPv4", "IPv6"] | Omit = omit, + port_range_max: Optional[int] | Omit = omit, + port_range_min: Optional[int] | Omit = omit, protocol: Literal[ "ah", "any", @@ -81,15 +81,15 @@ def create( "udplite", "vrrp", ] - | NotGiven = NOT_GIVEN, - remote_group_id: str | NotGiven = NOT_GIVEN, - remote_ip_prefix: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + remote_group_id: str | Omit = omit, + remote_ip_prefix: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroupRule: """ Add a new rule to an existing security group. @@ -157,7 +157,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific rule from a security group. @@ -194,10 +194,10 @@ def replace( region_id: int | None = None, direction: Literal["egress", "ingress"], security_group_id: str, - description: str | NotGiven = NOT_GIVEN, - ethertype: Optional[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, - port_range_max: Optional[int] | NotGiven = NOT_GIVEN, - port_range_min: Optional[int] | NotGiven = NOT_GIVEN, + description: str | Omit = omit, + ethertype: Optional[Literal["IPv4", "IPv6"]] | Omit = omit, + port_range_max: Optional[int] | Omit = omit, + port_range_min: Optional[int] | Omit = omit, protocol: Literal[ "ah", "any", @@ -224,15 +224,15 @@ def replace( "udplite", "vrrp", ] - | NotGiven = NOT_GIVEN, - remote_group_id: Optional[str] | NotGiven = NOT_GIVEN, - remote_ip_prefix: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + remote_group_id: Optional[str] | Omit = omit, + remote_ip_prefix: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroupRule: """ Update the configuration of an existing security group rule. @@ -321,11 +321,11 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, - description: str | NotGiven = NOT_GIVEN, - direction: Literal["egress", "ingress"] | NotGiven = NOT_GIVEN, - ethertype: Literal["IPv4", "IPv6"] | NotGiven = NOT_GIVEN, - port_range_max: Optional[int] | NotGiven = NOT_GIVEN, - port_range_min: Optional[int] | NotGiven = NOT_GIVEN, + description: str | Omit = omit, + direction: Literal["egress", "ingress"] | Omit = omit, + ethertype: Literal["IPv4", "IPv6"] | Omit = omit, + port_range_max: Optional[int] | Omit = omit, + port_range_min: Optional[int] | Omit = omit, protocol: Literal[ "ah", "any", @@ -352,15 +352,15 @@ async def create( "udplite", "vrrp", ] - | NotGiven = NOT_GIVEN, - remote_group_id: str | NotGiven = NOT_GIVEN, - remote_ip_prefix: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + remote_group_id: str | Omit = omit, + remote_ip_prefix: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroupRule: """ Add a new rule to an existing security group. @@ -428,7 +428,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific rule from a security group. @@ -465,10 +465,10 @@ async def replace( region_id: int | None = None, direction: Literal["egress", "ingress"], security_group_id: str, - description: str | NotGiven = NOT_GIVEN, - ethertype: Optional[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, - port_range_max: Optional[int] | NotGiven = NOT_GIVEN, - port_range_min: Optional[int] | NotGiven = NOT_GIVEN, + description: str | Omit = omit, + ethertype: Optional[Literal["IPv4", "IPv6"]] | Omit = omit, + port_range_max: Optional[int] | Omit = omit, + port_range_min: Optional[int] | Omit = omit, protocol: Literal[ "ah", "any", @@ -495,15 +495,15 @@ async def replace( "udplite", "vrrp", ] - | NotGiven = NOT_GIVEN, - remote_group_id: Optional[str] | NotGiven = NOT_GIVEN, - remote_ip_prefix: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + remote_group_id: Optional[str] | Omit = omit, + remote_ip_prefix: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroupRule: """ Update the configuration of an existing security group rule. diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index ac4d9bc3..52c3c958 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -14,7 +14,7 @@ RulesResourceWithStreamingResponse, AsyncRulesResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -68,13 +68,13 @@ def create( project_id: int | None = None, region_id: int | None = None, security_group: security_group_create_params.SecurityGroup, - instances: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + instances: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Create a new security group with the specified configuration. @@ -117,15 +117,15 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - changed_rules: Iterable[security_group_update_params.ChangedRule] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + changed_rules: Iterable[security_group_update_params.ChangedRule] | Omit = omit, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Update the configuration of an existing security group. @@ -190,16 +190,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[SecurityGroup]: """ List all security groups in the specified project and region. @@ -257,7 +257,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific security group and all its associated rules. @@ -298,7 +298,7 @@ def copy( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Create a deep copy of an existing security group. @@ -340,7 +340,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Get detailed information about a specific security group. @@ -379,7 +379,7 @@ def revert_to_default( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Revert a security group to its previous state. @@ -438,13 +438,13 @@ async def create( project_id: int | None = None, region_id: int | None = None, security_group: security_group_create_params.SecurityGroup, - instances: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + instances: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Create a new security group with the specified configuration. @@ -487,15 +487,15 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - changed_rules: Iterable[security_group_update_params.ChangedRule] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + changed_rules: Iterable[security_group_update_params.ChangedRule] | Omit = omit, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Update the configuration of an existing security group. @@ -560,16 +560,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[SecurityGroup, AsyncOffsetPage[SecurityGroup]]: """ List all security groups in the specified project and region. @@ -627,7 +627,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific security group and all its associated rules. @@ -668,7 +668,7 @@ async def copy( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Create a deep copy of an existing security group. @@ -710,7 +710,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Get detailed information about a specific security group. @@ -749,7 +749,7 @@ async def revert_to_default( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Revert a security group to its previous state. diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 788d415c..061b0876 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -50,14 +50,14 @@ def create( *, project_id: int | None = None, name: str, - public_key: str | NotGiven = NOT_GIVEN, - shared_in_project: bool | NotGiven = NOT_GIVEN, + public_key: str | Omit = omit, + shared_in_project: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SSHKeyCreated: """ To generate a key, omit the `public_key` parameter from the request body @@ -116,7 +116,7 @@ def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SSHKey: """ Share or unshare SSH key with users @@ -153,15 +153,15 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[SSHKey]: """ List SSH keys @@ -215,7 +215,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete SSH key @@ -256,7 +256,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SSHKey: """ Get SSH key @@ -312,14 +312,14 @@ async def create( *, project_id: int | None = None, name: str, - public_key: str | NotGiven = NOT_GIVEN, - shared_in_project: bool | NotGiven = NOT_GIVEN, + public_key: str | Omit = omit, + shared_in_project: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SSHKeyCreated: """ To generate a key, omit the `public_key` parameter from the request body @@ -378,7 +378,7 @@ async def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SSHKey: """ Share or unshare SSH key with users @@ -417,15 +417,15 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[SSHKey, AsyncOffsetPage[SSHKey]]: """ List SSH keys @@ -479,7 +479,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete SSH key @@ -520,7 +520,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SSHKey: """ Get SSH key diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 63bc78f7..967c4f16 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -49,23 +49,23 @@ def with_streaming_response(self) -> TasksResourceWithStreamingResponse: def list( self, *, - from_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - is_acknowledged: Optional[bool] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - project_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - region_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] | NotGiven = NOT_GIVEN, - task_type: Optional[str] | NotGiven = NOT_GIVEN, - to_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + from_timestamp: Union[str, datetime, None] | Omit = omit, + is_acknowledged: Optional[bool] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["asc", "desc"] | Omit = omit, + project_id: Optional[Iterable[int]] | Omit = omit, + region_id: Optional[Iterable[int]] | Omit = omit, + sorting: Literal["asc", "desc"] | Omit = omit, + state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] | Omit = omit, + task_type: Optional[str] | Omit = omit, + to_timestamp: Union[str, datetime, None] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Task]: """List tasks @@ -186,14 +186,14 @@ def list( def acknowledge_all( self, *, - project_id: Optional[int] | NotGiven = NOT_GIVEN, - region_id: Optional[int] | NotGiven = NOT_GIVEN, + project_id: Optional[int] | Omit = omit, + region_id: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Acknowledge all tasks @@ -239,7 +239,7 @@ def acknowledge_one( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Task: """ Acknowledge one task @@ -274,7 +274,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Task: """ Get task @@ -324,23 +324,23 @@ def with_streaming_response(self) -> AsyncTasksResourceWithStreamingResponse: def list( self, *, - from_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - is_acknowledged: Optional[bool] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - project_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - region_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] | NotGiven = NOT_GIVEN, - task_type: Optional[str] | NotGiven = NOT_GIVEN, - to_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + from_timestamp: Union[str, datetime, None] | Omit = omit, + is_acknowledged: Optional[bool] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["asc", "desc"] | Omit = omit, + project_id: Optional[Iterable[int]] | Omit = omit, + region_id: Optional[Iterable[int]] | Omit = omit, + sorting: Literal["asc", "desc"] | Omit = omit, + state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] | Omit = omit, + task_type: Optional[str] | Omit = omit, + to_timestamp: Union[str, datetime, None] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Task, AsyncOffsetPage[Task]]: """List tasks @@ -461,14 +461,14 @@ def list( async def acknowledge_all( self, *, - project_id: Optional[int] | NotGiven = NOT_GIVEN, - region_id: Optional[int] | NotGiven = NOT_GIVEN, + project_id: Optional[int] | Omit = omit, + region_id: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Acknowledge all tasks @@ -514,7 +514,7 @@ async def acknowledge_one( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Task: """ Acknowledge one task @@ -549,7 +549,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Task: """ Get task diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index 0adc0809..8758b3ab 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -50,14 +50,14 @@ def get( *, time_from: Union[str, datetime], time_to: Union[str, datetime], - enable_last_day: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - projects: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - schema_filter: usage_report_get_params.SchemaFilter | NotGiven = NOT_GIVEN, - sorting: Iterable[usage_report_get_params.Sorting] | NotGiven = NOT_GIVEN, - tags: usage_report_get_params.Tags | NotGiven = NOT_GIVEN, + enable_last_day: bool | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + projects: Optional[Iterable[int]] | Omit = omit, + regions: Iterable[int] | Omit = omit, + schema_filter: usage_report_get_params.SchemaFilter | Omit = omit, + sorting: Iterable[usage_report_get_params.Sorting] | Omit = omit, + tags: usage_report_get_params.Tags | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -87,13 +87,13 @@ def get( "volume", ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UsageReport: """Receiving data from the past hour might lead to incomplete statistics. @@ -188,14 +188,14 @@ async def get( *, time_from: Union[str, datetime], time_to: Union[str, datetime], - enable_last_day: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - projects: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - schema_filter: usage_report_get_params.SchemaFilter | NotGiven = NOT_GIVEN, - sorting: Iterable[usage_report_get_params.Sorting] | NotGiven = NOT_GIVEN, - tags: usage_report_get_params.Tags | NotGiven = NOT_GIVEN, + enable_last_day: bool | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + projects: Optional[Iterable[int]] | Omit = omit, + regions: Iterable[int] | Omit = omit, + schema_filter: usage_report_get_params.SchemaFilter | Omit = omit, + sorting: Iterable[usage_report_get_params.Sorting] | Omit = omit, + tags: usage_report_get_params.Tags | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -225,13 +225,13 @@ async def get( "volume", ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UsageReport: """Receiving data from the past hour might lead to incomplete statistics. diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 5294d3a7..2f16d40d 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -55,14 +55,14 @@ def create( *, role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"], user_id: int, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - project_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, + project_id: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleAssignment: """ Assign a role to an existing user in the specified scope. @@ -107,14 +107,14 @@ def update( *, role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"], user_id: int, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - project_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, + project_id: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleAssignmentUpdateDelete: """ Modify an existing role assignment for a user. @@ -158,16 +158,16 @@ def update( def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - project_id: int | NotGiven = NOT_GIVEN, - user_id: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + project_id: int | Omit = omit, + user_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[RoleAssignment]: """ List all role assignments in the specified scope. @@ -220,7 +220,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleAssignmentUpdateDelete: """ Delete an existing role assignment. @@ -270,14 +270,14 @@ async def create( *, role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"], user_id: int, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - project_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, + project_id: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleAssignment: """ Assign a role to an existing user in the specified scope. @@ -322,14 +322,14 @@ async def update( *, role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"], user_id: int, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - project_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, + project_id: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleAssignmentUpdateDelete: """ Modify an existing role assignment for a user. @@ -373,16 +373,16 @@ async def update( def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - project_id: int | NotGiven = NOT_GIVEN, - user_id: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + project_id: int | Omit = omit, + user_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[RoleAssignment, AsyncOffsetPage[RoleAssignment]]: """ List all role assignments in the specified scope. @@ -435,7 +435,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleAssignmentUpdateDelete: """ Delete an existing role assignment. diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index ed0babaa..a9bff765 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ..._utils import required_args, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -66,18 +66,17 @@ def create( name: str, size: int, source: Literal["image"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new volume in the project and region. @@ -134,19 +133,18 @@ def create( name: str, snapshot_id: str, source: Literal["snapshot"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + size: int | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new volume in the project and region. @@ -204,18 +202,17 @@ def create( name: str, size: int, source: Literal["new-volume"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new volume in the project and region. @@ -269,23 +266,22 @@ def create( *, project_id: int | None = None, region_id: int | None = None, - image_id: str | NotGiven = NOT_GIVEN, + image_id: str | Omit = omit, name: str, - size: int | NotGiven = NOT_GIVEN, + size: int | Omit = omit, source: Literal["image"] | Literal["snapshot"] | Literal["new-volume"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, - snapshot_id: str | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | Omit = omit, + snapshot_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -320,14 +316,14 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Volume: """ Rename a volume or update tags @@ -395,22 +391,22 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - bootable: bool | NotGiven = NOT_GIVEN, - cluster_id: str | NotGiven = NOT_GIVEN, - has_attachments: bool | NotGiven = NOT_GIVEN, - id_part: str | NotGiven = NOT_GIVEN, - instance_id: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name_part: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + bootable: bool | Omit = omit, + cluster_id: str | Omit = omit, + has_attachments: bool | Omit = omit, + id_part: str | Omit = omit, + instance_id: str | Omit = omit, + limit: int | Omit = omit, + name_part: str | Omit = omit, + offset: int | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Volume]: """Retrieve a list of volumes in the project and region. @@ -490,13 +486,13 @@ def delete( *, project_id: int | None = None, region_id: int | None = None, - snapshots: str | NotGiven = NOT_GIVEN, + snapshots: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a volume and all its snapshots. @@ -545,13 +541,13 @@ def attach_to_instance( project_id: int | None = None, region_id: int | None = None, instance_id: str, - attachment_tag: str | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Attach the volume to instance. @@ -610,7 +606,7 @@ def change_type( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Volume: """Change the type of a volume. @@ -661,7 +657,7 @@ def detach_from_instance( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Detach the volume from instance @@ -711,7 +707,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Volume: """ Retrieve detailed information about a specific volume. @@ -757,7 +753,7 @@ def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Increase the size of a volume. @@ -807,7 +803,7 @@ def revert_to_last_snapshot( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Revert a volume to its last snapshot. @@ -875,18 +871,17 @@ async def create( name: str, size: int, source: Literal["image"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new volume in the project and region. @@ -943,19 +938,18 @@ async def create( name: str, snapshot_id: str, source: Literal["snapshot"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + size: int | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new volume in the project and region. @@ -1013,18 +1007,17 @@ async def create( name: str, size: int, source: Literal["new-volume"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new volume in the project and region. @@ -1078,23 +1071,22 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, - image_id: str | NotGiven = NOT_GIVEN, + image_id: str | Omit = omit, name: str, - size: int | NotGiven = NOT_GIVEN, + size: int | Omit = omit, source: Literal["image"] | Literal["snapshot"] | Literal["new-volume"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, - snapshot_id: str | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | Omit = omit, + snapshot_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -1129,14 +1121,14 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Volume: """ Rename a volume or update tags @@ -1204,22 +1196,22 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - bootable: bool | NotGiven = NOT_GIVEN, - cluster_id: str | NotGiven = NOT_GIVEN, - has_attachments: bool | NotGiven = NOT_GIVEN, - id_part: str | NotGiven = NOT_GIVEN, - instance_id: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name_part: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + bootable: bool | Omit = omit, + cluster_id: str | Omit = omit, + has_attachments: bool | Omit = omit, + id_part: str | Omit = omit, + instance_id: str | Omit = omit, + limit: int | Omit = omit, + name_part: str | Omit = omit, + offset: int | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Volume, AsyncOffsetPage[Volume]]: """Retrieve a list of volumes in the project and region. @@ -1299,13 +1291,13 @@ async def delete( *, project_id: int | None = None, region_id: int | None = None, - snapshots: str | NotGiven = NOT_GIVEN, + snapshots: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a volume and all its snapshots. @@ -1354,13 +1346,13 @@ async def attach_to_instance( project_id: int | None = None, region_id: int | None = None, instance_id: str, - attachment_tag: str | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Attach the volume to instance. @@ -1419,7 +1411,7 @@ async def change_type( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Volume: """Change the type of a volume. @@ -1472,7 +1464,7 @@ async def detach_from_instance( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Detach the volume from instance @@ -1522,7 +1514,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Volume: """ Retrieve detailed information about a specific volume. @@ -1568,7 +1560,7 @@ async def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Increase the size of a volume. @@ -1618,7 +1610,7 @@ async def revert_to_last_snapshot( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Revert a volume to its last snapshot. diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py index 3e6485d0..099fe2fd 100644 --- a/src/gcore/resources/dns/dns.py +++ b/src/gcore/resources/dns/dns.py @@ -14,7 +14,7 @@ MetricsResourceWithStreamingResponse, AsyncMetricsResourceWithStreamingResponse, ) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from .locations import ( @@ -100,7 +100,7 @@ def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSGetAccountOverviewResponse: """Get info about client""" return self._get( @@ -114,15 +114,15 @@ def get_account_overview( def lookup( self, *, - name: str | NotGiven = NOT_GIVEN, + name: str | Omit = omit, request_server: Literal["authoritative_dns", "google", "cloudflare", "open_dns", "quad9", "gcore"] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSLookupResponse: """ Get the dns records from a specific domain or ip. @@ -203,7 +203,7 @@ async def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSGetAccountOverviewResponse: """Get info about client""" return await self._get( @@ -217,15 +217,15 @@ async def get_account_overview( async def lookup( self, *, - name: str | NotGiven = NOT_GIVEN, + name: str | Omit = omit, request_server: Literal["authoritative_dns", "google", "cloudflare", "open_dns", "quad9", "gcore"] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSLookupResponse: """ Get the dns records from a specific domain or ip. diff --git a/src/gcore/resources/dns/locations.py b/src/gcore/resources/dns/locations.py index 20dcea5a..3b571e04 100644 --- a/src/gcore/resources/dns/locations.py +++ b/src/gcore/resources/dns/locations.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -50,7 +50,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return self._get( @@ -69,7 +69,7 @@ def list_continents( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListContinentsResponse: """List of All locations continents.""" return self._get( @@ -88,7 +88,7 @@ def list_countries( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListCountriesResponse: """List of All locations countries.""" return self._get( @@ -107,7 +107,7 @@ def list_regions( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListRegionsResponse: """List of All locations regions.""" return self._get( @@ -147,7 +147,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return await self._get( @@ -166,7 +166,7 @@ async def list_continents( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListContinentsResponse: """List of All locations continents.""" return await self._get( @@ -185,7 +185,7 @@ async def list_countries( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListCountriesResponse: """List of All locations countries.""" return await self._get( @@ -204,7 +204,7 @@ async def list_regions( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListRegionsResponse: """List of All locations regions.""" return await self._get( diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index 8eef7aeb..3359b610 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -45,14 +45,14 @@ def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: def list( self, *, - client_ids: Iterable[int] | NotGiven = NOT_GIVEN, - zone_names: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + client_ids: Iterable[int] | Omit = omit, + zone_names: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> str: """ Example of success response: @@ -123,14 +123,14 @@ def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: async def list( self, *, - client_ids: Iterable[int] | NotGiven = NOT_GIVEN, - zone_names: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + client_ids: Iterable[int] | Omit = omit, + zone_names: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> str: """ Example of success response: diff --git a/src/gcore/resources/dns/pickers/pickers.py b/src/gcore/resources/dns/pickers/pickers.py index 3078c7f2..c08f6586 100644 --- a/src/gcore/resources/dns/pickers/pickers.py +++ b/src/gcore/resources/dns/pickers/pickers.py @@ -12,7 +12,7 @@ PresetsResourceWithStreamingResponse, AsyncPresetsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -59,7 +59,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PickerListResponse: """Returns list of picker""" return self._get( @@ -103,7 +103,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PickerListResponse: """Returns list of picker""" return await self._get( diff --git a/src/gcore/resources/dns/pickers/presets.py b/src/gcore/resources/dns/pickers/presets.py index aebd10ff..a816c8cc 100644 --- a/src/gcore/resources/dns/pickers/presets.py +++ b/src/gcore/resources/dns/pickers/presets.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -47,7 +47,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PresetListResponse: """Returns list of picker preset""" return self._get( @@ -87,7 +87,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PresetListResponse: """Returns list of picker preset""" return await self._get( diff --git a/src/gcore/resources/dns/zones/dnssec.py b/src/gcore/resources/dns/zones/dnssec.py index 8c747071..e91a9d09 100644 --- a/src/gcore/resources/dns/zones/dnssec.py +++ b/src/gcore/resources/dns/zones/dnssec.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -46,13 +46,13 @@ def update( self, name: str, *, - enabled: bool | NotGiven = NOT_GIVEN, + enabled: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DnssecUpdateResponse: """ Enable or disable DNSSEC for a DNS zone. @@ -86,7 +86,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DnssecGetResponse: """ Get DNSSEC DS for a DNS zone. @@ -135,13 +135,13 @@ async def update( self, name: str, *, - enabled: bool | NotGiven = NOT_GIVEN, + enabled: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DnssecUpdateResponse: """ Enable or disable DNSSEC for a DNS zone. @@ -175,7 +175,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DnssecGetResponse: """ Get DNSSEC DS for a DNS zone. diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index e1d136b1..bba8e773 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -58,15 +58,15 @@ def create( zone_name: str, rrset_name: str, resource_records: Iterable[rrset_create_params.ResourceRecord], - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - pickers: Iterable[rrset_create_params.Picker] | NotGiven = NOT_GIVEN, - ttl: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | Omit = omit, + pickers: Iterable[rrset_create_params.Picker] | Omit = omit, + ttl: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSOutputRrset: """ Add the RRSet to the zone specified by zoneName, RRSets can be configured to be @@ -225,16 +225,16 @@ def list( self, zone_name: str, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + order_direction: Literal["asc", "desc"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RrsetListResponse: """ List of RRset. @@ -289,7 +289,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete RRset. @@ -328,7 +328,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSOutputRrset: """ Particular RRset item info @@ -362,14 +362,14 @@ def get_failover_logs( *, zone_name: str, rrset_name: str, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RrsetGetFailoverLogsResponse: """ Get failover history for the RRset @@ -418,15 +418,15 @@ def replace( zone_name: str, rrset_name: str, resource_records: Iterable[rrset_replace_params.ResourceRecord], - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - pickers: Iterable[rrset_replace_params.Picker] | NotGiven = NOT_GIVEN, - ttl: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | Omit = omit, + pickers: Iterable[rrset_replace_params.Picker] | Omit = omit, + ttl: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSOutputRrset: """ Create/update RRset. @@ -497,15 +497,15 @@ async def create( zone_name: str, rrset_name: str, resource_records: Iterable[rrset_create_params.ResourceRecord], - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - pickers: Iterable[rrset_create_params.Picker] | NotGiven = NOT_GIVEN, - ttl: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | Omit = omit, + pickers: Iterable[rrset_create_params.Picker] | Omit = omit, + ttl: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSOutputRrset: """ Add the RRSet to the zone specified by zoneName, RRSets can be configured to be @@ -664,16 +664,16 @@ async def list( self, zone_name: str, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + order_direction: Literal["asc", "desc"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RrsetListResponse: """ List of RRset. @@ -728,7 +728,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete RRset. @@ -767,7 +767,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSOutputRrset: """ Particular RRset item info @@ -801,14 +801,14 @@ async def get_failover_logs( *, zone_name: str, rrset_name: str, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RrsetGetFailoverLogsResponse: """ Get failover history for the RRset @@ -857,15 +857,15 @@ async def replace( zone_name: str, rrset_name: str, resource_records: Iterable[rrset_replace_params.ResourceRecord], - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - pickers: Iterable[rrset_replace_params.Picker] | NotGiven = NOT_GIVEN, - ttl: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | Omit = omit, + pickers: Iterable[rrset_replace_params.Picker] | Omit = omit, + ttl: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSOutputRrset: """ Create/update RRset. diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 2bef8d84..0a5e9535 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -24,7 +24,7 @@ RrsetsResourceWithStreamingResponse, AsyncRrsetsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -85,21 +85,21 @@ def create( self, *, name: str, - contact: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expiry: int | NotGiven = NOT_GIVEN, - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - nx_ttl: int | NotGiven = NOT_GIVEN, - primary_server: str | NotGiven = NOT_GIVEN, - refresh: int | NotGiven = NOT_GIVEN, - retry: int | NotGiven = NOT_GIVEN, - serial: int | NotGiven = NOT_GIVEN, + contact: str | Omit = omit, + enabled: bool | Omit = omit, + expiry: int | Omit = omit, + meta: Dict[str, object] | Omit = omit, + nx_ttl: int | Omit = omit, + primary_server: str | Omit = omit, + refresh: int | Omit = omit, + retry: int | Omit = omit, + serial: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneCreateResponse: """ Add DNS zone. @@ -168,29 +168,29 @@ def create( def list( self, *, - id: Iterable[int] | NotGiven = NOT_GIVEN, - case_sensitive: bool | NotGiven = NOT_GIVEN, - client_id: Iterable[int] | NotGiven = NOT_GIVEN, - dynamic: bool | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - exact_match: bool | NotGiven = NOT_GIVEN, - healthcheck: bool | NotGiven = NOT_GIVEN, - iam_reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, - status: str | NotGiven = NOT_GIVEN, - updated_at_from: Union[str, datetime] | NotGiven = NOT_GIVEN, - updated_at_to: Union[str, datetime] | NotGiven = NOT_GIVEN, + id: Iterable[int] | Omit = omit, + case_sensitive: bool | Omit = omit, + client_id: Iterable[int] | Omit = omit, + dynamic: bool | Omit = omit, + enabled: bool | Omit = omit, + exact_match: bool | Omit = omit, + healthcheck: bool | Omit = omit, + iam_reseller_id: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + name: SequenceNotStr[str] | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + order_direction: Literal["asc", "desc"] | Omit = omit, + reseller_id: Iterable[int] | Omit = omit, + status: str | Omit = omit, + updated_at_from: Union[str, datetime] | Omit = omit, + updated_at_to: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneListResponse: """Show created zones with pagination managed by limit and offset params. @@ -266,7 +266,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete DNS zone and its records and raws. @@ -299,7 +299,7 @@ def check_delegation_status( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneCheckDelegationStatusResponse: """Returns delegation status for specified domain name. @@ -334,7 +334,7 @@ def disable( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Disable DNS zone. @@ -367,7 +367,7 @@ def enable( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Enable DNS zone. @@ -400,7 +400,7 @@ def export( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneExportResponse: """ Export zone to bind9 format. @@ -433,7 +433,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneGetResponse: """ Zone info by zone name. @@ -461,16 +461,16 @@ def get_statistics( self, name: str, *, - from_: int | NotGiven = NOT_GIVEN, - granularity: str | NotGiven = NOT_GIVEN, - record_type: str | NotGiven = NOT_GIVEN, - to: int | NotGiven = NOT_GIVEN, + from_: int | Omit = omit, + granularity: str | Omit = omit, + record_type: str | Omit = omit, + to: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneGetStatisticsResponse: """Statistics of DNS zone in common and by record types. @@ -540,13 +540,13 @@ def import_( self, zone_name: str, *, - body: object | NotGiven = NOT_GIVEN, + body: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneImportResponse: """Import zone in bind9 format. @@ -596,21 +596,21 @@ def replace( path_name: str, *, body_name: str, - contact: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expiry: int | NotGiven = NOT_GIVEN, - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - nx_ttl: int | NotGiven = NOT_GIVEN, - primary_server: str | NotGiven = NOT_GIVEN, - refresh: int | NotGiven = NOT_GIVEN, - retry: int | NotGiven = NOT_GIVEN, - serial: int | NotGiven = NOT_GIVEN, + contact: str | Omit = omit, + enabled: bool | Omit = omit, + expiry: int | Omit = omit, + meta: Dict[str, object] | Omit = omit, + nx_ttl: int | Omit = omit, + primary_server: str | Omit = omit, + refresh: int | Omit = omit, + retry: int | Omit = omit, + serial: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Update DNS zone and SOA record. @@ -711,21 +711,21 @@ async def create( self, *, name: str, - contact: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expiry: int | NotGiven = NOT_GIVEN, - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - nx_ttl: int | NotGiven = NOT_GIVEN, - primary_server: str | NotGiven = NOT_GIVEN, - refresh: int | NotGiven = NOT_GIVEN, - retry: int | NotGiven = NOT_GIVEN, - serial: int | NotGiven = NOT_GIVEN, + contact: str | Omit = omit, + enabled: bool | Omit = omit, + expiry: int | Omit = omit, + meta: Dict[str, object] | Omit = omit, + nx_ttl: int | Omit = omit, + primary_server: str | Omit = omit, + refresh: int | Omit = omit, + retry: int | Omit = omit, + serial: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneCreateResponse: """ Add DNS zone. @@ -794,29 +794,29 @@ async def create( async def list( self, *, - id: Iterable[int] | NotGiven = NOT_GIVEN, - case_sensitive: bool | NotGiven = NOT_GIVEN, - client_id: Iterable[int] | NotGiven = NOT_GIVEN, - dynamic: bool | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - exact_match: bool | NotGiven = NOT_GIVEN, - healthcheck: bool | NotGiven = NOT_GIVEN, - iam_reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, - status: str | NotGiven = NOT_GIVEN, - updated_at_from: Union[str, datetime] | NotGiven = NOT_GIVEN, - updated_at_to: Union[str, datetime] | NotGiven = NOT_GIVEN, + id: Iterable[int] | Omit = omit, + case_sensitive: bool | Omit = omit, + client_id: Iterable[int] | Omit = omit, + dynamic: bool | Omit = omit, + enabled: bool | Omit = omit, + exact_match: bool | Omit = omit, + healthcheck: bool | Omit = omit, + iam_reseller_id: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + name: SequenceNotStr[str] | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + order_direction: Literal["asc", "desc"] | Omit = omit, + reseller_id: Iterable[int] | Omit = omit, + status: str | Omit = omit, + updated_at_from: Union[str, datetime] | Omit = omit, + updated_at_to: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneListResponse: """Show created zones with pagination managed by limit and offset params. @@ -892,7 +892,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete DNS zone and its records and raws. @@ -925,7 +925,7 @@ async def check_delegation_status( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneCheckDelegationStatusResponse: """Returns delegation status for specified domain name. @@ -960,7 +960,7 @@ async def disable( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Disable DNS zone. @@ -993,7 +993,7 @@ async def enable( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Enable DNS zone. @@ -1026,7 +1026,7 @@ async def export( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneExportResponse: """ Export zone to bind9 format. @@ -1059,7 +1059,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneGetResponse: """ Zone info by zone name. @@ -1087,16 +1087,16 @@ async def get_statistics( self, name: str, *, - from_: int | NotGiven = NOT_GIVEN, - granularity: str | NotGiven = NOT_GIVEN, - record_type: str | NotGiven = NOT_GIVEN, - to: int | NotGiven = NOT_GIVEN, + from_: int | Omit = omit, + granularity: str | Omit = omit, + record_type: str | Omit = omit, + to: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneGetStatisticsResponse: """Statistics of DNS zone in common and by record types. @@ -1166,13 +1166,13 @@ async def import_( self, zone_name: str, *, - body: object | NotGiven = NOT_GIVEN, + body: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneImportResponse: """Import zone in bind9 format. @@ -1222,21 +1222,21 @@ async def replace( path_name: str, *, body_name: str, - contact: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expiry: int | NotGiven = NOT_GIVEN, - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - nx_ttl: int | NotGiven = NOT_GIVEN, - primary_server: str | NotGiven = NOT_GIVEN, - refresh: int | NotGiven = NOT_GIVEN, - retry: int | NotGiven = NOT_GIVEN, - serial: int | NotGiven = NOT_GIVEN, + contact: str | Omit = omit, + enabled: bool | Omit = omit, + expiry: int | Omit = omit, + meta: Dict[str, object] | Omit = omit, + nx_ttl: int | Omit = omit, + primary_server: str | Omit = omit, + refresh: int | Omit = omit, + retry: int | Omit = omit, + serial: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Update DNS zone and SOA record. diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index 92d2662a..21e9fb4c 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -15,7 +15,7 @@ LogsResourceWithStreamingResponse, AsyncLogsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -61,23 +61,23 @@ def with_streaming_response(self) -> AppsResourceWithStreamingResponse: def create( self, *, - binary: int | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, - debug: bool | NotGiven = NOT_GIVEN, - env: Dict[str, str] | NotGiven = NOT_GIVEN, - log: Optional[Literal["kafka", "none"]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - rsp_headers: Dict[str, str] | NotGiven = NOT_GIVEN, - secrets: Dict[str, app_create_params.Secrets] | NotGiven = NOT_GIVEN, - status: int | NotGiven = NOT_GIVEN, - stores: Dict[str, int] | NotGiven = NOT_GIVEN, - template: int | NotGiven = NOT_GIVEN, + binary: int | Omit = omit, + comment: str | Omit = omit, + debug: bool | Omit = omit, + env: Dict[str, str] | Omit = omit, + log: Optional[Literal["kafka", "none"]] | Omit = omit, + name: str | Omit = omit, + rsp_headers: Dict[str, str] | Omit = omit, + secrets: Dict[str, app_create_params.Secrets] | Omit = omit, + status: int | Omit = omit, + stores: Dict[str, int] | Omit = omit, + template: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppShort: """ Add a new app @@ -148,23 +148,23 @@ def update( self, id: int, *, - binary: int | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, - debug: bool | NotGiven = NOT_GIVEN, - env: Dict[str, str] | NotGiven = NOT_GIVEN, - log: Optional[Literal["kafka", "none"]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - rsp_headers: Dict[str, str] | NotGiven = NOT_GIVEN, - secrets: Dict[str, app_update_params.Secrets] | NotGiven = NOT_GIVEN, - status: int | NotGiven = NOT_GIVEN, - stores: Dict[str, int] | NotGiven = NOT_GIVEN, - template: int | NotGiven = NOT_GIVEN, + binary: int | Omit = omit, + comment: str | Omit = omit, + debug: bool | Omit = omit, + env: Dict[str, str] | Omit = omit, + log: Optional[Literal["kafka", "none"]] | Omit = omit, + name: str | Omit = omit, + rsp_headers: Dict[str, str] | Omit = omit, + secrets: Dict[str, app_update_params.Secrets] | Omit = omit, + status: int | Omit = omit, + stores: Dict[str, int] | Omit = omit, + template: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppShort: """ Update app @@ -234,11 +234,11 @@ def update( def list( self, *, - api_type: Literal["wasi-http", "proxy-wasm"] | NotGiven = NOT_GIVEN, - binary: int | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + api_type: Literal["wasi-http", "proxy-wasm"] | Omit = omit, + binary: int | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "name", "-name", @@ -253,16 +253,16 @@ def list( "plan", "-plan", ] - | NotGiven = NOT_GIVEN, - plan: int | NotGiven = NOT_GIVEN, - status: int | NotGiven = NOT_GIVEN, - template: int | NotGiven = NOT_GIVEN, + | Omit = omit, + plan: int | Omit = omit, + status: int | Omit = omit, + template: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPageFastedgeApps[AppShort]: """ List client's apps @@ -339,7 +339,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete app @@ -371,7 +371,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> App: """ Get app details @@ -397,13 +397,13 @@ def replace( self, id: int, *, - body: app_replace_params.Body | NotGiven = NOT_GIVEN, + body: app_replace_params.Body | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppShort: """ Update an app @@ -454,23 +454,23 @@ def with_streaming_response(self) -> AsyncAppsResourceWithStreamingResponse: async def create( self, *, - binary: int | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, - debug: bool | NotGiven = NOT_GIVEN, - env: Dict[str, str] | NotGiven = NOT_GIVEN, - log: Optional[Literal["kafka", "none"]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - rsp_headers: Dict[str, str] | NotGiven = NOT_GIVEN, - secrets: Dict[str, app_create_params.Secrets] | NotGiven = NOT_GIVEN, - status: int | NotGiven = NOT_GIVEN, - stores: Dict[str, int] | NotGiven = NOT_GIVEN, - template: int | NotGiven = NOT_GIVEN, + binary: int | Omit = omit, + comment: str | Omit = omit, + debug: bool | Omit = omit, + env: Dict[str, str] | Omit = omit, + log: Optional[Literal["kafka", "none"]] | Omit = omit, + name: str | Omit = omit, + rsp_headers: Dict[str, str] | Omit = omit, + secrets: Dict[str, app_create_params.Secrets] | Omit = omit, + status: int | Omit = omit, + stores: Dict[str, int] | Omit = omit, + template: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppShort: """ Add a new app @@ -541,23 +541,23 @@ async def update( self, id: int, *, - binary: int | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, - debug: bool | NotGiven = NOT_GIVEN, - env: Dict[str, str] | NotGiven = NOT_GIVEN, - log: Optional[Literal["kafka", "none"]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - rsp_headers: Dict[str, str] | NotGiven = NOT_GIVEN, - secrets: Dict[str, app_update_params.Secrets] | NotGiven = NOT_GIVEN, - status: int | NotGiven = NOT_GIVEN, - stores: Dict[str, int] | NotGiven = NOT_GIVEN, - template: int | NotGiven = NOT_GIVEN, + binary: int | Omit = omit, + comment: str | Omit = omit, + debug: bool | Omit = omit, + env: Dict[str, str] | Omit = omit, + log: Optional[Literal["kafka", "none"]] | Omit = omit, + name: str | Omit = omit, + rsp_headers: Dict[str, str] | Omit = omit, + secrets: Dict[str, app_update_params.Secrets] | Omit = omit, + status: int | Omit = omit, + stores: Dict[str, int] | Omit = omit, + template: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppShort: """ Update app @@ -627,11 +627,11 @@ async def update( def list( self, *, - api_type: Literal["wasi-http", "proxy-wasm"] | NotGiven = NOT_GIVEN, - binary: int | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + api_type: Literal["wasi-http", "proxy-wasm"] | Omit = omit, + binary: int | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "name", "-name", @@ -646,16 +646,16 @@ def list( "plan", "-plan", ] - | NotGiven = NOT_GIVEN, - plan: int | NotGiven = NOT_GIVEN, - status: int | NotGiven = NOT_GIVEN, - template: int | NotGiven = NOT_GIVEN, + | Omit = omit, + plan: int | Omit = omit, + status: int | Omit = omit, + template: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AppShort, AsyncOffsetPageFastedgeApps[AppShort]]: """ List client's apps @@ -732,7 +732,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete app @@ -764,7 +764,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> App: """ Get app details @@ -790,13 +790,13 @@ async def replace( self, id: int, *, - body: app_replace_params.Body | NotGiven = NOT_GIVEN, + body: app_replace_params.Body | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppShort: """ Update an app diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py index f43d121c..8f589ab0 100644 --- a/src/gcore/resources/fastedge/apps/logs.py +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -8,7 +8,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -50,20 +50,20 @@ def list( self, id: int, *, - client_ip: str | NotGiven = NOT_GIVEN, - edge: str | NotGiven = NOT_GIVEN, - from_: Union[str, datetime] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - search: str | NotGiven = NOT_GIVEN, - sort: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, - to: Union[str, datetime] | NotGiven = NOT_GIVEN, + client_ip: str | Omit = omit, + edge: str | Omit = omit, + from_: Union[str, datetime] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + search: str | Omit = omit, + sort: Literal["desc", "asc"] | Omit = omit, + to: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPageFastedgeAppLogs[Log]: """ List logs for the app @@ -143,20 +143,20 @@ def list( self, id: int, *, - client_ip: str | NotGiven = NOT_GIVEN, - edge: str | NotGiven = NOT_GIVEN, - from_: Union[str, datetime] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - search: str | NotGiven = NOT_GIVEN, - sort: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, - to: Union[str, datetime] | NotGiven = NOT_GIVEN, + client_ip: str | Omit = omit, + edge: str | Omit = omit, + from_: Union[str, datetime] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + search: str | Omit = omit, + sort: Literal["desc", "asc"] | Omit = omit, + to: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Log, AsyncOffsetPageFastedgeAppLogs[Log]]: """ List logs for the app diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index 8323efb1..c88f90da 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -5,7 +5,7 @@ import httpx from ..._files import read_file_content, async_read_file_content -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileContent +from ..._types import Body, Query, Headers, NoneType, NotGiven, FileContent, not_given from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -51,7 +51,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BinaryShort: """ Store compiled WASM binary @@ -83,7 +83,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BinaryListResponse: """List binaries""" return self._get( @@ -103,7 +103,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a binary @@ -135,7 +135,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Binary: """ Get binary @@ -187,7 +187,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BinaryShort: """ Store compiled WASM binary @@ -219,7 +219,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BinaryListResponse: """List binaries""" return await self._get( @@ -239,7 +239,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a binary @@ -271,7 +271,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Binary: """ Get binary diff --git a/src/gcore/resources/fastedge/fastedge.py b/src/gcore/resources/fastedge/fastedge.py index 9b052788..d4ba7cf3 100644 --- a/src/gcore/resources/fastedge/fastedge.py +++ b/src/gcore/resources/fastedge/fastedge.py @@ -12,7 +12,7 @@ SecretsResourceWithStreamingResponse, AsyncSecretsResourceWithStreamingResponse, ) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from .binaries import ( BinariesResource, AsyncBinariesResource, @@ -119,7 +119,7 @@ def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Client: """Get status and limits for the client""" return self._get( @@ -183,7 +183,7 @@ async def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Client: """Get status and limits for the client""" return await self._get( diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py index cb007bbc..42193e54 100644 --- a/src/gcore/resources/fastedge/kv_stores.py +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -46,14 +46,14 @@ def with_streaming_response(self) -> KvStoresResourceWithStreamingResponse: def create( self, *, - byod: kv_store_create_params.Byod | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, + byod: kv_store_create_params.Byod | Omit = omit, + comment: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStore: """ Add a new KV store @@ -89,13 +89,13 @@ def create( def list( self, *, - app_id: int | NotGiven = NOT_GIVEN, + app_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStoreListResponse: """ List available stores @@ -132,7 +132,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a store @@ -164,7 +164,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStoreGetResponse: """ Get store by id @@ -190,14 +190,14 @@ def replace( self, id: int, *, - byod: kv_store_replace_params.Byod | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, + byod: kv_store_replace_params.Byod | Omit = omit, + comment: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStore: """ Update a store @@ -254,14 +254,14 @@ def with_streaming_response(self) -> AsyncKvStoresResourceWithStreamingResponse: async def create( self, *, - byod: kv_store_create_params.Byod | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, + byod: kv_store_create_params.Byod | Omit = omit, + comment: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStore: """ Add a new KV store @@ -297,13 +297,13 @@ async def create( async def list( self, *, - app_id: int | NotGiven = NOT_GIVEN, + app_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStoreListResponse: """ List available stores @@ -340,7 +340,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a store @@ -372,7 +372,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStoreGetResponse: """ Get store by id @@ -398,14 +398,14 @@ async def replace( self, id: int, *, - byod: kv_store_replace_params.Byod | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, + byod: kv_store_replace_params.Byod | Omit = omit, + comment: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStore: """ Update a store diff --git a/src/gcore/resources/fastedge/secrets.py b/src/gcore/resources/fastedge/secrets.py index 8b1e97e2..81685e61 100644 --- a/src/gcore/resources/fastedge/secrets.py +++ b/src/gcore/resources/fastedge/secrets.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -55,14 +55,14 @@ def create( self, *, name: str, - comment: str | NotGiven = NOT_GIVEN, - secret_slots: Iterable[secret_create_params.SecretSlot] | NotGiven = NOT_GIVEN, + comment: str | Omit = omit, + secret_slots: Iterable[secret_create_params.SecretSlot] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecretCreateResponse: """ Add a new secret @@ -102,15 +102,15 @@ def update( self, id: int, *, - comment: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - secret_slots: Iterable[secret_update_params.SecretSlot] | NotGiven = NOT_GIVEN, + comment: str | Omit = omit, + name: str | Omit = omit, + secret_slots: Iterable[secret_update_params.SecretSlot] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Update a secret @@ -149,14 +149,14 @@ def update( def list( self, *, - app_id: int | NotGiven = NOT_GIVEN, - secret_name: str | NotGiven = NOT_GIVEN, + app_id: int | Omit = omit, + secret_name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecretListResponse: """ List available secrets @@ -196,13 +196,13 @@ def delete( self, id: int, *, - force: bool | NotGiven = NOT_GIVEN, + force: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a secret @@ -240,7 +240,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Get secret by id @@ -267,14 +267,14 @@ def replace( id: int, *, name: str, - comment: str | NotGiven = NOT_GIVEN, - secret_slots: Iterable[secret_replace_params.SecretSlot] | NotGiven = NOT_GIVEN, + comment: str | Omit = omit, + secret_slots: Iterable[secret_replace_params.SecretSlot] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Update a secret @@ -335,14 +335,14 @@ async def create( self, *, name: str, - comment: str | NotGiven = NOT_GIVEN, - secret_slots: Iterable[secret_create_params.SecretSlot] | NotGiven = NOT_GIVEN, + comment: str | Omit = omit, + secret_slots: Iterable[secret_create_params.SecretSlot] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecretCreateResponse: """ Add a new secret @@ -382,15 +382,15 @@ async def update( self, id: int, *, - comment: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - secret_slots: Iterable[secret_update_params.SecretSlot] | NotGiven = NOT_GIVEN, + comment: str | Omit = omit, + name: str | Omit = omit, + secret_slots: Iterable[secret_update_params.SecretSlot] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Update a secret @@ -429,14 +429,14 @@ async def update( async def list( self, *, - app_id: int | NotGiven = NOT_GIVEN, - secret_name: str | NotGiven = NOT_GIVEN, + app_id: int | Omit = omit, + secret_name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecretListResponse: """ List available secrets @@ -476,13 +476,13 @@ async def delete( self, id: int, *, - force: bool | NotGiven = NOT_GIVEN, + force: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a secret @@ -520,7 +520,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Get secret by id @@ -547,14 +547,14 @@ async def replace( id: int, *, name: str, - comment: str | NotGiven = NOT_GIVEN, - secret_slots: Iterable[secret_replace_params.SecretSlot] | NotGiven = NOT_GIVEN, + comment: str | Omit = omit, + secret_slots: Iterable[secret_replace_params.SecretSlot] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Update a secret diff --git a/src/gcore/resources/fastedge/statistics.py b/src/gcore/resources/fastedge/statistics.py index 1958aafc..4b344931 100644 --- a/src/gcore/resources/fastedge/statistics.py +++ b/src/gcore/resources/fastedge/statistics.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -51,14 +51,14 @@ def get_call_series( from_: Union[str, datetime], step: int, to: Union[str, datetime], - id: int | NotGiven = NOT_GIVEN, - network: str | NotGiven = NOT_GIVEN, + id: int | Omit = omit, + network: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetCallSeriesResponse: """ Call statistics @@ -109,14 +109,14 @@ def get_duration_series( from_: Union[str, datetime], step: int, to: Union[str, datetime], - id: int | NotGiven = NOT_GIVEN, - network: str | NotGiven = NOT_GIVEN, + id: int | Omit = omit, + network: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetDurationSeriesResponse: """ Execution duration statistics @@ -188,14 +188,14 @@ async def get_call_series( from_: Union[str, datetime], step: int, to: Union[str, datetime], - id: int | NotGiven = NOT_GIVEN, - network: str | NotGiven = NOT_GIVEN, + id: int | Omit = omit, + network: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetCallSeriesResponse: """ Call statistics @@ -246,14 +246,14 @@ async def get_duration_series( from_: Union[str, datetime], step: int, to: Union[str, datetime], - id: int | NotGiven = NOT_GIVEN, - network: str | NotGiven = NOT_GIVEN, + id: int | Omit = omit, + network: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetDurationSeriesResponse: """ Execution duration statistics diff --git a/src/gcore/resources/fastedge/templates.py b/src/gcore/resources/fastedge/templates.py index a39e2757..d58d3110 100644 --- a/src/gcore/resources/fastedge/templates.py +++ b/src/gcore/resources/fastedge/templates.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -59,14 +59,14 @@ def create( name: str, owned: bool, params: Iterable[TemplateParameterParam], - long_descr: str | NotGiven = NOT_GIVEN, - short_descr: str | NotGiven = NOT_GIVEN, + long_descr: str | Omit = omit, + short_descr: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TemplateShort: """ Add template @@ -114,16 +114,16 @@ def create( def list( self, *, - api_type: Literal["wasi-http", "proxy-wasm"] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - only_mine: bool | NotGiven = NOT_GIVEN, + api_type: Literal["wasi-http", "proxy-wasm"] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + only_mine: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPageFastedgeTemplates[TemplateShort]: """ List app templates @@ -173,13 +173,13 @@ def delete( self, id: int, *, - force: bool | NotGiven = NOT_GIVEN, + force: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete template @@ -217,7 +217,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Template: """ Get template details @@ -247,14 +247,14 @@ def replace( name: str, owned: bool, params: Iterable[TemplateParameterParam], - long_descr: str | NotGiven = NOT_GIVEN, - short_descr: str | NotGiven = NOT_GIVEN, + long_descr: str | Omit = omit, + short_descr: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TemplateShort: """ Update template @@ -327,14 +327,14 @@ async def create( name: str, owned: bool, params: Iterable[TemplateParameterParam], - long_descr: str | NotGiven = NOT_GIVEN, - short_descr: str | NotGiven = NOT_GIVEN, + long_descr: str | Omit = omit, + short_descr: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TemplateShort: """ Add template @@ -382,16 +382,16 @@ async def create( def list( self, *, - api_type: Literal["wasi-http", "proxy-wasm"] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - only_mine: bool | NotGiven = NOT_GIVEN, + api_type: Literal["wasi-http", "proxy-wasm"] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + only_mine: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[TemplateShort, AsyncOffsetPageFastedgeTemplates[TemplateShort]]: """ List app templates @@ -441,13 +441,13 @@ async def delete( self, id: int, *, - force: bool | NotGiven = NOT_GIVEN, + force: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete template @@ -485,7 +485,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Template: """ Get template details @@ -515,14 +515,14 @@ async def replace( name: str, owned: bool, params: Iterable[TemplateParameterParam], - long_descr: str | NotGiven = NOT_GIVEN, - short_descr: str | NotGiven = NOT_GIVEN, + long_descr: str | Omit = omit, + short_descr: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TemplateShort: """ Update template diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index ecd59cb6..e99827be 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -50,13 +50,13 @@ def create( client_user: api_token_create_params.ClientUser, exp_date: str, name: str, - description: str | NotGiven = NOT_GIVEN, + description: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APITokenCreate: """ Create an API token in the current account. @@ -100,16 +100,16 @@ def list( self, client_id: int, *, - deleted: bool | NotGiven = NOT_GIVEN, - issued_by: int | NotGiven = NOT_GIVEN, - not_issued_by: int | NotGiven = NOT_GIVEN, - role: str | NotGiven = NOT_GIVEN, + deleted: bool | Omit = omit, + issued_by: int | Omit = omit, + not_issued_by: int | Omit = omit, + role: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APITokenList: """Get information about your permanent API tokens in the account. @@ -176,7 +176,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Delete API token from current account. @@ -213,7 +213,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APIToken: """ Get API Token @@ -263,13 +263,13 @@ async def create( client_user: api_token_create_params.ClientUser, exp_date: str, name: str, - description: str | NotGiven = NOT_GIVEN, + description: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APITokenCreate: """ Create an API token in the current account. @@ -313,16 +313,16 @@ async def list( self, client_id: int, *, - deleted: bool | NotGiven = NOT_GIVEN, - issued_by: int | NotGiven = NOT_GIVEN, - not_issued_by: int | NotGiven = NOT_GIVEN, - role: str | NotGiven = NOT_GIVEN, + deleted: bool | Omit = omit, + issued_by: int | Omit = omit, + not_issued_by: int | Omit = omit, + role: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APITokenList: """Get information about your permanent API tokens in the account. @@ -389,7 +389,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Delete API token from current account. @@ -426,7 +426,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APIToken: """ Get API Token diff --git a/src/gcore/resources/iam/iam.py b/src/gcore/resources/iam/iam.py index 54b4653f..7f409c61 100644 --- a/src/gcore/resources/iam/iam.py +++ b/src/gcore/resources/iam/iam.py @@ -12,7 +12,7 @@ UsersResourceWithStreamingResponse, AsyncUsersResourceWithStreamingResponse, ) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._compat import cached_property from .api_tokens import ( APITokensResource, @@ -71,7 +71,7 @@ def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountOverview: """Get information about your profile, users and other account details.""" return self._get( @@ -119,7 +119,7 @@ async def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountOverview: """Get information about your profile, users and other account details.""" return await self._get( diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index a27021c1..bbb9e413 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -52,19 +52,19 @@ def update( self, user_id: int, *, - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | NotGiven = NOT_GIVEN, - company: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - groups: Iterable[user_update_params.Group] | NotGiven = NOT_GIVEN, - lang: Literal["de", "en", "ru", "zh", "az"] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - phone: Optional[str] | NotGiven = NOT_GIVEN, + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | Omit = omit, + company: str | Omit = omit, + email: str | Omit = omit, + groups: Iterable[user_update_params.Group] | Omit = omit, + lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, + name: Optional[str] | Omit = omit, + phone: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserUpdate: """This method updates user's details. @@ -123,14 +123,14 @@ def update( def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[User]: """Get a list of users. @@ -180,7 +180,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Revokes user's access to the specified account. @@ -214,7 +214,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserDetailed: """ Get user's details @@ -242,14 +242,14 @@ def invite( client_id: int, email: str, user_role: user_invite_params.UserRole, - lang: Literal["de", "en", "ru", "zh", "az"] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, + name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserInvite: """Invite a user to the account. @@ -317,19 +317,19 @@ async def update( self, user_id: int, *, - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | NotGiven = NOT_GIVEN, - company: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - groups: Iterable[user_update_params.Group] | NotGiven = NOT_GIVEN, - lang: Literal["de", "en", "ru", "zh", "az"] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - phone: Optional[str] | NotGiven = NOT_GIVEN, + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | Omit = omit, + company: str | Omit = omit, + email: str | Omit = omit, + groups: Iterable[user_update_params.Group] | Omit = omit, + lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, + name: Optional[str] | Omit = omit, + phone: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserUpdate: """This method updates user's details. @@ -388,14 +388,14 @@ async def update( def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[User, AsyncOffsetPage[User]]: """Get a list of users. @@ -445,7 +445,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Revokes user's access to the specified account. @@ -479,7 +479,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserDetailed: """ Get user's details @@ -507,14 +507,14 @@ async def invite( client_id: int, email: str, user_role: user_invite_params.UserRole, - lang: Literal["de", "en", "ru", "zh", "az"] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, + name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserInvite: """Invite a user to the account. diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index 43947fab..26b3bc96 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -47,16 +47,16 @@ def with_streaming_response(self) -> BgpAnnouncesResourceWithStreamingResponse: def list( self, *, - announced: Optional[bool] | NotGiven = NOT_GIVEN, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - origin: Optional[Literal["STATIC", "DYNAMIC"]] | NotGiven = NOT_GIVEN, - site: Optional[str] | NotGiven = NOT_GIVEN, + announced: Optional[bool] | Omit = omit, + client_id: Optional[int] | Omit = omit, + origin: Optional[Literal["STATIC", "DYNAMIC"]] | Omit = omit, + site: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BgpAnnounceListResponse: """Get BGP announces filtered by parameters. @@ -98,13 +98,13 @@ def toggle( *, announce: str, enabled: bool, - client_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """Change BGP announces (it can be enabled or disabled, but not created or updated). @@ -164,16 +164,16 @@ def with_streaming_response(self) -> AsyncBgpAnnouncesResourceWithStreamingRespo async def list( self, *, - announced: Optional[bool] | NotGiven = NOT_GIVEN, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - origin: Optional[Literal["STATIC", "DYNAMIC"]] | NotGiven = NOT_GIVEN, - site: Optional[str] | NotGiven = NOT_GIVEN, + announced: Optional[bool] | Omit = omit, + client_id: Optional[int] | Omit = omit, + origin: Optional[Literal["STATIC", "DYNAMIC"]] | Omit = omit, + site: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BgpAnnounceListResponse: """Get BGP announces filtered by parameters. @@ -215,13 +215,13 @@ async def toggle( *, announce: str, enabled: bool, - client_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """Change BGP announces (it can be enabled or disabled, but not created or updated). diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py index 86d387bb..e0699398 100644 --- a/src/gcore/resources/security/events.py +++ b/src/gcore/resources/security/events.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -49,11 +49,11 @@ def with_streaming_response(self) -> EventsResourceWithStreamingResponse: def list( self, *, - alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | NotGiven = NOT_GIVEN, - date_from: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN, - date_to: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | Omit = omit, + date_from: Union[Union[str, datetime], str] | Omit = omit, + date_to: Union[Union[str, datetime], str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "attack_start_time", "-attack_start_time", @@ -66,14 +66,14 @@ def list( "alert_type", "-alert_type", ] - | NotGiven = NOT_GIVEN, - targeted_ip_addresses: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + targeted_ip_addresses: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[ClientView]: """ Event Logs Clients View @@ -135,11 +135,11 @@ def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: def list( self, *, - alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | NotGiven = NOT_GIVEN, - date_from: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN, - date_to: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | Omit = omit, + date_from: Union[Union[str, datetime], str] | Omit = omit, + date_to: Union[Union[str, datetime], str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "attack_start_time", "-attack_start_time", @@ -152,14 +152,14 @@ def list( "alert_type", "-alert_type", ] - | NotGiven = NOT_GIVEN, - targeted_ip_addresses: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + targeted_ip_addresses: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ClientView, AsyncOffsetPage[ClientView]]: """ Event Logs Clients View diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py index 85b84ad8..307f3c0d 100644 --- a/src/gcore/resources/security/profile_templates.py +++ b/src/gcore/resources/security/profile_templates.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -47,7 +47,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProfileTemplateListResponse: """Get list of profile templates. @@ -91,7 +91,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProfileTemplateListResponse: """Get list of profile templates. diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index 16668afa..8394bd69 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -54,14 +54,14 @@ def create( *, fields: Iterable[profile_create_params.Field], profile_template: int, - ip_address: Optional[str] | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + ip_address: Optional[str] | Omit = omit, + site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """Create protection profile. @@ -97,16 +97,16 @@ def create( def list( self, *, - exclude_empty_address: bool | NotGiven = NOT_GIVEN, - include_deleted: bool | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + exclude_empty_address: bool | Omit = omit, + include_deleted: bool | Omit = omit, + ip_address: str | Omit = omit, + site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProfileListResponse: """Get list of protection profiles. @@ -150,7 +150,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Delete protection profile. @@ -184,7 +184,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """ Get profile by id @@ -212,14 +212,14 @@ def recreate( *, fields: Iterable[profile_recreate_params.Field], profile_template: int, - ip_address: Optional[str] | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + ip_address: Optional[str] | Omit = omit, + site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """ Recreate profile with another profile template (for other cases use detail API) @@ -256,14 +256,14 @@ def replace( *, fields: Iterable[profile_replace_params.Field], profile_template: int, - ip_address: Optional[str] | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + ip_address: Optional[str] | Omit = omit, + site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """Update profile. @@ -322,14 +322,14 @@ async def create( *, fields: Iterable[profile_create_params.Field], profile_template: int, - ip_address: Optional[str] | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + ip_address: Optional[str] | Omit = omit, + site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """Create protection profile. @@ -365,16 +365,16 @@ async def create( async def list( self, *, - exclude_empty_address: bool | NotGiven = NOT_GIVEN, - include_deleted: bool | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + exclude_empty_address: bool | Omit = omit, + include_deleted: bool | Omit = omit, + ip_address: str | Omit = omit, + site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProfileListResponse: """Get list of protection profiles. @@ -418,7 +418,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Delete protection profile. @@ -452,7 +452,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """ Get profile by id @@ -480,14 +480,14 @@ async def recreate( *, fields: Iterable[profile_recreate_params.Field], profile_template: int, - ip_address: Optional[str] | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + ip_address: Optional[str] | Omit = omit, + site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """ Recreate profile with another profile template (for other cases use detail API) @@ -524,14 +524,14 @@ async def replace( *, fields: Iterable[profile_replace_params.Field], profile_template: int, - ip_address: Optional[str] | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + ip_address: Optional[str] | Omit = omit, + site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """Update profile. diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index d8c41393..66c28797 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -20,7 +20,7 @@ PolicyResourceWithStreamingResponse, AsyncPolicyResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform from .lifecycle import ( LifecycleResource, @@ -88,7 +88,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Creates a new bucket within an S3 storage. @@ -119,14 +119,14 @@ def list( self, storage_id: int, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Bucket]: """Returns the list of buckets for the storage in a wrapped response. @@ -176,7 +176,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Removes a bucket from an S3 storage. @@ -246,7 +246,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Creates a new bucket within an S3 storage. @@ -277,14 +277,14 @@ def list( self, storage_id: int, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Bucket, AsyncOffsetPage[Bucket]]: """Returns the list of buckets for the storage in a wrapped response. @@ -334,7 +334,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Removes a bucket from an S3 storage. diff --git a/src/gcore/resources/storage/buckets/cors.py b/src/gcore/resources/storage/buckets/cors.py index 3869e78e..77a3e045 100644 --- a/src/gcore/resources/storage/buckets/cors.py +++ b/src/gcore/resources/storage/buckets/cors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -46,13 +46,13 @@ def create( bucket_name: str, *, storage_id: int, - allowed_origins: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + allowed_origins: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Configures Cross-Origin Resource Sharing (CORS) rules for an S3 bucket, allowing @@ -92,7 +92,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BucketCors: """ Retrieves the current Cross-Origin Resource Sharing (CORS) configuration for an @@ -144,13 +144,13 @@ async def create( bucket_name: str, *, storage_id: int, - allowed_origins: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + allowed_origins: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Configures Cross-Origin Resource Sharing (CORS) rules for an S3 bucket, allowing @@ -190,7 +190,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BucketCors: """ Retrieves the current Cross-Origin Resource Sharing (CORS) configuration for an diff --git a/src/gcore/resources/storage/buckets/lifecycle.py b/src/gcore/resources/storage/buckets/lifecycle.py index a4940ef7..b80dffaf 100644 --- a/src/gcore/resources/storage/buckets/lifecycle.py +++ b/src/gcore/resources/storage/buckets/lifecycle.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -45,13 +45,13 @@ def create( bucket_name: str, *, storage_id: int, - expiration_days: int | NotGiven = NOT_GIVEN, + expiration_days: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Sets up automatic object expiration for an S3 bucket. @@ -96,7 +96,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes all lifecycle rules from an S3 bucket, disabling automatic object @@ -148,13 +148,13 @@ async def create( bucket_name: str, *, storage_id: int, - expiration_days: int | NotGiven = NOT_GIVEN, + expiration_days: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Sets up automatic object expiration for an S3 bucket. @@ -201,7 +201,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes all lifecycle rules from an S3 bucket, disabling automatic object diff --git a/src/gcore/resources/storage/buckets/policy.py b/src/gcore/resources/storage/buckets/policy.py index f84d2653..cca549f9 100644 --- a/src/gcore/resources/storage/buckets/policy.py +++ b/src/gcore/resources/storage/buckets/policy.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Query, Headers, NoneType, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -49,7 +49,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Applies a public read policy to the S3 bucket, allowing anonymous users to @@ -88,7 +88,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes the public read policy from an S3 bucket, making all objects private and @@ -126,7 +126,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PolicyGetResponse: """ Returns whether the S3 bucket is currently configured for public read access. @@ -182,7 +182,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Applies a public read policy to the S3 bucket, allowing anonymous users to @@ -221,7 +221,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes the public read policy from an S3 bucket, making all objects private and @@ -259,7 +259,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PolicyGetResponse: """ Returns whether the S3 bucket is currently configured for public read access. diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index 5cc7224a..1db372ae 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -45,17 +45,17 @@ def recreate( self, storage_id: int, *, - delete_sftp_password: bool | NotGiven = NOT_GIVEN, - generate_s3_keys: bool | NotGiven = NOT_GIVEN, - generate_sftp_password: bool | NotGiven = NOT_GIVEN, - reset_sftp_keys: bool | NotGiven = NOT_GIVEN, - sftp_password: str | NotGiven = NOT_GIVEN, + delete_sftp_password: bool | Omit = omit, + generate_s3_keys: bool | Omit = omit, + generate_sftp_password: bool | Omit = omit, + reset_sftp_keys: bool | Omit = omit, + sftp_password: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """ Generates new access credentials for the storage (S3 keys for S3 storage, SFTP @@ -127,17 +127,17 @@ async def recreate( self, storage_id: int, *, - delete_sftp_password: bool | NotGiven = NOT_GIVEN, - generate_s3_keys: bool | NotGiven = NOT_GIVEN, - generate_sftp_password: bool | NotGiven = NOT_GIVEN, - reset_sftp_keys: bool | NotGiven = NOT_GIVEN, - sftp_password: str | NotGiven = NOT_GIVEN, + delete_sftp_password: bool | Omit = omit, + generate_s3_keys: bool | Omit = omit, + generate_sftp_password: bool | Omit = omit, + reset_sftp_keys: bool | Omit = omit, + sftp_password: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """ Generates new access credentials for the storage (S3 keys for S3 storage, SFTP diff --git a/src/gcore/resources/storage/locations.py b/src/gcore/resources/storage/locations.py index 5e2a2d96..bce1aa37 100644 --- a/src/gcore/resources/storage/locations.py +++ b/src/gcore/resources/storage/locations.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -45,14 +45,14 @@ def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Location]: """Returns available storage locations where you can create storages. @@ -111,14 +111,14 @@ def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Location, AsyncOffsetPage[Location]]: """Returns available storage locations where you can create storages. diff --git a/src/gcore/resources/storage/statistics.py b/src/gcore/resources/storage/statistics.py index 980c1410..dbaf7b6e 100644 --- a/src/gcore/resources/storage/statistics.py +++ b/src/gcore/resources/storage/statistics.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -45,16 +45,16 @@ def with_streaming_response(self) -> StatisticsResourceWithStreamingResponse: def get_usage_aggregated( self, *, - from_: str | NotGiven = NOT_GIVEN, - locations: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - storages: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + from_: str | Omit = omit, + locations: SequenceNotStr[str] | Omit = omit, + storages: SequenceNotStr[str] | Omit = omit, + to: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UsageTotal: """ Consumption statistics is updated in near real-time as a standard practice. @@ -101,19 +101,19 @@ def get_usage_aggregated( def get_usage_series( self, *, - from_: str | NotGiven = NOT_GIVEN, - granularity: str | NotGiven = NOT_GIVEN, - locations: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - source: int | NotGiven = NOT_GIVEN, - storages: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, - ts_string: bool | NotGiven = NOT_GIVEN, + from_: str | Omit = omit, + granularity: str | Omit = omit, + locations: SequenceNotStr[str] | Omit = omit, + source: int | Omit = omit, + storages: SequenceNotStr[str] | Omit = omit, + to: str | Omit = omit, + ts_string: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetUsageSeriesResponse: """ Consumption statistics is updated in near real-time as a standard practice. @@ -192,16 +192,16 @@ def with_streaming_response(self) -> AsyncStatisticsResourceWithStreamingRespons async def get_usage_aggregated( self, *, - from_: str | NotGiven = NOT_GIVEN, - locations: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - storages: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + from_: str | Omit = omit, + locations: SequenceNotStr[str] | Omit = omit, + storages: SequenceNotStr[str] | Omit = omit, + to: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UsageTotal: """ Consumption statistics is updated in near real-time as a standard practice. @@ -248,19 +248,19 @@ async def get_usage_aggregated( async def get_usage_series( self, *, - from_: str | NotGiven = NOT_GIVEN, - granularity: str | NotGiven = NOT_GIVEN, - locations: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - source: int | NotGiven = NOT_GIVEN, - storages: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, - ts_string: bool | NotGiven = NOT_GIVEN, + from_: str | Omit = omit, + granularity: str | Omit = omit, + locations: SequenceNotStr[str] | Omit = omit, + source: int | Omit = omit, + storages: SequenceNotStr[str] | Omit = omit, + to: str | Omit = omit, + ts_string: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetUsageSeriesResponse: """ Consumption statistics is updated in near real-time as a standard practice. diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index 9326bb88..7b5d0039 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from .locations import ( @@ -98,14 +98,14 @@ def create( location: Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"], name: str, type: Literal["sftp", "s3"], - generate_sftp_password: bool | NotGiven = NOT_GIVEN, - sftp_password: str | NotGiven = NOT_GIVEN, + generate_sftp_password: bool | Omit = omit, + sftp_password: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """ Creates a new storage instance (S3 or SFTP) in the specified location and @@ -159,14 +159,14 @@ def update( self, storage_id: int, *, - expires: str | NotGiven = NOT_GIVEN, - server_alias: str | NotGiven = NOT_GIVEN, + expires: str | Omit = omit, + server_alias: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """Updates storage configuration such as expiration date and server alias. @@ -205,22 +205,22 @@ def update( def list( self, *, - id: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - location: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - show_deleted: bool | NotGiven = NOT_GIVEN, - status: Literal["active", "suspended", "deleted", "pending"] | NotGiven = NOT_GIVEN, - type: Literal["s3", "sftp"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + limit: int | Omit = omit, + location: str | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + order_direction: Literal["asc", "desc"] | Omit = omit, + show_deleted: bool | Omit = omit, + status: Literal["active", "suspended", "deleted", "pending"] | Omit = omit, + type: Literal["s3", "sftp"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Storage]: """ Returns storages with the same filtering and pagination as v2, but in a @@ -293,7 +293,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Permanently deletes a storage and all its data. @@ -326,7 +326,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """ Retrieves detailed information about a specific storage including its @@ -359,7 +359,7 @@ def link_ssh_key( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Associates an SSH public key with an SFTP storage, enabling passwordless @@ -388,13 +388,13 @@ def restore( self, storage_id: int, *, - client_id: int | NotGiven = NOT_GIVEN, + client_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Restores a previously deleted S3 storage if it was deleted within the last 2 @@ -432,7 +432,7 @@ def unlink_ssh_key( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes SSH key association from an SFTP storage, disabling passwordless @@ -500,14 +500,14 @@ async def create( location: Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"], name: str, type: Literal["sftp", "s3"], - generate_sftp_password: bool | NotGiven = NOT_GIVEN, - sftp_password: str | NotGiven = NOT_GIVEN, + generate_sftp_password: bool | Omit = omit, + sftp_password: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """ Creates a new storage instance (S3 or SFTP) in the specified location and @@ -561,14 +561,14 @@ async def update( self, storage_id: int, *, - expires: str | NotGiven = NOT_GIVEN, - server_alias: str | NotGiven = NOT_GIVEN, + expires: str | Omit = omit, + server_alias: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """Updates storage configuration such as expiration date and server alias. @@ -607,22 +607,22 @@ async def update( def list( self, *, - id: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - location: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - show_deleted: bool | NotGiven = NOT_GIVEN, - status: Literal["active", "suspended", "deleted", "pending"] | NotGiven = NOT_GIVEN, - type: Literal["s3", "sftp"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + limit: int | Omit = omit, + location: str | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + order_direction: Literal["asc", "desc"] | Omit = omit, + show_deleted: bool | Omit = omit, + status: Literal["active", "suspended", "deleted", "pending"] | Omit = omit, + type: Literal["s3", "sftp"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Storage, AsyncOffsetPage[Storage]]: """ Returns storages with the same filtering and pagination as v2, but in a @@ -695,7 +695,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Permanently deletes a storage and all its data. @@ -728,7 +728,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """ Retrieves detailed information about a specific storage including its @@ -761,7 +761,7 @@ async def link_ssh_key( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Associates an SSH public key with an SFTP storage, enabling passwordless @@ -790,13 +790,13 @@ async def restore( self, storage_id: int, *, - client_id: int | NotGiven = NOT_GIVEN, + client_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Restores a previously deleted S3 storage if it was deleted within the last 2 @@ -836,7 +836,7 @@ async def unlink_ssh_key( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes SSH key association from an SFTP storage, disabling passwordless diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 0b63144c..5fef8653 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -53,17 +53,17 @@ def create( *, task_name: Literal["transcription", "content-moderation"], url: str, - audio_language: str | NotGiven = NOT_GIVEN, - category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | NotGiven = NOT_GIVEN, - client_entity_data: str | NotGiven = NOT_GIVEN, - client_user_id: str | NotGiven = NOT_GIVEN, - subtitles_language: str | NotGiven = NOT_GIVEN, + audio_language: str | Omit = omit, + category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | Omit = omit, + client_entity_data: str | Omit = omit, + client_user_id: str | Omit = omit, + subtitles_language: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskCreateResponse: """Creating an AI task. @@ -341,21 +341,20 @@ def create( def list( self, *, - date_created: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - ordering: Literal["task_id", "status", "task_name", "started_at"] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - search: str | NotGiven = NOT_GIVEN, - status: Literal["FAILURE", "PENDING", "RECEIVED", "RETRY", "REVOKED", "STARTED", "SUCCESS"] - | NotGiven = NOT_GIVEN, - task_id: str | NotGiven = NOT_GIVEN, - task_name: Literal["transcription", "content-moderation"] | NotGiven = NOT_GIVEN, + date_created: str | Omit = omit, + limit: int | Omit = omit, + ordering: Literal["task_id", "status", "task_name", "started_at"] | Omit = omit, + page: int | Omit = omit, + search: str | Omit = omit, + status: Literal["FAILURE", "PENDING", "RECEIVED", "RETRY", "REVOKED", "STARTED", "SUCCESS"] | Omit = omit, + task_id: str | Omit = omit, + task_name: Literal["transcription", "content-moderation"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreamingAI[AITask]: """Returns a list of previously created and processed AI tasks. @@ -433,7 +432,7 @@ def cancel( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskCancelResponse: """ Stopping a previously launched AI-task without waiting for it to be fully @@ -467,7 +466,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskGetResponse: """ This is the single method to check the execution status of an AI task, and @@ -529,14 +528,14 @@ def get_ai_settings( self, *, type: Literal["language_support"], - audio_language: str | NotGiven = NOT_GIVEN, - subtitles_language: str | NotGiven = NOT_GIVEN, + audio_language: str | Omit = omit, + subtitles_language: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskGetAISettingsResponse: """ The method for revealing basic information and advanced underlying settings that @@ -634,17 +633,17 @@ async def create( *, task_name: Literal["transcription", "content-moderation"], url: str, - audio_language: str | NotGiven = NOT_GIVEN, - category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | NotGiven = NOT_GIVEN, - client_entity_data: str | NotGiven = NOT_GIVEN, - client_user_id: str | NotGiven = NOT_GIVEN, - subtitles_language: str | NotGiven = NOT_GIVEN, + audio_language: str | Omit = omit, + category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | Omit = omit, + client_entity_data: str | Omit = omit, + client_user_id: str | Omit = omit, + subtitles_language: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskCreateResponse: """Creating an AI task. @@ -922,21 +921,20 @@ async def create( def list( self, *, - date_created: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - ordering: Literal["task_id", "status", "task_name", "started_at"] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - search: str | NotGiven = NOT_GIVEN, - status: Literal["FAILURE", "PENDING", "RECEIVED", "RETRY", "REVOKED", "STARTED", "SUCCESS"] - | NotGiven = NOT_GIVEN, - task_id: str | NotGiven = NOT_GIVEN, - task_name: Literal["transcription", "content-moderation"] | NotGiven = NOT_GIVEN, + date_created: str | Omit = omit, + limit: int | Omit = omit, + ordering: Literal["task_id", "status", "task_name", "started_at"] | Omit = omit, + page: int | Omit = omit, + search: str | Omit = omit, + status: Literal["FAILURE", "PENDING", "RECEIVED", "RETRY", "REVOKED", "STARTED", "SUCCESS"] | Omit = omit, + task_id: str | Omit = omit, + task_name: Literal["transcription", "content-moderation"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AITask, AsyncPageStreamingAI[AITask]]: """Returns a list of previously created and processed AI tasks. @@ -1014,7 +1012,7 @@ async def cancel( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskCancelResponse: """ Stopping a previously launched AI-task without waiting for it to be fully @@ -1048,7 +1046,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskGetResponse: """ This is the single method to check the execution status of an AI task, and @@ -1110,14 +1108,14 @@ async def get_ai_settings( self, *, type: Literal["language_support"], - audio_language: str | NotGiven = NOT_GIVEN, - subtitles_language: str | NotGiven = NOT_GIVEN, + audio_language: str | Omit = omit, + subtitles_language: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskGetAISettingsResponse: """ The method for revealing basic information and advanced underlying settings that diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index d8ef434b..bb9803bb 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -46,13 +46,13 @@ def with_streaming_response(self) -> BroadcastsResourceWithStreamingResponse: def create( self, *, - broadcast: broadcast_create_params.Broadcast | NotGiven = NOT_GIVEN, + broadcast: broadcast_create_params.Broadcast | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Broadcast entity is for setting up HTML video player, which serves to combine: @@ -88,13 +88,13 @@ def update( self, broadcast_id: int, *, - broadcast: broadcast_update_params.Broadcast | NotGiven = NOT_GIVEN, + broadcast: broadcast_update_params.Broadcast | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Broadcast: """ Updates broadcast settings @@ -120,13 +120,13 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreaming[Broadcast]: """ Note: Feature "Broadcast" is outdated, soon it will be replaced by @@ -167,7 +167,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete broadcast @@ -199,7 +199,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Broadcast: """ Returns broadcast details @@ -230,7 +230,7 @@ def get_spectators_count( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BroadcastSpectatorsCount: """ Returns number of simultaneous broadcast viewers at the current moment @@ -276,13 +276,13 @@ def with_streaming_response(self) -> AsyncBroadcastsResourceWithStreamingRespons async def create( self, *, - broadcast: broadcast_create_params.Broadcast | NotGiven = NOT_GIVEN, + broadcast: broadcast_create_params.Broadcast | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Broadcast entity is for setting up HTML video player, which serves to combine: @@ -318,13 +318,13 @@ async def update( self, broadcast_id: int, *, - broadcast: broadcast_update_params.Broadcast | NotGiven = NOT_GIVEN, + broadcast: broadcast_update_params.Broadcast | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Broadcast: """ Updates broadcast settings @@ -350,13 +350,13 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Broadcast, AsyncPageStreaming[Broadcast]]: """ Note: Feature "Broadcast" is outdated, soon it will be replaced by @@ -397,7 +397,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete broadcast @@ -429,7 +429,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Broadcast: """ Returns broadcast details @@ -460,7 +460,7 @@ async def get_spectators_count( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BroadcastSpectatorsCount: """ Returns number of simultaneous broadcast viewers at the current moment diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 438d9de8..0f70207a 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -47,13 +47,13 @@ def create( self, *, name: str, - parent_id: int | NotGiven = NOT_GIVEN, + parent_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryBase: """ Use this method to create a new directory entity. @@ -90,14 +90,14 @@ def update( self, directory_id: int, *, - name: str | NotGiven = NOT_GIVEN, - parent_id: int | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + parent_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryBase: """ Change a directory name or move to another "`parent_id`". @@ -140,7 +140,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a directory **and all entities inside**. @@ -179,7 +179,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryGetResponse: """Complete directory structure with contents. @@ -211,7 +211,7 @@ def get_tree( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoriesTree: """Tree structure of directories. @@ -251,13 +251,13 @@ async def create( self, *, name: str, - parent_id: int | NotGiven = NOT_GIVEN, + parent_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryBase: """ Use this method to create a new directory entity. @@ -294,14 +294,14 @@ async def update( self, directory_id: int, *, - name: str | NotGiven = NOT_GIVEN, - parent_id: int | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + parent_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryBase: """ Change a directory name or move to another "`parent_id`". @@ -344,7 +344,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a directory **and all entities inside**. @@ -383,7 +383,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryGetResponse: """Complete directory structure with contents. @@ -415,7 +415,7 @@ async def get_tree( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoriesTree: """Tree structure of directories. diff --git a/src/gcore/resources/streaming/players.py b/src/gcore/resources/streaming/players.py index 826e015a..b2590c29 100644 --- a/src/gcore/resources/streaming/players.py +++ b/src/gcore/resources/streaming/players.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -46,13 +46,13 @@ def with_streaming_response(self) -> PlayersResourceWithStreamingResponse: def create( self, *, - player: PlayerParam | NotGiven = NOT_GIVEN, + player: PlayerParam | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Create player @@ -84,13 +84,13 @@ def update( self, player_id: int, *, - player: PlayerParam | NotGiven = NOT_GIVEN, + player: PlayerParam | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Player: """Updates player settings @@ -120,13 +120,13 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreaming[Player]: """Returns a list of created players @@ -165,7 +165,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete player @@ -197,7 +197,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Player: """ Returns player settings @@ -228,7 +228,7 @@ def preview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Returns player configuration in HTML @@ -275,13 +275,13 @@ def with_streaming_response(self) -> AsyncPlayersResourceWithStreamingResponse: async def create( self, *, - player: PlayerParam | NotGiven = NOT_GIVEN, + player: PlayerParam | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Create player @@ -313,13 +313,13 @@ async def update( self, player_id: int, *, - player: PlayerParam | NotGiven = NOT_GIVEN, + player: PlayerParam | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Player: """Updates player settings @@ -349,13 +349,13 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Player, AsyncPageStreaming[Player]]: """Returns a list of created players @@ -394,7 +394,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete player @@ -426,7 +426,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Player: """ Returns player settings @@ -457,7 +457,7 @@ async def preview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Returns player configuration in HTML diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index fba76526..bb2036fc 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -50,26 +50,26 @@ def with_streaming_response(self) -> PlaylistsResourceWithStreamingResponse: def create( self, *, - active: bool | NotGiven = NOT_GIVEN, - ad_id: int | NotGiven = NOT_GIVEN, - client_id: int | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - countdown: bool | NotGiven = NOT_GIVEN, - hls_cmaf_url: str | NotGiven = NOT_GIVEN, - hls_url: str | NotGiven = NOT_GIVEN, - iframe_url: str | NotGiven = NOT_GIVEN, - loop: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - player_id: int | NotGiven = NOT_GIVEN, - playlist_type: Literal["live", "vod"] | NotGiven = NOT_GIVEN, - start_time: str | NotGiven = NOT_GIVEN, - video_ids: Iterable[int] | NotGiven = NOT_GIVEN, + active: bool | Omit = omit, + ad_id: int | Omit = omit, + client_id: int | Omit = omit, + client_user_id: int | Omit = omit, + countdown: bool | Omit = omit, + hls_cmaf_url: str | Omit = omit, + hls_url: str | Omit = omit, + iframe_url: str | Omit = omit, + loop: bool | Omit = omit, + name: str | Omit = omit, + player_id: int | Omit = omit, + playlist_type: Literal["live", "vod"] | Omit = omit, + start_time: str | Omit = omit, + video_ids: Iterable[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlaylistCreate: """ Playlist is a curated collection of video content organized in a sequential @@ -234,26 +234,26 @@ def update( self, playlist_id: int, *, - active: bool | NotGiven = NOT_GIVEN, - ad_id: int | NotGiven = NOT_GIVEN, - client_id: int | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - countdown: bool | NotGiven = NOT_GIVEN, - hls_cmaf_url: str | NotGiven = NOT_GIVEN, - hls_url: str | NotGiven = NOT_GIVEN, - iframe_url: str | NotGiven = NOT_GIVEN, - loop: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - player_id: int | NotGiven = NOT_GIVEN, - playlist_type: Literal["live", "vod"] | NotGiven = NOT_GIVEN, - start_time: str | NotGiven = NOT_GIVEN, - video_ids: Iterable[int] | NotGiven = NOT_GIVEN, + active: bool | Omit = omit, + ad_id: int | Omit = omit, + client_id: int | Omit = omit, + client_user_id: int | Omit = omit, + countdown: bool | Omit = omit, + hls_cmaf_url: str | Omit = omit, + hls_url: str | Omit = omit, + iframe_url: str | Omit = omit, + loop: bool | Omit = omit, + name: str | Omit = omit, + player_id: int | Omit = omit, + playlist_type: Literal["live", "vod"] | Omit = omit, + start_time: str | Omit = omit, + video_ids: Iterable[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Playlist: """Change playlist @@ -364,13 +364,13 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreaming[Playlist]: """Returns a list of created playlists @@ -409,7 +409,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete playlist @@ -441,7 +441,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Playlist: """ Returns a playlist details @@ -472,7 +472,7 @@ def list_videos( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlaylistListVideosResponse: """ Shows ordered array of playlist videos @@ -518,26 +518,26 @@ def with_streaming_response(self) -> AsyncPlaylistsResourceWithStreamingResponse async def create( self, *, - active: bool | NotGiven = NOT_GIVEN, - ad_id: int | NotGiven = NOT_GIVEN, - client_id: int | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - countdown: bool | NotGiven = NOT_GIVEN, - hls_cmaf_url: str | NotGiven = NOT_GIVEN, - hls_url: str | NotGiven = NOT_GIVEN, - iframe_url: str | NotGiven = NOT_GIVEN, - loop: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - player_id: int | NotGiven = NOT_GIVEN, - playlist_type: Literal["live", "vod"] | NotGiven = NOT_GIVEN, - start_time: str | NotGiven = NOT_GIVEN, - video_ids: Iterable[int] | NotGiven = NOT_GIVEN, + active: bool | Omit = omit, + ad_id: int | Omit = omit, + client_id: int | Omit = omit, + client_user_id: int | Omit = omit, + countdown: bool | Omit = omit, + hls_cmaf_url: str | Omit = omit, + hls_url: str | Omit = omit, + iframe_url: str | Omit = omit, + loop: bool | Omit = omit, + name: str | Omit = omit, + player_id: int | Omit = omit, + playlist_type: Literal["live", "vod"] | Omit = omit, + start_time: str | Omit = omit, + video_ids: Iterable[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlaylistCreate: """ Playlist is a curated collection of video content organized in a sequential @@ -702,26 +702,26 @@ async def update( self, playlist_id: int, *, - active: bool | NotGiven = NOT_GIVEN, - ad_id: int | NotGiven = NOT_GIVEN, - client_id: int | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - countdown: bool | NotGiven = NOT_GIVEN, - hls_cmaf_url: str | NotGiven = NOT_GIVEN, - hls_url: str | NotGiven = NOT_GIVEN, - iframe_url: str | NotGiven = NOT_GIVEN, - loop: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - player_id: int | NotGiven = NOT_GIVEN, - playlist_type: Literal["live", "vod"] | NotGiven = NOT_GIVEN, - start_time: str | NotGiven = NOT_GIVEN, - video_ids: Iterable[int] | NotGiven = NOT_GIVEN, + active: bool | Omit = omit, + ad_id: int | Omit = omit, + client_id: int | Omit = omit, + client_user_id: int | Omit = omit, + countdown: bool | Omit = omit, + hls_cmaf_url: str | Omit = omit, + hls_url: str | Omit = omit, + iframe_url: str | Omit = omit, + loop: bool | Omit = omit, + name: str | Omit = omit, + player_id: int | Omit = omit, + playlist_type: Literal["live", "vod"] | Omit = omit, + start_time: str | Omit = omit, + video_ids: Iterable[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Playlist: """Change playlist @@ -832,13 +832,13 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Playlist, AsyncPageStreaming[Playlist]]: """Returns a list of created playlists @@ -877,7 +877,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete playlist @@ -909,7 +909,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Playlist: """ Returns a playlist details @@ -940,7 +940,7 @@ async def list_videos( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlaylistListVideosResponse: """ Shows ordered array of playlist videos diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index 825c12da..5343d5c5 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -49,7 +49,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QualitySets: """ Method returns a list of all custom quality sets. @@ -101,14 +101,14 @@ def list( def set_default( self, *, - live: quality_set_set_default_params.Live | NotGiven = NOT_GIVEN, - vod: quality_set_set_default_params.Vod | NotGiven = NOT_GIVEN, + live: quality_set_set_default_params.Live | Omit = omit, + vod: quality_set_set_default_params.Vod | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QualitySets: """Method to set default quality set for VOD and Live transcoding. @@ -180,7 +180,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QualitySets: """ Method returns a list of all custom quality sets. @@ -232,14 +232,14 @@ async def list( async def set_default( self, *, - live: quality_set_set_default_params.Live | NotGiven = NOT_GIVEN, - vod: quality_set_set_default_params.Vod | NotGiven = NOT_GIVEN, + live: quality_set_set_default_params.Live | Omit = omit, + vod: quality_set_set_default_params.Vod | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QualitySets: """Method to set default quality set for VOD and Live transcoding. diff --git a/src/gcore/resources/streaming/restreams.py b/src/gcore/resources/streaming/restreams.py index 78880ed4..91f24ab2 100644 --- a/src/gcore/resources/streaming/restreams.py +++ b/src/gcore/resources/streaming/restreams.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -45,13 +45,13 @@ def with_streaming_response(self) -> RestreamsResourceWithStreamingResponse: def create( self, *, - restream: restream_create_params.Restream | NotGiven = NOT_GIVEN, + restream: restream_create_params.Restream | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Create restream @@ -79,13 +79,13 @@ def update( self, restream_id: int, *, - restream: restream_update_params.Restream | NotGiven = NOT_GIVEN, + restream: restream_update_params.Restream | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Restream: """ Updates restream settings @@ -111,13 +111,13 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreaming[Restream]: """Returns a list of created restreams @@ -156,7 +156,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete restream @@ -188,7 +188,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Restream: """ Returns restream details @@ -234,13 +234,13 @@ def with_streaming_response(self) -> AsyncRestreamsResourceWithStreamingResponse async def create( self, *, - restream: restream_create_params.Restream | NotGiven = NOT_GIVEN, + restream: restream_create_params.Restream | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Create restream @@ -268,13 +268,13 @@ async def update( self, restream_id: int, *, - restream: restream_update_params.Restream | NotGiven = NOT_GIVEN, + restream: restream_update_params.Restream | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Restream: """ Updates restream settings @@ -300,13 +300,13 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Restream, AsyncPageStreaming[Restream]]: """Returns a list of created restreams @@ -345,7 +345,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete restream @@ -377,7 +377,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Restream: """ Returns restream details diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 4e8cb182..b252b848 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -92,14 +92,14 @@ def get_ffprobes( date_from: str, date_to: str, stream_id: str, - interval: int | NotGiven = NOT_GIVEN, - units: Literal["second", "minute", "hour", "day", "week", "month"] | NotGiven = NOT_GIVEN, + interval: int | Omit = omit, + units: Literal["second", "minute", "hour", "day", "week", "month"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Ffprobes: """ Aggregates data for the specified video stream in the specified time interval. @@ -148,15 +148,15 @@ def get_live_unique_viewers( *, from_: str, to: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, + stream_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetLiveUniqueViewersResponse: """Calculates time series of unique viewers of Live streams via CDN. @@ -212,16 +212,16 @@ def get_live_watch_time_cdn( self, *, from_: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | Omit = omit, + stream_id: int | Omit = omit, + to: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamSeries: """Calculates a time series of live streams watching duration in minutes. @@ -277,16 +277,16 @@ def get_live_watch_time_cdn( def get_live_watch_time_total_cdn( self, *, - client_user_id: int | NotGiven = NOT_GIVEN, - from_: str | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + from_: str | Omit = omit, + stream_id: int | Omit = omit, + to: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodTotalStreamDurationSeries: """Calculates the total duration of live streams watching in minutes. @@ -339,13 +339,13 @@ def get_max_streams_series( *, from_: str, to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> MaxStreamSeries: """Calculates time series of the amount of simultaneous streams. @@ -396,7 +396,7 @@ def get_popular_videos( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PopularVideos: """ Aggregates the number of views for all client videos, grouping them by id and @@ -443,13 +443,13 @@ def get_storage_series( *, from_: str, to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StorageSeries: """ Calculates time series of the size of disk space in bytes for all processed and @@ -495,13 +495,13 @@ def get_stream_series( *, from_: str, to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamSeries: """Calculates time series of the transcoding minutes of all streams. @@ -547,19 +547,18 @@ def get_unique_viewers( *, date_from: str, date_to: str, - id: str | NotGiven = NOT_GIVEN, - country: str | NotGiven = NOT_GIVEN, - event: Literal["init", "start", "watch"] | NotGiven = NOT_GIVEN, - group: List[Literal["date", "host", "os", "browser", "platform", "ip", "country", "event", "id"]] - | NotGiven = NOT_GIVEN, - host: str | NotGiven = NOT_GIVEN, - type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + country: str | Omit = omit, + event: Literal["init", "start", "watch"] | Omit = omit, + group: List[Literal["date", "host", "os", "browser", "platform", "ip", "country", "event", "id"]] | Omit = omit, + host: str | Omit = omit, + type: Literal["live", "vod", "playlist"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UniqueViewers: """Get the number of unique viewers in the built-in player. @@ -625,14 +624,14 @@ def get_unique_viewers_cdn( *, date_from: str, date_to: str, - id: str | NotGiven = NOT_GIVEN, - type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + type: Literal["live", "vod", "playlist"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UniqueViewersCdn: """Сounts the number of unique viewers of a video entity over CDN. @@ -708,19 +707,18 @@ def get_views( *, date_from: str, date_to: str, - id: str | NotGiven = NOT_GIVEN, - country: str | NotGiven = NOT_GIVEN, - event: Literal["init", "start", "watch"] | NotGiven = NOT_GIVEN, - group: List[Literal["host", "os", "browser", "platform", "ip", "country", "event", "id"]] - | NotGiven = NOT_GIVEN, - host: str | NotGiven = NOT_GIVEN, - type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + country: str | Omit = omit, + event: Literal["init", "start", "watch"] | Omit = omit, + group: List[Literal["host", "os", "browser", "platform", "ip", "country", "event", "id"]] | Omit = omit, + host: str | Omit = omit, + type: Literal["live", "vod", "playlist"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Views: """Get the number of views in the built-in player. @@ -791,7 +789,7 @@ def get_views_by_browsers( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByBrowser: """ Aggregates the number of views for all client videos, grouping them by browsers @@ -842,7 +840,7 @@ def get_views_by_country( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByCountry: """ Aggregates the number of views grouping them by country in the built-in player. @@ -893,7 +891,7 @@ def get_views_by_hostname( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByHostname: """ Aggregates the number of views, grouping them by "host" domain name the built-in @@ -944,7 +942,7 @@ def get_views_by_operating_system( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByOperatingSystem: """ Aggregates the number of views for all client videos, grouping them by device @@ -995,7 +993,7 @@ def get_views_by_referer( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByReferer: """ Aggregates the number of views, grouping them by "referer" URL of pages the @@ -1046,7 +1044,7 @@ def get_views_by_region( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByRegion: """ Aggregates the number of views grouping them by regions of countries in the @@ -1099,7 +1097,7 @@ def get_views_heatmap( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsHeatmap: """ Shows information about what part of the video your viewers watched in the @@ -1159,7 +1157,7 @@ def get_vod_storage_volume( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """ Calculates time series of the duration in minutes for all processed and @@ -1207,7 +1205,7 @@ def get_vod_transcoding_duration( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """ Calculates time series of the transcoding time in minutes for all processed @@ -1250,15 +1248,15 @@ def get_vod_unique_viewers_cdn( *, from_: str, to: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, - slug: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, + slug: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """Calculates time series of unique viewers of VOD via CDN. @@ -1313,16 +1311,16 @@ def get_vod_watch_time_cdn( self, *, from_: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | NotGiven = NOT_GIVEN, - slug: str | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | Omit = omit, + slug: str | Omit = omit, + to: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """Calculates a time series of video watching duration in minutes. @@ -1378,16 +1376,16 @@ def get_vod_watch_time_cdn( def get_vod_watch_time_total_cdn( self, *, - client_user_id: int | NotGiven = NOT_GIVEN, - from_: str | NotGiven = NOT_GIVEN, - slug: str | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + from_: str | Omit = omit, + slug: str | Omit = omit, + to: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetVodWatchTimeTotalCdnResponse: """Calculates the total duration of video watching in minutes. @@ -1462,14 +1460,14 @@ async def get_ffprobes( date_from: str, date_to: str, stream_id: str, - interval: int | NotGiven = NOT_GIVEN, - units: Literal["second", "minute", "hour", "day", "week", "month"] | NotGiven = NOT_GIVEN, + interval: int | Omit = omit, + units: Literal["second", "minute", "hour", "day", "week", "month"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Ffprobes: """ Aggregates data for the specified video stream in the specified time interval. @@ -1518,15 +1516,15 @@ async def get_live_unique_viewers( *, from_: str, to: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, + stream_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetLiveUniqueViewersResponse: """Calculates time series of unique viewers of Live streams via CDN. @@ -1582,16 +1580,16 @@ async def get_live_watch_time_cdn( self, *, from_: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | Omit = omit, + stream_id: int | Omit = omit, + to: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamSeries: """Calculates a time series of live streams watching duration in minutes. @@ -1647,16 +1645,16 @@ async def get_live_watch_time_cdn( async def get_live_watch_time_total_cdn( self, *, - client_user_id: int | NotGiven = NOT_GIVEN, - from_: str | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + from_: str | Omit = omit, + stream_id: int | Omit = omit, + to: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodTotalStreamDurationSeries: """Calculates the total duration of live streams watching in minutes. @@ -1709,13 +1707,13 @@ async def get_max_streams_series( *, from_: str, to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> MaxStreamSeries: """Calculates time series of the amount of simultaneous streams. @@ -1766,7 +1764,7 @@ async def get_popular_videos( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PopularVideos: """ Aggregates the number of views for all client videos, grouping them by id and @@ -1813,13 +1811,13 @@ async def get_storage_series( *, from_: str, to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StorageSeries: """ Calculates time series of the size of disk space in bytes for all processed and @@ -1865,13 +1863,13 @@ async def get_stream_series( *, from_: str, to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamSeries: """Calculates time series of the transcoding minutes of all streams. @@ -1917,19 +1915,18 @@ async def get_unique_viewers( *, date_from: str, date_to: str, - id: str | NotGiven = NOT_GIVEN, - country: str | NotGiven = NOT_GIVEN, - event: Literal["init", "start", "watch"] | NotGiven = NOT_GIVEN, - group: List[Literal["date", "host", "os", "browser", "platform", "ip", "country", "event", "id"]] - | NotGiven = NOT_GIVEN, - host: str | NotGiven = NOT_GIVEN, - type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + country: str | Omit = omit, + event: Literal["init", "start", "watch"] | Omit = omit, + group: List[Literal["date", "host", "os", "browser", "platform", "ip", "country", "event", "id"]] | Omit = omit, + host: str | Omit = omit, + type: Literal["live", "vod", "playlist"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UniqueViewers: """Get the number of unique viewers in the built-in player. @@ -1995,14 +1992,14 @@ async def get_unique_viewers_cdn( *, date_from: str, date_to: str, - id: str | NotGiven = NOT_GIVEN, - type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + type: Literal["live", "vod", "playlist"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UniqueViewersCdn: """Сounts the number of unique viewers of a video entity over CDN. @@ -2078,19 +2075,18 @@ async def get_views( *, date_from: str, date_to: str, - id: str | NotGiven = NOT_GIVEN, - country: str | NotGiven = NOT_GIVEN, - event: Literal["init", "start", "watch"] | NotGiven = NOT_GIVEN, - group: List[Literal["host", "os", "browser", "platform", "ip", "country", "event", "id"]] - | NotGiven = NOT_GIVEN, - host: str | NotGiven = NOT_GIVEN, - type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + country: str | Omit = omit, + event: Literal["init", "start", "watch"] | Omit = omit, + group: List[Literal["host", "os", "browser", "platform", "ip", "country", "event", "id"]] | Omit = omit, + host: str | Omit = omit, + type: Literal["live", "vod", "playlist"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Views: """Get the number of views in the built-in player. @@ -2161,7 +2157,7 @@ async def get_views_by_browsers( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByBrowser: """ Aggregates the number of views for all client videos, grouping them by browsers @@ -2212,7 +2208,7 @@ async def get_views_by_country( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByCountry: """ Aggregates the number of views grouping them by country in the built-in player. @@ -2263,7 +2259,7 @@ async def get_views_by_hostname( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByHostname: """ Aggregates the number of views, grouping them by "host" domain name the built-in @@ -2314,7 +2310,7 @@ async def get_views_by_operating_system( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByOperatingSystem: """ Aggregates the number of views for all client videos, grouping them by device @@ -2365,7 +2361,7 @@ async def get_views_by_referer( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByReferer: """ Aggregates the number of views, grouping them by "referer" URL of pages the @@ -2416,7 +2412,7 @@ async def get_views_by_region( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByRegion: """ Aggregates the number of views grouping them by regions of countries in the @@ -2469,7 +2465,7 @@ async def get_views_heatmap( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsHeatmap: """ Shows information about what part of the video your viewers watched in the @@ -2529,7 +2525,7 @@ async def get_vod_storage_volume( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """ Calculates time series of the duration in minutes for all processed and @@ -2577,7 +2573,7 @@ async def get_vod_transcoding_duration( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """ Calculates time series of the transcoding time in minutes for all processed @@ -2620,15 +2616,15 @@ async def get_vod_unique_viewers_cdn( *, from_: str, to: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, - slug: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, + slug: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """Calculates time series of unique viewers of VOD via CDN. @@ -2683,16 +2679,16 @@ async def get_vod_watch_time_cdn( self, *, from_: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | NotGiven = NOT_GIVEN, - slug: str | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | Omit = omit, + slug: str | Omit = omit, + to: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """Calculates a time series of video watching duration in minutes. @@ -2748,16 +2744,16 @@ async def get_vod_watch_time_cdn( async def get_vod_watch_time_total_cdn( self, *, - client_user_id: int | NotGiven = NOT_GIVEN, - from_: str | NotGiven = NOT_GIVEN, - slug: str | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + from_: str | Omit = omit, + slug: str | Omit = omit, + to: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetVodWatchTimeTotalCdnResponse: """Calculates the total duration of video watching in minutes. diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index f52cfee4..b6f1b4fd 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -50,13 +50,13 @@ def create( self, stream_id: int, *, - body: Iterable[overlay_create_params.Body] | NotGiven = NOT_GIVEN, + body: Iterable[overlay_create_params.Body] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OverlayCreateResponse: """ "Overlay" is a live HTML widget, which rendered and inserted over the live @@ -136,18 +136,18 @@ def update( overlay_id: int, *, stream_id: int, - height: int | NotGiven = NOT_GIVEN, - stretch: bool | NotGiven = NOT_GIVEN, - url: str | NotGiven = NOT_GIVEN, - width: int | NotGiven = NOT_GIVEN, - x: int | NotGiven = NOT_GIVEN, - y: int | NotGiven = NOT_GIVEN, + height: int | Omit = omit, + stretch: bool | Omit = omit, + url: str | Omit = omit, + width: int | Omit = omit, + x: int | Omit = omit, + y: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Overlay: """ Updates overlay settings @@ -202,7 +202,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OverlayListResponse: """ Returns a list of HTML overlay widgets which are attached to a stream @@ -234,7 +234,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete an overlay @@ -267,7 +267,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Overlay: """ Get overlay details @@ -293,13 +293,13 @@ def update_multiple( self, stream_id: int, *, - body: Iterable[overlay_update_multiple_params.Body] | NotGiven = NOT_GIVEN, + body: Iterable[overlay_update_multiple_params.Body] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OverlayUpdateMultipleResponse: """ Updates settings for set of overlays @@ -347,13 +347,13 @@ async def create( self, stream_id: int, *, - body: Iterable[overlay_create_params.Body] | NotGiven = NOT_GIVEN, + body: Iterable[overlay_create_params.Body] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OverlayCreateResponse: """ "Overlay" is a live HTML widget, which rendered and inserted over the live @@ -433,18 +433,18 @@ async def update( overlay_id: int, *, stream_id: int, - height: int | NotGiven = NOT_GIVEN, - stretch: bool | NotGiven = NOT_GIVEN, - url: str | NotGiven = NOT_GIVEN, - width: int | NotGiven = NOT_GIVEN, - x: int | NotGiven = NOT_GIVEN, - y: int | NotGiven = NOT_GIVEN, + height: int | Omit = omit, + stretch: bool | Omit = omit, + url: str | Omit = omit, + width: int | Omit = omit, + x: int | Omit = omit, + y: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Overlay: """ Updates overlay settings @@ -499,7 +499,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OverlayListResponse: """ Returns a list of HTML overlay widgets which are attached to a stream @@ -531,7 +531,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete an overlay @@ -564,7 +564,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Overlay: """ Get overlay details @@ -590,13 +590,13 @@ async def update_multiple( self, stream_id: int, *, - body: Iterable[overlay_update_multiple_params.Body] | NotGiven = NOT_GIVEN, + body: Iterable[overlay_update_multiple_params.Body] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OverlayUpdateMultipleResponse: """ Updates settings for set of overlays diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 30c0c23b..691b6e03 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -15,7 +15,7 @@ OverlaysResourceWithStreamingResponse, AsyncOverlaysResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -70,27 +70,27 @@ def create( self, *, name: str, - active: bool | NotGiven = NOT_GIVEN, - auto_record: bool | NotGiven = NOT_GIVEN, - broadcast_ids: Iterable[int] | NotGiven = NOT_GIVEN, - cdn_id: int | NotGiven = NOT_GIVEN, - client_entity_data: str | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - dvr_duration: int | NotGiven = NOT_GIVEN, - dvr_enabled: bool | NotGiven = NOT_GIVEN, - hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN, - html_overlay: bool | NotGiven = NOT_GIVEN, - projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN, - pull: bool | NotGiven = NOT_GIVEN, - quality_set_id: int | NotGiven = NOT_GIVEN, - record_type: Literal["origin", "transcoded"] | NotGiven = NOT_GIVEN, - uri: str | NotGiven = NOT_GIVEN, + active: bool | Omit = omit, + auto_record: bool | Omit = omit, + broadcast_ids: Iterable[int] | Omit = omit, + cdn_id: int | Omit = omit, + client_entity_data: str | Omit = omit, + client_user_id: int | Omit = omit, + dvr_duration: int | Omit = omit, + dvr_enabled: bool | Omit = omit, + hls_mpegts_endlist_tag: bool | Omit = omit, + html_overlay: bool | Omit = omit, + projection: Literal["regular", "vr360", "vr180", "vr360tb"] | Omit = omit, + pull: bool | Omit = omit, + quality_set_id: int | Omit = omit, + record_type: Literal["origin", "transcoded"] | Omit = omit, + uri: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream: """ Use this method to create a new live stream entity for broadcasting. @@ -264,13 +264,13 @@ def update( self, stream_id: int, *, - stream: stream_update_params.Stream | NotGiven = NOT_GIVEN, + stream: stream_update_params.Stream | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream: """ Updates stream settings @@ -296,14 +296,14 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, - with_broadcasts: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + with_broadcasts: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreaming[Stream]: """Returns a list of streams @@ -351,7 +351,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a live stream. @@ -399,7 +399,7 @@ def clear_dvr( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Clear live stream DVR @@ -427,15 +427,15 @@ def create_clip( stream_id: int, *, duration: int, - expiration: int | NotGiven = NOT_GIVEN, - start: int | NotGiven = NOT_GIVEN, - vod_required: bool | NotGiven = NOT_GIVEN, + expiration: int | Omit = omit, + start: int | Omit = omit, + vod_required: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Clip: """Create an instant clip from on-going live stream. @@ -548,7 +548,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream: """ Returns stream details @@ -579,7 +579,7 @@ def list_clips( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamListClipsResponse: """ Get list of non expired instant clips for a stream. @@ -628,7 +628,7 @@ def start_recording( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamStartRecordingResponse: """ Start recording a stream. @@ -696,7 +696,7 @@ def stop_recording( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: """ Stop recording a stream. @@ -753,27 +753,27 @@ async def create( self, *, name: str, - active: bool | NotGiven = NOT_GIVEN, - auto_record: bool | NotGiven = NOT_GIVEN, - broadcast_ids: Iterable[int] | NotGiven = NOT_GIVEN, - cdn_id: int | NotGiven = NOT_GIVEN, - client_entity_data: str | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - dvr_duration: int | NotGiven = NOT_GIVEN, - dvr_enabled: bool | NotGiven = NOT_GIVEN, - hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN, - html_overlay: bool | NotGiven = NOT_GIVEN, - projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN, - pull: bool | NotGiven = NOT_GIVEN, - quality_set_id: int | NotGiven = NOT_GIVEN, - record_type: Literal["origin", "transcoded"] | NotGiven = NOT_GIVEN, - uri: str | NotGiven = NOT_GIVEN, + active: bool | Omit = omit, + auto_record: bool | Omit = omit, + broadcast_ids: Iterable[int] | Omit = omit, + cdn_id: int | Omit = omit, + client_entity_data: str | Omit = omit, + client_user_id: int | Omit = omit, + dvr_duration: int | Omit = omit, + dvr_enabled: bool | Omit = omit, + hls_mpegts_endlist_tag: bool | Omit = omit, + html_overlay: bool | Omit = omit, + projection: Literal["regular", "vr360", "vr180", "vr360tb"] | Omit = omit, + pull: bool | Omit = omit, + quality_set_id: int | Omit = omit, + record_type: Literal["origin", "transcoded"] | Omit = omit, + uri: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream: """ Use this method to create a new live stream entity for broadcasting. @@ -947,13 +947,13 @@ async def update( self, stream_id: int, *, - stream: stream_update_params.Stream | NotGiven = NOT_GIVEN, + stream: stream_update_params.Stream | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream: """ Updates stream settings @@ -979,14 +979,14 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, - with_broadcasts: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + with_broadcasts: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Stream, AsyncPageStreaming[Stream]]: """Returns a list of streams @@ -1034,7 +1034,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a live stream. @@ -1082,7 +1082,7 @@ async def clear_dvr( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Clear live stream DVR @@ -1110,15 +1110,15 @@ async def create_clip( stream_id: int, *, duration: int, - expiration: int | NotGiven = NOT_GIVEN, - start: int | NotGiven = NOT_GIVEN, - vod_required: bool | NotGiven = NOT_GIVEN, + expiration: int | Omit = omit, + start: int | Omit = omit, + vod_required: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Clip: """Create an instant clip from on-going live stream. @@ -1231,7 +1231,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream: """ Returns stream details @@ -1262,7 +1262,7 @@ async def list_clips( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamListClipsResponse: """ Get list of non expired instant clips for a stream. @@ -1311,7 +1311,7 @@ async def start_recording( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamStartRecordingResponse: """ Start recording a stream. @@ -1379,7 +1379,7 @@ async def stop_recording( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: """ Stop recording a stream. diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 4e59615e..08123c15 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -53,7 +53,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subtitle: """ Add new subtitle/captions to a video entity. @@ -133,15 +133,15 @@ def update( id: int, *, video_id: int, - language: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - vtt: str | NotGiven = NOT_GIVEN, + language: str | Omit = omit, + name: str | Omit = omit, + vtt: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SubtitleBase: """Method to update subtitle of a video. @@ -194,7 +194,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SubtitleListResponse: """ Method returns a list of all subtitles that are already attached to a video. @@ -226,7 +226,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete specified video subtitle @@ -259,7 +259,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subtitle: """ Returns information about a specific subtitle for a video. @@ -312,7 +312,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subtitle: """ Add new subtitle/captions to a video entity. @@ -392,15 +392,15 @@ async def update( id: int, *, video_id: int, - language: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - vtt: str | NotGiven = NOT_GIVEN, + language: str | Omit = omit, + name: str | Omit = omit, + vtt: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SubtitleBase: """Method to update subtitle of a video. @@ -453,7 +453,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SubtitleListResponse: """ Method returns a list of all subtitles that are already attached to a video. @@ -485,7 +485,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete specified video subtitle @@ -518,7 +518,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subtitle: """ Returns information about a specific subtitle for a video. diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index c77320db..0b306117 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from .subtitles import ( SubtitlesResource, @@ -70,13 +70,13 @@ def with_streaming_response(self) -> VideosResourceWithStreamingResponse: def create( self, *, - video: CreateVideoParam | NotGiven = NOT_GIVEN, + video: CreateVideoParam | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VideoCreateResponse: """ Use this method to create a new video entity. @@ -161,31 +161,31 @@ def update( video_id: int, *, name: str, - auto_transcribe_audio_language: Literal["disable", "auto", ""] | NotGiven = NOT_GIVEN, - auto_translate_subtitles_language: Literal["disable", "default", ""] | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - clip_duration_seconds: int | NotGiven = NOT_GIVEN, - clip_start_seconds: int | NotGiven = NOT_GIVEN, - custom_iframe_url: str | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - directory_id: int | NotGiven = NOT_GIVEN, - origin_http_headers: str | NotGiven = NOT_GIVEN, - origin_url: str | NotGiven = NOT_GIVEN, - poster: str | NotGiven = NOT_GIVEN, - priority: int | NotGiven = NOT_GIVEN, - projection: str | NotGiven = NOT_GIVEN, - quality_set_id: int | NotGiven = NOT_GIVEN, - remote_poster_url: str | NotGiven = NOT_GIVEN, - remove_poster: bool | NotGiven = NOT_GIVEN, - screenshot_id: int | NotGiven = NOT_GIVEN, - share_url: str | NotGiven = NOT_GIVEN, - source_bitrate_limit: bool | NotGiven = NOT_GIVEN, + auto_transcribe_audio_language: Literal["disable", "auto", ""] | Omit = omit, + auto_translate_subtitles_language: Literal["disable", "default", ""] | Omit = omit, + client_user_id: int | Omit = omit, + clip_duration_seconds: int | Omit = omit, + clip_start_seconds: int | Omit = omit, + custom_iframe_url: str | Omit = omit, + description: str | Omit = omit, + directory_id: int | Omit = omit, + origin_http_headers: str | Omit = omit, + origin_url: str | Omit = omit, + poster: str | Omit = omit, + priority: int | Omit = omit, + projection: str | Omit = omit, + quality_set_id: int | Omit = omit, + remote_poster_url: str | Omit = omit, + remove_poster: bool | Omit = omit, + screenshot_id: int | Omit = omit, + share_url: str | Omit = omit, + source_bitrate_limit: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: """Changes parameters of the video to new values. @@ -406,20 +406,20 @@ def update( def list( self, *, - id: str | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - fields: str | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - per_page: int | NotGiven = NOT_GIVEN, - search: str | NotGiven = NOT_GIVEN, - status: str | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + client_user_id: int | Omit = omit, + fields: str | Omit = omit, + page: int | Omit = omit, + per_page: int | Omit = omit, + search: str | Omit = omit, + status: str | Omit = omit, + stream_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreaming[Video]: """ Returns a set of videos by the given criteria. @@ -500,7 +500,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Operation to delete video entity. @@ -534,14 +534,14 @@ def delete( def create_multiple( self, *, - fields: str | NotGiven = NOT_GIVEN, - videos: Iterable[video_create_multiple_params.Video] | NotGiven = NOT_GIVEN, + fields: str | Omit = omit, + videos: Iterable[video_create_multiple_params.Video] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VideoCreateMultipleResponse: """Mass upload of your videos. @@ -596,7 +596,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: """Information about a video entity. @@ -641,7 +641,7 @@ def get_parameters_for_direct_upload( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectUploadParameters: """ Use this method to get TUS' session parameters: hostname of the server to @@ -695,13 +695,13 @@ def get_parameters_for_direct_upload( def list_names( self, *, - ids: Iterable[int] | NotGiven = NOT_GIVEN, + ids: Iterable[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Returns names for specified video IDs @@ -758,13 +758,13 @@ def with_streaming_response(self) -> AsyncVideosResourceWithStreamingResponse: async def create( self, *, - video: CreateVideoParam | NotGiven = NOT_GIVEN, + video: CreateVideoParam | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VideoCreateResponse: """ Use this method to create a new video entity. @@ -849,31 +849,31 @@ async def update( video_id: int, *, name: str, - auto_transcribe_audio_language: Literal["disable", "auto", ""] | NotGiven = NOT_GIVEN, - auto_translate_subtitles_language: Literal["disable", "default", ""] | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - clip_duration_seconds: int | NotGiven = NOT_GIVEN, - clip_start_seconds: int | NotGiven = NOT_GIVEN, - custom_iframe_url: str | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - directory_id: int | NotGiven = NOT_GIVEN, - origin_http_headers: str | NotGiven = NOT_GIVEN, - origin_url: str | NotGiven = NOT_GIVEN, - poster: str | NotGiven = NOT_GIVEN, - priority: int | NotGiven = NOT_GIVEN, - projection: str | NotGiven = NOT_GIVEN, - quality_set_id: int | NotGiven = NOT_GIVEN, - remote_poster_url: str | NotGiven = NOT_GIVEN, - remove_poster: bool | NotGiven = NOT_GIVEN, - screenshot_id: int | NotGiven = NOT_GIVEN, - share_url: str | NotGiven = NOT_GIVEN, - source_bitrate_limit: bool | NotGiven = NOT_GIVEN, + auto_transcribe_audio_language: Literal["disable", "auto", ""] | Omit = omit, + auto_translate_subtitles_language: Literal["disable", "default", ""] | Omit = omit, + client_user_id: int | Omit = omit, + clip_duration_seconds: int | Omit = omit, + clip_start_seconds: int | Omit = omit, + custom_iframe_url: str | Omit = omit, + description: str | Omit = omit, + directory_id: int | Omit = omit, + origin_http_headers: str | Omit = omit, + origin_url: str | Omit = omit, + poster: str | Omit = omit, + priority: int | Omit = omit, + projection: str | Omit = omit, + quality_set_id: int | Omit = omit, + remote_poster_url: str | Omit = omit, + remove_poster: bool | Omit = omit, + screenshot_id: int | Omit = omit, + share_url: str | Omit = omit, + source_bitrate_limit: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: """Changes parameters of the video to new values. @@ -1094,20 +1094,20 @@ async def update( def list( self, *, - id: str | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - fields: str | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - per_page: int | NotGiven = NOT_GIVEN, - search: str | NotGiven = NOT_GIVEN, - status: str | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + client_user_id: int | Omit = omit, + fields: str | Omit = omit, + page: int | Omit = omit, + per_page: int | Omit = omit, + search: str | Omit = omit, + status: str | Omit = omit, + stream_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Video, AsyncPageStreaming[Video]]: """ Returns a set of videos by the given criteria. @@ -1188,7 +1188,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Operation to delete video entity. @@ -1222,14 +1222,14 @@ async def delete( async def create_multiple( self, *, - fields: str | NotGiven = NOT_GIVEN, - videos: Iterable[video_create_multiple_params.Video] | NotGiven = NOT_GIVEN, + fields: str | Omit = omit, + videos: Iterable[video_create_multiple_params.Video] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VideoCreateMultipleResponse: """Mass upload of your videos. @@ -1288,7 +1288,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: """Information about a video entity. @@ -1333,7 +1333,7 @@ async def get_parameters_for_direct_upload( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectUploadParameters: """ Use this method to get TUS' session parameters: hostname of the server to @@ -1387,13 +1387,13 @@ async def get_parameters_for_direct_upload( async def list_names( self, *, - ids: Iterable[int] | NotGiven = NOT_GIVEN, + ids: Iterable[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Returns names for specified video IDs diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py index 30c32c1c..6f4aca32 100644 --- a/src/gcore/resources/waap/advanced_rules.py +++ b/src/gcore/resources/waap/advanced_rules.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -47,7 +47,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return self._get( @@ -87,7 +87,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return await self._get( diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index 7ce6dca4..11d40a03 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -55,19 +55,19 @@ def create( self, *, name: str, - block: Optional[custom_page_set_create_params.Block] | NotGiven = NOT_GIVEN, - block_csrf: Optional[custom_page_set_create_params.BlockCsrf] | NotGiven = NOT_GIVEN, - captcha: Optional[custom_page_set_create_params.Captcha] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[custom_page_set_create_params.CookieDisabled] | NotGiven = NOT_GIVEN, - domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[custom_page_set_create_params.Handshake] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[custom_page_set_create_params.JavascriptDisabled] | NotGiven = NOT_GIVEN, + block: Optional[custom_page_set_create_params.Block] | Omit = omit, + block_csrf: Optional[custom_page_set_create_params.BlockCsrf] | Omit = omit, + captcha: Optional[custom_page_set_create_params.Captcha] | Omit = omit, + cookie_disabled: Optional[custom_page_set_create_params.CookieDisabled] | Omit = omit, + domains: Optional[Iterable[int]] | Omit = omit, + handshake: Optional[custom_page_set_create_params.Handshake] | Omit = omit, + javascript_disabled: Optional[custom_page_set_create_params.JavascriptDisabled] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomPageSet: """Create a custom page set based on the provided data. @@ -112,20 +112,20 @@ def update( self, set_id: int, *, - block: Optional[custom_page_set_update_params.Block] | NotGiven = NOT_GIVEN, - block_csrf: Optional[custom_page_set_update_params.BlockCsrf] | NotGiven = NOT_GIVEN, - captcha: Optional[custom_page_set_update_params.Captcha] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[custom_page_set_update_params.CookieDisabled] | NotGiven = NOT_GIVEN, - domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[custom_page_set_update_params.Handshake] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[custom_page_set_update_params.JavascriptDisabled] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + block: Optional[custom_page_set_update_params.Block] | Omit = omit, + block_csrf: Optional[custom_page_set_update_params.BlockCsrf] | Omit = omit, + captcha: Optional[custom_page_set_update_params.Captcha] | Omit = omit, + cookie_disabled: Optional[custom_page_set_update_params.CookieDisabled] | Omit = omit, + domains: Optional[Iterable[int]] | Omit = omit, + handshake: Optional[custom_page_set_update_params.Handshake] | Omit = omit, + javascript_disabled: Optional[custom_page_set_update_params.JavascriptDisabled] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Update a custom page set based on the provided parameters. @@ -175,17 +175,17 @@ def update( def list( self, *, - ids: Iterable[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["name", "-name", "id", "-id"] | NotGiven = NOT_GIVEN, + ids: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["name", "-name", "id", "-id"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapCustomPageSet]: """ Retrieve a list of custom page sets available for use @@ -240,7 +240,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a custom page set @@ -274,7 +274,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomPageSet: """ Retrieve a custom page set based on the provided ID @@ -309,17 +309,17 @@ def preview( "handshake.html", "javascriptDisabled.html", ], - error: Optional[str] | NotGiven = NOT_GIVEN, - header: Optional[str] | NotGiven = NOT_GIVEN, - logo: Optional[str] | NotGiven = NOT_GIVEN, - text: Optional[str] | NotGiven = NOT_GIVEN, - title: Optional[str] | NotGiven = NOT_GIVEN, + error: Optional[str] | Omit = omit, + header: Optional[str] | Omit = omit, + logo: Optional[str] | Omit = omit, + text: Optional[str] | Omit = omit, + title: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomPagePreview: """ Allows to preview a custom page without creating it based on the provided type @@ -397,19 +397,19 @@ async def create( self, *, name: str, - block: Optional[custom_page_set_create_params.Block] | NotGiven = NOT_GIVEN, - block_csrf: Optional[custom_page_set_create_params.BlockCsrf] | NotGiven = NOT_GIVEN, - captcha: Optional[custom_page_set_create_params.Captcha] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[custom_page_set_create_params.CookieDisabled] | NotGiven = NOT_GIVEN, - domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[custom_page_set_create_params.Handshake] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[custom_page_set_create_params.JavascriptDisabled] | NotGiven = NOT_GIVEN, + block: Optional[custom_page_set_create_params.Block] | Omit = omit, + block_csrf: Optional[custom_page_set_create_params.BlockCsrf] | Omit = omit, + captcha: Optional[custom_page_set_create_params.Captcha] | Omit = omit, + cookie_disabled: Optional[custom_page_set_create_params.CookieDisabled] | Omit = omit, + domains: Optional[Iterable[int]] | Omit = omit, + handshake: Optional[custom_page_set_create_params.Handshake] | Omit = omit, + javascript_disabled: Optional[custom_page_set_create_params.JavascriptDisabled] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomPageSet: """Create a custom page set based on the provided data. @@ -454,20 +454,20 @@ async def update( self, set_id: int, *, - block: Optional[custom_page_set_update_params.Block] | NotGiven = NOT_GIVEN, - block_csrf: Optional[custom_page_set_update_params.BlockCsrf] | NotGiven = NOT_GIVEN, - captcha: Optional[custom_page_set_update_params.Captcha] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[custom_page_set_update_params.CookieDisabled] | NotGiven = NOT_GIVEN, - domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[custom_page_set_update_params.Handshake] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[custom_page_set_update_params.JavascriptDisabled] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + block: Optional[custom_page_set_update_params.Block] | Omit = omit, + block_csrf: Optional[custom_page_set_update_params.BlockCsrf] | Omit = omit, + captcha: Optional[custom_page_set_update_params.Captcha] | Omit = omit, + cookie_disabled: Optional[custom_page_set_update_params.CookieDisabled] | Omit = omit, + domains: Optional[Iterable[int]] | Omit = omit, + handshake: Optional[custom_page_set_update_params.Handshake] | Omit = omit, + javascript_disabled: Optional[custom_page_set_update_params.JavascriptDisabled] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Update a custom page set based on the provided parameters. @@ -517,17 +517,17 @@ async def update( def list( self, *, - ids: Iterable[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["name", "-name", "id", "-id"] | NotGiven = NOT_GIVEN, + ids: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["name", "-name", "id", "-id"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapCustomPageSet, AsyncOffsetPage[WaapCustomPageSet]]: """ Retrieve a list of custom page sets available for use @@ -582,7 +582,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a custom page set @@ -616,7 +616,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomPageSet: """ Retrieve a custom page set based on the provided ID @@ -651,17 +651,17 @@ async def preview( "handshake.html", "javascriptDisabled.html", ], - error: Optional[str] | NotGiven = NOT_GIVEN, - header: Optional[str] | NotGiven = NOT_GIVEN, - logo: Optional[str] | NotGiven = NOT_GIVEN, - text: Optional[str] | NotGiven = NOT_GIVEN, - title: Optional[str] | NotGiven = NOT_GIVEN, + error: Optional[str] | Omit = omit, + header: Optional[str] | Omit = omit, + logo: Optional[str] | Omit = omit, + text: Optional[str] | Omit = omit, + title: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomPagePreview: """ Allows to preview a custom page without creating it based on the provided type diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index e22a838f..5299f49c 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -53,14 +53,14 @@ def create( enabled: bool, name: str, source: str, - description: Optional[str] | NotGiven = NOT_GIVEN, - phase: Optional[Literal["access", "header_filter", "body_filter"]] | NotGiven = NOT_GIVEN, + description: Optional[str] | Omit = omit, + phase: Optional[Literal["access", "header_filter", "body_filter"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAdvancedRule: """ Create an advanced rule @@ -120,18 +120,18 @@ def update( rule_id: int, *, domain_id: int, - action: Optional[advanced_rule_update_params.Action] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - enabled: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - phase: Optional[Literal["access", "header_filter", "body_filter"]] | NotGiven = NOT_GIVEN, - source: Optional[str] | NotGiven = NOT_GIVEN, + action: Optional[advanced_rule_update_params.Action] | Omit = omit, + description: Optional[str] | Omit = omit, + enabled: Optional[bool] | Omit = omit, + name: Optional[str] | Omit = omit, + phase: Optional[Literal["access", "header_filter", "body_filter"]] | Omit = omit, + source: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Only properties present in the request will be updated @@ -193,12 +193,12 @@ def list( self, domain_id: int, *, - action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | Omit = omit, + description: str | Omit = omit, + enabled: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[ Literal[ "id", @@ -215,14 +215,14 @@ def list( "-phase", ] ] - | NotGiven = NOT_GIVEN, - phase: Literal["access", "header_filter", "body_filter"] | NotGiven = NOT_GIVEN, + | Omit = omit, + phase: Literal["access", "header_filter", "body_filter"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapAdvancedRule]: """ Retrieve a list of advanced rules assigned to a domain, offering filter, @@ -295,7 +295,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete an advanced rule @@ -332,7 +332,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAdvancedRule: """ Retrieve a specific advanced rule assigned to a domain @@ -369,7 +369,7 @@ def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Toggle an advanced rule @@ -429,14 +429,14 @@ async def create( enabled: bool, name: str, source: str, - description: Optional[str] | NotGiven = NOT_GIVEN, - phase: Optional[Literal["access", "header_filter", "body_filter"]] | NotGiven = NOT_GIVEN, + description: Optional[str] | Omit = omit, + phase: Optional[Literal["access", "header_filter", "body_filter"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAdvancedRule: """ Create an advanced rule @@ -496,18 +496,18 @@ async def update( rule_id: int, *, domain_id: int, - action: Optional[advanced_rule_update_params.Action] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - enabled: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - phase: Optional[Literal["access", "header_filter", "body_filter"]] | NotGiven = NOT_GIVEN, - source: Optional[str] | NotGiven = NOT_GIVEN, + action: Optional[advanced_rule_update_params.Action] | Omit = omit, + description: Optional[str] | Omit = omit, + enabled: Optional[bool] | Omit = omit, + name: Optional[str] | Omit = omit, + phase: Optional[Literal["access", "header_filter", "body_filter"]] | Omit = omit, + source: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Only properties present in the request will be updated @@ -569,12 +569,12 @@ def list( self, domain_id: int, *, - action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | Omit = omit, + description: str | Omit = omit, + enabled: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[ Literal[ "id", @@ -591,14 +591,14 @@ def list( "-phase", ] ] - | NotGiven = NOT_GIVEN, - phase: Literal["access", "header_filter", "body_filter"] | NotGiven = NOT_GIVEN, + | Omit = omit, + phase: Literal["access", "header_filter", "body_filter"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapAdvancedRule, AsyncOffsetPage[WaapAdvancedRule]]: """ Retrieve a list of advanced rules assigned to a domain, offering filter, @@ -671,7 +671,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete an advanced rule @@ -708,7 +708,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAdvancedRule: """ Retrieve a specific advanced rule assigned to a domain @@ -745,7 +745,7 @@ async def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Toggle an advanced rule diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py index 6b1f7896..426426f5 100644 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -61,7 +61,7 @@ def get_scan_result( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIScanResult: """ Get Scan Result @@ -98,7 +98,7 @@ def get_settings( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIDiscoverySettings: """ Retrieve the API discovery settings for a domain @@ -126,9 +126,9 @@ def list_scan_results( self, domain_id: int, *, - limit: int | NotGiven = NOT_GIVEN, - message: Optional[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + message: Optional[str] | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "type", @@ -143,15 +143,15 @@ def list_scan_results( "-status", "-message", ] - | NotGiven = NOT_GIVEN, - status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | NotGiven = NOT_GIVEN, - type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | NotGiven = NOT_GIVEN, + | Omit = omit, + status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | Omit = omit, + type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapAPIScanResult]: """ Get Scan Results @@ -211,7 +211,7 @@ def scan_openapi( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapTaskID: """Scan an API description file hosted online. @@ -242,17 +242,17 @@ def update_settings( self, domain_id: int, *, - description_file_location: Optional[str] | NotGiven = NOT_GIVEN, - description_file_scan_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - description_file_scan_interval_hours: Optional[int] | NotGiven = NOT_GIVEN, - traffic_scan_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - traffic_scan_interval_hours: Optional[int] | NotGiven = NOT_GIVEN, + description_file_location: Optional[str] | Omit = omit, + description_file_scan_enabled: Optional[bool] | Omit = omit, + description_file_scan_interval_hours: Optional[int] | Omit = omit, + traffic_scan_enabled: Optional[bool] | Omit = omit, + traffic_scan_interval_hours: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIDiscoverySettings: """ Update the API discovery settings for a domain @@ -309,7 +309,7 @@ def upload_openapi( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapTaskID: """ An API description file must adhere to the OpenAPI specification and be written @@ -379,7 +379,7 @@ async def get_scan_result( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIScanResult: """ Get Scan Result @@ -416,7 +416,7 @@ async def get_settings( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIDiscoverySettings: """ Retrieve the API discovery settings for a domain @@ -444,9 +444,9 @@ def list_scan_results( self, domain_id: int, *, - limit: int | NotGiven = NOT_GIVEN, - message: Optional[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + message: Optional[str] | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "type", @@ -461,15 +461,15 @@ def list_scan_results( "-status", "-message", ] - | NotGiven = NOT_GIVEN, - status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | NotGiven = NOT_GIVEN, - type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | NotGiven = NOT_GIVEN, + | Omit = omit, + status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | Omit = omit, + type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapAPIScanResult, AsyncOffsetPage[WaapAPIScanResult]]: """ Get Scan Results @@ -529,7 +529,7 @@ async def scan_openapi( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapTaskID: """Scan an API description file hosted online. @@ -560,17 +560,17 @@ async def update_settings( self, domain_id: int, *, - description_file_location: Optional[str] | NotGiven = NOT_GIVEN, - description_file_scan_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - description_file_scan_interval_hours: Optional[int] | NotGiven = NOT_GIVEN, - traffic_scan_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - traffic_scan_interval_hours: Optional[int] | NotGiven = NOT_GIVEN, + description_file_location: Optional[str] | Omit = omit, + description_file_scan_enabled: Optional[bool] | Omit = omit, + description_file_scan_interval_hours: Optional[int] | Omit = omit, + traffic_scan_enabled: Optional[bool] | Omit = omit, + traffic_scan_interval_hours: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIDiscoverySettings: """ Update the API discovery settings for a domain @@ -627,7 +627,7 @@ async def upload_openapi( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapTaskID: """ An API description file must adhere to the OpenAPI specification and be written diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py index 3e66ea27..a6b25b2e 100644 --- a/src/gcore/resources/waap/domains/api_path_groups.py +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -48,7 +48,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APIPathGroupList: """ Retrieve a list of API path groups for a specific domain @@ -102,7 +102,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APIPathGroupList: """ Retrieve a list of API path groups for a specific domain diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index fc1dd68c..fa4c9935 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -52,15 +52,15 @@ def create( http_scheme: Literal["HTTP", "HTTPS"], method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"], path: str, - api_groups: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - api_version: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + api_groups: SequenceNotStr[str] | Omit = omit, + api_version: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIPath: """ Create an API path for a domain @@ -113,16 +113,16 @@ def update( path_id: str, *, domain_id: int, - api_groups: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + api_groups: SequenceNotStr[str] | Omit = omit, + path: str | Omit = omit, + status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Update a specific API path for a domain @@ -173,14 +173,13 @@ def list( self, domain_id: int, *, - api_group: Optional[str] | NotGiven = NOT_GIVEN, - api_version: Optional[str] | NotGiven = NOT_GIVEN, - http_scheme: Optional[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, - ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] - | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + api_group: Optional[str] | Omit = omit, + api_version: Optional[str] | Omit = omit, + http_scheme: Optional[Literal["HTTP", "HTTPS"]] | Omit = omit, + ids: Optional[SequenceNotStr[str]] | Omit = omit, + limit: int | Omit = omit, + method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "path", @@ -201,17 +200,16 @@ def list( "-status", "-source", ] - | NotGiven = NOT_GIVEN, - path: Optional[str] | NotGiven = NOT_GIVEN, - source: Optional[Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"]] | NotGiven = NOT_GIVEN, - status: Optional[List[Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"]]] - | NotGiven = NOT_GIVEN, + | Omit = omit, + path: Optional[str] | Omit = omit, + source: Optional[Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"]] | Omit = omit, + status: Optional[List[Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapAPIPath]: """ Retrieve a list of API paths for a specific domain @@ -287,7 +285,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific API path for a domain @@ -326,7 +324,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIPath: """ Retrieve a specific API path for a domain @@ -382,15 +380,15 @@ async def create( http_scheme: Literal["HTTP", "HTTPS"], method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"], path: str, - api_groups: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - api_version: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + api_groups: SequenceNotStr[str] | Omit = omit, + api_version: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIPath: """ Create an API path for a domain @@ -443,16 +441,16 @@ async def update( path_id: str, *, domain_id: int, - api_groups: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + api_groups: SequenceNotStr[str] | Omit = omit, + path: str | Omit = omit, + status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Update a specific API path for a domain @@ -503,14 +501,13 @@ def list( self, domain_id: int, *, - api_group: Optional[str] | NotGiven = NOT_GIVEN, - api_version: Optional[str] | NotGiven = NOT_GIVEN, - http_scheme: Optional[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, - ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] - | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + api_group: Optional[str] | Omit = omit, + api_version: Optional[str] | Omit = omit, + http_scheme: Optional[Literal["HTTP", "HTTPS"]] | Omit = omit, + ids: Optional[SequenceNotStr[str]] | Omit = omit, + limit: int | Omit = omit, + method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "path", @@ -531,17 +528,16 @@ def list( "-status", "-source", ] - | NotGiven = NOT_GIVEN, - path: Optional[str] | NotGiven = NOT_GIVEN, - source: Optional[Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"]] | NotGiven = NOT_GIVEN, - status: Optional[List[Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"]]] - | NotGiven = NOT_GIVEN, + | Omit = omit, + path: Optional[str] | Omit = omit, + source: Optional[Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"]] | Omit = omit, + status: Optional[List[Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapAPIPath, AsyncOffsetPage[WaapAPIPath]]: """ Retrieve a list of API paths for a specific domain @@ -617,7 +613,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific API path for a domain @@ -656,7 +652,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIPath: """ Retrieve a specific API path for a domain diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index f175a192..8b6ccbf0 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -58,13 +58,13 @@ def create( conditions: Iterable[custom_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, + description: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomRule: """ Create a custom rule @@ -114,17 +114,17 @@ def update( rule_id: int, *, domain_id: int, - action: Optional[custom_rule_update_params.Action] | NotGiven = NOT_GIVEN, - conditions: Optional[Iterable[custom_rule_update_params.Condition]] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - enabled: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + action: Optional[custom_rule_update_params.Action] | Omit = omit, + conditions: Optional[Iterable[custom_rule_update_params.Condition]] | Omit = omit, + description: Optional[str] | Omit = omit, + enabled: Optional[bool] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Only properties present in the request will be updated @@ -176,24 +176,24 @@ def list( self, domain_id: int, *, - action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | Omit = omit, + description: str | Omit = omit, + enabled: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[ Literal[ "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action" ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapCustomRule]: """ Extracts a list of custom rules assigned to a domain, offering filter, ordering, @@ -258,7 +258,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a custom rule @@ -295,7 +295,7 @@ def delete_multiple( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete multiple WAAP rules @@ -335,7 +335,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomRule: """ Extracts a specific custom rule assigned to a domain @@ -372,7 +372,7 @@ def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Toggle a custom rule @@ -432,13 +432,13 @@ async def create( conditions: Iterable[custom_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, + description: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomRule: """ Create a custom rule @@ -488,17 +488,17 @@ async def update( rule_id: int, *, domain_id: int, - action: Optional[custom_rule_update_params.Action] | NotGiven = NOT_GIVEN, - conditions: Optional[Iterable[custom_rule_update_params.Condition]] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - enabled: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + action: Optional[custom_rule_update_params.Action] | Omit = omit, + conditions: Optional[Iterable[custom_rule_update_params.Condition]] | Omit = omit, + description: Optional[str] | Omit = omit, + enabled: Optional[bool] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Only properties present in the request will be updated @@ -550,24 +550,24 @@ def list( self, domain_id: int, *, - action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | Omit = omit, + description: str | Omit = omit, + enabled: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[ Literal[ "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action" ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapCustomRule, AsyncOffsetPage[WaapCustomRule]]: """ Extracts a list of custom rules assigned to a domain, offering filter, ordering, @@ -632,7 +632,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a custom rule @@ -669,7 +669,7 @@ async def delete_multiple( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete multiple WAAP rules @@ -709,7 +709,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomRule: """ Extracts a specific custom rule assigned to a domain @@ -746,7 +746,7 @@ async def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Toggle a custom rule diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index cf4135cc..b0d8c1b0 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -23,7 +23,7 @@ SettingsResourceWithStreamingResponse, AsyncSettingsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from .api_paths import ( APIPathsResource, @@ -172,13 +172,13 @@ def update( self, domain_id: int, *, - status: Literal["active", "monitor"] | NotGiven = NOT_GIVEN, + status: Literal["active", "monitor"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Update Domain @@ -209,19 +209,18 @@ def update( def list( self, *, - ids: Iterable[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] - | NotGiven = NOT_GIVEN, - status: Literal["active", "bypass", "monitor", "locked"] | NotGiven = NOT_GIVEN, + ids: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] | Omit = omit, + status: Literal["active", "bypass", "monitor", "locked"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapSummaryDomain]: """ Retrieve a list of domains associated with the client @@ -279,7 +278,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Delete an inactive domain by ID. @@ -315,7 +314,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapDetailedDomain: """ Retrieve detailed information about a specific domain @@ -348,7 +347,7 @@ def list_rule_sets( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DomainListRuleSetsResponse: """ Retrieve all rule sets linked to a particular domain @@ -382,7 +381,7 @@ def toggle_policy( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapPolicyMode: """ Modify the activation state of a policy associated with a domain @@ -475,13 +474,13 @@ async def update( self, domain_id: int, *, - status: Literal["active", "monitor"] | NotGiven = NOT_GIVEN, + status: Literal["active", "monitor"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Update Domain @@ -512,19 +511,18 @@ async def update( def list( self, *, - ids: Iterable[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] - | NotGiven = NOT_GIVEN, - status: Literal["active", "bypass", "monitor", "locked"] | NotGiven = NOT_GIVEN, + ids: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] | Omit = omit, + status: Literal["active", "bypass", "monitor", "locked"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapSummaryDomain, AsyncOffsetPage[WaapSummaryDomain]]: """ Retrieve a list of domains associated with the client @@ -582,7 +580,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Delete an inactive domain by ID. @@ -618,7 +616,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapDetailedDomain: """ Retrieve detailed information about a specific domain @@ -651,7 +649,7 @@ async def list_rule_sets( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DomainListRuleSetsResponse: """ Retrieve all rule sets linked to a particular domain @@ -685,7 +683,7 @@ async def toggle_policy( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapPolicyMode: """ Modify the activation state of a policy associated with a domain diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index b8600359..8b7b446a 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -58,13 +58,13 @@ def create( conditions: Iterable[firewall_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, + description: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapFirewallRule: """ Create a firewall rule @@ -113,17 +113,17 @@ def update( rule_id: int, *, domain_id: int, - action: Optional[firewall_rule_update_params.Action] | NotGiven = NOT_GIVEN, - conditions: Optional[Iterable[firewall_rule_update_params.Condition]] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - enabled: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + action: Optional[firewall_rule_update_params.Action] | Omit = omit, + conditions: Optional[Iterable[firewall_rule_update_params.Condition]] | Omit = omit, + description: Optional[str] | Omit = omit, + enabled: Optional[bool] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Only properties present in the request will be updated @@ -174,24 +174,24 @@ def list( self, domain_id: int, *, - action: Literal["allow", "block"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + action: Literal["allow", "block"] | Omit = omit, + description: str | Omit = omit, + enabled: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[ Literal[ "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action" ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapFirewallRule]: """ Extracts a list of firewall rules assigned to a domain, offering filter, @@ -256,7 +256,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a firewall rule @@ -293,7 +293,7 @@ def delete_multiple( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete multiple WAAP rules @@ -333,7 +333,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapFirewallRule: """ Extracts a specific firewall rule assigned to a domain @@ -370,7 +370,7 @@ def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Toggle a firewall rule @@ -430,13 +430,13 @@ async def create( conditions: Iterable[firewall_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, + description: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapFirewallRule: """ Create a firewall rule @@ -485,17 +485,17 @@ async def update( rule_id: int, *, domain_id: int, - action: Optional[firewall_rule_update_params.Action] | NotGiven = NOT_GIVEN, - conditions: Optional[Iterable[firewall_rule_update_params.Condition]] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - enabled: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + action: Optional[firewall_rule_update_params.Action] | Omit = omit, + conditions: Optional[Iterable[firewall_rule_update_params.Condition]] | Omit = omit, + description: Optional[str] | Omit = omit, + enabled: Optional[bool] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Only properties present in the request will be updated @@ -546,24 +546,24 @@ def list( self, domain_id: int, *, - action: Literal["allow", "block"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + action: Literal["allow", "block"] | Omit = omit, + description: str | Omit = omit, + enabled: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[ Literal[ "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action" ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapFirewallRule, AsyncOffsetPage[WaapFirewallRule]]: """ Extracts a list of firewall rules assigned to a domain, offering filter, @@ -628,7 +628,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a firewall rule @@ -665,7 +665,7 @@ async def delete_multiple( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete multiple WAAP rules @@ -705,7 +705,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapFirewallRule: """ Extracts a specific firewall rule assigned to a domain @@ -742,7 +742,7 @@ async def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Toggle a firewall rule diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 577332e9..8b57783e 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -8,7 +8,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -58,13 +58,13 @@ def create( comment: str, insight_type: str, labels: Dict[str, str], - expire_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + expire_at: Union[str, datetime, None] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsightSilence: """Create a new insight silence for a specified domain. @@ -118,13 +118,13 @@ def update( author: str, comment: str, expire_at: Union[str, datetime, None], - labels: Dict[str, str] | NotGiven = NOT_GIVEN, + labels: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsightSilence: """ Update an insight silence for a specific domain. @@ -173,12 +173,12 @@ def list( self, domain_id: int, *, - id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - author: Optional[str] | NotGiven = NOT_GIVEN, - comment: Optional[str] | NotGiven = NOT_GIVEN, - insight_type: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + id: Optional[SequenceNotStr[str]] | Omit = omit, + author: Optional[str] | Omit = omit, + comment: Optional[str] | Omit = omit, + insight_type: Optional[SequenceNotStr[str]] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "-id", @@ -191,13 +191,13 @@ def list( "expire_at", "-expire_at", ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapInsightSilence]: """ Retrieve a list of insight silences for a specific domain @@ -261,7 +261,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete an insight silence for a specific domain. @@ -300,7 +300,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsightSilence: """ Retrieve a specific insight silence for a specific domain @@ -357,13 +357,13 @@ async def create( comment: str, insight_type: str, labels: Dict[str, str], - expire_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + expire_at: Union[str, datetime, None] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsightSilence: """Create a new insight silence for a specified domain. @@ -417,13 +417,13 @@ async def update( author: str, comment: str, expire_at: Union[str, datetime, None], - labels: Dict[str, str] | NotGiven = NOT_GIVEN, + labels: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsightSilence: """ Update an insight silence for a specific domain. @@ -472,12 +472,12 @@ def list( self, domain_id: int, *, - id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - author: Optional[str] | NotGiven = NOT_GIVEN, - comment: Optional[str] | NotGiven = NOT_GIVEN, - insight_type: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + id: Optional[SequenceNotStr[str]] | Omit = omit, + author: Optional[str] | Omit = omit, + comment: Optional[str] | Omit = omit, + insight_type: Optional[SequenceNotStr[str]] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "-id", @@ -490,13 +490,13 @@ def list( "expire_at", "-expire_at", ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapInsightSilence, AsyncOffsetPage[WaapInsightSilence]]: """ Retrieve a list of insight silences for a specific domain @@ -560,7 +560,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete an insight silence for a specific domain. @@ -599,7 +599,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsightSilence: """ Retrieve a specific insight silence for a specific domain diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 8fb4ab52..924fe5e2 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -49,11 +49,11 @@ def list( self, domain_id: int, *, - id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - insight_type: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + id: Optional[SequenceNotStr[str]] | Omit = omit, + description: Optional[str] | Omit = omit, + insight_type: Optional[SequenceNotStr[str]] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "-id", @@ -68,14 +68,14 @@ def list( "status", "-status", ] - | NotGiven = NOT_GIVEN, - status: Optional[List[Literal["OPEN", "ACKED", "CLOSED"]]] | NotGiven = NOT_GIVEN, + | Omit = omit, + status: Optional[List[Literal["OPEN", "ACKED", "CLOSED"]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapInsight]: """ Retrieve a list of insights for a specific domain. @@ -139,7 +139,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsight: """ Retrieve a specific insight for a specific domain. @@ -176,7 +176,7 @@ def replace( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsight: """ Update the status of an insight for a specific domain. @@ -232,11 +232,11 @@ def list( self, domain_id: int, *, - id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - insight_type: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + id: Optional[SequenceNotStr[str]] | Omit = omit, + description: Optional[str] | Omit = omit, + insight_type: Optional[SequenceNotStr[str]] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "-id", @@ -251,14 +251,14 @@ def list( "status", "-status", ] - | NotGiven = NOT_GIVEN, - status: Optional[List[Literal["OPEN", "ACKED", "CLOSED"]]] | NotGiven = NOT_GIVEN, + | Omit = omit, + status: Optional[List[Literal["OPEN", "ACKED", "CLOSED"]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapInsight, AsyncOffsetPage[WaapInsight]]: """ Retrieve a list of insights for a specific domain. @@ -322,7 +322,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsight: """ Retrieve a specific insight for a specific domain. @@ -359,7 +359,7 @@ async def replace( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsight: """ Update the status of an insight for a specific domain. diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py index fc9cafbf..fcaabeaa 100644 --- a/src/gcore/resources/waap/domains/settings.py +++ b/src/gcore/resources/waap/domains/settings.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -45,14 +45,14 @@ def update( self, domain_id: int, *, - api: setting_update_params.API | NotGiven = NOT_GIVEN, - ddos: setting_update_params.DDOS | NotGiven = NOT_GIVEN, + api: setting_update_params.API | Omit = omit, + ddos: setting_update_params.DDOS | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Update settings for a specific domain @@ -97,7 +97,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapDomainSettingsModel: """ Retrieve settings for a specific domain @@ -146,14 +146,14 @@ async def update( self, domain_id: int, *, - api: setting_update_params.API | NotGiven = NOT_GIVEN, - ddos: setting_update_params.DDOS | NotGiven = NOT_GIVEN, + api: setting_update_params.API | Omit = omit, + ddos: setting_update_params.DDOS | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Update settings for a specific domain @@ -198,7 +198,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapDomainSettingsModel: """ Retrieve settings for a specific domain diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index f23b048b..94514578 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -8,7 +8,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -61,17 +61,17 @@ def get_ddos_attacks( self, domain_id: int, *, - end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | NotGiven = NOT_GIVEN, - start_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + end_time: Union[str, datetime, None] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | Omit = omit, + start_time: Union[str, datetime, None] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapDDOSAttack]: """ Retrieve a domain's DDoS attacks @@ -125,15 +125,15 @@ def get_ddos_info( *, group_by: Literal["URL", "User-Agent", "IP"], start: str, - end: Optional[str] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + end: Optional[str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapDDOSInfo]: """ Returns the top DDoS counts grouped by URL, User-Agent or IP @@ -187,17 +187,17 @@ def get_events_aggregated( domain_id: int, *, start: str, - action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | NotGiven = NOT_GIVEN, - end: Optional[str] | NotGiven = NOT_GIVEN, - ip: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - reference_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | NotGiven = NOT_GIVEN, + action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | Omit = omit, + end: Optional[str] | Omit = omit, + ip: Optional[SequenceNotStr[str]] | Omit = omit, + reference_id: Optional[SequenceNotStr[str]] | Omit = omit, + result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapEventStatistics: """ Retrieve an domain's event statistics @@ -258,7 +258,7 @@ def get_request_details( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapRequestDetails: """ Retrieves all the available information for a request that matches a given @@ -292,16 +292,16 @@ def get_requests_series( domain_id: int, *, start: str, - actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, - countries: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - end: Optional[str] | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: str | NotGiven = NOT_GIVEN, - reference_id: str | NotGiven = NOT_GIVEN, - security_rule_name: str | NotGiven = NOT_GIVEN, - status_code: int | NotGiven = NOT_GIVEN, + actions: List[Literal["allow", "block", "captcha", "handshake"]] | Omit = omit, + countries: SequenceNotStr[str] | Omit = omit, + end: Optional[str] | Omit = omit, + ip: str | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + ordering: str | Omit = omit, + reference_id: str | Omit = omit, + security_rule_name: str | Omit = omit, + status_code: int | Omit = omit, traffic_types: List[ Literal[ "policy_allowed", @@ -326,13 +326,13 @@ def get_requests_series( "monitored", ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapRequestSummary]: """ Retrieve a domain's requests data. @@ -408,13 +408,13 @@ def get_traffic_series( *, resolution: Literal["daily", "hourly", "minutely"], start: str, - end: Optional[str] | NotGiven = NOT_GIVEN, + end: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetTrafficSeriesResponse: """ Retrieves a comprehensive report on a domain's traffic statistics based on @@ -483,17 +483,17 @@ def get_ddos_attacks( self, domain_id: int, *, - end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | NotGiven = NOT_GIVEN, - start_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + end_time: Union[str, datetime, None] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | Omit = omit, + start_time: Union[str, datetime, None] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapDDOSAttack, AsyncOffsetPage[WaapDDOSAttack]]: """ Retrieve a domain's DDoS attacks @@ -547,15 +547,15 @@ def get_ddos_info( *, group_by: Literal["URL", "User-Agent", "IP"], start: str, - end: Optional[str] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + end: Optional[str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapDDOSInfo, AsyncOffsetPage[WaapDDOSInfo]]: """ Returns the top DDoS counts grouped by URL, User-Agent or IP @@ -609,17 +609,17 @@ async def get_events_aggregated( domain_id: int, *, start: str, - action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | NotGiven = NOT_GIVEN, - end: Optional[str] | NotGiven = NOT_GIVEN, - ip: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - reference_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | NotGiven = NOT_GIVEN, + action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | Omit = omit, + end: Optional[str] | Omit = omit, + ip: Optional[SequenceNotStr[str]] | Omit = omit, + reference_id: Optional[SequenceNotStr[str]] | Omit = omit, + result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapEventStatistics: """ Retrieve an domain's event statistics @@ -680,7 +680,7 @@ async def get_request_details( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapRequestDetails: """ Retrieves all the available information for a request that matches a given @@ -714,16 +714,16 @@ def get_requests_series( domain_id: int, *, start: str, - actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, - countries: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - end: Optional[str] | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: str | NotGiven = NOT_GIVEN, - reference_id: str | NotGiven = NOT_GIVEN, - security_rule_name: str | NotGiven = NOT_GIVEN, - status_code: int | NotGiven = NOT_GIVEN, + actions: List[Literal["allow", "block", "captcha", "handshake"]] | Omit = omit, + countries: SequenceNotStr[str] | Omit = omit, + end: Optional[str] | Omit = omit, + ip: str | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + ordering: str | Omit = omit, + reference_id: str | Omit = omit, + security_rule_name: str | Omit = omit, + status_code: int | Omit = omit, traffic_types: List[ Literal[ "policy_allowed", @@ -748,13 +748,13 @@ def get_requests_series( "monitored", ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapRequestSummary, AsyncOffsetPage[WaapRequestSummary]]: """ Retrieve a domain's requests data. @@ -830,13 +830,13 @@ async def get_traffic_series( *, resolution: Literal["daily", "hourly", "minutely"], start: str, - end: Optional[str] | NotGiven = NOT_GIVEN, + end: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetTrafficSeriesResponse: """ Retrieves a comprehensive report on a domain's traffic statistics based on diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index e056e67a..c9fc4370 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -48,19 +48,18 @@ def with_streaming_response(self) -> InsightsResourceWithStreamingResponse: def list_types( self, *, - insight_frequency: Optional[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["name", "-name", "slug", "-slug", "insight_frequency", "-insight_frequency"] - | NotGiven = NOT_GIVEN, - slug: Optional[str] | NotGiven = NOT_GIVEN, + insight_frequency: Optional[int] | Omit = omit, + limit: int | Omit = omit, + name: Optional[str] | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["name", "-name", "slug", "-slug", "insight_frequency", "-insight_frequency"] | Omit = omit, + slug: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapInsightType]: """ Insight types are generalized categories that encompass various specific @@ -134,19 +133,18 @@ def with_streaming_response(self) -> AsyncInsightsResourceWithStreamingResponse: def list_types( self, *, - insight_frequency: Optional[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["name", "-name", "slug", "-slug", "insight_frequency", "-insight_frequency"] - | NotGiven = NOT_GIVEN, - slug: Optional[str] | NotGiven = NOT_GIVEN, + insight_frequency: Optional[int] | Omit = omit, + limit: int | Omit = omit, + name: Optional[str] | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["name", "-name", "slug", "-slug", "insight_frequency", "-insight_frequency"] | Omit = omit, + slug: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapInsightType, AsyncOffsetPage[WaapInsightType]]: """ Insight types are generalized categories that encompass various specific diff --git a/src/gcore/resources/waap/ip_info/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py index e721bf7d..0c0050f2 100644 --- a/src/gcore/resources/waap/ip_info/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -12,7 +12,7 @@ MetricsResourceWithStreamingResponse, AsyncMetricsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -78,7 +78,7 @@ def get_attack_time_series( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetAttackTimeSeriesResponse: """ Retrieve a time-series of attacks originating from a specified IP address. @@ -118,7 +118,7 @@ def get_blocked_requests( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetBlockedRequestsResponse: """ Retrieve metrics, which enumerate blocked requests originating from a specific @@ -168,7 +168,7 @@ def get_ddos_attack_series( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapIPDDOSInfoModel: """ Fetch and analyze DDoS (Distributed Denial of Service) attack metrics for a @@ -211,7 +211,7 @@ def get_ip_info( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapIPInfo: """ Fetch details about a particular IP address, including WHOIS data, risk score, @@ -250,7 +250,7 @@ def get_top_urls( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetTopURLsResponse: """ Returns a list of the top 10 URLs accessed by a specified IP address within a @@ -301,7 +301,7 @@ def get_top_user_agents( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetTopUserAgentsResponse: """ Retrieve the top 10 user agents interacting with a specified domain, filtered by @@ -350,7 +350,7 @@ def get_top_user_sessions( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetTopUserSessionsResponse: """ Obtain the top 10 user sessions interfacing with a particular domain, identified @@ -398,7 +398,7 @@ def list_attacked_countries( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoListAttackedCountriesResponse: """ Retrieve a list of countries attacked by the specified IP address @@ -462,7 +462,7 @@ async def get_attack_time_series( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetAttackTimeSeriesResponse: """ Retrieve a time-series of attacks originating from a specified IP address. @@ -502,7 +502,7 @@ async def get_blocked_requests( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetBlockedRequestsResponse: """ Retrieve metrics, which enumerate blocked requests originating from a specific @@ -552,7 +552,7 @@ async def get_ddos_attack_series( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapIPDDOSInfoModel: """ Fetch and analyze DDoS (Distributed Denial of Service) attack metrics for a @@ -595,7 +595,7 @@ async def get_ip_info( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapIPInfo: """ Fetch details about a particular IP address, including WHOIS data, risk score, @@ -634,7 +634,7 @@ async def get_top_urls( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetTopURLsResponse: """ Returns a list of the top 10 URLs accessed by a specified IP address within a @@ -685,7 +685,7 @@ async def get_top_user_agents( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetTopUserAgentsResponse: """ Retrieve the top 10 user agents interacting with a specified domain, filtered by @@ -734,7 +734,7 @@ async def get_top_user_sessions( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetTopUserSessionsResponse: """ Obtain the top 10 user sessions interfacing with a particular domain, identified @@ -782,7 +782,7 @@ async def list_attacked_countries( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoListAttackedCountriesResponse: """ Retrieve a list of countries attacked by the specified IP address diff --git a/src/gcore/resources/waap/ip_info/metrics.py b/src/gcore/resources/waap/ip_info/metrics.py index c70d3faa..dd60d037 100644 --- a/src/gcore/resources/waap/ip_info/metrics.py +++ b/src/gcore/resources/waap/ip_info/metrics.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -47,13 +47,13 @@ def list( self, *, ip: str, - domain_id: Optional[int] | NotGiven = NOT_GIVEN, + domain_id: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapIPInfoCounts: """ Retrieve metrics encompassing the counts of total requests, blocked requests and @@ -119,13 +119,13 @@ async def list( self, *, ip: str, - domain_id: Optional[int] | NotGiven = NOT_GIVEN, + domain_id: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapIPInfoCounts: """ Retrieve metrics encompassing the counts of total requests, blocked requests and diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py index f36dcb35..07a8bc66 100644 --- a/src/gcore/resources/waap/organizations.py +++ b/src/gcore/resources/waap/organizations.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -48,16 +48,16 @@ def with_streaming_response(self) -> OrganizationsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Optional[Literal["name", "id", "-name", "-id"]] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + ordering: Optional[Literal["name", "id", "-name", "-id"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapOrganization]: """ This endpoint retrieves a list of network organizations that own IP ranges as @@ -126,16 +126,16 @@ def with_streaming_response(self) -> AsyncOrganizationsResourceWithStreamingResp def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Optional[Literal["name", "id", "-name", "-id"]] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + ordering: Optional[Literal["name", "id", "-name", "-id"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapOrganization, AsyncOffsetPage[WaapOrganization]]: """ This endpoint retrieves a list of network organizations that own IP ranges as diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py index f8258bab..e383f236 100644 --- a/src/gcore/resources/waap/statistics.py +++ b/src/gcore/resources/waap/statistics.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -57,7 +57,7 @@ def get_usage_series( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapStatisticsSeries: """Retrieve statistics data as a time series. @@ -139,7 +139,7 @@ async def get_usage_series( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapStatisticsSeries: """Retrieve statistics data as a time series. diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py index df171560..879f3f47 100644 --- a/src/gcore/resources/waap/tags.py +++ b/src/gcore/resources/waap/tags.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -48,19 +48,19 @@ def with_streaming_response(self) -> TagsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[Literal["name", "readable_name", "reserved", "-name", "-readable_name", "-reserved"]] - | NotGiven = NOT_GIVEN, - readable_name: str | NotGiven = NOT_GIVEN, - reserved: bool | NotGiven = NOT_GIVEN, + | Omit = omit, + readable_name: str | Omit = omit, + reserved: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapTag]: """ Tags are shortcuts for the rules used in WAAP policies for the creation of more @@ -134,19 +134,19 @@ def with_streaming_response(self) -> AsyncTagsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[Literal["name", "readable_name", "reserved", "-name", "-readable_name", "-reserved"]] - | NotGiven = NOT_GIVEN, - readable_name: str | NotGiven = NOT_GIVEN, - reserved: bool | NotGiven = NOT_GIVEN, + | Omit = omit, + readable_name: str | Omit = omit, + reserved: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapTag, AsyncOffsetPage[WaapTag]]: """ Tags are shortcuts for the rules used in WAAP policies for the creation of more diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index 3d68c41f..d5509b5f 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -12,7 +12,7 @@ TagsResourceWithStreamingResponse, AsyncTagsResourceWithStreamingResponse, ) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from .insights import ( InsightsResource, AsyncInsightsResource, @@ -143,7 +143,7 @@ def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return self._get( @@ -215,7 +215,7 @@ async def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return await self._get( diff --git a/tests/test_transform.py b/tests/test_transform.py index a2beb233..f66c5ae2 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,7 +8,7 @@ import pytest -from gcore._types import NOT_GIVEN, Base64FileInput +from gcore._types import Base64FileInput, omit, not_given from gcore._utils import ( PropertyInfo, transform as _transform, @@ -450,4 +450,11 @@ async def test_transform_skipping(use_async: bool) -> None: @pytest.mark.asyncio async def test_strips_notgiven(use_async: bool) -> None: assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} - assert await transform({"foo_bar": NOT_GIVEN}, Foo1, use_async) == {} + assert await transform({"foo_bar": not_given}, Foo1, use_async) == {} + + +@parametrize +@pytest.mark.asyncio +async def test_strips_omit(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": omit}, Foo1, use_async) == {} From 61fac7131bad1819813a3bf9956178c7e38f6611 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 17:46:04 +0000 Subject: [PATCH 324/592] chore: do not install brew dependencies in ./scripts/bootstrap by default --- scripts/bootstrap | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap b/scripts/bootstrap index e84fe62c..b430fee3 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,10 +4,18 @@ set -e cd "$(dirname "$0")/.." -if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { - echo "==> Installing Homebrew dependencies…" - brew bundle + echo -n "==> Install Homebrew dependencies? (y/N): " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + brew bundle + ;; + *) + ;; + esac + echo } fi From 0d0a2e10a0e3d669f7d4ae69bbc2696c7a6237ee Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 06:14:23 +0000 Subject: [PATCH 325/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/waap/domains/advanced_rules.py | 14 ++-- src/gcore/resources/waap/domains/api_paths.py | 24 +------ .../resources/waap/domains/custom_rules.py | 14 ++-- src/gcore/resources/waap/domains/domains.py | 4 +- .../resources/waap/domains/firewall_rules.py | 4 +- src/gcore/resources/waap/insights.py | 4 +- src/gcore/types/waap/domain_update_params.py | 4 +- .../domains/advanced_rule_create_params.py | 25 ++++--- .../domains/advanced_rule_update_params.py | 20 +++--- .../waap/domains/api_path_create_params.py | 3 - .../waap/domains/api_path_update_params.py | 4 +- .../waap/domains/custom_rule_create_params.py | 71 ++++++++++--------- .../waap/domains/custom_rule_update_params.py | 64 ++++++++--------- .../domains/firewall_rule_create_params.py | 12 ++-- .../domains/firewall_rule_update_params.py | 10 +-- .../types/waap/domains/waap_advanced_rule.py | 7 +- .../types/waap/domains/waap_custom_rule.py | 7 +- .../types/waap/domains/waap_firewall_rule.py | 2 +- src/gcore/types/waap/domains/waap_insight.py | 2 +- .../types/waap/insight_list_types_params.py | 2 +- .../waap/domains/test_custom_rules.py | 32 ++++----- .../waap/domains/test_firewall_rules.py | 24 +++---- .../waap/domains/test_insight_silences.py | 16 ++--- tests/api_resources/waap/test_domains.py | 18 ++--- 25 files changed, 184 insertions(+), 207 deletions(-) diff --git a/.stats.yml b/.stats.yml index 12d70d76..72e1a72b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b473743ee0ba83806f1c8fad37c8dc55062a7d64b726e4ce2ee7e6ed679500a0.yml -openapi_spec_hash: 990a444fc9f47cee9b92c1fc8915f6ac +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b274569f3b7b4720901d8180f3ce6072354a76aebcba71034efacc0d7c2e86af.yml +openapi_spec_hash: 23852eed0d43bf23e4bdce79570b7742 config_hash: b2097de8bb0184ce4379a853a61ef740 diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index 5299f49c..4e557da1 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -53,7 +53,7 @@ def create( enabled: bool, name: str, source: str, - description: Optional[str] | Omit = omit, + description: str | Omit = omit, phase: Optional[Literal["access", "header_filter", "body_filter"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -68,7 +68,8 @@ def create( Args: domain_id: The domain ID - action: The action that the rule takes when triggered + action: The action that the rule takes when triggered. Only one action can be set per + rule. enabled: Whether or not the rule is enabled @@ -141,7 +142,7 @@ def update( rule_id: The advanced rule ID - action: The action that a WAAP rule takes when triggered + action: The action that a WAAP rule takes when triggered. description: The description assigned to the rule @@ -429,7 +430,7 @@ async def create( enabled: bool, name: str, source: str, - description: Optional[str] | Omit = omit, + description: str | Omit = omit, phase: Optional[Literal["access", "header_filter", "body_filter"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -444,7 +445,8 @@ async def create( Args: domain_id: The domain ID - action: The action that the rule takes when triggered + action: The action that the rule takes when triggered. Only one action can be set per + rule. enabled: Whether or not the rule is enabled @@ -517,7 +519,7 @@ async def update( rule_id: The advanced rule ID - action: The action that a WAAP rule takes when triggered + action: The action that a WAAP rule takes when triggered. description: The description assigned to the rule diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index fa4c9935..ea3057ec 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -75,12 +75,6 @@ def create( path: The API path, locations that are saved for resource IDs will be put in curly brackets - api_groups: An array of api groups associated with the API path - - api_version: The API version - - tags: An array of tags associated with the API path - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -132,14 +126,10 @@ def update( path_id: The path ID - api_groups: An array of api groups associated with the API path - path: The updated API path. When updating the path, variables can be renamed, path parts can be converted to variables and vice versa. - status: The status of the discovered API path - - tags: An array of tags associated with the API path + status: The different statuses an API path can have extra_headers: Send extra headers @@ -403,12 +393,6 @@ async def create( path: The API path, locations that are saved for resource IDs will be put in curly brackets - api_groups: An array of api groups associated with the API path - - api_version: The API version - - tags: An array of tags associated with the API path - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -460,14 +444,10 @@ async def update( path_id: The path ID - api_groups: An array of api groups associated with the API path - path: The updated API path. When updating the path, variables can be renamed, path parts can be converted to variables and vice versa. - status: The status of the discovered API path - - tags: An array of tags associated with the API path + status: The different statuses an API path can have extra_headers: Send extra headers diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index 8b6ccbf0..e81e575e 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -58,7 +58,7 @@ def create( conditions: Iterable[custom_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | Omit = omit, + description: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -72,7 +72,8 @@ def create( Args: domain_id: The domain ID - action: The action that the rule takes when triggered + action: The action that the rule takes when triggered. Only one action can be set per + rule. conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger @@ -134,7 +135,7 @@ def update( rule_id: The custom rule ID - action: The action that a WAAP rule takes when triggered + action: The action that a WAAP rule takes when triggered. conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger @@ -432,7 +433,7 @@ async def create( conditions: Iterable[custom_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | Omit = omit, + description: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -446,7 +447,8 @@ async def create( Args: domain_id: The domain ID - action: The action that the rule takes when triggered + action: The action that the rule takes when triggered. Only one action can be set per + rule. conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger @@ -508,7 +510,7 @@ async def update( rule_id: The custom rule ID - action: The action that a WAAP rule takes when triggered + action: The action that a WAAP rule takes when triggered. conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index b0d8c1b0..644191c1 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -172,7 +172,7 @@ def update( self, domain_id: int, *, - status: Literal["active", "monitor"] | Omit = omit, + status: Literal["active", "monitor"], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -474,7 +474,7 @@ async def update( self, domain_id: int, *, - status: Literal["active", "monitor"] | Omit = omit, + status: Literal["active", "monitor"], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index 8b7b446a..3dbdde0b 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -58,7 +58,7 @@ def create( conditions: Iterable[firewall_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | Omit = omit, + description: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -430,7 +430,7 @@ async def create( conditions: Iterable[firewall_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | Omit = omit, + description: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index c9fc4370..5de0a968 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -76,7 +76,7 @@ def list_types( ordering: Sort the response by given field. - slug: Filter by the slug of the insight type + slug: The slug of the insight type extra_headers: Send extra headers @@ -161,7 +161,7 @@ def list_types( ordering: Sort the response by given field. - slug: Filter by the slug of the insight type + slug: The slug of the insight type extra_headers: Send extra headers diff --git a/src/gcore/types/waap/domain_update_params.py b/src/gcore/types/waap/domain_update_params.py index cd2134bd..a445eddf 100644 --- a/src/gcore/types/waap/domain_update_params.py +++ b/src/gcore/types/waap/domain_update_params.py @@ -2,11 +2,11 @@ from __future__ import annotations -from typing_extensions import Literal, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["DomainUpdateParams"] class DomainUpdateParams(TypedDict, total=False): - status: Literal["active", "monitor"] + status: Required[Literal["active", "monitor"]] """The current status of the domain""" diff --git a/src/gcore/types/waap/domains/advanced_rule_create_params.py b/src/gcore/types/waap/domains/advanced_rule_create_params.py index a1edf88a..019e227a 100644 --- a/src/gcore/types/waap/domains/advanced_rule_create_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_create_params.py @@ -12,7 +12,10 @@ class AdvancedRuleCreateParams(TypedDict, total=False): action: Required[Action] - """The action that the rule takes when triggered""" + """The action that the rule takes when triggered. + + Only one action can be set per rule. + """ enabled: Required[bool] """Whether or not the rule is enabled""" @@ -28,7 +31,7 @@ class AdvancedRuleCreateParams(TypedDict, total=False): https://gcore.com/docs/waap/waap-rules/advanced-rules """ - description: Optional[str] + description: str """The description assigned to the rule""" phase: Optional[Literal["access", "header_filter", "body_filter"]] @@ -43,7 +46,7 @@ class AdvancedRuleCreateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): - action_duration: Optional[str] + action_duration: str """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or @@ -51,8 +54,8 @@ class ActionBlock(TypedDict, total=False): intervals are not allowed. """ - status_code: Optional[Literal[403, 405, 418, 429]] - """Designates the HTTP status code to deliver when a request is blocked.""" + status_code: Literal[403, 405, 418, 429] + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class ActionTag(TypedDict, total=False): @@ -61,23 +64,23 @@ class ActionTag(TypedDict, total=False): class Action(TypedDict, total=False): - allow: Optional[object] + allow: object """The WAAP allowed the request""" - block: Optional[ActionBlock] + block: ActionBlock """ WAAP block action behavior could be configured with response status code and action duration. """ - captcha: Optional[object] + captcha: object """The WAAP presented the user with a captcha""" - handshake: Optional[object] + handshake: object """The WAAP performed automatic browser validation""" - monitor: Optional[object] + monitor: object """The WAAP monitored the request but took no action""" - tag: Optional[ActionTag] + tag: ActionTag """WAAP tag action gets a list of tags to tag the request scope with""" diff --git a/src/gcore/types/waap/domains/advanced_rule_update_params.py b/src/gcore/types/waap/domains/advanced_rule_update_params.py index f158d460..90e297cb 100644 --- a/src/gcore/types/waap/domains/advanced_rule_update_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_update_params.py @@ -15,7 +15,7 @@ class AdvancedRuleUpdateParams(TypedDict, total=False): """The domain ID""" action: Optional[Action] - """The action that a WAAP rule takes when triggered""" + """The action that a WAAP rule takes when triggered.""" description: Optional[str] """The description assigned to the rule""" @@ -46,7 +46,7 @@ class AdvancedRuleUpdateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): - action_duration: Optional[str] + action_duration: str """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or @@ -54,8 +54,8 @@ class ActionBlock(TypedDict, total=False): intervals are not allowed. """ - status_code: Optional[Literal[403, 405, 418, 429]] - """Designates the HTTP status code to deliver when a request is blocked.""" + status_code: Literal[403, 405, 418, 429] + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class ActionTag(TypedDict, total=False): @@ -64,23 +64,23 @@ class ActionTag(TypedDict, total=False): class Action(TypedDict, total=False): - allow: Optional[object] + allow: object """The WAAP allowed the request""" - block: Optional[ActionBlock] + block: ActionBlock """ WAAP block action behavior could be configured with response status code and action duration. """ - captcha: Optional[object] + captcha: object """The WAAP presented the user with a captcha""" - handshake: Optional[object] + handshake: object """The WAAP performed automatic browser validation""" - monitor: Optional[object] + monitor: object """The WAAP monitored the request but took no action""" - tag: Optional[ActionTag] + tag: ActionTag """WAAP tag action gets a list of tags to tag the request scope with""" diff --git a/src/gcore/types/waap/domains/api_path_create_params.py b/src/gcore/types/waap/domains/api_path_create_params.py index bec29966..b8c370d3 100644 --- a/src/gcore/types/waap/domains/api_path_create_params.py +++ b/src/gcore/types/waap/domains/api_path_create_params.py @@ -23,10 +23,7 @@ class APIPathCreateParams(TypedDict, total=False): """ api_groups: SequenceNotStr[str] - """An array of api groups associated with the API path""" api_version: str - """The API version""" tags: SequenceNotStr[str] - """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/api_path_update_params.py b/src/gcore/types/waap/domains/api_path_update_params.py index 71c995ba..18c1927f 100644 --- a/src/gcore/types/waap/domains/api_path_update_params.py +++ b/src/gcore/types/waap/domains/api_path_update_params.py @@ -14,7 +14,6 @@ class APIPathUpdateParams(TypedDict, total=False): """The domain ID""" api_groups: SequenceNotStr[str] - """An array of api groups associated with the API path""" path: str """The updated API path. @@ -24,7 +23,6 @@ class APIPathUpdateParams(TypedDict, total=False): """ status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] - """The status of the discovered API path""" + """The different statuses an API path can have""" tags: SequenceNotStr[str] - """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/custom_rule_create_params.py b/src/gcore/types/waap/domains/custom_rule_create_params.py index 13bd6574..cdd1397d 100644 --- a/src/gcore/types/waap/domains/custom_rule_create_params.py +++ b/src/gcore/types/waap/domains/custom_rule_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import List, Iterable from typing_extensions import Literal, Required, TypedDict from ...._types import SequenceNotStr @@ -36,7 +36,10 @@ class CustomRuleCreateParams(TypedDict, total=False): action: Required[Action] - """The action that the rule takes when triggered""" + """The action that the rule takes when triggered. + + Only one action can be set per rule. + """ conditions: Required[Iterable[Condition]] """The conditions required for the WAAP engine to trigger the rule. @@ -51,12 +54,12 @@ class CustomRuleCreateParams(TypedDict, total=False): name: Required[str] """The name assigned to the rule""" - description: Optional[str] + description: str """The description assigned to the rule""" class ActionBlock(TypedDict, total=False): - action_duration: Optional[str] + action_duration: str """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or @@ -64,8 +67,8 @@ class ActionBlock(TypedDict, total=False): intervals are not allowed. """ - status_code: Optional[Literal[403, 405, 418, 429]] - """Designates the HTTP status code to deliver when a request is blocked.""" + status_code: Literal[403, 405, 418, 429] + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class ActionTag(TypedDict, total=False): @@ -74,25 +77,25 @@ class ActionTag(TypedDict, total=False): class Action(TypedDict, total=False): - allow: Optional[object] + allow: object """The WAAP allowed the request""" - block: Optional[ActionBlock] + block: ActionBlock """ WAAP block action behavior could be configured with response status code and action duration. """ - captcha: Optional[object] + captcha: object """The WAAP presented the user with a captcha""" - handshake: Optional[object] + handshake: object """The WAAP performed automatic browser validation""" - monitor: Optional[object] + monitor: object """The WAAP monitored the request but took no action""" - tag: Optional[ActionTag] + tag: ActionTag """WAAP tag action gets a list of tags to tag the request scope with""" @@ -218,15 +221,13 @@ class ConditionRequestRate(TypedDict, total=False): triggering a request rate condition """ - http_methods: Optional[ - List[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] - ] + http_methods: List[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] """Possible HTTP request methods that can trigger a request rate condition""" - ips: Optional[SequenceNotStr[str]] + ips: SequenceNotStr[str] """A list of source IPs that can trigger a request rate condition""" - user_defined_tag: Optional[str] + user_defined_tag: str """ A user-defined tag that can be included in incoming requests and used to trigger a request rate condition @@ -310,62 +311,62 @@ class ConditionUserDefinedTags(TypedDict, total=False): class Condition(TypedDict, total=False): - content_type: Optional[ConditionContentType] + content_type: ConditionContentType """Match the requested Content-Type""" - country: Optional[ConditionCountry] + country: ConditionCountry """Match the country that the request originated from""" - file_extension: Optional[ConditionFileExtension] + file_extension: ConditionFileExtension """Match the incoming file extension""" - header: Optional[ConditionHeader] + header: ConditionHeader """Match an incoming request header""" - header_exists: Optional[ConditionHeaderExists] + header_exists: ConditionHeaderExists """Match when an incoming request header is present""" - http_method: Optional[ConditionHTTPMethod] + http_method: ConditionHTTPMethod """Match the incoming HTTP method""" - ip: Optional[ConditionIP] + ip: ConditionIP """Match the incoming request against a single IP address""" - ip_range: Optional[ConditionIPRange] + ip_range: ConditionIPRange """Match the incoming request against an IP range""" - organization: Optional[ConditionOrganization] + organization: ConditionOrganization """ Match the organization the request originated from, as determined by a WHOIS lookup of the requesting IP """ - owner_types: Optional[ConditionOwnerTypes] + owner_types: ConditionOwnerTypes """ Match the type of organization that owns the IP address making an incoming request """ - request_rate: Optional[ConditionRequestRate] + request_rate: ConditionRequestRate """Match the rate at which requests come in that match certain conditions""" - response_header: Optional[ConditionResponseHeader] + response_header: ConditionResponseHeader """Match a response header""" - response_header_exists: Optional[ConditionResponseHeaderExists] + response_header_exists: ConditionResponseHeaderExists """Match when a response header is present""" - session_request_count: Optional[ConditionSessionRequestCount] + session_request_count: ConditionSessionRequestCount """Match the number of dynamic page requests made in a WAAP session""" - tags: Optional[ConditionTags] + tags: ConditionTags """Matches requests based on specified tags""" - url: Optional[ConditionURL] + url: ConditionURL """Match the incoming request URL""" - user_agent: Optional[ConditionUserAgent] + user_agent: ConditionUserAgent """Match the user agent making the request""" - user_defined_tags: Optional[ConditionUserDefinedTags] + user_defined_tags: ConditionUserDefinedTags """Matches requests based on user-defined tags""" diff --git a/src/gcore/types/waap/domains/custom_rule_update_params.py b/src/gcore/types/waap/domains/custom_rule_update_params.py index 2978bc66..b9144fba 100644 --- a/src/gcore/types/waap/domains/custom_rule_update_params.py +++ b/src/gcore/types/waap/domains/custom_rule_update_params.py @@ -39,7 +39,7 @@ class CustomRuleUpdateParams(TypedDict, total=False): """The domain ID""" action: Optional[Action] - """The action that a WAAP rule takes when triggered""" + """The action that a WAAP rule takes when triggered.""" conditions: Optional[Iterable[Condition]] """The conditions required for the WAAP engine to trigger the rule. @@ -59,7 +59,7 @@ class CustomRuleUpdateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): - action_duration: Optional[str] + action_duration: str """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or @@ -67,8 +67,8 @@ class ActionBlock(TypedDict, total=False): intervals are not allowed. """ - status_code: Optional[Literal[403, 405, 418, 429]] - """Designates the HTTP status code to deliver when a request is blocked.""" + status_code: Literal[403, 405, 418, 429] + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class ActionTag(TypedDict, total=False): @@ -77,25 +77,25 @@ class ActionTag(TypedDict, total=False): class Action(TypedDict, total=False): - allow: Optional[object] + allow: object """The WAAP allowed the request""" - block: Optional[ActionBlock] + block: ActionBlock """ WAAP block action behavior could be configured with response status code and action duration. """ - captcha: Optional[object] + captcha: object """The WAAP presented the user with a captcha""" - handshake: Optional[object] + handshake: object """The WAAP performed automatic browser validation""" - monitor: Optional[object] + monitor: object """The WAAP monitored the request but took no action""" - tag: Optional[ActionTag] + tag: ActionTag """WAAP tag action gets a list of tags to tag the request scope with""" @@ -221,15 +221,13 @@ class ConditionRequestRate(TypedDict, total=False): triggering a request rate condition """ - http_methods: Optional[ - List[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] - ] + http_methods: List[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] """Possible HTTP request methods that can trigger a request rate condition""" - ips: Optional[SequenceNotStr[str]] + ips: SequenceNotStr[str] """A list of source IPs that can trigger a request rate condition""" - user_defined_tag: Optional[str] + user_defined_tag: str """ A user-defined tag that can be included in incoming requests and used to trigger a request rate condition @@ -313,62 +311,62 @@ class ConditionUserDefinedTags(TypedDict, total=False): class Condition(TypedDict, total=False): - content_type: Optional[ConditionContentType] + content_type: ConditionContentType """Match the requested Content-Type""" - country: Optional[ConditionCountry] + country: ConditionCountry """Match the country that the request originated from""" - file_extension: Optional[ConditionFileExtension] + file_extension: ConditionFileExtension """Match the incoming file extension""" - header: Optional[ConditionHeader] + header: ConditionHeader """Match an incoming request header""" - header_exists: Optional[ConditionHeaderExists] + header_exists: ConditionHeaderExists """Match when an incoming request header is present""" - http_method: Optional[ConditionHTTPMethod] + http_method: ConditionHTTPMethod """Match the incoming HTTP method""" - ip: Optional[ConditionIP] + ip: ConditionIP """Match the incoming request against a single IP address""" - ip_range: Optional[ConditionIPRange] + ip_range: ConditionIPRange """Match the incoming request against an IP range""" - organization: Optional[ConditionOrganization] + organization: ConditionOrganization """ Match the organization the request originated from, as determined by a WHOIS lookup of the requesting IP """ - owner_types: Optional[ConditionOwnerTypes] + owner_types: ConditionOwnerTypes """ Match the type of organization that owns the IP address making an incoming request """ - request_rate: Optional[ConditionRequestRate] + request_rate: ConditionRequestRate """Match the rate at which requests come in that match certain conditions""" - response_header: Optional[ConditionResponseHeader] + response_header: ConditionResponseHeader """Match a response header""" - response_header_exists: Optional[ConditionResponseHeaderExists] + response_header_exists: ConditionResponseHeaderExists """Match when a response header is present""" - session_request_count: Optional[ConditionSessionRequestCount] + session_request_count: ConditionSessionRequestCount """Match the number of dynamic page requests made in a WAAP session""" - tags: Optional[ConditionTags] + tags: ConditionTags """Matches requests based on specified tags""" - url: Optional[ConditionURL] + url: ConditionURL """Match the incoming request URL""" - user_agent: Optional[ConditionUserAgent] + user_agent: ConditionUserAgent """Match the user agent making the request""" - user_defined_tags: Optional[ConditionUserDefinedTags] + user_defined_tags: ConditionUserDefinedTags """Matches requests based on user-defined tags""" diff --git a/src/gcore/types/waap/domains/firewall_rule_create_params.py b/src/gcore/types/waap/domains/firewall_rule_create_params.py index 84b671fb..fec010b2 100644 --- a/src/gcore/types/waap/domains/firewall_rule_create_params.py +++ b/src/gcore/types/waap/domains/firewall_rule_create_params.py @@ -21,12 +21,12 @@ class FirewallRuleCreateParams(TypedDict, total=False): name: Required[str] """The name assigned to the rule""" - description: Optional[str] + description: str """The description assigned to the rule""" class ActionBlock(TypedDict, total=False): - action_duration: Optional[str] + action_duration: str """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or @@ -34,8 +34,8 @@ class ActionBlock(TypedDict, total=False): intervals are not allowed. """ - status_code: Optional[Literal[403, 405, 418, 429]] - """Designates the HTTP status code to deliver when a request is blocked.""" + status_code: Literal[403, 405, 418, 429] + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class Action(TypedDict, total=False): @@ -69,8 +69,8 @@ class ConditionIPRange(TypedDict, total=False): class Condition(TypedDict, total=False): - ip: Optional[ConditionIP] + ip: ConditionIP """Match the incoming request against a single IP address""" - ip_range: Optional[ConditionIPRange] + ip_range: ConditionIPRange """Match the incoming request against an IP range""" diff --git a/src/gcore/types/waap/domains/firewall_rule_update_params.py b/src/gcore/types/waap/domains/firewall_rule_update_params.py index 478d257c..87b0cd7e 100644 --- a/src/gcore/types/waap/domains/firewall_rule_update_params.py +++ b/src/gcore/types/waap/domains/firewall_rule_update_params.py @@ -29,7 +29,7 @@ class FirewallRuleUpdateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): - action_duration: Optional[str] + action_duration: str """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or @@ -37,8 +37,8 @@ class ActionBlock(TypedDict, total=False): intervals are not allowed. """ - status_code: Optional[Literal[403, 405, 418, 429]] - """Designates the HTTP status code to deliver when a request is blocked.""" + status_code: Literal[403, 405, 418, 429] + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class Action(TypedDict, total=False): @@ -72,8 +72,8 @@ class ConditionIPRange(TypedDict, total=False): class Condition(TypedDict, total=False): - ip: Optional[ConditionIP] + ip: ConditionIP """Match the incoming request against a single IP address""" - ip_range: Optional[ConditionIPRange] + ip_range: ConditionIPRange """Match the incoming request against an IP range""" diff --git a/src/gcore/types/waap/domains/waap_advanced_rule.py b/src/gcore/types/waap/domains/waap_advanced_rule.py index fc264a1a..d9160d4c 100644 --- a/src/gcore/types/waap/domains/waap_advanced_rule.py +++ b/src/gcore/types/waap/domains/waap_advanced_rule.py @@ -18,7 +18,7 @@ class ActionBlock(BaseModel): """ status_code: Optional[Literal[403, 405, 418, 429]] = None - """Designates the HTTP status code to deliver when a request is blocked.""" + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class ActionTag(BaseModel): @@ -54,7 +54,10 @@ class WaapAdvancedRule(BaseModel): """The unique identifier for the rule""" action: Action - """The action that the rule takes when triggered""" + """The action that the rule takes when triggered. + + Only one action can be set per rule. + """ enabled: bool """Whether or not the rule is enabled""" diff --git a/src/gcore/types/waap/domains/waap_custom_rule.py b/src/gcore/types/waap/domains/waap_custom_rule.py index aec81343..0a3ba958 100644 --- a/src/gcore/types/waap/domains/waap_custom_rule.py +++ b/src/gcore/types/waap/domains/waap_custom_rule.py @@ -42,7 +42,7 @@ class ActionBlock(BaseModel): """ status_code: Optional[Literal[403, 405, 418, 429]] = None - """Designates the HTTP status code to deliver when a request is blocked.""" + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class ActionTag(BaseModel): @@ -355,7 +355,10 @@ class WaapCustomRule(BaseModel): """The unique identifier for the rule""" action: Action - """The action that the rule takes when triggered""" + """The action that the rule takes when triggered. + + Only one action can be set per rule. + """ conditions: List[Condition] """The conditions required for the WAAP engine to trigger the rule. diff --git a/src/gcore/types/waap/domains/waap_firewall_rule.py b/src/gcore/types/waap/domains/waap_firewall_rule.py index d9ffa8dc..1130a89a 100644 --- a/src/gcore/types/waap/domains/waap_firewall_rule.py +++ b/src/gcore/types/waap/domains/waap_firewall_rule.py @@ -18,7 +18,7 @@ class ActionBlock(BaseModel): """ status_code: Optional[Literal[403, 405, 418, 429]] = None - """Designates the HTTP status code to deliver when a request is blocked.""" + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class Action(BaseModel): diff --git a/src/gcore/types/waap/domains/waap_insight.py b/src/gcore/types/waap/domains/waap_insight.py index f5ca2825..070c8bd8 100644 --- a/src/gcore/types/waap/domains/waap_insight.py +++ b/src/gcore/types/waap/domains/waap_insight.py @@ -20,7 +20,7 @@ class WaapInsight(BaseModel): """The date and time the insight was first seen in ISO 8601 format""" insight_type: str - """The type of the insight represented as a slug""" + """The slug of the insight type""" labels: Dict[str, str] """A hash table of label names and values that apply to the insight""" diff --git a/src/gcore/types/waap/insight_list_types_params.py b/src/gcore/types/waap/insight_list_types_params.py index 534f2cc2..6eae7ac3 100644 --- a/src/gcore/types/waap/insight_list_types_params.py +++ b/src/gcore/types/waap/insight_list_types_params.py @@ -25,4 +25,4 @@ class InsightListTypesParams(TypedDict, total=False): """Sort the response by given field.""" slug: Optional[str] - """Filter by the slug of the insight type""" + """The slug of the insight type""" diff --git a/tests/api_resources/waap/domains/test_custom_rules.py b/tests/api_resources/waap/domains/test_custom_rules.py index 62327ad7..36a7e89f 100644 --- a/tests/api_resources/waap/domains/test_custom_rules.py +++ b/tests/api_resources/waap/domains/test_custom_rules.py @@ -75,12 +75,12 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "negation": True, }, "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, "organization": { @@ -96,7 +96,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "requests": 20, "time": 1, "http_methods": ["CONNECT"], - "ips": ["192.168.1.1"], + "ips": ["string"], "user_defined_tag": "SQfNklznVLBBpr", }, "response_header": { @@ -224,12 +224,12 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "negation": True, }, "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, "organization": { @@ -245,7 +245,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "requests": 20, "time": 1, "http_methods": ["CONNECT"], - "ips": ["192.168.1.1"], + "ips": ["string"], "user_defined_tag": "SQfNklznVLBBpr", }, "response_header": { @@ -559,12 +559,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "negation": True, }, "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, "organization": { @@ -580,7 +580,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "requests": 20, "time": 1, "http_methods": ["CONNECT"], - "ips": ["192.168.1.1"], + "ips": ["string"], "user_defined_tag": "SQfNklznVLBBpr", }, "response_header": { @@ -708,12 +708,12 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "negation": True, }, "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, "organization": { @@ -729,7 +729,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "requests": 20, "time": 1, "http_methods": ["CONNECT"], - "ips": ["192.168.1.1"], + "ips": ["string"], "user_defined_tag": "SQfNklznVLBBpr", }, "response_header": { diff --git a/tests/api_resources/waap/domains/test_firewall_rules.py b/tests/api_resources/waap/domains/test_firewall_rules.py index 72064193..560b4128 100644 --- a/tests/api_resources/waap/domains/test_firewall_rules.py +++ b/tests/api_resources/waap/domains/test_firewall_rules.py @@ -45,12 +45,12 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: conditions=[ { "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, } @@ -116,12 +116,12 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: conditions=[ { "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, } @@ -373,12 +373,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> conditions=[ { "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, } @@ -444,12 +444,12 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> conditions=[ { "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, } diff --git a/tests/api_resources/waap/domains/test_insight_silences.py b/tests/api_resources/waap/domains/test_insight_silences.py index cd1d687a..835b21bf 100644 --- a/tests/api_resources/waap/domains/test_insight_silences.py +++ b/tests/api_resources/waap/domains/test_insight_silences.py @@ -27,7 +27,7 @@ def test_method_create(self, client: Gcore) -> None: domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, ) assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) @@ -38,7 +38,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -50,7 +50,7 @@ def test_raw_response_create(self, client: Gcore) -> None: domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, ) @@ -65,7 +65,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, ) as response: assert not response.is_closed @@ -283,7 +283,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, ) assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) @@ -294,7 +294,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -306,7 +306,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, ) @@ -321,7 +321,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, ) as response: assert not response.is_closed diff --git a/tests/api_resources/waap/test_domains.py b/tests/api_resources/waap/test_domains.py index f311215b..9c3d9c26 100644 --- a/tests/api_resources/waap/test_domains.py +++ b/tests/api_resources/waap/test_domains.py @@ -25,13 +25,6 @@ class TestDomains: @parametrize def test_method_update(self, client: Gcore) -> None: - domain = client.waap.domains.update( - domain_id=1, - ) - assert domain is None - - @parametrize - def test_method_update_with_all_params(self, client: Gcore) -> None: domain = client.waap.domains.update( domain_id=1, status="active", @@ -42,6 +35,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: def test_raw_response_update(self, client: Gcore) -> None: response = client.waap.domains.with_raw_response.update( domain_id=1, + status="active", ) assert response.is_closed is True @@ -53,6 +47,7 @@ def test_raw_response_update(self, client: Gcore) -> None: def test_streaming_response_update(self, client: Gcore) -> None: with client.waap.domains.with_streaming_response.update( domain_id=1, + status="active", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -242,13 +237,6 @@ class TestAsyncDomains: @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - domain = await async_client.waap.domains.update( - domain_id=1, - ) - assert domain is None - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: domain = await async_client.waap.domains.update( domain_id=1, status="active", @@ -259,6 +247,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.with_raw_response.update( domain_id=1, + status="active", ) assert response.is_closed is True @@ -270,6 +259,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.with_streaming_response.update( domain_id=1, + status="active", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From d770321ef78121a4b2fb1e0e8617bad823279053 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 06:42:17 +0000 Subject: [PATCH 326/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 72e1a72b..630a2f2b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b274569f3b7b4720901d8180f3ce6072354a76aebcba71034efacc0d7c2e86af.yml openapi_spec_hash: 23852eed0d43bf23e4bdce79570b7742 -config_hash: b2097de8bb0184ce4379a853a61ef740 +config_hash: 6bfe9b43c2ea6ddba1339589bc58d2fa From 60c56d7fbd1d1d73e0795ab5e403cafd6defdefa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 14:49:24 +0000 Subject: [PATCH 327/592] feat(api): aggregated API specs update --- .stats.yml | 6 +- .../resources/cloud/baremetal/servers.py | 26 +- src/gcore/resources/cloud/cost_reports.py | 118 ++-- .../cloud/file_shares/file_shares.py | 8 +- src/gcore/resources/cloud/floating_ips.py | 8 +- .../resources/cloud/instances/instances.py | 42 +- src/gcore/resources/cloud/ip_ranges.py | 26 +- .../resources/cloud/k8s/clusters/clusters.py | 36 +- .../cloud/load_balancers/load_balancers.py | 8 +- .../cloud/load_balancers/pools/pools.py | 14 +- .../resources/cloud/networks/networks.py | 8 +- src/gcore/resources/cloud/networks/subnets.py | 8 +- .../resources/cloud/registries/registries.py | 14 +- src/gcore/resources/cloud/registries/users.py | 14 +- .../cloud/security_groups/security_groups.py | 8 +- src/gcore/resources/cloud/volumes.py | 8 +- src/gcore/resources/dns/zones/rrsets.py | 118 ++-- src/gcore/resources/dns/zones/zones.py | 146 +++-- src/gcore/resources/iam/users.py | 60 +- .../resources/storage/buckets/buckets.py | 16 +- src/gcore/resources/storage/storage.py | 16 +- src/gcore/resources/streaming/ai_tasks.py | 392 +++++++----- src/gcore/resources/streaming/broadcasts.py | 12 +- src/gcore/resources/streaming/directories.py | 30 +- src/gcore/resources/streaming/playlists.py | 122 ++-- src/gcore/resources/streaming/quality_sets.py | 74 ++- src/gcore/resources/streaming/statistics.py | 574 +++++++++++------- .../resources/streaming/streams/overlays.py | 68 ++- .../resources/streaming/streams/streams.py | 468 ++++++++------ .../resources/streaming/videos/subtitles.py | 132 ++-- .../resources/streaming/videos/videos.py | 494 +++++++++------ .../resources/waap/domains/advanced_rules.py | 108 ++-- .../types/cloud/file_share_update_params.py | 4 +- .../types/cloud/floating_ip_update_params.py | 4 +- .../cloud/inference/inference_deployment.py | 4 +- .../types/cloud/instance_create_params.py | 4 +- .../types/cloud/k8s/cluster_create_params.py | 10 +- .../types/cloud/k8s/cluster_update_params.py | 10 +- src/gcore/types/cloud/k8s/k8s_cluster.py | 7 +- .../cloud/load_balancer_update_params.py | 4 +- .../types/cloud/network_update_params.py | 4 +- .../cloud/networks/subnet_update_params.py | 4 +- .../registries/user_create_multiple_params.py | 8 +- .../cloud/registries/user_create_params.py | 8 +- .../types/cloud/registry_create_params.py | 8 +- .../cloud/security_group_update_params.py | 4 +- src/gcore/types/cloud/ssh_key_created.py | 9 +- src/gcore/types/cloud/volume_update_params.py | 4 +- .../types/dns/zone_get_statistics_params.py | 21 +- .../types/dns/zone_get_statistics_response.py | 4 +- src/gcore/types/dns/zone_import_params.py | 36 +- src/gcore/types/dns/zones/dns_output_rrset.py | 10 +- src/gcore/types/iam/account_overview.py | 9 +- src/gcore/types/iam/user.py | 9 +- src/gcore/types/iam/user_detailed.py | 9 +- src/gcore/types/iam/user_invite_params.py | 5 +- src/gcore/types/iam/user_update.py | 9 +- src/gcore/types/iam/user_update_params.py | 9 +- .../ai_contentmoderation_hardnudity.py | 10 +- .../streaming/ai_contentmoderation_nsfw.py | 10 +- .../ai_contentmoderation_softnudity.py | 10 +- .../streaming/ai_contentmoderation_sport.py | 10 +- src/gcore/types/streaming/ai_task.py | 31 +- .../types/streaming/ai_task_create_params.py | 31 +- .../types/streaming/ai_task_get_response.py | 9 +- .../types/streaming/ai_task_list_params.py | 16 +- src/gcore/types/streaming/clip.py | 55 +- .../types/streaming/create_video_param.py | 118 ++-- src/gcore/types/streaming/playlist.py | 12 +- .../types/streaming/playlist_create_params.py | 12 +- .../types/streaming/playlist_update_params.py | 12 +- src/gcore/types/streaming/playlist_video.py | 118 ++-- ...statistic_get_unique_viewers_cdn_params.py | 11 +- src/gcore/types/streaming/stream.py | 343 ++++++----- .../streaming/stream_create_clip_params.py | 55 +- .../types/streaming/stream_create_params.py | 65 +- .../types/streaming/stream_update_params.py | 65 +- src/gcore/types/streaming/video.py | 214 ++++--- .../types/streaming/video_list_params.py | 6 +- .../types/streaming/video_update_params.py | 118 ++-- .../domains/advanced_rule_create_params.py | 19 +- .../waap/domains/advanced_rule_list_params.py | 17 +- .../domains/advanced_rule_update_params.py | 19 +- .../types/waap/domains/waap_advanced_rule.py | 19 +- 84 files changed, 3013 insertions(+), 1791 deletions(-) diff --git a/.stats.yml b/.stats.yml index 630a2f2b..bf3f4fca 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b274569f3b7b4720901d8180f3ce6072354a76aebcba71034efacc0d7c2e86af.yml -openapi_spec_hash: 23852eed0d43bf23e4bdce79570b7742 -config_hash: 6bfe9b43c2ea6ddba1339589bc58d2fa +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e543fc395c453a5bb59daf3463c5bbaf7fde7a7ffc957225eb2986c35d2c97ed.yml +openapi_spec_hash: b4be9c9d643d7d20c45dcffe381d1595 +config_hash: cd9ebeaa0d08830a9e995e37db3cd6e1 diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 00a36c69..6507c906 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -72,10 +72,12 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: - """Create a new bare metal server with the specified configuration. + """ + Create a new bare metal server with the specified configuration. + + How to get access: - How to get - access: For Linux, + For Linux, - Use the `user_data` field to provide a [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) @@ -83,7 +85,10 @@ def create( - Specify the `username` and `password` to create a new user. - When only `password` is provided, it is set as the password for the default user of the image. - - The `user_data` is ignored when the `password` is specified. For Windows, + - The `user_data` is ignored when the `password` is specified. + + For Windows, + - Use the `user_data` field to provide a [cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config) in base64 to create new users on Windows. @@ -437,10 +442,12 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: - """Create a new bare metal server with the specified configuration. + """ + Create a new bare metal server with the specified configuration. + + How to get access: - How to get - access: For Linux, + For Linux, - Use the `user_data` field to provide a [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) @@ -448,7 +455,10 @@ async def create( - Specify the `username` and `password` to create a new user. - When only `password` is provided, it is set as the password for the default user of the image. - - The `user_data` is ignored when the `password` is specified. For Windows, + - The `user_data` is ignored when the `password` is specified. + + For Windows, + - Use the `user_data` field to provide a [cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config) in base64 to create new users on Windows. diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index d5bb66c1..1ee323ee 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -103,15 +103,19 @@ def get_aggregated( """Get cost report totals (aggregated costs) for a given period. Requested period - should not exceed 31 days. Note: This report assumes there are no active commit - features in the billing plan. If there are active commit features (pre-paid - resources) in your plan, use /v1/`reservation_cost_report`/totals, as the - results from this report will not be accurate. Receiving data from the past hour - might lead to incomplete statistics. For the most accurate data, we recommend - accessing the statistics after at least one hour. Typically, updates are - available within a 24-hour period, although the frequency can vary. Maintenance - periods or other exceptions may cause delays, potentially extending beyond 24 - hours until the servers are back online and the missing data is filled in. + should not exceed 31 days. + + Note: This report assumes there are no active commit features in the billing + plan. If there are active commit features (pre-paid resources) in your plan, use + /v1/`reservation_cost_report`/totals, as the results from this report will not + be accurate. + + Receiving data from the past hour might lead to incomplete statistics. For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. Args: time_from: The start date of the report period (ISO 8601). The report starts from the @@ -220,12 +224,14 @@ def get_aggregated_monthly( Retrieve a detailed cost report totals for a specified month, which includes both commit and pay-as-you-go (overcommit) prices. Additionally, it provides the spent billing units (e.g., hours or GB) for resources. The "`time_to`" parameter - represents all days in the specified month. Receiving data from the past hour - might lead to incomplete statistics. For the most accurate data, we recommend - accessing the statistics after at least one hour. Typically, updates are - available within a 24-hour period, although the frequency can vary. Maintenance - periods or other exceptions may cause delays, potentially extending beyond 24 - hours until the servers are back online and the missing data is filled in. + represents all days in the specified month. + + Receiving data from the past hour might lead to incomplete statistics. For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. Args: regions: List of region IDs. @@ -331,16 +337,19 @@ def get_detailed( """Get a detailed cost report for a given period and specific resources. Requested - period should not exceed 31 days. Note: This report assumes there are no active - commit features in the billing plan. If there are active commit features - (pre-paid resources) in your plan, use /v1/`reservation_cost_report`/totals, as - the results from this report will not be accurate. Receiving data from the past - hour might lead to incomplete statistics. For the most accurate data, we - recommend accessing the statistics after at least one hour. Typically, updates - are available within a 24-hour period, although the frequency can vary. - Maintenance periods or other exceptions may cause delays, potentially extending - beyond 24 hours until the servers are back online and the missing data is filled - in. + period should not exceed 31 days. + + Note: This report assumes there are no active commit features in the billing + plan. If there are active commit features (pre-paid resources) in your plan, use + /v1/`reservation_cost_report`/totals, as the results from this report will not + be accurate. + + Receiving data from the past hour might lead to incomplete statistics. For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. Args: time_from: The start date of the report period (ISO 8601). The report starts from the @@ -479,15 +488,19 @@ async def get_aggregated( """Get cost report totals (aggregated costs) for a given period. Requested period - should not exceed 31 days. Note: This report assumes there are no active commit - features in the billing plan. If there are active commit features (pre-paid - resources) in your plan, use /v1/`reservation_cost_report`/totals, as the - results from this report will not be accurate. Receiving data from the past hour - might lead to incomplete statistics. For the most accurate data, we recommend - accessing the statistics after at least one hour. Typically, updates are - available within a 24-hour period, although the frequency can vary. Maintenance - periods or other exceptions may cause delays, potentially extending beyond 24 - hours until the servers are back online and the missing data is filled in. + should not exceed 31 days. + + Note: This report assumes there are no active commit features in the billing + plan. If there are active commit features (pre-paid resources) in your plan, use + /v1/`reservation_cost_report`/totals, as the results from this report will not + be accurate. + + Receiving data from the past hour might lead to incomplete statistics. For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. Args: time_from: The start date of the report period (ISO 8601). The report starts from the @@ -596,12 +609,14 @@ async def get_aggregated_monthly( Retrieve a detailed cost report totals for a specified month, which includes both commit and pay-as-you-go (overcommit) prices. Additionally, it provides the spent billing units (e.g., hours or GB) for resources. The "`time_to`" parameter - represents all days in the specified month. Receiving data from the past hour - might lead to incomplete statistics. For the most accurate data, we recommend - accessing the statistics after at least one hour. Typically, updates are - available within a 24-hour period, although the frequency can vary. Maintenance - periods or other exceptions may cause delays, potentially extending beyond 24 - hours until the servers are back online and the missing data is filled in. + represents all days in the specified month. + + Receiving data from the past hour might lead to incomplete statistics. For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. Args: regions: List of region IDs. @@ -707,16 +722,19 @@ async def get_detailed( """Get a detailed cost report for a given period and specific resources. Requested - period should not exceed 31 days. Note: This report assumes there are no active - commit features in the billing plan. If there are active commit features - (pre-paid resources) in your plan, use /v1/`reservation_cost_report`/totals, as - the results from this report will not be accurate. Receiving data from the past - hour might lead to incomplete statistics. For the most accurate data, we - recommend accessing the statistics after at least one hour. Typically, updates - are available within a 24-hour period, although the frequency can vary. - Maintenance periods or other exceptions may cause delays, potentially extending - beyond 24 hours until the servers are back online and the missing data is filled - in. + period should not exceed 31 days. + + Note: This report assumes there are no active commit features in the billing + plan. If there are active commit features (pre-paid resources) in your plan, use + /v1/`reservation_cost_report`/totals, as the results from this report will not + be accurate. + + Receiving data from the past hour might lead to incomplete statistics. For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. Args: time_from: The start date of the report period (ISO 8601). The report starts from the diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 3d18dec1..da32da6f 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -260,7 +260,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -733,7 +735,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index c27c64fb..edbe65f6 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -142,7 +142,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -540,7 +542,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index a0dd4e65..87689d92 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -134,9 +134,12 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: - """Create an instance with specified configuration. + """ + Create an instance with specified configuration. + + How to get access: - How to get access: For Linux, + For Linux, - Use the `user_data` field to provide a [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) @@ -144,7 +147,10 @@ def create( - Specify the `username` and `password` to create a new user. - When only `password` is provided, it is set as the password for the default user of the image. - - The `user_data` is ignored when the `password` is specified. For Windows, + - The `user_data` is ignored when the `password` is specified. + + For Windows, + - Use the `user_data` field to provide a [cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config) in base64 to create new users on Windows. @@ -188,8 +194,9 @@ def create( security_groups: Specifies security group UUIDs to be applied to all instance network interfaces. - servergroup_id: - Placement group ID for instance placement policy. Supported group types: + servergroup_id: Placement group ID for instance placement policy. + + Supported group types: - `anti-affinity`: Ensures instances are placed on different hosts for high availability. @@ -860,7 +867,9 @@ def get( The response content language for `ddos_profile` can be controlled via the 'language' cookie - parameter. **Cookie Parameters**: + parameter. + + **Cookie Parameters**: - `language` (str, optional): Language for the response content. Affects the `ddos_profile` field. Supported values: @@ -1148,9 +1157,12 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: - """Create an instance with specified configuration. + """ + Create an instance with specified configuration. + + How to get access: - How to get access: For Linux, + For Linux, - Use the `user_data` field to provide a [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) @@ -1158,7 +1170,10 @@ async def create( - Specify the `username` and `password` to create a new user. - When only `password` is provided, it is set as the password for the default user of the image. - - The `user_data` is ignored when the `password` is specified. For Windows, + - The `user_data` is ignored when the `password` is specified. + + For Windows, + - Use the `user_data` field to provide a [cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config) in base64 to create new users on Windows. @@ -1202,8 +1217,9 @@ async def create( security_groups: Specifies security group UUIDs to be applied to all instance network interfaces. - servergroup_id: - Placement group ID for instance placement policy. Supported group types: + servergroup_id: Placement group ID for instance placement policy. + + Supported group types: - `anti-affinity`: Ensures instances are placed on different hosts for high availability. @@ -1874,7 +1890,9 @@ async def get( The response content language for `ddos_profile` can be controlled via the 'language' cookie - parameter. **Cookie Parameters**: + parameter. + + **Cookie Parameters**: - `language` (str, optional): Language for the response content. Affects the `ddos_profile` field. Supported values: diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index fe7f9a68..d807001b 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -51,7 +51,9 @@ def list( ) -> IPRanges: """ Returns the complete list of IPv4 and IPv6 address ranges that Cloud uses for - outbound (egress) traffic. Typical reasons to call this endpoint: + outbound (egress) traffic. + + Typical reasons to call this endpoint: - Host-file delivery workflows – You upload images or other assets to the Cloud and share a download link that points to your own infrastructure. Add these @@ -61,10 +63,11 @@ def list( Cloud pushes events to your listener endpoint. Whitelisting the egress IP ranges lets you accept only traffic that originates from us. - General security controls, audit tooling, or SIEM rules that need to verify - that traffic truly comes from the Cloud. The list is global (covers all - regions) and refreshed automatically whenever Gcore allocates new egress IP - space. The response is an array of CIDR blocks; duplicate prefixes are not - returned. + that traffic truly comes from the Cloud. + + The list is global (covers all regions) and refreshed automatically whenever + Gcore allocates new egress IP space. The response is an array of CIDR blocks; + duplicate prefixes are not returned. """ return self._get( "/cloud/public/v1/ipranges/egress", @@ -107,7 +110,9 @@ async def list( ) -> IPRanges: """ Returns the complete list of IPv4 and IPv6 address ranges that Cloud uses for - outbound (egress) traffic. Typical reasons to call this endpoint: + outbound (egress) traffic. + + Typical reasons to call this endpoint: - Host-file delivery workflows – You upload images or other assets to the Cloud and share a download link that points to your own infrastructure. Add these @@ -117,10 +122,11 @@ async def list( Cloud pushes events to your listener endpoint. Whitelisting the egress IP ranges lets you accept only traffic that originates from us. - General security controls, audit tooling, or SIEM rules that need to verify - that traffic truly comes from the Cloud. The list is global (covers all - regions) and refreshed automatically whenever Gcore allocates new egress IP - space. The response is an array of CIDR blocks; duplicate prefixes are not - returned. + that traffic truly comes from the Cloud. + + The list is global (covers all regions) and refreshed automatically whenever + Gcore allocates new egress IP space. The response is an array of CIDR blocks; + duplicate prefixes are not returned. """ return await self._get( "/cloud/public/v1/ipranges/egress", diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index 2ab3669e..3e3f3398 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -120,9 +120,12 @@ def create( authentication: Authentication settings - autoscaler_config: Cluster autoscaler configuration. It allows you to override the default - cluster-autoscaler parameters provided by the platform with your preferred - values. Supported parameters (in alphabetical order): + autoscaler_config: Cluster autoscaler configuration. + + It allows you to override the default cluster-autoscaler parameters provided by + the platform with your preferred values. + + Supported parameters (in alphabetical order): - balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them. @@ -263,9 +266,12 @@ def update( Args: authentication: Authentication settings - autoscaler_config: Cluster autoscaler configuration. It allows you to override the default - cluster-autoscaler parameters provided by the platform with your preferred - values. Supported parameters (in alphabetical order): + autoscaler_config: Cluster autoscaler configuration. + + It allows you to override the default cluster-autoscaler parameters provided by + the platform with your preferred values. + + Supported parameters (in alphabetical order): - balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them. @@ -709,9 +715,12 @@ async def create( authentication: Authentication settings - autoscaler_config: Cluster autoscaler configuration. It allows you to override the default - cluster-autoscaler parameters provided by the platform with your preferred - values. Supported parameters (in alphabetical order): + autoscaler_config: Cluster autoscaler configuration. + + It allows you to override the default cluster-autoscaler parameters provided by + the platform with your preferred values. + + Supported parameters (in alphabetical order): - balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them. @@ -852,9 +861,12 @@ async def update( Args: authentication: Authentication settings - autoscaler_config: Cluster autoscaler configuration. It allows you to override the default - cluster-autoscaler parameters provided by the platform with your preferred - values. Supported parameters (in alphabetical order): + autoscaler_config: Cluster autoscaler configuration. + + It allows you to override the default cluster-autoscaler parameters provided by + the platform with your preferred values. + + Supported parameters (in alphabetical order): - balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them. diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index b95d3332..e6225101 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -265,7 +265,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -762,7 +764,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 0db4b88d..3ee27f95 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -200,6 +200,7 @@ def update( ) -> TaskIDList: """ Updates the specified load balancer pool with the provided changes. + **Behavior:** - Simple fields (strings, numbers, booleans) will be updated if provided @@ -209,8 +210,10 @@ def update( - If no change is detected for a specific field compared to the current pool state, that field will be skipped - If no changes are detected at all across all fields, no task will be created - and an empty task list will be returned **Examples of complex objects that - require full specification:** + and an empty task list will be returned + + **Examples of complex objects that require full specification:** + - Pool members: All member properties must be provided when updating members - Health monitors: Complete health monitor configuration must be specified - Session persistence: Full session persistence settings must be included @@ -593,6 +596,7 @@ async def update( ) -> TaskIDList: """ Updates the specified load balancer pool with the provided changes. + **Behavior:** - Simple fields (strings, numbers, booleans) will be updated if provided @@ -602,8 +606,10 @@ async def update( - If no change is detected for a specific field compared to the current pool state, that field will be skipped - If no changes are detected at all across all fields, no task will be created - and an empty task list will be returned **Examples of complex objects that - require full specification:** + and an empty task list will be returned + + **Examples of complex objects that require full specification:** + - Pool members: All member properties must be provided when updating members - Health monitors: Complete health monitor configuration must be specified - Session persistence: Full session persistence settings must be included diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index fe4cf9c4..2c4ca366 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -169,7 +169,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -507,7 +509,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 1067a023..c5048245 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -193,7 +193,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -589,7 +591,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 9ed4f0ec..0ba3414e 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -108,8 +108,11 @@ def create( Create a new container registry with the specified configuration. Args: - name: A name for the container registry. Should be in lowercase, consisting only of - numbers, letters and -, with maximum length of 24 characters + name: A name for the container registry. + + Should be in lowercase, consisting only of numbers, letters and -, + + with maximum length of 24 characters storage_limit: Registry storage limit, GiB @@ -347,8 +350,11 @@ async def create( Create a new container registry with the specified configuration. Args: - name: A name for the container registry. Should be in lowercase, consisting only of - numbers, letters and -, with maximum length of 24 characters + name: A name for the container registry. + + Should be in lowercase, consisting only of numbers, letters and -, + + with maximum length of 24 characters storage_limit: Registry storage limit, GiB diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index 110b6d2b..5225429a 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -69,8 +69,11 @@ def create( Args: duration: User account operating time, days - name: A name for the registry user. Should be in lowercase, consisting only of numbers - and letters, with maximum length of 16 characters + name: A name for the registry user. + + Should be in lowercase, consisting only of numbers and letters, + + with maximum length of 16 characters read_only: Read-only user @@ -355,8 +358,11 @@ async def create( Args: duration: User account operating time, days - name: A name for the registry user. Should be in lowercase, consisting only of numbers - and letters, with maximum length of 16 characters + name: A name for the registry user. + + Should be in lowercase, consisting only of numbers and letters, + + with maximum length of 16 characters read_only: Read-only user diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 52c3c958..5961799b 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -138,7 +138,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -508,7 +510,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index a9bff765..9c40ea2e 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -340,7 +340,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -1145,7 +1147,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index bba8e773..15085076 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -86,9 +86,11 @@ def create( determined by EDNS Client Subnet (ECS) if defined, otherwise - by client/recursor IP. Selector pickers are used in the specified order until the first match, in case of match - all next selectors are bypassed. Filters or - mutators are applied to the match according to the order they are specified. For - example, sort records by proximity to user, shuffle based on weights and return - not more than 3: + mutators are applied to the match according to the order they are specified. + + For example, sort records by proximity to user, shuffle based on weights and + return not more than 3: + `"pickers": [ { "type": "geodistance" }, { "type": "`weighted_shuffle`" }, { "type": "`first_n`", "limit": 3 } ]` #### geodns filter @@ -103,11 +105,14 @@ def create( - `regions` - list of region codes, e.g. `["de-bw", "de-by"]`; - `countries` - list of country codes, e.g. `["de", "lu", "lt"]`; - `continents` - list of continent codes, e.g. - `["af", "an", "eu", "as", "na", "sa", "oc"]`. If there is a record (or - multiple) with metadata matched IP, it's used as a response. If not - asn, - then country and then continent are checked for a match. If there is no match, - then the behaviour is defined by _strict_ parameter of the filter. Example: - `"pickers": [ { "type": "geodns", "strict": true } ]` + `["af", "an", "eu", "as", "na", "sa", "oc"]`. + + If there is a record (or multiple) with metadata matched IP, it's used as a + response. If not - asn, then country and then continent are checked for a match. + If there is no match, then the behaviour is defined by _strict_ parameter of the + filter. + + Example: `"pickers": [ { "type": "geodns", "strict": true } ]` ##### Strict parameter @@ -119,41 +124,50 @@ def create( Resource records which ASN metadata matches ASN of the requestor are picked by this selector, and passed to the next non-selector picker, if there is no - match - next configured picker starts with all records. Example: - `"pickers": [ {"type": "asn"} ]` + match - next configured picker starts with all records. + + Example: `"pickers": [ {"type": "asn"} ]` #### country selector Resource records which country metadata matches country of the requestor are picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. Example: - `"pickers": [ { "type": "country" } ]` + no match - next configured picker starts with all records. + + Example: `"pickers": [ { "type": "country" } ]` #### continent selector Resource records which continent metadata matches continent of the requestor are picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. Example: - `"pickers": [ { "type": "continent" } ]` + no match - next configured picker starts with all records. + + Example: `"pickers": [ { "type": "continent" } ]` #### region selector Resource records which region metadata matches region of the requestor are picked by this selector, and passed to the next non-selector picker, if there is no match - next configured picker starts with all records. e.g. `fr-nor` for - France/Normandy. Example: `"pickers": [ { "type": "region" } ]` + France/Normandy. + + Example: `"pickers": [ { "type": "region" } ]` #### ip selector Resource records which IP metadata matches IP of the requestor are picked by this selector, and passed to the next non-selector picker, if there is no match - next configured picker starts with all records. Maximum 100 subnets are - allowed to specify in meta of RR. Example: `"pickers": [ { "type": "ip" } ]` + allowed to specify in meta of RR. + + Example: `"pickers": [ { "type": "ip" } ]` #### default selector When enabled, records marked as default are selected: - `"meta": {"default": true}`. Example: + `"meta": {"default": true}`. + + Example: `"pickers": [ { "type": "geodns", "strict": false }, { "type": "default" }, { "type": "`first_n`", "limit": 2 } ]` #### geodistance mutator @@ -162,19 +176,22 @@ def create( meters) from requestor to the coordinates specified in latlong metadata. Distance is calculated using Haversine formula. The "nearest" to the user's IP RR goes first. The records without latlong metadata come last. e.g. for Berlin - `[52.520008, 13.404954]`.; In this configuration the only "nearest" to the - requestor record to be returned: + `[52.520008, 13.404954]`.; + + In this configuration the only "nearest" to the requestor record to be returned: `"pickers": [ { "type": "geodistance" }, { "type": "`first_n`", "limit": 1 } ]` #### `weighted_shuffle` mutator The resource records are rearranged in random order based on the `weight` - metadata. Default weight (if not specified) is 50. Example: - `"pickers": [ { "type": "`weighted_shuffle`" } ]` + metadata. Default weight (if not specified) is 50. + + Example: `"pickers": [ { "type": "`weighted_shuffle`" } ]` #### `first_n` filter Slices first N (N specified as a limit parameter value) resource records. + Example: `"pickers": [ { "type": "`first_n`", "limit": 1 } ]` returns only the first resource record. @@ -525,9 +542,11 @@ async def create( determined by EDNS Client Subnet (ECS) if defined, otherwise - by client/recursor IP. Selector pickers are used in the specified order until the first match, in case of match - all next selectors are bypassed. Filters or - mutators are applied to the match according to the order they are specified. For - example, sort records by proximity to user, shuffle based on weights and return - not more than 3: + mutators are applied to the match according to the order they are specified. + + For example, sort records by proximity to user, shuffle based on weights and + return not more than 3: + `"pickers": [ { "type": "geodistance" }, { "type": "`weighted_shuffle`" }, { "type": "`first_n`", "limit": 3 } ]` #### geodns filter @@ -542,11 +561,14 @@ async def create( - `regions` - list of region codes, e.g. `["de-bw", "de-by"]`; - `countries` - list of country codes, e.g. `["de", "lu", "lt"]`; - `continents` - list of continent codes, e.g. - `["af", "an", "eu", "as", "na", "sa", "oc"]`. If there is a record (or - multiple) with metadata matched IP, it's used as a response. If not - asn, - then country and then continent are checked for a match. If there is no match, - then the behaviour is defined by _strict_ parameter of the filter. Example: - `"pickers": [ { "type": "geodns", "strict": true } ]` + `["af", "an", "eu", "as", "na", "sa", "oc"]`. + + If there is a record (or multiple) with metadata matched IP, it's used as a + response. If not - asn, then country and then continent are checked for a match. + If there is no match, then the behaviour is defined by _strict_ parameter of the + filter. + + Example: `"pickers": [ { "type": "geodns", "strict": true } ]` ##### Strict parameter @@ -558,41 +580,50 @@ async def create( Resource records which ASN metadata matches ASN of the requestor are picked by this selector, and passed to the next non-selector picker, if there is no - match - next configured picker starts with all records. Example: - `"pickers": [ {"type": "asn"} ]` + match - next configured picker starts with all records. + + Example: `"pickers": [ {"type": "asn"} ]` #### country selector Resource records which country metadata matches country of the requestor are picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. Example: - `"pickers": [ { "type": "country" } ]` + no match - next configured picker starts with all records. + + Example: `"pickers": [ { "type": "country" } ]` #### continent selector Resource records which continent metadata matches continent of the requestor are picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. Example: - `"pickers": [ { "type": "continent" } ]` + no match - next configured picker starts with all records. + + Example: `"pickers": [ { "type": "continent" } ]` #### region selector Resource records which region metadata matches region of the requestor are picked by this selector, and passed to the next non-selector picker, if there is no match - next configured picker starts with all records. e.g. `fr-nor` for - France/Normandy. Example: `"pickers": [ { "type": "region" } ]` + France/Normandy. + + Example: `"pickers": [ { "type": "region" } ]` #### ip selector Resource records which IP metadata matches IP of the requestor are picked by this selector, and passed to the next non-selector picker, if there is no match - next configured picker starts with all records. Maximum 100 subnets are - allowed to specify in meta of RR. Example: `"pickers": [ { "type": "ip" } ]` + allowed to specify in meta of RR. + + Example: `"pickers": [ { "type": "ip" } ]` #### default selector When enabled, records marked as default are selected: - `"meta": {"default": true}`. Example: + `"meta": {"default": true}`. + + Example: `"pickers": [ { "type": "geodns", "strict": false }, { "type": "default" }, { "type": "`first_n`", "limit": 2 } ]` #### geodistance mutator @@ -601,19 +632,22 @@ async def create( meters) from requestor to the coordinates specified in latlong metadata. Distance is calculated using Haversine formula. The "nearest" to the user's IP RR goes first. The records without latlong metadata come last. e.g. for Berlin - `[52.520008, 13.404954]`.; In this configuration the only "nearest" to the - requestor record to be returned: + `[52.520008, 13.404954]`.; + + In this configuration the only "nearest" to the requestor record to be returned: `"pickers": [ { "type": "geodistance" }, { "type": "`first_n`", "limit": 1 } ]` #### `weighted_shuffle` mutator The resource records are rearranged in random order based on the `weight` - metadata. Default weight (if not specified) is 50. Example: - `"pickers": [ { "type": "`weighted_shuffle`" } ]` + metadata. Default weight (if not specified) is 50. + + Example: `"pickers": [ { "type": "`weighted_shuffle`" } ]` #### `first_n` filter Slices first N (N specified as a limit parameter value) resource records. + Example: `"pickers": [ { "type": "`first_n`", "limit": 1 } ]` returns only the first resource record. diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 0a5e9535..765d77eb 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -472,26 +472,30 @@ def get_statistics( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneGetStatisticsResponse: - """Statistics of DNS zone in common and by record types. + """ + Statistics of DNS zone in common and by record types. + + To get summary statistics for all zones use `all` instead of zone name in path. - To get summary statistics - for all zones use `all` instead of zone name in path. Note: Consumption - statistics is updated in near real-time as a standard practice. However, the - frequency of updates can vary, but they are typically available within a 30 - minutes period. Exceptions, such as maintenance periods, may delay data beyond - 30 minutes until servers resume and backfill missing statistics. + Note: Consumption statistics is updated in near real-time as a standard + practice. However, the frequency of updates can vary, but they are typically + available within a 30 minutes period. Exceptions, such as maintenance periods, + may delay data beyond 30 minutes until servers resume and backfill missing + statistics. Args: - from_: - Beginning of the requested time period (Unix Timestamp, UTC.) In a query string: - &from=1709068637 + from_: Beginning of the requested time period (Unix Timestamp, UTC.) + + In a query string: &from=1709068637 granularity: Granularity parameter string is a sequence of decimal numbers, each with - optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid - time units are "s", "m", "h". + optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". - record_type: - DNS record type. Possible values: + Valid time units are "s", "m", "h". + + record_type: DNS record type. + + Possible values: - A - AAAA @@ -502,9 +506,9 @@ def get_statistics( - SVCB - HTTPS - to: - End of the requested time period (Unix Timestamp, UTC.) In a query string: - &to=1709673437 + to: End of the requested time period (Unix Timestamp, UTC.) + + In a query string: &to=1709673437 extra_headers: Send extra headers @@ -557,20 +561,27 @@ def import_( n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, Read conventionally returns what is available instead of waiting - for more. When Read encounters an error or end-of-file condition after - successfully reading n > 0 bytes, it returns the number of bytes read. It may - return the (non-nil) error from the same call or return the error (and n == 0) - from a subsequent call. An instance of this general case is that a Reader - returning a non-zero number of bytes at the end of the input stream may return - either err == EOF or err == nil. The next Read should return 0, EOF. Callers - should always process the n > 0 bytes returned before considering the error err. - Doing so correctly handles I/O errors that happen after reading some bytes and - also both of the allowed EOF behaviors. If len(p) == 0, Read should always - return n == 0. It may return a non-nil error if some error condition is known, - such as EOF. Implementations of Read are discouraged from returning a zero byte - count with a nil error, except when len(p) == 0. Callers should treat a return - of 0 and nil as indicating that nothing happened; in particular it does not - indicate EOF. Implementations must not retain p. + for more. + + When Read encounters an error or end-of-file condition after successfully + reading n > 0 bytes, it returns the number of bytes read. It may return the + (non-nil) error from the same call or return the error (and n == 0) from a + subsequent call. An instance of this general case is that a Reader returning a + non-zero number of bytes at the end of the input stream may return either err == + EOF or err == nil. The next Read should return 0, EOF. + + Callers should always process the n > 0 bytes returned before considering the + error err. Doing so correctly handles I/O errors that happen after reading some + bytes and also both of the allowed EOF behaviors. + + If len(p) == 0, Read should always return n == 0. It may return a non-nil error + if some error condition is known, such as EOF. + + Implementations of Read are discouraged from returning a zero byte count with a + nil error, except when len(p) == 0. Callers should treat a return of 0 and nil + as indicating that nothing happened; in particular it does not indicate EOF. + + Implementations must not retain p. extra_headers: Send extra headers @@ -1098,26 +1109,30 @@ async def get_statistics( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneGetStatisticsResponse: - """Statistics of DNS zone in common and by record types. + """ + Statistics of DNS zone in common and by record types. + + To get summary statistics for all zones use `all` instead of zone name in path. - To get summary statistics - for all zones use `all` instead of zone name in path. Note: Consumption - statistics is updated in near real-time as a standard practice. However, the - frequency of updates can vary, but they are typically available within a 30 - minutes period. Exceptions, such as maintenance periods, may delay data beyond - 30 minutes until servers resume and backfill missing statistics. + Note: Consumption statistics is updated in near real-time as a standard + practice. However, the frequency of updates can vary, but they are typically + available within a 30 minutes period. Exceptions, such as maintenance periods, + may delay data beyond 30 minutes until servers resume and backfill missing + statistics. Args: - from_: - Beginning of the requested time period (Unix Timestamp, UTC.) In a query string: - &from=1709068637 + from_: Beginning of the requested time period (Unix Timestamp, UTC.) + + In a query string: &from=1709068637 granularity: Granularity parameter string is a sequence of decimal numbers, each with - optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid - time units are "s", "m", "h". + optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". - record_type: - DNS record type. Possible values: + Valid time units are "s", "m", "h". + + record_type: DNS record type. + + Possible values: - A - AAAA @@ -1128,9 +1143,9 @@ async def get_statistics( - SVCB - HTTPS - to: - End of the requested time period (Unix Timestamp, UTC.) In a query string: - &to=1709673437 + to: End of the requested time period (Unix Timestamp, UTC.) + + In a query string: &to=1709673437 extra_headers: Send extra headers @@ -1183,20 +1198,27 @@ async def import_( n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, Read conventionally returns what is available instead of waiting - for more. When Read encounters an error or end-of-file condition after - successfully reading n > 0 bytes, it returns the number of bytes read. It may - return the (non-nil) error from the same call or return the error (and n == 0) - from a subsequent call. An instance of this general case is that a Reader - returning a non-zero number of bytes at the end of the input stream may return - either err == EOF or err == nil. The next Read should return 0, EOF. Callers - should always process the n > 0 bytes returned before considering the error err. - Doing so correctly handles I/O errors that happen after reading some bytes and - also both of the allowed EOF behaviors. If len(p) == 0, Read should always - return n == 0. It may return a non-nil error if some error condition is known, - such as EOF. Implementations of Read are discouraged from returning a zero byte - count with a nil error, except when len(p) == 0. Callers should treat a return - of 0 and nil as indicating that nothing happened; in particular it does not - indicate EOF. Implementations must not retain p. + for more. + + When Read encounters an error or end-of-file condition after successfully + reading n > 0 bytes, it returns the number of bytes read. It may return the + (non-nil) error from the same call or return the error (and n == 0) from a + subsequent call. An instance of this general case is that a Reader returning a + non-zero number of bytes at the end of the input stream may return either err == + EOF or err == nil. The next Read should return 0, EOF. + + Callers should always process the n > 0 bytes returned before considering the + error err. Doing so correctly handles I/O errors that happen after reading some + bytes and also both of the allowed EOF behaviors. + + If len(p) == 0, Read should always return n == 0. It may return a non-nil error + if some error condition is known, such as EOF. + + Implementations of Read are discouraged from returning a zero byte count with a + nil error, except when len(p) == 0. Callers should treat a return of 0 and nil + as indicating that nothing happened; in particular it does not indicate EOF. + + Implementations must not retain p. extra_headers: Send extra headers diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index bbb9e413..f411d577 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -77,8 +77,9 @@ def update( email: User's email address. - groups: - User's group in the current account. IAM supports 5 groups: + groups: User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -86,7 +87,9 @@ def update( - Purge and Prefetch only (API) - Purge and Prefetch only (API+Web) - lang: User's language. Defines language of the control panel and email messages. + lang: User's language. + + Defines language of the control panel and email messages. name: User's name. @@ -132,11 +135,12 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[User]: - """Get a list of users. + """ + Get a list of users. - Pass a value for the `limit` parameter in your request if - you want retrieve a paginated result. Otherwise API returns a list with all - users without pagination. + Pass a value for the `limit` parameter in your request if you want retrieve a + paginated result. Otherwise API returns a list with all users without + pagination. Args: limit: The maximum number of items. @@ -253,16 +257,20 @@ def invite( ) -> UserInvite: """Invite a user to the account. - User will receive an email. The new user will - receive an invitation email with a link to create an account password, the - existing user will be notified about the invitation to the account. + User will receive an email. + + The new user will receive an invitation email with a + link to create an account password, the existing user will be notified about the + invitation to the account. Args: client_id: ID of account. email: User email. - lang: User's language. Defines language of the control panel and email messages. + lang: User's language. + + Defines language of the control panel and email messages. name: User name. @@ -342,8 +350,9 @@ async def update( email: User's email address. - groups: - User's group in the current account. IAM supports 5 groups: + groups: User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -351,7 +360,9 @@ async def update( - Purge and Prefetch only (API) - Purge and Prefetch only (API+Web) - lang: User's language. Defines language of the control panel and email messages. + lang: User's language. + + Defines language of the control panel and email messages. name: User's name. @@ -397,11 +408,12 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[User, AsyncOffsetPage[User]]: - """Get a list of users. + """ + Get a list of users. - Pass a value for the `limit` parameter in your request if - you want retrieve a paginated result. Otherwise API returns a list with all - users without pagination. + Pass a value for the `limit` parameter in your request if you want retrieve a + paginated result. Otherwise API returns a list with all users without + pagination. Args: limit: The maximum number of items. @@ -518,16 +530,20 @@ async def invite( ) -> UserInvite: """Invite a user to the account. - User will receive an email. The new user will - receive an invitation email with a link to create an account password, the - existing user will be notified about the invitation to the account. + User will receive an email. + + The new user will receive an invitation email with a + link to create an account password, the existing user will be notified about the + invitation to the account. Args: client_id: ID of account. email: User email. - lang: User's language. Defines language of the control panel and email messages. + lang: User's language. + + Defines language of the control panel and email messages. name: User name. diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index 66c28797..e6c589fa 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -128,11 +128,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Bucket]: - """Returns the list of buckets for the storage in a wrapped response. + """ + Returns the list of buckets for the storage in a wrapped response. - Response - format: count: total number of buckets (independent of pagination) results: - current page of buckets according to limit/offset + Response format: count: total number of buckets (independent of pagination) + results: current page of buckets according to limit/offset Args: limit: Max number of records in response @@ -286,11 +286,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Bucket, AsyncOffsetPage[Bucket]]: - """Returns the list of buckets for the storage in a wrapped response. + """ + Returns the list of buckets for the storage in a wrapped response. - Response - format: count: total number of buckets (independent of pagination) results: - current page of buckets according to limit/offset + Response format: count: total number of buckets (independent of pagination) + results: current page of buckets according to limit/offset Args: limit: Max number of records in response diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index 7b5d0039..c3a2d71e 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -224,9 +224,11 @@ def list( ) -> SyncOffsetPage[Storage]: """ Returns storages with the same filtering and pagination as v2, but in a - simplified response shape for easier client consumption. Response format: count: - total number of storages matching the filter (independent of pagination) - results: the current page of storages according to limit/offset + simplified response shape for easier client consumption. + + Response format: count: total number of storages matching the filter + (independent of pagination) results: the current page of storages according to + limit/offset Args: id: Filter by storage ID @@ -626,9 +628,11 @@ def list( ) -> AsyncPaginator[Storage, AsyncOffsetPage[Storage]]: """ Returns storages with the same filtering and pagination as v2, but in a - simplified response shape for easier client consumption. Response format: count: - total number of storages matching the filter (independent of pagination) - results: the current page of storages according to limit/offset + simplified response shape for easier client consumption. + + Response format: count: total number of storages matching the filter + (independent of pagination) results: the current page of storages according to + limit/offset Args: id: Filter by storage ID diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 5fef8653..6811e64c 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -65,10 +65,10 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskCreateResponse: - """Creating an AI task. + """ + Creating an AI task. - This method allows you to create an AI task for VOD video - processing: + This method allows you to create an AI task for VOD video processing: - ASR: Transcribe video - ASR: Translate subtitles @@ -77,28 +77,39 @@ def create( - CM: Soft nudity detection - CM: Hard nudity detection - CM: Objects recognition (soon) - ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) - How to use: + + ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) + + How to use: + - Create an AI task, specify algoritm to use - Get `task_id` - - Check a result using `.../ai/tasks/{task_id}` method For more detailed - information, see the description of each method separately. + - Check a result using `.../ai/tasks/{task_id}` method + + For more detailed information, see the description of each method separately. - **AI Automatic Speech Recognition (ASR)** AI is instrumental in automatic video - processing for subtitles creation by using Automatic Speech Recognition (ASR) - technology to transcribe spoken words into text, which can then be translated - into multiple languages for broader accessibility. Categories: + **AI Automatic Speech Recognition (ASR)** + + AI is instrumental in automatic video processing for subtitles creation by using + Automatic Speech Recognition (ASR) technology to transcribe spoken words into + text, which can then be translated into multiple languages for broader + accessibility. + + Categories: - `transcription` – to create subtitles/captions from audio in the original language. - `translation` – to transate subtitles/captions from the original language to - 99+ other languages. AI subtitle transcription and translation tools are - highly efficient, processing large volumes of audio-visual content quickly and - providing accurate transcriptions and translations with minimal human - intervention. Additionally, AI-driven solutions can significantly reduce costs - and turnaround times compared to traditional methods, making them an - invaluable resource for content creators and broadcasters aiming to reach - global audiences. Example response with positive result: + 99+ other languages. + + AI subtitle transcription and translation tools are highly efficient, processing + large volumes of audio-visual content quickly and providing accurate + transcriptions and translations with minimal human intervention. Additionally, + AI-driven solutions can significantly reduce costs and turnaround times compared + to traditional methods, making them an invaluable resource for content creators + and broadcasters aiming to reach global audiences. + + Example response with positive result: ``` { @@ -120,11 +131,14 @@ def create( } ``` - **AI Content Moderation (CM)** The AI Content Moderation API offers a powerful - solution for analyzing video content to detect various categories of - inappropriate material. Leveraging state-of-the-art AI models, this API ensures - real-time analysis and flagging of sensitive or restricted content types, making - it an essential tool for platforms requiring stringent content moderation. + **AI Content Moderation (CM)** + + The AI Content Moderation API offers a powerful solution for analyzing video + content to detect various categories of inappropriate material. Leveraging + state-of-the-art AI models, this API ensures real-time analysis and flagging of + sensitive or restricted content types, making it an essential tool for platforms + requiring stringent content moderation. + Categories: - `nsfw`: Quick algorithm to detect pornographic material, ensuring content is @@ -134,11 +148,15 @@ def create( - `soft_nudity`: Detailed video analysis that reveals both explicit and partial nudity, including the presence of male and female faces and other uncovered body parts. - - `sport`: Recognizes various sporting activities. The AI Content Moderation API - is an invaluable tool for managing and controlling the type of content being - shared or streamed on your platform. By implementing this API, you can ensure - compliance with community guidelines and legal requirements, as well as - provide a safer environment for your users. Important notes: + - `sport`: Recognizes various sporting activities. + + The AI Content Moderation API is an invaluable tool for managing and controlling + the type of content being shared or streamed on your platform. By implementing + this API, you can ensure compliance with community guidelines and legal + requirements, as well as provide a safer environment for your users. + + Important notes: + - It's allowed to analyse still images too (where applicable). Format of image: JPEG, PNG. In that case one image is the same as video of 1 second duration. - Not all frames in the video are used for analysis, but only key frames @@ -146,7 +164,9 @@ def create( detection will only occur at these timestamps. If an object appears and disappears between these time stamps, it will not be detected. We are working on a version to analyze more frames, please contact your manager or our - support team to enable this method. Example response with positive result: + support team to enable this method. + + Example response with positive result: ``` { @@ -159,9 +179,11 @@ def create( } ``` - **Additional information** Billing takes into account the duration of the - analyzed video. Or the duration until the stop tag(where applicable), if the - condition was triggered during the analysis. + **Additional information** + + Billing takes into account the duration of the analyzed video. Or the duration + until the stop tag(where applicable), if the condition was triggered during the + analysis. The heart of content moderation is AI, with additional services. They run on our own infrastructure, so the files/data are not transferred anywhere to external @@ -177,13 +199,20 @@ def create( url: URL to the MP4 file to analyse. File must be publicly accessible via HTTP/HTTPS. audio_language: Language in original audio (transcription only). This value is used to determine - the language from which to transcribe. If this is not set, the system will run - auto language identification and the subtitles will be in the detected language. - The method also works based on AI analysis. It's fairly accurate, but if it's - wrong, then set the language explicitly. Additionally, when this is not set, we - also support recognition of alternate languages in the video (language - code-switching). Language is set by 3-letter language code according to - ISO-639-2 (bibliographic code). We can process languages: + the language from which to transcribe. + + If this is not set, the system will run auto language identification and the + subtitles will be in the detected language. The method also works based on AI + analysis. It's fairly accurate, but if it's wrong, then set the language + explicitly. + + Additionally, when this is not set, we also support recognition of alternate + languages in the video (language code-switching). + + Language is set by 3-letter language code according to ISO-639-2 (bibliographic + code). + + We can process languages: - 'afr': Afrikaans - 'alb': Albanian @@ -290,10 +319,12 @@ def create( client_entity_data: Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. client_user_id: Meta parameter, designed to store your own identifier. Can be used by you to tag requests from different end-users. It is not used in any way in video @@ -301,6 +332,7 @@ def create( subtitles_language: Indicates which language it is clearly necessary to translate into. If this is not set, the original language will be used from attribute "`audio_language`". + Please note that: - transcription into the original language is a free procedure, @@ -356,11 +388,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreamingAI[AITask]: - """Returns a list of previously created and processed AI tasks. + """ + Returns a list of previously created and processed AI tasks. - The list contains - brief information about the task and its execution status. Data is displayed - page by page. + The list contains brief information about the task and its execution status. + Data is displayed page by page. Args: date_created: Time when task was created. Datetime in ISO 8601 format. @@ -368,15 +400,21 @@ def list( limit: Number of results to return per page. ordering: Which field to use when ordering the results: `task_id`, status, and - `task_name`. Sorting is done in ascending (ASC) order. If parameter is omitted - then "`started_at` DESC" is used for ordering by default. + `task_name`. Sorting is done in ascending (ASC) order. + + If parameter is omitted then "`started_at` DESC" is used for ordering by + default. page: Page to view from task list, starting from 1 search: This is an field for combined text search in the following fields: `task_id`, - `task_name`, status, and `task_data`. Both full and partial searches are - possible inside specified above fields. For example, you can filter tasks of a - certain category, or tasks by a specific original file. Example: + `task_name`, status, and `task_data`. + + Both full and partial searches are possible inside specified above fields. For + example, you can filter tasks of a certain category, or tasks by a specific + original file. + + Example: - To filter tasks of Content Moderation NSFW method: `GET /streaming/ai/tasks?search=nsfw` @@ -436,7 +474,9 @@ def cancel( ) -> AITaskCancelResponse: """ Stopping a previously launched AI-task without waiting for it to be fully - completed. The task will be moved to "REVOKED" status. + completed. + + The task will be moved to "REVOKED" status. Args: extra_headers: Send extra headers @@ -470,9 +510,10 @@ def get( ) -> AITaskGetResponse: """ This is the single method to check the execution status of an AI task, and - obtain the result of any type of AI task. Based on the results of processing, - the “result” field will contain an answer corresponding to the type of the - initially created task: + obtain the result of any type of AI task. + + Based on the results of processing, the “result” field will contain an answer + corresponding to the type of the initially created task: - ASR: Transcribe video - ASR: Translate subtitles @@ -484,7 +525,9 @@ def get( - etc... (see other methods from /ai/ domain) A queue is used to process videos. The waiting time depends on the total number - of requests in the system, so sometimes you will have to wait. Statuses: + of requests in the system, so sometimes you will have to wait. + + Statuses: - PENDING – the task is received and it is pending for available resources - STARTED – processing has started @@ -492,12 +535,14 @@ def get( - FAILURE – processing failed - REVOKED – processing was cancelled by the user (or the system) - RETRY – the task execution failed due to internal reasons, the task is queued - for re-execution (up to 3 times) Each task is processed in sub-stages, for - example, original language is first determined in a video, and then - transcription is performed. In such cases, the video processing status may - change from "STARTED" to "PENDING", and back. This is due to waiting for - resources for a specific processing sub-stage. In this case, the overall - percentage "progress" of video processing will reflect the full picture. + for re-execution (up to 3 times) + + Each task is processed in sub-stages, for example, original language is first + determined in a video, and then transcription is performed. In such cases, the + video processing status may change from "STARTED" to "PENDING", and back. This + is due to waiting for resources for a specific processing sub-stage. In this + case, the overall percentage "progress" of video processing will reflect the + full picture. The result data is stored for 1 month, after which it is deleted. @@ -547,12 +592,17 @@ def get_ai_settings( or not for AI translation. - this list will expand as new AI methods are added. - **`language_support`** There are many languages available for transcription. But - not all languages can be automatically translated to and from with good quality. - In order to determine the availability of translation from the audio language to - the desired subtitle language, you can use this type of "`language_support`". AI - models are constantly improving, so this method can be used for dynamic - determination. Example: + **`language_support`** + + There are many languages available for transcription. But not all languages can + be automatically translated to and from with good quality. In order to determine + the availability of translation from the audio language to the desired subtitle + language, you can use this type of "`language_support`". + + AI models are constantly improving, so this method can be used for dynamic + determination. + + Example: ``` curl -L 'https://api.gcore.com/streaming/ai/info?type=language_support&audio_language=eng&subtitles_language=fre' @@ -560,10 +610,12 @@ def get_ai_settings( { "supported": true } ``` - Today we provide the following capabilities as below. These are the 100 - languages for which we support only transcription and translation to English. - The iso639-2b codes for these are: + Today we provide the following capabilities as below. + + These are the 100 languages for which we support only transcription and + translation to English. The iso639-2b codes for these are: `afr, sqi, amh, ara, hye, asm, aze, bak, eus, bel, ben, bos, bre, bul, mya, cat, zho, hrv, ces, dan, nld, eng, est, fao, fin, fra, glg, kat, deu, guj, hat, hau, haw, heb, hin, hun, isl, ind, ita, jpn, jav, kan, kaz, khm, kor, lao, lat, lav, lin, lit, ltz, mkd, mlg, msa, mal, mlt, mri, mar, ell, mon, nep, nor, nno, oci, pan, fas, pol, por, pus, ron, rus, san, srp, sna, snd, sin, slk, slv, som, spa, sun, swa, swe, tgl, tgk, tam, tat, tel, tha, bod, tur, tuk, ukr, urd, uzb, vie, cym, yid, yor`. + These are the 77 languages for which we support translation to other languages and translation to: `afr, amh, ara, hye, asm, aze, eus, bel, ben, bos, bul, mya, cat, zho, hrv, ces, dan, nld, eng, est, fin, fra, glg, kat, deu, guj, heb, hin, hun, isl, ind, ita, jpn, jav, kan, kaz, khm, kor, lao, lav, lit, mkd, mal, mlt, mar, ell, mon, nep, nno, pan, fas, pol, por, pus, ron, rus, srp, sna, snd, slk, slv, som, spa, swa, swe, tgl, tgk, tam, tel, tha, tur, ukr, urd, vie, cym, yor`. @@ -645,10 +697,10 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskCreateResponse: - """Creating an AI task. + """ + Creating an AI task. - This method allows you to create an AI task for VOD video - processing: + This method allows you to create an AI task for VOD video processing: - ASR: Transcribe video - ASR: Translate subtitles @@ -657,28 +709,39 @@ async def create( - CM: Soft nudity detection - CM: Hard nudity detection - CM: Objects recognition (soon) - ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) - How to use: + + ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) + + How to use: + - Create an AI task, specify algoritm to use - Get `task_id` - - Check a result using `.../ai/tasks/{task_id}` method For more detailed - information, see the description of each method separately. + - Check a result using `.../ai/tasks/{task_id}` method + + For more detailed information, see the description of each method separately. - **AI Automatic Speech Recognition (ASR)** AI is instrumental in automatic video - processing for subtitles creation by using Automatic Speech Recognition (ASR) - technology to transcribe spoken words into text, which can then be translated - into multiple languages for broader accessibility. Categories: + **AI Automatic Speech Recognition (ASR)** + + AI is instrumental in automatic video processing for subtitles creation by using + Automatic Speech Recognition (ASR) technology to transcribe spoken words into + text, which can then be translated into multiple languages for broader + accessibility. + + Categories: - `transcription` – to create subtitles/captions from audio in the original language. - `translation` – to transate subtitles/captions from the original language to - 99+ other languages. AI subtitle transcription and translation tools are - highly efficient, processing large volumes of audio-visual content quickly and - providing accurate transcriptions and translations with minimal human - intervention. Additionally, AI-driven solutions can significantly reduce costs - and turnaround times compared to traditional methods, making them an - invaluable resource for content creators and broadcasters aiming to reach - global audiences. Example response with positive result: + 99+ other languages. + + AI subtitle transcription and translation tools are highly efficient, processing + large volumes of audio-visual content quickly and providing accurate + transcriptions and translations with minimal human intervention. Additionally, + AI-driven solutions can significantly reduce costs and turnaround times compared + to traditional methods, making them an invaluable resource for content creators + and broadcasters aiming to reach global audiences. + + Example response with positive result: ``` { @@ -700,11 +763,14 @@ async def create( } ``` - **AI Content Moderation (CM)** The AI Content Moderation API offers a powerful - solution for analyzing video content to detect various categories of - inappropriate material. Leveraging state-of-the-art AI models, this API ensures - real-time analysis and flagging of sensitive or restricted content types, making - it an essential tool for platforms requiring stringent content moderation. + **AI Content Moderation (CM)** + + The AI Content Moderation API offers a powerful solution for analyzing video + content to detect various categories of inappropriate material. Leveraging + state-of-the-art AI models, this API ensures real-time analysis and flagging of + sensitive or restricted content types, making it an essential tool for platforms + requiring stringent content moderation. + Categories: - `nsfw`: Quick algorithm to detect pornographic material, ensuring content is @@ -714,11 +780,15 @@ async def create( - `soft_nudity`: Detailed video analysis that reveals both explicit and partial nudity, including the presence of male and female faces and other uncovered body parts. - - `sport`: Recognizes various sporting activities. The AI Content Moderation API - is an invaluable tool for managing and controlling the type of content being - shared or streamed on your platform. By implementing this API, you can ensure - compliance with community guidelines and legal requirements, as well as - provide a safer environment for your users. Important notes: + - `sport`: Recognizes various sporting activities. + + The AI Content Moderation API is an invaluable tool for managing and controlling + the type of content being shared or streamed on your platform. By implementing + this API, you can ensure compliance with community guidelines and legal + requirements, as well as provide a safer environment for your users. + + Important notes: + - It's allowed to analyse still images too (where applicable). Format of image: JPEG, PNG. In that case one image is the same as video of 1 second duration. - Not all frames in the video are used for analysis, but only key frames @@ -726,7 +796,9 @@ async def create( detection will only occur at these timestamps. If an object appears and disappears between these time stamps, it will not be detected. We are working on a version to analyze more frames, please contact your manager or our - support team to enable this method. Example response with positive result: + support team to enable this method. + + Example response with positive result: ``` { @@ -739,9 +811,11 @@ async def create( } ``` - **Additional information** Billing takes into account the duration of the - analyzed video. Or the duration until the stop tag(where applicable), if the - condition was triggered during the analysis. + **Additional information** + + Billing takes into account the duration of the analyzed video. Or the duration + until the stop tag(where applicable), if the condition was triggered during the + analysis. The heart of content moderation is AI, with additional services. They run on our own infrastructure, so the files/data are not transferred anywhere to external @@ -757,13 +831,20 @@ async def create( url: URL to the MP4 file to analyse. File must be publicly accessible via HTTP/HTTPS. audio_language: Language in original audio (transcription only). This value is used to determine - the language from which to transcribe. If this is not set, the system will run - auto language identification and the subtitles will be in the detected language. - The method also works based on AI analysis. It's fairly accurate, but if it's - wrong, then set the language explicitly. Additionally, when this is not set, we - also support recognition of alternate languages in the video (language - code-switching). Language is set by 3-letter language code according to - ISO-639-2 (bibliographic code). We can process languages: + the language from which to transcribe. + + If this is not set, the system will run auto language identification and the + subtitles will be in the detected language. The method also works based on AI + analysis. It's fairly accurate, but if it's wrong, then set the language + explicitly. + + Additionally, when this is not set, we also support recognition of alternate + languages in the video (language code-switching). + + Language is set by 3-letter language code according to ISO-639-2 (bibliographic + code). + + We can process languages: - 'afr': Afrikaans - 'alb': Albanian @@ -870,10 +951,12 @@ async def create( client_entity_data: Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. client_user_id: Meta parameter, designed to store your own identifier. Can be used by you to tag requests from different end-users. It is not used in any way in video @@ -881,6 +964,7 @@ async def create( subtitles_language: Indicates which language it is clearly necessary to translate into. If this is not set, the original language will be used from attribute "`audio_language`". + Please note that: - transcription into the original language is a free procedure, @@ -936,11 +1020,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AITask, AsyncPageStreamingAI[AITask]]: - """Returns a list of previously created and processed AI tasks. + """ + Returns a list of previously created and processed AI tasks. - The list contains - brief information about the task and its execution status. Data is displayed - page by page. + The list contains brief information about the task and its execution status. + Data is displayed page by page. Args: date_created: Time when task was created. Datetime in ISO 8601 format. @@ -948,15 +1032,21 @@ def list( limit: Number of results to return per page. ordering: Which field to use when ordering the results: `task_id`, status, and - `task_name`. Sorting is done in ascending (ASC) order. If parameter is omitted - then "`started_at` DESC" is used for ordering by default. + `task_name`. Sorting is done in ascending (ASC) order. + + If parameter is omitted then "`started_at` DESC" is used for ordering by + default. page: Page to view from task list, starting from 1 search: This is an field for combined text search in the following fields: `task_id`, - `task_name`, status, and `task_data`. Both full and partial searches are - possible inside specified above fields. For example, you can filter tasks of a - certain category, or tasks by a specific original file. Example: + `task_name`, status, and `task_data`. + + Both full and partial searches are possible inside specified above fields. For + example, you can filter tasks of a certain category, or tasks by a specific + original file. + + Example: - To filter tasks of Content Moderation NSFW method: `GET /streaming/ai/tasks?search=nsfw` @@ -1016,7 +1106,9 @@ async def cancel( ) -> AITaskCancelResponse: """ Stopping a previously launched AI-task without waiting for it to be fully - completed. The task will be moved to "REVOKED" status. + completed. + + The task will be moved to "REVOKED" status. Args: extra_headers: Send extra headers @@ -1050,9 +1142,10 @@ async def get( ) -> AITaskGetResponse: """ This is the single method to check the execution status of an AI task, and - obtain the result of any type of AI task. Based on the results of processing, - the “result” field will contain an answer corresponding to the type of the - initially created task: + obtain the result of any type of AI task. + + Based on the results of processing, the “result” field will contain an answer + corresponding to the type of the initially created task: - ASR: Transcribe video - ASR: Translate subtitles @@ -1064,7 +1157,9 @@ async def get( - etc... (see other methods from /ai/ domain) A queue is used to process videos. The waiting time depends on the total number - of requests in the system, so sometimes you will have to wait. Statuses: + of requests in the system, so sometimes you will have to wait. + + Statuses: - PENDING – the task is received and it is pending for available resources - STARTED – processing has started @@ -1072,12 +1167,14 @@ async def get( - FAILURE – processing failed - REVOKED – processing was cancelled by the user (or the system) - RETRY – the task execution failed due to internal reasons, the task is queued - for re-execution (up to 3 times) Each task is processed in sub-stages, for - example, original language is first determined in a video, and then - transcription is performed. In such cases, the video processing status may - change from "STARTED" to "PENDING", and back. This is due to waiting for - resources for a specific processing sub-stage. In this case, the overall - percentage "progress" of video processing will reflect the full picture. + for re-execution (up to 3 times) + + Each task is processed in sub-stages, for example, original language is first + determined in a video, and then transcription is performed. In such cases, the + video processing status may change from "STARTED" to "PENDING", and back. This + is due to waiting for resources for a specific processing sub-stage. In this + case, the overall percentage "progress" of video processing will reflect the + full picture. The result data is stored for 1 month, after which it is deleted. @@ -1127,12 +1224,17 @@ async def get_ai_settings( or not for AI translation. - this list will expand as new AI methods are added. - **`language_support`** There are many languages available for transcription. But - not all languages can be automatically translated to and from with good quality. - In order to determine the availability of translation from the audio language to - the desired subtitle language, you can use this type of "`language_support`". AI - models are constantly improving, so this method can be used for dynamic - determination. Example: + **`language_support`** + + There are many languages available for transcription. But not all languages can + be automatically translated to and from with good quality. In order to determine + the availability of translation from the audio language to the desired subtitle + language, you can use this type of "`language_support`". + + AI models are constantly improving, so this method can be used for dynamic + determination. + + Example: ``` curl -L 'https://api.gcore.com/streaming/ai/info?type=language_support&audio_language=eng&subtitles_language=fre' @@ -1140,10 +1242,12 @@ async def get_ai_settings( { "supported": true } ``` - Today we provide the following capabilities as below. These are the 100 - languages for which we support only transcription and translation to English. - The iso639-2b codes for these are: + Today we provide the following capabilities as below. + + These are the 100 languages for which we support only transcription and + translation to English. The iso639-2b codes for these are: `afr, sqi, amh, ara, hye, asm, aze, bak, eus, bel, ben, bos, bre, bul, mya, cat, zho, hrv, ces, dan, nld, eng, est, fao, fin, fra, glg, kat, deu, guj, hat, hau, haw, heb, hin, hun, isl, ind, ita, jpn, jav, kan, kaz, khm, kor, lao, lat, lav, lin, lit, ltz, mkd, mlg, msa, mal, mlt, mri, mar, ell, mon, nep, nor, nno, oci, pan, fas, pol, por, pus, ron, rus, san, srp, sna, snd, sin, slk, slv, som, spa, sun, swa, swe, tgl, tgk, tam, tat, tel, tha, bod, tur, tuk, ukr, urd, uzb, vie, cym, yid, yor`. + These are the 77 languages for which we support translation to other languages and translation to: `afr, amh, ara, hye, asm, aze, eus, bel, ben, bos, bul, mya, cat, zho, hrv, ces, dan, nld, eng, est, fin, fra, glg, kat, deu, guj, heb, hin, hun, isl, ind, ita, jpn, jav, kan, kaz, khm, kor, lao, lav, lit, mkd, mal, mlt, mar, ell, mon, nep, nno, pan, fas, pol, por, pus, ron, rus, srp, sna, snd, slk, slv, som, spa, swa, swe, tgl, tgk, tam, tel, tha, tur, ukr, urd, vie, cym, yor`. diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index bb9803bb..757bde4d 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -59,8 +59,10 @@ def create( - many live streams, - advertising, - - and design in one config. If you use other players or you get streams by - direct .m3u8/.mpd links, then you will not need this entity. + - and design in one config. + + If you use other players or you get streams by direct .m3u8/.mpd links, then you + will not need this entity. Scheme of "broadcast" entity using: ![Scheme of "broadcast" using](https://demo-files.gvideo.io/apidocs/broadcasts.png) @@ -289,8 +291,10 @@ async def create( - many live streams, - advertising, - - and design in one config. If you use other players or you get streams by - direct .m3u8/.mpd links, then you will not need this entity. + - and design in one config. + + If you use other players or you get streams by direct .m3u8/.mpd links, then you + will not need this entity. Scheme of "broadcast" entity using: ![Scheme of "broadcast" using](https://demo-files.gvideo.io/apidocs/broadcasts.png) diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 0f70207a..3c45afb6 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -148,9 +148,12 @@ def delete( After its execution, all contents of the directory will be deleted recursively: - Subdirectories - - Videos The directory and contents are deleted permanently and irreversibly. - Therefore, it is impossible to restore files after this. For details, see the - Product Documentation. + - Videos + + The directory and contents are deleted permanently and irreversibly. Therefore, + it is impossible to restore files after this. + + For details, see the Product Documentation. Args: extra_headers: Send extra headers @@ -213,10 +216,10 @@ def get_tree( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoriesTree: - """Tree structure of directories. + """ + Tree structure of directories. - This endpoint returns hierarchical data about - directories in video hosting. + This endpoint returns hierarchical data about directories in video hosting. """ return self._get( "/streaming/directories/tree", @@ -352,9 +355,12 @@ async def delete( After its execution, all contents of the directory will be deleted recursively: - Subdirectories - - Videos The directory and contents are deleted permanently and irreversibly. - Therefore, it is impossible to restore files after this. For details, see the - Product Documentation. + - Videos + + The directory and contents are deleted permanently and irreversibly. Therefore, + it is impossible to restore files after this. + + For details, see the Product Documentation. Args: extra_headers: Send extra headers @@ -417,10 +423,10 @@ async def get_tree( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoriesTree: - """Tree structure of directories. + """ + Tree structure of directories. - This endpoint returns hierarchical data about - directories in video hosting. + This endpoint returns hierarchical data about directories in video hosting. """ return await self._get( "/streaming/directories/tree", diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index bb2036fc..aea53517 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -73,8 +73,10 @@ def create( ) -> PlaylistCreate: """ Playlist is a curated collection of video content organized in a sequential - manner. This method offers several advantages and features that are typical of - live streaming but with more control over the content. Here's how it works: + manner. + + This method offers several advantages and features that are typical of live + streaming but with more control over the content. Here's how it works: - Playlist always consists only of static VOD videos you previously uploaded to the system. @@ -84,24 +86,33 @@ def create( - Playlist can be looped endlessly. In this case, all the videos in the list will be constantly repeated through the list. - Playlist can be programmed to be played at a specific time in the future. In - that case, before the start time there will be empty manifest. You can add new - videos to the list, remove unnecessary videos, or change the order of videos - in the list. But please pay attention to when the video list changes, it is - updated instantly on the server. This means that after saving the changed - list, the playlist will be reloaded for all users and it will start plays from - the very first element. Maximum video limit = 128 videos in a row. + that case, before the start time there will be empty manifest. + + You can add new videos to the list, remove unnecessary videos, or change the + order of videos in the list. But please pay attention to when the video list + changes, it is updated instantly on the server. This means that after saving the + changed list, the playlist will be reloaded for all users and it will start + plays from the very first element. + + Maximum video limit = 128 videos in a row. Examples of usage: - Looped video playback - - Scheduled playback **Looped video playback** It can be used to simulate TV - channel pre-programmed behaviour. + - Scheduled playback + + **Looped video playback** + + It can be used to simulate TV channel pre-programmed behaviour. + - Selection: Choose a series of videos, such as TV show episodes, movies, tutorials, or any other relevant content. - Order: Arrange the selected videos in the desired sequence, much like setting a broadcast schedule. - Looping: Optionally, the playlist can be set to loop, replaying the sequence - once it finishes to maintain a continuous stream. Example: + once it finishes to maintain a continuous stream. + + Example: ``` active: true @@ -109,9 +120,11 @@ def create( name: "Playlist: TV channel 'The world around us' (Programmed broadcast for 24 hours)" ``` - **Scheduled playback** It can be used to simulate live events such as virtual - concerts, webinars, or any special broadcasts without the logistical challenges - of an actual live stream. + **Scheduled playback** + + It can be used to simulate live events such as virtual concerts, webinars, or + any special broadcasts without the logistical challenges of an actual live + stream. - Timing: Set specific start time, creating the illusion of a live broadcast schedule. @@ -172,8 +185,10 @@ def create( iframe_url: A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will automatically play in all - browsers. The player can be opened or shared via this direct link. Also the - video player can be integrated into your web pages using the Iframe tag. + browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. @@ -193,7 +208,9 @@ def create( Datetime in ISO 8601 format. video_ids: A list of VOD IDs included in the playlist. Order of videos in a playlist - reflects the order of IDs in the array. Maximum video limit = 128. + reflects the order of IDs in the array. + + Maximum video limit = 128. extra_headers: Send extra headers @@ -303,8 +320,10 @@ def update( iframe_url: A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will automatically play in all - browsers. The player can be opened or shared via this direct link. Also the - video player can be integrated into your web pages using the Iframe tag. + browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. @@ -324,7 +343,9 @@ def update( Datetime in ISO 8601 format. video_ids: A list of VOD IDs included in the playlist. Order of videos in a playlist - reflects the order of IDs in the array. Maximum video limit = 128. + reflects the order of IDs in the array. + + Maximum video limit = 128. extra_headers: Send extra headers @@ -541,8 +562,10 @@ async def create( ) -> PlaylistCreate: """ Playlist is a curated collection of video content organized in a sequential - manner. This method offers several advantages and features that are typical of - live streaming but with more control over the content. Here's how it works: + manner. + + This method offers several advantages and features that are typical of live + streaming but with more control over the content. Here's how it works: - Playlist always consists only of static VOD videos you previously uploaded to the system. @@ -552,24 +575,33 @@ async def create( - Playlist can be looped endlessly. In this case, all the videos in the list will be constantly repeated through the list. - Playlist can be programmed to be played at a specific time in the future. In - that case, before the start time there will be empty manifest. You can add new - videos to the list, remove unnecessary videos, or change the order of videos - in the list. But please pay attention to when the video list changes, it is - updated instantly on the server. This means that after saving the changed - list, the playlist will be reloaded for all users and it will start plays from - the very first element. Maximum video limit = 128 videos in a row. + that case, before the start time there will be empty manifest. + + You can add new videos to the list, remove unnecessary videos, or change the + order of videos in the list. But please pay attention to when the video list + changes, it is updated instantly on the server. This means that after saving the + changed list, the playlist will be reloaded for all users and it will start + plays from the very first element. + + Maximum video limit = 128 videos in a row. Examples of usage: - Looped video playback - - Scheduled playback **Looped video playback** It can be used to simulate TV - channel pre-programmed behaviour. + - Scheduled playback + + **Looped video playback** + + It can be used to simulate TV channel pre-programmed behaviour. + - Selection: Choose a series of videos, such as TV show episodes, movies, tutorials, or any other relevant content. - Order: Arrange the selected videos in the desired sequence, much like setting a broadcast schedule. - Looping: Optionally, the playlist can be set to loop, replaying the sequence - once it finishes to maintain a continuous stream. Example: + once it finishes to maintain a continuous stream. + + Example: ``` active: true @@ -577,9 +609,11 @@ async def create( name: "Playlist: TV channel 'The world around us' (Programmed broadcast for 24 hours)" ``` - **Scheduled playback** It can be used to simulate live events such as virtual - concerts, webinars, or any special broadcasts without the logistical challenges - of an actual live stream. + **Scheduled playback** + + It can be used to simulate live events such as virtual concerts, webinars, or + any special broadcasts without the logistical challenges of an actual live + stream. - Timing: Set specific start time, creating the illusion of a live broadcast schedule. @@ -640,8 +674,10 @@ async def create( iframe_url: A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will automatically play in all - browsers. The player can be opened or shared via this direct link. Also the - video player can be integrated into your web pages using the Iframe tag. + browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. @@ -661,7 +697,9 @@ async def create( Datetime in ISO 8601 format. video_ids: A list of VOD IDs included in the playlist. Order of videos in a playlist - reflects the order of IDs in the array. Maximum video limit = 128. + reflects the order of IDs in the array. + + Maximum video limit = 128. extra_headers: Send extra headers @@ -771,8 +809,10 @@ async def update( iframe_url: A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will automatically play in all - browsers. The player can be opened or shared via this direct link. Also the - video player can be integrated into your web pages using the Iframe tag. + browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. @@ -792,7 +832,9 @@ async def update( Datetime in ISO 8601 format. video_ids: A list of VOD IDs included in the playlist. Order of videos in a playlist - reflects the order of IDs in the array. Maximum video limit = 128. + reflects the order of IDs in the array. + + Maximum video limit = 128. extra_headers: Send extra headers diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index 5343d5c5..d91c5569 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -64,19 +64,26 @@ def list( described in the [documentation](https://gcore.com/docs/streaming-platform/live-streams-and-videos-protocols-and-codecs/output-parameters-after-transcoding-bitrate-frame-rate-and-codecs). These values are the default for everyone. There is no need to configure - anything additional. Read more about qiality in our blog + anything additional. + + Read more about qiality in our blog [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality). - ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) Only - for those cases when, in addition to the main parameters, it is necessary to use - your own, then it is necessary to use custom quality sets. How to use: + + ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) + + Only for those cases when, in addition to the main parameters, it is necessary + to use your own, then it is necessary to use custom quality sets. + + How to use: 1. By default custom quality set is empty – `{ "live":[],"vod":[] }` 2. Request the use of custom quality sets from your manager or the Support Team. 3. Please forward your requirements to us, since the parameters are set not by you, but by our engineers. (We are working to ensure that later you can create qualities by yourself.) - 4. Use the created quality sets through the these specified API methods. Here - are some common parameters of quality settings: + 4. Use the created quality sets through the these specified API methods. + + Here are some common parameters of quality settings: - Resolution: Determines the size of the video frame. I.e. 720p, 1080p, 4K, etc. - Bitrate: Refers to the amount of data processed per unit of time. @@ -110,19 +117,23 @@ def set_default( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QualitySets: - """Method to set default quality set for VOD and Live transcoding. + """ + Method to set default quality set for VOD and Live transcoding. + + For changing default quality set, specify the ID of the custom quality set from + the method GET /`quality_sets`. - For changing - default quality set, specify the ID of the custom quality set from the method - GET /`quality_sets`. Default value can be reverted to the system defaults - (cleared) by setting `"id": null`. + Default value can be reverted to the system defaults (cleared) by setting + `"id": null`. Live transcoding management: - You can specify quality set explicitly in POST /streams method, look at attribute "`quality_set_id`". - - Otherwise these default values will be used by the system by default. VOD - transcoding management: + - Otherwise these default values will be used by the system by default. + + VOD transcoding management: + - You can specify quality set explicitly in POST /videos method, look at attribute "`quality_set_id`". - Otherwise these default values will be used by the system by default. @@ -195,19 +206,26 @@ async def list( described in the [documentation](https://gcore.com/docs/streaming-platform/live-streams-and-videos-protocols-and-codecs/output-parameters-after-transcoding-bitrate-frame-rate-and-codecs). These values are the default for everyone. There is no need to configure - anything additional. Read more about qiality in our blog + anything additional. + + Read more about qiality in our blog [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality). - ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) Only - for those cases when, in addition to the main parameters, it is necessary to use - your own, then it is necessary to use custom quality sets. How to use: + + ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) + + Only for those cases when, in addition to the main parameters, it is necessary + to use your own, then it is necessary to use custom quality sets. + + How to use: 1. By default custom quality set is empty – `{ "live":[],"vod":[] }` 2. Request the use of custom quality sets from your manager or the Support Team. 3. Please forward your requirements to us, since the parameters are set not by you, but by our engineers. (We are working to ensure that later you can create qualities by yourself.) - 4. Use the created quality sets through the these specified API methods. Here - are some common parameters of quality settings: + 4. Use the created quality sets through the these specified API methods. + + Here are some common parameters of quality settings: - Resolution: Determines the size of the video frame. I.e. 720p, 1080p, 4K, etc. - Bitrate: Refers to the amount of data processed per unit of time. @@ -241,19 +259,23 @@ async def set_default( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QualitySets: - """Method to set default quality set for VOD and Live transcoding. + """ + Method to set default quality set for VOD and Live transcoding. + + For changing default quality set, specify the ID of the custom quality set from + the method GET /`quality_sets`. - For changing - default quality set, specify the ID of the custom quality set from the method - GET /`quality_sets`. Default value can be reverted to the system defaults - (cleared) by setting `"id": null`. + Default value can be reverted to the system defaults (cleared) by setting + `"id": null`. Live transcoding management: - You can specify quality set explicitly in POST /streams method, look at attribute "`quality_set_id`". - - Otherwise these default values will be used by the system by default. VOD - transcoding management: + - Otherwise these default values will be used by the system by default. + + VOD transcoding management: + - You can specify quality set explicitly in POST /videos method, look at attribute "`quality_set_id`". - Otherwise these default values will be used by the system by default. diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index b252b848..82b2a1f6 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -104,6 +104,7 @@ def get_ffprobes( """ Aggregates data for the specified video stream in the specified time interval. "interval" and "units" params working together to point aggregation interval. + You can use this method to watch when stream was alive in time, and when it was off. @@ -158,14 +159,17 @@ def get_live_unique_viewers( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetLiveUniqueViewersResponse: - """Calculates time series of unique viewers of Live streams via CDN. - - The statistics - are taken from the data of CDN and work regardless of which player the views - were made with. Works similar to the method `/statistics/cdn/uniqs`. But this - allows you to break down data with the specified granularity: minutes, hours, - days. Based on this method, a graph of unique views in the Customer Portal is - built. + """ + Calculates time series of unique viewers of Live streams via CDN. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Works similar to the method `/statistics/cdn/uniqs`. But this allows you to + break down data with the specified granularity: minutes, hours, days. + + Based on this method, a graph of unique views in the Customer Portal is built. + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/cdn_unique_viewers.png) Args: @@ -226,11 +230,14 @@ def get_live_watch_time_cdn( """Calculates a time series of live streams watching duration in minutes. Views of - only those streams that meet the specified filters are summed up. The statistics - are taken from the data of CDN and work regardless of which player the views - were made with. Please note that the result for each time interval is in - minutes, it is rounded to the nearest upper integer. You cannot use the sum of - all intervals as the total watch time value; instead, use the /total method. + only those streams that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Please note that the result for each time interval is in minutes, it is rounded + to the nearest upper integer. You cannot use the sum of all intervals as the + total watch time value; instead, use the /total method. Args: from_: Start of the time period for counting minutes of watching. Format is date time @@ -291,9 +298,10 @@ def get_live_watch_time_total_cdn( """Calculates the total duration of live streams watching in minutes. Views of only - those streams that meet the specified filters are summed up. The statistics are - taken from the data of CDN and work regardless of which player the views were - made with. + those streams that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. Args: client_user_id: Filter by field "`client_user_id`" @@ -400,12 +408,13 @@ def get_popular_videos( ) -> PopularVideos: """ Aggregates the number of views for all client videos, grouping them by id and - sort from most popular to less in the built-in player. Note. This method - operates only on data collected by the built-in HTML player. It will not show - statistics if you are using another player or viewing in native OS players - through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations through - CDN (look at method /statistics/cdn/uniqs) or statistics of the players you have - chosen. + sort from most popular to less in the built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -560,15 +569,19 @@ def get_unique_viewers( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UniqueViewers: - """Get the number of unique viewers in the built-in player. + """ + Get the number of unique viewers in the built-in player. + + Counts the number of unique IPs. - Counts the number of - unique IPs. Allows flexible grouping and filtering. The fields in the response - depend on the selected grouping. Note. This method operates only on data - collected by the built-in HTML player. It will not show statistics if you are - using another player or viewing in native OS players through direct - .m3u8/.mpd/.mp4 links. For such cases, use calculations through CDN (look at - method /statistics/cdn/uniqs) or statistics of the players you have chosen. + Allows flexible grouping and filtering. The fields in the response depend on the + selected grouping. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -636,30 +649,44 @@ def get_unique_viewers_cdn( """Сounts the number of unique viewers of a video entity over CDN. It doesn't - matter what player you used. All unique viewers for the specified period of time - are counted. **How does it work?** Calculating the number of unique viewers for - a Live stream or VOD over CDN involves aggregating and analyzing various metrics - to ensure each individual viewer is counted only once, regardless of how many - times they connect or disconnect during the stream. This method provides - statistics for any video viewing by unique users, regardless of viewing method - and a player you used. Thus, this is the most important difference from viewing - through the built-in player: + matter what player you used. + + All unique viewers for the specified period of time are counted. + + **How does it work?** + + Calculating the number of unique viewers for a Live stream or VOD over CDN + involves aggregating and analyzing various metrics to ensure each individual + viewer is counted only once, regardless of how many times they connect or + disconnect during the stream. + + This method provides statistics for any video viewing by unique users, + regardless of viewing method and a player you used. Thus, this is the most + important difference from viewing through the built-in player: - In method /statistics/uniqs viewers of the built-in player are tracked only. - - But this method tracks all viewers from everywhere. This method is a - combination of two other Live and VOD detailed methods. If you need detailed - information, then see the methods: `/statistics/stream/viewers` and - `/statistics/vod/viewers`. **Data Processing and Deduplication** We us IP - Address & User-Agent combination. Each unique combination of IP address and - User-Agent string might be considered a unique viewer. This approach allows to - accurately estimate the number of unique viewers. However, this is not - foolproof due to NAT (Network Address Translation) and shared networks. Thus - if your users fall under such restrictions, then the number of unique viewers - may be higher than calculated. **Why is there no "Unique Views" method?** - Based on CDN data, we can calculate the number of unique viewers only. Thus - only your player will be able to count the number of unique views (clicks on - the Play button) within the player session (i.e. how many times 1 unique - viewer clicked the Play button within a unique player's session). + - But this method tracks all viewers from everywhere. + + This method is a combination of two other Live and VOD detailed methods. If you + need detailed information, then see the methods: `/statistics/stream/viewers` + and `/statistics/vod/viewers`. + + **Data Processing and Deduplication** + + We us IP Address & User-Agent combination. Each unique combination of IP address + and User-Agent string might be considered a unique viewer. + + This approach allows to accurately estimate the number of unique viewers. + However, this is not foolproof due to NAT (Network Address Translation) and + shared networks. Thus if your users fall under such restrictions, then the + number of unique viewers may be higher than calculated. + + **Why is there no "Unique Views" method?** + + Based on CDN data, we can calculate the number of unique viewers only. Thus only + your player will be able to count the number of unique views (clicks on the Play + button) within the player session (i.e. how many times 1 unique viewer clicked + the Play button within a unique player's session). Args: date_from: Start of time frame. Format is date time in ISO 8601. @@ -667,10 +694,13 @@ def get_unique_viewers_cdn( date_to: End of time frame. Format is date time in ISO 8601. id: Filter by entity's id. Put ID of a Live stream, VOD or a playlist to be - calculated. If the value is omitted, then the calculation is done for all - videos/streams of the specified type. When using this "id" parameter, be sure to - specify the "type" parameter too. If you do not specify a type, the "id" will be - ignored. + calculated. + + If the value is omitted, then the calculation is done for all videos/streams of + the specified type. + + When using this "id" parameter, be sure to specify the "type" parameter too. If + you do not specify a type, the "id" will be ignored. type: Filter by entity's type @@ -720,15 +750,17 @@ def get_views( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Views: - """Get the number of views in the built-in player. + """ + Get the number of views in the built-in player. - Allows flexible grouping and - filtering. The fields in the response depend on the selected grouping. Note. - This method operates only on data collected by the built-in HTML player. It will - not show statistics if you are using another player or viewing in native OS - players through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations - through CDN (look at method /statistics/cdn/uniqs) or statistics of the players - you have chosen. + Allows flexible grouping and filtering. The fields in the response depend on the + selected grouping. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -793,11 +825,13 @@ def get_views_by_browsers( ) -> ViewsByBrowser: """ Aggregates the number of views for all client videos, grouping them by browsers - in the built-in player. Note. This method operates only on data collected by the - built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + in the built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -844,6 +878,7 @@ def get_views_by_country( ) -> ViewsByCountry: """ Aggregates the number of views grouping them by country in the built-in player. + Note. This method operates only on data collected by the built-in HTML player. It will not show statistics if you are using another player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use @@ -895,11 +930,13 @@ def get_views_by_hostname( ) -> ViewsByHostname: """ Aggregates the number of views, grouping them by "host" domain name the built-in - player was embeded to. Note. This method operates only on data collected by the - built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + player was embeded to. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -946,11 +983,13 @@ def get_views_by_operating_system( ) -> ViewsByOperatingSystem: """ Aggregates the number of views for all client videos, grouping them by device - OSs in the built-in player. Note. This method operates only on data collected by - the built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + OSs in the built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -997,11 +1036,13 @@ def get_views_by_referer( ) -> ViewsByReferer: """ Aggregates the number of views, grouping them by "referer" URL of pages the - built-in player was embeded to. Note. This method operates only on data - collected by the built-in HTML player. It will not show statistics if you are - using another player or viewing in native OS players through direct - .m3u8/.mpd/.mp4 links. For such cases, use calculations through CDN (look at - method /statistics/cdn/uniqs) or statistics of the players you have chosen. + built-in player was embeded to. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -1048,11 +1089,13 @@ def get_views_by_region( ) -> ViewsByRegion: """ Aggregates the number of views grouping them by regions of countries in the - built-in player. Note. This method operates only on data collected by the - built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -1101,14 +1144,18 @@ def get_views_heatmap( ) -> ViewsHeatmap: """ Shows information about what part of the video your viewers watched in the - built-in player. This way you can find out how many viewers started watching the - video, and where they stopped watching instead of watching the entire video to - the end. Has different format of response depends on query param "type". Note. - This method operates only on data collected by the built-in HTML player. It will - not show statistics if you are using another player or viewing in native OS - players through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations - through CDN (look at method /statistics/cdn/uniqs) or statistics of the players - you have chosen. + built-in player. + + This way you can find out how many viewers started watching the video, and where + they stopped watching instead of watching the entire video to the end. + + Has different format of response depends on query param "type". + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -1161,8 +1208,10 @@ def get_vod_storage_volume( ) -> VodStatisticsSeries: """ Calculates time series of the duration in minutes for all processed and - undeleted client videos. The data is updated every 8 hours, it does not make - sense to set the granulation less than 1 day. + undeleted client videos. + + The data is updated every 8 hours, it does not make sense to set the granulation + less than 1 day. Args: from_: Start of time frame. Datetime in ISO 8601 format. @@ -1209,8 +1258,10 @@ def get_vod_transcoding_duration( ) -> VodStatisticsSeries: """ Calculates time series of the transcoding time in minutes for all processed - client videos. The data is updated every 8 hours, it does not make sense to set - the granulation less than 1 day. + client videos. + + The data is updated every 8 hours, it does not make sense to set the granulation + less than 1 day. Args: from_: Start of time frame. Datetime in ISO 8601 format. @@ -1258,13 +1309,17 @@ def get_vod_unique_viewers_cdn( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: - """Calculates time series of unique viewers of VOD via CDN. + """ + Calculates time series of unique viewers of VOD via CDN. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Works similar to the method `/statistics/cdn/uniqs`. But this allows you to + break down data with the specified granularity: minutes, hours, days. - The statistics are - taken from the data of CDN and work regardless of which player the views were - made with. Works similar to the method `/statistics/cdn/uniqs`. But this allows - you to break down data with the specified granularity: minutes, hours, days. Based on this method, a graph of unique views in the Customer Portal is built. + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/cdn_unique_viewers.png) Args: @@ -1325,11 +1380,14 @@ def get_vod_watch_time_cdn( """Calculates a time series of video watching duration in minutes. Views of only - those videos that meet the specified filters are summed up. The statistics are - taken from the data of CDN and work regardless of which player the views were - made with. Please note that the result for each time interval is in minutes, it - is rounded to the nearest upper integer. You cannot use the sum of all intervals - as the total watch time value; instead, use the /total method. + those videos that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Please note that the result for each time interval is in minutes, it is rounded + to the nearest upper integer. You cannot use the sum of all intervals as the + total watch time value; instead, use the /total method. Args: from_: Start of the time period for counting minutes of watching. Format is date time @@ -1390,9 +1448,10 @@ def get_vod_watch_time_total_cdn( """Calculates the total duration of video watching in minutes. Views of only those - videos that meet the specified filters are summed up. The statistics are taken - from the data of CDN and work regardless of which player the views were made - with. + videos that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. Args: client_user_id: Filter by field "`client_user_id`" @@ -1472,6 +1531,7 @@ async def get_ffprobes( """ Aggregates data for the specified video stream in the specified time interval. "interval" and "units" params working together to point aggregation interval. + You can use this method to watch when stream was alive in time, and when it was off. @@ -1526,14 +1586,17 @@ async def get_live_unique_viewers( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetLiveUniqueViewersResponse: - """Calculates time series of unique viewers of Live streams via CDN. - - The statistics - are taken from the data of CDN and work regardless of which player the views - were made with. Works similar to the method `/statistics/cdn/uniqs`. But this - allows you to break down data with the specified granularity: minutes, hours, - days. Based on this method, a graph of unique views in the Customer Portal is - built. + """ + Calculates time series of unique viewers of Live streams via CDN. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Works similar to the method `/statistics/cdn/uniqs`. But this allows you to + break down data with the specified granularity: minutes, hours, days. + + Based on this method, a graph of unique views in the Customer Portal is built. + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/cdn_unique_viewers.png) Args: @@ -1594,11 +1657,14 @@ async def get_live_watch_time_cdn( """Calculates a time series of live streams watching duration in minutes. Views of - only those streams that meet the specified filters are summed up. The statistics - are taken from the data of CDN and work regardless of which player the views - were made with. Please note that the result for each time interval is in - minutes, it is rounded to the nearest upper integer. You cannot use the sum of - all intervals as the total watch time value; instead, use the /total method. + only those streams that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Please note that the result for each time interval is in minutes, it is rounded + to the nearest upper integer. You cannot use the sum of all intervals as the + total watch time value; instead, use the /total method. Args: from_: Start of the time period for counting minutes of watching. Format is date time @@ -1659,9 +1725,10 @@ async def get_live_watch_time_total_cdn( """Calculates the total duration of live streams watching in minutes. Views of only - those streams that meet the specified filters are summed up. The statistics are - taken from the data of CDN and work regardless of which player the views were - made with. + those streams that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. Args: client_user_id: Filter by field "`client_user_id`" @@ -1768,12 +1835,13 @@ async def get_popular_videos( ) -> PopularVideos: """ Aggregates the number of views for all client videos, grouping them by id and - sort from most popular to less in the built-in player. Note. This method - operates only on data collected by the built-in HTML player. It will not show - statistics if you are using another player or viewing in native OS players - through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations through - CDN (look at method /statistics/cdn/uniqs) or statistics of the players you have - chosen. + sort from most popular to less in the built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -1928,15 +1996,19 @@ async def get_unique_viewers( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UniqueViewers: - """Get the number of unique viewers in the built-in player. + """ + Get the number of unique viewers in the built-in player. + + Counts the number of unique IPs. - Counts the number of - unique IPs. Allows flexible grouping and filtering. The fields in the response - depend on the selected grouping. Note. This method operates only on data - collected by the built-in HTML player. It will not show statistics if you are - using another player or viewing in native OS players through direct - .m3u8/.mpd/.mp4 links. For such cases, use calculations through CDN (look at - method /statistics/cdn/uniqs) or statistics of the players you have chosen. + Allows flexible grouping and filtering. The fields in the response depend on the + selected grouping. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2004,30 +2076,44 @@ async def get_unique_viewers_cdn( """Сounts the number of unique viewers of a video entity over CDN. It doesn't - matter what player you used. All unique viewers for the specified period of time - are counted. **How does it work?** Calculating the number of unique viewers for - a Live stream or VOD over CDN involves aggregating and analyzing various metrics - to ensure each individual viewer is counted only once, regardless of how many - times they connect or disconnect during the stream. This method provides - statistics for any video viewing by unique users, regardless of viewing method - and a player you used. Thus, this is the most important difference from viewing - through the built-in player: + matter what player you used. + + All unique viewers for the specified period of time are counted. + + **How does it work?** + + Calculating the number of unique viewers for a Live stream or VOD over CDN + involves aggregating and analyzing various metrics to ensure each individual + viewer is counted only once, regardless of how many times they connect or + disconnect during the stream. + + This method provides statistics for any video viewing by unique users, + regardless of viewing method and a player you used. Thus, this is the most + important difference from viewing through the built-in player: - In method /statistics/uniqs viewers of the built-in player are tracked only. - - But this method tracks all viewers from everywhere. This method is a - combination of two other Live and VOD detailed methods. If you need detailed - information, then see the methods: `/statistics/stream/viewers` and - `/statistics/vod/viewers`. **Data Processing and Deduplication** We us IP - Address & User-Agent combination. Each unique combination of IP address and - User-Agent string might be considered a unique viewer. This approach allows to - accurately estimate the number of unique viewers. However, this is not - foolproof due to NAT (Network Address Translation) and shared networks. Thus - if your users fall under such restrictions, then the number of unique viewers - may be higher than calculated. **Why is there no "Unique Views" method?** - Based on CDN data, we can calculate the number of unique viewers only. Thus - only your player will be able to count the number of unique views (clicks on - the Play button) within the player session (i.e. how many times 1 unique - viewer clicked the Play button within a unique player's session). + - But this method tracks all viewers from everywhere. + + This method is a combination of two other Live and VOD detailed methods. If you + need detailed information, then see the methods: `/statistics/stream/viewers` + and `/statistics/vod/viewers`. + + **Data Processing and Deduplication** + + We us IP Address & User-Agent combination. Each unique combination of IP address + and User-Agent string might be considered a unique viewer. + + This approach allows to accurately estimate the number of unique viewers. + However, this is not foolproof due to NAT (Network Address Translation) and + shared networks. Thus if your users fall under such restrictions, then the + number of unique viewers may be higher than calculated. + + **Why is there no "Unique Views" method?** + + Based on CDN data, we can calculate the number of unique viewers only. Thus only + your player will be able to count the number of unique views (clicks on the Play + button) within the player session (i.e. how many times 1 unique viewer clicked + the Play button within a unique player's session). Args: date_from: Start of time frame. Format is date time in ISO 8601. @@ -2035,10 +2121,13 @@ async def get_unique_viewers_cdn( date_to: End of time frame. Format is date time in ISO 8601. id: Filter by entity's id. Put ID of a Live stream, VOD or a playlist to be - calculated. If the value is omitted, then the calculation is done for all - videos/streams of the specified type. When using this "id" parameter, be sure to - specify the "type" parameter too. If you do not specify a type, the "id" will be - ignored. + calculated. + + If the value is omitted, then the calculation is done for all videos/streams of + the specified type. + + When using this "id" parameter, be sure to specify the "type" parameter too. If + you do not specify a type, the "id" will be ignored. type: Filter by entity's type @@ -2088,15 +2177,17 @@ async def get_views( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Views: - """Get the number of views in the built-in player. + """ + Get the number of views in the built-in player. - Allows flexible grouping and - filtering. The fields in the response depend on the selected grouping. Note. - This method operates only on data collected by the built-in HTML player. It will - not show statistics if you are using another player or viewing in native OS - players through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations - through CDN (look at method /statistics/cdn/uniqs) or statistics of the players - you have chosen. + Allows flexible grouping and filtering. The fields in the response depend on the + selected grouping. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2161,11 +2252,13 @@ async def get_views_by_browsers( ) -> ViewsByBrowser: """ Aggregates the number of views for all client videos, grouping them by browsers - in the built-in player. Note. This method operates only on data collected by the - built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + in the built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2212,6 +2305,7 @@ async def get_views_by_country( ) -> ViewsByCountry: """ Aggregates the number of views grouping them by country in the built-in player. + Note. This method operates only on data collected by the built-in HTML player. It will not show statistics if you are using another player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use @@ -2263,11 +2357,13 @@ async def get_views_by_hostname( ) -> ViewsByHostname: """ Aggregates the number of views, grouping them by "host" domain name the built-in - player was embeded to. Note. This method operates only on data collected by the - built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + player was embeded to. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2314,11 +2410,13 @@ async def get_views_by_operating_system( ) -> ViewsByOperatingSystem: """ Aggregates the number of views for all client videos, grouping them by device - OSs in the built-in player. Note. This method operates only on data collected by - the built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + OSs in the built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2365,11 +2463,13 @@ async def get_views_by_referer( ) -> ViewsByReferer: """ Aggregates the number of views, grouping them by "referer" URL of pages the - built-in player was embeded to. Note. This method operates only on data - collected by the built-in HTML player. It will not show statistics if you are - using another player or viewing in native OS players through direct - .m3u8/.mpd/.mp4 links. For such cases, use calculations through CDN (look at - method /statistics/cdn/uniqs) or statistics of the players you have chosen. + built-in player was embeded to. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2416,11 +2516,13 @@ async def get_views_by_region( ) -> ViewsByRegion: """ Aggregates the number of views grouping them by regions of countries in the - built-in player. Note. This method operates only on data collected by the - built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2469,14 +2571,18 @@ async def get_views_heatmap( ) -> ViewsHeatmap: """ Shows information about what part of the video your viewers watched in the - built-in player. This way you can find out how many viewers started watching the - video, and where they stopped watching instead of watching the entire video to - the end. Has different format of response depends on query param "type". Note. - This method operates only on data collected by the built-in HTML player. It will - not show statistics if you are using another player or viewing in native OS - players through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations - through CDN (look at method /statistics/cdn/uniqs) or statistics of the players - you have chosen. + built-in player. + + This way you can find out how many viewers started watching the video, and where + they stopped watching instead of watching the entire video to the end. + + Has different format of response depends on query param "type". + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2529,8 +2635,10 @@ async def get_vod_storage_volume( ) -> VodStatisticsSeries: """ Calculates time series of the duration in minutes for all processed and - undeleted client videos. The data is updated every 8 hours, it does not make - sense to set the granulation less than 1 day. + undeleted client videos. + + The data is updated every 8 hours, it does not make sense to set the granulation + less than 1 day. Args: from_: Start of time frame. Datetime in ISO 8601 format. @@ -2577,8 +2685,10 @@ async def get_vod_transcoding_duration( ) -> VodStatisticsSeries: """ Calculates time series of the transcoding time in minutes for all processed - client videos. The data is updated every 8 hours, it does not make sense to set - the granulation less than 1 day. + client videos. + + The data is updated every 8 hours, it does not make sense to set the granulation + less than 1 day. Args: from_: Start of time frame. Datetime in ISO 8601 format. @@ -2626,13 +2736,17 @@ async def get_vod_unique_viewers_cdn( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: - """Calculates time series of unique viewers of VOD via CDN. + """ + Calculates time series of unique viewers of VOD via CDN. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Works similar to the method `/statistics/cdn/uniqs`. But this allows you to + break down data with the specified granularity: minutes, hours, days. - The statistics are - taken from the data of CDN and work regardless of which player the views were - made with. Works similar to the method `/statistics/cdn/uniqs`. But this allows - you to break down data with the specified granularity: minutes, hours, days. Based on this method, a graph of unique views in the Customer Portal is built. + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/cdn_unique_viewers.png) Args: @@ -2693,11 +2807,14 @@ async def get_vod_watch_time_cdn( """Calculates a time series of video watching duration in minutes. Views of only - those videos that meet the specified filters are summed up. The statistics are - taken from the data of CDN and work regardless of which player the views were - made with. Please note that the result for each time interval is in minutes, it - is rounded to the nearest upper integer. You cannot use the sum of all intervals - as the total watch time value; instead, use the /total method. + those videos that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Please note that the result for each time interval is in minutes, it is rounded + to the nearest upper integer. You cannot use the sum of all intervals as the + total watch time value; instead, use the /total method. Args: from_: Start of the time period for counting minutes of watching. Format is date time @@ -2758,9 +2875,10 @@ async def get_vod_watch_time_total_cdn( """Calculates the total duration of video watching in minutes. Views of only those - videos that meet the specified filters are summed up. The statistics are taken - from the data of CDN and work regardless of which player the views were made - with. + videos that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. Args: client_user_id: Filter by field "`client_user_id`" diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index b6f1b4fd..780f045b 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -65,6 +65,7 @@ def create( There are can be more that 1 overlay over a stream, which are small or stretched over full frame. Overlays can have transparent areas. Frequency of update is 1 FPS. Automatic size scaling for Adaptative Bitrate qualities is applied. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/coffee_run_overlays.gif) How to activate and use in simple steps: @@ -73,12 +74,16 @@ def create( - Set “`html_overlay`” attribute to "true" for a stream - Set array of overlays - Start or restart your stream again - - Enjoy :-) For the first time an overlay should be enabled **before** start - pushing of a live stream. If you are pushing the stream already (stream is - alive and you are activating overlay for the first time), then overlay will - become active after restart pushing. Once you activate the overlay for the - stream for the first time, you can add, change, move, delete widgets on the - fly even during a live stream with no affection on a result stream. + - Enjoy :-) + + For the first time an overlay should be enabled **before** start pushing of a + live stream. If you are pushing the stream already (stream is alive and you are + activating overlay for the first time), then overlay will become active after + restart pushing. + + Once you activate the overlay for the stream for the first time, you can add, + change, move, delete widgets on the fly even during a live stream with no + affection on a result stream. Tech limits: @@ -105,13 +110,16 @@ def create( can be stopped automatically, and the ability to insert widgets itself is banned. - If feature is disabled, you will receive HTTP code: 422. Error text: Feature - disabled. Contact support to enable. Please, pay attention to the content of - HTML widges you use. If you don't trust them, then you shouldn't use them, as - their result will be displayed in live stream to all users. **Will there be a - widget in the recording?** Right now overlay widgets are sent to the end - viewer in the HLS/DASH streams, but are not recorded due to technical - limitations. We are working to ensure that widgets remain in the recordings as - well. Follow the news. + disabled. Contact support to enable. + + Please, pay attention to the content of HTML widges you use. If you don't trust + them, then you shouldn't use them, as their result will be displayed in live + stream to all users. + + **Will there be a widget in the recording?** Right now overlay widgets are sent + to the end viewer in the HLS/DASH streams, but are not recorded due to technical + limitations. We are working to ensure that widgets remain in the recordings as + well. Follow the news. Args: extra_headers: Send extra headers @@ -362,6 +370,7 @@ async def create( There are can be more that 1 overlay over a stream, which are small or stretched over full frame. Overlays can have transparent areas. Frequency of update is 1 FPS. Automatic size scaling for Adaptative Bitrate qualities is applied. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/coffee_run_overlays.gif) How to activate and use in simple steps: @@ -370,12 +379,16 @@ async def create( - Set “`html_overlay`” attribute to "true" for a stream - Set array of overlays - Start or restart your stream again - - Enjoy :-) For the first time an overlay should be enabled **before** start - pushing of a live stream. If you are pushing the stream already (stream is - alive and you are activating overlay for the first time), then overlay will - become active after restart pushing. Once you activate the overlay for the - stream for the first time, you can add, change, move, delete widgets on the - fly even during a live stream with no affection on a result stream. + - Enjoy :-) + + For the first time an overlay should be enabled **before** start pushing of a + live stream. If you are pushing the stream already (stream is alive and you are + activating overlay for the first time), then overlay will become active after + restart pushing. + + Once you activate the overlay for the stream for the first time, you can add, + change, move, delete widgets on the fly even during a live stream with no + affection on a result stream. Tech limits: @@ -402,13 +415,16 @@ async def create( can be stopped automatically, and the ability to insert widgets itself is banned. - If feature is disabled, you will receive HTTP code: 422. Error text: Feature - disabled. Contact support to enable. Please, pay attention to the content of - HTML widges you use. If you don't trust them, then you shouldn't use them, as - their result will be displayed in live stream to all users. **Will there be a - widget in the recording?** Right now overlay widgets are sent to the end - viewer in the HLS/DASH streams, but are not recorded due to technical - limitations. We are working to ensure that widgets remain in the recordings as - well. Follow the news. + disabled. Contact support to enable. + + Please, pay attention to the content of HTML widges you use. If you don't trust + them, then you shouldn't use them, as their result will be displayed in live + stream to all users. + + **Will there be a widget in the recording?** Right now overlay widgets are sent + to the end viewer in the HLS/DASH streams, but are not recorded due to technical + limitations. We are working to ensure that widgets remain in the recordings as + well. Follow the news. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 691b6e03..acc3a7f3 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -97,22 +97,26 @@ def create( The input in API may contain streams of different formats, including the most common ones RTMP, RTMPS, SRT, HLS. Note that multicast MPEG-TS over UDP and - others are supported too, ask the Support Team please. For ingestion, you can - use both PUSH and PULL methods. Also you can use the main and backup servers, - which are geographically located in different locations. By default, any free - ingest points in the world are used. Settings have been applied that deliver - low-latency streams in the optimal way. If for some reason you need to set a - fixed ingest point, or if you need to set the main and backup ingest points in - the same region (for example, do not send streams outside the EU or US), then - contact our Support Team. + others are supported too, ask the Support Team please. + + For ingestion, you can use both PUSH and PULL methods. + + Also you can use the main and backup servers, which are geographically located + in different locations. By default, any free ingest points in the world are + used. Settings have been applied that deliver low-latency streams in the optimal + way. If for some reason you need to set a fixed ingest point, or if you need to + set the main and backup ingest points in the same region (for example, do not + send streams outside the EU or US), then contact our Support Team. The output is HLS and MPEG-DASH with ABR. We transcode video for you by our cloud-based infrastructure. ABR ladder supports all qualities from SD to 8K HDR - 60fps. All our streams are Low Latency enabled. We support a delay of ±4 seconds - for video streams by utilizing Common Media Application Format (CMAF) - technology. So you obtain latency from the traditional 30-50 seconds to ±4 - seconds only by default. If you need legacy non-low-latency HLS, then look at - HLS MPEG-TS delivery below. + 60fps. + + All our streams are Low Latency enabled. We support a delay of ±4 seconds for + video streams by utilizing Common Media Application Format (CMAF) technology. So + you obtain latency from the traditional 30-50 seconds to ±4 seconds only by + default. If you need legacy non-low-latency HLS, then look at HLS MPEG-TS + delivery below. You have access to additional functions such as: @@ -125,11 +129,16 @@ def create( For more information see specific API methods, and the Knowledge Base. To organize streaming with ultra-low latency, look for WebRTC delivery in different section in the Knowledge Base. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/low-latency-football.gif) Args: - name: Stream name. Often used as a human-readable name for the stream, but can contain - any text you wish. The values are not unique and may be repeated. Examples: + name: Stream name. + + Often used as a human-readable name for the stream, but can contain any text you + wish. The values are not unique and may be repeated. + + Examples: - Conference in July - Stream #10003 @@ -137,17 +146,21 @@ def create( - 480fd499-2de2-4988-bc1a-a4eebe9818ee active: Stream switch between on and off. This is not an indicator of the status "stream - is receiving and it is LIVE", but rather an on/off switch. When stream is - switched off, there is no way to process it: PULL is deactivated and PUSH will - return an error. + is receiving and it is LIVE", but rather an on/off switch. + + When stream is switched off, there is no way to process it: PULL is deactivated + and PUSH will return an error. - true – stream can be processed - false – stream is off, and cannot be processed auto_record: Enables autotomatic recording of the stream when it started. So you don't need - to call recording manually. Result of recording is automatically added to video - hosting. For details see the /streams/`start_recording` method and in knowledge - base Values: + to call recording manually. + + Result of recording is automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base + + Values: - true – auto recording is enabled - false – auto recording is disabled @@ -167,9 +180,12 @@ def create( field in any way when processing the stream. Example: `client_user_id = 1001` dvr_duration: DVR duration in seconds if DVR feature is enabled for the stream. So this is - duration of how far the user can rewind the live stream. `dvr_duration` range is - [30...14400]. Maximum value is 4 hours = 14400 seconds. If you need more, ask - the Support Team please. + duration of how far the user can rewind the live stream. + + `dvr_duration` range is [30...14400]. + + Maximum value is 4 hours = 14400 seconds. If you need more, ask the Support Team + please. dvr_enabled: Enables DVR for the stream: @@ -185,7 +201,9 @@ def create( projection: Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, - then use parameters of that video player. Modes: + then use parameters of that video player. + + Modes: - regular – regular “flat” stream - vr360 – display stream in 360° mode @@ -205,23 +223,28 @@ def create( your conditions. Look at GET /`quality_sets` method record_type: Method of recording a stream. Specifies the source from which the stream will be - recorded: original or transcoded. Types: + recorded: original or transcoded. + + Types: - "origin" – To record RMTP/SRT/etc original clean media source. - "transcoded" – To record the output transcoded version of the stream, including overlays, texts, logos, etc. additional media layers. - uri: When using PULL method, this is the URL to pull a stream from. You can specify - multiple addresses separated by a space (" "), so you can organize a backup - plan. In this case, the specified addresses will be selected one by one using - round robin scheduling. If the first address does not respond, then the next one - in the list will be automatically requested, returning to the first and so on in - a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + uri: When using PULL method, this is the URL to pull a stream from. + + You can specify multiple addresses separated by a space (" "), so you can + organize a backup plan. In this case, the specified addresses will be selected + one by one using round robin scheduling. If the first address does not respond, + then the next one in the list will be automatically requested, returning to the + first and so on in a circle. Also, if the sucessfully working stream stops + sending data, then the next one will be selected according to the same scheme. + + After 2 hours of inactivity of your original stream, the system stops PULL + requests and the stream is deactivated (the "active" field switches to "false"). + + Please, note that this field is for PULL only, so is not suitable for PUSH. Look + at fields "`push_url`" and "`push_url_srt`" from GET method. extra_headers: Send extra headers @@ -357,11 +380,14 @@ def delete( Delete a live stream. After deleting the live stream, all associated data is deleted: settings, PUSH - and PULL links, video playback links, etc. Live stream information is deleted - permanently and irreversibly. Therefore, it is impossible to restore data and - files after this. But if the live had recordings, they continue to remain - independent Video entities. The "`stream_id`" parameter will simply point to a - stream that no longer exists. + and PULL links, video playback links, etc. + + Live stream information is deleted permanently and irreversibly. Therefore, it + is impossible to restore data and files after this. + + But if the live had recordings, they continue to remain independent Video + entities. The "`stream_id`" parameter will simply point to a stream that no + longer exists. Perhaps, instead of deleting, you may use the stream deactivation: @@ -437,24 +463,29 @@ def create_clip( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Clip: - """Create an instant clip from on-going live stream. + """ + Create an instant clip from on-going live stream. - Instant clips are applicable - in cases where there is no time to wait for the broadcast to be completed and - recorded. For example, for quickly cutting highlights in sport events, or - cutting an important moment in the news or live performance. + Instant clips are applicable in cases where there is no time to wait for the + broadcast to be completed and recorded. For example, for quickly cutting + highlights in sport events, or cutting an important moment in the news or live + performance. Instant clip becomes available for viewing in the following formats: - HLS .m3u8, - MP4, - VOD in video hosting with a permanent link to watch video. - ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) - **Clip lifetime:** Instant clips are a copy of the stream, created from a live - stream. They are stored in memory for a limited time, after which the clip - ceases to exist and you will receive a 404 on the link. Limits that you should - keep in mind: + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) + + **Clip lifetime:** + + Instant clips are a copy of the stream, created from a live stream. They are + stored in memory for a limited time, after which the clip ceases to exist and + you will receive a 404 on the link. + + Limits that you should keep in mind: - The clip's lifespan is controlled by `expiration` parameter. - The default expiration value is 1 hour. The value can be set from 1 minute to @@ -468,9 +499,10 @@ def create_clip( you try to request it before this time, the response will be error code 425 "Too Early". - **Cutting a clip from a source:** In order to use clips recording feature, DVR - must be enabled for a stream: "`dvr_enabled`: true". The DVR serves as a source - for creating clips: + **Cutting a clip from a source:** + + In order to use clips recording feature, DVR must be enabled for a stream: + "`dvr_enabled`: true". The DVR serves as a source for creating clips: - By default live stream DVR is set to 1 hour (3600 seconds). You can create an instant clip using any segment of this time period by specifying the desired @@ -478,39 +510,56 @@ def create_clip( - If you create a clip, but the DVR expires, the clip will still exist for the specified time as a copy of the stream. - **Getting permanent VOD:** To get permanent VOD version of a live clip use this - parameter when making a request to create a clip: `vod_required: true`. Later, - when the clip is ready, grab `video_id` value from the response and query the - video by regular GET /video/{id} method. + **Getting permanent VOD:** + + To get permanent VOD version of a live clip use this parameter when making a + request to create a clip: `vod_required: true`. + + Later, when the clip is ready, grab `video_id` value from the response and query + the video by regular GET /video/{id} method. Args: - duration: Requested segment duration in seconds to be cut. Please, note that cutting is - based on the idea of instantly creating a clip, instead of precise timing. So - final segment may be: + duration: Requested segment duration in seconds to be cut. + + Please, note that cutting is based on the idea of instantly creating a clip, + instead of precise timing. So final segment may be: - Less than the specified value if there is less data in the DVR than the requested segment. - Greater than the specified value, because segment is aligned to the first and last key frames of already stored fragment in DVR, this way -1 and +1 chunks - can be added to left and right. Duration of cutted segment cannot be greater - than DVR duration for this stream. Therefore, to change the maximum, use - "`dvr_duration`" parameter of this stream. - - expiration: Expire time of the clip via a public link. Unix timestamp in seconds, absolute - value. This is the time how long the instant clip will be stored in the server - memory and can be accessed via public HLS/MP4 links. Download and/or use the - instant clip before this time expires. After the time has expired, the clip is - deleted from memory and is no longer available via the link. You need to create - a new segment, or use `vod_required: true` attribute. If value is omitted, then - expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. - `unix timestamp = + + 3600`). Allowed range: 1m <= expiration - <= 4h. Example: + can be added to left and right. + + Duration of cutted segment cannot be greater than DVR duration for this stream. + Therefore, to change the maximum, use "`dvr_duration`" parameter of this stream. + + expiration: Expire time of the clip via a public link. + + Unix timestamp in seconds, absolute value. + + This is the time how long the instant clip will be stored in the server memory + and can be accessed via public HLS/MP4 links. Download and/or use the instant + clip before this time expires. + + After the time has expired, the clip is deleted from memory and is no longer + available via the link. You need to create a new segment, or use + `vod_required: true` attribute. + + If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the + end of the clip (i.e. `unix timestamp = + + 3600`). + + Allowed range: 1m <= expiration <= 4h. + + Example: `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` - start: Starting point of the segment to cut. Unix timestamp in seconds, absolute value. - Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value - from the past is specified, it is used as the starting point for the segment to - cut. If the value is omitted, then clip will start from now. + start: Starting point of the segment to cut. + + Unix timestamp in seconds, absolute value. Example: + `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` + + If a value from the past is specified, it is used as the starting point for the + segment to cut. If the value is omitted, then clip will start from now. vod_required: Indicates if video needs to be stored also as permanent VOD @@ -587,11 +636,13 @@ def list_clips( You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs from "`hls_master`" and "`mp4_master`". - **How to download renditions of clips:** URLs contain "master" alias by default, - which means maximum available quality from ABR set (based on height metadata). - There is also possibility to access individual bitrates from ABR ladder. That - works for both HLS and MP4. You can replace manually "master" to a value from - renditions list in order to get exact bitrate/quality from the set. Example: + **How to download renditions of clips:** + + URLs contain "master" alias by default, which means maximum available quality + from ABR set (based on height metadata). There is also possibility to access + individual bitrates from ABR ladder. That works for both HLS and MP4. You can + replace manually "master" to a value from renditions list in order to get exact + bitrate/quality from the set. Example: - HLS 720p: `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.m3u8` @@ -648,12 +699,14 @@ def start_recording( - If you have access to the premium feature of saving the original stream (so not just transcoded renditions), then the link to the original file will be in the "`origin_url`" field. Look at the description of the field how to use it. - Stream must be live for the recording to start, please check fields "live" - and/or "`backup_live`". After the recording starts, field "recording" will - switch to "true", and the recording duration in seconds will appear in the - "`recording_duration`" field. Please, keep in mind that recording doesn't - start instantly, it takes ±3-7 seconds to initialize the process after - executing this method. + + Stream must be live for the recording to start, please check fields "live" + and/or "`backup_live`". After the recording starts, field "recording" will + switch to "true", and the recording duration in seconds will appear in the + "`recording_duration`" field. + + Please, keep in mind that recording doesn't start instantly, it takes ±3-7 + seconds to initialize the process after executing this method. Stream recording stops when: @@ -662,6 +715,7 @@ def start_recording( method again, the recording will be made to a new video file. - When sending the stream stops on the client side, or stops accidentally. In this case, recording process is waiting for 10 seconds to resume recording: + - If the stream resumes within that period, recording will continue to the same file. - After that period, the file will be completely saved and closed. @@ -780,22 +834,26 @@ async def create( The input in API may contain streams of different formats, including the most common ones RTMP, RTMPS, SRT, HLS. Note that multicast MPEG-TS over UDP and - others are supported too, ask the Support Team please. For ingestion, you can - use both PUSH and PULL methods. Also you can use the main and backup servers, - which are geographically located in different locations. By default, any free - ingest points in the world are used. Settings have been applied that deliver - low-latency streams in the optimal way. If for some reason you need to set a - fixed ingest point, or if you need to set the main and backup ingest points in - the same region (for example, do not send streams outside the EU or US), then - contact our Support Team. + others are supported too, ask the Support Team please. + + For ingestion, you can use both PUSH and PULL methods. + + Also you can use the main and backup servers, which are geographically located + in different locations. By default, any free ingest points in the world are + used. Settings have been applied that deliver low-latency streams in the optimal + way. If for some reason you need to set a fixed ingest point, or if you need to + set the main and backup ingest points in the same region (for example, do not + send streams outside the EU or US), then contact our Support Team. The output is HLS and MPEG-DASH with ABR. We transcode video for you by our cloud-based infrastructure. ABR ladder supports all qualities from SD to 8K HDR - 60fps. All our streams are Low Latency enabled. We support a delay of ±4 seconds - for video streams by utilizing Common Media Application Format (CMAF) - technology. So you obtain latency from the traditional 30-50 seconds to ±4 - seconds only by default. If you need legacy non-low-latency HLS, then look at - HLS MPEG-TS delivery below. + 60fps. + + All our streams are Low Latency enabled. We support a delay of ±4 seconds for + video streams by utilizing Common Media Application Format (CMAF) technology. So + you obtain latency from the traditional 30-50 seconds to ±4 seconds only by + default. If you need legacy non-low-latency HLS, then look at HLS MPEG-TS + delivery below. You have access to additional functions such as: @@ -808,11 +866,16 @@ async def create( For more information see specific API methods, and the Knowledge Base. To organize streaming with ultra-low latency, look for WebRTC delivery in different section in the Knowledge Base. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/low-latency-football.gif) Args: - name: Stream name. Often used as a human-readable name for the stream, but can contain - any text you wish. The values are not unique and may be repeated. Examples: + name: Stream name. + + Often used as a human-readable name for the stream, but can contain any text you + wish. The values are not unique and may be repeated. + + Examples: - Conference in July - Stream #10003 @@ -820,17 +883,21 @@ async def create( - 480fd499-2de2-4988-bc1a-a4eebe9818ee active: Stream switch between on and off. This is not an indicator of the status "stream - is receiving and it is LIVE", but rather an on/off switch. When stream is - switched off, there is no way to process it: PULL is deactivated and PUSH will - return an error. + is receiving and it is LIVE", but rather an on/off switch. + + When stream is switched off, there is no way to process it: PULL is deactivated + and PUSH will return an error. - true – stream can be processed - false – stream is off, and cannot be processed auto_record: Enables autotomatic recording of the stream when it started. So you don't need - to call recording manually. Result of recording is automatically added to video - hosting. For details see the /streams/`start_recording` method and in knowledge - base Values: + to call recording manually. + + Result of recording is automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base + + Values: - true – auto recording is enabled - false – auto recording is disabled @@ -850,9 +917,12 @@ async def create( field in any way when processing the stream. Example: `client_user_id = 1001` dvr_duration: DVR duration in seconds if DVR feature is enabled for the stream. So this is - duration of how far the user can rewind the live stream. `dvr_duration` range is - [30...14400]. Maximum value is 4 hours = 14400 seconds. If you need more, ask - the Support Team please. + duration of how far the user can rewind the live stream. + + `dvr_duration` range is [30...14400]. + + Maximum value is 4 hours = 14400 seconds. If you need more, ask the Support Team + please. dvr_enabled: Enables DVR for the stream: @@ -868,7 +938,9 @@ async def create( projection: Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, - then use parameters of that video player. Modes: + then use parameters of that video player. + + Modes: - regular – regular “flat” stream - vr360 – display stream in 360° mode @@ -888,23 +960,28 @@ async def create( your conditions. Look at GET /`quality_sets` method record_type: Method of recording a stream. Specifies the source from which the stream will be - recorded: original or transcoded. Types: + recorded: original or transcoded. + + Types: - "origin" – To record RMTP/SRT/etc original clean media source. - "transcoded" – To record the output transcoded version of the stream, including overlays, texts, logos, etc. additional media layers. - uri: When using PULL method, this is the URL to pull a stream from. You can specify - multiple addresses separated by a space (" "), so you can organize a backup - plan. In this case, the specified addresses will be selected one by one using - round robin scheduling. If the first address does not respond, then the next one - in the list will be automatically requested, returning to the first and so on in - a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + uri: When using PULL method, this is the URL to pull a stream from. + + You can specify multiple addresses separated by a space (" "), so you can + organize a backup plan. In this case, the specified addresses will be selected + one by one using round robin scheduling. If the first address does not respond, + then the next one in the list will be automatically requested, returning to the + first and so on in a circle. Also, if the sucessfully working stream stops + sending data, then the next one will be selected according to the same scheme. + + After 2 hours of inactivity of your original stream, the system stops PULL + requests and the stream is deactivated (the "active" field switches to "false"). + + Please, note that this field is for PULL only, so is not suitable for PUSH. Look + at fields "`push_url`" and "`push_url_srt`" from GET method. extra_headers: Send extra headers @@ -1040,11 +1117,14 @@ async def delete( Delete a live stream. After deleting the live stream, all associated data is deleted: settings, PUSH - and PULL links, video playback links, etc. Live stream information is deleted - permanently and irreversibly. Therefore, it is impossible to restore data and - files after this. But if the live had recordings, they continue to remain - independent Video entities. The "`stream_id`" parameter will simply point to a - stream that no longer exists. + and PULL links, video playback links, etc. + + Live stream information is deleted permanently and irreversibly. Therefore, it + is impossible to restore data and files after this. + + But if the live had recordings, they continue to remain independent Video + entities. The "`stream_id`" parameter will simply point to a stream that no + longer exists. Perhaps, instead of deleting, you may use the stream deactivation: @@ -1120,24 +1200,29 @@ async def create_clip( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Clip: - """Create an instant clip from on-going live stream. + """ + Create an instant clip from on-going live stream. - Instant clips are applicable - in cases where there is no time to wait for the broadcast to be completed and - recorded. For example, for quickly cutting highlights in sport events, or - cutting an important moment in the news or live performance. + Instant clips are applicable in cases where there is no time to wait for the + broadcast to be completed and recorded. For example, for quickly cutting + highlights in sport events, or cutting an important moment in the news or live + performance. Instant clip becomes available for viewing in the following formats: - HLS .m3u8, - MP4, - VOD in video hosting with a permanent link to watch video. - ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) - **Clip lifetime:** Instant clips are a copy of the stream, created from a live - stream. They are stored in memory for a limited time, after which the clip - ceases to exist and you will receive a 404 on the link. Limits that you should - keep in mind: + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) + + **Clip lifetime:** + + Instant clips are a copy of the stream, created from a live stream. They are + stored in memory for a limited time, after which the clip ceases to exist and + you will receive a 404 on the link. + + Limits that you should keep in mind: - The clip's lifespan is controlled by `expiration` parameter. - The default expiration value is 1 hour. The value can be set from 1 minute to @@ -1151,9 +1236,10 @@ async def create_clip( you try to request it before this time, the response will be error code 425 "Too Early". - **Cutting a clip from a source:** In order to use clips recording feature, DVR - must be enabled for a stream: "`dvr_enabled`: true". The DVR serves as a source - for creating clips: + **Cutting a clip from a source:** + + In order to use clips recording feature, DVR must be enabled for a stream: + "`dvr_enabled`: true". The DVR serves as a source for creating clips: - By default live stream DVR is set to 1 hour (3600 seconds). You can create an instant clip using any segment of this time period by specifying the desired @@ -1161,39 +1247,56 @@ async def create_clip( - If you create a clip, but the DVR expires, the clip will still exist for the specified time as a copy of the stream. - **Getting permanent VOD:** To get permanent VOD version of a live clip use this - parameter when making a request to create a clip: `vod_required: true`. Later, - when the clip is ready, grab `video_id` value from the response and query the - video by regular GET /video/{id} method. + **Getting permanent VOD:** + + To get permanent VOD version of a live clip use this parameter when making a + request to create a clip: `vod_required: true`. + + Later, when the clip is ready, grab `video_id` value from the response and query + the video by regular GET /video/{id} method. Args: - duration: Requested segment duration in seconds to be cut. Please, note that cutting is - based on the idea of instantly creating a clip, instead of precise timing. So - final segment may be: + duration: Requested segment duration in seconds to be cut. + + Please, note that cutting is based on the idea of instantly creating a clip, + instead of precise timing. So final segment may be: - Less than the specified value if there is less data in the DVR than the requested segment. - Greater than the specified value, because segment is aligned to the first and last key frames of already stored fragment in DVR, this way -1 and +1 chunks - can be added to left and right. Duration of cutted segment cannot be greater - than DVR duration for this stream. Therefore, to change the maximum, use - "`dvr_duration`" parameter of this stream. - - expiration: Expire time of the clip via a public link. Unix timestamp in seconds, absolute - value. This is the time how long the instant clip will be stored in the server - memory and can be accessed via public HLS/MP4 links. Download and/or use the - instant clip before this time expires. After the time has expired, the clip is - deleted from memory and is no longer available via the link. You need to create - a new segment, or use `vod_required: true` attribute. If value is omitted, then - expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. - `unix timestamp = + + 3600`). Allowed range: 1m <= expiration - <= 4h. Example: + can be added to left and right. + + Duration of cutted segment cannot be greater than DVR duration for this stream. + Therefore, to change the maximum, use "`dvr_duration`" parameter of this stream. + + expiration: Expire time of the clip via a public link. + + Unix timestamp in seconds, absolute value. + + This is the time how long the instant clip will be stored in the server memory + and can be accessed via public HLS/MP4 links. Download and/or use the instant + clip before this time expires. + + After the time has expired, the clip is deleted from memory and is no longer + available via the link. You need to create a new segment, or use + `vod_required: true` attribute. + + If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the + end of the clip (i.e. `unix timestamp = + + 3600`). + + Allowed range: 1m <= expiration <= 4h. + + Example: `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` - start: Starting point of the segment to cut. Unix timestamp in seconds, absolute value. - Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value - from the past is specified, it is used as the starting point for the segment to - cut. If the value is omitted, then clip will start from now. + start: Starting point of the segment to cut. + + Unix timestamp in seconds, absolute value. Example: + `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` + + If a value from the past is specified, it is used as the starting point for the + segment to cut. If the value is omitted, then clip will start from now. vod_required: Indicates if video needs to be stored also as permanent VOD @@ -1270,11 +1373,13 @@ async def list_clips( You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs from "`hls_master`" and "`mp4_master`". - **How to download renditions of clips:** URLs contain "master" alias by default, - which means maximum available quality from ABR set (based on height metadata). - There is also possibility to access individual bitrates from ABR ladder. That - works for both HLS and MP4. You can replace manually "master" to a value from - renditions list in order to get exact bitrate/quality from the set. Example: + **How to download renditions of clips:** + + URLs contain "master" alias by default, which means maximum available quality + from ABR set (based on height metadata). There is also possibility to access + individual bitrates from ABR ladder. That works for both HLS and MP4. You can + replace manually "master" to a value from renditions list in order to get exact + bitrate/quality from the set. Example: - HLS 720p: `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.m3u8` @@ -1331,12 +1436,14 @@ async def start_recording( - If you have access to the premium feature of saving the original stream (so not just transcoded renditions), then the link to the original file will be in the "`origin_url`" field. Look at the description of the field how to use it. - Stream must be live for the recording to start, please check fields "live" - and/or "`backup_live`". After the recording starts, field "recording" will - switch to "true", and the recording duration in seconds will appear in the - "`recording_duration`" field. Please, keep in mind that recording doesn't - start instantly, it takes ±3-7 seconds to initialize the process after - executing this method. + + Stream must be live for the recording to start, please check fields "live" + and/or "`backup_live`". After the recording starts, field "recording" will + switch to "true", and the recording duration in seconds will appear in the + "`recording_duration`" field. + + Please, keep in mind that recording doesn't start instantly, it takes ±3-7 + seconds to initialize the process after executing this method. Stream recording stops when: @@ -1345,6 +1452,7 @@ async def start_recording( method again, the recording will be made to a new video file. - When sending the stream stops on the client side, or stops accidentally. In this case, recording process is waiting for 10 seconds to resume recording: + - If the stream resumes within that period, recording will continue to the same file. - After that period, the file will be completely saved and closed. diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 08123c15..5930fd58 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -58,8 +58,9 @@ def create( """ Add new subtitle/captions to a video entity. - **Add already exist subtitles** Subtitles must be in one of the following - formats: + **Add already exist subtitles** + + Subtitles must be in one of the following formats: - SRT – SubRip Text is described on [wikipedia.org](https://en.wikipedia.org/wiki/SubRip#SubRip_file_format). Must @@ -69,19 +70,26 @@ def create( - WebVTT – Web Video Text Tracks Format is described on [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API). Must start from "WEBVTT" header. Use validators to check the subtitles, like - [W3C](https://w3c.github.io/webvtt.js/parser.html). Language is 3-letter - language code according to ISO-639-2 (bibliographic code). Specify language - you need, or just look at our list in the attribute "`audio_language`" of - section - ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). - You can add multiple subtitles in the same language, language uniqueness is - not required. Size must be up to 5Mb. + [W3C](https://w3c.github.io/webvtt.js/parser.html). + + Language is 3-letter language code according to ISO-639-2 (bibliographic code). + Specify language you need, or just look at our list in the attribute + "`audio_language`" of section + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). + + You can add multiple subtitles in the same language, language uniqueness is not + required. + + Size must be up to 5Mb. The update time for added or changed subtitles is up to 30 seconds. Just like videos, subtitles are cached, so it takes time to update the data. - **AI subtitles and transcribing** It is also possible to automatically create - subtitles based on AI. Read more: + **AI subtitles and transcribing** + + It is also possible to automatically create subtitles based on AI. + + Read more: - What is ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). @@ -95,14 +103,20 @@ def create( that. Also you can point several languages to translate to, then a separate subtitle will be generated for each specified language. The created AI-task(s) will be automatically executed, and result will also be automatically attached - to this video as subtitle(s). If AI is disabled in your account, you will - receive code 422 in response. + to this video as subtitle(s). - **Where and how subtitles are displayed?** Subtitles are became available in the - API response and in playback manifests. All added subtitles are automatically - inserted into the output manifest .m3u8. This way, subtitles become available to - any player: our player, OS built-in, or other specialized ones. You don't need - to do anything else. Read more information in the Knowledge Base. Example: + If AI is disabled in your account, you will receive code 422 in response. + + **Where and how subtitles are displayed?** + + Subtitles are became available in the API response and in playback manifests. + + All added subtitles are automatically inserted into the output manifest .m3u8. + This way, subtitles become available to any player: our player, OS built-in, or + other specialized ones. You don't need to do anything else. Read more + information in the Knowledge Base. + + Example: ``` # EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs0",NAME="English",LANGUAGE="en",AUTOSELECT=YES,URI="subs-0.m3u8" @@ -143,16 +157,20 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SubtitleBase: - """Method to update subtitle of a video. + """ + Method to update subtitle of a video. + + You can update all or only some of fields you need. - You can update all or only some of fields - you need. If you want to replace the text of subtitles (i.e. found a typo in the - text, or the timing in the video changed), then: + If you want to replace the text of subtitles (i.e. found a typo in the text, or + the timing in the video changed), then: - download it using GET method, - change it in an external editor, - - and update it using this PATCH method. Just like videos, subtitles are cached, - so it takes time to update the data. See POST method for details. + - and update it using this PATCH method. + + Just like videos, subtitles are cached, so it takes time to update the data. See + POST method for details. Args: language: 3-letter language code according to ISO-639-2 (bibliographic code) @@ -317,8 +335,9 @@ async def create( """ Add new subtitle/captions to a video entity. - **Add already exist subtitles** Subtitles must be in one of the following - formats: + **Add already exist subtitles** + + Subtitles must be in one of the following formats: - SRT – SubRip Text is described on [wikipedia.org](https://en.wikipedia.org/wiki/SubRip#SubRip_file_format). Must @@ -328,19 +347,26 @@ async def create( - WebVTT – Web Video Text Tracks Format is described on [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API). Must start from "WEBVTT" header. Use validators to check the subtitles, like - [W3C](https://w3c.github.io/webvtt.js/parser.html). Language is 3-letter - language code according to ISO-639-2 (bibliographic code). Specify language - you need, or just look at our list in the attribute "`audio_language`" of - section - ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). - You can add multiple subtitles in the same language, language uniqueness is - not required. Size must be up to 5Mb. + [W3C](https://w3c.github.io/webvtt.js/parser.html). + + Language is 3-letter language code according to ISO-639-2 (bibliographic code). + Specify language you need, or just look at our list in the attribute + "`audio_language`" of section + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). + + You can add multiple subtitles in the same language, language uniqueness is not + required. + + Size must be up to 5Mb. The update time for added or changed subtitles is up to 30 seconds. Just like videos, subtitles are cached, so it takes time to update the data. - **AI subtitles and transcribing** It is also possible to automatically create - subtitles based on AI. Read more: + **AI subtitles and transcribing** + + It is also possible to automatically create subtitles based on AI. + + Read more: - What is ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). @@ -354,14 +380,20 @@ async def create( that. Also you can point several languages to translate to, then a separate subtitle will be generated for each specified language. The created AI-task(s) will be automatically executed, and result will also be automatically attached - to this video as subtitle(s). If AI is disabled in your account, you will - receive code 422 in response. + to this video as subtitle(s). - **Where and how subtitles are displayed?** Subtitles are became available in the - API response and in playback manifests. All added subtitles are automatically - inserted into the output manifest .m3u8. This way, subtitles become available to - any player: our player, OS built-in, or other specialized ones. You don't need - to do anything else. Read more information in the Knowledge Base. Example: + If AI is disabled in your account, you will receive code 422 in response. + + **Where and how subtitles are displayed?** + + Subtitles are became available in the API response and in playback manifests. + + All added subtitles are automatically inserted into the output manifest .m3u8. + This way, subtitles become available to any player: our player, OS built-in, or + other specialized ones. You don't need to do anything else. Read more + information in the Knowledge Base. + + Example: ``` # EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs0",NAME="English",LANGUAGE="en",AUTOSELECT=YES,URI="subs-0.m3u8" @@ -402,16 +434,20 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SubtitleBase: - """Method to update subtitle of a video. + """ + Method to update subtitle of a video. + + You can update all or only some of fields you need. - You can update all or only some of fields - you need. If you want to replace the text of subtitles (i.e. found a typo in the - text, or the timing in the video changed), then: + If you want to replace the text of subtitles (i.e. found a typo in the text, or + the timing in the video changed), then: - download it using GET method, - change it in an external editor, - - and update it using this PATCH method. Just like videos, subtitles are cached, - so it takes time to update the data. See POST method for details. + - and update it using this PATCH method. + + Just like videos, subtitles are cached, so it takes time to update the data. See + POST method for details. Args: language: 3-letter language code according to ISO-639-2 (bibliographic code) diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index 0b306117..256d7d6f 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -81,8 +81,10 @@ def create( """ Use this method to create a new video entity. - **Methods of creating** To upload the original video file to the server, there - are several possible scenarios: + **Methods of creating** + + To upload the original video file to the server, there are several possible + scenarios: - **Copy from another server** – If your video is accessable via "http://", "https://", or "sftp://" public link, then you can use this method to copy a @@ -91,20 +93,26 @@ def create( execution file will be uploaded and will be sent to transcoding automatically, you don't have to do anything else. Use extra field `origin_http_headers` if authorization is required on the external server. + - **Direct upload from a local device** – If you need to upload video directly from your local device or from a mobile app, then use this method. Keep `origin_url` empty and use TUS protocol ([tus.io](https://tus.io)) to upload file. More details are here ["Get TUS' upload"](/docs/api-reference/streaming/videos/get-tus-parameters-for-direct-upload) - After getting the video, it is processed through the queue. There are 2 - priority criteria: global and local. Global is determined automatically by the - system as converters are ready to get next video, so your videos rarely queue - longer than usual (when you don't have a dedicated region). Local priority - works at the level of your account and you have full control over it, look at - "priority" attribute. - **AI processing** When uploading a video, it is possible to automatically create - subtitles based on AI. Read more: + After getting the video, it is processed through the queue. There are 2 priority + criteria: global and local. Global is determined automatically by the system as + converters are ready to get next video, so your videos rarely queue longer than + usual (when you don't have a dedicated region). Local priority works at the + level of your account and you have full control over it, look at "priority" + attribute. + + **AI processing** + + When uploading a video, it is possible to automatically create subtitles based + on AI. + + Read more: - What is ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). @@ -119,21 +127,26 @@ def create( subtitle will be generated for each specified language. - How to ["add AI-generated subtitles to an exist video"](/docs/api-reference/streaming/subtitles/add-subtitle). - The created AI-task(s) will be automatically executed, and result will also be - automatically attached to this video as subtitle(s). Please note that - transcription is done automatically for all videos uploaded to our video - hosting. If necessary, you can disable automatic creation of subtitles. If AI - is disabled in your account, no AI functionality is called. - - **Advanced Features** For details on the requirements for incoming original - files, and output video parameters after transcoding, refer to the Knowledge - Base documentation. By default video will be transcoded according to the - original resolution, and a quality ladder suitable for your original video will - be applied. There is no automatic upscaling; the maximum quality is taken from - the original video. If you want to upload specific files not explicitly listed - in requirements or wish to modify the standard quality ladder (i.e. decrease - quality or add new non-standard qualities), then such customization is possible. - Please reach out to us for assistance. + + The created AI-task(s) will be automatically executed, and result will also be + automatically attached to this video as subtitle(s). + + Please note that transcription is done automatically for all videos uploaded to + our video hosting. If necessary, you can disable automatic creation of + subtitles. If AI is disabled in your account, no AI functionality is called. + + **Advanced Features** + + For details on the requirements for incoming original files, and output video + parameters after transcoding, refer to the Knowledge Base documentation. By + default video will be transcoded according to the original resolution, and a + quality ladder suitable for your original video will be applied. There is no + automatic upscaling; the maximum quality is taken from the original video. + + If you want to upload specific files not explicitly listed in requirements or + wish to modify the standard quality ladder (i.e. decrease quality or add new + non-standard qualities), then such customization is possible. Please reach out + to us for assistance. Additionally, check the Knowledge Base for any supplementary information you may need. @@ -187,26 +200,30 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: - """Changes parameters of the video to new values. + """ + Changes parameters of the video to new values. - It's allowed to update only those - public parameters that are described in POST method to create a new “video” - entity. So it's not possible to change calculated parameters like "id", - "duration", "`hls_url`", etc. Examples of changing: + It's allowed to update only those public parameters that are described in POST + method to create a new “video” entity. So it's not possible to change calculated + parameters like "id", "duration", "`hls_url`", etc. + + Examples of changing: - Name: `{ "name": "new name of the video" }` - - Move the video to a new directory: ` { "directory_id": 200 }` Please note that - some parameters are used on initial step (before transcoding) only, so after - transcoding there is no use in changing their values. For example, - "`origin_url`" parameter is used for downloading an original file from a - source and never used after transcoding; or "priority" parameter is used to - set priority of processing and never used after transcoding. + - Move the video to a new directory: ` { "directory_id": 200 }` + + Please note that some parameters are used on initial step (before transcoding) + only, so after transcoding there is no use in changing their values. For + example, "`origin_url`" parameter is used for downloading an original file from + a source and never used after transcoding; or "priority" parameter is used to + set priority of processing and never used after transcoding. Args: name: Video name - auto_transcribe_audio_language: - Automatic creation of subtitles by transcribing the audio track. Values: + auto_transcribe_audio_language: Automatic creation of subtitles by transcribing the audio track. + + Values: - disable – Do not transcribe. - auto – Automatically detects the activation of the option based on the @@ -216,7 +233,9 @@ def update( language spoken in the audio track, or when auto language detection fails. Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). List of languages is available in `audio_language` - attribute of API POST /streaming/ai/transcribe . Example: + attribute of API POST /streaming/ai/transcribe . + + Example: ``` auto_transcribe_audio_language: "auto" @@ -232,15 +251,23 @@ def update( auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified language(s). Can be used both together with `auto_transcribe_audio_language` - option only. Use it when you want to make automatic subtitles in languages other - than the original language in audio. Values: + option only. + + Use it when you want to make automatic subtitles in languages other than the + original language in audio. + + Values: - disable – Do not translate. - default – There are 3 default languages: eng,fre,ger - \\ – Explicit language to translate to, or list of languages separated by a comma. Look at list of available languages in description of AI ASR task - creation. If several languages are specified for translation, a separate - subtitle will be generated for each language. Example: + creation. + + If several languages are specified for translation, a separate subtitle will be + generated for each language. + + Example: ``` auto_translate_subtitles_language: default @@ -260,8 +287,10 @@ def update( length if the video, then you can provide timecodes of starting point and duration of a segment to process. Start encoding from is a number in seconds. - custom_iframe_url: Deprecated. Custom URL of IFrame for video player to be used in share panel in - player. Auto generated IFrame URL provided by default + custom_iframe_url: Deprecated. + + Custom URL of IFrame for video player to be used in share panel in player. Auto + generated IFrame URL provided by default description: Video details; not visible to the end-users @@ -269,8 +298,11 @@ def update( origin_http_headers: Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file (specified in "`origin_url`" parameter) on an - external server. Syntax: - `Authorization: ` Examples: + external server. + + Syntax: `Authorization: ` + + Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -292,14 +324,20 @@ def update( transcoding. poster: Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own image. Also use attribute "`screenshot_id`" to select poster as a default - screnshot. Attribute accepts single image as base64-encoded string + screnshot. + + Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, - image/webp, and image/png and file sizes up to 1Mb. Examples: + format: `data:[];base64,` + + MIME-types are image/jpeg, image/webp, and image/png and file sizes up to 1Mb. + + Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` @@ -307,12 +345,14 @@ def update( priority: Priority allows you to adjust the urgency of processing some videos before others in your account, if your algorithm requires it. For example, when there - are very urgent video and some regular ones that can wait in the queue. Value - range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest - up-priority. Default priority is 0. + are very urgent video and some regular ones that can wait in the queue. + + Value range, integer [-10..10]. -10 is the lowest down-priority, 10 is the + highest up-priority. Default priority is 0. + + projection: Deprecated. - projection: - Deprecated. Regulates the video format: + Regulates the video format: - **regular** — plays the video as usual - **vr360** — plays the video in 360 degree mode @@ -325,21 +365,29 @@ def update( your conditions. Look at GET /`quality_sets` method remote_poster_url: Poster URL to download from external resource, instead of uploading via "poster" - attribute. It has the same restrictions as "poster" attribute. + attribute. + + It has the same restrictions as "poster" attribute. remove_poster: Set it to true to remove poster - screenshot_id: Default screenshot index. Specify an ID from the "screenshots" array, so that - the URL of the required screenshot appears in the "screenshot" attribute as the - default screenshot. By default 5 static screenshots will be taken from different - places in the video after transcoding. If the video is short, there may be fewer - screenshots. Counting from 0. A value of -1 sets the default screenshot to the - URL of your own image from the "poster" attribute. Look at "screenshot" - attribute in GET /videos/{`video_id`} for details. + screenshot_id: Default screenshot index. + + Specify an ID from the "screenshots" array, so that the URL of the required + screenshot appears in the "screenshot" attribute as the default screenshot. By + default 5 static screenshots will be taken from different places in the video + after transcoding. If the video is short, there may be fewer screenshots. + + Counting from 0. A value of -1 sets the default screenshot to the URL of your + own image from the "poster" attribute. + + Look at "screenshot" attribute in GET /videos/{`video_id`} for details. + + share_url: Deprecated. - share_url: Deprecated. Custom URL or iframe displayed in the link field when a user clicks - on a sharing button in player. If empty, the link field and social network - sharing is disabled + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled source_bitrate_limit: The option allows you to set the video transcoding rule so that the output bitrate in ABR ladder is not exceeding the bitrate of the original video. @@ -349,18 +397,21 @@ def update( By default `source_bitrate_limit: true` this option allows you to have the output bitrate not more than in the original video, thus to transcode video faster and to deliver it to end-viewers faster as well. At the same time, the - quality will be similar to the original. If for some reason you need more - byte-space in the output quality when encoding, you can set this option to - `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will - be raised from the bitrate of the original video to the maximum possible limit - specified in our the Product Documentation. For example, this may be needed - when: + quality will be similar to the original. + + If for some reason you need more byte-space in the output quality when encoding, + you can set this option to `source_bitrate_limit: false`. Then, when + transcoding, the quality ceiling will be raised from the bitrate of the original + video to the maximum possible limit specified in our the Product Documentation. + For example, this may be needed when: - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, - to improve the picture quality on dynamic scenes, - - etc. The option is applied only at the video creation stage and cannot be - changed later. If you want to re-transcode the video using new value, then you - need to create and upload a new video only. + - etc. + + The option is applied only at the video creation stage and cannot be changed + later. If you want to re-transcode the video using new value, then you need to + create and upload a new video only. extra_headers: Send extra headers @@ -443,8 +494,10 @@ def list( search: Aggregated search condition. If set, the video list is filtered by one combined SQL criterion: - - id={s} OR slug={s} OR name like {s} i.e. "/videos?search=1000" returns list of - videos where id=1000 or slug=1000 or name contains "1000". + - id={s} OR slug={s} OR name like {s} + + i.e. "/videos?search=1000" returns list of videos where id=1000 or slug=1000 or + name contains "1000". status: Use it to get videos filtered by their status. Possible values: @@ -507,8 +560,10 @@ def delete( When you delete a video, all transcoded qualities and all associated files such as subtitles and screenshots, as well as other data, are deleted from cloud - storage. The video is deleted permanently and irreversibly. Therefore, it is - impossible to restore files after this. + storage. + + The video is deleted permanently and irreversibly. Therefore, it is impossible + to restore files after this. For detailed information and information on calculating your maximum monthly storage usage, please refer to the Product Documentation. @@ -553,6 +608,7 @@ def create_multiple( All videos in the request will be processed in queue in order of priority. Use "priority" attribute and look at general description in POST /videos method. + Limits: - Batch max size = 500 videos. @@ -598,11 +654,13 @@ def get( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: - """Information about a video entity. + """ + Information about a video entity. - Contains all the data about the video: - meta-data, data for streaming and renditions, static media data, data about - original video. You can use different methods to play video: + Contains all the data about the video: meta-data, data for streaming and + renditions, static media data, data about original video. + + You can use different methods to play video: - `iframe_url` – a URL to a built-in HTML video player with automatically configured video playback. @@ -613,7 +671,8 @@ def get( - `dash_url` – a URL to MPEG-DASH .mpd manifest, which can be played in most modern video players. Preferable for Android and Windows devices. - `converted_videos`/`mp4_url` – a URL to MP4 file of specific rendition. - ![Video player](https://demo-files.gvideo.io/apidocs/coffee-run-player.jpg) + + ![Video player](https://demo-files.gvideo.io/apidocs/coffee-run-player.jpg) Args: extra_headers: Send extra headers @@ -645,19 +704,23 @@ def get_parameters_for_direct_upload( ) -> DirectUploadParameters: """ Use this method to get TUS' session parameters: hostname of the server to - upload, secure token. The general sequence of actions for a direct upload of a - video is as follows: + upload, secure token. + + The general sequence of actions for a direct upload of a video is as follows: - Create video entity via POST method ["Create video"](/docs/api-reference/streaming/videos/create-video) - Get TUS' session parameters (you are here now) - Upload file via TUS client, choose your implementation on - [tus.io](https://tus.io/implementations) Final endpoint for uploading is - constructed using the following template: "https://{hostname}/upload/". Also - you have to provide token, `client_id`, `video_id` as metadata too. A short - javascript example is shown below, based on tus-js-client. Variable "data" - below is the result of this API request. Please, note that we support 2.x - version only of tus-js-client. + [tus.io](https://tus.io/implementations) + + Final endpoint for uploading is constructed using the following template: + "https://{hostname}/upload/". Also you have to provide token, `client_id`, + `video_id` as metadata too. + + A short javascript example is shown below, based on tus-js-client. Variable + "data" below is the result of this API request. Please, note that we support 2.x + version only of tus-js-client. ``` uploads[data.video.id] = new tus.Upload(file, { @@ -769,8 +832,10 @@ async def create( """ Use this method to create a new video entity. - **Methods of creating** To upload the original video file to the server, there - are several possible scenarios: + **Methods of creating** + + To upload the original video file to the server, there are several possible + scenarios: - **Copy from another server** – If your video is accessable via "http://", "https://", or "sftp://" public link, then you can use this method to copy a @@ -779,20 +844,26 @@ async def create( execution file will be uploaded and will be sent to transcoding automatically, you don't have to do anything else. Use extra field `origin_http_headers` if authorization is required on the external server. + - **Direct upload from a local device** – If you need to upload video directly from your local device or from a mobile app, then use this method. Keep `origin_url` empty and use TUS protocol ([tus.io](https://tus.io)) to upload file. More details are here ["Get TUS' upload"](/docs/api-reference/streaming/videos/get-tus-parameters-for-direct-upload) - After getting the video, it is processed through the queue. There are 2 - priority criteria: global and local. Global is determined automatically by the - system as converters are ready to get next video, so your videos rarely queue - longer than usual (when you don't have a dedicated region). Local priority - works at the level of your account and you have full control over it, look at - "priority" attribute. - **AI processing** When uploading a video, it is possible to automatically create - subtitles based on AI. Read more: + After getting the video, it is processed through the queue. There are 2 priority + criteria: global and local. Global is determined automatically by the system as + converters are ready to get next video, so your videos rarely queue longer than + usual (when you don't have a dedicated region). Local priority works at the + level of your account and you have full control over it, look at "priority" + attribute. + + **AI processing** + + When uploading a video, it is possible to automatically create subtitles based + on AI. + + Read more: - What is ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). @@ -807,21 +878,26 @@ async def create( subtitle will be generated for each specified language. - How to ["add AI-generated subtitles to an exist video"](/docs/api-reference/streaming/subtitles/add-subtitle). - The created AI-task(s) will be automatically executed, and result will also be - automatically attached to this video as subtitle(s). Please note that - transcription is done automatically for all videos uploaded to our video - hosting. If necessary, you can disable automatic creation of subtitles. If AI - is disabled in your account, no AI functionality is called. - - **Advanced Features** For details on the requirements for incoming original - files, and output video parameters after transcoding, refer to the Knowledge - Base documentation. By default video will be transcoded according to the - original resolution, and a quality ladder suitable for your original video will - be applied. There is no automatic upscaling; the maximum quality is taken from - the original video. If you want to upload specific files not explicitly listed - in requirements or wish to modify the standard quality ladder (i.e. decrease - quality or add new non-standard qualities), then such customization is possible. - Please reach out to us for assistance. + + The created AI-task(s) will be automatically executed, and result will also be + automatically attached to this video as subtitle(s). + + Please note that transcription is done automatically for all videos uploaded to + our video hosting. If necessary, you can disable automatic creation of + subtitles. If AI is disabled in your account, no AI functionality is called. + + **Advanced Features** + + For details on the requirements for incoming original files, and output video + parameters after transcoding, refer to the Knowledge Base documentation. By + default video will be transcoded according to the original resolution, and a + quality ladder suitable for your original video will be applied. There is no + automatic upscaling; the maximum quality is taken from the original video. + + If you want to upload specific files not explicitly listed in requirements or + wish to modify the standard quality ladder (i.e. decrease quality or add new + non-standard qualities), then such customization is possible. Please reach out + to us for assistance. Additionally, check the Knowledge Base for any supplementary information you may need. @@ -875,26 +951,30 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: - """Changes parameters of the video to new values. + """ + Changes parameters of the video to new values. - It's allowed to update only those - public parameters that are described in POST method to create a new “video” - entity. So it's not possible to change calculated parameters like "id", - "duration", "`hls_url`", etc. Examples of changing: + It's allowed to update only those public parameters that are described in POST + method to create a new “video” entity. So it's not possible to change calculated + parameters like "id", "duration", "`hls_url`", etc. + + Examples of changing: - Name: `{ "name": "new name of the video" }` - - Move the video to a new directory: ` { "directory_id": 200 }` Please note that - some parameters are used on initial step (before transcoding) only, so after - transcoding there is no use in changing their values. For example, - "`origin_url`" parameter is used for downloading an original file from a - source and never used after transcoding; or "priority" parameter is used to - set priority of processing and never used after transcoding. + - Move the video to a new directory: ` { "directory_id": 200 }` + + Please note that some parameters are used on initial step (before transcoding) + only, so after transcoding there is no use in changing their values. For + example, "`origin_url`" parameter is used for downloading an original file from + a source and never used after transcoding; or "priority" parameter is used to + set priority of processing and never used after transcoding. Args: name: Video name - auto_transcribe_audio_language: - Automatic creation of subtitles by transcribing the audio track. Values: + auto_transcribe_audio_language: Automatic creation of subtitles by transcribing the audio track. + + Values: - disable – Do not transcribe. - auto – Automatically detects the activation of the option based on the @@ -904,7 +984,9 @@ async def update( language spoken in the audio track, or when auto language detection fails. Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). List of languages is available in `audio_language` - attribute of API POST /streaming/ai/transcribe . Example: + attribute of API POST /streaming/ai/transcribe . + + Example: ``` auto_transcribe_audio_language: "auto" @@ -920,15 +1002,23 @@ async def update( auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified language(s). Can be used both together with `auto_transcribe_audio_language` - option only. Use it when you want to make automatic subtitles in languages other - than the original language in audio. Values: + option only. + + Use it when you want to make automatic subtitles in languages other than the + original language in audio. + + Values: - disable – Do not translate. - default – There are 3 default languages: eng,fre,ger - \\ – Explicit language to translate to, or list of languages separated by a comma. Look at list of available languages in description of AI ASR task - creation. If several languages are specified for translation, a separate - subtitle will be generated for each language. Example: + creation. + + If several languages are specified for translation, a separate subtitle will be + generated for each language. + + Example: ``` auto_translate_subtitles_language: default @@ -948,8 +1038,10 @@ async def update( length if the video, then you can provide timecodes of starting point and duration of a segment to process. Start encoding from is a number in seconds. - custom_iframe_url: Deprecated. Custom URL of IFrame for video player to be used in share panel in - player. Auto generated IFrame URL provided by default + custom_iframe_url: Deprecated. + + Custom URL of IFrame for video player to be used in share panel in player. Auto + generated IFrame URL provided by default description: Video details; not visible to the end-users @@ -957,8 +1049,11 @@ async def update( origin_http_headers: Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file (specified in "`origin_url`" parameter) on an - external server. Syntax: - `Authorization: ` Examples: + external server. + + Syntax: `Authorization: ` + + Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -980,14 +1075,20 @@ async def update( transcoding. poster: Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own image. Also use attribute "`screenshot_id`" to select poster as a default - screnshot. Attribute accepts single image as base64-encoded string + screnshot. + + Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, - image/webp, and image/png and file sizes up to 1Mb. Examples: + format: `data:[];base64,` + + MIME-types are image/jpeg, image/webp, and image/png and file sizes up to 1Mb. + + Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` @@ -995,12 +1096,14 @@ async def update( priority: Priority allows you to adjust the urgency of processing some videos before others in your account, if your algorithm requires it. For example, when there - are very urgent video and some regular ones that can wait in the queue. Value - range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest - up-priority. Default priority is 0. + are very urgent video and some regular ones that can wait in the queue. + + Value range, integer [-10..10]. -10 is the lowest down-priority, 10 is the + highest up-priority. Default priority is 0. + + projection: Deprecated. - projection: - Deprecated. Regulates the video format: + Regulates the video format: - **regular** — plays the video as usual - **vr360** — plays the video in 360 degree mode @@ -1013,21 +1116,29 @@ async def update( your conditions. Look at GET /`quality_sets` method remote_poster_url: Poster URL to download from external resource, instead of uploading via "poster" - attribute. It has the same restrictions as "poster" attribute. + attribute. + + It has the same restrictions as "poster" attribute. remove_poster: Set it to true to remove poster - screenshot_id: Default screenshot index. Specify an ID from the "screenshots" array, so that - the URL of the required screenshot appears in the "screenshot" attribute as the - default screenshot. By default 5 static screenshots will be taken from different - places in the video after transcoding. If the video is short, there may be fewer - screenshots. Counting from 0. A value of -1 sets the default screenshot to the - URL of your own image from the "poster" attribute. Look at "screenshot" - attribute in GET /videos/{`video_id`} for details. + screenshot_id: Default screenshot index. + + Specify an ID from the "screenshots" array, so that the URL of the required + screenshot appears in the "screenshot" attribute as the default screenshot. By + default 5 static screenshots will be taken from different places in the video + after transcoding. If the video is short, there may be fewer screenshots. + + Counting from 0. A value of -1 sets the default screenshot to the URL of your + own image from the "poster" attribute. + + Look at "screenshot" attribute in GET /videos/{`video_id`} for details. + + share_url: Deprecated. - share_url: Deprecated. Custom URL or iframe displayed in the link field when a user clicks - on a sharing button in player. If empty, the link field and social network - sharing is disabled + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled source_bitrate_limit: The option allows you to set the video transcoding rule so that the output bitrate in ABR ladder is not exceeding the bitrate of the original video. @@ -1037,18 +1148,21 @@ async def update( By default `source_bitrate_limit: true` this option allows you to have the output bitrate not more than in the original video, thus to transcode video faster and to deliver it to end-viewers faster as well. At the same time, the - quality will be similar to the original. If for some reason you need more - byte-space in the output quality when encoding, you can set this option to - `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will - be raised from the bitrate of the original video to the maximum possible limit - specified in our the Product Documentation. For example, this may be needed - when: + quality will be similar to the original. + + If for some reason you need more byte-space in the output quality when encoding, + you can set this option to `source_bitrate_limit: false`. Then, when + transcoding, the quality ceiling will be raised from the bitrate of the original + video to the maximum possible limit specified in our the Product Documentation. + For example, this may be needed when: - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, - to improve the picture quality on dynamic scenes, - - etc. The option is applied only at the video creation stage and cannot be - changed later. If you want to re-transcode the video using new value, then you - need to create and upload a new video only. + - etc. + + The option is applied only at the video creation stage and cannot be changed + later. If you want to re-transcode the video using new value, then you need to + create and upload a new video only. extra_headers: Send extra headers @@ -1131,8 +1245,10 @@ def list( search: Aggregated search condition. If set, the video list is filtered by one combined SQL criterion: - - id={s} OR slug={s} OR name like {s} i.e. "/videos?search=1000" returns list of - videos where id=1000 or slug=1000 or name contains "1000". + - id={s} OR slug={s} OR name like {s} + + i.e. "/videos?search=1000" returns list of videos where id=1000 or slug=1000 or + name contains "1000". status: Use it to get videos filtered by their status. Possible values: @@ -1195,8 +1311,10 @@ async def delete( When you delete a video, all transcoded qualities and all associated files such as subtitles and screenshots, as well as other data, are deleted from cloud - storage. The video is deleted permanently and irreversibly. Therefore, it is - impossible to restore files after this. + storage. + + The video is deleted permanently and irreversibly. Therefore, it is impossible + to restore files after this. For detailed information and information on calculating your maximum monthly storage usage, please refer to the Product Documentation. @@ -1241,6 +1359,7 @@ async def create_multiple( All videos in the request will be processed in queue in order of priority. Use "priority" attribute and look at general description in POST /videos method. + Limits: - Batch max size = 500 videos. @@ -1290,11 +1409,13 @@ async def get( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: - """Information about a video entity. + """ + Information about a video entity. - Contains all the data about the video: - meta-data, data for streaming and renditions, static media data, data about - original video. You can use different methods to play video: + Contains all the data about the video: meta-data, data for streaming and + renditions, static media data, data about original video. + + You can use different methods to play video: - `iframe_url` – a URL to a built-in HTML video player with automatically configured video playback. @@ -1305,7 +1426,8 @@ async def get( - `dash_url` – a URL to MPEG-DASH .mpd manifest, which can be played in most modern video players. Preferable for Android and Windows devices. - `converted_videos`/`mp4_url` – a URL to MP4 file of specific rendition. - ![Video player](https://demo-files.gvideo.io/apidocs/coffee-run-player.jpg) + + ![Video player](https://demo-files.gvideo.io/apidocs/coffee-run-player.jpg) Args: extra_headers: Send extra headers @@ -1337,19 +1459,23 @@ async def get_parameters_for_direct_upload( ) -> DirectUploadParameters: """ Use this method to get TUS' session parameters: hostname of the server to - upload, secure token. The general sequence of actions for a direct upload of a - video is as follows: + upload, secure token. + + The general sequence of actions for a direct upload of a video is as follows: - Create video entity via POST method ["Create video"](/docs/api-reference/streaming/videos/create-video) - Get TUS' session parameters (you are here now) - Upload file via TUS client, choose your implementation on - [tus.io](https://tus.io/implementations) Final endpoint for uploading is - constructed using the following template: "https://{hostname}/upload/". Also - you have to provide token, `client_id`, `video_id` as metadata too. A short - javascript example is shown below, based on tus-js-client. Variable "data" - below is the result of this API request. Please, note that we support 2.x - version only of tus-js-client. + [tus.io](https://tus.io/implementations) + + Final endpoint for uploading is constructed using the following template: + "https://{hostname}/upload/". Also you have to provide token, `client_id`, + `video_id` as metadata too. + + A short javascript example is shown below, based on tus-js-client. Variable + "data" below is the result of this API request. Please, note that we support 2.x + version only of tus-js-client. ``` uploads[data.video.id] = new tus.Upload(file, { diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index 4e557da1..f46e4f46 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -77,17 +77,23 @@ def create( source: A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, `user_defined_tags`, `user_agent`, - `client_data`. More info can be found here: + `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules description: The description assigned to the rule - phase: The WAAP request/response phase for applying the rule. Default is "access". The - "access" phase is responsible for modifying the request before it is sent to the - origin server. The "`header_filter`" phase is responsible for modifying the HTTP - headers of a response before they are sent back to the client. The - "`body_filter`" phase is responsible for modifying the body of a response before - it is sent back to the client. + phase: The WAAP request/response phase for applying the rule. Default is "access". + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. extra_headers: Send extra headers @@ -150,16 +156,22 @@ def update( name: The name assigned to the rule - phase: The WAAP request/response phase for applying the rule. The "access" phase is - responsible for modifying the request before it is sent to the origin server. + phase: The WAAP request/response phase for applying the rule. + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + The "`header_filter`" phase is responsible for modifying the HTTP headers of a - response before they are sent back to the client. The "`body_filter`" phase is - responsible for modifying the body of a response before it is sent back to the - client. + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. source: A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, `user_defined_tags`, `user_agent`, - `client_data`. More info can be found here: + `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules extra_headers: Send extra headers @@ -246,12 +258,16 @@ def list( ordering: Determine the field to order results by - phase: Filter rules based on the WAAP request/response phase for applying the rule. The - "access" phase is responsible for modifying the request before it is sent to the - origin server. The "`header_filter`" phase is responsible for modifying the HTTP - headers of a response before they are sent back to the client. The - "`body_filter`" phase is responsible for modifying the body of a response before - it is sent back to the client. + phase: Filter rules based on the WAAP request/response phase for applying the rule. + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. extra_headers: Send extra headers @@ -454,17 +470,23 @@ async def create( source: A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, `user_defined_tags`, `user_agent`, - `client_data`. More info can be found here: + `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules description: The description assigned to the rule - phase: The WAAP request/response phase for applying the rule. Default is "access". The - "access" phase is responsible for modifying the request before it is sent to the - origin server. The "`header_filter`" phase is responsible for modifying the HTTP - headers of a response before they are sent back to the client. The - "`body_filter`" phase is responsible for modifying the body of a response before - it is sent back to the client. + phase: The WAAP request/response phase for applying the rule. Default is "access". + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. extra_headers: Send extra headers @@ -527,16 +549,22 @@ async def update( name: The name assigned to the rule - phase: The WAAP request/response phase for applying the rule. The "access" phase is - responsible for modifying the request before it is sent to the origin server. + phase: The WAAP request/response phase for applying the rule. + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + The "`header_filter`" phase is responsible for modifying the HTTP headers of a - response before they are sent back to the client. The "`body_filter`" phase is - responsible for modifying the body of a response before it is sent back to the - client. + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. source: A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, `user_defined_tags`, `user_agent`, - `client_data`. More info can be found here: + `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules extra_headers: Send extra headers @@ -623,12 +651,16 @@ def list( ordering: Determine the field to order results by - phase: Filter rules based on the WAAP request/response phase for applying the rule. The - "access" phase is responsible for modifying the request before it is sent to the - origin server. The "`header_filter`" phase is responsible for modifying the HTTP - headers of a response before they are sent back to the client. The - "`body_filter`" phase is responsible for modifying the body of a response before - it is sent back to the client. + phase: Filter rules based on the WAAP request/response phase for applying the rule. + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. extra_headers: Send extra headers diff --git a/src/gcore/types/cloud/file_share_update_params.py b/src/gcore/types/cloud/file_share_update_params.py index a51b8aa0..fc03f7c5 100644 --- a/src/gcore/types/cloud/file_share_update_params.py +++ b/src/gcore/types/cloud/file_share_update_params.py @@ -28,7 +28,9 @@ class FileShareUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/cloud/floating_ip_update_params.py b/src/gcore/types/cloud/floating_ip_update_params.py index 79377f4b..59b962fe 100644 --- a/src/gcore/types/cloud/floating_ip_update_params.py +++ b/src/gcore/types/cloud/floating_ip_update_params.py @@ -22,7 +22,9 @@ class FloatingIPUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/cloud/inference/inference_deployment.py b/src/gcore/types/cloud/inference/inference_deployment.py index 1cde4c63..bd0ab822 100644 --- a/src/gcore/types/cloud/inference/inference_deployment.py +++ b/src/gcore/types/cloud/inference/inference_deployment.py @@ -239,7 +239,9 @@ class InferenceDeployment(BaseModel): """Project ID. If not provided, your default project ID will be used.""" status: Literal["ACTIVE", "DELETING", "DEPLOYING", "DISABLED", "PARTIALLYDEPLOYED", "PENDING"] - """Inference instance status. Value can be one of the following: + """Inference instance status. + + Value can be one of the following: - `DEPLOYING` - The instance is being deployed. Containers are not yet created. - `PARTIALLYDEPLOYED` - All containers have been created, but some may not be diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index 6d84dc51..b2acd4a1 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -97,7 +97,9 @@ class InstanceCreateParams(TypedDict, total=False): """ servergroup_id: str - """Placement group ID for instance placement policy. Supported group types: + """Placement group ID for instance placement policy. + + Supported group types: - `anti-affinity`: Ensures instances are placed on different hosts for high availability. diff --git a/src/gcore/types/cloud/k8s/cluster_create_params.py b/src/gcore/types/cloud/k8s/cluster_create_params.py index d7c9497b..d0b1050e 100644 --- a/src/gcore/types/cloud/k8s/cluster_create_params.py +++ b/src/gcore/types/cloud/k8s/cluster_create_params.py @@ -43,10 +43,12 @@ class ClusterCreateParams(TypedDict, total=False): """Authentication settings""" autoscaler_config: Optional[Dict[str, str]] - """ - Cluster autoscaler configuration. It allows you to override the default - cluster-autoscaler parameters provided by the platform with your preferred - values. Supported parameters (in alphabetical order): + """Cluster autoscaler configuration. + + It allows you to override the default cluster-autoscaler parameters provided by + the platform with your preferred values. + + Supported parameters (in alphabetical order): - balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them. diff --git a/src/gcore/types/cloud/k8s/cluster_update_params.py b/src/gcore/types/cloud/k8s/cluster_update_params.py index 74a40789..32011180 100644 --- a/src/gcore/types/cloud/k8s/cluster_update_params.py +++ b/src/gcore/types/cloud/k8s/cluster_update_params.py @@ -28,10 +28,12 @@ class ClusterUpdateParams(TypedDict, total=False): """Authentication settings""" autoscaler_config: Optional[Dict[str, str]] - """ - Cluster autoscaler configuration. It allows you to override the default - cluster-autoscaler parameters provided by the platform with your preferred - values. Supported parameters (in alphabetical order): + """Cluster autoscaler configuration. + + It allows you to override the default cluster-autoscaler parameters provided by + the platform with your preferred values. + + Supported parameters (in alphabetical order): - balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them. diff --git a/src/gcore/types/cloud/k8s/k8s_cluster.py b/src/gcore/types/cloud/k8s/k8s_cluster.py index 621ef6e5..1df10feb 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster.py @@ -166,9 +166,10 @@ class K8sCluster(BaseModel): """Cluster authentication settings""" autoscaler_config: Optional[Dict[str, str]] = None - """ - Cluster autoscaler configuration. It contains overrides to the default - cluster-autoscaler parameters provided by the platform. + """Cluster autoscaler configuration. + + It contains overrides to the default cluster-autoscaler parameters provided by + the platform. """ cni: Optional[Cni] = None diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py index f4b01786..0870d49c 100644 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -34,7 +34,9 @@ class LoadBalancerUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/cloud/network_update_params.py b/src/gcore/types/cloud/network_update_params.py index 8aa509d3..76a08699 100644 --- a/src/gcore/types/cloud/network_update_params.py +++ b/src/gcore/types/cloud/network_update_params.py @@ -25,7 +25,9 @@ class NetworkUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index 455119cc..122b546d 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -43,7 +43,9 @@ class SubnetUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/cloud/registries/user_create_multiple_params.py b/src/gcore/types/cloud/registries/user_create_multiple_params.py index 48dbfc44..e580e8dc 100644 --- a/src/gcore/types/cloud/registries/user_create_multiple_params.py +++ b/src/gcore/types/cloud/registries/user_create_multiple_params.py @@ -22,9 +22,11 @@ class User(TypedDict, total=False): """User account operating time, days""" name: Required[str] - """ - A name for the registry user. Should be in lowercase, consisting only of numbers - and letters, with maximum length of 16 characters + """A name for the registry user. + + Should be in lowercase, consisting only of numbers and letters, + + with maximum length of 16 characters """ read_only: bool diff --git a/src/gcore/types/cloud/registries/user_create_params.py b/src/gcore/types/cloud/registries/user_create_params.py index 19283e53..a658b14c 100644 --- a/src/gcore/types/cloud/registries/user_create_params.py +++ b/src/gcore/types/cloud/registries/user_create_params.py @@ -16,9 +16,11 @@ class UserCreateParams(TypedDict, total=False): """User account operating time, days""" name: Required[str] - """ - A name for the registry user. Should be in lowercase, consisting only of numbers - and letters, with maximum length of 16 characters + """A name for the registry user. + + Should be in lowercase, consisting only of numbers and letters, + + with maximum length of 16 characters """ read_only: bool diff --git a/src/gcore/types/cloud/registry_create_params.py b/src/gcore/types/cloud/registry_create_params.py index 13f03cab..2d5ecfbb 100644 --- a/src/gcore/types/cloud/registry_create_params.py +++ b/src/gcore/types/cloud/registry_create_params.py @@ -13,9 +13,11 @@ class RegistryCreateParams(TypedDict, total=False): region_id: int name: Required[str] - """ - A name for the container registry. Should be in lowercase, consisting only of - numbers, letters and -, with maximum length of 24 characters + """A name for the container registry. + + Should be in lowercase, consisting only of numbers, letters and -, + + with maximum length of 24 characters """ storage_limit: int diff --git a/src/gcore/types/cloud/security_group_update_params.py b/src/gcore/types/cloud/security_group_update_params.py index a63fad11..dbc8fa10 100644 --- a/src/gcore/types/cloud/security_group_update_params.py +++ b/src/gcore/types/cloud/security_group_update_params.py @@ -26,7 +26,9 @@ class SecurityGroupUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/cloud/ssh_key_created.py b/src/gcore/types/cloud/ssh_key_created.py index 7e304ed8..c889ff5a 100644 --- a/src/gcore/types/cloud/ssh_key_created.py +++ b/src/gcore/types/cloud/ssh_key_created.py @@ -26,9 +26,12 @@ class SSHKeyCreated(BaseModel): """The private part of an SSH key is the confidential portion of the key pair. It should never be shared or exposed. This key is used to prove your identity - when connecting to a server. If you omit the `public_key`, the platform will - generate a key for you. The `private_key` will be returned **once** in the API - response. Be sure to save it securely, as it cannot be retrieved again later. + when connecting to a server. + + If you omit the `public_key`, the platform will generate a key for you. The + `private_key` will be returned **once** in the API response. Be sure to save it + securely, as it cannot be retrieved again later. + Best practice: Save the private key to a secure location on your machine (e.g., `~/.ssh/id_ed25519`) and set the file permissions to be readable only by you. """ diff --git a/src/gcore/types/cloud/volume_update_params.py b/src/gcore/types/cloud/volume_update_params.py index 455e6210..cf8b7815 100644 --- a/src/gcore/types/cloud/volume_update_params.py +++ b/src/gcore/types/cloud/volume_update_params.py @@ -25,7 +25,9 @@ class VolumeUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/dns/zone_get_statistics_params.py b/src/gcore/types/dns/zone_get_statistics_params.py index ee528101..2db7a140 100644 --- a/src/gcore/types/dns/zone_get_statistics_params.py +++ b/src/gcore/types/dns/zone_get_statistics_params.py @@ -11,20 +11,23 @@ class ZoneGetStatisticsParams(TypedDict, total=False): from_: Annotated[int, PropertyInfo(alias="from")] - """ - Beginning of the requested time period (Unix Timestamp, UTC.) In a query string: - &from=1709068637 + """Beginning of the requested time period (Unix Timestamp, UTC.) + + In a query string: &from=1709068637 """ granularity: str """ Granularity parameter string is a sequence of decimal numbers, each with - optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid - time units are "s", "m", "h". + optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". + + Valid time units are "s", "m", "h". """ record_type: str - """DNS record type. Possible values: + """DNS record type. + + Possible values: - A - AAAA @@ -37,7 +40,7 @@ class ZoneGetStatisticsParams(TypedDict, total=False): """ to: int - """ - End of the requested time period (Unix Timestamp, UTC.) In a query string: - &to=1709673437 + """End of the requested time period (Unix Timestamp, UTC.) + + In a query string: &to=1709673437 """ diff --git a/src/gcore/types/dns/zone_get_statistics_response.py b/src/gcore/types/dns/zone_get_statistics_response.py index 6798692d..76dadd2e 100644 --- a/src/gcore/types/dns/zone_get_statistics_response.py +++ b/src/gcore/types/dns/zone_get_statistics_response.py @@ -11,7 +11,9 @@ class ZoneGetStatisticsResponse(BaseModel): requests: Optional[object] = None """ Requests amount (values) for particular zone fractionated by time intervals - (keys). Example of response: + (keys). + + Example of response: `{ "requests": { "1598608080000": 14716, "1598608140000": 51167, "1598608200000": 53432, "1598611020000": 51050, "1598611080000": 52611, "1598611140000": 46884 } }` """ diff --git a/src/gcore/types/dns/zone_import_params.py b/src/gcore/types/dns/zone_import_params.py index ca009f38..5f189393 100644 --- a/src/gcore/types/dns/zone_import_params.py +++ b/src/gcore/types/dns/zone_import_params.py @@ -14,19 +14,25 @@ class ZoneImportParams(TypedDict, total=False): It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, Read - conventionally returns what is available instead of waiting for more. When Read - encounters an error or end-of-file condition after successfully reading n > 0 - bytes, it returns the number of bytes read. It may return the (non-nil) error - from the same call or return the error (and n == 0) from a subsequent call. An - instance of this general case is that a Reader returning a non-zero number of - bytes at the end of the input stream may return either err == EOF or err == nil. - The next Read should return 0, EOF. Callers should always process the n > 0 - bytes returned before considering the error err. Doing so correctly handles I/O - errors that happen after reading some bytes and also both of the allowed EOF - behaviors. If len(p) == 0, Read should always return n == 0. It may return a - non-nil error if some error condition is known, such as EOF. Implementations of - Read are discouraged from returning a zero byte count with a nil error, except - when len(p) == 0. Callers should treat a return of 0 and nil as indicating that - nothing happened; in particular it does not indicate EOF. Implementations must - not retain p. + conventionally returns what is available instead of waiting for more. + + When Read encounters an error or end-of-file condition after successfully + reading n > 0 bytes, it returns the number of bytes read. It may return the + (non-nil) error from the same call or return the error (and n == 0) from a + subsequent call. An instance of this general case is that a Reader returning a + non-zero number of bytes at the end of the input stream may return either err == + EOF or err == nil. The next Read should return 0, EOF. + + Callers should always process the n > 0 bytes returned before considering the + error err. Doing so correctly handles I/O errors that happen after reading some + bytes and also both of the allowed EOF behaviors. + + If len(p) == 0, Read should always return n == 0. It may return a non-nil error + if some error condition is known, such as EOF. + + Implementations of Read are discouraged from returning a zero byte count with a + nil error, except when len(p) == 0. Callers should treat a return of 0 and nil + as indicating that nothing happened; in particular it does not indicate EOF. + + Implementations must not retain p. """ diff --git a/src/gcore/types/dns/zones/dns_output_rrset.py b/src/gcore/types/dns/zones/dns_output_rrset.py index 8ff63143..13a99e28 100644 --- a/src/gcore/types/dns/zones/dns_output_rrset.py +++ b/src/gcore/types/dns/zones/dns_output_rrset.py @@ -42,9 +42,13 @@ class ResourceRecord(BaseModel): 6. `backup` (bool) 7. `notes` (string) 8. `weight` (float) - 9. `ip` (string) Some keys are reserved for balancing, @see - https://api.gcore.com/dns/v2/info/meta This meta will be used to decide which - resource record should pass through filters from the filter set + 9. `ip` (string) + + Some keys are reserved for balancing, @see + https://api.gcore.com/dns/v2/info/meta + + This meta will be used to decide which resource record should pass through + filters from the filter set """ diff --git a/src/gcore/types/iam/account_overview.py b/src/gcore/types/iam/account_overview.py index 0f30b80b..68de5bbd 100644 --- a/src/gcore/types/iam/account_overview.py +++ b/src/gcore/types/iam/account_overview.py @@ -372,7 +372,9 @@ class User(BaseModel): """User's email address.""" groups: Optional[List[UserGroup]] = None - """User's group in the current account. IAM supports 5 groups: + """User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -382,7 +384,10 @@ class User(BaseModel): """ lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None - """User's language. Defines language of the control panel and email messages.""" + """User's language. + + Defines language of the control panel and email messages. + """ name: Optional[str] = None """User's name.""" diff --git a/src/gcore/types/iam/user.py b/src/gcore/types/iam/user.py index 15424ee4..ba27f51d 100644 --- a/src/gcore/types/iam/user.py +++ b/src/gcore/types/iam/user.py @@ -51,7 +51,9 @@ class User(BaseModel): """User's email address.""" groups: Optional[List[Group]] = None - """User's group in the current account. IAM supports 5 groups: + """User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -61,7 +63,10 @@ class User(BaseModel): """ lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None - """User's language. Defines language of the control panel and email messages.""" + """User's language. + + Defines language of the control panel and email messages. + """ name: Optional[str] = None """User's name.""" diff --git a/src/gcore/types/iam/user_detailed.py b/src/gcore/types/iam/user_detailed.py index b82809a2..15a94926 100644 --- a/src/gcore/types/iam/user_detailed.py +++ b/src/gcore/types/iam/user_detailed.py @@ -66,7 +66,9 @@ class UserDetailed(BaseModel): """User's email address.""" groups: Optional[List[Group]] = None - """User's group in the current account. IAM supports 5 groups: + """User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -79,7 +81,10 @@ class UserDetailed(BaseModel): """User activity flag.""" lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None - """User's language. Defines language of the control panel and email messages.""" + """User's language. + + Defines language of the control panel and email messages. + """ name: Optional[str] = None """User's name.""" diff --git a/src/gcore/types/iam/user_invite_params.py b/src/gcore/types/iam/user_invite_params.py index 8f17f566..47c0baac 100644 --- a/src/gcore/types/iam/user_invite_params.py +++ b/src/gcore/types/iam/user_invite_params.py @@ -17,7 +17,10 @@ class UserInviteParams(TypedDict, total=False): user_role: Required[UserRole] lang: Literal["de", "en", "ru", "zh", "az"] - """User's language. Defines language of the control panel and email messages.""" + """User's language. + + Defines language of the control panel and email messages. + """ name: str """User name.""" diff --git a/src/gcore/types/iam/user_update.py b/src/gcore/types/iam/user_update.py index 78b75ac0..83b13534 100644 --- a/src/gcore/types/iam/user_update.py +++ b/src/gcore/types/iam/user_update.py @@ -66,7 +66,9 @@ class UserUpdate(BaseModel): """User's email address.""" groups: Optional[List[Group]] = None - """User's group in the current account. IAM supports 5 groups: + """User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -79,7 +81,10 @@ class UserUpdate(BaseModel): """User activity flag.""" lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None - """User's language. Defines language of the control panel and email messages.""" + """User's language. + + Defines language of the control panel and email messages. + """ name: Optional[str] = None """User's name.""" diff --git a/src/gcore/types/iam/user_update_params.py b/src/gcore/types/iam/user_update_params.py index 6353a943..80d93a28 100644 --- a/src/gcore/types/iam/user_update_params.py +++ b/src/gcore/types/iam/user_update_params.py @@ -19,7 +19,9 @@ class UserUpdateParams(TypedDict, total=False): """User's email address.""" groups: Iterable[Group] - """User's group in the current account. IAM supports 5 groups: + """User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -29,7 +31,10 @@ class UserUpdateParams(TypedDict, total=False): """ lang: Literal["de", "en", "ru", "zh", "az"] - """User's language. Defines language of the control panel and email messages.""" + """User's language. + + Defines language of the control panel and email messages. + """ name: Optional[str] """User's name.""" diff --git a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py index 61517f1a..11b0629a 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py +++ b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py @@ -25,10 +25,12 @@ class AIContentmoderationHardnudity(BaseModel): """ Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. """ client_user_id: Optional[str] = None diff --git a/src/gcore/types/streaming/ai_contentmoderation_nsfw.py b/src/gcore/types/streaming/ai_contentmoderation_nsfw.py index e7c3436b..fac523f2 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_nsfw.py +++ b/src/gcore/types/streaming/ai_contentmoderation_nsfw.py @@ -25,10 +25,12 @@ class AIContentmoderationNsfw(BaseModel): """ Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. """ client_user_id: Optional[str] = None diff --git a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py index 5c0b7f3c..ebfb6a59 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py +++ b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py @@ -25,10 +25,12 @@ class AIContentmoderationSoftnudity(BaseModel): """ Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. """ client_user_id: Optional[str] = None diff --git a/src/gcore/types/streaming/ai_contentmoderation_sport.py b/src/gcore/types/streaming/ai_contentmoderation_sport.py index 78c5b629..079043dd 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_sport.py +++ b/src/gcore/types/streaming/ai_contentmoderation_sport.py @@ -25,10 +25,12 @@ class AIContentmoderationSport(BaseModel): """ Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. """ client_user_id: Optional[str] = None diff --git a/src/gcore/types/streaming/ai_task.py b/src/gcore/types/streaming/ai_task.py index fd114dea..f5f3c6e7 100644 --- a/src/gcore/types/streaming/ai_task.py +++ b/src/gcore/types/streaming/ai_task.py @@ -25,14 +25,20 @@ class TaskDataAITranscribe(BaseModel): audio_language: Optional[str] = None """Language in original audio (transcription only). - This value is used to determine the language from which to transcribe. If this - is not set, the system will run auto language identification and the subtitles - will be in the detected language. The method also works based on AI analysis. - It's fairly accurate, but if it's wrong, then set the language explicitly. + This value is used to determine the language from which to transcribe. + + If this is not set, the system will run auto language identification and the + subtitles will be in the detected language. The method also works based on AI + analysis. It's fairly accurate, but if it's wrong, then set the language + explicitly. + Additionally, when this is not set, we also support recognition of alternate - languages in the video (language code-switching). Language is set by 3-letter - language code according to ISO-639-2 (bibliographic code). We can process - languages: + languages in the video (language code-switching). + + Language is set by 3-letter language code according to ISO-639-2 (bibliographic + code). + + We can process languages: - 'afr': Afrikaans - 'alb': Albanian @@ -139,10 +145,12 @@ class TaskDataAITranscribe(BaseModel): """ Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (transcribing, - translationing), then the ID of the associated video for which the task was - performed will be explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (transcribing, translationing), then the ID + of the associated video for which the task was performed will be explicitly + indicated here. """ client_user_id: Optional[str] = None @@ -156,6 +164,7 @@ class TaskDataAITranscribe(BaseModel): """ Indicates which language it is clearly necessary to translate into. If this is not set, the original language will be used from attribute "`audio_language`". + Please note that: - transcription into the original language is a free procedure, diff --git a/src/gcore/types/streaming/ai_task_create_params.py b/src/gcore/types/streaming/ai_task_create_params.py index 11bddf89..cbf354f3 100644 --- a/src/gcore/types/streaming/ai_task_create_params.py +++ b/src/gcore/types/streaming/ai_task_create_params.py @@ -20,14 +20,20 @@ class AITaskCreateParams(TypedDict, total=False): audio_language: str """Language in original audio (transcription only). - This value is used to determine the language from which to transcribe. If this - is not set, the system will run auto language identification and the subtitles - will be in the detected language. The method also works based on AI analysis. - It's fairly accurate, but if it's wrong, then set the language explicitly. + This value is used to determine the language from which to transcribe. + + If this is not set, the system will run auto language identification and the + subtitles will be in the detected language. The method also works based on AI + analysis. It's fairly accurate, but if it's wrong, then set the language + explicitly. + Additionally, when this is not set, we also support recognition of alternate - languages in the video (language code-switching). Language is set by 3-letter - language code according to ISO-639-2 (bibliographic code). We can process - languages: + languages in the video (language code-switching). + + Language is set by 3-letter language code according to ISO-639-2 (bibliographic + code). + + We can process languages: - 'afr': Afrikaans - 'alb': Albanian @@ -140,10 +146,12 @@ class AITaskCreateParams(TypedDict, total=False): """ Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. """ client_user_id: str @@ -157,6 +165,7 @@ class AITaskCreateParams(TypedDict, total=False): """ Indicates which language it is clearly necessary to translate into. If this is not set, the original language will be used from attribute "`audio_language`". + Please note that: - transcription into the original language is a free procedure, diff --git a/src/gcore/types/streaming/ai_task_get_response.py b/src/gcore/types/streaming/ai_task_get_response.py index 8bd63299..293f55c4 100644 --- a/src/gcore/types/streaming/ai_task_get_response.py +++ b/src/gcore/types/streaming/ai_task_get_response.py @@ -65,10 +65,11 @@ class AITaskGetResponseResultAIResultsTranscribe(BaseModel): """ speech_detected: Optional[bool] = None - """ - Determines whether speech was detected or not. Please note: If the task is in - "SUCCESS" status and speech was not found in the entire file, then "false" will - be indicated here and the `subtitles` field will be empty. + """Determines whether speech was detected or not. + + Please note: If the task is in "SUCCESS" status and speech was not found in the + entire file, then "false" will be indicated here and the `subtitles` field will + be empty. """ subtitles: Optional[List[AITaskGetResponseResultAIResultsTranscribeSubtitle]] = None diff --git a/src/gcore/types/streaming/ai_task_list_params.py b/src/gcore/types/streaming/ai_task_list_params.py index b6499c1c..8fe3d727 100644 --- a/src/gcore/types/streaming/ai_task_list_params.py +++ b/src/gcore/types/streaming/ai_task_list_params.py @@ -17,8 +17,10 @@ class AITaskListParams(TypedDict, total=False): ordering: Literal["task_id", "status", "task_name", "started_at"] """ Which field to use when ordering the results: `task_id`, status, and - `task_name`. Sorting is done in ascending (ASC) order. If parameter is omitted - then "`started_at` DESC" is used for ordering by default. + `task_name`. Sorting is done in ascending (ASC) order. + + If parameter is omitted then "`started_at` DESC" is used for ordering by + default. """ page: int @@ -27,9 +29,13 @@ class AITaskListParams(TypedDict, total=False): search: str """ This is an field for combined text search in the following fields: `task_id`, - `task_name`, status, and `task_data`. Both full and partial searches are - possible inside specified above fields. For example, you can filter tasks of a - certain category, or tasks by a specific original file. Example: + `task_name`, status, and `task_data`. + + Both full and partial searches are possible inside specified above fields. For + example, you can filter tasks of a certain category, or tasks by a specific + original file. + + Example: - To filter tasks of Content Moderation NSFW method: `GET /streaming/ai/tasks?search=nsfw` diff --git a/src/gcore/types/streaming/clip.py b/src/gcore/types/streaming/clip.py index f5c0135a..b29471a8 100644 --- a/src/gcore/types/streaming/clip.py +++ b/src/gcore/types/streaming/clip.py @@ -12,34 +12,43 @@ class Clip(BaseModel): """ID of the clip""" duration: int - """ - Requested segment duration in seconds to be cut. Please, note that cutting is - based on the idea of instantly creating a clip, instead of precise timing. So - final segment may be: + """Requested segment duration in seconds to be cut. + + Please, note that cutting is based on the idea of instantly creating a clip, + instead of precise timing. So final segment may be: - Less than the specified value if there is less data in the DVR than the requested segment. - Greater than the specified value, because segment is aligned to the first and last key frames of already stored fragment in DVR, this way -1 and +1 chunks - can be added to left and right. Duration of cutted segment cannot be greater - than DVR duration for this stream. Therefore, to change the maximum, use - "`dvr_duration`" parameter of this stream. + can be added to left and right. + + Duration of cutted segment cannot be greater than DVR duration for this stream. + Therefore, to change the maximum, use "`dvr_duration`" parameter of this stream. """ created_at: Optional[str] = None """Creation date and time. Format is date time in ISO 8601""" expiration: Optional[int] = None - """ - Expire time of the clip via a public link. Unix timestamp in seconds, absolute - value. This is the time how long the instant clip will be stored in the server - memory and can be accessed via public HLS/MP4 links. Download and/or use the - instant clip before this time expires. After the time has expired, the clip is - deleted from memory and is no longer available via the link. You need to create - a new segment, or use `vod_required: true` attribute. If value is omitted, then - expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. - `unix timestamp = + + 3600`). Allowed range: 1m <= expiration - <= 4h. Example: + """Expire time of the clip via a public link. + + Unix timestamp in seconds, absolute value. + + This is the time how long the instant clip will be stored in the server memory + and can be accessed via public HLS/MP4 links. Download and/or use the instant + clip before this time expires. + + After the time has expired, the clip is deleted from memory and is no longer + available via the link. You need to create a new segment, or use + `vod_required: true` attribute. + + If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the + end of the clip (i.e. `unix timestamp = + + 3600`). + + Allowed range: 1m <= expiration <= 4h. + + Example: `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` """ @@ -65,11 +74,13 @@ class Clip(BaseModel): """List of available rendition heights""" start: Optional[int] = None - """ - Starting point of the segment to cut. Unix timestamp in seconds, absolute value. - Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value - from the past is specified, it is used as the starting point for the segment to - cut. If the value is omitted, then clip will start from now. + """Starting point of the segment to cut. + + Unix timestamp in seconds, absolute value. Example: + `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` + + If a value from the past is specified, it is used as the starting point for the + segment to cut. If the value is omitted, then clip will start from now. """ video_id: Optional[int] = None diff --git a/src/gcore/types/streaming/create_video_param.py b/src/gcore/types/streaming/create_video_param.py index aed1f153..111f0095 100644 --- a/src/gcore/types/streaming/create_video_param.py +++ b/src/gcore/types/streaming/create_video_param.py @@ -12,7 +12,9 @@ class CreateVideoParam(TypedDict, total=False): """Video name""" auto_transcribe_audio_language: Literal["disable", "auto", ""] - """Automatic creation of subtitles by transcribing the audio track. Values: + """Automatic creation of subtitles by transcribing the audio track. + + Values: - disable – Do not transcribe. - auto – Automatically detects the activation of the option based on the @@ -22,7 +24,9 @@ class CreateVideoParam(TypedDict, total=False): language spoken in the audio track, or when auto language detection fails. Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). List of languages is available in `audio_language` - attribute of API POST /streaming/ai/transcribe . Example: + attribute of API POST /streaming/ai/transcribe . + + Example: ``` auto_transcribe_audio_language: "auto" @@ -41,16 +45,23 @@ class CreateVideoParam(TypedDict, total=False): """Automatic translation of auto-transcribed subtitles to the specified language(s). - Can be used both together with `auto_transcribe_audio_language` option only. Use - it when you want to make automatic subtitles in languages other than the - original language in audio. Values: + Can be used both together with `auto_transcribe_audio_language` option only. + + Use it when you want to make automatic subtitles in languages other than the + original language in audio. + + Values: - disable – Do not translate. - default – There are 3 default languages: eng,fre,ger - \\ – Explicit language to translate to, or list of languages separated by a comma. Look at list of available languages in description of AI ASR task - creation. If several languages are specified for translation, a separate - subtitle will be generated for each language. Example: + creation. + + If several languages are specified for translation, a separate subtitle will be + generated for each language. + + Example: ``` auto_translate_subtitles_language: default @@ -79,9 +90,10 @@ class CreateVideoParam(TypedDict, total=False): """ custom_iframe_url: str - """ - Deprecated. Custom URL of IFrame for video player to be used in share panel in - player. Auto generated IFrame URL provided by default + """Deprecated. + + Custom URL of IFrame for video player to be used in share panel in player. Auto + generated IFrame URL provided by default """ description: str @@ -94,8 +106,11 @@ class CreateVideoParam(TypedDict, total=False): """Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file - (specified in "`origin_url`" parameter) on an external server. Syntax: - `Authorization: ` Examples: + (specified in "`origin_url`" parameter) on an external server. + + Syntax: `Authorization: ` + + Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -121,16 +136,21 @@ class CreateVideoParam(TypedDict, total=False): """ poster: str - """ - Poster is your own static image which can be displayed before the video starts. + """Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own image. Also use attribute "`screenshot_id`" to select poster as a default - screnshot. Attribute accepts single image as base64-encoded string + screnshot. + + Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, - image/webp, and image/png and file sizes up to 1Mb. Examples: + format: `data:[];base64,` + + MIME-types are image/jpeg, image/webp, and image/png and file sizes up to 1Mb. + + Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` @@ -141,13 +161,16 @@ class CreateVideoParam(TypedDict, total=False): """ Priority allows you to adjust the urgency of processing some videos before others in your account, if your algorithm requires it. For example, when there - are very urgent video and some regular ones that can wait in the queue. Value - range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest - up-priority. Default priority is 0. + are very urgent video and some regular ones that can wait in the queue. + + Value range, integer [-10..10]. -10 is the lowest down-priority, 10 is the + highest up-priority. Default priority is 0. """ projection: str - """Deprecated. Regulates the video format: + """Deprecated. + + Regulates the video format: - **regular** — plays the video as usual - **vr360** — plays the video in 360 degree mode @@ -166,28 +189,34 @@ class CreateVideoParam(TypedDict, total=False): remote_poster_url: str """ Poster URL to download from external resource, instead of uploading via "poster" - attribute. It has the same restrictions as "poster" attribute. + attribute. + + It has the same restrictions as "poster" attribute. """ remove_poster: bool """Set it to true to remove poster""" screenshot_id: int - """ - Default screenshot index. Specify an ID from the "screenshots" array, so that - the URL of the required screenshot appears in the "screenshot" attribute as the - default screenshot. By default 5 static screenshots will be taken from different - places in the video after transcoding. If the video is short, there may be fewer - screenshots. Counting from 0. A value of -1 sets the default screenshot to the - URL of your own image from the "poster" attribute. Look at "screenshot" - attribute in GET /videos/{`video_id`} for details. + """Default screenshot index. + + Specify an ID from the "screenshots" array, so that the URL of the required + screenshot appears in the "screenshot" attribute as the default screenshot. By + default 5 static screenshots will be taken from different places in the video + after transcoding. If the video is short, there may be fewer screenshots. + + Counting from 0. A value of -1 sets the default screenshot to the URL of your + own image from the "poster" attribute. + + Look at "screenshot" attribute in GET /videos/{`video_id`} for details. """ share_url: str - """ - Deprecated. Custom URL or iframe displayed in the link field when a user clicks - on a sharing button in player. If empty, the link field and social network - sharing is disabled + """Deprecated. + + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled """ source_bitrate_limit: bool @@ -200,16 +229,19 @@ class CreateVideoParam(TypedDict, total=False): By default `source_bitrate_limit: true` this option allows you to have the output bitrate not more than in the original video, thus to transcode video faster and to deliver it to end-viewers faster as well. At the same time, the - quality will be similar to the original. If for some reason you need more - byte-space in the output quality when encoding, you can set this option to - `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will - be raised from the bitrate of the original video to the maximum possible limit - specified in our the Product Documentation. For example, this may be needed - when: + quality will be similar to the original. + + If for some reason you need more byte-space in the output quality when encoding, + you can set this option to `source_bitrate_limit: false`. Then, when + transcoding, the quality ceiling will be raised from the bitrate of the original + video to the maximum possible limit specified in our the Product Documentation. + For example, this may be needed when: - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, - to improve the picture quality on dynamic scenes, - - etc. The option is applied only at the video creation stage and cannot be - changed later. If you want to re-transcode the video using new value, then you - need to create and upload a new video only. + - etc. + + The option is applied only at the video creation stage and cannot be changed + later. If you want to re-transcode the video using new value, then you need to + create and upload a new video only. """ diff --git a/src/gcore/types/streaming/playlist.py b/src/gcore/types/streaming/playlist.py index 677306e0..a6349c50 100644 --- a/src/gcore/types/streaming/playlist.py +++ b/src/gcore/types/streaming/playlist.py @@ -64,9 +64,10 @@ class Playlist(BaseModel): """A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will - automatically play in all browsers. The player can be opened or shared via this - direct link. Also the video player can be integrated into your web pages using - the Iframe tag. + automatically play in all browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. """ @@ -97,6 +98,7 @@ class Playlist(BaseModel): video_ids: Optional[List[int]] = None """A list of VOD IDs included in the playlist. - Order of videos in a playlist reflects the order of IDs in the array. Maximum - video limit = 128. + Order of videos in a playlist reflects the order of IDs in the array. + + Maximum video limit = 128. """ diff --git a/src/gcore/types/streaming/playlist_create_params.py b/src/gcore/types/streaming/playlist_create_params.py index f8043bbe..c393d54f 100644 --- a/src/gcore/types/streaming/playlist_create_params.py +++ b/src/gcore/types/streaming/playlist_create_params.py @@ -64,9 +64,10 @@ class PlaylistCreateParams(TypedDict, total=False): """A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will - automatically play in all browsers. The player can be opened or shared via this - direct link. Also the video player can be integrated into your web pages using - the Iframe tag. + automatically play in all browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. """ @@ -97,6 +98,7 @@ class PlaylistCreateParams(TypedDict, total=False): video_ids: Iterable[int] """A list of VOD IDs included in the playlist. - Order of videos in a playlist reflects the order of IDs in the array. Maximum - video limit = 128. + Order of videos in a playlist reflects the order of IDs in the array. + + Maximum video limit = 128. """ diff --git a/src/gcore/types/streaming/playlist_update_params.py b/src/gcore/types/streaming/playlist_update_params.py index a8f2a06e..ec9e9fd2 100644 --- a/src/gcore/types/streaming/playlist_update_params.py +++ b/src/gcore/types/streaming/playlist_update_params.py @@ -64,9 +64,10 @@ class PlaylistUpdateParams(TypedDict, total=False): """A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will - automatically play in all browsers. The player can be opened or shared via this - direct link. Also the video player can be integrated into your web pages using - the Iframe tag. + automatically play in all browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. """ @@ -97,6 +98,7 @@ class PlaylistUpdateParams(TypedDict, total=False): video_ids: Iterable[int] """A list of VOD IDs included in the playlist. - Order of videos in a playlist reflects the order of IDs in the array. Maximum - video limit = 128. + Order of videos in a playlist reflects the order of IDs in the array. + + Maximum video limit = 128. """ diff --git a/src/gcore/types/streaming/playlist_video.py b/src/gcore/types/streaming/playlist_video.py index 309b5362..d271fb3b 100644 --- a/src/gcore/types/streaming/playlist_video.py +++ b/src/gcore/types/streaming/playlist_video.py @@ -13,7 +13,9 @@ class PlaylistVideo(BaseModel): """Video name""" auto_transcribe_audio_language: Optional[Literal["disable", "auto", ""]] = None - """Automatic creation of subtitles by transcribing the audio track. Values: + """Automatic creation of subtitles by transcribing the audio track. + + Values: - disable – Do not transcribe. - auto – Automatically detects the activation of the option based on the @@ -23,7 +25,9 @@ class PlaylistVideo(BaseModel): language spoken in the audio track, or when auto language detection fails. Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). List of languages is available in `audio_language` - attribute of API POST /streaming/ai/transcribe . Example: + attribute of API POST /streaming/ai/transcribe . + + Example: ``` auto_transcribe_audio_language: "auto" @@ -42,16 +46,23 @@ class PlaylistVideo(BaseModel): """Automatic translation of auto-transcribed subtitles to the specified language(s). - Can be used both together with `auto_transcribe_audio_language` option only. Use - it when you want to make automatic subtitles in languages other than the - original language in audio. Values: + Can be used both together with `auto_transcribe_audio_language` option only. + + Use it when you want to make automatic subtitles in languages other than the + original language in audio. + + Values: - disable – Do not translate. - default – There are 3 default languages: eng,fre,ger - \\ – Explicit language to translate to, or list of languages separated by a comma. Look at list of available languages in description of AI ASR task - creation. If several languages are specified for translation, a separate - subtitle will be generated for each language. Example: + creation. + + If several languages are specified for translation, a separate subtitle will be + generated for each language. + + Example: ``` auto_translate_subtitles_language: default @@ -80,9 +91,10 @@ class PlaylistVideo(BaseModel): """ custom_iframe_url: Optional[str] = None - """ - Deprecated. Custom URL of IFrame for video player to be used in share panel in - player. Auto generated IFrame URL provided by default + """Deprecated. + + Custom URL of IFrame for video player to be used in share panel in player. Auto + generated IFrame URL provided by default """ description: Optional[str] = None @@ -95,8 +107,11 @@ class PlaylistVideo(BaseModel): """Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file - (specified in "`origin_url`" parameter) on an external server. Syntax: - `Authorization: ` Examples: + (specified in "`origin_url`" parameter) on an external server. + + Syntax: `Authorization: ` + + Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -122,16 +137,21 @@ class PlaylistVideo(BaseModel): """ poster: Optional[str] = None - """ - Poster is your own static image which can be displayed before the video starts. + """Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own image. Also use attribute "`screenshot_id`" to select poster as a default - screnshot. Attribute accepts single image as base64-encoded string + screnshot. + + Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, - image/webp, and image/png and file sizes up to 1Mb. Examples: + format: `data:[];base64,` + + MIME-types are image/jpeg, image/webp, and image/png and file sizes up to 1Mb. + + Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` @@ -142,13 +162,16 @@ class PlaylistVideo(BaseModel): """ Priority allows you to adjust the urgency of processing some videos before others in your account, if your algorithm requires it. For example, when there - are very urgent video and some regular ones that can wait in the queue. Value - range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest - up-priority. Default priority is 0. + are very urgent video and some regular ones that can wait in the queue. + + Value range, integer [-10..10]. -10 is the lowest down-priority, 10 is the + highest up-priority. Default priority is 0. """ projection: Optional[str] = None - """Deprecated. Regulates the video format: + """Deprecated. + + Regulates the video format: - **regular** — plays the video as usual - **vr360** — plays the video in 360 degree mode @@ -167,28 +190,34 @@ class PlaylistVideo(BaseModel): remote_poster_url: Optional[str] = None """ Poster URL to download from external resource, instead of uploading via "poster" - attribute. It has the same restrictions as "poster" attribute. + attribute. + + It has the same restrictions as "poster" attribute. """ remove_poster: Optional[bool] = None """Set it to true to remove poster""" screenshot_id: Optional[int] = None - """ - Default screenshot index. Specify an ID from the "screenshots" array, so that - the URL of the required screenshot appears in the "screenshot" attribute as the - default screenshot. By default 5 static screenshots will be taken from different - places in the video after transcoding. If the video is short, there may be fewer - screenshots. Counting from 0. A value of -1 sets the default screenshot to the - URL of your own image from the "poster" attribute. Look at "screenshot" - attribute in GET /videos/{`video_id`} for details. + """Default screenshot index. + + Specify an ID from the "screenshots" array, so that the URL of the required + screenshot appears in the "screenshot" attribute as the default screenshot. By + default 5 static screenshots will be taken from different places in the video + after transcoding. If the video is short, there may be fewer screenshots. + + Counting from 0. A value of -1 sets the default screenshot to the URL of your + own image from the "poster" attribute. + + Look at "screenshot" attribute in GET /videos/{`video_id`} for details. """ share_url: Optional[str] = None - """ - Deprecated. Custom URL or iframe displayed in the link field when a user clicks - on a sharing button in player. If empty, the link field and social network - sharing is disabled + """Deprecated. + + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled """ source_bitrate_limit: Optional[bool] = None @@ -201,16 +230,19 @@ class PlaylistVideo(BaseModel): By default `source_bitrate_limit: true` this option allows you to have the output bitrate not more than in the original video, thus to transcode video faster and to deliver it to end-viewers faster as well. At the same time, the - quality will be similar to the original. If for some reason you need more - byte-space in the output quality when encoding, you can set this option to - `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will - be raised from the bitrate of the original video to the maximum possible limit - specified in our the Product Documentation. For example, this may be needed - when: + quality will be similar to the original. + + If for some reason you need more byte-space in the output quality when encoding, + you can set this option to `source_bitrate_limit: false`. Then, when + transcoding, the quality ceiling will be raised from the bitrate of the original + video to the maximum possible limit specified in our the Product Documentation. + For example, this may be needed when: - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, - to improve the picture quality on dynamic scenes, - - etc. The option is applied only at the video creation stage and cannot be - changed later. If you want to re-transcode the video using new value, then you - need to create and upload a new video only. + - etc. + + The option is applied only at the video creation stage and cannot be changed + later. If you want to re-transcode the video using new value, then you need to + create and upload a new video only. """ diff --git a/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py b/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py index 3516aa24..b8da4126 100644 --- a/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py +++ b/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py @@ -17,10 +17,13 @@ class StatisticGetUniqueViewersCdnParams(TypedDict, total=False): id: str """Filter by entity's id. - Put ID of a Live stream, VOD or a playlist to be calculated. If the value is - omitted, then the calculation is done for all videos/streams of the specified - type. When using this "id" parameter, be sure to specify the "type" parameter - too. If you do not specify a type, the "id" will be ignored. + Put ID of a Live stream, VOD or a playlist to be calculated. + + If the value is omitted, then the calculation is done for all videos/streams of + the specified type. + + When using this "id" parameter, be sure to specify the "type" parameter too. If + you do not specify a type, the "id" will be ignored. """ type: Literal["live", "vod", "playlist"] diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py index 903a1515..8db7262a 100644 --- a/src/gcore/types/streaming/stream.py +++ b/src/gcore/types/streaming/stream.py @@ -11,9 +11,12 @@ class Stream(BaseModel): name: str - """ - Stream name. Often used as a human-readable name for the stream, but can contain - any text you wish. The values are not unique and may be repeated. Examples: + """Stream name. + + Often used as a human-readable name for the stream, but can contain any text you + wish. The values are not unique and may be repeated. + + Examples: - Conference in July - Stream #10003 @@ -28,8 +31,10 @@ class Stream(BaseModel): """Stream switch between on and off. This is not an indicator of the status "stream is receiving and it is LIVE", but - rather an on/off switch. When stream is switched off, there is no way to process - it: PULL is deactivated and PUSH will return an error. + rather an on/off switch. + + When stream is switched off, there is no way to process it: PULL is deactivated + and PUSH will return an error. - true – stream can be processed - false – stream is off, and cannot be processed @@ -38,9 +43,12 @@ class Stream(BaseModel): auto_record: Optional[bool] = None """Enables autotomatic recording of the stream when it started. - So you don't need to call recording manually. Result of recording is - automatically added to video hosting. For details see the - /streams/`start_recording` method and in knowledge base Values: + So you don't need to call recording manually. + + Result of recording is automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base + + Values: - true – auto recording is enabled - false – auto recording is disabled @@ -49,23 +57,28 @@ class Stream(BaseModel): backup_live: Optional[bool] = None """ State of receiving and transcoding master stream from source by backup server if - you pushing stream to "`backup_push_url`" or "`backup_push_url_srt`". Displays - the backup server status of PUSH method only. For PULL a "live" field is always - used, even when origin servers are switched using round robin scheduling (look - "uri" field for details). + you pushing stream to "`backup_push_url`" or "`backup_push_url_srt`". + + Displays the backup server status of PUSH method only. For PULL a "live" field + is always used, even when origin servers are switched using round robin + scheduling (look "uri" field for details). """ backup_push_url: Optional[str] = None """URL to PUSH master stream to our backup server using RTMP/S protocols. - Servers for the main and backup streams are distributed geographically. Mainly - sending one stream to main server is enough. But if you need a backup stream, - then this is the field to PUSH it. To use RTMPS just manually change the - protocol name from "rtmp://" to "rtmps://". The backup logs are as follows: In - PUSH mode, you initiate sending a stream from your machine. If your stream stops - or breaks for some reason and it stops coming to the main server, then after - 3-10 seconds of waiting the stream will turn off or the backup one will be - automatically turned on, if you are pushing it too. + Servers for the main and backup streams are distributed geographically. + + Mainly sending one stream to main server is enough. But if you need a backup + stream, then this is the field to PUSH it. + + To use RTMPS just manually change the protocol name from "rtmp://" to + "rtmps://". + + The backup logs are as follows: In PUSH mode, you initiate sending a stream from + your machine. If your stream stops or breaks for some reason and it stops coming + to the main server, then after 3-10 seconds of waiting the stream will turn off + or the backup one will be automatically turned on, if you are pushing it too. """ backup_push_url_srt: Optional[str] = None @@ -105,12 +118,15 @@ class Stream(BaseModel): dash_url: Optional[str] = None """MPEG-DASH output. - URL for transcoded result stream in MPEG-DASH format, with .mpd link. Low - Latency support: YES. This is CMAF-based MPEG-DASH stream. Encoder and packager - dynamically assemble the video stream with fMP4 fragments. Chunks have ±2-4 - seconds duration depending on the settings. All chunks for DASH are transferred - through CDN using chunk transfer technology, which allows to use all the - advantages of low latency delivery of DASH. + URL for transcoded result stream in MPEG-DASH format, with .mpd link. + + Low Latency support: YES. + + This is CMAF-based MPEG-DASH stream. Encoder and packager dynamically assemble + the video stream with fMP4 fragments. Chunks have ±2-4 seconds duration + depending on the settings. All chunks for DASH are transferred through CDN using + chunk transfer technology, which allows to use all the advantages of low latency + delivery of DASH. - by default low latency is ±4 sec, because it's stable for almost all last-mile use cases. @@ -124,8 +140,11 @@ class Stream(BaseModel): """DVR duration in seconds if DVR feature is enabled for the stream. So this is duration of how far the user can rewind the live stream. - `dvr_duration` range is [30...14400]. Maximum value is 4 hours = 14400 seconds. - If you need more, ask the Support Team please. + + `dvr_duration` range is [30...14400]. + + Maximum value is 4 hours = 14400 seconds. If you need more, ask the Support Team + please. """ dvr_enabled: Optional[bool] = None @@ -136,16 +155,17 @@ class Stream(BaseModel): """ finished_at_primary: Optional[str] = None - """Time when the stream ended for the last time. - - Datetime in ISO 8601. After restarting the stream, this value is not reset to - "null", and the time of the last/previous end is always displayed here. That is, - when the start time is greater than the end time, it means the current session - is still ongoing and the stream has not ended yet. If you want to see all - information about acitivity of the stream, you can get it from another method - /streaming/statistics/ffprobe. This method shows aggregated activity parameters - during a time, when stream was alive and transcoded. Also you can create graphs - to see the activity. For example + """Time when the stream ended for the last time. Datetime in ISO 8601. + + After restarting the stream, this value is not reset to "null", and the time of + the last/previous end is always displayed here. That is, when the start time is + greater than the end time, it means the current session is still ongoing and the + stream has not ended yet. + + If you want to see all information about acitivity of the stream, you can get it + from another method /streaming/statistics/ffprobe. This method shows aggregated + activity parameters during a time, when stream was alive and transcoded. Also + you can create graphs to see the activity. For example /streaming/statistics/ffprobe?interval=6000&`date_from`=2023-10-01&`date_to`=2023-10-11&`stream_id`=12345 """ @@ -156,12 +176,15 @@ class Stream(BaseModel): """HLS output. URL for transcoded result of stream in HLS CMAF format, with .m3u8 link. - Recommended for use for all HLS streams. Low Latency support: YES. This is - CMAF-based HLS stream. Encoder and packager dynamically assemble the video - stream with fMP4 fragments. Chunks have ±2-4 seconds duration depending on the - settings. All chunks for LL-HLS are transferred through CDN via dividing into - parts (small segments `#EXT-X-PART` of 0.5-1.0 sec duration), which allows to - use all the advantages of low latency delivery of LL-HLS. + Recommended for use for all HLS streams. + + Low Latency support: YES. + + This is CMAF-based HLS stream. Encoder and packager dynamically assemble the + video stream with fMP4 fragments. Chunks have ±2-4 seconds duration depending on + the settings. All chunks for LL-HLS are transferred through CDN via dividing + into parts (small segments `#EXT-X-PART` of 0.5-1.0 sec duration), which allows + to use all the advantages of low latency delivery of LL-HLS. - by default low latency is ±5 sec, because it's stable for almost all last-mile use cases. @@ -185,12 +208,18 @@ class Stream(BaseModel): """HLS output for legacy devices. URL for transcoded result of stream in HLS MPEG-TS (.ts) format, with .m3u8 - link. Low Latency support: NO. Some legacy devices or software may require - MPEG-TS (.ts) segments as a format for streaming, so we provide this options - keeping backward compatibility with any of your existing workflows. For other - cases it's better to use "`hls_cmaf_url`" instead. You can use this legacy HLSv6 - format based on MPEG-TS segmenter in parallel with main HLS CMAF. Both formats - are sharing same segments size, manifest length (DVR), etc. + link. + + Low Latency support: NO. + + Some legacy devices or software may require MPEG-TS (.ts) segments as a format + for streaming, so we provide this options keeping backward compatibility with + any of your existing workflows. For other cases it's better to use + "`hls_cmaf_url`" instead. + + You can use this legacy HLSv6 format based on MPEG-TS segmenter in parallel with + main HLS CMAF. Both formats are sharing same segments size, manifest length + (DVR), etc. It is also possible to use additional modifier-attributes: @@ -200,10 +229,13 @@ class Stream(BaseModel): length multiple of whole seconds, or a fractional number separated by a dot for chunks that are not multiples of seconds. This attribute allows you to determine duration in seconds at the level of analyzing the logs of CDN - requests and compare it with file size (so to use it in your analytics). Such - modifier attributes are applied manually and added to the link obtained from - this field. I.e. `?get_duration_sec=true` Example: - `https://demo.gvideo.io/mpegts/2675_19146/master_mpegts.m3u8?get_duration_sec=true` + requests and compare it with file size (so to use it in your analytics). + + Such modifier attributes are applied manually and added to the link obtained + from this field. I.e. `?get_duration_sec=true` + + Example: + `https://demo.gvideo.io/mpegts/2675_19146/master_mpegts.m3u8?get_duration_sec=true` ``` #EXTM3U @@ -230,14 +262,19 @@ class Stream(BaseModel): """A URL to a built-in HTML web player with the stream inside. It can be inserted into an iframe on your website and the video will - automatically play in all browsers. Please, remember that transcoded streams - from "`hls_cmaf_url`" with .m3u8 at the end, and from "`dash_url`" with .mpd at - the end are to be played inside video players only. For example: AVplayer on - iOS, Exoplayer on Android, HTML web player in browser, etc. General bowsers like - Chrome, Firefox, etc cannot play transcoded streams with .m3u8 and .mpd at the - end. The only exception is Safari, which can only play Apple's HLS .m3u8 format - with limits. That's why you may need to use this HTML web player. Please, look - Knowledge Base for details. Example of usage on a web page: + automatically play in all browsers. + + Please, remember that transcoded streams from "`hls_cmaf_url`" with .m3u8 at the + end, and from "`dash_url`" with .mpd at the end are to be played inside video + players only. For example: AVplayer on iOS, Exoplayer on Android, HTML web + player in browser, etc. General bowsers like Chrome, Firefox, etc cannot play + transcoded streams with .m3u8 and .mpd at the end. The only exception is Safari, + which can only play Apple's HLS .m3u8 format with limits. + + That's why you may need to use this HTML web player. Please, look Knowledge Base + for details. + + Example of usage on a web page: """ @@ -249,7 +286,9 @@ class Stream(BaseModel): """ Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, - then use parameters of that video player. Modes: + then use parameters of that video player. + + Modes: - regular – regular “flat” stream - vr360 – display stream in 360° mode @@ -270,9 +309,11 @@ class Stream(BaseModel): """ push_url: Optional[str] = None - """ - URL to PUSH master stream to our main server using RTMP and RTMPS protocols. To - use RTMPS just manually change the protocol name from "rtmp://" to "rtmps://". + """URL to PUSH master stream to our main server using RTMP and RTMPS protocols. + + To use RTMPS just manually change the protocol name from "rtmp://" to + "rtmps://". + Use only 1 protocol of sending a master stream: eitheronly RTMP/S (`push_url`), or only SRT (`push_url_srt`). @@ -287,8 +328,9 @@ class Stream(BaseModel): Please note that 1 connection and 1 protocol can be used at a single moment in time per unique stream key input. Trying to send 2+ connection requests into - `push_url` to once, or 2+ protocols at once will not lead to a result. For - example, transcoding process will fail if: + `push_url` to once, or 2+ protocols at once will not lead to a result. + + For example, transcoding process will fail if: - you are pushing primary and backup RTMP to the same single `push_url` simultaneously @@ -303,31 +345,37 @@ class Stream(BaseModel): """ push_url_srt: Optional[str] = None - """ - URL to PUSH master stream to our main server using SRT protocol. Use only 1 - protocol of sending a master stream: eitheronly RTMP/S (`push_url`), or only SRT - (`push_url_srt`). + """URL to PUSH master stream to our main server using SRT protocol. + + Use only 1 protocol of sending a master stream: eitheronly RTMP/S (`push_url`), + or only SRT (`push_url_srt`). + + **Setup SRT latency on your sender side** - **Setup SRT latency on your sender side** SRT is designed as a low-latency - transport protocol, but real networks are not always stable and in some cases - the end-to-end path from the venue to the ingest point can be long. For this - reason, it is important to configure the latency parameter carefully to match - the actual network conditions. Small latency values may lead to packet loss when - jitter or retransmissions occur, while very large values introduce unnecessary - end-to-end delay. \\**Incorrect or low default value is one of the most common - reasons for packet loss, frames loss, and bad picture.\\** + SRT is designed as a low-latency transport protocol, but real networks are not + always stable and in some cases the end-to-end path from the venue to the ingest + point can be long. For this reason, it is important to configure the latency + parameter carefully to match the actual network conditions. + + Small latency values may lead to packet loss when jitter or retransmissions + occur, while very large values introduce unnecessary end-to-end delay. + \\**Incorrect or low default value is one of the most common reasons for packet + loss, frames loss, and bad picture.\\** We therefore recommend setting latency manually rather than relying on the default, to ensure the buffer is correctly sized for your environment. A practical range is 400–2000 ms, with the exact value chosen based on RTT, - jitter, and expected packet loss. Be sure to check and test SRT settings on your - sender side. The default values do not take into account your specific scenarios - and do not work well. If necessary, ask us and we will help you. + jitter, and expected packet loss. + + Be sure to check and test SRT settings on your sender side. The default values + do not take into account your specific scenarios and do not work well. If + necessary, ask us and we will help you. Please note that 1 connection and 1 protocol can be used at a single moment in time per unique stream key input. Trying to send 2+ connection requests into - `push_url_srt` to once, or 2+ protocols at once will not lead to a result. For - example, transcoding process will fail if: + `push_url_srt` to once, or 2+ protocols at once will not lead to a result. + + For example, transcoding process will fail if: - you are pushing primary and backup SRT to the same single `push_url_srt` simultaneously @@ -340,37 +388,52 @@ class Stream(BaseModel): push_url_whip: Optional[str] = None """URL to PUSH WebRTC stream to our server using WHIP protocol. - **WebRTC WHIP to LL-HLS and DASH** Video Streaming supports WebRTC HTTP Ingest - Protocol (WHIP), and WebRTC to HLS/DASH converter. As a result you can stream - from web broswers natively. **WebRTC WHIP server** We have dedicated WebRTC WHIP - servers in our infrastructure. WebRTC WHIP server organizes both signaling and - receives video data. Signaling is a term to describe communication between - WebRTC endpoints, needed to initiate and maintain a session. WHIP is an open - specification for a simple signaling protocol for starting WebRTC sessions in an - outgoing direction, (i.e., streaming from your device). There is the primary - link only for WHIP, so no backup link. **WebRTC stream encoding parameters** At - least one video and audio track both must be present in the stream: + **WebRTC WHIP to LL-HLS and DASH** + + Video Streaming supports WebRTC HTTP Ingest Protocol (WHIP), and WebRTC to + HLS/DASH converter. As a result you can stream from web broswers natively. + + **WebRTC WHIP server** + + We have dedicated WebRTC WHIP servers in our infrastructure. WebRTC WHIP server + organizes both signaling and receives video data. Signaling is a term to + describe communication between WebRTC endpoints, needed to initiate and maintain + a session. WHIP is an open specification for a simple signaling protocol for + starting WebRTC sessions in an outgoing direction, (i.e., streaming from your + device). + + There is the primary link only for WHIP, so no backup link. + + **WebRTC stream encoding parameters** + + At least one video and audio track both must be present in the stream: - Video must be encoded with H.264. - - Audio must be encoded with OPUS. Note. Specifically for WebRTC mode a method - of constant transcoding with an initial given resolution is used. This means - that if WebRTC in the end-user's browser decides to reduce the quality or - resolution of the master stream (to let say 360p) due to restrictions on the - end-user's device (network conditions, CPU consumption, etc.), the transcoder - will still continue to transcode the reduced stream to the initial resolution - (let say 1080p ABR). When the restrictions on the end-user's device are - removed, quiality will improve again. **WebRTC WHIP Client** We provide a - convenient WebRTC WHIP library for working in browsers. You can use our - library, or any other you prefer. Simple example of usage is here: - https://stackblitz.com/edit/stackblitz-starters-j2r9ar?file=index.html Also - try to use the feature in UI of the Customer Portal. In the Streaming section - inside the settings of a specific live stream, a new section "Quick start in - browser" has been added. + - Audio must be encoded with OPUS. + + Note. Specifically for WebRTC mode a method of constant transcoding with an + initial given resolution is used. This means that if WebRTC in the end-user's + browser decides to reduce the quality or resolution of the master stream (to let + say 360p) due to restrictions on the end-user's device (network conditions, CPU + consumption, etc.), the transcoder will still continue to transcode the reduced + stream to the initial resolution (let say 1080p ABR). When the restrictions on + the end-user's device are removed, quiality will improve again. + + **WebRTC WHIP Client** + + We provide a convenient WebRTC WHIP library for working in browsers. You can use + our library, or any other you prefer. Simple example of usage is here: + https://stackblitz.com/edit/stackblitz-starters-j2r9ar?file=index.html + + Also try to use the feature in UI of the Customer Portal. In the Streaming + section inside the settings of a specific live stream, a new section "Quick + start in browser" has been added. Please note that 1 connection and 1 protocol can be used at a single moment in time per unique stream key input. Trying to send 2+ connection requests into - `push_url_whip` to once, or 2+ protocols at once will not lead to a result. For - example, transcoding process will fail if: + `push_url_whip` to once, or 2+ protocols at once will not lead to a result. + + For example, transcoding process will fail if: - you are pushing primary and backup WHIP to the same single `push_url_whip` simultaneously @@ -389,7 +452,9 @@ class Stream(BaseModel): """Method of recording a stream. Specifies the source from which the stream will be recorded: original or - transcoded. Types: + transcoded. + + Types: - "origin" – To record RMTP/SRT/etc original clean media source. - "transcoded" – To record the output transcoded version of the stream, @@ -403,10 +468,12 @@ class Stream(BaseModel): """ An instant screenshot taken from a live stream, and available as a static JPEG image. Resolution 1080 pixels wide, or less if the original stream has a lower - resolution. Screenshot is taken every 10 seconds while the stream is live. This - field contains a link to the last screenshot created by the system. Screenshot - history is not stored, so if you need a series of screenshots over time, then - download them. + resolution. + + Screenshot is taken every 10 seconds while the stream is live. This field + contains a link to the last screenshot created by the system. Screenshot history + is not stored, so if you need a series of screenshots over time, then download + them. """ started_at_backup: Optional[str] = None @@ -418,36 +485,40 @@ class Stream(BaseModel): started_at_primary: Optional[str] = None """Time of the last session when main server started receiving the stream. - Datetime in ISO 8601. This means that if the stream was started 1 time, then - here will be the time it was started. If the stream was started several times, - or restarted on your side, then only the time of the last session is displayed - here. + Datetime in ISO 8601. + + This means that if the stream was started 1 time, then here will be the time it + was started. If the stream was started several times, or restarted on your side, + then only the time of the last session is displayed here. """ transcoded_qualities: Optional[List[str]] = None """Array of qualities to which live stream is transcoded""" transcoding_speed: Optional[float] = None - """Speed of transcoding the stream. Mainly it must be 1.0 for real-time processing. + """Speed of transcoding the stream. - May be less than 1.0 if your stream has problems in delivery due to your local - internet provider's conditions, or the stream does not meet stream inbound - requirements. See Knowledge Base for details. + Mainly it must be 1.0 for real-time processing. May be less than 1.0 if your + stream has problems in delivery due to your local internet provider's + conditions, or the stream does not meet stream inbound requirements. See + Knowledge Base for details. """ uri: Optional[str] = None - """ - When using PULL method, this is the URL to pull a stream from. You can specify - multiple addresses separated by a space (" "), so you can organize a backup - plan. In this case, the specified addresses will be selected one by one using - round robin scheduling. If the first address does not respond, then the next one - in the list will be automatically requested, returning to the first and so on in - a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + """When using PULL method, this is the URL to pull a stream from. + + You can specify multiple addresses separated by a space (" "), so you can + organize a backup plan. In this case, the specified addresses will be selected + one by one using round robin scheduling. If the first address does not respond, + then the next one in the list will be automatically requested, returning to the + first and so on in a circle. Also, if the sucessfully working stream stops + sending data, then the next one will be selected according to the same scheme. + + After 2 hours of inactivity of your original stream, the system stops PULL + requests and the stream is deactivated (the "active" field switches to "false"). + + Please, note that this field is for PULL only, so is not suitable for PUSH. Look + at fields "`push_url`" and "`push_url_srt`" from GET method. """ video_height: Optional[float] = None diff --git a/src/gcore/types/streaming/stream_create_clip_params.py b/src/gcore/types/streaming/stream_create_clip_params.py index e8f0b107..5440a13d 100644 --- a/src/gcore/types/streaming/stream_create_clip_params.py +++ b/src/gcore/types/streaming/stream_create_clip_params.py @@ -9,40 +9,51 @@ class StreamCreateClipParams(TypedDict, total=False): duration: Required[int] - """ - Requested segment duration in seconds to be cut. Please, note that cutting is - based on the idea of instantly creating a clip, instead of precise timing. So - final segment may be: + """Requested segment duration in seconds to be cut. + + Please, note that cutting is based on the idea of instantly creating a clip, + instead of precise timing. So final segment may be: - Less than the specified value if there is less data in the DVR than the requested segment. - Greater than the specified value, because segment is aligned to the first and last key frames of already stored fragment in DVR, this way -1 and +1 chunks - can be added to left and right. Duration of cutted segment cannot be greater - than DVR duration for this stream. Therefore, to change the maximum, use - "`dvr_duration`" parameter of this stream. + can be added to left and right. + + Duration of cutted segment cannot be greater than DVR duration for this stream. + Therefore, to change the maximum, use "`dvr_duration`" parameter of this stream. """ expiration: int - """ - Expire time of the clip via a public link. Unix timestamp in seconds, absolute - value. This is the time how long the instant clip will be stored in the server - memory and can be accessed via public HLS/MP4 links. Download and/or use the - instant clip before this time expires. After the time has expired, the clip is - deleted from memory and is no longer available via the link. You need to create - a new segment, or use `vod_required: true` attribute. If value is omitted, then - expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. - `unix timestamp = + + 3600`). Allowed range: 1m <= expiration - <= 4h. Example: + """Expire time of the clip via a public link. + + Unix timestamp in seconds, absolute value. + + This is the time how long the instant clip will be stored in the server memory + and can be accessed via public HLS/MP4 links. Download and/or use the instant + clip before this time expires. + + After the time has expired, the clip is deleted from memory and is no longer + available via the link. You need to create a new segment, or use + `vod_required: true` attribute. + + If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the + end of the clip (i.e. `unix timestamp = + + 3600`). + + Allowed range: 1m <= expiration <= 4h. + + Example: `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` """ start: int - """ - Starting point of the segment to cut. Unix timestamp in seconds, absolute value. - Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value - from the past is specified, it is used as the starting point for the segment to - cut. If the value is omitted, then clip will start from now. + """Starting point of the segment to cut. + + Unix timestamp in seconds, absolute value. Example: + `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` + + If a value from the past is specified, it is used as the starting point for the + segment to cut. If the value is omitted, then clip will start from now. """ vod_required: bool diff --git a/src/gcore/types/streaming/stream_create_params.py b/src/gcore/types/streaming/stream_create_params.py index a8254826..50513e7d 100644 --- a/src/gcore/types/streaming/stream_create_params.py +++ b/src/gcore/types/streaming/stream_create_params.py @@ -10,9 +10,12 @@ class StreamCreateParams(TypedDict, total=False): name: Required[str] - """ - Stream name. Often used as a human-readable name for the stream, but can contain - any text you wish. The values are not unique and may be repeated. Examples: + """Stream name. + + Often used as a human-readable name for the stream, but can contain any text you + wish. The values are not unique and may be repeated. + + Examples: - Conference in July - Stream #10003 @@ -24,8 +27,10 @@ class StreamCreateParams(TypedDict, total=False): """Stream switch between on and off. This is not an indicator of the status "stream is receiving and it is LIVE", but - rather an on/off switch. When stream is switched off, there is no way to process - it: PULL is deactivated and PUSH will return an error. + rather an on/off switch. + + When stream is switched off, there is no way to process it: PULL is deactivated + and PUSH will return an error. - true – stream can be processed - false – stream is off, and cannot be processed @@ -34,9 +39,12 @@ class StreamCreateParams(TypedDict, total=False): auto_record: bool """Enables autotomatic recording of the stream when it started. - So you don't need to call recording manually. Result of recording is - automatically added to video hosting. For details see the - /streams/`start_recording` method and in knowledge base Values: + So you don't need to call recording manually. + + Result of recording is automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base + + Values: - true – auto recording is enabled - false – auto recording is disabled @@ -71,8 +79,11 @@ class StreamCreateParams(TypedDict, total=False): """DVR duration in seconds if DVR feature is enabled for the stream. So this is duration of how far the user can rewind the live stream. - `dvr_duration` range is [30...14400]. Maximum value is 4 hours = 14400 seconds. - If you need more, ask the Support Team please. + + `dvr_duration` range is [30...14400]. + + Maximum value is 4 hours = 14400 seconds. If you need more, ask the Support Team + please. """ dvr_enabled: bool @@ -98,7 +109,9 @@ class StreamCreateParams(TypedDict, total=False): """ Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, - then use parameters of that video player. Modes: + then use parameters of that video player. + + Modes: - regular – regular “flat” stream - vr360 – display stream in 360° mode @@ -128,7 +141,9 @@ class StreamCreateParams(TypedDict, total=False): """Method of recording a stream. Specifies the source from which the stream will be recorded: original or - transcoded. Types: + transcoded. + + Types: - "origin" – To record RMTP/SRT/etc original clean media source. - "transcoded" – To record the output transcoded version of the stream, @@ -136,16 +151,18 @@ class StreamCreateParams(TypedDict, total=False): """ uri: str - """ - When using PULL method, this is the URL to pull a stream from. You can specify - multiple addresses separated by a space (" "), so you can organize a backup - plan. In this case, the specified addresses will be selected one by one using - round robin scheduling. If the first address does not respond, then the next one - in the list will be automatically requested, returning to the first and so on in - a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + """When using PULL method, this is the URL to pull a stream from. + + You can specify multiple addresses separated by a space (" "), so you can + organize a backup plan. In this case, the specified addresses will be selected + one by one using round robin scheduling. If the first address does not respond, + then the next one in the list will be automatically requested, returning to the + first and so on in a circle. Also, if the sucessfully working stream stops + sending data, then the next one will be selected according to the same scheme. + + After 2 hours of inactivity of your original stream, the system stops PULL + requests and the stream is deactivated (the "active" field switches to "false"). + + Please, note that this field is for PULL only, so is not suitable for PUSH. Look + at fields "`push_url`" and "`push_url_srt`" from GET method. """ diff --git a/src/gcore/types/streaming/stream_update_params.py b/src/gcore/types/streaming/stream_update_params.py index ecff938d..da6d8478 100644 --- a/src/gcore/types/streaming/stream_update_params.py +++ b/src/gcore/types/streaming/stream_update_params.py @@ -14,9 +14,12 @@ class StreamUpdateParams(TypedDict, total=False): class Stream(TypedDict, total=False): name: Required[str] - """ - Stream name. Often used as a human-readable name for the stream, but can contain - any text you wish. The values are not unique and may be repeated. Examples: + """Stream name. + + Often used as a human-readable name for the stream, but can contain any text you + wish. The values are not unique and may be repeated. + + Examples: - Conference in July - Stream #10003 @@ -28,8 +31,10 @@ class Stream(TypedDict, total=False): """Stream switch between on and off. This is not an indicator of the status "stream is receiving and it is LIVE", but - rather an on/off switch. When stream is switched off, there is no way to process - it: PULL is deactivated and PUSH will return an error. + rather an on/off switch. + + When stream is switched off, there is no way to process it: PULL is deactivated + and PUSH will return an error. - true – stream can be processed - false – stream is off, and cannot be processed @@ -38,9 +43,12 @@ class Stream(TypedDict, total=False): auto_record: bool """Enables autotomatic recording of the stream when it started. - So you don't need to call recording manually. Result of recording is - automatically added to video hosting. For details see the - /streams/`start_recording` method and in knowledge base Values: + So you don't need to call recording manually. + + Result of recording is automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base + + Values: - true – auto recording is enabled - false – auto recording is disabled @@ -75,8 +83,11 @@ class Stream(TypedDict, total=False): """DVR duration in seconds if DVR feature is enabled for the stream. So this is duration of how far the user can rewind the live stream. - `dvr_duration` range is [30...14400]. Maximum value is 4 hours = 14400 seconds. - If you need more, ask the Support Team please. + + `dvr_duration` range is [30...14400]. + + Maximum value is 4 hours = 14400 seconds. If you need more, ask the Support Team + please. """ dvr_enabled: bool @@ -102,7 +113,9 @@ class Stream(TypedDict, total=False): """ Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, - then use parameters of that video player. Modes: + then use parameters of that video player. + + Modes: - regular – regular “flat” stream - vr360 – display stream in 360° mode @@ -132,7 +145,9 @@ class Stream(TypedDict, total=False): """Method of recording a stream. Specifies the source from which the stream will be recorded: original or - transcoded. Types: + transcoded. + + Types: - "origin" – To record RMTP/SRT/etc original clean media source. - "transcoded" – To record the output transcoded version of the stream, @@ -140,16 +155,18 @@ class Stream(TypedDict, total=False): """ uri: str - """ - When using PULL method, this is the URL to pull a stream from. You can specify - multiple addresses separated by a space (" "), so you can organize a backup - plan. In this case, the specified addresses will be selected one by one using - round robin scheduling. If the first address does not respond, then the next one - in the list will be automatically requested, returning to the first and so on in - a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + """When using PULL method, this is the URL to pull a stream from. + + You can specify multiple addresses separated by a space (" "), so you can + organize a backup plan. In this case, the specified addresses will be selected + one by one using round robin scheduling. If the first address does not respond, + then the next one in the list will be automatically requested, returning to the + first and so on in a circle. Also, if the sucessfully working stream stops + sending data, then the next one will be selected according to the same scheme. + + After 2 hours of inactivity of your original stream, the system stops PULL + requests and the stream is deactivated (the "active" field switches to "false"). + + Please, note that this field is for PULL only, so is not suitable for PUSH. Look + at fields "`push_url`" and "`push_url_srt`" from GET method. """ diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py index 42fff728..9af59437 100644 --- a/src/gcore/types/streaming/video.py +++ b/src/gcore/types/streaming/video.py @@ -26,13 +26,16 @@ class ConvertedVideo(BaseModel): A URL to a rendition file of the specified quality in MP4 format for downloading. - **Download methods** For each converted video, additional download endpoints are - available under `converted_videos`/`mp4_urls`. An MP4 download enpoints: + **Download methods** + + For each converted video, additional download endpoints are available under + `converted_videos`/`mp4_urls`. An MP4 download enpoints: - /videos/{`client_id`}\\__{slug}/{filename}.mp4 - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download - - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download={`custom_filename`} The - first option returns the file as is. Response will be: + - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download={`custom_filename`} + + The first option returns the file as is. Response will be: ``` GET .mp4 @@ -54,7 +57,9 @@ class ConvertedVideo(BaseModel): The third option allows you to set a custom name for the file being downloaded. You can optionally specify a custom filename (just name excluding the .mp4 - extension) using the download= query. Filename constraints: + extension) using the download= query. + + Filename constraints: - Length: 1-255 characters - Must NOT include the .mp4 extension (it is added automatically) @@ -77,40 +82,55 @@ class ConvertedVideo(BaseModel): - Video with custom download filename: `https://demo-public.gvideo.io/videos/2675_1OFgHZ1FWZNNvx1A/qid3567v1_h264_4050_1080.mp4/download=highlights_v1.1_2025-05-30` - **Default MP4 file name structure** Link to the file {filename} contains - information about the encoding method using format: - `___.mp4` + **Default MP4 file name structure** + + Link to the file {filename} contains information about the encoding method using + format: `___.mp4` - `` – Internal quality identifier and file version. Please do not use it, can be changed at any time without any notice. - `` – Codec name that was used to encode the video, or audio codec if it is an audio-only file. - `` – Encoding bitrate in Kbps. - - `` – Video height, or word "audio" if it is an audio-only file. Note - that this link format has been applied since 14.08.2024. If the video entity - was uploaded earlier, links may have old simplified format. Example: - `/videos/{client_id}_{slug}/qid3567v1_h264_4050_1080.mp4` + - `` – Video height, or word "audio" if it is an audio-only file. + + Note that this link format has been applied since 14.08.2024. If the video + entity was uploaded earlier, links may have old simplified format. + + Example: `/videos/{client_id}_{slug}/qid3567v1_h264_4050_1080.mp4` **Dynamic speed limiting** This mode sets different limits for different users or for different types of content. The speed is adjusted based on requests with - the “speed” and “buffer” arguments. Example: `?speed=50k&buffer=500k` Read more - in Product Documentation in CDN section "Network limits". + the “speed” and “buffer” arguments. + + Example: `?speed=50k&buffer=500k` + + Read more in Product Documentation in CDN section "Network limits". + + **Secure token authentication (updated)** + + Access to MP4 download links can be protected using secure tokens passed as + query parameters. The token generation logic has been updated to allow + fine-grained protection per file and bitrate. - **Secure token authentication (updated)** Access to MP4 download links can be - protected using secure tokens passed as query parameters. The token generation - logic has been updated to allow fine-grained protection per file and bitrate. Token generation uses the entire MP4 path, which ensures the token only grants access to a specific quality/version of the video. This prevents unintended - access to other bitrate versions of an ABR stream. Token Query Parameters: + access to other bitrate versions of an ABR stream. + + Token Query Parameters: - token: The generated hash - expires: Expiration timestamp - speed: (optional) Speed limit in bytes/sec, or empty string - - buffer: (optional) Buffer size in bytes, or empty string Optional (for - IP-bound tokens): + - buffer: (optional) Buffer size in bytes, or empty string + + Optional (for IP-bound tokens): + - ip: The user’s IP address Example: - `?md5=QX39c77lbQKvYgMMAvpyMQ&expires=1743167062` Read more in Product - Documentation in Streaming section "Protected temporarily link". + `?md5=QX39c77lbQKvYgMMAvpyMQ&expires=1743167062` + + Read more in Product Documentation in Streaming section "Protected temporarily + link". """ name: Optional[str] = None @@ -178,22 +198,27 @@ class Video(BaseModel): dash_url: Optional[str] = None """ A URL to a master playlist MPEG-DASH (master.mpd) with CMAF or WebM based - chunks. Chunk type will be selected automatically for each quality: + chunks. + + Chunk type will be selected automatically for each quality: - CMAF for H264 and H265 codecs. - WebM for AV1 codec. This URL is a link to the main manifest. But you can also manually specify suffix-options that will allow you to change the manifest to your request: - `/videos/{client_id}_{slug}/master[-min-N][-max-N][-(h264|hevc|av1)].mpd` List - of suffix-options: + `/videos/{client_id}_{slug}/master[-min-N][-max-N][-(h264|hevc|av1)].mpd` + + List of suffix-options: - [-min-N] – ABR soft limitation of qualities from below. - [-max-N] – ABR soft limitation of qualities from above. - [-(h264|hevc|av1) – Video codec soft limitation. Applicable if the video was transcoded into multiple codecs H264, H265 and AV1 at once, but you want to return just 1 video codec in a manifest. Read the Product Documentation for - details. Read more what is ABR soft-limiting in the "`hls_url`" field above. + details. + + Read more what is ABR soft-limiting in the "`hls_url`" field above. Caution. Solely master.mpd is officially documented and intended for your use. Any additional internal manifests, sub-manifests, parameters, chunk names, file @@ -234,9 +259,9 @@ class Video(BaseModel): """ hls_url: Optional[str] = None - """ - A URL to a master playlist HLS (master.m3u8). Chunk type will be selected - automatically: + """A URL to a master playlist HLS (master.m3u8). + + Chunk type will be selected automatically: - TS if your video was encoded to H264 only. - CMAF if your video was encoded additionally to H265 and/or AV1 codecs (as @@ -246,6 +271,7 @@ class Video(BaseModel): You can also manually specify suffix-options that will allow you to change the manifest to your request: `/videos/{client_id}_{video_slug}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` + List of suffix-options: - [-cmaf] – getting HLS CMAF version of the manifest. Look at the `hls_cmaf_url` @@ -257,12 +283,15 @@ class Video(BaseModel): - [-(h264|hevc|av1) – Video codec soft limitation. Applicable if the video was transcoded into multiple codecs H264, H265 and AV1 at once, but you want to return just 1 video codec in a manifest. Read the Product Documentation for - details. ABR soft-limiting: Soft limitation of the list of qualities allows - you to return not the entire list of transcoded qualities for a video, but - only those you need. For more details look at the Product Documentation. For - example, the video is available in 7 qualities from 360p to 4K, but you want - to return not more than 480p only due to the conditions of distribution of - content to a specific end-user (i.e. free account): + details. + + ABR soft-limiting: Soft limitation of the list of qualities allows you to return + not the entire list of transcoded qualities for a video, but only those you + need. For more details look at the Product Documentation. For example, the video + is available in 7 qualities from 360p to 4K, but you want to return not more + than 480p only due to the conditions of distribution of content to a specific + end-user (i.e. free account): + - To a generic `.../master.m3u8` manifest - Add a suffix-option to limit quality `.../master-max-480.m3u8` - Add a suffix-option to limit quality and codec @@ -280,24 +309,32 @@ class Video(BaseModel): """A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will - automatically play in all browsers. The player can be opened or shared via this - direct link. Also the video player can be integrated into your web pages using - the Iframe tag. Example of usage on a web page: + automatically play in all browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. + + Example of usage on a web page: + There are some link modificators you can specify and add manually: - - ?`no_low_latency` – player is forced to use non-low-latency streams HLS MPEG-TS, instead of MPEG-DASH CMAF or HLS/LL-HLS CMAF. - - ?t=(integer) – time to start playback from specified point in the video. Applicable for VOD only. - - ?`sub_lang`=(language) – force subtitles to specific language (2 letters ISO 639 code of a language). + + - ?`no_low_latency` – player is forced to use non-low-latency streams HLS + MPEG-TS, instead of MPEG-DASH CMAF or HLS/LL-HLS CMAF. + - ?t=(integer) – time to start playback from specified point in the video. + Applicable for VOD only. + - ?`sub_lang`=(language) – force subtitles to specific language (2 letters ISO + 639 code of a language). - Read more in the Product Documentation. """ name: Optional[str] = None - """ - Title of the video. Often used as a human-readable name of the video, but can - contain any text you wish. The values are not unique and may be repeated. - Examples: + """Title of the video. + + Often used as a human-readable name of the video, but can contain any text you + wish. The values are not unique and may be repeated. Examples: - Educational training 2024-03-29 - Series X S3E14, The empire strikes back @@ -308,28 +345,42 @@ class Video(BaseModel): """Size of original file""" origin_url: Optional[str] = None - """ - URL to an original file from which the information for transcoding was taken. + """URL to an original file from which the information for transcoding was taken. + May contain a link for scenarios: - If the video was downloaded from another origin - If the video is a recording of a live stream - - Otherwise it is "null" **Copy from another server** URL to an original file - that was downloaded. Look at method "Copy from another server" in POST - /videos. **Recording of an original live stream** URL to the original - non-transcoded stream recording with original quality, saved in MP4 format. - File is created immediately after the completion of the stream recording. The - stream from which the recording was made is reflected in "`stream_id`" field. - Can be used for internal operations when a recording needs to be received - faster than the transcoded versions are ready. But this version is not - intended for public distribution. Views and downloads occur in the usual way, - like viewing an MP4 rendition. The MP4 file becomes available for downloading - when the video entity "status" changes from "new" to "pending". The file is - stored for 7 days, after which it will be automatically deleted. Format of URL - is `/videos/_/origin__.mp4` Where: + - Otherwise it is "null" + + **Copy from another server** + + URL to an original file that was downloaded. Look at method "Copy from another + server" in POST /videos. + + **Recording of an original live stream** + + URL to the original non-transcoded stream recording with original quality, saved + in MP4 format. File is created immediately after the completion of the stream + recording. The stream from which the recording was made is reflected in + "`stream_id`" field. + + Can be used for internal operations when a recording needs to be received faster + than the transcoded versions are ready. But this version is not intended for + public distribution. Views and downloads occur in the usual way, like viewing an + MP4 rendition. + + The MP4 file becomes available for downloading when the video entity "status" + changes from "new" to "pending". The file is stored for 7 days, after which it + will be automatically deleted. + + Format of URL is `/videos/_/origin__.mp4` Where: + - `` – Encoding bitrate in Kbps. - - `` – Video height. This is a premium feature, available only upon - request through your manager or support team. + - `` – Video height. + + This is a premium feature, available only upon request through your manager or + support team. """ origin_video_duration: Optional[int] = None @@ -338,8 +389,11 @@ class Video(BaseModel): poster: Optional[str] = None """ Poster is your own static image which can be displayed before the video begins - playing. This is often a frame of the video or a custom title screen. Field - contains a link to your own uploaded image. Also look at "screenshot" attribute. + playing. This is often a frame of the video or a custom title screen. + + Field contains a link to your own uploaded image. + + Also look at "screenshot" attribute. """ poster_thumb: Optional[str] = None @@ -371,29 +425,34 @@ class Video(BaseModel): The image is selected from an array of all screenshots based on the “`screenshot_id`” attribute. If you use your own "poster", the link to it will - be here too. Our video player uses this field to display the static image before - the video starts playing. As soon as the user hits "play" the image will go - away. If you use your own external video player, then you can use the value of - this field to set the poster/thumbnail in your player. Example: + be here too. + + Our video player uses this field to display the static image before the video + starts playing. As soon as the user hits "play" the image will go away. If you + use your own external video player, then you can use the value of this field to + set the poster/thumbnail in your player. + + Example: - `video_js`.poster: `api.screenshot` - clappr.poster: `api.screenshot` """ screenshot_id: Optional[int] = None - """ - ID of auto generated screenshots to be used for default screenshot. Counting - from 0. A value of -1 sets the "screenshot" attribute to the URL of your own - image from the "poster" attribute. + """ID of auto generated screenshots to be used for default screenshot. + + Counting from 0. A value of -1 sets the "screenshot" attribute to the URL of + your own image from the "poster" attribute. """ screenshots: Optional[List[str]] = None """Array of auto generated screenshots from the video. By default 5 static screenshots are taken from different places in the video. If - the video is short, there may be fewer screenshots. Screenshots are created - automatically, so they may contain not very good frames from the video. To use - your own image look at "poster" attribute. + the video is short, there may be fewer screenshots. + + Screenshots are created automatically, so they may contain not very good frames + from the video. To use your own image look at "poster" attribute. """ share_url: Optional[str] = None @@ -407,7 +466,10 @@ class Video(BaseModel): """ A unique alphanumeric identifier used in public URLs to retrieve and view the video. It is unique for each video, generated randomly and set automatically by - the system. Format of usage in URL is \\**.../videos/{`client_id`}\\__{slug}/...\\** + the system. + + Format of usage in URL is \\**.../videos/{`client_id`}\\__{slug}/...\\** + Example: - Player: /videos/`12345_neAq1bYZ2` diff --git a/src/gcore/types/streaming/video_list_params.py b/src/gcore/types/streaming/video_list_params.py index 2a7e4e9a..91cc9504 100644 --- a/src/gcore/types/streaming/video_list_params.py +++ b/src/gcore/types/streaming/video_list_params.py @@ -38,8 +38,10 @@ class VideoListParams(TypedDict, total=False): If set, the video list is filtered by one combined SQL criterion: - - id={s} OR slug={s} OR name like {s} i.e. "/videos?search=1000" returns list of - videos where id=1000 or slug=1000 or name contains "1000". + - id={s} OR slug={s} OR name like {s} + + i.e. "/videos?search=1000" returns list of videos where id=1000 or slug=1000 or + name contains "1000". """ status: str diff --git a/src/gcore/types/streaming/video_update_params.py b/src/gcore/types/streaming/video_update_params.py index db5ed39f..d1ad1c8a 100644 --- a/src/gcore/types/streaming/video_update_params.py +++ b/src/gcore/types/streaming/video_update_params.py @@ -12,7 +12,9 @@ class VideoUpdateParams(TypedDict, total=False): """Video name""" auto_transcribe_audio_language: Literal["disable", "auto", ""] - """Automatic creation of subtitles by transcribing the audio track. Values: + """Automatic creation of subtitles by transcribing the audio track. + + Values: - disable – Do not transcribe. - auto – Automatically detects the activation of the option based on the @@ -22,7 +24,9 @@ class VideoUpdateParams(TypedDict, total=False): language spoken in the audio track, or when auto language detection fails. Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). List of languages is available in `audio_language` - attribute of API POST /streaming/ai/transcribe . Example: + attribute of API POST /streaming/ai/transcribe . + + Example: ``` auto_transcribe_audio_language: "auto" @@ -41,16 +45,23 @@ class VideoUpdateParams(TypedDict, total=False): """Automatic translation of auto-transcribed subtitles to the specified language(s). - Can be used both together with `auto_transcribe_audio_language` option only. Use - it when you want to make automatic subtitles in languages other than the - original language in audio. Values: + Can be used both together with `auto_transcribe_audio_language` option only. + + Use it when you want to make automatic subtitles in languages other than the + original language in audio. + + Values: - disable – Do not translate. - default – There are 3 default languages: eng,fre,ger - \\ – Explicit language to translate to, or list of languages separated by a comma. Look at list of available languages in description of AI ASR task - creation. If several languages are specified for translation, a separate - subtitle will be generated for each language. Example: + creation. + + If several languages are specified for translation, a separate subtitle will be + generated for each language. + + Example: ``` auto_translate_subtitles_language: default @@ -79,9 +90,10 @@ class VideoUpdateParams(TypedDict, total=False): """ custom_iframe_url: str - """ - Deprecated. Custom URL of IFrame for video player to be used in share panel in - player. Auto generated IFrame URL provided by default + """Deprecated. + + Custom URL of IFrame for video player to be used in share panel in player. Auto + generated IFrame URL provided by default """ description: str @@ -94,8 +106,11 @@ class VideoUpdateParams(TypedDict, total=False): """Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file - (specified in "`origin_url`" parameter) on an external server. Syntax: - `Authorization: ` Examples: + (specified in "`origin_url`" parameter) on an external server. + + Syntax: `Authorization: ` + + Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -121,16 +136,21 @@ class VideoUpdateParams(TypedDict, total=False): """ poster: str - """ - Poster is your own static image which can be displayed before the video starts. + """Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own image. Also use attribute "`screenshot_id`" to select poster as a default - screnshot. Attribute accepts single image as base64-encoded string + screnshot. + + Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, - image/webp, and image/png and file sizes up to 1Mb. Examples: + format: `data:[];base64,` + + MIME-types are image/jpeg, image/webp, and image/png and file sizes up to 1Mb. + + Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` @@ -141,13 +161,16 @@ class VideoUpdateParams(TypedDict, total=False): """ Priority allows you to adjust the urgency of processing some videos before others in your account, if your algorithm requires it. For example, when there - are very urgent video and some regular ones that can wait in the queue. Value - range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest - up-priority. Default priority is 0. + are very urgent video and some regular ones that can wait in the queue. + + Value range, integer [-10..10]. -10 is the lowest down-priority, 10 is the + highest up-priority. Default priority is 0. """ projection: str - """Deprecated. Regulates the video format: + """Deprecated. + + Regulates the video format: - **regular** — plays the video as usual - **vr360** — plays the video in 360 degree mode @@ -166,28 +189,34 @@ class VideoUpdateParams(TypedDict, total=False): remote_poster_url: str """ Poster URL to download from external resource, instead of uploading via "poster" - attribute. It has the same restrictions as "poster" attribute. + attribute. + + It has the same restrictions as "poster" attribute. """ remove_poster: bool """Set it to true to remove poster""" screenshot_id: int - """ - Default screenshot index. Specify an ID from the "screenshots" array, so that - the URL of the required screenshot appears in the "screenshot" attribute as the - default screenshot. By default 5 static screenshots will be taken from different - places in the video after transcoding. If the video is short, there may be fewer - screenshots. Counting from 0. A value of -1 sets the default screenshot to the - URL of your own image from the "poster" attribute. Look at "screenshot" - attribute in GET /videos/{`video_id`} for details. + """Default screenshot index. + + Specify an ID from the "screenshots" array, so that the URL of the required + screenshot appears in the "screenshot" attribute as the default screenshot. By + default 5 static screenshots will be taken from different places in the video + after transcoding. If the video is short, there may be fewer screenshots. + + Counting from 0. A value of -1 sets the default screenshot to the URL of your + own image from the "poster" attribute. + + Look at "screenshot" attribute in GET /videos/{`video_id`} for details. """ share_url: str - """ - Deprecated. Custom URL or iframe displayed in the link field when a user clicks - on a sharing button in player. If empty, the link field and social network - sharing is disabled + """Deprecated. + + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled """ source_bitrate_limit: bool @@ -200,16 +229,19 @@ class VideoUpdateParams(TypedDict, total=False): By default `source_bitrate_limit: true` this option allows you to have the output bitrate not more than in the original video, thus to transcode video faster and to deliver it to end-viewers faster as well. At the same time, the - quality will be similar to the original. If for some reason you need more - byte-space in the output quality when encoding, you can set this option to - `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will - be raised from the bitrate of the original video to the maximum possible limit - specified in our the Product Documentation. For example, this may be needed - when: + quality will be similar to the original. + + If for some reason you need more byte-space in the output quality when encoding, + you can set this option to `source_bitrate_limit: false`. Then, when + transcoding, the quality ceiling will be raised from the bitrate of the original + video to the maximum possible limit specified in our the Product Documentation. + For example, this may be needed when: - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, - to improve the picture quality on dynamic scenes, - - etc. The option is applied only at the video creation stage and cannot be - changed later. If you want to re-transcode the video using new value, then you - need to create and upload a new video only. + - etc. + + The option is applied only at the video creation stage and cannot be changed + later. If you want to re-transcode the video using new value, then you need to + create and upload a new video only. """ diff --git a/src/gcore/types/waap/domains/advanced_rule_create_params.py b/src/gcore/types/waap/domains/advanced_rule_create_params.py index 019e227a..e761c89f 100644 --- a/src/gcore/types/waap/domains/advanced_rule_create_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_create_params.py @@ -27,7 +27,9 @@ class AdvancedRuleCreateParams(TypedDict, total=False): """A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, - `user_defined_tags`, `user_agent`, `client_data`. More info can be found here: + `user_defined_tags`, `user_agent`, `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules """ @@ -35,13 +37,16 @@ class AdvancedRuleCreateParams(TypedDict, total=False): """The description assigned to the rule""" phase: Optional[Literal["access", "header_filter", "body_filter"]] - """The WAAP request/response phase for applying the rule. + """The WAAP request/response phase for applying the rule. Default is "access". + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. - Default is "access". The "access" phase is responsible for modifying the request - before it is sent to the origin server. The "`header_filter`" phase is - responsible for modifying the HTTP headers of a response before they are sent - back to the client. The "`body_filter`" phase is responsible for modifying the - body of a response before it is sent back to the client. + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. """ diff --git a/src/gcore/types/waap/domains/advanced_rule_list_params.py b/src/gcore/types/waap/domains/advanced_rule_list_params.py index 385857d7..dfa975c3 100644 --- a/src/gcore/types/waap/domains/advanced_rule_list_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_list_params.py @@ -46,11 +46,14 @@ class AdvancedRuleListParams(TypedDict, total=False): """Determine the field to order results by""" phase: Literal["access", "header_filter", "body_filter"] - """ - Filter rules based on the WAAP request/response phase for applying the rule. The - "access" phase is responsible for modifying the request before it is sent to the - origin server. The "`header_filter`" phase is responsible for modifying the HTTP - headers of a response before they are sent back to the client. The - "`body_filter`" phase is responsible for modifying the body of a response before - it is sent back to the client. + """Filter rules based on the WAAP request/response phase for applying the rule. + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. """ diff --git a/src/gcore/types/waap/domains/advanced_rule_update_params.py b/src/gcore/types/waap/domains/advanced_rule_update_params.py index 90e297cb..d77ee76e 100644 --- a/src/gcore/types/waap/domains/advanced_rule_update_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_update_params.py @@ -27,20 +27,25 @@ class AdvancedRuleUpdateParams(TypedDict, total=False): """The name assigned to the rule""" phase: Optional[Literal["access", "header_filter", "body_filter"]] - """ - The WAAP request/response phase for applying the rule. The "access" phase is - responsible for modifying the request before it is sent to the origin server. + """The WAAP request/response phase for applying the rule. + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + The "`header_filter`" phase is responsible for modifying the HTTP headers of a - response before they are sent back to the client. The "`body_filter`" phase is - responsible for modifying the body of a response before it is sent back to the - client. + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. """ source: Optional[str] """A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, - `user_defined_tags`, `user_agent`, `client_data`. More info can be found here: + `user_defined_tags`, `user_agent`, `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules """ diff --git a/src/gcore/types/waap/domains/waap_advanced_rule.py b/src/gcore/types/waap/domains/waap_advanced_rule.py index d9160d4c..c9c4529a 100644 --- a/src/gcore/types/waap/domains/waap_advanced_rule.py +++ b/src/gcore/types/waap/domains/waap_advanced_rule.py @@ -69,7 +69,9 @@ class WaapAdvancedRule(BaseModel): """A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, - `user_defined_tags`, `user_agent`, `client_data`. More info can be found here: + `user_defined_tags`, `user_agent`, `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules """ @@ -77,11 +79,14 @@ class WaapAdvancedRule(BaseModel): """The description assigned to the rule""" phase: Optional[Literal["access", "header_filter", "body_filter"]] = None - """The WAAP request/response phase for applying the rule. + """The WAAP request/response phase for applying the rule. Default is "access". + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. - Default is "access". The "access" phase is responsible for modifying the request - before it is sent to the origin server. The "`header_filter`" phase is - responsible for modifying the HTTP headers of a response before they are sent - back to the client. The "`body_filter`" phase is responsible for modifying the - body of a response before it is sent back to the client. + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. """ From fcdb0b70aa0144cc22ae31663d9ac1f4e696ce5a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 19:27:49 +0000 Subject: [PATCH 328/592] chore: improve example values --- tests/api_resources/cloud/baremetal/test_servers.py | 8 ++++---- tests/api_resources/cloud/k8s/test_clusters.py | 8 ++++---- .../api_resources/cloud/load_balancers/test_listeners.py | 8 ++++---- tests/api_resources/cloud/test_load_balancers.py | 4 ++-- tests/api_resources/cloud/users/test_role_assignments.py | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index 355896d0..7482ef7b 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -51,9 +51,9 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "fields": [ { "base_field": 10, - "field_name": "field_name", + "field_name": None, "field_value": [45046, 45047], - "value": "value", + "value": None, } ], }, @@ -255,9 +255,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "fields": [ { "base_field": 10, - "field_name": "field_name", + "field_name": None, "field_value": [45046, 45047], - "value": "value", + "value": None, } ], }, diff --git a/tests/api_resources/cloud/k8s/test_clusters.py b/tests/api_resources/cloud/k8s/test_clusters.py index 1cb521cd..219f9e08 100644 --- a/tests/api_resources/cloud/k8s/test_clusters.py +++ b/tests/api_resources/cloud/k8s/test_clusters.py @@ -100,7 +100,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: { "base_field": 10, "field_value": [45046, 45047], - "value": "value", + "value": None, } ], "profile_template": 29, @@ -216,7 +216,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: { "base_field": 10, "field_value": [45046, 45047], - "value": "value", + "value": None, } ], "profile_template": 29, @@ -675,7 +675,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> { "base_field": 10, "field_value": [45046, 45047], - "value": "value", + "value": None, } ], "profile_template": 29, @@ -791,7 +791,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> { "base_field": 10, "field_value": [45046, 45047], - "value": "value", + "value": None, } ], "profile_template": 29, diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index ac026380..2605c9f6 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -45,7 +45,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: sni_secret_id=["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], timeout_client_data=50000, timeout_member_connect=50000, - timeout_member_data=0, + timeout_member_data=None, user_list=[ { "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", @@ -111,7 +111,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: sni_secret_id=["af4a64e7-03ca-470f-9a09-b77d54c5abd8", "12b43d95-d420-4c79-a883-49bf146cbdff"], timeout_client_data=50000, timeout_member_connect=50000, - timeout_member_data=0, + timeout_member_data=None, user_list=[ { "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", @@ -338,7 +338,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> sni_secret_id=["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], timeout_client_data=50000, timeout_member_connect=50000, - timeout_member_data=0, + timeout_member_data=None, user_list=[ { "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", @@ -404,7 +404,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> sni_secret_id=["af4a64e7-03ca-470f-9a09-b77d54c5abd8", "12b43d95-d420-4c79-a883-49bf146cbdff"], timeout_client_data=50000, timeout_member_connect=50000, - timeout_member_data=0, + timeout_member_data=None, user_list=[ { "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index f1ba8d09..85a8fdb7 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -106,7 +106,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "sni_secret_id": ["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], "timeout_client_data": 50000, "timeout_member_connect": 50000, - "timeout_member_data": 0, + "timeout_member_data": None, "user_list": [ { "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", @@ -574,7 +574,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "sni_secret_id": ["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], "timeout_client_data": 50000, "timeout_member_connect": 50000, - "timeout_member_data": 0, + "timeout_member_data": None, "user_list": [ { "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", diff --git a/tests/api_resources/cloud/users/test_role_assignments.py b/tests/api_resources/cloud/users/test_role_assignments.py index 2c74e087..d4ffeb4c 100644 --- a/tests/api_resources/cloud/users/test_role_assignments.py +++ b/tests/api_resources/cloud/users/test_role_assignments.py @@ -35,7 +35,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: role="ClientAdministrator", user_id=777, client_id=8, - project_id=0, + project_id=None, ) assert_matches_type(RoleAssignment, role_assignment, path=["response"]) @@ -81,7 +81,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: role="ClientAdministrator", user_id=777, client_id=8, - project_id=0, + project_id=None, ) assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) @@ -199,7 +199,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> role="ClientAdministrator", user_id=777, client_id=8, - project_id=0, + project_id=None, ) assert_matches_type(RoleAssignment, role_assignment, path=["response"]) @@ -245,7 +245,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> role="ClientAdministrator", user_id=777, client_id=8, - project_id=0, + project_id=None, ) assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) From fbccec2934971cd5945f0a69d727c8e40125ac02 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Sep 2025 09:00:09 +0000 Subject: [PATCH 329/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index bf3f4fca..9d77d289 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e543fc395c453a5bb59daf3463c5bbaf7fde7a7ffc957225eb2986c35d2c97ed.yml openapi_spec_hash: b4be9c9d643d7d20c45dcffe381d1595 -config_hash: cd9ebeaa0d08830a9e995e37db3cd6e1 +config_hash: fee4391924d7ea28b2bb5e5d81c8778f From 5e20f9470393896535b7397640d228abe3a7ae2e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Sep 2025 12:14:58 +0000 Subject: [PATCH 330/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cloud/k8s/clusters/clusters.py | 16 ++++++ .../cloud/k8s/clusters/pools/pools.py | 4 +- .../types/cloud/k8s/cluster_create_params.py | 40 +++++++++++++ .../types/cloud/k8s/cluster_update_params.py | 56 ++++++++++++++++++- .../cloud/k8s/clusters/pool_update_params.py | 2 +- src/gcore/types/cloud/k8s/k8s_cluster.py | 36 ++++++++++++ .../api_resources/cloud/k8s/test_clusters.py | 32 +++++++++++ 8 files changed, 183 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9d77d289..3932b1fa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e543fc395c453a5bb59daf3463c5bbaf7fde7a7ffc957225eb2986c35d2c97ed.yml -openapi_spec_hash: b4be9c9d643d7d20c45dcffe381d1595 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-71ebc8da15fdc297934029972bf2536f4abc6a167b38df66cf8c3f5a0d69bf4a.yml +openapi_spec_hash: ac7c9a26fa95888ecb41f32b35f9a7ec config_hash: fee4391924d7ea28b2bb5e5d81c8778f diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index 3e3f3398..cda6a936 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -86,6 +86,7 @@ def create( name: str, pools: Iterable[cluster_create_params.Pool], version: str, + add_ons: cluster_create_params.AddOns | Omit = omit, authentication: Optional[cluster_create_params.Authentication] | Omit = omit, autoscaler_config: Optional[Dict[str, str]] | Omit = omit, cni: Optional[cluster_create_params.Cni] | Omit = omit, @@ -118,6 +119,8 @@ def create( version: The version of the k8s cluster + add_ons: Cluster add-ons configuration + authentication: Authentication settings autoscaler_config: Cluster autoscaler configuration. @@ -220,6 +223,7 @@ def create( "name": name, "pools": pools, "version": version, + "add_ons": add_ons, "authentication": authentication, "autoscaler_config": autoscaler_config, "cni": cni, @@ -248,6 +252,7 @@ def update( *, project_id: int | None = None, region_id: int | None = None, + add_ons: cluster_update_params.AddOns | Omit = omit, authentication: Optional[cluster_update_params.Authentication] | Omit = omit, autoscaler_config: Optional[Dict[str, str]] | Omit = omit, cni: Optional[cluster_update_params.Cni] | Omit = omit, @@ -264,6 +269,8 @@ def update( Update k8s cluster Args: + add_ons: Cluster add-ons configuration + authentication: Authentication settings autoscaler_config: Cluster autoscaler configuration. @@ -348,6 +355,7 @@ def update( f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=maybe_transform( { + "add_ons": add_ons, "authentication": authentication, "autoscaler_config": autoscaler_config, "cni": cni, @@ -681,6 +689,7 @@ async def create( name: str, pools: Iterable[cluster_create_params.Pool], version: str, + add_ons: cluster_create_params.AddOns | Omit = omit, authentication: Optional[cluster_create_params.Authentication] | Omit = omit, autoscaler_config: Optional[Dict[str, str]] | Omit = omit, cni: Optional[cluster_create_params.Cni] | Omit = omit, @@ -713,6 +722,8 @@ async def create( version: The version of the k8s cluster + add_ons: Cluster add-ons configuration + authentication: Authentication settings autoscaler_config: Cluster autoscaler configuration. @@ -815,6 +826,7 @@ async def create( "name": name, "pools": pools, "version": version, + "add_ons": add_ons, "authentication": authentication, "autoscaler_config": autoscaler_config, "cni": cni, @@ -843,6 +855,7 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, + add_ons: cluster_update_params.AddOns | Omit = omit, authentication: Optional[cluster_update_params.Authentication] | Omit = omit, autoscaler_config: Optional[Dict[str, str]] | Omit = omit, cni: Optional[cluster_update_params.Cni] | Omit = omit, @@ -859,6 +872,8 @@ async def update( Update k8s cluster Args: + add_ons: Cluster add-ons configuration + authentication: Authentication settings autoscaler_config: Cluster autoscaler configuration. @@ -943,6 +958,7 @@ async def update( f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=await async_maybe_transform( { + "add_ons": add_ons, "authentication": authentication, "autoscaler_config": autoscaler_config, "cni": cni, diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 18e410c3..72cb9321 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -187,7 +187,7 @@ def update( min_node_count: Minimum node count - node_count: Current node count + node_count: This field is deprecated. Please use the cluster pool resize handler instead. taints: Taints applied to the cluster pool @@ -549,7 +549,7 @@ async def update( min_node_count: Minimum node count - node_count: Current node count + node_count: This field is deprecated. Please use the cluster pool resize handler instead. taints: Taints applied to the cluster pool diff --git a/src/gcore/types/cloud/k8s/cluster_create_params.py b/src/gcore/types/cloud/k8s/cluster_create_params.py index d0b1050e..c49852c6 100644 --- a/src/gcore/types/cloud/k8s/cluster_create_params.py +++ b/src/gcore/types/cloud/k8s/cluster_create_params.py @@ -5,11 +5,14 @@ from typing import Dict, List, Iterable, Optional from typing_extensions import Literal, Required, TypedDict +from ...._types import SequenceNotStr from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam __all__ = [ "ClusterCreateParams", "Pool", + "AddOns", + "AddOnsSlurm", "Authentication", "AuthenticationOidc", "Cni", @@ -39,6 +42,9 @@ class ClusterCreateParams(TypedDict, total=False): version: Required[str] """The version of the k8s cluster""" + add_ons: AddOns + """Cluster add-ons configuration""" + authentication: Optional[Authentication] """Authentication settings""" @@ -177,6 +183,40 @@ class Pool(TypedDict, total=False): """Taints applied to the cluster pool""" +class AddOnsSlurm(TypedDict, total=False): + enabled: Required[Literal[True]] + """The Slurm add-on will be enabled in the cluster. + + This add-on is only supported in clusters running Kubernetes v1.31 and v1.32 + with at least 1 GPU cluster pool and VAST NFS support enabled. + """ + + file_share_id: Required[str] + """ID of a VAST file share to be used as Slurm storage. + + The Slurm add-on will create separate Persistent Volume Claims for different + purposes (controller spool, worker spool, jail) on that file share. + + The file share must have `root_squash` disabled, while `path_length` and + `allowed_characters` settings must be set to `NPL`. + """ + + ssh_key_ids: Required[SequenceNotStr[str]] + """IDs of SSH keys to authorize for SSH connection to Slurm login nodes.""" + + worker_count: Required[int] + """Size of the worker pool, i.e. the number of Slurm worker nodes. + + Each Slurm worker node will be backed by a Pod scheduled on one of cluster's GPU + nodes. + """ + + +class AddOns(TypedDict, total=False): + slurm: AddOnsSlurm + """Slurm add-on configuration""" + + class AuthenticationOidc(TypedDict, total=False): client_id: Optional[str] """Client ID""" diff --git a/src/gcore/types/cloud/k8s/cluster_update_params.py b/src/gcore/types/cloud/k8s/cluster_update_params.py index 32011180..01670802 100644 --- a/src/gcore/types/cloud/k8s/cluster_update_params.py +++ b/src/gcore/types/cloud/k8s/cluster_update_params.py @@ -2,13 +2,18 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional -from typing_extensions import Literal, Required, TypedDict +from typing import Dict, List, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict +from ...._types import SequenceNotStr from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam __all__ = [ "ClusterUpdateParams", + "AddOns", + "AddOnsSlurm", + "AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer", + "AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer", "Authentication", "AuthenticationOidc", "Cni", @@ -24,6 +29,9 @@ class ClusterUpdateParams(TypedDict, total=False): region_id: int + add_ons: AddOns + """Cluster add-ons configuration""" + authentication: Optional[Authentication] """Authentication settings""" @@ -97,6 +105,50 @@ class ClusterUpdateParams(TypedDict, total=False): """Logging configuration""" +class AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer(TypedDict, total=False): + enabled: Required[Literal[True]] + """The Slurm add-on will be enabled in the cluster. + + This add-on is only supported in clusters running Kubernetes v1.31 and v1.32 + with at least 1 GPU cluster pool and VAST NFS support enabled. + """ + + file_share_id: Required[str] + """ID of a VAST file share to be used as Slurm storage. + + The Slurm add-on will create separate Persistent Volume Claims for different + purposes (controller spool, worker spool, jail) on that file share. + + The file share must have `root_squash` disabled, while `path_length` and + `allowed_characters` settings must be set to `NPL`. + """ + + ssh_key_ids: Required[SequenceNotStr[str]] + """IDs of SSH keys to authorize for SSH connection to Slurm login nodes.""" + + worker_count: Required[int] + """Size of the worker pool, i.e. the number of Slurm worker nodes. + + Each Slurm worker node will be backed by a Pod scheduled on one of cluster's GPU + nodes. + """ + + +class AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer(TypedDict, total=False): + enabled: Required[bool] + """The Slurm add-on will be disabled in the cluster.""" + + +AddOnsSlurm: TypeAlias = Union[ + AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer, AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer +] + + +class AddOns(TypedDict, total=False): + slurm: AddOnsSlurm + """Slurm add-on configuration""" + + class AuthenticationOidc(TypedDict, total=False): client_id: Optional[str] """Client ID""" diff --git a/src/gcore/types/cloud/k8s/clusters/pool_update_params.py b/src/gcore/types/cloud/k8s/clusters/pool_update_params.py index 877e80ca..16a46ed7 100644 --- a/src/gcore/types/cloud/k8s/clusters/pool_update_params.py +++ b/src/gcore/types/cloud/k8s/clusters/pool_update_params.py @@ -28,7 +28,7 @@ class PoolUpdateParams(TypedDict, total=False): """Minimum node count""" node_count: Optional[int] - """Current node count""" + """This field is deprecated. Please use the cluster pool resize handler instead.""" taints: Optional[Dict[str, str]] """Taints applied to the cluster pool""" diff --git a/src/gcore/types/cloud/k8s/k8s_cluster.py b/src/gcore/types/cloud/k8s/k8s_cluster.py index 1df10feb..a93825fd 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster.py @@ -10,6 +10,8 @@ __all__ = [ "K8sCluster", + "AddOns", + "AddOnsSlurm", "Csi", "CsiNfs", "Authentication", @@ -21,6 +23,37 @@ ] +class AddOnsSlurm(BaseModel): + enabled: bool + """Indicates whether Slurm add-on is deployed in the cluster. + + This add-on is only supported in clusters running Kubernetes v1.31 and v1.32 + with at least 1 GPU cluster pool. + """ + + file_share_id: Optional[str] = None + """ID of a VAST file share used as Slurm storage. + + The Slurm add-on creates separate Persistent Volume Claims for different + purposes (controller spool, worker spool, jail) on that file share. + """ + + ssh_key_ids: Optional[List[str]] = None + """IDs of SSH keys authorized for SSH connection to Slurm login nodes.""" + + worker_count: Optional[int] = None + """Size of the worker pool, i.e. number of worker nodes. + + Each Slurm worker node is backed by a Pod scheduled on one of cluster's GPU + nodes. + """ + + +class AddOns(BaseModel): + slurm: AddOnsSlurm + """Slurm add-on configuration""" + + class CsiNfs(BaseModel): vast_enabled: bool """Indicates the status of VAST NFS integration""" @@ -135,6 +168,9 @@ class K8sCluster(BaseModel): id: str """Cluster pool uuid""" + add_ons: AddOns + """Cluster add-ons configuration""" + created_at: str """Function creation date""" diff --git a/tests/api_resources/cloud/k8s/test_clusters.py b/tests/api_resources/cloud/k8s/test_clusters.py index 219f9e08..800f7316 100644 --- a/tests/api_resources/cloud/k8s/test_clusters.py +++ b/tests/api_resources/cloud/k8s/test_clusters.py @@ -66,6 +66,14 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: } ], version="1.28.1", + add_ons={ + "slurm": { + "enabled": True, + "file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c", + "ssh_key_ids": ["25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7"], + "worker_count": 2, + } + }, authentication={ "oidc": { "client_id": "kubernetes", @@ -183,6 +191,14 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: cluster_name="cluster_name", project_id=0, region_id=0, + add_ons={ + "slurm": { + "enabled": True, + "file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c", + "ssh_key_ids": ["25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7"], + "worker_count": 2, + } + }, authentication={ "oidc": { "client_id": "kubernetes", @@ -641,6 +657,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> } ], version="1.28.1", + add_ons={ + "slurm": { + "enabled": True, + "file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c", + "ssh_key_ids": ["25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7"], + "worker_count": 2, + } + }, authentication={ "oidc": { "client_id": "kubernetes", @@ -758,6 +782,14 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> cluster_name="cluster_name", project_id=0, region_id=0, + add_ons={ + "slurm": { + "enabled": True, + "file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c", + "ssh_key_ids": ["25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7"], + "worker_count": 2, + } + }, authentication={ "oidc": { "client_id": "kubernetes", From 2f8b389ae30a66d93350410d2bad32263709c940 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 24 Sep 2025 10:43:49 +0000 Subject: [PATCH 331/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3932b1fa..cda32772 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-71ebc8da15fdc297934029972bf2536f4abc6a167b38df66cf8c3f5a0d69bf4a.yml -openapi_spec_hash: ac7c9a26fa95888ecb41f32b35f9a7ec +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-be6f9c6c28bd770713d6e945c3f39f5137cef8294b04e4b8dfe05d221d27bef0.yml +openapi_spec_hash: af720572990100486b48af60a6a2e077 config_hash: fee4391924d7ea28b2bb5e5d81c8778f From c0ed8b4a3254cd489161aee08f1c3a481b303ee3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 24 Sep 2025 13:38:47 +0000 Subject: [PATCH 332/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/_client.py | 10 +- src/gcore/resources/cloud/audit_logs.py | 8 +- .../resources/cloud/baremetal/flavors.py | 8 +- src/gcore/resources/cloud/baremetal/images.py | 8 +- .../resources/cloud/baremetal/servers.py | 24 ++- .../resources/cloud/billing_reservations.py | 16 +- src/gcore/resources/cloud/cost_reports.py | 24 ++- .../cloud/file_shares/access_rules.py | 24 ++- .../cloud/file_shares/file_shares.py | 48 +++-- src/gcore/resources/cloud/floating_ips.py | 56 ++++-- .../cloud/gpu_baremetal_clusters/flavors.py | 8 +- .../gpu_baremetal_clusters.py | 64 ++++-- .../cloud/gpu_baremetal_clusters/images.py | 32 ++- .../gpu_baremetal_clusters/interfaces.py | 8 +- .../cloud/gpu_baremetal_clusters/servers.py | 56 ++++-- .../resources/cloud/inference/api_keys.py | 40 +++- .../inference/applications/deployments.py | 40 +++- .../cloud/inference/applications/templates.py | 16 +- .../inference/deployments/deployments.py | 64 ++++-- .../cloud/inference/deployments/logs.py | 8 +- .../resources/cloud/inference/flavors.py | 16 +- .../resources/cloud/inference/inference.py | 8 +- .../cloud/inference/registry_credentials.py | 40 +++- .../resources/cloud/inference/secrets.py | 40 +++- .../resources/cloud/instances/flavors.py | 8 +- src/gcore/resources/cloud/instances/images.py | 48 +++-- .../resources/cloud/instances/instances.py | 112 ++++++++--- .../resources/cloud/instances/interfaces.py | 24 ++- .../resources/cloud/instances/metrics.py | 8 +- src/gcore/resources/cloud/ip_ranges.py | 8 +- .../resources/cloud/k8s/clusters/clusters.py | 72 +++++-- .../resources/cloud/k8s/clusters/nodes.py | 16 +- .../cloud/k8s/clusters/pools/nodes.py | 16 +- .../cloud/k8s/clusters/pools/pools.py | 48 +++-- src/gcore/resources/cloud/k8s/flavors.py | 8 +- src/gcore/resources/cloud/k8s/k8s.py | 8 +- .../resources/cloud/load_balancers/flavors.py | 8 +- .../load_balancers/l7_policies/l7_policies.py | 40 +++- .../cloud/load_balancers/l7_policies/rules.py | 40 +++- .../cloud/load_balancers/listeners.py | 40 +++- .../cloud/load_balancers/load_balancers.py | 56 ++++-- .../resources/cloud/load_balancers/metrics.py | 8 +- .../load_balancers/pools/health_monitors.py | 16 +- .../cloud/load_balancers/pools/members.py | 16 +- .../cloud/load_balancers/pools/pools.py | 40 +++- .../cloud/load_balancers/statuses.py | 16 +- .../resources/cloud/networks/networks.py | 40 +++- src/gcore/resources/cloud/networks/routers.py | 56 ++++-- src/gcore/resources/cloud/networks/subnets.py | 40 +++- src/gcore/resources/cloud/placement_groups.py | 32 ++- src/gcore/resources/cloud/projects.py | 32 ++- src/gcore/resources/cloud/quotas/quotas.py | 24 ++- src/gcore/resources/cloud/quotas/requests.py | 32 ++- src/gcore/resources/cloud/regions.py | 12 +- .../resources/cloud/registries/artifacts.py | 16 +- .../resources/cloud/registries/registries.py | 40 +++- .../cloud/registries/repositories.py | 16 +- src/gcore/resources/cloud/registries/tags.py | 8 +- src/gcore/resources/cloud/registries/users.py | 48 +++-- .../reserved_fixed_ips/reserved_fixed_ips.py | 32 ++- .../resources/cloud/reserved_fixed_ips/vip.py | 40 +++- src/gcore/resources/cloud/secrets.py | 32 ++- .../resources/cloud/security_groups/rules.py | 24 ++- .../cloud/security_groups/security_groups.py | 56 ++++-- src/gcore/resources/cloud/ssh_keys.py | 40 +++- src/gcore/resources/cloud/tasks.py | 28 ++- src/gcore/resources/cloud/usage_reports.py | 8 +- .../resources/cloud/users/role_assignments.py | 32 ++- src/gcore/resources/cloud/volumes.py | 80 ++++++-- src/gcore/resources/dns/dns.py | 12 +- src/gcore/resources/dns/locations.py | 28 ++- src/gcore/resources/dns/metrics.py | 8 +- src/gcore/resources/dns/pickers/pickers.py | 4 +- src/gcore/resources/dns/pickers/presets.py | 8 +- src/gcore/resources/dns/zones/dnssec.py | 16 +- src/gcore/resources/dns/zones/rrsets.py | 48 +++-- src/gcore/resources/dns/zones/zones.py | 80 +++++--- src/gcore/resources/fastedge/apps/apps.py | 40 ++-- src/gcore/resources/fastedge/apps/logs.py | 8 +- src/gcore/resources/fastedge/binaries.py | 32 ++- src/gcore/resources/fastedge/fastedge.py | 4 +- src/gcore/resources/fastedge/kv_stores.py | 32 ++- src/gcore/resources/fastedge/secrets.py | 48 +++-- src/gcore/resources/fastedge/statistics.py | 16 +- src/gcore/resources/fastedge/templates.py | 40 +++- src/gcore/resources/iam/api_tokens.py | 32 ++- src/gcore/resources/iam/iam.py | 4 +- src/gcore/resources/iam/users.py | 36 +++- src/gcore/resources/security/bgp_announces.py | 16 +- src/gcore/resources/security/events.py | 8 +- .../resources/security/profile_templates.py | 8 +- src/gcore/resources/security/profiles.py | 48 +++-- .../resources/storage/buckets/buckets.py | 24 ++- src/gcore/resources/storage/buckets/cors.py | 16 +- .../resources/storage/buckets/lifecycle.py | 16 +- src/gcore/resources/storage/buckets/policy.py | 24 ++- src/gcore/resources/storage/credentials.py | 8 +- src/gcore/resources/storage/locations.py | 8 +- src/gcore/resources/storage/statistics.py | 16 +- src/gcore/resources/storage/storage.py | 64 ++++-- src/gcore/resources/streaming/ai_tasks.py | 28 ++- src/gcore/resources/streaming/broadcasts.py | 48 +++-- src/gcore/resources/streaming/directories.py | 40 +++- src/gcore/resources/streaming/players.py | 40 ++-- src/gcore/resources/streaming/playlists.py | 48 +++-- src/gcore/resources/streaming/quality_sets.py | 16 +- src/gcore/resources/streaming/restreams.py | 40 +++- src/gcore/resources/streaming/statistics.py | 184 +++++++++++++----- .../resources/streaming/streams/overlays.py | 48 +++-- .../resources/streaming/streams/streams.py | 72 +++++-- .../resources/streaming/videos/subtitles.py | 40 +++- .../resources/streaming/videos/videos.py | 56 ++++-- src/gcore/resources/waap/advanced_rules.py | 8 +- src/gcore/resources/waap/custom_page_sets.py | 48 +++-- .../resources/waap/domains/advanced_rules.py | 48 +++-- .../resources/waap/domains/api_discovery.py | 48 +++-- .../resources/waap/domains/api_path_groups.py | 8 +- src/gcore/resources/waap/domains/api_paths.py | 40 +++- .../resources/waap/domains/custom_rules.py | 56 ++++-- src/gcore/resources/waap/domains/domains.py | 44 +++-- .../resources/waap/domains/firewall_rules.py | 56 ++++-- .../waap/domains/insight_silences.py | 40 +++- src/gcore/resources/waap/domains/insights.py | 24 ++- src/gcore/resources/waap/domains/settings.py | 16 +- .../resources/waap/domains/statistics.py | 48 +++-- src/gcore/resources/waap/insights.py | 8 +- src/gcore/resources/waap/ip_info/ip_info.py | 64 ++++-- src/gcore/resources/waap/ip_info/metrics.py | 8 +- src/gcore/resources/waap/organizations.py | 8 +- src/gcore/resources/waap/statistics.py | 8 +- src/gcore/resources/waap/tags.py | 4 +- src/gcore/resources/waap/waap.py | 4 +- 133 files changed, 3042 insertions(+), 1052 deletions(-) diff --git a/.stats.yml b/.stats.yml index cda32772..29162beb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-be6f9c6c28bd770713d6e945c3f39f5137cef8294b04e4b8dfe05d221d27bef0.yml -openapi_spec_hash: af720572990100486b48af60a6a2e077 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-529e656a1e2b65a9adec55ae8207a9bc5a2bdd9c7adf846627aab1fa721f8e66.yml +openapi_spec_hash: 83d94f9375542b87f0227c982076ac1f config_hash: fee4391924d7ea28b2bb5e5d81c8778f diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 837f0881..51d339d9 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -113,6 +113,7 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") + self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -197,7 +198,7 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( + client = self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -210,6 +211,8 @@ def copy( default_query=params, **_extra_kwargs, ) + client._base_url_overridden = self._base_url_overridden or base_url is not None + return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) @@ -340,6 +343,7 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") + self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -424,7 +428,7 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( + client = self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -437,6 +441,8 @@ def copy( default_query=params, **_extra_kwargs, ) + client._base_url_overridden = self._base_url_overridden or base_url is not None + return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index 0e942e4e..0c1a5060 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -206,7 +206,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions", + "/cloud/v1/user_actions" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/user_actions", page=SyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, @@ -415,7 +417,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions", + "/cloud/v1/user_actions" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/user_actions", page=AsyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 454b0c7f..202234f1 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -93,7 +93,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -187,7 +189,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index 16f4d22c..ddb9f507 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -90,7 +90,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -178,7 +180,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 6507c906..63fcbf41 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -161,7 +161,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -299,7 +301,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", page=SyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -382,7 +386,9 @@ def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=maybe_transform( { "image_id": image_id, @@ -531,7 +537,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -669,7 +677,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", page=AsyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -752,7 +762,9 @@ async def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=await async_maybe_transform( { "image_id": image_id, diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index c25bd06c..ed15046f 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -120,7 +120,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations", + "/cloud/v1/reservations" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservations", page=SyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,7 +280,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations", + "/cloud/v1/reservations" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservations", page=AsyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -330,7 +336,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 1ee323ee..6871f862 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -150,7 +150,9 @@ def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/totals", body=maybe_transform( { "time_from": time_from, @@ -261,7 +263,9 @@ def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", body=maybe_transform( { "regions": regions, @@ -390,7 +394,9 @@ def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/resources", body=maybe_transform( { "time_from": time_from, @@ -535,7 +541,9 @@ async def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/totals", body=await async_maybe_transform( { "time_from": time_from, @@ -646,7 +654,9 @@ async def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", body=await async_maybe_transform( { "regions": regions, @@ -775,7 +785,9 @@ async def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/resources", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index 6750a7c5..fa8f4a08 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -88,7 +88,9 @@ def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=maybe_transform( { "access_mode": access_mode, @@ -140,7 +142,9 @@ def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,7 +195,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -263,7 +269,9 @@ async def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=await async_maybe_transform( { "access_mode": access_mode, @@ -315,7 +323,9 @@ async def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -366,7 +376,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index da32da6f..6451d59c 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -206,7 +206,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -294,7 +296,9 @@ def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=maybe_transform( { "name": name, @@ -355,7 +359,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", page=SyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -413,7 +419,9 @@ def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -458,7 +466,9 @@ def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -506,7 +516,9 @@ def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -681,7 +693,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -769,7 +783,9 @@ async def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=await async_maybe_transform( { "name": name, @@ -830,7 +846,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", page=AsyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -888,7 +906,9 @@ async def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -933,7 +953,9 @@ async def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -981,7 +1003,9 @@ async def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=await async_maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index edbe65f6..06f0d86d 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -100,7 +100,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", body=maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -176,7 +178,9 @@ def update( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._patch( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", body=maybe_transform({"tags": tags}, floating_ip_update_params.FloatingIPUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -230,7 +234,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", page=SyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -288,7 +294,9 @@ def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -333,7 +341,9 @@ def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=maybe_transform( { "port_id": port_id, @@ -385,7 +395,9 @@ def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,7 +436,9 @@ def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -500,7 +514,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", body=await async_maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -576,7 +592,9 @@ async def update( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._patch( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", body=await async_maybe_transform({"tags": tags}, floating_ip_update_params.FloatingIPUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -630,7 +648,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", page=AsyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -688,7 +708,9 @@ async def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -733,7 +755,9 @@ async def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=await async_maybe_transform( { "port_id": port_id, @@ -785,7 +809,9 @@ async def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -824,7 +850,9 @@ async def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index 19df3189..dc44954b 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -80,7 +80,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -157,7 +159,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 248d96c7..8275201c 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -156,7 +156,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=maybe_transform( { "flavor": flavor, @@ -220,7 +222,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=SyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -291,7 +295,9 @@ def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -348,7 +354,9 @@ def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,7 +395,9 @@ def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -426,7 +436,9 @@ def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -478,7 +490,9 @@ def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=maybe_transform( { "nodes": nodes, @@ -530,7 +544,9 @@ def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, @@ -633,7 +649,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=await async_maybe_transform( { "flavor": flavor, @@ -697,7 +715,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=AsyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -768,7 +788,9 @@ async def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -825,7 +847,9 @@ async def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -864,7 +888,9 @@ async def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -903,7 +929,9 @@ async def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -955,7 +983,9 @@ async def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=await async_maybe_transform( { "nodes": nodes, @@ -1007,7 +1037,9 @@ async def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=await async_maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 5e2003c2..3f68475e 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -79,7 +79,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -124,7 +126,9 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -169,7 +173,9 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +250,9 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=maybe_transform( { "name": name, @@ -320,7 +328,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -365,7 +375,9 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -410,7 +422,9 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,7 +499,9 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index 63371d8e..c12ccc5f 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -71,7 +71,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -131,7 +133,9 @@ async def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index fb1a210e..1d650c11 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -143,7 +143,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=SyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -209,7 +211,9 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -448,7 +452,9 @@ def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -507,7 +513,9 @@ def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -553,7 +561,9 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -592,7 +602,9 @@ def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -631,7 +643,9 @@ def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -748,7 +762,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=AsyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -814,7 +830,9 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1055,7 +1073,9 @@ async def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -1114,7 +1134,9 @@ async def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, @@ -1160,7 +1182,9 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1199,7 +1223,9 @@ async def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1238,7 +1264,9 @@ async def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py index fcd8860c..2bca0a73 100644 --- a/src/gcore/resources/cloud/inference/api_keys.py +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -84,7 +84,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", body=maybe_transform( { "name": name, @@ -135,7 +137,9 @@ def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -178,7 +182,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", page=SyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -233,7 +239,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,7 +281,9 @@ def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -340,7 +350,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", body=await async_maybe_transform( { "name": name, @@ -391,7 +403,9 @@ async def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=await async_maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -434,7 +448,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", page=AsyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -489,7 +505,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,7 +547,9 @@ async def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index 7b62f2c2..717dbba4 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -93,7 +93,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", body=maybe_transform( { "application_name": application_name, @@ -140,7 +142,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,7 +186,9 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,7 +232,9 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -279,7 +287,9 @@ def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -361,7 +371,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", body=await async_maybe_transform( { "application_name": application_name, @@ -408,7 +420,9 @@ async def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -450,7 +464,9 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -494,7 +510,9 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,7 +565,9 @@ async def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, diff --git a/src/gcore/resources/cloud/inference/applications/templates.py b/src/gcore/resources/cloud/inference/applications/templates.py index d888a399..ab2fe2cb 100644 --- a/src/gcore/resources/cloud/inference/applications/templates.py +++ b/src/gcore/resources/cloud/inference/applications/templates.py @@ -58,7 +58,9 @@ def list( required to create a fully functional application deployment. """ return self._get( - "/cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -97,7 +99,9 @@ def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -143,7 +147,9 @@ async def list( required to create a fully functional application deployment. """ return await self._get( - "/cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,7 +188,9 @@ async def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return await self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 0521e2e5..990e025c 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -147,7 +147,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", body=maybe_transform( { "containers": containers, @@ -263,7 +265,9 @@ def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -325,7 +329,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", page=SyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -376,7 +382,9 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -416,7 +424,9 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -457,7 +467,9 @@ def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -505,7 +517,9 @@ def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -553,7 +567,9 @@ def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -673,7 +689,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", body=await async_maybe_transform( { "containers": containers, @@ -789,7 +807,9 @@ async def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, @@ -851,7 +871,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", page=AsyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -902,7 +924,9 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -942,7 +966,9 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -983,7 +1009,9 @@ async def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1031,7 +1059,9 @@ async def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1079,7 +1109,9 @@ async def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index 3a46cbd0..e243a63a 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -91,7 +91,9 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=SyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, @@ -178,7 +180,9 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=AsyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index c9934320..6009835e 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -73,7 +73,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/flavors", page=SyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -119,7 +121,9 @@ def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return self._get( - f"/cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -178,7 +182,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/flavors", page=AsyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -224,7 +230,9 @@ async def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return await self._get( - f"/cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index 86dd2f3c..8b2b1ca1 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -123,7 +123,9 @@ def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return self._get( - "/cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +189,9 @@ async def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return await self._get( - "/cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index c34dfc0a..0baea891 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -86,7 +86,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", body=maybe_transform( { "name": name, @@ -137,7 +139,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", page=SyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -189,7 +193,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -229,7 +235,9 @@ def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -278,7 +286,9 @@ def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=maybe_transform( { "password": password, @@ -354,7 +364,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", body=await async_maybe_transform( { "name": name, @@ -405,7 +417,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", page=AsyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -457,7 +471,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,7 +513,9 @@ async def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -546,7 +564,9 @@ async def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=await async_maybe_transform( { "password": password, diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index 6b168d22..9ff5126f 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -79,7 +79,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", body=maybe_transform( { "data": data, @@ -130,7 +132,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", page=SyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -182,7 +186,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -222,7 +228,9 @@ def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -268,7 +276,9 @@ def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", body=maybe_transform( { "data": data, @@ -340,7 +350,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", body=await async_maybe_transform( { "data": data, @@ -391,7 +403,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", page=AsyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -443,7 +457,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -483,7 +499,9 @@ async def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,7 +547,9 @@ async def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", body=await async_maybe_transform( { "data": data, diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 23ba0073..63158c8b 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -85,7 +85,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -169,7 +171,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index c23fde30..375adf86 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -110,7 +110,9 @@ def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", body=maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -176,7 +178,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -230,7 +234,9 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -302,7 +308,9 @@ def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -359,7 +367,9 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -442,7 +452,9 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -544,7 +556,9 @@ async def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", body=await async_maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -610,7 +624,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -664,7 +680,9 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -736,7 +754,9 @@ async def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -793,7 +813,9 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -876,7 +898,9 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 87689d92..7421c6da 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -235,7 +235,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -302,7 +304,9 @@ def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -451,7 +455,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", page=SyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -545,7 +551,9 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -654,7 +662,9 @@ def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=maybe_transform( { "action": action, @@ -705,7 +715,9 @@ def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -758,7 +770,9 @@ def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=maybe_transform( { "name": name, @@ -804,7 +818,9 @@ def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -843,7 +859,9 @@ def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -899,7 +917,9 @@ def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -941,7 +961,9 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -988,7 +1010,9 @@ def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1030,7 +1054,9 @@ def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1080,7 +1106,9 @@ def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=maybe_transform( { "name": name, @@ -1258,7 +1286,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -1325,7 +1355,9 @@ async def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1474,7 +1506,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", page=AsyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -1568,7 +1602,9 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1677,7 +1713,9 @@ async def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=await async_maybe_transform( { "action": action, @@ -1728,7 +1766,9 @@ async def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=await async_maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -1781,7 +1821,9 @@ async def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=await async_maybe_transform( { "name": name, @@ -1827,7 +1869,9 @@ async def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1866,7 +1910,9 @@ async def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1922,7 +1968,9 @@ async def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1964,7 +2012,9 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2011,7 +2061,9 @@ async def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2053,7 +2105,9 @@ async def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=await async_maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -2103,7 +2157,9 @@ async def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 261241ba..58e644ef 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -77,7 +77,9 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -309,7 +311,9 @@ def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -368,7 +372,9 @@ def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -435,7 +441,9 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -667,7 +675,9 @@ async def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -726,7 +736,9 @@ async def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index c24b208c..77f2ea82 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -87,7 +87,9 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -166,7 +168,9 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index d807001b..4e66a509 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -70,7 +70,9 @@ def list( duplicate prefixes are not returned. """ return self._get( - "/cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -129,7 +131,9 @@ async def list( duplicate prefixes are not returned. """ return await self._get( - "/cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index cda6a936..7399935c 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -216,7 +216,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", body=maybe_transform( { "keypair": keypair, @@ -352,7 +354,9 @@ def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=maybe_transform( { "add_ons": add_ons, @@ -399,7 +403,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +447,9 @@ def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -484,7 +492,9 @@ def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,7 +533,9 @@ def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -562,7 +574,9 @@ def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -601,7 +615,9 @@ def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -643,7 +659,9 @@ def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -819,7 +837,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", body=await async_maybe_transform( { "keypair": keypair, @@ -955,7 +975,9 @@ async def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=await async_maybe_transform( { "add_ons": add_ons, @@ -1002,7 +1024,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1044,7 +1068,9 @@ async def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1087,7 +1113,9 @@ async def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1126,7 +1154,9 @@ async def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1165,7 +1195,9 @@ async def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1204,7 +1236,9 @@ async def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1246,7 +1280,9 @@ async def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=await async_maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/clusters/nodes.py b/src/gcore/resources/cloud/k8s/clusters/nodes.py index 4518d8b9..6ab3f1ba 100644 --- a/src/gcore/resources/cloud/k8s/clusters/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/nodes.py @@ -76,7 +76,9 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -124,7 +126,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +191,9 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -235,7 +241,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py index 797c0e6e..fedba09c 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py @@ -79,7 +79,9 @@ def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -130,7 +132,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -196,7 +200,9 @@ async def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -247,7 +253,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 72cb9321..38dfa4a7 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -130,7 +130,9 @@ def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=maybe_transform( { "flavor_id": flavor_id, @@ -208,7 +210,9 @@ def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -258,7 +262,9 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,7 +306,9 @@ def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -342,7 +350,9 @@ def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,7 +397,9 @@ def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -492,7 +504,9 @@ async def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=await async_maybe_transform( { "flavor_id": flavor_id, @@ -570,7 +584,9 @@ async def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=await async_maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -620,7 +636,9 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -662,7 +680,9 @@ async def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -704,7 +724,9 @@ async def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -749,7 +771,9 @@ async def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=await async_maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/flavors.py b/src/gcore/resources/cloud/k8s/flavors.py index 0823633e..4996c836 100644 --- a/src/gcore/resources/cloud/k8s/flavors.py +++ b/src/gcore/resources/cloud/k8s/flavors.py @@ -79,7 +79,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -155,7 +157,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index f3ac5aff..2c10d310 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -92,7 +92,9 @@ def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -157,7 +159,9 @@ async def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index 8d126cd7..c24a04dd 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -76,7 +76,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -143,7 +145,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index 17a2a8ea..447e8047 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py @@ -118,7 +118,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", body=maybe_transform( { "action": action, @@ -168,7 +170,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -207,7 +211,9 @@ def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -246,7 +252,9 @@ def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -314,7 +322,9 @@ def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=maybe_transform( { "action": action, @@ -420,7 +430,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", body=await async_maybe_transform( { "action": action, @@ -470,7 +482,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -509,7 +523,9 @@ async def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -548,7 +564,9 @@ async def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -616,7 +634,9 @@ async def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=await async_maybe_transform( { "action": action, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py index c4ba95fd..a4b1e8b5 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -106,7 +106,9 @@ def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=maybe_transform( { "compare_type": compare_type, @@ -156,7 +158,9 @@ def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -198,7 +202,9 @@ def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -240,7 +246,9 @@ def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -312,7 +320,9 @@ def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=maybe_transform( { "compare_type": compare_type, @@ -412,7 +422,9 @@ async def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=await async_maybe_transform( { "compare_type": compare_type, @@ -462,7 +474,9 @@ async def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -504,7 +518,9 @@ async def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -546,7 +562,9 @@ async def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -618,7 +636,9 @@ async def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=await async_maybe_transform( { "compare_type": compare_type, diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 8959a6b4..df3a8019 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -127,7 +127,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", body=maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -219,7 +221,9 @@ def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -279,7 +283,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -334,7 +340,9 @@ def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,7 +390,9 @@ def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -489,7 +499,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", body=await async_maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -581,7 +593,9 @@ async def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=await async_maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -641,7 +655,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -696,7 +712,9 @@ async def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -744,7 +762,9 @@ async def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index e6225101..2a76d970 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -207,7 +207,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -299,7 +301,9 @@ def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=maybe_transform( { "logging": logging, @@ -377,7 +381,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", page=SyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -435,7 +441,9 @@ def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -477,7 +485,9 @@ def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -523,7 +533,9 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -575,7 +587,9 @@ def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -706,7 +720,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -798,7 +814,9 @@ async def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=await async_maybe_transform( { "logging": logging, @@ -876,7 +894,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", page=AsyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -934,7 +954,9 @@ async def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -976,7 +998,9 @@ async def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=await async_maybe_transform( {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams ), @@ -1024,7 +1048,9 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1076,7 +1102,9 @@ async def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index 38ecf843..bedfa5eb 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -81,7 +81,9 @@ def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -154,7 +156,9 @@ async def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index cc1baa93..c262d9a8 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -115,7 +115,9 @@ def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=maybe_transform( { "delay": delay, @@ -177,7 +179,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -274,7 +278,9 @@ async def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=await async_maybe_transform( { "delay": delay, @@ -336,7 +342,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 29d440f7..2ef413c0 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -131,7 +131,9 @@ def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=maybe_transform( { "address": address, @@ -195,7 +197,9 @@ def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -311,7 +315,9 @@ async def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=await async_maybe_transform( { "address": address, @@ -375,7 +381,9 @@ async def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 3ee27f95..e7141924 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -147,7 +147,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", body=maybe_transform( { "lb_algorithm": lb_algorithm, @@ -265,7 +267,9 @@ def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=maybe_transform( { "ca_secret_id": ca_secret_id, @@ -331,7 +335,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -387,7 +393,9 @@ def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -432,7 +440,9 @@ def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -543,7 +553,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", body=await async_maybe_transform( { "lb_algorithm": lb_algorithm, @@ -661,7 +673,9 @@ async def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=await async_maybe_transform( { "ca_secret_id": ca_secret_id, @@ -727,7 +741,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -783,7 +799,9 @@ async def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -828,7 +846,9 @@ async def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 624132ba..97ac74d7 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -69,7 +69,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -108,7 +110,9 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -165,7 +169,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -204,7 +210,9 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 2c4ca366..2e9585fa 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -120,7 +120,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -203,7 +205,9 @@ def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=maybe_transform( { "name": name, @@ -270,7 +274,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", page=SyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -330,7 +336,9 @@ def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -375,7 +383,9 @@ def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -460,7 +470,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -543,7 +555,9 @@ async def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=await async_maybe_transform( { "name": name, @@ -610,7 +624,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", page=AsyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -670,7 +686,9 @@ async def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -715,7 +733,9 @@ async def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 52cf6cf8..018bfae0 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -92,7 +92,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -149,7 +151,9 @@ def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=maybe_transform( { "external_gateway_info": external_gateway_info, @@ -199,7 +203,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", page=SyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -249,7 +255,9 @@ def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,7 +309,9 @@ def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=maybe_transform( { "subnet_id": subnet_id, @@ -350,7 +360,9 @@ def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=maybe_transform({"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -390,7 +402,9 @@ def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -459,7 +473,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -516,7 +532,9 @@ async def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=await async_maybe_transform( { "external_gateway_info": external_gateway_info, @@ -566,7 +584,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", page=AsyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -616,7 +636,9 @@ async def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -668,7 +690,9 @@ async def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=await async_maybe_transform( { "subnet_id": subnet_id, @@ -717,7 +741,9 @@ async def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=await async_maybe_transform( {"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams ), @@ -759,7 +785,9 @@ async def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index c5048245..22a3b1a4 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -125,7 +125,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", body=maybe_transform( { "cidr": cidr, @@ -227,7 +229,9 @@ def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=maybe_transform( { "dns_nameservers": dns_nameservers, @@ -313,7 +317,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", page=SyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -374,7 +380,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -419,7 +427,9 @@ def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,7 +533,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", body=await async_maybe_transform( { "cidr": cidr, @@ -625,7 +637,9 @@ async def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=await async_maybe_transform( { "dns_nameservers": dns_nameservers, @@ -711,7 +725,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", page=AsyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -772,7 +788,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -817,7 +835,9 @@ async def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index bb5119c8..d06de2c4 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -80,7 +80,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -123,7 +125,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -162,7 +166,9 @@ def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -201,7 +207,9 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -264,7 +272,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -307,7 +317,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -346,7 +358,9 @@ async def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -385,7 +399,9 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index cb6c69b4..316da27f 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -83,7 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", body=maybe_transform( { "name": name, @@ -142,7 +142,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", page=SyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -193,7 +193,9 @@ def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._delete( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,7 +228,9 @@ def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,7 +271,9 @@ def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._put( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", body=maybe_transform( { "name": name, @@ -339,7 +345,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", body=await async_maybe_transform( { "name": name, @@ -398,7 +404,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", page=AsyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -449,7 +455,9 @@ async def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._delete( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -482,7 +490,9 @@ async def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,7 +533,9 @@ async def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._put( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 915d900d..3adb5a00 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -65,7 +65,9 @@ def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return self._get( - "/cloud/v2/client_quotas", + "/cloud/v2/client_quotas" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -103,7 +105,9 @@ def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -136,7 +140,9 @@ def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -180,7 +186,9 @@ async def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return await self._get( - "/cloud/v2/client_quotas", + "/cloud/v2/client_quotas" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -218,7 +226,9 @@ async def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -251,7 +261,9 @@ async def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 6857110a..128238fc 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -79,7 +79,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", body=maybe_transform( { "description": description, @@ -127,7 +129,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", page=SyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -173,7 +177,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -206,7 +212,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,7 +275,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", body=await async_maybe_transform( { "description": description, @@ -315,7 +325,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", page=AsyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -361,7 +373,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +408,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index b9d06835..c2ed0980 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -85,7 +85,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions", + "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", page=SyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -138,7 +138,9 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -211,7 +213,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions", + "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", page=AsyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -264,7 +266,9 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index 4b07607a..b9ed4772 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -72,7 +72,9 @@ def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -116,7 +118,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -177,7 +181,9 @@ async def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -221,7 +227,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 0ba3414e..7d41597b 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -129,7 +129,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -172,7 +174,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -210,7 +214,9 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -247,7 +253,9 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -287,7 +295,9 @@ def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=maybe_transform({"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -371,7 +381,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -414,7 +426,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -452,7 +466,9 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -489,7 +505,9 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,7 +547,9 @@ async def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=await async_maybe_transform( {"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams ), diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index d0c860a9..0a3a776d 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -69,7 +69,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -110,7 +112,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -168,7 +172,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -209,7 +215,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index 74f68017..9c1812de 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -78,7 +78,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -146,7 +148,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index 5225429a..c7f5e4e6 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -92,7 +92,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=maybe_transform( { "duration": duration, @@ -145,7 +147,9 @@ def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=maybe_transform( { "duration": duration, @@ -189,7 +193,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,7 +234,9 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -268,7 +276,9 @@ def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -307,7 +317,9 @@ def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -381,7 +393,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=await async_maybe_transform( { "duration": duration, @@ -434,7 +448,9 @@ async def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=await async_maybe_transform( { "duration": duration, @@ -478,7 +494,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,7 +535,9 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -557,7 +577,9 @@ async def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=await async_maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -596,7 +618,9 @@ async def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index c76170a1..0d1b246c 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -274,7 +274,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=maybe_transform( { "type": type, @@ -352,7 +354,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=SyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -409,7 +413,9 @@ def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -448,7 +454,9 @@ def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -695,7 +703,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=await async_maybe_transform( { "type": type, @@ -773,7 +783,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=AsyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -830,7 +842,9 @@ async def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -869,7 +883,9 @@ async def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 966a51e0..947e07af 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -79,7 +79,9 @@ def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -118,7 +120,9 @@ def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -160,7 +164,9 @@ def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -205,7 +211,9 @@ def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -248,7 +256,9 @@ def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), @@ -311,7 +321,9 @@ async def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,7 +362,9 @@ async def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +406,9 @@ async def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -437,7 +453,9 @@ async def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=await async_maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -480,7 +498,9 @@ async def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index e23a92ad..297e8a02 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -86,7 +86,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", page=SyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -142,7 +144,9 @@ def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +191,9 @@ def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -236,7 +242,9 @@ def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -312,7 +320,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", page=AsyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -368,7 +378,9 @@ async def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -413,7 +425,9 @@ async def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -462,7 +476,9 @@ async def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index aacd3921..4886e5bd 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -126,7 +126,9 @@ def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=maybe_transform( { "description": description, @@ -179,7 +181,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,7 +277,9 @@ def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=maybe_transform( { "direction": direction, @@ -397,7 +403,9 @@ async def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=await async_maybe_transform( { "description": description, @@ -450,7 +458,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -544,7 +554,9 @@ async def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=await async_maybe_transform( { "direction": direction, diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 5961799b..30e98b08 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -97,7 +97,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", body=maybe_transform( { "security_group": security_group, @@ -172,7 +174,9 @@ def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=maybe_transform( { "changed_rules": changed_rules, @@ -228,7 +232,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", page=SyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -281,7 +287,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -323,7 +331,9 @@ def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -363,7 +373,9 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,7 +414,9 @@ def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -469,7 +483,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", body=await async_maybe_transform( { "security_group": security_group, @@ -544,7 +560,9 @@ async def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=await async_maybe_transform( { "changed_rules": changed_rules, @@ -600,7 +618,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", page=AsyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -653,7 +673,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -695,7 +717,9 @@ async def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=await async_maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -735,7 +759,9 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -774,7 +800,9 @@ async def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 061b0876..970602db 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -90,7 +90,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", body=maybe_transform( { "name": name, @@ -141,7 +143,9 @@ def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=maybe_transform({"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -186,7 +190,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", page=SyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -239,7 +245,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -279,7 +287,9 @@ def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -352,7 +362,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", body=await async_maybe_transform( { "name": name, @@ -403,7 +415,9 @@ async def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=await async_maybe_transform( {"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams ), @@ -450,7 +464,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", page=AsyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -503,7 +519,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -543,7 +561,9 @@ async def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 967c4f16..63be5a85 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -156,7 +156,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks", + "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", page=SyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -213,7 +213,9 @@ def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -258,7 +260,9 @@ def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -293,7 +297,9 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -431,7 +437,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks", + "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", page=AsyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -488,7 +494,9 @@ async def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -533,7 +541,9 @@ async def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -568,7 +578,9 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index 8758b3ab..c9795e74 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -139,7 +139,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/usage_report", + "/cloud/v1/usage_report" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/usage_report", body=maybe_transform( { "time_from": time_from, @@ -277,7 +279,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/usage_report", + "/cloud/v1/usage_report" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/usage_report", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 2f16d40d..ad4a9d8b 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -85,7 +85,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", body=maybe_transform( { "role": role, @@ -139,7 +141,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", body=maybe_transform( { "role": role, @@ -191,7 +195,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", page=SyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -237,7 +243,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ return self._delete( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,7 +308,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", body=await async_maybe_transform( { "role": role, @@ -354,7 +364,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", body=await async_maybe_transform( { "role": role, @@ -406,7 +418,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", page=AsyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -452,7 +466,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ return await self._delete( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 9c40ea2e..11bf5ecd 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -288,7 +288,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", body=maybe_transform( { "image_id": image_id, @@ -374,7 +376,9 @@ def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=maybe_transform( { "name": name, @@ -456,7 +460,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", page=SyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -525,7 +531,9 @@ def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -582,7 +590,9 @@ def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=maybe_transform( { "instance_id": instance_id, @@ -639,7 +649,9 @@ def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=maybe_transform({"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -688,7 +700,9 @@ def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -736,7 +750,9 @@ def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -786,7 +802,9 @@ def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -835,7 +853,9 @@ def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1095,7 +1115,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", body=await async_maybe_transform( { "image_id": image_id, @@ -1181,7 +1203,9 @@ async def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=await async_maybe_transform( { "name": name, @@ -1263,7 +1287,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", page=AsyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -1332,7 +1358,9 @@ async def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1389,7 +1417,9 @@ async def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=await async_maybe_transform( { "instance_id": instance_id, @@ -1446,7 +1476,9 @@ async def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=await async_maybe_transform( {"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams ), @@ -1497,7 +1529,9 @@ async def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=await async_maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -1545,7 +1579,9 @@ async def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1595,7 +1631,9 @@ async def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=await async_maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1644,7 +1682,9 @@ async def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py index 099fe2fd..edad6bbe 100644 --- a/src/gcore/resources/dns/dns.py +++ b/src/gcore/resources/dns/dns.py @@ -104,7 +104,9 @@ def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return self._get( - "/dns/v2/platform/info", + "/dns/v2/platform/info" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -141,7 +143,7 @@ def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/lookup", + "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -207,7 +209,9 @@ async def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return await self._get( - "/dns/v2/platform/info", + "/dns/v2/platform/info" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +248,7 @@ async def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/lookup", + "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/locations.py b/src/gcore/resources/dns/locations.py index 3b571e04..a6c27797 100644 --- a/src/gcore/resources/dns/locations.py +++ b/src/gcore/resources/dns/locations.py @@ -54,7 +54,7 @@ def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return self._get( - "/dns/v2/locations", + "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -73,7 +73,9 @@ def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return self._get( - "/dns/v2/locations/continents", + "/dns/v2/locations/continents" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -92,7 +94,9 @@ def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return self._get( - "/dns/v2/locations/countries", + "/dns/v2/locations/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -111,7 +115,9 @@ def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return self._get( - "/dns/v2/locations/regions", + "/dns/v2/locations/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -151,7 +157,7 @@ async def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return await self._get( - "/dns/v2/locations", + "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -170,7 +176,9 @@ async def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return await self._get( - "/dns/v2/locations/continents", + "/dns/v2/locations/continents" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -189,7 +197,9 @@ async def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return await self._get( - "/dns/v2/locations/countries", + "/dns/v2/locations/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -208,7 +218,9 @@ async def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return await self._get( - "/dns/v2/locations/regions", + "/dns/v2/locations/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index 3359b610..90cbb48b 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -82,7 +82,9 @@ def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return self._get( - "/dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -160,7 +162,9 @@ async def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return await self._get( - "/dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/pickers/pickers.py b/src/gcore/resources/dns/pickers/pickers.py index c08f6586..5cbf16a7 100644 --- a/src/gcore/resources/dns/pickers/pickers.py +++ b/src/gcore/resources/dns/pickers/pickers.py @@ -63,7 +63,7 @@ def list( ) -> PickerListResponse: """Returns list of picker""" return self._get( - "/dns/v2/pickers", + "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -107,7 +107,7 @@ async def list( ) -> PickerListResponse: """Returns list of picker""" return await self._get( - "/dns/v2/pickers", + "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/pickers/presets.py b/src/gcore/resources/dns/pickers/presets.py index a816c8cc..6a8db18b 100644 --- a/src/gcore/resources/dns/pickers/presets.py +++ b/src/gcore/resources/dns/pickers/presets.py @@ -51,7 +51,9 @@ def list( ) -> PresetListResponse: """Returns list of picker preset""" return self._get( - "/dns/v2/pickers/presets", + "/dns/v2/pickers/presets" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -91,7 +93,9 @@ async def list( ) -> PresetListResponse: """Returns list of picker preset""" return await self._get( - "/dns/v2/pickers/presets", + "/dns/v2/pickers/presets" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/dnssec.py b/src/gcore/resources/dns/zones/dnssec.py index e91a9d09..c5dcb39b 100644 --- a/src/gcore/resources/dns/zones/dnssec.py +++ b/src/gcore/resources/dns/zones/dnssec.py @@ -69,7 +69,9 @@ def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", body=maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -103,7 +105,9 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -158,7 +162,9 @@ async def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", body=await async_maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -192,7 +198,9 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index 15085076..18f66d20 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -222,7 +222,9 @@ def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -276,7 +278,9 @@ def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -327,7 +331,9 @@ def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -366,7 +372,9 @@ def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -411,7 +419,9 @@ def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -470,7 +480,9 @@ def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -678,7 +690,9 @@ async def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, @@ -732,7 +746,9 @@ async def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -783,7 +799,9 @@ async def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -822,7 +840,9 @@ async def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -867,7 +887,9 @@ async def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -926,7 +948,9 @@ async def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 765d77eb..7092460c 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -143,7 +143,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", body=maybe_transform( { "name": name, @@ -225,7 +225,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -283,7 +283,9 @@ def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._delete( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -318,7 +320,9 @@ def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -351,7 +355,9 @@ def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -384,7 +390,9 @@ def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -417,7 +425,9 @@ def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -450,7 +460,9 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -521,7 +533,9 @@ def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -594,7 +608,9 @@ def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._post( - f"/dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", body=maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -667,7 +683,9 @@ def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return self._put( - f"/dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{path_name}", body=maybe_transform( { "body_name": body_name, @@ -780,7 +798,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", body=await async_maybe_transform( { "name": name, @@ -862,7 +880,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -920,7 +938,9 @@ async def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._delete( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -955,7 +975,9 @@ async def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -988,7 +1010,9 @@ async def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1021,7 +1045,9 @@ async def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1054,7 +1080,9 @@ async def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1087,7 +1115,9 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1158,7 +1188,9 @@ async def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1231,7 +1263,9 @@ async def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", body=await async_maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1304,7 +1338,9 @@ async def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return await self._put( - f"/dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{path_name}", body=await async_maybe_transform( { "body_name": body_name, diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index 21e9fb4c..6344b4c8 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -121,7 +121,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", body=maybe_transform( { "binary": binary, @@ -208,7 +208,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=maybe_transform( { "binary": binary, @@ -305,7 +307,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", page=SyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -355,7 +357,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -386,7 +390,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -418,7 +424,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -514,7 +522,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", body=await async_maybe_transform( { "binary": binary, @@ -601,7 +609,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=await async_maybe_transform( { "binary": binary, @@ -698,7 +708,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", page=AsyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -748,7 +758,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -779,7 +791,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -811,7 +825,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=await async_maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py index 8f589ab0..c38308f9 100644 --- a/src/gcore/resources/fastedge/apps/logs.py +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -94,7 +94,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", page=SyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, @@ -187,7 +189,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", page=AsyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index c88f90da..142fa332 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -67,7 +67,9 @@ def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return self._post( - "/fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries/raw", body=read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -87,7 +89,9 @@ def list( ) -> BinaryListResponse: """List binaries""" return self._get( - "/fastedge/v1/binaries", + "/fastedge/v1/binaries" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +123,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -150,7 +156,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,7 +211,9 @@ async def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return await self._post( - "/fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries/raw", body=await async_read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -223,7 +233,9 @@ async def list( ) -> BinaryListResponse: """List binaries""" return await self._get( - "/fastedge/v1/binaries", + "/fastedge/v1/binaries" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -255,7 +267,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -286,7 +300,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/fastedge.py b/src/gcore/resources/fastedge/fastedge.py index d4ba7cf3..43091582 100644 --- a/src/gcore/resources/fastedge/fastedge.py +++ b/src/gcore/resources/fastedge/fastedge.py @@ -123,7 +123,7 @@ def get_account_overview( ) -> Client: """Get status and limits for the client""" return self._get( - "/fastedge/v1/me", + "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +187,7 @@ async def get_account_overview( ) -> Client: """Get status and limits for the client""" return await self._get( - "/fastedge/v1/me", + "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py index 42193e54..a39f434b 100644 --- a/src/gcore/resources/fastedge/kv_stores.py +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -72,7 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", body=maybe_transform( { "byod": byod, @@ -112,7 +112,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -148,7 +148,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -179,7 +181,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,7 +220,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", body=maybe_transform( { "byod": byod, @@ -280,7 +286,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", body=await async_maybe_transform( { "byod": byod, @@ -320,7 +326,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -356,7 +362,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,7 +395,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,7 +434,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", body=await async_maybe_transform( { "byod": byod, diff --git a/src/gcore/resources/fastedge/secrets.py b/src/gcore/resources/fastedge/secrets.py index 81685e61..32e39e18 100644 --- a/src/gcore/resources/fastedge/secrets.py +++ b/src/gcore/resources/fastedge/secrets.py @@ -83,7 +83,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", body=maybe_transform( { "name": name, @@ -131,7 +133,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=maybe_transform( { "comment": comment, @@ -175,7 +179,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -220,7 +226,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -255,7 +263,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -295,7 +305,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=maybe_transform( { "name": name, @@ -363,7 +375,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", body=await async_maybe_transform( { "name": name, @@ -411,7 +425,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "comment": comment, @@ -455,7 +471,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -500,7 +518,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -535,7 +555,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -575,7 +597,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/fastedge/statistics.py b/src/gcore/resources/fastedge/statistics.py index 4b344931..2768b1c7 100644 --- a/src/gcore/resources/fastedge/statistics.py +++ b/src/gcore/resources/fastedge/statistics.py @@ -83,7 +83,9 @@ def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -141,7 +143,9 @@ def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -220,7 +224,9 @@ async def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -278,7 +284,9 @@ async def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/fastedge/templates.py b/src/gcore/resources/fastedge/templates.py index d58d3110..55ba0f87 100644 --- a/src/gcore/resources/fastedge/templates.py +++ b/src/gcore/resources/fastedge/templates.py @@ -93,7 +93,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", body=maybe_transform( { "binary_id": binary_id, @@ -149,7 +151,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", page=SyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -197,7 +201,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -232,7 +238,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,7 +289,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", body=maybe_transform( { "binary_id": binary_id, @@ -361,7 +371,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", body=await async_maybe_transform( { "binary_id": binary_id, @@ -417,7 +429,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", page=AsyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -465,7 +479,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -500,7 +516,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -549,7 +567,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", body=await async_maybe_transform( { "binary_id": binary_id, diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index e99827be..e6031ed5 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -80,7 +80,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", body=maybe_transform( { "client_user": client_user, @@ -147,7 +149,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -196,7 +200,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,7 +234,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -293,7 +301,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", body=await async_maybe_transform( { "client_user": client_user, @@ -360,7 +370,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -409,7 +421,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +455,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/iam.py b/src/gcore/resources/iam/iam.py index 7f409c61..0072cb39 100644 --- a/src/gcore/resources/iam/iam.py +++ b/src/gcore/resources/iam/iam.py @@ -75,7 +75,7 @@ def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return self._get( - "/iam/clients/me", + "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +123,7 @@ async def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return await self._get( - "/iam/clients/me", + "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index f411d577..9337eadb 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -104,7 +104,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", body=maybe_transform( { "auth_types": auth_types, @@ -156,7 +158,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users", + "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", page=SyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -202,7 +204,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -233,7 +237,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -283,7 +289,9 @@ def invite( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/iam/clients/invite_user", + "/iam/clients/invite_user" + if self._client._base_url_overridden + else "https://api.gcore.com//iam/clients/invite_user", body=maybe_transform( { "client_id": client_id, @@ -377,7 +385,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", body=await async_maybe_transform( { "auth_types": auth_types, @@ -429,7 +439,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users", + "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", page=AsyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -475,7 +485,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -506,7 +518,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -556,7 +570,9 @@ async def invite( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/iam/clients/invite_user", + "/iam/clients/invite_user" + if self._client._base_url_overridden + else "https://api.gcore.com//iam/clients/invite_user", body=await async_maybe_transform( { "client_id": client_id, diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index 26b3bc96..50000889 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -74,7 +74,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -122,7 +124,9 @@ def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", body=maybe_transform( { "announce": announce, @@ -191,7 +195,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -239,7 +245,9 @@ async def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", body=await async_maybe_transform( { "announce": announce, diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py index e0699398..a9cc8e57 100644 --- a/src/gcore/resources/security/events.py +++ b/src/gcore/resources/security/events.py @@ -88,7 +88,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs" + if self._client._base_url_overridden + else "https://api.gcore.com//security/notifier/v1/event_logs", page=SyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs" + if self._client._base_url_overridden + else "https://api.gcore.com//security/notifier/v1/event_logs", page=AsyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py index 307f3c0d..c4a4459e 100644 --- a/src/gcore/resources/security/profile_templates.py +++ b/src/gcore/resources/security/profile_templates.py @@ -55,7 +55,9 @@ def list( profile. Client receives only common and created for him profile templates. """ return self._get( - "/security/iaas/profile-templates", + "/security/iaas/profile-templates" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -99,7 +101,9 @@ async def list( profile. Client receives only common and created for him profile templates. """ return await self._get( - "/security/iaas/profile-templates", + "/security/iaas/profile-templates" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index 8394bd69..b54bb4af 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -78,7 +78,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", body=maybe_transform( { "fields": fields, @@ -122,7 +124,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -168,7 +172,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +205,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -234,7 +242,9 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", body=maybe_transform( { "fields": fields, @@ -280,7 +290,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", body=maybe_transform( { "fields": fields, @@ -346,7 +358,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", body=await async_maybe_transform( { "fields": fields, @@ -390,7 +404,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -436,7 +452,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,7 +485,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -502,7 +522,9 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", body=await async_maybe_transform( { "fields": fields, @@ -548,7 +570,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", body=await async_maybe_transform( { "fields": fields, diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index e6c589fa..4f2b6b24 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -108,7 +108,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,7 +150,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets", + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", page=SyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, @@ -196,7 +200,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -266,7 +272,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -306,7 +314,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets", + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", page=AsyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, @@ -354,7 +364,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/cors.py b/src/gcore/resources/storage/buckets/cors.py index 77a3e045..2cbefd77 100644 --- a/src/gcore/resources/storage/buckets/cors.py +++ b/src/gcore/resources/storage/buckets/cors.py @@ -74,7 +74,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -111,7 +113,9 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -172,7 +176,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=await async_maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -209,7 +215,9 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/lifecycle.py b/src/gcore/resources/storage/buckets/lifecycle.py index b80dffaf..60182808 100644 --- a/src/gcore/resources/storage/buckets/lifecycle.py +++ b/src/gcore/resources/storage/buckets/lifecycle.py @@ -78,7 +78,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=maybe_transform({"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -115,7 +117,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,7 +185,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=await async_maybe_transform( {"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams ), @@ -220,7 +226,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/policy.py b/src/gcore/resources/storage/buckets/policy.py index cca549f9..41c123c5 100644 --- a/src/gcore/resources/storage/buckets/policy.py +++ b/src/gcore/resources/storage/buckets/policy.py @@ -71,7 +71,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -109,7 +111,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -144,7 +148,9 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -204,7 +210,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,7 +250,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -277,7 +287,9 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index 1db372ae..ee32e77e 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -85,7 +85,9 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", body=maybe_transform( { "delete_sftp_password": delete_sftp_password, @@ -167,7 +169,9 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", body=await async_maybe_transform( { "delete_sftp_password": delete_sftp_password, diff --git a/src/gcore/resources/storage/locations.py b/src/gcore/resources/storage/locations.py index bce1aa37..be55ab51 100644 --- a/src/gcore/resources/storage/locations.py +++ b/src/gcore/resources/storage/locations.py @@ -69,7 +69,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v2/locations", + "/storage/provisioning/v2/locations" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/locations", page=SyncOffsetPage[Location], options=make_request_options( extra_headers=extra_headers, @@ -135,7 +137,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v2/locations", + "/storage/provisioning/v2/locations" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/locations", page=AsyncOffsetPage[Location], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/storage/statistics.py b/src/gcore/resources/storage/statistics.py index dbaf7b6e..25cbc05c 100644 --- a/src/gcore/resources/storage/statistics.py +++ b/src/gcore/resources/storage/statistics.py @@ -82,7 +82,9 @@ def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/total", body=maybe_transform( { "from_": from_, @@ -149,7 +151,9 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/series", body=maybe_transform( { "from_": from_, @@ -229,7 +233,9 @@ async def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/total", body=await async_maybe_transform( { "from_": from_, @@ -296,7 +302,9 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/series", body=await async_maybe_transform( { "from_": from_, diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index c3a2d71e..26ee34ae 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -138,7 +138,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/provisioning/v2/storage", + "/storage/provisioning/v2/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/storage", body=maybe_transform( { "location": location, @@ -188,7 +190,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/storage/provisioning/v2/storage/{storage_id}", + f"/storage/provisioning/v2/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}", body=maybe_transform( { "expires": expires, @@ -260,7 +264,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v3/storage", + "/storage/provisioning/v3/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v3/storage", page=SyncOffsetPage[Storage], options=make_request_options( extra_headers=extra_headers, @@ -312,7 +318,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -344,7 +352,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -379,7 +389,9 @@ def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -413,7 +425,9 @@ def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -452,7 +466,9 @@ def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -542,7 +558,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/provisioning/v2/storage", + "/storage/provisioning/v2/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/storage", body=await async_maybe_transform( { "location": location, @@ -592,7 +610,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/storage/provisioning/v2/storage/{storage_id}", + f"/storage/provisioning/v2/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}", body=await async_maybe_transform( { "expires": expires, @@ -664,7 +684,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v3/storage", + "/storage/provisioning/v3/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v3/storage", page=AsyncOffsetPage[Storage], options=make_request_options( extra_headers=extra_headers, @@ -716,7 +738,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -748,7 +772,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -783,7 +809,9 @@ async def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -817,7 +845,9 @@ async def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -858,7 +888,9 @@ async def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 6811e64c..02a61389 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -351,7 +351,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", body=maybe_transform( { "task_name": task_name, @@ -437,7 +437,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", page=SyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -490,7 +490,9 @@ def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -562,7 +564,9 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -641,7 +645,7 @@ def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/ai/info", + "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -983,7 +987,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", body=await async_maybe_transform( { "task_name": task_name, @@ -1069,7 +1073,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", page=AsyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -1122,7 +1126,9 @@ async def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1194,7 +1200,9 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1273,7 +1281,7 @@ async def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/ai/info", + "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index 757bde4d..2435c18a 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -78,7 +78,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", body=maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -111,7 +113,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", body=maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -148,7 +152,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", page=SyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -185,7 +191,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,7 +224,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -247,7 +257,9 @@ def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -310,7 +322,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -343,7 +357,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -380,7 +396,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", page=AsyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -417,7 +435,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -448,7 +468,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -479,7 +501,9 @@ async def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 3c45afb6..a67d8d61 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -72,7 +72,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/directories", + "/streaming/directories" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories", body=maybe_transform( { "name": name, @@ -117,7 +119,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", body=maybe_transform( { "name": name, @@ -166,7 +170,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +205,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -222,7 +230,9 @@ def get_tree( This endpoint returns hierarchical data about directories in video hosting. """ return self._get( - "/streaming/directories/tree", + "/streaming/directories/tree" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -279,7 +289,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/directories", + "/streaming/directories" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories", body=await async_maybe_transform( { "name": name, @@ -324,7 +336,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", body=await async_maybe_transform( { "name": name, @@ -373,7 +387,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -406,7 +422,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -429,7 +447,9 @@ async def get_tree( This endpoint returns hierarchical data about directories in video hosting. """ return await self._get( - "/streaming/directories/tree", + "/streaming/directories/tree" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/players.py b/src/gcore/resources/streaming/players.py index b2590c29..e7717e34 100644 --- a/src/gcore/resources/streaming/players.py +++ b/src/gcore/resources/streaming/players.py @@ -72,7 +72,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", body=maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,7 +109,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", body=maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -144,7 +146,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", page=SyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -181,7 +183,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -212,7 +216,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +250,9 @@ def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - f"/streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,7 +309,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", body=await async_maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -338,7 +346,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", body=await async_maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -373,7 +383,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", page=AsyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -410,7 +420,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +453,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,7 +487,9 @@ async def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - f"/streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index aea53517..a7804425 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -221,7 +221,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", body=maybe_transform( { "active": active, @@ -356,7 +358,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", body=maybe_transform( { "active": active, @@ -409,7 +413,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", page=SyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -446,7 +452,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -477,7 +485,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -508,7 +518,9 @@ def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -710,7 +722,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", body=await async_maybe_transform( { "active": active, @@ -845,7 +859,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", body=await async_maybe_transform( { "active": active, @@ -898,7 +914,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", page=AsyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -935,7 +953,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -966,7 +986,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -997,7 +1019,9 @@ async def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index d91c5569..7bd710f3 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -98,7 +98,9 @@ def list( is a paid feature. """ return self._get( - "/streaming/quality_sets", + "/streaming/quality_sets" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,7 +150,9 @@ def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - "/streaming/quality_sets/default", + "/streaming/quality_sets/default" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets/default", body=maybe_transform( { "live": live, @@ -240,7 +244,9 @@ async def list( is a paid feature. """ return await self._get( - "/streaming/quality_sets", + "/streaming/quality_sets" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -290,7 +296,9 @@ async def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - "/streaming/quality_sets/default", + "/streaming/quality_sets/default" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets/default", body=await async_maybe_transform( { "live": live, diff --git a/src/gcore/resources/streaming/restreams.py b/src/gcore/resources/streaming/restreams.py index 91f24ab2..2be0770f 100644 --- a/src/gcore/resources/streaming/restreams.py +++ b/src/gcore/resources/streaming/restreams.py @@ -67,7 +67,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", body=maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -100,7 +102,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", body=maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -135,7 +139,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", page=SyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -172,7 +178,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,7 +211,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -256,7 +266,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", body=await async_maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -289,7 +301,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", body=await async_maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -324,7 +338,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", page=AsyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -361,7 +377,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +410,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 82b2a1f6..913d43c1 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -124,7 +124,9 @@ def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -192,7 +194,9 @@ def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -261,7 +265,9 @@ def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -323,7 +329,9 @@ def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -376,7 +384,9 @@ def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/max_stream", + "/streaming/statistics/max_stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -430,7 +440,9 @@ def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/popular", + "/streaming/statistics/popular" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -481,7 +493,9 @@ def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/storage", + "/streaming/statistics/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -533,7 +547,9 @@ def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream", + "/streaming/statistics/stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -609,7 +625,9 @@ def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/uniqs", + "/streaming/statistics/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -713,7 +731,9 @@ def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -788,7 +808,9 @@ def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/views", + "/streaming/statistics/views" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -847,7 +869,9 @@ def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/browsers", + "/streaming/statistics/browsers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -899,7 +923,9 @@ def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/countries", + "/streaming/statistics/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -952,7 +978,9 @@ def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/hosts", + "/streaming/statistics/hosts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1005,7 +1033,9 @@ def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/systems", + "/streaming/statistics/systems" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1058,7 +1088,9 @@ def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/embeds", + "/streaming/statistics/embeds" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1111,7 +1143,9 @@ def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/regions", + "/streaming/statistics/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1175,7 +1209,9 @@ def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/heatmap", + "/streaming/statistics/heatmap" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1227,7 +1263,9 @@ def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1277,7 +1315,9 @@ def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1342,7 +1382,9 @@ def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1411,7 +1453,9 @@ def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1473,7 +1517,9 @@ def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1551,7 +1597,9 @@ async def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1619,7 +1667,9 @@ async def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1688,7 +1738,9 @@ async def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1750,7 +1802,9 @@ async def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1803,7 +1857,9 @@ async def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/max_stream", + "/streaming/statistics/max_stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1857,7 +1913,9 @@ async def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/popular", + "/streaming/statistics/popular" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1908,7 +1966,9 @@ async def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/storage", + "/streaming/statistics/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1960,7 +2020,9 @@ async def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream", + "/streaming/statistics/stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2036,7 +2098,9 @@ async def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/uniqs", + "/streaming/statistics/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2140,7 +2204,9 @@ async def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2215,7 +2281,9 @@ async def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/views", + "/streaming/statistics/views" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2274,7 +2342,9 @@ async def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/browsers", + "/streaming/statistics/browsers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2326,7 +2396,9 @@ async def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/countries", + "/streaming/statistics/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2379,7 +2451,9 @@ async def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/hosts", + "/streaming/statistics/hosts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2432,7 +2506,9 @@ async def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/systems", + "/streaming/statistics/systems" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2485,7 +2561,9 @@ async def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/embeds", + "/streaming/statistics/embeds" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2538,7 +2616,9 @@ async def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/regions", + "/streaming/statistics/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2602,7 +2682,9 @@ async def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/heatmap", + "/streaming/statistics/heatmap" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2654,7 +2736,9 @@ async def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2704,7 +2788,9 @@ async def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2769,7 +2855,9 @@ async def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2838,7 +2926,9 @@ async def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2900,7 +2990,9 @@ async def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index 780f045b..8f37a1e4 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -131,7 +131,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -183,7 +185,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", body=maybe_transform( { "height": height, @@ -225,7 +229,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -258,7 +264,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -290,7 +298,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -322,7 +332,9 @@ def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -436,7 +448,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -488,7 +502,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", body=await async_maybe_transform( { "height": height, @@ -530,7 +546,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -563,7 +581,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -595,7 +615,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -627,7 +649,9 @@ async def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index acc3a7f3..33a7b0fc 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -255,7 +255,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", body=maybe_transform( { "name": name, @@ -308,7 +308,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", body=maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -347,7 +349,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", page=SyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -409,7 +411,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +445,9 @@ def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -572,7 +578,9 @@ def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", body=maybe_transform( { "duration": duration, @@ -612,7 +620,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -663,7 +673,9 @@ def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -734,7 +746,9 @@ def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -771,7 +785,9 @@ def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -992,7 +1008,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", body=await async_maybe_transform( { "name": name, @@ -1045,7 +1061,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", body=await async_maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1084,7 +1102,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", page=AsyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -1146,7 +1164,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1178,7 +1198,9 @@ async def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1309,7 +1331,9 @@ async def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", body=await async_maybe_transform( { "duration": duration, @@ -1349,7 +1373,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1400,7 +1426,9 @@ async def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1471,7 +1499,9 @@ async def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1508,7 +1538,9 @@ async def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 5930fd58..fe18befd 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -134,7 +134,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", body=maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -188,7 +190,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", body=maybe_transform( { "language": language, @@ -227,7 +231,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -260,7 +266,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -292,7 +300,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -411,7 +421,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", body=await async_maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -465,7 +477,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", body=await async_maybe_transform( { "language": language, @@ -504,7 +518,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -537,7 +553,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -569,7 +587,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index 256d7d6f..6c6aec17 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -161,7 +161,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", body=maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -422,7 +422,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", body=maybe_transform( { "name": name, @@ -520,7 +522,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", page=SyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -579,7 +581,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -631,7 +635,9 @@ def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos/batch", + "/streaming/videos/batch" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/batch", body=maybe_transform({"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, @@ -684,7 +690,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -748,7 +756,9 @@ def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -782,7 +792,9 @@ def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - "/streaming/videos/names", + "/streaming/videos/names" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -912,7 +924,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", body=await async_maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1173,7 +1185,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", body=await async_maybe_transform( { "name": name, @@ -1271,7 +1285,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", page=AsyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -1330,7 +1344,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1382,7 +1398,9 @@ async def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos/batch", + "/streaming/videos/batch" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/batch", body=await async_maybe_transform( {"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams ), @@ -1439,7 +1457,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1503,7 +1523,9 @@ async def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1537,7 +1559,9 @@ async def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - "/streaming/videos/names", + "/streaming/videos/names" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py index 6f4aca32..855bd508 100644 --- a/src/gcore/resources/waap/advanced_rules.py +++ b/src/gcore/resources/waap/advanced_rules.py @@ -51,7 +51,9 @@ def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return self._get( - "/waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -91,7 +93,9 @@ async def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return await self._get( - "/waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index 11d40a03..78e82b31 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -88,7 +88,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", body=maybe_transform( { "name": name, @@ -152,7 +154,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", body=maybe_transform( { "block": block, @@ -210,7 +214,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", page=SyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -258,7 +264,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -291,7 +299,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -349,7 +359,9 @@ def preview( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/preview-custom-page", body=maybe_transform( { "error": error, @@ -430,7 +442,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", body=await async_maybe_transform( { "name": name, @@ -494,7 +508,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", body=await async_maybe_transform( { "block": block, @@ -552,7 +568,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", page=AsyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -600,7 +618,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -633,7 +653,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -691,7 +713,9 @@ async def preview( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/preview-custom-page", body=await async_maybe_transform( { "error": error, diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index f46e4f46..2bfd7a2a 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -104,7 +104,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", body=maybe_transform( { "action": action, @@ -184,7 +186,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -278,7 +282,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", page=SyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -332,7 +338,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -368,7 +376,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -410,7 +420,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,7 +509,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", body=await async_maybe_transform( { "action": action, @@ -577,7 +591,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -671,7 +687,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", page=AsyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -725,7 +743,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -761,7 +781,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -803,7 +825,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py index 426426f5..df3a60cf 100644 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -82,7 +82,9 @@ def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -115,7 +117,9 @@ def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -180,7 +184,9 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", page=SyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -231,7 +237,9 @@ def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,7 +289,9 @@ def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", body=maybe_transform( { "description_file_location": description_file_location, @@ -334,7 +344,9 @@ def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", body=maybe_transform( { "file_data": file_data, @@ -400,7 +412,9 @@ async def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -433,7 +447,9 @@ async def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -498,7 +514,9 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", page=AsyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -549,7 +567,9 @@ async def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -599,7 +619,9 @@ async def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", body=await async_maybe_transform( { "description_file_location": description_file_location, @@ -652,7 +674,9 @@ async def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", body=await async_maybe_transform( { "file_data": file_data, diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py index a6b25b2e..b75e11b4 100644 --- a/src/gcore/resources/waap/domains/api_path_groups.py +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -65,7 +65,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +121,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index ea3057ec..df8cefbc 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -84,7 +84,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", body=maybe_transform( { "http_scheme": http_scheme, @@ -143,7 +145,9 @@ def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", body=maybe_transform( { "api_groups": api_groups, @@ -238,7 +242,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", page=SyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -297,7 +303,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -335,7 +343,9 @@ def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,7 +412,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", body=await async_maybe_transform( { "http_scheme": http_scheme, @@ -461,7 +473,9 @@ async def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", body=await async_maybe_transform( { "api_groups": api_groups, @@ -556,7 +570,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", page=AsyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -615,7 +631,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -653,7 +671,9 @@ async def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index e81e575e..e98cf62e 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -93,7 +93,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", body=maybe_transform( { "action": action, @@ -156,7 +158,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -226,7 +230,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", page=SyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -279,7 +285,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -316,7 +324,9 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -355,7 +365,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -397,7 +409,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -468,7 +482,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", body=await async_maybe_transform( { "action": action, @@ -531,7 +547,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -601,7 +619,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", page=AsyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -654,7 +674,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -691,7 +713,9 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -730,7 +754,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -772,7 +798,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index 644191c1..9cf7af61 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -198,7 +198,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", body=maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -247,7 +249,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains", + "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", page=SyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -298,7 +300,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -331,7 +335,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -364,7 +370,9 @@ def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,7 +410,9 @@ def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -500,7 +510,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", body=await async_maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -549,7 +561,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains", + "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", page=AsyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -600,7 +612,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -633,7 +647,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -666,7 +682,9 @@ async def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -704,7 +722,9 @@ async def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index 3dbdde0b..fc6c2b83 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -91,7 +91,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", body=maybe_transform( { "action": action, @@ -153,7 +155,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -223,7 +227,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", page=SyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -276,7 +282,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -313,7 +321,9 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -352,7 +362,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +406,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -463,7 +477,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", body=await async_maybe_transform( { "action": action, @@ -525,7 +541,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -595,7 +613,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", page=AsyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -648,7 +668,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -685,7 +707,9 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -724,7 +748,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -766,7 +792,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 8b57783e..8d81b5e7 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -93,7 +93,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", body=maybe_transform( { "author": author, @@ -153,7 +155,9 @@ def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=maybe_transform( { "author": author, @@ -228,7 +232,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", page=SyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -283,7 +289,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -321,7 +329,9 @@ def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +402,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", body=await async_maybe_transform( { "author": author, @@ -452,7 +464,9 @@ async def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=await async_maybe_transform( { "author": author, @@ -527,7 +541,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", page=AsyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -582,7 +598,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -620,7 +638,9 @@ async def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 924fe5e2..068c932d 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -106,7 +106,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", page=SyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -158,7 +160,9 @@ def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +203,9 @@ def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", body=maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -289,7 +295,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", page=AsyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -341,7 +349,9 @@ async def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,7 +392,9 @@ async def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", body=await async_maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py index fcaabeaa..fe8edb00 100644 --- a/src/gcore/resources/waap/domains/settings.py +++ b/src/gcore/resources/waap/domains/settings.py @@ -74,7 +74,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", body=maybe_transform( { "api": api, @@ -114,7 +116,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -175,7 +179,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", body=await async_maybe_transform( { "api": api, @@ -215,7 +221,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index 94514578..b912f295 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -98,7 +98,9 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", page=SyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -161,7 +163,9 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", page=SyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -227,7 +231,9 @@ def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -280,7 +286,9 @@ def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -374,7 +382,9 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", page=SyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -440,7 +450,9 @@ def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -520,7 +532,9 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", page=AsyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -583,7 +597,9 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", page=AsyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -649,7 +665,9 @@ async def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -702,7 +720,9 @@ async def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -796,7 +816,9 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", page=AsyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -862,7 +884,9 @@ async def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index 5de0a968..8b9a2234 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -87,7 +87,9 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types", + "/waap/v1/security-insights/types" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/security-insights/types", page=SyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, @@ -172,7 +174,9 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types", + "/waap/v1/security-insights/types" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/security-insights/types", page=AsyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/ip_info/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py index 0c0050f2..2e1fbd71 100644 --- a/src/gcore/resources/waap/ip_info/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -95,7 +95,9 @@ def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -142,7 +144,9 @@ def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -189,7 +193,9 @@ def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -229,7 +235,9 @@ def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -274,7 +282,9 @@ def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -323,7 +333,9 @@ def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -372,7 +384,9 @@ def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -415,7 +429,9 @@ def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -479,7 +495,9 @@ async def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -526,7 +544,9 @@ async def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -573,7 +593,9 @@ async def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -613,7 +635,9 @@ async def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -658,7 +682,9 @@ async def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -707,7 +733,9 @@ async def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -756,7 +784,9 @@ async def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -799,7 +829,9 @@ async def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/ip_info/metrics.py b/src/gcore/resources/waap/ip_info/metrics.py index dd60d037..7d04cbd5 100644 --- a/src/gcore/resources/waap/ip_info/metrics.py +++ b/src/gcore/resources/waap/ip_info/metrics.py @@ -77,7 +77,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -149,7 +151,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py index 07a8bc66..9a12a3c4 100644 --- a/src/gcore/resources/waap/organizations.py +++ b/src/gcore/resources/waap/organizations.py @@ -82,7 +82,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations", + "/waap/v1/organizations" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/organizations", page=SyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, @@ -160,7 +162,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations", + "/waap/v1/organizations" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/organizations", page=AsyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py index e383f236..23840a49 100644 --- a/src/gcore/resources/waap/statistics.py +++ b/src/gcore/resources/waap/statistics.py @@ -87,7 +87,9 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/statistics/series", + "/waap/v1/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -169,7 +171,9 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/statistics/series", + "/waap/v1/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py index 879f3f47..543f186c 100644 --- a/src/gcore/resources/waap/tags.py +++ b/src/gcore/resources/waap/tags.py @@ -88,7 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags", + "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", page=SyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags", + "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", page=AsyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index d5509b5f..01f7d84c 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -147,7 +147,7 @@ def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return self._get( - "/waap/v1/clients/me", + "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -219,7 +219,7 @@ async def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return await self._get( - "/waap/v1/clients/me", + "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), From 981e6c9887514b3b5998885bdf2d89b1eeeeb98c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Sep 2025 07:43:07 +0000 Subject: [PATCH 333/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 29162beb..c571d3d7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-529e656a1e2b65a9adec55ae8207a9bc5a2bdd9c7adf846627aab1fa721f8e66.yml -openapi_spec_hash: 83d94f9375542b87f0227c982076ac1f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-da84a23d077729a2f9b3fddd8875bcfaa746d424a20bb24042c5a75c4f26cd9c.yml +openapi_spec_hash: 779e938deb4b2bbf7439e759411b2612 config_hash: fee4391924d7ea28b2bb5e5d81c8778f From d4ffcae877e8751203cdb0a7fe1657e62e7dd15f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Sep 2025 09:21:02 +0000 Subject: [PATCH 334/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index c571d3d7..ffc7f790 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-da84a23d077729a2f9b3fddd8875bcfaa746d424a20bb24042c5a75c4f26cd9c.yml openapi_spec_hash: 779e938deb4b2bbf7439e759411b2612 -config_hash: fee4391924d7ea28b2bb5e5d81c8778f +config_hash: fb616a3673c89cafa4b40ebf35b912e3 From 00ede9fd37f95c9d2ec1bd2be23a32b2359638f4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Sep 2025 14:30:24 +0000 Subject: [PATCH 335/592] feat(cloud): enable TF for floating IPs --- .stats.yml | 6 +++--- src/gcore/resources/cloud/cloud.py | 24 +++++++++++++++++++++++ src/gcore/resources/cloud/floating_ips.py | 10 ++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index ffc7f790..7a48049f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-da84a23d077729a2f9b3fddd8875bcfaa746d424a20bb24042c5a75c4f26cd9c.yml -openapi_spec_hash: 779e938deb4b2bbf7439e759411b2612 -config_hash: fb616a3673c89cafa4b40ebf35b912e3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0f2def526562974411b1e35ca95e3090a7d407c1cb60d111b08167da8ffc7d90.yml +openapi_spec_hash: b1c7de35e2926455753274c2f4c567bb +config_hash: ae97def27b01f1398b799f2463b56aa0 diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index bd70d20c..eee5ccd6 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -263,6 +263,10 @@ def volumes(self) -> VolumesResource: @cached_property def floating_ips(self) -> FloatingIPsResource: + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ return FloatingIPsResource(self._client) @cached_property @@ -388,6 +392,10 @@ def volumes(self) -> AsyncVolumesResource: @cached_property def floating_ips(self) -> AsyncFloatingIPsResource: + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ return AsyncFloatingIPsResource(self._client) @cached_property @@ -516,6 +524,10 @@ def volumes(self) -> VolumesResourceWithRawResponse: @cached_property def floating_ips(self) -> FloatingIPsResourceWithRawResponse: + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ return FloatingIPsResourceWithRawResponse(self._cloud.floating_ips) @cached_property @@ -625,6 +637,10 @@ def volumes(self) -> AsyncVolumesResourceWithRawResponse: @cached_property def floating_ips(self) -> AsyncFloatingIPsResourceWithRawResponse: + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ return AsyncFloatingIPsResourceWithRawResponse(self._cloud.floating_ips) @cached_property @@ -734,6 +750,10 @@ def volumes(self) -> VolumesResourceWithStreamingResponse: @cached_property def floating_ips(self) -> FloatingIPsResourceWithStreamingResponse: + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ return FloatingIPsResourceWithStreamingResponse(self._cloud.floating_ips) @cached_property @@ -843,6 +863,10 @@ def volumes(self) -> AsyncVolumesResourceWithStreamingResponse: @cached_property def floating_ips(self) -> AsyncFloatingIPsResourceWithStreamingResponse: + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ return AsyncFloatingIPsResourceWithStreamingResponse(self._cloud.floating_ips) @cached_property diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 06f0d86d..67523605 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -33,6 +33,11 @@ class FloatingIPsResource(SyncAPIResource): + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ + @cached_property def with_raw_response(self) -> FloatingIPsResourceWithRawResponse: """ @@ -447,6 +452,11 @@ def unassign( class AsyncFloatingIPsResource(AsyncAPIResource): + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ + @cached_property def with_raw_response(self) -> AsyncFloatingIPsResourceWithRawResponse: """ From 0e0b5f8fed27472b4854b674a5a1eeb2225c86ed Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 10:10:45 +0000 Subject: [PATCH 336/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7a48049f..eb1d14c1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0f2def526562974411b1e35ca95e3090a7d407c1cb60d111b08167da8ffc7d90.yml -openapi_spec_hash: b1c7de35e2926455753274c2f4c567bb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-50ea4cb2cfb59cc83930457f5119efe716bf23a7cc5d6c6949b25ed842b4bc9a.yml +openapi_spec_hash: e75a52f3a96070ecb451fff82a33e94d config_hash: ae97def27b01f1398b799f2463b56aa0 From 9e2e9147bff3acbe6d95b37580a9c64a9a9885c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Sep 2025 14:10:31 +0000 Subject: [PATCH 337/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index eb1d14c1..ea4c0bb8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-50ea4cb2cfb59cc83930457f5119efe716bf23a7cc5d6c6949b25ed842b4bc9a.yml -openapi_spec_hash: e75a52f3a96070ecb451fff82a33e94d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8547b524a14d0f5e0093396c4e0e1afab2fe239396910617c009402b547cba46.yml +openapi_spec_hash: 8768c88e22bbe1d3042539be56ea8469 config_hash: ae97def27b01f1398b799f2463b56aa0 From 4e28d3e494053218dbb39f5108b11f4e441d27c3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Sep 2025 16:19:51 +0000 Subject: [PATCH 338/592] fix(client): correctly generate K8sClusterSlurmAddonV2Serializers --- .stats.yml | 6 +- api.md | 1 + .../gpu_baremetal_clusters.py | 178 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 1 + .../gpu_baremetal_cluster_action_params.py | 46 +++++ .../types/cloud/k8s/cluster_update_params.py | 2 +- .../cloud/test_gpu_baremetal_clusters.py | 108 +++++++++++ 7 files changed, 338 insertions(+), 4 deletions(-) create mode 100644 src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py diff --git a/.stats.yml b/.stats.yml index ea4c0bb8..076e10de 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8547b524a14d0f5e0093396c4e0e1afab2fe239396910617c009402b547cba46.yml +configured_endpoints: 525 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d59e09eb6882032973e42339edbc5170a0d695dcb127e28e29109f1a1f088afd.yml openapi_spec_hash: 8768c88e22bbe1d3042539be56ea8469 -config_hash: ae97def27b01f1398b799f2463b56aa0 +config_hash: b9ce342bbc2dc553f1ef41dc1ccf9084 diff --git a/api.md b/api.md index 56d6038b..19a53ae1 100644 --- a/api.md +++ b/api.md @@ -770,6 +770,7 @@ Methods: - client.cloud.gpu_baremetal_clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalCluster] - client.cloud.gpu_baremetal_clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.get(cluster_id, \*, project_id, region_id) -> GPUBaremetalCluster - client.cloud.gpu_baremetal_clusters.powercycle_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List - client.cloud.gpu_baremetal_clusters.reboot_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 8275201c..bcde0157 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -52,6 +52,7 @@ from ....pagination import SyncOffsetPage, AsyncOffsetPage from ....types.cloud import ( gpu_baremetal_cluster_list_params, + gpu_baremetal_cluster_action_params, gpu_baremetal_cluster_create_params, gpu_baremetal_cluster_delete_params, gpu_baremetal_cluster_resize_params, @@ -59,6 +60,7 @@ ) from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.gpu_baremetal_cluster import GPUBaremetalCluster from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_cluster_server_v1_list import GPUBaremetalClusterServerV1List @@ -316,6 +318,88 @@ def delete( cast_to=TaskIDList, ) + def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["update_tags"], + tags: Optional[TagUpdateMapParam], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a baremetal GPU cluster. + + Available actions: update + tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._post( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action", + body=maybe_transform( + { + "action": action, + "tags": tags, + }, + gpu_baremetal_cluster_action_params.GPUBaremetalClusterActionParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + def get( self, cluster_id: str, @@ -809,6 +893,88 @@ async def delete( cast_to=TaskIDList, ) + async def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["update_tags"], + tags: Optional[TagUpdateMapParam], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a baremetal GPU cluster. + + Available actions: update + tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._post( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action", + body=await async_maybe_transform( + { + "action": action, + "tags": tags, + }, + gpu_baremetal_cluster_action_params.GPUBaremetalClusterActionParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + async def get( self, cluster_id: str, @@ -1064,6 +1230,9 @@ def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None self.delete = to_raw_response_wrapper( gpu_baremetal_clusters.delete, ) + self.action = to_raw_response_wrapper( + gpu_baremetal_clusters.action, + ) self.get = to_raw_response_wrapper( gpu_baremetal_clusters.get, ) @@ -1110,6 +1279,9 @@ def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> self.delete = async_to_raw_response_wrapper( gpu_baremetal_clusters.delete, ) + self.action = async_to_raw_response_wrapper( + gpu_baremetal_clusters.action, + ) self.get = async_to_raw_response_wrapper( gpu_baremetal_clusters.get, ) @@ -1156,6 +1328,9 @@ def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None self.delete = to_streamed_response_wrapper( gpu_baremetal_clusters.delete, ) + self.action = to_streamed_response_wrapper( + gpu_baremetal_clusters.action, + ) self.get = to_streamed_response_wrapper( gpu_baremetal_clusters.get, ) @@ -1202,6 +1377,9 @@ def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> self.delete = async_to_streamed_response_wrapper( gpu_baremetal_clusters.delete, ) + self.action = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.action, + ) self.get = async_to_streamed_response_wrapper( gpu_baremetal_clusters.get, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 21972950..852d56df 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -166,6 +166,7 @@ from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams +from .gpu_baremetal_cluster_action_params import GPUBaremetalClusterActionParams as GPUBaremetalClusterActionParams from .gpu_baremetal_cluster_create_params import GPUBaremetalClusterCreateParams as GPUBaremetalClusterCreateParams from .gpu_baremetal_cluster_delete_params import GPUBaremetalClusterDeleteParams as GPUBaremetalClusterDeleteParams from .gpu_baremetal_cluster_resize_params import GPUBaremetalClusterResizeParams as GPUBaremetalClusterResizeParams diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py new file mode 100644 index 00000000..66c88a9f --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +from .tag_update_map_param import TagUpdateMapParam + +__all__ = ["GPUBaremetalClusterActionParams"] + + +class GPUBaremetalClusterActionParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["update_tags"]] + """Action name""" + + tags: Required[Optional[TagUpdateMapParam]] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ diff --git a/src/gcore/types/cloud/k8s/cluster_update_params.py b/src/gcore/types/cloud/k8s/cluster_update_params.py index 01670802..46e02a9d 100644 --- a/src/gcore/types/cloud/k8s/cluster_update_params.py +++ b/src/gcore/types/cloud/k8s/cluster_update_params.py @@ -135,7 +135,7 @@ class AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer(TypedDict, total=False): class AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer(TypedDict, total=False): - enabled: Required[bool] + enabled: Required[Literal[False]] """The Slurm add-on will be disabled in the cluster.""" diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index b6a7547c..9fc01cc9 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -204,6 +204,60 @@ def test_path_params_delete(self, client: Gcore) -> None: region_id=7, ) + @parametrize + def test_method_action(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_raw_response_action(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_streaming_response_action(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_action(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + @parametrize def test_method_get(self, client: Gcore) -> None: gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.get( @@ -642,6 +696,60 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: region_id=7, ) + @parametrize + async def test_method_action(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_raw_response_action(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_action(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_action(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.get( From 2cb195bdbbdcdf8b504c51e89a357876de1acb42 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Sep 2025 05:01:04 +0000 Subject: [PATCH 339/592] feat(cdn): add API support --- .stats.yml | 4 +- api.md | 314 ++ src/gcore/_client.py | 9 + src/gcore/pagination.py | 137 + src/gcore/resources/__init__.py | 14 + src/gcore/resources/cdn/__init__.py | 201 ++ src/gcore/resources/cdn/audit_log.py | 406 +++ src/gcore/resources/cdn/cdn.py | 957 ++++++ src/gcore/resources/cdn/certificates.py | 1062 +++++++ src/gcore/resources/cdn/ip_ranges.py | 224 ++ src/gcore/resources/cdn/logs/__init__.py | 33 + src/gcore/resources/cdn/logs/logs.py | 1424 +++++++++ src/gcore/resources/cdn/logs/settings.py | 1081 +++++++ .../resources/cdn/logs_uploader/__init__.py | 61 + .../resources/cdn/logs_uploader/configs.py | 868 ++++++ .../cdn/logs_uploader/logs_uploader.py | 166 ++ .../resources/cdn/logs_uploader/policies.py | 1060 +++++++ .../resources/cdn/logs_uploader/targets.py | 811 +++++ src/gcore/resources/cdn/metrics.py | 419 +++ src/gcore/resources/cdn/network_capacity.py | 139 + src/gcore/resources/cdn/origin_groups.py | 1496 ++++++++++ src/gcore/resources/cdn/resources/__init__.py | 47 + .../resources/cdn/resources/resources.py | 2060 +++++++++++++ src/gcore/resources/cdn/resources/rules.py | 1027 +++++++ src/gcore/resources/cdn/resources/shield.py | 259 ++ src/gcore/resources/cdn/rule_templates.py | 883 ++++++ src/gcore/resources/cdn/shields.py | 139 + src/gcore/resources/cdn/statistics.py | 1408 +++++++++ .../resources/cdn/trusted_ca_certificates.py | 592 ++++ src/gcore/types/cdn/__init__.py | 80 + src/gcore/types/cdn/audit_log_list_params.py | 73 + src/gcore/types/cdn/ca_certificate.py | 53 + src/gcore/types/cdn/ca_certificate_list.py | 10 + src/gcore/types/cdn/cdn_account.py | 86 + src/gcore/types/cdn/cdn_account_limits.py | 27 + src/gcore/types/cdn/cdn_audit_log_entry.py | 66 + src/gcore/types/cdn/cdn_available_features.py | 46 + .../cdn/cdn_list_purge_statuses_params.py | 67 + src/gcore/types/cdn/cdn_log_entry.py | 70 + src/gcore/types/cdn/cdn_metrics.py | 22 + src/gcore/types/cdn/cdn_metrics_groups.py | 13 + src/gcore/types/cdn/cdn_metrics_values.py | 19 + src/gcore/types/cdn/cdn_resource.py | 1977 +++++++++++++ src/gcore/types/cdn/cdn_resource_list.py | 10 + .../types/cdn/cdn_update_account_params.py | 15 + .../types/cdn/certificate_create_params.py | 51 + .../cdn/certificate_get_status_params.py | 14 + .../types/cdn/certificate_list_params.py | 29 + .../types/cdn/certificate_replace_params.py | 39 + src/gcore/types/cdn/log_download_params.py | 279 ++ src/gcore/types/cdn/log_list_params.py | 273 ++ src/gcore/types/cdn/logs/__init__.py | 7 + src/gcore/types/cdn/logs/log_settings.py | 172 ++ .../types/cdn/logs/setting_create_params.py | 200 ++ .../types/cdn/logs/setting_update_params.py | 200 ++ src/gcore/types/cdn/logs_aggregated_stats.py | 23 + src/gcore/types/cdn/logs_uploader/__init__.py | 23 + .../cdn/logs_uploader/config_create_params.py | 32 + .../cdn/logs_uploader/config_list_params.py | 16 + .../logs_uploader/config_replace_params.py | 32 + .../cdn/logs_uploader/config_update_params.py | 32 + .../cdn/logs_uploader/logs_uploader_config.py | 51 + .../logs_uploader_config_list.py | 10 + .../cdn/logs_uploader/logs_uploader_policy.py | 73 + .../logs_uploader_policy_list.py | 10 + .../cdn/logs_uploader/logs_uploader_target.py | 236 ++ .../logs_uploader_target_list.py | 10 + .../cdn/logs_uploader/policy_create_params.py | 61 + .../policy_list_fields_response.py | 8 + .../cdn/logs_uploader/policy_list_params.py | 16 + .../logs_uploader/policy_replace_params.py | 61 + .../cdn/logs_uploader/policy_update_params.py | 61 + .../cdn/logs_uploader/target_create_params.py | 249 ++ .../cdn/logs_uploader/target_list_params.py | 16 + .../logs_uploader/target_replace_params.py | 249 ++ .../cdn/logs_uploader/target_update_params.py | 249 ++ .../types/cdn/logs_uploader_validation.py | 23 + src/gcore/types/cdn/metric_list_params.py | 168 ++ src/gcore/types/cdn/network_capacity.py | 22 + .../types/cdn/origin_group_create_params.py | 184 ++ .../types/cdn/origin_group_list_params.py | 24 + .../types/cdn/origin_group_replace_params.py | 190 ++ .../types/cdn/origin_group_update_params.py | 190 ++ src/gcore/types/cdn/origin_groups.py | 212 ++ src/gcore/types/cdn/origin_groups_list.py | 10 + src/gcore/types/cdn/public_ip_list.py | 15 + src/gcore/types/cdn/public_network_list.py | 15 + src/gcore/types/cdn/purge_status.py | 55 + .../types/cdn/resource_aggregated_stats.py | 80 + src/gcore/types/cdn/resource_create_params.py | 1825 ++++++++++++ src/gcore/types/cdn/resource_list_params.py | 107 + .../types/cdn/resource_prefetch_params.py | 17 + src/gcore/types/cdn/resource_purge_params.py | 71 + .../types/cdn/resource_replace_params.py | 1803 ++++++++++++ src/gcore/types/cdn/resource_update_params.py | 1794 +++++++++++ src/gcore/types/cdn/resource_usage_stats.py | 111 + src/gcore/types/cdn/resources/__init__.py | 11 + .../types/cdn/resources/cdn_resource_rule.py | 1695 +++++++++++ .../types/cdn/resources/origin_shielding.py | 15 + .../types/cdn/resources/rule_create_params.py | 1652 +++++++++++ .../types/cdn/resources/rule_list_response.py | 10 + .../cdn/resources/rule_replace_params.py | 1654 +++++++++++ .../types/cdn/resources/rule_update_params.py | 1654 +++++++++++ .../cdn/resources/shield_replace_params.py | 16 + src/gcore/types/cdn/rule_template.py | 1666 +++++++++++ .../types/cdn/rule_template_create_params.py | 1636 +++++++++++ src/gcore/types/cdn/rule_template_list.py | 10 + .../types/cdn/rule_template_replace_params.py | 1636 +++++++++++ .../types/cdn/rule_template_update_params.py | 1636 +++++++++++ .../types/cdn/shield_aggregated_stats.py | 23 + src/gcore/types/cdn/shield_list_response.py | 25 + src/gcore/types/cdn/ssl_detail.py | 62 + src/gcore/types/cdn/ssl_detail_list.py | 10 + src/gcore/types/cdn/ssl_request_status.py | 135 + ...tistic_get_logs_usage_aggregated_params.py | 42 + .../statistic_get_logs_usage_series_params.py | 35 + ...ic_get_resource_usage_aggregated_params.py | 151 + ...tistic_get_resource_usage_series_params.py | 131 + ...stic_get_shield_usage_aggregated_params.py | 42 + ...tatistic_get_shield_usage_series_params.py | 25 + .../trusted_ca_certificate_create_params.py | 23 + .../cdn/trusted_ca_certificate_list_params.py | 29 + .../trusted_ca_certificate_replace_params.py | 15 + src/gcore/types/cdn/usage_series_stats.py | 31 + tests/api_resources/cdn/__init__.py | 1 + tests/api_resources/cdn/logs/__init__.py | 1 + tests/api_resources/cdn/logs/test_settings.py | 568 ++++ .../cdn/logs_uploader/__init__.py | 1 + .../cdn/logs_uploader/test_configs.py | 572 ++++ .../cdn/logs_uploader/test_policies.py | 572 ++++ .../cdn/logs_uploader/test_targets.py | 668 +++++ tests/api_resources/cdn/resources/__init__.py | 1 + .../api_resources/cdn/resources/test_rules.py | 2101 +++++++++++++ .../cdn/resources/test_shield.py | 164 ++ tests/api_resources/cdn/test_audit_log.py | 171 ++ tests/api_resources/cdn/test_certificates.py | 686 +++++ tests/api_resources/cdn/test_ip_ranges.py | 124 + tests/api_resources/cdn/test_logs.py | 437 +++ tests/api_resources/cdn/test_metrics.py | 134 + .../cdn/test_network_capacity.py | 74 + tests/api_resources/cdn/test_origin_groups.py | 971 ++++++ tests/api_resources/cdn/test_resources.py | 2617 +++++++++++++++++ .../api_resources/cdn/test_rule_templates.py | 2035 +++++++++++++ tests/api_resources/cdn/test_shields.py | 74 + tests/api_resources/cdn/test_statistics.py | 608 ++++ .../cdn/test_trusted_ca_certificates.py | 355 +++ tests/api_resources/test_cdn.py | 320 ++ 147 files changed, 56956 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cdn/__init__.py create mode 100644 src/gcore/resources/cdn/audit_log.py create mode 100644 src/gcore/resources/cdn/cdn.py create mode 100644 src/gcore/resources/cdn/certificates.py create mode 100644 src/gcore/resources/cdn/ip_ranges.py create mode 100644 src/gcore/resources/cdn/logs/__init__.py create mode 100644 src/gcore/resources/cdn/logs/logs.py create mode 100644 src/gcore/resources/cdn/logs/settings.py create mode 100644 src/gcore/resources/cdn/logs_uploader/__init__.py create mode 100644 src/gcore/resources/cdn/logs_uploader/configs.py create mode 100644 src/gcore/resources/cdn/logs_uploader/logs_uploader.py create mode 100644 src/gcore/resources/cdn/logs_uploader/policies.py create mode 100644 src/gcore/resources/cdn/logs_uploader/targets.py create mode 100644 src/gcore/resources/cdn/metrics.py create mode 100644 src/gcore/resources/cdn/network_capacity.py create mode 100644 src/gcore/resources/cdn/origin_groups.py create mode 100644 src/gcore/resources/cdn/resources/__init__.py create mode 100644 src/gcore/resources/cdn/resources/resources.py create mode 100644 src/gcore/resources/cdn/resources/rules.py create mode 100644 src/gcore/resources/cdn/resources/shield.py create mode 100644 src/gcore/resources/cdn/rule_templates.py create mode 100644 src/gcore/resources/cdn/shields.py create mode 100644 src/gcore/resources/cdn/statistics.py create mode 100644 src/gcore/resources/cdn/trusted_ca_certificates.py create mode 100644 src/gcore/types/cdn/__init__.py create mode 100644 src/gcore/types/cdn/audit_log_list_params.py create mode 100644 src/gcore/types/cdn/ca_certificate.py create mode 100644 src/gcore/types/cdn/ca_certificate_list.py create mode 100644 src/gcore/types/cdn/cdn_account.py create mode 100644 src/gcore/types/cdn/cdn_account_limits.py create mode 100644 src/gcore/types/cdn/cdn_audit_log_entry.py create mode 100644 src/gcore/types/cdn/cdn_available_features.py create mode 100644 src/gcore/types/cdn/cdn_list_purge_statuses_params.py create mode 100644 src/gcore/types/cdn/cdn_log_entry.py create mode 100644 src/gcore/types/cdn/cdn_metrics.py create mode 100644 src/gcore/types/cdn/cdn_metrics_groups.py create mode 100644 src/gcore/types/cdn/cdn_metrics_values.py create mode 100644 src/gcore/types/cdn/cdn_resource.py create mode 100644 src/gcore/types/cdn/cdn_resource_list.py create mode 100644 src/gcore/types/cdn/cdn_update_account_params.py create mode 100644 src/gcore/types/cdn/certificate_create_params.py create mode 100644 src/gcore/types/cdn/certificate_get_status_params.py create mode 100644 src/gcore/types/cdn/certificate_list_params.py create mode 100644 src/gcore/types/cdn/certificate_replace_params.py create mode 100644 src/gcore/types/cdn/log_download_params.py create mode 100644 src/gcore/types/cdn/log_list_params.py create mode 100644 src/gcore/types/cdn/logs/__init__.py create mode 100644 src/gcore/types/cdn/logs/log_settings.py create mode 100644 src/gcore/types/cdn/logs/setting_create_params.py create mode 100644 src/gcore/types/cdn/logs/setting_update_params.py create mode 100644 src/gcore/types/cdn/logs_aggregated_stats.py create mode 100644 src/gcore/types/cdn/logs_uploader/__init__.py create mode 100644 src/gcore/types/cdn/logs_uploader/config_create_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/config_list_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/config_replace_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/config_update_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/logs_uploader_config.py create mode 100644 src/gcore/types/cdn/logs_uploader/logs_uploader_config_list.py create mode 100644 src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py create mode 100644 src/gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py create mode 100644 src/gcore/types/cdn/logs_uploader/logs_uploader_target.py create mode 100644 src/gcore/types/cdn/logs_uploader/logs_uploader_target_list.py create mode 100644 src/gcore/types/cdn/logs_uploader/policy_create_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/policy_list_fields_response.py create mode 100644 src/gcore/types/cdn/logs_uploader/policy_list_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/policy_replace_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/policy_update_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/target_create_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/target_list_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/target_replace_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/target_update_params.py create mode 100644 src/gcore/types/cdn/logs_uploader_validation.py create mode 100644 src/gcore/types/cdn/metric_list_params.py create mode 100644 src/gcore/types/cdn/network_capacity.py create mode 100644 src/gcore/types/cdn/origin_group_create_params.py create mode 100644 src/gcore/types/cdn/origin_group_list_params.py create mode 100644 src/gcore/types/cdn/origin_group_replace_params.py create mode 100644 src/gcore/types/cdn/origin_group_update_params.py create mode 100644 src/gcore/types/cdn/origin_groups.py create mode 100644 src/gcore/types/cdn/origin_groups_list.py create mode 100644 src/gcore/types/cdn/public_ip_list.py create mode 100644 src/gcore/types/cdn/public_network_list.py create mode 100644 src/gcore/types/cdn/purge_status.py create mode 100644 src/gcore/types/cdn/resource_aggregated_stats.py create mode 100644 src/gcore/types/cdn/resource_create_params.py create mode 100644 src/gcore/types/cdn/resource_list_params.py create mode 100644 src/gcore/types/cdn/resource_prefetch_params.py create mode 100644 src/gcore/types/cdn/resource_purge_params.py create mode 100644 src/gcore/types/cdn/resource_replace_params.py create mode 100644 src/gcore/types/cdn/resource_update_params.py create mode 100644 src/gcore/types/cdn/resource_usage_stats.py create mode 100644 src/gcore/types/cdn/resources/__init__.py create mode 100644 src/gcore/types/cdn/resources/cdn_resource_rule.py create mode 100644 src/gcore/types/cdn/resources/origin_shielding.py create mode 100644 src/gcore/types/cdn/resources/rule_create_params.py create mode 100644 src/gcore/types/cdn/resources/rule_list_response.py create mode 100644 src/gcore/types/cdn/resources/rule_replace_params.py create mode 100644 src/gcore/types/cdn/resources/rule_update_params.py create mode 100644 src/gcore/types/cdn/resources/shield_replace_params.py create mode 100644 src/gcore/types/cdn/rule_template.py create mode 100644 src/gcore/types/cdn/rule_template_create_params.py create mode 100644 src/gcore/types/cdn/rule_template_list.py create mode 100644 src/gcore/types/cdn/rule_template_replace_params.py create mode 100644 src/gcore/types/cdn/rule_template_update_params.py create mode 100644 src/gcore/types/cdn/shield_aggregated_stats.py create mode 100644 src/gcore/types/cdn/shield_list_response.py create mode 100644 src/gcore/types/cdn/ssl_detail.py create mode 100644 src/gcore/types/cdn/ssl_detail_list.py create mode 100644 src/gcore/types/cdn/ssl_request_status.py create mode 100644 src/gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py create mode 100644 src/gcore/types/cdn/statistic_get_logs_usage_series_params.py create mode 100644 src/gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py create mode 100644 src/gcore/types/cdn/statistic_get_resource_usage_series_params.py create mode 100644 src/gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py create mode 100644 src/gcore/types/cdn/statistic_get_shield_usage_series_params.py create mode 100644 src/gcore/types/cdn/trusted_ca_certificate_create_params.py create mode 100644 src/gcore/types/cdn/trusted_ca_certificate_list_params.py create mode 100644 src/gcore/types/cdn/trusted_ca_certificate_replace_params.py create mode 100644 src/gcore/types/cdn/usage_series_stats.py create mode 100644 tests/api_resources/cdn/__init__.py create mode 100644 tests/api_resources/cdn/logs/__init__.py create mode 100644 tests/api_resources/cdn/logs/test_settings.py create mode 100644 tests/api_resources/cdn/logs_uploader/__init__.py create mode 100644 tests/api_resources/cdn/logs_uploader/test_configs.py create mode 100644 tests/api_resources/cdn/logs_uploader/test_policies.py create mode 100644 tests/api_resources/cdn/logs_uploader/test_targets.py create mode 100644 tests/api_resources/cdn/resources/__init__.py create mode 100644 tests/api_resources/cdn/resources/test_rules.py create mode 100644 tests/api_resources/cdn/resources/test_shield.py create mode 100644 tests/api_resources/cdn/test_audit_log.py create mode 100644 tests/api_resources/cdn/test_certificates.py create mode 100644 tests/api_resources/cdn/test_ip_ranges.py create mode 100644 tests/api_resources/cdn/test_logs.py create mode 100644 tests/api_resources/cdn/test_metrics.py create mode 100644 tests/api_resources/cdn/test_network_capacity.py create mode 100644 tests/api_resources/cdn/test_origin_groups.py create mode 100644 tests/api_resources/cdn/test_resources.py create mode 100644 tests/api_resources/cdn/test_rule_templates.py create mode 100644 tests/api_resources/cdn/test_shields.py create mode 100644 tests/api_resources/cdn/test_statistics.py create mode 100644 tests/api_resources/cdn/test_trusted_ca_certificates.py create mode 100644 tests/api_resources/test_cdn.py diff --git a/.stats.yml b/.stats.yml index 076e10de..28d74a32 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 525 +configured_endpoints: 612 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d59e09eb6882032973e42339edbc5170a0d695dcb127e28e29109f1a1f088afd.yml openapi_spec_hash: 8768c88e22bbe1d3042539be56ea8469 -config_hash: b9ce342bbc2dc553f1ef41dc1ccf9084 +config_hash: 11eb703eee66609eba76695b18f8cb4a diff --git a/api.md b/api.md index 19a53ae1..b15ab5ea 100644 --- a/api.md +++ b/api.md @@ -2076,3 +2076,317 @@ Methods: - client.storage.buckets.policy.create(bucket_name, \*, storage_id) -> None - client.storage.buckets.policy.delete(bucket_name, \*, storage_id) -> None - client.storage.buckets.policy.get(bucket_name, \*, storage_id) -> PolicyGetResponse + +# Cdn + +Types: + +```python +from gcore.types.cdn import CdnAccount, CdnAccountLimits, CdnAvailableFeatures, PurgeStatus +``` + +Methods: + +- client.cdn.get_account_limits() -> CdnAccountLimits +- client.cdn.get_account_overview() -> CdnAccount +- client.cdn.get_available_features() -> CdnAvailableFeatures +- client.cdn.list_purge_statuses(\*\*params) -> SyncOffsetPageCdn[PurgeStatus] +- client.cdn.update_account(\*\*params) -> CdnAccount + +## Resources + +Types: + +```python +from gcore.types.cdn import CdnResource, CdnResourceList +``` + +Methods: + +- client.cdn.resources.create(\*\*params) -> CdnResource +- client.cdn.resources.update(resource_id, \*\*params) -> CdnResource +- client.cdn.resources.list(\*\*params) -> CdnResourceList +- client.cdn.resources.delete(resource_id) -> None +- client.cdn.resources.get(resource_id) -> CdnResource +- client.cdn.resources.prefetch(resource_id, \*\*params) -> None +- client.cdn.resources.prevalidate_ssl_le_certificate(resource_id) -> None +- client.cdn.resources.purge(resource_id, \*\*params) -> None +- client.cdn.resources.replace(resource_id, \*\*params) -> CdnResource + +### Shield + +Types: + +```python +from gcore.types.cdn.resources import OriginShielding, OriginShieldingUpdated +``` + +Methods: + +- client.cdn.resources.shield.get(resource_id) -> OriginShielding +- client.cdn.resources.shield.replace(resource_id, \*\*params) -> object + +### Rules + +Types: + +```python +from gcore.types.cdn.resources import CdnResourceRule, RuleListResponse +``` + +Methods: + +- client.cdn.resources.rules.create(resource_id, \*\*params) -> CdnResourceRule +- client.cdn.resources.rules.update(rule_id, \*, resource_id, \*\*params) -> CdnResourceRule +- client.cdn.resources.rules.list(resource_id) -> RuleListResponse +- client.cdn.resources.rules.delete(rule_id, \*, resource_id) -> None +- client.cdn.resources.rules.get(rule_id, \*, resource_id) -> CdnResourceRule +- client.cdn.resources.rules.replace(rule_id, \*, resource_id, \*\*params) -> CdnResourceRule + +## Shields + +Types: + +```python +from gcore.types.cdn import ShieldListResponse +``` + +Methods: + +- client.cdn.shields.list() -> ShieldListResponse + +## OriginGroups + +Types: + +```python +from gcore.types.cdn import OriginGroups, OriginGroupsList +``` + +Methods: + +- client.cdn.origin_groups.create(\*\*params) -> OriginGroups +- client.cdn.origin_groups.update(origin_group_id, \*\*params) -> OriginGroups +- client.cdn.origin_groups.list(\*\*params) -> OriginGroupsList +- client.cdn.origin_groups.delete(origin_group_id) -> None +- client.cdn.origin_groups.get(origin_group_id) -> OriginGroups +- client.cdn.origin_groups.replace(origin_group_id, \*\*params) -> OriginGroups + +## RuleTemplates + +Types: + +```python +from gcore.types.cdn import RuleTemplate, RuleTemplateList +``` + +Methods: + +- client.cdn.rule_templates.create(\*\*params) -> RuleTemplate +- client.cdn.rule_templates.update(rule_template_id, \*\*params) -> RuleTemplate +- client.cdn.rule_templates.list() -> RuleTemplateList +- client.cdn.rule_templates.delete(rule_template_id) -> None +- client.cdn.rule_templates.get(rule_template_id) -> RuleTemplate +- client.cdn.rule_templates.replace(rule_template_id, \*\*params) -> RuleTemplate + +## Certificates + +Types: + +```python +from gcore.types.cdn import SslDetail, SslDetailList, SslRequestStatus +``` + +Methods: + +- client.cdn.certificates.create(\*\*params) -> None +- client.cdn.certificates.list(\*\*params) -> SslDetailList +- client.cdn.certificates.delete(ssl_id) -> None +- client.cdn.certificates.force_retry(cert_id) -> None +- client.cdn.certificates.get(ssl_id) -> SslDetail +- client.cdn.certificates.get_status(cert_id, \*\*params) -> SslRequestStatus +- client.cdn.certificates.renew(cert_id) -> None +- client.cdn.certificates.replace(ssl_id, \*\*params) -> SslDetail + +## TrustedCaCertificates + +Types: + +```python +from gcore.types.cdn import CaCertificate, CaCertificateList +``` + +Methods: + +- client.cdn.trusted_ca_certificates.create(\*\*params) -> CaCertificate +- client.cdn.trusted_ca_certificates.list(\*\*params) -> CaCertificateList +- client.cdn.trusted_ca_certificates.delete(id) -> None +- client.cdn.trusted_ca_certificates.get(id) -> CaCertificate +- client.cdn.trusted_ca_certificates.replace(id, \*\*params) -> CaCertificate + +## AuditLog + +Types: + +```python +from gcore.types.cdn import CdnAuditLogEntry +``` + +Methods: + +- client.cdn.audit_log.list(\*\*params) -> SyncOffsetPage[CdnAuditLogEntry] +- client.cdn.audit_log.get(log_id) -> CdnAuditLogEntry + +## Logs + +Types: + +```python +from gcore.types.cdn import CdnLogEntry +``` + +Methods: + +- client.cdn.logs.list(\*\*params) -> SyncOffsetPageCdnLogs[Data] +- client.cdn.logs.download(\*\*params) -> BinaryAPIResponse + +### Settings + +Types: + +```python +from gcore.types.cdn.logs import LogSettings +``` + +Methods: + +- client.cdn.logs.settings.create(\*\*params) -> None +- client.cdn.logs.settings.update(\*\*params) -> None +- client.cdn.logs.settings.delete() -> None +- client.cdn.logs.settings.get() -> LogSettings + +## LogsUploader + +Types: + +```python +from gcore.types.cdn import LogsUploaderValidation +``` + +### Policies + +Types: + +```python +from gcore.types.cdn.logs_uploader import ( + LogsUploaderPolicy, + LogsUploaderPolicyList, + PolicyListFieldsResponse, +) +``` + +Methods: + +- client.cdn.logs_uploader.policies.create(\*\*params) -> LogsUploaderPolicy +- client.cdn.logs_uploader.policies.update(id, \*\*params) -> LogsUploaderPolicy +- client.cdn.logs_uploader.policies.list(\*\*params) -> LogsUploaderPolicyList +- client.cdn.logs_uploader.policies.delete(id) -> None +- client.cdn.logs_uploader.policies.get(id) -> LogsUploaderPolicy +- client.cdn.logs_uploader.policies.list_fields() -> PolicyListFieldsResponse +- client.cdn.logs_uploader.policies.replace(id, \*\*params) -> LogsUploaderPolicy + +### Targets + +Types: + +```python +from gcore.types.cdn.logs_uploader import LogsUploaderTarget, LogsUploaderTargetList +``` + +Methods: + +- client.cdn.logs_uploader.targets.create(\*\*params) -> LogsUploaderTarget +- client.cdn.logs_uploader.targets.update(id, \*\*params) -> LogsUploaderTarget +- client.cdn.logs_uploader.targets.list(\*\*params) -> LogsUploaderTargetList +- client.cdn.logs_uploader.targets.delete(id) -> None +- client.cdn.logs_uploader.targets.get(id) -> LogsUploaderTarget +- client.cdn.logs_uploader.targets.replace(id, \*\*params) -> LogsUploaderTarget +- client.cdn.logs_uploader.targets.validate(id) -> LogsUploaderValidation + +### Configs + +Types: + +```python +from gcore.types.cdn.logs_uploader import LogsUploaderConfig, LogsUploaderConfigList +``` + +Methods: + +- client.cdn.logs_uploader.configs.create(\*\*params) -> LogsUploaderConfig +- client.cdn.logs_uploader.configs.update(id, \*\*params) -> LogsUploaderConfig +- client.cdn.logs_uploader.configs.list(\*\*params) -> LogsUploaderConfigList +- client.cdn.logs_uploader.configs.delete(id) -> None +- client.cdn.logs_uploader.configs.get(id) -> LogsUploaderConfig +- client.cdn.logs_uploader.configs.replace(id, \*\*params) -> LogsUploaderConfig +- client.cdn.logs_uploader.configs.validate(id) -> LogsUploaderValidation + +## Statistics + +Types: + +```python +from gcore.types.cdn import ( + LogsAggregatedStats, + ResourceAggregatedStats, + ResourceUsageStats, + ShieldAggregatedStats, + UsageSeriesStats, +) +``` + +Methods: + +- client.cdn.statistics.get_logs_usage_aggregated(\*\*params) -> LogsAggregatedStats +- client.cdn.statistics.get_logs_usage_series(\*\*params) -> UsageSeriesStats +- client.cdn.statistics.get_resource_usage_aggregated(\*\*params) -> ResourceAggregatedStats +- client.cdn.statistics.get_resource_usage_series(\*\*params) -> ResourceUsageStats +- client.cdn.statistics.get_shield_usage_aggregated(\*\*params) -> ShieldAggregatedStats +- client.cdn.statistics.get_shield_usage_series(\*\*params) -> UsageSeriesStats + +## NetworkCapacity + +Types: + +```python +from gcore.types.cdn import NetworkCapacity +``` + +Methods: + +- client.cdn.network_capacity.list() -> NetworkCapacity + +## Metrics + +Types: + +```python +from gcore.types.cdn import CdnMetrics, CdnMetricsGroups, CdnMetricsValues +``` + +Methods: + +- client.cdn.metrics.list(\*\*params) -> CdnMetrics + +## IPRanges + +Types: + +```python +from gcore.types.cdn import PublicIPList, PublicNetworkList +``` + +Methods: + +- client.cdn.ip_ranges.list() -> PublicNetworkList +- client.cdn.ip_ranges.list_ips() -> PublicIPList diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 51d339d9..3aaf9b6f 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -28,6 +28,7 @@ SyncAPIClient, AsyncAPIClient, ) +from .resources.cdn import cdn from .resources.dns import dns from .resources.iam import iam from .resources.waap import waap @@ -49,6 +50,7 @@ class Gcore(SyncAPIClient): security: security.SecurityResource dns: dns.DNSResource storage: storage.StorageResource + cdn: cdn.CdnResource with_raw_response: GcoreWithRawResponse with_streaming_response: GcoreWithStreamedResponse @@ -136,6 +138,7 @@ def __init__( self.security = security.SecurityResource(self) self.dns = dns.DNSResource(self) self.storage = storage.StorageResource(self) + self.cdn = cdn.CdnResource(self) self.with_raw_response = GcoreWithRawResponse(self) self.with_streaming_response = GcoreWithStreamedResponse(self) @@ -279,6 +282,7 @@ class AsyncGcore(AsyncAPIClient): security: security.AsyncSecurityResource dns: dns.AsyncDNSResource storage: storage.AsyncStorageResource + cdn: cdn.AsyncCdnResource with_raw_response: AsyncGcoreWithRawResponse with_streaming_response: AsyncGcoreWithStreamedResponse @@ -366,6 +370,7 @@ def __init__( self.security = security.AsyncSecurityResource(self) self.dns = dns.AsyncDNSResource(self) self.storage = storage.AsyncStorageResource(self) + self.cdn = cdn.AsyncCdnResource(self) self.with_raw_response = AsyncGcoreWithRawResponse(self) self.with_streaming_response = AsyncGcoreWithStreamedResponse(self) @@ -510,6 +515,7 @@ def __init__(self, client: Gcore) -> None: self.security = security.SecurityResourceWithRawResponse(client.security) self.dns = dns.DNSResourceWithRawResponse(client.dns) self.storage = storage.StorageResourceWithRawResponse(client.storage) + self.cdn = cdn.CdnResourceWithRawResponse(client.cdn) class AsyncGcoreWithRawResponse: @@ -522,6 +528,7 @@ def __init__(self, client: AsyncGcore) -> None: self.security = security.AsyncSecurityResourceWithRawResponse(client.security) self.dns = dns.AsyncDNSResourceWithRawResponse(client.dns) self.storage = storage.AsyncStorageResourceWithRawResponse(client.storage) + self.cdn = cdn.AsyncCdnResourceWithRawResponse(client.cdn) class GcoreWithStreamedResponse: @@ -534,6 +541,7 @@ def __init__(self, client: Gcore) -> None: self.security = security.SecurityResourceWithStreamingResponse(client.security) self.dns = dns.DNSResourceWithStreamingResponse(client.dns) self.storage = storage.StorageResourceWithStreamingResponse(client.storage) + self.cdn = cdn.CdnResourceWithStreamingResponse(client.cdn) class AsyncGcoreWithStreamedResponse: @@ -546,6 +554,7 @@ def __init__(self, client: AsyncGcore) -> None: self.security = security.AsyncSecurityResourceWithStreamingResponse(client.security) self.dns = dns.AsyncDNSResourceWithStreamingResponse(client.dns) self.storage = storage.AsyncStorageResourceWithStreamingResponse(client.storage) + self.cdn = cdn.AsyncCdnResourceWithStreamingResponse(client.cdn) Client = Gcore diff --git a/src/gcore/pagination.py b/src/gcore/pagination.py index 57bab8f9..24edbc64 100644 --- a/src/gcore/pagination.py +++ b/src/gcore/pagination.py @@ -22,6 +22,11 @@ "AsyncPageStreamingAI", "SyncPageStreaming", "AsyncPageStreaming", + "SyncOffsetPageCdn", + "AsyncOffsetPageCdn", + "OffsetPageCdnLogsMeta", + "SyncOffsetPageCdnLogs", + "AsyncOffsetPageCdnLogs", ] _BaseModelT = TypeVar("_BaseModelT", bound=BaseModel) @@ -357,3 +362,135 @@ def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseM **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}), }, ) + + +class SyncOffsetPageCdn(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + items: List[_T] + + @override + def _get_page_items(self) -> List[_T]: + items = self.items + if not items: + return [] + return items + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + return PageInfo(params={"offset": current_count}) + + @classmethod + def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003 + return cls.construct( + None, + **{ + **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}), + }, + ) + + +class AsyncOffsetPageCdn(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + items: List[_T] + + @override + def _get_page_items(self) -> List[_T]: + items = self.items + if not items: + return [] + return items + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + return PageInfo(params={"offset": current_count}) + + @classmethod + def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003 + return cls.construct( + None, + **{ + **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}), + }, + ) + + +class OffsetPageCdnLogsMeta(BaseModel): + count: Optional[int] = None + + +class SyncOffsetPageCdnLogs(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + data: List[_T] + meta: Optional[OffsetPageCdnLogsMeta] = None + + @override + def _get_page_items(self) -> List[_T]: + data = self.data + if not data: + return [] + return data + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + count = None + if self.meta is not None: + if self.meta.count is not None: + count = self.meta.count + if count is None: + return None + + if current_count < count: + return PageInfo(params={"offset": current_count}) + + return None + + +class AsyncOffsetPageCdnLogs(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + data: List[_T] + meta: Optional[OffsetPageCdnLogsMeta] = None + + @override + def _get_page_items(self) -> List[_T]: + data = self.data + if not data: + return [] + return data + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + count = None + if self.meta is not None: + if self.meta.count is not None: + count = self.meta.count + if count is None: + return None + + if current_count < count: + return PageInfo(params={"offset": current_count}) + + return None diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py index e8e92c1e..c8aaa6a7 100644 --- a/src/gcore/resources/__init__.py +++ b/src/gcore/resources/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .cdn import ( + CdnResource, + AsyncCdnResource, + CdnResourceWithRawResponse, + AsyncCdnResourceWithRawResponse, + CdnResourceWithStreamingResponse, + AsyncCdnResourceWithStreamingResponse, +) from .dns import ( DNSResource, AsyncDNSResource, @@ -114,4 +122,10 @@ "AsyncStorageResourceWithRawResponse", "StorageResourceWithStreamingResponse", "AsyncStorageResourceWithStreamingResponse", + "CdnResource", + "AsyncCdnResource", + "CdnResourceWithRawResponse", + "AsyncCdnResourceWithRawResponse", + "CdnResourceWithStreamingResponse", + "AsyncCdnResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/cdn/__init__.py b/src/gcore/resources/cdn/__init__.py new file mode 100644 index 00000000..83661f58 --- /dev/null +++ b/src/gcore/resources/cdn/__init__.py @@ -0,0 +1,201 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .cdn import ( + CdnResource, + AsyncCdnResource, + CdnResourceWithRawResponse, + AsyncCdnResourceWithRawResponse, + CdnResourceWithStreamingResponse, + AsyncCdnResourceWithStreamingResponse, +) +from .logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) +from .shields import ( + ShieldsResource, + AsyncShieldsResource, + ShieldsResourceWithRawResponse, + AsyncShieldsResourceWithRawResponse, + ShieldsResourceWithStreamingResponse, + AsyncShieldsResourceWithStreamingResponse, +) +from .audit_log import ( + AuditLogResource, + AsyncAuditLogResource, + AuditLogResourceWithRawResponse, + AsyncAuditLogResourceWithRawResponse, + AuditLogResourceWithStreamingResponse, + AsyncAuditLogResourceWithStreamingResponse, +) +from .ip_ranges import ( + IPRangesResource, + AsyncIPRangesResource, + IPRangesResourceWithRawResponse, + AsyncIPRangesResourceWithRawResponse, + IPRangesResourceWithStreamingResponse, + AsyncIPRangesResourceWithStreamingResponse, +) +from .resources import ( + ResourcesResource, + AsyncResourcesResource, + ResourcesResourceWithRawResponse, + AsyncResourcesResourceWithRawResponse, + ResourcesResourceWithStreamingResponse, + AsyncResourcesResourceWithStreamingResponse, +) +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) +from .certificates import ( + CertificatesResource, + AsyncCertificatesResource, + CertificatesResourceWithRawResponse, + AsyncCertificatesResourceWithRawResponse, + CertificatesResourceWithStreamingResponse, + AsyncCertificatesResourceWithStreamingResponse, +) +from .logs_uploader import ( + LogsUploaderResource, + AsyncLogsUploaderResource, + LogsUploaderResourceWithRawResponse, + AsyncLogsUploaderResourceWithRawResponse, + LogsUploaderResourceWithStreamingResponse, + AsyncLogsUploaderResourceWithStreamingResponse, +) +from .origin_groups import ( + OriginGroupsResource, + AsyncOriginGroupsResource, + OriginGroupsResourceWithRawResponse, + AsyncOriginGroupsResourceWithRawResponse, + OriginGroupsResourceWithStreamingResponse, + AsyncOriginGroupsResourceWithStreamingResponse, +) +from .rule_templates import ( + RuleTemplatesResource, + AsyncRuleTemplatesResource, + RuleTemplatesResourceWithRawResponse, + AsyncRuleTemplatesResourceWithRawResponse, + RuleTemplatesResourceWithStreamingResponse, + AsyncRuleTemplatesResourceWithStreamingResponse, +) +from .network_capacity import ( + NetworkCapacityResource, + AsyncNetworkCapacityResource, + NetworkCapacityResourceWithRawResponse, + AsyncNetworkCapacityResourceWithRawResponse, + NetworkCapacityResourceWithStreamingResponse, + AsyncNetworkCapacityResourceWithStreamingResponse, +) +from .trusted_ca_certificates import ( + TrustedCaCertificatesResource, + AsyncTrustedCaCertificatesResource, + TrustedCaCertificatesResourceWithRawResponse, + AsyncTrustedCaCertificatesResourceWithRawResponse, + TrustedCaCertificatesResourceWithStreamingResponse, + AsyncTrustedCaCertificatesResourceWithStreamingResponse, +) + +__all__ = [ + "ResourcesResource", + "AsyncResourcesResource", + "ResourcesResourceWithRawResponse", + "AsyncResourcesResourceWithRawResponse", + "ResourcesResourceWithStreamingResponse", + "AsyncResourcesResourceWithStreamingResponse", + "ShieldsResource", + "AsyncShieldsResource", + "ShieldsResourceWithRawResponse", + "AsyncShieldsResourceWithRawResponse", + "ShieldsResourceWithStreamingResponse", + "AsyncShieldsResourceWithStreamingResponse", + "OriginGroupsResource", + "AsyncOriginGroupsResource", + "OriginGroupsResourceWithRawResponse", + "AsyncOriginGroupsResourceWithRawResponse", + "OriginGroupsResourceWithStreamingResponse", + "AsyncOriginGroupsResourceWithStreamingResponse", + "RuleTemplatesResource", + "AsyncRuleTemplatesResource", + "RuleTemplatesResourceWithRawResponse", + "AsyncRuleTemplatesResourceWithRawResponse", + "RuleTemplatesResourceWithStreamingResponse", + "AsyncRuleTemplatesResourceWithStreamingResponse", + "CertificatesResource", + "AsyncCertificatesResource", + "CertificatesResourceWithRawResponse", + "AsyncCertificatesResourceWithRawResponse", + "CertificatesResourceWithStreamingResponse", + "AsyncCertificatesResourceWithStreamingResponse", + "TrustedCaCertificatesResource", + "AsyncTrustedCaCertificatesResource", + "TrustedCaCertificatesResourceWithRawResponse", + "AsyncTrustedCaCertificatesResourceWithRawResponse", + "TrustedCaCertificatesResourceWithStreamingResponse", + "AsyncTrustedCaCertificatesResourceWithStreamingResponse", + "AuditLogResource", + "AsyncAuditLogResource", + "AuditLogResourceWithRawResponse", + "AsyncAuditLogResourceWithRawResponse", + "AuditLogResourceWithStreamingResponse", + "AsyncAuditLogResourceWithStreamingResponse", + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", + "LogsUploaderResource", + "AsyncLogsUploaderResource", + "LogsUploaderResourceWithRawResponse", + "AsyncLogsUploaderResourceWithRawResponse", + "LogsUploaderResourceWithStreamingResponse", + "AsyncLogsUploaderResourceWithStreamingResponse", + "StatisticsResource", + "AsyncStatisticsResource", + "StatisticsResourceWithRawResponse", + "AsyncStatisticsResourceWithRawResponse", + "StatisticsResourceWithStreamingResponse", + "AsyncStatisticsResourceWithStreamingResponse", + "NetworkCapacityResource", + "AsyncNetworkCapacityResource", + "NetworkCapacityResourceWithRawResponse", + "AsyncNetworkCapacityResourceWithRawResponse", + "NetworkCapacityResourceWithStreamingResponse", + "AsyncNetworkCapacityResourceWithStreamingResponse", + "MetricsResource", + "AsyncMetricsResource", + "MetricsResourceWithRawResponse", + "AsyncMetricsResourceWithRawResponse", + "MetricsResourceWithStreamingResponse", + "AsyncMetricsResourceWithStreamingResponse", + "IPRangesResource", + "AsyncIPRangesResource", + "IPRangesResourceWithRawResponse", + "AsyncIPRangesResourceWithRawResponse", + "IPRangesResourceWithStreamingResponse", + "AsyncIPRangesResourceWithStreamingResponse", + "CdnResource", + "AsyncCdnResource", + "CdnResourceWithRawResponse", + "AsyncCdnResourceWithRawResponse", + "CdnResourceWithStreamingResponse", + "AsyncCdnResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cdn/audit_log.py b/src/gcore/resources/cdn/audit_log.py new file mode 100644 index 00000000..1df531f5 --- /dev/null +++ b/src/gcore/resources/cdn/audit_log.py @@ -0,0 +1,406 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import audit_log_list_params +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ..._base_client import AsyncPaginator, make_request_options +from ...types.cdn.cdn_audit_log_entry import CdnAuditLogEntry + +__all__ = ["AuditLogResource", "AsyncAuditLogResource"] + + +class AuditLogResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AuditLogResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AuditLogResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AuditLogResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AuditLogResourceWithStreamingResponse(self) + + def list( + self, + *, + client_id: int | Omit = omit, + limit: int | Omit = omit, + max_requested_at: str | Omit = omit, + method: str | Omit = omit, + min_requested_at: str | Omit = omit, + offset: int | Omit = omit, + path: str | Omit = omit, + remote_ip_address: str | Omit = omit, + status_code: int | Omit = omit, + token_id: int | Omit = omit, + user_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncOffsetPage[CdnAuditLogEntry]: + """ + Get information about all CDN activity logs records. + + Args: + client_id: Client ID. + + limit: Maximum number of items in response. + + max_requested_at: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + You can specify a date with a time separated by a space, or just a date. + + Examples: + + - &`max_requested_at`=2021-05-05 12:00:00 + - &`max_requested_at`=2021-05-05 + + method: HTTP method type of requests. + + Use upper case only. + + Example: + + - ?method=DELETE + + min_requested_at: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + You can specify a date with a time separated by a space, or just a date. + + Examples: + + - &`min_requested_at`=2021-05-05 12:00:00 + - &`min_requested_at`=2021-05-05 + + offset: Offset relative to the beginning of activity logs. + + path: Path that a requested URL should contain. + + remote_ip_address: IP address or part of it from which requests are sent. + + status_code: Status code returned in the response. + + Specify the first numbers of a status code to get requests for a group of status + codes. + + To filter the activity logs by 4xx codes, use: + + - &`status_code`=4 - + + token_id: Permanent API token ID. Requests made with this token should be displayed. + + user_id: User ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cdn/activity_log/requests" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/activity_log/requests", + page=SyncOffsetPage[CdnAuditLogEntry], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "client_id": client_id, + "limit": limit, + "max_requested_at": max_requested_at, + "method": method, + "min_requested_at": min_requested_at, + "offset": offset, + "path": path, + "remote_ip_address": remote_ip_address, + "status_code": status_code, + "token_id": token_id, + "user_id": user_id, + }, + audit_log_list_params.AuditLogListParams, + ), + ), + model=CdnAuditLogEntry, + ) + + def get( + self, + log_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnAuditLogEntry: + """ + Get information about CDN activity logs record. + + Args: + log_id: Activity logs record ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cdn/activity_log/requests/{log_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/activity_log/requests/{log_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAuditLogEntry, + ) + + +class AsyncAuditLogResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAuditLogResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncAuditLogResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAuditLogResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncAuditLogResourceWithStreamingResponse(self) + + def list( + self, + *, + client_id: int | Omit = omit, + limit: int | Omit = omit, + max_requested_at: str | Omit = omit, + method: str | Omit = omit, + min_requested_at: str | Omit = omit, + offset: int | Omit = omit, + path: str | Omit = omit, + remote_ip_address: str | Omit = omit, + status_code: int | Omit = omit, + token_id: int | Omit = omit, + user_id: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[CdnAuditLogEntry, AsyncOffsetPage[CdnAuditLogEntry]]: + """ + Get information about all CDN activity logs records. + + Args: + client_id: Client ID. + + limit: Maximum number of items in response. + + max_requested_at: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + You can specify a date with a time separated by a space, or just a date. + + Examples: + + - &`max_requested_at`=2021-05-05 12:00:00 + - &`max_requested_at`=2021-05-05 + + method: HTTP method type of requests. + + Use upper case only. + + Example: + + - ?method=DELETE + + min_requested_at: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + You can specify a date with a time separated by a space, or just a date. + + Examples: + + - &`min_requested_at`=2021-05-05 12:00:00 + - &`min_requested_at`=2021-05-05 + + offset: Offset relative to the beginning of activity logs. + + path: Path that a requested URL should contain. + + remote_ip_address: IP address or part of it from which requests are sent. + + status_code: Status code returned in the response. + + Specify the first numbers of a status code to get requests for a group of status + codes. + + To filter the activity logs by 4xx codes, use: + + - &`status_code`=4 - + + token_id: Permanent API token ID. Requests made with this token should be displayed. + + user_id: User ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cdn/activity_log/requests" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/activity_log/requests", + page=AsyncOffsetPage[CdnAuditLogEntry], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "client_id": client_id, + "limit": limit, + "max_requested_at": max_requested_at, + "method": method, + "min_requested_at": min_requested_at, + "offset": offset, + "path": path, + "remote_ip_address": remote_ip_address, + "status_code": status_code, + "token_id": token_id, + "user_id": user_id, + }, + audit_log_list_params.AuditLogListParams, + ), + ), + model=CdnAuditLogEntry, + ) + + async def get( + self, + log_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnAuditLogEntry: + """ + Get information about CDN activity logs record. + + Args: + log_id: Activity logs record ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cdn/activity_log/requests/{log_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/activity_log/requests/{log_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAuditLogEntry, + ) + + +class AuditLogResourceWithRawResponse: + def __init__(self, audit_log: AuditLogResource) -> None: + self._audit_log = audit_log + + self.list = to_raw_response_wrapper( + audit_log.list, + ) + self.get = to_raw_response_wrapper( + audit_log.get, + ) + + +class AsyncAuditLogResourceWithRawResponse: + def __init__(self, audit_log: AsyncAuditLogResource) -> None: + self._audit_log = audit_log + + self.list = async_to_raw_response_wrapper( + audit_log.list, + ) + self.get = async_to_raw_response_wrapper( + audit_log.get, + ) + + +class AuditLogResourceWithStreamingResponse: + def __init__(self, audit_log: AuditLogResource) -> None: + self._audit_log = audit_log + + self.list = to_streamed_response_wrapper( + audit_log.list, + ) + self.get = to_streamed_response_wrapper( + audit_log.get, + ) + + +class AsyncAuditLogResourceWithStreamingResponse: + def __init__(self, audit_log: AsyncAuditLogResource) -> None: + self._audit_log = audit_log + + self.list = async_to_streamed_response_wrapper( + audit_log.list, + ) + self.get = async_to_streamed_response_wrapper( + audit_log.get, + ) diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py new file mode 100644 index 00000000..430498dc --- /dev/null +++ b/src/gcore/resources/cdn/cdn.py @@ -0,0 +1,957 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) +from .shields import ( + ShieldsResource, + AsyncShieldsResource, + ShieldsResourceWithRawResponse, + AsyncShieldsResourceWithRawResponse, + ShieldsResourceWithStreamingResponse, + AsyncShieldsResourceWithStreamingResponse, +) +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from .audit_log import ( + AuditLogResource, + AsyncAuditLogResource, + AuditLogResourceWithRawResponse, + AsyncAuditLogResourceWithRawResponse, + AuditLogResourceWithStreamingResponse, + AsyncAuditLogResourceWithStreamingResponse, +) +from .ip_ranges import ( + IPRangesResource, + AsyncIPRangesResource, + IPRangesResourceWithRawResponse, + AsyncIPRangesResourceWithRawResponse, + IPRangesResourceWithStreamingResponse, + AsyncIPRangesResourceWithStreamingResponse, +) +from .logs.logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import cdn_update_account_params, cdn_list_purge_statuses_params +from ...pagination import SyncOffsetPageCdn, AsyncOffsetPageCdn +from .certificates import ( + CertificatesResource, + AsyncCertificatesResource, + CertificatesResourceWithRawResponse, + AsyncCertificatesResourceWithRawResponse, + CertificatesResourceWithStreamingResponse, + AsyncCertificatesResourceWithStreamingResponse, +) +from .origin_groups import ( + OriginGroupsResource, + AsyncOriginGroupsResource, + OriginGroupsResourceWithRawResponse, + AsyncOriginGroupsResourceWithRawResponse, + OriginGroupsResourceWithStreamingResponse, + AsyncOriginGroupsResourceWithStreamingResponse, +) +from ..._base_client import AsyncPaginator, make_request_options +from .rule_templates import ( + RuleTemplatesResource, + AsyncRuleTemplatesResource, + RuleTemplatesResourceWithRawResponse, + AsyncRuleTemplatesResourceWithRawResponse, + RuleTemplatesResourceWithStreamingResponse, + AsyncRuleTemplatesResourceWithStreamingResponse, +) +from .network_capacity import ( + NetworkCapacityResource, + AsyncNetworkCapacityResource, + NetworkCapacityResourceWithRawResponse, + AsyncNetworkCapacityResourceWithRawResponse, + NetworkCapacityResourceWithStreamingResponse, + AsyncNetworkCapacityResourceWithStreamingResponse, +) +from .resources.resources import ( + ResourcesResource, + AsyncResourcesResource, + ResourcesResourceWithRawResponse, + AsyncResourcesResourceWithRawResponse, + ResourcesResourceWithStreamingResponse, + AsyncResourcesResourceWithStreamingResponse, +) +from ...types.cdn.cdn_account import CdnAccount +from .trusted_ca_certificates import ( + TrustedCaCertificatesResource, + AsyncTrustedCaCertificatesResource, + TrustedCaCertificatesResourceWithRawResponse, + AsyncTrustedCaCertificatesResourceWithRawResponse, + TrustedCaCertificatesResourceWithStreamingResponse, + AsyncTrustedCaCertificatesResourceWithStreamingResponse, +) +from ...types.cdn.purge_status import PurgeStatus +from .logs_uploader.logs_uploader import ( + LogsUploaderResource, + AsyncLogsUploaderResource, + LogsUploaderResourceWithRawResponse, + AsyncLogsUploaderResourceWithRawResponse, + LogsUploaderResourceWithStreamingResponse, + AsyncLogsUploaderResourceWithStreamingResponse, +) +from ...types.cdn.cdn_account_limits import CdnAccountLimits +from ...types.cdn.cdn_available_features import CdnAvailableFeatures + +__all__ = ["CdnResource", "AsyncCdnResource"] + + +class CdnResource(SyncAPIResource): + @cached_property + def resources(self) -> ResourcesResource: + return ResourcesResource(self._client) + + @cached_property + def shields(self) -> ShieldsResource: + return ShieldsResource(self._client) + + @cached_property + def origin_groups(self) -> OriginGroupsResource: + return OriginGroupsResource(self._client) + + @cached_property + def rule_templates(self) -> RuleTemplatesResource: + return RuleTemplatesResource(self._client) + + @cached_property + def certificates(self) -> CertificatesResource: + return CertificatesResource(self._client) + + @cached_property + def trusted_ca_certificates(self) -> TrustedCaCertificatesResource: + return TrustedCaCertificatesResource(self._client) + + @cached_property + def audit_log(self) -> AuditLogResource: + return AuditLogResource(self._client) + + @cached_property + def logs(self) -> LogsResource: + return LogsResource(self._client) + + @cached_property + def logs_uploader(self) -> LogsUploaderResource: + return LogsUploaderResource(self._client) + + @cached_property + def statistics(self) -> StatisticsResource: + return StatisticsResource(self._client) + + @cached_property + def network_capacity(self) -> NetworkCapacityResource: + return NetworkCapacityResource(self._client) + + @cached_property + def metrics(self) -> MetricsResource: + return MetricsResource(self._client) + + @cached_property + def ip_ranges(self) -> IPRangesResource: + return IPRangesResource(self._client) + + @cached_property + def with_raw_response(self) -> CdnResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return CdnResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CdnResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return CdnResourceWithStreamingResponse(self) + + def get_account_limits( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnAccountLimits: + """Get information about CDN service limits.""" + return self._get( + "/cdn/clients/me/limits" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/clients/me/limits", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAccountLimits, + ) + + def get_account_overview( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnAccount: + """Get information about CDN service.""" + return self._get( + "/cdn/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//cdn/clients/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAccount, + ) + + def get_available_features( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnAvailableFeatures: + """Get information about available CDN features.""" + return self._get( + "/cdn/clients/me/features" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/clients/me/features", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAvailableFeatures, + ) + + def list_purge_statuses( + self, + *, + cname: str | Omit = omit, + from_created: str | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + purge_type: str | Omit = omit, + status: str | Omit = omit, + to_created: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncOffsetPageCdn[PurgeStatus]: + """ + Get purges history. + + Args: + cname: Purges associated with a specific resource CNAME. + + Example: + + - &cname=example.com + + from_created: Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Examples: + + - &`from_created`=2021-06-14T00:00:00Z + - &`from_created`=2021-06-14T00:00:00.000Z + + limit: Maximum number of purges in the response. + + offset: Number of purge requests in the response to skip starting from the beginning of + the requested period. + + purge_type: Purge requests with a certain purge type. + + Possible values: + + - **`purge_by_pattern`** - Purge by Pattern. + - **`purge_by_url`** - Purge by URL. + - **`purge_all`** - Purge All. + + status: Purge with a certain status. + + Possible values: + + - **In progress** + - **Successful** + - **Failed** + - **Status report disabled** + + to_created: End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &`to_created`=2021-06-15T00:00:00Z + - &`to_created`=2021-06-15T00:00:00.000Z + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cdn/purge_statuses" if self._client._base_url_overridden else "https://api.gcore.com//cdn/purge_statuses", + page=SyncOffsetPageCdn[PurgeStatus], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "cname": cname, + "from_created": from_created, + "limit": limit, + "offset": offset, + "purge_type": purge_type, + "status": status, + "to_created": to_created, + }, + cdn_list_purge_statuses_params.CdnListPurgeStatusesParams, + ), + ), + model=PurgeStatus, + ) + + def update_account( + self, + *, + utilization_level: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnAccount: + """ + Change information about CDN service. + + Args: + utilization_level: CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + "/cdn/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//cdn/clients/me", + body=maybe_transform( + {"utilization_level": utilization_level}, cdn_update_account_params.CdnUpdateAccountParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAccount, + ) + + +class AsyncCdnResource(AsyncAPIResource): + @cached_property + def resources(self) -> AsyncResourcesResource: + return AsyncResourcesResource(self._client) + + @cached_property + def shields(self) -> AsyncShieldsResource: + return AsyncShieldsResource(self._client) + + @cached_property + def origin_groups(self) -> AsyncOriginGroupsResource: + return AsyncOriginGroupsResource(self._client) + + @cached_property + def rule_templates(self) -> AsyncRuleTemplatesResource: + return AsyncRuleTemplatesResource(self._client) + + @cached_property + def certificates(self) -> AsyncCertificatesResource: + return AsyncCertificatesResource(self._client) + + @cached_property + def trusted_ca_certificates(self) -> AsyncTrustedCaCertificatesResource: + return AsyncTrustedCaCertificatesResource(self._client) + + @cached_property + def audit_log(self) -> AsyncAuditLogResource: + return AsyncAuditLogResource(self._client) + + @cached_property + def logs(self) -> AsyncLogsResource: + return AsyncLogsResource(self._client) + + @cached_property + def logs_uploader(self) -> AsyncLogsUploaderResource: + return AsyncLogsUploaderResource(self._client) + + @cached_property + def statistics(self) -> AsyncStatisticsResource: + return AsyncStatisticsResource(self._client) + + @cached_property + def network_capacity(self) -> AsyncNetworkCapacityResource: + return AsyncNetworkCapacityResource(self._client) + + @cached_property + def metrics(self) -> AsyncMetricsResource: + return AsyncMetricsResource(self._client) + + @cached_property + def ip_ranges(self) -> AsyncIPRangesResource: + return AsyncIPRangesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncCdnResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncCdnResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCdnResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncCdnResourceWithStreamingResponse(self) + + async def get_account_limits( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnAccountLimits: + """Get information about CDN service limits.""" + return await self._get( + "/cdn/clients/me/limits" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/clients/me/limits", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAccountLimits, + ) + + async def get_account_overview( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnAccount: + """Get information about CDN service.""" + return await self._get( + "/cdn/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//cdn/clients/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAccount, + ) + + async def get_available_features( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnAvailableFeatures: + """Get information about available CDN features.""" + return await self._get( + "/cdn/clients/me/features" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/clients/me/features", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAvailableFeatures, + ) + + def list_purge_statuses( + self, + *, + cname: str | Omit = omit, + from_created: str | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + purge_type: str | Omit = omit, + status: str | Omit = omit, + to_created: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[PurgeStatus, AsyncOffsetPageCdn[PurgeStatus]]: + """ + Get purges history. + + Args: + cname: Purges associated with a specific resource CNAME. + + Example: + + - &cname=example.com + + from_created: Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Examples: + + - &`from_created`=2021-06-14T00:00:00Z + - &`from_created`=2021-06-14T00:00:00.000Z + + limit: Maximum number of purges in the response. + + offset: Number of purge requests in the response to skip starting from the beginning of + the requested period. + + purge_type: Purge requests with a certain purge type. + + Possible values: + + - **`purge_by_pattern`** - Purge by Pattern. + - **`purge_by_url`** - Purge by URL. + - **`purge_all`** - Purge All. + + status: Purge with a certain status. + + Possible values: + + - **In progress** + - **Successful** + - **Failed** + - **Status report disabled** + + to_created: End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &`to_created`=2021-06-15T00:00:00Z + - &`to_created`=2021-06-15T00:00:00.000Z + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cdn/purge_statuses" if self._client._base_url_overridden else "https://api.gcore.com//cdn/purge_statuses", + page=AsyncOffsetPageCdn[PurgeStatus], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "cname": cname, + "from_created": from_created, + "limit": limit, + "offset": offset, + "purge_type": purge_type, + "status": status, + "to_created": to_created, + }, + cdn_list_purge_statuses_params.CdnListPurgeStatusesParams, + ), + ), + model=PurgeStatus, + ) + + async def update_account( + self, + *, + utilization_level: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnAccount: + """ + Change information about CDN service. + + Args: + utilization_level: CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + "/cdn/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//cdn/clients/me", + body=await async_maybe_transform( + {"utilization_level": utilization_level}, cdn_update_account_params.CdnUpdateAccountParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAccount, + ) + + +class CdnResourceWithRawResponse: + def __init__(self, cdn: CdnResource) -> None: + self._cdn = cdn + + self.get_account_limits = to_raw_response_wrapper( + cdn.get_account_limits, + ) + self.get_account_overview = to_raw_response_wrapper( + cdn.get_account_overview, + ) + self.get_available_features = to_raw_response_wrapper( + cdn.get_available_features, + ) + self.list_purge_statuses = to_raw_response_wrapper( + cdn.list_purge_statuses, + ) + self.update_account = to_raw_response_wrapper( + cdn.update_account, + ) + + @cached_property + def resources(self) -> ResourcesResourceWithRawResponse: + return ResourcesResourceWithRawResponse(self._cdn.resources) + + @cached_property + def shields(self) -> ShieldsResourceWithRawResponse: + return ShieldsResourceWithRawResponse(self._cdn.shields) + + @cached_property + def origin_groups(self) -> OriginGroupsResourceWithRawResponse: + return OriginGroupsResourceWithRawResponse(self._cdn.origin_groups) + + @cached_property + def rule_templates(self) -> RuleTemplatesResourceWithRawResponse: + return RuleTemplatesResourceWithRawResponse(self._cdn.rule_templates) + + @cached_property + def certificates(self) -> CertificatesResourceWithRawResponse: + return CertificatesResourceWithRawResponse(self._cdn.certificates) + + @cached_property + def trusted_ca_certificates(self) -> TrustedCaCertificatesResourceWithRawResponse: + return TrustedCaCertificatesResourceWithRawResponse(self._cdn.trusted_ca_certificates) + + @cached_property + def audit_log(self) -> AuditLogResourceWithRawResponse: + return AuditLogResourceWithRawResponse(self._cdn.audit_log) + + @cached_property + def logs(self) -> LogsResourceWithRawResponse: + return LogsResourceWithRawResponse(self._cdn.logs) + + @cached_property + def logs_uploader(self) -> LogsUploaderResourceWithRawResponse: + return LogsUploaderResourceWithRawResponse(self._cdn.logs_uploader) + + @cached_property + def statistics(self) -> StatisticsResourceWithRawResponse: + return StatisticsResourceWithRawResponse(self._cdn.statistics) + + @cached_property + def network_capacity(self) -> NetworkCapacityResourceWithRawResponse: + return NetworkCapacityResourceWithRawResponse(self._cdn.network_capacity) + + @cached_property + def metrics(self) -> MetricsResourceWithRawResponse: + return MetricsResourceWithRawResponse(self._cdn.metrics) + + @cached_property + def ip_ranges(self) -> IPRangesResourceWithRawResponse: + return IPRangesResourceWithRawResponse(self._cdn.ip_ranges) + + +class AsyncCdnResourceWithRawResponse: + def __init__(self, cdn: AsyncCdnResource) -> None: + self._cdn = cdn + + self.get_account_limits = async_to_raw_response_wrapper( + cdn.get_account_limits, + ) + self.get_account_overview = async_to_raw_response_wrapper( + cdn.get_account_overview, + ) + self.get_available_features = async_to_raw_response_wrapper( + cdn.get_available_features, + ) + self.list_purge_statuses = async_to_raw_response_wrapper( + cdn.list_purge_statuses, + ) + self.update_account = async_to_raw_response_wrapper( + cdn.update_account, + ) + + @cached_property + def resources(self) -> AsyncResourcesResourceWithRawResponse: + return AsyncResourcesResourceWithRawResponse(self._cdn.resources) + + @cached_property + def shields(self) -> AsyncShieldsResourceWithRawResponse: + return AsyncShieldsResourceWithRawResponse(self._cdn.shields) + + @cached_property + def origin_groups(self) -> AsyncOriginGroupsResourceWithRawResponse: + return AsyncOriginGroupsResourceWithRawResponse(self._cdn.origin_groups) + + @cached_property + def rule_templates(self) -> AsyncRuleTemplatesResourceWithRawResponse: + return AsyncRuleTemplatesResourceWithRawResponse(self._cdn.rule_templates) + + @cached_property + def certificates(self) -> AsyncCertificatesResourceWithRawResponse: + return AsyncCertificatesResourceWithRawResponse(self._cdn.certificates) + + @cached_property + def trusted_ca_certificates(self) -> AsyncTrustedCaCertificatesResourceWithRawResponse: + return AsyncTrustedCaCertificatesResourceWithRawResponse(self._cdn.trusted_ca_certificates) + + @cached_property + def audit_log(self) -> AsyncAuditLogResourceWithRawResponse: + return AsyncAuditLogResourceWithRawResponse(self._cdn.audit_log) + + @cached_property + def logs(self) -> AsyncLogsResourceWithRawResponse: + return AsyncLogsResourceWithRawResponse(self._cdn.logs) + + @cached_property + def logs_uploader(self) -> AsyncLogsUploaderResourceWithRawResponse: + return AsyncLogsUploaderResourceWithRawResponse(self._cdn.logs_uploader) + + @cached_property + def statistics(self) -> AsyncStatisticsResourceWithRawResponse: + return AsyncStatisticsResourceWithRawResponse(self._cdn.statistics) + + @cached_property + def network_capacity(self) -> AsyncNetworkCapacityResourceWithRawResponse: + return AsyncNetworkCapacityResourceWithRawResponse(self._cdn.network_capacity) + + @cached_property + def metrics(self) -> AsyncMetricsResourceWithRawResponse: + return AsyncMetricsResourceWithRawResponse(self._cdn.metrics) + + @cached_property + def ip_ranges(self) -> AsyncIPRangesResourceWithRawResponse: + return AsyncIPRangesResourceWithRawResponse(self._cdn.ip_ranges) + + +class CdnResourceWithStreamingResponse: + def __init__(self, cdn: CdnResource) -> None: + self._cdn = cdn + + self.get_account_limits = to_streamed_response_wrapper( + cdn.get_account_limits, + ) + self.get_account_overview = to_streamed_response_wrapper( + cdn.get_account_overview, + ) + self.get_available_features = to_streamed_response_wrapper( + cdn.get_available_features, + ) + self.list_purge_statuses = to_streamed_response_wrapper( + cdn.list_purge_statuses, + ) + self.update_account = to_streamed_response_wrapper( + cdn.update_account, + ) + + @cached_property + def resources(self) -> ResourcesResourceWithStreamingResponse: + return ResourcesResourceWithStreamingResponse(self._cdn.resources) + + @cached_property + def shields(self) -> ShieldsResourceWithStreamingResponse: + return ShieldsResourceWithStreamingResponse(self._cdn.shields) + + @cached_property + def origin_groups(self) -> OriginGroupsResourceWithStreamingResponse: + return OriginGroupsResourceWithStreamingResponse(self._cdn.origin_groups) + + @cached_property + def rule_templates(self) -> RuleTemplatesResourceWithStreamingResponse: + return RuleTemplatesResourceWithStreamingResponse(self._cdn.rule_templates) + + @cached_property + def certificates(self) -> CertificatesResourceWithStreamingResponse: + return CertificatesResourceWithStreamingResponse(self._cdn.certificates) + + @cached_property + def trusted_ca_certificates(self) -> TrustedCaCertificatesResourceWithStreamingResponse: + return TrustedCaCertificatesResourceWithStreamingResponse(self._cdn.trusted_ca_certificates) + + @cached_property + def audit_log(self) -> AuditLogResourceWithStreamingResponse: + return AuditLogResourceWithStreamingResponse(self._cdn.audit_log) + + @cached_property + def logs(self) -> LogsResourceWithStreamingResponse: + return LogsResourceWithStreamingResponse(self._cdn.logs) + + @cached_property + def logs_uploader(self) -> LogsUploaderResourceWithStreamingResponse: + return LogsUploaderResourceWithStreamingResponse(self._cdn.logs_uploader) + + @cached_property + def statistics(self) -> StatisticsResourceWithStreamingResponse: + return StatisticsResourceWithStreamingResponse(self._cdn.statistics) + + @cached_property + def network_capacity(self) -> NetworkCapacityResourceWithStreamingResponse: + return NetworkCapacityResourceWithStreamingResponse(self._cdn.network_capacity) + + @cached_property + def metrics(self) -> MetricsResourceWithStreamingResponse: + return MetricsResourceWithStreamingResponse(self._cdn.metrics) + + @cached_property + def ip_ranges(self) -> IPRangesResourceWithStreamingResponse: + return IPRangesResourceWithStreamingResponse(self._cdn.ip_ranges) + + +class AsyncCdnResourceWithStreamingResponse: + def __init__(self, cdn: AsyncCdnResource) -> None: + self._cdn = cdn + + self.get_account_limits = async_to_streamed_response_wrapper( + cdn.get_account_limits, + ) + self.get_account_overview = async_to_streamed_response_wrapper( + cdn.get_account_overview, + ) + self.get_available_features = async_to_streamed_response_wrapper( + cdn.get_available_features, + ) + self.list_purge_statuses = async_to_streamed_response_wrapper( + cdn.list_purge_statuses, + ) + self.update_account = async_to_streamed_response_wrapper( + cdn.update_account, + ) + + @cached_property + def resources(self) -> AsyncResourcesResourceWithStreamingResponse: + return AsyncResourcesResourceWithStreamingResponse(self._cdn.resources) + + @cached_property + def shields(self) -> AsyncShieldsResourceWithStreamingResponse: + return AsyncShieldsResourceWithStreamingResponse(self._cdn.shields) + + @cached_property + def origin_groups(self) -> AsyncOriginGroupsResourceWithStreamingResponse: + return AsyncOriginGroupsResourceWithStreamingResponse(self._cdn.origin_groups) + + @cached_property + def rule_templates(self) -> AsyncRuleTemplatesResourceWithStreamingResponse: + return AsyncRuleTemplatesResourceWithStreamingResponse(self._cdn.rule_templates) + + @cached_property + def certificates(self) -> AsyncCertificatesResourceWithStreamingResponse: + return AsyncCertificatesResourceWithStreamingResponse(self._cdn.certificates) + + @cached_property + def trusted_ca_certificates(self) -> AsyncTrustedCaCertificatesResourceWithStreamingResponse: + return AsyncTrustedCaCertificatesResourceWithStreamingResponse(self._cdn.trusted_ca_certificates) + + @cached_property + def audit_log(self) -> AsyncAuditLogResourceWithStreamingResponse: + return AsyncAuditLogResourceWithStreamingResponse(self._cdn.audit_log) + + @cached_property + def logs(self) -> AsyncLogsResourceWithStreamingResponse: + return AsyncLogsResourceWithStreamingResponse(self._cdn.logs) + + @cached_property + def logs_uploader(self) -> AsyncLogsUploaderResourceWithStreamingResponse: + return AsyncLogsUploaderResourceWithStreamingResponse(self._cdn.logs_uploader) + + @cached_property + def statistics(self) -> AsyncStatisticsResourceWithStreamingResponse: + return AsyncStatisticsResourceWithStreamingResponse(self._cdn.statistics) + + @cached_property + def network_capacity(self) -> AsyncNetworkCapacityResourceWithStreamingResponse: + return AsyncNetworkCapacityResourceWithStreamingResponse(self._cdn.network_capacity) + + @cached_property + def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: + return AsyncMetricsResourceWithStreamingResponse(self._cdn.metrics) + + @cached_property + def ip_ranges(self) -> AsyncIPRangesResourceWithStreamingResponse: + return AsyncIPRangesResourceWithStreamingResponse(self._cdn.ip_ranges) diff --git a/src/gcore/resources/cdn/certificates.py b/src/gcore/resources/cdn/certificates.py new file mode 100644 index 00000000..343090f3 --- /dev/null +++ b/src/gcore/resources/cdn/certificates.py @@ -0,0 +1,1062 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import overload + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ..._utils import required_args, maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import ( + certificate_list_params, + certificate_create_params, + certificate_replace_params, + certificate_get_status_params, +) +from ..._base_client import make_request_options +from ...types.cdn.ssl_detail import SslDetail +from ...types.cdn.ssl_detail_list import SslDetailList +from ...types.cdn.ssl_request_status import SslRequestStatus + +__all__ = ["CertificatesResource", "AsyncCertificatesResource"] + + +class CertificatesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CertificatesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return CertificatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CertificatesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return CertificatesResourceWithStreamingResponse(self) + + @overload + def create( + self, + *, + name: str, + ssl_certificate: str, + ssl_private_key: str, + validate_root_ca: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Add an SSL certificate for content delivery over HTTPS protocol. + + Enter all strings of the certificate(s) and the private key into one string + parameter. Each certificate and the private key in chain should be separated by + the "\n" symbol, as shown in the example. + + Additionally, you can add a Let's Encrypt certificate. In this case, certificate + and private key will be generated automatically after attaching this certificate + to your CDN resource. + + Args: + name: SSL certificate name. + + It must be unique. + + ssl_certificate: Public part of the SSL certificate. + + All chain of the SSL certificate should be added. + + ssl_private_key: Private key of the SSL certificate. + + validate_root_ca: Defines whether to check the SSL certificate for a signature from a trusted + certificate authority. + + Possible values: + + - **true** - SSL certificate must be verified to be signed by a trusted + certificate authority. + - **false** - SSL certificate will not be verified to be signed by a trusted + certificate authority. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + automated: bool, + name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Add an SSL certificate for content delivery over HTTPS protocol. + + Enter all strings of the certificate(s) and the private key into one string + parameter. Each certificate and the private key in chain should be separated by + the "\n" symbol, as shown in the example. + + Additionally, you can add a Let's Encrypt certificate. In this case, certificate + and private key will be generated automatically after attaching this certificate + to your CDN resource. + + Args: + automated: Must be **true** to issue certificate automatically. + + name: SSL certificate name. It must be unique. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args(["name", "ssl_certificate", "ssl_private_key"], ["automated", "name"]) + def create( + self, + *, + name: str, + ssl_certificate: str | Omit = omit, + ssl_private_key: str | Omit = omit, + validate_root_ca: bool | Omit = omit, + automated: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + "/cdn/sslData" if self._client._base_url_overridden else "https://api.gcore.com//cdn/sslData", + body=maybe_transform( + { + "name": name, + "ssl_certificate": ssl_certificate, + "ssl_private_key": ssl_private_key, + "validate_root_ca": validate_root_ca, + "automated": automated, + }, + certificate_create_params.CertificateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + *, + automated: bool | Omit = omit, + resource_id: int | Omit = omit, + validity_not_after_lte: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SslDetailList: + """ + Get information about SSL certificates. + + Args: + automated: How the SSL certificate was issued. + + Possible values: + + - **true** – Certificate was issued automatically. + - **false** – Certificate was added by a user. + + resource_id: CDN resource ID for which certificates are requested. + + validity_not_after_lte: Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, + UTC.) + + Response will contain only certificates valid until the specified time. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/sslData" if self._client._base_url_overridden else "https://api.gcore.com//cdn/sslData", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "automated": automated, + "resource_id": resource_id, + "validity_not_after_lte": validity_not_after_lte, + }, + certificate_list_params.CertificateListParams, + ), + ), + cast_to=SslDetailList, + ) + + def delete( + self, + ssl_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete SSL certificate + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/sslData/{ssl_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def force_retry( + self, + cert_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Force retry issuance of Let's Encrypt certificate if the previous attempt was + failed. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cdn/sslData/{cert_id}/force-retry" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{cert_id}/force-retry", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + ssl_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SslDetail: + """ + Get SSL certificate details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cdn/sslData/{ssl_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SslDetail, + ) + + def get_status( + self, + cert_id: int, + *, + exclude: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SslRequestStatus: + """ + Get details about the latest Let's Encrypt certificate issuing attempt for the + CDN resource. Returns attempts in all statuses. + + Args: + exclude: Listed fields will be excluded from the response. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cdn/sslData/{cert_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{cert_id}/status", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"exclude": exclude}, certificate_get_status_params.CertificateGetStatusParams), + ), + cast_to=SslRequestStatus, + ) + + def renew( + self, + cert_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Renew free Let's Encrypt certificate for the CDN resource. + + It can take up to + fifteen minutes. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cdn/sslData/{cert_id}/renew" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{cert_id}/renew", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def replace( + self, + ssl_id: int, + *, + name: str, + ssl_certificate: str, + ssl_private_key: str, + validate_root_ca: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SslDetail: + """ + Change SSL certificate + + Args: + name: SSL certificate name. + + It must be unique. + + ssl_certificate: Public part of the SSL certificate. + + All chain of the SSL certificate should be added. + + ssl_private_key: Private key of the SSL certificate. + + validate_root_ca: Defines whether to check the SSL certificate for a signature from a trusted + certificate authority. + + Possible values: + + - **true** - SSL certificate must be verified to be signed by a trusted + certificate authority. + - **false** - SSL certificate will not be verified to be signed by a trusted + certificate authority. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + f"/cdn/sslData/{ssl_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + body=maybe_transform( + { + "name": name, + "ssl_certificate": ssl_certificate, + "ssl_private_key": ssl_private_key, + "validate_root_ca": validate_root_ca, + }, + certificate_replace_params.CertificateReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SslDetail, + ) + + +class AsyncCertificatesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCertificatesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncCertificatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCertificatesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncCertificatesResourceWithStreamingResponse(self) + + @overload + async def create( + self, + *, + name: str, + ssl_certificate: str, + ssl_private_key: str, + validate_root_ca: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Add an SSL certificate for content delivery over HTTPS protocol. + + Enter all strings of the certificate(s) and the private key into one string + parameter. Each certificate and the private key in chain should be separated by + the "\n" symbol, as shown in the example. + + Additionally, you can add a Let's Encrypt certificate. In this case, certificate + and private key will be generated automatically after attaching this certificate + to your CDN resource. + + Args: + name: SSL certificate name. + + It must be unique. + + ssl_certificate: Public part of the SSL certificate. + + All chain of the SSL certificate should be added. + + ssl_private_key: Private key of the SSL certificate. + + validate_root_ca: Defines whether to check the SSL certificate for a signature from a trusted + certificate authority. + + Possible values: + + - **true** - SSL certificate must be verified to be signed by a trusted + certificate authority. + - **false** - SSL certificate will not be verified to be signed by a trusted + certificate authority. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + automated: bool, + name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Add an SSL certificate for content delivery over HTTPS protocol. + + Enter all strings of the certificate(s) and the private key into one string + parameter. Each certificate and the private key in chain should be separated by + the "\n" symbol, as shown in the example. + + Additionally, you can add a Let's Encrypt certificate. In this case, certificate + and private key will be generated automatically after attaching this certificate + to your CDN resource. + + Args: + automated: Must be **true** to issue certificate automatically. + + name: SSL certificate name. It must be unique. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args(["name", "ssl_certificate", "ssl_private_key"], ["automated", "name"]) + async def create( + self, + *, + name: str, + ssl_certificate: str | Omit = omit, + ssl_private_key: str | Omit = omit, + validate_root_ca: bool | Omit = omit, + automated: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + "/cdn/sslData" if self._client._base_url_overridden else "https://api.gcore.com//cdn/sslData", + body=await async_maybe_transform( + { + "name": name, + "ssl_certificate": ssl_certificate, + "ssl_private_key": ssl_private_key, + "validate_root_ca": validate_root_ca, + "automated": automated, + }, + certificate_create_params.CertificateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def list( + self, + *, + automated: bool | Omit = omit, + resource_id: int | Omit = omit, + validity_not_after_lte: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SslDetailList: + """ + Get information about SSL certificates. + + Args: + automated: How the SSL certificate was issued. + + Possible values: + + - **true** – Certificate was issued automatically. + - **false** – Certificate was added by a user. + + resource_id: CDN resource ID for which certificates are requested. + + validity_not_after_lte: Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, + UTC.) + + Response will contain only certificates valid until the specified time. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/sslData" if self._client._base_url_overridden else "https://api.gcore.com//cdn/sslData", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "automated": automated, + "resource_id": resource_id, + "validity_not_after_lte": validity_not_after_lte, + }, + certificate_list_params.CertificateListParams, + ), + ), + cast_to=SslDetailList, + ) + + async def delete( + self, + ssl_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete SSL certificate + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/sslData/{ssl_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def force_retry( + self, + cert_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Force retry issuance of Let's Encrypt certificate if the previous attempt was + failed. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cdn/sslData/{cert_id}/force-retry" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{cert_id}/force-retry", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + ssl_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SslDetail: + """ + Get SSL certificate details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cdn/sslData/{ssl_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SslDetail, + ) + + async def get_status( + self, + cert_id: int, + *, + exclude: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SslRequestStatus: + """ + Get details about the latest Let's Encrypt certificate issuing attempt for the + CDN resource. Returns attempts in all statuses. + + Args: + exclude: Listed fields will be excluded from the response. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cdn/sslData/{cert_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{cert_id}/status", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"exclude": exclude}, certificate_get_status_params.CertificateGetStatusParams + ), + ), + cast_to=SslRequestStatus, + ) + + async def renew( + self, + cert_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Renew free Let's Encrypt certificate for the CDN resource. + + It can take up to + fifteen minutes. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cdn/sslData/{cert_id}/renew" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{cert_id}/renew", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def replace( + self, + ssl_id: int, + *, + name: str, + ssl_certificate: str, + ssl_private_key: str, + validate_root_ca: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SslDetail: + """ + Change SSL certificate + + Args: + name: SSL certificate name. + + It must be unique. + + ssl_certificate: Public part of the SSL certificate. + + All chain of the SSL certificate should be added. + + ssl_private_key: Private key of the SSL certificate. + + validate_root_ca: Defines whether to check the SSL certificate for a signature from a trusted + certificate authority. + + Possible values: + + - **true** - SSL certificate must be verified to be signed by a trusted + certificate authority. + - **false** - SSL certificate will not be verified to be signed by a trusted + certificate authority. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + f"/cdn/sslData/{ssl_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + body=await async_maybe_transform( + { + "name": name, + "ssl_certificate": ssl_certificate, + "ssl_private_key": ssl_private_key, + "validate_root_ca": validate_root_ca, + }, + certificate_replace_params.CertificateReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SslDetail, + ) + + +class CertificatesResourceWithRawResponse: + def __init__(self, certificates: CertificatesResource) -> None: + self._certificates = certificates + + self.create = to_raw_response_wrapper( + certificates.create, + ) + self.list = to_raw_response_wrapper( + certificates.list, + ) + self.delete = to_raw_response_wrapper( + certificates.delete, + ) + self.force_retry = to_raw_response_wrapper( + certificates.force_retry, + ) + self.get = to_raw_response_wrapper( + certificates.get, + ) + self.get_status = to_raw_response_wrapper( + certificates.get_status, + ) + self.renew = to_raw_response_wrapper( + certificates.renew, + ) + self.replace = to_raw_response_wrapper( + certificates.replace, + ) + + +class AsyncCertificatesResourceWithRawResponse: + def __init__(self, certificates: AsyncCertificatesResource) -> None: + self._certificates = certificates + + self.create = async_to_raw_response_wrapper( + certificates.create, + ) + self.list = async_to_raw_response_wrapper( + certificates.list, + ) + self.delete = async_to_raw_response_wrapper( + certificates.delete, + ) + self.force_retry = async_to_raw_response_wrapper( + certificates.force_retry, + ) + self.get = async_to_raw_response_wrapper( + certificates.get, + ) + self.get_status = async_to_raw_response_wrapper( + certificates.get_status, + ) + self.renew = async_to_raw_response_wrapper( + certificates.renew, + ) + self.replace = async_to_raw_response_wrapper( + certificates.replace, + ) + + +class CertificatesResourceWithStreamingResponse: + def __init__(self, certificates: CertificatesResource) -> None: + self._certificates = certificates + + self.create = to_streamed_response_wrapper( + certificates.create, + ) + self.list = to_streamed_response_wrapper( + certificates.list, + ) + self.delete = to_streamed_response_wrapper( + certificates.delete, + ) + self.force_retry = to_streamed_response_wrapper( + certificates.force_retry, + ) + self.get = to_streamed_response_wrapper( + certificates.get, + ) + self.get_status = to_streamed_response_wrapper( + certificates.get_status, + ) + self.renew = to_streamed_response_wrapper( + certificates.renew, + ) + self.replace = to_streamed_response_wrapper( + certificates.replace, + ) + + +class AsyncCertificatesResourceWithStreamingResponse: + def __init__(self, certificates: AsyncCertificatesResource) -> None: + self._certificates = certificates + + self.create = async_to_streamed_response_wrapper( + certificates.create, + ) + self.list = async_to_streamed_response_wrapper( + certificates.list, + ) + self.delete = async_to_streamed_response_wrapper( + certificates.delete, + ) + self.force_retry = async_to_streamed_response_wrapper( + certificates.force_retry, + ) + self.get = async_to_streamed_response_wrapper( + certificates.get, + ) + self.get_status = async_to_streamed_response_wrapper( + certificates.get_status, + ) + self.renew = async_to_streamed_response_wrapper( + certificates.renew, + ) + self.replace = async_to_streamed_response_wrapper( + certificates.replace, + ) diff --git a/src/gcore/resources/cdn/ip_ranges.py b/src/gcore/resources/cdn/ip_ranges.py new file mode 100644 index 00000000..1480fb8e --- /dev/null +++ b/src/gcore/resources/cdn/ip_ranges.py @@ -0,0 +1,224 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.cdn.public_ip_list import PublicIPList +from ...types.cdn.public_network_list import PublicNetworkList + +__all__ = ["IPRangesResource", "AsyncIPRangesResource"] + + +class IPRangesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> IPRangesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return IPRangesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> IPRangesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return IPRangesResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PublicNetworkList: + """ + Get all CDN networks that can be used to pull content from your origin. + + This list is updated periodically. If you want to use network from this list to + configure IP ACL on your origin, you need to independently monitor its + relevance. We recommend using a script for automatically update IP ACL. + + This request does not require authorization. + """ + return self._get( + "/cdn/public-net-list" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/public-net-list", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PublicNetworkList, + ) + + def list_ips( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PublicIPList: + """ + Get all IP addresses of CDN servers that can be used to pull content from your + origin. + + This list is updated periodically. If you want to use IP from this list to + configure IP ACL in your origin, you need to independently monitor its + relevance. We recommend using a script to automatically update IP ACL. + + This request does not require authorization. + """ + return self._get( + "/cdn/public-ip-list" if self._client._base_url_overridden else "https://api.gcore.com//cdn/public-ip-list", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PublicIPList, + ) + + +class AsyncIPRangesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncIPRangesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncIPRangesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncIPRangesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncIPRangesResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PublicNetworkList: + """ + Get all CDN networks that can be used to pull content from your origin. + + This list is updated periodically. If you want to use network from this list to + configure IP ACL on your origin, you need to independently monitor its + relevance. We recommend using a script for automatically update IP ACL. + + This request does not require authorization. + """ + return await self._get( + "/cdn/public-net-list" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/public-net-list", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PublicNetworkList, + ) + + async def list_ips( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PublicIPList: + """ + Get all IP addresses of CDN servers that can be used to pull content from your + origin. + + This list is updated periodically. If you want to use IP from this list to + configure IP ACL in your origin, you need to independently monitor its + relevance. We recommend using a script to automatically update IP ACL. + + This request does not require authorization. + """ + return await self._get( + "/cdn/public-ip-list" if self._client._base_url_overridden else "https://api.gcore.com//cdn/public-ip-list", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PublicIPList, + ) + + +class IPRangesResourceWithRawResponse: + def __init__(self, ip_ranges: IPRangesResource) -> None: + self._ip_ranges = ip_ranges + + self.list = to_raw_response_wrapper( + ip_ranges.list, + ) + self.list_ips = to_raw_response_wrapper( + ip_ranges.list_ips, + ) + + +class AsyncIPRangesResourceWithRawResponse: + def __init__(self, ip_ranges: AsyncIPRangesResource) -> None: + self._ip_ranges = ip_ranges + + self.list = async_to_raw_response_wrapper( + ip_ranges.list, + ) + self.list_ips = async_to_raw_response_wrapper( + ip_ranges.list_ips, + ) + + +class IPRangesResourceWithStreamingResponse: + def __init__(self, ip_ranges: IPRangesResource) -> None: + self._ip_ranges = ip_ranges + + self.list = to_streamed_response_wrapper( + ip_ranges.list, + ) + self.list_ips = to_streamed_response_wrapper( + ip_ranges.list_ips, + ) + + +class AsyncIPRangesResourceWithStreamingResponse: + def __init__(self, ip_ranges: AsyncIPRangesResource) -> None: + self._ip_ranges = ip_ranges + + self.list = async_to_streamed_response_wrapper( + ip_ranges.list, + ) + self.list_ips = async_to_streamed_response_wrapper( + ip_ranges.list_ips, + ) diff --git a/src/gcore/resources/cdn/logs/__init__.py b/src/gcore/resources/cdn/logs/__init__.py new file mode 100644 index 00000000..580717d0 --- /dev/null +++ b/src/gcore/resources/cdn/logs/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) + +__all__ = [ + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cdn/logs/logs.py b/src/gcore/resources/cdn/logs/logs.py new file mode 100644 index 00000000..9466b36b --- /dev/null +++ b/src/gcore/resources/cdn/logs/logs.py @@ -0,0 +1,1424 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + BinaryAPIResponse, + AsyncBinaryAPIResponse, + StreamedBinaryAPIResponse, + AsyncStreamedBinaryAPIResponse, + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + to_custom_raw_response_wrapper, + async_to_streamed_response_wrapper, + to_custom_streamed_response_wrapper, + async_to_custom_raw_response_wrapper, + async_to_custom_streamed_response_wrapper, +) +from ....types.cdn import log_list_params, log_download_params +from ....pagination import SyncOffsetPageCdnLogs, AsyncOffsetPageCdnLogs +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cdn.cdn_log_entry import Data + +__all__ = ["LogsResource", "AsyncLogsResource"] + + +class LogsResource(SyncAPIResource): + @cached_property + def settings(self) -> SettingsResource: + return SettingsResource(self._client) + + @cached_property + def with_raw_response(self) -> LogsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return LogsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LogsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return LogsResourceWithStreamingResponse(self) + + def list( + self, + *, + from_: str, + to: str, + cache_status_eq: str | Omit = omit, + cache_status_in: str | Omit = omit, + cache_status_ne: str | Omit = omit, + cache_status_not_in: str | Omit = omit, + client_ip_eq: str | Omit = omit, + client_ip_in: str | Omit = omit, + client_ip_ne: str | Omit = omit, + client_ip_not_in: str | Omit = omit, + cname_contains: str | Omit = omit, + cname_eq: str | Omit = omit, + cname_in: str | Omit = omit, + cname_ne: str | Omit = omit, + cname_not_in: str | Omit = omit, + datacenter_eq: str | Omit = omit, + datacenter_in: str | Omit = omit, + datacenter_ne: str | Omit = omit, + datacenter_not_in: str | Omit = omit, + fields: str | Omit = omit, + limit: int | Omit = omit, + method_eq: str | Omit = omit, + method_in: str | Omit = omit, + method_ne: str | Omit = omit, + method_not_in: str | Omit = omit, + offset: int | Omit = omit, + ordering: str | Omit = omit, + resource_id_eq: int | Omit = omit, + resource_id_gt: int | Omit = omit, + resource_id_gte: int | Omit = omit, + resource_id_in: str | Omit = omit, + resource_id_lt: int | Omit = omit, + resource_id_lte: int | Omit = omit, + resource_id_ne: int | Omit = omit, + resource_id_not_in: str | Omit = omit, + size_eq: int | Omit = omit, + size_gt: int | Omit = omit, + size_gte: int | Omit = omit, + size_in: str | Omit = omit, + size_lt: int | Omit = omit, + size_lte: int | Omit = omit, + size_ne: int | Omit = omit, + size_not_in: str | Omit = omit, + status_eq: int | Omit = omit, + status_gt: int | Omit = omit, + status_gte: int | Omit = omit, + status_in: str | Omit = omit, + status_lt: int | Omit = omit, + status_lte: int | Omit = omit, + status_ne: int | Omit = omit, + status_not_in: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncOffsetPageCdnLogs[Data]: + """ + Get CDN logs for up to 3 days starting today. + + You can filter logs using query parameters by client IP, CDN resource, date, + path and etc. + + To filter the CDN logs by 2xx status codes, use: + + - &`status__gte`=200&`status__lt`=300 + + Args: + from_: Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &from=2021-06-14T00:00:00Z + - &from=2021-06-14T00:00:00.000Z + + to: End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &to=2021-06-15T00:00:00Z + - &to=2021-06-15T00:00:00.000Z + + cache_status_eq: Caching status. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_in: List of caching statuses. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. Values should be separated by + a comma. + + cache_status_ne: Caching status not equal to the specified value. Possible values: 'MISS', + 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_not_in: + List of caching statuses not equal to the specified values. Possible values: + 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', + 'HIT', '-'. Values should be separated by a comma. + + client_ip_eq: IP address of the client who sent the request. + + client_ip_in: List of IP addresses of the clients who sent the request. + + client_ip_ne: IP address of the client who did not send the request. + + client_ip_not_in: List of IP addresses of the clients who did not send the request. + + cname_contains: Part of the custom domain of the requested CDN resource. Minimum length is 3 + characters. + + cname_eq: Custom domain of the requested CDN resource. + + cname_in: List of custom domains of the requested CDN resource. Values should be separated + by a comma. + + cname_ne: Custom domain of the requested CDN resource not equal to the specified value. + + cname_not_in: List of custom domains of the requested CDN resource not equal to the specified + values. Values should be separated by a comma. + + datacenter_eq: Data center where request was processed. + + datacenter_in: List of data centers where request was processed. Values should be separated by + a comma. + + datacenter_ne: Data center where request was not processed. + + datacenter_not_in: List of data centers where request was not processed. Values should be separated + by a comma. + + fields: A comma-separated list of returned fields. + + Supported fields are presented in the responses section. + + Example: + + - &fields=timestamp,path,status + + limit: Maximum number of log records in the response. + + method_eq: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + method_ne: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_not_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + offset: Number of log records to skip starting from the beginning of the requested + period. + + ordering: Sorting rules. + + Possible values: + + - **method** - Request HTTP method. + - **`client_ip`** - IP address of the client who sent the request. + - **status** - Status code in the response. + - **size** - Response size in bytes. + - **cname** - Custom domain of the requested resource. + - **`resource_id`** - ID of the requested CDN resource. + - **`cache_status`** - Caching status. + - **datacenter** - Data center where request was processed. + - **timestamp** - Date and time when the request was made. + + Parameter may have multiple values separated by a comma. + + By default, ascending sorting is applied. To sort in descending order, add '-' + prefix. + + Example: + + - &ordering=-timestamp,status + + resource_id_eq: ID of the requested CDN resource equal to the specified value. + + resource_id_gt: ID of the requested CDN resource greater than the specified value. + + resource_id_gte: ID of the requested CDN resource greater than or equal to the specified value. + + resource_id_in: List of IDs of the requested CDN resource. Values should be separated by a + comma. + + resource_id_lt: ID of the requested CDN resource less than the specified value. + + resource_id_lte: ID of the requested CDN resource less than or equal to the specified value. + + resource_id_ne: ID of the requested CDN resource not equal to the specified value. + + resource_id_not_in: List of IDs of the requested CDN resource not equal to the specified values. + Values should be separated by a comma. + + size_eq: Response size in bytes equal to the specified value. + + size_gt: Response size in bytes greater than the specified value. + + size_gte: Response size in bytes greater than or equal to the specified value. + + size_in: List of response sizes in bytes. Values should be separated by a comma. + + size_lt: Response size in bytes less than the specified value. + + size_lte: Response size in bytes less than or equal to the specified value. + + size_ne: Response size in bytes not equal to the specified value. + + size_not_in: List of response sizes in bytes not equal to the specified values. Values should + be separated by + + status_eq: Status code in the response equal to the specified value. + + status_gt: Status code in the response greater than the specified value. + + status_gte: Status code in the response greater than or equal to the specified value. + + status_in: List of status codes in the response. Values should be separated by a comma. + + status_lt: Status code in the response less than the specified value. + + status_lte: Status code in the response less than or equal to the specified value. + + status_ne: Status code in the response not equal to the specified value. + + status_not_in: List of status codes not in the response. Values should be separated by a comma. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cdn/advanced/v1/logs" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/logs", + page=SyncOffsetPageCdnLogs[Data], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "cache_status_eq": cache_status_eq, + "cache_status_in": cache_status_in, + "cache_status_ne": cache_status_ne, + "cache_status_not_in": cache_status_not_in, + "client_ip_eq": client_ip_eq, + "client_ip_in": client_ip_in, + "client_ip_ne": client_ip_ne, + "client_ip_not_in": client_ip_not_in, + "cname_contains": cname_contains, + "cname_eq": cname_eq, + "cname_in": cname_in, + "cname_ne": cname_ne, + "cname_not_in": cname_not_in, + "datacenter_eq": datacenter_eq, + "datacenter_in": datacenter_in, + "datacenter_ne": datacenter_ne, + "datacenter_not_in": datacenter_not_in, + "fields": fields, + "limit": limit, + "method_eq": method_eq, + "method_in": method_in, + "method_ne": method_ne, + "method_not_in": method_not_in, + "offset": offset, + "ordering": ordering, + "resource_id_eq": resource_id_eq, + "resource_id_gt": resource_id_gt, + "resource_id_gte": resource_id_gte, + "resource_id_in": resource_id_in, + "resource_id_lt": resource_id_lt, + "resource_id_lte": resource_id_lte, + "resource_id_ne": resource_id_ne, + "resource_id_not_in": resource_id_not_in, + "size_eq": size_eq, + "size_gt": size_gt, + "size_gte": size_gte, + "size_in": size_in, + "size_lt": size_lt, + "size_lte": size_lte, + "size_ne": size_ne, + "size_not_in": size_not_in, + "status_eq": status_eq, + "status_gt": status_gt, + "status_gte": status_gte, + "status_in": status_in, + "status_lt": status_lt, + "status_lte": status_lte, + "status_ne": status_ne, + "status_not_in": status_not_in, + }, + log_list_params.LogListParams, + ), + ), + model=Data, + ) + + def download( + self, + *, + format: str, + from_: str, + to: str, + cache_status_eq: str | Omit = omit, + cache_status_in: str | Omit = omit, + cache_status_ne: str | Omit = omit, + cache_status_not_in: str | Omit = omit, + client_ip_eq: str | Omit = omit, + client_ip_in: str | Omit = omit, + client_ip_ne: str | Omit = omit, + client_ip_not_in: str | Omit = omit, + cname_contains: str | Omit = omit, + cname_eq: str | Omit = omit, + cname_in: str | Omit = omit, + cname_ne: str | Omit = omit, + cname_not_in: str | Omit = omit, + datacenter_eq: str | Omit = omit, + datacenter_in: str | Omit = omit, + datacenter_ne: str | Omit = omit, + datacenter_not_in: str | Omit = omit, + fields: str | Omit = omit, + limit: int | Omit = omit, + method_eq: str | Omit = omit, + method_in: str | Omit = omit, + method_ne: str | Omit = omit, + method_not_in: str | Omit = omit, + offset: int | Omit = omit, + resource_id_eq: int | Omit = omit, + resource_id_gt: int | Omit = omit, + resource_id_gte: int | Omit = omit, + resource_id_in: str | Omit = omit, + resource_id_lt: int | Omit = omit, + resource_id_lte: int | Omit = omit, + resource_id_ne: int | Omit = omit, + resource_id_not_in: str | Omit = omit, + size_eq: int | Omit = omit, + size_gt: int | Omit = omit, + size_gte: int | Omit = omit, + size_in: str | Omit = omit, + size_lt: int | Omit = omit, + size_lte: int | Omit = omit, + size_ne: int | Omit = omit, + size_not_in: str | Omit = omit, + sort: str | Omit = omit, + status_eq: int | Omit = omit, + status_gt: int | Omit = omit, + status_gte: int | Omit = omit, + status_in: str | Omit = omit, + status_lt: int | Omit = omit, + status_lte: int | Omit = omit, + status_ne: int | Omit = omit, + status_not_in: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> BinaryAPIResponse: + """ + Download CDN logs for up to 3 days starting today. + + You can filter logs using query params by client IP, CDN resource, date, path + and etc. + + Args: + format: Output format. + + Possible values: + + - csv + - tsv + + from_: Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &from=2021-06-14T00:00:00Z + - &from=2021-06-14T00:00:00.000Z + + to: End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &to=2021-06-15T00:00:00Z + - &to=2021-06-15T00:00:00.000Z + + cache_status_eq: Caching status. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_in: List of caching statuses. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. Values should be separated by + a comma. + + cache_status_ne: Caching status not equal to the specified value. Possible values: 'MISS', + 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_not_in: + List of caching statuses not equal to the specified values. Possible values: + 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', + 'HIT', '-'. Values should be separated by a comma. + + client_ip_eq: IP address of the client who sent the request. + + client_ip_in: List of IP addresses of the clients who sent the request. + + client_ip_ne: IP address of the client who did not send the request. + + client_ip_not_in: List of IP addresses of the clients who did not send the request. + + cname_contains: Part of the custom domain of the requested CDN resource. Minimum length is 3 + characters. + + cname_eq: Custom domain of the requested CDN resource. + + cname_in: List of custom domains of the requested CDN resource. Values should be separated + by a comma. + + cname_ne: Custom domain of the requested CDN resource not equal to the specified value. + + cname_not_in: List of custom domains of the requested CDN resource not equal to the specified + values. Values should be separated by a comma. + + datacenter_eq: Data center where request was processed. + + datacenter_in: List of data centers where request was processed. Values should be separated by + a comma. + + datacenter_ne: Data center where request was not processed. + + datacenter_not_in: List of data centers where request was not processed. Values should be separated + by a comma. + + fields: A comma-separated list of returned fields. + + Supported fields are presented in the responses section. + + Example: + + - &fields=timestamp,path,status + + limit: Maximum number of log records in the response. + + method_eq: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + method_ne: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_not_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + offset: Number of log records to skip starting from the beginning of the requested + period. + + resource_id_eq: ID of the requested CDN resource equal to the specified value. + + resource_id_gt: ID of the requested CDN resource greater than the specified value. + + resource_id_gte: ID of the requested CDN resource greater than or equal to the specified value. + + resource_id_in: List of IDs of the requested CDN resource. Values should be separated by a + comma. + + resource_id_lt: ID of the requested CDN resource less than the specified value. + + resource_id_lte: ID of the requested CDN resource less than or equal to the specified value. + + resource_id_ne: ID of the requested CDN resource not equal to the specified value. + + resource_id_not_in: List of IDs of the requested CDN resource not equal to the specified values. + Values should be separated by a comma. + + size_eq: Response size in bytes equal to the specified value. + + size_gt: Response size in bytes greater than the specified value. + + size_gte: Response size in bytes greater than or equal to the specified value. + + size_in: List of response sizes in bytes. Values should be separated by a comma. + + size_lt: Response size in bytes less than the specified value. + + size_lte: Response size in bytes less than or equal to the specified value. + + size_ne: Response size in bytes not equal to the specified value. + + size_not_in: List of response sizes in bytes not equal to the specified values. Values should + be separated by + + sort: Sorting rules. + + Possible values: + + - **method** - Request HTTP method. + - **`client_ip`** - IP address of the client who sent the request. + - **status** - Status code in the response. + - **size** - Response size in bytes. + - **cname** - Custom domain of the requested resource. + - **`resource_id`** - ID of the requested CDN resource. + - **`cache_status`** - Caching status. + - **datacenter** - Data center where request was processed. + - **timestamp** - Date and time when the request was made. + + May include multiple values separated by a comma. + + Example: + + - &sort=-timestamp,status + + status_eq: Status code in the response equal to the specified value. + + status_gt: Status code in the response greater than the specified value. + + status_gte: Status code in the response greater than or equal to the specified value. + + status_in: List of status codes in the response. Values should be separated by a comma. + + status_lt: Status code in the response less than the specified value. + + status_lte: Status code in the response less than or equal to the specified value. + + status_ne: Status code in the response not equal to the specified value. + + status_not_in: List of status codes not in the response. Values should be separated by a comma. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "application/zip", **(extra_headers or {})} + return self._get( + "/cdn/advanced/v1/logs/download" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/logs/download", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "format": format, + "from_": from_, + "to": to, + "cache_status_eq": cache_status_eq, + "cache_status_in": cache_status_in, + "cache_status_ne": cache_status_ne, + "cache_status_not_in": cache_status_not_in, + "client_ip_eq": client_ip_eq, + "client_ip_in": client_ip_in, + "client_ip_ne": client_ip_ne, + "client_ip_not_in": client_ip_not_in, + "cname_contains": cname_contains, + "cname_eq": cname_eq, + "cname_in": cname_in, + "cname_ne": cname_ne, + "cname_not_in": cname_not_in, + "datacenter_eq": datacenter_eq, + "datacenter_in": datacenter_in, + "datacenter_ne": datacenter_ne, + "datacenter_not_in": datacenter_not_in, + "fields": fields, + "limit": limit, + "method_eq": method_eq, + "method_in": method_in, + "method_ne": method_ne, + "method_not_in": method_not_in, + "offset": offset, + "resource_id_eq": resource_id_eq, + "resource_id_gt": resource_id_gt, + "resource_id_gte": resource_id_gte, + "resource_id_in": resource_id_in, + "resource_id_lt": resource_id_lt, + "resource_id_lte": resource_id_lte, + "resource_id_ne": resource_id_ne, + "resource_id_not_in": resource_id_not_in, + "size_eq": size_eq, + "size_gt": size_gt, + "size_gte": size_gte, + "size_in": size_in, + "size_lt": size_lt, + "size_lte": size_lte, + "size_ne": size_ne, + "size_not_in": size_not_in, + "sort": sort, + "status_eq": status_eq, + "status_gt": status_gt, + "status_gte": status_gte, + "status_in": status_in, + "status_lt": status_lt, + "status_lte": status_lte, + "status_ne": status_ne, + "status_not_in": status_not_in, + }, + log_download_params.LogDownloadParams, + ), + ), + cast_to=BinaryAPIResponse, + ) + + +class AsyncLogsResource(AsyncAPIResource): + @cached_property + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncLogsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncLogsResourceWithStreamingResponse(self) + + def list( + self, + *, + from_: str, + to: str, + cache_status_eq: str | Omit = omit, + cache_status_in: str | Omit = omit, + cache_status_ne: str | Omit = omit, + cache_status_not_in: str | Omit = omit, + client_ip_eq: str | Omit = omit, + client_ip_in: str | Omit = omit, + client_ip_ne: str | Omit = omit, + client_ip_not_in: str | Omit = omit, + cname_contains: str | Omit = omit, + cname_eq: str | Omit = omit, + cname_in: str | Omit = omit, + cname_ne: str | Omit = omit, + cname_not_in: str | Omit = omit, + datacenter_eq: str | Omit = omit, + datacenter_in: str | Omit = omit, + datacenter_ne: str | Omit = omit, + datacenter_not_in: str | Omit = omit, + fields: str | Omit = omit, + limit: int | Omit = omit, + method_eq: str | Omit = omit, + method_in: str | Omit = omit, + method_ne: str | Omit = omit, + method_not_in: str | Omit = omit, + offset: int | Omit = omit, + ordering: str | Omit = omit, + resource_id_eq: int | Omit = omit, + resource_id_gt: int | Omit = omit, + resource_id_gte: int | Omit = omit, + resource_id_in: str | Omit = omit, + resource_id_lt: int | Omit = omit, + resource_id_lte: int | Omit = omit, + resource_id_ne: int | Omit = omit, + resource_id_not_in: str | Omit = omit, + size_eq: int | Omit = omit, + size_gt: int | Omit = omit, + size_gte: int | Omit = omit, + size_in: str | Omit = omit, + size_lt: int | Omit = omit, + size_lte: int | Omit = omit, + size_ne: int | Omit = omit, + size_not_in: str | Omit = omit, + status_eq: int | Omit = omit, + status_gt: int | Omit = omit, + status_gte: int | Omit = omit, + status_in: str | Omit = omit, + status_lt: int | Omit = omit, + status_lte: int | Omit = omit, + status_ne: int | Omit = omit, + status_not_in: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[Data, AsyncOffsetPageCdnLogs[Data]]: + """ + Get CDN logs for up to 3 days starting today. + + You can filter logs using query parameters by client IP, CDN resource, date, + path and etc. + + To filter the CDN logs by 2xx status codes, use: + + - &`status__gte`=200&`status__lt`=300 + + Args: + from_: Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &from=2021-06-14T00:00:00Z + - &from=2021-06-14T00:00:00.000Z + + to: End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &to=2021-06-15T00:00:00Z + - &to=2021-06-15T00:00:00.000Z + + cache_status_eq: Caching status. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_in: List of caching statuses. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. Values should be separated by + a comma. + + cache_status_ne: Caching status not equal to the specified value. Possible values: 'MISS', + 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_not_in: + List of caching statuses not equal to the specified values. Possible values: + 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', + 'HIT', '-'. Values should be separated by a comma. + + client_ip_eq: IP address of the client who sent the request. + + client_ip_in: List of IP addresses of the clients who sent the request. + + client_ip_ne: IP address of the client who did not send the request. + + client_ip_not_in: List of IP addresses of the clients who did not send the request. + + cname_contains: Part of the custom domain of the requested CDN resource. Minimum length is 3 + characters. + + cname_eq: Custom domain of the requested CDN resource. + + cname_in: List of custom domains of the requested CDN resource. Values should be separated + by a comma. + + cname_ne: Custom domain of the requested CDN resource not equal to the specified value. + + cname_not_in: List of custom domains of the requested CDN resource not equal to the specified + values. Values should be separated by a comma. + + datacenter_eq: Data center where request was processed. + + datacenter_in: List of data centers where request was processed. Values should be separated by + a comma. + + datacenter_ne: Data center where request was not processed. + + datacenter_not_in: List of data centers where request was not processed. Values should be separated + by a comma. + + fields: A comma-separated list of returned fields. + + Supported fields are presented in the responses section. + + Example: + + - &fields=timestamp,path,status + + limit: Maximum number of log records in the response. + + method_eq: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + method_ne: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_not_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + offset: Number of log records to skip starting from the beginning of the requested + period. + + ordering: Sorting rules. + + Possible values: + + - **method** - Request HTTP method. + - **`client_ip`** - IP address of the client who sent the request. + - **status** - Status code in the response. + - **size** - Response size in bytes. + - **cname** - Custom domain of the requested resource. + - **`resource_id`** - ID of the requested CDN resource. + - **`cache_status`** - Caching status. + - **datacenter** - Data center where request was processed. + - **timestamp** - Date and time when the request was made. + + Parameter may have multiple values separated by a comma. + + By default, ascending sorting is applied. To sort in descending order, add '-' + prefix. + + Example: + + - &ordering=-timestamp,status + + resource_id_eq: ID of the requested CDN resource equal to the specified value. + + resource_id_gt: ID of the requested CDN resource greater than the specified value. + + resource_id_gte: ID of the requested CDN resource greater than or equal to the specified value. + + resource_id_in: List of IDs of the requested CDN resource. Values should be separated by a + comma. + + resource_id_lt: ID of the requested CDN resource less than the specified value. + + resource_id_lte: ID of the requested CDN resource less than or equal to the specified value. + + resource_id_ne: ID of the requested CDN resource not equal to the specified value. + + resource_id_not_in: List of IDs of the requested CDN resource not equal to the specified values. + Values should be separated by a comma. + + size_eq: Response size in bytes equal to the specified value. + + size_gt: Response size in bytes greater than the specified value. + + size_gte: Response size in bytes greater than or equal to the specified value. + + size_in: List of response sizes in bytes. Values should be separated by a comma. + + size_lt: Response size in bytes less than the specified value. + + size_lte: Response size in bytes less than or equal to the specified value. + + size_ne: Response size in bytes not equal to the specified value. + + size_not_in: List of response sizes in bytes not equal to the specified values. Values should + be separated by + + status_eq: Status code in the response equal to the specified value. + + status_gt: Status code in the response greater than the specified value. + + status_gte: Status code in the response greater than or equal to the specified value. + + status_in: List of status codes in the response. Values should be separated by a comma. + + status_lt: Status code in the response less than the specified value. + + status_lte: Status code in the response less than or equal to the specified value. + + status_ne: Status code in the response not equal to the specified value. + + status_not_in: List of status codes not in the response. Values should be separated by a comma. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/cdn/advanced/v1/logs" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/logs", + page=AsyncOffsetPageCdnLogs[Data], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "cache_status_eq": cache_status_eq, + "cache_status_in": cache_status_in, + "cache_status_ne": cache_status_ne, + "cache_status_not_in": cache_status_not_in, + "client_ip_eq": client_ip_eq, + "client_ip_in": client_ip_in, + "client_ip_ne": client_ip_ne, + "client_ip_not_in": client_ip_not_in, + "cname_contains": cname_contains, + "cname_eq": cname_eq, + "cname_in": cname_in, + "cname_ne": cname_ne, + "cname_not_in": cname_not_in, + "datacenter_eq": datacenter_eq, + "datacenter_in": datacenter_in, + "datacenter_ne": datacenter_ne, + "datacenter_not_in": datacenter_not_in, + "fields": fields, + "limit": limit, + "method_eq": method_eq, + "method_in": method_in, + "method_ne": method_ne, + "method_not_in": method_not_in, + "offset": offset, + "ordering": ordering, + "resource_id_eq": resource_id_eq, + "resource_id_gt": resource_id_gt, + "resource_id_gte": resource_id_gte, + "resource_id_in": resource_id_in, + "resource_id_lt": resource_id_lt, + "resource_id_lte": resource_id_lte, + "resource_id_ne": resource_id_ne, + "resource_id_not_in": resource_id_not_in, + "size_eq": size_eq, + "size_gt": size_gt, + "size_gte": size_gte, + "size_in": size_in, + "size_lt": size_lt, + "size_lte": size_lte, + "size_ne": size_ne, + "size_not_in": size_not_in, + "status_eq": status_eq, + "status_gt": status_gt, + "status_gte": status_gte, + "status_in": status_in, + "status_lt": status_lt, + "status_lte": status_lte, + "status_ne": status_ne, + "status_not_in": status_not_in, + }, + log_list_params.LogListParams, + ), + ), + model=Data, + ) + + async def download( + self, + *, + format: str, + from_: str, + to: str, + cache_status_eq: str | Omit = omit, + cache_status_in: str | Omit = omit, + cache_status_ne: str | Omit = omit, + cache_status_not_in: str | Omit = omit, + client_ip_eq: str | Omit = omit, + client_ip_in: str | Omit = omit, + client_ip_ne: str | Omit = omit, + client_ip_not_in: str | Omit = omit, + cname_contains: str | Omit = omit, + cname_eq: str | Omit = omit, + cname_in: str | Omit = omit, + cname_ne: str | Omit = omit, + cname_not_in: str | Omit = omit, + datacenter_eq: str | Omit = omit, + datacenter_in: str | Omit = omit, + datacenter_ne: str | Omit = omit, + datacenter_not_in: str | Omit = omit, + fields: str | Omit = omit, + limit: int | Omit = omit, + method_eq: str | Omit = omit, + method_in: str | Omit = omit, + method_ne: str | Omit = omit, + method_not_in: str | Omit = omit, + offset: int | Omit = omit, + resource_id_eq: int | Omit = omit, + resource_id_gt: int | Omit = omit, + resource_id_gte: int | Omit = omit, + resource_id_in: str | Omit = omit, + resource_id_lt: int | Omit = omit, + resource_id_lte: int | Omit = omit, + resource_id_ne: int | Omit = omit, + resource_id_not_in: str | Omit = omit, + size_eq: int | Omit = omit, + size_gt: int | Omit = omit, + size_gte: int | Omit = omit, + size_in: str | Omit = omit, + size_lt: int | Omit = omit, + size_lte: int | Omit = omit, + size_ne: int | Omit = omit, + size_not_in: str | Omit = omit, + sort: str | Omit = omit, + status_eq: int | Omit = omit, + status_gt: int | Omit = omit, + status_gte: int | Omit = omit, + status_in: str | Omit = omit, + status_lt: int | Omit = omit, + status_lte: int | Omit = omit, + status_ne: int | Omit = omit, + status_not_in: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncBinaryAPIResponse: + """ + Download CDN logs for up to 3 days starting today. + + You can filter logs using query params by client IP, CDN resource, date, path + and etc. + + Args: + format: Output format. + + Possible values: + + - csv + - tsv + + from_: Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &from=2021-06-14T00:00:00Z + - &from=2021-06-14T00:00:00.000Z + + to: End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &to=2021-06-15T00:00:00Z + - &to=2021-06-15T00:00:00.000Z + + cache_status_eq: Caching status. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_in: List of caching statuses. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. Values should be separated by + a comma. + + cache_status_ne: Caching status not equal to the specified value. Possible values: 'MISS', + 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_not_in: + List of caching statuses not equal to the specified values. Possible values: + 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', + 'HIT', '-'. Values should be separated by a comma. + + client_ip_eq: IP address of the client who sent the request. + + client_ip_in: List of IP addresses of the clients who sent the request. + + client_ip_ne: IP address of the client who did not send the request. + + client_ip_not_in: List of IP addresses of the clients who did not send the request. + + cname_contains: Part of the custom domain of the requested CDN resource. Minimum length is 3 + characters. + + cname_eq: Custom domain of the requested CDN resource. + + cname_in: List of custom domains of the requested CDN resource. Values should be separated + by a comma. + + cname_ne: Custom domain of the requested CDN resource not equal to the specified value. + + cname_not_in: List of custom domains of the requested CDN resource not equal to the specified + values. Values should be separated by a comma. + + datacenter_eq: Data center where request was processed. + + datacenter_in: List of data centers where request was processed. Values should be separated by + a comma. + + datacenter_ne: Data center where request was not processed. + + datacenter_not_in: List of data centers where request was not processed. Values should be separated + by a comma. + + fields: A comma-separated list of returned fields. + + Supported fields are presented in the responses section. + + Example: + + - &fields=timestamp,path,status + + limit: Maximum number of log records in the response. + + method_eq: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + method_ne: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_not_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + offset: Number of log records to skip starting from the beginning of the requested + period. + + resource_id_eq: ID of the requested CDN resource equal to the specified value. + + resource_id_gt: ID of the requested CDN resource greater than the specified value. + + resource_id_gte: ID of the requested CDN resource greater than or equal to the specified value. + + resource_id_in: List of IDs of the requested CDN resource. Values should be separated by a + comma. + + resource_id_lt: ID of the requested CDN resource less than the specified value. + + resource_id_lte: ID of the requested CDN resource less than or equal to the specified value. + + resource_id_ne: ID of the requested CDN resource not equal to the specified value. + + resource_id_not_in: List of IDs of the requested CDN resource not equal to the specified values. + Values should be separated by a comma. + + size_eq: Response size in bytes equal to the specified value. + + size_gt: Response size in bytes greater than the specified value. + + size_gte: Response size in bytes greater than or equal to the specified value. + + size_in: List of response sizes in bytes. Values should be separated by a comma. + + size_lt: Response size in bytes less than the specified value. + + size_lte: Response size in bytes less than or equal to the specified value. + + size_ne: Response size in bytes not equal to the specified value. + + size_not_in: List of response sizes in bytes not equal to the specified values. Values should + be separated by + + sort: Sorting rules. + + Possible values: + + - **method** - Request HTTP method. + - **`client_ip`** - IP address of the client who sent the request. + - **status** - Status code in the response. + - **size** - Response size in bytes. + - **cname** - Custom domain of the requested resource. + - **`resource_id`** - ID of the requested CDN resource. + - **`cache_status`** - Caching status. + - **datacenter** - Data center where request was processed. + - **timestamp** - Date and time when the request was made. + + May include multiple values separated by a comma. + + Example: + + - &sort=-timestamp,status + + status_eq: Status code in the response equal to the specified value. + + status_gt: Status code in the response greater than the specified value. + + status_gte: Status code in the response greater than or equal to the specified value. + + status_in: List of status codes in the response. Values should be separated by a comma. + + status_lt: Status code in the response less than the specified value. + + status_lte: Status code in the response less than or equal to the specified value. + + status_ne: Status code in the response not equal to the specified value. + + status_not_in: List of status codes not in the response. Values should be separated by a comma. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "application/zip", **(extra_headers or {})} + return await self._get( + "/cdn/advanced/v1/logs/download" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/logs/download", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "format": format, + "from_": from_, + "to": to, + "cache_status_eq": cache_status_eq, + "cache_status_in": cache_status_in, + "cache_status_ne": cache_status_ne, + "cache_status_not_in": cache_status_not_in, + "client_ip_eq": client_ip_eq, + "client_ip_in": client_ip_in, + "client_ip_ne": client_ip_ne, + "client_ip_not_in": client_ip_not_in, + "cname_contains": cname_contains, + "cname_eq": cname_eq, + "cname_in": cname_in, + "cname_ne": cname_ne, + "cname_not_in": cname_not_in, + "datacenter_eq": datacenter_eq, + "datacenter_in": datacenter_in, + "datacenter_ne": datacenter_ne, + "datacenter_not_in": datacenter_not_in, + "fields": fields, + "limit": limit, + "method_eq": method_eq, + "method_in": method_in, + "method_ne": method_ne, + "method_not_in": method_not_in, + "offset": offset, + "resource_id_eq": resource_id_eq, + "resource_id_gt": resource_id_gt, + "resource_id_gte": resource_id_gte, + "resource_id_in": resource_id_in, + "resource_id_lt": resource_id_lt, + "resource_id_lte": resource_id_lte, + "resource_id_ne": resource_id_ne, + "resource_id_not_in": resource_id_not_in, + "size_eq": size_eq, + "size_gt": size_gt, + "size_gte": size_gte, + "size_in": size_in, + "size_lt": size_lt, + "size_lte": size_lte, + "size_ne": size_ne, + "size_not_in": size_not_in, + "sort": sort, + "status_eq": status_eq, + "status_gt": status_gt, + "status_gte": status_gte, + "status_in": status_in, + "status_lt": status_lt, + "status_lte": status_lte, + "status_ne": status_ne, + "status_not_in": status_not_in, + }, + log_download_params.LogDownloadParams, + ), + ), + cast_to=AsyncBinaryAPIResponse, + ) + + +class LogsResourceWithRawResponse: + def __init__(self, logs: LogsResource) -> None: + self._logs = logs + + self.list = to_raw_response_wrapper( + logs.list, + ) + self.download = to_custom_raw_response_wrapper( + logs.download, + BinaryAPIResponse, + ) + + @cached_property + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._logs.settings) + + +class AsyncLogsResourceWithRawResponse: + def __init__(self, logs: AsyncLogsResource) -> None: + self._logs = logs + + self.list = async_to_raw_response_wrapper( + logs.list, + ) + self.download = async_to_custom_raw_response_wrapper( + logs.download, + AsyncBinaryAPIResponse, + ) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._logs.settings) + + +class LogsResourceWithStreamingResponse: + def __init__(self, logs: LogsResource) -> None: + self._logs = logs + + self.list = to_streamed_response_wrapper( + logs.list, + ) + self.download = to_custom_streamed_response_wrapper( + logs.download, + StreamedBinaryAPIResponse, + ) + + @cached_property + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._logs.settings) + + +class AsyncLogsResourceWithStreamingResponse: + def __init__(self, logs: AsyncLogsResource) -> None: + self._logs = logs + + self.list = async_to_streamed_response_wrapper( + logs.list, + ) + self.download = async_to_custom_streamed_response_wrapper( + logs.download, + AsyncStreamedBinaryAPIResponse, + ) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._logs.settings) diff --git a/src/gcore/resources/cdn/logs/settings.py b/src/gcore/resources/cdn/logs/settings.py new file mode 100644 index 00000000..81624fb2 --- /dev/null +++ b/src/gcore/resources/cdn/logs/settings.py @@ -0,0 +1,1081 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional + +import httpx + +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cdn.logs import setting_create_params, setting_update_params +from ....types.cdn.logs.log_settings import LogSettings + +__all__ = ["SettingsResource", "AsyncSettingsResource"] + + +class SettingsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SettingsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return SettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return SettingsResourceWithStreamingResponse(self) + + def create( + self, + *, + all_resources_bucket: str, + all_resources_folder: str, + folders: Iterable[setting_create_params.Folder], + for_all_resources: bool, + ftp_hostname: str, + ftp_login: str, + ftp_password: str, + s3_access_key_id: str, + s3_hostname: str, + s3_secret_key: str, + s3_type: str, + sftp_hostname: str, + sftp_login: str, + sftp_password: str, + storage_type: str, + archive_size_mb: Optional[int] | Omit = omit, + enabled: bool | Omit = omit, + ftp_prepend_folder: str | Omit = omit, + ignore_empty_logs: bool | Omit = omit, + s3_aws_region: int | Omit = omit, + s3_bucket_location: str | Omit = omit, + s3_host_bucket: str | Omit = omit, + sftp_key_passphrase: str | Omit = omit, + sftp_prepend_folder: str | Omit = omit, + sftp_private_key: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Setup raw logs settings + + Args: + all_resources_bucket: Name of the S3 bucket to which logs for all CDN resources are delivered. + + all_resources_folder: + Parameter meaning depends on the value of the "`storage_type`" value: + + - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for + all CDN resources are delivered. + - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for + all CDN resources are delivered. + + folders: List of folders/buckets for receiving CDN resources logs. + + for_all_resources: Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of different CDN resources are delivered to separate + folders/buckets. + + ftp_hostname: FTP storage hostname. + + ftp_login: FTP storage login. + + ftp_password: FTP storage password. + + s3_access_key_id: Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + + s3_hostname: S3 storage hostname. + + It is required if "`s3_type`": other. + + s3_secret_key: Secret access key for the S3 account. + + Secret Access Key is 20-50 alpha-numeric-slash-plus characters like + kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct + + s3_type: Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + + sftp_hostname: SFTP storage hostname. + + sftp_login: SFTP storage login. + + sftp_password: SFTP storage password. + + It should be empty if "`sftp_private_key`" is set. + + storage_type: Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + + archive_size_mb: The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + + enabled: Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + + ftp_prepend_folder: Name of the FTP prepend folder for log delivery. + + **Null** is allowed. + + ignore_empty_logs: Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + + s3_aws_region: Amazon AWS region. + + s3_bucket_location: Location of S3 storage. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores + (.:\\__-). + + s3_host_bucket: S3 bucket hostname. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + - Required if "`s3_type`": other. + + sftp_key_passphrase: Passphrase for SFTP private key. + + Restrictions: + + - Should be set if private key encoded with passphrase. + - Should be empty if "`sftp_password`" is set. + + sftp_prepend_folder: Name of the SFTP prepend folder for log delivery. + + **Null** is allowed. + + sftp_private_key: Private key for SFTP authorization. + + Possible values: + + - **RSA** + - **ED25519** + + It should be empty if "`sftp_password`" is set. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + body=maybe_transform( + { + "all_resources_bucket": all_resources_bucket, + "all_resources_folder": all_resources_folder, + "folders": folders, + "for_all_resources": for_all_resources, + "ftp_hostname": ftp_hostname, + "ftp_login": ftp_login, + "ftp_password": ftp_password, + "s3_access_key_id": s3_access_key_id, + "s3_hostname": s3_hostname, + "s3_secret_key": s3_secret_key, + "s3_type": s3_type, + "sftp_hostname": sftp_hostname, + "sftp_login": sftp_login, + "sftp_password": sftp_password, + "storage_type": storage_type, + "archive_size_mb": archive_size_mb, + "enabled": enabled, + "ftp_prepend_folder": ftp_prepend_folder, + "ignore_empty_logs": ignore_empty_logs, + "s3_aws_region": s3_aws_region, + "s3_bucket_location": s3_bucket_location, + "s3_host_bucket": s3_host_bucket, + "sftp_key_passphrase": sftp_key_passphrase, + "sftp_prepend_folder": sftp_prepend_folder, + "sftp_private_key": sftp_private_key, + }, + setting_create_params.SettingCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def update( + self, + *, + all_resources_bucket: str, + all_resources_folder: str, + folders: Iterable[setting_update_params.Folder], + for_all_resources: bool, + ftp_hostname: str, + ftp_login: str, + ftp_password: str, + s3_access_key_id: str, + s3_hostname: str, + s3_secret_key: str, + s3_type: str, + sftp_hostname: str, + sftp_login: str, + sftp_password: str, + storage_type: str, + archive_size_mb: Optional[int] | Omit = omit, + enabled: bool | Omit = omit, + ftp_prepend_folder: str | Omit = omit, + ignore_empty_logs: bool | Omit = omit, + s3_aws_region: int | Omit = omit, + s3_bucket_location: str | Omit = omit, + s3_host_bucket: str | Omit = omit, + sftp_key_passphrase: str | Omit = omit, + sftp_prepend_folder: str | Omit = omit, + sftp_private_key: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + PATCH method is not allowed. + + Args: + all_resources_bucket: Name of the S3 bucket to which logs for all CDN resources are delivered. + + all_resources_folder: + Parameter meaning depends on the value of the "`storage_type`" value: + + - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for + all CDN resources are delivered. + - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for + all CDN resources are delivered. + + folders: List of folders/buckets for receiving CDN resources logs. + + for_all_resources: Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of different CDN resources are delivered to separate + folders/buckets. + + ftp_hostname: FTP storage hostname. + + ftp_login: FTP storage login. + + ftp_password: FTP storage password. + + s3_access_key_id: Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + + s3_hostname: S3 storage hostname. + + It is required if "`s3_type`": other. + + s3_secret_key: Secret access key for the S3 account. + + Secret Access Key is 20-50 alpha-numeric-slash-plus characters like + kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct + + s3_type: Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + + sftp_hostname: SFTP storage hostname. + + sftp_login: SFTP storage login. + + sftp_password: SFTP storage password. + + It should be empty if "`sftp_private_key`" is set. + + storage_type: Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + + archive_size_mb: The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + + enabled: Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + + ftp_prepend_folder: Name of the FTP prepend folder for log delivery. + + **Null** is allowed. + + ignore_empty_logs: Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + + s3_aws_region: Amazon AWS region. + + s3_bucket_location: Location of S3 storage. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores + (.:\\__-). + + s3_host_bucket: S3 bucket hostname. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + - Required if "`s3_type`": other. + + sftp_key_passphrase: Passphrase for SFTP private key. + + Restrictions: + + - Should be set if private key encoded with passphrase. + - Should be empty if "`sftp_password`" is set. + + sftp_prepend_folder: Name of the SFTP prepend folder for log delivery. + + **Null** is allowed. + + sftp_private_key: Private key for SFTP authorization. + + Possible values: + + - **RSA** + - **ED25519** + + It should be empty if "`sftp_password`" is set. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._put( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + body=maybe_transform( + { + "all_resources_bucket": all_resources_bucket, + "all_resources_folder": all_resources_folder, + "folders": folders, + "for_all_resources": for_all_resources, + "ftp_hostname": ftp_hostname, + "ftp_login": ftp_login, + "ftp_password": ftp_password, + "s3_access_key_id": s3_access_key_id, + "s3_hostname": s3_hostname, + "s3_secret_key": s3_secret_key, + "s3_type": s3_type, + "sftp_hostname": sftp_hostname, + "sftp_login": sftp_login, + "sftp_password": sftp_password, + "storage_type": storage_type, + "archive_size_mb": archive_size_mb, + "enabled": enabled, + "ftp_prepend_folder": ftp_prepend_folder, + "ignore_empty_logs": ignore_empty_logs, + "s3_aws_region": s3_aws_region, + "s3_bucket_location": s3_bucket_location, + "s3_host_bucket": s3_host_bucket, + "sftp_key_passphrase": sftp_key_passphrase, + "sftp_prepend_folder": sftp_prepend_folder, + "sftp_private_key": sftp_private_key, + }, + setting_update_params.SettingUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def delete( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete the raw logs delivery configuration from the system permanently. + + Notes: + + - **Deactivation Requirement**: Set the `enabled` attribute to `false` before + deletion. + - **Irreversibility**: This action is irreversible. Once deleted, the raw logs + delivery configuration cannot be recovered. + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogSettings: + """Get information about raw logs feature settings.""" + return self._get( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogSettings, + ) + + +class AsyncSettingsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncSettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncSettingsResourceWithStreamingResponse(self) + + async def create( + self, + *, + all_resources_bucket: str, + all_resources_folder: str, + folders: Iterable[setting_create_params.Folder], + for_all_resources: bool, + ftp_hostname: str, + ftp_login: str, + ftp_password: str, + s3_access_key_id: str, + s3_hostname: str, + s3_secret_key: str, + s3_type: str, + sftp_hostname: str, + sftp_login: str, + sftp_password: str, + storage_type: str, + archive_size_mb: Optional[int] | Omit = omit, + enabled: bool | Omit = omit, + ftp_prepend_folder: str | Omit = omit, + ignore_empty_logs: bool | Omit = omit, + s3_aws_region: int | Omit = omit, + s3_bucket_location: str | Omit = omit, + s3_host_bucket: str | Omit = omit, + sftp_key_passphrase: str | Omit = omit, + sftp_prepend_folder: str | Omit = omit, + sftp_private_key: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Setup raw logs settings + + Args: + all_resources_bucket: Name of the S3 bucket to which logs for all CDN resources are delivered. + + all_resources_folder: + Parameter meaning depends on the value of the "`storage_type`" value: + + - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for + all CDN resources are delivered. + - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for + all CDN resources are delivered. + + folders: List of folders/buckets for receiving CDN resources logs. + + for_all_resources: Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of different CDN resources are delivered to separate + folders/buckets. + + ftp_hostname: FTP storage hostname. + + ftp_login: FTP storage login. + + ftp_password: FTP storage password. + + s3_access_key_id: Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + + s3_hostname: S3 storage hostname. + + It is required if "`s3_type`": other. + + s3_secret_key: Secret access key for the S3 account. + + Secret Access Key is 20-50 alpha-numeric-slash-plus characters like + kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct + + s3_type: Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + + sftp_hostname: SFTP storage hostname. + + sftp_login: SFTP storage login. + + sftp_password: SFTP storage password. + + It should be empty if "`sftp_private_key`" is set. + + storage_type: Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + + archive_size_mb: The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + + enabled: Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + + ftp_prepend_folder: Name of the FTP prepend folder for log delivery. + + **Null** is allowed. + + ignore_empty_logs: Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + + s3_aws_region: Amazon AWS region. + + s3_bucket_location: Location of S3 storage. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores + (.:\\__-). + + s3_host_bucket: S3 bucket hostname. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + - Required if "`s3_type`": other. + + sftp_key_passphrase: Passphrase for SFTP private key. + + Restrictions: + + - Should be set if private key encoded with passphrase. + - Should be empty if "`sftp_password`" is set. + + sftp_prepend_folder: Name of the SFTP prepend folder for log delivery. + + **Null** is allowed. + + sftp_private_key: Private key for SFTP authorization. + + Possible values: + + - **RSA** + - **ED25519** + + It should be empty if "`sftp_password`" is set. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + body=await async_maybe_transform( + { + "all_resources_bucket": all_resources_bucket, + "all_resources_folder": all_resources_folder, + "folders": folders, + "for_all_resources": for_all_resources, + "ftp_hostname": ftp_hostname, + "ftp_login": ftp_login, + "ftp_password": ftp_password, + "s3_access_key_id": s3_access_key_id, + "s3_hostname": s3_hostname, + "s3_secret_key": s3_secret_key, + "s3_type": s3_type, + "sftp_hostname": sftp_hostname, + "sftp_login": sftp_login, + "sftp_password": sftp_password, + "storage_type": storage_type, + "archive_size_mb": archive_size_mb, + "enabled": enabled, + "ftp_prepend_folder": ftp_prepend_folder, + "ignore_empty_logs": ignore_empty_logs, + "s3_aws_region": s3_aws_region, + "s3_bucket_location": s3_bucket_location, + "s3_host_bucket": s3_host_bucket, + "sftp_key_passphrase": sftp_key_passphrase, + "sftp_prepend_folder": sftp_prepend_folder, + "sftp_private_key": sftp_private_key, + }, + setting_create_params.SettingCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def update( + self, + *, + all_resources_bucket: str, + all_resources_folder: str, + folders: Iterable[setting_update_params.Folder], + for_all_resources: bool, + ftp_hostname: str, + ftp_login: str, + ftp_password: str, + s3_access_key_id: str, + s3_hostname: str, + s3_secret_key: str, + s3_type: str, + sftp_hostname: str, + sftp_login: str, + sftp_password: str, + storage_type: str, + archive_size_mb: Optional[int] | Omit = omit, + enabled: bool | Omit = omit, + ftp_prepend_folder: str | Omit = omit, + ignore_empty_logs: bool | Omit = omit, + s3_aws_region: int | Omit = omit, + s3_bucket_location: str | Omit = omit, + s3_host_bucket: str | Omit = omit, + sftp_key_passphrase: str | Omit = omit, + sftp_prepend_folder: str | Omit = omit, + sftp_private_key: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + PATCH method is not allowed. + + Args: + all_resources_bucket: Name of the S3 bucket to which logs for all CDN resources are delivered. + + all_resources_folder: + Parameter meaning depends on the value of the "`storage_type`" value: + + - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for + all CDN resources are delivered. + - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for + all CDN resources are delivered. + + folders: List of folders/buckets for receiving CDN resources logs. + + for_all_resources: Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of different CDN resources are delivered to separate + folders/buckets. + + ftp_hostname: FTP storage hostname. + + ftp_login: FTP storage login. + + ftp_password: FTP storage password. + + s3_access_key_id: Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + + s3_hostname: S3 storage hostname. + + It is required if "`s3_type`": other. + + s3_secret_key: Secret access key for the S3 account. + + Secret Access Key is 20-50 alpha-numeric-slash-plus characters like + kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct + + s3_type: Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + + sftp_hostname: SFTP storage hostname. + + sftp_login: SFTP storage login. + + sftp_password: SFTP storage password. + + It should be empty if "`sftp_private_key`" is set. + + storage_type: Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + + archive_size_mb: The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + + enabled: Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + + ftp_prepend_folder: Name of the FTP prepend folder for log delivery. + + **Null** is allowed. + + ignore_empty_logs: Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + + s3_aws_region: Amazon AWS region. + + s3_bucket_location: Location of S3 storage. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores + (.:\\__-). + + s3_host_bucket: S3 bucket hostname. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + - Required if "`s3_type`": other. + + sftp_key_passphrase: Passphrase for SFTP private key. + + Restrictions: + + - Should be set if private key encoded with passphrase. + - Should be empty if "`sftp_password`" is set. + + sftp_prepend_folder: Name of the SFTP prepend folder for log delivery. + + **Null** is allowed. + + sftp_private_key: Private key for SFTP authorization. + + Possible values: + + - **RSA** + - **ED25519** + + It should be empty if "`sftp_password`" is set. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._put( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + body=await async_maybe_transform( + { + "all_resources_bucket": all_resources_bucket, + "all_resources_folder": all_resources_folder, + "folders": folders, + "for_all_resources": for_all_resources, + "ftp_hostname": ftp_hostname, + "ftp_login": ftp_login, + "ftp_password": ftp_password, + "s3_access_key_id": s3_access_key_id, + "s3_hostname": s3_hostname, + "s3_secret_key": s3_secret_key, + "s3_type": s3_type, + "sftp_hostname": sftp_hostname, + "sftp_login": sftp_login, + "sftp_password": sftp_password, + "storage_type": storage_type, + "archive_size_mb": archive_size_mb, + "enabled": enabled, + "ftp_prepend_folder": ftp_prepend_folder, + "ignore_empty_logs": ignore_empty_logs, + "s3_aws_region": s3_aws_region, + "s3_bucket_location": s3_bucket_location, + "s3_host_bucket": s3_host_bucket, + "sftp_key_passphrase": sftp_key_passphrase, + "sftp_prepend_folder": sftp_prepend_folder, + "sftp_private_key": sftp_private_key, + }, + setting_update_params.SettingUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def delete( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete the raw logs delivery configuration from the system permanently. + + Notes: + + - **Deactivation Requirement**: Set the `enabled` attribute to `false` before + deletion. + - **Irreversibility**: This action is irreversible. Once deleted, the raw logs + delivery configuration cannot be recovered. + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogSettings: + """Get information about raw logs feature settings.""" + return await self._get( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogSettings, + ) + + +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings + + self.create = to_raw_response_wrapper( + settings.create, + ) + self.update = to_raw_response_wrapper( + settings.update, + ) + self.delete = to_raw_response_wrapper( + settings.delete, + ) + self.get = to_raw_response_wrapper( + settings.get, + ) + + +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings + + self.create = async_to_raw_response_wrapper( + settings.create, + ) + self.update = async_to_raw_response_wrapper( + settings.update, + ) + self.delete = async_to_raw_response_wrapper( + settings.delete, + ) + self.get = async_to_raw_response_wrapper( + settings.get, + ) + + +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings + + self.create = to_streamed_response_wrapper( + settings.create, + ) + self.update = to_streamed_response_wrapper( + settings.update, + ) + self.delete = to_streamed_response_wrapper( + settings.delete, + ) + self.get = to_streamed_response_wrapper( + settings.get, + ) + + +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings + + self.create = async_to_streamed_response_wrapper( + settings.create, + ) + self.update = async_to_streamed_response_wrapper( + settings.update, + ) + self.delete = async_to_streamed_response_wrapper( + settings.delete, + ) + self.get = async_to_streamed_response_wrapper( + settings.get, + ) diff --git a/src/gcore/resources/cdn/logs_uploader/__init__.py b/src/gcore/resources/cdn/logs_uploader/__init__.py new file mode 100644 index 00000000..d5c0911f --- /dev/null +++ b/src/gcore/resources/cdn/logs_uploader/__init__.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .configs import ( + ConfigsResource, + AsyncConfigsResource, + ConfigsResourceWithRawResponse, + AsyncConfigsResourceWithRawResponse, + ConfigsResourceWithStreamingResponse, + AsyncConfigsResourceWithStreamingResponse, +) +from .targets import ( + TargetsResource, + AsyncTargetsResource, + TargetsResourceWithRawResponse, + AsyncTargetsResourceWithRawResponse, + TargetsResourceWithStreamingResponse, + AsyncTargetsResourceWithStreamingResponse, +) +from .policies import ( + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, +) +from .logs_uploader import ( + LogsUploaderResource, + AsyncLogsUploaderResource, + LogsUploaderResourceWithRawResponse, + AsyncLogsUploaderResourceWithRawResponse, + LogsUploaderResourceWithStreamingResponse, + AsyncLogsUploaderResourceWithStreamingResponse, +) + +__all__ = [ + "PoliciesResource", + "AsyncPoliciesResource", + "PoliciesResourceWithRawResponse", + "AsyncPoliciesResourceWithRawResponse", + "PoliciesResourceWithStreamingResponse", + "AsyncPoliciesResourceWithStreamingResponse", + "TargetsResource", + "AsyncTargetsResource", + "TargetsResourceWithRawResponse", + "AsyncTargetsResourceWithRawResponse", + "TargetsResourceWithStreamingResponse", + "AsyncTargetsResourceWithStreamingResponse", + "ConfigsResource", + "AsyncConfigsResource", + "ConfigsResourceWithRawResponse", + "AsyncConfigsResourceWithRawResponse", + "ConfigsResourceWithStreamingResponse", + "AsyncConfigsResourceWithStreamingResponse", + "LogsUploaderResource", + "AsyncLogsUploaderResource", + "LogsUploaderResourceWithRawResponse", + "AsyncLogsUploaderResourceWithRawResponse", + "LogsUploaderResourceWithStreamingResponse", + "AsyncLogsUploaderResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cdn/logs_uploader/configs.py b/src/gcore/resources/cdn/logs_uploader/configs.py new file mode 100644 index 00000000..34dfc89b --- /dev/null +++ b/src/gcore/resources/cdn/logs_uploader/configs.py @@ -0,0 +1,868 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable + +import httpx + +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cdn.logs_uploader import ( + config_list_params, + config_create_params, + config_update_params, + config_replace_params, +) +from ....types.cdn.logs_uploader_validation import LogsUploaderValidation +from ....types.cdn.logs_uploader.logs_uploader_config import LogsUploaderConfig +from ....types.cdn.logs_uploader.logs_uploader_config_list import LogsUploaderConfigList + +__all__ = ["ConfigsResource", "AsyncConfigsResource"] + + +class ConfigsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ConfigsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return ConfigsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ConfigsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return ConfigsResourceWithStreamingResponse(self) + + def create( + self, + *, + name: str, + policy: int, + target: int, + enabled: bool | Omit = omit, + for_all_resources: bool | Omit = omit, + resources: Iterable[int] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderConfig: + """ + Create logs uploader config. + + Args: + name: Name of the config. + + policy: ID of the policy that should be assigned to given config. + + target: ID of the target to which logs should be uploaded. + + enabled: Enables or disables the config. + + for_all_resources: If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + + resources: List of resource IDs to which the config should be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/cdn/logs_uploader/configs" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/configs", + body=maybe_transform( + { + "name": name, + "policy": policy, + "target": target, + "enabled": enabled, + "for_all_resources": for_all_resources, + "resources": resources, + }, + config_create_params.ConfigCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + def update( + self, + id: int, + *, + enabled: bool | Omit = omit, + for_all_resources: bool | Omit = omit, + name: str | Omit = omit, + policy: int | Omit = omit, + resources: Iterable[int] | Omit = omit, + target: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderConfig: + """ + Change logs uploader config partially. + + Args: + enabled: Enables or disables the config. + + for_all_resources: If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + + name: Name of the config. + + policy: ID of the policy that should be assigned to given config. + + resources: List of resource IDs to which the config should be applied. + + target: ID of the target to which logs should be uploaded. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + body=maybe_transform( + { + "enabled": enabled, + "for_all_resources": for_all_resources, + "name": name, + "policy": policy, + "resources": resources, + "target": target, + }, + config_update_params.ConfigUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + def list( + self, + *, + resource_ids: Iterable[int] | Omit = omit, + search: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderConfigList: + """ + Get list of logs uploader configs. + + Args: + resource_ids: Filter by ids of CDN resources that are assigned to given config. + + search: Search by config name or id. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/logs_uploader/configs" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/configs", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "resource_ids": resource_ids, + "search": search, + }, + config_list_params.ConfigListParams, + ), + ), + cast_to=LogsUploaderConfigList, + ) + + def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete the logs uploader config from the system permanently. + + Notes: + + - **Irreversibility**: This action is irreversible. Once deleted, the logs + uploader config cannot be recovered. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderConfig: + """ + Get information about logs uploader config. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + def replace( + self, + id: int, + *, + name: str, + policy: int, + target: int, + enabled: bool | Omit = omit, + for_all_resources: bool | Omit = omit, + resources: Iterable[int] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderConfig: + """ + Change logs uploader config. + + Args: + name: Name of the config. + + policy: ID of the policy that should be assigned to given config. + + target: ID of the target to which logs should be uploaded. + + enabled: Enables or disables the config. + + for_all_resources: If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + + resources: List of resource IDs to which the config should be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + body=maybe_transform( + { + "name": name, + "policy": policy, + "target": target, + "enabled": enabled, + "for_all_resources": for_all_resources, + "resources": resources, + }, + config_replace_params.ConfigReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + def validate( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderValidation: + """ + Validate logs uploader config. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/cdn/logs_uploader/configs/{id}/validate" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}/validate", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderValidation, + ) + + +class AsyncConfigsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncConfigsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncConfigsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncConfigsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncConfigsResourceWithStreamingResponse(self) + + async def create( + self, + *, + name: str, + policy: int, + target: int, + enabled: bool | Omit = omit, + for_all_resources: bool | Omit = omit, + resources: Iterable[int] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderConfig: + """ + Create logs uploader config. + + Args: + name: Name of the config. + + policy: ID of the policy that should be assigned to given config. + + target: ID of the target to which logs should be uploaded. + + enabled: Enables or disables the config. + + for_all_resources: If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + + resources: List of resource IDs to which the config should be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/cdn/logs_uploader/configs" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/configs", + body=await async_maybe_transform( + { + "name": name, + "policy": policy, + "target": target, + "enabled": enabled, + "for_all_resources": for_all_resources, + "resources": resources, + }, + config_create_params.ConfigCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + async def update( + self, + id: int, + *, + enabled: bool | Omit = omit, + for_all_resources: bool | Omit = omit, + name: str | Omit = omit, + policy: int | Omit = omit, + resources: Iterable[int] | Omit = omit, + target: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderConfig: + """ + Change logs uploader config partially. + + Args: + enabled: Enables or disables the config. + + for_all_resources: If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + + name: Name of the config. + + policy: ID of the policy that should be assigned to given config. + + resources: List of resource IDs to which the config should be applied. + + target: ID of the target to which logs should be uploaded. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + body=await async_maybe_transform( + { + "enabled": enabled, + "for_all_resources": for_all_resources, + "name": name, + "policy": policy, + "resources": resources, + "target": target, + }, + config_update_params.ConfigUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + async def list( + self, + *, + resource_ids: Iterable[int] | Omit = omit, + search: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderConfigList: + """ + Get list of logs uploader configs. + + Args: + resource_ids: Filter by ids of CDN resources that are assigned to given config. + + search: Search by config name or id. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/logs_uploader/configs" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/configs", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "resource_ids": resource_ids, + "search": search, + }, + config_list_params.ConfigListParams, + ), + ), + cast_to=LogsUploaderConfigList, + ) + + async def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete the logs uploader config from the system permanently. + + Notes: + + - **Irreversibility**: This action is irreversible. Once deleted, the logs + uploader config cannot be recovered. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderConfig: + """ + Get information about logs uploader config. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + async def replace( + self, + id: int, + *, + name: str, + policy: int, + target: int, + enabled: bool | Omit = omit, + for_all_resources: bool | Omit = omit, + resources: Iterable[int] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderConfig: + """ + Change logs uploader config. + + Args: + name: Name of the config. + + policy: ID of the policy that should be assigned to given config. + + target: ID of the target to which logs should be uploaded. + + enabled: Enables or disables the config. + + for_all_resources: If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + + resources: List of resource IDs to which the config should be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + body=await async_maybe_transform( + { + "name": name, + "policy": policy, + "target": target, + "enabled": enabled, + "for_all_resources": for_all_resources, + "resources": resources, + }, + config_replace_params.ConfigReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + async def validate( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderValidation: + """ + Validate logs uploader config. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/cdn/logs_uploader/configs/{id}/validate" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}/validate", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderValidation, + ) + + +class ConfigsResourceWithRawResponse: + def __init__(self, configs: ConfigsResource) -> None: + self._configs = configs + + self.create = to_raw_response_wrapper( + configs.create, + ) + self.update = to_raw_response_wrapper( + configs.update, + ) + self.list = to_raw_response_wrapper( + configs.list, + ) + self.delete = to_raw_response_wrapper( + configs.delete, + ) + self.get = to_raw_response_wrapper( + configs.get, + ) + self.replace = to_raw_response_wrapper( + configs.replace, + ) + self.validate = to_raw_response_wrapper( + configs.validate, + ) + + +class AsyncConfigsResourceWithRawResponse: + def __init__(self, configs: AsyncConfigsResource) -> None: + self._configs = configs + + self.create = async_to_raw_response_wrapper( + configs.create, + ) + self.update = async_to_raw_response_wrapper( + configs.update, + ) + self.list = async_to_raw_response_wrapper( + configs.list, + ) + self.delete = async_to_raw_response_wrapper( + configs.delete, + ) + self.get = async_to_raw_response_wrapper( + configs.get, + ) + self.replace = async_to_raw_response_wrapper( + configs.replace, + ) + self.validate = async_to_raw_response_wrapper( + configs.validate, + ) + + +class ConfigsResourceWithStreamingResponse: + def __init__(self, configs: ConfigsResource) -> None: + self._configs = configs + + self.create = to_streamed_response_wrapper( + configs.create, + ) + self.update = to_streamed_response_wrapper( + configs.update, + ) + self.list = to_streamed_response_wrapper( + configs.list, + ) + self.delete = to_streamed_response_wrapper( + configs.delete, + ) + self.get = to_streamed_response_wrapper( + configs.get, + ) + self.replace = to_streamed_response_wrapper( + configs.replace, + ) + self.validate = to_streamed_response_wrapper( + configs.validate, + ) + + +class AsyncConfigsResourceWithStreamingResponse: + def __init__(self, configs: AsyncConfigsResource) -> None: + self._configs = configs + + self.create = async_to_streamed_response_wrapper( + configs.create, + ) + self.update = async_to_streamed_response_wrapper( + configs.update, + ) + self.list = async_to_streamed_response_wrapper( + configs.list, + ) + self.delete = async_to_streamed_response_wrapper( + configs.delete, + ) + self.get = async_to_streamed_response_wrapper( + configs.get, + ) + self.replace = async_to_streamed_response_wrapper( + configs.replace, + ) + self.validate = async_to_streamed_response_wrapper( + configs.validate, + ) diff --git a/src/gcore/resources/cdn/logs_uploader/logs_uploader.py b/src/gcore/resources/cdn/logs_uploader/logs_uploader.py new file mode 100644 index 00000000..9d7c3aeb --- /dev/null +++ b/src/gcore/resources/cdn/logs_uploader/logs_uploader.py @@ -0,0 +1,166 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .configs import ( + ConfigsResource, + AsyncConfigsResource, + ConfigsResourceWithRawResponse, + AsyncConfigsResourceWithRawResponse, + ConfigsResourceWithStreamingResponse, + AsyncConfigsResourceWithStreamingResponse, +) +from .targets import ( + TargetsResource, + AsyncTargetsResource, + TargetsResourceWithRawResponse, + AsyncTargetsResourceWithRawResponse, + TargetsResourceWithStreamingResponse, + AsyncTargetsResourceWithStreamingResponse, +) +from .policies import ( + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["LogsUploaderResource", "AsyncLogsUploaderResource"] + + +class LogsUploaderResource(SyncAPIResource): + @cached_property + def policies(self) -> PoliciesResource: + return PoliciesResource(self._client) + + @cached_property + def targets(self) -> TargetsResource: + return TargetsResource(self._client) + + @cached_property + def configs(self) -> ConfigsResource: + return ConfigsResource(self._client) + + @cached_property + def with_raw_response(self) -> LogsUploaderResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return LogsUploaderResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LogsUploaderResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return LogsUploaderResourceWithStreamingResponse(self) + + +class AsyncLogsUploaderResource(AsyncAPIResource): + @cached_property + def policies(self) -> AsyncPoliciesResource: + return AsyncPoliciesResource(self._client) + + @cached_property + def targets(self) -> AsyncTargetsResource: + return AsyncTargetsResource(self._client) + + @cached_property + def configs(self) -> AsyncConfigsResource: + return AsyncConfigsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncLogsUploaderResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncLogsUploaderResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLogsUploaderResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncLogsUploaderResourceWithStreamingResponse(self) + + +class LogsUploaderResourceWithRawResponse: + def __init__(self, logs_uploader: LogsUploaderResource) -> None: + self._logs_uploader = logs_uploader + + @cached_property + def policies(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self._logs_uploader.policies) + + @cached_property + def targets(self) -> TargetsResourceWithRawResponse: + return TargetsResourceWithRawResponse(self._logs_uploader.targets) + + @cached_property + def configs(self) -> ConfigsResourceWithRawResponse: + return ConfigsResourceWithRawResponse(self._logs_uploader.configs) + + +class AsyncLogsUploaderResourceWithRawResponse: + def __init__(self, logs_uploader: AsyncLogsUploaderResource) -> None: + self._logs_uploader = logs_uploader + + @cached_property + def policies(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self._logs_uploader.policies) + + @cached_property + def targets(self) -> AsyncTargetsResourceWithRawResponse: + return AsyncTargetsResourceWithRawResponse(self._logs_uploader.targets) + + @cached_property + def configs(self) -> AsyncConfigsResourceWithRawResponse: + return AsyncConfigsResourceWithRawResponse(self._logs_uploader.configs) + + +class LogsUploaderResourceWithStreamingResponse: + def __init__(self, logs_uploader: LogsUploaderResource) -> None: + self._logs_uploader = logs_uploader + + @cached_property + def policies(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self._logs_uploader.policies) + + @cached_property + def targets(self) -> TargetsResourceWithStreamingResponse: + return TargetsResourceWithStreamingResponse(self._logs_uploader.targets) + + @cached_property + def configs(self) -> ConfigsResourceWithStreamingResponse: + return ConfigsResourceWithStreamingResponse(self._logs_uploader.configs) + + +class AsyncLogsUploaderResourceWithStreamingResponse: + def __init__(self, logs_uploader: AsyncLogsUploaderResource) -> None: + self._logs_uploader = logs_uploader + + @cached_property + def policies(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self._logs_uploader.policies) + + @cached_property + def targets(self) -> AsyncTargetsResourceWithStreamingResponse: + return AsyncTargetsResourceWithStreamingResponse(self._logs_uploader.targets) + + @cached_property + def configs(self) -> AsyncConfigsResourceWithStreamingResponse: + return AsyncConfigsResourceWithStreamingResponse(self._logs_uploader.configs) diff --git a/src/gcore/resources/cdn/logs_uploader/policies.py b/src/gcore/resources/cdn/logs_uploader/policies.py new file mode 100644 index 00000000..141db85a --- /dev/null +++ b/src/gcore/resources/cdn/logs_uploader/policies.py @@ -0,0 +1,1060 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable, Optional + +import httpx + +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cdn.logs_uploader import ( + policy_list_params, + policy_create_params, + policy_update_params, + policy_replace_params, +) +from ....types.cdn.logs_uploader.logs_uploader_policy import LogsUploaderPolicy +from ....types.cdn.logs_uploader.logs_uploader_policy_list import LogsUploaderPolicyList +from ....types.cdn.logs_uploader.policy_list_fields_response import PolicyListFieldsResponse + +__all__ = ["PoliciesResource", "AsyncPoliciesResource"] + + +class PoliciesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PoliciesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return PoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return PoliciesResourceWithStreamingResponse(self) + + def create( + self, + *, + date_format: str | Omit = omit, + description: str | Omit = omit, + field_delimiter: str | Omit = omit, + field_separator: str | Omit = omit, + fields: SequenceNotStr[str] | Omit = omit, + file_name_template: str | Omit = omit, + format_type: str | Omit = omit, + include_empty_logs: bool | Omit = omit, + include_shield_logs: bool | Omit = omit, + name: str | Omit = omit, + retry_interval_minutes: int | Omit = omit, + rotate_interval_minutes: int | Omit = omit, + rotate_threshold_lines: int | Omit = omit, + rotate_threshold_mb: Optional[int] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Create logs uploader policy. + + Args: + date_format: Date format for logs. + + description: Description of the policy. + + field_delimiter: Field delimiter for logs. + + field_separator: Field separator for logs. + + fields: List of fields to include in logs. + + file_name_template: Template for log file name. + + format_type: Format type for logs. + + include_empty_logs: Include empty logs in the upload. + + include_shield_logs: Include logs from origin shielding in the upload. + + name: Name of the policy. + + retry_interval_minutes: Interval in minutes to retry failed uploads. + + rotate_interval_minutes: Interval in minutes to rotate logs. + + rotate_threshold_lines: Threshold in lines to rotate logs. + + rotate_threshold_mb: Threshold in MB to rotate logs. + + tags: Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/cdn/logs_uploader/policies" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/policies", + body=maybe_transform( + { + "date_format": date_format, + "description": description, + "field_delimiter": field_delimiter, + "field_separator": field_separator, + "fields": fields, + "file_name_template": file_name_template, + "format_type": format_type, + "include_empty_logs": include_empty_logs, + "include_shield_logs": include_shield_logs, + "name": name, + "retry_interval_minutes": retry_interval_minutes, + "rotate_interval_minutes": rotate_interval_minutes, + "rotate_threshold_lines": rotate_threshold_lines, + "rotate_threshold_mb": rotate_threshold_mb, + "tags": tags, + }, + policy_create_params.PolicyCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + def update( + self, + id: int, + *, + date_format: str | Omit = omit, + description: str | Omit = omit, + field_delimiter: str | Omit = omit, + field_separator: str | Omit = omit, + fields: SequenceNotStr[str] | Omit = omit, + file_name_template: str | Omit = omit, + format_type: str | Omit = omit, + include_empty_logs: bool | Omit = omit, + include_shield_logs: bool | Omit = omit, + name: str | Omit = omit, + retry_interval_minutes: int | Omit = omit, + rotate_interval_minutes: int | Omit = omit, + rotate_threshold_lines: int | Omit = omit, + rotate_threshold_mb: Optional[int] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Change logs uploader policy partially. + + Args: + date_format: Date format for logs. + + description: Description of the policy. + + field_delimiter: Field delimiter for logs. + + field_separator: Field separator for logs. + + fields: List of fields to include in logs. + + file_name_template: Template for log file name. + + format_type: Format type for logs. + + include_empty_logs: Include empty logs in the upload. + + include_shield_logs: Include logs from origin shielding in the upload. + + name: Name of the policy. + + retry_interval_minutes: Interval in minutes to retry failed uploads. + + rotate_interval_minutes: Interval in minutes to rotate logs. + + rotate_threshold_lines: Threshold in lines to rotate logs. + + rotate_threshold_mb: Threshold in MB to rotate logs. + + tags: Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + body=maybe_transform( + { + "date_format": date_format, + "description": description, + "field_delimiter": field_delimiter, + "field_separator": field_separator, + "fields": fields, + "file_name_template": file_name_template, + "format_type": format_type, + "include_empty_logs": include_empty_logs, + "include_shield_logs": include_shield_logs, + "name": name, + "retry_interval_minutes": retry_interval_minutes, + "rotate_interval_minutes": rotate_interval_minutes, + "rotate_threshold_lines": rotate_threshold_lines, + "rotate_threshold_mb": rotate_threshold_mb, + "tags": tags, + }, + policy_update_params.PolicyUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + def list( + self, + *, + config_ids: Iterable[int] | Omit = omit, + search: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicyList: + """ + Get list of logs uploader policies. + + Args: + config_ids: Filter by ids of related logs uploader configs that use given policy. + + search: Search by policy name or id. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/logs_uploader/policies" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/policies", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "config_ids": config_ids, + "search": search, + }, + policy_list_params.PolicyListParams, + ), + ), + cast_to=LogsUploaderPolicyList, + ) + + def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete the logs uploader policy from the system permanently. + + Notes: + + - **Irreversibility**: This action is irreversible. Once deleted, the logs + uploader policy cannot be recovered. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Get information about logs uploader policy. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + def list_fields( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PolicyListFieldsResponse: + """Get list of available fields for logs uploader policy.""" + return self._get( + "/cdn/logs_uploader/policies/fields" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/policies/fields", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PolicyListFieldsResponse, + ) + + def replace( + self, + id: int, + *, + date_format: str | Omit = omit, + description: str | Omit = omit, + field_delimiter: str | Omit = omit, + field_separator: str | Omit = omit, + fields: SequenceNotStr[str] | Omit = omit, + file_name_template: str | Omit = omit, + format_type: str | Omit = omit, + include_empty_logs: bool | Omit = omit, + include_shield_logs: bool | Omit = omit, + name: str | Omit = omit, + retry_interval_minutes: int | Omit = omit, + rotate_interval_minutes: int | Omit = omit, + rotate_threshold_lines: int | Omit = omit, + rotate_threshold_mb: Optional[int] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Change logs uploader policy. + + Args: + date_format: Date format for logs. + + description: Description of the policy. + + field_delimiter: Field delimiter for logs. + + field_separator: Field separator for logs. + + fields: List of fields to include in logs. + + file_name_template: Template for log file name. + + format_type: Format type for logs. + + include_empty_logs: Include empty logs in the upload. + + include_shield_logs: Include logs from origin shielding in the upload. + + name: Name of the policy. + + retry_interval_minutes: Interval in minutes to retry failed uploads. + + rotate_interval_minutes: Interval in minutes to rotate logs. + + rotate_threshold_lines: Threshold in lines to rotate logs. + + rotate_threshold_mb: Threshold in MB to rotate logs. + + tags: Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + body=maybe_transform( + { + "date_format": date_format, + "description": description, + "field_delimiter": field_delimiter, + "field_separator": field_separator, + "fields": fields, + "file_name_template": file_name_template, + "format_type": format_type, + "include_empty_logs": include_empty_logs, + "include_shield_logs": include_shield_logs, + "name": name, + "retry_interval_minutes": retry_interval_minutes, + "rotate_interval_minutes": rotate_interval_minutes, + "rotate_threshold_lines": rotate_threshold_lines, + "rotate_threshold_mb": rotate_threshold_mb, + "tags": tags, + }, + policy_replace_params.PolicyReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + +class AsyncPoliciesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncPoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncPoliciesResourceWithStreamingResponse(self) + + async def create( + self, + *, + date_format: str | Omit = omit, + description: str | Omit = omit, + field_delimiter: str | Omit = omit, + field_separator: str | Omit = omit, + fields: SequenceNotStr[str] | Omit = omit, + file_name_template: str | Omit = omit, + format_type: str | Omit = omit, + include_empty_logs: bool | Omit = omit, + include_shield_logs: bool | Omit = omit, + name: str | Omit = omit, + retry_interval_minutes: int | Omit = omit, + rotate_interval_minutes: int | Omit = omit, + rotate_threshold_lines: int | Omit = omit, + rotate_threshold_mb: Optional[int] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Create logs uploader policy. + + Args: + date_format: Date format for logs. + + description: Description of the policy. + + field_delimiter: Field delimiter for logs. + + field_separator: Field separator for logs. + + fields: List of fields to include in logs. + + file_name_template: Template for log file name. + + format_type: Format type for logs. + + include_empty_logs: Include empty logs in the upload. + + include_shield_logs: Include logs from origin shielding in the upload. + + name: Name of the policy. + + retry_interval_minutes: Interval in minutes to retry failed uploads. + + rotate_interval_minutes: Interval in minutes to rotate logs. + + rotate_threshold_lines: Threshold in lines to rotate logs. + + rotate_threshold_mb: Threshold in MB to rotate logs. + + tags: Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/cdn/logs_uploader/policies" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/policies", + body=await async_maybe_transform( + { + "date_format": date_format, + "description": description, + "field_delimiter": field_delimiter, + "field_separator": field_separator, + "fields": fields, + "file_name_template": file_name_template, + "format_type": format_type, + "include_empty_logs": include_empty_logs, + "include_shield_logs": include_shield_logs, + "name": name, + "retry_interval_minutes": retry_interval_minutes, + "rotate_interval_minutes": rotate_interval_minutes, + "rotate_threshold_lines": rotate_threshold_lines, + "rotate_threshold_mb": rotate_threshold_mb, + "tags": tags, + }, + policy_create_params.PolicyCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + async def update( + self, + id: int, + *, + date_format: str | Omit = omit, + description: str | Omit = omit, + field_delimiter: str | Omit = omit, + field_separator: str | Omit = omit, + fields: SequenceNotStr[str] | Omit = omit, + file_name_template: str | Omit = omit, + format_type: str | Omit = omit, + include_empty_logs: bool | Omit = omit, + include_shield_logs: bool | Omit = omit, + name: str | Omit = omit, + retry_interval_minutes: int | Omit = omit, + rotate_interval_minutes: int | Omit = omit, + rotate_threshold_lines: int | Omit = omit, + rotate_threshold_mb: Optional[int] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Change logs uploader policy partially. + + Args: + date_format: Date format for logs. + + description: Description of the policy. + + field_delimiter: Field delimiter for logs. + + field_separator: Field separator for logs. + + fields: List of fields to include in logs. + + file_name_template: Template for log file name. + + format_type: Format type for logs. + + include_empty_logs: Include empty logs in the upload. + + include_shield_logs: Include logs from origin shielding in the upload. + + name: Name of the policy. + + retry_interval_minutes: Interval in minutes to retry failed uploads. + + rotate_interval_minutes: Interval in minutes to rotate logs. + + rotate_threshold_lines: Threshold in lines to rotate logs. + + rotate_threshold_mb: Threshold in MB to rotate logs. + + tags: Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + body=await async_maybe_transform( + { + "date_format": date_format, + "description": description, + "field_delimiter": field_delimiter, + "field_separator": field_separator, + "fields": fields, + "file_name_template": file_name_template, + "format_type": format_type, + "include_empty_logs": include_empty_logs, + "include_shield_logs": include_shield_logs, + "name": name, + "retry_interval_minutes": retry_interval_minutes, + "rotate_interval_minutes": rotate_interval_minutes, + "rotate_threshold_lines": rotate_threshold_lines, + "rotate_threshold_mb": rotate_threshold_mb, + "tags": tags, + }, + policy_update_params.PolicyUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + async def list( + self, + *, + config_ids: Iterable[int] | Omit = omit, + search: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicyList: + """ + Get list of logs uploader policies. + + Args: + config_ids: Filter by ids of related logs uploader configs that use given policy. + + search: Search by policy name or id. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/logs_uploader/policies" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/policies", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "config_ids": config_ids, + "search": search, + }, + policy_list_params.PolicyListParams, + ), + ), + cast_to=LogsUploaderPolicyList, + ) + + async def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete the logs uploader policy from the system permanently. + + Notes: + + - **Irreversibility**: This action is irreversible. Once deleted, the logs + uploader policy cannot be recovered. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Get information about logs uploader policy. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + async def list_fields( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PolicyListFieldsResponse: + """Get list of available fields for logs uploader policy.""" + return await self._get( + "/cdn/logs_uploader/policies/fields" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/policies/fields", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PolicyListFieldsResponse, + ) + + async def replace( + self, + id: int, + *, + date_format: str | Omit = omit, + description: str | Omit = omit, + field_delimiter: str | Omit = omit, + field_separator: str | Omit = omit, + fields: SequenceNotStr[str] | Omit = omit, + file_name_template: str | Omit = omit, + format_type: str | Omit = omit, + include_empty_logs: bool | Omit = omit, + include_shield_logs: bool | Omit = omit, + name: str | Omit = omit, + retry_interval_minutes: int | Omit = omit, + rotate_interval_minutes: int | Omit = omit, + rotate_threshold_lines: int | Omit = omit, + rotate_threshold_mb: Optional[int] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Change logs uploader policy. + + Args: + date_format: Date format for logs. + + description: Description of the policy. + + field_delimiter: Field delimiter for logs. + + field_separator: Field separator for logs. + + fields: List of fields to include in logs. + + file_name_template: Template for log file name. + + format_type: Format type for logs. + + include_empty_logs: Include empty logs in the upload. + + include_shield_logs: Include logs from origin shielding in the upload. + + name: Name of the policy. + + retry_interval_minutes: Interval in minutes to retry failed uploads. + + rotate_interval_minutes: Interval in minutes to rotate logs. + + rotate_threshold_lines: Threshold in lines to rotate logs. + + rotate_threshold_mb: Threshold in MB to rotate logs. + + tags: Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + body=await async_maybe_transform( + { + "date_format": date_format, + "description": description, + "field_delimiter": field_delimiter, + "field_separator": field_separator, + "fields": fields, + "file_name_template": file_name_template, + "format_type": format_type, + "include_empty_logs": include_empty_logs, + "include_shield_logs": include_shield_logs, + "name": name, + "retry_interval_minutes": retry_interval_minutes, + "rotate_interval_minutes": rotate_interval_minutes, + "rotate_threshold_lines": rotate_threshold_lines, + "rotate_threshold_mb": rotate_threshold_mb, + "tags": tags, + }, + policy_replace_params.PolicyReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + +class PoliciesResourceWithRawResponse: + def __init__(self, policies: PoliciesResource) -> None: + self._policies = policies + + self.create = to_raw_response_wrapper( + policies.create, + ) + self.update = to_raw_response_wrapper( + policies.update, + ) + self.list = to_raw_response_wrapper( + policies.list, + ) + self.delete = to_raw_response_wrapper( + policies.delete, + ) + self.get = to_raw_response_wrapper( + policies.get, + ) + self.list_fields = to_raw_response_wrapper( + policies.list_fields, + ) + self.replace = to_raw_response_wrapper( + policies.replace, + ) + + +class AsyncPoliciesResourceWithRawResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: + self._policies = policies + + self.create = async_to_raw_response_wrapper( + policies.create, + ) + self.update = async_to_raw_response_wrapper( + policies.update, + ) + self.list = async_to_raw_response_wrapper( + policies.list, + ) + self.delete = async_to_raw_response_wrapper( + policies.delete, + ) + self.get = async_to_raw_response_wrapper( + policies.get, + ) + self.list_fields = async_to_raw_response_wrapper( + policies.list_fields, + ) + self.replace = async_to_raw_response_wrapper( + policies.replace, + ) + + +class PoliciesResourceWithStreamingResponse: + def __init__(self, policies: PoliciesResource) -> None: + self._policies = policies + + self.create = to_streamed_response_wrapper( + policies.create, + ) + self.update = to_streamed_response_wrapper( + policies.update, + ) + self.list = to_streamed_response_wrapper( + policies.list, + ) + self.delete = to_streamed_response_wrapper( + policies.delete, + ) + self.get = to_streamed_response_wrapper( + policies.get, + ) + self.list_fields = to_streamed_response_wrapper( + policies.list_fields, + ) + self.replace = to_streamed_response_wrapper( + policies.replace, + ) + + +class AsyncPoliciesResourceWithStreamingResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: + self._policies = policies + + self.create = async_to_streamed_response_wrapper( + policies.create, + ) + self.update = async_to_streamed_response_wrapper( + policies.update, + ) + self.list = async_to_streamed_response_wrapper( + policies.list, + ) + self.delete = async_to_streamed_response_wrapper( + policies.delete, + ) + self.get = async_to_streamed_response_wrapper( + policies.get, + ) + self.list_fields = async_to_streamed_response_wrapper( + policies.list_fields, + ) + self.replace = async_to_streamed_response_wrapper( + policies.replace, + ) diff --git a/src/gcore/resources/cdn/logs_uploader/targets.py b/src/gcore/resources/cdn/logs_uploader/targets.py new file mode 100644 index 00000000..1b5b90fa --- /dev/null +++ b/src/gcore/resources/cdn/logs_uploader/targets.py @@ -0,0 +1,811 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal + +import httpx + +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cdn.logs_uploader import ( + target_list_params, + target_create_params, + target_update_params, + target_replace_params, +) +from ....types.cdn.logs_uploader_validation import LogsUploaderValidation +from ....types.cdn.logs_uploader.logs_uploader_target import LogsUploaderTarget +from ....types.cdn.logs_uploader.logs_uploader_target_list import LogsUploaderTargetList + +__all__ = ["TargetsResource", "AsyncTargetsResource"] + + +class TargetsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TargetsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return TargetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TargetsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return TargetsResourceWithStreamingResponse(self) + + def create( + self, + *, + config: target_create_params.Config, + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"], + description: str | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderTarget: + """ + Create logs uploader target. + + Args: + config: Config for specific storage type. + + storage_type: Type of storage for logs. + + description: Description of the target. + + name: Name of the target. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/cdn/logs_uploader/targets" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/targets", + body=maybe_transform( + { + "config": config, + "storage_type": storage_type, + "description": description, + "name": name, + }, + target_create_params.TargetCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + def update( + self, + id: int, + *, + config: target_update_params.Config | Omit = omit, + description: str | Omit = omit, + name: str | Omit = omit, + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"] + | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderTarget: + """ + Change logs uploader target partially. + + Args: + config: Config for specific storage type. + + description: Description of the target. + + name: Name of the target. + + storage_type: Type of storage for logs. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + body=maybe_transform( + { + "config": config, + "description": description, + "name": name, + "storage_type": storage_type, + }, + target_update_params.TargetUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + def list( + self, + *, + config_ids: Iterable[int] | Omit = omit, + search: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderTargetList: + """ + Get list of logs uploader targets. + + Args: + config_ids: Filter by ids of related logs uploader configs that use given target. + + search: Search by target name or id. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/logs_uploader/targets" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/targets", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "config_ids": config_ids, + "search": search, + }, + target_list_params.TargetListParams, + ), + ), + cast_to=LogsUploaderTargetList, + ) + + def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete the logs uploader target from the system permanently. + + Notes: + + - **Irreversibility**: This action is irreversible. Once deleted, the logs + uploader target cannot be recovered. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderTarget: + """ + Get information about logs uploader target. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + def replace( + self, + id: int, + *, + config: target_replace_params.Config, + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"], + description: str | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderTarget: + """ + Change logs uploader target. + + Args: + config: Config for specific storage type. + + storage_type: Type of storage for logs. + + description: Description of the target. + + name: Name of the target. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + body=maybe_transform( + { + "config": config, + "storage_type": storage_type, + "description": description, + "name": name, + }, + target_replace_params.TargetReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + def validate( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderValidation: + """ + Validate logs uploader target. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/cdn/logs_uploader/targets/{id}/validate" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}/validate", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderValidation, + ) + + +class AsyncTargetsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTargetsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncTargetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTargetsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncTargetsResourceWithStreamingResponse(self) + + async def create( + self, + *, + config: target_create_params.Config, + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"], + description: str | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderTarget: + """ + Create logs uploader target. + + Args: + config: Config for specific storage type. + + storage_type: Type of storage for logs. + + description: Description of the target. + + name: Name of the target. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/cdn/logs_uploader/targets" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/targets", + body=await async_maybe_transform( + { + "config": config, + "storage_type": storage_type, + "description": description, + "name": name, + }, + target_create_params.TargetCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + async def update( + self, + id: int, + *, + config: target_update_params.Config | Omit = omit, + description: str | Omit = omit, + name: str | Omit = omit, + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"] + | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderTarget: + """ + Change logs uploader target partially. + + Args: + config: Config for specific storage type. + + description: Description of the target. + + name: Name of the target. + + storage_type: Type of storage for logs. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + body=await async_maybe_transform( + { + "config": config, + "description": description, + "name": name, + "storage_type": storage_type, + }, + target_update_params.TargetUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + async def list( + self, + *, + config_ids: Iterable[int] | Omit = omit, + search: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderTargetList: + """ + Get list of logs uploader targets. + + Args: + config_ids: Filter by ids of related logs uploader configs that use given target. + + search: Search by target name or id. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/logs_uploader/targets" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/targets", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "config_ids": config_ids, + "search": search, + }, + target_list_params.TargetListParams, + ), + ), + cast_to=LogsUploaderTargetList, + ) + + async def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete the logs uploader target from the system permanently. + + Notes: + + - **Irreversibility**: This action is irreversible. Once deleted, the logs + uploader target cannot be recovered. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderTarget: + """ + Get information about logs uploader target. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + async def replace( + self, + id: int, + *, + config: target_replace_params.Config, + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"], + description: str | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderTarget: + """ + Change logs uploader target. + + Args: + config: Config for specific storage type. + + storage_type: Type of storage for logs. + + description: Description of the target. + + name: Name of the target. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + body=await async_maybe_transform( + { + "config": config, + "storage_type": storage_type, + "description": description, + "name": name, + }, + target_replace_params.TargetReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + async def validate( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderValidation: + """ + Validate logs uploader target. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/cdn/logs_uploader/targets/{id}/validate" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}/validate", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderValidation, + ) + + +class TargetsResourceWithRawResponse: + def __init__(self, targets: TargetsResource) -> None: + self._targets = targets + + self.create = to_raw_response_wrapper( + targets.create, + ) + self.update = to_raw_response_wrapper( + targets.update, + ) + self.list = to_raw_response_wrapper( + targets.list, + ) + self.delete = to_raw_response_wrapper( + targets.delete, + ) + self.get = to_raw_response_wrapper( + targets.get, + ) + self.replace = to_raw_response_wrapper( + targets.replace, + ) + self.validate = to_raw_response_wrapper( + targets.validate, + ) + + +class AsyncTargetsResourceWithRawResponse: + def __init__(self, targets: AsyncTargetsResource) -> None: + self._targets = targets + + self.create = async_to_raw_response_wrapper( + targets.create, + ) + self.update = async_to_raw_response_wrapper( + targets.update, + ) + self.list = async_to_raw_response_wrapper( + targets.list, + ) + self.delete = async_to_raw_response_wrapper( + targets.delete, + ) + self.get = async_to_raw_response_wrapper( + targets.get, + ) + self.replace = async_to_raw_response_wrapper( + targets.replace, + ) + self.validate = async_to_raw_response_wrapper( + targets.validate, + ) + + +class TargetsResourceWithStreamingResponse: + def __init__(self, targets: TargetsResource) -> None: + self._targets = targets + + self.create = to_streamed_response_wrapper( + targets.create, + ) + self.update = to_streamed_response_wrapper( + targets.update, + ) + self.list = to_streamed_response_wrapper( + targets.list, + ) + self.delete = to_streamed_response_wrapper( + targets.delete, + ) + self.get = to_streamed_response_wrapper( + targets.get, + ) + self.replace = to_streamed_response_wrapper( + targets.replace, + ) + self.validate = to_streamed_response_wrapper( + targets.validate, + ) + + +class AsyncTargetsResourceWithStreamingResponse: + def __init__(self, targets: AsyncTargetsResource) -> None: + self._targets = targets + + self.create = async_to_streamed_response_wrapper( + targets.create, + ) + self.update = async_to_streamed_response_wrapper( + targets.update, + ) + self.list = async_to_streamed_response_wrapper( + targets.list, + ) + self.delete = async_to_streamed_response_wrapper( + targets.delete, + ) + self.get = async_to_streamed_response_wrapper( + targets.get, + ) + self.replace = async_to_streamed_response_wrapper( + targets.replace, + ) + self.validate = async_to_streamed_response_wrapper( + targets.validate, + ) diff --git a/src/gcore/resources/cdn/metrics.py b/src/gcore/resources/cdn/metrics.py new file mode 100644 index 00000000..4d32d90a --- /dev/null +++ b/src/gcore/resources/cdn/metrics.py @@ -0,0 +1,419 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import metric_list_params +from ..._base_client import make_request_options +from ...types.cdn.cdn_metrics import CdnMetrics + +__all__ = ["MetricsResource", "AsyncMetricsResource"] + + +class MetricsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> MetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return MetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return MetricsResourceWithStreamingResponse(self) + + def list( + self, + *, + from_: str, + metrics: SequenceNotStr[str], + to: str, + filter_by: Iterable[metric_list_params.FilterBy] | Omit = omit, + granularity: str | Omit = omit, + group_by: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnMetrics: + """ + Get CDN metrics + + Args: + from_: Beginning period to fetch metrics (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - 2021-06-14T00:00:00Z + - 2021-06-14T00:00:00.000Z + + The total number of points, which is determined as the difference between "from" + and "to" divided by "granularity", cannot exceed 1440. Exception: "speed" + metrics are limited to 72 points. + + metrics: + Possible values: + + - **`edge_bandwidth`** - Bandwidth from client to CDN (bit/s.) + - **`edge_requests`** - Number of requests per interval (requests/s.) + - **`edge_requests_total`** - Total number of requests per interval. + - **`edge_status_1xx`** - Number of 1xx status codes from edge. + - **`edge_status_200`** - Number of 200 status codes from edge. + - **`edge_status_204`** - Number of 204 status codes from edge. + - **`edge_status_206`** - Number of 206 status codes from edge. + - **`edge_status_2xx`** - Number of 2xx status codes from edge. + - **`edge_status_301`** - Number of 301 status codes from edge. + - **`edge_status_302`** - Number of 302 status codes from edge. + - **`edge_status_304`** - Number of 304 status codes from edge. + - **`edge_status_3xx`** - Number of 3xx status codes from edge. + - **`edge_status_400`** - Number of 400 status codes from edge. + - **`edge_status_401`** - Number of 401 status codes from edge. + - **`edge_status_403`** - Number of 403 status codes from edge. + - **`edge_status_404`** - Number of 404 status codes from edge. + - **`edge_status_416`** - Number of 416 status codes from edge. + - **`edge_status_429`** - Number of 429 status codes from edge. + - **`edge_status_4xx`** - Number of 4xx status codes from edge. + - **`edge_status_500`** - Number of 500 status codes from edge. + - **`edge_status_501`** - Number of 501 status codes from edge. + - **`edge_status_502`** - Number of 502 status codes from edge. + - **`edge_status_503`** - Number of 503 status codes from edge. + - **`edge_status_504`** - Number of 504 status codes from edge. + - **`edge_status_505`** - Number of 505 status codes from edge. + - **`edge_status_5xx`** - Number of 5xx status codes from edge. + - **`edge_hit_ratio`** - Percent of cache hits (0.0 - 1.0). + - **`edge_hit_bytes`** - Number of bytes sent back when cache hits. + - **`origin_bandwidth`** - Bandwidth from CDN to Origin (bit/s.) + - **`origin_requests`** - Number of requests per interval (requests/s.) + - **`origin_status_1xx`** - Number of 1xx status from origin. + - **`origin_status_200`** - Number of 200 status from origin. + - **`origin_status_204`** - Number of 204 status from origin. + - **`origin_status_206`** - Number of 206 status from origin. + - **`origin_status_2xx`** - Number of 2xx status from origin. + - **`origin_status_301`** - Number of 301 status from origin. + - **`origin_status_302`** - Number of 302 status from origin. + - **`origin_status_304`** - Number of 304 status from origin. + - **`origin_status_3xx`** - Number of 3xx status from origin. + - **`origin_status_400`** - Number of 400 status from origin. + - **`origin_status_401`** - Number of 401 status from origin. + - **`origin_status_403`** - Number of 403 status from origin. + - **`origin_status_404`** - Number of 404 status from origin. + - **`origin_status_416`** - Number of 416 status from origin. + - **`origin_status_429`** - Number of 426 status from origin. + - **`origin_status_4xx`** - Number of 4xx status from origin. + - **`origin_status_500`** - Number of 500 status from origin. + - **`origin_status_501`** - Number of 501 status from origin. + - **`origin_status_502`** - Number of 502 status from origin. + - **`origin_status_503`** - Number of 503 status from origin. + - **`origin_status_504`** - Number of 504 status from origin. + - **`origin_status_505`** - Number of 505 status from origin. + - **`origin_status_5xx`** - Number of 5xx status from origin. + - **`edge_download_speed`** - Download speed from edge in KB/s (includes only + requests that status was in the range [200, 300].) + - **`origin_download_speed`** - Download speed from origin in KB/s (includes + only requests that status was in the range [200, 300].) + + to: Specifies ending period to fetch metrics (ISO 8601/RFC 3339 format, UTC) + + Examples: + + - 2021-06-15T00:00:00Z + - 2021-06-15T00:00:00.000Z + + The total number of points, which is determined as the difference between "from" + and "to" divided by "granularity", cannot exceed 1440. Exception: "speed" + metrics are limited to 72 points. + + filter_by: Each item represents one filter statement. + + granularity: Duration of the time blocks into which the data is divided. The value must + correspond to the ISO 8601 period format. + + Examples: + + - P1D + - PT5M + + Notes: + + - The total number of points, which is determined as the difference between + "from" and "to" divided by "granularity", cannot exceed 1440. Exception: + "speed" metrics are limited to 72 points. + - For "speed" metrics the value must be a multiple of 5. + + group_by: Output data grouping. + + Possible values: + + - **resource** - Data is grouped by CDN resource. + - **cname** - Data is grouped by common names. + - **region** – Data is grouped by regions (continents.) Available for "speed" + metrics only. + - **isp** - Data is grouped by ISP names. Available for "speed" metrics only. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/cdn/advanced/v1/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/metrics", + body=maybe_transform( + { + "from_": from_, + "metrics": metrics, + "to": to, + "filter_by": filter_by, + "granularity": granularity, + "group_by": group_by, + }, + metric_list_params.MetricListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnMetrics, + ) + + +class AsyncMetricsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncMetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncMetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncMetricsResourceWithStreamingResponse(self) + + async def list( + self, + *, + from_: str, + metrics: SequenceNotStr[str], + to: str, + filter_by: Iterable[metric_list_params.FilterBy] | Omit = omit, + granularity: str | Omit = omit, + group_by: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnMetrics: + """ + Get CDN metrics + + Args: + from_: Beginning period to fetch metrics (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - 2021-06-14T00:00:00Z + - 2021-06-14T00:00:00.000Z + + The total number of points, which is determined as the difference between "from" + and "to" divided by "granularity", cannot exceed 1440. Exception: "speed" + metrics are limited to 72 points. + + metrics: + Possible values: + + - **`edge_bandwidth`** - Bandwidth from client to CDN (bit/s.) + - **`edge_requests`** - Number of requests per interval (requests/s.) + - **`edge_requests_total`** - Total number of requests per interval. + - **`edge_status_1xx`** - Number of 1xx status codes from edge. + - **`edge_status_200`** - Number of 200 status codes from edge. + - **`edge_status_204`** - Number of 204 status codes from edge. + - **`edge_status_206`** - Number of 206 status codes from edge. + - **`edge_status_2xx`** - Number of 2xx status codes from edge. + - **`edge_status_301`** - Number of 301 status codes from edge. + - **`edge_status_302`** - Number of 302 status codes from edge. + - **`edge_status_304`** - Number of 304 status codes from edge. + - **`edge_status_3xx`** - Number of 3xx status codes from edge. + - **`edge_status_400`** - Number of 400 status codes from edge. + - **`edge_status_401`** - Number of 401 status codes from edge. + - **`edge_status_403`** - Number of 403 status codes from edge. + - **`edge_status_404`** - Number of 404 status codes from edge. + - **`edge_status_416`** - Number of 416 status codes from edge. + - **`edge_status_429`** - Number of 429 status codes from edge. + - **`edge_status_4xx`** - Number of 4xx status codes from edge. + - **`edge_status_500`** - Number of 500 status codes from edge. + - **`edge_status_501`** - Number of 501 status codes from edge. + - **`edge_status_502`** - Number of 502 status codes from edge. + - **`edge_status_503`** - Number of 503 status codes from edge. + - **`edge_status_504`** - Number of 504 status codes from edge. + - **`edge_status_505`** - Number of 505 status codes from edge. + - **`edge_status_5xx`** - Number of 5xx status codes from edge. + - **`edge_hit_ratio`** - Percent of cache hits (0.0 - 1.0). + - **`edge_hit_bytes`** - Number of bytes sent back when cache hits. + - **`origin_bandwidth`** - Bandwidth from CDN to Origin (bit/s.) + - **`origin_requests`** - Number of requests per interval (requests/s.) + - **`origin_status_1xx`** - Number of 1xx status from origin. + - **`origin_status_200`** - Number of 200 status from origin. + - **`origin_status_204`** - Number of 204 status from origin. + - **`origin_status_206`** - Number of 206 status from origin. + - **`origin_status_2xx`** - Number of 2xx status from origin. + - **`origin_status_301`** - Number of 301 status from origin. + - **`origin_status_302`** - Number of 302 status from origin. + - **`origin_status_304`** - Number of 304 status from origin. + - **`origin_status_3xx`** - Number of 3xx status from origin. + - **`origin_status_400`** - Number of 400 status from origin. + - **`origin_status_401`** - Number of 401 status from origin. + - **`origin_status_403`** - Number of 403 status from origin. + - **`origin_status_404`** - Number of 404 status from origin. + - **`origin_status_416`** - Number of 416 status from origin. + - **`origin_status_429`** - Number of 426 status from origin. + - **`origin_status_4xx`** - Number of 4xx status from origin. + - **`origin_status_500`** - Number of 500 status from origin. + - **`origin_status_501`** - Number of 501 status from origin. + - **`origin_status_502`** - Number of 502 status from origin. + - **`origin_status_503`** - Number of 503 status from origin. + - **`origin_status_504`** - Number of 504 status from origin. + - **`origin_status_505`** - Number of 505 status from origin. + - **`origin_status_5xx`** - Number of 5xx status from origin. + - **`edge_download_speed`** - Download speed from edge in KB/s (includes only + requests that status was in the range [200, 300].) + - **`origin_download_speed`** - Download speed from origin in KB/s (includes + only requests that status was in the range [200, 300].) + + to: Specifies ending period to fetch metrics (ISO 8601/RFC 3339 format, UTC) + + Examples: + + - 2021-06-15T00:00:00Z + - 2021-06-15T00:00:00.000Z + + The total number of points, which is determined as the difference between "from" + and "to" divided by "granularity", cannot exceed 1440. Exception: "speed" + metrics are limited to 72 points. + + filter_by: Each item represents one filter statement. + + granularity: Duration of the time blocks into which the data is divided. The value must + correspond to the ISO 8601 period format. + + Examples: + + - P1D + - PT5M + + Notes: + + - The total number of points, which is determined as the difference between + "from" and "to" divided by "granularity", cannot exceed 1440. Exception: + "speed" metrics are limited to 72 points. + - For "speed" metrics the value must be a multiple of 5. + + group_by: Output data grouping. + + Possible values: + + - **resource** - Data is grouped by CDN resource. + - **cname** - Data is grouped by common names. + - **region** – Data is grouped by regions (continents.) Available for "speed" + metrics only. + - **isp** - Data is grouped by ISP names. Available for "speed" metrics only. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/cdn/advanced/v1/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/metrics", + body=await async_maybe_transform( + { + "from_": from_, + "metrics": metrics, + "to": to, + "filter_by": filter_by, + "granularity": granularity, + "group_by": group_by, + }, + metric_list_params.MetricListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnMetrics, + ) + + +class MetricsResourceWithRawResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_raw_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithRawResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_raw_response_wrapper( + metrics.list, + ) + + +class MetricsResourceWithStreamingResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_streamed_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithStreamingResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_streamed_response_wrapper( + metrics.list, + ) diff --git a/src/gcore/resources/cdn/network_capacity.py b/src/gcore/resources/cdn/network_capacity.py new file mode 100644 index 00000000..30acd2bb --- /dev/null +++ b/src/gcore/resources/cdn/network_capacity.py @@ -0,0 +1,139 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.cdn.network_capacity import NetworkCapacity + +__all__ = ["NetworkCapacityResource", "AsyncNetworkCapacityResource"] + + +class NetworkCapacityResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> NetworkCapacityResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return NetworkCapacityResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> NetworkCapacityResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return NetworkCapacityResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> NetworkCapacity: + """Get network capacity per country.""" + return self._get( + "/cdn/advanced/v1/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/capacity", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NetworkCapacity, + ) + + +class AsyncNetworkCapacityResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncNetworkCapacityResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncNetworkCapacityResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncNetworkCapacityResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncNetworkCapacityResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> NetworkCapacity: + """Get network capacity per country.""" + return await self._get( + "/cdn/advanced/v1/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/capacity", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NetworkCapacity, + ) + + +class NetworkCapacityResourceWithRawResponse: + def __init__(self, network_capacity: NetworkCapacityResource) -> None: + self._network_capacity = network_capacity + + self.list = to_raw_response_wrapper( + network_capacity.list, + ) + + +class AsyncNetworkCapacityResourceWithRawResponse: + def __init__(self, network_capacity: AsyncNetworkCapacityResource) -> None: + self._network_capacity = network_capacity + + self.list = async_to_raw_response_wrapper( + network_capacity.list, + ) + + +class NetworkCapacityResourceWithStreamingResponse: + def __init__(self, network_capacity: NetworkCapacityResource) -> None: + self._network_capacity = network_capacity + + self.list = to_streamed_response_wrapper( + network_capacity.list, + ) + + +class AsyncNetworkCapacityResourceWithStreamingResponse: + def __init__(self, network_capacity: AsyncNetworkCapacityResource) -> None: + self._network_capacity = network_capacity + + self.list = async_to_streamed_response_wrapper( + network_capacity.list, + ) diff --git a/src/gcore/resources/cdn/origin_groups.py b/src/gcore/resources/cdn/origin_groups.py new file mode 100644 index 00000000..aa98a961 --- /dev/null +++ b/src/gcore/resources/cdn/origin_groups.py @@ -0,0 +1,1496 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Any, Iterable, cast +from typing_extensions import overload + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ..._utils import required_args, maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import ( + origin_group_list_params, + origin_group_create_params, + origin_group_update_params, + origin_group_replace_params, +) +from ..._base_client import make_request_options +from ...types.cdn.origin_groups import OriginGroups +from ...types.cdn.origin_groups_list import OriginGroupsList + +__all__ = ["OriginGroupsResource", "AsyncOriginGroupsResource"] + + +class OriginGroupsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> OriginGroupsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return OriginGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> OriginGroupsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return OriginGroupsResourceWithStreamingResponse(self) + + @overload + def create( + self, + *, + name: str, + sources: Iterable[origin_group_create_params.NoneAuthSource], + auth_type: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Create an origin group with one or more origin sources. + + Args: + name: Origin group name. + + sources: List of origin sources in the origin group. + + auth_type: Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + auth: origin_group_create_params.AwsSignatureV4Auth, + auth_type: str, + name: str, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Create an origin group with one or more origin sources. + + Args: + auth: Credentials to access the private bucket. + + auth_type: Authentication type. + + **awsSignatureV4** value is used for S3 storage. + + name: Origin group name. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args(["name", "sources"], ["auth", "auth_type", "name"]) + def create( + self, + *, + name: str, + sources: Iterable[origin_group_create_params.NoneAuthSource] | Omit = omit, + auth_type: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | Omit = omit, + auth: origin_group_create_params.AwsSignatureV4Auth | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + return cast( + OriginGroups, + self._post( + "/cdn/origin_groups" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/origin_groups", + body=maybe_transform( + { + "name": name, + "sources": sources, + "auth_type": auth_type, + "proxy_next_upstream": proxy_next_upstream, + "use_next": use_next, + "auth": auth, + }, + origin_group_create_params.OriginGroupCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + @overload + def update( + self, + origin_group_id: int, + *, + name: str, + auth_type: str | Omit = omit, + path: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + sources: Iterable[origin_group_update_params.NoneAuthSource] | Omit = omit, + use_next: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Change origin group + + Args: + name: Origin group name. + + auth_type: Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + + path: Parameter is **deprecated**. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + sources: List of origin sources in the origin group. + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def update( + self, + origin_group_id: int, + *, + auth: origin_group_update_params.AwsSignatureV4Auth | Omit = omit, + auth_type: str | Omit = omit, + name: str | Omit = omit, + path: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Change origin group + + Args: + auth: Credentials to access the private bucket. + + auth_type: Authentication type. + + **awsSignatureV4** value is used for S3 storage. + + name: Origin group name. + + path: Parameter is **deprecated**. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + def update( + self, + origin_group_id: int, + *, + name: str | Omit = omit, + auth_type: str | Omit = omit, + path: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + sources: Iterable[origin_group_update_params.NoneAuthSource] | Omit = omit, + use_next: bool | Omit = omit, + auth: origin_group_update_params.AwsSignatureV4Auth | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + return cast( + OriginGroups, + self._patch( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + body=maybe_transform( + { + "name": name, + "auth_type": auth_type, + "path": path, + "proxy_next_upstream": proxy_next_upstream, + "sources": sources, + "use_next": use_next, + "auth": auth, + }, + origin_group_update_params.OriginGroupUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + def list( + self, + *, + has_related_resources: bool | Omit = omit, + name: str | Omit = omit, + sources: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroupsList: + """ + Get all origin groups and related origin sources. + + Args: + has_related_resources: Defines whether the origin group has related CDN resources. + + Possible values: + + - **true** – Origin group has related CDN resources. + - **false** – Origin group does not have related CDN resources. + + name: Origin group name. + + sources: Origin sources (IP addresses or domains) in the origin group. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/origin_groups" if self._client._base_url_overridden else "https://api.gcore.com//cdn/origin_groups", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "has_related_resources": has_related_resources, + "name": name, + "sources": sources, + }, + origin_group_list_params.OriginGroupListParams, + ), + ), + cast_to=OriginGroupsList, + ) + + def delete( + self, + origin_group_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete origin group + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + origin_group_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Get origin group details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return cast( + OriginGroups, + self._get( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + @overload + def replace( + self, + origin_group_id: int, + *, + auth_type: str, + name: str, + path: str, + sources: Iterable[origin_group_replace_params.NoneAuthSource], + use_next: bool, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Change origin group + + Args: + auth_type: Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + + name: Origin group name. + + path: Parameter is **deprecated**. + + sources: List of origin sources in the origin group. + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def replace( + self, + origin_group_id: int, + *, + auth: origin_group_replace_params.AwsSignatureV4Auth, + auth_type: str, + name: str, + path: str, + use_next: bool, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Change origin group + + Args: + auth: Credentials to access the private bucket. + + auth_type: Authentication type. + + **awsSignatureV4** value is used for S3 storage. + + name: Origin group name. + + path: Parameter is **deprecated**. + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args( + ["auth_type", "name", "path", "sources", "use_next"], ["auth", "auth_type", "name", "path", "use_next"] + ) + def replace( + self, + origin_group_id: int, + *, + auth_type: str, + name: str, + path: str, + sources: Iterable[origin_group_replace_params.NoneAuthSource] | Omit = omit, + use_next: bool, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + auth: origin_group_replace_params.AwsSignatureV4Auth | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + return cast( + OriginGroups, + self._put( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + body=maybe_transform( + { + "auth_type": auth_type, + "name": name, + "path": path, + "sources": sources, + "use_next": use_next, + "proxy_next_upstream": proxy_next_upstream, + "auth": auth, + }, + origin_group_replace_params.OriginGroupReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + +class AsyncOriginGroupsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncOriginGroupsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncOriginGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncOriginGroupsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncOriginGroupsResourceWithStreamingResponse(self) + + @overload + async def create( + self, + *, + name: str, + sources: Iterable[origin_group_create_params.NoneAuthSource], + auth_type: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Create an origin group with one or more origin sources. + + Args: + name: Origin group name. + + sources: List of origin sources in the origin group. + + auth_type: Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + auth: origin_group_create_params.AwsSignatureV4Auth, + auth_type: str, + name: str, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Create an origin group with one or more origin sources. + + Args: + auth: Credentials to access the private bucket. + + auth_type: Authentication type. + + **awsSignatureV4** value is used for S3 storage. + + name: Origin group name. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args(["name", "sources"], ["auth", "auth_type", "name"]) + async def create( + self, + *, + name: str, + sources: Iterable[origin_group_create_params.NoneAuthSource] | Omit = omit, + auth_type: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | Omit = omit, + auth: origin_group_create_params.AwsSignatureV4Auth | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + return cast( + OriginGroups, + await self._post( + "/cdn/origin_groups" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/origin_groups", + body=await async_maybe_transform( + { + "name": name, + "sources": sources, + "auth_type": auth_type, + "proxy_next_upstream": proxy_next_upstream, + "use_next": use_next, + "auth": auth, + }, + origin_group_create_params.OriginGroupCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + @overload + async def update( + self, + origin_group_id: int, + *, + name: str, + auth_type: str | Omit = omit, + path: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + sources: Iterable[origin_group_update_params.NoneAuthSource] | Omit = omit, + use_next: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Change origin group + + Args: + name: Origin group name. + + auth_type: Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + + path: Parameter is **deprecated**. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + sources: List of origin sources in the origin group. + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def update( + self, + origin_group_id: int, + *, + auth: origin_group_update_params.AwsSignatureV4Auth | Omit = omit, + auth_type: str | Omit = omit, + name: str | Omit = omit, + path: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Change origin group + + Args: + auth: Credentials to access the private bucket. + + auth_type: Authentication type. + + **awsSignatureV4** value is used for S3 storage. + + name: Origin group name. + + path: Parameter is **deprecated**. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + async def update( + self, + origin_group_id: int, + *, + name: str | Omit = omit, + auth_type: str | Omit = omit, + path: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + sources: Iterable[origin_group_update_params.NoneAuthSource] | Omit = omit, + use_next: bool | Omit = omit, + auth: origin_group_update_params.AwsSignatureV4Auth | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + return cast( + OriginGroups, + await self._patch( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + body=await async_maybe_transform( + { + "name": name, + "auth_type": auth_type, + "path": path, + "proxy_next_upstream": proxy_next_upstream, + "sources": sources, + "use_next": use_next, + "auth": auth, + }, + origin_group_update_params.OriginGroupUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def list( + self, + *, + has_related_resources: bool | Omit = omit, + name: str | Omit = omit, + sources: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroupsList: + """ + Get all origin groups and related origin sources. + + Args: + has_related_resources: Defines whether the origin group has related CDN resources. + + Possible values: + + - **true** – Origin group has related CDN resources. + - **false** – Origin group does not have related CDN resources. + + name: Origin group name. + + sources: Origin sources (IP addresses or domains) in the origin group. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/origin_groups" if self._client._base_url_overridden else "https://api.gcore.com//cdn/origin_groups", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "has_related_resources": has_related_resources, + "name": name, + "sources": sources, + }, + origin_group_list_params.OriginGroupListParams, + ), + ), + cast_to=OriginGroupsList, + ) + + async def delete( + self, + origin_group_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete origin group + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + origin_group_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Get origin group details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return cast( + OriginGroups, + await self._get( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + @overload + async def replace( + self, + origin_group_id: int, + *, + auth_type: str, + name: str, + path: str, + sources: Iterable[origin_group_replace_params.NoneAuthSource], + use_next: bool, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Change origin group + + Args: + auth_type: Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + + name: Origin group name. + + path: Parameter is **deprecated**. + + sources: List of origin sources in the origin group. + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def replace( + self, + origin_group_id: int, + *, + auth: origin_group_replace_params.AwsSignatureV4Auth, + auth_type: str, + name: str, + path: str, + use_next: bool, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + """ + Change origin group + + Args: + auth: Credentials to access the private bucket. + + auth_type: Authentication type. + + **awsSignatureV4** value is used for S3 storage. + + name: Origin group name. + + path: Parameter is **deprecated**. + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args( + ["auth_type", "name", "path", "sources", "use_next"], ["auth", "auth_type", "name", "path", "use_next"] + ) + async def replace( + self, + origin_group_id: int, + *, + auth_type: str, + name: str, + path: str, + sources: Iterable[origin_group_replace_params.NoneAuthSource] | Omit = omit, + use_next: bool, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + auth: origin_group_replace_params.AwsSignatureV4Auth | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginGroups: + return cast( + OriginGroups, + await self._put( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + body=await async_maybe_transform( + { + "auth_type": auth_type, + "name": name, + "path": path, + "sources": sources, + "use_next": use_next, + "proxy_next_upstream": proxy_next_upstream, + "auth": auth, + }, + origin_group_replace_params.OriginGroupReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + +class OriginGroupsResourceWithRawResponse: + def __init__(self, origin_groups: OriginGroupsResource) -> None: + self._origin_groups = origin_groups + + self.create = to_raw_response_wrapper( + origin_groups.create, + ) + self.update = to_raw_response_wrapper( + origin_groups.update, + ) + self.list = to_raw_response_wrapper( + origin_groups.list, + ) + self.delete = to_raw_response_wrapper( + origin_groups.delete, + ) + self.get = to_raw_response_wrapper( + origin_groups.get, + ) + self.replace = to_raw_response_wrapper( + origin_groups.replace, + ) + + +class AsyncOriginGroupsResourceWithRawResponse: + def __init__(self, origin_groups: AsyncOriginGroupsResource) -> None: + self._origin_groups = origin_groups + + self.create = async_to_raw_response_wrapper( + origin_groups.create, + ) + self.update = async_to_raw_response_wrapper( + origin_groups.update, + ) + self.list = async_to_raw_response_wrapper( + origin_groups.list, + ) + self.delete = async_to_raw_response_wrapper( + origin_groups.delete, + ) + self.get = async_to_raw_response_wrapper( + origin_groups.get, + ) + self.replace = async_to_raw_response_wrapper( + origin_groups.replace, + ) + + +class OriginGroupsResourceWithStreamingResponse: + def __init__(self, origin_groups: OriginGroupsResource) -> None: + self._origin_groups = origin_groups + + self.create = to_streamed_response_wrapper( + origin_groups.create, + ) + self.update = to_streamed_response_wrapper( + origin_groups.update, + ) + self.list = to_streamed_response_wrapper( + origin_groups.list, + ) + self.delete = to_streamed_response_wrapper( + origin_groups.delete, + ) + self.get = to_streamed_response_wrapper( + origin_groups.get, + ) + self.replace = to_streamed_response_wrapper( + origin_groups.replace, + ) + + +class AsyncOriginGroupsResourceWithStreamingResponse: + def __init__(self, origin_groups: AsyncOriginGroupsResource) -> None: + self._origin_groups = origin_groups + + self.create = async_to_streamed_response_wrapper( + origin_groups.create, + ) + self.update = async_to_streamed_response_wrapper( + origin_groups.update, + ) + self.list = async_to_streamed_response_wrapper( + origin_groups.list, + ) + self.delete = async_to_streamed_response_wrapper( + origin_groups.delete, + ) + self.get = async_to_streamed_response_wrapper( + origin_groups.get, + ) + self.replace = async_to_streamed_response_wrapper( + origin_groups.replace, + ) diff --git a/src/gcore/resources/cdn/resources/__init__.py b/src/gcore/resources/cdn/resources/__init__.py new file mode 100644 index 00000000..e72105aa --- /dev/null +++ b/src/gcore/resources/cdn/resources/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .rules import ( + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, +) +from .shield import ( + ShieldResource, + AsyncShieldResource, + ShieldResourceWithRawResponse, + AsyncShieldResourceWithRawResponse, + ShieldResourceWithStreamingResponse, + AsyncShieldResourceWithStreamingResponse, +) +from .resources import ( + ResourcesResource, + AsyncResourcesResource, + ResourcesResourceWithRawResponse, + AsyncResourcesResourceWithRawResponse, + ResourcesResourceWithStreamingResponse, + AsyncResourcesResourceWithStreamingResponse, +) + +__all__ = [ + "ShieldResource", + "AsyncShieldResource", + "ShieldResourceWithRawResponse", + "AsyncShieldResourceWithRawResponse", + "ShieldResourceWithStreamingResponse", + "AsyncShieldResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "ResourcesResource", + "AsyncResourcesResource", + "ResourcesResourceWithRawResponse", + "AsyncResourcesResourceWithRawResponse", + "ResourcesResourceWithStreamingResponse", + "AsyncResourcesResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cdn/resources/resources.py b/src/gcore/resources/cdn/resources/resources.py new file mode 100644 index 00000000..02065307 --- /dev/null +++ b/src/gcore/resources/cdn/resources/resources.py @@ -0,0 +1,2060 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, overload + +import httpx + +from .rules import ( + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, +) +from .shield import ( + ShieldResource, + AsyncShieldResource, + ShieldResourceWithRawResponse, + AsyncShieldResourceWithRawResponse, + ShieldResourceWithStreamingResponse, + AsyncShieldResourceWithStreamingResponse, +) +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....types.cdn import ( + resource_list_params, + resource_purge_params, + resource_create_params, + resource_update_params, + resource_replace_params, + resource_prefetch_params, +) +from ...._base_client import make_request_options +from ....types.cdn.cdn_resource import CdnResource +from ....types.cdn.cdn_resource_list import CdnResourceList + +__all__ = ["ResourcesResource", "AsyncResourcesResource"] + + +class ResourcesResource(SyncAPIResource): + @cached_property + def shield(self) -> ShieldResource: + return ShieldResource(self._client) + + @cached_property + def rules(self) -> RulesResource: + return RulesResource(self._client) + + @cached_property + def with_raw_response(self) -> ResourcesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return ResourcesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ResourcesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return ResourcesResourceWithStreamingResponse(self) + + def create( + self, + *, + cname: str, + origin: str, + origin_group: int, + active: bool | Omit = omit, + description: str | Omit = omit, + name: Optional[str] | Omit = omit, + options: resource_create_params.Options | Omit = omit, + origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, + primary_resource: Optional[int] | Omit = omit, + proxy_ssl_ca: Optional[int] | Omit = omit, + proxy_ssl_data: Optional[int] | Omit = omit, + proxy_ssl_enabled: bool | Omit = omit, + secondary_hostnames: SequenceNotStr[str] | Omit = omit, + ssl_data: Optional[int] | Omit = omit, + ssl_enabled: bool | Omit = omit, + waap_api_domain_enabled: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResource: + """ + Create CDN resource + + Args: + cname: Delivery domains that will be used for content delivery through a CDN. + + Delivery domains should be added to your DNS settings. + + origin: IP address or domain name of the origin and the port, if custom port is used. + + You can use either the `origin` or `originGroup` parameter in the request. + + origin_group: Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + + active: Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + + description: Optional comment describing the CDN resource. + + name: CDN resource name. + + options: List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + + origin_protocol: Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + + primary_resource: ID of the main CDN resource which has a shared caching zone with a reserve CDN + resource. + + If the parameter is not empty, then the current CDN resource is the reserve. You + cannot change some options, create rules, set up origin shielding, or use the + reserve CDN resource for Streaming. + + proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_data: ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + + secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + + ssl_data: ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + + ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + + waap_api_domain_enabled: Defines whether the associated WAAP Domain is identified as an API Domain. + + Possible values: + + - **true** - The associated WAAP Domain is designated as an API Domain. + - **false** - The associated WAAP Domain is not designated as an API Domain. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources", + body=maybe_transform( + { + "cname": cname, + "origin": origin, + "origin_group": origin_group, + "active": active, + "description": description, + "name": name, + "options": options, + "origin_protocol": origin_protocol, + "primary_resource": primary_resource, + "proxy_ssl_ca": proxy_ssl_ca, + "proxy_ssl_data": proxy_ssl_data, + "proxy_ssl_enabled": proxy_ssl_enabled, + "secondary_hostnames": secondary_hostnames, + "ssl_data": ssl_data, + "ssl_enabled": ssl_enabled, + "waap_api_domain_enabled": waap_api_domain_enabled, + }, + resource_create_params.ResourceCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + def update( + self, + resource_id: int, + *, + active: bool | Omit = omit, + description: str | Omit = omit, + name: Optional[str] | Omit = omit, + options: resource_update_params.Options | Omit = omit, + origin_group: int | Omit = omit, + origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, + proxy_ssl_ca: Optional[int] | Omit = omit, + proxy_ssl_data: Optional[int] | Omit = omit, + proxy_ssl_enabled: bool | Omit = omit, + secondary_hostnames: SequenceNotStr[str] | Omit = omit, + ssl_data: Optional[int] | Omit = omit, + ssl_enabled: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResource: + """ + Change CDN resource + + Args: + active: Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + + description: Optional comment describing the CDN resource. + + name: CDN resource name. + + options: List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + + origin_group: Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + + origin_protocol: Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + + proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_data: ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + + secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + + ssl_data: ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + + ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + body=maybe_transform( + { + "active": active, + "description": description, + "name": name, + "options": options, + "origin_group": origin_group, + "origin_protocol": origin_protocol, + "proxy_ssl_ca": proxy_ssl_ca, + "proxy_ssl_data": proxy_ssl_data, + "proxy_ssl_enabled": proxy_ssl_enabled, + "secondary_hostnames": secondary_hostnames, + "ssl_data": ssl_data, + "ssl_enabled": ssl_enabled, + }, + resource_update_params.ResourceUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + def list( + self, + *, + cname: str | Omit = omit, + deleted: bool | Omit = omit, + enabled: bool | Omit = omit, + max_created: str | Omit = omit, + min_created: str | Omit = omit, + origin_group: int | Omit = omit, + rules: str | Omit = omit, + secondary_hostnames: str | Omit = omit, + shield_dc: str | Omit = omit, + shielded: bool | Omit = omit, + ssl_data: int | Omit = omit, + ssl_data_in: int | Omit = omit, + ssl_enabled: bool | Omit = omit, + status: Literal["active", "processed", "suspended", "deleted"] | Omit = omit, + suspend: bool | Omit = omit, + vp_enabled: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResourceList: + """ + Get information about all CDN resources in your account. + + Args: + cname: Delivery domain (CNAME) of the CDN resource. + + deleted: Defines whether a CDN resource has been deleted. + + Possible values: + + - **true** - CDN resource has been deleted. + - **false** - CDN resource has not been deleted. + + enabled: Enables or disables a CDN resource change by a user. + + Possible values: + + - **true** - CDN resource is enabled. + - **false** - CDN resource is disabled. + + max_created: Most recent date of CDN resource creation for which CDN resources should be + returned (ISO 8601/RFC 3339 format, UTC.) + + min_created: Earliest date of CDN resource creation for which CDN resources should be + returned (ISO 8601/RFC 3339 format, UTC.) + + origin_group: Origin group ID. + + rules: Rule name or pattern. + + secondary_hostnames: Additional delivery domains (CNAMEs) of the CDN resource. + + shield_dc: Name of the origin shielding data center location. + + shielded: Defines whether origin shielding is enabled for the CDN resource. + + Possible values: + + - **true** - Origin shielding is enabled for the CDN resource. + - **false** - Origin shielding is disabled for the CDN resource. + + ssl_data: SSL certificate ID. + + ssl_data_in: SSL certificates IDs. + + Example: + + - ?`sslData_in`=1643,1644,1652 + + ssl_enabled: Defines whether the HTTPS protocol is enabled for content delivery. + + Possible values: + + - **true** - HTTPS protocol is enabled for CDN resource. + - **false** - HTTPS protocol is disabled for CDN resource. + + status: CDN resource status. + + suspend: Defines whether the CDN resource was automatically suspended by the system. + + Possible values: + + - **true** - CDN resource is selected for automatic suspension in the next 7 + days. + - **false** - CDN resource is not selected for automatic suspension. + + vp_enabled: Defines whether the CDN resource is integrated with the Streaming platform. + + Possible values: + + - **true** - CDN resource is used for Streaming platform. + - **false** - CDN resource is not used for Streaming platform. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "cname": cname, + "deleted": deleted, + "enabled": enabled, + "max_created": max_created, + "min_created": min_created, + "origin_group": origin_group, + "rules": rules, + "secondary_hostnames": secondary_hostnames, + "shield_dc": shield_dc, + "shielded": shielded, + "ssl_data": ssl_data, + "ssl_data_in": ssl_data_in, + "ssl_enabled": ssl_enabled, + "status": status, + "suspend": suspend, + "vp_enabled": vp_enabled, + }, + resource_list_params.ResourceListParams, + ), + ), + cast_to=CdnResourceList, + ) + + def delete( + self, + resource_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete the CDN resource from the system permanently. + + Notes: + + - **Deactivation Requirement**: Set the `active` attribute to `false` before + deletion. + - **Statistics Availability**: Statistics will be available for **365 days** + after deletion through the + [statistics endpoints](/docs/api-reference/cdn/cdn-statistics/cdn-resource-statistics). + - **Irreversibility**: This action is irreversible. Once deleted, the CDN + resource cannot be recovered. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + resource_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResource: + """ + Get CDN resource details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + def prefetch( + self, + resource_id: int, + *, + paths: SequenceNotStr[str], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Pre-populate files to a CDN cache before users requests. + + Prefetch is recommended + only for files that **more than 200 MB** and **less than 5 GB**. + + You can make one prefetch request for a CDN resource per minute. One request for + prefetch may content only up to 100 paths to files. + + The time of procedure depends on the number and size of the files. + + If you need to update files stored in the CDN, first purge these files and then + prefetch. + + Args: + paths: Paths to files that should be pre-populated to the CDN. + + Paths to the files should be specified without a domain name. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cdn/resources/{resource_id}/prefetch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/prefetch", + body=maybe_transform({"paths": paths}, resource_prefetch_params.ResourcePrefetchParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def prevalidate_ssl_le_certificate( + self, + resource_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Check whether a Let's Encrypt certificate can be issued for the CDN resource. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cdn/resources/{resource_id}/ssl/le/pre-validate" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/ssl/le/pre-validate", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + @overload + def purge( + self, + resource_id: int, + *, + urls: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Delete cache from CDN servers. + + This is necessary to update CDN content. + + We have different limits for different purge types: + + - **Purge all cache** - One purge request for a CDN resource per minute. + - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge + request is limited to 100 URLs. + - **Purge by pattern** - One purge request for a CDN resource per minute. One + purge request is limited to 10 patterns. + + Args: + urls: **Purge by URL** clears the cache of a specific files. This purge type is + recommended. + + Specify file URLs including query strings. URLs should start with / without a + domain name. + + Purge by URL depends on the following CDN options: + + 1. "vary response header" is used. If your origin serves variants of the same + content depending on the Vary HTTP response header, purge by URL will delete + only one version of the file. + 2. "slice" is used. If you update several files in the origin without clearing + the CDN cache, purge by URL will delete only the first slice (with bytes=0… + .) + 3. "ignoreQueryString" is used. Don’t specify parameters in the purge request. + 4. "`query_params_blacklist`" is used. Only files with the listed in the option + parameters will be cached as different objects. Files with other parameters + will be cached as one object. In this case, specify the listed parameters in + the Purge request. Don't specify other parameters. + 5. "`query_params_whitelist`" is used. Files with listed in the option + parameters will be cached as one object. Files with other parameters will be + cached as different objects. In this case, specify other parameters (if any) + besides the ones listed in the purge request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def purge( + self, + resource_id: int, + *, + paths: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Delete cache from CDN servers. + + This is necessary to update CDN content. + + We have different limits for different purge types: + + - **Purge all cache** - One purge request for a CDN resource per minute. + - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge + request is limited to 100 URLs. + - **Purge by pattern** - One purge request for a CDN resource per minute. One + purge request is limited to 10 patterns. + + Args: + paths: **Purge by pattern** clears the cache that matches the pattern. + + Use \\** operator, which replaces any number of symbols in your path. It's + important to note that wildcard usage (\\**) is permitted only at the end of a + pattern. + + Query string added to any patterns will be ignored, and purge request will be + processed as if there weren't any parameters. + + Purge by pattern is recursive. Both /path and /path\\** will result in recursive + purging, meaning all content under the specified path will be affected. As such, + using the pattern /path\\** is functionally equivalent to simply using /path. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def purge( + self, + resource_id: int, + *, + paths: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Delete cache from CDN servers. + + This is necessary to update CDN content. + + We have different limits for different purge types: + + - **Purge all cache** - One purge request for a CDN resource per minute. + - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge + request is limited to 100 URLs. + - **Purge by pattern** - One purge request for a CDN resource per minute. One + purge request is limited to 10 patterns. + + Args: + paths: **Purge all cache** clears the entire cache for the CDN resource. + + Specify an empty array to purge all content for the resource. + + When you purge all assets, CDN servers request content from your origin server + and cause a high load. Therefore, we recommend to use purge by URL for large + content quantities. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + def purge( + self, + resource_id: int, + *, + urls: SequenceNotStr[str] | Omit = omit, + paths: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cdn/resources/{resource_id}/purge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/purge", + body=maybe_transform( + { + "urls": urls, + "paths": paths, + }, + resource_purge_params.ResourcePurgeParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def replace( + self, + resource_id: int, + *, + origin_group: int, + active: bool | Omit = omit, + description: str | Omit = omit, + name: Optional[str] | Omit = omit, + options: resource_replace_params.Options | Omit = omit, + origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, + proxy_ssl_ca: Optional[int] | Omit = omit, + proxy_ssl_data: Optional[int] | Omit = omit, + proxy_ssl_enabled: bool | Omit = omit, + secondary_hostnames: SequenceNotStr[str] | Omit = omit, + ssl_data: Optional[int] | Omit = omit, + ssl_enabled: bool | Omit = omit, + waap_api_domain_enabled: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResource: + """ + Change CDN resource + + Args: + origin_group: Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + + active: Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + + description: Optional comment describing the CDN resource. + + name: CDN resource name. + + options: List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + + origin_protocol: Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + + proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_data: ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + + secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + + ssl_data: ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + + ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + + waap_api_domain_enabled: Defines whether the associated WAAP Domain is identified as an API Domain. + + Possible values: + + - **true** - The associated WAAP Domain is designated as an API Domain. + - **false** - The associated WAAP Domain is not designated as an API Domain. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + body=maybe_transform( + { + "origin_group": origin_group, + "active": active, + "description": description, + "name": name, + "options": options, + "origin_protocol": origin_protocol, + "proxy_ssl_ca": proxy_ssl_ca, + "proxy_ssl_data": proxy_ssl_data, + "proxy_ssl_enabled": proxy_ssl_enabled, + "secondary_hostnames": secondary_hostnames, + "ssl_data": ssl_data, + "ssl_enabled": ssl_enabled, + "waap_api_domain_enabled": waap_api_domain_enabled, + }, + resource_replace_params.ResourceReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + +class AsyncResourcesResource(AsyncAPIResource): + @cached_property + def shield(self) -> AsyncShieldResource: + return AsyncShieldResource(self._client) + + @cached_property + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncResourcesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncResourcesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncResourcesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncResourcesResourceWithStreamingResponse(self) + + async def create( + self, + *, + cname: str, + origin: str, + origin_group: int, + active: bool | Omit = omit, + description: str | Omit = omit, + name: Optional[str] | Omit = omit, + options: resource_create_params.Options | Omit = omit, + origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, + primary_resource: Optional[int] | Omit = omit, + proxy_ssl_ca: Optional[int] | Omit = omit, + proxy_ssl_data: Optional[int] | Omit = omit, + proxy_ssl_enabled: bool | Omit = omit, + secondary_hostnames: SequenceNotStr[str] | Omit = omit, + ssl_data: Optional[int] | Omit = omit, + ssl_enabled: bool | Omit = omit, + waap_api_domain_enabled: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResource: + """ + Create CDN resource + + Args: + cname: Delivery domains that will be used for content delivery through a CDN. + + Delivery domains should be added to your DNS settings. + + origin: IP address or domain name of the origin and the port, if custom port is used. + + You can use either the `origin` or `originGroup` parameter in the request. + + origin_group: Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + + active: Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + + description: Optional comment describing the CDN resource. + + name: CDN resource name. + + options: List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + + origin_protocol: Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + + primary_resource: ID of the main CDN resource which has a shared caching zone with a reserve CDN + resource. + + If the parameter is not empty, then the current CDN resource is the reserve. You + cannot change some options, create rules, set up origin shielding, or use the + reserve CDN resource for Streaming. + + proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_data: ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + + secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + + ssl_data: ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + + ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + + waap_api_domain_enabled: Defines whether the associated WAAP Domain is identified as an API Domain. + + Possible values: + + - **true** - The associated WAAP Domain is designated as an API Domain. + - **false** - The associated WAAP Domain is not designated as an API Domain. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources", + body=await async_maybe_transform( + { + "cname": cname, + "origin": origin, + "origin_group": origin_group, + "active": active, + "description": description, + "name": name, + "options": options, + "origin_protocol": origin_protocol, + "primary_resource": primary_resource, + "proxy_ssl_ca": proxy_ssl_ca, + "proxy_ssl_data": proxy_ssl_data, + "proxy_ssl_enabled": proxy_ssl_enabled, + "secondary_hostnames": secondary_hostnames, + "ssl_data": ssl_data, + "ssl_enabled": ssl_enabled, + "waap_api_domain_enabled": waap_api_domain_enabled, + }, + resource_create_params.ResourceCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + async def update( + self, + resource_id: int, + *, + active: bool | Omit = omit, + description: str | Omit = omit, + name: Optional[str] | Omit = omit, + options: resource_update_params.Options | Omit = omit, + origin_group: int | Omit = omit, + origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, + proxy_ssl_ca: Optional[int] | Omit = omit, + proxy_ssl_data: Optional[int] | Omit = omit, + proxy_ssl_enabled: bool | Omit = omit, + secondary_hostnames: SequenceNotStr[str] | Omit = omit, + ssl_data: Optional[int] | Omit = omit, + ssl_enabled: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResource: + """ + Change CDN resource + + Args: + active: Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + + description: Optional comment describing the CDN resource. + + name: CDN resource name. + + options: List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + + origin_group: Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + + origin_protocol: Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + + proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_data: ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + + secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + + ssl_data: ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + + ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + body=await async_maybe_transform( + { + "active": active, + "description": description, + "name": name, + "options": options, + "origin_group": origin_group, + "origin_protocol": origin_protocol, + "proxy_ssl_ca": proxy_ssl_ca, + "proxy_ssl_data": proxy_ssl_data, + "proxy_ssl_enabled": proxy_ssl_enabled, + "secondary_hostnames": secondary_hostnames, + "ssl_data": ssl_data, + "ssl_enabled": ssl_enabled, + }, + resource_update_params.ResourceUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + async def list( + self, + *, + cname: str | Omit = omit, + deleted: bool | Omit = omit, + enabled: bool | Omit = omit, + max_created: str | Omit = omit, + min_created: str | Omit = omit, + origin_group: int | Omit = omit, + rules: str | Omit = omit, + secondary_hostnames: str | Omit = omit, + shield_dc: str | Omit = omit, + shielded: bool | Omit = omit, + ssl_data: int | Omit = omit, + ssl_data_in: int | Omit = omit, + ssl_enabled: bool | Omit = omit, + status: Literal["active", "processed", "suspended", "deleted"] | Omit = omit, + suspend: bool | Omit = omit, + vp_enabled: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResourceList: + """ + Get information about all CDN resources in your account. + + Args: + cname: Delivery domain (CNAME) of the CDN resource. + + deleted: Defines whether a CDN resource has been deleted. + + Possible values: + + - **true** - CDN resource has been deleted. + - **false** - CDN resource has not been deleted. + + enabled: Enables or disables a CDN resource change by a user. + + Possible values: + + - **true** - CDN resource is enabled. + - **false** - CDN resource is disabled. + + max_created: Most recent date of CDN resource creation for which CDN resources should be + returned (ISO 8601/RFC 3339 format, UTC.) + + min_created: Earliest date of CDN resource creation for which CDN resources should be + returned (ISO 8601/RFC 3339 format, UTC.) + + origin_group: Origin group ID. + + rules: Rule name or pattern. + + secondary_hostnames: Additional delivery domains (CNAMEs) of the CDN resource. + + shield_dc: Name of the origin shielding data center location. + + shielded: Defines whether origin shielding is enabled for the CDN resource. + + Possible values: + + - **true** - Origin shielding is enabled for the CDN resource. + - **false** - Origin shielding is disabled for the CDN resource. + + ssl_data: SSL certificate ID. + + ssl_data_in: SSL certificates IDs. + + Example: + + - ?`sslData_in`=1643,1644,1652 + + ssl_enabled: Defines whether the HTTPS protocol is enabled for content delivery. + + Possible values: + + - **true** - HTTPS protocol is enabled for CDN resource. + - **false** - HTTPS protocol is disabled for CDN resource. + + status: CDN resource status. + + suspend: Defines whether the CDN resource was automatically suspended by the system. + + Possible values: + + - **true** - CDN resource is selected for automatic suspension in the next 7 + days. + - **false** - CDN resource is not selected for automatic suspension. + + vp_enabled: Defines whether the CDN resource is integrated with the Streaming platform. + + Possible values: + + - **true** - CDN resource is used for Streaming platform. + - **false** - CDN resource is not used for Streaming platform. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "cname": cname, + "deleted": deleted, + "enabled": enabled, + "max_created": max_created, + "min_created": min_created, + "origin_group": origin_group, + "rules": rules, + "secondary_hostnames": secondary_hostnames, + "shield_dc": shield_dc, + "shielded": shielded, + "ssl_data": ssl_data, + "ssl_data_in": ssl_data_in, + "ssl_enabled": ssl_enabled, + "status": status, + "suspend": suspend, + "vp_enabled": vp_enabled, + }, + resource_list_params.ResourceListParams, + ), + ), + cast_to=CdnResourceList, + ) + + async def delete( + self, + resource_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete the CDN resource from the system permanently. + + Notes: + + - **Deactivation Requirement**: Set the `active` attribute to `false` before + deletion. + - **Statistics Availability**: Statistics will be available for **365 days** + after deletion through the + [statistics endpoints](/docs/api-reference/cdn/cdn-statistics/cdn-resource-statistics). + - **Irreversibility**: This action is irreversible. Once deleted, the CDN + resource cannot be recovered. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + resource_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResource: + """ + Get CDN resource details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + async def prefetch( + self, + resource_id: int, + *, + paths: SequenceNotStr[str], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Pre-populate files to a CDN cache before users requests. + + Prefetch is recommended + only for files that **more than 200 MB** and **less than 5 GB**. + + You can make one prefetch request for a CDN resource per minute. One request for + prefetch may content only up to 100 paths to files. + + The time of procedure depends on the number and size of the files. + + If you need to update files stored in the CDN, first purge these files and then + prefetch. + + Args: + paths: Paths to files that should be pre-populated to the CDN. + + Paths to the files should be specified without a domain name. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cdn/resources/{resource_id}/prefetch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/prefetch", + body=await async_maybe_transform({"paths": paths}, resource_prefetch_params.ResourcePrefetchParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def prevalidate_ssl_le_certificate( + self, + resource_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Check whether a Let's Encrypt certificate can be issued for the CDN resource. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cdn/resources/{resource_id}/ssl/le/pre-validate" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/ssl/le/pre-validate", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + @overload + async def purge( + self, + resource_id: int, + *, + urls: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Delete cache from CDN servers. + + This is necessary to update CDN content. + + We have different limits for different purge types: + + - **Purge all cache** - One purge request for a CDN resource per minute. + - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge + request is limited to 100 URLs. + - **Purge by pattern** - One purge request for a CDN resource per minute. One + purge request is limited to 10 patterns. + + Args: + urls: **Purge by URL** clears the cache of a specific files. This purge type is + recommended. + + Specify file URLs including query strings. URLs should start with / without a + domain name. + + Purge by URL depends on the following CDN options: + + 1. "vary response header" is used. If your origin serves variants of the same + content depending on the Vary HTTP response header, purge by URL will delete + only one version of the file. + 2. "slice" is used. If you update several files in the origin without clearing + the CDN cache, purge by URL will delete only the first slice (with bytes=0… + .) + 3. "ignoreQueryString" is used. Don’t specify parameters in the purge request. + 4. "`query_params_blacklist`" is used. Only files with the listed in the option + parameters will be cached as different objects. Files with other parameters + will be cached as one object. In this case, specify the listed parameters in + the Purge request. Don't specify other parameters. + 5. "`query_params_whitelist`" is used. Files with listed in the option + parameters will be cached as one object. Files with other parameters will be + cached as different objects. In this case, specify other parameters (if any) + besides the ones listed in the purge request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def purge( + self, + resource_id: int, + *, + paths: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Delete cache from CDN servers. + + This is necessary to update CDN content. + + We have different limits for different purge types: + + - **Purge all cache** - One purge request for a CDN resource per minute. + - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge + request is limited to 100 URLs. + - **Purge by pattern** - One purge request for a CDN resource per minute. One + purge request is limited to 10 patterns. + + Args: + paths: **Purge by pattern** clears the cache that matches the pattern. + + Use \\** operator, which replaces any number of symbols in your path. It's + important to note that wildcard usage (\\**) is permitted only at the end of a + pattern. + + Query string added to any patterns will be ignored, and purge request will be + processed as if there weren't any parameters. + + Purge by pattern is recursive. Both /path and /path\\** will result in recursive + purging, meaning all content under the specified path will be affected. As such, + using the pattern /path\\** is functionally equivalent to simply using /path. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def purge( + self, + resource_id: int, + *, + paths: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Delete cache from CDN servers. + + This is necessary to update CDN content. + + We have different limits for different purge types: + + - **Purge all cache** - One purge request for a CDN resource per minute. + - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge + request is limited to 100 URLs. + - **Purge by pattern** - One purge request for a CDN resource per minute. One + purge request is limited to 10 patterns. + + Args: + paths: **Purge all cache** clears the entire cache for the CDN resource. + + Specify an empty array to purge all content for the resource. + + When you purge all assets, CDN servers request content from your origin server + and cause a high load. Therefore, we recommend to use purge by URL for large + content quantities. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + async def purge( + self, + resource_id: int, + *, + urls: SequenceNotStr[str] | Omit = omit, + paths: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cdn/resources/{resource_id}/purge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/purge", + body=await async_maybe_transform( + { + "urls": urls, + "paths": paths, + }, + resource_purge_params.ResourcePurgeParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def replace( + self, + resource_id: int, + *, + origin_group: int, + active: bool | Omit = omit, + description: str | Omit = omit, + name: Optional[str] | Omit = omit, + options: resource_replace_params.Options | Omit = omit, + origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, + proxy_ssl_ca: Optional[int] | Omit = omit, + proxy_ssl_data: Optional[int] | Omit = omit, + proxy_ssl_enabled: bool | Omit = omit, + secondary_hostnames: SequenceNotStr[str] | Omit = omit, + ssl_data: Optional[int] | Omit = omit, + ssl_enabled: bool | Omit = omit, + waap_api_domain_enabled: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResource: + """ + Change CDN resource + + Args: + origin_group: Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + + active: Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + + description: Optional comment describing the CDN resource. + + name: CDN resource name. + + options: List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + + origin_protocol: Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + + proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_data: ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + + secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + + ssl_data: ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + + ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + + waap_api_domain_enabled: Defines whether the associated WAAP Domain is identified as an API Domain. + + Possible values: + + - **true** - The associated WAAP Domain is designated as an API Domain. + - **false** - The associated WAAP Domain is not designated as an API Domain. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + body=await async_maybe_transform( + { + "origin_group": origin_group, + "active": active, + "description": description, + "name": name, + "options": options, + "origin_protocol": origin_protocol, + "proxy_ssl_ca": proxy_ssl_ca, + "proxy_ssl_data": proxy_ssl_data, + "proxy_ssl_enabled": proxy_ssl_enabled, + "secondary_hostnames": secondary_hostnames, + "ssl_data": ssl_data, + "ssl_enabled": ssl_enabled, + "waap_api_domain_enabled": waap_api_domain_enabled, + }, + resource_replace_params.ResourceReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + +class ResourcesResourceWithRawResponse: + def __init__(self, resources: ResourcesResource) -> None: + self._resources = resources + + self.create = to_raw_response_wrapper( + resources.create, + ) + self.update = to_raw_response_wrapper( + resources.update, + ) + self.list = to_raw_response_wrapper( + resources.list, + ) + self.delete = to_raw_response_wrapper( + resources.delete, + ) + self.get = to_raw_response_wrapper( + resources.get, + ) + self.prefetch = to_raw_response_wrapper( + resources.prefetch, + ) + self.prevalidate_ssl_le_certificate = to_raw_response_wrapper( + resources.prevalidate_ssl_le_certificate, + ) + self.purge = to_raw_response_wrapper( + resources.purge, + ) + self.replace = to_raw_response_wrapper( + resources.replace, + ) + + @cached_property + def shield(self) -> ShieldResourceWithRawResponse: + return ShieldResourceWithRawResponse(self._resources.shield) + + @cached_property + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._resources.rules) + + +class AsyncResourcesResourceWithRawResponse: + def __init__(self, resources: AsyncResourcesResource) -> None: + self._resources = resources + + self.create = async_to_raw_response_wrapper( + resources.create, + ) + self.update = async_to_raw_response_wrapper( + resources.update, + ) + self.list = async_to_raw_response_wrapper( + resources.list, + ) + self.delete = async_to_raw_response_wrapper( + resources.delete, + ) + self.get = async_to_raw_response_wrapper( + resources.get, + ) + self.prefetch = async_to_raw_response_wrapper( + resources.prefetch, + ) + self.prevalidate_ssl_le_certificate = async_to_raw_response_wrapper( + resources.prevalidate_ssl_le_certificate, + ) + self.purge = async_to_raw_response_wrapper( + resources.purge, + ) + self.replace = async_to_raw_response_wrapper( + resources.replace, + ) + + @cached_property + def shield(self) -> AsyncShieldResourceWithRawResponse: + return AsyncShieldResourceWithRawResponse(self._resources.shield) + + @cached_property + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._resources.rules) + + +class ResourcesResourceWithStreamingResponse: + def __init__(self, resources: ResourcesResource) -> None: + self._resources = resources + + self.create = to_streamed_response_wrapper( + resources.create, + ) + self.update = to_streamed_response_wrapper( + resources.update, + ) + self.list = to_streamed_response_wrapper( + resources.list, + ) + self.delete = to_streamed_response_wrapper( + resources.delete, + ) + self.get = to_streamed_response_wrapper( + resources.get, + ) + self.prefetch = to_streamed_response_wrapper( + resources.prefetch, + ) + self.prevalidate_ssl_le_certificate = to_streamed_response_wrapper( + resources.prevalidate_ssl_le_certificate, + ) + self.purge = to_streamed_response_wrapper( + resources.purge, + ) + self.replace = to_streamed_response_wrapper( + resources.replace, + ) + + @cached_property + def shield(self) -> ShieldResourceWithStreamingResponse: + return ShieldResourceWithStreamingResponse(self._resources.shield) + + @cached_property + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._resources.rules) + + +class AsyncResourcesResourceWithStreamingResponse: + def __init__(self, resources: AsyncResourcesResource) -> None: + self._resources = resources + + self.create = async_to_streamed_response_wrapper( + resources.create, + ) + self.update = async_to_streamed_response_wrapper( + resources.update, + ) + self.list = async_to_streamed_response_wrapper( + resources.list, + ) + self.delete = async_to_streamed_response_wrapper( + resources.delete, + ) + self.get = async_to_streamed_response_wrapper( + resources.get, + ) + self.prefetch = async_to_streamed_response_wrapper( + resources.prefetch, + ) + self.prevalidate_ssl_le_certificate = async_to_streamed_response_wrapper( + resources.prevalidate_ssl_le_certificate, + ) + self.purge = async_to_streamed_response_wrapper( + resources.purge, + ) + self.replace = async_to_streamed_response_wrapper( + resources.replace, + ) + + @cached_property + def shield(self) -> AsyncShieldResourceWithStreamingResponse: + return AsyncShieldResourceWithStreamingResponse(self._resources.shield) + + @cached_property + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._resources.rules) diff --git a/src/gcore/resources/cdn/resources/rules.py b/src/gcore/resources/cdn/resources/rules.py new file mode 100644 index 00000000..11dd3eda --- /dev/null +++ b/src/gcore/resources/cdn/resources/rules.py @@ -0,0 +1,1027 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cdn.resources import rule_create_params, rule_update_params, rule_replace_params +from ....types.cdn.resources.cdn_resource_rule import CdnResourceRule +from ....types.cdn.resources.rule_list_response import RuleListResponse + +__all__ = ["RulesResource", "AsyncRulesResource"] + + +class RulesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RulesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return RulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return RulesResourceWithStreamingResponse(self) + + def create( + self, + resource_id: int, + *, + name: str, + rule: str, + rule_type: int, + active: bool | Omit = omit, + options: rule_create_params.Options | Omit = omit, + origin_group: Optional[int] | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResourceRule: + """ + Create rule + + Args: + name: Rule name. + + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + active: Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + origin_group: ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/cdn/resources/{resource_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules", + body=maybe_transform( + { + "name": name, + "rule": rule, + "rule_type": rule_type, + "active": active, + "options": options, + "origin_group": origin_group, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_create_params.RuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + def update( + self, + rule_id: int, + *, + resource_id: int, + active: bool | Omit = omit, + name: str | Omit = omit, + options: rule_update_params.Options | Omit = omit, + origin_group: Optional[int] | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + rule: str | Omit = omit, + rule_type: int | Omit = omit, + weight: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResourceRule: + """ + Change rule + + Args: + active: Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + + name: Rule name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + origin_group: ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + body=maybe_transform( + { + "active": active, + "name": name, + "options": options, + "origin_group": origin_group, + "override_origin_protocol": override_origin_protocol, + "rule": rule, + "rule_type": rule_type, + "weight": weight, + }, + rule_update_params.RuleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + def list( + self, + resource_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RuleListResponse: + """ + Get rules list + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cdn/resources/{resource_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleListResponse, + ) + + def delete( + self, + rule_id: int, + *, + resource_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete the rule from the system permanently. + + Notes: + + - **Deactivation Requirement**: Set the `active` attribute to `false` before + deletion. + - **Irreversibility**: This action is irreversible. Once deleted, the rule + cannot be recovered. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + rule_id: int, + *, + resource_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResourceRule: + """ + Get rule details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + def replace( + self, + rule_id: int, + *, + resource_id: int, + rule: str, + rule_type: int, + active: bool | Omit = omit, + name: str | Omit = omit, + options: rule_replace_params.Options | Omit = omit, + origin_group: Optional[int] | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResourceRule: + """ + Change rule + + Args: + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + active: Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + + name: Rule name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + origin_group: ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + body=maybe_transform( + { + "rule": rule, + "rule_type": rule_type, + "active": active, + "name": name, + "options": options, + "origin_group": origin_group, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_replace_params.RuleReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + +class AsyncRulesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncRulesResourceWithStreamingResponse(self) + + async def create( + self, + resource_id: int, + *, + name: str, + rule: str, + rule_type: int, + active: bool | Omit = omit, + options: rule_create_params.Options | Omit = omit, + origin_group: Optional[int] | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResourceRule: + """ + Create rule + + Args: + name: Rule name. + + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + active: Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + origin_group: ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/cdn/resources/{resource_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules", + body=await async_maybe_transform( + { + "name": name, + "rule": rule, + "rule_type": rule_type, + "active": active, + "options": options, + "origin_group": origin_group, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_create_params.RuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + async def update( + self, + rule_id: int, + *, + resource_id: int, + active: bool | Omit = omit, + name: str | Omit = omit, + options: rule_update_params.Options | Omit = omit, + origin_group: Optional[int] | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + rule: str | Omit = omit, + rule_type: int | Omit = omit, + weight: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResourceRule: + """ + Change rule + + Args: + active: Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + + name: Rule name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + origin_group: ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + body=await async_maybe_transform( + { + "active": active, + "name": name, + "options": options, + "origin_group": origin_group, + "override_origin_protocol": override_origin_protocol, + "rule": rule, + "rule_type": rule_type, + "weight": weight, + }, + rule_update_params.RuleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + async def list( + self, + resource_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RuleListResponse: + """ + Get rules list + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cdn/resources/{resource_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleListResponse, + ) + + async def delete( + self, + rule_id: int, + *, + resource_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete the rule from the system permanently. + + Notes: + + - **Deactivation Requirement**: Set the `active` attribute to `false` before + deletion. + - **Irreversibility**: This action is irreversible. Once deleted, the rule + cannot be recovered. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + rule_id: int, + *, + resource_id: int, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResourceRule: + """ + Get rule details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + async def replace( + self, + rule_id: int, + *, + resource_id: int, + rule: str, + rule_type: int, + active: bool | Omit = omit, + name: str | Omit = omit, + options: rule_replace_params.Options | Omit = omit, + origin_group: Optional[int] | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CdnResourceRule: + """ + Change rule + + Args: + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + active: Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + + name: Rule name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + origin_group: ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + body=await async_maybe_transform( + { + "rule": rule, + "rule_type": rule_type, + "active": active, + "name": name, + "options": options, + "origin_group": origin_group, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_replace_params.RuleReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: + self._rules = rules + + self.create = to_raw_response_wrapper( + rules.create, + ) + self.update = to_raw_response_wrapper( + rules.update, + ) + self.list = to_raw_response_wrapper( + rules.list, + ) + self.delete = to_raw_response_wrapper( + rules.delete, + ) + self.get = to_raw_response_wrapper( + rules.get, + ) + self.replace = to_raw_response_wrapper( + rules.replace, + ) + + +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: + self._rules = rules + + self.create = async_to_raw_response_wrapper( + rules.create, + ) + self.update = async_to_raw_response_wrapper( + rules.update, + ) + self.list = async_to_raw_response_wrapper( + rules.list, + ) + self.delete = async_to_raw_response_wrapper( + rules.delete, + ) + self.get = async_to_raw_response_wrapper( + rules.get, + ) + self.replace = async_to_raw_response_wrapper( + rules.replace, + ) + + +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: + self._rules = rules + + self.create = to_streamed_response_wrapper( + rules.create, + ) + self.update = to_streamed_response_wrapper( + rules.update, + ) + self.list = to_streamed_response_wrapper( + rules.list, + ) + self.delete = to_streamed_response_wrapper( + rules.delete, + ) + self.get = to_streamed_response_wrapper( + rules.get, + ) + self.replace = to_streamed_response_wrapper( + rules.replace, + ) + + +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: + self._rules = rules + + self.create = async_to_streamed_response_wrapper( + rules.create, + ) + self.update = async_to_streamed_response_wrapper( + rules.update, + ) + self.list = async_to_streamed_response_wrapper( + rules.list, + ) + self.delete = async_to_streamed_response_wrapper( + rules.delete, + ) + self.get = async_to_streamed_response_wrapper( + rules.get, + ) + self.replace = async_to_streamed_response_wrapper( + rules.replace, + ) diff --git a/src/gcore/resources/cdn/resources/shield.py b/src/gcore/resources/cdn/resources/shield.py new file mode 100644 index 00000000..1d7d3bc9 --- /dev/null +++ b/src/gcore/resources/cdn/resources/shield.py @@ -0,0 +1,259 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cdn.resources import shield_replace_params +from ....types.cdn.resources.origin_shielding import OriginShielding + +__all__ = ["ShieldResource", "AsyncShieldResource"] + + +class ShieldResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ShieldResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return ShieldResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ShieldResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return ShieldResourceWithStreamingResponse(self) + + def get( + self, + resource_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginShielding: + """ + Get information about origin shielding. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cdn/resources/{resource_id}/shielding_v2" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/shielding_v2", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OriginShielding, + ) + + def replace( + self, + resource_id: int, + *, + shielding_pop: Optional[int] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> object: + """ + Change origin shielding settings or disabled origin shielding. + + Args: + shielding_pop: Shielding location ID. + + If origin shielding is disabled, the parameter value is **null**. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + f"/cdn/resources/{resource_id}/shielding_v2" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/shielding_v2", + body=maybe_transform({"shielding_pop": shielding_pop}, shield_replace_params.ShieldReplaceParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class AsyncShieldResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncShieldResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncShieldResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncShieldResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncShieldResourceWithStreamingResponse(self) + + async def get( + self, + resource_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OriginShielding: + """ + Get information about origin shielding. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cdn/resources/{resource_id}/shielding_v2" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/shielding_v2", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OriginShielding, + ) + + async def replace( + self, + resource_id: int, + *, + shielding_pop: Optional[int] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> object: + """ + Change origin shielding settings or disabled origin shielding. + + Args: + shielding_pop: Shielding location ID. + + If origin shielding is disabled, the parameter value is **null**. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + f"/cdn/resources/{resource_id}/shielding_v2" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/shielding_v2", + body=await async_maybe_transform( + {"shielding_pop": shielding_pop}, shield_replace_params.ShieldReplaceParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class ShieldResourceWithRawResponse: + def __init__(self, shield: ShieldResource) -> None: + self._shield = shield + + self.get = to_raw_response_wrapper( + shield.get, + ) + self.replace = to_raw_response_wrapper( + shield.replace, + ) + + +class AsyncShieldResourceWithRawResponse: + def __init__(self, shield: AsyncShieldResource) -> None: + self._shield = shield + + self.get = async_to_raw_response_wrapper( + shield.get, + ) + self.replace = async_to_raw_response_wrapper( + shield.replace, + ) + + +class ShieldResourceWithStreamingResponse: + def __init__(self, shield: ShieldResource) -> None: + self._shield = shield + + self.get = to_streamed_response_wrapper( + shield.get, + ) + self.replace = to_streamed_response_wrapper( + shield.replace, + ) + + +class AsyncShieldResourceWithStreamingResponse: + def __init__(self, shield: AsyncShieldResource) -> None: + self._shield = shield + + self.get = async_to_streamed_response_wrapper( + shield.get, + ) + self.replace = async_to_streamed_response_wrapper( + shield.replace, + ) diff --git a/src/gcore/resources/cdn/rule_templates.py b/src/gcore/resources/cdn/rule_templates.py new file mode 100644 index 00000000..a48777d2 --- /dev/null +++ b/src/gcore/resources/cdn/rule_templates.py @@ -0,0 +1,883 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import rule_template_create_params, rule_template_update_params, rule_template_replace_params +from ..._base_client import make_request_options +from ...types.cdn.rule_template import RuleTemplate +from ...types.cdn.rule_template_list import RuleTemplateList + +__all__ = ["RuleTemplatesResource", "AsyncRuleTemplatesResource"] + + +class RuleTemplatesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RuleTemplatesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return RuleTemplatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RuleTemplatesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return RuleTemplatesResourceWithStreamingResponse(self) + + def create( + self, + *, + rule: str, + rule_type: int, + name: str | Omit = omit, + options: rule_template_create_params.Options | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RuleTemplate: + """ + Create rule template + + Args: + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + name: Rule template name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/cdn/resources/rule_templates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/resources/rule_templates", + body=maybe_transform( + { + "rule": rule, + "rule_type": rule_type, + "name": name, + "options": options, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_template_create_params.RuleTemplateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + def update( + self, + rule_template_id: int, + *, + name: str | Omit = omit, + options: rule_template_update_params.Options | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + rule: str | Omit = omit, + rule_type: int | Omit = omit, + weight: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RuleTemplate: + """ + Change rule template + + Args: + name: Rule template name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + body=maybe_transform( + { + "name": name, + "options": options, + "override_origin_protocol": override_origin_protocol, + "rule": rule, + "rule_type": rule_type, + "weight": weight, + }, + rule_template_update_params.RuleTemplateUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RuleTemplateList: + """Get rule templates list""" + return self._get( + "/cdn/resources/rule_templates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/resources/rule_templates", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplateList, + ) + + def delete( + self, + rule_template_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete rule template + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + rule_template_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RuleTemplate: + """ + Get rule template details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + def replace( + self, + rule_template_id: int, + *, + rule: str, + rule_type: int, + name: str | Omit = omit, + options: rule_template_replace_params.Options | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RuleTemplate: + """ + Change rule template + + Args: + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + name: Rule template name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + body=maybe_transform( + { + "rule": rule, + "rule_type": rule_type, + "name": name, + "options": options, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_template_replace_params.RuleTemplateReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + +class AsyncRuleTemplatesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRuleTemplatesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRuleTemplatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRuleTemplatesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncRuleTemplatesResourceWithStreamingResponse(self) + + async def create( + self, + *, + rule: str, + rule_type: int, + name: str | Omit = omit, + options: rule_template_create_params.Options | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RuleTemplate: + """ + Create rule template + + Args: + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + name: Rule template name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/cdn/resources/rule_templates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/resources/rule_templates", + body=await async_maybe_transform( + { + "rule": rule, + "rule_type": rule_type, + "name": name, + "options": options, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_template_create_params.RuleTemplateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + async def update( + self, + rule_template_id: int, + *, + name: str | Omit = omit, + options: rule_template_update_params.Options | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + rule: str | Omit = omit, + rule_type: int | Omit = omit, + weight: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RuleTemplate: + """ + Change rule template + + Args: + name: Rule template name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + body=await async_maybe_transform( + { + "name": name, + "options": options, + "override_origin_protocol": override_origin_protocol, + "rule": rule, + "rule_type": rule_type, + "weight": weight, + }, + rule_template_update_params.RuleTemplateUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RuleTemplateList: + """Get rule templates list""" + return await self._get( + "/cdn/resources/rule_templates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/resources/rule_templates", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplateList, + ) + + async def delete( + self, + rule_template_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete rule template + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + rule_template_id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RuleTemplate: + """ + Get rule template details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + async def replace( + self, + rule_template_id: int, + *, + rule: str, + rule_type: int, + name: str | Omit = omit, + options: rule_template_replace_params.Options | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> RuleTemplate: + """ + Change rule template + + Args: + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + name: Rule template name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + body=await async_maybe_transform( + { + "rule": rule, + "rule_type": rule_type, + "name": name, + "options": options, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_template_replace_params.RuleTemplateReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + +class RuleTemplatesResourceWithRawResponse: + def __init__(self, rule_templates: RuleTemplatesResource) -> None: + self._rule_templates = rule_templates + + self.create = to_raw_response_wrapper( + rule_templates.create, + ) + self.update = to_raw_response_wrapper( + rule_templates.update, + ) + self.list = to_raw_response_wrapper( + rule_templates.list, + ) + self.delete = to_raw_response_wrapper( + rule_templates.delete, + ) + self.get = to_raw_response_wrapper( + rule_templates.get, + ) + self.replace = to_raw_response_wrapper( + rule_templates.replace, + ) + + +class AsyncRuleTemplatesResourceWithRawResponse: + def __init__(self, rule_templates: AsyncRuleTemplatesResource) -> None: + self._rule_templates = rule_templates + + self.create = async_to_raw_response_wrapper( + rule_templates.create, + ) + self.update = async_to_raw_response_wrapper( + rule_templates.update, + ) + self.list = async_to_raw_response_wrapper( + rule_templates.list, + ) + self.delete = async_to_raw_response_wrapper( + rule_templates.delete, + ) + self.get = async_to_raw_response_wrapper( + rule_templates.get, + ) + self.replace = async_to_raw_response_wrapper( + rule_templates.replace, + ) + + +class RuleTemplatesResourceWithStreamingResponse: + def __init__(self, rule_templates: RuleTemplatesResource) -> None: + self._rule_templates = rule_templates + + self.create = to_streamed_response_wrapper( + rule_templates.create, + ) + self.update = to_streamed_response_wrapper( + rule_templates.update, + ) + self.list = to_streamed_response_wrapper( + rule_templates.list, + ) + self.delete = to_streamed_response_wrapper( + rule_templates.delete, + ) + self.get = to_streamed_response_wrapper( + rule_templates.get, + ) + self.replace = to_streamed_response_wrapper( + rule_templates.replace, + ) + + +class AsyncRuleTemplatesResourceWithStreamingResponse: + def __init__(self, rule_templates: AsyncRuleTemplatesResource) -> None: + self._rule_templates = rule_templates + + self.create = async_to_streamed_response_wrapper( + rule_templates.create, + ) + self.update = async_to_streamed_response_wrapper( + rule_templates.update, + ) + self.list = async_to_streamed_response_wrapper( + rule_templates.list, + ) + self.delete = async_to_streamed_response_wrapper( + rule_templates.delete, + ) + self.get = async_to_streamed_response_wrapper( + rule_templates.get, + ) + self.replace = async_to_streamed_response_wrapper( + rule_templates.replace, + ) diff --git a/src/gcore/resources/cdn/shields.py b/src/gcore/resources/cdn/shields.py new file mode 100644 index 00000000..cc6d7c38 --- /dev/null +++ b/src/gcore/resources/cdn/shields.py @@ -0,0 +1,139 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.cdn.shield_list_response import ShieldListResponse + +__all__ = ["ShieldsResource", "AsyncShieldsResource"] + + +class ShieldsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ShieldsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return ShieldsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ShieldsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return ShieldsResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ShieldListResponse: + """Get information about all origin shielding locations available in the account.""" + return self._get( + "/cdn/shieldingpop_v2" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/shieldingpop_v2", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ShieldListResponse, + ) + + +class AsyncShieldsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncShieldsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncShieldsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncShieldsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncShieldsResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ShieldListResponse: + """Get information about all origin shielding locations available in the account.""" + return await self._get( + "/cdn/shieldingpop_v2" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/shieldingpop_v2", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ShieldListResponse, + ) + + +class ShieldsResourceWithRawResponse: + def __init__(self, shields: ShieldsResource) -> None: + self._shields = shields + + self.list = to_raw_response_wrapper( + shields.list, + ) + + +class AsyncShieldsResourceWithRawResponse: + def __init__(self, shields: AsyncShieldsResource) -> None: + self._shields = shields + + self.list = async_to_raw_response_wrapper( + shields.list, + ) + + +class ShieldsResourceWithStreamingResponse: + def __init__(self, shields: ShieldsResource) -> None: + self._shields = shields + + self.list = to_streamed_response_wrapper( + shields.list, + ) + + +class AsyncShieldsResourceWithStreamingResponse: + def __init__(self, shields: AsyncShieldsResource) -> None: + self._shields = shields + + self.list = async_to_streamed_response_wrapper( + shields.list, + ) diff --git a/src/gcore/resources/cdn/statistics.py b/src/gcore/resources/cdn/statistics.py new file mode 100644 index 00000000..113ffff9 --- /dev/null +++ b/src/gcore/resources/cdn/statistics.py @@ -0,0 +1,1408 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import ( + statistic_get_logs_usage_series_params, + statistic_get_shield_usage_series_params, + statistic_get_logs_usage_aggregated_params, + statistic_get_resource_usage_series_params, + statistic_get_shield_usage_aggregated_params, + statistic_get_resource_usage_aggregated_params, +) +from ..._base_client import make_request_options +from ...types.cdn.usage_series_stats import UsageSeriesStats +from ...types.cdn.resource_usage_stats import ResourceUsageStats +from ...types.cdn.logs_aggregated_stats import LogsAggregatedStats +from ...types.cdn.shield_aggregated_stats import ShieldAggregatedStats +from ...types.cdn.resource_aggregated_stats import ResourceAggregatedStats + +__all__ = ["StatisticsResource", "AsyncStatisticsResource"] + + +class StatisticsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StatisticsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return StatisticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StatisticsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return StatisticsResourceWithStreamingResponse(self) + + def get_logs_usage_aggregated( + self, + *, + from_: str, + to: str, + flat: bool | Omit = omit, + group_by: str | Omit = omit, + resource: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsAggregatedStats: + """ + Get the number of CDN resources that used raw logs. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + flat: The waу parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + + group_by: Output data grouping. + + Possible value: + + - **resource** - Data is grouped by CDN resources. + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/statistics/raw_logs_usage/aggregated" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/raw_logs_usage/aggregated", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "flat": flat, + "group_by": group_by, + "resource": resource, + }, + statistic_get_logs_usage_aggregated_params.StatisticGetLogsUsageAggregatedParams, + ), + ), + cast_to=LogsAggregatedStats, + ) + + def get_logs_usage_series( + self, + *, + from_: str, + to: str, + resource: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> UsageSeriesStats: + """ + Get raw logs usage statistics for up to 90 days starting today. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Example: + + - &from=2020-01-01T00:00:00.000 + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Example: + + - &from=2020-01-01T00:00:00.000 + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/statistics/raw_logs_usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/raw_logs_usage/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "resource": resource, + }, + statistic_get_logs_usage_series_params.StatisticGetLogsUsageSeriesParams, + ), + ), + cast_to=UsageSeriesStats, + ) + + def get_resource_usage_aggregated( + self, + *, + from_: str, + metrics: str, + service: str, + to: str, + countries: str | Omit = omit, + flat: bool | Omit = omit, + group_by: str | Omit = omit, + regions: str | Omit = omit, + resource: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ResourceAggregatedStats: + """ + Get aggregated CDN resources statistics. + + Request URL parameters should be added as a query string after the endpoint. + + Aggregated data does not include data for the last two hours. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &from=2018-11-01T00:00:00.000 + - &from=2018-11-01 + + metrics: Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding when used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. + - **`95_percentile`** - Represents the 95th percentile of network bandwidth + usage in bytes per second. This means that 95% of the time, the network + resource usage was below this value. + - **`max_bandwidth`** - The maximum network bandwidth that was used during the + selected time represented in bytes per second. + - **`min_bandwidth`** - The minimum network bandwidth that was used during the + selected time represented in bytes per second. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + + service: Service name. + + Possible value: + + - CDN + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &to=2018-11-01T00:00:00.000 + - &to=2018-11-01 + + countries: Names of countries for which data is displayed. + + English short name from [ISO 3166 standard][1] without the definite article + "the" should be used. + + [1]: https://www.iso.org/obp/ui/#search/code/ + + To request multiple values, use: + + - &countries=france&countries=denmark + + flat: The waу the parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + + group_by: Output data grouping. + + Possible values: + + - **resource** – Data is grouped by CDN resources IDs. + - **region** – Data is grouped by regions of CDN edge servers. + - **country** – Data is grouped by countries of CDN edge servers. + - **vhost** – Data is grouped by resources CNAME. + + To request multiple values, use: + + - &`group_by`=region&`group_by`=resource + + regions: Regions for which data is displayed. + + Possible values: + + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States + - **asia** – Asia + - **au** – Australia + - **latam** – Latin America + - **me** – Middle East + - **africa** - Africa + - **sa** - South America + + resource: CDN resources IDs by which statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + If CDN resource ID is not specified, data related to all CDN resources is + returned. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/statistics/aggregate/stats" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/aggregate/stats", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "metrics": metrics, + "service": service, + "to": to, + "countries": countries, + "flat": flat, + "group_by": group_by, + "regions": regions, + "resource": resource, + }, + statistic_get_resource_usage_aggregated_params.StatisticGetResourceUsageAggregatedParams, + ), + ), + cast_to=ResourceAggregatedStats, + ) + + def get_resource_usage_series( + self, + *, + from_: str, + granularity: str, + metrics: str, + service: str, + to: str, + countries: str | Omit = omit, + group_by: str | Omit = omit, + regions: str | Omit = omit, + resource: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ResourceUsageStats: + """ + Get CDN resources statistics for up to 365 days starting today. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + granularity: Duration of the time blocks into which the data will be divided. + + Possible values: + + - **1m** - available only for up to 1 month in the past. + - **5m** + - **15m** + - **1h** + - **1d** + + metrics: Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding when used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + + service: Service name. + + Possible value: + + - CDN + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + countries: Names of countries for which data should be displayed. English short name from + [ISO 3166 standard][1] without the definite article ("the") should be used. + + [1]: https://www.iso.org/obp/ui/#search/code/ + + To request multiple values, use: + + - &countries=france&countries=denmark + + group_by: Output data grouping. + + Possible values: + + - **resource** – Data is grouped by CDN resources IDs. + - **region** – Data is grouped by regions of CDN edge servers. + - **country** – Data is grouped by countries of CDN edge servers. + - **vhost** – Data is grouped by resources CNAMEs. + + To request multiple values, use: + + - &`group_by`=region&`group_by`=resource + + regions: Regions for which data is displayed. + + Possible values: + + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States + - **asia** – Asia + - **au** – Australia + - **latam** – Latin America + - **me** – Middle East + - **africa** - Africa + - **sa** - South America + + resource: CDN resource IDs. + + To request multiple values, use: + + - &resource=1&resource=2 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "granularity": granularity, + "metrics": metrics, + "service": service, + "to": to, + "countries": countries, + "group_by": group_by, + "regions": regions, + "resource": resource, + }, + statistic_get_resource_usage_series_params.StatisticGetResourceUsageSeriesParams, + ), + ), + cast_to=ResourceUsageStats, + ) + + def get_shield_usage_aggregated( + self, + *, + from_: str, + to: str, + flat: bool | Omit = omit, + group_by: str | Omit = omit, + resource: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ShieldAggregatedStats: + """ + The number of CDN resources that use origin shielding. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + flat: The waу parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + + group_by: Output data grouping. + + Possible value: + + - **resource** - Data is grouped by CDN resource. + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/statistics/shield_usage/aggregated" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/shield_usage/aggregated", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "flat": flat, + "group_by": group_by, + "resource": resource, + }, + statistic_get_shield_usage_aggregated_params.StatisticGetShieldUsageAggregatedParams, + ), + ), + cast_to=ShieldAggregatedStats, + ) + + def get_shield_usage_series( + self, + *, + from_: str, + to: str, + resource: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> UsageSeriesStats: + """ + Get origin shielding usage statistics for up to 365 days starting from today. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/statistics/shield_usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/shield_usage/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "resource": resource, + }, + statistic_get_shield_usage_series_params.StatisticGetShieldUsageSeriesParams, + ), + ), + cast_to=UsageSeriesStats, + ) + + +class AsyncStatisticsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncStatisticsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncStatisticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStatisticsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncStatisticsResourceWithStreamingResponse(self) + + async def get_logs_usage_aggregated( + self, + *, + from_: str, + to: str, + flat: bool | Omit = omit, + group_by: str | Omit = omit, + resource: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsAggregatedStats: + """ + Get the number of CDN resources that used raw logs. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + flat: The waу parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + + group_by: Output data grouping. + + Possible value: + + - **resource** - Data is grouped by CDN resources. + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/statistics/raw_logs_usage/aggregated" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/raw_logs_usage/aggregated", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "flat": flat, + "group_by": group_by, + "resource": resource, + }, + statistic_get_logs_usage_aggregated_params.StatisticGetLogsUsageAggregatedParams, + ), + ), + cast_to=LogsAggregatedStats, + ) + + async def get_logs_usage_series( + self, + *, + from_: str, + to: str, + resource: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> UsageSeriesStats: + """ + Get raw logs usage statistics for up to 90 days starting today. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Example: + + - &from=2020-01-01T00:00:00.000 + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Example: + + - &from=2020-01-01T00:00:00.000 + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/statistics/raw_logs_usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/raw_logs_usage/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "resource": resource, + }, + statistic_get_logs_usage_series_params.StatisticGetLogsUsageSeriesParams, + ), + ), + cast_to=UsageSeriesStats, + ) + + async def get_resource_usage_aggregated( + self, + *, + from_: str, + metrics: str, + service: str, + to: str, + countries: str | Omit = omit, + flat: bool | Omit = omit, + group_by: str | Omit = omit, + regions: str | Omit = omit, + resource: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ResourceAggregatedStats: + """ + Get aggregated CDN resources statistics. + + Request URL parameters should be added as a query string after the endpoint. + + Aggregated data does not include data for the last two hours. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &from=2018-11-01T00:00:00.000 + - &from=2018-11-01 + + metrics: Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding when used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. + - **`95_percentile`** - Represents the 95th percentile of network bandwidth + usage in bytes per second. This means that 95% of the time, the network + resource usage was below this value. + - **`max_bandwidth`** - The maximum network bandwidth that was used during the + selected time represented in bytes per second. + - **`min_bandwidth`** - The minimum network bandwidth that was used during the + selected time represented in bytes per second. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + + service: Service name. + + Possible value: + + - CDN + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &to=2018-11-01T00:00:00.000 + - &to=2018-11-01 + + countries: Names of countries for which data is displayed. + + English short name from [ISO 3166 standard][1] without the definite article + "the" should be used. + + [1]: https://www.iso.org/obp/ui/#search/code/ + + To request multiple values, use: + + - &countries=france&countries=denmark + + flat: The waу the parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + + group_by: Output data grouping. + + Possible values: + + - **resource** – Data is grouped by CDN resources IDs. + - **region** – Data is grouped by regions of CDN edge servers. + - **country** – Data is grouped by countries of CDN edge servers. + - **vhost** – Data is grouped by resources CNAME. + + To request multiple values, use: + + - &`group_by`=region&`group_by`=resource + + regions: Regions for which data is displayed. + + Possible values: + + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States + - **asia** – Asia + - **au** – Australia + - **latam** – Latin America + - **me** – Middle East + - **africa** - Africa + - **sa** - South America + + resource: CDN resources IDs by which statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + If CDN resource ID is not specified, data related to all CDN resources is + returned. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/statistics/aggregate/stats" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/aggregate/stats", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "metrics": metrics, + "service": service, + "to": to, + "countries": countries, + "flat": flat, + "group_by": group_by, + "regions": regions, + "resource": resource, + }, + statistic_get_resource_usage_aggregated_params.StatisticGetResourceUsageAggregatedParams, + ), + ), + cast_to=ResourceAggregatedStats, + ) + + async def get_resource_usage_series( + self, + *, + from_: str, + granularity: str, + metrics: str, + service: str, + to: str, + countries: str | Omit = omit, + group_by: str | Omit = omit, + regions: str | Omit = omit, + resource: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ResourceUsageStats: + """ + Get CDN resources statistics for up to 365 days starting today. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + granularity: Duration of the time blocks into which the data will be divided. + + Possible values: + + - **1m** - available only for up to 1 month in the past. + - **5m** + - **15m** + - **1h** + - **1d** + + metrics: Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding when used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + + service: Service name. + + Possible value: + + - CDN + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + countries: Names of countries for which data should be displayed. English short name from + [ISO 3166 standard][1] without the definite article ("the") should be used. + + [1]: https://www.iso.org/obp/ui/#search/code/ + + To request multiple values, use: + + - &countries=france&countries=denmark + + group_by: Output data grouping. + + Possible values: + + - **resource** – Data is grouped by CDN resources IDs. + - **region** – Data is grouped by regions of CDN edge servers. + - **country** – Data is grouped by countries of CDN edge servers. + - **vhost** – Data is grouped by resources CNAMEs. + + To request multiple values, use: + + - &`group_by`=region&`group_by`=resource + + regions: Regions for which data is displayed. + + Possible values: + + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States + - **asia** – Asia + - **au** – Australia + - **latam** – Latin America + - **me** – Middle East + - **africa** - Africa + - **sa** - South America + + resource: CDN resource IDs. + + To request multiple values, use: + + - &resource=1&resource=2 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "granularity": granularity, + "metrics": metrics, + "service": service, + "to": to, + "countries": countries, + "group_by": group_by, + "regions": regions, + "resource": resource, + }, + statistic_get_resource_usage_series_params.StatisticGetResourceUsageSeriesParams, + ), + ), + cast_to=ResourceUsageStats, + ) + + async def get_shield_usage_aggregated( + self, + *, + from_: str, + to: str, + flat: bool | Omit = omit, + group_by: str | Omit = omit, + resource: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ShieldAggregatedStats: + """ + The number of CDN resources that use origin shielding. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + flat: The waу parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + + group_by: Output data grouping. + + Possible value: + + - **resource** - Data is grouped by CDN resource. + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/statistics/shield_usage/aggregated" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/shield_usage/aggregated", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "flat": flat, + "group_by": group_by, + "resource": resource, + }, + statistic_get_shield_usage_aggregated_params.StatisticGetShieldUsageAggregatedParams, + ), + ), + cast_to=ShieldAggregatedStats, + ) + + async def get_shield_usage_series( + self, + *, + from_: str, + to: str, + resource: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> UsageSeriesStats: + """ + Get origin shielding usage statistics for up to 365 days starting from today. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/statistics/shield_usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/shield_usage/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "resource": resource, + }, + statistic_get_shield_usage_series_params.StatisticGetShieldUsageSeriesParams, + ), + ), + cast_to=UsageSeriesStats, + ) + + +class StatisticsResourceWithRawResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics + + self.get_logs_usage_aggregated = to_raw_response_wrapper( + statistics.get_logs_usage_aggregated, + ) + self.get_logs_usage_series = to_raw_response_wrapper( + statistics.get_logs_usage_series, + ) + self.get_resource_usage_aggregated = to_raw_response_wrapper( + statistics.get_resource_usage_aggregated, + ) + self.get_resource_usage_series = to_raw_response_wrapper( + statistics.get_resource_usage_series, + ) + self.get_shield_usage_aggregated = to_raw_response_wrapper( + statistics.get_shield_usage_aggregated, + ) + self.get_shield_usage_series = to_raw_response_wrapper( + statistics.get_shield_usage_series, + ) + + +class AsyncStatisticsResourceWithRawResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics + + self.get_logs_usage_aggregated = async_to_raw_response_wrapper( + statistics.get_logs_usage_aggregated, + ) + self.get_logs_usage_series = async_to_raw_response_wrapper( + statistics.get_logs_usage_series, + ) + self.get_resource_usage_aggregated = async_to_raw_response_wrapper( + statistics.get_resource_usage_aggregated, + ) + self.get_resource_usage_series = async_to_raw_response_wrapper( + statistics.get_resource_usage_series, + ) + self.get_shield_usage_aggregated = async_to_raw_response_wrapper( + statistics.get_shield_usage_aggregated, + ) + self.get_shield_usage_series = async_to_raw_response_wrapper( + statistics.get_shield_usage_series, + ) + + +class StatisticsResourceWithStreamingResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics + + self.get_logs_usage_aggregated = to_streamed_response_wrapper( + statistics.get_logs_usage_aggregated, + ) + self.get_logs_usage_series = to_streamed_response_wrapper( + statistics.get_logs_usage_series, + ) + self.get_resource_usage_aggregated = to_streamed_response_wrapper( + statistics.get_resource_usage_aggregated, + ) + self.get_resource_usage_series = to_streamed_response_wrapper( + statistics.get_resource_usage_series, + ) + self.get_shield_usage_aggregated = to_streamed_response_wrapper( + statistics.get_shield_usage_aggregated, + ) + self.get_shield_usage_series = to_streamed_response_wrapper( + statistics.get_shield_usage_series, + ) + + +class AsyncStatisticsResourceWithStreamingResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics + + self.get_logs_usage_aggregated = async_to_streamed_response_wrapper( + statistics.get_logs_usage_aggregated, + ) + self.get_logs_usage_series = async_to_streamed_response_wrapper( + statistics.get_logs_usage_series, + ) + self.get_resource_usage_aggregated = async_to_streamed_response_wrapper( + statistics.get_resource_usage_aggregated, + ) + self.get_resource_usage_series = async_to_streamed_response_wrapper( + statistics.get_resource_usage_series, + ) + self.get_shield_usage_aggregated = async_to_streamed_response_wrapper( + statistics.get_shield_usage_aggregated, + ) + self.get_shield_usage_series = async_to_streamed_response_wrapper( + statistics.get_shield_usage_series, + ) diff --git a/src/gcore/resources/cdn/trusted_ca_certificates.py b/src/gcore/resources/cdn/trusted_ca_certificates.py new file mode 100644 index 00000000..b8f83ff3 --- /dev/null +++ b/src/gcore/resources/cdn/trusted_ca_certificates.py @@ -0,0 +1,592 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import ( + trusted_ca_certificate_list_params, + trusted_ca_certificate_create_params, + trusted_ca_certificate_replace_params, +) +from ..._base_client import make_request_options +from ...types.cdn.ca_certificate import CaCertificate +from ...types.cdn.ca_certificate_list import CaCertificateList + +__all__ = ["TrustedCaCertificatesResource", "AsyncTrustedCaCertificatesResource"] + + +class TrustedCaCertificatesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TrustedCaCertificatesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return TrustedCaCertificatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TrustedCaCertificatesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return TrustedCaCertificatesResourceWithStreamingResponse(self) + + def create( + self, + *, + name: str, + ssl_certificate: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CaCertificate: + """ + Add a trusted CA certificate to verify an origin. + + Enter all strings of the certificate in one string parameter. Each string should + be separated by the "\n" symbol. + + Args: + name: CA certificate name. + + It must be unique. + + ssl_certificate: Public part of the CA certificate. + + It must be in the PEM format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/cdn/sslCertificates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/sslCertificates", + body=maybe_transform( + { + "name": name, + "ssl_certificate": ssl_certificate, + }, + trusted_ca_certificate_create_params.TrustedCaCertificateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CaCertificate, + ) + + def list( + self, + *, + automated: bool | Omit = omit, + resource_id: int | Omit = omit, + validity_not_after_lte: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CaCertificateList: + """ + Get list of trusted CA certificates used to verify an origin. + + Args: + automated: How the certificate was issued. + + Possible values: + + - **true** – Certificate was issued automatically. + - **false** – Certificate was added by a user. + + resource_id: CDN resource ID for which the certificates are requested. + + validity_not_after_lte: Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, + UTC.) + + Response will contain certificates valid until the specified time. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/cdn/sslCertificates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/sslCertificates", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "automated": automated, + "resource_id": resource_id, + "validity_not_after_lte": validity_not_after_lte, + }, + trusted_ca_certificate_list_params.TrustedCaCertificateListParams, + ), + ), + cast_to=CaCertificateList, + ) + + def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete trusted CA certificate + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/sslCertificates/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslCertificates/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CaCertificate: + """ + Get trusted CA certificate details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/cdn/sslCertificates/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslCertificates/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CaCertificate, + ) + + def replace( + self, + id: int, + *, + name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CaCertificate: + """ + Change trusted CA certificate + + Args: + name: CA certificate name. + + It must be unique. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + f"/cdn/sslCertificates/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslCertificates/{id}", + body=maybe_transform( + {"name": name}, trusted_ca_certificate_replace_params.TrustedCaCertificateReplaceParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CaCertificate, + ) + + +class AsyncTrustedCaCertificatesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTrustedCaCertificatesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncTrustedCaCertificatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTrustedCaCertificatesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncTrustedCaCertificatesResourceWithStreamingResponse(self) + + async def create( + self, + *, + name: str, + ssl_certificate: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CaCertificate: + """ + Add a trusted CA certificate to verify an origin. + + Enter all strings of the certificate in one string parameter. Each string should + be separated by the "\n" symbol. + + Args: + name: CA certificate name. + + It must be unique. + + ssl_certificate: Public part of the CA certificate. + + It must be in the PEM format. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/cdn/sslCertificates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/sslCertificates", + body=await async_maybe_transform( + { + "name": name, + "ssl_certificate": ssl_certificate, + }, + trusted_ca_certificate_create_params.TrustedCaCertificateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CaCertificate, + ) + + async def list( + self, + *, + automated: bool | Omit = omit, + resource_id: int | Omit = omit, + validity_not_after_lte: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CaCertificateList: + """ + Get list of trusted CA certificates used to verify an origin. + + Args: + automated: How the certificate was issued. + + Possible values: + + - **true** – Certificate was issued automatically. + - **false** – Certificate was added by a user. + + resource_id: CDN resource ID for which the certificates are requested. + + validity_not_after_lte: Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, + UTC.) + + Response will contain certificates valid until the specified time. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/cdn/sslCertificates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/sslCertificates", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "automated": automated, + "resource_id": resource_id, + "validity_not_after_lte": validity_not_after_lte, + }, + trusted_ca_certificate_list_params.TrustedCaCertificateListParams, + ), + ), + cast_to=CaCertificateList, + ) + + async def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete trusted CA certificate + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/sslCertificates/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslCertificates/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CaCertificate: + """ + Get trusted CA certificate details + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/cdn/sslCertificates/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslCertificates/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CaCertificate, + ) + + async def replace( + self, + id: int, + *, + name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CaCertificate: + """ + Change trusted CA certificate + + Args: + name: CA certificate name. + + It must be unique. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + f"/cdn/sslCertificates/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslCertificates/{id}", + body=await async_maybe_transform( + {"name": name}, trusted_ca_certificate_replace_params.TrustedCaCertificateReplaceParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CaCertificate, + ) + + +class TrustedCaCertificatesResourceWithRawResponse: + def __init__(self, trusted_ca_certificates: TrustedCaCertificatesResource) -> None: + self._trusted_ca_certificates = trusted_ca_certificates + + self.create = to_raw_response_wrapper( + trusted_ca_certificates.create, + ) + self.list = to_raw_response_wrapper( + trusted_ca_certificates.list, + ) + self.delete = to_raw_response_wrapper( + trusted_ca_certificates.delete, + ) + self.get = to_raw_response_wrapper( + trusted_ca_certificates.get, + ) + self.replace = to_raw_response_wrapper( + trusted_ca_certificates.replace, + ) + + +class AsyncTrustedCaCertificatesResourceWithRawResponse: + def __init__(self, trusted_ca_certificates: AsyncTrustedCaCertificatesResource) -> None: + self._trusted_ca_certificates = trusted_ca_certificates + + self.create = async_to_raw_response_wrapper( + trusted_ca_certificates.create, + ) + self.list = async_to_raw_response_wrapper( + trusted_ca_certificates.list, + ) + self.delete = async_to_raw_response_wrapper( + trusted_ca_certificates.delete, + ) + self.get = async_to_raw_response_wrapper( + trusted_ca_certificates.get, + ) + self.replace = async_to_raw_response_wrapper( + trusted_ca_certificates.replace, + ) + + +class TrustedCaCertificatesResourceWithStreamingResponse: + def __init__(self, trusted_ca_certificates: TrustedCaCertificatesResource) -> None: + self._trusted_ca_certificates = trusted_ca_certificates + + self.create = to_streamed_response_wrapper( + trusted_ca_certificates.create, + ) + self.list = to_streamed_response_wrapper( + trusted_ca_certificates.list, + ) + self.delete = to_streamed_response_wrapper( + trusted_ca_certificates.delete, + ) + self.get = to_streamed_response_wrapper( + trusted_ca_certificates.get, + ) + self.replace = to_streamed_response_wrapper( + trusted_ca_certificates.replace, + ) + + +class AsyncTrustedCaCertificatesResourceWithStreamingResponse: + def __init__(self, trusted_ca_certificates: AsyncTrustedCaCertificatesResource) -> None: + self._trusted_ca_certificates = trusted_ca_certificates + + self.create = async_to_streamed_response_wrapper( + trusted_ca_certificates.create, + ) + self.list = async_to_streamed_response_wrapper( + trusted_ca_certificates.list, + ) + self.delete = async_to_streamed_response_wrapper( + trusted_ca_certificates.delete, + ) + self.get = async_to_streamed_response_wrapper( + trusted_ca_certificates.get, + ) + self.replace = async_to_streamed_response_wrapper( + trusted_ca_certificates.replace, + ) diff --git a/src/gcore/types/cdn/__init__.py b/src/gcore/types/cdn/__init__.py new file mode 100644 index 00000000..66a8669b --- /dev/null +++ b/src/gcore/types/cdn/__init__.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .ssl_detail import SslDetail as SslDetail +from .cdn_account import CdnAccount as CdnAccount +from .cdn_metrics import CdnMetrics as CdnMetrics +from .cdn_resource import CdnResource as CdnResource +from .purge_status import PurgeStatus as PurgeStatus +from .cdn_log_entry import CdnLogEntry as CdnLogEntry +from .origin_groups import OriginGroups as OriginGroups +from .rule_template import RuleTemplate as RuleTemplate +from .ca_certificate import CaCertificate as CaCertificate +from .public_ip_list import PublicIPList as PublicIPList +from .log_list_params import LogListParams as LogListParams +from .ssl_detail_list import SslDetailList as SslDetailList +from .network_capacity import NetworkCapacity as NetworkCapacity +from .cdn_resource_list import CdnResourceList as CdnResourceList +from .cdn_account_limits import CdnAccountLimits as CdnAccountLimits +from .cdn_metrics_groups import CdnMetricsGroups as CdnMetricsGroups +from .cdn_metrics_values import CdnMetricsValues as CdnMetricsValues +from .metric_list_params import MetricListParams as MetricListParams +from .origin_groups_list import OriginGroupsList as OriginGroupsList +from .rule_template_list import RuleTemplateList as RuleTemplateList +from .ssl_request_status import SslRequestStatus as SslRequestStatus +from .usage_series_stats import UsageSeriesStats as UsageSeriesStats +from .ca_certificate_list import CaCertificateList as CaCertificateList +from .cdn_audit_log_entry import CdnAuditLogEntry as CdnAuditLogEntry +from .log_download_params import LogDownloadParams as LogDownloadParams +from .public_network_list import PublicNetworkList as PublicNetworkList +from .resource_list_params import ResourceListParams as ResourceListParams +from .resource_usage_stats import ResourceUsageStats as ResourceUsageStats +from .shield_list_response import ShieldListResponse as ShieldListResponse +from .audit_log_list_params import AuditLogListParams as AuditLogListParams +from .logs_aggregated_stats import LogsAggregatedStats as LogsAggregatedStats +from .resource_purge_params import ResourcePurgeParams as ResourcePurgeParams +from .cdn_available_features import CdnAvailableFeatures as CdnAvailableFeatures +from .resource_create_params import ResourceCreateParams as ResourceCreateParams +from .resource_update_params import ResourceUpdateParams as ResourceUpdateParams +from .certificate_list_params import CertificateListParams as CertificateListParams +from .resource_replace_params import ResourceReplaceParams as ResourceReplaceParams +from .shield_aggregated_stats import ShieldAggregatedStats as ShieldAggregatedStats +from .logs_uploader_validation import LogsUploaderValidation as LogsUploaderValidation +from .origin_group_list_params import OriginGroupListParams as OriginGroupListParams +from .resource_prefetch_params import ResourcePrefetchParams as ResourcePrefetchParams +from .cdn_update_account_params import CdnUpdateAccountParams as CdnUpdateAccountParams +from .certificate_create_params import CertificateCreateParams as CertificateCreateParams +from .resource_aggregated_stats import ResourceAggregatedStats as ResourceAggregatedStats +from .certificate_replace_params import CertificateReplaceParams as CertificateReplaceParams +from .origin_group_create_params import OriginGroupCreateParams as OriginGroupCreateParams +from .origin_group_update_params import OriginGroupUpdateParams as OriginGroupUpdateParams +from .origin_group_replace_params import OriginGroupReplaceParams as OriginGroupReplaceParams +from .rule_template_create_params import RuleTemplateCreateParams as RuleTemplateCreateParams +from .rule_template_update_params import RuleTemplateUpdateParams as RuleTemplateUpdateParams +from .rule_template_replace_params import RuleTemplateReplaceParams as RuleTemplateReplaceParams +from .certificate_get_status_params import CertificateGetStatusParams as CertificateGetStatusParams +from .cdn_list_purge_statuses_params import CdnListPurgeStatusesParams as CdnListPurgeStatusesParams +from .trusted_ca_certificate_list_params import TrustedCaCertificateListParams as TrustedCaCertificateListParams +from .trusted_ca_certificate_create_params import TrustedCaCertificateCreateParams as TrustedCaCertificateCreateParams +from .trusted_ca_certificate_replace_params import ( + TrustedCaCertificateReplaceParams as TrustedCaCertificateReplaceParams, +) +from .statistic_get_logs_usage_series_params import ( + StatisticGetLogsUsageSeriesParams as StatisticGetLogsUsageSeriesParams, +) +from .statistic_get_shield_usage_series_params import ( + StatisticGetShieldUsageSeriesParams as StatisticGetShieldUsageSeriesParams, +) +from .statistic_get_logs_usage_aggregated_params import ( + StatisticGetLogsUsageAggregatedParams as StatisticGetLogsUsageAggregatedParams, +) +from .statistic_get_resource_usage_series_params import ( + StatisticGetResourceUsageSeriesParams as StatisticGetResourceUsageSeriesParams, +) +from .statistic_get_shield_usage_aggregated_params import ( + StatisticGetShieldUsageAggregatedParams as StatisticGetShieldUsageAggregatedParams, +) +from .statistic_get_resource_usage_aggregated_params import ( + StatisticGetResourceUsageAggregatedParams as StatisticGetResourceUsageAggregatedParams, +) diff --git a/src/gcore/types/cdn/audit_log_list_params.py b/src/gcore/types/cdn/audit_log_list_params.py new file mode 100644 index 00000000..95024e59 --- /dev/null +++ b/src/gcore/types/cdn/audit_log_list_params.py @@ -0,0 +1,73 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["AuditLogListParams"] + + +class AuditLogListParams(TypedDict, total=False): + client_id: int + """Client ID.""" + + limit: int + """Maximum number of items in response.""" + + max_requested_at: str + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + You can specify a date with a time separated by a space, or just a date. + + Examples: + + - &`max_requested_at`=2021-05-05 12:00:00 + - &`max_requested_at`=2021-05-05 + """ + + method: str + """HTTP method type of requests. + + Use upper case only. + + Example: + + - ?method=DELETE + """ + + min_requested_at: str + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + You can specify a date with a time separated by a space, or just a date. + + Examples: + + - &`min_requested_at`=2021-05-05 12:00:00 + - &`min_requested_at`=2021-05-05 + """ + + offset: int + """Offset relative to the beginning of activity logs.""" + + path: str + """Path that a requested URL should contain.""" + + remote_ip_address: str + """IP address or part of it from which requests are sent.""" + + status_code: int + """Status code returned in the response. + + Specify the first numbers of a status code to get requests for a group of status + codes. + + To filter the activity logs by 4xx codes, use: + + - &`status_code`=4 - + """ + + token_id: int + """Permanent API token ID. Requests made with this token should be displayed.""" + + user_id: int + """User ID.""" diff --git a/src/gcore/types/cdn/ca_certificate.py b/src/gcore/types/cdn/ca_certificate.py new file mode 100644 index 00000000..bc2cba57 --- /dev/null +++ b/src/gcore/types/cdn/ca_certificate.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["CaCertificate"] + + +class CaCertificate(BaseModel): + id: Optional[int] = None + """CA certificate ID.""" + + cert_issuer: Optional[str] = None + """Name of the certification center that issued the CA certificate.""" + + cert_subject_alt: Optional[str] = None + """Alternative domain names that the CA certificate secures.""" + + cert_subject_cn: Optional[str] = None + """Domain name that the CA certificate secures.""" + + deleted: Optional[bool] = None + """Defines whether the certificate has been deleted. Parameter is **deprecated**. + + Possible values: + + - **true** - Certificate has been deleted. + - **false** - Certificate has not been deleted. + """ + + has_related_resources: Optional[bool] = FieldInfo(alias="hasRelatedResources", default=None) + """Defines whether the CA certificate is used by a CDN resource. + + Possible values: + + - **true** - Certificate is used by a CDN resource. + - **false** - Certificate is not used by a CDN resource. + """ + + name: Optional[str] = None + """CA certificate name.""" + + ssl_certificate_chain: Optional[str] = FieldInfo(alias="sslCertificateChain", default=None) + """Parameter is **deprecated**.""" + + validity_not_after: Optional[str] = None + """Date when the CA certificate become untrusted (ISO 8601/RFC 3339 format, UTC.)""" + + validity_not_before: Optional[str] = None + """Date when the CA certificate become valid (ISO 8601/RFC 3339 format, UTC.)""" diff --git a/src/gcore/types/cdn/ca_certificate_list.py b/src/gcore/types/cdn/ca_certificate_list.py new file mode 100644 index 00000000..1f56b642 --- /dev/null +++ b/src/gcore/types/cdn/ca_certificate_list.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .ca_certificate import CaCertificate + +__all__ = ["CaCertificateList"] + +CaCertificateList: TypeAlias = List[CaCertificate] diff --git a/src/gcore/types/cdn/cdn_account.py b/src/gcore/types/cdn/cdn_account.py new file mode 100644 index 00000000..44e8165e --- /dev/null +++ b/src/gcore/types/cdn/cdn_account.py @@ -0,0 +1,86 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["CdnAccount", "Service"] + + +class Service(BaseModel): + enabled: Optional[bool] = None + """Defines whether the CDN service is activated. + + Possible values: + + - **true** - Service is activated. + - **false** - Service is not activated. + """ + + status: Optional[str] = None + """CDN service status. + + Possible values: + + - **new** - CDN service is not activated. + - **trial** - Free trial is in progress. + - **trialend** - Free trial has ended and CDN service is stopped. All CDN + resources are suspended. + - **activating** - CDN service is being activated. It can take up to 15 minutes. + - **active** - CDN service is active. + - **paused** - CDN service is stopped. All CDN resources are suspended. + - **deleted** - CDN service is stopped. All CDN resources are deleted. + """ + + updated: Optional[str] = None + """Date of the last CDN service status update (ISO 8601/RFC 3339 format, UTC.)""" + + +class CdnAccount(BaseModel): + id: Optional[int] = None + """Account ID.""" + + auto_suspend_enabled: Optional[bool] = None + """Defines whether resources will be deactivated automatically by inactivity. + + Possible values: + + - **true** - Resources will be deactivated. + - **false** - Resources will not be deactivated. + """ + + cdn_resources_rules_max_count: Optional[int] = None + """Limit on the number of rules for each CDN resource.""" + + cname: Optional[str] = None + """Domain zone to which a CNAME record of your CDN resources should be pointed.""" + + created: Optional[str] = None + """ + Date of the first synchronization with the Platform (ISO 8601/RFC 3339 format, + UTC.) + """ + + service: Optional[Service] = None + """Information about the CDN service status.""" + + updated: Optional[str] = None + """ + Date of the last update of information about CDN service (ISO 8601/RFC 3339 + format, UTC.) + """ + + use_balancer: Optional[bool] = None + """Defines whether custom balancing is used for content delivery. + + Possible values: + + - **true** - Custom balancing is used for content delivery. + - **false** - Custom balancing is not used for content delivery. + """ + + utilization_level: Optional[int] = None + """CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + """ diff --git a/src/gcore/types/cdn/cdn_account_limits.py b/src/gcore/types/cdn/cdn_account_limits.py new file mode 100644 index 00000000..efaf384d --- /dev/null +++ b/src/gcore/types/cdn/cdn_account_limits.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["CdnAccountLimits"] + + +class CdnAccountLimits(BaseModel): + id: Optional[int] = None + """Account ID.""" + + origins_in_group_limit: Optional[int] = None + """ + Maximum number of origins that can be added to the origin group on your tariff + plan. + """ + + resources_limit: Optional[int] = None + """Maximum number of CDN resources that can be created on your tariff plan.""" + + rules_limit: Optional[int] = None + """ + Maximum number of rules that can be created per CDN resource on your tariff + plan. + """ diff --git a/src/gcore/types/cdn/cdn_audit_log_entry.py b/src/gcore/types/cdn/cdn_audit_log_entry.py new file mode 100644 index 00000000..28064cb6 --- /dev/null +++ b/src/gcore/types/cdn/cdn_audit_log_entry.py @@ -0,0 +1,66 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["CdnAuditLogEntry", "Action"] + + +class Action(BaseModel): + action_type: Optional[str] = None + """Type of change. + + Possible values: + + - **D** - Object is deleted. + - **C** - Object is created. + - **U** - Object is updated. + """ + + state_after_request: Optional[object] = None + """JSON representation of object after the request.""" + + state_before_request: Optional[object] = None + """JSON representation of object before the request.""" + + +class CdnAuditLogEntry(BaseModel): + id: Optional[int] = None + """Activity logs record ID.""" + + actions: Optional[List[Action]] = None + """State of a requested object before and after the request.""" + + client_id: Optional[int] = None + """ID of the client who made the request.""" + + data: Optional[object] = None + """Request body.""" + + host: Optional[str] = None + """Host from which the request was made.""" + + method: Optional[str] = None + """Request HTTP method.""" + + path: Optional[str] = None + """Request URL.""" + + query_params: Optional[str] = None + """Request parameters.""" + + remote_ip_address: Optional[str] = None + """IP address from which the request was made.""" + + requested_at: Optional[str] = None + """Date and time when the request was made.""" + + status_code: Optional[int] = None + """Status code that is returned in the response.""" + + token_id: Optional[int] = None + """Permanent API token ID with which the request was made.""" + + user_id: Optional[int] = None + """ID of the user who made the request.""" diff --git a/src/gcore/types/cdn/cdn_available_features.py b/src/gcore/types/cdn/cdn_available_features.py new file mode 100644 index 00000000..dead1cdc --- /dev/null +++ b/src/gcore/types/cdn/cdn_available_features.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["CdnAvailableFeatures", "FreeFeature", "PaidFeature"] + + +class FreeFeature(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8601/RFC 3339 format, UTC.)""" + + feature_id: Optional[int] = None + """Feature ID.""" + + free_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + name: Optional[str] = None + """Feature name.""" + + +class PaidFeature(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8601/RFC 3339 format, UTC.)""" + + feature_id: Optional[int] = None + """Feature ID.""" + + name: Optional[str] = None + """Feature name.""" + + paid_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + +class CdnAvailableFeatures(BaseModel): + id: Optional[int] = None + """Account ID.""" + + free_features: Optional[List[FreeFeature]] = None + """Free features available for your account.""" + + paid_features: Optional[List[PaidFeature]] = None + """Paid features available for your account.""" diff --git a/src/gcore/types/cdn/cdn_list_purge_statuses_params.py b/src/gcore/types/cdn/cdn_list_purge_statuses_params.py new file mode 100644 index 00000000..3c725a88 --- /dev/null +++ b/src/gcore/types/cdn/cdn_list_purge_statuses_params.py @@ -0,0 +1,67 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["CdnListPurgeStatusesParams"] + + +class CdnListPurgeStatusesParams(TypedDict, total=False): + cname: str + """Purges associated with a specific resource CNAME. + + Example: + + - &cname=example.com + """ + + from_created: str + """ + Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Examples: + + - &`from_created`=2021-06-14T00:00:00Z + - &`from_created`=2021-06-14T00:00:00.000Z + """ + + limit: int + """Maximum number of purges in the response.""" + + offset: int + """ + Number of purge requests in the response to skip starting from the beginning of + the requested period. + """ + + purge_type: str + """Purge requests with a certain purge type. + + Possible values: + + - **`purge_by_pattern`** - Purge by Pattern. + - **`purge_by_url`** - Purge by URL. + - **`purge_all`** - Purge All. + """ + + status: str + """Purge with a certain status. + + Possible values: + + - **In progress** + - **Successful** + - **Failed** + - **Status report disabled** + """ + + to_created: str + """End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &`to_created`=2021-06-15T00:00:00Z + - &`to_created`=2021-06-15T00:00:00.000Z + """ diff --git a/src/gcore/types/cdn/cdn_log_entry.py b/src/gcore/types/cdn/cdn_log_entry.py new file mode 100644 index 00000000..5e13d3ac --- /dev/null +++ b/src/gcore/types/cdn/cdn_log_entry.py @@ -0,0 +1,70 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["CdnLogEntry", "Data", "Meta"] + + +class Data(BaseModel): + cache_status: Optional[str] = None + """Cache status: HIT, MISS, etc.""" + + client_ip: Optional[str] = None + """IP address from that the request was received.""" + + cname: Optional[str] = None + """CDN resource custom domain.""" + + datacenter: Optional[str] = None + """Data center where the request was processed.""" + + method: Optional[str] = None + """HTTP method used in the request.""" + + path: Optional[str] = None + """Path requested.""" + + referer: Optional[str] = None + """Value of 'Referer' header.""" + + resource_id: Optional[int] = None + """CDN resource ID.""" + + sent_http_content_type: Optional[str] = None + """ + Value of the Content-Type HTTP header, indicating the MIME type of the resource + being transmitted. + """ + + size: Optional[int] = None + """Response size in bytes.""" + + status: Optional[int] = None + """HTTP status code.""" + + tcpinfo_rtt: Optional[int] = None + """ + Time required to transmit a complete TCP segment: from the first bit to the + last. + """ + + timestamp: Optional[int] = None + """Log timestamp.""" + + user_agent: Optional[str] = None + """Value of 'User-Agent' header.""" + + +class Meta(BaseModel): + count: Optional[int] = None + """Total number of records which match given parameters.""" + + +class CdnLogEntry(BaseModel): + data: Optional[List[Data]] = None + """Contains requested logs.""" + + meta: Optional[Meta] = None + """Contains meta-information.""" diff --git a/src/gcore/types/cdn/cdn_metrics.py b/src/gcore/types/cdn/cdn_metrics.py new file mode 100644 index 00000000..1922d524 --- /dev/null +++ b/src/gcore/types/cdn/cdn_metrics.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel +from .cdn_metrics_groups import CdnMetricsGroups +from .cdn_metrics_values import CdnMetricsValues + +__all__ = ["CdnMetrics", "Data"] + +Data: TypeAlias = Union[CdnMetricsValues, CdnMetricsGroups] + + +class CdnMetrics(BaseModel): + data: Optional[Data] = None + """ + If no grouping was requested then "data" holds an array of metric values. If at + least one field is specified in "`group_by`" then "data" is an object whose + properties are groups, which may include other groups; the last group will hold + array of metrics values. + """ diff --git a/src/gcore/types/cdn/cdn_metrics_groups.py b/src/gcore/types/cdn/cdn_metrics_groups.py new file mode 100644 index 00000000..e808f0bd --- /dev/null +++ b/src/gcore/types/cdn/cdn_metrics_groups.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .cdn_metrics_values import CdnMetricsValues + +__all__ = ["CdnMetricsGroups"] + + +class CdnMetricsGroups(BaseModel): + group: Optional[CdnMetricsValues] = None + """List of requested metrics sorted by timestamp in ascending order.""" diff --git a/src/gcore/types/cdn/cdn_metrics_values.py b/src/gcore/types/cdn/cdn_metrics_values.py new file mode 100644 index 00000000..d436ae54 --- /dev/null +++ b/src/gcore/types/cdn/cdn_metrics_values.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["CdnMetricsValues", "CdnMetricsValueItem"] + + +class CdnMetricsValueItem(BaseModel): + metric: Optional[float] = None + """Metrics value.""" + + timestamp: Optional[int] = None + """Start timestamp of interval.""" + + +CdnMetricsValues: TypeAlias = List[CdnMetricsValueItem] diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py new file mode 100644 index 00000000..978b7f64 --- /dev/null +++ b/src/gcore/types/cdn/cdn_resource.py @@ -0,0 +1,1977 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "CdnResource", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsHttp3Enabled", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsTlsVersions", + "OptionsUseDefaultLeChain", + "OptionsUseDns01LeChallenge", + "OptionsUseRsaLeCert", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class OptionsAllowedHTTPMethods(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]] + + +class OptionsBotProtectionBotChallenge(BaseModel): + enabled: Optional[bool] = None + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(BaseModel): + bot_challenge: OptionsBotProtectionBotChallenge + """Controls the bot challenge module state.""" + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + + +class OptionsCors(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: Optional[bool] = None + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Literal["allow", "deny"] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Optional[Dict[str, str]] = None + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: Optional[str] = None + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: Optional[str] = None + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: Optional[OptionsFastedgeOnRequestBody] = None + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: Optional[OptionsFastedgeOnRequestHeaders] = None + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: Optional[OptionsFastedgeOnResponseBody] = None + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: Optional[OptionsFastedgeOnResponseHeaders] = None + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(BaseModel): + codes: List[Literal[301, 302, 303, 307, 308]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(BaseModel): + end_time: str + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: str + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: Optional[str] = None + """Time zone used to calculate time.""" + + +class OptionsForceReturn(BaseModel): + body: str + """URL for redirection or text.""" + + code: int + """Status code value.""" + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] = None + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Host Header value.""" + + +class OptionsHttp3Enabled(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsIgnoreCookie(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: Optional[bool] = None + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: Optional[bool] = None + """Enables or disables compression without quality loss for PNG format.""" + + quality: Optional[int] = None + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: Optional[bool] = None + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Literal["allow", "deny"] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Literal["static", "dynamic"] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: Optional[int] = None + """Amount of downloaded data after which the user will be rate limited.""" + + speed: Optional[int] = None + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: List[str] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: List[str] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Literal["allow", "deny"] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: int + """Maximum request rate.""" + + burst: Optional[int] = None + + delay: Optional[int] = None + + rate_unit: Optional[Literal["r/s", "r/m"]] = None + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: List[str] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Literal["hide", "show"] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(BaseModel): + body: str + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Optional[Literal["break", "last", "redirect", "permanent"]] = None + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Optional[str] = None + """Key generated on your side that will be used for URL signing.""" + + type: Optional[Literal[0, 2]] = None + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(BaseModel): + custom_hostname: str + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Optional[Literal["dynamic", "custom"]] = None + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(BaseModel): + name: str + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: List[str] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: Optional[bool] = None + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[OptionsStaticResponseHeadersValue] + + +class OptionsStaticHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Dict[str, str] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Dict[str, str] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsTlsVersions(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[Literal["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"]] + """List of SSL/TLS protocol versions (case sensitive).""" + + +class OptionsUseDefaultLeChain(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Default Let's Encrypt certificate chain. This is a deprecated + version, use it only for compatibilities with Android devices 7.1.1 or lower. + - **false** - Alternative Let's Encrypt certificate chain. + """ + + +class OptionsUseDns01LeChallenge(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - DNS-01 challenge is used to issue Let's Encrypt certificate. + - **false** - HTTP-01 challenge is used to issue Let's Encrypt certificate. + """ + + +class OptionsUseRsaLeCert(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - RSA Let's Encrypt certificate. + - **false** - ECDSA Let's Encrypt certificate. + """ + + +class OptionsUserAgentACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Literal["allow", "deny"] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(BaseModel): + allowed_http_methods: Optional[OptionsAllowedHTTPMethods] = FieldInfo(alias="allowedHttpMethods", default=None) + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] = None + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] = None + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] = None + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] = None + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] = None + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] = None + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] = None + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] = None + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] = None + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] = None + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] = None + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] = None + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] = None + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] = None + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Optional[OptionsGzipOn] = FieldInfo(alias="gzipOn", default=None) + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Optional[OptionsHostHeader] = FieldInfo(alias="hostHeader", default=None) + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + http3_enabled: Optional[OptionsHttp3Enabled] = None + """Enables HTTP/3 protocol for content delivery. + + `http3_enabled` option works only with `"sslEnabled": true`. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] = None + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Optional[OptionsIgnoreQueryString] = FieldInfo(alias="ignoreQueryString", default=None) + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] = None + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] = None + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] = None + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] = None + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] = None + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] = None + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] = None + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] = None + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] = None + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] = None + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] = None + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] = None + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] = None + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] = None + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] = None + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] = None + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] = None + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] = None + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] = None + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] = None + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] = None + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Optional[OptionsStaticHeaders] = FieldInfo(alias="staticHeaders", default=None) + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Optional[OptionsStaticRequestHeaders] = FieldInfo( + alias="staticRequestHeaders", default=None + ) + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + tls_versions: Optional[OptionsTlsVersions] = None + """ + List of SSL/TLS protocol versions allowed for HTTPS connections from end users + to the domain. + + When the option is disabled, all protocols versions are allowed. + """ + + use_default_le_chain: Optional[OptionsUseDefaultLeChain] = None + """Let's Encrypt certificate chain. + + The specified chain will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + use_dns01_le_challenge: Optional[OptionsUseDns01LeChallenge] = None + """DNS-01 challenge to issue a Let's Encrypt certificate for the resource. + + DNS service should be activated to enable this option. + """ + + use_rsa_le_cert: Optional[OptionsUseRsaLeCert] = None + """RSA Let's Encrypt certificate type for the CDN resource. + + The specified value will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] = None + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] = None + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] = None + """Enables or disables WebSockets connections to an origin server.""" + + +class CdnResource(BaseModel): + id: Optional[int] = None + """CDN resource ID.""" + + active: Optional[bool] = None + """Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + """ + + can_purge_by_urls: Optional[bool] = None + """Defines whether the CDN resource can be used for purge by URLs feature. + + It's available only in case the CDN resource has enabled `ignore_vary_header` + option. + """ + + client: Optional[int] = None + """ID of an account to which the CDN resource belongs.""" + + cname: Optional[str] = None + """Delivery domains that will be used for content delivery through a CDN. + + Delivery domains should be added to your DNS settings. + """ + + created: Optional[str] = None + """Date of CDN resource creation.""" + + deleted: Optional[bool] = None + """Defines whether CDN resource has been deleted. + + Possible values: + + - **true** - CDN resource is deleted. + - **false** - CDN resource is not deleted. + """ + + description: Optional[str] = None + """Optional comment describing the CDN resource.""" + + enabled: Optional[bool] = None + """Enables or disables a CDN resource change by a user. + + Possible values: + + - **true** - CDN resource is enabled and can be changed. Content can be + delivered. + - **false** - CDN resource is disabled and cannot be changed. Content can not be + delivered. + """ + + full_custom_enabled: Optional[bool] = None + """Defines whether the CDN resource has a custom configuration. + + Possible values: + + - **true** - CDN resource has a custom configuration. You cannot change resource + settings, except for the SSL certificate. To change other settings, contact + technical support. + - **false** - CDN resource has a regular configuration. You can change CDN + resource settings. + """ + + is_primary: Optional[bool] = None + """Defines whether a CDN resource has a cache zone shared with other CDN resources. + + Possible values: + + - **true** - CDN resource is main and has a shared caching zone with other CDN + resources, which are called reserve. + - **false** - CDN resource is reserve and it has a shared caching zone with the + main CDN resource. You cannot change some options, create rules, set up origin + shielding and use the reserve resource for Streaming. + - **null** - CDN resource does not have a shared cache zone. + + The main CDN resource is specified in the `primary_resource` field. It cannot be + suspended unless all related reserve CDN resources are suspended. + """ + + name: Optional[str] = None + """CDN resource name.""" + + options: Optional[Options] = None + """List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + """ + + origin_group: Optional[int] = FieldInfo(alias="originGroup", default=None) + """Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + """ + + origin_group_name: Optional[str] = FieldInfo(alias="originGroup_name", default=None) + """Origin group name.""" + + origin_protocol: Optional[Literal["HTTP", "HTTPS", "MATCH"]] = FieldInfo(alias="originProtocol", default=None) + """Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + """ + + preset_applied: Optional[bool] = None + """Defines whether the CDN resource has a preset applied. + + Possible values: + + - **true** - CDN resource has a preset applied. CDN resource options included in + the preset cannot be edited. + - **false** - CDN resource does not have a preset applied. + """ + + primary_resource: Optional[int] = None + """ + ID of the main CDN resource which has a shared caching zone with a reserve CDN + resource. + + If the parameter is not empty, then the current CDN resource is the reserve. You + cannot change some options, create rules, set up origin shielding, or use the + reserve CDN resource for Streaming. + """ + + proxy_ssl_ca: Optional[int] = None + """ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_data: Optional[int] = None + """ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_enabled: Optional[bool] = None + """ + Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + """ + + rules: Optional[List[object]] = None + """Rules configured for the CDN resource.""" + + secondary_hostnames: Optional[List[str]] = FieldInfo(alias="secondaryHostnames", default=None) + """ + Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + """ + + shield_dc: Optional[str] = None + """Name of the origin shielding location data center. + + Parameter returns **null** if origin shielding is disabled. + """ + + shield_enabled: Optional[bool] = None + """Defines whether origin shield is active and working for the CDN resource. + + Possible values: + + - **true** - Origin shield is active. + - **false** - Origin shield is not active. + """ + + shield_routing_map: Optional[int] = None + """ + Defines whether the origin shield with a dynamic location is enabled for the CDN + resource. + + To manage origin shielding, you must contact customer support. + """ + + shielded: Optional[bool] = None + """Defines whether origin shielding feature is enabled for the resource. + + Possible values: + + - **true** - Origin shielding is enabled. + - **false** - Origin shielding is disabled. + """ + + ssl_data: Optional[int] = FieldInfo(alias="sslData", default=None) + """ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + """ + + ssl_enabled: Optional[bool] = FieldInfo(alias="sslEnabled", default=None) + """Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + """ + + status: Optional[Literal["active", "suspended", "processed", "deleted"]] = None + """CDN resource status. + + Possible values: + + - **active** - CDN resource is active. Content is available to users. + - **suspended** - CDN resource is suspended. Content is not available to users. + - **processed** - CDN resource has recently been created and is currently being + processed. It will take about fifteen minutes to propagate it to all + locations. + - **deleted** - CDN resource is deleted. + """ + + suspend_date: Optional[str] = None + """ + Date when the CDN resource was suspended automatically if there is no traffic on + it for 90 days. + + Not specified if the resource was not stopped due to lack of traffic. + """ + + suspended: Optional[bool] = None + """ + Defines whether the CDN resource has been automatically suspended because there + was no traffic on it for 90 days. + + Possible values: + + - **true** - CDN resource is currently automatically suspended. + - **false** - CDN resource is not automatically suspended. + + You can enable CDN resource using the `active` field. If there is no traffic on + the CDN resource within seven days following activation, it will be suspended + again. + + To avoid CDN resource suspension due to no traffic, contact technical support. + """ + + updated: Optional[str] = None + """Date of the last CDN resource update.""" + + vp_enabled: Optional[bool] = None + """Defines whether the CDN resource is integrated with the Streaming Platform. + + Possible values: + + - **true** - CDN resource is configured for Streaming Platform. Changing + resource settings can affect its operation. + - **false** - CDN resource is not configured for Streaming Platform. + """ + + waap_domain_id: Optional[str] = None + """The ID of the associated WAAP domain.""" diff --git a/src/gcore/types/cdn/cdn_resource_list.py b/src/gcore/types/cdn/cdn_resource_list.py new file mode 100644 index 00000000..cfbed20c --- /dev/null +++ b/src/gcore/types/cdn/cdn_resource_list.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .cdn_resource import CdnResource + +__all__ = ["CdnResourceList"] + +CdnResourceList: TypeAlias = List[CdnResource] diff --git a/src/gcore/types/cdn/cdn_update_account_params.py b/src/gcore/types/cdn/cdn_update_account_params.py new file mode 100644 index 00000000..cfeba9f7 --- /dev/null +++ b/src/gcore/types/cdn/cdn_update_account_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["CdnUpdateAccountParams"] + + +class CdnUpdateAccountParams(TypedDict, total=False): + utilization_level: int + """CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + """ diff --git a/src/gcore/types/cdn/certificate_create_params.py b/src/gcore/types/cdn/certificate_create_params.py new file mode 100644 index 00000000..8c17c903 --- /dev/null +++ b/src/gcore/types/cdn/certificate_create_params.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Required, Annotated, TypeAlias, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["CertificateCreateParams", "CreateSSlPayload", "LetSEncryptCertificate"] + + +class CreateSSlPayload(TypedDict, total=False): + name: Required[str] + """SSL certificate name. + + It must be unique. + """ + + ssl_certificate: Required[Annotated[str, PropertyInfo(alias="sslCertificate")]] + """Public part of the SSL certificate. + + All chain of the SSL certificate should be added. + """ + + ssl_private_key: Required[Annotated[str, PropertyInfo(alias="sslPrivateKey")]] + """Private key of the SSL certificate.""" + + validate_root_ca: bool + """ + Defines whether to check the SSL certificate for a signature from a trusted + certificate authority. + + Possible values: + + - **true** - SSL certificate must be verified to be signed by a trusted + certificate authority. + - **false** - SSL certificate will not be verified to be signed by a trusted + certificate authority. + """ + + +class LetSEncryptCertificate(TypedDict, total=False): + automated: Required[bool] + """Must be **true** to issue certificate automatically.""" + + name: Required[str] + """SSL certificate name. It must be unique.""" + + +CertificateCreateParams: TypeAlias = Union[CreateSSlPayload, LetSEncryptCertificate] diff --git a/src/gcore/types/cdn/certificate_get_status_params.py b/src/gcore/types/cdn/certificate_get_status_params.py new file mode 100644 index 00000000..ea923341 --- /dev/null +++ b/src/gcore/types/cdn/certificate_get_status_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["CertificateGetStatusParams"] + + +class CertificateGetStatusParams(TypedDict, total=False): + exclude: SequenceNotStr[str] + """Listed fields will be excluded from the response.""" diff --git a/src/gcore/types/cdn/certificate_list_params.py b/src/gcore/types/cdn/certificate_list_params.py new file mode 100644 index 00000000..7474922f --- /dev/null +++ b/src/gcore/types/cdn/certificate_list_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["CertificateListParams"] + + +class CertificateListParams(TypedDict, total=False): + automated: bool + """How the SSL certificate was issued. + + Possible values: + + - **true** – Certificate was issued automatically. + - **false** – Certificate was added by a user. + """ + + resource_id: int + """CDN resource ID for which certificates are requested.""" + + validity_not_after_lte: str + """ + Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, + UTC.) + + Response will contain only certificates valid until the specified time. + """ diff --git a/src/gcore/types/cdn/certificate_replace_params.py b/src/gcore/types/cdn/certificate_replace_params.py new file mode 100644 index 00000000..8d60c803 --- /dev/null +++ b/src/gcore/types/cdn/certificate_replace_params.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["CertificateReplaceParams"] + + +class CertificateReplaceParams(TypedDict, total=False): + name: Required[str] + """SSL certificate name. + + It must be unique. + """ + + ssl_certificate: Required[Annotated[str, PropertyInfo(alias="sslCertificate")]] + """Public part of the SSL certificate. + + All chain of the SSL certificate should be added. + """ + + ssl_private_key: Required[Annotated[str, PropertyInfo(alias="sslPrivateKey")]] + """Private key of the SSL certificate.""" + + validate_root_ca: bool + """ + Defines whether to check the SSL certificate for a signature from a trusted + certificate authority. + + Possible values: + + - **true** - SSL certificate must be verified to be signed by a trusted + certificate authority. + - **false** - SSL certificate will not be verified to be signed by a trusted + certificate authority. + """ diff --git a/src/gcore/types/cdn/log_download_params.py b/src/gcore/types/cdn/log_download_params.py new file mode 100644 index 00000000..2804b7bb --- /dev/null +++ b/src/gcore/types/cdn/log_download_params.py @@ -0,0 +1,279 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["LogDownloadParams"] + + +class LogDownloadParams(TypedDict, total=False): + format: Required[str] + """Output format. + + Possible values: + + - csv + - tsv + """ + + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """ + Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &from=2021-06-14T00:00:00Z + - &from=2021-06-14T00:00:00.000Z + """ + + to: Required[str] + """End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &to=2021-06-15T00:00:00Z + - &to=2021-06-15T00:00:00.000Z + """ + + cache_status_eq: Annotated[str, PropertyInfo(alias="cache_status__eq")] + """Caching status. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. + """ + + cache_status_in: Annotated[str, PropertyInfo(alias="cache_status__in")] + """List of caching statuses. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. Values should be separated by a comma. + """ + + cache_status_ne: Annotated[str, PropertyInfo(alias="cache_status__ne")] + """Caching status not equal to the specified value. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. + """ + + cache_status_not_in: Annotated[str, PropertyInfo(alias="cache_status__not_in")] + """List of caching statuses not equal to the specified values. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. Values should be separated by a comma. + """ + + client_ip_eq: Annotated[str, PropertyInfo(alias="client_ip__eq")] + """IP address of the client who sent the request.""" + + client_ip_in: Annotated[str, PropertyInfo(alias="client_ip__in")] + """List of IP addresses of the clients who sent the request.""" + + client_ip_ne: Annotated[str, PropertyInfo(alias="client_ip__ne")] + """IP address of the client who did not send the request.""" + + client_ip_not_in: Annotated[str, PropertyInfo(alias="client_ip__not_in")] + """List of IP addresses of the clients who did not send the request.""" + + cname_contains: Annotated[str, PropertyInfo(alias="cname__contains")] + """Part of the custom domain of the requested CDN resource. + + Minimum length is 3 characters. + """ + + cname_eq: Annotated[str, PropertyInfo(alias="cname__eq")] + """Custom domain of the requested CDN resource.""" + + cname_in: Annotated[str, PropertyInfo(alias="cname__in")] + """List of custom domains of the requested CDN resource. + + Values should be separated by a comma. + """ + + cname_ne: Annotated[str, PropertyInfo(alias="cname__ne")] + """Custom domain of the requested CDN resource not equal to the specified value.""" + + cname_not_in: Annotated[str, PropertyInfo(alias="cname__not_in")] + """ + List of custom domains of the requested CDN resource not equal to the specified + values. Values should be separated by a comma. + """ + + datacenter_eq: Annotated[str, PropertyInfo(alias="datacenter__eq")] + """Data center where request was processed.""" + + datacenter_in: Annotated[str, PropertyInfo(alias="datacenter__in")] + """List of data centers where request was processed. + + Values should be separated by a comma. + """ + + datacenter_ne: Annotated[str, PropertyInfo(alias="datacenter__ne")] + """Data center where request was not processed.""" + + datacenter_not_in: Annotated[str, PropertyInfo(alias="datacenter__not_in")] + """List of data centers where request was not processed. + + Values should be separated by a comma. + """ + + fields: str + """A comma-separated list of returned fields. + + Supported fields are presented in the responses section. + + Example: + + - &fields=timestamp,path,status + """ + + limit: int + """Maximum number of log records in the response.""" + + method_eq: Annotated[str, PropertyInfo(alias="method__eq")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. + """ + + method_in: Annotated[str, PropertyInfo(alias="method__in")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. Values should be separated by a comma. + """ + + method_ne: Annotated[str, PropertyInfo(alias="method__ne")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. + """ + + method_not_in: Annotated[str, PropertyInfo(alias="method__not_in")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. Values should be separated by a comma. + """ + + offset: int + """ + Number of log records to skip starting from the beginning of the requested + period. + """ + + resource_id_eq: Annotated[int, PropertyInfo(alias="resource_id__eq")] + """ID of the requested CDN resource equal to the specified value.""" + + resource_id_gt: Annotated[int, PropertyInfo(alias="resource_id__gt")] + """ID of the requested CDN resource greater than the specified value.""" + + resource_id_gte: Annotated[int, PropertyInfo(alias="resource_id__gte")] + """ID of the requested CDN resource greater than or equal to the specified value.""" + + resource_id_in: Annotated[str, PropertyInfo(alias="resource_id__in")] + """List of IDs of the requested CDN resource. + + Values should be separated by a comma. + """ + + resource_id_lt: Annotated[int, PropertyInfo(alias="resource_id__lt")] + """ID of the requested CDN resource less than the specified value.""" + + resource_id_lte: Annotated[int, PropertyInfo(alias="resource_id__lte")] + """ID of the requested CDN resource less than or equal to the specified value.""" + + resource_id_ne: Annotated[int, PropertyInfo(alias="resource_id__ne")] + """ID of the requested CDN resource not equal to the specified value.""" + + resource_id_not_in: Annotated[str, PropertyInfo(alias="resource_id__not_in")] + """List of IDs of the requested CDN resource not equal to the specified values. + + Values should be separated by a comma. + """ + + size_eq: Annotated[int, PropertyInfo(alias="size__eq")] + """Response size in bytes equal to the specified value.""" + + size_gt: Annotated[int, PropertyInfo(alias="size__gt")] + """Response size in bytes greater than the specified value.""" + + size_gte: Annotated[int, PropertyInfo(alias="size__gte")] + """Response size in bytes greater than or equal to the specified value.""" + + size_in: Annotated[str, PropertyInfo(alias="size__in")] + """List of response sizes in bytes. Values should be separated by a comma.""" + + size_lt: Annotated[int, PropertyInfo(alias="size__lt")] + """Response size in bytes less than the specified value.""" + + size_lte: Annotated[int, PropertyInfo(alias="size__lte")] + """Response size in bytes less than or equal to the specified value.""" + + size_ne: Annotated[int, PropertyInfo(alias="size__ne")] + """Response size in bytes not equal to the specified value.""" + + size_not_in: Annotated[str, PropertyInfo(alias="size__not_in")] + """List of response sizes in bytes not equal to the specified values. + + Values should be separated by + """ + + sort: str + """Sorting rules. + + Possible values: + + - **method** - Request HTTP method. + - **`client_ip`** - IP address of the client who sent the request. + - **status** - Status code in the response. + - **size** - Response size in bytes. + - **cname** - Custom domain of the requested resource. + - **`resource_id`** - ID of the requested CDN resource. + - **`cache_status`** - Caching status. + - **datacenter** - Data center where request was processed. + - **timestamp** - Date and time when the request was made. + + May include multiple values separated by a comma. + + Example: + + - &sort=-timestamp,status + """ + + status_eq: Annotated[int, PropertyInfo(alias="status__eq")] + """Status code in the response equal to the specified value.""" + + status_gt: Annotated[int, PropertyInfo(alias="status__gt")] + """Status code in the response greater than the specified value.""" + + status_gte: Annotated[int, PropertyInfo(alias="status__gte")] + """Status code in the response greater than or equal to the specified value.""" + + status_in: Annotated[str, PropertyInfo(alias="status__in")] + """List of status codes in the response. Values should be separated by a comma.""" + + status_lt: Annotated[int, PropertyInfo(alias="status__lt")] + """Status code in the response less than the specified value.""" + + status_lte: Annotated[int, PropertyInfo(alias="status__lte")] + """Status code in the response less than or equal to the specified value.""" + + status_ne: Annotated[int, PropertyInfo(alias="status__ne")] + """Status code in the response not equal to the specified value.""" + + status_not_in: Annotated[str, PropertyInfo(alias="status__not_in")] + """List of status codes not in the response. + + Values should be separated by a comma. + """ diff --git a/src/gcore/types/cdn/log_list_params.py b/src/gcore/types/cdn/log_list_params.py new file mode 100644 index 00000000..7a9b1aca --- /dev/null +++ b/src/gcore/types/cdn/log_list_params.py @@ -0,0 +1,273 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["LogListParams"] + + +class LogListParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """ + Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &from=2021-06-14T00:00:00Z + - &from=2021-06-14T00:00:00.000Z + """ + + to: Required[str] + """End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &to=2021-06-15T00:00:00Z + - &to=2021-06-15T00:00:00.000Z + """ + + cache_status_eq: Annotated[str, PropertyInfo(alias="cache_status__eq")] + """Caching status. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. + """ + + cache_status_in: Annotated[str, PropertyInfo(alias="cache_status__in")] + """List of caching statuses. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. Values should be separated by a comma. + """ + + cache_status_ne: Annotated[str, PropertyInfo(alias="cache_status__ne")] + """Caching status not equal to the specified value. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. + """ + + cache_status_not_in: Annotated[str, PropertyInfo(alias="cache_status__not_in")] + """List of caching statuses not equal to the specified values. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. Values should be separated by a comma. + """ + + client_ip_eq: Annotated[str, PropertyInfo(alias="client_ip__eq")] + """IP address of the client who sent the request.""" + + client_ip_in: Annotated[str, PropertyInfo(alias="client_ip__in")] + """List of IP addresses of the clients who sent the request.""" + + client_ip_ne: Annotated[str, PropertyInfo(alias="client_ip__ne")] + """IP address of the client who did not send the request.""" + + client_ip_not_in: Annotated[str, PropertyInfo(alias="client_ip__not_in")] + """List of IP addresses of the clients who did not send the request.""" + + cname_contains: Annotated[str, PropertyInfo(alias="cname__contains")] + """Part of the custom domain of the requested CDN resource. + + Minimum length is 3 characters. + """ + + cname_eq: Annotated[str, PropertyInfo(alias="cname__eq")] + """Custom domain of the requested CDN resource.""" + + cname_in: Annotated[str, PropertyInfo(alias="cname__in")] + """List of custom domains of the requested CDN resource. + + Values should be separated by a comma. + """ + + cname_ne: Annotated[str, PropertyInfo(alias="cname__ne")] + """Custom domain of the requested CDN resource not equal to the specified value.""" + + cname_not_in: Annotated[str, PropertyInfo(alias="cname__not_in")] + """ + List of custom domains of the requested CDN resource not equal to the specified + values. Values should be separated by a comma. + """ + + datacenter_eq: Annotated[str, PropertyInfo(alias="datacenter__eq")] + """Data center where request was processed.""" + + datacenter_in: Annotated[str, PropertyInfo(alias="datacenter__in")] + """List of data centers where request was processed. + + Values should be separated by a comma. + """ + + datacenter_ne: Annotated[str, PropertyInfo(alias="datacenter__ne")] + """Data center where request was not processed.""" + + datacenter_not_in: Annotated[str, PropertyInfo(alias="datacenter__not_in")] + """List of data centers where request was not processed. + + Values should be separated by a comma. + """ + + fields: str + """A comma-separated list of returned fields. + + Supported fields are presented in the responses section. + + Example: + + - &fields=timestamp,path,status + """ + + limit: int + """Maximum number of log records in the response.""" + + method_eq: Annotated[str, PropertyInfo(alias="method__eq")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. + """ + + method_in: Annotated[str, PropertyInfo(alias="method__in")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. Values should be separated by a comma. + """ + + method_ne: Annotated[str, PropertyInfo(alias="method__ne")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. + """ + + method_not_in: Annotated[str, PropertyInfo(alias="method__not_in")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. Values should be separated by a comma. + """ + + offset: int + """ + Number of log records to skip starting from the beginning of the requested + period. + """ + + ordering: str + """Sorting rules. + + Possible values: + + - **method** - Request HTTP method. + - **`client_ip`** - IP address of the client who sent the request. + - **status** - Status code in the response. + - **size** - Response size in bytes. + - **cname** - Custom domain of the requested resource. + - **`resource_id`** - ID of the requested CDN resource. + - **`cache_status`** - Caching status. + - **datacenter** - Data center where request was processed. + - **timestamp** - Date and time when the request was made. + + Parameter may have multiple values separated by a comma. + + By default, ascending sorting is applied. To sort in descending order, add '-' + prefix. + + Example: + + - &ordering=-timestamp,status + """ + + resource_id_eq: Annotated[int, PropertyInfo(alias="resource_id__eq")] + """ID of the requested CDN resource equal to the specified value.""" + + resource_id_gt: Annotated[int, PropertyInfo(alias="resource_id__gt")] + """ID of the requested CDN resource greater than the specified value.""" + + resource_id_gte: Annotated[int, PropertyInfo(alias="resource_id__gte")] + """ID of the requested CDN resource greater than or equal to the specified value.""" + + resource_id_in: Annotated[str, PropertyInfo(alias="resource_id__in")] + """List of IDs of the requested CDN resource. + + Values should be separated by a comma. + """ + + resource_id_lt: Annotated[int, PropertyInfo(alias="resource_id__lt")] + """ID of the requested CDN resource less than the specified value.""" + + resource_id_lte: Annotated[int, PropertyInfo(alias="resource_id__lte")] + """ID of the requested CDN resource less than or equal to the specified value.""" + + resource_id_ne: Annotated[int, PropertyInfo(alias="resource_id__ne")] + """ID of the requested CDN resource not equal to the specified value.""" + + resource_id_not_in: Annotated[str, PropertyInfo(alias="resource_id__not_in")] + """List of IDs of the requested CDN resource not equal to the specified values. + + Values should be separated by a comma. + """ + + size_eq: Annotated[int, PropertyInfo(alias="size__eq")] + """Response size in bytes equal to the specified value.""" + + size_gt: Annotated[int, PropertyInfo(alias="size__gt")] + """Response size in bytes greater than the specified value.""" + + size_gte: Annotated[int, PropertyInfo(alias="size__gte")] + """Response size in bytes greater than or equal to the specified value.""" + + size_in: Annotated[str, PropertyInfo(alias="size__in")] + """List of response sizes in bytes. Values should be separated by a comma.""" + + size_lt: Annotated[int, PropertyInfo(alias="size__lt")] + """Response size in bytes less than the specified value.""" + + size_lte: Annotated[int, PropertyInfo(alias="size__lte")] + """Response size in bytes less than or equal to the specified value.""" + + size_ne: Annotated[int, PropertyInfo(alias="size__ne")] + """Response size in bytes not equal to the specified value.""" + + size_not_in: Annotated[str, PropertyInfo(alias="size__not_in")] + """List of response sizes in bytes not equal to the specified values. + + Values should be separated by + """ + + status_eq: Annotated[int, PropertyInfo(alias="status__eq")] + """Status code in the response equal to the specified value.""" + + status_gt: Annotated[int, PropertyInfo(alias="status__gt")] + """Status code in the response greater than the specified value.""" + + status_gte: Annotated[int, PropertyInfo(alias="status__gte")] + """Status code in the response greater than or equal to the specified value.""" + + status_in: Annotated[str, PropertyInfo(alias="status__in")] + """List of status codes in the response. Values should be separated by a comma.""" + + status_lt: Annotated[int, PropertyInfo(alias="status__lt")] + """Status code in the response less than the specified value.""" + + status_lte: Annotated[int, PropertyInfo(alias="status__lte")] + """Status code in the response less than or equal to the specified value.""" + + status_ne: Annotated[int, PropertyInfo(alias="status__ne")] + """Status code in the response not equal to the specified value.""" + + status_not_in: Annotated[str, PropertyInfo(alias="status__not_in")] + """List of status codes not in the response. + + Values should be separated by a comma. + """ diff --git a/src/gcore/types/cdn/logs/__init__.py b/src/gcore/types/cdn/logs/__init__.py new file mode 100644 index 00000000..02f4dd5c --- /dev/null +++ b/src/gcore/types/cdn/logs/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .log_settings import LogSettings as LogSettings +from .setting_create_params import SettingCreateParams as SettingCreateParams +from .setting_update_params import SettingUpdateParams as SettingUpdateParams diff --git a/src/gcore/types/cdn/logs/log_settings.py b/src/gcore/types/cdn/logs/log_settings.py new file mode 100644 index 00000000..ab1adcc9 --- /dev/null +++ b/src/gcore/types/cdn/logs/log_settings.py @@ -0,0 +1,172 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["LogSettings", "Folder"] + + +class Folder(BaseModel): + id: Optional[int] = None + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - S3 bucket ID. + - **ftp/sftp** - FTP/SFTP folder ID. + """ + + bucket: Optional[str] = None + """S3 bucket name. + + The field is required if "`storage_type`": **s3**. + """ + + cdn_resource: Optional[int] = None + """CDN resource ID.""" + + folder: Optional[str] = None + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - S3 bucket sub-folder name (optional.) + - **ftp/sftp** - FTP/SFTP folder name (required.) + """ + + +class LogSettings(BaseModel): + all_resources_bucket: Optional[str] = None + """Name of the S3 bucket to which logs of all CDN resources are delivered. + + Applicable for "`storage_type`": S3. + """ + + all_resources_folder: Optional[str] = None + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - Name of the S3 bucket sub-folder to which logs for all CDN resources + are delivered. + - **ftp/sftp** - Name of the folder (or path) to which logs for all CDN + resources are delivered. + """ + + archive_size_mb: Optional[int] = None + """ + The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + """ + + client: Optional[int] = None + """Client ID.""" + + comment: Optional[str] = None + """System comment on the status of settings, if they are suspended.""" + + enabled: Optional[bool] = None + """Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + """ + + folders: Optional[List[Folder]] = None + """List of folders/buckets for receiving CDN resources logs.""" + + for_all_resources: Optional[bool] = None + """ + Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of CDN resources are delivered to separate folders/buckets. + """ + + ftp_hostname: Optional[str] = None + """FTP storage hostname.""" + + ftp_login: Optional[str] = None + """FTP storage login.""" + + ftp_prepend_folder: Optional[str] = None + """Name of prepend FTP folder for log delivery.""" + + ignore_empty_logs: Optional[bool] = None + """Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + """ + + s3_access_key_id: Optional[str] = None + """Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + """ + + s3_aws_region: Optional[str] = None + """Amazon AWS region.""" + + s3_bucket_location: Optional[str] = None + """S3 storage location. + + Restrictions: + + - Maximum 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores + (.:\\__-). + """ + + s3_host_bucket: Optional[str] = None + """S3 storage bucket hostname. + + Restrictions: + + - Maximum 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + """ + + s3_hostname: Optional[str] = None + """S3 storage hostname.""" + + s3_type: Optional[str] = None + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + sftp_hostname: Optional[str] = None + """SFTP storage hostname.""" + + sftp_login: Optional[str] = None + """SFTP storage login.""" + + sftp_prepend_folder: Optional[str] = None + """Name of prepend SFTP folder for log delivery.""" + + status: Optional[str] = None + """Log delivery status. + + Possible values: + + - **ok** – All/part of attempts to deliver logs were successful. + - **failed** – All attempts to deliver logs failed. + - **pending** - No logs delivery attempts yet. + - **disabled** - Log delivery is disabled. + """ + + storage_type: Optional[str] = None + """Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + """ diff --git a/src/gcore/types/cdn/logs/setting_create_params.py b/src/gcore/types/cdn/logs/setting_create_params.py new file mode 100644 index 00000000..20720e89 --- /dev/null +++ b/src/gcore/types/cdn/logs/setting_create_params.py @@ -0,0 +1,200 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["SettingCreateParams", "Folder"] + + +class SettingCreateParams(TypedDict, total=False): + all_resources_bucket: Required[str] + """Name of the S3 bucket to which logs for all CDN resources are delivered.""" + + all_resources_folder: Required[str] + """Parameter meaning depends on the value of the "`storage_type`" value: + + - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for + all CDN resources are delivered. + - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for + all CDN resources are delivered. + """ + + folders: Required[Iterable[Folder]] + """List of folders/buckets for receiving CDN resources logs.""" + + for_all_resources: Required[bool] + """ + Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of different CDN resources are delivered to separate + folders/buckets. + """ + + ftp_hostname: Required[str] + """FTP storage hostname.""" + + ftp_login: Required[str] + """FTP storage login.""" + + ftp_password: Required[str] + """FTP storage password.""" + + s3_access_key_id: Required[str] + """Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + """ + + s3_hostname: Required[str] + """S3 storage hostname. + + It is required if "`s3_type`": other. + """ + + s3_secret_key: Required[str] + """Secret access key for the S3 account. + + Secret Access Key is 20-50 alpha-numeric-slash-plus characters like + kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct + """ + + s3_type: Required[str] + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + sftp_hostname: Required[str] + """SFTP storage hostname.""" + + sftp_login: Required[str] + """SFTP storage login.""" + + sftp_password: Required[str] + """SFTP storage password. + + It should be empty if "`sftp_private_key`" is set. + """ + + storage_type: Required[str] + """Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + """ + + archive_size_mb: Optional[int] + """ + The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + """ + + enabled: bool + """Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + """ + + ftp_prepend_folder: str + """Name of the FTP prepend folder for log delivery. + + **Null** is allowed. + """ + + ignore_empty_logs: bool + """Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + """ + + s3_aws_region: int + """Amazon AWS region.""" + + s3_bucket_location: str + """Location of S3 storage. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores + (.:\\__-). + """ + + s3_host_bucket: str + """S3 bucket hostname. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + - Required if "`s3_type`": other. + """ + + sftp_key_passphrase: str + """Passphrase for SFTP private key. + + Restrictions: + + - Should be set if private key encoded with passphrase. + - Should be empty if "`sftp_password`" is set. + """ + + sftp_prepend_folder: str + """Name of the SFTP prepend folder for log delivery. + + **Null** is allowed. + """ + + sftp_private_key: str + """Private key for SFTP authorization. + + Possible values: + + - **RSA** + - **ED25519** + + It should be empty if "`sftp_password`" is set. + """ + + +class Folder(TypedDict, total=False): + id: int + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - S3 bucket ID. + - **ftp/sftp** - FTP/SFTP folder ID. + """ + + bucket: str + """S3 bucket name. + + The field is required if "`storage_type`": **s3**. + """ + + cdn_resource: int + """CDN resource ID.""" + + folder: str + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - S3 bucket sub-folder name (optional.) + - **ftp/sftp** - FTP/SFTP folder name (required.) + """ diff --git a/src/gcore/types/cdn/logs/setting_update_params.py b/src/gcore/types/cdn/logs/setting_update_params.py new file mode 100644 index 00000000..b6736ad2 --- /dev/null +++ b/src/gcore/types/cdn/logs/setting_update_params.py @@ -0,0 +1,200 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["SettingUpdateParams", "Folder"] + + +class SettingUpdateParams(TypedDict, total=False): + all_resources_bucket: Required[str] + """Name of the S3 bucket to which logs for all CDN resources are delivered.""" + + all_resources_folder: Required[str] + """Parameter meaning depends on the value of the "`storage_type`" value: + + - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for + all CDN resources are delivered. + - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for + all CDN resources are delivered. + """ + + folders: Required[Iterable[Folder]] + """List of folders/buckets for receiving CDN resources logs.""" + + for_all_resources: Required[bool] + """ + Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of different CDN resources are delivered to separate + folders/buckets. + """ + + ftp_hostname: Required[str] + """FTP storage hostname.""" + + ftp_login: Required[str] + """FTP storage login.""" + + ftp_password: Required[str] + """FTP storage password.""" + + s3_access_key_id: Required[str] + """Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + """ + + s3_hostname: Required[str] + """S3 storage hostname. + + It is required if "`s3_type`": other. + """ + + s3_secret_key: Required[str] + """Secret access key for the S3 account. + + Secret Access Key is 20-50 alpha-numeric-slash-plus characters like + kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct + """ + + s3_type: Required[str] + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + sftp_hostname: Required[str] + """SFTP storage hostname.""" + + sftp_login: Required[str] + """SFTP storage login.""" + + sftp_password: Required[str] + """SFTP storage password. + + It should be empty if "`sftp_private_key`" is set. + """ + + storage_type: Required[str] + """Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + """ + + archive_size_mb: Optional[int] + """ + The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + """ + + enabled: bool + """Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + """ + + ftp_prepend_folder: str + """Name of the FTP prepend folder for log delivery. + + **Null** is allowed. + """ + + ignore_empty_logs: bool + """Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + """ + + s3_aws_region: int + """Amazon AWS region.""" + + s3_bucket_location: str + """Location of S3 storage. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores + (.:\\__-). + """ + + s3_host_bucket: str + """S3 bucket hostname. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + - Required if "`s3_type`": other. + """ + + sftp_key_passphrase: str + """Passphrase for SFTP private key. + + Restrictions: + + - Should be set if private key encoded with passphrase. + - Should be empty if "`sftp_password`" is set. + """ + + sftp_prepend_folder: str + """Name of the SFTP prepend folder for log delivery. + + **Null** is allowed. + """ + + sftp_private_key: str + """Private key for SFTP authorization. + + Possible values: + + - **RSA** + - **ED25519** + + It should be empty if "`sftp_password`" is set. + """ + + +class Folder(TypedDict, total=False): + id: int + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - S3 bucket ID. + - **ftp/sftp** - FTP/SFTP folder ID. + """ + + bucket: str + """S3 bucket name. + + The field is required if "`storage_type`": **s3**. + """ + + cdn_resource: int + """CDN resource ID.""" + + folder: str + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - S3 bucket sub-folder name (optional.) + - **ftp/sftp** - FTP/SFTP folder name (required.) + """ diff --git a/src/gcore/types/cdn/logs_aggregated_stats.py b/src/gcore/types/cdn/logs_aggregated_stats.py new file mode 100644 index 00000000..30806dfc --- /dev/null +++ b/src/gcore/types/cdn/logs_aggregated_stats.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["LogsAggregatedStats"] + + +class LogsAggregatedStats(BaseModel): + api_1_example: Optional[object] = FieldInfo(alias="1 (example)", default=None) + """CDN resource ID for which statistics data is shown.""" + + metrics: Optional[object] = None + """Statistics parameters.""" + + raw_logs_usage: Optional[str] = None + """Number of resources that used raw logs.""" + + resource: Optional[object] = None + """Resources IDs by which statistics data is grouped..""" diff --git a/src/gcore/types/cdn/logs_uploader/__init__.py b/src/gcore/types/cdn/logs_uploader/__init__.py new file mode 100644 index 00000000..3bf54233 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/__init__.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .config_list_params import ConfigListParams as ConfigListParams +from .policy_list_params import PolicyListParams as PolicyListParams +from .target_list_params import TargetListParams as TargetListParams +from .config_create_params import ConfigCreateParams as ConfigCreateParams +from .config_update_params import ConfigUpdateParams as ConfigUpdateParams +from .logs_uploader_config import LogsUploaderConfig as LogsUploaderConfig +from .logs_uploader_policy import LogsUploaderPolicy as LogsUploaderPolicy +from .logs_uploader_target import LogsUploaderTarget as LogsUploaderTarget +from .policy_create_params import PolicyCreateParams as PolicyCreateParams +from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams +from .target_create_params import TargetCreateParams as TargetCreateParams +from .target_update_params import TargetUpdateParams as TargetUpdateParams +from .config_replace_params import ConfigReplaceParams as ConfigReplaceParams +from .policy_replace_params import PolicyReplaceParams as PolicyReplaceParams +from .target_replace_params import TargetReplaceParams as TargetReplaceParams +from .logs_uploader_config_list import LogsUploaderConfigList as LogsUploaderConfigList +from .logs_uploader_policy_list import LogsUploaderPolicyList as LogsUploaderPolicyList +from .logs_uploader_target_list import LogsUploaderTargetList as LogsUploaderTargetList +from .policy_list_fields_response import PolicyListFieldsResponse as PolicyListFieldsResponse diff --git a/src/gcore/types/cdn/logs_uploader/config_create_params.py b/src/gcore/types/cdn/logs_uploader/config_create_params.py new file mode 100644 index 00000000..40e51bdf --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/config_create_params.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["ConfigCreateParams"] + + +class ConfigCreateParams(TypedDict, total=False): + name: Required[str] + """Name of the config.""" + + policy: Required[int] + """ID of the policy that should be assigned to given config.""" + + target: Required[int] + """ID of the target to which logs should be uploaded.""" + + enabled: bool + """Enables or disables the config.""" + + for_all_resources: bool + """ + If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + """ + + resources: Iterable[int] + """List of resource IDs to which the config should be applied.""" diff --git a/src/gcore/types/cdn/logs_uploader/config_list_params.py b/src/gcore/types/cdn/logs_uploader/config_list_params.py new file mode 100644 index 00000000..8b2e42b2 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/config_list_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import TypedDict + +__all__ = ["ConfigListParams"] + + +class ConfigListParams(TypedDict, total=False): + resource_ids: Iterable[int] + """Filter by ids of CDN resources that are assigned to given config.""" + + search: str + """Search by config name or id.""" diff --git a/src/gcore/types/cdn/logs_uploader/config_replace_params.py b/src/gcore/types/cdn/logs_uploader/config_replace_params.py new file mode 100644 index 00000000..398da0ae --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/config_replace_params.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["ConfigReplaceParams"] + + +class ConfigReplaceParams(TypedDict, total=False): + name: Required[str] + """Name of the config.""" + + policy: Required[int] + """ID of the policy that should be assigned to given config.""" + + target: Required[int] + """ID of the target to which logs should be uploaded.""" + + enabled: bool + """Enables or disables the config.""" + + for_all_resources: bool + """ + If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + """ + + resources: Iterable[int] + """List of resource IDs to which the config should be applied.""" diff --git a/src/gcore/types/cdn/logs_uploader/config_update_params.py b/src/gcore/types/cdn/logs_uploader/config_update_params.py new file mode 100644 index 00000000..d0dcd2cb --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/config_update_params.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import TypedDict + +__all__ = ["ConfigUpdateParams"] + + +class ConfigUpdateParams(TypedDict, total=False): + enabled: bool + """Enables or disables the config.""" + + for_all_resources: bool + """ + If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + """ + + name: str + """Name of the config.""" + + policy: int + """ID of the policy that should be assigned to given config.""" + + resources: Iterable[int] + """List of resource IDs to which the config should be applied.""" + + target: int + """ID of the target to which logs should be uploaded.""" diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_config.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_config.py new file mode 100644 index 00000000..71914495 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_config.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel +from ..logs_uploader_validation import LogsUploaderValidation + +__all__ = ["LogsUploaderConfig", "Status"] + + +class Status(LogsUploaderValidation): + pass + + +class LogsUploaderConfig(BaseModel): + id: Optional[int] = None + + client_id: Optional[int] = None + """Client that owns the config.""" + + created: Optional[datetime] = None + """Time when the config was created.""" + + enabled: Optional[bool] = None + """Enables or disables the config.""" + + for_all_resources: Optional[bool] = None + """ + If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + """ + + name: Optional[str] = None + """Name of the config.""" + + policy: Optional[int] = None + """ID of the policy that should be assigned to given config.""" + + resources: Optional[List[int]] = None + """List of resource IDs to which the config should be applied.""" + + status: Optional[Status] = None + """Validation status of the logs uploader config.""" + + target: Optional[int] = None + """ID of the target to which logs should be uploaded.""" + + updated: Optional[datetime] = None + """Time when the config was updated.""" diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_config_list.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_config_list.py new file mode 100644 index 00000000..477aaf6c --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_config_list.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .logs_uploader_config import LogsUploaderConfig + +__all__ = ["LogsUploaderConfigList"] + +LogsUploaderConfigList: TypeAlias = List[LogsUploaderConfig] diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py new file mode 100644 index 00000000..241cb7d5 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py @@ -0,0 +1,73 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["LogsUploaderPolicy"] + + +class LogsUploaderPolicy(BaseModel): + id: Optional[int] = None + + client_id: Optional[int] = None + """Client that owns the policy.""" + + created: Optional[datetime] = None + """Time when logs uploader policy was created.""" + + date_format: Optional[str] = None + """Date format for logs.""" + + description: Optional[str] = None + """Description of the policy.""" + + field_delimiter: Optional[str] = None + """Field delimiter for logs.""" + + field_separator: Optional[str] = None + """Field separator for logs.""" + + fields: Optional[List[str]] = None + """List of fields to include in logs.""" + + file_name_template: Optional[str] = None + """Template for log file name.""" + + format_type: Optional[str] = None + """Format type for logs.""" + + include_empty_logs: Optional[bool] = None + """Include empty logs in the upload.""" + + include_shield_logs: Optional[bool] = None + """Include logs from origin shielding in the upload.""" + + name: Optional[str] = None + """Name of the policy.""" + + related_uploader_configs: Optional[List[int]] = None + """List of logs uploader configs that use this policy.""" + + retry_interval_minutes: Optional[int] = None + """Interval in minutes to retry failed uploads.""" + + rotate_interval_minutes: Optional[int] = None + """Interval in minutes to rotate logs.""" + + rotate_threshold_lines: Optional[int] = None + """Threshold in lines to rotate logs.""" + + rotate_threshold_mb: Optional[int] = None + """Threshold in MB to rotate logs.""" + + tags: Optional[Dict[str, str]] = None + """ + Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + """ + + updated: Optional[datetime] = None + """Time when logs uploader policy was updated.""" diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py new file mode 100644 index 00000000..75f9a44e --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .logs_uploader_policy import LogsUploaderPolicy + +__all__ = ["LogsUploaderPolicyList"] + +LogsUploaderPolicyList: TypeAlias = List[LogsUploaderPolicy] diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_target.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_target.py new file mode 100644 index 00000000..05eb1f25 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_target.py @@ -0,0 +1,236 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, TypeAlias + +from ...._models import BaseModel +from ..logs_uploader_validation import LogsUploaderValidation + +__all__ = [ + "LogsUploaderTarget", + "Config", + "ConfigS3GcoreConfigResponse", + "ConfigS3AmazonConfigResponse", + "ConfigUnionMember2", + "ConfigBaseFtpConfig", + "ConfigSftpConfigResponse", + "ConfigHTTPConfigResponse", + "ConfigHTTPConfigResponseAppend", + "ConfigHTTPConfigResponseAppendResponseAction", + "ConfigHTTPConfigResponseAuth", + "ConfigHTTPConfigResponseAuthConfig", + "ConfigHTTPConfigResponseRetry", + "ConfigHTTPConfigResponseRetryResponseAction", + "ConfigHTTPConfigResponseUpload", + "ConfigHTTPConfigResponseUploadResponseAction", + "Status", +] + + +class ConfigS3GcoreConfigResponse(BaseModel): + access_key_id: Optional[str] = None + + bucket_name: Optional[str] = None + + directory: Optional[str] = None + + endpoint: Optional[str] = None + + region: Optional[str] = None + + use_path_style: Optional[bool] = None + + +class ConfigS3AmazonConfigResponse(BaseModel): + access_key_id: Optional[str] = None + + bucket_name: Optional[str] = None + + directory: Optional[str] = None + + region: Optional[str] = None + + +class ConfigUnionMember2(BaseModel): + access_key_id: Optional[str] = None + + bucket_name: Optional[str] = None + + directory: Optional[str] = None + + region: Optional[str] = None + + +class ConfigBaseFtpConfig(BaseModel): + directory: Optional[str] = None + + hostname: Optional[str] = None + + timeout_seconds: Optional[int] = None + + user: Optional[str] = None + + +class ConfigSftpConfigResponse(BaseModel): + hostname: str + + user: str + + directory: Optional[str] = None + + key_passphrase: Optional[str] = None + + password: Optional[str] = None + + private_key: Optional[str] = None + + timeout_seconds: Optional[int] = None + + +class ConfigHTTPConfigResponseAppendResponseAction(BaseModel): + action: Optional[Literal["drop", "retry", "append"]] = None + + description: Optional[str] = None + + match_payload: Optional[str] = None + + match_status_code: Optional[int] = None + + +class ConfigHTTPConfigResponseAppend(BaseModel): + headers: Optional[Dict[str, str]] = None + + method: Optional[Literal["POST", "PUT"]] = None + + response_actions: Optional[List[ConfigHTTPConfigResponseAppendResponseAction]] = None + + timeout_seconds: Optional[int] = None + + url: Optional[str] = None + + use_compression: Optional[bool] = None + + +class ConfigHTTPConfigResponseAuthConfig(BaseModel): + token: Optional[str] = None + + header_name: Optional[str] = None + + +class ConfigHTTPConfigResponseAuth(BaseModel): + config: Optional[ConfigHTTPConfigResponseAuthConfig] = None + + type: Optional[Literal["token"]] = None + + +class ConfigHTTPConfigResponseRetryResponseAction(BaseModel): + action: Optional[Literal["drop", "retry", "append"]] = None + + description: Optional[str] = None + + match_payload: Optional[str] = None + + match_status_code: Optional[int] = None + + +class ConfigHTTPConfigResponseRetry(BaseModel): + headers: Optional[Dict[str, str]] = None + + method: Optional[Literal["POST", "PUT"]] = None + + response_actions: Optional[List[ConfigHTTPConfigResponseRetryResponseAction]] = None + + timeout_seconds: Optional[int] = None + + url: Optional[str] = None + + use_compression: Optional[bool] = None + + +class ConfigHTTPConfigResponseUploadResponseAction(BaseModel): + action: Optional[Literal["drop", "retry", "append"]] = None + + description: Optional[str] = None + + match_payload: Optional[str] = None + + match_status_code: Optional[int] = None + + +class ConfigHTTPConfigResponseUpload(BaseModel): + headers: Optional[Dict[str, str]] = None + + method: Optional[Literal["POST", "PUT"]] = None + + response_actions: Optional[List[ConfigHTTPConfigResponseUploadResponseAction]] = None + + timeout_seconds: Optional[int] = None + + url: Optional[str] = None + + use_compression: Optional[bool] = None + + +class ConfigHTTPConfigResponse(BaseModel): + append: Optional[ConfigHTTPConfigResponseAppend] = None + + auth: Optional[ConfigHTTPConfigResponseAuth] = None + + content_type: Optional[Literal["json", "text"]] = None + + retry: Optional[ConfigHTTPConfigResponseRetry] = None + + upload: Optional[ConfigHTTPConfigResponseUpload] = None + + +Config: TypeAlias = Union[ + ConfigS3GcoreConfigResponse, + ConfigS3AmazonConfigResponse, + ConfigUnionMember2, + ConfigS3GcoreConfigResponse, + ConfigS3GcoreConfigResponse, + ConfigBaseFtpConfig, + ConfigSftpConfigResponse, + ConfigHTTPConfigResponse, +] + + +class Status(LogsUploaderValidation): + pass + + +class LogsUploaderTarget(BaseModel): + id: Optional[int] = None + + client_id: Optional[int] = None + """Client that owns the target.""" + + config: Optional[Config] = None + """Config for specific storage type.""" + + created: Optional[datetime] = None + """Time when logs uploader target was created.""" + + description: Optional[str] = None + """Description of the target.""" + + name: Optional[str] = None + """Name of the target.""" + + related_uploader_configs: Optional[List[int]] = None + """List of logs uploader configs that use this target.""" + + status: Optional[Status] = None + """Validation status of the logs uploader target. + + Informs if the specified target is reachable. + """ + + storage_type: Optional[Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"]] = ( + None + ) + """Type of storage for logs.""" + + updated: Optional[datetime] = None + """Time when logs uploader target was updated.""" diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_target_list.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_target_list.py new file mode 100644 index 00000000..f3df6d6b --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_target_list.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .logs_uploader_target import LogsUploaderTarget + +__all__ = ["LogsUploaderTargetList"] + +LogsUploaderTargetList: TypeAlias = List[LogsUploaderTarget] diff --git a/src/gcore/types/cdn/logs_uploader/policy_create_params.py b/src/gcore/types/cdn/logs_uploader/policy_create_params.py new file mode 100644 index 00000000..4d763619 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/policy_create_params.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +from ...._types import SequenceNotStr + +__all__ = ["PolicyCreateParams"] + + +class PolicyCreateParams(TypedDict, total=False): + date_format: str + """Date format for logs.""" + + description: str + """Description of the policy.""" + + field_delimiter: str + """Field delimiter for logs.""" + + field_separator: str + """Field separator for logs.""" + + fields: SequenceNotStr[str] + """List of fields to include in logs.""" + + file_name_template: str + """Template for log file name.""" + + format_type: str + """Format type for logs.""" + + include_empty_logs: bool + """Include empty logs in the upload.""" + + include_shield_logs: bool + """Include logs from origin shielding in the upload.""" + + name: str + """Name of the policy.""" + + retry_interval_minutes: int + """Interval in minutes to retry failed uploads.""" + + rotate_interval_minutes: int + """Interval in minutes to rotate logs.""" + + rotate_threshold_lines: int + """Threshold in lines to rotate logs.""" + + rotate_threshold_mb: Optional[int] + """Threshold in MB to rotate logs.""" + + tags: Dict[str, str] + """ + Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + """ diff --git a/src/gcore/types/cdn/logs_uploader/policy_list_fields_response.py b/src/gcore/types/cdn/logs_uploader/policy_list_fields_response.py new file mode 100644 index 00000000..fcfbca93 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/policy_list_fields_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +__all__ = ["PolicyListFieldsResponse"] + +PolicyListFieldsResponse: TypeAlias = List[str] diff --git a/src/gcore/types/cdn/logs_uploader/policy_list_params.py b/src/gcore/types/cdn/logs_uploader/policy_list_params.py new file mode 100644 index 00000000..4b2a2b4a --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/policy_list_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import TypedDict + +__all__ = ["PolicyListParams"] + + +class PolicyListParams(TypedDict, total=False): + config_ids: Iterable[int] + """Filter by ids of related logs uploader configs that use given policy.""" + + search: str + """Search by policy name or id.""" diff --git a/src/gcore/types/cdn/logs_uploader/policy_replace_params.py b/src/gcore/types/cdn/logs_uploader/policy_replace_params.py new file mode 100644 index 00000000..7c62d955 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/policy_replace_params.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +from ...._types import SequenceNotStr + +__all__ = ["PolicyReplaceParams"] + + +class PolicyReplaceParams(TypedDict, total=False): + date_format: str + """Date format for logs.""" + + description: str + """Description of the policy.""" + + field_delimiter: str + """Field delimiter for logs.""" + + field_separator: str + """Field separator for logs.""" + + fields: SequenceNotStr[str] + """List of fields to include in logs.""" + + file_name_template: str + """Template for log file name.""" + + format_type: str + """Format type for logs.""" + + include_empty_logs: bool + """Include empty logs in the upload.""" + + include_shield_logs: bool + """Include logs from origin shielding in the upload.""" + + name: str + """Name of the policy.""" + + retry_interval_minutes: int + """Interval in minutes to retry failed uploads.""" + + rotate_interval_minutes: int + """Interval in minutes to rotate logs.""" + + rotate_threshold_lines: int + """Threshold in lines to rotate logs.""" + + rotate_threshold_mb: Optional[int] + """Threshold in MB to rotate logs.""" + + tags: Dict[str, str] + """ + Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + """ diff --git a/src/gcore/types/cdn/logs_uploader/policy_update_params.py b/src/gcore/types/cdn/logs_uploader/policy_update_params.py new file mode 100644 index 00000000..c1bb5811 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/policy_update_params.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +from ...._types import SequenceNotStr + +__all__ = ["PolicyUpdateParams"] + + +class PolicyUpdateParams(TypedDict, total=False): + date_format: str + """Date format for logs.""" + + description: str + """Description of the policy.""" + + field_delimiter: str + """Field delimiter for logs.""" + + field_separator: str + """Field separator for logs.""" + + fields: SequenceNotStr[str] + """List of fields to include in logs.""" + + file_name_template: str + """Template for log file name.""" + + format_type: str + """Format type for logs.""" + + include_empty_logs: bool + """Include empty logs in the upload.""" + + include_shield_logs: bool + """Include logs from origin shielding in the upload.""" + + name: str + """Name of the policy.""" + + retry_interval_minutes: int + """Interval in minutes to retry failed uploads.""" + + rotate_interval_minutes: int + """Interval in minutes to rotate logs.""" + + rotate_threshold_lines: int + """Threshold in lines to rotate logs.""" + + rotate_threshold_mb: Optional[int] + """Threshold in MB to rotate logs.""" + + tags: Dict[str, str] + """ + Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + """ diff --git a/src/gcore/types/cdn/logs_uploader/target_create_params.py b/src/gcore/types/cdn/logs_uploader/target_create_params.py new file mode 100644 index 00000000..f8d8e8e9 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/target_create_params.py @@ -0,0 +1,249 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = [ + "TargetCreateParams", + "Config", + "ConfigS3GcoreConfig", + "ConfigS3AmazonConfig", + "ConfigS3OssConfig", + "ConfigS3OtherConfig", + "ConfigS3V1Config", + "ConfigFtpConfig", + "ConfigSftpConfig", + "ConfigHTTPConfig", + "ConfigHTTPConfigUpload", + "ConfigHTTPConfigUploadResponseAction", + "ConfigHTTPConfigAppend", + "ConfigHTTPConfigAppendResponseAction", + "ConfigHTTPConfigAuth", + "ConfigHTTPConfigAuthConfig", + "ConfigHTTPConfigRetry", + "ConfigHTTPConfigRetryResponseAction", +] + + +class TargetCreateParams(TypedDict, total=False): + config: Required[Config] + """Config for specific storage type.""" + + storage_type: Required[Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"]] + """Type of storage for logs.""" + + description: str + """Description of the target.""" + + name: str + """Name of the target.""" + + +class ConfigS3GcoreConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigS3AmazonConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + +class ConfigS3OssConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + region: Optional[str] + + +class ConfigS3OtherConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigS3V1Config(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigFtpConfig(TypedDict, total=False): + hostname: Required[str] + + password: Required[str] + + user: Required[str] + + directory: Optional[str] + + timeout_seconds: int + + +class ConfigSftpConfig(TypedDict, total=False): + hostname: Required[str] + + user: Required[str] + + directory: Optional[str] + + key_passphrase: Optional[str] + + password: Optional[str] + + private_key: Optional[str] + + timeout_seconds: int + + +class ConfigHTTPConfigUploadResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigUpload(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigUploadResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfigAppendResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigAppend(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigAppendResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfigAuthConfig(TypedDict, total=False): + token: Required[str] + + header_name: Required[str] + + +class ConfigHTTPConfigAuth(TypedDict, total=False): + config: Required[ConfigHTTPConfigAuthConfig] + + type: Required[Literal["token"]] + + +class ConfigHTTPConfigRetryResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigRetry(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigRetryResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfig(TypedDict, total=False): + upload: Required[ConfigHTTPConfigUpload] + + append: ConfigHTTPConfigAppend + + auth: ConfigHTTPConfigAuth + + content_type: Literal["json", "text"] + + retry: ConfigHTTPConfigRetry + + +Config: TypeAlias = Union[ + ConfigS3GcoreConfig, + ConfigS3AmazonConfig, + ConfigS3OssConfig, + ConfigS3OtherConfig, + ConfigS3V1Config, + ConfigFtpConfig, + ConfigSftpConfig, + ConfigHTTPConfig, +] diff --git a/src/gcore/types/cdn/logs_uploader/target_list_params.py b/src/gcore/types/cdn/logs_uploader/target_list_params.py new file mode 100644 index 00000000..aed247de --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/target_list_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import TypedDict + +__all__ = ["TargetListParams"] + + +class TargetListParams(TypedDict, total=False): + config_ids: Iterable[int] + """Filter by ids of related logs uploader configs that use given target.""" + + search: str + """Search by target name or id.""" diff --git a/src/gcore/types/cdn/logs_uploader/target_replace_params.py b/src/gcore/types/cdn/logs_uploader/target_replace_params.py new file mode 100644 index 00000000..77281c94 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/target_replace_params.py @@ -0,0 +1,249 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = [ + "TargetReplaceParams", + "Config", + "ConfigS3GcoreConfig", + "ConfigS3AmazonConfig", + "ConfigS3OssConfig", + "ConfigS3OtherConfig", + "ConfigS3V1Config", + "ConfigFtpConfig", + "ConfigSftpConfig", + "ConfigHTTPConfig", + "ConfigHTTPConfigUpload", + "ConfigHTTPConfigUploadResponseAction", + "ConfigHTTPConfigAppend", + "ConfigHTTPConfigAppendResponseAction", + "ConfigHTTPConfigAuth", + "ConfigHTTPConfigAuthConfig", + "ConfigHTTPConfigRetry", + "ConfigHTTPConfigRetryResponseAction", +] + + +class TargetReplaceParams(TypedDict, total=False): + config: Required[Config] + """Config for specific storage type.""" + + storage_type: Required[Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"]] + """Type of storage for logs.""" + + description: str + """Description of the target.""" + + name: str + """Name of the target.""" + + +class ConfigS3GcoreConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigS3AmazonConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + +class ConfigS3OssConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + region: Optional[str] + + +class ConfigS3OtherConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigS3V1Config(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigFtpConfig(TypedDict, total=False): + hostname: Required[str] + + password: Required[str] + + user: Required[str] + + directory: Optional[str] + + timeout_seconds: int + + +class ConfigSftpConfig(TypedDict, total=False): + hostname: Required[str] + + user: Required[str] + + directory: Optional[str] + + key_passphrase: Optional[str] + + password: Optional[str] + + private_key: Optional[str] + + timeout_seconds: int + + +class ConfigHTTPConfigUploadResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigUpload(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigUploadResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfigAppendResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigAppend(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigAppendResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfigAuthConfig(TypedDict, total=False): + token: Required[str] + + header_name: Required[str] + + +class ConfigHTTPConfigAuth(TypedDict, total=False): + config: Required[ConfigHTTPConfigAuthConfig] + + type: Required[Literal["token"]] + + +class ConfigHTTPConfigRetryResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigRetry(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigRetryResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfig(TypedDict, total=False): + upload: Required[ConfigHTTPConfigUpload] + + append: ConfigHTTPConfigAppend + + auth: ConfigHTTPConfigAuth + + content_type: Literal["json", "text"] + + retry: ConfigHTTPConfigRetry + + +Config: TypeAlias = Union[ + ConfigS3GcoreConfig, + ConfigS3AmazonConfig, + ConfigS3OssConfig, + ConfigS3OtherConfig, + ConfigS3V1Config, + ConfigFtpConfig, + ConfigSftpConfig, + ConfigHTTPConfig, +] diff --git a/src/gcore/types/cdn/logs_uploader/target_update_params.py b/src/gcore/types/cdn/logs_uploader/target_update_params.py new file mode 100644 index 00000000..e93ab4d9 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/target_update_params.py @@ -0,0 +1,249 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = [ + "TargetUpdateParams", + "Config", + "ConfigS3GcoreConfig", + "ConfigS3AmazonConfig", + "ConfigS3OssConfig", + "ConfigS3OtherConfig", + "ConfigS3V1Config", + "ConfigFtpConfig", + "ConfigSftpConfig", + "ConfigHTTPConfig", + "ConfigHTTPConfigUpload", + "ConfigHTTPConfigUploadResponseAction", + "ConfigHTTPConfigAppend", + "ConfigHTTPConfigAppendResponseAction", + "ConfigHTTPConfigAuth", + "ConfigHTTPConfigAuthConfig", + "ConfigHTTPConfigRetry", + "ConfigHTTPConfigRetryResponseAction", +] + + +class TargetUpdateParams(TypedDict, total=False): + config: Config + """Config for specific storage type.""" + + description: str + """Description of the target.""" + + name: str + """Name of the target.""" + + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"] + """Type of storage for logs.""" + + +class ConfigS3GcoreConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigS3AmazonConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + +class ConfigS3OssConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + region: Optional[str] + + +class ConfigS3OtherConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigS3V1Config(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigFtpConfig(TypedDict, total=False): + hostname: Required[str] + + password: Required[str] + + user: Required[str] + + directory: Optional[str] + + timeout_seconds: int + + +class ConfigSftpConfig(TypedDict, total=False): + hostname: Required[str] + + user: Required[str] + + directory: Optional[str] + + key_passphrase: Optional[str] + + password: Optional[str] + + private_key: Optional[str] + + timeout_seconds: int + + +class ConfigHTTPConfigUploadResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigUpload(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigUploadResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfigAppendResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigAppend(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigAppendResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfigAuthConfig(TypedDict, total=False): + token: Required[str] + + header_name: Required[str] + + +class ConfigHTTPConfigAuth(TypedDict, total=False): + config: Required[ConfigHTTPConfigAuthConfig] + + type: Required[Literal["token"]] + + +class ConfigHTTPConfigRetryResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigRetry(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigRetryResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfig(TypedDict, total=False): + upload: Required[ConfigHTTPConfigUpload] + + append: ConfigHTTPConfigAppend + + auth: ConfigHTTPConfigAuth + + content_type: Literal["json", "text"] + + retry: ConfigHTTPConfigRetry + + +Config: TypeAlias = Union[ + ConfigS3GcoreConfig, + ConfigS3AmazonConfig, + ConfigS3OssConfig, + ConfigS3OtherConfig, + ConfigS3V1Config, + ConfigFtpConfig, + ConfigSftpConfig, + ConfigHTTPConfig, +] diff --git a/src/gcore/types/cdn/logs_uploader_validation.py b/src/gcore/types/cdn/logs_uploader_validation.py new file mode 100644 index 00000000..6f24857d --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader_validation.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["LogsUploaderValidation"] + + +class LogsUploaderValidation(BaseModel): + code: Optional[int] = None + """Error code indicating the type of validation error.""" + + details: Optional[str] = None + """Error message if the validation failed.""" + + status: Optional[Literal["in_progress", "successful", "failed"]] = None + """Status of the validation.""" + + updated: Optional[datetime] = None + """Time when the validation status was updated.""" diff --git a/src/gcore/types/cdn/metric_list_params.py b/src/gcore/types/cdn/metric_list_params.py new file mode 100644 index 00000000..42aa48e4 --- /dev/null +++ b/src/gcore/types/cdn/metric_list_params.py @@ -0,0 +1,168 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = ["MetricListParams", "FilterBy"] + + +class MetricListParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning period to fetch metrics (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - 2021-06-14T00:00:00Z + - 2021-06-14T00:00:00.000Z + + The total number of points, which is determined as the difference between "from" + and "to" divided by "granularity", cannot exceed 1440. Exception: "speed" + metrics are limited to 72 points. + """ + + metrics: Required[SequenceNotStr[str]] + """Possible values: + + - **`edge_bandwidth`** - Bandwidth from client to CDN (bit/s.) + - **`edge_requests`** - Number of requests per interval (requests/s.) + - **`edge_requests_total`** - Total number of requests per interval. + - **`edge_status_1xx`** - Number of 1xx status codes from edge. + - **`edge_status_200`** - Number of 200 status codes from edge. + - **`edge_status_204`** - Number of 204 status codes from edge. + - **`edge_status_206`** - Number of 206 status codes from edge. + - **`edge_status_2xx`** - Number of 2xx status codes from edge. + - **`edge_status_301`** - Number of 301 status codes from edge. + - **`edge_status_302`** - Number of 302 status codes from edge. + - **`edge_status_304`** - Number of 304 status codes from edge. + - **`edge_status_3xx`** - Number of 3xx status codes from edge. + - **`edge_status_400`** - Number of 400 status codes from edge. + - **`edge_status_401`** - Number of 401 status codes from edge. + - **`edge_status_403`** - Number of 403 status codes from edge. + - **`edge_status_404`** - Number of 404 status codes from edge. + - **`edge_status_416`** - Number of 416 status codes from edge. + - **`edge_status_429`** - Number of 429 status codes from edge. + - **`edge_status_4xx`** - Number of 4xx status codes from edge. + - **`edge_status_500`** - Number of 500 status codes from edge. + - **`edge_status_501`** - Number of 501 status codes from edge. + - **`edge_status_502`** - Number of 502 status codes from edge. + - **`edge_status_503`** - Number of 503 status codes from edge. + - **`edge_status_504`** - Number of 504 status codes from edge. + - **`edge_status_505`** - Number of 505 status codes from edge. + - **`edge_status_5xx`** - Number of 5xx status codes from edge. + - **`edge_hit_ratio`** - Percent of cache hits (0.0 - 1.0). + - **`edge_hit_bytes`** - Number of bytes sent back when cache hits. + - **`origin_bandwidth`** - Bandwidth from CDN to Origin (bit/s.) + - **`origin_requests`** - Number of requests per interval (requests/s.) + - **`origin_status_1xx`** - Number of 1xx status from origin. + - **`origin_status_200`** - Number of 200 status from origin. + - **`origin_status_204`** - Number of 204 status from origin. + - **`origin_status_206`** - Number of 206 status from origin. + - **`origin_status_2xx`** - Number of 2xx status from origin. + - **`origin_status_301`** - Number of 301 status from origin. + - **`origin_status_302`** - Number of 302 status from origin. + - **`origin_status_304`** - Number of 304 status from origin. + - **`origin_status_3xx`** - Number of 3xx status from origin. + - **`origin_status_400`** - Number of 400 status from origin. + - **`origin_status_401`** - Number of 401 status from origin. + - **`origin_status_403`** - Number of 403 status from origin. + - **`origin_status_404`** - Number of 404 status from origin. + - **`origin_status_416`** - Number of 416 status from origin. + - **`origin_status_429`** - Number of 426 status from origin. + - **`origin_status_4xx`** - Number of 4xx status from origin. + - **`origin_status_500`** - Number of 500 status from origin. + - **`origin_status_501`** - Number of 501 status from origin. + - **`origin_status_502`** - Number of 502 status from origin. + - **`origin_status_503`** - Number of 503 status from origin. + - **`origin_status_504`** - Number of 504 status from origin. + - **`origin_status_505`** - Number of 505 status from origin. + - **`origin_status_5xx`** - Number of 5xx status from origin. + - **`edge_download_speed`** - Download speed from edge in KB/s (includes only + requests that status was in the range [200, 300].) + - **`origin_download_speed`** - Download speed from origin in KB/s (includes + only requests that status was in the range [200, 300].) + """ + + to: Required[str] + """Specifies ending period to fetch metrics (ISO 8601/RFC 3339 format, UTC) + + Examples: + + - 2021-06-15T00:00:00Z + - 2021-06-15T00:00:00.000Z + + The total number of points, which is determined as the difference between "from" + and "to" divided by "granularity", cannot exceed 1440. Exception: "speed" + metrics are limited to 72 points. + """ + + filter_by: Iterable[FilterBy] + """Each item represents one filter statement.""" + + granularity: str + """Duration of the time blocks into which the data is divided. + + The value must correspond to the ISO 8601 period format. + + Examples: + + - P1D + - PT5M + + Notes: + + - The total number of points, which is determined as the difference between + "from" and "to" divided by "granularity", cannot exceed 1440. Exception: + "speed" metrics are limited to 72 points. + - For "speed" metrics the value must be a multiple of 5. + """ + + group_by: SequenceNotStr[str] + """Output data grouping. + + Possible values: + + - **resource** - Data is grouped by CDN resource. + - **cname** - Data is grouped by common names. + - **region** – Data is grouped by regions (continents.) Available for "speed" + metrics only. + - **isp** - Data is grouped by ISP names. Available for "speed" metrics only. + """ + + +class FilterBy(TypedDict, total=False): + field: Required[str] + """Defines the parameters by that data can be filtered. + + Possible values: + + - **resource** - Data is filtered by CDN resource ID. + - **cname** - Data is filtered by common name. + - **region** - Data is filtered by region (continent.) Available for "speed" + metrics only. + - **isp** - Data is filtered by ISP name. Available for "speed" metrics only. + """ + + op: Required[str] + """Comparison operator to be applied. + + Possible values: + + - **in** - 'IN' operator. + - **`not_in`** - 'NOT IN' operator. + - **gt** - '>' operator. + - **gte** - '>=' operator. + - **lt** - '<' operator. + - **lte** - '<=' operator. + - **eq** - '==' operator. + - **ne** - '!=' operator. + - **like** - 'LIKE' operator. + - **`not_like`** - 'NOT LIKE' operator. + """ + + values: Required[SequenceNotStr[Union[float, str]]] + """Contains one or more values to be compared against.""" diff --git a/src/gcore/types/cdn/network_capacity.py b/src/gcore/types/cdn/network_capacity.py new file mode 100644 index 00000000..8d76c0c5 --- /dev/null +++ b/src/gcore/types/cdn/network_capacity.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["NetworkCapacity", "NetworkCapacityItem"] + + +class NetworkCapacityItem(BaseModel): + capacity: Optional[float] = None + """Network capacity in Gbit/s.""" + + country: Optional[str] = None + """Country name.""" + + country_code: Optional[str] = None + """ISO country code.""" + + +NetworkCapacity: TypeAlias = List[NetworkCapacityItem] diff --git a/src/gcore/types/cdn/origin_group_create_params.py b/src/gcore/types/cdn/origin_group_create_params.py new file mode 100644 index 00000000..74f3a60a --- /dev/null +++ b/src/gcore/types/cdn/origin_group_create_params.py @@ -0,0 +1,184 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Required, TypeAlias, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["OriginGroupCreateParams", "NoneAuth", "NoneAuthSource", "AwsSignatureV4", "AwsSignatureV4Auth"] + + +class NoneAuth(TypedDict, total=False): + name: Required[str] + """Origin group name.""" + + sources: Required[Iterable[NoneAuthSource]] + """List of origin sources in the origin group.""" + + auth_type: str + """Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + """ + + proxy_next_upstream: SequenceNotStr[str] + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + use_next: bool + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class NoneAuthSource(TypedDict, total=False): + backup: bool + """ + Defines whether the origin is a backup, meaning that it will not be used until + one of active origins become unavailable. + + Possible values: + + - **true** - Origin is a backup. + - **false** - Origin is not a backup. + """ + + enabled: bool + """Enables or disables an origin source in the origin group. + + Possible values: + + - **true** - Origin is enabled and the CDN uses it to pull content. + - **false** - Origin is disabled and the CDN does not use it to pull content. + + Origin group must contain at least one enabled origin. + """ + + source: str + """IP address or domain name of the origin and the port, if custom port is used.""" + + +class AwsSignatureV4(TypedDict, total=False): + auth: Required[AwsSignatureV4Auth] + """Credentials to access the private bucket.""" + + auth_type: Required[str] + """Authentication type. + + **awsSignatureV4** value is used for S3 storage. + """ + + name: Required[str] + """Origin group name.""" + + proxy_next_upstream: SequenceNotStr[str] + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + use_next: bool + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class AwsSignatureV4Auth(TypedDict, total=False): + s3_access_key_id: Required[str] + """Access key ID for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), colon, dash, and underscore. + - From 3 to 512 characters. + """ + + s3_bucket_name: Required[str] + """S3 bucket name. + + Restrictions: + + - Maximum 128 characters. + """ + + s3_secret_access_key: Required[str] + """Secret access key for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and + underscores. + - If "`s3_type`": amazon, length should be 40 characters. + - If "`s3_type`": other, length should be from 16 to 255 characters. + """ + + s3_type: Required[str] + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + s3_region: str + """S3 storage region. + + The parameter is required, if "`s3_type`": amazon. + """ + + s3_storage_hostname: str + """S3 storage hostname. + + The parameter is required, if "`s3_type`": other. + """ + + +OriginGroupCreateParams: TypeAlias = Union[NoneAuth, AwsSignatureV4] diff --git a/src/gcore/types/cdn/origin_group_list_params.py b/src/gcore/types/cdn/origin_group_list_params.py new file mode 100644 index 00000000..9a19eea1 --- /dev/null +++ b/src/gcore/types/cdn/origin_group_list_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["OriginGroupListParams"] + + +class OriginGroupListParams(TypedDict, total=False): + has_related_resources: bool + """Defines whether the origin group has related CDN resources. + + Possible values: + + - **true** – Origin group has related CDN resources. + - **false** – Origin group does not have related CDN resources. + """ + + name: str + """Origin group name.""" + + sources: str + """Origin sources (IP addresses or domains) in the origin group.""" diff --git a/src/gcore/types/cdn/origin_group_replace_params.py b/src/gcore/types/cdn/origin_group_replace_params.py new file mode 100644 index 00000000..4125cae7 --- /dev/null +++ b/src/gcore/types/cdn/origin_group_replace_params.py @@ -0,0 +1,190 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Required, TypeAlias, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["OriginGroupReplaceParams", "NoneAuth", "NoneAuthSource", "AwsSignatureV4", "AwsSignatureV4Auth"] + + +class NoneAuth(TypedDict, total=False): + auth_type: Required[str] + """Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + """ + + name: Required[str] + """Origin group name.""" + + path: Required[str] + """Parameter is **deprecated**.""" + + sources: Required[Iterable[NoneAuthSource]] + """List of origin sources in the origin group.""" + + use_next: Required[bool] + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + proxy_next_upstream: SequenceNotStr[str] + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + +class NoneAuthSource(TypedDict, total=False): + backup: bool + """ + Defines whether the origin is a backup, meaning that it will not be used until + one of active origins become unavailable. + + Possible values: + + - **true** - Origin is a backup. + - **false** - Origin is not a backup. + """ + + enabled: bool + """Enables or disables an origin source in the origin group. + + Possible values: + + - **true** - Origin is enabled and the CDN uses it to pull content. + - **false** - Origin is disabled and the CDN does not use it to pull content. + + Origin group must contain at least one enabled origin. + """ + + source: str + """IP address or domain name of the origin and the port, if custom port is used.""" + + +class AwsSignatureV4(TypedDict, total=False): + auth: Required[AwsSignatureV4Auth] + """Credentials to access the private bucket.""" + + auth_type: Required[str] + """Authentication type. + + **awsSignatureV4** value is used for S3 storage. + """ + + name: Required[str] + """Origin group name.""" + + path: Required[str] + """Parameter is **deprecated**.""" + + use_next: Required[bool] + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + proxy_next_upstream: SequenceNotStr[str] + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + +class AwsSignatureV4Auth(TypedDict, total=False): + s3_access_key_id: Required[str] + """Access key ID for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), colon, dash, and underscore. + - From 3 to 512 characters. + """ + + s3_bucket_name: Required[str] + """S3 bucket name. + + Restrictions: + + - Maximum 128 characters. + """ + + s3_secret_access_key: Required[str] + """Secret access key for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and + underscores. + - If "`s3_type`": amazon, length should be 40 characters. + - If "`s3_type`": other, length should be from 16 to 255 characters. + """ + + s3_type: Required[str] + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + s3_region: str + """S3 storage region. + + The parameter is required, if "`s3_type`": amazon. + """ + + s3_storage_hostname: str + """S3 storage hostname. + + The parameter is required, if "`s3_type`": other. + """ + + +OriginGroupReplaceParams: TypeAlias = Union[NoneAuth, AwsSignatureV4] diff --git a/src/gcore/types/cdn/origin_group_update_params.py b/src/gcore/types/cdn/origin_group_update_params.py new file mode 100644 index 00000000..47d5a0d7 --- /dev/null +++ b/src/gcore/types/cdn/origin_group_update_params.py @@ -0,0 +1,190 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Required, TypeAlias, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["OriginGroupUpdateParams", "NoneAuth", "NoneAuthSource", "AwsSignatureV4", "AwsSignatureV4Auth"] + + +class NoneAuth(TypedDict, total=False): + name: Required[str] + """Origin group name.""" + + auth_type: str + """Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + """ + + path: str + """Parameter is **deprecated**.""" + + proxy_next_upstream: SequenceNotStr[str] + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + sources: Iterable[NoneAuthSource] + """List of origin sources in the origin group.""" + + use_next: bool + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class NoneAuthSource(TypedDict, total=False): + backup: bool + """ + Defines whether the origin is a backup, meaning that it will not be used until + one of active origins become unavailable. + + Possible values: + + - **true** - Origin is a backup. + - **false** - Origin is not a backup. + """ + + enabled: bool + """Enables or disables an origin source in the origin group. + + Possible values: + + - **true** - Origin is enabled and the CDN uses it to pull content. + - **false** - Origin is disabled and the CDN does not use it to pull content. + + Origin group must contain at least one enabled origin. + """ + + source: str + """IP address or domain name of the origin and the port, if custom port is used.""" + + +class AwsSignatureV4(TypedDict, total=False): + auth: AwsSignatureV4Auth + """Credentials to access the private bucket.""" + + auth_type: str + """Authentication type. + + **awsSignatureV4** value is used for S3 storage. + """ + + name: str + """Origin group name.""" + + path: str + """Parameter is **deprecated**.""" + + proxy_next_upstream: SequenceNotStr[str] + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + use_next: bool + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class AwsSignatureV4Auth(TypedDict, total=False): + s3_access_key_id: Required[str] + """Access key ID for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), colon, dash, and underscore. + - From 3 to 512 characters. + """ + + s3_bucket_name: Required[str] + """S3 bucket name. + + Restrictions: + + - Maximum 128 characters. + """ + + s3_secret_access_key: Required[str] + """Secret access key for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and + underscores. + - If "`s3_type`": amazon, length should be 40 characters. + - If "`s3_type`": other, length should be from 16 to 255 characters. + """ + + s3_type: Required[str] + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + s3_region: str + """S3 storage region. + + The parameter is required, if "`s3_type`": amazon. + """ + + s3_storage_hostname: str + """S3 storage hostname. + + The parameter is required, if "`s3_type`": other. + """ + + +OriginGroupUpdateParams: TypeAlias = Union[NoneAuth, AwsSignatureV4] diff --git a/src/gcore/types/cdn/origin_groups.py b/src/gcore/types/cdn/origin_groups.py new file mode 100644 index 00000000..50c3eb01 --- /dev/null +++ b/src/gcore/types/cdn/origin_groups.py @@ -0,0 +1,212 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["OriginGroups", "NoneAuth", "NoneAuthSource", "AwsSignatureV4", "AwsSignatureV4Auth"] + + +class NoneAuthSource(BaseModel): + backup: Optional[bool] = None + """ + Defines whether the origin is a backup, meaning that it will not be used until + one of active origins become unavailable. + + Possible values: + + - **true** - Origin is a backup. + - **false** - Origin is not a backup. + """ + + enabled: Optional[bool] = None + """Enables or disables an origin source in the origin group. + + Possible values: + + - **true** - Origin is enabled and the CDN uses it to pull content. + - **false** - Origin is disabled and the CDN does not use it to pull content. + + Origin group must contain at least one enabled origin. + """ + + source: Optional[str] = None + """IP address or domain name of the origin and the port, if custom port is used.""" + + +class NoneAuth(BaseModel): + id: Optional[int] = None + """Origin group ID.""" + + auth_type: Optional[str] = None + """Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + """ + + has_related_resources: Optional[bool] = None + """Defines whether the origin group has related CDN resources. + + Possible values: + + - **true** - Origin group has related CDN resources. + - **false** - Origin group does not have related CDN resources. + """ + + name: Optional[str] = None + """Origin group name.""" + + path: Optional[str] = None + """Parameter is **deprecated**.""" + + proxy_next_upstream: Optional[List[str]] = None + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + sources: Optional[List[NoneAuthSource]] = None + """List of origin sources in the origin group.""" + + use_next: Optional[bool] = None + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class AwsSignatureV4Auth(BaseModel): + s3_access_key_id: str + """Access key ID for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), colon, dash, and underscore. + - From 3 to 512 characters. + """ + + s3_bucket_name: str + """S3 bucket name. + + Restrictions: + + - Maximum 128 characters. + """ + + s3_secret_access_key: str + """Secret access key for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and + underscores. + - If "`s3_type`": amazon, length should be 40 characters. + - If "`s3_type`": other, length should be from 16 to 255 characters. + """ + + s3_type: str + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + s3_region: Optional[str] = None + """S3 storage region. + + The parameter is required, if "`s3_type`": amazon. + """ + + s3_storage_hostname: Optional[str] = None + """S3 storage hostname. + + The parameter is required, if "`s3_type`": other. + """ + + +class AwsSignatureV4(BaseModel): + id: Optional[int] = None + """Origin group ID.""" + + auth: Optional[AwsSignatureV4Auth] = None + """Credentials to access the private bucket.""" + + auth_type: Optional[str] = None + """Authentication type. + + **awsSignatureV4** value is used for S3 storage. + """ + + has_related_resources: Optional[bool] = None + """Defines whether the origin group has related CDN resources. + + Possible values: + + - **true** - Origin group has related CDN resources. + - **false** - Origin group does not have related CDN resources. + """ + + name: Optional[str] = None + """Origin group name.""" + + path: Optional[str] = None + """Parameter is **deprecated**.""" + + proxy_next_upstream: Optional[List[str]] = None + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + use_next: Optional[bool] = None + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +OriginGroups: TypeAlias = Union[NoneAuth, AwsSignatureV4] diff --git a/src/gcore/types/cdn/origin_groups_list.py b/src/gcore/types/cdn/origin_groups_list.py new file mode 100644 index 00000000..248241d2 --- /dev/null +++ b/src/gcore/types/cdn/origin_groups_list.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .origin_groups import OriginGroups + +__all__ = ["OriginGroupsList"] + +OriginGroupsList: TypeAlias = List[OriginGroups] diff --git a/src/gcore/types/cdn/public_ip_list.py b/src/gcore/types/cdn/public_ip_list.py new file mode 100644 index 00000000..ce8272df --- /dev/null +++ b/src/gcore/types/cdn/public_ip_list.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["PublicIPList"] + + +class PublicIPList(BaseModel): + addresses: Optional[List[str]] = None + """List of IPv4 addresses.""" + + addresses_v6: Optional[List[str]] = None + """List of IPv6 addresses.""" diff --git a/src/gcore/types/cdn/public_network_list.py b/src/gcore/types/cdn/public_network_list.py new file mode 100644 index 00000000..2cc5570d --- /dev/null +++ b/src/gcore/types/cdn/public_network_list.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["PublicNetworkList"] + + +class PublicNetworkList(BaseModel): + addresses: Optional[List[str]] = None + """List of IPv4 networks.""" + + addresses_v6: Optional[List[str]] = None + """List of IPv6 networks.""" diff --git a/src/gcore/types/cdn/purge_status.py b/src/gcore/types/cdn/purge_status.py new file mode 100644 index 00000000..2ac5c9f3 --- /dev/null +++ b/src/gcore/types/cdn/purge_status.py @@ -0,0 +1,55 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["PurgeStatus", "Resource"] + + +class Resource(BaseModel): + id: Optional[int] = None + """Resource ID.""" + + cname: Optional[str] = None + """CNAME of the resource.""" + + +class PurgeStatus(BaseModel): + created: Optional[str] = None + """Date and time when the purge was created (ISO 8601/RFC 3339 format, UTC).""" + + payload: Optional[object] = None + """Purge payload depends on purge type. + + Possible values: + + - **urls** - Purge by URL. + - **paths** - Purge by Pattern and purge All. + """ + + purge_id: Optional[int] = None + """Purge ID.""" + + purge_type: Optional[str] = None + """Contains the name of the purge request type. + + Possible values: + + - **`purge_by_pattern`** - Purge by Pattern. + - **`purge_by_url`** - Purge by URL. + - **`purge_all`** - Purge All. + """ + + resource: Optional[Resource] = None + + status: Optional[Literal["In progress", "Successful", "Failed"]] = None + """Purge status. + + Possible values: + + - **In progress** - Purge is in progress. + - **Successful** - Purge was successful. + - **Failed** - Purge failed. + """ diff --git a/src/gcore/types/cdn/resource_aggregated_stats.py b/src/gcore/types/cdn/resource_aggregated_stats.py new file mode 100644 index 00000000..5d6453a2 --- /dev/null +++ b/src/gcore/types/cdn/resource_aggregated_stats.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["ResourceAggregatedStats"] + + +class ResourceAggregatedStats(BaseModel): + api_1_example: Optional[object] = FieldInfo(alias="1 (example)", default=None) + """CDN resource ID for which statistics data is shown.""" + + api_95_percentile: Optional[int] = FieldInfo(alias="95_percentile", default=None) + """95 percentile bandwidth value""" + + backblaze_bytes: Optional[int] = None + """Traffic in bytes from Backblaze origin.""" + + cache_hit_traffic_ratio: Optional[int] = None + """Formula: 1 - `upstream_bytes` / `sent_bytes`. + + We deduct the non-cached traffic from the total traffic amount + """ + + cis_example: Optional[object] = FieldInfo(alias="cis (example)", default=None) + """Region by which statistics data is grouped.""" + + max_bandwidth: Optional[int] = None + """Maximum bandwidth""" + + metrics: Optional[object] = None + """Statistics parameters.""" + + min_bandwidth: Optional[int] = None + """Minimum bandwidth""" + + region: Optional[object] = None + """Regions by which statistics data is grouped.""" + + requests: Optional[int] = None + """Number of requests to edge servers.""" + + resource: Optional[object] = None + """Resources IDs by which statistics data is grouped.""" + + response_types: Optional[object] = None + """Statistics by content type. + + It returns a number of responses for content with different MIME types. + """ + + responses_2xx: Optional[int] = None + """Number of 2xx response codes.""" + + responses_3xx: Optional[int] = None + """Number of 3xx response codes.""" + + responses_4xx: Optional[int] = None + """Number of 4xx response codes.""" + + responses_5xx: Optional[int] = None + """Number of 5xx response codes.""" + + responses_hit: Optional[int] = None + """Number of responses with the header Cache: HIT.""" + + responses_miss: Optional[int] = None + """Number of responses with the header Cache: MISS.""" + + sent_bytes: Optional[int] = None + """Traffic in bytes from CDN servers to clients.""" + + total_bytes: Optional[int] = None + """Upstream bytes and `sent_bytes` combined.""" + + upstream_bytes: Optional[int] = None + """Traffic in bytes from the upstream to CDN servers.""" diff --git a/src/gcore/types/cdn/resource_create_params.py b/src/gcore/types/cdn/resource_create_params.py new file mode 100644 index 00000000..fbde3142 --- /dev/null +++ b/src/gcore/types/cdn/resource_create_params.py @@ -0,0 +1,1825 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = [ + "ResourceCreateParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsHttp3Enabled", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsTlsVersions", + "OptionsUseDefaultLeChain", + "OptionsUseDns01LeChallenge", + "OptionsUseRsaLeCert", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class ResourceCreateParams(TypedDict, total=False): + cname: Required[str] + """Delivery domains that will be used for content delivery through a CDN. + + Delivery domains should be added to your DNS settings. + """ + + origin: Required[str] + """IP address or domain name of the origin and the port, if custom port is used. + + You can use either the `origin` or `originGroup` parameter in the request. + """ + + origin_group: Required[Annotated[int, PropertyInfo(alias="originGroup")]] + """Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + """ + + active: bool + """Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + """ + + description: str + """Optional comment describing the CDN resource.""" + + name: Optional[str] + """CDN resource name.""" + + options: Options + """List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + """ + + origin_protocol: Annotated[Literal["HTTP", "HTTPS", "MATCH"], PropertyInfo(alias="originProtocol")] + """Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + """ + + primary_resource: Optional[int] + """ + ID of the main CDN resource which has a shared caching zone with a reserve CDN + resource. + + If the parameter is not empty, then the current CDN resource is the reserve. You + cannot change some options, create rules, set up origin shielding, or use the + reserve CDN resource for Streaming. + """ + + proxy_ssl_ca: Optional[int] + """ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_data: Optional[int] + """ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_enabled: bool + """ + Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + """ + + secondary_hostnames: Annotated[SequenceNotStr[str], PropertyInfo(alias="secondaryHostnames")] + """ + Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + """ + + ssl_data: Annotated[Optional[int], PropertyInfo(alias="sslData")] + """ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + """ + + ssl_enabled: Annotated[bool, PropertyInfo(alias="sslEnabled")] + """Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + """ + + waap_api_domain_enabled: bool + """Defines whether the associated WAAP Domain is identified as an API Domain. + + Possible values: + + - **true** - The associated WAAP Domain is designated as an API Domain. + - **false** - The associated WAAP Domain is not designated as an API Domain. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsHttp3Enabled(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsTlsVersions(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"]]] + """List of SSL/TLS protocol versions (case sensitive).""" + + +class OptionsUseDefaultLeChain(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Default Let's Encrypt certificate chain. This is a deprecated + version, use it only for compatibilities with Android devices 7.1.1 or lower. + - **false** - Alternative Let's Encrypt certificate chain. + """ + + +class OptionsUseDns01LeChallenge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - DNS-01 challenge is used to issue Let's Encrypt certificate. + - **false** - HTTP-01 challenge is used to issue Let's Encrypt certificate. + """ + + +class OptionsUseRsaLeCert(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - RSA Let's Encrypt certificate. + - **false** - ECDSA Let's Encrypt certificate. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + http3_enabled: Optional[OptionsHttp3Enabled] + """Enables HTTP/3 protocol for content delivery. + + `http3_enabled` option works only with `"sslEnabled": true`. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + tls_versions: Optional[OptionsTlsVersions] + """ + List of SSL/TLS protocol versions allowed for HTTPS connections from end users + to the domain. + + When the option is disabled, all protocols versions are allowed. + """ + + use_default_le_chain: Optional[OptionsUseDefaultLeChain] + """Let's Encrypt certificate chain. + + The specified chain will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + use_dns01_le_challenge: Optional[OptionsUseDns01LeChallenge] + """DNS-01 challenge to issue a Let's Encrypt certificate for the resource. + + DNS service should be activated to enable this option. + """ + + use_rsa_le_cert: Optional[OptionsUseRsaLeCert] + """RSA Let's Encrypt certificate type for the CDN resource. + + The specified value will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/resource_list_params.py b/src/gcore/types/cdn/resource_list_params.py new file mode 100644 index 00000000..24c26506 --- /dev/null +++ b/src/gcore/types/cdn/resource_list_params.py @@ -0,0 +1,107 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ResourceListParams"] + + +class ResourceListParams(TypedDict, total=False): + cname: str + """Delivery domain (CNAME) of the CDN resource.""" + + deleted: bool + """Defines whether a CDN resource has been deleted. + + Possible values: + + - **true** - CDN resource has been deleted. + - **false** - CDN resource has not been deleted. + """ + + enabled: bool + """Enables or disables a CDN resource change by a user. + + Possible values: + + - **true** - CDN resource is enabled. + - **false** - CDN resource is disabled. + """ + + max_created: str + """ + Most recent date of CDN resource creation for which CDN resources should be + returned (ISO 8601/RFC 3339 format, UTC.) + """ + + min_created: str + """ + Earliest date of CDN resource creation for which CDN resources should be + returned (ISO 8601/RFC 3339 format, UTC.) + """ + + origin_group: Annotated[int, PropertyInfo(alias="originGroup")] + """Origin group ID.""" + + rules: str + """Rule name or pattern.""" + + secondary_hostnames: Annotated[str, PropertyInfo(alias="secondaryHostnames")] + """Additional delivery domains (CNAMEs) of the CDN resource.""" + + shield_dc: str + """Name of the origin shielding data center location.""" + + shielded: bool + """Defines whether origin shielding is enabled for the CDN resource. + + Possible values: + + - **true** - Origin shielding is enabled for the CDN resource. + - **false** - Origin shielding is disabled for the CDN resource. + """ + + ssl_data: Annotated[int, PropertyInfo(alias="sslData")] + """SSL certificate ID.""" + + ssl_data_in: Annotated[int, PropertyInfo(alias="sslData_in")] + """SSL certificates IDs. + + Example: + + - ?`sslData_in`=1643,1644,1652 + """ + + ssl_enabled: Annotated[bool, PropertyInfo(alias="sslEnabled")] + """Defines whether the HTTPS protocol is enabled for content delivery. + + Possible values: + + - **true** - HTTPS protocol is enabled for CDN resource. + - **false** - HTTPS protocol is disabled for CDN resource. + """ + + status: Literal["active", "processed", "suspended", "deleted"] + """CDN resource status.""" + + suspend: bool + """Defines whether the CDN resource was automatically suspended by the system. + + Possible values: + + - **true** - CDN resource is selected for automatic suspension in the next 7 + days. + - **false** - CDN resource is not selected for automatic suspension. + """ + + vp_enabled: bool + """Defines whether the CDN resource is integrated with the Streaming platform. + + Possible values: + + - **true** - CDN resource is used for Streaming platform. + - **false** - CDN resource is not used for Streaming platform. + """ diff --git a/src/gcore/types/cdn/resource_prefetch_params.py b/src/gcore/types/cdn/resource_prefetch_params.py new file mode 100644 index 00000000..1fc88a63 --- /dev/null +++ b/src/gcore/types/cdn/resource_prefetch_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["ResourcePrefetchParams"] + + +class ResourcePrefetchParams(TypedDict, total=False): + paths: Required[SequenceNotStr[str]] + """Paths to files that should be pre-populated to the CDN. + + Paths to the files should be specified without a domain name. + """ diff --git a/src/gcore/types/cdn/resource_purge_params.py b/src/gcore/types/cdn/resource_purge_params.py new file mode 100644 index 00000000..5342995f --- /dev/null +++ b/src/gcore/types/cdn/resource_purge_params.py @@ -0,0 +1,71 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["ResourcePurgeParams", "PurgeByURL", "PurgeByPattern", "PurgeAllCache"] + + +class PurgeByURL(TypedDict, total=False): + urls: SequenceNotStr[str] + """**Purge by URL** clears the cache of a specific files. + + This purge type is recommended. + + Specify file URLs including query strings. URLs should start with / without a + domain name. + + Purge by URL depends on the following CDN options: + + 1. "vary response header" is used. If your origin serves variants of the same + content depending on the Vary HTTP response header, purge by URL will delete + only one version of the file. + 2. "slice" is used. If you update several files in the origin without clearing + the CDN cache, purge by URL will delete only the first slice (with bytes=0… + .) + 3. "ignoreQueryString" is used. Don’t specify parameters in the purge request. + 4. "`query_params_blacklist`" is used. Only files with the listed in the option + parameters will be cached as different objects. Files with other parameters + will be cached as one object. In this case, specify the listed parameters in + the Purge request. Don't specify other parameters. + 5. "`query_params_whitelist`" is used. Files with listed in the option + parameters will be cached as one object. Files with other parameters will be + cached as different objects. In this case, specify other parameters (if any) + besides the ones listed in the purge request. + """ + + +class PurgeByPattern(TypedDict, total=False): + paths: SequenceNotStr[str] + """**Purge by pattern** clears the cache that matches the pattern. + + Use \\** operator, which replaces any number of symbols in your path. It's + important to note that wildcard usage (\\**) is permitted only at the end of a + pattern. + + Query string added to any patterns will be ignored, and purge request will be + processed as if there weren't any parameters. + + Purge by pattern is recursive. Both /path and /path\\** will result in recursive + purging, meaning all content under the specified path will be affected. As such, + using the pattern /path\\** is functionally equivalent to simply using /path. + """ + + +class PurgeAllCache(TypedDict, total=False): + paths: SequenceNotStr[str] + """**Purge all cache** clears the entire cache for the CDN resource. + + Specify an empty array to purge all content for the resource. + + When you purge all assets, CDN servers request content from your origin server + and cause a high load. Therefore, we recommend to use purge by URL for large + content quantities. + """ + + +ResourcePurgeParams: TypeAlias = Union[PurgeByURL, PurgeByPattern, PurgeAllCache] diff --git a/src/gcore/types/cdn/resource_replace_params.py b/src/gcore/types/cdn/resource_replace_params.py new file mode 100644 index 00000000..4128691f --- /dev/null +++ b/src/gcore/types/cdn/resource_replace_params.py @@ -0,0 +1,1803 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = [ + "ResourceReplaceParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsHttp3Enabled", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsTlsVersions", + "OptionsUseDefaultLeChain", + "OptionsUseDns01LeChallenge", + "OptionsUseRsaLeCert", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class ResourceReplaceParams(TypedDict, total=False): + origin_group: Required[Annotated[int, PropertyInfo(alias="originGroup")]] + """Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + """ + + active: bool + """Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + """ + + description: str + """Optional comment describing the CDN resource.""" + + name: Optional[str] + """CDN resource name.""" + + options: Options + """List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + """ + + origin_protocol: Annotated[Literal["HTTP", "HTTPS", "MATCH"], PropertyInfo(alias="originProtocol")] + """Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + """ + + proxy_ssl_ca: Optional[int] + """ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_data: Optional[int] + """ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_enabled: bool + """ + Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + """ + + secondary_hostnames: Annotated[SequenceNotStr[str], PropertyInfo(alias="secondaryHostnames")] + """ + Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + """ + + ssl_data: Annotated[Optional[int], PropertyInfo(alias="sslData")] + """ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + """ + + ssl_enabled: Annotated[bool, PropertyInfo(alias="sslEnabled")] + """Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + """ + + waap_api_domain_enabled: bool + """Defines whether the associated WAAP Domain is identified as an API Domain. + + Possible values: + + - **true** - The associated WAAP Domain is designated as an API Domain. + - **false** - The associated WAAP Domain is not designated as an API Domain. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsHttp3Enabled(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsTlsVersions(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"]]] + """List of SSL/TLS protocol versions (case sensitive).""" + + +class OptionsUseDefaultLeChain(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Default Let's Encrypt certificate chain. This is a deprecated + version, use it only for compatibilities with Android devices 7.1.1 or lower. + - **false** - Alternative Let's Encrypt certificate chain. + """ + + +class OptionsUseDns01LeChallenge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - DNS-01 challenge is used to issue Let's Encrypt certificate. + - **false** - HTTP-01 challenge is used to issue Let's Encrypt certificate. + """ + + +class OptionsUseRsaLeCert(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - RSA Let's Encrypt certificate. + - **false** - ECDSA Let's Encrypt certificate. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + http3_enabled: Optional[OptionsHttp3Enabled] + """Enables HTTP/3 protocol for content delivery. + + `http3_enabled` option works only with `"sslEnabled": true`. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + tls_versions: Optional[OptionsTlsVersions] + """ + List of SSL/TLS protocol versions allowed for HTTPS connections from end users + to the domain. + + When the option is disabled, all protocols versions are allowed. + """ + + use_default_le_chain: Optional[OptionsUseDefaultLeChain] + """Let's Encrypt certificate chain. + + The specified chain will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + use_dns01_le_challenge: Optional[OptionsUseDns01LeChallenge] + """DNS-01 challenge to issue a Let's Encrypt certificate for the resource. + + DNS service should be activated to enable this option. + """ + + use_rsa_le_cert: Optional[OptionsUseRsaLeCert] + """RSA Let's Encrypt certificate type for the CDN resource. + + The specified value will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/resource_update_params.py b/src/gcore/types/cdn/resource_update_params.py new file mode 100644 index 00000000..dad17ba7 --- /dev/null +++ b/src/gcore/types/cdn/resource_update_params.py @@ -0,0 +1,1794 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = [ + "ResourceUpdateParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsHttp3Enabled", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsTlsVersions", + "OptionsUseDefaultLeChain", + "OptionsUseDns01LeChallenge", + "OptionsUseRsaLeCert", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class ResourceUpdateParams(TypedDict, total=False): + active: bool + """Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + """ + + description: str + """Optional comment describing the CDN resource.""" + + name: Optional[str] + """CDN resource name.""" + + options: Options + """List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + """ + + origin_group: Annotated[int, PropertyInfo(alias="originGroup")] + """Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + """ + + origin_protocol: Annotated[Literal["HTTP", "HTTPS", "MATCH"], PropertyInfo(alias="originProtocol")] + """Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + """ + + proxy_ssl_ca: Optional[int] + """ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_data: Optional[int] + """ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_enabled: bool + """ + Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + """ + + secondary_hostnames: Annotated[SequenceNotStr[str], PropertyInfo(alias="secondaryHostnames")] + """ + Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + """ + + ssl_data: Annotated[Optional[int], PropertyInfo(alias="sslData")] + """ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + """ + + ssl_enabled: Annotated[bool, PropertyInfo(alias="sslEnabled")] + """Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsHttp3Enabled(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsTlsVersions(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"]]] + """List of SSL/TLS protocol versions (case sensitive).""" + + +class OptionsUseDefaultLeChain(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Default Let's Encrypt certificate chain. This is a deprecated + version, use it only for compatibilities with Android devices 7.1.1 or lower. + - **false** - Alternative Let's Encrypt certificate chain. + """ + + +class OptionsUseDns01LeChallenge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - DNS-01 challenge is used to issue Let's Encrypt certificate. + - **false** - HTTP-01 challenge is used to issue Let's Encrypt certificate. + """ + + +class OptionsUseRsaLeCert(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - RSA Let's Encrypt certificate. + - **false** - ECDSA Let's Encrypt certificate. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + http3_enabled: Optional[OptionsHttp3Enabled] + """Enables HTTP/3 protocol for content delivery. + + `http3_enabled` option works only with `"sslEnabled": true`. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + tls_versions: Optional[OptionsTlsVersions] + """ + List of SSL/TLS protocol versions allowed for HTTPS connections from end users + to the domain. + + When the option is disabled, all protocols versions are allowed. + """ + + use_default_le_chain: Optional[OptionsUseDefaultLeChain] + """Let's Encrypt certificate chain. + + The specified chain will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + use_dns01_le_challenge: Optional[OptionsUseDns01LeChallenge] + """DNS-01 challenge to issue a Let's Encrypt certificate for the resource. + + DNS service should be activated to enable this option. + """ + + use_rsa_le_cert: Optional[OptionsUseRsaLeCert] + """RSA Let's Encrypt certificate type for the CDN resource. + + The specified value will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/resource_usage_stats.py b/src/gcore/types/cdn/resource_usage_stats.py new file mode 100644 index 00000000..7a6f6255 --- /dev/null +++ b/src/gcore/types/cdn/resource_usage_stats.py @@ -0,0 +1,111 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["ResourceUsageStats"] + + +class ResourceUsageStats(BaseModel): + api_1_example: Optional[object] = FieldInfo(alias="1 (example)", default=None) + """ID of CDN resource for which statistics data is shown.""" + + backblaze_bytes: Optional[List[int]] = None + """BackBlaze bytes from Backblaze origin. + + Represented by two values: + + - 1543622400 — Time in the UNIX timestamp when statistics were received. + - 17329220573 — Bytes. + """ + + metrics: Optional[object] = None + """Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding, if used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic value. + - **`cache_hit_requests_ratio`** – Share of sending cached content. Formula: + `responses_hit` / requests. + - **`shield_traffic_ratio`** – Origin shielding efficiency: how much more + traffic is sent from the origin shielding than from the origin. Formula: + (`shield_bytes` - `upstream_bytes`) / `shield_bytes`. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (when there is more than one origin,) we summarize + them. When aggregating several queries, the average is calculated. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + """ + + region: Optional[object] = None + """Locations (regions) by which the data is grouped. + + Possible values: + + - **asia** – Asia + - **au** – Australia + - **cis** – CIS (Commonwealth of Independent States) + - **eu** – Europe + - **latam** – Latin America + - **me** – Middle East + - **na** – North America + - **africa** – Africa + - **sa** – South America + """ + + resource: Optional[object] = None + """Resources IDs by which statistics data is grouped.""" + + sent_bytes: Optional[List[int]] = None + """Bytes from CDN servers to the end-users. + + Represented by two values: + + - 1543622400 — Time in the UNIX timestamp when statistics were received. + - 17329220573 — Bytes. + """ + + total_bytes: Optional[List[int]] = None + """Upstream bytes and `sent_bytes` combined. + + Represented by two values: + + - 1543622400 — Time in the UNIX timestamp when statistics were received. + - 17329220573 — Bytes. + """ + + upstream_bytes: Optional[List[int]] = None + """Bytes from the upstream to the CDN servers. + + Represented by two values: + + - 1543622400 — Time in the UNIX timestamp when statistics were received. + - 17329220573 — Bytes. + """ diff --git a/src/gcore/types/cdn/resources/__init__.py b/src/gcore/types/cdn/resources/__init__.py new file mode 100644 index 00000000..f5876a8a --- /dev/null +++ b/src/gcore/types/cdn/resources/__init__.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .origin_shielding import OriginShielding as OriginShielding +from .cdn_resource_rule import CdnResourceRule as CdnResourceRule +from .rule_create_params import RuleCreateParams as RuleCreateParams +from .rule_list_response import RuleListResponse as RuleListResponse +from .rule_update_params import RuleUpdateParams as RuleUpdateParams +from .rule_replace_params import RuleReplaceParams as RuleReplaceParams +from .shield_replace_params import ShieldReplaceParams as ShieldReplaceParams diff --git a/src/gcore/types/cdn/resources/cdn_resource_rule.py b/src/gcore/types/cdn/resources/cdn_resource_rule.py new file mode 100644 index 00000000..8bf93a9e --- /dev/null +++ b/src/gcore/types/cdn/resources/cdn_resource_rule.py @@ -0,0 +1,1695 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = [ + "CdnResourceRule", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class OptionsAllowedHTTPMethods(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]] + + +class OptionsBotProtectionBotChallenge(BaseModel): + enabled: Optional[bool] = None + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(BaseModel): + bot_challenge: OptionsBotProtectionBotChallenge + """Controls the bot challenge module state.""" + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + + +class OptionsCors(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: Optional[bool] = None + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Literal["allow", "deny"] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Optional[Dict[str, str]] = None + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: Optional[str] = None + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: Optional[str] = None + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: Optional[OptionsFastedgeOnRequestBody] = None + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: Optional[OptionsFastedgeOnRequestHeaders] = None + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: Optional[OptionsFastedgeOnResponseBody] = None + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: Optional[OptionsFastedgeOnResponseHeaders] = None + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(BaseModel): + codes: List[Literal[301, 302, 303, 307, 308]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(BaseModel): + end_time: str + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: str + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: Optional[str] = None + """Time zone used to calculate time.""" + + +class OptionsForceReturn(BaseModel): + body: str + """URL for redirection or text.""" + + code: int + """Status code value.""" + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] = None + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Host Header value.""" + + +class OptionsIgnoreCookie(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: Optional[bool] = None + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: Optional[bool] = None + """Enables or disables compression without quality loss for PNG format.""" + + quality: Optional[int] = None + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: Optional[bool] = None + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Literal["allow", "deny"] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Literal["static", "dynamic"] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: Optional[int] = None + """Amount of downloaded data after which the user will be rate limited.""" + + speed: Optional[int] = None + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: List[str] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: List[str] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Literal["allow", "deny"] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: int + """Maximum request rate.""" + + burst: Optional[int] = None + + delay: Optional[int] = None + + rate_unit: Optional[Literal["r/s", "r/m"]] = None + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: List[str] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Literal["hide", "show"] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(BaseModel): + body: str + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Optional[Literal["break", "last", "redirect", "permanent"]] = None + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Optional[str] = None + """Key generated on your side that will be used for URL signing.""" + + type: Optional[Literal[0, 2]] = None + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(BaseModel): + custom_hostname: str + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Optional[Literal["dynamic", "custom"]] = None + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(BaseModel): + name: str + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: List[str] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: Optional[bool] = None + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[OptionsStaticResponseHeadersValue] + + +class OptionsStaticHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Dict[str, str] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Dict[str, str] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Literal["allow", "deny"] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(BaseModel): + allowed_http_methods: Optional[OptionsAllowedHTTPMethods] = FieldInfo(alias="allowedHttpMethods", default=None) + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] = None + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] = None + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] = None + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] = None + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] = None + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] = None + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] = None + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] = None + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] = None + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] = None + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] = None + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] = None + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] = None + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] = None + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Optional[OptionsGzipOn] = FieldInfo(alias="gzipOn", default=None) + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Optional[OptionsHostHeader] = FieldInfo(alias="hostHeader", default=None) + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] = None + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Optional[OptionsIgnoreQueryString] = FieldInfo(alias="ignoreQueryString", default=None) + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] = None + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] = None + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] = None + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] = None + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] = None + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] = None + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] = None + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] = None + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] = None + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] = None + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] = None + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] = None + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] = None + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] = None + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] = None + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] = None + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] = None + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] = None + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] = None + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] = None + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] = None + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Optional[OptionsStaticHeaders] = FieldInfo(alias="staticHeaders", default=None) + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Optional[OptionsStaticRequestHeaders] = FieldInfo( + alias="staticRequestHeaders", default=None + ) + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] = None + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] = None + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] = None + """Enables or disables WebSockets connections to an origin server.""" + + +class CdnResourceRule(BaseModel): + id: Optional[int] = None + """Rule ID.""" + + active: Optional[bool] = None + """Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + """ + + deleted: Optional[bool] = None + """Defines whether the rule has been deleted. + + Possible values: + + - **true** - Rule has been deleted. + - **false** - Rule has not been deleted. + """ + + name: Optional[str] = None + """Rule name.""" + + options: Optional[Options] = None + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + origin_group: Optional[int] = FieldInfo(alias="originGroup", default=None) + """ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + """ + + origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] = FieldInfo(alias="originProtocol", default=None) + """Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + """ + + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] = FieldInfo( + alias="overrideOriginProtocol", default=None + ) + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + preset_applied: Optional[bool] = None + """Defines whether the rule has an applied preset. + + Possible values: + + - **true** - Rule has a preset applied. + - **false** - Rule does not have a preset applied. + + If a preset is applied to the rule, the options included in the preset cannot be + edited for the rule. + """ + + primary_rule: Optional[int] = None + """ + ID of the rule with which the current rule is synchronized within the CDN + resource shared cache zone feature. + """ + + rule: Optional[str] = None + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Optional[int] = FieldInfo(alias="ruleType", default=None) + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + weight: Optional[int] = None + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ diff --git a/src/gcore/types/cdn/resources/origin_shielding.py b/src/gcore/types/cdn/resources/origin_shielding.py new file mode 100644 index 00000000..f188e7ac --- /dev/null +++ b/src/gcore/types/cdn/resources/origin_shielding.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["OriginShielding"] + + +class OriginShielding(BaseModel): + shielding_pop: Optional[int] = None + """Shielding location ID. + + If origin shielding is disabled, the parameter value is **null**. + """ diff --git a/src/gcore/types/cdn/resources/rule_create_params.py b/src/gcore/types/cdn/resources/rule_create_params.py new file mode 100644 index 00000000..b9c282ce --- /dev/null +++ b/src/gcore/types/cdn/resources/rule_create_params.py @@ -0,0 +1,1652 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._types import SequenceNotStr +from ...._utils import PropertyInfo + +__all__ = [ + "RuleCreateParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class RuleCreateParams(TypedDict, total=False): + name: Required[str] + """Rule name.""" + + rule: Required[str] + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Required[Annotated[int, PropertyInfo(alias="ruleType")]] + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + active: bool + """Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + """ + + options: Options + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + origin_group: Annotated[Optional[int], PropertyInfo(alias="originGroup")] + """ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + """ + + override_origin_protocol: Annotated[ + Optional[Literal["HTTPS", "HTTP", "MATCH"]], PropertyInfo(alias="overrideOriginProtocol") + ] + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + weight: int + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/resources/rule_list_response.py b/src/gcore/types/cdn/resources/rule_list_response.py new file mode 100644 index 00000000..06cbe617 --- /dev/null +++ b/src/gcore/types/cdn/resources/rule_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .cdn_resource_rule import CdnResourceRule + +__all__ = ["RuleListResponse"] + +RuleListResponse: TypeAlias = List[CdnResourceRule] diff --git a/src/gcore/types/cdn/resources/rule_replace_params.py b/src/gcore/types/cdn/resources/rule_replace_params.py new file mode 100644 index 00000000..6e9dfca4 --- /dev/null +++ b/src/gcore/types/cdn/resources/rule_replace_params.py @@ -0,0 +1,1654 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._types import SequenceNotStr +from ...._utils import PropertyInfo + +__all__ = [ + "RuleReplaceParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class RuleReplaceParams(TypedDict, total=False): + resource_id: Required[int] + + rule: Required[str] + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Required[Annotated[int, PropertyInfo(alias="ruleType")]] + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + active: bool + """Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + """ + + name: str + """Rule name.""" + + options: Options + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + origin_group: Annotated[Optional[int], PropertyInfo(alias="originGroup")] + """ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + """ + + override_origin_protocol: Annotated[ + Optional[Literal["HTTPS", "HTTP", "MATCH"]], PropertyInfo(alias="overrideOriginProtocol") + ] + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + weight: int + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/resources/rule_update_params.py b/src/gcore/types/cdn/resources/rule_update_params.py new file mode 100644 index 00000000..959e82a8 --- /dev/null +++ b/src/gcore/types/cdn/resources/rule_update_params.py @@ -0,0 +1,1654 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._types import SequenceNotStr +from ...._utils import PropertyInfo + +__all__ = [ + "RuleUpdateParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class RuleUpdateParams(TypedDict, total=False): + resource_id: Required[int] + + active: bool + """Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + """ + + name: str + """Rule name.""" + + options: Options + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + origin_group: Annotated[Optional[int], PropertyInfo(alias="originGroup")] + """ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + """ + + override_origin_protocol: Annotated[ + Optional[Literal["HTTPS", "HTTP", "MATCH"]], PropertyInfo(alias="overrideOriginProtocol") + ] + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + rule: str + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Annotated[int, PropertyInfo(alias="ruleType")] + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + weight: int + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/resources/shield_replace_params.py b/src/gcore/types/cdn/resources/shield_replace_params.py new file mode 100644 index 00000000..3cc4e963 --- /dev/null +++ b/src/gcore/types/cdn/resources/shield_replace_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["ShieldReplaceParams"] + + +class ShieldReplaceParams(TypedDict, total=False): + shielding_pop: Optional[int] + """Shielding location ID. + + If origin shielding is disabled, the parameter value is **null**. + """ diff --git a/src/gcore/types/cdn/rule_template.py b/src/gcore/types/cdn/rule_template.py new file mode 100644 index 00000000..000e8ebd --- /dev/null +++ b/src/gcore/types/cdn/rule_template.py @@ -0,0 +1,1666 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "RuleTemplate", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class OptionsAllowedHTTPMethods(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]] + + +class OptionsBotProtectionBotChallenge(BaseModel): + enabled: Optional[bool] = None + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(BaseModel): + bot_challenge: OptionsBotProtectionBotChallenge + """Controls the bot challenge module state.""" + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + + +class OptionsCors(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: Optional[bool] = None + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Literal["allow", "deny"] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Optional[Dict[str, str]] = None + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: Optional[str] = None + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: Optional[str] = None + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: Optional[OptionsFastedgeOnRequestBody] = None + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: Optional[OptionsFastedgeOnRequestHeaders] = None + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: Optional[OptionsFastedgeOnResponseBody] = None + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: Optional[OptionsFastedgeOnResponseHeaders] = None + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(BaseModel): + codes: List[Literal[301, 302, 303, 307, 308]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(BaseModel): + end_time: str + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: str + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: Optional[str] = None + """Time zone used to calculate time.""" + + +class OptionsForceReturn(BaseModel): + body: str + """URL for redirection or text.""" + + code: int + """Status code value.""" + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] = None + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Host Header value.""" + + +class OptionsIgnoreCookie(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: Optional[bool] = None + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: Optional[bool] = None + """Enables or disables compression without quality loss for PNG format.""" + + quality: Optional[int] = None + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: Optional[bool] = None + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Literal["allow", "deny"] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Literal["static", "dynamic"] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: Optional[int] = None + """Amount of downloaded data after which the user will be rate limited.""" + + speed: Optional[int] = None + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: List[str] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: List[str] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Literal["allow", "deny"] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: int + """Maximum request rate.""" + + burst: Optional[int] = None + + delay: Optional[int] = None + + rate_unit: Optional[Literal["r/s", "r/m"]] = None + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: List[str] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Literal["hide", "show"] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(BaseModel): + body: str + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Optional[Literal["break", "last", "redirect", "permanent"]] = None + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Optional[str] = None + """Key generated on your side that will be used for URL signing.""" + + type: Optional[Literal[0, 2]] = None + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(BaseModel): + custom_hostname: str + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Optional[Literal["dynamic", "custom"]] = None + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(BaseModel): + name: str + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: List[str] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: Optional[bool] = None + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[OptionsStaticResponseHeadersValue] + + +class OptionsStaticHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Dict[str, str] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Dict[str, str] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Literal["allow", "deny"] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(BaseModel): + allowed_http_methods: Optional[OptionsAllowedHTTPMethods] = FieldInfo(alias="allowedHttpMethods", default=None) + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] = None + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] = None + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] = None + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] = None + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] = None + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] = None + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] = None + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] = None + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] = None + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] = None + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] = None + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] = None + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] = None + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] = None + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Optional[OptionsGzipOn] = FieldInfo(alias="gzipOn", default=None) + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Optional[OptionsHostHeader] = FieldInfo(alias="hostHeader", default=None) + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] = None + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Optional[OptionsIgnoreQueryString] = FieldInfo(alias="ignoreQueryString", default=None) + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] = None + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] = None + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] = None + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] = None + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] = None + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] = None + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] = None + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] = None + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] = None + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] = None + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] = None + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] = None + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] = None + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] = None + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] = None + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] = None + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] = None + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] = None + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] = None + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] = None + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] = None + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Optional[OptionsStaticHeaders] = FieldInfo(alias="staticHeaders", default=None) + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Optional[OptionsStaticRequestHeaders] = FieldInfo( + alias="staticRequestHeaders", default=None + ) + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] = None + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] = None + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] = None + """Enables or disables WebSockets connections to an origin server.""" + + +class RuleTemplate(BaseModel): + id: Optional[int] = None + """Rule template ID.""" + + client: Optional[int] = None + """Client ID""" + + default: Optional[bool] = None + """Defines whether the template is a system template developed for common cases. + + System templates are available to all customers. + + Possible values: + + - **true** - Template is a system template and cannot be changed by a user. + - **false** - Template is a custom template and can be changed by a user. + """ + + deleted: Optional[bool] = None + """Defines whether the template has been deleted. + + Possible values: + + - **true** - Template has been deleted. + - **false** - Template has not been deleted. + """ + + name: Optional[str] = None + """Rule template name.""" + + options: Optional[Options] = None + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] = FieldInfo( + alias="overrideOriginProtocol", default=None + ) + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + rule: Optional[str] = None + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Optional[int] = FieldInfo(alias="ruleType", default=None) + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + template: Optional[bool] = None + """Determines whether the rule is a template.""" + + weight: Optional[int] = None + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ diff --git a/src/gcore/types/cdn/rule_template_create_params.py b/src/gcore/types/cdn/rule_template_create_params.py new file mode 100644 index 00000000..bea0ca5a --- /dev/null +++ b/src/gcore/types/cdn/rule_template_create_params.py @@ -0,0 +1,1636 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = [ + "RuleTemplateCreateParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class RuleTemplateCreateParams(TypedDict, total=False): + rule: Required[str] + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Required[Annotated[int, PropertyInfo(alias="ruleType")]] + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + name: str + """Rule template name.""" + + options: Options + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + override_origin_protocol: Annotated[ + Optional[Literal["HTTPS", "HTTP", "MATCH"]], PropertyInfo(alias="overrideOriginProtocol") + ] + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + weight: int + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/rule_template_list.py b/src/gcore/types/cdn/rule_template_list.py new file mode 100644 index 00000000..7d194b4f --- /dev/null +++ b/src/gcore/types/cdn/rule_template_list.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .rule_template import RuleTemplate + +__all__ = ["RuleTemplateList"] + +RuleTemplateList: TypeAlias = List[RuleTemplate] diff --git a/src/gcore/types/cdn/rule_template_replace_params.py b/src/gcore/types/cdn/rule_template_replace_params.py new file mode 100644 index 00000000..61956314 --- /dev/null +++ b/src/gcore/types/cdn/rule_template_replace_params.py @@ -0,0 +1,1636 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = [ + "RuleTemplateReplaceParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class RuleTemplateReplaceParams(TypedDict, total=False): + rule: Required[str] + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Required[Annotated[int, PropertyInfo(alias="ruleType")]] + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + name: str + """Rule template name.""" + + options: Options + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + override_origin_protocol: Annotated[ + Optional[Literal["HTTPS", "HTTP", "MATCH"]], PropertyInfo(alias="overrideOriginProtocol") + ] + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + weight: int + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/rule_template_update_params.py b/src/gcore/types/cdn/rule_template_update_params.py new file mode 100644 index 00000000..927ca2e9 --- /dev/null +++ b/src/gcore/types/cdn/rule_template_update_params.py @@ -0,0 +1,1636 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = [ + "RuleTemplateUpdateParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class RuleTemplateUpdateParams(TypedDict, total=False): + name: str + """Rule template name.""" + + options: Options + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + override_origin_protocol: Annotated[ + Optional[Literal["HTTPS", "HTTP", "MATCH"]], PropertyInfo(alias="overrideOriginProtocol") + ] + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + rule: str + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Annotated[int, PropertyInfo(alias="ruleType")] + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + weight: int + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/shield_aggregated_stats.py b/src/gcore/types/cdn/shield_aggregated_stats.py new file mode 100644 index 00000000..e13cf582 --- /dev/null +++ b/src/gcore/types/cdn/shield_aggregated_stats.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["ShieldAggregatedStats"] + + +class ShieldAggregatedStats(BaseModel): + api_1_example: Optional[object] = FieldInfo(alias="1 (example)", default=None) + """CDN resource ID for which statistics data is shown.""" + + metrics: Optional[object] = None + """Statistics parameters.""" + + resource: Optional[object] = None + """Resources IDs by which statistics data is grouped.""" + + shield_usage: Optional[str] = None + """Number of CDN resources that used origin shielding.""" diff --git a/src/gcore/types/cdn/shield_list_response.py b/src/gcore/types/cdn/shield_list_response.py new file mode 100644 index 00000000..4449e462 --- /dev/null +++ b/src/gcore/types/cdn/shield_list_response.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["ShieldListResponse", "ShieldListResponseItem"] + + +class ShieldListResponseItem(BaseModel): + id: Optional[int] = None + """Origin shielding location ID.""" + + city: Optional[str] = None + """City of origin shielding location.""" + + country: Optional[str] = None + """Country of origin shielding location.""" + + datacenter: Optional[str] = None + """Name of origin shielding location datacenter.""" + + +ShieldListResponse: TypeAlias = List[ShieldListResponseItem] diff --git a/src/gcore/types/cdn/ssl_detail.py b/src/gcore/types/cdn/ssl_detail.py new file mode 100644 index 00000000..aa57c7d5 --- /dev/null +++ b/src/gcore/types/cdn/ssl_detail.py @@ -0,0 +1,62 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["SslDetail"] + + +class SslDetail(BaseModel): + id: Optional[int] = None + """SSL certificate ID.""" + + automated: Optional[bool] = None + """How the SSL certificate was issued. + + Possible values: + + - **true** - Certificate was issued automatically. + - **false** - Certificate was added by a use. + """ + + cert_issuer: Optional[str] = None + """Name of the certification center issued the SSL certificate.""" + + cert_subject_alt: Optional[str] = None + """Alternative domain names that the SSL certificate secures.""" + + cert_subject_cn: Optional[str] = None + """Domain name that the SSL certificate secures.""" + + deleted: Optional[bool] = None + """Defines whether the certificate has been deleted. Parameter is **deprecated**. + + Possible values: + + - **true** - Certificate has been deleted. + - **false** - Certificate has not been deleted. + """ + + has_related_resources: Optional[bool] = FieldInfo(alias="hasRelatedResources", default=None) + """Defines whether the SSL certificate is used by a CDN resource. + + Possible values: + + - **true** - Certificate is used by a CDN resource. + - **false** - Certificate is not used by a CDN resource. + """ + + name: Optional[str] = None + """SSL certificate name.""" + + ssl_certificate_chain: Optional[str] = FieldInfo(alias="sslCertificateChain", default=None) + """Parameter is **deprecated**.""" + + validity_not_after: Optional[str] = None + """Date when certificate become untrusted (ISO 8601/RFC 3339 format, UTC.)""" + + validity_not_before: Optional[str] = None + """Date when certificate become valid (ISO 8601/RFC 3339 format, UTC.)""" diff --git a/src/gcore/types/cdn/ssl_detail_list.py b/src/gcore/types/cdn/ssl_detail_list.py new file mode 100644 index 00000000..8a6a991b --- /dev/null +++ b/src/gcore/types/cdn/ssl_detail_list.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .ssl_detail import SslDetail + +__all__ = ["SslDetailList"] + +SslDetailList: TypeAlias = List[SslDetail] diff --git a/src/gcore/types/cdn/ssl_request_status.py b/src/gcore/types/cdn/ssl_request_status.py new file mode 100644 index 00000000..b1738272 --- /dev/null +++ b/src/gcore/types/cdn/ssl_request_status.py @@ -0,0 +1,135 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["SslRequestStatus", "LatestStatus", "Status"] + + +class LatestStatus(BaseModel): + id: Optional[int] = None + """ID of the attempt to issue the Let's Encrypt certificate.""" + + created: Optional[str] = None + """ + Date and time when the issuing attempt status was created (ISO 8601/RFC 3339 + format, UTC). + """ + + details: Optional[str] = None + """ + Detailed description of the error that occurred when trying to issue a Let's + Encrypt certificate. + """ + + error: Optional[str] = None + """ + Brief description of the error that occurred when trying to issue a Let's + Encrypt certificate. + """ + + retry_after: Optional[str] = None + """ + Date indicating when the certificate issuance limit will be lifted (ISO 8601/RFC + 3339 format, UTC). + + It is filled in only if error = RateLimited. + """ + + status: Optional[str] = None + """Status of the attempt to issue the Let's Encrypt certificate. + + Possible values: + + - **Done** - Attempt is successful. Let's Encrypt certificate was issued. + - **Failed** - Attempt failed. Let's Encrypt certificate was not issued. + - **Cancelled** - Attempt is canceled. Let's Encrypt certificate was not issued. + """ + + +class Status(BaseModel): + id: Optional[int] = None + """ID of the attempt to issue the Let's Encrypt certificate.""" + + created: Optional[str] = None + """ + Date and time when the issuing attempt status was created (ISO 8601/RFC 3339 + format, UTC). + """ + + details: Optional[str] = None + """ + Detailed description of the error that occurred when trying to issue a Let's + Encrypt certificate. + """ + + error: Optional[str] = None + """ + Brief description of the error that occurred when trying to issue a Let's + Encrypt certificate. + """ + + retry_after: Optional[str] = None + """ + Date indicating when the certificate issuance limit will be lifted (ISO 8601/RFC + 3339 format, UTC). + + It is filled in only if error = RateLimited. + """ + + status: Optional[str] = None + """Status of the attempt to issue the Let's Encrypt certificate. + + Possible values: + + - **Done** - Attempt is successful. Let's Encrypt certificate was issued. + - **Failed** - Attempt failed. Let's Encrypt certificate was not issued. + - **Cancelled** - Attempt is canceled. Let's Encrypt certificate was not issued. + """ + + +class SslRequestStatus(BaseModel): + id: Optional[int] = None + """ID of the attempt to issue a Let's Encrypt certificate.""" + + active: Optional[bool] = None + """Defines whether the Let's Encrypt certificate issuing process is active. + + Possible values: + + - **true** - Issuing process is active. + - **false** - Issuing process is completed. + """ + + attempts_count: Optional[int] = None + """Number of attempts to issue the Let's Encrypt certificate.""" + + finished: Optional[str] = None + """ + Date when the process of issuing a Let's Encrypt certificate was finished (ISO + 8601/RFC 3339 format, UTC). + + The field is **null** if the issuing process is not finished. + """ + + latest_status: Optional[LatestStatus] = None + """Detailed information about last attempt to issue a Let's Encrypt certificate.""" + + next_attempt_time: Optional[str] = None + """ + Time of the next scheduled attempt to issue the Let's Encrypt certificate (ISO + 8601/RFC 3339 format, UTC). + """ + + resource: Optional[int] = None + """CDN resource ID.""" + + started: Optional[str] = None + """ + Date when the process of issuing a Let's Encrypt certificate was started (ISO + 8601/RFC 3339 format, UTC). + """ + + statuses: Optional[List[Status]] = None + """Detailed information about attempts to issue a Let's Encrypt certificate.""" diff --git a/src/gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py b/src/gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py new file mode 100644 index 00000000..a1a50799 --- /dev/null +++ b/src/gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetLogsUsageAggregatedParams"] + + +class StatisticGetLogsUsageAggregatedParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + to: Required[str] + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + flat: bool + """The waу parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + """ + + group_by: str + """Output data grouping. + + Possible value: + + - **resource** - Data is grouped by CDN resources. + """ + + resource: int + """CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + """ diff --git a/src/gcore/types/cdn/statistic_get_logs_usage_series_params.py b/src/gcore/types/cdn/statistic_get_logs_usage_series_params.py new file mode 100644 index 00000000..634f818e --- /dev/null +++ b/src/gcore/types/cdn/statistic_get_logs_usage_series_params.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetLogsUsageSeriesParams"] + + +class StatisticGetLogsUsageSeriesParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Example: + + - &from=2020-01-01T00:00:00.000 + """ + + to: Required[str] + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Example: + + - &from=2020-01-01T00:00:00.000 + """ + + resource: int + """CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + """ diff --git a/src/gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py b/src/gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py new file mode 100644 index 00000000..9518ebe1 --- /dev/null +++ b/src/gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py @@ -0,0 +1,151 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetResourceUsageAggregatedParams"] + + +class StatisticGetResourceUsageAggregatedParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &from=2018-11-01T00:00:00.000 + - &from=2018-11-01 + """ + + metrics: Required[str] + """Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding when used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. + - **`95_percentile`** - Represents the 95th percentile of network bandwidth + usage in bytes per second. This means that 95% of the time, the network + resource usage was below this value. + - **`max_bandwidth`** - The maximum network bandwidth that was used during the + selected time represented in bytes per second. + - **`min_bandwidth`** - The minimum network bandwidth that was used during the + selected time represented in bytes per second. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + """ + + service: Required[str] + """Service name. + + Possible value: + + - CDN + """ + + to: Required[str] + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &to=2018-11-01T00:00:00.000 + - &to=2018-11-01 + """ + + countries: str + """Names of countries for which data is displayed. + + English short name from [ISO 3166 standard][1] without the definite article + "the" should be used. + + [1]: https://www.iso.org/obp/ui/#search/code/ + + To request multiple values, use: + + - &countries=france&countries=denmark + """ + + flat: bool + """The waу the parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + """ + + group_by: str + """Output data grouping. + + Possible values: + + - **resource** – Data is grouped by CDN resources IDs. + - **region** – Data is grouped by regions of CDN edge servers. + - **country** – Data is grouped by countries of CDN edge servers. + - **vhost** – Data is grouped by resources CNAME. + + To request multiple values, use: + + - &`group_by`=region&`group_by`=resource + """ + + regions: str + """Regions for which data is displayed. + + Possible values: + + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States + - **asia** – Asia + - **au** – Australia + - **latam** – Latin America + - **me** – Middle East + - **africa** - Africa + - **sa** - South America + """ + + resource: int + """CDN resources IDs by which statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + If CDN resource ID is not specified, data related to all CDN resources is + returned. + """ diff --git a/src/gcore/types/cdn/statistic_get_resource_usage_series_params.py b/src/gcore/types/cdn/statistic_get_resource_usage_series_params.py new file mode 100644 index 00000000..e830094f --- /dev/null +++ b/src/gcore/types/cdn/statistic_get_resource_usage_series_params.py @@ -0,0 +1,131 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetResourceUsageSeriesParams"] + + +class StatisticGetResourceUsageSeriesParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + granularity: Required[str] + """Duration of the time blocks into which the data will be divided. + + Possible values: + + - **1m** - available only for up to 1 month in the past. + - **5m** + - **15m** + - **1h** + - **1d** + """ + + metrics: Required[str] + """Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding when used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + """ + + service: Required[str] + """Service name. + + Possible value: + + - CDN + """ + + to: Required[str] + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + countries: str + """ + Names of countries for which data should be displayed. English short name from + [ISO 3166 standard][1] without the definite article ("the") should be used. + + [1]: https://www.iso.org/obp/ui/#search/code/ + + To request multiple values, use: + + - &countries=france&countries=denmark + """ + + group_by: str + """Output data grouping. + + Possible values: + + - **resource** – Data is grouped by CDN resources IDs. + - **region** – Data is grouped by regions of CDN edge servers. + - **country** – Data is grouped by countries of CDN edge servers. + - **vhost** – Data is grouped by resources CNAMEs. + + To request multiple values, use: + + - &`group_by`=region&`group_by`=resource + """ + + regions: str + """Regions for which data is displayed. + + Possible values: + + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States + - **asia** – Asia + - **au** – Australia + - **latam** – Latin America + - **me** – Middle East + - **africa** - Africa + - **sa** - South America + """ + + resource: int + """CDN resource IDs. + + To request multiple values, use: + + - &resource=1&resource=2 + """ diff --git a/src/gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py b/src/gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py new file mode 100644 index 00000000..eff1d4f0 --- /dev/null +++ b/src/gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetShieldUsageAggregatedParams"] + + +class StatisticGetShieldUsageAggregatedParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + to: Required[str] + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + flat: bool + """The waу parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + """ + + group_by: str + """Output data grouping. + + Possible value: + + - **resource** - Data is grouped by CDN resource. + """ + + resource: int + """CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + """ diff --git a/src/gcore/types/cdn/statistic_get_shield_usage_series_params.py b/src/gcore/types/cdn/statistic_get_shield_usage_series_params.py new file mode 100644 index 00000000..2b0e1a38 --- /dev/null +++ b/src/gcore/types/cdn/statistic_get_shield_usage_series_params.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetShieldUsageSeriesParams"] + + +class StatisticGetShieldUsageSeriesParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + to: Required[str] + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + resource: int + """CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + """ diff --git a/src/gcore/types/cdn/trusted_ca_certificate_create_params.py b/src/gcore/types/cdn/trusted_ca_certificate_create_params.py new file mode 100644 index 00000000..0240b6df --- /dev/null +++ b/src/gcore/types/cdn/trusted_ca_certificate_create_params.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["TrustedCaCertificateCreateParams"] + + +class TrustedCaCertificateCreateParams(TypedDict, total=False): + name: Required[str] + """CA certificate name. + + It must be unique. + """ + + ssl_certificate: Required[Annotated[str, PropertyInfo(alias="sslCertificate")]] + """Public part of the CA certificate. + + It must be in the PEM format. + """ diff --git a/src/gcore/types/cdn/trusted_ca_certificate_list_params.py b/src/gcore/types/cdn/trusted_ca_certificate_list_params.py new file mode 100644 index 00000000..468e9a37 --- /dev/null +++ b/src/gcore/types/cdn/trusted_ca_certificate_list_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["TrustedCaCertificateListParams"] + + +class TrustedCaCertificateListParams(TypedDict, total=False): + automated: bool + """How the certificate was issued. + + Possible values: + + - **true** – Certificate was issued automatically. + - **false** – Certificate was added by a user. + """ + + resource_id: int + """CDN resource ID for which the certificates are requested.""" + + validity_not_after_lte: str + """ + Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, + UTC.) + + Response will contain certificates valid until the specified time. + """ diff --git a/src/gcore/types/cdn/trusted_ca_certificate_replace_params.py b/src/gcore/types/cdn/trusted_ca_certificate_replace_params.py new file mode 100644 index 00000000..882017d1 --- /dev/null +++ b/src/gcore/types/cdn/trusted_ca_certificate_replace_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["TrustedCaCertificateReplaceParams"] + + +class TrustedCaCertificateReplaceParams(TypedDict, total=False): + name: Required[str] + """CA certificate name. + + It must be unique. + """ diff --git a/src/gcore/types/cdn/usage_series_stats.py b/src/gcore/types/cdn/usage_series_stats.py new file mode 100644 index 00000000..f6ab393d --- /dev/null +++ b/src/gcore/types/cdn/usage_series_stats.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["UsageSeriesStats", "UsageSeriesStatItem"] + + +class UsageSeriesStatItem(BaseModel): + active_from: Optional[str] = None + """Date and time when paid feature was enabled (ISO 8601/RFC 3339 format, UTC.)""" + + active_to: Optional[str] = None + """Date and time when paid feature was disabled (ISO 8601/RFC 3339 format, UTC.) + + It returns **null** if the paid feature is enabled. + """ + + client_id: Optional[int] = None + """Client ID.""" + + cname: Optional[str] = None + """CDN resource CNAME.""" + + resource_id: Optional[int] = None + """CDN resource ID.""" + + +UsageSeriesStats: TypeAlias = List[UsageSeriesStatItem] diff --git a/tests/api_resources/cdn/__init__.py b/tests/api_resources/cdn/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cdn/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cdn/logs/__init__.py b/tests/api_resources/cdn/logs/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cdn/logs/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cdn/logs/test_settings.py b/tests/api_resources/cdn/logs/test_settings.py new file mode 100644 index 00000000..3384caf7 --- /dev/null +++ b/tests/api_resources/cdn/logs/test_settings.py @@ -0,0 +1,568 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn.logs import LogSettings + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSettings: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + setting = client.cdn.logs.settings.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + assert setting is None + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + setting = client.cdn.logs.settings.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[ + { + "id": 0, + "bucket": "bucket", + "cdn_resource": 0, + "folder": "folder", + } + ], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + archive_size_mb=500, + enabled=True, + ftp_prepend_folder="ftp_prepend_folder", + ignore_empty_logs=True, + s3_aws_region=0, + s3_bucket_location="s3_bucket_location", + s3_host_bucket="s3_host_bucket", + sftp_key_passphrase="sftp_key_passphrase", + sftp_prepend_folder="sftp_prepend_folder", + sftp_private_key="sftp_private_key", + ) + assert setting is None + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.logs.settings.with_raw_response.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert setting is None + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.logs.settings.with_streaming_response.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + setting = client.cdn.logs.settings.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + assert setting is None + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + setting = client.cdn.logs.settings.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[ + { + "id": 0, + "bucket": "bucket", + "cdn_resource": 0, + "folder": "folder", + } + ], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + archive_size_mb=500, + enabled=True, + ftp_prepend_folder="ftp_prepend_folder", + ignore_empty_logs=True, + s3_aws_region=0, + s3_bucket_location="s3_bucket_location", + s3_host_bucket="s3_host_bucket", + sftp_key_passphrase="sftp_key_passphrase", + sftp_prepend_folder="sftp_prepend_folder", + sftp_private_key="sftp_private_key", + ) + assert setting is None + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.logs.settings.with_raw_response.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert setting is None + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.logs.settings.with_streaming_response.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + setting = client.cdn.logs.settings.delete() + assert setting is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.logs.settings.with_raw_response.delete() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert setting is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.logs.settings.with_streaming_response.delete() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + setting = client.cdn.logs.settings.get() + assert_matches_type(LogSettings, setting, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.logs.settings.with_raw_response.get() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert_matches_type(LogSettings, setting, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.logs.settings.with_streaming_response.get() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert_matches_type(LogSettings, setting, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncSettings: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + setting = await async_client.cdn.logs.settings.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + assert setting is None + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + setting = await async_client.cdn.logs.settings.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[ + { + "id": 0, + "bucket": "bucket", + "cdn_resource": 0, + "folder": "folder", + } + ], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + archive_size_mb=500, + enabled=True, + ftp_prepend_folder="ftp_prepend_folder", + ignore_empty_logs=True, + s3_aws_region=0, + s3_bucket_location="s3_bucket_location", + s3_host_bucket="s3_host_bucket", + sftp_key_passphrase="sftp_key_passphrase", + sftp_prepend_folder="sftp_prepend_folder", + sftp_private_key="sftp_private_key", + ) + assert setting is None + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs.settings.with_raw_response.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert setting is None + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs.settings.with_streaming_response.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + setting = await async_client.cdn.logs.settings.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + assert setting is None + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + setting = await async_client.cdn.logs.settings.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[ + { + "id": 0, + "bucket": "bucket", + "cdn_resource": 0, + "folder": "folder", + } + ], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + archive_size_mb=500, + enabled=True, + ftp_prepend_folder="ftp_prepend_folder", + ignore_empty_logs=True, + s3_aws_region=0, + s3_bucket_location="s3_bucket_location", + s3_host_bucket="s3_host_bucket", + sftp_key_passphrase="sftp_key_passphrase", + sftp_prepend_folder="sftp_prepend_folder", + sftp_private_key="sftp_private_key", + ) + assert setting is None + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs.settings.with_raw_response.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert setting is None + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs.settings.with_streaming_response.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + setting = await async_client.cdn.logs.settings.delete() + assert setting is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs.settings.with_raw_response.delete() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert setting is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs.settings.with_streaming_response.delete() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + setting = await async_client.cdn.logs.settings.get() + assert_matches_type(LogSettings, setting, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs.settings.with_raw_response.get() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert_matches_type(LogSettings, setting, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs.settings.with_streaming_response.get() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert_matches_type(LogSettings, setting, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/logs_uploader/__init__.py b/tests/api_resources/cdn/logs_uploader/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cdn/logs_uploader/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cdn/logs_uploader/test_configs.py b/tests/api_resources/cdn/logs_uploader/test_configs.py new file mode 100644 index 00000000..77fc82eb --- /dev/null +++ b/tests/api_resources/cdn/logs_uploader/test_configs.py @@ -0,0 +1,572 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import LogsUploaderValidation +from gcore.types.cdn.logs_uploader import ( + LogsUploaderConfig, + LogsUploaderConfigList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestConfigs: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.create( + name="name", + policy=0, + target=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.create( + name="name", + policy=0, + target=0, + enabled=True, + for_all_resources=True, + resources=[0], + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.create( + name="name", + policy=0, + target=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.create( + name="name", + policy=0, + target=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.update( + id=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.update( + id=0, + enabled=True, + for_all_resources=True, + name="name", + policy=0, + resources=[0], + target=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.list() + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.list( + resource_ids=[0], + search="search", + ) + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.delete( + 0, + ) + assert config is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert config is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert config is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.get( + 0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.replace( + id=0, + name="name", + policy=0, + target=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.replace( + id=0, + name="name", + policy=0, + target=0, + enabled=True, + for_all_resources=True, + resources=[0], + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.replace( + id=0, + name="name", + policy=0, + target=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.replace( + id=0, + name="name", + policy=0, + target=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_validate(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.validate( + 0, + ) + assert_matches_type(LogsUploaderValidation, config, path=["response"]) + + @parametrize + def test_raw_response_validate(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.validate( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert_matches_type(LogsUploaderValidation, config, path=["response"]) + + @parametrize + def test_streaming_response_validate(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.validate( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert_matches_type(LogsUploaderValidation, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncConfigs: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.create( + name="name", + policy=0, + target=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.create( + name="name", + policy=0, + target=0, + enabled=True, + for_all_resources=True, + resources=[0], + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.create( + name="name", + policy=0, + target=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.create( + name="name", + policy=0, + target=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.update( + id=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.update( + id=0, + enabled=True, + for_all_resources=True, + name="name", + policy=0, + resources=[0], + target=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.list() + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.list( + resource_ids=[0], + search="search", + ) + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.delete( + 0, + ) + assert config is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert config is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert config is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.get( + 0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.replace( + id=0, + name="name", + policy=0, + target=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.replace( + id=0, + name="name", + policy=0, + target=0, + enabled=True, + for_all_resources=True, + resources=[0], + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.replace( + id=0, + name="name", + policy=0, + target=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.replace( + id=0, + name="name", + policy=0, + target=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_validate(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.validate( + 0, + ) + assert_matches_type(LogsUploaderValidation, config, path=["response"]) + + @parametrize + async def test_raw_response_validate(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.validate( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert_matches_type(LogsUploaderValidation, config, path=["response"]) + + @parametrize + async def test_streaming_response_validate(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.validate( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert_matches_type(LogsUploaderValidation, config, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/logs_uploader/test_policies.py b/tests/api_resources/cdn/logs_uploader/test_policies.py new file mode 100644 index 00000000..07ed96bf --- /dev/null +++ b/tests/api_resources/cdn/logs_uploader/test_policies.py @@ -0,0 +1,572 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn.logs_uploader import ( + LogsUploaderPolicy, + LogsUploaderPolicyList, + PolicyListFieldsResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPolicies: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.create() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.create( + date_format="[02/Jan/2006:15:04:05 -0700]", + description="New policy", + field_delimiter=",", + field_separator=";", + fields=["remote_addr", "status"], + file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", + format_type="flvproxy", + include_empty_logs=True, + include_shield_logs=True, + name="Policy", + retry_interval_minutes=32, + rotate_interval_minutes=32, + rotate_threshold_lines=5000, + rotate_threshold_mb=252, + tags={}, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.update( + id=0, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.update( + id=0, + date_format="[02/Jan/2006:15:04:05 -0700]", + description="New policy", + field_delimiter=",", + field_separator=";", + fields=["remote_addr", "status"], + file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", + format_type="flvproxy", + include_empty_logs=True, + include_shield_logs=True, + name="Policy", + retry_interval_minutes=32, + rotate_interval_minutes=32, + rotate_threshold_lines=5000, + rotate_threshold_mb=252, + tags={}, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.list() + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.list( + config_ids=[0], + search="search", + ) + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.delete( + 0, + ) + assert policy is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert policy is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert policy is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.get( + 0, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_fields(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.list_fields() + assert_matches_type(PolicyListFieldsResponse, policy, path=["response"]) + + @parametrize + def test_raw_response_list_fields(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.list_fields() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(PolicyListFieldsResponse, policy, path=["response"]) + + @parametrize + def test_streaming_response_list_fields(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.list_fields() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(PolicyListFieldsResponse, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.replace( + id=0, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.replace( + id=0, + date_format="[02/Jan/2006:15:04:05 -0700]", + description="New policy", + field_delimiter=",", + field_separator=";", + fields=["remote_addr", "status"], + file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", + format_type="flvproxy", + include_empty_logs=True, + include_shield_logs=True, + name="Policy", + retry_interval_minutes=32, + rotate_interval_minutes=32, + rotate_threshold_lines=5000, + rotate_threshold_mb=252, + tags={}, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.replace( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.replace( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncPolicies: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.create() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.create( + date_format="[02/Jan/2006:15:04:05 -0700]", + description="New policy", + field_delimiter=",", + field_separator=";", + fields=["remote_addr", "status"], + file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", + format_type="flvproxy", + include_empty_logs=True, + include_shield_logs=True, + name="Policy", + retry_interval_minutes=32, + rotate_interval_minutes=32, + rotate_threshold_lines=5000, + rotate_threshold_mb=252, + tags={}, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.update( + id=0, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.update( + id=0, + date_format="[02/Jan/2006:15:04:05 -0700]", + description="New policy", + field_delimiter=",", + field_separator=";", + fields=["remote_addr", "status"], + file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", + format_type="flvproxy", + include_empty_logs=True, + include_shield_logs=True, + name="Policy", + retry_interval_minutes=32, + rotate_interval_minutes=32, + rotate_threshold_lines=5000, + rotate_threshold_mb=252, + tags={}, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.list() + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.list( + config_ids=[0], + search="search", + ) + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.delete( + 0, + ) + assert policy is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert policy is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert policy is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.get( + 0, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_fields(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.list_fields() + assert_matches_type(PolicyListFieldsResponse, policy, path=["response"]) + + @parametrize + async def test_raw_response_list_fields(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.list_fields() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(PolicyListFieldsResponse, policy, path=["response"]) + + @parametrize + async def test_streaming_response_list_fields(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.list_fields() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(PolicyListFieldsResponse, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.replace( + id=0, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.replace( + id=0, + date_format="[02/Jan/2006:15:04:05 -0700]", + description="New policy", + field_delimiter=",", + field_separator=";", + fields=["remote_addr", "status"], + file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", + format_type="flvproxy", + include_empty_logs=True, + include_shield_logs=True, + name="Policy", + retry_interval_minutes=32, + rotate_interval_minutes=32, + rotate_threshold_lines=5000, + rotate_threshold_mb=252, + tags={}, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.replace( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.replace( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/logs_uploader/test_targets.py b/tests/api_resources/cdn/logs_uploader/test_targets.py new file mode 100644 index 00000000..3cea5248 --- /dev/null +++ b/tests/api_resources/cdn/logs_uploader/test_targets.py @@ -0,0 +1,668 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import LogsUploaderValidation +from gcore.types.cdn.logs_uploader import ( + LogsUploaderTarget, + LogsUploaderTargetList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTargets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + "directory": "directory", + "use_path_style": True, + }, + storage_type="s3_gcore", + description="description", + name="name", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.update( + id=0, + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.update( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + "directory": "directory", + "use_path_style": True, + }, + description="description", + name="name", + storage_type="s3_gcore", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.list() + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.list( + config_ids=[0], + search="search", + ) + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.delete( + 0, + ) + assert target is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert target is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert target is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.get( + 0, + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + "directory": "directory", + "use_path_style": True, + }, + storage_type="s3_gcore", + description="description", + name="name", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_validate(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.validate( + 0, + ) + assert_matches_type(LogsUploaderValidation, target, path=["response"]) + + @parametrize + def test_raw_response_validate(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.validate( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert_matches_type(LogsUploaderValidation, target, path=["response"]) + + @parametrize + def test_streaming_response_validate(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.validate( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert_matches_type(LogsUploaderValidation, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncTargets: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + "directory": "directory", + "use_path_style": True, + }, + storage_type="s3_gcore", + description="description", + name="name", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.update( + id=0, + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.update( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + "directory": "directory", + "use_path_style": True, + }, + description="description", + name="name", + storage_type="s3_gcore", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.list() + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.list( + config_ids=[0], + search="search", + ) + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.delete( + 0, + ) + assert target is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert target is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert target is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.get( + 0, + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + "directory": "directory", + "use_path_style": True, + }, + storage_type="s3_gcore", + description="description", + name="name", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_validate(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.validate( + 0, + ) + assert_matches_type(LogsUploaderValidation, target, path=["response"]) + + @parametrize + async def test_raw_response_validate(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.validate( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert_matches_type(LogsUploaderValidation, target, path=["response"]) + + @parametrize + async def test_streaming_response_validate(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.validate( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert_matches_type(LogsUploaderValidation, target, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/resources/__init__.py b/tests/api_resources/cdn/resources/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cdn/resources/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cdn/resources/test_rules.py b/tests/api_resources/cdn/resources/test_rules.py new file mode 100644 index 00000000..fbb097c3 --- /dev/null +++ b/tests/api_resources/cdn/resources/test_rules.py @@ -0,0 +1,2101 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn.resources import ( + CdnResourceRule, + RuleListResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRules: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + active=True, + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=None, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.resources.rules.with_raw_response.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.resources.rules.with_streaming_response.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.update( + rule_id=0, + resource_id=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.update( + rule_id=0, + resource_id=0, + active=True, + name="My first rule", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=None, + override_origin_protocol="HTTPS", + rule="/folder/images/*.png", + rule_type=0, + weight=1, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.resources.rules.with_raw_response.update( + rule_id=0, + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.resources.rules.with_streaming_response.update( + rule_id=0, + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.list( + 0, + ) + assert_matches_type(RuleListResponse, rule, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.resources.rules.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleListResponse, rule, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.resources.rules.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleListResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.delete( + rule_id=0, + resource_id=0, + ) + assert rule is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.resources.rules.with_raw_response.delete( + rule_id=0, + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert rule is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.resources.rules.with_streaming_response.delete( + rule_id=0, + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.get( + rule_id=0, + resource_id=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.resources.rules.with_raw_response.get( + rule_id=0, + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.resources.rules.with_streaming_response.get( + rule_id=0, + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + active=True, + name="My first rule", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=None, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.resources.rules.with_raw_response.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.resources.rules.with_streaming_response.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRules: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + active=True, + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=None, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.rules.with_raw_response.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.rules.with_streaming_response.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.update( + rule_id=0, + resource_id=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.update( + rule_id=0, + resource_id=0, + active=True, + name="My first rule", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=None, + override_origin_protocol="HTTPS", + rule="/folder/images/*.png", + rule_type=0, + weight=1, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.rules.with_raw_response.update( + rule_id=0, + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.rules.with_streaming_response.update( + rule_id=0, + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.list( + 0, + ) + assert_matches_type(RuleListResponse, rule, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.rules.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleListResponse, rule, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.rules.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleListResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.delete( + rule_id=0, + resource_id=0, + ) + assert rule is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.rules.with_raw_response.delete( + rule_id=0, + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert rule is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.rules.with_streaming_response.delete( + rule_id=0, + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.get( + rule_id=0, + resource_id=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.rules.with_raw_response.get( + rule_id=0, + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.rules.with_streaming_response.get( + rule_id=0, + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + active=True, + name="My first rule", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=None, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.rules.with_raw_response.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.rules.with_streaming_response.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/resources/test_shield.py b/tests/api_resources/cdn/resources/test_shield.py new file mode 100644 index 00000000..40679e62 --- /dev/null +++ b/tests/api_resources/cdn/resources/test_shield.py @@ -0,0 +1,164 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn.resources import OriginShielding + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestShield: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + shield = client.cdn.resources.shield.get( + 0, + ) + assert_matches_type(OriginShielding, shield, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.resources.shield.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shield = response.parse() + assert_matches_type(OriginShielding, shield, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.resources.shield.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shield = response.parse() + assert_matches_type(OriginShielding, shield, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + shield = client.cdn.resources.shield.replace( + resource_id=0, + ) + assert_matches_type(object, shield, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + shield = client.cdn.resources.shield.replace( + resource_id=0, + shielding_pop=4, + ) + assert_matches_type(object, shield, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.resources.shield.with_raw_response.replace( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shield = response.parse() + assert_matches_type(object, shield, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.resources.shield.with_streaming_response.replace( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shield = response.parse() + assert_matches_type(object, shield, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncShield: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + shield = await async_client.cdn.resources.shield.get( + 0, + ) + assert_matches_type(OriginShielding, shield, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.shield.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shield = await response.parse() + assert_matches_type(OriginShielding, shield, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.shield.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shield = await response.parse() + assert_matches_type(OriginShielding, shield, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + shield = await async_client.cdn.resources.shield.replace( + resource_id=0, + ) + assert_matches_type(object, shield, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + shield = await async_client.cdn.resources.shield.replace( + resource_id=0, + shielding_pop=4, + ) + assert_matches_type(object, shield, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.shield.with_raw_response.replace( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shield = await response.parse() + assert_matches_type(object, shield, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.shield.with_streaming_response.replace( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shield = await response.parse() + assert_matches_type(object, shield, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_audit_log.py b/tests/api_resources/cdn/test_audit_log.py new file mode 100644 index 00000000..5cd11748 --- /dev/null +++ b/tests/api_resources/cdn/test_audit_log.py @@ -0,0 +1,171 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import CdnAuditLogEntry +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAuditLog: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + audit_log = client.cdn.audit_log.list() + assert_matches_type(SyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + audit_log = client.cdn.audit_log.list( + client_id=0, + limit=0, + max_requested_at="max_requested_at", + method="method", + min_requested_at="min_requested_at", + offset=0, + path="path", + remote_ip_address="remote_ip_address", + status_code=0, + token_id=0, + user_id=0, + ) + assert_matches_type(SyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.audit_log.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + audit_log = response.parse() + assert_matches_type(SyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.audit_log.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + audit_log = response.parse() + assert_matches_type(SyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + audit_log = client.cdn.audit_log.get( + 0, + ) + assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.audit_log.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + audit_log = response.parse() + assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.audit_log.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + audit_log = response.parse() + assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncAuditLog: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + audit_log = await async_client.cdn.audit_log.list() + assert_matches_type(AsyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + audit_log = await async_client.cdn.audit_log.list( + client_id=0, + limit=0, + max_requested_at="max_requested_at", + method="method", + min_requested_at="min_requested_at", + offset=0, + path="path", + remote_ip_address="remote_ip_address", + status_code=0, + token_id=0, + user_id=0, + ) + assert_matches_type(AsyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.audit_log.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + audit_log = await response.parse() + assert_matches_type(AsyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.audit_log.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + audit_log = await response.parse() + assert_matches_type(AsyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + audit_log = await async_client.cdn.audit_log.get( + 0, + ) + assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.audit_log.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + audit_log = await response.parse() + assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.audit_log.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + audit_log = await response.parse() + assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_certificates.py b/tests/api_resources/cdn/test_certificates.py new file mode 100644 index 00000000..da6d3aad --- /dev/null +++ b/tests/api_resources/cdn/test_certificates.py @@ -0,0 +1,686 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + SslDetail, + SslDetailList, + SslRequestStatus, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCertificates: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create_overload_1(self, client: Gcore) -> None: + certificate = client.cdn.certificates.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + assert certificate is None + + @parametrize + def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: + certificate = client.cdn.certificates.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + validate_root_ca=True, + ) + assert certificate is None + + @parametrize + def test_raw_response_create_overload_1(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert certificate is None + + @parametrize + def test_streaming_response_create_overload_1(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_2(self, client: Gcore) -> None: + certificate = client.cdn.certificates.create( + automated=True, + name="New Let's Encrypt certificate", + ) + assert certificate is None + + @parametrize + def test_raw_response_create_overload_2(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.create( + automated=True, + name="New Let's Encrypt certificate", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert certificate is None + + @parametrize + def test_streaming_response_create_overload_2(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.create( + automated=True, + name="New Let's Encrypt certificate", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + certificate = client.cdn.certificates.list() + assert_matches_type(SslDetailList, certificate, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + certificate = client.cdn.certificates.list( + automated=True, + resource_id=0, + validity_not_after_lte="validity_not_after_lte", + ) + assert_matches_type(SslDetailList, certificate, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert_matches_type(SslDetailList, certificate, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert_matches_type(SslDetailList, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + certificate = client.cdn.certificates.delete( + 0, + ) + assert certificate is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert certificate is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_force_retry(self, client: Gcore) -> None: + certificate = client.cdn.certificates.force_retry( + 0, + ) + assert certificate is None + + @parametrize + def test_raw_response_force_retry(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.force_retry( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert certificate is None + + @parametrize + def test_streaming_response_force_retry(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.force_retry( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + certificate = client.cdn.certificates.get( + 0, + ) + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_status(self, client: Gcore) -> None: + certificate = client.cdn.certificates.get_status( + cert_id=0, + ) + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + @parametrize + def test_method_get_status_with_all_params(self, client: Gcore) -> None: + certificate = client.cdn.certificates.get_status( + cert_id=0, + exclude=["string"], + ) + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + @parametrize + def test_raw_response_get_status(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.get_status( + cert_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + @parametrize + def test_streaming_response_get_status(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.get_status( + cert_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_renew(self, client: Gcore) -> None: + certificate = client.cdn.certificates.renew( + 0, + ) + assert certificate is None + + @parametrize + def test_raw_response_renew(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.renew( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert certificate is None + + @parametrize + def test_streaming_response_renew(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.renew( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + certificate = client.cdn.certificates.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + certificate = client.cdn.certificates.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + validate_root_ca=True, + ) + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCertificates: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create_overload_1(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + assert certificate is None + + @parametrize + async def test_method_create_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + validate_root_ca=True, + ) + assert certificate is None + + @parametrize + async def test_raw_response_create_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert certificate is None + + @parametrize + async def test_streaming_response_create_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_2(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.create( + automated=True, + name="New Let's Encrypt certificate", + ) + assert certificate is None + + @parametrize + async def test_raw_response_create_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.create( + automated=True, + name="New Let's Encrypt certificate", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert certificate is None + + @parametrize + async def test_streaming_response_create_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.create( + automated=True, + name="New Let's Encrypt certificate", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.list() + assert_matches_type(SslDetailList, certificate, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.list( + automated=True, + resource_id=0, + validity_not_after_lte="validity_not_after_lte", + ) + assert_matches_type(SslDetailList, certificate, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert_matches_type(SslDetailList, certificate, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert_matches_type(SslDetailList, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.delete( + 0, + ) + assert certificate is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert certificate is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_force_retry(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.force_retry( + 0, + ) + assert certificate is None + + @parametrize + async def test_raw_response_force_retry(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.force_retry( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert certificate is None + + @parametrize + async def test_streaming_response_force_retry(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.force_retry( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.get( + 0, + ) + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_status(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.get_status( + cert_id=0, + ) + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + @parametrize + async def test_method_get_status_with_all_params(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.get_status( + cert_id=0, + exclude=["string"], + ) + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + @parametrize + async def test_raw_response_get_status(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.get_status( + cert_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + @parametrize + async def test_streaming_response_get_status(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.get_status( + cert_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_renew(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.renew( + 0, + ) + assert certificate is None + + @parametrize + async def test_raw_response_renew(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.renew( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert certificate is None + + @parametrize + async def test_streaming_response_renew(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.renew( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + validate_root_ca=True, + ) + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_ip_ranges.py b/tests/api_resources/cdn/test_ip_ranges.py new file mode 100644 index 00000000..c9bbdb5e --- /dev/null +++ b/tests/api_resources/cdn/test_ip_ranges.py @@ -0,0 +1,124 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import PublicIPList, PublicNetworkList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestIPRanges: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + ip_range = client.cdn.ip_ranges.list() + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.ip_ranges.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_range = response.parse() + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.ip_ranges.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_range = response.parse() + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_ips(self, client: Gcore) -> None: + ip_range = client.cdn.ip_ranges.list_ips() + assert_matches_type(PublicIPList, ip_range, path=["response"]) + + @parametrize + def test_raw_response_list_ips(self, client: Gcore) -> None: + response = client.cdn.ip_ranges.with_raw_response.list_ips() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_range = response.parse() + assert_matches_type(PublicIPList, ip_range, path=["response"]) + + @parametrize + def test_streaming_response_list_ips(self, client: Gcore) -> None: + with client.cdn.ip_ranges.with_streaming_response.list_ips() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_range = response.parse() + assert_matches_type(PublicIPList, ip_range, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncIPRanges: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + ip_range = await async_client.cdn.ip_ranges.list() + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.ip_ranges.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_range = await response.parse() + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.ip_ranges.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_range = await response.parse() + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_ips(self, async_client: AsyncGcore) -> None: + ip_range = await async_client.cdn.ip_ranges.list_ips() + assert_matches_type(PublicIPList, ip_range, path=["response"]) + + @parametrize + async def test_raw_response_list_ips(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.ip_ranges.with_raw_response.list_ips() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_range = await response.parse() + assert_matches_type(PublicIPList, ip_range, path=["response"]) + + @parametrize + async def test_streaming_response_list_ips(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.ip_ranges.with_streaming_response.list_ips() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_range = await response.parse() + assert_matches_type(PublicIPList, ip_range, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_logs.py b/tests/api_resources/cdn/test_logs.py new file mode 100644 index 00000000..c585876e --- /dev/null +++ b/tests/api_resources/cdn/test_logs.py @@ -0,0 +1,437 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import httpx +import pytest +from respx import MockRouter + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore._response import ( + BinaryAPIResponse, + AsyncBinaryAPIResponse, + StreamedBinaryAPIResponse, + AsyncStreamedBinaryAPIResponse, +) +from gcore.pagination import SyncOffsetPageCdnLogs, AsyncOffsetPageCdnLogs +from gcore.types.cdn.cdn_log_entry import Data + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLogs: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + log = client.cdn.logs.list( + from_="from", + to="to", + ) + assert_matches_type(SyncOffsetPageCdnLogs[Data], log, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + log = client.cdn.logs.list( + from_="from", + to="to", + cache_status_eq="cache_status__eq", + cache_status_in="cache_status__in", + cache_status_ne="cache_status__ne", + cache_status_not_in="cache_status__not_in", + client_ip_eq="client_ip__eq", + client_ip_in="client_ip__in", + client_ip_ne="client_ip__ne", + client_ip_not_in="client_ip__not_in", + cname_contains="cname__contains", + cname_eq="cname__eq", + cname_in="cname__in", + cname_ne="cname__ne", + cname_not_in="cname__not_in", + datacenter_eq="datacenter__eq", + datacenter_in="datacenter__in", + datacenter_ne="datacenter__ne", + datacenter_not_in="datacenter__not_in", + fields="fields", + limit=1, + method_eq="method__eq", + method_in="method__in", + method_ne="method__ne", + method_not_in="method__not_in", + offset=0, + ordering="ordering", + resource_id_eq=0, + resource_id_gt=0, + resource_id_gte=0, + resource_id_in="resource_id__in", + resource_id_lt=0, + resource_id_lte=0, + resource_id_ne=0, + resource_id_not_in="resource_id__not_in", + size_eq=0, + size_gt=0, + size_gte=0, + size_in="size__in", + size_lt=0, + size_lte=0, + size_ne=0, + size_not_in="size__not_in", + status_eq=0, + status_gt=0, + status_gte=0, + status_in="status__in", + status_lt=0, + status_lte=0, + status_ne=0, + status_not_in="status__not_in", + ) + assert_matches_type(SyncOffsetPageCdnLogs[Data], log, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.logs.with_raw_response.list( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + log = response.parse() + assert_matches_type(SyncOffsetPageCdnLogs[Data], log, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.logs.with_streaming_response.list( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + log = response.parse() + assert_matches_type(SyncOffsetPageCdnLogs[Data], log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_method_download(self, client: Gcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + log = client.cdn.logs.download( + format="format", + from_="from", + to="to", + ) + assert log.is_closed + assert log.json() == {"foo": "bar"} + assert cast(Any, log.is_closed) is True + assert isinstance(log, BinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_method_download_with_all_params(self, client: Gcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + log = client.cdn.logs.download( + format="format", + from_="from", + to="to", + cache_status_eq="cache_status__eq", + cache_status_in="cache_status__in", + cache_status_ne="cache_status__ne", + cache_status_not_in="cache_status__not_in", + client_ip_eq="client_ip__eq", + client_ip_in="client_ip__in", + client_ip_ne="client_ip__ne", + client_ip_not_in="client_ip__not_in", + cname_contains="cname__contains", + cname_eq="cname__eq", + cname_in="cname__in", + cname_ne="cname__ne", + cname_not_in="cname__not_in", + datacenter_eq="datacenter__eq", + datacenter_in="datacenter__in", + datacenter_ne="datacenter__ne", + datacenter_not_in="datacenter__not_in", + fields="fields", + limit=10000, + method_eq="method__eq", + method_in="method__in", + method_ne="method__ne", + method_not_in="method__not_in", + offset=0, + resource_id_eq=0, + resource_id_gt=0, + resource_id_gte=0, + resource_id_in="resource_id__in", + resource_id_lt=0, + resource_id_lte=0, + resource_id_ne=0, + resource_id_not_in="resource_id__not_in", + size_eq=0, + size_gt=0, + size_gte=0, + size_in="size__in", + size_lt=0, + size_lte=0, + size_ne=0, + size_not_in="size__not_in", + sort="sort", + status_eq=0, + status_gt=0, + status_gte=0, + status_in="status__in", + status_lt=0, + status_lte=0, + status_ne=0, + status_not_in="status__not_in", + ) + assert log.is_closed + assert log.json() == {"foo": "bar"} + assert cast(Any, log.is_closed) is True + assert isinstance(log, BinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_raw_response_download(self, client: Gcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + log = client.cdn.logs.with_raw_response.download( + format="format", + from_="from", + to="to", + ) + + assert log.is_closed is True + assert log.http_request.headers.get("X-Stainless-Lang") == "python" + assert log.json() == {"foo": "bar"} + assert isinstance(log, BinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_streaming_response_download(self, client: Gcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + with client.cdn.logs.with_streaming_response.download( + format="format", + from_="from", + to="to", + ) as log: + assert not log.is_closed + assert log.http_request.headers.get("X-Stainless-Lang") == "python" + + assert log.json() == {"foo": "bar"} + assert cast(Any, log.is_closed) is True + assert isinstance(log, StreamedBinaryAPIResponse) + + assert cast(Any, log.is_closed) is True + + +class TestAsyncLogs: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + log = await async_client.cdn.logs.list( + from_="from", + to="to", + ) + assert_matches_type(AsyncOffsetPageCdnLogs[Data], log, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + log = await async_client.cdn.logs.list( + from_="from", + to="to", + cache_status_eq="cache_status__eq", + cache_status_in="cache_status__in", + cache_status_ne="cache_status__ne", + cache_status_not_in="cache_status__not_in", + client_ip_eq="client_ip__eq", + client_ip_in="client_ip__in", + client_ip_ne="client_ip__ne", + client_ip_not_in="client_ip__not_in", + cname_contains="cname__contains", + cname_eq="cname__eq", + cname_in="cname__in", + cname_ne="cname__ne", + cname_not_in="cname__not_in", + datacenter_eq="datacenter__eq", + datacenter_in="datacenter__in", + datacenter_ne="datacenter__ne", + datacenter_not_in="datacenter__not_in", + fields="fields", + limit=1, + method_eq="method__eq", + method_in="method__in", + method_ne="method__ne", + method_not_in="method__not_in", + offset=0, + ordering="ordering", + resource_id_eq=0, + resource_id_gt=0, + resource_id_gte=0, + resource_id_in="resource_id__in", + resource_id_lt=0, + resource_id_lte=0, + resource_id_ne=0, + resource_id_not_in="resource_id__not_in", + size_eq=0, + size_gt=0, + size_gte=0, + size_in="size__in", + size_lt=0, + size_lte=0, + size_ne=0, + size_not_in="size__not_in", + status_eq=0, + status_gt=0, + status_gte=0, + status_in="status__in", + status_lt=0, + status_lte=0, + status_ne=0, + status_not_in="status__not_in", + ) + assert_matches_type(AsyncOffsetPageCdnLogs[Data], log, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs.with_raw_response.list( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + log = await response.parse() + assert_matches_type(AsyncOffsetPageCdnLogs[Data], log, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs.with_streaming_response.list( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + log = await response.parse() + assert_matches_type(AsyncOffsetPageCdnLogs[Data], log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_method_download(self, async_client: AsyncGcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + log = await async_client.cdn.logs.download( + format="format", + from_="from", + to="to", + ) + assert log.is_closed + assert await log.json() == {"foo": "bar"} + assert cast(Any, log.is_closed) is True + assert isinstance(log, AsyncBinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_method_download_with_all_params(self, async_client: AsyncGcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + log = await async_client.cdn.logs.download( + format="format", + from_="from", + to="to", + cache_status_eq="cache_status__eq", + cache_status_in="cache_status__in", + cache_status_ne="cache_status__ne", + cache_status_not_in="cache_status__not_in", + client_ip_eq="client_ip__eq", + client_ip_in="client_ip__in", + client_ip_ne="client_ip__ne", + client_ip_not_in="client_ip__not_in", + cname_contains="cname__contains", + cname_eq="cname__eq", + cname_in="cname__in", + cname_ne="cname__ne", + cname_not_in="cname__not_in", + datacenter_eq="datacenter__eq", + datacenter_in="datacenter__in", + datacenter_ne="datacenter__ne", + datacenter_not_in="datacenter__not_in", + fields="fields", + limit=10000, + method_eq="method__eq", + method_in="method__in", + method_ne="method__ne", + method_not_in="method__not_in", + offset=0, + resource_id_eq=0, + resource_id_gt=0, + resource_id_gte=0, + resource_id_in="resource_id__in", + resource_id_lt=0, + resource_id_lte=0, + resource_id_ne=0, + resource_id_not_in="resource_id__not_in", + size_eq=0, + size_gt=0, + size_gte=0, + size_in="size__in", + size_lt=0, + size_lte=0, + size_ne=0, + size_not_in="size__not_in", + sort="sort", + status_eq=0, + status_gt=0, + status_gte=0, + status_in="status__in", + status_lt=0, + status_lte=0, + status_ne=0, + status_not_in="status__not_in", + ) + assert log.is_closed + assert await log.json() == {"foo": "bar"} + assert cast(Any, log.is_closed) is True + assert isinstance(log, AsyncBinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_raw_response_download(self, async_client: AsyncGcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + log = await async_client.cdn.logs.with_raw_response.download( + format="format", + from_="from", + to="to", + ) + + assert log.is_closed is True + assert log.http_request.headers.get("X-Stainless-Lang") == "python" + assert await log.json() == {"foo": "bar"} + assert isinstance(log, AsyncBinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_streaming_response_download(self, async_client: AsyncGcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + async with async_client.cdn.logs.with_streaming_response.download( + format="format", + from_="from", + to="to", + ) as log: + assert not log.is_closed + assert log.http_request.headers.get("X-Stainless-Lang") == "python" + + assert await log.json() == {"foo": "bar"} + assert cast(Any, log.is_closed) is True + assert isinstance(log, AsyncStreamedBinaryAPIResponse) + + assert cast(Any, log.is_closed) is True diff --git a/tests/api_resources/cdn/test_metrics.py b/tests/api_resources/cdn/test_metrics.py new file mode 100644 index 00000000..dcfd8767 --- /dev/null +++ b/tests/api_resources/cdn/test_metrics.py @@ -0,0 +1,134 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import CdnMetrics + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestMetrics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + metric = client.cdn.metrics.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + ) + assert_matches_type(CdnMetrics, metric, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + metric = client.cdn.metrics.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + filter_by=[ + { + "field": "resource", + "op": "eq", + "values": [1234], + } + ], + granularity="P1D", + group_by=["cname"], + ) + assert_matches_type(CdnMetrics, metric, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.metrics.with_raw_response.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = response.parse() + assert_matches_type(CdnMetrics, metric, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.metrics.with_streaming_response.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = response.parse() + assert_matches_type(CdnMetrics, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncMetrics: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + metric = await async_client.cdn.metrics.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + ) + assert_matches_type(CdnMetrics, metric, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + metric = await async_client.cdn.metrics.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + filter_by=[ + { + "field": "resource", + "op": "eq", + "values": [1234], + } + ], + granularity="P1D", + group_by=["cname"], + ) + assert_matches_type(CdnMetrics, metric, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.metrics.with_raw_response.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = await response.parse() + assert_matches_type(CdnMetrics, metric, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.metrics.with_streaming_response.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = await response.parse() + assert_matches_type(CdnMetrics, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_network_capacity.py b/tests/api_resources/cdn/test_network_capacity.py new file mode 100644 index 00000000..39fc89da --- /dev/null +++ b/tests/api_resources/cdn/test_network_capacity.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import NetworkCapacity + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestNetworkCapacity: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + network_capacity = client.cdn.network_capacity.list() + assert_matches_type(NetworkCapacity, network_capacity, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.network_capacity.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_capacity = response.parse() + assert_matches_type(NetworkCapacity, network_capacity, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.network_capacity.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_capacity = response.parse() + assert_matches_type(NetworkCapacity, network_capacity, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncNetworkCapacity: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + network_capacity = await async_client.cdn.network_capacity.list() + assert_matches_type(NetworkCapacity, network_capacity, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.network_capacity.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_capacity = await response.parse() + assert_matches_type(NetworkCapacity, network_capacity, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.network_capacity.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_capacity = await response.parse() + assert_matches_type(NetworkCapacity, network_capacity, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_origin_groups.py b/tests/api_resources/cdn/test_origin_groups.py new file mode 100644 index 00000000..43dc567c --- /dev/null +++ b/tests/api_resources/cdn/test_origin_groups.py @@ -0,0 +1,971 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + OriginGroups, + OriginGroupsList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestOriginGroups: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create_overload_1(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.create( + name="YourOriginGroup", + sources=[{}, {}], + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.create( + name="YourOriginGroup", + sources=[ + { + "backup": False, + "enabled": True, + "source": "yourwebsite.com", + }, + { + "backup": True, + "enabled": True, + "source": "1.2.3.4:5500", + }, + ], + auth_type="none", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_create_overload_1(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.create( + name="YourOriginGroup", + sources=[{}, {}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_1(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.create( + name="YourOriginGroup", + sources=[{}, {}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_2(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + "s3_region": "us-east-2", + "s3_storage_hostname": "s3_storage_hostname", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_create_overload_2(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_2(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update_overload_1(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.update( + origin_group_id=0, + name="YourOriginGroup", + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_method_update_with_all_params_overload_1(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.update( + origin_group_id=0, + name="YourOriginGroup", + auth_type="none", + path="", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + sources=[ + { + "backup": False, + "enabled": True, + "source": "yourdomain.com", + } + ], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_update_overload_1(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.update( + origin_group_id=0, + name="YourOriginGroup", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_update_overload_1(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.update( + origin_group_id=0, + name="YourOriginGroup", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update_overload_2(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.update( + origin_group_id=0, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_method_update_with_all_params_overload_2(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.update( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + "s3_region": "us-east-2", + "s3_storage_hostname": "s3_storage_hostname", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_update_overload_2(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.update( + origin_group_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_update_overload_2(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.update( + origin_group_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.list() + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.list( + has_related_resources=True, + name="name", + sources="sources", + ) + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.delete( + 0, + ) + assert origin_group is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert origin_group is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert origin_group is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.get( + 0, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace_overload_1(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[{}], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_method_replace_with_all_params_overload_1(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[ + { + "backup": False, + "enabled": True, + "source": "yourdomain.com", + } + ], + use_next=True, + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_replace_overload_1(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[{}], + use_next=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_replace_overload_1(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[{}], + use_next=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace_overload_2(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_method_replace_with_all_params_overload_2(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + "s3_region": "us-east-2", + "s3_storage_hostname": "s3_storage_hostname", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_replace_overload_2(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_replace_overload_2(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncOriginGroups: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create_overload_1(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.create( + name="YourOriginGroup", + sources=[{}, {}], + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.create( + name="YourOriginGroup", + sources=[ + { + "backup": False, + "enabled": True, + "source": "yourwebsite.com", + }, + { + "backup": True, + "enabled": True, + "source": "1.2.3.4:5500", + }, + ], + auth_type="none", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.create( + name="YourOriginGroup", + sources=[{}, {}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.create( + name="YourOriginGroup", + sources=[{}, {}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_2(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + "s3_region": "us-east-2", + "s3_storage_hostname": "s3_storage_hostname", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update_overload_1(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.update( + origin_group_id=0, + name="YourOriginGroup", + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_method_update_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.update( + origin_group_id=0, + name="YourOriginGroup", + auth_type="none", + path="", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + sources=[ + { + "backup": False, + "enabled": True, + "source": "yourdomain.com", + } + ], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_update_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.update( + origin_group_id=0, + name="YourOriginGroup", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_update_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.update( + origin_group_id=0, + name="YourOriginGroup", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update_overload_2(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.update( + origin_group_id=0, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_method_update_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.update( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + "s3_region": "us-east-2", + "s3_storage_hostname": "s3_storage_hostname", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_update_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.update( + origin_group_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_update_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.update( + origin_group_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.list() + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.list( + has_related_resources=True, + name="name", + sources="sources", + ) + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.delete( + 0, + ) + assert origin_group is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert origin_group is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert origin_group is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.get( + 0, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace_overload_1(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[{}], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[ + { + "backup": False, + "enabled": True, + "source": "yourdomain.com", + } + ], + use_next=True, + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_replace_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[{}], + use_next=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_replace_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[{}], + use_next=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace_overload_2(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + "s3_region": "us-east-2", + "s3_storage_hostname": "s3_storage_hostname", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_replace_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_replace_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_resources.py b/tests/api_resources/cdn/test_resources.py new file mode 100644 index 00000000..1f5c43bb --- /dev/null +++ b/tests/api_resources/cdn/test_resources.py @@ -0,0 +1,2617 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + CdnResource, + CdnResourceList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestResources: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + resource = client.cdn.resources.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + resource = client.cdn.resources.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + active=True, + description="My resource", + name="Resource for images", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "http3_enabled": { + "enabled": True, + "value": True, + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "tls_versions": { + "enabled": True, + "value": ["SSLv3", "TLSv1.3"], + }, + "use_default_le_chain": { + "enabled": True, + "value": True, + }, + "use_dns01_le_challenge": { + "enabled": True, + "value": True, + }, + "use_rsa_le_cert": { + "enabled": True, + "value": True, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_protocol="HTTPS", + primary_resource=None, + proxy_ssl_ca=None, + proxy_ssl_data=None, + proxy_ssl_enabled=False, + secondary_hostnames=["first.example.com", "second.example.com"], + ssl_data=192, + ssl_enabled=False, + waap_api_domain_enabled=True, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + def test_method_update(self, client: Gcore) -> None: + resource = client.cdn.resources.update( + resource_id=0, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + resource = client.cdn.resources.update( + resource_id=0, + active=True, + description="My resource", + name="Resource for images", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "http3_enabled": { + "enabled": True, + "value": True, + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "tls_versions": { + "enabled": True, + "value": ["SSLv3", "TLSv1.3"], + }, + "use_default_le_chain": { + "enabled": True, + "value": True, + }, + "use_dns01_le_challenge": { + "enabled": True, + "value": True, + }, + "use_rsa_le_cert": { + "enabled": True, + "value": True, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=132, + origin_protocol="HTTPS", + proxy_ssl_ca=None, + proxy_ssl_data=None, + proxy_ssl_enabled=False, + secondary_hostnames=["first.example.com", "second.example.com"], + ssl_data=192, + ssl_enabled=False, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.update( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.update( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + resource = client.cdn.resources.list() + assert_matches_type(CdnResourceList, resource, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + resource = client.cdn.resources.list( + cname="cname", + deleted=True, + enabled=True, + max_created="max_created", + min_created="min_created", + origin_group=0, + rules="rules", + secondary_hostnames="secondaryHostnames", + shield_dc="shield_dc", + shielded=True, + ssl_data=0, + ssl_data_in=0, + ssl_enabled=True, + status="active", + suspend=True, + vp_enabled=True, + ) + assert_matches_type(CdnResourceList, resource, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert_matches_type(CdnResourceList, resource, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert_matches_type(CdnResourceList, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + resource = client.cdn.resources.delete( + 0, + ) + assert resource is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert resource is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + resource = client.cdn.resources.get( + 0, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_prefetch(self, client: Gcore) -> None: + resource = client.cdn.resources.prefetch( + resource_id=0, + paths=["/test.jpg", "test1.jpg"], + ) + assert resource is None + + @parametrize + def test_raw_response_prefetch(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.prefetch( + resource_id=0, + paths=["/test.jpg", "test1.jpg"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert resource is None + + @parametrize + def test_streaming_response_prefetch(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.prefetch( + resource_id=0, + paths=["/test.jpg", "test1.jpg"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_prevalidate_ssl_le_certificate(self, client: Gcore) -> None: + resource = client.cdn.resources.prevalidate_ssl_le_certificate( + 0, + ) + assert resource is None + + @parametrize + def test_raw_response_prevalidate_ssl_le_certificate(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.prevalidate_ssl_le_certificate( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert resource is None + + @parametrize + def test_streaming_response_prevalidate_ssl_le_certificate(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.prevalidate_ssl_le_certificate( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_purge_overload_1(self, client: Gcore) -> None: + resource = client.cdn.resources.purge( + resource_id=0, + ) + assert resource is None + + @parametrize + def test_method_purge_with_all_params_overload_1(self, client: Gcore) -> None: + resource = client.cdn.resources.purge( + resource_id=0, + urls=["string"], + ) + assert resource is None + + @parametrize + def test_raw_response_purge_overload_1(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.purge( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert resource is None + + @parametrize + def test_streaming_response_purge_overload_1(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.purge( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_purge_overload_2(self, client: Gcore) -> None: + resource = client.cdn.resources.purge( + resource_id=0, + ) + assert resource is None + + @parametrize + def test_method_purge_with_all_params_overload_2(self, client: Gcore) -> None: + resource = client.cdn.resources.purge( + resource_id=0, + paths=["string"], + ) + assert resource is None + + @parametrize + def test_raw_response_purge_overload_2(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.purge( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert resource is None + + @parametrize + def test_streaming_response_purge_overload_2(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.purge( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_purge_overload_3(self, client: Gcore) -> None: + resource = client.cdn.resources.purge( + resource_id=0, + ) + assert resource is None + + @parametrize + def test_method_purge_with_all_params_overload_3(self, client: Gcore) -> None: + resource = client.cdn.resources.purge( + resource_id=0, + paths=["string"], + ) + assert resource is None + + @parametrize + def test_raw_response_purge_overload_3(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.purge( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert resource is None + + @parametrize + def test_streaming_response_purge_overload_3(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.purge( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + resource = client.cdn.resources.replace( + resource_id=0, + origin_group=132, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + resource = client.cdn.resources.replace( + resource_id=0, + origin_group=132, + active=True, + description="My resource", + name="Resource for images", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "http3_enabled": { + "enabled": True, + "value": True, + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "tls_versions": { + "enabled": True, + "value": ["SSLv3", "TLSv1.3"], + }, + "use_default_le_chain": { + "enabled": True, + "value": True, + }, + "use_dns01_le_challenge": { + "enabled": True, + "value": True, + }, + "use_rsa_le_cert": { + "enabled": True, + "value": True, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_protocol="HTTPS", + proxy_ssl_ca=None, + proxy_ssl_data=None, + proxy_ssl_enabled=False, + secondary_hostnames=["first.example.com", "second.example.com"], + ssl_data=192, + ssl_enabled=False, + waap_api_domain_enabled=True, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.replace( + resource_id=0, + origin_group=132, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.replace( + resource_id=0, + origin_group=132, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncResources: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + active=True, + description="My resource", + name="Resource for images", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "http3_enabled": { + "enabled": True, + "value": True, + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "tls_versions": { + "enabled": True, + "value": ["SSLv3", "TLSv1.3"], + }, + "use_default_le_chain": { + "enabled": True, + "value": True, + }, + "use_dns01_le_challenge": { + "enabled": True, + "value": True, + }, + "use_rsa_le_cert": { + "enabled": True, + "value": True, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_protocol="HTTPS", + primary_resource=None, + proxy_ssl_ca=None, + proxy_ssl_data=None, + proxy_ssl_enabled=False, + secondary_hostnames=["first.example.com", "second.example.com"], + ssl_data=192, + ssl_enabled=False, + waap_api_domain_enabled=True, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.update( + resource_id=0, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.update( + resource_id=0, + active=True, + description="My resource", + name="Resource for images", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "http3_enabled": { + "enabled": True, + "value": True, + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "tls_versions": { + "enabled": True, + "value": ["SSLv3", "TLSv1.3"], + }, + "use_default_le_chain": { + "enabled": True, + "value": True, + }, + "use_dns01_le_challenge": { + "enabled": True, + "value": True, + }, + "use_rsa_le_cert": { + "enabled": True, + "value": True, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=132, + origin_protocol="HTTPS", + proxy_ssl_ca=None, + proxy_ssl_data=None, + proxy_ssl_enabled=False, + secondary_hostnames=["first.example.com", "second.example.com"], + ssl_data=192, + ssl_enabled=False, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.update( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.update( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.list() + assert_matches_type(CdnResourceList, resource, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.list( + cname="cname", + deleted=True, + enabled=True, + max_created="max_created", + min_created="min_created", + origin_group=0, + rules="rules", + secondary_hostnames="secondaryHostnames", + shield_dc="shield_dc", + shielded=True, + ssl_data=0, + ssl_data_in=0, + ssl_enabled=True, + status="active", + suspend=True, + vp_enabled=True, + ) + assert_matches_type(CdnResourceList, resource, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert_matches_type(CdnResourceList, resource, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert_matches_type(CdnResourceList, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.delete( + 0, + ) + assert resource is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert resource is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.get( + 0, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_prefetch(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.prefetch( + resource_id=0, + paths=["/test.jpg", "test1.jpg"], + ) + assert resource is None + + @parametrize + async def test_raw_response_prefetch(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.prefetch( + resource_id=0, + paths=["/test.jpg", "test1.jpg"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert resource is None + + @parametrize + async def test_streaming_response_prefetch(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.prefetch( + resource_id=0, + paths=["/test.jpg", "test1.jpg"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_prevalidate_ssl_le_certificate(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.prevalidate_ssl_le_certificate( + 0, + ) + assert resource is None + + @parametrize + async def test_raw_response_prevalidate_ssl_le_certificate(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.prevalidate_ssl_le_certificate( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert resource is None + + @parametrize + async def test_streaming_response_prevalidate_ssl_le_certificate(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.prevalidate_ssl_le_certificate( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_purge_overload_1(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.purge( + resource_id=0, + ) + assert resource is None + + @parametrize + async def test_method_purge_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.purge( + resource_id=0, + urls=["string"], + ) + assert resource is None + + @parametrize + async def test_raw_response_purge_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.purge( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert resource is None + + @parametrize + async def test_streaming_response_purge_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.purge( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_purge_overload_2(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.purge( + resource_id=0, + ) + assert resource is None + + @parametrize + async def test_method_purge_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.purge( + resource_id=0, + paths=["string"], + ) + assert resource is None + + @parametrize + async def test_raw_response_purge_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.purge( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert resource is None + + @parametrize + async def test_streaming_response_purge_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.purge( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_purge_overload_3(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.purge( + resource_id=0, + ) + assert resource is None + + @parametrize + async def test_method_purge_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.purge( + resource_id=0, + paths=["string"], + ) + assert resource is None + + @parametrize + async def test_raw_response_purge_overload_3(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.purge( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert resource is None + + @parametrize + async def test_streaming_response_purge_overload_3(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.purge( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.replace( + resource_id=0, + origin_group=132, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.replace( + resource_id=0, + origin_group=132, + active=True, + description="My resource", + name="Resource for images", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "http3_enabled": { + "enabled": True, + "value": True, + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "tls_versions": { + "enabled": True, + "value": ["SSLv3", "TLSv1.3"], + }, + "use_default_le_chain": { + "enabled": True, + "value": True, + }, + "use_dns01_le_challenge": { + "enabled": True, + "value": True, + }, + "use_rsa_le_cert": { + "enabled": True, + "value": True, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_protocol="HTTPS", + proxy_ssl_ca=None, + proxy_ssl_data=None, + proxy_ssl_enabled=False, + secondary_hostnames=["first.example.com", "second.example.com"], + ssl_data=192, + ssl_enabled=False, + waap_api_domain_enabled=True, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.replace( + resource_id=0, + origin_group=132, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.replace( + resource_id=0, + origin_group=132, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_rule_templates.py b/tests/api_resources/cdn/test_rule_templates.py new file mode 100644 index 00000000..7f1d616d --- /dev/null +++ b/tests/api_resources/cdn/test_rule_templates.py @@ -0,0 +1,2035 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + RuleTemplate, + RuleTemplateList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRuleTemplates: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.create( + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.create( + rule="/folder/images/*.png", + rule_type=0, + name="All images template", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.rule_templates.with_raw_response.create( + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.rule_templates.with_streaming_response.create( + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.update( + rule_template_id=0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.update( + rule_template_id=0, + name="All images template", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + override_origin_protocol="HTTPS", + rule="/folder/images/*.png", + rule_type=0, + weight=1, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.rule_templates.with_raw_response.update( + rule_template_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.rule_templates.with_streaming_response.update( + rule_template_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.list() + assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.rule_templates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = response.parse() + assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.rule_templates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = response.parse() + assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.delete( + 0, + ) + assert rule_template is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.rule_templates.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = response.parse() + assert rule_template is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.rule_templates.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = response.parse() + assert rule_template is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.get( + 0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.rule_templates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.rule_templates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + name="All images template", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.rule_templates.with_raw_response.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.rule_templates.with_streaming_response.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRuleTemplates: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.create( + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.create( + rule="/folder/images/*.png", + rule_type=0, + name="All images template", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.rule_templates.with_raw_response.create( + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.rule_templates.with_streaming_response.create( + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.update( + rule_template_id=0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.update( + rule_template_id=0, + name="All images template", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + override_origin_protocol="HTTPS", + rule="/folder/images/*.png", + rule_type=0, + weight=1, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.rule_templates.with_raw_response.update( + rule_template_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.rule_templates.with_streaming_response.update( + rule_template_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.list() + assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.rule_templates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = await response.parse() + assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.rule_templates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = await response.parse() + assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.delete( + 0, + ) + assert rule_template is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.rule_templates.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = await response.parse() + assert rule_template is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.rule_templates.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = await response.parse() + assert rule_template is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.get( + 0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.rule_templates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.rule_templates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + name="All images template", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.rule_templates.with_raw_response.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.rule_templates.with_streaming_response.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_shields.py b/tests/api_resources/cdn/test_shields.py new file mode 100644 index 00000000..0600aa49 --- /dev/null +++ b/tests/api_resources/cdn/test_shields.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ShieldListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestShields: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + shield = client.cdn.shields.list() + assert_matches_type(ShieldListResponse, shield, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.shields.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shield = response.parse() + assert_matches_type(ShieldListResponse, shield, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.shields.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shield = response.parse() + assert_matches_type(ShieldListResponse, shield, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncShields: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + shield = await async_client.cdn.shields.list() + assert_matches_type(ShieldListResponse, shield, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.shields.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shield = await response.parse() + assert_matches_type(ShieldListResponse, shield, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.shields.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shield = await response.parse() + assert_matches_type(ShieldListResponse, shield, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_statistics.py b/tests/api_resources/cdn/test_statistics.py new file mode 100644 index 00000000..3aca8e28 --- /dev/null +++ b/tests/api_resources/cdn/test_statistics.py @@ -0,0 +1,608 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + UsageSeriesStats, + ResourceUsageStats, + LogsAggregatedStats, + ShieldAggregatedStats, + ResourceAggregatedStats, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestStatistics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_logs_usage_aggregated(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_logs_usage_aggregated( + from_="from", + to="to", + ) + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_method_get_logs_usage_aggregated_with_all_params(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_logs_usage_aggregated( + from_="from", + to="to", + flat=True, + group_by="group_by", + resource=0, + ) + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_logs_usage_aggregated(self, client: Gcore) -> None: + response = client.cdn.statistics.with_raw_response.get_logs_usage_aggregated( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_logs_usage_aggregated(self, client: Gcore) -> None: + with client.cdn.statistics.with_streaming_response.get_logs_usage_aggregated( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_logs_usage_series(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_logs_usage_series( + from_="from", + to="to", + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + def test_method_get_logs_usage_series_with_all_params(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_logs_usage_series( + from_="from", + to="to", + resource=0, + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_logs_usage_series(self, client: Gcore) -> None: + response = client.cdn.statistics.with_raw_response.get_logs_usage_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_logs_usage_series(self, client: Gcore) -> None: + with client.cdn.statistics.with_streaming_response.get_logs_usage_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_resource_usage_aggregated(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + ) + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_method_get_resource_usage_aggregated_with_all_params(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + countries="countries", + flat=True, + group_by="group_by", + regions="regions", + resource=0, + ) + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_resource_usage_aggregated(self, client: Gcore) -> None: + response = client.cdn.statistics.with_raw_response.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_resource_usage_aggregated(self, client: Gcore) -> None: + with client.cdn.statistics.with_streaming_response.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_resource_usage_series(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + ) + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + @parametrize + def test_method_get_resource_usage_series_with_all_params(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + countries="countries", + group_by="group_by", + regions="regions", + resource=0, + ) + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_resource_usage_series(self, client: Gcore) -> None: + response = client.cdn.statistics.with_raw_response.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_resource_usage_series(self, client: Gcore) -> None: + with client.cdn.statistics.with_streaming_response.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_shield_usage_aggregated(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_shield_usage_aggregated( + from_="from", + to="to", + ) + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_method_get_shield_usage_aggregated_with_all_params(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_shield_usage_aggregated( + from_="from", + to="to", + flat=True, + group_by="group_by", + resource=0, + ) + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_shield_usage_aggregated(self, client: Gcore) -> None: + response = client.cdn.statistics.with_raw_response.get_shield_usage_aggregated( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_shield_usage_aggregated(self, client: Gcore) -> None: + with client.cdn.statistics.with_streaming_response.get_shield_usage_aggregated( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_shield_usage_series(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_shield_usage_series( + from_="from", + to="to", + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + def test_method_get_shield_usage_series_with_all_params(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_shield_usage_series( + from_="from", + to="to", + resource=0, + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_shield_usage_series(self, client: Gcore) -> None: + response = client.cdn.statistics.with_raw_response.get_shield_usage_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_shield_usage_series(self, client: Gcore) -> None: + with client.cdn.statistics.with_streaming_response.get_shield_usage_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncStatistics: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get_logs_usage_aggregated(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_logs_usage_aggregated( + from_="from", + to="to", + ) + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_method_get_logs_usage_aggregated_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_logs_usage_aggregated( + from_="from", + to="to", + flat=True, + group_by="group_by", + resource=0, + ) + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_logs_usage_aggregated(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.statistics.with_raw_response.get_logs_usage_aggregated( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_logs_usage_aggregated(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.statistics.with_streaming_response.get_logs_usage_aggregated( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_logs_usage_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_logs_usage_series( + from_="from", + to="to", + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + async def test_method_get_logs_usage_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_logs_usage_series( + from_="from", + to="to", + resource=0, + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_logs_usage_series(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.statistics.with_raw_response.get_logs_usage_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_logs_usage_series(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.statistics.with_streaming_response.get_logs_usage_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_resource_usage_aggregated(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + ) + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_method_get_resource_usage_aggregated_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + countries="countries", + flat=True, + group_by="group_by", + regions="regions", + resource=0, + ) + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_resource_usage_aggregated(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.statistics.with_raw_response.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_resource_usage_aggregated(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.statistics.with_streaming_response.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_resource_usage_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + ) + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + @parametrize + async def test_method_get_resource_usage_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + countries="countries", + group_by="group_by", + regions="regions", + resource=0, + ) + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_resource_usage_series(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.statistics.with_raw_response.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_resource_usage_series(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.statistics.with_streaming_response.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_shield_usage_aggregated(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_shield_usage_aggregated( + from_="from", + to="to", + ) + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_method_get_shield_usage_aggregated_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_shield_usage_aggregated( + from_="from", + to="to", + flat=True, + group_by="group_by", + resource=0, + ) + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_shield_usage_aggregated(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.statistics.with_raw_response.get_shield_usage_aggregated( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_shield_usage_aggregated(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.statistics.with_streaming_response.get_shield_usage_aggregated( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_shield_usage_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_shield_usage_series( + from_="from", + to="to", + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + async def test_method_get_shield_usage_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_shield_usage_series( + from_="from", + to="to", + resource=0, + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_shield_usage_series(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.statistics.with_raw_response.get_shield_usage_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_shield_usage_series(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.statistics.with_streaming_response.get_shield_usage_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_trusted_ca_certificates.py b/tests/api_resources/cdn/test_trusted_ca_certificates.py new file mode 100644 index 00000000..0d0df832 --- /dev/null +++ b/tests/api_resources/cdn/test_trusted_ca_certificates.py @@ -0,0 +1,355 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + CaCertificate, + CaCertificateList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTrustedCaCertificates: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + trusted_ca_certificate = client.cdn.trusted_ca_certificates.create( + name="Example CA cert", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjAwNjI2MTIwMzUzWhcNMjEwNjI2MTIwMzUzWjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAN4nnSfTsMEnfPgL7rkbImxZAQoND+bpPoX8q16iXZz3fFfqdRk+uEIpU3Brleeg\np0zrrT2eI3+c2h/PRod0Fam4TO6EcfwuboUFzV3j6yw6aWdfBjWZsWBR/FoqWLYq\nb3UejN7yiTYNSiIy3zVpi9pnFM8N8qT+VGBrRDGef2v9JCzhsSSU7wAYM5HKZTp+\nWHojjiyB2hOYqft7A2WlTEDmHFa5UcPHMRZKATUYI1T2TRVqLlSiE2mJ3dFRXGM2\nZAS33J0NVUjkx3w8RmJ7DNflEFJt/6IXdfaokVgfza7LFarrQFQP/YURXEeJT7jm\nDvKpZ/a8wu3ve6N4ykC+CBsCAwEAAaMrMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNV\nHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAovxY5lm89Eod\nL8CH3dZzIH7nv8MXtwgpv2vth4PDq2btLS8xrqm2SsA/cV+DsbDjh5CxQLoDX+8V\ng8NtY+ipOE0hdJAUo7UVlsxuAY4frkmLL1/RwpjZg+Z2NAxpR7xGWgoMn7CH481w\nAOBypAuCxcfcyyAOttdS+YMRJnpL6z8/C3W0LGkNOs26Qhu1/U8lfz1f9F4XummD\nu2SCmJsAd1PrL1shsyh4HtmFjuY698aTjYUDUleAnx7ytrGlZuLOIeoQi7tcsLJJ\nTPMbxTLgGN2HEkdJerFRBNViuWvqioEyYlzZ3MshOCR2wsL4wrXrCF0Y3cNOYcIh\nZ8z+wUAP2g==\n-----END CERTIFICATE-----\n", + ) + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.trusted_ca_certificates.with_raw_response.create( + name="Example CA cert", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjAwNjI2MTIwMzUzWhcNMjEwNjI2MTIwMzUzWjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAN4nnSfTsMEnfPgL7rkbImxZAQoND+bpPoX8q16iXZz3fFfqdRk+uEIpU3Brleeg\np0zrrT2eI3+c2h/PRod0Fam4TO6EcfwuboUFzV3j6yw6aWdfBjWZsWBR/FoqWLYq\nb3UejN7yiTYNSiIy3zVpi9pnFM8N8qT+VGBrRDGef2v9JCzhsSSU7wAYM5HKZTp+\nWHojjiyB2hOYqft7A2WlTEDmHFa5UcPHMRZKATUYI1T2TRVqLlSiE2mJ3dFRXGM2\nZAS33J0NVUjkx3w8RmJ7DNflEFJt/6IXdfaokVgfza7LFarrQFQP/YURXEeJT7jm\nDvKpZ/a8wu3ve6N4ykC+CBsCAwEAAaMrMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNV\nHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAovxY5lm89Eod\nL8CH3dZzIH7nv8MXtwgpv2vth4PDq2btLS8xrqm2SsA/cV+DsbDjh5CxQLoDX+8V\ng8NtY+ipOE0hdJAUo7UVlsxuAY4frkmLL1/RwpjZg+Z2NAxpR7xGWgoMn7CH481w\nAOBypAuCxcfcyyAOttdS+YMRJnpL6z8/C3W0LGkNOs26Qhu1/U8lfz1f9F4XummD\nu2SCmJsAd1PrL1shsyh4HtmFjuY698aTjYUDUleAnx7ytrGlZuLOIeoQi7tcsLJJ\nTPMbxTLgGN2HEkdJerFRBNViuWvqioEyYlzZ3MshOCR2wsL4wrXrCF0Y3cNOYcIh\nZ8z+wUAP2g==\n-----END CERTIFICATE-----\n", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.trusted_ca_certificates.with_streaming_response.create( + name="Example CA cert", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjAwNjI2MTIwMzUzWhcNMjEwNjI2MTIwMzUzWjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAN4nnSfTsMEnfPgL7rkbImxZAQoND+bpPoX8q16iXZz3fFfqdRk+uEIpU3Brleeg\np0zrrT2eI3+c2h/PRod0Fam4TO6EcfwuboUFzV3j6yw6aWdfBjWZsWBR/FoqWLYq\nb3UejN7yiTYNSiIy3zVpi9pnFM8N8qT+VGBrRDGef2v9JCzhsSSU7wAYM5HKZTp+\nWHojjiyB2hOYqft7A2WlTEDmHFa5UcPHMRZKATUYI1T2TRVqLlSiE2mJ3dFRXGM2\nZAS33J0NVUjkx3w8RmJ7DNflEFJt/6IXdfaokVgfza7LFarrQFQP/YURXEeJT7jm\nDvKpZ/a8wu3ve6N4ykC+CBsCAwEAAaMrMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNV\nHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAovxY5lm89Eod\nL8CH3dZzIH7nv8MXtwgpv2vth4PDq2btLS8xrqm2SsA/cV+DsbDjh5CxQLoDX+8V\ng8NtY+ipOE0hdJAUo7UVlsxuAY4frkmLL1/RwpjZg+Z2NAxpR7xGWgoMn7CH481w\nAOBypAuCxcfcyyAOttdS+YMRJnpL6z8/C3W0LGkNOs26Qhu1/U8lfz1f9F4XummD\nu2SCmJsAd1PrL1shsyh4HtmFjuY698aTjYUDUleAnx7ytrGlZuLOIeoQi7tcsLJJ\nTPMbxTLgGN2HEkdJerFRBNViuWvqioEyYlzZ3MshOCR2wsL4wrXrCF0Y3cNOYcIh\nZ8z+wUAP2g==\n-----END CERTIFICATE-----\n", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + trusted_ca_certificate = client.cdn.trusted_ca_certificates.list() + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + trusted_ca_certificate = client.cdn.trusted_ca_certificates.list( + automated=True, + resource_id=0, + validity_not_after_lte="validity_not_after_lte", + ) + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.trusted_ca_certificates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.trusted_ca_certificates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + trusted_ca_certificate = client.cdn.trusted_ca_certificates.delete( + 0, + ) + assert trusted_ca_certificate is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.trusted_ca_certificates.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = response.parse() + assert trusted_ca_certificate is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.trusted_ca_certificates.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = response.parse() + assert trusted_ca_certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + trusted_ca_certificate = client.cdn.trusted_ca_certificates.get( + 0, + ) + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.trusted_ca_certificates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.trusted_ca_certificates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + trusted_ca_certificate = client.cdn.trusted_ca_certificates.replace( + id=0, + name="Example CA cert 2", + ) + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.trusted_ca_certificates.with_raw_response.replace( + id=0, + name="Example CA cert 2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.trusted_ca_certificates.with_streaming_response.replace( + id=0, + name="Example CA cert 2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncTrustedCaCertificates: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.create( + name="Example CA cert", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjAwNjI2MTIwMzUzWhcNMjEwNjI2MTIwMzUzWjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAN4nnSfTsMEnfPgL7rkbImxZAQoND+bpPoX8q16iXZz3fFfqdRk+uEIpU3Brleeg\np0zrrT2eI3+c2h/PRod0Fam4TO6EcfwuboUFzV3j6yw6aWdfBjWZsWBR/FoqWLYq\nb3UejN7yiTYNSiIy3zVpi9pnFM8N8qT+VGBrRDGef2v9JCzhsSSU7wAYM5HKZTp+\nWHojjiyB2hOYqft7A2WlTEDmHFa5UcPHMRZKATUYI1T2TRVqLlSiE2mJ3dFRXGM2\nZAS33J0NVUjkx3w8RmJ7DNflEFJt/6IXdfaokVgfza7LFarrQFQP/YURXEeJT7jm\nDvKpZ/a8wu3ve6N4ykC+CBsCAwEAAaMrMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNV\nHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAovxY5lm89Eod\nL8CH3dZzIH7nv8MXtwgpv2vth4PDq2btLS8xrqm2SsA/cV+DsbDjh5CxQLoDX+8V\ng8NtY+ipOE0hdJAUo7UVlsxuAY4frkmLL1/RwpjZg+Z2NAxpR7xGWgoMn7CH481w\nAOBypAuCxcfcyyAOttdS+YMRJnpL6z8/C3W0LGkNOs26Qhu1/U8lfz1f9F4XummD\nu2SCmJsAd1PrL1shsyh4HtmFjuY698aTjYUDUleAnx7ytrGlZuLOIeoQi7tcsLJJ\nTPMbxTLgGN2HEkdJerFRBNViuWvqioEyYlzZ3MshOCR2wsL4wrXrCF0Y3cNOYcIh\nZ8z+wUAP2g==\n-----END CERTIFICATE-----\n", + ) + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.trusted_ca_certificates.with_raw_response.create( + name="Example CA cert", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjAwNjI2MTIwMzUzWhcNMjEwNjI2MTIwMzUzWjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAN4nnSfTsMEnfPgL7rkbImxZAQoND+bpPoX8q16iXZz3fFfqdRk+uEIpU3Brleeg\np0zrrT2eI3+c2h/PRod0Fam4TO6EcfwuboUFzV3j6yw6aWdfBjWZsWBR/FoqWLYq\nb3UejN7yiTYNSiIy3zVpi9pnFM8N8qT+VGBrRDGef2v9JCzhsSSU7wAYM5HKZTp+\nWHojjiyB2hOYqft7A2WlTEDmHFa5UcPHMRZKATUYI1T2TRVqLlSiE2mJ3dFRXGM2\nZAS33J0NVUjkx3w8RmJ7DNflEFJt/6IXdfaokVgfza7LFarrQFQP/YURXEeJT7jm\nDvKpZ/a8wu3ve6N4ykC+CBsCAwEAAaMrMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNV\nHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAovxY5lm89Eod\nL8CH3dZzIH7nv8MXtwgpv2vth4PDq2btLS8xrqm2SsA/cV+DsbDjh5CxQLoDX+8V\ng8NtY+ipOE0hdJAUo7UVlsxuAY4frkmLL1/RwpjZg+Z2NAxpR7xGWgoMn7CH481w\nAOBypAuCxcfcyyAOttdS+YMRJnpL6z8/C3W0LGkNOs26Qhu1/U8lfz1f9F4XummD\nu2SCmJsAd1PrL1shsyh4HtmFjuY698aTjYUDUleAnx7ytrGlZuLOIeoQi7tcsLJJ\nTPMbxTLgGN2HEkdJerFRBNViuWvqioEyYlzZ3MshOCR2wsL4wrXrCF0Y3cNOYcIh\nZ8z+wUAP2g==\n-----END CERTIFICATE-----\n", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.trusted_ca_certificates.with_streaming_response.create( + name="Example CA cert", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjAwNjI2MTIwMzUzWhcNMjEwNjI2MTIwMzUzWjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAN4nnSfTsMEnfPgL7rkbImxZAQoND+bpPoX8q16iXZz3fFfqdRk+uEIpU3Brleeg\np0zrrT2eI3+c2h/PRod0Fam4TO6EcfwuboUFzV3j6yw6aWdfBjWZsWBR/FoqWLYq\nb3UejN7yiTYNSiIy3zVpi9pnFM8N8qT+VGBrRDGef2v9JCzhsSSU7wAYM5HKZTp+\nWHojjiyB2hOYqft7A2WlTEDmHFa5UcPHMRZKATUYI1T2TRVqLlSiE2mJ3dFRXGM2\nZAS33J0NVUjkx3w8RmJ7DNflEFJt/6IXdfaokVgfza7LFarrQFQP/YURXEeJT7jm\nDvKpZ/a8wu3ve6N4ykC+CBsCAwEAAaMrMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNV\nHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAovxY5lm89Eod\nL8CH3dZzIH7nv8MXtwgpv2vth4PDq2btLS8xrqm2SsA/cV+DsbDjh5CxQLoDX+8V\ng8NtY+ipOE0hdJAUo7UVlsxuAY4frkmLL1/RwpjZg+Z2NAxpR7xGWgoMn7CH481w\nAOBypAuCxcfcyyAOttdS+YMRJnpL6z8/C3W0LGkNOs26Qhu1/U8lfz1f9F4XummD\nu2SCmJsAd1PrL1shsyh4HtmFjuY698aTjYUDUleAnx7ytrGlZuLOIeoQi7tcsLJJ\nTPMbxTLgGN2HEkdJerFRBNViuWvqioEyYlzZ3MshOCR2wsL4wrXrCF0Y3cNOYcIh\nZ8z+wUAP2g==\n-----END CERTIFICATE-----\n", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.list() + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.list( + automated=True, + resource_id=0, + validity_not_after_lte="validity_not_after_lte", + ) + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.trusted_ca_certificates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.trusted_ca_certificates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.delete( + 0, + ) + assert trusted_ca_certificate is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.trusted_ca_certificates.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = await response.parse() + assert trusted_ca_certificate is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.trusted_ca_certificates.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = await response.parse() + assert trusted_ca_certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.get( + 0, + ) + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.trusted_ca_certificates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.trusted_ca_certificates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.replace( + id=0, + name="Example CA cert 2", + ) + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.trusted_ca_certificates.with_raw_response.replace( + id=0, + name="Example CA cert 2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.trusted_ca_certificates.with_streaming_response.replace( + id=0, + name="Example CA cert 2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_cdn.py b/tests/api_resources/test_cdn.py new file mode 100644 index 00000000..8e256e1f --- /dev/null +++ b/tests/api_resources/test_cdn.py @@ -0,0 +1,320 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + CdnAccount, + PurgeStatus, + CdnAccountLimits, + CdnAvailableFeatures, +) +from gcore.pagination import SyncOffsetPageCdn, AsyncOffsetPageCdn + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCdn: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_account_limits(self, client: Gcore) -> None: + cdn = client.cdn.get_account_limits() + assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + + @parametrize + def test_raw_response_get_account_limits(self, client: Gcore) -> None: + response = client.cdn.with_raw_response.get_account_limits() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = response.parse() + assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + + @parametrize + def test_streaming_response_get_account_limits(self, client: Gcore) -> None: + with client.cdn.with_streaming_response.get_account_limits() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = response.parse() + assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_account_overview(self, client: Gcore) -> None: + cdn = client.cdn.get_account_overview() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + def test_raw_response_get_account_overview(self, client: Gcore) -> None: + response = client.cdn.with_raw_response.get_account_overview() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + def test_streaming_response_get_account_overview(self, client: Gcore) -> None: + with client.cdn.with_streaming_response.get_account_overview() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_available_features(self, client: Gcore) -> None: + cdn = client.cdn.get_available_features() + assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + + @parametrize + def test_raw_response_get_available_features(self, client: Gcore) -> None: + response = client.cdn.with_raw_response.get_available_features() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = response.parse() + assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + + @parametrize + def test_streaming_response_get_available_features(self, client: Gcore) -> None: + with client.cdn.with_streaming_response.get_available_features() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = response.parse() + assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_purge_statuses(self, client: Gcore) -> None: + cdn = client.cdn.list_purge_statuses() + assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + + @parametrize + def test_method_list_purge_statuses_with_all_params(self, client: Gcore) -> None: + cdn = client.cdn.list_purge_statuses( + cname="cname", + from_created="from_created", + limit=100, + offset=0, + purge_type="purge_type", + status="status", + to_created="to_created", + ) + assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + + @parametrize + def test_raw_response_list_purge_statuses(self, client: Gcore) -> None: + response = client.cdn.with_raw_response.list_purge_statuses() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = response.parse() + assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + + @parametrize + def test_streaming_response_list_purge_statuses(self, client: Gcore) -> None: + with client.cdn.with_streaming_response.list_purge_statuses() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = response.parse() + assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update_account(self, client: Gcore) -> None: + cdn = client.cdn.update_account() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + def test_method_update_account_with_all_params(self, client: Gcore) -> None: + cdn = client.cdn.update_account( + utilization_level=1111, + ) + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + def test_raw_response_update_account(self, client: Gcore) -> None: + response = client.cdn.with_raw_response.update_account() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + def test_streaming_response_update_account(self, client: Gcore) -> None: + with client.cdn.with_streaming_response.update_account() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCdn: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get_account_limits(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.get_account_limits() + assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + + @parametrize + async def test_raw_response_get_account_limits(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.with_raw_response.get_account_limits() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = await response.parse() + assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + + @parametrize + async def test_streaming_response_get_account_limits(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.with_streaming_response.get_account_limits() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = await response.parse() + assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_account_overview(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.get_account_overview() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + async def test_raw_response_get_account_overview(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.with_raw_response.get_account_overview() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = await response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + async def test_streaming_response_get_account_overview(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.with_streaming_response.get_account_overview() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = await response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_available_features(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.get_available_features() + assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + + @parametrize + async def test_raw_response_get_available_features(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.with_raw_response.get_available_features() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = await response.parse() + assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + + @parametrize + async def test_streaming_response_get_available_features(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.with_streaming_response.get_available_features() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = await response.parse() + assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_purge_statuses(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.list_purge_statuses() + assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + + @parametrize + async def test_method_list_purge_statuses_with_all_params(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.list_purge_statuses( + cname="cname", + from_created="from_created", + limit=100, + offset=0, + purge_type="purge_type", + status="status", + to_created="to_created", + ) + assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + + @parametrize + async def test_raw_response_list_purge_statuses(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.with_raw_response.list_purge_statuses() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = await response.parse() + assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + + @parametrize + async def test_streaming_response_list_purge_statuses(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.with_streaming_response.list_purge_statuses() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = await response.parse() + assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update_account(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.update_account() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + async def test_method_update_account_with_all_params(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.update_account( + utilization_level=1111, + ) + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + async def test_raw_response_update_account(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.with_raw_response.update_account() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = await response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + async def test_streaming_response_update_account(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.with_streaming_response.update_account() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = await response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True From 152a81664614bfa84a0c802d92b886c99e955ece Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Sep 2025 05:44:17 +0000 Subject: [PATCH 340/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d52d2b97..a26ebfc1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.13.0" + ".": "0.14.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index fc8fa408..7f06d8fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.13.0" +version = "0.14.0" description = "The official Python library for the gcore API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/gcore/_version.py b/src/gcore/_version.py index 30d62a13..426ebfb3 100644 --- a/src/gcore/_version.py +++ b/src/gcore/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "gcore" -__version__ = "0.13.0" # x-release-please-version +__version__ = "0.14.0" # x-release-please-version From 0fd53f9dbbe89f84d5e139a653cdfc0ac535c965 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Sep 2025 12:15:38 +0000 Subject: [PATCH 341/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- api.md | 2 +- src/gcore/resources/cloud/networks/subnets.py | 12 +++++------ src/gcore/types/cdn/cdn_resource.py | 20 +++++++++++++++++++ src/gcore/types/cdn/resource_create_params.py | 20 +++++++++++++++++++ .../types/cdn/resource_replace_params.py | 20 +++++++++++++++++++ src/gcore/types/cdn/resource_update_params.py | 20 +++++++++++++++++++ .../types/cdn/resources/cdn_resource_rule.py | 20 +++++++++++++++++++ .../types/cdn/resources/rule_create_params.py | 20 +++++++++++++++++++ .../cdn/resources/rule_replace_params.py | 20 +++++++++++++++++++ .../types/cdn/resources/rule_update_params.py | 20 +++++++++++++++++++ src/gcore/types/cdn/rule_template.py | 20 +++++++++++++++++++ .../types/cdn/rule_template_create_params.py | 20 +++++++++++++++++++ .../types/cdn/rule_template_replace_params.py | 20 +++++++++++++++++++ .../types/cdn/rule_template_update_params.py | 20 +++++++++++++++++++ .../gpu_baremetal_flavor.py | 12 +++++++++++ .../api_resources/cdn/resources/test_rules.py | 12 +++++++++++ tests/api_resources/cdn/test_resources.py | 12 +++++++++++ .../api_resources/cdn/test_rule_templates.py | 12 +++++++++++ .../cloud/networks/test_subnets.py | 12 +++++------ 20 files changed, 302 insertions(+), 16 deletions(-) diff --git a/.stats.yml b/.stats.yml index 28d74a32..f4b66ad9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d59e09eb6882032973e42339edbc5170a0d695dcb127e28e29109f1a1f088afd.yml -openapi_spec_hash: 8768c88e22bbe1d3042539be56ea8469 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-751a4484d0fe654e54b278167d65ece7cc03a254ded11d7910878acc1c54d13f.yml +openapi_spec_hash: b70c3cc1433a3ff2665b95afd8a4df81 config_hash: 11eb703eee66609eba76695b18f8cb4a diff --git a/api.md b/api.md index b15ab5ea..32fe29dc 100644 --- a/api.md +++ b/api.md @@ -344,7 +344,7 @@ Methods: - client.cloud.networks.subnets.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.networks.subnets.update(subnet_id, \*, project_id, region_id, \*\*params) -> Subnet - client.cloud.networks.subnets.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Subnet] -- client.cloud.networks.subnets.delete(subnet_id, \*, project_id, region_id) -> None +- client.cloud.networks.subnets.delete(subnet_id, \*, project_id, region_id) -> TaskIDList - client.cloud.networks.subnets.get(subnet_id, \*, project_id, region_id) -> Subnet ### Routers diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 22a3b1a4..14ed3385 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -7,7 +7,7 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -353,7 +353,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: + ) -> TaskIDList: """ Delete subnet @@ -378,7 +378,6 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" if self._client._base_url_overridden @@ -386,7 +385,7 @@ def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=NoneType, + cast_to=TaskIDList, ) def get( @@ -761,7 +760,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: + ) -> TaskIDList: """ Delete subnet @@ -786,7 +785,6 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" if self._client._base_url_overridden @@ -794,7 +792,7 @@ async def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=NoneType, + cast_to=TaskIDList, ) async def get( diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py index 978b7f64..6b897448 100644 --- a/src/gcore/types/cdn/cdn_resource.py +++ b/src/gcore/types/cdn/cdn_resource.py @@ -832,6 +832,26 @@ class OptionsQueryStringForwarding(BaseModel): of the streaming session. """ + forward_except_keys: Optional[List[str]] = None + """ + The `forward_except_keys` field provides a mechanism to exclude specific + parameters from being forwarded from playlist files to media chunk files. By + listing certain keys in this field, you can ensure that these parameters are + omitted during the forwarding process. This is particularly useful for + preventing sensitive or irrelevant information from being included in requests + for media chunks, thereby enhancing security and optimizing performance. + """ + + forward_only_keys: Optional[List[str]] = None + """ + The `forward_only_keys` field allows for granular control over which specific + parameters are forwarded from playlist files to media chunk files. By specifying + certain keys, only those parameters will be propagated, ensuring that only + relevant information is passed along. This is particularly useful for security + and performance optimization, as it prevents unnecessary or sensitive data from + being included in requests for media chunks. + """ + class OptionsRedirectHTTPToHTTPS(BaseModel): enabled: bool diff --git a/src/gcore/types/cdn/resource_create_params.py b/src/gcore/types/cdn/resource_create_params.py index fbde3142..544e6f4a 100644 --- a/src/gcore/types/cdn/resource_create_params.py +++ b/src/gcore/types/cdn/resource_create_params.py @@ -955,6 +955,26 @@ class OptionsQueryStringForwarding(TypedDict, total=False): of the streaming session. """ + forward_except_keys: SequenceNotStr[str] + """ + The `forward_except_keys` field provides a mechanism to exclude specific + parameters from being forwarded from playlist files to media chunk files. By + listing certain keys in this field, you can ensure that these parameters are + omitted during the forwarding process. This is particularly useful for + preventing sensitive or irrelevant information from being included in requests + for media chunks, thereby enhancing security and optimizing performance. + """ + + forward_only_keys: SequenceNotStr[str] + """ + The `forward_only_keys` field allows for granular control over which specific + parameters are forwarded from playlist files to media chunk files. By specifying + certain keys, only those parameters will be propagated, ensuring that only + relevant information is passed along. This is particularly useful for security + and performance optimization, as it prevents unnecessary or sensitive data from + being included in requests for media chunks. + """ + class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): enabled: Required[bool] diff --git a/src/gcore/types/cdn/resource_replace_params.py b/src/gcore/types/cdn/resource_replace_params.py index 4128691f..938b1f96 100644 --- a/src/gcore/types/cdn/resource_replace_params.py +++ b/src/gcore/types/cdn/resource_replace_params.py @@ -933,6 +933,26 @@ class OptionsQueryStringForwarding(TypedDict, total=False): of the streaming session. """ + forward_except_keys: SequenceNotStr[str] + """ + The `forward_except_keys` field provides a mechanism to exclude specific + parameters from being forwarded from playlist files to media chunk files. By + listing certain keys in this field, you can ensure that these parameters are + omitted during the forwarding process. This is particularly useful for + preventing sensitive or irrelevant information from being included in requests + for media chunks, thereby enhancing security and optimizing performance. + """ + + forward_only_keys: SequenceNotStr[str] + """ + The `forward_only_keys` field allows for granular control over which specific + parameters are forwarded from playlist files to media chunk files. By specifying + certain keys, only those parameters will be propagated, ensuring that only + relevant information is passed along. This is particularly useful for security + and performance optimization, as it prevents unnecessary or sensitive data from + being included in requests for media chunks. + """ + class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): enabled: Required[bool] diff --git a/src/gcore/types/cdn/resource_update_params.py b/src/gcore/types/cdn/resource_update_params.py index dad17ba7..6ee27ee0 100644 --- a/src/gcore/types/cdn/resource_update_params.py +++ b/src/gcore/types/cdn/resource_update_params.py @@ -924,6 +924,26 @@ class OptionsQueryStringForwarding(TypedDict, total=False): of the streaming session. """ + forward_except_keys: SequenceNotStr[str] + """ + The `forward_except_keys` field provides a mechanism to exclude specific + parameters from being forwarded from playlist files to media chunk files. By + listing certain keys in this field, you can ensure that these parameters are + omitted during the forwarding process. This is particularly useful for + preventing sensitive or irrelevant information from being included in requests + for media chunks, thereby enhancing security and optimizing performance. + """ + + forward_only_keys: SequenceNotStr[str] + """ + The `forward_only_keys` field allows for granular control over which specific + parameters are forwarded from playlist files to media chunk files. By specifying + certain keys, only those parameters will be propagated, ensuring that only + relevant information is passed along. This is particularly useful for security + and performance optimization, as it prevents unnecessary or sensitive data from + being included in requests for media chunks. + """ + class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): enabled: Required[bool] diff --git a/src/gcore/types/cdn/resources/cdn_resource_rule.py b/src/gcore/types/cdn/resources/cdn_resource_rule.py index 8bf93a9e..4975c21d 100644 --- a/src/gcore/types/cdn/resources/cdn_resource_rule.py +++ b/src/gcore/types/cdn/resources/cdn_resource_rule.py @@ -809,6 +809,26 @@ class OptionsQueryStringForwarding(BaseModel): of the streaming session. """ + forward_except_keys: Optional[List[str]] = None + """ + The `forward_except_keys` field provides a mechanism to exclude specific + parameters from being forwarded from playlist files to media chunk files. By + listing certain keys in this field, you can ensure that these parameters are + omitted during the forwarding process. This is particularly useful for + preventing sensitive or irrelevant information from being included in requests + for media chunks, thereby enhancing security and optimizing performance. + """ + + forward_only_keys: Optional[List[str]] = None + """ + The `forward_only_keys` field allows for granular control over which specific + parameters are forwarded from playlist files to media chunk files. By specifying + certain keys, only those parameters will be propagated, ensuring that only + relevant information is passed along. This is particularly useful for security + and performance optimization, as it prevents unnecessary or sensitive data from + being included in requests for media chunks. + """ + class OptionsRedirectHTTPToHTTPS(BaseModel): enabled: bool diff --git a/src/gcore/types/cdn/resources/rule_create_params.py b/src/gcore/types/cdn/resources/rule_create_params.py index b9c282ce..1f1c269f 100644 --- a/src/gcore/types/cdn/resources/rule_create_params.py +++ b/src/gcore/types/cdn/resources/rule_create_params.py @@ -885,6 +885,26 @@ class OptionsQueryStringForwarding(TypedDict, total=False): of the streaming session. """ + forward_except_keys: SequenceNotStr[str] + """ + The `forward_except_keys` field provides a mechanism to exclude specific + parameters from being forwarded from playlist files to media chunk files. By + listing certain keys in this field, you can ensure that these parameters are + omitted during the forwarding process. This is particularly useful for + preventing sensitive or irrelevant information from being included in requests + for media chunks, thereby enhancing security and optimizing performance. + """ + + forward_only_keys: SequenceNotStr[str] + """ + The `forward_only_keys` field allows for granular control over which specific + parameters are forwarded from playlist files to media chunk files. By specifying + certain keys, only those parameters will be propagated, ensuring that only + relevant information is passed along. This is particularly useful for security + and performance optimization, as it prevents unnecessary or sensitive data from + being included in requests for media chunks. + """ + class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): enabled: Required[bool] diff --git a/src/gcore/types/cdn/resources/rule_replace_params.py b/src/gcore/types/cdn/resources/rule_replace_params.py index 6e9dfca4..63da2423 100644 --- a/src/gcore/types/cdn/resources/rule_replace_params.py +++ b/src/gcore/types/cdn/resources/rule_replace_params.py @@ -887,6 +887,26 @@ class OptionsQueryStringForwarding(TypedDict, total=False): of the streaming session. """ + forward_except_keys: SequenceNotStr[str] + """ + The `forward_except_keys` field provides a mechanism to exclude specific + parameters from being forwarded from playlist files to media chunk files. By + listing certain keys in this field, you can ensure that these parameters are + omitted during the forwarding process. This is particularly useful for + preventing sensitive or irrelevant information from being included in requests + for media chunks, thereby enhancing security and optimizing performance. + """ + + forward_only_keys: SequenceNotStr[str] + """ + The `forward_only_keys` field allows for granular control over which specific + parameters are forwarded from playlist files to media chunk files. By specifying + certain keys, only those parameters will be propagated, ensuring that only + relevant information is passed along. This is particularly useful for security + and performance optimization, as it prevents unnecessary or sensitive data from + being included in requests for media chunks. + """ + class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): enabled: Required[bool] diff --git a/src/gcore/types/cdn/resources/rule_update_params.py b/src/gcore/types/cdn/resources/rule_update_params.py index 959e82a8..6351104f 100644 --- a/src/gcore/types/cdn/resources/rule_update_params.py +++ b/src/gcore/types/cdn/resources/rule_update_params.py @@ -887,6 +887,26 @@ class OptionsQueryStringForwarding(TypedDict, total=False): of the streaming session. """ + forward_except_keys: SequenceNotStr[str] + """ + The `forward_except_keys` field provides a mechanism to exclude specific + parameters from being forwarded from playlist files to media chunk files. By + listing certain keys in this field, you can ensure that these parameters are + omitted during the forwarding process. This is particularly useful for + preventing sensitive or irrelevant information from being included in requests + for media chunks, thereby enhancing security and optimizing performance. + """ + + forward_only_keys: SequenceNotStr[str] + """ + The `forward_only_keys` field allows for granular control over which specific + parameters are forwarded from playlist files to media chunk files. By specifying + certain keys, only those parameters will be propagated, ensuring that only + relevant information is passed along. This is particularly useful for security + and performance optimization, as it prevents unnecessary or sensitive data from + being included in requests for media chunks. + """ + class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): enabled: Required[bool] diff --git a/src/gcore/types/cdn/rule_template.py b/src/gcore/types/cdn/rule_template.py index 000e8ebd..4f13a6a2 100644 --- a/src/gcore/types/cdn/rule_template.py +++ b/src/gcore/types/cdn/rule_template.py @@ -809,6 +809,26 @@ class OptionsQueryStringForwarding(BaseModel): of the streaming session. """ + forward_except_keys: Optional[List[str]] = None + """ + The `forward_except_keys` field provides a mechanism to exclude specific + parameters from being forwarded from playlist files to media chunk files. By + listing certain keys in this field, you can ensure that these parameters are + omitted during the forwarding process. This is particularly useful for + preventing sensitive or irrelevant information from being included in requests + for media chunks, thereby enhancing security and optimizing performance. + """ + + forward_only_keys: Optional[List[str]] = None + """ + The `forward_only_keys` field allows for granular control over which specific + parameters are forwarded from playlist files to media chunk files. By specifying + certain keys, only those parameters will be propagated, ensuring that only + relevant information is passed along. This is particularly useful for security + and performance optimization, as it prevents unnecessary or sensitive data from + being included in requests for media chunks. + """ + class OptionsRedirectHTTPToHTTPS(BaseModel): enabled: bool diff --git a/src/gcore/types/cdn/rule_template_create_params.py b/src/gcore/types/cdn/rule_template_create_params.py index bea0ca5a..529ec2a3 100644 --- a/src/gcore/types/cdn/rule_template_create_params.py +++ b/src/gcore/types/cdn/rule_template_create_params.py @@ -869,6 +869,26 @@ class OptionsQueryStringForwarding(TypedDict, total=False): of the streaming session. """ + forward_except_keys: SequenceNotStr[str] + """ + The `forward_except_keys` field provides a mechanism to exclude specific + parameters from being forwarded from playlist files to media chunk files. By + listing certain keys in this field, you can ensure that these parameters are + omitted during the forwarding process. This is particularly useful for + preventing sensitive or irrelevant information from being included in requests + for media chunks, thereby enhancing security and optimizing performance. + """ + + forward_only_keys: SequenceNotStr[str] + """ + The `forward_only_keys` field allows for granular control over which specific + parameters are forwarded from playlist files to media chunk files. By specifying + certain keys, only those parameters will be propagated, ensuring that only + relevant information is passed along. This is particularly useful for security + and performance optimization, as it prevents unnecessary or sensitive data from + being included in requests for media chunks. + """ + class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): enabled: Required[bool] diff --git a/src/gcore/types/cdn/rule_template_replace_params.py b/src/gcore/types/cdn/rule_template_replace_params.py index 61956314..ca412de2 100644 --- a/src/gcore/types/cdn/rule_template_replace_params.py +++ b/src/gcore/types/cdn/rule_template_replace_params.py @@ -869,6 +869,26 @@ class OptionsQueryStringForwarding(TypedDict, total=False): of the streaming session. """ + forward_except_keys: SequenceNotStr[str] + """ + The `forward_except_keys` field provides a mechanism to exclude specific + parameters from being forwarded from playlist files to media chunk files. By + listing certain keys in this field, you can ensure that these parameters are + omitted during the forwarding process. This is particularly useful for + preventing sensitive or irrelevant information from being included in requests + for media chunks, thereby enhancing security and optimizing performance. + """ + + forward_only_keys: SequenceNotStr[str] + """ + The `forward_only_keys` field allows for granular control over which specific + parameters are forwarded from playlist files to media chunk files. By specifying + certain keys, only those parameters will be propagated, ensuring that only + relevant information is passed along. This is particularly useful for security + and performance optimization, as it prevents unnecessary or sensitive data from + being included in requests for media chunks. + """ + class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): enabled: Required[bool] diff --git a/src/gcore/types/cdn/rule_template_update_params.py b/src/gcore/types/cdn/rule_template_update_params.py index 927ca2e9..685df7a4 100644 --- a/src/gcore/types/cdn/rule_template_update_params.py +++ b/src/gcore/types/cdn/rule_template_update_params.py @@ -869,6 +869,26 @@ class OptionsQueryStringForwarding(TypedDict, total=False): of the streaming session. """ + forward_except_keys: SequenceNotStr[str] + """ + The `forward_except_keys` field provides a mechanism to exclude specific + parameters from being forwarded from playlist files to media chunk files. By + listing certain keys in this field, you can ensure that these parameters are + omitted during the forwarding process. This is particularly useful for + preventing sensitive or irrelevant information from being included in requests + for media chunks, thereby enhancing security and optimizing performance. + """ + + forward_only_keys: SequenceNotStr[str] + """ + The `forward_only_keys` field allows for granular control over which specific + parameters are forwarded from playlist files to media chunk files. By specifying + certain keys, only those parameters will be propagated, ensuring that only + relevant information is passed along. This is particularly useful for security + and performance optimization, as it prevents unnecessary or sensitive data from + being included in requests for media chunks. + """ + class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): enabled: Required[bool] 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 19278108..4664d48a 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 @@ -46,6 +46,12 @@ class GPUBaremetalFlavorSerializerWithoutPriceHardwareProperties(BaseModel): gpu_model: Optional[str] = None """GPU model""" + nic_eth: Optional[str] = None + """The configuration of the Ethernet ports""" + + nic_ib: Optional[str] = None + """The configuration of the InfiniBand ports""" + class GPUBaremetalFlavorSerializerWithoutPriceSupportedFeatures(BaseModel): security_groups: bool @@ -101,6 +107,12 @@ class GPUBaremetalFlavorSerializerWithPricesHardwareProperties(BaseModel): gpu_model: Optional[str] = None """GPU model""" + nic_eth: Optional[str] = None + """The configuration of the Ethernet ports""" + + nic_ib: Optional[str] = None + """The configuration of the InfiniBand ports""" + class GPUBaremetalFlavorSerializerWithPricesPrice(BaseModel): currency_code: Optional[str] = None diff --git a/tests/api_resources/cdn/resources/test_rules.py b/tests/api_resources/cdn/resources/test_rules.py index fbb097c3..9fb7c8b6 100644 --- a/tests/api_resources/cdn/resources/test_rules.py +++ b/tests/api_resources/cdn/resources/test_rules.py @@ -211,6 +211,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -522,6 +524,8 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -934,6 +938,8 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -1254,6 +1260,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -1565,6 +1573,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -1977,6 +1987,8 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, diff --git a/tests/api_resources/cdn/test_resources.py b/tests/api_resources/cdn/test_resources.py index 1f5c43bb..97602ddc 100644 --- a/tests/api_resources/cdn/test_resources.py +++ b/tests/api_resources/cdn/test_resources.py @@ -215,6 +215,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -551,6 +553,8 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -1175,6 +1179,8 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -1516,6 +1522,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -1852,6 +1860,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -2476,6 +2486,8 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, diff --git a/tests/api_resources/cdn/test_rule_templates.py b/tests/api_resources/cdn/test_rule_templates.py index 7f1d616d..3ef7dd05 100644 --- a/tests/api_resources/cdn/test_rule_templates.py +++ b/tests/api_resources/cdn/test_rule_templates.py @@ -207,6 +207,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -510,6 +512,8 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -904,6 +908,8 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -1217,6 +1223,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -1520,6 +1528,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, @@ -1914,6 +1924,8 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, "forward_from_file_types": ["m3u8", "mpd"], "forward_to_file_types": ["ts", "mp4"], + "forward_except_keys": ["debug_info"], + "forward_only_keys": ["auth_token", "session_id"], }, "redirect_http_to_https": { "enabled": True, diff --git a/tests/api_resources/cloud/networks/test_subnets.py b/tests/api_resources/cloud/networks/test_subnets.py index 0680b1f7..8ba4ff6f 100644 --- a/tests/api_resources/cloud/networks/test_subnets.py +++ b/tests/api_resources/cloud/networks/test_subnets.py @@ -206,7 +206,7 @@ def test_method_delete(self, client: Gcore) -> None: project_id=1, region_id=1, ) - assert subnet is None + assert_matches_type(TaskIDList, subnet, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: @@ -219,7 +219,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" subnet = response.parse() - assert subnet is None + assert_matches_type(TaskIDList, subnet, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: @@ -232,7 +232,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" subnet = response.parse() - assert subnet is None + assert_matches_type(TaskIDList, subnet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -485,7 +485,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: project_id=1, region_id=1, ) - assert subnet is None + assert_matches_type(TaskIDList, subnet, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @@ -498,7 +498,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" subnet = await response.parse() - assert subnet is None + assert_matches_type(TaskIDList, subnet, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: @@ -511,7 +511,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" subnet = await response.parse() - assert subnet is None + assert_matches_type(TaskIDList, subnet, path=["response"]) assert cast(Any, response.is_closed) is True From 9636c2a595c811df789e07df1ff8f23f2798a9a8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 1 Oct 2025 08:13:11 +0000 Subject: [PATCH 342/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/iam/api_tokens.py | 6 ++- src/gcore/types/iam/account_overview.py | 50 +++++++++---------- src/gcore/types/iam/api_token.py | 48 +++++++++--------- .../types/iam/api_token_create_params.py | 3 +- src/gcore/types/iam/api_token_list.py | 48 +++++++++--------- src/gcore/types/iam/user_detailed.py | 30 +++++------ src/gcore/types/iam/user_invite.py | 6 +-- src/gcore/types/iam/user_update.py | 30 +++++------ 9 files changed, 112 insertions(+), 113 deletions(-) diff --git a/.stats.yml b/.stats.yml index f4b66ad9..cd48d6f3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-751a4484d0fe654e54b278167d65ece7cc03a254ded11d7910878acc1c54d13f.yml -openapi_spec_hash: b70c3cc1433a3ff2665b95afd8a4df81 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-dafe18d92c83ef5bf5454ccc0c0d242b753f42c37f62542bfd7b614f5ad5d6f4.yml +openapi_spec_hash: fbe9b7c24144bd442b1294bf2e3ee79a config_hash: 11eb703eee66609eba76695b18f8cb4a diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index e6031ed5..3cabd1c3 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -2,6 +2,8 @@ from __future__ import annotations +from typing import Optional + import httpx from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given @@ -48,7 +50,7 @@ def create( client_id: int, *, client_user: api_token_create_params.ClientUser, - exp_date: str, + exp_date: Optional[str], name: str, description: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -269,7 +271,7 @@ async def create( client_id: int, *, client_user: api_token_create_params.ClientUser, - exp_date: str, + exp_date: Optional[str], name: str, description: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/types/iam/account_overview.py b/src/gcore/types/iam/account_overview.py index 68de5bbd..e0907b58 100644 --- a/src/gcore/types/iam/account_overview.py +++ b/src/gcore/types/iam/account_overview.py @@ -410,50 +410,44 @@ class User(BaseModel): class AccountOverview(BaseModel): - id: Optional[int] = None + id: int """The account ID.""" - bill_type: Optional[str] = None + bill_type: str """System field. Billing type of the account.""" - capabilities: Optional[List[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]]] = None + capabilities: List[Literal["CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD"]] """System field. List of services available for the account.""" - company_name: Optional[str] = FieldInfo(alias="companyName", default=None) + company_name: str = FieldInfo(alias="companyName") """The company name.""" - country_code: Optional[str] = None - """System field. The company country (ISO 3166-1 alpha-2 format).""" - - current_user: Optional[int] = FieldInfo(alias="currentUser", default=None) + current_user: int = FieldInfo(alias="currentUser") """ID of the current user.""" - custom_id: Optional[str] = None - """The account custom ID.""" - - deleted: Optional[bool] = None + deleted: bool """The field shows the status of the account: - `true` – the account has been deleted - `false` – the account is not deleted """ - email: Optional[str] = None + email: str """The account email.""" entry_base_domain: Optional[str] = FieldInfo(alias="entryBaseDomain", default=None) """System field. Control panel domain.""" - free_features: Optional[FreeFeatures] = FieldInfo(alias="freeFeatures", default=None) + free_features: FreeFeatures = FieldInfo(alias="freeFeatures") """ An object of arrays which contains information about free features available for the requested account. """ - has_active_admin: Optional[bool] = None + has_active_admin: bool """System field.""" - is_test: Optional[bool] = None + is_test: bool """System field: - `true` — a test account; @@ -463,29 +457,33 @@ class AccountOverview(BaseModel): name: Optional[str] = None """Name of a user who registered the requested account.""" - paid_features: Optional[PaidFeatures] = FieldInfo(alias="paidFeatures", default=None) + paid_features: PaidFeatures = FieldInfo(alias="paidFeatures") """ An object of arrays which contains information about paid features available for the requested account. """ - phone: Optional[str] = None - """Phone of a user who registered the requested account.""" - - service_statuses: Optional[ServiceStatuses] = FieldInfo(alias="serviceStatuses", default=None) + service_statuses: ServiceStatuses = FieldInfo(alias="serviceStatuses") """ An object of arrays which contains information about all services available for the requested account. """ + status: Literal["new", "trial", "trialend", "active", "integration", "paused", "preparation", "ready"] + """Status of the account.""" + + country_code: Optional[str] = None + """System field. The company country (ISO 3166-1 alpha-2 format).""" + + custom_id: Optional[str] = None + """The account custom ID.""" + + phone: Optional[str] = None + """Phone of a user who registered the requested account.""" + signup_process: Optional[Literal["sign_up_full", "sign_up_simple"]] = None """System field. Type of the account registration process.""" - status: Optional[Literal["new", "trial", "trialend", "active", "integration", "paused", "preparation", "ready"]] = ( - None - ) - """Status of the account.""" - users: Optional[List[User]] = None """List of account users.""" diff --git a/src/gcore/types/iam/api_token.py b/src/gcore/types/iam/api_token.py index c896a522..0348d230 100644 --- a/src/gcore/types/iam/api_token.py +++ b/src/gcore/types/iam/api_token.py @@ -25,54 +25,54 @@ class ClientUserRole(BaseModel): class ClientUser(BaseModel): - client_id: Optional[int] = None + client_id: int """Account's ID.""" - deleted: Optional[bool] = None + deleted: bool """Deletion flag. If true, then the API token was deleted.""" - role: Optional[ClientUserRole] = None + role: ClientUserRole - user_email: Optional[str] = None + user_email: str """User's email who issued the API token.""" - user_id: Optional[int] = None + user_id: int """User's ID who issued the API token.""" - user_name: Optional[str] = None + user_name: str """User's name who issued the API token.""" class APIToken(BaseModel): - client_user: ClientUser - - exp_date: str - """ - Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If - null, then the API token will never expire. - """ - - name: str - """API token name.""" - - id: Optional[int] = None + id: int """API token ID.""" - created: Optional[str] = None + client_user: ClientUser + + created: str """Date when the API token was issued (ISO 8086/RFC 3339 format), UTC.""" - deleted: Optional[bool] = None + deleted: bool """Deletion flag. If true, then the API token was deleted.""" - description: Optional[str] = None - """API token description.""" + exp_date: Optional[str] = None + """ + Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If + null, then the API token will never expire. + """ - expired: Optional[bool] = None + expired: bool """Expiration flag. If true, then the API token has expired. When an API token expires it will be automatically deleted. """ - last_usage: Optional[str] = None + last_usage: str """Date when the API token was last used (ISO 8086/RFC 3339 format), UTC.""" + + name: str + """API token name.""" + + description: Optional[str] = None + """API token description.""" diff --git a/src/gcore/types/iam/api_token_create_params.py b/src/gcore/types/iam/api_token_create_params.py index dcb3f8f3..50d23678 100644 --- a/src/gcore/types/iam/api_token_create_params.py +++ b/src/gcore/types/iam/api_token_create_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["APITokenCreateParams", "ClientUser", "ClientUserRole"] @@ -11,7 +12,7 @@ class APITokenCreateParams(TypedDict, total=False): client_user: Required[ClientUser] """API token role.""" - exp_date: Required[str] + exp_date: Required[Optional[str]] """ Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If null, then the API token will never expire. diff --git a/src/gcore/types/iam/api_token_list.py b/src/gcore/types/iam/api_token_list.py index 7a68232a..2bf046b6 100644 --- a/src/gcore/types/iam/api_token_list.py +++ b/src/gcore/types/iam/api_token_list.py @@ -25,57 +25,57 @@ class APITokenListItemClientUserRole(BaseModel): class APITokenListItemClientUser(BaseModel): - client_id: Optional[int] = None + client_id: int """Account's ID.""" - deleted: Optional[bool] = None + deleted: bool """Deletion flag. If true, then the API token was deleted.""" - role: Optional[APITokenListItemClientUserRole] = None + role: APITokenListItemClientUserRole - user_email: Optional[str] = None + user_email: str """User's email who issued the API token.""" - user_id: Optional[int] = None + user_id: int """User's ID who issued the API token.""" - user_name: Optional[str] = None + user_name: str """User's name who issued the API token.""" class APITokenListItem(BaseModel): - client_user: APITokenListItemClientUser - - exp_date: str - """ - Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If - null, then the API token will never expire. - """ - - name: str - """API token name.""" - - id: Optional[int] = None + id: int """API token ID.""" - created: Optional[str] = None + client_user: APITokenListItemClientUser + + created: str """Date when the API token was issued (ISO 8086/RFC 3339 format), UTC.""" - deleted: Optional[bool] = None + deleted: bool """Deletion flag. If true, then the API token was deleted.""" - description: Optional[str] = None - """API token description.""" + exp_date: Optional[str] = None + """ + Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If + null, then the API token will never expire. + """ - expired: Optional[bool] = None + expired: bool """Expiration flag. If true, then the API token has expired. When an API token expires it will be automatically deleted. """ - last_usage: Optional[str] = None + last_usage: str """Date when the API token was last used (ISO 8086/RFC 3339 format), UTC.""" + name: str + """API token name.""" + + description: Optional[str] = None + """API token description.""" + APITokenList: TypeAlias = List[APITokenListItem] diff --git a/src/gcore/types/iam/user_detailed.py b/src/gcore/types/iam/user_detailed.py index 15a94926..976262c5 100644 --- a/src/gcore/types/iam/user_detailed.py +++ b/src/gcore/types/iam/user_detailed.py @@ -37,35 +37,35 @@ class Group(BaseModel): class UserDetailed(BaseModel): - id: Optional[int] = None + id: int """User's ID.""" - activated: Optional[bool] = None + activated: bool """Email confirmation: - `true` – user confirmed the email; - `false` – user did not confirm the email. """ - auth_types: Optional[List[Literal["password", "sso", "github", "google-oauth2"]]] = None + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] """System field. List of auth types available for the account.""" - client: Optional[float] = None + client: float """User's account ID.""" - client_and_roles: Optional[List[ClientAndRole]] = None + client_and_roles: List[ClientAndRole] """List of user's clients. User can access to one or more clients.""" - company: Optional[str] = None + company: str """User's company.""" - deleted: Optional[bool] = None + deleted: bool """Deletion flag. If `true` then user was deleted.""" - email: Optional[str] = None + email: str """User's email address.""" - groups: Optional[List[Group]] = None + groups: List[Group] """User's group in the current account. IAM supports 5 groups: @@ -77,10 +77,10 @@ class UserDetailed(BaseModel): - Purge and Prefetch only (API+Web) """ - is_active: Optional[bool] = None + is_active: bool """User activity flag.""" - lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None + lang: Literal["de", "en", "ru", "zh", "az"] """User's language. Defines language of the control panel and email messages. @@ -92,18 +92,18 @@ class UserDetailed(BaseModel): phone: Optional[str] = None """User's phone.""" - reseller: Optional[int] = None + reseller: int """Services provider ID.""" - sso_auth: Optional[bool] = None + sso_auth: bool """SSO authentication flag. If `true` then user can login via SAML SSO.""" - two_fa: Optional[bool] = None + two_fa: bool """Two-step verification: - `true` – user enabled two-step verification; - `false` – user disabled two-step verification. """ - user_type: Optional[Literal["common", "reseller", "seller"]] = None + user_type: Literal["common", "reseller", "seller"] """User's type.""" diff --git a/src/gcore/types/iam/user_invite.py b/src/gcore/types/iam/user_invite.py index 86eea011..2579f935 100644 --- a/src/gcore/types/iam/user_invite.py +++ b/src/gcore/types/iam/user_invite.py @@ -1,15 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional - from ..._models import BaseModel __all__ = ["UserInvite"] class UserInvite(BaseModel): - status: Optional[str] = None + status: str """Status of the invitation.""" - user_id: Optional[int] = None + user_id: int """Invited user ID.""" diff --git a/src/gcore/types/iam/user_update.py b/src/gcore/types/iam/user_update.py index 83b13534..b41dcd86 100644 --- a/src/gcore/types/iam/user_update.py +++ b/src/gcore/types/iam/user_update.py @@ -37,35 +37,35 @@ class Group(BaseModel): class UserUpdate(BaseModel): - id: Optional[int] = None + id: int """User's ID.""" - activated: Optional[bool] = None + activated: bool """Email confirmation: - `true` – user confirmed the email; - `false` – user did not confirm the email. """ - auth_types: Optional[List[Literal["password", "sso", "github", "google-oauth2"]]] = None + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] """System field. List of auth types available for the account.""" - client: Optional[float] = None + client: float """User's account ID.""" - client_and_roles: Optional[List[ClientAndRole]] = None + client_and_roles: List[ClientAndRole] """List of user's clients. User can access to one or more clients.""" - company: Optional[str] = None + company: str """User's company.""" - deleted: Optional[bool] = None + deleted: bool """Deletion flag. If `true` then user was deleted.""" - email: Optional[str] = None + email: str """User's email address.""" - groups: Optional[List[Group]] = None + groups: List[Group] """User's group in the current account. IAM supports 5 groups: @@ -77,10 +77,10 @@ class UserUpdate(BaseModel): - Purge and Prefetch only (API+Web) """ - is_active: Optional[bool] = None + is_active: bool """User activity flag.""" - lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None + lang: Literal["de", "en", "ru", "zh", "az"] """User's language. Defines language of the control panel and email messages. @@ -92,18 +92,18 @@ class UserUpdate(BaseModel): phone: Optional[str] = None """User's phone.""" - reseller: Optional[int] = None + reseller: int """Services provider ID.""" - sso_auth: Optional[bool] = None + sso_auth: bool """SSO authentication flag. If `true` then user can login via SAML SSO.""" - two_fa: Optional[bool] = None + two_fa: bool """Two-step verification: - `true` – user enabled two-step verification; - `false` – user disabled two-step verification. """ - user_type: Optional[Literal["common", "reseller", "seller"]] = None + user_type: Literal["common", "reseller", "seller"] """User's type.""" From 0e86557b0b423e675ce1d2dc6a8383b0bc3d46a8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Oct 2025 09:12:08 +0000 Subject: [PATCH 343/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index cd48d6f3..4526cc06 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-dafe18d92c83ef5bf5454ccc0c0d242b753f42c37f62542bfd7b614f5ad5d6f4.yml -openapi_spec_hash: fbe9b7c24144bd442b1294bf2e3ee79a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-16371b2072672e02560bd18864474603092dc447179c5f0314c2bd4a95eafc61.yml +openapi_spec_hash: 63d2f087caacfa7cd6a5844146acb860 config_hash: 11eb703eee66609eba76695b18f8cb4a From 0572179cc6c1896d127a95d4ce32642b18ac7b3e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Oct 2025 10:10:42 +0000 Subject: [PATCH 344/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cloud/quota_get_all_response.py | 16 ++++++++-------- .../types/cloud/quota_get_by_region_response.py | 16 ++++++++-------- .../types/cloud/quotas/request_create_params.py | 8 ++++---- .../types/cloud/quotas/request_get_response.py | 8 ++++---- .../types/cloud/quotas/request_list_response.py | 8 ++++---- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4526cc06..3b61b186 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-16371b2072672e02560bd18864474603092dc447179c5f0314c2bd4a95eafc61.yml -openapi_spec_hash: 63d2f087caacfa7cd6a5844146acb860 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0dfcd129932d83b47233f06cbfbeed49f1a645d1699a05d2cc5b0307060e4eb6.yml +openapi_spec_hash: c74de8fe8a4766402504ece5bd7e30bb config_hash: 11eb703eee66609eba76695b18f8cb4a diff --git a/src/gcore/types/cloud/quota_get_all_response.py b/src/gcore/types/cloud/quota_get_all_response.py index 7839b777..1778f75c 100644 --- a/src/gcore/types/cloud/quota_get_all_response.py +++ b/src/gcore/types/cloud/quota_get_all_response.py @@ -59,10 +59,10 @@ class RegionalQuota(BaseModel): """Basic bare metal servers count usage""" baremetal_gpu_a100_count_limit: Optional[int] = None - """Baremetal A100 GPU card count limit""" + """Bare metal A100 GPU server count limit""" baremetal_gpu_a100_count_usage: Optional[int] = None - """Baremetal A100 GPU card count usage""" + """Bare metal A100 GPU server count usage""" baremetal_gpu_count_limit: Optional[int] = None """Total number of AI GPU bare metal servers. @@ -81,22 +81,22 @@ class RegionalQuota(BaseModel): """ baremetal_gpu_h100_count_limit: Optional[int] = None - """Baremetal H100 GPU card count limit""" + """Bare metal H100 GPU server count limit""" baremetal_gpu_h100_count_usage: Optional[int] = None - """Baremetal H100 GPU card count usage""" + """Bare metal H100 GPU server count usage""" baremetal_gpu_h200_count_limit: Optional[int] = None - """Baremetal H200 GPU card count limit""" + """Bare metal H200 GPU server count limit""" baremetal_gpu_h200_count_usage: Optional[int] = None - """Baremetal H200 GPU card count usage""" + """Bare metal H200 GPU server count usage""" baremetal_gpu_l40s_count_limit: Optional[int] = None - """Baremetal L40S GPU card count limit""" + """Bare metal L40S GPU server count limit""" baremetal_gpu_l40s_count_usage: Optional[int] = None - """Baremetal L40S GPU card count usage""" + """Bare metal L40S GPU server count usage""" baremetal_hf_count_limit: Optional[int] = None """High-frequency bare metal servers count limit""" diff --git a/src/gcore/types/cloud/quota_get_by_region_response.py b/src/gcore/types/cloud/quota_get_by_region_response.py index c81b8e5d..aef7ba2b 100644 --- a/src/gcore/types/cloud/quota_get_by_region_response.py +++ b/src/gcore/types/cloud/quota_get_by_region_response.py @@ -15,10 +15,10 @@ class QuotaGetByRegionResponse(BaseModel): """Basic bare metal servers count usage""" baremetal_gpu_a100_count_limit: Optional[int] = None - """Baremetal A100 GPU card count limit""" + """Bare metal A100 GPU server count limit""" baremetal_gpu_a100_count_usage: Optional[int] = None - """Baremetal A100 GPU card count usage""" + """Bare metal A100 GPU server count usage""" baremetal_gpu_count_limit: Optional[int] = None """Total number of AI GPU bare metal servers. @@ -37,22 +37,22 @@ class QuotaGetByRegionResponse(BaseModel): """ baremetal_gpu_h100_count_limit: Optional[int] = None - """Baremetal H100 GPU card count limit""" + """Bare metal H100 GPU server count limit""" baremetal_gpu_h100_count_usage: Optional[int] = None - """Baremetal H100 GPU card count usage""" + """Bare metal H100 GPU server count usage""" baremetal_gpu_h200_count_limit: Optional[int] = None - """Baremetal H200 GPU card count limit""" + """Bare metal H200 GPU server count limit""" baremetal_gpu_h200_count_usage: Optional[int] = None - """Baremetal H200 GPU card count usage""" + """Bare metal H200 GPU server count usage""" baremetal_gpu_l40s_count_limit: Optional[int] = None - """Baremetal L40S GPU card count limit""" + """Bare metal L40S GPU server count limit""" baremetal_gpu_l40s_count_usage: Optional[int] = None - """Baremetal L40S GPU card count usage""" + """Bare metal L40S GPU server count usage""" baremetal_hf_count_limit: Optional[int] = None """High-frequency bare metal servers 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 09490a25..282e29ad 100644 --- a/src/gcore/types/cloud/quotas/request_create_params.py +++ b/src/gcore/types/cloud/quotas/request_create_params.py @@ -47,7 +47,7 @@ class RequestedLimitsRegionalLimit(TypedDict, total=False): """Basic bare metal servers count limit""" baremetal_gpu_a100_count_limit: int - """Baremetal A100 GPU card count limit""" + """Bare metal A100 GPU server count limit""" baremetal_gpu_count_limit: int """Total number of AI GPU bare metal servers. @@ -58,13 +58,13 @@ class RequestedLimitsRegionalLimit(TypedDict, total=False): """ baremetal_gpu_h100_count_limit: int - """Baremetal H100 GPU card count limit""" + """Bare metal H100 GPU server count limit""" baremetal_gpu_h200_count_limit: int - """Baremetal H200 GPU card count limit""" + """Bare metal H200 GPU server count limit""" baremetal_gpu_l40s_count_limit: int - """Baremetal L40S GPU card count limit""" + """Bare metal L40S GPU server count limit""" baremetal_hf_count_limit: int """High-frequency bare metal servers count limit""" diff --git a/src/gcore/types/cloud/quotas/request_get_response.py b/src/gcore/types/cloud/quotas/request_get_response.py index 17301847..3ac8bc47 100644 --- a/src/gcore/types/cloud/quotas/request_get_response.py +++ b/src/gcore/types/cloud/quotas/request_get_response.py @@ -36,7 +36,7 @@ class RequestedLimitsRegionalLimit(BaseModel): """Basic bare metal servers count limit""" baremetal_gpu_a100_count_limit: Optional[int] = None - """Baremetal A100 GPU card count limit""" + """Bare metal A100 GPU server count limit""" baremetal_gpu_count_limit: Optional[int] = None """Total number of AI GPU bare metal servers. @@ -47,13 +47,13 @@ class RequestedLimitsRegionalLimit(BaseModel): """ baremetal_gpu_h100_count_limit: Optional[int] = None - """Baremetal H100 GPU card count limit""" + """Bare metal H100 GPU server count limit""" baremetal_gpu_h200_count_limit: Optional[int] = None - """Baremetal H200 GPU card count limit""" + """Bare metal H200 GPU server count limit""" baremetal_gpu_l40s_count_limit: Optional[int] = None - """Baremetal L40S GPU card count limit""" + """Bare metal L40S GPU server count limit""" baremetal_hf_count_limit: Optional[int] = None """High-frequency bare metal servers count limit""" diff --git a/src/gcore/types/cloud/quotas/request_list_response.py b/src/gcore/types/cloud/quotas/request_list_response.py index e69e988c..971dce9b 100644 --- a/src/gcore/types/cloud/quotas/request_list_response.py +++ b/src/gcore/types/cloud/quotas/request_list_response.py @@ -36,7 +36,7 @@ class RequestedLimitsRegionalLimit(BaseModel): """Basic bare metal servers count limit""" baremetal_gpu_a100_count_limit: Optional[int] = None - """Baremetal A100 GPU card count limit""" + """Bare metal A100 GPU server count limit""" baremetal_gpu_count_limit: Optional[int] = None """Total number of AI GPU bare metal servers. @@ -47,13 +47,13 @@ class RequestedLimitsRegionalLimit(BaseModel): """ baremetal_gpu_h100_count_limit: Optional[int] = None - """Baremetal H100 GPU card count limit""" + """Bare metal H100 GPU server count limit""" baremetal_gpu_h200_count_limit: Optional[int] = None - """Baremetal H200 GPU card count limit""" + """Bare metal H200 GPU server count limit""" baremetal_gpu_l40s_count_limit: Optional[int] = None - """Baremetal L40S GPU card count limit""" + """Bare metal L40S GPU server count limit""" baremetal_hf_count_limit: Optional[int] = None """High-frequency bare metal servers count limit""" From 85035e4277d56613280316bcb1a78267810cbb42 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Oct 2025 12:28:19 +0000 Subject: [PATCH 345/592] feat(api): Add missing reserved_fixed_ips update method --- .stats.yml | 2 +- api.md | 1 + .../reserved_fixed_ips/reserved_fixed_ips.py | 111 +++++++++++++++++- src/gcore/types/cloud/__init__.py | 1 + .../cloud/reserved_fixed_ip_update_params.py | 16 +++ .../cloud/test_reserved_fixed_ips.py | 100 ++++++++++++++++ 6 files changed, 229 insertions(+), 2 deletions(-) create mode 100644 src/gcore/types/cloud/reserved_fixed_ip_update_params.py diff --git a/.stats.yml b/.stats.yml index 3b61b186..aa4a30c2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0dfcd129932d83b47233f06cbfbeed49f1a645d1699a05d2cc5b0307060e4eb6.yml openapi_spec_hash: c74de8fe8a4766402504ece5bd7e30bb -config_hash: 11eb703eee66609eba76695b18f8cb4a +config_hash: e660d386571b7b7f97e632d15f98719f diff --git a/api.md b/api.md index 32fe29dc..86601a2c 100644 --- a/api.md +++ b/api.md @@ -301,6 +301,7 @@ from gcore.types.cloud import ReservedFixedIP Methods: - client.cloud.reserved_fixed_ips.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.reserved_fixed_ips.update(port_id, \*, project_id, region_id, \*\*params) -> ReservedFixedIP - client.cloud.reserved_fixed_ips.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[ReservedFixedIP] - client.cloud.reserved_fixed_ips.delete(port_id, \*, project_id, region_id) -> TaskIDList - client.cloud.reserved_fixed_ips.get(port_id, \*, project_id, region_id) -> ReservedFixedIP diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index 0d1b246c..44d071e6 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -26,7 +26,12 @@ async_to_streamed_response_wrapper, ) from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.cloud import InterfaceIPFamily, reserved_fixed_ip_list_params, reserved_fixed_ip_create_params +from ....types.cloud import ( + InterfaceIPFamily, + reserved_fixed_ip_list_params, + reserved_fixed_ip_create_params, + reserved_fixed_ip_update_params, +) from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.reserved_fixed_ip import ReservedFixedIP @@ -295,6 +300,51 @@ def create( cast_to=TaskIDList, ) + def update( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + is_vip: bool, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ReservedFixedIP: + """ + Update the VIP status of a reserved fixed IP. + + Args: + is_vip: If reserved fixed IP should be a VIP + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return self._patch( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + body=maybe_transform({"is_vip": is_vip}, reserved_fixed_ip_update_params.ReservedFixedIPUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ReservedFixedIP, + ) + def list( self, *, @@ -724,6 +774,53 @@ async def create( cast_to=TaskIDList, ) + async def update( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + is_vip: bool, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ReservedFixedIP: + """ + Update the VIP status of a reserved fixed IP. + + Args: + is_vip: If reserved fixed IP should be a VIP + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return await self._patch( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + body=await async_maybe_transform( + {"is_vip": is_vip}, reserved_fixed_ip_update_params.ReservedFixedIPUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ReservedFixedIP, + ) + def list( self, *, @@ -900,6 +997,9 @@ def __init__(self, reserved_fixed_ips: ReservedFixedIPsResource) -> None: self.create = to_raw_response_wrapper( reserved_fixed_ips.create, ) + self.update = to_raw_response_wrapper( + reserved_fixed_ips.update, + ) self.list = to_raw_response_wrapper( reserved_fixed_ips.list, ) @@ -922,6 +1022,9 @@ def __init__(self, reserved_fixed_ips: AsyncReservedFixedIPsResource) -> None: self.create = async_to_raw_response_wrapper( reserved_fixed_ips.create, ) + self.update = async_to_raw_response_wrapper( + reserved_fixed_ips.update, + ) self.list = async_to_raw_response_wrapper( reserved_fixed_ips.list, ) @@ -944,6 +1047,9 @@ def __init__(self, reserved_fixed_ips: ReservedFixedIPsResource) -> None: self.create = to_streamed_response_wrapper( reserved_fixed_ips.create, ) + self.update = to_streamed_response_wrapper( + reserved_fixed_ips.update, + ) self.list = to_streamed_response_wrapper( reserved_fixed_ips.list, ) @@ -966,6 +1072,9 @@ def __init__(self, reserved_fixed_ips: AsyncReservedFixedIPsResource) -> None: self.create = async_to_streamed_response_wrapper( reserved_fixed_ips.create, ) + self.update = async_to_streamed_response_wrapper( + reserved_fixed_ips.update, + ) self.list = async_to_streamed_response_wrapper( reserved_fixed_ips.list, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 852d56df..96c25d07 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -160,6 +160,7 @@ from .billing_reservation_list_params import BillingReservationListParams as BillingReservationListParams from .cost_report_get_detailed_params import CostReportGetDetailedParams as CostReportGetDetailedParams from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams +from .reserved_fixed_ip_update_params import ReservedFixedIPUpdateParams as ReservedFixedIPUpdateParams from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams from .cost_report_get_aggregated_params import CostReportGetAggregatedParams as CostReportGetAggregatedParams from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams diff --git a/src/gcore/types/cloud/reserved_fixed_ip_update_params.py b/src/gcore/types/cloud/reserved_fixed_ip_update_params.py new file mode 100644 index 00000000..9d2bbb2d --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ip_update_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ReservedFixedIPUpdateParams"] + + +class ReservedFixedIPUpdateParams(TypedDict, total=False): + project_id: int + + region_id: int + + is_vip: Required[bool] + """If reserved fixed IP should be a VIP""" diff --git a/tests/api_resources/cloud/test_reserved_fixed_ips.py b/tests/api_resources/cloud/test_reserved_fixed_ips.py index 3f321ace..21a89074 100644 --- a/tests/api_resources/cloud/test_reserved_fixed_ips.py +++ b/tests/api_resources/cloud/test_reserved_fixed_ips.py @@ -267,6 +267,56 @@ def test_streaming_response_create_overload_5(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_update(self, client: Gcore) -> None: + reserved_fixed_ip = client.cloud.reserved_fixed_ips.update( + port_id="port_id", + project_id=0, + region_id=0, + is_vip=True, + ) + assert_matches_type(ReservedFixedIP, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.with_raw_response.update( + port_id="port_id", + project_id=0, + region_id=0, + is_vip=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = response.parse() + assert_matches_type(ReservedFixedIP, reserved_fixed_ip, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.with_streaming_response.update( + port_id="port_id", + project_id=0, + region_id=0, + is_vip=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = response.parse() + assert_matches_type(ReservedFixedIP, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.reserved_fixed_ips.with_raw_response.update( + port_id="", + project_id=0, + region_id=0, + is_vip=True, + ) + @parametrize def test_method_list(self, client: Gcore) -> None: reserved_fixed_ip = client.cloud.reserved_fixed_ips.list( @@ -662,6 +712,56 @@ async def test_streaming_response_create_overload_5(self, async_client: AsyncGco assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.update( + port_id="port_id", + project_id=0, + region_id=0, + is_vip=True, + ) + assert_matches_type(ReservedFixedIP, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.with_raw_response.update( + port_id="port_id", + project_id=0, + region_id=0, + is_vip=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reserved_fixed_ip = await response.parse() + assert_matches_type(ReservedFixedIP, reserved_fixed_ip, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.with_streaming_response.update( + port_id="port_id", + project_id=0, + region_id=0, + is_vip=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reserved_fixed_ip = await response.parse() + assert_matches_type(ReservedFixedIP, reserved_fixed_ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.reserved_fixed_ips.with_raw_response.update( + port_id="", + project_id=0, + region_id=0, + is_vip=True, + ) + @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: reserved_fixed_ip = await async_client.cloud.reserved_fixed_ips.list( From 8c3a728f707ab4ae1520d51eec7d3cd981cf3f92 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Oct 2025 14:10:29 +0000 Subject: [PATCH 346/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index aa4a30c2..d690e547 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0dfcd129932d83b47233f06cbfbeed49f1a645d1699a05d2cc5b0307060e4eb6.yml -openapi_spec_hash: c74de8fe8a4766402504ece5bd7e30bb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0c766e6ecf7e97b4bad1f4ee664a81ab3f3c76e655993623084f9cf9517097cd.yml +openapi_spec_hash: 1a1ec9ecc3cdf29e91d4dd75570af164 config_hash: e660d386571b7b7f97e632d15f98719f From 72b35619a42e1fae7e78f7ef5df88de8e7df174d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Oct 2025 07:48:06 +0000 Subject: [PATCH 347/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a26ebfc1..8f3e0a49 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.14.0" + ".": "0.15.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 7f06d8fc..f2b1d19f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.14.0" +version = "0.15.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 426ebfb3..0bfdd66b 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.14.0" # x-release-please-version +__version__ = "0.15.0" # x-release-please-version From 0f47bb25f3e0bcc9b45e78cfd46150bdfed163ac Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Oct 2025 08:38:12 +0000 Subject: [PATCH 348/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index d690e547..338dc952 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0c766e6ecf7e97b4bad1f4ee664a81ab3f3c76e655993623084f9cf9517097cd.yml openapi_spec_hash: 1a1ec9ecc3cdf29e91d4dd75570af164 -config_hash: e660d386571b7b7f97e632d15f98719f +config_hash: 399dda838c78c5d92532b7efcaaa0345 From 52de02002916832602ae1c0016e4cc88255485ae Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Oct 2025 16:11:17 +0000 Subject: [PATCH 349/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 338dc952..de1acd46 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0c766e6ecf7e97b4bad1f4ee664a81ab3f3c76e655993623084f9cf9517097cd.yml -openapi_spec_hash: 1a1ec9ecc3cdf29e91d4dd75570af164 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c9b7984d78ad4599fbfda87055912f937e234a8db4463c8c6aa7023662c7a280.yml +openapi_spec_hash: 0be98adf8c9c2ad45390fc965c4e4f17 config_hash: 399dda838c78c5d92532b7efcaaa0345 From 1bd1ab46667a3ced1dca2a9bc1377a8d15fbaf35 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Oct 2025 18:12:39 +0000 Subject: [PATCH 350/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index de1acd46..3841261a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c9b7984d78ad4599fbfda87055912f937e234a8db4463c8c6aa7023662c7a280.yml -openapi_spec_hash: 0be98adf8c9c2ad45390fc965c4e4f17 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2e22746e28cb0e7e02f3d050b6df3be6966f53cfd8501b504c66ea635ffed487.yml +openapi_spec_hash: bbc0673615cc3ed39ab62932c9406848 config_hash: 399dda838c78c5d92532b7efcaaa0345 From 9a886ceb793a2eb19d8c568ef2d0720bf23ea093 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 4 Oct 2025 08:11:20 +0000 Subject: [PATCH 351/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3841261a..fded566f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2e22746e28cb0e7e02f3d050b6df3be6966f53cfd8501b504c66ea635ffed487.yml -openapi_spec_hash: bbc0673615cc3ed39ab62932c9406848 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-940761106582fbda3f1fc709e3e7f6cfaee308f45fb6fe8a1529c5571c5e06e1.yml +openapi_spec_hash: 850248fd937d6ac4eb4017b570da7446 config_hash: 399dda838c78c5d92532b7efcaaa0345 From 6899c1045d5c9b6f1309c531de42d03a94528d75 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 4 Oct 2025 12:13:50 +0000 Subject: [PATCH 352/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index fded566f..8356373a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-940761106582fbda3f1fc709e3e7f6cfaee308f45fb6fe8a1529c5571c5e06e1.yml -openapi_spec_hash: 850248fd937d6ac4eb4017b570da7446 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-86e7b639591decc4bdeef6bec058e750ac5c8afefea4c383a53d853fb60412f0.yml +openapi_spec_hash: b5d1e86bd11c6137ece128c96e1fe125 config_hash: 399dda838c78c5d92532b7efcaaa0345 From 48e2e802b95851b014976743eac286094129a577 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 5 Oct 2025 06:12:10 +0000 Subject: [PATCH 353/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8356373a..3eb0ba44 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-86e7b639591decc4bdeef6bec058e750ac5c8afefea4c383a53d853fb60412f0.yml -openapi_spec_hash: b5d1e86bd11c6137ece128c96e1fe125 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-26735f8194ab02771e7175495b584d0f18ee300f28e08ab29a80f86b3ff23c15.yml +openapi_spec_hash: 3c1f9758d286f95709cb1c40bc6c4dc2 config_hash: 399dda838c78c5d92532b7efcaaa0345 From aaa16fc5a644708913d1e14a630dace259ca06fb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 5 Oct 2025 08:11:10 +0000 Subject: [PATCH 354/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3eb0ba44..39a75be7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-26735f8194ab02771e7175495b584d0f18ee300f28e08ab29a80f86b3ff23c15.yml -openapi_spec_hash: 3c1f9758d286f95709cb1c40bc6c4dc2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-06897786d30f23263f01d0528289fbbef0360413a60b1b1d19318f1bdbcb33ae.yml +openapi_spec_hash: aaec1260698ff557bf644c1771178282 config_hash: 399dda838c78c5d92532b7efcaaa0345 From 0fe0f917e97e125cc559560efedb2f49b2f5fc81 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 5 Oct 2025 12:13:35 +0000 Subject: [PATCH 355/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 39a75be7..fee4016c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-06897786d30f23263f01d0528289fbbef0360413a60b1b1d19318f1bdbcb33ae.yml -openapi_spec_hash: aaec1260698ff557bf644c1771178282 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-33a8162d42e72250da01c56166d9153a4ad4392d03c6b3687d78ffa26e3aefb1.yml +openapi_spec_hash: 12d84581238923977f42a1d76b8a6296 config_hash: 399dda838c78c5d92532b7efcaaa0345 From 54b55906f5c457eec64d01ca38fa43aca789d484 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 5 Oct 2025 16:10:07 +0000 Subject: [PATCH 356/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index fee4016c..4072aabe 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-33a8162d42e72250da01c56166d9153a4ad4392d03c6b3687d78ffa26e3aefb1.yml -openapi_spec_hash: 12d84581238923977f42a1d76b8a6296 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-734f9dcd472890369cd87bea9ef232d22a24c0cd3034f340504015e436367190.yml +openapi_spec_hash: e7f6ab41615673c45d6adb3936b20611 config_hash: 399dda838c78c5d92532b7efcaaa0345 From a5391b2fd8f075fae6ecc2de366cd10b73fda2fe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Oct 2025 08:12:53 +0000 Subject: [PATCH 357/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4072aabe..43b5aab5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-734f9dcd472890369cd87bea9ef232d22a24c0cd3034f340504015e436367190.yml -openapi_spec_hash: e7f6ab41615673c45d6adb3936b20611 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-766962d8bf15f6a5e5ff09bbe313b1a18e79f1db04aadeeffb47733ec844082b.yml +openapi_spec_hash: 470d7b26ee2e2dd6f79d4b3bf73f598c config_hash: 399dda838c78c5d92532b7efcaaa0345 From 2af566bd5587d6c1026846be195f020d293848dd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Oct 2025 08:54:55 +0000 Subject: [PATCH 358/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 43b5aab5..a2bcdaae 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-766962d8bf15f6a5e5ff09bbe313b1a18e79f1db04aadeeffb47733ec844082b.yml -openapi_spec_hash: 470d7b26ee2e2dd6f79d4b3bf73f598c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-13bd5c49d79b761f75f39c52b2913b634772f4548854c7ea7fabd8edc9004437.yml +openapi_spec_hash: 60578a4e7dbad87ddf1c7601f341037f config_hash: 399dda838c78c5d92532b7efcaaa0345 From 3d8e59def7b2359ba97fb2dc24ef86d206127d1c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Oct 2025 09:32:03 +0000 Subject: [PATCH 359/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a2bcdaae..6d907b1f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-13bd5c49d79b761f75f39c52b2913b634772f4548854c7ea7fabd8edc9004437.yml -openapi_spec_hash: 60578a4e7dbad87ddf1c7601f341037f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-70c64c5e903dc3750a97f27c301e4ad16af9588b46592707c02765f9043c3c51.yml +openapi_spec_hash: 83c6750d9e652bc18366e53d331d97cf config_hash: 399dda838c78c5d92532b7efcaaa0345 From f171984a6cdcb1ed1657aa084bfa9de4a5768d82 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Oct 2025 10:11:46 +0000 Subject: [PATCH 360/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6d907b1f..202ad72a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-70c64c5e903dc3750a97f27c301e4ad16af9588b46592707c02765f9043c3c51.yml -openapi_spec_hash: 83c6750d9e652bc18366e53d331d97cf +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-22bbef253f2956b3c6b7b4b809fa8b89dba489b8af41b29d43a2aec20b783ec1.yml +openapi_spec_hash: 39ed3f8ee69486683f458fc9bf7672d1 config_hash: 399dda838c78c5d92532b7efcaaa0345 From 41ecbd475dc04018fb00ca2e670599da584a2fb6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Oct 2025 13:11:34 +0000 Subject: [PATCH 361/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cloud/billing_reservations.py | 53 ++++-- .../resources/cloud/instances/instances.py | 6 +- src/gcore/types/cloud/instance_list_params.py | 2 +- .../cloud/test_billing_reservations.py | 160 ++++++++++-------- 5 files changed, 135 insertions(+), 90 deletions(-) diff --git a/.stats.yml b/.stats.yml index 202ad72a..f64973ad 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-22bbef253f2956b3c6b7b4b809fa8b89dba489b8af41b29d43a2aec20b783ec1.yml -openapi_spec_hash: 39ed3f8ee69486683f458fc9bf7672d1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9d544c0c6403897f31c25f5630228b123f6542f9ac7deee6ef2bade239c637c2.yml +openapi_spec_hash: 504c8bea0ced4e280b59f75422f29764 config_hash: 399dda838c78c5d92532b7efcaaa0345 diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index ed15046f..5a2dd6b5 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import List, Union from datetime import date, datetime from typing_extensions import Literal @@ -46,6 +47,7 @@ def with_streaming_response(self) -> BillingReservationsResourceWithStreamingRes """ return BillingReservationsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def list( self, *, @@ -150,6 +152,7 @@ def list( model=BillingReservation, ) + @typing_extensions.deprecated("deprecated") def get( self, reservation_id: int, @@ -206,6 +209,7 @@ def with_streaming_response(self) -> AsyncBillingReservationsResourceWithStreami """ return AsyncBillingReservationsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def list( self, *, @@ -310,6 +314,7 @@ def list( model=BillingReservation, ) + @typing_extensions.deprecated("deprecated") async def get( self, reservation_id: int, @@ -350,11 +355,15 @@ class BillingReservationsResourceWithRawResponse: def __init__(self, billing_reservations: BillingReservationsResource) -> None: self._billing_reservations = billing_reservations - self.list = to_raw_response_wrapper( - billing_reservations.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + billing_reservations.list, # pyright: ignore[reportDeprecated], + ) ) - self.get = to_raw_response_wrapper( - billing_reservations.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + billing_reservations.get, # pyright: ignore[reportDeprecated], + ) ) @@ -362,11 +371,15 @@ class AsyncBillingReservationsResourceWithRawResponse: def __init__(self, billing_reservations: AsyncBillingReservationsResource) -> None: self._billing_reservations = billing_reservations - self.list = async_to_raw_response_wrapper( - billing_reservations.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + billing_reservations.list, # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_raw_response_wrapper( - billing_reservations.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + billing_reservations.get, # pyright: ignore[reportDeprecated], + ) ) @@ -374,11 +387,15 @@ class BillingReservationsResourceWithStreamingResponse: def __init__(self, billing_reservations: BillingReservationsResource) -> None: self._billing_reservations = billing_reservations - self.list = to_streamed_response_wrapper( - billing_reservations.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + billing_reservations.list, # pyright: ignore[reportDeprecated], + ) ) - self.get = to_streamed_response_wrapper( - billing_reservations.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + billing_reservations.get, # pyright: ignore[reportDeprecated], + ) ) @@ -386,9 +403,13 @@ class AsyncBillingReservationsResourceWithStreamingResponse: def __init__(self, billing_reservations: AsyncBillingReservationsResource) -> None: self._billing_reservations = billing_reservations - self.list = async_to_streamed_response_wrapper( - billing_reservations.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + billing_reservations.list, # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_streamed_response_wrapper( - billing_reservations.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + billing_reservations.get, # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 7421c6da..31942533 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -335,7 +335,8 @@ def list( offset: int | Omit = omit, only_isolated: bool | Omit = omit, only_with_fixed_external_ip: bool | Omit = omit, - order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | Omit = omit, + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] + | Omit = omit, profile_name: str | Omit = omit, protection_status: Literal["Active", "Queued", "Error"] | Omit = omit, status: Literal[ @@ -1386,7 +1387,8 @@ def list( offset: int | Omit = omit, only_isolated: bool | Omit = omit, only_with_fixed_external_ip: bool | Omit = omit, - order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | Omit = omit, + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] + | Omit = omit, profile_name: str | Omit = omit, protection_status: Literal["Active", "Queued", "Error"] | Omit = omit, status: Literal[ diff --git a/src/gcore/types/cloud/instance_list_params.py b/src/gcore/types/cloud/instance_list_params.py index 17c76f8f..1d321ffc 100644 --- a/src/gcore/types/cloud/instance_list_params.py +++ b/src/gcore/types/cloud/instance_list_params.py @@ -82,7 +82,7 @@ class InstanceListParams(TypedDict, total=False): only_with_fixed_external_ip: bool """Return bare metals only with external fixed IP addresses.""" - order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] """Order by field and direction.""" profile_name: str diff --git a/tests/api_resources/cloud/test_billing_reservations.py b/tests/api_resources/cloud/test_billing_reservations.py index 9053b82d..64ab5b9a 100644 --- a/tests/api_resources/cloud/test_billing_reservations.py +++ b/tests/api_resources/cloud/test_billing_reservations.py @@ -13,6 +13,8 @@ from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud import BillingReservation +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,30 +23,35 @@ class TestBillingReservations: @parametrize def test_method_list(self, client: Gcore) -> None: - billing_reservation = client.cloud.billing_reservations.list() + with pytest.warns(DeprecationWarning): + billing_reservation = client.cloud.billing_reservations.list() + assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - billing_reservation = client.cloud.billing_reservations.list( - activated_from=parse_date("2019-12-27"), - activated_to=parse_date("2019-12-27"), - created_from=parse_datetime("2019-12-27T18:11:19.117Z"), - created_to=parse_datetime("2019-12-27T18:11:19.117Z"), - deactivated_from=parse_date("2019-12-27"), - deactivated_to=parse_date("2019-12-27"), - limit=1, - metric_name="metric_name", - offset=0, - order_by="active_from.asc", - region_id=0, - status=["ACTIVATED"], - ) + with pytest.warns(DeprecationWarning): + billing_reservation = client.cloud.billing_reservations.list( + activated_from=parse_date("2019-12-27"), + activated_to=parse_date("2019-12-27"), + created_from=parse_datetime("2019-12-27T18:11:19.117Z"), + created_to=parse_datetime("2019-12-27T18:11:19.117Z"), + deactivated_from=parse_date("2019-12-27"), + deactivated_to=parse_date("2019-12-27"), + limit=1, + metric_name="metric_name", + offset=0, + order_by="active_from.asc", + region_id=0, + status=["ACTIVATED"], + ) + assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.billing_reservations.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = client.cloud.billing_reservations.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -53,27 +60,31 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.billing_reservations.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.billing_reservations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - billing_reservation = response.parse() - assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + billing_reservation = response.parse() + assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_get(self, client: Gcore) -> None: - billing_reservation = client.cloud.billing_reservations.get( - 0, - ) + with pytest.warns(DeprecationWarning): + billing_reservation = client.cloud.billing_reservations.get( + 0, + ) + assert_matches_type(BillingReservation, billing_reservation, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.billing_reservations.with_raw_response.get( - 0, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.billing_reservations.with_raw_response.get( + 0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -82,14 +93,15 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.billing_reservations.with_streaming_response.get( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.billing_reservations.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - billing_reservation = response.parse() - assert_matches_type(BillingReservation, billing_reservation, path=["response"]) + billing_reservation = response.parse() + assert_matches_type(BillingReservation, billing_reservation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -101,30 +113,35 @@ class TestAsyncBillingReservations: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - billing_reservation = await async_client.cloud.billing_reservations.list() + with pytest.warns(DeprecationWarning): + billing_reservation = await async_client.cloud.billing_reservations.list() + assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - billing_reservation = await async_client.cloud.billing_reservations.list( - activated_from=parse_date("2019-12-27"), - activated_to=parse_date("2019-12-27"), - created_from=parse_datetime("2019-12-27T18:11:19.117Z"), - created_to=parse_datetime("2019-12-27T18:11:19.117Z"), - deactivated_from=parse_date("2019-12-27"), - deactivated_to=parse_date("2019-12-27"), - limit=1, - metric_name="metric_name", - offset=0, - order_by="active_from.asc", - region_id=0, - status=["ACTIVATED"], - ) + with pytest.warns(DeprecationWarning): + billing_reservation = await async_client.cloud.billing_reservations.list( + activated_from=parse_date("2019-12-27"), + activated_to=parse_date("2019-12-27"), + created_from=parse_datetime("2019-12-27T18:11:19.117Z"), + created_to=parse_datetime("2019-12-27T18:11:19.117Z"), + deactivated_from=parse_date("2019-12-27"), + deactivated_to=parse_date("2019-12-27"), + limit=1, + metric_name="metric_name", + offset=0, + order_by="active_from.asc", + region_id=0, + status=["ACTIVATED"], + ) + assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.billing_reservations.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.billing_reservations.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -133,27 +150,31 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.billing_reservations.with_streaming_response.list() 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.billing_reservations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - billing_reservation = await response.parse() - assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + billing_reservation = await response.parse() + assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - billing_reservation = await async_client.cloud.billing_reservations.get( - 0, - ) + with pytest.warns(DeprecationWarning): + billing_reservation = await async_client.cloud.billing_reservations.get( + 0, + ) + assert_matches_type(BillingReservation, billing_reservation, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.billing_reservations.with_raw_response.get( - 0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.billing_reservations.with_raw_response.get( + 0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -162,13 +183,14 @@ 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.billing_reservations.with_streaming_response.get( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - billing_reservation = await response.parse() - assert_matches_type(BillingReservation, billing_reservation, path=["response"]) + with pytest.warns(DeprecationWarning): + async with async_client.cloud.billing_reservations.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + billing_reservation = await response.parse() + assert_matches_type(BillingReservation, billing_reservation, path=["response"]) assert cast(Any, response.is_closed) is True From 5670ba3f8765fe00ddca6b44778ecd799348572b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 7 Oct 2025 12:15:51 +0000 Subject: [PATCH 362/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/_client.py | 10 +- src/gcore/resources/cdn/audit_log.py | 16 +- src/gcore/resources/cdn/cdn.py | 28 +-- src/gcore/resources/cdn/certificates.py | 56 ++---- src/gcore/resources/cdn/ip_ranges.py | 12 +- src/gcore/resources/cdn/logs/logs.py | 16 +- src/gcore/resources/cdn/logs/settings.py | 32 +-- .../resources/cdn/logs_uploader/configs.py | 56 ++---- .../resources/cdn/logs_uploader/policies.py | 56 ++---- .../resources/cdn/logs_uploader/targets.py | 56 ++---- src/gcore/resources/cdn/metrics.py | 8 +- src/gcore/resources/cdn/network_capacity.py | 8 +- src/gcore/resources/cdn/origin_groups.py | 44 ++--- .../resources/cdn/resources/resources.py | 64 ++---- src/gcore/resources/cdn/resources/rules.py | 48 ++--- src/gcore/resources/cdn/resources/shield.py | 16 +- src/gcore/resources/cdn/rule_templates.py | 48 ++--- src/gcore/resources/cdn/shields.py | 8 +- src/gcore/resources/cdn/statistics.py | 48 ++--- .../resources/cdn/trusted_ca_certificates.py | 40 +--- src/gcore/resources/cloud/audit_logs.py | 8 +- .../resources/cloud/baremetal/flavors.py | 8 +- src/gcore/resources/cloud/baremetal/images.py | 8 +- .../resources/cloud/baremetal/servers.py | 24 +-- .../resources/cloud/billing_reservations.py | 16 +- src/gcore/resources/cloud/cost_reports.py | 24 +-- .../cloud/file_shares/access_rules.py | 24 +-- .../cloud/file_shares/file_shares.py | 48 ++--- src/gcore/resources/cloud/floating_ips.py | 56 ++---- .../cloud/gpu_baremetal_clusters/flavors.py | 8 +- .../gpu_baremetal_clusters.py | 72 ++----- .../cloud/gpu_baremetal_clusters/images.py | 32 +-- .../gpu_baremetal_clusters/interfaces.py | 8 +- .../cloud/gpu_baremetal_clusters/servers.py | 56 ++---- .../resources/cloud/inference/api_keys.py | 40 +--- .../inference/applications/deployments.py | 40 +--- .../cloud/inference/applications/templates.py | 16 +- .../inference/deployments/deployments.py | 64 ++---- .../cloud/inference/deployments/logs.py | 8 +- .../resources/cloud/inference/flavors.py | 16 +- .../resources/cloud/inference/inference.py | 8 +- .../cloud/inference/registry_credentials.py | 40 +--- .../resources/cloud/inference/secrets.py | 40 +--- .../resources/cloud/instances/flavors.py | 8 +- src/gcore/resources/cloud/instances/images.py | 48 ++--- .../resources/cloud/instances/instances.py | 112 +++-------- .../resources/cloud/instances/interfaces.py | 24 +-- .../resources/cloud/instances/metrics.py | 8 +- src/gcore/resources/cloud/ip_ranges.py | 8 +- .../resources/cloud/k8s/clusters/clusters.py | 72 ++----- .../resources/cloud/k8s/clusters/nodes.py | 16 +- .../cloud/k8s/clusters/pools/nodes.py | 16 +- .../cloud/k8s/clusters/pools/pools.py | 48 ++--- src/gcore/resources/cloud/k8s/flavors.py | 8 +- src/gcore/resources/cloud/k8s/k8s.py | 8 +- .../resources/cloud/load_balancers/flavors.py | 8 +- .../load_balancers/l7_policies/l7_policies.py | 40 +--- .../cloud/load_balancers/l7_policies/rules.py | 40 +--- .../cloud/load_balancers/listeners.py | 40 +--- .../cloud/load_balancers/load_balancers.py | 56 ++---- .../resources/cloud/load_balancers/metrics.py | 8 +- .../load_balancers/pools/health_monitors.py | 16 +- .../cloud/load_balancers/pools/members.py | 16 +- .../cloud/load_balancers/pools/pools.py | 40 +--- .../cloud/load_balancers/statuses.py | 16 +- .../resources/cloud/networks/networks.py | 40 +--- src/gcore/resources/cloud/networks/routers.py | 56 ++---- src/gcore/resources/cloud/networks/subnets.py | 40 +--- src/gcore/resources/cloud/placement_groups.py | 32 +-- src/gcore/resources/cloud/projects.py | 32 +-- src/gcore/resources/cloud/quotas/quotas.py | 24 +-- src/gcore/resources/cloud/quotas/requests.py | 32 +-- src/gcore/resources/cloud/regions.py | 12 +- .../resources/cloud/registries/artifacts.py | 16 +- .../resources/cloud/registries/registries.py | 40 +--- .../cloud/registries/repositories.py | 16 +- src/gcore/resources/cloud/registries/tags.py | 8 +- src/gcore/resources/cloud/registries/users.py | 48 ++--- .../reserved_fixed_ips/reserved_fixed_ips.py | 40 +--- .../resources/cloud/reserved_fixed_ips/vip.py | 40 +--- src/gcore/resources/cloud/secrets.py | 32 +-- .../resources/cloud/security_groups/rules.py | 24 +-- .../cloud/security_groups/security_groups.py | 56 ++---- src/gcore/resources/cloud/ssh_keys.py | 40 +--- src/gcore/resources/cloud/tasks.py | 28 +-- src/gcore/resources/cloud/usage_reports.py | 8 +- .../resources/cloud/users/role_assignments.py | 32 +-- src/gcore/resources/cloud/volumes.py | 80 ++------ src/gcore/resources/dns/dns.py | 12 +- src/gcore/resources/dns/locations.py | 28 +-- src/gcore/resources/dns/metrics.py | 8 +- src/gcore/resources/dns/pickers/pickers.py | 4 +- src/gcore/resources/dns/pickers/presets.py | 8 +- src/gcore/resources/dns/zones/dnssec.py | 16 +- src/gcore/resources/dns/zones/rrsets.py | 48 ++--- src/gcore/resources/dns/zones/zones.py | 80 +++----- src/gcore/resources/fastedge/apps/apps.py | 40 ++-- src/gcore/resources/fastedge/apps/logs.py | 8 +- src/gcore/resources/fastedge/binaries.py | 32 +-- src/gcore/resources/fastedge/fastedge.py | 4 +- src/gcore/resources/fastedge/kv_stores.py | 32 +-- src/gcore/resources/fastedge/secrets.py | 48 ++--- src/gcore/resources/fastedge/statistics.py | 16 +- src/gcore/resources/fastedge/templates.py | 40 +--- src/gcore/resources/iam/api_tokens.py | 32 +-- src/gcore/resources/iam/iam.py | 4 +- src/gcore/resources/iam/users.py | 36 +--- src/gcore/resources/security/bgp_announces.py | 16 +- src/gcore/resources/security/events.py | 8 +- .../resources/security/profile_templates.py | 8 +- src/gcore/resources/security/profiles.py | 48 ++--- .../resources/storage/buckets/buckets.py | 24 +-- src/gcore/resources/storage/buckets/cors.py | 16 +- .../resources/storage/buckets/lifecycle.py | 16 +- src/gcore/resources/storage/buckets/policy.py | 24 +-- src/gcore/resources/storage/credentials.py | 8 +- src/gcore/resources/storage/locations.py | 8 +- src/gcore/resources/storage/statistics.py | 16 +- src/gcore/resources/storage/storage.py | 64 ++---- src/gcore/resources/streaming/ai_tasks.py | 28 +-- src/gcore/resources/streaming/broadcasts.py | 48 ++--- src/gcore/resources/streaming/directories.py | 40 +--- src/gcore/resources/streaming/players.py | 40 ++-- src/gcore/resources/streaming/playlists.py | 48 ++--- src/gcore/resources/streaming/quality_sets.py | 16 +- src/gcore/resources/streaming/restreams.py | 40 +--- src/gcore/resources/streaming/statistics.py | 184 +++++------------- .../resources/streaming/streams/overlays.py | 48 ++--- .../resources/streaming/streams/streams.py | 72 ++----- .../resources/streaming/videos/subtitles.py | 40 +--- .../resources/streaming/videos/videos.py | 56 ++---- src/gcore/resources/waap/advanced_rules.py | 8 +- src/gcore/resources/waap/custom_page_sets.py | 48 ++--- .../resources/waap/domains/advanced_rules.py | 48 ++--- .../resources/waap/domains/api_discovery.py | 48 ++--- .../resources/waap/domains/api_path_groups.py | 8 +- src/gcore/resources/waap/domains/api_paths.py | 40 +--- .../resources/waap/domains/custom_rules.py | 56 ++---- src/gcore/resources/waap/domains/domains.py | 44 ++--- .../resources/waap/domains/firewall_rules.py | 56 ++---- .../waap/domains/insight_silences.py | 40 +--- src/gcore/resources/waap/domains/insights.py | 24 +-- src/gcore/resources/waap/domains/settings.py | 16 +- .../resources/waap/domains/statistics.py | 48 ++--- src/gcore/resources/waap/insights.py | 8 +- src/gcore/resources/waap/ip_info/ip_info.py | 64 ++---- src/gcore/resources/waap/ip_info/metrics.py | 8 +- src/gcore/resources/waap/organizations.py | 8 +- src/gcore/resources/waap/statistics.py | 8 +- src/gcore/resources/waap/tags.py | 4 +- src/gcore/resources/waap/waap.py | 4 +- 152 files changed, 1230 insertions(+), 3540 deletions(-) diff --git a/.stats.yml b/.stats.yml index f64973ad..dac0e15a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9d544c0c6403897f31c25f5630228b123f6542f9ac7deee6ef2bade239c637c2.yml -openapi_spec_hash: 504c8bea0ced4e280b59f75422f29764 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0783502211f81fa32d09abbc34b4678c3d8e7dc885194ad89102ca02bcdc0cc6.yml +openapi_spec_hash: aa485ffac6ffc8cb771ddb451a65a71b config_hash: 399dda838c78c5d92532b7efcaaa0345 diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 3aaf9b6f..4df8dcc0 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -115,7 +115,6 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") - self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -201,7 +200,7 @@ def copy( params = set_default_query http_client = http_client or self._client - client = self.__class__( + return self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -214,8 +213,6 @@ def copy( default_query=params, **_extra_kwargs, ) - client._base_url_overridden = self._base_url_overridden or base_url is not None - return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) @@ -347,7 +344,6 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") - self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -433,7 +429,7 @@ def copy( params = set_default_query http_client = http_client or self._client - client = self.__class__( + return self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -446,8 +442,6 @@ def copy( default_query=params, **_extra_kwargs, ) - client._base_url_overridden = self._base_url_overridden or base_url is not None - return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) diff --git a/src/gcore/resources/cdn/audit_log.py b/src/gcore/resources/cdn/audit_log.py index 1df531f5..f39a518f 100644 --- a/src/gcore/resources/cdn/audit_log.py +++ b/src/gcore/resources/cdn/audit_log.py @@ -125,9 +125,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cdn/activity_log/requests" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/activity_log/requests", + "/cdn/activity_log/requests", page=SyncOffsetPage[CdnAuditLogEntry], options=make_request_options( extra_headers=extra_headers, @@ -180,9 +178,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cdn/activity_log/requests/{log_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/activity_log/requests/{log_id}", + f"/cdn/activity_log/requests/{log_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -293,9 +289,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cdn/activity_log/requests" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/activity_log/requests", + "/cdn/activity_log/requests", page=AsyncOffsetPage[CdnAuditLogEntry], options=make_request_options( extra_headers=extra_headers, @@ -348,9 +342,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cdn/activity_log/requests/{log_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/activity_log/requests/{log_id}", + f"/cdn/activity_log/requests/{log_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py index 430498dc..152610ba 100644 --- a/src/gcore/resources/cdn/cdn.py +++ b/src/gcore/resources/cdn/cdn.py @@ -213,9 +213,7 @@ def get_account_limits( ) -> CdnAccountLimits: """Get information about CDN service limits.""" return self._get( - "/cdn/clients/me/limits" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/clients/me/limits", + "/cdn/clients/me/limits", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -234,7 +232,7 @@ def get_account_overview( ) -> CdnAccount: """Get information about CDN service.""" return self._get( - "/cdn/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//cdn/clients/me", + "/cdn/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -253,9 +251,7 @@ def get_available_features( ) -> CdnAvailableFeatures: """Get information about available CDN features.""" return self._get( - "/cdn/clients/me/features" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/clients/me/features", + "/cdn/clients/me/features", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -335,7 +331,7 @@ def list_purge_statuses( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cdn/purge_statuses" if self._client._base_url_overridden else "https://api.gcore.com//cdn/purge_statuses", + "/cdn/purge_statuses", page=SyncOffsetPageCdn[PurgeStatus], options=make_request_options( extra_headers=extra_headers, @@ -386,7 +382,7 @@ def update_account( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - "/cdn/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//cdn/clients/me", + "/cdn/clients/me", body=maybe_transform( {"utilization_level": utilization_level}, cdn_update_account_params.CdnUpdateAccountParams ), @@ -481,9 +477,7 @@ async def get_account_limits( ) -> CdnAccountLimits: """Get information about CDN service limits.""" return await self._get( - "/cdn/clients/me/limits" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/clients/me/limits", + "/cdn/clients/me/limits", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -502,7 +496,7 @@ async def get_account_overview( ) -> CdnAccount: """Get information about CDN service.""" return await self._get( - "/cdn/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//cdn/clients/me", + "/cdn/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -521,9 +515,7 @@ async def get_available_features( ) -> CdnAvailableFeatures: """Get information about available CDN features.""" return await self._get( - "/cdn/clients/me/features" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/clients/me/features", + "/cdn/clients/me/features", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -603,7 +595,7 @@ def list_purge_statuses( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cdn/purge_statuses" if self._client._base_url_overridden else "https://api.gcore.com//cdn/purge_statuses", + "/cdn/purge_statuses", page=AsyncOffsetPageCdn[PurgeStatus], options=make_request_options( extra_headers=extra_headers, @@ -654,7 +646,7 @@ async def update_account( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - "/cdn/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//cdn/clients/me", + "/cdn/clients/me", body=await async_maybe_transform( {"utilization_level": utilization_level}, cdn_update_account_params.CdnUpdateAccountParams ), diff --git a/src/gcore/resources/cdn/certificates.py b/src/gcore/resources/cdn/certificates.py index 343090f3..5b299f13 100644 --- a/src/gcore/resources/cdn/certificates.py +++ b/src/gcore/resources/cdn/certificates.py @@ -164,7 +164,7 @@ def create( ) -> None: extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cdn/sslData" if self._client._base_url_overridden else "https://api.gcore.com//cdn/sslData", + "/cdn/sslData", body=maybe_transform( { "name": name, @@ -221,7 +221,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/sslData" if self._client._base_url_overridden else "https://api.gcore.com//cdn/sslData", + "/cdn/sslData", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -264,9 +264,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cdn/sslData/{ssl_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + f"/cdn/sslData/{ssl_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -299,9 +297,7 @@ def force_retry( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cdn/sslData/{cert_id}/force-retry" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslData/{cert_id}/force-retry", + f"/cdn/sslData/{cert_id}/force-retry", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -332,9 +328,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cdn/sslData/{ssl_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + f"/cdn/sslData/{ssl_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -369,9 +363,7 @@ def get_status( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cdn/sslData/{cert_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslData/{cert_id}/status", + f"/cdn/sslData/{cert_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -409,9 +401,7 @@ def renew( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cdn/sslData/{cert_id}/renew" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslData/{cert_id}/renew", + f"/cdn/sslData/{cert_id}/renew", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -466,9 +456,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/cdn/sslData/{ssl_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + f"/cdn/sslData/{ssl_id}", body=maybe_transform( { "name": name, @@ -619,7 +607,7 @@ async def create( ) -> None: extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cdn/sslData" if self._client._base_url_overridden else "https://api.gcore.com//cdn/sslData", + "/cdn/sslData", body=await async_maybe_transform( { "name": name, @@ -676,7 +664,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/sslData" if self._client._base_url_overridden else "https://api.gcore.com//cdn/sslData", + "/cdn/sslData", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -719,9 +707,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cdn/sslData/{ssl_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + f"/cdn/sslData/{ssl_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -754,9 +740,7 @@ async def force_retry( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cdn/sslData/{cert_id}/force-retry" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslData/{cert_id}/force-retry", + f"/cdn/sslData/{cert_id}/force-retry", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -787,9 +771,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cdn/sslData/{ssl_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + f"/cdn/sslData/{ssl_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -824,9 +806,7 @@ async def get_status( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cdn/sslData/{cert_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslData/{cert_id}/status", + f"/cdn/sslData/{cert_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -866,9 +846,7 @@ async def renew( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cdn/sslData/{cert_id}/renew" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslData/{cert_id}/renew", + f"/cdn/sslData/{cert_id}/renew", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -923,9 +901,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/cdn/sslData/{ssl_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + f"/cdn/sslData/{ssl_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cdn/ip_ranges.py b/src/gcore/resources/cdn/ip_ranges.py index 1480fb8e..606e9b83 100644 --- a/src/gcore/resources/cdn/ip_ranges.py +++ b/src/gcore/resources/cdn/ip_ranges.py @@ -60,9 +60,7 @@ def list( This request does not require authorization. """ return self._get( - "/cdn/public-net-list" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/public-net-list", + "/cdn/public-net-list", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -90,7 +88,7 @@ def list_ips( This request does not require authorization. """ return self._get( - "/cdn/public-ip-list" if self._client._base_url_overridden else "https://api.gcore.com//cdn/public-ip-list", + "/cdn/public-ip-list", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -138,9 +136,7 @@ async def list( This request does not require authorization. """ return await self._get( - "/cdn/public-net-list" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/public-net-list", + "/cdn/public-net-list", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -168,7 +164,7 @@ async def list_ips( This request does not require authorization. """ return await self._get( - "/cdn/public-ip-list" if self._client._base_url_overridden else "https://api.gcore.com//cdn/public-ip-list", + "/cdn/public-ip-list", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cdn/logs/logs.py b/src/gcore/resources/cdn/logs/logs.py index 9466b36b..123c80e6 100644 --- a/src/gcore/resources/cdn/logs/logs.py +++ b/src/gcore/resources/cdn/logs/logs.py @@ -309,9 +309,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cdn/advanced/v1/logs" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/advanced/v1/logs", + "/cdn/advanced/v1/logs", page=SyncOffsetPageCdnLogs[Data], options=make_request_options( extra_headers=extra_headers, @@ -627,9 +625,7 @@ def download( """ extra_headers = {"Accept": "application/zip", **(extra_headers or {})} return self._get( - "/cdn/advanced/v1/logs/download" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/advanced/v1/logs/download", + "/cdn/advanced/v1/logs/download", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -968,9 +964,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cdn/advanced/v1/logs" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/advanced/v1/logs", + "/cdn/advanced/v1/logs", page=AsyncOffsetPageCdnLogs[Data], options=make_request_options( extra_headers=extra_headers, @@ -1286,9 +1280,7 @@ async def download( """ extra_headers = {"Accept": "application/zip", **(extra_headers or {})} return await self._get( - "/cdn/advanced/v1/logs/download" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/advanced/v1/logs/download", + "/cdn/advanced/v1/logs/download", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cdn/logs/settings.py b/src/gcore/resources/cdn/logs/settings.py index 81624fb2..94e81d6c 100644 --- a/src/gcore/resources/cdn/logs/settings.py +++ b/src/gcore/resources/cdn/logs/settings.py @@ -214,9 +214,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cdn/raw_log_settings" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/raw_log_settings", + "/cdn/raw_log_settings", body=maybe_transform( { "all_resources_bucket": all_resources_bucket, @@ -424,9 +422,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - "/cdn/raw_log_settings" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/raw_log_settings", + "/cdn/raw_log_settings", body=maybe_transform( { "all_resources_bucket": all_resources_bucket, @@ -485,9 +481,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - "/cdn/raw_log_settings" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/raw_log_settings", + "/cdn/raw_log_settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -506,9 +500,7 @@ def get( ) -> LogSettings: """Get information about raw logs feature settings.""" return self._get( - "/cdn/raw_log_settings" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/raw_log_settings", + "/cdn/raw_log_settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -707,9 +699,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cdn/raw_log_settings" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/raw_log_settings", + "/cdn/raw_log_settings", body=await async_maybe_transform( { "all_resources_bucket": all_resources_bucket, @@ -917,9 +907,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - "/cdn/raw_log_settings" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/raw_log_settings", + "/cdn/raw_log_settings", body=await async_maybe_transform( { "all_resources_bucket": all_resources_bucket, @@ -978,9 +966,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - "/cdn/raw_log_settings" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/raw_log_settings", + "/cdn/raw_log_settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -999,9 +985,7 @@ async def get( ) -> LogSettings: """Get information about raw logs feature settings.""" return await self._get( - "/cdn/raw_log_settings" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/raw_log_settings", + "/cdn/raw_log_settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cdn/logs_uploader/configs.py b/src/gcore/resources/cdn/logs_uploader/configs.py index 34dfc89b..66fb217f 100644 --- a/src/gcore/resources/cdn/logs_uploader/configs.py +++ b/src/gcore/resources/cdn/logs_uploader/configs.py @@ -93,9 +93,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cdn/logs_uploader/configs" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/configs", + "/cdn/logs_uploader/configs", body=maybe_transform( { "name": name, @@ -157,9 +155,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cdn/logs_uploader/configs/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + f"/cdn/logs_uploader/configs/{id}", body=maybe_transform( { "enabled": enabled, @@ -206,9 +202,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/logs_uploader/configs" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/configs", + "/cdn/logs_uploader/configs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -255,9 +249,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cdn/logs_uploader/configs/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + f"/cdn/logs_uploader/configs/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -288,9 +280,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cdn/logs_uploader/configs/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + f"/cdn/logs_uploader/configs/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -341,9 +331,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/cdn/logs_uploader/configs/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + f"/cdn/logs_uploader/configs/{id}", body=maybe_transform( { "name": name, @@ -385,9 +373,7 @@ def validate( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/cdn/logs_uploader/configs/{id}/validate" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}/validate", + f"/cdn/logs_uploader/configs/{id}/validate", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -458,9 +444,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cdn/logs_uploader/configs" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/configs", + "/cdn/logs_uploader/configs", body=await async_maybe_transform( { "name": name, @@ -522,9 +506,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cdn/logs_uploader/configs/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + f"/cdn/logs_uploader/configs/{id}", body=await async_maybe_transform( { "enabled": enabled, @@ -571,9 +553,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/logs_uploader/configs" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/configs", + "/cdn/logs_uploader/configs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -620,9 +600,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cdn/logs_uploader/configs/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + f"/cdn/logs_uploader/configs/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -653,9 +631,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cdn/logs_uploader/configs/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + f"/cdn/logs_uploader/configs/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -706,9 +682,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/cdn/logs_uploader/configs/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + f"/cdn/logs_uploader/configs/{id}", body=await async_maybe_transform( { "name": name, @@ -750,9 +724,7 @@ async def validate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/cdn/logs_uploader/configs/{id}/validate" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}/validate", + f"/cdn/logs_uploader/configs/{id}/validate", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cdn/logs_uploader/policies.py b/src/gcore/resources/cdn/logs_uploader/policies.py index 141db85a..1ea24646 100644 --- a/src/gcore/resources/cdn/logs_uploader/policies.py +++ b/src/gcore/resources/cdn/logs_uploader/policies.py @@ -120,9 +120,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cdn/logs_uploader/policies" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/policies", + "/cdn/logs_uploader/policies", body=maybe_transform( { "date_format": date_format, @@ -220,9 +218,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cdn/logs_uploader/policies/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + f"/cdn/logs_uploader/policies/{id}", body=maybe_transform( { "date_format": date_format, @@ -278,9 +274,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/logs_uploader/policies" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/policies", + "/cdn/logs_uploader/policies", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -327,9 +321,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cdn/logs_uploader/policies/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + f"/cdn/logs_uploader/policies/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -360,9 +352,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cdn/logs_uploader/policies/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + f"/cdn/logs_uploader/policies/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -381,9 +371,7 @@ def list_fields( ) -> PolicyListFieldsResponse: """Get list of available fields for logs uploader policy.""" return self._get( - "/cdn/logs_uploader/policies/fields" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/policies/fields", + "/cdn/logs_uploader/policies/fields", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -461,9 +449,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/cdn/logs_uploader/policies/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + f"/cdn/logs_uploader/policies/{id}", body=maybe_transform( { "date_format": date_format, @@ -581,9 +567,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cdn/logs_uploader/policies" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/policies", + "/cdn/logs_uploader/policies", body=await async_maybe_transform( { "date_format": date_format, @@ -681,9 +665,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cdn/logs_uploader/policies/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + f"/cdn/logs_uploader/policies/{id}", body=await async_maybe_transform( { "date_format": date_format, @@ -739,9 +721,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/logs_uploader/policies" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/policies", + "/cdn/logs_uploader/policies", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -788,9 +768,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cdn/logs_uploader/policies/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + f"/cdn/logs_uploader/policies/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -821,9 +799,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cdn/logs_uploader/policies/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + f"/cdn/logs_uploader/policies/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -842,9 +818,7 @@ async def list_fields( ) -> PolicyListFieldsResponse: """Get list of available fields for logs uploader policy.""" return await self._get( - "/cdn/logs_uploader/policies/fields" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/policies/fields", + "/cdn/logs_uploader/policies/fields", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -922,9 +896,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/cdn/logs_uploader/policies/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + f"/cdn/logs_uploader/policies/{id}", body=await async_maybe_transform( { "date_format": date_format, diff --git a/src/gcore/resources/cdn/logs_uploader/targets.py b/src/gcore/resources/cdn/logs_uploader/targets.py index 1b5b90fa..c0eba285 100644 --- a/src/gcore/resources/cdn/logs_uploader/targets.py +++ b/src/gcore/resources/cdn/logs_uploader/targets.py @@ -86,9 +86,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cdn/logs_uploader/targets" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/targets", + "/cdn/logs_uploader/targets", body=maybe_transform( { "config": config, @@ -141,9 +139,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cdn/logs_uploader/targets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + f"/cdn/logs_uploader/targets/{id}", body=maybe_transform( { "config": config, @@ -188,9 +184,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/logs_uploader/targets" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/targets", + "/cdn/logs_uploader/targets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -237,9 +231,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cdn/logs_uploader/targets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + f"/cdn/logs_uploader/targets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -270,9 +262,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cdn/logs_uploader/targets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + f"/cdn/logs_uploader/targets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -315,9 +305,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/cdn/logs_uploader/targets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + f"/cdn/logs_uploader/targets/{id}", body=maybe_transform( { "config": config, @@ -357,9 +345,7 @@ def validate( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/cdn/logs_uploader/targets/{id}/validate" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}/validate", + f"/cdn/logs_uploader/targets/{id}/validate", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -422,9 +408,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cdn/logs_uploader/targets" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/targets", + "/cdn/logs_uploader/targets", body=await async_maybe_transform( { "config": config, @@ -477,9 +461,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cdn/logs_uploader/targets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + f"/cdn/logs_uploader/targets/{id}", body=await async_maybe_transform( { "config": config, @@ -524,9 +506,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/logs_uploader/targets" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/logs_uploader/targets", + "/cdn/logs_uploader/targets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -573,9 +553,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cdn/logs_uploader/targets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + f"/cdn/logs_uploader/targets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -606,9 +584,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cdn/logs_uploader/targets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + f"/cdn/logs_uploader/targets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -651,9 +627,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/cdn/logs_uploader/targets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + f"/cdn/logs_uploader/targets/{id}", body=await async_maybe_transform( { "config": config, @@ -693,9 +667,7 @@ async def validate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/cdn/logs_uploader/targets/{id}/validate" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}/validate", + f"/cdn/logs_uploader/targets/{id}/validate", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cdn/metrics.py b/src/gcore/resources/cdn/metrics.py index 4d32d90a..d1c551bd 100644 --- a/src/gcore/resources/cdn/metrics.py +++ b/src/gcore/resources/cdn/metrics.py @@ -182,9 +182,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cdn/advanced/v1/metrics" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/advanced/v1/metrics", + "/cdn/advanced/v1/metrics", body=maybe_transform( { "from_": from_, @@ -362,9 +360,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cdn/advanced/v1/metrics" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/advanced/v1/metrics", + "/cdn/advanced/v1/metrics", body=await async_maybe_transform( { "from_": from_, diff --git a/src/gcore/resources/cdn/network_capacity.py b/src/gcore/resources/cdn/network_capacity.py index 30acd2bb..870849d3 100644 --- a/src/gcore/resources/cdn/network_capacity.py +++ b/src/gcore/resources/cdn/network_capacity.py @@ -51,9 +51,7 @@ def list( ) -> NetworkCapacity: """Get network capacity per country.""" return self._get( - "/cdn/advanced/v1/capacity" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/advanced/v1/capacity", + "/cdn/advanced/v1/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -93,9 +91,7 @@ async def list( ) -> NetworkCapacity: """Get network capacity per country.""" return await self._get( - "/cdn/advanced/v1/capacity" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/advanced/v1/capacity", + "/cdn/advanced/v1/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cdn/origin_groups.py b/src/gcore/resources/cdn/origin_groups.py index aa98a961..fd8beae5 100644 --- a/src/gcore/resources/cdn/origin_groups.py +++ b/src/gcore/resources/cdn/origin_groups.py @@ -201,9 +201,7 @@ def create( return cast( OriginGroups, self._post( - "/cdn/origin_groups" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/origin_groups", + "/cdn/origin_groups", body=maybe_transform( { "name": name, @@ -382,9 +380,7 @@ def update( return cast( OriginGroups, self._patch( - f"/cdn/origin_groups/{origin_group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + f"/cdn/origin_groups/{origin_group_id}", body=maybe_transform( { "name": name, @@ -441,7 +437,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/origin_groups" if self._client._base_url_overridden else "https://api.gcore.com//cdn/origin_groups", + "/cdn/origin_groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -484,9 +480,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cdn/origin_groups/{origin_group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + f"/cdn/origin_groups/{origin_group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -519,9 +513,7 @@ def get( return cast( OriginGroups, self._get( - f"/cdn/origin_groups/{origin_group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + f"/cdn/origin_groups/{origin_group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -692,9 +684,7 @@ def replace( return cast( OriginGroups, self._put( - f"/cdn/origin_groups/{origin_group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + f"/cdn/origin_groups/{origin_group_id}", body=maybe_transform( { "auth_type": auth_type, @@ -886,9 +876,7 @@ async def create( return cast( OriginGroups, await self._post( - "/cdn/origin_groups" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/origin_groups", + "/cdn/origin_groups", body=await async_maybe_transform( { "name": name, @@ -1067,9 +1055,7 @@ async def update( return cast( OriginGroups, await self._patch( - f"/cdn/origin_groups/{origin_group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + f"/cdn/origin_groups/{origin_group_id}", body=await async_maybe_transform( { "name": name, @@ -1126,7 +1112,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/origin_groups" if self._client._base_url_overridden else "https://api.gcore.com//cdn/origin_groups", + "/cdn/origin_groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1169,9 +1155,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cdn/origin_groups/{origin_group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + f"/cdn/origin_groups/{origin_group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1204,9 +1188,7 @@ async def get( return cast( OriginGroups, await self._get( - f"/cdn/origin_groups/{origin_group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + f"/cdn/origin_groups/{origin_group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1377,9 +1359,7 @@ async def replace( return cast( OriginGroups, await self._put( - f"/cdn/origin_groups/{origin_group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + f"/cdn/origin_groups/{origin_group_id}", body=await async_maybe_transform( { "auth_type": auth_type, diff --git a/src/gcore/resources/cdn/resources/resources.py b/src/gcore/resources/cdn/resources/resources.py index 02065307..5dc03672 100644 --- a/src/gcore/resources/cdn/resources/resources.py +++ b/src/gcore/resources/cdn/resources/resources.py @@ -200,7 +200,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources", + "/cdn/resources", body=maybe_transform( { "cname": cname, @@ -327,9 +327,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cdn/resources/{resource_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}", + f"/cdn/resources/{resource_id}", body=maybe_transform( { "active": active, @@ -461,7 +459,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources", + "/cdn/resources", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -527,9 +525,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cdn/resources/{resource_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}", + f"/cdn/resources/{resource_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -560,9 +556,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cdn/resources/{resource_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}", + f"/cdn/resources/{resource_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -609,9 +603,7 @@ def prefetch( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cdn/resources/{resource_id}/prefetch" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/prefetch", + f"/cdn/resources/{resource_id}/prefetch", body=maybe_transform({"paths": paths}, resource_prefetch_params.ResourcePrefetchParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -644,9 +636,7 @@ def prevalidate_ssl_le_certificate( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cdn/resources/{resource_id}/ssl/le/pre-validate" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/ssl/le/pre-validate", + f"/cdn/resources/{resource_id}/ssl/le/pre-validate", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -821,9 +811,7 @@ def purge( ) -> None: extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cdn/resources/{resource_id}/purge" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/purge", + f"/cdn/resources/{resource_id}/purge", body=maybe_transform( { "urls": urls, @@ -944,9 +932,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/cdn/resources/{resource_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}", + f"/cdn/resources/{resource_id}", body=maybe_transform( { "origin_group": origin_group, @@ -1124,7 +1110,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources", + "/cdn/resources", body=await async_maybe_transform( { "cname": cname, @@ -1251,9 +1237,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cdn/resources/{resource_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}", + f"/cdn/resources/{resource_id}", body=await async_maybe_transform( { "active": active, @@ -1385,7 +1369,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources", + "/cdn/resources", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1451,9 +1435,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cdn/resources/{resource_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}", + f"/cdn/resources/{resource_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1484,9 +1466,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cdn/resources/{resource_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}", + f"/cdn/resources/{resource_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1533,9 +1513,7 @@ async def prefetch( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cdn/resources/{resource_id}/prefetch" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/prefetch", + f"/cdn/resources/{resource_id}/prefetch", body=await async_maybe_transform({"paths": paths}, resource_prefetch_params.ResourcePrefetchParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1568,9 +1546,7 @@ async def prevalidate_ssl_le_certificate( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cdn/resources/{resource_id}/ssl/le/pre-validate" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/ssl/le/pre-validate", + f"/cdn/resources/{resource_id}/ssl/le/pre-validate", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1745,9 +1721,7 @@ async def purge( ) -> None: extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cdn/resources/{resource_id}/purge" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/purge", + f"/cdn/resources/{resource_id}/purge", body=await async_maybe_transform( { "urls": urls, @@ -1868,9 +1842,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/cdn/resources/{resource_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}", + f"/cdn/resources/{resource_id}", body=await async_maybe_transform( { "origin_group": origin_group, diff --git a/src/gcore/resources/cdn/resources/rules.py b/src/gcore/resources/cdn/resources/rules.py index 11dd3eda..88273cf0 100644 --- a/src/gcore/resources/cdn/resources/rules.py +++ b/src/gcore/resources/cdn/resources/rules.py @@ -130,9 +130,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/cdn/resources/{resource_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/rules", + f"/cdn/resources/{resource_id}/rules", body=maybe_transform( { "name": name, @@ -238,9 +236,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cdn/resources/{resource_id}/rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + f"/cdn/resources/{resource_id}/rules/{rule_id}", body=maybe_transform( { "active": active, @@ -284,9 +280,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cdn/resources/{resource_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/rules", + f"/cdn/resources/{resource_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -326,9 +320,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cdn/resources/{resource_id}/rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + f"/cdn/resources/{resource_id}/rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -360,9 +352,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cdn/resources/{resource_id}/rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + f"/cdn/resources/{resource_id}/rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -455,9 +445,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/cdn/resources/{resource_id}/rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + f"/cdn/resources/{resource_id}/rules/{rule_id}", body=maybe_transform( { "rule": rule, @@ -583,9 +571,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/cdn/resources/{resource_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/rules", + f"/cdn/resources/{resource_id}/rules", body=await async_maybe_transform( { "name": name, @@ -691,9 +677,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cdn/resources/{resource_id}/rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + f"/cdn/resources/{resource_id}/rules/{rule_id}", body=await async_maybe_transform( { "active": active, @@ -737,9 +721,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cdn/resources/{resource_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/rules", + f"/cdn/resources/{resource_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -779,9 +761,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cdn/resources/{resource_id}/rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + f"/cdn/resources/{resource_id}/rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -813,9 +793,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cdn/resources/{resource_id}/rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + f"/cdn/resources/{resource_id}/rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -908,9 +886,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/cdn/resources/{resource_id}/rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + f"/cdn/resources/{resource_id}/rules/{rule_id}", body=await async_maybe_transform( { "rule": rule, diff --git a/src/gcore/resources/cdn/resources/shield.py b/src/gcore/resources/cdn/resources/shield.py index 1d7d3bc9..cbb712d5 100644 --- a/src/gcore/resources/cdn/resources/shield.py +++ b/src/gcore/resources/cdn/resources/shield.py @@ -67,9 +67,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cdn/resources/{resource_id}/shielding_v2" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/shielding_v2", + f"/cdn/resources/{resource_id}/shielding_v2", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -105,9 +103,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/cdn/resources/{resource_id}/shielding_v2" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/shielding_v2", + f"/cdn/resources/{resource_id}/shielding_v2", body=maybe_transform({"shielding_pop": shielding_pop}, shield_replace_params.ShieldReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -160,9 +156,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cdn/resources/{resource_id}/shielding_v2" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/shielding_v2", + f"/cdn/resources/{resource_id}/shielding_v2", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -198,9 +192,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/cdn/resources/{resource_id}/shielding_v2" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/{resource_id}/shielding_v2", + f"/cdn/resources/{resource_id}/shielding_v2", body=await async_maybe_transform( {"shielding_pop": shielding_pop}, shield_replace_params.ShieldReplaceParams ), diff --git a/src/gcore/resources/cdn/rule_templates.py b/src/gcore/resources/cdn/rule_templates.py index a48777d2..326b7811 100644 --- a/src/gcore/resources/cdn/rule_templates.py +++ b/src/gcore/resources/cdn/rule_templates.py @@ -115,9 +115,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cdn/resources/rule_templates" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/resources/rule_templates", + "/cdn/resources/rule_templates", body=maybe_transform( { "rule": rule, @@ -206,9 +204,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cdn/resources/rule_templates/{rule_template_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + f"/cdn/resources/rule_templates/{rule_template_id}", body=maybe_transform( { "name": name, @@ -238,9 +234,7 @@ def list( ) -> RuleTemplateList: """Get rule templates list""" return self._get( - "/cdn/resources/rule_templates" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/resources/rule_templates", + "/cdn/resources/rule_templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -272,9 +266,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cdn/resources/rule_templates/{rule_template_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + f"/cdn/resources/rule_templates/{rule_template_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -305,9 +297,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cdn/resources/rule_templates/{rule_template_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + f"/cdn/resources/rule_templates/{rule_template_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -385,9 +375,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/cdn/resources/rule_templates/{rule_template_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + f"/cdn/resources/rule_templates/{rule_template_id}", body=maybe_transform( { "rule": rule, @@ -496,9 +484,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cdn/resources/rule_templates" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/resources/rule_templates", + "/cdn/resources/rule_templates", body=await async_maybe_transform( { "rule": rule, @@ -587,9 +573,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cdn/resources/rule_templates/{rule_template_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + f"/cdn/resources/rule_templates/{rule_template_id}", body=await async_maybe_transform( { "name": name, @@ -619,9 +603,7 @@ async def list( ) -> RuleTemplateList: """Get rule templates list""" return await self._get( - "/cdn/resources/rule_templates" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/resources/rule_templates", + "/cdn/resources/rule_templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -653,9 +635,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cdn/resources/rule_templates/{rule_template_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + f"/cdn/resources/rule_templates/{rule_template_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -686,9 +666,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cdn/resources/rule_templates/{rule_template_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + f"/cdn/resources/rule_templates/{rule_template_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -766,9 +744,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/cdn/resources/rule_templates/{rule_template_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + f"/cdn/resources/rule_templates/{rule_template_id}", body=await async_maybe_transform( { "rule": rule, diff --git a/src/gcore/resources/cdn/shields.py b/src/gcore/resources/cdn/shields.py index cc6d7c38..07c64807 100644 --- a/src/gcore/resources/cdn/shields.py +++ b/src/gcore/resources/cdn/shields.py @@ -51,9 +51,7 @@ def list( ) -> ShieldListResponse: """Get information about all origin shielding locations available in the account.""" return self._get( - "/cdn/shieldingpop_v2" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/shieldingpop_v2", + "/cdn/shieldingpop_v2", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -93,9 +91,7 @@ async def list( ) -> ShieldListResponse: """Get information about all origin shielding locations available in the account.""" return await self._get( - "/cdn/shieldingpop_v2" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/shieldingpop_v2", + "/cdn/shieldingpop_v2", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cdn/statistics.py b/src/gcore/resources/cdn/statistics.py index 113ffff9..d07e9b46 100644 --- a/src/gcore/resources/cdn/statistics.py +++ b/src/gcore/resources/cdn/statistics.py @@ -105,9 +105,7 @@ def get_logs_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/statistics/raw_logs_usage/aggregated" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/statistics/raw_logs_usage/aggregated", + "/cdn/statistics/raw_logs_usage/aggregated", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -173,9 +171,7 @@ def get_logs_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/statistics/raw_logs_usage/series" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/statistics/raw_logs_usage/series", + "/cdn/statistics/raw_logs_usage/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -351,9 +347,7 @@ def get_resource_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/statistics/aggregate/stats" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/statistics/aggregate/stats", + "/cdn/statistics/aggregate/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -512,9 +506,7 @@ def get_resource_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/statistics/series" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/statistics/series", + "/cdn/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -591,9 +583,7 @@ def get_shield_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/statistics/shield_usage/aggregated" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/statistics/shield_usage/aggregated", + "/cdn/statistics/shield_usage/aggregated", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -651,9 +641,7 @@ def get_shield_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/statistics/shield_usage/series" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/statistics/shield_usage/series", + "/cdn/statistics/shield_usage/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -745,9 +733,7 @@ async def get_logs_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/statistics/raw_logs_usage/aggregated" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/statistics/raw_logs_usage/aggregated", + "/cdn/statistics/raw_logs_usage/aggregated", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -813,9 +799,7 @@ async def get_logs_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/statistics/raw_logs_usage/series" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/statistics/raw_logs_usage/series", + "/cdn/statistics/raw_logs_usage/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -991,9 +975,7 @@ async def get_resource_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/statistics/aggregate/stats" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/statistics/aggregate/stats", + "/cdn/statistics/aggregate/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1152,9 +1134,7 @@ async def get_resource_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/statistics/series" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/statistics/series", + "/cdn/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1231,9 +1211,7 @@ async def get_shield_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/statistics/shield_usage/aggregated" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/statistics/shield_usage/aggregated", + "/cdn/statistics/shield_usage/aggregated", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1291,9 +1269,7 @@ async def get_shield_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/statistics/shield_usage/series" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/statistics/shield_usage/series", + "/cdn/statistics/shield_usage/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cdn/trusted_ca_certificates.py b/src/gcore/resources/cdn/trusted_ca_certificates.py index b8f83ff3..3ac42d0b 100644 --- a/src/gcore/resources/cdn/trusted_ca_certificates.py +++ b/src/gcore/resources/cdn/trusted_ca_certificates.py @@ -82,9 +82,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cdn/sslCertificates" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/sslCertificates", + "/cdn/sslCertificates", body=maybe_transform( { "name": name, @@ -138,9 +136,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/cdn/sslCertificates" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/sslCertificates", + "/cdn/sslCertificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -183,9 +179,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cdn/sslCertificates/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslCertificates/{id}", + f"/cdn/sslCertificates/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,9 +210,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cdn/sslCertificates/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslCertificates/{id}", + f"/cdn/sslCertificates/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -254,9 +246,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/cdn/sslCertificates/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslCertificates/{id}", + f"/cdn/sslCertificates/{id}", body=maybe_transform( {"name": name}, trusted_ca_certificate_replace_params.TrustedCaCertificateReplaceParams ), @@ -323,9 +313,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cdn/sslCertificates" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/sslCertificates", + "/cdn/sslCertificates", body=await async_maybe_transform( { "name": name, @@ -379,9 +367,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/cdn/sslCertificates" - if self._client._base_url_overridden - else "https://api.gcore.com//cdn/sslCertificates", + "/cdn/sslCertificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -424,9 +410,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cdn/sslCertificates/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslCertificates/{id}", + f"/cdn/sslCertificates/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -457,9 +441,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cdn/sslCertificates/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslCertificates/{id}", + f"/cdn/sslCertificates/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -495,9 +477,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/cdn/sslCertificates/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cdn/sslCertificates/{id}", + f"/cdn/sslCertificates/{id}", body=await async_maybe_transform( {"name": name}, trusted_ca_certificate_replace_params.TrustedCaCertificateReplaceParams ), diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index 0c1a5060..0e942e4e 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -206,9 +206,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/user_actions", + "/cloud/v1/user_actions", page=SyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, @@ -417,9 +415,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/user_actions", + "/cloud/v1/user_actions", page=AsyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 202234f1..454b0c7f 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -93,9 +93,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -189,9 +187,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index ddb9f507..16f4d22c 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -90,9 +90,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -180,9 +178,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 63fcbf41..6507c906 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -161,9 +161,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -301,9 +299,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", page=SyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -386,9 +382,7 @@ def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=maybe_transform( { "image_id": image_id, @@ -537,9 +531,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -677,9 +669,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}", page=AsyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -762,9 +752,7 @@ async def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=await async_maybe_transform( { "image_id": image_id, diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index 5a2dd6b5..dc107127 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -122,9 +122,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservations", + "/cloud/v1/reservations", page=SyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -179,9 +177,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v1/reservations/{reservation_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -284,9 +280,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservations", + "/cloud/v1/reservations", page=AsyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -341,9 +335,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v1/reservations/{reservation_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 6871f862..1ee323ee 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -150,9 +150,7 @@ def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals", body=maybe_transform( { "time_from": time_from, @@ -263,9 +261,7 @@ def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/reservation_cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals", body=maybe_transform( { "regions": regions, @@ -394,9 +390,7 @@ def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/resources" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources", body=maybe_transform( { "time_from": time_from, @@ -541,9 +535,7 @@ async def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals", body=await async_maybe_transform( { "time_from": time_from, @@ -654,9 +646,7 @@ async def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/reservation_cost_report/totals" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals", body=await async_maybe_transform( { "regions": regions, @@ -785,9 +775,7 @@ async def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/resources" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index fa8f4a08..6750a7c5 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -88,9 +88,7 @@ def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=maybe_transform( { "access_mode": access_mode, @@ -142,9 +140,7 @@ def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -195,9 +191,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -269,9 +263,7 @@ async def create( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=await async_maybe_transform( { "access_mode": access_mode, @@ -323,9 +315,7 @@ async def list( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -376,9 +366,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 6451d59c..da32da6f 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -206,9 +206,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -296,9 +294,7 @@ def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=maybe_transform( { "name": name, @@ -359,9 +355,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", page=SyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -419,9 +413,7 @@ def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -466,9 +458,7 @@ def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -516,9 +506,7 @@ def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -693,9 +681,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -783,9 +769,7 @@ async def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=await async_maybe_transform( { "name": name, @@ -846,9 +830,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}", page=AsyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -906,9 +888,7 @@ async def delete( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -953,9 +933,7 @@ async def get( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1003,9 +981,7 @@ async def resize( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=await async_maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 67523605..9ec344aa 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -105,9 +105,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", body=maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -183,9 +181,7 @@ def update( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._patch( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", body=maybe_transform({"tags": tags}, floating_ip_update_params.FloatingIPUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -239,9 +235,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", page=SyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -299,9 +293,7 @@ def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -346,9 +338,7 @@ def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=maybe_transform( { "port_id": port_id, @@ -400,9 +390,7 @@ def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,9 +429,7 @@ def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -524,9 +510,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", body=await async_maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -602,9 +586,7 @@ async def update( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._patch( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", body=await async_maybe_transform({"tags": tags}, floating_ip_update_params.FloatingIPUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -658,9 +640,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}", page=AsyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -718,9 +698,7 @@ async def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -765,9 +743,7 @@ async def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=await async_maybe_transform( { "port_id": port_id, @@ -819,9 +795,7 @@ async def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -860,9 +834,7 @@ async def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index dc44954b..19df3189 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -80,9 +80,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -159,9 +157,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index bcde0157..c72bac4e 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -158,9 +158,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=maybe_transform( { "flavor": flavor, @@ -224,9 +222,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=SyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -297,9 +293,7 @@ def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -384,9 +378,7 @@ def action( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action", body=maybe_transform( { "action": action, @@ -438,9 +430,7 @@ def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -479,9 +469,7 @@ def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -520,9 +508,7 @@ def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -574,9 +560,7 @@ def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=maybe_transform( { "nodes": nodes, @@ -628,9 +612,7 @@ def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, @@ -733,9 +715,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=await async_maybe_transform( { "flavor": flavor, @@ -799,9 +779,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=AsyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -872,9 +850,7 @@ async def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -959,9 +935,7 @@ async def action( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action", body=await async_maybe_transform( { "action": action, @@ -1013,9 +987,7 @@ async def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1054,9 +1026,7 @@ async def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1095,9 +1065,7 @@ async def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1149,9 +1117,7 @@ async def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=await async_maybe_transform( { "nodes": nodes, @@ -1203,9 +1169,7 @@ async def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=await async_maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 3f68475e..5e2003c2 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -79,9 +79,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -126,9 +124,7 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -173,9 +169,7 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +244,7 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=maybe_transform( { "name": name, @@ -328,9 +320,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -375,9 +365,7 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -422,9 +410,7 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -499,9 +485,7 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index c12ccc5f..63371d8e 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -71,9 +71,7 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -133,9 +131,7 @@ async def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 1d650c11..fb1a210e 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -143,9 +143,7 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=SyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -211,9 +209,7 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -452,9 +448,7 @@ def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -513,9 +507,7 @@ def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -561,9 +553,7 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -602,9 +592,7 @@ def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -643,9 +631,7 @@ def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -762,9 +748,7 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=AsyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -830,9 +814,7 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1073,9 +1055,7 @@ async def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -1134,9 +1114,7 @@ async def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, @@ -1182,9 +1160,7 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1223,9 +1199,7 @@ async def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1264,9 +1238,7 @@ async def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py index 2bca0a73..fcd8860c 100644 --- a/src/gcore/resources/cloud/inference/api_keys.py +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -84,9 +84,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", body=maybe_transform( { "name": name, @@ -137,9 +135,7 @@ def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -182,9 +178,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", page=SyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -239,9 +233,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,9 +273,7 @@ def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,9 +340,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", body=await async_maybe_transform( { "name": name, @@ -403,9 +391,7 @@ async def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=await async_maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -448,9 +434,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys", page=AsyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -505,9 +489,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,9 +529,7 @@ async def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index 717dbba4..7b62f2c2 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -93,9 +93,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", body=maybe_transform( { "application_name": application_name, @@ -142,9 +140,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -186,9 +182,7 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -232,9 +226,7 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -287,9 +279,7 @@ def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -371,9 +361,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", body=await async_maybe_transform( { "application_name": application_name, @@ -420,9 +408,7 @@ async def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -464,9 +450,7 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -510,9 +494,7 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -565,9 +547,7 @@ async def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, diff --git a/src/gcore/resources/cloud/inference/applications/templates.py b/src/gcore/resources/cloud/inference/applications/templates.py index ab2fe2cb..d888a399 100644 --- a/src/gcore/resources/cloud/inference/applications/templates.py +++ b/src/gcore/resources/cloud/inference/applications/templates.py @@ -58,9 +58,7 @@ def list( required to create a fully functional application deployment. """ return self._get( - "/cloud/v3/inference/applications/catalog" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -99,9 +97,7 @@ def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -147,9 +143,7 @@ async def list( required to create a fully functional application deployment. """ return await self._get( - "/cloud/v3/inference/applications/catalog" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -188,9 +182,7 @@ async def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return await self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 990e025c..0521e2e5 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -147,9 +147,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", body=maybe_transform( { "containers": containers, @@ -265,9 +263,7 @@ def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -329,9 +325,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", page=SyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -382,9 +376,7 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,9 +416,7 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,9 +457,7 @@ def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,9 +505,7 @@ def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -567,9 +553,7 @@ def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -689,9 +673,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", body=await async_maybe_transform( { "containers": containers, @@ -807,9 +789,7 @@ async def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, @@ -871,9 +851,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments", page=AsyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -924,9 +902,7 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -966,9 +942,7 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1009,9 +983,7 @@ async def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1059,9 +1031,7 @@ async def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1109,9 +1079,7 @@ async def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index e243a63a..3a46cbd0 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -91,9 +91,7 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=SyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, @@ -180,9 +178,7 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=AsyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index 6009835e..c9934320 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -73,9 +73,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors", page=SyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -121,9 +119,7 @@ def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return self._get( - f"/cloud/v3/inference/flavors/{flavor_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,9 +178,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors", page=AsyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -230,9 +224,7 @@ async def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return await self._get( - f"/cloud/v3/inference/flavors/{flavor_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index 8b2b1ca1..86dd2f3c 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -123,9 +123,7 @@ def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return self._get( - "/cloud/v3/inference/capacity" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -189,9 +187,7 @@ async def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return await self._get( - "/cloud/v3/inference/capacity" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 0baea891..c34dfc0a 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -86,9 +86,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", body=maybe_transform( { "name": name, @@ -139,9 +137,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", page=SyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -193,9 +189,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -235,9 +229,7 @@ def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -286,9 +278,7 @@ def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=maybe_transform( { "password": password, @@ -364,9 +354,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", body=await async_maybe_transform( { "name": name, @@ -417,9 +405,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials", page=AsyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -471,9 +457,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -513,9 +497,7 @@ async def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -564,9 +546,7 @@ async def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=await async_maybe_transform( { "password": password, diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index 9ff5126f..6b168d22 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -79,9 +79,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", body=maybe_transform( { "data": data, @@ -132,9 +130,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", page=SyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -186,9 +182,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,9 +222,7 @@ def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,9 +268,7 @@ def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", body=maybe_transform( { "data": data, @@ -350,9 +340,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", body=await async_maybe_transform( { "data": data, @@ -403,9 +391,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets", page=AsyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -457,9 +443,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -499,9 +483,7 @@ async def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,9 +529,7 @@ async def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", body=await async_maybe_transform( { "data": data, diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 63158c8b..23ba0073 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -85,9 +85,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -171,9 +169,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index 375adf86..c23fde30 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -110,9 +110,7 @@ def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", body=maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -178,9 +176,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -234,9 +230,7 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -308,9 +302,7 @@ def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -367,9 +359,7 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -452,9 +442,7 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -556,9 +544,7 @@ async def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", body=await async_maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -624,9 +610,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -680,9 +664,7 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -754,9 +736,7 @@ async def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/images/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -813,9 +793,7 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -898,9 +876,7 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 31942533..66a09771 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -235,9 +235,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -304,9 +302,7 @@ def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -456,9 +452,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}", page=SyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -552,9 +546,7 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -663,9 +655,7 @@ def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=maybe_transform( { "action": action, @@ -716,9 +706,7 @@ def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -771,9 +759,7 @@ def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=maybe_transform( { "name": name, @@ -819,9 +805,7 @@ def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -860,9 +844,7 @@ def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -918,9 +900,7 @@ def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -962,9 +942,7 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1011,9 +989,7 @@ def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1055,9 +1031,7 @@ def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1107,9 +1081,7 @@ def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=maybe_transform( { "name": name, @@ -1287,9 +1259,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -1356,9 +1326,7 @@ async def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1508,9 +1476,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}", page=AsyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -1604,9 +1570,7 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1715,9 +1679,7 @@ async def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=await async_maybe_transform( { "action": action, @@ -1768,9 +1730,7 @@ async def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=await async_maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -1823,9 +1783,7 @@ async def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=await async_maybe_transform( { "name": name, @@ -1871,9 +1829,7 @@ async def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1912,9 +1868,7 @@ async def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1970,9 +1924,7 @@ async def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2014,9 +1966,7 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2063,9 +2013,7 @@ async def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2107,9 +2055,7 @@ async def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=await async_maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -2159,9 +2105,7 @@ async def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 58e644ef..261241ba 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -77,9 +77,7 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -311,9 +309,7 @@ def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -372,9 +368,7 @@ def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -441,9 +435,7 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -675,9 +667,7 @@ async def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -736,9 +726,7 @@ async def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index 77f2ea82..c24b208c 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -87,9 +87,7 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -168,9 +166,7 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index 4e66a509..d807001b 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -70,9 +70,7 @@ def list( duplicate prefixes are not returned. """ return self._get( - "/cloud/public/v1/ipranges/egress" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -131,9 +129,7 @@ async def list( duplicate prefixes are not returned. """ return await self._get( - "/cloud/public/v1/ipranges/egress" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index 7399935c..cda6a936 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -216,9 +216,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", body=maybe_transform( { "keypair": keypair, @@ -354,9 +352,7 @@ def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=maybe_transform( { "add_ons": add_ons, @@ -403,9 +399,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -447,9 +441,7 @@ def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -492,9 +484,7 @@ def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -533,9 +523,7 @@ def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -574,9 +562,7 @@ def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -615,9 +601,7 @@ def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -659,9 +643,7 @@ def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -837,9 +819,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", body=await async_maybe_transform( { "keypair": keypair, @@ -975,9 +955,7 @@ async def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=await async_maybe_transform( { "add_ons": add_ons, @@ -1024,9 +1002,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1068,9 +1044,7 @@ async def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1113,9 +1087,7 @@ async def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1154,9 +1126,7 @@ async def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1195,9 +1165,7 @@ async def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1236,9 +1204,7 @@ async def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1280,9 +1246,7 @@ async def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=await async_maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/clusters/nodes.py b/src/gcore/resources/cloud/k8s/clusters/nodes.py index 6ab3f1ba..4518d8b9 100644 --- a/src/gcore/resources/cloud/k8s/clusters/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/nodes.py @@ -76,9 +76,7 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -126,9 +124,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,9 +187,7 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -241,9 +235,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py index fedba09c..797c0e6e 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py @@ -79,9 +79,7 @@ def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -132,9 +130,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -200,9 +196,7 @@ async def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -253,9 +247,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 38dfa4a7..72cb9321 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -130,9 +130,7 @@ def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=maybe_transform( { "flavor_id": flavor_id, @@ -210,9 +208,7 @@ def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -262,9 +258,7 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -306,9 +300,7 @@ def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,9 +342,7 @@ def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -397,9 +387,7 @@ def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -504,9 +492,7 @@ async def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=await async_maybe_transform( { "flavor_id": flavor_id, @@ -584,9 +570,7 @@ async def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=await async_maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -636,9 +620,7 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -680,9 +662,7 @@ async def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -724,9 +704,7 @@ async def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -771,9 +749,7 @@ async def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=await async_maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/flavors.py b/src/gcore/resources/cloud/k8s/flavors.py index 4996c836..0823633e 100644 --- a/src/gcore/resources/cloud/k8s/flavors.py +++ b/src/gcore/resources/cloud/k8s/flavors.py @@ -79,9 +79,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -157,9 +155,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index 2c10d310..f3ac5aff 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -92,9 +92,7 @@ def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -159,9 +157,7 @@ async def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index c24a04dd..8d126cd7 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -76,9 +76,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -145,9 +143,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index 447e8047..17a2a8ea 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py @@ -118,9 +118,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", body=maybe_transform( { "action": action, @@ -170,9 +168,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +207,7 @@ def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -252,9 +246,7 @@ def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -322,9 +314,7 @@ def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=maybe_transform( { "action": action, @@ -430,9 +420,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", body=await async_maybe_transform( { "action": action, @@ -482,9 +470,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,9 +509,7 @@ async def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -564,9 +548,7 @@ async def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -634,9 +616,7 @@ async def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=await async_maybe_transform( { "action": action, diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py index a4b1e8b5..c4ba95fd 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -106,9 +106,7 @@ def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=maybe_transform( { "compare_type": compare_type, @@ -158,9 +156,7 @@ def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -202,9 +198,7 @@ def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -246,9 +240,7 @@ def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -320,9 +312,7 @@ def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=maybe_transform( { "compare_type": compare_type, @@ -422,9 +412,7 @@ async def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=await async_maybe_transform( { "compare_type": compare_type, @@ -474,9 +462,7 @@ async def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -518,9 +504,7 @@ async def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -562,9 +546,7 @@ async def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -636,9 +618,7 @@ async def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=await async_maybe_transform( { "compare_type": compare_type, diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index df3a8019..8959a6b4 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -127,9 +127,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -221,9 +219,7 @@ def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -283,9 +279,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -340,9 +334,7 @@ def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +382,7 @@ def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -499,9 +489,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=await async_maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -593,9 +581,7 @@ async def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=await async_maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -655,9 +641,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -712,9 +696,7 @@ async def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -762,9 +744,7 @@ async def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 2a76d970..e6225101 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -207,9 +207,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -301,9 +299,7 @@ def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=maybe_transform( { "logging": logging, @@ -381,9 +377,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", page=SyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -441,9 +435,7 @@ def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,9 +477,7 @@ def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -533,9 +523,7 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -587,9 +575,7 @@ def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -720,9 +706,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -814,9 +798,7 @@ async def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=await async_maybe_transform( { "logging": logging, @@ -894,9 +876,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}", page=AsyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -954,9 +934,7 @@ async def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -998,9 +976,7 @@ async def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=await async_maybe_transform( {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams ), @@ -1048,9 +1024,7 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1102,9 +1076,7 @@ async def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index bedfa5eb..38ecf843 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -81,9 +81,7 @@ def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -156,9 +154,7 @@ async def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index c262d9a8..cc1baa93 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -115,9 +115,7 @@ def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=maybe_transform( { "delay": delay, @@ -179,9 +177,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -278,9 +274,7 @@ async def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=await async_maybe_transform( { "delay": delay, @@ -342,9 +336,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 2ef413c0..29d440f7 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -131,9 +131,7 @@ def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=maybe_transform( { "address": address, @@ -197,9 +195,7 @@ def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -315,9 +311,7 @@ async def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=await async_maybe_transform( { "address": address, @@ -381,9 +375,7 @@ async def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index e7141924..3ee27f95 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -147,9 +147,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", body=maybe_transform( { "lb_algorithm": lb_algorithm, @@ -267,9 +265,7 @@ def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=maybe_transform( { "ca_secret_id": ca_secret_id, @@ -335,9 +331,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -393,9 +387,7 @@ def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -440,9 +432,7 @@ def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -553,9 +543,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", body=await async_maybe_transform( { "lb_algorithm": lb_algorithm, @@ -673,9 +661,7 @@ async def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=await async_maybe_transform( { "ca_secret_id": ca_secret_id, @@ -741,9 +727,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -799,9 +783,7 @@ async def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -846,9 +828,7 @@ async def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 97ac74d7..624132ba 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -69,9 +69,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -110,9 +108,7 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -169,9 +165,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -210,9 +204,7 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 2e9585fa..2c4ca366 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -120,9 +120,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -205,9 +203,7 @@ def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=maybe_transform( { "name": name, @@ -274,9 +270,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", page=SyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -336,9 +330,7 @@ def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -383,9 +375,7 @@ def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -470,9 +460,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -555,9 +543,7 @@ async def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=await async_maybe_transform( { "name": name, @@ -624,9 +610,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}", page=AsyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -686,9 +670,7 @@ async def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -733,9 +715,7 @@ async def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 018bfae0..52cf6cf8 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -92,9 +92,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -151,9 +149,7 @@ def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=maybe_transform( { "external_gateway_info": external_gateway_info, @@ -203,9 +199,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", page=SyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -255,9 +249,7 @@ def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -309,9 +301,7 @@ def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=maybe_transform( { "subnet_id": subnet_id, @@ -360,9 +350,7 @@ def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=maybe_transform({"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -402,9 +390,7 @@ def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,9 +459,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -532,9 +516,7 @@ async def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=await async_maybe_transform( { "external_gateway_info": external_gateway_info, @@ -584,9 +566,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}", page=AsyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -636,9 +616,7 @@ async def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -690,9 +668,7 @@ async def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=await async_maybe_transform( { "subnet_id": subnet_id, @@ -741,9 +717,7 @@ async def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=await async_maybe_transform( {"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams ), @@ -785,9 +759,7 @@ async def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 14ed3385..d7879d72 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -125,9 +125,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", body=maybe_transform( { "cidr": cidr, @@ -229,9 +227,7 @@ def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=maybe_transform( { "dns_nameservers": dns_nameservers, @@ -317,9 +313,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", page=SyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -379,9 +373,7 @@ def delete( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -426,9 +418,7 @@ def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -532,9 +522,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", body=await async_maybe_transform( { "cidr": cidr, @@ -636,9 +624,7 @@ async def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=await async_maybe_transform( { "dns_nameservers": dns_nameservers, @@ -724,9 +710,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}", page=AsyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -786,9 +770,7 @@ async def delete( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -833,9 +815,7 @@ async def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index d06de2c4..bb5119c8 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -80,9 +80,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -125,9 +123,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -166,9 +162,7 @@ def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -207,9 +201,7 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -272,9 +264,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -317,9 +307,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -358,9 +346,7 @@ async def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -399,9 +385,7 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 316da27f..cb6c69b4 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -83,7 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", body=maybe_transform( { "name": name, @@ -142,7 +142,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", page=SyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -193,9 +193,7 @@ def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._delete( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,9 +226,7 @@ def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -271,9 +267,7 @@ def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._put( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", body=maybe_transform( { "name": name, @@ -345,7 +339,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", body=await async_maybe_transform( { "name": name, @@ -404,7 +398,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", + "/cloud/v1/projects", page=AsyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -455,9 +449,7 @@ async def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._delete( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -490,9 +482,7 @@ async def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -533,9 +523,7 @@ async def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._put( - f"/cloud/v1/projects/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 3adb5a00..915d900d 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -65,9 +65,7 @@ def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return self._get( - "/cloud/v2/client_quotas" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/client_quotas", + "/cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -105,9 +103,7 @@ def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -140,9 +136,7 @@ def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/global_quotas/{client_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -186,9 +180,7 @@ async def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return await self._get( - "/cloud/v2/client_quotas" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/client_quotas", + "/cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,9 +218,7 @@ async def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -261,9 +251,7 @@ async def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/global_quotas/{client_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 128238fc..6857110a 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -79,9 +79,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", body=maybe_transform( { "description": description, @@ -129,9 +127,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", page=SyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -177,9 +173,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -212,9 +206,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -275,9 +267,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", body=await async_maybe_transform( { "description": description, @@ -325,9 +315,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v2/limits_request", + "/cloud/v2/limits_request", page=AsyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -373,9 +361,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -408,9 +394,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/limits_request/{request_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index c2ed0980..b9d06835 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -85,7 +85,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", + "/cloud/v1/regions", page=SyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -138,9 +138,7 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/regions/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -213,7 +211,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", + "/cloud/v1/regions", page=AsyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -266,9 +264,7 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/regions/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index b9ed4772..4b07607a 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -72,9 +72,7 @@ def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -118,9 +116,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,9 +177,7 @@ async def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -227,9 +221,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 7d41597b..0ba3414e 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -129,9 +129,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -174,9 +172,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -214,9 +210,7 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -253,9 +247,7 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -295,9 +287,7 @@ def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=maybe_transform({"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -381,9 +371,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -426,9 +414,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -466,9 +452,7 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -505,9 +489,7 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,9 +529,7 @@ async def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=await async_maybe_transform( {"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams ), diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index 0a3a776d..d0c860a9 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -69,9 +69,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -112,9 +110,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -172,9 +168,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -215,9 +209,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index 9c1812de..74f68017 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -78,9 +78,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,9 +146,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index c7f5e4e6..5225429a 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -92,9 +92,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=maybe_transform( { "duration": duration, @@ -147,9 +145,7 @@ def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=maybe_transform( { "duration": duration, @@ -193,9 +189,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -234,9 +228,7 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,9 +268,7 @@ def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -317,9 +307,7 @@ def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -393,9 +381,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=await async_maybe_transform( { "duration": duration, @@ -448,9 +434,7 @@ async def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=await async_maybe_transform( { "duration": duration, @@ -494,9 +478,7 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -535,9 +517,7 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -577,9 +557,7 @@ async def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=await async_maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -618,9 +596,7 @@ async def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index 44d071e6..fe46b299 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -279,9 +279,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=maybe_transform( { "type": type, @@ -335,9 +333,7 @@ def update( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=maybe_transform({"is_vip": is_vip}, reserved_fixed_ip_update_params.ReservedFixedIPUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -404,9 +400,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=SyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -463,9 +457,7 @@ def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -504,9 +496,7 @@ def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -753,9 +743,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=await async_maybe_transform( { "type": type, @@ -809,9 +797,7 @@ async def update( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=await async_maybe_transform( {"is_vip": is_vip}, reserved_fixed_ip_update_params.ReservedFixedIPUpdateParams ), @@ -880,9 +866,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=AsyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -939,9 +923,7 @@ async def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -980,9 +962,7 @@ async def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 947e07af..966a51e0 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -79,9 +79,7 @@ def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -120,9 +118,7 @@ def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -164,9 +160,7 @@ def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -211,9 +205,7 @@ def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -256,9 +248,7 @@ def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), @@ -321,9 +311,7 @@ async def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -362,9 +350,7 @@ async def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -406,9 +392,7 @@ async def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -453,9 +437,7 @@ async def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=await async_maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -498,9 +480,7 @@ async def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 297e8a02..e23a92ad 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -86,9 +86,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}", page=SyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -144,9 +142,7 @@ def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,9 +187,7 @@ def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,9 +236,7 @@ def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -320,9 +312,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}", page=AsyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -378,9 +368,7 @@ async def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +413,7 @@ async def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -476,9 +462,7 @@ async def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index 4886e5bd..aacd3921 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -126,9 +126,7 @@ def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=maybe_transform( { "description": description, @@ -181,9 +179,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -277,9 +273,7 @@ def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=maybe_transform( { "direction": direction, @@ -403,9 +397,7 @@ async def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=await async_maybe_transform( { "description": description, @@ -458,9 +450,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -554,9 +544,7 @@ async def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=await async_maybe_transform( { "direction": direction, diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 30e98b08..5961799b 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -97,9 +97,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", body=maybe_transform( { "security_group": security_group, @@ -174,9 +172,7 @@ def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=maybe_transform( { "changed_rules": changed_rules, @@ -232,9 +228,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", page=SyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -287,9 +281,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -331,9 +323,7 @@ def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -373,9 +363,7 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -414,9 +402,7 @@ def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -483,9 +469,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", body=await async_maybe_transform( { "security_group": security_group, @@ -560,9 +544,7 @@ async def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=await async_maybe_transform( { "changed_rules": changed_rules, @@ -618,9 +600,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}", page=AsyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -673,9 +653,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -717,9 +695,7 @@ async def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=await async_maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -759,9 +735,7 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -800,9 +774,7 @@ async def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 970602db..061b0876 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -90,9 +90,7 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", body=maybe_transform( { "name": name, @@ -143,9 +141,7 @@ def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=maybe_transform({"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -190,9 +186,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", page=SyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -245,9 +239,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -287,9 +279,7 @@ def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -362,9 +352,7 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", body=await async_maybe_transform( { "name": name, @@ -415,9 +403,7 @@ async def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=await async_maybe_transform( {"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams ), @@ -464,9 +450,7 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}", page=AsyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -519,9 +503,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -561,9 +543,7 @@ async def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 63be5a85..967c4f16 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -156,7 +156,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", + "/cloud/v1/tasks", page=SyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -213,9 +213,7 @@ def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v1/tasks/acknowledge_all" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -260,9 +258,7 @@ def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -297,9 +293,7 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/cloud/v1/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -437,7 +431,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", + "/cloud/v1/tasks", page=AsyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -494,9 +488,7 @@ async def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v1/tasks/acknowledge_all" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -541,9 +533,7 @@ async def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -578,9 +568,7 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/cloud/v1/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index c9795e74..8758b3ab 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -139,9 +139,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/usage_report" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/usage_report", + "/cloud/v1/usage_report", body=maybe_transform( { "time_from": time_from, @@ -279,9 +277,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/usage_report" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/usage_report", + "/cloud/v1/usage_report", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index ad4a9d8b..2f16d40d 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -85,9 +85,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", body=maybe_transform( { "role": role, @@ -141,9 +139,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", body=maybe_transform( { "role": role, @@ -195,9 +191,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", page=SyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -243,9 +237,7 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ return self._delete( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -308,9 +300,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", body=await async_maybe_transform( { "role": role, @@ -364,9 +354,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", body=await async_maybe_transform( { "role": role, @@ -418,9 +406,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments" - if self._client._base_url_overridden - else "https://api.gcore.com//cloud/v1/users/assignments", + "/cloud/v1/users/assignments", page=AsyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -466,9 +452,7 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ return await self._delete( - f"/cloud/v1/users/assignments/{assignment_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 11bf5ecd..9c40ea2e 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -288,9 +288,7 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", body=maybe_transform( { "image_id": image_id, @@ -376,9 +374,7 @@ def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=maybe_transform( { "name": name, @@ -460,9 +456,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", page=SyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -531,9 +525,7 @@ def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -590,9 +582,7 @@ def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=maybe_transform( { "instance_id": instance_id, @@ -649,9 +639,7 @@ def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=maybe_transform({"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -700,9 +688,7 @@ def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -750,9 +736,7 @@ def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -802,9 +786,7 @@ def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -853,9 +835,7 @@ def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1115,9 +1095,7 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", body=await async_maybe_transform( { "image_id": image_id, @@ -1203,9 +1181,7 @@ async def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=await async_maybe_transform( { "name": name, @@ -1287,9 +1263,7 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}", page=AsyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -1358,9 +1332,7 @@ async def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1417,9 +1389,7 @@ async def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=await async_maybe_transform( { "instance_id": instance_id, @@ -1476,9 +1446,7 @@ async def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=await async_maybe_transform( {"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams ), @@ -1529,9 +1497,7 @@ async def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=await async_maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -1579,9 +1545,7 @@ async def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1631,9 +1595,7 @@ async def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=await async_maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1682,9 +1644,7 @@ async def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" - if self._client._base_url_overridden - else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py index edad6bbe..099fe2fd 100644 --- a/src/gcore/resources/dns/dns.py +++ b/src/gcore/resources/dns/dns.py @@ -104,9 +104,7 @@ def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return self._get( - "/dns/v2/platform/info" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/platform/info", + "/dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -143,7 +141,7 @@ def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", + "/dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -209,9 +207,7 @@ async def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return await self._get( - "/dns/v2/platform/info" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/platform/info", + "/dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -248,7 +244,7 @@ async def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", + "/dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/locations.py b/src/gcore/resources/dns/locations.py index a6c27797..3b571e04 100644 --- a/src/gcore/resources/dns/locations.py +++ b/src/gcore/resources/dns/locations.py @@ -54,7 +54,7 @@ def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return self._get( - "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", + "/dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -73,9 +73,7 @@ def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return self._get( - "/dns/v2/locations/continents" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/continents", + "/dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -94,9 +92,7 @@ def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return self._get( - "/dns/v2/locations/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/countries", + "/dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -115,9 +111,7 @@ def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return self._get( - "/dns/v2/locations/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/regions", + "/dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -157,7 +151,7 @@ async def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return await self._get( - "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", + "/dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -176,9 +170,7 @@ async def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return await self._get( - "/dns/v2/locations/continents" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/continents", + "/dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -197,9 +189,7 @@ async def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return await self._get( - "/dns/v2/locations/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/countries", + "/dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -218,9 +208,7 @@ async def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return await self._get( - "/dns/v2/locations/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/locations/regions", + "/dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index 90cbb48b..3359b610 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -82,9 +82,7 @@ def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return self._get( - "/dns/v2/monitor/metrics" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -162,9 +160,7 @@ async def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return await self._get( - "/dns/v2/monitor/metrics" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/pickers/pickers.py b/src/gcore/resources/dns/pickers/pickers.py index 5cbf16a7..c08f6586 100644 --- a/src/gcore/resources/dns/pickers/pickers.py +++ b/src/gcore/resources/dns/pickers/pickers.py @@ -63,7 +63,7 @@ def list( ) -> PickerListResponse: """Returns list of picker""" return self._get( - "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", + "/dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -107,7 +107,7 @@ async def list( ) -> PickerListResponse: """Returns list of picker""" return await self._get( - "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", + "/dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/pickers/presets.py b/src/gcore/resources/dns/pickers/presets.py index 6a8db18b..a816c8cc 100644 --- a/src/gcore/resources/dns/pickers/presets.py +++ b/src/gcore/resources/dns/pickers/presets.py @@ -51,9 +51,7 @@ def list( ) -> PresetListResponse: """Returns list of picker preset""" return self._get( - "/dns/v2/pickers/presets" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/pickers/presets", + "/dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -93,9 +91,7 @@ async def list( ) -> PresetListResponse: """Returns list of picker preset""" return await self._get( - "/dns/v2/pickers/presets" - if self._client._base_url_overridden - else "https://api.gcore.com//dns/v2/pickers/presets", + "/dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/dnssec.py b/src/gcore/resources/dns/zones/dnssec.py index c5dcb39b..e91a9d09 100644 --- a/src/gcore/resources/dns/zones/dnssec.py +++ b/src/gcore/resources/dns/zones/dnssec.py @@ -69,9 +69,7 @@ def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", body=maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -105,9 +103,7 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -162,9 +158,7 @@ async def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", body=await async_maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -198,9 +192,7 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/dnssec" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index 18f66d20..15085076 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -222,9 +222,7 @@ def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -278,9 +276,7 @@ def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/rrsets" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -331,9 +327,7 @@ def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -372,9 +366,7 @@ def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -419,9 +411,7 @@ def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -480,9 +470,7 @@ def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -690,9 +678,7 @@ async def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, @@ -746,9 +732,7 @@ async def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/rrsets" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -799,9 +783,7 @@ async def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -840,9 +822,7 @@ async def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -887,9 +867,7 @@ async def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -948,9 +926,7 @@ async def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 7092460c..765d77eb 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -143,7 +143,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", body=maybe_transform( { "name": name, @@ -225,7 +225,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -283,9 +283,7 @@ def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._delete( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -320,9 +318,7 @@ def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/analyze/{name}/delegation-status" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -355,9 +351,7 @@ def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/disable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +384,7 @@ def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/enable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +417,7 @@ def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/export" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -460,9 +450,7 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -533,9 +521,7 @@ def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/statistics" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -608,9 +594,7 @@ def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._post( - f"/dns/v2/zones/{zone_name}/import" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import", body=maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -683,9 +667,7 @@ def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return self._put( - f"/dns/v2/zones/{path_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}", body=maybe_transform( { "body_name": body_name, @@ -798,7 +780,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", body=await async_maybe_transform( { "name": name, @@ -880,7 +862,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", + "/dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -938,9 +920,7 @@ async def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._delete( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -975,9 +955,7 @@ async def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/analyze/{name}/delegation-status" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1010,9 +988,7 @@ async def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/disable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1045,9 +1021,7 @@ async def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/enable" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1080,9 +1054,7 @@ async def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/export" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1115,9 +1087,7 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}", + f"/dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1188,9 +1158,7 @@ async def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/statistics" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1263,9 +1231,7 @@ async def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/import" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import", body=await async_maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1338,9 +1304,7 @@ async def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return await self._put( - f"/dns/v2/zones/{path_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}", body=await async_maybe_transform( { "body_name": body_name, diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index 6344b4c8..21e9fb4c 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -121,7 +121,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", body=maybe_transform( { "binary": binary, @@ -208,9 +208,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=maybe_transform( { "binary": binary, @@ -307,7 +305,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", page=SyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -357,9 +355,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -390,9 +386,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,9 +418,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -522,7 +514,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", body=await async_maybe_transform( { "binary": binary, @@ -609,9 +601,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=await async_maybe_transform( { "binary": binary, @@ -708,7 +698,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", + "/fastedge/v1/apps", page=AsyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -758,9 +748,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -791,9 +779,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -825,9 +811,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/apps/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}", body=await async_maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py index c38308f9..8f589ab0 100644 --- a/src/gcore/resources/fastedge/apps/logs.py +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -94,9 +94,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs", page=SyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, @@ -189,9 +187,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs", page=AsyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index 142fa332..c88f90da 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -67,9 +67,7 @@ def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return self._post( - "/fastedge/v1/binaries/raw" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw", body=read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -89,9 +87,7 @@ def list( ) -> BinaryListResponse: """List binaries""" return self._get( - "/fastedge/v1/binaries" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries", + "/fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,9 +119,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -156,9 +150,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +203,7 @@ async def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return await self._post( - "/fastedge/v1/binaries/raw" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw", body=await async_read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -233,9 +223,7 @@ async def list( ) -> BinaryListResponse: """List binaries""" return await self._get( - "/fastedge/v1/binaries" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/binaries", + "/fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,9 +255,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,9 +286,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/binaries/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/fastedge.py b/src/gcore/resources/fastedge/fastedge.py index 43091582..d4ba7cf3 100644 --- a/src/gcore/resources/fastedge/fastedge.py +++ b/src/gcore/resources/fastedge/fastedge.py @@ -123,7 +123,7 @@ def get_account_overview( ) -> Client: """Get status and limits for the client""" return self._get( - "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", + "/fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +187,7 @@ async def get_account_overview( ) -> Client: """Get status and limits for the client""" return await self._get( - "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", + "/fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py index a39f434b..42193e54 100644 --- a/src/gcore/resources/fastedge/kv_stores.py +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -72,7 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", body=maybe_transform( { "byod": byod, @@ -112,7 +112,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -148,9 +148,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,9 +179,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -220,9 +216,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", body=maybe_transform( { "byod": byod, @@ -286,7 +280,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", body=await async_maybe_transform( { "byod": byod, @@ -326,7 +320,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", + "/fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -362,9 +356,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -395,9 +387,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -434,9 +424,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/kv/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}", body=await async_maybe_transform( { "byod": byod, diff --git a/src/gcore/resources/fastedge/secrets.py b/src/gcore/resources/fastedge/secrets.py index 32e39e18..81685e61 100644 --- a/src/gcore/resources/fastedge/secrets.py +++ b/src/gcore/resources/fastedge/secrets.py @@ -83,9 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", body=maybe_transform( { "name": name, @@ -133,9 +131,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=maybe_transform( { "comment": comment, @@ -179,9 +175,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -226,9 +220,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -263,9 +255,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -305,9 +295,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=maybe_transform( { "name": name, @@ -375,9 +363,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", body=await async_maybe_transform( { "name": name, @@ -425,9 +411,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "comment": comment, @@ -471,9 +455,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/secrets" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/secrets", + "/fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -518,9 +500,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -555,9 +535,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -597,9 +575,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/secrets/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/fastedge/statistics.py b/src/gcore/resources/fastedge/statistics.py index 2768b1c7..4b344931 100644 --- a/src/gcore/resources/fastedge/statistics.py +++ b/src/gcore/resources/fastedge/statistics.py @@ -83,9 +83,7 @@ def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/calls" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -143,9 +141,7 @@ def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/app_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -224,9 +220,7 @@ async def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/calls" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -284,9 +278,7 @@ async def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/app_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/fastedge/templates.py b/src/gcore/resources/fastedge/templates.py index 55ba0f87..d58d3110 100644 --- a/src/gcore/resources/fastedge/templates.py +++ b/src/gcore/resources/fastedge/templates.py @@ -93,9 +93,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", body=maybe_transform( { "binary_id": binary_id, @@ -151,9 +149,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", page=SyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -201,9 +197,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -238,9 +232,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -289,9 +281,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", body=maybe_transform( { "binary_id": binary_id, @@ -371,9 +361,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", body=await async_maybe_transform( { "binary_id": binary_id, @@ -429,9 +417,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template" - if self._client._base_url_overridden - else "https://api.gcore.com//fastedge/v1/template", + "/fastedge/v1/template", page=AsyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -479,9 +465,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -516,9 +500,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -567,9 +549,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/template/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}", body=await async_maybe_transform( { "binary_id": binary_id, diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index 3cabd1c3..aca5b46f 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -82,9 +82,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", body=maybe_transform( { "client_user": client_user, @@ -151,9 +149,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -202,9 +198,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -236,9 +230,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -303,9 +295,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", body=await async_maybe_transform( { "client_user": client_user, @@ -372,9 +362,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -423,9 +411,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -457,9 +443,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens/{token_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/iam.py b/src/gcore/resources/iam/iam.py index 0072cb39..7f409c61 100644 --- a/src/gcore/resources/iam/iam.py +++ b/src/gcore/resources/iam/iam.py @@ -75,7 +75,7 @@ def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return self._get( - "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", + "/iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +123,7 @@ async def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return await self._get( - "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", + "/iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index 9337eadb..f411d577 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -104,9 +104,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", body=maybe_transform( { "auth_types": auth_types, @@ -158,7 +156,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", + "/iam/users", page=SyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -204,9 +202,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -237,9 +233,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -289,9 +283,7 @@ def invite( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/iam/clients/invite_user" - if self._client._base_url_overridden - else "https://api.gcore.com//iam/clients/invite_user", + "/iam/clients/invite_user", body=maybe_transform( { "client_id": client_id, @@ -385,9 +377,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", body=await async_maybe_transform( { "auth_types": auth_types, @@ -439,7 +429,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", + "/iam/users", page=AsyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -485,9 +475,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -518,9 +506,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/users/{user_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//iam/users/{user_id}", + f"/iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -570,9 +556,7 @@ async def invite( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/iam/clients/invite_user" - if self._client._base_url_overridden - else "https://api.gcore.com//iam/clients/invite_user", + "/iam/clients/invite_user", body=await async_maybe_transform( { "client_id": client_id, diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index 50000889..26b3bc96 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -74,9 +74,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -124,9 +122,7 @@ def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", body=maybe_transform( { "announce": announce, @@ -195,9 +191,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -245,9 +239,7 @@ async def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/sifter/v2/protected_addresses/announces" - if self._client._base_url_overridden - else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces", body=await async_maybe_transform( { "announce": announce, diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py index a9cc8e57..e0699398 100644 --- a/src/gcore/resources/security/events.py +++ b/src/gcore/resources/security/events.py @@ -88,9 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs" - if self._client._base_url_overridden - else "https://api.gcore.com//security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs", page=SyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, @@ -176,9 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs" - if self._client._base_url_overridden - else "https://api.gcore.com//security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs", page=AsyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py index c4a4459e..307f3c0d 100644 --- a/src/gcore/resources/security/profile_templates.py +++ b/src/gcore/resources/security/profile_templates.py @@ -55,9 +55,7 @@ def list( profile. Client receives only common and created for him profile templates. """ return self._get( - "/security/iaas/profile-templates" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/profile-templates", + "/security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -101,9 +99,7 @@ async def list( profile. Client receives only common and created for him profile templates. """ return await self._get( - "/security/iaas/profile-templates" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/profile-templates", + "/security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index b54bb4af..8394bd69 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -78,9 +78,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", body=maybe_transform( { "fields": fields, @@ -124,9 +122,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -172,9 +168,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -205,9 +199,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,9 +234,7 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}/recreate" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate", body=maybe_transform( { "fields": fields, @@ -290,9 +280,7 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", body=maybe_transform( { "fields": fields, @@ -358,9 +346,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", body=await async_maybe_transform( { "fields": fields, @@ -404,9 +390,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/iaas/v2/profiles" - if self._client._base_url_overridden - else "https://api.gcore.com//security/iaas/v2/profiles", + "/security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -452,9 +436,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,9 +467,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -522,9 +502,7 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}/recreate" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate", body=await async_maybe_transform( { "fields": fields, @@ -570,9 +548,7 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}", body=await async_maybe_transform( { "fields": fields, diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index 4f2b6b24..e6c589fa 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -108,9 +108,7 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -150,9 +148,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets", page=SyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, @@ -200,9 +196,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -272,9 +266,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -314,9 +306,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets", page=AsyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, @@ -364,9 +354,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/cors.py b/src/gcore/resources/storage/buckets/cors.py index 2cbefd77..77a3e045 100644 --- a/src/gcore/resources/storage/buckets/cors.py +++ b/src/gcore/resources/storage/buckets/cors.py @@ -74,9 +74,7 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -113,9 +111,7 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -176,9 +172,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=await async_maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -215,9 +209,7 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/lifecycle.py b/src/gcore/resources/storage/buckets/lifecycle.py index 60182808..b80dffaf 100644 --- a/src/gcore/resources/storage/buckets/lifecycle.py +++ b/src/gcore/resources/storage/buckets/lifecycle.py @@ -78,9 +78,7 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=maybe_transform({"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -117,9 +115,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -185,9 +181,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=await async_maybe_transform( {"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams ), @@ -226,9 +220,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/policy.py b/src/gcore/resources/storage/buckets/policy.py index 41c123c5..cca549f9 100644 --- a/src/gcore/resources/storage/buckets/policy.py +++ b/src/gcore/resources/storage/buckets/policy.py @@ -71,9 +71,7 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -111,9 +109,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,9 +144,7 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -210,9 +204,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +242,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -287,9 +277,7 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index ee32e77e..1db372ae 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -85,9 +85,7 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials", body=maybe_transform( { "delete_sftp_password": delete_sftp_password, @@ -169,9 +167,7 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials", body=await async_maybe_transform( { "delete_sftp_password": delete_sftp_password, diff --git a/src/gcore/resources/storage/locations.py b/src/gcore/resources/storage/locations.py index be55ab51..bce1aa37 100644 --- a/src/gcore/resources/storage/locations.py +++ b/src/gcore/resources/storage/locations.py @@ -69,9 +69,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v2/locations" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v2/locations", + "/storage/provisioning/v2/locations", page=SyncOffsetPage[Location], options=make_request_options( extra_headers=extra_headers, @@ -137,9 +135,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v2/locations" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v2/locations", + "/storage/provisioning/v2/locations", page=AsyncOffsetPage[Location], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/storage/statistics.py b/src/gcore/resources/storage/statistics.py index 25cbc05c..dbaf7b6e 100644 --- a/src/gcore/resources/storage/statistics.py +++ b/src/gcore/resources/storage/statistics.py @@ -82,9 +82,7 @@ def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/total" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total", body=maybe_transform( { "from_": from_, @@ -151,9 +149,7 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/series" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series", body=maybe_transform( { "from_": from_, @@ -233,9 +229,7 @@ async def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/total" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total", body=await async_maybe_transform( { "from_": from_, @@ -302,9 +296,7 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/series" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series", body=await async_maybe_transform( { "from_": from_, diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index 26ee34ae..c3a2d71e 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -138,9 +138,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/provisioning/v2/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v2/storage", + "/storage/provisioning/v2/storage", body=maybe_transform( { "location": location, @@ -190,9 +188,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/storage/provisioning/v2/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}", + f"/storage/provisioning/v2/storage/{storage_id}", body=maybe_transform( { "expires": expires, @@ -264,9 +260,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v3/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v3/storage", + "/storage/provisioning/v3/storage", page=SyncOffsetPage[Storage], options=make_request_options( extra_headers=extra_headers, @@ -318,9 +312,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -352,9 +344,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -389,9 +379,7 @@ def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,9 +413,7 @@ def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -466,9 +452,7 @@ def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -558,9 +542,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/provisioning/v2/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v2/storage", + "/storage/provisioning/v2/storage", body=await async_maybe_transform( { "location": location, @@ -610,9 +592,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/storage/provisioning/v2/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}", + f"/storage/provisioning/v2/storage/{storage_id}", body=await async_maybe_transform( { "expires": expires, @@ -684,9 +664,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v3/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//storage/provisioning/v3/storage", + "/storage/provisioning/v3/storage", page=AsyncOffsetPage[Storage], options=make_request_options( extra_headers=extra_headers, @@ -738,9 +716,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -772,9 +748,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -809,9 +783,7 @@ async def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -845,9 +817,7 @@ async def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -888,9 +858,7 @@ async def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" - if self._client._base_url_overridden - else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 02a61389..6811e64c 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -351,7 +351,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", body=maybe_transform( { "task_name": task_name, @@ -437,7 +437,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", page=SyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -490,9 +490,7 @@ def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/streaming/ai/tasks/{task_id}/cancel" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -564,9 +562,7 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/streaming/ai/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -645,7 +641,7 @@ def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", + "/streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -987,7 +983,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", body=await async_maybe_transform( { "task_name": task_name, @@ -1073,7 +1069,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", + "/streaming/ai/tasks", page=AsyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -1126,9 +1122,7 @@ async def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/streaming/ai/tasks/{task_id}/cancel" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1200,9 +1194,7 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/streaming/ai/tasks/{task_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1281,7 +1273,7 @@ async def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", + "/streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index 2435c18a..757bde4d 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -78,9 +78,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", body=maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -113,9 +111,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", body=maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -152,9 +148,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", page=SyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -191,9 +185,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -224,9 +216,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -257,9 +247,7 @@ def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -322,9 +310,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -357,9 +343,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -396,9 +380,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/broadcasts", + "/streaming/broadcasts", page=AsyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -435,9 +417,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -468,9 +448,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -501,9 +479,7 @@ async def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index a67d8d61..3c45afb6 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -72,9 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/directories" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories", + "/streaming/directories", body=maybe_transform( { "name": name, @@ -119,9 +117,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", body=maybe_transform( { "name": name, @@ -170,9 +166,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -205,9 +199,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -230,9 +222,7 @@ def get_tree( This endpoint returns hierarchical data about directories in video hosting. """ return self._get( - "/streaming/directories/tree" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories/tree", + "/streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -289,9 +279,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/directories" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories", + "/streaming/directories", body=await async_maybe_transform( { "name": name, @@ -336,9 +324,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", body=await async_maybe_transform( { "name": name, @@ -387,9 +373,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -422,9 +406,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/directories/{directory_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -447,9 +429,7 @@ async def get_tree( This endpoint returns hierarchical data about directories in video hosting. """ return await self._get( - "/streaming/directories/tree" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/directories/tree", + "/streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/players.py b/src/gcore/resources/streaming/players.py index e7717e34..b2590c29 100644 --- a/src/gcore/resources/streaming/players.py +++ b/src/gcore/resources/streaming/players.py @@ -72,7 +72,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", body=maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,9 +109,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", body=maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -146,7 +144,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", page=SyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -183,9 +181,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,9 +212,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -250,9 +244,7 @@ def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - f"/streaming/players/{player_id}/preview" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -309,7 +301,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", body=await async_maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -346,9 +338,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", body=await async_maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -383,7 +373,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", + "/streaming/players", page=AsyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -420,9 +410,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -453,9 +441,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/players/{player_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}", + f"/streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -487,9 +473,7 @@ async def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - f"/streaming/players/{player_id}/preview" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index a7804425..aea53517 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -221,9 +221,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", body=maybe_transform( { "active": active, @@ -358,9 +356,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", body=maybe_transform( { "active": active, @@ -413,9 +409,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", page=SyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -452,9 +446,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,9 +477,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -518,9 +508,7 @@ def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}/videos" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -722,9 +710,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", body=await async_maybe_transform( { "active": active, @@ -859,9 +845,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", body=await async_maybe_transform( { "active": active, @@ -914,9 +898,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/playlists", + "/streaming/playlists", page=AsyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -953,9 +935,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -986,9 +966,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1019,9 +997,7 @@ async def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}/videos" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index 7bd710f3..d91c5569 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -98,9 +98,7 @@ def list( is a paid feature. """ return self._get( - "/streaming/quality_sets" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets", + "/streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -150,9 +148,7 @@ def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - "/streaming/quality_sets/default" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets/default", + "/streaming/quality_sets/default", body=maybe_transform( { "live": live, @@ -244,9 +240,7 @@ async def list( is a paid feature. """ return await self._get( - "/streaming/quality_sets" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets", + "/streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -296,9 +290,7 @@ async def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - "/streaming/quality_sets/default" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/quality_sets/default", + "/streaming/quality_sets/default", body=await async_maybe_transform( { "live": live, diff --git a/src/gcore/resources/streaming/restreams.py b/src/gcore/resources/streaming/restreams.py index 2be0770f..91f24ab2 100644 --- a/src/gcore/resources/streaming/restreams.py +++ b/src/gcore/resources/streaming/restreams.py @@ -67,9 +67,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", body=maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -102,9 +100,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", body=maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -139,9 +135,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", page=SyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -178,9 +172,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -211,9 +203,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -266,9 +256,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", body=await async_maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -301,9 +289,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", body=await async_maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -338,9 +324,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/restreams", + "/streaming/restreams", page=AsyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -377,9 +361,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -410,9 +392,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/restreams/{restream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 913d43c1..82b2a1f6 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -124,9 +124,7 @@ def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/ffprobe" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -194,9 +192,7 @@ def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -265,9 +261,7 @@ def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -329,9 +323,7 @@ def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -384,9 +376,7 @@ def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/max_stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/max_stream", + "/streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -440,9 +430,7 @@ def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/popular" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/popular", + "/streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -493,9 +481,7 @@ def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/storage", + "/streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -547,9 +533,7 @@ def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream", + "/streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -625,9 +609,7 @@ def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/uniqs", + "/streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -731,9 +713,7 @@ def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/cdn/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -808,9 +788,7 @@ def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/views" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/views", + "/streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -869,9 +847,7 @@ def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/browsers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/browsers", + "/streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -923,9 +899,7 @@ def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/countries", + "/streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -978,9 +952,7 @@ def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/hosts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/hosts", + "/streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1033,9 +1005,7 @@ def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/systems" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/systems", + "/streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1088,9 +1058,7 @@ def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/embeds" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/embeds", + "/streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1143,9 +1111,7 @@ def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/regions", + "/streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1209,9 +1175,7 @@ def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/heatmap" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/heatmap", + "/streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1263,9 +1227,7 @@ def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/storage_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1315,9 +1277,7 @@ def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/transcoding_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1382,9 +1342,7 @@ def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1453,9 +1411,7 @@ def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1517,9 +1473,7 @@ def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1597,9 +1551,7 @@ async def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/ffprobe" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1667,9 +1619,7 @@ async def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1738,9 +1688,7 @@ async def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1802,9 +1750,7 @@ async def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1857,9 +1803,7 @@ async def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/max_stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/max_stream", + "/streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1913,9 +1857,7 @@ async def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/popular" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/popular", + "/streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1966,9 +1908,7 @@ async def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/storage" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/storage", + "/streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2020,9 +1960,7 @@ async def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/stream", + "/streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2098,9 +2036,7 @@ async def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/uniqs", + "/streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2204,9 +2140,7 @@ async def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/cdn/uniqs" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2281,9 +2215,7 @@ async def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/views" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/views", + "/streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2342,9 +2274,7 @@ async def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/browsers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/browsers", + "/streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2396,9 +2326,7 @@ async def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/countries" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/countries", + "/streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2451,9 +2379,7 @@ async def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/hosts" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/hosts", + "/streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2506,9 +2432,7 @@ async def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/systems" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/systems", + "/streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2561,9 +2485,7 @@ async def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/embeds" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/embeds", + "/streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2616,9 +2538,7 @@ async def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/regions" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/regions", + "/streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2682,9 +2602,7 @@ async def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/heatmap" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/heatmap", + "/streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2736,9 +2654,7 @@ async def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/storage_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2788,9 +2704,7 @@ async def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/transcoding_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2855,9 +2769,7 @@ async def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/viewers" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2926,9 +2838,7 @@ async def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2990,9 +2900,7 @@ async def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration/total" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index 8f37a1e4..780f045b 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -131,9 +131,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -185,9 +183,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", body=maybe_transform( { "height": height, @@ -229,9 +225,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -264,9 +258,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -298,9 +290,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -332,9 +322,7 @@ def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -448,9 +436,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -502,9 +488,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", body=await async_maybe_transform( { "height": height, @@ -546,9 +530,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -581,9 +563,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -615,9 +595,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -649,9 +627,7 @@ async def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 33a7b0fc..acc3a7f3 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -255,7 +255,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", body=maybe_transform( { "name": name, @@ -308,9 +308,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", body=maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -349,7 +347,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", page=SyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -411,9 +409,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -445,9 +441,7 @@ def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -578,9 +572,7 @@ def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", body=maybe_transform( { "duration": duration, @@ -620,9 +612,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -673,9 +663,7 @@ def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -746,9 +734,7 @@ def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/start_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -785,9 +771,7 @@ def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/stop_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1008,7 +992,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", body=await async_maybe_transform( { "name": name, @@ -1061,9 +1045,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", body=await async_maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1102,7 +1084,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", + "/streaming/streams", page=AsyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -1164,9 +1146,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1198,9 +1178,7 @@ async def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1331,9 +1309,7 @@ async def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", body=await async_maybe_transform( { "duration": duration, @@ -1373,9 +1349,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1426,9 +1400,7 @@ async def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/clip_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1499,9 +1471,7 @@ async def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/start_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1538,9 +1508,7 @@ async def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/stop_recording" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index fe18befd..5930fd58 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -134,9 +134,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", body=maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -190,9 +188,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", body=maybe_transform( { "language": language, @@ -231,9 +227,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -266,9 +260,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,9 +292,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -421,9 +411,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", body=await async_maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -477,9 +465,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", body=await async_maybe_transform( { "language": language, @@ -518,9 +504,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -553,9 +537,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -587,9 +569,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles/{id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index 6c6aec17..256d7d6f 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -161,7 +161,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", body=maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -422,9 +422,7 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", body=maybe_transform( { "name": name, @@ -522,7 +520,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", page=SyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -581,9 +579,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -635,9 +631,7 @@ def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos/batch" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/batch", + "/streaming/videos/batch", body=maybe_transform({"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, @@ -690,9 +684,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -756,9 +748,7 @@ def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -792,9 +782,7 @@ def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - "/streaming/videos/names" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/names", + "/streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -924,7 +912,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", body=await async_maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1185,9 +1173,7 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", body=await async_maybe_transform( { "name": name, @@ -1285,7 +1271,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", + "/streaming/videos", page=AsyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -1344,9 +1330,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1398,9 +1382,7 @@ async def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos/batch" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/batch", + "/streaming/videos/batch", body=await async_maybe_transform( {"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams ), @@ -1457,9 +1439,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}", + f"/streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1523,9 +1503,7 @@ async def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1559,9 +1537,7 @@ async def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - "/streaming/videos/names" - if self._client._base_url_overridden - else "https://api.gcore.com//streaming/videos/names", + "/streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py index 855bd508..6f4aca32 100644 --- a/src/gcore/resources/waap/advanced_rules.py +++ b/src/gcore/resources/waap/advanced_rules.py @@ -51,9 +51,7 @@ def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return self._get( - "/waap/v1/advanced-rules/descriptor" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -93,9 +91,7 @@ async def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return await self._get( - "/waap/v1/advanced-rules/descriptor" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index 78e82b31..11d40a03 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -88,9 +88,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", body=maybe_transform( { "name": name, @@ -154,9 +152,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", body=maybe_transform( { "block": block, @@ -214,9 +210,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", page=SyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -264,9 +258,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -299,9 +291,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -359,9 +349,7 @@ def preview( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/preview-custom-page" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page", body=maybe_transform( { "error": error, @@ -442,9 +430,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", body=await async_maybe_transform( { "name": name, @@ -508,9 +494,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", body=await async_maybe_transform( { "block": block, @@ -568,9 +552,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets", page=AsyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -618,9 +600,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -653,9 +633,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/custom-page-sets/{set_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -713,9 +691,7 @@ async def preview( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/preview-custom-page" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page", body=await async_maybe_transform( { "error": error, diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index 2bfd7a2a..f46e4f46 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -104,9 +104,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", body=maybe_transform( { "action": action, @@ -186,9 +184,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -282,9 +278,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", page=SyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -338,9 +332,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -376,9 +368,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -420,9 +410,7 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -509,9 +497,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", body=await async_maybe_transform( { "action": action, @@ -591,9 +577,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -687,9 +671,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules", page=AsyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -743,9 +725,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -781,9 +761,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -825,9 +803,7 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py index df3a60cf..426426f5 100644 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -82,9 +82,7 @@ def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -117,9 +115,7 @@ def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -184,9 +180,7 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", page=SyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -237,9 +231,7 @@ def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -289,9 +281,7 @@ def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", body=maybe_transform( { "description_file_location": description_file_location, @@ -344,9 +334,7 @@ def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload", body=maybe_transform( { "file_data": file_data, @@ -412,9 +400,7 @@ async def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -447,9 +433,7 @@ async def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -514,9 +498,7 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", page=AsyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -567,9 +549,7 @@ async def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -619,9 +599,7 @@ async def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings", body=await async_maybe_transform( { "description_file_location": description_file_location, @@ -674,9 +652,7 @@ async def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload", body=await async_maybe_transform( { "file_data": file_data, diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py index b75e11b4..a6b25b2e 100644 --- a/src/gcore/resources/waap/domains/api_path_groups.py +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -65,9 +65,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -121,9 +119,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index df8cefbc..ea3057ec 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -84,9 +84,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", body=maybe_transform( { "http_scheme": http_scheme, @@ -145,9 +143,7 @@ def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", body=maybe_transform( { "api_groups": api_groups, @@ -242,9 +238,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", page=SyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -303,9 +297,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -343,9 +335,7 @@ def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -412,9 +402,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", body=await async_maybe_transform( { "http_scheme": http_scheme, @@ -473,9 +461,7 @@ async def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", body=await async_maybe_transform( { "api_groups": api_groups, @@ -570,9 +556,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths", page=AsyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -631,9 +615,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -671,9 +653,7 @@ async def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index e98cf62e..e81e575e 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -93,9 +93,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", body=maybe_transform( { "action": action, @@ -158,9 +156,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -230,9 +226,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", page=SyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -285,9 +279,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -324,9 +316,7 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -365,9 +355,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -409,9 +397,7 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -482,9 +468,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", body=await async_maybe_transform( { "action": action, @@ -547,9 +531,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -619,9 +601,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules", page=AsyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -674,9 +654,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -713,9 +691,7 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -754,9 +730,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -798,9 +772,7 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index 9cf7af61..644191c1 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -198,9 +198,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", body=maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -249,7 +247,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", + "/waap/v1/domains", page=SyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -300,9 +298,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -335,9 +331,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -370,9 +364,7 @@ def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/rule-sets" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -410,9 +402,7 @@ def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -510,9 +500,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", body=await async_maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -561,7 +549,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", + "/waap/v1/domains", page=AsyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -612,9 +600,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -647,9 +633,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -682,9 +666,7 @@ async def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/rule-sets" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -722,9 +704,7 @@ async def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index fc6c2b83..3dbdde0b 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -91,9 +91,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", body=maybe_transform( { "action": action, @@ -155,9 +153,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -227,9 +223,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", page=SyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -282,9 +276,7 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -321,9 +313,7 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -362,9 +352,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -406,9 +394,7 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -477,9 +463,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", body=await async_maybe_transform( { "action": action, @@ -541,9 +525,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -613,9 +595,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules", page=AsyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -668,9 +648,7 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -707,9 +685,7 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -748,9 +724,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -792,9 +766,7 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 8d81b5e7..8b57783e 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -93,9 +93,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", body=maybe_transform( { "author": author, @@ -155,9 +153,7 @@ def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=maybe_transform( { "author": author, @@ -232,9 +228,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", page=SyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -289,9 +283,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -329,9 +321,7 @@ def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,9 +392,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", body=await async_maybe_transform( { "author": author, @@ -464,9 +452,7 @@ async def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=await async_maybe_transform( { "author": author, @@ -541,9 +527,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences", page=AsyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -598,9 +582,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -638,9 +620,7 @@ async def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 068c932d..924fe5e2 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -106,9 +106,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights", page=SyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -160,9 +158,7 @@ def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,9 +199,7 @@ def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", body=maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -295,9 +289,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights", page=AsyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -349,9 +341,7 @@ async def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,9 +382,7 @@ async def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}", body=await async_maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py index fe8edb00..fcaabeaa 100644 --- a/src/gcore/resources/waap/domains/settings.py +++ b/src/gcore/resources/waap/domains/settings.py @@ -74,9 +74,7 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", body=maybe_transform( { "api": api, @@ -116,9 +114,7 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -179,9 +175,7 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", body=await async_maybe_transform( { "api": api, @@ -221,9 +215,7 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/settings" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index b912f295..94514578 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -98,9 +98,7 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks", page=SyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -163,9 +161,7 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info", page=SyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -231,9 +227,7 @@ def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/stats" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -286,9 +280,7 @@ def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,9 +374,7 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests", page=SyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -450,9 +440,7 @@ def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/traffic" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -532,9 +520,7 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks", page=AsyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -597,9 +583,7 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info", page=AsyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -665,9 +649,7 @@ async def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/stats" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -720,9 +702,7 @@ async def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -816,9 +796,7 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests", page=AsyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -884,9 +862,7 @@ async def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/traffic" - if self._client._base_url_overridden - else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index 8b9a2234..5de0a968 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -87,9 +87,7 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/security-insights/types", + "/waap/v1/security-insights/types", page=SyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, @@ -174,9 +172,7 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/security-insights/types", + "/waap/v1/security-insights/types", page=AsyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/ip_info/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py index 2e1fbd71..0c0050f2 100644 --- a/src/gcore/resources/waap/ip_info/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -95,9 +95,7 @@ def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-time-series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -144,9 +142,7 @@ def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/blocked-requests" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -193,9 +189,7 @@ def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ddos" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -235,9 +229,7 @@ def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ip-info" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -282,9 +274,7 @@ def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-urls" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -333,9 +323,7 @@ def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-user-agents" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -384,9 +372,7 @@ def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-sessions" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -429,9 +415,7 @@ def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-map" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -495,9 +479,7 @@ async def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-time-series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -544,9 +526,7 @@ async def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/blocked-requests" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -593,9 +573,7 @@ async def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ddos" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -635,9 +613,7 @@ async def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ip-info" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -682,9 +658,7 @@ async def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-urls" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -733,9 +707,7 @@ async def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-user-agents" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -784,9 +756,7 @@ async def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-sessions" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -829,9 +799,7 @@ async def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-map" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/ip_info/metrics.py b/src/gcore/resources/waap/ip_info/metrics.py index 7d04cbd5..dd60d037 100644 --- a/src/gcore/resources/waap/ip_info/metrics.py +++ b/src/gcore/resources/waap/ip_info/metrics.py @@ -77,9 +77,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/counts" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -151,9 +149,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/counts" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py index 9a12a3c4..07a8bc66 100644 --- a/src/gcore/resources/waap/organizations.py +++ b/src/gcore/resources/waap/organizations.py @@ -82,9 +82,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/organizations", + "/waap/v1/organizations", page=SyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, @@ -162,9 +160,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/organizations", + "/waap/v1/organizations", page=AsyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py index 23840a49..e383f236 100644 --- a/src/gcore/resources/waap/statistics.py +++ b/src/gcore/resources/waap/statistics.py @@ -87,9 +87,7 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/statistics/series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/statistics/series", + "/waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -171,9 +169,7 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/statistics/series" - if self._client._base_url_overridden - else "https://api.gcore.com//waap/v1/statistics/series", + "/waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py index 543f186c..879f3f47 100644 --- a/src/gcore/resources/waap/tags.py +++ b/src/gcore/resources/waap/tags.py @@ -88,7 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", + "/waap/v1/tags", page=SyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", + "/waap/v1/tags", page=AsyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index 01f7d84c..d5509b5f 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -147,7 +147,7 @@ def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return self._get( - "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", + "/waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -219,7 +219,7 @@ async def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return await self._get( - "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", + "/waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), From 7c6868cb1c465b98f89bc1866cf697a104b561a2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Oct 2025 10:10:44 +0000 Subject: [PATCH 363/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index dac0e15a..663313c2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0783502211f81fa32d09abbc34b4678c3d8e7dc885194ad89102ca02bcdc0cc6.yml -openapi_spec_hash: aa485ffac6ffc8cb771ddb451a65a71b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-308c971e681f1c4d36c47ee545e002a364e4491797694a069f3b4cddc9202347.yml +openapi_spec_hash: e579cb5c51a08bb69634651da66148ac config_hash: 399dda838c78c5d92532b7efcaaa0345 From 7678f5cf836f00afd2a185e9bc6cc22477198805 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:15:15 +0000 Subject: [PATCH 364/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/cloud/cost_reports.py | 66 ++++++++++------------ src/gcore/resources/cloud/usage_reports.py | 28 +++++---- 3 files changed, 45 insertions(+), 53 deletions(-) diff --git a/.stats.yml b/.stats.yml index 663313c2..624ae5a2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-308c971e681f1c4d36c47ee545e002a364e4491797694a069f3b4cddc9202347.yml -openapi_spec_hash: e579cb5c51a08bb69634651da66148ac +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5a7ab6a73d8b5baaf7f48ba5dc59aab2288689470607e793205aafe92a0ae48f.yml +openapi_spec_hash: bb229625bc538d51d91bd2edffa2048f config_hash: 399dda838c78c5d92532b7efcaaa0345 diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 1ee323ee..29b0e2e0 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -110,12 +110,11 @@ def get_aggregated( /v1/`reservation_cost_report`/totals, as the results from this report will not be accurate. - Receiving data from the past hour might lead to incomplete statistics. For the - most accurate data, we recommend accessing the statistics after at least one - hour. Typically, updates are available within a 24-hour period, although the - frequency can vary. Maintenance periods or other exceptions may cause delays, - potentially extending beyond 24 hours until the servers are back online and the - missing data is filled in. + Data from the past hour may not reflect the full set of statistics. For the most + complete and accurate results, we recommend accessing the data at least one hour + after the relevant time period. Updates are generally available within a 24-hour + window, though timing can vary. Scheduled maintenance or other exceptions may + occasionally cause delays beyond 24 hours. Args: time_from: The start date of the report period (ISO 8601). The report starts from the @@ -226,12 +225,11 @@ def get_aggregated_monthly( spent billing units (e.g., hours or GB) for resources. The "`time_to`" parameter represents all days in the specified month. - Receiving data from the past hour might lead to incomplete statistics. For the - most accurate data, we recommend accessing the statistics after at least one - hour. Typically, updates are available within a 24-hour period, although the - frequency can vary. Maintenance periods or other exceptions may cause delays, - potentially extending beyond 24 hours until the servers are back online and the - missing data is filled in. + Data from the past hour may not reflect the full set of statistics. For the most + complete and accurate results, we recommend accessing the data at least one hour + after the relevant time period. Updates are generally available within a 24-hour + window, though timing can vary. Scheduled maintenance or other exceptions may + occasionally cause delays beyond 24 hours. Args: regions: List of region IDs. @@ -344,12 +342,11 @@ def get_detailed( /v1/`reservation_cost_report`/totals, as the results from this report will not be accurate. - Receiving data from the past hour might lead to incomplete statistics. For the - most accurate data, we recommend accessing the statistics after at least one - hour. Typically, updates are available within a 24-hour period, although the - frequency can vary. Maintenance periods or other exceptions may cause delays, - potentially extending beyond 24 hours until the servers are back online and the - missing data is filled in. + Data from the past hour may not reflect the full set of statistics. For the most + complete and accurate results, we recommend accessing the data at least one hour + after the relevant time period. Updates are generally available within a 24-hour + window, though timing can vary. Scheduled maintenance or other exceptions may + occasionally cause delays beyond 24 hours. Args: time_from: The start date of the report period (ISO 8601). The report starts from the @@ -495,12 +492,11 @@ async def get_aggregated( /v1/`reservation_cost_report`/totals, as the results from this report will not be accurate. - Receiving data from the past hour might lead to incomplete statistics. For the - most accurate data, we recommend accessing the statistics after at least one - hour. Typically, updates are available within a 24-hour period, although the - frequency can vary. Maintenance periods or other exceptions may cause delays, - potentially extending beyond 24 hours until the servers are back online and the - missing data is filled in. + Data from the past hour may not reflect the full set of statistics. For the most + complete and accurate results, we recommend accessing the data at least one hour + after the relevant time period. Updates are generally available within a 24-hour + window, though timing can vary. Scheduled maintenance or other exceptions may + occasionally cause delays beyond 24 hours. Args: time_from: The start date of the report period (ISO 8601). The report starts from the @@ -611,12 +607,11 @@ async def get_aggregated_monthly( spent billing units (e.g., hours or GB) for resources. The "`time_to`" parameter represents all days in the specified month. - Receiving data from the past hour might lead to incomplete statistics. For the - most accurate data, we recommend accessing the statistics after at least one - hour. Typically, updates are available within a 24-hour period, although the - frequency can vary. Maintenance periods or other exceptions may cause delays, - potentially extending beyond 24 hours until the servers are back online and the - missing data is filled in. + Data from the past hour may not reflect the full set of statistics. For the most + complete and accurate results, we recommend accessing the data at least one hour + after the relevant time period. Updates are generally available within a 24-hour + window, though timing can vary. Scheduled maintenance or other exceptions may + occasionally cause delays beyond 24 hours. Args: regions: List of region IDs. @@ -729,12 +724,11 @@ async def get_detailed( /v1/`reservation_cost_report`/totals, as the results from this report will not be accurate. - Receiving data from the past hour might lead to incomplete statistics. For the - most accurate data, we recommend accessing the statistics after at least one - hour. Typically, updates are available within a 24-hour period, although the - frequency can vary. Maintenance periods or other exceptions may cause delays, - potentially extending beyond 24 hours until the servers are back online and the - missing data is filled in. + Data from the past hour may not reflect the full set of statistics. For the most + complete and accurate results, we recommend accessing the data at least one hour + after the relevant time period. Updates are generally available within a 24-hour + window, though timing can vary. Scheduled maintenance or other exceptions may + occasionally cause delays beyond 24 hours. Args: time_from: The start date of the report period (ISO 8601). The report starts from the diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index 8758b3ab..f0667ea6 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -95,14 +95,13 @@ def get( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UsageReport: - """Receiving data from the past hour might lead to incomplete statistics. + """Data from the past hour may not reflect the full set of statistics. - For the - most accurate data, we recommend accessing the statistics after at least one - hour. Typically, updates are available within a 24-hour period, although the - frequency can vary. Maintenance periods or other exceptions may cause delays, - potentially extending beyond 24 hours until the servers are back online and the - missing data is filled in. + For the most + complete and accurate results, we recommend accessing the data at least one hour + after the relevant time period. Updates are generally available within a 24-hour + window, though timing can vary. Scheduled maintenance or other exceptions may + occasionally cause delays beyond 24 hours. Args: time_from: The start date of the report period (ISO 8601). The report starts from the @@ -233,14 +232,13 @@ async def get( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UsageReport: - """Receiving data from the past hour might lead to incomplete statistics. - - For the - most accurate data, we recommend accessing the statistics after at least one - hour. Typically, updates are available within a 24-hour period, although the - frequency can vary. Maintenance periods or other exceptions may cause delays, - potentially extending beyond 24 hours until the servers are back online and the - missing data is filled in. + """Data from the past hour may not reflect the full set of statistics. + + For the most + complete and accurate results, we recommend accessing the data at least one hour + after the relevant time period. Updates are generally available within a 24-hour + window, though timing can vary. Scheduled maintenance or other exceptions may + occasionally cause delays beyond 24 hours. Args: time_from: The start date of the report period (ISO 8601). The report starts from the From 237c979fb03ca3344f531dd3bc2e7dc354c1ebd7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 08:13:22 +0000 Subject: [PATCH 365/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/resources/cloud/cost_reports.py | 16 ++++++++-------- src/gcore/resources/cloud/usage_reports.py | 8 ++++---- .../cloud/cost_report_get_aggregated_params.py | 4 ++-- .../cloud/cost_report_get_detailed_params.py | 4 ++-- src/gcore/types/cloud/usage_report_get_params.py | 4 ++-- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.stats.yml b/.stats.yml index 624ae5a2..117150da 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5a7ab6a73d8b5baaf7f48ba5dc59aab2288689470607e793205aafe92a0ae48f.yml -openapi_spec_hash: bb229625bc538d51d91bd2edffa2048f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e03e7effe72aa3668976b9a30a76b188e8d2aa2f4210730cf46e66c70c62c116.yml +openapi_spec_hash: da83e364ba42681bf2570c5d90372d97 config_hash: 399dda838c78c5d92532b7efcaaa0345 diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 29b0e2e0..730f57bc 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -118,10 +118,10 @@ def get_aggregated( Args: time_from: The start date of the report period (ISO 8601). The report starts from the - beginning of this day. + beginning of this day in UTC. time_to: The end date of the report period (ISO 8601). The report ends just before the - beginning of this day. + beginning of this day in UTC. enable_last_day: Expenses for the last specified day are taken into account. As the default, False. @@ -350,10 +350,10 @@ def get_detailed( Args: time_from: The start date of the report period (ISO 8601). The report starts from the - beginning of this day. + beginning of this day in UTC. time_to: The end date of the report period (ISO 8601). The report ends just before the - beginning of this day. + beginning of this day in UTC. enable_last_day: Expenses for the last specified day are taken into account. As the default, False. @@ -500,10 +500,10 @@ async def get_aggregated( Args: time_from: The start date of the report period (ISO 8601). The report starts from the - beginning of this day. + beginning of this day in UTC. time_to: The end date of the report period (ISO 8601). The report ends just before the - beginning of this day. + beginning of this day in UTC. enable_last_day: Expenses for the last specified day are taken into account. As the default, False. @@ -732,10 +732,10 @@ async def get_detailed( Args: time_from: The start date of the report period (ISO 8601). The report starts from the - beginning of this day. + beginning of this day in UTC. time_to: The end date of the report period (ISO 8601). The report ends just before the - beginning of this day. + beginning of this day in UTC. enable_last_day: Expenses for the last specified day are taken into account. As the default, False. diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index f0667ea6..0cb9178c 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -105,10 +105,10 @@ def get( Args: time_from: The start date of the report period (ISO 8601). The report starts from the - beginning of this day. + beginning of this day in UTC. time_to: The end date of the report period (ISO 8601). The report ends just before the - beginning of this day. + beginning of this day in UTC. enable_last_day: Expenses for the last specified day are taken into account. As the default, False. @@ -242,10 +242,10 @@ async def get( Args: time_from: The start date of the report period (ISO 8601). The report starts from the - beginning of this day. + beginning of this day in UTC. time_to: The end date of the report period (ISO 8601). The report ends just before the - beginning of this day. + beginning of this day in UTC. enable_last_day: Expenses for the last specified day are taken into account. As the default, False. 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 1d79bba8..6fa2ee1f 100644 --- a/src/gcore/types/cloud/cost_report_get_aggregated_params.py +++ b/src/gcore/types/cloud/cost_report_get_aggregated_params.py @@ -46,13 +46,13 @@ class CostReportGetAggregatedParams(TypedDict, total=False): time_from: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """The start date of the report period (ISO 8601). - The report starts from the beginning of this day. + The report starts from the beginning of this day in UTC. """ time_to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """The end date of the report period (ISO 8601). - The report ends just before the beginning of this day. + The report ends just before the beginning of this day in UTC. """ enable_last_day: bool 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 a55d3a37..e7b8908e 100644 --- a/src/gcore/types/cloud/cost_report_get_detailed_params.py +++ b/src/gcore/types/cloud/cost_report_get_detailed_params.py @@ -47,13 +47,13 @@ class CostReportGetDetailedParams(TypedDict, total=False): time_from: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """The start date of the report period (ISO 8601). - The report starts from the beginning of this day. + The report starts from the beginning of this day in UTC. """ time_to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """The end date of the report period (ISO 8601). - The report ends just before the beginning of this day. + The report ends just before the beginning of this day in UTC. """ enable_last_day: bool diff --git a/src/gcore/types/cloud/usage_report_get_params.py b/src/gcore/types/cloud/usage_report_get_params.py index ea7a3e0e..176598dc 100644 --- a/src/gcore/types/cloud/usage_report_get_params.py +++ b/src/gcore/types/cloud/usage_report_get_params.py @@ -47,13 +47,13 @@ class UsageReportGetParams(TypedDict, total=False): time_from: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """The start date of the report period (ISO 8601). - The report starts from the beginning of this day. + The report starts from the beginning of this day in UTC. """ time_to: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """The end date of the report period (ISO 8601). - The report ends just before the beginning of this day. + The report ends just before the beginning of this day in UTC. """ enable_last_day: bool From 3753e79be502d6bdcfc47adbadad27e51c062e54 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 08:48:50 +0000 Subject: [PATCH 366/592] chore(internal): detect missing future annotations with ruff --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index f2b1d19f..77000739 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -225,6 +225,8 @@ select = [ "B", # remove unused imports "F401", + # check for missing future annotations + "FA102", # bare except statements "E722", # unused arguments @@ -247,6 +249,8 @@ unfixable = [ "T203", ] +extend-safe-fixes = ["FA102"] + [tool.ruff.lint.flake8-tidy-imports.banned-api] "functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead" From 0d283208bdd340e727f160f459ac4b933be36262 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 13 Oct 2025 12:15:17 +0000 Subject: [PATCH 367/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../cloud/file_shares/file_shares.py | 33 +++- .../resources/cloud/instances/instances.py | 75 +++++++- src/gcore/resources/cloud/tasks.py | 12 +- .../types/cloud/instance_update_params.py | 34 +++- src/gcore/types/cloud/task_list_params.py | 6 +- tests/api_resources/cloud/test_file_shares.py | 164 ++++++++++-------- tests/api_resources/cloud/test_instances.py | 30 +++- 8 files changed, 246 insertions(+), 112 deletions(-) diff --git a/.stats.yml b/.stats.yml index 117150da..ce1b3626 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e03e7effe72aa3668976b9a30a76b188e8d2aa2f4210730cf46e66c70c62c116.yml -openapi_spec_hash: da83e364ba42681bf2570c5d90372d97 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7692ff469c0a20a3fde59d14a30c785a1773a8b60e5be9cc1280792a56b3b9e0.yml +openapi_spec_hash: 188c9e304c287741b6a73552c939658f config_hash: 399dda838c78c5d92532b7efcaaa0345 diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index da32da6f..463ee013 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Dict, Iterable, Optional from typing_extensions import Literal, overload @@ -227,6 +228,7 @@ def create( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") def update( self, file_share_id: str, @@ -246,6 +248,9 @@ def update( """ Rename file share or update tags + **Deprecated**: Use PATCH + /v3/`file_shares`/{`project_id`}/{`region_id`}/{`file_share_id`} instead + Args: project_id: Project ID @@ -702,6 +707,7 @@ async def create( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") async def update( self, file_share_id: str, @@ -721,6 +727,9 @@ async def update( """ Rename file share or update tags + **Deprecated**: Use PATCH + /v3/`file_shares`/{`project_id`}/{`region_id`}/{`file_share_id`} instead + Args: project_id: Project ID @@ -997,8 +1006,10 @@ def __init__(self, file_shares: FileSharesResource) -> None: self.create = to_raw_response_wrapper( file_shares.create, ) - self.update = to_raw_response_wrapper( - file_shares.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + file_shares.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_raw_response_wrapper( file_shares.list, @@ -1025,8 +1036,10 @@ def __init__(self, file_shares: AsyncFileSharesResource) -> None: self.create = async_to_raw_response_wrapper( file_shares.create, ) - self.update = async_to_raw_response_wrapper( - file_shares.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + file_shares.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_raw_response_wrapper( file_shares.list, @@ -1053,8 +1066,10 @@ def __init__(self, file_shares: FileSharesResource) -> None: self.create = to_streamed_response_wrapper( file_shares.create, ) - self.update = to_streamed_response_wrapper( - file_shares.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + file_shares.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_streamed_response_wrapper( file_shares.list, @@ -1081,8 +1096,10 @@ def __init__(self, file_shares: AsyncFileSharesResource) -> None: self.create = async_to_streamed_response_wrapper( file_shares.create, ) - self.update = async_to_streamed_response_wrapper( - file_shares.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + file_shares.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_streamed_response_wrapper( file_shares.list, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 66a09771..8b0ead11 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -68,6 +68,7 @@ from ....types.cloud.instance import Instance from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.instance_interface import InstanceInterface +from ....types.cloud.tag_update_map_param import TagUpdateMapParam __all__ = ["InstancesResource", "AsyncInstancesResource"] @@ -267,7 +268,8 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - name: str, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -276,7 +278,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Instance: """ - Rename instance + Rename instance or update tags Args: project_id: Project ID @@ -285,7 +287,29 @@ def update( instance_id: Instance ID - name: Name. + name: Name + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. extra_headers: Send extra headers @@ -303,7 +327,13 @@ def update( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._patch( f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", - body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), + body=maybe_transform( + { + "name": name, + "tags": tags, + }, + instance_update_params.InstanceUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1291,7 +1321,8 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - name: str, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1300,7 +1331,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Instance: """ - Rename instance + Rename instance or update tags Args: project_id: Project ID @@ -1309,7 +1340,29 @@ async def update( instance_id: Instance ID - name: Name. + name: Name + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. extra_headers: Send extra headers @@ -1327,7 +1380,13 @@ async def update( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._patch( f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", - body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), + body=await async_maybe_transform( + { + "name": name, + "tags": tags, + }, + instance_update_params.InstanceUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 967c4f16..3a27e985 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -140,9 +140,9 @@ def list( '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', '`update_inference_application`', '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`', - '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', - '`upscale_gpu_virtual_cluster`'] + '`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: ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` @@ -415,9 +415,9 @@ def list( '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', '`update_inference_application`', '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`', - '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', - '`upscale_gpu_virtual_cluster`'] + '`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: ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` diff --git a/src/gcore/types/cloud/instance_update_params.py b/src/gcore/types/cloud/instance_update_params.py index 915a1edb..a04fb983 100644 --- a/src/gcore/types/cloud/instance_update_params.py +++ b/src/gcore/types/cloud/instance_update_params.py @@ -2,7 +2,10 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Optional +from typing_extensions import TypedDict + +from .tag_update_map_param import TagUpdateMapParam __all__ = ["InstanceUpdateParams"] @@ -14,5 +17,30 @@ class InstanceUpdateParams(TypedDict, total=False): region_id: int """Region ID""" - name: Required[str] - """Name.""" + name: str + """Name""" + + tags: Optional[TagUpdateMapParam] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index 22a319d3..c7248550 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -103,9 +103,9 @@ class TaskListParams(TypedDict, total=False): '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', '`update_inference_application`', '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`', - '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', - '`upscale_gpu_virtual_cluster`'] + '`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")] diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index 262d8a4a..adc1fc01 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -15,6 +15,8 @@ TaskIDList, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -155,36 +157,41 @@ def test_streaming_response_create_overload_2(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: - file_share = client.cloud.file_shares.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + file_share = client.cloud.file_shares.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + assert_matches_type(FileShare, file_share, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - file_share = client.cloud.file_shares.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - name="some_name", - share_settings={ - "allowed_characters": "LCD", - "path_length": "LCD", - "root_squash": True, - }, - tags={"foo": "my-tag-value"}, - ) + with pytest.warns(DeprecationWarning): + file_share = client.cloud.file_shares.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + name="some_name", + share_settings={ + "allowed_characters": "LCD", + "path_length": "LCD", + "root_squash": True, + }, + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(FileShare, file_share, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.file_shares.with_raw_response.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.file_shares.with_raw_response.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -193,27 +200,29 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.file_shares.with_streaming_response.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.file_shares.with_streaming_response.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file_share = response.parse() - assert_matches_type(FileShare, file_share, path=["response"]) + file_share = response.parse() + assert_matches_type(FileShare, file_share, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): - client.cloud.file_shares.with_raw_response.update( - file_share_id="", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + client.cloud.file_shares.with_raw_response.update( + file_share_id="", + project_id=1, + region_id=1, + ) @parametrize def test_method_list(self, client: Gcore) -> None: @@ -543,36 +552,41 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncGco @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - file_share = await async_client.cloud.file_shares.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + file_share = await async_client.cloud.file_shares.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + assert_matches_type(FileShare, file_share, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - file_share = await async_client.cloud.file_shares.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - name="some_name", - share_settings={ - "allowed_characters": "LCD", - "path_length": "LCD", - "root_squash": True, - }, - tags={"foo": "my-tag-value"}, - ) + with pytest.warns(DeprecationWarning): + file_share = await async_client.cloud.file_shares.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + name="some_name", + share_settings={ + "allowed_characters": "LCD", + "path_length": "LCD", + "root_squash": True, + }, + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(FileShare, file_share, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.file_shares.with_raw_response.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.file_shares.with_raw_response.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -581,27 +595,29 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.file_shares.with_streaming_response.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.cloud.file_shares.with_streaming_response.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file_share = await response.parse() - assert_matches_type(FileShare, file_share, path=["response"]) + file_share = await response.parse() + assert_matches_type(FileShare, file_share, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): - await async_client.cloud.file_shares.with_raw_response.update( - file_share_id="", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + await async_client.cloud.file_shares.with_raw_response.update( + file_share_id="", + project_id=1, + region_id=1, + ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/cloud/test_instances.py b/tests/api_resources/cloud/test_instances.py index 9dfe0883..3ab8c850 100644 --- a/tests/api_resources/cloud/test_instances.py +++ b/tests/api_resources/cloud/test_instances.py @@ -127,7 +127,17 @@ def test_method_update(self, client: Gcore) -> None: instance_id="instance_id", project_id=0, region_id=0, - name="my-resource", + ) + assert_matches_type(Instance, instance, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + instance = client.cloud.instances.update( + instance_id="instance_id", + project_id=0, + region_id=0, + name="instance_name", + tags={"foo": "my-tag-value"}, ) assert_matches_type(Instance, instance, path=["response"]) @@ -137,7 +147,6 @@ def test_raw_response_update(self, client: Gcore) -> None: instance_id="instance_id", project_id=0, region_id=0, - name="my-resource", ) assert response.is_closed is True @@ -151,7 +160,6 @@ def test_streaming_response_update(self, client: Gcore) -> None: instance_id="instance_id", project_id=0, region_id=0, - name="my-resource", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -168,7 +176,6 @@ def test_path_params_update(self, client: Gcore) -> None: instance_id="", project_id=0, region_id=0, - name="my-resource", ) @parametrize @@ -990,7 +997,17 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: instance_id="instance_id", project_id=0, region_id=0, - name="my-resource", + ) + assert_matches_type(Instance, instance, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + instance = await async_client.cloud.instances.update( + instance_id="instance_id", + project_id=0, + region_id=0, + name="instance_name", + tags={"foo": "my-tag-value"}, ) assert_matches_type(Instance, instance, path=["response"]) @@ -1000,7 +1017,6 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: instance_id="instance_id", project_id=0, region_id=0, - name="my-resource", ) assert response.is_closed is True @@ -1014,7 +1030,6 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None instance_id="instance_id", project_id=0, region_id=0, - name="my-resource", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1031,7 +1046,6 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: instance_id="", project_id=0, region_id=0, - name="my-resource", ) @parametrize From 896591c12d1b9bc2b37bf2d1ff1b7768d9933837 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 13 Oct 2025 14:10:54 +0000 Subject: [PATCH 368/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/resources/security/profiles.py | 8 ++++---- src/gcore/types/security/profile_create_params.py | 4 ++-- tests/api_resources/security/test_profiles.py | 10 ++++++++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index ce1b3626..783ee76d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7692ff469c0a20a3fde59d14a30c785a1773a8b60e5be9cc1280792a56b3b9e0.yml -openapi_spec_hash: 188c9e304c287741b6a73552c939658f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9f065df469027bcaa0bd19a36a0f8f132271e837c4cb058f27f3c5c740298797.yml +openapi_spec_hash: 844a27c7d8957769e1fb98965f9f1df0 config_hash: 399dda838c78c5d92532b7efcaaa0345 diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index 8394bd69..2ddf3257 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -54,8 +54,8 @@ def create( *, fields: Iterable[profile_create_params.Field], profile_template: int, + site: str, ip_address: Optional[str] | Omit = omit, - site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -83,8 +83,8 @@ def create( { "fields": fields, "profile_template": profile_template, - "ip_address": ip_address, "site": site, + "ip_address": ip_address, }, profile_create_params.ProfileCreateParams, ), @@ -322,8 +322,8 @@ async def create( *, fields: Iterable[profile_create_params.Field], profile_template: int, + site: str, ip_address: Optional[str] | Omit = omit, - site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -351,8 +351,8 @@ async def create( { "fields": fields, "profile_template": profile_template, - "ip_address": ip_address, "site": site, + "ip_address": ip_address, }, profile_create_params.ProfileCreateParams, ), diff --git a/src/gcore/types/security/profile_create_params.py b/src/gcore/types/security/profile_create_params.py index d4bd6d61..ad7b982c 100644 --- a/src/gcore/types/security/profile_create_params.py +++ b/src/gcore/types/security/profile_create_params.py @@ -13,9 +13,9 @@ class ProfileCreateParams(TypedDict, total=False): profile_template: Required[int] - ip_address: Optional[str] + site: Required[str] - site: str + ip_address: Optional[str] class Field(TypedDict, total=False): diff --git a/tests/api_resources/security/test_profiles.py b/tests/api_resources/security/test_profiles.py index ae9ed3b3..c79499ab 100644 --- a/tests/api_resources/security/test_profiles.py +++ b/tests/api_resources/security/test_profiles.py @@ -25,6 +25,7 @@ def test_method_create(self, client: Gcore) -> None: profile = client.security.profiles.create( fields=[{"base_field": 1}], profile_template=1, + site="GNC", ) assert_matches_type(ClientProfile, profile, path=["response"]) @@ -38,8 +39,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: } ], profile_template=1, + site="GNC", ip_address="123.43.2.10", - site="ED", ) assert_matches_type(ClientProfile, profile, path=["response"]) @@ -48,6 +49,7 @@ def test_raw_response_create(self, client: Gcore) -> None: response = client.security.profiles.with_raw_response.create( fields=[{"base_field": 1}], profile_template=1, + site="GNC", ) assert response.is_closed is True @@ -60,6 +62,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: with client.security.profiles.with_streaming_response.create( fields=[{"base_field": 1}], profile_template=1, + site="GNC", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -283,6 +286,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: profile = await async_client.security.profiles.create( fields=[{"base_field": 1}], profile_template=1, + site="GNC", ) assert_matches_type(ClientProfile, profile, path=["response"]) @@ -296,8 +300,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> } ], profile_template=1, + site="GNC", ip_address="123.43.2.10", - site="ED", ) assert_matches_type(ClientProfile, profile, path=["response"]) @@ -306,6 +310,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.security.profiles.with_raw_response.create( fields=[{"base_field": 1}], profile_template=1, + site="GNC", ) assert response.is_closed is True @@ -318,6 +323,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None async with async_client.security.profiles.with_streaming_response.create( fields=[{"base_field": 1}], profile_template=1, + site="GNC", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From a75a13a257a46433c5dd423ead685ae2828443bc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 14 Oct 2025 07:19:02 +0000 Subject: [PATCH 369/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 783ee76d..8a2dc2f8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9f065df469027bcaa0bd19a36a0f8f132271e837c4cb058f27f3c5c740298797.yml openapi_spec_hash: 844a27c7d8957769e1fb98965f9f1df0 -config_hash: 399dda838c78c5d92532b7efcaaa0345 +config_hash: 55ae5e2d505eb74ae52c73f854e77eb5 From e3ecdf2c0c3a173855e303c3dc7e023caecb3fcf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 14 Oct 2025 10:32:36 +0000 Subject: [PATCH 370/592] chore(cloud)!: rename inference applications deployments update method --- .stats.yml | 2 +- api.md | 2 +- .../inference/applications/deployments.py | 258 +++++++++--------- .../cloud/inference/applications/__init__.py | 2 +- ..._params.py => deployment_update_params.py} | 4 +- .../applications/test_deployments.py | 252 ++++++++--------- 6 files changed, 260 insertions(+), 260 deletions(-) rename src/gcore/types/cloud/inference/applications/{deployment_patch_params.py => deployment_update_params.py} (95%) diff --git a/.stats.yml b/.stats.yml index 8a2dc2f8..191e2bb2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9f065df469027bcaa0bd19a36a0f8f132271e837c4cb058f27f3c5c740298797.yml openapi_spec_hash: 844a27c7d8957769e1fb98965f9f1df0 -config_hash: 55ae5e2d505eb74ae52c73f854e77eb5 +config_hash: 6cf02fb49626ee44b56133d941a8ec11 diff --git a/api.md b/api.md index 86601a2c..afd2f125 100644 --- a/api.md +++ b/api.md @@ -576,10 +576,10 @@ from gcore.types.cloud.inference.applications import ( Methods: - client.cloud.inference.applications.deployments.create(\*, project_id, \*\*params) -> TaskIDList +- client.cloud.inference.applications.deployments.update(deployment_name, \*, project_id, \*\*params) -> TaskIDList - client.cloud.inference.applications.deployments.list(\*, project_id) -> InferenceApplicationDeploymentList - client.cloud.inference.applications.deployments.delete(deployment_name, \*, project_id) -> TaskIDList - client.cloud.inference.applications.deployments.get(deployment_name, \*, project_id) -> InferenceApplicationDeployment -- client.cloud.inference.applications.deployments.patch(deployment_name, \*, project_id, \*\*params) -> TaskIDList #### Templates diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index 7b62f2c2..5bfac7b7 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -18,7 +18,7 @@ ) from ....._base_client import make_request_options from .....types.cloud.task_id_list import TaskIDList -from .....types.cloud.inference.applications import deployment_patch_params, deployment_create_params +from .....types.cloud.inference.applications import deployment_create_params, deployment_update_params from .....types.cloud.inference.applications.inference_application_deployment import InferenceApplicationDeployment from .....types.cloud.inference.applications.inference_application_deployment_list import ( InferenceApplicationDeploymentList, @@ -110,25 +110,39 @@ def create( cast_to=TaskIDList, ) - def list( + def update( self, + deployment_name: str, *, project_id: int | None = None, + api_keys: SequenceNotStr[str] | Omit = omit, + components_configuration: Dict[str, Optional[deployment_update_params.ComponentsConfiguration]] | Omit = omit, + regions: Iterable[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> InferenceApplicationDeploymentList: - """ - Returns a list of your application deployments, including deployment names, - associated catalog applications, regions, component configurations, and current - status. Useful for monitoring and managing all active AI application instances. + ) -> TaskIDList: + """Updates an existing application deployment. + + You can modify the target regions + and update configurations for individual components. To disable a component, set + its value to null. Only the provided fields will be updated; all others remain + unchanged. Args: project_id: Project ID + deployment_name: Name of deployment + + api_keys: List of API keys for the application + + components_configuration: Mapping of component names to their configuration (e.g., `"model": {...}`) + + regions: Geographical regions to be updated for the deployment + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -139,17 +153,26 @@ def list( """ if project_id is None: project_id = self._client._get_cloud_project_id_path_param() - return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments", + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return self._patch( + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + body=maybe_transform( + { + "api_keys": api_keys, + "components_configuration": components_configuration, + "regions": regions, + }, + deployment_update_params.DeploymentUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceApplicationDeploymentList, + cast_to=TaskIDList, ) - def delete( + def list( self, - deployment_name: str, *, project_id: int | None = None, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -158,17 +181,15 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: + ) -> InferenceApplicationDeploymentList: """ - Deletes an existing application deployment along with all associated resources. - This action will permanently remove the deployment and **terminate all related - inference instances** that are part of the application. + Returns a list of your application deployments, including deployment names, + associated catalog applications, regions, component configurations, and current + status. Useful for monitoring and managing all active AI application instances. Args: project_id: Project ID - deployment_name: Name of deployment - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -179,17 +200,15 @@ def delete( """ if project_id is None: project_id = self._client._get_cloud_project_id_path_param() - if not deployment_name: - raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") - return self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + return self._get( + f"/cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=TaskIDList, + cast_to=InferenceApplicationDeploymentList, ) - def get( + def delete( self, deployment_name: str, *, @@ -200,13 +219,11 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> InferenceApplicationDeployment: - """Retrieves detailed information about a specific application deployment. - - The - response includes the catalog application it was created from, deployment name, - active regions, configuration of each component, and the current status of the - deployment. + ) -> TaskIDList: + """ + Deletes an existing application deployment along with all associated resources. + This action will permanently remove the deployment and **terminate all related + inference instances** that are part of the application. Args: project_id: Project ID @@ -225,47 +242,38 @@ def get( project_id = self._client._get_cloud_project_id_path_param() if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") - return self._get( + return self._delete( f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceApplicationDeployment, + cast_to=TaskIDList, ) - def patch( + def get( self, deployment_name: str, *, project_id: int | None = None, - api_keys: SequenceNotStr[str] | Omit = omit, - components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] | Omit = omit, - regions: Iterable[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """Updates an existing application deployment. + ) -> InferenceApplicationDeployment: + """Retrieves detailed information about a specific application deployment. - You can modify the target regions - and update configurations for individual components. To disable a component, set - its value to null. Only the provided fields will be updated; all others remain - unchanged. + The + response includes the catalog application it was created from, deployment name, + active regions, configuration of each component, and the current status of the + deployment. Args: project_id: Project ID deployment_name: Name of deployment - api_keys: List of API keys for the application - - components_configuration: Mapping of component names to their configuration (e.g., `"model": {...}`) - - regions: Geographical regions to be updated for the deployment - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -278,20 +286,12 @@ def patch( project_id = self._client._get_cloud_project_id_path_param() if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") - return self._patch( + return self._get( f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", - body=maybe_transform( - { - "api_keys": api_keys, - "components_configuration": components_configuration, - "regions": regions, - }, - deployment_patch_params.DeploymentPatchParams, - ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=TaskIDList, + cast_to=InferenceApplicationDeployment, ) @@ -378,25 +378,39 @@ async def create( cast_to=TaskIDList, ) - async def list( + async def update( self, + deployment_name: str, *, project_id: int | None = None, + api_keys: SequenceNotStr[str] | Omit = omit, + components_configuration: Dict[str, Optional[deployment_update_params.ComponentsConfiguration]] | Omit = omit, + regions: Iterable[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> InferenceApplicationDeploymentList: - """ - Returns a list of your application deployments, including deployment names, - associated catalog applications, regions, component configurations, and current - status. Useful for monitoring and managing all active AI application instances. + ) -> TaskIDList: + """Updates an existing application deployment. + + You can modify the target regions + and update configurations for individual components. To disable a component, set + its value to null. Only the provided fields will be updated; all others remain + unchanged. Args: project_id: Project ID + deployment_name: Name of deployment + + api_keys: List of API keys for the application + + components_configuration: Mapping of component names to their configuration (e.g., `"model": {...}`) + + regions: Geographical regions to be updated for the deployment + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -407,17 +421,26 @@ async def list( """ if project_id is None: project_id = self._client._get_cloud_project_id_path_param() - return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments", + if not deployment_name: + raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") + return await self._patch( + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + body=await async_maybe_transform( + { + "api_keys": api_keys, + "components_configuration": components_configuration, + "regions": regions, + }, + deployment_update_params.DeploymentUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceApplicationDeploymentList, + cast_to=TaskIDList, ) - async def delete( + async def list( self, - deployment_name: str, *, project_id: int | None = None, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -426,17 +449,15 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: + ) -> InferenceApplicationDeploymentList: """ - Deletes an existing application deployment along with all associated resources. - This action will permanently remove the deployment and **terminate all related - inference instances** that are part of the application. + Returns a list of your application deployments, including deployment names, + associated catalog applications, regions, component configurations, and current + status. Useful for monitoring and managing all active AI application instances. Args: project_id: Project ID - deployment_name: Name of deployment - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -447,17 +468,15 @@ async def delete( """ if project_id is None: project_id = self._client._get_cloud_project_id_path_param() - if not deployment_name: - raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") - return await self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + return await self._get( + f"/cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=TaskIDList, + cast_to=InferenceApplicationDeploymentList, ) - async def get( + async def delete( self, deployment_name: str, *, @@ -468,13 +487,11 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> InferenceApplicationDeployment: - """Retrieves detailed information about a specific application deployment. - - The - response includes the catalog application it was created from, deployment name, - active regions, configuration of each component, and the current status of the - deployment. + ) -> TaskIDList: + """ + Deletes an existing application deployment along with all associated resources. + This action will permanently remove the deployment and **terminate all related + inference instances** that are part of the application. Args: project_id: Project ID @@ -493,47 +510,38 @@ async def get( project_id = self._client._get_cloud_project_id_path_param() if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") - return await self._get( + return await self._delete( f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceApplicationDeployment, + cast_to=TaskIDList, ) - async def patch( + async def get( self, deployment_name: str, *, project_id: int | None = None, - api_keys: SequenceNotStr[str] | Omit = omit, - components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] | Omit = omit, - regions: Iterable[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """Updates an existing application deployment. + ) -> InferenceApplicationDeployment: + """Retrieves detailed information about a specific application deployment. - You can modify the target regions - and update configurations for individual components. To disable a component, set - its value to null. Only the provided fields will be updated; all others remain - unchanged. + The + response includes the catalog application it was created from, deployment name, + active regions, configuration of each component, and the current status of the + deployment. Args: project_id: Project ID deployment_name: Name of deployment - api_keys: List of API keys for the application - - components_configuration: Mapping of component names to their configuration (e.g., `"model": {...}`) - - regions: Geographical regions to be updated for the deployment - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -546,20 +554,12 @@ async def patch( project_id = self._client._get_cloud_project_id_path_param() if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") - return await self._patch( + return await self._get( f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", - body=await async_maybe_transform( - { - "api_keys": api_keys, - "components_configuration": components_configuration, - "regions": regions, - }, - deployment_patch_params.DeploymentPatchParams, - ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=TaskIDList, + cast_to=InferenceApplicationDeployment, ) @@ -570,6 +570,9 @@ def __init__(self, deployments: DeploymentsResource) -> None: self.create = to_raw_response_wrapper( deployments.create, ) + self.update = to_raw_response_wrapper( + deployments.update, + ) self.list = to_raw_response_wrapper( deployments.list, ) @@ -579,9 +582,6 @@ def __init__(self, deployments: DeploymentsResource) -> None: self.get = to_raw_response_wrapper( deployments.get, ) - self.patch = to_raw_response_wrapper( - deployments.patch, - ) class AsyncDeploymentsResourceWithRawResponse: @@ -591,6 +591,9 @@ def __init__(self, deployments: AsyncDeploymentsResource) -> None: self.create = async_to_raw_response_wrapper( deployments.create, ) + self.update = async_to_raw_response_wrapper( + deployments.update, + ) self.list = async_to_raw_response_wrapper( deployments.list, ) @@ -600,9 +603,6 @@ def __init__(self, deployments: AsyncDeploymentsResource) -> None: self.get = async_to_raw_response_wrapper( deployments.get, ) - self.patch = async_to_raw_response_wrapper( - deployments.patch, - ) class DeploymentsResourceWithStreamingResponse: @@ -612,6 +612,9 @@ def __init__(self, deployments: DeploymentsResource) -> None: self.create = to_streamed_response_wrapper( deployments.create, ) + self.update = to_streamed_response_wrapper( + deployments.update, + ) self.list = to_streamed_response_wrapper( deployments.list, ) @@ -621,9 +624,6 @@ def __init__(self, deployments: DeploymentsResource) -> None: self.get = to_streamed_response_wrapper( deployments.get, ) - self.patch = to_streamed_response_wrapper( - deployments.patch, - ) class AsyncDeploymentsResourceWithStreamingResponse: @@ -633,6 +633,9 @@ def __init__(self, deployments: AsyncDeploymentsResource) -> None: self.create = async_to_streamed_response_wrapper( deployments.create, ) + self.update = async_to_streamed_response_wrapper( + deployments.update, + ) self.list = async_to_streamed_response_wrapper( deployments.list, ) @@ -642,6 +645,3 @@ def __init__(self, deployments: AsyncDeploymentsResource) -> None: self.get = async_to_streamed_response_wrapper( deployments.get, ) - self.patch = async_to_streamed_response_wrapper( - deployments.patch, - ) diff --git a/src/gcore/types/cloud/inference/applications/__init__.py b/src/gcore/types/cloud/inference/applications/__init__.py index 1671486c..8f061c13 100644 --- a/src/gcore/types/cloud/inference/applications/__init__.py +++ b/src/gcore/types/cloud/inference/applications/__init__.py @@ -2,8 +2,8 @@ from __future__ import annotations -from .deployment_patch_params import DeploymentPatchParams as DeploymentPatchParams from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams +from .deployment_update_params import DeploymentUpdateParams as DeploymentUpdateParams from .inference_application_template import InferenceApplicationTemplate as InferenceApplicationTemplate from .inference_application_deployment import InferenceApplicationDeployment as InferenceApplicationDeployment from .inference_application_template_list import InferenceApplicationTemplateList as InferenceApplicationTemplateList diff --git a/src/gcore/types/cloud/inference/applications/deployment_patch_params.py b/src/gcore/types/cloud/inference/applications/deployment_update_params.py similarity index 95% rename from src/gcore/types/cloud/inference/applications/deployment_patch_params.py rename to src/gcore/types/cloud/inference/applications/deployment_update_params.py index 0ce4395d..8a8c6a1a 100644 --- a/src/gcore/types/cloud/inference/applications/deployment_patch_params.py +++ b/src/gcore/types/cloud/inference/applications/deployment_update_params.py @@ -8,14 +8,14 @@ from ....._types import SequenceNotStr __all__ = [ - "DeploymentPatchParams", + "DeploymentUpdateParams", "ComponentsConfiguration", "ComponentsConfigurationParameterOverrides", "ComponentsConfigurationScale", ] -class DeploymentPatchParams(TypedDict, total=False): +class DeploymentUpdateParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/tests/api_resources/cloud/inference/applications/test_deployments.py b/tests/api_resources/cloud/inference/applications/test_deployments.py index 850cc9e8..dd38dbe7 100644 --- a/tests/api_resources/cloud/inference/applications/test_deployments.py +++ b/tests/api_resources/cloud/inference/applications/test_deployments.py @@ -113,6 +113,69 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_update(self, client: Gcore) -> None: + deployment = client.cloud.inference.applications.deployments.update( + deployment_name="deployment_name", + project_id=1, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + deployment = client.cloud.inference.applications.deployments.update( + deployment_name="deployment_name", + project_id=1, + api_keys=["key1", "key2"], + components_configuration={ + "model": { + "exposed": True, + "flavor": "flavor", + "parameter_overrides": {"foo": {"value": "value"}}, + "scale": { + "max": 2, + "min": 0, + }, + } + }, + regions=[1, 2], + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.inference.applications.deployments.with_raw_response.update( + deployment_name="deployment_name", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.inference.applications.deployments.with_streaming_response.update( + deployment_name="deployment_name", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + client.cloud.inference.applications.deployments.with_raw_response.update( + deployment_name="", + project_id=1, + ) + @parametrize def test_method_list(self, client: Gcore) -> None: deployment = client.cloud.inference.applications.deployments.list( @@ -228,69 +291,6 @@ def test_path_params_get(self, client: Gcore) -> None: project_id=1, ) - @parametrize - def test_method_patch(self, client: Gcore) -> None: - deployment = client.cloud.inference.applications.deployments.patch( - deployment_name="deployment_name", - project_id=1, - ) - assert_matches_type(TaskIDList, deployment, path=["response"]) - - @parametrize - def test_method_patch_with_all_params(self, client: Gcore) -> None: - deployment = client.cloud.inference.applications.deployments.patch( - deployment_name="deployment_name", - project_id=1, - api_keys=["key1", "key2"], - components_configuration={ - "model": { - "exposed": True, - "flavor": "flavor", - "parameter_overrides": {"foo": {"value": "value"}}, - "scale": { - "max": 2, - "min": 0, - }, - } - }, - regions=[1, 2], - ) - assert_matches_type(TaskIDList, deployment, path=["response"]) - - @parametrize - def test_raw_response_patch(self, client: Gcore) -> None: - response = client.cloud.inference.applications.deployments.with_raw_response.patch( - deployment_name="deployment_name", - project_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - deployment = response.parse() - assert_matches_type(TaskIDList, deployment, path=["response"]) - - @parametrize - def test_streaming_response_patch(self, client: Gcore) -> None: - with client.cloud.inference.applications.deployments.with_streaming_response.patch( - deployment_name="deployment_name", - project_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - deployment = response.parse() - assert_matches_type(TaskIDList, deployment, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_patch(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): - client.cloud.inference.applications.deployments.with_raw_response.patch( - deployment_name="", - project_id=1, - ) - class TestAsyncDeployments: parametrize = pytest.mark.parametrize( @@ -389,6 +389,69 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.applications.deployments.update( + deployment_name="deployment_name", + project_id=1, + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + deployment = await async_client.cloud.inference.applications.deployments.update( + deployment_name="deployment_name", + project_id=1, + api_keys=["key1", "key2"], + components_configuration={ + "model": { + "exposed": True, + "flavor": "flavor", + "parameter_overrides": {"foo": {"value": "value"}}, + "scale": { + "max": 2, + "min": 0, + }, + } + }, + regions=[1, 2], + ) + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.inference.applications.deployments.with_raw_response.update( + deployment_name="deployment_name", + project_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.inference.applications.deployments.with_streaming_response.update( + deployment_name="deployment_name", + project_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + deployment = await response.parse() + assert_matches_type(TaskIDList, deployment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): + await async_client.cloud.inference.applications.deployments.with_raw_response.update( + deployment_name="", + project_id=1, + ) + @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: deployment = await async_client.cloud.inference.applications.deployments.list( @@ -503,66 +566,3 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: deployment_name="", project_id=1, ) - - @parametrize - async def test_method_patch(self, async_client: AsyncGcore) -> None: - deployment = await async_client.cloud.inference.applications.deployments.patch( - deployment_name="deployment_name", - project_id=1, - ) - assert_matches_type(TaskIDList, deployment, path=["response"]) - - @parametrize - async def test_method_patch_with_all_params(self, async_client: AsyncGcore) -> None: - deployment = await async_client.cloud.inference.applications.deployments.patch( - deployment_name="deployment_name", - project_id=1, - api_keys=["key1", "key2"], - components_configuration={ - "model": { - "exposed": True, - "flavor": "flavor", - "parameter_overrides": {"foo": {"value": "value"}}, - "scale": { - "max": 2, - "min": 0, - }, - } - }, - regions=[1, 2], - ) - assert_matches_type(TaskIDList, deployment, path=["response"]) - - @parametrize - async def test_raw_response_patch(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.inference.applications.deployments.with_raw_response.patch( - deployment_name="deployment_name", - project_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - deployment = await response.parse() - assert_matches_type(TaskIDList, deployment, path=["response"]) - - @parametrize - async def test_streaming_response_patch(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.inference.applications.deployments.with_streaming_response.patch( - deployment_name="deployment_name", - project_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - deployment = await response.parse() - assert_matches_type(TaskIDList, deployment, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_patch(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_name` but received ''"): - await async_client.cloud.inference.applications.deployments.with_raw_response.patch( - deployment_name="", - project_id=1, - ) From 4b7fba3b72a0bde4b50a0c55ee1b243dc81dea0d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 14 Oct 2025 12:15:39 +0000 Subject: [PATCH 371/592] feat(api): aggregated API specs update --- .stats.yml | 6 +- api.md | 12 - .../cloud/load_balancers/__init__.py | 14 - .../cloud/load_balancers/listeners.py | 24 +- .../cloud/load_balancers/load_balancers.py | 629 +----------------- .../resources/cloud/load_balancers/metrics.py | 205 ------ .../cloud/load_balancers/pools/pools.py | 24 +- .../cloud/load_balancers/statuses.py | 91 --- src/gcore/types/cloud/__init__.py | 6 - .../cloud/load_balancer_create_params.py | 2 +- .../cloud/load_balancer_failover_params.py | 16 - .../types/cloud/load_balancer_get_params.py | 19 - .../cloud/load_balancer_listener_detail.py | 2 +- .../types/cloud/load_balancer_metrics.py | 32 - .../types/cloud/load_balancer_metrics_list.py | 16 - .../cloud/load_balancer_resize_params.py | 16 - .../cloud/load_balancer_update_params.py | 69 -- .../types/cloud/load_balancers/__init__.py | 1 - .../load_balancers/listener_create_params.py | 2 +- .../load_balancers/listener_list_params.py | 2 +- .../load_balancers/metric_list_params.py | 21 - .../load_balancers/pool_create_params.py | 2 +- .../cloud/load_balancers/pool_list_params.py | 2 +- .../cloud/load_balancers/test_listeners.py | 20 +- .../cloud/load_balancers/test_metrics.py | 132 ---- .../cloud/load_balancers/test_pools.py | 8 +- .../cloud/load_balancers/test_statuses.py | 94 +-- .../cloud/test_load_balancers.py | 550 +-------------- 28 files changed, 51 insertions(+), 1966 deletions(-) delete mode 100644 src/gcore/resources/cloud/load_balancers/metrics.py delete mode 100644 src/gcore/types/cloud/load_balancer_failover_params.py delete mode 100644 src/gcore/types/cloud/load_balancer_get_params.py delete mode 100644 src/gcore/types/cloud/load_balancer_metrics.py delete mode 100644 src/gcore/types/cloud/load_balancer_metrics_list.py delete mode 100644 src/gcore/types/cloud/load_balancer_resize_params.py delete mode 100644 src/gcore/types/cloud/load_balancer_update_params.py delete mode 100644 src/gcore/types/cloud/load_balancers/metric_list_params.py delete mode 100644 tests/api_resources/cloud/load_balancers/test_metrics.py diff --git a/.stats.yml b/.stats.yml index 191e2bb2..66e1da4c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9f065df469027bcaa0bd19a36a0f8f132271e837c4cb058f27f3c5c740298797.yml -openapi_spec_hash: 844a27c7d8957769e1fb98965f9f1df0 +configured_endpoints: 605 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-94563a57bbb285cfead93d0627bac0731dd32093481327a6328d8e3d678cbc37.yml +openapi_spec_hash: 3af9864bebf6795a51b15af60b234510 config_hash: 6cf02fb49626ee44b56133d941a8ec11 diff --git a/api.md b/api.md index afd2f125..815e5839 100644 --- a/api.md +++ b/api.md @@ -210,12 +210,7 @@ from gcore.types.cloud import ( Methods: - client.cloud.load_balancers.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.update(loadbalancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer - client.cloud.load_balancers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[LoadBalancer] -- client.cloud.load_balancers.delete(loadbalancer_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.load_balancers.failover(loadbalancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.get(loadbalancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer -- client.cloud.load_balancers.resize(loadbalancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList ### L7Policies @@ -277,18 +272,11 @@ 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 -### Metrics - -Methods: - -- client.cloud.load_balancers.metrics.list(loadbalancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancerMetricsList - ### Statuses Methods: - client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> LoadBalancerStatusList -- client.cloud.load_balancers.statuses.get(loadbalancer_id, \*, project_id, region_id) -> LoadBalancerStatus ## ReservedFixedIPs diff --git a/src/gcore/resources/cloud/load_balancers/__init__.py b/src/gcore/resources/cloud/load_balancers/__init__.py index 4de45722..cdd5187e 100644 --- a/src/gcore/resources/cloud/load_balancers/__init__.py +++ b/src/gcore/resources/cloud/load_balancers/__init__.py @@ -16,14 +16,6 @@ FlavorsResourceWithStreamingResponse, AsyncFlavorsResourceWithStreamingResponse, ) -from .metrics import ( - MetricsResource, - AsyncMetricsResource, - MetricsResourceWithRawResponse, - AsyncMetricsResourceWithRawResponse, - MetricsResourceWithStreamingResponse, - AsyncMetricsResourceWithStreamingResponse, -) from .statuses import ( StatusesResource, AsyncStatusesResource, @@ -82,12 +74,6 @@ "AsyncPoolsResourceWithRawResponse", "PoolsResourceWithStreamingResponse", "AsyncPoolsResourceWithStreamingResponse", - "MetricsResource", - "AsyncMetricsResource", - "MetricsResourceWithRawResponse", - "AsyncMetricsResourceWithRawResponse", - "MetricsResourceWithStreamingResponse", - "AsyncMetricsResourceWithStreamingResponse", "StatusesResource", "AsyncStatusesResource", "StatusesResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 8959a6b4..272880d8 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -57,7 +57,7 @@ def create( *, project_id: int | None = None, region_id: int | None = None, - loadbalancer_id: str, + load_balancer_id: str, name: str, protocol: LbListenerProtocol, protocol_port: int, @@ -85,7 +85,7 @@ def create( region_id: Region ID - loadbalancer_id: Load balancer ID + load_balancer_id: Load balancer ID name: Load balancer listener name @@ -130,7 +130,7 @@ def create( f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=maybe_transform( { - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, "name": name, "protocol": protocol, "protocol_port": protocol_port, @@ -245,7 +245,7 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - loadbalancer_id: str | Omit = omit, + load_balancer_id: str | Omit = omit, show_stats: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -262,7 +262,7 @@ def list( region_id: Region ID - loadbalancer_id: Load Balancer ID + load_balancer_id: Load Balancer ID show_stats: Show stats @@ -287,7 +287,7 @@ def list( timeout=timeout, query=maybe_transform( { - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, "show_stats": show_stats, }, listener_list_params.ListenerListParams, @@ -419,7 +419,7 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, - loadbalancer_id: str, + load_balancer_id: str, name: str, protocol: LbListenerProtocol, protocol_port: int, @@ -447,7 +447,7 @@ async def create( region_id: Region ID - loadbalancer_id: Load balancer ID + load_balancer_id: Load balancer ID name: Load balancer listener name @@ -492,7 +492,7 @@ async def create( f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=await async_maybe_transform( { - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, "name": name, "protocol": protocol, "protocol_port": protocol_port, @@ -607,7 +607,7 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - loadbalancer_id: str | Omit = omit, + load_balancer_id: str | Omit = omit, show_stats: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -624,7 +624,7 @@ async def list( region_id: Region ID - loadbalancer_id: Load Balancer ID + load_balancer_id: Load Balancer ID show_stats: Show stats @@ -649,7 +649,7 @@ async def list( timeout=timeout, query=await async_maybe_transform( { - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, "show_stats": show_stats, }, listener_list_params.ListenerListParams, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index e6225101..1609b8b7 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Dict, Iterable import httpx @@ -14,14 +14,6 @@ FlavorsResourceWithStreamingResponse, AsyncFlavorsResourceWithStreamingResponse, ) -from .metrics import ( - MetricsResource, - AsyncMetricsResource, - MetricsResourceWithRawResponse, - AsyncMetricsResourceWithRawResponse, - MetricsResourceWithStreamingResponse, - AsyncMetricsResourceWithStreamingResponse, -) from .statuses import ( StatusesResource, AsyncStatusesResource, @@ -60,12 +52,8 @@ from ....types.cloud import ( InterfaceIPFamily, LoadBalancerMemberConnectivity, - load_balancer_get_params, load_balancer_list_params, load_balancer_create_params, - load_balancer_resize_params, - load_balancer_update_params, - load_balancer_failover_params, ) from ...._base_client import AsyncPaginator, make_request_options from .l7_policies.l7_policies import ( @@ -79,7 +67,6 @@ from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.load_balancer import LoadBalancer from ....types.cloud.interface_ip_family import InterfaceIPFamily -from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.load_balancer_member_connectivity import LoadBalancerMemberConnectivity __all__ = ["LoadBalancersResource", "AsyncLoadBalancersResource"] @@ -102,10 +89,6 @@ def listeners(self) -> ListenersResource: def pools(self) -> PoolsResource: return PoolsResource(self._client) - @cached_property - def metrics(self) -> MetricsResource: - return MetricsResource(self._client) - @cached_property def statuses(self) -> StatusesResource: return StatusesResource(self._client) @@ -231,90 +214,6 @@ def create( cast_to=TaskIDList, ) - def update( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - logging: load_balancer_update_params.Logging | Omit = omit, - name: str | Omit = omit, - preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, - tags: Optional[TagUpdateMapParam] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancer: - """ - Rename load balancer, activate/deactivate logging, update preferred connectivity - type and/or modify load balancer tags. The request will only process the fields - that are provided in the request body. Any fields that are not included will - remain unchanged. - - Args: - logging: Logging configuration - - name: Name. - - preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools - members - - tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide - key-value pairs to add or update tags. Set tag values to `null` to remove tags. - Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. - - **Examples:** - - - **Add/update tags:** - `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or - updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only - tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates - specified tags. - - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - - **Replace all:** first delete existing tags with null values, then add new - ones in the same request. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", - body=maybe_transform( - { - "logging": logging, - "name": name, - "preferred_connectivity": preferred_connectivity, - "tags": tags, - }, - load_balancer_update_params.LoadBalancerUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LoadBalancer, - ) - def list( self, *, @@ -403,186 +302,6 @@ def list( model=LoadBalancer, ) - def delete( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Delete load balancer - - 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 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 loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - def failover( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - force: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Failover load balancer - - Args: - force: Validate current load balancer status before failover or not. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", - body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - def get( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - show_stats: bool | Omit = omit, - with_ddos: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancer: - """ - Get load balancer - - Args: - show_stats: Show statistics - - with_ddos: Show DDoS profile - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "show_stats": show_stats, - "with_ddos": with_ddos, - }, - load_balancer_get_params.LoadBalancerGetParams, - ), - ), - cast_to=LoadBalancer, - ) - - def resize( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - flavor: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Resize load balancer - - Args: - flavor: Name of the desired flavor to resize to. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", - body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - class AsyncLoadBalancersResource(AsyncAPIResource): @cached_property @@ -601,10 +320,6 @@ def listeners(self) -> AsyncListenersResource: def pools(self) -> AsyncPoolsResource: return AsyncPoolsResource(self._client) - @cached_property - def metrics(self) -> AsyncMetricsResource: - return AsyncMetricsResource(self._client) - @cached_property def statuses(self) -> AsyncStatusesResource: return AsyncStatusesResource(self._client) @@ -730,90 +445,6 @@ async def create( cast_to=TaskIDList, ) - async def update( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - logging: load_balancer_update_params.Logging | Omit = omit, - name: str | Omit = omit, - preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, - tags: Optional[TagUpdateMapParam] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancer: - """ - Rename load balancer, activate/deactivate logging, update preferred connectivity - type and/or modify load balancer tags. The request will only process the fields - that are provided in the request body. Any fields that are not included will - remain unchanged. - - Args: - logging: Logging configuration - - name: Name. - - preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools - members - - tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide - key-value pairs to add or update tags. Set tag values to `null` to remove tags. - Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. - - **Examples:** - - - **Add/update tags:** - `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or - updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only - tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates - specified tags. - - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - - **Replace all:** first delete existing tags with null values, then add new - ones in the same request. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return await self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", - body=await async_maybe_transform( - { - "logging": logging, - "name": name, - "preferred_connectivity": preferred_connectivity, - "tags": tags, - }, - load_balancer_update_params.LoadBalancerUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LoadBalancer, - ) - def list( self, *, @@ -902,188 +533,6 @@ def list( model=LoadBalancer, ) - async def delete( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Delete load balancer - - 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 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 loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return await self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - async def failover( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - force: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Failover load balancer - - Args: - force: Validate current load balancer status before failover or not. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", - body=await async_maybe_transform( - {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - async def get( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - show_stats: bool | Omit = omit, - with_ddos: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancer: - """ - Get load balancer - - Args: - show_stats: Show statistics - - with_ddos: Show DDoS profile - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "show_stats": show_stats, - "with_ddos": with_ddos, - }, - load_balancer_get_params.LoadBalancerGetParams, - ), - ), - cast_to=LoadBalancer, - ) - - async def resize( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - flavor: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Resize load balancer - - Args: - flavor: Name of the desired flavor to resize to. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", - body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - class LoadBalancersResourceWithRawResponse: def __init__(self, load_balancers: LoadBalancersResource) -> None: @@ -1092,24 +541,9 @@ def __init__(self, load_balancers: LoadBalancersResource) -> None: self.create = to_raw_response_wrapper( load_balancers.create, ) - self.update = to_raw_response_wrapper( - load_balancers.update, - ) self.list = to_raw_response_wrapper( load_balancers.list, ) - self.delete = to_raw_response_wrapper( - load_balancers.delete, - ) - self.failover = to_raw_response_wrapper( - load_balancers.failover, - ) - self.get = to_raw_response_wrapper( - load_balancers.get, - ) - self.resize = to_raw_response_wrapper( - load_balancers.resize, - ) @cached_property def l7_policies(self) -> L7PoliciesResourceWithRawResponse: @@ -1127,10 +561,6 @@ def listeners(self) -> ListenersResourceWithRawResponse: def pools(self) -> PoolsResourceWithRawResponse: return PoolsResourceWithRawResponse(self._load_balancers.pools) - @cached_property - def metrics(self) -> MetricsResourceWithRawResponse: - return MetricsResourceWithRawResponse(self._load_balancers.metrics) - @cached_property def statuses(self) -> StatusesResourceWithRawResponse: return StatusesResourceWithRawResponse(self._load_balancers.statuses) @@ -1143,24 +573,9 @@ def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: self.create = async_to_raw_response_wrapper( load_balancers.create, ) - self.update = async_to_raw_response_wrapper( - load_balancers.update, - ) self.list = async_to_raw_response_wrapper( load_balancers.list, ) - self.delete = async_to_raw_response_wrapper( - load_balancers.delete, - ) - self.failover = async_to_raw_response_wrapper( - load_balancers.failover, - ) - self.get = async_to_raw_response_wrapper( - load_balancers.get, - ) - self.resize = async_to_raw_response_wrapper( - load_balancers.resize, - ) @cached_property def l7_policies(self) -> AsyncL7PoliciesResourceWithRawResponse: @@ -1178,10 +593,6 @@ def listeners(self) -> AsyncListenersResourceWithRawResponse: def pools(self) -> AsyncPoolsResourceWithRawResponse: return AsyncPoolsResourceWithRawResponse(self._load_balancers.pools) - @cached_property - def metrics(self) -> AsyncMetricsResourceWithRawResponse: - return AsyncMetricsResourceWithRawResponse(self._load_balancers.metrics) - @cached_property def statuses(self) -> AsyncStatusesResourceWithRawResponse: return AsyncStatusesResourceWithRawResponse(self._load_balancers.statuses) @@ -1194,24 +605,9 @@ def __init__(self, load_balancers: LoadBalancersResource) -> None: self.create = to_streamed_response_wrapper( load_balancers.create, ) - self.update = to_streamed_response_wrapper( - load_balancers.update, - ) self.list = to_streamed_response_wrapper( load_balancers.list, ) - self.delete = to_streamed_response_wrapper( - load_balancers.delete, - ) - self.failover = to_streamed_response_wrapper( - load_balancers.failover, - ) - self.get = to_streamed_response_wrapper( - load_balancers.get, - ) - self.resize = to_streamed_response_wrapper( - load_balancers.resize, - ) @cached_property def l7_policies(self) -> L7PoliciesResourceWithStreamingResponse: @@ -1229,10 +625,6 @@ def listeners(self) -> ListenersResourceWithStreamingResponse: def pools(self) -> PoolsResourceWithStreamingResponse: return PoolsResourceWithStreamingResponse(self._load_balancers.pools) - @cached_property - def metrics(self) -> MetricsResourceWithStreamingResponse: - return MetricsResourceWithStreamingResponse(self._load_balancers.metrics) - @cached_property def statuses(self) -> StatusesResourceWithStreamingResponse: return StatusesResourceWithStreamingResponse(self._load_balancers.statuses) @@ -1245,24 +637,9 @@ def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: self.create = async_to_streamed_response_wrapper( load_balancers.create, ) - self.update = async_to_streamed_response_wrapper( - load_balancers.update, - ) self.list = async_to_streamed_response_wrapper( load_balancers.list, ) - self.delete = async_to_streamed_response_wrapper( - load_balancers.delete, - ) - self.failover = async_to_streamed_response_wrapper( - load_balancers.failover, - ) - self.get = async_to_streamed_response_wrapper( - load_balancers.get, - ) - self.resize = async_to_streamed_response_wrapper( - load_balancers.resize, - ) @cached_property def l7_policies(self) -> AsyncL7PoliciesResourceWithStreamingResponse: @@ -1280,10 +657,6 @@ def listeners(self) -> AsyncListenersResourceWithStreamingResponse: def pools(self) -> AsyncPoolsResourceWithStreamingResponse: return AsyncPoolsResourceWithStreamingResponse(self._load_balancers.pools) - @cached_property - def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: - return AsyncMetricsResourceWithStreamingResponse(self._load_balancers.metrics) - @cached_property def statuses(self) -> AsyncStatusesResourceWithStreamingResponse: return AsyncStatusesResourceWithStreamingResponse(self._load_balancers.statuses) diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py deleted file mode 100644 index 38ecf843..00000000 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ /dev/null @@ -1,205 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import Body, Query, Headers, NotGiven, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....types.cloud import InstanceMetricsTimeUnit -from ...._base_client import make_request_options -from ....types.cloud.load_balancers import metric_list_params -from ....types.cloud.instance_metrics_time_unit import InstanceMetricsTimeUnit -from ....types.cloud.load_balancer_metrics_list import LoadBalancerMetricsList - -__all__ = ["MetricsResource", "AsyncMetricsResource"] - - -class MetricsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> MetricsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers - """ - return MetricsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response - """ - return MetricsResourceWithStreamingResponse(self) - - def list( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - time_interval: int, - time_unit: InstanceMetricsTimeUnit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerMetricsList: - """ - Get load balancer metrics, including cpu, memory and network - - Args: - time_interval: Time interval - - time_unit: Time interval unit - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", - body=maybe_transform( - { - "time_interval": time_interval, - "time_unit": time_unit, - }, - metric_list_params.MetricListParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LoadBalancerMetricsList, - ) - - -class AsyncMetricsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncMetricsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers - """ - return AsyncMetricsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response - """ - return AsyncMetricsResourceWithStreamingResponse(self) - - async def list( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - time_interval: int, - time_unit: InstanceMetricsTimeUnit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerMetricsList: - """ - Get load balancer metrics, including cpu, memory and network - - Args: - time_interval: Time interval - - time_unit: Time interval unit - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", - body=await async_maybe_transform( - { - "time_interval": time_interval, - "time_unit": time_unit, - }, - metric_list_params.MetricListParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LoadBalancerMetricsList, - ) - - -class MetricsResourceWithRawResponse: - def __init__(self, metrics: MetricsResource) -> None: - self._metrics = metrics - - self.list = to_raw_response_wrapper( - metrics.list, - ) - - -class AsyncMetricsResourceWithRawResponse: - def __init__(self, metrics: AsyncMetricsResource) -> None: - self._metrics = metrics - - self.list = async_to_raw_response_wrapper( - metrics.list, - ) - - -class MetricsResourceWithStreamingResponse: - def __init__(self, metrics: MetricsResource) -> None: - self._metrics = metrics - - self.list = to_streamed_response_wrapper( - metrics.list, - ) - - -class AsyncMetricsResourceWithStreamingResponse: - def __init__(self, metrics: AsyncMetricsResource) -> None: - self._metrics = metrics - - self.list = async_to_streamed_response_wrapper( - metrics.list, - ) diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 3ee27f95..1b3ddd58 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -84,7 +84,7 @@ def create( crl_secret_id: Optional[str] | Omit = omit, healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, listener_id: Optional[str] | Omit = omit, - loadbalancer_id: Optional[str] | Omit = omit, + load_balancer_id: Optional[str] | Omit = omit, members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, secret_id: Optional[str] | Omit = omit, session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, @@ -120,7 +120,7 @@ def create( listener_id: Listener ID - loadbalancer_id: Loadbalancer ID + load_balancer_id: Loadbalancer ID members: Pool members @@ -157,7 +157,7 @@ def create( "crl_secret_id": crl_secret_id, "healthmonitor": healthmonitor, "listener_id": listener_id, - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, "members": members, "secret_id": secret_id, "session_persistence": session_persistence, @@ -296,7 +296,7 @@ def list( region_id: int | None = None, details: bool | Omit = omit, listener_id: str | Omit = omit, - loadbalancer_id: str | Omit = omit, + load_balancer_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, @@ -316,7 +316,7 @@ def list( listener_id: Listener ID - loadbalancer_id: Load Balancer ID + load_balancer_id: Load Balancer ID extra_headers: Send extra headers @@ -341,7 +341,7 @@ def list( { "details": details, "listener_id": listener_id, - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, }, pool_list_params.PoolListParams, ), @@ -480,7 +480,7 @@ async def create( crl_secret_id: Optional[str] | Omit = omit, healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, listener_id: Optional[str] | Omit = omit, - loadbalancer_id: Optional[str] | Omit = omit, + load_balancer_id: Optional[str] | Omit = omit, members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, secret_id: Optional[str] | Omit = omit, session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, @@ -516,7 +516,7 @@ async def create( listener_id: Listener ID - loadbalancer_id: Loadbalancer ID + load_balancer_id: Loadbalancer ID members: Pool members @@ -553,7 +553,7 @@ async def create( "crl_secret_id": crl_secret_id, "healthmonitor": healthmonitor, "listener_id": listener_id, - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, "members": members, "secret_id": secret_id, "session_persistence": session_persistence, @@ -692,7 +692,7 @@ async def list( region_id: int | None = None, details: bool | Omit = omit, listener_id: str | Omit = omit, - loadbalancer_id: str | Omit = omit, + load_balancer_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, @@ -712,7 +712,7 @@ async def list( listener_id: Listener ID - loadbalancer_id: Load Balancer ID + load_balancer_id: Load Balancer ID extra_headers: Send extra headers @@ -737,7 +737,7 @@ async def list( { "details": details, "listener_id": listener_id, - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, }, pool_list_params.PoolListParams, ), diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 624132ba..7270e2a8 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -14,7 +14,6 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.cloud.load_balancer_status import LoadBalancerStatus from ....types.cloud.load_balancer_status_list import LoadBalancerStatusList __all__ = ["StatusesResource", "AsyncStatusesResource"] @@ -76,45 +75,6 @@ def list( cast_to=LoadBalancerStatusList, ) - def get( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerStatus: - """ - Get load balancer status - - 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 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 loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LoadBalancerStatus, - ) - class AsyncStatusesResource(AsyncAPIResource): @cached_property @@ -172,45 +132,6 @@ async def list( cast_to=LoadBalancerStatusList, ) - async def get( - self, - loadbalancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerStatus: - """ - Get load balancer status - - 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 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 loadbalancer_id: - raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") - return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LoadBalancerStatus, - ) - class StatusesResourceWithRawResponse: def __init__(self, statuses: StatusesResource) -> None: @@ -219,9 +140,6 @@ def __init__(self, statuses: StatusesResource) -> None: self.list = to_raw_response_wrapper( statuses.list, ) - self.get = to_raw_response_wrapper( - statuses.get, - ) class AsyncStatusesResourceWithRawResponse: @@ -231,9 +149,6 @@ def __init__(self, statuses: AsyncStatusesResource) -> None: self.list = async_to_raw_response_wrapper( statuses.list, ) - self.get = async_to_raw_response_wrapper( - statuses.get, - ) class StatusesResourceWithStreamingResponse: @@ -243,9 +158,6 @@ def __init__(self, statuses: StatusesResource) -> None: self.list = to_streamed_response_wrapper( statuses.list, ) - self.get = to_streamed_response_wrapper( - statuses.get, - ) class AsyncStatusesResourceWithStreamingResponse: @@ -255,6 +167,3 @@ def __init__(self, statuses: AsyncStatusesResource) -> None: self.list = async_to_streamed_response_wrapper( statuses.list, ) - self.get = async_to_streamed_response_wrapper( - statuses.get, - ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 96c25d07..e7f5de17 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -90,7 +90,6 @@ from .gpu_baremetal_cluster import GPUBaremetalCluster as GPUBaremetalCluster from .health_monitor_status import HealthMonitorStatus as HealthMonitorStatus from .load_balancer_l7_rule import LoadBalancerL7Rule as LoadBalancerL7Rule -from .load_balancer_metrics import LoadBalancerMetrics as LoadBalancerMetrics from .network_create_params import NetworkCreateParams as NetworkCreateParams from .network_update_params import NetworkUpdateParams as NetworkUpdateParams from .project_create_params import ProjectCreateParams as ProjectCreateParams @@ -118,7 +117,6 @@ from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams from .file_share_update_params import FileShareUpdateParams as FileShareUpdateParams from .k8s_cluster_version_list import K8sClusterVersionList as K8sClusterVersionList -from .load_balancer_get_params import LoadBalancerGetParams as LoadBalancerGetParams from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams @@ -131,7 +129,6 @@ from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit from .load_balancer_l7_rule_list import LoadBalancerL7RuleList as LoadBalancerL7RuleList -from .load_balancer_metrics_list import LoadBalancerMetricsList as LoadBalancerMetricsList from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField @@ -143,14 +140,11 @@ from .load_balancer_flavor_detail import LoadBalancerFlavorDetail as LoadBalancerFlavorDetail from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole from .load_balancer_listener_list import LoadBalancerListenerList as LoadBalancerListenerList -from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams -from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .load_balancer_l7_policy_list import LoadBalancerL7PolicyList as LoadBalancerL7PolicyList from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams -from .load_balancer_failover_params import LoadBalancerFailoverParams as LoadBalancerFailoverParams from .load_balancer_listener_detail import LoadBalancerListenerDetail as LoadBalancerListenerDetail from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 7a4c3051..a41fd6e4 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -274,7 +274,7 @@ class ListenerPool(TypedDict, total=False): listener_id: Optional[str] """Listener ID""" - loadbalancer_id: Optional[str] + load_balancer_id: Optional[str] """Loadbalancer ID""" members: Optional[Iterable[ListenerPoolMember]] diff --git a/src/gcore/types/cloud/load_balancer_failover_params.py b/src/gcore/types/cloud/load_balancer_failover_params.py deleted file mode 100644 index b4a727a7..00000000 --- a/src/gcore/types/cloud/load_balancer_failover_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["LoadBalancerFailoverParams"] - - -class LoadBalancerFailoverParams(TypedDict, total=False): - project_id: int - - region_id: int - - force: bool - """Validate current load balancer status before failover or not.""" diff --git a/src/gcore/types/cloud/load_balancer_get_params.py b/src/gcore/types/cloud/load_balancer_get_params.py deleted file mode 100644 index 233a6f3e..00000000 --- a/src/gcore/types/cloud/load_balancer_get_params.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["LoadBalancerGetParams"] - - -class LoadBalancerGetParams(TypedDict, total=False): - project_id: int - - region_id: int - - show_stats: bool - """Show statistics""" - - with_ddos: bool - """Show DDoS profile""" diff --git a/src/gcore/types/cloud/load_balancer_listener_detail.py b/src/gcore/types/cloud/load_balancer_listener_detail.py index 41d9a4c6..e230a736 100644 --- a/src/gcore/types/cloud/load_balancer_listener_detail.py +++ b/src/gcore/types/cloud/load_balancer_listener_detail.py @@ -38,7 +38,7 @@ class LoadBalancerListenerDetail(BaseModel): Only used with HTTP and `TERMINATED_HTTPS` protocols. """ - loadbalancer_id: Optional[str] = None + load_balancer_id: Optional[str] = None """Load balancer ID""" name: str diff --git a/src/gcore/types/cloud/load_balancer_metrics.py b/src/gcore/types/cloud/load_balancer_metrics.py deleted file mode 100644 index ffdf6859..00000000 --- a/src/gcore/types/cloud/load_balancer_metrics.py +++ /dev/null @@ -1,32 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["LoadBalancerMetrics"] - - -class LoadBalancerMetrics(BaseModel): - cpu_util: Optional[float] = None - """CPU utilization, % (max 100% for multi-core)""" - - memory_util: Optional[float] = None - """RAM utilization, %""" - - network_bps_egress: Optional[float] = FieldInfo(alias="network_Bps_egress", default=None) - """Network out, bytes per second""" - - network_bps_ingress: Optional[float] = FieldInfo(alias="network_Bps_ingress", default=None) - """Network in, bytes per second""" - - network_pps_egress: Optional[float] = None - """Network out, packets per second""" - - network_pps_ingress: Optional[float] = None - """Network in, packets per second""" - - time: Optional[str] = None - """Timestamp""" diff --git a/src/gcore/types/cloud/load_balancer_metrics_list.py b/src/gcore/types/cloud/load_balancer_metrics_list.py deleted file mode 100644 index c270faf1..00000000 --- a/src/gcore/types/cloud/load_balancer_metrics_list.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .load_balancer_metrics import LoadBalancerMetrics - -__all__ = ["LoadBalancerMetricsList"] - - -class LoadBalancerMetricsList(BaseModel): - count: int - """Number of objects""" - - results: List[LoadBalancerMetrics] - """Objects""" diff --git a/src/gcore/types/cloud/load_balancer_resize_params.py b/src/gcore/types/cloud/load_balancer_resize_params.py deleted file mode 100644 index 05055dfe..00000000 --- a/src/gcore/types/cloud/load_balancer_resize_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["LoadBalancerResizeParams"] - - -class LoadBalancerResizeParams(TypedDict, total=False): - project_id: int - - region_id: int - - flavor: Required[str] - """Name of the desired flavor to resize to.""" diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py deleted file mode 100644 index 0870d49c..00000000 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ /dev/null @@ -1,69 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import TypedDict - -from .tag_update_map_param import TagUpdateMapParam -from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam -from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity - -__all__ = ["LoadBalancerUpdateParams", "Logging"] - - -class LoadBalancerUpdateParams(TypedDict, total=False): - project_id: int - - region_id: int - - logging: Logging - """Logging configuration""" - - name: str - """Name.""" - - preferred_connectivity: LoadBalancerMemberConnectivity - """ - Preferred option to establish connectivity between load balancer and its pools - members - """ - - tags: Optional[TagUpdateMapParam] - """Update key-value tags using JSON Merge Patch semantics (RFC 7386). - - Provide key-value pairs to add or update tags. Set tag values to `null` to - remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. - - **Examples:** - - - **Add/update tags:** - `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or - updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only - tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates - specified tags. - - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - - **Replace all:** first delete existing tags with null values, then add new - ones in the same request. - """ - - -class Logging(TypedDict, total=False): - destination_region_id: Optional[int] - """Destination region id to which the logs will be written""" - - enabled: bool - """Enable/disable forwarding logs to LaaS""" - - retention_policy: Optional[LaasIndexRetentionPolicyParam] - """The logs retention policy""" - - topic_name: Optional[str] - """The topic name to which the logs will be written""" diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index 433f966c..c25ce985 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -4,7 +4,6 @@ from .pool_list_params import PoolListParams as PoolListParams from .flavor_list_params import FlavorListParams as FlavorListParams -from .metric_list_params import MetricListParams as MetricListParams from .pool_create_params import PoolCreateParams as PoolCreateParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .listener_get_params import ListenerGetParams as ListenerGetParams diff --git a/src/gcore/types/cloud/load_balancers/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py index 7f7bf451..c5b6f5e6 100644 --- a/src/gcore/types/cloud/load_balancers/listener_create_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -18,7 +18,7 @@ class ListenerCreateParams(TypedDict, total=False): region_id: int """Region ID""" - loadbalancer_id: Required[str] + load_balancer_id: Required[str] """Load balancer ID""" name: Required[str] diff --git a/src/gcore/types/cloud/load_balancers/listener_list_params.py b/src/gcore/types/cloud/load_balancers/listener_list_params.py index 783d8482..c3e9925f 100644 --- a/src/gcore/types/cloud/load_balancers/listener_list_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_list_params.py @@ -14,7 +14,7 @@ class ListenerListParams(TypedDict, total=False): region_id: int """Region ID""" - loadbalancer_id: str + load_balancer_id: str """Load Balancer ID""" show_stats: bool diff --git a/src/gcore/types/cloud/load_balancers/metric_list_params.py b/src/gcore/types/cloud/load_balancers/metric_list_params.py deleted file mode 100644 index 4af5e414..00000000 --- a/src/gcore/types/cloud/load_balancers/metric_list_params.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from ..instance_metrics_time_unit import InstanceMetricsTimeUnit - -__all__ = ["MetricListParams"] - - -class MetricListParams(TypedDict, total=False): - project_id: int - - region_id: int - - time_interval: Required[int] - """Time interval""" - - time_unit: Required[InstanceMetricsTimeUnit] - """Time interval unit""" 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 b19fb813..492e9640 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -42,7 +42,7 @@ class PoolCreateParams(TypedDict, total=False): listener_id: Optional[str] """Listener ID""" - loadbalancer_id: Optional[str] + load_balancer_id: Optional[str] """Loadbalancer ID""" members: Optional[Iterable[Member]] diff --git a/src/gcore/types/cloud/load_balancers/pool_list_params.py b/src/gcore/types/cloud/load_balancers/pool_list_params.py index 16020665..1cddb97b 100644 --- a/src/gcore/types/cloud/load_balancers/pool_list_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_list_params.py @@ -20,5 +20,5 @@ class PoolListParams(TypedDict, total=False): listener_id: str """Listener ID""" - loadbalancer_id: str + load_balancer_id: str """Load Balancer ID""" diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index 2605c9f6..b7228ea5 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -22,7 +22,7 @@ def test_method_create(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -60,7 +60,7 @@ def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.load_balancers.listeners.with_raw_response.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -76,7 +76,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.load_balancers.listeners.with_streaming_response.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -171,7 +171,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.list( project_id=1, region_id=1, - loadbalancer_id="00000000-0000-4000-8000-000000000000", + load_balancer_id="00000000-0000-4000-8000-000000000000", show_stats=True, ) assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @@ -315,7 +315,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: listener = await async_client.cloud.load_balancers.listeners.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -327,7 +327,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> listener = await async_client.cloud.load_balancers.listeners.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -353,7 +353,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.listeners.with_raw_response.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -369,7 +369,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None async with async_client.cloud.load_balancers.listeners.with_streaming_response.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -464,7 +464,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No listener = await async_client.cloud.load_balancers.listeners.list( project_id=1, region_id=1, - loadbalancer_id="00000000-0000-4000-8000-000000000000", + load_balancer_id="00000000-0000-4000-8000-000000000000", show_stats=True, ) assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) diff --git a/tests/api_resources/cloud/load_balancers/test_metrics.py b/tests/api_resources/cloud/load_balancers/test_metrics.py deleted file mode 100644 index 39bdefed..00000000 --- a/tests/api_resources/cloud/load_balancers/test_metrics.py +++ /dev/null @@ -1,132 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from gcore import Gcore, AsyncGcore -from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerMetricsList - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestMetrics: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Gcore) -> None: - metric = client.cloud.load_balancers.metrics.list( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.load_balancers.metrics.with_raw_response.list( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - metric = response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.load_balancers.metrics.with_streaming_response.list( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - metric = response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - client.cloud.load_balancers.metrics.with_raw_response.list( - loadbalancer_id="", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) - - -class TestAsyncMetrics: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_list(self, async_client: AsyncGcore) -> None: - metric = await async_client.cloud.load_balancers.metrics.list( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.metrics.with_raw_response.list( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - metric = await response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.metrics.with_streaming_response.list( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - metric = await response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - await async_client.cloud.load_balancers.metrics.with_raw_response.list( - loadbalancer_id="", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py index f926dcc0..0b095c3d 100644 --- a/tests/api_resources/cloud/load_balancers/test_pools.py +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -49,7 +49,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "url_path": "/", }, listener_id="listener_id", - loadbalancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + load_balancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", members=[ { "address": "192.168.1.101", @@ -227,7 +227,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: region_id=1, details=True, listener_id="00000000-0000-4000-8000-000000000000", - loadbalancer_id="00000000-0000-4000-8000-000000000000", + load_balancer_id="00000000-0000-4000-8000-000000000000", ) assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @@ -387,7 +387,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "url_path": "/", }, listener_id="listener_id", - loadbalancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + load_balancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", members=[ { "address": "192.168.1.101", @@ -565,7 +565,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No region_id=1, details=True, listener_id="00000000-0000-4000-8000-000000000000", - loadbalancer_id="00000000-0000-4000-8000-000000000000", + load_balancer_id="00000000-0000-4000-8000-000000000000", ) assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) diff --git a/tests/api_resources/cloud/load_balancers/test_statuses.py b/tests/api_resources/cloud/load_balancers/test_statuses.py index cf38797d..a9583093 100644 --- a/tests/api_resources/cloud/load_balancers/test_statuses.py +++ b/tests/api_resources/cloud/load_balancers/test_statuses.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerStatus, LoadBalancerStatusList +from gcore.types.cloud import LoadBalancerStatusList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -51,52 +51,6 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_get(self, client: Gcore) -> None: - status = client.cloud.load_balancers.statuses.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(LoadBalancerStatus, status, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.load_balancers.statuses.with_raw_response.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - status = response.parse() - assert_matches_type(LoadBalancerStatus, status, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.load_balancers.statuses.with_streaming_response.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - status = response.parse() - assert_matches_type(LoadBalancerStatus, status, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - client.cloud.load_balancers.statuses.with_raw_response.get( - loadbalancer_id="", - project_id=0, - region_id=0, - ) - class TestAsyncStatuses: parametrize = pytest.mark.parametrize( @@ -136,49 +90,3 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(LoadBalancerStatusList, status, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_get(self, async_client: AsyncGcore) -> None: - status = await async_client.cloud.load_balancers.statuses.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(LoadBalancerStatus, status, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.statuses.with_raw_response.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - status = await response.parse() - assert_matches_type(LoadBalancerStatus, status, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.statuses.with_streaming_response.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - status = await response.parse() - assert_matches_type(LoadBalancerStatus, status, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - await async_client.cloud.load_balancers.statuses.with_raw_response.get( - loadbalancer_id="", - project_id=0, - region_id=0, - ) diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index 85a8fdb7..d365a629 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -65,7 +65,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "url_path": "/", }, "listener_id": "listener_id", - "loadbalancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + "load_balancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", "members": [ { "address": "192.168.1.101", @@ -158,70 +158,6 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_update(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.update( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.update( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - logging={ - "destination_region_id": 1, - "enabled": True, - "retention_policy": {"period": 45}, - "topic_name": "my-log-name", - }, - name="some_name", - preferred_connectivity="L2", - tags={"foo": "my-tag-value"}, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.load_balancers.with_raw_response.update( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.load_balancers.with_streaming_response.update( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - client.cloud.load_balancers.with_raw_response.update( - loadbalancer_id="", - project_id=0, - region_id=0, - ) - @parametrize def test_method_list(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.list( @@ -274,215 +210,6 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_delete(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.delete( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.load_balancers.with_raw_response.delete( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.load_balancers.with_streaming_response.delete( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - client.cloud.load_balancers.with_raw_response.delete( - loadbalancer_id="", - project_id=0, - region_id=0, - ) - - @parametrize - def test_method_failover(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.failover( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_method_failover_with_all_params(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.failover( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - force=True, - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_raw_response_failover(self, client: Gcore) -> None: - response = client.cloud.load_balancers.with_raw_response.failover( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_streaming_response_failover(self, client: Gcore) -> None: - with client.cloud.load_balancers.with_streaming_response.failover( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_failover(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - client.cloud.load_balancers.with_raw_response.failover( - loadbalancer_id="", - project_id=0, - region_id=0, - ) - - @parametrize - def test_method_get(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - def test_method_get_with_all_params(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - show_stats=True, - with_ddos=True, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.load_balancers.with_raw_response.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.load_balancers.with_streaming_response.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - client.cloud.load_balancers.with_raw_response.get( - loadbalancer_id="", - project_id=0, - region_id=0, - ) - - @parametrize - def test_method_resize(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.resize( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_raw_response_resize(self, client: Gcore) -> None: - response = client.cloud.load_balancers.with_raw_response.resize( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_streaming_response_resize(self, client: Gcore) -> None: - with client.cloud.load_balancers.with_streaming_response.resize( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_resize(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - client.cloud.load_balancers.with_raw_response.resize( - loadbalancer_id="", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) - class TestAsyncLoadBalancers: parametrize = pytest.mark.parametrize( @@ -533,7 +260,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "url_path": "/", }, "listener_id": "listener_id", - "loadbalancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + "load_balancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", "members": [ { "address": "192.168.1.101", @@ -626,70 +353,6 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True - @parametrize - async def test_method_update(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.update( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.update( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - logging={ - "destination_region_id": 1, - "enabled": True, - "retention_policy": {"period": 45}, - "topic_name": "my-log-name", - }, - name="some_name", - preferred_connectivity="L2", - tags={"foo": "my-tag-value"}, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.with_raw_response.update( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = await response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.with_streaming_response.update( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = await response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - await async_client.cloud.load_balancers.with_raw_response.update( - loadbalancer_id="", - project_id=0, - region_id=0, - ) - @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.list( @@ -741,212 +404,3 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(AsyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.delete( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.with_raw_response.delete( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = await response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.with_streaming_response.delete( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = await response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - await async_client.cloud.load_balancers.with_raw_response.delete( - loadbalancer_id="", - project_id=0, - region_id=0, - ) - - @parametrize - async def test_method_failover(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.failover( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_method_failover_with_all_params(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.failover( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - force=True, - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_raw_response_failover(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.with_raw_response.failover( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = await response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_streaming_response_failover(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.with_streaming_response.failover( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = await response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_failover(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - await async_client.cloud.load_balancers.with_raw_response.failover( - loadbalancer_id="", - project_id=0, - region_id=0, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - show_stats=True, - with_ddos=True, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.with_raw_response.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = await response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.with_streaming_response.get( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = await response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - await async_client.cloud.load_balancers.with_raw_response.get( - loadbalancer_id="", - project_id=0, - region_id=0, - ) - - @parametrize - async def test_method_resize(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.resize( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.with_raw_response.resize( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = await response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.with_streaming_response.resize( - loadbalancer_id="loadbalancer_id", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = await response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_resize(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `loadbalancer_id` but received ''"): - await async_client.cloud.load_balancers.with_raw_response.resize( - loadbalancer_id="", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) From 5139d8b9f59a52efb8cb38f0c0ede5bb6f1bb8f5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 14 Oct 2025 15:09:13 +0000 Subject: [PATCH 372/592] fix(cloud)!: rename to load_balancer_id path param --- .stats.yml | 4 +- api.md | 12 + .../cloud/load_balancers/__init__.py | 14 + .../cloud/load_balancers/load_balancers.py | 629 +++++++++++++++++- .../resources/cloud/load_balancers/metrics.py | 205 ++++++ .../cloud/load_balancers/statuses.py | 91 +++ src/gcore/types/cloud/__init__.py | 6 + .../cloud/load_balancer_failover_params.py | 16 + .../types/cloud/load_balancer_get_params.py | 19 + .../types/cloud/load_balancer_metrics.py | 32 + .../types/cloud/load_balancer_metrics_list.py | 16 + .../cloud/load_balancer_resize_params.py | 16 + .../cloud/load_balancer_update_params.py | 69 ++ .../types/cloud/load_balancers/__init__.py | 1 + .../load_balancers/metric_list_params.py | 21 + .../cloud/load_balancers/test_metrics.py | 132 ++++ .../cloud/load_balancers/test_statuses.py | 94 ++- .../cloud/test_load_balancers.py | 546 +++++++++++++++ 18 files changed, 1919 insertions(+), 4 deletions(-) create mode 100644 src/gcore/resources/cloud/load_balancers/metrics.py create mode 100644 src/gcore/types/cloud/load_balancer_failover_params.py create mode 100644 src/gcore/types/cloud/load_balancer_get_params.py create mode 100644 src/gcore/types/cloud/load_balancer_metrics.py create mode 100644 src/gcore/types/cloud/load_balancer_metrics_list.py create mode 100644 src/gcore/types/cloud/load_balancer_resize_params.py create mode 100644 src/gcore/types/cloud/load_balancer_update_params.py create mode 100644 src/gcore/types/cloud/load_balancers/metric_list_params.py create mode 100644 tests/api_resources/cloud/load_balancers/test_metrics.py diff --git a/.stats.yml b/.stats.yml index 66e1da4c..d13e0609 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 605 +configured_endpoints: 612 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-94563a57bbb285cfead93d0627bac0731dd32093481327a6328d8e3d678cbc37.yml openapi_spec_hash: 3af9864bebf6795a51b15af60b234510 -config_hash: 6cf02fb49626ee44b56133d941a8ec11 +config_hash: 330219cbf58ba11acb43a8a4424673ac diff --git a/api.md b/api.md index 815e5839..d2b0533c 100644 --- a/api.md +++ b/api.md @@ -210,7 +210,12 @@ from gcore.types.cloud import ( Methods: - client.cloud.load_balancers.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.update(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer - client.cloud.load_balancers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[LoadBalancer] +- client.cloud.load_balancers.delete(load_balancer_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.load_balancers.failover(load_balancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.get(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer +- client.cloud.load_balancers.resize(load_balancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList ### L7Policies @@ -272,11 +277,18 @@ 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 +### Metrics + +Methods: + +- client.cloud.load_balancers.metrics.list(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancerMetricsList + ### Statuses Methods: - client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> LoadBalancerStatusList +- client.cloud.load_balancers.statuses.get(load_balancer_id, \*, project_id, region_id) -> LoadBalancerStatus ## ReservedFixedIPs diff --git a/src/gcore/resources/cloud/load_balancers/__init__.py b/src/gcore/resources/cloud/load_balancers/__init__.py index cdd5187e..4de45722 100644 --- a/src/gcore/resources/cloud/load_balancers/__init__.py +++ b/src/gcore/resources/cloud/load_balancers/__init__.py @@ -16,6 +16,14 @@ FlavorsResourceWithStreamingResponse, AsyncFlavorsResourceWithStreamingResponse, ) +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) from .statuses import ( StatusesResource, AsyncStatusesResource, @@ -74,6 +82,12 @@ "AsyncPoolsResourceWithRawResponse", "PoolsResourceWithStreamingResponse", "AsyncPoolsResourceWithStreamingResponse", + "MetricsResource", + "AsyncMetricsResource", + "MetricsResourceWithRawResponse", + "AsyncMetricsResourceWithRawResponse", + "MetricsResourceWithStreamingResponse", + "AsyncMetricsResourceWithStreamingResponse", "StatusesResource", "AsyncStatusesResource", "StatusesResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 1609b8b7..12138750 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable +from typing import Dict, Iterable, Optional import httpx @@ -14,6 +14,14 @@ FlavorsResourceWithStreamingResponse, AsyncFlavorsResourceWithStreamingResponse, ) +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) from .statuses import ( StatusesResource, AsyncStatusesResource, @@ -52,8 +60,12 @@ from ....types.cloud import ( InterfaceIPFamily, LoadBalancerMemberConnectivity, + load_balancer_get_params, load_balancer_list_params, load_balancer_create_params, + load_balancer_resize_params, + load_balancer_update_params, + load_balancer_failover_params, ) from ...._base_client import AsyncPaginator, make_request_options from .l7_policies.l7_policies import ( @@ -67,6 +79,7 @@ from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.load_balancer import LoadBalancer from ....types.cloud.interface_ip_family import InterfaceIPFamily +from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.load_balancer_member_connectivity import LoadBalancerMemberConnectivity __all__ = ["LoadBalancersResource", "AsyncLoadBalancersResource"] @@ -89,6 +102,10 @@ def listeners(self) -> ListenersResource: def pools(self) -> PoolsResource: return PoolsResource(self._client) + @cached_property + def metrics(self) -> MetricsResource: + return MetricsResource(self._client) + @cached_property def statuses(self) -> StatusesResource: return StatusesResource(self._client) @@ -214,6 +231,90 @@ def create( cast_to=TaskIDList, ) + def update( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + logging: load_balancer_update_params.Logging | Omit = omit, + name: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancer: + """ + Rename load balancer, activate/deactivate logging, update preferred connectivity + type and/or modify load balancer tags. The request will only process the fields + that are provided in the request body. Any fields that are not included will + remain unchanged. + + Args: + logging: Logging configuration + + name: Name. + + preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools + members + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._patch( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", + body=maybe_transform( + { + "logging": logging, + "name": name, + "preferred_connectivity": preferred_connectivity, + "tags": tags, + }, + load_balancer_update_params.LoadBalancerUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancer, + ) + def list( self, *, @@ -302,6 +403,186 @@ def list( model=LoadBalancer, ) + def delete( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete load balancer + + 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 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 load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._delete( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def failover( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + force: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Failover load balancer + + Args: + force: Validate current load balancer status before failover or not. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/failover", + body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + show_stats: bool | Omit = omit, + with_ddos: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancer: + """ + Get load balancer + + Args: + show_stats: Show statistics + + with_ddos: Show DDoS profile + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "show_stats": show_stats, + "with_ddos": with_ddos, + }, + load_balancer_get_params.LoadBalancerGetParams, + ), + ), + cast_to=LoadBalancer, + ) + + def resize( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Resize load balancer + + Args: + flavor: Name of the desired flavor to resize to. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/resize", + body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + class AsyncLoadBalancersResource(AsyncAPIResource): @cached_property @@ -320,6 +601,10 @@ def listeners(self) -> AsyncListenersResource: def pools(self) -> AsyncPoolsResource: return AsyncPoolsResource(self._client) + @cached_property + def metrics(self) -> AsyncMetricsResource: + return AsyncMetricsResource(self._client) + @cached_property def statuses(self) -> AsyncStatusesResource: return AsyncStatusesResource(self._client) @@ -445,6 +730,90 @@ async def create( cast_to=TaskIDList, ) + async def update( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + logging: load_balancer_update_params.Logging | Omit = omit, + name: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancer: + """ + Rename load balancer, activate/deactivate logging, update preferred connectivity + type and/or modify load balancer tags. The request will only process the fields + that are provided in the request body. Any fields that are not included will + remain unchanged. + + Args: + logging: Logging configuration + + name: Name. + + preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools + members + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._patch( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", + body=await async_maybe_transform( + { + "logging": logging, + "name": name, + "preferred_connectivity": preferred_connectivity, + "tags": tags, + }, + load_balancer_update_params.LoadBalancerUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancer, + ) + def list( self, *, @@ -533,6 +902,188 @@ def list( model=LoadBalancer, ) + async def delete( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete load balancer + + 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 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 load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._delete( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def failover( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + force: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Failover load balancer + + Args: + force: Validate current load balancer status before failover or not. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/failover", + body=await async_maybe_transform( + {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + show_stats: bool | Omit = omit, + with_ddos: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancer: + """ + Get load balancer + + Args: + show_stats: Show statistics + + with_ddos: Show DDoS profile + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "show_stats": show_stats, + "with_ddos": with_ddos, + }, + load_balancer_get_params.LoadBalancerGetParams, + ), + ), + cast_to=LoadBalancer, + ) + + async def resize( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Resize load balancer + + Args: + flavor: Name of the desired flavor to resize to. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/resize", + body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + class LoadBalancersResourceWithRawResponse: def __init__(self, load_balancers: LoadBalancersResource) -> None: @@ -541,9 +1092,24 @@ def __init__(self, load_balancers: LoadBalancersResource) -> None: self.create = to_raw_response_wrapper( load_balancers.create, ) + self.update = to_raw_response_wrapper( + load_balancers.update, + ) self.list = to_raw_response_wrapper( load_balancers.list, ) + self.delete = to_raw_response_wrapper( + load_balancers.delete, + ) + self.failover = to_raw_response_wrapper( + load_balancers.failover, + ) + self.get = to_raw_response_wrapper( + load_balancers.get, + ) + self.resize = to_raw_response_wrapper( + load_balancers.resize, + ) @cached_property def l7_policies(self) -> L7PoliciesResourceWithRawResponse: @@ -561,6 +1127,10 @@ def listeners(self) -> ListenersResourceWithRawResponse: def pools(self) -> PoolsResourceWithRawResponse: return PoolsResourceWithRawResponse(self._load_balancers.pools) + @cached_property + def metrics(self) -> MetricsResourceWithRawResponse: + return MetricsResourceWithRawResponse(self._load_balancers.metrics) + @cached_property def statuses(self) -> StatusesResourceWithRawResponse: return StatusesResourceWithRawResponse(self._load_balancers.statuses) @@ -573,9 +1143,24 @@ def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: self.create = async_to_raw_response_wrapper( load_balancers.create, ) + self.update = async_to_raw_response_wrapper( + load_balancers.update, + ) self.list = async_to_raw_response_wrapper( load_balancers.list, ) + self.delete = async_to_raw_response_wrapper( + load_balancers.delete, + ) + self.failover = async_to_raw_response_wrapper( + load_balancers.failover, + ) + self.get = async_to_raw_response_wrapper( + load_balancers.get, + ) + self.resize = async_to_raw_response_wrapper( + load_balancers.resize, + ) @cached_property def l7_policies(self) -> AsyncL7PoliciesResourceWithRawResponse: @@ -593,6 +1178,10 @@ def listeners(self) -> AsyncListenersResourceWithRawResponse: def pools(self) -> AsyncPoolsResourceWithRawResponse: return AsyncPoolsResourceWithRawResponse(self._load_balancers.pools) + @cached_property + def metrics(self) -> AsyncMetricsResourceWithRawResponse: + return AsyncMetricsResourceWithRawResponse(self._load_balancers.metrics) + @cached_property def statuses(self) -> AsyncStatusesResourceWithRawResponse: return AsyncStatusesResourceWithRawResponse(self._load_balancers.statuses) @@ -605,9 +1194,24 @@ def __init__(self, load_balancers: LoadBalancersResource) -> None: self.create = to_streamed_response_wrapper( load_balancers.create, ) + self.update = to_streamed_response_wrapper( + load_balancers.update, + ) self.list = to_streamed_response_wrapper( load_balancers.list, ) + self.delete = to_streamed_response_wrapper( + load_balancers.delete, + ) + self.failover = to_streamed_response_wrapper( + load_balancers.failover, + ) + self.get = to_streamed_response_wrapper( + load_balancers.get, + ) + self.resize = to_streamed_response_wrapper( + load_balancers.resize, + ) @cached_property def l7_policies(self) -> L7PoliciesResourceWithStreamingResponse: @@ -625,6 +1229,10 @@ def listeners(self) -> ListenersResourceWithStreamingResponse: def pools(self) -> PoolsResourceWithStreamingResponse: return PoolsResourceWithStreamingResponse(self._load_balancers.pools) + @cached_property + def metrics(self) -> MetricsResourceWithStreamingResponse: + return MetricsResourceWithStreamingResponse(self._load_balancers.metrics) + @cached_property def statuses(self) -> StatusesResourceWithStreamingResponse: return StatusesResourceWithStreamingResponse(self._load_balancers.statuses) @@ -637,9 +1245,24 @@ def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: self.create = async_to_streamed_response_wrapper( load_balancers.create, ) + self.update = async_to_streamed_response_wrapper( + load_balancers.update, + ) self.list = async_to_streamed_response_wrapper( load_balancers.list, ) + self.delete = async_to_streamed_response_wrapper( + load_balancers.delete, + ) + self.failover = async_to_streamed_response_wrapper( + load_balancers.failover, + ) + self.get = async_to_streamed_response_wrapper( + load_balancers.get, + ) + self.resize = async_to_streamed_response_wrapper( + load_balancers.resize, + ) @cached_property def l7_policies(self) -> AsyncL7PoliciesResourceWithStreamingResponse: @@ -657,6 +1280,10 @@ def listeners(self) -> AsyncListenersResourceWithStreamingResponse: def pools(self) -> AsyncPoolsResourceWithStreamingResponse: return AsyncPoolsResourceWithStreamingResponse(self._load_balancers.pools) + @cached_property + def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: + return AsyncMetricsResourceWithStreamingResponse(self._load_balancers.metrics) + @cached_property def statuses(self) -> AsyncStatusesResourceWithStreamingResponse: return AsyncStatusesResourceWithStreamingResponse(self._load_balancers.statuses) diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py new file mode 100644 index 00000000..e7647609 --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -0,0 +1,205 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....types.cloud import InstanceMetricsTimeUnit +from ...._base_client import make_request_options +from ....types.cloud.load_balancers import metric_list_params +from ....types.cloud.instance_metrics_time_unit import InstanceMetricsTimeUnit +from ....types.cloud.load_balancer_metrics_list import LoadBalancerMetricsList + +__all__ = ["MetricsResource", "AsyncMetricsResource"] + + +class MetricsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> MetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return MetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return MetricsResourceWithStreamingResponse(self) + + def list( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + time_interval: int, + time_unit: InstanceMetricsTimeUnit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancerMetricsList: + """ + Get load balancer metrics, including cpu, memory and network + + Args: + time_interval: Time interval + + time_unit: Time interval unit + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/metrics", + body=maybe_transform( + { + "time_interval": time_interval, + "time_unit": time_unit, + }, + metric_list_params.MetricListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancerMetricsList, + ) + + +class AsyncMetricsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncMetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncMetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncMetricsResourceWithStreamingResponse(self) + + async def list( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + time_interval: int, + time_unit: InstanceMetricsTimeUnit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancerMetricsList: + """ + Get load balancer metrics, including cpu, memory and network + + Args: + time_interval: Time interval + + time_unit: Time interval unit + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/metrics", + body=await async_maybe_transform( + { + "time_interval": time_interval, + "time_unit": time_unit, + }, + metric_list_params.MetricListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancerMetricsList, + ) + + +class MetricsResourceWithRawResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_raw_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithRawResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_raw_response_wrapper( + metrics.list, + ) + + +class MetricsResourceWithStreamingResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_streamed_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithStreamingResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_streamed_response_wrapper( + metrics.list, + ) diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 7270e2a8..e537b073 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -14,6 +14,7 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options +from ....types.cloud.load_balancer_status import LoadBalancerStatus from ....types.cloud.load_balancer_status_list import LoadBalancerStatusList __all__ = ["StatusesResource", "AsyncStatusesResource"] @@ -75,6 +76,45 @@ def list( cast_to=LoadBalancerStatusList, ) + def get( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancerStatus: + """ + Get load balancer status + + 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 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 load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancerStatus, + ) + class AsyncStatusesResource(AsyncAPIResource): @cached_property @@ -132,6 +172,45 @@ async def list( cast_to=LoadBalancerStatusList, ) + async def get( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancerStatus: + """ + Get load balancer status + + 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 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 load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancerStatus, + ) + class StatusesResourceWithRawResponse: def __init__(self, statuses: StatusesResource) -> None: @@ -140,6 +219,9 @@ def __init__(self, statuses: StatusesResource) -> None: self.list = to_raw_response_wrapper( statuses.list, ) + self.get = to_raw_response_wrapper( + statuses.get, + ) class AsyncStatusesResourceWithRawResponse: @@ -149,6 +231,9 @@ def __init__(self, statuses: AsyncStatusesResource) -> None: self.list = async_to_raw_response_wrapper( statuses.list, ) + self.get = async_to_raw_response_wrapper( + statuses.get, + ) class StatusesResourceWithStreamingResponse: @@ -158,6 +243,9 @@ def __init__(self, statuses: StatusesResource) -> None: self.list = to_streamed_response_wrapper( statuses.list, ) + self.get = to_streamed_response_wrapper( + statuses.get, + ) class AsyncStatusesResourceWithStreamingResponse: @@ -167,3 +255,6 @@ def __init__(self, statuses: AsyncStatusesResource) -> None: self.list = async_to_streamed_response_wrapper( statuses.list, ) + self.get = async_to_streamed_response_wrapper( + statuses.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index e7f5de17..96c25d07 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -90,6 +90,7 @@ from .gpu_baremetal_cluster import GPUBaremetalCluster as GPUBaremetalCluster from .health_monitor_status import HealthMonitorStatus as HealthMonitorStatus from .load_balancer_l7_rule import LoadBalancerL7Rule as LoadBalancerL7Rule +from .load_balancer_metrics import LoadBalancerMetrics as LoadBalancerMetrics from .network_create_params import NetworkCreateParams as NetworkCreateParams from .network_update_params import NetworkUpdateParams as NetworkUpdateParams from .project_create_params import ProjectCreateParams as ProjectCreateParams @@ -117,6 +118,7 @@ from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams from .file_share_update_params import FileShareUpdateParams as FileShareUpdateParams from .k8s_cluster_version_list import K8sClusterVersionList as K8sClusterVersionList +from .load_balancer_get_params import LoadBalancerGetParams as LoadBalancerGetParams from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams @@ -129,6 +131,7 @@ from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit from .load_balancer_l7_rule_list import LoadBalancerL7RuleList as LoadBalancerL7RuleList +from .load_balancer_metrics_list import LoadBalancerMetricsList as LoadBalancerMetricsList from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField @@ -140,11 +143,14 @@ from .load_balancer_flavor_detail import LoadBalancerFlavorDetail as LoadBalancerFlavorDetail from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole from .load_balancer_listener_list import LoadBalancerListenerList as LoadBalancerListenerList +from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams +from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .load_balancer_l7_policy_list import LoadBalancerL7PolicyList as LoadBalancerL7PolicyList from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams +from .load_balancer_failover_params import LoadBalancerFailoverParams as LoadBalancerFailoverParams from .load_balancer_listener_detail import LoadBalancerListenerDetail as LoadBalancerListenerDetail from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams diff --git a/src/gcore/types/cloud/load_balancer_failover_params.py b/src/gcore/types/cloud/load_balancer_failover_params.py new file mode 100644 index 00000000..b4a727a7 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_failover_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["LoadBalancerFailoverParams"] + + +class LoadBalancerFailoverParams(TypedDict, total=False): + project_id: int + + region_id: int + + force: bool + """Validate current load balancer status before failover or not.""" diff --git a/src/gcore/types/cloud/load_balancer_get_params.py b/src/gcore/types/cloud/load_balancer_get_params.py new file mode 100644 index 00000000..233a6f3e --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_get_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_extensions import TypedDict + +__all__ = ["LoadBalancerGetParams"] + + +class LoadBalancerGetParams(TypedDict, total=False): + project_id: int + + region_id: int + + show_stats: bool + """Show statistics""" + + with_ddos: bool + """Show DDoS profile""" diff --git a/src/gcore/types/cloud/load_balancer_metrics.py b/src/gcore/types/cloud/load_balancer_metrics.py new file mode 100644 index 00000000..ffdf6859 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_metrics.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["LoadBalancerMetrics"] + + +class LoadBalancerMetrics(BaseModel): + cpu_util: Optional[float] = None + """CPU utilization, % (max 100% for multi-core)""" + + memory_util: Optional[float] = None + """RAM utilization, %""" + + network_bps_egress: Optional[float] = FieldInfo(alias="network_Bps_egress", default=None) + """Network out, bytes per second""" + + network_bps_ingress: Optional[float] = FieldInfo(alias="network_Bps_ingress", default=None) + """Network in, bytes per second""" + + network_pps_egress: Optional[float] = None + """Network out, packets per second""" + + network_pps_ingress: Optional[float] = None + """Network in, packets per second""" + + time: Optional[str] = None + """Timestamp""" diff --git a/src/gcore/types/cloud/load_balancer_metrics_list.py b/src/gcore/types/cloud/load_balancer_metrics_list.py new file mode 100644 index 00000000..c270faf1 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_metrics_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .load_balancer_metrics import LoadBalancerMetrics + +__all__ = ["LoadBalancerMetricsList"] + + +class LoadBalancerMetricsList(BaseModel): + count: int + """Number of objects""" + + results: List[LoadBalancerMetrics] + """Objects""" diff --git a/src/gcore/types/cloud/load_balancer_resize_params.py b/src/gcore/types/cloud/load_balancer_resize_params.py new file mode 100644 index 00000000..05055dfe --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_resize_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LoadBalancerResizeParams"] + + +class LoadBalancerResizeParams(TypedDict, total=False): + project_id: int + + region_id: int + + flavor: Required[str] + """Name of the desired flavor to resize to.""" diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py new file mode 100644 index 00000000..0870d49c --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -0,0 +1,69 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +from .tag_update_map_param import TagUpdateMapParam +from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam +from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity + +__all__ = ["LoadBalancerUpdateParams", "Logging"] + + +class LoadBalancerUpdateParams(TypedDict, total=False): + project_id: int + + region_id: int + + logging: Logging + """Logging configuration""" + + name: str + """Name.""" + + preferred_connectivity: LoadBalancerMemberConnectivity + """ + Preferred option to establish connectivity between load balancer and its pools + members + """ + + tags: Optional[TagUpdateMapParam] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ + + +class Logging(TypedDict, total=False): + destination_region_id: Optional[int] + """Destination region id to which the logs will be written""" + + enabled: bool + """Enable/disable forwarding logs to LaaS""" + + retention_policy: Optional[LaasIndexRetentionPolicyParam] + """The logs retention policy""" + + topic_name: Optional[str] + """The topic name to which the logs will be written""" diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index c25ce985..433f966c 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -4,6 +4,7 @@ from .pool_list_params import PoolListParams as PoolListParams from .flavor_list_params import FlavorListParams as FlavorListParams +from .metric_list_params import MetricListParams as MetricListParams from .pool_create_params import PoolCreateParams as PoolCreateParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .listener_get_params import ListenerGetParams as ListenerGetParams diff --git a/src/gcore/types/cloud/load_balancers/metric_list_params.py b/src/gcore/types/cloud/load_balancers/metric_list_params.py new file mode 100644 index 00000000..4af5e414 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/metric_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 Required, TypedDict + +from ..instance_metrics_time_unit import InstanceMetricsTimeUnit + +__all__ = ["MetricListParams"] + + +class MetricListParams(TypedDict, total=False): + project_id: int + + region_id: int + + time_interval: Required[int] + """Time interval""" + + time_unit: Required[InstanceMetricsTimeUnit] + """Time interval unit""" diff --git a/tests/api_resources/cloud/load_balancers/test_metrics.py b/tests/api_resources/cloud/load_balancers/test_metrics.py new file mode 100644 index 00000000..281f1d68 --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/test_metrics.py @@ -0,0 +1,132 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import LoadBalancerMetricsList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestMetrics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + metric = client.cloud.load_balancers.metrics.list( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.load_balancers.metrics.with_raw_response.list( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = response.parse() + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.load_balancers.metrics.with_streaming_response.list( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = response.parse() + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.metrics.with_raw_response.list( + load_balancer_id="", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + + +class TestAsyncMetrics: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + metric = await async_client.cloud.load_balancers.metrics.list( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.metrics.with_raw_response.list( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = await response.parse() + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.metrics.with_streaming_response.list( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = await response.parse() + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.metrics.with_raw_response.list( + load_balancer_id="", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) diff --git a/tests/api_resources/cloud/load_balancers/test_statuses.py b/tests/api_resources/cloud/load_balancers/test_statuses.py index a9583093..da7e88cb 100644 --- a/tests/api_resources/cloud/load_balancers/test_statuses.py +++ b/tests/api_resources/cloud/load_balancers/test_statuses.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerStatusList +from gcore.types.cloud import LoadBalancerStatus, LoadBalancerStatusList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -51,6 +51,52 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_get(self, client: Gcore) -> None: + status = client.cloud.load_balancers.statuses.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.load_balancers.statuses.with_raw_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + status = response.parse() + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.load_balancers.statuses.with_streaming_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + status = response.parse() + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.statuses.with_raw_response.get( + load_balancer_id="", + project_id=0, + region_id=0, + ) + class TestAsyncStatuses: parametrize = pytest.mark.parametrize( @@ -90,3 +136,49 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(LoadBalancerStatusList, status, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + status = await async_client.cloud.load_balancers.statuses.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.statuses.with_raw_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + status = await response.parse() + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.statuses.with_streaming_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + status = await response.parse() + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.statuses.with_raw_response.get( + load_balancer_id="", + project_id=0, + region_id=0, + ) diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index d365a629..faf824ef 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -158,6 +158,70 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_update(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + name="some_name", + preferred_connectivity="L2", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.update( + load_balancer_id="", + project_id=0, + region_id=0, + ) + @parametrize def test_method_list(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.list( @@ -210,6 +274,215 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_delete(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.delete( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.delete( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.delete( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.delete( + load_balancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_failover(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_method_failover_with_all_params(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + force=True, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_failover(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_failover(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_failover(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.failover( + load_balancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_method_get_with_all_params(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + show_stats=True, + with_ddos=True, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.get( + load_balancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_resize(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.resize( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_resize(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.resize( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_resize(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.resize( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_resize(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.resize( + load_balancer_id="", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + class TestAsyncLoadBalancers: parametrize = pytest.mark.parametrize( @@ -353,6 +626,70 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + name="some_name", + preferred_connectivity="L2", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.update( + load_balancer_id="", + project_id=0, + region_id=0, + ) + @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.list( @@ -404,3 +741,212 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(AsyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.delete( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.delete( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.delete( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.delete( + load_balancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_failover(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_method_failover_with_all_params(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + force=True, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_failover(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_failover(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_failover(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.failover( + load_balancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + show_stats=True, + with_ddos=True, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.get( + load_balancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_resize(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.resize( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.resize( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.resize( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_resize(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.resize( + load_balancer_id="", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) From 2269987624f91f68810823d8a566be4ee43aa67d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 14 Oct 2025 15:18:30 +0000 Subject: [PATCH 373/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index d13e0609..6631141a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-94563a57bbb285cfead93d0627bac0731dd32093481327a6328d8e3d678cbc37.yml openapi_spec_hash: 3af9864bebf6795a51b15af60b234510 -config_hash: 330219cbf58ba11acb43a8a4424673ac +config_hash: 15cb59d432f38477e728fcd4a41c3ecd From 597ed05f7b5493236e1a4925ebbda07745a04864 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 14 Oct 2025 21:09:38 +0000 Subject: [PATCH 374/592] feat(cloude): remove cloud_lbmember name --- .stats.yml | 8 +- api.md | 12 - .../cloud/load_balancers/__init__.py | 14 - .../cloud/load_balancers/listeners.py | 24 +- .../cloud/load_balancers/load_balancers.py | 629 +----------------- .../resources/cloud/load_balancers/metrics.py | 205 ------ .../cloud/load_balancers/pools/pools.py | 24 +- .../cloud/load_balancers/statuses.py | 91 --- src/gcore/types/cloud/__init__.py | 6 - .../cloud/load_balancer_create_params.py | 2 +- .../cloud/load_balancer_failover_params.py | 16 - .../types/cloud/load_balancer_get_params.py | 19 - .../cloud/load_balancer_listener_detail.py | 2 +- .../types/cloud/load_balancer_metrics.py | 32 - .../types/cloud/load_balancer_metrics_list.py | 16 - .../cloud/load_balancer_resize_params.py | 16 - .../cloud/load_balancer_update_params.py | 69 -- .../types/cloud/load_balancers/__init__.py | 1 - .../load_balancers/listener_create_params.py | 2 +- .../load_balancers/listener_list_params.py | 2 +- .../load_balancers/metric_list_params.py | 21 - .../load_balancers/pool_create_params.py | 2 +- .../cloud/load_balancers/pool_list_params.py | 2 +- .../cloud/load_balancers/test_listeners.py | 20 +- .../cloud/load_balancers/test_metrics.py | 132 ---- .../cloud/load_balancers/test_pools.py | 8 +- .../cloud/load_balancers/test_statuses.py | 94 +-- .../cloud/test_load_balancers.py | 550 +-------------- 28 files changed, 52 insertions(+), 1967 deletions(-) delete mode 100644 src/gcore/resources/cloud/load_balancers/metrics.py delete mode 100644 src/gcore/types/cloud/load_balancer_failover_params.py delete mode 100644 src/gcore/types/cloud/load_balancer_get_params.py delete mode 100644 src/gcore/types/cloud/load_balancer_metrics.py delete mode 100644 src/gcore/types/cloud/load_balancer_metrics_list.py delete mode 100644 src/gcore/types/cloud/load_balancer_resize_params.py delete mode 100644 src/gcore/types/cloud/load_balancer_update_params.py delete mode 100644 src/gcore/types/cloud/load_balancers/metric_list_params.py delete mode 100644 tests/api_resources/cloud/load_balancers/test_metrics.py diff --git a/.stats.yml b/.stats.yml index 6631141a..4c39159a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-94563a57bbb285cfead93d0627bac0731dd32093481327a6328d8e3d678cbc37.yml -openapi_spec_hash: 3af9864bebf6795a51b15af60b234510 -config_hash: 15cb59d432f38477e728fcd4a41c3ecd +configured_endpoints: 605 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9f065df469027bcaa0bd19a36a0f8f132271e837c4cb058f27f3c5c740298797.yml +openapi_spec_hash: 844a27c7d8957769e1fb98965f9f1df0 +config_hash: 16325d713dde8c8d722ff7890df2a16a diff --git a/api.md b/api.md index d2b0533c..815e5839 100644 --- a/api.md +++ b/api.md @@ -210,12 +210,7 @@ from gcore.types.cloud import ( Methods: - client.cloud.load_balancers.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.update(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer - client.cloud.load_balancers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[LoadBalancer] -- client.cloud.load_balancers.delete(load_balancer_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.load_balancers.failover(load_balancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.get(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer -- client.cloud.load_balancers.resize(load_balancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList ### L7Policies @@ -277,18 +272,11 @@ 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 -### Metrics - -Methods: - -- client.cloud.load_balancers.metrics.list(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancerMetricsList - ### Statuses Methods: - client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> LoadBalancerStatusList -- client.cloud.load_balancers.statuses.get(load_balancer_id, \*, project_id, region_id) -> LoadBalancerStatus ## ReservedFixedIPs diff --git a/src/gcore/resources/cloud/load_balancers/__init__.py b/src/gcore/resources/cloud/load_balancers/__init__.py index 4de45722..cdd5187e 100644 --- a/src/gcore/resources/cloud/load_balancers/__init__.py +++ b/src/gcore/resources/cloud/load_balancers/__init__.py @@ -16,14 +16,6 @@ FlavorsResourceWithStreamingResponse, AsyncFlavorsResourceWithStreamingResponse, ) -from .metrics import ( - MetricsResource, - AsyncMetricsResource, - MetricsResourceWithRawResponse, - AsyncMetricsResourceWithRawResponse, - MetricsResourceWithStreamingResponse, - AsyncMetricsResourceWithStreamingResponse, -) from .statuses import ( StatusesResource, AsyncStatusesResource, @@ -82,12 +74,6 @@ "AsyncPoolsResourceWithRawResponse", "PoolsResourceWithStreamingResponse", "AsyncPoolsResourceWithStreamingResponse", - "MetricsResource", - "AsyncMetricsResource", - "MetricsResourceWithRawResponse", - "AsyncMetricsResourceWithRawResponse", - "MetricsResourceWithStreamingResponse", - "AsyncMetricsResourceWithStreamingResponse", "StatusesResource", "AsyncStatusesResource", "StatusesResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 272880d8..8959a6b4 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -57,7 +57,7 @@ def create( *, project_id: int | None = None, region_id: int | None = None, - load_balancer_id: str, + loadbalancer_id: str, name: str, protocol: LbListenerProtocol, protocol_port: int, @@ -85,7 +85,7 @@ def create( region_id: Region ID - load_balancer_id: Load balancer ID + loadbalancer_id: Load balancer ID name: Load balancer listener name @@ -130,7 +130,7 @@ def create( f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=maybe_transform( { - "load_balancer_id": load_balancer_id, + "loadbalancer_id": loadbalancer_id, "name": name, "protocol": protocol, "protocol_port": protocol_port, @@ -245,7 +245,7 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - load_balancer_id: str | Omit = omit, + loadbalancer_id: str | Omit = omit, show_stats: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -262,7 +262,7 @@ def list( region_id: Region ID - load_balancer_id: Load Balancer ID + loadbalancer_id: Load Balancer ID show_stats: Show stats @@ -287,7 +287,7 @@ def list( timeout=timeout, query=maybe_transform( { - "load_balancer_id": load_balancer_id, + "loadbalancer_id": loadbalancer_id, "show_stats": show_stats, }, listener_list_params.ListenerListParams, @@ -419,7 +419,7 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, - load_balancer_id: str, + loadbalancer_id: str, name: str, protocol: LbListenerProtocol, protocol_port: int, @@ -447,7 +447,7 @@ async def create( region_id: Region ID - load_balancer_id: Load balancer ID + loadbalancer_id: Load balancer ID name: Load balancer listener name @@ -492,7 +492,7 @@ async def create( f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=await async_maybe_transform( { - "load_balancer_id": load_balancer_id, + "loadbalancer_id": loadbalancer_id, "name": name, "protocol": protocol, "protocol_port": protocol_port, @@ -607,7 +607,7 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - load_balancer_id: str | Omit = omit, + loadbalancer_id: str | Omit = omit, show_stats: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -624,7 +624,7 @@ async def list( region_id: Region ID - load_balancer_id: Load Balancer ID + loadbalancer_id: Load Balancer ID show_stats: Show stats @@ -649,7 +649,7 @@ async def list( timeout=timeout, query=await async_maybe_transform( { - "load_balancer_id": load_balancer_id, + "loadbalancer_id": loadbalancer_id, "show_stats": show_stats, }, listener_list_params.ListenerListParams, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 12138750..1609b8b7 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Dict, Iterable import httpx @@ -14,14 +14,6 @@ FlavorsResourceWithStreamingResponse, AsyncFlavorsResourceWithStreamingResponse, ) -from .metrics import ( - MetricsResource, - AsyncMetricsResource, - MetricsResourceWithRawResponse, - AsyncMetricsResourceWithRawResponse, - MetricsResourceWithStreamingResponse, - AsyncMetricsResourceWithStreamingResponse, -) from .statuses import ( StatusesResource, AsyncStatusesResource, @@ -60,12 +52,8 @@ from ....types.cloud import ( InterfaceIPFamily, LoadBalancerMemberConnectivity, - load_balancer_get_params, load_balancer_list_params, load_balancer_create_params, - load_balancer_resize_params, - load_balancer_update_params, - load_balancer_failover_params, ) from ...._base_client import AsyncPaginator, make_request_options from .l7_policies.l7_policies import ( @@ -79,7 +67,6 @@ from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.load_balancer import LoadBalancer from ....types.cloud.interface_ip_family import InterfaceIPFamily -from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.load_balancer_member_connectivity import LoadBalancerMemberConnectivity __all__ = ["LoadBalancersResource", "AsyncLoadBalancersResource"] @@ -102,10 +89,6 @@ def listeners(self) -> ListenersResource: def pools(self) -> PoolsResource: return PoolsResource(self._client) - @cached_property - def metrics(self) -> MetricsResource: - return MetricsResource(self._client) - @cached_property def statuses(self) -> StatusesResource: return StatusesResource(self._client) @@ -231,90 +214,6 @@ def create( cast_to=TaskIDList, ) - def update( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - logging: load_balancer_update_params.Logging | Omit = omit, - name: str | Omit = omit, - preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, - tags: Optional[TagUpdateMapParam] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancer: - """ - Rename load balancer, activate/deactivate logging, update preferred connectivity - type and/or modify load balancer tags. The request will only process the fields - that are provided in the request body. Any fields that are not included will - remain unchanged. - - Args: - logging: Logging configuration - - name: Name. - - preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools - members - - tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide - key-value pairs to add or update tags. Set tag values to `null` to remove tags. - Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. - - **Examples:** - - - **Add/update tags:** - `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or - updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only - tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates - specified tags. - - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - - **Replace all:** first delete existing tags with null values, then add new - ones in the same request. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", - body=maybe_transform( - { - "logging": logging, - "name": name, - "preferred_connectivity": preferred_connectivity, - "tags": tags, - }, - load_balancer_update_params.LoadBalancerUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LoadBalancer, - ) - def list( self, *, @@ -403,186 +302,6 @@ def list( model=LoadBalancer, ) - def delete( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Delete load balancer - - 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 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 load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - def failover( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - force: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Failover load balancer - - Args: - force: Validate current load balancer status before failover or not. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/failover", - body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - def get( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - show_stats: bool | Omit = omit, - with_ddos: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancer: - """ - Get load balancer - - Args: - show_stats: Show statistics - - with_ddos: Show DDoS profile - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "show_stats": show_stats, - "with_ddos": with_ddos, - }, - load_balancer_get_params.LoadBalancerGetParams, - ), - ), - cast_to=LoadBalancer, - ) - - def resize( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - flavor: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Resize load balancer - - Args: - flavor: Name of the desired flavor to resize to. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/resize", - body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - class AsyncLoadBalancersResource(AsyncAPIResource): @cached_property @@ -601,10 +320,6 @@ def listeners(self) -> AsyncListenersResource: def pools(self) -> AsyncPoolsResource: return AsyncPoolsResource(self._client) - @cached_property - def metrics(self) -> AsyncMetricsResource: - return AsyncMetricsResource(self._client) - @cached_property def statuses(self) -> AsyncStatusesResource: return AsyncStatusesResource(self._client) @@ -730,90 +445,6 @@ async def create( cast_to=TaskIDList, ) - async def update( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - logging: load_balancer_update_params.Logging | Omit = omit, - name: str | Omit = omit, - preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, - tags: Optional[TagUpdateMapParam] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancer: - """ - Rename load balancer, activate/deactivate logging, update preferred connectivity - type and/or modify load balancer tags. The request will only process the fields - that are provided in the request body. Any fields that are not included will - remain unchanged. - - Args: - logging: Logging configuration - - name: Name. - - preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools - members - - tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide - key-value pairs to add or update tags. Set tag values to `null` to remove tags. - Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. - - **Examples:** - - - **Add/update tags:** - `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or - updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only - tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates - specified tags. - - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - - **Replace all:** first delete existing tags with null values, then add new - ones in the same request. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return await self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", - body=await async_maybe_transform( - { - "logging": logging, - "name": name, - "preferred_connectivity": preferred_connectivity, - "tags": tags, - }, - load_balancer_update_params.LoadBalancerUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LoadBalancer, - ) - def list( self, *, @@ -902,188 +533,6 @@ def list( model=LoadBalancer, ) - async def delete( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Delete load balancer - - 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 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 load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return await self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - async def failover( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - force: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Failover load balancer - - Args: - force: Validate current load balancer status before failover or not. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/failover", - body=await async_maybe_transform( - {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - async def get( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - show_stats: bool | Omit = omit, - with_ddos: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancer: - """ - Get load balancer - - Args: - show_stats: Show statistics - - with_ddos: Show DDoS profile - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "show_stats": show_stats, - "with_ddos": with_ddos, - }, - load_balancer_get_params.LoadBalancerGetParams, - ), - ), - cast_to=LoadBalancer, - ) - - async def resize( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - flavor: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Resize load balancer - - Args: - flavor: Name of the desired flavor to resize to. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/resize", - body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - class LoadBalancersResourceWithRawResponse: def __init__(self, load_balancers: LoadBalancersResource) -> None: @@ -1092,24 +541,9 @@ def __init__(self, load_balancers: LoadBalancersResource) -> None: self.create = to_raw_response_wrapper( load_balancers.create, ) - self.update = to_raw_response_wrapper( - load_balancers.update, - ) self.list = to_raw_response_wrapper( load_balancers.list, ) - self.delete = to_raw_response_wrapper( - load_balancers.delete, - ) - self.failover = to_raw_response_wrapper( - load_balancers.failover, - ) - self.get = to_raw_response_wrapper( - load_balancers.get, - ) - self.resize = to_raw_response_wrapper( - load_balancers.resize, - ) @cached_property def l7_policies(self) -> L7PoliciesResourceWithRawResponse: @@ -1127,10 +561,6 @@ def listeners(self) -> ListenersResourceWithRawResponse: def pools(self) -> PoolsResourceWithRawResponse: return PoolsResourceWithRawResponse(self._load_balancers.pools) - @cached_property - def metrics(self) -> MetricsResourceWithRawResponse: - return MetricsResourceWithRawResponse(self._load_balancers.metrics) - @cached_property def statuses(self) -> StatusesResourceWithRawResponse: return StatusesResourceWithRawResponse(self._load_balancers.statuses) @@ -1143,24 +573,9 @@ def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: self.create = async_to_raw_response_wrapper( load_balancers.create, ) - self.update = async_to_raw_response_wrapper( - load_balancers.update, - ) self.list = async_to_raw_response_wrapper( load_balancers.list, ) - self.delete = async_to_raw_response_wrapper( - load_balancers.delete, - ) - self.failover = async_to_raw_response_wrapper( - load_balancers.failover, - ) - self.get = async_to_raw_response_wrapper( - load_balancers.get, - ) - self.resize = async_to_raw_response_wrapper( - load_balancers.resize, - ) @cached_property def l7_policies(self) -> AsyncL7PoliciesResourceWithRawResponse: @@ -1178,10 +593,6 @@ def listeners(self) -> AsyncListenersResourceWithRawResponse: def pools(self) -> AsyncPoolsResourceWithRawResponse: return AsyncPoolsResourceWithRawResponse(self._load_balancers.pools) - @cached_property - def metrics(self) -> AsyncMetricsResourceWithRawResponse: - return AsyncMetricsResourceWithRawResponse(self._load_balancers.metrics) - @cached_property def statuses(self) -> AsyncStatusesResourceWithRawResponse: return AsyncStatusesResourceWithRawResponse(self._load_balancers.statuses) @@ -1194,24 +605,9 @@ def __init__(self, load_balancers: LoadBalancersResource) -> None: self.create = to_streamed_response_wrapper( load_balancers.create, ) - self.update = to_streamed_response_wrapper( - load_balancers.update, - ) self.list = to_streamed_response_wrapper( load_balancers.list, ) - self.delete = to_streamed_response_wrapper( - load_balancers.delete, - ) - self.failover = to_streamed_response_wrapper( - load_balancers.failover, - ) - self.get = to_streamed_response_wrapper( - load_balancers.get, - ) - self.resize = to_streamed_response_wrapper( - load_balancers.resize, - ) @cached_property def l7_policies(self) -> L7PoliciesResourceWithStreamingResponse: @@ -1229,10 +625,6 @@ def listeners(self) -> ListenersResourceWithStreamingResponse: def pools(self) -> PoolsResourceWithStreamingResponse: return PoolsResourceWithStreamingResponse(self._load_balancers.pools) - @cached_property - def metrics(self) -> MetricsResourceWithStreamingResponse: - return MetricsResourceWithStreamingResponse(self._load_balancers.metrics) - @cached_property def statuses(self) -> StatusesResourceWithStreamingResponse: return StatusesResourceWithStreamingResponse(self._load_balancers.statuses) @@ -1245,24 +637,9 @@ def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: self.create = async_to_streamed_response_wrapper( load_balancers.create, ) - self.update = async_to_streamed_response_wrapper( - load_balancers.update, - ) self.list = async_to_streamed_response_wrapper( load_balancers.list, ) - self.delete = async_to_streamed_response_wrapper( - load_balancers.delete, - ) - self.failover = async_to_streamed_response_wrapper( - load_balancers.failover, - ) - self.get = async_to_streamed_response_wrapper( - load_balancers.get, - ) - self.resize = async_to_streamed_response_wrapper( - load_balancers.resize, - ) @cached_property def l7_policies(self) -> AsyncL7PoliciesResourceWithStreamingResponse: @@ -1280,10 +657,6 @@ def listeners(self) -> AsyncListenersResourceWithStreamingResponse: def pools(self) -> AsyncPoolsResourceWithStreamingResponse: return AsyncPoolsResourceWithStreamingResponse(self._load_balancers.pools) - @cached_property - def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: - return AsyncMetricsResourceWithStreamingResponse(self._load_balancers.metrics) - @cached_property def statuses(self) -> AsyncStatusesResourceWithStreamingResponse: return AsyncStatusesResourceWithStreamingResponse(self._load_balancers.statuses) diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py deleted file mode 100644 index e7647609..00000000 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ /dev/null @@ -1,205 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import Body, Query, Headers, NotGiven, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....types.cloud import InstanceMetricsTimeUnit -from ...._base_client import make_request_options -from ....types.cloud.load_balancers import metric_list_params -from ....types.cloud.instance_metrics_time_unit import InstanceMetricsTimeUnit -from ....types.cloud.load_balancer_metrics_list import LoadBalancerMetricsList - -__all__ = ["MetricsResource", "AsyncMetricsResource"] - - -class MetricsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> MetricsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers - """ - return MetricsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response - """ - return MetricsResourceWithStreamingResponse(self) - - def list( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - time_interval: int, - time_unit: InstanceMetricsTimeUnit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerMetricsList: - """ - Get load balancer metrics, including cpu, memory and network - - Args: - time_interval: Time interval - - time_unit: Time interval unit - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/metrics", - body=maybe_transform( - { - "time_interval": time_interval, - "time_unit": time_unit, - }, - metric_list_params.MetricListParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LoadBalancerMetricsList, - ) - - -class AsyncMetricsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncMetricsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers - """ - return AsyncMetricsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response - """ - return AsyncMetricsResourceWithStreamingResponse(self) - - async def list( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - time_interval: int, - time_unit: InstanceMetricsTimeUnit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerMetricsList: - """ - Get load balancer metrics, including cpu, memory and network - - Args: - time_interval: Time interval - - time_unit: Time interval unit - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/metrics", - body=await async_maybe_transform( - { - "time_interval": time_interval, - "time_unit": time_unit, - }, - metric_list_params.MetricListParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LoadBalancerMetricsList, - ) - - -class MetricsResourceWithRawResponse: - def __init__(self, metrics: MetricsResource) -> None: - self._metrics = metrics - - self.list = to_raw_response_wrapper( - metrics.list, - ) - - -class AsyncMetricsResourceWithRawResponse: - def __init__(self, metrics: AsyncMetricsResource) -> None: - self._metrics = metrics - - self.list = async_to_raw_response_wrapper( - metrics.list, - ) - - -class MetricsResourceWithStreamingResponse: - def __init__(self, metrics: MetricsResource) -> None: - self._metrics = metrics - - self.list = to_streamed_response_wrapper( - metrics.list, - ) - - -class AsyncMetricsResourceWithStreamingResponse: - def __init__(self, metrics: AsyncMetricsResource) -> None: - self._metrics = metrics - - self.list = async_to_streamed_response_wrapper( - metrics.list, - ) diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 1b3ddd58..3ee27f95 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -84,7 +84,7 @@ def create( crl_secret_id: Optional[str] | Omit = omit, healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, listener_id: Optional[str] | Omit = omit, - load_balancer_id: Optional[str] | Omit = omit, + loadbalancer_id: Optional[str] | Omit = omit, members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, secret_id: Optional[str] | Omit = omit, session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, @@ -120,7 +120,7 @@ def create( listener_id: Listener ID - load_balancer_id: Loadbalancer ID + loadbalancer_id: Loadbalancer ID members: Pool members @@ -157,7 +157,7 @@ def create( "crl_secret_id": crl_secret_id, "healthmonitor": healthmonitor, "listener_id": listener_id, - "load_balancer_id": load_balancer_id, + "loadbalancer_id": loadbalancer_id, "members": members, "secret_id": secret_id, "session_persistence": session_persistence, @@ -296,7 +296,7 @@ def list( region_id: int | None = None, details: bool | Omit = omit, listener_id: str | Omit = omit, - load_balancer_id: str | Omit = omit, + loadbalancer_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -316,7 +316,7 @@ def list( listener_id: Listener ID - load_balancer_id: Load Balancer ID + loadbalancer_id: Load Balancer ID extra_headers: Send extra headers @@ -341,7 +341,7 @@ def list( { "details": details, "listener_id": listener_id, - "load_balancer_id": load_balancer_id, + "loadbalancer_id": loadbalancer_id, }, pool_list_params.PoolListParams, ), @@ -480,7 +480,7 @@ async def create( crl_secret_id: Optional[str] | Omit = omit, healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, listener_id: Optional[str] | Omit = omit, - load_balancer_id: Optional[str] | Omit = omit, + loadbalancer_id: Optional[str] | Omit = omit, members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, secret_id: Optional[str] | Omit = omit, session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, @@ -516,7 +516,7 @@ async def create( listener_id: Listener ID - load_balancer_id: Loadbalancer ID + loadbalancer_id: Loadbalancer ID members: Pool members @@ -553,7 +553,7 @@ async def create( "crl_secret_id": crl_secret_id, "healthmonitor": healthmonitor, "listener_id": listener_id, - "load_balancer_id": load_balancer_id, + "loadbalancer_id": loadbalancer_id, "members": members, "secret_id": secret_id, "session_persistence": session_persistence, @@ -692,7 +692,7 @@ async def list( region_id: int | None = None, details: bool | Omit = omit, listener_id: str | Omit = omit, - load_balancer_id: str | Omit = omit, + loadbalancer_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -712,7 +712,7 @@ async def list( listener_id: Listener ID - load_balancer_id: Load Balancer ID + loadbalancer_id: Load Balancer ID extra_headers: Send extra headers @@ -737,7 +737,7 @@ async def list( { "details": details, "listener_id": listener_id, - "load_balancer_id": load_balancer_id, + "loadbalancer_id": loadbalancer_id, }, pool_list_params.PoolListParams, ), diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index e537b073..7270e2a8 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -14,7 +14,6 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.cloud.load_balancer_status import LoadBalancerStatus from ....types.cloud.load_balancer_status_list import LoadBalancerStatusList __all__ = ["StatusesResource", "AsyncStatusesResource"] @@ -76,45 +75,6 @@ def list( cast_to=LoadBalancerStatusList, ) - def get( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerStatus: - """ - Get load balancer status - - 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 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 load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/status", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LoadBalancerStatus, - ) - class AsyncStatusesResource(AsyncAPIResource): @cached_property @@ -172,45 +132,6 @@ async def list( cast_to=LoadBalancerStatusList, ) - async def get( - self, - load_balancer_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerStatus: - """ - Get load balancer status - - 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 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 load_balancer_id: - raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") - return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/status", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LoadBalancerStatus, - ) - class StatusesResourceWithRawResponse: def __init__(self, statuses: StatusesResource) -> None: @@ -219,9 +140,6 @@ def __init__(self, statuses: StatusesResource) -> None: self.list = to_raw_response_wrapper( statuses.list, ) - self.get = to_raw_response_wrapper( - statuses.get, - ) class AsyncStatusesResourceWithRawResponse: @@ -231,9 +149,6 @@ def __init__(self, statuses: AsyncStatusesResource) -> None: self.list = async_to_raw_response_wrapper( statuses.list, ) - self.get = async_to_raw_response_wrapper( - statuses.get, - ) class StatusesResourceWithStreamingResponse: @@ -243,9 +158,6 @@ def __init__(self, statuses: StatusesResource) -> None: self.list = to_streamed_response_wrapper( statuses.list, ) - self.get = to_streamed_response_wrapper( - statuses.get, - ) class AsyncStatusesResourceWithStreamingResponse: @@ -255,6 +167,3 @@ def __init__(self, statuses: AsyncStatusesResource) -> None: self.list = async_to_streamed_response_wrapper( statuses.list, ) - self.get = async_to_streamed_response_wrapper( - statuses.get, - ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 96c25d07..e7f5de17 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -90,7 +90,6 @@ from .gpu_baremetal_cluster import GPUBaremetalCluster as GPUBaremetalCluster from .health_monitor_status import HealthMonitorStatus as HealthMonitorStatus from .load_balancer_l7_rule import LoadBalancerL7Rule as LoadBalancerL7Rule -from .load_balancer_metrics import LoadBalancerMetrics as LoadBalancerMetrics from .network_create_params import NetworkCreateParams as NetworkCreateParams from .network_update_params import NetworkUpdateParams as NetworkUpdateParams from .project_create_params import ProjectCreateParams as ProjectCreateParams @@ -118,7 +117,6 @@ from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams from .file_share_update_params import FileShareUpdateParams as FileShareUpdateParams from .k8s_cluster_version_list import K8sClusterVersionList as K8sClusterVersionList -from .load_balancer_get_params import LoadBalancerGetParams as LoadBalancerGetParams from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams @@ -131,7 +129,6 @@ from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit from .load_balancer_l7_rule_list import LoadBalancerL7RuleList as LoadBalancerL7RuleList -from .load_balancer_metrics_list import LoadBalancerMetricsList as LoadBalancerMetricsList from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField @@ -143,14 +140,11 @@ from .load_balancer_flavor_detail import LoadBalancerFlavorDetail as LoadBalancerFlavorDetail from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole from .load_balancer_listener_list import LoadBalancerListenerList as LoadBalancerListenerList -from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams -from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .load_balancer_l7_policy_list import LoadBalancerL7PolicyList as LoadBalancerL7PolicyList from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams -from .load_balancer_failover_params import LoadBalancerFailoverParams as LoadBalancerFailoverParams from .load_balancer_listener_detail import LoadBalancerListenerDetail as LoadBalancerListenerDetail from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index a41fd6e4..7a4c3051 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -274,7 +274,7 @@ class ListenerPool(TypedDict, total=False): listener_id: Optional[str] """Listener ID""" - load_balancer_id: Optional[str] + loadbalancer_id: Optional[str] """Loadbalancer ID""" members: Optional[Iterable[ListenerPoolMember]] diff --git a/src/gcore/types/cloud/load_balancer_failover_params.py b/src/gcore/types/cloud/load_balancer_failover_params.py deleted file mode 100644 index b4a727a7..00000000 --- a/src/gcore/types/cloud/load_balancer_failover_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["LoadBalancerFailoverParams"] - - -class LoadBalancerFailoverParams(TypedDict, total=False): - project_id: int - - region_id: int - - force: bool - """Validate current load balancer status before failover or not.""" diff --git a/src/gcore/types/cloud/load_balancer_get_params.py b/src/gcore/types/cloud/load_balancer_get_params.py deleted file mode 100644 index 233a6f3e..00000000 --- a/src/gcore/types/cloud/load_balancer_get_params.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["LoadBalancerGetParams"] - - -class LoadBalancerGetParams(TypedDict, total=False): - project_id: int - - region_id: int - - show_stats: bool - """Show statistics""" - - with_ddos: bool - """Show DDoS profile""" diff --git a/src/gcore/types/cloud/load_balancer_listener_detail.py b/src/gcore/types/cloud/load_balancer_listener_detail.py index e230a736..41d9a4c6 100644 --- a/src/gcore/types/cloud/load_balancer_listener_detail.py +++ b/src/gcore/types/cloud/load_balancer_listener_detail.py @@ -38,7 +38,7 @@ class LoadBalancerListenerDetail(BaseModel): Only used with HTTP and `TERMINATED_HTTPS` protocols. """ - load_balancer_id: Optional[str] = None + loadbalancer_id: Optional[str] = None """Load balancer ID""" name: str diff --git a/src/gcore/types/cloud/load_balancer_metrics.py b/src/gcore/types/cloud/load_balancer_metrics.py deleted file mode 100644 index ffdf6859..00000000 --- a/src/gcore/types/cloud/load_balancer_metrics.py +++ /dev/null @@ -1,32 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = ["LoadBalancerMetrics"] - - -class LoadBalancerMetrics(BaseModel): - cpu_util: Optional[float] = None - """CPU utilization, % (max 100% for multi-core)""" - - memory_util: Optional[float] = None - """RAM utilization, %""" - - network_bps_egress: Optional[float] = FieldInfo(alias="network_Bps_egress", default=None) - """Network out, bytes per second""" - - network_bps_ingress: Optional[float] = FieldInfo(alias="network_Bps_ingress", default=None) - """Network in, bytes per second""" - - network_pps_egress: Optional[float] = None - """Network out, packets per second""" - - network_pps_ingress: Optional[float] = None - """Network in, packets per second""" - - time: Optional[str] = None - """Timestamp""" diff --git a/src/gcore/types/cloud/load_balancer_metrics_list.py b/src/gcore/types/cloud/load_balancer_metrics_list.py deleted file mode 100644 index c270faf1..00000000 --- a/src/gcore/types/cloud/load_balancer_metrics_list.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .load_balancer_metrics import LoadBalancerMetrics - -__all__ = ["LoadBalancerMetricsList"] - - -class LoadBalancerMetricsList(BaseModel): - count: int - """Number of objects""" - - results: List[LoadBalancerMetrics] - """Objects""" diff --git a/src/gcore/types/cloud/load_balancer_resize_params.py b/src/gcore/types/cloud/load_balancer_resize_params.py deleted file mode 100644 index 05055dfe..00000000 --- a/src/gcore/types/cloud/load_balancer_resize_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["LoadBalancerResizeParams"] - - -class LoadBalancerResizeParams(TypedDict, total=False): - project_id: int - - region_id: int - - flavor: Required[str] - """Name of the desired flavor to resize to.""" diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py deleted file mode 100644 index 0870d49c..00000000 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ /dev/null @@ -1,69 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import TypedDict - -from .tag_update_map_param import TagUpdateMapParam -from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam -from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity - -__all__ = ["LoadBalancerUpdateParams", "Logging"] - - -class LoadBalancerUpdateParams(TypedDict, total=False): - project_id: int - - region_id: int - - logging: Logging - """Logging configuration""" - - name: str - """Name.""" - - preferred_connectivity: LoadBalancerMemberConnectivity - """ - Preferred option to establish connectivity between load balancer and its pools - members - """ - - tags: Optional[TagUpdateMapParam] - """Update key-value tags using JSON Merge Patch semantics (RFC 7386). - - Provide key-value pairs to add or update tags. Set tag values to `null` to - remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. - - **Examples:** - - - **Add/update tags:** - `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or - updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only - tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates - specified tags. - - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - - **Replace all:** first delete existing tags with null values, then add new - ones in the same request. - """ - - -class Logging(TypedDict, total=False): - destination_region_id: Optional[int] - """Destination region id to which the logs will be written""" - - enabled: bool - """Enable/disable forwarding logs to LaaS""" - - retention_policy: Optional[LaasIndexRetentionPolicyParam] - """The logs retention policy""" - - topic_name: Optional[str] - """The topic name to which the logs will be written""" diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index 433f966c..c25ce985 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -4,7 +4,6 @@ from .pool_list_params import PoolListParams as PoolListParams from .flavor_list_params import FlavorListParams as FlavorListParams -from .metric_list_params import MetricListParams as MetricListParams from .pool_create_params import PoolCreateParams as PoolCreateParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .listener_get_params import ListenerGetParams as ListenerGetParams diff --git a/src/gcore/types/cloud/load_balancers/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py index c5b6f5e6..7f7bf451 100644 --- a/src/gcore/types/cloud/load_balancers/listener_create_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -18,7 +18,7 @@ class ListenerCreateParams(TypedDict, total=False): region_id: int """Region ID""" - load_balancer_id: Required[str] + loadbalancer_id: Required[str] """Load balancer ID""" name: Required[str] diff --git a/src/gcore/types/cloud/load_balancers/listener_list_params.py b/src/gcore/types/cloud/load_balancers/listener_list_params.py index c3e9925f..783d8482 100644 --- a/src/gcore/types/cloud/load_balancers/listener_list_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_list_params.py @@ -14,7 +14,7 @@ class ListenerListParams(TypedDict, total=False): region_id: int """Region ID""" - load_balancer_id: str + loadbalancer_id: str """Load Balancer ID""" show_stats: bool diff --git a/src/gcore/types/cloud/load_balancers/metric_list_params.py b/src/gcore/types/cloud/load_balancers/metric_list_params.py deleted file mode 100644 index 4af5e414..00000000 --- a/src/gcore/types/cloud/load_balancers/metric_list_params.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from ..instance_metrics_time_unit import InstanceMetricsTimeUnit - -__all__ = ["MetricListParams"] - - -class MetricListParams(TypedDict, total=False): - project_id: int - - region_id: int - - time_interval: Required[int] - """Time interval""" - - time_unit: Required[InstanceMetricsTimeUnit] - """Time interval unit""" 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 492e9640..b19fb813 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -42,7 +42,7 @@ class PoolCreateParams(TypedDict, total=False): listener_id: Optional[str] """Listener ID""" - load_balancer_id: Optional[str] + loadbalancer_id: Optional[str] """Loadbalancer ID""" members: Optional[Iterable[Member]] diff --git a/src/gcore/types/cloud/load_balancers/pool_list_params.py b/src/gcore/types/cloud/load_balancers/pool_list_params.py index 1cddb97b..16020665 100644 --- a/src/gcore/types/cloud/load_balancers/pool_list_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_list_params.py @@ -20,5 +20,5 @@ class PoolListParams(TypedDict, total=False): listener_id: str """Listener ID""" - load_balancer_id: str + loadbalancer_id: str """Load Balancer ID""" diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index b7228ea5..2605c9f6 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -22,7 +22,7 @@ def test_method_create(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.create( project_id=1, region_id=1, - load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.create( project_id=1, region_id=1, - load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -60,7 +60,7 @@ def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.load_balancers.listeners.with_raw_response.create( project_id=1, region_id=1, - load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -76,7 +76,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.load_balancers.listeners.with_streaming_response.create( project_id=1, region_id=1, - load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -171,7 +171,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.list( project_id=1, region_id=1, - load_balancer_id="00000000-0000-4000-8000-000000000000", + loadbalancer_id="00000000-0000-4000-8000-000000000000", show_stats=True, ) assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @@ -315,7 +315,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: listener = await async_client.cloud.load_balancers.listeners.create( project_id=1, region_id=1, - load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -327,7 +327,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> listener = await async_client.cloud.load_balancers.listeners.create( project_id=1, region_id=1, - load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -353,7 +353,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.listeners.with_raw_response.create( project_id=1, region_id=1, - load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -369,7 +369,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None async with async_client.cloud.load_balancers.listeners.with_streaming_response.create( project_id=1, region_id=1, - load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -464,7 +464,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No listener = await async_client.cloud.load_balancers.listeners.list( project_id=1, region_id=1, - load_balancer_id="00000000-0000-4000-8000-000000000000", + loadbalancer_id="00000000-0000-4000-8000-000000000000", show_stats=True, ) assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) diff --git a/tests/api_resources/cloud/load_balancers/test_metrics.py b/tests/api_resources/cloud/load_balancers/test_metrics.py deleted file mode 100644 index 281f1d68..00000000 --- a/tests/api_resources/cloud/load_balancers/test_metrics.py +++ /dev/null @@ -1,132 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from gcore import Gcore, AsyncGcore -from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerMetricsList - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestMetrics: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Gcore) -> None: - metric = client.cloud.load_balancers.metrics.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.load_balancers.metrics.with_raw_response.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - metric = response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.load_balancers.metrics.with_streaming_response.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - metric = response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - client.cloud.load_balancers.metrics.with_raw_response.list( - load_balancer_id="", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) - - -class TestAsyncMetrics: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_list(self, async_client: AsyncGcore) -> None: - metric = await async_client.cloud.load_balancers.metrics.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.metrics.with_raw_response.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - metric = await response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.metrics.with_streaming_response.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - metric = await response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - await async_client.cloud.load_balancers.metrics.with_raw_response.list( - load_balancer_id="", - project_id=0, - region_id=0, - time_interval=6, - time_unit="day", - ) diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py index 0b095c3d..f926dcc0 100644 --- a/tests/api_resources/cloud/load_balancers/test_pools.py +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -49,7 +49,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "url_path": "/", }, listener_id="listener_id", - load_balancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + loadbalancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", members=[ { "address": "192.168.1.101", @@ -227,7 +227,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: region_id=1, details=True, listener_id="00000000-0000-4000-8000-000000000000", - load_balancer_id="00000000-0000-4000-8000-000000000000", + loadbalancer_id="00000000-0000-4000-8000-000000000000", ) assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @@ -387,7 +387,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "url_path": "/", }, listener_id="listener_id", - load_balancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + loadbalancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", members=[ { "address": "192.168.1.101", @@ -565,7 +565,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No region_id=1, details=True, listener_id="00000000-0000-4000-8000-000000000000", - load_balancer_id="00000000-0000-4000-8000-000000000000", + loadbalancer_id="00000000-0000-4000-8000-000000000000", ) assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) diff --git a/tests/api_resources/cloud/load_balancers/test_statuses.py b/tests/api_resources/cloud/load_balancers/test_statuses.py index da7e88cb..a9583093 100644 --- a/tests/api_resources/cloud/load_balancers/test_statuses.py +++ b/tests/api_resources/cloud/load_balancers/test_statuses.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerStatus, LoadBalancerStatusList +from gcore.types.cloud import LoadBalancerStatusList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -51,52 +51,6 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_get(self, client: Gcore) -> None: - status = client.cloud.load_balancers.statuses.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(LoadBalancerStatus, status, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.load_balancers.statuses.with_raw_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - status = response.parse() - assert_matches_type(LoadBalancerStatus, status, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.load_balancers.statuses.with_streaming_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - status = response.parse() - assert_matches_type(LoadBalancerStatus, status, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - client.cloud.load_balancers.statuses.with_raw_response.get( - load_balancer_id="", - project_id=0, - region_id=0, - ) - class TestAsyncStatuses: parametrize = pytest.mark.parametrize( @@ -136,49 +90,3 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(LoadBalancerStatusList, status, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_get(self, async_client: AsyncGcore) -> None: - status = await async_client.cloud.load_balancers.statuses.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(LoadBalancerStatus, status, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.statuses.with_raw_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - status = await response.parse() - assert_matches_type(LoadBalancerStatus, status, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.statuses.with_streaming_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - status = await response.parse() - assert_matches_type(LoadBalancerStatus, status, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - await async_client.cloud.load_balancers.statuses.with_raw_response.get( - load_balancer_id="", - project_id=0, - region_id=0, - ) diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index faf824ef..8bb41cbf 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -65,7 +65,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "url_path": "/", }, "listener_id": "listener_id", - "load_balancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + "loadbalancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", "members": [ { "address": "192.168.1.101", @@ -158,70 +158,6 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_update(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - logging={ - "destination_region_id": 1, - "enabled": True, - "retention_policy": {"period": 45}, - "topic_name": "my-log-name", - }, - name="some_name", - preferred_connectivity="L2", - tags={"foo": "my-tag-value"}, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.load_balancers.with_raw_response.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.load_balancers.with_streaming_response.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - client.cloud.load_balancers.with_raw_response.update( - load_balancer_id="", - project_id=0, - region_id=0, - ) - @parametrize def test_method_list(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.list( @@ -274,215 +210,6 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_delete(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.load_balancers.with_raw_response.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.load_balancers.with_streaming_response.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - client.cloud.load_balancers.with_raw_response.delete( - load_balancer_id="", - project_id=0, - region_id=0, - ) - - @parametrize - def test_method_failover(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_method_failover_with_all_params(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - force=True, - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_raw_response_failover(self, client: Gcore) -> None: - response = client.cloud.load_balancers.with_raw_response.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_streaming_response_failover(self, client: Gcore) -> None: - with client.cloud.load_balancers.with_streaming_response.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_failover(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - client.cloud.load_balancers.with_raw_response.failover( - load_balancer_id="", - project_id=0, - region_id=0, - ) - - @parametrize - def test_method_get(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - def test_method_get_with_all_params(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - show_stats=True, - with_ddos=True, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.load_balancers.with_raw_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.load_balancers.with_streaming_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - client.cloud.load_balancers.with_raw_response.get( - load_balancer_id="", - project_id=0, - region_id=0, - ) - - @parametrize - def test_method_resize(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_raw_response_resize(self, client: Gcore) -> None: - response = client.cloud.load_balancers.with_raw_response.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - def test_streaming_response_resize(self, client: Gcore) -> None: - with client.cloud.load_balancers.with_streaming_response.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_resize(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - client.cloud.load_balancers.with_raw_response.resize( - load_balancer_id="", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) - class TestAsyncLoadBalancers: parametrize = pytest.mark.parametrize( @@ -533,7 +260,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "url_path": "/", }, "listener_id": "listener_id", - "load_balancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + "loadbalancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", "members": [ { "address": "192.168.1.101", @@ -626,70 +353,6 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True - @parametrize - async def test_method_update(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - logging={ - "destination_region_id": 1, - "enabled": True, - "retention_policy": {"period": 45}, - "topic_name": "my-log-name", - }, - name="some_name", - preferred_connectivity="L2", - tags={"foo": "my-tag-value"}, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.with_raw_response.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = await response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.with_streaming_response.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = await response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - await async_client.cloud.load_balancers.with_raw_response.update( - load_balancer_id="", - project_id=0, - region_id=0, - ) - @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.list( @@ -741,212 +404,3 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(AsyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.with_raw_response.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = await response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.with_streaming_response.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = await response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - await async_client.cloud.load_balancers.with_raw_response.delete( - load_balancer_id="", - project_id=0, - region_id=0, - ) - - @parametrize - async def test_method_failover(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_method_failover_with_all_params(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - force=True, - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_raw_response_failover(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.with_raw_response.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = await response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_streaming_response_failover(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.with_streaming_response.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = await response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_failover(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - await async_client.cloud.load_balancers.with_raw_response.failover( - load_balancer_id="", - project_id=0, - region_id=0, - ) - - @parametrize - async def test_method_get(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - show_stats=True, - with_ddos=True, - ) - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.with_raw_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = await response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.with_streaming_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = await response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - await async_client.cloud.load_balancers.with_raw_response.get( - load_balancer_id="", - project_id=0, - region_id=0, - ) - - @parametrize - async def test_method_resize(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.with_raw_response.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = await response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - @parametrize - async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.with_streaming_response.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - load_balancer = await response.parse() - assert_matches_type(TaskIDList, load_balancer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_resize(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - await async_client.cloud.load_balancers.with_raw_response.resize( - load_balancer_id="", - project_id=0, - region_id=0, - flavor="lb1-2-4", - ) From 912cec24d70a1cd8705f6ba30b30bc2183cf1d55 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 16 Oct 2025 07:46:30 +0000 Subject: [PATCH 375/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 4c39159a..c903b0a9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 605 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9f065df469027bcaa0bd19a36a0f8f132271e837c4cb058f27f3c5c740298797.yml openapi_spec_hash: 844a27c7d8957769e1fb98965f9f1df0 -config_hash: 16325d713dde8c8d722ff7890df2a16a +config_hash: 4424995cf809ff9b2c7ef6f4b5fbdcf8 From 757867afc71b88eebdccf8a6c4b0af6c900e786f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 16 Oct 2025 08:13:24 +0000 Subject: [PATCH 376/592] feat(api): aggregated API specs update --- .stats.yml | 6 +- api.md | 12 + .../cloud/load_balancers/__init__.py | 14 + .../cloud/load_balancers/listeners.py | 24 +- .../cloud/load_balancers/load_balancers.py | 629 +++++++++++++++++- .../resources/cloud/load_balancers/metrics.py | 205 ++++++ .../cloud/load_balancers/pools/pools.py | 24 +- .../cloud/load_balancers/statuses.py | 91 +++ src/gcore/types/cloud/__init__.py | 6 + .../cloud/load_balancer_create_params.py | 2 +- .../cloud/load_balancer_failover_params.py | 16 + .../types/cloud/load_balancer_get_params.py | 19 + .../cloud/load_balancer_listener_detail.py | 2 +- .../types/cloud/load_balancer_metrics.py | 32 + .../types/cloud/load_balancer_metrics_list.py | 16 + .../cloud/load_balancer_resize_params.py | 16 + .../cloud/load_balancer_update_params.py | 69 ++ .../types/cloud/load_balancers/__init__.py | 1 + .../load_balancers/listener_create_params.py | 2 +- .../load_balancers/listener_list_params.py | 2 +- .../load_balancers/metric_list_params.py | 21 + .../load_balancers/pool_create_params.py | 2 +- .../cloud/load_balancers/pool_list_params.py | 2 +- .../cloud/load_balancers/test_listeners.py | 20 +- .../cloud/load_balancers/test_metrics.py | 132 ++++ .../cloud/load_balancers/test_pools.py | 8 +- .../cloud/load_balancers/test_statuses.py | 94 ++- .../cloud/test_load_balancers.py | 550 ++++++++++++++- 28 files changed, 1966 insertions(+), 51 deletions(-) create mode 100644 src/gcore/resources/cloud/load_balancers/metrics.py create mode 100644 src/gcore/types/cloud/load_balancer_failover_params.py create mode 100644 src/gcore/types/cloud/load_balancer_get_params.py create mode 100644 src/gcore/types/cloud/load_balancer_metrics.py create mode 100644 src/gcore/types/cloud/load_balancer_metrics_list.py create mode 100644 src/gcore/types/cloud/load_balancer_resize_params.py create mode 100644 src/gcore/types/cloud/load_balancer_update_params.py create mode 100644 src/gcore/types/cloud/load_balancers/metric_list_params.py create mode 100644 tests/api_resources/cloud/load_balancers/test_metrics.py diff --git a/.stats.yml b/.stats.yml index c903b0a9..7634073e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 605 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9f065df469027bcaa0bd19a36a0f8f132271e837c4cb058f27f3c5c740298797.yml -openapi_spec_hash: 844a27c7d8957769e1fb98965f9f1df0 +configured_endpoints: 612 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-61c8daa30b17f90adc70901ef07fff2a1f9ea09c65153b7c7041dfedecd88288.yml +openapi_spec_hash: 9e0d4a49b58c61a8d53e6b4f3123f225 config_hash: 4424995cf809ff9b2c7ef6f4b5fbdcf8 diff --git a/api.md b/api.md index 815e5839..d2b0533c 100644 --- a/api.md +++ b/api.md @@ -210,7 +210,12 @@ from gcore.types.cloud import ( Methods: - client.cloud.load_balancers.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.update(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer - client.cloud.load_balancers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[LoadBalancer] +- client.cloud.load_balancers.delete(load_balancer_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.load_balancers.failover(load_balancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.get(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer +- client.cloud.load_balancers.resize(load_balancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList ### L7Policies @@ -272,11 +277,18 @@ 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 +### Metrics + +Methods: + +- client.cloud.load_balancers.metrics.list(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancerMetricsList + ### Statuses Methods: - client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> LoadBalancerStatusList +- client.cloud.load_balancers.statuses.get(load_balancer_id, \*, project_id, region_id) -> LoadBalancerStatus ## ReservedFixedIPs diff --git a/src/gcore/resources/cloud/load_balancers/__init__.py b/src/gcore/resources/cloud/load_balancers/__init__.py index cdd5187e..4de45722 100644 --- a/src/gcore/resources/cloud/load_balancers/__init__.py +++ b/src/gcore/resources/cloud/load_balancers/__init__.py @@ -16,6 +16,14 @@ FlavorsResourceWithStreamingResponse, AsyncFlavorsResourceWithStreamingResponse, ) +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) from .statuses import ( StatusesResource, AsyncStatusesResource, @@ -74,6 +82,12 @@ "AsyncPoolsResourceWithRawResponse", "PoolsResourceWithStreamingResponse", "AsyncPoolsResourceWithStreamingResponse", + "MetricsResource", + "AsyncMetricsResource", + "MetricsResourceWithRawResponse", + "AsyncMetricsResourceWithRawResponse", + "MetricsResourceWithStreamingResponse", + "AsyncMetricsResourceWithStreamingResponse", "StatusesResource", "AsyncStatusesResource", "StatusesResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 8959a6b4..272880d8 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -57,7 +57,7 @@ def create( *, project_id: int | None = None, region_id: int | None = None, - loadbalancer_id: str, + load_balancer_id: str, name: str, protocol: LbListenerProtocol, protocol_port: int, @@ -85,7 +85,7 @@ def create( region_id: Region ID - loadbalancer_id: Load balancer ID + load_balancer_id: Load balancer ID name: Load balancer listener name @@ -130,7 +130,7 @@ def create( f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=maybe_transform( { - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, "name": name, "protocol": protocol, "protocol_port": protocol_port, @@ -245,7 +245,7 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - loadbalancer_id: str | Omit = omit, + load_balancer_id: str | Omit = omit, show_stats: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -262,7 +262,7 @@ def list( region_id: Region ID - loadbalancer_id: Load Balancer ID + load_balancer_id: Load Balancer ID show_stats: Show stats @@ -287,7 +287,7 @@ def list( timeout=timeout, query=maybe_transform( { - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, "show_stats": show_stats, }, listener_list_params.ListenerListParams, @@ -419,7 +419,7 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, - loadbalancer_id: str, + load_balancer_id: str, name: str, protocol: LbListenerProtocol, protocol_port: int, @@ -447,7 +447,7 @@ async def create( region_id: Region ID - loadbalancer_id: Load balancer ID + load_balancer_id: Load balancer ID name: Load balancer listener name @@ -492,7 +492,7 @@ async def create( f"/cloud/v1/lblisteners/{project_id}/{region_id}", body=await async_maybe_transform( { - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, "name": name, "protocol": protocol, "protocol_port": protocol_port, @@ -607,7 +607,7 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - loadbalancer_id: str | Omit = omit, + load_balancer_id: str | Omit = omit, show_stats: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -624,7 +624,7 @@ async def list( region_id: Region ID - loadbalancer_id: Load Balancer ID + load_balancer_id: Load Balancer ID show_stats: Show stats @@ -649,7 +649,7 @@ async def list( timeout=timeout, query=await async_maybe_transform( { - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, "show_stats": show_stats, }, listener_list_params.ListenerListParams, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 1609b8b7..12138750 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable +from typing import Dict, Iterable, Optional import httpx @@ -14,6 +14,14 @@ FlavorsResourceWithStreamingResponse, AsyncFlavorsResourceWithStreamingResponse, ) +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) from .statuses import ( StatusesResource, AsyncStatusesResource, @@ -52,8 +60,12 @@ from ....types.cloud import ( InterfaceIPFamily, LoadBalancerMemberConnectivity, + load_balancer_get_params, load_balancer_list_params, load_balancer_create_params, + load_balancer_resize_params, + load_balancer_update_params, + load_balancer_failover_params, ) from ...._base_client import AsyncPaginator, make_request_options from .l7_policies.l7_policies import ( @@ -67,6 +79,7 @@ from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.load_balancer import LoadBalancer from ....types.cloud.interface_ip_family import InterfaceIPFamily +from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.load_balancer_member_connectivity import LoadBalancerMemberConnectivity __all__ = ["LoadBalancersResource", "AsyncLoadBalancersResource"] @@ -89,6 +102,10 @@ def listeners(self) -> ListenersResource: def pools(self) -> PoolsResource: return PoolsResource(self._client) + @cached_property + def metrics(self) -> MetricsResource: + return MetricsResource(self._client) + @cached_property def statuses(self) -> StatusesResource: return StatusesResource(self._client) @@ -214,6 +231,90 @@ def create( cast_to=TaskIDList, ) + def update( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + logging: load_balancer_update_params.Logging | Omit = omit, + name: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancer: + """ + Rename load balancer, activate/deactivate logging, update preferred connectivity + type and/or modify load balancer tags. The request will only process the fields + that are provided in the request body. Any fields that are not included will + remain unchanged. + + Args: + logging: Logging configuration + + name: Name. + + preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools + members + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._patch( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", + body=maybe_transform( + { + "logging": logging, + "name": name, + "preferred_connectivity": preferred_connectivity, + "tags": tags, + }, + load_balancer_update_params.LoadBalancerUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancer, + ) + def list( self, *, @@ -302,6 +403,186 @@ def list( model=LoadBalancer, ) + def delete( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete load balancer + + 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 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 load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._delete( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def failover( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + force: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Failover load balancer + + Args: + force: Validate current load balancer status before failover or not. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/failover", + body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + show_stats: bool | Omit = omit, + with_ddos: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancer: + """ + Get load balancer + + Args: + show_stats: Show statistics + + with_ddos: Show DDoS profile + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "show_stats": show_stats, + "with_ddos": with_ddos, + }, + load_balancer_get_params.LoadBalancerGetParams, + ), + ), + cast_to=LoadBalancer, + ) + + def resize( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Resize load balancer + + Args: + flavor: Name of the desired flavor to resize to. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/resize", + body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + class AsyncLoadBalancersResource(AsyncAPIResource): @cached_property @@ -320,6 +601,10 @@ def listeners(self) -> AsyncListenersResource: def pools(self) -> AsyncPoolsResource: return AsyncPoolsResource(self._client) + @cached_property + def metrics(self) -> AsyncMetricsResource: + return AsyncMetricsResource(self._client) + @cached_property def statuses(self) -> AsyncStatusesResource: return AsyncStatusesResource(self._client) @@ -445,6 +730,90 @@ async def create( cast_to=TaskIDList, ) + async def update( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + logging: load_balancer_update_params.Logging | Omit = omit, + name: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancer: + """ + Rename load balancer, activate/deactivate logging, update preferred connectivity + type and/or modify load balancer tags. The request will only process the fields + that are provided in the request body. Any fields that are not included will + remain unchanged. + + Args: + logging: Logging configuration + + name: Name. + + preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools + members + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._patch( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", + body=await async_maybe_transform( + { + "logging": logging, + "name": name, + "preferred_connectivity": preferred_connectivity, + "tags": tags, + }, + load_balancer_update_params.LoadBalancerUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancer, + ) + def list( self, *, @@ -533,6 +902,188 @@ def list( model=LoadBalancer, ) + async def delete( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete load balancer + + 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 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 load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._delete( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def failover( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + force: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Failover load balancer + + Args: + force: Validate current load balancer status before failover or not. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/failover", + body=await async_maybe_transform( + {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + show_stats: bool | Omit = omit, + with_ddos: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancer: + """ + Get load balancer + + Args: + show_stats: Show statistics + + with_ddos: Show DDoS profile + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "show_stats": show_stats, + "with_ddos": with_ddos, + }, + load_balancer_get_params.LoadBalancerGetParams, + ), + ), + cast_to=LoadBalancer, + ) + + async def resize( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Resize load balancer + + Args: + flavor: Name of the desired flavor to resize to. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/resize", + body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + class LoadBalancersResourceWithRawResponse: def __init__(self, load_balancers: LoadBalancersResource) -> None: @@ -541,9 +1092,24 @@ def __init__(self, load_balancers: LoadBalancersResource) -> None: self.create = to_raw_response_wrapper( load_balancers.create, ) + self.update = to_raw_response_wrapper( + load_balancers.update, + ) self.list = to_raw_response_wrapper( load_balancers.list, ) + self.delete = to_raw_response_wrapper( + load_balancers.delete, + ) + self.failover = to_raw_response_wrapper( + load_balancers.failover, + ) + self.get = to_raw_response_wrapper( + load_balancers.get, + ) + self.resize = to_raw_response_wrapper( + load_balancers.resize, + ) @cached_property def l7_policies(self) -> L7PoliciesResourceWithRawResponse: @@ -561,6 +1127,10 @@ def listeners(self) -> ListenersResourceWithRawResponse: def pools(self) -> PoolsResourceWithRawResponse: return PoolsResourceWithRawResponse(self._load_balancers.pools) + @cached_property + def metrics(self) -> MetricsResourceWithRawResponse: + return MetricsResourceWithRawResponse(self._load_balancers.metrics) + @cached_property def statuses(self) -> StatusesResourceWithRawResponse: return StatusesResourceWithRawResponse(self._load_balancers.statuses) @@ -573,9 +1143,24 @@ def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: self.create = async_to_raw_response_wrapper( load_balancers.create, ) + self.update = async_to_raw_response_wrapper( + load_balancers.update, + ) self.list = async_to_raw_response_wrapper( load_balancers.list, ) + self.delete = async_to_raw_response_wrapper( + load_balancers.delete, + ) + self.failover = async_to_raw_response_wrapper( + load_balancers.failover, + ) + self.get = async_to_raw_response_wrapper( + load_balancers.get, + ) + self.resize = async_to_raw_response_wrapper( + load_balancers.resize, + ) @cached_property def l7_policies(self) -> AsyncL7PoliciesResourceWithRawResponse: @@ -593,6 +1178,10 @@ def listeners(self) -> AsyncListenersResourceWithRawResponse: def pools(self) -> AsyncPoolsResourceWithRawResponse: return AsyncPoolsResourceWithRawResponse(self._load_balancers.pools) + @cached_property + def metrics(self) -> AsyncMetricsResourceWithRawResponse: + return AsyncMetricsResourceWithRawResponse(self._load_balancers.metrics) + @cached_property def statuses(self) -> AsyncStatusesResourceWithRawResponse: return AsyncStatusesResourceWithRawResponse(self._load_balancers.statuses) @@ -605,9 +1194,24 @@ def __init__(self, load_balancers: LoadBalancersResource) -> None: self.create = to_streamed_response_wrapper( load_balancers.create, ) + self.update = to_streamed_response_wrapper( + load_balancers.update, + ) self.list = to_streamed_response_wrapper( load_balancers.list, ) + self.delete = to_streamed_response_wrapper( + load_balancers.delete, + ) + self.failover = to_streamed_response_wrapper( + load_balancers.failover, + ) + self.get = to_streamed_response_wrapper( + load_balancers.get, + ) + self.resize = to_streamed_response_wrapper( + load_balancers.resize, + ) @cached_property def l7_policies(self) -> L7PoliciesResourceWithStreamingResponse: @@ -625,6 +1229,10 @@ def listeners(self) -> ListenersResourceWithStreamingResponse: def pools(self) -> PoolsResourceWithStreamingResponse: return PoolsResourceWithStreamingResponse(self._load_balancers.pools) + @cached_property + def metrics(self) -> MetricsResourceWithStreamingResponse: + return MetricsResourceWithStreamingResponse(self._load_balancers.metrics) + @cached_property def statuses(self) -> StatusesResourceWithStreamingResponse: return StatusesResourceWithStreamingResponse(self._load_balancers.statuses) @@ -637,9 +1245,24 @@ def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: self.create = async_to_streamed_response_wrapper( load_balancers.create, ) + self.update = async_to_streamed_response_wrapper( + load_balancers.update, + ) self.list = async_to_streamed_response_wrapper( load_balancers.list, ) + self.delete = async_to_streamed_response_wrapper( + load_balancers.delete, + ) + self.failover = async_to_streamed_response_wrapper( + load_balancers.failover, + ) + self.get = async_to_streamed_response_wrapper( + load_balancers.get, + ) + self.resize = async_to_streamed_response_wrapper( + load_balancers.resize, + ) @cached_property def l7_policies(self) -> AsyncL7PoliciesResourceWithStreamingResponse: @@ -657,6 +1280,10 @@ def listeners(self) -> AsyncListenersResourceWithStreamingResponse: def pools(self) -> AsyncPoolsResourceWithStreamingResponse: return AsyncPoolsResourceWithStreamingResponse(self._load_balancers.pools) + @cached_property + def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: + return AsyncMetricsResourceWithStreamingResponse(self._load_balancers.metrics) + @cached_property def statuses(self) -> AsyncStatusesResourceWithStreamingResponse: return AsyncStatusesResourceWithStreamingResponse(self._load_balancers.statuses) diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py new file mode 100644 index 00000000..e7647609 --- /dev/null +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -0,0 +1,205 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....types.cloud import InstanceMetricsTimeUnit +from ...._base_client import make_request_options +from ....types.cloud.load_balancers import metric_list_params +from ....types.cloud.instance_metrics_time_unit import InstanceMetricsTimeUnit +from ....types.cloud.load_balancer_metrics_list import LoadBalancerMetricsList + +__all__ = ["MetricsResource", "AsyncMetricsResource"] + + +class MetricsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> MetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return MetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return MetricsResourceWithStreamingResponse(self) + + def list( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + time_interval: int, + time_unit: InstanceMetricsTimeUnit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancerMetricsList: + """ + Get load balancer metrics, including cpu, memory and network + + Args: + time_interval: Time interval + + time_unit: Time interval unit + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/metrics", + body=maybe_transform( + { + "time_interval": time_interval, + "time_unit": time_unit, + }, + metric_list_params.MetricListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancerMetricsList, + ) + + +class AsyncMetricsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncMetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncMetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncMetricsResourceWithStreamingResponse(self) + + async def list( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + time_interval: int, + time_unit: InstanceMetricsTimeUnit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancerMetricsList: + """ + Get load balancer metrics, including cpu, memory and network + + Args: + time_interval: Time interval + + time_unit: Time interval unit + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._post( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/metrics", + body=await async_maybe_transform( + { + "time_interval": time_interval, + "time_unit": time_unit, + }, + metric_list_params.MetricListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancerMetricsList, + ) + + +class MetricsResourceWithRawResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_raw_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithRawResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_raw_response_wrapper( + metrics.list, + ) + + +class MetricsResourceWithStreamingResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_streamed_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithStreamingResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_streamed_response_wrapper( + metrics.list, + ) diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 3ee27f95..1b3ddd58 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -84,7 +84,7 @@ def create( crl_secret_id: Optional[str] | Omit = omit, healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, listener_id: Optional[str] | Omit = omit, - loadbalancer_id: Optional[str] | Omit = omit, + load_balancer_id: Optional[str] | Omit = omit, members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, secret_id: Optional[str] | Omit = omit, session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, @@ -120,7 +120,7 @@ def create( listener_id: Listener ID - loadbalancer_id: Loadbalancer ID + load_balancer_id: Loadbalancer ID members: Pool members @@ -157,7 +157,7 @@ def create( "crl_secret_id": crl_secret_id, "healthmonitor": healthmonitor, "listener_id": listener_id, - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, "members": members, "secret_id": secret_id, "session_persistence": session_persistence, @@ -296,7 +296,7 @@ def list( region_id: int | None = None, details: bool | Omit = omit, listener_id: str | Omit = omit, - loadbalancer_id: str | Omit = omit, + load_balancer_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, @@ -316,7 +316,7 @@ def list( listener_id: Listener ID - loadbalancer_id: Load Balancer ID + load_balancer_id: Load Balancer ID extra_headers: Send extra headers @@ -341,7 +341,7 @@ def list( { "details": details, "listener_id": listener_id, - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, }, pool_list_params.PoolListParams, ), @@ -480,7 +480,7 @@ async def create( crl_secret_id: Optional[str] | Omit = omit, healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, listener_id: Optional[str] | Omit = omit, - loadbalancer_id: Optional[str] | Omit = omit, + load_balancer_id: Optional[str] | Omit = omit, members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, secret_id: Optional[str] | Omit = omit, session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, @@ -516,7 +516,7 @@ async def create( listener_id: Listener ID - loadbalancer_id: Loadbalancer ID + load_balancer_id: Loadbalancer ID members: Pool members @@ -553,7 +553,7 @@ async def create( "crl_secret_id": crl_secret_id, "healthmonitor": healthmonitor, "listener_id": listener_id, - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, "members": members, "secret_id": secret_id, "session_persistence": session_persistence, @@ -692,7 +692,7 @@ async def list( region_id: int | None = None, details: bool | Omit = omit, listener_id: str | Omit = omit, - loadbalancer_id: str | Omit = omit, + load_balancer_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, @@ -712,7 +712,7 @@ async def list( listener_id: Listener ID - loadbalancer_id: Load Balancer ID + load_balancer_id: Load Balancer ID extra_headers: Send extra headers @@ -737,7 +737,7 @@ async def list( { "details": details, "listener_id": listener_id, - "loadbalancer_id": loadbalancer_id, + "load_balancer_id": load_balancer_id, }, pool_list_params.PoolListParams, ), diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 7270e2a8..e537b073 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -14,6 +14,7 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options +from ....types.cloud.load_balancer_status import LoadBalancerStatus from ....types.cloud.load_balancer_status_list import LoadBalancerStatusList __all__ = ["StatusesResource", "AsyncStatusesResource"] @@ -75,6 +76,45 @@ def list( cast_to=LoadBalancerStatusList, ) + def get( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancerStatus: + """ + Get load balancer status + + 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 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 load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancerStatus, + ) + class AsyncStatusesResource(AsyncAPIResource): @cached_property @@ -132,6 +172,45 @@ async def list( cast_to=LoadBalancerStatusList, ) + async def get( + self, + load_balancer_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LoadBalancerStatus: + """ + Get load balancer status + + 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 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 load_balancer_id: + raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}") + return await self._get( + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/status", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LoadBalancerStatus, + ) + class StatusesResourceWithRawResponse: def __init__(self, statuses: StatusesResource) -> None: @@ -140,6 +219,9 @@ def __init__(self, statuses: StatusesResource) -> None: self.list = to_raw_response_wrapper( statuses.list, ) + self.get = to_raw_response_wrapper( + statuses.get, + ) class AsyncStatusesResourceWithRawResponse: @@ -149,6 +231,9 @@ def __init__(self, statuses: AsyncStatusesResource) -> None: self.list = async_to_raw_response_wrapper( statuses.list, ) + self.get = async_to_raw_response_wrapper( + statuses.get, + ) class StatusesResourceWithStreamingResponse: @@ -158,6 +243,9 @@ def __init__(self, statuses: StatusesResource) -> None: self.list = to_streamed_response_wrapper( statuses.list, ) + self.get = to_streamed_response_wrapper( + statuses.get, + ) class AsyncStatusesResourceWithStreamingResponse: @@ -167,3 +255,6 @@ def __init__(self, statuses: AsyncStatusesResource) -> None: self.list = async_to_streamed_response_wrapper( statuses.list, ) + self.get = async_to_streamed_response_wrapper( + statuses.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index e7f5de17..96c25d07 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -90,6 +90,7 @@ from .gpu_baremetal_cluster import GPUBaremetalCluster as GPUBaremetalCluster from .health_monitor_status import HealthMonitorStatus as HealthMonitorStatus from .load_balancer_l7_rule import LoadBalancerL7Rule as LoadBalancerL7Rule +from .load_balancer_metrics import LoadBalancerMetrics as LoadBalancerMetrics from .network_create_params import NetworkCreateParams as NetworkCreateParams from .network_update_params import NetworkUpdateParams as NetworkUpdateParams from .project_create_params import ProjectCreateParams as ProjectCreateParams @@ -117,6 +118,7 @@ from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams from .file_share_update_params import FileShareUpdateParams as FileShareUpdateParams from .k8s_cluster_version_list import K8sClusterVersionList as K8sClusterVersionList +from .load_balancer_get_params import LoadBalancerGetParams as LoadBalancerGetParams from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams @@ -129,6 +131,7 @@ from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit from .load_balancer_l7_rule_list import LoadBalancerL7RuleList as LoadBalancerL7RuleList +from .load_balancer_metrics_list import LoadBalancerMetricsList as LoadBalancerMetricsList from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField @@ -140,11 +143,14 @@ from .load_balancer_flavor_detail import LoadBalancerFlavorDetail as LoadBalancerFlavorDetail from .load_balancer_instance_role import LoadBalancerInstanceRole as LoadBalancerInstanceRole from .load_balancer_listener_list import LoadBalancerListenerList as LoadBalancerListenerList +from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams +from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams from .load_balancer_l7_policy_list import LoadBalancerL7PolicyList as LoadBalancerL7PolicyList from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams +from .load_balancer_failover_params import LoadBalancerFailoverParams as LoadBalancerFailoverParams from .load_balancer_listener_detail import LoadBalancerListenerDetail as LoadBalancerListenerDetail from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 7a4c3051..a41fd6e4 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -274,7 +274,7 @@ class ListenerPool(TypedDict, total=False): listener_id: Optional[str] """Listener ID""" - loadbalancer_id: Optional[str] + load_balancer_id: Optional[str] """Loadbalancer ID""" members: Optional[Iterable[ListenerPoolMember]] diff --git a/src/gcore/types/cloud/load_balancer_failover_params.py b/src/gcore/types/cloud/load_balancer_failover_params.py new file mode 100644 index 00000000..b4a727a7 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_failover_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["LoadBalancerFailoverParams"] + + +class LoadBalancerFailoverParams(TypedDict, total=False): + project_id: int + + region_id: int + + force: bool + """Validate current load balancer status before failover or not.""" diff --git a/src/gcore/types/cloud/load_balancer_get_params.py b/src/gcore/types/cloud/load_balancer_get_params.py new file mode 100644 index 00000000..233a6f3e --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_get_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_extensions import TypedDict + +__all__ = ["LoadBalancerGetParams"] + + +class LoadBalancerGetParams(TypedDict, total=False): + project_id: int + + region_id: int + + show_stats: bool + """Show statistics""" + + with_ddos: bool + """Show DDoS profile""" diff --git a/src/gcore/types/cloud/load_balancer_listener_detail.py b/src/gcore/types/cloud/load_balancer_listener_detail.py index 41d9a4c6..e230a736 100644 --- a/src/gcore/types/cloud/load_balancer_listener_detail.py +++ b/src/gcore/types/cloud/load_balancer_listener_detail.py @@ -38,7 +38,7 @@ class LoadBalancerListenerDetail(BaseModel): Only used with HTTP and `TERMINATED_HTTPS` protocols. """ - loadbalancer_id: Optional[str] = None + load_balancer_id: Optional[str] = None """Load balancer ID""" name: str diff --git a/src/gcore/types/cloud/load_balancer_metrics.py b/src/gcore/types/cloud/load_balancer_metrics.py new file mode 100644 index 00000000..ffdf6859 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_metrics.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["LoadBalancerMetrics"] + + +class LoadBalancerMetrics(BaseModel): + cpu_util: Optional[float] = None + """CPU utilization, % (max 100% for multi-core)""" + + memory_util: Optional[float] = None + """RAM utilization, %""" + + network_bps_egress: Optional[float] = FieldInfo(alias="network_Bps_egress", default=None) + """Network out, bytes per second""" + + network_bps_ingress: Optional[float] = FieldInfo(alias="network_Bps_ingress", default=None) + """Network in, bytes per second""" + + network_pps_egress: Optional[float] = None + """Network out, packets per second""" + + network_pps_ingress: Optional[float] = None + """Network in, packets per second""" + + time: Optional[str] = None + """Timestamp""" diff --git a/src/gcore/types/cloud/load_balancer_metrics_list.py b/src/gcore/types/cloud/load_balancer_metrics_list.py new file mode 100644 index 00000000..c270faf1 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_metrics_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .load_balancer_metrics import LoadBalancerMetrics + +__all__ = ["LoadBalancerMetricsList"] + + +class LoadBalancerMetricsList(BaseModel): + count: int + """Number of objects""" + + results: List[LoadBalancerMetrics] + """Objects""" diff --git a/src/gcore/types/cloud/load_balancer_resize_params.py b/src/gcore/types/cloud/load_balancer_resize_params.py new file mode 100644 index 00000000..05055dfe --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_resize_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LoadBalancerResizeParams"] + + +class LoadBalancerResizeParams(TypedDict, total=False): + project_id: int + + region_id: int + + flavor: Required[str] + """Name of the desired flavor to resize to.""" diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py new file mode 100644 index 00000000..0870d49c --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -0,0 +1,69 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +from .tag_update_map_param import TagUpdateMapParam +from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam +from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity + +__all__ = ["LoadBalancerUpdateParams", "Logging"] + + +class LoadBalancerUpdateParams(TypedDict, total=False): + project_id: int + + region_id: int + + logging: Logging + """Logging configuration""" + + name: str + """Name.""" + + preferred_connectivity: LoadBalancerMemberConnectivity + """ + Preferred option to establish connectivity between load balancer and its pools + members + """ + + tags: Optional[TagUpdateMapParam] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ + + +class Logging(TypedDict, total=False): + destination_region_id: Optional[int] + """Destination region id to which the logs will be written""" + + enabled: bool + """Enable/disable forwarding logs to LaaS""" + + retention_policy: Optional[LaasIndexRetentionPolicyParam] + """The logs retention policy""" + + topic_name: Optional[str] + """The topic name to which the logs will be written""" diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index c25ce985..433f966c 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -4,6 +4,7 @@ from .pool_list_params import PoolListParams as PoolListParams from .flavor_list_params import FlavorListParams as FlavorListParams +from .metric_list_params import MetricListParams as MetricListParams from .pool_create_params import PoolCreateParams as PoolCreateParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .listener_get_params import ListenerGetParams as ListenerGetParams diff --git a/src/gcore/types/cloud/load_balancers/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py index 7f7bf451..c5b6f5e6 100644 --- a/src/gcore/types/cloud/load_balancers/listener_create_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -18,7 +18,7 @@ class ListenerCreateParams(TypedDict, total=False): region_id: int """Region ID""" - loadbalancer_id: Required[str] + load_balancer_id: Required[str] """Load balancer ID""" name: Required[str] diff --git a/src/gcore/types/cloud/load_balancers/listener_list_params.py b/src/gcore/types/cloud/load_balancers/listener_list_params.py index 783d8482..c3e9925f 100644 --- a/src/gcore/types/cloud/load_balancers/listener_list_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_list_params.py @@ -14,7 +14,7 @@ class ListenerListParams(TypedDict, total=False): region_id: int """Region ID""" - loadbalancer_id: str + load_balancer_id: str """Load Balancer ID""" show_stats: bool diff --git a/src/gcore/types/cloud/load_balancers/metric_list_params.py b/src/gcore/types/cloud/load_balancers/metric_list_params.py new file mode 100644 index 00000000..4af5e414 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/metric_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 Required, TypedDict + +from ..instance_metrics_time_unit import InstanceMetricsTimeUnit + +__all__ = ["MetricListParams"] + + +class MetricListParams(TypedDict, total=False): + project_id: int + + region_id: int + + time_interval: Required[int] + """Time interval""" + + time_unit: Required[InstanceMetricsTimeUnit] + """Time interval unit""" 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 b19fb813..492e9640 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -42,7 +42,7 @@ class PoolCreateParams(TypedDict, total=False): listener_id: Optional[str] """Listener ID""" - loadbalancer_id: Optional[str] + load_balancer_id: Optional[str] """Loadbalancer ID""" members: Optional[Iterable[Member]] diff --git a/src/gcore/types/cloud/load_balancers/pool_list_params.py b/src/gcore/types/cloud/load_balancers/pool_list_params.py index 16020665..1cddb97b 100644 --- a/src/gcore/types/cloud/load_balancers/pool_list_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_list_params.py @@ -20,5 +20,5 @@ class PoolListParams(TypedDict, total=False): listener_id: str """Listener ID""" - loadbalancer_id: str + load_balancer_id: str """Load Balancer ID""" diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index 2605c9f6..b7228ea5 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -22,7 +22,7 @@ def test_method_create(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -60,7 +60,7 @@ def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.load_balancers.listeners.with_raw_response.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -76,7 +76,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.load_balancers.listeners.with_streaming_response.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -171,7 +171,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: listener = client.cloud.load_balancers.listeners.list( project_id=1, region_id=1, - loadbalancer_id="00000000-0000-4000-8000-000000000000", + load_balancer_id="00000000-0000-4000-8000-000000000000", show_stats=True, ) assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) @@ -315,7 +315,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: listener = await async_client.cloud.load_balancers.listeners.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -327,7 +327,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> listener = await async_client.cloud.load_balancers.listeners.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -353,7 +353,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.listeners.with_raw_response.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -369,7 +369,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None async with async_client.cloud.load_balancers.listeners.with_streaming_response.create( project_id=1, region_id=1, - loadbalancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", + load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7", name="my_listener", protocol="HTTP", protocol_port=80, @@ -464,7 +464,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No listener = await async_client.cloud.load_balancers.listeners.list( project_id=1, region_id=1, - loadbalancer_id="00000000-0000-4000-8000-000000000000", + load_balancer_id="00000000-0000-4000-8000-000000000000", show_stats=True, ) assert_matches_type(LoadBalancerListenerList, listener, path=["response"]) diff --git a/tests/api_resources/cloud/load_balancers/test_metrics.py b/tests/api_resources/cloud/load_balancers/test_metrics.py new file mode 100644 index 00000000..281f1d68 --- /dev/null +++ b/tests/api_resources/cloud/load_balancers/test_metrics.py @@ -0,0 +1,132 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import LoadBalancerMetricsList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestMetrics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + metric = client.cloud.load_balancers.metrics.list( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.load_balancers.metrics.with_raw_response.list( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = response.parse() + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.load_balancers.metrics.with_streaming_response.list( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = response.parse() + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.metrics.with_raw_response.list( + load_balancer_id="", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + + +class TestAsyncMetrics: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + metric = await async_client.cloud.load_balancers.metrics.list( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.metrics.with_raw_response.list( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = await response.parse() + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.metrics.with_streaming_response.list( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = await response.parse() + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.metrics.with_raw_response.list( + load_balancer_id="", + project_id=0, + region_id=0, + time_interval=6, + time_unit="day", + ) diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py index f926dcc0..0b095c3d 100644 --- a/tests/api_resources/cloud/load_balancers/test_pools.py +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -49,7 +49,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "url_path": "/", }, listener_id="listener_id", - loadbalancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + load_balancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", members=[ { "address": "192.168.1.101", @@ -227,7 +227,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: region_id=1, details=True, listener_id="00000000-0000-4000-8000-000000000000", - loadbalancer_id="00000000-0000-4000-8000-000000000000", + load_balancer_id="00000000-0000-4000-8000-000000000000", ) assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) @@ -387,7 +387,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "url_path": "/", }, listener_id="listener_id", - loadbalancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + load_balancer_id="bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", members=[ { "address": "192.168.1.101", @@ -565,7 +565,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No region_id=1, details=True, listener_id="00000000-0000-4000-8000-000000000000", - loadbalancer_id="00000000-0000-4000-8000-000000000000", + load_balancer_id="00000000-0000-4000-8000-000000000000", ) assert_matches_type(LoadBalancerPoolList, pool, path=["response"]) diff --git a/tests/api_resources/cloud/load_balancers/test_statuses.py b/tests/api_resources/cloud/load_balancers/test_statuses.py index a9583093..da7e88cb 100644 --- a/tests/api_resources/cloud/load_balancers/test_statuses.py +++ b/tests/api_resources/cloud/load_balancers/test_statuses.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerStatusList +from gcore.types.cloud import LoadBalancerStatus, LoadBalancerStatusList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -51,6 +51,52 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_get(self, client: Gcore) -> None: + status = client.cloud.load_balancers.statuses.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.load_balancers.statuses.with_raw_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + status = response.parse() + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.load_balancers.statuses.with_streaming_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + status = response.parse() + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.statuses.with_raw_response.get( + load_balancer_id="", + project_id=0, + region_id=0, + ) + class TestAsyncStatuses: parametrize = pytest.mark.parametrize( @@ -90,3 +136,49 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(LoadBalancerStatusList, status, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + status = await async_client.cloud.load_balancers.statuses.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.statuses.with_raw_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + status = await response.parse() + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.statuses.with_streaming_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + status = await response.parse() + assert_matches_type(LoadBalancerStatus, status, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.statuses.with_raw_response.get( + load_balancer_id="", + project_id=0, + region_id=0, + ) diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index 8bb41cbf..faf824ef 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -65,7 +65,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "url_path": "/", }, "listener_id": "listener_id", - "loadbalancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + "load_balancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", "members": [ { "address": "192.168.1.101", @@ -158,6 +158,70 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_update(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + name="some_name", + preferred_connectivity="L2", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.update( + load_balancer_id="", + project_id=0, + region_id=0, + ) + @parametrize def test_method_list(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.list( @@ -210,6 +274,215 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_delete(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.delete( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.delete( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.delete( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.delete( + load_balancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_failover(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_method_failover_with_all_params(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + force=True, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_failover(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_failover(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_failover(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.failover( + load_balancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_method_get_with_all_params(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + show_stats=True, + with_ddos=True, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.get( + load_balancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_resize(self, client: Gcore) -> None: + load_balancer = client.cloud.load_balancers.resize( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_raw_response_resize(self, client: Gcore) -> None: + response = client.cloud.load_balancers.with_raw_response.resize( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + def test_streaming_response_resize(self, client: Gcore) -> None: + with client.cloud.load_balancers.with_streaming_response.resize( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_resize(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.resize( + load_balancer_id="", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + class TestAsyncLoadBalancers: parametrize = pytest.mark.parametrize( @@ -260,7 +533,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "url_path": "/", }, "listener_id": "listener_id", - "loadbalancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", + "load_balancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", "members": [ { "address": "192.168.1.101", @@ -353,6 +626,70 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + name="some_name", + preferred_connectivity="L2", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.update( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.update( + load_balancer_id="", + project_id=0, + region_id=0, + ) + @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.list( @@ -404,3 +741,212 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(AsyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.delete( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.delete( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.delete( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.delete( + load_balancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_failover(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_method_failover_with_all_params(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + force=True, + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_failover(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_failover(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.failover( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_failover(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.failover( + load_balancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + show_stats=True, + with_ddos=True, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.get( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.get( + load_balancer_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_resize(self, async_client: AsyncGcore) -> None: + load_balancer = await async_client.cloud.load_balancers.resize( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.with_raw_response.resize( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + @parametrize + async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.with_streaming_response.resize( + load_balancer_id="load_balancer_id", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + load_balancer = await response.parse() + assert_matches_type(TaskIDList, load_balancer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_resize(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.resize( + load_balancer_id="", + project_id=0, + region_id=0, + flavor="lb1-2-4", + ) From daa3e0b7a756e2b9deb6370ca1c83f2f4faf4732 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 16 Oct 2025 11:36:10 +0000 Subject: [PATCH 377/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7634073e..a2eb2e5b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-61c8daa30b17f90adc70901ef07fff2a1f9ea09c65153b7c7041dfedecd88288.yml -openapi_spec_hash: 9e0d4a49b58c61a8d53e6b4f3123f225 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e54e8526d5139c8d8a7997847009fe8ec7a790eb4d5b143c7b30ef1db0a8dce0.yml +openapi_spec_hash: 05a6616f8cd320010d34e2a58fee9f05 config_hash: 4424995cf809ff9b2c7ef6f4b5fbdcf8 From 1e615546796460dce796bb87d6433660885e13e0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:11:40 +0000 Subject: [PATCH 378/592] feat(api): aggregated API specs update --- .stats.yml | 6 +- api.md | 15 - src/gcore/resources/cdn/logs/__init__.py | 14 - src/gcore/resources/cdn/logs/logs.py | 32 - src/gcore/resources/cdn/logs/settings.py | 1065 ----------------- src/gcore/resources/cdn/statistics.py | 8 +- src/gcore/types/cdn/logs/__init__.py | 4 - src/gcore/types/cdn/logs/log_settings.py | 172 --- .../types/cdn/logs/setting_create_params.py | 200 ---- .../types/cdn/logs/setting_update_params.py | 200 ---- src/gcore/types/cdn/logs_aggregated_stats.py | 2 +- tests/api_resources/cdn/logs/test_settings.py | 568 --------- 12 files changed, 8 insertions(+), 2278 deletions(-) delete mode 100644 src/gcore/resources/cdn/logs/settings.py delete mode 100644 src/gcore/types/cdn/logs/log_settings.py delete mode 100644 src/gcore/types/cdn/logs/setting_create_params.py delete mode 100644 src/gcore/types/cdn/logs/setting_update_params.py delete mode 100644 tests/api_resources/cdn/logs/test_settings.py diff --git a/.stats.yml b/.stats.yml index a2eb2e5b..db89b62d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 612 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e54e8526d5139c8d8a7997847009fe8ec7a790eb4d5b143c7b30ef1db0a8dce0.yml -openapi_spec_hash: 05a6616f8cd320010d34e2a58fee9f05 +configured_endpoints: 608 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-028d2bc06b6df923be73a9173da89cc0b5f82016051679f7500732da0168431f.yml +openapi_spec_hash: d85526ff52803ee01d44231d0536da87 config_hash: 4424995cf809ff9b2c7ef6f4b5fbdcf8 diff --git a/api.md b/api.md index d2b0533c..ff858a4e 100644 --- a/api.md +++ b/api.md @@ -2251,21 +2251,6 @@ Methods: - client.cdn.logs.list(\*\*params) -> SyncOffsetPageCdnLogs[Data] - client.cdn.logs.download(\*\*params) -> BinaryAPIResponse -### Settings - -Types: - -```python -from gcore.types.cdn.logs import LogSettings -``` - -Methods: - -- client.cdn.logs.settings.create(\*\*params) -> None -- client.cdn.logs.settings.update(\*\*params) -> None -- client.cdn.logs.settings.delete() -> None -- client.cdn.logs.settings.get() -> LogSettings - ## LogsUploader Types: diff --git a/src/gcore/resources/cdn/logs/__init__.py b/src/gcore/resources/cdn/logs/__init__.py index 580717d0..30876fab 100644 --- a/src/gcore/resources/cdn/logs/__init__.py +++ b/src/gcore/resources/cdn/logs/__init__.py @@ -8,22 +8,8 @@ LogsResourceWithStreamingResponse, AsyncLogsResourceWithStreamingResponse, ) -from .settings import ( - SettingsResource, - AsyncSettingsResource, - SettingsResourceWithRawResponse, - AsyncSettingsResourceWithRawResponse, - SettingsResourceWithStreamingResponse, - AsyncSettingsResourceWithStreamingResponse, -) __all__ = [ - "SettingsResource", - "AsyncSettingsResource", - "SettingsResourceWithRawResponse", - "AsyncSettingsResourceWithRawResponse", - "SettingsResourceWithStreamingResponse", - "AsyncSettingsResourceWithStreamingResponse", "LogsResource", "AsyncLogsResource", "LogsResourceWithRawResponse", diff --git a/src/gcore/resources/cdn/logs/logs.py b/src/gcore/resources/cdn/logs/logs.py index 123c80e6..4a03bc86 100644 --- a/src/gcore/resources/cdn/logs/logs.py +++ b/src/gcore/resources/cdn/logs/logs.py @@ -4,14 +4,6 @@ import httpx -from .settings import ( - SettingsResource, - AsyncSettingsResource, - SettingsResourceWithRawResponse, - AsyncSettingsResourceWithRawResponse, - SettingsResourceWithStreamingResponse, - AsyncSettingsResourceWithStreamingResponse, -) from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property @@ -39,10 +31,6 @@ class LogsResource(SyncAPIResource): - @cached_property - def settings(self) -> SettingsResource: - return SettingsResource(self._client) - @cached_property def with_raw_response(self) -> LogsResourceWithRawResponse: """ @@ -694,10 +682,6 @@ def download( class AsyncLogsResource(AsyncAPIResource): - @cached_property - def settings(self) -> AsyncSettingsResource: - return AsyncSettingsResource(self._client) - @cached_property def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: """ @@ -1360,10 +1344,6 @@ def __init__(self, logs: LogsResource) -> None: BinaryAPIResponse, ) - @cached_property - def settings(self) -> SettingsResourceWithRawResponse: - return SettingsResourceWithRawResponse(self._logs.settings) - class AsyncLogsResourceWithRawResponse: def __init__(self, logs: AsyncLogsResource) -> None: @@ -1377,10 +1357,6 @@ def __init__(self, logs: AsyncLogsResource) -> None: AsyncBinaryAPIResponse, ) - @cached_property - def settings(self) -> AsyncSettingsResourceWithRawResponse: - return AsyncSettingsResourceWithRawResponse(self._logs.settings) - class LogsResourceWithStreamingResponse: def __init__(self, logs: LogsResource) -> None: @@ -1394,10 +1370,6 @@ def __init__(self, logs: LogsResource) -> None: StreamedBinaryAPIResponse, ) - @cached_property - def settings(self) -> SettingsResourceWithStreamingResponse: - return SettingsResourceWithStreamingResponse(self._logs.settings) - class AsyncLogsResourceWithStreamingResponse: def __init__(self, logs: AsyncLogsResource) -> None: @@ -1410,7 +1382,3 @@ def __init__(self, logs: AsyncLogsResource) -> None: logs.download, AsyncStreamedBinaryAPIResponse, ) - - @cached_property - def settings(self) -> AsyncSettingsResourceWithStreamingResponse: - return AsyncSettingsResourceWithStreamingResponse(self._logs.settings) diff --git a/src/gcore/resources/cdn/logs/settings.py b/src/gcore/resources/cdn/logs/settings.py deleted file mode 100644 index 94e81d6c..00000000 --- a/src/gcore/resources/cdn/logs/settings.py +++ /dev/null @@ -1,1065 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional - -import httpx - -from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.cdn.logs import setting_create_params, setting_update_params -from ....types.cdn.logs.log_settings import LogSettings - -__all__ = ["SettingsResource", "AsyncSettingsResource"] - - -class SettingsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SettingsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers - """ - return SettingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response - """ - return SettingsResourceWithStreamingResponse(self) - - def create( - self, - *, - all_resources_bucket: str, - all_resources_folder: str, - folders: Iterable[setting_create_params.Folder], - for_all_resources: bool, - ftp_hostname: str, - ftp_login: str, - ftp_password: str, - s3_access_key_id: str, - s3_hostname: str, - s3_secret_key: str, - s3_type: str, - sftp_hostname: str, - sftp_login: str, - sftp_password: str, - storage_type: str, - archive_size_mb: Optional[int] | Omit = omit, - enabled: bool | Omit = omit, - ftp_prepend_folder: str | Omit = omit, - ignore_empty_logs: bool | Omit = omit, - s3_aws_region: int | Omit = omit, - s3_bucket_location: str | Omit = omit, - s3_host_bucket: str | Omit = omit, - sftp_key_passphrase: str | Omit = omit, - sftp_prepend_folder: str | Omit = omit, - sftp_private_key: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Setup raw logs settings - - Args: - all_resources_bucket: Name of the S3 bucket to which logs for all CDN resources are delivered. - - all_resources_folder: - Parameter meaning depends on the value of the "`storage_type`" value: - - - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for - all CDN resources are delivered. - - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for - all CDN resources are delivered. - - folders: List of folders/buckets for receiving CDN resources logs. - - for_all_resources: Defines whether logs of all CDN resources are delivered to one folder/bucket or - to separate ones. - - Possible values: - - - **true** - Logs of all CDN resources are delivered to one folder/bucket. - - **false** - Logs of different CDN resources are delivered to separate - folders/buckets. - - ftp_hostname: FTP storage hostname. - - ftp_login: FTP storage login. - - ftp_password: FTP storage password. - - s3_access_key_id: Access key ID for the S3 account. - - Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 - - s3_hostname: S3 storage hostname. - - It is required if "`s3_type`": other. - - s3_secret_key: Secret access key for the S3 account. - - Secret Access Key is 20-50 alpha-numeric-slash-plus characters like - kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct - - s3_type: Storage type compatible with S3. - - Possible values: - - - **amazon** – AWS S3 storage. - - **other** – Other (not AWS) S3 compatible storage. - - sftp_hostname: SFTP storage hostname. - - sftp_login: SFTP storage login. - - sftp_password: SFTP storage password. - - It should be empty if "`sftp_private_key`" is set. - - storage_type: Storage type. - - Possible values: - - - **ftp** - - **sftp** - - **s3** - - archive_size_mb: The size of a single piece of the archive in MB. In case of **null** value logs - are delivered without slicing. - - enabled: Enables or disables a log forwarding feature. - - Possible values: - - - **true** - log forwarding feature is active. - - **false** - log forwarding feature is deactivated. - - ftp_prepend_folder: Name of the FTP prepend folder for log delivery. - - **Null** is allowed. - - ignore_empty_logs: Enables or disables the forwarding of empty logs. - - Possible values: - - - **true** - Empty logs are not sent. - - **false** - Empty logs are sent. - - s3_aws_region: Amazon AWS region. - - s3_bucket_location: Location of S3 storage. - - Restrictions: - - - Maximum of 255 symbols. - - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores - (.:\\__-). - - s3_host_bucket: S3 bucket hostname. - - Restrictions: - - - Maximum of 255 symbols. - - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. - - Required if "`s3_type`": other. - - sftp_key_passphrase: Passphrase for SFTP private key. - - Restrictions: - - - Should be set if private key encoded with passphrase. - - Should be empty if "`sftp_password`" is set. - - sftp_prepend_folder: Name of the SFTP prepend folder for log delivery. - - **Null** is allowed. - - sftp_private_key: Private key for SFTP authorization. - - Possible values: - - - **RSA** - - **ED25519** - - It should be empty if "`sftp_password`" is set. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._post( - "/cdn/raw_log_settings", - body=maybe_transform( - { - "all_resources_bucket": all_resources_bucket, - "all_resources_folder": all_resources_folder, - "folders": folders, - "for_all_resources": for_all_resources, - "ftp_hostname": ftp_hostname, - "ftp_login": ftp_login, - "ftp_password": ftp_password, - "s3_access_key_id": s3_access_key_id, - "s3_hostname": s3_hostname, - "s3_secret_key": s3_secret_key, - "s3_type": s3_type, - "sftp_hostname": sftp_hostname, - "sftp_login": sftp_login, - "sftp_password": sftp_password, - "storage_type": storage_type, - "archive_size_mb": archive_size_mb, - "enabled": enabled, - "ftp_prepend_folder": ftp_prepend_folder, - "ignore_empty_logs": ignore_empty_logs, - "s3_aws_region": s3_aws_region, - "s3_bucket_location": s3_bucket_location, - "s3_host_bucket": s3_host_bucket, - "sftp_key_passphrase": sftp_key_passphrase, - "sftp_prepend_folder": sftp_prepend_folder, - "sftp_private_key": sftp_private_key, - }, - setting_create_params.SettingCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def update( - self, - *, - all_resources_bucket: str, - all_resources_folder: str, - folders: Iterable[setting_update_params.Folder], - for_all_resources: bool, - ftp_hostname: str, - ftp_login: str, - ftp_password: str, - s3_access_key_id: str, - s3_hostname: str, - s3_secret_key: str, - s3_type: str, - sftp_hostname: str, - sftp_login: str, - sftp_password: str, - storage_type: str, - archive_size_mb: Optional[int] | Omit = omit, - enabled: bool | Omit = omit, - ftp_prepend_folder: str | Omit = omit, - ignore_empty_logs: bool | Omit = omit, - s3_aws_region: int | Omit = omit, - s3_bucket_location: str | Omit = omit, - s3_host_bucket: str | Omit = omit, - sftp_key_passphrase: str | Omit = omit, - sftp_prepend_folder: str | Omit = omit, - sftp_private_key: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - PATCH method is not allowed. - - Args: - all_resources_bucket: Name of the S3 bucket to which logs for all CDN resources are delivered. - - all_resources_folder: - Parameter meaning depends on the value of the "`storage_type`" value: - - - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for - all CDN resources are delivered. - - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for - all CDN resources are delivered. - - folders: List of folders/buckets for receiving CDN resources logs. - - for_all_resources: Defines whether logs of all CDN resources are delivered to one folder/bucket or - to separate ones. - - Possible values: - - - **true** - Logs of all CDN resources are delivered to one folder/bucket. - - **false** - Logs of different CDN resources are delivered to separate - folders/buckets. - - ftp_hostname: FTP storage hostname. - - ftp_login: FTP storage login. - - ftp_password: FTP storage password. - - s3_access_key_id: Access key ID for the S3 account. - - Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 - - s3_hostname: S3 storage hostname. - - It is required if "`s3_type`": other. - - s3_secret_key: Secret access key for the S3 account. - - Secret Access Key is 20-50 alpha-numeric-slash-plus characters like - kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct - - s3_type: Storage type compatible with S3. - - Possible values: - - - **amazon** – AWS S3 storage. - - **other** – Other (not AWS) S3 compatible storage. - - sftp_hostname: SFTP storage hostname. - - sftp_login: SFTP storage login. - - sftp_password: SFTP storage password. - - It should be empty if "`sftp_private_key`" is set. - - storage_type: Storage type. - - Possible values: - - - **ftp** - - **sftp** - - **s3** - - archive_size_mb: The size of a single piece of the archive in MB. In case of **null** value logs - are delivered without slicing. - - enabled: Enables or disables a log forwarding feature. - - Possible values: - - - **true** - log forwarding feature is active. - - **false** - log forwarding feature is deactivated. - - ftp_prepend_folder: Name of the FTP prepend folder for log delivery. - - **Null** is allowed. - - ignore_empty_logs: Enables or disables the forwarding of empty logs. - - Possible values: - - - **true** - Empty logs are not sent. - - **false** - Empty logs are sent. - - s3_aws_region: Amazon AWS region. - - s3_bucket_location: Location of S3 storage. - - Restrictions: - - - Maximum of 255 symbols. - - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores - (.:\\__-). - - s3_host_bucket: S3 bucket hostname. - - Restrictions: - - - Maximum of 255 symbols. - - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. - - Required if "`s3_type`": other. - - sftp_key_passphrase: Passphrase for SFTP private key. - - Restrictions: - - - Should be set if private key encoded with passphrase. - - Should be empty if "`sftp_password`" is set. - - sftp_prepend_folder: Name of the SFTP prepend folder for log delivery. - - **Null** is allowed. - - sftp_private_key: Private key for SFTP authorization. - - Possible values: - - - **RSA** - - **ED25519** - - It should be empty if "`sftp_password`" is set. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._put( - "/cdn/raw_log_settings", - body=maybe_transform( - { - "all_resources_bucket": all_resources_bucket, - "all_resources_folder": all_resources_folder, - "folders": folders, - "for_all_resources": for_all_resources, - "ftp_hostname": ftp_hostname, - "ftp_login": ftp_login, - "ftp_password": ftp_password, - "s3_access_key_id": s3_access_key_id, - "s3_hostname": s3_hostname, - "s3_secret_key": s3_secret_key, - "s3_type": s3_type, - "sftp_hostname": sftp_hostname, - "sftp_login": sftp_login, - "sftp_password": sftp_password, - "storage_type": storage_type, - "archive_size_mb": archive_size_mb, - "enabled": enabled, - "ftp_prepend_folder": ftp_prepend_folder, - "ignore_empty_logs": ignore_empty_logs, - "s3_aws_region": s3_aws_region, - "s3_bucket_location": s3_bucket_location, - "s3_host_bucket": s3_host_bucket, - "sftp_key_passphrase": sftp_key_passphrase, - "sftp_prepend_folder": sftp_prepend_folder, - "sftp_private_key": sftp_private_key, - }, - setting_update_params.SettingUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def delete( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Delete the raw logs delivery configuration from the system permanently. - - Notes: - - - **Deactivation Requirement**: Set the `enabled` attribute to `false` before - deletion. - - **Irreversibility**: This action is irreversible. Once deleted, the raw logs - delivery configuration cannot be recovered. - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._delete( - "/cdn/raw_log_settings", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def get( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LogSettings: - """Get information about raw logs feature settings.""" - return self._get( - "/cdn/raw_log_settings", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LogSettings, - ) - - -class AsyncSettingsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers - """ - return AsyncSettingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response - """ - return AsyncSettingsResourceWithStreamingResponse(self) - - async def create( - self, - *, - all_resources_bucket: str, - all_resources_folder: str, - folders: Iterable[setting_create_params.Folder], - for_all_resources: bool, - ftp_hostname: str, - ftp_login: str, - ftp_password: str, - s3_access_key_id: str, - s3_hostname: str, - s3_secret_key: str, - s3_type: str, - sftp_hostname: str, - sftp_login: str, - sftp_password: str, - storage_type: str, - archive_size_mb: Optional[int] | Omit = omit, - enabled: bool | Omit = omit, - ftp_prepend_folder: str | Omit = omit, - ignore_empty_logs: bool | Omit = omit, - s3_aws_region: int | Omit = omit, - s3_bucket_location: str | Omit = omit, - s3_host_bucket: str | Omit = omit, - sftp_key_passphrase: str | Omit = omit, - sftp_prepend_folder: str | Omit = omit, - sftp_private_key: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Setup raw logs settings - - Args: - all_resources_bucket: Name of the S3 bucket to which logs for all CDN resources are delivered. - - all_resources_folder: - Parameter meaning depends on the value of the "`storage_type`" value: - - - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for - all CDN resources are delivered. - - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for - all CDN resources are delivered. - - folders: List of folders/buckets for receiving CDN resources logs. - - for_all_resources: Defines whether logs of all CDN resources are delivered to one folder/bucket or - to separate ones. - - Possible values: - - - **true** - Logs of all CDN resources are delivered to one folder/bucket. - - **false** - Logs of different CDN resources are delivered to separate - folders/buckets. - - ftp_hostname: FTP storage hostname. - - ftp_login: FTP storage login. - - ftp_password: FTP storage password. - - s3_access_key_id: Access key ID for the S3 account. - - Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 - - s3_hostname: S3 storage hostname. - - It is required if "`s3_type`": other. - - s3_secret_key: Secret access key for the S3 account. - - Secret Access Key is 20-50 alpha-numeric-slash-plus characters like - kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct - - s3_type: Storage type compatible with S3. - - Possible values: - - - **amazon** – AWS S3 storage. - - **other** – Other (not AWS) S3 compatible storage. - - sftp_hostname: SFTP storage hostname. - - sftp_login: SFTP storage login. - - sftp_password: SFTP storage password. - - It should be empty if "`sftp_private_key`" is set. - - storage_type: Storage type. - - Possible values: - - - **ftp** - - **sftp** - - **s3** - - archive_size_mb: The size of a single piece of the archive in MB. In case of **null** value logs - are delivered without slicing. - - enabled: Enables or disables a log forwarding feature. - - Possible values: - - - **true** - log forwarding feature is active. - - **false** - log forwarding feature is deactivated. - - ftp_prepend_folder: Name of the FTP prepend folder for log delivery. - - **Null** is allowed. - - ignore_empty_logs: Enables or disables the forwarding of empty logs. - - Possible values: - - - **true** - Empty logs are not sent. - - **false** - Empty logs are sent. - - s3_aws_region: Amazon AWS region. - - s3_bucket_location: Location of S3 storage. - - Restrictions: - - - Maximum of 255 symbols. - - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores - (.:\\__-). - - s3_host_bucket: S3 bucket hostname. - - Restrictions: - - - Maximum of 255 symbols. - - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. - - Required if "`s3_type`": other. - - sftp_key_passphrase: Passphrase for SFTP private key. - - Restrictions: - - - Should be set if private key encoded with passphrase. - - Should be empty if "`sftp_password`" is set. - - sftp_prepend_folder: Name of the SFTP prepend folder for log delivery. - - **Null** is allowed. - - sftp_private_key: Private key for SFTP authorization. - - Possible values: - - - **RSA** - - **ED25519** - - It should be empty if "`sftp_password`" is set. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._post( - "/cdn/raw_log_settings", - body=await async_maybe_transform( - { - "all_resources_bucket": all_resources_bucket, - "all_resources_folder": all_resources_folder, - "folders": folders, - "for_all_resources": for_all_resources, - "ftp_hostname": ftp_hostname, - "ftp_login": ftp_login, - "ftp_password": ftp_password, - "s3_access_key_id": s3_access_key_id, - "s3_hostname": s3_hostname, - "s3_secret_key": s3_secret_key, - "s3_type": s3_type, - "sftp_hostname": sftp_hostname, - "sftp_login": sftp_login, - "sftp_password": sftp_password, - "storage_type": storage_type, - "archive_size_mb": archive_size_mb, - "enabled": enabled, - "ftp_prepend_folder": ftp_prepend_folder, - "ignore_empty_logs": ignore_empty_logs, - "s3_aws_region": s3_aws_region, - "s3_bucket_location": s3_bucket_location, - "s3_host_bucket": s3_host_bucket, - "sftp_key_passphrase": sftp_key_passphrase, - "sftp_prepend_folder": sftp_prepend_folder, - "sftp_private_key": sftp_private_key, - }, - setting_create_params.SettingCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def update( - self, - *, - all_resources_bucket: str, - all_resources_folder: str, - folders: Iterable[setting_update_params.Folder], - for_all_resources: bool, - ftp_hostname: str, - ftp_login: str, - ftp_password: str, - s3_access_key_id: str, - s3_hostname: str, - s3_secret_key: str, - s3_type: str, - sftp_hostname: str, - sftp_login: str, - sftp_password: str, - storage_type: str, - archive_size_mb: Optional[int] | Omit = omit, - enabled: bool | Omit = omit, - ftp_prepend_folder: str | Omit = omit, - ignore_empty_logs: bool | Omit = omit, - s3_aws_region: int | Omit = omit, - s3_bucket_location: str | Omit = omit, - s3_host_bucket: str | Omit = omit, - sftp_key_passphrase: str | Omit = omit, - sftp_prepend_folder: str | Omit = omit, - sftp_private_key: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - PATCH method is not allowed. - - Args: - all_resources_bucket: Name of the S3 bucket to which logs for all CDN resources are delivered. - - all_resources_folder: - Parameter meaning depends on the value of the "`storage_type`" value: - - - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for - all CDN resources are delivered. - - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for - all CDN resources are delivered. - - folders: List of folders/buckets for receiving CDN resources logs. - - for_all_resources: Defines whether logs of all CDN resources are delivered to one folder/bucket or - to separate ones. - - Possible values: - - - **true** - Logs of all CDN resources are delivered to one folder/bucket. - - **false** - Logs of different CDN resources are delivered to separate - folders/buckets. - - ftp_hostname: FTP storage hostname. - - ftp_login: FTP storage login. - - ftp_password: FTP storage password. - - s3_access_key_id: Access key ID for the S3 account. - - Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 - - s3_hostname: S3 storage hostname. - - It is required if "`s3_type`": other. - - s3_secret_key: Secret access key for the S3 account. - - Secret Access Key is 20-50 alpha-numeric-slash-plus characters like - kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct - - s3_type: Storage type compatible with S3. - - Possible values: - - - **amazon** – AWS S3 storage. - - **other** – Other (not AWS) S3 compatible storage. - - sftp_hostname: SFTP storage hostname. - - sftp_login: SFTP storage login. - - sftp_password: SFTP storage password. - - It should be empty if "`sftp_private_key`" is set. - - storage_type: Storage type. - - Possible values: - - - **ftp** - - **sftp** - - **s3** - - archive_size_mb: The size of a single piece of the archive in MB. In case of **null** value logs - are delivered without slicing. - - enabled: Enables or disables a log forwarding feature. - - Possible values: - - - **true** - log forwarding feature is active. - - **false** - log forwarding feature is deactivated. - - ftp_prepend_folder: Name of the FTP prepend folder for log delivery. - - **Null** is allowed. - - ignore_empty_logs: Enables or disables the forwarding of empty logs. - - Possible values: - - - **true** - Empty logs are not sent. - - **false** - Empty logs are sent. - - s3_aws_region: Amazon AWS region. - - s3_bucket_location: Location of S3 storage. - - Restrictions: - - - Maximum of 255 symbols. - - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores - (.:\\__-). - - s3_host_bucket: S3 bucket hostname. - - Restrictions: - - - Maximum of 255 symbols. - - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. - - Required if "`s3_type`": other. - - sftp_key_passphrase: Passphrase for SFTP private key. - - Restrictions: - - - Should be set if private key encoded with passphrase. - - Should be empty if "`sftp_password`" is set. - - sftp_prepend_folder: Name of the SFTP prepend folder for log delivery. - - **Null** is allowed. - - sftp_private_key: Private key for SFTP authorization. - - Possible values: - - - **RSA** - - **ED25519** - - It should be empty if "`sftp_password`" is set. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._put( - "/cdn/raw_log_settings", - body=await async_maybe_transform( - { - "all_resources_bucket": all_resources_bucket, - "all_resources_folder": all_resources_folder, - "folders": folders, - "for_all_resources": for_all_resources, - "ftp_hostname": ftp_hostname, - "ftp_login": ftp_login, - "ftp_password": ftp_password, - "s3_access_key_id": s3_access_key_id, - "s3_hostname": s3_hostname, - "s3_secret_key": s3_secret_key, - "s3_type": s3_type, - "sftp_hostname": sftp_hostname, - "sftp_login": sftp_login, - "sftp_password": sftp_password, - "storage_type": storage_type, - "archive_size_mb": archive_size_mb, - "enabled": enabled, - "ftp_prepend_folder": ftp_prepend_folder, - "ignore_empty_logs": ignore_empty_logs, - "s3_aws_region": s3_aws_region, - "s3_bucket_location": s3_bucket_location, - "s3_host_bucket": s3_host_bucket, - "sftp_key_passphrase": sftp_key_passphrase, - "sftp_prepend_folder": sftp_prepend_folder, - "sftp_private_key": sftp_private_key, - }, - setting_update_params.SettingUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def delete( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Delete the raw logs delivery configuration from the system permanently. - - Notes: - - - **Deactivation Requirement**: Set the `enabled` attribute to `false` before - deletion. - - **Irreversibility**: This action is irreversible. Once deleted, the raw logs - delivery configuration cannot be recovered. - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._delete( - "/cdn/raw_log_settings", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def get( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LogSettings: - """Get information about raw logs feature settings.""" - return await self._get( - "/cdn/raw_log_settings", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=LogSettings, - ) - - -class SettingsResourceWithRawResponse: - def __init__(self, settings: SettingsResource) -> None: - self._settings = settings - - self.create = to_raw_response_wrapper( - settings.create, - ) - self.update = to_raw_response_wrapper( - settings.update, - ) - self.delete = to_raw_response_wrapper( - settings.delete, - ) - self.get = to_raw_response_wrapper( - settings.get, - ) - - -class AsyncSettingsResourceWithRawResponse: - def __init__(self, settings: AsyncSettingsResource) -> None: - self._settings = settings - - self.create = async_to_raw_response_wrapper( - settings.create, - ) - self.update = async_to_raw_response_wrapper( - settings.update, - ) - self.delete = async_to_raw_response_wrapper( - settings.delete, - ) - self.get = async_to_raw_response_wrapper( - settings.get, - ) - - -class SettingsResourceWithStreamingResponse: - def __init__(self, settings: SettingsResource) -> None: - self._settings = settings - - self.create = to_streamed_response_wrapper( - settings.create, - ) - self.update = to_streamed_response_wrapper( - settings.update, - ) - self.delete = to_streamed_response_wrapper( - settings.delete, - ) - self.get = to_streamed_response_wrapper( - settings.get, - ) - - -class AsyncSettingsResourceWithStreamingResponse: - def __init__(self, settings: AsyncSettingsResource) -> None: - self._settings = settings - - self.create = async_to_streamed_response_wrapper( - settings.create, - ) - self.update = async_to_streamed_response_wrapper( - settings.update, - ) - self.delete = async_to_streamed_response_wrapper( - settings.delete, - ) - self.get = async_to_streamed_response_wrapper( - settings.get, - ) diff --git a/src/gcore/resources/cdn/statistics.py b/src/gcore/resources/cdn/statistics.py index d07e9b46..14f2fa8c 100644 --- a/src/gcore/resources/cdn/statistics.py +++ b/src/gcore/resources/cdn/statistics.py @@ -68,7 +68,7 @@ def get_logs_usage_aggregated( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LogsAggregatedStats: """ - Get the number of CDN resources that used raw logs. + Get the number of CDN resources that used Logs uploader. Request URL parameters should be added as a query string after the endpoint. @@ -139,7 +139,7 @@ def get_logs_usage_series( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UsageSeriesStats: """ - Get raw logs usage statistics for up to 90 days starting today. + Get Logs uploader usage statistics for up to 90 days starting today. Request URL parameters should be added as a query string after the endpoint. @@ -696,7 +696,7 @@ async def get_logs_usage_aggregated( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LogsAggregatedStats: """ - Get the number of CDN resources that used raw logs. + Get the number of CDN resources that used Logs uploader. Request URL parameters should be added as a query string after the endpoint. @@ -767,7 +767,7 @@ async def get_logs_usage_series( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UsageSeriesStats: """ - Get raw logs usage statistics for up to 90 days starting today. + Get Logs uploader usage statistics for up to 90 days starting today. Request URL parameters should be added as a query string after the endpoint. diff --git a/src/gcore/types/cdn/logs/__init__.py b/src/gcore/types/cdn/logs/__init__.py index 02f4dd5c..f8ee8b14 100644 --- a/src/gcore/types/cdn/logs/__init__.py +++ b/src/gcore/types/cdn/logs/__init__.py @@ -1,7 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .log_settings import LogSettings as LogSettings -from .setting_create_params import SettingCreateParams as SettingCreateParams -from .setting_update_params import SettingUpdateParams as SettingUpdateParams diff --git a/src/gcore/types/cdn/logs/log_settings.py b/src/gcore/types/cdn/logs/log_settings.py deleted file mode 100644 index ab1adcc9..00000000 --- a/src/gcore/types/cdn/logs/log_settings.py +++ /dev/null @@ -1,172 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ...._models import BaseModel - -__all__ = ["LogSettings", "Folder"] - - -class Folder(BaseModel): - id: Optional[int] = None - """Parameter meaning depends on the value of the "`storage_type`" value: - - - **s3** - S3 bucket ID. - - **ftp/sftp** - FTP/SFTP folder ID. - """ - - bucket: Optional[str] = None - """S3 bucket name. - - The field is required if "`storage_type`": **s3**. - """ - - cdn_resource: Optional[int] = None - """CDN resource ID.""" - - folder: Optional[str] = None - """Parameter meaning depends on the value of the "`storage_type`" value: - - - **s3** - S3 bucket sub-folder name (optional.) - - **ftp/sftp** - FTP/SFTP folder name (required.) - """ - - -class LogSettings(BaseModel): - all_resources_bucket: Optional[str] = None - """Name of the S3 bucket to which logs of all CDN resources are delivered. - - Applicable for "`storage_type`": S3. - """ - - all_resources_folder: Optional[str] = None - """Parameter meaning depends on the value of the "`storage_type`" value: - - - **s3** - Name of the S3 bucket sub-folder to which logs for all CDN resources - are delivered. - - **ftp/sftp** - Name of the folder (or path) to which logs for all CDN - resources are delivered. - """ - - archive_size_mb: Optional[int] = None - """ - The size of a single piece of the archive in MB. In case of **null** value logs - are delivered without slicing. - """ - - client: Optional[int] = None - """Client ID.""" - - comment: Optional[str] = None - """System comment on the status of settings, if they are suspended.""" - - enabled: Optional[bool] = None - """Enables or disables a log forwarding feature. - - Possible values: - - - **true** - log forwarding feature is active. - - **false** - log forwarding feature is deactivated. - """ - - folders: Optional[List[Folder]] = None - """List of folders/buckets for receiving CDN resources logs.""" - - for_all_resources: Optional[bool] = None - """ - Defines whether logs of all CDN resources are delivered to one folder/bucket or - to separate ones. - - Possible values: - - - **true** - Logs of all CDN resources are delivered to one folder/bucket. - - **false** - Logs of CDN resources are delivered to separate folders/buckets. - """ - - ftp_hostname: Optional[str] = None - """FTP storage hostname.""" - - ftp_login: Optional[str] = None - """FTP storage login.""" - - ftp_prepend_folder: Optional[str] = None - """Name of prepend FTP folder for log delivery.""" - - ignore_empty_logs: Optional[bool] = None - """Enables or disables the forwarding of empty logs. - - Possible values: - - - **true** - Empty logs are not sent. - - **false** - Empty logs are sent. - """ - - s3_access_key_id: Optional[str] = None - """Access key ID for the S3 account. - - Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 - """ - - s3_aws_region: Optional[str] = None - """Amazon AWS region.""" - - s3_bucket_location: Optional[str] = None - """S3 storage location. - - Restrictions: - - - Maximum 255 symbols. - - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores - (.:\\__-). - """ - - s3_host_bucket: Optional[str] = None - """S3 storage bucket hostname. - - Restrictions: - - - Maximum 255 symbols. - - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. - """ - - s3_hostname: Optional[str] = None - """S3 storage hostname.""" - - s3_type: Optional[str] = None - """Storage type compatible with S3. - - Possible values: - - - **amazon** – AWS S3 storage. - - **other** – Other (not AWS) S3 compatible storage. - """ - - sftp_hostname: Optional[str] = None - """SFTP storage hostname.""" - - sftp_login: Optional[str] = None - """SFTP storage login.""" - - sftp_prepend_folder: Optional[str] = None - """Name of prepend SFTP folder for log delivery.""" - - status: Optional[str] = None - """Log delivery status. - - Possible values: - - - **ok** – All/part of attempts to deliver logs were successful. - - **failed** – All attempts to deliver logs failed. - - **pending** - No logs delivery attempts yet. - - **disabled** - Log delivery is disabled. - """ - - storage_type: Optional[str] = None - """Storage type. - - Possible values: - - - **ftp** - - **sftp** - - **s3** - """ diff --git a/src/gcore/types/cdn/logs/setting_create_params.py b/src/gcore/types/cdn/logs/setting_create_params.py deleted file mode 100644 index 20720e89..00000000 --- a/src/gcore/types/cdn/logs/setting_create_params.py +++ /dev/null @@ -1,200 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Required, TypedDict - -__all__ = ["SettingCreateParams", "Folder"] - - -class SettingCreateParams(TypedDict, total=False): - all_resources_bucket: Required[str] - """Name of the S3 bucket to which logs for all CDN resources are delivered.""" - - all_resources_folder: Required[str] - """Parameter meaning depends on the value of the "`storage_type`" value: - - - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for - all CDN resources are delivered. - - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for - all CDN resources are delivered. - """ - - folders: Required[Iterable[Folder]] - """List of folders/buckets for receiving CDN resources logs.""" - - for_all_resources: Required[bool] - """ - Defines whether logs of all CDN resources are delivered to one folder/bucket or - to separate ones. - - Possible values: - - - **true** - Logs of all CDN resources are delivered to one folder/bucket. - - **false** - Logs of different CDN resources are delivered to separate - folders/buckets. - """ - - ftp_hostname: Required[str] - """FTP storage hostname.""" - - ftp_login: Required[str] - """FTP storage login.""" - - ftp_password: Required[str] - """FTP storage password.""" - - s3_access_key_id: Required[str] - """Access key ID for the S3 account. - - Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 - """ - - s3_hostname: Required[str] - """S3 storage hostname. - - It is required if "`s3_type`": other. - """ - - s3_secret_key: Required[str] - """Secret access key for the S3 account. - - Secret Access Key is 20-50 alpha-numeric-slash-plus characters like - kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct - """ - - s3_type: Required[str] - """Storage type compatible with S3. - - Possible values: - - - **amazon** – AWS S3 storage. - - **other** – Other (not AWS) S3 compatible storage. - """ - - sftp_hostname: Required[str] - """SFTP storage hostname.""" - - sftp_login: Required[str] - """SFTP storage login.""" - - sftp_password: Required[str] - """SFTP storage password. - - It should be empty if "`sftp_private_key`" is set. - """ - - storage_type: Required[str] - """Storage type. - - Possible values: - - - **ftp** - - **sftp** - - **s3** - """ - - archive_size_mb: Optional[int] - """ - The size of a single piece of the archive in MB. In case of **null** value logs - are delivered without slicing. - """ - - enabled: bool - """Enables or disables a log forwarding feature. - - Possible values: - - - **true** - log forwarding feature is active. - - **false** - log forwarding feature is deactivated. - """ - - ftp_prepend_folder: str - """Name of the FTP prepend folder for log delivery. - - **Null** is allowed. - """ - - ignore_empty_logs: bool - """Enables or disables the forwarding of empty logs. - - Possible values: - - - **true** - Empty logs are not sent. - - **false** - Empty logs are sent. - """ - - s3_aws_region: int - """Amazon AWS region.""" - - s3_bucket_location: str - """Location of S3 storage. - - Restrictions: - - - Maximum of 255 symbols. - - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores - (.:\\__-). - """ - - s3_host_bucket: str - """S3 bucket hostname. - - Restrictions: - - - Maximum of 255 symbols. - - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. - - Required if "`s3_type`": other. - """ - - sftp_key_passphrase: str - """Passphrase for SFTP private key. - - Restrictions: - - - Should be set if private key encoded with passphrase. - - Should be empty if "`sftp_password`" is set. - """ - - sftp_prepend_folder: str - """Name of the SFTP prepend folder for log delivery. - - **Null** is allowed. - """ - - sftp_private_key: str - """Private key for SFTP authorization. - - Possible values: - - - **RSA** - - **ED25519** - - It should be empty if "`sftp_password`" is set. - """ - - -class Folder(TypedDict, total=False): - id: int - """Parameter meaning depends on the value of the "`storage_type`" value: - - - **s3** - S3 bucket ID. - - **ftp/sftp** - FTP/SFTP folder ID. - """ - - bucket: str - """S3 bucket name. - - The field is required if "`storage_type`": **s3**. - """ - - cdn_resource: int - """CDN resource ID.""" - - folder: str - """Parameter meaning depends on the value of the "`storage_type`" value: - - - **s3** - S3 bucket sub-folder name (optional.) - - **ftp/sftp** - FTP/SFTP folder name (required.) - """ diff --git a/src/gcore/types/cdn/logs/setting_update_params.py b/src/gcore/types/cdn/logs/setting_update_params.py deleted file mode 100644 index b6736ad2..00000000 --- a/src/gcore/types/cdn/logs/setting_update_params.py +++ /dev/null @@ -1,200 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Required, TypedDict - -__all__ = ["SettingUpdateParams", "Folder"] - - -class SettingUpdateParams(TypedDict, total=False): - all_resources_bucket: Required[str] - """Name of the S3 bucket to which logs for all CDN resources are delivered.""" - - all_resources_folder: Required[str] - """Parameter meaning depends on the value of the "`storage_type`" value: - - - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for - all CDN resources are delivered. - - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for - all CDN resources are delivered. - """ - - folders: Required[Iterable[Folder]] - """List of folders/buckets for receiving CDN resources logs.""" - - for_all_resources: Required[bool] - """ - Defines whether logs of all CDN resources are delivered to one folder/bucket or - to separate ones. - - Possible values: - - - **true** - Logs of all CDN resources are delivered to one folder/bucket. - - **false** - Logs of different CDN resources are delivered to separate - folders/buckets. - """ - - ftp_hostname: Required[str] - """FTP storage hostname.""" - - ftp_login: Required[str] - """FTP storage login.""" - - ftp_password: Required[str] - """FTP storage password.""" - - s3_access_key_id: Required[str] - """Access key ID for the S3 account. - - Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 - """ - - s3_hostname: Required[str] - """S3 storage hostname. - - It is required if "`s3_type`": other. - """ - - s3_secret_key: Required[str] - """Secret access key for the S3 account. - - Secret Access Key is 20-50 alpha-numeric-slash-plus characters like - kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct - """ - - s3_type: Required[str] - """Storage type compatible with S3. - - Possible values: - - - **amazon** – AWS S3 storage. - - **other** – Other (not AWS) S3 compatible storage. - """ - - sftp_hostname: Required[str] - """SFTP storage hostname.""" - - sftp_login: Required[str] - """SFTP storage login.""" - - sftp_password: Required[str] - """SFTP storage password. - - It should be empty if "`sftp_private_key`" is set. - """ - - storage_type: Required[str] - """Storage type. - - Possible values: - - - **ftp** - - **sftp** - - **s3** - """ - - archive_size_mb: Optional[int] - """ - The size of a single piece of the archive in MB. In case of **null** value logs - are delivered without slicing. - """ - - enabled: bool - """Enables or disables a log forwarding feature. - - Possible values: - - - **true** - log forwarding feature is active. - - **false** - log forwarding feature is deactivated. - """ - - ftp_prepend_folder: str - """Name of the FTP prepend folder for log delivery. - - **Null** is allowed. - """ - - ignore_empty_logs: bool - """Enables or disables the forwarding of empty logs. - - Possible values: - - - **true** - Empty logs are not sent. - - **false** - Empty logs are sent. - """ - - s3_aws_region: int - """Amazon AWS region.""" - - s3_bucket_location: str - """Location of S3 storage. - - Restrictions: - - - Maximum of 255 symbols. - - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores - (.:\\__-). - """ - - s3_host_bucket: str - """S3 bucket hostname. - - Restrictions: - - - Maximum of 255 symbols. - - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. - - Required if "`s3_type`": other. - """ - - sftp_key_passphrase: str - """Passphrase for SFTP private key. - - Restrictions: - - - Should be set if private key encoded with passphrase. - - Should be empty if "`sftp_password`" is set. - """ - - sftp_prepend_folder: str - """Name of the SFTP prepend folder for log delivery. - - **Null** is allowed. - """ - - sftp_private_key: str - """Private key for SFTP authorization. - - Possible values: - - - **RSA** - - **ED25519** - - It should be empty if "`sftp_password`" is set. - """ - - -class Folder(TypedDict, total=False): - id: int - """Parameter meaning depends on the value of the "`storage_type`" value: - - - **s3** - S3 bucket ID. - - **ftp/sftp** - FTP/SFTP folder ID. - """ - - bucket: str - """S3 bucket name. - - The field is required if "`storage_type`": **s3**. - """ - - cdn_resource: int - """CDN resource ID.""" - - folder: str - """Parameter meaning depends on the value of the "`storage_type`" value: - - - **s3** - S3 bucket sub-folder name (optional.) - - **ftp/sftp** - FTP/SFTP folder name (required.) - """ diff --git a/src/gcore/types/cdn/logs_aggregated_stats.py b/src/gcore/types/cdn/logs_aggregated_stats.py index 30806dfc..4fd29679 100644 --- a/src/gcore/types/cdn/logs_aggregated_stats.py +++ b/src/gcore/types/cdn/logs_aggregated_stats.py @@ -17,7 +17,7 @@ class LogsAggregatedStats(BaseModel): """Statistics parameters.""" raw_logs_usage: Optional[str] = None - """Number of resources that used raw logs.""" + """Number of resources that used Logs uploader.""" resource: Optional[object] = None """Resources IDs by which statistics data is grouped..""" diff --git a/tests/api_resources/cdn/logs/test_settings.py b/tests/api_resources/cdn/logs/test_settings.py deleted file mode 100644 index 3384caf7..00000000 --- a/tests/api_resources/cdn/logs/test_settings.py +++ /dev/null @@ -1,568 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from gcore import Gcore, AsyncGcore -from tests.utils import assert_matches_type -from gcore.types.cdn.logs import LogSettings - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSettings: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Gcore) -> None: - setting = client.cdn.logs.settings.create( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[{}], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - ) - assert setting is None - - @parametrize - def test_method_create_with_all_params(self, client: Gcore) -> None: - setting = client.cdn.logs.settings.create( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[ - { - "id": 0, - "bucket": "bucket", - "cdn_resource": 0, - "folder": "folder", - } - ], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - archive_size_mb=500, - enabled=True, - ftp_prepend_folder="ftp_prepend_folder", - ignore_empty_logs=True, - s3_aws_region=0, - s3_bucket_location="s3_bucket_location", - s3_host_bucket="s3_host_bucket", - sftp_key_passphrase="sftp_key_passphrase", - sftp_prepend_folder="sftp_prepend_folder", - sftp_private_key="sftp_private_key", - ) - assert setting is None - - @parametrize - def test_raw_response_create(self, client: Gcore) -> None: - response = client.cdn.logs.settings.with_raw_response.create( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[{}], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert setting is None - - @parametrize - def test_streaming_response_create(self, client: Gcore) -> None: - with client.cdn.logs.settings.with_streaming_response.create( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[{}], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert setting is None - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_update(self, client: Gcore) -> None: - setting = client.cdn.logs.settings.update( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[{}], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - ) - assert setting is None - - @parametrize - def test_method_update_with_all_params(self, client: Gcore) -> None: - setting = client.cdn.logs.settings.update( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[ - { - "id": 0, - "bucket": "bucket", - "cdn_resource": 0, - "folder": "folder", - } - ], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - archive_size_mb=500, - enabled=True, - ftp_prepend_folder="ftp_prepend_folder", - ignore_empty_logs=True, - s3_aws_region=0, - s3_bucket_location="s3_bucket_location", - s3_host_bucket="s3_host_bucket", - sftp_key_passphrase="sftp_key_passphrase", - sftp_prepend_folder="sftp_prepend_folder", - sftp_private_key="sftp_private_key", - ) - assert setting is None - - @parametrize - def test_raw_response_update(self, client: Gcore) -> None: - response = client.cdn.logs.settings.with_raw_response.update( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[{}], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert setting is None - - @parametrize - def test_streaming_response_update(self, client: Gcore) -> None: - with client.cdn.logs.settings.with_streaming_response.update( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[{}], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert setting is None - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_delete(self, client: Gcore) -> None: - setting = client.cdn.logs.settings.delete() - assert setting is None - - @parametrize - def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cdn.logs.settings.with_raw_response.delete() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert setting is None - - @parametrize - def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cdn.logs.settings.with_streaming_response.delete() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert setting is None - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_get(self, client: Gcore) -> None: - setting = client.cdn.logs.settings.get() - assert_matches_type(LogSettings, setting, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Gcore) -> None: - response = client.cdn.logs.settings.with_raw_response.get() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = response.parse() - assert_matches_type(LogSettings, setting, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Gcore) -> None: - with client.cdn.logs.settings.with_streaming_response.get() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = response.parse() - assert_matches_type(LogSettings, setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncSettings: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_create(self, async_client: AsyncGcore) -> None: - setting = await async_client.cdn.logs.settings.create( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[{}], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - ) - assert setting is None - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - setting = await async_client.cdn.logs.settings.create( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[ - { - "id": 0, - "bucket": "bucket", - "cdn_resource": 0, - "folder": "folder", - } - ], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - archive_size_mb=500, - enabled=True, - ftp_prepend_folder="ftp_prepend_folder", - ignore_empty_logs=True, - s3_aws_region=0, - s3_bucket_location="s3_bucket_location", - s3_host_bucket="s3_host_bucket", - sftp_key_passphrase="sftp_key_passphrase", - sftp_prepend_folder="sftp_prepend_folder", - sftp_private_key="sftp_private_key", - ) - assert setting is None - - @parametrize - async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.logs.settings.with_raw_response.create( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[{}], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert setting is None - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.logs.settings.with_streaming_response.create( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[{}], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert setting is None - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_update(self, async_client: AsyncGcore) -> None: - setting = await async_client.cdn.logs.settings.update( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[{}], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - ) - assert setting is None - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - setting = await async_client.cdn.logs.settings.update( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[ - { - "id": 0, - "bucket": "bucket", - "cdn_resource": 0, - "folder": "folder", - } - ], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - archive_size_mb=500, - enabled=True, - ftp_prepend_folder="ftp_prepend_folder", - ignore_empty_logs=True, - s3_aws_region=0, - s3_bucket_location="s3_bucket_location", - s3_host_bucket="s3_host_bucket", - sftp_key_passphrase="sftp_key_passphrase", - sftp_prepend_folder="sftp_prepend_folder", - sftp_private_key="sftp_private_key", - ) - assert setting is None - - @parametrize - async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.logs.settings.with_raw_response.update( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[{}], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert setting is None - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.logs.settings.with_streaming_response.update( - all_resources_bucket="all_resources_bucket", - all_resources_folder="all_resources_folder", - folders=[{}], - for_all_resources=True, - ftp_hostname="ftp_hostname", - ftp_login="ftp_login", - ftp_password="ftp_password", - s3_access_key_id="s3_access_key_id", - s3_hostname="s3_hostname", - s3_secret_key="s3_secret_key", - s3_type="s3_type", - sftp_hostname="sftp_hostname", - sftp_login="sftp_login", - sftp_password="sftp_password", - storage_type="storage_type", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert setting is None - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncGcore) -> None: - setting = await async_client.cdn.logs.settings.delete() - assert setting is None - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.logs.settings.with_raw_response.delete() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert setting is None - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.logs.settings.with_streaming_response.delete() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert setting is None - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_get(self, async_client: AsyncGcore) -> None: - setting = await async_client.cdn.logs.settings.get() - assert_matches_type(LogSettings, setting, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.logs.settings.with_raw_response.get() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - setting = await response.parse() - assert_matches_type(LogSettings, setting, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.logs.settings.with_streaming_response.get() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - setting = await response.parse() - assert_matches_type(LogSettings, setting, path=["response"]) - - assert cast(Any, response.is_closed) is True From d47a2694df88b9dfdef631d4a085c305d7c86d1b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:40:37 +0000 Subject: [PATCH 379/592] feat(cloud)!: remove get and update list method for billing reservations --- .stats.yml | 4 +- api.md | 5 +- .../resources/cloud/billing_reservations.py | 262 +++--------------- src/gcore/types/cloud/__init__.py | 1 + src/gcore/types/cloud/billing_reservation.py | 166 ++++------- .../cloud/billing_reservation_list_params.py | 46 +-- src/gcore/types/cloud/billing_reservations.py | 16 ++ .../cloud/test_billing_reservations.py | 168 +++-------- 8 files changed, 143 insertions(+), 525 deletions(-) create mode 100644 src/gcore/types/cloud/billing_reservations.py diff --git a/.stats.yml b/.stats.yml index db89b62d..c571d757 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 608 +configured_endpoints: 607 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-028d2bc06b6df923be73a9173da89cc0b5f82016051679f7500732da0168431f.yml openapi_spec_hash: d85526ff52803ee01d44231d0536da87 -config_hash: 4424995cf809ff9b2c7ef6f4b5fbdcf8 +config_hash: ba133b9b8d6b270153eb6a24c4280262 diff --git a/api.md b/api.md index ff858a4e..9aba3b27 100644 --- a/api.md +++ b/api.md @@ -750,13 +750,12 @@ Methods: Types: ```python -from gcore.types.cloud import BillingReservation +from gcore.types.cloud import BillingReservation, BillingReservations ``` Methods: -- client.cloud.billing_reservations.list(\*\*params) -> SyncOffsetPage[BillingReservation] -- client.cloud.billing_reservations.get(reservation_id) -> BillingReservation +- client.cloud.billing_reservations.list(\*\*params) -> BillingReservations ## GPUBaremetalClusters diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index dc107127..19127d09 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -2,15 +2,12 @@ from __future__ import annotations -import typing_extensions -from typing import List, Union -from datetime import date, datetime from typing_extensions import Literal import httpx from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -19,10 +16,9 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...pagination import SyncOffsetPage, AsyncOffsetPage from ...types.cloud import billing_reservation_list_params -from ..._base_client import AsyncPaginator, make_request_options -from ...types.cloud.billing_reservation import BillingReservation +from ..._base_client import make_request_options +from ...types.cloud.billing_reservations import BillingReservations __all__ = ["BillingReservationsResource", "AsyncBillingReservationsResource"] @@ -47,71 +43,32 @@ def with_streaming_response(self) -> BillingReservationsResourceWithStreamingRes """ return BillingReservationsResourceWithStreamingResponse(self) - @typing_extensions.deprecated("deprecated") def list( self, *, - activated_from: Union[str, date] | Omit = omit, - activated_to: Union[str, date] | Omit = omit, - created_from: Union[str, datetime] | Omit = omit, - created_to: Union[str, datetime] | Omit = omit, - deactivated_from: Union[str, date] | Omit = omit, - deactivated_to: Union[str, date] | Omit = omit, - limit: int | Omit = omit, metric_name: str | Omit = omit, - offset: int | Omit = omit, - order_by: Literal[ - "active_from.asc", - "active_from.desc", - "active_to.asc", - "active_to.desc", - "created_at.asc", - "created_at.desc", - ] - | Omit = omit, + order_by: Literal["active_from.asc", "active_from.desc", "active_to.asc", "active_to.desc"] | Omit = omit, region_id: int | Omit = omit, - status: List[ - Literal[ - "ACTIVATED", "APPROVED", "COPIED", "CREATED", "EXPIRED", "REJECTED", "RESERVED", "WAITING_FOR_PAYMENT" - ] - ] - | Omit = omit, + show_inactive: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncOffsetPage[BillingReservation]: + ) -> BillingReservations: """ - List reservations + Get a list of billing reservations along with detailed information on resource + configurations and associated pricing. Args: - activated_from: Lower bound, starting from what date the reservation was/will be activated - - activated_to: High bound, before what date the reservation was/will be activated - - created_from: Lower bound the filter, showing result(s) equal to or greater than date the - reservation was created - - created_to: High bound the filter, showing result(s) equal to or less date the reservation - was created - - deactivated_from: Lower bound, starting from what date the reservation was/will be deactivated - - deactivated_to: High bound, before what date the reservation was/will be deactivated - - limit: Limit of reservation list page - metric_name: Name from billing features for specific resource - offset: Offset in reservation list - order_by: Order by field and direction. region_id: Region for reservation - status: Field for fixed a status by reservation workflow + show_inactive: Include inactive commits in the response extra_headers: Send extra headers @@ -121,9 +78,8 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( - "/cloud/v1/reservations", - page=SyncOffsetPage[BillingReservation], + return self._get( + "/cloud/v2/reservations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -131,57 +87,15 @@ def list( timeout=timeout, query=maybe_transform( { - "activated_from": activated_from, - "activated_to": activated_to, - "created_from": created_from, - "created_to": created_to, - "deactivated_from": deactivated_from, - "deactivated_to": deactivated_to, - "limit": limit, "metric_name": metric_name, - "offset": offset, "order_by": order_by, "region_id": region_id, - "status": status, + "show_inactive": show_inactive, }, billing_reservation_list_params.BillingReservationListParams, ), ), - model=BillingReservation, - ) - - @typing_extensions.deprecated("deprecated") - def get( - self, - reservation_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, - ) -> BillingReservation: - """ - Get reservation - - Args: - reservation_id: ID of the reservation - - 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"/cloud/v1/reservations/{reservation_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=BillingReservation, + cast_to=BillingReservations, ) @@ -205,71 +119,32 @@ def with_streaming_response(self) -> AsyncBillingReservationsResourceWithStreami """ return AsyncBillingReservationsResourceWithStreamingResponse(self) - @typing_extensions.deprecated("deprecated") - def list( + async def list( self, *, - activated_from: Union[str, date] | Omit = omit, - activated_to: Union[str, date] | Omit = omit, - created_from: Union[str, datetime] | Omit = omit, - created_to: Union[str, datetime] | Omit = omit, - deactivated_from: Union[str, date] | Omit = omit, - deactivated_to: Union[str, date] | Omit = omit, - limit: int | Omit = omit, metric_name: str | Omit = omit, - offset: int | Omit = omit, - order_by: Literal[ - "active_from.asc", - "active_from.desc", - "active_to.asc", - "active_to.desc", - "created_at.asc", - "created_at.desc", - ] - | Omit = omit, + order_by: Literal["active_from.asc", "active_from.desc", "active_to.asc", "active_to.desc"] | Omit = omit, region_id: int | Omit = omit, - status: List[ - Literal[ - "ACTIVATED", "APPROVED", "COPIED", "CREATED", "EXPIRED", "REJECTED", "RESERVED", "WAITING_FOR_PAYMENT" - ] - ] - | Omit = omit, + show_inactive: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[BillingReservation, AsyncOffsetPage[BillingReservation]]: + ) -> BillingReservations: """ - List reservations + Get a list of billing reservations along with detailed information on resource + configurations and associated pricing. Args: - activated_from: Lower bound, starting from what date the reservation was/will be activated - - activated_to: High bound, before what date the reservation was/will be activated - - created_from: Lower bound the filter, showing result(s) equal to or greater than date the - reservation was created - - created_to: High bound the filter, showing result(s) equal to or less date the reservation - was created - - deactivated_from: Lower bound, starting from what date the reservation was/will be deactivated - - deactivated_to: High bound, before what date the reservation was/will be deactivated - - limit: Limit of reservation list page - metric_name: Name from billing features for specific resource - offset: Offset in reservation list - order_by: Order by field and direction. region_id: Region for reservation - status: Field for fixed a status by reservation workflow + show_inactive: Include inactive commits in the response extra_headers: Send extra headers @@ -279,67 +154,24 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( - "/cloud/v1/reservations", - page=AsyncOffsetPage[BillingReservation], + return await self._get( + "/cloud/v2/reservations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform( + query=await async_maybe_transform( { - "activated_from": activated_from, - "activated_to": activated_to, - "created_from": created_from, - "created_to": created_to, - "deactivated_from": deactivated_from, - "deactivated_to": deactivated_to, - "limit": limit, "metric_name": metric_name, - "offset": offset, "order_by": order_by, "region_id": region_id, - "status": status, + "show_inactive": show_inactive, }, billing_reservation_list_params.BillingReservationListParams, ), ), - model=BillingReservation, - ) - - @typing_extensions.deprecated("deprecated") - async def get( - self, - reservation_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, - ) -> BillingReservation: - """ - Get reservation - - Args: - reservation_id: ID of the reservation - - 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"/cloud/v1/reservations/{reservation_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=BillingReservation, + cast_to=BillingReservations, ) @@ -347,15 +179,8 @@ class BillingReservationsResourceWithRawResponse: def __init__(self, billing_reservations: BillingReservationsResource) -> None: self._billing_reservations = billing_reservations - self.list = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - billing_reservations.list, # pyright: ignore[reportDeprecated], - ) - ) - self.get = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - billing_reservations.get, # pyright: ignore[reportDeprecated], - ) + self.list = to_raw_response_wrapper( + billing_reservations.list, ) @@ -363,15 +188,8 @@ class AsyncBillingReservationsResourceWithRawResponse: def __init__(self, billing_reservations: AsyncBillingReservationsResource) -> None: self._billing_reservations = billing_reservations - self.list = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - billing_reservations.list, # pyright: ignore[reportDeprecated], - ) - ) - self.get = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - billing_reservations.get, # pyright: ignore[reportDeprecated], - ) + self.list = async_to_raw_response_wrapper( + billing_reservations.list, ) @@ -379,15 +197,8 @@ class BillingReservationsResourceWithStreamingResponse: def __init__(self, billing_reservations: BillingReservationsResource) -> None: self._billing_reservations = billing_reservations - self.list = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - billing_reservations.list, # pyright: ignore[reportDeprecated], - ) - ) - self.get = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - billing_reservations.get, # pyright: ignore[reportDeprecated], - ) + self.list = to_streamed_response_wrapper( + billing_reservations.list, ) @@ -395,13 +206,6 @@ class AsyncBillingReservationsResourceWithStreamingResponse: def __init__(self, billing_reservations: AsyncBillingReservationsResource) -> None: self._billing_reservations = billing_reservations - self.list = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - billing_reservations.list, # pyright: ignore[reportDeprecated], - ) - ) - self.get = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - billing_reservations.get, # pyright: ignore[reportDeprecated], - ) + self.list = async_to_streamed_response_wrapper( + billing_reservations.list, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 96c25d07..2fd658ef 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -72,6 +72,7 @@ from .security_group_rule import SecurityGroupRule as SecurityGroupRule from .session_persistence import SessionPersistence as SessionPersistence from .ssh_key_list_params import SSHKeyListParams as SSHKeyListParams +from .billing_reservations import BillingReservations as BillingReservations from .cost_report_detailed import CostReportDetailed as CostReportDetailed from .floating_ip_detailed import FloatingIPDetailed as FloatingIPDetailed from .instance_list_params import InstanceListParams as InstanceListParams diff --git a/src/gcore/types/cloud/billing_reservation.py b/src/gcore/types/cloud/billing_reservation.py index 8f36e1bb..5a1c1949 100644 --- a/src/gcore/types/cloud/billing_reservation.py +++ b/src/gcore/types/cloud/billing_reservation.py @@ -1,153 +1,91 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import date, datetime -from typing_extensions import Literal +from typing import Optional +from datetime import datetime from ..._models import BaseModel -__all__ = ["BillingReservation", "AmountPrices", "Resource"] +__all__ = ["BillingReservation", "ActiveOvercommit", "Commit", "HardwareInfo"] -class AmountPrices(BaseModel): - commit_price_per_month: str - """Commit price of the item charged per month""" +class ActiveOvercommit(BaseModel): + active_from: datetime + """Billing subscription active from date""" - commit_price_per_unit: str - """Commit price of the item charged per hour""" + plan_item_id: Optional[int] = None + """Billing plan item ID""" - commit_price_total: str - """Commit price of the item charged for all period reservation""" + price_per_month: str + """Price per month""" - currency_code: str - """Currency code (3 letter code per ISO 4217)""" + price_per_unit: str + """Price per unit (hourly)""" - overcommit_price_per_month: str - """Overcommit price of the item charged per month""" + price_total: str + """Total price for the reservation period""" - overcommit_price_per_unit: str - """Overcommit price of the item charged per hour""" + subscription_id: Optional[int] = None + """Billing subscription ID for overcommit""" - overcommit_price_total: str - """Overcommit price of the item charged for all period reservation""" +class Commit(BaseModel): + active_from: datetime + """Billing subscription active from date""" -class Resource(BaseModel): - activity_period: str - """Name of the billing period, e.g month""" + active_to: Optional[datetime] = None + """Billing subscription active to date""" - activity_period_length: int - """Length of the full reservation period by `activity_period`""" + price_per_month: str + """Price per month, per one resource""" - billing_plan_item_id: int - """Billing plan item id""" + price_per_unit: str + """Price per unit, per one resource (hourly)""" - commit_price_per_month: str - """Commit price of the item charged per month""" + price_total: str + """Total price for the reservation period for the full reserved amount""" - commit_price_per_unit: str - """Commit price of the item charged per hour""" + subscription_id: int + """Billing subscription ID for commit""" - commit_price_total: str - """Commit price of the item charged for all period reservation""" - - overcommit_billing_plan_item_id: int - """Overcommit billing plan item id""" - - overcommit_price_per_month: str - """Overcommit price of the item charged per month""" - - overcommit_price_per_unit: str - """Overcommit price of the item charged per hour""" - - overcommit_price_total: str - """Overcommit price of the item charged for all period reservation""" - - resource_count: int - """Number of reserved resource items""" - - resource_name: str - """Resource name""" - - resource_type: Literal["flavor"] - """Resource type""" - - unit_name: str - """Billing unit name""" - - unit_size_month: str - """Minimal billing size, for example it is 744 hours per 1 month.""" - - unit_size_total: str - """Unit size month multiplied by count of resources in the reservation""" +class HardwareInfo(BaseModel): cpu: Optional[str] = None - """Baremetal CPU description""" + """CPU specification""" disk: Optional[str] = None - """Baremetal disk description""" + """Disk specification""" ram: Optional[str] = None - """Baremetal RAM description""" + """RAM specification""" class BillingReservation(BaseModel): - id: int - """Reservation id""" - - active_from: date - """Reservation active from date""" + active_billing_plan_id: int + """Active billing plan ID""" - active_to: date - """Reservation active to date""" + active_overcommit: ActiveOvercommit + """Overcommit pricing details""" - activity_period: str - """Name of the billing period, e.g month""" + commit: Commit + """Commit pricing details""" - activity_period_length: int - """Length of the full reservation period by `activity_period`""" - - amount_prices: AmountPrices - """Reservation amount prices""" - - billing_plan_id: int - """Billing plan id""" - - created_at: datetime - """Reservation creation date""" - - error: Optional[str] = None - """Error message if any occured during reservation""" - - eta: Optional[date] = None - """ETA delivery if bare metal out of stock. - - Value None means that bare metal in stock. - """ - - is_expiration_message_visible: bool - """Hide or show expiration message to customer.""" - - name: str - """Reservation name""" - - next_statuses: List[str] - """List of possible next reservation statuses""" - - region_id: int - """Region id""" + hardware_info: HardwareInfo + """Hardware specifications""" region_name: str """Region name""" - remind_expiration_message: Optional[date] = None - """The date when show expiration date to customer""" + resource_count: int + """Number of reserved resource items""" - resources: List[Resource] - """List of reservation resources""" + resource_name: str + """Resource name""" - status: str - """Reservation status""" + unit_name: str + """Unit name (e.g., 'H' for hours)""" - user_status: str - """User status""" + unit_size_month: str + """Unit size per month (e.g., 744 hours)""" + + unit_size_total: str + """Unit size month multiplied by count of resources in the reservation""" diff --git a/src/gcore/types/cloud/billing_reservation_list_params.py b/src/gcore/types/cloud/billing_reservation_list_params.py index a54c8b26..b0c40c5c 100644 --- a/src/gcore/types/cloud/billing_reservation_list_params.py +++ b/src/gcore/types/cloud/billing_reservation_list_params.py @@ -2,58 +2,20 @@ from __future__ import annotations -from typing import List, Union -from datetime import date, datetime -from typing_extensions import Literal, Annotated, TypedDict - -from ..._utils import PropertyInfo +from typing_extensions import Literal, TypedDict __all__ = ["BillingReservationListParams"] class BillingReservationListParams(TypedDict, total=False): - activated_from: Annotated[Union[str, date], PropertyInfo(format="iso8601")] - """Lower bound, starting from what date the reservation was/will be activated""" - - activated_to: Annotated[Union[str, date], PropertyInfo(format="iso8601")] - """High bound, before what date the reservation was/will be activated""" - - created_from: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """ - Lower bound the filter, showing result(s) equal to or greater than date the - reservation was created - """ - - created_to: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """ - High bound the filter, showing result(s) equal to or less date the reservation - was created - """ - - deactivated_from: Annotated[Union[str, date], PropertyInfo(format="iso8601")] - """Lower bound, starting from what date the reservation was/will be deactivated""" - - deactivated_to: Annotated[Union[str, date], PropertyInfo(format="iso8601")] - """High bound, before what date the reservation was/will be deactivated""" - - limit: int - """Limit of reservation list page""" - metric_name: str """Name from billing features for specific resource""" - offset: int - """Offset in reservation list""" - - order_by: Literal[ - "active_from.asc", "active_from.desc", "active_to.asc", "active_to.desc", "created_at.asc", "created_at.desc" - ] + order_by: Literal["active_from.asc", "active_from.desc", "active_to.asc", "active_to.desc"] """Order by field and direction.""" region_id: int """Region for reservation""" - status: List[ - Literal["ACTIVATED", "APPROVED", "COPIED", "CREATED", "EXPIRED", "REJECTED", "RESERVED", "WAITING_FOR_PAYMENT"] - ] - """Field for fixed a status by reservation workflow""" + show_inactive: bool + """Include inactive commits in the response""" diff --git a/src/gcore/types/cloud/billing_reservations.py b/src/gcore/types/cloud/billing_reservations.py new file mode 100644 index 00000000..d3787fba --- /dev/null +++ b/src/gcore/types/cloud/billing_reservations.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .billing_reservation import BillingReservation + +__all__ = ["BillingReservations"] + + +class BillingReservations(BaseModel): + count: int + """Number of objects""" + + results: List[BillingReservation] + """Objects""" diff --git a/tests/api_resources/cloud/test_billing_reservations.py b/tests/api_resources/cloud/test_billing_reservations.py index 64ab5b9a..28dd8870 100644 --- a/tests/api_resources/cloud/test_billing_reservations.py +++ b/tests/api_resources/cloud/test_billing_reservations.py @@ -9,11 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore._utils import parse_date, parse_datetime -from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.cloud import BillingReservation - -# pyright: reportDeprecated=false +from gcore.types.cloud import BillingReservations base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,85 +19,36 @@ class TestBillingReservations: @parametrize def test_method_list(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - billing_reservation = client.cloud.billing_reservations.list() - - assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + billing_reservation = client.cloud.billing_reservations.list() + assert_matches_type(BillingReservations, billing_reservation, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - billing_reservation = client.cloud.billing_reservations.list( - activated_from=parse_date("2019-12-27"), - activated_to=parse_date("2019-12-27"), - created_from=parse_datetime("2019-12-27T18:11:19.117Z"), - created_to=parse_datetime("2019-12-27T18:11:19.117Z"), - deactivated_from=parse_date("2019-12-27"), - deactivated_to=parse_date("2019-12-27"), - limit=1, - metric_name="metric_name", - offset=0, - order_by="active_from.asc", - region_id=0, - status=["ACTIVATED"], - ) - - assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + billing_reservation = client.cloud.billing_reservations.list( + metric_name="metric_name", + order_by="active_from.asc", + region_id=0, + show_inactive=True, + ) + assert_matches_type(BillingReservations, billing_reservation, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.cloud.billing_reservations.with_raw_response.list() + response = client.cloud.billing_reservations.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" billing_reservation = response.parse() - assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + assert_matches_type(BillingReservations, billing_reservation, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.cloud.billing_reservations.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - billing_reservation = response.parse() - assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_get(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - billing_reservation = client.cloud.billing_reservations.get( - 0, - ) - - assert_matches_type(BillingReservation, billing_reservation, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.cloud.billing_reservations.with_raw_response.get( - 0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - billing_reservation = response.parse() - assert_matches_type(BillingReservation, billing_reservation, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.cloud.billing_reservations.with_streaming_response.get( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.cloud.billing_reservations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - billing_reservation = response.parse() - assert_matches_type(BillingReservation, billing_reservation, path=["response"]) + billing_reservation = response.parse() + assert_matches_type(BillingReservations, billing_reservation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -113,84 +60,35 @@ class TestAsyncBillingReservations: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - billing_reservation = await async_client.cloud.billing_reservations.list() - - assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + billing_reservation = await async_client.cloud.billing_reservations.list() + assert_matches_type(BillingReservations, billing_reservation, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - billing_reservation = await async_client.cloud.billing_reservations.list( - activated_from=parse_date("2019-12-27"), - activated_to=parse_date("2019-12-27"), - created_from=parse_datetime("2019-12-27T18:11:19.117Z"), - created_to=parse_datetime("2019-12-27T18:11:19.117Z"), - deactivated_from=parse_date("2019-12-27"), - deactivated_to=parse_date("2019-12-27"), - limit=1, - metric_name="metric_name", - offset=0, - order_by="active_from.asc", - region_id=0, - status=["ACTIVATED"], - ) - - assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + billing_reservation = await async_client.cloud.billing_reservations.list( + metric_name="metric_name", + order_by="active_from.asc", + region_id=0, + show_inactive=True, + ) + assert_matches_type(BillingReservations, billing_reservation, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.cloud.billing_reservations.with_raw_response.list() + response = await async_client.cloud.billing_reservations.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" billing_reservation = await response.parse() - assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) + assert_matches_type(BillingReservations, billing_reservation, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.cloud.billing_reservations.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - billing_reservation = await response.parse() - assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_get(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - billing_reservation = await async_client.cloud.billing_reservations.get( - 0, - ) - - assert_matches_type(BillingReservation, billing_reservation, path=["response"]) + async with async_client.cloud.billing_reservations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - @parametrize - async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.cloud.billing_reservations.with_raw_response.get( - 0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - billing_reservation = await response.parse() - assert_matches_type(BillingReservation, billing_reservation, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.cloud.billing_reservations.with_streaming_response.get( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - billing_reservation = await response.parse() - assert_matches_type(BillingReservation, billing_reservation, path=["response"]) + billing_reservation = await response.parse() + assert_matches_type(BillingReservations, billing_reservation, path=["response"]) assert cast(Any, response.is_closed) is True From d6b3c622274a678d9bf7920bbcea5179ed5f4d00 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 16 Oct 2025 16:12:01 +0000 Subject: [PATCH 380/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c571d757..f1cba395 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 607 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-028d2bc06b6df923be73a9173da89cc0b5f82016051679f7500732da0168431f.yml -openapi_spec_hash: d85526ff52803ee01d44231d0536da87 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69cdddee2436ba596d5c966a54c73d4ed4081564ec1c09282e3736bdb9ec6e20.yml +openapi_spec_hash: 33a4d60dd35c4e8ae937a9b079a25cad config_hash: ba133b9b8d6b270153eb6a24c4280262 From 77f697ccf5dc5b9fbc9828344f324886bd36b8f3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:25:44 +0000 Subject: [PATCH 381/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8f3e0a49..b4e9013b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.15.0" + ".": "0.16.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 77000739..fd1d47f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.15.0" +version = "0.16.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 0bfdd66b..a0186b0a 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.15.0" # x-release-please-version +__version__ = "0.16.0" # x-release-please-version From b424a73579dfce340af11d18aebccf81b19f3859 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 10:20:55 +0000 Subject: [PATCH 382/592] chore: bump `httpx-aiohttp` version to 0.1.9 --- pyproject.toml | 2 +- requirements-dev.lock | 2 +- requirements.lock | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fd1d47f9..95e2f724 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ Homepage = "https://github.com/G-Core/gcore-python" Repository = "https://github.com/G-Core/gcore-python" [project.optional-dependencies] -aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"] +aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"] [tool.rye] managed = true diff --git a/requirements-dev.lock b/requirements-dev.lock index 8b62e881..a53580e4 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -59,7 +59,7 @@ httpx==0.28.1 # via gcore # via httpx-aiohttp # via respx -httpx-aiohttp==0.1.8 +httpx-aiohttp==0.1.9 # via gcore idna==3.4 # via anyio diff --git a/requirements.lock b/requirements.lock index b9e884ce..bdcade78 100644 --- a/requirements.lock +++ b/requirements.lock @@ -43,7 +43,7 @@ httpcore==1.0.9 httpx==0.28.1 # via gcore # via httpx-aiohttp -httpx-aiohttp==0.1.8 +httpx-aiohttp==0.1.9 # via gcore idna==3.4 # via anyio From 5fb9d3f7b3f06a6f71f822d4a759e46a05d5c67e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 14:42:09 +0000 Subject: [PATCH 383/592] chore(cloud)!: use new PATCH files shares endpoint --- .stats.yml | 2 +- api.md | 2 +- .../cloud/file_shares/file_shares.py | 49 ++--- tests/api_resources/cloud/test_file_shares.py | 176 ++++++++---------- 4 files changed, 98 insertions(+), 131 deletions(-) diff --git a/.stats.yml b/.stats.yml index f1cba395..79474ef0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 607 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69cdddee2436ba596d5c966a54c73d4ed4081564ec1c09282e3736bdb9ec6e20.yml openapi_spec_hash: 33a4d60dd35c4e8ae937a9b079a25cad -config_hash: ba133b9b8d6b270153eb6a24c4280262 +config_hash: 8231091a164c254e620f00ab3747d82a diff --git a/api.md b/api.md index 9aba3b27..27468d68 100644 --- a/api.md +++ b/api.md @@ -725,7 +725,7 @@ from gcore.types.cloud import FileShare Methods: - client.cloud.file_shares.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.file_shares.update(file_share_id, \*, project_id, region_id, \*\*params) -> FileShare +- client.cloud.file_shares.update(file_share_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.file_shares.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[FileShare] - client.cloud.file_shares.delete(file_share_id, \*, project_id, region_id) -> TaskIDList - client.cloud.file_shares.get(file_share_id, \*, project_id, region_id) -> FileShare diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 463ee013..025b46b5 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -2,7 +2,6 @@ from __future__ import annotations -import typing_extensions from typing import Dict, Iterable, Optional from typing_extensions import Literal, overload @@ -228,7 +227,6 @@ def create( cast_to=TaskIDList, ) - @typing_extensions.deprecated("deprecated") def update( self, file_share_id: str, @@ -244,12 +242,9 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FileShare: + ) -> TaskIDList: """ - Rename file share or update tags - - **Deprecated**: Use PATCH - /v3/`file_shares`/{`project_id`}/{`region_id`}/{`file_share_id`} instead + Rename file share, update tags or set share specific properties Args: project_id: Project ID @@ -299,7 +294,7 @@ def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v3/file_shares/{project_id}/{region_id}/{file_share_id}", body=maybe_transform( { "name": name, @@ -311,7 +306,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FileShare, + cast_to=TaskIDList, ) def list( @@ -707,7 +702,6 @@ async def create( cast_to=TaskIDList, ) - @typing_extensions.deprecated("deprecated") async def update( self, file_share_id: str, @@ -723,12 +717,9 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FileShare: + ) -> TaskIDList: """ - Rename file share or update tags - - **Deprecated**: Use PATCH - /v3/`file_shares`/{`project_id`}/{`region_id`}/{`file_share_id`} instead + Rename file share, update tags or set share specific properties Args: project_id: Project ID @@ -778,7 +769,7 @@ async def update( if not file_share_id: raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}") return await self._patch( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v3/file_shares/{project_id}/{region_id}/{file_share_id}", body=await async_maybe_transform( { "name": name, @@ -790,7 +781,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FileShare, + cast_to=TaskIDList, ) def list( @@ -1006,10 +997,8 @@ def __init__(self, file_shares: FileSharesResource) -> None: self.create = to_raw_response_wrapper( file_shares.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - file_shares.update, # pyright: ignore[reportDeprecated], - ) + self.update = to_raw_response_wrapper( + file_shares.update, ) self.list = to_raw_response_wrapper( file_shares.list, @@ -1036,10 +1025,8 @@ def __init__(self, file_shares: AsyncFileSharesResource) -> None: self.create = async_to_raw_response_wrapper( file_shares.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - file_shares.update, # pyright: ignore[reportDeprecated], - ) + self.update = async_to_raw_response_wrapper( + file_shares.update, ) self.list = async_to_raw_response_wrapper( file_shares.list, @@ -1066,10 +1053,8 @@ def __init__(self, file_shares: FileSharesResource) -> None: self.create = to_streamed_response_wrapper( file_shares.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - file_shares.update, # pyright: ignore[reportDeprecated], - ) + self.update = to_streamed_response_wrapper( + file_shares.update, ) self.list = to_streamed_response_wrapper( file_shares.list, @@ -1096,10 +1081,8 @@ def __init__(self, file_shares: AsyncFileSharesResource) -> None: self.create = async_to_streamed_response_wrapper( file_shares.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - file_shares.update, # pyright: ignore[reportDeprecated], - ) + self.update = async_to_streamed_response_wrapper( + file_shares.update, ) self.list = async_to_streamed_response_wrapper( file_shares.list, diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index adc1fc01..055e05d6 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -15,8 +15,6 @@ TaskIDList, ) -# pyright: reportDeprecated=false - base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -157,72 +155,65 @@ def test_streaming_response_create_overload_2(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - file_share = client.cloud.file_shares.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - ) - - assert_matches_type(FileShare, file_share, path=["response"]) + file_share = client.cloud.file_shares.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - file_share = client.cloud.file_shares.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - name="some_name", - share_settings={ - "allowed_characters": "LCD", - "path_length": "LCD", - "root_squash": True, - }, - tags={"foo": "my-tag-value"}, - ) - - assert_matches_type(FileShare, file_share, path=["response"]) + file_share = client.cloud.file_shares.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + name="some_name", + share_settings={ + "allowed_characters": "LCD", + "path_length": "LCD", + "root_squash": True, + }, + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.cloud.file_shares.with_raw_response.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - ) + response = client.cloud.file_shares.with_raw_response.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" file_share = response.parse() - assert_matches_type(FileShare, file_share, path=["response"]) + assert_matches_type(TaskIDList, file_share, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.cloud.file_shares.with_streaming_response.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.cloud.file_shares.with_streaming_response.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file_share = response.parse() - assert_matches_type(FileShare, file_share, path=["response"]) + file_share = response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): - client.cloud.file_shares.with_raw_response.update( - file_share_id="", - project_id=1, - region_id=1, - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + client.cloud.file_shares.with_raw_response.update( + file_share_id="", + project_id=1, + region_id=1, + ) @parametrize def test_method_list(self, client: Gcore) -> None: @@ -552,72 +543,65 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncGco @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - file_share = await async_client.cloud.file_shares.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - ) - - assert_matches_type(FileShare, file_share, path=["response"]) + file_share = await async_client.cloud.file_shares.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - file_share = await async_client.cloud.file_shares.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - name="some_name", - share_settings={ - "allowed_characters": "LCD", - "path_length": "LCD", - "root_squash": True, - }, - tags={"foo": "my-tag-value"}, - ) - - assert_matches_type(FileShare, file_share, path=["response"]) + file_share = await async_client.cloud.file_shares.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + name="some_name", + share_settings={ + "allowed_characters": "LCD", + "path_length": "LCD", + "root_squash": True, + }, + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, file_share, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.cloud.file_shares.with_raw_response.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - ) + response = await async_client.cloud.file_shares.with_raw_response.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" file_share = await response.parse() - assert_matches_type(FileShare, file_share, path=["response"]) + assert_matches_type(TaskIDList, file_share, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.cloud.file_shares.with_streaming_response.update( - file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + async with async_client.cloud.file_shares.with_streaming_response.update( + file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file_share = await response.parse() - assert_matches_type(FileShare, file_share, path=["response"]) + file_share = await response.parse() + assert_matches_type(TaskIDList, file_share, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): - await async_client.cloud.file_shares.with_raw_response.update( - file_share_id="", - project_id=1, - region_id=1, - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"): + await async_client.cloud.file_shares.with_raw_response.update( + file_share_id="", + project_id=1, + region_id=1, + ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: From 24c229e41807439176d30718e174417ccefabec9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 14:57:16 +0000 Subject: [PATCH 384/592] chore(cloud)!: rename to projects update --- .stats.yml | 2 +- api.md | 2 +- src/gcore/resources/cloud/projects.py | 218 +++++++++--------- src/gcore/types/cloud/__init__.py | 2 +- ...ace_params.py => project_update_params.py} | 4 +- tests/api_resources/cloud/test_projects.py | 146 ++++++------ tests/test_client.py | 8 +- 7 files changed, 191 insertions(+), 191 deletions(-) rename src/gcore/types/cloud/{project_replace_params.py => project_update_params.py} (81%) diff --git a/.stats.yml b/.stats.yml index 79474ef0..23ec15d4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 607 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69cdddee2436ba596d5c966a54c73d4ed4081564ec1c09282e3736bdb9ec6e20.yml openapi_spec_hash: 33a4d60dd35c4e8ae937a9b079a25cad -config_hash: 8231091a164c254e620f00ab3747d82a +config_hash: 047e7f6015b85a7f8ee3c1127e5cd4a1 diff --git a/api.md b/api.md index 27468d68..32c6564e 100644 --- a/api.md +++ b/api.md @@ -67,10 +67,10 @@ from gcore.types.cloud import Project Methods: - client.cloud.projects.create(\*\*params) -> Project +- client.cloud.projects.update(\*, project_id, \*\*params) -> Project - client.cloud.projects.list(\*\*params) -> SyncOffsetPage[Project] - client.cloud.projects.delete(\*, project_id) -> TaskIDList - client.cloud.projects.get(\*, project_id) -> Project -- client.cloud.projects.replace(\*, project_id, \*\*params) -> Project ## Tasks diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index cb6c69b4..2e5ae929 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -18,7 +18,7 @@ async_to_streamed_response_wrapper, ) from ...pagination import SyncOffsetPage, AsyncOffsetPage -from ...types.cloud import project_list_params, project_create_params, project_replace_params +from ...types.cloud import project_list_params, project_create_params, project_update_params from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.project import Project from ...types.cloud.task_id_list import TaskIDList @@ -99,6 +99,54 @@ def create( cast_to=Project, ) + def update( + self, + *, + project_id: int | None = None, + name: str, + description: Optional[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Project: + """Update project name and description. + + Project management must be enabled to + perform this operation. + + Args: + name: Name of the entity, following a specific format. + + description: Description of the project. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return self._put( + f"/cloud/v1/projects/{project_id}", + body=maybe_transform( + { + "name": name, + "description": description, + }, + project_update_params.ProjectUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Project, + ) + def list( self, *, @@ -233,54 +281,6 @@ def get( cast_to=Project, ) - def replace( - self, - *, - project_id: int | None = None, - name: str, - description: Optional[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Project: - """Update project name and description. - - Project management must be enabled to - perform this operation. - - Args: - name: Name of the entity, following a specific format. - - description: Description of the project. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - return self._put( - f"/cloud/v1/projects/{project_id}", - body=maybe_transform( - { - "name": name, - "description": description, - }, - project_replace_params.ProjectReplaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Project, - ) - class AsyncProjectsResource(AsyncAPIResource): @cached_property @@ -355,6 +355,54 @@ async def create( cast_to=Project, ) + async def update( + self, + *, + project_id: int | None = None, + name: str, + description: Optional[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Project: + """Update project name and description. + + Project management must be enabled to + perform this operation. + + Args: + name: Name of the entity, following a specific format. + + description: Description of the project. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + return await self._put( + f"/cloud/v1/projects/{project_id}", + body=await async_maybe_transform( + { + "name": name, + "description": description, + }, + project_update_params.ProjectUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Project, + ) + def list( self, *, @@ -489,54 +537,6 @@ async def get( cast_to=Project, ) - async def replace( - self, - *, - project_id: int | None = None, - name: str, - description: Optional[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Project: - """Update project name and description. - - Project management must be enabled to - perform this operation. - - Args: - name: Name of the entity, following a specific format. - - description: Description of the project. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - return await self._put( - f"/cloud/v1/projects/{project_id}", - body=await async_maybe_transform( - { - "name": name, - "description": description, - }, - project_replace_params.ProjectReplaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Project, - ) - class ProjectsResourceWithRawResponse: def __init__(self, projects: ProjectsResource) -> None: @@ -545,6 +545,9 @@ def __init__(self, projects: ProjectsResource) -> None: self.create = to_raw_response_wrapper( projects.create, ) + self.update = to_raw_response_wrapper( + projects.update, + ) self.list = to_raw_response_wrapper( projects.list, ) @@ -554,9 +557,6 @@ def __init__(self, projects: ProjectsResource) -> None: self.get = to_raw_response_wrapper( projects.get, ) - self.replace = to_raw_response_wrapper( - projects.replace, - ) class AsyncProjectsResourceWithRawResponse: @@ -566,6 +566,9 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.create = async_to_raw_response_wrapper( projects.create, ) + self.update = async_to_raw_response_wrapper( + projects.update, + ) self.list = async_to_raw_response_wrapper( projects.list, ) @@ -575,9 +578,6 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.get = async_to_raw_response_wrapper( projects.get, ) - self.replace = async_to_raw_response_wrapper( - projects.replace, - ) class ProjectsResourceWithStreamingResponse: @@ -587,6 +587,9 @@ def __init__(self, projects: ProjectsResource) -> None: self.create = to_streamed_response_wrapper( projects.create, ) + self.update = to_streamed_response_wrapper( + projects.update, + ) self.list = to_streamed_response_wrapper( projects.list, ) @@ -596,9 +599,6 @@ def __init__(self, projects: ProjectsResource) -> None: self.get = to_streamed_response_wrapper( projects.get, ) - self.replace = to_streamed_response_wrapper( - projects.replace, - ) class AsyncProjectsResourceWithStreamingResponse: @@ -608,6 +608,9 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.create = async_to_streamed_response_wrapper( projects.create, ) + self.update = async_to_streamed_response_wrapper( + projects.update, + ) self.list = async_to_streamed_response_wrapper( projects.list, ) @@ -617,6 +620,3 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.get = async_to_streamed_response_wrapper( projects.get, ) - self.replace = async_to_streamed_response_wrapper( - projects.replace, - ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 2fd658ef..80b12b29 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -95,6 +95,7 @@ from .network_create_params import NetworkCreateParams as NetworkCreateParams from .network_update_params import NetworkUpdateParams as NetworkUpdateParams from .project_create_params import ProjectCreateParams as ProjectCreateParams +from .project_update_params import ProjectUpdateParams as ProjectUpdateParams from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams from .cost_report_aggregated import CostReportAggregated as CostReportAggregated @@ -106,7 +107,6 @@ from .instance_update_params import InstanceUpdateParams as InstanceUpdateParams from .lb_health_monitor_type import LbHealthMonitorType as LbHealthMonitorType from .network_interface_list import NetworkInterfaceList as NetworkInterfaceList -from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse from .registry_create_params import RegistryCreateParams as RegistryCreateParams from .registry_resize_params import RegistryResizeParams as RegistryResizeParams diff --git a/src/gcore/types/cloud/project_replace_params.py b/src/gcore/types/cloud/project_update_params.py similarity index 81% rename from src/gcore/types/cloud/project_replace_params.py rename to src/gcore/types/cloud/project_update_params.py index c26f1c6f..42489cb1 100644 --- a/src/gcore/types/cloud/project_replace_params.py +++ b/src/gcore/types/cloud/project_update_params.py @@ -5,10 +5,10 @@ from typing import Optional from typing_extensions import Required, TypedDict -__all__ = ["ProjectReplaceParams"] +__all__ = ["ProjectUpdateParams"] -class ProjectReplaceParams(TypedDict, total=False): +class ProjectUpdateParams(TypedDict, total=False): project_id: int name: Required[str] diff --git a/tests/api_resources/cloud/test_projects.py b/tests/api_resources/cloud/test_projects.py index b01e5c29..33942a79 100644 --- a/tests/api_resources/cloud/test_projects.py +++ b/tests/api_resources/cloud/test_projects.py @@ -59,6 +59,49 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_update(self, client: Gcore) -> None: + project = client.cloud.projects.update( + project_id=0, + name="New Project", + ) + assert_matches_type(Project, project, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + project = client.cloud.projects.update( + project_id=0, + name="New Project", + description="Project description", + ) + assert_matches_type(Project, project, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.projects.with_raw_response.update( + project_id=0, + name="New Project", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + project = response.parse() + assert_matches_type(Project, project, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.projects.with_streaming_response.update( + project_id=0, + name="New Project", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + project = response.parse() + assert_matches_type(Project, project, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_list(self, client: Gcore) -> None: project = client.cloud.projects.list() @@ -158,75 +201,74 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + +class TestAsyncProjects: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + @parametrize - def test_method_replace(self, client: Gcore) -> None: - project = client.cloud.projects.replace( - project_id=0, + async def test_method_create(self, async_client: AsyncGcore) -> None: + project = await async_client.cloud.projects.create( name="New Project", ) assert_matches_type(Project, project, path=["response"]) @parametrize - def test_method_replace_with_all_params(self, client: Gcore) -> None: - project = client.cloud.projects.replace( - project_id=0, + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + project = await async_client.cloud.projects.create( name="New Project", + client_id=3, description="Project description", + state="ACTIVE", ) assert_matches_type(Project, project, path=["response"]) @parametrize - def test_raw_response_replace(self, client: Gcore) -> None: - response = client.cloud.projects.with_raw_response.replace( - project_id=0, + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.projects.with_raw_response.create( name="New Project", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() + project = await response.parse() assert_matches_type(Project, project, path=["response"]) @parametrize - def test_streaming_response_replace(self, client: Gcore) -> None: - with client.cloud.projects.with_streaming_response.replace( - project_id=0, + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.projects.with_streaming_response.create( name="New Project", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() + project = await response.parse() assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True - -class TestAsyncProjects: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - @parametrize - async def test_method_create(self, async_client: AsyncGcore) -> None: - project = await async_client.cloud.projects.create( + async def test_method_update(self, async_client: AsyncGcore) -> None: + project = await async_client.cloud.projects.update( + project_id=0, name="New Project", ) assert_matches_type(Project, project, path=["response"]) @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - project = await async_client.cloud.projects.create( + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + project = await async_client.cloud.projects.update( + project_id=0, name="New Project", - client_id=3, description="Project description", - state="ACTIVE", ) assert_matches_type(Project, project, path=["response"]) @parametrize - async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.projects.with_raw_response.create( + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.projects.with_raw_response.update( + project_id=0, name="New Project", ) @@ -236,8 +278,9 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: assert_matches_type(Project, project, path=["response"]) @parametrize - async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.projects.with_streaming_response.create( + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.projects.with_streaming_response.update( + project_id=0, name="New Project", ) as response: assert not response.is_closed @@ -346,46 +389,3 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_replace(self, async_client: AsyncGcore) -> None: - project = await async_client.cloud.projects.replace( - project_id=0, - name="New Project", - ) - assert_matches_type(Project, project, path=["response"]) - - @parametrize - async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: - project = await async_client.cloud.projects.replace( - project_id=0, - name="New Project", - description="Project description", - ) - assert_matches_type(Project, project, path=["response"]) - - @parametrize - async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.projects.with_raw_response.replace( - project_id=0, - name="New Project", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() - assert_matches_type(Project, project, path=["response"]) - - @parametrize - async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.projects.with_streaming_response.replace( - project_id=0, - name="New Project", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = await response.parse() - assert_matches_type(Project, project, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/test_client.py b/tests/test_client.py index 17903dc2..1ef62fe4 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -367,11 +367,11 @@ def test_cloud_project_id_client_params(self) -> None: with client as c2: with pytest.raises(ValueError, match="Missing cloud_project_id argument;"): - c2.cloud.projects.delete() + c2.cloud.projects.update(name="New Project") client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_project_id=0) with client as c2: - c2.cloud.projects.delete() + c2.cloud.projects.update(name="New Project") def test_cloud_region_id_client_params(self) -> None: client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) @@ -1192,11 +1192,11 @@ async def test_cloud_project_id_client_params(self) -> None: async with client as c2: with pytest.raises(ValueError, match="Missing cloud_project_id argument;"): - await c2.cloud.projects.delete() + await c2.cloud.projects.update(name="New Project") client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_project_id=0) async with client as c2: - await c2.cloud.projects.delete() + await c2.cloud.projects.update(name="New Project") async def test_cloud_region_id_client_params(self) -> None: client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) From d91076fa165a1df46b9cb20fb01e72193cef256e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 18 Oct 2025 13:28:46 +0000 Subject: [PATCH 385/592] feat(cloud): enable TF for placement groups --- .stats.yml | 2 +- src/gcore/resources/cloud/cloud.py | 18 ++++++++++++++++++ src/gcore/resources/cloud/placement_groups.py | 8 ++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 23ec15d4..cbda0171 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 607 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69cdddee2436ba596d5c966a54c73d4ed4081564ec1c09282e3736bdb9ec6e20.yml openapi_spec_hash: 33a4d60dd35c4e8ae937a9b079a25cad -config_hash: 047e7f6015b85a7f8ee3c1127e5cd4a1 +config_hash: 92707e07e9f37f45fb1c3067865e2185 diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index eee5ccd6..7628349c 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -283,6 +283,9 @@ def inference(self) -> InferenceResource: @cached_property def placement_groups(self) -> PlacementGroupsResource: + """ + Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones. + """ return PlacementGroupsResource(self._client) @cached_property @@ -412,6 +415,9 @@ def inference(self) -> AsyncInferenceResource: @cached_property def placement_groups(self) -> AsyncPlacementGroupsResource: + """ + Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones. + """ return AsyncPlacementGroupsResource(self._client) @cached_property @@ -544,6 +550,9 @@ def inference(self) -> InferenceResourceWithRawResponse: @cached_property def placement_groups(self) -> PlacementGroupsResourceWithRawResponse: + """ + Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones. + """ return PlacementGroupsResourceWithRawResponse(self._cloud.placement_groups) @cached_property @@ -657,6 +666,9 @@ def inference(self) -> AsyncInferenceResourceWithRawResponse: @cached_property def placement_groups(self) -> AsyncPlacementGroupsResourceWithRawResponse: + """ + Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones. + """ return AsyncPlacementGroupsResourceWithRawResponse(self._cloud.placement_groups) @cached_property @@ -770,6 +782,9 @@ def inference(self) -> InferenceResourceWithStreamingResponse: @cached_property def placement_groups(self) -> PlacementGroupsResourceWithStreamingResponse: + """ + Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones. + """ return PlacementGroupsResourceWithStreamingResponse(self._cloud.placement_groups) @cached_property @@ -883,6 +898,9 @@ def inference(self) -> AsyncInferenceResourceWithStreamingResponse: @cached_property def placement_groups(self) -> AsyncPlacementGroupsResourceWithStreamingResponse: + """ + Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones. + """ return AsyncPlacementGroupsResourceWithStreamingResponse(self._cloud.placement_groups) @cached_property diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index bb5119c8..243dd294 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -26,6 +26,10 @@ class PlacementGroupsResource(SyncAPIResource): + """ + Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones. + """ + @cached_property def with_raw_response(self) -> PlacementGroupsResourceWithRawResponse: """ @@ -210,6 +214,10 @@ def get( class AsyncPlacementGroupsResource(AsyncAPIResource): + """ + Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones. + """ + @cached_property def with_raw_response(self) -> AsyncPlacementGroupsResourceWithRawResponse: """ From dccb8c305b2af2674fca01928344da5fd3b8679e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 08:52:01 +0000 Subject: [PATCH 386/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index cbda0171..3a816ce9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 607 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69cdddee2436ba596d5c966a54c73d4ed4081564ec1c09282e3736bdb9ec6e20.yml openapi_spec_hash: 33a4d60dd35c4e8ae937a9b079a25cad -config_hash: 92707e07e9f37f45fb1c3067865e2185 +config_hash: a9137176d3732dbcd57f852c1dcc486e From 60030f0b09ac5b0e7a5bd5d51145ba38bd924ca9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 09:13:19 +0000 Subject: [PATCH 387/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 3a816ce9..9360c889 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 607 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69cdddee2436ba596d5c966a54c73d4ed4081564ec1c09282e3736bdb9ec6e20.yml openapi_spec_hash: 33a4d60dd35c4e8ae937a9b079a25cad -config_hash: a9137176d3732dbcd57f852c1dcc486e +config_hash: 720d60887d39a3d28eaa15095c52ba8e From 6d4903820a910de879ebfa91e8c6d7f73ff2008e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 10:01:10 +0000 Subject: [PATCH 388/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 9360c889..aace63c6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 607 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69cdddee2436ba596d5c966a54c73d4ed4081564ec1c09282e3736bdb9ec6e20.yml openapi_spec_hash: 33a4d60dd35c4e8ae937a9b079a25cad -config_hash: 720d60887d39a3d28eaa15095c52ba8e +config_hash: e0fc59326352d96367e9bb218de26276 From 32c59e9d1c0062c0f41aec0ca3e43d5acc731e47 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 20 Oct 2025 10:18:51 +0000 Subject: [PATCH 389/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/types/cdn/cdn_resource.py | 2 +- src/gcore/types/cdn/resource_create_params.py | 2 +- .../types/cdn/resource_replace_params.py | 2 +- src/gcore/types/cdn/resource_update_params.py | 2 +- .../types/cdn/resources/cdn_resource_rule.py | 2 +- .../types/cdn/resources/rule_create_params.py | 2 +- .../cdn/resources/rule_replace_params.py | 2 +- .../types/cdn/resources/rule_update_params.py | 2 +- src/gcore/types/cdn/rule_template.py | 2 +- .../types/cdn/rule_template_create_params.py | 2 +- .../types/cdn/rule_template_replace_params.py | 2 +- .../types/cdn/rule_template_update_params.py | 2 +- .../api_resources/cdn/resources/test_rules.py | 90 +++++++++++-------- tests/api_resources/cdn/test_resources.py | 90 +++++++++++-------- .../api_resources/cdn/test_rule_templates.py | 90 +++++++++++-------- 16 files changed, 176 insertions(+), 122 deletions(-) diff --git a/.stats.yml b/.stats.yml index aace63c6..13da14b8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 607 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69cdddee2436ba596d5c966a54c73d4ed4081564ec1c09282e3736bdb9ec6e20.yml -openapi_spec_hash: 33a4d60dd35c4e8ae937a9b079a25cad +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ef83e09553fcd2b3c5fb67d3fb7f49cfa58fd22b58df2666d4359490c31f6118.yml +openapi_spec_hash: e560d8339290d758f459a6ea6ed16928 config_hash: e0fc59326352d96367e9bb218de26276 diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py index 6b897448..dd05e44f 100644 --- a/src/gcore/types/cdn/cdn_resource.py +++ b/src/gcore/types/cdn/cdn_resource.py @@ -1189,7 +1189,7 @@ class OptionsStaticHeaders(BaseModel): - **false** - Option is disabled. """ - value: Dict[str, str] + value: object """A MAP for static headers in a format of `header_name: header_value`. Restrictions: diff --git a/src/gcore/types/cdn/resource_create_params.py b/src/gcore/types/cdn/resource_create_params.py index 544e6f4a..f31367c0 100644 --- a/src/gcore/types/cdn/resource_create_params.py +++ b/src/gcore/types/cdn/resource_create_params.py @@ -1310,7 +1310,7 @@ class OptionsStaticHeaders(TypedDict, total=False): - **false** - Option is disabled. """ - value: Required[Dict[str, str]] + value: Required[object] """A MAP for static headers in a format of `header_name: header_value`. Restrictions: diff --git a/src/gcore/types/cdn/resource_replace_params.py b/src/gcore/types/cdn/resource_replace_params.py index 938b1f96..717114a4 100644 --- a/src/gcore/types/cdn/resource_replace_params.py +++ b/src/gcore/types/cdn/resource_replace_params.py @@ -1288,7 +1288,7 @@ class OptionsStaticHeaders(TypedDict, total=False): - **false** - Option is disabled. """ - value: Required[Dict[str, str]] + value: Required[object] """A MAP for static headers in a format of `header_name: header_value`. Restrictions: diff --git a/src/gcore/types/cdn/resource_update_params.py b/src/gcore/types/cdn/resource_update_params.py index 6ee27ee0..d980ad8c 100644 --- a/src/gcore/types/cdn/resource_update_params.py +++ b/src/gcore/types/cdn/resource_update_params.py @@ -1279,7 +1279,7 @@ class OptionsStaticHeaders(TypedDict, total=False): - **false** - Option is disabled. """ - value: Required[Dict[str, str]] + value: Required[object] """A MAP for static headers in a format of `header_name: header_value`. Restrictions: diff --git a/src/gcore/types/cdn/resources/cdn_resource_rule.py b/src/gcore/types/cdn/resources/cdn_resource_rule.py index 4975c21d..28dc2ebf 100644 --- a/src/gcore/types/cdn/resources/cdn_resource_rule.py +++ b/src/gcore/types/cdn/resources/cdn_resource_rule.py @@ -1166,7 +1166,7 @@ class OptionsStaticHeaders(BaseModel): - **false** - Option is disabled. """ - value: Dict[str, str] + value: object """A MAP for static headers in a format of `header_name: header_value`. Restrictions: diff --git a/src/gcore/types/cdn/resources/rule_create_params.py b/src/gcore/types/cdn/resources/rule_create_params.py index 1f1c269f..6c8ab837 100644 --- a/src/gcore/types/cdn/resources/rule_create_params.py +++ b/src/gcore/types/cdn/resources/rule_create_params.py @@ -1240,7 +1240,7 @@ class OptionsStaticHeaders(TypedDict, total=False): - **false** - Option is disabled. """ - value: Required[Dict[str, str]] + value: Required[object] """A MAP for static headers in a format of `header_name: header_value`. Restrictions: diff --git a/src/gcore/types/cdn/resources/rule_replace_params.py b/src/gcore/types/cdn/resources/rule_replace_params.py index 63da2423..6eb3eddc 100644 --- a/src/gcore/types/cdn/resources/rule_replace_params.py +++ b/src/gcore/types/cdn/resources/rule_replace_params.py @@ -1242,7 +1242,7 @@ class OptionsStaticHeaders(TypedDict, total=False): - **false** - Option is disabled. """ - value: Required[Dict[str, str]] + value: Required[object] """A MAP for static headers in a format of `header_name: header_value`. Restrictions: diff --git a/src/gcore/types/cdn/resources/rule_update_params.py b/src/gcore/types/cdn/resources/rule_update_params.py index 6351104f..154c4cef 100644 --- a/src/gcore/types/cdn/resources/rule_update_params.py +++ b/src/gcore/types/cdn/resources/rule_update_params.py @@ -1242,7 +1242,7 @@ class OptionsStaticHeaders(TypedDict, total=False): - **false** - Option is disabled. """ - value: Required[Dict[str, str]] + value: Required[object] """A MAP for static headers in a format of `header_name: header_value`. Restrictions: diff --git a/src/gcore/types/cdn/rule_template.py b/src/gcore/types/cdn/rule_template.py index 4f13a6a2..6d73d4f4 100644 --- a/src/gcore/types/cdn/rule_template.py +++ b/src/gcore/types/cdn/rule_template.py @@ -1166,7 +1166,7 @@ class OptionsStaticHeaders(BaseModel): - **false** - Option is disabled. """ - value: Dict[str, str] + value: object """A MAP for static headers in a format of `header_name: header_value`. Restrictions: diff --git a/src/gcore/types/cdn/rule_template_create_params.py b/src/gcore/types/cdn/rule_template_create_params.py index 529ec2a3..a0e9ea73 100644 --- a/src/gcore/types/cdn/rule_template_create_params.py +++ b/src/gcore/types/cdn/rule_template_create_params.py @@ -1224,7 +1224,7 @@ class OptionsStaticHeaders(TypedDict, total=False): - **false** - Option is disabled. """ - value: Required[Dict[str, str]] + value: Required[object] """A MAP for static headers in a format of `header_name: header_value`. Restrictions: diff --git a/src/gcore/types/cdn/rule_template_replace_params.py b/src/gcore/types/cdn/rule_template_replace_params.py index ca412de2..683bd306 100644 --- a/src/gcore/types/cdn/rule_template_replace_params.py +++ b/src/gcore/types/cdn/rule_template_replace_params.py @@ -1224,7 +1224,7 @@ class OptionsStaticHeaders(TypedDict, total=False): - **false** - Option is disabled. """ - value: Required[Dict[str, str]] + value: Required[object] """A MAP for static headers in a format of `header_name: header_value`. Restrictions: diff --git a/src/gcore/types/cdn/rule_template_update_params.py b/src/gcore/types/cdn/rule_template_update_params.py index 685df7a4..c1e77142 100644 --- a/src/gcore/types/cdn/rule_template_update_params.py +++ b/src/gcore/types/cdn/rule_template_update_params.py @@ -1224,7 +1224,7 @@ class OptionsStaticHeaders(TypedDict, total=False): - **false** - Option is disabled. """ - value: Required[Dict[str, str]] + value: Required[object] """A MAP for static headers in a format of `header_name: header_value`. Restrictions: diff --git a/tests/api_resources/cdn/resources/test_rules.py b/tests/api_resources/cdn/resources/test_rules.py index 9fb7c8b6..63940c96 100644 --- a/tests/api_resources/cdn/resources/test_rules.py +++ b/tests/api_resources/cdn/resources/test_rules.py @@ -136,13 +136,13 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -277,7 +277,10 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -449,13 +452,13 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -590,7 +593,10 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -863,13 +869,13 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -1004,7 +1010,10 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -1185,13 +1194,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -1326,7 +1335,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -1498,13 +1510,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -1639,7 +1651,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -1912,13 +1927,13 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -2053,7 +2068,10 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, diff --git a/tests/api_resources/cdn/test_resources.py b/tests/api_resources/cdn/test_resources.py index 97602ddc..aecf0ca9 100644 --- a/tests/api_resources/cdn/test_resources.py +++ b/tests/api_resources/cdn/test_resources.py @@ -136,13 +136,13 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -281,7 +281,10 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -474,13 +477,13 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -619,7 +622,10 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -1100,13 +1106,13 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -1245,7 +1251,10 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -1443,13 +1452,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -1588,7 +1597,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -1781,13 +1793,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -1926,7 +1938,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -2407,13 +2422,13 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -2552,7 +2567,10 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, diff --git a/tests/api_resources/cdn/test_rule_templates.py b/tests/api_resources/cdn/test_rule_templates.py index 3ef7dd05..cf4af42c 100644 --- a/tests/api_resources/cdn/test_rule_templates.py +++ b/tests/api_resources/cdn/test_rule_templates.py @@ -132,13 +132,13 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -273,7 +273,10 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -437,13 +440,13 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -578,7 +581,10 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -833,13 +839,13 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -974,7 +980,10 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -1148,13 +1157,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -1289,7 +1298,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -1453,13 +1465,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -1594,7 +1606,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, @@ -1849,13 +1864,13 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> "enabled": True, }, "force_return": { - "body": "body", - "code": 100, + "body": "http://example.com/redirect_address", + "code": 301, "enabled": True, "time_interval": { - "end_time": "18:11:19.117Z", - "start_time": "18:11:19.117Z", - "time_zone": "Europe/Luxembourg", + "end_time": "20:00", + "start_time": "09:00", + "time_zone": "CET", }, }, "forward_host_header": { @@ -1990,7 +2005,10 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> }, "static_headers": { "enabled": True, - "value": {"foo": "string"}, + "value": { + "X-Example": "Value_1", + "X-Example-Multiple": ["Value_2", "Value_3"], + }, }, "static_request_headers": { "enabled": True, From f72a822d86cc8a4a1d2f4ea75fe8226621dde14a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Oct 2025 07:42:40 +0000 Subject: [PATCH 390/592] feat(client): add client opt for cloud polling timeout --- .stats.yml | 2 +- src/gcore/_client.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 13da14b8..63a9e108 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 607 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ef83e09553fcd2b3c5fb67d3fb7f49cfa58fd22b58df2666d4359490c31f6118.yml openapi_spec_hash: e560d8339290d758f459a6ea6ed16928 -config_hash: e0fc59326352d96367e9bb218de26276 +config_hash: 13185bfef4b2f58cecc5a3dba39a8c05 diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 4df8dcc0..d900f571 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -59,6 +59,7 @@ class Gcore(SyncAPIClient): cloud_project_id: int | None cloud_region_id: int | None cloud_polling_interval_seconds: int | None + cloud_polling_timeout_seconds: int | None def __init__( self, @@ -67,6 +68,7 @@ def __init__( cloud_project_id: int | None = None, cloud_region_id: int | None = None, cloud_polling_interval_seconds: int | None = 3, + cloud_polling_timeout_seconds: int | None = 7200, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, @@ -113,6 +115,10 @@ def __init__( cloud_polling_interval_seconds = 3 self.cloud_polling_interval_seconds = cloud_polling_interval_seconds + if cloud_polling_timeout_seconds is None: + cloud_polling_timeout_seconds = 7200 + self.cloud_polling_timeout_seconds = cloud_polling_timeout_seconds + if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") if base_url is None: @@ -168,6 +174,7 @@ def copy( cloud_project_id: int | None = None, cloud_region_id: int | None = None, cloud_polling_interval_seconds: int | None = None, + cloud_polling_timeout_seconds: int | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, @@ -205,6 +212,7 @@ def copy( cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, cloud_polling_interval_seconds=cloud_polling_interval_seconds or self.cloud_polling_interval_seconds, + cloud_polling_timeout_seconds=cloud_polling_timeout_seconds or self.cloud_polling_timeout_seconds, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, @@ -288,6 +296,7 @@ class AsyncGcore(AsyncAPIClient): cloud_project_id: int | None cloud_region_id: int | None cloud_polling_interval_seconds: int | None + cloud_polling_timeout_seconds: int | None def __init__( self, @@ -296,6 +305,7 @@ def __init__( cloud_project_id: int | None = None, cloud_region_id: int | None = None, cloud_polling_interval_seconds: int | None = 3, + cloud_polling_timeout_seconds: int | None = 7200, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, @@ -342,6 +352,10 @@ def __init__( cloud_polling_interval_seconds = 3 self.cloud_polling_interval_seconds = cloud_polling_interval_seconds + if cloud_polling_timeout_seconds is None: + cloud_polling_timeout_seconds = 7200 + self.cloud_polling_timeout_seconds = cloud_polling_timeout_seconds + if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") if base_url is None: @@ -397,6 +411,7 @@ def copy( cloud_project_id: int | None = None, cloud_region_id: int | None = None, cloud_polling_interval_seconds: int | None = None, + cloud_polling_timeout_seconds: int | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, @@ -434,6 +449,7 @@ def copy( cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, cloud_polling_interval_seconds=cloud_polling_interval_seconds or self.cloud_polling_interval_seconds, + cloud_polling_timeout_seconds=cloud_polling_timeout_seconds or self.cloud_polling_timeout_seconds, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, From 1a881b679e3559601b10547e65d5c85a9c38fead Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Oct 2025 08:37:12 +0000 Subject: [PATCH 391/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 63a9e108..236c162c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 607 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ef83e09553fcd2b3c5fb67d3fb7f49cfa58fd22b58df2666d4359490c31f6118.yml -openapi_spec_hash: e560d8339290d758f459a6ea6ed16928 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-4477a92293903ddc8cfef875c0656f452f8f103ca25805828cb05fe3a2ea177f.yml +openapi_spec_hash: e2dfa7cf4d9de97cb1a496220b6cb535 config_hash: 13185bfef4b2f58cecc5a3dba39a8c05 From d2bb4ba84aa49bba7ec1ab6338f7de8ea87ee4ac Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Oct 2025 08:51:36 +0000 Subject: [PATCH 392/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 236c162c..41c0c942 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 607 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-4477a92293903ddc8cfef875c0656f452f8f103ca25805828cb05fe3a2ea177f.yml -openapi_spec_hash: e2dfa7cf4d9de97cb1a496220b6cb535 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-56132999d4ac773438df4415a4bb56c8cf7f067c3c340d80424bf968074f66dc.yml +openapi_spec_hash: c33cea043ddbfe20778e0774313fa7e6 config_hash: 13185bfef4b2f58cecc5a3dba39a8c05 From c7a72493d7ce4eef1dd640a7654a7985aeab21ae Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Oct 2025 10:19:36 +0000 Subject: [PATCH 393/592] refactor(spec): remove CDN deprecated endpoints --- .stats.yml | 2 +- api.md | 4 ++-- src/gcore/resources/cdn/cdn.py | 16 ++++++++-------- src/gcore/resources/cdn/{logs => }/logs.py | 18 +++++++++--------- src/gcore/resources/cdn/logs/__init__.py | 19 ------------------- src/gcore/types/cdn/logs/__init__.py | 3 --- tests/api_resources/cdn/logs/__init__.py | 1 - 7 files changed, 20 insertions(+), 43 deletions(-) rename src/gcore/resources/cdn/{logs => }/logs.py (99%) delete mode 100644 src/gcore/resources/cdn/logs/__init__.py delete mode 100644 src/gcore/types/cdn/logs/__init__.py delete mode 100644 tests/api_resources/cdn/logs/__init__.py diff --git a/.stats.yml b/.stats.yml index 41c0c942..2cb98a5a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 607 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-56132999d4ac773438df4415a4bb56c8cf7f067c3c340d80424bf968074f66dc.yml openapi_spec_hash: c33cea043ddbfe20778e0774313fa7e6 -config_hash: 13185bfef4b2f58cecc5a3dba39a8c05 +config_hash: e9817aca06ab90c1d5249560a1a300b8 diff --git a/api.md b/api.md index 32c6564e..395f4890 100644 --- a/api.md +++ b/api.md @@ -2247,8 +2247,8 @@ from gcore.types.cdn import CdnLogEntry Methods: -- client.cdn.logs.list(\*\*params) -> SyncOffsetPageCdnLogs[Data] -- client.cdn.logs.download(\*\*params) -> BinaryAPIResponse +- client.cdn.logs.list(\*\*params) -> SyncOffsetPageCdnLogs[Data] +- client.cdn.logs.download(\*\*params) -> BinaryAPIResponse ## LogsUploader diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py index 152610ba..0bcaad80 100644 --- a/src/gcore/resources/cdn/cdn.py +++ b/src/gcore/resources/cdn/cdn.py @@ -4,6 +4,14 @@ import httpx +from .logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) from .metrics import ( MetricsResource, AsyncMetricsResource, @@ -39,14 +47,6 @@ IPRangesResourceWithStreamingResponse, AsyncIPRangesResourceWithStreamingResponse, ) -from .logs.logs import ( - LogsResource, - AsyncLogsResource, - LogsResourceWithRawResponse, - AsyncLogsResourceWithRawResponse, - LogsResourceWithStreamingResponse, - AsyncLogsResourceWithStreamingResponse, -) from .statistics import ( StatisticsResource, AsyncStatisticsResource, diff --git a/src/gcore/resources/cdn/logs/logs.py b/src/gcore/resources/cdn/logs.py similarity index 99% rename from src/gcore/resources/cdn/logs/logs.py rename to src/gcore/resources/cdn/logs.py index 4a03bc86..7520c6dd 100644 --- a/src/gcore/resources/cdn/logs/logs.py +++ b/src/gcore/resources/cdn/logs.py @@ -4,11 +4,11 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( BinaryAPIResponse, AsyncBinaryAPIResponse, StreamedBinaryAPIResponse, @@ -22,10 +22,10 @@ async_to_custom_raw_response_wrapper, async_to_custom_streamed_response_wrapper, ) -from ....types.cdn import log_list_params, log_download_params -from ....pagination import SyncOffsetPageCdnLogs, AsyncOffsetPageCdnLogs -from ...._base_client import AsyncPaginator, make_request_options -from ....types.cdn.cdn_log_entry import Data +from ...types.cdn import log_list_params, log_download_params +from ...pagination import SyncOffsetPageCdnLogs, AsyncOffsetPageCdnLogs +from ..._base_client import AsyncPaginator, make_request_options +from ...types.cdn.cdn_log_entry import Data __all__ = ["LogsResource", "AsyncLogsResource"] diff --git a/src/gcore/resources/cdn/logs/__init__.py b/src/gcore/resources/cdn/logs/__init__.py deleted file mode 100644 index 30876fab..00000000 --- a/src/gcore/resources/cdn/logs/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .logs import ( - LogsResource, - AsyncLogsResource, - LogsResourceWithRawResponse, - AsyncLogsResourceWithRawResponse, - LogsResourceWithStreamingResponse, - AsyncLogsResourceWithStreamingResponse, -) - -__all__ = [ - "LogsResource", - "AsyncLogsResource", - "LogsResourceWithRawResponse", - "AsyncLogsResourceWithRawResponse", - "LogsResourceWithStreamingResponse", - "AsyncLogsResourceWithStreamingResponse", -] diff --git a/src/gcore/types/cdn/logs/__init__.py b/src/gcore/types/cdn/logs/__init__.py deleted file mode 100644 index f8ee8b14..00000000 --- a/src/gcore/types/cdn/logs/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations diff --git a/tests/api_resources/cdn/logs/__init__.py b/tests/api_resources/cdn/logs/__init__.py deleted file mode 100644 index fd8019a9..00000000 --- a/tests/api_resources/cdn/logs/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. From 6f98b7404a1d49f3c57c775a6919f1a5b6690c1b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Oct 2025 10:58:47 +0000 Subject: [PATCH 394/592] feat(cdn): add methods to list aws and alibaba regions --- .stats.yml | 4 +- api.md | 14 +- src/gcore/resources/cdn/cdn.py | 125 ++++++++++++++++-- src/gcore/types/cdn/__init__.py | 3 + src/gcore/types/cdn/alibaba_regions.py | 22 +++ src/gcore/types/cdn/aws_regions.py | 22 +++ .../cdn/cdn_list_purge_statuses_response.py | 10 ++ tests/api_resources/test_cdn.py | 121 +++++++++++++++-- 8 files changed, 294 insertions(+), 27 deletions(-) create mode 100644 src/gcore/types/cdn/alibaba_regions.py create mode 100644 src/gcore/types/cdn/aws_regions.py create mode 100644 src/gcore/types/cdn/cdn_list_purge_statuses_response.py diff --git a/.stats.yml b/.stats.yml index 2cb98a5a..fd2d5539 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 607 +configured_endpoints: 609 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-56132999d4ac773438df4415a4bb56c8cf7f067c3c340d80424bf968074f66dc.yml openapi_spec_hash: c33cea043ddbfe20778e0774313fa7e6 -config_hash: e9817aca06ab90c1d5249560a1a300b8 +config_hash: bb4a27712c30f7a2b52e1f3b31766f24 diff --git a/api.md b/api.md index 395f4890..01ab7916 100644 --- a/api.md +++ b/api.md @@ -2082,7 +2082,15 @@ Methods: Types: ```python -from gcore.types.cdn import CdnAccount, CdnAccountLimits, CdnAvailableFeatures, PurgeStatus +from gcore.types.cdn import ( + AlibabaRegions, + AwsRegions, + CdnAccount, + CdnAccountLimits, + CdnAvailableFeatures, + PurgeStatus, + CdnListPurgeStatusesResponse, +) ``` Methods: @@ -2090,7 +2098,9 @@ Methods: - client.cdn.get_account_limits() -> CdnAccountLimits - client.cdn.get_account_overview() -> CdnAccount - client.cdn.get_available_features() -> CdnAvailableFeatures -- client.cdn.list_purge_statuses(\*\*params) -> SyncOffsetPageCdn[PurgeStatus] +- client.cdn.list_alibaba_regions() -> AlibabaRegions +- client.cdn.list_aws_regions() -> AwsRegions +- client.cdn.list_purge_statuses(\*\*params) -> CdnListPurgeStatusesResponse - client.cdn.update_account(\*\*params) -> CdnAccount ## Resources diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py index 0bcaad80..c08f226c 100644 --- a/src/gcore/resources/cdn/cdn.py +++ b/src/gcore/resources/cdn/cdn.py @@ -63,7 +63,6 @@ async_to_streamed_response_wrapper, ) from ...types.cdn import cdn_update_account_params, cdn_list_purge_statuses_params -from ...pagination import SyncOffsetPageCdn, AsyncOffsetPageCdn from .certificates import ( CertificatesResource, AsyncCertificatesResource, @@ -80,7 +79,7 @@ OriginGroupsResourceWithStreamingResponse, AsyncOriginGroupsResourceWithStreamingResponse, ) -from ..._base_client import AsyncPaginator, make_request_options +from ..._base_client import make_request_options from .rule_templates import ( RuleTemplatesResource, AsyncRuleTemplatesResource, @@ -105,6 +104,7 @@ ResourcesResourceWithStreamingResponse, AsyncResourcesResourceWithStreamingResponse, ) +from ...types.cdn.aws_regions import AwsRegions from ...types.cdn.cdn_account import CdnAccount from .trusted_ca_certificates import ( TrustedCaCertificatesResource, @@ -114,7 +114,7 @@ TrustedCaCertificatesResourceWithStreamingResponse, AsyncTrustedCaCertificatesResourceWithStreamingResponse, ) -from ...types.cdn.purge_status import PurgeStatus +from ...types.cdn.alibaba_regions import AlibabaRegions from .logs_uploader.logs_uploader import ( LogsUploaderResource, AsyncLogsUploaderResource, @@ -125,6 +125,7 @@ ) from ...types.cdn.cdn_account_limits import CdnAccountLimits from ...types.cdn.cdn_available_features import CdnAvailableFeatures +from ...types.cdn.cdn_list_purge_statuses_response import CdnListPurgeStatusesResponse __all__ = ["CdnResource", "AsyncCdnResource"] @@ -258,6 +259,44 @@ def get_available_features( cast_to=CdnAvailableFeatures, ) + def list_alibaba_regions( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AlibabaRegions: + """Get the list of Alibaba Cloud regions.""" + return self._get( + "/cdn/alibaba_regions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AlibabaRegions, + ) + + def list_aws_regions( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AwsRegions: + """Get the list of Amazon AWS regions.""" + return self._get( + "/cdn/aws_regions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AwsRegions, + ) + def list_purge_statuses( self, *, @@ -274,7 +313,7 @@ def list_purge_statuses( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncOffsetPageCdn[PurgeStatus]: + ) -> CdnListPurgeStatusesResponse: """ Get purges history. @@ -330,9 +369,8 @@ def list_purge_statuses( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + return self._get( "/cdn/purge_statuses", - page=SyncOffsetPageCdn[PurgeStatus], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -351,7 +389,7 @@ def list_purge_statuses( cdn_list_purge_statuses_params.CdnListPurgeStatusesParams, ), ), - model=PurgeStatus, + cast_to=CdnListPurgeStatusesResponse, ) def update_account( @@ -522,7 +560,45 @@ async def get_available_features( cast_to=CdnAvailableFeatures, ) - def list_purge_statuses( + async def list_alibaba_regions( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AlibabaRegions: + """Get the list of Alibaba Cloud regions.""" + return await self._get( + "/cdn/alibaba_regions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AlibabaRegions, + ) + + async def list_aws_regions( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AwsRegions: + """Get the list of Amazon AWS regions.""" + return await self._get( + "/cdn/aws_regions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AwsRegions, + ) + + async def list_purge_statuses( self, *, cname: str | Omit = omit, @@ -538,7 +614,7 @@ def list_purge_statuses( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[PurgeStatus, AsyncOffsetPageCdn[PurgeStatus]]: + ) -> CdnListPurgeStatusesResponse: """ Get purges history. @@ -594,15 +670,14 @@ def list_purge_statuses( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + return await self._get( "/cdn/purge_statuses", - page=AsyncOffsetPageCdn[PurgeStatus], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform( + query=await async_maybe_transform( { "cname": cname, "from_created": from_created, @@ -615,7 +690,7 @@ def list_purge_statuses( cdn_list_purge_statuses_params.CdnListPurgeStatusesParams, ), ), - model=PurgeStatus, + cast_to=CdnListPurgeStatusesResponse, ) async def update_account( @@ -670,6 +745,12 @@ def __init__(self, cdn: CdnResource) -> None: self.get_available_features = to_raw_response_wrapper( cdn.get_available_features, ) + self.list_alibaba_regions = to_raw_response_wrapper( + cdn.list_alibaba_regions, + ) + self.list_aws_regions = to_raw_response_wrapper( + cdn.list_aws_regions, + ) self.list_purge_statuses = to_raw_response_wrapper( cdn.list_purge_statuses, ) @@ -743,6 +824,12 @@ def __init__(self, cdn: AsyncCdnResource) -> None: self.get_available_features = async_to_raw_response_wrapper( cdn.get_available_features, ) + self.list_alibaba_regions = async_to_raw_response_wrapper( + cdn.list_alibaba_regions, + ) + self.list_aws_regions = async_to_raw_response_wrapper( + cdn.list_aws_regions, + ) self.list_purge_statuses = async_to_raw_response_wrapper( cdn.list_purge_statuses, ) @@ -816,6 +903,12 @@ def __init__(self, cdn: CdnResource) -> None: self.get_available_features = to_streamed_response_wrapper( cdn.get_available_features, ) + self.list_alibaba_regions = to_streamed_response_wrapper( + cdn.list_alibaba_regions, + ) + self.list_aws_regions = to_streamed_response_wrapper( + cdn.list_aws_regions, + ) self.list_purge_statuses = to_streamed_response_wrapper( cdn.list_purge_statuses, ) @@ -889,6 +982,12 @@ def __init__(self, cdn: AsyncCdnResource) -> None: self.get_available_features = async_to_streamed_response_wrapper( cdn.get_available_features, ) + self.list_alibaba_regions = async_to_streamed_response_wrapper( + cdn.list_alibaba_regions, + ) + self.list_aws_regions = async_to_streamed_response_wrapper( + cdn.list_aws_regions, + ) self.list_purge_statuses = async_to_streamed_response_wrapper( cdn.list_purge_statuses, ) diff --git a/src/gcore/types/cdn/__init__.py b/src/gcore/types/cdn/__init__.py index 66a8669b..ebb15cf3 100644 --- a/src/gcore/types/cdn/__init__.py +++ b/src/gcore/types/cdn/__init__.py @@ -3,6 +3,7 @@ from __future__ import annotations from .ssl_detail import SslDetail as SslDetail +from .aws_regions import AwsRegions as AwsRegions from .cdn_account import CdnAccount as CdnAccount from .cdn_metrics import CdnMetrics as CdnMetrics from .cdn_resource import CdnResource as CdnResource @@ -12,6 +13,7 @@ from .rule_template import RuleTemplate as RuleTemplate from .ca_certificate import CaCertificate as CaCertificate from .public_ip_list import PublicIPList as PublicIPList +from .alibaba_regions import AlibabaRegions as AlibabaRegions from .log_list_params import LogListParams as LogListParams from .ssl_detail_list import SslDetailList as SslDetailList from .network_capacity import NetworkCapacity as NetworkCapacity @@ -55,6 +57,7 @@ from .rule_template_replace_params import RuleTemplateReplaceParams as RuleTemplateReplaceParams from .certificate_get_status_params import CertificateGetStatusParams as CertificateGetStatusParams from .cdn_list_purge_statuses_params import CdnListPurgeStatusesParams as CdnListPurgeStatusesParams +from .cdn_list_purge_statuses_response import CdnListPurgeStatusesResponse as CdnListPurgeStatusesResponse from .trusted_ca_certificate_list_params import TrustedCaCertificateListParams as TrustedCaCertificateListParams from .trusted_ca_certificate_create_params import TrustedCaCertificateCreateParams as TrustedCaCertificateCreateParams from .trusted_ca_certificate_replace_params import ( diff --git a/src/gcore/types/cdn/alibaba_regions.py b/src/gcore/types/cdn/alibaba_regions.py new file mode 100644 index 00000000..8be22234 --- /dev/null +++ b/src/gcore/types/cdn/alibaba_regions.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["AlibabaRegions", "AlibabaRegionItem"] + + +class AlibabaRegionItem(BaseModel): + id: Optional[int] = None + """Region ID.""" + + code: Optional[str] = None + """Region code.""" + + name: Optional[str] = None + """Region name.""" + + +AlibabaRegions: TypeAlias = List[AlibabaRegionItem] diff --git a/src/gcore/types/cdn/aws_regions.py b/src/gcore/types/cdn/aws_regions.py new file mode 100644 index 00000000..0dccf9b9 --- /dev/null +++ b/src/gcore/types/cdn/aws_regions.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["AwsRegions", "AwsRegionItem"] + + +class AwsRegionItem(BaseModel): + id: Optional[int] = None + """Region ID.""" + + code: Optional[str] = None + """Region code.""" + + name: Optional[str] = None + """Region name.""" + + +AwsRegions: TypeAlias = List[AwsRegionItem] diff --git a/src/gcore/types/cdn/cdn_list_purge_statuses_response.py b/src/gcore/types/cdn/cdn_list_purge_statuses_response.py new file mode 100644 index 00000000..1dec8100 --- /dev/null +++ b/src/gcore/types/cdn/cdn_list_purge_statuses_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .purge_status import PurgeStatus + +__all__ = ["CdnListPurgeStatusesResponse"] + +CdnListPurgeStatusesResponse: TypeAlias = List[PurgeStatus] diff --git a/tests/api_resources/test_cdn.py b/tests/api_resources/test_cdn.py index 8e256e1f..97c7b598 100644 --- a/tests/api_resources/test_cdn.py +++ b/tests/api_resources/test_cdn.py @@ -10,12 +10,13 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.cdn import ( + AwsRegions, CdnAccount, - PurgeStatus, + AlibabaRegions, CdnAccountLimits, CdnAvailableFeatures, + CdnListPurgeStatusesResponse, ) -from gcore.pagination import SyncOffsetPageCdn, AsyncOffsetPageCdn base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -98,10 +99,60 @@ def test_streaming_response_get_available_features(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_list_alibaba_regions(self, client: Gcore) -> None: + cdn = client.cdn.list_alibaba_regions() + assert_matches_type(AlibabaRegions, cdn, path=["response"]) + + @parametrize + def test_raw_response_list_alibaba_regions(self, client: Gcore) -> None: + response = client.cdn.with_raw_response.list_alibaba_regions() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = response.parse() + assert_matches_type(AlibabaRegions, cdn, path=["response"]) + + @parametrize + def test_streaming_response_list_alibaba_regions(self, client: Gcore) -> None: + with client.cdn.with_streaming_response.list_alibaba_regions() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = response.parse() + assert_matches_type(AlibabaRegions, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_aws_regions(self, client: Gcore) -> None: + cdn = client.cdn.list_aws_regions() + assert_matches_type(AwsRegions, cdn, path=["response"]) + + @parametrize + def test_raw_response_list_aws_regions(self, client: Gcore) -> None: + response = client.cdn.with_raw_response.list_aws_regions() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = response.parse() + assert_matches_type(AwsRegions, cdn, path=["response"]) + + @parametrize + def test_streaming_response_list_aws_regions(self, client: Gcore) -> None: + with client.cdn.with_streaming_response.list_aws_regions() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = response.parse() + assert_matches_type(AwsRegions, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_list_purge_statuses(self, client: Gcore) -> None: cdn = client.cdn.list_purge_statuses() - assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) @parametrize def test_method_list_purge_statuses_with_all_params(self, client: Gcore) -> None: @@ -114,7 +165,7 @@ def test_method_list_purge_statuses_with_all_params(self, client: Gcore) -> None status="status", to_created="to_created", ) - assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) @parametrize def test_raw_response_list_purge_statuses(self, client: Gcore) -> None: @@ -123,7 +174,7 @@ def test_raw_response_list_purge_statuses(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = response.parse() - assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) @parametrize def test_streaming_response_list_purge_statuses(self, client: Gcore) -> None: @@ -132,7 +183,7 @@ def test_streaming_response_list_purge_statuses(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = response.parse() - assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) assert cast(Any, response.is_closed) is True @@ -249,10 +300,60 @@ async def test_streaming_response_get_available_features(self, async_client: Asy assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_list_alibaba_regions(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.list_alibaba_regions() + assert_matches_type(AlibabaRegions, cdn, path=["response"]) + + @parametrize + async def test_raw_response_list_alibaba_regions(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.with_raw_response.list_alibaba_regions() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = await response.parse() + assert_matches_type(AlibabaRegions, cdn, path=["response"]) + + @parametrize + async def test_streaming_response_list_alibaba_regions(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.with_streaming_response.list_alibaba_regions() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = await response.parse() + assert_matches_type(AlibabaRegions, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_aws_regions(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.list_aws_regions() + assert_matches_type(AwsRegions, cdn, path=["response"]) + + @parametrize + async def test_raw_response_list_aws_regions(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.with_raw_response.list_aws_regions() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = await response.parse() + assert_matches_type(AwsRegions, cdn, path=["response"]) + + @parametrize + async def test_streaming_response_list_aws_regions(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.with_streaming_response.list_aws_regions() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = await response.parse() + assert_matches_type(AwsRegions, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_list_purge_statuses(self, async_client: AsyncGcore) -> None: cdn = await async_client.cdn.list_purge_statuses() - assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) @parametrize async def test_method_list_purge_statuses_with_all_params(self, async_client: AsyncGcore) -> None: @@ -265,7 +366,7 @@ async def test_method_list_purge_statuses_with_all_params(self, async_client: As status="status", to_created="to_created", ) - assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) @parametrize async def test_raw_response_list_purge_statuses(self, async_client: AsyncGcore) -> None: @@ -274,7 +375,7 @@ async def test_raw_response_list_purge_statuses(self, async_client: AsyncGcore) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = await response.parse() - assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) @parametrize async def test_streaming_response_list_purge_statuses(self, async_client: AsyncGcore) -> None: @@ -283,7 +384,7 @@ async def test_streaming_response_list_purge_statuses(self, async_client: AsyncG assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = await response.parse() - assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) assert cast(Any, response.is_closed) is True From 2ace075c817be269b35f607e441daa68eda08c85 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Oct 2025 21:26:10 +0000 Subject: [PATCH 395/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b4e9013b..6db19b95 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.16.0" + ".": "0.17.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 95e2f724..104cc67c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.16.0" +version = "0.17.0" description = "The official Python library for the gcore API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/gcore/_version.py b/src/gcore/_version.py index a0186b0a..4e59998e 100644 --- a/src/gcore/_version.py +++ b/src/gcore/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "gcore" -__version__ = "0.16.0" # x-release-please-version +__version__ = "0.17.0" # x-release-please-version From 3f121eba606e627c6a8cb251d47d31a617f47cdd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Oct 2025 08:49:18 +0000 Subject: [PATCH 396/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 4 +- src/gcore/resources/cdn/ip_ranges.py | 102 +++++++++++++++- src/gcore/resources/cdn/statistics.py | 114 +++++++++--------- src/gcore/resources/cloud/quotas/requests.py | 8 -- src/gcore/types/cdn/__init__.py | 2 + .../types/cdn/ip_range_list_ips_params.py | 19 +++ src/gcore/types/cdn/ip_range_list_params.py | 19 +++ src/gcore/types/cdn/resource_usage_stats.py | 31 ++--- ...tistic_get_logs_usage_aggregated_params.py | 5 +- .../statistic_get_logs_usage_series_params.py | 17 +-- ...ic_get_resource_usage_aggregated_params.py | 31 ++--- ...tistic_get_resource_usage_series_params.py | 7 +- ...stic_get_shield_usage_aggregated_params.py | 7 +- ...tatistic_get_shield_usage_series_params.py | 3 + .../cloud/quotas/request_create_params.py | 3 - src/gcore/types/cloud/security_group.py | 9 +- tests/api_resources/cdn/test_ip_ranges.py | 32 +++++ .../cloud/quotas/test_requests.py | 2 - 19 files changed, 286 insertions(+), 133 deletions(-) create mode 100644 src/gcore/types/cdn/ip_range_list_ips_params.py create mode 100644 src/gcore/types/cdn/ip_range_list_params.py diff --git a/.stats.yml b/.stats.yml index fd2d5539..c8537dbe 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-56132999d4ac773438df4415a4bb56c8cf7f067c3c340d80424bf968074f66dc.yml -openapi_spec_hash: c33cea043ddbfe20778e0774313fa7e6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-593c5e99888d61f0b89a96221b71679316ae326fe0bf7468d93a3f4d73d06e8c.yml +openapi_spec_hash: cfd6560b017a4ff1d003e335b739f2f3 config_hash: bb4a27712c30f7a2b52e1f3b31766f24 diff --git a/api.md b/api.md index 01ab7916..8904e330 100644 --- a/api.md +++ b/api.md @@ -2383,5 +2383,5 @@ from gcore.types.cdn import PublicIPList, PublicNetworkList Methods: -- client.cdn.ip_ranges.list() -> PublicNetworkList -- client.cdn.ip_ranges.list_ips() -> PublicIPList +- client.cdn.ip_ranges.list(\*\*params) -> PublicNetworkList +- client.cdn.ip_ranges.list_ips(\*\*params) -> PublicIPList diff --git a/src/gcore/resources/cdn/ip_ranges.py b/src/gcore/resources/cdn/ip_ranges.py index 606e9b83..ee39f4a9 100644 --- a/src/gcore/resources/cdn/ip_ranges.py +++ b/src/gcore/resources/cdn/ip_ranges.py @@ -2,9 +2,12 @@ from __future__ import annotations +from typing_extensions import Literal + import httpx -from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -13,6 +16,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) +from ...types.cdn import ip_range_list_params, ip_range_list_ips_params from ..._base_client import make_request_options from ...types.cdn.public_ip_list import PublicIPList from ...types.cdn.public_network_list import PublicNetworkList @@ -43,6 +47,8 @@ def with_streaming_response(self) -> IPRangesResourceWithStreamingResponse: def list( self, *, + format: Literal["json", "plain"] | Omit = omit, + accept: Literal["application/json", "text/plain"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -58,11 +64,31 @@ def list( relevance. We recommend using a script for automatically update IP ACL. This request does not require authorization. + + Args: + format: Optional format override. When set, this takes precedence over the `Accept` + header. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds """ + extra_headers = { + **strip_not_given({"Accept": str(accept) if is_given(accept) else not_given}), + **(extra_headers or {}), + } return self._get( "/cdn/public-net-list", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"format": format}, ip_range_list_params.IPRangeListParams), ), cast_to=PublicNetworkList, ) @@ -70,6 +96,8 @@ def list( def list_ips( self, *, + format: Literal["json", "plain"] | Omit = omit, + accept: Literal["application/json", "text/plain"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -86,11 +114,31 @@ def list_ips( relevance. We recommend using a script to automatically update IP ACL. This request does not require authorization. + + Args: + format: Optional format override. When set, this takes precedence over the `Accept` + header. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds """ + extra_headers = { + **strip_not_given({"Accept": str(accept) if is_given(accept) else not_given}), + **(extra_headers or {}), + } return self._get( "/cdn/public-ip-list", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"format": format}, ip_range_list_ips_params.IPRangeListIPsParams), ), cast_to=PublicIPList, ) @@ -119,6 +167,8 @@ def with_streaming_response(self) -> AsyncIPRangesResourceWithStreamingResponse: async def list( self, *, + format: Literal["json", "plain"] | Omit = omit, + accept: Literal["application/json", "text/plain"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -134,11 +184,31 @@ async def list( relevance. We recommend using a script for automatically update IP ACL. This request does not require authorization. + + Args: + format: Optional format override. When set, this takes precedence over the `Accept` + header. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds """ + extra_headers = { + **strip_not_given({"Accept": str(accept) if is_given(accept) else not_given}), + **(extra_headers or {}), + } return await self._get( "/cdn/public-net-list", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"format": format}, ip_range_list_params.IPRangeListParams), ), cast_to=PublicNetworkList, ) @@ -146,6 +216,8 @@ async def list( async def list_ips( self, *, + format: Literal["json", "plain"] | Omit = omit, + accept: Literal["application/json", "text/plain"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -162,11 +234,31 @@ async def list_ips( relevance. We recommend using a script to automatically update IP ACL. This request does not require authorization. + + Args: + format: Optional format override. When set, this takes precedence over the `Accept` + header. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds """ + extra_headers = { + **strip_not_given({"Accept": str(accept) if is_given(accept) else not_given}), + **(extra_headers or {}), + } return await self._get( "/cdn/public-ip-list", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"format": format}, ip_range_list_ips_params.IPRangeListIPsParams), ), cast_to=PublicIPList, ) diff --git a/src/gcore/resources/cdn/statistics.py b/src/gcore/resources/cdn/statistics.py index 14f2fa8c..0e6a32a6 100644 --- a/src/gcore/resources/cdn/statistics.py +++ b/src/gcore/resources/cdn/statistics.py @@ -77,7 +77,7 @@ def get_logs_usage_aggregated( to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) - flat: The waу parameters are arranged in the response. + flat: The way the parameters are arranged in the response. Possible values: @@ -96,6 +96,9 @@ def get_logs_usage_aggregated( - &resource=1&resource=2 + If CDN resource ID is not specified, data related to all CDN resources is + returned. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -146,22 +149,17 @@ def get_logs_usage_series( Args: from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) - Example: - - - &from=2020-01-01T00:00:00.000 - to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) - Example: - - - &from=2020-01-01T00:00:00.000 - resource: CDN resources IDs by that statistics data is grouped. To request multiple values, use: - &resource=1&resource=2 + If CDN resource ID is not specified, data related to all CDN resources is + returned. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -218,11 +216,6 @@ def get_resource_usage_aggregated( Args: from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) - Examples: - - - &from=2018-11-01T00:00:00.000 - - &from=2018-11-01 - metrics: Types of statistics data. Possible values: @@ -279,15 +272,8 @@ def get_resource_usage_aggregated( to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) - Examples: - - - &to=2018-11-01T00:00:00.000 - - &to=2018-11-01 - - countries: Names of countries for which data is displayed. - - English short name from [ISO 3166 standard][1] without the definite article - "the" should be used. + countries: Names of countries for which data should be displayed. English short name from + [ISO 3166 standard][1] without the definite article ("the") should be used. [1]: https://www.iso.org/obp/ui/#search/code/ @@ -295,7 +281,7 @@ def get_resource_usage_aggregated( - &countries=france&countries=denmark - flat: The waу the parameters are arranged in the response. + flat: The way the parameters are arranged in the response. Possible values: @@ -309,7 +295,9 @@ def get_resource_usage_aggregated( - **resource** – Data is grouped by CDN resources IDs. - **region** – Data is grouped by regions of CDN edge servers. - **country** – Data is grouped by countries of CDN edge servers. - - **vhost** – Data is grouped by resources CNAME. + - **vhost** – Data is grouped by resources CNAMEs. + - **`client_country`** - Data is grouped by countries, based on end-users' + location. To request multiple values, use: @@ -329,7 +317,7 @@ def get_resource_usage_aggregated( - **africa** - Africa - **sa** - South America - resource: CDN resources IDs by which statistics data is grouped. + resource: CDN resources IDs by that statistics data is grouped. To request multiple values, use: @@ -472,6 +460,8 @@ def get_resource_usage_series( - **region** – Data is grouped by regions of CDN edge servers. - **country** – Data is grouped by countries of CDN edge servers. - **vhost** – Data is grouped by resources CNAMEs. + - **`client_country`** - Data is grouped by countries, based on end-users' + location. To request multiple values, use: @@ -491,12 +481,15 @@ def get_resource_usage_series( - **africa** - Africa - **sa** - South America - resource: CDN resource IDs. + resource: CDN resources IDs by that statistics data is grouped. To request multiple values, use: - &resource=1&resource=2 + If CDN resource ID is not specified, data related to all CDN resources is + returned. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -555,7 +548,7 @@ def get_shield_usage_aggregated( to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) - flat: The waу parameters are arranged in the response. + flat: The way the parameters are arranged in the response. Possible values: @@ -566,7 +559,7 @@ def get_shield_usage_aggregated( Possible value: - - **resource** - Data is grouped by CDN resource. + - **resource** - Data is grouped by CDN resources. resource: CDN resources IDs by that statistics data is grouped. @@ -574,6 +567,9 @@ def get_shield_usage_aggregated( - &resource=1&resource=2 + If CDN resource ID is not specified, data related to all CDN resources is + returned. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -632,6 +628,9 @@ def get_shield_usage_series( - &resource=1&resource=2 + If CDN resource ID is not specified, data related to all CDN resources is + returned. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -705,7 +704,7 @@ async def get_logs_usage_aggregated( to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) - flat: The waу parameters are arranged in the response. + flat: The way the parameters are arranged in the response. Possible values: @@ -724,6 +723,9 @@ async def get_logs_usage_aggregated( - &resource=1&resource=2 + If CDN resource ID is not specified, data related to all CDN resources is + returned. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -774,22 +776,17 @@ async def get_logs_usage_series( Args: from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) - Example: - - - &from=2020-01-01T00:00:00.000 - to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) - Example: - - - &from=2020-01-01T00:00:00.000 - resource: CDN resources IDs by that statistics data is grouped. To request multiple values, use: - &resource=1&resource=2 + If CDN resource ID is not specified, data related to all CDN resources is + returned. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -846,11 +843,6 @@ async def get_resource_usage_aggregated( Args: from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) - Examples: - - - &from=2018-11-01T00:00:00.000 - - &from=2018-11-01 - metrics: Types of statistics data. Possible values: @@ -907,15 +899,8 @@ async def get_resource_usage_aggregated( to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) - Examples: - - - &to=2018-11-01T00:00:00.000 - - &to=2018-11-01 - - countries: Names of countries for which data is displayed. - - English short name from [ISO 3166 standard][1] without the definite article - "the" should be used. + countries: Names of countries for which data should be displayed. English short name from + [ISO 3166 standard][1] without the definite article ("the") should be used. [1]: https://www.iso.org/obp/ui/#search/code/ @@ -923,7 +908,7 @@ async def get_resource_usage_aggregated( - &countries=france&countries=denmark - flat: The waу the parameters are arranged in the response. + flat: The way the parameters are arranged in the response. Possible values: @@ -937,7 +922,9 @@ async def get_resource_usage_aggregated( - **resource** – Data is grouped by CDN resources IDs. - **region** – Data is grouped by regions of CDN edge servers. - **country** – Data is grouped by countries of CDN edge servers. - - **vhost** – Data is grouped by resources CNAME. + - **vhost** – Data is grouped by resources CNAMEs. + - **`client_country`** - Data is grouped by countries, based on end-users' + location. To request multiple values, use: @@ -957,7 +944,7 @@ async def get_resource_usage_aggregated( - **africa** - Africa - **sa** - South America - resource: CDN resources IDs by which statistics data is grouped. + resource: CDN resources IDs by that statistics data is grouped. To request multiple values, use: @@ -1100,6 +1087,8 @@ async def get_resource_usage_series( - **region** – Data is grouped by regions of CDN edge servers. - **country** – Data is grouped by countries of CDN edge servers. - **vhost** – Data is grouped by resources CNAMEs. + - **`client_country`** - Data is grouped by countries, based on end-users' + location. To request multiple values, use: @@ -1119,12 +1108,15 @@ async def get_resource_usage_series( - **africa** - Africa - **sa** - South America - resource: CDN resource IDs. + resource: CDN resources IDs by that statistics data is grouped. To request multiple values, use: - &resource=1&resource=2 + If CDN resource ID is not specified, data related to all CDN resources is + returned. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1183,7 +1175,7 @@ async def get_shield_usage_aggregated( to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) - flat: The waу parameters are arranged in the response. + flat: The way the parameters are arranged in the response. Possible values: @@ -1194,7 +1186,7 @@ async def get_shield_usage_aggregated( Possible value: - - **resource** - Data is grouped by CDN resource. + - **resource** - Data is grouped by CDN resources. resource: CDN resources IDs by that statistics data is grouped. @@ -1202,6 +1194,9 @@ async def get_shield_usage_aggregated( - &resource=1&resource=2 + If CDN resource ID is not specified, data related to all CDN resources is + returned. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1260,6 +1255,9 @@ async def get_shield_usage_series( - &resource=1&resource=2 + If CDN resource ID is not specified, data related to all CDN resources is + returned. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 6857110a..5d778e27 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -51,7 +51,6 @@ def create( *, description: str, requested_limits: request_create_params.RequestedLimits, - client_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -67,8 +66,6 @@ def create( requested_limits: Limits you want to increase. - client_id: Client ID that requests the limit increase. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -84,7 +81,6 @@ def create( { "description": description, "requested_limits": requested_limits, - "client_id": client_id, }, request_create_params.RequestCreateParams, ), @@ -239,7 +235,6 @@ async def create( *, description: str, requested_limits: request_create_params.RequestedLimits, - client_id: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -255,8 +250,6 @@ async def create( requested_limits: Limits you want to increase. - client_id: Client ID that requests the limit increase. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -272,7 +265,6 @@ async def create( { "description": description, "requested_limits": requested_limits, - "client_id": client_id, }, request_create_params.RequestCreateParams, ), diff --git a/src/gcore/types/cdn/__init__.py b/src/gcore/types/cdn/__init__.py index ebb15cf3..8cd6fefc 100644 --- a/src/gcore/types/cdn/__init__.py +++ b/src/gcore/types/cdn/__init__.py @@ -30,6 +30,7 @@ from .cdn_audit_log_entry import CdnAuditLogEntry as CdnAuditLogEntry from .log_download_params import LogDownloadParams as LogDownloadParams from .public_network_list import PublicNetworkList as PublicNetworkList +from .ip_range_list_params import IPRangeListParams as IPRangeListParams from .resource_list_params import ResourceListParams as ResourceListParams from .resource_usage_stats import ResourceUsageStats as ResourceUsageStats from .shield_list_response import ShieldListResponse as ShieldListResponse @@ -42,6 +43,7 @@ from .certificate_list_params import CertificateListParams as CertificateListParams from .resource_replace_params import ResourceReplaceParams as ResourceReplaceParams from .shield_aggregated_stats import ShieldAggregatedStats as ShieldAggregatedStats +from .ip_range_list_ips_params import IPRangeListIPsParams as IPRangeListIPsParams from .logs_uploader_validation import LogsUploaderValidation as LogsUploaderValidation from .origin_group_list_params import OriginGroupListParams as OriginGroupListParams from .resource_prefetch_params import ResourcePrefetchParams as ResourcePrefetchParams diff --git a/src/gcore/types/cdn/ip_range_list_ips_params.py b/src/gcore/types/cdn/ip_range_list_ips_params.py new file mode 100644 index 00000000..f10f642c --- /dev/null +++ b/src/gcore/types/cdn/ip_range_list_ips_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_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["IPRangeListIPsParams"] + + +class IPRangeListIPsParams(TypedDict, total=False): + format: Literal["json", "plain"] + """ + Optional format override. When set, this takes precedence over the `Accept` + header. + """ + + accept: Annotated[Literal["application/json", "text/plain"], PropertyInfo(alias="Accept")] diff --git a/src/gcore/types/cdn/ip_range_list_params.py b/src/gcore/types/cdn/ip_range_list_params.py new file mode 100644 index 00000000..2de60645 --- /dev/null +++ b/src/gcore/types/cdn/ip_range_list_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_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["IPRangeListParams"] + + +class IPRangeListParams(TypedDict, total=False): + format: Literal["json", "plain"] + """ + Optional format override. When set, this takes precedence over the `Accept` + header. + """ + + accept: Annotated[Literal["application/json", "text/plain"], PropertyInfo(alias="Accept")] diff --git a/src/gcore/types/cdn/resource_usage_stats.py b/src/gcore/types/cdn/resource_usage_stats.py index 7a6f6255..93e1fea7 100644 --- a/src/gcore/types/cdn/resource_usage_stats.py +++ b/src/gcore/types/cdn/resource_usage_stats.py @@ -28,7 +28,7 @@ class ResourceUsageStats(BaseModel): Possible values: - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers - or to origin shielding, if used. + or to origin shielding when used. - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. @@ -45,39 +45,40 @@ class ResourceUsageStats(BaseModel): - **`response_types`** – Statistics by content type. It returns a number of responses for content with different MIME types. - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. - We deduct the non-cached traffic from the total traffic value. - - **`cache_hit_requests_ratio`** – Share of sending cached content. Formula: - `responses_hit` / requests. - - **`shield_traffic_ratio`** – Origin shielding efficiency: how much more - traffic is sent from the origin shielding than from the origin. Formula: - (`shield_bytes` - `upstream_bytes`) / `shield_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. - **`image_processed`** - Number of images transformed on the Image optimization service. - **`request_time`** - Time elapsed between the first bytes of a request were processed and logging after the last bytes were sent to a user. - **`upstream_response_time`** - Number of milliseconds it took to receive a response from an origin. If upstream `response_time_` contains several - indications for one request (when there is more than one origin,) we summarize - them. When aggregating several queries, the average is calculated. + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. Metrics **`upstream_response_time`** and **`request_time`** should be requested separately from other metrics """ region: Optional[object] = None - """Locations (regions) by which the data is grouped. + """Regions for which data is displayed. Possible values: + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States - **asia** – Asia - **au** – Australia - - **cis** – CIS (Commonwealth of Independent States) - - **eu** – Europe - **latam** – Latin America - **me** – Middle East - - **na** – North America - - **africa** – Africa - - **sa** – South America + - **africa** - Africa + - **sa** - South America """ resource: Optional[object] = None diff --git a/src/gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py b/src/gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py index a1a50799..e5dff95c 100644 --- a/src/gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py +++ b/src/gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py @@ -17,7 +17,7 @@ class StatisticGetLogsUsageAggregatedParams(TypedDict, total=False): """End of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" flat: bool - """The waу parameters are arranged in the response. + """The way the parameters are arranged in the response. Possible values: @@ -39,4 +39,7 @@ class StatisticGetLogsUsageAggregatedParams(TypedDict, total=False): To request multiple values, use: - &resource=1&resource=2 + + If CDN resource ID is not specified, data related to all CDN resources is + returned. """ diff --git a/src/gcore/types/cdn/statistic_get_logs_usage_series_params.py b/src/gcore/types/cdn/statistic_get_logs_usage_series_params.py index 634f818e..400835af 100644 --- a/src/gcore/types/cdn/statistic_get_logs_usage_series_params.py +++ b/src/gcore/types/cdn/statistic_get_logs_usage_series_params.py @@ -11,20 +11,10 @@ class StatisticGetLogsUsageSeriesParams(TypedDict, total=False): from_: Required[Annotated[str, PropertyInfo(alias="from")]] - """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) - - Example: - - - &from=2020-01-01T00:00:00.000 - """ + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" to: Required[str] - """End of the requested time period (ISO 8601/RFC 3339 format, UTC.) - - Example: - - - &from=2020-01-01T00:00:00.000 - """ + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" resource: int """CDN resources IDs by that statistics data is grouped. @@ -32,4 +22,7 @@ class StatisticGetLogsUsageSeriesParams(TypedDict, total=False): To request multiple values, use: - &resource=1&resource=2 + + If CDN resource ID is not specified, data related to all CDN resources is + returned. """ diff --git a/src/gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py b/src/gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py index 9518ebe1..ccf15dac 100644 --- a/src/gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py +++ b/src/gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py @@ -11,13 +11,7 @@ class StatisticGetResourceUsageAggregatedParams(TypedDict, total=False): from_: Required[Annotated[str, PropertyInfo(alias="from")]] - """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) - - Examples: - - - &from=2018-11-01T00:00:00.000 - - &from=2018-11-01 - """ + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" metrics: Required[str] """Types of statistics data. @@ -78,19 +72,12 @@ class StatisticGetResourceUsageAggregatedParams(TypedDict, total=False): """ to: Required[str] - """End of the requested time period (ISO 8601/RFC 3339 format, UTC.) - - Examples: - - - &to=2018-11-01T00:00:00.000 - - &to=2018-11-01 - """ + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" countries: str - """Names of countries for which data is displayed. - - English short name from [ISO 3166 standard][1] without the definite article - "the" should be used. + """ + Names of countries for which data should be displayed. English short name from + [ISO 3166 standard][1] without the definite article ("the") should be used. [1]: https://www.iso.org/obp/ui/#search/code/ @@ -100,7 +87,7 @@ class StatisticGetResourceUsageAggregatedParams(TypedDict, total=False): """ flat: bool - """The waу the parameters are arranged in the response. + """The way the parameters are arranged in the response. Possible values: @@ -116,7 +103,9 @@ class StatisticGetResourceUsageAggregatedParams(TypedDict, total=False): - **resource** – Data is grouped by CDN resources IDs. - **region** – Data is grouped by regions of CDN edge servers. - **country** – Data is grouped by countries of CDN edge servers. - - **vhost** – Data is grouped by resources CNAME. + - **vhost** – Data is grouped by resources CNAMEs. + - **`client_country`** - Data is grouped by countries, based on end-users' + location. To request multiple values, use: @@ -140,7 +129,7 @@ class StatisticGetResourceUsageAggregatedParams(TypedDict, total=False): """ resource: int - """CDN resources IDs by which statistics data is grouped. + """CDN resources IDs by that statistics data is grouped. To request multiple values, use: diff --git a/src/gcore/types/cdn/statistic_get_resource_usage_series_params.py b/src/gcore/types/cdn/statistic_get_resource_usage_series_params.py index e830094f..27b963f5 100644 --- a/src/gcore/types/cdn/statistic_get_resource_usage_series_params.py +++ b/src/gcore/types/cdn/statistic_get_resource_usage_series_params.py @@ -100,6 +100,8 @@ class StatisticGetResourceUsageSeriesParams(TypedDict, total=False): - **region** – Data is grouped by regions of CDN edge servers. - **country** – Data is grouped by countries of CDN edge servers. - **vhost** – Data is grouped by resources CNAMEs. + - **`client_country`** - Data is grouped by countries, based on end-users' + location. To request multiple values, use: @@ -123,9 +125,12 @@ class StatisticGetResourceUsageSeriesParams(TypedDict, total=False): """ resource: int - """CDN resource IDs. + """CDN resources IDs by that statistics data is grouped. To request multiple values, use: - &resource=1&resource=2 + + If CDN resource ID is not specified, data related to all CDN resources is + returned. """ diff --git a/src/gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py b/src/gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py index eff1d4f0..f40579b7 100644 --- a/src/gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py +++ b/src/gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py @@ -17,7 +17,7 @@ class StatisticGetShieldUsageAggregatedParams(TypedDict, total=False): """End of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" flat: bool - """The waу parameters are arranged in the response. + """The way the parameters are arranged in the response. Possible values: @@ -30,7 +30,7 @@ class StatisticGetShieldUsageAggregatedParams(TypedDict, total=False): Possible value: - - **resource** - Data is grouped by CDN resource. + - **resource** - Data is grouped by CDN resources. """ resource: int @@ -39,4 +39,7 @@ class StatisticGetShieldUsageAggregatedParams(TypedDict, total=False): To request multiple values, use: - &resource=1&resource=2 + + If CDN resource ID is not specified, data related to all CDN resources is + returned. """ diff --git a/src/gcore/types/cdn/statistic_get_shield_usage_series_params.py b/src/gcore/types/cdn/statistic_get_shield_usage_series_params.py index 2b0e1a38..3ba5ad5a 100644 --- a/src/gcore/types/cdn/statistic_get_shield_usage_series_params.py +++ b/src/gcore/types/cdn/statistic_get_shield_usage_series_params.py @@ -22,4 +22,7 @@ class StatisticGetShieldUsageSeriesParams(TypedDict, total=False): To request multiple values, use: - &resource=1&resource=2 + + If CDN resource ID is not specified, data related to all CDN resources is + returned. """ diff --git a/src/gcore/types/cloud/quotas/request_create_params.py b/src/gcore/types/cloud/quotas/request_create_params.py index 282e29ad..8732cde2 100644 --- a/src/gcore/types/cloud/quotas/request_create_params.py +++ b/src/gcore/types/cloud/quotas/request_create_params.py @@ -15,9 +15,6 @@ class RequestCreateParams(TypedDict, total=False): requested_limits: Required[RequestedLimits] """Limits you want to increase.""" - client_id: int - """Client ID that requests the limit increase.""" - class RequestedLimitsGlobalLimits(TypedDict, total=False): inference_cpu_millicore_count_limit: int diff --git a/src/gcore/types/cloud/security_group.py b/src/gcore/types/cloud/security_group.py index 7407daad..412b43d5 100644 --- a/src/gcore/types/cloud/security_group.py +++ b/src/gcore/types/cloud/security_group.py @@ -33,7 +33,14 @@ class SecurityGroup(BaseModel): """The number of revisions""" tags_v2: List[Tag] - """Tags for a security group""" + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. + """ updated_at: datetime """Datetime when the security group was last updated""" diff --git a/tests/api_resources/cdn/test_ip_ranges.py b/tests/api_resources/cdn/test_ip_ranges.py index c9bbdb5e..b4967cd6 100644 --- a/tests/api_resources/cdn/test_ip_ranges.py +++ b/tests/api_resources/cdn/test_ip_ranges.py @@ -22,6 +22,14 @@ def test_method_list(self, client: Gcore) -> None: ip_range = client.cdn.ip_ranges.list() assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + ip_range = client.cdn.ip_ranges.list( + format="json", + accept="application/json", + ) + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cdn.ip_ranges.with_raw_response.list() @@ -47,6 +55,14 @@ def test_method_list_ips(self, client: Gcore) -> None: ip_range = client.cdn.ip_ranges.list_ips() assert_matches_type(PublicIPList, ip_range, path=["response"]) + @parametrize + def test_method_list_ips_with_all_params(self, client: Gcore) -> None: + ip_range = client.cdn.ip_ranges.list_ips( + format="json", + accept="application/json", + ) + assert_matches_type(PublicIPList, ip_range, path=["response"]) + @parametrize def test_raw_response_list_ips(self, client: Gcore) -> None: response = client.cdn.ip_ranges.with_raw_response.list_ips() @@ -78,6 +94,14 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: ip_range = await async_client.cdn.ip_ranges.list() assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + ip_range = await async_client.cdn.ip_ranges.list( + format="json", + accept="application/json", + ) + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cdn.ip_ranges.with_raw_response.list() @@ -103,6 +127,14 @@ async def test_method_list_ips(self, async_client: AsyncGcore) -> None: ip_range = await async_client.cdn.ip_ranges.list_ips() assert_matches_type(PublicIPList, ip_range, path=["response"]) + @parametrize + async def test_method_list_ips_with_all_params(self, async_client: AsyncGcore) -> None: + ip_range = await async_client.cdn.ip_ranges.list_ips( + format="json", + accept="application/json", + ) + assert_matches_type(PublicIPList, ip_range, path=["response"]) + @parametrize async def test_raw_response_list_ips(self, async_client: AsyncGcore) -> None: response = await async_client.cdn.ip_ranges.with_raw_response.list_ips() diff --git a/tests/api_resources/cloud/quotas/test_requests.py b/tests/api_resources/cloud/quotas/test_requests.py index 9b2b7487..3c7152a1 100644 --- a/tests/api_resources/cloud/quotas/test_requests.py +++ b/tests/api_resources/cloud/quotas/test_requests.py @@ -97,7 +97,6 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: } ], }, - client_id=1, ) assert request is None @@ -308,7 +307,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> } ], }, - client_id=1, ) assert request is None From d6d0428fa094ece253426fc8c5029a7aa15c2c32 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Oct 2025 09:44:53 +0000 Subject: [PATCH 397/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c8537dbe..e310623d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-593c5e99888d61f0b89a96221b71679316ae326fe0bf7468d93a3f4d73d06e8c.yml -openapi_spec_hash: cfd6560b017a4ff1d003e335b739f2f3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f1aa5e69e579d8ef50ab8dbc55b74e312029a61a8764dd5eb6b71d186f31ffc4.yml +openapi_spec_hash: 79d6c39952e4e8ef5a10705031cc88af config_hash: bb4a27712c30f7a2b52e1f3b31766f24 From ac53468286cf91356185ee7d5e306160fac8ce22 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Oct 2025 13:41:14 +0000 Subject: [PATCH 398/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index e310623d..20191264 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f1aa5e69e579d8ef50ab8dbc55b74e312029a61a8764dd5eb6b71d186f31ffc4.yml -openapi_spec_hash: 79d6c39952e4e8ef5a10705031cc88af +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7f43b28f5f3787d90ad3097b603d78732c31602963a0706e9d3faab773ffe35a.yml +openapi_spec_hash: d3684a66988042fe56ddad6fea6a0373 config_hash: bb4a27712c30f7a2b52e1f3b31766f24 From ebf810234bb4fee61f146e0a71afceae2453aedc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Oct 2025 15:12:26 +0000 Subject: [PATCH 399/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 20191264..4e936b75 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7f43b28f5f3787d90ad3097b603d78732c31602963a0706e9d3faab773ffe35a.yml -openapi_spec_hash: d3684a66988042fe56ddad6fea6a0373 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-926c452d13564ca1a0c7a5f6d4596d9ae2f0b62087bfe0f3229eae1e76cb9a86.yml +openapi_spec_hash: a887cd2beb7fe136a63a14ad3508462b config_hash: bb4a27712c30f7a2b52e1f3b31766f24 From d06085c12dcca5cfa53a63c965ec6962a6974e9b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 23 Oct 2025 07:22:39 +0000 Subject: [PATCH 400/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4e936b75..dab5821b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-926c452d13564ca1a0c7a5f6d4596d9ae2f0b62087bfe0f3229eae1e76cb9a86.yml -openapi_spec_hash: a887cd2beb7fe136a63a14ad3508462b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f7fe3d141383d9367eea75565a3dae94897e44354066b110db09dacf0f581187.yml +openapi_spec_hash: f710af685b8aa4d0f7962a77fd13ee40 config_hash: bb4a27712c30f7a2b52e1f3b31766f24 From 64976bd187962bbe2ba8a220778ce1c5c611b48a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 24 Oct 2025 07:50:27 +0000 Subject: [PATCH 401/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index dab5821b..de0ab459 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f7fe3d141383d9367eea75565a3dae94897e44354066b110db09dacf0f581187.yml -openapi_spec_hash: f710af685b8aa4d0f7962a77fd13ee40 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-99fc33842c158346e3b39e07fc0cef0151a5fe60c003494d60d73e3e1221d083.yml +openapi_spec_hash: 0a9e2bf938e4490d06959e14b65f3ab0 config_hash: bb4a27712c30f7a2b52e1f3b31766f24 From bf6e712ccc94082e7694e8daad9dbf3ee37530e4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 24 Oct 2025 08:22:47 +0000 Subject: [PATCH 402/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index de0ab459..78cae3bd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-99fc33842c158346e3b39e07fc0cef0151a5fe60c003494d60d73e3e1221d083.yml -openapi_spec_hash: 0a9e2bf938e4490d06959e14b65f3ab0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-286a65430a65eb4a40437fca2268857a509498373c2d8def0557e6dbd873dd41.yml +openapi_spec_hash: 25cb371f8eacd4951b1f7f8451201e83 config_hash: bb4a27712c30f7a2b52e1f3b31766f24 From ef1ef0e242b405a7063bb1c6028fd199b7b98629 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 27 Oct 2025 08:13:41 +0000 Subject: [PATCH 403/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- tests/api_resources/cdn/test_resources.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index 78cae3bd..60b9cef8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-286a65430a65eb4a40437fca2268857a509498373c2d8def0557e6dbd873dd41.yml -openapi_spec_hash: 25cb371f8eacd4951b1f7f8451201e83 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3f6cc1eae983d7512f2a83d113890737b5af78501b08d3b87d1c6a8e888671c7.yml +openapi_spec_hash: 41d631be71afa942d320dc4f57f2b919 config_hash: bb4a27712c30f7a2b52e1f3b31766f24 diff --git a/tests/api_resources/cdn/test_resources.py b/tests/api_resources/cdn/test_resources.py index aecf0ca9..debacd03 100644 --- a/tests/api_resources/cdn/test_resources.py +++ b/tests/api_resources/cdn/test_resources.py @@ -886,7 +886,7 @@ def test_method_purge_overload_1(self, client: Gcore) -> None: def test_method_purge_with_all_params_overload_1(self, client: Gcore) -> None: resource = client.cdn.resources.purge( resource_id=0, - urls=["string"], + urls=["/some-url.jpg", "/img/example.jpg"], ) assert resource is None @@ -925,7 +925,7 @@ def test_method_purge_overload_2(self, client: Gcore) -> None: def test_method_purge_with_all_params_overload_2(self, client: Gcore) -> None: resource = client.cdn.resources.purge( resource_id=0, - paths=["string"], + paths=["/images/*", "/videos/*"], ) assert resource is None @@ -2202,7 +2202,7 @@ async def test_method_purge_overload_1(self, async_client: AsyncGcore) -> None: async def test_method_purge_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: resource = await async_client.cdn.resources.purge( resource_id=0, - urls=["string"], + urls=["/some-url.jpg", "/img/example.jpg"], ) assert resource is None @@ -2241,7 +2241,7 @@ async def test_method_purge_overload_2(self, async_client: AsyncGcore) -> None: async def test_method_purge_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: resource = await async_client.cdn.resources.purge( resource_id=0, - paths=["string"], + paths=["/images/*", "/videos/*"], ) assert resource is None From 4042158abf673fc3cdb89fa080ae1fa9986133e5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 27 Oct 2025 12:15:28 +0000 Subject: [PATCH 404/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 60b9cef8..8927182b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3f6cc1eae983d7512f2a83d113890737b5af78501b08d3b87d1c6a8e888671c7.yml -openapi_spec_hash: 41d631be71afa942d320dc4f57f2b919 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-40612ca61459a98a98276b2788ba9fcdb457df1ecbbaa3556a3a379ce4de8272.yml +openapi_spec_hash: 619b199ac27e1919bc7d9996455fd96b config_hash: bb4a27712c30f7a2b52e1f3b31766f24 From ecf338dd6987107a7bdfab18bbdf81b86eee80a7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 27 Oct 2025 14:10:49 +0000 Subject: [PATCH 405/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cdn/cdn_resource.py | 10 ++++++++-- src/gcore/types/cdn/resource_create_params.py | 10 ++++++++-- src/gcore/types/cdn/resource_replace_params.py | 10 ++++++++-- src/gcore/types/cdn/resource_update_params.py | 10 ++++++++-- src/gcore/types/cdn/resources/cdn_resource_rule.py | 10 ++++++++-- src/gcore/types/cdn/resources/rule_create_params.py | 10 ++++++++-- src/gcore/types/cdn/resources/rule_replace_params.py | 10 ++++++++-- src/gcore/types/cdn/resources/rule_update_params.py | 10 ++++++++-- src/gcore/types/cdn/rule_template.py | 10 ++++++++-- src/gcore/types/cdn/rule_template_create_params.py | 10 ++++++++-- src/gcore/types/cdn/rule_template_replace_params.py | 10 ++++++++-- src/gcore/types/cdn/rule_template_update_params.py | 10 ++++++++-- 13 files changed, 98 insertions(+), 26 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8927182b..c7e76cf1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-40612ca61459a98a98276b2788ba9fcdb457df1ecbbaa3556a3a379ce4de8272.yml -openapi_spec_hash: 619b199ac27e1919bc7d9996455fd96b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9a8804253e6b10b100fd87d24631d4b6e3fb018fa6e57bb9a7404af7cae5c132.yml +openapi_spec_hash: 1fd683372fd558a27e495fb2d2aa7141 config_hash: bb4a27712c30f7a2b52e1f3b31766f24 diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py index dd05e44f..007d4be8 100644 --- a/src/gcore/types/cdn/cdn_resource.py +++ b/src/gcore/types/cdn/cdn_resource.py @@ -759,7 +759,10 @@ class OptionsProxyConnectTimeout(BaseModel): """ value: str - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 5s**. + """ class OptionsProxyReadTimeout(BaseModel): @@ -773,7 +776,10 @@ class OptionsProxyReadTimeout(BaseModel): """ value: str - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 30s**. + """ class OptionsQueryParamsBlacklist(BaseModel): diff --git a/src/gcore/types/cdn/resource_create_params.py b/src/gcore/types/cdn/resource_create_params.py index f31367c0..ce9dad10 100644 --- a/src/gcore/types/cdn/resource_create_params.py +++ b/src/gcore/types/cdn/resource_create_params.py @@ -882,7 +882,10 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 5s**. + """ class OptionsProxyReadTimeout(TypedDict, total=False): @@ -896,7 +899,10 @@ class OptionsProxyReadTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 30s**. + """ class OptionsQueryParamsBlacklist(TypedDict, total=False): diff --git a/src/gcore/types/cdn/resource_replace_params.py b/src/gcore/types/cdn/resource_replace_params.py index 717114a4..58e21ac4 100644 --- a/src/gcore/types/cdn/resource_replace_params.py +++ b/src/gcore/types/cdn/resource_replace_params.py @@ -860,7 +860,10 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 5s**. + """ class OptionsProxyReadTimeout(TypedDict, total=False): @@ -874,7 +877,10 @@ class OptionsProxyReadTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 30s**. + """ class OptionsQueryParamsBlacklist(TypedDict, total=False): diff --git a/src/gcore/types/cdn/resource_update_params.py b/src/gcore/types/cdn/resource_update_params.py index d980ad8c..a382bda2 100644 --- a/src/gcore/types/cdn/resource_update_params.py +++ b/src/gcore/types/cdn/resource_update_params.py @@ -851,7 +851,10 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 5s**. + """ class OptionsProxyReadTimeout(TypedDict, total=False): @@ -865,7 +868,10 @@ class OptionsProxyReadTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 30s**. + """ class OptionsQueryParamsBlacklist(TypedDict, total=False): diff --git a/src/gcore/types/cdn/resources/cdn_resource_rule.py b/src/gcore/types/cdn/resources/cdn_resource_rule.py index 28dc2ebf..8f66f00c 100644 --- a/src/gcore/types/cdn/resources/cdn_resource_rule.py +++ b/src/gcore/types/cdn/resources/cdn_resource_rule.py @@ -736,7 +736,10 @@ class OptionsProxyConnectTimeout(BaseModel): """ value: str - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 5s**. + """ class OptionsProxyReadTimeout(BaseModel): @@ -750,7 +753,10 @@ class OptionsProxyReadTimeout(BaseModel): """ value: str - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 30s**. + """ class OptionsQueryParamsBlacklist(BaseModel): diff --git a/src/gcore/types/cdn/resources/rule_create_params.py b/src/gcore/types/cdn/resources/rule_create_params.py index 6c8ab837..4d80f7c6 100644 --- a/src/gcore/types/cdn/resources/rule_create_params.py +++ b/src/gcore/types/cdn/resources/rule_create_params.py @@ -812,7 +812,10 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 5s**. + """ class OptionsProxyReadTimeout(TypedDict, total=False): @@ -826,7 +829,10 @@ class OptionsProxyReadTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 30s**. + """ class OptionsQueryParamsBlacklist(TypedDict, total=False): diff --git a/src/gcore/types/cdn/resources/rule_replace_params.py b/src/gcore/types/cdn/resources/rule_replace_params.py index 6eb3eddc..c6bf65cc 100644 --- a/src/gcore/types/cdn/resources/rule_replace_params.py +++ b/src/gcore/types/cdn/resources/rule_replace_params.py @@ -814,7 +814,10 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 5s**. + """ class OptionsProxyReadTimeout(TypedDict, total=False): @@ -828,7 +831,10 @@ class OptionsProxyReadTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 30s**. + """ class OptionsQueryParamsBlacklist(TypedDict, total=False): diff --git a/src/gcore/types/cdn/resources/rule_update_params.py b/src/gcore/types/cdn/resources/rule_update_params.py index 154c4cef..e04e0c93 100644 --- a/src/gcore/types/cdn/resources/rule_update_params.py +++ b/src/gcore/types/cdn/resources/rule_update_params.py @@ -814,7 +814,10 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 5s**. + """ class OptionsProxyReadTimeout(TypedDict, total=False): @@ -828,7 +831,10 @@ class OptionsProxyReadTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 30s**. + """ class OptionsQueryParamsBlacklist(TypedDict, total=False): diff --git a/src/gcore/types/cdn/rule_template.py b/src/gcore/types/cdn/rule_template.py index 6d73d4f4..1d7b8693 100644 --- a/src/gcore/types/cdn/rule_template.py +++ b/src/gcore/types/cdn/rule_template.py @@ -736,7 +736,10 @@ class OptionsProxyConnectTimeout(BaseModel): """ value: str - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 5s**. + """ class OptionsProxyReadTimeout(BaseModel): @@ -750,7 +753,10 @@ class OptionsProxyReadTimeout(BaseModel): """ value: str - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 30s**. + """ class OptionsQueryParamsBlacklist(BaseModel): diff --git a/src/gcore/types/cdn/rule_template_create_params.py b/src/gcore/types/cdn/rule_template_create_params.py index a0e9ea73..30d52eba 100644 --- a/src/gcore/types/cdn/rule_template_create_params.py +++ b/src/gcore/types/cdn/rule_template_create_params.py @@ -796,7 +796,10 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 5s**. + """ class OptionsProxyReadTimeout(TypedDict, total=False): @@ -810,7 +813,10 @@ class OptionsProxyReadTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 30s**. + """ class OptionsQueryParamsBlacklist(TypedDict, total=False): diff --git a/src/gcore/types/cdn/rule_template_replace_params.py b/src/gcore/types/cdn/rule_template_replace_params.py index 683bd306..ccb47c56 100644 --- a/src/gcore/types/cdn/rule_template_replace_params.py +++ b/src/gcore/types/cdn/rule_template_replace_params.py @@ -796,7 +796,10 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 5s**. + """ class OptionsProxyReadTimeout(TypedDict, total=False): @@ -810,7 +813,10 @@ class OptionsProxyReadTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 30s**. + """ class OptionsQueryParamsBlacklist(TypedDict, total=False): diff --git a/src/gcore/types/cdn/rule_template_update_params.py b/src/gcore/types/cdn/rule_template_update_params.py index c1e77142..2be5eb7e 100644 --- a/src/gcore/types/cdn/rule_template_update_params.py +++ b/src/gcore/types/cdn/rule_template_update_params.py @@ -796,7 +796,10 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 5s**. + """ class OptionsProxyReadTimeout(TypedDict, total=False): @@ -810,7 +813,10 @@ class OptionsProxyReadTimeout(TypedDict, total=False): """ value: Required[str] - """Timeout value in seconds.""" + """Timeout value in seconds. + + Supported range: **1s - 30s**. + """ class OptionsQueryParamsBlacklist(TypedDict, total=False): From fb02b1bc0fd14b82917f4770400a8c243583cb5d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Oct 2025 10:11:42 +0000 Subject: [PATCH 406/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c7e76cf1..c6f718d3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9a8804253e6b10b100fd87d24631d4b6e3fb018fa6e57bb9a7404af7cae5c132.yml -openapi_spec_hash: 1fd683372fd558a27e495fb2d2aa7141 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7a2f7e9dd81da1b84b614443585eb99dca6581b155f778de2af43cf9e02ff144.yml +openapi_spec_hash: 236bdc057e30d676bc46e7d4f22cbee7 config_hash: bb4a27712c30f7a2b52e1f3b31766f24 From cb97417156edf4827da2d66e92cd8a726ceece64 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Oct 2025 12:15:36 +0000 Subject: [PATCH 407/592] feat(api): aggregated API specs update --- .stats.yml | 4 +-- api.md | 2 +- .../cloud/load_balancers/listeners.py | 35 +++++++++++++++---- .../cloud/load_balancer_create_params.py | 5 ++- .../types/cloud/load_balancers/__init__.py | 1 + .../load_balancers/listener_create_params.py | 5 ++- .../load_balancers/listener_delete_params.py | 18 ++++++++++ .../load_balancers/listener_update_params.py | 5 ++- .../cloud/load_balancers/test_listeners.py | 20 +++++++++++ 9 files changed, 83 insertions(+), 12 deletions(-) create mode 100644 src/gcore/types/cloud/load_balancers/listener_delete_params.py diff --git a/.stats.yml b/.stats.yml index c6f718d3..035cadcd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7a2f7e9dd81da1b84b614443585eb99dca6581b155f778de2af43cf9e02ff144.yml -openapi_spec_hash: 236bdc057e30d676bc46e7d4f22cbee7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7bb076221b6b8c4e465291804fa37dfec95dc815c0670753eec9e02420aef8eb.yml +openapi_spec_hash: 5c56fa55767a46498c083e3fa940c227 config_hash: bb4a27712c30f7a2b52e1f3b31766f24 diff --git a/api.md b/api.md index 8904e330..6ff46915 100644 --- a/api.md +++ b/api.md @@ -250,7 +250,7 @@ Methods: - client.cloud.load_balancers.listeners.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.listeners.update(listener_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.listeners.list(\*, project_id, region_id, \*\*params) -> LoadBalancerListenerList -- client.cloud.load_balancers.listeners.delete(listener_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.load_balancers.listeners.delete(listener_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.listeners.get(listener_id, \*, project_id, region_id, \*\*params) -> LoadBalancerListenerDetail ### Pools diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 272880d8..907744a0 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -23,6 +23,7 @@ listener_get_params, listener_list_params, listener_create_params, + listener_delete_params, listener_update_params, ) from ....types.cloud.lb_listener_protocol import LbListenerProtocol @@ -95,7 +96,8 @@ def create( allowed_cidrs: Network CIDRs from which service will be accessible - connection_limit: Limit of the simultaneous connections + connection_limit: Limit of the simultaneous connections. If -1 is provided, it is translated to + the default value 100000. insert_x_forwarded: Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. Only used with HTTP or `TERMINATED_HTTPS` protocols. @@ -186,7 +188,8 @@ def update( allowed_cidrs: Network CIDRs from which service will be accessible - connection_limit: Limit of simultaneous connections + connection_limit: Limit of simultaneous connections. If -1 is provided, it is translated to the + default value 100000. name: Load balancer listener name @@ -302,6 +305,7 @@ def delete( *, project_id: int | None = None, region_id: int | None = None, + delete_default_pool: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -319,6 +323,8 @@ def delete( listener_id: Listener ID + delete_default_pool: Delete default pool attached directly to the listener. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -336,7 +342,13 @@ def delete( return self._delete( f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"delete_default_pool": delete_default_pool}, listener_delete_params.ListenerDeleteParams + ), ), cast_to=TaskIDList, ) @@ -457,7 +469,8 @@ async def create( allowed_cidrs: Network CIDRs from which service will be accessible - connection_limit: Limit of the simultaneous connections + connection_limit: Limit of the simultaneous connections. If -1 is provided, it is translated to + the default value 100000. insert_x_forwarded: Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. Only used with HTTP or `TERMINATED_HTTPS` protocols. @@ -548,7 +561,8 @@ async def update( allowed_cidrs: Network CIDRs from which service will be accessible - connection_limit: Limit of simultaneous connections + connection_limit: Limit of simultaneous connections. If -1 is provided, it is translated to the + default value 100000. name: Load balancer listener name @@ -664,6 +678,7 @@ async def delete( *, project_id: int | None = None, region_id: int | None = None, + delete_default_pool: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -681,6 +696,8 @@ async def delete( listener_id: Listener ID + delete_default_pool: Delete default pool attached directly to the listener. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -698,7 +715,13 @@ async def delete( return await self._delete( f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"delete_default_pool": delete_default_pool}, listener_delete_params.ListenerDeleteParams + ), ), cast_to=TaskIDList, ) diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index a41fd6e4..0ab6f5ce 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -318,7 +318,10 @@ class Listener(TypedDict, total=False): """Network CIDRs from which service will be accessible""" connection_limit: int - """Limit of the simultaneous connections""" + """Limit of the simultaneous connections. + + If -1 is provided, it is translated to the default value 100000. + """ insert_x_forwarded: bool """Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index 433f966c..c68b77c9 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -10,6 +10,7 @@ from .listener_get_params import ListenerGetParams as ListenerGetParams from .listener_list_params import ListenerListParams as ListenerListParams from .listener_create_params import ListenerCreateParams as ListenerCreateParams +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/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py index c5b6f5e6..9850d348 100644 --- a/src/gcore/types/cloud/load_balancers/listener_create_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -34,7 +34,10 @@ class ListenerCreateParams(TypedDict, total=False): """Network CIDRs from which service will be accessible""" connection_limit: int - """Limit of the simultaneous connections""" + """Limit of the simultaneous connections. + + If -1 is provided, it is translated to the default value 100000. + """ insert_x_forwarded: bool """Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. diff --git a/src/gcore/types/cloud/load_balancers/listener_delete_params.py b/src/gcore/types/cloud/load_balancers/listener_delete_params.py new file mode 100644 index 00000000..7d0e31a4 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/listener_delete_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_extensions import TypedDict + +__all__ = ["ListenerDeleteParams"] + + +class ListenerDeleteParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + delete_default_pool: bool + """Delete default pool attached directly to the listener.""" diff --git a/src/gcore/types/cloud/load_balancers/listener_update_params.py b/src/gcore/types/cloud/load_balancers/listener_update_params.py index 492c990d..42fa7e38 100644 --- a/src/gcore/types/cloud/load_balancers/listener_update_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_update_params.py @@ -21,7 +21,10 @@ class ListenerUpdateParams(TypedDict, total=False): """Network CIDRs from which service will be accessible""" connection_limit: int - """Limit of simultaneous connections""" + """Limit of simultaneous connections. + + If -1 is provided, it is translated to the default value 100000. + """ name: str """Load balancer listener name""" diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index b7228ea5..628a84f8 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -211,6 +211,16 @@ def test_method_delete(self, client: Gcore) -> None: ) assert_matches_type(TaskIDList, listener, path=["response"]) + @parametrize + def test_method_delete_with_all_params(self, client: Gcore) -> None: + listener = client.cloud.load_balancers.listeners.delete( + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + delete_default_pool=False, + ) + assert_matches_type(TaskIDList, listener, path=["response"]) + @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.load_balancers.listeners.with_raw_response.delete( @@ -504,6 +514,16 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: ) assert_matches_type(TaskIDList, listener, path=["response"]) + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: + listener = await async_client.cloud.load_balancers.listeners.delete( + listener_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + delete_default_pool=False, + ) + assert_matches_type(TaskIDList, listener, path=["response"]) + @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.listeners.with_raw_response.delete( From 0ebf556be36b6efac4bb85a5146a26153463aab0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 29 Oct 2025 09:46:24 +0000 Subject: [PATCH 408/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 035cadcd..e33bba97 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7bb076221b6b8c4e465291804fa37dfec95dc815c0670753eec9e02420aef8eb.yml openapi_spec_hash: 5c56fa55767a46498c083e3fa940c227 -config_hash: bb4a27712c30f7a2b52e1f3b31766f24 +config_hash: 25b1dd444559d26e51bf85892358c0bc From c36490f6a88acaa96910074b0ce3261499b52b76 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 29 Oct 2025 10:43:04 +0000 Subject: [PATCH 409/592] fix(client): close streams without requiring full consumption --- src/gcore/_streaming.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gcore/_streaming.py b/src/gcore/_streaming.py index bf3046cf..16c106ae 100644 --- a/src/gcore/_streaming.py +++ b/src/gcore/_streaming.py @@ -57,9 +57,8 @@ def __stream__(self) -> Iterator[_T]: for sse in iterator: yield process_data(data=sse.json(), cast_to=cast_to, response=response) - # Ensure the entire stream is consumed - for _sse in iterator: - ... + # As we might not fully consume the response stream, we need to close it explicitly + response.close() def __enter__(self) -> Self: return self @@ -121,9 +120,8 @@ async def __stream__(self) -> AsyncIterator[_T]: async for sse in iterator: yield process_data(data=sse.json(), cast_to=cast_to, response=response) - # Ensure the entire stream is consumed - async for _sse in iterator: - ... + # As we might not fully consume the response stream, we need to close it explicitly + await response.aclose() async def __aenter__(self) -> Self: return self From eec24ea8454ab3bfba08f52781137d1c7695ce7a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 29 Oct 2025 12:15:35 +0000 Subject: [PATCH 410/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cloud/gpu_baremetal_cluster.py | 14 +++++++++++++- .../cloud/gpu_baremetal_cluster_create_params.py | 12 ++++++++++++ .../cloud/test_gpu_baremetal_clusters.py | 12 ++++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index e33bba97..f535120f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7bb076221b6b8c4e465291804fa37dfec95dc815c0670753eec9e02420aef8eb.yml -openapi_spec_hash: 5c56fa55767a46498c083e3fa940c227 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-848b764e60807c1c1aedd39ebdbadd2ee63dcc6ae3910179cdfff3ef80429563.yml +openapi_spec_hash: 04d6bac6704e464b0fa52af0cd0e18a2 config_hash: 25b1dd444559d26e51bf85892358c0bc diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal_cluster.py index aa310a9b..373678bf 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster.py @@ -11,6 +11,7 @@ __all__ = [ "GPUBaremetalCluster", "ServersSettings", + "ServersSettingsFileShare", "ServersSettingsInterface", "ServersSettingsInterfaceExternalInterfaceOutputSerializer", "ServersSettingsInterfaceSubnetInterfaceOutputSerializer", @@ -21,6 +22,14 @@ ] +class ServersSettingsFileShare(BaseModel): + id: str + """Unique identifier of the file share in UUID format.""" + + mount_path: str + """Absolute mount path inside the system where the file share will be mounted.""" + + class ServersSettingsInterfaceExternalInterfaceOutputSerializer(BaseModel): ip_family: Literal["dual", "ipv4", "ipv6"] """Which subnets should be selected: IPv4, IPv6, or use dual stack.""" @@ -90,6 +99,9 @@ class ServersSettingsSecurityGroup(BaseModel): class ServersSettings(BaseModel): + file_shares: List[ServersSettingsFileShare] + """List of file shares mounted across the cluster.""" + interfaces: List[ServersSettingsInterface] security_groups: List[ServersSettingsSecurityGroup] @@ -99,7 +111,7 @@ class ServersSettings(BaseModel): """SSH key name""" user_data: Optional[str] = None - """Optional custom user data (Base64-encoded) Mutually exclusive with 'password'.""" + """Optional custom user data""" class GPUBaremetalCluster(BaseModel): 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 2dd61b2c..7bdf8a8a 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -15,6 +15,7 @@ "ServersSettingsInterfaceAnySubnetInterfaceInputSerializer", "ServersSettingsInterfaceAnySubnetInterfaceInputSerializerFloatingIP", "ServersSettingsCredentials", + "ServersSettingsFileShare", "ServersSettingsSecurityGroup", ] @@ -127,6 +128,14 @@ class ServersSettingsCredentials(TypedDict, total=False): """The 'username' and 'password' fields create a new user on the system""" +class ServersSettingsFileShare(TypedDict, total=False): + id: Required[str] + """Unique identifier of the file share in UUID format.""" + + mount_path: Required[str] + """Absolute mount path inside the system where the file share will be mounted.""" + + class ServersSettingsSecurityGroup(TypedDict, total=False): id: Required[str] """Resource ID""" @@ -139,6 +148,9 @@ class ServersSettings(TypedDict, total=False): credentials: ServersSettingsCredentials """Optional server access credentials""" + file_shares: Iterable[ServersSettingsFileShare] + """List of file shares to be mounted across the cluster.""" + security_groups: Iterable[ServersSettingsSecurityGroup] """List of security groups UUIDs""" diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index 9fc01cc9..90aa7127 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -57,6 +57,12 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "ssh_key_name": "my-ssh-key", "username": "admin", }, + "file_shares": [ + { + "id": "a3f2d1b8-45e6-4f8a-bb5d-19dbf2cd7e9a", + "mount_path": "/mnt/vast", + } + ], "security_groups": [{"id": "b4849ffa-89f2-45a1-951f-0ae5b7809d98"}], "user_data": "eyJ0ZXN0IjogImRhdGEifQ==", }, @@ -549,6 +555,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "ssh_key_name": "my-ssh-key", "username": "admin", }, + "file_shares": [ + { + "id": "a3f2d1b8-45e6-4f8a-bb5d-19dbf2cd7e9a", + "mount_path": "/mnt/vast", + } + ], "security_groups": [{"id": "b4849ffa-89f2-45a1-951f-0ae5b7809d98"}], "user_data": "eyJ0ZXN0IjogImRhdGEifQ==", }, From a216e747c90b788d4643ee8d5ae9e614963d9916 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Oct 2025 11:03:32 +0000 Subject: [PATCH 411/592] chore(internal/tests): avoid race condition with implicit client cleanup --- tests/test_client.py | 398 +++++++++++++++++++++++-------------------- 1 file changed, 212 insertions(+), 186 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 1ef62fe4..5e4cd0ed 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -59,51 +59,49 @@ def _get_open_connections(client: Gcore | AsyncGcore) -> int: class TestGcore: - client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) - @pytest.mark.respx(base_url=base_url) - def test_raw_response(self, respx_mock: MockRouter) -> None: + def test_raw_response(self, respx_mock: MockRouter, client: Gcore) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.post("/foo", cast_to=httpx.Response) + response = client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} @pytest.mark.respx(base_url=base_url) - def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + def test_raw_response_for_binary(self, respx_mock: MockRouter, client: Gcore) -> None: respx_mock.post("/foo").mock( return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') ) - response = self.client.post("/foo", cast_to=httpx.Response) + response = client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} - def test_copy(self) -> None: - copied = self.client.copy() - assert id(copied) != id(self.client) + def test_copy(self, client: Gcore) -> None: + copied = client.copy() + assert id(copied) != id(client) - copied = self.client.copy(api_key="another My API Key") + copied = client.copy(api_key="another My API Key") assert copied.api_key == "another My API Key" - assert self.client.api_key == "My API Key" + assert client.api_key == "My API Key" - def test_copy_default_options(self) -> None: + def test_copy_default_options(self, client: Gcore) -> None: # options that have a default are overridden correctly - copied = self.client.copy(max_retries=7) + copied = client.copy(max_retries=7) assert copied.max_retries == 7 - assert self.client.max_retries == 2 + assert client.max_retries == 2 copied2 = copied.copy(max_retries=6) assert copied2.max_retries == 6 assert copied.max_retries == 7 # timeout - assert isinstance(self.client.timeout, httpx.Timeout) - copied = self.client.copy(timeout=None) + assert isinstance(client.timeout, httpx.Timeout) + copied = client.copy(timeout=None) assert copied.timeout is None - assert isinstance(self.client.timeout, httpx.Timeout) + assert isinstance(client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: client = Gcore( @@ -138,6 +136,7 @@ def test_copy_default_headers(self) -> None: match="`default_headers` and `set_default_headers` arguments are mutually exclusive", ): client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + client.close() def test_copy_default_query(self) -> None: client = Gcore( @@ -175,13 +174,15 @@ def test_copy_default_query(self) -> None: ): client.copy(set_default_query={}, default_query={"foo": "Bar"}) - def test_copy_signature(self) -> None: + client.close() + + def test_copy_signature(self, client: Gcore) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + client.__init__, # type: ignore[misc] ) - copy_signature = inspect.signature(self.client.copy) + copy_signature = inspect.signature(client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} for name in init_signature.parameters.keys(): @@ -192,12 +193,12 @@ def test_copy_signature(self) -> None: assert copy_param is not None, f"copy() signature is missing the {name} param" @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") - def test_copy_build_request(self) -> None: + def test_copy_build_request(self, client: Gcore) -> None: options = FinalRequestOptions(method="get", url="/foo") def build_request(options: FinalRequestOptions) -> None: - client = self.client.copy() - client._build_request(options) + client_copy = client.copy() + client_copy._build_request(options) # ensure that the machinery is warmed up before tracing starts. build_request(options) @@ -254,14 +255,12 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic print(frame) raise AssertionError() - def test_request_timeout(self) -> None: - request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + def test_request_timeout(self, client: Gcore) -> None: + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT - request = self.client._build_request( - FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) - ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0))) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(100.0) @@ -272,6 +271,8 @@ def test_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(0) + client.close() + def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used with httpx.Client(timeout=None) as http_client: @@ -283,6 +284,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(None) + client.close() + # no timeout given to the httpx client should not use the httpx default with httpx.Client() as http_client: client = Gcore( @@ -293,6 +296,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT + client.close() + # explicitly passing the default timeout currently results in it being ignored with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: client = Gcore( @@ -303,6 +308,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT # our default + client.close() + async def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): async with httpx.AsyncClient() as http_client: @@ -314,14 +321,14 @@ async def test_invalid_http_client(self) -> None: ) def test_default_headers_option(self) -> None: - client = Gcore( + test_client = Gcore( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - client2 = Gcore( + test_client2 = Gcore( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -330,10 +337,13 @@ def test_default_headers_option(self) -> None: "X-Stainless-Lang": "my-overriding-header", }, ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client2._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "stainless" assert request.headers.get("x-stainless-lang") == "my-overriding-header" + test_client.close() + test_client2.close() + def test_validate_headers(self) -> None: client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) @@ -362,30 +372,28 @@ def test_default_query_option(self) -> None: url = httpx.URL(request.url) assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} - def test_cloud_project_id_client_params(self) -> None: - client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + client.close() - with client as c2: - with pytest.raises(ValueError, match="Missing cloud_project_id argument;"): - c2.cloud.projects.update(name="New Project") + 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="New Project") client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_project_id=0) with client as c2: c2.cloud.projects.update(name="New Project") - def test_cloud_region_id_client_params(self) -> None: - client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) - - with client as c2: - with pytest.raises(ValueError, match="Missing cloud_region_id argument;"): - c2.cloud.regions.get() + def test_cloud_region_id_client_params(self, client: Gcore) -> None: + # Test with base client (no custom params) + with pytest.raises(ValueError, match="Missing cloud_region_id argument;"): + client.cloud.regions.get() client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_region_id=0) with client as c2: c2.cloud.regions.get() - def test_request_extra_json(self) -> None: - request = self.client._build_request( + def test_request_extra_json(self, client: Gcore) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -396,7 +404,7 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": False} - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -407,7 +415,7 @@ def test_request_extra_json(self) -> None: assert data == {"baz": False} # `extra_json` takes priority over `json_data` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -418,8 +426,8 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": None} - def test_request_extra_headers(self) -> None: - request = self.client._build_request( + def test_request_extra_headers(self, client: Gcore) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -429,7 +437,7 @@ def test_request_extra_headers(self) -> None: assert request.headers.get("X-Foo") == "Foo" # `extra_headers` takes priority over `default_headers` when keys clash - request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + request = client.with_options(default_headers={"X-Bar": "true"})._build_request( FinalRequestOptions( method="post", url="/foo", @@ -440,8 +448,8 @@ def test_request_extra_headers(self) -> None: ) assert request.headers.get("X-Bar") == "false" - def test_request_extra_query(self) -> None: - request = self.client._build_request( + def test_request_extra_query(self, client: Gcore) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -454,7 +462,7 @@ def test_request_extra_query(self) -> None: assert params == {"my_query_param": "Foo"} # if both `query` and `extra_query` are given, they are merged - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -468,7 +476,7 @@ def test_request_extra_query(self) -> None: assert params == {"bar": "1", "foo": "2"} # `extra_query` takes priority over `query` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -511,7 +519,7 @@ def test_multipart_repeating_array(self, client: Gcore) -> None: ] @pytest.mark.respx(base_url=base_url) - def test_basic_union_response(self, respx_mock: MockRouter) -> None: + def test_basic_union_response(self, respx_mock: MockRouter, client: Gcore) -> None: class Model1(BaseModel): name: str @@ -520,12 +528,12 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" @pytest.mark.respx(base_url=base_url) - def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + def test_union_response_different_types(self, respx_mock: MockRouter, client: Gcore) -> None: """Union of objects with the same field name using a different type""" class Model1(BaseModel): @@ -536,18 +544,18 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) assert response.foo == 1 @pytest.mark.respx(base_url=base_url) - def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter, client: Gcore) -> None: """ Response that sets Content-Type to something other than application/json but returns json data """ @@ -563,7 +571,7 @@ class Model(BaseModel): ) ) - response = self.client.get("/foo", cast_to=Model) + response = client.get("/foo", cast_to=Model) assert isinstance(response, Model) assert response.foo == 2 @@ -575,6 +583,8 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" + client.close() + def test_base_url_env(self) -> None: with update_env(GCORE_BASE_URL="http://localhost:5000/from/env"): client = Gcore(api_key=api_key, _strict_response_validation=True) @@ -602,6 +612,7 @@ def test_base_url_trailing_slash(self, client: Gcore) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + client.close() @pytest.mark.parametrize( "client", @@ -625,6 +636,7 @@ def test_base_url_no_trailing_slash(self, client: Gcore) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + client.close() @pytest.mark.parametrize( "client", @@ -648,35 +660,36 @@ def test_absolute_request_url(self, client: Gcore) -> None: ), ) assert request.url == "https://myapi.com/foo" + client.close() def test_copied_client_does_not_close_http(self) -> None: - client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) - assert not client.is_closed() + test_client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + assert not test_client.is_closed() - copied = client.copy() - assert copied is not client + copied = test_client.copy() + assert copied is not test_client del copied - assert not client.is_closed() + assert not test_client.is_closed() def test_client_context_manager(self) -> None: - client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) - with client as c2: - assert c2 is client + test_client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + with test_client as c2: + assert c2 is test_client assert not c2.is_closed() - assert not client.is_closed() - assert client.is_closed() + assert not test_client.is_closed() + assert test_client.is_closed() @pytest.mark.respx(base_url=base_url) - def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + def test_client_response_validation_error(self, respx_mock: MockRouter, client: Gcore) -> None: class Model(BaseModel): foo: str respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) with pytest.raises(APIResponseValidationError) as exc: - self.client.get("/foo", cast_to=Model) + client.get("/foo", cast_to=Model) assert isinstance(exc.value.__cause__, ValidationError) @@ -696,11 +709,14 @@ class Model(BaseModel): with pytest.raises(APIResponseValidationError): strict_client.get("/foo", cast_to=Model) - client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=False) + non_strict_client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=False) - response = client.get("/foo", cast_to=Model) + response = non_strict_client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] + strict_client.close() + non_strict_client.close() + @pytest.mark.parametrize( "remaining_retries,retry_after,timeout", [ @@ -723,9 +739,9 @@ class Model(BaseModel): ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) - def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: - client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) - + def test_parse_retry_after_header( + self, remaining_retries: int, retry_after: str, timeout: float, client: Gcore + ) -> None: headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) @@ -739,7 +755,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien with pytest.raises(APITimeoutError): client.cloud.projects.with_streaming_response.create(name="New Project").__enter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(client) == 0 @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -748,7 +764,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client with pytest.raises(APIStatusError): client.cloud.projects.with_streaming_response.create(name="New Project").__enter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @@ -852,83 +868,77 @@ def test_default_client_creation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - def test_follow_redirects(self, respx_mock: MockRouter) -> None: + def test_follow_redirects(self, respx_mock: MockRouter, client: Gcore) -> None: # Test that the default follow_redirects=True allows following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) - response = self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + response = client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) assert response.status_code == 200 assert response.json() == {"status": "ok"} @pytest.mark.respx(base_url=base_url) - def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + def test_follow_redirects_disabled(self, respx_mock: MockRouter, client: Gcore) -> None: # Test that follow_redirects=False prevents following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) with pytest.raises(APIStatusError) as exc_info: - self.client.post( - "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response - ) + client.post("/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response) assert exc_info.value.response.status_code == 302 assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" class TestAsyncGcore: - client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) - @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_raw_response(self, respx_mock: MockRouter) -> None: + async def test_raw_response(self, respx_mock: MockRouter, async_client: AsyncGcore) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.post("/foo", cast_to=httpx.Response) + response = await async_client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + async def test_raw_response_for_binary(self, respx_mock: MockRouter, async_client: AsyncGcore) -> None: respx_mock.post("/foo").mock( return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') ) - response = await self.client.post("/foo", cast_to=httpx.Response) + response = await async_client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} - def test_copy(self) -> None: - copied = self.client.copy() - assert id(copied) != id(self.client) + def test_copy(self, async_client: AsyncGcore) -> None: + copied = async_client.copy() + assert id(copied) != id(async_client) - copied = self.client.copy(api_key="another My API Key") + copied = async_client.copy(api_key="another My API Key") assert copied.api_key == "another My API Key" - assert self.client.api_key == "My API Key" + assert async_client.api_key == "My API Key" - def test_copy_default_options(self) -> None: + def test_copy_default_options(self, async_client: AsyncGcore) -> None: # options that have a default are overridden correctly - copied = self.client.copy(max_retries=7) + copied = async_client.copy(max_retries=7) assert copied.max_retries == 7 - assert self.client.max_retries == 2 + assert async_client.max_retries == 2 copied2 = copied.copy(max_retries=6) assert copied2.max_retries == 6 assert copied.max_retries == 7 # timeout - assert isinstance(self.client.timeout, httpx.Timeout) - copied = self.client.copy(timeout=None) + assert isinstance(async_client.timeout, httpx.Timeout) + copied = async_client.copy(timeout=None) assert copied.timeout is None - assert isinstance(self.client.timeout, httpx.Timeout) + assert isinstance(async_client.timeout, httpx.Timeout) - def test_copy_default_headers(self) -> None: + async def test_copy_default_headers(self) -> None: client = AsyncGcore( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) @@ -961,8 +971,9 @@ def test_copy_default_headers(self) -> None: match="`default_headers` and `set_default_headers` arguments are mutually exclusive", ): client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + await client.close() - def test_copy_default_query(self) -> None: + async def test_copy_default_query(self) -> None: client = AsyncGcore( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} ) @@ -998,13 +1009,15 @@ def test_copy_default_query(self) -> None: ): client.copy(set_default_query={}, default_query={"foo": "Bar"}) - def test_copy_signature(self) -> None: + await client.close() + + def test_copy_signature(self, async_client: AsyncGcore) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + async_client.__init__, # type: ignore[misc] ) - copy_signature = inspect.signature(self.client.copy) + copy_signature = inspect.signature(async_client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} for name in init_signature.parameters.keys(): @@ -1015,12 +1028,12 @@ def test_copy_signature(self) -> None: assert copy_param is not None, f"copy() signature is missing the {name} param" @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") - def test_copy_build_request(self) -> None: + def test_copy_build_request(self, async_client: AsyncGcore) -> None: options = FinalRequestOptions(method="get", url="/foo") def build_request(options: FinalRequestOptions) -> None: - client = self.client.copy() - client._build_request(options) + client_copy = async_client.copy() + client_copy._build_request(options) # ensure that the machinery is warmed up before tracing starts. build_request(options) @@ -1077,12 +1090,12 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic print(frame) raise AssertionError() - async def test_request_timeout(self) -> None: - request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + async def test_request_timeout(self, async_client: AsyncGcore) -> None: + request = async_client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT - request = self.client._build_request( + request = async_client._build_request( FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) ) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -1097,6 +1110,8 @@ async def test_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(0) + await client.close() + async def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used async with httpx.AsyncClient(timeout=None) as http_client: @@ -1108,6 +1123,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(None) + await client.close() + # no timeout given to the httpx client should not use the httpx default async with httpx.AsyncClient() as http_client: client = AsyncGcore( @@ -1118,6 +1135,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT + await client.close() + # explicitly passing the default timeout currently results in it being ignored async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: client = AsyncGcore( @@ -1128,6 +1147,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT # our default + await client.close() + def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): with httpx.Client() as http_client: @@ -1138,15 +1159,15 @@ def test_invalid_http_client(self) -> None: http_client=cast(Any, http_client), ) - def test_default_headers_option(self) -> None: - client = AsyncGcore( + async def test_default_headers_option(self) -> None: + test_client = AsyncGcore( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - client2 = AsyncGcore( + test_client2 = AsyncGcore( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -1155,10 +1176,13 @@ def test_default_headers_option(self) -> None: "X-Stainless-Lang": "my-overriding-header", }, ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client2._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "stainless" assert request.headers.get("x-stainless-lang") == "my-overriding-header" + await test_client.close() + await test_client2.close() + def test_validate_headers(self) -> None: client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) @@ -1169,7 +1193,7 @@ def test_validate_headers(self) -> None: client2 = AsyncGcore(base_url=base_url, api_key=None, _strict_response_validation=True) _ = client2 - def test_default_query_option(self) -> None: + async def test_default_query_option(self) -> None: client = AsyncGcore( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} ) @@ -1187,30 +1211,28 @@ def test_default_query_option(self) -> None: url = httpx.URL(request.url) assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} - async def test_cloud_project_id_client_params(self) -> None: - client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + await client.close() - async with client as c2: - with pytest.raises(ValueError, match="Missing cloud_project_id argument;"): - await c2.cloud.projects.update(name="New Project") + 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="New Project") client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_project_id=0) async with client as c2: await c2.cloud.projects.update(name="New Project") - async def test_cloud_region_id_client_params(self) -> None: - client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) - - async with client as c2: - with pytest.raises(ValueError, match="Missing cloud_region_id argument;"): - await c2.cloud.regions.get() + async def test_cloud_region_id_client_params(self, async_client: AsyncGcore) -> None: + # Test with base client (no custom params) + with pytest.raises(ValueError, match="Missing cloud_region_id argument;"): + await async_client.cloud.regions.get() client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_region_id=0) async with client as c2: await c2.cloud.regions.get() - def test_request_extra_json(self) -> None: - request = self.client._build_request( + def test_request_extra_json(self, client: Gcore) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1221,7 +1243,7 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": False} - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1232,7 +1254,7 @@ def test_request_extra_json(self) -> None: assert data == {"baz": False} # `extra_json` takes priority over `json_data` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1243,8 +1265,8 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": None} - def test_request_extra_headers(self) -> None: - request = self.client._build_request( + def test_request_extra_headers(self, client: Gcore) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1254,7 +1276,7 @@ def test_request_extra_headers(self) -> None: assert request.headers.get("X-Foo") == "Foo" # `extra_headers` takes priority over `default_headers` when keys clash - request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + request = client.with_options(default_headers={"X-Bar": "true"})._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1265,8 +1287,8 @@ def test_request_extra_headers(self) -> None: ) assert request.headers.get("X-Bar") == "false" - def test_request_extra_query(self) -> None: - request = self.client._build_request( + def test_request_extra_query(self, client: Gcore) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1279,7 +1301,7 @@ def test_request_extra_query(self) -> None: assert params == {"my_query_param": "Foo"} # if both `query` and `extra_query` are given, they are merged - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1293,7 +1315,7 @@ def test_request_extra_query(self) -> None: assert params == {"bar": "1", "foo": "2"} # `extra_query` takes priority over `query` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1336,7 +1358,7 @@ def test_multipart_repeating_array(self, async_client: AsyncGcore) -> None: ] @pytest.mark.respx(base_url=base_url) - async def test_basic_union_response(self, respx_mock: MockRouter) -> None: + async def test_basic_union_response(self, respx_mock: MockRouter, async_client: AsyncGcore) -> None: class Model1(BaseModel): name: str @@ -1345,12 +1367,12 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" @pytest.mark.respx(base_url=base_url) - async def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + async def test_union_response_different_types(self, respx_mock: MockRouter, async_client: AsyncGcore) -> None: """Union of objects with the same field name using a different type""" class Model1(BaseModel): @@ -1361,18 +1383,20 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) assert response.foo == 1 @pytest.mark.respx(base_url=base_url) - async def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + async def test_non_application_json_content_type_for_json_data( + self, respx_mock: MockRouter, async_client: AsyncGcore + ) -> None: """ Response that sets Content-Type to something other than application/json but returns json data """ @@ -1388,11 +1412,11 @@ class Model(BaseModel): ) ) - response = await self.client.get("/foo", cast_to=Model) + response = await async_client.get("/foo", cast_to=Model) assert isinstance(response, Model) assert response.foo == 2 - def test_base_url_setter(self) -> None: + async def test_base_url_setter(self) -> None: client = AsyncGcore(base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True) assert client.base_url == "https://example.com/from_init/" @@ -1400,7 +1424,9 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" - def test_base_url_env(self) -> None: + await client.close() + + async def test_base_url_env(self) -> None: with update_env(GCORE_BASE_URL="http://localhost:5000/from/env"): client = AsyncGcore(api_key=api_key, _strict_response_validation=True) assert client.base_url == "http://localhost:5000/from/env/" @@ -1420,7 +1446,7 @@ def test_base_url_env(self) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_trailing_slash(self, client: AsyncGcore) -> None: + async def test_base_url_trailing_slash(self, client: AsyncGcore) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1429,6 +1455,7 @@ def test_base_url_trailing_slash(self, client: AsyncGcore) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + await client.close() @pytest.mark.parametrize( "client", @@ -1445,7 +1472,7 @@ def test_base_url_trailing_slash(self, client: AsyncGcore) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_no_trailing_slash(self, client: AsyncGcore) -> None: + async def test_base_url_no_trailing_slash(self, client: AsyncGcore) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1454,6 +1481,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncGcore) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + await client.close() @pytest.mark.parametrize( "client", @@ -1470,7 +1498,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncGcore) -> None: ], ids=["standard", "custom http client"], ) - def test_absolute_request_url(self, client: AsyncGcore) -> None: + async def test_absolute_request_url(self, client: AsyncGcore) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1479,37 +1507,37 @@ def test_absolute_request_url(self, client: AsyncGcore) -> None: ), ) assert request.url == "https://myapi.com/foo" + await client.close() async def test_copied_client_does_not_close_http(self) -> None: - client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) - assert not client.is_closed() + test_client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + assert not test_client.is_closed() - copied = client.copy() - assert copied is not client + copied = test_client.copy() + assert copied is not test_client del copied await asyncio.sleep(0.2) - assert not client.is_closed() + assert not test_client.is_closed() async def test_client_context_manager(self) -> None: - client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) - async with client as c2: - assert c2 is client + test_client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) + async with test_client as c2: + assert c2 is test_client assert not c2.is_closed() - assert not client.is_closed() - assert client.is_closed() + assert not test_client.is_closed() + assert test_client.is_closed() @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + async def test_client_response_validation_error(self, respx_mock: MockRouter, async_client: AsyncGcore) -> None: class Model(BaseModel): foo: str respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) with pytest.raises(APIResponseValidationError) as exc: - await self.client.get("/foo", cast_to=Model) + await async_client.get("/foo", cast_to=Model) assert isinstance(exc.value.__cause__, ValidationError) @@ -1520,7 +1548,6 @@ async def test_client_max_retries_validation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: class Model(BaseModel): name: str @@ -1532,11 +1559,14 @@ class Model(BaseModel): with pytest.raises(APIResponseValidationError): await strict_client.get("/foo", cast_to=Model) - client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=False) + non_strict_client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=False) - response = await client.get("/foo", cast_to=Model) + response = await non_strict_client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] + await strict_client.close() + await non_strict_client.close() + @pytest.mark.parametrize( "remaining_retries,retry_after,timeout", [ @@ -1559,13 +1589,12 @@ class Model(BaseModel): ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) - @pytest.mark.asyncio - async def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: - client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True) - + async def test_parse_retry_after_header( + self, remaining_retries: int, retry_after: str, timeout: float, async_client: AsyncGcore + ) -> None: headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) - calculated = client._calculate_retry_timeout(remaining_retries, options, headers) + calculated = async_client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @@ -1576,7 +1605,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, with pytest.raises(APITimeoutError): await async_client.cloud.projects.with_streaming_response.create(name="New Project").__aenter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(async_client) == 0 @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -1585,12 +1614,11 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, with pytest.raises(APIStatusError): await async_client.cloud.projects.with_streaming_response.create(name="New Project").__aenter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(async_client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio @pytest.mark.parametrize("failure_mode", ["status", "exception"]) async def test_retries_taken( self, @@ -1622,7 +1650,6 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_omit_retry_count_header( self, async_client: AsyncGcore, failures_before_success: int, respx_mock: MockRouter ) -> None: @@ -1648,7 +1675,6 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("gcore._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_overwrite_retry_count_header( self, async_client: AsyncGcore, failures_before_success: int, respx_mock: MockRouter ) -> None: @@ -1698,26 +1724,26 @@ async def test_default_client_creation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - async def test_follow_redirects(self, respx_mock: MockRouter) -> None: + async def test_follow_redirects(self, respx_mock: MockRouter, async_client: AsyncGcore) -> None: # Test that the default follow_redirects=True allows following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) - response = await self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + response = await async_client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) assert response.status_code == 200 assert response.json() == {"status": "ok"} @pytest.mark.respx(base_url=base_url) - async def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + async def test_follow_redirects_disabled(self, respx_mock: MockRouter, async_client: AsyncGcore) -> None: # Test that follow_redirects=False prevents following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) with pytest.raises(APIStatusError) as exc_info: - await self.client.post( + await async_client.post( "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response ) From 50bd0cfd49563a93c0ab2dde1e1a7eab67633f5c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Oct 2025 14:25:37 +0000 Subject: [PATCH 412/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f535120f..4f5a18fa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-848b764e60807c1c1aedd39ebdbadd2ee63dcc6ae3910179cdfff3ef80429563.yml openapi_spec_hash: 04d6bac6704e464b0fa52af0cd0e18a2 -config_hash: 25b1dd444559d26e51bf85892358c0bc +config_hash: 4758209f53bb13d06f55e4cf6c952b6d From 6377d943a454b63f402c1dd5c6ecd994393065b2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Oct 2025 16:12:06 +0000 Subject: [PATCH 413/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4f5a18fa..c4fe28d4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-848b764e60807c1c1aedd39ebdbadd2ee63dcc6ae3910179cdfff3ef80429563.yml -openapi_spec_hash: 04d6bac6704e464b0fa52af0cd0e18a2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0346b042bad7a80c3a1d4281080d8196a2e7fe31d16555fa09a969c17135802d.yml +openapi_spec_hash: 89f372e20779803f35c14b4189960972 config_hash: 4758209f53bb13d06f55e4cf6c952b6d From c0be8d2e70183cd6230784239dea327b5ff9527e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 3 Nov 2025 10:12:06 +0000 Subject: [PATCH 414/592] feat(api): aggregated API specs update --- .stats.yml | 6 +- api.md | 42 +- src/gcore/_client.py | 9 - src/gcore/resources/__init__.py | 14 - src/gcore/resources/security/__init__.py | 75 -- src/gcore/resources/security/bgp_announces.py | 308 -------- src/gcore/resources/security/events.py | 234 ------- .../resources/security/profile_templates.py | 143 ---- src/gcore/resources/security/profiles.py | 661 ------------------ src/gcore/resources/security/security.py | 198 ------ src/gcore/types/security/__init__.py | 15 - .../security/bgp_announce_list_params.py | 18 - .../security/bgp_announce_list_response.py | 10 - .../security/bgp_announce_toggle_params.py | 16 - src/gcore/types/security/client_announce.py | 15 - src/gcore/types/security/client_profile.py | 56 -- .../types/security/client_profile_template.py | 43 -- src/gcore/types/security/client_view.py | 29 - src/gcore/types/security/event_list_params.py | 38 - .../types/security/profile_create_params.py | 24 - .../types/security/profile_list_params.py | 17 - .../types/security/profile_list_response.py | 10 - .../types/security/profile_recreate_params.py | 24 - .../types/security/profile_replace_params.py | 24 - .../profile_template_list_response.py | 10 - tests/api_resources/security/__init__.py | 1 - .../security/test_bgp_announces.py | 180 ----- tests/api_resources/security/test_events.py | 102 --- .../security/test_profile_templates.py | 74 -- tests/api_resources/security/test_profiles.py | 537 -------------- 30 files changed, 5 insertions(+), 2928 deletions(-) delete mode 100644 src/gcore/resources/security/__init__.py delete mode 100644 src/gcore/resources/security/bgp_announces.py delete mode 100644 src/gcore/resources/security/events.py delete mode 100644 src/gcore/resources/security/profile_templates.py delete mode 100644 src/gcore/resources/security/profiles.py delete mode 100644 src/gcore/resources/security/security.py delete mode 100644 src/gcore/types/security/bgp_announce_list_params.py delete mode 100644 src/gcore/types/security/bgp_announce_list_response.py delete mode 100644 src/gcore/types/security/bgp_announce_toggle_params.py delete mode 100644 src/gcore/types/security/client_announce.py delete mode 100644 src/gcore/types/security/client_profile.py delete mode 100644 src/gcore/types/security/client_profile_template.py delete mode 100644 src/gcore/types/security/client_view.py delete mode 100644 src/gcore/types/security/event_list_params.py delete mode 100644 src/gcore/types/security/profile_create_params.py delete mode 100644 src/gcore/types/security/profile_list_params.py delete mode 100644 src/gcore/types/security/profile_list_response.py delete mode 100644 src/gcore/types/security/profile_recreate_params.py delete mode 100644 src/gcore/types/security/profile_replace_params.py delete mode 100644 src/gcore/types/security/profile_template_list_response.py delete mode 100644 tests/api_resources/security/__init__.py delete mode 100644 tests/api_resources/security/test_bgp_announces.py delete mode 100644 tests/api_resources/security/test_events.py delete mode 100644 tests/api_resources/security/test_profile_templates.py delete mode 100644 tests/api_resources/security/test_profiles.py diff --git a/.stats.yml b/.stats.yml index c4fe28d4..d0525a7d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 609 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0346b042bad7a80c3a1d4281080d8196a2e7fe31d16555fa09a969c17135802d.yml -openapi_spec_hash: 89f372e20779803f35c14b4189960972 +configured_endpoints: 599 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-963021ac0cb8a12826d7e00d317340e71748a27c18553422a76d882d2e8ad389.yml +openapi_spec_hash: 0c1ea27cd584bf0d47fed367663053b2 config_hash: 4758209f53bb13d06f55e4cf6c952b6d diff --git a/api.md b/api.md index 6ff46915..2fe398c1 100644 --- a/api.md +++ b/api.md @@ -1789,60 +1789,22 @@ Methods: # Security -## Events - -Types: - -```python -from gcore.types.security import ClientView -``` - -Methods: - -- client.security.events.list(\*\*params) -> SyncOffsetPage[ClientView] - -## BgpAnnounces - -Types: - -```python -from gcore.types.security import ClientAnnounce, BgpAnnounceListResponse -``` - -Methods: - -- client.security.bgp_announces.list(\*\*params) -> BgpAnnounceListResponse -- client.security.bgp_announces.toggle(\*\*params) -> object - ## ProfileTemplates Types: ```python -from gcore.types.security import ClientProfileTemplate, ProfileTemplateListResponse +from gcore.types.security import ClientProfileTemplate ``` -Methods: - -- client.security.profile_templates.list() -> ProfileTemplateListResponse - ## Profiles Types: ```python -from gcore.types.security import ClientProfile, ProfileListResponse +from gcore.types.security import ClientProfile ``` -Methods: - -- client.security.profiles.create(\*\*params) -> ClientProfile -- client.security.profiles.list(\*\*params) -> ProfileListResponse -- client.security.profiles.delete(id) -> None -- client.security.profiles.get(id) -> ClientProfile -- client.security.profiles.recreate(id, \*\*params) -> ClientProfile -- client.security.profiles.replace(id, \*\*params) -> ClientProfile - # DNS Types: diff --git a/src/gcore/_client.py b/src/gcore/_client.py index d900f571..df7f4886 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -35,7 +35,6 @@ from .resources.cloud import cloud from .resources.storage import storage from .resources.fastedge import fastedge -from .resources.security import security from .resources.streaming import streaming __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Gcore", "AsyncGcore", "Client", "AsyncClient"] @@ -47,7 +46,6 @@ class Gcore(SyncAPIClient): iam: iam.IamResource fastedge: fastedge.FastedgeResource streaming: streaming.StreamingResource - security: security.SecurityResource dns: dns.DNSResource storage: storage.StorageResource cdn: cdn.CdnResource @@ -140,7 +138,6 @@ def __init__( self.iam = iam.IamResource(self) self.fastedge = fastedge.FastedgeResource(self) self.streaming = streaming.StreamingResource(self) - self.security = security.SecurityResource(self) self.dns = dns.DNSResource(self) self.storage = storage.StorageResource(self) self.cdn = cdn.CdnResource(self) @@ -284,7 +281,6 @@ class AsyncGcore(AsyncAPIClient): iam: iam.AsyncIamResource fastedge: fastedge.AsyncFastedgeResource streaming: streaming.AsyncStreamingResource - security: security.AsyncSecurityResource dns: dns.AsyncDNSResource storage: storage.AsyncStorageResource cdn: cdn.AsyncCdnResource @@ -377,7 +373,6 @@ def __init__( self.iam = iam.AsyncIamResource(self) self.fastedge = fastedge.AsyncFastedgeResource(self) self.streaming = streaming.AsyncStreamingResource(self) - self.security = security.AsyncSecurityResource(self) self.dns = dns.AsyncDNSResource(self) self.storage = storage.AsyncStorageResource(self) self.cdn = cdn.AsyncCdnResource(self) @@ -522,7 +517,6 @@ def __init__(self, client: Gcore) -> None: self.iam = iam.IamResourceWithRawResponse(client.iam) self.fastedge = fastedge.FastedgeResourceWithRawResponse(client.fastedge) self.streaming = streaming.StreamingResourceWithRawResponse(client.streaming) - self.security = security.SecurityResourceWithRawResponse(client.security) self.dns = dns.DNSResourceWithRawResponse(client.dns) self.storage = storage.StorageResourceWithRawResponse(client.storage) self.cdn = cdn.CdnResourceWithRawResponse(client.cdn) @@ -535,7 +529,6 @@ def __init__(self, client: AsyncGcore) -> None: self.iam = iam.AsyncIamResourceWithRawResponse(client.iam) self.fastedge = fastedge.AsyncFastedgeResourceWithRawResponse(client.fastedge) self.streaming = streaming.AsyncStreamingResourceWithRawResponse(client.streaming) - self.security = security.AsyncSecurityResourceWithRawResponse(client.security) self.dns = dns.AsyncDNSResourceWithRawResponse(client.dns) self.storage = storage.AsyncStorageResourceWithRawResponse(client.storage) self.cdn = cdn.AsyncCdnResourceWithRawResponse(client.cdn) @@ -548,7 +541,6 @@ def __init__(self, client: Gcore) -> None: self.iam = iam.IamResourceWithStreamingResponse(client.iam) self.fastedge = fastedge.FastedgeResourceWithStreamingResponse(client.fastedge) self.streaming = streaming.StreamingResourceWithStreamingResponse(client.streaming) - self.security = security.SecurityResourceWithStreamingResponse(client.security) self.dns = dns.DNSResourceWithStreamingResponse(client.dns) self.storage = storage.StorageResourceWithStreamingResponse(client.storage) self.cdn = cdn.CdnResourceWithStreamingResponse(client.cdn) @@ -561,7 +553,6 @@ def __init__(self, client: AsyncGcore) -> None: self.iam = iam.AsyncIamResourceWithStreamingResponse(client.iam) self.fastedge = fastedge.AsyncFastedgeResourceWithStreamingResponse(client.fastedge) self.streaming = streaming.AsyncStreamingResourceWithStreamingResponse(client.streaming) - self.security = security.AsyncSecurityResourceWithStreamingResponse(client.security) self.dns = dns.AsyncDNSResourceWithStreamingResponse(client.dns) self.storage = storage.AsyncStorageResourceWithStreamingResponse(client.storage) self.cdn = cdn.AsyncCdnResourceWithStreamingResponse(client.cdn) diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py index c8aaa6a7..d7b63884 100644 --- a/src/gcore/resources/__init__.py +++ b/src/gcore/resources/__init__.py @@ -56,14 +56,6 @@ FastedgeResourceWithStreamingResponse, AsyncFastedgeResourceWithStreamingResponse, ) -from .security import ( - SecurityResource, - AsyncSecurityResource, - SecurityResourceWithRawResponse, - AsyncSecurityResourceWithRawResponse, - SecurityResourceWithStreamingResponse, - AsyncSecurityResourceWithStreamingResponse, -) from .streaming import ( StreamingResource, AsyncStreamingResource, @@ -104,12 +96,6 @@ "AsyncStreamingResourceWithRawResponse", "StreamingResourceWithStreamingResponse", "AsyncStreamingResourceWithStreamingResponse", - "SecurityResource", - "AsyncSecurityResource", - "SecurityResourceWithRawResponse", - "AsyncSecurityResourceWithRawResponse", - "SecurityResourceWithStreamingResponse", - "AsyncSecurityResourceWithStreamingResponse", "DNSResource", "AsyncDNSResource", "DNSResourceWithRawResponse", diff --git a/src/gcore/resources/security/__init__.py b/src/gcore/resources/security/__init__.py deleted file mode 100644 index a1a7a5ea..00000000 --- a/src/gcore/resources/security/__init__.py +++ /dev/null @@ -1,75 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .events import ( - EventsResource, - AsyncEventsResource, - EventsResourceWithRawResponse, - AsyncEventsResourceWithRawResponse, - EventsResourceWithStreamingResponse, - AsyncEventsResourceWithStreamingResponse, -) -from .profiles import ( - ProfilesResource, - AsyncProfilesResource, - ProfilesResourceWithRawResponse, - AsyncProfilesResourceWithRawResponse, - ProfilesResourceWithStreamingResponse, - AsyncProfilesResourceWithStreamingResponse, -) -from .security import ( - SecurityResource, - AsyncSecurityResource, - SecurityResourceWithRawResponse, - AsyncSecurityResourceWithRawResponse, - SecurityResourceWithStreamingResponse, - AsyncSecurityResourceWithStreamingResponse, -) -from .bgp_announces import ( - BgpAnnouncesResource, - AsyncBgpAnnouncesResource, - BgpAnnouncesResourceWithRawResponse, - AsyncBgpAnnouncesResourceWithRawResponse, - BgpAnnouncesResourceWithStreamingResponse, - AsyncBgpAnnouncesResourceWithStreamingResponse, -) -from .profile_templates import ( - ProfileTemplatesResource, - AsyncProfileTemplatesResource, - ProfileTemplatesResourceWithRawResponse, - AsyncProfileTemplatesResourceWithRawResponse, - ProfileTemplatesResourceWithStreamingResponse, - AsyncProfileTemplatesResourceWithStreamingResponse, -) - -__all__ = [ - "EventsResource", - "AsyncEventsResource", - "EventsResourceWithRawResponse", - "AsyncEventsResourceWithRawResponse", - "EventsResourceWithStreamingResponse", - "AsyncEventsResourceWithStreamingResponse", - "BgpAnnouncesResource", - "AsyncBgpAnnouncesResource", - "BgpAnnouncesResourceWithRawResponse", - "AsyncBgpAnnouncesResourceWithRawResponse", - "BgpAnnouncesResourceWithStreamingResponse", - "AsyncBgpAnnouncesResourceWithStreamingResponse", - "ProfileTemplatesResource", - "AsyncProfileTemplatesResource", - "ProfileTemplatesResourceWithRawResponse", - "AsyncProfileTemplatesResourceWithRawResponse", - "ProfileTemplatesResourceWithStreamingResponse", - "AsyncProfileTemplatesResourceWithStreamingResponse", - "ProfilesResource", - "AsyncProfilesResource", - "ProfilesResourceWithRawResponse", - "AsyncProfilesResourceWithRawResponse", - "ProfilesResourceWithStreamingResponse", - "AsyncProfilesResourceWithStreamingResponse", - "SecurityResource", - "AsyncSecurityResource", - "SecurityResourceWithRawResponse", - "AsyncSecurityResourceWithRawResponse", - "SecurityResourceWithStreamingResponse", - "AsyncSecurityResourceWithStreamingResponse", -] diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py deleted file mode 100644 index 26b3bc96..00000000 --- a/src/gcore/resources/security/bgp_announces.py +++ /dev/null @@ -1,308 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Literal - -import httpx - -from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.security import bgp_announce_list_params, bgp_announce_toggle_params -from ...types.security.bgp_announce_list_response import BgpAnnounceListResponse - -__all__ = ["BgpAnnouncesResource", "AsyncBgpAnnouncesResource"] - - -class BgpAnnouncesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> BgpAnnouncesResourceWithRawResponse: - """ - 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 BgpAnnouncesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BgpAnnouncesResourceWithStreamingResponse: - """ - 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 BgpAnnouncesResourceWithStreamingResponse(self) - - def list( - self, - *, - announced: Optional[bool] | Omit = omit, - client_id: Optional[int] | Omit = omit, - origin: Optional[Literal["STATIC", "DYNAMIC"]] | Omit = omit, - site: Optional[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> BgpAnnounceListResponse: - """Get BGP announces filtered by parameters. - - Shows announces in active profiles, - meaning that to get a non-empty response, the client must have at least one - active profile. - - 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( - "/security/sifter/v2/protected_addresses/announces", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "announced": announced, - "client_id": client_id, - "origin": origin, - "site": site, - }, - bgp_announce_list_params.BgpAnnounceListParams, - ), - ), - cast_to=BgpAnnounceListResponse, - ) - - def toggle( - self, - *, - announce: str, - enabled: bool, - client_id: Optional[int] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: - """Change BGP announces (it can be enabled or disabled, but not created or - updated). - - Can be applied to already existing announces in active profiles, - meaning that the client must have at least one active profile. - - 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( - "/security/sifter/v2/protected_addresses/announces", - body=maybe_transform( - { - "announce": announce, - "enabled": enabled, - }, - bgp_announce_toggle_params.BgpAnnounceToggleParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"client_id": client_id}, bgp_announce_toggle_params.BgpAnnounceToggleParams), - ), - cast_to=object, - ) - - -class AsyncBgpAnnouncesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncBgpAnnouncesResourceWithRawResponse: - """ - 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 AsyncBgpAnnouncesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBgpAnnouncesResourceWithStreamingResponse: - """ - 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 AsyncBgpAnnouncesResourceWithStreamingResponse(self) - - async def list( - self, - *, - announced: Optional[bool] | Omit = omit, - client_id: Optional[int] | Omit = omit, - origin: Optional[Literal["STATIC", "DYNAMIC"]] | Omit = omit, - site: Optional[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> BgpAnnounceListResponse: - """Get BGP announces filtered by parameters. - - Shows announces in active profiles, - meaning that to get a non-empty response, the client must have at least one - active profile. - - 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( - "/security/sifter/v2/protected_addresses/announces", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "announced": announced, - "client_id": client_id, - "origin": origin, - "site": site, - }, - bgp_announce_list_params.BgpAnnounceListParams, - ), - ), - cast_to=BgpAnnounceListResponse, - ) - - async def toggle( - self, - *, - announce: str, - enabled: bool, - client_id: Optional[int] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: - """Change BGP announces (it can be enabled or disabled, but not created or - updated). - - Can be applied to already existing announces in active profiles, - meaning that the client must have at least one active profile. - - 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( - "/security/sifter/v2/protected_addresses/announces", - body=await async_maybe_transform( - { - "announce": announce, - "enabled": enabled, - }, - bgp_announce_toggle_params.BgpAnnounceToggleParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"client_id": client_id}, bgp_announce_toggle_params.BgpAnnounceToggleParams - ), - ), - cast_to=object, - ) - - -class BgpAnnouncesResourceWithRawResponse: - def __init__(self, bgp_announces: BgpAnnouncesResource) -> None: - self._bgp_announces = bgp_announces - - self.list = to_raw_response_wrapper( - bgp_announces.list, - ) - self.toggle = to_raw_response_wrapper( - bgp_announces.toggle, - ) - - -class AsyncBgpAnnouncesResourceWithRawResponse: - def __init__(self, bgp_announces: AsyncBgpAnnouncesResource) -> None: - self._bgp_announces = bgp_announces - - self.list = async_to_raw_response_wrapper( - bgp_announces.list, - ) - self.toggle = async_to_raw_response_wrapper( - bgp_announces.toggle, - ) - - -class BgpAnnouncesResourceWithStreamingResponse: - def __init__(self, bgp_announces: BgpAnnouncesResource) -> None: - self._bgp_announces = bgp_announces - - self.list = to_streamed_response_wrapper( - bgp_announces.list, - ) - self.toggle = to_streamed_response_wrapper( - bgp_announces.toggle, - ) - - -class AsyncBgpAnnouncesResourceWithStreamingResponse: - def __init__(self, bgp_announces: AsyncBgpAnnouncesResource) -> None: - self._bgp_announces = bgp_announces - - self.list = async_to_streamed_response_wrapper( - bgp_announces.list, - ) - self.toggle = async_to_streamed_response_wrapper( - bgp_announces.toggle, - ) diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py deleted file mode 100644 index e0699398..00000000 --- a/src/gcore/resources/security/events.py +++ /dev/null @@ -1,234 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Optional -from datetime import datetime -from typing_extensions import Literal - -import httpx - -from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...pagination import SyncOffsetPage, AsyncOffsetPage -from ..._base_client import AsyncPaginator, make_request_options -from ...types.security import event_list_params -from ...types.security.client_view import ClientView - -__all__ = ["EventsResource", "AsyncEventsResource"] - - -class EventsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> EventsResourceWithRawResponse: - """ - 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 EventsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EventsResourceWithStreamingResponse: - """ - 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 EventsResourceWithStreamingResponse(self) - - def list( - self, - *, - alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | Omit = omit, - date_from: Union[Union[str, datetime], str] | Omit = omit, - date_to: Union[Union[str, datetime], str] | Omit = omit, - limit: int | Omit = omit, - offset: int | Omit = omit, - ordering: Literal[ - "attack_start_time", - "-attack_start_time", - "attack_power_bps", - "-attack_power_bps", - "attack_power_pps", - "-attack_power_pps", - "number_of_ip_involved_in_attack", - "-number_of_ip_involved_in_attack", - "alert_type", - "-alert_type", - ] - | Omit = omit, - targeted_ip_addresses: Optional[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncOffsetPage[ClientView]: - """ - Event Logs Clients View - - 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_api_list( - "/security/notifier/v1/event_logs", - page=SyncOffsetPage[ClientView], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "alert_type": alert_type, - "date_from": date_from, - "date_to": date_to, - "limit": limit, - "offset": offset, - "ordering": ordering, - "targeted_ip_addresses": targeted_ip_addresses, - }, - event_list_params.EventListParams, - ), - ), - model=ClientView, - ) - - -class AsyncEventsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: - """ - 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 AsyncEventsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: - """ - 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 AsyncEventsResourceWithStreamingResponse(self) - - def list( - self, - *, - alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | Omit = omit, - date_from: Union[Union[str, datetime], str] | Omit = omit, - date_to: Union[Union[str, datetime], str] | Omit = omit, - limit: int | Omit = omit, - offset: int | Omit = omit, - ordering: Literal[ - "attack_start_time", - "-attack_start_time", - "attack_power_bps", - "-attack_power_bps", - "attack_power_pps", - "-attack_power_pps", - "number_of_ip_involved_in_attack", - "-number_of_ip_involved_in_attack", - "alert_type", - "-alert_type", - ] - | Omit = omit, - targeted_ip_addresses: Optional[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[ClientView, AsyncOffsetPage[ClientView]]: - """ - Event Logs Clients View - - 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_api_list( - "/security/notifier/v1/event_logs", - page=AsyncOffsetPage[ClientView], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "alert_type": alert_type, - "date_from": date_from, - "date_to": date_to, - "limit": limit, - "offset": offset, - "ordering": ordering, - "targeted_ip_addresses": targeted_ip_addresses, - }, - event_list_params.EventListParams, - ), - ), - model=ClientView, - ) - - -class EventsResourceWithRawResponse: - def __init__(self, events: EventsResource) -> None: - self._events = events - - self.list = to_raw_response_wrapper( - events.list, - ) - - -class AsyncEventsResourceWithRawResponse: - def __init__(self, events: AsyncEventsResource) -> None: - self._events = events - - self.list = async_to_raw_response_wrapper( - events.list, - ) - - -class EventsResourceWithStreamingResponse: - def __init__(self, events: EventsResource) -> None: - self._events = events - - self.list = to_streamed_response_wrapper( - events.list, - ) - - -class AsyncEventsResourceWithStreamingResponse: - def __init__(self, events: AsyncEventsResource) -> None: - self._events = events - - self.list = async_to_streamed_response_wrapper( - events.list, - ) diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py deleted file mode 100644 index 307f3c0d..00000000 --- a/src/gcore/resources/security/profile_templates.py +++ /dev/null @@ -1,143 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..._types import Body, Query, Headers, NotGiven, not_given -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.security.profile_template_list_response import ProfileTemplateListResponse - -__all__ = ["ProfileTemplatesResource", "AsyncProfileTemplatesResource"] - - -class ProfileTemplatesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ProfileTemplatesResourceWithRawResponse: - """ - 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 ProfileTemplatesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ProfileTemplatesResourceWithStreamingResponse: - """ - 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 ProfileTemplatesResourceWithStreamingResponse(self) - - def list( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ProfileTemplateListResponse: - """Get list of profile templates. - - Profile template is used as a template to create - profile. Client receives only common and created for him profile templates. - """ - return self._get( - "/security/iaas/profile-templates", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProfileTemplateListResponse, - ) - - -class AsyncProfileTemplatesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncProfileTemplatesResourceWithRawResponse: - """ - 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 AsyncProfileTemplatesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncProfileTemplatesResourceWithStreamingResponse: - """ - 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 AsyncProfileTemplatesResourceWithStreamingResponse(self) - - async def list( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ProfileTemplateListResponse: - """Get list of profile templates. - - Profile template is used as a template to create - profile. Client receives only common and created for him profile templates. - """ - return await self._get( - "/security/iaas/profile-templates", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProfileTemplateListResponse, - ) - - -class ProfileTemplatesResourceWithRawResponse: - def __init__(self, profile_templates: ProfileTemplatesResource) -> None: - self._profile_templates = profile_templates - - self.list = to_raw_response_wrapper( - profile_templates.list, - ) - - -class AsyncProfileTemplatesResourceWithRawResponse: - def __init__(self, profile_templates: AsyncProfileTemplatesResource) -> None: - self._profile_templates = profile_templates - - self.list = async_to_raw_response_wrapper( - profile_templates.list, - ) - - -class ProfileTemplatesResourceWithStreamingResponse: - def __init__(self, profile_templates: ProfileTemplatesResource) -> None: - self._profile_templates = profile_templates - - self.list = to_streamed_response_wrapper( - profile_templates.list, - ) - - -class AsyncProfileTemplatesResourceWithStreamingResponse: - def __init__(self, profile_templates: AsyncProfileTemplatesResource) -> None: - self._profile_templates = profile_templates - - self.list = async_to_streamed_response_wrapper( - profile_templates.list, - ) diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py deleted file mode 100644 index 2ddf3257..00000000 --- a/src/gcore/resources/security/profiles.py +++ /dev/null @@ -1,661 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional - -import httpx - -from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.security import ( - profile_list_params, - profile_create_params, - profile_replace_params, - profile_recreate_params, -) -from ...types.security.client_profile import ClientProfile -from ...types.security.profile_list_response import ProfileListResponse - -__all__ = ["ProfilesResource", "AsyncProfilesResource"] - - -class ProfilesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ProfilesResourceWithRawResponse: - """ - 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 ProfilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ProfilesResourceWithStreamingResponse: - """ - 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 ProfilesResourceWithStreamingResponse(self) - - def create( - self, - *, - fields: Iterable[profile_create_params.Field], - profile_template: int, - site: str, - ip_address: Optional[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ClientProfile: - """Create protection profile. - - Protection is enabled at the same time as profile is - created - - 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( - "/security/iaas/v2/profiles", - body=maybe_transform( - { - "fields": fields, - "profile_template": profile_template, - "site": site, - "ip_address": ip_address, - }, - profile_create_params.ProfileCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ClientProfile, - ) - - def list( - self, - *, - exclude_empty_address: bool | Omit = omit, - include_deleted: bool | Omit = omit, - ip_address: str | Omit = omit, - site: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ProfileListResponse: - """Get list of protection profiles. - - Client receives only profiles created by him - - 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( - "/security/iaas/v2/profiles", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "exclude_empty_address": exclude_empty_address, - "include_deleted": include_deleted, - "ip_address": ip_address, - "site": site, - }, - profile_list_params.ProfileListParams, - ), - ), - cast_to=ProfileListResponse, - ) - - def delete( - self, - id: int, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """Delete protection profile. - - Protection is disabled at the same time as profile is - deleted - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._delete( - f"/security/iaas/v2/profiles/{id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - def get( - self, - id: int, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ClientProfile: - """ - Get profile by id - - 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"/security/iaas/v2/profiles/{id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ClientProfile, - ) - - def recreate( - self, - id: int, - *, - fields: Iterable[profile_recreate_params.Field], - profile_template: int, - ip_address: Optional[str] | Omit = omit, - site: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ClientProfile: - """ - Recreate profile with another profile template (for other cases use detail API) - - 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"/security/iaas/v2/profiles/{id}/recreate", - body=maybe_transform( - { - "fields": fields, - "profile_template": profile_template, - "ip_address": ip_address, - "site": site, - }, - profile_recreate_params.ProfileRecreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ClientProfile, - ) - - def replace( - self, - id: int, - *, - fields: Iterable[profile_replace_params.Field], - profile_template: int, - ip_address: Optional[str] | Omit = omit, - site: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ClientProfile: - """Update profile. - - Protection policies are updated at the same time as profile - updated - - 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"/security/iaas/v2/profiles/{id}", - body=maybe_transform( - { - "fields": fields, - "profile_template": profile_template, - "ip_address": ip_address, - "site": site, - }, - profile_replace_params.ProfileReplaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ClientProfile, - ) - - -class AsyncProfilesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncProfilesResourceWithRawResponse: - """ - 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 AsyncProfilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncProfilesResourceWithStreamingResponse: - """ - 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 AsyncProfilesResourceWithStreamingResponse(self) - - async def create( - self, - *, - fields: Iterable[profile_create_params.Field], - profile_template: int, - site: str, - ip_address: Optional[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ClientProfile: - """Create protection profile. - - Protection is enabled at the same time as profile is - created - - 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( - "/security/iaas/v2/profiles", - body=await async_maybe_transform( - { - "fields": fields, - "profile_template": profile_template, - "site": site, - "ip_address": ip_address, - }, - profile_create_params.ProfileCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ClientProfile, - ) - - async def list( - self, - *, - exclude_empty_address: bool | Omit = omit, - include_deleted: bool | Omit = omit, - ip_address: str | Omit = omit, - site: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ProfileListResponse: - """Get list of protection profiles. - - Client receives only profiles created by him - - 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( - "/security/iaas/v2/profiles", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "exclude_empty_address": exclude_empty_address, - "include_deleted": include_deleted, - "ip_address": ip_address, - "site": site, - }, - profile_list_params.ProfileListParams, - ), - ), - cast_to=ProfileListResponse, - ) - - async def delete( - self, - id: int, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """Delete protection profile. - - Protection is disabled at the same time as profile is - deleted - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._delete( - f"/security/iaas/v2/profiles/{id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - async def get( - self, - id: int, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ClientProfile: - """ - Get profile by id - - 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"/security/iaas/v2/profiles/{id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ClientProfile, - ) - - async def recreate( - self, - id: int, - *, - fields: Iterable[profile_recreate_params.Field], - profile_template: int, - ip_address: Optional[str] | Omit = omit, - site: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ClientProfile: - """ - Recreate profile with another profile template (for other cases use detail API) - - 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"/security/iaas/v2/profiles/{id}/recreate", - body=await async_maybe_transform( - { - "fields": fields, - "profile_template": profile_template, - "ip_address": ip_address, - "site": site, - }, - profile_recreate_params.ProfileRecreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ClientProfile, - ) - - async def replace( - self, - id: int, - *, - fields: Iterable[profile_replace_params.Field], - profile_template: int, - ip_address: Optional[str] | Omit = omit, - site: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ClientProfile: - """Update profile. - - Protection policies are updated at the same time as profile - updated - - 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"/security/iaas/v2/profiles/{id}", - body=await async_maybe_transform( - { - "fields": fields, - "profile_template": profile_template, - "ip_address": ip_address, - "site": site, - }, - profile_replace_params.ProfileReplaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ClientProfile, - ) - - -class ProfilesResourceWithRawResponse: - def __init__(self, profiles: ProfilesResource) -> None: - self._profiles = profiles - - self.create = to_raw_response_wrapper( - profiles.create, - ) - self.list = to_raw_response_wrapper( - profiles.list, - ) - self.delete = to_raw_response_wrapper( - profiles.delete, - ) - self.get = to_raw_response_wrapper( - profiles.get, - ) - self.recreate = to_raw_response_wrapper( - profiles.recreate, - ) - self.replace = to_raw_response_wrapper( - profiles.replace, - ) - - -class AsyncProfilesResourceWithRawResponse: - def __init__(self, profiles: AsyncProfilesResource) -> None: - self._profiles = profiles - - self.create = async_to_raw_response_wrapper( - profiles.create, - ) - self.list = async_to_raw_response_wrapper( - profiles.list, - ) - self.delete = async_to_raw_response_wrapper( - profiles.delete, - ) - self.get = async_to_raw_response_wrapper( - profiles.get, - ) - self.recreate = async_to_raw_response_wrapper( - profiles.recreate, - ) - self.replace = async_to_raw_response_wrapper( - profiles.replace, - ) - - -class ProfilesResourceWithStreamingResponse: - def __init__(self, profiles: ProfilesResource) -> None: - self._profiles = profiles - - self.create = to_streamed_response_wrapper( - profiles.create, - ) - self.list = to_streamed_response_wrapper( - profiles.list, - ) - self.delete = to_streamed_response_wrapper( - profiles.delete, - ) - self.get = to_streamed_response_wrapper( - profiles.get, - ) - self.recreate = to_streamed_response_wrapper( - profiles.recreate, - ) - self.replace = to_streamed_response_wrapper( - profiles.replace, - ) - - -class AsyncProfilesResourceWithStreamingResponse: - def __init__(self, profiles: AsyncProfilesResource) -> None: - self._profiles = profiles - - self.create = async_to_streamed_response_wrapper( - profiles.create, - ) - self.list = async_to_streamed_response_wrapper( - profiles.list, - ) - self.delete = async_to_streamed_response_wrapper( - profiles.delete, - ) - self.get = async_to_streamed_response_wrapper( - profiles.get, - ) - self.recreate = async_to_streamed_response_wrapper( - profiles.recreate, - ) - self.replace = async_to_streamed_response_wrapper( - profiles.replace, - ) diff --git a/src/gcore/resources/security/security.py b/src/gcore/resources/security/security.py deleted file mode 100644 index 2d0d9c11..00000000 --- a/src/gcore/resources/security/security.py +++ /dev/null @@ -1,198 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .events import ( - EventsResource, - AsyncEventsResource, - EventsResourceWithRawResponse, - AsyncEventsResourceWithRawResponse, - EventsResourceWithStreamingResponse, - AsyncEventsResourceWithStreamingResponse, -) -from .profiles import ( - ProfilesResource, - AsyncProfilesResource, - ProfilesResourceWithRawResponse, - AsyncProfilesResourceWithRawResponse, - ProfilesResourceWithStreamingResponse, - AsyncProfilesResourceWithStreamingResponse, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from .bgp_announces import ( - BgpAnnouncesResource, - AsyncBgpAnnouncesResource, - BgpAnnouncesResourceWithRawResponse, - AsyncBgpAnnouncesResourceWithRawResponse, - BgpAnnouncesResourceWithStreamingResponse, - AsyncBgpAnnouncesResourceWithStreamingResponse, -) -from .profile_templates import ( - ProfileTemplatesResource, - AsyncProfileTemplatesResource, - ProfileTemplatesResourceWithRawResponse, - AsyncProfileTemplatesResourceWithRawResponse, - ProfileTemplatesResourceWithStreamingResponse, - AsyncProfileTemplatesResourceWithStreamingResponse, -) - -__all__ = ["SecurityResource", "AsyncSecurityResource"] - - -class SecurityResource(SyncAPIResource): - @cached_property - def events(self) -> EventsResource: - return EventsResource(self._client) - - @cached_property - def bgp_announces(self) -> BgpAnnouncesResource: - return BgpAnnouncesResource(self._client) - - @cached_property - def profile_templates(self) -> ProfileTemplatesResource: - return ProfileTemplatesResource(self._client) - - @cached_property - def profiles(self) -> ProfilesResource: - return ProfilesResource(self._client) - - @cached_property - def with_raw_response(self) -> SecurityResourceWithRawResponse: - """ - 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 SecurityResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SecurityResourceWithStreamingResponse: - """ - 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 SecurityResourceWithStreamingResponse(self) - - -class AsyncSecurityResource(AsyncAPIResource): - @cached_property - def events(self) -> AsyncEventsResource: - return AsyncEventsResource(self._client) - - @cached_property - def bgp_announces(self) -> AsyncBgpAnnouncesResource: - return AsyncBgpAnnouncesResource(self._client) - - @cached_property - def profile_templates(self) -> AsyncProfileTemplatesResource: - return AsyncProfileTemplatesResource(self._client) - - @cached_property - def profiles(self) -> AsyncProfilesResource: - return AsyncProfilesResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncSecurityResourceWithRawResponse: - """ - 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 AsyncSecurityResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSecurityResourceWithStreamingResponse: - """ - 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 AsyncSecurityResourceWithStreamingResponse(self) - - -class SecurityResourceWithRawResponse: - def __init__(self, security: SecurityResource) -> None: - self._security = security - - @cached_property - def events(self) -> EventsResourceWithRawResponse: - return EventsResourceWithRawResponse(self._security.events) - - @cached_property - def bgp_announces(self) -> BgpAnnouncesResourceWithRawResponse: - return BgpAnnouncesResourceWithRawResponse(self._security.bgp_announces) - - @cached_property - def profile_templates(self) -> ProfileTemplatesResourceWithRawResponse: - return ProfileTemplatesResourceWithRawResponse(self._security.profile_templates) - - @cached_property - def profiles(self) -> ProfilesResourceWithRawResponse: - return ProfilesResourceWithRawResponse(self._security.profiles) - - -class AsyncSecurityResourceWithRawResponse: - def __init__(self, security: AsyncSecurityResource) -> None: - self._security = security - - @cached_property - def events(self) -> AsyncEventsResourceWithRawResponse: - return AsyncEventsResourceWithRawResponse(self._security.events) - - @cached_property - def bgp_announces(self) -> AsyncBgpAnnouncesResourceWithRawResponse: - return AsyncBgpAnnouncesResourceWithRawResponse(self._security.bgp_announces) - - @cached_property - def profile_templates(self) -> AsyncProfileTemplatesResourceWithRawResponse: - return AsyncProfileTemplatesResourceWithRawResponse(self._security.profile_templates) - - @cached_property - def profiles(self) -> AsyncProfilesResourceWithRawResponse: - return AsyncProfilesResourceWithRawResponse(self._security.profiles) - - -class SecurityResourceWithStreamingResponse: - def __init__(self, security: SecurityResource) -> None: - self._security = security - - @cached_property - def events(self) -> EventsResourceWithStreamingResponse: - return EventsResourceWithStreamingResponse(self._security.events) - - @cached_property - def bgp_announces(self) -> BgpAnnouncesResourceWithStreamingResponse: - return BgpAnnouncesResourceWithStreamingResponse(self._security.bgp_announces) - - @cached_property - def profile_templates(self) -> ProfileTemplatesResourceWithStreamingResponse: - return ProfileTemplatesResourceWithStreamingResponse(self._security.profile_templates) - - @cached_property - def profiles(self) -> ProfilesResourceWithStreamingResponse: - return ProfilesResourceWithStreamingResponse(self._security.profiles) - - -class AsyncSecurityResourceWithStreamingResponse: - def __init__(self, security: AsyncSecurityResource) -> None: - self._security = security - - @cached_property - def events(self) -> AsyncEventsResourceWithStreamingResponse: - return AsyncEventsResourceWithStreamingResponse(self._security.events) - - @cached_property - def bgp_announces(self) -> AsyncBgpAnnouncesResourceWithStreamingResponse: - return AsyncBgpAnnouncesResourceWithStreamingResponse(self._security.bgp_announces) - - @cached_property - def profile_templates(self) -> AsyncProfileTemplatesResourceWithStreamingResponse: - return AsyncProfileTemplatesResourceWithStreamingResponse(self._security.profile_templates) - - @cached_property - def profiles(self) -> AsyncProfilesResourceWithStreamingResponse: - return AsyncProfilesResourceWithStreamingResponse(self._security.profiles) diff --git a/src/gcore/types/security/__init__.py b/src/gcore/types/security/__init__.py index 4994ea70..f8ee8b14 100644 --- a/src/gcore/types/security/__init__.py +++ b/src/gcore/types/security/__init__.py @@ -1,18 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .client_view import ClientView as ClientView -from .client_profile import ClientProfile as ClientProfile -from .client_announce import ClientAnnounce as ClientAnnounce -from .event_list_params import EventListParams as EventListParams -from .profile_list_params import ProfileListParams as ProfileListParams -from .profile_create_params import ProfileCreateParams as ProfileCreateParams -from .profile_list_response import ProfileListResponse as ProfileListResponse -from .profile_replace_params import ProfileReplaceParams as ProfileReplaceParams -from .client_profile_template import ClientProfileTemplate as ClientProfileTemplate -from .profile_recreate_params import ProfileRecreateParams as ProfileRecreateParams -from .bgp_announce_list_params import BgpAnnounceListParams as BgpAnnounceListParams -from .bgp_announce_list_response import BgpAnnounceListResponse as BgpAnnounceListResponse -from .bgp_announce_toggle_params import BgpAnnounceToggleParams as BgpAnnounceToggleParams -from .profile_template_list_response import ProfileTemplateListResponse as ProfileTemplateListResponse diff --git a/src/gcore/types/security/bgp_announce_list_params.py b/src/gcore/types/security/bgp_announce_list_params.py deleted file mode 100644 index 390464fe..00000000 --- a/src/gcore/types/security/bgp_announce_list_params.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Literal, TypedDict - -__all__ = ["BgpAnnounceListParams"] - - -class BgpAnnounceListParams(TypedDict, total=False): - announced: Optional[bool] - - client_id: Optional[int] - - origin: Optional[Literal["STATIC", "DYNAMIC"]] - - site: Optional[str] diff --git a/src/gcore/types/security/bgp_announce_list_response.py b/src/gcore/types/security/bgp_announce_list_response.py deleted file mode 100644 index 6981ba90..00000000 --- a/src/gcore/types/security/bgp_announce_list_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import TypeAlias - -from .client_announce import ClientAnnounce - -__all__ = ["BgpAnnounceListResponse"] - -BgpAnnounceListResponse: TypeAlias = List[ClientAnnounce] diff --git a/src/gcore/types/security/bgp_announce_toggle_params.py b/src/gcore/types/security/bgp_announce_toggle_params.py deleted file mode 100644 index 4c5dd1b6..00000000 --- a/src/gcore/types/security/bgp_announce_toggle_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Required, TypedDict - -__all__ = ["BgpAnnounceToggleParams"] - - -class BgpAnnounceToggleParams(TypedDict, total=False): - announce: Required[str] - - enabled: Required[bool] - - client_id: Optional[int] diff --git a/src/gcore/types/security/client_announce.py b/src/gcore/types/security/client_announce.py deleted file mode 100644 index ef276615..00000000 --- a/src/gcore/types/security/client_announce.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel - -__all__ = ["ClientAnnounce"] - - -class ClientAnnounce(BaseModel): - announced: List[str] - - client_id: int - - not_announced: List[str] diff --git a/src/gcore/types/security/client_profile.py b/src/gcore/types/security/client_profile.py deleted file mode 100644 index e02111b5..00000000 --- a/src/gcore/types/security/client_profile.py +++ /dev/null @@ -1,56 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional - -from ..._models import BaseModel -from .client_profile_template import ClientProfileTemplate - -__all__ = ["ClientProfile", "Field", "Options"] - - -class Field(BaseModel): - id: int - - base_field: int - - default: str - - description: str - - field_type: str - - name: str - - required: bool - - validation_schema: Dict[str, object] - - field_value: Optional[object] = None - - -class Options(BaseModel): - active: bool - - bgp: bool - - price: str - - -class ClientProfile(BaseModel): - id: int - - fields: List[Field] - - options: Options - - plan: str - - profile_template: ClientProfileTemplate - - protocols: List[Dict[str, object]] - - site: str - - status: Dict[str, object] - - ip_address: Optional[str] = None diff --git a/src/gcore/types/security/client_profile_template.py b/src/gcore/types/security/client_profile_template.py deleted file mode 100644 index 4ea63e14..00000000 --- a/src/gcore/types/security/client_profile_template.py +++ /dev/null @@ -1,43 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["ClientProfileTemplate", "Field"] - - -class Field(BaseModel): - id: int - - name: str - - default: Optional[str] = None - - description: Optional[str] = None - - field_type: Optional[Literal["int", "bool", "str"]] = None - - required: Optional[bool] = None - - validation_schema: Optional[Dict[str, object]] = None - - -class ClientProfileTemplate(BaseModel): - id: int - - created: datetime - - fields: List[Field] - - name: str - - version: str - - base_template: Optional[int] = None - - description: Optional[str] = None - - template_sifter: Optional[str] = None diff --git a/src/gcore/types/security/client_view.py b/src/gcore/types/security/client_view.py deleted file mode 100644 index 802060ab..00000000 --- a/src/gcore/types/security/client_view.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["ClientView"] - - -class ClientView(BaseModel): - id: str - - alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] = None - - attack_power_bps: Optional[float] = None - - attack_power_pps: Optional[float] = None - - attack_start_time: Optional[datetime] = None - - client_id: Optional[int] = None - - notification_type: Optional[str] = None - - number_of_ip_involved_in_attack: Optional[int] = None - - targeted_ip_addresses: Optional[str] = None diff --git a/src/gcore/types/security/event_list_params.py b/src/gcore/types/security/event_list_params.py deleted file mode 100644 index 0bd703c3..00000000 --- a/src/gcore/types/security/event_list_params.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Optional -from datetime import datetime -from typing_extensions import Literal, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["EventListParams"] - - -class EventListParams(TypedDict, total=False): - alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] - - date_from: Annotated[Union[Union[str, datetime], str], PropertyInfo(format="iso8601")] - - date_to: Annotated[Union[Union[str, datetime], str], PropertyInfo(format="iso8601")] - - limit: int - - offset: int - - ordering: Literal[ - "attack_start_time", - "-attack_start_time", - "attack_power_bps", - "-attack_power_bps", - "attack_power_pps", - "-attack_power_pps", - "number_of_ip_involved_in_attack", - "-number_of_ip_involved_in_attack", - "alert_type", - "-alert_type", - ] - - targeted_ip_addresses: Optional[str] diff --git a/src/gcore/types/security/profile_create_params.py b/src/gcore/types/security/profile_create_params.py deleted file mode 100644 index ad7b982c..00000000 --- a/src/gcore/types/security/profile_create_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Required, TypedDict - -__all__ = ["ProfileCreateParams", "Field"] - - -class ProfileCreateParams(TypedDict, total=False): - fields: Required[Iterable[Field]] - - profile_template: Required[int] - - site: Required[str] - - ip_address: Optional[str] - - -class Field(TypedDict, total=False): - base_field: Required[int] - - field_value: object diff --git a/src/gcore/types/security/profile_list_params.py b/src/gcore/types/security/profile_list_params.py deleted file mode 100644 index e54f232f..00000000 --- a/src/gcore/types/security/profile_list_params.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["ProfileListParams"] - - -class ProfileListParams(TypedDict, total=False): - exclude_empty_address: bool - - include_deleted: bool - - ip_address: str - - site: str diff --git a/src/gcore/types/security/profile_list_response.py b/src/gcore/types/security/profile_list_response.py deleted file mode 100644 index 816021c8..00000000 --- a/src/gcore/types/security/profile_list_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import TypeAlias - -from .client_profile import ClientProfile - -__all__ = ["ProfileListResponse"] - -ProfileListResponse: TypeAlias = List[ClientProfile] diff --git a/src/gcore/types/security/profile_recreate_params.py b/src/gcore/types/security/profile_recreate_params.py deleted file mode 100644 index e1dd3d10..00000000 --- a/src/gcore/types/security/profile_recreate_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Required, TypedDict - -__all__ = ["ProfileRecreateParams", "Field"] - - -class ProfileRecreateParams(TypedDict, total=False): - fields: Required[Iterable[Field]] - - profile_template: Required[int] - - ip_address: Optional[str] - - site: str - - -class Field(TypedDict, total=False): - base_field: Required[int] - - field_value: object diff --git a/src/gcore/types/security/profile_replace_params.py b/src/gcore/types/security/profile_replace_params.py deleted file mode 100644 index 9684dffd..00000000 --- a/src/gcore/types/security/profile_replace_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Required, TypedDict - -__all__ = ["ProfileReplaceParams", "Field"] - - -class ProfileReplaceParams(TypedDict, total=False): - fields: Required[Iterable[Field]] - - profile_template: Required[int] - - ip_address: Optional[str] - - site: str - - -class Field(TypedDict, total=False): - base_field: Required[int] - - field_value: object diff --git a/src/gcore/types/security/profile_template_list_response.py b/src/gcore/types/security/profile_template_list_response.py deleted file mode 100644 index 2264e970..00000000 --- a/src/gcore/types/security/profile_template_list_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import TypeAlias - -from .client_profile_template import ClientProfileTemplate - -__all__ = ["ProfileTemplateListResponse"] - -ProfileTemplateListResponse: TypeAlias = List[ClientProfileTemplate] diff --git a/tests/api_resources/security/__init__.py b/tests/api_resources/security/__init__.py deleted file mode 100644 index fd8019a9..00000000 --- a/tests/api_resources/security/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/security/test_bgp_announces.py b/tests/api_resources/security/test_bgp_announces.py deleted file mode 100644 index c1115976..00000000 --- a/tests/api_resources/security/test_bgp_announces.py +++ /dev/null @@ -1,180 +0,0 @@ -# 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.security import BgpAnnounceListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestBgpAnnounces: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Gcore) -> None: - bgp_announce = client.security.bgp_announces.list() - assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Gcore) -> None: - bgp_announce = client.security.bgp_announces.list( - announced=True, - client_id=0, - origin="STATIC", - site="x", - ) - assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Gcore) -> None: - response = client.security.bgp_announces.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bgp_announce = response.parse() - assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Gcore) -> None: - with client.security.bgp_announces.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bgp_announce = response.parse() - assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_toggle(self, client: Gcore) -> None: - bgp_announce = client.security.bgp_announces.toggle( - announce="192.9.9.1/32", - enabled=True, - ) - assert_matches_type(object, bgp_announce, path=["response"]) - - @parametrize - def test_method_toggle_with_all_params(self, client: Gcore) -> None: - bgp_announce = client.security.bgp_announces.toggle( - announce="192.9.9.1/32", - enabled=True, - client_id=0, - ) - assert_matches_type(object, bgp_announce, path=["response"]) - - @parametrize - def test_raw_response_toggle(self, client: Gcore) -> None: - response = client.security.bgp_announces.with_raw_response.toggle( - announce="192.9.9.1/32", - enabled=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bgp_announce = response.parse() - assert_matches_type(object, bgp_announce, path=["response"]) - - @parametrize - def test_streaming_response_toggle(self, client: Gcore) -> None: - with client.security.bgp_announces.with_streaming_response.toggle( - announce="192.9.9.1/32", - enabled=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bgp_announce = response.parse() - assert_matches_type(object, bgp_announce, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncBgpAnnounces: - 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: - bgp_announce = await async_client.security.bgp_announces.list() - assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - bgp_announce = await async_client.security.bgp_announces.list( - announced=True, - client_id=0, - origin="STATIC", - site="x", - ) - assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.security.bgp_announces.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bgp_announce = await response.parse() - assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.security.bgp_announces.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bgp_announce = await response.parse() - assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_toggle(self, async_client: AsyncGcore) -> None: - bgp_announce = await async_client.security.bgp_announces.toggle( - announce="192.9.9.1/32", - enabled=True, - ) - assert_matches_type(object, bgp_announce, path=["response"]) - - @parametrize - async def test_method_toggle_with_all_params(self, async_client: AsyncGcore) -> None: - bgp_announce = await async_client.security.bgp_announces.toggle( - announce="192.9.9.1/32", - enabled=True, - client_id=0, - ) - assert_matches_type(object, bgp_announce, path=["response"]) - - @parametrize - async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: - response = await async_client.security.bgp_announces.with_raw_response.toggle( - announce="192.9.9.1/32", - enabled=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bgp_announce = await response.parse() - assert_matches_type(object, bgp_announce, path=["response"]) - - @parametrize - async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: - async with async_client.security.bgp_announces.with_streaming_response.toggle( - announce="192.9.9.1/32", - enabled=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bgp_announce = await response.parse() - assert_matches_type(object, bgp_announce, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/security/test_events.py b/tests/api_resources/security/test_events.py deleted file mode 100644 index 650de2cf..00000000 --- a/tests/api_resources/security/test_events.py +++ /dev/null @@ -1,102 +0,0 @@ -# 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._utils import parse_datetime -from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.security import ClientView - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestEvents: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Gcore) -> None: - event = client.security.events.list() - assert_matches_type(SyncOffsetPage[ClientView], event, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Gcore) -> None: - event = client.security.events.list( - alert_type="ddos_alert", - date_from=parse_datetime("2019-12-27T18:11:19.117Z"), - date_to=parse_datetime("2019-12-27T18:11:19.117Z"), - limit=1, - offset=0, - ordering="attack_start_time", - targeted_ip_addresses="targeted_ip_addresses", - ) - assert_matches_type(SyncOffsetPage[ClientView], event, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Gcore) -> None: - response = client.security.events.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(SyncOffsetPage[ClientView], event, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Gcore) -> None: - with client.security.events.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = response.parse() - assert_matches_type(SyncOffsetPage[ClientView], event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncEvents: - 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: - event = await async_client.security.events.list() - assert_matches_type(AsyncOffsetPage[ClientView], event, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - event = await async_client.security.events.list( - alert_type="ddos_alert", - date_from=parse_datetime("2019-12-27T18:11:19.117Z"), - date_to=parse_datetime("2019-12-27T18:11:19.117Z"), - limit=1, - offset=0, - ordering="attack_start_time", - targeted_ip_addresses="targeted_ip_addresses", - ) - assert_matches_type(AsyncOffsetPage[ClientView], event, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.security.events.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(AsyncOffsetPage[ClientView], event, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.security.events.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = await response.parse() - assert_matches_type(AsyncOffsetPage[ClientView], event, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/security/test_profile_templates.py b/tests/api_resources/security/test_profile_templates.py deleted file mode 100644 index 7df4918f..00000000 --- a/tests/api_resources/security/test_profile_templates.py +++ /dev/null @@ -1,74 +0,0 @@ -# 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.security import ProfileTemplateListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestProfileTemplates: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Gcore) -> None: - profile_template = client.security.profile_templates.list() - assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Gcore) -> None: - response = client.security.profile_templates.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile_template = response.parse() - assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Gcore) -> None: - with client.security.profile_templates.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile_template = response.parse() - assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncProfileTemplates: - 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: - profile_template = await async_client.security.profile_templates.list() - assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.security.profile_templates.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile_template = await response.parse() - assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.security.profile_templates.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile_template = await response.parse() - assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/security/test_profiles.py b/tests/api_resources/security/test_profiles.py deleted file mode 100644 index c79499ab..00000000 --- a/tests/api_resources/security/test_profiles.py +++ /dev/null @@ -1,537 +0,0 @@ -# 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.security import ( - ClientProfile, - ProfileListResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestProfiles: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Gcore) -> None: - profile = client.security.profiles.create( - fields=[{"base_field": 1}], - profile_template=1, - site="GNC", - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Gcore) -> None: - profile = client.security.profiles.create( - fields=[ - { - "base_field": 1, - "field_value": {}, - } - ], - profile_template=1, - site="GNC", - ip_address="123.43.2.10", - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Gcore) -> None: - response = client.security.profiles.with_raw_response.create( - fields=[{"base_field": 1}], - profile_template=1, - site="GNC", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Gcore) -> None: - with client.security.profiles.with_streaming_response.create( - fields=[{"base_field": 1}], - profile_template=1, - site="GNC", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_list(self, client: Gcore) -> None: - profile = client.security.profiles.list() - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Gcore) -> None: - profile = client.security.profiles.list( - exclude_empty_address=True, - include_deleted=True, - ip_address="ip_address", - site="site", - ) - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Gcore) -> None: - response = client.security.profiles.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = response.parse() - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Gcore) -> None: - with client.security.profiles.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = response.parse() - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_delete(self, client: Gcore) -> None: - profile = client.security.profiles.delete( - 0, - ) - assert profile is None - - @parametrize - def test_raw_response_delete(self, client: Gcore) -> None: - response = client.security.profiles.with_raw_response.delete( - 0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = response.parse() - assert profile is None - - @parametrize - def test_streaming_response_delete(self, client: Gcore) -> None: - with client.security.profiles.with_streaming_response.delete( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = response.parse() - assert profile is None - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_get(self, client: Gcore) -> None: - profile = client.security.profiles.get( - 0, - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Gcore) -> None: - response = client.security.profiles.with_raw_response.get( - 0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Gcore) -> None: - with client.security.profiles.with_streaming_response.get( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_recreate(self, client: Gcore) -> None: - profile = client.security.profiles.recreate( - id=0, - fields=[{"base_field": 1}], - profile_template=1, - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - def test_method_recreate_with_all_params(self, client: Gcore) -> None: - profile = client.security.profiles.recreate( - id=0, - fields=[ - { - "base_field": 1, - "field_value": {}, - } - ], - profile_template=1, - ip_address="ip_address", - site="ED", - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - def test_raw_response_recreate(self, client: Gcore) -> None: - response = client.security.profiles.with_raw_response.recreate( - id=0, - fields=[{"base_field": 1}], - profile_template=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - def test_streaming_response_recreate(self, client: Gcore) -> None: - with client.security.profiles.with_streaming_response.recreate( - id=0, - fields=[{"base_field": 1}], - profile_template=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_replace(self, client: Gcore) -> None: - profile = client.security.profiles.replace( - id=0, - fields=[{"base_field": 1}], - profile_template=1, - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - def test_method_replace_with_all_params(self, client: Gcore) -> None: - profile = client.security.profiles.replace( - id=0, - fields=[ - { - "base_field": 1, - "field_value": {}, - } - ], - profile_template=1, - ip_address="ip_address", - site="ED", - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - def test_raw_response_replace(self, client: Gcore) -> None: - response = client.security.profiles.with_raw_response.replace( - id=0, - fields=[{"base_field": 1}], - profile_template=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - def test_streaming_response_replace(self, client: Gcore) -> None: - with client.security.profiles.with_streaming_response.replace( - id=0, - fields=[{"base_field": 1}], - profile_template=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncProfiles: - 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: - profile = await async_client.security.profiles.create( - fields=[{"base_field": 1}], - profile_template=1, - site="GNC", - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - profile = await async_client.security.profiles.create( - fields=[ - { - "base_field": 1, - "field_value": {}, - } - ], - profile_template=1, - site="GNC", - ip_address="123.43.2.10", - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.security.profiles.with_raw_response.create( - fields=[{"base_field": 1}], - profile_template=1, - site="GNC", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = await response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.security.profiles.with_streaming_response.create( - fields=[{"base_field": 1}], - profile_template=1, - site="GNC", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = await response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_list(self, async_client: AsyncGcore) -> None: - profile = await async_client.security.profiles.list() - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - profile = await async_client.security.profiles.list( - exclude_empty_address=True, - include_deleted=True, - ip_address="ip_address", - site="site", - ) - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.security.profiles.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = await response.parse() - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.security.profiles.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = await response.parse() - assert_matches_type(ProfileListResponse, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncGcore) -> None: - profile = await async_client.security.profiles.delete( - 0, - ) - assert profile is None - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.security.profiles.with_raw_response.delete( - 0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = await response.parse() - assert profile is None - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.security.profiles.with_streaming_response.delete( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = await response.parse() - assert profile is None - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_get(self, async_client: AsyncGcore) -> None: - profile = await async_client.security.profiles.get( - 0, - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.security.profiles.with_raw_response.get( - 0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = await response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.security.profiles.with_streaming_response.get( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = await response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_recreate(self, async_client: AsyncGcore) -> None: - profile = await async_client.security.profiles.recreate( - id=0, - fields=[{"base_field": 1}], - profile_template=1, - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - async def test_method_recreate_with_all_params(self, async_client: AsyncGcore) -> None: - profile = await async_client.security.profiles.recreate( - id=0, - fields=[ - { - "base_field": 1, - "field_value": {}, - } - ], - profile_template=1, - ip_address="ip_address", - site="ED", - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - async def test_raw_response_recreate(self, async_client: AsyncGcore) -> None: - response = await async_client.security.profiles.with_raw_response.recreate( - id=0, - fields=[{"base_field": 1}], - profile_template=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = await response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - async def test_streaming_response_recreate(self, async_client: AsyncGcore) -> None: - async with async_client.security.profiles.with_streaming_response.recreate( - id=0, - fields=[{"base_field": 1}], - profile_template=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = await response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_replace(self, async_client: AsyncGcore) -> None: - profile = await async_client.security.profiles.replace( - id=0, - fields=[{"base_field": 1}], - profile_template=1, - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: - profile = await async_client.security.profiles.replace( - id=0, - fields=[ - { - "base_field": 1, - "field_value": {}, - } - ], - profile_template=1, - ip_address="ip_address", - site="ED", - ) - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: - response = await async_client.security.profiles.with_raw_response.replace( - id=0, - fields=[{"base_field": 1}], - profile_template=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - profile = await response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - @parametrize - async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: - async with async_client.security.profiles.with_streaming_response.replace( - id=0, - fields=[{"base_field": 1}], - profile_template=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - profile = await response.parse() - assert_matches_type(ClientProfile, profile, path=["response"]) - - assert cast(Any, response.is_closed) is True From d2e6022add9050f5c41585c395ff6d9ae6d5c8ec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 3 Nov 2025 16:11:06 +0000 Subject: [PATCH 415/592] chore(internal): grammar fix (it's -> its) --- src/gcore/_utils/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gcore/_utils/_utils.py b/src/gcore/_utils/_utils.py index 50d59269..eec7f4a1 100644 --- a/src/gcore/_utils/_utils.py +++ b/src/gcore/_utils/_utils.py @@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: # Type safe methods for narrowing types with TypeVars. # The default narrowing for isinstance(obj, dict) is dict[unknown, unknown], # however this cause Pyright to rightfully report errors. As we know we don't -# care about the contained types we can safely use `object` in it's place. +# care about the contained types we can safely use `object` in its place. # # There are two separate functions defined, `is_*` and `is_*_t` for different use cases. # `is_*` is for when you're dealing with an unknown input From 8e4cbb5700c8a81d034bdf2a5a117492217a3da5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 07:34:13 +0000 Subject: [PATCH 416/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- .../resources/cloud/load_balancers/pools/pools.py | 4 ++-- src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py | 12 ++++++++++++ src/gcore/types/cloud/load_balancer_create_params.py | 2 +- .../types/cloud/load_balancers/pool_create_params.py | 2 +- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index d0525a7d..505403dc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 599 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-963021ac0cb8a12826d7e00d317340e71748a27c18553422a76d882d2e8ad389.yml -openapi_spec_hash: 0c1ea27cd584bf0d47fed367663053b2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-54e13cd82113c74d43e82dc26f72f31cc1c7dcbdba376c44513a707a954ad778.yml +openapi_spec_hash: 044a6432c14ebaa2c163ad90733d10a8 config_hash: 4758209f53bb13d06f55e4cf6c952b6d diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 1b3ddd58..80d91bf7 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -85,7 +85,7 @@ def create( healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, listener_id: Optional[str] | Omit = omit, load_balancer_id: Optional[str] | Omit = omit, - members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, + members: Iterable[pool_create_params.Member] | Omit = omit, secret_id: Optional[str] | Omit = omit, session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, timeout_client_data: Optional[int] | Omit = omit, @@ -481,7 +481,7 @@ async def create( healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, listener_id: Optional[str] | Omit = omit, load_balancer_id: Optional[str] | Omit = omit, - members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, + members: Iterable[pool_create_params.Member] | Omit = omit, secret_id: Optional[str] | Omit = omit, session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, timeout_client_data: Optional[int] | Omit = omit, diff --git a/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py b/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py index 38aaabe4..c7f7426e 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py @@ -9,9 +9,21 @@ class K8sClusterKubeconfig(BaseModel): + client_certificate: str + """String in base64 format. Cluster client certificate""" + + client_key: str + """String in base64 format. Cluster client key""" + + cluster_ca_certificate: str + """String in base64 format. Cluster ca certificate""" + config: str """Cluster kubeconfig""" + host: str + """Cluster host""" + created_at: Optional[datetime] = None """Kubeconfig creation date""" diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 0ab6f5ce..28429738 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -277,7 +277,7 @@ class ListenerPool(TypedDict, total=False): load_balancer_id: Optional[str] """Loadbalancer ID""" - members: Optional[Iterable[ListenerPoolMember]] + members: Iterable[ListenerPoolMember] """Pool members""" secret_id: Optional[str] 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 492e9640..c8e503a5 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -45,7 +45,7 @@ class PoolCreateParams(TypedDict, total=False): load_balancer_id: Optional[str] """Loadbalancer ID""" - members: Optional[Iterable[Member]] + members: Iterable[Member] """Pool members""" secret_id: Optional[str] From 3b316f0bed5a68d13dda48a4e54b66b440f2395f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 10:11:50 +0000 Subject: [PATCH 417/592] feat(api): aggregated API specs update --- .stats.yml | 4 +-- README.md | 16 ++++----- src/gcore/resources/cloud/projects.py | 28 +++------------ .../types/cloud/project_create_params.py | 6 ---- tests/api_resources/cloud/test_projects.py | 36 +++++++++---------- tests/test_client.py | 28 +++++++-------- 6 files changed, 44 insertions(+), 74 deletions(-) diff --git a/.stats.yml b/.stats.yml index 505403dc..373cf5e0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 599 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-54e13cd82113c74d43e82dc26f72f31cc1c7dcbdba376c44513a707a954ad778.yml -openapi_spec_hash: 044a6432c14ebaa2c163ad90733d10a8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-62590a431788ed5841ef8a0e86fdf0d666ef18819a2a1c784a573b03fb314f60.yml +openapi_spec_hash: cf5994f5522f209e3c2e3290bc7b418a config_hash: 4758209f53bb13d06f55e4cf6c952b6d diff --git a/README.md b/README.md index c6d6ca1e..4e4cfb33 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ client = Gcore( ) project = client.cloud.projects.create( - name="New Project", + name="my-project", ) print(project.id) ``` @@ -59,7 +59,7 @@ client = AsyncGcore( async def main() -> None: project = await client.cloud.projects.create( - name="New Project", + name="my-project", ) print(project.id) @@ -94,7 +94,7 @@ async def main() -> None: http_client=DefaultAioHttpClient(), ) as client: project = await client.cloud.projects.create( - name="New Project", + name="my-project", ) print(project.id) @@ -201,7 +201,7 @@ client = Gcore() try: client.cloud.projects.create( - name="New Project", + name="my-project", ) except gcore.APIConnectionError as e: print("The server could not be reached") @@ -246,7 +246,7 @@ client = Gcore( # Or, configure per-request: client.with_options(max_retries=5).cloud.projects.create( - name="New Project", + name="my-project", ) ``` @@ -271,7 +271,7 @@ client = Gcore( # Override per-request: client.with_options(timeout=5.0).cloud.projects.create( - name="New Project", + name="my-project", ) ``` @@ -314,7 +314,7 @@ from gcore import Gcore client = Gcore() response = client.cloud.projects.with_raw_response.create( - name="New Project", + name="my-project", ) print(response.headers.get('X-My-Header')) @@ -334,7 +334,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi ```python with client.cloud.projects.with_streaming_response.create( - name="New Project", + name="my-project", ) as response: print(response.headers.get("X-My-Header")) diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 2e5ae929..ad5381ec 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -50,9 +50,7 @@ def create( self, *, name: str, - client_id: Optional[int] | Omit = omit, description: Optional[str] | Omit = omit, - state: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -68,12 +66,8 @@ def create( Args: name: Unique project name for a client. Each client always has one "default" project. - client_id: ID associated with the client. - description: Description of the project. - state: State of the project. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -87,9 +81,7 @@ def create( body=maybe_transform( { "name": name, - "client_id": client_id, "description": description, - "state": state, }, project_create_params.ProjectCreateParams, ), @@ -112,10 +104,8 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: - """Update project name and description. - - Project management must be enabled to - perform this operation. + """ + Update project name and description. Args: name: Name of the entity, following a specific format. @@ -306,9 +296,7 @@ async def create( self, *, name: str, - client_id: Optional[int] | Omit = omit, description: Optional[str] | Omit = omit, - state: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -324,12 +312,8 @@ async def create( Args: name: Unique project name for a client. Each client always has one "default" project. - client_id: ID associated with the client. - description: Description of the project. - state: State of the project. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -343,9 +327,7 @@ async def create( body=await async_maybe_transform( { "name": name, - "client_id": client_id, "description": description, - "state": state, }, project_create_params.ProjectCreateParams, ), @@ -368,10 +350,8 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: - """Update project name and description. - - Project management must be enabled to - perform this operation. + """ + Update project name and description. Args: name: Name of the entity, following a specific format. diff --git a/src/gcore/types/cloud/project_create_params.py b/src/gcore/types/cloud/project_create_params.py index 9a9255be..86a3ff86 100644 --- a/src/gcore/types/cloud/project_create_params.py +++ b/src/gcore/types/cloud/project_create_params.py @@ -12,11 +12,5 @@ class ProjectCreateParams(TypedDict, total=False): name: Required[str] """Unique project name for a client. Each client always has one "default" project.""" - client_id: Optional[int] - """ID associated with the client.""" - description: Optional[str] """Description of the project.""" - - state: Optional[str] - """State of the project.""" diff --git a/tests/api_resources/cloud/test_projects.py b/tests/api_resources/cloud/test_projects.py index 33942a79..2a620652 100644 --- a/tests/api_resources/cloud/test_projects.py +++ b/tests/api_resources/cloud/test_projects.py @@ -21,24 +21,22 @@ class TestProjects: @parametrize def test_method_create(self, client: Gcore) -> None: project = client.cloud.projects.create( - name="New Project", + name="my-project", ) assert_matches_type(Project, project, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: project = client.cloud.projects.create( - name="New Project", - client_id=3, + name="my-project", description="Project description", - state="ACTIVE", ) assert_matches_type(Project, project, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.projects.with_raw_response.create( - name="New Project", + name="my-project", ) assert response.is_closed is True @@ -49,7 +47,7 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.projects.with_streaming_response.create( - name="New Project", + name="my-project", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -63,7 +61,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: def test_method_update(self, client: Gcore) -> None: project = client.cloud.projects.update( project_id=0, - name="New Project", + name="my-project", ) assert_matches_type(Project, project, path=["response"]) @@ -71,7 +69,7 @@ def test_method_update(self, client: Gcore) -> None: def test_method_update_with_all_params(self, client: Gcore) -> None: project = client.cloud.projects.update( project_id=0, - name="New Project", + name="my-project", description="Project description", ) assert_matches_type(Project, project, path=["response"]) @@ -80,7 +78,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: def test_raw_response_update(self, client: Gcore) -> None: response = client.cloud.projects.with_raw_response.update( project_id=0, - name="New Project", + name="my-project", ) assert response.is_closed is True @@ -92,7 +90,7 @@ def test_raw_response_update(self, client: Gcore) -> None: def test_streaming_response_update(self, client: Gcore) -> None: with client.cloud.projects.with_streaming_response.update( project_id=0, - name="New Project", + name="my-project", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -210,24 +208,22 @@ class TestAsyncProjects: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: project = await async_client.cloud.projects.create( - name="New Project", + name="my-project", ) assert_matches_type(Project, project, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: project = await async_client.cloud.projects.create( - name="New Project", - client_id=3, + name="my-project", description="Project description", - state="ACTIVE", ) assert_matches_type(Project, project, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.projects.with_raw_response.create( - name="New Project", + name="my-project", ) assert response.is_closed is True @@ -238,7 +234,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.projects.with_streaming_response.create( - name="New Project", + name="my-project", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -252,7 +248,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None async def test_method_update(self, async_client: AsyncGcore) -> None: project = await async_client.cloud.projects.update( project_id=0, - name="New Project", + name="my-project", ) assert_matches_type(Project, project, path=["response"]) @@ -260,7 +256,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: project = await async_client.cloud.projects.update( project_id=0, - name="New Project", + name="my-project", description="Project description", ) assert_matches_type(Project, project, path=["response"]) @@ -269,7 +265,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.projects.with_raw_response.update( project_id=0, - name="New Project", + name="my-project", ) assert response.is_closed is True @@ -281,7 +277,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.cloud.projects.with_streaming_response.update( project_id=0, - name="New Project", + name="my-project", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/test_client.py b/tests/test_client.py index 5e4cd0ed..8f4855f7 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="New Project") + client.cloud.projects.update(name="my-project") client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_project_id=0) with client as c2: - c2.cloud.projects.update(name="New Project") + c2.cloud.projects.update(name="my-project") def test_cloud_region_id_client_params(self, client: Gcore) -> None: # Test with base client (no custom params) @@ -753,7 +753,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien respx_mock.post("/cloud/v1/projects").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - client.cloud.projects.with_streaming_response.create(name="New Project").__enter__() + client.cloud.projects.with_streaming_response.create(name="my-project").__enter__() assert _get_open_connections(client) == 0 @@ -763,7 +763,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client respx_mock.post("/cloud/v1/projects").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - client.cloud.projects.with_streaming_response.create(name="New Project").__enter__() + client.cloud.projects.with_streaming_response.create(name="my-project").__enter__() assert _get_open_connections(client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @@ -792,7 +792,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) - response = client.cloud.projects.with_raw_response.create(name="New Project") + response = client.cloud.projects.with_raw_response.create(name="my-project") assert response.retries_taken == failures_before_success assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success @@ -815,7 +815,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) response = client.cloud.projects.with_raw_response.create( - name="New Project", extra_headers={"x-stainless-retry-count": Omit()} + name="my-project", extra_headers={"x-stainless-retry-count": Omit()} ) assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 @@ -840,7 +840,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) response = client.cloud.projects.with_raw_response.create( - name="New Project", extra_headers={"x-stainless-retry-count": "42"} + name="my-project", extra_headers={"x-stainless-retry-count": "42"} ) assert response.http_request.headers.get("x-stainless-retry-count") == "42" @@ -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="New Project") + await async_client.cloud.projects.update(name="my-project") client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_project_id=0) async with client as c2: - await c2.cloud.projects.update(name="New Project") + await c2.cloud.projects.update(name="my-project") async def test_cloud_region_id_client_params(self, async_client: AsyncGcore) -> None: # Test with base client (no custom params) @@ -1603,7 +1603,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, respx_mock.post("/cloud/v1/projects").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - await async_client.cloud.projects.with_streaming_response.create(name="New Project").__aenter__() + await async_client.cloud.projects.with_streaming_response.create(name="my-project").__aenter__() assert _get_open_connections(async_client) == 0 @@ -1613,7 +1613,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, respx_mock.post("/cloud/v1/projects").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - await async_client.cloud.projects.with_streaming_response.create(name="New Project").__aenter__() + await async_client.cloud.projects.with_streaming_response.create(name="my-project").__aenter__() assert _get_open_connections(async_client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @@ -1642,7 +1642,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) - response = await client.cloud.projects.with_raw_response.create(name="New Project") + response = await client.cloud.projects.with_raw_response.create(name="my-project") assert response.retries_taken == failures_before_success assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success @@ -1667,7 +1667,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) response = await client.cloud.projects.with_raw_response.create( - name="New Project", extra_headers={"x-stainless-retry-count": Omit()} + name="my-project", extra_headers={"x-stainless-retry-count": Omit()} ) assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 @@ -1692,7 +1692,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/cloud/v1/projects").mock(side_effect=retry_handler) response = await client.cloud.projects.with_raw_response.create( - name="New Project", extra_headers={"x-stainless-retry-count": "42"} + name="my-project", extra_headers={"x-stainless-retry-count": "42"} ) assert response.http_request.headers.get("x-stainless-retry-count") == "42" From 35dc0953eb7728874fffdea6f3f760fb73d0b199 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 13:57:16 +0000 Subject: [PATCH 418/592] feat(api): aggregated API specs update --- .stats.yml | 6 +- api.md | 42 +- src/gcore/_client.py | 9 + src/gcore/resources/__init__.py | 14 + src/gcore/resources/security/__init__.py | 75 ++ src/gcore/resources/security/bgp_announces.py | 308 ++++++++ src/gcore/resources/security/events.py | 234 +++++++ .../resources/security/profile_templates.py | 143 ++++ src/gcore/resources/security/profiles.py | 661 ++++++++++++++++++ src/gcore/resources/security/security.py | 198 ++++++ src/gcore/types/security/__init__.py | 15 + .../security/bgp_announce_list_params.py | 18 + .../security/bgp_announce_list_response.py | 10 + .../security/bgp_announce_toggle_params.py | 16 + src/gcore/types/security/client_announce.py | 15 + src/gcore/types/security/client_profile.py | 56 ++ .../types/security/client_profile_template.py | 43 ++ src/gcore/types/security/client_view.py | 29 + src/gcore/types/security/event_list_params.py | 38 + .../types/security/profile_create_params.py | 24 + .../types/security/profile_list_params.py | 17 + .../types/security/profile_list_response.py | 10 + .../types/security/profile_recreate_params.py | 24 + .../types/security/profile_replace_params.py | 24 + .../profile_template_list_response.py | 10 + tests/api_resources/security/__init__.py | 1 + .../security/test_bgp_announces.py | 180 +++++ tests/api_resources/security/test_events.py | 102 +++ .../security/test_profile_templates.py | 74 ++ tests/api_resources/security/test_profiles.py | 537 ++++++++++++++ 30 files changed, 2928 insertions(+), 5 deletions(-) create mode 100644 src/gcore/resources/security/__init__.py create mode 100644 src/gcore/resources/security/bgp_announces.py create mode 100644 src/gcore/resources/security/events.py create mode 100644 src/gcore/resources/security/profile_templates.py create mode 100644 src/gcore/resources/security/profiles.py create mode 100644 src/gcore/resources/security/security.py create mode 100644 src/gcore/types/security/bgp_announce_list_params.py create mode 100644 src/gcore/types/security/bgp_announce_list_response.py create mode 100644 src/gcore/types/security/bgp_announce_toggle_params.py create mode 100644 src/gcore/types/security/client_announce.py create mode 100644 src/gcore/types/security/client_profile.py create mode 100644 src/gcore/types/security/client_profile_template.py create mode 100644 src/gcore/types/security/client_view.py create mode 100644 src/gcore/types/security/event_list_params.py create mode 100644 src/gcore/types/security/profile_create_params.py create mode 100644 src/gcore/types/security/profile_list_params.py create mode 100644 src/gcore/types/security/profile_list_response.py create mode 100644 src/gcore/types/security/profile_recreate_params.py create mode 100644 src/gcore/types/security/profile_replace_params.py create mode 100644 src/gcore/types/security/profile_template_list_response.py create mode 100644 tests/api_resources/security/__init__.py create mode 100644 tests/api_resources/security/test_bgp_announces.py create mode 100644 tests/api_resources/security/test_events.py create mode 100644 tests/api_resources/security/test_profile_templates.py create mode 100644 tests/api_resources/security/test_profiles.py diff --git a/.stats.yml b/.stats.yml index 373cf5e0..72bd8302 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 599 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-62590a431788ed5841ef8a0e86fdf0d666ef18819a2a1c784a573b03fb314f60.yml -openapi_spec_hash: cf5994f5522f209e3c2e3290bc7b418a +configured_endpoints: 609 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1089f2c131ebee7df82e158c4210c07f019b47549d84fe6ea7f022117c83a008.yml +openapi_spec_hash: 9758acbadc1ee1bc0d826d4657e1ad4a config_hash: 4758209f53bb13d06f55e4cf6c952b6d diff --git a/api.md b/api.md index 2fe398c1..6ff46915 100644 --- a/api.md +++ b/api.md @@ -1789,22 +1789,60 @@ Methods: # Security +## Events + +Types: + +```python +from gcore.types.security import ClientView +``` + +Methods: + +- client.security.events.list(\*\*params) -> SyncOffsetPage[ClientView] + +## BgpAnnounces + +Types: + +```python +from gcore.types.security import ClientAnnounce, BgpAnnounceListResponse +``` + +Methods: + +- client.security.bgp_announces.list(\*\*params) -> BgpAnnounceListResponse +- client.security.bgp_announces.toggle(\*\*params) -> object + ## ProfileTemplates Types: ```python -from gcore.types.security import ClientProfileTemplate +from gcore.types.security import ClientProfileTemplate, ProfileTemplateListResponse ``` +Methods: + +- client.security.profile_templates.list() -> ProfileTemplateListResponse + ## Profiles Types: ```python -from gcore.types.security import ClientProfile +from gcore.types.security import ClientProfile, ProfileListResponse ``` +Methods: + +- client.security.profiles.create(\*\*params) -> ClientProfile +- client.security.profiles.list(\*\*params) -> ProfileListResponse +- client.security.profiles.delete(id) -> None +- client.security.profiles.get(id) -> ClientProfile +- client.security.profiles.recreate(id, \*\*params) -> ClientProfile +- client.security.profiles.replace(id, \*\*params) -> ClientProfile + # DNS Types: diff --git a/src/gcore/_client.py b/src/gcore/_client.py index df7f4886..d900f571 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -35,6 +35,7 @@ from .resources.cloud import cloud from .resources.storage import storage from .resources.fastedge import fastedge +from .resources.security import security from .resources.streaming import streaming __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Gcore", "AsyncGcore", "Client", "AsyncClient"] @@ -46,6 +47,7 @@ class Gcore(SyncAPIClient): iam: iam.IamResource fastedge: fastedge.FastedgeResource streaming: streaming.StreamingResource + security: security.SecurityResource dns: dns.DNSResource storage: storage.StorageResource cdn: cdn.CdnResource @@ -138,6 +140,7 @@ def __init__( self.iam = iam.IamResource(self) self.fastedge = fastedge.FastedgeResource(self) self.streaming = streaming.StreamingResource(self) + self.security = security.SecurityResource(self) self.dns = dns.DNSResource(self) self.storage = storage.StorageResource(self) self.cdn = cdn.CdnResource(self) @@ -281,6 +284,7 @@ class AsyncGcore(AsyncAPIClient): iam: iam.AsyncIamResource fastedge: fastedge.AsyncFastedgeResource streaming: streaming.AsyncStreamingResource + security: security.AsyncSecurityResource dns: dns.AsyncDNSResource storage: storage.AsyncStorageResource cdn: cdn.AsyncCdnResource @@ -373,6 +377,7 @@ def __init__( self.iam = iam.AsyncIamResource(self) self.fastedge = fastedge.AsyncFastedgeResource(self) self.streaming = streaming.AsyncStreamingResource(self) + self.security = security.AsyncSecurityResource(self) self.dns = dns.AsyncDNSResource(self) self.storage = storage.AsyncStorageResource(self) self.cdn = cdn.AsyncCdnResource(self) @@ -517,6 +522,7 @@ def __init__(self, client: Gcore) -> None: self.iam = iam.IamResourceWithRawResponse(client.iam) self.fastedge = fastedge.FastedgeResourceWithRawResponse(client.fastedge) self.streaming = streaming.StreamingResourceWithRawResponse(client.streaming) + self.security = security.SecurityResourceWithRawResponse(client.security) self.dns = dns.DNSResourceWithRawResponse(client.dns) self.storage = storage.StorageResourceWithRawResponse(client.storage) self.cdn = cdn.CdnResourceWithRawResponse(client.cdn) @@ -529,6 +535,7 @@ def __init__(self, client: AsyncGcore) -> None: self.iam = iam.AsyncIamResourceWithRawResponse(client.iam) self.fastedge = fastedge.AsyncFastedgeResourceWithRawResponse(client.fastedge) self.streaming = streaming.AsyncStreamingResourceWithRawResponse(client.streaming) + self.security = security.AsyncSecurityResourceWithRawResponse(client.security) self.dns = dns.AsyncDNSResourceWithRawResponse(client.dns) self.storage = storage.AsyncStorageResourceWithRawResponse(client.storage) self.cdn = cdn.AsyncCdnResourceWithRawResponse(client.cdn) @@ -541,6 +548,7 @@ def __init__(self, client: Gcore) -> None: self.iam = iam.IamResourceWithStreamingResponse(client.iam) self.fastedge = fastedge.FastedgeResourceWithStreamingResponse(client.fastedge) self.streaming = streaming.StreamingResourceWithStreamingResponse(client.streaming) + self.security = security.SecurityResourceWithStreamingResponse(client.security) self.dns = dns.DNSResourceWithStreamingResponse(client.dns) self.storage = storage.StorageResourceWithStreamingResponse(client.storage) self.cdn = cdn.CdnResourceWithStreamingResponse(client.cdn) @@ -553,6 +561,7 @@ def __init__(self, client: AsyncGcore) -> None: self.iam = iam.AsyncIamResourceWithStreamingResponse(client.iam) self.fastedge = fastedge.AsyncFastedgeResourceWithStreamingResponse(client.fastedge) self.streaming = streaming.AsyncStreamingResourceWithStreamingResponse(client.streaming) + self.security = security.AsyncSecurityResourceWithStreamingResponse(client.security) self.dns = dns.AsyncDNSResourceWithStreamingResponse(client.dns) self.storage = storage.AsyncStorageResourceWithStreamingResponse(client.storage) self.cdn = cdn.AsyncCdnResourceWithStreamingResponse(client.cdn) diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py index d7b63884..c8aaa6a7 100644 --- a/src/gcore/resources/__init__.py +++ b/src/gcore/resources/__init__.py @@ -56,6 +56,14 @@ FastedgeResourceWithStreamingResponse, AsyncFastedgeResourceWithStreamingResponse, ) +from .security import ( + SecurityResource, + AsyncSecurityResource, + SecurityResourceWithRawResponse, + AsyncSecurityResourceWithRawResponse, + SecurityResourceWithStreamingResponse, + AsyncSecurityResourceWithStreamingResponse, +) from .streaming import ( StreamingResource, AsyncStreamingResource, @@ -96,6 +104,12 @@ "AsyncStreamingResourceWithRawResponse", "StreamingResourceWithStreamingResponse", "AsyncStreamingResourceWithStreamingResponse", + "SecurityResource", + "AsyncSecurityResource", + "SecurityResourceWithRawResponse", + "AsyncSecurityResourceWithRawResponse", + "SecurityResourceWithStreamingResponse", + "AsyncSecurityResourceWithStreamingResponse", "DNSResource", "AsyncDNSResource", "DNSResourceWithRawResponse", diff --git a/src/gcore/resources/security/__init__.py b/src/gcore/resources/security/__init__.py new file mode 100644 index 00000000..a1a7a5ea --- /dev/null +++ b/src/gcore/resources/security/__init__.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) +from .profiles import ( + ProfilesResource, + AsyncProfilesResource, + ProfilesResourceWithRawResponse, + AsyncProfilesResourceWithRawResponse, + ProfilesResourceWithStreamingResponse, + AsyncProfilesResourceWithStreamingResponse, +) +from .security import ( + SecurityResource, + AsyncSecurityResource, + SecurityResourceWithRawResponse, + AsyncSecurityResourceWithRawResponse, + SecurityResourceWithStreamingResponse, + AsyncSecurityResourceWithStreamingResponse, +) +from .bgp_announces import ( + BgpAnnouncesResource, + AsyncBgpAnnouncesResource, + BgpAnnouncesResourceWithRawResponse, + AsyncBgpAnnouncesResourceWithRawResponse, + BgpAnnouncesResourceWithStreamingResponse, + AsyncBgpAnnouncesResourceWithStreamingResponse, +) +from .profile_templates import ( + ProfileTemplatesResource, + AsyncProfileTemplatesResource, + ProfileTemplatesResourceWithRawResponse, + AsyncProfileTemplatesResourceWithRawResponse, + ProfileTemplatesResourceWithStreamingResponse, + AsyncProfileTemplatesResourceWithStreamingResponse, +) + +__all__ = [ + "EventsResource", + "AsyncEventsResource", + "EventsResourceWithRawResponse", + "AsyncEventsResourceWithRawResponse", + "EventsResourceWithStreamingResponse", + "AsyncEventsResourceWithStreamingResponse", + "BgpAnnouncesResource", + "AsyncBgpAnnouncesResource", + "BgpAnnouncesResourceWithRawResponse", + "AsyncBgpAnnouncesResourceWithRawResponse", + "BgpAnnouncesResourceWithStreamingResponse", + "AsyncBgpAnnouncesResourceWithStreamingResponse", + "ProfileTemplatesResource", + "AsyncProfileTemplatesResource", + "ProfileTemplatesResourceWithRawResponse", + "AsyncProfileTemplatesResourceWithRawResponse", + "ProfileTemplatesResourceWithStreamingResponse", + "AsyncProfileTemplatesResourceWithStreamingResponse", + "ProfilesResource", + "AsyncProfilesResource", + "ProfilesResourceWithRawResponse", + "AsyncProfilesResourceWithRawResponse", + "ProfilesResourceWithStreamingResponse", + "AsyncProfilesResourceWithStreamingResponse", + "SecurityResource", + "AsyncSecurityResource", + "SecurityResourceWithRawResponse", + "AsyncSecurityResourceWithRawResponse", + "SecurityResourceWithStreamingResponse", + "AsyncSecurityResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py new file mode 100644 index 00000000..26b3bc96 --- /dev/null +++ b/src/gcore/resources/security/bgp_announces.py @@ -0,0 +1,308 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.security import bgp_announce_list_params, bgp_announce_toggle_params +from ...types.security.bgp_announce_list_response import BgpAnnounceListResponse + +__all__ = ["BgpAnnouncesResource", "AsyncBgpAnnouncesResource"] + + +class BgpAnnouncesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> BgpAnnouncesResourceWithRawResponse: + """ + 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 BgpAnnouncesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BgpAnnouncesResourceWithStreamingResponse: + """ + 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 BgpAnnouncesResourceWithStreamingResponse(self) + + def list( + self, + *, + announced: Optional[bool] | Omit = omit, + client_id: Optional[int] | Omit = omit, + origin: Optional[Literal["STATIC", "DYNAMIC"]] | Omit = omit, + site: Optional[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> BgpAnnounceListResponse: + """Get BGP announces filtered by parameters. + + Shows announces in active profiles, + meaning that to get a non-empty response, the client must have at least one + active profile. + + 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( + "/security/sifter/v2/protected_addresses/announces", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "announced": announced, + "client_id": client_id, + "origin": origin, + "site": site, + }, + bgp_announce_list_params.BgpAnnounceListParams, + ), + ), + cast_to=BgpAnnounceListResponse, + ) + + def toggle( + self, + *, + announce: str, + enabled: bool, + client_id: Optional[int] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> object: + """Change BGP announces (it can be enabled or disabled, but not created or + updated). + + Can be applied to already existing announces in active profiles, + meaning that the client must have at least one active profile. + + 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( + "/security/sifter/v2/protected_addresses/announces", + body=maybe_transform( + { + "announce": announce, + "enabled": enabled, + }, + bgp_announce_toggle_params.BgpAnnounceToggleParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"client_id": client_id}, bgp_announce_toggle_params.BgpAnnounceToggleParams), + ), + cast_to=object, + ) + + +class AsyncBgpAnnouncesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncBgpAnnouncesResourceWithRawResponse: + """ + 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 AsyncBgpAnnouncesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBgpAnnouncesResourceWithStreamingResponse: + """ + 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 AsyncBgpAnnouncesResourceWithStreamingResponse(self) + + async def list( + self, + *, + announced: Optional[bool] | Omit = omit, + client_id: Optional[int] | Omit = omit, + origin: Optional[Literal["STATIC", "DYNAMIC"]] | Omit = omit, + site: Optional[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> BgpAnnounceListResponse: + """Get BGP announces filtered by parameters. + + Shows announces in active profiles, + meaning that to get a non-empty response, the client must have at least one + active profile. + + 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( + "/security/sifter/v2/protected_addresses/announces", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "announced": announced, + "client_id": client_id, + "origin": origin, + "site": site, + }, + bgp_announce_list_params.BgpAnnounceListParams, + ), + ), + cast_to=BgpAnnounceListResponse, + ) + + async def toggle( + self, + *, + announce: str, + enabled: bool, + client_id: Optional[int] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> object: + """Change BGP announces (it can be enabled or disabled, but not created or + updated). + + Can be applied to already existing announces in active profiles, + meaning that the client must have at least one active profile. + + 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( + "/security/sifter/v2/protected_addresses/announces", + body=await async_maybe_transform( + { + "announce": announce, + "enabled": enabled, + }, + bgp_announce_toggle_params.BgpAnnounceToggleParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"client_id": client_id}, bgp_announce_toggle_params.BgpAnnounceToggleParams + ), + ), + cast_to=object, + ) + + +class BgpAnnouncesResourceWithRawResponse: + def __init__(self, bgp_announces: BgpAnnouncesResource) -> None: + self._bgp_announces = bgp_announces + + self.list = to_raw_response_wrapper( + bgp_announces.list, + ) + self.toggle = to_raw_response_wrapper( + bgp_announces.toggle, + ) + + +class AsyncBgpAnnouncesResourceWithRawResponse: + def __init__(self, bgp_announces: AsyncBgpAnnouncesResource) -> None: + self._bgp_announces = bgp_announces + + self.list = async_to_raw_response_wrapper( + bgp_announces.list, + ) + self.toggle = async_to_raw_response_wrapper( + bgp_announces.toggle, + ) + + +class BgpAnnouncesResourceWithStreamingResponse: + def __init__(self, bgp_announces: BgpAnnouncesResource) -> None: + self._bgp_announces = bgp_announces + + self.list = to_streamed_response_wrapper( + bgp_announces.list, + ) + self.toggle = to_streamed_response_wrapper( + bgp_announces.toggle, + ) + + +class AsyncBgpAnnouncesResourceWithStreamingResponse: + def __init__(self, bgp_announces: AsyncBgpAnnouncesResource) -> None: + self._bgp_announces = bgp_announces + + self.list = async_to_streamed_response_wrapper( + bgp_announces.list, + ) + self.toggle = async_to_streamed_response_wrapper( + bgp_announces.toggle, + ) diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py new file mode 100644 index 00000000..e0699398 --- /dev/null +++ b/src/gcore/resources/security/events.py @@ -0,0 +1,234 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ..._base_client import AsyncPaginator, make_request_options +from ...types.security import event_list_params +from ...types.security.client_view import ClientView + +__all__ = ["EventsResource", "AsyncEventsResource"] + + +class EventsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> EventsResourceWithRawResponse: + """ + 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 EventsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> EventsResourceWithStreamingResponse: + """ + 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 EventsResourceWithStreamingResponse(self) + + def list( + self, + *, + alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | Omit = omit, + date_from: Union[Union[str, datetime], str] | Omit = omit, + date_to: Union[Union[str, datetime], str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + ordering: Literal[ + "attack_start_time", + "-attack_start_time", + "attack_power_bps", + "-attack_power_bps", + "attack_power_pps", + "-attack_power_pps", + "number_of_ip_involved_in_attack", + "-number_of_ip_involved_in_attack", + "alert_type", + "-alert_type", + ] + | Omit = omit, + targeted_ip_addresses: Optional[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncOffsetPage[ClientView]: + """ + Event Logs Clients View + + 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_api_list( + "/security/notifier/v1/event_logs", + page=SyncOffsetPage[ClientView], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "alert_type": alert_type, + "date_from": date_from, + "date_to": date_to, + "limit": limit, + "offset": offset, + "ordering": ordering, + "targeted_ip_addresses": targeted_ip_addresses, + }, + event_list_params.EventListParams, + ), + ), + model=ClientView, + ) + + +class AsyncEventsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: + """ + 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 AsyncEventsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: + """ + 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 AsyncEventsResourceWithStreamingResponse(self) + + def list( + self, + *, + alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | Omit = omit, + date_from: Union[Union[str, datetime], str] | Omit = omit, + date_to: Union[Union[str, datetime], str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + ordering: Literal[ + "attack_start_time", + "-attack_start_time", + "attack_power_bps", + "-attack_power_bps", + "attack_power_pps", + "-attack_power_pps", + "number_of_ip_involved_in_attack", + "-number_of_ip_involved_in_attack", + "alert_type", + "-alert_type", + ] + | Omit = omit, + targeted_ip_addresses: Optional[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[ClientView, AsyncOffsetPage[ClientView]]: + """ + Event Logs Clients View + + 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_api_list( + "/security/notifier/v1/event_logs", + page=AsyncOffsetPage[ClientView], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "alert_type": alert_type, + "date_from": date_from, + "date_to": date_to, + "limit": limit, + "offset": offset, + "ordering": ordering, + "targeted_ip_addresses": targeted_ip_addresses, + }, + event_list_params.EventListParams, + ), + ), + model=ClientView, + ) + + +class EventsResourceWithRawResponse: + def __init__(self, events: EventsResource) -> None: + self._events = events + + self.list = to_raw_response_wrapper( + events.list, + ) + + +class AsyncEventsResourceWithRawResponse: + def __init__(self, events: AsyncEventsResource) -> None: + self._events = events + + self.list = async_to_raw_response_wrapper( + events.list, + ) + + +class EventsResourceWithStreamingResponse: + def __init__(self, events: EventsResource) -> None: + self._events = events + + self.list = to_streamed_response_wrapper( + events.list, + ) + + +class AsyncEventsResourceWithStreamingResponse: + def __init__(self, events: AsyncEventsResource) -> None: + self._events = events + + self.list = async_to_streamed_response_wrapper( + events.list, + ) diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py new file mode 100644 index 00000000..307f3c0d --- /dev/null +++ b/src/gcore/resources/security/profile_templates.py @@ -0,0 +1,143 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.security.profile_template_list_response import ProfileTemplateListResponse + +__all__ = ["ProfileTemplatesResource", "AsyncProfileTemplatesResource"] + + +class ProfileTemplatesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ProfileTemplatesResourceWithRawResponse: + """ + 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 ProfileTemplatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ProfileTemplatesResourceWithStreamingResponse: + """ + 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 ProfileTemplatesResourceWithStreamingResponse(self) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ProfileTemplateListResponse: + """Get list of profile templates. + + Profile template is used as a template to create + profile. Client receives only common and created for him profile templates. + """ + return self._get( + "/security/iaas/profile-templates", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProfileTemplateListResponse, + ) + + +class AsyncProfileTemplatesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncProfileTemplatesResourceWithRawResponse: + """ + 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 AsyncProfileTemplatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncProfileTemplatesResourceWithStreamingResponse: + """ + 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 AsyncProfileTemplatesResourceWithStreamingResponse(self) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ProfileTemplateListResponse: + """Get list of profile templates. + + Profile template is used as a template to create + profile. Client receives only common and created for him profile templates. + """ + return await self._get( + "/security/iaas/profile-templates", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProfileTemplateListResponse, + ) + + +class ProfileTemplatesResourceWithRawResponse: + def __init__(self, profile_templates: ProfileTemplatesResource) -> None: + self._profile_templates = profile_templates + + self.list = to_raw_response_wrapper( + profile_templates.list, + ) + + +class AsyncProfileTemplatesResourceWithRawResponse: + def __init__(self, profile_templates: AsyncProfileTemplatesResource) -> None: + self._profile_templates = profile_templates + + self.list = async_to_raw_response_wrapper( + profile_templates.list, + ) + + +class ProfileTemplatesResourceWithStreamingResponse: + def __init__(self, profile_templates: ProfileTemplatesResource) -> None: + self._profile_templates = profile_templates + + self.list = to_streamed_response_wrapper( + profile_templates.list, + ) + + +class AsyncProfileTemplatesResourceWithStreamingResponse: + def __init__(self, profile_templates: AsyncProfileTemplatesResource) -> None: + self._profile_templates = profile_templates + + self.list = async_to_streamed_response_wrapper( + profile_templates.list, + ) diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py new file mode 100644 index 00000000..2ddf3257 --- /dev/null +++ b/src/gcore/resources/security/profiles.py @@ -0,0 +1,661 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.security import ( + profile_list_params, + profile_create_params, + profile_replace_params, + profile_recreate_params, +) +from ...types.security.client_profile import ClientProfile +from ...types.security.profile_list_response import ProfileListResponse + +__all__ = ["ProfilesResource", "AsyncProfilesResource"] + + +class ProfilesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ProfilesResourceWithRawResponse: + """ + 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 ProfilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ProfilesResourceWithStreamingResponse: + """ + 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 ProfilesResourceWithStreamingResponse(self) + + def create( + self, + *, + fields: Iterable[profile_create_params.Field], + profile_template: int, + site: str, + ip_address: Optional[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ClientProfile: + """Create protection profile. + + Protection is enabled at the same time as profile is + created + + 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( + "/security/iaas/v2/profiles", + body=maybe_transform( + { + "fields": fields, + "profile_template": profile_template, + "site": site, + "ip_address": ip_address, + }, + profile_create_params.ProfileCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + def list( + self, + *, + exclude_empty_address: bool | Omit = omit, + include_deleted: bool | Omit = omit, + ip_address: str | Omit = omit, + site: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ProfileListResponse: + """Get list of protection profiles. + + Client receives only profiles created by him + + 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( + "/security/iaas/v2/profiles", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "exclude_empty_address": exclude_empty_address, + "include_deleted": include_deleted, + "ip_address": ip_address, + "site": site, + }, + profile_list_params.ProfileListParams, + ), + ), + cast_to=ProfileListResponse, + ) + + def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Delete protection profile. + + Protection is disabled at the same time as profile is + deleted + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/security/iaas/v2/profiles/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ClientProfile: + """ + Get profile by id + + 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"/security/iaas/v2/profiles/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + def recreate( + self, + id: int, + *, + fields: Iterable[profile_recreate_params.Field], + profile_template: int, + ip_address: Optional[str] | Omit = omit, + site: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ClientProfile: + """ + Recreate profile with another profile template (for other cases use detail API) + + 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"/security/iaas/v2/profiles/{id}/recreate", + body=maybe_transform( + { + "fields": fields, + "profile_template": profile_template, + "ip_address": ip_address, + "site": site, + }, + profile_recreate_params.ProfileRecreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + def replace( + self, + id: int, + *, + fields: Iterable[profile_replace_params.Field], + profile_template: int, + ip_address: Optional[str] | Omit = omit, + site: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ClientProfile: + """Update profile. + + Protection policies are updated at the same time as profile + updated + + 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"/security/iaas/v2/profiles/{id}", + body=maybe_transform( + { + "fields": fields, + "profile_template": profile_template, + "ip_address": ip_address, + "site": site, + }, + profile_replace_params.ProfileReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + +class AsyncProfilesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncProfilesResourceWithRawResponse: + """ + 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 AsyncProfilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncProfilesResourceWithStreamingResponse: + """ + 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 AsyncProfilesResourceWithStreamingResponse(self) + + async def create( + self, + *, + fields: Iterable[profile_create_params.Field], + profile_template: int, + site: str, + ip_address: Optional[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ClientProfile: + """Create protection profile. + + Protection is enabled at the same time as profile is + created + + 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( + "/security/iaas/v2/profiles", + body=await async_maybe_transform( + { + "fields": fields, + "profile_template": profile_template, + "site": site, + "ip_address": ip_address, + }, + profile_create_params.ProfileCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + async def list( + self, + *, + exclude_empty_address: bool | Omit = omit, + include_deleted: bool | Omit = omit, + ip_address: str | Omit = omit, + site: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ProfileListResponse: + """Get list of protection profiles. + + Client receives only profiles created by him + + 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( + "/security/iaas/v2/profiles", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "exclude_empty_address": exclude_empty_address, + "include_deleted": include_deleted, + "ip_address": ip_address, + "site": site, + }, + profile_list_params.ProfileListParams, + ), + ), + cast_to=ProfileListResponse, + ) + + async def delete( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Delete protection profile. + + Protection is disabled at the same time as profile is + deleted + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/security/iaas/v2/profiles/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ClientProfile: + """ + Get profile by id + + 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"/security/iaas/v2/profiles/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + async def recreate( + self, + id: int, + *, + fields: Iterable[profile_recreate_params.Field], + profile_template: int, + ip_address: Optional[str] | Omit = omit, + site: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ClientProfile: + """ + Recreate profile with another profile template (for other cases use detail API) + + 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"/security/iaas/v2/profiles/{id}/recreate", + body=await async_maybe_transform( + { + "fields": fields, + "profile_template": profile_template, + "ip_address": ip_address, + "site": site, + }, + profile_recreate_params.ProfileRecreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + async def replace( + self, + id: int, + *, + fields: Iterable[profile_replace_params.Field], + profile_template: int, + ip_address: Optional[str] | Omit = omit, + site: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ClientProfile: + """Update profile. + + Protection policies are updated at the same time as profile + updated + + 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"/security/iaas/v2/profiles/{id}", + body=await async_maybe_transform( + { + "fields": fields, + "profile_template": profile_template, + "ip_address": ip_address, + "site": site, + }, + profile_replace_params.ProfileReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClientProfile, + ) + + +class ProfilesResourceWithRawResponse: + def __init__(self, profiles: ProfilesResource) -> None: + self._profiles = profiles + + self.create = to_raw_response_wrapper( + profiles.create, + ) + self.list = to_raw_response_wrapper( + profiles.list, + ) + self.delete = to_raw_response_wrapper( + profiles.delete, + ) + self.get = to_raw_response_wrapper( + profiles.get, + ) + self.recreate = to_raw_response_wrapper( + profiles.recreate, + ) + self.replace = to_raw_response_wrapper( + profiles.replace, + ) + + +class AsyncProfilesResourceWithRawResponse: + def __init__(self, profiles: AsyncProfilesResource) -> None: + self._profiles = profiles + + self.create = async_to_raw_response_wrapper( + profiles.create, + ) + self.list = async_to_raw_response_wrapper( + profiles.list, + ) + self.delete = async_to_raw_response_wrapper( + profiles.delete, + ) + self.get = async_to_raw_response_wrapper( + profiles.get, + ) + self.recreate = async_to_raw_response_wrapper( + profiles.recreate, + ) + self.replace = async_to_raw_response_wrapper( + profiles.replace, + ) + + +class ProfilesResourceWithStreamingResponse: + def __init__(self, profiles: ProfilesResource) -> None: + self._profiles = profiles + + self.create = to_streamed_response_wrapper( + profiles.create, + ) + self.list = to_streamed_response_wrapper( + profiles.list, + ) + self.delete = to_streamed_response_wrapper( + profiles.delete, + ) + self.get = to_streamed_response_wrapper( + profiles.get, + ) + self.recreate = to_streamed_response_wrapper( + profiles.recreate, + ) + self.replace = to_streamed_response_wrapper( + profiles.replace, + ) + + +class AsyncProfilesResourceWithStreamingResponse: + def __init__(self, profiles: AsyncProfilesResource) -> None: + self._profiles = profiles + + self.create = async_to_streamed_response_wrapper( + profiles.create, + ) + self.list = async_to_streamed_response_wrapper( + profiles.list, + ) + self.delete = async_to_streamed_response_wrapper( + profiles.delete, + ) + self.get = async_to_streamed_response_wrapper( + profiles.get, + ) + self.recreate = async_to_streamed_response_wrapper( + profiles.recreate, + ) + self.replace = async_to_streamed_response_wrapper( + profiles.replace, + ) diff --git a/src/gcore/resources/security/security.py b/src/gcore/resources/security/security.py new file mode 100644 index 00000000..2d0d9c11 --- /dev/null +++ b/src/gcore/resources/security/security.py @@ -0,0 +1,198 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .events import ( + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, +) +from .profiles import ( + ProfilesResource, + AsyncProfilesResource, + ProfilesResourceWithRawResponse, + AsyncProfilesResourceWithRawResponse, + ProfilesResourceWithStreamingResponse, + AsyncProfilesResourceWithStreamingResponse, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from .bgp_announces import ( + BgpAnnouncesResource, + AsyncBgpAnnouncesResource, + BgpAnnouncesResourceWithRawResponse, + AsyncBgpAnnouncesResourceWithRawResponse, + BgpAnnouncesResourceWithStreamingResponse, + AsyncBgpAnnouncesResourceWithStreamingResponse, +) +from .profile_templates import ( + ProfileTemplatesResource, + AsyncProfileTemplatesResource, + ProfileTemplatesResourceWithRawResponse, + AsyncProfileTemplatesResourceWithRawResponse, + ProfileTemplatesResourceWithStreamingResponse, + AsyncProfileTemplatesResourceWithStreamingResponse, +) + +__all__ = ["SecurityResource", "AsyncSecurityResource"] + + +class SecurityResource(SyncAPIResource): + @cached_property + def events(self) -> EventsResource: + return EventsResource(self._client) + + @cached_property + def bgp_announces(self) -> BgpAnnouncesResource: + return BgpAnnouncesResource(self._client) + + @cached_property + def profile_templates(self) -> ProfileTemplatesResource: + return ProfileTemplatesResource(self._client) + + @cached_property + def profiles(self) -> ProfilesResource: + return ProfilesResource(self._client) + + @cached_property + def with_raw_response(self) -> SecurityResourceWithRawResponse: + """ + 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 SecurityResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SecurityResourceWithStreamingResponse: + """ + 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 SecurityResourceWithStreamingResponse(self) + + +class AsyncSecurityResource(AsyncAPIResource): + @cached_property + def events(self) -> AsyncEventsResource: + return AsyncEventsResource(self._client) + + @cached_property + def bgp_announces(self) -> AsyncBgpAnnouncesResource: + return AsyncBgpAnnouncesResource(self._client) + + @cached_property + def profile_templates(self) -> AsyncProfileTemplatesResource: + return AsyncProfileTemplatesResource(self._client) + + @cached_property + def profiles(self) -> AsyncProfilesResource: + return AsyncProfilesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncSecurityResourceWithRawResponse: + """ + 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 AsyncSecurityResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSecurityResourceWithStreamingResponse: + """ + 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 AsyncSecurityResourceWithStreamingResponse(self) + + +class SecurityResourceWithRawResponse: + def __init__(self, security: SecurityResource) -> None: + self._security = security + + @cached_property + def events(self) -> EventsResourceWithRawResponse: + return EventsResourceWithRawResponse(self._security.events) + + @cached_property + def bgp_announces(self) -> BgpAnnouncesResourceWithRawResponse: + return BgpAnnouncesResourceWithRawResponse(self._security.bgp_announces) + + @cached_property + def profile_templates(self) -> ProfileTemplatesResourceWithRawResponse: + return ProfileTemplatesResourceWithRawResponse(self._security.profile_templates) + + @cached_property + def profiles(self) -> ProfilesResourceWithRawResponse: + return ProfilesResourceWithRawResponse(self._security.profiles) + + +class AsyncSecurityResourceWithRawResponse: + def __init__(self, security: AsyncSecurityResource) -> None: + self._security = security + + @cached_property + def events(self) -> AsyncEventsResourceWithRawResponse: + return AsyncEventsResourceWithRawResponse(self._security.events) + + @cached_property + def bgp_announces(self) -> AsyncBgpAnnouncesResourceWithRawResponse: + return AsyncBgpAnnouncesResourceWithRawResponse(self._security.bgp_announces) + + @cached_property + def profile_templates(self) -> AsyncProfileTemplatesResourceWithRawResponse: + return AsyncProfileTemplatesResourceWithRawResponse(self._security.profile_templates) + + @cached_property + def profiles(self) -> AsyncProfilesResourceWithRawResponse: + return AsyncProfilesResourceWithRawResponse(self._security.profiles) + + +class SecurityResourceWithStreamingResponse: + def __init__(self, security: SecurityResource) -> None: + self._security = security + + @cached_property + def events(self) -> EventsResourceWithStreamingResponse: + return EventsResourceWithStreamingResponse(self._security.events) + + @cached_property + def bgp_announces(self) -> BgpAnnouncesResourceWithStreamingResponse: + return BgpAnnouncesResourceWithStreamingResponse(self._security.bgp_announces) + + @cached_property + def profile_templates(self) -> ProfileTemplatesResourceWithStreamingResponse: + return ProfileTemplatesResourceWithStreamingResponse(self._security.profile_templates) + + @cached_property + def profiles(self) -> ProfilesResourceWithStreamingResponse: + return ProfilesResourceWithStreamingResponse(self._security.profiles) + + +class AsyncSecurityResourceWithStreamingResponse: + def __init__(self, security: AsyncSecurityResource) -> None: + self._security = security + + @cached_property + def events(self) -> AsyncEventsResourceWithStreamingResponse: + return AsyncEventsResourceWithStreamingResponse(self._security.events) + + @cached_property + def bgp_announces(self) -> AsyncBgpAnnouncesResourceWithStreamingResponse: + return AsyncBgpAnnouncesResourceWithStreamingResponse(self._security.bgp_announces) + + @cached_property + def profile_templates(self) -> AsyncProfileTemplatesResourceWithStreamingResponse: + return AsyncProfileTemplatesResourceWithStreamingResponse(self._security.profile_templates) + + @cached_property + def profiles(self) -> AsyncProfilesResourceWithStreamingResponse: + return AsyncProfilesResourceWithStreamingResponse(self._security.profiles) diff --git a/src/gcore/types/security/__init__.py b/src/gcore/types/security/__init__.py index f8ee8b14..4994ea70 100644 --- a/src/gcore/types/security/__init__.py +++ b/src/gcore/types/security/__init__.py @@ -1,3 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .client_view import ClientView as ClientView +from .client_profile import ClientProfile as ClientProfile +from .client_announce import ClientAnnounce as ClientAnnounce +from .event_list_params import EventListParams as EventListParams +from .profile_list_params import ProfileListParams as ProfileListParams +from .profile_create_params import ProfileCreateParams as ProfileCreateParams +from .profile_list_response import ProfileListResponse as ProfileListResponse +from .profile_replace_params import ProfileReplaceParams as ProfileReplaceParams +from .client_profile_template import ClientProfileTemplate as ClientProfileTemplate +from .profile_recreate_params import ProfileRecreateParams as ProfileRecreateParams +from .bgp_announce_list_params import BgpAnnounceListParams as BgpAnnounceListParams +from .bgp_announce_list_response import BgpAnnounceListResponse as BgpAnnounceListResponse +from .bgp_announce_toggle_params import BgpAnnounceToggleParams as BgpAnnounceToggleParams +from .profile_template_list_response import ProfileTemplateListResponse as ProfileTemplateListResponse diff --git a/src/gcore/types/security/bgp_announce_list_params.py b/src/gcore/types/security/bgp_announce_list_params.py new file mode 100644 index 00000000..390464fe --- /dev/null +++ b/src/gcore/types/security/bgp_announce_list_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 Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["BgpAnnounceListParams"] + + +class BgpAnnounceListParams(TypedDict, total=False): + announced: Optional[bool] + + client_id: Optional[int] + + origin: Optional[Literal["STATIC", "DYNAMIC"]] + + site: Optional[str] diff --git a/src/gcore/types/security/bgp_announce_list_response.py b/src/gcore/types/security/bgp_announce_list_response.py new file mode 100644 index 00000000..6981ba90 --- /dev/null +++ b/src/gcore/types/security/bgp_announce_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .client_announce import ClientAnnounce + +__all__ = ["BgpAnnounceListResponse"] + +BgpAnnounceListResponse: TypeAlias = List[ClientAnnounce] diff --git a/src/gcore/types/security/bgp_announce_toggle_params.py b/src/gcore/types/security/bgp_announce_toggle_params.py new file mode 100644 index 00000000..4c5dd1b6 --- /dev/null +++ b/src/gcore/types/security/bgp_announce_toggle_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +__all__ = ["BgpAnnounceToggleParams"] + + +class BgpAnnounceToggleParams(TypedDict, total=False): + announce: Required[str] + + enabled: Required[bool] + + client_id: Optional[int] diff --git a/src/gcore/types/security/client_announce.py b/src/gcore/types/security/client_announce.py new file mode 100644 index 00000000..ef276615 --- /dev/null +++ b/src/gcore/types/security/client_announce.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["ClientAnnounce"] + + +class ClientAnnounce(BaseModel): + announced: List[str] + + client_id: int + + not_announced: List[str] diff --git a/src/gcore/types/security/client_profile.py b/src/gcore/types/security/client_profile.py new file mode 100644 index 00000000..e02111b5 --- /dev/null +++ b/src/gcore/types/security/client_profile.py @@ -0,0 +1,56 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional + +from ..._models import BaseModel +from .client_profile_template import ClientProfileTemplate + +__all__ = ["ClientProfile", "Field", "Options"] + + +class Field(BaseModel): + id: int + + base_field: int + + default: str + + description: str + + field_type: str + + name: str + + required: bool + + validation_schema: Dict[str, object] + + field_value: Optional[object] = None + + +class Options(BaseModel): + active: bool + + bgp: bool + + price: str + + +class ClientProfile(BaseModel): + id: int + + fields: List[Field] + + options: Options + + plan: str + + profile_template: ClientProfileTemplate + + protocols: List[Dict[str, object]] + + site: str + + status: Dict[str, object] + + ip_address: Optional[str] = None diff --git a/src/gcore/types/security/client_profile_template.py b/src/gcore/types/security/client_profile_template.py new file mode 100644 index 00000000..4ea63e14 --- /dev/null +++ b/src/gcore/types/security/client_profile_template.py @@ -0,0 +1,43 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["ClientProfileTemplate", "Field"] + + +class Field(BaseModel): + id: int + + name: str + + default: Optional[str] = None + + description: Optional[str] = None + + field_type: Optional[Literal["int", "bool", "str"]] = None + + required: Optional[bool] = None + + validation_schema: Optional[Dict[str, object]] = None + + +class ClientProfileTemplate(BaseModel): + id: int + + created: datetime + + fields: List[Field] + + name: str + + version: str + + base_template: Optional[int] = None + + description: Optional[str] = None + + template_sifter: Optional[str] = None diff --git a/src/gcore/types/security/client_view.py b/src/gcore/types/security/client_view.py new file mode 100644 index 00000000..802060ab --- /dev/null +++ b/src/gcore/types/security/client_view.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["ClientView"] + + +class ClientView(BaseModel): + id: str + + alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] = None + + attack_power_bps: Optional[float] = None + + attack_power_pps: Optional[float] = None + + attack_start_time: Optional[datetime] = None + + client_id: Optional[int] = None + + notification_type: Optional[str] = None + + number_of_ip_involved_in_attack: Optional[int] = None + + targeted_ip_addresses: Optional[str] = None diff --git a/src/gcore/types/security/event_list_params.py b/src/gcore/types/security/event_list_params.py new file mode 100644 index 00000000..0bd703c3 --- /dev/null +++ b/src/gcore/types/security/event_list_params.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["EventListParams"] + + +class EventListParams(TypedDict, total=False): + alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] + + date_from: Annotated[Union[Union[str, datetime], str], PropertyInfo(format="iso8601")] + + date_to: Annotated[Union[Union[str, datetime], str], PropertyInfo(format="iso8601")] + + limit: int + + offset: int + + ordering: Literal[ + "attack_start_time", + "-attack_start_time", + "attack_power_bps", + "-attack_power_bps", + "attack_power_pps", + "-attack_power_pps", + "number_of_ip_involved_in_attack", + "-number_of_ip_involved_in_attack", + "alert_type", + "-alert_type", + ] + + targeted_ip_addresses: Optional[str] diff --git a/src/gcore/types/security/profile_create_params.py b/src/gcore/types/security/profile_create_params.py new file mode 100644 index 00000000..ad7b982c --- /dev/null +++ b/src/gcore/types/security/profile_create_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["ProfileCreateParams", "Field"] + + +class ProfileCreateParams(TypedDict, total=False): + fields: Required[Iterable[Field]] + + profile_template: Required[int] + + site: Required[str] + + ip_address: Optional[str] + + +class Field(TypedDict, total=False): + base_field: Required[int] + + field_value: object diff --git a/src/gcore/types/security/profile_list_params.py b/src/gcore/types/security/profile_list_params.py new file mode 100644 index 00000000..e54f232f --- /dev/null +++ b/src/gcore/types/security/profile_list_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ProfileListParams"] + + +class ProfileListParams(TypedDict, total=False): + exclude_empty_address: bool + + include_deleted: bool + + ip_address: str + + site: str diff --git a/src/gcore/types/security/profile_list_response.py b/src/gcore/types/security/profile_list_response.py new file mode 100644 index 00000000..816021c8 --- /dev/null +++ b/src/gcore/types/security/profile_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .client_profile import ClientProfile + +__all__ = ["ProfileListResponse"] + +ProfileListResponse: TypeAlias = List[ClientProfile] diff --git a/src/gcore/types/security/profile_recreate_params.py b/src/gcore/types/security/profile_recreate_params.py new file mode 100644 index 00000000..e1dd3d10 --- /dev/null +++ b/src/gcore/types/security/profile_recreate_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["ProfileRecreateParams", "Field"] + + +class ProfileRecreateParams(TypedDict, total=False): + fields: Required[Iterable[Field]] + + profile_template: Required[int] + + ip_address: Optional[str] + + site: str + + +class Field(TypedDict, total=False): + base_field: Required[int] + + field_value: object diff --git a/src/gcore/types/security/profile_replace_params.py b/src/gcore/types/security/profile_replace_params.py new file mode 100644 index 00000000..9684dffd --- /dev/null +++ b/src/gcore/types/security/profile_replace_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["ProfileReplaceParams", "Field"] + + +class ProfileReplaceParams(TypedDict, total=False): + fields: Required[Iterable[Field]] + + profile_template: Required[int] + + ip_address: Optional[str] + + site: str + + +class Field(TypedDict, total=False): + base_field: Required[int] + + field_value: object diff --git a/src/gcore/types/security/profile_template_list_response.py b/src/gcore/types/security/profile_template_list_response.py new file mode 100644 index 00000000..2264e970 --- /dev/null +++ b/src/gcore/types/security/profile_template_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .client_profile_template import ClientProfileTemplate + +__all__ = ["ProfileTemplateListResponse"] + +ProfileTemplateListResponse: TypeAlias = List[ClientProfileTemplate] diff --git a/tests/api_resources/security/__init__.py b/tests/api_resources/security/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/security/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/security/test_bgp_announces.py b/tests/api_resources/security/test_bgp_announces.py new file mode 100644 index 00000000..c1115976 --- /dev/null +++ b/tests/api_resources/security/test_bgp_announces.py @@ -0,0 +1,180 @@ +# 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.security import BgpAnnounceListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBgpAnnounces: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + bgp_announce = client.security.bgp_announces.list() + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + bgp_announce = client.security.bgp_announces.list( + announced=True, + client_id=0, + origin="STATIC", + site="x", + ) + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.security.bgp_announces.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_announce = response.parse() + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.security.bgp_announces.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_announce = response.parse() + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_toggle(self, client: Gcore) -> None: + bgp_announce = client.security.bgp_announces.toggle( + announce="192.9.9.1/32", + enabled=True, + ) + assert_matches_type(object, bgp_announce, path=["response"]) + + @parametrize + def test_method_toggle_with_all_params(self, client: Gcore) -> None: + bgp_announce = client.security.bgp_announces.toggle( + announce="192.9.9.1/32", + enabled=True, + client_id=0, + ) + assert_matches_type(object, bgp_announce, path=["response"]) + + @parametrize + def test_raw_response_toggle(self, client: Gcore) -> None: + response = client.security.bgp_announces.with_raw_response.toggle( + announce="192.9.9.1/32", + enabled=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_announce = response.parse() + assert_matches_type(object, bgp_announce, path=["response"]) + + @parametrize + def test_streaming_response_toggle(self, client: Gcore) -> None: + with client.security.bgp_announces.with_streaming_response.toggle( + announce="192.9.9.1/32", + enabled=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_announce = response.parse() + assert_matches_type(object, bgp_announce, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncBgpAnnounces: + 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: + bgp_announce = await async_client.security.bgp_announces.list() + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + bgp_announce = await async_client.security.bgp_announces.list( + announced=True, + client_id=0, + origin="STATIC", + site="x", + ) + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.security.bgp_announces.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_announce = await response.parse() + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.security.bgp_announces.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_announce = await response.parse() + assert_matches_type(BgpAnnounceListResponse, bgp_announce, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_toggle(self, async_client: AsyncGcore) -> None: + bgp_announce = await async_client.security.bgp_announces.toggle( + announce="192.9.9.1/32", + enabled=True, + ) + assert_matches_type(object, bgp_announce, path=["response"]) + + @parametrize + async def test_method_toggle_with_all_params(self, async_client: AsyncGcore) -> None: + bgp_announce = await async_client.security.bgp_announces.toggle( + announce="192.9.9.1/32", + enabled=True, + client_id=0, + ) + assert_matches_type(object, bgp_announce, path=["response"]) + + @parametrize + async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: + response = await async_client.security.bgp_announces.with_raw_response.toggle( + announce="192.9.9.1/32", + enabled=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bgp_announce = await response.parse() + assert_matches_type(object, bgp_announce, path=["response"]) + + @parametrize + async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: + async with async_client.security.bgp_announces.with_streaming_response.toggle( + announce="192.9.9.1/32", + enabled=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bgp_announce = await response.parse() + assert_matches_type(object, bgp_announce, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/security/test_events.py b/tests/api_resources/security/test_events.py new file mode 100644 index 00000000..650de2cf --- /dev/null +++ b/tests/api_resources/security/test_events.py @@ -0,0 +1,102 @@ +# 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._utils import parse_datetime +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.security import ClientView + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestEvents: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + event = client.security.events.list() + assert_matches_type(SyncOffsetPage[ClientView], event, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + event = client.security.events.list( + alert_type="ddos_alert", + date_from=parse_datetime("2019-12-27T18:11:19.117Z"), + date_to=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=1, + offset=0, + ordering="attack_start_time", + targeted_ip_addresses="targeted_ip_addresses", + ) + assert_matches_type(SyncOffsetPage[ClientView], event, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.security.events.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = response.parse() + assert_matches_type(SyncOffsetPage[ClientView], event, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.security.events.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = response.parse() + assert_matches_type(SyncOffsetPage[ClientView], event, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncEvents: + 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: + event = await async_client.security.events.list() + assert_matches_type(AsyncOffsetPage[ClientView], event, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + event = await async_client.security.events.list( + alert_type="ddos_alert", + date_from=parse_datetime("2019-12-27T18:11:19.117Z"), + date_to=parse_datetime("2019-12-27T18:11:19.117Z"), + limit=1, + offset=0, + ordering="attack_start_time", + targeted_ip_addresses="targeted_ip_addresses", + ) + assert_matches_type(AsyncOffsetPage[ClientView], event, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.security.events.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + event = await response.parse() + assert_matches_type(AsyncOffsetPage[ClientView], event, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.security.events.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + event = await response.parse() + assert_matches_type(AsyncOffsetPage[ClientView], event, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/security/test_profile_templates.py b/tests/api_resources/security/test_profile_templates.py new file mode 100644 index 00000000..7df4918f --- /dev/null +++ b/tests/api_resources/security/test_profile_templates.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.security import ProfileTemplateListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestProfileTemplates: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + profile_template = client.security.profile_templates.list() + assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.security.profile_templates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile_template = response.parse() + assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.security.profile_templates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile_template = response.parse() + assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncProfileTemplates: + 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: + profile_template = await async_client.security.profile_templates.list() + assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profile_templates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile_template = await response.parse() + assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.security.profile_templates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile_template = await response.parse() + assert_matches_type(ProfileTemplateListResponse, profile_template, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/security/test_profiles.py b/tests/api_resources/security/test_profiles.py new file mode 100644 index 00000000..c79499ab --- /dev/null +++ b/tests/api_resources/security/test_profiles.py @@ -0,0 +1,537 @@ +# 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.security import ( + ClientProfile, + ProfileListResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestProfiles: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + profile = client.security.profiles.create( + fields=[{"base_field": 1}], + profile_template=1, + site="GNC", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + profile = client.security.profiles.create( + fields=[ + { + "base_field": 1, + "field_value": {}, + } + ], + profile_template=1, + site="GNC", + ip_address="123.43.2.10", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.security.profiles.with_raw_response.create( + fields=[{"base_field": 1}], + profile_template=1, + site="GNC", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.security.profiles.with_streaming_response.create( + fields=[{"base_field": 1}], + profile_template=1, + site="GNC", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + profile = client.security.profiles.list() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + profile = client.security.profiles.list( + exclude_empty_address=True, + include_deleted=True, + ip_address="ip_address", + site="site", + ) + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.security.profiles.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.security.profiles.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + profile = client.security.profiles.delete( + 0, + ) + assert profile is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.security.profiles.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert profile is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.security.profiles.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert profile is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + profile = client.security.profiles.get( + 0, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.security.profiles.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.security.profiles.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_recreate(self, client: Gcore) -> None: + profile = client.security.profiles.recreate( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_method_recreate_with_all_params(self, client: Gcore) -> None: + profile = client.security.profiles.recreate( + id=0, + fields=[ + { + "base_field": 1, + "field_value": {}, + } + ], + profile_template=1, + ip_address="ip_address", + site="ED", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_raw_response_recreate(self, client: Gcore) -> None: + response = client.security.profiles.with_raw_response.recreate( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_streaming_response_recreate(self, client: Gcore) -> None: + with client.security.profiles.with_streaming_response.recreate( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + profile = client.security.profiles.replace( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + profile = client.security.profiles.replace( + id=0, + fields=[ + { + "base_field": 1, + "field_value": {}, + } + ], + profile_template=1, + ip_address="ip_address", + site="ED", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.security.profiles.with_raw_response.replace( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.security.profiles.with_streaming_response.replace( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncProfiles: + 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: + profile = await async_client.security.profiles.create( + fields=[{"base_field": 1}], + profile_template=1, + site="GNC", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.create( + fields=[ + { + "base_field": 1, + "field_value": {}, + } + ], + profile_template=1, + site="GNC", + ip_address="123.43.2.10", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profiles.with_raw_response.create( + fields=[{"base_field": 1}], + profile_template=1, + site="GNC", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.security.profiles.with_streaming_response.create( + fields=[{"base_field": 1}], + profile_template=1, + site="GNC", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.list() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.list( + exclude_empty_address=True, + include_deleted=True, + ip_address="ip_address", + site="site", + ) + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profiles.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.security.profiles.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(ProfileListResponse, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.delete( + 0, + ) + assert profile is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profiles.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert profile is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.security.profiles.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert profile is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.get( + 0, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profiles.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.security.profiles.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_recreate(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.recreate( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_method_recreate_with_all_params(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.recreate( + id=0, + fields=[ + { + "base_field": 1, + "field_value": {}, + } + ], + profile_template=1, + ip_address="ip_address", + site="ED", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_raw_response_recreate(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profiles.with_raw_response.recreate( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_streaming_response_recreate(self, async_client: AsyncGcore) -> None: + async with async_client.security.profiles.with_streaming_response.recreate( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.replace( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + profile = await async_client.security.profiles.replace( + id=0, + fields=[ + { + "base_field": 1, + "field_value": {}, + } + ], + profile_template=1, + ip_address="ip_address", + site="ED", + ) + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.security.profiles.with_raw_response.replace( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.security.profiles.with_streaming_response.replace( + id=0, + fields=[{"base_field": 1}], + profile_template=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + profile = await response.parse() + assert_matches_type(ClientProfile, profile, path=["response"]) + + assert cast(Any, response.is_closed) is True From 1b54d597e0b89633fee4d787e16eea7576d787f4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 15:47:43 +0000 Subject: [PATCH 419/592] feat(cloud): add support for postgres --- .stats.yml | 4 +- api.md | 57 ++ src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + .../resources/cloud/databases/__init__.py | 33 + .../resources/cloud/databases/databases.py | 102 +++ .../cloud/databases/postgres/__init__.py | 61 ++ .../databases/postgres/clusters/__init__.py | 33 + .../databases/postgres/clusters/clusters.py | 716 +++++++++++++++++ .../postgres/clusters/user_credentials.py | 281 +++++++ .../databases/postgres/configurations.py | 169 ++++ .../postgres/custom_configurations.py | 197 +++++ .../cloud/databases/postgres/postgres.py | 166 ++++ src/gcore/types/cloud/databases/__init__.py | 3 + .../cloud/databases/postgres/__init__.py | 12 + .../postgres/cluster_create_params.py | 108 +++ .../databases/postgres/cluster_list_params.py | 19 + .../postgres/cluster_update_params.py | 102 +++ .../databases/postgres/clusters/__init__.py | 5 + .../clusters/postgres_user_credentials.py | 13 + .../custom_configuration_validate_params.py | 19 + .../databases/postgres/pg_conf_validation.py | 15 + .../databases/postgres/postgres_cluster.py | 118 +++ .../postgres/postgres_cluster_short.py | 22 + .../postgres/postgres_configuration.py | 31 + .../api_resources/cloud/databases/__init__.py | 1 + .../cloud/databases/postgres/__init__.py | 1 + .../databases/postgres/clusters/__init__.py | 1 + .../clusters/test_user_credentials.py | 256 ++++++ .../cloud/databases/postgres/test_clusters.py | 731 ++++++++++++++++++ .../databases/postgres/test_configurations.py | 92 +++ .../postgres/test_custom_configurations.py | 104 +++ 32 files changed, 3516 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/databases/__init__.py create mode 100644 src/gcore/resources/cloud/databases/databases.py create mode 100644 src/gcore/resources/cloud/databases/postgres/__init__.py create mode 100644 src/gcore/resources/cloud/databases/postgres/clusters/__init__.py create mode 100644 src/gcore/resources/cloud/databases/postgres/clusters/clusters.py create mode 100644 src/gcore/resources/cloud/databases/postgres/clusters/user_credentials.py create mode 100644 src/gcore/resources/cloud/databases/postgres/configurations.py create mode 100644 src/gcore/resources/cloud/databases/postgres/custom_configurations.py create mode 100644 src/gcore/resources/cloud/databases/postgres/postgres.py create mode 100644 src/gcore/types/cloud/databases/__init__.py create mode 100644 src/gcore/types/cloud/databases/postgres/__init__.py create mode 100644 src/gcore/types/cloud/databases/postgres/cluster_create_params.py create mode 100644 src/gcore/types/cloud/databases/postgres/cluster_list_params.py create mode 100644 src/gcore/types/cloud/databases/postgres/cluster_update_params.py create mode 100644 src/gcore/types/cloud/databases/postgres/clusters/__init__.py create mode 100644 src/gcore/types/cloud/databases/postgres/clusters/postgres_user_credentials.py create mode 100644 src/gcore/types/cloud/databases/postgres/custom_configuration_validate_params.py create mode 100644 src/gcore/types/cloud/databases/postgres/pg_conf_validation.py create mode 100644 src/gcore/types/cloud/databases/postgres/postgres_cluster.py create mode 100644 src/gcore/types/cloud/databases/postgres/postgres_cluster_short.py create mode 100644 src/gcore/types/cloud/databases/postgres/postgres_configuration.py create mode 100644 tests/api_resources/cloud/databases/__init__.py create mode 100644 tests/api_resources/cloud/databases/postgres/__init__.py create mode 100644 tests/api_resources/cloud/databases/postgres/clusters/__init__.py create mode 100644 tests/api_resources/cloud/databases/postgres/clusters/test_user_credentials.py create mode 100644 tests/api_resources/cloud/databases/postgres/test_clusters.py create mode 100644 tests/api_resources/cloud/databases/postgres/test_configurations.py create mode 100644 tests/api_resources/cloud/databases/postgres/test_custom_configurations.py diff --git a/.stats.yml b/.stats.yml index 72bd8302..bb221715 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 609 +configured_endpoints: 618 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1089f2c131ebee7df82e158c4210c07f019b47549d84fe6ea7f022117c83a008.yml openapi_spec_hash: 9758acbadc1ee1bc0d826d4657e1ad4a -config_hash: 4758209f53bb13d06f55e4cf6c952b6d +config_hash: 79098512b2ff15053f2813524c207add diff --git a/api.md b/api.md index 6ff46915..180b482b 100644 --- a/api.md +++ b/api.md @@ -1006,6 +1006,63 @@ Methods: - client.cloud.usage_reports.get(\*\*params) -> UsageReport +## Databases + +### Postgres + +#### Clusters + +Types: + +```python +from gcore.types.cloud.databases.postgres import PostgresCluster, PostgresClusterShort +``` + +Methods: + +- client.cloud.databases.postgres.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.databases.postgres.clusters.update(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.databases.postgres.clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[PostgresClusterShort] +- client.cloud.databases.postgres.clusters.delete(cluster_name, \*, project_id, region_id) -> TaskIDList +- client.cloud.databases.postgres.clusters.get(cluster_name, \*, project_id, region_id) -> PostgresCluster + +##### UserCredentials + +Types: + +```python +from gcore.types.cloud.databases.postgres.clusters import PostgresUserCredentials +``` + +Methods: + +- client.cloud.databases.postgres.clusters.user_credentials.get(username, \*, project_id, region_id, cluster_name) -> PostgresUserCredentials +- client.cloud.databases.postgres.clusters.user_credentials.regenerate(username, \*, project_id, region_id, cluster_name) -> PostgresUserCredentials + +#### Configurations + +Types: + +```python +from gcore.types.cloud.databases.postgres import PostgresConfiguration +``` + +Methods: + +- client.cloud.databases.postgres.configurations.get(\*, project_id, region_id) -> PostgresConfiguration + +#### CustomConfigurations + +Types: + +```python +from gcore.types.cloud.databases.postgres import PgConfValidation +``` + +Methods: + +- client.cloud.databases.postgres.custom_configurations.validate(\*, project_id, region_id, \*\*params) -> PgConfValidation + # Waap Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index c78945ec..b430fc7c 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -96,6 +96,14 @@ BaremetalResourceWithStreamingResponse, AsyncBaremetalResourceWithStreamingResponse, ) +from .databases import ( + DatabasesResource, + AsyncDatabasesResource, + DatabasesResourceWithRawResponse, + AsyncDatabasesResourceWithRawResponse, + DatabasesResourceWithStreamingResponse, + AsyncDatabasesResourceWithStreamingResponse, +) from .inference import ( InferenceResource, AsyncInferenceResource, @@ -374,6 +382,12 @@ "AsyncUsageReportsResourceWithRawResponse", "UsageReportsResourceWithStreamingResponse", "AsyncUsageReportsResourceWithStreamingResponse", + "DatabasesResource", + "AsyncDatabasesResource", + "DatabasesResourceWithRawResponse", + "AsyncDatabasesResourceWithRawResponse", + "DatabasesResourceWithStreamingResponse", + "AsyncDatabasesResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 7628349c..6583dc98 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -140,6 +140,14 @@ BaremetalResourceWithStreamingResponse, AsyncBaremetalResourceWithStreamingResponse, ) +from .databases.databases import ( + DatabasesResource, + AsyncDatabasesResource, + DatabasesResourceWithRawResponse, + AsyncDatabasesResourceWithRawResponse, + DatabasesResourceWithStreamingResponse, + AsyncDatabasesResourceWithStreamingResponse, +) from .inference.inference import ( InferenceResource, AsyncInferenceResource, @@ -328,6 +336,10 @@ def cost_reports(self) -> CostReportsResource: def usage_reports(self) -> UsageReportsResource: return UsageReportsResource(self._client) + @cached_property + def databases(self) -> DatabasesResource: + return DatabasesResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -460,6 +472,10 @@ def cost_reports(self) -> AsyncCostReportsResource: def usage_reports(self) -> AsyncUsageReportsResource: return AsyncUsageReportsResource(self._client) + @cached_property + def databases(self) -> AsyncDatabasesResource: + return AsyncDatabasesResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -595,6 +611,10 @@ def cost_reports(self) -> CostReportsResourceWithRawResponse: def usage_reports(self) -> UsageReportsResourceWithRawResponse: return UsageReportsResourceWithRawResponse(self._cloud.usage_reports) + @cached_property + def databases(self) -> DatabasesResourceWithRawResponse: + return DatabasesResourceWithRawResponse(self._cloud.databases) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -711,6 +731,10 @@ def cost_reports(self) -> AsyncCostReportsResourceWithRawResponse: def usage_reports(self) -> AsyncUsageReportsResourceWithRawResponse: return AsyncUsageReportsResourceWithRawResponse(self._cloud.usage_reports) + @cached_property + def databases(self) -> AsyncDatabasesResourceWithRawResponse: + return AsyncDatabasesResourceWithRawResponse(self._cloud.databases) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -827,6 +851,10 @@ def cost_reports(self) -> CostReportsResourceWithStreamingResponse: def usage_reports(self) -> UsageReportsResourceWithStreamingResponse: return UsageReportsResourceWithStreamingResponse(self._cloud.usage_reports) + @cached_property + def databases(self) -> DatabasesResourceWithStreamingResponse: + return DatabasesResourceWithStreamingResponse(self._cloud.databases) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -942,3 +970,7 @@ def cost_reports(self) -> AsyncCostReportsResourceWithStreamingResponse: @cached_property def usage_reports(self) -> AsyncUsageReportsResourceWithStreamingResponse: return AsyncUsageReportsResourceWithStreamingResponse(self._cloud.usage_reports) + + @cached_property + def databases(self) -> AsyncDatabasesResourceWithStreamingResponse: + return AsyncDatabasesResourceWithStreamingResponse(self._cloud.databases) diff --git a/src/gcore/resources/cloud/databases/__init__.py b/src/gcore/resources/cloud/databases/__init__.py new file mode 100644 index 00000000..6935a4f7 --- /dev/null +++ b/src/gcore/resources/cloud/databases/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .postgres import ( + PostgresResource, + AsyncPostgresResource, + PostgresResourceWithRawResponse, + AsyncPostgresResourceWithRawResponse, + PostgresResourceWithStreamingResponse, + AsyncPostgresResourceWithStreamingResponse, +) +from .databases import ( + DatabasesResource, + AsyncDatabasesResource, + DatabasesResourceWithRawResponse, + AsyncDatabasesResourceWithRawResponse, + DatabasesResourceWithStreamingResponse, + AsyncDatabasesResourceWithStreamingResponse, +) + +__all__ = [ + "PostgresResource", + "AsyncPostgresResource", + "PostgresResourceWithRawResponse", + "AsyncPostgresResourceWithRawResponse", + "PostgresResourceWithStreamingResponse", + "AsyncPostgresResourceWithStreamingResponse", + "DatabasesResource", + "AsyncDatabasesResource", + "DatabasesResourceWithRawResponse", + "AsyncDatabasesResourceWithRawResponse", + "DatabasesResourceWithStreamingResponse", + "AsyncDatabasesResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/databases/databases.py b/src/gcore/resources/cloud/databases/databases.py new file mode 100644 index 00000000..baacc4af --- /dev/null +++ b/src/gcore/resources/cloud/databases/databases.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from .postgres.postgres import ( + PostgresResource, + AsyncPostgresResource, + PostgresResourceWithRawResponse, + AsyncPostgresResourceWithRawResponse, + PostgresResourceWithStreamingResponse, + AsyncPostgresResourceWithStreamingResponse, +) + +__all__ = ["DatabasesResource", "AsyncDatabasesResource"] + + +class DatabasesResource(SyncAPIResource): + @cached_property + def postgres(self) -> PostgresResource: + return PostgresResource(self._client) + + @cached_property + def with_raw_response(self) -> DatabasesResourceWithRawResponse: + """ + 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 DatabasesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DatabasesResourceWithStreamingResponse: + """ + 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 DatabasesResourceWithStreamingResponse(self) + + +class AsyncDatabasesResource(AsyncAPIResource): + @cached_property + def postgres(self) -> AsyncPostgresResource: + return AsyncPostgresResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncDatabasesResourceWithRawResponse: + """ + 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 AsyncDatabasesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDatabasesResourceWithStreamingResponse: + """ + 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 AsyncDatabasesResourceWithStreamingResponse(self) + + +class DatabasesResourceWithRawResponse: + def __init__(self, databases: DatabasesResource) -> None: + self._databases = databases + + @cached_property + def postgres(self) -> PostgresResourceWithRawResponse: + return PostgresResourceWithRawResponse(self._databases.postgres) + + +class AsyncDatabasesResourceWithRawResponse: + def __init__(self, databases: AsyncDatabasesResource) -> None: + self._databases = databases + + @cached_property + def postgres(self) -> AsyncPostgresResourceWithRawResponse: + return AsyncPostgresResourceWithRawResponse(self._databases.postgres) + + +class DatabasesResourceWithStreamingResponse: + def __init__(self, databases: DatabasesResource) -> None: + self._databases = databases + + @cached_property + def postgres(self) -> PostgresResourceWithStreamingResponse: + return PostgresResourceWithStreamingResponse(self._databases.postgres) + + +class AsyncDatabasesResourceWithStreamingResponse: + def __init__(self, databases: AsyncDatabasesResource) -> None: + self._databases = databases + + @cached_property + def postgres(self) -> AsyncPostgresResourceWithStreamingResponse: + return AsyncPostgresResourceWithStreamingResponse(self._databases.postgres) diff --git a/src/gcore/resources/cloud/databases/postgres/__init__.py b/src/gcore/resources/cloud/databases/postgres/__init__.py new file mode 100644 index 00000000..63128146 --- /dev/null +++ b/src/gcore/resources/cloud/databases/postgres/__init__.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) +from .postgres import ( + PostgresResource, + AsyncPostgresResource, + PostgresResourceWithRawResponse, + AsyncPostgresResourceWithRawResponse, + PostgresResourceWithStreamingResponse, + AsyncPostgresResourceWithStreamingResponse, +) +from .configurations import ( + ConfigurationsResource, + AsyncConfigurationsResource, + ConfigurationsResourceWithRawResponse, + AsyncConfigurationsResourceWithRawResponse, + ConfigurationsResourceWithStreamingResponse, + AsyncConfigurationsResourceWithStreamingResponse, +) +from .custom_configurations import ( + CustomConfigurationsResource, + AsyncCustomConfigurationsResource, + CustomConfigurationsResourceWithRawResponse, + AsyncCustomConfigurationsResourceWithRawResponse, + CustomConfigurationsResourceWithStreamingResponse, + AsyncCustomConfigurationsResourceWithStreamingResponse, +) + +__all__ = [ + "ClustersResource", + "AsyncClustersResource", + "ClustersResourceWithRawResponse", + "AsyncClustersResourceWithRawResponse", + "ClustersResourceWithStreamingResponse", + "AsyncClustersResourceWithStreamingResponse", + "ConfigurationsResource", + "AsyncConfigurationsResource", + "ConfigurationsResourceWithRawResponse", + "AsyncConfigurationsResourceWithRawResponse", + "ConfigurationsResourceWithStreamingResponse", + "AsyncConfigurationsResourceWithStreamingResponse", + "CustomConfigurationsResource", + "AsyncCustomConfigurationsResource", + "CustomConfigurationsResourceWithRawResponse", + "AsyncCustomConfigurationsResourceWithRawResponse", + "CustomConfigurationsResourceWithStreamingResponse", + "AsyncCustomConfigurationsResourceWithStreamingResponse", + "PostgresResource", + "AsyncPostgresResource", + "PostgresResourceWithRawResponse", + "AsyncPostgresResourceWithRawResponse", + "PostgresResourceWithStreamingResponse", + "AsyncPostgresResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/databases/postgres/clusters/__init__.py b/src/gcore/resources/cloud/databases/postgres/clusters/__init__.py new file mode 100644 index 00000000..677f309e --- /dev/null +++ b/src/gcore/resources/cloud/databases/postgres/clusters/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) +from .user_credentials import ( + UserCredentialsResource, + AsyncUserCredentialsResource, + UserCredentialsResourceWithRawResponse, + AsyncUserCredentialsResourceWithRawResponse, + UserCredentialsResourceWithStreamingResponse, + AsyncUserCredentialsResourceWithStreamingResponse, +) + +__all__ = [ + "UserCredentialsResource", + "AsyncUserCredentialsResource", + "UserCredentialsResourceWithRawResponse", + "AsyncUserCredentialsResourceWithRawResponse", + "UserCredentialsResourceWithStreamingResponse", + "AsyncUserCredentialsResourceWithStreamingResponse", + "ClustersResource", + "AsyncClustersResource", + "ClustersResourceWithRawResponse", + "AsyncClustersResourceWithRawResponse", + "ClustersResourceWithStreamingResponse", + "AsyncClustersResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/databases/postgres/clusters/clusters.py b/src/gcore/resources/cloud/databases/postgres/clusters/clusters.py new file mode 100644 index 00000000..bb01ed8b --- /dev/null +++ b/src/gcore/resources/cloud/databases/postgres/clusters/clusters.py @@ -0,0 +1,716 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional + +import httpx + +from ......_types import Body, Omit, Query, Headers, 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 ......pagination import SyncOffsetPage, AsyncOffsetPage +from .user_credentials import ( + UserCredentialsResource, + AsyncUserCredentialsResource, + UserCredentialsResourceWithRawResponse, + AsyncUserCredentialsResourceWithRawResponse, + UserCredentialsResourceWithStreamingResponse, + AsyncUserCredentialsResourceWithStreamingResponse, +) +from ......_base_client import AsyncPaginator, make_request_options +from ......types.cloud.task_id_list import TaskIDList +from ......types.cloud.databases.postgres import cluster_list_params, cluster_create_params, cluster_update_params +from ......types.cloud.databases.postgres.postgres_cluster import PostgresCluster +from ......types.cloud.databases.postgres.postgres_cluster_short import PostgresClusterShort + +__all__ = ["ClustersResource", "AsyncClustersResource"] + + +class ClustersResource(SyncAPIResource): + @cached_property + def user_credentials(self) -> UserCredentialsResource: + return UserCredentialsResource(self._client) + + @cached_property + def with_raw_response(self) -> ClustersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return ClustersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ClustersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return ClustersResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_name: str, + flavor: cluster_create_params.Flavor, + high_availability: Optional[cluster_create_params.HighAvailability], + network: cluster_create_params.Network, + pg_server_configuration: cluster_create_params.PgServerConfiguration, + storage: cluster_create_params.Storage, + databases: Iterable[cluster_create_params.Database] | Omit = omit, + users: Iterable[cluster_create_params.User] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Create a new PostgreSQL cluster with the specified configuration. + + Args: + cluster_name: PostgreSQL cluster name + + flavor: Instance RAM and CPU + + high_availability: High Availability settings + + pg_server_configuration: PosgtreSQL cluster configuration + + storage: Cluster's storage configuration + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}", + body=maybe_transform( + { + "cluster_name": cluster_name, + "flavor": flavor, + "high_availability": high_availability, + "network": network, + "pg_server_configuration": pg_server_configuration, + "storage": storage, + "databases": databases, + "users": users, + }, + cluster_create_params.ClusterCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + databases: Iterable[cluster_update_params.Database] | Omit = omit, + flavor: Optional[cluster_update_params.Flavor] | Omit = omit, + high_availability: Optional[cluster_update_params.HighAvailability] | Omit = omit, + network: Optional[cluster_update_params.Network] | Omit = omit, + pg_server_configuration: Optional[cluster_update_params.PgServerConfiguration] | Omit = omit, + storage: Optional[cluster_update_params.Storage] | Omit = omit, + users: Iterable[cluster_update_params.User] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Update the configuration of an existing PostgreSQL cluster. + + Args: + flavor: New instance RAM and CPU + + high_availability: New High Availability settings + + pg_server_configuration: New PosgtreSQL cluster configuration + + storage: New storage configuration + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._patch( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}", + body=maybe_transform( + { + "databases": databases, + "flavor": flavor, + "high_availability": high_availability, + "network": network, + "pg_server_configuration": pg_server_configuration, + "storage": storage, + "users": users, + }, + cluster_update_params.ClusterUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | Omit = omit, + offset: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncOffsetPage[PostgresClusterShort]: + """List all PostgreSQL clusters in the specified project and region. + + Results can be + filtered by search query and paginated. + + Args: + limit: Maximum number of clusters to return + + offset: Number of clusters to skip + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}", + page=SyncOffsetPage[PostgresClusterShort], + 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, + }, + cluster_list_params.ClusterListParams, + ), + ), + model=PostgresClusterShort, + ) + + def delete( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete a PostgreSQL cluster and all its associated resources. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._delete( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PostgresCluster: + """ + Get detailed information about a specific PostgreSQL cluster. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return self._get( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PostgresCluster, + ) + + +class AsyncClustersResource(AsyncAPIResource): + @cached_property + def user_credentials(self) -> AsyncUserCredentialsResource: + return AsyncUserCredentialsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncClustersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncClustersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncClustersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncClustersResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_name: str, + flavor: cluster_create_params.Flavor, + high_availability: Optional[cluster_create_params.HighAvailability], + network: cluster_create_params.Network, + pg_server_configuration: cluster_create_params.PgServerConfiguration, + storage: cluster_create_params.Storage, + databases: Iterable[cluster_create_params.Database] | Omit = omit, + users: Iterable[cluster_create_params.User] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Create a new PostgreSQL cluster with the specified configuration. + + Args: + cluster_name: PostgreSQL cluster name + + flavor: Instance RAM and CPU + + high_availability: High Availability settings + + pg_server_configuration: PosgtreSQL cluster configuration + + storage: Cluster's storage configuration + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "cluster_name": cluster_name, + "flavor": flavor, + "high_availability": high_availability, + "network": network, + "pg_server_configuration": pg_server_configuration, + "storage": storage, + "databases": databases, + "users": users, + }, + cluster_create_params.ClusterCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + databases: Iterable[cluster_update_params.Database] | Omit = omit, + flavor: Optional[cluster_update_params.Flavor] | Omit = omit, + high_availability: Optional[cluster_update_params.HighAvailability] | Omit = omit, + network: Optional[cluster_update_params.Network] | Omit = omit, + pg_server_configuration: Optional[cluster_update_params.PgServerConfiguration] | Omit = omit, + storage: Optional[cluster_update_params.Storage] | Omit = omit, + users: Iterable[cluster_update_params.User] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Update the configuration of an existing PostgreSQL cluster. + + Args: + flavor: New instance RAM and CPU + + high_availability: New High Availability settings + + pg_server_configuration: New PosgtreSQL cluster configuration + + storage: New storage configuration + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._patch( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}", + body=await async_maybe_transform( + { + "databases": databases, + "flavor": flavor, + "high_availability": high_availability, + "network": network, + "pg_server_configuration": pg_server_configuration, + "storage": storage, + "users": users, + }, + cluster_update_params.ClusterUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | Omit = omit, + offset: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[PostgresClusterShort, AsyncOffsetPage[PostgresClusterShort]]: + """List all PostgreSQL clusters in the specified project and region. + + Results can be + filtered by search query and paginated. + + Args: + limit: Maximum number of clusters to return + + offset: Number of clusters to skip + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get_api_list( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}", + page=AsyncOffsetPage[PostgresClusterShort], + 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, + }, + cluster_list_params.ClusterListParams, + ), + ), + model=PostgresClusterShort, + ) + + async def delete( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete a PostgreSQL cluster and all its associated resources. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._delete( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + cluster_name: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PostgresCluster: + """ + Get detailed information about a specific PostgreSQL cluster. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + return await self._get( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PostgresCluster, + ) + + +class ClustersResourceWithRawResponse: + def __init__(self, clusters: ClustersResource) -> None: + self._clusters = clusters + + self.create = to_raw_response_wrapper( + clusters.create, + ) + self.update = to_raw_response_wrapper( + clusters.update, + ) + self.list = to_raw_response_wrapper( + clusters.list, + ) + self.delete = to_raw_response_wrapper( + clusters.delete, + ) + self.get = to_raw_response_wrapper( + clusters.get, + ) + + @cached_property + def user_credentials(self) -> UserCredentialsResourceWithRawResponse: + return UserCredentialsResourceWithRawResponse(self._clusters.user_credentials) + + +class AsyncClustersResourceWithRawResponse: + def __init__(self, clusters: AsyncClustersResource) -> None: + self._clusters = clusters + + self.create = async_to_raw_response_wrapper( + clusters.create, + ) + self.update = async_to_raw_response_wrapper( + clusters.update, + ) + self.list = async_to_raw_response_wrapper( + clusters.list, + ) + self.delete = async_to_raw_response_wrapper( + clusters.delete, + ) + self.get = async_to_raw_response_wrapper( + clusters.get, + ) + + @cached_property + def user_credentials(self) -> AsyncUserCredentialsResourceWithRawResponse: + return AsyncUserCredentialsResourceWithRawResponse(self._clusters.user_credentials) + + +class ClustersResourceWithStreamingResponse: + def __init__(self, clusters: ClustersResource) -> None: + self._clusters = clusters + + self.create = to_streamed_response_wrapper( + clusters.create, + ) + self.update = to_streamed_response_wrapper( + clusters.update, + ) + self.list = to_streamed_response_wrapper( + clusters.list, + ) + self.delete = to_streamed_response_wrapper( + clusters.delete, + ) + self.get = to_streamed_response_wrapper( + clusters.get, + ) + + @cached_property + def user_credentials(self) -> UserCredentialsResourceWithStreamingResponse: + return UserCredentialsResourceWithStreamingResponse(self._clusters.user_credentials) + + +class AsyncClustersResourceWithStreamingResponse: + def __init__(self, clusters: AsyncClustersResource) -> None: + self._clusters = clusters + + self.create = async_to_streamed_response_wrapper( + clusters.create, + ) + self.update = async_to_streamed_response_wrapper( + clusters.update, + ) + self.list = async_to_streamed_response_wrapper( + clusters.list, + ) + self.delete = async_to_streamed_response_wrapper( + clusters.delete, + ) + self.get = async_to_streamed_response_wrapper( + clusters.get, + ) + + @cached_property + def user_credentials(self) -> AsyncUserCredentialsResourceWithStreamingResponse: + return AsyncUserCredentialsResourceWithStreamingResponse(self._clusters.user_credentials) diff --git a/src/gcore/resources/cloud/databases/postgres/clusters/user_credentials.py b/src/gcore/resources/cloud/databases/postgres/clusters/user_credentials.py new file mode 100644 index 00000000..98ad25be --- /dev/null +++ b/src/gcore/resources/cloud/databases/postgres/clusters/user_credentials.py @@ -0,0 +1,281 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ......_types import Body, Query, Headers, NotGiven, not_given +from ......_compat import cached_property +from ......_resource import SyncAPIResource, AsyncAPIResource +from ......_response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ......_base_client import make_request_options +from ......types.cloud.databases.postgres.clusters.postgres_user_credentials import PostgresUserCredentials + +__all__ = ["UserCredentialsResource", "AsyncUserCredentialsResource"] + + +class UserCredentialsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> UserCredentialsResourceWithRawResponse: + """ + 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 UserCredentialsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> UserCredentialsResourceWithStreamingResponse: + """ + 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 UserCredentialsResourceWithStreamingResponse(self) + + def get( + self, + username: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_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, + ) -> PostgresUserCredentials: + """Get the credentials for a specific user in a PostgreSQL cluster. + + This endpoint + can only be used once per user. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not username: + raise ValueError(f"Expected a non-empty value for `username` but received {username!r}") + return self._get( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}/users/{username}/credentials", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PostgresUserCredentials, + ) + + def regenerate( + self, + username: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_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, + ) -> PostgresUserCredentials: + """ + Generate new credentials for a specific user in a PostgreSQL cluster. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not username: + raise ValueError(f"Expected a non-empty value for `username` but received {username!r}") + return self._post( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}/users/{username}/credentials", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PostgresUserCredentials, + ) + + +class AsyncUserCredentialsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncUserCredentialsResourceWithRawResponse: + """ + 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 AsyncUserCredentialsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncUserCredentialsResourceWithStreamingResponse: + """ + 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 AsyncUserCredentialsResourceWithStreamingResponse(self) + + async def get( + self, + username: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_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, + ) -> PostgresUserCredentials: + """Get the credentials for a specific user in a PostgreSQL cluster. + + This endpoint + can only be used once per user. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not username: + raise ValueError(f"Expected a non-empty value for `username` but received {username!r}") + return await self._get( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}/users/{username}/credentials", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PostgresUserCredentials, + ) + + async def regenerate( + self, + username: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_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, + ) -> PostgresUserCredentials: + """ + Generate new credentials for a specific user in a PostgreSQL cluster. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_name: + raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") + if not username: + raise ValueError(f"Expected a non-empty value for `username` but received {username!r}") + return await self._post( + f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}/users/{username}/credentials", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PostgresUserCredentials, + ) + + +class UserCredentialsResourceWithRawResponse: + def __init__(self, user_credentials: UserCredentialsResource) -> None: + self._user_credentials = user_credentials + + self.get = to_raw_response_wrapper( + user_credentials.get, + ) + self.regenerate = to_raw_response_wrapper( + user_credentials.regenerate, + ) + + +class AsyncUserCredentialsResourceWithRawResponse: + def __init__(self, user_credentials: AsyncUserCredentialsResource) -> None: + self._user_credentials = user_credentials + + self.get = async_to_raw_response_wrapper( + user_credentials.get, + ) + self.regenerate = async_to_raw_response_wrapper( + user_credentials.regenerate, + ) + + +class UserCredentialsResourceWithStreamingResponse: + def __init__(self, user_credentials: UserCredentialsResource) -> None: + self._user_credentials = user_credentials + + self.get = to_streamed_response_wrapper( + user_credentials.get, + ) + self.regenerate = to_streamed_response_wrapper( + user_credentials.regenerate, + ) + + +class AsyncUserCredentialsResourceWithStreamingResponse: + def __init__(self, user_credentials: AsyncUserCredentialsResource) -> None: + self._user_credentials = user_credentials + + self.get = async_to_streamed_response_wrapper( + user_credentials.get, + ) + self.regenerate = async_to_streamed_response_wrapper( + user_credentials.regenerate, + ) diff --git a/src/gcore/resources/cloud/databases/postgres/configurations.py b/src/gcore/resources/cloud/databases/postgres/configurations.py new file mode 100644 index 00000000..c9f30551 --- /dev/null +++ b/src/gcore/resources/cloud/databases/postgres/configurations.py @@ -0,0 +1,169 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ....._types import Body, Query, Headers, NotGiven, not_given +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.cloud.databases.postgres.postgres_configuration import PostgresConfiguration + +__all__ = ["ConfigurationsResource", "AsyncConfigurationsResource"] + + +class ConfigurationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ConfigurationsResourceWithRawResponse: + """ + 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 ConfigurationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ConfigurationsResourceWithStreamingResponse: + """ + 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 ConfigurationsResourceWithStreamingResponse(self) + + def get( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PostgresConfiguration: + """ + Get all available PostgreSQL configurations for the specified region. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v1/dbaas/postgres/configuration/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PostgresConfiguration, + ) + + +class AsyncConfigurationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncConfigurationsResourceWithRawResponse: + """ + 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 AsyncConfigurationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncConfigurationsResourceWithStreamingResponse: + """ + 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 AsyncConfigurationsResourceWithStreamingResponse(self) + + async def get( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PostgresConfiguration: + """ + Get all available PostgreSQL configurations for the specified region. + + 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 project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v1/dbaas/postgres/configuration/{project_id}/{region_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PostgresConfiguration, + ) + + +class ConfigurationsResourceWithRawResponse: + def __init__(self, configurations: ConfigurationsResource) -> None: + self._configurations = configurations + + self.get = to_raw_response_wrapper( + configurations.get, + ) + + +class AsyncConfigurationsResourceWithRawResponse: + def __init__(self, configurations: AsyncConfigurationsResource) -> None: + self._configurations = configurations + + self.get = async_to_raw_response_wrapper( + configurations.get, + ) + + +class ConfigurationsResourceWithStreamingResponse: + def __init__(self, configurations: ConfigurationsResource) -> None: + self._configurations = configurations + + self.get = to_streamed_response_wrapper( + configurations.get, + ) + + +class AsyncConfigurationsResourceWithStreamingResponse: + def __init__(self, configurations: AsyncConfigurationsResource) -> None: + self._configurations = configurations + + self.get = async_to_streamed_response_wrapper( + configurations.get, + ) diff --git a/src/gcore/resources/cloud/databases/postgres/custom_configurations.py b/src/gcore/resources/cloud/databases/postgres/custom_configurations.py new file mode 100644 index 00000000..9ce396df --- /dev/null +++ b/src/gcore/resources/cloud/databases/postgres/custom_configurations.py @@ -0,0 +1,197 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ....._types import Body, Query, Headers, NotGiven, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.cloud.databases.postgres import custom_configuration_validate_params +from .....types.cloud.databases.postgres.pg_conf_validation import PgConfValidation + +__all__ = ["CustomConfigurationsResource", "AsyncCustomConfigurationsResource"] + + +class CustomConfigurationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CustomConfigurationsResourceWithRawResponse: + """ + 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 CustomConfigurationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CustomConfigurationsResourceWithStreamingResponse: + """ + 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 CustomConfigurationsResourceWithStreamingResponse(self) + + def validate( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + pg_conf: str, + version: 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, + ) -> PgConfValidation: + """ + Validate a custom PostgreSQL configuration file. + + Args: + pg_conf: PostgreSQL configuration + + version: PostgreSQL version + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/dbaas/postgres/validate_pg_conf/{project_id}/{region_id}", + body=maybe_transform( + { + "pg_conf": pg_conf, + "version": version, + }, + custom_configuration_validate_params.CustomConfigurationValidateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PgConfValidation, + ) + + +class AsyncCustomConfigurationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCustomConfigurationsResourceWithRawResponse: + """ + 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 AsyncCustomConfigurationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCustomConfigurationsResourceWithStreamingResponse: + """ + 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 AsyncCustomConfigurationsResourceWithStreamingResponse(self) + + async def validate( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + pg_conf: str, + version: 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, + ) -> PgConfValidation: + """ + Validate a custom PostgreSQL configuration file. + + Args: + pg_conf: PostgreSQL configuration + + version: PostgreSQL version + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/dbaas/postgres/validate_pg_conf/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "pg_conf": pg_conf, + "version": version, + }, + custom_configuration_validate_params.CustomConfigurationValidateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PgConfValidation, + ) + + +class CustomConfigurationsResourceWithRawResponse: + def __init__(self, custom_configurations: CustomConfigurationsResource) -> None: + self._custom_configurations = custom_configurations + + self.validate = to_raw_response_wrapper( + custom_configurations.validate, + ) + + +class AsyncCustomConfigurationsResourceWithRawResponse: + def __init__(self, custom_configurations: AsyncCustomConfigurationsResource) -> None: + self._custom_configurations = custom_configurations + + self.validate = async_to_raw_response_wrapper( + custom_configurations.validate, + ) + + +class CustomConfigurationsResourceWithStreamingResponse: + def __init__(self, custom_configurations: CustomConfigurationsResource) -> None: + self._custom_configurations = custom_configurations + + self.validate = to_streamed_response_wrapper( + custom_configurations.validate, + ) + + +class AsyncCustomConfigurationsResourceWithStreamingResponse: + def __init__(self, custom_configurations: AsyncCustomConfigurationsResource) -> None: + self._custom_configurations = custom_configurations + + self.validate = async_to_streamed_response_wrapper( + custom_configurations.validate, + ) diff --git a/src/gcore/resources/cloud/databases/postgres/postgres.py b/src/gcore/resources/cloud/databases/postgres/postgres.py new file mode 100644 index 00000000..ce9c32b7 --- /dev/null +++ b/src/gcore/resources/cloud/databases/postgres/postgres.py @@ -0,0 +1,166 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from .configurations import ( + ConfigurationsResource, + AsyncConfigurationsResource, + ConfigurationsResourceWithRawResponse, + AsyncConfigurationsResourceWithRawResponse, + ConfigurationsResourceWithStreamingResponse, + AsyncConfigurationsResourceWithStreamingResponse, +) +from .clusters.clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) +from .custom_configurations import ( + CustomConfigurationsResource, + AsyncCustomConfigurationsResource, + CustomConfigurationsResourceWithRawResponse, + AsyncCustomConfigurationsResourceWithRawResponse, + CustomConfigurationsResourceWithStreamingResponse, + AsyncCustomConfigurationsResourceWithStreamingResponse, +) + +__all__ = ["PostgresResource", "AsyncPostgresResource"] + + +class PostgresResource(SyncAPIResource): + @cached_property + def clusters(self) -> ClustersResource: + return ClustersResource(self._client) + + @cached_property + def configurations(self) -> ConfigurationsResource: + return ConfigurationsResource(self._client) + + @cached_property + def custom_configurations(self) -> CustomConfigurationsResource: + return CustomConfigurationsResource(self._client) + + @cached_property + def with_raw_response(self) -> PostgresResourceWithRawResponse: + """ + 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 PostgresResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PostgresResourceWithStreamingResponse: + """ + 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 PostgresResourceWithStreamingResponse(self) + + +class AsyncPostgresResource(AsyncAPIResource): + @cached_property + def clusters(self) -> AsyncClustersResource: + return AsyncClustersResource(self._client) + + @cached_property + def configurations(self) -> AsyncConfigurationsResource: + return AsyncConfigurationsResource(self._client) + + @cached_property + def custom_configurations(self) -> AsyncCustomConfigurationsResource: + return AsyncCustomConfigurationsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncPostgresResourceWithRawResponse: + """ + 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 AsyncPostgresResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPostgresResourceWithStreamingResponse: + """ + 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 AsyncPostgresResourceWithStreamingResponse(self) + + +class PostgresResourceWithRawResponse: + def __init__(self, postgres: PostgresResource) -> None: + self._postgres = postgres + + @cached_property + def clusters(self) -> ClustersResourceWithRawResponse: + return ClustersResourceWithRawResponse(self._postgres.clusters) + + @cached_property + def configurations(self) -> ConfigurationsResourceWithRawResponse: + return ConfigurationsResourceWithRawResponse(self._postgres.configurations) + + @cached_property + def custom_configurations(self) -> CustomConfigurationsResourceWithRawResponse: + return CustomConfigurationsResourceWithRawResponse(self._postgres.custom_configurations) + + +class AsyncPostgresResourceWithRawResponse: + def __init__(self, postgres: AsyncPostgresResource) -> None: + self._postgres = postgres + + @cached_property + def clusters(self) -> AsyncClustersResourceWithRawResponse: + return AsyncClustersResourceWithRawResponse(self._postgres.clusters) + + @cached_property + def configurations(self) -> AsyncConfigurationsResourceWithRawResponse: + return AsyncConfigurationsResourceWithRawResponse(self._postgres.configurations) + + @cached_property + def custom_configurations(self) -> AsyncCustomConfigurationsResourceWithRawResponse: + return AsyncCustomConfigurationsResourceWithRawResponse(self._postgres.custom_configurations) + + +class PostgresResourceWithStreamingResponse: + def __init__(self, postgres: PostgresResource) -> None: + self._postgres = postgres + + @cached_property + def clusters(self) -> ClustersResourceWithStreamingResponse: + return ClustersResourceWithStreamingResponse(self._postgres.clusters) + + @cached_property + def configurations(self) -> ConfigurationsResourceWithStreamingResponse: + return ConfigurationsResourceWithStreamingResponse(self._postgres.configurations) + + @cached_property + def custom_configurations(self) -> CustomConfigurationsResourceWithStreamingResponse: + return CustomConfigurationsResourceWithStreamingResponse(self._postgres.custom_configurations) + + +class AsyncPostgresResourceWithStreamingResponse: + def __init__(self, postgres: AsyncPostgresResource) -> None: + self._postgres = postgres + + @cached_property + def clusters(self) -> AsyncClustersResourceWithStreamingResponse: + return AsyncClustersResourceWithStreamingResponse(self._postgres.clusters) + + @cached_property + def configurations(self) -> AsyncConfigurationsResourceWithStreamingResponse: + return AsyncConfigurationsResourceWithStreamingResponse(self._postgres.configurations) + + @cached_property + def custom_configurations(self) -> AsyncCustomConfigurationsResourceWithStreamingResponse: + return AsyncCustomConfigurationsResourceWithStreamingResponse(self._postgres.custom_configurations) diff --git a/src/gcore/types/cloud/databases/__init__.py b/src/gcore/types/cloud/databases/__init__.py new file mode 100644 index 00000000..f8ee8b14 --- /dev/null +++ b/src/gcore/types/cloud/databases/__init__.py @@ -0,0 +1,3 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations diff --git a/src/gcore/types/cloud/databases/postgres/__init__.py b/src/gcore/types/cloud/databases/postgres/__init__.py new file mode 100644 index 00000000..e4449e2b --- /dev/null +++ b/src/gcore/types/cloud/databases/postgres/__init__.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .postgres_cluster import PostgresCluster as PostgresCluster +from .pg_conf_validation import PgConfValidation as PgConfValidation +from .cluster_list_params import ClusterListParams as ClusterListParams +from .cluster_create_params import ClusterCreateParams as ClusterCreateParams +from .cluster_update_params import ClusterUpdateParams as ClusterUpdateParams +from .postgres_cluster_short import PostgresClusterShort as PostgresClusterShort +from .postgres_configuration import PostgresConfiguration as PostgresConfiguration +from .custom_configuration_validate_params import CustomConfigurationValidateParams as CustomConfigurationValidateParams diff --git a/src/gcore/types/cloud/databases/postgres/cluster_create_params.py b/src/gcore/types/cloud/databases/postgres/cluster_create_params.py new file mode 100644 index 00000000..7b569828 --- /dev/null +++ b/src/gcore/types/cloud/databases/postgres/cluster_create_params.py @@ -0,0 +1,108 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +from ....._types import SequenceNotStr + +__all__ = [ + "ClusterCreateParams", + "Flavor", + "HighAvailability", + "Network", + "PgServerConfiguration", + "PgServerConfigurationPooler", + "Storage", + "Database", + "User", +] + + +class ClusterCreateParams(TypedDict, total=False): + project_id: int + + region_id: int + + cluster_name: Required[str] + """PostgreSQL cluster name""" + + flavor: Required[Flavor] + """Instance RAM and CPU""" + + high_availability: Required[Optional[HighAvailability]] + """High Availability settings""" + + network: Required[Network] + + pg_server_configuration: Required[PgServerConfiguration] + """PosgtreSQL cluster configuration""" + + storage: Required[Storage] + """Cluster's storage configuration""" + + databases: Iterable[Database] + + users: Iterable[User] + + +class Flavor(TypedDict, total=False): + cpu: Required[int] + """Maximum available cores for instance""" + + memory_gib: Required[int] + """Maximum available RAM for instance""" + + +class HighAvailability(TypedDict, total=False): + replication_mode: Required[Literal["async", "sync"]] + """Type of replication""" + + +class Network(TypedDict, total=False): + acl: Required[SequenceNotStr[str]] + """Allowed IPs and subnets for incoming traffic""" + + network_type: Required[Literal["public"]] + """Network Type""" + + +class PgServerConfigurationPooler(TypedDict, total=False): + mode: Required[Literal["session", "statement", "transaction"]] + + type: Literal["pgbouncer"] + + +class PgServerConfiguration(TypedDict, total=False): + pg_conf: Required[str] + """pg.conf settings""" + + version: Required[str] + """Cluster version""" + + pooler: Optional[PgServerConfigurationPooler] + + +class Storage(TypedDict, total=False): + size_gib: Required[int] + """Total available storage for database""" + + type: Required[str] + """Storage type""" + + +class Database(TypedDict, total=False): + name: Required[str] + """Database name""" + + owner: Required[str] + """Database owner from users list""" + + +class User(TypedDict, total=False): + name: Required[str] + """User name""" + + role_attributes: Required[List[Literal["BYPASSRLS", "CREATEDB", "CREATEROLE", "INHERIT", "LOGIN", "NOLOGIN"]]] + """User's attributes""" diff --git a/src/gcore/types/cloud/databases/postgres/cluster_list_params.py b/src/gcore/types/cloud/databases/postgres/cluster_list_params.py new file mode 100644 index 00000000..301f22e4 --- /dev/null +++ b/src/gcore/types/cloud/databases/postgres/cluster_list_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_extensions import TypedDict + +__all__ = ["ClusterListParams"] + + +class ClusterListParams(TypedDict, total=False): + project_id: int + + region_id: int + + limit: int + """Maximum number of clusters to return""" + + offset: int + """Number of clusters to skip""" diff --git a/src/gcore/types/cloud/databases/postgres/cluster_update_params.py b/src/gcore/types/cloud/databases/postgres/cluster_update_params.py new file mode 100644 index 00000000..075ee4df --- /dev/null +++ b/src/gcore/types/cloud/databases/postgres/cluster_update_params.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +from ....._types import SequenceNotStr + +__all__ = [ + "ClusterUpdateParams", + "Database", + "Flavor", + "HighAvailability", + "Network", + "PgServerConfiguration", + "PgServerConfigurationPooler", + "Storage", + "User", +] + + +class ClusterUpdateParams(TypedDict, total=False): + project_id: int + + region_id: int + + databases: Iterable[Database] + + flavor: Optional[Flavor] + """New instance RAM and CPU""" + + high_availability: Optional[HighAvailability] + """New High Availability settings""" + + network: Optional[Network] + + pg_server_configuration: Optional[PgServerConfiguration] + """New PosgtreSQL cluster configuration""" + + storage: Optional[Storage] + """New storage configuration""" + + users: Iterable[User] + + +class Database(TypedDict, total=False): + name: Required[str] + """Database name""" + + owner: Required[str] + """Database owner from users list""" + + +class Flavor(TypedDict, total=False): + cpu: Required[int] + """Maximum available cores for instance""" + + memory_gib: Required[int] + """Maximum available RAM for instance""" + + +class HighAvailability(TypedDict, total=False): + replication_mode: Required[Literal["async", "sync"]] + """Type of replication""" + + +class Network(TypedDict, total=False): + acl: Required[SequenceNotStr[str]] + """Allowed IPs and subnets for incoming traffic""" + + network_type: Required[Literal["public"]] + """Network Type""" + + +class PgServerConfigurationPooler(TypedDict, total=False): + mode: Required[Literal["session", "statement", "transaction"]] + + type: Literal["pgbouncer"] + + +class PgServerConfiguration(TypedDict, total=False): + pg_conf: Optional[str] + """New pg.conf file settings""" + + pooler: Optional[PgServerConfigurationPooler] + + version: Optional[str] + """New cluster version""" + + +class Storage(TypedDict, total=False): + size_gib: Required[int] + """Total available storage for database""" + + +class User(TypedDict, total=False): + name: Required[str] + """User name""" + + role_attributes: Required[List[Literal["BYPASSRLS", "CREATEDB", "CREATEROLE", "INHERIT", "LOGIN", "NOLOGIN"]]] + """User's attributes""" diff --git a/src/gcore/types/cloud/databases/postgres/clusters/__init__.py b/src/gcore/types/cloud/databases/postgres/clusters/__init__.py new file mode 100644 index 00000000..254c35c0 --- /dev/null +++ b/src/gcore/types/cloud/databases/postgres/clusters/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .postgres_user_credentials import PostgresUserCredentials as PostgresUserCredentials diff --git a/src/gcore/types/cloud/databases/postgres/clusters/postgres_user_credentials.py b/src/gcore/types/cloud/databases/postgres/clusters/postgres_user_credentials.py new file mode 100644 index 00000000..fd38e6c6 --- /dev/null +++ b/src/gcore/types/cloud/databases/postgres/clusters/postgres_user_credentials.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ......_models import BaseModel + +__all__ = ["PostgresUserCredentials"] + + +class PostgresUserCredentials(BaseModel): + password: str + """Password""" + + username: str + """Username""" diff --git a/src/gcore/types/cloud/databases/postgres/custom_configuration_validate_params.py b/src/gcore/types/cloud/databases/postgres/custom_configuration_validate_params.py new file mode 100644 index 00000000..2cd791ae --- /dev/null +++ b/src/gcore/types/cloud/databases/postgres/custom_configuration_validate_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_extensions import Required, TypedDict + +__all__ = ["CustomConfigurationValidateParams"] + + +class CustomConfigurationValidateParams(TypedDict, total=False): + project_id: int + + region_id: int + + pg_conf: Required[str] + """PostgreSQL configuration""" + + version: Required[str] + """PostgreSQL version""" diff --git a/src/gcore/types/cloud/databases/postgres/pg_conf_validation.py b/src/gcore/types/cloud/databases/postgres/pg_conf_validation.py new file mode 100644 index 00000000..8e4ae232 --- /dev/null +++ b/src/gcore/types/cloud/databases/postgres/pg_conf_validation.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ....._models import BaseModel + +__all__ = ["PgConfValidation"] + + +class PgConfValidation(BaseModel): + errors: List[str] + """Errors list""" + + is_valid: bool + """Validity of pg.conf file""" diff --git a/src/gcore/types/cloud/databases/postgres/postgres_cluster.py b/src/gcore/types/cloud/databases/postgres/postgres_cluster.py new file mode 100644 index 00000000..445ba8e3 --- /dev/null +++ b/src/gcore/types/cloud/databases/postgres/postgres_cluster.py @@ -0,0 +1,118 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = [ + "PostgresCluster", + "Database", + "Flavor", + "HighAvailability", + "Network", + "PgServerConfiguration", + "PgServerConfigurationPooler", + "Storage", + "User", +] + + +class Database(BaseModel): + name: str + """Database name""" + + owner: str + """Database owner from users list""" + + size: int + """Size in bytes""" + + +class Flavor(BaseModel): + cpu: int + """Maximum available cores for instance""" + + memory_gib: int + """Maximum available RAM for instance""" + + +class HighAvailability(BaseModel): + replication_mode: Literal["async", "sync"] + """Type of replication""" + + +class Network(BaseModel): + acl: List[str] + """Allowed IPs and subnets for incoming traffic""" + + connection_string: str + """Connection string to main database""" + + host: str + """database hostname""" + + network_type: Literal["public"] + """Network Type""" + + +class PgServerConfigurationPooler(BaseModel): + mode: Literal["session", "statement", "transaction"] + + type: Optional[Literal["pgbouncer"]] = None + + +class PgServerConfiguration(BaseModel): + pg_conf: str + """pg.conf settings""" + + version: str + """Cluster version""" + + pooler: Optional[PgServerConfigurationPooler] = None + + +class Storage(BaseModel): + size_gib: int + """Total available storage for database""" + + type: str + """Storage type""" + + +class User(BaseModel): + is_secret_revealed: bool + """Display was secret revealed or not""" + + name: str + """User name""" + + role_attributes: List[Literal["BYPASSRLS", "CREATEDB", "CREATEROLE", "INHERIT", "LOGIN", "NOLOGIN"]] + """User's attributes""" + + +class PostgresCluster(BaseModel): + cluster_name: str + + created_at: datetime + + databases: List[Database] + + flavor: Flavor + """Instance RAM and CPU""" + + high_availability: Optional[HighAvailability] = None + + network: Network + + pg_server_configuration: PgServerConfiguration + """Main PG configuration""" + + status: Literal["DELETING", "FAILED", "PREPARING", "READY", "UNHEALTHY", "UNKNOWN", "UPDATING"] + """Current cluster status""" + + storage: Storage + """PG's storage configuration""" + + users: List[User] diff --git a/src/gcore/types/cloud/databases/postgres/postgres_cluster_short.py b/src/gcore/types/cloud/databases/postgres/postgres_cluster_short.py new file mode 100644 index 00000000..1a197123 --- /dev/null +++ b/src/gcore/types/cloud/databases/postgres/postgres_cluster_short.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["PostgresClusterShort"] + + +class PostgresClusterShort(BaseModel): + cluster_name: str + """PostgreSQL cluster name""" + + created_at: datetime + """Creation timestamp""" + + status: Literal["DELETING", "FAILED", "PREPARING", "READY", "UNHEALTHY", "UNKNOWN", "UPDATING"] + """Current cluster status""" + + version: str + """Cluster version""" diff --git a/src/gcore/types/cloud/databases/postgres/postgres_configuration.py b/src/gcore/types/cloud/databases/postgres/postgres_configuration.py new file mode 100644 index 00000000..8be36800 --- /dev/null +++ b/src/gcore/types/cloud/databases/postgres/postgres_configuration.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ....._models import BaseModel + +__all__ = ["PostgresConfiguration", "Flavor", "StorageClass"] + + +class Flavor(BaseModel): + cpu: int + """Maximum available cores for instance""" + + memory_gib: int + """Maximum available RAM for instance""" + + pg_conf: str + + +class StorageClass(BaseModel): + name: str + """Storage type""" + + +class PostgresConfiguration(BaseModel): + flavors: List[Flavor] + + storage_classes: List[StorageClass] + + versions: List[str] + """Available versions""" diff --git a/tests/api_resources/cloud/databases/__init__.py b/tests/api_resources/cloud/databases/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/databases/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/databases/postgres/__init__.py b/tests/api_resources/cloud/databases/postgres/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/databases/postgres/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/databases/postgres/clusters/__init__.py b/tests/api_resources/cloud/databases/postgres/clusters/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/databases/postgres/clusters/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/databases/postgres/clusters/test_user_credentials.py b/tests/api_resources/cloud/databases/postgres/clusters/test_user_credentials.py new file mode 100644 index 00000000..28169d78 --- /dev/null +++ b/tests/api_resources/cloud/databases/postgres/clusters/test_user_credentials.py @@ -0,0 +1,256 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.databases.postgres.clusters import PostgresUserCredentials + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestUserCredentials: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + user_credential = client.cloud.databases.postgres.clusters.user_credentials.get( + username="username", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert_matches_type(PostgresUserCredentials, user_credential, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.databases.postgres.clusters.user_credentials.with_raw_response.get( + username="username", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_credential = response.parse() + assert_matches_type(PostgresUserCredentials, user_credential, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.databases.postgres.clusters.user_credentials.with_streaming_response.get( + username="username", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_credential = response.parse() + assert_matches_type(PostgresUserCredentials, user_credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.databases.postgres.clusters.user_credentials.with_raw_response.get( + username="username", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `username` but received ''"): + client.cloud.databases.postgres.clusters.user_credentials.with_raw_response.get( + username="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + @parametrize + def test_method_regenerate(self, client: Gcore) -> None: + user_credential = client.cloud.databases.postgres.clusters.user_credentials.regenerate( + username="username", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert_matches_type(PostgresUserCredentials, user_credential, path=["response"]) + + @parametrize + def test_raw_response_regenerate(self, client: Gcore) -> None: + response = client.cloud.databases.postgres.clusters.user_credentials.with_raw_response.regenerate( + username="username", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_credential = response.parse() + assert_matches_type(PostgresUserCredentials, user_credential, path=["response"]) + + @parametrize + def test_streaming_response_regenerate(self, client: Gcore) -> None: + with client.cloud.databases.postgres.clusters.user_credentials.with_streaming_response.regenerate( + username="username", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_credential = response.parse() + assert_matches_type(PostgresUserCredentials, user_credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_regenerate(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.databases.postgres.clusters.user_credentials.with_raw_response.regenerate( + username="username", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `username` but received ''"): + client.cloud.databases.postgres.clusters.user_credentials.with_raw_response.regenerate( + username="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + +class TestAsyncUserCredentials: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + user_credential = await async_client.cloud.databases.postgres.clusters.user_credentials.get( + username="username", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert_matches_type(PostgresUserCredentials, user_credential, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.databases.postgres.clusters.user_credentials.with_raw_response.get( + username="username", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_credential = await response.parse() + assert_matches_type(PostgresUserCredentials, user_credential, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.databases.postgres.clusters.user_credentials.with_streaming_response.get( + username="username", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_credential = await response.parse() + assert_matches_type(PostgresUserCredentials, user_credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.databases.postgres.clusters.user_credentials.with_raw_response.get( + username="username", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `username` but received ''"): + await async_client.cloud.databases.postgres.clusters.user_credentials.with_raw_response.get( + username="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + @parametrize + async def test_method_regenerate(self, async_client: AsyncGcore) -> None: + user_credential = await async_client.cloud.databases.postgres.clusters.user_credentials.regenerate( + username="username", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + assert_matches_type(PostgresUserCredentials, user_credential, path=["response"]) + + @parametrize + async def test_raw_response_regenerate(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.databases.postgres.clusters.user_credentials.with_raw_response.regenerate( + username="username", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_credential = await response.parse() + assert_matches_type(PostgresUserCredentials, user_credential, path=["response"]) + + @parametrize + async def test_streaming_response_regenerate(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.databases.postgres.clusters.user_credentials.with_streaming_response.regenerate( + username="username", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_credential = await response.parse() + assert_matches_type(PostgresUserCredentials, user_credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_regenerate(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.databases.postgres.clusters.user_credentials.with_raw_response.regenerate( + username="username", + project_id=0, + region_id=0, + cluster_name="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `username` but received ''"): + await async_client.cloud.databases.postgres.clusters.user_credentials.with_raw_response.regenerate( + username="", + project_id=0, + region_id=0, + cluster_name="cluster_name", + ) diff --git a/tests/api_resources/cloud/databases/postgres/test_clusters.py b/tests/api_resources/cloud/databases/postgres/test_clusters.py new file mode 100644 index 00000000..224aa613 --- /dev/null +++ b/tests/api_resources/cloud/databases/postgres/test_clusters.py @@ -0,0 +1,731 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.databases.postgres import ( + PostgresCluster, + PostgresClusterShort, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestClusters: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + cluster = client.cloud.databases.postgres.clusters.create( + project_id=0, + region_id=0, + cluster_name="3", + flavor={ + "cpu": 1, + "memory_gib": 1, + }, + high_availability={"replication_mode": "sync"}, + network={ + "acl": ["92.33.34.127"], + "network_type": "public", + }, + pg_server_configuration={ + "pg_conf": "\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + "version": "version", + }, + storage={ + "size_gib": 100, + "type": "ssd-hiiops", + }, + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + cluster = client.cloud.databases.postgres.clusters.create( + project_id=0, + region_id=0, + cluster_name="3", + flavor={ + "cpu": 1, + "memory_gib": 1, + }, + high_availability={"replication_mode": "sync"}, + network={ + "acl": ["92.33.34.127"], + "network_type": "public", + }, + pg_server_configuration={ + "pg_conf": "\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + "version": "version", + "pooler": { + "mode": "transaction", + "type": "pgbouncer", + }, + }, + storage={ + "size_gib": 100, + "type": "ssd-hiiops", + }, + databases=[ + { + "name": "mydatabase", + "owner": "myuser", + } + ], + users=[ + { + "name": "myuser", + "role_attributes": ["INHERIT"], + } + ], + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.databases.postgres.clusters.with_raw_response.create( + project_id=0, + region_id=0, + cluster_name="3", + flavor={ + "cpu": 1, + "memory_gib": 1, + }, + high_availability={"replication_mode": "sync"}, + network={ + "acl": ["92.33.34.127"], + "network_type": "public", + }, + pg_server_configuration={ + "pg_conf": "\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + "version": "version", + }, + storage={ + "size_gib": 100, + "type": "ssd-hiiops", + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.databases.postgres.clusters.with_streaming_response.create( + project_id=0, + region_id=0, + cluster_name="3", + flavor={ + "cpu": 1, + "memory_gib": 1, + }, + high_availability={"replication_mode": "sync"}, + network={ + "acl": ["92.33.34.127"], + "network_type": "public", + }, + pg_server_configuration={ + "pg_conf": "\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + "version": "version", + }, + storage={ + "size_gib": 100, + "type": "ssd-hiiops", + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + cluster = client.cloud.databases.postgres.clusters.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + cluster = client.cloud.databases.postgres.clusters.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + databases=[ + { + "name": "mydatabase", + "owner": "myuser", + } + ], + flavor={ + "cpu": 1, + "memory_gib": 1, + }, + high_availability={"replication_mode": "sync"}, + network={ + "acl": ["92.33.34.127"], + "network_type": "public", + }, + pg_server_configuration={ + "pg_conf": "\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + "pooler": { + "mode": "transaction", + "type": "pgbouncer", + }, + "version": "15", + }, + storage={"size_gib": 100}, + users=[ + { + "name": "myuser", + "role_attributes": ["INHERIT"], + } + ], + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.databases.postgres.clusters.with_raw_response.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.databases.postgres.clusters.with_streaming_response.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.databases.postgres.clusters.with_raw_response.update( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + cluster = client.cloud.databases.postgres.clusters.list( + project_id=0, + region_id=0, + ) + assert_matches_type(SyncOffsetPage[PostgresClusterShort], cluster, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + cluster = client.cloud.databases.postgres.clusters.list( + project_id=0, + region_id=0, + limit=0, + offset=0, + ) + assert_matches_type(SyncOffsetPage[PostgresClusterShort], cluster, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.databases.postgres.clusters.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(SyncOffsetPage[PostgresClusterShort], cluster, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.databases.postgres.clusters.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(SyncOffsetPage[PostgresClusterShort], cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + cluster = client.cloud.databases.postgres.clusters.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.databases.postgres.clusters.with_raw_response.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.databases.postgres.clusters.with_streaming_response.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.databases.postgres.clusters.with_raw_response.delete( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + cluster = client.cloud.databases.postgres.clusters.get( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(PostgresCluster, cluster, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.databases.postgres.clusters.with_raw_response.get( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = response.parse() + assert_matches_type(PostgresCluster, cluster, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.databases.postgres.clusters.with_streaming_response.get( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = response.parse() + assert_matches_type(PostgresCluster, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + client.cloud.databases.postgres.clusters.with_raw_response.get( + cluster_name="", + project_id=0, + region_id=0, + ) + + +class TestAsyncClusters: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.databases.postgres.clusters.create( + project_id=0, + region_id=0, + cluster_name="3", + flavor={ + "cpu": 1, + "memory_gib": 1, + }, + high_availability={"replication_mode": "sync"}, + network={ + "acl": ["92.33.34.127"], + "network_type": "public", + }, + pg_server_configuration={ + "pg_conf": "\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + "version": "version", + }, + storage={ + "size_gib": 100, + "type": "ssd-hiiops", + }, + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.databases.postgres.clusters.create( + project_id=0, + region_id=0, + cluster_name="3", + flavor={ + "cpu": 1, + "memory_gib": 1, + }, + high_availability={"replication_mode": "sync"}, + network={ + "acl": ["92.33.34.127"], + "network_type": "public", + }, + pg_server_configuration={ + "pg_conf": "\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + "version": "version", + "pooler": { + "mode": "transaction", + "type": "pgbouncer", + }, + }, + storage={ + "size_gib": 100, + "type": "ssd-hiiops", + }, + databases=[ + { + "name": "mydatabase", + "owner": "myuser", + } + ], + users=[ + { + "name": "myuser", + "role_attributes": ["INHERIT"], + } + ], + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.databases.postgres.clusters.with_raw_response.create( + project_id=0, + region_id=0, + cluster_name="3", + flavor={ + "cpu": 1, + "memory_gib": 1, + }, + high_availability={"replication_mode": "sync"}, + network={ + "acl": ["92.33.34.127"], + "network_type": "public", + }, + pg_server_configuration={ + "pg_conf": "\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + "version": "version", + }, + storage={ + "size_gib": 100, + "type": "ssd-hiiops", + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.databases.postgres.clusters.with_streaming_response.create( + project_id=0, + region_id=0, + cluster_name="3", + flavor={ + "cpu": 1, + "memory_gib": 1, + }, + high_availability={"replication_mode": "sync"}, + network={ + "acl": ["92.33.34.127"], + "network_type": "public", + }, + pg_server_configuration={ + "pg_conf": "\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + "version": "version", + }, + storage={ + "size_gib": 100, + "type": "ssd-hiiops", + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.databases.postgres.clusters.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.databases.postgres.clusters.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + databases=[ + { + "name": "mydatabase", + "owner": "myuser", + } + ], + flavor={ + "cpu": 1, + "memory_gib": 1, + }, + high_availability={"replication_mode": "sync"}, + network={ + "acl": ["92.33.34.127"], + "network_type": "public", + }, + pg_server_configuration={ + "pg_conf": "\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + "pooler": { + "mode": "transaction", + "type": "pgbouncer", + }, + "version": "15", + }, + storage={"size_gib": 100}, + users=[ + { + "name": "myuser", + "role_attributes": ["INHERIT"], + } + ], + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.databases.postgres.clusters.with_raw_response.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.databases.postgres.clusters.with_streaming_response.update( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.databases.postgres.clusters.with_raw_response.update( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.databases.postgres.clusters.list( + project_id=0, + region_id=0, + ) + assert_matches_type(AsyncOffsetPage[PostgresClusterShort], cluster, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.databases.postgres.clusters.list( + project_id=0, + region_id=0, + limit=0, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[PostgresClusterShort], cluster, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.databases.postgres.clusters.with_raw_response.list( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[PostgresClusterShort], cluster, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.databases.postgres.clusters.with_streaming_response.list( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[PostgresClusterShort], cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.databases.postgres.clusters.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.databases.postgres.clusters.with_raw_response.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.databases.postgres.clusters.with_streaming_response.delete( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.databases.postgres.clusters.with_raw_response.delete( + cluster_name="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + cluster = await async_client.cloud.databases.postgres.clusters.get( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + assert_matches_type(PostgresCluster, cluster, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.databases.postgres.clusters.with_raw_response.get( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cluster = await response.parse() + assert_matches_type(PostgresCluster, cluster, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.databases.postgres.clusters.with_streaming_response.get( + cluster_name="cluster_name", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cluster = await response.parse() + assert_matches_type(PostgresCluster, cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): + await async_client.cloud.databases.postgres.clusters.with_raw_response.get( + cluster_name="", + project_id=0, + region_id=0, + ) diff --git a/tests/api_resources/cloud/databases/postgres/test_configurations.py b/tests/api_resources/cloud/databases/postgres/test_configurations.py new file mode 100644 index 00000000..635483f0 --- /dev/null +++ b/tests/api_resources/cloud/databases/postgres/test_configurations.py @@ -0,0 +1,92 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.databases.postgres import PostgresConfiguration + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestConfigurations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + configuration = client.cloud.databases.postgres.configurations.get( + project_id=0, + region_id=0, + ) + assert_matches_type(PostgresConfiguration, configuration, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.databases.postgres.configurations.with_raw_response.get( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + configuration = response.parse() + assert_matches_type(PostgresConfiguration, configuration, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.databases.postgres.configurations.with_streaming_response.get( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + configuration = response.parse() + assert_matches_type(PostgresConfiguration, configuration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncConfigurations: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + configuration = await async_client.cloud.databases.postgres.configurations.get( + project_id=0, + region_id=0, + ) + assert_matches_type(PostgresConfiguration, configuration, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.databases.postgres.configurations.with_raw_response.get( + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + configuration = await response.parse() + assert_matches_type(PostgresConfiguration, configuration, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.databases.postgres.configurations.with_streaming_response.get( + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + configuration = await response.parse() + assert_matches_type(PostgresConfiguration, configuration, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/databases/postgres/test_custom_configurations.py b/tests/api_resources/cloud/databases/postgres/test_custom_configurations.py new file mode 100644 index 00000000..1f6935d3 --- /dev/null +++ b/tests/api_resources/cloud/databases/postgres/test_custom_configurations.py @@ -0,0 +1,104 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.databases.postgres import PgConfValidation + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCustomConfigurations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_validate(self, client: Gcore) -> None: + custom_configuration = client.cloud.databases.postgres.custom_configurations.validate( + project_id=0, + region_id=0, + pg_conf="\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + version="15", + ) + assert_matches_type(PgConfValidation, custom_configuration, path=["response"]) + + @parametrize + def test_raw_response_validate(self, client: Gcore) -> None: + response = client.cloud.databases.postgres.custom_configurations.with_raw_response.validate( + project_id=0, + region_id=0, + pg_conf="\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + version="15", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_configuration = response.parse() + assert_matches_type(PgConfValidation, custom_configuration, path=["response"]) + + @parametrize + def test_streaming_response_validate(self, client: Gcore) -> None: + with client.cloud.databases.postgres.custom_configurations.with_streaming_response.validate( + project_id=0, + region_id=0, + pg_conf="\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + version="15", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_configuration = response.parse() + assert_matches_type(PgConfValidation, custom_configuration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCustomConfigurations: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_validate(self, async_client: AsyncGcore) -> None: + custom_configuration = await async_client.cloud.databases.postgres.custom_configurations.validate( + project_id=0, + region_id=0, + pg_conf="\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + version="15", + ) + assert_matches_type(PgConfValidation, custom_configuration, path=["response"]) + + @parametrize + async def test_raw_response_validate(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.databases.postgres.custom_configurations.with_raw_response.validate( + project_id=0, + region_id=0, + pg_conf="\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + version="15", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_configuration = await response.parse() + assert_matches_type(PgConfValidation, custom_configuration, path=["response"]) + + @parametrize + async def test_streaming_response_validate(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.databases.postgres.custom_configurations.with_streaming_response.validate( + project_id=0, + region_id=0, + pg_conf="\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", + version="15", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_configuration = await response.parse() + assert_matches_type(PgConfValidation, custom_configuration, path=["response"]) + + assert cast(Any, response.is_closed) is True From e36cc759292864c8149d70693e65887bdcc987de Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 17:19:50 +0000 Subject: [PATCH 420/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6db19b95..4ad3fef3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.17.0" + ".": "0.18.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 104cc67c..59cd40d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.17.0" +version = "0.18.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 4e59998e..4e588aa0 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.17.0" # x-release-please-version +__version__ = "0.18.0" # x-release-please-version From 9b09132e2aafe1629f0f6d77be9bcba53263c813 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Nov 2025 10:11:34 +0000 Subject: [PATCH 421/592] codegen metadata --- .stats.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index bb221715..bf6d91fb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 618 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1089f2c131ebee7df82e158c4210c07f019b47549d84fe6ea7f022117c83a008.yml -openapi_spec_hash: 9758acbadc1ee1bc0d826d4657e1ad4a -config_hash: 79098512b2ff15053f2813524c207add +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-03327bc118eb0ed98401ef3a157dc7e41173f62114095077f3f49247af7b62a5.yml +openapi_spec_hash: 446c1f8864f2d965b3eece233c5a6b22 +config_hash: db560bc3873a6441828babf34ae5f184 From f3f9554c6139ed88de38f12a8d692635724acc0f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Nov 2025 12:15:45 +0000 Subject: [PATCH 422/592] feat(api): aggregated API specs update --- .stats.yml | 4 +-- src/gcore/resources/storage/credentials.py | 28 ------------------- src/gcore/resources/storage/storage.py | 4 +-- .../storage/credential_recreate_params.py | 17 ----------- src/gcore/types/storage/storage.py | 2 +- .../types/storage/storage_create_params.py | 2 +- .../api_resources/storage/test_credentials.py | 12 ++++---- .../api_resources/storage/test_statistics.py | 8 +++--- tests/api_resources/test_storage.py | 16 +++++------ 9 files changed, 24 insertions(+), 69 deletions(-) diff --git a/.stats.yml b/.stats.yml index bf6d91fb..5a78a97e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 618 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-03327bc118eb0ed98401ef3a157dc7e41173f62114095077f3f49247af7b62a5.yml -openapi_spec_hash: 446c1f8864f2d965b3eece233c5a6b22 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c358b756aa348a1c6a982fa7af3c5134289f9951a0b2e348d5c5d796cd68a9b9.yml +openapi_spec_hash: 8f53b4d77c357ba5d34d47ec447ec57b config_hash: db560bc3873a6441828babf34ae5f184 diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index 1db372ae..616afdb8 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -62,20 +62,6 @@ def recreate( password for SFTP storage). Args: - delete_sftp_password: Remove the SFTP password, disabling password authentication. Only applicable to - SFTP storage type. - - generate_s3_keys: Generate new S3 access and secret keys for S3 storage. Only applicable to S3 - storage type. - - generate_sftp_password: Generate a new random password for SFTP access. Only applicable to SFTP storage - type. - - reset_sftp_keys: Reset/remove all SSH keys associated with the SFTP storage. Only applicable to - SFTP storage type. - - sftp_password: Set a custom password for SFTP access. Only applicable to SFTP storage type. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -144,20 +130,6 @@ async def recreate( password for SFTP storage). Args: - delete_sftp_password: Remove the SFTP password, disabling password authentication. Only applicable to - SFTP storage type. - - generate_s3_keys: Generate new S3 access and secret keys for S3 storage. Only applicable to S3 - storage type. - - generate_sftp_password: Generate a new random password for SFTP access. Only applicable to SFTP storage - type. - - reset_sftp_keys: Reset/remove all SSH keys associated with the SFTP storage. Only applicable to - SFTP storage type. - - sftp_password: Set a custom password for SFTP access. Only applicable to SFTP storage type. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index c3a2d71e..afc3922f 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -95,7 +95,7 @@ def with_streaming_response(self) -> StorageResourceWithStreamingResponse: def create( self, *, - location: Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"], + location: str, name: str, type: Literal["sftp", "s3"], generate_sftp_password: bool | Omit = omit, @@ -499,7 +499,7 @@ def with_streaming_response(self) -> AsyncStorageResourceWithStreamingResponse: async def create( self, *, - location: Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"], + location: str, name: str, type: Literal["sftp", "s3"], generate_sftp_password: bool | Omit = omit, diff --git a/src/gcore/types/storage/credential_recreate_params.py b/src/gcore/types/storage/credential_recreate_params.py index d0b7c608..6ddf0375 100644 --- a/src/gcore/types/storage/credential_recreate_params.py +++ b/src/gcore/types/storage/credential_recreate_params.py @@ -9,28 +9,11 @@ class CredentialRecreateParams(TypedDict, total=False): delete_sftp_password: bool - """Remove the SFTP password, disabling password authentication. - - Only applicable to SFTP storage type. - """ generate_s3_keys: bool - """Generate new S3 access and secret keys for S3 storage. - - Only applicable to S3 storage type. - """ generate_sftp_password: bool - """Generate a new random password for SFTP access. - - Only applicable to SFTP storage type. - """ reset_sftp_keys: bool - """Reset/remove all SSH keys associated with the SFTP storage. - - Only applicable to SFTP storage type. - """ sftp_password: str - """Set a custom password for SFTP access. Only applicable to SFTP storage type.""" diff --git a/src/gcore/types/storage/storage.py b/src/gcore/types/storage/storage.py index 6c02f31b..126b5a7d 100644 --- a/src/gcore/types/storage/storage.py +++ b/src/gcore/types/storage/storage.py @@ -53,7 +53,7 @@ class Storage(BaseModel): created_at: str """ISO 8601 timestamp when the storage was created""" - location: Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"] + location: str """Geographic location code where the storage is provisioned""" name: str diff --git a/src/gcore/types/storage/storage_create_params.py b/src/gcore/types/storage/storage_create_params.py index b3a6cc62..e5582029 100644 --- a/src/gcore/types/storage/storage_create_params.py +++ b/src/gcore/types/storage/storage_create_params.py @@ -8,7 +8,7 @@ class StorageCreateParams(TypedDict, total=False): - location: Required[Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"]] + location: Required[str] """Geographic location where the storage will be provisioned. Each location represents a specific data center region. diff --git a/tests/api_resources/storage/test_credentials.py b/tests/api_resources/storage/test_credentials.py index caf6bc59..8f02e9d0 100644 --- a/tests/api_resources/storage/test_credentials.py +++ b/tests/api_resources/storage/test_credentials.py @@ -28,11 +28,11 @@ def test_method_recreate(self, client: Gcore) -> None: def test_method_recreate_with_all_params(self, client: Gcore) -> None: credential = client.storage.credentials.recreate( storage_id=0, - delete_sftp_password=False, + delete_sftp_password=True, generate_s3_keys=True, generate_sftp_password=True, - reset_sftp_keys=False, - sftp_password="MyNewSecurePassword123", + reset_sftp_keys=True, + sftp_password="sftp_password", ) assert_matches_type(Storage, credential, path=["response"]) @@ -77,11 +77,11 @@ async def test_method_recreate(self, async_client: AsyncGcore) -> None: async def test_method_recreate_with_all_params(self, async_client: AsyncGcore) -> None: credential = await async_client.storage.credentials.recreate( storage_id=0, - delete_sftp_password=False, + delete_sftp_password=True, generate_s3_keys=True, generate_sftp_password=True, - reset_sftp_keys=False, - sftp_password="MyNewSecurePassword123", + reset_sftp_keys=True, + sftp_password="sftp_password", ) assert_matches_type(Storage, credential, path=["response"]) diff --git a/tests/api_resources/storage/test_statistics.py b/tests/api_resources/storage/test_statistics.py index 4c4739fd..7bcb3e22 100644 --- a/tests/api_resources/storage/test_statistics.py +++ b/tests/api_resources/storage/test_statistics.py @@ -29,7 +29,7 @@ def test_method_get_usage_aggregated(self, client: Gcore) -> None: def test_method_get_usage_aggregated_with_all_params(self, client: Gcore) -> None: statistic = client.storage.statistics.get_usage_aggregated( from_="2006-01-02", - locations=["s-ed1", "s-drc2", "s-sgc1"], + locations=["s-region-1", "s-region-2"], storages=["123-myStorage"], to="2006-01-02", ) @@ -65,7 +65,7 @@ def test_method_get_usage_series_with_all_params(self, client: Gcore) -> None: statistic = client.storage.statistics.get_usage_series( from_="2006-01-02", granularity="12h", - locations=["s-ed1", "s-drc2", "s-sgc1"], + locations=["s-region-1", "s-region-2"], source=0, storages=["123-myStorage"], to="2006-01-02", @@ -108,7 +108,7 @@ async def test_method_get_usage_aggregated(self, async_client: AsyncGcore) -> No async def test_method_get_usage_aggregated_with_all_params(self, async_client: AsyncGcore) -> None: statistic = await async_client.storage.statistics.get_usage_aggregated( from_="2006-01-02", - locations=["s-ed1", "s-drc2", "s-sgc1"], + locations=["s-region-1", "s-region-2"], storages=["123-myStorage"], to="2006-01-02", ) @@ -144,7 +144,7 @@ async def test_method_get_usage_series_with_all_params(self, async_client: Async statistic = await async_client.storage.statistics.get_usage_series( from_="2006-01-02", granularity="12h", - locations=["s-ed1", "s-drc2", "s-sgc1"], + locations=["s-region-1", "s-region-2"], source=0, storages=["123-myStorage"], to="2006-01-02", diff --git a/tests/api_resources/test_storage.py b/tests/api_resources/test_storage.py index b66d14c9..00988587 100644 --- a/tests/api_resources/test_storage.py +++ b/tests/api_resources/test_storage.py @@ -23,7 +23,7 @@ class TestStorage: @parametrize def test_method_create(self, client: Gcore) -> None: storage = client.storage.create( - location="s-ed1", + location="s-region-1", name="my-storage-prod", type="s3", ) @@ -32,7 +32,7 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: storage = client.storage.create( - location="s-ed1", + location="s-region-1", name="my-storage-prod", type="s3", generate_sftp_password=True, @@ -43,7 +43,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.storage.with_raw_response.create( - location="s-ed1", + location="s-region-1", name="my-storage-prod", type="s3", ) @@ -56,7 +56,7 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.storage.with_streaming_response.create( - location="s-ed1", + location="s-region-1", name="my-storage-prod", type="s3", ) as response: @@ -327,7 +327,7 @@ class TestAsyncStorage: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: storage = await async_client.storage.create( - location="s-ed1", + location="s-region-1", name="my-storage-prod", type="s3", ) @@ -336,7 +336,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: storage = await async_client.storage.create( - location="s-ed1", + location="s-region-1", name="my-storage-prod", type="s3", generate_sftp_password=True, @@ -347,7 +347,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.storage.with_raw_response.create( - location="s-ed1", + location="s-region-1", name="my-storage-prod", type="s3", ) @@ -360,7 +360,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.storage.with_streaming_response.create( - location="s-ed1", + location="s-region-1", name="my-storage-prod", type="s3", ) as response: From d374f017e2bcb0c31e1de16d7a1256972c20786f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Nov 2025 12:15:57 +0000 Subject: [PATCH 423/592] feat(api): aggregated API specs update --- .stats.yml | 4 +-- src/gcore/resources/security/bgp_announces.py | 4 --- src/gcore/resources/security/profiles.py | 26 ++++++++++++++----- .../security/bgp_announce_list_params.py | 2 -- .../types/security/profile_create_params.py | 5 ++-- .../types/security/profile_recreate_params.py | 5 ++-- .../types/security/profile_replace_params.py | 5 ++-- .../security/test_bgp_announces.py | 2 -- tests/api_resources/security/test_profiles.py | 4 +-- 9 files changed, 32 insertions(+), 25 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5a78a97e..23e684ec 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 618 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c358b756aa348a1c6a982fa7af3c5134289f9951a0b2e348d5c5d796cd68a9b9.yml -openapi_spec_hash: 8f53b4d77c357ba5d34d47ec447ec57b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c98c3c0bf29fd07be3ff871bfac3cdc39c55c353207b7b33c6c448ab4f4cc845.yml +openapi_spec_hash: d77a4fabd08324c4e401d0d50c9a13c7 config_hash: db560bc3873a6441828babf34ae5f184 diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index 26b3bc96..1908f05a 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -48,7 +48,6 @@ def list( self, *, announced: Optional[bool] | Omit = omit, - client_id: Optional[int] | Omit = omit, origin: Optional[Literal["STATIC", "DYNAMIC"]] | Omit = omit, site: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -83,7 +82,6 @@ def list( query=maybe_transform( { "announced": announced, - "client_id": client_id, "origin": origin, "site": site, }, @@ -165,7 +163,6 @@ async def list( self, *, announced: Optional[bool] | Omit = omit, - client_id: Optional[int] | Omit = omit, origin: Optional[Literal["STATIC", "DYNAMIC"]] | Omit = omit, site: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -200,7 +197,6 @@ async def list( query=await async_maybe_transform( { "announced": announced, - "client_id": client_id, "origin": origin, "site": site, }, diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index 2ddf3257..6b397fdd 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Iterable import httpx @@ -55,7 +55,7 @@ def create( fields: Iterable[profile_create_params.Field], profile_template: int, site: str, - ip_address: Optional[str] | Omit = omit, + ip_address: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -69,6 +69,8 @@ def create( created Args: + ip_address: Required for Universal template only. Optional for all others. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -212,7 +214,7 @@ def recreate( *, fields: Iterable[profile_recreate_params.Field], profile_template: int, - ip_address: Optional[str] | Omit = omit, + ip_address: str | Omit = omit, site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -225,6 +227,8 @@ def recreate( Recreate profile with another profile template (for other cases use detail API) Args: + ip_address: Required for Universal template only. Optional for all others. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -256,7 +260,7 @@ def replace( *, fields: Iterable[profile_replace_params.Field], profile_template: int, - ip_address: Optional[str] | Omit = omit, + ip_address: str | Omit = omit, site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -271,6 +275,8 @@ def replace( updated Args: + ip_address: Required for Universal template only. Optional for all others. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -323,7 +329,7 @@ async def create( fields: Iterable[profile_create_params.Field], profile_template: int, site: str, - ip_address: Optional[str] | Omit = omit, + ip_address: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -337,6 +343,8 @@ async def create( created Args: + ip_address: Required for Universal template only. Optional for all others. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -480,7 +488,7 @@ async def recreate( *, fields: Iterable[profile_recreate_params.Field], profile_template: int, - ip_address: Optional[str] | Omit = omit, + ip_address: str | Omit = omit, site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -493,6 +501,8 @@ async def recreate( Recreate profile with another profile template (for other cases use detail API) Args: + ip_address: Required for Universal template only. Optional for all others. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -524,7 +534,7 @@ async def replace( *, fields: Iterable[profile_replace_params.Field], profile_template: int, - ip_address: Optional[str] | Omit = omit, + ip_address: str | Omit = omit, site: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -539,6 +549,8 @@ async def replace( updated Args: + ip_address: Required for Universal template only. Optional for all others. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/types/security/bgp_announce_list_params.py b/src/gcore/types/security/bgp_announce_list_params.py index 390464fe..2bc6a994 100644 --- a/src/gcore/types/security/bgp_announce_list_params.py +++ b/src/gcore/types/security/bgp_announce_list_params.py @@ -11,8 +11,6 @@ class BgpAnnounceListParams(TypedDict, total=False): announced: Optional[bool] - client_id: Optional[int] - origin: Optional[Literal["STATIC", "DYNAMIC"]] site: Optional[str] diff --git a/src/gcore/types/security/profile_create_params.py b/src/gcore/types/security/profile_create_params.py index ad7b982c..fccbc6a5 100644 --- a/src/gcore/types/security/profile_create_params.py +++ b/src/gcore/types/security/profile_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Iterable from typing_extensions import Required, TypedDict __all__ = ["ProfileCreateParams", "Field"] @@ -15,7 +15,8 @@ class ProfileCreateParams(TypedDict, total=False): site: Required[str] - ip_address: Optional[str] + ip_address: str + """Required for Universal template only. Optional for all others.""" class Field(TypedDict, total=False): diff --git a/src/gcore/types/security/profile_recreate_params.py b/src/gcore/types/security/profile_recreate_params.py index e1dd3d10..c0f4e097 100644 --- a/src/gcore/types/security/profile_recreate_params.py +++ b/src/gcore/types/security/profile_recreate_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Iterable from typing_extensions import Required, TypedDict __all__ = ["ProfileRecreateParams", "Field"] @@ -13,7 +13,8 @@ class ProfileRecreateParams(TypedDict, total=False): profile_template: Required[int] - ip_address: Optional[str] + ip_address: str + """Required for Universal template only. Optional for all others.""" site: str diff --git a/src/gcore/types/security/profile_replace_params.py b/src/gcore/types/security/profile_replace_params.py index 9684dffd..9d472c12 100644 --- a/src/gcore/types/security/profile_replace_params.py +++ b/src/gcore/types/security/profile_replace_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Iterable from typing_extensions import Required, TypedDict __all__ = ["ProfileReplaceParams", "Field"] @@ -13,7 +13,8 @@ class ProfileReplaceParams(TypedDict, total=False): profile_template: Required[int] - ip_address: Optional[str] + ip_address: str + """Required for Universal template only. Optional for all others.""" site: str diff --git a/tests/api_resources/security/test_bgp_announces.py b/tests/api_resources/security/test_bgp_announces.py index c1115976..8907ce2f 100644 --- a/tests/api_resources/security/test_bgp_announces.py +++ b/tests/api_resources/security/test_bgp_announces.py @@ -26,7 +26,6 @@ def test_method_list(self, client: Gcore) -> None: def test_method_list_with_all_params(self, client: Gcore) -> None: bgp_announce = client.security.bgp_announces.list( announced=True, - client_id=0, origin="STATIC", site="x", ) @@ -110,7 +109,6 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: bgp_announce = await async_client.security.bgp_announces.list( announced=True, - client_id=0, origin="STATIC", site="x", ) diff --git a/tests/api_resources/security/test_profiles.py b/tests/api_resources/security/test_profiles.py index c79499ab..38fdfe70 100644 --- a/tests/api_resources/security/test_profiles.py +++ b/tests/api_resources/security/test_profiles.py @@ -83,7 +83,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: exclude_empty_address=True, include_deleted=True, ip_address="ip_address", - site="site", + site="ED", ) assert_matches_type(ProfileListResponse, profile, path=["response"]) @@ -344,7 +344,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No exclude_empty_address=True, include_deleted=True, ip_address="ip_address", - site="site", + site="ED", ) assert_matches_type(ProfileListResponse, profile, path=["response"]) From 6898d14fea7ce2f71b89997bec4e48359938ed1f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Nov 2025 14:10:55 +0000 Subject: [PATCH 424/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cloud/gpu_baremetal_cluster.py | 7 +++++-- .../gpu_baremetal_cluster_server.py | 7 +++++-- src/gcore/types/cloud/gpu_image.py | 9 +++++++++ src/gcore/types/cloud/image.py | 9 +++++++++ 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index 23e684ec..9ebd1994 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 618 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c98c3c0bf29fd07be3ff871bfac3cdc39c55c353207b7b33c6c448ab4f4cc845.yml -openapi_spec_hash: d77a4fabd08324c4e401d0d50c9a13c7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c4c5dfe1ae880783e8245a2e920d681bd4f5aca8836e040aa190d3bf7e2430d6.yml +openapi_spec_hash: 96ef539de84a44456e5700c9b1526666 config_hash: db560bc3873a6441828babf34ae5f184 diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal_cluster.py index 373678bf..d2d67eca 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster.py @@ -94,8 +94,11 @@ class ServersSettingsInterfaceAnySubnetInterfaceOutputSerializer(BaseModel): class ServersSettingsSecurityGroup(BaseModel): + id: str + """Security group ID""" + name: str - """Name.""" + """Security group name""" class ServersSettings(BaseModel): @@ -105,7 +108,7 @@ class ServersSettings(BaseModel): interfaces: List[ServersSettingsInterface] security_groups: List[ServersSettingsSecurityGroup] - """Security groups names""" + """Security groups""" ssh_key_name: Optional[str] = None """SSH key name""" diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py index 58a99830..d2e11700 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py @@ -11,8 +11,11 @@ class SecurityGroup(BaseModel): + id: str + """Security group ID""" + name: str - """Name.""" + """Security group name""" class GPUBaremetalClusterServer(BaseModel): @@ -35,7 +38,7 @@ class GPUBaremetalClusterServer(BaseModel): """Server's name generated using cluster's name""" security_groups: List[SecurityGroup] - """Security groups names""" + """Security groups""" ssh_key_name: Optional[str] = None """SSH key pair assigned to the server""" diff --git a/src/gcore/types/cloud/gpu_image.py b/src/gcore/types/cloud/gpu_image.py index a5335c77..31a90256 100644 --- a/src/gcore/types/cloud/gpu_image.py +++ b/src/gcore/types/cloud/gpu_image.py @@ -47,6 +47,15 @@ class GPUImage(BaseModel): architecture: Optional[str] = None """Image architecture type""" + gpu_driver: Optional[str] = None + """Name of the GPU driver vendor""" + + gpu_driver_type: Optional[str] = None + """Type of the GPU driver""" + + gpu_driver_version: Optional[str] = None + """Version of the installed GPU driver""" + os_distro: Optional[str] = None """OS Distribution""" diff --git a/src/gcore/types/cloud/image.py b/src/gcore/types/cloud/image.py index 2ab1b799..901b0436 100644 --- a/src/gcore/types/cloud/image.py +++ b/src/gcore/types/cloud/image.py @@ -80,6 +80,15 @@ class Image(BaseModel): display_order: Optional[int] = None + gpu_driver: Optional[str] = None + """Name of the GPU driver vendor""" + + gpu_driver_type: Optional[str] = None + """Type of the GPU driver""" + + gpu_driver_version: Optional[str] = None + """Version of the installed GPU driver""" + hw_firmware_type: Optional[Literal["bios", "uefi"]] = None """Specifies the type of firmware with which to boot the guest.""" From 50a31bfee86180a017ced7c07ccd789c7b1a5646 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Nov 2025 10:11:32 +0000 Subject: [PATCH 425/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/resources/security/profiles.py | 12 ++++++++++++ src/gcore/types/security/client_profile.py | 1 + src/gcore/types/security/profile_create_params.py | 1 + src/gcore/types/security/profile_recreate_params.py | 1 + src/gcore/types/security/profile_replace_params.py | 1 + 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9ebd1994..934a1512 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 618 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c4c5dfe1ae880783e8245a2e920d681bd4f5aca8836e040aa190d3bf7e2430d6.yml -openapi_spec_hash: 96ef539de84a44456e5700c9b1526666 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-29e2cc8d4eccb3e6657d61c17d200583cc2bd5bd90494b331881256e362d5873.yml +openapi_spec_hash: de6249d14f251ef0a008dd506e0e99ef config_hash: db560bc3873a6441828babf34ae5f184 diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index 6b397fdd..13cfdcfa 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -69,6 +69,8 @@ def create( created Args: + site: Region where the protection profiles will be deployed + ip_address: Required for Universal template only. Optional for all others. extra_headers: Send extra headers @@ -229,6 +231,8 @@ def recreate( Args: ip_address: Required for Universal template only. Optional for all others. + site: Region where the protection profiles will be deployed + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -277,6 +281,8 @@ def replace( Args: ip_address: Required for Universal template only. Optional for all others. + site: Region where the protection profiles will be deployed + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -343,6 +349,8 @@ async def create( created Args: + site: Region where the protection profiles will be deployed + ip_address: Required for Universal template only. Optional for all others. extra_headers: Send extra headers @@ -503,6 +511,8 @@ async def recreate( Args: ip_address: Required for Universal template only. Optional for all others. + site: Region where the protection profiles will be deployed + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -551,6 +561,8 @@ async def replace( Args: ip_address: Required for Universal template only. Optional for all others. + site: Region where the protection profiles will be deployed + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/types/security/client_profile.py b/src/gcore/types/security/client_profile.py index e02111b5..7cf11bbb 100644 --- a/src/gcore/types/security/client_profile.py +++ b/src/gcore/types/security/client_profile.py @@ -50,6 +50,7 @@ class ClientProfile(BaseModel): protocols: List[Dict[str, object]] site: str + """Region where the protection profiles will be deployed""" status: Dict[str, object] diff --git a/src/gcore/types/security/profile_create_params.py b/src/gcore/types/security/profile_create_params.py index fccbc6a5..a26e0d2a 100644 --- a/src/gcore/types/security/profile_create_params.py +++ b/src/gcore/types/security/profile_create_params.py @@ -14,6 +14,7 @@ class ProfileCreateParams(TypedDict, total=False): profile_template: Required[int] site: Required[str] + """Region where the protection profiles will be deployed""" ip_address: str """Required for Universal template only. Optional for all others.""" diff --git a/src/gcore/types/security/profile_recreate_params.py b/src/gcore/types/security/profile_recreate_params.py index c0f4e097..4c6718fe 100644 --- a/src/gcore/types/security/profile_recreate_params.py +++ b/src/gcore/types/security/profile_recreate_params.py @@ -17,6 +17,7 @@ class ProfileRecreateParams(TypedDict, total=False): """Required for Universal template only. Optional for all others.""" site: str + """Region where the protection profiles will be deployed""" class Field(TypedDict, total=False): diff --git a/src/gcore/types/security/profile_replace_params.py b/src/gcore/types/security/profile_replace_params.py index 9d472c12..eb4e5ca8 100644 --- a/src/gcore/types/security/profile_replace_params.py +++ b/src/gcore/types/security/profile_replace_params.py @@ -17,6 +17,7 @@ class ProfileReplaceParams(TypedDict, total=False): """Required for Universal template only. Optional for all others.""" site: str + """Region where the protection profiles will be deployed""" class Field(TypedDict, total=False): From 6f9d1b2a8d280324c7193ee567a468a6d87379cd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 09:33:16 +0000 Subject: [PATCH 426/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4ad3fef3..e7562934 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.18.0" + ".": "0.19.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 59cd40d8..e9c43979 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.18.0" +version = "0.19.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 4e588aa0..54b67f1e 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.18.0" # x-release-please-version +__version__ = "0.19.0" # x-release-please-version From 073ba90c9e97f0b2671141f1268f4669bd419c3b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 11:29:53 +0000 Subject: [PATCH 427/592] chore(package): drop Python 3.8 support --- README.md | 4 ++-- pyproject.toml | 5 ++--- src/gcore/_utils/_sync.py | 34 +++------------------------------- 3 files changed, 7 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 4e4cfb33..fbb3f3cf 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![PyPI version](https://img.shields.io/pypi/v/gcore.svg?label=pypi%20(stable))](https://pypi.org/project/gcore/) -The Gcore Python library provides convenient access to the Gcore REST API from any Python 3.8+ +The Gcore Python library provides convenient access to the Gcore REST API from any Python 3.9+ application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). @@ -445,7 +445,7 @@ print(gcore.__version__) ## Requirements -Python 3.8 or higher. +Python 3.9 or higher. ## Contributing diff --git a/pyproject.toml b/pyproject.toml index e9c43979..adc340a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,11 +15,10 @@ dependencies = [ "distro>=1.7.0, <2", "sniffio", ] -requires-python = ">= 3.8" +requires-python = ">= 3.9" classifiers = [ "Typing :: Typed", "Intended Audience :: Developers", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -142,7 +141,7 @@ filterwarnings = [ # there are a couple of flags that are still disabled by # default in strict mode as they are experimental and niche. typeCheckingMode = "strict" -pythonVersion = "3.8" +pythonVersion = "3.9" exclude = [ "_dev", diff --git a/src/gcore/_utils/_sync.py b/src/gcore/_utils/_sync.py index ad7ec71b..f6027c18 100644 --- a/src/gcore/_utils/_sync.py +++ b/src/gcore/_utils/_sync.py @@ -1,10 +1,8 @@ from __future__ import annotations -import sys import asyncio import functools -import contextvars -from typing import Any, TypeVar, Callable, Awaitable +from typing import TypeVar, Callable, Awaitable from typing_extensions import ParamSpec import anyio @@ -15,34 +13,11 @@ T_ParamSpec = ParamSpec("T_ParamSpec") -if sys.version_info >= (3, 9): - _asyncio_to_thread = asyncio.to_thread -else: - # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread - # for Python 3.8 support - async def _asyncio_to_thread( - func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs - ) -> Any: - """Asynchronously run function *func* in a separate thread. - - Any *args and **kwargs supplied for this function are directly passed - to *func*. Also, the current :class:`contextvars.Context` is propagated, - allowing context variables from the main thread to be accessed in the - separate thread. - - Returns a coroutine that can be awaited to get the eventual result of *func*. - """ - loop = asyncio.events.get_running_loop() - ctx = contextvars.copy_context() - func_call = functools.partial(ctx.run, func, *args, **kwargs) - return await loop.run_in_executor(None, func_call) - - async def to_thread( func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs ) -> T_Retval: if sniffio.current_async_library() == "asyncio": - return await _asyncio_to_thread(func, *args, **kwargs) + return await asyncio.to_thread(func, *args, **kwargs) return await anyio.to_thread.run_sync( functools.partial(func, *args, **kwargs), @@ -53,10 +28,7 @@ async def to_thread( def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: """ Take a blocking function and create an async one that receives the same - positional and keyword arguments. For python version 3.9 and above, it uses - asyncio.to_thread to run the function in a separate thread. For python version - 3.8, it uses locally defined copy of the asyncio.to_thread function which was - introduced in python 3.9. + positional and keyword arguments. Usage: From 038301aae3b9a6d32a562fd517e4a0e92340c253 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 13:36:28 +0000 Subject: [PATCH 428/592] fix: compat with Python 3.14 --- src/gcore/_models.py | 11 ++++++++--- tests/test_models.py | 8 ++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/gcore/_models.py b/src/gcore/_models.py index 6a3cd1d2..fcec2cf9 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -2,6 +2,7 @@ import os import inspect +import weakref from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast from datetime import date, datetime from typing_extensions import ( @@ -573,6 +574,9 @@ class CachedDiscriminatorType(Protocol): __discriminator__: DiscriminatorDetails +DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary() + + class DiscriminatorDetails: field_name: str """The name of the discriminator field in the variant class, e.g. @@ -615,8 +619,9 @@ def __init__( def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None: - if isinstance(union, CachedDiscriminatorType): - return union.__discriminator__ + cached = DISCRIMINATOR_CACHE.get(union) + if cached is not None: + return cached discriminator_field_name: str | None = None @@ -669,7 +674,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, discriminator_field=discriminator_field_name, discriminator_alias=discriminator_alias, ) - cast(CachedDiscriminatorType, union).__discriminator__ = details + DISCRIMINATOR_CACHE.setdefault(union, details) return details diff --git a/tests/test_models.py b/tests/test_models.py index 7b21d517..d899cd02 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -9,7 +9,7 @@ from gcore._utils import PropertyInfo from gcore._compat import PYDANTIC_V1, parse_obj, model_dump, model_json -from gcore._models import BaseModel, construct_type +from gcore._models import DISCRIMINATOR_CACHE, BaseModel, construct_type class BasicModel(BaseModel): @@ -809,7 +809,7 @@ class B(BaseModel): UnionType = cast(Any, Union[A, B]) - assert not hasattr(UnionType, "__discriminator__") + assert not DISCRIMINATOR_CACHE.get(UnionType) m = construct_type( value={"type": "b", "data": "foo"}, type_=cast(Any, Annotated[UnionType, PropertyInfo(discriminator="type")]) @@ -818,7 +818,7 @@ class B(BaseModel): assert m.type == "b" assert m.data == "foo" # type: ignore[comparison-overlap] - discriminator = UnionType.__discriminator__ + discriminator = DISCRIMINATOR_CACHE.get(UnionType) assert discriminator is not None m = construct_type( @@ -830,7 +830,7 @@ class B(BaseModel): # if the discriminator details object stays the same between invocations then # we hit the cache - assert UnionType.__discriminator__ is discriminator + assert DISCRIMINATOR_CACHE.get(UnionType) is discriminator @pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") From 1f9c0477343de0d033c9ec158251c8f8a8cfd8af Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 11 Nov 2025 06:14:13 +0000 Subject: [PATCH 429/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/resources/cdn/audit_log.py | 8 ++++---- src/gcore/types/cdn/audit_log_list_params.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index 934a1512..11307508 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 618 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-29e2cc8d4eccb3e6657d61c17d200583cc2bd5bd90494b331881256e362d5873.yml -openapi_spec_hash: de6249d14f251ef0a008dd506e0e99ef +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-cf3ae8749ead0412e761136b7c81a9ca98dd46ca9ef76c1f700cb1ecc814630d.yml +openapi_spec_hash: d5b2b66116339bbe16ec0bbff5b6366f config_hash: db560bc3873a6441828babf34ae5f184 diff --git a/src/gcore/resources/cdn/audit_log.py b/src/gcore/resources/cdn/audit_log.py index f39a518f..a80c335e 100644 --- a/src/gcore/resources/cdn/audit_log.py +++ b/src/gcore/resources/cdn/audit_log.py @@ -99,9 +99,9 @@ def list( offset: Offset relative to the beginning of activity logs. - path: Path that a requested URL should contain. + path: Exact URL path. - remote_ip_address: IP address or part of it from which requests are sent. + remote_ip_address: Exact IP address from which requests are sent. status_code: Status code returned in the response. @@ -263,9 +263,9 @@ def list( offset: Offset relative to the beginning of activity logs. - path: Path that a requested URL should contain. + path: Exact URL path. - remote_ip_address: IP address or part of it from which requests are sent. + remote_ip_address: Exact IP address from which requests are sent. status_code: Status code returned in the response. diff --git a/src/gcore/types/cdn/audit_log_list_params.py b/src/gcore/types/cdn/audit_log_list_params.py index 95024e59..e70beede 100644 --- a/src/gcore/types/cdn/audit_log_list_params.py +++ b/src/gcore/types/cdn/audit_log_list_params.py @@ -50,10 +50,10 @@ class AuditLogListParams(TypedDict, total=False): """Offset relative to the beginning of activity logs.""" path: str - """Path that a requested URL should contain.""" + """Exact URL path.""" remote_ip_address: str - """IP address or part of it from which requests are sent.""" + """Exact IP address from which requests are sent.""" status_code: int """Status code returned in the response. From 7c07d407d071f6775dd9dc921dc2ce575ea73a80 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 11 Nov 2025 13:50:59 +0000 Subject: [PATCH 430/592] feat(cloud): add support for GPU virtual clusters --- .stats.yml | 4 +- api.md | 81 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + .../cloud/gpu_virtual_clusters/__init__.py | 89 + .../cloud/gpu_virtual_clusters/flavors.py | 211 +++ .../gpu_virtual_clusters.py | 1539 +++++++++++++++++ .../cloud/gpu_virtual_clusters/images.py | 580 +++++++ .../cloud/gpu_virtual_clusters/interfaces.py | 187 ++ .../cloud/gpu_virtual_clusters/servers.py | 506 ++++++ .../cloud/gpu_virtual_clusters/volumes.py | 187 ++ src/gcore/types/cloud/__init__.py | 6 + src/gcore/types/cloud/gpu_virtual_cluster.py | 189 ++ .../gpu_virtual_cluster_action_params.py | 122 ++ .../gpu_virtual_cluster_create_params.py | 213 +++ .../gpu_virtual_cluster_delete_params.py | 41 + .../cloud/gpu_virtual_cluster_list_params.py | 21 + .../gpu_virtual_cluster_update_params.py | 18 + .../cloud/gpu_virtual_clusters/__init__.py | 16 + .../flavor_list_params.py | 21 + .../gpu_virtual_cluster_server.py | 77 + .../gpu_virtual_cluster_server_list.py | 16 + .../gpu_virtual_cluster_volume.py | 64 + .../gpu_virtual_cluster_volume_list.py | 16 + .../gpu_virtual_flavor.py | 155 ++ .../gpu_virtual_flavor_list.py | 16 + .../gpu_virtual_interface.py | 190 ++ .../gpu_virtual_interface_list.py | 16 + .../image_upload_params.py | 56 + .../server_delete_params.py | 44 + .../server_list_params.py | 75 + .../cloud/gpu_virtual_clusters/__init__.py | 1 + .../gpu_virtual_clusters/test_flavors.py | 112 ++ .../cloud/gpu_virtual_clusters/test_images.py | 392 +++++ .../gpu_virtual_clusters/test_interfaces.py | 116 ++ .../gpu_virtual_clusters/test_servers.py | 302 ++++ .../gpu_virtual_clusters/test_volumes.py | 116 ++ .../cloud/test_gpu_virtual_clusters.py | 1294 ++++++++++++++ 38 files changed, 7133 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/gpu_virtual_clusters/__init__.py create mode 100644 src/gcore/resources/cloud/gpu_virtual_clusters/flavors.py create mode 100644 src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py create mode 100644 src/gcore/resources/cloud/gpu_virtual_clusters/images.py create mode 100644 src/gcore/resources/cloud/gpu_virtual_clusters/interfaces.py create mode 100644 src/gcore/resources/cloud/gpu_virtual_clusters/servers.py create mode 100644 src/gcore/resources/cloud/gpu_virtual_clusters/volumes.py create mode 100644 src/gcore/types/cloud/gpu_virtual_cluster.py create mode 100644 src/gcore/types/cloud/gpu_virtual_cluster_action_params.py create mode 100644 src/gcore/types/cloud/gpu_virtual_cluster_create_params.py create mode 100644 src/gcore/types/cloud/gpu_virtual_cluster_delete_params.py create mode 100644 src/gcore/types/cloud/gpu_virtual_cluster_list_params.py create mode 100644 src/gcore/types/cloud/gpu_virtual_cluster_update_params.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/__init__.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/flavor_list_params.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server_list.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume_list.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor_list.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface_list.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/server_delete_params.py create mode 100644 src/gcore/types/cloud/gpu_virtual_clusters/server_list_params.py create mode 100644 tests/api_resources/cloud/gpu_virtual_clusters/__init__.py create mode 100644 tests/api_resources/cloud/gpu_virtual_clusters/test_flavors.py create mode 100644 tests/api_resources/cloud/gpu_virtual_clusters/test_images.py create mode 100644 tests/api_resources/cloud/gpu_virtual_clusters/test_interfaces.py create mode 100644 tests/api_resources/cloud/gpu_virtual_clusters/test_servers.py create mode 100644 tests/api_resources/cloud/gpu_virtual_clusters/test_volumes.py create mode 100644 tests/api_resources/cloud/test_gpu_virtual_clusters.py diff --git a/.stats.yml b/.stats.yml index 11307508..af8fa5c8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 618 +configured_endpoints: 633 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-cf3ae8749ead0412e761136b7c81a9ca98dd46ca9ef76c1f700cb1ecc814630d.yml openapi_spec_hash: d5b2b66116339bbe16ec0bbff5b6366f -config_hash: db560bc3873a6441828babf34ae5f184 +config_hash: e759f29c457a9e3ac5031e760c36594a diff --git a/api.md b/api.md index 180b482b..6158d8b8 100644 --- a/api.md +++ b/api.md @@ -826,6 +826,87 @@ Methods: - client.cloud.gpu_baremetal_clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage - client.cloud.gpu_baremetal_clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList +## GPUVirtualClusters + +Types: + +```python +from gcore.types.cloud import GPUVirtualCluster +``` + +Methods: + +- client.cloud.gpu_virtual_clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual_clusters.update(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualCluster +- client.cloud.gpu_virtual_clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUVirtualCluster] +- client.cloud.gpu_virtual_clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual_clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual_clusters.get(cluster_id, \*, project_id, region_id) -> GPUVirtualCluster + +### Servers + +Types: + +```python +from gcore.types.cloud.gpu_virtual_clusters import ( + GPUVirtualClusterServer, + GPUVirtualClusterServerList, +) +``` + +Methods: + +- client.cloud.gpu_virtual_clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualClusterServerList +- client.cloud.gpu_virtual_clusters.servers.delete(server_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList + +### Volumes + +Types: + +```python +from gcore.types.cloud.gpu_virtual_clusters import ( + GPUVirtualClusterVolume, + GPUVirtualClusterVolumeList, +) +``` + +Methods: + +- client.cloud.gpu_virtual_clusters.volumes.list(cluster_id, \*, project_id, region_id) -> GPUVirtualClusterVolumeList + +### Interfaces + +Types: + +```python +from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualInterface, GPUVirtualInterfaceList +``` + +Methods: + +- client.cloud.gpu_virtual_clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> GPUVirtualInterfaceList + +### Flavors + +Types: + +```python +from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualFlavor, GPUVirtualFlavorList +``` + +Methods: + +- client.cloud.gpu_virtual_clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUVirtualFlavorList + +### Images + +Methods: + +- client.cloud.gpu_virtual_clusters.images.list(\*, project_id, region_id) -> GPUImageList +- client.cloud.gpu_virtual_clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.gpu_virtual_clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage +- client.cloud.gpu_virtual_clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList + ## Instances Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index b430fc7c..6ae9dac7 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -216,6 +216,14 @@ BillingReservationsResourceWithStreamingResponse, AsyncBillingReservationsResourceWithStreamingResponse, ) +from .gpu_virtual_clusters import ( + GPUVirtualClustersResource, + AsyncGPUVirtualClustersResource, + GPUVirtualClustersResourceWithRawResponse, + AsyncGPUVirtualClustersResourceWithRawResponse, + GPUVirtualClustersResourceWithStreamingResponse, + AsyncGPUVirtualClustersResourceWithStreamingResponse, +) from .gpu_baremetal_clusters import ( GPUBaremetalClustersResource, AsyncGPUBaremetalClustersResource, @@ -352,6 +360,12 @@ "AsyncGPUBaremetalClustersResourceWithRawResponse", "GPUBaremetalClustersResourceWithStreamingResponse", "AsyncGPUBaremetalClustersResourceWithStreamingResponse", + "GPUVirtualClustersResource", + "AsyncGPUVirtualClustersResource", + "GPUVirtualClustersResourceWithRawResponse", + "AsyncGPUVirtualClustersResourceWithRawResponse", + "GPUVirtualClustersResourceWithStreamingResponse", + "AsyncGPUVirtualClustersResourceWithStreamingResponse", "InstancesResource", "AsyncInstancesResource", "InstancesResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 6583dc98..3f9ad996 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -212,6 +212,14 @@ ReservedFixedIPsResourceWithStreamingResponse, AsyncReservedFixedIPsResourceWithStreamingResponse, ) +from .gpu_virtual_clusters.gpu_virtual_clusters import ( + GPUVirtualClustersResource, + AsyncGPUVirtualClustersResource, + GPUVirtualClustersResourceWithRawResponse, + AsyncGPUVirtualClustersResourceWithRawResponse, + GPUVirtualClustersResourceWithStreamingResponse, + AsyncGPUVirtualClustersResourceWithStreamingResponse, +) from .gpu_baremetal_clusters.gpu_baremetal_clusters import ( GPUBaremetalClustersResource, AsyncGPUBaremetalClustersResource, @@ -316,6 +324,10 @@ def billing_reservations(self) -> BillingReservationsResource: def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResource: return GPUBaremetalClustersResource(self._client) + @cached_property + def gpu_virtual_clusters(self) -> GPUVirtualClustersResource: + return GPUVirtualClustersResource(self._client) + @cached_property def instances(self) -> InstancesResource: return InstancesResource(self._client) @@ -452,6 +464,10 @@ def billing_reservations(self) -> AsyncBillingReservationsResource: def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResource: return AsyncGPUBaremetalClustersResource(self._client) + @cached_property + def gpu_virtual_clusters(self) -> AsyncGPUVirtualClustersResource: + return AsyncGPUVirtualClustersResource(self._client) + @cached_property def instances(self) -> AsyncInstancesResource: return AsyncInstancesResource(self._client) @@ -591,6 +607,10 @@ def billing_reservations(self) -> BillingReservationsResourceWithRawResponse: def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithRawResponse: return GPUBaremetalClustersResourceWithRawResponse(self._cloud.gpu_baremetal_clusters) + @cached_property + def gpu_virtual_clusters(self) -> GPUVirtualClustersResourceWithRawResponse: + return GPUVirtualClustersResourceWithRawResponse(self._cloud.gpu_virtual_clusters) + @cached_property def instances(self) -> InstancesResourceWithRawResponse: return InstancesResourceWithRawResponse(self._cloud.instances) @@ -711,6 +731,10 @@ def billing_reservations(self) -> AsyncBillingReservationsResourceWithRawRespons def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithRawResponse: return AsyncGPUBaremetalClustersResourceWithRawResponse(self._cloud.gpu_baremetal_clusters) + @cached_property + def gpu_virtual_clusters(self) -> AsyncGPUVirtualClustersResourceWithRawResponse: + return AsyncGPUVirtualClustersResourceWithRawResponse(self._cloud.gpu_virtual_clusters) + @cached_property def instances(self) -> AsyncInstancesResourceWithRawResponse: return AsyncInstancesResourceWithRawResponse(self._cloud.instances) @@ -831,6 +855,10 @@ def billing_reservations(self) -> BillingReservationsResourceWithStreamingRespon def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithStreamingResponse: return GPUBaremetalClustersResourceWithStreamingResponse(self._cloud.gpu_baremetal_clusters) + @cached_property + def gpu_virtual_clusters(self) -> GPUVirtualClustersResourceWithStreamingResponse: + return GPUVirtualClustersResourceWithStreamingResponse(self._cloud.gpu_virtual_clusters) + @cached_property def instances(self) -> InstancesResourceWithStreamingResponse: return InstancesResourceWithStreamingResponse(self._cloud.instances) @@ -951,6 +979,10 @@ def billing_reservations(self) -> AsyncBillingReservationsResourceWithStreamingR def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithStreamingResponse: return AsyncGPUBaremetalClustersResourceWithStreamingResponse(self._cloud.gpu_baremetal_clusters) + @cached_property + def gpu_virtual_clusters(self) -> AsyncGPUVirtualClustersResourceWithStreamingResponse: + return AsyncGPUVirtualClustersResourceWithStreamingResponse(self._cloud.gpu_virtual_clusters) + @cached_property def instances(self) -> AsyncInstancesResourceWithStreamingResponse: return AsyncInstancesResourceWithStreamingResponse(self._cloud.instances) diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/__init__.py b/src/gcore/resources/cloud/gpu_virtual_clusters/__init__.py new file mode 100644 index 00000000..6957a34c --- /dev/null +++ b/src/gcore/resources/cloud/gpu_virtual_clusters/__init__.py @@ -0,0 +1,89 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .images import ( + ImagesResource, + AsyncImagesResource, + ImagesResourceWithRawResponse, + AsyncImagesResourceWithRawResponse, + ImagesResourceWithStreamingResponse, + AsyncImagesResourceWithStreamingResponse, +) +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .servers import ( + ServersResource, + AsyncServersResource, + ServersResourceWithRawResponse, + AsyncServersResourceWithRawResponse, + ServersResourceWithStreamingResponse, + AsyncServersResourceWithStreamingResponse, +) +from .volumes import ( + VolumesResource, + AsyncVolumesResource, + VolumesResourceWithRawResponse, + AsyncVolumesResourceWithRawResponse, + VolumesResourceWithStreamingResponse, + AsyncVolumesResourceWithStreamingResponse, +) +from .interfaces import ( + InterfacesResource, + AsyncInterfacesResource, + InterfacesResourceWithRawResponse, + AsyncInterfacesResourceWithRawResponse, + InterfacesResourceWithStreamingResponse, + AsyncInterfacesResourceWithStreamingResponse, +) +from .gpu_virtual_clusters import ( + GPUVirtualClustersResource, + AsyncGPUVirtualClustersResource, + GPUVirtualClustersResourceWithRawResponse, + AsyncGPUVirtualClustersResourceWithRawResponse, + GPUVirtualClustersResourceWithStreamingResponse, + AsyncGPUVirtualClustersResourceWithStreamingResponse, +) + +__all__ = [ + "ServersResource", + "AsyncServersResource", + "ServersResourceWithRawResponse", + "AsyncServersResourceWithRawResponse", + "ServersResourceWithStreamingResponse", + "AsyncServersResourceWithStreamingResponse", + "VolumesResource", + "AsyncVolumesResource", + "VolumesResourceWithRawResponse", + "AsyncVolumesResourceWithRawResponse", + "VolumesResourceWithStreamingResponse", + "AsyncVolumesResourceWithStreamingResponse", + "InterfacesResource", + "AsyncInterfacesResource", + "InterfacesResourceWithRawResponse", + "AsyncInterfacesResourceWithRawResponse", + "InterfacesResourceWithStreamingResponse", + "AsyncInterfacesResourceWithStreamingResponse", + "FlavorsResource", + "AsyncFlavorsResource", + "FlavorsResourceWithRawResponse", + "AsyncFlavorsResourceWithRawResponse", + "FlavorsResourceWithStreamingResponse", + "AsyncFlavorsResourceWithStreamingResponse", + "ImagesResource", + "AsyncImagesResource", + "ImagesResourceWithRawResponse", + "AsyncImagesResourceWithRawResponse", + "ImagesResourceWithStreamingResponse", + "AsyncImagesResourceWithStreamingResponse", + "GPUVirtualClustersResource", + "AsyncGPUVirtualClustersResource", + "GPUVirtualClustersResourceWithRawResponse", + "AsyncGPUVirtualClustersResourceWithRawResponse", + "GPUVirtualClustersResourceWithStreamingResponse", + "AsyncGPUVirtualClustersResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/flavors.py b/src/gcore/resources/cloud/gpu_virtual_clusters/flavors.py new file mode 100644 index 00000000..269932f2 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_virtual_clusters/flavors.py @@ -0,0 +1,211 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.gpu_virtual_clusters import flavor_list_params +from ....types.cloud.gpu_virtual_clusters.gpu_virtual_flavor_list import GPUVirtualFlavorList + +__all__ = ["FlavorsResource", "AsyncFlavorsResource"] + + +class FlavorsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FlavorsResourceWithRawResponse: + """ + 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 FlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: + """ + 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 FlavorsResourceWithStreamingResponse(self) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + hide_disabled: bool | Omit = omit, + include_prices: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUVirtualFlavorList: + """ + List virtual GPU flavors + + Args: + project_id: Project ID + + region_id: Region ID + + hide_disabled: Set to `true` to remove the disabled flavors from the response. + + include_prices: Set to `true` if the response should include flavor prices. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/flavors", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "hide_disabled": hide_disabled, + "include_prices": include_prices, + }, + flavor_list_params.FlavorListParams, + ), + ), + cast_to=GPUVirtualFlavorList, + ) + + +class AsyncFlavorsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFlavorsResourceWithRawResponse: + """ + 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 AsyncFlavorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: + """ + 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 AsyncFlavorsResourceWithStreamingResponse(self) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + hide_disabled: bool | Omit = omit, + include_prices: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUVirtualFlavorList: + """ + List virtual GPU flavors + + Args: + project_id: Project ID + + region_id: Region ID + + hide_disabled: Set to `true` to remove the disabled flavors from the response. + + include_prices: Set to `true` if the response should include flavor prices. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/flavors", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "hide_disabled": hide_disabled, + "include_prices": include_prices, + }, + flavor_list_params.FlavorListParams, + ), + ), + cast_to=GPUVirtualFlavorList, + ) + + +class FlavorsResourceWithRawResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_raw_response_wrapper( + flavors.list, + ) + + +class AsyncFlavorsResourceWithRawResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_raw_response_wrapper( + flavors.list, + ) + + +class FlavorsResourceWithStreamingResponse: + def __init__(self, flavors: FlavorsResource) -> None: + self._flavors = flavors + + self.list = to_streamed_response_wrapper( + flavors.list, + ) + + +class AsyncFlavorsResourceWithStreamingResponse: + def __init__(self, flavors: AsyncFlavorsResource) -> None: + self._flavors = flavors + + self.list = async_to_streamed_response_wrapper( + flavors.list, + ) diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py b/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py new file mode 100644 index 00000000..7711ec5a --- /dev/null +++ b/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py @@ -0,0 +1,1539 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal, overload + +import httpx + +from .images import ( + ImagesResource, + AsyncImagesResource, + ImagesResourceWithRawResponse, + AsyncImagesResourceWithRawResponse, + ImagesResourceWithStreamingResponse, + AsyncImagesResourceWithStreamingResponse, +) +from .flavors import ( + FlavorsResource, + AsyncFlavorsResource, + FlavorsResourceWithRawResponse, + AsyncFlavorsResourceWithRawResponse, + FlavorsResourceWithStreamingResponse, + AsyncFlavorsResourceWithStreamingResponse, +) +from .servers import ( + ServersResource, + AsyncServersResource, + ServersResourceWithRawResponse, + AsyncServersResourceWithRawResponse, + ServersResourceWithStreamingResponse, + AsyncServersResourceWithStreamingResponse, +) +from .volumes import ( + VolumesResource, + AsyncVolumesResource, + VolumesResourceWithRawResponse, + AsyncVolumesResourceWithRawResponse, + VolumesResourceWithStreamingResponse, + AsyncVolumesResourceWithStreamingResponse, +) +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ...._utils import required_args, maybe_transform, async_maybe_transform +from ...._compat import cached_property +from .interfaces import ( + InterfacesResource, + AsyncInterfacesResource, + InterfacesResourceWithRawResponse, + AsyncInterfacesResourceWithRawResponse, + InterfacesResourceWithStreamingResponse, + AsyncInterfacesResourceWithStreamingResponse, +) +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....pagination import SyncOffsetPage, AsyncOffsetPage +from ....types.cloud import ( + gpu_virtual_cluster_list_params, + gpu_virtual_cluster_action_params, + gpu_virtual_cluster_create_params, + gpu_virtual_cluster_delete_params, + gpu_virtual_cluster_update_params, +) +from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.gpu_virtual_cluster import GPUVirtualCluster +from ....types.cloud.tag_update_map_param import TagUpdateMapParam + +__all__ = ["GPUVirtualClustersResource", "AsyncGPUVirtualClustersResource"] + + +class GPUVirtualClustersResource(SyncAPIResource): + @cached_property + def servers(self) -> ServersResource: + return ServersResource(self._client) + + @cached_property + def volumes(self) -> VolumesResource: + return VolumesResource(self._client) + + @cached_property + def interfaces(self) -> InterfacesResource: + return InterfacesResource(self._client) + + @cached_property + def flavors(self) -> FlavorsResource: + return FlavorsResource(self._client) + + @cached_property + def images(self) -> ImagesResource: + return ImagesResource(self._client) + + @cached_property + def with_raw_response(self) -> GPUVirtualClustersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return GPUVirtualClustersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> GPUVirtualClustersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return GPUVirtualClustersResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str, + name: str, + servers_count: int, + servers_settings: gpu_virtual_cluster_create_params.ServersSettings, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Create a new virtual GPU cluster with the specified configuration. + + Args: + project_id: Project ID + + region_id: Region ID + + flavor: Cluster flavor ID + + name: Cluster name + + servers_count: Number of servers in the cluster + + servers_settings: Configuration settings for the servers in the cluster + + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters", + body=maybe_transform( + { + "flavor": flavor, + "name": name, + "servers_count": servers_count, + "servers_settings": servers_settings, + "tags": tags, + }, + gpu_virtual_cluster_create_params.GPUVirtualClusterCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + 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, + ) -> GPUVirtualCluster: + """ + Update the name of an existing virtual GPU cluster. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + name: Cluster name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._patch( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}", + body=maybe_transform({"name": name}, gpu_virtual_cluster_update_params.GPUVirtualClusterUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUVirtualCluster, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | Omit = omit, + offset: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncOffsetPage[GPUVirtualCluster]: + """ + List all virtual GPU clusters in the specified project and region. + + Args: + project_id: Project ID + + region_id: Region ID + + limit: Limit of items on a single page + + offset: Offset in results list + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get_api_list( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters", + page=SyncOffsetPage[GPUVirtualCluster], + 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, + }, + gpu_virtual_cluster_list_params.GPUVirtualClusterListParams, + ), + ), + model=GPUVirtualCluster, + ) + + def delete( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + all_floating_ips: bool | Omit = omit, + all_reserved_fixed_ips: bool | Omit = omit, + all_volumes: bool | Omit = omit, + floating_ip_ids: SequenceNotStr[str] | Omit = omit, + reserved_fixed_ip_ids: SequenceNotStr[str] | Omit = omit, + volume_ids: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete a virtual GPU cluster and all its associated resources. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + all_floating_ips: Flag indicating whether the floating ips associated with server / cluster are + deleted + + all_reserved_fixed_ips: Flag indicating whether the reserved fixed ips associated with server / cluster + are deleted + + all_volumes: Flag indicating whether all attached volumes are deleted + + floating_ip_ids: Optional list of floating ips to be deleted + + reserved_fixed_ip_ids: Optional list of reserved fixed ips to be deleted + + volume_ids: Optional list of volumes to be deleted + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._delete( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "all_floating_ips": all_floating_ips, + "all_reserved_fixed_ips": all_reserved_fixed_ips, + "all_volumes": all_volumes, + "floating_ip_ids": floating_ip_ids, + "reserved_fixed_ip_ids": reserved_fixed_ip_ids, + "volume_ids": volume_ids, + }, + gpu_virtual_cluster_delete_params.GPUVirtualClusterDeleteParams, + ), + ), + cast_to=TaskIDList, + ) + + @overload + def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["start"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a virtual GPU cluster. + + Available actions: start, + stop, soft reboot, hard reboot, resize, update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["stop"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a virtual GPU cluster. + + Available actions: start, + stop, soft reboot, hard reboot, resize, update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["soft_reboot"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a virtual GPU cluster. + + Available actions: start, + stop, soft reboot, hard reboot, resize, update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["hard_reboot"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a virtual GPU cluster. + + Available actions: start, + stop, soft reboot, hard reboot, resize, update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["update_tags"], + tags: Optional[TagUpdateMapParam], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a virtual GPU cluster. + + Available actions: start, + stop, soft reboot, hard reboot, resize, update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["resize"], + servers_count: 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, + ) -> TaskIDList: + """Perform a specific action on a virtual GPU cluster. + + Available actions: start, + stop, soft reboot, hard reboot, resize, update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + servers_count: Requested servers count + + 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"], ["action", "tags"], ["action", "servers_count"]) + def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["start"] + | Literal["stop"] + | Literal["soft_reboot"] + | Literal["hard_reboot"] + | Literal["update_tags"] + | Literal["resize"], + tags: Optional[TagUpdateMapParam] | Omit = omit, + servers_count: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> 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 cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._post( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}/action", + body=maybe_transform( + { + "action": action, + "tags": tags, + "servers_count": servers_count, + }, + gpu_virtual_cluster_action_params.GPUVirtualClusterActionParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUVirtualCluster: + """ + Get detailed information about a specific virtual GPU cluster. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUVirtualCluster, + ) + + +class AsyncGPUVirtualClustersResource(AsyncAPIResource): + @cached_property + def servers(self) -> AsyncServersResource: + return AsyncServersResource(self._client) + + @cached_property + def volumes(self) -> AsyncVolumesResource: + return AsyncVolumesResource(self._client) + + @cached_property + def interfaces(self) -> AsyncInterfacesResource: + return AsyncInterfacesResource(self._client) + + @cached_property + def flavors(self) -> AsyncFlavorsResource: + return AsyncFlavorsResource(self._client) + + @cached_property + def images(self) -> AsyncImagesResource: + return AsyncImagesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncGPUVirtualClustersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncGPUVirtualClustersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncGPUVirtualClustersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncGPUVirtualClustersResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor: str, + name: str, + servers_count: int, + servers_settings: gpu_virtual_cluster_create_params.ServersSettings, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Create a new virtual GPU cluster with the specified configuration. + + Args: + project_id: Project ID + + region_id: Region ID + + flavor: Cluster flavor ID + + name: Cluster name + + servers_count: Number of servers in the cluster + + servers_settings: Configuration settings for the servers in the cluster + + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters", + body=await async_maybe_transform( + { + "flavor": flavor, + "name": name, + "servers_count": servers_count, + "servers_settings": servers_settings, + "tags": tags, + }, + gpu_virtual_cluster_create_params.GPUVirtualClusterCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + 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, + ) -> GPUVirtualCluster: + """ + Update the name of an existing virtual GPU cluster. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + name: Cluster name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._patch( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}", + body=await async_maybe_transform( + {"name": name}, gpu_virtual_cluster_update_params.GPUVirtualClusterUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUVirtualCluster, + ) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + limit: int | Omit = omit, + offset: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[GPUVirtualCluster, AsyncOffsetPage[GPUVirtualCluster]]: + """ + List all virtual GPU clusters in the specified project and region. + + Args: + project_id: Project ID + + region_id: Region ID + + limit: Limit of items on a single page + + offset: Offset in results list + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get_api_list( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters", + page=AsyncOffsetPage[GPUVirtualCluster], + 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, + }, + gpu_virtual_cluster_list_params.GPUVirtualClusterListParams, + ), + ), + model=GPUVirtualCluster, + ) + + async def delete( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + all_floating_ips: bool | Omit = omit, + all_reserved_fixed_ips: bool | Omit = omit, + all_volumes: bool | Omit = omit, + floating_ip_ids: SequenceNotStr[str] | Omit = omit, + reserved_fixed_ip_ids: SequenceNotStr[str] | Omit = omit, + volume_ids: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete a virtual GPU cluster and all its associated resources. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + all_floating_ips: Flag indicating whether the floating ips associated with server / cluster are + deleted + + all_reserved_fixed_ips: Flag indicating whether the reserved fixed ips associated with server / cluster + are deleted + + all_volumes: Flag indicating whether all attached volumes are deleted + + floating_ip_ids: Optional list of floating ips to be deleted + + reserved_fixed_ip_ids: Optional list of reserved fixed ips to be deleted + + volume_ids: Optional list of volumes to be deleted + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._delete( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "all_floating_ips": all_floating_ips, + "all_reserved_fixed_ips": all_reserved_fixed_ips, + "all_volumes": all_volumes, + "floating_ip_ids": floating_ip_ids, + "reserved_fixed_ip_ids": reserved_fixed_ip_ids, + "volume_ids": volume_ids, + }, + gpu_virtual_cluster_delete_params.GPUVirtualClusterDeleteParams, + ), + ), + cast_to=TaskIDList, + ) + + @overload + async def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["start"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a virtual GPU cluster. + + Available actions: start, + stop, soft reboot, hard reboot, resize, update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["stop"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a virtual GPU cluster. + + Available actions: start, + stop, soft reboot, hard reboot, resize, update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["soft_reboot"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a virtual GPU cluster. + + Available actions: start, + stop, soft reboot, hard reboot, resize, update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["hard_reboot"], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a virtual GPU cluster. + + Available actions: start, + stop, soft reboot, hard reboot, resize, update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["update_tags"], + tags: Optional[TagUpdateMapParam], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a virtual GPU cluster. + + Available actions: start, + stop, soft reboot, hard reboot, resize, update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["resize"], + servers_count: 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, + ) -> TaskIDList: + """Perform a specific action on a virtual GPU cluster. + + Available actions: start, + stop, soft reboot, hard reboot, resize, update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + servers_count: Requested servers count + + 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"], ["action", "tags"], ["action", "servers_count"]) + async def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["start"] + | Literal["stop"] + | Literal["soft_reboot"] + | Literal["hard_reboot"] + | Literal["update_tags"] + | Literal["resize"], + tags: Optional[TagUpdateMapParam] | Omit = omit, + servers_count: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> 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 cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._post( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}/action", + body=await async_maybe_transform( + { + "action": action, + "tags": tags, + "servers_count": servers_count, + }, + gpu_virtual_cluster_action_params.GPUVirtualClusterActionParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUVirtualCluster: + """ + Get detailed information about a specific virtual GPU cluster. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUVirtualCluster, + ) + + +class GPUVirtualClustersResourceWithRawResponse: + def __init__(self, gpu_virtual_clusters: GPUVirtualClustersResource) -> None: + self._gpu_virtual_clusters = gpu_virtual_clusters + + self.create = to_raw_response_wrapper( + gpu_virtual_clusters.create, + ) + self.update = to_raw_response_wrapper( + gpu_virtual_clusters.update, + ) + self.list = to_raw_response_wrapper( + gpu_virtual_clusters.list, + ) + self.delete = to_raw_response_wrapper( + gpu_virtual_clusters.delete, + ) + self.action = to_raw_response_wrapper( + gpu_virtual_clusters.action, + ) + self.get = to_raw_response_wrapper( + gpu_virtual_clusters.get, + ) + + @cached_property + def servers(self) -> ServersResourceWithRawResponse: + return ServersResourceWithRawResponse(self._gpu_virtual_clusters.servers) + + @cached_property + def volumes(self) -> VolumesResourceWithRawResponse: + return VolumesResourceWithRawResponse(self._gpu_virtual_clusters.volumes) + + @cached_property + def interfaces(self) -> InterfacesResourceWithRawResponse: + return InterfacesResourceWithRawResponse(self._gpu_virtual_clusters.interfaces) + + @cached_property + def flavors(self) -> FlavorsResourceWithRawResponse: + return FlavorsResourceWithRawResponse(self._gpu_virtual_clusters.flavors) + + @cached_property + def images(self) -> ImagesResourceWithRawResponse: + return ImagesResourceWithRawResponse(self._gpu_virtual_clusters.images) + + +class AsyncGPUVirtualClustersResourceWithRawResponse: + def __init__(self, gpu_virtual_clusters: AsyncGPUVirtualClustersResource) -> None: + self._gpu_virtual_clusters = gpu_virtual_clusters + + self.create = async_to_raw_response_wrapper( + gpu_virtual_clusters.create, + ) + self.update = async_to_raw_response_wrapper( + gpu_virtual_clusters.update, + ) + self.list = async_to_raw_response_wrapper( + gpu_virtual_clusters.list, + ) + self.delete = async_to_raw_response_wrapper( + gpu_virtual_clusters.delete, + ) + self.action = async_to_raw_response_wrapper( + gpu_virtual_clusters.action, + ) + self.get = async_to_raw_response_wrapper( + gpu_virtual_clusters.get, + ) + + @cached_property + def servers(self) -> AsyncServersResourceWithRawResponse: + return AsyncServersResourceWithRawResponse(self._gpu_virtual_clusters.servers) + + @cached_property + def volumes(self) -> AsyncVolumesResourceWithRawResponse: + return AsyncVolumesResourceWithRawResponse(self._gpu_virtual_clusters.volumes) + + @cached_property + def interfaces(self) -> AsyncInterfacesResourceWithRawResponse: + return AsyncInterfacesResourceWithRawResponse(self._gpu_virtual_clusters.interfaces) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithRawResponse: + return AsyncFlavorsResourceWithRawResponse(self._gpu_virtual_clusters.flavors) + + @cached_property + def images(self) -> AsyncImagesResourceWithRawResponse: + return AsyncImagesResourceWithRawResponse(self._gpu_virtual_clusters.images) + + +class GPUVirtualClustersResourceWithStreamingResponse: + def __init__(self, gpu_virtual_clusters: GPUVirtualClustersResource) -> None: + self._gpu_virtual_clusters = gpu_virtual_clusters + + self.create = to_streamed_response_wrapper( + gpu_virtual_clusters.create, + ) + self.update = to_streamed_response_wrapper( + gpu_virtual_clusters.update, + ) + self.list = to_streamed_response_wrapper( + gpu_virtual_clusters.list, + ) + self.delete = to_streamed_response_wrapper( + gpu_virtual_clusters.delete, + ) + self.action = to_streamed_response_wrapper( + gpu_virtual_clusters.action, + ) + self.get = to_streamed_response_wrapper( + gpu_virtual_clusters.get, + ) + + @cached_property + def servers(self) -> ServersResourceWithStreamingResponse: + return ServersResourceWithStreamingResponse(self._gpu_virtual_clusters.servers) + + @cached_property + def volumes(self) -> VolumesResourceWithStreamingResponse: + return VolumesResourceWithStreamingResponse(self._gpu_virtual_clusters.volumes) + + @cached_property + def interfaces(self) -> InterfacesResourceWithStreamingResponse: + return InterfacesResourceWithStreamingResponse(self._gpu_virtual_clusters.interfaces) + + @cached_property + def flavors(self) -> FlavorsResourceWithStreamingResponse: + return FlavorsResourceWithStreamingResponse(self._gpu_virtual_clusters.flavors) + + @cached_property + def images(self) -> ImagesResourceWithStreamingResponse: + return ImagesResourceWithStreamingResponse(self._gpu_virtual_clusters.images) + + +class AsyncGPUVirtualClustersResourceWithStreamingResponse: + def __init__(self, gpu_virtual_clusters: AsyncGPUVirtualClustersResource) -> None: + self._gpu_virtual_clusters = gpu_virtual_clusters + + self.create = async_to_streamed_response_wrapper( + gpu_virtual_clusters.create, + ) + self.update = async_to_streamed_response_wrapper( + gpu_virtual_clusters.update, + ) + self.list = async_to_streamed_response_wrapper( + gpu_virtual_clusters.list, + ) + self.delete = async_to_streamed_response_wrapper( + gpu_virtual_clusters.delete, + ) + self.action = async_to_streamed_response_wrapper( + gpu_virtual_clusters.action, + ) + self.get = async_to_streamed_response_wrapper( + gpu_virtual_clusters.get, + ) + + @cached_property + def servers(self) -> AsyncServersResourceWithStreamingResponse: + return AsyncServersResourceWithStreamingResponse(self._gpu_virtual_clusters.servers) + + @cached_property + def volumes(self) -> AsyncVolumesResourceWithStreamingResponse: + return AsyncVolumesResourceWithStreamingResponse(self._gpu_virtual_clusters.volumes) + + @cached_property + def interfaces(self) -> AsyncInterfacesResourceWithStreamingResponse: + return AsyncInterfacesResourceWithStreamingResponse(self._gpu_virtual_clusters.interfaces) + + @cached_property + def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse: + return AsyncFlavorsResourceWithStreamingResponse(self._gpu_virtual_clusters.flavors) + + @cached_property + def images(self) -> AsyncImagesResourceWithStreamingResponse: + return AsyncImagesResourceWithStreamingResponse(self._gpu_virtual_clusters.images) diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/images.py b/src/gcore/resources/cloud/gpu_virtual_clusters/images.py new file mode 100644 index 00000000..47315e2a --- /dev/null +++ b/src/gcore/resources/cloud/gpu_virtual_clusters/images.py @@ -0,0 +1,580 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import 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 ...._base_client import make_request_options +from ....types.cloud.gpu_image import GPUImage +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.gpu_image_list import GPUImageList +from ....types.cloud.gpu_virtual_clusters import image_upload_params + +__all__ = ["ImagesResource", "AsyncImagesResource"] + + +class ImagesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ImagesResourceWithRawResponse: + """ + 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 ImagesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ImagesResourceWithStreamingResponse: + """ + 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 ImagesResourceWithStreamingResponse(self) + + def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUImageList: + """ + List virtual GPU images + + Args: + project_id: Project ID + + region_id: Region ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUImageList, + ) + + def delete( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete virtual GPU image + + Args: + project_id: Project ID + + region_id: Region ID + + image_id: Image ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + 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 image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return self._delete( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images/{image_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUImage: + """ + Get virtual GPU image + + Args: + project_id: Project ID + + region_id: Region ID + + image_id: Image ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + 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 image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images/{image_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUImage, + ) + + def upload( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + url: str, + architecture: Optional[Literal["aarch64", "x86_64"]] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Optional[Literal["linux", "windows"]] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Upload new virtual GPU image + + Args: + project_id: Project ID + + region_id: Region ID + + name: Image name + + url: Image URL + + architecture: Image architecture type: aarch64, `x86_64` + + cow_format: When True, image cannot be deleted unless all volumes, created from it, are + deleted. + + hw_firmware_type: Specifies the type of firmware with which to boot the guest. + + os_distro: OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc. + + os_type: The operating system installed on the image. Linux by default + + os_version: OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian + + ssh_key: Permission to use a ssh key in instances + + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images", + body=maybe_transform( + { + "name": name, + "url": url, + "architecture": architecture, + "cow_format": cow_format, + "hw_firmware_type": hw_firmware_type, + "os_distro": os_distro, + "os_type": os_type, + "os_version": os_version, + "ssh_key": ssh_key, + "tags": tags, + }, + image_upload_params.ImageUploadParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class AsyncImagesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncImagesResourceWithRawResponse: + """ + 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 AsyncImagesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncImagesResourceWithStreamingResponse: + """ + 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 AsyncImagesResourceWithStreamingResponse(self) + + async def list( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUImageList: + """ + List virtual GPU images + + Args: + project_id: Project ID + + region_id: Region ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUImageList, + ) + + async def delete( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete virtual GPU image + + Args: + project_id: Project ID + + region_id: Region ID + + image_id: Image ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + 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 image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return await self._delete( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images/{image_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + image_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUImage: + """ + Get virtual GPU image + + Args: + project_id: Project ID + + region_id: Region ID + + image_id: Image ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + 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 image_id: + raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") + return await self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images/{image_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUImage, + ) + + async def upload( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + url: str, + architecture: Optional[Literal["aarch64", "x86_64"]] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Optional[Literal["linux", "windows"]] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Upload new virtual GPU image + + Args: + project_id: Project ID + + region_id: Region ID + + name: Image name + + url: Image URL + + architecture: Image architecture type: aarch64, `x86_64` + + cow_format: When True, image cannot be deleted unless all volumes, created from it, are + deleted. + + hw_firmware_type: Specifies the type of firmware with which to boot the guest. + + os_distro: OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc. + + os_type: The operating system installed on the image. Linux by default + + os_version: OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian + + ssh_key: Permission to use a ssh key in instances + + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Some tags are read-only and cannot be + modified by the user. Tags are also integrated with cost reports, allowing cost + data to be filtered based on tag keys or values. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images", + body=await async_maybe_transform( + { + "name": name, + "url": url, + "architecture": architecture, + "cow_format": cow_format, + "hw_firmware_type": hw_firmware_type, + "os_distro": os_distro, + "os_type": os_type, + "os_version": os_version, + "ssh_key": ssh_key, + "tags": tags, + }, + image_upload_params.ImageUploadParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + +class ImagesResourceWithRawResponse: + def __init__(self, images: ImagesResource) -> None: + self._images = images + + self.list = to_raw_response_wrapper( + images.list, + ) + self.delete = to_raw_response_wrapper( + images.delete, + ) + self.get = to_raw_response_wrapper( + images.get, + ) + self.upload = to_raw_response_wrapper( + images.upload, + ) + + +class AsyncImagesResourceWithRawResponse: + def __init__(self, images: AsyncImagesResource) -> None: + self._images = images + + self.list = async_to_raw_response_wrapper( + images.list, + ) + self.delete = async_to_raw_response_wrapper( + images.delete, + ) + self.get = async_to_raw_response_wrapper( + images.get, + ) + self.upload = async_to_raw_response_wrapper( + images.upload, + ) + + +class ImagesResourceWithStreamingResponse: + def __init__(self, images: ImagesResource) -> None: + self._images = images + + self.list = to_streamed_response_wrapper( + images.list, + ) + self.delete = to_streamed_response_wrapper( + images.delete, + ) + self.get = to_streamed_response_wrapper( + images.get, + ) + self.upload = to_streamed_response_wrapper( + images.upload, + ) + + +class AsyncImagesResourceWithStreamingResponse: + def __init__(self, images: AsyncImagesResource) -> None: + self._images = images + + self.list = async_to_streamed_response_wrapper( + images.list, + ) + self.delete = async_to_streamed_response_wrapper( + images.delete, + ) + self.get = async_to_streamed_response_wrapper( + images.get, + ) + self.upload = async_to_streamed_response_wrapper( + images.upload, + ) diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_virtual_clusters/interfaces.py new file mode 100644 index 00000000..ca97cda6 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_virtual_clusters/interfaces.py @@ -0,0 +1,187 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.gpu_virtual_clusters.gpu_virtual_interface_list import GPUVirtualInterfaceList + +__all__ = ["InterfacesResource", "AsyncInterfacesResource"] + + +class InterfacesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InterfacesResourceWithRawResponse: + """ + 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 InterfacesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InterfacesResourceWithStreamingResponse: + """ + 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 InterfacesResourceWithStreamingResponse(self) + + def list( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUVirtualInterfaceList: + """ + List all network interfaces for servers in a virtual GPU cluster. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}/interfaces", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUVirtualInterfaceList, + ) + + +class AsyncInterfacesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInterfacesResourceWithRawResponse: + """ + 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 AsyncInterfacesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInterfacesResourceWithStreamingResponse: + """ + 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 AsyncInterfacesResourceWithStreamingResponse(self) + + async def list( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUVirtualInterfaceList: + """ + List all network interfaces for servers in a virtual GPU cluster. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}/interfaces", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUVirtualInterfaceList, + ) + + +class InterfacesResourceWithRawResponse: + def __init__(self, interfaces: InterfacesResource) -> None: + self._interfaces = interfaces + + self.list = to_raw_response_wrapper( + interfaces.list, + ) + + +class AsyncInterfacesResourceWithRawResponse: + def __init__(self, interfaces: AsyncInterfacesResource) -> None: + self._interfaces = interfaces + + self.list = async_to_raw_response_wrapper( + interfaces.list, + ) + + +class InterfacesResourceWithStreamingResponse: + def __init__(self, interfaces: InterfacesResource) -> None: + self._interfaces = interfaces + + self.list = to_streamed_response_wrapper( + interfaces.list, + ) + + +class AsyncInterfacesResourceWithStreamingResponse: + def __init__(self, interfaces: AsyncInterfacesResource) -> None: + self._interfaces = interfaces + + self.list = async_to_streamed_response_wrapper( + interfaces.list, + ) diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/servers.py b/src/gcore/resources/cloud/gpu_virtual_clusters/servers.py new file mode 100644 index 00000000..a0176570 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_virtual_clusters/servers.py @@ -0,0 +1,506 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.gpu_virtual_clusters import server_list_params, server_delete_params +from ....types.cloud.gpu_virtual_clusters.gpu_virtual_cluster_server_list import GPUVirtualClusterServerList + +__all__ = ["ServersResource", "AsyncServersResource"] + + +class ServersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ServersResourceWithRawResponse: + """ + 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 ServersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ServersResourceWithStreamingResponse: + """ + 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 ServersResourceWithStreamingResponse(self) + + def list( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + changed_before: Union[str, datetime] | Omit = omit, + changed_since: Union[str, datetime] | Omit = omit, + ip_address: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] | Omit = omit, + status: Literal[ + "ACTIVE", + "BUILD", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PAUSED", + "REBOOT", + "REBUILD", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "VERIFY_RESIZE", + ] + | Omit = omit, + uuids: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUVirtualClusterServerList: + """ + List all servers in a virtual GPU cluster. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + changed_before: Filters the results to include only servers whose last change timestamp is less + than the specified datetime. Format: ISO 8601. + + changed_since: Filters the results to include only servers whose last change timestamp is + greater than or equal to the specified datetime. Format: ISO 8601. + + ip_address: Filter servers by ip address. + + limit: Limit of items on a single page + + name: Filter servers by name. You can provide a full or partial name, servers with + matching names will be returned. For example, entering 'test' will return all + servers that contain 'test' in their name. + + offset: Offset in results list + + order_by: Order field + + status: Filters servers by status. + + uuids: Filter servers by uuid. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}/servers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "changed_before": changed_before, + "changed_since": changed_since, + "ip_address": ip_address, + "limit": limit, + "name": name, + "offset": offset, + "order_by": order_by, + "status": status, + "uuids": uuids, + }, + server_list_params.ServerListParams, + ), + ), + cast_to=GPUVirtualClusterServerList, + ) + + def delete( + self, + server_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_id: str, + all_floating_ips: bool | Omit = omit, + all_reserved_fixed_ips: bool | Omit = omit, + all_volumes: bool | Omit = omit, + floating_ip_ids: SequenceNotStr[str] | Omit = omit, + reserved_fixed_ip_ids: SequenceNotStr[str] | Omit = omit, + volume_ids: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete a server from a virtual GPU cluster and its associated resources. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + server_id: Server unique identifier + + all_floating_ips: Flag indicating whether the floating ips associated with server / cluster are + deleted + + all_reserved_fixed_ips: Flag indicating whether the reserved fixed ips associated with server / cluster + are deleted + + all_volumes: Flag indicating whether all attached volumes are deleted + + floating_ip_ids: Optional list of floating ips to be deleted + + reserved_fixed_ip_ids: Optional list of reserved fixed ips to be deleted + + volume_ids: Optional list of volumes to be deleted + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + if not server_id: + raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") + return self._delete( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}/servers/{server_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "all_floating_ips": all_floating_ips, + "all_reserved_fixed_ips": all_reserved_fixed_ips, + "all_volumes": all_volumes, + "floating_ip_ids": floating_ip_ids, + "reserved_fixed_ip_ids": reserved_fixed_ip_ids, + "volume_ids": volume_ids, + }, + server_delete_params.ServerDeleteParams, + ), + ), + cast_to=TaskIDList, + ) + + +class AsyncServersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncServersResourceWithRawResponse: + """ + 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 AsyncServersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncServersResourceWithStreamingResponse: + """ + 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 AsyncServersResourceWithStreamingResponse(self) + + async def list( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + changed_before: Union[str, datetime] | Omit = omit, + changed_since: Union[str, datetime] | Omit = omit, + ip_address: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] | Omit = omit, + status: Literal[ + "ACTIVE", + "BUILD", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PAUSED", + "REBOOT", + "REBUILD", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "VERIFY_RESIZE", + ] + | Omit = omit, + uuids: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUVirtualClusterServerList: + """ + List all servers in a virtual GPU cluster. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + changed_before: Filters the results to include only servers whose last change timestamp is less + than the specified datetime. Format: ISO 8601. + + changed_since: Filters the results to include only servers whose last change timestamp is + greater than or equal to the specified datetime. Format: ISO 8601. + + ip_address: Filter servers by ip address. + + limit: Limit of items on a single page + + name: Filter servers by name. You can provide a full or partial name, servers with + matching names will be returned. For example, entering 'test' will return all + servers that contain 'test' in their name. + + offset: Offset in results list + + order_by: Order field + + status: Filters servers by status. + + uuids: Filter servers by uuid. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}/servers", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "changed_before": changed_before, + "changed_since": changed_since, + "ip_address": ip_address, + "limit": limit, + "name": name, + "offset": offset, + "order_by": order_by, + "status": status, + "uuids": uuids, + }, + server_list_params.ServerListParams, + ), + ), + cast_to=GPUVirtualClusterServerList, + ) + + async def delete( + self, + server_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + cluster_id: str, + all_floating_ips: bool | Omit = omit, + all_reserved_fixed_ips: bool | Omit = omit, + all_volumes: bool | Omit = omit, + floating_ip_ids: SequenceNotStr[str] | Omit = omit, + reserved_fixed_ip_ids: SequenceNotStr[str] | Omit = omit, + volume_ids: SequenceNotStr[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete a server from a virtual GPU cluster and its associated resources. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + server_id: Server unique identifier + + all_floating_ips: Flag indicating whether the floating ips associated with server / cluster are + deleted + + all_reserved_fixed_ips: Flag indicating whether the reserved fixed ips associated with server / cluster + are deleted + + all_volumes: Flag indicating whether all attached volumes are deleted + + floating_ip_ids: Optional list of floating ips to be deleted + + reserved_fixed_ip_ids: Optional list of reserved fixed ips to be deleted + + volume_ids: Optional list of volumes to be deleted + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + if not server_id: + raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") + return await self._delete( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}/servers/{server_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "all_floating_ips": all_floating_ips, + "all_reserved_fixed_ips": all_reserved_fixed_ips, + "all_volumes": all_volumes, + "floating_ip_ids": floating_ip_ids, + "reserved_fixed_ip_ids": reserved_fixed_ip_ids, + "volume_ids": volume_ids, + }, + server_delete_params.ServerDeleteParams, + ), + ), + cast_to=TaskIDList, + ) + + +class ServersResourceWithRawResponse: + def __init__(self, servers: ServersResource) -> None: + self._servers = servers + + self.list = to_raw_response_wrapper( + servers.list, + ) + self.delete = to_raw_response_wrapper( + servers.delete, + ) + + +class AsyncServersResourceWithRawResponse: + def __init__(self, servers: AsyncServersResource) -> None: + self._servers = servers + + self.list = async_to_raw_response_wrapper( + servers.list, + ) + self.delete = async_to_raw_response_wrapper( + servers.delete, + ) + + +class ServersResourceWithStreamingResponse: + def __init__(self, servers: ServersResource) -> None: + self._servers = servers + + self.list = to_streamed_response_wrapper( + servers.list, + ) + self.delete = to_streamed_response_wrapper( + servers.delete, + ) + + +class AsyncServersResourceWithStreamingResponse: + def __init__(self, servers: AsyncServersResource) -> None: + self._servers = servers + + self.list = async_to_streamed_response_wrapper( + servers.list, + ) + self.delete = async_to_streamed_response_wrapper( + servers.delete, + ) diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/volumes.py b/src/gcore/resources/cloud/gpu_virtual_clusters/volumes.py new file mode 100644 index 00000000..390e7cf9 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_virtual_clusters/volumes.py @@ -0,0 +1,187 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cloud.gpu_virtual_clusters.gpu_virtual_cluster_volume_list import GPUVirtualClusterVolumeList + +__all__ = ["VolumesResource", "AsyncVolumesResource"] + + +class VolumesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> VolumesResourceWithRawResponse: + """ + 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 VolumesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VolumesResourceWithStreamingResponse: + """ + 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 VolumesResourceWithStreamingResponse(self) + + def list( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUVirtualClusterVolumeList: + """ + List all volumes attached to servers in a virtual GPU cluster. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}/volumes", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUVirtualClusterVolumeList, + ) + + +class AsyncVolumesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncVolumesResourceWithRawResponse: + """ + 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 AsyncVolumesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVolumesResourceWithStreamingResponse: + """ + 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 AsyncVolumesResourceWithStreamingResponse(self) + + async def list( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> GPUVirtualClusterVolumeList: + """ + List all volumes attached to servers in a virtual GPU cluster. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._get( + f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}/volumes", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=GPUVirtualClusterVolumeList, + ) + + +class VolumesResourceWithRawResponse: + def __init__(self, volumes: VolumesResource) -> None: + self._volumes = volumes + + self.list = to_raw_response_wrapper( + volumes.list, + ) + + +class AsyncVolumesResourceWithRawResponse: + def __init__(self, volumes: AsyncVolumesResource) -> None: + self._volumes = volumes + + self.list = async_to_raw_response_wrapper( + volumes.list, + ) + + +class VolumesResourceWithStreamingResponse: + def __init__(self, volumes: VolumesResource) -> None: + self._volumes = volumes + + self.list = to_streamed_response_wrapper( + volumes.list, + ) + + +class AsyncVolumesResourceWithStreamingResponse: + def __init__(self, volumes: AsyncVolumesResource) -> None: + self._volumes = volumes + + self.list = async_to_streamed_response_wrapper( + volumes.list, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 80b12b29..e97ac01a 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -64,6 +64,7 @@ from .billing_reservation import BillingReservation as BillingReservation from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .fixed_address_short import FixedAddressShort as FixedAddressShort +from .gpu_virtual_cluster import GPUVirtualCluster as GPUVirtualCluster from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .k8s_cluster_version import K8sClusterVersion as K8sClusterVersion from .network_list_params import NetworkListParams as NetworkListParams @@ -160,11 +161,16 @@ from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus from .billing_reservation_list_params import BillingReservationListParams as BillingReservationListParams from .cost_report_get_detailed_params import CostReportGetDetailedParams as CostReportGetDetailedParams +from .gpu_virtual_cluster_list_params import GPUVirtualClusterListParams as GPUVirtualClusterListParams from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams from .reserved_fixed_ip_update_params import ReservedFixedIPUpdateParams as ReservedFixedIPUpdateParams from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams from .cost_report_get_aggregated_params import CostReportGetAggregatedParams as CostReportGetAggregatedParams from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams +from .gpu_virtual_cluster_action_params import GPUVirtualClusterActionParams as GPUVirtualClusterActionParams +from .gpu_virtual_cluster_create_params import GPUVirtualClusterCreateParams as GPUVirtualClusterCreateParams +from .gpu_virtual_cluster_delete_params import GPUVirtualClusterDeleteParams as GPUVirtualClusterDeleteParams +from .gpu_virtual_cluster_update_params import GPUVirtualClusterUpdateParams as GPUVirtualClusterUpdateParams from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams diff --git a/src/gcore/types/cloud/gpu_virtual_cluster.py b/src/gcore/types/cloud/gpu_virtual_cluster.py new file mode 100644 index 00000000..28d58c1e --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_cluster.py @@ -0,0 +1,189 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, Annotated, TypeAlias + +from .tag import Tag +from ..._utils import PropertyInfo +from ..._models import BaseModel + +__all__ = [ + "GPUVirtualCluster", + "ServersSettings", + "ServersSettingsFileShare", + "ServersSettingsInterface", + "ServersSettingsInterfaceExternalInterfaceOutputSerializer", + "ServersSettingsInterfaceSubnetInterfaceOutputSerializer", + "ServersSettingsInterfaceSubnetInterfaceOutputSerializerFloatingIP", + "ServersSettingsInterfaceAnySubnetInterfaceOutputSerializer", + "ServersSettingsInterfaceAnySubnetInterfaceOutputSerializerFloatingIP", + "ServersSettingsSecurityGroup", + "ServersSettingsVolume", +] + + +class ServersSettingsFileShare(BaseModel): + id: str + """Unique identifier of the file share in UUID format.""" + + mount_path: str + """Absolute mount path inside the system where the file share will be mounted.""" + + +class ServersSettingsInterfaceExternalInterfaceOutputSerializer(BaseModel): + ip_family: Literal["dual", "ipv4", "ipv6"] + """Which subnets should be selected: IPv4, IPv6, or use dual stack.""" + + name: Optional[str] = None + """Interface name""" + + type: Literal["external"] + + +class ServersSettingsInterfaceSubnetInterfaceOutputSerializerFloatingIP(BaseModel): + source: Literal["new"] + + +class ServersSettingsInterfaceSubnetInterfaceOutputSerializer(BaseModel): + floating_ip: Optional[ServersSettingsInterfaceSubnetInterfaceOutputSerializerFloatingIP] = None + """Floating IP config for this subnet attachment""" + + name: Optional[str] = None + """Interface name""" + + network_id: str + """Network ID the subnet belongs to. Port will be plugged in this network""" + + subnet_id: str + """Port is assigned an IP address from this subnet""" + + type: Literal["subnet"] + + +class ServersSettingsInterfaceAnySubnetInterfaceOutputSerializerFloatingIP(BaseModel): + source: Literal["new"] + + +class ServersSettingsInterfaceAnySubnetInterfaceOutputSerializer(BaseModel): + floating_ip: Optional[ServersSettingsInterfaceAnySubnetInterfaceOutputSerializerFloatingIP] = None + """Floating IP config for this subnet attachment""" + + ip_address: Optional[str] = None + """Fixed IP address""" + + ip_family: Literal["dual", "ipv4", "ipv6"] + """Which subnets should be selected: IPv4, IPv6, or use dual stack""" + + name: Optional[str] = None + """Interface name""" + + network_id: str + """Network ID the subnet belongs to. Port will be plugged in this network""" + + type: Literal["any_subnet"] + + +ServersSettingsInterface: TypeAlias = Annotated[ + Union[ + ServersSettingsInterfaceExternalInterfaceOutputSerializer, + ServersSettingsInterfaceSubnetInterfaceOutputSerializer, + ServersSettingsInterfaceAnySubnetInterfaceOutputSerializer, + ], + PropertyInfo(discriminator="type"), +] + + +class ServersSettingsSecurityGroup(BaseModel): + id: str + """Security group ID""" + + name: str + """Security group name""" + + +class ServersSettingsVolume(BaseModel): + boot_index: Optional[int] = None + """Boot index of the volume""" + + delete_on_termination: bool + """Flag indicating whether the volume is deleted on instance termination""" + + image_id: Optional[str] = None + """Image ID for the volume""" + + name: str + """Volume name""" + + size: int + """Volume size in GiB""" + + tags: List[Tag] + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. + """ + + type: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] + """Volume type""" + + +class ServersSettings(BaseModel): + file_shares: List[ServersSettingsFileShare] + """List of file shares mounted across the cluster.""" + + interfaces: List[ServersSettingsInterface] + + security_groups: List[ServersSettingsSecurityGroup] + """Security groups""" + + ssh_key_name: Optional[str] = None + """SSH key name""" + + user_data: Optional[str] = None + """Optional custom user data""" + + volumes: List[ServersSettingsVolume] + """List of volumes""" + + +class GPUVirtualCluster(BaseModel): + id: str + """Cluster unique identifier""" + + created_at: datetime + """Cluster creation date time""" + + flavor: str + """Cluster flavor name""" + + name: str + """Cluster name""" + + servers_count: int + """Cluster servers count""" + + servers_ids: List[str] + """List of cluster nodes""" + + servers_settings: ServersSettings + + status: Literal["active", "deleting", "error", "new", "resizing"] + """Cluster status""" + + tags: List[Tag] + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. + """ + + updated_at: Optional[datetime] = None + """Cluster update date time""" diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_action_params.py b/src/gcore/types/cloud/gpu_virtual_cluster_action_params.py new file mode 100644 index 00000000..0c5f99b8 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_cluster_action_params.py @@ -0,0 +1,122 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .tag_update_map_param import TagUpdateMapParam + +__all__ = [ + "GPUVirtualClusterActionParams", + "StartVirtualGPUClusterSerializer", + "StopVirtualGPUClusterSerializer", + "SoftRebootVirtualGPUClusterSerializer", + "HardRebootVirtualGPUClusterSerializer", + "UpdateTagsGPUClusterSerializer", + "ResizeVirtualGPUClusterSerializer", +] + + +class StartVirtualGPUClusterSerializer(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["start"]] + """Action name""" + + +class StopVirtualGPUClusterSerializer(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["stop"]] + """Action name""" + + +class SoftRebootVirtualGPUClusterSerializer(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["soft_reboot"]] + """Action name""" + + +class HardRebootVirtualGPUClusterSerializer(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["hard_reboot"]] + """Action name""" + + +class UpdateTagsGPUClusterSerializer(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["update_tags"]] + """Action name""" + + tags: Required[Optional[TagUpdateMapParam]] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ + + +class ResizeVirtualGPUClusterSerializer(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["resize"]] + """Action name""" + + servers_count: Required[int] + """Requested servers count""" + + +GPUVirtualClusterActionParams: TypeAlias = Union[ + StartVirtualGPUClusterSerializer, + StopVirtualGPUClusterSerializer, + SoftRebootVirtualGPUClusterSerializer, + HardRebootVirtualGPUClusterSerializer, + UpdateTagsGPUClusterSerializer, + ResizeVirtualGPUClusterSerializer, +] diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py b/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py new file mode 100644 index 00000000..acf172b3 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py @@ -0,0 +1,213 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = [ + "GPUVirtualClusterCreateParams", + "ServersSettings", + "ServersSettingsInterface", + "ServersSettingsInterfaceExternalInterfaceInputSerializer", + "ServersSettingsInterfaceSubnetInterfaceInputSerializer", + "ServersSettingsInterfaceSubnetInterfaceInputSerializerFloatingIP", + "ServersSettingsInterfaceAnySubnetInterfaceInputSerializer", + "ServersSettingsInterfaceAnySubnetInterfaceInputSerializerFloatingIP", + "ServersSettingsVolume", + "ServersSettingsVolumeNewVolumeInputSerializer", + "ServersSettingsVolumeImageVolumeInputSerializer", + "ServersSettingsCredentials", + "ServersSettingsFileShare", + "ServersSettingsSecurityGroup", +] + + +class GPUVirtualClusterCreateParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + flavor: Required[str] + """Cluster flavor ID""" + + name: Required[str] + """Cluster name""" + + servers_count: Required[int] + """Number of servers in the cluster""" + + servers_settings: Required[ServersSettings] + """Configuration settings for the servers in the cluster""" + + tags: Dict[str, str] + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. 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. + """ + + +class ServersSettingsInterfaceExternalInterfaceInputSerializer(TypedDict, total=False): + type: Required[Literal["external"]] + + ip_family: Literal["dual", "ipv4", "ipv6"] + """Which subnets should be selected: IPv4, IPv6, or use dual stack.""" + + name: str + """Interface name""" + + +class ServersSettingsInterfaceSubnetInterfaceInputSerializerFloatingIP(TypedDict, total=False): + source: Required[Literal["new"]] + + +class ServersSettingsInterfaceSubnetInterfaceInputSerializer(TypedDict, total=False): + network_id: Required[str] + """Network ID the subnet belongs to. Port will be plugged in this network""" + + subnet_id: Required[str] + """Port is assigned an IP address from this subnet""" + + type: Required[Literal["subnet"]] + + floating_ip: ServersSettingsInterfaceSubnetInterfaceInputSerializerFloatingIP + """Floating IP config for this subnet attachment""" + + name: str + """Interface name""" + + +class ServersSettingsInterfaceAnySubnetInterfaceInputSerializerFloatingIP(TypedDict, total=False): + source: Required[Literal["new"]] + + +class ServersSettingsInterfaceAnySubnetInterfaceInputSerializer(TypedDict, total=False): + network_id: Required[str] + """Network ID the subnet belongs to. Port will be plugged in this network""" + + type: Required[Literal["any_subnet"]] + + floating_ip: ServersSettingsInterfaceAnySubnetInterfaceInputSerializerFloatingIP + """Floating IP config for this subnet attachment""" + + ip_family: Literal["dual", "ipv4", "ipv6"] + """Which subnets should be selected: IPv4, IPv6, or use dual stack""" + + name: str + """Interface name""" + + +ServersSettingsInterface: TypeAlias = Union[ + ServersSettingsInterfaceExternalInterfaceInputSerializer, + ServersSettingsInterfaceSubnetInterfaceInputSerializer, + ServersSettingsInterfaceAnySubnetInterfaceInputSerializer, +] + + +class ServersSettingsVolumeNewVolumeInputSerializer(TypedDict, total=False): + boot_index: Required[int] + """Boot index of the volume""" + + name: Required[str] + """Volume name""" + + size: Required[int] + """Volume size in GiB""" + + source: Required[Literal["new"]] + + type: Required[Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]] + """Volume type""" + + delete_on_termination: bool + """Flag indicating whether the volume is deleted on instance termination""" + + tags: Dict[str, str] + """Tags associated with the volume""" + + +class ServersSettingsVolumeImageVolumeInputSerializer(TypedDict, total=False): + boot_index: Required[int] + """Boot index of the volume""" + + image_id: Required[str] + """Image ID for the volume""" + + name: Required[str] + """Volume name""" + + size: Required[int] + """Volume size in GiB""" + + source: Required[Literal["image"]] + + type: Required[Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]] + """Volume type""" + + delete_on_termination: bool + """Flag indicating whether the volume is deleted on instance termination""" + + tags: Dict[str, str] + """Tags associated with the volume""" + + +ServersSettingsVolume: TypeAlias = Union[ + ServersSettingsVolumeNewVolumeInputSerializer, ServersSettingsVolumeImageVolumeInputSerializer +] + + +class ServersSettingsCredentials(TypedDict, total=False): + password: str + """Used to set the password for the specified 'username' on Linux instances. + + If 'username' is not provided, the password is applied to the default user of + the image. Mutually exclusive with '`user_data`' - only one can be specified. + """ + + ssh_key_name: str + """ + Specifies the name of the SSH keypair, created via the + [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). + """ + + username: str + """The 'username' and 'password' fields create a new user on the system""" + + +class ServersSettingsFileShare(TypedDict, total=False): + id: Required[str] + """Unique identifier of the file share in UUID format.""" + + mount_path: Required[str] + """Absolute mount path inside the system where the file share will be mounted.""" + + +class ServersSettingsSecurityGroup(TypedDict, total=False): + id: Required[str] + """Resource ID""" + + +class ServersSettings(TypedDict, total=False): + interfaces: Required[Iterable[ServersSettingsInterface]] + """Subnet IPs and floating IPs""" + + volumes: Required[Iterable[ServersSettingsVolume]] + """List of volumes""" + + credentials: ServersSettingsCredentials + """Optional server access credentials""" + + file_shares: Iterable[ServersSettingsFileShare] + """List of file shares to be mounted across the cluster.""" + + security_groups: Iterable[ServersSettingsSecurityGroup] + """List of security groups UUIDs""" + + user_data: str + """Optional custom user data (Base64-encoded)""" diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_delete_params.py b/src/gcore/types/cloud/gpu_virtual_cluster_delete_params.py new file mode 100644 index 00000000..3cd9988b --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_cluster_delete_params.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["GPUVirtualClusterDeleteParams"] + + +class GPUVirtualClusterDeleteParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + all_floating_ips: bool + """ + Flag indicating whether the floating ips associated with server / cluster are + deleted + """ + + all_reserved_fixed_ips: bool + """ + Flag indicating whether the reserved fixed ips associated with server / cluster + are deleted + """ + + all_volumes: bool + """Flag indicating whether all attached volumes are deleted""" + + floating_ip_ids: SequenceNotStr[str] + """Optional list of floating ips to be deleted""" + + reserved_fixed_ip_ids: SequenceNotStr[str] + """Optional list of reserved fixed ips to be deleted""" + + volume_ids: SequenceNotStr[str] + """Optional list of volumes to be deleted""" diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_list_params.py b/src/gcore/types/cloud/gpu_virtual_cluster_list_params.py new file mode 100644 index 00000000..ff0dba49 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_cluster_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 TypedDict + +__all__ = ["GPUVirtualClusterListParams"] + + +class GPUVirtualClusterListParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + limit: int + """Limit of items on a single page""" + + offset: int + """Offset in results list""" diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_update_params.py b/src/gcore/types/cloud/gpu_virtual_cluster_update_params.py new file mode 100644 index 00000000..790bbf88 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_cluster_update_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_extensions import Required, TypedDict + +__all__ = ["GPUVirtualClusterUpdateParams"] + + +class GPUVirtualClusterUpdateParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + name: Required[str] + """Cluster name""" diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/__init__.py b/src/gcore/types/cloud/gpu_virtual_clusters/__init__.py new file mode 100644 index 00000000..df222501 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/__init__.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .flavor_list_params import FlavorListParams as FlavorListParams +from .gpu_virtual_flavor import GPUVirtualFlavor as GPUVirtualFlavor +from .server_list_params import ServerListParams as ServerListParams +from .image_upload_params import ImageUploadParams as ImageUploadParams +from .server_delete_params import ServerDeleteParams as ServerDeleteParams +from .gpu_virtual_interface import GPUVirtualInterface as GPUVirtualInterface +from .gpu_virtual_flavor_list import GPUVirtualFlavorList as GPUVirtualFlavorList +from .gpu_virtual_cluster_server import GPUVirtualClusterServer as GPUVirtualClusterServer +from .gpu_virtual_cluster_volume import GPUVirtualClusterVolume as GPUVirtualClusterVolume +from .gpu_virtual_interface_list import GPUVirtualInterfaceList as GPUVirtualInterfaceList +from .gpu_virtual_cluster_server_list import GPUVirtualClusterServerList as GPUVirtualClusterServerList +from .gpu_virtual_cluster_volume_list import GPUVirtualClusterVolumeList as GPUVirtualClusterVolumeList diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/flavor_list_params.py b/src/gcore/types/cloud/gpu_virtual_clusters/flavor_list_params.py new file mode 100644 index 00000000..febeb592 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/flavor_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 TypedDict + +__all__ = ["FlavorListParams"] + + +class FlavorListParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + hide_disabled: bool + """Set to `true` to remove the disabled flavors from the response.""" + + include_prices: bool + """Set to `true` if the response should include flavor prices.""" diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server.py b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server.py new file mode 100644 index 00000000..b1b8b52f --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server.py @@ -0,0 +1,77 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..tag import Tag +from ...._models import BaseModel + +__all__ = ["GPUVirtualClusterServer", "SecurityGroup"] + + +class SecurityGroup(BaseModel): + id: str + """Security group ID""" + + name: str + """Security group name""" + + +class GPUVirtualClusterServer(BaseModel): + id: str + """Server unique identifier""" + + created_at: datetime + """Server creation date and time""" + + flavor: str + """Unique flavor identifier""" + + image_id: Optional[str] = None + """Server's image UUID""" + + ip_addresses: List[str] + """List of IP addresses""" + + name: str + """Server's name generated using cluster's name""" + + security_groups: List[SecurityGroup] + """Security groups""" + + ssh_key_name: Optional[str] = None + """SSH key pair assigned to the server""" + + status: Literal[ + "ACTIVE", + "BUILD", + "DELETED", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PASSWORD", + "PAUSED", + "REBOOT", + "REBUILD", + "RESCUE", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "UNKNOWN", + "VERIFY_RESIZE", + ] + """Current server status""" + + tags: List[Tag] + """User defined tags""" + + task_id: Optional[str] = None + """Identifier of the task currently modifying the GPU cluster""" + + updated_at: datetime + """Server update date and time""" diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server_list.py b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server_list.py new file mode 100644 index 00000000..d9cdad5a --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .gpu_virtual_cluster_server import GPUVirtualClusterServer + +__all__ = ["GPUVirtualClusterServerList"] + + +class GPUVirtualClusterServerList(BaseModel): + count: int + """Number of objects""" + + results: List[GPUVirtualClusterServer] + """Objects""" diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume.py b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume.py new file mode 100644 index 00000000..06653cde --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume.py @@ -0,0 +1,64 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from datetime import datetime +from typing_extensions import Literal + +from ..tag import Tag +from ...._models import BaseModel + +__all__ = ["GPUVirtualClusterVolume"] + + +class GPUVirtualClusterVolume(BaseModel): + id: str + """Volume unique identifier""" + + bootable: bool + """True if this is bootable volume""" + + created_at: datetime + """Volume creation date and time""" + + name: str + """User defined name""" + + root_fs: bool + """True if this volume contains root file system""" + + server_id: str + """Server UUID""" + + size: int + """Volume size in GiB""" + + status: Literal[ + "attaching", + "available", + "awaiting-transfer", + "backing-up", + "creating", + "deleting", + "detaching", + "downloading", + "error", + "error_backing-up", + "error_deleting", + "error_extending", + "error_restoring", + "extending", + "in-use", + "maintenance", + "reserved", + "restoring-backup", + "retyping", + "reverting", + "uploading", + ] + """Current volume status""" + + tags: List[Tag] + """User defined tags""" + + type: str + """Volume type""" diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume_list.py b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume_list.py new file mode 100644 index 00000000..feb8afbc --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .gpu_virtual_cluster_volume import GPUVirtualClusterVolume + +__all__ = ["GPUVirtualClusterVolumeList"] + + +class GPUVirtualClusterVolumeList(BaseModel): + count: int + """Number of objects""" + + results: List[GPUVirtualClusterVolume] + """Objects""" 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 new file mode 100644 index 00000000..cd90cda1 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py @@ -0,0 +1,155 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal, TypeAlias + +from ...._models import BaseModel + +__all__ = [ + "GPUVirtualFlavor", + "GPUVirtualFlavorSerializerWithoutPrice", + "GPUVirtualFlavorSerializerWithoutPriceHardwareDescription", + "GPUVirtualFlavorSerializerWithoutPriceHardwareProperties", + "GPUVirtualFlavorSerializerWithoutPriceSupportedFeatures", + "GPUVirtualFlavorSerializerWithPrices", + "GPUVirtualFlavorSerializerWithPricesHardwareDescription", + "GPUVirtualFlavorSerializerWithPricesHardwareProperties", + "GPUVirtualFlavorSerializerWithPricesPrice", + "GPUVirtualFlavorSerializerWithPricesSupportedFeatures", +] + + +class GPUVirtualFlavorSerializerWithoutPriceHardwareDescription(BaseModel): + gpu: Optional[str] = None + """Human-readable GPU description""" + + local_storage: Optional[int] = None + """Local storage capacity in GiB""" + + ram: Optional[int] = None + """RAM size in MiB""" + + vcpus: Optional[int] = None + """Virtual CPU count""" + + +class GPUVirtualFlavorSerializerWithoutPriceHardwareProperties(BaseModel): + gpu_count: Optional[int] = None + """The total count of available GPUs.""" + + gpu_manufacturer: Optional[str] = None + """The manufacturer of the graphics processing GPU""" + + gpu_model: Optional[str] = None + """GPU model""" + + nic_eth: Optional[str] = None + """The configuration of the Ethernet ports""" + + nic_ib: Optional[str] = None + """The configuration of the InfiniBand ports""" + + +class GPUVirtualFlavorSerializerWithoutPriceSupportedFeatures(BaseModel): + security_groups: bool + + +class GPUVirtualFlavorSerializerWithoutPrice(BaseModel): + architecture: Optional[str] = None + """Flavor architecture type""" + + capacity: int + """Number of available instances of given flavor""" + + disabled: bool + """If the flavor is disabled, new resources cannot be created using this flavor.""" + + hardware_description: GPUVirtualFlavorSerializerWithoutPriceHardwareDescription + """Additional virtual hardware description""" + + hardware_properties: GPUVirtualFlavorSerializerWithoutPriceHardwareProperties + """Additional virtual hardware properties""" + + name: str + """Flavor name""" + + supported_features: GPUVirtualFlavorSerializerWithoutPriceSupportedFeatures + """Set of enabled features based on the flavor's type and configuration""" + + +class GPUVirtualFlavorSerializerWithPricesHardwareDescription(BaseModel): + gpu: Optional[str] = None + """Human-readable GPU description""" + + local_storage: Optional[int] = None + """Local storage capacity in GiB""" + + ram: Optional[int] = None + """RAM size in MiB""" + + vcpus: Optional[int] = None + """Virtual CPU count""" + + +class GPUVirtualFlavorSerializerWithPricesHardwareProperties(BaseModel): + gpu_count: Optional[int] = None + """The total count of available GPUs.""" + + gpu_manufacturer: Optional[str] = None + """The manufacturer of the graphics processing GPU""" + + gpu_model: Optional[str] = None + """GPU model""" + + nic_eth: Optional[str] = None + """The configuration of the Ethernet ports""" + + nic_ib: Optional[str] = None + """The configuration of the InfiniBand ports""" + + +class GPUVirtualFlavorSerializerWithPricesPrice(BaseModel): + currency_code: Optional[str] = None + """Currency code. Shown if the `include_prices` query parameter if set to true""" + + price_per_hour: Optional[float] = None + """Price per hour. Shown if the `include_prices` query parameter if set to true""" + + price_per_month: Optional[float] = None + """Price per month. Shown if the `include_prices` query parameter if set to true""" + + price_status: Optional[Literal["error", "hide", "show"]] = None + """Price status for the UI""" + + +class GPUVirtualFlavorSerializerWithPricesSupportedFeatures(BaseModel): + security_groups: bool + + +class GPUVirtualFlavorSerializerWithPrices(BaseModel): + architecture: Optional[str] = None + """Flavor architecture type""" + + capacity: int + """Number of available instances of given flavor""" + + disabled: bool + """If the flavor is disabled, new resources cannot be created using this flavor.""" + + hardware_description: GPUVirtualFlavorSerializerWithPricesHardwareDescription + """Additional virtual hardware description""" + + hardware_properties: GPUVirtualFlavorSerializerWithPricesHardwareProperties + """Additional virtual hardware properties""" + + name: str + """Flavor name""" + + price: GPUVirtualFlavorSerializerWithPricesPrice + """Flavor price.""" + + supported_features: GPUVirtualFlavorSerializerWithPricesSupportedFeatures + """Set of enabled features based on the flavor's type and configuration""" + + +GPUVirtualFlavor: TypeAlias = Union[GPUVirtualFlavorSerializerWithoutPrice, GPUVirtualFlavorSerializerWithPrices] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor_list.py b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor_list.py new file mode 100644 index 00000000..fdfab090 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .gpu_virtual_flavor import GPUVirtualFlavor + +__all__ = ["GPUVirtualFlavorList"] + + +class GPUVirtualFlavorList(BaseModel): + count: int + """Number of objects""" + + results: List[GPUVirtualFlavor] + """Objects""" 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 new file mode 100644 index 00000000..fbac34d7 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py @@ -0,0 +1,190 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..tag import Tag +from ..route import Route +from ...._models import BaseModel +from ..ip_version import IPVersion +from ..floating_ip_status import FloatingIPStatus + +__all__ = ["GPUVirtualInterface", "FloatingIP", "IPAssignment", "Network", "NetworkSubnet"] + + +class FloatingIP(BaseModel): + id: str + """Floating IP ID""" + + created_at: datetime + """Datetime when the floating IP was created""" + + fixed_ip_address: Optional[str] = None + """IP address of the port the floating IP is attached to""" + + floating_ip_address: Optional[str] = None + """IP Address of the floating IP""" + + port_id: Optional[str] = None + """Port ID the floating IP is attached to. + + The `fixed_ip_address` is the IP address of the port. + """ + + router_id: Optional[str] = None + """Router ID""" + + status: Optional[FloatingIPStatus] = None + """Floating IP status""" + + tags: List[Tag] + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. + """ + + updated_at: datetime + """Datetime when the floating IP was last updated""" + + +class IPAssignment(BaseModel): + ip_address: str + """The IP address assigned to the port from the specified subnet""" + + subnet_id: str + """ID of the subnet that allocated the IP""" + + +class NetworkSubnet(BaseModel): + id: str + """Subnet id.""" + + available_ips: Optional[int] = None + """Number of available ips in subnet""" + + cidr: str + """CIDR""" + + created_at: datetime + """Datetime when the subnet was created""" + + dns_nameservers: Optional[List[str]] = None + """List IP addresses of a DNS resolver reachable from the network""" + + enable_dhcp: bool + """Indicates whether DHCP is enabled for this subnet. + + If true, IP addresses will be assigned automatically + """ + + gateway_ip: Optional[str] = None + """Default GW IPv4 address, advertised in DHCP routes of this subnet. + + If null, no gateway is advertised by this subnet. + """ + + has_router: bool + """Deprecated. Always returns `false`.""" + + host_routes: Optional[List[Route]] = None + """List of custom static routes to advertise via DHCP.""" + + ip_version: IPVersion + """IP version used by the subnet (IPv4 or IPv6)""" + + name: str + """Subnet name""" + + network_id: str + """Network ID""" + + tags: List[Tag] + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. + """ + + total_ips: Optional[int] = None + """Total number of ips in subnet""" + + updated_at: datetime + """Datetime when the subnet was last updated""" + + +class Network(BaseModel): + id: str + """Network ID""" + + created_at: datetime + """Datetime when the network was created""" + + external: bool + """True if the network `router:external` attribute""" + + mtu: int + """MTU (maximum transmission unit)""" + + name: str + """Network name""" + + port_security_enabled: bool + """ + Indicates `port_security_enabled` status of all newly created in the network + ports. + """ + + segmentation_id: Optional[int] = None + """Id of network segment""" + + shared: bool + """True when the network is shared with your project by external owner""" + + subnets: Optional[List[NetworkSubnet]] = None + """List of subnetworks""" + + tags: List[Tag] + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. + """ + + type: str + """Network type (vlan, vxlan)""" + + updated_at: datetime + """Datetime when the network was last updated""" + + +class GPUVirtualInterface(BaseModel): + floating_ips: List[FloatingIP] + """Bodies of floatingips that are NAT-ing ips of this port""" + + ip_assignments: List[IPAssignment] + """IP addresses assigned to this port""" + + mac_address: Optional[str] = None + """MAC address of the virtual port""" + + network: Network + """Body of the network this port is attached to""" + + network_id: str + """ID of the network the port is attached to""" + + port_id: str + """ID of virtual ethernet port object""" + + port_security_enabled: bool + """Port security status""" diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface_list.py b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface_list.py new file mode 100644 index 00000000..ae39f4cf --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .gpu_virtual_interface import GPUVirtualInterface + +__all__ = ["GPUVirtualInterfaceList"] + + +class GPUVirtualInterfaceList(BaseModel): + count: int + """Number of objects""" + + results: List[GPUVirtualInterface] + """Objects""" diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py new file mode 100644 index 00000000..c83f5687 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py @@ -0,0 +1,56 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ImageUploadParams"] + + +class ImageUploadParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + name: Required[str] + """Image name""" + + url: Required[str] + """Image URL""" + + architecture: Optional[Literal["aarch64", "x86_64"]] + """Image architecture type: aarch64, `x86_64`""" + + cow_format: bool + """ + When True, image cannot be deleted unless all volumes, created from it, are + deleted. + """ + + hw_firmware_type: Optional[Literal["bios", "uefi"]] + """Specifies the type of firmware with which to boot the guest.""" + + os_distro: Optional[str] + """OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc.""" + + os_type: Optional[Literal["linux", "windows"]] + """The operating system installed on the image. Linux by default""" + + os_version: Optional[str] + """OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian""" + + ssh_key: Literal["allow", "deny", "required"] + """Permission to use a ssh key in instances""" + + tags: Dict[str, str] + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. + """ diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/server_delete_params.py b/src/gcore/types/cloud/gpu_virtual_clusters/server_delete_params.py new file mode 100644 index 00000000..714cb4bb --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/server_delete_params.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ...._types import SequenceNotStr + +__all__ = ["ServerDeleteParams"] + + +class ServerDeleteParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + cluster_id: Required[str] + """Cluster unique identifier""" + + all_floating_ips: bool + """ + Flag indicating whether the floating ips associated with server / cluster are + deleted + """ + + all_reserved_fixed_ips: bool + """ + Flag indicating whether the reserved fixed ips associated with server / cluster + are deleted + """ + + all_volumes: bool + """Flag indicating whether all attached volumes are deleted""" + + floating_ip_ids: SequenceNotStr[str] + """Optional list of floating ips to be deleted""" + + reserved_fixed_ip_ids: SequenceNotStr[str] + """Optional list of reserved fixed ips to be deleted""" + + volume_ids: SequenceNotStr[str] + """Optional list of volumes to be deleted""" diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/server_list_params.py b/src/gcore/types/cloud/gpu_virtual_clusters/server_list_params.py new file mode 100644 index 00000000..35c7f374 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual_clusters/server_list_params.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ...._types import SequenceNotStr +from ...._utils import PropertyInfo + +__all__ = ["ServerListParams"] + + +class ServerListParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + changed_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Filters the results to include only servers whose last change timestamp is less + than the specified datetime. Format: ISO 8601. + """ + + changed_since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Filters the results to include only servers whose last change timestamp is + greater than or equal to the specified datetime. Format: ISO 8601. + """ + + ip_address: str + """Filter servers by ip address.""" + + limit: int + """Limit of items on a single page""" + + name: str + """Filter servers by name. + + You can provide a full or partial name, servers with matching names will be + returned. For example, entering 'test' will return all servers that contain + 'test' in their name. + """ + + offset: int + """Offset in results list""" + + order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] + """Order field""" + + status: Literal[ + "ACTIVE", + "BUILD", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PAUSED", + "REBOOT", + "REBUILD", + "RESIZE", + "REVERT_RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "VERIFY_RESIZE", + ] + """Filters servers by status.""" + + uuids: SequenceNotStr[str] + """Filter servers by uuid.""" diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/__init__.py b/tests/api_resources/cloud/gpu_virtual_clusters/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/gpu_virtual_clusters/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_flavors.py b/tests/api_resources/cloud/gpu_virtual_clusters/test_flavors.py new file mode 100644 index 00000000..89b949ed --- /dev/null +++ b/tests/api_resources/cloud/gpu_virtual_clusters/test_flavors.py @@ -0,0 +1,112 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualFlavorList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFlavors: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + flavor = client.cloud.gpu_virtual_clusters.flavors.list( + project_id=1, + region_id=7, + ) + assert_matches_type(GPUVirtualFlavorList, flavor, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + flavor = client.cloud.gpu_virtual_clusters.flavors.list( + project_id=1, + region_id=7, + hide_disabled=True, + include_prices=True, + ) + assert_matches_type(GPUVirtualFlavorList, flavor, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.flavors.with_raw_response.list( + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = response.parse() + assert_matches_type(GPUVirtualFlavorList, flavor, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.flavors.with_streaming_response.list( + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = response.parse() + assert_matches_type(GPUVirtualFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFlavors: + 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: + flavor = await async_client.cloud.gpu_virtual_clusters.flavors.list( + project_id=1, + region_id=7, + ) + assert_matches_type(GPUVirtualFlavorList, flavor, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + flavor = await async_client.cloud.gpu_virtual_clusters.flavors.list( + project_id=1, + region_id=7, + hide_disabled=True, + include_prices=True, + ) + assert_matches_type(GPUVirtualFlavorList, flavor, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.flavors.with_raw_response.list( + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + flavor = await response.parse() + assert_matches_type(GPUVirtualFlavorList, flavor, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.flavors.with_streaming_response.list( + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + flavor = await response.parse() + assert_matches_type(GPUVirtualFlavorList, flavor, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_images.py b/tests/api_resources/cloud/gpu_virtual_clusters/test_images.py new file mode 100644 index 00000000..7312ccb7 --- /dev/null +++ b/tests/api_resources/cloud/gpu_virtual_clusters/test_images.py @@ -0,0 +1,392 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import GPUImage, TaskIDList, GPUImageList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestImages: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + image = client.cloud.gpu_virtual_clusters.images.list( + project_id=1, + region_id=7, + ) + assert_matches_type(GPUImageList, image, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.images.with_raw_response.list( + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(GPUImageList, image, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.images.with_streaming_response.list( + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(GPUImageList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + image = client.cloud.gpu_virtual_clusters.images.delete( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.images.with_raw_response.delete( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.images.with_streaming_response.delete( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + client.cloud.gpu_virtual_clusters.images.with_raw_response.delete( + image_id="", + project_id=1, + region_id=7, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + image = client.cloud.gpu_virtual_clusters.images.get( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + assert_matches_type(GPUImage, image, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.images.with_raw_response.get( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(GPUImage, image, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.images.with_streaming_response.get( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(GPUImage, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + client.cloud.gpu_virtual_clusters.images.with_raw_response.get( + image_id="", + project_id=1, + region_id=7, + ) + + @parametrize + def test_method_upload(self, client: Gcore) -> None: + image = client.cloud.gpu_virtual_clusters.images.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_method_upload_with_all_params(self, client: Gcore) -> None: + image = client.cloud.gpu_virtual_clusters.images.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + architecture="x86_64", + cow_format=True, + hw_firmware_type="bios", + os_distro="os_distro", + os_type="linux", + os_version="19.04", + ssh_key="allow", + tags={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_raw_response_upload(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.images.with_raw_response.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + def test_streaming_response_upload(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.images.with_streaming_response.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncImages: + 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: + image = await async_client.cloud.gpu_virtual_clusters.images.list( + project_id=1, + region_id=7, + ) + assert_matches_type(GPUImageList, image, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.list( + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(GPUImageList, image, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.images.with_streaming_response.list( + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(GPUImageList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.gpu_virtual_clusters.images.delete( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.delete( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.images.with_streaming_response.delete( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.delete( + image_id="", + project_id=1, + region_id=7, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.gpu_virtual_clusters.images.get( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + assert_matches_type(GPUImage, image, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.get( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(GPUImage, image, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.images.with_streaming_response.get( + image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(GPUImage, image, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.get( + image_id="", + project_id=1, + region_id=7, + ) + + @parametrize + async def test_method_upload(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.gpu_virtual_clusters.images.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> None: + image = await async_client.cloud.gpu_virtual_clusters.images.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + architecture="x86_64", + cow_format=True, + hw_firmware_type="bios", + os_distro="os_distro", + os_type="linux", + os_version="19.04", + ssh_key="allow", + tags={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_raw_response_upload(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + @parametrize + async def test_streaming_response_upload(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.images.with_streaming_response.upload( + project_id=1, + region_id=7, + name="ubuntu-23.10-x64", + url="http://mirror.noris.net/cirros/0.4.0/cirros-0.4.0-x86_64-disk.img", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image = await response.parse() + assert_matches_type(TaskIDList, image, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_interfaces.py b/tests/api_resources/cloud/gpu_virtual_clusters/test_interfaces.py new file mode 100644 index 00000000..c36ac28b --- /dev/null +++ b/tests/api_resources/cloud/gpu_virtual_clusters/test_interfaces.py @@ -0,0 +1,116 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualInterfaceList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInterfaces: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + interface = client.cloud.gpu_virtual_clusters.interfaces.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + assert_matches_type(GPUVirtualInterfaceList, interface, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.interfaces.with_raw_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(GPUVirtualInterfaceList, interface, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.interfaces.with_streaming_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(GPUVirtualInterfaceList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.interfaces.with_raw_response.list( + cluster_id="", + project_id=1, + region_id=7, + ) + + +class TestAsyncInterfaces: + 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: + interface = await async_client.cloud.gpu_virtual_clusters.interfaces.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + assert_matches_type(GPUVirtualInterfaceList, interface, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.interfaces.with_raw_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(GPUVirtualInterfaceList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.interfaces.with_streaming_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(GPUVirtualInterfaceList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.interfaces.with_raw_response.list( + cluster_id="", + project_id=1, + region_id=7, + ) diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_servers.py b/tests/api_resources/cloud/gpu_virtual_clusters/test_servers.py new file mode 100644 index 00000000..6e341c99 --- /dev/null +++ b/tests/api_resources/cloud/gpu_virtual_clusters/test_servers.py @@ -0,0 +1,302 @@ +# 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._utils import parse_datetime +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualClusterServerList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestServers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + server = client.cloud.gpu_virtual_clusters.servers.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + assert_matches_type(GPUVirtualClusterServerList, server, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + server = client.cloud.gpu_virtual_clusters.servers.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + changed_before=parse_datetime("2025-10-01T12:00:00Z"), + changed_since=parse_datetime("2025-10-01T12:00:00Z"), + ip_address="237.84.2.178", + limit=10, + name="name", + offset=0, + order_by="created_at.asc", + status="ACTIVE", + uuids=["string"], + ) + assert_matches_type(GPUVirtualClusterServerList, server, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.servers.with_raw_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(GPUVirtualClusterServerList, server, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.servers.with_streaming_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(GPUVirtualClusterServerList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.servers.with_raw_response.list( + cluster_id="", + project_id=1, + region_id=7, + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + server = client.cloud.gpu_virtual_clusters.servers.delete( + server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", + project_id=1, + region_id=7, + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_method_delete_with_all_params(self, client: Gcore) -> None: + server = client.cloud.gpu_virtual_clusters.servers.delete( + server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", + project_id=1, + region_id=7, + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + all_floating_ips=True, + all_reserved_fixed_ips=True, + all_volumes=True, + floating_ip_ids=["e4a01208-d6ac-4304-bf86-3028154b070a"], + reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], + volume_ids=["1333c684-c3da-4b91-ac9e-a92706aa2824"], + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", + project_id=1, + region_id=7, + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.servers.with_streaming_response.delete( + server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", + project_id=1, + region_id=7, + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", + project_id=1, + region_id=7, + cluster_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): + client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + server_id="", + project_id=1, + region_id=7, + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + ) + + +class TestAsyncServers: + 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: + server = await async_client.cloud.gpu_virtual_clusters.servers.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + assert_matches_type(GPUVirtualClusterServerList, server, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_virtual_clusters.servers.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + changed_before=parse_datetime("2025-10-01T12:00:00Z"), + changed_since=parse_datetime("2025-10-01T12:00:00Z"), + ip_address="237.84.2.178", + limit=10, + name="name", + offset=0, + order_by="created_at.asc", + status="ACTIVE", + uuids=["string"], + ) + assert_matches_type(GPUVirtualClusterServerList, server, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(GPUVirtualClusterServerList, server, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.servers.with_streaming_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(GPUVirtualClusterServerList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.list( + cluster_id="", + project_id=1, + region_id=7, + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_virtual_clusters.servers.delete( + server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", + project_id=1, + region_id=7, + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: + server = await async_client.cloud.gpu_virtual_clusters.servers.delete( + server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", + project_id=1, + region_id=7, + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + all_floating_ips=True, + all_reserved_fixed_ips=True, + all_volumes=True, + floating_ip_ids=["e4a01208-d6ac-4304-bf86-3028154b070a"], + reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], + volume_ids=["1333c684-c3da-4b91-ac9e-a92706aa2824"], + ) + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", + project_id=1, + region_id=7, + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.servers.with_streaming_response.delete( + server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", + project_id=1, + region_id=7, + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + server = await response.parse() + assert_matches_type(TaskIDList, server, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", + project_id=1, + region_id=7, + cluster_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + server_id="", + project_id=1, + region_id=7, + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + ) diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_volumes.py b/tests/api_resources/cloud/gpu_virtual_clusters/test_volumes.py new file mode 100644 index 00000000..294f4466 --- /dev/null +++ b/tests/api_resources/cloud/gpu_virtual_clusters/test_volumes.py @@ -0,0 +1,116 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualClusterVolumeList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestVolumes: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + volume = client.cloud.gpu_virtual_clusters.volumes.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + assert_matches_type(GPUVirtualClusterVolumeList, volume, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.volumes.with_raw_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = response.parse() + assert_matches_type(GPUVirtualClusterVolumeList, volume, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.volumes.with_streaming_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = response.parse() + assert_matches_type(GPUVirtualClusterVolumeList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.volumes.with_raw_response.list( + cluster_id="", + project_id=1, + region_id=7, + ) + + +class TestAsyncVolumes: + 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: + volume = await async_client.cloud.gpu_virtual_clusters.volumes.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + assert_matches_type(GPUVirtualClusterVolumeList, volume, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.volumes.with_raw_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume = await response.parse() + assert_matches_type(GPUVirtualClusterVolumeList, volume, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.volumes.with_streaming_response.list( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume = await response.parse() + assert_matches_type(GPUVirtualClusterVolumeList, volume, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.volumes.with_raw_response.list( + cluster_id="", + project_id=1, + region_id=7, + ) diff --git a/tests/api_resources/cloud/test_gpu_virtual_clusters.py b/tests/api_resources/cloud/test_gpu_virtual_clusters.py new file mode 100644 index 00000000..6f3758e5 --- /dev/null +++ b/tests/api_resources/cloud/test_gpu_virtual_clusters.py @@ -0,0 +1,1294 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.cloud import ( + TaskIDList, + GPUVirtualCluster, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestGPUVirtualClusters: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + name="gpu-cluster-1", + servers_count=3, + servers_settings={ + "interfaces": [{"type": "external"}], + "volumes": [ + { + "boot_index": 1, + "name": "my-data-disk", + "size": 100, + "source": "new", + "type": "cold", + } + ], + }, + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + name="gpu-cluster-1", + servers_count=3, + servers_settings={ + "interfaces": [ + { + "type": "external", + "ip_family": "ipv4", + "name": "eth0", + } + ], + "volumes": [ + { + "boot_index": 1, + "name": "my-data-disk", + "size": 100, + "source": "new", + "type": "cold", + "delete_on_termination": True, + "tags": {"key1": "value1"}, + } + ], + "credentials": { + "password": "securepassword", + "ssh_key_name": "my-ssh-key", + "username": "admin", + }, + "file_shares": [ + { + "id": "a3f2d1b8-45e6-4f8a-bb5d-19dbf2cd7e9a", + "mount_path": "/mnt/vast", + } + ], + "security_groups": [{"id": "b4849ffa-89f2-45a1-951f-0ae5b7809d98"}], + "user_data": "eyJ0ZXN0IjogImRhdGEifQ==", + }, + tags={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.with_raw_response.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + name="gpu-cluster-1", + servers_count=3, + servers_settings={ + "interfaces": [{"type": "external"}], + "volumes": [ + { + "boot_index": 1, + "name": "my-data-disk", + "size": 100, + "source": "new", + "type": "cold", + } + ], + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.with_streaming_response.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + name="gpu-cluster-1", + servers_count=3, + servers_settings={ + "interfaces": [{"type": "external"}], + "volumes": [ + { + "boot_index": 1, + "name": "my-data-disk", + "size": 100, + "source": "new", + "type": "cold", + } + ], + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.update( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + name="gpu-cluster-1", + ) + assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.with_raw_response.update( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + name="gpu-cluster-1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = response.parse() + assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.with_streaming_response.update( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + name="gpu-cluster-1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = response.parse() + assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.with_raw_response.update( + cluster_id="", + project_id=1, + region_id=7, + name="gpu-cluster-1", + ) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.list( + project_id=1, + region_id=7, + ) + assert_matches_type(SyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.list( + project_id=1, + region_id=7, + limit=10, + offset=0, + ) + assert_matches_type(SyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.with_raw_response.list( + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = response.parse() + assert_matches_type(SyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.with_streaming_response.list( + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = response.parse() + assert_matches_type(SyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_method_delete_with_all_params(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + all_floating_ips=True, + all_reserved_fixed_ips=True, + all_volumes=True, + floating_ip_ids=["e4a01208-d6ac-4304-bf86-3028154b070a"], + reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], + volume_ids=["1333c684-c3da-4b91-ac9e-a92706aa2824"], + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.with_raw_response.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.with_streaming_response.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.with_raw_response.delete( + cluster_id="", + project_id=1, + region_id=7, + ) + + @parametrize + def test_method_action_overload_1(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="start", + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_raw_response_action_overload_1(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="start", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_streaming_response_action_overload_1(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="start", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_action_overload_1(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="start", + ) + + @parametrize + def test_method_action_overload_2(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="stop", + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_raw_response_action_overload_2(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="stop", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_streaming_response_action_overload_2(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="stop", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_action_overload_2(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="stop", + ) + + @parametrize + def test_method_action_overload_3(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="soft_reboot", + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_raw_response_action_overload_3(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="soft_reboot", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_streaming_response_action_overload_3(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="soft_reboot", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_action_overload_3(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="soft_reboot", + ) + + @parametrize + def test_method_action_overload_4(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="hard_reboot", + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_raw_response_action_overload_4(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="hard_reboot", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_streaming_response_action_overload_4(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="hard_reboot", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_action_overload_4(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="hard_reboot", + ) + + @parametrize + def test_method_action_overload_5(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_raw_response_action_overload_5(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_streaming_response_action_overload_5(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_action_overload_5(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + + @parametrize + def test_method_action_overload_6(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="resize", + servers_count=5, + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_raw_response_action_overload_6(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="resize", + servers_count=5, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_streaming_response_action_overload_6(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="resize", + servers_count=5, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_action_overload_6(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="resize", + servers_count=5, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.get( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.gpu_virtual_clusters.with_raw_response.get( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = response.parse() + assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.gpu_virtual_clusters.with_streaming_response.get( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = response.parse() + assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_virtual_clusters.with_raw_response.get( + cluster_id="", + project_id=1, + region_id=7, + ) + + +class TestAsyncGPUVirtualClusters: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + name="gpu-cluster-1", + servers_count=3, + servers_settings={ + "interfaces": [{"type": "external"}], + "volumes": [ + { + "boot_index": 1, + "name": "my-data-disk", + "size": 100, + "source": "new", + "type": "cold", + } + ], + }, + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + name="gpu-cluster-1", + servers_count=3, + servers_settings={ + "interfaces": [ + { + "type": "external", + "ip_family": "ipv4", + "name": "eth0", + } + ], + "volumes": [ + { + "boot_index": 1, + "name": "my-data-disk", + "size": 100, + "source": "new", + "type": "cold", + "delete_on_termination": True, + "tags": {"key1": "value1"}, + } + ], + "credentials": { + "password": "securepassword", + "ssh_key_name": "my-ssh-key", + "username": "admin", + }, + "file_shares": [ + { + "id": "a3f2d1b8-45e6-4f8a-bb5d-19dbf2cd7e9a", + "mount_path": "/mnt/vast", + } + ], + "security_groups": [{"id": "b4849ffa-89f2-45a1-951f-0ae5b7809d98"}], + "user_data": "eyJ0ZXN0IjogImRhdGEifQ==", + }, + tags={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + name="gpu-cluster-1", + servers_count=3, + servers_settings={ + "interfaces": [{"type": "external"}], + "volumes": [ + { + "boot_index": 1, + "name": "my-data-disk", + "size": 100, + "source": "new", + "type": "cold", + } + ], + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.create( + project_id=1, + region_id=7, + flavor="g3-ai-32-192-1500-l40s-48-1", + name="gpu-cluster-1", + servers_count=3, + servers_settings={ + "interfaces": [{"type": "external"}], + "volumes": [ + { + "boot_index": 1, + "name": "my-data-disk", + "size": 100, + "source": "new", + "type": "cold", + } + ], + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.update( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + name="gpu-cluster-1", + ) + assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.update( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + name="gpu-cluster-1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = await response.parse() + assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.update( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + name="gpu-cluster-1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = await response.parse() + assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.with_raw_response.update( + cluster_id="", + project_id=1, + region_id=7, + name="gpu-cluster-1", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.list( + project_id=1, + region_id=7, + ) + assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.list( + project_id=1, + region_id=7, + limit=10, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.list( + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.list( + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + all_floating_ips=True, + all_reserved_fixed_ips=True, + all_volumes=True, + floating_ip_ids=["e4a01208-d6ac-4304-bf86-3028154b070a"], + reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], + volume_ids=["1333c684-c3da-4b91-ac9e-a92706aa2824"], + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.delete( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.with_raw_response.delete( + cluster_id="", + project_id=1, + region_id=7, + ) + + @parametrize + async def test_method_action_overload_1(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="start", + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_raw_response_action_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="start", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_action_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="start", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_action_overload_1(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="start", + ) + + @parametrize + async def test_method_action_overload_2(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="stop", + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_raw_response_action_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="stop", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_action_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="stop", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_action_overload_2(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="stop", + ) + + @parametrize + async def test_method_action_overload_3(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="soft_reboot", + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_raw_response_action_overload_3(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="soft_reboot", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_action_overload_3(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="soft_reboot", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_action_overload_3(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="soft_reboot", + ) + + @parametrize + async def test_method_action_overload_4(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="hard_reboot", + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_raw_response_action_overload_4(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="hard_reboot", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_action_overload_4(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="hard_reboot", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_action_overload_4(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="hard_reboot", + ) + + @parametrize + async def test_method_action_overload_5(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_raw_response_action_overload_5(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_action_overload_5(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_action_overload_5(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + + @parametrize + async def test_method_action_overload_6(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="resize", + servers_count=5, + ) + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_raw_response_action_overload_6(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="resize", + servers_count=5, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_action_overload_6(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="resize", + servers_count=5, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_action_overload_6(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="resize", + servers_count=5, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.get( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.get( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_virtual_cluster = await response.parse() + assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.get( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_virtual_cluster = await response.parse() + assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_virtual_clusters.with_raw_response.get( + cluster_id="", + project_id=1, + region_id=7, + ) From d4acdb78127b9c94e5a3dbc32fc909f97acc35f9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 11 Nov 2025 14:36:33 +0000 Subject: [PATCH 431/592] fix(compat): update signatures of `model_dump` and `model_dump_json` for Pydantic v1 --- src/gcore/_models.py | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/gcore/_models.py b/src/gcore/_models.py index fcec2cf9..ca9500b2 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -257,15 +257,16 @@ def model_dump( mode: Literal["json", "python"] | str = "python", include: IncEx | None = None, exclude: IncEx | None = None, + context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, + exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, - context: dict[str, Any] | None = None, - serialize_as_any: bool = False, fallback: Callable[[Any], Any] | None = None, + serialize_as_any: bool = False, ) -> dict[str, Any]: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump @@ -273,16 +274,24 @@ def model_dump( Args: mode: The mode in which `to_python` should run. - If mode is 'json', the dictionary will only contain JSON serializable types. - If mode is 'python', the dictionary may contain any Python objects. - include: A list of fields to include in the output. - exclude: A list of fields to exclude from the output. + If mode is 'json', the output will only contain JSON serializable types. + If mode is 'python', the output may contain non-JSON-serializable Python objects. + include: A set of fields to include in the output. + exclude: A set of fields to exclude from the output. + context: Additional context to pass to the serializer. by_alias: Whether to use the field's alias in the dictionary key if defined. - exclude_unset: Whether to exclude fields that are unset or None from the output. - exclude_defaults: Whether to exclude fields that are set to their default value from the output. - exclude_none: Whether to exclude fields that have a value of `None` from the output. - round_trip: Whether to enable serialization and deserialization round-trip support. - warnings: Whether to log warnings when invalid fields are encountered. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that are set to their default value. + exclude_none: Whether to exclude fields that have a value of `None`. + exclude_computed_fields: Whether to exclude computed fields. + While this can be useful for round-tripping, it is usually recommended to use the dedicated + `round_trip` parameter instead. + round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. + warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, + "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. + fallback: A function to call when an unknown value is encountered. If not provided, + a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. + serialize_as_any: Whether to serialize fields with duck-typing serialization behavior. Returns: A dictionary representation of the model. @@ -299,6 +308,8 @@ def model_dump( raise ValueError("serialize_as_any is only supported in Pydantic v2") if fallback is not None: raise ValueError("fallback is only supported in Pydantic v2") + if exclude_computed_fields != False: + raise ValueError("exclude_computed_fields is only supported in Pydantic v2") dumped = super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, @@ -315,15 +326,17 @@ def model_dump_json( self, *, indent: int | None = None, + ensure_ascii: bool = False, include: IncEx | None = None, exclude: IncEx | None = None, + context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, + exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, - context: dict[str, Any] | None = None, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, ) -> str: @@ -355,6 +368,10 @@ def model_dump_json( raise ValueError("serialize_as_any is only supported in Pydantic v2") if fallback is not None: raise ValueError("fallback is only supported in Pydantic v2") + if ensure_ascii != False: + raise ValueError("ensure_ascii is only supported in Pydantic v2") + if exclude_computed_fields != False: + raise ValueError("exclude_computed_fields is only supported in Pydantic v2") return super().json( # type: ignore[reportDeprecated] indent=indent, include=include, From ef421ab866f392f2ac911e18b3165808f30e2cdb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 12 Nov 2025 12:00:47 +0000 Subject: [PATCH 432/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e7562934..0c2ecec6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.19.0" + ".": "0.20.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index adc340a4..51ecde25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.19.0" +version = "0.20.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 54b67f1e..0013e79a 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.19.0" # x-release-please-version +__version__ = "0.20.0" # x-release-please-version From 3678243e055ae4b4652c9b48c9bfacd50e99ad7a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 13 Nov 2025 19:52:11 +0000 Subject: [PATCH 433/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index af8fa5c8..0b56c292 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-cf3ae8749ead0412e761136b7c81a9ca98dd46ca9ef76c1f700cb1ecc814630d.yml openapi_spec_hash: d5b2b66116339bbe16ec0bbff5b6366f -config_hash: e759f29c457a9e3ac5031e760c36594a +config_hash: 814c5f622b6b26a5556a87031051c797 From a3849d94310119766e8d0ef421e6ad010749ee68 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Nov 2025 10:11:35 +0000 Subject: [PATCH 434/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cdn/resources/resources.py | 40 +++++++++---------- src/gcore/resources/cloud/audit_logs.py | 20 ++++++++++ .../resources/cloud/baremetal/servers.py | 8 ++-- .../cloud/file_shares/file_shares.py | 18 +++++++-- src/gcore/resources/cloud/floating_ips.py | 30 ++++++++++++-- .../gpu_baremetal_clusters.py | 18 +++++++-- .../gpu_virtual_clusters.py | 18 +++++++-- .../inference/deployments/deployments.py | 8 ++-- .../resources/cloud/instances/instances.py | 26 ++++++++---- .../cloud/load_balancers/load_balancers.py | 18 +++++++-- .../resources/cloud/networks/networks.py | 18 +++++++-- src/gcore/resources/cloud/networks/subnets.py | 18 +++++++-- .../cloud/security_groups/security_groups.py | 18 +++++++-- src/gcore/resources/cloud/volumes.py | 18 +++++++-- src/gcore/resources/dns/zones/rrsets.py | 20 +++++----- src/gcore/resources/dns/zones/zones.py | 4 +- src/gcore/types/cdn/cdn_resource.py | 17 ++++---- src/gcore/types/cdn/resource_create_params.py | 17 ++++---- src/gcore/types/cdn/resource_purge_params.py | 8 ++-- .../types/cdn/resource_replace_params.py | 17 ++++---- src/gcore/types/cdn/resource_update_params.py | 17 ++++---- .../types/cdn/resources/cdn_resource_rule.py | 13 +++--- .../types/cdn/resources/rule_create_params.py | 13 +++--- .../cdn/resources/rule_replace_params.py | 13 +++--- .../types/cdn/resources/rule_update_params.py | 13 +++--- src/gcore/types/cdn/rule_template.py | 13 +++--- .../types/cdn/rule_template_create_params.py | 13 +++--- .../types/cdn/rule_template_replace_params.py | 13 +++--- .../types/cdn/rule_template_update_params.py | 13 +++--- src/gcore/types/cloud/audit_log_entry.py | 6 +++ .../types/cloud/audit_log_list_params.py | 12 ++++++ .../cloud/baremetal/server_create_params.py | 4 +- .../types/cloud/file_share_update_params.py | 9 ++++- src/gcore/types/cloud/floating_ip.py | 6 ++- src/gcore/types/cloud/floating_ip_detailed.py | 6 ++- .../types/cloud/floating_ip_list_params.py | 8 ++++ .../types/cloud/floating_ip_update_params.py | 9 ++++- .../gpu_baremetal_cluster_action_params.py | 9 ++++- .../gpu_virtual_cluster_action_params.py | 9 ++++- .../inference/deployment_create_params.py | 2 +- .../inference/deployment_update_params.py | 2 +- .../cloud/inference/inference_deployment.py | 2 +- .../types/cloud/instance_create_params.py | 4 +- .../types/cloud/instance_update_params.py | 9 ++++- .../cloud/load_balancer_update_params.py | 9 ++++- .../types/cloud/network_update_params.py | 9 ++++- .../cloud/networks/subnet_update_params.py | 9 ++++- .../cloud/security_group_update_params.py | 9 ++++- src/gcore/types/cloud/task_id_list.py | 6 +-- src/gcore/types/cloud/volume_update_params.py | 9 ++++- src/gcore/types/dns/zone_list_params.py | 2 +- src/gcore/types/streaming/stream.py | 5 ++- src/gcore/types/streaming/video.py | 2 +- .../waap/domains/custom_rule_create_params.py | 2 +- .../waap/domains/custom_rule_update_params.py | 2 +- .../types/waap/domains/waap_custom_rule.py | 2 +- tests/api_resources/cloud/test_audit_logs.py | 4 ++ .../api_resources/cloud/test_floating_ips.py | 2 + 59 files changed, 432 insertions(+), 221 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0b56c292..cd19e79d 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-cf3ae8749ead0412e761136b7c81a9ca98dd46ca9ef76c1f700cb1ecc814630d.yml -openapi_spec_hash: d5b2b66116339bbe16ec0bbff5b6366f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9377b474dea790cb05261b341252967ecb7791d5aa9b102f2241a8b8826c11ab.yml +openapi_spec_hash: c6a8c5e78604079deb242a0dd3d48cba config_hash: 814c5f622b6b26a5556a87031051c797 diff --git a/src/gcore/resources/cdn/resources/resources.py b/src/gcore/resources/cdn/resources/resources.py index 5dc03672..1757c8f3 100644 --- a/src/gcore/resources/cdn/resources/resources.py +++ b/src/gcore/resources/cdn/resources/resources.py @@ -154,11 +154,11 @@ def create( proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. proxy_ssl_data: ID of the SSL certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before completing any connection. @@ -288,11 +288,11 @@ def update( proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. proxy_ssl_data: ID of the SSL certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before completing any connection. @@ -731,16 +731,16 @@ def purge( Args: paths: **Purge by pattern** clears the cache that matches the pattern. - Use \\** operator, which replaces any number of symbols in your path. It's - important to note that wildcard usage (\\**) is permitted only at the end of a + Use _ operator, which replaces any number of symbols in your path. It's + important to note that wildcard usage (_) is permitted only at the end of a pattern. Query string added to any patterns will be ignored, and purge request will be processed as if there weren't any parameters. - Purge by pattern is recursive. Both /path and /path\\** will result in recursive + Purge by pattern is recursive. Both /path and /path* will result in recursive purging, meaning all content under the specified path will be affected. As such, - using the pattern /path\\** is functionally equivalent to simply using /path. + using the pattern /path* is functionally equivalent to simply using /path. extra_headers: Send extra headers @@ -886,11 +886,11 @@ def replace( proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. proxy_ssl_data: ID of the SSL certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before completing any connection. @@ -1064,11 +1064,11 @@ async def create( proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. proxy_ssl_data: ID of the SSL certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before completing any connection. @@ -1198,11 +1198,11 @@ async def update( proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. proxy_ssl_data: ID of the SSL certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before completing any connection. @@ -1641,16 +1641,16 @@ async def purge( Args: paths: **Purge by pattern** clears the cache that matches the pattern. - Use \\** operator, which replaces any number of symbols in your path. It's - important to note that wildcard usage (\\**) is permitted only at the end of a + Use _ operator, which replaces any number of symbols in your path. It's + important to note that wildcard usage (_) is permitted only at the end of a pattern. Query string added to any patterns will be ignored, and purge request will be processed as if there weren't any parameters. - Purge by pattern is recursive. Both /path and /path\\** will result in recursive + Purge by pattern is recursive. Both /path and /path* will result in recursive purging, meaning all content under the specified path will be affected. As such, - using the pattern /path\\** is functionally equivalent to simply using /path. + using the pattern /path* is functionally equivalent to simply using /path. extra_headers: Send extra headers @@ -1796,11 +1796,11 @@ async def replace( proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. proxy_ssl_data: ID of the SSL certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before completing any connection. diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index 0e942e4e..f92e7daa 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -156,7 +156,9 @@ def list( resource_id: SequenceNotStr[str] | Omit = omit, search_field: str | Omit = omit, sorting: Literal["asc", "desc"] | Omit = omit, + source_user_ips: SequenceNotStr[str] | Omit = omit, to_timestamp: Union[str, datetime] | Omit = omit, + user_agents: 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, @@ -194,9 +196,15 @@ def list( sorting: (DEPRECATED Use '`order_by`' instead) Sorting by timestamp. Oldest first, or most recent first + source_user_ips: Originating IP address of the client making the request. Several options can be + specified. + to_timestamp: ISO formatted datetime string. Ending timestamp until which user actions are requested + user_agents: User-Agent string identifying the client making the request. Several options can + be specified. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -226,7 +234,9 @@ def list( "resource_id": resource_id, "search_field": search_field, "sorting": sorting, + "source_user_ips": source_user_ips, "to_timestamp": to_timestamp, + "user_agents": user_agents, }, audit_log_list_params.AuditLogListParams, ), @@ -365,7 +375,9 @@ def list( resource_id: SequenceNotStr[str] | Omit = omit, search_field: str | Omit = omit, sorting: Literal["asc", "desc"] | Omit = omit, + source_user_ips: SequenceNotStr[str] | Omit = omit, to_timestamp: Union[str, datetime] | Omit = omit, + user_agents: 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, @@ -403,9 +415,15 @@ def list( sorting: (DEPRECATED Use '`order_by`' instead) Sorting by timestamp. Oldest first, or most recent first + source_user_ips: Originating IP address of the client making the request. Several options can be + specified. + to_timestamp: ISO formatted datetime string. Ending timestamp until which user actions are requested + user_agents: User-Agent string identifying the client making the request. Several options can + be specified. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -435,7 +453,9 @@ def list( "resource_id": resource_id, "search_field": search_field, "sorting": sorting, + "source_user_ips": source_user_ips, "to_timestamp": to_timestamp, + "user_agents": user_agents, }, audit_log_list_params.AuditLogListParams, ), diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 6507c906..03b39269 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -120,8 +120,8 @@ def create( name_template: If you want server names to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during provisioning. - Supported placeholders are: `{`ip_octets`}` (last 3 octets of the IP), - `{`two_ip_octets`}`, and `{`one_ip_octet`}`. + Supported placeholders are: `{ip_octets}` (last 3 octets of the IP), + `{two_ip_octets}`, and `{one_ip_octet}`. password: For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user @@ -490,8 +490,8 @@ async def create( name_template: If you want server names to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during provisioning. - Supported placeholders are: `{`ip_octets`}` (last 3 octets of the IP), - `{`two_ip_octets`}`, and `{`one_ip_octet`}`. + Supported placeholders are: `{ip_octets}` (last 3 octets of the IP), + `{two_ip_octets}`, and `{one_ip_octet}`. password: For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 025b46b5..253553dc 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -267,15 +267,20 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -742,15 +747,20 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 9ec344aa..fc9675fd 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -18,6 +18,7 @@ ) from ...pagination import SyncOffsetPage, AsyncOffsetPage from ...types.cloud import ( + FloatingIPStatus, floating_ip_list_params, floating_ip_assign_params, floating_ip_create_params, @@ -26,6 +27,7 @@ from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.floating_ip import FloatingIP from ...types.cloud.task_id_list import TaskIDList +from ...types.cloud.floating_ip_status import FloatingIPStatus from ...types.cloud.floating_ip_detailed import FloatingIPDetailed from ...types.cloud.tag_update_map_param import TagUpdateMapParam @@ -154,15 +156,20 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -196,6 +203,7 @@ def list( region_id: int | None = None, limit: int | Omit = omit, offset: int | Omit = omit, + status: FloatingIPStatus | Omit = omit, tag_key: SequenceNotStr[str] | Omit = omit, tag_key_value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -218,6 +226,9 @@ def list( offset: Optional. Offset value is used to exclude the first set of records from the result + status: Filter by floating IP status. DOWN - unassigned (available). ACTIVE - attached + to a port (in use). ERROR - error state. + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 tag_key_value: Optional. Filter by tag key-value pairs. @@ -246,6 +257,7 @@ def list( { "limit": limit, "offset": offset, + "status": status, "tag_key": tag_key, "tag_key_value": tag_key_value, }, @@ -559,15 +571,20 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -601,6 +618,7 @@ def list( region_id: int | None = None, limit: int | Omit = omit, offset: int | Omit = omit, + status: FloatingIPStatus | Omit = omit, tag_key: SequenceNotStr[str] | Omit = omit, tag_key_value: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -623,6 +641,9 @@ def list( offset: Optional. Offset value is used to exclude the first set of records from the result + status: Filter by floating IP status. DOWN - unassigned (available). ACTIVE - attached + to a port (in use). ERROR - error state. + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 tag_key_value: Optional. Filter by tag key-value pairs. @@ -651,6 +672,7 @@ def list( { "limit": limit, "offset": offset, + "status": status, "tag_key": tag_key, "tag_key_value": tag_key_value, }, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index c72bac4e..359aaa67 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -351,15 +351,20 @@ def action( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -908,15 +913,20 @@ async def action( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py b/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py index 7711ec5a..59d7b44a 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py +++ b/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py @@ -563,15 +563,20 @@ def action( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -1209,15 +1214,20 @@ async def action( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 0521e2e5..caa01442 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -109,7 +109,7 @@ def create( ValidationError will be raised. auth_enabled: Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required for the requests to the instance if enabled. This field is deprecated and will be removed in the future. Use `api_keys` field instead.If `auth_enabled` and `api_keys` are both specified, a ValidationError will be raised. @@ -214,7 +214,7 @@ def update( and auth will be disabled on the deployment. auth_enabled: Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required for the requests to the instance if enabled. This field is deprecated and will be removed in the future. Use `api_keys` field instead.If `auth_enabled` and `api_keys` are both specified, a ValidationError will be raised. @@ -635,7 +635,7 @@ async def create( ValidationError will be raised. auth_enabled: Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required for the requests to the instance if enabled. This field is deprecated and will be removed in the future. Use `api_keys` field instead.If `auth_enabled` and `api_keys` are both specified, a ValidationError will be raised. @@ -740,7 +740,7 @@ async def update( and auth will be disabled on the deployment. auth_enabled: Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required for the requests to the instance if enabled. This field is deprecated and will be removed in the future. Use `api_keys` field instead.If `auth_enabled` and `api_keys` are both specified, a ValidationError will be raised. diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 8b0ead11..d086607c 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -183,8 +183,8 @@ def create( name_template: If you want the instance name to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during - provisioning. Supported placeholders are: `{`ip_octets`}` (last 3 octets of the - IP), `{`two_ip_octets`}`, and `{`one_ip_octet`}`. + provisioning. Supported placeholders are: `{ip_octets}` (last 3 octets of the + IP), `{two_ip_octets}`, and `{one_ip_octet}`. password: For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user @@ -299,15 +299,20 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -1236,8 +1241,8 @@ async def create( name_template: If you want the instance name to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during - provisioning. Supported placeholders are: `{`ip_octets`}` (last 3 octets of the - IP), `{`two_ip_octets`}`, and `{`one_ip_octet`}`. + provisioning. Supported placeholders are: `{ip_octets}` (last 3 octets of the + IP), `{two_ip_octets}`, and `{one_ip_octet}`. password: For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user @@ -1352,15 +1357,20 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 12138750..dfca0b90 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -272,15 +272,20 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -771,15 +776,20 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 2c4ca366..64e93a05 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -176,15 +176,20 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -516,15 +521,20 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index d7879d72..f4c918c2 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -200,15 +200,20 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -597,15 +602,20 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 5961799b..5a9cc544 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -145,15 +145,20 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -517,15 +522,20 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 9c40ea2e..ba0e3c85 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -347,15 +347,20 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -1154,15 +1159,20 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index 15085076..b1ab12a5 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -91,7 +91,7 @@ def create( For example, sort records by proximity to user, shuffle based on weights and return not more than 3: - `"pickers": [ { "type": "geodistance" }, { "type": "`weighted_shuffle`" }, { "type": "`first_n`", "limit": 3 } ]` + `"pickers": [ { "type": "geodistance" }, { "type": "weighted_shuffle" }, { "type": "first_n", "limit": 3 } ]` #### geodns filter @@ -168,7 +168,7 @@ def create( `"meta": {"default": true}`. Example: - `"pickers": [ { "type": "geodns", "strict": false }, { "type": "default" }, { "type": "`first_n`", "limit": 2 } ]` + `"pickers": [ { "type": "geodns", "strict": false }, { "type": "default" }, { "type": "first_n", "limit": 2 } ]` #### geodistance mutator @@ -179,20 +179,20 @@ def create( `[52.520008, 13.404954]`.; In this configuration the only "nearest" to the requestor record to be returned: - `"pickers": [ { "type": "geodistance" }, { "type": "`first_n`", "limit": 1 } ]` + `"pickers": [ { "type": "geodistance" }, { "type": "first_n", "limit": 1 } ]` #### `weighted_shuffle` mutator The resource records are rearranged in random order based on the `weight` metadata. Default weight (if not specified) is 50. - Example: `"pickers": [ { "type": "`weighted_shuffle`" } ]` + Example: `"pickers": [ { "type": "weighted_shuffle" } ]` #### `first_n` filter Slices first N (N specified as a limit parameter value) resource records. - Example: `"pickers": [ { "type": "`first_n`", "limit": 1 } ]` returns only the + Example: `"pickers": [ { "type": "first_n", "limit": 1 } ]` returns only the first resource record. ##### limit parameter @@ -547,7 +547,7 @@ async def create( For example, sort records by proximity to user, shuffle based on weights and return not more than 3: - `"pickers": [ { "type": "geodistance" }, { "type": "`weighted_shuffle`" }, { "type": "`first_n`", "limit": 3 } ]` + `"pickers": [ { "type": "geodistance" }, { "type": "weighted_shuffle" }, { "type": "first_n", "limit": 3 } ]` #### geodns filter @@ -624,7 +624,7 @@ async def create( `"meta": {"default": true}`. Example: - `"pickers": [ { "type": "geodns", "strict": false }, { "type": "default" }, { "type": "`first_n`", "limit": 2 } ]` + `"pickers": [ { "type": "geodns", "strict": false }, { "type": "default" }, { "type": "first_n", "limit": 2 } ]` #### geodistance mutator @@ -635,20 +635,20 @@ async def create( `[52.520008, 13.404954]`.; In this configuration the only "nearest" to the requestor record to be returned: - `"pickers": [ { "type": "geodistance" }, { "type": "`first_n`", "limit": 1 } ]` + `"pickers": [ { "type": "geodistance" }, { "type": "first_n", "limit": 1 } ]` #### `weighted_shuffle` mutator The resource records are rearranged in random order based on the `weight` metadata. Default weight (if not specified) is 50. - Example: `"pickers": [ { "type": "`weighted_shuffle`" } ]` + Example: `"pickers": [ { "type": "weighted_shuffle" } ]` #### `first_n` filter Slices first N (N specified as a limit parameter value) resource records. - Example: `"pickers": [ { "type": "`first_n`", "limit": 1 } ]` returns only the + Example: `"pickers": [ { "type": "first_n", "limit": 1 } ]` returns only the first resource record. ##### limit parameter diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 765d77eb..94bf34c2 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -200,7 +200,7 @@ def list( Args: id: to pass several ids `id=1&id=3&id=5...` - client_id: to pass several `client_ids` `client_id=1&`client_id`=3&`client_id`=5...` + client_id: to pass several `client_ids` `client_id=1&client_id=3&client_id=5...` dynamic: Zones with dynamic RRsets @@ -837,7 +837,7 @@ async def list( Args: id: to pass several ids `id=1&id=3&id=5...` - client_id: to pass several `client_ids` `client_id=1&`client_id`=3&`client_id`=5...` + client_id: to pass several `client_ids` `client_id=1&client_id=3&client_id=5...` dynamic: Zones with dynamic RRsets diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py index 007d4be8..b0302fb4 100644 --- a/src/gcore/types/cdn/cdn_resource.py +++ b/src/gcore/types/cdn/cdn_resource.py @@ -187,7 +187,7 @@ class OptionsCors(BaseModel): Possible values: - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be - uploaded for requests from any domain. `"value": ["\\**"]` + uploaded for requests from any domain. `"value": ["*"]` - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. @@ -195,7 +195,7 @@ class OptionsCors(BaseModel): - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" - header in the response. `"value": ["$`http_origin`"]` + header in the response. `"value": ["$http_origin"]` """ always: Optional[bool] = None @@ -918,7 +918,7 @@ class OptionsReferrerACL(BaseModel): Examples: - `example.com` - - `\\**.example.com` + - `*.example.com` """ policy_type: Literal["allow", "deny"] @@ -1008,7 +1008,7 @@ class OptionsRewrite(BaseModel): Example: - - `/(.\\**) /media/$1` + - `/(.*) /media/$1` """ enabled: bool @@ -1461,7 +1461,7 @@ class Options(BaseModel): 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. + `"fetch_compressed": false` in the rule. """ follow_origin_redirect: Optional[OptionsFollowOriginRedirect] = None @@ -1495,8 +1495,7 @@ class Options(BaseModel): 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. + `gzipON` in rules, you need to specify `"fetch_compressed":false` for rules. """ host_header: Optional[OptionsHostHeader] = FieldInfo(alias="hostHeader", default=None) @@ -1870,13 +1869,13 @@ class CdnResource(BaseModel): proxy_ssl_ca: Optional[int] = None """ID of the trusted CA certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. """ proxy_ssl_data: Optional[int] = None """ID of the SSL certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. """ proxy_ssl_enabled: Optional[bool] = None diff --git a/src/gcore/types/cdn/resource_create_params.py b/src/gcore/types/cdn/resource_create_params.py index ce9dad10..8bbcce76 100644 --- a/src/gcore/types/cdn/resource_create_params.py +++ b/src/gcore/types/cdn/resource_create_params.py @@ -138,13 +138,13 @@ class ResourceCreateParams(TypedDict, total=False): proxy_ssl_ca: Optional[int] """ID of the trusted CA certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. """ proxy_ssl_data: Optional[int] """ID of the SSL certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. """ proxy_ssl_enabled: bool @@ -310,7 +310,7 @@ class OptionsCors(TypedDict, total=False): Possible values: - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be - uploaded for requests from any domain. `"value": ["\\**"]` + uploaded for requests from any domain. `"value": ["*"]` - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. @@ -318,7 +318,7 @@ class OptionsCors(TypedDict, total=False): - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" - header in the response. `"value": ["$`http_origin`"]` + header in the response. `"value": ["$http_origin"]` """ always: bool @@ -1041,7 +1041,7 @@ class OptionsReferrerACL(TypedDict, total=False): Examples: - `example.com` - - `\\**.example.com` + - `*.example.com` """ policy_type: Required[Literal["allow", "deny"]] @@ -1127,7 +1127,7 @@ class OptionsRewrite(TypedDict, total=False): Example: - - `/(.\\**) /media/$1` + - `/(.*) /media/$1` """ enabled: Required[bool] @@ -1582,7 +1582,7 @@ class Options(TypedDict, total=False): 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. + `"fetch_compressed": false` in the rule. """ follow_origin_redirect: Optional[OptionsFollowOriginRedirect] @@ -1616,8 +1616,7 @@ class Options(TypedDict, total=False): 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. + `gzipON` in rules, you need to specify `"fetch_compressed":false` for rules. """ host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] diff --git a/src/gcore/types/cdn/resource_purge_params.py b/src/gcore/types/cdn/resource_purge_params.py index 5342995f..f55c4797 100644 --- a/src/gcore/types/cdn/resource_purge_params.py +++ b/src/gcore/types/cdn/resource_purge_params.py @@ -43,16 +43,16 @@ class PurgeByPattern(TypedDict, total=False): paths: SequenceNotStr[str] """**Purge by pattern** clears the cache that matches the pattern. - Use \\** operator, which replaces any number of symbols in your path. It's - important to note that wildcard usage (\\**) is permitted only at the end of a + Use _ operator, which replaces any number of symbols in your path. It's + important to note that wildcard usage (_) is permitted only at the end of a pattern. Query string added to any patterns will be ignored, and purge request will be processed as if there weren't any parameters. - Purge by pattern is recursive. Both /path and /path\\** will result in recursive + Purge by pattern is recursive. Both /path and /path* will result in recursive purging, meaning all content under the specified path will be affected. As such, - using the pattern /path\\** is functionally equivalent to simply using /path. + using the pattern /path* is functionally equivalent to simply using /path. """ diff --git a/src/gcore/types/cdn/resource_replace_params.py b/src/gcore/types/cdn/resource_replace_params.py index 58e21ac4..0d888ff0 100644 --- a/src/gcore/types/cdn/resource_replace_params.py +++ b/src/gcore/types/cdn/resource_replace_params.py @@ -116,13 +116,13 @@ class ResourceReplaceParams(TypedDict, total=False): proxy_ssl_ca: Optional[int] """ID of the trusted CA certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. """ proxy_ssl_data: Optional[int] """ID of the SSL certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. """ proxy_ssl_enabled: bool @@ -288,7 +288,7 @@ class OptionsCors(TypedDict, total=False): Possible values: - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be - uploaded for requests from any domain. `"value": ["\\**"]` + uploaded for requests from any domain. `"value": ["*"]` - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. @@ -296,7 +296,7 @@ class OptionsCors(TypedDict, total=False): - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" - header in the response. `"value": ["$`http_origin`"]` + header in the response. `"value": ["$http_origin"]` """ always: bool @@ -1019,7 +1019,7 @@ class OptionsReferrerACL(TypedDict, total=False): Examples: - `example.com` - - `\\**.example.com` + - `*.example.com` """ policy_type: Required[Literal["allow", "deny"]] @@ -1105,7 +1105,7 @@ class OptionsRewrite(TypedDict, total=False): Example: - - `/(.\\**) /media/$1` + - `/(.*) /media/$1` """ enabled: Required[bool] @@ -1560,7 +1560,7 @@ class Options(TypedDict, total=False): 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. + `"fetch_compressed": false` in the rule. """ follow_origin_redirect: Optional[OptionsFollowOriginRedirect] @@ -1594,8 +1594,7 @@ class Options(TypedDict, total=False): 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. + `gzipON` in rules, you need to specify `"fetch_compressed":false` for rules. """ host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] diff --git a/src/gcore/types/cdn/resource_update_params.py b/src/gcore/types/cdn/resource_update_params.py index a382bda2..2a8bd492 100644 --- a/src/gcore/types/cdn/resource_update_params.py +++ b/src/gcore/types/cdn/resource_update_params.py @@ -116,13 +116,13 @@ class ResourceUpdateParams(TypedDict, total=False): proxy_ssl_ca: Optional[int] """ID of the trusted CA certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. """ proxy_ssl_data: Optional[int] """ID of the SSL certificate used to verify an origin. - It can be used only with `"`proxy_ssl_enabled`": true`. + It can be used only with `"proxy_ssl_enabled": true`. """ proxy_ssl_enabled: bool @@ -279,7 +279,7 @@ class OptionsCors(TypedDict, total=False): Possible values: - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be - uploaded for requests from any domain. `"value": ["\\**"]` + uploaded for requests from any domain. `"value": ["*"]` - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. @@ -287,7 +287,7 @@ class OptionsCors(TypedDict, total=False): - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" - header in the response. `"value": ["$`http_origin`"]` + header in the response. `"value": ["$http_origin"]` """ always: bool @@ -1010,7 +1010,7 @@ class OptionsReferrerACL(TypedDict, total=False): Examples: - `example.com` - - `\\**.example.com` + - `*.example.com` """ policy_type: Required[Literal["allow", "deny"]] @@ -1096,7 +1096,7 @@ class OptionsRewrite(TypedDict, total=False): Example: - - `/(.\\**) /media/$1` + - `/(.*) /media/$1` """ enabled: Required[bool] @@ -1551,7 +1551,7 @@ class Options(TypedDict, total=False): 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. + `"fetch_compressed": false` in the rule. """ follow_origin_redirect: Optional[OptionsFollowOriginRedirect] @@ -1585,8 +1585,7 @@ class Options(TypedDict, total=False): 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. + `gzipON` in rules, you need to specify `"fetch_compressed":false` for rules. """ host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] diff --git a/src/gcore/types/cdn/resources/cdn_resource_rule.py b/src/gcore/types/cdn/resources/cdn_resource_rule.py index 8f66f00c..268172bc 100644 --- a/src/gcore/types/cdn/resources/cdn_resource_rule.py +++ b/src/gcore/types/cdn/resources/cdn_resource_rule.py @@ -182,7 +182,7 @@ class OptionsCors(BaseModel): Possible values: - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be - uploaded for requests from any domain. `"value": ["\\**"]` + uploaded for requests from any domain. `"value": ["*"]` - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. @@ -190,7 +190,7 @@ class OptionsCors(BaseModel): - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" - header in the response. `"value": ["$`http_origin`"]` + header in the response. `"value": ["$http_origin"]` """ always: Optional[bool] = None @@ -895,7 +895,7 @@ class OptionsReferrerACL(BaseModel): Examples: - `example.com` - - `\\**.example.com` + - `*.example.com` """ policy_type: Literal["allow", "deny"] @@ -985,7 +985,7 @@ class OptionsRewrite(BaseModel): Example: - - `/(.\\**) /media/$1` + - `/(.*) /media/$1` """ enabled: bool @@ -1369,7 +1369,7 @@ class Options(BaseModel): 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. + `"fetch_compressed": false` in the rule. """ follow_origin_redirect: Optional[OptionsFollowOriginRedirect] = None @@ -1403,8 +1403,7 @@ class Options(BaseModel): 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. + `gzipON` in rules, you need to specify `"fetch_compressed":false` for rules. """ host_header: Optional[OptionsHostHeader] = FieldInfo(alias="hostHeader", default=None) diff --git a/src/gcore/types/cdn/resources/rule_create_params.py b/src/gcore/types/cdn/resources/rule_create_params.py index 4d80f7c6..ca1e05a9 100644 --- a/src/gcore/types/cdn/resources/rule_create_params.py +++ b/src/gcore/types/cdn/resources/rule_create_params.py @@ -258,7 +258,7 @@ class OptionsCors(TypedDict, total=False): Possible values: - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be - uploaded for requests from any domain. `"value": ["\\**"]` + uploaded for requests from any domain. `"value": ["*"]` - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. @@ -266,7 +266,7 @@ class OptionsCors(TypedDict, total=False): - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" - header in the response. `"value": ["$`http_origin`"]` + header in the response. `"value": ["$http_origin"]` """ always: bool @@ -971,7 +971,7 @@ class OptionsReferrerACL(TypedDict, total=False): Examples: - `example.com` - - `\\**.example.com` + - `*.example.com` """ policy_type: Required[Literal["allow", "deny"]] @@ -1057,7 +1057,7 @@ class OptionsRewrite(TypedDict, total=False): Example: - - `/(.\\**) /media/$1` + - `/(.*) /media/$1` """ enabled: Required[bool] @@ -1443,7 +1443,7 @@ class Options(TypedDict, total=False): 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. + `"fetch_compressed": false` in the rule. """ follow_origin_redirect: Optional[OptionsFollowOriginRedirect] @@ -1477,8 +1477,7 @@ class Options(TypedDict, total=False): 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. + `gzipON` in rules, you need to specify `"fetch_compressed":false` for rules. """ host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] diff --git a/src/gcore/types/cdn/resources/rule_replace_params.py b/src/gcore/types/cdn/resources/rule_replace_params.py index c6bf65cc..c1bf7fea 100644 --- a/src/gcore/types/cdn/resources/rule_replace_params.py +++ b/src/gcore/types/cdn/resources/rule_replace_params.py @@ -260,7 +260,7 @@ class OptionsCors(TypedDict, total=False): Possible values: - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be - uploaded for requests from any domain. `"value": ["\\**"]` + uploaded for requests from any domain. `"value": ["*"]` - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. @@ -268,7 +268,7 @@ class OptionsCors(TypedDict, total=False): - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" - header in the response. `"value": ["$`http_origin`"]` + header in the response. `"value": ["$http_origin"]` """ always: bool @@ -973,7 +973,7 @@ class OptionsReferrerACL(TypedDict, total=False): Examples: - `example.com` - - `\\**.example.com` + - `*.example.com` """ policy_type: Required[Literal["allow", "deny"]] @@ -1059,7 +1059,7 @@ class OptionsRewrite(TypedDict, total=False): Example: - - `/(.\\**) /media/$1` + - `/(.*) /media/$1` """ enabled: Required[bool] @@ -1445,7 +1445,7 @@ class Options(TypedDict, total=False): 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. + `"fetch_compressed": false` in the rule. """ follow_origin_redirect: Optional[OptionsFollowOriginRedirect] @@ -1479,8 +1479,7 @@ class Options(TypedDict, total=False): 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. + `gzipON` in rules, you need to specify `"fetch_compressed":false` for rules. """ host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] diff --git a/src/gcore/types/cdn/resources/rule_update_params.py b/src/gcore/types/cdn/resources/rule_update_params.py index e04e0c93..24b47a1b 100644 --- a/src/gcore/types/cdn/resources/rule_update_params.py +++ b/src/gcore/types/cdn/resources/rule_update_params.py @@ -260,7 +260,7 @@ class OptionsCors(TypedDict, total=False): Possible values: - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be - uploaded for requests from any domain. `"value": ["\\**"]` + uploaded for requests from any domain. `"value": ["*"]` - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. @@ -268,7 +268,7 @@ class OptionsCors(TypedDict, total=False): - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" - header in the response. `"value": ["$`http_origin`"]` + header in the response. `"value": ["$http_origin"]` """ always: bool @@ -973,7 +973,7 @@ class OptionsReferrerACL(TypedDict, total=False): Examples: - `example.com` - - `\\**.example.com` + - `*.example.com` """ policy_type: Required[Literal["allow", "deny"]] @@ -1059,7 +1059,7 @@ class OptionsRewrite(TypedDict, total=False): Example: - - `/(.\\**) /media/$1` + - `/(.*) /media/$1` """ enabled: Required[bool] @@ -1445,7 +1445,7 @@ class Options(TypedDict, total=False): 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. + `"fetch_compressed": false` in the rule. """ follow_origin_redirect: Optional[OptionsFollowOriginRedirect] @@ -1479,8 +1479,7 @@ class Options(TypedDict, total=False): 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. + `gzipON` in rules, you need to specify `"fetch_compressed":false` for rules. """ host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] diff --git a/src/gcore/types/cdn/rule_template.py b/src/gcore/types/cdn/rule_template.py index 1d7b8693..d42b39f1 100644 --- a/src/gcore/types/cdn/rule_template.py +++ b/src/gcore/types/cdn/rule_template.py @@ -182,7 +182,7 @@ class OptionsCors(BaseModel): Possible values: - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be - uploaded for requests from any domain. `"value": ["\\**"]` + uploaded for requests from any domain. `"value": ["*"]` - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. @@ -190,7 +190,7 @@ class OptionsCors(BaseModel): - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" - header in the response. `"value": ["$`http_origin`"]` + header in the response. `"value": ["$http_origin"]` """ always: Optional[bool] = None @@ -895,7 +895,7 @@ class OptionsReferrerACL(BaseModel): Examples: - `example.com` - - `\\**.example.com` + - `*.example.com` """ policy_type: Literal["allow", "deny"] @@ -985,7 +985,7 @@ class OptionsRewrite(BaseModel): Example: - - `/(.\\**) /media/$1` + - `/(.*) /media/$1` """ enabled: bool @@ -1369,7 +1369,7 @@ class Options(BaseModel): 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. + `"fetch_compressed": false` in the rule. """ follow_origin_redirect: Optional[OptionsFollowOriginRedirect] = None @@ -1403,8 +1403,7 @@ class Options(BaseModel): 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. + `gzipON` in rules, you need to specify `"fetch_compressed":false` for rules. """ host_header: Optional[OptionsHostHeader] = FieldInfo(alias="hostHeader", default=None) diff --git a/src/gcore/types/cdn/rule_template_create_params.py b/src/gcore/types/cdn/rule_template_create_params.py index 30d52eba..7c9c0fbb 100644 --- a/src/gcore/types/cdn/rule_template_create_params.py +++ b/src/gcore/types/cdn/rule_template_create_params.py @@ -242,7 +242,7 @@ class OptionsCors(TypedDict, total=False): Possible values: - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be - uploaded for requests from any domain. `"value": ["\\**"]` + uploaded for requests from any domain. `"value": ["*"]` - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. @@ -250,7 +250,7 @@ class OptionsCors(TypedDict, total=False): - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" - header in the response. `"value": ["$`http_origin`"]` + header in the response. `"value": ["$http_origin"]` """ always: bool @@ -955,7 +955,7 @@ class OptionsReferrerACL(TypedDict, total=False): Examples: - `example.com` - - `\\**.example.com` + - `*.example.com` """ policy_type: Required[Literal["allow", "deny"]] @@ -1041,7 +1041,7 @@ class OptionsRewrite(TypedDict, total=False): Example: - - `/(.\\**) /media/$1` + - `/(.*) /media/$1` """ enabled: Required[bool] @@ -1427,7 +1427,7 @@ class Options(TypedDict, total=False): 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. + `"fetch_compressed": false` in the rule. """ follow_origin_redirect: Optional[OptionsFollowOriginRedirect] @@ -1461,8 +1461,7 @@ class Options(TypedDict, total=False): 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. + `gzipON` in rules, you need to specify `"fetch_compressed":false` for rules. """ host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] diff --git a/src/gcore/types/cdn/rule_template_replace_params.py b/src/gcore/types/cdn/rule_template_replace_params.py index ccb47c56..d0790a32 100644 --- a/src/gcore/types/cdn/rule_template_replace_params.py +++ b/src/gcore/types/cdn/rule_template_replace_params.py @@ -242,7 +242,7 @@ class OptionsCors(TypedDict, total=False): Possible values: - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be - uploaded for requests from any domain. `"value": ["\\**"]` + uploaded for requests from any domain. `"value": ["*"]` - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. @@ -250,7 +250,7 @@ class OptionsCors(TypedDict, total=False): - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" - header in the response. `"value": ["$`http_origin`"]` + header in the response. `"value": ["$http_origin"]` """ always: bool @@ -955,7 +955,7 @@ class OptionsReferrerACL(TypedDict, total=False): Examples: - `example.com` - - `\\**.example.com` + - `*.example.com` """ policy_type: Required[Literal["allow", "deny"]] @@ -1041,7 +1041,7 @@ class OptionsRewrite(TypedDict, total=False): Example: - - `/(.\\**) /media/$1` + - `/(.*) /media/$1` """ enabled: Required[bool] @@ -1427,7 +1427,7 @@ class Options(TypedDict, total=False): 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. + `"fetch_compressed": false` in the rule. """ follow_origin_redirect: Optional[OptionsFollowOriginRedirect] @@ -1461,8 +1461,7 @@ class Options(TypedDict, total=False): 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. + `gzipON` in rules, you need to specify `"fetch_compressed":false` for rules. """ host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] diff --git a/src/gcore/types/cdn/rule_template_update_params.py b/src/gcore/types/cdn/rule_template_update_params.py index 2be5eb7e..eb5be71b 100644 --- a/src/gcore/types/cdn/rule_template_update_params.py +++ b/src/gcore/types/cdn/rule_template_update_params.py @@ -242,7 +242,7 @@ class OptionsCors(TypedDict, total=False): Possible values: - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be - uploaded for requests from any domain. `"value": ["\\**"]` + uploaded for requests from any domain. `"value": ["*"]` - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. @@ -250,7 +250,7 @@ class OptionsCors(TypedDict, total=False): - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" - header in the response. `"value": ["$`http_origin`"]` + header in the response. `"value": ["$http_origin"]` """ always: bool @@ -955,7 +955,7 @@ class OptionsReferrerACL(TypedDict, total=False): Examples: - `example.com` - - `\\**.example.com` + - `*.example.com` """ policy_type: Required[Literal["allow", "deny"]] @@ -1041,7 +1041,7 @@ class OptionsRewrite(TypedDict, total=False): Example: - - `/(.\\**) /media/$1` + - `/(.*) /media/$1` """ enabled: Required[bool] @@ -1427,7 +1427,7 @@ class Options(TypedDict, total=False): 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. + `"fetch_compressed": false` in the rule. """ follow_origin_redirect: Optional[OptionsFollowOriginRedirect] @@ -1461,8 +1461,7 @@ class Options(TypedDict, total=False): 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. + `gzipON` in rules, you need to specify `"fetch_compressed":false` for rules. """ host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] diff --git a/src/gcore/types/cloud/audit_log_entry.py b/src/gcore/types/cloud/audit_log_entry.py index 810184ea..3dd7ea87 100644 --- a/src/gcore/types/cloud/audit_log_entry.py +++ b/src/gcore/types/cloud/audit_log_entry.py @@ -238,6 +238,9 @@ class AuditLogEntry(BaseModel): resources: List[Resource] """Resources""" + source_user_ip: Optional[str] = None + """User IP that made the request""" + task_id: Optional[str] = None """Task ID""" @@ -250,5 +253,8 @@ class AuditLogEntry(BaseModel): total_price: Optional[TotalPrice] = None """Total resource price VAT inclusive""" + user_agent: Optional[str] = None + """User-Agent that made the request""" + user_id: int """User ID""" diff --git a/src/gcore/types/cloud/audit_log_list_params.py b/src/gcore/types/cloud/audit_log_list_params.py index 09a75554..cec69e6a 100644 --- a/src/gcore/types/cloud/audit_log_list_params.py +++ b/src/gcore/types/cloud/audit_log_list_params.py @@ -152,8 +152,20 @@ class AuditLogListParams(TypedDict, total=False): Oldest first, or most recent first """ + source_user_ips: SequenceNotStr[str] + """Originating IP address of the client making the request. + + Several options can be specified. + """ + to_timestamp: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ISO formatted datetime string. Ending timestamp until which user actions are requested """ + + user_agents: SequenceNotStr[str] + """User-Agent string identifying the client making the request. + + Several options can be specified. + """ diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index ba70700a..fb749577 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -67,8 +67,8 @@ class ServerCreateParams(TypedDict, total=False): If you want server names to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during provisioning. - Supported placeholders are: `{`ip_octets`}` (last 3 octets of the IP), - `{`two_ip_octets`}`, and `{`one_ip_octet`}`. + Supported placeholders are: `{ip_octets}` (last 3 octets of the IP), + `{two_ip_octets}`, and `{one_ip_octet}`. """ password: str diff --git a/src/gcore/types/cloud/file_share_update_params.py b/src/gcore/types/cloud/file_share_update_params.py index fc03f7c5..ca8df7d9 100644 --- a/src/gcore/types/cloud/file_share_update_params.py +++ b/src/gcore/types/cloud/file_share_update_params.py @@ -35,15 +35,20 @@ class FileShareUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/floating_ip.py b/src/gcore/types/cloud/floating_ip.py index 61d3995d..6d7cb0d1 100644 --- a/src/gcore/types/cloud/floating_ip.py +++ b/src/gcore/types/cloud/floating_ip.py @@ -45,7 +45,11 @@ class FloatingIP(BaseModel): """Router ID""" status: Optional[FloatingIPStatus] = None - """Floating IP status""" + """Floating IP status. + + DOWN - unassigned (available). ACTIVE - attached to a port (in use). ERROR - + error state. + """ tags: List[Tag] """List of key-value tags associated with the resource. diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index 1692fc87..41f9ad36 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -190,7 +190,11 @@ class FloatingIPDetailed(BaseModel): """Router ID""" status: Optional[FloatingIPStatus] = None - """Floating IP status""" + """Floating IP status. + + DOWN - unassigned (available). ACTIVE - attached to a port (in use). ERROR - + error state. + """ tags: List[Tag] """List of key-value tags associated with the resource. diff --git a/src/gcore/types/cloud/floating_ip_list_params.py b/src/gcore/types/cloud/floating_ip_list_params.py index 97017a38..4eb3b7e2 100644 --- a/src/gcore/types/cloud/floating_ip_list_params.py +++ b/src/gcore/types/cloud/floating_ip_list_params.py @@ -5,6 +5,7 @@ from typing_extensions import TypedDict from ..._types import SequenceNotStr +from .floating_ip_status import FloatingIPStatus __all__ = ["FloatingIPListParams"] @@ -25,6 +26,13 @@ class FloatingIPListParams(TypedDict, total=False): Offset value is used to exclude the first set of records from the result """ + status: FloatingIPStatus + """Filter by floating IP status. + + DOWN - unassigned (available). ACTIVE - attached to a port (in use). ERROR - + error state. + """ + tag_key: SequenceNotStr[str] """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" diff --git a/src/gcore/types/cloud/floating_ip_update_params.py b/src/gcore/types/cloud/floating_ip_update_params.py index 59b962fe..13dfa1d0 100644 --- a/src/gcore/types/cloud/floating_ip_update_params.py +++ b/src/gcore/types/cloud/floating_ip_update_params.py @@ -29,15 +29,20 @@ class FloatingIPUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py index 66c88a9f..506d3619 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py @@ -32,15 +32,20 @@ class GPUBaremetalClusterActionParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_action_params.py b/src/gcore/types/cloud/gpu_virtual_cluster_action_params.py index 0c5f99b8..9319deff 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_action_params.py +++ b/src/gcore/types/cloud/gpu_virtual_cluster_action_params.py @@ -84,15 +84,20 @@ class UpdateTagsGPUClusterSerializer(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/inference/deployment_create_params.py b/src/gcore/types/cloud/inference/deployment_create_params.py index 9886738e..ace2531f 100644 --- a/src/gcore/types/cloud/inference/deployment_create_params.py +++ b/src/gcore/types/cloud/inference/deployment_create_params.py @@ -75,7 +75,7 @@ class DeploymentCreateParams(TypedDict, total=False): auth_enabled: bool """Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required for the requests to the instance if enabled. This field is deprecated and will be removed in the future. Use `api_keys` field instead.If `auth_enabled` and `api_keys` are both specified, a ValidationError will be raised. diff --git a/src/gcore/types/cloud/inference/deployment_update_params.py b/src/gcore/types/cloud/inference/deployment_update_params.py index 047799c7..26b2042d 100644 --- a/src/gcore/types/cloud/inference/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -56,7 +56,7 @@ class DeploymentUpdateParams(TypedDict, total=False): auth_enabled: bool """Set to `true` to enable API key authentication for the inference instance. - `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required for the requests to the instance if enabled. This field is deprecated and will be removed in the future. Use `api_keys` field instead.If `auth_enabled` and `api_keys` are both specified, a ValidationError will be raised. diff --git a/src/gcore/types/cloud/inference/inference_deployment.py b/src/gcore/types/cloud/inference/inference_deployment.py index bd0ab822..bc24f8d1 100644 --- a/src/gcore/types/cloud/inference/inference_deployment.py +++ b/src/gcore/types/cloud/inference/inference_deployment.py @@ -184,7 +184,7 @@ class InferenceDeployment(BaseModel): auth_enabled: bool """`true` if instance uses API key authentication. - `"Authorization": "Bearer ****\\**"` or `"X-Api-Key": "****\\**"` header is required + `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required for the requests to the instance if enabled. """ diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index b2acd4a1..0362ecb1 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -77,8 +77,8 @@ class InstanceCreateParams(TypedDict, total=False): If you want the instance name to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during - provisioning. Supported placeholders are: `{`ip_octets`}` (last 3 octets of the - IP), `{`two_ip_octets`}`, and `{`one_ip_octet`}`. + provisioning. Supported placeholders are: `{ip_octets}` (last 3 octets of the + IP), `{two_ip_octets}`, and `{one_ip_octet}`. """ password: str diff --git a/src/gcore/types/cloud/instance_update_params.py b/src/gcore/types/cloud/instance_update_params.py index a04fb983..78235205 100644 --- a/src/gcore/types/cloud/instance_update_params.py +++ b/src/gcore/types/cloud/instance_update_params.py @@ -32,15 +32,20 @@ class InstanceUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py index 0870d49c..28fa42f9 100644 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -41,15 +41,20 @@ class LoadBalancerUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/network_update_params.py b/src/gcore/types/cloud/network_update_params.py index 76a08699..8f9f5b85 100644 --- a/src/gcore/types/cloud/network_update_params.py +++ b/src/gcore/types/cloud/network_update_params.py @@ -32,15 +32,20 @@ class NetworkUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index 122b546d..0a79030b 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -50,15 +50,20 @@ class SubnetUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/security_group_update_params.py b/src/gcore/types/cloud/security_group_update_params.py index dbc8fa10..d085c208 100644 --- a/src/gcore/types/cloud/security_group_update_params.py +++ b/src/gcore/types/cloud/security_group_update_params.py @@ -33,15 +33,20 @@ class SecurityGroupUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/task_id_list.py b/src/gcore/types/cloud/task_id_list.py index 7796e645..a4ad68d2 100644 --- a/src/gcore/types/cloud/task_id_list.py +++ b/src/gcore/types/cloud/task_id_list.py @@ -13,7 +13,7 @@ class TaskIDList(BaseModel): Use these IDs to monitor operation progress: - - `GET /v1/tasks/{`task_id`}` - Check individual task status and details Poll - task status until completion (`FINISHED`/`ERROR`) before proceeding with - dependent operations. + - `GET /v1/tasks/{task_id}` - Check individual task status and details Poll task + status until completion (`FINISHED`/`ERROR`) before proceeding with dependent + operations. """ diff --git a/src/gcore/types/cloud/volume_update_params.py b/src/gcore/types/cloud/volume_update_params.py index cf8b7815..09cf5e3f 100644 --- a/src/gcore/types/cloud/volume_update_params.py +++ b/src/gcore/types/cloud/volume_update_params.py @@ -32,15 +32,20 @@ class VolumeUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. + - **Mixed operations:** - `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates 'environment' and '`cost_center`' while removing '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/dns/zone_list_params.py b/src/gcore/types/dns/zone_list_params.py index 256ed922..1bee33db 100644 --- a/src/gcore/types/dns/zone_list_params.py +++ b/src/gcore/types/dns/zone_list_params.py @@ -19,7 +19,7 @@ class ZoneListParams(TypedDict, total=False): case_sensitive: bool client_id: Iterable[int] - """to pass several `client_ids` `client_id=1&`client_id`=3&`client_id`=5...`""" + """to pass several `client_ids` `client_id=1&client_id=3&client_id=5...`""" dynamic: bool """Zones with dynamic RRsets""" diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py index 8db7262a..9a43c77c 100644 --- a/src/gcore/types/streaming/stream.py +++ b/src/gcore/types/streaming/stream.py @@ -359,8 +359,9 @@ class Stream(BaseModel): Small latency values may lead to packet loss when jitter or retransmissions occur, while very large values introduce unnecessary end-to-end delay. - \\**Incorrect or low default value is one of the most common reasons for packet - loss, frames loss, and bad picture.\\** + + _Incorrect or low default value is one of the most common reasons for packet + loss, frames loss, and bad picture._ We therefore recommend setting latency manually rather than relying on the default, to ensure the buffer is correctly sized for your environment. A diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py index 9af59437..30c725c2 100644 --- a/src/gcore/types/streaming/video.py +++ b/src/gcore/types/streaming/video.py @@ -468,7 +468,7 @@ class Video(BaseModel): video. It is unique for each video, generated randomly and set automatically by the system. - Format of usage in URL is \\**.../videos/{`client_id`}\\__{slug}/...\\** + Format of usage in URL is _.../videos/{`client_id`}\\__{slug}/..._ Example: 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 cdd1397d..19c17b6d 100644 --- a/src/gcore/types/waap/domains/custom_rule_create_params.py +++ b/src/gcore/types/waap/domains/custom_rule_create_params.py @@ -279,7 +279,7 @@ class ConditionURL(TypedDict, total=False): `match_type`: - **Exact/Contains**: plain text matching (e.g., `/admin`, must comply with - `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))\\*\\++,=\\//\\--\\..\\%%]+$`). + `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))*\\++,=\\//\\--\\..\\%%]+$`). - **Regex**: a valid regular expression (e.g., `^/upload(/\\dd+)?/\\ww+`). Lookahead/lookbehind constructs are forbidden. """ 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 b9144fba..7a1ec114 100644 --- a/src/gcore/types/waap/domains/custom_rule_update_params.py +++ b/src/gcore/types/waap/domains/custom_rule_update_params.py @@ -279,7 +279,7 @@ class ConditionURL(TypedDict, total=False): `match_type`: - **Exact/Contains**: plain text matching (e.g., `/admin`, must comply with - `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))\\*\\++,=\\//\\--\\..\\%%]+$`). + `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))*\\++,=\\//\\--\\..\\%%]+$`). - **Regex**: a valid regular expression (e.g., `^/upload(/\\dd+)?/\\ww+`). Lookahead/lookbehind constructs are forbidden. """ diff --git a/src/gcore/types/waap/domains/waap_custom_rule.py b/src/gcore/types/waap/domains/waap_custom_rule.py index 0a3ba958..25bc3234 100644 --- a/src/gcore/types/waap/domains/waap_custom_rule.py +++ b/src/gcore/types/waap/domains/waap_custom_rule.py @@ -257,7 +257,7 @@ class ConditionURL(BaseModel): `match_type`: - **Exact/Contains**: plain text matching (e.g., `/admin`, must comply with - `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))\\*\\++,=\\//\\--\\..\\%%]+$`). + `^[\\ww!\\$$~:#\\[[\\]]@\\((\\))*\\++,=\\//\\--\\..\\%%]+$`). - **Regex**: a valid regular expression (e.g., `^/upload(/\\dd+)?/\\ww+`). Lookahead/lookbehind constructs are forbidden. """ diff --git a/tests/api_resources/cloud/test_audit_logs.py b/tests/api_resources/cloud/test_audit_logs.py index 60dd5b14..924f869c 100644 --- a/tests/api_resources/cloud/test_audit_logs.py +++ b/tests/api_resources/cloud/test_audit_logs.py @@ -38,7 +38,9 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: resource_id=["string"], search_field="default", sorting="asc", + source_user_ips=["203.0.113.42", "192.168.1.100"], to_timestamp=parse_datetime("2019-11-14T10:30:32Z"), + user_agents=["Mozilla/5.0", "MyApp/1.0.0"], ) assert_matches_type(SyncOffsetPage[AuditLogEntry], audit_log, path=["response"]) @@ -87,7 +89,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No resource_id=["string"], search_field="default", sorting="asc", + source_user_ips=["203.0.113.42", "192.168.1.100"], to_timestamp=parse_datetime("2019-11-14T10:30:32Z"), + user_agents=["Mozilla/5.0", "MyApp/1.0.0"], ) assert_matches_type(AsyncOffsetPage[AuditLogEntry], audit_log, path=["response"]) diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index 4b31820b..9768e23c 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -138,6 +138,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: region_id=1, limit=1000, offset=0, + status="ACTIVE", tag_key=["key1", "key2"], tag_key_value="tag_key_value", ) @@ -490,6 +491,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No region_id=1, limit=1000, offset=0, + status="ACTIVE", tag_key=["key1", "key2"], tag_key_value="tag_key_value", ) From 7e994b9313affa9aa6a0da4fd8bcc0c2457643f5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Nov 2025 10:37:53 +0000 Subject: [PATCH 435/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0c2ecec6..86b0e83d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.20.0" + ".": "0.21.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 51ecde25..5db643b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.20.0" +version = "0.21.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 0013e79a..13d7c069 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.20.0" # x-release-please-version +__version__ = "0.21.0" # x-release-please-version From a319d08c0dcea18911fc6dd2d0cd16feeb3f10b5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Nov 2025 11:27:46 +0000 Subject: [PATCH 436/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index cd19e79d..d2606ec3 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-9377b474dea790cb05261b341252967ecb7791d5aa9b102f2241a8b8826c11ab.yml -openapi_spec_hash: c6a8c5e78604079deb242a0dd3d48cba +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5468c6beef9ec273f80b4c12dfa31af101e0ef3fb5a32a20d7675bc1eea40620.yml +openapi_spec_hash: cf374448dbbb1a63b0cb2fcbd94589f8 config_hash: 814c5f622b6b26a5556a87031051c797 From 0f5a51c6656784403c52e6bb7195ee248758a84b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Nov 2025 14:52:29 +0000 Subject: [PATCH 437/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index d2606ec3..ec9da4d2 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-5468c6beef9ec273f80b4c12dfa31af101e0ef3fb5a32a20d7675bc1eea40620.yml openapi_spec_hash: cf374448dbbb1a63b0cb2fcbd94589f8 -config_hash: 814c5f622b6b26a5556a87031051c797 +config_hash: a48f94af0acd513b236dad03133f50f5 From 411d14b33ad6e5784d0e03b42f8e4e697420d559 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Nov 2025 12:15:32 +0000 Subject: [PATCH 438/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- .../resources/cloud/load_balancers/load_balancers.py | 10 ++++++---- src/gcore/types/cloud/load_balancer_create_params.py | 7 +++++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index ec9da4d2..b6da1be3 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-5468c6beef9ec273f80b4c12dfa31af101e0ef3fb5a32a20d7675bc1eea40620.yml -openapi_spec_hash: cf374448dbbb1a63b0cb2fcbd94589f8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-dc39841098bc6fb985a13b618df8431116df6fb1aaac9155c05c10a01ca44de0.yml +openapi_spec_hash: a1c1b5a15ec7da96b01925220c1715ca config_hash: a48f94af0acd513b236dad03133f50f5 diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index dfca0b90..b53f3b4e 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -166,9 +166,10 @@ def create( logging: Logging configuration - name: Load balancer name + name: Load balancer name. Either `name` or `name_template` should be specified. - name_template: Load balancer name which will be changed by template. + name_template: Load balancer name which will be changed by template. Either `name` or + `name_template` should be specified. preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools members. L2 provides best performance, L3 provides less IPs usage. It is taking @@ -670,9 +671,10 @@ async def create( logging: Logging configuration - name: Load balancer name + name: Load balancer name. Either `name` or `name_template` should be specified. - name_template: Load balancer name which will be changed by template. + name_template: Load balancer name which will be changed by template. Either `name` or + `name_template` should be specified. preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools members. L2 provides best performance, L3 provides less IPs usage. It is taking diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 28429738..4a635ca3 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -52,10 +52,13 @@ class LoadBalancerCreateParams(TypedDict, total=False): """Logging configuration""" name: str - """Load balancer name""" + """Load balancer name. Either `name` or `name_template` should be specified.""" name_template: str - """Load balancer name which will be changed by template.""" + """Load balancer name which will be changed by template. + + Either `name` or `name_template` should be specified. + """ preferred_connectivity: LoadBalancerMemberConnectivity """ From a5926d2dc82e9f2e74852fb3a1938f5038110423 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Nov 2025 16:28:43 +0000 Subject: [PATCH 439/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index b6da1be3..39053948 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-dc39841098bc6fb985a13b618df8431116df6fb1aaac9155c05c10a01ca44de0.yml openapi_spec_hash: a1c1b5a15ec7da96b01925220c1715ca -config_hash: a48f94af0acd513b236dad03133f50f5 +config_hash: 8d6e241ecf37049888c3c2d7b8ec38d3 From 302753fd9b5f212471f5aa87cdc16580f53938e3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Nov 2025 16:11:51 +0000 Subject: [PATCH 440/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 24 +- .../load_balancers/l7_policies/l7_policies.py | 1046 ++++++++++++++--- .../cloud/load_balancers/l7_policies/rules.py | 128 +- src/gcore/resources/cloud/ssh_keys.py | 10 + src/gcore/types/cloud/__init__.py | 4 - .../cloud/load_balancer_l7_policy_list.py | 16 - .../types/cloud/load_balancer_l7_rule_list.py | 16 - .../types/cloud/load_balancers/__init__.py | 2 + .../load_balancers/l7_policies/__init__.py | 2 + .../l7_policies/rule_create_params.py | 15 +- .../l7_policies/rule_get_response.py} | 43 +- .../l7_policies/rule_list_response.py | 71 ++ .../l7_policies/rule_replace_params.py | 18 +- .../load_balancers/l7_policy_create_params.py | 120 +- .../l7_policy_get_response.py} | 49 +- .../load_balancers/l7_policy_list_response.py | 107 ++ .../l7_policy_replace_params.py | 110 +- src/gcore/types/cloud/ssh_key_list_params.py | 7 + src/gcore/types/iam/api_token_create.py | 71 +- .../load_balancers/l7_policies/test_rules.py | 404 ++++--- .../cloud/load_balancers/test_l7_policies.py | 1040 +++++++++++++--- tests/api_resources/cloud/test_ssh_keys.py | 2 + 23 files changed, 2652 insertions(+), 657 deletions(-) delete mode 100644 src/gcore/types/cloud/load_balancer_l7_policy_list.py delete mode 100644 src/gcore/types/cloud/load_balancer_l7_rule_list.py rename src/gcore/types/cloud/{load_balancer_l7_rule.py => load_balancers/l7_policies/rule_get_response.py} (53%) create mode 100644 src/gcore/types/cloud/load_balancers/l7_policies/rule_list_response.py rename src/gcore/types/cloud/{load_balancer_l7_policy.py => load_balancers/l7_policy_get_response.py} (68%) create mode 100644 src/gcore/types/cloud/load_balancers/l7_policy_list_response.py diff --git a/.stats.yml b/.stats.yml index 39053948..46bf2109 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-dc39841098bc6fb985a13b618df8431116df6fb1aaac9155c05c10a01ca44de0.yml -openapi_spec_hash: a1c1b5a15ec7da96b01925220c1715ca +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7450831dcb145c2b5eb10805035c43d581849e4e1275084f861e0b16a6cd9590.yml +openapi_spec_hash: 89399bb5359562184e8ac9c59425daf3 config_hash: 8d6e241ecf37049888c3c2d7b8ec38d3 diff --git a/api.md b/api.md index 6158d8b8..c6903489 100644 --- a/api.md +++ b/api.md @@ -188,10 +188,6 @@ from gcore.types.cloud import ( ListenerStatus, LoadBalancerFlavorDetail, LoadBalancerFlavorList, - LoadBalancerL7Policy, - LoadBalancerL7PolicyList, - LoadBalancerL7Rule, - LoadBalancerL7RuleList, LoadBalancerListenerDetail, LoadBalancerListenerList, LoadBalancerMetrics, @@ -219,22 +215,34 @@ Methods: ### L7Policies +Types: + +```python +from gcore.types.cloud.load_balancers import L7PolicyListResponse, L7PolicyGetResponse +``` + Methods: - client.cloud.load_balancers.l7_policies.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.l7_policies.list(\*, project_id, region_id) -> LoadBalancerL7PolicyList +- client.cloud.load_balancers.l7_policies.list(\*, project_id, region_id) -> L7PolicyListResponse - 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.get(l7policy_id, \*, project_id, region_id) -> L7PolicyGetResponse - client.cloud.load_balancers.l7_policies.replace(l7policy_id, \*, project_id, region_id, \*\*params) -> TaskIDList #### Rules +Types: + +```python +from gcore.types.cloud.load_balancers.l7_policies import RuleListResponse, RuleGetResponse +``` + Methods: - client.cloud.load_balancers.l7_policies.rules.create(l7policy_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.l7_policies.rules.list(l7policy_id, \*, project_id, region_id) -> LoadBalancerL7RuleList +- client.cloud.load_balancers.l7_policies.rules.list(l7policy_id, \*, project_id, region_id) -> RuleListResponse - client.cloud.load_balancers.l7_policies.rules.delete(l7rule_id, \*, project_id, region_id, l7policy_id) -> TaskIDList -- client.cloud.load_balancers.l7_policies.rules.get(l7rule_id, \*, project_id, region_id, l7policy_id) -> LoadBalancerL7Rule +- client.cloud.load_balancers.l7_policies.rules.get(l7rule_id, \*, project_id, region_id, l7policy_id) -> RuleGetResponse - client.cloud.load_balancers.l7_policies.rules.replace(l7rule_id, \*, project_id, region_id, l7policy_id, \*\*params) -> TaskIDList ### Flavors diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index 17a2a8ea..0ca05e3d 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 @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import Literal +from typing_extensions import Literal, overload import httpx @@ -15,7 +15,7 @@ AsyncRulesResourceWithStreamingResponse, ) from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ....._utils import maybe_transform, async_maybe_transform +from ....._utils import required_args, maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource from ....._response import ( @@ -27,8 +27,8 @@ 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_balancer_l7_policy import LoadBalancerL7Policy -from .....types.cloud.load_balancer_l7_policy_list import LoadBalancerL7PolicyList +from .....types.cloud.load_balancers.l7_policy_get_response import L7PolicyGetResponse +from .....types.cloud.load_balancers.l7_policy_list_response import L7PolicyListResponse __all__ = ["L7PoliciesResource", "AsyncL7PoliciesResource"] @@ -57,19 +57,18 @@ def with_streaming_response(self) -> L7PoliciesResourceWithStreamingResponse: """ return L7PoliciesResourceWithStreamingResponse(self) + @overload def create( self, *, project_id: int | None = None, region_id: int | None = None, - action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], + action: Literal["REDIRECT_TO_URL"], listener_id: str, + redirect_url: str, name: str | Omit = omit, position: int | Omit = omit, redirect_http_code: int | Omit = omit, - redirect_pool_id: str | Omit = omit, - redirect_prefix: str | Omit = omit, - redirect_url: str | Omit = omit, tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -82,26 +81,172 @@ def create( Create load balancer L7 policy Args: + project_id: Project ID + + region_id: Region ID + action: Action listener_id: Listener ID + redirect_url: Requests matching this policy will be redirected to this URL. + name: Human-readable name of the policy - position: The position of this policy on the listener. Positions start at 1. + 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. + URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308. + Default is 302. - redirect_pool_id: Requests matching this policy will be redirected to the pool withthis ID. Only - valid if action is `REDIRECT_TO_POOL`. + tags: A list of simple strings assigned to the resource. - redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid - if action is `REDIRECT_PREFIX`. + extra_headers: Send extra headers - redirect_url: Requests matching this policy will be redirected to this URL. Only valid if - action is `REDIRECT_TO_URL`. + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_PREFIX"], + listener_id: str, + 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: + """ + Create load balancer L7 policy + + Args: + project_id: Project ID + + region_id: Region ID + + action: Action + + listener_id: Listener ID + + 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 create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_TO_POOL"], + listener_id: str, + 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: + """ + Create load balancer L7 policy + + Args: + project_id: Project ID + + region_id: Region ID + + action: Action + + listener_id: Listener ID + + 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 create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REJECT"], + listener_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: + """ + Create load balancer L7 policy + + Args: + project_id: Project ID + + region_id: Region ID + + action: Action + + listener_id: Listener 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. @@ -113,6 +258,38 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ + ... + + @required_args( + ["action", "listener_id", "redirect_url"], + ["action", "listener_id", "redirect_prefix"], + ["action", "listener_id", "redirect_pool_id"], + ["action", "listener_id"], + ) + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_TO_URL"] + | Literal["REDIRECT_PREFIX"] + | Literal["REDIRECT_TO_POOL"] + | Literal["REJECT"], + listener_id: str, + 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: @@ -123,13 +300,13 @@ def create( { "action": action, "listener_id": listener_id, + "redirect_url": redirect_url, "name": name, "position": position, "redirect_http_code": redirect_http_code, - "redirect_pool_id": redirect_pool_id, - "redirect_prefix": redirect_prefix, - "redirect_url": redirect_url, "tags": tags, + "redirect_prefix": redirect_prefix, + "redirect_pool_id": redirect_pool_id, }, l7_policy_create_params.L7PolicyCreateParams, ), @@ -150,11 +327,15 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerL7PolicyList: + ) -> L7PolicyListResponse: """ List load balancer L7 policies Args: + project_id: Project ID + + region_id: Region ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -172,7 +353,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerL7PolicyList, + cast_to=L7PolicyListResponse, ) def delete( @@ -192,6 +373,12 @@ def delete( Delete load balancer L7 policy Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -226,11 +413,17 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerL7Policy: + ) -> L7PolicyGetResponse: """ Get load balancer L7 policy Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -250,22 +443,21 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerL7Policy, + cast_to=L7PolicyGetResponse, ) + @overload def replace( self, l7policy_id: str, *, project_id: int | None = None, region_id: int | None = None, - action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], + action: Literal["REDIRECT_TO_URL"], + redirect_url: str, name: str | Omit = omit, position: int | Omit = omit, redirect_http_code: int | Omit = omit, - redirect_pool_id: str | Omit = omit, - redirect_prefix: str | Omit = omit, - redirect_url: str | Omit = omit, tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -274,29 +466,33 @@ def replace( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: - """ - Replace load balancer L7 policy + """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. Positions start at 1. + 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. - redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID. Only - valid if action is `REDIRECT_TO_POOL`. - - redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid - if action is `REDIRECT_PREFIX`. - - redirect_url: Requests matching this policy will be redirected to this URL. Only valid if - action is `REDIRECT_TO_URL`. - tags: A list of simple strings assigned to the resource. extra_headers: Send extra headers @@ -307,71 +503,20 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not 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, - "name": name, - "position": position, - "redirect_http_code": redirect_http_code, - "redirect_pool_id": redirect_pool_id, - "redirect_prefix": redirect_prefix, - "redirect_url": redirect_url, - "tags": tags, - }, - 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, - ) - - -class AsyncL7PoliciesResource(AsyncAPIResource): - @cached_property - def rules(self) -> AsyncRulesResource: - return AsyncRulesResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncL7PoliciesResourceWithRawResponse: - """ - 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 AsyncL7PoliciesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncL7PoliciesResourceWithStreamingResponse: - """ - 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 AsyncL7PoliciesResourceWithStreamingResponse(self) + ... - async def create( + @overload + def replace( self, + l7policy_id: str, *, project_id: int | None = None, region_id: int | None = None, - action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], - listener_id: str, + action: Literal["REDIRECT_PREFIX"], + redirect_prefix: str, name: str | Omit = omit, position: int | Omit = omit, redirect_http_code: int | Omit = omit, - redirect_pool_id: str | Omit = omit, - redirect_prefix: str | Omit = omit, - redirect_url: str | Omit = omit, tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -380,30 +525,31 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: - """ - Create load balancer L7 policy + """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: - action: Action + project_id: Project ID - listener_id: Listener ID + region_id: Region ID - name: Human-readable name of the policy + l7policy_id: L7 policy ID - position: The position of this policy on the listener. Positions start at 1. + action: Action - 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. + redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. - redirect_pool_id: Requests matching this policy will be redirected to the pool withthis ID. Only - valid if action is `REDIRECT_TO_POOL`. + name: Human-readable name of the policy - redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid - if action is `REDIRECT_PREFIX`. + position: The position of this policy on the listener - redirect_url: Requests matching this policy will be redirected to this URL. Only valid if - action is `REDIRECT_TO_URL`. + 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. @@ -415,8 +561,425 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() + ... + + @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, + ) + + +class AsyncL7PoliciesResource(AsyncAPIResource): + @cached_property + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncL7PoliciesResourceWithRawResponse: + """ + 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 AsyncL7PoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncL7PoliciesResourceWithStreamingResponse: + """ + 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 AsyncL7PoliciesResourceWithStreamingResponse(self) + + @overload + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_TO_URL"], + listener_id: str, + 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: + """ + Create load balancer L7 policy + + Args: + project_id: Project ID + + region_id: Region ID + + action: Action + + listener_id: Listener ID + + redirect_url: Requests matching this policy will be redirected to this 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 create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_PREFIX"], + listener_id: str, + 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: + """ + Create load balancer L7 policy + + Args: + project_id: Project ID + + region_id: Region ID + + action: Action + + listener_id: Listener ID + + 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 create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_TO_POOL"], + listener_id: str, + 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: + """ + Create load balancer L7 policy + + Args: + project_id: Project ID + + region_id: Region ID + + action: Action + + listener_id: Listener ID + + 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 create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REJECT"], + listener_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: + """ + Create load balancer L7 policy + + Args: + project_id: Project ID + + region_id: Region ID + + action: Action + + listener_id: Listener 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 + """ + ... + + @required_args( + ["action", "listener_id", "redirect_url"], + ["action", "listener_id", "redirect_prefix"], + ["action", "listener_id", "redirect_pool_id"], + ["action", "listener_id"], + ) + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_TO_URL"] + | Literal["REDIRECT_PREFIX"] + | Literal["REDIRECT_TO_POOL"] + | Literal["REJECT"], + listener_id: str, + 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() return await self._post( @@ -425,13 +988,13 @@ async def create( { "action": action, "listener_id": listener_id, + "redirect_url": redirect_url, "name": name, "position": position, "redirect_http_code": redirect_http_code, - "redirect_pool_id": redirect_pool_id, - "redirect_prefix": redirect_prefix, - "redirect_url": redirect_url, "tags": tags, + "redirect_prefix": redirect_prefix, + "redirect_pool_id": redirect_pool_id, }, l7_policy_create_params.L7PolicyCreateParams, ), @@ -452,11 +1015,15 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerL7PolicyList: + ) -> L7PolicyListResponse: """ List load balancer L7 policies Args: + project_id: Project ID + + region_id: Region ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -474,7 +1041,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerL7PolicyList, + cast_to=L7PolicyListResponse, ) async def delete( @@ -494,6 +1061,12 @@ async def delete( Delete load balancer L7 policy Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -528,11 +1101,17 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerL7Policy: + ) -> L7PolicyGetResponse: """ Get load balancer L7 policy Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -552,22 +1131,21 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerL7Policy, + cast_to=L7PolicyGetResponse, ) + @overload async def replace( self, l7policy_id: str, *, project_id: int | None = None, region_id: int | None = None, - action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], + action: Literal["REDIRECT_TO_URL"], + redirect_url: str, name: str | Omit = omit, position: int | Omit = omit, redirect_http_code: int | Omit = omit, - redirect_pool_id: str | Omit = omit, - redirect_prefix: str | Omit = omit, - redirect_url: str | Omit = omit, tags: SequenceNotStr[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -576,28 +1154,143 @@ async def replace( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: - """ - Replace load balancer L7 policy + """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. Positions start at 1. + 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. - redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID. Only - valid if action is `REDIRECT_TO_POOL`. + tags: A list of simple strings assigned to the resource. + + extra_headers: Send extra headers - redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid - if action is `REDIRECT_PREFIX`. + extra_query: Add additional query parameters to the request - redirect_url: Requests matching this policy will be redirected to this URL. Only valid if - action is `REDIRECT_TO_URL`. + 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. @@ -609,6 +1302,85 @@ async def replace( 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: @@ -620,13 +1392,13 @@ async def replace( body=await async_maybe_transform( { "action": action, + "redirect_url": redirect_url, "name": name, "position": position, "redirect_http_code": redirect_http_code, - "redirect_pool_id": redirect_pool_id, - "redirect_prefix": redirect_prefix, - "redirect_url": redirect_url, "tags": tags, + "redirect_prefix": redirect_prefix, + "redirect_pool_id": redirect_pool_id, }, l7_policy_replace_params.L7PolicyReplaceParams, ), 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 c4ba95fd..8cf06b94 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -18,9 +18,9 @@ ) from ....._base_client import make_request_options from .....types.cloud.task_id_list import TaskIDList -from .....types.cloud.load_balancer_l7_rule import LoadBalancerL7Rule -from .....types.cloud.load_balancer_l7_rule_list import LoadBalancerL7RuleList from .....types.cloud.load_balancers.l7_policies import rule_create_params, rule_replace_params +from .....types.cloud.load_balancers.l7_policies.rule_get_response import RuleGetResponse +from .....types.cloud.load_balancers.l7_policies.rule_list_response import RuleListResponse __all__ = ["RulesResource", "AsyncRulesResource"] @@ -77,17 +77,21 @@ def create( Create load balancer L7 rule Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + compare_type: The comparison type for the L7 rule type: The L7 rule type - value: The value to use for the comparison. For example, the file type to compare + value: The value to use for the comparison - invert: When true the logic of the rule is inverted. For example, with invert true, - 'equal to' would become 'not equal to'. Default is false. + invert: When true the logic of the rule is inverted. - key: The key to use for the comparison. For example, the name of the cookie to - evaluate. + key: The key to use for the comparison. tags: A list of simple strings assigned to the l7 rule @@ -136,11 +140,17 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerL7RuleList: + ) -> RuleListResponse: """ List load balancer L7 policy rules Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -160,7 +170,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerL7RuleList, + cast_to=RuleListResponse, ) def delete( @@ -181,6 +191,14 @@ def delete( Delete load balancer L7 rule Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + l7rule_id: L7 rule ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -218,11 +236,19 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerL7Rule: + ) -> RuleGetResponse: """ Get load balancer L7 rule Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + l7rule_id: L7 rule ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -244,7 +270,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerL7Rule, + cast_to=RuleGetResponse, ) def replace( @@ -254,7 +280,7 @@ def replace( project_id: int | None = None, region_id: int | None = None, l7policy_id: str, - compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | Omit = omit, + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"], invert: bool | Omit = omit, key: str | Omit = omit, tags: SequenceNotStr[str] | Omit = omit, @@ -281,19 +307,25 @@ def replace( Replace load balancer L7 rule properties Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + l7rule_id: L7 rule ID + compare_type: The comparison type for the L7 rule - invert: When true the logic of the rule is inverted. For example, with invert true, - 'equal to' would become 'not equal to'. Default is false. + invert: When true the logic of the rule is inverted. - key: The key to use for the comparison. For example, the name of the cookie to - evaluate. + key: The key to use for the comparison. tags: A list of simple strings assigned to the l7 rule type: The L7 rule type - value: The value to use for the comparison. For example, the file type to compare + value: The value to use for the comparison extra_headers: Send extra headers @@ -383,17 +415,21 @@ async def create( Create load balancer L7 rule Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + compare_type: The comparison type for the L7 rule type: The L7 rule type - value: The value to use for the comparison. For example, the file type to compare + value: The value to use for the comparison - invert: When true the logic of the rule is inverted. For example, with invert true, - 'equal to' would become 'not equal to'. Default is false. + invert: When true the logic of the rule is inverted. - key: The key to use for the comparison. For example, the name of the cookie to - evaluate. + key: The key to use for the comparison. tags: A list of simple strings assigned to the l7 rule @@ -442,11 +478,17 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerL7RuleList: + ) -> RuleListResponse: """ List load balancer L7 policy rules Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -466,7 +508,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerL7RuleList, + cast_to=RuleListResponse, ) async def delete( @@ -487,6 +529,14 @@ async def delete( Delete load balancer L7 rule Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + l7rule_id: L7 rule ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -524,11 +574,19 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerL7Rule: + ) -> RuleGetResponse: """ Get load balancer L7 rule Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + l7rule_id: L7 rule ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -550,7 +608,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerL7Rule, + cast_to=RuleGetResponse, ) async def replace( @@ -560,7 +618,7 @@ async def replace( project_id: int | None = None, region_id: int | None = None, l7policy_id: str, - compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | Omit = omit, + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"], invert: bool | Omit = omit, key: str | Omit = omit, tags: SequenceNotStr[str] | Omit = omit, @@ -587,19 +645,25 @@ async def replace( Replace load balancer L7 rule properties Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + l7rule_id: L7 rule ID + compare_type: The comparison type for the L7 rule - invert: When true the logic of the rule is inverted. For example, with invert true, - 'equal to' would become 'not equal to'. Default is false. + invert: When true the logic of the rule is inverted. - key: The key to use for the comparison. For example, the name of the cookie to - evaluate. + key: The key to use for the comparison. tags: A list of simple strings assigned to the l7 rule type: The L7 rule type - value: The value to use for the comparison. For example, the file type to compare + value: The value to use for the comparison extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 061b0876..cd2c058d 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -154,6 +154,7 @@ def list( *, project_id: int | None = None, limit: int | Omit = omit, + name: str | Omit = omit, offset: int | Omit = omit, order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -171,6 +172,9 @@ def list( limit: Maximum number of SSH keys to return + name: SSH key name. Partial substring match. Example: `name=abc` matches any key + containing `abc` in name. + offset: Offset for pagination order_by: Sort order for the SSH keys @@ -196,6 +200,7 @@ def list( query=maybe_transform( { "limit": limit, + "name": name, "offset": offset, "order_by": order_by, }, @@ -418,6 +423,7 @@ def list( *, project_id: int | None = None, limit: int | Omit = omit, + name: str | Omit = omit, offset: int | Omit = omit, order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -435,6 +441,9 @@ def list( limit: Maximum number of SSH keys to return + name: SSH key name. Partial substring match. Example: `name=abc` matches any key + containing `abc` in name. + offset: Offset for pagination order_by: Sort order for the SSH keys @@ -460,6 +469,7 @@ def list( query=maybe_transform( { "limit": limit, + "name": name, "offset": offset, "order_by": order_by, }, diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index e97ac01a..554c0e96 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -91,7 +91,6 @@ from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate from .gpu_baremetal_cluster import GPUBaremetalCluster as GPUBaremetalCluster from .health_monitor_status import HealthMonitorStatus as HealthMonitorStatus -from .load_balancer_l7_rule import LoadBalancerL7Rule as LoadBalancerL7Rule from .load_balancer_metrics import LoadBalancerMetrics as LoadBalancerMetrics from .network_create_params import NetworkCreateParams as NetworkCreateParams from .network_update_params import NetworkUpdateParams as NetworkUpdateParams @@ -112,7 +111,6 @@ from .registry_create_params import RegistryCreateParams as RegistryCreateParams from .registry_resize_params import RegistryResizeParams as RegistryResizeParams from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams -from .load_balancer_l7_policy import LoadBalancerL7Policy as LoadBalancerL7Policy from .load_balancer_pool_list import LoadBalancerPoolList as LoadBalancerPoolList from .usage_report_get_params import UsageReportGetParams as UsageReportGetParams from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList @@ -132,7 +130,6 @@ from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit -from .load_balancer_l7_rule_list import LoadBalancerL7RuleList as LoadBalancerL7RuleList from .load_balancer_metrics_list import LoadBalancerMetricsList as LoadBalancerMetricsList from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams @@ -148,7 +145,6 @@ from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams -from .load_balancer_l7_policy_list import LoadBalancerL7PolicyList as LoadBalancerL7PolicyList from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams diff --git a/src/gcore/types/cloud/load_balancer_l7_policy_list.py b/src/gcore/types/cloud/load_balancer_l7_policy_list.py deleted file mode 100644 index e3fa62c0..00000000 --- a/src/gcore/types/cloud/load_balancer_l7_policy_list.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel -from .load_balancer_l7_policy import LoadBalancerL7Policy - -__all__ = ["LoadBalancerL7PolicyList"] - - -class LoadBalancerL7PolicyList(BaseModel): - count: Optional[int] = None - """Number of objects""" - - results: Optional[List[LoadBalancerL7Policy]] = None - """Objects""" diff --git a/src/gcore/types/cloud/load_balancer_l7_rule_list.py b/src/gcore/types/cloud/load_balancer_l7_rule_list.py deleted file mode 100644 index 8bd48ca0..00000000 --- a/src/gcore/types/cloud/load_balancer_l7_rule_list.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel -from .load_balancer_l7_rule import LoadBalancerL7Rule - -__all__ = ["LoadBalancerL7RuleList"] - - -class LoadBalancerL7RuleList(BaseModel): - count: Optional[int] = None - """Number of objects""" - - results: Optional[List[LoadBalancerL7Rule]] = None - """Objects""" diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index c68b77c9..53d86f51 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -9,8 +9,10 @@ from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .listener_get_params import ListenerGetParams as ListenerGetParams from .listener_list_params import ListenerListParams as ListenerListParams +from .l7_policy_get_response import L7PolicyGetResponse as L7PolicyGetResponse from .listener_create_params import ListenerCreateParams as ListenerCreateParams 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_list_response import L7PolicyListResponse as L7PolicyListResponse from .l7_policy_replace_params import L7PolicyReplaceParams as L7PolicyReplaceParams diff --git a/src/gcore/types/cloud/load_balancers/l7_policies/__init__.py b/src/gcore/types/cloud/load_balancers/l7_policies/__init__.py index 832f1d77..0c3d4dfe 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policies/__init__.py +++ b/src/gcore/types/cloud/load_balancers/l7_policies/__init__.py @@ -2,5 +2,7 @@ from __future__ import annotations +from .rule_get_response import RuleGetResponse as RuleGetResponse from .rule_create_params import RuleCreateParams as RuleCreateParams +from .rule_list_response import RuleListResponse as RuleListResponse from .rule_replace_params import RuleReplaceParams as RuleReplaceParams 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 a15d72e2..30ab9c53 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 @@ -11,8 +11,10 @@ class RuleCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" compare_type: Required[Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"]] """The comparison type for the L7 rule""" @@ -32,20 +34,13 @@ class RuleCreateParams(TypedDict, total=False): """The L7 rule type""" value: Required[str] - """The value to use for the comparison. For example, the file type to compare""" + """The value to use for the comparison""" invert: bool - """When true the logic of the rule is inverted. - - For example, with invert true, 'equal to' would become 'not equal to'. Default - is false. - """ + """When true the logic of the rule is inverted.""" key: str - """The key to use for the comparison. - - For example, the name of the cookie to evaluate. - """ + """The key to use for the comparison.""" tags: SequenceNotStr[str] """A list of simple strings assigned to the l7 rule""" diff --git a/src/gcore/types/cloud/load_balancer_l7_rule.py b/src/gcore/types/cloud/load_balancers/l7_policies/rule_get_response.py similarity index 53% rename from src/gcore/types/cloud/load_balancer_l7_rule.py rename to src/gcore/types/cloud/load_balancers/l7_policies/rule_get_response.py index 244e294b..55a99540 100644 --- a/src/gcore/types/cloud/load_balancer_l7_rule.py +++ b/src/gcore/types/cloud/load_balancers/l7_policies/rule_get_response.py @@ -3,19 +3,21 @@ from typing import List, Optional from typing_extensions import Literal -from ..._models import BaseModel +from ....._models import BaseModel +from ...provisioning_status import ProvisioningStatus +from ...load_balancer_operating_status import LoadBalancerOperatingStatus -__all__ = ["LoadBalancerL7Rule"] +__all__ = ["RuleGetResponse"] -class LoadBalancerL7Rule(BaseModel): - id: Optional[str] = None +class RuleGetResponse(BaseModel): + id: str """L7Rule ID""" - compare_type: Optional[Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"]] = None + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] """The comparison type for the L7 rule""" - invert: Optional[bool] = None + invert: bool """When true the logic of the rule is inverted. For example, with invert true, 'equal to' would become 'not equal to'. Default @@ -28,20 +30,18 @@ class LoadBalancerL7Rule(BaseModel): For example, the name of the cookie to evaluate. """ - operating_status: Optional[Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"]] = None + operating_status: LoadBalancerOperatingStatus """L7 policy operating status""" - project_id: Optional[int] = None + project_id: int """Project ID""" - provisioning_status: Optional[ - Literal["ACTIVE", "DELETED", "ERROR", "PENDING_CREATE", "PENDING_DELETE", "PENDING_UPDATE"] - ] = None + provisioning_status: ProvisioningStatus - region: Optional[str] = None + region: str """Region name""" - region_id: Optional[int] = None + region_id: int """Region ID""" tags: Optional[List[str]] = None @@ -54,19 +54,10 @@ class LoadBalancerL7Rule(BaseModel): the resource is not locked. """ - type: Optional[ - Literal[ - "COOKIE", - "FILE_TYPE", - "HEADER", - "HOST_NAME", - "PATH", - "SSL_CONN_HAS_CERT", - "SSL_DN_FIELD", - "SSL_VERIFY_RESULT", - ] - ] = None + type: Literal[ + "COOKIE", "FILE_TYPE", "HEADER", "HOST_NAME", "PATH", "SSL_CONN_HAS_CERT", "SSL_DN_FIELD", "SSL_VERIFY_RESULT" + ] """The L7 rule type""" - value: Optional[str] = None + value: str """The value to use for the comparison. For example, the file type to compare.""" diff --git a/src/gcore/types/cloud/load_balancers/l7_policies/rule_list_response.py b/src/gcore/types/cloud/load_balancers/l7_policies/rule_list_response.py new file mode 100644 index 00000000..ee543170 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/l7_policies/rule_list_response.py @@ -0,0 +1,71 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ....._models import BaseModel +from ...provisioning_status import ProvisioningStatus +from ...load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = ["RuleListResponse", "Result"] + + +class Result(BaseModel): + id: str + """L7Rule ID""" + + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] + """The comparison type for the L7 rule""" + + invert: bool + """When true the logic of the rule is inverted. + + For example, with invert true, 'equal to' would become 'not equal to'. Default + is false. + """ + + key: Optional[str] = None + """The key to use for the comparison. + + For example, the name of the cookie to evaluate. + """ + + operating_status: LoadBalancerOperatingStatus + """L7 policy operating status""" + + project_id: int + """Project ID""" + + provisioning_status: ProvisioningStatus + + region: str + """Region name""" + + region_id: int + """Region ID""" + + tags: Optional[List[str]] = None + """A list of simple strings assigned to the l7 rule""" + + task_id: Optional[str] = None + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. + """ + + type: Literal[ + "COOKIE", "FILE_TYPE", "HEADER", "HOST_NAME", "PATH", "SSL_CONN_HAS_CERT", "SSL_DN_FIELD", "SSL_VERIFY_RESULT" + ] + """The L7 rule type""" + + value: str + """The value to use for the comparison. For example, the file type to compare.""" + + +class RuleListResponse(BaseModel): + count: int + """Number of objects""" + + results: List[Result] + """Objects""" 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 4694d1b8..0d8e5c97 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 @@ -11,26 +11,22 @@ class RuleReplaceParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" l7policy_id: Required[str] + """L7 policy ID""" - compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] + compare_type: Required[Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"]] """The comparison type for the L7 rule""" invert: bool - """When true the logic of the rule is inverted. - - For example, with invert true, 'equal to' would become 'not equal to'. Default - is false. - """ + """When true the logic of the rule is inverted.""" key: str - """The key to use for the comparison. - - For example, the name of the cookie to evaluate. - """ + """The key to use for the comparison.""" tags: SequenceNotStr[str] """A list of simple strings assigned to the l7 rule""" @@ -41,4 +37,4 @@ class RuleReplaceParams(TypedDict, total=False): """The L7 rule type""" value: str - """The value to use for the comparison. For example, the file type to compare""" + """The value to use for the comparison""" diff --git a/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py b/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py index 2ffea9c0..1ab01e3f 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py +++ b/src/gcore/types/cloud/load_balancers/l7_policy_create_params.py @@ -2,54 +2,138 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing import Union +from typing_extensions import Literal, Required, TypeAlias, TypedDict from ...._types import SequenceNotStr -__all__ = ["L7PolicyCreateParams"] +__all__ = [ + "L7PolicyCreateParams", + "CreateL7PolicyRedirectToURLSerializer", + "CreateL7PolicyRedirectPrefixSerializer", + "CreateL7PolicyRedirectToPoolSerializer", + "CreateL7PolicyRejectSerializer", +] -class L7PolicyCreateParams(TypedDict, total=False): +class CreateL7PolicyRedirectToURLSerializer(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" - action: Required[Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"]] + action: Required[Literal["REDIRECT_TO_URL"]] """Action""" listener_id: Required[str] """Listener ID""" + redirect_url: Required[str] + """Requests matching this policy will be redirected to this URL.""" + name: str """Human-readable name of the policy""" position: int - """The position of this policy on the listener. Positions start at 1.""" + """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. + URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308. + Default is 302. """ - redirect_pool_id: str - """Requests matching this policy will be redirected to the pool withthis ID. + tags: SequenceNotStr[str] + """A list of simple strings assigned to the resource.""" - Only valid if action is `REDIRECT_TO_POOL`. - """ - redirect_prefix: str - """Requests matching this policy will be redirected to this Prefix URL. +class CreateL7PolicyRedirectPrefixSerializer(TypedDict, total=False): + project_id: int + """Project ID""" - Only valid if action is `REDIRECT_PREFIX`. - """ + region_id: int + """Region ID""" + + action: Required[Literal["REDIRECT_PREFIX"]] + """Action""" + + listener_id: Required[str] + """Listener ID""" + + redirect_prefix: Required[str] + """Requests matching this policy will be redirected to this Prefix URL.""" + + name: str + """Human-readable name of the policy""" - redirect_url: str - """Requests matching this policy will be redirected to this URL. + position: int + """The position of this policy on the listener""" - Only valid if action is `REDIRECT_TO_URL`. + 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 CreateL7PolicyRedirectToPoolSerializer(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["REDIRECT_TO_POOL"]] + """Action""" + + listener_id: Required[str] + """Listener ID""" + + 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 CreateL7PolicyRejectSerializer(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["REJECT"]] + """Action""" + + listener_id: Required[str] + """Listener 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.""" + + +L7PolicyCreateParams: TypeAlias = Union[ + CreateL7PolicyRedirectToURLSerializer, + CreateL7PolicyRedirectPrefixSerializer, + CreateL7PolicyRedirectToPoolSerializer, + CreateL7PolicyRejectSerializer, +] diff --git a/src/gcore/types/cloud/load_balancer_l7_policy.py b/src/gcore/types/cloud/load_balancers/l7_policy_get_response.py similarity index 68% rename from src/gcore/types/cloud/load_balancer_l7_policy.py rename to src/gcore/types/cloud/load_balancers/l7_policy_get_response.py index 4190b4e9..ba2b9259 100644 --- a/src/gcore/types/cloud/load_balancer_l7_policy.py +++ b/src/gcore/types/cloud/load_balancers/l7_policy_get_response.py @@ -3,37 +3,50 @@ from typing import List, Optional from typing_extensions import Literal -from ..._models import BaseModel -from .load_balancer_l7_rule import LoadBalancerL7Rule +from ...._models import BaseModel +from ..provisioning_status import ProvisioningStatus +from ..load_balancer_operating_status import LoadBalancerOperatingStatus -__all__ = ["LoadBalancerL7Policy"] +__all__ = ["L7PolicyGetResponse", "Rule"] -class LoadBalancerL7Policy(BaseModel): - id: Optional[str] = None +class Rule(BaseModel): + id: str + """L7Rule ID""" + + project_id: int + """Project ID""" + + region: str + """Region name""" + + region_id: int + """Region ID""" + + +class L7PolicyGetResponse(BaseModel): + id: str """ID""" - action: Optional[Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"]] = None + action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"] """Action""" - listener_id: Optional[str] = None + listener_id: str """Listener ID""" - name: Optional[str] = None + name: str """Human-readable name of the policy""" - operating_status: Optional[Literal["DEGRADED", "DRAINING", "ERROR", "NO_MONITOR", "OFFLINE", "ONLINE"]] = None + operating_status: LoadBalancerOperatingStatus """L7 policy operating status""" - position: Optional[int] = None + position: int """The position of this policy on the listener. Positions start at 1.""" - project_id: Optional[int] = None + project_id: int """Project ID""" - provisioning_status: Optional[ - Literal["ACTIVE", "DELETED", "ERROR", "PENDING_CREATE", "PENDING_DELETE", "PENDING_UPDATE"] - ] = None + provisioning_status: ProvisioningStatus redirect_http_code: Optional[int] = None """ @@ -60,13 +73,13 @@ class LoadBalancerL7Policy(BaseModel): Only valid if action is `REDIRECT_TO_URL`. """ - region: Optional[str] = None + region: str """Region name""" - region_id: Optional[int] = None + region_id: int """Region ID""" - rules: Optional[List[LoadBalancerL7Rule]] = None + rules: List[Rule] """Rules. All the rules associated with a given policy are logically ANDed together. A @@ -75,7 +88,7 @@ class LoadBalancerL7Policy(BaseModel): policies with the same action. """ - tags: Optional[List[str]] = None + tags: List[str] """A list of simple strings assigned to the resource.""" task_id: Optional[str] = None diff --git a/src/gcore/types/cloud/load_balancers/l7_policy_list_response.py b/src/gcore/types/cloud/load_balancers/l7_policy_list_response.py new file mode 100644 index 00000000..b418937f --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/l7_policy_list_response.py @@ -0,0 +1,107 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ...._models import BaseModel +from ..provisioning_status import ProvisioningStatus +from ..load_balancer_operating_status import LoadBalancerOperatingStatus + +__all__ = ["L7PolicyListResponse", "Result", "ResultRule"] + + +class ResultRule(BaseModel): + id: str + """L7Rule ID""" + + project_id: int + """Project ID""" + + region: str + """Region name""" + + region_id: int + """Region ID""" + + +class Result(BaseModel): + id: str + """ID""" + + action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"] + """Action""" + + listener_id: str + """Listener ID""" + + name: str + """Human-readable name of the policy""" + + operating_status: LoadBalancerOperatingStatus + """L7 policy operating status""" + + position: int + """The position of this policy on the listener. Positions start at 1.""" + + project_id: int + """Project ID""" + + provisioning_status: ProvisioningStatus + + redirect_http_code: Optional[int] = None + """ + 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. + """ + + redirect_pool_id: Optional[str] = None + """Requests matching this policy will be redirected to the pool with this ID. + + Only valid if action is `REDIRECT_TO_POOL`. + """ + + redirect_prefix: Optional[str] = None + """Requests matching this policy will be redirected to this Prefix URL. + + Only valid if action is `REDIRECT_PREFIX`. + """ + + redirect_url: Optional[str] = None + """Requests matching this policy will be redirected to this URL. + + Only valid if action is `REDIRECT_TO_URL`. + """ + + region: str + """Region name""" + + region_id: int + """Region ID""" + + rules: List[ResultRule] + """Rules. + + All the rules associated with a given policy are logically ANDed together. A + request must match all the policy’s rules to match the policy.If you need to + express a logical OR operation between rules, then do this by creating multiple + policies with the same action. + """ + + tags: List[str] + """A list of simple strings assigned to the resource.""" + + task_id: Optional[str] = None + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. + """ + + +class L7PolicyListResponse(BaseModel): + count: int + """Number of objects""" + + results: List[Result] + """Objects""" 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 index 2ed23ebc..806e90ac 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py +++ b/src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py @@ -2,26 +2,41 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing import Union +from typing_extensions import Literal, Required, TypeAlias, TypedDict from ...._types import SequenceNotStr -__all__ = ["L7PolicyReplaceParams"] +__all__ = [ + "L7PolicyReplaceParams", + "UpdateL7PolicyRedirectToURLSerializer", + "UpdateL7PolicyRedirectPrefixSerializer", + "UpdateL7PolicyRedirectToPoolSerializer", + "UpdateL7PolicyRejectSerializer", +] -class L7PolicyReplaceParams(TypedDict, total=False): +class UpdateL7PolicyRedirectToURLSerializer(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" - action: Required[Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"]] + 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. Positions start at 1.""" + """The position of this policy on the listener""" redirect_http_code: int """ @@ -30,23 +45,86 @@ class L7PolicyReplaceParams(TypedDict, total=False): `REDIRECT_PREFIX`. Valid options are 301, 302, 303, 307, or 308. Default is 302. """ - redirect_pool_id: str - """Requests matching this policy will be redirected to the pool with this ID. + tags: SequenceNotStr[str] + """A list of simple strings assigned to the resource.""" - Only valid if action is `REDIRECT_TO_POOL`. - """ - redirect_prefix: str - """Requests matching this policy will be redirected to this Prefix URL. +class UpdateL7PolicyRedirectPrefixSerializer(TypedDict, total=False): + project_id: int + """Project ID""" - Only valid if action is `REDIRECT_PREFIX`. - """ + region_id: int + """Region ID""" - redirect_url: str - """Requests matching this policy will be redirected to this URL. + action: Required[Literal["REDIRECT_PREFIX"]] + """Action""" - Only valid if action is `REDIRECT_TO_URL`. + 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/ssh_key_list_params.py b/src/gcore/types/cloud/ssh_key_list_params.py index a3dea48f..6082d012 100644 --- a/src/gcore/types/cloud/ssh_key_list_params.py +++ b/src/gcore/types/cloud/ssh_key_list_params.py @@ -14,6 +14,13 @@ class SSHKeyListParams(TypedDict, total=False): limit: int """Maximum number of SSH keys to return""" + name: str + """SSH key name. + + Partial substring match. Example: `name=abc` matches any key containing `abc` in + name. + """ + offset: int """Offset for pagination""" diff --git a/src/gcore/types/iam/api_token_create.py b/src/gcore/types/iam/api_token_create.py index 5cfc280a..d2157ce0 100644 --- a/src/gcore/types/iam/api_token_create.py +++ b/src/gcore/types/iam/api_token_create.py @@ -1,15 +1,84 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["APITokenCreate"] +__all__ = ["APITokenCreate", "ClientUser", "ClientUserRole"] + + +class ClientUserRole(BaseModel): + id: Optional[int] = None + """Group's ID: Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + """ + + name: Optional[ + Literal[ + "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" + ] + ] = None + """Group's name.""" + + +class ClientUser(BaseModel): + client_id: int + """Account's ID.""" + + deleted: bool + """Deletion flag. If true, then the API token was deleted.""" + + role: ClientUserRole + + user_email: str + """User's email who issued the API token.""" + + user_id: int + """User's ID who issued the API token.""" + + user_name: str + """User's name who issued the API token.""" class APITokenCreate(BaseModel): + id: int + """API token ID.""" + + client_user: ClientUser + + created: str + """Date when the API token was issued (ISO 8086/RFC 3339 format), UTC.""" + + deleted: bool + """Deletion flag. If true, then the API token was deleted.""" + + exp_date: Optional[str] = None + """ + Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If + null, then the API token will never expire. + """ + + expired: bool + """Expiration flag. + + If true, then the API token has expired. When an API token expires it will be + automatically deleted. + """ + + last_usage: str + """Date when the API token was last used (ISO 8086/RFC 3339 format), UTC.""" + + name: str + """API token name.""" + token: Optional[str] = None """ API token. Copy it, because you will not be able to get it again. We do not store tokens. All responsibility for token storage and usage is on the issuer. """ + + description: Optional[str] = None + """API token description.""" 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 3d55c8a0..63f90fa0 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 @@ -9,7 +9,11 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, LoadBalancerL7Rule, LoadBalancerL7RuleList +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.load_balancers.l7_policies import ( + RuleGetResponse, + RuleListResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,9 +24,9 @@ class TestRules: @parametrize def test_method_create(self, client: Gcore) -> None: rule = client.cloud.load_balancers.l7_policies.rules.create( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, compare_type="REGEX", type="PATH", value="/images*", @@ -32,24 +36,24 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: rule = client.cloud.load_balancers.l7_policies.rules.create( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, compare_type="REGEX", type="PATH", value="/images*", - invert=False, - key="key", - tags=["test_tag"], + invert=True, + key="the name of the cookie to evaluate.", + tags=["test_tag_1", "test_tag_2"], ) assert_matches_type(TaskIDList, rule, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.load_balancers.l7_policies.rules.with_raw_response.create( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, compare_type="REGEX", type="PATH", value="/images*", @@ -63,9 +67,9 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.load_balancers.l7_policies.rules.with_streaming_response.create( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, compare_type="REGEX", type="PATH", value="/images*", @@ -83,8 +87,8 @@ def test_path_params_create(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.rules.with_raw_response.create( l7policy_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, compare_type="REGEX", type="PATH", value="/images*", @@ -93,37 +97,37 @@ def test_path_params_create(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: rule = client.cloud.load_balancers.l7_policies.rules.list( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) - assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) + assert_matches_type(RuleListResponse, rule, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.load_balancers.l7_policies.rules.with_raw_response.list( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) + assert_matches_type(RuleListResponse, rule, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.load_balancers.l7_policies.rules.with_streaming_response.list( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) + assert_matches_type(RuleListResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -132,27 +136,27 @@ def test_path_params_list(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.rules.with_raw_response.list( l7policy_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_delete(self, client: Gcore) -> None: rule = client.cloud.load_balancers.l7_policies.rules.delete( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) assert_matches_type(TaskIDList, rule, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.load_balancers.l7_policies.rules.with_raw_response.delete( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) assert response.is_closed is True @@ -163,10 +167,10 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.load_balancers.l7_policies.rules.with_streaming_response.delete( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -180,57 +184,57 @@ def test_streaming_response_delete(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 `l7policy_id` but received ''"): client.cloud.load_balancers.l7_policies.rules.with_raw_response.delete( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, l7policy_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7rule_id` but received ''"): client.cloud.load_balancers.l7_policies.rules.with_raw_response.delete( l7rule_id="", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) @parametrize def test_method_get(self, client: Gcore) -> None: rule = client.cloud.load_balancers.l7_policies.rules.get( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) - assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) + assert_matches_type(RuleGetResponse, rule, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.load_balancers.l7_policies.rules.with_raw_response.get( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) + assert_matches_type(RuleGetResponse, rule, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.load_balancers.l7_policies.rules.with_streaming_response.get( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) + assert_matches_type(RuleGetResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -238,53 +242,55 @@ def test_streaming_response_get(self, client: Gcore) -> None: def test_path_params_get(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.rules.with_raw_response.get( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, l7policy_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7rule_id` but received ''"): client.cloud.load_balancers.l7_policies.rules.with_raw_response.get( l7rule_id="", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) @parametrize def test_method_replace(self, client: Gcore) -> None: rule = client.cloud.load_balancers.l7_policies.rules.replace( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + compare_type="REGEX", ) assert_matches_type(TaskIDList, rule, path=["response"]) @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: rule = client.cloud.load_balancers.l7_policies.rules.replace( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", - compare_type="CONTAINS", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + compare_type="REGEX", invert=True, - key="key", - tags=["string"], - type="COOKIE", - value="value", + key="the name of the cookie to evaluate.", + tags=["test_tag_1", "test_tag_2"], + type="PATH", + value="/images*", ) assert_matches_type(TaskIDList, rule, path=["response"]) @parametrize def test_raw_response_replace(self, client: Gcore) -> None: response = client.cloud.load_balancers.l7_policies.rules.with_raw_response.replace( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + compare_type="REGEX", ) assert response.is_closed is True @@ -295,10 +301,11 @@ def test_raw_response_replace(self, client: Gcore) -> None: @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: with client.cloud.load_balancers.l7_policies.rules.with_streaming_response.replace( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + compare_type="REGEX", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -312,18 +319,20 @@ def test_streaming_response_replace(self, client: Gcore) -> None: def test_path_params_replace(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.rules.with_raw_response.replace( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, l7policy_id="", + compare_type="REGEX", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7rule_id` but received ''"): client.cloud.load_balancers.l7_policies.rules.with_raw_response.replace( l7rule_id="", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + compare_type="REGEX", ) @@ -335,9 +344,9 @@ class TestAsyncRules: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.load_balancers.l7_policies.rules.create( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, compare_type="REGEX", type="PATH", value="/images*", @@ -347,24 +356,24 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.load_balancers.l7_policies.rules.create( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, compare_type="REGEX", type="PATH", value="/images*", - invert=False, - key="key", - tags=["test_tag"], + invert=True, + key="the name of the cookie to evaluate.", + tags=["test_tag_1", "test_tag_2"], ) assert_matches_type(TaskIDList, rule, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.create( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, compare_type="REGEX", type="PATH", value="/images*", @@ -378,9 +387,9 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.l7_policies.rules.with_streaming_response.create( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, compare_type="REGEX", type="PATH", value="/images*", @@ -398,8 +407,8 @@ async def test_path_params_create(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.rules.with_raw_response.create( l7policy_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, compare_type="REGEX", type="PATH", value="/images*", @@ -408,37 +417,37 @@ async def test_path_params_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.load_balancers.l7_policies.rules.list( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) - assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) + assert_matches_type(RuleListResponse, rule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.list( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) + assert_matches_type(RuleListResponse, rule, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.l7_policies.rules.with_streaming_response.list( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) + assert_matches_type(RuleListResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -447,27 +456,27 @@ async def test_path_params_list(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.rules.with_raw_response.list( l7policy_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.load_balancers.l7_policies.rules.delete( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) assert_matches_type(TaskIDList, rule, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.delete( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) assert response.is_closed is True @@ -478,10 +487,10 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.l7_policies.rules.with_streaming_response.delete( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -495,57 +504,57 @@ async def test_streaming_response_delete(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 `l7policy_id` but received ''"): await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.delete( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, l7policy_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7rule_id` but received ''"): await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.delete( l7rule_id="", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.load_balancers.l7_policies.rules.get( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) - assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) + assert_matches_type(RuleGetResponse, rule, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.get( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) + assert_matches_type(RuleGetResponse, rule, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.l7_policies.rules.with_streaming_response.get( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) + assert_matches_type(RuleGetResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -553,53 +562,55 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async def test_path_params_get(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.rules.with_raw_response.get( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, l7policy_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7rule_id` but received ''"): await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.get( l7rule_id="", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) @parametrize async def test_method_replace(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.load_balancers.l7_policies.rules.replace( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + compare_type="REGEX", ) assert_matches_type(TaskIDList, rule, path=["response"]) @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.load_balancers.l7_policies.rules.replace( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", - compare_type="CONTAINS", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + compare_type="REGEX", invert=True, - key="key", - tags=["string"], - type="COOKIE", - value="value", + key="the name of the cookie to evaluate.", + tags=["test_tag_1", "test_tag_2"], + type="PATH", + value="/images*", ) assert_matches_type(TaskIDList, rule, path=["response"]) @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.replace( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + compare_type="REGEX", ) assert response.is_closed is True @@ -610,10 +621,11 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.l7_policies.rules.with_streaming_response.replace( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + compare_type="REGEX", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -627,16 +639,18 @@ async def test_streaming_response_replace(self, async_client: AsyncGcore) -> Non async def test_path_params_replace(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.rules.with_raw_response.replace( - l7rule_id="l7rule_id", - project_id=0, - region_id=0, + l7rule_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, l7policy_id="", + compare_type="REGEX", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7rule_id` but received ''"): await async_client.cloud.load_balancers.l7_policies.rules.with_raw_response.replace( l7rule_id="", - project_id=0, - region_id=0, - l7policy_id="l7policy_id", + project_id=1, + region_id=1, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + compare_type="REGEX", ) 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 769aa5f8..52a01256 100644 --- a/tests/api_resources/cloud/load_balancers/test_l7_policies.py +++ b/tests/api_resources/cloud/load_balancers/test_l7_policies.py @@ -9,7 +9,11 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, LoadBalancerL7Policy, LoadBalancerL7PolicyList +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.load_balancers import ( + L7PolicyGetResponse, + L7PolicyListResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,39 +22,39 @@ class TestL7Policies: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_create(self, client: Gcore) -> None: + def test_method_create_overload_1(self, client: Gcore) -> None: l7_policy = client.cloud.load_balancers.l7_policies.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, action="REDIRECT_TO_URL", listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + redirect_url="https://www.example.com", ) assert_matches_type(TaskIDList, l7_policy, path=["response"]) @parametrize - def test_method_create_with_all_params(self, client: Gcore) -> None: + def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: l7_policy = client.cloud.load_balancers.l7_policies.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, action="REDIRECT_TO_URL", listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + redirect_url="https://www.example.com", name="redirect-example.com", position=1, redirect_http_code=301, - redirect_pool_id="redirect_pool_id", - redirect_prefix="redirect_prefix", - redirect_url="http://www.example.com", tags=["test_tag"], ) assert_matches_type(TaskIDList, l7_policy, path=["response"]) @parametrize - def test_raw_response_create(self, client: Gcore) -> None: + def test_raw_response_create_overload_1(self, client: Gcore) -> None: response = client.cloud.load_balancers.l7_policies.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, action="REDIRECT_TO_URL", listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + redirect_url="https://www.example.com", ) assert response.is_closed is True @@ -59,12 +63,181 @@ def test_raw_response_create(self, client: Gcore) -> None: assert_matches_type(TaskIDList, l7_policy, path=["response"]) @parametrize - def test_streaming_response_create(self, client: Gcore) -> None: + def test_streaming_response_create_overload_1(self, client: Gcore) -> None: with client.cloud.load_balancers.l7_policies.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, action="REDIRECT_TO_URL", listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_method_create_overload_2(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.create( + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + redirect_prefix="/api/v1/policies", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.create( + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_create_overload_2(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.with_raw_response.create( + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_create_overload_2(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.with_streaming_response.create( + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_method_create_overload_3(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.create( + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + redirect_pool_id="00000000-0000-4000-8000-000000000000", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_3(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.create( + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_create_overload_3(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.with_raw_response.create( + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_create_overload_3(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.with_streaming_response.create( + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_method_create_overload_4(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.create( + project_id=1, + region_id=1, + action="REJECT", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_4(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.create( + project_id=1, + region_id=1, + action="REJECT", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + name="redirect-example.com", + position=1, + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_raw_response_create_overload_4(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.with_raw_response.create( + project_id=1, + region_id=1, + action="REJECT", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + ) + + 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_create_overload_4(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.with_streaming_response.create( + project_id=1, + region_id=1, + action="REJECT", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -77,52 +250,52 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: l7_policy = client.cloud.load_balancers.l7_policies.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) - assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) + assert_matches_type(L7PolicyListResponse, l7_policy, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.load_balancers.l7_policies.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = response.parse() - assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) + assert_matches_type(L7PolicyListResponse, l7_policy, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.load_balancers.l7_policies.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = response.parse() - assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) + assert_matches_type(L7PolicyListResponse, l7_policy, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: Gcore) -> None: l7_policy = client.cloud.load_balancers.l7_policies.delete( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, l7_policy, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.load_balancers.l7_policies.with_raw_response.delete( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -133,9 +306,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.load_balancers.l7_policies.with_streaming_response.delete( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -150,44 +323,44 @@ def test_path_params_delete(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.delete( l7policy_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_get(self, client: Gcore) -> None: l7_policy = client.cloud.load_balancers.l7_policies.get( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) - assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) + assert_matches_type(L7PolicyGetResponse, l7_policy, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.load_balancers.l7_policies.with_raw_response.get( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = response.parse() - assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) + assert_matches_type(L7PolicyGetResponse, l7_policy, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.load_balancers.l7_policies.with_streaming_response.get( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = response.parse() - assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) + assert_matches_type(L7PolicyGetResponse, l7_policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -196,44 +369,44 @@ def test_path_params_get(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.get( l7policy_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize - def test_method_replace(self, client: Gcore) -> None: + def test_method_replace_overload_1(self, client: Gcore) -> None: l7_policy = client.cloud.load_balancers.l7_policies.replace( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + 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(self, client: Gcore) -> None: + def test_method_replace_with_all_params_overload_1(self, client: Gcore) -> None: l7_policy = client.cloud.load_balancers.l7_policies.replace( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, action="REDIRECT_TO_URL", - name="redirect-images.example.com", + redirect_url="https://www.example.com", + name="redirect-example.com", position=1, redirect_http_code=301, - redirect_pool_id="redirect_pool_id", - redirect_prefix="redirect_prefix", - redirect_url="http://images.example.com", - tags=["updated_tag"], + tags=["test_tag"], ) assert_matches_type(TaskIDList, l7_policy, path=["response"]) @parametrize - def test_raw_response_replace(self, client: Gcore) -> None: + def test_raw_response_replace_overload_1(self, client: Gcore) -> None: response = client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + 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 @@ -242,12 +415,13 @@ def test_raw_response_replace(self, client: Gcore) -> None: assert_matches_type(TaskIDList, l7_policy, path=["response"]) @parametrize - def test_streaming_response_replace(self, client: Gcore) -> None: + def test_streaming_response_replace_overload_1(self, client: Gcore) -> None: with client.cloud.load_balancers.l7_policies.with_streaming_response.replace( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + 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" @@ -258,13 +432,214 @@ def test_streaming_response_replace(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_replace(self, client: Gcore) -> None: + 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=0, - region_id=0, + 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", ) @@ -274,39 +649,39 @@ class TestAsyncL7Policies: ) @parametrize - async def test_method_create(self, async_client: AsyncGcore) -> None: + async def test_method_create_overload_1(self, async_client: AsyncGcore) -> None: l7_policy = await async_client.cloud.load_balancers.l7_policies.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, action="REDIRECT_TO_URL", listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + redirect_url="https://www.example.com", ) assert_matches_type(TaskIDList, l7_policy, path=["response"]) @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + async def test_method_create_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: l7_policy = await async_client.cloud.load_balancers.l7_policies.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, action="REDIRECT_TO_URL", listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + redirect_url="https://www.example.com", name="redirect-example.com", position=1, redirect_http_code=301, - redirect_pool_id="redirect_pool_id", - redirect_prefix="redirect_prefix", - redirect_url="http://www.example.com", tags=["test_tag"], ) assert_matches_type(TaskIDList, l7_policy, path=["response"]) @parametrize - async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + async def test_raw_response_create_overload_1(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, action="REDIRECT_TO_URL", listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + redirect_url="https://www.example.com", ) assert response.is_closed is True @@ -315,12 +690,181 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: assert_matches_type(TaskIDList, l7_policy, path=["response"]) @parametrize - async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async def test_streaming_response_create_overload_1(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, action="REDIRECT_TO_URL", listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_method_create_overload_2(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.create( + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + redirect_prefix="/api/v1/policies", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.create( + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_create_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.create( + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_create_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.create( + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_method_create_overload_3(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.create( + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + redirect_pool_id="00000000-0000-4000-8000-000000000000", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.create( + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_create_overload_3(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.create( + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_create_overload_3(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.create( + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + 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_method_create_overload_4(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.create( + project_id=1, + region_id=1, + action="REJECT", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_4(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.create( + project_id=1, + region_id=1, + action="REJECT", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + name="redirect-example.com", + position=1, + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_4(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.create( + project_id=1, + region_id=1, + action="REJECT", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", + ) + + 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_create_overload_4(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.create( + project_id=1, + region_id=1, + action="REJECT", + listener_id="023f2e34-7806-443b-bfae-16c324569a3d", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -333,52 +877,52 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: l7_policy = await async_client.cloud.load_balancers.l7_policies.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) - assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) + assert_matches_type(L7PolicyListResponse, l7_policy, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = await response.parse() - assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) + assert_matches_type(L7PolicyListResponse, l7_policy, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) 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(LoadBalancerL7PolicyList, l7_policy, path=["response"]) + assert_matches_type(L7PolicyListResponse, l7_policy, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: l7_policy = await async_client.cloud.load_balancers.l7_policies.delete( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) assert_matches_type(TaskIDList, l7_policy, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.delete( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -389,9 +933,9 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.delete( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -406,44 +950,44 @@ async def test_path_params_delete(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.delete( l7policy_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: l7_policy = await async_client.cloud.load_balancers.l7_policies.get( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) - assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) + assert_matches_type(L7PolicyGetResponse, l7_policy, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.get( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = await response.parse() - assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) + assert_matches_type(L7PolicyGetResponse, l7_policy, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.get( - l7policy_id="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, ) 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(LoadBalancerL7Policy, l7_policy, path=["response"]) + assert_matches_type(L7PolicyGetResponse, l7_policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -452,44 +996,44 @@ async def test_path_params_get(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.get( l7policy_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize - async def test_method_replace(self, async_client: AsyncGcore) -> None: + 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="l7policy_id", - project_id=0, - region_id=0, + 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(self, async_client: AsyncGcore) -> None: + 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="l7policy_id", - project_id=0, - region_id=0, + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, action="REDIRECT_TO_URL", - name="redirect-images.example.com", + redirect_url="https://www.example.com", + name="redirect-example.com", position=1, redirect_http_code=301, - redirect_pool_id="redirect_pool_id", - redirect_prefix="redirect_prefix", - redirect_url="http://images.example.com", - tags=["updated_tag"], + tags=["test_tag"], ) assert_matches_type(TaskIDList, l7_policy, path=["response"]) @parametrize - async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + 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="l7policy_id", - project_id=0, - region_id=0, + 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 @@ -498,12 +1042,13 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: assert_matches_type(TaskIDList, l7_policy, path=["response"]) @parametrize - async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + 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="l7policy_id", - project_id=0, - region_id=0, + 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" @@ -514,11 +1059,212 @@ async def test_streaming_response_replace(self, async_client: AsyncGcore) -> Non assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_replace(self, async_client: AsyncGcore) -> None: + 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=0, - region_id=0, + 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_ssh_keys.py b/tests/api_resources/cloud/test_ssh_keys.py index e1049f06..14428dbf 100644 --- a/tests/api_resources/cloud/test_ssh_keys.py +++ b/tests/api_resources/cloud/test_ssh_keys.py @@ -120,6 +120,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: ssh_key = client.cloud.ssh_keys.list( project_id=1, limit=100, + name="my-ssh-key", offset=0, order_by="created_at.desc", ) @@ -341,6 +342,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No ssh_key = await async_client.cloud.ssh_keys.list( project_id=1, limit=100, + name="my-ssh-key", offset=0, order_by="created_at.desc", ) From ba80e9253835d27687d25f6b7c1fb35d13911d60 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Nov 2025 23:26:34 +0000 Subject: [PATCH 441/592] chore(internal): codegen related update --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 5db643b3..47cc9210 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Operating System :: OS Independent", "Operating System :: POSIX", "Operating System :: MacOS", From f584c2204edb82172cda276cd8ea1cc286057665 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 08:14:14 +0000 Subject: [PATCH 442/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cloud/baremetal/servers.py | 14 +++--- .../cloud/file_shares/file_shares.py | 28 ++++++----- src/gcore/resources/cloud/floating_ips.py | 14 +++--- .../gpu_baremetal_clusters.py | 14 +++--- .../cloud/gpu_baremetal_clusters/images.py | 14 +++--- .../gpu_virtual_clusters.py | 14 +++--- .../cloud/gpu_virtual_clusters/images.py | 14 +++--- src/gcore/resources/cloud/instances/images.py | 42 +++++++++------- .../resources/cloud/instances/instances.py | 14 +++--- .../cloud/load_balancers/load_balancers.py | 14 +++--- .../resources/cloud/networks/networks.py | 14 +++--- src/gcore/resources/cloud/networks/subnets.py | 14 +++--- src/gcore/resources/cloud/volumes.py | 42 +++++++++------- .../cloud/baremetal/server_create_params.py | 8 ++-- src/gcore/types/cloud/blackhole_port.py | 5 +- .../types/cloud/file_share_create_params.py | 16 +++---- .../types/cloud/floating_ip_create_params.py | 8 ++-- .../gpu_baremetal_cluster_create_params.py | 8 ++-- .../image_upload_params.py | 8 ++-- .../gpu_virtual_cluster_create_params.py | 8 ++-- .../image_upload_params.py | 8 ++-- .../types/cloud/instance_create_params.py | 48 +++++++++---------- .../image_create_from_volume_params.py | 8 ++-- .../cloud/instances/image_update_params.py | 8 ++-- .../cloud/instances/image_upload_params.py | 8 ++-- .../cloud/load_balancer_create_params.py | 8 ++-- .../types/cloud/network_create_params.py | 8 ++-- .../cloud/networks/subnet_create_params.py | 8 ++-- .../cloud/security_group_create_params.py | 10 ++-- src/gcore/types/cloud/tag.py | 4 +- src/gcore/types/cloud/volume_create_params.py | 24 +++++----- .../cloud/test_security_groups.py | 4 +- 33 files changed, 251 insertions(+), 212 deletions(-) diff --git a/.stats.yml b/.stats.yml index 46bf2109..00e87d83 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-7450831dcb145c2b5eb10805035c43d581849e4e1275084f861e0b16a6cd9590.yml -openapi_spec_hash: 89399bb5359562184e8ac9c59425daf3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-61246c736228a6c005ecc784c08b6339b9afff6b3ea7225ef6bad7112e158355.yml +openapi_spec_hash: 2dfeaccd1623885572ec0f968f8f50c0 config_hash: 8d6e241ecf37049888c3c2d7b8ec38d3 diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 03b39269..e9f8d073 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -135,9 +135,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when 'password' field is provided. For Windows instances, Admin user password is set @@ -505,9 +506,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when 'password' field is provided. For Windows instances, Admin user password is set diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 253553dc..350398f9 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -105,9 +105,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. type_name: Standard file share type @@ -161,9 +162,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. type_name: Vast file share type @@ -585,9 +587,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. type_name: Standard file share type @@ -641,9 +644,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. type_name: Vast file share type diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index fc9675fd..bfccd253 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -90,9 +90,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -505,9 +506,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py index 359aaa67..c4012ae1 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py @@ -141,9 +141,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -703,9 +704,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 5e2003c2..66f405cd 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -227,9 +227,10 @@ def upload( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -468,9 +469,10 @@ async def upload( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py b/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py index 59d7b44a..6d00751f 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py +++ b/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py @@ -148,9 +148,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -797,9 +798,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/images.py b/src/gcore/resources/cloud/gpu_virtual_clusters/images.py index 47315e2a..8d408ad5 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_virtual_clusters/images.py @@ -227,9 +227,10 @@ def upload( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -468,9 +469,10 @@ async def upload( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index c23fde30..7691ba3e 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -91,9 +91,10 @@ def update( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -285,9 +286,10 @@ def create_from_volume( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -425,9 +427,10 @@ def upload( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -525,9 +528,10 @@ async def update( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -719,9 +723,10 @@ async def create_from_volume( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -859,9 +864,10 @@ async def upload( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index d086607c..fe34b4e1 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -210,9 +210,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when 'password' field is provided. For Windows instances, Admin user password is set @@ -1268,9 +1269,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when 'password' field is provided. For Windows instances, Admin user password is set diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index b53f3b4e..8d4aece6 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -179,9 +179,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. vip_ip_family: IP family for load balancer subnet auto-selection if `vip_network_id` is specified @@ -684,9 +685,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. vip_ip_family: IP family for load balancer subnet auto-selection if `vip_network_id` is specified diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 64e93a05..fbbfeccf 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -101,9 +101,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. type: vlan or vxlan network type is allowed. Default value is vxlan @@ -446,9 +447,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. type: vlan or vxlan network type is allowed. Default value is vxlan diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index f4c918c2..6de45b06 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -108,9 +108,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -510,9 +511,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index ba0e3c85..3ecbe665 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -107,9 +107,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`, volume type will be derived from the snapshot volume. @@ -176,9 +177,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`, volume type will be derived from the snapshot volume. @@ -241,9 +243,10 @@ def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`, volume type will be derived from the snapshot volume. @@ -919,9 +922,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`, volume type will be derived from the snapshot volume. @@ -988,9 +992,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`, volume type will be derived from the snapshot volume. @@ -1053,9 +1058,10 @@ async def create( tags: Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for - better organization and management. 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. + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`, volume type will be derived from the snapshot volume. diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index fb749577..e477245e 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -91,10 +91,10 @@ class ServerCreateParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ user_data: str diff --git a/src/gcore/types/cloud/blackhole_port.py b/src/gcore/types/cloud/blackhole_port.py index 6b51cf32..8586ddc3 100644 --- a/src/gcore/types/cloud/blackhole_port.py +++ b/src/gcore/types/cloud/blackhole_port.py @@ -12,7 +12,10 @@ class BlackholePort(BaseModel): alarm_end: datetime = FieldInfo(alias="AlarmEnd") - """A date-time string giving the time that the alarm ended""" + """A date-time string giving the time that the alarm ended. + + If not yet ended, time will be given as 0001-01-01T00:00:00Z + """ alarm_start: datetime = FieldInfo(alias="AlarmStart") """A date-time string giving the time that the alarm started""" diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index c1c8624b..718f0055 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -41,10 +41,10 @@ class CreateStandardFileShareSerializer(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ type_name: Literal["standard"] @@ -96,10 +96,10 @@ class CreateVastFileShareSerializer(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ type_name: Literal["vast"] diff --git a/src/gcore/types/cloud/floating_ip_create_params.py b/src/gcore/types/cloud/floating_ip_create_params.py index 01d7f41b..48cddda9 100644 --- a/src/gcore/types/cloud/floating_ip_create_params.py +++ b/src/gcore/types/cloud/floating_ip_create_params.py @@ -31,8 +31,8 @@ class FloatingIPCreateParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py index 7bdf8a8a..faf830e3 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -46,10 +46,10 @@ class GPUBaremetalClusterCreateParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py index c83f5687..4cae77be 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py @@ -49,8 +49,8 @@ class ImageUploadParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py b/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py index acf172b3..d0f2f050 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py @@ -46,10 +46,10 @@ class GPUVirtualClusterCreateParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py index c83f5687..4cae77be 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py +++ b/src/gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py @@ -49,8 +49,8 @@ class ImageUploadParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index 0362ecb1..0a279d23 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -118,10 +118,10 @@ class InstanceCreateParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ user_data: str @@ -394,10 +394,10 @@ class VolumeCreateInstanceCreateNewVolumeSerializer(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] @@ -455,10 +455,10 @@ class VolumeCreateInstanceCreateVolumeFromImageSerializer(TypedDict, total=False """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] @@ -509,10 +509,10 @@ class VolumeCreateInstanceCreateVolumeFromSnapshotSerializer(TypedDict, total=Fa """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ type_name: Literal["ssd_hiiops", "standard"] @@ -555,10 +555,10 @@ class VolumeCreateInstanceCreateVolumeFromApptemplateSerializer(TypedDict, total """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] @@ -600,10 +600,10 @@ class VolumeCreateInstanceExistingVolumeSerializer(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ diff --git a/src/gcore/types/cloud/instances/image_create_from_volume_params.py b/src/gcore/types/cloud/instances/image_create_from_volume_params.py index 70dd351f..d98e34ae 100644 --- a/src/gcore/types/cloud/instances/image_create_from_volume_params.py +++ b/src/gcore/types/cloud/instances/image_create_from_volume_params.py @@ -44,8 +44,8 @@ class ImageCreateFromVolumeParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ diff --git a/src/gcore/types/cloud/instances/image_update_params.py b/src/gcore/types/cloud/instances/image_update_params.py index 6676110f..d51c715f 100644 --- a/src/gcore/types/cloud/instances/image_update_params.py +++ b/src/gcore/types/cloud/instances/image_update_params.py @@ -36,8 +36,8 @@ class ImageUpdateParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ diff --git a/src/gcore/types/cloud/instances/image_upload_params.py b/src/gcore/types/cloud/instances/image_upload_params.py index 08cfe96f..4085ea54 100644 --- a/src/gcore/types/cloud/instances/image_upload_params.py +++ b/src/gcore/types/cloud/instances/image_upload_params.py @@ -53,8 +53,8 @@ class ImageUploadParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 4a635ca3..e75028f8 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -73,10 +73,10 @@ class LoadBalancerCreateParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ vip_ip_family: InterfaceIPFamily diff --git a/src/gcore/types/cloud/network_create_params.py b/src/gcore/types/cloud/network_create_params.py index da45b25c..b4cb5e77 100644 --- a/src/gcore/types/cloud/network_create_params.py +++ b/src/gcore/types/cloud/network_create_params.py @@ -25,10 +25,10 @@ class NetworkCreateParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ type: Literal["vlan", "vxlan"] diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index 6d8b3749..5a6b365f 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -64,10 +64,10 @@ class SubnetCreateParams(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ diff --git a/src/gcore/types/cloud/security_group_create_params.py b/src/gcore/types/cloud/security_group_create_params.py index 4721a5dc..35527106 100644 --- a/src/gcore/types/cloud/security_group_create_params.py +++ b/src/gcore/types/cloud/security_group_create_params.py @@ -85,12 +85,12 @@ class SecurityGroup(TypedDict, total=False): security_group_rules: Iterable[SecurityGroupSecurityGroupRule] """Security group rules""" - tags: Dict[str, object] + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ diff --git a/src/gcore/types/cloud/tag.py b/src/gcore/types/cloud/tag.py index bf23a3ce..e53068dc 100644 --- a/src/gcore/types/cloud/tag.py +++ b/src/gcore/types/cloud/tag.py @@ -7,10 +7,10 @@ class Tag(BaseModel): key: str - """Tag key. The maximum size for a key is 255 bytes.""" + """Tag key. The maximum size for a key is 255 characters.""" read_only: bool """If true, the tag is read-only and cannot be modified by the user""" value: str - """Tag value. The maximum size for a value is 1024 bytes.""" + """Tag value. The maximum size for a value is 255 characters.""" diff --git a/src/gcore/types/cloud/volume_create_params.py b/src/gcore/types/cloud/volume_create_params.py index 49b57128..2e2dd5a7 100644 --- a/src/gcore/types/cloud/volume_create_params.py +++ b/src/gcore/types/cloud/volume_create_params.py @@ -53,10 +53,10 @@ class CreateVolumeFromImageSerializer(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] @@ -108,10 +108,10 @@ class CreateVolumeFromSnapshotSerializer(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] @@ -157,10 +157,10 @@ class CreateNewVolumeSerializer(TypedDict, total=False): """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. 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. + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. """ type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index 24ed373f..d1ca3713 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -49,7 +49,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "remote_ip_prefix": "10.0.0.0/8", } ], - "tags": {"my-tag": "bar"}, + "tags": {"my-tag": "my-tag-value"}, }, instances=["00000000-0000-4000-8000-000000000000"], ) @@ -423,7 +423,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "remote_ip_prefix": "10.0.0.0/8", } ], - "tags": {"my-tag": "bar"}, + "tags": {"my-tag": "my-tag-value"}, }, instances=["00000000-0000-4000-8000-000000000000"], ) From 7c24626db8f2ea255ba1941cd40862a2938ac2ff Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 13:51:53 +0000 Subject: [PATCH 443/592] feat(cloud)!: updates to get/list LB l7 policy/rules models --- .stats.yml | 2 +- api.md | 24 ++-- .../load_balancers/l7_policies/l7_policies.py | 20 ++-- .../cloud/load_balancers/l7_policies/rules.py | 20 ++-- src/gcore/types/cloud/__init__.py | 4 + ...response.py => load_balancer_l7_policy.py} | 10 +- .../cloud/load_balancer_l7_policy_list.py | 16 +++ ...t_response.py => load_balancer_l7_rule.py} | 10 +- .../types/cloud/load_balancer_l7_rule_list.py | 16 +++ .../types/cloud/load_balancers/__init__.py | 2 - .../load_balancers/l7_policies/__init__.py | 2 - .../l7_policies/rule_list_response.py | 71 ------------ .../load_balancers/l7_policy_list_response.py | 107 ------------------ .../load_balancers/l7_policies/test_rules.py | 30 +++-- .../cloud/load_balancers/test_l7_policies.py | 30 +++-- 15 files changed, 101 insertions(+), 263 deletions(-) rename src/gcore/types/cloud/{load_balancers/l7_policy_get_response.py => load_balancer_l7_policy.py} (90%) create mode 100644 src/gcore/types/cloud/load_balancer_l7_policy_list.py rename src/gcore/types/cloud/{load_balancers/l7_policies/rule_get_response.py => load_balancer_l7_rule.py} (86%) create mode 100644 src/gcore/types/cloud/load_balancer_l7_rule_list.py delete mode 100644 src/gcore/types/cloud/load_balancers/l7_policies/rule_list_response.py delete mode 100644 src/gcore/types/cloud/load_balancers/l7_policy_list_response.py diff --git a/.stats.yml b/.stats.yml index 00e87d83..793e7281 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-61246c736228a6c005ecc784c08b6339b9afff6b3ea7225ef6bad7112e158355.yml openapi_spec_hash: 2dfeaccd1623885572ec0f968f8f50c0 -config_hash: 8d6e241ecf37049888c3c2d7b8ec38d3 +config_hash: 2fb8878094f57ab57cb3449ee009646e diff --git a/api.md b/api.md index c6903489..6158d8b8 100644 --- a/api.md +++ b/api.md @@ -188,6 +188,10 @@ from gcore.types.cloud import ( ListenerStatus, LoadBalancerFlavorDetail, LoadBalancerFlavorList, + LoadBalancerL7Policy, + LoadBalancerL7PolicyList, + LoadBalancerL7Rule, + LoadBalancerL7RuleList, LoadBalancerListenerDetail, LoadBalancerListenerList, LoadBalancerMetrics, @@ -215,34 +219,22 @@ Methods: ### L7Policies -Types: - -```python -from gcore.types.cloud.load_balancers import L7PolicyListResponse, L7PolicyGetResponse -``` - Methods: - client.cloud.load_balancers.l7_policies.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.l7_policies.list(\*, project_id, region_id) -> L7PolicyListResponse +- 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) -> L7PolicyGetResponse +- 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 -Types: - -```python -from gcore.types.cloud.load_balancers.l7_policies import RuleListResponse, RuleGetResponse -``` - Methods: - client.cloud.load_balancers.l7_policies.rules.create(l7policy_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.l7_policies.rules.list(l7policy_id, \*, project_id, region_id) -> RuleListResponse +- client.cloud.load_balancers.l7_policies.rules.list(l7policy_id, \*, project_id, region_id) -> LoadBalancerL7RuleList - client.cloud.load_balancers.l7_policies.rules.delete(l7rule_id, \*, project_id, region_id, l7policy_id) -> TaskIDList -- client.cloud.load_balancers.l7_policies.rules.get(l7rule_id, \*, project_id, region_id, l7policy_id) -> RuleGetResponse +- client.cloud.load_balancers.l7_policies.rules.get(l7rule_id, \*, project_id, region_id, l7policy_id) -> LoadBalancerL7Rule - client.cloud.load_balancers.l7_policies.rules.replace(l7rule_id, \*, project_id, region_id, l7policy_id, \*\*params) -> TaskIDList ### Flavors diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index 0ca05e3d..fe09dde4 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 @@ -27,8 +27,8 @@ 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.l7_policy_get_response import L7PolicyGetResponse -from .....types.cloud.load_balancers.l7_policy_list_response import L7PolicyListResponse +from .....types.cloud.load_balancer_l7_policy import LoadBalancerL7Policy +from .....types.cloud.load_balancer_l7_policy_list import LoadBalancerL7PolicyList __all__ = ["L7PoliciesResource", "AsyncL7PoliciesResource"] @@ -327,7 +327,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> L7PolicyListResponse: + ) -> LoadBalancerL7PolicyList: """ List load balancer L7 policies @@ -353,7 +353,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=L7PolicyListResponse, + cast_to=LoadBalancerL7PolicyList, ) def delete( @@ -413,7 +413,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> L7PolicyGetResponse: + ) -> LoadBalancerL7Policy: """ Get load balancer L7 policy @@ -443,7 +443,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=L7PolicyGetResponse, + cast_to=LoadBalancerL7Policy, ) @overload @@ -1015,7 +1015,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> L7PolicyListResponse: + ) -> LoadBalancerL7PolicyList: """ List load balancer L7 policies @@ -1041,7 +1041,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=L7PolicyListResponse, + cast_to=LoadBalancerL7PolicyList, ) async def delete( @@ -1101,7 +1101,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> L7PolicyGetResponse: + ) -> LoadBalancerL7Policy: """ Get load balancer L7 policy @@ -1131,7 +1131,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=L7PolicyGetResponse, + cast_to=LoadBalancerL7Policy, ) @overload 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 8cf06b94..3f76d0cd 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -18,9 +18,9 @@ ) from ....._base_client import make_request_options from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.load_balancer_l7_rule import LoadBalancerL7Rule +from .....types.cloud.load_balancer_l7_rule_list import LoadBalancerL7RuleList from .....types.cloud.load_balancers.l7_policies import rule_create_params, rule_replace_params -from .....types.cloud.load_balancers.l7_policies.rule_get_response import RuleGetResponse -from .....types.cloud.load_balancers.l7_policies.rule_list_response import RuleListResponse __all__ = ["RulesResource", "AsyncRulesResource"] @@ -140,7 +140,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RuleListResponse: + ) -> LoadBalancerL7RuleList: """ List load balancer L7 policy rules @@ -170,7 +170,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RuleListResponse, + cast_to=LoadBalancerL7RuleList, ) def delete( @@ -236,7 +236,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RuleGetResponse: + ) -> LoadBalancerL7Rule: """ Get load balancer L7 rule @@ -270,7 +270,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RuleGetResponse, + cast_to=LoadBalancerL7Rule, ) def replace( @@ -478,7 +478,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RuleListResponse: + ) -> LoadBalancerL7RuleList: """ List load balancer L7 policy rules @@ -508,7 +508,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RuleListResponse, + cast_to=LoadBalancerL7RuleList, ) async def delete( @@ -574,7 +574,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RuleGetResponse: + ) -> LoadBalancerL7Rule: """ Get load balancer L7 rule @@ -608,7 +608,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RuleGetResponse, + cast_to=LoadBalancerL7Rule, ) async def replace( diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 554c0e96..e97ac01a 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -91,6 +91,7 @@ from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate from .gpu_baremetal_cluster import GPUBaremetalCluster as GPUBaremetalCluster from .health_monitor_status import HealthMonitorStatus as HealthMonitorStatus +from .load_balancer_l7_rule import LoadBalancerL7Rule as LoadBalancerL7Rule from .load_balancer_metrics import LoadBalancerMetrics as LoadBalancerMetrics from .network_create_params import NetworkCreateParams as NetworkCreateParams from .network_update_params import NetworkUpdateParams as NetworkUpdateParams @@ -111,6 +112,7 @@ from .registry_create_params import RegistryCreateParams as RegistryCreateParams from .registry_resize_params import RegistryResizeParams as RegistryResizeParams from .floating_ip_list_params import FloatingIPListParams as FloatingIPListParams +from .load_balancer_l7_policy import LoadBalancerL7Policy as LoadBalancerL7Policy from .load_balancer_pool_list import LoadBalancerPoolList as LoadBalancerPoolList from .usage_report_get_params import UsageReportGetParams as UsageReportGetParams from .ddos_profile_option_list import DDOSProfileOptionList as DDOSProfileOptionList @@ -130,6 +132,7 @@ from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit +from .load_balancer_l7_rule_list import LoadBalancerL7RuleList as LoadBalancerL7RuleList from .load_balancer_metrics_list import LoadBalancerMetricsList as LoadBalancerMetricsList from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams @@ -145,6 +148,7 @@ from .load_balancer_resize_params import LoadBalancerResizeParams as LoadBalancerResizeParams from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .task_acknowledge_all_params import TaskAcknowledgeAllParams as TaskAcknowledgeAllParams +from .load_balancer_l7_policy_list import LoadBalancerL7PolicyList as LoadBalancerL7PolicyList from .quota_get_by_region_response import QuotaGetByRegionResponse as QuotaGetByRegionResponse from .security_group_create_params import SecurityGroupCreateParams as SecurityGroupCreateParams from .security_group_update_params import SecurityGroupUpdateParams as SecurityGroupUpdateParams diff --git a/src/gcore/types/cloud/load_balancers/l7_policy_get_response.py b/src/gcore/types/cloud/load_balancer_l7_policy.py similarity index 90% rename from src/gcore/types/cloud/load_balancers/l7_policy_get_response.py rename to src/gcore/types/cloud/load_balancer_l7_policy.py index ba2b9259..1619c8f9 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policy_get_response.py +++ b/src/gcore/types/cloud/load_balancer_l7_policy.py @@ -3,11 +3,11 @@ from typing import List, Optional from typing_extensions import Literal -from ...._models import BaseModel -from ..provisioning_status import ProvisioningStatus -from ..load_balancer_operating_status import LoadBalancerOperatingStatus +from ..._models import BaseModel +from .provisioning_status import ProvisioningStatus +from .load_balancer_operating_status import LoadBalancerOperatingStatus -__all__ = ["L7PolicyGetResponse", "Rule"] +__all__ = ["LoadBalancerL7Policy", "Rule"] class Rule(BaseModel): @@ -24,7 +24,7 @@ class Rule(BaseModel): """Region ID""" -class L7PolicyGetResponse(BaseModel): +class LoadBalancerL7Policy(BaseModel): id: str """ID""" diff --git a/src/gcore/types/cloud/load_balancer_l7_policy_list.py b/src/gcore/types/cloud/load_balancer_l7_policy_list.py new file mode 100644 index 00000000..b1b156f1 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_l7_policy_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .load_balancer_l7_policy import LoadBalancerL7Policy + +__all__ = ["LoadBalancerL7PolicyList"] + + +class LoadBalancerL7PolicyList(BaseModel): + count: int + """Number of objects""" + + results: List[LoadBalancerL7Policy] + """Objects""" diff --git a/src/gcore/types/cloud/load_balancers/l7_policies/rule_get_response.py b/src/gcore/types/cloud/load_balancer_l7_rule.py similarity index 86% rename from src/gcore/types/cloud/load_balancers/l7_policies/rule_get_response.py rename to src/gcore/types/cloud/load_balancer_l7_rule.py index 55a99540..4c6b3c5d 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policies/rule_get_response.py +++ b/src/gcore/types/cloud/load_balancer_l7_rule.py @@ -3,14 +3,14 @@ from typing import List, Optional from typing_extensions import Literal -from ....._models import BaseModel -from ...provisioning_status import ProvisioningStatus -from ...load_balancer_operating_status import LoadBalancerOperatingStatus +from ..._models import BaseModel +from .provisioning_status import ProvisioningStatus +from .load_balancer_operating_status import LoadBalancerOperatingStatus -__all__ = ["RuleGetResponse"] +__all__ = ["LoadBalancerL7Rule"] -class RuleGetResponse(BaseModel): +class LoadBalancerL7Rule(BaseModel): id: str """L7Rule ID""" diff --git a/src/gcore/types/cloud/load_balancer_l7_rule_list.py b/src/gcore/types/cloud/load_balancer_l7_rule_list.py new file mode 100644 index 00000000..58dee359 --- /dev/null +++ b/src/gcore/types/cloud/load_balancer_l7_rule_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from .load_balancer_l7_rule import LoadBalancerL7Rule + +__all__ = ["LoadBalancerL7RuleList"] + + +class LoadBalancerL7RuleList(BaseModel): + count: int + """Number of objects""" + + results: List[LoadBalancerL7Rule] + """Objects""" diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index 53d86f51..c68b77c9 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -9,10 +9,8 @@ from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .listener_get_params import ListenerGetParams as ListenerGetParams from .listener_list_params import ListenerListParams as ListenerListParams -from .l7_policy_get_response import L7PolicyGetResponse as L7PolicyGetResponse from .listener_create_params import ListenerCreateParams as ListenerCreateParams 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_list_response import L7PolicyListResponse as L7PolicyListResponse from .l7_policy_replace_params import L7PolicyReplaceParams as L7PolicyReplaceParams diff --git a/src/gcore/types/cloud/load_balancers/l7_policies/__init__.py b/src/gcore/types/cloud/load_balancers/l7_policies/__init__.py index 0c3d4dfe..832f1d77 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policies/__init__.py +++ b/src/gcore/types/cloud/load_balancers/l7_policies/__init__.py @@ -2,7 +2,5 @@ from __future__ import annotations -from .rule_get_response import RuleGetResponse as RuleGetResponse from .rule_create_params import RuleCreateParams as RuleCreateParams -from .rule_list_response import RuleListResponse as RuleListResponse from .rule_replace_params import RuleReplaceParams as RuleReplaceParams diff --git a/src/gcore/types/cloud/load_balancers/l7_policies/rule_list_response.py b/src/gcore/types/cloud/load_balancers/l7_policies/rule_list_response.py deleted file mode 100644 index ee543170..00000000 --- a/src/gcore/types/cloud/load_balancers/l7_policies/rule_list_response.py +++ /dev/null @@ -1,71 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ....._models import BaseModel -from ...provisioning_status import ProvisioningStatus -from ...load_balancer_operating_status import LoadBalancerOperatingStatus - -__all__ = ["RuleListResponse", "Result"] - - -class Result(BaseModel): - id: str - """L7Rule ID""" - - compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] - """The comparison type for the L7 rule""" - - invert: bool - """When true the logic of the rule is inverted. - - For example, with invert true, 'equal to' would become 'not equal to'. Default - is false. - """ - - key: Optional[str] = None - """The key to use for the comparison. - - For example, the name of the cookie to evaluate. - """ - - operating_status: LoadBalancerOperatingStatus - """L7 policy operating status""" - - project_id: int - """Project ID""" - - provisioning_status: ProvisioningStatus - - region: str - """Region name""" - - region_id: int - """Region ID""" - - tags: Optional[List[str]] = None - """A list of simple strings assigned to the l7 rule""" - - task_id: Optional[str] = None - """The UUID of the active task that currently holds a lock on the resource. - - This lock prevents concurrent modifications to ensure consistency. If `null`, - the resource is not locked. - """ - - type: Literal[ - "COOKIE", "FILE_TYPE", "HEADER", "HOST_NAME", "PATH", "SSL_CONN_HAS_CERT", "SSL_DN_FIELD", "SSL_VERIFY_RESULT" - ] - """The L7 rule type""" - - value: str - """The value to use for the comparison. For example, the file type to compare.""" - - -class RuleListResponse(BaseModel): - count: int - """Number of objects""" - - results: List[Result] - """Objects""" diff --git a/src/gcore/types/cloud/load_balancers/l7_policy_list_response.py b/src/gcore/types/cloud/load_balancers/l7_policy_list_response.py deleted file mode 100644 index b418937f..00000000 --- a/src/gcore/types/cloud/load_balancers/l7_policy_list_response.py +++ /dev/null @@ -1,107 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ...._models import BaseModel -from ..provisioning_status import ProvisioningStatus -from ..load_balancer_operating_status import LoadBalancerOperatingStatus - -__all__ = ["L7PolicyListResponse", "Result", "ResultRule"] - - -class ResultRule(BaseModel): - id: str - """L7Rule ID""" - - project_id: int - """Project ID""" - - region: str - """Region name""" - - region_id: int - """Region ID""" - - -class Result(BaseModel): - id: str - """ID""" - - action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"] - """Action""" - - listener_id: str - """Listener ID""" - - name: str - """Human-readable name of the policy""" - - operating_status: LoadBalancerOperatingStatus - """L7 policy operating status""" - - position: int - """The position of this policy on the listener. Positions start at 1.""" - - project_id: int - """Project ID""" - - provisioning_status: ProvisioningStatus - - redirect_http_code: Optional[int] = None - """ - 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. - """ - - redirect_pool_id: Optional[str] = None - """Requests matching this policy will be redirected to the pool with this ID. - - Only valid if action is `REDIRECT_TO_POOL`. - """ - - redirect_prefix: Optional[str] = None - """Requests matching this policy will be redirected to this Prefix URL. - - Only valid if action is `REDIRECT_PREFIX`. - """ - - redirect_url: Optional[str] = None - """Requests matching this policy will be redirected to this URL. - - Only valid if action is `REDIRECT_TO_URL`. - """ - - region: str - """Region name""" - - region_id: int - """Region ID""" - - rules: List[ResultRule] - """Rules. - - All the rules associated with a given policy are logically ANDed together. A - request must match all the policy’s rules to match the policy.If you need to - express a logical OR operation between rules, then do this by creating multiple - policies with the same action. - """ - - tags: List[str] - """A list of simple strings assigned to the resource.""" - - task_id: Optional[str] = None - """The UUID of the active task that currently holds a lock on the resource. - - This lock prevents concurrent modifications to ensure consistency. If `null`, - the resource is not locked. - """ - - -class L7PolicyListResponse(BaseModel): - count: int - """Number of objects""" - - results: List[Result] - """Objects""" 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 63f90fa0..bb3a27f2 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 @@ -9,11 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList -from gcore.types.cloud.load_balancers.l7_policies import ( - RuleGetResponse, - RuleListResponse, -) +from gcore.types.cloud import TaskIDList, LoadBalancerL7Rule, LoadBalancerL7RuleList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -101,7 +97,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(RuleListResponse, rule, path=["response"]) + assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -114,7 +110,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleListResponse, rule, path=["response"]) + assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -127,7 +123,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleListResponse, rule, path=["response"]) + assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -206,7 +202,7 @@ def test_method_get(self, client: Gcore) -> None: region_id=1, l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -220,7 +216,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -234,7 +230,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -421,7 +417,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(RuleListResponse, rule, path=["response"]) + assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -434,7 +430,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleListResponse, rule, path=["response"]) + assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -447,7 +443,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleListResponse, rule, path=["response"]) + assert_matches_type(LoadBalancerL7RuleList, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -526,7 +522,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: region_id=1, l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", ) - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -540,7 +536,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -554,7 +550,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleGetResponse, rule, path=["response"]) + assert_matches_type(LoadBalancerL7Rule, rule, path=["response"]) assert cast(Any, response.is_closed) is True 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 52a01256..5cff8201 100644 --- a/tests/api_resources/cloud/load_balancers/test_l7_policies.py +++ b/tests/api_resources/cloud/load_balancers/test_l7_policies.py @@ -9,11 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList -from gcore.types.cloud.load_balancers import ( - L7PolicyGetResponse, - L7PolicyListResponse, -) +from gcore.types.cloud import TaskIDList, LoadBalancerL7Policy, LoadBalancerL7PolicyList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -253,7 +249,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(L7PolicyListResponse, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -265,7 +261,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = response.parse() - assert_matches_type(L7PolicyListResponse, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -277,7 +273,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = response.parse() - assert_matches_type(L7PolicyListResponse, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -334,7 +330,7 @@ def test_method_get(self, client: Gcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(L7PolicyGetResponse, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -347,7 +343,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = response.parse() - assert_matches_type(L7PolicyGetResponse, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -360,7 +356,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = response.parse() - assert_matches_type(L7PolicyGetResponse, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -880,7 +876,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(L7PolicyListResponse, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -892,7 +888,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = await response.parse() - assert_matches_type(L7PolicyListResponse, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -904,7 +900,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = await response.parse() - assert_matches_type(L7PolicyListResponse, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7PolicyList, l7_policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -961,7 +957,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: project_id=1, region_id=1, ) - assert_matches_type(L7PolicyGetResponse, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -974,7 +970,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = await response.parse() - assert_matches_type(L7PolicyGetResponse, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -987,7 +983,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" l7_policy = await response.parse() - assert_matches_type(L7PolicyGetResponse, l7_policy, path=["response"]) + assert_matches_type(LoadBalancerL7Policy, l7_policy, path=["response"]) assert cast(Any, response.is_closed) is True From 49276a33b120bcd314a29e05cfedd6152fc5c779 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 25 Nov 2025 09:35:58 +0000 Subject: [PATCH 444/592] fix(cloud)!: k8s references from k8 to k8s --- .stats.yml | 2 +- api.md | 32 ++++----- src/gcore/resources/cloud/__init__.py | 24 +++---- src/gcore/resources/cloud/cloud.py | 36 +++++----- src/gcore/resources/cloud/k8s/__init__.py | 24 +++---- .../resources/cloud/k8s/clusters/clusters.py | 50 ++++++------- .../cloud/k8s/clusters/pools/pools.py | 28 ++++---- src/gcore/resources/cloud/k8s/k8s.py | 48 ++++++------- src/gcore/types/cloud/__init__.py | 4 +- src/gcore/types/cloud/k8s/__init__.py | 8 +-- .../types/cloud/k8s/cluster_update_params.py | 10 +-- .../types/cloud/k8s/clusters/__init__.py | 4 +- .../cloud/k8s/clusters/k8s_cluster_pool.py | 4 +- .../k8s/clusters/k8s_cluster_pool_list.py | 8 +-- src/gcore/types/cloud/k8s/k8s_cluster.py | 8 +-- .../cloud/k8s/k8s_cluster_certificate.py | 4 +- .../types/cloud/k8s/k8s_cluster_kubeconfig.py | 4 +- src/gcore/types/cloud/k8s/k8s_cluster_list.py | 8 +-- src/gcore/types/cloud/k8s_cluster_version.py | 4 +- .../types/cloud/k8s_cluster_version_list.py | 8 +-- .../cloud/k8s/clusters/test_pools.py | 44 ++++++------ .../api_resources/cloud/k8s/test_clusters.py | 70 +++++++++---------- tests/api_resources/cloud/test_k8s.py | 30 ++++---- 23 files changed, 231 insertions(+), 231 deletions(-) diff --git a/.stats.yml b/.stats.yml index 793e7281..0da4a381 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-61246c736228a6c005ecc784c08b6339b9afff6b3ea7225ef6bad7112e158355.yml openapi_spec_hash: 2dfeaccd1623885572ec0f968f8f50c0 -config_hash: 2fb8878094f57ab57cb3449ee009646e +config_hash: ed81680ad8f1babe06844ab73e7148d1 diff --git a/api.md b/api.md index 6158d8b8..5d4b590b 100644 --- a/api.md +++ b/api.md @@ -975,17 +975,17 @@ Methods: - client.cloud.instances.metrics.list(instance_id, \*, project_id, region_id, \*\*params) -> MetricsList -## K8s +## K8S Types: ```python -from gcore.types.cloud import K8sClusterVersion, K8sClusterVersionList +from gcore.types.cloud import K8SClusterVersion, K8SClusterVersionList ``` Methods: -- client.cloud.k8s.list_versions(\*, project_id, region_id) -> K8sClusterVersionList +- client.cloud.k8s.list_versions(\*, project_id, region_id) -> K8SClusterVersionList ### Flavors @@ -999,10 +999,10 @@ Types: ```python from gcore.types.cloud.k8s import ( - K8sCluster, - K8sClusterCertificate, - K8sClusterKubeconfig, - K8sClusterList, + K8SCluster, + K8SClusterCertificate, + K8SClusterKubeconfig, + K8SClusterList, ) ``` @@ -1010,12 +1010,12 @@ Methods: - client.cloud.k8s.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.k8s.clusters.update(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.k8s.clusters.list(\*, project_id, region_id) -> K8sClusterList +- client.cloud.k8s.clusters.list(\*, project_id, region_id) -> K8SClusterList - client.cloud.k8s.clusters.delete(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.k8s.clusters.get(cluster_name, \*, project_id, region_id) -> K8sCluster -- client.cloud.k8s.clusters.get_certificate(cluster_name, \*, project_id, region_id) -> K8sClusterCertificate -- client.cloud.k8s.clusters.get_kubeconfig(cluster_name, \*, project_id, region_id) -> K8sClusterKubeconfig -- client.cloud.k8s.clusters.list_versions_for_upgrade(cluster_name, \*, project_id, region_id) -> K8sClusterVersionList +- client.cloud.k8s.clusters.get(cluster_name, \*, project_id, region_id) -> K8SCluster +- client.cloud.k8s.clusters.get_certificate(cluster_name, \*, project_id, region_id) -> K8SClusterCertificate +- client.cloud.k8s.clusters.get_kubeconfig(cluster_name, \*, project_id, region_id) -> K8SClusterKubeconfig +- client.cloud.k8s.clusters.list_versions_for_upgrade(cluster_name, \*, project_id, region_id) -> K8SClusterVersionList - client.cloud.k8s.clusters.upgrade(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList #### Nodes @@ -1030,16 +1030,16 @@ Methods: Types: ```python -from gcore.types.cloud.k8s.clusters import K8sClusterPool, K8sClusterPoolList +from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolList ``` Methods: - client.cloud.k8s.clusters.pools.create(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.k8s.clusters.pools.update(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> K8sClusterPool -- client.cloud.k8s.clusters.pools.list(cluster_name, \*, project_id, region_id) -> K8sClusterPoolList +- client.cloud.k8s.clusters.pools.update(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> K8SClusterPool +- client.cloud.k8s.clusters.pools.list(cluster_name, \*, project_id, region_id) -> K8SClusterPoolList - client.cloud.k8s.clusters.pools.delete(pool_name, \*, project_id, region_id, cluster_name) -> TaskIDList -- client.cloud.k8s.clusters.pools.get(pool_name, \*, project_id, region_id, cluster_name) -> K8sClusterPool +- client.cloud.k8s.clusters.pools.get(pool_name, \*, project_id, region_id, cluster_name) -> K8SClusterPool - client.cloud.k8s.clusters.pools.resize(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> TaskIDList ##### Nodes diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 6ae9dac7..aa77fd72 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -1,12 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .k8s import ( - K8sResource, - AsyncK8sResource, - K8sResourceWithRawResponse, - AsyncK8sResourceWithRawResponse, - K8sResourceWithStreamingResponse, - AsyncK8sResourceWithStreamingResponse, + K8SResource, + AsyncK8SResource, + K8SResourceWithRawResponse, + AsyncK8SResourceWithRawResponse, + K8SResourceWithStreamingResponse, + AsyncK8SResourceWithStreamingResponse, ) from .cloud import ( CloudResource, @@ -372,12 +372,12 @@ "AsyncInstancesResourceWithRawResponse", "InstancesResourceWithStreamingResponse", "AsyncInstancesResourceWithStreamingResponse", - "K8sResource", - "AsyncK8sResource", - "K8sResourceWithRawResponse", - "AsyncK8sResourceWithRawResponse", - "K8sResourceWithStreamingResponse", - "AsyncK8sResourceWithStreamingResponse", + "K8SResource", + "AsyncK8SResource", + "K8SResourceWithRawResponse", + "AsyncK8SResourceWithRawResponse", + "K8SResourceWithStreamingResponse", + "AsyncK8SResourceWithStreamingResponse", "AuditLogsResource", "AsyncAuditLogsResource", "AuditLogsResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 3f9ad996..6147e663 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -11,12 +11,12 @@ AsyncTasksResourceWithStreamingResponse, ) from .k8s.k8s import ( - K8sResource, - AsyncK8sResource, - K8sResourceWithRawResponse, - AsyncK8sResourceWithRawResponse, - K8sResourceWithStreamingResponse, - AsyncK8sResourceWithStreamingResponse, + K8SResource, + AsyncK8SResource, + K8SResourceWithRawResponse, + AsyncK8SResourceWithRawResponse, + K8SResourceWithStreamingResponse, + AsyncK8SResourceWithStreamingResponse, ) from .regions import ( RegionsResource, @@ -333,8 +333,8 @@ def instances(self) -> InstancesResource: return InstancesResource(self._client) @cached_property - def k8s(self) -> K8sResource: - return K8sResource(self._client) + def k8s(self) -> K8SResource: + return K8SResource(self._client) @cached_property def audit_logs(self) -> AuditLogsResource: @@ -473,8 +473,8 @@ def instances(self) -> AsyncInstancesResource: return AsyncInstancesResource(self._client) @cached_property - def k8s(self) -> AsyncK8sResource: - return AsyncK8sResource(self._client) + def k8s(self) -> AsyncK8SResource: + return AsyncK8SResource(self._client) @cached_property def audit_logs(self) -> AsyncAuditLogsResource: @@ -616,8 +616,8 @@ def instances(self) -> InstancesResourceWithRawResponse: return InstancesResourceWithRawResponse(self._cloud.instances) @cached_property - def k8s(self) -> K8sResourceWithRawResponse: - return K8sResourceWithRawResponse(self._cloud.k8s) + def k8s(self) -> K8SResourceWithRawResponse: + return K8SResourceWithRawResponse(self._cloud.k8s) @cached_property def audit_logs(self) -> AuditLogsResourceWithRawResponse: @@ -740,8 +740,8 @@ def instances(self) -> AsyncInstancesResourceWithRawResponse: return AsyncInstancesResourceWithRawResponse(self._cloud.instances) @cached_property - def k8s(self) -> AsyncK8sResourceWithRawResponse: - return AsyncK8sResourceWithRawResponse(self._cloud.k8s) + def k8s(self) -> AsyncK8SResourceWithRawResponse: + return AsyncK8SResourceWithRawResponse(self._cloud.k8s) @cached_property def audit_logs(self) -> AsyncAuditLogsResourceWithRawResponse: @@ -864,8 +864,8 @@ def instances(self) -> InstancesResourceWithStreamingResponse: return InstancesResourceWithStreamingResponse(self._cloud.instances) @cached_property - def k8s(self) -> K8sResourceWithStreamingResponse: - return K8sResourceWithStreamingResponse(self._cloud.k8s) + def k8s(self) -> K8SResourceWithStreamingResponse: + return K8SResourceWithStreamingResponse(self._cloud.k8s) @cached_property def audit_logs(self) -> AuditLogsResourceWithStreamingResponse: @@ -988,8 +988,8 @@ def instances(self) -> AsyncInstancesResourceWithStreamingResponse: return AsyncInstancesResourceWithStreamingResponse(self._cloud.instances) @cached_property - def k8s(self) -> AsyncK8sResourceWithStreamingResponse: - return AsyncK8sResourceWithStreamingResponse(self._cloud.k8s) + def k8s(self) -> AsyncK8SResourceWithStreamingResponse: + return AsyncK8SResourceWithStreamingResponse(self._cloud.k8s) @cached_property def audit_logs(self) -> AsyncAuditLogsResourceWithStreamingResponse: diff --git a/src/gcore/resources/cloud/k8s/__init__.py b/src/gcore/resources/cloud/k8s/__init__.py index 6b5f189d..26af76b8 100644 --- a/src/gcore/resources/cloud/k8s/__init__.py +++ b/src/gcore/resources/cloud/k8s/__init__.py @@ -1,12 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .k8s import ( - K8sResource, - AsyncK8sResource, - K8sResourceWithRawResponse, - AsyncK8sResourceWithRawResponse, - K8sResourceWithStreamingResponse, - AsyncK8sResourceWithStreamingResponse, + K8SResource, + AsyncK8SResource, + K8SResourceWithRawResponse, + AsyncK8SResourceWithRawResponse, + K8SResourceWithStreamingResponse, + AsyncK8SResourceWithStreamingResponse, ) from .flavors import ( FlavorsResource, @@ -38,10 +38,10 @@ "AsyncClustersResourceWithRawResponse", "ClustersResourceWithStreamingResponse", "AsyncClustersResourceWithStreamingResponse", - "K8sResource", - "AsyncK8sResource", - "K8sResourceWithRawResponse", - "AsyncK8sResourceWithRawResponse", - "K8sResourceWithStreamingResponse", - "AsyncK8sResourceWithStreamingResponse", + "K8SResource", + "AsyncK8SResource", + "K8SResourceWithRawResponse", + "AsyncK8SResourceWithRawResponse", + "K8SResourceWithStreamingResponse", + "AsyncK8SResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index cda6a936..52ab2f78 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -40,11 +40,11 @@ cluster_upgrade_params, ) from .....types.cloud.task_id_list import TaskIDList -from .....types.cloud.k8s.k8s_cluster import K8sCluster -from .....types.cloud.k8s.k8s_cluster_list import K8sClusterList -from .....types.cloud.k8s_cluster_version_list import K8sClusterVersionList -from .....types.cloud.k8s.k8s_cluster_kubeconfig import K8sClusterKubeconfig -from .....types.cloud.k8s.k8s_cluster_certificate import K8sClusterCertificate +from .....types.cloud.k8s.k8s_cluster import K8SCluster +from .....types.cloud.k8s.k8s_cluster_list import K8SClusterList +from .....types.cloud.k8s_cluster_version_list import K8SClusterVersionList +from .....types.cloud.k8s.k8s_cluster_kubeconfig import K8SClusterKubeconfig +from .....types.cloud.k8s.k8s_cluster_certificate import K8SClusterCertificate __all__ = ["ClustersResource", "AsyncClustersResource"] @@ -381,7 +381,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterList: + ) -> K8SClusterList: """ List k8s clusters @@ -403,7 +403,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterList, + cast_to=K8SClusterList, ) def delete( @@ -464,7 +464,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sCluster: + ) -> K8SCluster: """ Get k8s cluster @@ -488,7 +488,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sCluster, + cast_to=K8SCluster, ) def get_certificate( @@ -503,7 +503,7 @@ def get_certificate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterCertificate: + ) -> K8SClusterCertificate: """ Get k8s cluster CA certificate @@ -527,7 +527,7 @@ def get_certificate( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterCertificate, + cast_to=K8SClusterCertificate, ) def get_kubeconfig( @@ -542,7 +542,7 @@ def get_kubeconfig( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterKubeconfig: + ) -> K8SClusterKubeconfig: """ Get k8s cluster kubeconfig @@ -566,7 +566,7 @@ def get_kubeconfig( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterKubeconfig, + cast_to=K8SClusterKubeconfig, ) def list_versions_for_upgrade( @@ -581,7 +581,7 @@ def list_versions_for_upgrade( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterVersionList: + ) -> K8SClusterVersionList: """ List available k8s cluster versions for upgrade @@ -605,7 +605,7 @@ def list_versions_for_upgrade( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterVersionList, + cast_to=K8SClusterVersionList, ) def upgrade( @@ -984,7 +984,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterList: + ) -> K8SClusterList: """ List k8s clusters @@ -1006,7 +1006,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterList, + cast_to=K8SClusterList, ) async def delete( @@ -1067,7 +1067,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sCluster: + ) -> K8SCluster: """ Get k8s cluster @@ -1091,7 +1091,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sCluster, + cast_to=K8SCluster, ) async def get_certificate( @@ -1106,7 +1106,7 @@ async def get_certificate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterCertificate: + ) -> K8SClusterCertificate: """ Get k8s cluster CA certificate @@ -1130,7 +1130,7 @@ async def get_certificate( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterCertificate, + cast_to=K8SClusterCertificate, ) async def get_kubeconfig( @@ -1145,7 +1145,7 @@ async def get_kubeconfig( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterKubeconfig: + ) -> K8SClusterKubeconfig: """ Get k8s cluster kubeconfig @@ -1169,7 +1169,7 @@ async def get_kubeconfig( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterKubeconfig, + cast_to=K8SClusterKubeconfig, ) async def list_versions_for_upgrade( @@ -1184,7 +1184,7 @@ async def list_versions_for_upgrade( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterVersionList: + ) -> K8SClusterVersionList: """ List available k8s cluster versions for upgrade @@ -1208,7 +1208,7 @@ async def list_versions_for_upgrade( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterVersionList, + cast_to=K8SClusterVersionList, ) async def upgrade( diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 72cb9321..6cc9863a 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -28,8 +28,8 @@ from ......_base_client import make_request_options from ......types.cloud.k8s.clusters import pool_create_params, pool_resize_params, pool_update_params from ......types.cloud.task_id_list import TaskIDList -from ......types.cloud.k8s.clusters.k8s_cluster_pool import K8sClusterPool -from ......types.cloud.k8s.clusters.k8s_cluster_pool_list import K8sClusterPoolList +from ......types.cloud.k8s.clusters.k8s_cluster_pool import K8SClusterPool +from ......types.cloud.k8s.clusters.k8s_cluster_pool_list import K8SClusterPoolList __all__ = ["PoolsResource", "AsyncPoolsResource"] @@ -174,7 +174,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterPool: + ) -> K8SClusterPool: """ Update k8s cluster pool @@ -223,7 +223,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterPool, + cast_to=K8SClusterPool, ) def list( @@ -238,7 +238,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterPoolList: + ) -> K8SClusterPoolList: """ List k8s cluster pools @@ -262,7 +262,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterPoolList, + cast_to=K8SClusterPoolList, ) def delete( @@ -320,7 +320,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterPool: + ) -> K8SClusterPool: """ Get k8s cluster pool @@ -346,7 +346,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterPool, + cast_to=K8SClusterPool, ) def resize( @@ -536,7 +536,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterPool: + ) -> K8SClusterPool: """ Update k8s cluster pool @@ -585,7 +585,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterPool, + cast_to=K8SClusterPool, ) async def list( @@ -600,7 +600,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterPoolList: + ) -> K8SClusterPoolList: """ List k8s cluster pools @@ -624,7 +624,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterPoolList, + cast_to=K8SClusterPoolList, ) async def delete( @@ -682,7 +682,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterPool: + ) -> K8SClusterPool: """ Get k8s cluster pool @@ -708,7 +708,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterPool, + cast_to=K8SClusterPool, ) async def resize( diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index f3ac5aff..e1dabed0 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -30,12 +30,12 @@ ClustersResourceWithStreamingResponse, AsyncClustersResourceWithStreamingResponse, ) -from ....types.cloud.k8s_cluster_version_list import K8sClusterVersionList +from ....types.cloud.k8s_cluster_version_list import K8SClusterVersionList -__all__ = ["K8sResource", "AsyncK8sResource"] +__all__ = ["K8SResource", "AsyncK8SResource"] -class K8sResource(SyncAPIResource): +class K8SResource(SyncAPIResource): @cached_property def flavors(self) -> FlavorsResource: return FlavorsResource(self._client) @@ -45,23 +45,23 @@ def clusters(self) -> ClustersResource: return ClustersResource(self._client) @cached_property - def with_raw_response(self) -> K8sResourceWithRawResponse: + def with_raw_response(self) -> K8SResourceWithRawResponse: """ 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 K8sResourceWithRawResponse(self) + return K8SResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> K8sResourceWithStreamingResponse: + def with_streaming_response(self) -> K8SResourceWithStreamingResponse: """ 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 K8sResourceWithStreamingResponse(self) + return K8SResourceWithStreamingResponse(self) def list_versions( self, @@ -74,7 +74,7 @@ def list_versions( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterVersionList: + ) -> K8SClusterVersionList: """ List available k8s cluster versions for creation @@ -96,11 +96,11 @@ def list_versions( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterVersionList, + cast_to=K8SClusterVersionList, ) -class AsyncK8sResource(AsyncAPIResource): +class AsyncK8SResource(AsyncAPIResource): @cached_property def flavors(self) -> AsyncFlavorsResource: return AsyncFlavorsResource(self._client) @@ -110,23 +110,23 @@ def clusters(self) -> AsyncClustersResource: return AsyncClustersResource(self._client) @cached_property - def with_raw_response(self) -> AsyncK8sResourceWithRawResponse: + def with_raw_response(self) -> AsyncK8SResourceWithRawResponse: """ 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 AsyncK8sResourceWithRawResponse(self) + return AsyncK8SResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncK8sResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncK8SResourceWithStreamingResponse: """ 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 AsyncK8sResourceWithStreamingResponse(self) + return AsyncK8SResourceWithStreamingResponse(self) async def list_versions( self, @@ -139,7 +139,7 @@ async def list_versions( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8sClusterVersionList: + ) -> K8SClusterVersionList: """ List available k8s cluster versions for creation @@ -161,12 +161,12 @@ async def list_versions( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8sClusterVersionList, + cast_to=K8SClusterVersionList, ) -class K8sResourceWithRawResponse: - def __init__(self, k8s: K8sResource) -> None: +class K8SResourceWithRawResponse: + def __init__(self, k8s: K8SResource) -> None: self._k8s = k8s self.list_versions = to_raw_response_wrapper( @@ -182,8 +182,8 @@ def clusters(self) -> ClustersResourceWithRawResponse: return ClustersResourceWithRawResponse(self._k8s.clusters) -class AsyncK8sResourceWithRawResponse: - def __init__(self, k8s: AsyncK8sResource) -> None: +class AsyncK8SResourceWithRawResponse: + def __init__(self, k8s: AsyncK8SResource) -> None: self._k8s = k8s self.list_versions = async_to_raw_response_wrapper( @@ -199,8 +199,8 @@ def clusters(self) -> AsyncClustersResourceWithRawResponse: return AsyncClustersResourceWithRawResponse(self._k8s.clusters) -class K8sResourceWithStreamingResponse: - def __init__(self, k8s: K8sResource) -> None: +class K8SResourceWithStreamingResponse: + def __init__(self, k8s: K8SResource) -> None: self._k8s = k8s self.list_versions = to_streamed_response_wrapper( @@ -216,8 +216,8 @@ def clusters(self) -> ClustersResourceWithStreamingResponse: return ClustersResourceWithStreamingResponse(self._k8s.clusters) -class AsyncK8sResourceWithStreamingResponse: - def __init__(self, k8s: AsyncK8sResource) -> None: +class AsyncK8SResourceWithStreamingResponse: + def __init__(self, k8s: AsyncK8SResource) -> None: self._k8s = k8s self.list_versions = async_to_streamed_response_wrapper( diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index e97ac01a..73915dd5 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -66,7 +66,7 @@ from .fixed_address_short import FixedAddressShort as FixedAddressShort from .gpu_virtual_cluster import GPUVirtualCluster as GPUVirtualCluster from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily -from .k8s_cluster_version import K8sClusterVersion as K8sClusterVersion +from .k8s_cluster_version import K8SClusterVersion as K8SClusterVersion from .network_list_params import NetworkListParams as NetworkListParams from .project_list_params import ProjectListParams as ProjectListParams from .provisioning_status import ProvisioningStatus as ProvisioningStatus @@ -119,7 +119,7 @@ from .file_share_create_params import FileShareCreateParams as FileShareCreateParams from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams from .file_share_update_params import FileShareUpdateParams as FileShareUpdateParams -from .k8s_cluster_version_list import K8sClusterVersionList as K8sClusterVersionList +from .k8s_cluster_version_list import K8SClusterVersionList as K8SClusterVersionList from .load_balancer_get_params import LoadBalancerGetParams as LoadBalancerGetParams from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams diff --git a/src/gcore/types/cloud/k8s/__init__.py b/src/gcore/types/cloud/k8s/__init__.py index 2ce45d68..0eed39f3 100644 --- a/src/gcore/types/cloud/k8s/__init__.py +++ b/src/gcore/types/cloud/k8s/__init__.py @@ -2,12 +2,12 @@ from __future__ import annotations -from .k8s_cluster import K8sCluster as K8sCluster -from .k8s_cluster_list import K8sClusterList as K8sClusterList +from .k8s_cluster import K8SCluster as K8SCluster +from .k8s_cluster_list import K8SClusterList as K8SClusterList from .flavor_list_params import FlavorListParams as FlavorListParams from .cluster_create_params import ClusterCreateParams as ClusterCreateParams from .cluster_delete_params import ClusterDeleteParams as ClusterDeleteParams from .cluster_update_params import ClusterUpdateParams as ClusterUpdateParams from .cluster_upgrade_params import ClusterUpgradeParams as ClusterUpgradeParams -from .k8s_cluster_kubeconfig import K8sClusterKubeconfig as K8sClusterKubeconfig -from .k8s_cluster_certificate import K8sClusterCertificate as K8sClusterCertificate +from .k8s_cluster_kubeconfig import K8SClusterKubeconfig as K8SClusterKubeconfig +from .k8s_cluster_certificate import K8SClusterCertificate as K8SClusterCertificate diff --git a/src/gcore/types/cloud/k8s/cluster_update_params.py b/src/gcore/types/cloud/k8s/cluster_update_params.py index 46e02a9d..d6b1dd55 100644 --- a/src/gcore/types/cloud/k8s/cluster_update_params.py +++ b/src/gcore/types/cloud/k8s/cluster_update_params.py @@ -12,8 +12,8 @@ "ClusterUpdateParams", "AddOns", "AddOnsSlurm", - "AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer", - "AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer", + "AddOnsSlurmK8SClusterSlurmAddonEnableV2Serializer", + "AddOnsSlurmK8SClusterSlurmAddonDisableV2Serializer", "Authentication", "AuthenticationOidc", "Cni", @@ -105,7 +105,7 @@ class ClusterUpdateParams(TypedDict, total=False): """Logging configuration""" -class AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer(TypedDict, total=False): +class AddOnsSlurmK8SClusterSlurmAddonEnableV2Serializer(TypedDict, total=False): enabled: Required[Literal[True]] """The Slurm add-on will be enabled in the cluster. @@ -134,13 +134,13 @@ class AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer(TypedDict, total=False): """ -class AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer(TypedDict, total=False): +class AddOnsSlurmK8SClusterSlurmAddonDisableV2Serializer(TypedDict, total=False): enabled: Required[Literal[False]] """The Slurm add-on will be disabled in the cluster.""" AddOnsSlurm: TypeAlias = Union[ - AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer, AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer + AddOnsSlurmK8SClusterSlurmAddonEnableV2Serializer, AddOnsSlurmK8SClusterSlurmAddonDisableV2Serializer ] diff --git a/src/gcore/types/cloud/k8s/clusters/__init__.py b/src/gcore/types/cloud/k8s/clusters/__init__.py index 0ffb0b08..e145306b 100644 --- a/src/gcore/types/cloud/k8s/clusters/__init__.py +++ b/src/gcore/types/cloud/k8s/clusters/__init__.py @@ -2,9 +2,9 @@ from __future__ import annotations -from .k8s_cluster_pool import K8sClusterPool as K8sClusterPool +from .k8s_cluster_pool import K8SClusterPool as K8SClusterPool from .node_list_params import NodeListParams as NodeListParams from .pool_create_params import PoolCreateParams as PoolCreateParams from .pool_resize_params import PoolResizeParams as PoolResizeParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams -from .k8s_cluster_pool_list import K8sClusterPoolList as K8sClusterPoolList +from .k8s_cluster_pool_list import K8SClusterPoolList as K8SClusterPoolList diff --git a/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool.py b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool.py index d8aa59e6..415b314c 100644 --- a/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool.py +++ b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool.py @@ -4,10 +4,10 @@ from ....._models import BaseModel -__all__ = ["K8sClusterPool"] +__all__ = ["K8SClusterPool"] -class K8sClusterPool(BaseModel): +class K8SClusterPool(BaseModel): id: str """UUID of the cluster pool""" diff --git a/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py index 9ec5299d..23f3943a 100644 --- a/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py +++ b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py @@ -3,14 +3,14 @@ from typing import List from ....._models import BaseModel -from .k8s_cluster_pool import K8sClusterPool +from .k8s_cluster_pool import K8SClusterPool -__all__ = ["K8sClusterPoolList"] +__all__ = ["K8SClusterPoolList"] -class K8sClusterPoolList(BaseModel): +class K8SClusterPoolList(BaseModel): count: int """Number of objects""" - results: List[K8sClusterPool] + results: List[K8SClusterPool] """Objects""" diff --git a/src/gcore/types/cloud/k8s/k8s_cluster.py b/src/gcore/types/cloud/k8s/k8s_cluster.py index a93825fd..8d4e6c21 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster.py @@ -6,10 +6,10 @@ from ..logging import Logging from ...._models import BaseModel -from .clusters.k8s_cluster_pool import K8sClusterPool +from .clusters.k8s_cluster_pool import K8SClusterPool __all__ = [ - "K8sCluster", + "K8SCluster", "AddOns", "AddOnsSlurm", "Csi", @@ -164,7 +164,7 @@ class DDOSProfile(BaseModel): """DDoS profile template name""" -class K8sCluster(BaseModel): +class K8SCluster(BaseModel): id: str """Cluster pool uuid""" @@ -189,7 +189,7 @@ class K8sCluster(BaseModel): name: str """Name""" - pools: List[K8sClusterPool] + pools: List[K8SClusterPool] """pools""" status: Literal["Deleting", "Provisioned", "Provisioning"] diff --git a/src/gcore/types/cloud/k8s/k8s_cluster_certificate.py b/src/gcore/types/cloud/k8s/k8s_cluster_certificate.py index c7965b6c..03e30bf1 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster_certificate.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster_certificate.py @@ -2,10 +2,10 @@ from ...._models import BaseModel -__all__ = ["K8sClusterCertificate"] +__all__ = ["K8SClusterCertificate"] -class K8sClusterCertificate(BaseModel): +class K8SClusterCertificate(BaseModel): certificate: str """Cluster CA certificate""" diff --git a/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py b/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py index c7f7426e..717dddc5 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py @@ -5,10 +5,10 @@ from ...._models import BaseModel -__all__ = ["K8sClusterKubeconfig"] +__all__ = ["K8SClusterKubeconfig"] -class K8sClusterKubeconfig(BaseModel): +class K8SClusterKubeconfig(BaseModel): client_certificate: str """String in base64 format. Cluster client certificate""" diff --git a/src/gcore/types/cloud/k8s/k8s_cluster_list.py b/src/gcore/types/cloud/k8s/k8s_cluster_list.py index b3ed3df7..bc252f6b 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster_list.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster_list.py @@ -3,14 +3,14 @@ from typing import List from ...._models import BaseModel -from .k8s_cluster import K8sCluster +from .k8s_cluster import K8SCluster -__all__ = ["K8sClusterList"] +__all__ = ["K8SClusterList"] -class K8sClusterList(BaseModel): +class K8SClusterList(BaseModel): count: int """Number of objects""" - results: List[K8sCluster] + results: List[K8SCluster] """Objects""" diff --git a/src/gcore/types/cloud/k8s_cluster_version.py b/src/gcore/types/cloud/k8s_cluster_version.py index 6f8c1ddf..257cf728 100644 --- a/src/gcore/types/cloud/k8s_cluster_version.py +++ b/src/gcore/types/cloud/k8s_cluster_version.py @@ -2,9 +2,9 @@ from ..._models import BaseModel -__all__ = ["K8sClusterVersion"] +__all__ = ["K8SClusterVersion"] -class K8sClusterVersion(BaseModel): +class K8SClusterVersion(BaseModel): version: str """List of supported Kubernetes cluster versions""" diff --git a/src/gcore/types/cloud/k8s_cluster_version_list.py b/src/gcore/types/cloud/k8s_cluster_version_list.py index 27a17073..2f66ffb7 100644 --- a/src/gcore/types/cloud/k8s_cluster_version_list.py +++ b/src/gcore/types/cloud/k8s_cluster_version_list.py @@ -3,14 +3,14 @@ from typing import List from ..._models import BaseModel -from .k8s_cluster_version import K8sClusterVersion +from .k8s_cluster_version import K8SClusterVersion -__all__ = ["K8sClusterVersionList"] +__all__ = ["K8SClusterVersionList"] -class K8sClusterVersionList(BaseModel): +class K8SClusterVersionList(BaseModel): count: int """Number of objects""" - results: List[K8sClusterVersion] + results: List[K8SClusterVersion] """Objects""" diff --git a/tests/api_resources/cloud/k8s/clusters/test_pools.py b/tests/api_resources/cloud/k8s/clusters/test_pools.py index e8e7e5b8..214fa14e 100644 --- a/tests/api_resources/cloud/k8s/clusters/test_pools.py +++ b/tests/api_resources/cloud/k8s/clusters/test_pools.py @@ -11,8 +11,8 @@ from tests.utils import assert_matches_type from gcore.types.cloud import TaskIDList from gcore.types.cloud.k8s.clusters import ( - K8sClusterPool, - K8sClusterPoolList, + K8SClusterPool, + K8SClusterPoolList, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -109,7 +109,7 @@ def test_method_update(self, client: Gcore) -> None: region_id=0, cluster_name="cluster_name", ) - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: @@ -125,7 +125,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: node_count=2, taints={"my-taint": "bar:NoSchedule"}, ) - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: @@ -139,7 +139,7 @@ def test_raw_response_update(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: @@ -153,7 +153,7 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -182,7 +182,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8sClusterPoolList, pool, path=["response"]) + assert_matches_type(K8SClusterPoolList, pool, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -195,7 +195,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(K8sClusterPoolList, pool, path=["response"]) + assert_matches_type(K8SClusterPoolList, pool, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -208,7 +208,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(K8sClusterPoolList, pool, path=["response"]) + assert_matches_type(K8SClusterPoolList, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -287,7 +287,7 @@ def test_method_get(self, client: Gcore) -> None: region_id=0, cluster_name="cluster_name", ) - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -301,7 +301,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -315,7 +315,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -494,7 +494,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: region_id=0, cluster_name="cluster_name", ) - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: @@ -510,7 +510,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> node_count=2, taints={"my-taint": "bar:NoSchedule"}, ) - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @@ -524,7 +524,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: @@ -538,7 +538,7 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -567,7 +567,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8sClusterPoolList, pool, path=["response"]) + assert_matches_type(K8SClusterPoolList, pool, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -580,7 +580,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(K8sClusterPoolList, pool, path=["response"]) + assert_matches_type(K8SClusterPoolList, pool, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -593,7 +593,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(K8sClusterPoolList, pool, path=["response"]) + assert_matches_type(K8SClusterPoolList, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -672,7 +672,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: region_id=0, cluster_name="cluster_name", ) - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -686,7 +686,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -700,7 +700,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(K8sClusterPool, pool, path=["response"]) + assert_matches_type(K8SClusterPool, pool, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/k8s/test_clusters.py b/tests/api_resources/cloud/k8s/test_clusters.py index 800f7316..d9296b23 100644 --- a/tests/api_resources/cloud/k8s/test_clusters.py +++ b/tests/api_resources/cloud/k8s/test_clusters.py @@ -9,12 +9,12 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, K8sClusterVersionList +from gcore.types.cloud import TaskIDList, K8SClusterVersionList from gcore.types.cloud.k8s import ( - K8sCluster, - K8sClusterList, - K8sClusterKubeconfig, - K8sClusterCertificate, + K8SCluster, + K8SClusterList, + K8SClusterKubeconfig, + K8SClusterCertificate, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -290,7 +290,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8sClusterList, cluster, path=["response"]) + assert_matches_type(K8SClusterList, cluster, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -302,7 +302,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8sClusterList, cluster, path=["response"]) + assert_matches_type(K8SClusterList, cluster, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -314,7 +314,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8sClusterList, cluster, path=["response"]) + assert_matches_type(K8SClusterList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -381,7 +381,7 @@ def test_method_get(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8sCluster, cluster, path=["response"]) + assert_matches_type(K8SCluster, cluster, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -394,7 +394,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8sCluster, cluster, path=["response"]) + assert_matches_type(K8SCluster, cluster, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -407,7 +407,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8sCluster, cluster, path=["response"]) + assert_matches_type(K8SCluster, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -427,7 +427,7 @@ def test_method_get_certificate(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8sClusterCertificate, cluster, path=["response"]) + assert_matches_type(K8SClusterCertificate, cluster, path=["response"]) @parametrize def test_raw_response_get_certificate(self, client: Gcore) -> None: @@ -440,7 +440,7 @@ def test_raw_response_get_certificate(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8sClusterCertificate, cluster, path=["response"]) + assert_matches_type(K8SClusterCertificate, cluster, path=["response"]) @parametrize def test_streaming_response_get_certificate(self, client: Gcore) -> None: @@ -453,7 +453,7 @@ def test_streaming_response_get_certificate(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8sClusterCertificate, cluster, path=["response"]) + assert_matches_type(K8SClusterCertificate, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -473,7 +473,7 @@ def test_method_get_kubeconfig(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8sClusterKubeconfig, cluster, path=["response"]) + assert_matches_type(K8SClusterKubeconfig, cluster, path=["response"]) @parametrize def test_raw_response_get_kubeconfig(self, client: Gcore) -> None: @@ -486,7 +486,7 @@ def test_raw_response_get_kubeconfig(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8sClusterKubeconfig, cluster, path=["response"]) + assert_matches_type(K8SClusterKubeconfig, cluster, path=["response"]) @parametrize def test_streaming_response_get_kubeconfig(self, client: Gcore) -> None: @@ -499,7 +499,7 @@ def test_streaming_response_get_kubeconfig(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8sClusterKubeconfig, cluster, path=["response"]) + assert_matches_type(K8SClusterKubeconfig, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -519,7 +519,7 @@ def test_method_list_versions_for_upgrade(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8sClusterVersionList, cluster, path=["response"]) + assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) @parametrize def test_raw_response_list_versions_for_upgrade(self, client: Gcore) -> None: @@ -532,7 +532,7 @@ def test_raw_response_list_versions_for_upgrade(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8sClusterVersionList, cluster, path=["response"]) + assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) @parametrize def test_streaming_response_list_versions_for_upgrade(self, client: Gcore) -> None: @@ -545,7 +545,7 @@ def test_streaming_response_list_versions_for_upgrade(self, client: Gcore) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8sClusterVersionList, cluster, path=["response"]) + assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -881,7 +881,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8sClusterList, cluster, path=["response"]) + assert_matches_type(K8SClusterList, cluster, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -893,7 +893,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8sClusterList, cluster, path=["response"]) + assert_matches_type(K8SClusterList, cluster, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -905,7 +905,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8sClusterList, cluster, path=["response"]) + assert_matches_type(K8SClusterList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -972,7 +972,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8sCluster, cluster, path=["response"]) + assert_matches_type(K8SCluster, cluster, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -985,7 +985,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8sCluster, cluster, path=["response"]) + assert_matches_type(K8SCluster, cluster, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -998,7 +998,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8sCluster, cluster, path=["response"]) + assert_matches_type(K8SCluster, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1018,7 +1018,7 @@ async def test_method_get_certificate(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8sClusterCertificate, cluster, path=["response"]) + assert_matches_type(K8SClusterCertificate, cluster, path=["response"]) @parametrize async def test_raw_response_get_certificate(self, async_client: AsyncGcore) -> None: @@ -1031,7 +1031,7 @@ async def test_raw_response_get_certificate(self, async_client: AsyncGcore) -> N assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8sClusterCertificate, cluster, path=["response"]) + assert_matches_type(K8SClusterCertificate, cluster, path=["response"]) @parametrize async def test_streaming_response_get_certificate(self, async_client: AsyncGcore) -> None: @@ -1044,7 +1044,7 @@ async def test_streaming_response_get_certificate(self, async_client: AsyncGcore assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8sClusterCertificate, cluster, path=["response"]) + assert_matches_type(K8SClusterCertificate, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1064,7 +1064,7 @@ async def test_method_get_kubeconfig(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8sClusterKubeconfig, cluster, path=["response"]) + assert_matches_type(K8SClusterKubeconfig, cluster, path=["response"]) @parametrize async def test_raw_response_get_kubeconfig(self, async_client: AsyncGcore) -> None: @@ -1077,7 +1077,7 @@ async def test_raw_response_get_kubeconfig(self, async_client: AsyncGcore) -> No assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8sClusterKubeconfig, cluster, path=["response"]) + assert_matches_type(K8SClusterKubeconfig, cluster, path=["response"]) @parametrize async def test_streaming_response_get_kubeconfig(self, async_client: AsyncGcore) -> None: @@ -1090,7 +1090,7 @@ async def test_streaming_response_get_kubeconfig(self, async_client: AsyncGcore) assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8sClusterKubeconfig, cluster, path=["response"]) + assert_matches_type(K8SClusterKubeconfig, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1110,7 +1110,7 @@ async def test_method_list_versions_for_upgrade(self, async_client: AsyncGcore) project_id=0, region_id=0, ) - assert_matches_type(K8sClusterVersionList, cluster, path=["response"]) + assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) @parametrize async def test_raw_response_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: @@ -1123,7 +1123,7 @@ async def test_raw_response_list_versions_for_upgrade(self, async_client: AsyncG assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8sClusterVersionList, cluster, path=["response"]) + assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) @parametrize async def test_streaming_response_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: @@ -1136,7 +1136,7 @@ async def test_streaming_response_list_versions_for_upgrade(self, async_client: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8sClusterVersionList, cluster, path=["response"]) + assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_k8s.py b/tests/api_resources/cloud/test_k8s.py index 6bd73971..98602a71 100644 --- a/tests/api_resources/cloud/test_k8s.py +++ b/tests/api_resources/cloud/test_k8s.py @@ -9,21 +9,21 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import K8sClusterVersionList +from gcore.types.cloud import K8SClusterVersionList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestK8s: +class TestK8S: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list_versions(self, client: Gcore) -> None: - k8 = client.cloud.k8s.list_versions( + k8s = client.cloud.k8s.list_versions( project_id=0, region_id=0, ) - assert_matches_type(K8sClusterVersionList, k8, path=["response"]) + assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) @parametrize def test_raw_response_list_versions(self, client: Gcore) -> None: @@ -34,8 +34,8 @@ def test_raw_response_list_versions(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - k8 = response.parse() - assert_matches_type(K8sClusterVersionList, k8, path=["response"]) + k8s = response.parse() + assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) @parametrize def test_streaming_response_list_versions(self, client: Gcore) -> None: @@ -46,24 +46,24 @@ def test_streaming_response_list_versions(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - k8 = response.parse() - assert_matches_type(K8sClusterVersionList, k8, path=["response"]) + k8s = response.parse() + assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncK8s: +class TestAsyncK8S: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @parametrize async def test_method_list_versions(self, async_client: AsyncGcore) -> None: - k8 = await async_client.cloud.k8s.list_versions( + k8s = await async_client.cloud.k8s.list_versions( project_id=0, region_id=0, ) - assert_matches_type(K8sClusterVersionList, k8, path=["response"]) + assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) @parametrize async def test_raw_response_list_versions(self, async_client: AsyncGcore) -> None: @@ -74,8 +74,8 @@ async def test_raw_response_list_versions(self, async_client: AsyncGcore) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - k8 = await response.parse() - assert_matches_type(K8sClusterVersionList, k8, path=["response"]) + k8s = await response.parse() + assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) @parametrize async def test_streaming_response_list_versions(self, async_client: AsyncGcore) -> None: @@ -86,7 +86,7 @@ async def test_streaming_response_list_versions(self, async_client: AsyncGcore) assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - k8 = await response.parse() - assert_matches_type(K8sClusterVersionList, k8, path=["response"]) + k8s = await response.parse() + assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) assert cast(Any, response.is_closed) is True From 201e75951f7d3a795352237e825720c34a38a7c9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 25 Nov 2025 19:02:13 +0000 Subject: [PATCH 445/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 86b0e83d..cb9d2541 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.21.0" + ".": "0.22.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 47cc9210..c63d7fd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.21.0" +version = "0.22.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 13d7c069..58fc4d82 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.21.0" # x-release-please-version +__version__ = "0.22.0" # x-release-please-version From 1c4c44f01889575aa2891149a16933c9a9d47da3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Nov 2025 10:11:31 +0000 Subject: [PATCH 446/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cloud/billing_reservations.py | 4 +- .../cloud/security_groups/security_groups.py | 32 ++++++--- src/gcore/types/cloud/baremetal_flavor.py | 6 -- .../cloud/billing_reservation_list_params.py | 2 +- .../cloud/security_group_create_params.py | 2 + .../types/cloud/security_group_list_params.py | 10 +-- .../cloud/test_security_groups.py | 72 +++++++++---------- 8 files changed, 73 insertions(+), 59 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0da4a381..73ff0a89 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-61246c736228a6c005ecc784c08b6339b9afff6b3ea7225ef6bad7112e158355.yml -openapi_spec_hash: 2dfeaccd1623885572ec0f968f8f50c0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b310f95695f4f4cf339560f4ac879067c0dacbbc695a6b81e14756423f59ab39.yml +openapi_spec_hash: c2f2c83e6c3cd42fe8e8bad9bd60a23c config_hash: ed81680ad8f1babe06844ab73e7148d1 diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index 19127d09..12ea8829 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -62,7 +62,7 @@ def list( configurations and associated pricing. Args: - metric_name: Name from billing features for specific resource + metric_name: Metric name for the resource (e.g., 'bm1-hf-`medium_min`') order_by: Order by field and direction. @@ -138,7 +138,7 @@ async def list( configurations and associated pricing. Args: - metric_name: Name from billing features for specific resource + metric_name: Metric name for the resource (e.g., 'bm1-hf-`medium_min`') order_by: Order by field and direction. diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 5a9cc544..498e06b7 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -80,6 +80,10 @@ def create( Create a new security group with the specified configuration. Args: + project_id: Project ID + + region_id: Region ID + security_group: Security group instances: List of instances @@ -212,13 +216,17 @@ def list( List all security groups in the specified project and region. Args: - limit: Limit the number of returned security groups + project_id: Project ID + + region_id: Region ID + + limit: Limit of items on a single page - offset: Offset value is used to exclude the first set of records from the result + offset: Offset in results list - tag_key: Filter by tag keys. + tag_key: Optional. Filter by tag keys. - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. + tag_key_value: Optional. Filter by tag key-value pairs. Must be a valid JSON string. extra_headers: Send extra headers @@ -457,6 +465,10 @@ async def create( Create a new security group with the specified configuration. Args: + project_id: Project ID + + region_id: Region ID + security_group: Security group instances: List of instances @@ -589,13 +601,17 @@ def list( List all security groups in the specified project and region. Args: - limit: Limit the number of returned security groups + project_id: Project ID + + region_id: Region ID + + limit: Limit of items on a single page - offset: Offset value is used to exclude the first set of records from the result + offset: Offset in results list - tag_key: Filter by tag keys. + tag_key: Optional. Filter by tag keys. - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. + tag_key_value: Optional. Filter by tag key-value pairs. Must be a valid JSON string. extra_headers: Send extra headers diff --git a/src/gcore/types/cloud/baremetal_flavor.py b/src/gcore/types/cloud/baremetal_flavor.py index b5967afb..5bc0b974 100644 --- a/src/gcore/types/cloud/baremetal_flavor.py +++ b/src/gcore/types/cloud/baremetal_flavor.py @@ -50,9 +50,3 @@ class BaremetalFlavor(BaseModel): price_status: Optional[Literal["error", "hide", "show"]] = None """Price status for the UI""" - - reserved_in_stock: Optional[int] = None - """Count of reserved but not used nodes. - - If a client don't have reservations for the flavor, it's None. - """ diff --git a/src/gcore/types/cloud/billing_reservation_list_params.py b/src/gcore/types/cloud/billing_reservation_list_params.py index b0c40c5c..86c5fed6 100644 --- a/src/gcore/types/cloud/billing_reservation_list_params.py +++ b/src/gcore/types/cloud/billing_reservation_list_params.py @@ -9,7 +9,7 @@ class BillingReservationListParams(TypedDict, total=False): metric_name: str - """Name from billing features for specific resource""" + """Metric name for the resource (e.g., 'bm1-hf-`medium_min`')""" order_by: Literal["active_from.asc", "active_from.desc", "active_to.asc", "active_to.desc"] """Order by field and direction.""" diff --git a/src/gcore/types/cloud/security_group_create_params.py b/src/gcore/types/cloud/security_group_create_params.py index 35527106..8847cbb1 100644 --- a/src/gcore/types/cloud/security_group_create_params.py +++ b/src/gcore/types/cloud/security_group_create_params.py @@ -12,8 +12,10 @@ class SecurityGroupCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" security_group: Required[SecurityGroup] """Security group""" diff --git a/src/gcore/types/cloud/security_group_list_params.py b/src/gcore/types/cloud/security_group_list_params.py index 676a5d48..c6bfc34d 100644 --- a/src/gcore/types/cloud/security_group_list_params.py +++ b/src/gcore/types/cloud/security_group_list_params.py @@ -11,17 +11,19 @@ class SecurityGroupListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" limit: int - """Limit the number of returned security groups""" + """Limit of items on a single page""" offset: int - """Offset value is used to exclude the first set of records from the result""" + """Offset in results list""" tag_key: SequenceNotStr[str] - """Filter by tag keys.""" + """Optional. Filter by tag keys.""" tag_key_value: str - """Filter by tag key-value pairs. Must be a valid JSON string.""" + """Optional. Filter by tag key-value pairs. Must be a valid JSON string.""" diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index d1ca3713..69777f00 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -23,8 +23,8 @@ class TestSecurityGroups: @parametrize def test_method_create(self, client: Gcore) -> None: security_group = client.cloud.security_groups.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, security_group={"name": "my_security_group"}, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @@ -32,8 +32,8 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: security_group = client.cloud.security_groups.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, security_group={ "name": "my_security_group", "description": "Some description", @@ -58,8 +58,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.security_groups.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, security_group={"name": "my_security_group"}, ) @@ -71,8 +71,8 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.security_groups.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, security_group={"name": "my_security_group"}, ) as response: assert not response.is_closed @@ -157,19 +157,19 @@ def test_path_params_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: security_group = client.cloud.security_groups.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert_matches_type(SyncOffsetPage[SecurityGroup], security_group, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: security_group = client.cloud.security_groups.list( - project_id=0, - region_id=0, - limit=0, + project_id=1, + region_id=1, + limit=10, offset=0, - tag_key=["string"], + tag_key=["my-tag"], tag_key_value="tag_key_value", ) assert_matches_type(SyncOffsetPage[SecurityGroup], security_group, path=["response"]) @@ -177,8 +177,8 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.security_groups.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -189,8 +189,8 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.security_groups.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -397,8 +397,8 @@ class TestAsyncSecurityGroups: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, security_group={"name": "my_security_group"}, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @@ -406,8 +406,8 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, security_group={ "name": "my_security_group", "description": "Some description", @@ -432,8 +432,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, security_group={"name": "my_security_group"}, ) @@ -445,8 +445,8 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=1, security_group={"name": "my_security_group"}, ) as response: assert not response.is_closed @@ -531,19 +531,19 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert_matches_type(AsyncOffsetPage[SecurityGroup], security_group, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.list( - project_id=0, - region_id=0, - limit=0, + project_id=1, + region_id=1, + limit=10, offset=0, - tag_key=["string"], + tag_key=["my-tag"], tag_key_value="tag_key_value", ) assert_matches_type(AsyncOffsetPage[SecurityGroup], security_group, path=["response"]) @@ -551,8 +551,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -563,8 +563,8 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From 1dc2804c8220991fe22dcf82ccc8eac38afa967f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Nov 2025 08:39:34 +0000 Subject: [PATCH 447/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 73ff0a89..5dd3125c 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-b310f95695f4f4cf339560f4ac879067c0dacbbc695a6b81e14756423f59ab39.yml openapi_spec_hash: c2f2c83e6c3cd42fe8e8bad9bd60a23c -config_hash: ed81680ad8f1babe06844ab73e7148d1 +config_hash: feba924f7316f83b5c218f114ae1b133 From 9c258d6aef8108d54fe18f08eb9d3b1eeedd9b26 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Nov 2025 12:15:27 +0000 Subject: [PATCH 448/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/resources/cloud/baremetal/servers.py | 4 ++-- src/gcore/resources/cloud/instances/instances.py | 4 ++-- src/gcore/types/cloud/audit_log_entry.py | 6 +++--- src/gcore/types/cloud/baremetal/server_create_params.py | 2 +- src/gcore/types/cloud/instance_create_params.py | 2 +- src/gcore/types/cloud/load_balancer_flavor_detail.py | 4 ++-- src/gcore/types/cloud/load_balancer_listener_detail.py | 4 ++-- src/gcore/types/cloud/region.py | 6 +++--- tests/api_resources/cloud/baremetal/test_servers.py | 4 ++-- tests/api_resources/cloud/test_instances.py | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5dd3125c..8d504140 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-b310f95695f4f4cf339560f4ac879067c0dacbbc695a6b81e14756423f59ab39.yml -openapi_spec_hash: c2f2c83e6c3cd42fe8e8bad9bd60a23c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-415b3e1ff98241ebe58f65df0e6ee1381f07ced3d6e9af8bbf9ff8ba25ad655d.yml +openapi_spec_hash: cbcb8f94fedaa853d6fa4763016ce6e0 config_hash: feba924f7316f83b5c218f114ae1b133 diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index e9f8d073..f1dc32ed 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -54,7 +54,7 @@ def create( region_id: int | None = None, flavor: str, interfaces: Iterable[server_create_params.Interface], - app_config: Optional[object] | Omit = omit, + app_config: Optional[Dict[str, object]] | Omit = omit, apptemplate_id: str | Omit = omit, ddos_profile: server_create_params.DDOSProfile | Omit = omit, image_id: str | Omit = omit, @@ -425,7 +425,7 @@ async def create( region_id: int | None = None, flavor: str, interfaces: Iterable[server_create_params.Interface], - app_config: Optional[object] | Omit = omit, + app_config: Optional[Dict[str, object]] | Omit = omit, apptemplate_id: str | Omit = omit, ddos_profile: server_create_params.DDOSProfile | Omit = omit, image_id: str | Omit = omit, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index fe34b4e1..43e07b21 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -118,7 +118,7 @@ def create( interfaces: Iterable[instance_create_params.Interface], volumes: Iterable[instance_create_params.Volume], allow_app_ports: bool | Omit = omit, - configuration: Optional[object] | Omit = omit, + configuration: Optional[Dict[str, object]] | Omit = omit, name: str | Omit = omit, name_template: str | Omit = omit, password: str | Omit = omit, @@ -1177,7 +1177,7 @@ async def create( interfaces: Iterable[instance_create_params.Interface], volumes: Iterable[instance_create_params.Volume], allow_app_ports: bool | Omit = omit, - configuration: Optional[object] | Omit = omit, + configuration: Optional[Dict[str, object]] | Omit = omit, name: str | Omit = omit, name_template: str | Omit = omit, password: str | Omit = omit, diff --git a/src/gcore/types/cloud/audit_log_entry.py b/src/gcore/types/cloud/audit_log_entry.py index 3dd7ea87..56dcac38 100644 --- a/src/gcore/types/cloud/audit_log_entry.py +++ b/src/gcore/types/cloud/audit_log_entry.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import Literal @@ -81,7 +81,7 @@ class Resource(BaseModel): ] """Resource type""" - resource_body: Optional[object] = None + resource_body: Optional[Dict[str, object]] = None """Free-form object, resource body.""" search_field: Optional[str] = None @@ -115,7 +115,7 @@ class AuditLogEntry(BaseModel): User action log was successfully received by its subscriber in case there is one """ - action_data: Optional[object] = None + action_data: Optional[Dict[str, object]] = None """Additional information about the action""" action_type: Literal[ diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index e477245e..79ba71d7 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -44,7 +44,7 @@ class ServerCreateParams(TypedDict, total=False): You can create one or more interfaces - private, public, or both. """ - app_config: Optional[object] + app_config: Optional[Dict[str, object]] """ Parameters for the application template if creating the instance from an `apptemplate`. diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index 0a279d23..93b160be 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -63,7 +63,7 @@ class InstanceCreateParams(TypedDict, total=False): marketplace application template. """ - configuration: Optional[object] + configuration: Optional[Dict[str, object]] """ Parameters for the application template if creating the instance from an `apptemplate`. diff --git a/src/gcore/types/cloud/load_balancer_flavor_detail.py b/src/gcore/types/cloud/load_balancer_flavor_detail.py index 33eb224b..6088eff6 100644 --- a/src/gcore/types/cloud/load_balancer_flavor_detail.py +++ b/src/gcore/types/cloud/load_balancer_flavor_detail.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Dict, Union, Optional from typing_extensions import Literal, TypeAlias from ..._models import BaseModel @@ -8,7 +8,7 @@ __all__ = ["LoadBalancerFlavorDetail", "HardwareDescription"] -HardwareDescription: TypeAlias = Union[FlavorHardwareDescription, object] +HardwareDescription: TypeAlias = Union[FlavorHardwareDescription, Dict[str, object]] class LoadBalancerFlavorDetail(BaseModel): diff --git a/src/gcore/types/cloud/load_balancer_listener_detail.py b/src/gcore/types/cloud/load_balancer_listener_detail.py index e230a736..c04b3d43 100644 --- a/src/gcore/types/cloud/load_balancer_listener_detail.py +++ b/src/gcore/types/cloud/load_balancer_listener_detail.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from ..._models import BaseModel from .provisioning_status import ProvisioningStatus @@ -32,7 +32,7 @@ class LoadBalancerListenerDetail(BaseModel): creator_task_id: Optional[str] = None """Task that created this entity""" - insert_headers: object + insert_headers: Dict[str, object] """Dictionary of additional header insertion into HTTP headers. Only used with HTTP and `TERMINATED_HTTPS` protocols. diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py index 977637ba..d44747af 100644 --- a/src/gcore/types/cloud/region.py +++ b/src/gcore/types/cloud/region.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal @@ -10,9 +10,9 @@ class Coordinates(BaseModel): - latitude: float + latitude: Union[float, str] - longitude: float + longitude: Union[float, str] class Region(BaseModel): diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index 7482ef7b..564217ee 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -44,7 +44,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "port_group": 0, } ], - app_config={}, + app_config={"foo": "bar"}, apptemplate_id="apptemplate_id", ddos_profile={ "profile_template": 123, @@ -248,7 +248,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "port_group": 0, } ], - app_config={}, + app_config={"foo": "bar"}, apptemplate_id="apptemplate_id", ddos_profile={ "profile_template": 123, diff --git a/tests/api_resources/cloud/test_instances.py b/tests/api_resources/cloud/test_instances.py index 3ab8c850..7b908015 100644 --- a/tests/api_resources/cloud/test_instances.py +++ b/tests/api_resources/cloud/test_instances.py @@ -66,7 +66,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: } ], allow_app_ports=True, - configuration={}, + configuration={"foo": "bar"}, name="my-instance", name_template="name_template", password="password", @@ -936,7 +936,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> } ], allow_app_ports=True, - configuration={}, + configuration={"foo": "bar"}, name="my-instance", name_template="name_template", password="password", From 2b60b6d0a624382e592c82a8d20841869b275f6b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Nov 2025 16:49:20 +0000 Subject: [PATCH 449/592] fix: ensure streams are always closed --- src/gcore/_streaming.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/gcore/_streaming.py b/src/gcore/_streaming.py index 16c106ae..82ff9d32 100644 --- a/src/gcore/_streaming.py +++ b/src/gcore/_streaming.py @@ -54,11 +54,12 @@ def __stream__(self) -> Iterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - response.close() + try: + for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + response.close() def __enter__(self) -> Self: return self @@ -117,11 +118,12 @@ async def __stream__(self) -> AsyncIterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - async for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - await response.aclose() + try: + async for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + await response.aclose() async def __aenter__(self) -> Self: return self From 892bd6f130570271744e079d0366a173ca16182c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Nov 2025 18:46:57 +0000 Subject: [PATCH 450/592] chore(deps): mypy 1.18.1 has a regression, pin to 1.17 --- pyproject.toml | 2 +- requirements-dev.lock | 4 +++- requirements.lock | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c63d7fd0..e863900f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ managed = true # version pins are in requirements-dev.lock dev-dependencies = [ "pyright==1.1.399", - "mypy", + "mypy==1.17", "respx", "pytest", "pytest-asyncio", diff --git a/requirements-dev.lock b/requirements-dev.lock index a53580e4..6d6e0b3a 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -75,7 +75,7 @@ mdurl==0.1.2 multidict==6.4.4 # via aiohttp # via yarl -mypy==1.14.1 +mypy==1.17.0 mypy-extensions==1.0.0 # via mypy nodeenv==1.8.0 @@ -84,6 +84,8 @@ nox==2023.4.22 packaging==23.2 # via nox # via pytest +pathspec==0.12.1 + # via mypy platformdirs==3.11.0 # via virtualenv pluggy==1.5.0 diff --git a/requirements.lock b/requirements.lock index bdcade78..5275f060 100644 --- a/requirements.lock +++ b/requirements.lock @@ -55,21 +55,21 @@ multidict==6.4.4 propcache==0.3.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 sniffio==1.3.0 # via anyio # via gcore -typing-extensions==4.12.2 +typing-extensions==4.15.0 # via anyio # via gcore # via multidict # via pydantic # via pydantic-core # via typing-inspection -typing-inspection==0.4.1 +typing-inspection==0.4.2 # via pydantic yarl==1.20.0 # via aiohttp From 81d0756efa384f74a940b31a6da61bbaa10d2a9b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 1 Dec 2025 10:44:04 +0000 Subject: [PATCH 451/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 8d504140..c2b1ebe1 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 -config_hash: feba924f7316f83b5c218f114ae1b133 +config_hash: c71c5fd84e30d315500ae54ec3a83b71 From 0963cea5fc400db6c2cafebb8048f23bd3cf5862 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 1 Dec 2025 13:05:36 +0000 Subject: [PATCH 452/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cb9d2541..7f3f5c84 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.22.0" + ".": "0.23.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index e863900f..bea36aa6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.22.0" +version = "0.23.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 58fc4d82..addbcdc6 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.22.0" # x-release-please-version +__version__ = "0.23.0" # x-release-please-version From af87e5bb421d93feb072f6c141e1e18c14344203 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Dec 2025 11:06:12 +0000 Subject: [PATCH 453/592] chore: update lockfile --- pyproject.toml | 14 +++--- requirements-dev.lock | 110 +++++++++++++++++++++++------------------- requirements.lock | 31 ++++++------ 3 files changed, 84 insertions(+), 71 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bea36aa6..292e7034 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 6d6e0b3a..68cbfa4d 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,82 +66,87 @@ 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 -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 c5ceab5cdc943dfe67b53994f847e607323252ab 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 454/592] 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 fbb3f3cf..e33c80e6 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,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 @@ -90,7 +91,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 895168dd75cb487497e07aff22a1f893affa76e6 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 455/592] 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 3f76d0cd..c8591644 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 @@ -429,7 +429,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 @@ -657,7 +657,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 899c10fff9fc4f01d0c0a5137877a74d5ca2d961 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 456/592] 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 8d1fbbd8f463dfc6a6e46578a4f94eeead0fb254 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 457/592] 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 46e953d85aea014b9890b776e5437a9248f9dc43 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 458/592] 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 0348f4db1dc127a16c96506902be6b62e2fc7890 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 459/592] 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 f6e72794f0508be3d9d34702e57895de64d82bb6 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 460/592] 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 bb89838b70679c887bf2f1fbd21f6100f2a3a3ec 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 461/592] 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 8ff15f286d6fffeeda49c486e04a8aca26d49289 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 462/592] feat(api): aggregated API specs update --- .stats.yml | 6 +- api.md | 1 - .../load_balancers/l7_policies/l7_policies.py | 562 +----------------- 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 +- 10 files changed, 60 insertions(+), 1291 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/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py index fe09dde4..df321dd1 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, - ) - class AsyncL7PoliciesResource(AsyncAPIResource): @cached_property @@ -1134,280 +860,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, - ) - class L7PoliciesResourceWithRawResponse: def __init__(self, l7_policies: L7PoliciesResource) -> None: @@ -1425,9 +877,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, - ) @cached_property def rules(self) -> RulesResourceWithRawResponse: @@ -1450,9 +899,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, - ) @cached_property def rules(self) -> AsyncRulesResourceWithRawResponse: @@ -1475,9 +921,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, - ) @cached_property def rules(self) -> RulesResourceWithStreamingResponse: @@ -1500,9 +943,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, - ) @cached_property def rules(self) -> AsyncRulesResourceWithStreamingResponse: diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 3a27e985..2a21b3d7 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.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 @@ -49,17 +49,17 @@ def with_streaming_response(self) -> TasksResourceWithStreamingResponse: 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, @@ -119,17 +119,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`', @@ -139,7 +139,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`'] @@ -186,8 +186,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, @@ -324,17 +324,17 @@ def with_streaming_response(self) -> AsyncTasksResourceWithStreamingResponse: 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, @@ -394,17 +394,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`', @@ -414,7 +414,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`'] @@ -461,8 +461,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 ff23d5dbc5dcb1c46579b579ad1ef41dcb7fa3e6 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 463/592] 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 640c61a38b97d4f545883871a21b05bcde30e57c 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 464/592] 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 ac7bf0d6eaa6f48006a3523385931de7af35d331 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 465/592] 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 aa8762dc800b662f9df6a7e846a2f25cfec267a8 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 466/592] 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 0a14fea8ca8baa2d0349c5365c627b1c9d9749e6 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 467/592] 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 da8ff97203ed1e6905bf13f887b7ef71f613b98d 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 468/592] 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 4c8c302528b9032c41f97737d1091f8ec5d94edc 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 469/592] 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 9c66718c7d69ce1a15d5e2c3de2e9ac64c55468e 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 470/592] 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 b50c38afc4a0ab80344798d06fc936141581b8a4 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 471/592] 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 df321dd1..a814d66b 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, *, @@ -730,6 +988,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, *, @@ -868,6 +1384,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, ) @@ -890,6 +1409,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, ) @@ -912,6 +1434,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, ) @@ -934,6 +1459,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 5b49e17fefbd2291f61084e513f4071613b9a955 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 472/592] 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 bfec7275d7f32c47ec88ae416cdd1ca9f16b23e4 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 473/592] 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 64a5ddae6350910fcd6f0d5f1d5a5ca9b5ac8b66 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 474/592] 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 9e35629e5eb5aa5b62b9a4ebedf6e12584f092c8 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 475/592] 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 a9851922a85e421ee4b4ef7f75ca30f891bc5c06 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Dec 2025 15:24:45 +0000 Subject: [PATCH 476/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 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/pyproject.toml b/pyproject.toml index 292e7034..bc96f9a3 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 From e334597f3e9e21cb5417ff61546c37fdd2b803cb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Dec 2025 13:48:29 +0000 Subject: [PATCH 477/592] fix(cloud)!: streamline vip connected and candidate ports --- .stats.yml | 2 +- api.md | 40 +- .../reserved_fixed_ips/reserved_fixed_ips.py | 2 +- .../cloud/reserved_fixed_ips/vip/__init__.py | 47 ++ .../reserved_fixed_ips/vip/candidate_ports.py | 175 ++++++++ .../{vip.py => vip/connected_ports.py} | 346 ++++----------- .../cloud/reserved_fixed_ips/vip/vip.py | 249 +++++++++++ .../cloud/reserved_fixed_ips/__init__.py | 6 - .../cloud/reserved_fixed_ips/vip/__init__.py | 10 + .../{ => vip}/candidate_port.py | 6 +- .../{ => vip}/candidate_port_list.py | 2 +- .../{ => vip}/connected_port.py | 6 +- .../connected_port_add_params.py} | 6 +- .../{ => vip}/connected_port_list.py | 2 +- .../connected_port_replace_params.py} | 6 +- .../cloud/reserved_fixed_ips/test_vip.py | 412 ------------------ .../cloud/reserved_fixed_ips/vip/__init__.py | 1 + .../vip/test_candidate_ports.py | 116 +++++ .../vip/test_connected_ports.py | 342 +++++++++++++++ 19 files changed, 1057 insertions(+), 719 deletions(-) create mode 100644 src/gcore/resources/cloud/reserved_fixed_ips/vip/__init__.py create mode 100644 src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py rename src/gcore/resources/cloud/reserved_fixed_ips/{vip.py => vip/connected_ports.py} (50%) create mode 100644 src/gcore/resources/cloud/reserved_fixed_ips/vip/vip.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py rename src/gcore/types/cloud/reserved_fixed_ips/{ => vip}/candidate_port.py (82%) rename src/gcore/types/cloud/reserved_fixed_ips/{ => vip}/candidate_port_list.py (90%) rename src/gcore/types/cloud/reserved_fixed_ips/{ => vip}/connected_port.py (82%) rename src/gcore/types/cloud/reserved_fixed_ips/{vip_update_connected_ports_params.py => vip/connected_port_add_params.py} (67%) rename src/gcore/types/cloud/reserved_fixed_ips/{ => vip}/connected_port_list.py (90%) rename src/gcore/types/cloud/reserved_fixed_ips/{vip_replace_connected_ports_params.py => vip/connected_port_replace_params.py} (66%) create mode 100644 tests/api_resources/cloud/reserved_fixed_ips/vip/__init__.py create mode 100644 tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py create mode 100644 tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py diff --git a/.stats.yml b/.stats.yml index 1d92b3c5..f58461b2 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: 12d04b6067da5a07e6f7f104987c0360 +config_hash: c78d9ecf9139feb7c9a0a8784b5e8d20 diff --git a/api.md b/api.md index 8ae67ebb..06fef89f 100644 --- a/api.md +++ b/api.md @@ -311,22 +311,38 @@ Methods: Types: ```python -from gcore.types.cloud.reserved_fixed_ips import ( - CandidatePort, - CandidatePortList, - ConnectedPort, - ConnectedPortList, - IPWithSubnet, -) +from gcore.types.cloud.reserved_fixed_ips import IPWithSubnet +``` + +Methods: + +- client.cloud.reserved_fixed_ips.vip.toggle(port_id, \*, project_id, region_id, \*\*params) -> ReservedFixedIP + +#### CandidatePorts + +Types: + +```python +from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePort, CandidatePortList +``` + +Methods: + +- client.cloud.reserved_fixed_ips.vip.candidate_ports.list(port_id, \*, project_id, region_id) -> CandidatePortList + +#### ConnectedPorts + +Types: + +```python +from gcore.types.cloud.reserved_fixed_ips.vip import ConnectedPort, ConnectedPortList ``` Methods: -- client.cloud.reserved_fixed_ips.vip.list_candidate_ports(port_id, \*, project_id, region_id) -> CandidatePortList -- client.cloud.reserved_fixed_ips.vip.list_connected_ports(port_id, \*, project_id, region_id) -> ConnectedPortList -- client.cloud.reserved_fixed_ips.vip.replace_connected_ports(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList -- client.cloud.reserved_fixed_ips.vip.toggle(port_id, \*, project_id, region_id, \*\*params) -> ReservedFixedIP -- client.cloud.reserved_fixed_ips.vip.update_connected_ports(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList +- client.cloud.reserved_fixed_ips.vip.connected_ports.list(port_id, \*, project_id, region_id) -> ConnectedPortList +- client.cloud.reserved_fixed_ips.vip.connected_ports.add(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList +- client.cloud.reserved_fixed_ips.vip.connected_ports.replace(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList ## Networks diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index fe46b299..59ed0e06 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -7,7 +7,7 @@ import httpx -from .vip import ( +from .vip.vip import ( VipResource, AsyncVipResource, VipResourceWithRawResponse, diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip/__init__.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip/__init__.py new file mode 100644 index 00000000..81fcb02c --- /dev/null +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .vip import ( + VipResource, + AsyncVipResource, + VipResourceWithRawResponse, + AsyncVipResourceWithRawResponse, + VipResourceWithStreamingResponse, + AsyncVipResourceWithStreamingResponse, +) +from .candidate_ports import ( + CandidatePortsResource, + AsyncCandidatePortsResource, + CandidatePortsResourceWithRawResponse, + AsyncCandidatePortsResourceWithRawResponse, + CandidatePortsResourceWithStreamingResponse, + AsyncCandidatePortsResourceWithStreamingResponse, +) +from .connected_ports import ( + ConnectedPortsResource, + AsyncConnectedPortsResource, + ConnectedPortsResourceWithRawResponse, + AsyncConnectedPortsResourceWithRawResponse, + ConnectedPortsResourceWithStreamingResponse, + AsyncConnectedPortsResourceWithStreamingResponse, +) + +__all__ = [ + "CandidatePortsResource", + "AsyncCandidatePortsResource", + "CandidatePortsResourceWithRawResponse", + "AsyncCandidatePortsResourceWithRawResponse", + "CandidatePortsResourceWithStreamingResponse", + "AsyncCandidatePortsResourceWithStreamingResponse", + "ConnectedPortsResource", + "AsyncConnectedPortsResource", + "ConnectedPortsResourceWithRawResponse", + "AsyncConnectedPortsResourceWithRawResponse", + "ConnectedPortsResourceWithStreamingResponse", + "AsyncConnectedPortsResourceWithStreamingResponse", + "VipResource", + "AsyncVipResource", + "VipResourceWithRawResponse", + "AsyncVipResourceWithRawResponse", + "VipResourceWithStreamingResponse", + "AsyncVipResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py new file mode 100644 index 00000000..fdc29228 --- /dev/null +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py @@ -0,0 +1,175 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ....._types import Body, Query, Headers, NotGiven, not_given +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.cloud.reserved_fixed_ips.vip.candidate_port_list import CandidatePortList + +__all__ = ["CandidatePortsResource", "AsyncCandidatePortsResource"] + + +class CandidatePortsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CandidatePortsResourceWithRawResponse: + """ + 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 CandidatePortsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CandidatePortsResourceWithStreamingResponse: + """ + 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 CandidatePortsResourceWithStreamingResponse(self) + + def list( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CandidatePortList: + """ + List all instance ports that are available for connecting to a VIP. + + 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 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 port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return self._get( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CandidatePortList, + ) + + +class AsyncCandidatePortsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCandidatePortsResourceWithRawResponse: + """ + 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 AsyncCandidatePortsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCandidatePortsResourceWithStreamingResponse: + """ + 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 AsyncCandidatePortsResourceWithStreamingResponse(self) + + async def list( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CandidatePortList: + """ + List all instance ports that are available for connecting to a VIP. + + 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 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 port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return await self._get( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CandidatePortList, + ) + + +class CandidatePortsResourceWithRawResponse: + def __init__(self, candidate_ports: CandidatePortsResource) -> None: + self._candidate_ports = candidate_ports + + self.list = to_raw_response_wrapper( + candidate_ports.list, + ) + + +class AsyncCandidatePortsResourceWithRawResponse: + def __init__(self, candidate_ports: AsyncCandidatePortsResource) -> None: + self._candidate_ports = candidate_ports + + self.list = async_to_raw_response_wrapper( + candidate_ports.list, + ) + + +class CandidatePortsResourceWithStreamingResponse: + def __init__(self, candidate_ports: CandidatePortsResource) -> None: + self._candidate_ports = candidate_ports + + self.list = to_streamed_response_wrapper( + candidate_ports.list, + ) + + +class AsyncCandidatePortsResourceWithStreamingResponse: + def __init__(self, candidate_ports: AsyncCandidatePortsResource) -> None: + self._candidate_ports = candidate_ports + + self.list = async_to_streamed_response_wrapper( + candidate_ports.list, + ) diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py similarity index 50% rename from src/gcore/resources/cloud/reserved_fixed_ips/vip.py rename to src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py index 966a51e0..f98e4b8a 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py @@ -4,89 +4,44 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.reserved_fixed_ip import ReservedFixedIP -from ....types.cloud.reserved_fixed_ips import ( - vip_toggle_params, - vip_update_connected_ports_params, - vip_replace_connected_ports_params, -) -from ....types.cloud.reserved_fixed_ips.candidate_port_list import CandidatePortList -from ....types.cloud.reserved_fixed_ips.connected_port_list import ConnectedPortList +from ....._base_client import make_request_options +from .....types.cloud.reserved_fixed_ips.vip import connected_port_add_params, connected_port_replace_params +from .....types.cloud.reserved_fixed_ips.vip.connected_port_list import ConnectedPortList -__all__ = ["VipResource", "AsyncVipResource"] +__all__ = ["ConnectedPortsResource", "AsyncConnectedPortsResource"] -class VipResource(SyncAPIResource): +class ConnectedPortsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> VipResourceWithRawResponse: + def with_raw_response(self) -> ConnectedPortsResourceWithRawResponse: """ 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 VipResourceWithRawResponse(self) + return ConnectedPortsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> VipResourceWithStreamingResponse: + def with_streaming_response(self) -> ConnectedPortsResourceWithStreamingResponse: """ 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 VipResourceWithStreamingResponse(self) - - def list_candidate_ports( - self, - port_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CandidatePortList: - """ - List all instance ports that are available for connecting to a VIP. - - 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 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 port_id: - raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") - return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CandidatePortList, - ) + return ConnectedPortsResourceWithStreamingResponse(self) - def list_connected_ports( + def list( self, port_id: str, *, @@ -125,7 +80,7 @@ def list_connected_ports( cast_to=ConnectedPortList, ) - def replace_connected_ports( + def add( self, port_id: str, *, @@ -140,7 +95,7 @@ def replace_connected_ports( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ - Replace the list of instance ports that share a VIP. + Add instance ports to share a VIP. Args: port_ids: List of port IDs that will share one VIP @@ -159,61 +114,16 @@ def replace_connected_ports( region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") - return self._put( + return self._patch( f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", - body=maybe_transform( - {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams - ), + body=maybe_transform({"port_ids": port_ids}, connected_port_add_params.ConnectedPortAddParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=ConnectedPortList, ) - def toggle( - self, - port_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - is_vip: bool, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ReservedFixedIP: - """ - Update the VIP status of a reserved fixed IP. - - Args: - is_vip: If reserved fixed IP should be a VIP - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not port_id: - raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") - return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", - body=maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ReservedFixedIP, - ) - - def update_connected_ports( + def replace( self, port_id: str, *, @@ -228,7 +138,7 @@ def update_connected_ports( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ - Add instance ports to share a VIP. + Replace the list of instance ports that share a VIP. Args: port_ids: List of port IDs that will share one VIP @@ -247,11 +157,9 @@ def update_connected_ports( region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") - return self._patch( + return self._put( f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", - body=maybe_transform( - {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams - ), + body=maybe_transform({"port_ids": port_ids}, connected_port_replace_params.ConnectedPortReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -259,66 +167,27 @@ def update_connected_ports( ) -class AsyncVipResource(AsyncAPIResource): +class AsyncConnectedPortsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncVipResourceWithRawResponse: + def with_raw_response(self) -> AsyncConnectedPortsResourceWithRawResponse: """ 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 AsyncVipResourceWithRawResponse(self) + return AsyncConnectedPortsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncVipResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncConnectedPortsResourceWithStreamingResponse: """ 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 AsyncVipResourceWithStreamingResponse(self) + return AsyncConnectedPortsResourceWithStreamingResponse(self) - async def list_candidate_ports( - self, - port_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CandidatePortList: - """ - List all instance ports that are available for connecting to a VIP. - - 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 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 port_id: - raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") - return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CandidatePortList, - ) - - async def list_connected_ports( + async def list( self, port_id: str, *, @@ -357,7 +226,7 @@ async def list_connected_ports( cast_to=ConnectedPortList, ) - async def replace_connected_ports( + async def add( self, port_id: str, *, @@ -372,7 +241,7 @@ async def replace_connected_ports( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ - Replace the list of instance ports that share a VIP. + Add instance ports to share a VIP. Args: port_ids: List of port IDs that will share one VIP @@ -391,61 +260,16 @@ async def replace_connected_ports( region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") - return await self._put( + return await self._patch( f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", - body=await async_maybe_transform( - {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams - ), + body=await async_maybe_transform({"port_ids": port_ids}, connected_port_add_params.ConnectedPortAddParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=ConnectedPortList, ) - async def toggle( - self, - port_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - is_vip: bool, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ReservedFixedIP: - """ - Update the VIP status of a reserved fixed IP. - - Args: - is_vip: If reserved fixed IP should be a VIP - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not port_id: - raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") - return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", - body=await async_maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ReservedFixedIP, - ) - - async def update_connected_ports( + async def replace( self, port_id: str, *, @@ -460,7 +284,7 @@ async def update_connected_ports( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ - Add instance ports to share a VIP. + Replace the list of instance ports that share a VIP. Args: port_ids: List of port IDs that will share one VIP @@ -479,10 +303,10 @@ async def update_connected_ports( region_id = self._client._get_cloud_region_id_path_param() if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") - return await self._patch( + return await self._put( f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( - {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams + {"port_ids": port_ids}, connected_port_replace_params.ConnectedPortReplaceParams ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -491,85 +315,61 @@ async def update_connected_ports( ) -class VipResourceWithRawResponse: - def __init__(self, vip: VipResource) -> None: - self._vip = vip +class ConnectedPortsResourceWithRawResponse: + def __init__(self, connected_ports: ConnectedPortsResource) -> None: + self._connected_ports = connected_ports - self.list_candidate_ports = to_raw_response_wrapper( - vip.list_candidate_ports, - ) - self.list_connected_ports = to_raw_response_wrapper( - vip.list_connected_ports, + self.list = to_raw_response_wrapper( + connected_ports.list, ) - self.replace_connected_ports = to_raw_response_wrapper( - vip.replace_connected_ports, + self.add = to_raw_response_wrapper( + connected_ports.add, ) - self.toggle = to_raw_response_wrapper( - vip.toggle, - ) - self.update_connected_ports = to_raw_response_wrapper( - vip.update_connected_ports, + self.replace = to_raw_response_wrapper( + connected_ports.replace, ) -class AsyncVipResourceWithRawResponse: - def __init__(self, vip: AsyncVipResource) -> None: - self._vip = vip +class AsyncConnectedPortsResourceWithRawResponse: + def __init__(self, connected_ports: AsyncConnectedPortsResource) -> None: + self._connected_ports = connected_ports - self.list_candidate_ports = async_to_raw_response_wrapper( - vip.list_candidate_ports, - ) - self.list_connected_ports = async_to_raw_response_wrapper( - vip.list_connected_ports, + self.list = async_to_raw_response_wrapper( + connected_ports.list, ) - self.replace_connected_ports = async_to_raw_response_wrapper( - vip.replace_connected_ports, + self.add = async_to_raw_response_wrapper( + connected_ports.add, ) - self.toggle = async_to_raw_response_wrapper( - vip.toggle, - ) - self.update_connected_ports = async_to_raw_response_wrapper( - vip.update_connected_ports, + self.replace = async_to_raw_response_wrapper( + connected_ports.replace, ) -class VipResourceWithStreamingResponse: - def __init__(self, vip: VipResource) -> None: - self._vip = vip +class ConnectedPortsResourceWithStreamingResponse: + def __init__(self, connected_ports: ConnectedPortsResource) -> None: + self._connected_ports = connected_ports - self.list_candidate_ports = to_streamed_response_wrapper( - vip.list_candidate_ports, - ) - self.list_connected_ports = to_streamed_response_wrapper( - vip.list_connected_ports, - ) - self.replace_connected_ports = to_streamed_response_wrapper( - vip.replace_connected_ports, + self.list = to_streamed_response_wrapper( + connected_ports.list, ) - self.toggle = to_streamed_response_wrapper( - vip.toggle, + self.add = to_streamed_response_wrapper( + connected_ports.add, ) - self.update_connected_ports = to_streamed_response_wrapper( - vip.update_connected_ports, + self.replace = to_streamed_response_wrapper( + connected_ports.replace, ) -class AsyncVipResourceWithStreamingResponse: - def __init__(self, vip: AsyncVipResource) -> None: - self._vip = vip +class AsyncConnectedPortsResourceWithStreamingResponse: + def __init__(self, connected_ports: AsyncConnectedPortsResource) -> None: + self._connected_ports = connected_ports - self.list_candidate_ports = async_to_streamed_response_wrapper( - vip.list_candidate_ports, - ) - self.list_connected_ports = async_to_streamed_response_wrapper( - vip.list_connected_ports, - ) - self.replace_connected_ports = async_to_streamed_response_wrapper( - vip.replace_connected_ports, + self.list = async_to_streamed_response_wrapper( + connected_ports.list, ) - self.toggle = async_to_streamed_response_wrapper( - vip.toggle, + self.add = async_to_streamed_response_wrapper( + connected_ports.add, ) - self.update_connected_ports = async_to_streamed_response_wrapper( - vip.update_connected_ports, + self.replace = async_to_streamed_response_wrapper( + connected_ports.replace, ) diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip/vip.py new file mode 100644 index 00000000..58ff9bd5 --- /dev/null +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip/vip.py @@ -0,0 +1,249 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ....._types import Body, Query, Headers, NotGiven, not_given +from ....._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 .candidate_ports import ( + CandidatePortsResource, + AsyncCandidatePortsResource, + CandidatePortsResourceWithRawResponse, + AsyncCandidatePortsResourceWithRawResponse, + CandidatePortsResourceWithStreamingResponse, + AsyncCandidatePortsResourceWithStreamingResponse, +) +from .connected_ports import ( + ConnectedPortsResource, + AsyncConnectedPortsResource, + ConnectedPortsResourceWithRawResponse, + AsyncConnectedPortsResourceWithRawResponse, + ConnectedPortsResourceWithStreamingResponse, + AsyncConnectedPortsResourceWithStreamingResponse, +) +from ....._base_client import make_request_options +from .....types.cloud.reserved_fixed_ip import ReservedFixedIP +from .....types.cloud.reserved_fixed_ips import vip_toggle_params + +__all__ = ["VipResource", "AsyncVipResource"] + + +class VipResource(SyncAPIResource): + @cached_property + def candidate_ports(self) -> CandidatePortsResource: + return CandidatePortsResource(self._client) + + @cached_property + def connected_ports(self) -> ConnectedPortsResource: + return ConnectedPortsResource(self._client) + + @cached_property + def with_raw_response(self) -> VipResourceWithRawResponse: + """ + 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 VipResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VipResourceWithStreamingResponse: + """ + 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 VipResourceWithStreamingResponse(self) + + def toggle( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + is_vip: bool, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ReservedFixedIP: + """ + Update the VIP status of a reserved fixed IP. + + Args: + is_vip: If reserved fixed IP should be a VIP + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return self._patch( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + body=maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ReservedFixedIP, + ) + + +class AsyncVipResource(AsyncAPIResource): + @cached_property + def candidate_ports(self) -> AsyncCandidatePortsResource: + return AsyncCandidatePortsResource(self._client) + + @cached_property + def connected_ports(self) -> AsyncConnectedPortsResource: + return AsyncConnectedPortsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncVipResourceWithRawResponse: + """ + 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 AsyncVipResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVipResourceWithStreamingResponse: + """ + 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 AsyncVipResourceWithStreamingResponse(self) + + async def toggle( + self, + port_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + is_vip: bool, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ReservedFixedIP: + """ + Update the VIP status of a reserved fixed IP. + + Args: + is_vip: If reserved fixed IP should be a VIP + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not port_id: + raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") + return await self._patch( + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + body=await async_maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ReservedFixedIP, + ) + + +class VipResourceWithRawResponse: + def __init__(self, vip: VipResource) -> None: + self._vip = vip + + self.toggle = to_raw_response_wrapper( + vip.toggle, + ) + + @cached_property + def candidate_ports(self) -> CandidatePortsResourceWithRawResponse: + return CandidatePortsResourceWithRawResponse(self._vip.candidate_ports) + + @cached_property + def connected_ports(self) -> ConnectedPortsResourceWithRawResponse: + return ConnectedPortsResourceWithRawResponse(self._vip.connected_ports) + + +class AsyncVipResourceWithRawResponse: + def __init__(self, vip: AsyncVipResource) -> None: + self._vip = vip + + self.toggle = async_to_raw_response_wrapper( + vip.toggle, + ) + + @cached_property + def candidate_ports(self) -> AsyncCandidatePortsResourceWithRawResponse: + return AsyncCandidatePortsResourceWithRawResponse(self._vip.candidate_ports) + + @cached_property + def connected_ports(self) -> AsyncConnectedPortsResourceWithRawResponse: + return AsyncConnectedPortsResourceWithRawResponse(self._vip.connected_ports) + + +class VipResourceWithStreamingResponse: + def __init__(self, vip: VipResource) -> None: + self._vip = vip + + self.toggle = to_streamed_response_wrapper( + vip.toggle, + ) + + @cached_property + def candidate_ports(self) -> CandidatePortsResourceWithStreamingResponse: + return CandidatePortsResourceWithStreamingResponse(self._vip.candidate_ports) + + @cached_property + def connected_ports(self) -> ConnectedPortsResourceWithStreamingResponse: + return ConnectedPortsResourceWithStreamingResponse(self._vip.connected_ports) + + +class AsyncVipResourceWithStreamingResponse: + def __init__(self, vip: AsyncVipResource) -> None: + self._vip = vip + + self.toggle = async_to_streamed_response_wrapper( + vip.toggle, + ) + + @cached_property + def candidate_ports(self) -> AsyncCandidatePortsResourceWithStreamingResponse: + return AsyncCandidatePortsResourceWithStreamingResponse(self._vip.candidate_ports) + + @cached_property + def connected_ports(self) -> AsyncConnectedPortsResourceWithStreamingResponse: + return AsyncConnectedPortsResourceWithStreamingResponse(self._vip.connected_ports) diff --git a/src/gcore/types/cloud/reserved_fixed_ips/__init__.py b/src/gcore/types/cloud/reserved_fixed_ips/__init__.py index a437e01d..a796bf7c 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/__init__.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/__init__.py @@ -2,11 +2,5 @@ from __future__ import annotations -from .candidate_port import CandidatePort as CandidatePort -from .connected_port import ConnectedPort as ConnectedPort from .ip_with_subnet import IPWithSubnet as IPWithSubnet from .vip_toggle_params import VipToggleParams as VipToggleParams -from .candidate_port_list import CandidatePortList as CandidatePortList -from .connected_port_list import ConnectedPortList as ConnectedPortList -from .vip_update_connected_ports_params import VipUpdateConnectedPortsParams as VipUpdateConnectedPortsParams -from .vip_replace_connected_ports_params import VipReplaceConnectedPortsParams as VipReplaceConnectedPortsParams diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py new file mode 100644 index 00000000..0dd4eb7e --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .candidate_port import CandidatePort as CandidatePort +from .connected_port import ConnectedPort as ConnectedPort +from .candidate_port_list import CandidatePortList as CandidatePortList +from .connected_port_list import ConnectedPortList as ConnectedPortList +from .connected_port_add_params import ConnectedPortAddParams as ConnectedPortAddParams +from .connected_port_replace_params import ConnectedPortReplaceParams as ConnectedPortReplaceParams diff --git a/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port.py similarity index 82% rename from src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py rename to src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port.py index 78b5db02..4799c337 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/candidate_port.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port.py @@ -2,9 +2,9 @@ from typing import List -from ..network import Network -from ...._models import BaseModel -from .ip_with_subnet import IPWithSubnet +from ...network import Network +from ....._models import BaseModel +from ..ip_with_subnet import IPWithSubnet __all__ = ["CandidatePort"] diff --git a/src/gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list.py similarity index 90% rename from src/gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py rename to src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list.py index d01d7744..3c68db42 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel from .candidate_port import CandidatePort __all__ = ["CandidatePortList"] diff --git a/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port.py similarity index 82% rename from src/gcore/types/cloud/reserved_fixed_ips/connected_port.py rename to src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port.py index 0920f52c..b368f281 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/connected_port.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port.py @@ -2,9 +2,9 @@ from typing import List -from ..network import Network -from ...._models import BaseModel -from .ip_with_subnet import IPWithSubnet +from ...network import Network +from ....._models import BaseModel +from ..ip_with_subnet import IPWithSubnet __all__ = ["ConnectedPort"] diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_add_params.py similarity index 67% rename from src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py rename to src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_add_params.py index d11d10a0..be2667e3 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_add_params.py @@ -4,12 +4,12 @@ from typing_extensions import TypedDict -from ...._types import SequenceNotStr +from ....._types import SequenceNotStr -__all__ = ["VipUpdateConnectedPortsParams"] +__all__ = ["ConnectedPortAddParams"] -class VipUpdateConnectedPortsParams(TypedDict, total=False): +class ConnectedPortAddParams(TypedDict, total=False): project_id: int region_id: int diff --git a/src/gcore/types/cloud/reserved_fixed_ips/connected_port_list.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list.py similarity index 90% rename from src/gcore/types/cloud/reserved_fixed_ips/connected_port_list.py rename to src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list.py index cb2079f7..6a0a2251 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/connected_port_list.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel from .connected_port import ConnectedPort __all__ = ["ConnectedPortList"] diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_params.py similarity index 66% rename from src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py rename to src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_params.py index cb8aa477..860428e7 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_params.py @@ -4,12 +4,12 @@ from typing_extensions import TypedDict -from ...._types import SequenceNotStr +from ....._types import SequenceNotStr -__all__ = ["VipReplaceConnectedPortsParams"] +__all__ = ["ConnectedPortReplaceParams"] -class VipReplaceConnectedPortsParams(TypedDict, total=False): +class ConnectedPortReplaceParams(TypedDict, total=False): project_id: int region_id: int diff --git a/tests/api_resources/cloud/reserved_fixed_ips/test_vip.py b/tests/api_resources/cloud/reserved_fixed_ips/test_vip.py index 65011df5..1b905f1f 100644 --- a/tests/api_resources/cloud/reserved_fixed_ips/test_vip.py +++ b/tests/api_resources/cloud/reserved_fixed_ips/test_vip.py @@ -10,10 +10,6 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.cloud import ReservedFixedIP -from gcore.types.cloud.reserved_fixed_ips import ( - CandidatePortList, - ConnectedPortList, -) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,154 +17,6 @@ class TestVip: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @parametrize - def test_method_list_candidate_ports(self, client: Gcore) -> None: - vip = client.cloud.reserved_fixed_ips.vip.list_candidate_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - assert_matches_type(CandidatePortList, vip, path=["response"]) - - @parametrize - def test_raw_response_list_candidate_ports(self, client: Gcore) -> None: - response = client.cloud.reserved_fixed_ips.vip.with_raw_response.list_candidate_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vip = response.parse() - assert_matches_type(CandidatePortList, vip, path=["response"]) - - @parametrize - def test_streaming_response_list_candidate_ports(self, client: Gcore) -> None: - with client.cloud.reserved_fixed_ips.vip.with_streaming_response.list_candidate_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vip = response.parse() - assert_matches_type(CandidatePortList, vip, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list_candidate_ports(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): - client.cloud.reserved_fixed_ips.vip.with_raw_response.list_candidate_ports( - port_id="", - project_id=0, - region_id=0, - ) - - @parametrize - def test_method_list_connected_ports(self, client: Gcore) -> None: - vip = client.cloud.reserved_fixed_ips.vip.list_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - def test_raw_response_list_connected_ports(self, client: Gcore) -> None: - response = client.cloud.reserved_fixed_ips.vip.with_raw_response.list_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vip = response.parse() - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - def test_streaming_response_list_connected_ports(self, client: Gcore) -> None: - with client.cloud.reserved_fixed_ips.vip.with_streaming_response.list_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vip = response.parse() - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list_connected_ports(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): - client.cloud.reserved_fixed_ips.vip.with_raw_response.list_connected_ports( - port_id="", - project_id=0, - region_id=0, - ) - - @parametrize - def test_method_replace_connected_ports(self, client: Gcore) -> None: - vip = client.cloud.reserved_fixed_ips.vip.replace_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - def test_method_replace_connected_ports_with_all_params(self, client: Gcore) -> None: - vip = client.cloud.reserved_fixed_ips.vip.replace_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], - ) - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - def test_raw_response_replace_connected_ports(self, client: Gcore) -> None: - response = client.cloud.reserved_fixed_ips.vip.with_raw_response.replace_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vip = response.parse() - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - def test_streaming_response_replace_connected_ports(self, client: Gcore) -> None: - with client.cloud.reserved_fixed_ips.vip.with_streaming_response.replace_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vip = response.parse() - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_replace_connected_ports(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): - client.cloud.reserved_fixed_ips.vip.with_raw_response.replace_connected_ports( - port_id="", - project_id=0, - region_id=0, - ) - @parametrize def test_method_toggle(self, client: Gcore) -> None: vip = client.cloud.reserved_fixed_ips.vip.toggle( @@ -219,216 +67,12 @@ def test_path_params_toggle(self, client: Gcore) -> None: is_vip=True, ) - @parametrize - def test_method_update_connected_ports(self, client: Gcore) -> None: - vip = client.cloud.reserved_fixed_ips.vip.update_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - def test_method_update_connected_ports_with_all_params(self, client: Gcore) -> None: - vip = client.cloud.reserved_fixed_ips.vip.update_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], - ) - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - def test_raw_response_update_connected_ports(self, client: Gcore) -> None: - response = client.cloud.reserved_fixed_ips.vip.with_raw_response.update_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vip = response.parse() - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - def test_streaming_response_update_connected_ports(self, client: Gcore) -> None: - with client.cloud.reserved_fixed_ips.vip.with_streaming_response.update_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vip = response.parse() - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update_connected_ports(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): - client.cloud.reserved_fixed_ips.vip.with_raw_response.update_connected_ports( - port_id="", - project_id=0, - region_id=0, - ) - class TestAsyncVip: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @parametrize - async def test_method_list_candidate_ports(self, async_client: AsyncGcore) -> None: - vip = await async_client.cloud.reserved_fixed_ips.vip.list_candidate_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - assert_matches_type(CandidatePortList, vip, path=["response"]) - - @parametrize - async def test_raw_response_list_candidate_ports(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.list_candidate_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vip = await response.parse() - assert_matches_type(CandidatePortList, vip, path=["response"]) - - @parametrize - async def test_streaming_response_list_candidate_ports(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.reserved_fixed_ips.vip.with_streaming_response.list_candidate_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vip = await response.parse() - assert_matches_type(CandidatePortList, vip, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list_candidate_ports(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): - await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.list_candidate_ports( - port_id="", - project_id=0, - region_id=0, - ) - - @parametrize - async def test_method_list_connected_ports(self, async_client: AsyncGcore) -> None: - vip = await async_client.cloud.reserved_fixed_ips.vip.list_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - async def test_raw_response_list_connected_ports(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.list_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vip = await response.parse() - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - async def test_streaming_response_list_connected_ports(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.reserved_fixed_ips.vip.with_streaming_response.list_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vip = await response.parse() - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list_connected_ports(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): - await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.list_connected_ports( - port_id="", - project_id=0, - region_id=0, - ) - - @parametrize - async def test_method_replace_connected_ports(self, async_client: AsyncGcore) -> None: - vip = await async_client.cloud.reserved_fixed_ips.vip.replace_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - async def test_method_replace_connected_ports_with_all_params(self, async_client: AsyncGcore) -> None: - vip = await async_client.cloud.reserved_fixed_ips.vip.replace_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], - ) - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - async def test_raw_response_replace_connected_ports(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.replace_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vip = await response.parse() - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - async def test_streaming_response_replace_connected_ports(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.reserved_fixed_ips.vip.with_streaming_response.replace_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vip = await response.parse() - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_replace_connected_ports(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): - await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.replace_connected_ports( - port_id="", - project_id=0, - region_id=0, - ) - @parametrize async def test_method_toggle(self, async_client: AsyncGcore) -> None: vip = await async_client.cloud.reserved_fixed_ips.vip.toggle( @@ -478,59 +122,3 @@ async def test_path_params_toggle(self, async_client: AsyncGcore) -> None: region_id=0, is_vip=True, ) - - @parametrize - async def test_method_update_connected_ports(self, async_client: AsyncGcore) -> None: - vip = await async_client.cloud.reserved_fixed_ips.vip.update_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - async def test_method_update_connected_ports_with_all_params(self, async_client: AsyncGcore) -> None: - vip = await async_client.cloud.reserved_fixed_ips.vip.update_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], - ) - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - async def test_raw_response_update_connected_ports(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.update_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vip = await response.parse() - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - @parametrize - async def test_streaming_response_update_connected_ports(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.reserved_fixed_ips.vip.with_streaming_response.update_connected_ports( - port_id="port_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vip = await response.parse() - assert_matches_type(ConnectedPortList, vip, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update_connected_ports(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): - await async_client.cloud.reserved_fixed_ips.vip.with_raw_response.update_connected_ports( - port_id="", - project_id=0, - region_id=0, - ) diff --git a/tests/api_resources/cloud/reserved_fixed_ips/vip/__init__.py b/tests/api_resources/cloud/reserved_fixed_ips/vip/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/reserved_fixed_ips/vip/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py new file mode 100644 index 00000000..cc679c0e --- /dev/null +++ b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py @@ -0,0 +1,116 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePortList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCandidatePorts: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + candidate_port = client.cloud.reserved_fixed_ips.vip.candidate_ports.list( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.vip.candidate_ports.with_raw_response.list( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + candidate_port = response.parse() + assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.vip.candidate_ports.with_streaming_response.list( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + candidate_port = response.parse() + assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.reserved_fixed_ips.vip.candidate_ports.with_raw_response.list( + port_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncCandidatePorts: + 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: + candidate_port = await async_client.cloud.reserved_fixed_ips.vip.candidate_ports.list( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.vip.candidate_ports.with_raw_response.list( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + candidate_port = await response.parse() + assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.vip.candidate_ports.with_streaming_response.list( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + candidate_port = await response.parse() + assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.reserved_fixed_ips.vip.candidate_ports.with_raw_response.list( + port_id="", + project_id=0, + region_id=0, + ) diff --git a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py new file mode 100644 index 00000000..7c47c319 --- /dev/null +++ b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py @@ -0,0 +1,342 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud.reserved_fixed_ips.vip import ( + ConnectedPortList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestConnectedPorts: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + connected_port = client.cloud.reserved_fixed_ips.vip.connected_ports.list( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.vip.connected_ports.with_raw_response.list( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connected_port = response.parse() + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.vip.connected_ports.with_streaming_response.list( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connected_port = response.parse() + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.reserved_fixed_ips.vip.connected_ports.with_raw_response.list( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_add(self, client: Gcore) -> None: + connected_port = client.cloud.reserved_fixed_ips.vip.connected_ports.add( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + def test_method_add_with_all_params(self, client: Gcore) -> None: + connected_port = client.cloud.reserved_fixed_ips.vip.connected_ports.add( + port_id="port_id", + project_id=0, + region_id=0, + port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], + ) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + def test_raw_response_add(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.vip.connected_ports.with_raw_response.add( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connected_port = response.parse() + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + def test_streaming_response_add(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.vip.connected_ports.with_streaming_response.add( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connected_port = response.parse() + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_add(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.reserved_fixed_ips.vip.connected_ports.with_raw_response.add( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + connected_port = client.cloud.reserved_fixed_ips.vip.connected_ports.replace( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + connected_port = client.cloud.reserved_fixed_ips.vip.connected_ports.replace( + port_id="port_id", + project_id=0, + region_id=0, + port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], + ) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cloud.reserved_fixed_ips.vip.connected_ports.with_raw_response.replace( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connected_port = response.parse() + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cloud.reserved_fixed_ips.vip.connected_ports.with_streaming_response.replace( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connected_port = response.parse() + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_replace(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + client.cloud.reserved_fixed_ips.vip.connected_ports.with_raw_response.replace( + port_id="", + project_id=0, + region_id=0, + ) + + +class TestAsyncConnectedPorts: + 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: + connected_port = await async_client.cloud.reserved_fixed_ips.vip.connected_ports.list( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.vip.connected_ports.with_raw_response.list( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connected_port = await response.parse() + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.vip.connected_ports.with_streaming_response.list( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connected_port = await response.parse() + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.reserved_fixed_ips.vip.connected_ports.with_raw_response.list( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_add(self, async_client: AsyncGcore) -> None: + connected_port = await async_client.cloud.reserved_fixed_ips.vip.connected_ports.add( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> None: + connected_port = await async_client.cloud.reserved_fixed_ips.vip.connected_ports.add( + port_id="port_id", + project_id=0, + region_id=0, + port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], + ) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + async def test_raw_response_add(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.vip.connected_ports.with_raw_response.add( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connected_port = await response.parse() + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + async def test_streaming_response_add(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.vip.connected_ports.with_streaming_response.add( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connected_port = await response.parse() + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_add(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.reserved_fixed_ips.vip.connected_ports.with_raw_response.add( + port_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + connected_port = await async_client.cloud.reserved_fixed_ips.vip.connected_ports.replace( + port_id="port_id", + project_id=0, + region_id=0, + ) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + connected_port = await async_client.cloud.reserved_fixed_ips.vip.connected_ports.replace( + port_id="port_id", + project_id=0, + region_id=0, + port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], + ) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.reserved_fixed_ips.vip.connected_ports.with_raw_response.replace( + port_id="port_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connected_port = await response.parse() + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.reserved_fixed_ips.vip.connected_ports.with_streaming_response.replace( + port_id="port_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connected_port = await response.parse() + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_replace(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `port_id` but received ''"): + await async_client.cloud.reserved_fixed_ips.vip.connected_ports.with_raw_response.replace( + port_id="", + project_id=0, + region_id=0, + ) From 854a87cc4ce0b3da184bd835574b55dfff7a3f4a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Dec 2025 20:17:37 +0000 Subject: [PATCH 478/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f58461b2..67f225de 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: c78d9ecf9139feb7c9a0a8784b5e8d20 +config_hash: 1607041fe51cd832db709af848355624 From 0fea46de9965a86133be16f4649c51f3976e5af7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Dec 2025 21:16:45 +0000 Subject: [PATCH 479/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 67f225de..228e8f6c 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 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f57087d83cc5135c47f333ed0a63556bf863412fc64fc994e85dce424091748c.yml +openapi_spec_hash: 688d72b5f721a48f16e55906233dbbdd config_hash: 1607041fe51cd832db709af848355624 From 1dadab1ecbfeba56f038ae02924e76df83204d22 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Dec 2025 08:13:55 +0000 Subject: [PATCH 480/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 228e8f6c..c845ebe0 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-f57087d83cc5135c47f333ed0a63556bf863412fc64fc994e85dce424091748c.yml -openapi_spec_hash: 688d72b5f721a48f16e55906233dbbdd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-605467e8ebfb1f3a191479bd2e95aae67e637f9143f142cfd7cbf27e0180a4c3.yml +openapi_spec_hash: 490bb734e61ef3d749bff3181137ba0f config_hash: 1607041fe51cd832db709af848355624 From e0363a7a9f66facfe8bf3cc113cb0d41bd1c2940 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Dec 2025 19:11:53 +0000 Subject: [PATCH 481/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c845ebe0..99de8068 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-605467e8ebfb1f3a191479bd2e95aae67e637f9143f142cfd7cbf27e0180a4c3.yml -openapi_spec_hash: 490bb734e61ef3d749bff3181137ba0f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-739b0d84ccefaa883a2334ad16738cc87ec625ded28ee0e2e11781f17ba36580.yml +openapi_spec_hash: deb6a4c127edd808cfd8c8eb9eb9610b config_hash: 1607041fe51cd832db709af848355624 From fcacd5e33f9ecc087873602b42151607bdf0087c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 09:27:49 +0000 Subject: [PATCH 482/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d2d60a3d..a36746b8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.24.0" + ".": "0.25.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index bc96f9a3..1ec62bb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.24.0" +version = "0.25.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 08a76896..7771dae8 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.24.0" # x-release-please-version +__version__ = "0.25.0" # x-release-please-version From 7b330af91d86078994cd1d569c73f1e212a26cdd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 11:17:07 +0000 Subject: [PATCH 483/592] feat(cloud): add k8s cluster pools check quotas method --- .stats.yml | 4 +- api.md | 3 +- .../cloud/k8s/clusters/pools/pools.py | 174 ++++++++++++++- .../types/cloud/k8s/clusters/__init__.py | 2 + .../k8s/clusters/k8s_cluster_pool_quota.py | 204 ++++++++++++++++++ .../k8s/clusters/pool_check_quota_params.py | 37 ++++ .../cloud/k8s/clusters/test_pools.py | 105 +++++++++ 7 files changed, 525 insertions(+), 4 deletions(-) create mode 100644 src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_quota.py create mode 100644 src/gcore/types/cloud/k8s/clusters/pool_check_quota_params.py diff --git a/.stats.yml b/.stats.yml index 99de8068..e84f2b46 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 640 +configured_endpoints: 641 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-739b0d84ccefaa883a2334ad16738cc87ec625ded28ee0e2e11781f17ba36580.yml openapi_spec_hash: deb6a4c127edd808cfd8c8eb9eb9610b -config_hash: 1607041fe51cd832db709af848355624 +config_hash: c6c8ef25ca05ecd4082810d4afd564cf diff --git a/api.md b/api.md index 06fef89f..f54b05d3 100644 --- a/api.md +++ b/api.md @@ -1046,7 +1046,7 @@ Methods: Types: ```python -from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolList +from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolList, K8SClusterPoolQuota ``` Methods: @@ -1055,6 +1055,7 @@ Methods: - client.cloud.k8s.clusters.pools.update(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> K8SClusterPool - client.cloud.k8s.clusters.pools.list(cluster_name, \*, project_id, region_id) -> K8SClusterPoolList - client.cloud.k8s.clusters.pools.delete(pool_name, \*, project_id, region_id, cluster_name) -> TaskIDList +- client.cloud.k8s.clusters.pools.check_quota(\*, project_id, region_id, \*\*params) -> K8SClusterPoolQuota - client.cloud.k8s.clusters.pools.get(pool_name, \*, project_id, region_id, cluster_name) -> K8SClusterPool - client.cloud.k8s.clusters.pools.resize(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> TaskIDList diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 6cc9863a..7de8cf65 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -26,10 +26,16 @@ async_to_streamed_response_wrapper, ) from ......_base_client import make_request_options -from ......types.cloud.k8s.clusters import pool_create_params, pool_resize_params, pool_update_params +from ......types.cloud.k8s.clusters import ( + pool_create_params, + pool_resize_params, + pool_update_params, + pool_check_quota_params, +) from ......types.cloud.task_id_list import TaskIDList from ......types.cloud.k8s.clusters.k8s_cluster_pool import K8SClusterPool from ......types.cloud.k8s.clusters.k8s_cluster_pool_list import K8SClusterPoolList +from ......types.cloud.k8s.clusters.k8s_cluster_pool_quota import K8SClusterPoolQuota __all__ = ["PoolsResource", "AsyncPoolsResource"] @@ -307,6 +313,83 @@ def delete( cast_to=TaskIDList, ) + def check_quota( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor_id: str, + boot_volume_size: Optional[int] | Omit = omit, + max_node_count: Optional[int] | Omit = omit, + min_node_count: Optional[int] | Omit = omit, + name: Optional[str] | Omit = omit, + node_count: Optional[int] | Omit = omit, + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> K8SClusterPoolQuota: + """Calculate quota requirements for a new cluster pool before creation. + + Returns + exceeded quotas if regional limits would be violated. Use before pool creation + to validate resource availability. Checks: CPU, RAM, volumes, VMs, GPUs, and + baremetal quotas depending on flavor type. + + Args: + project_id: Project ID + + region_id: Region ID + + flavor_id: Flavor ID + + boot_volume_size: Boot volume size + + max_node_count: Maximum node count + + min_node_count: Minimum node count + + name: Name of the cluster pool + + node_count: Maximum node count + + servergroup_policy: Server group policy: anti-affinity, soft-anti-affinity or affinity + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/pools/check_limits", + body=maybe_transform( + { + "flavor_id": flavor_id, + "boot_volume_size": boot_volume_size, + "max_node_count": max_node_count, + "min_node_count": min_node_count, + "name": name, + "node_count": node_count, + "servergroup_policy": servergroup_policy, + }, + pool_check_quota_params.PoolCheckQuotaParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8SClusterPoolQuota, + ) + def get( self, pool_name: str, @@ -669,6 +752,83 @@ async def delete( cast_to=TaskIDList, ) + async def check_quota( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor_id: str, + boot_volume_size: Optional[int] | Omit = omit, + max_node_count: Optional[int] | Omit = omit, + min_node_count: Optional[int] | Omit = omit, + name: Optional[str] | Omit = omit, + node_count: Optional[int] | Omit = omit, + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> K8SClusterPoolQuota: + """Calculate quota requirements for a new cluster pool before creation. + + Returns + exceeded quotas if regional limits would be violated. Use before pool creation + to validate resource availability. Checks: CPU, RAM, volumes, VMs, GPUs, and + baremetal quotas depending on flavor type. + + Args: + project_id: Project ID + + region_id: Region ID + + flavor_id: Flavor ID + + boot_volume_size: Boot volume size + + max_node_count: Maximum node count + + min_node_count: Minimum node count + + name: Name of the cluster pool + + node_count: Maximum node count + + servergroup_policy: Server group policy: anti-affinity, soft-anti-affinity or affinity + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/pools/check_limits", + body=await async_maybe_transform( + { + "flavor_id": flavor_id, + "boot_volume_size": boot_volume_size, + "max_node_count": max_node_count, + "min_node_count": min_node_count, + "name": name, + "node_count": node_count, + "servergroup_policy": servergroup_policy, + }, + pool_check_quota_params.PoolCheckQuotaParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8SClusterPoolQuota, + ) + async def get( self, pool_name: str, @@ -774,6 +934,9 @@ def __init__(self, pools: PoolsResource) -> None: self.delete = to_raw_response_wrapper( pools.delete, ) + self.check_quota = to_raw_response_wrapper( + pools.check_quota, + ) self.get = to_raw_response_wrapper( pools.get, ) @@ -802,6 +965,9 @@ def __init__(self, pools: AsyncPoolsResource) -> None: self.delete = async_to_raw_response_wrapper( pools.delete, ) + self.check_quota = async_to_raw_response_wrapper( + pools.check_quota, + ) self.get = async_to_raw_response_wrapper( pools.get, ) @@ -830,6 +996,9 @@ def __init__(self, pools: PoolsResource) -> None: self.delete = to_streamed_response_wrapper( pools.delete, ) + self.check_quota = to_streamed_response_wrapper( + pools.check_quota, + ) self.get = to_streamed_response_wrapper( pools.get, ) @@ -858,6 +1027,9 @@ def __init__(self, pools: AsyncPoolsResource) -> None: self.delete = async_to_streamed_response_wrapper( pools.delete, ) + self.check_quota = async_to_streamed_response_wrapper( + pools.check_quota, + ) self.get = async_to_streamed_response_wrapper( pools.get, ) diff --git a/src/gcore/types/cloud/k8s/clusters/__init__.py b/src/gcore/types/cloud/k8s/clusters/__init__.py index e145306b..c8c5c859 100644 --- a/src/gcore/types/cloud/k8s/clusters/__init__.py +++ b/src/gcore/types/cloud/k8s/clusters/__init__.py @@ -8,3 +8,5 @@ from .pool_resize_params import PoolResizeParams as PoolResizeParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .k8s_cluster_pool_list import K8SClusterPoolList as K8SClusterPoolList +from .k8s_cluster_pool_quota import K8SClusterPoolQuota as K8SClusterPoolQuota +from .pool_check_quota_params import PoolCheckQuotaParams as PoolCheckQuotaParams diff --git a/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_quota.py b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_quota.py new file mode 100644 index 00000000..f7c178db --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_quota.py @@ -0,0 +1,204 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ....._models import BaseModel + +__all__ = ["K8SClusterPoolQuota"] + + +class K8SClusterPoolQuota(BaseModel): + """Response schema for K8s cluster quota check. + + Returns quota fields that are exceeded. Fields are only included when + regional limits would be violated. Empty response means no quotas exceeded. + """ + + baremetal_gpu_a100_count_limit: Optional[int] = None + """Bare metal A100 GPU server count limit""" + + baremetal_gpu_a100_count_requested: Optional[int] = None + """Bare metal A100 GPU server count requested""" + + baremetal_gpu_a100_count_usage: Optional[int] = None + """Bare metal A100 GPU server count usage""" + + baremetal_gpu_h100_count_limit: Optional[int] = None + """Bare metal H100 GPU server count limit""" + + baremetal_gpu_h100_count_requested: Optional[int] = None + """Bare metal H100 GPU server count requested""" + + baremetal_gpu_h100_count_usage: Optional[int] = None + """Bare metal H100 GPU server count usage""" + + baremetal_gpu_h200_count_limit: Optional[int] = None + """Bare metal H200 GPU server count limit""" + + baremetal_gpu_h200_count_requested: Optional[int] = None + """Bare metal H200 GPU server count requested""" + + baremetal_gpu_h200_count_usage: Optional[int] = None + """Bare metal H200 GPU server count usage""" + + baremetal_gpu_l40s_count_limit: Optional[int] = None + """Bare metal L40S GPU server count limit""" + + baremetal_gpu_l40s_count_requested: Optional[int] = None + """Bare metal L40S GPU server count requested""" + + baremetal_gpu_l40s_count_usage: Optional[int] = None + """Bare metal L40S GPU server count usage""" + + baremetal_hf_count_limit: Optional[int] = None + """High-frequency bare metal servers count limit""" + + baremetal_hf_count_requested: Optional[int] = None + """High-frequency bare metal servers count requested""" + + baremetal_hf_count_usage: Optional[int] = None + """High-frequency bare metal servers count usage""" + + cluster_count_limit: Optional[int] = None + """K8s clusters count limit""" + + cluster_count_requested: Optional[int] = None + """K8s clusters count requested""" + + cluster_count_usage: Optional[int] = None + """K8s clusters count usage""" + + cpu_count_limit: Optional[int] = None + """vCPU Count limit""" + + cpu_count_requested: Optional[int] = None + """vCPU Count requested""" + + cpu_count_usage: Optional[int] = None + """vCPU Count usage""" + + firewall_count_limit: Optional[int] = None + """Firewalls Count limit""" + + firewall_count_requested: Optional[int] = None + """Firewalls Count requested""" + + firewall_count_usage: Optional[int] = None + """Firewalls Count usage""" + + floating_count_limit: Optional[int] = None + """Floating IP Count limit""" + + floating_count_requested: Optional[int] = None + """Floating IP Count requested""" + + floating_count_usage: Optional[int] = None + """Floating IP Count usage""" + + gpu_count_limit: Optional[int] = None + """GPU Count limit""" + + gpu_count_requested: Optional[int] = None + """GPU Count requested""" + + gpu_count_usage: Optional[int] = None + """GPU Count usage""" + + gpu_virtual_a100_count_limit: Optional[int] = None + """Virtual A100 GPU card count limit""" + + gpu_virtual_a100_count_requested: Optional[int] = None + """Virtual A100 GPU card count requested""" + + gpu_virtual_a100_count_usage: Optional[int] = None + """Virtual A100 GPU card count usage""" + + gpu_virtual_h100_count_limit: Optional[int] = None + """Virtual H100 GPU card count limit""" + + gpu_virtual_h100_count_requested: Optional[int] = None + """Virtual H100 GPU card count requested""" + + gpu_virtual_h100_count_usage: Optional[int] = None + """Virtual H100 GPU card count usage""" + + gpu_virtual_h200_count_limit: Optional[int] = None + """Virtual H200 GPU card count limit""" + + gpu_virtual_h200_count_requested: Optional[int] = None + """Virtual H200 GPU card count requested""" + + gpu_virtual_h200_count_usage: Optional[int] = None + """Virtual H200 GPU card count usage""" + + gpu_virtual_l40s_count_limit: Optional[int] = None + """Virtual L40S GPU card count limit""" + + gpu_virtual_l40s_count_requested: Optional[int] = None + """Virtual L40S GPU card count requested""" + + gpu_virtual_l40s_count_usage: Optional[int] = None + """Virtual L40S GPU card count usage""" + + laas_topic_count_limit: Optional[int] = None + """LaaS Topics Count limit""" + + laas_topic_count_requested: Optional[int] = None + """LaaS Topics Count requested""" + + laas_topic_count_usage: Optional[int] = None + """LaaS Topics Count usage""" + + loadbalancer_count_limit: Optional[int] = None + """Load Balancers Count limit""" + + loadbalancer_count_requested: Optional[int] = None + """Load Balancers Count requested""" + + loadbalancer_count_usage: Optional[int] = None + """Load Balancers Count usage""" + + ram_limit: Optional[int] = None + """RAM Size, MiB limit""" + + ram_requested: Optional[int] = None + """RAM Size, MiB requested""" + + ram_usage: Optional[int] = None + """RAM Size, MiB usage""" + + servergroup_count_limit: Optional[int] = None + """Placement Group Count limit""" + + servergroup_count_requested: Optional[int] = None + """Placement Group Count requested""" + + servergroup_count_usage: Optional[int] = None + """Placement Group Count usage""" + + vm_count_limit: Optional[int] = None + """VMs Count limit""" + + vm_count_requested: Optional[int] = None + """VMs Count requested""" + + vm_count_usage: Optional[int] = None + """VMs Count usage""" + + volume_count_limit: Optional[int] = None + """Volumes Count limit""" + + volume_count_requested: Optional[int] = None + """Volumes Count requested""" + + volume_count_usage: Optional[int] = None + """Volumes Count usage""" + + volume_size_limit: Optional[int] = None + """Volumes Size, GiB limit""" + + volume_size_requested: Optional[int] = None + """Volumes Size, GiB requested""" + + volume_size_usage: Optional[int] = None + """Volumes Size, GiB usage""" diff --git a/src/gcore/types/cloud/k8s/clusters/pool_check_quota_params.py b/src/gcore/types/cloud/k8s/clusters/pool_check_quota_params.py new file mode 100644 index 00000000..06880774 --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/pool_check_quota_params.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["PoolCheckQuotaParams"] + + +class PoolCheckQuotaParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + flavor_id: Required[str] + """Flavor ID""" + + boot_volume_size: Optional[int] + """Boot volume size""" + + max_node_count: Optional[int] + """Maximum node count""" + + min_node_count: Optional[int] + """Minimum node count""" + + name: Optional[str] + """Name of the cluster pool""" + + node_count: Optional[int] + """Maximum node count""" + + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] + """Server group policy: anti-affinity, soft-anti-affinity or affinity""" diff --git a/tests/api_resources/cloud/k8s/clusters/test_pools.py b/tests/api_resources/cloud/k8s/clusters/test_pools.py index 214fa14e..bc2d028a 100644 --- a/tests/api_resources/cloud/k8s/clusters/test_pools.py +++ b/tests/api_resources/cloud/k8s/clusters/test_pools.py @@ -13,6 +13,7 @@ from gcore.types.cloud.k8s.clusters import ( K8SClusterPool, K8SClusterPoolList, + K8SClusterPoolQuota, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -279,6 +280,58 @@ def test_path_params_delete(self, client: Gcore) -> None: cluster_name="cluster_name", ) + @parametrize + def test_method_check_quota(self, client: Gcore) -> None: + pool = client.cloud.k8s.clusters.pools.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + ) + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + @parametrize + def test_method_check_quota_with_all_params(self, client: Gcore) -> None: + pool = client.cloud.k8s.clusters.pools.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + boot_volume_size=50, + max_node_count=5, + min_node_count=3, + name="test", + node_count=5, + servergroup_policy="anti-affinity", + ) + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + @parametrize + def test_raw_response_check_quota(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.pools.with_raw_response.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + @parametrize + def test_streaming_response_check_quota(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.pools.with_streaming_response.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_get(self, client: Gcore) -> None: pool = client.cloud.k8s.clusters.pools.get( @@ -664,6 +717,58 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: cluster_name="cluster_name", ) + @parametrize + async def test_method_check_quota(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.k8s.clusters.pools.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + ) + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + @parametrize + async def test_method_check_quota_with_all_params(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.k8s.clusters.pools.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + boot_volume_size=50, + max_node_count=5, + min_node_count=3, + name="test", + node_count=5, + servergroup_policy="anti-affinity", + ) + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + @parametrize + async def test_raw_response_check_quota(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.pools.with_raw_response.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + @parametrize + async def test_streaming_response_check_quota(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.pools.with_streaming_response.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.k8s.clusters.pools.get( From 5709b5f3075436247acb4acb2f0d0bb90f179018 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 16:13:13 +0000 Subject: [PATCH 484/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index e84f2b46..6aabaa4f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-739b0d84ccefaa883a2334ad16738cc87ec625ded28ee0e2e11781f17ba36580.yml -openapi_spec_hash: deb6a4c127edd808cfd8c8eb9eb9610b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-049015d30ae7be5a2516de85e7676067a73a19ac93bb7466fe755fa02a50e455.yml +openapi_spec_hash: 76630a1cbcc682a5654a85734d0d2ec9 config_hash: c6c8ef25ca05ecd4082810d4afd564cf From f05102e6ca611c3bd39798a3b65e2af03ffce257 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 19:19:15 +0000 Subject: [PATCH 485/592] chore(internal): add missing files argument to base client --- src/gcore/_base_client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index b68aa376..dbb20c58 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -1247,9 +1247,12 @@ def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + opts = FinalRequestOptions.construct( + method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + ) return self.request(cast_to, opts) def put( @@ -1767,9 +1770,12 @@ async def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + opts = FinalRequestOptions.construct( + method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + ) return await self.request(cast_to, opts) async def put( From 5afe063c53076e6aebb05fa5d1fe8fbd641214ae Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Dec 2025 10:12:03 +0000 Subject: [PATCH 486/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6aabaa4f..4e82abb7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-049015d30ae7be5a2516de85e7676067a73a19ac93bb7466fe755fa02a50e455.yml -openapi_spec_hash: 76630a1cbcc682a5654a85734d0d2ec9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-36971faed5b11c78add3bd18144c9e7374da2cb07cdff440b9866fda9b8740a4.yml +openapi_spec_hash: 0edd74ac0c1bf1c36807d1549d770d38 config_hash: c6c8ef25ca05ecd4082810d4afd564cf From d0784cbb8b728908cb5c174f45ab7c456fe99967 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Dec 2025 15:26:25 +0000 Subject: [PATCH 487/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4e82abb7..1628a0a6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-36971faed5b11c78add3bd18144c9e7374da2cb07cdff440b9866fda9b8740a4.yml -openapi_spec_hash: 0edd74ac0c1bf1c36807d1549d770d38 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d3062187985fbeaf2d7852a622344a75a8a87e0e941743194c44f74ee0222dbb.yml +openapi_spec_hash: 01b0048f185d3ceb84fe75a52a27afc8 config_hash: c6c8ef25ca05ecd4082810d4afd564cf From 36647efe0f942c9ecc555095888ab7fc20c10d9b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Dec 2025 17:20:56 +0000 Subject: [PATCH 488/592] chore: speedup initial import --- src/gcore/_client.py | 456 +++++++++++++++++++++++++------- src/gcore/resources/__init__.py | 130 --------- 2 files changed, 364 insertions(+), 222 deletions(-) diff --git a/src/gcore/_client.py b/src/gcore/_client.py index d900f571..4bd616d2 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Mapping +from typing import TYPE_CHECKING, Any, Mapping from typing_extensions import Self, override import httpx @@ -20,6 +20,7 @@ not_given, ) from ._utils import is_given, get_async_library, maybe_coerce_integer +from ._compat import cached_property from ._version import __version__ from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import GcoreError, APIStatusError @@ -28,32 +29,23 @@ SyncAPIClient, AsyncAPIClient, ) -from .resources.cdn import cdn -from .resources.dns import dns -from .resources.iam import iam -from .resources.waap import waap -from .resources.cloud import cloud -from .resources.storage import storage -from .resources.fastedge import fastedge -from .resources.security import security -from .resources.streaming import streaming + +if TYPE_CHECKING: + from .resources import cdn, dns, iam, waap, cloud, storage, fastedge, security, streaming + from .resources.cdn.cdn import CdnResource, AsyncCdnResource + from .resources.dns.dns import DNSResource, AsyncDNSResource + from .resources.iam.iam import IamResource, AsyncIamResource + from .resources.waap.waap import WaapResource, AsyncWaapResource + from .resources.cloud.cloud import CloudResource, AsyncCloudResource + from .resources.storage.storage import StorageResource, AsyncStorageResource + from .resources.fastedge.fastedge import FastedgeResource, AsyncFastedgeResource + from .resources.security.security import SecurityResource, AsyncSecurityResource + from .resources.streaming.streaming import StreamingResource, AsyncStreamingResource __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Gcore", "AsyncGcore", "Client", "AsyncClient"] class Gcore(SyncAPIClient): - cloud: cloud.CloudResource - waap: waap.WaapResource - iam: iam.IamResource - fastedge: fastedge.FastedgeResource - streaming: streaming.StreamingResource - security: security.SecurityResource - dns: dns.DNSResource - storage: storage.StorageResource - cdn: cdn.CdnResource - with_raw_response: GcoreWithRawResponse - with_streaming_response: GcoreWithStreamedResponse - # client options api_key: str cloud_project_id: int | None @@ -135,17 +127,67 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.cloud = cloud.CloudResource(self) - self.waap = waap.WaapResource(self) - self.iam = iam.IamResource(self) - self.fastedge = fastedge.FastedgeResource(self) - self.streaming = streaming.StreamingResource(self) - self.security = security.SecurityResource(self) - self.dns = dns.DNSResource(self) - self.storage = storage.StorageResource(self) - self.cdn = cdn.CdnResource(self) - self.with_raw_response = GcoreWithRawResponse(self) - self.with_streaming_response = GcoreWithStreamedResponse(self) + @cached_property + def cloud(self) -> CloudResource: + from .resources.cloud import CloudResource + + return CloudResource(self) + + @cached_property + def waap(self) -> WaapResource: + from .resources.waap import WaapResource + + return WaapResource(self) + + @cached_property + def iam(self) -> IamResource: + from .resources.iam import IamResource + + return IamResource(self) + + @cached_property + def fastedge(self) -> FastedgeResource: + from .resources.fastedge import FastedgeResource + + return FastedgeResource(self) + + @cached_property + def streaming(self) -> StreamingResource: + from .resources.streaming import StreamingResource + + return StreamingResource(self) + + @cached_property + def security(self) -> SecurityResource: + from .resources.security import SecurityResource + + return SecurityResource(self) + + @cached_property + def dns(self) -> DNSResource: + from .resources.dns import DNSResource + + return DNSResource(self) + + @cached_property + def storage(self) -> StorageResource: + from .resources.storage import StorageResource + + return StorageResource(self) + + @cached_property + def cdn(self) -> CdnResource: + from .resources.cdn import CdnResource + + return CdnResource(self) + + @cached_property + def with_raw_response(self) -> GcoreWithRawResponse: + return GcoreWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> GcoreWithStreamedResponse: + return GcoreWithStreamedResponse(self) @property @override @@ -279,18 +321,6 @@ def _make_status_error( class AsyncGcore(AsyncAPIClient): - cloud: cloud.AsyncCloudResource - waap: waap.AsyncWaapResource - iam: iam.AsyncIamResource - fastedge: fastedge.AsyncFastedgeResource - streaming: streaming.AsyncStreamingResource - security: security.AsyncSecurityResource - dns: dns.AsyncDNSResource - storage: storage.AsyncStorageResource - cdn: cdn.AsyncCdnResource - with_raw_response: AsyncGcoreWithRawResponse - with_streaming_response: AsyncGcoreWithStreamedResponse - # client options api_key: str cloud_project_id: int | None @@ -372,17 +402,67 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.cloud = cloud.AsyncCloudResource(self) - self.waap = waap.AsyncWaapResource(self) - self.iam = iam.AsyncIamResource(self) - self.fastedge = fastedge.AsyncFastedgeResource(self) - self.streaming = streaming.AsyncStreamingResource(self) - self.security = security.AsyncSecurityResource(self) - self.dns = dns.AsyncDNSResource(self) - self.storage = storage.AsyncStorageResource(self) - self.cdn = cdn.AsyncCdnResource(self) - self.with_raw_response = AsyncGcoreWithRawResponse(self) - self.with_streaming_response = AsyncGcoreWithStreamedResponse(self) + @cached_property + def cloud(self) -> AsyncCloudResource: + from .resources.cloud import AsyncCloudResource + + return AsyncCloudResource(self) + + @cached_property + def waap(self) -> AsyncWaapResource: + from .resources.waap import AsyncWaapResource + + return AsyncWaapResource(self) + + @cached_property + def iam(self) -> AsyncIamResource: + from .resources.iam import AsyncIamResource + + return AsyncIamResource(self) + + @cached_property + def fastedge(self) -> AsyncFastedgeResource: + from .resources.fastedge import AsyncFastedgeResource + + return AsyncFastedgeResource(self) + + @cached_property + def streaming(self) -> AsyncStreamingResource: + from .resources.streaming import AsyncStreamingResource + + return AsyncStreamingResource(self) + + @cached_property + def security(self) -> AsyncSecurityResource: + from .resources.security import AsyncSecurityResource + + return AsyncSecurityResource(self) + + @cached_property + def dns(self) -> AsyncDNSResource: + from .resources.dns import AsyncDNSResource + + return AsyncDNSResource(self) + + @cached_property + def storage(self) -> AsyncStorageResource: + from .resources.storage import AsyncStorageResource + + return AsyncStorageResource(self) + + @cached_property + def cdn(self) -> AsyncCdnResource: + from .resources.cdn import AsyncCdnResource + + return AsyncCdnResource(self) + + @cached_property + def with_raw_response(self) -> AsyncGcoreWithRawResponse: + return AsyncGcoreWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncGcoreWithStreamedResponse: + return AsyncGcoreWithStreamedResponse(self) @property @override @@ -516,55 +596,247 @@ def _make_status_error( class GcoreWithRawResponse: + _client: Gcore + def __init__(self, client: Gcore) -> None: - self.cloud = cloud.CloudResourceWithRawResponse(client.cloud) - self.waap = waap.WaapResourceWithRawResponse(client.waap) - self.iam = iam.IamResourceWithRawResponse(client.iam) - self.fastedge = fastedge.FastedgeResourceWithRawResponse(client.fastedge) - self.streaming = streaming.StreamingResourceWithRawResponse(client.streaming) - self.security = security.SecurityResourceWithRawResponse(client.security) - self.dns = dns.DNSResourceWithRawResponse(client.dns) - self.storage = storage.StorageResourceWithRawResponse(client.storage) - self.cdn = cdn.CdnResourceWithRawResponse(client.cdn) + self._client = client + + @cached_property + def cloud(self) -> cloud.CloudResourceWithRawResponse: + from .resources.cloud import CloudResourceWithRawResponse + + return CloudResourceWithRawResponse(self._client.cloud) + + @cached_property + def waap(self) -> waap.WaapResourceWithRawResponse: + from .resources.waap import WaapResourceWithRawResponse + + return WaapResourceWithRawResponse(self._client.waap) + + @cached_property + def iam(self) -> iam.IamResourceWithRawResponse: + from .resources.iam import IamResourceWithRawResponse + + return IamResourceWithRawResponse(self._client.iam) + + @cached_property + def fastedge(self) -> fastedge.FastedgeResourceWithRawResponse: + from .resources.fastedge import FastedgeResourceWithRawResponse + + return FastedgeResourceWithRawResponse(self._client.fastedge) + + @cached_property + def streaming(self) -> streaming.StreamingResourceWithRawResponse: + from .resources.streaming import StreamingResourceWithRawResponse + + return StreamingResourceWithRawResponse(self._client.streaming) + + @cached_property + def security(self) -> security.SecurityResourceWithRawResponse: + from .resources.security import SecurityResourceWithRawResponse + + return SecurityResourceWithRawResponse(self._client.security) + + @cached_property + def dns(self) -> dns.DNSResourceWithRawResponse: + from .resources.dns import DNSResourceWithRawResponse + + return DNSResourceWithRawResponse(self._client.dns) + + @cached_property + def storage(self) -> storage.StorageResourceWithRawResponse: + from .resources.storage import StorageResourceWithRawResponse + + return StorageResourceWithRawResponse(self._client.storage) + + @cached_property + def cdn(self) -> cdn.CdnResourceWithRawResponse: + from .resources.cdn import CdnResourceWithRawResponse + + return CdnResourceWithRawResponse(self._client.cdn) class AsyncGcoreWithRawResponse: + _client: AsyncGcore + def __init__(self, client: AsyncGcore) -> None: - self.cloud = cloud.AsyncCloudResourceWithRawResponse(client.cloud) - self.waap = waap.AsyncWaapResourceWithRawResponse(client.waap) - self.iam = iam.AsyncIamResourceWithRawResponse(client.iam) - self.fastedge = fastedge.AsyncFastedgeResourceWithRawResponse(client.fastedge) - self.streaming = streaming.AsyncStreamingResourceWithRawResponse(client.streaming) - self.security = security.AsyncSecurityResourceWithRawResponse(client.security) - self.dns = dns.AsyncDNSResourceWithRawResponse(client.dns) - self.storage = storage.AsyncStorageResourceWithRawResponse(client.storage) - self.cdn = cdn.AsyncCdnResourceWithRawResponse(client.cdn) + self._client = client + + @cached_property + def cloud(self) -> cloud.AsyncCloudResourceWithRawResponse: + from .resources.cloud import AsyncCloudResourceWithRawResponse + + return AsyncCloudResourceWithRawResponse(self._client.cloud) + + @cached_property + def waap(self) -> waap.AsyncWaapResourceWithRawResponse: + from .resources.waap import AsyncWaapResourceWithRawResponse + + return AsyncWaapResourceWithRawResponse(self._client.waap) + + @cached_property + def iam(self) -> iam.AsyncIamResourceWithRawResponse: + from .resources.iam import AsyncIamResourceWithRawResponse + + return AsyncIamResourceWithRawResponse(self._client.iam) + + @cached_property + def fastedge(self) -> fastedge.AsyncFastedgeResourceWithRawResponse: + from .resources.fastedge import AsyncFastedgeResourceWithRawResponse + + return AsyncFastedgeResourceWithRawResponse(self._client.fastedge) + + @cached_property + def streaming(self) -> streaming.AsyncStreamingResourceWithRawResponse: + from .resources.streaming import AsyncStreamingResourceWithRawResponse + + return AsyncStreamingResourceWithRawResponse(self._client.streaming) + + @cached_property + def security(self) -> security.AsyncSecurityResourceWithRawResponse: + from .resources.security import AsyncSecurityResourceWithRawResponse + + return AsyncSecurityResourceWithRawResponse(self._client.security) + + @cached_property + def dns(self) -> dns.AsyncDNSResourceWithRawResponse: + from .resources.dns import AsyncDNSResourceWithRawResponse + + return AsyncDNSResourceWithRawResponse(self._client.dns) + + @cached_property + def storage(self) -> storage.AsyncStorageResourceWithRawResponse: + from .resources.storage import AsyncStorageResourceWithRawResponse + + return AsyncStorageResourceWithRawResponse(self._client.storage) + + @cached_property + def cdn(self) -> cdn.AsyncCdnResourceWithRawResponse: + from .resources.cdn import AsyncCdnResourceWithRawResponse + + return AsyncCdnResourceWithRawResponse(self._client.cdn) class GcoreWithStreamedResponse: + _client: Gcore + def __init__(self, client: Gcore) -> None: - self.cloud = cloud.CloudResourceWithStreamingResponse(client.cloud) - self.waap = waap.WaapResourceWithStreamingResponse(client.waap) - self.iam = iam.IamResourceWithStreamingResponse(client.iam) - self.fastedge = fastedge.FastedgeResourceWithStreamingResponse(client.fastedge) - self.streaming = streaming.StreamingResourceWithStreamingResponse(client.streaming) - self.security = security.SecurityResourceWithStreamingResponse(client.security) - self.dns = dns.DNSResourceWithStreamingResponse(client.dns) - self.storage = storage.StorageResourceWithStreamingResponse(client.storage) - self.cdn = cdn.CdnResourceWithStreamingResponse(client.cdn) + self._client = client + + @cached_property + def cloud(self) -> cloud.CloudResourceWithStreamingResponse: + from .resources.cloud import CloudResourceWithStreamingResponse + + return CloudResourceWithStreamingResponse(self._client.cloud) + + @cached_property + def waap(self) -> waap.WaapResourceWithStreamingResponse: + from .resources.waap import WaapResourceWithStreamingResponse + + return WaapResourceWithStreamingResponse(self._client.waap) + + @cached_property + def iam(self) -> iam.IamResourceWithStreamingResponse: + from .resources.iam import IamResourceWithStreamingResponse + + return IamResourceWithStreamingResponse(self._client.iam) + + @cached_property + def fastedge(self) -> fastedge.FastedgeResourceWithStreamingResponse: + from .resources.fastedge import FastedgeResourceWithStreamingResponse + + return FastedgeResourceWithStreamingResponse(self._client.fastedge) + + @cached_property + def streaming(self) -> streaming.StreamingResourceWithStreamingResponse: + from .resources.streaming import StreamingResourceWithStreamingResponse + + return StreamingResourceWithStreamingResponse(self._client.streaming) + + @cached_property + def security(self) -> security.SecurityResourceWithStreamingResponse: + from .resources.security import SecurityResourceWithStreamingResponse + + return SecurityResourceWithStreamingResponse(self._client.security) + + @cached_property + def dns(self) -> dns.DNSResourceWithStreamingResponse: + from .resources.dns import DNSResourceWithStreamingResponse + + return DNSResourceWithStreamingResponse(self._client.dns) + + @cached_property + def storage(self) -> storage.StorageResourceWithStreamingResponse: + from .resources.storage import StorageResourceWithStreamingResponse + + return StorageResourceWithStreamingResponse(self._client.storage) + + @cached_property + def cdn(self) -> cdn.CdnResourceWithStreamingResponse: + from .resources.cdn import CdnResourceWithStreamingResponse + + return CdnResourceWithStreamingResponse(self._client.cdn) class AsyncGcoreWithStreamedResponse: + _client: AsyncGcore + def __init__(self, client: AsyncGcore) -> None: - self.cloud = cloud.AsyncCloudResourceWithStreamingResponse(client.cloud) - self.waap = waap.AsyncWaapResourceWithStreamingResponse(client.waap) - self.iam = iam.AsyncIamResourceWithStreamingResponse(client.iam) - self.fastedge = fastedge.AsyncFastedgeResourceWithStreamingResponse(client.fastedge) - self.streaming = streaming.AsyncStreamingResourceWithStreamingResponse(client.streaming) - self.security = security.AsyncSecurityResourceWithStreamingResponse(client.security) - self.dns = dns.AsyncDNSResourceWithStreamingResponse(client.dns) - self.storage = storage.AsyncStorageResourceWithStreamingResponse(client.storage) - self.cdn = cdn.AsyncCdnResourceWithStreamingResponse(client.cdn) + self._client = client + + @cached_property + def cloud(self) -> cloud.AsyncCloudResourceWithStreamingResponse: + from .resources.cloud import AsyncCloudResourceWithStreamingResponse + + return AsyncCloudResourceWithStreamingResponse(self._client.cloud) + + @cached_property + def waap(self) -> waap.AsyncWaapResourceWithStreamingResponse: + from .resources.waap import AsyncWaapResourceWithStreamingResponse + + return AsyncWaapResourceWithStreamingResponse(self._client.waap) + + @cached_property + def iam(self) -> iam.AsyncIamResourceWithStreamingResponse: + from .resources.iam import AsyncIamResourceWithStreamingResponse + + return AsyncIamResourceWithStreamingResponse(self._client.iam) + + @cached_property + def fastedge(self) -> fastedge.AsyncFastedgeResourceWithStreamingResponse: + from .resources.fastedge import AsyncFastedgeResourceWithStreamingResponse + + return AsyncFastedgeResourceWithStreamingResponse(self._client.fastedge) + + @cached_property + def streaming(self) -> streaming.AsyncStreamingResourceWithStreamingResponse: + from .resources.streaming import AsyncStreamingResourceWithStreamingResponse + + return AsyncStreamingResourceWithStreamingResponse(self._client.streaming) + + @cached_property + def security(self) -> security.AsyncSecurityResourceWithStreamingResponse: + from .resources.security import AsyncSecurityResourceWithStreamingResponse + + return AsyncSecurityResourceWithStreamingResponse(self._client.security) + + @cached_property + def dns(self) -> dns.AsyncDNSResourceWithStreamingResponse: + from .resources.dns import AsyncDNSResourceWithStreamingResponse + + return AsyncDNSResourceWithStreamingResponse(self._client.dns) + + @cached_property + def storage(self) -> storage.AsyncStorageResourceWithStreamingResponse: + from .resources.storage import AsyncStorageResourceWithStreamingResponse + + return AsyncStorageResourceWithStreamingResponse(self._client.storage) + + @cached_property + def cdn(self) -> cdn.AsyncCdnResourceWithStreamingResponse: + from .resources.cdn import AsyncCdnResourceWithStreamingResponse + + return AsyncCdnResourceWithStreamingResponse(self._client.cdn) Client = Gcore diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py index c8aaa6a7..fd8019a9 100644 --- a/src/gcore/resources/__init__.py +++ b/src/gcore/resources/__init__.py @@ -1,131 +1 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .cdn import ( - CdnResource, - AsyncCdnResource, - CdnResourceWithRawResponse, - AsyncCdnResourceWithRawResponse, - CdnResourceWithStreamingResponse, - AsyncCdnResourceWithStreamingResponse, -) -from .dns import ( - DNSResource, - AsyncDNSResource, - DNSResourceWithRawResponse, - AsyncDNSResourceWithRawResponse, - DNSResourceWithStreamingResponse, - AsyncDNSResourceWithStreamingResponse, -) -from .iam import ( - IamResource, - AsyncIamResource, - IamResourceWithRawResponse, - AsyncIamResourceWithRawResponse, - IamResourceWithStreamingResponse, - AsyncIamResourceWithStreamingResponse, -) -from .waap import ( - WaapResource, - AsyncWaapResource, - WaapResourceWithRawResponse, - AsyncWaapResourceWithRawResponse, - WaapResourceWithStreamingResponse, - AsyncWaapResourceWithStreamingResponse, -) -from .cloud import ( - CloudResource, - AsyncCloudResource, - CloudResourceWithRawResponse, - AsyncCloudResourceWithRawResponse, - CloudResourceWithStreamingResponse, - AsyncCloudResourceWithStreamingResponse, -) -from .storage import ( - StorageResource, - AsyncStorageResource, - StorageResourceWithRawResponse, - AsyncStorageResourceWithRawResponse, - StorageResourceWithStreamingResponse, - AsyncStorageResourceWithStreamingResponse, -) -from .fastedge import ( - FastedgeResource, - AsyncFastedgeResource, - FastedgeResourceWithRawResponse, - AsyncFastedgeResourceWithRawResponse, - FastedgeResourceWithStreamingResponse, - AsyncFastedgeResourceWithStreamingResponse, -) -from .security import ( - SecurityResource, - AsyncSecurityResource, - SecurityResourceWithRawResponse, - AsyncSecurityResourceWithRawResponse, - SecurityResourceWithStreamingResponse, - AsyncSecurityResourceWithStreamingResponse, -) -from .streaming import ( - StreamingResource, - AsyncStreamingResource, - StreamingResourceWithRawResponse, - AsyncStreamingResourceWithRawResponse, - StreamingResourceWithStreamingResponse, - AsyncStreamingResourceWithStreamingResponse, -) - -__all__ = [ - "CloudResource", - "AsyncCloudResource", - "CloudResourceWithRawResponse", - "AsyncCloudResourceWithRawResponse", - "CloudResourceWithStreamingResponse", - "AsyncCloudResourceWithStreamingResponse", - "WaapResource", - "AsyncWaapResource", - "WaapResourceWithRawResponse", - "AsyncWaapResourceWithRawResponse", - "WaapResourceWithStreamingResponse", - "AsyncWaapResourceWithStreamingResponse", - "IamResource", - "AsyncIamResource", - "IamResourceWithRawResponse", - "AsyncIamResourceWithRawResponse", - "IamResourceWithStreamingResponse", - "AsyncIamResourceWithStreamingResponse", - "FastedgeResource", - "AsyncFastedgeResource", - "FastedgeResourceWithRawResponse", - "AsyncFastedgeResourceWithRawResponse", - "FastedgeResourceWithStreamingResponse", - "AsyncFastedgeResourceWithStreamingResponse", - "StreamingResource", - "AsyncStreamingResource", - "StreamingResourceWithRawResponse", - "AsyncStreamingResourceWithRawResponse", - "StreamingResourceWithStreamingResponse", - "AsyncStreamingResourceWithStreamingResponse", - "SecurityResource", - "AsyncSecurityResource", - "SecurityResourceWithRawResponse", - "AsyncSecurityResourceWithRawResponse", - "SecurityResourceWithStreamingResponse", - "AsyncSecurityResourceWithStreamingResponse", - "DNSResource", - "AsyncDNSResource", - "DNSResourceWithRawResponse", - "AsyncDNSResourceWithRawResponse", - "DNSResourceWithStreamingResponse", - "AsyncDNSResourceWithStreamingResponse", - "StorageResource", - "AsyncStorageResource", - "StorageResourceWithRawResponse", - "AsyncStorageResourceWithRawResponse", - "StorageResourceWithStreamingResponse", - "AsyncStorageResourceWithStreamingResponse", - "CdnResource", - "AsyncCdnResource", - "CdnResourceWithRawResponse", - "AsyncCdnResourceWithRawResponse", - "CdnResourceWithStreamingResponse", - "AsyncCdnResourceWithStreamingResponse", -] From 7ee49b870d73133bd4a16f9686297e405bfaeaac Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 17 Dec 2025 10:11:29 +0000 Subject: [PATCH 489/592] feat(api): aggregated API specs update --- .stats.yml | 4 +-- api.md | 2 +- src/gcore/resources/dns/network_mappings.py | 16 +++------ src/gcore/types/dns/dns_mapping_entry.py | 4 +-- .../types/dns/dns_mapping_entry_param.py | 5 ++- .../dns/network_mapping_create_params.py | 2 -- .../dns/network_mapping_replace_params.py | 5 +-- .../dns/test_network_mappings.py | 36 +++++++++---------- 8 files changed, 28 insertions(+), 46 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1628a0a6..cf556c22 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d3062187985fbeaf2d7852a622344a75a8a87e0e941743194c44f74ee0222dbb.yml -openapi_spec_hash: 01b0048f185d3ceb84fe75a52a27afc8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-26212428643e136f317e84302b933a8f4c65f88cc78c254ed40ad1c0793341f2.yml +openapi_spec_hash: 6907d8b360bddcbc5adaef5054eab10e config_hash: c6c8ef25ca05ecd4082810d4afd564cf diff --git a/api.md b/api.md index f54b05d3..41beddd2 100644 --- a/api.md +++ b/api.md @@ -2156,7 +2156,7 @@ Methods: - client.dns.network_mappings.get(id) -> DNSNetworkMapping - client.dns.network_mappings.get_by_name(name) -> DNSNetworkMapping - client.dns.network*mappings.import*() -> NetworkMappingImportResponse -- client.dns.network_mappings.replace(path_id, \*\*params) -> object +- client.dns.network_mappings.replace(id, \*\*params) -> object # Storage diff --git a/src/gcore/resources/dns/network_mappings.py b/src/gcore/resources/dns/network_mappings.py index 1292d320..1feb1047 100644 --- a/src/gcore/resources/dns/network_mappings.py +++ b/src/gcore/resources/dns/network_mappings.py @@ -51,7 +51,6 @@ def with_streaming_response(self) -> NetworkMappingsResourceWithStreamingRespons def create( self, *, - id: int | Omit = omit, mapping: Iterable[DNSMappingEntryParam] | Omit = omit, name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -112,7 +111,6 @@ def create( "/dns/v2/network-mappings", body=maybe_transform( { - "id": id, "mapping": mapping, "name": name, }, @@ -388,9 +386,8 @@ def import_( def replace( self, - path_id: int, + id: int, *, - body_id: int | Omit = omit, mapping: Iterable[DNSMappingEntryParam] | Omit = omit, name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -446,10 +443,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/dns/v2/network-mappings/{path_id}", + f"/dns/v2/network-mappings/{id}", body=maybe_transform( { - "body_id": body_id, "mapping": mapping, "name": name, }, @@ -485,7 +481,6 @@ def with_streaming_response(self) -> AsyncNetworkMappingsResourceWithStreamingRe async def create( self, *, - id: int | Omit = omit, mapping: Iterable[DNSMappingEntryParam] | Omit = omit, name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -546,7 +541,6 @@ async def create( "/dns/v2/network-mappings", body=await async_maybe_transform( { - "id": id, "mapping": mapping, "name": name, }, @@ -822,9 +816,8 @@ async def import_( async def replace( self, - path_id: int, + id: int, *, - body_id: int | Omit = omit, mapping: Iterable[DNSMappingEntryParam] | Omit = omit, name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -880,10 +873,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/dns/v2/network-mappings/{path_id}", + f"/dns/v2/network-mappings/{id}", body=await async_maybe_transform( { - "body_id": body_id, "mapping": mapping, "name": name, }, diff --git a/src/gcore/types/dns/dns_mapping_entry.py b/src/gcore/types/dns/dns_mapping_entry.py index 8f96c644..5d8db17c 100644 --- a/src/gcore/types/dns/dns_mapping_entry.py +++ b/src/gcore/types/dns/dns_mapping_entry.py @@ -8,8 +8,8 @@ class DNSMappingEntry(BaseModel): - cidr4: Optional[List[object]] = None + cidr4: Optional[List[str]] = None - cidr6: Optional[List[object]] = None + cidr6: Optional[List[str]] = None tags: Optional[List[str]] = None diff --git a/src/gcore/types/dns/dns_mapping_entry_param.py b/src/gcore/types/dns/dns_mapping_entry_param.py index 67942c37..d6504b98 100644 --- a/src/gcore/types/dns/dns_mapping_entry_param.py +++ b/src/gcore/types/dns/dns_mapping_entry_param.py @@ -2,7 +2,6 @@ from __future__ import annotations -from typing import Iterable from typing_extensions import TypedDict from ..._types import SequenceNotStr @@ -11,8 +10,8 @@ class DNSMappingEntryParam(TypedDict, total=False): - cidr4: Iterable[object] + cidr4: SequenceNotStr[str] - cidr6: Iterable[object] + cidr6: SequenceNotStr[str] tags: SequenceNotStr[str] diff --git a/src/gcore/types/dns/network_mapping_create_params.py b/src/gcore/types/dns/network_mapping_create_params.py index 2b82ed34..d670478a 100644 --- a/src/gcore/types/dns/network_mapping_create_params.py +++ b/src/gcore/types/dns/network_mapping_create_params.py @@ -11,8 +11,6 @@ class NetworkMappingCreateParams(TypedDict, total=False): - id: int - mapping: Iterable[DNSMappingEntryParam] name: str diff --git a/src/gcore/types/dns/network_mapping_replace_params.py b/src/gcore/types/dns/network_mapping_replace_params.py index cb10d570..7e7d7b2e 100644 --- a/src/gcore/types/dns/network_mapping_replace_params.py +++ b/src/gcore/types/dns/network_mapping_replace_params.py @@ -3,17 +3,14 @@ from __future__ import annotations from typing import Iterable -from typing_extensions import Annotated, TypedDict +from typing_extensions import TypedDict -from ..._utils import PropertyInfo from .dns_mapping_entry_param import DNSMappingEntryParam __all__ = ["NetworkMappingReplaceParams"] class NetworkMappingReplaceParams(TypedDict, total=False): - body_id: Annotated[int, PropertyInfo(alias="id")] - mapping: Iterable[DNSMappingEntryParam] name: str diff --git a/tests/api_resources/dns/test_network_mappings.py b/tests/api_resources/dns/test_network_mappings.py index 7f7e164a..158a3f7b 100644 --- a/tests/api_resources/dns/test_network_mappings.py +++ b/tests/api_resources/dns/test_network_mappings.py @@ -30,11 +30,10 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: network_mapping = client.dns.network_mappings.create( - id=0, mapping=[ { - "cidr4": [{}], - "cidr6": [{}], + "cidr4": ["string"], + "cidr6": ["string"], "tags": ["string"], } ], @@ -225,19 +224,18 @@ def test_streaming_response_import(self, client: Gcore) -> None: @parametrize def test_method_replace(self, client: Gcore) -> None: network_mapping = client.dns.network_mappings.replace( - path_id=0, + id=0, ) assert_matches_type(object, network_mapping, path=["response"]) @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: network_mapping = client.dns.network_mappings.replace( - path_id=0, - body_id=0, + id=0, mapping=[ { - "cidr4": [{}], - "cidr6": [{}], + "cidr4": ["string"], + "cidr6": ["string"], "tags": ["string"], } ], @@ -248,7 +246,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_replace(self, client: Gcore) -> None: response = client.dns.network_mappings.with_raw_response.replace( - path_id=0, + id=0, ) assert response.is_closed is True @@ -259,7 +257,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: with client.dns.network_mappings.with_streaming_response.replace( - path_id=0, + id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -283,11 +281,10 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: network_mapping = await async_client.dns.network_mappings.create( - id=0, mapping=[ { - "cidr4": [{}], - "cidr6": [{}], + "cidr4": ["string"], + "cidr6": ["string"], "tags": ["string"], } ], @@ -478,19 +475,18 @@ async def test_streaming_response_import(self, async_client: AsyncGcore) -> None @parametrize async def test_method_replace(self, async_client: AsyncGcore) -> None: network_mapping = await async_client.dns.network_mappings.replace( - path_id=0, + id=0, ) assert_matches_type(object, network_mapping, path=["response"]) @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: network_mapping = await async_client.dns.network_mappings.replace( - path_id=0, - body_id=0, + id=0, mapping=[ { - "cidr4": [{}], - "cidr6": [{}], + "cidr4": ["string"], + "cidr6": ["string"], "tags": ["string"], } ], @@ -501,7 +497,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: response = await async_client.dns.network_mappings.with_raw_response.replace( - path_id=0, + id=0, ) assert response.is_closed is True @@ -512,7 +508,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: async with async_client.dns.network_mappings.with_streaming_response.replace( - path_id=0, + id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From ae9b826ba071f052d38ababb3a2c406d2a9d14f8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 17 Dec 2025 15:48:39 +0000 Subject: [PATCH 490/592] fix: use async_to_httpx_files in patch method --- src/gcore/_base_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index dbb20c58..56aeddf3 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -1774,7 +1774,7 @@ async def patch( options: RequestOptions = {}, ) -> ResponseT: opts = FinalRequestOptions.construct( - method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + method="patch", url=path, json_data=body, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts) From 33b990c8fe938606f1c18d03fe9de7e06b96b56b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Dec 2025 14:11:46 +0000 Subject: [PATCH 491/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- .../resources/cloud/load_balancers/listeners.py | 12 ++++++++++-- src/gcore/types/cloud/gpu_baremetal_cluster.py | 3 +++ .../cloud/load_balancers/listener_create_params.py | 5 ++++- .../cloud/load_balancers/test_listeners.py | 2 ++ 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index cf556c22..8dc34720 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-26212428643e136f317e84302b933a8f4c65f88cc78c254ed40ad1c0793341f2.yml -openapi_spec_hash: 6907d8b360bddcbc5adaef5054eab10e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2c3abe1f1637f97f6bc750aff6eb77efc45ac2b527376541ac2af6b9626b35af.yml +openapi_spec_hash: ff74a4ccd9ec5ddb1a65963d52e709ba config_hash: c6c8ef25ca05ecd4082810d4afd564cf diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 907744a0..5f82baad 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -64,6 +64,7 @@ def create( protocol_port: int, allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, connection_limit: int | Omit = omit, + default_pool_id: str | Omit = omit, insert_x_forwarded: bool | Omit = omit, secret_id: str | Omit = omit, sni_secret_id: SequenceNotStr[str] | Omit = omit, @@ -86,7 +87,7 @@ def create( region_id: Region ID - load_balancer_id: Load balancer ID + load_balancer_id: ID of already existent Load Balancer. name: Load balancer listener name @@ -99,6 +100,8 @@ def create( connection_limit: Limit of the simultaneous connections. If -1 is provided, it is translated to the default value 100000. + default_pool_id: ID of already existent Load Balancer Pool to attach listener to. + insert_x_forwarded: Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. Only used with HTTP or `TERMINATED_HTTPS` protocols. @@ -138,6 +141,7 @@ def create( "protocol_port": protocol_port, "allowed_cidrs": allowed_cidrs, "connection_limit": connection_limit, + "default_pool_id": default_pool_id, "insert_x_forwarded": insert_x_forwarded, "secret_id": secret_id, "sni_secret_id": sni_secret_id, @@ -437,6 +441,7 @@ async def create( protocol_port: int, allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, connection_limit: int | Omit = omit, + default_pool_id: str | Omit = omit, insert_x_forwarded: bool | Omit = omit, secret_id: str | Omit = omit, sni_secret_id: SequenceNotStr[str] | Omit = omit, @@ -459,7 +464,7 @@ async def create( region_id: Region ID - load_balancer_id: Load balancer ID + load_balancer_id: ID of already existent Load Balancer. name: Load balancer listener name @@ -472,6 +477,8 @@ async def create( connection_limit: Limit of the simultaneous connections. If -1 is provided, it is translated to the default value 100000. + default_pool_id: ID of already existent Load Balancer Pool to attach listener to. + insert_x_forwarded: Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. Only used with HTTP or `TERMINATED_HTTPS` protocols. @@ -511,6 +518,7 @@ async def create( "protocol_port": protocol_port, "allowed_cidrs": allowed_cidrs, "connection_limit": connection_limit, + "default_pool_id": default_pool_id, "insert_x_forwarded": insert_x_forwarded, "secret_id": secret_id, "sni_secret_id": sni_secret_id, diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal_cluster.py index 85bc978c..bfbdff15 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster.py @@ -131,6 +131,9 @@ class GPUBaremetalCluster(BaseModel): flavor: str """Cluster flavor name""" + image_id: str + """Image ID""" + managed_by: Literal["k8s", "user"] """User type managing the resource""" diff --git a/src/gcore/types/cloud/load_balancers/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py index 9850d348..8dc00324 100644 --- a/src/gcore/types/cloud/load_balancers/listener_create_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -19,7 +19,7 @@ class ListenerCreateParams(TypedDict, total=False): """Region ID""" load_balancer_id: Required[str] - """Load balancer ID""" + """ID of already existent Load Balancer.""" name: Required[str] """Load balancer listener name""" @@ -39,6 +39,9 @@ class ListenerCreateParams(TypedDict, total=False): If -1 is provided, it is translated to the default value 100000. """ + default_pool_id: str + """ID of already existent Load Balancer Pool to attach listener to.""" + insert_x_forwarded: bool """Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index 628a84f8..2e098f0f 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -40,6 +40,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: protocol_port=80, allowed_cidrs=["10.0.0.0/8"], connection_limit=100000, + default_pool_id="00000000-0000-4000-8000-000000000000", insert_x_forwarded=False, secret_id="f2e734d0-fa2b-42c2-ad33-4c6db5101e00", sni_secret_id=["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], @@ -343,6 +344,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> protocol_port=80, allowed_cidrs=["10.0.0.0/8"], connection_limit=100000, + default_pool_id="00000000-0000-4000-8000-000000000000", insert_x_forwarded=False, secret_id="f2e734d0-fa2b-42c2-ad33-4c6db5101e00", sni_secret_id=["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], From 592f3f4c105c3d091dc2799f738fc1afabbc8fba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Dec 2025 22:24:18 +0000 Subject: [PATCH 492/592] chore(internal): codegen related update --- scripts/lint | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/lint b/scripts/lint index 3bb2d385..1d30512d 100755 --- a/scripts/lint +++ b/scripts/lint @@ -4,8 +4,13 @@ set -e cd "$(dirname "$0")/.." -echo "==> Running lints" -rye run lint +if [ "$1" = "--fix" ]; then + echo "==> Running lints with --fix" + rye run fix:ruff +else + echo "==> Running lints" + rye run lint +fi echo "==> Making sure it imports" rye run python -c 'import gcore' From 4c322720e95bcea56fefec2bb2c1254cf6b91ba6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 10:54:44 +0000 Subject: [PATCH 493/592] fix(cloud)!: restructure to be gpu_virtual.clusters --- .stats.yml | 2 +- api.md | 54 +-- src/gcore/resources/cloud/__init__.py | 28 +- src/gcore/resources/cloud/cloud.py | 40 +- .../resources/cloud/gpu_virtual/__init__.py | 33 ++ .../clusters}/__init__.py | 28 +- .../clusters/clusters.py} | 192 ++++---- .../clusters}/flavors.py | 16 +- .../clusters}/images.py | 20 +- .../clusters}/interfaces.py | 12 +- .../clusters}/servers.py | 18 +- .../clusters}/volumes.py | 12 +- .../cloud/gpu_virtual/gpu_virtual.py | 102 +++++ src/gcore/types/cloud/__init__.py | 6 - src/gcore/types/cloud/gpu_virtual/__init__.py | 10 + .../cluster_action_params.py} | 6 +- .../cluster_create_params.py} | 4 +- .../cluster_delete_params.py} | 6 +- .../cluster_list_params.py} | 4 +- .../cluster_update_params.py} | 4 +- .../clusters}/__init__.py | 0 .../clusters}/flavor_list_params.py | 0 .../clusters}/gpu_virtual_cluster_server.py | 4 +- .../gpu_virtual_cluster_server_list.py | 2 +- .../clusters}/gpu_virtual_cluster_volume.py | 4 +- .../gpu_virtual_cluster_volume_list.py | 2 +- .../clusters}/gpu_virtual_flavor.py | 2 +- .../clusters}/gpu_virtual_flavor_list.py | 2 +- .../clusters}/gpu_virtual_interface.py | 10 +- .../clusters}/gpu_virtual_interface_list.py | 2 +- .../clusters}/image_upload_params.py | 0 .../clusters}/server_delete_params.py | 2 +- .../clusters}/server_list_params.py | 4 +- .../{ => gpu_virtual}/gpu_virtual_cluster.py | 6 +- .../__init__.py | 0 .../cloud/gpu_virtual/clusters/__init__.py | 1 + .../clusters}/test_flavors.py | 18 +- .../clusters}/test_images.py | 60 +-- .../clusters}/test_interfaces.py | 18 +- .../clusters}/test_servers.py | 46 +- .../clusters}/test_volumes.py | 18 +- .../test_clusters.py} | 420 +++++++++--------- 42 files changed, 679 insertions(+), 539 deletions(-) create mode 100644 src/gcore/resources/cloud/gpu_virtual/__init__.py rename src/gcore/resources/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/__init__.py (80%) rename src/gcore/resources/cloud/{gpu_virtual_clusters/gpu_virtual_clusters.py => gpu_virtual/clusters/clusters.py} (89%) rename src/gcore/resources/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/flavors.py (93%) rename src/gcore/resources/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/images.py (97%) rename src/gcore/resources/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/interfaces.py (95%) rename src/gcore/resources/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/servers.py (96%) rename src/gcore/resources/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/volumes.py (94%) create mode 100644 src/gcore/resources/cloud/gpu_virtual/gpu_virtual.py create mode 100644 src/gcore/types/cloud/gpu_virtual/__init__.py rename src/gcore/types/cloud/{gpu_virtual_cluster_action_params.py => gpu_virtual/cluster_action_params.py} (95%) rename src/gcore/types/cloud/{gpu_virtual_cluster_create_params.py => gpu_virtual/cluster_create_params.py} (98%) rename src/gcore/types/cloud/{gpu_virtual_cluster_delete_params.py => gpu_virtual/cluster_delete_params.py} (86%) rename src/gcore/types/cloud/{gpu_virtual_cluster_list_params.py => gpu_virtual/cluster_list_params.py} (77%) rename src/gcore/types/cloud/{gpu_virtual_cluster_update_params.py => gpu_virtual/cluster_update_params.py} (74%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/__init__.py (100%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/flavor_list_params.py (100%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/gpu_virtual_cluster_server.py (96%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/gpu_virtual_cluster_server_list.py (91%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/gpu_virtual_cluster_volume.py (95%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/gpu_virtual_cluster_volume_list.py (91%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/gpu_virtual_flavor.py (99%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/gpu_virtual_flavor_list.py (90%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/gpu_virtual_interface.py (96%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/gpu_virtual_interface_list.py (90%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/image_upload_params.py (100%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/server_delete_params.py (96%) rename src/gcore/types/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/server_list_params.py (96%) rename src/gcore/types/cloud/{ => gpu_virtual}/gpu_virtual_cluster.py (98%) rename tests/api_resources/cloud/{gpu_virtual_clusters => gpu_virtual}/__init__.py (100%) create mode 100644 tests/api_resources/cloud/gpu_virtual/clusters/__init__.py rename tests/api_resources/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/test_flavors.py (86%) rename tests/api_resources/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/test_images.py (87%) rename tests/api_resources/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/test_interfaces.py (87%) rename tests/api_resources/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/test_servers.py (88%) rename tests/api_resources/cloud/{gpu_virtual_clusters => gpu_virtual/clusters}/test_volumes.py (87%) rename tests/api_resources/cloud/{test_gpu_virtual_clusters.py => gpu_virtual/test_clusters.py} (73%) diff --git a/.stats.yml b/.stats.yml index 8dc34720..fc3e8dc4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2c3abe1f1637f97f6bc750aff6eb77efc45ac2b527376541ac2af6b9626b35af.yml openapi_spec_hash: ff74a4ccd9ec5ddb1a65963d52e709ba -config_hash: c6c8ef25ca05ecd4082810d4afd564cf +config_hash: e76c698a64f32a4f2b33e2099e771d83 diff --git a/api.md b/api.md index 41beddd2..bc132d4d 100644 --- a/api.md +++ b/api.md @@ -842,29 +842,31 @@ Methods: - client.cloud.gpu_baremetal_clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage - client.cloud.gpu_baremetal_clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList -## GPUVirtualClusters +## GPUVirtual + +### Clusters Types: ```python -from gcore.types.cloud import GPUVirtualCluster +from gcore.types.cloud.gpu_virtual import GPUVirtualCluster ``` Methods: -- client.cloud.gpu_virtual_clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_virtual_clusters.update(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualCluster -- client.cloud.gpu_virtual_clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUVirtualCluster] -- client.cloud.gpu_virtual_clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_virtual_clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_virtual_clusters.get(cluster_id, \*, project_id, region_id) -> GPUVirtualCluster +- client.cloud.gpu_virtual.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.update(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualCluster +- client.cloud.gpu_virtual.clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUVirtualCluster] +- client.cloud.gpu_virtual.clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.get(cluster_id, \*, project_id, region_id) -> GPUVirtualCluster -### Servers +#### Servers Types: ```python -from gcore.types.cloud.gpu_virtual_clusters import ( +from gcore.types.cloud.gpu_virtual.clusters import ( GPUVirtualClusterServer, GPUVirtualClusterServerList, ) @@ -872,15 +874,15 @@ from gcore.types.cloud.gpu_virtual_clusters import ( Methods: -- client.cloud.gpu_virtual_clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualClusterServerList -- client.cloud.gpu_virtual_clusters.servers.delete(server_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualClusterServerList +- client.cloud.gpu_virtual.clusters.servers.delete(server_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList -### Volumes +#### Volumes Types: ```python -from gcore.types.cloud.gpu_virtual_clusters import ( +from gcore.types.cloud.gpu_virtual.clusters import ( GPUVirtualClusterVolume, GPUVirtualClusterVolumeList, ) @@ -888,40 +890,40 @@ from gcore.types.cloud.gpu_virtual_clusters import ( Methods: -- client.cloud.gpu_virtual_clusters.volumes.list(cluster_id, \*, project_id, region_id) -> GPUVirtualClusterVolumeList +- client.cloud.gpu_virtual.clusters.volumes.list(cluster_id, \*, project_id, region_id) -> GPUVirtualClusterVolumeList -### Interfaces +#### Interfaces Types: ```python -from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualInterface, GPUVirtualInterfaceList +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualInterface, GPUVirtualInterfaceList ``` Methods: -- client.cloud.gpu_virtual_clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> GPUVirtualInterfaceList +- client.cloud.gpu_virtual.clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> GPUVirtualInterfaceList -### Flavors +#### Flavors Types: ```python -from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualFlavor, GPUVirtualFlavorList +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualFlavor, GPUVirtualFlavorList ``` Methods: -- client.cloud.gpu_virtual_clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUVirtualFlavorList +- client.cloud.gpu_virtual.clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUVirtualFlavorList -### Images +#### Images Methods: -- client.cloud.gpu_virtual_clusters.images.list(\*, project_id, region_id) -> GPUImageList -- client.cloud.gpu_virtual_clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.gpu_virtual_clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage -- client.cloud.gpu_virtual_clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.images.list(\*, project_id, region_id) -> GPUImageList +- client.cloud.gpu_virtual.clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.gpu_virtual.clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage +- client.cloud.gpu_virtual.clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList ## Instances diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index aa77fd72..e4c125cc 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -152,6 +152,14 @@ FileSharesResourceWithStreamingResponse, AsyncFileSharesResourceWithStreamingResponse, ) +from .gpu_virtual import ( + GPUVirtualResource, + AsyncGPUVirtualResource, + GPUVirtualResourceWithRawResponse, + AsyncGPUVirtualResourceWithRawResponse, + GPUVirtualResourceWithStreamingResponse, + AsyncGPUVirtualResourceWithStreamingResponse, +) from .cost_reports import ( CostReportsResource, AsyncCostReportsResource, @@ -216,14 +224,6 @@ BillingReservationsResourceWithStreamingResponse, AsyncBillingReservationsResourceWithStreamingResponse, ) -from .gpu_virtual_clusters import ( - GPUVirtualClustersResource, - AsyncGPUVirtualClustersResource, - GPUVirtualClustersResourceWithRawResponse, - AsyncGPUVirtualClustersResourceWithRawResponse, - GPUVirtualClustersResourceWithStreamingResponse, - AsyncGPUVirtualClustersResourceWithStreamingResponse, -) from .gpu_baremetal_clusters import ( GPUBaremetalClustersResource, AsyncGPUBaremetalClustersResource, @@ -360,12 +360,12 @@ "AsyncGPUBaremetalClustersResourceWithRawResponse", "GPUBaremetalClustersResourceWithStreamingResponse", "AsyncGPUBaremetalClustersResourceWithStreamingResponse", - "GPUVirtualClustersResource", - "AsyncGPUVirtualClustersResource", - "GPUVirtualClustersResourceWithRawResponse", - "AsyncGPUVirtualClustersResourceWithRawResponse", - "GPUVirtualClustersResourceWithStreamingResponse", - "AsyncGPUVirtualClustersResourceWithStreamingResponse", + "GPUVirtualResource", + "AsyncGPUVirtualResource", + "GPUVirtualResourceWithRawResponse", + "AsyncGPUVirtualResourceWithRawResponse", + "GPUVirtualResourceWithStreamingResponse", + "AsyncGPUVirtualResourceWithStreamingResponse", "InstancesResource", "AsyncInstancesResource", "InstancesResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 6147e663..9db7efd3 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -188,6 +188,14 @@ FileSharesResourceWithStreamingResponse, AsyncFileSharesResourceWithStreamingResponse, ) +from .gpu_virtual.gpu_virtual import ( + GPUVirtualResource, + AsyncGPUVirtualResource, + GPUVirtualResourceWithRawResponse, + AsyncGPUVirtualResourceWithRawResponse, + GPUVirtualResourceWithStreamingResponse, + AsyncGPUVirtualResourceWithStreamingResponse, +) from .load_balancers.load_balancers import ( LoadBalancersResource, AsyncLoadBalancersResource, @@ -212,14 +220,6 @@ ReservedFixedIPsResourceWithStreamingResponse, AsyncReservedFixedIPsResourceWithStreamingResponse, ) -from .gpu_virtual_clusters.gpu_virtual_clusters import ( - GPUVirtualClustersResource, - AsyncGPUVirtualClustersResource, - GPUVirtualClustersResourceWithRawResponse, - AsyncGPUVirtualClustersResourceWithRawResponse, - GPUVirtualClustersResourceWithStreamingResponse, - AsyncGPUVirtualClustersResourceWithStreamingResponse, -) from .gpu_baremetal_clusters.gpu_baremetal_clusters import ( GPUBaremetalClustersResource, AsyncGPUBaremetalClustersResource, @@ -325,8 +325,8 @@ def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResource: return GPUBaremetalClustersResource(self._client) @cached_property - def gpu_virtual_clusters(self) -> GPUVirtualClustersResource: - return GPUVirtualClustersResource(self._client) + def gpu_virtual(self) -> GPUVirtualResource: + return GPUVirtualResource(self._client) @cached_property def instances(self) -> InstancesResource: @@ -465,8 +465,8 @@ def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResource: return AsyncGPUBaremetalClustersResource(self._client) @cached_property - def gpu_virtual_clusters(self) -> AsyncGPUVirtualClustersResource: - return AsyncGPUVirtualClustersResource(self._client) + def gpu_virtual(self) -> AsyncGPUVirtualResource: + return AsyncGPUVirtualResource(self._client) @cached_property def instances(self) -> AsyncInstancesResource: @@ -608,8 +608,8 @@ def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithRawResponse: return GPUBaremetalClustersResourceWithRawResponse(self._cloud.gpu_baremetal_clusters) @cached_property - def gpu_virtual_clusters(self) -> GPUVirtualClustersResourceWithRawResponse: - return GPUVirtualClustersResourceWithRawResponse(self._cloud.gpu_virtual_clusters) + def gpu_virtual(self) -> GPUVirtualResourceWithRawResponse: + return GPUVirtualResourceWithRawResponse(self._cloud.gpu_virtual) @cached_property def instances(self) -> InstancesResourceWithRawResponse: @@ -732,8 +732,8 @@ def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithRawResp return AsyncGPUBaremetalClustersResourceWithRawResponse(self._cloud.gpu_baremetal_clusters) @cached_property - def gpu_virtual_clusters(self) -> AsyncGPUVirtualClustersResourceWithRawResponse: - return AsyncGPUVirtualClustersResourceWithRawResponse(self._cloud.gpu_virtual_clusters) + def gpu_virtual(self) -> AsyncGPUVirtualResourceWithRawResponse: + return AsyncGPUVirtualResourceWithRawResponse(self._cloud.gpu_virtual) @cached_property def instances(self) -> AsyncInstancesResourceWithRawResponse: @@ -856,8 +856,8 @@ def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithStreamingRes return GPUBaremetalClustersResourceWithStreamingResponse(self._cloud.gpu_baremetal_clusters) @cached_property - def gpu_virtual_clusters(self) -> GPUVirtualClustersResourceWithStreamingResponse: - return GPUVirtualClustersResourceWithStreamingResponse(self._cloud.gpu_virtual_clusters) + def gpu_virtual(self) -> GPUVirtualResourceWithStreamingResponse: + return GPUVirtualResourceWithStreamingResponse(self._cloud.gpu_virtual) @cached_property def instances(self) -> InstancesResourceWithStreamingResponse: @@ -980,8 +980,8 @@ def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithStreami return AsyncGPUBaremetalClustersResourceWithStreamingResponse(self._cloud.gpu_baremetal_clusters) @cached_property - def gpu_virtual_clusters(self) -> AsyncGPUVirtualClustersResourceWithStreamingResponse: - return AsyncGPUVirtualClustersResourceWithStreamingResponse(self._cloud.gpu_virtual_clusters) + def gpu_virtual(self) -> AsyncGPUVirtualResourceWithStreamingResponse: + return AsyncGPUVirtualResourceWithStreamingResponse(self._cloud.gpu_virtual) @cached_property def instances(self) -> AsyncInstancesResourceWithStreamingResponse: diff --git a/src/gcore/resources/cloud/gpu_virtual/__init__.py b/src/gcore/resources/cloud/gpu_virtual/__init__.py new file mode 100644 index 00000000..214d9c94 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_virtual/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) +from .gpu_virtual import ( + GPUVirtualResource, + AsyncGPUVirtualResource, + GPUVirtualResourceWithRawResponse, + AsyncGPUVirtualResourceWithRawResponse, + GPUVirtualResourceWithStreamingResponse, + AsyncGPUVirtualResourceWithStreamingResponse, +) + +__all__ = [ + "ClustersResource", + "AsyncClustersResource", + "ClustersResourceWithRawResponse", + "AsyncClustersResourceWithRawResponse", + "ClustersResourceWithStreamingResponse", + "AsyncClustersResourceWithStreamingResponse", + "GPUVirtualResource", + "AsyncGPUVirtualResource", + "GPUVirtualResourceWithRawResponse", + "AsyncGPUVirtualResourceWithRawResponse", + "GPUVirtualResourceWithStreamingResponse", + "AsyncGPUVirtualResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/__init__.py b/src/gcore/resources/cloud/gpu_virtual/clusters/__init__.py similarity index 80% rename from src/gcore/resources/cloud/gpu_virtual_clusters/__init__.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/__init__.py index 6957a34c..567fb0f3 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/__init__.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/__init__.py @@ -32,6 +32,14 @@ VolumesResourceWithStreamingResponse, AsyncVolumesResourceWithStreamingResponse, ) +from .clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) from .interfaces import ( InterfacesResource, AsyncInterfacesResource, @@ -40,14 +48,6 @@ InterfacesResourceWithStreamingResponse, AsyncInterfacesResourceWithStreamingResponse, ) -from .gpu_virtual_clusters import ( - GPUVirtualClustersResource, - AsyncGPUVirtualClustersResource, - GPUVirtualClustersResourceWithRawResponse, - AsyncGPUVirtualClustersResourceWithRawResponse, - GPUVirtualClustersResourceWithStreamingResponse, - AsyncGPUVirtualClustersResourceWithStreamingResponse, -) __all__ = [ "ServersResource", @@ -80,10 +80,10 @@ "AsyncImagesResourceWithRawResponse", "ImagesResourceWithStreamingResponse", "AsyncImagesResourceWithStreamingResponse", - "GPUVirtualClustersResource", - "AsyncGPUVirtualClustersResource", - "GPUVirtualClustersResourceWithRawResponse", - "AsyncGPUVirtualClustersResourceWithRawResponse", - "GPUVirtualClustersResourceWithStreamingResponse", - "AsyncGPUVirtualClustersResourceWithStreamingResponse", + "ClustersResource", + "AsyncClustersResource", + "ClustersResourceWithRawResponse", + "AsyncClustersResourceWithRawResponse", + "ClustersResourceWithStreamingResponse", + "AsyncClustersResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py b/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py similarity index 89% rename from src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py index 6d00751f..a94d8752 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py @@ -39,9 +39,8 @@ VolumesResourceWithStreamingResponse, AsyncVolumesResourceWithStreamingResponse, ) -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import required_args, maybe_transform, async_maybe_transform -from ...._compat import cached_property +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ....._utils import required_args, maybe_transform, async_maybe_transform from .interfaces import ( InterfacesResource, AsyncInterfacesResource, @@ -50,30 +49,31 @@ InterfacesResourceWithStreamingResponse, AsyncInterfacesResourceWithStreamingResponse, ) -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.cloud import ( - gpu_virtual_cluster_list_params, - gpu_virtual_cluster_action_params, - gpu_virtual_cluster_create_params, - gpu_virtual_cluster_delete_params, - gpu_virtual_cluster_update_params, +from .....pagination import SyncOffsetPage, AsyncOffsetPage +from ....._base_client import AsyncPaginator, make_request_options +from .....types.cloud.gpu_virtual import ( + cluster_list_params, + cluster_action_params, + cluster_create_params, + cluster_delete_params, + cluster_update_params, ) -from ...._base_client import AsyncPaginator, make_request_options -from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.gpu_virtual_cluster import GPUVirtualCluster -from ....types.cloud.tag_update_map_param import TagUpdateMapParam +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.tag_update_map_param import TagUpdateMapParam +from .....types.cloud.gpu_virtual.gpu_virtual_cluster import GPUVirtualCluster -__all__ = ["GPUVirtualClustersResource", "AsyncGPUVirtualClustersResource"] +__all__ = ["ClustersResource", "AsyncClustersResource"] -class GPUVirtualClustersResource(SyncAPIResource): +class ClustersResource(SyncAPIResource): @cached_property def servers(self) -> ServersResource: return ServersResource(self._client) @@ -95,23 +95,23 @@ def images(self) -> ImagesResource: return ImagesResource(self._client) @cached_property - def with_raw_response(self) -> GPUVirtualClustersResourceWithRawResponse: + def with_raw_response(self) -> ClustersResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ - return GPUVirtualClustersResourceWithRawResponse(self) + return ClustersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> GPUVirtualClustersResourceWithStreamingResponse: + def with_streaming_response(self) -> ClustersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ - return GPUVirtualClustersResourceWithStreamingResponse(self) + return ClustersResourceWithStreamingResponse(self) def create( self, @@ -121,7 +121,7 @@ def create( flavor: str, name: str, servers_count: int, - servers_settings: gpu_virtual_cluster_create_params.ServersSettings, + servers_settings: cluster_create_params.ServersSettings, tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -175,7 +175,7 @@ def create( "servers_settings": servers_settings, "tags": tags, }, - gpu_virtual_cluster_create_params.GPUVirtualClusterCreateParams, + cluster_create_params.ClusterCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -225,7 +225,7 @@ def update( raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._patch( f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}", - body=maybe_transform({"name": name}, gpu_virtual_cluster_update_params.GPUVirtualClusterUpdateParams), + body=maybe_transform({"name": name}, cluster_update_params.ClusterUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -283,7 +283,7 @@ def list( "limit": limit, "offset": offset, }, - gpu_virtual_cluster_list_params.GPUVirtualClusterListParams, + cluster_list_params.ClusterListParams, ), ), model=GPUVirtualCluster, @@ -362,7 +362,7 @@ def delete( "reserved_fixed_ip_ids": reserved_fixed_ip_ids, "volume_ids": volume_ids, }, - gpu_virtual_cluster_delete_params.GPUVirtualClusterDeleteParams, + cluster_delete_params.ClusterDeleteParams, ), ), cast_to=TaskIDList, @@ -669,7 +669,7 @@ def action( "tags": tags, "servers_count": servers_count, }, - gpu_virtual_cluster_action_params.GPUVirtualClusterActionParams, + cluster_action_params.ClusterActionParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -723,7 +723,7 @@ def get( ) -class AsyncGPUVirtualClustersResource(AsyncAPIResource): +class AsyncClustersResource(AsyncAPIResource): @cached_property def servers(self) -> AsyncServersResource: return AsyncServersResource(self._client) @@ -745,23 +745,23 @@ def images(self) -> AsyncImagesResource: return AsyncImagesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncGPUVirtualClustersResourceWithRawResponse: + def with_raw_response(self) -> AsyncClustersResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ - return AsyncGPUVirtualClustersResourceWithRawResponse(self) + return AsyncClustersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncGPUVirtualClustersResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncClustersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ - return AsyncGPUVirtualClustersResourceWithStreamingResponse(self) + return AsyncClustersResourceWithStreamingResponse(self) async def create( self, @@ -771,7 +771,7 @@ async def create( flavor: str, name: str, servers_count: int, - servers_settings: gpu_virtual_cluster_create_params.ServersSettings, + servers_settings: cluster_create_params.ServersSettings, tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -825,7 +825,7 @@ async def create( "servers_settings": servers_settings, "tags": tags, }, - gpu_virtual_cluster_create_params.GPUVirtualClusterCreateParams, + cluster_create_params.ClusterCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -875,9 +875,7 @@ async def update( raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._patch( f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}", - body=await async_maybe_transform( - {"name": name}, gpu_virtual_cluster_update_params.GPUVirtualClusterUpdateParams - ), + body=await async_maybe_transform({"name": name}, cluster_update_params.ClusterUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -935,7 +933,7 @@ def list( "limit": limit, "offset": offset, }, - gpu_virtual_cluster_list_params.GPUVirtualClusterListParams, + cluster_list_params.ClusterListParams, ), ), model=GPUVirtualCluster, @@ -1014,7 +1012,7 @@ async def delete( "reserved_fixed_ip_ids": reserved_fixed_ip_ids, "volume_ids": volume_ids, }, - gpu_virtual_cluster_delete_params.GPUVirtualClusterDeleteParams, + cluster_delete_params.ClusterDeleteParams, ), ), cast_to=TaskIDList, @@ -1321,7 +1319,7 @@ async def action( "tags": tags, "servers_count": servers_count, }, - gpu_virtual_cluster_action_params.GPUVirtualClusterActionParams, + cluster_action_params.ClusterActionParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1375,177 +1373,177 @@ async def get( ) -class GPUVirtualClustersResourceWithRawResponse: - def __init__(self, gpu_virtual_clusters: GPUVirtualClustersResource) -> None: - self._gpu_virtual_clusters = gpu_virtual_clusters +class ClustersResourceWithRawResponse: + def __init__(self, clusters: ClustersResource) -> None: + self._clusters = clusters self.create = to_raw_response_wrapper( - gpu_virtual_clusters.create, + clusters.create, ) self.update = to_raw_response_wrapper( - gpu_virtual_clusters.update, + clusters.update, ) self.list = to_raw_response_wrapper( - gpu_virtual_clusters.list, + clusters.list, ) self.delete = to_raw_response_wrapper( - gpu_virtual_clusters.delete, + clusters.delete, ) self.action = to_raw_response_wrapper( - gpu_virtual_clusters.action, + clusters.action, ) self.get = to_raw_response_wrapper( - gpu_virtual_clusters.get, + clusters.get, ) @cached_property def servers(self) -> ServersResourceWithRawResponse: - return ServersResourceWithRawResponse(self._gpu_virtual_clusters.servers) + return ServersResourceWithRawResponse(self._clusters.servers) @cached_property def volumes(self) -> VolumesResourceWithRawResponse: - return VolumesResourceWithRawResponse(self._gpu_virtual_clusters.volumes) + return VolumesResourceWithRawResponse(self._clusters.volumes) @cached_property def interfaces(self) -> InterfacesResourceWithRawResponse: - return InterfacesResourceWithRawResponse(self._gpu_virtual_clusters.interfaces) + return InterfacesResourceWithRawResponse(self._clusters.interfaces) @cached_property def flavors(self) -> FlavorsResourceWithRawResponse: - return FlavorsResourceWithRawResponse(self._gpu_virtual_clusters.flavors) + return FlavorsResourceWithRawResponse(self._clusters.flavors) @cached_property def images(self) -> ImagesResourceWithRawResponse: - return ImagesResourceWithRawResponse(self._gpu_virtual_clusters.images) + return ImagesResourceWithRawResponse(self._clusters.images) -class AsyncGPUVirtualClustersResourceWithRawResponse: - def __init__(self, gpu_virtual_clusters: AsyncGPUVirtualClustersResource) -> None: - self._gpu_virtual_clusters = gpu_virtual_clusters +class AsyncClustersResourceWithRawResponse: + def __init__(self, clusters: AsyncClustersResource) -> None: + self._clusters = clusters self.create = async_to_raw_response_wrapper( - gpu_virtual_clusters.create, + clusters.create, ) self.update = async_to_raw_response_wrapper( - gpu_virtual_clusters.update, + clusters.update, ) self.list = async_to_raw_response_wrapper( - gpu_virtual_clusters.list, + clusters.list, ) self.delete = async_to_raw_response_wrapper( - gpu_virtual_clusters.delete, + clusters.delete, ) self.action = async_to_raw_response_wrapper( - gpu_virtual_clusters.action, + clusters.action, ) self.get = async_to_raw_response_wrapper( - gpu_virtual_clusters.get, + clusters.get, ) @cached_property def servers(self) -> AsyncServersResourceWithRawResponse: - return AsyncServersResourceWithRawResponse(self._gpu_virtual_clusters.servers) + return AsyncServersResourceWithRawResponse(self._clusters.servers) @cached_property def volumes(self) -> AsyncVolumesResourceWithRawResponse: - return AsyncVolumesResourceWithRawResponse(self._gpu_virtual_clusters.volumes) + return AsyncVolumesResourceWithRawResponse(self._clusters.volumes) @cached_property def interfaces(self) -> AsyncInterfacesResourceWithRawResponse: - return AsyncInterfacesResourceWithRawResponse(self._gpu_virtual_clusters.interfaces) + return AsyncInterfacesResourceWithRawResponse(self._clusters.interfaces) @cached_property def flavors(self) -> AsyncFlavorsResourceWithRawResponse: - return AsyncFlavorsResourceWithRawResponse(self._gpu_virtual_clusters.flavors) + return AsyncFlavorsResourceWithRawResponse(self._clusters.flavors) @cached_property def images(self) -> AsyncImagesResourceWithRawResponse: - return AsyncImagesResourceWithRawResponse(self._gpu_virtual_clusters.images) + return AsyncImagesResourceWithRawResponse(self._clusters.images) -class GPUVirtualClustersResourceWithStreamingResponse: - def __init__(self, gpu_virtual_clusters: GPUVirtualClustersResource) -> None: - self._gpu_virtual_clusters = gpu_virtual_clusters +class ClustersResourceWithStreamingResponse: + def __init__(self, clusters: ClustersResource) -> None: + self._clusters = clusters self.create = to_streamed_response_wrapper( - gpu_virtual_clusters.create, + clusters.create, ) self.update = to_streamed_response_wrapper( - gpu_virtual_clusters.update, + clusters.update, ) self.list = to_streamed_response_wrapper( - gpu_virtual_clusters.list, + clusters.list, ) self.delete = to_streamed_response_wrapper( - gpu_virtual_clusters.delete, + clusters.delete, ) self.action = to_streamed_response_wrapper( - gpu_virtual_clusters.action, + clusters.action, ) self.get = to_streamed_response_wrapper( - gpu_virtual_clusters.get, + clusters.get, ) @cached_property def servers(self) -> ServersResourceWithStreamingResponse: - return ServersResourceWithStreamingResponse(self._gpu_virtual_clusters.servers) + return ServersResourceWithStreamingResponse(self._clusters.servers) @cached_property def volumes(self) -> VolumesResourceWithStreamingResponse: - return VolumesResourceWithStreamingResponse(self._gpu_virtual_clusters.volumes) + return VolumesResourceWithStreamingResponse(self._clusters.volumes) @cached_property def interfaces(self) -> InterfacesResourceWithStreamingResponse: - return InterfacesResourceWithStreamingResponse(self._gpu_virtual_clusters.interfaces) + return InterfacesResourceWithStreamingResponse(self._clusters.interfaces) @cached_property def flavors(self) -> FlavorsResourceWithStreamingResponse: - return FlavorsResourceWithStreamingResponse(self._gpu_virtual_clusters.flavors) + return FlavorsResourceWithStreamingResponse(self._clusters.flavors) @cached_property def images(self) -> ImagesResourceWithStreamingResponse: - return ImagesResourceWithStreamingResponse(self._gpu_virtual_clusters.images) + return ImagesResourceWithStreamingResponse(self._clusters.images) -class AsyncGPUVirtualClustersResourceWithStreamingResponse: - def __init__(self, gpu_virtual_clusters: AsyncGPUVirtualClustersResource) -> None: - self._gpu_virtual_clusters = gpu_virtual_clusters +class AsyncClustersResourceWithStreamingResponse: + def __init__(self, clusters: AsyncClustersResource) -> None: + self._clusters = clusters self.create = async_to_streamed_response_wrapper( - gpu_virtual_clusters.create, + clusters.create, ) self.update = async_to_streamed_response_wrapper( - gpu_virtual_clusters.update, + clusters.update, ) self.list = async_to_streamed_response_wrapper( - gpu_virtual_clusters.list, + clusters.list, ) self.delete = async_to_streamed_response_wrapper( - gpu_virtual_clusters.delete, + clusters.delete, ) self.action = async_to_streamed_response_wrapper( - gpu_virtual_clusters.action, + clusters.action, ) self.get = async_to_streamed_response_wrapper( - gpu_virtual_clusters.get, + clusters.get, ) @cached_property def servers(self) -> AsyncServersResourceWithStreamingResponse: - return AsyncServersResourceWithStreamingResponse(self._gpu_virtual_clusters.servers) + return AsyncServersResourceWithStreamingResponse(self._clusters.servers) @cached_property def volumes(self) -> AsyncVolumesResourceWithStreamingResponse: - return AsyncVolumesResourceWithStreamingResponse(self._gpu_virtual_clusters.volumes) + return AsyncVolumesResourceWithStreamingResponse(self._clusters.volumes) @cached_property def interfaces(self) -> AsyncInterfacesResourceWithStreamingResponse: - return AsyncInterfacesResourceWithStreamingResponse(self._gpu_virtual_clusters.interfaces) + return AsyncInterfacesResourceWithStreamingResponse(self._clusters.interfaces) @cached_property def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse: - return AsyncFlavorsResourceWithStreamingResponse(self._gpu_virtual_clusters.flavors) + return AsyncFlavorsResourceWithStreamingResponse(self._clusters.flavors) @cached_property def images(self) -> AsyncImagesResourceWithStreamingResponse: - return AsyncImagesResourceWithStreamingResponse(self._gpu_virtual_clusters.images) + return AsyncImagesResourceWithStreamingResponse(self._clusters.images) diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/flavors.py b/src/gcore/resources/cloud/gpu_virtual/clusters/flavors.py similarity index 93% rename from src/gcore/resources/cloud/gpu_virtual_clusters/flavors.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/flavors.py index 269932f2..ee6fd7dc 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/flavors.py @@ -4,19 +4,19 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.gpu_virtual_clusters import flavor_list_params -from ....types.cloud.gpu_virtual_clusters.gpu_virtual_flavor_list import GPUVirtualFlavorList +from ....._base_client import make_request_options +from .....types.cloud.gpu_virtual.clusters import flavor_list_params +from .....types.cloud.gpu_virtual.clusters.gpu_virtual_flavor_list import GPUVirtualFlavorList __all__ = ["FlavorsResource", "AsyncFlavorsResource"] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/images.py b/src/gcore/resources/cloud/gpu_virtual/clusters/images.py similarity index 97% rename from src/gcore/resources/cloud/gpu_virtual_clusters/images.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/images.py index 8d408ad5..9c7d1472 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/images.py @@ -7,21 +7,21 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.gpu_image import GPUImage -from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.gpu_image_list import GPUImageList -from ....types.cloud.gpu_virtual_clusters import image_upload_params +from ....._base_client import make_request_options +from .....types.cloud.gpu_image import GPUImage +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.gpu_image_list import GPUImageList +from .....types.cloud.gpu_virtual.clusters import image_upload_params __all__ = ["ImagesResource", "AsyncImagesResource"] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_virtual/clusters/interfaces.py similarity index 95% rename from src/gcore/resources/cloud/gpu_virtual_clusters/interfaces.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/interfaces.py index ca97cda6..28bae5d4 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/interfaces.py @@ -4,17 +4,17 @@ import httpx -from ...._types import Body, Query, Headers, NotGiven, not_given -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Query, Headers, NotGiven, not_given +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.gpu_virtual_clusters.gpu_virtual_interface_list import GPUVirtualInterfaceList +from ....._base_client import make_request_options +from .....types.cloud.gpu_virtual.clusters.gpu_virtual_interface_list import GPUVirtualInterfaceList __all__ = ["InterfacesResource", "AsyncInterfacesResource"] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/servers.py b/src/gcore/resources/cloud/gpu_virtual/clusters/servers.py similarity index 96% rename from src/gcore/resources/cloud/gpu_virtual_clusters/servers.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/servers.py index a0176570..4895fd83 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/servers.py @@ -8,20 +8,20 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.gpu_virtual_clusters import server_list_params, server_delete_params -from ....types.cloud.gpu_virtual_clusters.gpu_virtual_cluster_server_list import GPUVirtualClusterServerList +from ....._base_client import make_request_options +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.gpu_virtual.clusters import server_list_params, server_delete_params +from .....types.cloud.gpu_virtual.clusters.gpu_virtual_cluster_server_list import GPUVirtualClusterServerList __all__ = ["ServersResource", "AsyncServersResource"] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/volumes.py b/src/gcore/resources/cloud/gpu_virtual/clusters/volumes.py similarity index 94% rename from src/gcore/resources/cloud/gpu_virtual_clusters/volumes.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/volumes.py index 390e7cf9..afa07662 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/volumes.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/volumes.py @@ -4,17 +4,17 @@ import httpx -from ...._types import Body, Query, Headers, NotGiven, not_given -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Query, Headers, NotGiven, not_given +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.gpu_virtual_clusters.gpu_virtual_cluster_volume_list import GPUVirtualClusterVolumeList +from ....._base_client import make_request_options +from .....types.cloud.gpu_virtual.clusters.gpu_virtual_cluster_volume_list import GPUVirtualClusterVolumeList __all__ = ["VolumesResource", "AsyncVolumesResource"] diff --git a/src/gcore/resources/cloud/gpu_virtual/gpu_virtual.py b/src/gcore/resources/cloud/gpu_virtual/gpu_virtual.py new file mode 100644 index 00000000..959b2156 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_virtual/gpu_virtual.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from .clusters.clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) + +__all__ = ["GPUVirtualResource", "AsyncGPUVirtualResource"] + + +class GPUVirtualResource(SyncAPIResource): + @cached_property + def clusters(self) -> ClustersResource: + return ClustersResource(self._client) + + @cached_property + def with_raw_response(self) -> GPUVirtualResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return GPUVirtualResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> GPUVirtualResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return GPUVirtualResourceWithStreamingResponse(self) + + +class AsyncGPUVirtualResource(AsyncAPIResource): + @cached_property + def clusters(self) -> AsyncClustersResource: + return AsyncClustersResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncGPUVirtualResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncGPUVirtualResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncGPUVirtualResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncGPUVirtualResourceWithStreamingResponse(self) + + +class GPUVirtualResourceWithRawResponse: + def __init__(self, gpu_virtual: GPUVirtualResource) -> None: + self._gpu_virtual = gpu_virtual + + @cached_property + def clusters(self) -> ClustersResourceWithRawResponse: + return ClustersResourceWithRawResponse(self._gpu_virtual.clusters) + + +class AsyncGPUVirtualResourceWithRawResponse: + def __init__(self, gpu_virtual: AsyncGPUVirtualResource) -> None: + self._gpu_virtual = gpu_virtual + + @cached_property + def clusters(self) -> AsyncClustersResourceWithRawResponse: + return AsyncClustersResourceWithRawResponse(self._gpu_virtual.clusters) + + +class GPUVirtualResourceWithStreamingResponse: + def __init__(self, gpu_virtual: GPUVirtualResource) -> None: + self._gpu_virtual = gpu_virtual + + @cached_property + def clusters(self) -> ClustersResourceWithStreamingResponse: + return ClustersResourceWithStreamingResponse(self._gpu_virtual.clusters) + + +class AsyncGPUVirtualResourceWithStreamingResponse: + def __init__(self, gpu_virtual: AsyncGPUVirtualResource) -> None: + self._gpu_virtual = gpu_virtual + + @cached_property + def clusters(self) -> AsyncClustersResourceWithStreamingResponse: + return AsyncClustersResourceWithStreamingResponse(self._gpu_virtual.clusters) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 33f051d9..0503e14b 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -64,7 +64,6 @@ from .billing_reservation import BillingReservation as BillingReservation from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .fixed_address_short import FixedAddressShort as FixedAddressShort -from .gpu_virtual_cluster import GPUVirtualCluster as GPUVirtualCluster from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .k8s_cluster_version import K8SClusterVersion as K8SClusterVersion from .network_list_params import NetworkListParams as NetworkListParams @@ -161,16 +160,11 @@ from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus from .billing_reservation_list_params import BillingReservationListParams as BillingReservationListParams from .cost_report_get_detailed_params import CostReportGetDetailedParams as CostReportGetDetailedParams -from .gpu_virtual_cluster_list_params import GPUVirtualClusterListParams as GPUVirtualClusterListParams from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams from .reserved_fixed_ip_update_params import ReservedFixedIPUpdateParams as ReservedFixedIPUpdateParams from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams from .cost_report_get_aggregated_params import CostReportGetAggregatedParams as CostReportGetAggregatedParams from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams -from .gpu_virtual_cluster_action_params import GPUVirtualClusterActionParams as GPUVirtualClusterActionParams -from .gpu_virtual_cluster_create_params import GPUVirtualClusterCreateParams as GPUVirtualClusterCreateParams -from .gpu_virtual_cluster_delete_params import GPUVirtualClusterDeleteParams as GPUVirtualClusterDeleteParams -from .gpu_virtual_cluster_update_params import GPUVirtualClusterUpdateParams as GPUVirtualClusterUpdateParams from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams diff --git a/src/gcore/types/cloud/gpu_virtual/__init__.py b/src/gcore/types/cloud/gpu_virtual/__init__.py new file mode 100644 index 00000000..9c1abcb8 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .cluster_list_params import ClusterListParams as ClusterListParams +from .gpu_virtual_cluster import GPUVirtualCluster as GPUVirtualCluster +from .cluster_action_params import ClusterActionParams as ClusterActionParams +from .cluster_create_params import ClusterCreateParams as ClusterCreateParams +from .cluster_delete_params import ClusterDeleteParams as ClusterDeleteParams +from .cluster_update_params import ClusterUpdateParams as ClusterUpdateParams diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_action_params.py b/src/gcore/types/cloud/gpu_virtual/cluster_action_params.py similarity index 95% rename from src/gcore/types/cloud/gpu_virtual_cluster_action_params.py rename to src/gcore/types/cloud/gpu_virtual/cluster_action_params.py index 9319deff..a1c0cd75 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_action_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_action_params.py @@ -5,10 +5,10 @@ from typing import Union, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .tag_update_map_param import TagUpdateMapParam +from ..tag_update_map_param import TagUpdateMapParam __all__ = [ - "GPUVirtualClusterActionParams", + "ClusterActionParams", "StartVirtualGPUClusterSerializer", "StopVirtualGPUClusterSerializer", "SoftRebootVirtualGPUClusterSerializer", @@ -117,7 +117,7 @@ class ResizeVirtualGPUClusterSerializer(TypedDict, total=False): """Requested servers count""" -GPUVirtualClusterActionParams: TypeAlias = Union[ +ClusterActionParams: TypeAlias = Union[ StartVirtualGPUClusterSerializer, StopVirtualGPUClusterSerializer, SoftRebootVirtualGPUClusterSerializer, diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py b/src/gcore/types/cloud/gpu_virtual/cluster_create_params.py similarity index 98% rename from src/gcore/types/cloud/gpu_virtual_cluster_create_params.py rename to src/gcore/types/cloud/gpu_virtual/cluster_create_params.py index b678cabf..f6235455 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_create_params.py @@ -6,7 +6,7 @@ from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ - "GPUVirtualClusterCreateParams", + "ClusterCreateParams", "ServersSettings", "ServersSettingsInterface", "ServersSettingsInterfaceExternalInterfaceInputSerializer", @@ -23,7 +23,7 @@ ] -class GPUVirtualClusterCreateParams(TypedDict, total=False): +class ClusterCreateParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_delete_params.py b/src/gcore/types/cloud/gpu_virtual/cluster_delete_params.py similarity index 86% rename from src/gcore/types/cloud/gpu_virtual_cluster_delete_params.py rename to src/gcore/types/cloud/gpu_virtual/cluster_delete_params.py index 3cd9988b..5734cd7c 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_delete_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_delete_params.py @@ -4,12 +4,12 @@ from typing_extensions import TypedDict -from ..._types import SequenceNotStr +from ...._types import SequenceNotStr -__all__ = ["GPUVirtualClusterDeleteParams"] +__all__ = ["ClusterDeleteParams"] -class GPUVirtualClusterDeleteParams(TypedDict, total=False): +class ClusterDeleteParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_list_params.py b/src/gcore/types/cloud/gpu_virtual/cluster_list_params.py similarity index 77% rename from src/gcore/types/cloud/gpu_virtual_cluster_list_params.py rename to src/gcore/types/cloud/gpu_virtual/cluster_list_params.py index ff0dba49..e62cf44f 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_list_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_list_params.py @@ -4,10 +4,10 @@ from typing_extensions import TypedDict -__all__ = ["GPUVirtualClusterListParams"] +__all__ = ["ClusterListParams"] -class GPUVirtualClusterListParams(TypedDict, total=False): +class ClusterListParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_update_params.py b/src/gcore/types/cloud/gpu_virtual/cluster_update_params.py similarity index 74% rename from src/gcore/types/cloud/gpu_virtual_cluster_update_params.py rename to src/gcore/types/cloud/gpu_virtual/cluster_update_params.py index 790bbf88..8ce9c924 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_update_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_update_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["GPUVirtualClusterUpdateParams"] +__all__ = ["ClusterUpdateParams"] -class GPUVirtualClusterUpdateParams(TypedDict, total=False): +class ClusterUpdateParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/__init__.py b/src/gcore/types/cloud/gpu_virtual/clusters/__init__.py similarity index 100% rename from src/gcore/types/cloud/gpu_virtual_clusters/__init__.py rename to src/gcore/types/cloud/gpu_virtual/clusters/__init__.py diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/flavor_list_params.py b/src/gcore/types/cloud/gpu_virtual/clusters/flavor_list_params.py similarity index 100% rename from src/gcore/types/cloud/gpu_virtual_clusters/flavor_list_params.py rename to src/gcore/types/cloud/gpu_virtual/clusters/flavor_list_params.py diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_server.py similarity index 96% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_server.py index b1b8b52f..d8126e53 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_server.py @@ -4,8 +4,8 @@ from datetime import datetime from typing_extensions import Literal -from ..tag import Tag -from ...._models import BaseModel +from ...tag import Tag +from ....._models import BaseModel __all__ = ["GPUVirtualClusterServer", "SecurityGroup"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server_list.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_server_list.py similarity index 91% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server_list.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_server_list.py index d9cdad5a..4d6f87a2 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server_list.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_server_list.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel from .gpu_virtual_cluster_server import GPUVirtualClusterServer __all__ = ["GPUVirtualClusterServerList"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_volume.py similarity index 95% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_volume.py index 06653cde..bab71b55 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_volume.py @@ -4,8 +4,8 @@ from datetime import datetime from typing_extensions import Literal -from ..tag import Tag -from ...._models import BaseModel +from ...tag import Tag +from ....._models import BaseModel __all__ = ["GPUVirtualClusterVolume"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume_list.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_volume_list.py similarity index 91% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume_list.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_volume_list.py index feb8afbc..85b9ab5d 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume_list.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_volume_list.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel from .gpu_virtual_cluster_volume import GPUVirtualClusterVolume __all__ = ["GPUVirtualClusterVolumeList"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_flavor.py similarity index 99% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_flavor.py index 5b94d243..9acea9fb 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_flavor.py @@ -3,7 +3,7 @@ from typing import Union, Optional from typing_extensions import Literal, TypeAlias -from ...._models import BaseModel +from ....._models import BaseModel __all__ = [ "GPUVirtualFlavor", diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor_list.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_flavor_list.py similarity index 90% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor_list.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_flavor_list.py index fdfab090..71caf1fc 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor_list.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_flavor_list.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel from .gpu_virtual_flavor import GPUVirtualFlavor __all__ = ["GPUVirtualFlavorList"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_interface.py similarity index 96% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_interface.py index 22892dca..50473b10 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_interface.py @@ -3,11 +3,11 @@ from typing import List, Optional from datetime import datetime -from ..tag import Tag -from ..route import Route -from ...._models import BaseModel -from ..ip_version import IPVersion -from ..floating_ip_status import FloatingIPStatus +from ...tag import Tag +from ...route import Route +from ....._models import BaseModel +from ...ip_version import IPVersion +from ...floating_ip_status import FloatingIPStatus __all__ = ["GPUVirtualInterface", "FloatingIP", "IPAssignment", "Network", "NetworkSubnet"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface_list.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_interface_list.py similarity index 90% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface_list.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_interface_list.py index ae39f4cf..006974ba 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface_list.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_interface_list.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel from .gpu_virtual_interface import GPUVirtualInterface __all__ = ["GPUVirtualInterfaceList"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_virtual/clusters/image_upload_params.py similarity index 100% rename from src/gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py rename to src/gcore/types/cloud/gpu_virtual/clusters/image_upload_params.py diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/server_delete_params.py b/src/gcore/types/cloud/gpu_virtual/clusters/server_delete_params.py similarity index 96% rename from src/gcore/types/cloud/gpu_virtual_clusters/server_delete_params.py rename to src/gcore/types/cloud/gpu_virtual/clusters/server_delete_params.py index 714cb4bb..a9b463f7 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/server_delete_params.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/server_delete_params.py @@ -4,7 +4,7 @@ from typing_extensions import Required, TypedDict -from ...._types import SequenceNotStr +from ....._types import SequenceNotStr __all__ = ["ServerDeleteParams"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/server_list_params.py b/src/gcore/types/cloud/gpu_virtual/clusters/server_list_params.py similarity index 96% rename from src/gcore/types/cloud/gpu_virtual_clusters/server_list_params.py rename to src/gcore/types/cloud/gpu_virtual/clusters/server_list_params.py index 35c7f374..89f4cb6d 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/server_list_params.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/server_list_params.py @@ -6,8 +6,8 @@ from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict -from ...._types import SequenceNotStr -from ...._utils import PropertyInfo +from ....._types import SequenceNotStr +from ....._utils import PropertyInfo __all__ = ["ServerListParams"] diff --git a/src/gcore/types/cloud/gpu_virtual_cluster.py b/src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py similarity index 98% rename from src/gcore/types/cloud/gpu_virtual_cluster.py rename to src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py index 72aaad4e..9b71eb5e 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster.py +++ b/src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py @@ -4,9 +4,9 @@ from datetime import datetime from typing_extensions import Literal, Annotated, TypeAlias -from .tag import Tag -from ..._utils import PropertyInfo -from ..._models import BaseModel +from ..tag import Tag +from ...._utils import PropertyInfo +from ...._models import BaseModel __all__ = [ "GPUVirtualCluster", diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/__init__.py b/tests/api_resources/cloud/gpu_virtual/__init__.py similarity index 100% rename from tests/api_resources/cloud/gpu_virtual_clusters/__init__.py rename to tests/api_resources/cloud/gpu_virtual/__init__.py diff --git a/tests/api_resources/cloud/gpu_virtual/clusters/__init__.py b/tests/api_resources/cloud/gpu_virtual/clusters/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/gpu_virtual/clusters/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_flavors.py b/tests/api_resources/cloud/gpu_virtual/clusters/test_flavors.py similarity index 86% rename from tests/api_resources/cloud/gpu_virtual_clusters/test_flavors.py rename to tests/api_resources/cloud/gpu_virtual/clusters/test_flavors.py index 89b949ed..4f1118ae 100644 --- a/tests/api_resources/cloud/gpu_virtual_clusters/test_flavors.py +++ b/tests/api_resources/cloud/gpu_virtual/clusters/test_flavors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualFlavorList +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualFlavorList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,7 +19,7 @@ class TestFlavors: @parametrize def test_method_list(self, client: Gcore) -> None: - flavor = client.cloud.gpu_virtual_clusters.flavors.list( + flavor = client.cloud.gpu_virtual.clusters.flavors.list( project_id=1, region_id=7, ) @@ -27,7 +27,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - flavor = client.cloud.gpu_virtual_clusters.flavors.list( + flavor = client.cloud.gpu_virtual.clusters.flavors.list( project_id=1, region_id=7, hide_disabled=True, @@ -37,7 +37,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.flavors.with_raw_response.list( + response = client.cloud.gpu_virtual.clusters.flavors.with_raw_response.list( project_id=1, region_id=7, ) @@ -49,7 +49,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.flavors.with_streaming_response.list( + with client.cloud.gpu_virtual.clusters.flavors.with_streaming_response.list( project_id=1, region_id=7, ) as response: @@ -69,7 +69,7 @@ class TestAsyncFlavors: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - flavor = await async_client.cloud.gpu_virtual_clusters.flavors.list( + flavor = await async_client.cloud.gpu_virtual.clusters.flavors.list( project_id=1, region_id=7, ) @@ -77,7 +77,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - flavor = await async_client.cloud.gpu_virtual_clusters.flavors.list( + flavor = await async_client.cloud.gpu_virtual.clusters.flavors.list( project_id=1, region_id=7, hide_disabled=True, @@ -87,7 +87,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.flavors.with_raw_response.list( + response = await async_client.cloud.gpu_virtual.clusters.flavors.with_raw_response.list( project_id=1, region_id=7, ) @@ -99,7 +99,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.flavors.with_streaming_response.list( + async with async_client.cloud.gpu_virtual.clusters.flavors.with_streaming_response.list( project_id=1, region_id=7, ) as response: diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_images.py b/tests/api_resources/cloud/gpu_virtual/clusters/test_images.py similarity index 87% rename from tests/api_resources/cloud/gpu_virtual_clusters/test_images.py rename to tests/api_resources/cloud/gpu_virtual/clusters/test_images.py index 7312ccb7..669aa6c0 100644 --- a/tests/api_resources/cloud/gpu_virtual_clusters/test_images.py +++ b/tests/api_resources/cloud/gpu_virtual/clusters/test_images.py @@ -19,7 +19,7 @@ class TestImages: @parametrize def test_method_list(self, client: Gcore) -> None: - image = client.cloud.gpu_virtual_clusters.images.list( + image = client.cloud.gpu_virtual.clusters.images.list( project_id=1, region_id=7, ) @@ -27,7 +27,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.images.with_raw_response.list( + response = client.cloud.gpu_virtual.clusters.images.with_raw_response.list( project_id=1, region_id=7, ) @@ -39,7 +39,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.images.with_streaming_response.list( + with client.cloud.gpu_virtual.clusters.images.with_streaming_response.list( project_id=1, region_id=7, ) as response: @@ -53,7 +53,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: - image = client.cloud.gpu_virtual_clusters.images.delete( + image = client.cloud.gpu_virtual.clusters.images.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -62,7 +62,7 @@ def test_method_delete(self, client: Gcore) -> None: @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.images.with_raw_response.delete( + response = client.cloud.gpu_virtual.clusters.images.with_raw_response.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -75,7 +75,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.images.with_streaming_response.delete( + with client.cloud.gpu_virtual.clusters.images.with_streaming_response.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -91,7 +91,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): - client.cloud.gpu_virtual_clusters.images.with_raw_response.delete( + client.cloud.gpu_virtual.clusters.images.with_raw_response.delete( image_id="", project_id=1, region_id=7, @@ -99,7 +99,7 @@ def test_path_params_delete(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: - image = client.cloud.gpu_virtual_clusters.images.get( + image = client.cloud.gpu_virtual.clusters.images.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -108,7 +108,7 @@ def test_method_get(self, client: Gcore) -> None: @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.images.with_raw_response.get( + response = client.cloud.gpu_virtual.clusters.images.with_raw_response.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -121,7 +121,7 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.images.with_streaming_response.get( + with client.cloud.gpu_virtual.clusters.images.with_streaming_response.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -137,7 +137,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: @parametrize def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): - client.cloud.gpu_virtual_clusters.images.with_raw_response.get( + client.cloud.gpu_virtual.clusters.images.with_raw_response.get( image_id="", project_id=1, region_id=7, @@ -145,7 +145,7 @@ def test_path_params_get(self, client: Gcore) -> None: @parametrize def test_method_upload(self, client: Gcore) -> None: - image = client.cloud.gpu_virtual_clusters.images.upload( + image = client.cloud.gpu_virtual.clusters.images.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -155,7 +155,7 @@ def test_method_upload(self, client: Gcore) -> None: @parametrize def test_method_upload_with_all_params(self, client: Gcore) -> None: - image = client.cloud.gpu_virtual_clusters.images.upload( + image = client.cloud.gpu_virtual.clusters.images.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -173,7 +173,7 @@ def test_method_upload_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_upload(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.images.with_raw_response.upload( + response = client.cloud.gpu_virtual.clusters.images.with_raw_response.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -187,7 +187,7 @@ def test_raw_response_upload(self, client: Gcore) -> None: @parametrize def test_streaming_response_upload(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.images.with_streaming_response.upload( + with client.cloud.gpu_virtual.clusters.images.with_streaming_response.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -209,7 +209,7 @@ class TestAsyncImages: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_virtual_clusters.images.list( + image = await async_client.cloud.gpu_virtual.clusters.images.list( project_id=1, region_id=7, ) @@ -217,7 +217,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.list( + response = await async_client.cloud.gpu_virtual.clusters.images.with_raw_response.list( project_id=1, region_id=7, ) @@ -229,7 +229,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.images.with_streaming_response.list( + async with async_client.cloud.gpu_virtual.clusters.images.with_streaming_response.list( project_id=1, region_id=7, ) as response: @@ -243,7 +243,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_virtual_clusters.images.delete( + image = await async_client.cloud.gpu_virtual.clusters.images.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -252,7 +252,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.delete( + response = await async_client.cloud.gpu_virtual.clusters.images.with_raw_response.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -265,7 +265,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.images.with_streaming_response.delete( + async with async_client.cloud.gpu_virtual.clusters.images.with_streaming_response.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -281,7 +281,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.delete( + await async_client.cloud.gpu_virtual.clusters.images.with_raw_response.delete( image_id="", project_id=1, region_id=7, @@ -289,7 +289,7 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_virtual_clusters.images.get( + image = await async_client.cloud.gpu_virtual.clusters.images.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -298,7 +298,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.get( + response = await async_client.cloud.gpu_virtual.clusters.images.with_raw_response.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -311,7 +311,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.images.with_streaming_response.get( + async with async_client.cloud.gpu_virtual.clusters.images.with_streaming_response.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -327,7 +327,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.get( + await async_client.cloud.gpu_virtual.clusters.images.with_raw_response.get( image_id="", project_id=1, region_id=7, @@ -335,7 +335,7 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_upload(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_virtual_clusters.images.upload( + image = await async_client.cloud.gpu_virtual.clusters.images.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -345,7 +345,7 @@ async def test_method_upload(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_virtual_clusters.images.upload( + image = await async_client.cloud.gpu_virtual.clusters.images.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -363,7 +363,7 @@ async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_upload(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.upload( + response = await async_client.cloud.gpu_virtual.clusters.images.with_raw_response.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -377,7 +377,7 @@ async def test_raw_response_upload(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_upload(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.images.with_streaming_response.upload( + async with async_client.cloud.gpu_virtual.clusters.images.with_streaming_response.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_interfaces.py b/tests/api_resources/cloud/gpu_virtual/clusters/test_interfaces.py similarity index 87% rename from tests/api_resources/cloud/gpu_virtual_clusters/test_interfaces.py rename to tests/api_resources/cloud/gpu_virtual/clusters/test_interfaces.py index c36ac28b..b2cbbb85 100644 --- a/tests/api_resources/cloud/gpu_virtual_clusters/test_interfaces.py +++ b/tests/api_resources/cloud/gpu_virtual/clusters/test_interfaces.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualInterfaceList +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualInterfaceList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,7 +19,7 @@ class TestInterfaces: @parametrize def test_method_list(self, client: Gcore) -> None: - interface = client.cloud.gpu_virtual_clusters.interfaces.list( + interface = client.cloud.gpu_virtual.clusters.interfaces.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -28,7 +28,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.interfaces.with_raw_response.list( + response = client.cloud.gpu_virtual.clusters.interfaces.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -41,7 +41,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.interfaces.with_streaming_response.list( + with client.cloud.gpu_virtual.clusters.interfaces.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -57,7 +57,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.interfaces.with_raw_response.list( + client.cloud.gpu_virtual.clusters.interfaces.with_raw_response.list( cluster_id="", project_id=1, region_id=7, @@ -71,7 +71,7 @@ class TestAsyncInterfaces: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - interface = await async_client.cloud.gpu_virtual_clusters.interfaces.list( + interface = await async_client.cloud.gpu_virtual.clusters.interfaces.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -80,7 +80,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.interfaces.with_raw_response.list( + response = await async_client.cloud.gpu_virtual.clusters.interfaces.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -93,7 +93,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.interfaces.with_streaming_response.list( + async with async_client.cloud.gpu_virtual.clusters.interfaces.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -109,7 +109,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.interfaces.with_raw_response.list( + await async_client.cloud.gpu_virtual.clusters.interfaces.with_raw_response.list( cluster_id="", project_id=1, region_id=7, diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_servers.py b/tests/api_resources/cloud/gpu_virtual/clusters/test_servers.py similarity index 88% rename from tests/api_resources/cloud/gpu_virtual_clusters/test_servers.py rename to tests/api_resources/cloud/gpu_virtual/clusters/test_servers.py index 6e341c99..29ca8dc8 100644 --- a/tests/api_resources/cloud/gpu_virtual_clusters/test_servers.py +++ b/tests/api_resources/cloud/gpu_virtual/clusters/test_servers.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from gcore._utils import parse_datetime from gcore.types.cloud import TaskIDList -from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualClusterServerList +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualClusterServerList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,7 +21,7 @@ class TestServers: @parametrize def test_method_list(self, client: Gcore) -> None: - server = client.cloud.gpu_virtual_clusters.servers.list( + server = client.cloud.gpu_virtual.clusters.servers.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -30,7 +30,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - server = client.cloud.gpu_virtual_clusters.servers.list( + server = client.cloud.gpu_virtual.clusters.servers.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -48,7 +48,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.servers.with_raw_response.list( + response = client.cloud.gpu_virtual.clusters.servers.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -61,7 +61,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.servers.with_streaming_response.list( + with client.cloud.gpu_virtual.clusters.servers.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -77,7 +77,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.servers.with_raw_response.list( + client.cloud.gpu_virtual.clusters.servers.with_raw_response.list( cluster_id="", project_id=1, region_id=7, @@ -85,7 +85,7 @@ def test_path_params_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: - server = client.cloud.gpu_virtual_clusters.servers.delete( + server = client.cloud.gpu_virtual.clusters.servers.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -95,7 +95,7 @@ def test_method_delete(self, client: Gcore) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gcore) -> None: - server = client.cloud.gpu_virtual_clusters.servers.delete( + server = client.cloud.gpu_virtual.clusters.servers.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -111,7 +111,7 @@ def test_method_delete_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + response = client.cloud.gpu_virtual.clusters.servers.with_raw_response.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -125,7 +125,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.servers.with_streaming_response.delete( + with client.cloud.gpu_virtual.clusters.servers.with_streaming_response.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -142,7 +142,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + client.cloud.gpu_virtual.clusters.servers.with_raw_response.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -150,7 +150,7 @@ def test_path_params_delete(self, client: Gcore) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): - client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + client.cloud.gpu_virtual.clusters.servers.with_raw_response.delete( server_id="", project_id=1, region_id=7, @@ -165,7 +165,7 @@ class TestAsyncServers: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_virtual_clusters.servers.list( + server = await async_client.cloud.gpu_virtual.clusters.servers.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -174,7 +174,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_virtual_clusters.servers.list( + server = await async_client.cloud.gpu_virtual.clusters.servers.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -192,7 +192,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.list( + response = await async_client.cloud.gpu_virtual.clusters.servers.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -205,7 +205,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.servers.with_streaming_response.list( + async with async_client.cloud.gpu_virtual.clusters.servers.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -221,7 +221,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.list( + await async_client.cloud.gpu_virtual.clusters.servers.with_raw_response.list( cluster_id="", project_id=1, region_id=7, @@ -229,7 +229,7 @@ async def test_path_params_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_virtual_clusters.servers.delete( + server = await async_client.cloud.gpu_virtual.clusters.servers.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -239,7 +239,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_virtual_clusters.servers.delete( + server = await async_client.cloud.gpu_virtual.clusters.servers.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -255,7 +255,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + response = await async_client.cloud.gpu_virtual.clusters.servers.with_raw_response.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -269,7 +269,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.servers.with_streaming_response.delete( + async with async_client.cloud.gpu_virtual.clusters.servers.with_streaming_response.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -286,7 +286,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + await async_client.cloud.gpu_virtual.clusters.servers.with_raw_response.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -294,7 +294,7 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + await async_client.cloud.gpu_virtual.clusters.servers.with_raw_response.delete( server_id="", project_id=1, region_id=7, diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_volumes.py b/tests/api_resources/cloud/gpu_virtual/clusters/test_volumes.py similarity index 87% rename from tests/api_resources/cloud/gpu_virtual_clusters/test_volumes.py rename to tests/api_resources/cloud/gpu_virtual/clusters/test_volumes.py index 294f4466..37d10355 100644 --- a/tests/api_resources/cloud/gpu_virtual_clusters/test_volumes.py +++ b/tests/api_resources/cloud/gpu_virtual/clusters/test_volumes.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualClusterVolumeList +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualClusterVolumeList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,7 +19,7 @@ class TestVolumes: @parametrize def test_method_list(self, client: Gcore) -> None: - volume = client.cloud.gpu_virtual_clusters.volumes.list( + volume = client.cloud.gpu_virtual.clusters.volumes.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -28,7 +28,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.volumes.with_raw_response.list( + response = client.cloud.gpu_virtual.clusters.volumes.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -41,7 +41,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.volumes.with_streaming_response.list( + with client.cloud.gpu_virtual.clusters.volumes.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -57,7 +57,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.volumes.with_raw_response.list( + client.cloud.gpu_virtual.clusters.volumes.with_raw_response.list( cluster_id="", project_id=1, region_id=7, @@ -71,7 +71,7 @@ class TestAsyncVolumes: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - volume = await async_client.cloud.gpu_virtual_clusters.volumes.list( + volume = await async_client.cloud.gpu_virtual.clusters.volumes.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -80,7 +80,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.volumes.with_raw_response.list( + response = await async_client.cloud.gpu_virtual.clusters.volumes.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -93,7 +93,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.volumes.with_streaming_response.list( + async with async_client.cloud.gpu_virtual.clusters.volumes.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -109,7 +109,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.volumes.with_raw_response.list( + await async_client.cloud.gpu_virtual.clusters.volumes.with_raw_response.list( cluster_id="", project_id=1, region_id=7, diff --git a/tests/api_resources/cloud/test_gpu_virtual_clusters.py b/tests/api_resources/cloud/gpu_virtual/test_clusters.py similarity index 73% rename from tests/api_resources/cloud/test_gpu_virtual_clusters.py rename to tests/api_resources/cloud/gpu_virtual/test_clusters.py index 6f3758e5..91d2ae2d 100644 --- a/tests/api_resources/cloud/test_gpu_virtual_clusters.py +++ b/tests/api_resources/cloud/gpu_virtual/test_clusters.py @@ -10,20 +10,20 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.cloud import ( - TaskIDList, +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.gpu_virtual import ( GPUVirtualCluster, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestGPUVirtualClusters: +class TestClusters: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_create(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.create( + cluster = client.cloud.gpu_virtual.clusters.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -42,11 +42,11 @@ def test_method_create(self, client: Gcore) -> None: ], }, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.create( + cluster = client.cloud.gpu_virtual.clusters.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -87,11 +87,11 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: }, tags={"my-tag": "my-tag-value"}, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.create( + response = client.cloud.gpu_virtual.clusters.with_raw_response.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -113,12 +113,12 @@ def test_raw_response_create(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.create( + with client.cloud.gpu_virtual.clusters.with_streaming_response.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -140,24 +140,24 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_update(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.update( + cluster = client.cloud.gpu_virtual.clusters.update( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, name="gpu-cluster-1", ) - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.update( + response = client.cloud.gpu_virtual.clusters.with_raw_response.update( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -166,12 +166,12 @@ def test_raw_response_update(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.update( + with client.cloud.gpu_virtual.clusters.with_streaming_response.update( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -180,15 +180,15 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.update( + client.cloud.gpu_virtual.clusters.with_raw_response.update( cluster_id="", project_id=1, region_id=7, @@ -197,60 +197,60 @@ def test_path_params_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.list( + cluster = client.cloud.gpu_virtual.clusters.list( project_id=1, region_id=7, ) - assert_matches_type(SyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + assert_matches_type(SyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.list( + cluster = client.cloud.gpu_virtual.clusters.list( project_id=1, region_id=7, limit=10, offset=0, ) - assert_matches_type(SyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + assert_matches_type(SyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.list( + response = client.cloud.gpu_virtual.clusters.with_raw_response.list( project_id=1, region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(SyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(SyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.list( + with client.cloud.gpu_virtual.clusters.with_streaming_response.list( project_id=1, region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(SyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(SyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.delete( + cluster = client.cloud.gpu_virtual.clusters.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_method_delete_with_all_params(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.delete( + cluster = client.cloud.gpu_virtual.clusters.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -261,11 +261,11 @@ def test_method_delete_with_all_params(self, client: Gcore) -> None: reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], volume_ids=["1333c684-c3da-4b91-ac9e-a92706aa2824"], ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.delete( + response = client.cloud.gpu_virtual.clusters.with_raw_response.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -273,12 +273,12 @@ def test_raw_response_delete(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.delete( + with client.cloud.gpu_virtual.clusters.with_streaming_response.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -286,15 +286,15 @@ def test_streaming_response_delete(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.delete( + client.cloud.gpu_virtual.clusters.with_raw_response.delete( cluster_id="", project_id=1, region_id=7, @@ -302,17 +302,17 @@ def test_path_params_delete(self, client: Gcore) -> None: @parametrize def test_method_action_overload_1(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster = client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="start", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action_overload_1(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -321,12 +321,12 @@ def test_raw_response_action_overload_1(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action_overload_1(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + with client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -335,15 +335,15 @@ def test_streaming_response_action_overload_1(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action_overload_1(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.action( + client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -352,17 +352,17 @@ def test_path_params_action_overload_1(self, client: Gcore) -> None: @parametrize def test_method_action_overload_2(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster = client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="stop", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action_overload_2(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -371,12 +371,12 @@ def test_raw_response_action_overload_2(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action_overload_2(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + with client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -385,15 +385,15 @@ def test_streaming_response_action_overload_2(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action_overload_2(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.action( + client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -402,17 +402,17 @@ def test_path_params_action_overload_2(self, client: Gcore) -> None: @parametrize def test_method_action_overload_3(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster = client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="soft_reboot", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action_overload_3(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -421,12 +421,12 @@ def test_raw_response_action_overload_3(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action_overload_3(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + with client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -435,15 +435,15 @@ def test_streaming_response_action_overload_3(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action_overload_3(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.action( + client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -452,17 +452,17 @@ def test_path_params_action_overload_3(self, client: Gcore) -> None: @parametrize def test_method_action_overload_4(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster = client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="hard_reboot", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action_overload_4(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -471,12 +471,12 @@ def test_raw_response_action_overload_4(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action_overload_4(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + with client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -485,15 +485,15 @@ def test_streaming_response_action_overload_4(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action_overload_4(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.action( + client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -502,18 +502,18 @@ def test_path_params_action_overload_4(self, client: Gcore) -> None: @parametrize def test_method_action_overload_5(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster = client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="update_tags", tags={"foo": "my-tag-value"}, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action_overload_5(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -523,12 +523,12 @@ def test_raw_response_action_overload_5(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action_overload_5(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + with client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -538,15 +538,15 @@ def test_streaming_response_action_overload_5(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action_overload_5(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.action( + client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -556,18 +556,18 @@ def test_path_params_action_overload_5(self, client: Gcore) -> None: @parametrize def test_method_action_overload_6(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster = client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="resize", servers_count=5, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action_overload_6(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -577,12 +577,12 @@ def test_raw_response_action_overload_6(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action_overload_6(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + with client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -592,15 +592,15 @@ def test_streaming_response_action_overload_6(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action_overload_6(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.action( + client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -610,16 +610,16 @@ def test_path_params_action_overload_6(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.get( + cluster = client.cloud.gpu_virtual.clusters.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, ) - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.get( + response = client.cloud.gpu_virtual.clusters.with_raw_response.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -627,12 +627,12 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.get( + with client.cloud.gpu_virtual.clusters.with_streaming_response.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -640,29 +640,29 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.get( + client.cloud.gpu_virtual.clusters.with_raw_response.get( cluster_id="", project_id=1, region_id=7, ) -class TestAsyncGPUVirtualClusters: +class TestAsyncClusters: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.create( + cluster = await async_client.cloud.gpu_virtual.clusters.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -681,11 +681,11 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: ], }, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.create( + cluster = await async_client.cloud.gpu_virtual.clusters.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -726,11 +726,11 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> }, tags={"my-tag": "my-tag-value"}, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.create( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -752,12 +752,12 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.create( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -779,24 +779,24 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.update( + cluster = await async_client.cloud.gpu_virtual.clusters.update( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, name="gpu-cluster-1", ) - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.update( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.update( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -805,12 +805,12 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.update( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.update( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -819,15 +819,15 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.update( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.update( cluster_id="", project_id=1, region_id=7, @@ -836,60 +836,60 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.list( + cluster = await async_client.cloud.gpu_virtual.clusters.list( project_id=1, region_id=7, ) - assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.list( + cluster = await async_client.cloud.gpu_virtual.clusters.list( project_id=1, region_id=7, limit=10, offset=0, ) - assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.list( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.list( project_id=1, region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.list( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.list( project_id=1, region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.delete( + cluster = await async_client.cloud.gpu_virtual.clusters.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.delete( + cluster = await async_client.cloud.gpu_virtual.clusters.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -900,11 +900,11 @@ async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], volume_ids=["1333c684-c3da-4b91-ac9e-a92706aa2824"], ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.delete( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -912,12 +912,12 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.delete( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -925,15 +925,15 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.delete( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.delete( cluster_id="", project_id=1, region_id=7, @@ -941,17 +941,17 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_action_overload_1(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster = await async_client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="start", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action_overload_1(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -960,12 +960,12 @@ async def test_raw_response_action_overload_1(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action_overload_1(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -974,15 +974,15 @@ async def test_streaming_response_action_overload_1(self, async_client: AsyncGco assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action_overload_1(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -991,17 +991,17 @@ async def test_path_params_action_overload_1(self, async_client: AsyncGcore) -> @parametrize async def test_method_action_overload_2(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster = await async_client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="stop", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action_overload_2(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1010,12 +1010,12 @@ async def test_raw_response_action_overload_2(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action_overload_2(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1024,15 +1024,15 @@ async def test_streaming_response_action_overload_2(self, async_client: AsyncGco assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action_overload_2(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -1041,17 +1041,17 @@ async def test_path_params_action_overload_2(self, async_client: AsyncGcore) -> @parametrize async def test_method_action_overload_3(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster = await async_client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="soft_reboot", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action_overload_3(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1060,12 +1060,12 @@ async def test_raw_response_action_overload_3(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action_overload_3(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1074,15 +1074,15 @@ async def test_streaming_response_action_overload_3(self, async_client: AsyncGco assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action_overload_3(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -1091,17 +1091,17 @@ async def test_path_params_action_overload_3(self, async_client: AsyncGcore) -> @parametrize async def test_method_action_overload_4(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster = await async_client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="hard_reboot", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action_overload_4(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1110,12 +1110,12 @@ async def test_raw_response_action_overload_4(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action_overload_4(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1124,15 +1124,15 @@ async def test_streaming_response_action_overload_4(self, async_client: AsyncGco assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action_overload_4(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -1141,18 +1141,18 @@ async def test_path_params_action_overload_4(self, async_client: AsyncGcore) -> @parametrize async def test_method_action_overload_5(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster = await async_client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="update_tags", tags={"foo": "my-tag-value"}, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action_overload_5(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1162,12 +1162,12 @@ async def test_raw_response_action_overload_5(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action_overload_5(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1177,15 +1177,15 @@ async def test_streaming_response_action_overload_5(self, async_client: AsyncGco assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action_overload_5(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -1195,18 +1195,18 @@ async def test_path_params_action_overload_5(self, async_client: AsyncGcore) -> @parametrize async def test_method_action_overload_6(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster = await async_client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="resize", servers_count=5, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action_overload_6(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1216,12 +1216,12 @@ async def test_raw_response_action_overload_6(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action_overload_6(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1231,15 +1231,15 @@ async def test_streaming_response_action_overload_6(self, async_client: AsyncGco assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action_overload_6(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -1249,16 +1249,16 @@ async def test_path_params_action_overload_6(self, async_client: AsyncGcore) -> @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.get( + cluster = await async_client.cloud.gpu_virtual.clusters.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, ) - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.get( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1266,12 +1266,12 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.get( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1279,15 +1279,15 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.get( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.get( cluster_id="", project_id=1, region_id=7, From ef3c4bcbe3fb9ba1bef6317e022b5cd95dfcf2e0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 11:42:21 +0000 Subject: [PATCH 494/592] fix(cloud)!: move methods to gpu_baremetal_clusters.interfaces.attach()/detach() --- .stats.yml | 2 +- api.md | 4 +- .../gpu_baremetal_clusters/interfaces.py | 628 ++++++++++++++- .../cloud/gpu_baremetal_clusters/servers.py | 637 +-------------- .../cloud/gpu_baremetal_clusters/__init__.py | 4 +- ...e_params.py => interface_attach_params.py} | 4 +- ...e_params.py => interface_detach_params.py} | 4 +- .../gpu_baremetal_clusters/test_interfaces.py | 736 +++++++++++++++++- .../gpu_baremetal_clusters/test_servers.py | 734 ----------------- 9 files changed, 1374 insertions(+), 1379 deletions(-) rename src/gcore/types/cloud/gpu_baremetal_clusters/{server_attach_interface_params.py => interface_attach_params.py} (98%) rename src/gcore/types/cloud/gpu_baremetal_clusters/{server_detach_interface_params.py => interface_detach_params.py} (76%) diff --git a/.stats.yml b/.stats.yml index fc3e8dc4..f80e20ce 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2c3abe1f1637f97f6bc750aff6eb77efc45ac2b527376541ac2af6b9626b35af.yml openapi_spec_hash: ff74a4ccd9ec5ddb1a65963d52e709ba -config_hash: e76c698a64f32a4f2b33e2099e771d83 +config_hash: 0df262ae146e43627e9daf27e6b3bebf diff --git a/api.md b/api.md index bc132d4d..562bb4ed 100644 --- a/api.md +++ b/api.md @@ -798,6 +798,8 @@ Methods: Methods: - client.cloud.gpu_baremetal_clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> NetworkInterfaceList +- client.cloud.gpu_baremetal_clusters.interfaces.attach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.interfaces.detach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList ### Servers @@ -815,8 +817,6 @@ Methods: - client.cloud.gpu_baremetal_clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalClusterServer] - client.cloud.gpu_baremetal_clusters.servers.delete(instance_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.servers.attach_interface(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.servers.detach_interface(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.servers.get_console(instance_id, \*, project_id, region_id) -> Console - client.cloud.gpu_baremetal_clusters.servers.powercycle(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 - client.cloud.gpu_baremetal_clusters.servers.reboot(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index 63371d8e..f7c10022 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -2,9 +2,13 @@ from __future__ import annotations +from typing import Iterable +from typing_extensions import Literal, overload + import httpx -from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -14,6 +18,8 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.gpu_baremetal_clusters import interface_attach_params, interface_detach_params from ....types.cloud.network_interface_list import NetworkInterfaceList __all__ = ["InterfacesResource", "AsyncInterfacesResource"] @@ -78,6 +84,304 @@ def list( cast_to=NetworkInterfaceList, ) + @overload + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be 'external'. Union tag + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + subnet_id: Port will get an IP address from this subnet + + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be 'subnet' + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + network_id: str, + ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + network_id: Port will get an IP address in this network subnet + + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be '`any_subnet`' + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_id: str, + ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + port_id: Port ID + + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be '`reserved_fixed_ip`'. Union tag + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile + | interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile + | interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + body=maybe_transform( + { + "ddos_profile": ddos_profile, + "interface_name": interface_name, + "ip_family": ip_family, + "port_group": port_group, + "security_groups": security_groups, + "type": type, + "subnet_id": subnet_id, + "network_id": network_id, + "port_id": port_id, + }, + interface_attach_params.InterfaceAttachParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def detach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ip_address: str, + port_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Detach interface from bare metal GPU cluster server + + Args: + ip_address: IP address + + port_id: ID of the port + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + body=maybe_transform( + { + "ip_address": ip_address, + "port_id": port_id, + }, + interface_detach_params.InterfaceDetachParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + class AsyncInterfacesResource(AsyncAPIResource): @cached_property @@ -138,6 +442,304 @@ async def list( cast_to=NetworkInterfaceList, ) + @overload + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be 'external'. Union tag + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + subnet_id: Port will get an IP address from this subnet + + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be 'subnet' + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + network_id: str, + ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + network_id: Port will get an IP address in this network subnet + + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be '`any_subnet`' + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_id: str, + ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + port_id: Port ID + + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be '`reserved_fixed_ip`'. Union tag + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile + | interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile + | interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + body=await async_maybe_transform( + { + "ddos_profile": ddos_profile, + "interface_name": interface_name, + "ip_family": ip_family, + "port_group": port_group, + "security_groups": security_groups, + "type": type, + "subnet_id": subnet_id, + "network_id": network_id, + "port_id": port_id, + }, + interface_attach_params.InterfaceAttachParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def detach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ip_address: str, + port_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Detach interface from bare metal GPU cluster server + + Args: + ip_address: IP address + + port_id: ID of the port + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + body=await async_maybe_transform( + { + "ip_address": ip_address, + "port_id": port_id, + }, + interface_detach_params.InterfaceDetachParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + class InterfacesResourceWithRawResponse: def __init__(self, interfaces: InterfacesResource) -> None: @@ -146,6 +748,12 @@ def __init__(self, interfaces: InterfacesResource) -> None: self.list = to_raw_response_wrapper( interfaces.list, ) + self.attach = to_raw_response_wrapper( + interfaces.attach, + ) + self.detach = to_raw_response_wrapper( + interfaces.detach, + ) class AsyncInterfacesResourceWithRawResponse: @@ -155,6 +763,12 @@ def __init__(self, interfaces: AsyncInterfacesResource) -> None: self.list = async_to_raw_response_wrapper( interfaces.list, ) + self.attach = async_to_raw_response_wrapper( + interfaces.attach, + ) + self.detach = async_to_raw_response_wrapper( + interfaces.detach, + ) class InterfacesResourceWithStreamingResponse: @@ -164,6 +778,12 @@ def __init__(self, interfaces: InterfacesResource) -> None: self.list = to_streamed_response_wrapper( interfaces.list, ) + self.attach = to_streamed_response_wrapper( + interfaces.attach, + ) + self.detach = to_streamed_response_wrapper( + interfaces.detach, + ) class AsyncInterfacesResourceWithStreamingResponse: @@ -173,3 +793,9 @@ def __init__(self, interfaces: AsyncInterfacesResource) -> None: self.list = async_to_streamed_response_wrapper( interfaces.list, ) + self.attach = async_to_streamed_response_wrapper( + interfaces.attach, + ) + self.detach = async_to_streamed_response_wrapper( + interfaces.detach, + ) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index fb1a210e..898b4d66 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -2,9 +2,9 @@ from __future__ import annotations -from typing import Union, Iterable +from typing import Union from datetime import datetime -from typing_extensions import Literal, overload +from typing_extensions import Literal import httpx @@ -22,12 +22,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.console import Console from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.gpu_baremetal_clusters import ( - server_list_params, - server_delete_params, - server_attach_interface_params, - server_detach_interface_params, -) +from ....types.cloud.gpu_baremetal_clusters import server_list_params, server_delete_params from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_cluster_server import GPUBaremetalClusterServer from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_cluster_server_v1 import GPUBaremetalClusterServerV1 @@ -220,307 +215,6 @@ def delete( cast_to=TaskIDList, ) - @overload - def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be 'external'. Union tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - subnet_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - subnet_id: Port will get an IP address from this subnet - - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be 'subnet' - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - network_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - network_id: Port will get an IP address in this network subnet - - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be '`any_subnet`' - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - port_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - port_id: Port ID - - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be '`reserved_fixed_ip`'. Union tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile - | server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile - | server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | Omit = omit, - interface_name: str | Omit = omit, - ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - subnet_id: str | Omit = omit, - network_id: str | Omit = omit, - port_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not instance_id: - raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") - return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", - body=maybe_transform( - { - "ddos_profile": ddos_profile, - "interface_name": interface_name, - "ip_family": ip_family, - "port_group": port_group, - "security_groups": security_groups, - "type": type, - "subnet_id": subnet_id, - "network_id": network_id, - "port_id": port_id, - }, - server_attach_interface_params.ServerAttachInterfaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - def detach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - ip_address: str, - port_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Detach interface from bare metal GPU cluster server - - Args: - ip_address: IP address - - port_id: ID of the port - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not instance_id: - raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") - return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", - body=maybe_transform( - { - "ip_address": ip_address, - "port_id": port_id, - }, - server_detach_interface_params.ServerDetachInterfaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - def get_console( self, instance_id: str, @@ -827,307 +521,6 @@ async def delete( cast_to=TaskIDList, ) - @overload - async def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be 'external'. Union tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - subnet_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - subnet_id: Port will get an IP address from this subnet - - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be 'subnet' - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - network_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - network_id: Port will get an IP address in this network subnet - - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be '`any_subnet`' - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - port_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - port_id: Port ID - - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be '`reserved_fixed_ip`'. Union tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - async def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile - | server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile - | server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | Omit = omit, - interface_name: str | Omit = omit, - ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - subnet_id: str | Omit = omit, - network_id: str | Omit = omit, - port_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not instance_id: - raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") - return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", - body=await async_maybe_transform( - { - "ddos_profile": ddos_profile, - "interface_name": interface_name, - "ip_family": ip_family, - "port_group": port_group, - "security_groups": security_groups, - "type": type, - "subnet_id": subnet_id, - "network_id": network_id, - "port_id": port_id, - }, - server_attach_interface_params.ServerAttachInterfaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - async def detach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - ip_address: str, - port_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Detach interface from bare metal GPU cluster server - - Args: - ip_address: IP address - - port_id: ID of the port - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not instance_id: - raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") - return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", - body=await async_maybe_transform( - { - "ip_address": ip_address, - "port_id": port_id, - }, - server_detach_interface_params.ServerDetachInterfaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - async def get_console( self, instance_id: str, @@ -1256,12 +649,6 @@ def __init__(self, servers: ServersResource) -> None: self.delete = to_raw_response_wrapper( servers.delete, ) - self.attach_interface = to_raw_response_wrapper( - servers.attach_interface, - ) - self.detach_interface = to_raw_response_wrapper( - servers.detach_interface, - ) self.get_console = to_raw_response_wrapper( servers.get_console, ) @@ -1283,12 +670,6 @@ def __init__(self, servers: AsyncServersResource) -> None: self.delete = async_to_raw_response_wrapper( servers.delete, ) - self.attach_interface = async_to_raw_response_wrapper( - servers.attach_interface, - ) - self.detach_interface = async_to_raw_response_wrapper( - servers.detach_interface, - ) self.get_console = async_to_raw_response_wrapper( servers.get_console, ) @@ -1310,12 +691,6 @@ def __init__(self, servers: ServersResource) -> None: self.delete = to_streamed_response_wrapper( servers.delete, ) - self.attach_interface = to_streamed_response_wrapper( - servers.attach_interface, - ) - self.detach_interface = to_streamed_response_wrapper( - servers.detach_interface, - ) self.get_console = to_streamed_response_wrapper( servers.get_console, ) @@ -1337,12 +712,6 @@ def __init__(self, servers: AsyncServersResource) -> None: self.delete = async_to_streamed_response_wrapper( servers.delete, ) - self.attach_interface = async_to_streamed_response_wrapper( - servers.attach_interface, - ) - self.detach_interface = async_to_streamed_response_wrapper( - servers.detach_interface, - ) self.get_console = async_to_streamed_response_wrapper( servers.get_console, ) diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py b/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py index 30aeddac..7929f325 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py @@ -7,9 +7,9 @@ from .image_upload_params import ImageUploadParams as ImageUploadParams from .gpu_baremetal_flavor import GPUBaremetalFlavor as GPUBaremetalFlavor from .server_delete_params import ServerDeleteParams as ServerDeleteParams +from .interface_attach_params import InterfaceAttachParams as InterfaceAttachParams +from .interface_detach_params import InterfaceDetachParams as InterfaceDetachParams from .gpu_baremetal_flavor_list import GPUBaremetalFlavorList as GPUBaremetalFlavorList from .gpu_baremetal_cluster_server import GPUBaremetalClusterServer as GPUBaremetalClusterServer -from .server_attach_interface_params import ServerAttachInterfaceParams as ServerAttachInterfaceParams -from .server_detach_interface_params import ServerDetachInterfaceParams as ServerDetachInterfaceParams from .gpu_baremetal_cluster_server_v1 import GPUBaremetalClusterServerV1 as GPUBaremetalClusterServerV1 from .gpu_baremetal_cluster_server_v1_list import GPUBaremetalClusterServerV1List as GPUBaremetalClusterServerV1List diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/interface_attach_params.py similarity index 98% rename from src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py rename to src/gcore/types/cloud/gpu_baremetal_clusters/interface_attach_params.py index 98bf36af..43ff9ee3 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/interface_attach_params.py @@ -6,7 +6,7 @@ from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ - "ServerAttachInterfaceParams", + "InterfaceAttachParams", "NewInterfaceExternalExtendSchemaWithDDOS", "NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile", "NewInterfaceExternalExtendSchemaWithDdosddosProfileField", @@ -261,7 +261,7 @@ class NewInterfaceReservedFixedIPSchemaSecurityGroup(TypedDict, total=False): """Resource ID""" -ServerAttachInterfaceParams: TypeAlias = Union[ +InterfaceAttachParams: TypeAlias = Union[ NewInterfaceExternalExtendSchemaWithDDOS, NewInterfaceSpecificSubnetSchema, NewInterfaceAnySubnetSchema, diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/interface_detach_params.py similarity index 76% rename from src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py rename to src/gcore/types/cloud/gpu_baremetal_clusters/interface_detach_params.py index 4c9cacc3..5f092a84 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/interface_detach_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["ServerDetachInterfaceParams"] +__all__ = ["InterfaceDetachParams"] -class ServerDetachInterfaceParams(TypedDict, total=False): +class InterfaceDetachParams(TypedDict, total=False): project_id: int region_id: int diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py index ec77e011..0afb78c8 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import NetworkInterfaceList +from gcore.types.cloud import TaskIDList, NetworkInterfaceList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -63,6 +63,373 @@ def test_path_params_list(self, client: Gcore) -> None: region_id=0, ) + @parametrize + def test_method_attach_overload_1(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_method_attach_with_all_params_overload_1(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="interface_name", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="external", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_attach_overload_1(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_attach_overload_1(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_overload_1(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_attach_overload_2(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_method_attach_with_all_params_overload_2(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-subnet-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="subnet", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_attach_overload_2(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_attach_overload_2(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_overload_2(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + def test_method_attach_overload_3(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_method_attach_with_all_params_overload_3(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-any-subnet-interface", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="any_subnet", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_attach_overload_3(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_attach_overload_3(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_overload_3(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + def test_method_attach_overload_4(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_method_attach_with_all_params_overload_4(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-rfip-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="reserved_fixed_ip", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_attach_overload_4(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_attach_overload_4(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_overload_4(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + @parametrize + def test_method_detach(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_detach(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_detach(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_detach(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.detach( + instance_id="", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + class TestAsyncInterfaces: parametrize = pytest.mark.parametrize( @@ -114,3 +481,370 @@ async def test_path_params_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) + + @parametrize + async def test_method_attach_overload_1(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_method_attach_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="interface_name", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="external", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_attach_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_attach_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_overload_1(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_attach_overload_2(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_method_attach_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-subnet-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="subnet", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_attach_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_attach_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_overload_2(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + async def test_method_attach_overload_3(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_method_attach_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-any-subnet-interface", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="any_subnet", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_attach_overload_3(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_attach_overload_3(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_overload_3(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + async def test_method_attach_overload_4(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_method_attach_with_all_params_overload_4(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-rfip-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="reserved_fixed_ip", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_attach_overload_4(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_attach_overload_4(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_overload_4(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + @parametrize + async def test_method_detach(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_detach(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_detach(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_detach(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.detach( + instance_id="", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py index 204a8ffb..e3631089 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py @@ -156,373 +156,6 @@ def test_path_params_delete(self, client: Gcore) -> None: cluster_id="cluster_id", ) - @parametrize - def test_method_attach_interface_overload_1(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_method_attach_interface_with_all_params_overload_1(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="interface_name", - ip_family="dual", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="external", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_raw_response_attach_interface_overload_1(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_streaming_response_attach_interface_overload_1(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_attach_interface_overload_1(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - ) - - @parametrize - def test_method_attach_interface_overload_2(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_method_attach_interface_with_all_params_overload_2(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="my-subnet-interface", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="subnet", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_raw_response_attach_interface_overload_2(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_streaming_response_attach_interface_overload_2(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_attach_interface_overload_2(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - @parametrize - def test_method_attach_interface_overload_3(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_method_attach_interface_with_all_params_overload_3(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="my-any-subnet-interface", - ip_family="dual", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="any_subnet", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_raw_response_attach_interface_overload_3(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_streaming_response_attach_interface_overload_3(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_attach_interface_overload_3(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - @parametrize - def test_method_attach_interface_overload_4(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_method_attach_interface_with_all_params_overload_4(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="my-rfip-interface", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="reserved_fixed_ip", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_raw_response_attach_interface_overload_4(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_streaming_response_attach_interface_overload_4(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_attach_interface_overload_4(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) - - @parametrize - def test_method_detach_interface(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.detach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_raw_response_detach_interface(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.detach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_streaming_response_detach_interface(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.detach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_detach_interface(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.detach_interface( - instance_id="", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) - @parametrize def test_method_get_console(self, client: Gcore) -> None: server = client.cloud.gpu_baremetal_clusters.servers.get_console( @@ -800,373 +433,6 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: cluster_id="cluster_id", ) - @parametrize - async def test_method_attach_interface_overload_1(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_method_attach_interface_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="interface_name", - ip_family="dual", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="external", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_raw_response_attach_interface_overload_1(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_streaming_response_attach_interface_overload_1(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_attach_interface_overload_1(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - ) - - @parametrize - async def test_method_attach_interface_overload_2(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_method_attach_interface_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="my-subnet-interface", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="subnet", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_raw_response_attach_interface_overload_2(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_streaming_response_attach_interface_overload_2(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_attach_interface_overload_2(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - @parametrize - async def test_method_attach_interface_overload_3(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_method_attach_interface_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="my-any-subnet-interface", - ip_family="dual", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="any_subnet", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_raw_response_attach_interface_overload_3(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_streaming_response_attach_interface_overload_3(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_attach_interface_overload_3(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - @parametrize - async def test_method_attach_interface_overload_4(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_method_attach_interface_with_all_params_overload_4(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="my-rfip-interface", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="reserved_fixed_ip", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_raw_response_attach_interface_overload_4(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_streaming_response_attach_interface_overload_4(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_attach_interface_overload_4(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) - - @parametrize - async def test_method_detach_interface(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.detach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_raw_response_detach_interface(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.detach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_streaming_response_detach_interface(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.detach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_detach_interface(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.detach_interface( - instance_id="", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) - @parametrize async def test_method_get_console(self, async_client: AsyncGcore) -> None: server = await async_client.cloud.gpu_baremetal_clusters.servers.get_console( From 0e595b83545da5cf9c5f7ebcf7e4dcb6a9f59254 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 12:07:01 +0000 Subject: [PATCH 495/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a36746b8..caf5ca3f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.25.0" + ".": "0.26.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 1ec62bb7..0faa21bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.25.0" +version = "0.26.0" description = "The official Python library for the gcore API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/gcore/_version.py b/src/gcore/_version.py index 7771dae8..3749030a 100644 --- a/src/gcore/_version.py +++ b/src/gcore/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "gcore" -__version__ = "0.25.0" # x-release-please-version +__version__ = "0.26.0" # x-release-please-version From 86020dbdbf8b4360819a3af599b6c1cb76f46c0b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Dec 2025 09:37:47 +0000 Subject: [PATCH 496/592] feat(api): manual updates --- .stats.yml | 2 +- api.md | 62 +-- src/gcore/resources/cloud/__init__.py | 28 +- src/gcore/resources/cloud/cloud.py | 40 +- .../resources/cloud/gpu_baremetal/__init__.py | 33 ++ .../clusters}/__init__.py | 28 +- .../clusters/clusters.py} | 218 ++++++----- .../clusters}/flavors.py | 16 +- .../clusters}/images.py | 20 +- .../clusters}/interfaces.py | 18 +- .../clusters}/servers.py | 24 +- .../cloud/gpu_baremetal/gpu_baremetal.py | 102 +++++ src/gcore/types/cloud/__init__.py | 7 - .../types/cloud/gpu_baremetal/__init__.py | 11 + .../cluster_action_params.py} | 6 +- .../cluster_create_params.py} | 4 +- .../cluster_delete_params.py} | 6 +- .../cluster_list_params.py} | 4 +- .../cluster_rebuild_params.py} | 6 +- .../cluster_resize_params.py} | 4 +- .../clusters}/__init__.py | 0 .../clusters}/flavor_list_params.py | 0 .../clusters}/gpu_baremetal_cluster_server.py | 4 +- .../gpu_baremetal_cluster_server_v1.py | 16 +- .../gpu_baremetal_cluster_server_v1_list.py | 2 +- .../clusters}/gpu_baremetal_flavor.py | 2 +- .../clusters}/gpu_baremetal_flavor_list.py | 2 +- .../clusters}/image_upload_params.py | 0 .../clusters}/interface_attach_params.py | 0 .../clusters}/interface_detach_params.py | 0 .../clusters}/server_delete_params.py | 0 .../clusters}/server_list_params.py | 4 +- .../gpu_baremetal_cluster.py | 6 +- .../__init__.py | 0 .../cloud/gpu_baremetal/clusters/__init__.py | 1 + .../clusters}/test_flavors.py | 18 +- .../clusters}/test_images.py | 60 +-- .../clusters}/test_interfaces.py | 112 +++--- .../clusters}/test_servers.py | 94 ++--- .../test_clusters.py} | 358 +++++++++--------- 40 files changed, 728 insertions(+), 590 deletions(-) create mode 100644 src/gcore/resources/cloud/gpu_baremetal/__init__.py rename src/gcore/resources/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/__init__.py (75%) rename src/gcore/resources/cloud/{gpu_baremetal_clusters/gpu_baremetal_clusters.py => gpu_baremetal/clusters/clusters.py} (87%) rename src/gcore/resources/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/flavors.py (93%) rename src/gcore/resources/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/images.py (97%) rename src/gcore/resources/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/interfaces.py (98%) rename src/gcore/resources/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/servers.py (97%) create mode 100644 src/gcore/resources/cloud/gpu_baremetal/gpu_baremetal.py create mode 100644 src/gcore/types/cloud/gpu_baremetal/__init__.py rename src/gcore/types/cloud/{gpu_baremetal_cluster_action_params.py => gpu_baremetal/cluster_action_params.py} (90%) rename src/gcore/types/cloud/{gpu_baremetal_cluster_create_params.py => gpu_baremetal/cluster_create_params.py} (98%) rename src/gcore/types/cloud/{gpu_baremetal_cluster_delete_params.py => gpu_baremetal/cluster_delete_params.py} (83%) rename src/gcore/types/cloud/{gpu_baremetal_cluster_list_params.py => gpu_baremetal/cluster_list_params.py} (86%) rename src/gcore/types/cloud/{gpu_baremetal_cluster_rebuild_params.py => gpu_baremetal/cluster_rebuild_params.py} (79%) rename src/gcore/types/cloud/{gpu_baremetal_cluster_resize_params.py => gpu_baremetal/cluster_resize_params.py} (73%) rename src/gcore/types/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/__init__.py (100%) rename src/gcore/types/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/flavor_list_params.py (100%) rename src/gcore/types/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/gpu_baremetal_cluster_server.py (96%) rename src/gcore/types/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/gpu_baremetal_cluster_server_v1.py (93%) rename src/gcore/types/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/gpu_baremetal_cluster_server_v1_list.py (91%) rename src/gcore/types/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/gpu_baremetal_flavor.py (99%) rename src/gcore/types/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/gpu_baremetal_flavor_list.py (90%) rename src/gcore/types/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/image_upload_params.py (100%) rename src/gcore/types/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/interface_attach_params.py (100%) rename src/gcore/types/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/interface_detach_params.py (100%) rename src/gcore/types/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/server_delete_params.py (100%) rename src/gcore/types/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/server_list_params.py (96%) rename src/gcore/types/cloud/{ => gpu_baremetal}/gpu_baremetal_cluster.py (98%) rename tests/api_resources/cloud/{gpu_baremetal_clusters => gpu_baremetal}/__init__.py (100%) create mode 100644 tests/api_resources/cloud/gpu_baremetal/clusters/__init__.py rename tests/api_resources/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/test_flavors.py (86%) rename tests/api_resources/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/test_images.py (87%) rename tests/api_resources/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/test_interfaces.py (89%) rename tests/api_resources/cloud/{gpu_baremetal_clusters => gpu_baremetal/clusters}/test_servers.py (87%) rename tests/api_resources/cloud/{test_gpu_baremetal_clusters.py => gpu_baremetal/test_clusters.py} (70%) diff --git a/.stats.yml b/.stats.yml index f80e20ce..87a747f2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2c3abe1f1637f97f6bc750aff6eb77efc45ac2b527376541ac2af6b9626b35af.yml openapi_spec_hash: ff74a4ccd9ec5ddb1a65963d52e709ba -config_hash: 0df262ae146e43627e9daf27e6b3bebf +config_hash: 74d2c4eaca28539e6694ab47fe0c34db diff --git a/api.md b/api.md index 562bb4ed..b7509aeb 100644 --- a/api.md +++ b/api.md @@ -773,40 +773,42 @@ Methods: - client.cloud.billing_reservations.list(\*\*params) -> BillingReservations -## GPUBaremetalClusters +## GPUBaremetal + +### Clusters Types: ```python -from gcore.types.cloud import GPUBaremetalCluster +from gcore.types.cloud.gpu_baremetal import GPUBaremetalCluster ``` Methods: -- client.cloud.gpu_baremetal_clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalCluster] -- client.cloud.gpu_baremetal_clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.get(cluster_id, \*, project_id, region_id) -> GPUBaremetalCluster -- client.cloud.gpu_baremetal_clusters.powercycle_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List -- client.cloud.gpu_baremetal_clusters.reboot_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List -- client.cloud.gpu_baremetal_clusters.rebuild(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.resize(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalCluster] +- client.cloud.gpu_baremetal.clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.get(cluster_id, \*, project_id, region_id) -> GPUBaremetalCluster +- client.cloud.gpu_baremetal.clusters.powercycle_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List +- client.cloud.gpu_baremetal.clusters.reboot_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List +- client.cloud.gpu_baremetal.clusters.rebuild(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.resize(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -### Interfaces +#### Interfaces Methods: -- client.cloud.gpu_baremetal_clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> NetworkInterfaceList -- client.cloud.gpu_baremetal_clusters.interfaces.attach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.interfaces.detach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> NetworkInterfaceList +- client.cloud.gpu_baremetal.clusters.interfaces.attach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.interfaces.detach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList -### Servers +#### Servers Types: ```python -from gcore.types.cloud.gpu_baremetal_clusters import ( +from gcore.types.cloud.gpu_baremetal.clusters import ( GPUBaremetalClusterServer, GPUBaremetalClusterServerV1, GPUBaremetalClusterServerV1List, @@ -815,32 +817,32 @@ from gcore.types.cloud.gpu_baremetal_clusters import ( Methods: -- client.cloud.gpu_baremetal_clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalClusterServer] -- client.cloud.gpu_baremetal_clusters.servers.delete(instance_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.servers.get_console(instance_id, \*, project_id, region_id) -> Console -- client.cloud.gpu_baremetal_clusters.servers.powercycle(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 -- client.cloud.gpu_baremetal_clusters.servers.reboot(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 +- client.cloud.gpu_baremetal.clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalClusterServer] +- client.cloud.gpu_baremetal.clusters.servers.delete(instance_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.servers.get_console(instance_id, \*, project_id, region_id) -> Console +- client.cloud.gpu_baremetal.clusters.servers.powercycle(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 +- client.cloud.gpu_baremetal.clusters.servers.reboot(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 -### Flavors +#### Flavors Types: ```python -from gcore.types.cloud.gpu_baremetal_clusters import GPUBaremetalFlavor, GPUBaremetalFlavorList +from gcore.types.cloud.gpu_baremetal.clusters import GPUBaremetalFlavor, GPUBaremetalFlavorList ``` Methods: -- client.cloud.gpu_baremetal_clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUBaremetalFlavorList +- client.cloud.gpu_baremetal.clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUBaremetalFlavorList -### Images +#### Images Methods: -- client.cloud.gpu_baremetal_clusters.images.list(\*, project_id, region_id) -> GPUImageList -- client.cloud.gpu_baremetal_clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage -- client.cloud.gpu_baremetal_clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.images.list(\*, project_id, region_id) -> GPUImageList +- client.cloud.gpu_baremetal.clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage +- client.cloud.gpu_baremetal.clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList ## GPUVirtual diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index e4c125cc..36c2a495 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -176,6 +176,14 @@ FloatingIPsResourceWithStreamingResponse, AsyncFloatingIPsResourceWithStreamingResponse, ) +from .gpu_baremetal import ( + GPUBaremetalResource, + AsyncGPUBaremetalResource, + GPUBaremetalResourceWithRawResponse, + AsyncGPUBaremetalResourceWithRawResponse, + GPUBaremetalResourceWithStreamingResponse, + AsyncGPUBaremetalResourceWithStreamingResponse, +) from .usage_reports import ( UsageReportsResource, AsyncUsageReportsResource, @@ -224,14 +232,6 @@ BillingReservationsResourceWithStreamingResponse, AsyncBillingReservationsResourceWithStreamingResponse, ) -from .gpu_baremetal_clusters import ( - GPUBaremetalClustersResource, - AsyncGPUBaremetalClustersResource, - GPUBaremetalClustersResourceWithRawResponse, - AsyncGPUBaremetalClustersResourceWithRawResponse, - GPUBaremetalClustersResourceWithStreamingResponse, - AsyncGPUBaremetalClustersResourceWithStreamingResponse, -) __all__ = [ "ProjectsResource", @@ -354,12 +354,12 @@ "AsyncBillingReservationsResourceWithRawResponse", "BillingReservationsResourceWithStreamingResponse", "AsyncBillingReservationsResourceWithStreamingResponse", - "GPUBaremetalClustersResource", - "AsyncGPUBaremetalClustersResource", - "GPUBaremetalClustersResourceWithRawResponse", - "AsyncGPUBaremetalClustersResourceWithRawResponse", - "GPUBaremetalClustersResourceWithStreamingResponse", - "AsyncGPUBaremetalClustersResourceWithStreamingResponse", + "GPUBaremetalResource", + "AsyncGPUBaremetalResource", + "GPUBaremetalResourceWithRawResponse", + "AsyncGPUBaremetalResourceWithRawResponse", + "GPUBaremetalResourceWithStreamingResponse", + "AsyncGPUBaremetalResourceWithStreamingResponse", "GPUVirtualResource", "AsyncGPUVirtualResource", "GPUVirtualResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 9db7efd3..f8c91a68 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -196,6 +196,14 @@ GPUVirtualResourceWithStreamingResponse, AsyncGPUVirtualResourceWithStreamingResponse, ) +from .gpu_baremetal.gpu_baremetal import ( + GPUBaremetalResource, + AsyncGPUBaremetalResource, + GPUBaremetalResourceWithRawResponse, + AsyncGPUBaremetalResourceWithRawResponse, + GPUBaremetalResourceWithStreamingResponse, + AsyncGPUBaremetalResourceWithStreamingResponse, +) from .load_balancers.load_balancers import ( LoadBalancersResource, AsyncLoadBalancersResource, @@ -220,14 +228,6 @@ ReservedFixedIPsResourceWithStreamingResponse, AsyncReservedFixedIPsResourceWithStreamingResponse, ) -from .gpu_baremetal_clusters.gpu_baremetal_clusters import ( - GPUBaremetalClustersResource, - AsyncGPUBaremetalClustersResource, - GPUBaremetalClustersResourceWithRawResponse, - AsyncGPUBaremetalClustersResourceWithRawResponse, - GPUBaremetalClustersResourceWithStreamingResponse, - AsyncGPUBaremetalClustersResourceWithStreamingResponse, -) __all__ = ["CloudResource", "AsyncCloudResource"] @@ -321,8 +321,8 @@ def billing_reservations(self) -> BillingReservationsResource: return BillingReservationsResource(self._client) @cached_property - def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResource: - return GPUBaremetalClustersResource(self._client) + def gpu_baremetal(self) -> GPUBaremetalResource: + return GPUBaremetalResource(self._client) @cached_property def gpu_virtual(self) -> GPUVirtualResource: @@ -461,8 +461,8 @@ def billing_reservations(self) -> AsyncBillingReservationsResource: return AsyncBillingReservationsResource(self._client) @cached_property - def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResource: - return AsyncGPUBaremetalClustersResource(self._client) + def gpu_baremetal(self) -> AsyncGPUBaremetalResource: + return AsyncGPUBaremetalResource(self._client) @cached_property def gpu_virtual(self) -> AsyncGPUVirtualResource: @@ -604,8 +604,8 @@ def billing_reservations(self) -> BillingReservationsResourceWithRawResponse: return BillingReservationsResourceWithRawResponse(self._cloud.billing_reservations) @cached_property - def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithRawResponse: - return GPUBaremetalClustersResourceWithRawResponse(self._cloud.gpu_baremetal_clusters) + def gpu_baremetal(self) -> GPUBaremetalResourceWithRawResponse: + return GPUBaremetalResourceWithRawResponse(self._cloud.gpu_baremetal) @cached_property def gpu_virtual(self) -> GPUVirtualResourceWithRawResponse: @@ -728,8 +728,8 @@ def billing_reservations(self) -> AsyncBillingReservationsResourceWithRawRespons return AsyncBillingReservationsResourceWithRawResponse(self._cloud.billing_reservations) @cached_property - def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithRawResponse: - return AsyncGPUBaremetalClustersResourceWithRawResponse(self._cloud.gpu_baremetal_clusters) + def gpu_baremetal(self) -> AsyncGPUBaremetalResourceWithRawResponse: + return AsyncGPUBaremetalResourceWithRawResponse(self._cloud.gpu_baremetal) @cached_property def gpu_virtual(self) -> AsyncGPUVirtualResourceWithRawResponse: @@ -852,8 +852,8 @@ def billing_reservations(self) -> BillingReservationsResourceWithStreamingRespon return BillingReservationsResourceWithStreamingResponse(self._cloud.billing_reservations) @cached_property - def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithStreamingResponse: - return GPUBaremetalClustersResourceWithStreamingResponse(self._cloud.gpu_baremetal_clusters) + def gpu_baremetal(self) -> GPUBaremetalResourceWithStreamingResponse: + return GPUBaremetalResourceWithStreamingResponse(self._cloud.gpu_baremetal) @cached_property def gpu_virtual(self) -> GPUVirtualResourceWithStreamingResponse: @@ -976,8 +976,8 @@ def billing_reservations(self) -> AsyncBillingReservationsResourceWithStreamingR return AsyncBillingReservationsResourceWithStreamingResponse(self._cloud.billing_reservations) @cached_property - def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithStreamingResponse: - return AsyncGPUBaremetalClustersResourceWithStreamingResponse(self._cloud.gpu_baremetal_clusters) + def gpu_baremetal(self) -> AsyncGPUBaremetalResourceWithStreamingResponse: + return AsyncGPUBaremetalResourceWithStreamingResponse(self._cloud.gpu_baremetal) @cached_property def gpu_virtual(self) -> AsyncGPUVirtualResourceWithStreamingResponse: diff --git a/src/gcore/resources/cloud/gpu_baremetal/__init__.py b/src/gcore/resources/cloud/gpu_baremetal/__init__.py new file mode 100644 index 00000000..d8e97060 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_baremetal/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) +from .gpu_baremetal import ( + GPUBaremetalResource, + AsyncGPUBaremetalResource, + GPUBaremetalResourceWithRawResponse, + AsyncGPUBaremetalResourceWithRawResponse, + GPUBaremetalResourceWithStreamingResponse, + AsyncGPUBaremetalResourceWithStreamingResponse, +) + +__all__ = [ + "ClustersResource", + "AsyncClustersResource", + "ClustersResourceWithRawResponse", + "AsyncClustersResourceWithRawResponse", + "ClustersResourceWithStreamingResponse", + "AsyncClustersResourceWithStreamingResponse", + "GPUBaremetalResource", + "AsyncGPUBaremetalResource", + "GPUBaremetalResourceWithRawResponse", + "AsyncGPUBaremetalResourceWithRawResponse", + "GPUBaremetalResourceWithStreamingResponse", + "AsyncGPUBaremetalResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/__init__.py b/src/gcore/resources/cloud/gpu_baremetal/clusters/__init__.py similarity index 75% rename from src/gcore/resources/cloud/gpu_baremetal_clusters/__init__.py rename to src/gcore/resources/cloud/gpu_baremetal/clusters/__init__.py index ecfb4752..10acfe5d 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/__init__.py +++ b/src/gcore/resources/cloud/gpu_baremetal/clusters/__init__.py @@ -24,6 +24,14 @@ ServersResourceWithStreamingResponse, AsyncServersResourceWithStreamingResponse, ) +from .clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) from .interfaces import ( InterfacesResource, AsyncInterfacesResource, @@ -32,14 +40,6 @@ InterfacesResourceWithStreamingResponse, AsyncInterfacesResourceWithStreamingResponse, ) -from .gpu_baremetal_clusters import ( - GPUBaremetalClustersResource, - AsyncGPUBaremetalClustersResource, - GPUBaremetalClustersResourceWithRawResponse, - AsyncGPUBaremetalClustersResourceWithRawResponse, - GPUBaremetalClustersResourceWithStreamingResponse, - AsyncGPUBaremetalClustersResourceWithStreamingResponse, -) __all__ = [ "InterfacesResource", @@ -66,10 +66,10 @@ "AsyncImagesResourceWithRawResponse", "ImagesResourceWithStreamingResponse", "AsyncImagesResourceWithStreamingResponse", - "GPUBaremetalClustersResource", - "AsyncGPUBaremetalClustersResource", - "GPUBaremetalClustersResourceWithRawResponse", - "AsyncGPUBaremetalClustersResourceWithRawResponse", - "GPUBaremetalClustersResourceWithStreamingResponse", - "AsyncGPUBaremetalClustersResourceWithStreamingResponse", + "ClustersResource", + "AsyncClustersResource", + "ClustersResourceWithRawResponse", + "AsyncClustersResourceWithRawResponse", + "ClustersResourceWithStreamingResponse", + "AsyncClustersResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py similarity index 87% rename from src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py rename to src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py index c4012ae1..87804b8a 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py @@ -31,9 +31,8 @@ ServersResourceWithStreamingResponse, AsyncServersResourceWithStreamingResponse, ) -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform from .interfaces import ( InterfacesResource, AsyncInterfacesResource, @@ -42,32 +41,33 @@ InterfacesResourceWithStreamingResponse, AsyncInterfacesResourceWithStreamingResponse, ) -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.cloud import ( - gpu_baremetal_cluster_list_params, - gpu_baremetal_cluster_action_params, - gpu_baremetal_cluster_create_params, - gpu_baremetal_cluster_delete_params, - gpu_baremetal_cluster_resize_params, - gpu_baremetal_cluster_rebuild_params, +from .....pagination import SyncOffsetPage, AsyncOffsetPage +from ....._base_client import AsyncPaginator, make_request_options +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.gpu_baremetal import ( + cluster_list_params, + cluster_action_params, + cluster_create_params, + cluster_delete_params, + cluster_resize_params, + cluster_rebuild_params, ) -from ...._base_client import AsyncPaginator, make_request_options -from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.tag_update_map_param import TagUpdateMapParam -from ....types.cloud.gpu_baremetal_cluster import GPUBaremetalCluster -from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_cluster_server_v1_list import GPUBaremetalClusterServerV1List +from .....types.cloud.tag_update_map_param import TagUpdateMapParam +from .....types.cloud.gpu_baremetal.gpu_baremetal_cluster import GPUBaremetalCluster +from .....types.cloud.gpu_baremetal.clusters.gpu_baremetal_cluster_server_v1_list import GPUBaremetalClusterServerV1List -__all__ = ["GPUBaremetalClustersResource", "AsyncGPUBaremetalClustersResource"] +__all__ = ["ClustersResource", "AsyncClustersResource"] -class GPUBaremetalClustersResource(SyncAPIResource): +class ClustersResource(SyncAPIResource): @cached_property def interfaces(self) -> InterfacesResource: return InterfacesResource(self._client) @@ -85,23 +85,23 @@ def images(self) -> ImagesResource: return ImagesResource(self._client) @cached_property - def with_raw_response(self) -> GPUBaremetalClustersResourceWithRawResponse: + def with_raw_response(self) -> ClustersResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ - return GPUBaremetalClustersResourceWithRawResponse(self) + return ClustersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> GPUBaremetalClustersResourceWithStreamingResponse: + def with_streaming_response(self) -> ClustersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ - return GPUBaremetalClustersResourceWithStreamingResponse(self) + return ClustersResourceWithStreamingResponse(self) def create( self, @@ -112,7 +112,7 @@ def create( image_id: str, name: str, servers_count: int, - servers_settings: gpu_baremetal_cluster_create_params.ServersSettings, + servers_settings: cluster_create_params.ServersSettings, tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -169,7 +169,7 @@ def create( "servers_settings": servers_settings, "tags": tags, }, - gpu_baremetal_cluster_create_params.GPUBaremetalClusterCreateParams, + cluster_create_params.ClusterCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -236,7 +236,7 @@ def list( "managed_by": managed_by, "offset": offset, }, - gpu_baremetal_cluster_list_params.GPUBaremetalClusterListParams, + cluster_list_params.ClusterListParams, ), ), model=GPUBaremetalCluster, @@ -307,7 +307,7 @@ def delete( "floating_ip_ids": floating_ip_ids, "reserved_fixed_ip_ids": reserved_fixed_ip_ids, }, - gpu_baremetal_cluster_delete_params.GPUBaremetalClusterDeleteParams, + cluster_delete_params.ClusterDeleteParams, ), ), cast_to=TaskIDList, @@ -390,7 +390,7 @@ def action( "action": action, "tags": tags, }, - gpu_baremetal_cluster_action_params.GPUBaremetalClusterActionParams, + cluster_action_params.ClusterActionParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -573,7 +573,7 @@ def rebuild( "image_id": image_id, "user_data": user_data, }, - gpu_baremetal_cluster_rebuild_params.GPUBaremetalClusterRebuildParams, + cluster_rebuild_params.ClusterRebuildParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -619,10 +619,7 @@ def resize( raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", - body=maybe_transform( - {"instances_count": instances_count}, - gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, - ), + body=maybe_transform({"instances_count": instances_count}, cluster_resize_params.ClusterResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -630,7 +627,7 @@ def resize( ) -class AsyncGPUBaremetalClustersResource(AsyncAPIResource): +class AsyncClustersResource(AsyncAPIResource): @cached_property def interfaces(self) -> AsyncInterfacesResource: return AsyncInterfacesResource(self._client) @@ -648,23 +645,23 @@ def images(self) -> AsyncImagesResource: return AsyncImagesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncGPUBaremetalClustersResourceWithRawResponse: + def with_raw_response(self) -> AsyncClustersResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ - return AsyncGPUBaremetalClustersResourceWithRawResponse(self) + return AsyncClustersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncGPUBaremetalClustersResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncClustersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ - return AsyncGPUBaremetalClustersResourceWithStreamingResponse(self) + return AsyncClustersResourceWithStreamingResponse(self) async def create( self, @@ -675,7 +672,7 @@ async def create( image_id: str, name: str, servers_count: int, - servers_settings: gpu_baremetal_cluster_create_params.ServersSettings, + servers_settings: cluster_create_params.ServersSettings, tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -732,7 +729,7 @@ async def create( "servers_settings": servers_settings, "tags": tags, }, - gpu_baremetal_cluster_create_params.GPUBaremetalClusterCreateParams, + cluster_create_params.ClusterCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -799,7 +796,7 @@ def list( "managed_by": managed_by, "offset": offset, }, - gpu_baremetal_cluster_list_params.GPUBaremetalClusterListParams, + cluster_list_params.ClusterListParams, ), ), model=GPUBaremetalCluster, @@ -870,7 +867,7 @@ async def delete( "floating_ip_ids": floating_ip_ids, "reserved_fixed_ip_ids": reserved_fixed_ip_ids, }, - gpu_baremetal_cluster_delete_params.GPUBaremetalClusterDeleteParams, + cluster_delete_params.ClusterDeleteParams, ), ), cast_to=TaskIDList, @@ -953,7 +950,7 @@ async def action( "action": action, "tags": tags, }, - gpu_baremetal_cluster_action_params.GPUBaremetalClusterActionParams, + cluster_action_params.ClusterActionParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1136,7 +1133,7 @@ async def rebuild( "image_id": image_id, "user_data": user_data, }, - gpu_baremetal_cluster_rebuild_params.GPUBaremetalClusterRebuildParams, + cluster_rebuild_params.ClusterRebuildParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1183,8 +1180,7 @@ async def resize( return await self._post( f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=await async_maybe_transform( - {"instances_count": instances_count}, - gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, + {"instances_count": instances_count}, cluster_resize_params.ClusterResizeParams ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1193,197 +1189,197 @@ async def resize( ) -class GPUBaremetalClustersResourceWithRawResponse: - def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None: - self._gpu_baremetal_clusters = gpu_baremetal_clusters +class ClustersResourceWithRawResponse: + def __init__(self, clusters: ClustersResource) -> None: + self._clusters = clusters self.create = to_raw_response_wrapper( - gpu_baremetal_clusters.create, + clusters.create, ) self.list = to_raw_response_wrapper( - gpu_baremetal_clusters.list, + clusters.list, ) self.delete = to_raw_response_wrapper( - gpu_baremetal_clusters.delete, + clusters.delete, ) self.action = to_raw_response_wrapper( - gpu_baremetal_clusters.action, + clusters.action, ) self.get = to_raw_response_wrapper( - gpu_baremetal_clusters.get, + clusters.get, ) self.powercycle_all_servers = to_raw_response_wrapper( - gpu_baremetal_clusters.powercycle_all_servers, + clusters.powercycle_all_servers, ) self.reboot_all_servers = to_raw_response_wrapper( - gpu_baremetal_clusters.reboot_all_servers, + clusters.reboot_all_servers, ) self.rebuild = to_raw_response_wrapper( - gpu_baremetal_clusters.rebuild, + clusters.rebuild, ) self.resize = to_raw_response_wrapper( - gpu_baremetal_clusters.resize, + clusters.resize, ) @cached_property def interfaces(self) -> InterfacesResourceWithRawResponse: - return InterfacesResourceWithRawResponse(self._gpu_baremetal_clusters.interfaces) + return InterfacesResourceWithRawResponse(self._clusters.interfaces) @cached_property def servers(self) -> ServersResourceWithRawResponse: - return ServersResourceWithRawResponse(self._gpu_baremetal_clusters.servers) + return ServersResourceWithRawResponse(self._clusters.servers) @cached_property def flavors(self) -> FlavorsResourceWithRawResponse: - return FlavorsResourceWithRawResponse(self._gpu_baremetal_clusters.flavors) + return FlavorsResourceWithRawResponse(self._clusters.flavors) @cached_property def images(self) -> ImagesResourceWithRawResponse: - return ImagesResourceWithRawResponse(self._gpu_baremetal_clusters.images) + return ImagesResourceWithRawResponse(self._clusters.images) -class AsyncGPUBaremetalClustersResourceWithRawResponse: - def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> None: - self._gpu_baremetal_clusters = gpu_baremetal_clusters +class AsyncClustersResourceWithRawResponse: + def __init__(self, clusters: AsyncClustersResource) -> None: + self._clusters = clusters self.create = async_to_raw_response_wrapper( - gpu_baremetal_clusters.create, + clusters.create, ) self.list = async_to_raw_response_wrapper( - gpu_baremetal_clusters.list, + clusters.list, ) self.delete = async_to_raw_response_wrapper( - gpu_baremetal_clusters.delete, + clusters.delete, ) self.action = async_to_raw_response_wrapper( - gpu_baremetal_clusters.action, + clusters.action, ) self.get = async_to_raw_response_wrapper( - gpu_baremetal_clusters.get, + clusters.get, ) self.powercycle_all_servers = async_to_raw_response_wrapper( - gpu_baremetal_clusters.powercycle_all_servers, + clusters.powercycle_all_servers, ) self.reboot_all_servers = async_to_raw_response_wrapper( - gpu_baremetal_clusters.reboot_all_servers, + clusters.reboot_all_servers, ) self.rebuild = async_to_raw_response_wrapper( - gpu_baremetal_clusters.rebuild, + clusters.rebuild, ) self.resize = async_to_raw_response_wrapper( - gpu_baremetal_clusters.resize, + clusters.resize, ) @cached_property def interfaces(self) -> AsyncInterfacesResourceWithRawResponse: - return AsyncInterfacesResourceWithRawResponse(self._gpu_baremetal_clusters.interfaces) + return AsyncInterfacesResourceWithRawResponse(self._clusters.interfaces) @cached_property def servers(self) -> AsyncServersResourceWithRawResponse: - return AsyncServersResourceWithRawResponse(self._gpu_baremetal_clusters.servers) + return AsyncServersResourceWithRawResponse(self._clusters.servers) @cached_property def flavors(self) -> AsyncFlavorsResourceWithRawResponse: - return AsyncFlavorsResourceWithRawResponse(self._gpu_baremetal_clusters.flavors) + return AsyncFlavorsResourceWithRawResponse(self._clusters.flavors) @cached_property def images(self) -> AsyncImagesResourceWithRawResponse: - return AsyncImagesResourceWithRawResponse(self._gpu_baremetal_clusters.images) + return AsyncImagesResourceWithRawResponse(self._clusters.images) -class GPUBaremetalClustersResourceWithStreamingResponse: - def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None: - self._gpu_baremetal_clusters = gpu_baremetal_clusters +class ClustersResourceWithStreamingResponse: + def __init__(self, clusters: ClustersResource) -> None: + self._clusters = clusters self.create = to_streamed_response_wrapper( - gpu_baremetal_clusters.create, + clusters.create, ) self.list = to_streamed_response_wrapper( - gpu_baremetal_clusters.list, + clusters.list, ) self.delete = to_streamed_response_wrapper( - gpu_baremetal_clusters.delete, + clusters.delete, ) self.action = to_streamed_response_wrapper( - gpu_baremetal_clusters.action, + clusters.action, ) self.get = to_streamed_response_wrapper( - gpu_baremetal_clusters.get, + clusters.get, ) self.powercycle_all_servers = to_streamed_response_wrapper( - gpu_baremetal_clusters.powercycle_all_servers, + clusters.powercycle_all_servers, ) self.reboot_all_servers = to_streamed_response_wrapper( - gpu_baremetal_clusters.reboot_all_servers, + clusters.reboot_all_servers, ) self.rebuild = to_streamed_response_wrapper( - gpu_baremetal_clusters.rebuild, + clusters.rebuild, ) self.resize = to_streamed_response_wrapper( - gpu_baremetal_clusters.resize, + clusters.resize, ) @cached_property def interfaces(self) -> InterfacesResourceWithStreamingResponse: - return InterfacesResourceWithStreamingResponse(self._gpu_baremetal_clusters.interfaces) + return InterfacesResourceWithStreamingResponse(self._clusters.interfaces) @cached_property def servers(self) -> ServersResourceWithStreamingResponse: - return ServersResourceWithStreamingResponse(self._gpu_baremetal_clusters.servers) + return ServersResourceWithStreamingResponse(self._clusters.servers) @cached_property def flavors(self) -> FlavorsResourceWithStreamingResponse: - return FlavorsResourceWithStreamingResponse(self._gpu_baremetal_clusters.flavors) + return FlavorsResourceWithStreamingResponse(self._clusters.flavors) @cached_property def images(self) -> ImagesResourceWithStreamingResponse: - return ImagesResourceWithStreamingResponse(self._gpu_baremetal_clusters.images) + return ImagesResourceWithStreamingResponse(self._clusters.images) -class AsyncGPUBaremetalClustersResourceWithStreamingResponse: - def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> None: - self._gpu_baremetal_clusters = gpu_baremetal_clusters +class AsyncClustersResourceWithStreamingResponse: + def __init__(self, clusters: AsyncClustersResource) -> None: + self._clusters = clusters self.create = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.create, + clusters.create, ) self.list = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.list, + clusters.list, ) self.delete = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.delete, + clusters.delete, ) self.action = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.action, + clusters.action, ) self.get = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.get, + clusters.get, ) self.powercycle_all_servers = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.powercycle_all_servers, + clusters.powercycle_all_servers, ) self.reboot_all_servers = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.reboot_all_servers, + clusters.reboot_all_servers, ) self.rebuild = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.rebuild, + clusters.rebuild, ) self.resize = async_to_streamed_response_wrapper( - gpu_baremetal_clusters.resize, + clusters.resize, ) @cached_property def interfaces(self) -> AsyncInterfacesResourceWithStreamingResponse: - return AsyncInterfacesResourceWithStreamingResponse(self._gpu_baremetal_clusters.interfaces) + return AsyncInterfacesResourceWithStreamingResponse(self._clusters.interfaces) @cached_property def servers(self) -> AsyncServersResourceWithStreamingResponse: - return AsyncServersResourceWithStreamingResponse(self._gpu_baremetal_clusters.servers) + return AsyncServersResourceWithStreamingResponse(self._clusters.servers) @cached_property def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse: - return AsyncFlavorsResourceWithStreamingResponse(self._gpu_baremetal_clusters.flavors) + return AsyncFlavorsResourceWithStreamingResponse(self._clusters.flavors) @cached_property def images(self) -> AsyncImagesResourceWithStreamingResponse: - return AsyncImagesResourceWithStreamingResponse(self._gpu_baremetal_clusters.images) + return AsyncImagesResourceWithStreamingResponse(self._clusters.images) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal/clusters/flavors.py similarity index 93% rename from src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py rename to src/gcore/resources/cloud/gpu_baremetal/clusters/flavors.py index 19df3189..486250ea 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal/clusters/flavors.py @@ -4,19 +4,19 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.gpu_baremetal_clusters import flavor_list_params -from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_flavor_list import GPUBaremetalFlavorList +from ....._base_client import make_request_options +from .....types.cloud.gpu_baremetal.clusters import flavor_list_params +from .....types.cloud.gpu_baremetal.clusters.gpu_baremetal_flavor_list import GPUBaremetalFlavorList __all__ = ["FlavorsResource", "AsyncFlavorsResource"] diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal/clusters/images.py similarity index 97% rename from src/gcore/resources/cloud/gpu_baremetal_clusters/images.py rename to src/gcore/resources/cloud/gpu_baremetal/clusters/images.py index 66f405cd..c30ce40a 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal/clusters/images.py @@ -7,21 +7,21 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.gpu_image import GPUImage -from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.gpu_image_list import GPUImageList -from ....types.cloud.gpu_baremetal_clusters import image_upload_params +from ....._base_client import make_request_options +from .....types.cloud.gpu_image import GPUImage +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.gpu_image_list import GPUImageList +from .....types.cloud.gpu_baremetal.clusters import image_upload_params __all__ = ["ImagesResource", "AsyncImagesResource"] diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal/clusters/interfaces.py similarity index 98% rename from src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py rename to src/gcore/resources/cloud/gpu_baremetal/clusters/interfaces.py index f7c10022..0b4d0768 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal/clusters/interfaces.py @@ -7,20 +7,20 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.gpu_baremetal_clusters import interface_attach_params, interface_detach_params -from ....types.cloud.network_interface_list import NetworkInterfaceList +from ....._base_client import make_request_options +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.gpu_baremetal.clusters import interface_attach_params, interface_detach_params +from .....types.cloud.network_interface_list import NetworkInterfaceList __all__ = ["InterfacesResource", "AsyncInterfacesResource"] diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal/clusters/servers.py similarity index 97% rename from src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py rename to src/gcore/resources/cloud/gpu_baremetal/clusters/servers.py index 898b4d66..36f89dd7 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal/clusters/servers.py @@ -8,23 +8,23 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ...._base_client import AsyncPaginator, make_request_options -from ....types.cloud.console import Console -from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.gpu_baremetal_clusters import server_list_params, server_delete_params -from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_cluster_server import GPUBaremetalClusterServer -from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_cluster_server_v1 import GPUBaremetalClusterServerV1 +from .....pagination import SyncOffsetPage, AsyncOffsetPage +from ....._base_client import AsyncPaginator, make_request_options +from .....types.cloud.console import Console +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.gpu_baremetal.clusters import server_list_params, server_delete_params +from .....types.cloud.gpu_baremetal.clusters.gpu_baremetal_cluster_server import GPUBaremetalClusterServer +from .....types.cloud.gpu_baremetal.clusters.gpu_baremetal_cluster_server_v1 import GPUBaremetalClusterServerV1 __all__ = ["ServersResource", "AsyncServersResource"] diff --git a/src/gcore/resources/cloud/gpu_baremetal/gpu_baremetal.py b/src/gcore/resources/cloud/gpu_baremetal/gpu_baremetal.py new file mode 100644 index 00000000..b752dffd --- /dev/null +++ b/src/gcore/resources/cloud/gpu_baremetal/gpu_baremetal.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from .clusters.clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) + +__all__ = ["GPUBaremetalResource", "AsyncGPUBaremetalResource"] + + +class GPUBaremetalResource(SyncAPIResource): + @cached_property + def clusters(self) -> ClustersResource: + return ClustersResource(self._client) + + @cached_property + def with_raw_response(self) -> GPUBaremetalResourceWithRawResponse: + """ + 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 GPUBaremetalResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> GPUBaremetalResourceWithStreamingResponse: + """ + 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 GPUBaremetalResourceWithStreamingResponse(self) + + +class AsyncGPUBaremetalResource(AsyncAPIResource): + @cached_property + def clusters(self) -> AsyncClustersResource: + return AsyncClustersResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncGPUBaremetalResourceWithRawResponse: + """ + 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 AsyncGPUBaremetalResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncGPUBaremetalResourceWithStreamingResponse: + """ + 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 AsyncGPUBaremetalResourceWithStreamingResponse(self) + + +class GPUBaremetalResourceWithRawResponse: + def __init__(self, gpu_baremetal: GPUBaremetalResource) -> None: + self._gpu_baremetal = gpu_baremetal + + @cached_property + def clusters(self) -> ClustersResourceWithRawResponse: + return ClustersResourceWithRawResponse(self._gpu_baremetal.clusters) + + +class AsyncGPUBaremetalResourceWithRawResponse: + def __init__(self, gpu_baremetal: AsyncGPUBaremetalResource) -> None: + self._gpu_baremetal = gpu_baremetal + + @cached_property + def clusters(self) -> AsyncClustersResourceWithRawResponse: + return AsyncClustersResourceWithRawResponse(self._gpu_baremetal.clusters) + + +class GPUBaremetalResourceWithStreamingResponse: + def __init__(self, gpu_baremetal: GPUBaremetalResource) -> None: + self._gpu_baremetal = gpu_baremetal + + @cached_property + def clusters(self) -> ClustersResourceWithStreamingResponse: + return ClustersResourceWithStreamingResponse(self._gpu_baremetal.clusters) + + +class AsyncGPUBaremetalResourceWithStreamingResponse: + def __init__(self, gpu_baremetal: AsyncGPUBaremetalResource) -> None: + self._gpu_baremetal = gpu_baremetal + + @cached_property + def clusters(self) -> AsyncClustersResourceWithStreamingResponse: + return AsyncClustersResourceWithStreamingResponse(self._gpu_baremetal.clusters) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 0503e14b..bac65886 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -88,7 +88,6 @@ from .audit_log_list_params import AuditLogListParams as AuditLogListParams from .baremetal_flavor_list import BaremetalFlavorList as BaremetalFlavorList from .ddos_profile_template import DDOSProfileTemplate as DDOSProfileTemplate -from .gpu_baremetal_cluster import GPUBaremetalCluster as GPUBaremetalCluster from .health_monitor_status import HealthMonitorStatus as HealthMonitorStatus from .load_balancer_l7_rule import LoadBalancerL7Rule as LoadBalancerL7Rule from .load_balancer_metrics import LoadBalancerMetrics as LoadBalancerMetrics @@ -164,15 +163,9 @@ from .reserved_fixed_ip_update_params import ReservedFixedIPUpdateParams as ReservedFixedIPUpdateParams from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams from .cost_report_get_aggregated_params import CostReportGetAggregatedParams as CostReportGetAggregatedParams -from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams -from .gpu_baremetal_cluster_action_params import GPUBaremetalClusterActionParams as GPUBaremetalClusterActionParams -from .gpu_baremetal_cluster_create_params import GPUBaremetalClusterCreateParams as GPUBaremetalClusterCreateParams -from .gpu_baremetal_cluster_delete_params import GPUBaremetalClusterDeleteParams as GPUBaremetalClusterDeleteParams -from .gpu_baremetal_cluster_resize_params import GPUBaremetalClusterResizeParams as GPUBaremetalClusterResizeParams -from .gpu_baremetal_cluster_rebuild_params import GPUBaremetalClusterRebuildParams as GPUBaremetalClusterRebuildParams from .secret_upload_tls_certificate_params import SecretUploadTlsCertificateParams as SecretUploadTlsCertificateParams from .instance_assign_security_group_params import ( InstanceAssignSecurityGroupParams as InstanceAssignSecurityGroupParams, diff --git a/src/gcore/types/cloud/gpu_baremetal/__init__.py b/src/gcore/types/cloud/gpu_baremetal/__init__.py new file mode 100644 index 00000000..baff756f --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal/__init__.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .cluster_list_params import ClusterListParams as ClusterListParams +from .cluster_action_params import ClusterActionParams as ClusterActionParams +from .cluster_create_params import ClusterCreateParams as ClusterCreateParams +from .cluster_delete_params import ClusterDeleteParams as ClusterDeleteParams +from .cluster_resize_params import ClusterResizeParams as ClusterResizeParams +from .gpu_baremetal_cluster import GPUBaremetalCluster as GPUBaremetalCluster +from .cluster_rebuild_params import ClusterRebuildParams as ClusterRebuildParams diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py b/src/gcore/types/cloud/gpu_baremetal/cluster_action_params.py similarity index 90% rename from src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py rename to src/gcore/types/cloud/gpu_baremetal/cluster_action_params.py index 506d3619..95167930 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/cluster_action_params.py @@ -5,12 +5,12 @@ from typing import Optional from typing_extensions import Literal, Required, TypedDict -from .tag_update_map_param import TagUpdateMapParam +from ..tag_update_map_param import TagUpdateMapParam -__all__ = ["GPUBaremetalClusterActionParams"] +__all__ = ["ClusterActionParams"] -class GPUBaremetalClusterActionParams(TypedDict, total=False): +class ClusterActionParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py b/src/gcore/types/cloud/gpu_baremetal/cluster_create_params.py similarity index 98% rename from src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py rename to src/gcore/types/cloud/gpu_baremetal/cluster_create_params.py index 4bc1ea85..7e407d87 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/cluster_create_params.py @@ -6,7 +6,7 @@ from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ - "GPUBaremetalClusterCreateParams", + "ClusterCreateParams", "ServersSettings", "ServersSettingsInterface", "ServersSettingsInterfaceExternalInterfaceInputSerializer", @@ -20,7 +20,7 @@ ] -class GPUBaremetalClusterCreateParams(TypedDict, total=False): +class ClusterCreateParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py b/src/gcore/types/cloud/gpu_baremetal/cluster_delete_params.py similarity index 83% rename from src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py rename to src/gcore/types/cloud/gpu_baremetal/cluster_delete_params.py index dc737d14..97104a24 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_delete_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/cluster_delete_params.py @@ -4,12 +4,12 @@ from typing_extensions import TypedDict -from ..._types import SequenceNotStr +from ...._types import SequenceNotStr -__all__ = ["GPUBaremetalClusterDeleteParams"] +__all__ = ["ClusterDeleteParams"] -class GPUBaremetalClusterDeleteParams(TypedDict, total=False): +class ClusterDeleteParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py b/src/gcore/types/cloud/gpu_baremetal/cluster_list_params.py similarity index 86% rename from src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py rename to src/gcore/types/cloud/gpu_baremetal/cluster_list_params.py index 8112f690..c96a3a7e 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_list_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/cluster_list_params.py @@ -5,10 +5,10 @@ from typing import List from typing_extensions import Literal, TypedDict -__all__ = ["GPUBaremetalClusterListParams"] +__all__ = ["ClusterListParams"] -class GPUBaremetalClusterListParams(TypedDict, total=False): +class ClusterListParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py b/src/gcore/types/cloud/gpu_baremetal/cluster_rebuild_params.py similarity index 79% rename from src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py rename to src/gcore/types/cloud/gpu_baremetal/cluster_rebuild_params.py index f4d27f43..f9fe6f9d 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/cluster_rebuild_params.py @@ -5,12 +5,12 @@ from typing import Optional from typing_extensions import Required, TypedDict -from ..._types import SequenceNotStr +from ...._types import SequenceNotStr -__all__ = ["GPUBaremetalClusterRebuildParams"] +__all__ = ["ClusterRebuildParams"] -class GPUBaremetalClusterRebuildParams(TypedDict, total=False): +class ClusterRebuildParams(TypedDict, total=False): project_id: int region_id: int diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py b/src/gcore/types/cloud/gpu_baremetal/cluster_resize_params.py similarity index 73% rename from src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py rename to src/gcore/types/cloud/gpu_baremetal/cluster_resize_params.py index 9f8b0391..cb9f2211 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_resize_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/cluster_resize_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["GPUBaremetalClusterResizeParams"] +__all__ = ["ClusterResizeParams"] -class GPUBaremetalClusterResizeParams(TypedDict, total=False): +class ClusterResizeParams(TypedDict, total=False): project_id: int region_id: int diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py b/src/gcore/types/cloud/gpu_baremetal/clusters/__init__.py similarity index 100% rename from src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py rename to src/gcore/types/cloud/gpu_baremetal/clusters/__init__.py diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py b/src/gcore/types/cloud/gpu_baremetal/clusters/flavor_list_params.py similarity index 100% rename from src/gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py rename to src/gcore/types/cloud/gpu_baremetal/clusters/flavor_list_params.py diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py b/src/gcore/types/cloud/gpu_baremetal/clusters/gpu_baremetal_cluster_server.py similarity index 96% rename from src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py rename to src/gcore/types/cloud/gpu_baremetal/clusters/gpu_baremetal_cluster_server.py index d2e11700..ff1e581f 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py +++ b/src/gcore/types/cloud/gpu_baremetal/clusters/gpu_baremetal_cluster_server.py @@ -4,8 +4,8 @@ from datetime import datetime from typing_extensions import Literal -from ..tag import Tag -from ...._models import BaseModel +from ...tag import Tag +from ....._models import BaseModel __all__ = ["GPUBaremetalClusterServer", "SecurityGroup"] 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 similarity index 93% rename from src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1.py rename to src/gcore/types/cloud/gpu_baremetal/clusters/gpu_baremetal_cluster_server_v1.py index 171a164a..9e44be1e 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 @@ -4,14 +4,14 @@ from datetime import datetime from typing_extensions import Literal, TypeAlias -from ..tag import Tag -from ...._models import BaseModel -from ..ddos_profile import DDOSProfile -from ..fixed_address import FixedAddress -from ..blackhole_port import BlackholePort -from ..floating_address import FloatingAddress -from ..instance_isolation import InstanceIsolation -from ..fixed_address_short import FixedAddressShort +from ...tag import Tag +from ....._models import BaseModel +from ...ddos_profile import DDOSProfile +from ...fixed_address import FixedAddress +from ...blackhole_port import BlackholePort +from ...floating_address import FloatingAddress +from ...instance_isolation import InstanceIsolation +from ...fixed_address_short import FixedAddressShort __all__ = [ "GPUBaremetalClusterServerV1", diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1_list.py b/src/gcore/types/cloud/gpu_baremetal/clusters/gpu_baremetal_cluster_server_v1_list.py similarity index 91% rename from src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1_list.py rename to src/gcore/types/cloud/gpu_baremetal/clusters/gpu_baremetal_cluster_server_v1_list.py index a6c6a2f2..b3599d3a 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1_list.py +++ b/src/gcore/types/cloud/gpu_baremetal/clusters/gpu_baremetal_cluster_server_v1_list.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel from .gpu_baremetal_cluster_server_v1 import GPUBaremetalClusterServerV1 __all__ = ["GPUBaremetalClusterServerV1List"] 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 similarity index 99% rename from src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor.py rename to src/gcore/types/cloud/gpu_baremetal/clusters/gpu_baremetal_flavor.py index bca6570c..be48dcf7 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 @@ -3,7 +3,7 @@ from typing import Union, Optional from typing_extensions import Literal, TypeAlias -from ...._models import BaseModel +from ....._models import BaseModel __all__ = [ "GPUBaremetalFlavor", diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor_list.py b/src/gcore/types/cloud/gpu_baremetal/clusters/gpu_baremetal_flavor_list.py similarity index 90% rename from src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor_list.py rename to src/gcore/types/cloud/gpu_baremetal/clusters/gpu_baremetal_flavor_list.py index 2cc4ee84..785daffd 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor_list.py +++ b/src/gcore/types/cloud/gpu_baremetal/clusters/gpu_baremetal_flavor_list.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel from .gpu_baremetal_flavor import GPUBaremetalFlavor __all__ = ["GPUBaremetalFlavorList"] diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_baremetal/clusters/image_upload_params.py similarity index 100% rename from src/gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py rename to src/gcore/types/cloud/gpu_baremetal/clusters/image_upload_params.py diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/interface_attach_params.py b/src/gcore/types/cloud/gpu_baremetal/clusters/interface_attach_params.py similarity index 100% rename from src/gcore/types/cloud/gpu_baremetal_clusters/interface_attach_params.py rename to src/gcore/types/cloud/gpu_baremetal/clusters/interface_attach_params.py diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/interface_detach_params.py b/src/gcore/types/cloud/gpu_baremetal/clusters/interface_detach_params.py similarity index 100% rename from src/gcore/types/cloud/gpu_baremetal_clusters/interface_detach_params.py rename to src/gcore/types/cloud/gpu_baremetal/clusters/interface_detach_params.py diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py b/src/gcore/types/cloud/gpu_baremetal/clusters/server_delete_params.py similarity index 100% rename from src/gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py rename to src/gcore/types/cloud/gpu_baremetal/clusters/server_delete_params.py diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_list_params.py b/src/gcore/types/cloud/gpu_baremetal/clusters/server_list_params.py similarity index 96% rename from src/gcore/types/cloud/gpu_baremetal_clusters/server_list_params.py rename to src/gcore/types/cloud/gpu_baremetal/clusters/server_list_params.py index 35c7f374..89f4cb6d 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/server_list_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/clusters/server_list_params.py @@ -6,8 +6,8 @@ from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict -from ...._types import SequenceNotStr -from ...._utils import PropertyInfo +from ....._types import SequenceNotStr +from ....._utils import PropertyInfo __all__ = ["ServerListParams"] diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal/gpu_baremetal_cluster.py similarity index 98% rename from src/gcore/types/cloud/gpu_baremetal_cluster.py rename to src/gcore/types/cloud/gpu_baremetal/gpu_baremetal_cluster.py index bfbdff15..17cfcf4e 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal/gpu_baremetal_cluster.py @@ -4,9 +4,9 @@ from datetime import datetime from typing_extensions import Literal, Annotated, TypeAlias -from .tag import Tag -from ..._utils import PropertyInfo -from ..._models import BaseModel +from ..tag import Tag +from ...._utils import PropertyInfo +from ...._models import BaseModel __all__ = [ "GPUBaremetalCluster", diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/__init__.py b/tests/api_resources/cloud/gpu_baremetal/__init__.py similarity index 100% rename from tests/api_resources/cloud/gpu_baremetal_clusters/__init__.py rename to tests/api_resources/cloud/gpu_baremetal/__init__.py diff --git a/tests/api_resources/cloud/gpu_baremetal/clusters/__init__.py b/tests/api_resources/cloud/gpu_baremetal/clusters/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/gpu_baremetal/clusters/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py b/tests/api_resources/cloud/gpu_baremetal/clusters/test_flavors.py similarity index 86% rename from tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py rename to tests/api_resources/cloud/gpu_baremetal/clusters/test_flavors.py index 9cb9018c..b19b4b99 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_flavors.py +++ b/tests/api_resources/cloud/gpu_baremetal/clusters/test_flavors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.gpu_baremetal_clusters import GPUBaremetalFlavorList +from gcore.types.cloud.gpu_baremetal.clusters import GPUBaremetalFlavorList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,7 +19,7 @@ class TestFlavors: @parametrize def test_method_list(self, client: Gcore) -> None: - flavor = client.cloud.gpu_baremetal_clusters.flavors.list( + flavor = client.cloud.gpu_baremetal.clusters.flavors.list( project_id=1, region_id=7, ) @@ -27,7 +27,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - flavor = client.cloud.gpu_baremetal_clusters.flavors.list( + flavor = client.cloud.gpu_baremetal.clusters.flavors.list( project_id=1, region_id=7, hide_disabled=True, @@ -37,7 +37,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.flavors.with_raw_response.list( + response = client.cloud.gpu_baremetal.clusters.flavors.with_raw_response.list( project_id=1, region_id=7, ) @@ -49,7 +49,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.flavors.with_streaming_response.list( + with client.cloud.gpu_baremetal.clusters.flavors.with_streaming_response.list( project_id=1, region_id=7, ) as response: @@ -69,7 +69,7 @@ class TestAsyncFlavors: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - flavor = await async_client.cloud.gpu_baremetal_clusters.flavors.list( + flavor = await async_client.cloud.gpu_baremetal.clusters.flavors.list( project_id=1, region_id=7, ) @@ -77,7 +77,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - flavor = await async_client.cloud.gpu_baremetal_clusters.flavors.list( + flavor = await async_client.cloud.gpu_baremetal.clusters.flavors.list( project_id=1, region_id=7, hide_disabled=True, @@ -87,7 +87,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.flavors.with_raw_response.list( + response = await async_client.cloud.gpu_baremetal.clusters.flavors.with_raw_response.list( project_id=1, region_id=7, ) @@ -99,7 +99,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.flavors.with_streaming_response.list( + async with async_client.cloud.gpu_baremetal.clusters.flavors.with_streaming_response.list( project_id=1, region_id=7, ) as response: diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py b/tests/api_resources/cloud/gpu_baremetal/clusters/test_images.py similarity index 87% rename from tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py rename to tests/api_resources/cloud/gpu_baremetal/clusters/test_images.py index e9f6c63f..3657deea 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_images.py +++ b/tests/api_resources/cloud/gpu_baremetal/clusters/test_images.py @@ -19,7 +19,7 @@ class TestImages: @parametrize def test_method_list(self, client: Gcore) -> None: - image = client.cloud.gpu_baremetal_clusters.images.list( + image = client.cloud.gpu_baremetal.clusters.images.list( project_id=1, region_id=7, ) @@ -27,7 +27,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.images.with_raw_response.list( + response = client.cloud.gpu_baremetal.clusters.images.with_raw_response.list( project_id=1, region_id=7, ) @@ -39,7 +39,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.images.with_streaming_response.list( + with client.cloud.gpu_baremetal.clusters.images.with_streaming_response.list( project_id=1, region_id=7, ) as response: @@ -53,7 +53,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: - image = client.cloud.gpu_baremetal_clusters.images.delete( + image = client.cloud.gpu_baremetal.clusters.images.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -62,7 +62,7 @@ def test_method_delete(self, client: Gcore) -> None: @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.images.with_raw_response.delete( + response = client.cloud.gpu_baremetal.clusters.images.with_raw_response.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -75,7 +75,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.images.with_streaming_response.delete( + with client.cloud.gpu_baremetal.clusters.images.with_streaming_response.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -91,7 +91,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): - client.cloud.gpu_baremetal_clusters.images.with_raw_response.delete( + client.cloud.gpu_baremetal.clusters.images.with_raw_response.delete( image_id="", project_id=1, region_id=7, @@ -99,7 +99,7 @@ def test_path_params_delete(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: - image = client.cloud.gpu_baremetal_clusters.images.get( + image = client.cloud.gpu_baremetal.clusters.images.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -108,7 +108,7 @@ def test_method_get(self, client: Gcore) -> None: @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.images.with_raw_response.get( + response = client.cloud.gpu_baremetal.clusters.images.with_raw_response.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -121,7 +121,7 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.images.with_streaming_response.get( + with client.cloud.gpu_baremetal.clusters.images.with_streaming_response.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -137,7 +137,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: @parametrize def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): - client.cloud.gpu_baremetal_clusters.images.with_raw_response.get( + client.cloud.gpu_baremetal.clusters.images.with_raw_response.get( image_id="", project_id=1, region_id=7, @@ -145,7 +145,7 @@ def test_path_params_get(self, client: Gcore) -> None: @parametrize def test_method_upload(self, client: Gcore) -> None: - image = client.cloud.gpu_baremetal_clusters.images.upload( + image = client.cloud.gpu_baremetal.clusters.images.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -155,7 +155,7 @@ def test_method_upload(self, client: Gcore) -> None: @parametrize def test_method_upload_with_all_params(self, client: Gcore) -> None: - image = client.cloud.gpu_baremetal_clusters.images.upload( + image = client.cloud.gpu_baremetal.clusters.images.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -173,7 +173,7 @@ def test_method_upload_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_upload(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.images.with_raw_response.upload( + response = client.cloud.gpu_baremetal.clusters.images.with_raw_response.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -187,7 +187,7 @@ def test_raw_response_upload(self, client: Gcore) -> None: @parametrize def test_streaming_response_upload(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.images.with_streaming_response.upload( + with client.cloud.gpu_baremetal.clusters.images.with_streaming_response.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -209,7 +209,7 @@ class TestAsyncImages: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_baremetal_clusters.images.list( + image = await async_client.cloud.gpu_baremetal.clusters.images.list( project_id=1, region_id=7, ) @@ -217,7 +217,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.images.with_raw_response.list( + response = await async_client.cloud.gpu_baremetal.clusters.images.with_raw_response.list( project_id=1, region_id=7, ) @@ -229,7 +229,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.images.with_streaming_response.list( + async with async_client.cloud.gpu_baremetal.clusters.images.with_streaming_response.list( project_id=1, region_id=7, ) as response: @@ -243,7 +243,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_baremetal_clusters.images.delete( + image = await async_client.cloud.gpu_baremetal.clusters.images.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -252,7 +252,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.images.with_raw_response.delete( + response = await async_client.cloud.gpu_baremetal.clusters.images.with_raw_response.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -265,7 +265,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.images.with_streaming_response.delete( + async with async_client.cloud.gpu_baremetal.clusters.images.with_streaming_response.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -281,7 +281,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.images.with_raw_response.delete( + await async_client.cloud.gpu_baremetal.clusters.images.with_raw_response.delete( image_id="", project_id=1, region_id=7, @@ -289,7 +289,7 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_baremetal_clusters.images.get( + image = await async_client.cloud.gpu_baremetal.clusters.images.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -298,7 +298,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.images.with_raw_response.get( + response = await async_client.cloud.gpu_baremetal.clusters.images.with_raw_response.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -311,7 +311,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.images.with_streaming_response.get( + async with async_client.cloud.gpu_baremetal.clusters.images.with_streaming_response.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -327,7 +327,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.images.with_raw_response.get( + await async_client.cloud.gpu_baremetal.clusters.images.with_raw_response.get( image_id="", project_id=1, region_id=7, @@ -335,7 +335,7 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_upload(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_baremetal_clusters.images.upload( + image = await async_client.cloud.gpu_baremetal.clusters.images.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -345,7 +345,7 @@ async def test_method_upload(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_baremetal_clusters.images.upload( + image = await async_client.cloud.gpu_baremetal.clusters.images.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -363,7 +363,7 @@ async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_upload(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.images.with_raw_response.upload( + response = await async_client.cloud.gpu_baremetal.clusters.images.with_raw_response.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -377,7 +377,7 @@ async def test_raw_response_upload(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_upload(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.images.with_streaming_response.upload( + async with async_client.cloud.gpu_baremetal.clusters.images.with_streaming_response.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py b/tests/api_resources/cloud/gpu_baremetal/clusters/test_interfaces.py similarity index 89% rename from tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py rename to tests/api_resources/cloud/gpu_baremetal/clusters/test_interfaces.py index 0afb78c8..de330f4d 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py +++ b/tests/api_resources/cloud/gpu_baremetal/clusters/test_interfaces.py @@ -19,7 +19,7 @@ class TestInterfaces: @parametrize def test_method_list(self, client: Gcore) -> None: - interface = client.cloud.gpu_baremetal_clusters.interfaces.list( + interface = client.cloud.gpu_baremetal.clusters.interfaces.list( cluster_id="cluster_id", project_id=0, region_id=0, @@ -28,7 +28,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.list( + response = client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.list( cluster_id="cluster_id", project_id=0, region_id=0, @@ -41,7 +41,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.list( + with client.cloud.gpu_baremetal.clusters.interfaces.with_streaming_response.list( cluster_id="cluster_id", project_id=0, region_id=0, @@ -57,7 +57,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.list( + client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.list( cluster_id="", project_id=0, region_id=0, @@ -65,7 +65,7 @@ def test_path_params_list(self, client: Gcore) -> None: @parametrize def test_method_attach_overload_1(self, client: Gcore) -> None: - interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -74,7 +74,7 @@ def test_method_attach_overload_1(self, client: Gcore) -> None: @parametrize def test_method_attach_with_all_params_overload_1(self, client: Gcore) -> None: - interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -103,7 +103,7 @@ def test_method_attach_with_all_params_overload_1(self, client: Gcore) -> None: @parametrize def test_raw_response_attach_overload_1(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + response = client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -116,7 +116,7 @@ def test_raw_response_attach_overload_1(self, client: Gcore) -> None: @parametrize def test_streaming_response_attach_overload_1(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + with client.cloud.gpu_baremetal.clusters.interfaces.with_streaming_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -132,7 +132,7 @@ def test_streaming_response_attach_overload_1(self, client: Gcore) -> None: @parametrize def test_path_params_attach_overload_1(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="", project_id=0, region_id=0, @@ -140,7 +140,7 @@ def test_path_params_attach_overload_1(self, client: Gcore) -> None: @parametrize def test_method_attach_overload_2(self, client: Gcore) -> None: - interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -150,7 +150,7 @@ def test_method_attach_overload_2(self, client: Gcore) -> None: @parametrize def test_method_attach_with_all_params_overload_2(self, client: Gcore) -> None: - interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -179,7 +179,7 @@ def test_method_attach_with_all_params_overload_2(self, client: Gcore) -> None: @parametrize def test_raw_response_attach_overload_2(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + response = client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -193,7 +193,7 @@ def test_raw_response_attach_overload_2(self, client: Gcore) -> None: @parametrize def test_streaming_response_attach_overload_2(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + with client.cloud.gpu_baremetal.clusters.interfaces.with_streaming_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -210,7 +210,7 @@ def test_streaming_response_attach_overload_2(self, client: Gcore) -> None: @parametrize def test_path_params_attach_overload_2(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="", project_id=0, region_id=0, @@ -219,7 +219,7 @@ def test_path_params_attach_overload_2(self, client: Gcore) -> None: @parametrize def test_method_attach_overload_3(self, client: Gcore) -> None: - interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -229,7 +229,7 @@ def test_method_attach_overload_3(self, client: Gcore) -> None: @parametrize def test_method_attach_with_all_params_overload_3(self, client: Gcore) -> None: - interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -259,7 +259,7 @@ def test_method_attach_with_all_params_overload_3(self, client: Gcore) -> None: @parametrize def test_raw_response_attach_overload_3(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + response = client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -273,7 +273,7 @@ def test_raw_response_attach_overload_3(self, client: Gcore) -> None: @parametrize def test_streaming_response_attach_overload_3(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + with client.cloud.gpu_baremetal.clusters.interfaces.with_streaming_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -290,7 +290,7 @@ def test_streaming_response_attach_overload_3(self, client: Gcore) -> None: @parametrize def test_path_params_attach_overload_3(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="", project_id=0, region_id=0, @@ -299,7 +299,7 @@ def test_path_params_attach_overload_3(self, client: Gcore) -> None: @parametrize def test_method_attach_overload_4(self, client: Gcore) -> None: - interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -309,7 +309,7 @@ def test_method_attach_overload_4(self, client: Gcore) -> None: @parametrize def test_method_attach_with_all_params_overload_4(self, client: Gcore) -> None: - interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -338,7 +338,7 @@ def test_method_attach_with_all_params_overload_4(self, client: Gcore) -> None: @parametrize def test_raw_response_attach_overload_4(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + response = client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -352,7 +352,7 @@ def test_raw_response_attach_overload_4(self, client: Gcore) -> None: @parametrize def test_streaming_response_attach_overload_4(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + with client.cloud.gpu_baremetal.clusters.interfaces.with_streaming_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -369,7 +369,7 @@ def test_streaming_response_attach_overload_4(self, client: Gcore) -> None: @parametrize def test_path_params_attach_overload_4(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="", project_id=0, region_id=0, @@ -378,7 +378,7 @@ def test_path_params_attach_overload_4(self, client: Gcore) -> None: @parametrize def test_method_detach(self, client: Gcore) -> None: - interface = client.cloud.gpu_baremetal_clusters.interfaces.detach( + interface = client.cloud.gpu_baremetal.clusters.interfaces.detach( instance_id="instance_id", project_id=0, region_id=0, @@ -389,7 +389,7 @@ def test_method_detach(self, client: Gcore) -> None: @parametrize def test_raw_response_detach(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.detach( + response = client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.detach( instance_id="instance_id", project_id=0, region_id=0, @@ -404,7 +404,7 @@ def test_raw_response_detach(self, client: Gcore) -> None: @parametrize def test_streaming_response_detach(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.detach( + with client.cloud.gpu_baremetal.clusters.interfaces.with_streaming_response.detach( instance_id="instance_id", project_id=0, region_id=0, @@ -422,7 +422,7 @@ def test_streaming_response_detach(self, client: Gcore) -> None: @parametrize def test_path_params_detach(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.detach( + client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.detach( instance_id="", project_id=0, region_id=0, @@ -438,7 +438,7 @@ class TestAsyncInterfaces: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.list( + interface = await async_client.cloud.gpu_baremetal.clusters.interfaces.list( cluster_id="cluster_id", project_id=0, region_id=0, @@ -447,7 +447,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.list( + response = await async_client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.list( cluster_id="cluster_id", project_id=0, region_id=0, @@ -460,7 +460,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.list( + async with async_client.cloud.gpu_baremetal.clusters.interfaces.with_streaming_response.list( cluster_id="cluster_id", project_id=0, region_id=0, @@ -476,7 +476,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.list( + await async_client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.list( cluster_id="", project_id=0, region_id=0, @@ -484,7 +484,7 @@ async def test_path_params_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_attach_overload_1(self, async_client: AsyncGcore) -> None: - interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = await async_client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -493,7 +493,7 @@ async def test_method_attach_overload_1(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_attach_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: - interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = await async_client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -522,7 +522,7 @@ async def test_method_attach_with_all_params_overload_1(self, async_client: Asyn @parametrize async def test_raw_response_attach_overload_1(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + response = await async_client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -535,7 +535,7 @@ async def test_raw_response_attach_overload_1(self, async_client: AsyncGcore) -> @parametrize async def test_streaming_response_attach_overload_1(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + async with async_client.cloud.gpu_baremetal.clusters.interfaces.with_streaming_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -551,7 +551,7 @@ async def test_streaming_response_attach_overload_1(self, async_client: AsyncGco @parametrize async def test_path_params_attach_overload_1(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + await async_client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="", project_id=0, region_id=0, @@ -559,7 +559,7 @@ async def test_path_params_attach_overload_1(self, async_client: AsyncGcore) -> @parametrize async def test_method_attach_overload_2(self, async_client: AsyncGcore) -> None: - interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = await async_client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -569,7 +569,7 @@ async def test_method_attach_overload_2(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_attach_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: - interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = await async_client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -598,7 +598,7 @@ async def test_method_attach_with_all_params_overload_2(self, async_client: Asyn @parametrize async def test_raw_response_attach_overload_2(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + response = await async_client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -612,7 +612,7 @@ async def test_raw_response_attach_overload_2(self, async_client: AsyncGcore) -> @parametrize async def test_streaming_response_attach_overload_2(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + async with async_client.cloud.gpu_baremetal.clusters.interfaces.with_streaming_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -629,7 +629,7 @@ async def test_streaming_response_attach_overload_2(self, async_client: AsyncGco @parametrize async def test_path_params_attach_overload_2(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + await async_client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="", project_id=0, region_id=0, @@ -638,7 +638,7 @@ async def test_path_params_attach_overload_2(self, async_client: AsyncGcore) -> @parametrize async def test_method_attach_overload_3(self, async_client: AsyncGcore) -> None: - interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = await async_client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -648,7 +648,7 @@ async def test_method_attach_overload_3(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_attach_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: - interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = await async_client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -678,7 +678,7 @@ async def test_method_attach_with_all_params_overload_3(self, async_client: Asyn @parametrize async def test_raw_response_attach_overload_3(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + response = await async_client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -692,7 +692,7 @@ async def test_raw_response_attach_overload_3(self, async_client: AsyncGcore) -> @parametrize async def test_streaming_response_attach_overload_3(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + async with async_client.cloud.gpu_baremetal.clusters.interfaces.with_streaming_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -709,7 +709,7 @@ async def test_streaming_response_attach_overload_3(self, async_client: AsyncGco @parametrize async def test_path_params_attach_overload_3(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + await async_client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="", project_id=0, region_id=0, @@ -718,7 +718,7 @@ async def test_path_params_attach_overload_3(self, async_client: AsyncGcore) -> @parametrize async def test_method_attach_overload_4(self, async_client: AsyncGcore) -> None: - interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = await async_client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -728,7 +728,7 @@ async def test_method_attach_overload_4(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_attach_with_all_params_overload_4(self, async_client: AsyncGcore) -> None: - interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + interface = await async_client.cloud.gpu_baremetal.clusters.interfaces.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -757,7 +757,7 @@ async def test_method_attach_with_all_params_overload_4(self, async_client: Asyn @parametrize async def test_raw_response_attach_overload_4(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + response = await async_client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -771,7 +771,7 @@ async def test_raw_response_attach_overload_4(self, async_client: AsyncGcore) -> @parametrize async def test_streaming_response_attach_overload_4(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + async with async_client.cloud.gpu_baremetal.clusters.interfaces.with_streaming_response.attach( instance_id="instance_id", project_id=0, region_id=0, @@ -788,7 +788,7 @@ async def test_streaming_response_attach_overload_4(self, async_client: AsyncGco @parametrize async def test_path_params_attach_overload_4(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + await async_client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.attach( instance_id="", project_id=0, region_id=0, @@ -797,7 +797,7 @@ async def test_path_params_attach_overload_4(self, async_client: AsyncGcore) -> @parametrize async def test_method_detach(self, async_client: AsyncGcore) -> None: - interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.detach( + interface = await async_client.cloud.gpu_baremetal.clusters.interfaces.detach( instance_id="instance_id", project_id=0, region_id=0, @@ -808,7 +808,7 @@ async def test_method_detach(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_detach(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.detach( + response = await async_client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.detach( instance_id="instance_id", project_id=0, region_id=0, @@ -823,7 +823,7 @@ async def test_raw_response_detach(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_detach(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.detach( + async with async_client.cloud.gpu_baremetal.clusters.interfaces.with_streaming_response.detach( instance_id="instance_id", project_id=0, region_id=0, @@ -841,7 +841,7 @@ async def test_streaming_response_detach(self, async_client: AsyncGcore) -> None @parametrize async def test_path_params_detach(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.detach( + await async_client.cloud.gpu_baremetal.clusters.interfaces.with_raw_response.detach( instance_id="", project_id=0, region_id=0, diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py b/tests/api_resources/cloud/gpu_baremetal/clusters/test_servers.py similarity index 87% rename from tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py rename to tests/api_resources/cloud/gpu_baremetal/clusters/test_servers.py index e3631089..d468d7c4 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py +++ b/tests/api_resources/cloud/gpu_baremetal/clusters/test_servers.py @@ -12,7 +12,7 @@ from gcore._utils import parse_datetime from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud import Console, TaskIDList -from gcore.types.cloud.gpu_baremetal_clusters import ( +from gcore.types.cloud.gpu_baremetal.clusters import ( GPUBaremetalClusterServer, GPUBaremetalClusterServerV1, ) @@ -25,7 +25,7 @@ class TestServers: @parametrize def test_method_list(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.list( + server = client.cloud.gpu_baremetal.clusters.servers.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -34,7 +34,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.list( + server = client.cloud.gpu_baremetal.clusters.servers.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -52,7 +52,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.list( + response = client.cloud.gpu_baremetal.clusters.servers.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -65,7 +65,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.list( + with client.cloud.gpu_baremetal.clusters.servers.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -81,7 +81,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.list( + client.cloud.gpu_baremetal.clusters.servers.with_raw_response.list( cluster_id="", project_id=1, region_id=7, @@ -89,7 +89,7 @@ def test_path_params_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.delete( + server = client.cloud.gpu_baremetal.clusters.servers.delete( instance_id="instance_id", project_id=0, region_id=0, @@ -99,7 +99,7 @@ def test_method_delete(self, client: Gcore) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.delete( + server = client.cloud.gpu_baremetal.clusters.servers.delete( instance_id="instance_id", project_id=0, region_id=0, @@ -110,7 +110,7 @@ def test_method_delete_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + response = client.cloud.gpu_baremetal.clusters.servers.with_raw_response.delete( instance_id="instance_id", project_id=0, region_id=0, @@ -124,7 +124,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.delete( + with client.cloud.gpu_baremetal.clusters.servers.with_streaming_response.delete( instance_id="instance_id", project_id=0, region_id=0, @@ -141,7 +141,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + client.cloud.gpu_baremetal.clusters.servers.with_raw_response.delete( instance_id="instance_id", project_id=0, region_id=0, @@ -149,7 +149,7 @@ def test_path_params_delete(self, client: Gcore) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + client.cloud.gpu_baremetal.clusters.servers.with_raw_response.delete( instance_id="", project_id=0, region_id=0, @@ -158,7 +158,7 @@ def test_path_params_delete(self, client: Gcore) -> None: @parametrize def test_method_get_console(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.get_console( + server = client.cloud.gpu_baremetal.clusters.servers.get_console( instance_id="instance_id", project_id=0, region_id=0, @@ -167,7 +167,7 @@ def test_method_get_console(self, client: Gcore) -> None: @parametrize def test_raw_response_get_console(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.get_console( + response = client.cloud.gpu_baremetal.clusters.servers.with_raw_response.get_console( instance_id="instance_id", project_id=0, region_id=0, @@ -180,7 +180,7 @@ def test_raw_response_get_console(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_console(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.get_console( + with client.cloud.gpu_baremetal.clusters.servers.with_streaming_response.get_console( instance_id="instance_id", project_id=0, region_id=0, @@ -196,7 +196,7 @@ def test_streaming_response_get_console(self, client: Gcore) -> None: @parametrize def test_path_params_get_console(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.get_console( + client.cloud.gpu_baremetal.clusters.servers.with_raw_response.get_console( instance_id="", project_id=0, region_id=0, @@ -204,7 +204,7 @@ def test_path_params_get_console(self, client: Gcore) -> None: @parametrize def test_method_powercycle(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.powercycle( + server = client.cloud.gpu_baremetal.clusters.servers.powercycle( instance_id="instance_id", project_id=0, region_id=0, @@ -213,7 +213,7 @@ def test_method_powercycle(self, client: Gcore) -> None: @parametrize def test_raw_response_powercycle(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.powercycle( + response = client.cloud.gpu_baremetal.clusters.servers.with_raw_response.powercycle( instance_id="instance_id", project_id=0, region_id=0, @@ -226,7 +226,7 @@ def test_raw_response_powercycle(self, client: Gcore) -> None: @parametrize def test_streaming_response_powercycle(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.powercycle( + with client.cloud.gpu_baremetal.clusters.servers.with_streaming_response.powercycle( instance_id="instance_id", project_id=0, region_id=0, @@ -242,7 +242,7 @@ def test_streaming_response_powercycle(self, client: Gcore) -> None: @parametrize def test_path_params_powercycle(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.powercycle( + client.cloud.gpu_baremetal.clusters.servers.with_raw_response.powercycle( instance_id="", project_id=0, region_id=0, @@ -250,7 +250,7 @@ def test_path_params_powercycle(self, client: Gcore) -> None: @parametrize def test_method_reboot(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.reboot( + server = client.cloud.gpu_baremetal.clusters.servers.reboot( instance_id="instance_id", project_id=0, region_id=0, @@ -259,7 +259,7 @@ def test_method_reboot(self, client: Gcore) -> None: @parametrize def test_raw_response_reboot(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.reboot( + response = client.cloud.gpu_baremetal.clusters.servers.with_raw_response.reboot( instance_id="instance_id", project_id=0, region_id=0, @@ -272,7 +272,7 @@ def test_raw_response_reboot(self, client: Gcore) -> None: @parametrize def test_streaming_response_reboot(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.reboot( + with client.cloud.gpu_baremetal.clusters.servers.with_streaming_response.reboot( instance_id="instance_id", project_id=0, region_id=0, @@ -288,7 +288,7 @@ def test_streaming_response_reboot(self, client: Gcore) -> None: @parametrize def test_path_params_reboot(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.reboot( + client.cloud.gpu_baremetal.clusters.servers.with_raw_response.reboot( instance_id="", project_id=0, region_id=0, @@ -302,7 +302,7 @@ class TestAsyncServers: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.list( + server = await async_client.cloud.gpu_baremetal.clusters.servers.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -311,7 +311,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.list( + server = await async_client.cloud.gpu_baremetal.clusters.servers.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -329,7 +329,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.list( + response = await async_client.cloud.gpu_baremetal.clusters.servers.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -342,7 +342,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.list( + async with async_client.cloud.gpu_baremetal.clusters.servers.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -358,7 +358,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.list( + await async_client.cloud.gpu_baremetal.clusters.servers.with_raw_response.list( cluster_id="", project_id=1, region_id=7, @@ -366,7 +366,7 @@ async def test_path_params_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.delete( + server = await async_client.cloud.gpu_baremetal.clusters.servers.delete( instance_id="instance_id", project_id=0, region_id=0, @@ -376,7 +376,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.delete( + server = await async_client.cloud.gpu_baremetal.clusters.servers.delete( instance_id="instance_id", project_id=0, region_id=0, @@ -387,7 +387,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + response = await async_client.cloud.gpu_baremetal.clusters.servers.with_raw_response.delete( instance_id="instance_id", project_id=0, region_id=0, @@ -401,7 +401,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.delete( + async with async_client.cloud.gpu_baremetal.clusters.servers.with_streaming_response.delete( instance_id="instance_id", project_id=0, region_id=0, @@ -418,7 +418,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + await async_client.cloud.gpu_baremetal.clusters.servers.with_raw_response.delete( instance_id="instance_id", project_id=0, region_id=0, @@ -426,7 +426,7 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.delete( + await async_client.cloud.gpu_baremetal.clusters.servers.with_raw_response.delete( instance_id="", project_id=0, region_id=0, @@ -435,7 +435,7 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_get_console(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.get_console( + server = await async_client.cloud.gpu_baremetal.clusters.servers.get_console( instance_id="instance_id", project_id=0, region_id=0, @@ -444,7 +444,7 @@ async def test_method_get_console(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_get_console(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.get_console( + response = await async_client.cloud.gpu_baremetal.clusters.servers.with_raw_response.get_console( instance_id="instance_id", project_id=0, region_id=0, @@ -457,7 +457,7 @@ async def test_raw_response_get_console(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get_console(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.get_console( + async with async_client.cloud.gpu_baremetal.clusters.servers.with_streaming_response.get_console( instance_id="instance_id", project_id=0, region_id=0, @@ -473,7 +473,7 @@ async def test_streaming_response_get_console(self, async_client: AsyncGcore) -> @parametrize async def test_path_params_get_console(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.get_console( + await async_client.cloud.gpu_baremetal.clusters.servers.with_raw_response.get_console( instance_id="", project_id=0, region_id=0, @@ -481,7 +481,7 @@ async def test_path_params_get_console(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_powercycle(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.powercycle( + server = await async_client.cloud.gpu_baremetal.clusters.servers.powercycle( instance_id="instance_id", project_id=0, region_id=0, @@ -490,7 +490,7 @@ async def test_method_powercycle(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_powercycle(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.powercycle( + response = await async_client.cloud.gpu_baremetal.clusters.servers.with_raw_response.powercycle( instance_id="instance_id", project_id=0, region_id=0, @@ -503,7 +503,7 @@ async def test_raw_response_powercycle(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_powercycle(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.powercycle( + async with async_client.cloud.gpu_baremetal.clusters.servers.with_streaming_response.powercycle( instance_id="instance_id", project_id=0, region_id=0, @@ -519,7 +519,7 @@ async def test_streaming_response_powercycle(self, async_client: AsyncGcore) -> @parametrize async def test_path_params_powercycle(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.powercycle( + await async_client.cloud.gpu_baremetal.clusters.servers.with_raw_response.powercycle( instance_id="", project_id=0, region_id=0, @@ -527,7 +527,7 @@ async def test_path_params_powercycle(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_reboot(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.reboot( + server = await async_client.cloud.gpu_baremetal.clusters.servers.reboot( instance_id="instance_id", project_id=0, region_id=0, @@ -536,7 +536,7 @@ async def test_method_reboot(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_reboot(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.reboot( + response = await async_client.cloud.gpu_baremetal.clusters.servers.with_raw_response.reboot( instance_id="instance_id", project_id=0, region_id=0, @@ -549,7 +549,7 @@ async def test_raw_response_reboot(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_reboot(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.reboot( + async with async_client.cloud.gpu_baremetal.clusters.servers.with_streaming_response.reboot( instance_id="instance_id", project_id=0, region_id=0, @@ -565,7 +565,7 @@ async def test_streaming_response_reboot(self, async_client: AsyncGcore) -> None @parametrize async def test_path_params_reboot(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.reboot( + await async_client.cloud.gpu_baremetal.clusters.servers.with_raw_response.reboot( instance_id="", project_id=0, region_id=0, diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/gpu_baremetal/test_clusters.py similarity index 70% rename from tests/api_resources/cloud/test_gpu_baremetal_clusters.py rename to tests/api_resources/cloud/gpu_baremetal/test_clusters.py index 90aa7127..cd68c18a 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/gpu_baremetal/test_clusters.py @@ -10,21 +10,21 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.cloud import ( - TaskIDList, +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.gpu_baremetal import ( GPUBaremetalCluster, ) -from gcore.types.cloud.gpu_baremetal_clusters import GPUBaremetalClusterServerV1List +from gcore.types.cloud.gpu_baremetal.clusters import GPUBaremetalClusterServerV1List base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestGPUBaremetalClusters: +class TestClusters: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_create(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( + cluster = client.cloud.gpu_baremetal.clusters.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -33,11 +33,11 @@ def test_method_create(self, client: Gcore) -> None: servers_count=3, servers_settings={"interfaces": [{"type": "external"}]}, ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.create( + cluster = client.cloud.gpu_baremetal.clusters.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -68,11 +68,11 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: }, tags={"my-tag": "my-tag-value"}, ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.create( + response = client.cloud.gpu_baremetal.clusters.with_raw_response.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -84,12 +84,12 @@ def test_raw_response_create(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.create( + with client.cloud.gpu_baremetal.clusters.with_streaming_response.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -101,68 +101,68 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_list(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( + cluster = client.cloud.gpu_baremetal.clusters.list( project_id=1, region_id=7, ) - assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], cluster, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.list( + cluster = client.cloud.gpu_baremetal.clusters.list( project_id=1, region_id=7, limit=10, managed_by=["k8s"], offset=0, ) - assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], cluster, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.list( + response = client.cloud.gpu_baremetal.clusters.with_raw_response.list( project_id=1, region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], cluster, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.list( + with client.cloud.gpu_baremetal.clusters.with_streaming_response.list( project_id=1, region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(SyncOffsetPage[GPUBaremetalCluster], cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.delete( + cluster = client.cloud.gpu_baremetal.clusters.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_method_delete_with_all_params(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.delete( + cluster = client.cloud.gpu_baremetal.clusters.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -171,11 +171,11 @@ def test_method_delete_with_all_params(self, client: Gcore) -> None: floating_ip_ids=["e4a01208-d6ac-4304-bf86-3028154b070a"], reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + response = client.cloud.gpu_baremetal.clusters.with_raw_response.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -183,12 +183,12 @@ def test_raw_response_delete(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.delete( + with client.cloud.gpu_baremetal.clusters.with_streaming_response.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -196,15 +196,15 @@ def test_streaming_response_delete(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + client.cloud.gpu_baremetal.clusters.with_raw_response.delete( cluster_id="", project_id=1, region_id=7, @@ -212,18 +212,18 @@ def test_path_params_delete(self, client: Gcore) -> None: @parametrize def test_method_action(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.action( + cluster = client.cloud.gpu_baremetal.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="update_tags", tags={"foo": "my-tag-value"}, ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.action( + response = client.cloud.gpu_baremetal.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -233,12 +233,12 @@ def test_raw_response_action(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.action( + with client.cloud.gpu_baremetal.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -248,15 +248,15 @@ def test_streaming_response_action(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.action( + client.cloud.gpu_baremetal.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -266,16 +266,16 @@ def test_path_params_action(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.get( + cluster = client.cloud.gpu_baremetal.clusters.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, ) - assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalCluster, cluster, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.get( + response = client.cloud.gpu_baremetal.clusters.with_raw_response.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -283,12 +283,12 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUBaremetalCluster, cluster, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.get( + with client.cloud.gpu_baremetal.clusters.with_streaming_response.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -296,15 +296,15 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUBaremetalCluster, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.get( + client.cloud.gpu_baremetal.clusters.with_raw_response.get( cluster_id="", project_id=1, region_id=7, @@ -312,16 +312,16 @@ def test_path_params_get(self, client: Gcore) -> None: @parametrize def test_method_powercycle_all_servers(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.powercycle_all_servers( + cluster = client.cloud.gpu_baremetal.clusters.powercycle_all_servers( cluster_id="cluster_id", project_id=0, region_id=0, ) - assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, cluster, path=["response"]) @parametrize def test_raw_response_powercycle_all_servers(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.powercycle_all_servers( + response = client.cloud.gpu_baremetal.clusters.with_raw_response.powercycle_all_servers( cluster_id="cluster_id", project_id=0, region_id=0, @@ -329,12 +329,12 @@ def test_raw_response_powercycle_all_servers(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUBaremetalClusterServerV1List, cluster, path=["response"]) @parametrize def test_streaming_response_powercycle_all_servers(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.powercycle_all_servers( + with client.cloud.gpu_baremetal.clusters.with_streaming_response.powercycle_all_servers( cluster_id="cluster_id", project_id=0, region_id=0, @@ -342,15 +342,15 @@ def test_streaming_response_powercycle_all_servers(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUBaremetalClusterServerV1List, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_powercycle_all_servers(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.powercycle_all_servers( + client.cloud.gpu_baremetal.clusters.with_raw_response.powercycle_all_servers( cluster_id="", project_id=0, region_id=0, @@ -358,16 +358,16 @@ def test_path_params_powercycle_all_servers(self, client: Gcore) -> None: @parametrize def test_method_reboot_all_servers(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.reboot_all_servers( + cluster = client.cloud.gpu_baremetal.clusters.reboot_all_servers( cluster_id="cluster_id", project_id=0, region_id=0, ) - assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, cluster, path=["response"]) @parametrize def test_raw_response_reboot_all_servers(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.reboot_all_servers( + response = client.cloud.gpu_baremetal.clusters.with_raw_response.reboot_all_servers( cluster_id="cluster_id", project_id=0, region_id=0, @@ -375,12 +375,12 @@ def test_raw_response_reboot_all_servers(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUBaremetalClusterServerV1List, cluster, path=["response"]) @parametrize def test_streaming_response_reboot_all_servers(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.reboot_all_servers( + with client.cloud.gpu_baremetal.clusters.with_streaming_response.reboot_all_servers( cluster_id="cluster_id", project_id=0, region_id=0, @@ -388,15 +388,15 @@ def test_streaming_response_reboot_all_servers(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUBaremetalClusterServerV1List, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_reboot_all_servers(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.reboot_all_servers( + client.cloud.gpu_baremetal.clusters.with_raw_response.reboot_all_servers( cluster_id="", project_id=0, region_id=0, @@ -404,17 +404,17 @@ def test_path_params_reboot_all_servers(self, client: Gcore) -> None: @parametrize def test_method_rebuild(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.rebuild( + cluster = client.cloud.gpu_baremetal.clusters.rebuild( cluster_id="cluster_id", project_id=0, region_id=0, nodes=["string"], ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_method_rebuild_with_all_params(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.rebuild( + cluster = client.cloud.gpu_baremetal.clusters.rebuild( cluster_id="cluster_id", project_id=0, region_id=0, @@ -422,11 +422,11 @@ def test_method_rebuild_with_all_params(self, client: Gcore) -> None: image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", user_data="user_data", ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_rebuild(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.rebuild( + response = client.cloud.gpu_baremetal.clusters.with_raw_response.rebuild( cluster_id="cluster_id", project_id=0, region_id=0, @@ -435,12 +435,12 @@ def test_raw_response_rebuild(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_rebuild(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.rebuild( + with client.cloud.gpu_baremetal.clusters.with_streaming_response.rebuild( cluster_id="cluster_id", project_id=0, region_id=0, @@ -449,15 +449,15 @@ def test_streaming_response_rebuild(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_rebuild(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.rebuild( + client.cloud.gpu_baremetal.clusters.with_raw_response.rebuild( cluster_id="", project_id=0, region_id=0, @@ -466,17 +466,17 @@ def test_path_params_rebuild(self, client: Gcore) -> None: @parametrize def test_method_resize(self, client: Gcore) -> None: - gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.resize( + cluster = client.cloud.gpu_baremetal.clusters.resize( cluster_id="cluster_id", project_id=0, region_id=0, instances_count=1, ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_resize(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.with_raw_response.resize( + response = client.cloud.gpu_baremetal.clusters.with_raw_response.resize( cluster_id="cluster_id", project_id=0, region_id=0, @@ -485,12 +485,12 @@ def test_raw_response_resize(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_resize(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.with_streaming_response.resize( + with client.cloud.gpu_baremetal.clusters.with_streaming_response.resize( cluster_id="cluster_id", project_id=0, region_id=0, @@ -499,15 +499,15 @@ def test_streaming_response_resize(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_resize(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_baremetal_clusters.with_raw_response.resize( + client.cloud.gpu_baremetal.clusters.with_raw_response.resize( cluster_id="", project_id=0, region_id=0, @@ -515,14 +515,14 @@ def test_path_params_resize(self, client: Gcore) -> None: ) -class TestAsyncGPUBaremetalClusters: +class TestAsyncClusters: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( + cluster = await async_client.cloud.gpu_baremetal.clusters.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -531,11 +531,11 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: servers_count=3, servers_settings={"interfaces": [{"type": "external"}]}, ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.create( + cluster = await async_client.cloud.gpu_baremetal.clusters.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -566,11 +566,11 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> }, tags={"my-tag": "my-tag-value"}, ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.create( + response = await async_client.cloud.gpu_baremetal.clusters.with_raw_response.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -582,12 +582,12 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.create( + async with async_client.cloud.gpu_baremetal.clusters.with_streaming_response.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -599,68 +599,68 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( + cluster = await async_client.cloud.gpu_baremetal.clusters.list( project_id=1, region_id=7, ) - assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], cluster, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.list( + cluster = await async_client.cloud.gpu_baremetal.clusters.list( project_id=1, region_id=7, limit=10, managed_by=["k8s"], offset=0, ) - assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], cluster, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.list( + response = await async_client.cloud.gpu_baremetal.clusters.with_raw_response.list( project_id=1, region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], cluster, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.list( + async with async_client.cloud.gpu_baremetal.clusters.with_streaming_response.list( project_id=1, region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUBaremetalCluster], cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.delete( + cluster = await async_client.cloud.gpu_baremetal.clusters.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.delete( + cluster = await async_client.cloud.gpu_baremetal.clusters.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -669,11 +669,11 @@ async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> floating_ip_ids=["e4a01208-d6ac-4304-bf86-3028154b070a"], reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + response = await async_client.cloud.gpu_baremetal.clusters.with_raw_response.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -681,12 +681,12 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.delete( + async with async_client.cloud.gpu_baremetal.clusters.with_streaming_response.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -694,15 +694,15 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.delete( + await async_client.cloud.gpu_baremetal.clusters.with_raw_response.delete( cluster_id="", project_id=1, region_id=7, @@ -710,18 +710,18 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_action(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.action( + cluster = await async_client.cloud.gpu_baremetal.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="update_tags", tags={"foo": "my-tag-value"}, ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_baremetal.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -731,12 +731,12 @@ async def test_raw_response_action(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_baremetal.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -746,15 +746,15 @@ async def test_streaming_response_action(self, async_client: AsyncGcore) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.action( + await async_client.cloud.gpu_baremetal.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -764,16 +764,16 @@ async def test_path_params_action(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.get( + cluster = await async_client.cloud.gpu_baremetal.clusters.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, ) - assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalCluster, cluster, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.get( + response = await async_client.cloud.gpu_baremetal.clusters.with_raw_response.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -781,12 +781,12 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUBaremetalCluster, cluster, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.get( + async with async_client.cloud.gpu_baremetal.clusters.with_streaming_response.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -794,15 +794,15 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUBaremetalCluster, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUBaremetalCluster, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.get( + await async_client.cloud.gpu_baremetal.clusters.with_raw_response.get( cluster_id="", project_id=1, region_id=7, @@ -810,16 +810,16 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_powercycle_all_servers(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.powercycle_all_servers( + cluster = await async_client.cloud.gpu_baremetal.clusters.powercycle_all_servers( cluster_id="cluster_id", project_id=0, region_id=0, ) - assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, cluster, path=["response"]) @parametrize async def test_raw_response_powercycle_all_servers(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.powercycle_all_servers( + response = await async_client.cloud.gpu_baremetal.clusters.with_raw_response.powercycle_all_servers( cluster_id="cluster_id", project_id=0, region_id=0, @@ -827,12 +827,12 @@ async def test_raw_response_powercycle_all_servers(self, async_client: AsyncGcor assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUBaremetalClusterServerV1List, cluster, path=["response"]) @parametrize async def test_streaming_response_powercycle_all_servers(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.powercycle_all_servers( + async with async_client.cloud.gpu_baremetal.clusters.with_streaming_response.powercycle_all_servers( cluster_id="cluster_id", project_id=0, region_id=0, @@ -840,15 +840,15 @@ async def test_streaming_response_powercycle_all_servers(self, async_client: Asy assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUBaremetalClusterServerV1List, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_powercycle_all_servers(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.powercycle_all_servers( + await async_client.cloud.gpu_baremetal.clusters.with_raw_response.powercycle_all_servers( cluster_id="", project_id=0, region_id=0, @@ -856,16 +856,16 @@ async def test_path_params_powercycle_all_servers(self, async_client: AsyncGcore @parametrize async def test_method_reboot_all_servers(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.reboot_all_servers( + cluster = await async_client.cloud.gpu_baremetal.clusters.reboot_all_servers( cluster_id="cluster_id", project_id=0, region_id=0, ) - assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(GPUBaremetalClusterServerV1List, cluster, path=["response"]) @parametrize async def test_raw_response_reboot_all_servers(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.reboot_all_servers( + response = await async_client.cloud.gpu_baremetal.clusters.with_raw_response.reboot_all_servers( cluster_id="cluster_id", project_id=0, region_id=0, @@ -873,12 +873,12 @@ async def test_raw_response_reboot_all_servers(self, async_client: AsyncGcore) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUBaremetalClusterServerV1List, cluster, path=["response"]) @parametrize async def test_streaming_response_reboot_all_servers(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.reboot_all_servers( + async with async_client.cloud.gpu_baremetal.clusters.with_streaming_response.reboot_all_servers( cluster_id="cluster_id", project_id=0, region_id=0, @@ -886,15 +886,15 @@ async def test_streaming_response_reboot_all_servers(self, async_client: AsyncGc assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(GPUBaremetalClusterServerV1List, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUBaremetalClusterServerV1List, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_reboot_all_servers(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.reboot_all_servers( + await async_client.cloud.gpu_baremetal.clusters.with_raw_response.reboot_all_servers( cluster_id="", project_id=0, region_id=0, @@ -902,17 +902,17 @@ async def test_path_params_reboot_all_servers(self, async_client: AsyncGcore) -> @parametrize async def test_method_rebuild(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.rebuild( + cluster = await async_client.cloud.gpu_baremetal.clusters.rebuild( cluster_id="cluster_id", project_id=0, region_id=0, nodes=["string"], ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_method_rebuild_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.rebuild( + cluster = await async_client.cloud.gpu_baremetal.clusters.rebuild( cluster_id="cluster_id", project_id=0, region_id=0, @@ -920,11 +920,11 @@ async def test_method_rebuild_with_all_params(self, async_client: AsyncGcore) -> image_id="f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1", user_data="user_data", ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_rebuild(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.rebuild( + response = await async_client.cloud.gpu_baremetal.clusters.with_raw_response.rebuild( cluster_id="cluster_id", project_id=0, region_id=0, @@ -933,12 +933,12 @@ async def test_raw_response_rebuild(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_rebuild(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.rebuild( + async with async_client.cloud.gpu_baremetal.clusters.with_streaming_response.rebuild( cluster_id="cluster_id", project_id=0, region_id=0, @@ -947,15 +947,15 @@ async def test_streaming_response_rebuild(self, async_client: AsyncGcore) -> Non assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_rebuild(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.rebuild( + await async_client.cloud.gpu_baremetal.clusters.with_raw_response.rebuild( cluster_id="", project_id=0, region_id=0, @@ -964,17 +964,17 @@ async def test_path_params_rebuild(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_resize(self, async_client: AsyncGcore) -> None: - gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.resize( + cluster = await async_client.cloud.gpu_baremetal.clusters.resize( cluster_id="cluster_id", project_id=0, region_id=0, instances_count=1, ) - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.resize( + response = await async_client.cloud.gpu_baremetal.clusters.with_raw_response.resize( cluster_id="cluster_id", project_id=0, region_id=0, @@ -983,12 +983,12 @@ async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.resize( + async with async_client.cloud.gpu_baremetal.clusters.with_streaming_response.resize( cluster_id="cluster_id", project_id=0, region_id=0, @@ -997,15 +997,15 @@ async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_baremetal_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_resize(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.with_raw_response.resize( + await async_client.cloud.gpu_baremetal.clusters.with_raw_response.resize( cluster_id="", project_id=0, region_id=0, From 76162f09120711c0d8f747f2c91e512bb7bdf5e5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Dec 2025 10:24:36 +0000 Subject: [PATCH 497/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index caf5ca3f..59acac47 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.26.0" + ".": "0.27.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 0faa21bc..d6d3f4fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.26.0" +version = "0.27.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 3749030a..f59c6bde 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.26.0" # x-release-please-version +__version__ = "0.27.0" # x-release-please-version From 2d8a54c0944c519ea9db90c337d3c0d9329f3106 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Dec 2025 11:36:00 +0000 Subject: [PATCH 498/592] chore!: change naming for POST, PUT, PATCH, DELETE models --- .stats.yml | 2 +- api.md | 38 +++++++++---------- .../resources/cloud/inference/api_keys.py | 10 ++--- src/gcore/resources/cloud/registries/users.py | 18 ++++----- src/gcore/resources/cloud/ssh_keys.py | 10 ++--- .../resources/cloud/users/role_assignments.py | 18 ++++----- src/gcore/resources/iam/api_tokens.py | 10 ++--- src/gcore/resources/iam/users.py | 10 ++--- src/gcore/resources/streaming/playlists.py | 10 ++--- src/gcore/types/cloud/__init__.py | 2 +- src/gcore/types/cloud/inference/__init__.py | 2 +- ...create.py => inference_api_key_created.py} | 4 +- src/gcore/types/cloud/registries/__init__.py | 2 +- ...ser_create.py => registry_user_created.py} | 4 +- .../{ssh_key_create.py => ssh_key_created.py} | 4 +- src/gcore/types/cloud/users/__init__.py | 2 +- ....py => role_assignment_updated_deleted.py} | 4 +- src/gcore/types/iam/__init__.py | 4 +- ...i_token_create.py => api_token_created.py} | 4 +- .../iam/{user_update.py => user_updated.py} | 4 +- src/gcore/types/streaming/__init__.py | 2 +- ...playlist_create.py => playlist_created.py} | 4 +- .../cloud/inference/test_api_keys.py | 18 ++++----- .../cloud/registries/test_users.py | 30 +++++++-------- tests/api_resources/cloud/test_ssh_keys.py | 18 ++++----- .../cloud/users/test_role_assignments.py | 30 +++++++-------- tests/api_resources/iam/test_api_tokens.py | 18 ++++----- tests/api_resources/iam/test_users.py | 18 ++++----- .../api_resources/streaming/test_playlists.py | 18 ++++----- 29 files changed, 159 insertions(+), 159 deletions(-) rename src/gcore/types/cloud/inference/{inference_api_key_create.py => inference_api_key_created.py} (88%) rename src/gcore/types/cloud/registries/{registry_user_create.py => registry_user_created.py} (88%) rename src/gcore/types/cloud/{ssh_key_create.py => ssh_key_created.py} (96%) rename src/gcore/types/cloud/users/{role_assignment_update_delete.py => role_assignment_updated_deleted.py} (65%) rename src/gcore/types/iam/{api_token_create.py => api_token_created.py} (95%) rename src/gcore/types/iam/{user_update.py => user_updated.py} (96%) rename src/gcore/types/streaming/{playlist_create.py => playlist_created.py} (76%) diff --git a/.stats.yml b/.stats.yml index 87a747f2..698a6006 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2c3abe1f1637f97f6bc750aff6eb77efc45ac2b527376541ac2af6b9626b35af.yml openapi_spec_hash: ff74a4ccd9ec5ddb1a65963d52e709ba -config_hash: 74d2c4eaca28539e6694ab47fe0c34db +config_hash: df463160c27e4de887be7c27454ac4e0 diff --git a/api.md b/api.md index b7509aeb..ff599062 100644 --- a/api.md +++ b/api.md @@ -149,12 +149,12 @@ Methods: Types: ```python -from gcore.types.cloud import SSHKey, SSHKeyCreate +from gcore.types.cloud import SSHKey, SSHKeyCreated ``` Methods: -- client.cloud.ssh_keys.create(\*, project_id, \*\*params) -> SSHKeyCreate +- client.cloud.ssh_keys.create(\*, project_id, \*\*params) -> SSHKeyCreated - 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 @@ -454,15 +454,15 @@ Methods: Types: ```python -from gcore.types.cloud.users import RoleAssignment, RoleAssignmentUpdateDelete +from gcore.types.cloud.users import RoleAssignment, RoleAssignmentUpdatedDeleted ``` Methods: - client.cloud.users.role_assignments.create(\*\*params) -> RoleAssignment -- client.cloud.users.role_assignments.update(assignment_id, \*\*params) -> RoleAssignmentUpdateDelete +- client.cloud.users.role_assignments.update(assignment_id, \*\*params) -> RoleAssignmentUpdatedDeleted - client.cloud.users.role_assignments.list(\*\*params) -> SyncOffsetPage[RoleAssignment] -- client.cloud.users.role_assignments.delete(assignment_id) -> RoleAssignmentUpdateDelete +- client.cloud.users.role_assignments.delete(assignment_id) -> RoleAssignmentUpdatedDeleted ## Inference @@ -565,12 +565,12 @@ Methods: Types: ```python -from gcore.types.cloud.inference import InferenceAPIKey, InferenceAPIKeyCreate +from gcore.types.cloud.inference import InferenceAPIKey, InferenceAPIKeyCreated ``` Methods: -- client.cloud.inference.api_keys.create(\*, project_id, \*\*params) -> InferenceAPIKeyCreate +- client.cloud.inference.api_keys.create(\*, project_id, \*\*params) -> InferenceAPIKeyCreated - client.cloud.inference.api_keys.update(api_key_name, \*, project_id, \*\*params) -> InferenceAPIKey - client.cloud.inference.api_keys.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceAPIKey] - client.cloud.inference.api_keys.delete(api_key_name, \*, project_id) -> None @@ -715,7 +715,7 @@ Types: ```python from gcore.types.cloud.registries import ( RegistryUser, - RegistryUserCreate, + RegistryUserCreated, RegistryUserList, UserRefreshSecretResponse, ) @@ -723,11 +723,11 @@ from gcore.types.cloud.registries import ( Methods: -- client.cloud.registries.users.create(registry_id, \*, project_id, region_id, \*\*params) -> RegistryUserCreate +- client.cloud.registries.users.create(registry_id, \*, project_id, region_id, \*\*params) -> RegistryUserCreated - 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) -> RegistryUserCreate +- client.cloud.registries.users.create_multiple(registry_id, \*, project_id, region_id, \*\*params) -> RegistryUserCreated - client.cloud.registries.users.refresh_secret(user_id, \*, project_id, region_id, registry_id) -> UserRefreshSecretResponse ## FileShares @@ -1505,12 +1505,12 @@ Methods: Types: ```python -from gcore.types.iam import APIToken, APITokenCreate, APITokenList +from gcore.types.iam import APIToken, APITokenCreated, APITokenList ``` Methods: -- client.iam.api_tokens.create(client_id, \*\*params) -> APITokenCreate +- client.iam.api_tokens.create(client_id, \*\*params) -> APITokenCreated - client.iam.api_tokens.list(client_id, \*\*params) -> APITokenList - client.iam.api_tokens.delete(token_id, \*, client_id) -> None - client.iam.api_tokens.get(token_id, \*, client_id) -> APIToken @@ -1520,12 +1520,12 @@ Methods: Types: ```python -from gcore.types.iam import User, UserDetailed, UserInvite, UserUpdate +from gcore.types.iam import User, UserDetailed, UserInvite, UserUpdated ``` Methods: -- client.iam.users.update(user_id, \*\*params) -> UserUpdate +- client.iam.users.update(user_id, \*\*params) -> UserUpdated - client.iam.users.list(\*\*params) -> SyncOffsetPage[User] - client.iam.users.delete(user_id, \*, client_id) -> None - client.iam.users.get(user_id) -> UserDetailed @@ -1770,7 +1770,7 @@ Types: ```python from gcore.types.streaming import ( Playlist, - PlaylistCreate, + PlaylistCreated, PlaylistVideo, PlaylistListVideosResponse, ) @@ -1778,7 +1778,7 @@ from gcore.types.streaming import ( Methods: -- client.streaming.playlists.create(\*\*params) -> PlaylistCreate +- client.streaming.playlists.create(\*\*params) -> PlaylistCreated - client.streaming.playlists.update(playlist_id, \*\*params) -> Playlist - client.streaming.playlists.list(\*\*params) -> SyncPageStreaming[Playlist] - client.streaming.playlists.delete(playlist_id) -> None @@ -1795,7 +1795,7 @@ from gcore.types.streaming import ( Subtitle, SubtitleBase, SubtitleBody, - SubtitleUpdate, + SubtitleUpdated, VideoCreateResponse, VideoCreateMultipleResponse, ) @@ -2311,13 +2311,13 @@ Methods: Types: ```python -from gcore.types.cdn.resources import OriginShielding, OriginShieldingReplace +from gcore.types.cdn.resources import OriginShielding, OriginShieldingReplaced ``` 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/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py index fcd8860c..37e51cd0 100644 --- a/src/gcore/resources/cloud/inference/api_keys.py +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -20,7 +20,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.inference import api_key_list_params, api_key_create_params, api_key_update_params from ....types.cloud.inference.inference_api_key import InferenceAPIKey -from ....types.cloud.inference.inference_api_key_create import InferenceAPIKeyCreate +from ....types.cloud.inference.inference_api_key_created import InferenceAPIKeyCreated __all__ = ["APIKeysResource", "AsyncAPIKeysResource"] @@ -58,7 +58,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> InferenceAPIKeyCreate: + ) -> InferenceAPIKeyCreated: """This endpoint creates a new API key for everywhere inference. It returs api @@ -96,7 +96,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceAPIKeyCreate, + cast_to=InferenceAPIKeyCreated, ) def update( @@ -314,7 +314,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> InferenceAPIKeyCreate: + ) -> InferenceAPIKeyCreated: """This endpoint creates a new API key for everywhere inference. It returs api @@ -352,7 +352,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=InferenceAPIKeyCreate, + cast_to=InferenceAPIKeyCreated, ) async def update( diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index ee880e0a..5225429a 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_create import RegistryUserCreate +from ....types.cloud.registries.registry_user_created import RegistryUserCreated 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, - ) -> RegistryUserCreate: + ) -> RegistryUserCreated: """ 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=RegistryUserCreate, + cast_to=RegistryUserCreated, ) 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, - ) -> RegistryUserCreate: + ) -> RegistryUserCreated: """ 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=RegistryUserCreate, + cast_to=RegistryUserCreated, ) 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, - ) -> RegistryUserCreate: + ) -> RegistryUserCreated: """ 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=RegistryUserCreate, + cast_to=RegistryUserCreated, ) 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, - ) -> RegistryUserCreate: + ) -> RegistryUserCreated: """ 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=RegistryUserCreate, + cast_to=RegistryUserCreated, ) async def refresh_secret( diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 9ecc18ab..cd2c058d 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_create import SSHKeyCreate +from ...types.cloud.ssh_key_created import SSHKeyCreated __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, - ) -> SSHKeyCreate: + ) -> SSHKeyCreated: """ 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=SSHKeyCreate, + cast_to=SSHKeyCreated, ) 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, - ) -> SSHKeyCreate: + ) -> SSHKeyCreated: """ 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=SSHKeyCreate, + cast_to=SSHKeyCreated, ) async def update( diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 2f16d40d..db6f6bd4 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -25,7 +25,7 @@ role_assignment_update_params, ) from ....types.cloud.users.role_assignment import RoleAssignment -from ....types.cloud.users.role_assignment_update_delete import RoleAssignmentUpdateDelete +from ....types.cloud.users.role_assignment_updated_deleted import RoleAssignmentUpdatedDeleted __all__ = ["RoleAssignmentsResource", "AsyncRoleAssignmentsResource"] @@ -115,7 +115,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RoleAssignmentUpdateDelete: + ) -> RoleAssignmentUpdatedDeleted: """ Modify an existing role assignment for a user. @@ -152,7 +152,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RoleAssignmentUpdateDelete, + cast_to=RoleAssignmentUpdatedDeleted, ) def list( @@ -221,7 +221,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RoleAssignmentUpdateDelete: + ) -> RoleAssignmentUpdatedDeleted: """ Delete an existing role assignment. @@ -241,7 +241,7 @@ def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RoleAssignmentUpdateDelete, + cast_to=RoleAssignmentUpdatedDeleted, ) @@ -330,7 +330,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RoleAssignmentUpdateDelete: + ) -> RoleAssignmentUpdatedDeleted: """ Modify an existing role assignment for a user. @@ -367,7 +367,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RoleAssignmentUpdateDelete, + cast_to=RoleAssignmentUpdatedDeleted, ) def list( @@ -436,7 +436,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RoleAssignmentUpdateDelete: + ) -> RoleAssignmentUpdatedDeleted: """ Delete an existing role assignment. @@ -456,7 +456,7 @@ async def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RoleAssignmentUpdateDelete, + cast_to=RoleAssignmentUpdatedDeleted, ) diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index aca5b46f..6395270b 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -20,7 +20,7 @@ from ..._base_client import make_request_options from ...types.iam.api_token import APIToken from ...types.iam.api_token_list import APITokenList -from ...types.iam.api_token_create import APITokenCreate +from ...types.iam.api_token_created import APITokenCreated __all__ = ["APITokensResource", "AsyncAPITokensResource"] @@ -59,7 +59,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> APITokenCreate: + ) -> APITokenCreated: """ Create an API token in the current account. @@ -95,7 +95,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APITokenCreate, + cast_to=APITokenCreated, ) def list( @@ -272,7 +272,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> APITokenCreate: + ) -> APITokenCreated: """ Create an API token in the current account. @@ -308,7 +308,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=APITokenCreate, + cast_to=APITokenCreated, ) async def list( diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index f411d577..3cf6bbef 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -22,7 +22,7 @@ from ..._base_client import AsyncPaginator, make_request_options from ...types.iam.user import User from ...types.iam.user_invite import UserInvite -from ...types.iam.user_update import UserUpdate +from ...types.iam.user_updated import UserUpdated from ...types.iam.user_detailed import UserDetailed __all__ = ["UsersResource", "AsyncUsersResource"] @@ -65,7 +65,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserUpdate: + ) -> UserUpdated: """This method updates user's details. Args: @@ -120,7 +120,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=UserUpdate, + cast_to=UserUpdated, ) def list( @@ -338,7 +338,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserUpdate: + ) -> UserUpdated: """This method updates user's details. Args: @@ -393,7 +393,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=UserUpdate, + cast_to=UserUpdated, ) def list( diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index aea53517..60629d9e 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -21,7 +21,7 @@ from ..._base_client import AsyncPaginator, make_request_options from ...types.streaming import playlist_list_params, playlist_create_params, playlist_update_params from ...types.streaming.playlist import Playlist -from ...types.streaming.playlist_create import PlaylistCreate +from ...types.streaming.playlist_created import PlaylistCreated from ...types.streaming.playlist_list_videos_response import PlaylistListVideosResponse __all__ = ["PlaylistsResource", "AsyncPlaylistsResource"] @@ -70,7 +70,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PlaylistCreate: + ) -> PlaylistCreated: """ Playlist is a curated collection of video content organized in a sequential manner. @@ -244,7 +244,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PlaylistCreate, + cast_to=PlaylistCreated, ) def update( @@ -559,7 +559,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PlaylistCreate: + ) -> PlaylistCreated: """ Playlist is a curated collection of video content organized in a sequential manner. @@ -733,7 +733,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PlaylistCreate, + cast_to=PlaylistCreated, ) async def update( diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index bac65886..86a27485 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/inference/__init__.py b/src/gcore/types/cloud/inference/__init__.py index 95023b65..66a4d198 100644 --- a/src/gcore/types/cloud/inference/__init__.py +++ b/src/gcore/types/cloud/inference/__init__.py @@ -21,7 +21,7 @@ from .deployment_list_params import DeploymentListParams as DeploymentListParams from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams from .deployment_update_params import DeploymentUpdateParams as DeploymentUpdateParams -from .inference_api_key_create import InferenceAPIKeyCreate as InferenceAPIKeyCreate +from .inference_api_key_created import InferenceAPIKeyCreated as InferenceAPIKeyCreated from .inference_deployment_api_key import InferenceDeploymentAPIKey as InferenceDeploymentAPIKey from .inference_registry_credentials import InferenceRegistryCredentials as InferenceRegistryCredentials from .registry_credential_list_params import RegistryCredentialListParams as RegistryCredentialListParams diff --git a/src/gcore/types/cloud/inference/inference_api_key_create.py b/src/gcore/types/cloud/inference/inference_api_key_created.py similarity index 88% rename from src/gcore/types/cloud/inference/inference_api_key_create.py rename to src/gcore/types/cloud/inference/inference_api_key_created.py index d86eb844..b479f800 100644 --- a/src/gcore/types/cloud/inference/inference_api_key_create.py +++ b/src/gcore/types/cloud/inference/inference_api_key_created.py @@ -4,10 +4,10 @@ from ...._models import BaseModel -__all__ = ["InferenceAPIKeyCreate"] +__all__ = ["InferenceAPIKeyCreated"] -class InferenceAPIKeyCreate(BaseModel): +class InferenceAPIKeyCreated(BaseModel): created_at: str """Timestamp when the API Key was created.""" diff --git a/src/gcore/types/cloud/registries/__init__.py b/src/gcore/types/cloud/registries/__init__.py index daf9c94e..a4e5934f 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_create import RegistryUserCreate as RegistryUserCreate +from .registry_user_created import RegistryUserCreated as RegistryUserCreated 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_create.py b/src/gcore/types/cloud/registries/registry_user_created.py similarity index 88% rename from src/gcore/types/cloud/registries/registry_user_create.py rename to src/gcore/types/cloud/registries/registry_user_created.py index cdace476..6cb1ae87 100644 --- a/src/gcore/types/cloud/registries/registry_user_create.py +++ b/src/gcore/types/cloud/registries/registry_user_created.py @@ -5,10 +5,10 @@ from ...._models import BaseModel -__all__ = ["RegistryUserCreate"] +__all__ = ["RegistryUserCreated"] -class RegistryUserCreate(BaseModel): +class RegistryUserCreated(BaseModel): id: int """User ID""" diff --git a/src/gcore/types/cloud/ssh_key_create.py b/src/gcore/types/cloud/ssh_key_created.py similarity index 96% rename from src/gcore/types/cloud/ssh_key_create.py rename to src/gcore/types/cloud/ssh_key_created.py index f0aa9b31..c889ff5a 100644 --- a/src/gcore/types/cloud/ssh_key_create.py +++ b/src/gcore/types/cloud/ssh_key_created.py @@ -6,10 +6,10 @@ from ..._models import BaseModel -__all__ = ["SSHKeyCreate"] +__all__ = ["SSHKeyCreated"] -class SSHKeyCreate(BaseModel): +class SSHKeyCreated(BaseModel): id: str """SSH key ID""" diff --git a/src/gcore/types/cloud/users/__init__.py b/src/gcore/types/cloud/users/__init__.py index 4f7272e2..0fb51dca 100644 --- a/src/gcore/types/cloud/users/__init__.py +++ b/src/gcore/types/cloud/users/__init__.py @@ -5,5 +5,5 @@ from .role_assignment import RoleAssignment as RoleAssignment from .role_assignment_list_params import RoleAssignmentListParams as RoleAssignmentListParams from .role_assignment_create_params import RoleAssignmentCreateParams as RoleAssignmentCreateParams -from .role_assignment_update_delete import RoleAssignmentUpdateDelete as RoleAssignmentUpdateDelete from .role_assignment_update_params import RoleAssignmentUpdateParams as RoleAssignmentUpdateParams +from .role_assignment_updated_deleted import RoleAssignmentUpdatedDeleted as RoleAssignmentUpdatedDeleted diff --git a/src/gcore/types/cloud/users/role_assignment_update_delete.py b/src/gcore/types/cloud/users/role_assignment_updated_deleted.py similarity index 65% rename from src/gcore/types/cloud/users/role_assignment_update_delete.py rename to src/gcore/types/cloud/users/role_assignment_updated_deleted.py index 51293863..8c38f1c5 100644 --- a/src/gcore/types/cloud/users/role_assignment_update_delete.py +++ b/src/gcore/types/cloud/users/role_assignment_updated_deleted.py @@ -2,9 +2,9 @@ from ...._models import BaseModel -__all__ = ["RoleAssignmentUpdateDelete"] +__all__ = ["RoleAssignmentUpdatedDeleted"] -class RoleAssignmentUpdateDelete(BaseModel): +class RoleAssignmentUpdatedDeleted(BaseModel): assignment_id: int """Assignment ID""" diff --git a/src/gcore/types/iam/__init__.py b/src/gcore/types/iam/__init__.py index ad8745f0..849d7323 100644 --- a/src/gcore/types/iam/__init__.py +++ b/src/gcore/types/iam/__init__.py @@ -5,12 +5,12 @@ from .user import User as User from .api_token import APIToken as APIToken from .user_invite import UserInvite as UserInvite -from .user_update import UserUpdate as UserUpdate +from .user_updated import UserUpdated as UserUpdated from .user_detailed import UserDetailed as UserDetailed from .api_token_list import APITokenList as APITokenList from .account_overview import AccountOverview as AccountOverview -from .api_token_create import APITokenCreate as APITokenCreate from .user_list_params import UserListParams as UserListParams +from .api_token_created import APITokenCreated as APITokenCreated from .user_invite_params import UserInviteParams as UserInviteParams from .user_update_params import UserUpdateParams as UserUpdateParams from .api_token_list_params import APITokenListParams as APITokenListParams diff --git a/src/gcore/types/iam/api_token_create.py b/src/gcore/types/iam/api_token_created.py similarity index 95% rename from src/gcore/types/iam/api_token_create.py rename to src/gcore/types/iam/api_token_created.py index d2157ce0..be3c3ff3 100644 --- a/src/gcore/types/iam/api_token_create.py +++ b/src/gcore/types/iam/api_token_created.py @@ -5,7 +5,7 @@ from ..._models import BaseModel -__all__ = ["APITokenCreate", "ClientUser", "ClientUserRole"] +__all__ = ["APITokenCreated", "ClientUser", "ClientUserRole"] class ClientUserRole(BaseModel): @@ -43,7 +43,7 @@ class ClientUser(BaseModel): """User's name who issued the API token.""" -class APITokenCreate(BaseModel): +class APITokenCreated(BaseModel): id: int """API token ID.""" diff --git a/src/gcore/types/iam/user_update.py b/src/gcore/types/iam/user_updated.py similarity index 96% rename from src/gcore/types/iam/user_update.py rename to src/gcore/types/iam/user_updated.py index b41dcd86..d3e5c38c 100644 --- a/src/gcore/types/iam/user_update.py +++ b/src/gcore/types/iam/user_updated.py @@ -5,7 +5,7 @@ from ..._models import BaseModel -__all__ = ["UserUpdate", "ClientAndRole", "Group"] +__all__ = ["UserUpdated", "ClientAndRole", "Group"] class ClientAndRole(BaseModel): @@ -36,7 +36,7 @@ class Group(BaseModel): """Group's name.""" -class UserUpdate(BaseModel): +class UserUpdated(BaseModel): id: int """User's ID.""" diff --git a/src/gcore/types/streaming/__init__.py b/src/gcore/types/streaming/__init__.py index b58b2e1d..1e0e445a 100644 --- a/src/gcore/types/streaming/__init__.py +++ b/src/gcore/types/streaming/__init__.py @@ -25,9 +25,9 @@ from .storage_series import StorageSeries as StorageSeries from .unique_viewers import UniqueViewers as UniqueViewers from .directory_video import DirectoryVideo as DirectoryVideo -from .playlist_create import PlaylistCreate as PlaylistCreate from .views_by_region import ViewsByRegion as ViewsByRegion from .directories_tree import DirectoriesTree as DirectoriesTree +from .playlist_created import PlaylistCreated as PlaylistCreated from .views_by_browser import ViewsByBrowser as ViewsByBrowser from .views_by_country import ViewsByCountry as ViewsByCountry from .views_by_referer import ViewsByReferer as ViewsByReferer diff --git a/src/gcore/types/streaming/playlist_create.py b/src/gcore/types/streaming/playlist_created.py similarity index 76% rename from src/gcore/types/streaming/playlist_create.py rename to src/gcore/types/streaming/playlist_created.py index eae6f2a6..2f49d6f5 100644 --- a/src/gcore/types/streaming/playlist_create.py +++ b/src/gcore/types/streaming/playlist_created.py @@ -4,9 +4,9 @@ from .playlist import Playlist -__all__ = ["PlaylistCreate"] +__all__ = ["PlaylistCreated"] -class PlaylistCreate(Playlist): +class PlaylistCreated(Playlist): id: Optional[int] = None """Playlist ID""" diff --git a/tests/api_resources/cloud/inference/test_api_keys.py b/tests/api_resources/cloud/inference/test_api_keys.py index 9921af4a..5afddf66 100644 --- a/tests/api_resources/cloud/inference/test_api_keys.py +++ b/tests/api_resources/cloud/inference/test_api_keys.py @@ -12,7 +12,7 @@ from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud.inference import ( InferenceAPIKey, - InferenceAPIKeyCreate, + InferenceAPIKeyCreated, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +27,7 @@ def test_method_create(self, client: Gcore) -> None: project_id=1, name="my-api-key", ) - assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + assert_matches_type(InferenceAPIKeyCreated, api_key, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -37,7 +37,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: description="This key is used for accessing the inference service.", expires_at="2024-10-01T12:00:00Z", ) - assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + assert_matches_type(InferenceAPIKeyCreated, api_key, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -49,7 +49,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" api_key = response.parse() - assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + assert_matches_type(InferenceAPIKeyCreated, api_key, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -61,7 +61,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_key = response.parse() - assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + assert_matches_type(InferenceAPIKeyCreated, api_key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -252,7 +252,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: project_id=1, name="my-api-key", ) - assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + assert_matches_type(InferenceAPIKeyCreated, api_key, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -262,7 +262,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> description="This key is used for accessing the inference service.", expires_at="2024-10-01T12:00:00Z", ) - assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + assert_matches_type(InferenceAPIKeyCreated, api_key, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -274,7 +274,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" api_key = await response.parse() - assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + assert_matches_type(InferenceAPIKeyCreated, api_key, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -286,7 +286,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_key = await response.parse() - assert_matches_type(InferenceAPIKeyCreate, api_key, path=["response"]) + assert_matches_type(InferenceAPIKeyCreated, api_key, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/registries/test_users.py b/tests/api_resources/cloud/registries/test_users.py index a5280bed..1167b206 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, - RegistryUserCreate, + RegistryUserCreated, UserRefreshSecretResponse, ) @@ -31,7 +31,7 @@ def test_method_create(self, client: Gcore) -> None: duration=14, name="user1", ) - assert_matches_type(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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(RegistryUserCreate, user, path=["response"]) + assert_matches_type(RegistryUserCreated, 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 6d72feb6..14428dbf 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, SSHKeyCreate +from gcore.types.cloud import SSHKey, SSHKeyCreated 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(SSHKeyCreate, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, 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(SSHKeyCreate, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, 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(SSHKeyCreate, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, 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(SSHKeyCreate, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, 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(SSHKeyCreate, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, 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(SSHKeyCreate, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, 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(SSHKeyCreate, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, 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(SSHKeyCreate, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/users/test_role_assignments.py b/tests/api_resources/cloud/users/test_role_assignments.py index d4ffeb4c..e29064ca 100644 --- a/tests/api_resources/cloud/users/test_role_assignments.py +++ b/tests/api_resources/cloud/users/test_role_assignments.py @@ -12,7 +12,7 @@ from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud.users import ( RoleAssignment, - RoleAssignmentUpdateDelete, + RoleAssignmentUpdatedDeleted, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -72,7 +72,7 @@ def test_method_update(self, client: Gcore) -> None: role="ClientAdministrator", user_id=777, ) - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: @@ -83,7 +83,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: client_id=8, project_id=None, ) - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: @@ -96,7 +96,7 @@ def test_raw_response_update(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role_assignment = response.parse() - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: @@ -109,7 +109,7 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" role_assignment = response.parse() - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -153,7 +153,7 @@ def test_method_delete(self, client: Gcore) -> None: role_assignment = client.cloud.users.role_assignments.delete( 123, ) - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: @@ -164,7 +164,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role_assignment = response.parse() - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: @@ -175,7 +175,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" role_assignment = response.parse() - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -236,7 +236,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: role="ClientAdministrator", user_id=777, ) - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: @@ -247,7 +247,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> client_id=8, project_id=None, ) - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @@ -260,7 +260,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role_assignment = await response.parse() - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: @@ -273,7 +273,7 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" role_assignment = await response.parse() - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -317,7 +317,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: role_assignment = await async_client.cloud.users.role_assignments.delete( 123, ) - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @@ -328,7 +328,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role_assignment = await response.parse() - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: @@ -339,6 +339,6 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" role_assignment = await response.parse() - assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) + assert_matches_type(RoleAssignmentUpdatedDeleted, role_assignment, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/iam/test_api_tokens.py b/tests/api_resources/iam/test_api_tokens.py index 4991518d..a524f1db 100644 --- a/tests/api_resources/iam/test_api_tokens.py +++ b/tests/api_resources/iam/test_api_tokens.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.iam import APIToken, APITokenList, APITokenCreate +from gcore.types.iam import APIToken, APITokenList, APITokenCreated base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_create(self, client: Gcore) -> None: exp_date="2021-01-01 12:00:00+00:00", name="My token", ) - assert_matches_type(APITokenCreate, api_token, path=["response"]) + assert_matches_type(APITokenCreated, api_token, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -41,7 +41,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: name="My token", description="It's my token", ) - assert_matches_type(APITokenCreate, api_token, path=["response"]) + assert_matches_type(APITokenCreated, api_token, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -55,7 +55,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" api_token = response.parse() - assert_matches_type(APITokenCreate, api_token, path=["response"]) + assert_matches_type(APITokenCreated, api_token, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -69,7 +69,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_token = response.parse() - assert_matches_type(APITokenCreate, api_token, path=["response"]) + assert_matches_type(APITokenCreated, api_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -197,7 +197,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: exp_date="2021-01-01 12:00:00+00:00", name="My token", ) - assert_matches_type(APITokenCreate, api_token, path=["response"]) + assert_matches_type(APITokenCreated, api_token, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -213,7 +213,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> name="My token", description="It's my token", ) - assert_matches_type(APITokenCreate, api_token, path=["response"]) + assert_matches_type(APITokenCreated, api_token, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -227,7 +227,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" api_token = await response.parse() - assert_matches_type(APITokenCreate, api_token, path=["response"]) + assert_matches_type(APITokenCreated, api_token, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -241,7 +241,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_token = await response.parse() - assert_matches_type(APITokenCreate, api_token, path=["response"]) + assert_matches_type(APITokenCreated, api_token, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/iam/test_users.py b/tests/api_resources/iam/test_users.py index bf149b6b..6c3635a9 100644 --- a/tests/api_resources/iam/test_users.py +++ b/tests/api_resources/iam/test_users.py @@ -12,7 +12,7 @@ from gcore.types.iam import ( User, UserInvite, - UserUpdate, + UserUpdated, UserDetailed, ) from gcore.pagination import SyncOffsetPage, AsyncOffsetPage @@ -28,7 +28,7 @@ def test_method_update(self, client: Gcore) -> None: user = client.iam.users.update( user_id=0, ) - assert_matches_type(UserUpdate, user, path=["response"]) + assert_matches_type(UserUpdated, user, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: @@ -47,7 +47,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: name="name", phone="phone", ) - assert_matches_type(UserUpdate, user, path=["response"]) + assert_matches_type(UserUpdated, user, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: @@ -58,7 +58,7 @@ def test_raw_response_update(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserUpdate, user, path=["response"]) + assert_matches_type(UserUpdated, user, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: @@ -69,7 +69,7 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserUpdate, user, path=["response"]) + assert_matches_type(UserUpdated, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -233,7 +233,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: user = await async_client.iam.users.update( user_id=0, ) - assert_matches_type(UserUpdate, user, path=["response"]) + assert_matches_type(UserUpdated, user, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: @@ -252,7 +252,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> name="name", phone="phone", ) - assert_matches_type(UserUpdate, user, path=["response"]) + assert_matches_type(UserUpdated, user, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @@ -263,7 +263,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserUpdate, user, path=["response"]) + assert_matches_type(UserUpdated, user, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: @@ -274,7 +274,7 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserUpdate, user, path=["response"]) + assert_matches_type(UserUpdated, user, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_playlists.py b/tests/api_resources/streaming/test_playlists.py index 80644e67..753dd073 100644 --- a/tests/api_resources/streaming/test_playlists.py +++ b/tests/api_resources/streaming/test_playlists.py @@ -12,7 +12,7 @@ from gcore.pagination import SyncPageStreaming, AsyncPageStreaming from gcore.types.streaming import ( Playlist, - PlaylistCreate, + PlaylistCreated, PlaylistListVideosResponse, ) @@ -25,7 +25,7 @@ class TestPlaylists: @parametrize def test_method_create(self, client: Gcore) -> None: playlist = client.streaming.playlists.create() - assert_matches_type(PlaylistCreate, playlist, path=["response"]) + assert_matches_type(PlaylistCreated, playlist, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -45,7 +45,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: start_time="2024-07-01T11:00:00Z", video_ids=[17800, 17801], ) - assert_matches_type(PlaylistCreate, playlist, path=["response"]) + assert_matches_type(PlaylistCreated, playlist, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -54,7 +54,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" playlist = response.parse() - assert_matches_type(PlaylistCreate, playlist, path=["response"]) + assert_matches_type(PlaylistCreated, playlist, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -63,7 +63,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" playlist = response.parse() - assert_matches_type(PlaylistCreate, playlist, path=["response"]) + assert_matches_type(PlaylistCreated, playlist, path=["response"]) assert cast(Any, response.is_closed) is True @@ -253,7 +253,7 @@ class TestAsyncPlaylists: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: playlist = await async_client.streaming.playlists.create() - assert_matches_type(PlaylistCreate, playlist, path=["response"]) + assert_matches_type(PlaylistCreated, playlist, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -273,7 +273,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> start_time="2024-07-01T11:00:00Z", video_ids=[17800, 17801], ) - assert_matches_type(PlaylistCreate, playlist, path=["response"]) + assert_matches_type(PlaylistCreated, playlist, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -282,7 +282,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" playlist = await response.parse() - assert_matches_type(PlaylistCreate, playlist, path=["response"]) + assert_matches_type(PlaylistCreated, playlist, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -291,7 +291,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" playlist = await response.parse() - assert_matches_type(PlaylistCreate, playlist, path=["response"]) + assert_matches_type(PlaylistCreated, playlist, path=["response"]) assert cast(Any, response.is_closed) is True From ef53b16ec4affa246bd2e628baf3ecd0dc25cd9a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Dec 2025 12:22:11 +0000 Subject: [PATCH 499/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 59acac47..8935e932 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.27.0" + ".": "0.28.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index d6d3f4fb..361aba26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.27.0" +version = "0.28.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 f59c6bde..6f1dd8f4 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.27.0" # x-release-please-version +__version__ = "0.28.0" # x-release-please-version From b99cb7c87cce9b9f7d2c05809b054401c1a7cb24 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 Jan 2026 10:11:05 +0000 Subject: [PATCH 500/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- LICENSE | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 698a6006..ed67f4d9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2c3abe1f1637f97f6bc750aff6eb77efc45ac2b527376541ac2af6b9626b35af.yml -openapi_spec_hash: ff74a4ccd9ec5ddb1a65963d52e709ba +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9fe9802b8aaab88db204b099e3b00ce64e7671a0c1940238830a1170d6cdae51.yml +openapi_spec_hash: 1ccdc3a946fcdf0440c62453683783cd config_hash: df463160c27e4de887be7c27454ac4e0 diff --git a/LICENSE b/LICENSE index b28d04ff..03c99139 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2025 Gcore + Copyright 2026 Gcore Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From a51cb19c6111e06ab82a4a27bfeea9c69137bde6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 Jan 2026 10:11:32 +0000 Subject: [PATCH 501/592] feat(api): aggregated API specs update --- .stats.yml | 4 +-- src/gcore/types/dns/zone_get_response.py | 35 +++++++++-------------- src/gcore/types/dns/zone_list_response.py | 6 ++-- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/.stats.yml b/.stats.yml index ed67f4d9..7dc067f3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9fe9802b8aaab88db204b099e3b00ce64e7671a0c1940238830a1170d6cdae51.yml -openapi_spec_hash: 1ccdc3a946fcdf0440c62453683783cd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ee0efc59d50fe2618b65f41c253bdd82bd91407c103626f24b799f9f9ae517ba.yml +openapi_spec_hash: 81b30a58a624bbf417f1a096c8fc1534 config_hash: df463160c27e4de887be7c27454ac4e0 diff --git a/src/gcore/types/dns/zone_get_response.py b/src/gcore/types/dns/zone_get_response.py index 38422c5c..b984fa7a 100644 --- a/src/gcore/types/dns/zone_get_response.py +++ b/src/gcore/types/dns/zone_get_response.py @@ -1,15 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional - -from pydantic import Field as FieldInfo +from typing import Dict, List, Optional from ..._models import BaseModel -__all__ = ["ZoneGetResponse", "Zone", "ZoneRecord", "ZoneRrsetsAmount", "ZoneRrsetsAmountDynamic"] +__all__ = ["ZoneGetResponse", "Record", "RrsetsAmount", "RrsetsAmountDynamic"] -class ZoneRecord(BaseModel): +class Record(BaseModel): """Record - readonly short version of rrset""" name: Optional[str] = None @@ -21,7 +19,7 @@ class ZoneRecord(BaseModel): type: Optional[str] = None -class ZoneRrsetsAmountDynamic(BaseModel): +class RrsetsAmountDynamic(BaseModel): """Amount of dynamic RRsets in zone""" healthcheck: Optional[int] = None @@ -31,8 +29,8 @@ class ZoneRrsetsAmountDynamic(BaseModel): """Total amount of dynamic RRsets in zone""" -class ZoneRrsetsAmount(BaseModel): - dynamic: Optional[ZoneRrsetsAmountDynamic] = None +class RrsetsAmount(BaseModel): + dynamic: Optional[RrsetsAmountDynamic] = None """Amount of dynamic RRsets in zone""" static: Optional[int] = None @@ -42,8 +40,8 @@ class ZoneRrsetsAmount(BaseModel): """Total amount of RRsets in zone""" -class Zone(BaseModel): - """OutputZone""" +class ZoneGetResponse(BaseModel): + """Complete zone info with all records included""" id: Optional[int] = None """ @@ -51,8 +49,6 @@ class Zone(BaseModel): of getting deleted zones by admin. """ - client_id: Optional[int] = None - contact: Optional[str] = None """email address of the administrator responsible for this zone""" @@ -62,13 +58,15 @@ class Zone(BaseModel): dnssec is disabled for the zone """ + enabled: Optional[bool] = None + expiry: Optional[int] = None """ number of seconds after which secondary name servers should stop answering request for this zone """ - meta: Optional[object] = None + meta: Optional[Dict[str, object]] = None """arbitrarily data of zone in json format""" name: Optional[str] = None @@ -80,7 +78,7 @@ class Zone(BaseModel): primary_server: Optional[str] = None """primary master name server for zone""" - records: Optional[List[ZoneRecord]] = None + records: Optional[List[Record]] = None refresh: Optional[int] = None """ @@ -94,7 +92,7 @@ class Zone(BaseModel): serial number """ - rrsets_amount: Optional[ZoneRrsetsAmount] = None + rrsets_amount: Optional[RrsetsAmount] = None serial: Optional[int] = None """ @@ -105,10 +103,3 @@ class Zone(BaseModel): """ status: Optional[str] = None - - -class ZoneGetResponse(BaseModel): - """Complete zone info with all records included""" - - zone: Optional[Zone] = FieldInfo(alias="Zone", default=None) - """OutputZone""" diff --git a/src/gcore/types/dns/zone_list_response.py b/src/gcore/types/dns/zone_list_response.py index 16d0629b..4b0a0277 100644 --- a/src/gcore/types/dns/zone_list_response.py +++ b/src/gcore/types/dns/zone_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from ..._models import BaseModel @@ -60,13 +60,15 @@ class Zone(BaseModel): dnssec is disabled for the zone """ + enabled: Optional[bool] = None + expiry: Optional[int] = None """ number of seconds after which secondary name servers should stop answering request for this zone """ - meta: Optional[object] = None + meta: Optional[Dict[str, object]] = None """arbitrarily data of zone in json format""" name: Optional[str] = None From f4e7e71784ab876c3d62ab399de15c74cb5453a2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 Jan 2026 15:04:09 +0000 Subject: [PATCH 502/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 7dc067f3..b7270892 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ee0efc59d50fe2618b65f41c253bdd82bd91407c103626f24b799f9f9ae517ba.yml openapi_spec_hash: 81b30a58a624bbf417f1a096c8fc1534 -config_hash: df463160c27e4de887be7c27454ac4e0 +config_hash: 8c967b4319f8d1992bbc86592ad01598 From 8abee36db2726815528e16de42a2857d257bb829 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 Jan 2026 15:26:03 +0000 Subject: [PATCH 503/592] feat(cloud): add support for volume snapshots --- .stats.yml | 4 +- api.md | 15 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + src/gcore/resources/cloud/volume_snapshots.py | 611 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 3 + src/gcore/types/cloud/snapshot.py | 75 +++ .../cloud/volume_snapshot_create_params.py | 33 + .../cloud/volume_snapshot_update_params.py | 54 ++ .../cloud/test_volume_snapshots.py | 429 ++++++++++++ 10 files changed, 1268 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/volume_snapshots.py create mode 100644 src/gcore/types/cloud/snapshot.py create mode 100644 src/gcore/types/cloud/volume_snapshot_create_params.py create mode 100644 src/gcore/types/cloud/volume_snapshot_update_params.py create mode 100644 tests/api_resources/cloud/test_volume_snapshots.py diff --git a/.stats.yml b/.stats.yml index b7270892..6e8bc6bc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 641 +configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ee0efc59d50fe2618b65f41c253bdd82bd91407c103626f24b799f9f9ae517ba.yml openapi_spec_hash: 81b30a58a624bbf417f1a096c8fc1534 -config_hash: 8c967b4319f8d1992bbc86592ad01598 +config_hash: 37ad42485ffe4a964c3d7d7b2564550a diff --git a/api.md b/api.md index ff599062..d38c1ccf 100644 --- a/api.md +++ b/api.md @@ -1165,6 +1165,21 @@ Methods: - client.cloud.databases.postgres.custom_configurations.validate(\*, project_id, region_id, \*\*params) -> PgConfValidation +## VolumeSnapshots + +Types: + +```python +from gcore.types.cloud import Snapshot +``` + +Methods: + +- client.cloud.volume_snapshots.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volume_snapshots.update(snapshot_id, \*, project_id, region_id, \*\*params) -> Snapshot +- client.cloud.volume_snapshots.delete(snapshot_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.volume_snapshots.get(snapshot_id, \*, project_id, region_id) -> Snapshot + # Waap Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 36c2a495..df7277aa 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -216,6 +216,14 @@ PlacementGroupsResourceWithStreamingResponse, AsyncPlacementGroupsResourceWithStreamingResponse, ) +from .volume_snapshots import ( + VolumeSnapshotsResource, + AsyncVolumeSnapshotsResource, + VolumeSnapshotsResourceWithRawResponse, + AsyncVolumeSnapshotsResourceWithRawResponse, + VolumeSnapshotsResourceWithStreamingResponse, + AsyncVolumeSnapshotsResourceWithStreamingResponse, +) from .reserved_fixed_ips import ( ReservedFixedIPsResource, AsyncReservedFixedIPsResource, @@ -402,6 +410,12 @@ "AsyncDatabasesResourceWithRawResponse", "DatabasesResourceWithStreamingResponse", "AsyncDatabasesResourceWithStreamingResponse", + "VolumeSnapshotsResource", + "AsyncVolumeSnapshotsResource", + "VolumeSnapshotsResourceWithRawResponse", + "AsyncVolumeSnapshotsResourceWithRawResponse", + "VolumeSnapshotsResourceWithStreamingResponse", + "AsyncVolumeSnapshotsResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index f8c91a68..47a7caab 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -124,6 +124,14 @@ PlacementGroupsResourceWithStreamingResponse, AsyncPlacementGroupsResourceWithStreamingResponse, ) +from .volume_snapshots import ( + VolumeSnapshotsResource, + AsyncVolumeSnapshotsResource, + VolumeSnapshotsResourceWithRawResponse, + AsyncVolumeSnapshotsResourceWithRawResponse, + VolumeSnapshotsResourceWithStreamingResponse, + AsyncVolumeSnapshotsResourceWithStreamingResponse, +) from .networks.networks import ( NetworksResource, AsyncNetworksResource, @@ -352,6 +360,10 @@ def usage_reports(self) -> UsageReportsResource: def databases(self) -> DatabasesResource: return DatabasesResource(self._client) + @cached_property + def volume_snapshots(self) -> VolumeSnapshotsResource: + return VolumeSnapshotsResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -492,6 +504,10 @@ def usage_reports(self) -> AsyncUsageReportsResource: def databases(self) -> AsyncDatabasesResource: return AsyncDatabasesResource(self._client) + @cached_property + def volume_snapshots(self) -> AsyncVolumeSnapshotsResource: + return AsyncVolumeSnapshotsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -635,6 +651,10 @@ def usage_reports(self) -> UsageReportsResourceWithRawResponse: def databases(self) -> DatabasesResourceWithRawResponse: return DatabasesResourceWithRawResponse(self._cloud.databases) + @cached_property + def volume_snapshots(self) -> VolumeSnapshotsResourceWithRawResponse: + return VolumeSnapshotsResourceWithRawResponse(self._cloud.volume_snapshots) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -759,6 +779,10 @@ def usage_reports(self) -> AsyncUsageReportsResourceWithRawResponse: def databases(self) -> AsyncDatabasesResourceWithRawResponse: return AsyncDatabasesResourceWithRawResponse(self._cloud.databases) + @cached_property + def volume_snapshots(self) -> AsyncVolumeSnapshotsResourceWithRawResponse: + return AsyncVolumeSnapshotsResourceWithRawResponse(self._cloud.volume_snapshots) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -883,6 +907,10 @@ def usage_reports(self) -> UsageReportsResourceWithStreamingResponse: def databases(self) -> DatabasesResourceWithStreamingResponse: return DatabasesResourceWithStreamingResponse(self._cloud.databases) + @cached_property + def volume_snapshots(self) -> VolumeSnapshotsResourceWithStreamingResponse: + return VolumeSnapshotsResourceWithStreamingResponse(self._cloud.volume_snapshots) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -1006,3 +1034,7 @@ def usage_reports(self) -> AsyncUsageReportsResourceWithStreamingResponse: @cached_property def databases(self) -> AsyncDatabasesResourceWithStreamingResponse: return AsyncDatabasesResourceWithStreamingResponse(self._cloud.databases) + + @cached_property + def volume_snapshots(self) -> AsyncVolumeSnapshotsResourceWithStreamingResponse: + return AsyncVolumeSnapshotsResourceWithStreamingResponse(self._cloud.volume_snapshots) diff --git a/src/gcore/resources/cloud/volume_snapshots.py b/src/gcore/resources/cloud/volume_snapshots.py new file mode 100644 index 00000000..fefcddb8 --- /dev/null +++ b/src/gcore/resources/cloud/volume_snapshots.py @@ -0,0 +1,611 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cloud import volume_snapshot_create_params, volume_snapshot_update_params +from ..._base_client import make_request_options +from ...types.cloud.snapshot import Snapshot +from ...types.cloud.task_id_list import TaskIDList +from ...types.cloud.tag_update_map_param import TagUpdateMapParam + +__all__ = ["VolumeSnapshotsResource", "AsyncVolumeSnapshotsResource"] + + +class VolumeSnapshotsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> VolumeSnapshotsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return VolumeSnapshotsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VolumeSnapshotsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return VolumeSnapshotsResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + volume_id: str, + description: str | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Create a new snapshot from a volume. + + Args: + name: Snapshot name + + volume_id: Volume ID to make snapshot of + + description: Snapshot description + + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v1/snapshots/{project_id}/{region_id}", + body=maybe_transform( + { + "name": name, + "volume_id": volume_id, + "description": description, + "tags": tags, + }, + volume_snapshot_create_params.VolumeSnapshotCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + snapshot_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Snapshot: + """ + Rename snapshot or update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + snapshot_id: Unique identifier of the snapshot + + name: Display name for the snapshot (3-63 chars). Used in customer portal and API. + Does not affect snapshot data. + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + + - **Mixed operations:** + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not snapshot_id: + raise ValueError(f"Expected a non-empty value for `snapshot_id` but received {snapshot_id!r}") + return self._patch( + f"/cloud/v1/snapshots/{project_id}/{region_id}/{snapshot_id}", + body=maybe_transform( + { + "name": name, + "tags": tags, + }, + volume_snapshot_update_params.VolumeSnapshotUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Snapshot, + ) + + def delete( + self, + snapshot_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete a specific snapshot. + + Args: + project_id: Project ID + + region_id: Region ID + + snapshot_id: Unique identifier of the snapshot + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not snapshot_id: + raise ValueError(f"Expected a non-empty value for `snapshot_id` but received {snapshot_id!r}") + return self._delete( + f"/cloud/v1/snapshots/{project_id}/{region_id}/{snapshot_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + snapshot_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Snapshot: + """ + Get detailed information about a specific snapshot. + + Args: + project_id: Project ID + + region_id: Region ID + + snapshot_id: Unique identifier of the snapshot + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not snapshot_id: + raise ValueError(f"Expected a non-empty value for `snapshot_id` but received {snapshot_id!r}") + return self._get( + f"/cloud/v1/snapshots/{project_id}/{region_id}/{snapshot_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Snapshot, + ) + + +class AsyncVolumeSnapshotsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncVolumeSnapshotsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncVolumeSnapshotsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVolumeSnapshotsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncVolumeSnapshotsResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + volume_id: str, + description: str | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Create a new snapshot from a volume. + + Args: + name: Snapshot name + + volume_id: Volume ID to make snapshot of + + description: Snapshot description + + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v1/snapshots/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "name": name, + "volume_id": volume_id, + "description": description, + "tags": tags, + }, + volume_snapshot_create_params.VolumeSnapshotCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + snapshot_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Snapshot: + """ + Rename snapshot or update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + snapshot_id: Unique identifier of the snapshot + + name: Display name for the snapshot (3-63 chars). Used in customer portal and API. + Does not affect snapshot data. + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + + - **Mixed operations:** + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not snapshot_id: + raise ValueError(f"Expected a non-empty value for `snapshot_id` but received {snapshot_id!r}") + return await self._patch( + f"/cloud/v1/snapshots/{project_id}/{region_id}/{snapshot_id}", + body=await async_maybe_transform( + { + "name": name, + "tags": tags, + }, + volume_snapshot_update_params.VolumeSnapshotUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Snapshot, + ) + + async def delete( + self, + snapshot_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Delete a specific snapshot. + + Args: + project_id: Project ID + + region_id: Region ID + + snapshot_id: Unique identifier of the snapshot + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not snapshot_id: + raise ValueError(f"Expected a non-empty value for `snapshot_id` but received {snapshot_id!r}") + return await self._delete( + f"/cloud/v1/snapshots/{project_id}/{region_id}/{snapshot_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + snapshot_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Snapshot: + """ + Get detailed information about a specific snapshot. + + Args: + project_id: Project ID + + region_id: Region ID + + snapshot_id: Unique identifier of the snapshot + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not snapshot_id: + raise ValueError(f"Expected a non-empty value for `snapshot_id` but received {snapshot_id!r}") + return await self._get( + f"/cloud/v1/snapshots/{project_id}/{region_id}/{snapshot_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Snapshot, + ) + + +class VolumeSnapshotsResourceWithRawResponse: + def __init__(self, volume_snapshots: VolumeSnapshotsResource) -> None: + self._volume_snapshots = volume_snapshots + + self.create = to_raw_response_wrapper( + volume_snapshots.create, + ) + self.update = to_raw_response_wrapper( + volume_snapshots.update, + ) + self.delete = to_raw_response_wrapper( + volume_snapshots.delete, + ) + self.get = to_raw_response_wrapper( + volume_snapshots.get, + ) + + +class AsyncVolumeSnapshotsResourceWithRawResponse: + def __init__(self, volume_snapshots: AsyncVolumeSnapshotsResource) -> None: + self._volume_snapshots = volume_snapshots + + self.create = async_to_raw_response_wrapper( + volume_snapshots.create, + ) + self.update = async_to_raw_response_wrapper( + volume_snapshots.update, + ) + self.delete = async_to_raw_response_wrapper( + volume_snapshots.delete, + ) + self.get = async_to_raw_response_wrapper( + volume_snapshots.get, + ) + + +class VolumeSnapshotsResourceWithStreamingResponse: + def __init__(self, volume_snapshots: VolumeSnapshotsResource) -> None: + self._volume_snapshots = volume_snapshots + + self.create = to_streamed_response_wrapper( + volume_snapshots.create, + ) + self.update = to_streamed_response_wrapper( + volume_snapshots.update, + ) + self.delete = to_streamed_response_wrapper( + volume_snapshots.delete, + ) + self.get = to_streamed_response_wrapper( + volume_snapshots.get, + ) + + +class AsyncVolumeSnapshotsResourceWithStreamingResponse: + def __init__(self, volume_snapshots: AsyncVolumeSnapshotsResource) -> None: + self._volume_snapshots = volume_snapshots + + self.create = async_to_streamed_response_wrapper( + volume_snapshots.create, + ) + self.update = async_to_streamed_response_wrapper( + volume_snapshots.update, + ) + self.delete = async_to_streamed_response_wrapper( + volume_snapshots.delete, + ) + self.get = async_to_streamed_response_wrapper( + volume_snapshots.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 86a27485..87ed7492 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -18,6 +18,7 @@ from .ssh_key import SSHKey as SSHKey from .instance import Instance as Instance from .registry import Registry as Registry +from .snapshot import Snapshot as Snapshot from .gpu_image import GPUImage as GPUImage from .ip_ranges import IPRanges as IPRanges from .file_share import FileShare as FileShare @@ -154,6 +155,8 @@ from .load_balancer_listener_detail import LoadBalancerListenerDetail as LoadBalancerListenerDetail from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams +from .volume_snapshot_create_params import VolumeSnapshotCreateParams as VolumeSnapshotCreateParams +from .volume_snapshot_update_params import VolumeSnapshotUpdateParams as VolumeSnapshotUpdateParams from .cost_report_aggregated_monthly import CostReportAggregatedMonthly as CostReportAggregatedMonthly from .inference_region_capacity_list import InferenceRegionCapacityList as InferenceRegionCapacityList from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus diff --git a/src/gcore/types/cloud/snapshot.py b/src/gcore/types/cloud/snapshot.py new file mode 100644 index 00000000..ac5ca594 --- /dev/null +++ b/src/gcore/types/cloud/snapshot.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .tag import Tag +from ..._models import BaseModel + +__all__ = ["Snapshot"] + + +class Snapshot(BaseModel): + id: str + """Snapshot ID""" + + created_at: datetime + """Datetime when the snapshot was created""" + + creator_task_id: str + """Task that created this entity""" + + description: Optional[str] = None + """Snapshot description""" + + name: str + """Snapshot name""" + + project_id: int + """Project ID""" + + region: str + """Region name""" + + region_id: int + """Region ID""" + + size: int + """Snapshot size, GiB""" + + status: Literal[ + "available", + "backing-up", + "creating", + "deleted", + "deleting", + "error", + "error_deleting", + "restoring", + "unmanaging", + ] + """Snapshot status""" + + tags: List[Tag] + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. + """ + + task_id: Optional[str] = None + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. + """ + + updated_at: datetime + """Datetime when the snapshot was last updated""" + + volume_id: str + """ID of the volume this snapshot was made from""" diff --git a/src/gcore/types/cloud/volume_snapshot_create_params.py b/src/gcore/types/cloud/volume_snapshot_create_params.py new file mode 100644 index 00000000..b832806b --- /dev/null +++ b/src/gcore/types/cloud/volume_snapshot_create_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import Required, TypedDict + +__all__ = ["VolumeSnapshotCreateParams"] + + +class VolumeSnapshotCreateParams(TypedDict, total=False): + project_id: int + + region_id: int + + name: Required[str] + """Snapshot name""" + + volume_id: Required[str] + """Volume ID to make snapshot of""" + + description: str + """Snapshot description""" + + tags: Dict[str, str] + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. + """ diff --git a/src/gcore/types/cloud/volume_snapshot_update_params.py b/src/gcore/types/cloud/volume_snapshot_update_params.py new file mode 100644 index 00000000..5e279e7e --- /dev/null +++ b/src/gcore/types/cloud/volume_snapshot_update_params.py @@ -0,0 +1,54 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +from .tag_update_map_param import TagUpdateMapParam + +__all__ = ["VolumeSnapshotUpdateParams"] + + +class VolumeSnapshotUpdateParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + name: str + """Display name for the snapshot (3-63 chars). + + Used in customer portal and API. Does not affect snapshot data. + """ + + tags: Optional[TagUpdateMapParam] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + + - **Mixed operations:** + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ diff --git a/tests/api_resources/cloud/test_volume_snapshots.py b/tests/api_resources/cloud/test_volume_snapshots.py new file mode 100644 index 00000000..4b2d7bfd --- /dev/null +++ b/tests/api_resources/cloud/test_volume_snapshots.py @@ -0,0 +1,429 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import ( + Snapshot, + TaskIDList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestVolumeSnapshots: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + volume_snapshot = client.cloud.volume_snapshots.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + ) + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + volume_snapshot = client.cloud.volume_snapshots.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + description="Snapshot description", + tags={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.volume_snapshots.with_raw_response.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.volume_snapshots.with_streaming_response.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + volume_snapshot = client.cloud.volume_snapshots.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + volume_snapshot = client.cloud.volume_snapshots.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + name="my-backup-snapshot", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.volume_snapshots.with_raw_response.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = response.parse() + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.volume_snapshots.with_streaming_response.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = response.parse() + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `snapshot_id` but received ''"): + client.cloud.volume_snapshots.with_raw_response.update( + snapshot_id="", + project_id=1, + region_id=1, + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + volume_snapshot = client.cloud.volume_snapshots.delete( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.volume_snapshots.with_raw_response.delete( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.volume_snapshots.with_streaming_response.delete( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `snapshot_id` but received ''"): + client.cloud.volume_snapshots.with_raw_response.delete( + snapshot_id="", + project_id=1, + region_id=1, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + volume_snapshot = client.cloud.volume_snapshots.get( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.volume_snapshots.with_raw_response.get( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = response.parse() + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.volume_snapshots.with_streaming_response.get( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = response.parse() + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `snapshot_id` but received ''"): + client.cloud.volume_snapshots.with_raw_response.get( + snapshot_id="", + project_id=1, + region_id=1, + ) + + +class TestAsyncVolumeSnapshots: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncGcore) -> None: + volume_snapshot = await async_client.cloud.volume_snapshots.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + ) + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + volume_snapshot = await async_client.cloud.volume_snapshots.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + description="Snapshot description", + tags={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volume_snapshots.with_raw_response.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = await response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volume_snapshots.with_streaming_response.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = await response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + volume_snapshot = await async_client.cloud.volume_snapshots.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + volume_snapshot = await async_client.cloud.volume_snapshots.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + name="my-backup-snapshot", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volume_snapshots.with_raw_response.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = await response.parse() + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volume_snapshots.with_streaming_response.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = await response.parse() + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `snapshot_id` but received ''"): + await async_client.cloud.volume_snapshots.with_raw_response.update( + snapshot_id="", + project_id=1, + region_id=1, + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + volume_snapshot = await async_client.cloud.volume_snapshots.delete( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volume_snapshots.with_raw_response.delete( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = await response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volume_snapshots.with_streaming_response.delete( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = await response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `snapshot_id` but received ''"): + await async_client.cloud.volume_snapshots.with_raw_response.delete( + snapshot_id="", + project_id=1, + region_id=1, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + volume_snapshot = await async_client.cloud.volume_snapshots.get( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volume_snapshots.with_raw_response.get( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = await response.parse() + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volume_snapshots.with_streaming_response.get( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = await response.parse() + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `snapshot_id` but received ''"): + await async_client.cloud.volume_snapshots.with_raw_response.get( + snapshot_id="", + project_id=1, + region_id=1, + ) From d597d8caf363ef157cbb7080dfed9fd0e77eb84c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Jan 2026 09:17:44 +0000 Subject: [PATCH 504/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 6e8bc6bc..e6455392 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ee0efc59d50fe2618b65f41c253bdd82bd91407c103626f24b799f9f9ae517ba.yml openapi_spec_hash: 81b30a58a624bbf417f1a096c8fc1534 -config_hash: 37ad42485ffe4a964c3d7d7b2564550a +config_hash: cba67c225c37fe0e91ed7586f53169e4 From cc237996b533fdefe2ca454dc3bf2b23537397cb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Jan 2026 10:11:38 +0000 Subject: [PATCH 505/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cdn/logs_uploader/policies.py | 127 +++++++++++++++++- .../cdn/logs_uploader/logs_uploader_policy.py | 26 +++- .../cdn/logs_uploader/policy_create_params.py | 27 +++- .../logs_uploader/policy_replace_params.py | 27 +++- .../cdn/logs_uploader/policy_update_params.py | 27 +++- src/gcore/types/dns/zones/dns_output_rrset.py | 10 +- .../cdn/logs_uploader/test_policies.py | 18 ++- 8 files changed, 236 insertions(+), 30 deletions(-) diff --git a/.stats.yml b/.stats.yml index e6455392..58e08d86 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ee0efc59d50fe2618b65f41c253bdd82bd91407c103626f24b799f9f9ae517ba.yml -openapi_spec_hash: 81b30a58a624bbf417f1a096c8fc1534 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-33aa30cae2d845ec4347e37da18c094ba63cd87f8c80c1d40cb62fbcd84711e4.yml +openapi_spec_hash: ca2f0eca860c223ceb929d5533de8c9e config_hash: cba67c225c37fe0e91ed7586f53169e4 diff --git a/src/gcore/resources/cdn/logs_uploader/policies.py b/src/gcore/resources/cdn/logs_uploader/policies.py index 1ea24646..a6d933fb 100644 --- a/src/gcore/resources/cdn/logs_uploader/policies.py +++ b/src/gcore/resources/cdn/logs_uploader/policies.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import Dict, Iterable, Optional +from typing_extensions import Literal import httpx @@ -55,11 +56,12 @@ def create( *, date_format: str | Omit = omit, description: str | Omit = omit, + escape_special_characters: bool | Omit = omit, field_delimiter: str | Omit = omit, field_separator: str | Omit = omit, fields: SequenceNotStr[str] | Omit = omit, file_name_template: str | Omit = omit, - format_type: str | Omit = omit, + format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, name: str | Omit = omit, @@ -83,6 +85,17 @@ def create( description: Description of the policy. + escape_special_characters: When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + field_delimiter: Field delimiter for logs. field_separator: Field separator for logs. @@ -93,6 +106,12 @@ def create( format_type: Format type for logs. + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + include_empty_logs: Include empty logs in the upload. include_shield_logs: Include logs from origin shielding in the upload. @@ -125,6 +144,7 @@ def create( { "date_format": date_format, "description": description, + "escape_special_characters": escape_special_characters, "field_delimiter": field_delimiter, "field_separator": field_separator, "fields": fields, @@ -153,11 +173,12 @@ def update( *, date_format: str | Omit = omit, description: str | Omit = omit, + escape_special_characters: bool | Omit = omit, field_delimiter: str | Omit = omit, field_separator: str | Omit = omit, fields: SequenceNotStr[str] | Omit = omit, file_name_template: str | Omit = omit, - format_type: str | Omit = omit, + format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, name: str | Omit = omit, @@ -181,6 +202,17 @@ def update( description: Description of the policy. + escape_special_characters: When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + field_delimiter: Field delimiter for logs. field_separator: Field separator for logs. @@ -191,6 +223,12 @@ def update( format_type: Format type for logs. + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + include_empty_logs: Include empty logs in the upload. include_shield_logs: Include logs from origin shielding in the upload. @@ -223,6 +261,7 @@ def update( { "date_format": date_format, "description": description, + "escape_special_characters": escape_special_characters, "field_delimiter": field_delimiter, "field_separator": field_separator, "fields": fields, @@ -384,11 +423,12 @@ def replace( *, date_format: str | Omit = omit, description: str | Omit = omit, + escape_special_characters: bool | Omit = omit, field_delimiter: str | Omit = omit, field_separator: str | Omit = omit, fields: SequenceNotStr[str] | Omit = omit, file_name_template: str | Omit = omit, - format_type: str | Omit = omit, + format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, name: str | Omit = omit, @@ -412,6 +452,17 @@ def replace( description: Description of the policy. + escape_special_characters: When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + field_delimiter: Field delimiter for logs. field_separator: Field separator for logs. @@ -422,6 +473,12 @@ def replace( format_type: Format type for logs. + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + include_empty_logs: Include empty logs in the upload. include_shield_logs: Include logs from origin shielding in the upload. @@ -454,6 +511,7 @@ def replace( { "date_format": date_format, "description": description, + "escape_special_characters": escape_special_characters, "field_delimiter": field_delimiter, "field_separator": field_separator, "fields": fields, @@ -502,11 +560,12 @@ async def create( *, date_format: str | Omit = omit, description: str | Omit = omit, + escape_special_characters: bool | Omit = omit, field_delimiter: str | Omit = omit, field_separator: str | Omit = omit, fields: SequenceNotStr[str] | Omit = omit, file_name_template: str | Omit = omit, - format_type: str | Omit = omit, + format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, name: str | Omit = omit, @@ -530,6 +589,17 @@ async def create( description: Description of the policy. + escape_special_characters: When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + field_delimiter: Field delimiter for logs. field_separator: Field separator for logs. @@ -540,6 +610,12 @@ async def create( format_type: Format type for logs. + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + include_empty_logs: Include empty logs in the upload. include_shield_logs: Include logs from origin shielding in the upload. @@ -572,6 +648,7 @@ async def create( { "date_format": date_format, "description": description, + "escape_special_characters": escape_special_characters, "field_delimiter": field_delimiter, "field_separator": field_separator, "fields": fields, @@ -600,11 +677,12 @@ async def update( *, date_format: str | Omit = omit, description: str | Omit = omit, + escape_special_characters: bool | Omit = omit, field_delimiter: str | Omit = omit, field_separator: str | Omit = omit, fields: SequenceNotStr[str] | Omit = omit, file_name_template: str | Omit = omit, - format_type: str | Omit = omit, + format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, name: str | Omit = omit, @@ -628,6 +706,17 @@ async def update( description: Description of the policy. + escape_special_characters: When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + field_delimiter: Field delimiter for logs. field_separator: Field separator for logs. @@ -638,6 +727,12 @@ async def update( format_type: Format type for logs. + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + include_empty_logs: Include empty logs in the upload. include_shield_logs: Include logs from origin shielding in the upload. @@ -670,6 +765,7 @@ async def update( { "date_format": date_format, "description": description, + "escape_special_characters": escape_special_characters, "field_delimiter": field_delimiter, "field_separator": field_separator, "fields": fields, @@ -831,11 +927,12 @@ async def replace( *, date_format: str | Omit = omit, description: str | Omit = omit, + escape_special_characters: bool | Omit = omit, field_delimiter: str | Omit = omit, field_separator: str | Omit = omit, fields: SequenceNotStr[str] | Omit = omit, file_name_template: str | Omit = omit, - format_type: str | Omit = omit, + format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, name: str | Omit = omit, @@ -859,6 +956,17 @@ async def replace( description: Description of the policy. + escape_special_characters: When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + field_delimiter: Field delimiter for logs. field_separator: Field separator for logs. @@ -869,6 +977,12 @@ async def replace( format_type: Format type for logs. + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + include_empty_logs: Include empty logs in the upload. include_shield_logs: Include logs from origin shielding in the upload. @@ -901,6 +1015,7 @@ async def replace( { "date_format": date_format, "description": description, + "escape_special_characters": escape_special_characters, "field_delimiter": field_delimiter, "field_separator": field_separator, "fields": fields, diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py index 241cb7d5..dd6cfc5a 100644 --- a/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py @@ -2,6 +2,7 @@ from typing import Dict, List, Optional from datetime import datetime +from typing_extensions import Literal from ...._models import BaseModel @@ -23,6 +24,20 @@ class LogsUploaderPolicy(BaseModel): description: Optional[str] = None """Description of the policy.""" + escape_special_characters: Optional[bool] = None + """ + When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + """ + field_delimiter: Optional[str] = None """Field delimiter for logs.""" @@ -35,8 +50,15 @@ class LogsUploaderPolicy(BaseModel): file_name_template: Optional[str] = None """Template for log file name.""" - format_type: Optional[str] = None - """Format type for logs.""" + format_type: Optional[Literal["json", ""]] = None + """Format type for logs. + + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + """ include_empty_logs: Optional[bool] = None """Include empty logs in the upload.""" diff --git a/src/gcore/types/cdn/logs_uploader/policy_create_params.py b/src/gcore/types/cdn/logs_uploader/policy_create_params.py index 4d763619..7179d9d1 100644 --- a/src/gcore/types/cdn/logs_uploader/policy_create_params.py +++ b/src/gcore/types/cdn/logs_uploader/policy_create_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, Optional -from typing_extensions import TypedDict +from typing_extensions import Literal, TypedDict from ...._types import SequenceNotStr @@ -17,6 +17,20 @@ class PolicyCreateParams(TypedDict, total=False): description: str """Description of the policy.""" + escape_special_characters: bool + """ + When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + """ + field_delimiter: str """Field delimiter for logs.""" @@ -29,8 +43,15 @@ class PolicyCreateParams(TypedDict, total=False): file_name_template: str """Template for log file name.""" - format_type: str - """Format type for logs.""" + format_type: Literal["json", ""] + """Format type for logs. + + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + """ include_empty_logs: bool """Include empty logs in the upload.""" diff --git a/src/gcore/types/cdn/logs_uploader/policy_replace_params.py b/src/gcore/types/cdn/logs_uploader/policy_replace_params.py index 7c62d955..cc779079 100644 --- a/src/gcore/types/cdn/logs_uploader/policy_replace_params.py +++ b/src/gcore/types/cdn/logs_uploader/policy_replace_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, Optional -from typing_extensions import TypedDict +from typing_extensions import Literal, TypedDict from ...._types import SequenceNotStr @@ -17,6 +17,20 @@ class PolicyReplaceParams(TypedDict, total=False): description: str """Description of the policy.""" + escape_special_characters: bool + """ + When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + """ + field_delimiter: str """Field delimiter for logs.""" @@ -29,8 +43,15 @@ class PolicyReplaceParams(TypedDict, total=False): file_name_template: str """Template for log file name.""" - format_type: str - """Format type for logs.""" + format_type: Literal["json", ""] + """Format type for logs. + + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + """ include_empty_logs: bool """Include empty logs in the upload.""" diff --git a/src/gcore/types/cdn/logs_uploader/policy_update_params.py b/src/gcore/types/cdn/logs_uploader/policy_update_params.py index c1bb5811..0e8ce99d 100644 --- a/src/gcore/types/cdn/logs_uploader/policy_update_params.py +++ b/src/gcore/types/cdn/logs_uploader/policy_update_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, Optional -from typing_extensions import TypedDict +from typing_extensions import Literal, TypedDict from ...._types import SequenceNotStr @@ -17,6 +17,20 @@ class PolicyUpdateParams(TypedDict, total=False): description: str """Description of the policy.""" + escape_special_characters: bool + """ + When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + """ + field_delimiter: str """Field delimiter for logs.""" @@ -29,8 +43,15 @@ class PolicyUpdateParams(TypedDict, total=False): file_name_template: str """Template for log file name.""" - format_type: str - """Format type for logs.""" + format_type: Literal["json", ""] + """Format type for logs. + + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + """ include_empty_logs: bool """Include empty logs in the upload.""" diff --git a/src/gcore/types/dns/zones/dns_output_rrset.py b/src/gcore/types/dns/zones/dns_output_rrset.py index 13a99e28..67b794d6 100644 --- a/src/gcore/types/dns/zones/dns_output_rrset.py +++ b/src/gcore/types/dns/zones/dns_output_rrset.py @@ -38,11 +38,11 @@ class ResourceRecord(BaseModel): 2. `continents` (array of string) 3. `countries` (array of string) 4. `latlong` (array of float64, latitude and longitude) - 5. `fallback` (bool) - 6. `backup` (bool) - 7. `notes` (string) - 8. `weight` (float) - 9. `ip` (string) + 5. `backup` (bool) + 6. `notes` (string) + 7. `weight` (float) + 8. `ip` (string) + 9. `default` (bool) Some keys are reserved for balancing, @see https://api.gcore.com/dns/v2/info/meta diff --git a/tests/api_resources/cdn/logs_uploader/test_policies.py b/tests/api_resources/cdn/logs_uploader/test_policies.py index 07ed96bf..e197ed4c 100644 --- a/tests/api_resources/cdn/logs_uploader/test_policies.py +++ b/tests/api_resources/cdn/logs_uploader/test_policies.py @@ -31,11 +31,12 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: policy = client.cdn.logs_uploader.policies.create( date_format="[02/Jan/2006:15:04:05 -0700]", description="New policy", + escape_special_characters=True, field_delimiter=",", field_separator=";", fields=["remote_addr", "status"], file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", - format_type="flvproxy", + format_type="json", include_empty_logs=True, include_shield_logs=True, name="Policy", @@ -80,11 +81,12 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: id=0, date_format="[02/Jan/2006:15:04:05 -0700]", description="New policy", + escape_special_characters=True, field_delimiter=",", field_separator=";", fields=["remote_addr", "status"], file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", - format_type="flvproxy", + format_type="json", include_empty_logs=True, include_shield_logs=True, name="Policy", @@ -253,11 +255,12 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: id=0, date_format="[02/Jan/2006:15:04:05 -0700]", description="New policy", + escape_special_characters=True, field_delimiter=",", field_separator=";", fields=["remote_addr", "status"], file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", - format_type="flvproxy", + format_type="json", include_empty_logs=True, include_shield_logs=True, name="Policy", @@ -309,11 +312,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> policy = await async_client.cdn.logs_uploader.policies.create( date_format="[02/Jan/2006:15:04:05 -0700]", description="New policy", + escape_special_characters=True, field_delimiter=",", field_separator=";", fields=["remote_addr", "status"], file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", - format_type="flvproxy", + format_type="json", include_empty_logs=True, include_shield_logs=True, name="Policy", @@ -358,11 +362,12 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> id=0, date_format="[02/Jan/2006:15:04:05 -0700]", description="New policy", + escape_special_characters=True, field_delimiter=",", field_separator=";", fields=["remote_addr", "status"], file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", - format_type="flvproxy", + format_type="json", include_empty_logs=True, include_shield_logs=True, name="Policy", @@ -531,11 +536,12 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> id=0, date_format="[02/Jan/2006:15:04:05 -0700]", description="New policy", + escape_special_characters=True, field_delimiter=",", field_separator=";", fields=["remote_addr", "status"], file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", - format_type="flvproxy", + format_type="json", include_empty_logs=True, include_shield_logs=True, name="Policy", From de4514918a3162b5f3c445f8a740f0d4cc5fd74f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Jan 2026 11:09:47 +0000 Subject: [PATCH 506/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 58e08d86..012d8b2b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-33aa30cae2d845ec4347e37da18c094ba63cd87f8c80c1d40cb62fbcd84711e4.yml -openapi_spec_hash: ca2f0eca860c223ceb929d5533de8c9e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f7071d2209910e2d6aa64c6dc59a626672b55ac387f7ccbbb686d6c40f6789ca.yml +openapi_spec_hash: dada79ef3ca01512c80d9579bc03acb4 config_hash: cba67c225c37fe0e91ed7586f53169e4 From d716f289dc6cd3a29175dd568ba3f422aa0deb48 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Jan 2026 10:12:07 +0000 Subject: [PATCH 507/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 69 ++-- .../resources/cloud/instances/flavors.py | 10 +- .../resources/cloud/k8s/clusters/clusters.py | 20 +- .../cloud/k8s/clusters/pools/pools.py | 10 +- src/gcore/resources/cloud/k8s/k8s.py | 10 +- .../resources/cloud/load_balancers/flavors.py | 18 +- .../cloud/load_balancers/load_balancers.py | 151 ++++++-- .../resources/cloud/load_balancers/metrics.py | 22 +- .../cloud/load_balancers/statuses.py | 30 +- src/gcore/resources/cloud/networks/subnets.py | 4 +- src/gcore/resources/cloud/placement_groups.py | 10 +- .../reserved_fixed_ips/vip/candidate_ports.py | 10 +- .../reserved_fixed_ips/vip/connected_ports.py | 28 +- .../resources/cloud/security_groups/rules.py | 48 ++- .../cloud/security_groups/security_groups.py | 60 ++++ src/gcore/types/cloud/__init__.py | 7 +- src/gcore/types/cloud/cost_report_detailed.py | 12 +- .../inference/deployment_update_params.py | 4 +- src/gcore/types/cloud/instances/__init__.py | 3 +- .../cloud/instances/flavor_list_response.py | 94 +++++ .../types/cloud/instances/instance_flavor.py | 51 --- src/gcore/types/cloud/k8s/__init__.py | 5 +- ...uster_list.py => cluster_list_response.py} | 4 +- ...ter_list_versions_for_upgrade_response.py} | 8 +- .../types/cloud/k8s/clusters/__init__.py | 2 +- ...ter_pool_list.py => pool_list_response.py} | 4 +- ..._list.py => k8s_list_versions_response.py} | 4 +- .../cloud/load_balancer_create_params.py | 8 +- .../cloud/load_balancer_failover_params.py | 2 + .../types/cloud/load_balancer_flavor_list.py | 16 - .../types/cloud/load_balancer_get_params.py | 4 +- .../types/cloud/load_balancer_list_params.py | 42 ++- .../cloud/load_balancer_resize_params.py | 2 + .../cloud/load_balancer_update_params.py | 2 + .../types/cloud/load_balancers/__init__.py | 3 + .../load_balancers/flavor_list_params.py | 2 + .../load_balancers/flavor_list_response.py | 34 ++ .../load_balancers/metric_list_params.py | 2 + .../metric_list_response.py} | 8 +- .../status_list_response.py} | 8 +- src/gcore/types/cloud/networks/__init__.py | 1 - src/gcore/types/cloud/networks/router_list.py | 16 - .../cloud/networks/subnet_update_params.py | 2 +- ...st.py => placement_group_list_response.py} | 4 +- src/gcore/types/cloud/region.py | 4 +- .../types/cloud/registries/registry_user.py | 3 +- .../cloud/registries/registry_user_created.py | 5 +- .../user_refresh_secret_response.py | 5 +- .../cloud/reserved_fixed_ips/vip/__init__.py | 6 +- ...ist.py => candidate_port_list_response.py} | 4 +- ...list.py => connected_port_add_response.py} | 4 +- .../vip/connected_port_list_response.py | 16 + .../vip/connected_port_replace_response.py | 16 + .../types/cloud/security_group_copy_params.py | 2 + .../cloud/security_group_create_params.py | 8 +- src/gcore/types/cloud/security_group_rule.py | 24 +- .../cloud/security_group_update_params.py | 2 + .../security_groups/rule_create_params.py | 12 +- .../security_groups/rule_replace_params.py | 2 + src/gcore/types/cloud/usage_report.py | 12 +- .../cloud/inference/test_deployments.py | 4 +- .../cloud/instances/test_flavors.py | 18 +- .../cloud/k8s/clusters/test_pools.py | 14 +- .../api_resources/cloud/k8s/test_clusters.py | 29 +- .../cloud/load_balancers/test_flavors.py | 50 +-- .../cloud/load_balancers/test_metrics.py | 58 +-- .../cloud/load_balancers/test_statuses.py | 83 ++--- .../vip/test_candidate_ports.py | 14 +- .../vip/test_connected_ports.py | 48 +-- .../cloud/security_groups/test_rules.py | 168 ++++----- tests/api_resources/cloud/test_k8s.py | 14 +- .../cloud/test_load_balancers.py | 340 +++++++++--------- .../cloud/test_placement_groups.py | 14 +- .../cloud/test_security_groups.py | 236 ++++++------ 75 files changed, 1227 insertions(+), 846 deletions(-) create mode 100644 src/gcore/types/cloud/instances/flavor_list_response.py delete mode 100644 src/gcore/types/cloud/instances/instance_flavor.py rename src/gcore/types/cloud/k8s/{k8s_cluster_list.py => cluster_list_response.py} (79%) rename src/gcore/types/cloud/{instances/instance_flavor_list.py => k8s/cluster_list_versions_for_upgrade_response.py} (51%) rename src/gcore/types/cloud/k8s/clusters/{k8s_cluster_pool_list.py => pool_list_response.py} (80%) rename src/gcore/types/cloud/{k8s_cluster_version_list.py => k8s_list_versions_response.py} (78%) delete mode 100644 src/gcore/types/cloud/load_balancer_flavor_list.py create mode 100644 src/gcore/types/cloud/load_balancers/flavor_list_response.py rename src/gcore/types/cloud/{load_balancer_metrics_list.py => load_balancers/metric_list_response.py} (56%) rename src/gcore/types/cloud/{load_balancer_status_list.py => load_balancers/status_list_response.py} (56%) delete mode 100644 src/gcore/types/cloud/networks/router_list.py rename src/gcore/types/cloud/{placement_group_list.py => placement_group_list_response.py} (77%) rename src/gcore/types/cloud/reserved_fixed_ips/vip/{candidate_port_list.py => candidate_port_list_response.py} (77%) rename src/gcore/types/cloud/reserved_fixed_ips/vip/{connected_port_list.py => connected_port_add_response.py} (77%) create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list_response.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_response.py diff --git a/.stats.yml b/.stats.yml index 012d8b2b..d5976c8d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f7071d2209910e2d6aa64c6dc59a626672b55ac387f7ccbbb686d6c40f6789ca.yml -openapi_spec_hash: dada79ef3ca01512c80d9579bc03acb4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-432dafc5e24ab4a5594e628f3ac9a35e906e1de7dd20eeecd27afaf143dec88f.yml +openapi_spec_hash: 57bd58f035387ac1efdcbefa5abab427 config_hash: cba67c225c37fe0e91ed7586f53169e4 diff --git a/api.md b/api.md index d38c1ccf..644fa847 100644 --- a/api.md +++ b/api.md @@ -187,7 +187,6 @@ from gcore.types.cloud import ( LbSessionPersistenceType, ListenerStatus, LoadBalancerFlavorDetail, - LoadBalancerFlavorList, LoadBalancerL7Policy, LoadBalancerL7PolicyList, LoadBalancerL7Rule, @@ -195,11 +194,9 @@ from gcore.types.cloud import ( LoadBalancerListenerDetail, LoadBalancerListenerList, LoadBalancerMetrics, - LoadBalancerMetricsList, LoadBalancerPool, LoadBalancerPoolList, LoadBalancerStatus, - LoadBalancerStatusList, Member, MemberStatus, PoolStatus, @@ -239,9 +236,15 @@ Methods: ### Flavors +Types: + +```python +from gcore.types.cloud.load_balancers import FlavorListResponse +``` + Methods: -- client.cloud.load_balancers.flavors.list(\*, project_id, region_id, \*\*params) -> LoadBalancerFlavorList +- client.cloud.load_balancers.flavors.list(\*, project_id, region_id, \*\*params) -> FlavorListResponse ### Listeners @@ -279,15 +282,27 @@ Methods: ### Metrics +Types: + +```python +from gcore.types.cloud.load_balancers import MetricListResponse +``` + Methods: -- client.cloud.load_balancers.metrics.list(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancerMetricsList +- client.cloud.load_balancers.metrics.list(load_balancer_id, \*, project_id, region_id, \*\*params) -> MetricListResponse ### Statuses +Types: + +```python +from gcore.types.cloud.load_balancers import StatusListResponse +``` + Methods: -- client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> LoadBalancerStatusList +- client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> StatusListResponse - client.cloud.load_balancers.statuses.get(load_balancer_id, \*, project_id, region_id) -> LoadBalancerStatus ## ReservedFixedIPs @@ -323,26 +338,31 @@ Methods: Types: ```python -from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePort, CandidatePortList +from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePort, CandidatePortListResponse ``` Methods: -- client.cloud.reserved_fixed_ips.vip.candidate_ports.list(port_id, \*, project_id, region_id) -> CandidatePortList +- client.cloud.reserved_fixed_ips.vip.candidate_ports.list(port_id, \*, project_id, region_id) -> CandidatePortListResponse #### ConnectedPorts Types: ```python -from gcore.types.cloud.reserved_fixed_ips.vip import ConnectedPort, ConnectedPortList +from gcore.types.cloud.reserved_fixed_ips.vip import ( + ConnectedPort, + ConnectedPortListResponse, + ConnectedPortAddResponse, + ConnectedPortReplaceResponse, +) ``` Methods: -- client.cloud.reserved_fixed_ips.vip.connected_ports.list(port_id, \*, project_id, region_id) -> ConnectedPortList -- client.cloud.reserved_fixed_ips.vip.connected_ports.add(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList -- client.cloud.reserved_fixed_ips.vip.connected_ports.replace(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList +- client.cloud.reserved_fixed_ips.vip.connected_ports.list(port_id, \*, project_id, region_id) -> ConnectedPortListResponse +- client.cloud.reserved_fixed_ips.vip.connected_ports.add(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortAddResponse +- client.cloud.reserved_fixed_ips.vip.connected_ports.replace(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortReplaceResponse ## Networks @@ -369,7 +389,7 @@ Methods: Types: ```python -from gcore.types.cloud.networks import Router, RouterList, SubnetID +from gcore.types.cloud.networks import Router, SubnetID ``` Methods: @@ -618,13 +638,13 @@ Methods: Types: ```python -from gcore.types.cloud import PlacementGroup, PlacementGroupList +from gcore.types.cloud import PlacementGroup, PlacementGroupListResponse ``` Methods: - client.cloud.placement_groups.create(\*, project_id, region_id, \*\*params) -> PlacementGroup -- client.cloud.placement_groups.list(\*, project_id, region_id) -> PlacementGroupList +- client.cloud.placement_groups.list(\*, project_id, region_id) -> PlacementGroupListResponse - client.cloud.placement_groups.delete(group_id, \*, project_id, region_id) -> TaskIDList - client.cloud.placement_groups.get(group_id, \*, project_id, region_id) -> PlacementGroup @@ -957,12 +977,12 @@ Methods: Types: ```python -from gcore.types.cloud.instances import InstanceFlavor, InstanceFlavorList +from gcore.types.cloud.instances import InstanceFlavor, InstanceFlavorList, FlavorListResponse ``` Methods: -- client.cloud.instances.flavors.list(\*, project_id, region_id, \*\*params) -> InstanceFlavorList +- client.cloud.instances.flavors.list(\*, project_id, region_id, \*\*params) -> FlavorListResponse ### Interfaces @@ -1000,12 +1020,12 @@ Methods: Types: ```python -from gcore.types.cloud import K8SClusterVersion, K8SClusterVersionList +from gcore.types.cloud import K8SClusterVersion, K8SListVersionsResponse ``` Methods: -- client.cloud.k8s.list_versions(\*, project_id, region_id) -> K8SClusterVersionList +- client.cloud.k8s.list_versions(\*, project_id, region_id) -> K8SListVersionsResponse ### Flavors @@ -1022,7 +1042,8 @@ from gcore.types.cloud.k8s import ( K8SCluster, K8SClusterCertificate, K8SClusterKubeconfig, - K8SClusterList, + ClusterListResponse, + ClusterListVersionsForUpgradeResponse, ) ``` @@ -1030,12 +1051,12 @@ Methods: - client.cloud.k8s.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.k8s.clusters.update(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.k8s.clusters.list(\*, project_id, region_id) -> K8SClusterList +- client.cloud.k8s.clusters.list(\*, project_id, region_id) -> ClusterListResponse - client.cloud.k8s.clusters.delete(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.k8s.clusters.get(cluster_name, \*, project_id, region_id) -> K8SCluster - client.cloud.k8s.clusters.get_certificate(cluster_name, \*, project_id, region_id) -> K8SClusterCertificate - client.cloud.k8s.clusters.get_kubeconfig(cluster_name, \*, project_id, region_id) -> K8SClusterKubeconfig -- client.cloud.k8s.clusters.list_versions_for_upgrade(cluster_name, \*, project_id, region_id) -> K8SClusterVersionList +- client.cloud.k8s.clusters.list_versions_for_upgrade(cluster_name, \*, project_id, region_id) -> ClusterListVersionsForUpgradeResponse - client.cloud.k8s.clusters.upgrade(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList #### Nodes @@ -1050,14 +1071,14 @@ Methods: Types: ```python -from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolList, K8SClusterPoolQuota +from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolQuota, PoolListResponse ``` Methods: - client.cloud.k8s.clusters.pools.create(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.k8s.clusters.pools.update(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> K8SClusterPool -- client.cloud.k8s.clusters.pools.list(cluster_name, \*, project_id, region_id) -> K8SClusterPoolList +- client.cloud.k8s.clusters.pools.list(cluster_name, \*, project_id, region_id) -> PoolListResponse - client.cloud.k8s.clusters.pools.delete(pool_name, \*, project_id, region_id, cluster_name) -> TaskIDList - client.cloud.k8s.clusters.pools.check_quota(\*, project_id, region_id, \*\*params) -> K8SClusterPoolQuota - client.cloud.k8s.clusters.pools.get(pool_name, \*, project_id, region_id, cluster_name) -> K8SClusterPool diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 23ba0073..69f5eace 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -16,7 +16,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.instances import flavor_list_params -from ....types.cloud.instances.instance_flavor_list import InstanceFlavorList +from ....types.cloud.instances.flavor_list_response import FlavorListResponse __all__ = ["FlavorsResource", "AsyncFlavorsResource"] @@ -56,7 +56,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> InstanceFlavorList: + ) -> FlavorListResponse: """Retrieve a list of available instance flavors in the project and region. When @@ -101,7 +101,7 @@ def list( flavor_list_params.FlavorListParams, ), ), - cast_to=InstanceFlavorList, + cast_to=FlavorListResponse, ) @@ -140,7 +140,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> InstanceFlavorList: + ) -> FlavorListResponse: """Retrieve a list of available instance flavors in the project and region. When @@ -185,7 +185,7 @@ async def list( flavor_list_params.FlavorListParams, ), ), - cast_to=InstanceFlavorList, + cast_to=FlavorListResponse, ) diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index 52ab2f78..8b48757d 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -41,10 +41,10 @@ ) from .....types.cloud.task_id_list import TaskIDList from .....types.cloud.k8s.k8s_cluster import K8SCluster -from .....types.cloud.k8s.k8s_cluster_list import K8SClusterList -from .....types.cloud.k8s_cluster_version_list import K8SClusterVersionList +from .....types.cloud.k8s.cluster_list_response import ClusterListResponse from .....types.cloud.k8s.k8s_cluster_kubeconfig import K8SClusterKubeconfig from .....types.cloud.k8s.k8s_cluster_certificate import K8SClusterCertificate +from .....types.cloud.k8s.cluster_list_versions_for_upgrade_response import ClusterListVersionsForUpgradeResponse __all__ = ["ClustersResource", "AsyncClustersResource"] @@ -381,7 +381,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterList: + ) -> ClusterListResponse: """ List k8s clusters @@ -403,7 +403,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterList, + cast_to=ClusterListResponse, ) def delete( @@ -581,7 +581,7 @@ def list_versions_for_upgrade( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterVersionList: + ) -> ClusterListVersionsForUpgradeResponse: """ List available k8s cluster versions for upgrade @@ -605,7 +605,7 @@ def list_versions_for_upgrade( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterVersionList, + cast_to=ClusterListVersionsForUpgradeResponse, ) def upgrade( @@ -984,7 +984,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterList: + ) -> ClusterListResponse: """ List k8s clusters @@ -1006,7 +1006,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterList, + cast_to=ClusterListResponse, ) async def delete( @@ -1184,7 +1184,7 @@ async def list_versions_for_upgrade( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterVersionList: + ) -> ClusterListVersionsForUpgradeResponse: """ List available k8s cluster versions for upgrade @@ -1208,7 +1208,7 @@ async def list_versions_for_upgrade( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterVersionList, + cast_to=ClusterListVersionsForUpgradeResponse, ) async def upgrade( diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 7de8cf65..1dd0f32d 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -34,7 +34,7 @@ ) from ......types.cloud.task_id_list import TaskIDList from ......types.cloud.k8s.clusters.k8s_cluster_pool import K8SClusterPool -from ......types.cloud.k8s.clusters.k8s_cluster_pool_list import K8SClusterPoolList +from ......types.cloud.k8s.clusters.pool_list_response import PoolListResponse from ......types.cloud.k8s.clusters.k8s_cluster_pool_quota import K8SClusterPoolQuota __all__ = ["PoolsResource", "AsyncPoolsResource"] @@ -244,7 +244,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterPoolList: + ) -> PoolListResponse: """ List k8s cluster pools @@ -268,7 +268,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterPoolList, + cast_to=PoolListResponse, ) def delete( @@ -683,7 +683,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterPoolList: + ) -> PoolListResponse: """ List k8s cluster pools @@ -707,7 +707,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterPoolList, + cast_to=PoolListResponse, ) async def delete( diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index e1dabed0..da703ea5 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -30,7 +30,7 @@ ClustersResourceWithStreamingResponse, AsyncClustersResourceWithStreamingResponse, ) -from ....types.cloud.k8s_cluster_version_list import K8SClusterVersionList +from ....types.cloud.k8s_list_versions_response import K8SListVersionsResponse __all__ = ["K8SResource", "AsyncK8SResource"] @@ -74,7 +74,7 @@ def list_versions( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterVersionList: + ) -> K8SListVersionsResponse: """ List available k8s cluster versions for creation @@ -96,7 +96,7 @@ def list_versions( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterVersionList, + cast_to=K8SListVersionsResponse, ) @@ -139,7 +139,7 @@ async def list_versions( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterVersionList: + ) -> K8SListVersionsResponse: """ List available k8s cluster versions for creation @@ -161,7 +161,7 @@ async def list_versions( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterVersionList, + cast_to=K8SListVersionsResponse, ) diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index 8d126cd7..c6c71f5c 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -16,7 +16,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.load_balancers import flavor_list_params -from ....types.cloud.load_balancer_flavor_list import LoadBalancerFlavorList +from ....types.cloud.load_balancers.flavor_list_response import FlavorListResponse __all__ = ["FlavorsResource", "AsyncFlavorsResource"] @@ -53,7 +53,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerFlavorList: + ) -> FlavorListResponse: """Retrieve a list of load balancer flavors. When the `include_prices` query @@ -61,6 +61,10 @@ def list( price values as 0. If you get Pricing Error contact the support Args: + project_id: Project ID + + region_id: Region ID + include_prices: Set to true if the response should include flavor prices extra_headers: Send extra headers @@ -84,7 +88,7 @@ def list( timeout=timeout, query=maybe_transform({"include_prices": include_prices}, flavor_list_params.FlavorListParams), ), - cast_to=LoadBalancerFlavorList, + cast_to=FlavorListResponse, ) @@ -120,7 +124,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerFlavorList: + ) -> FlavorListResponse: """Retrieve a list of load balancer flavors. When the `include_prices` query @@ -128,6 +132,10 @@ async def list( price values as 0. If you get Pricing Error contact the support Args: + project_id: Project ID + + region_id: Region ID + include_prices: Set to true if the response should include flavor prices extra_headers: Send extra headers @@ -153,7 +161,7 @@ async def list( {"include_prices": include_prices}, flavor_list_params.FlavorListParams ), ), - cast_to=LoadBalancerFlavorList, + cast_to=FlavorListResponse, ) diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 8d4aece6..6a097c65 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import Dict, Iterable, Optional +from typing_extensions import Literal import httpx @@ -157,6 +158,10 @@ def create( Create load balancer Args: + project_id: Project ID + + region_id: Region ID + flavor: Load balancer flavor name floating_ip: Floating IP configuration for assignment @@ -257,6 +262,12 @@ def update( remain unchanged. Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + logging: Logging configuration name: Name. @@ -332,7 +343,25 @@ def list( logging_enabled: bool | Omit = omit, name: str | Omit = omit, offset: int | Omit = omit, - order_by: str | Omit = omit, + order_by: Literal[ + "created_at.asc", + "created_at.desc", + "flavor.asc", + "flavor.desc", + "name.asc", + "name.desc", + "operating_status.asc", + "operating_status.desc", + "provisioning_status.asc", + "provisioning_status.desc", + "updated_at.asc", + "updated_at.desc", + "vip_address.asc", + "vip_address.desc", + "vip_ip_family.asc", + "vip_ip_family.desc", + ] + | Omit = omit, show_stats: bool | Omit = omit, tag_key: SequenceNotStr[str] | Omit = omit, tag_key_value: str | Omit = omit, @@ -348,26 +377,27 @@ def list( List load balancers Args: + project_id: Project ID + + region_id: Region ID + assigned_floating: With or without assigned floating IP - limit: Limit the number of returned limit request entities. + limit: Limit of items on a single page - logging_enabled: With or without logging + logging_enabled: With or without logging enabled name: Filter by name - offset: Offset value is used to exclude the first set of records from the result. + offset: Offset in results list - order_by: Ordering Load Balancer list result by name, `created_at`, `updated_at`, - `operating_status`, `provisioning_status`, `vip_address`, `vip_ip_family` and - flavor fields of the load balancer and directions (name.asc), default is - "`created_at`.asc" + order_by: Order by field and direction. show_stats: Show statistics - tag_key: Filter by tag keys. + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. + tag_key_value: Optional. Filter by tag key-value pairs. with_ddos: Show Advanced DDoS protection profile, if exists @@ -427,6 +457,12 @@ def delete( Delete load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -467,6 +503,12 @@ def failover( Failover load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + force: Validate current load balancer status before failover or not. extra_headers: Send extra headers @@ -511,9 +553,15 @@ def get( Get load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + show_stats: Show statistics - with_ddos: Show DDoS profile + with_ddos: Show Advanced DDoS protection profile, if exists extra_headers: Send extra headers @@ -565,6 +613,12 @@ def resize( Resize load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + flavor: Name of the desired flavor to resize to. extra_headers: Send extra headers @@ -663,6 +717,10 @@ async def create( Create load balancer Args: + project_id: Project ID + + region_id: Region ID + flavor: Load balancer flavor name floating_ip: Floating IP configuration for assignment @@ -763,6 +821,12 @@ async def update( remain unchanged. Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + logging: Logging configuration name: Name. @@ -838,7 +902,25 @@ def list( logging_enabled: bool | Omit = omit, name: str | Omit = omit, offset: int | Omit = omit, - order_by: str | Omit = omit, + order_by: Literal[ + "created_at.asc", + "created_at.desc", + "flavor.asc", + "flavor.desc", + "name.asc", + "name.desc", + "operating_status.asc", + "operating_status.desc", + "provisioning_status.asc", + "provisioning_status.desc", + "updated_at.asc", + "updated_at.desc", + "vip_address.asc", + "vip_address.desc", + "vip_ip_family.asc", + "vip_ip_family.desc", + ] + | Omit = omit, show_stats: bool | Omit = omit, tag_key: SequenceNotStr[str] | Omit = omit, tag_key_value: str | Omit = omit, @@ -854,26 +936,27 @@ def list( List load balancers Args: + project_id: Project ID + + region_id: Region ID + assigned_floating: With or without assigned floating IP - limit: Limit the number of returned limit request entities. + limit: Limit of items on a single page - logging_enabled: With or without logging + logging_enabled: With or without logging enabled name: Filter by name - offset: Offset value is used to exclude the first set of records from the result. + offset: Offset in results list - order_by: Ordering Load Balancer list result by name, `created_at`, `updated_at`, - `operating_status`, `provisioning_status`, `vip_address`, `vip_ip_family` and - flavor fields of the load balancer and directions (name.asc), default is - "`created_at`.asc" + order_by: Order by field and direction. show_stats: Show statistics - tag_key: Filter by tag keys. + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. + tag_key_value: Optional. Filter by tag key-value pairs. with_ddos: Show Advanced DDoS protection profile, if exists @@ -933,6 +1016,12 @@ async def delete( Delete load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -973,6 +1062,12 @@ async def failover( Failover load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + force: Validate current load balancer status before failover or not. extra_headers: Send extra headers @@ -1019,9 +1114,15 @@ async def get( Get load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + show_stats: Show statistics - with_ddos: Show DDoS profile + with_ddos: Show Advanced DDoS protection profile, if exists extra_headers: Send extra headers @@ -1073,6 +1174,12 @@ async def resize( Resize load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + flavor: Name of the desired flavor to resize to. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index e7647609..72ba10be 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -18,7 +18,7 @@ from ...._base_client import make_request_options from ....types.cloud.load_balancers import metric_list_params from ....types.cloud.instance_metrics_time_unit import InstanceMetricsTimeUnit -from ....types.cloud.load_balancer_metrics_list import LoadBalancerMetricsList +from ....types.cloud.load_balancers.metric_list_response import MetricListResponse __all__ = ["MetricsResource", "AsyncMetricsResource"] @@ -57,11 +57,17 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerMetricsList: + ) -> MetricListResponse: """ Get load balancer metrics, including cpu, memory and network Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + time_interval: Time interval time_unit: Time interval unit @@ -92,7 +98,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerMetricsList, + cast_to=MetricListResponse, ) @@ -130,11 +136,17 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerMetricsList: + ) -> MetricListResponse: """ Get load balancer metrics, including cpu, memory and network Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + time_interval: Time interval time_unit: Time interval unit @@ -165,7 +177,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerMetricsList, + cast_to=MetricListResponse, ) diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index e537b073..1805ddd4 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -15,7 +15,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.load_balancer_status import LoadBalancerStatus -from ....types.cloud.load_balancer_status_list import LoadBalancerStatusList +from ....types.cloud.load_balancers.status_list_response import StatusListResponse __all__ = ["StatusesResource", "AsyncStatusesResource"] @@ -51,11 +51,15 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerStatusList: + ) -> StatusListResponse: """ List load balancers statuses Args: + project_id: Project ID + + region_id: Region ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -73,7 +77,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerStatusList, + cast_to=StatusListResponse, ) def get( @@ -93,6 +97,12 @@ def get( Get load balancer status Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -147,11 +157,15 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerStatusList: + ) -> StatusListResponse: """ List load balancers statuses Args: + project_id: Project ID + + region_id: Region ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -169,7 +183,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerStatusList, + cast_to=StatusListResponse, ) async def get( @@ -189,6 +203,12 @@ async def get( Get load balancer status Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 6de45b06..4180bb0b 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -156,7 +156,7 @@ def update( project_id: int | None = None, region_id: int | None = None, dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, - enable_dhcp: Optional[bool] | Omit = omit, + enable_dhcp: bool | Omit = omit, gateway_ip: Optional[str] | Omit = omit, host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | Omit = omit, name: Optional[str] | Omit = omit, @@ -559,7 +559,7 @@ async def update( project_id: int | None = None, region_id: int | None = None, dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, - enable_dhcp: Optional[bool] | Omit = omit, + enable_dhcp: bool | Omit = omit, gateway_ip: Optional[str] | Omit = omit, host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | Omit = omit, name: Optional[str] | Omit = omit, diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 243dd294..4cd753f3 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -20,7 +20,7 @@ from ..._base_client import make_request_options from ...types.cloud.task_id_list import TaskIDList from ...types.cloud.placement_group import PlacementGroup -from ...types.cloud.placement_group_list import PlacementGroupList +from ...types.cloud.placement_group_list_response import PlacementGroupListResponse __all__ = ["PlacementGroupsResource", "AsyncPlacementGroupsResource"] @@ -109,7 +109,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PlacementGroupList: + ) -> PlacementGroupListResponse: """ List placement groups @@ -131,7 +131,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PlacementGroupList, + cast_to=PlacementGroupListResponse, ) def delete( @@ -297,7 +297,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PlacementGroupList: + ) -> PlacementGroupListResponse: """ List placement groups @@ -319,7 +319,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PlacementGroupList, + cast_to=PlacementGroupListResponse, ) async def delete( diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py index fdc29228..3c726b46 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py @@ -14,7 +14,7 @@ async_to_streamed_response_wrapper, ) from ....._base_client import make_request_options -from .....types.cloud.reserved_fixed_ips.vip.candidate_port_list import CandidatePortList +from .....types.cloud.reserved_fixed_ips.vip.candidate_port_list_response import CandidatePortListResponse __all__ = ["CandidatePortsResource", "AsyncCandidatePortsResource"] @@ -51,7 +51,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CandidatePortList: + ) -> CandidatePortListResponse: """ List all instance ports that are available for connecting to a VIP. @@ -75,7 +75,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CandidatePortList, + cast_to=CandidatePortListResponse, ) @@ -111,7 +111,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CandidatePortList: + ) -> CandidatePortListResponse: """ List all instance ports that are available for connecting to a VIP. @@ -135,7 +135,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CandidatePortList, + cast_to=CandidatePortListResponse, ) diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py index f98e4b8a..a78a8e6c 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py @@ -16,7 +16,9 @@ ) from ....._base_client import make_request_options from .....types.cloud.reserved_fixed_ips.vip import connected_port_add_params, connected_port_replace_params -from .....types.cloud.reserved_fixed_ips.vip.connected_port_list import ConnectedPortList +from .....types.cloud.reserved_fixed_ips.vip.connected_port_add_response import ConnectedPortAddResponse +from .....types.cloud.reserved_fixed_ips.vip.connected_port_list_response import ConnectedPortListResponse +from .....types.cloud.reserved_fixed_ips.vip.connected_port_replace_response import ConnectedPortReplaceResponse __all__ = ["ConnectedPortsResource", "AsyncConnectedPortsResource"] @@ -53,7 +55,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortList: + ) -> ConnectedPortListResponse: """ List all instance ports that share a VIP. @@ -77,7 +79,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortList, + cast_to=ConnectedPortListResponse, ) def add( @@ -93,7 +95,7 @@ def add( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortList: + ) -> ConnectedPortAddResponse: """ Add instance ports to share a VIP. @@ -120,7 +122,7 @@ def add( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortList, + cast_to=ConnectedPortAddResponse, ) def replace( @@ -136,7 +138,7 @@ def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortList: + ) -> ConnectedPortReplaceResponse: """ Replace the list of instance ports that share a VIP. @@ -163,7 +165,7 @@ def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortList, + cast_to=ConnectedPortReplaceResponse, ) @@ -199,7 +201,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortList: + ) -> ConnectedPortListResponse: """ List all instance ports that share a VIP. @@ -223,7 +225,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortList, + cast_to=ConnectedPortListResponse, ) async def add( @@ -239,7 +241,7 @@ async def add( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortList: + ) -> ConnectedPortAddResponse: """ Add instance ports to share a VIP. @@ -266,7 +268,7 @@ async def add( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortList, + cast_to=ConnectedPortAddResponse, ) async def replace( @@ -282,7 +284,7 @@ async def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortList: + ) -> ConnectedPortReplaceResponse: """ Replace the list of instance ports that share a VIP. @@ -311,7 +313,7 @@ async def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortList, + cast_to=ConnectedPortReplaceResponse, ) diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index aacd3921..dc4cdfa2 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -50,8 +50,8 @@ def create( *, project_id: int | None = None, region_id: int | None = None, + direction: Literal["egress", "ingress"], description: str | Omit = omit, - direction: Literal["egress", "ingress"] | Omit = omit, ethertype: Literal["IPv4", "IPv6"] | Omit = omit, port_range_max: Optional[int] | Omit = omit, port_range_min: Optional[int] | Omit = omit, @@ -95,10 +95,16 @@ def create( Add a new rule to an existing security group. Args: - description: Rule description + project_id: Project ID + + region_id: Region ID + + group_id: Group ID direction: Ingress or egress, which is the direction in which the security group is applied + description: Rule description + ethertype: Ether type port_range_max: The maximum port number in the range that is matched by the security group rule @@ -129,8 +135,8 @@ def create( f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=maybe_transform( { - "description": description, "direction": direction, + "description": description, "ethertype": ethertype, "port_range_max": port_range_max, "port_range_min": port_range_min, @@ -163,6 +169,12 @@ def delete( Delete a specific rule from a security group. Args: + project_id: Project ID + + region_id: Region ID + + rule_id: Rule ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -238,6 +250,12 @@ def replace( Update the configuration of an existing security group rule. Args: + project_id: Project ID + + region_id: Region ID + + rule_id: Rule ID + direction: Ingress or egress, which is the direction in which the security group rule is applied @@ -321,8 +339,8 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, + direction: Literal["egress", "ingress"], description: str | Omit = omit, - direction: Literal["egress", "ingress"] | Omit = omit, ethertype: Literal["IPv4", "IPv6"] | Omit = omit, port_range_max: Optional[int] | Omit = omit, port_range_min: Optional[int] | Omit = omit, @@ -366,10 +384,16 @@ async def create( Add a new rule to an existing security group. Args: - description: Rule description + project_id: Project ID + + region_id: Region ID + + group_id: Group ID direction: Ingress or egress, which is the direction in which the security group is applied + description: Rule description + ethertype: Ether type port_range_max: The maximum port number in the range that is matched by the security group rule @@ -400,8 +424,8 @@ async def create( f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=await async_maybe_transform( { - "description": description, "direction": direction, + "description": description, "ethertype": ethertype, "port_range_max": port_range_max, "port_range_min": port_range_min, @@ -434,6 +458,12 @@ async def delete( Delete a specific rule from a security group. Args: + project_id: Project ID + + region_id: Region ID + + rule_id: Rule ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -509,6 +539,12 @@ async def replace( Update the configuration of an existing security group rule. Args: + project_id: Project ID + + region_id: Region ID + + rule_id: Rule ID + direction: Ingress or egress, which is the direction in which the security group rule is applied diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index ca0d7b65..27442cce 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -135,6 +135,12 @@ def update( Update the configuration of an existing security group. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + changed_rules: List of rules to create or delete name: Name @@ -278,6 +284,12 @@ def delete( Delete a specific security group and all its associated rules. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -319,6 +331,12 @@ def copy( Create a deep copy of an existing security group. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + name: Name. extra_headers: Send extra headers @@ -361,6 +379,12 @@ def get( Get detailed information about a specific security group. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -400,6 +424,12 @@ def revert_to_default( Revert a security group to its previous state. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -520,6 +550,12 @@ async def update( Update the configuration of an existing security group. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + changed_rules: List of rules to create or delete name: Name @@ -663,6 +699,12 @@ async def delete( Delete a specific security group and all its associated rules. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -704,6 +746,12 @@ async def copy( Create a deep copy of an existing security group. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + name: Name. extra_headers: Send extra headers @@ -746,6 +794,12 @@ async def get( Get detailed information about a specific security group. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -785,6 +839,12 @@ async def revert_to_default( Revert a security group to its previous state. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 87ed7492..57125bdd 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -79,7 +79,6 @@ from .instance_list_params import InstanceListParams as InstanceListParams from .lb_listener_protocol import LbListenerProtocol as LbListenerProtocol from .load_balancer_status import LoadBalancerStatus as LoadBalancerStatus -from .placement_group_list import PlacementGroupList as PlacementGroupList from .tag_update_map_param import TagUpdateMapParam as TagUpdateMapParam from .volume_create_params import VolumeCreateParams as VolumeCreateParams from .volume_delete_params import VolumeDeleteParams as VolumeDeleteParams @@ -118,21 +117,18 @@ from .file_share_create_params import FileShareCreateParams as FileShareCreateParams from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams from .file_share_update_params import FileShareUpdateParams as FileShareUpdateParams -from .k8s_cluster_version_list import K8SClusterVersionList as K8SClusterVersionList from .load_balancer_get_params import LoadBalancerGetParams as LoadBalancerGetParams from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams from .floating_ip_update_params import FloatingIPUpdateParams as FloatingIPUpdateParams from .inference_region_capacity import InferenceRegionCapacity as InferenceRegionCapacity -from .load_balancer_flavor_list import LoadBalancerFlavorList as LoadBalancerFlavorList from .load_balancer_list_params import LoadBalancerListParams as LoadBalancerListParams -from .load_balancer_status_list import LoadBalancerStatusList as LoadBalancerStatusList from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit +from .k8s_list_versions_response import K8SListVersionsResponse as K8SListVersionsResponse from .load_balancer_l7_rule_list import LoadBalancerL7RuleList as LoadBalancerL7RuleList -from .load_balancer_metrics_list import LoadBalancerMetricsList as LoadBalancerMetricsList from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField @@ -154,6 +150,7 @@ from .load_balancer_failover_params import LoadBalancerFailoverParams as LoadBalancerFailoverParams from .load_balancer_listener_detail import LoadBalancerListenerDetail as LoadBalancerListenerDetail from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams +from .placement_group_list_response import PlacementGroupListResponse as PlacementGroupListResponse from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams from .volume_snapshot_create_params import VolumeSnapshotCreateParams as VolumeSnapshotCreateParams from .volume_snapshot_update_params import VolumeSnapshotUpdateParams as VolumeSnapshotUpdateParams diff --git a/src/gcore/types/cloud/cost_report_detailed.py b/src/gcore/types/cloud/cost_report_detailed.py index 5669ad22..348099af 100644 --- a/src/gcore/types/cloud/cost_report_detailed.py +++ b/src/gcore/types/cloud/cost_report_detailed.py @@ -365,6 +365,9 @@ class ResultResourceEgressTrafficWithCostSerializer(BaseModel): first_seen: datetime """First time the resource was seen in the given period""" + instance_name: Optional[str] = None + """Name of the instance""" + instance_type: Literal["baremetal", "vm"] """Type of the instance""" @@ -394,9 +397,6 @@ class ResultResourceEgressTrafficWithCostSerializer(BaseModel): vm_id: str """ID of the bare metal server the traffic is associated with""" - instance_name: Optional[str] = None - """Name of the instance""" - class ResultResourceExternalIPWithCostSerializer(BaseModel): attached_to_vm: Optional[str] = None @@ -1011,6 +1011,9 @@ class ResultResourceSnapshotWithCostSerializer(BaseModel): class ResultResourceVolumeWithCostSerializer(BaseModel): + attached_to_vm: Optional[str] = None + """ID of the VM the volume is attached to""" + billing_feature_name: Optional[str] = None billing_metric_name: str @@ -1066,9 +1069,6 @@ class ResultResourceVolumeWithCostSerializer(BaseModel): volume_type: str """Type of the volume""" - attached_to_vm: Optional[str] = None - """ID of the VM the volume is attached to""" - class ResultResourceDbaasPostgreSQLPoolerWithCostSerializer(BaseModel): billing_feature_name: Optional[str] = None diff --git a/src/gcore/types/cloud/inference/deployment_update_params.py b/src/gcore/types/cloud/inference/deployment_update_params.py index 85037b7b..ad86e3eb 100644 --- a/src/gcore/types/cloud/inference/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -230,10 +230,10 @@ class ContainerScale(TypedDict, total=False): class Container(TypedDict, total=False): - region_id: Required[Optional[int]] + region_id: Required[int] """Region id for the container""" - scale: Required[Optional[ContainerScale]] + scale: Required[ContainerScale] """Scale for the container""" diff --git a/src/gcore/types/cloud/instances/__init__.py b/src/gcore/types/cloud/instances/__init__.py index c2f77cfe..5fc63c97 100644 --- a/src/gcore/types/cloud/instances/__init__.py +++ b/src/gcore/types/cloud/instances/__init__.py @@ -4,14 +4,13 @@ from .metrics import Metrics as Metrics from .metrics_list import MetricsList as MetricsList -from .instance_flavor import InstanceFlavor as InstanceFlavor from .image_get_params import ImageGetParams as ImageGetParams from .image_list_params import ImageListParams as ImageListParams from .flavor_list_params import FlavorListParams as FlavorListParams from .metric_list_params import MetricListParams as MetricListParams from .image_update_params import ImageUpdateParams as ImageUpdateParams from .image_upload_params import ImageUploadParams as ImageUploadParams -from .instance_flavor_list import InstanceFlavorList as InstanceFlavorList +from .flavor_list_response import FlavorListResponse as FlavorListResponse from .interface_attach_params import InterfaceAttachParams as InterfaceAttachParams from .interface_detach_params import InterfaceDetachParams as InterfaceDetachParams from .image_create_from_volume_params import ImageCreateFromVolumeParams as ImageCreateFromVolumeParams diff --git a/src/gcore/types/cloud/instances/flavor_list_response.py b/src/gcore/types/cloud/instances/flavor_list_response.py new file mode 100644 index 00000000..7b51daf6 --- /dev/null +++ b/src/gcore/types/cloud/instances/flavor_list_response.py @@ -0,0 +1,94 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from ...._models import BaseModel + +__all__ = [ + "FlavorListResponse", + "Result", + "ResultInstanceFlavorExtendedSerializerWithoutPrice", + "ResultInstanceFlavorExtendedSerializerWithPrice", +] + + +class ResultInstanceFlavorExtendedSerializerWithoutPrice(BaseModel): + """Instances flavor schema without price information""" + + architecture: str + """Flavor architecture type""" + + disabled: bool + """Disabled flavor flag""" + + flavor_id: str + """Flavor ID is the same as name""" + + flavor_name: str + """Flavor name""" + + hardware_description: Dict[str, str] + """Additional hardware description""" + + os_type: str + """Flavor operating system""" + + ram: int + """RAM size in MiB""" + + vcpus: int + """Virtual CPU count""" + + +class ResultInstanceFlavorExtendedSerializerWithPrice(BaseModel): + """Instances flavor schema with price information""" + + architecture: str + """Flavor architecture type""" + + currency_code: Optional[str] = None + """Currency code""" + + disabled: bool + """Disabled flavor flag""" + + flavor_id: str + """Flavor ID is the same as name""" + + flavor_name: str + """Flavor name""" + + hardware_description: Dict[str, str] + """Additional hardware description""" + + os_type: str + """Flavor operating system""" + + price_per_hour: Optional[float] = None + """Price per hour""" + + price_per_month: Optional[float] = None + """Price per month""" + + price_status: Optional[Literal["error", "hide", "show"]] = None + """Price status for the UI""" + + ram: int + """RAM size in MiB""" + + vcpus: int + """Virtual CPU count""" + + +Result: TypeAlias = Union[ + ResultInstanceFlavorExtendedSerializerWithoutPrice, ResultInstanceFlavorExtendedSerializerWithPrice +] + + +class FlavorListResponse(BaseModel): + count: int + """Number of objects""" + + results: List[Result] + """Objects""" diff --git a/src/gcore/types/cloud/instances/instance_flavor.py b/src/gcore/types/cloud/instances/instance_flavor.py deleted file mode 100644 index 07fbe85f..00000000 --- a/src/gcore/types/cloud/instances/instance_flavor.py +++ /dev/null @@ -1,51 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["InstanceFlavor"] - - -class InstanceFlavor(BaseModel): - """Instances flavor schema""" - - architecture: str - """Flavor architecture type""" - - disabled: bool - """Disabled flavor flag""" - - flavor_id: str - """Flavor ID is the same as name""" - - flavor_name: str - """Flavor name""" - - os_type: str - """Flavor operating system""" - - ram: int - """RAM size in MiB""" - - vcpus: int - """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" - - capacity: Optional[int] = None - """Number of available instances of given configuration""" - - currency_code: Optional[str] = None - """Currency code. Shown if the `include_prices` query parameter if set to true""" - - hardware_description: Optional[Dict[str, str]] = None - """Additional hardware description""" - - price_per_hour: Optional[float] = None - """Price per hour. Shown if the `include_prices` query parameter if set to true""" - - price_per_month: Optional[float] = None - """Price per month. Shown if the `include_prices` query parameter if set to true""" - - price_status: Optional[Literal["error", "hide", "show"]] = None - """Price status for the UI""" diff --git a/src/gcore/types/cloud/k8s/__init__.py b/src/gcore/types/cloud/k8s/__init__.py index 0eed39f3..735764a4 100644 --- a/src/gcore/types/cloud/k8s/__init__.py +++ b/src/gcore/types/cloud/k8s/__init__.py @@ -3,11 +3,14 @@ from __future__ import annotations from .k8s_cluster import K8SCluster as K8SCluster -from .k8s_cluster_list import K8SClusterList as K8SClusterList from .flavor_list_params import FlavorListParams as FlavorListParams from .cluster_create_params import ClusterCreateParams as ClusterCreateParams from .cluster_delete_params import ClusterDeleteParams as ClusterDeleteParams +from .cluster_list_response import ClusterListResponse as ClusterListResponse from .cluster_update_params import ClusterUpdateParams as ClusterUpdateParams from .cluster_upgrade_params import ClusterUpgradeParams as ClusterUpgradeParams from .k8s_cluster_kubeconfig import K8SClusterKubeconfig as K8SClusterKubeconfig from .k8s_cluster_certificate import K8SClusterCertificate as K8SClusterCertificate +from .cluster_list_versions_for_upgrade_response import ( + ClusterListVersionsForUpgradeResponse as ClusterListVersionsForUpgradeResponse, +) diff --git a/src/gcore/types/cloud/k8s/k8s_cluster_list.py b/src/gcore/types/cloud/k8s/cluster_list_response.py similarity index 79% rename from src/gcore/types/cloud/k8s/k8s_cluster_list.py rename to src/gcore/types/cloud/k8s/cluster_list_response.py index bc252f6b..3e46fa0d 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster_list.py +++ b/src/gcore/types/cloud/k8s/cluster_list_response.py @@ -5,10 +5,10 @@ from ...._models import BaseModel from .k8s_cluster import K8SCluster -__all__ = ["K8SClusterList"] +__all__ = ["ClusterListResponse"] -class K8SClusterList(BaseModel): +class ClusterListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/instances/instance_flavor_list.py b/src/gcore/types/cloud/k8s/cluster_list_versions_for_upgrade_response.py similarity index 51% rename from src/gcore/types/cloud/instances/instance_flavor_list.py rename to src/gcore/types/cloud/k8s/cluster_list_versions_for_upgrade_response.py index 5d1e52c2..7eae6ea0 100644 --- a/src/gcore/types/cloud/instances/instance_flavor_list.py +++ b/src/gcore/types/cloud/k8s/cluster_list_versions_for_upgrade_response.py @@ -3,14 +3,14 @@ from typing import List from ...._models import BaseModel -from .instance_flavor import InstanceFlavor +from ..k8s_cluster_version import K8SClusterVersion -__all__ = ["InstanceFlavorList"] +__all__ = ["ClusterListVersionsForUpgradeResponse"] -class InstanceFlavorList(BaseModel): +class ClusterListVersionsForUpgradeResponse(BaseModel): count: int """Number of objects""" - results: List[InstanceFlavor] + results: List[K8SClusterVersion] """Objects""" diff --git a/src/gcore/types/cloud/k8s/clusters/__init__.py b/src/gcore/types/cloud/k8s/clusters/__init__.py index c8c5c859..b96a1c38 100644 --- a/src/gcore/types/cloud/k8s/clusters/__init__.py +++ b/src/gcore/types/cloud/k8s/clusters/__init__.py @@ -5,8 +5,8 @@ from .k8s_cluster_pool import K8SClusterPool as K8SClusterPool from .node_list_params import NodeListParams as NodeListParams from .pool_create_params import PoolCreateParams as PoolCreateParams +from .pool_list_response import PoolListResponse as PoolListResponse from .pool_resize_params import PoolResizeParams as PoolResizeParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams -from .k8s_cluster_pool_list import K8SClusterPoolList as K8SClusterPoolList from .k8s_cluster_pool_quota import K8SClusterPoolQuota as K8SClusterPoolQuota from .pool_check_quota_params import PoolCheckQuotaParams as PoolCheckQuotaParams diff --git a/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py b/src/gcore/types/cloud/k8s/clusters/pool_list_response.py similarity index 80% rename from src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py rename to src/gcore/types/cloud/k8s/clusters/pool_list_response.py index 23f3943a..25d4e977 100644 --- a/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py +++ b/src/gcore/types/cloud/k8s/clusters/pool_list_response.py @@ -5,10 +5,10 @@ from ....._models import BaseModel from .k8s_cluster_pool import K8SClusterPool -__all__ = ["K8SClusterPoolList"] +__all__ = ["PoolListResponse"] -class K8SClusterPoolList(BaseModel): +class PoolListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/k8s_cluster_version_list.py b/src/gcore/types/cloud/k8s_list_versions_response.py similarity index 78% rename from src/gcore/types/cloud/k8s_cluster_version_list.py rename to src/gcore/types/cloud/k8s_list_versions_response.py index 2f66ffb7..74ad65b1 100644 --- a/src/gcore/types/cloud/k8s_cluster_version_list.py +++ b/src/gcore/types/cloud/k8s_list_versions_response.py @@ -5,10 +5,10 @@ from ..._models import BaseModel from .k8s_cluster_version import K8SClusterVersion -__all__ = ["K8SClusterVersionList"] +__all__ = ["K8SListVersionsResponse"] -class K8SClusterVersionList(BaseModel): +class K8SListVersionsResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 16e66ced..e52fd1c4 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -33,8 +33,10 @@ class LoadBalancerCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" flavor: str """Load balancer flavor name""" @@ -278,12 +280,6 @@ class ListenerPool(TypedDict, total=False): healthmonitor: Optional[ListenerPoolHealthmonitor] """Health monitor details""" - listener_id: Optional[str] - """Listener ID""" - - load_balancer_id: Optional[str] - """Loadbalancer ID""" - members: Iterable[ListenerPoolMember] """Pool members""" diff --git a/src/gcore/types/cloud/load_balancer_failover_params.py b/src/gcore/types/cloud/load_balancer_failover_params.py index b4a727a7..90da9688 100644 --- a/src/gcore/types/cloud/load_balancer_failover_params.py +++ b/src/gcore/types/cloud/load_balancer_failover_params.py @@ -9,8 +9,10 @@ class LoadBalancerFailoverParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" force: bool """Validate current load balancer status before failover or not.""" diff --git a/src/gcore/types/cloud/load_balancer_flavor_list.py b/src/gcore/types/cloud/load_balancer_flavor_list.py deleted file mode 100644 index 7b10dbd7..00000000 --- a/src/gcore/types/cloud/load_balancer_flavor_list.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .load_balancer_flavor_detail import LoadBalancerFlavorDetail - -__all__ = ["LoadBalancerFlavorList"] - - -class LoadBalancerFlavorList(BaseModel): - count: int - """Number of objects""" - - results: List[LoadBalancerFlavorDetail] - """Objects""" diff --git a/src/gcore/types/cloud/load_balancer_get_params.py b/src/gcore/types/cloud/load_balancer_get_params.py index 233a6f3e..d1644e83 100644 --- a/src/gcore/types/cloud/load_balancer_get_params.py +++ b/src/gcore/types/cloud/load_balancer_get_params.py @@ -9,11 +9,13 @@ class LoadBalancerGetParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" show_stats: bool """Show statistics""" with_ddos: bool - """Show DDoS profile""" + """Show Advanced DDoS protection profile, if exists""" diff --git a/src/gcore/types/cloud/load_balancer_list_params.py b/src/gcore/types/cloud/load_balancer_list_params.py index 81ab5ea7..d6a71ba9 100644 --- a/src/gcore/types/cloud/load_balancer_list_params.py +++ b/src/gcore/types/cloud/load_balancer_list_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Literal, TypedDict from ..._types import SequenceNotStr @@ -11,40 +11,54 @@ class LoadBalancerListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" assigned_floating: bool """With or without assigned floating IP""" limit: int - """Limit the number of returned limit request entities.""" + """Limit of items on a single page""" logging_enabled: bool - """With or without logging""" + """With or without logging enabled""" name: str """Filter by name""" offset: int - """Offset value is used to exclude the first set of records from the result.""" - - order_by: str - """ - Ordering Load Balancer list result by name, `created_at`, `updated_at`, - `operating_status`, `provisioning_status`, `vip_address`, `vip_ip_family` and - flavor fields of the load balancer and directions (name.asc), default is - "`created_at`.asc" - """ + """Offset in results list""" + + order_by: Literal[ + "created_at.asc", + "created_at.desc", + "flavor.asc", + "flavor.desc", + "name.asc", + "name.desc", + "operating_status.asc", + "operating_status.desc", + "provisioning_status.asc", + "provisioning_status.desc", + "updated_at.asc", + "updated_at.desc", + "vip_address.asc", + "vip_address.desc", + "vip_ip_family.asc", + "vip_ip_family.desc", + ] + """Order by field and direction.""" show_stats: bool """Show statistics""" tag_key: SequenceNotStr[str] - """Filter by tag keys.""" + """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str - """Filter by tag key-value pairs. Must be a valid JSON string.""" + """Optional. Filter by tag key-value pairs.""" with_ddos: bool """Show Advanced DDoS protection profile, if exists""" diff --git a/src/gcore/types/cloud/load_balancer_resize_params.py b/src/gcore/types/cloud/load_balancer_resize_params.py index 05055dfe..80d1a0b5 100644 --- a/src/gcore/types/cloud/load_balancer_resize_params.py +++ b/src/gcore/types/cloud/load_balancer_resize_params.py @@ -9,8 +9,10 @@ class LoadBalancerResizeParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" flavor: Required[str] """Name of the desired flavor to resize to.""" diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py index 94770401..0b6f23d8 100644 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -14,8 +14,10 @@ class LoadBalancerUpdateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" logging: Logging """Logging configuration""" diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index cfacdce7..4674ceb5 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -8,7 +8,10 @@ from .pool_create_params import PoolCreateParams as PoolCreateParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .listener_get_params import ListenerGetParams as ListenerGetParams +from .flavor_list_response import FlavorListResponse as FlavorListResponse from .listener_list_params import ListenerListParams as ListenerListParams +from .metric_list_response import MetricListResponse as MetricListResponse +from .status_list_response import StatusListResponse as StatusListResponse from .listener_create_params import ListenerCreateParams as ListenerCreateParams from .listener_delete_params import ListenerDeleteParams as ListenerDeleteParams from .listener_update_params import ListenerUpdateParams as ListenerUpdateParams diff --git a/src/gcore/types/cloud/load_balancers/flavor_list_params.py b/src/gcore/types/cloud/load_balancers/flavor_list_params.py index 4db3ee38..af622cd6 100644 --- a/src/gcore/types/cloud/load_balancers/flavor_list_params.py +++ b/src/gcore/types/cloud/load_balancers/flavor_list_params.py @@ -9,8 +9,10 @@ class FlavorListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" include_prices: bool """Set to true if the response should include flavor prices""" diff --git a/src/gcore/types/cloud/load_balancers/flavor_list_response.py b/src/gcore/types/cloud/load_balancers/flavor_list_response.py new file mode 100644 index 00000000..202767ec --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/flavor_list_response.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union +from typing_extensions import TypeAlias + +from ...._models import BaseModel +from ..load_balancer_flavor_detail import LoadBalancerFlavorDetail + +__all__ = ["FlavorListResponse", "Result", "ResultLbFlavorSerializer"] + + +class ResultLbFlavorSerializer(BaseModel): + flavor_id: str + """Flavor ID is the same as name""" + + flavor_name: str + """Flavor name""" + + ram: int + """RAM size in MiB""" + + vcpus: int + """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" + + +Result: TypeAlias = Union[ResultLbFlavorSerializer, LoadBalancerFlavorDetail] + + +class FlavorListResponse(BaseModel): + count: int + """Number of objects""" + + results: List[Result] + """Objects""" diff --git a/src/gcore/types/cloud/load_balancers/metric_list_params.py b/src/gcore/types/cloud/load_balancers/metric_list_params.py index 4af5e414..a88d2c11 100644 --- a/src/gcore/types/cloud/load_balancers/metric_list_params.py +++ b/src/gcore/types/cloud/load_balancers/metric_list_params.py @@ -11,8 +11,10 @@ class MetricListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" time_interval: Required[int] """Time interval""" diff --git a/src/gcore/types/cloud/load_balancer_metrics_list.py b/src/gcore/types/cloud/load_balancers/metric_list_response.py similarity index 56% rename from src/gcore/types/cloud/load_balancer_metrics_list.py rename to src/gcore/types/cloud/load_balancers/metric_list_response.py index c270faf1..05b87752 100644 --- a/src/gcore/types/cloud/load_balancer_metrics_list.py +++ b/src/gcore/types/cloud/load_balancers/metric_list_response.py @@ -2,13 +2,13 @@ from typing import List -from ..._models import BaseModel -from .load_balancer_metrics import LoadBalancerMetrics +from ...._models import BaseModel +from ..load_balancer_metrics import LoadBalancerMetrics -__all__ = ["LoadBalancerMetricsList"] +__all__ = ["MetricListResponse"] -class LoadBalancerMetricsList(BaseModel): +class MetricListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/load_balancer_status_list.py b/src/gcore/types/cloud/load_balancers/status_list_response.py similarity index 56% rename from src/gcore/types/cloud/load_balancer_status_list.py rename to src/gcore/types/cloud/load_balancers/status_list_response.py index 0432a12c..120dd86d 100644 --- a/src/gcore/types/cloud/load_balancer_status_list.py +++ b/src/gcore/types/cloud/load_balancers/status_list_response.py @@ -2,13 +2,13 @@ from typing import List -from ..._models import BaseModel -from .load_balancer_status import LoadBalancerStatus +from ...._models import BaseModel +from ..load_balancer_status import LoadBalancerStatus -__all__ = ["LoadBalancerStatusList"] +__all__ = ["StatusListResponse"] -class LoadBalancerStatusList(BaseModel): +class StatusListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/networks/__init__.py b/src/gcore/types/cloud/networks/__init__.py index be19f7cf..84c111f1 100644 --- a/src/gcore/types/cloud/networks/__init__.py +++ b/src/gcore/types/cloud/networks/__init__.py @@ -3,7 +3,6 @@ from __future__ import annotations from .router import Router as Router -from .router_list import RouterList as RouterList from .router_list_params import RouterListParams as RouterListParams from .subnet_list_params import SubnetListParams as SubnetListParams from .router_create_params import RouterCreateParams as RouterCreateParams diff --git a/src/gcore/types/cloud/networks/router_list.py b/src/gcore/types/cloud/networks/router_list.py deleted file mode 100644 index 23a83fc8..00000000 --- a/src/gcore/types/cloud/networks/router_list.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .router import Router -from ...._models import BaseModel - -__all__ = ["RouterList"] - - -class RouterList(BaseModel): - count: int - """Number of objects""" - - results: List[Router] - """Objects""" diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index 0a79030b..267a9af7 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -21,7 +21,7 @@ class SubnetUpdateParams(TypedDict, total=False): dns_nameservers: Optional[SequenceNotStr[str]] """List IP addresses of DNS servers to advertise via DHCP.""" - enable_dhcp: Optional[bool] + enable_dhcp: bool """True if DHCP should be enabled""" gateway_ip: Optional[str] diff --git a/src/gcore/types/cloud/placement_group_list.py b/src/gcore/types/cloud/placement_group_list_response.py similarity index 77% rename from src/gcore/types/cloud/placement_group_list.py rename to src/gcore/types/cloud/placement_group_list_response.py index 92fbc1f9..708a9720 100644 --- a/src/gcore/types/cloud/placement_group_list.py +++ b/src/gcore/types/cloud/placement_group_list_response.py @@ -5,10 +5,10 @@ from ..._models import BaseModel from .placement_group import PlacementGroup -__all__ = ["PlacementGroupList"] +__all__ = ["PlacementGroupListResponse"] -class PlacementGroupList(BaseModel): +class PlacementGroupListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py index ac2fa29b..e7bde6fe 100644 --- a/src/gcore/types/cloud/region.py +++ b/src/gcore/types/cloud/region.py @@ -30,8 +30,8 @@ class Region(BaseModel): coordinates: Optional[Coordinates] = None """Coordinates of the region""" - country: Optional[str] = None - """Country""" + country: str + """Two-letter country code, ISO 3166-1 alpha-2""" created_at: datetime """Region creation date and time""" diff --git a/src/gcore/types/cloud/registries/registry_user.py b/src/gcore/types/cloud/registries/registry_user.py index 81e7d4b8..23de4c01 100644 --- a/src/gcore/types/cloud/registries/registry_user.py +++ b/src/gcore/types/cloud/registries/registry_user.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional from datetime import datetime from ...._models import BaseModel @@ -24,5 +23,5 @@ class RegistryUser(BaseModel): name: str """User name""" - read_only: Optional[bool] = None + read_only: bool """Read-only user""" diff --git a/src/gcore/types/cloud/registries/registry_user_created.py b/src/gcore/types/cloud/registries/registry_user_created.py index 6cb1ae87..42564a72 100644 --- a/src/gcore/types/cloud/registries/registry_user_created.py +++ b/src/gcore/types/cloud/registries/registry_user_created.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional from datetime import datetime from ...._models import BaseModel @@ -24,8 +23,8 @@ class RegistryUserCreated(BaseModel): name: str """User name""" - read_only: Optional[bool] = None + read_only: bool """Read-only user""" - secret: Optional[str] = None + secret: str """User secret""" diff --git a/src/gcore/types/cloud/registries/user_refresh_secret_response.py b/src/gcore/types/cloud/registries/user_refresh_secret_response.py index 17fb1144..255c1e8a 100644 --- a/src/gcore/types/cloud/registries/user_refresh_secret_response.py +++ b/src/gcore/types/cloud/registries/user_refresh_secret_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional from datetime import datetime from ...._models import BaseModel @@ -24,8 +23,8 @@ class UserRefreshSecretResponse(BaseModel): name: str """User name""" - read_only: Optional[bool] = None + read_only: bool """Read-only user""" - secret: Optional[str] = None + secret: str """User secret""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py index 0dd4eb7e..58c39149 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py @@ -4,7 +4,9 @@ from .candidate_port import CandidatePort as CandidatePort from .connected_port import ConnectedPort as ConnectedPort -from .candidate_port_list import CandidatePortList as CandidatePortList -from .connected_port_list import ConnectedPortList as ConnectedPortList from .connected_port_add_params import ConnectedPortAddParams as ConnectedPortAddParams +from .connected_port_add_response import ConnectedPortAddResponse as ConnectedPortAddResponse +from .candidate_port_list_response import CandidatePortListResponse as CandidatePortListResponse +from .connected_port_list_response import ConnectedPortListResponse as ConnectedPortListResponse from .connected_port_replace_params import ConnectedPortReplaceParams as ConnectedPortReplaceParams +from .connected_port_replace_response import ConnectedPortReplaceResponse as ConnectedPortReplaceResponse diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list_response.py similarity index 77% rename from src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list.py rename to src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list_response.py index 3c68db42..cffbde8a 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list_response.py @@ -5,10 +5,10 @@ from ....._models import BaseModel from .candidate_port import CandidatePort -__all__ = ["CandidatePortList"] +__all__ = ["CandidatePortListResponse"] -class CandidatePortList(BaseModel): +class CandidatePortListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_add_response.py similarity index 77% rename from src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list.py rename to src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_add_response.py index 6a0a2251..85c0ba11 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_add_response.py @@ -5,10 +5,10 @@ from ....._models import BaseModel from .connected_port import ConnectedPort -__all__ = ["ConnectedPortList"] +__all__ = ["ConnectedPortAddResponse"] -class ConnectedPortList(BaseModel): +class ConnectedPortAddResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list_response.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list_response.py new file mode 100644 index 00000000..1bfa1883 --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ....._models import BaseModel +from .connected_port import ConnectedPort + +__all__ = ["ConnectedPortListResponse"] + + +class ConnectedPortListResponse(BaseModel): + count: int + """Number of objects""" + + results: List[ConnectedPort] + """Objects""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_response.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_response.py new file mode 100644 index 00000000..ad469857 --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ....._models import BaseModel +from .connected_port import ConnectedPort + +__all__ = ["ConnectedPortReplaceResponse"] + + +class ConnectedPortReplaceResponse(BaseModel): + count: int + """Number of objects""" + + results: List[ConnectedPort] + """Objects""" diff --git a/src/gcore/types/cloud/security_group_copy_params.py b/src/gcore/types/cloud/security_group_copy_params.py index 6a1666e9..c93aa980 100644 --- a/src/gcore/types/cloud/security_group_copy_params.py +++ b/src/gcore/types/cloud/security_group_copy_params.py @@ -9,8 +9,10 @@ class SecurityGroupCopyParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" name: Required[str] """Name.""" diff --git a/src/gcore/types/cloud/security_group_create_params.py b/src/gcore/types/cloud/security_group_create_params.py index 7ae07e15..b932ad13 100644 --- a/src/gcore/types/cloud/security_group_create_params.py +++ b/src/gcore/types/cloud/security_group_create_params.py @@ -25,14 +25,14 @@ class SecurityGroupCreateParams(TypedDict, total=False): class SecurityGroupSecurityGroupRule(TypedDict, total=False): - description: str - """Rule description""" - - direction: Literal["egress", "ingress"] + direction: Required[Literal["egress", "ingress"]] """ Ingress or egress, which is the direction in which the security group is applied """ + description: str + """Rule description""" + ethertype: Literal["IPv4", "IPv6"] """Ether type""" diff --git a/src/gcore/types/cloud/security_group_rule.py b/src/gcore/types/cloud/security_group_rule.py index 533537e8..aa717ba6 100644 --- a/src/gcore/types/cloud/security_group_rule.py +++ b/src/gcore/types/cloud/security_group_rule.py @@ -16,24 +16,15 @@ class SecurityGroupRule(BaseModel): created_at: datetime """Datetime when the rule was created""" + description: Optional[str] = None + """Rule description""" + direction: Literal["egress", "ingress"] """ Ingress or egress, which is the direction in which the security group rule is applied """ - revision_number: int - """The revision number of the resource""" - - security_group_id: str - """The security group ID to associate with this security group rule""" - - updated_at: datetime - """Datetime when the rule was last updated""" - - description: Optional[str] = None - """Rule description""" - ethertype: Optional[Literal["IPv4", "IPv6"]] = None """ Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress @@ -81,3 +72,12 @@ class SecurityGroupRule(BaseModel): remote_ip_prefix: Optional[str] = None """The remote IP prefix that is matched by this security group rule""" + + revision_number: int + """The revision number of the resource""" + + security_group_id: str + """The security group ID to associate with this security group rule""" + + updated_at: datetime + """Datetime when the rule was last updated""" diff --git a/src/gcore/types/cloud/security_group_update_params.py b/src/gcore/types/cloud/security_group_update_params.py index d085c208..1ac56005 100644 --- a/src/gcore/types/cloud/security_group_update_params.py +++ b/src/gcore/types/cloud/security_group_update_params.py @@ -12,8 +12,10 @@ class SecurityGroupUpdateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" changed_rules: Iterable[ChangedRule] """List of rules to create or delete""" diff --git a/src/gcore/types/cloud/security_groups/rule_create_params.py b/src/gcore/types/cloud/security_groups/rule_create_params.py index a8ff773d..46fdd411 100644 --- a/src/gcore/types/cloud/security_groups/rule_create_params.py +++ b/src/gcore/types/cloud/security_groups/rule_create_params.py @@ -3,24 +3,26 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Literal, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["RuleCreateParams"] class RuleCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" - description: str - """Rule description""" - - direction: Literal["egress", "ingress"] + direction: Required[Literal["egress", "ingress"]] """ Ingress or egress, which is the direction in which the security group is applied """ + description: str + """Rule description""" + ethertype: Literal["IPv4", "IPv6"] """Ether type""" diff --git a/src/gcore/types/cloud/security_groups/rule_replace_params.py b/src/gcore/types/cloud/security_groups/rule_replace_params.py index be16eb3b..55d7a2ca 100644 --- a/src/gcore/types/cloud/security_groups/rule_replace_params.py +++ b/src/gcore/types/cloud/security_groups/rule_replace_params.py @@ -10,8 +10,10 @@ class RuleReplaceParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" direction: Required[Literal["egress", "ingress"]] """ diff --git a/src/gcore/types/cloud/usage_report.py b/src/gcore/types/cloud/usage_report.py index 6649aebf..659a5421 100644 --- a/src/gcore/types/cloud/usage_report.py +++ b/src/gcore/types/cloud/usage_report.py @@ -343,6 +343,9 @@ class ResourceResourceEgressTrafficSerializer(BaseModel): first_seen: datetime """First time the resource was seen in the given period""" + instance_name: Optional[str] = None + """Name of the instance""" + instance_type: Literal["baremetal", "vm"] """Type of the instance""" @@ -372,9 +375,6 @@ class ResourceResourceEgressTrafficSerializer(BaseModel): vm_id: str """ID of the bare metal server the traffic is associated with""" - instance_name: Optional[str] = None - """Name of the instance""" - class ResourceResourceExternalIPSerializer(BaseModel): """ @@ -917,6 +917,9 @@ class ResourceResourceVolumeSerializer(BaseModel): in all cost and usage reports results (but not in totals) """ + attached_to_vm: Optional[str] = None + """ID of the VM the volume is attached to""" + billing_metric_name: str """Name of the billing metric""" @@ -961,9 +964,6 @@ class ResourceResourceVolumeSerializer(BaseModel): volume_type: str """Type of the volume""" - attached_to_vm: Optional[str] = None - """ID of the VM the volume is attached to""" - class ResourceResourceDbaasPostgreSQLPoolerSerializer(BaseModel): billing_metric_name: str diff --git a/tests/api_resources/cloud/inference/test_deployments.py b/tests/api_resources/cloud/inference/test_deployments.py index 6b9b0802..a9e40264 100644 --- a/tests/api_resources/cloud/inference/test_deployments.py +++ b/tests/api_resources/cloud/inference/test_deployments.py @@ -230,7 +230,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: command=["nginx", "-g", "daemon off;"], containers=[ { - "region_id": 0, + "region_id": 1337, "scale": { "max": 3, "min": 1, @@ -839,7 +839,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> command=["nginx", "-g", "daemon off;"], containers=[ { - "region_id": 0, + "region_id": 1337, "scale": { "max": 3, "min": 1, diff --git a/tests/api_resources/cloud/instances/test_flavors.py b/tests/api_resources/cloud/instances/test_flavors.py index 51ff8119..1e0aecf5 100644 --- a/tests/api_resources/cloud/instances/test_flavors.py +++ b/tests/api_resources/cloud/instances/test_flavors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.instances import InstanceFlavorList +from gcore.types.cloud.instances import FlavorListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -35,7 +35,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: exclude_windows=True, include_prices=True, ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -47,7 +47,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -59,7 +59,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +75,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -87,7 +87,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No exclude_windows=True, include_prices=True, ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -99,7 +99,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -111,6 +111,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/k8s/clusters/test_pools.py b/tests/api_resources/cloud/k8s/clusters/test_pools.py index bc2d028a..f97df4e7 100644 --- a/tests/api_resources/cloud/k8s/clusters/test_pools.py +++ b/tests/api_resources/cloud/k8s/clusters/test_pools.py @@ -12,7 +12,7 @@ from gcore.types.cloud import TaskIDList from gcore.types.cloud.k8s.clusters import ( K8SClusterPool, - K8SClusterPoolList, + PoolListResponse, K8SClusterPoolQuota, ) @@ -183,7 +183,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -196,7 +196,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(K8SClusterPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -209,7 +209,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(K8SClusterPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -620,7 +620,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -633,7 +633,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(K8SClusterPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -646,7 +646,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(K8SClusterPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/k8s/test_clusters.py b/tests/api_resources/cloud/k8s/test_clusters.py index d9296b23..4ab9f3a4 100644 --- a/tests/api_resources/cloud/k8s/test_clusters.py +++ b/tests/api_resources/cloud/k8s/test_clusters.py @@ -9,12 +9,13 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, K8SClusterVersionList +from gcore.types.cloud import TaskIDList from gcore.types.cloud.k8s import ( K8SCluster, - K8SClusterList, + ClusterListResponse, K8SClusterKubeconfig, K8SClusterCertificate, + ClusterListVersionsForUpgradeResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -290,7 +291,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterList, cluster, path=["response"]) + assert_matches_type(ClusterListResponse, cluster, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -302,7 +303,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8SClusterList, cluster, path=["response"]) + assert_matches_type(ClusterListResponse, cluster, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -314,7 +315,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8SClusterList, cluster, path=["response"]) + assert_matches_type(ClusterListResponse, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -519,7 +520,7 @@ def test_method_list_versions_for_upgrade(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) + assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) @parametrize def test_raw_response_list_versions_for_upgrade(self, client: Gcore) -> None: @@ -532,7 +533,7 @@ def test_raw_response_list_versions_for_upgrade(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) + assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) @parametrize def test_streaming_response_list_versions_for_upgrade(self, client: Gcore) -> None: @@ -545,7 +546,7 @@ def test_streaming_response_list_versions_for_upgrade(self, client: Gcore) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) + assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -881,7 +882,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterList, cluster, path=["response"]) + assert_matches_type(ClusterListResponse, cluster, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -893,7 +894,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8SClusterList, cluster, path=["response"]) + assert_matches_type(ClusterListResponse, cluster, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -905,7 +906,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8SClusterList, cluster, path=["response"]) + assert_matches_type(ClusterListResponse, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1110,7 +1111,7 @@ async def test_method_list_versions_for_upgrade(self, async_client: AsyncGcore) project_id=0, region_id=0, ) - assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) + assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) @parametrize async def test_raw_response_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: @@ -1123,7 +1124,7 @@ async def test_raw_response_list_versions_for_upgrade(self, async_client: AsyncG assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) + assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) @parametrize async def test_streaming_response_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: @@ -1136,7 +1137,7 @@ async def test_streaming_response_list_versions_for_upgrade(self, async_client: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) + assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_flavors.py b/tests/api_resources/cloud/load_balancers/test_flavors.py index 51b2776e..25029744 100644 --- a/tests/api_resources/cloud/load_balancers/test_flavors.py +++ b/tests/api_resources/cloud/load_balancers/test_flavors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerFlavorList +from gcore.types.cloud.load_balancers import FlavorListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,43 +20,43 @@ class TestFlavors: @parametrize def test_method_list(self, client: Gcore) -> None: flavor = client.cloud.load_balancers.flavors.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: flavor = client.cloud.load_balancers.flavors.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, include_prices=True, ) - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.load_balancers.flavors.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.load_balancers.flavors.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,42 +69,42 @@ class TestAsyncFlavors: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: flavor = await async_client.cloud.load_balancers.flavors.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: flavor = await async_client.cloud.load_balancers.flavors.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, include_prices=True, ) - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.flavors.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.flavors.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_metrics.py b/tests/api_resources/cloud/load_balancers/test_metrics.py index 281f1d68..ec17405c 100644 --- a/tests/api_resources/cloud/load_balancers/test_metrics.py +++ b/tests/api_resources/cloud/load_balancers/test_metrics.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerMetricsList +from gcore.types.cloud.load_balancers import MetricListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,20 +20,20 @@ class TestMetrics: @parametrize def test_method_list(self, client: Gcore) -> None: metric = client.cloud.load_balancers.metrics.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + assert_matches_type(MetricListResponse, metric, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.load_balancers.metrics.with_raw_response.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) @@ -41,14 +41,14 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + assert_matches_type(MetricListResponse, metric, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.load_balancers.metrics.with_streaming_response.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) as response: @@ -56,7 +56,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + assert_matches_type(MetricListResponse, metric, path=["response"]) assert cast(Any, response.is_closed) is True @@ -65,8 +65,8 @@ def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.metrics.with_raw_response.list( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) @@ -80,20 +80,20 @@ class TestAsyncMetrics: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: metric = await async_client.cloud.load_balancers.metrics.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + assert_matches_type(MetricListResponse, metric, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.metrics.with_raw_response.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) @@ -101,14 +101,14 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = await response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + assert_matches_type(MetricListResponse, metric, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.metrics.with_streaming_response.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) as response: @@ -116,7 +116,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = await response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + assert_matches_type(MetricListResponse, metric, path=["response"]) assert cast(Any, response.is_closed) is True @@ -125,8 +125,8 @@ async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.metrics.with_raw_response.list( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) diff --git a/tests/api_resources/cloud/load_balancers/test_statuses.py b/tests/api_resources/cloud/load_balancers/test_statuses.py index da7e88cb..8e5d2536 100644 --- a/tests/api_resources/cloud/load_balancers/test_statuses.py +++ b/tests/api_resources/cloud/load_balancers/test_statuses.py @@ -9,7 +9,8 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerStatus, LoadBalancerStatusList +from gcore.types.cloud import LoadBalancerStatus +from gcore.types.cloud.load_balancers import StatusListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,52 +21,52 @@ class TestStatuses: @parametrize def test_method_list(self, client: Gcore) -> None: status = client.cloud.load_balancers.statuses.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) - assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + assert_matches_type(StatusListResponse, status, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.load_balancers.statuses.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = response.parse() - assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + assert_matches_type(StatusListResponse, status, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.load_balancers.statuses.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = response.parse() - assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + assert_matches_type(StatusListResponse, status, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_get(self, client: Gcore) -> None: status = client.cloud.load_balancers.statuses.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(LoadBalancerStatus, status, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.load_balancers.statuses.with_raw_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -76,9 +77,9 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.load_balancers.statuses.with_streaming_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -93,8 +94,8 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.statuses.with_raw_response.get( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @@ -106,52 +107,52 @@ class TestAsyncStatuses: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: status = await async_client.cloud.load_balancers.statuses.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) - assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + assert_matches_type(StatusListResponse, status, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.statuses.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = await response.parse() - assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + assert_matches_type(StatusListResponse, status, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.statuses.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = await response.parse() - assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + assert_matches_type(StatusListResponse, status, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: status = await async_client.cloud.load_balancers.statuses.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(LoadBalancerStatus, status, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.statuses.with_raw_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -162,9 +163,9 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.statuses.with_streaming_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -179,6 +180,6 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.statuses.with_raw_response.get( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) diff --git a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py index cc679c0e..7b18df0d 100644 --- a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py +++ b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePortList +from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePortListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -37,7 +37,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" candidate_port = response.parse() - assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -50,7 +50,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" candidate_port = response.parse() - assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -76,7 +76,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -89,7 +89,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" candidate_port = await response.parse() - assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -102,7 +102,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" candidate_port = await response.parse() - assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py index 7c47c319..8fb5bc82 100644 --- a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py +++ b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py @@ -10,7 +10,9 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.cloud.reserved_fixed_ips.vip import ( - ConnectedPortList, + ConnectedPortAddResponse, + ConnectedPortListResponse, + ConnectedPortReplaceResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +28,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -39,7 +41,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -52,7 +54,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +74,7 @@ def test_method_add(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) @parametrize def test_method_add_with_all_params(self, client: Gcore) -> None: @@ -82,7 +84,7 @@ def test_method_add_with_all_params(self, client: Gcore) -> None: region_id=0, port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) @parametrize def test_raw_response_add(self, client: Gcore) -> None: @@ -95,7 +97,7 @@ def test_raw_response_add(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) @parametrize def test_streaming_response_add(self, client: Gcore) -> None: @@ -108,7 +110,7 @@ def test_streaming_response_add(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -128,7 +130,7 @@ def test_method_replace(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: @@ -138,7 +140,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: region_id=0, port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) @parametrize def test_raw_response_replace(self, client: Gcore) -> None: @@ -151,7 +153,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: @@ -164,7 +166,7 @@ def test_streaming_response_replace(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -190,7 +192,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -203,7 +205,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -216,7 +218,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -236,7 +238,7 @@ async def test_method_add(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) @parametrize async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> None: @@ -246,7 +248,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> Non region_id=0, port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) @parametrize async def test_raw_response_add(self, async_client: AsyncGcore) -> None: @@ -259,7 +261,7 @@ async def test_raw_response_add(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) @parametrize async def test_streaming_response_add(self, async_client: AsyncGcore) -> None: @@ -272,7 +274,7 @@ async def test_streaming_response_add(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -292,7 +294,7 @@ async def test_method_replace(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: @@ -302,7 +304,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> region_id=0, port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @@ -315,7 +317,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: @@ -328,7 +330,7 @@ async def test_streaming_response_replace(self, async_client: AsyncGcore) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/security_groups/test_rules.py b/tests/api_resources/cloud/security_groups/test_rules.py index 6f84f09a..b3e9f95f 100644 --- a/tests/api_resources/cloud/security_groups/test_rules.py +++ b/tests/api_resources/cloud/security_groups/test_rules.py @@ -20,20 +20,21 @@ class TestRules: @parametrize def test_method_create(self, client: Gcore) -> None: rule = client.cloud.security_groups.rules.create( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", ) assert_matches_type(SecurityGroupRule, rule, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: rule = client.cloud.security_groups.rules.create( - group_id="group_id", - project_id=0, - region_id=0, - description="Some description", + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", + description="Some description", ethertype="IPv4", port_range_max=80, port_range_min=80, @@ -46,9 +47,10 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.security_groups.rules.with_raw_response.create( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", ) assert response.is_closed is True @@ -59,9 +61,10 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.security_groups.rules.with_streaming_response.create( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -76,25 +79,26 @@ def test_path_params_create(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.cloud.security_groups.rules.with_raw_response.create( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, + direction="ingress", ) @parametrize def test_method_delete(self, client: Gcore) -> None: rule = client.cloud.security_groups.rules.delete( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert rule is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.security_groups.rules.with_raw_response.delete( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -105,9 +109,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.security_groups.rules.with_streaming_response.delete( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -122,16 +126,16 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): client.cloud.security_groups.rules.with_raw_response.delete( rule_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_replace(self, client: Gcore) -> None: rule = client.cloud.security_groups.rules.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) @@ -140,9 +144,9 @@ def test_method_replace(self, client: Gcore) -> None: @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: rule = client.cloud.security_groups.rules.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", description="Some description", @@ -158,9 +162,9 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_replace(self, client: Gcore) -> None: response = client.cloud.security_groups.rules.with_raw_response.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) @@ -173,9 +177,9 @@ def test_raw_response_replace(self, client: Gcore) -> None: @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: with client.cloud.security_groups.rules.with_streaming_response.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) as response: @@ -192,8 +196,8 @@ def test_path_params_replace(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): client.cloud.security_groups.rules.with_raw_response.replace( rule_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) @@ -207,20 +211,21 @@ class TestAsyncRules: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.security_groups.rules.create( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", ) assert_matches_type(SecurityGroupRule, rule, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.security_groups.rules.create( - group_id="group_id", - project_id=0, - region_id=0, - description="Some description", + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", + description="Some description", ethertype="IPv4", port_range_max=80, port_range_min=80, @@ -233,9 +238,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.rules.with_raw_response.create( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", ) assert response.is_closed is True @@ -246,9 +252,10 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.rules.with_streaming_response.create( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -263,25 +270,26 @@ async def test_path_params_create(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.cloud.security_groups.rules.with_raw_response.create( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, + direction="ingress", ) @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.security_groups.rules.delete( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert rule is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.rules.with_raw_response.delete( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -292,9 +300,9 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.rules.with_streaming_response.delete( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -309,16 +317,16 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): await async_client.cloud.security_groups.rules.with_raw_response.delete( rule_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_replace(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.security_groups.rules.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) @@ -327,9 +335,9 @@ async def test_method_replace(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.security_groups.rules.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", description="Some description", @@ -345,9 +353,9 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.rules.with_raw_response.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) @@ -360,9 +368,9 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.rules.with_streaming_response.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) as response: @@ -379,8 +387,8 @@ async def test_path_params_replace(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): await async_client.cloud.security_groups.rules.with_raw_response.replace( rule_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) diff --git a/tests/api_resources/cloud/test_k8s.py b/tests/api_resources/cloud/test_k8s.py index 98602a71..7500f600 100644 --- a/tests/api_resources/cloud/test_k8s.py +++ b/tests/api_resources/cloud/test_k8s.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import K8SClusterVersionList +from gcore.types.cloud import K8SListVersionsResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list_versions(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) + assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) @parametrize def test_raw_response_list_versions(self, client: Gcore) -> None: @@ -35,7 +35,7 @@ def test_raw_response_list_versions(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" k8s = response.parse() - assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) + assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) @parametrize def test_streaming_response_list_versions(self, client: Gcore) -> None: @@ -47,7 +47,7 @@ def test_streaming_response_list_versions(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" k8s = response.parse() - assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) + assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) assert cast(Any, response.is_closed) is True @@ -63,7 +63,7 @@ async def test_method_list_versions(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) + assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) @parametrize async def test_raw_response_list_versions(self, async_client: AsyncGcore) -> None: @@ -75,7 +75,7 @@ async def test_raw_response_list_versions(self, async_client: AsyncGcore) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" k8s = await response.parse() - assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) + assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) @parametrize async def test_streaming_response_list_versions(self, async_client: AsyncGcore) -> None: @@ -87,6 +87,6 @@ async def test_streaming_response_list_versions(self, async_client: AsyncGcore) assert response.http_request.headers.get("X-Stainless-Lang") == "python" k8s = await response.parse() - assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) + assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index faf824ef..abd1f5ce 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -24,16 +24,16 @@ class TestLoadBalancers: @parametrize def test_method_create(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, flavor="lb1-1-2", floating_ip={ "existing_floating_id": "c64e5db1-5f1f-43ec-a8d9-5090df85b82d", @@ -64,8 +64,6 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "max_retries_down": 3, "url_path": "/", }, - "listener_id": "listener_id", - "load_balancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", "members": [ { "address": "192.168.1.101", @@ -135,8 +133,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -147,8 +145,8 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -161,18 +159,18 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, logging={ "destination_region_id": 1, "enabled": True, @@ -188,9 +186,9 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_update(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -201,9 +199,9 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -218,31 +216,31 @@ def test_path_params_update(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.with_raw_response.update( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_list(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(SyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, assigned_floating=True, - limit=0, + limit=1000, logging_enabled=True, - name="name", + name="lb_name", offset=0, - order_by="order_by", + order_by="name.asc", show_stats=True, - tag_key=["string"], + tag_key=["key1", "key2"], tag_key_value="tag_key_value", with_ddos=True, ) @@ -251,8 +249,8 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -263,8 +261,8 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -277,18 +275,18 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -299,9 +297,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -316,25 +314,25 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.with_raw_response.delete( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_failover(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @parametrize def test_method_failover_with_all_params(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, force=True, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @@ -342,9 +340,9 @@ def test_method_failover_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_failover(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -355,9 +353,9 @@ def test_raw_response_failover(self, client: Gcore) -> None: @parametrize def test_streaming_response_failover(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -372,25 +370,25 @@ def test_path_params_failover(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.with_raw_response.failover( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_get(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, show_stats=True, with_ddos=True, ) @@ -399,9 +397,9 @@ def test_method_get_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -412,9 +410,9 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -429,16 +427,16 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.with_raw_response.get( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_resize(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, flavor="lb1-2-4", ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @@ -446,9 +444,9 @@ def test_method_resize(self, client: Gcore) -> None: @parametrize def test_raw_response_resize(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, flavor="lb1-2-4", ) @@ -460,9 +458,9 @@ def test_raw_response_resize(self, client: Gcore) -> None: @parametrize def test_streaming_response_resize(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, flavor="lb1-2-4", ) as response: assert not response.is_closed @@ -478,8 +476,8 @@ def test_path_params_resize(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.with_raw_response.resize( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, flavor="lb1-2-4", ) @@ -492,16 +490,16 @@ class TestAsyncLoadBalancers: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, flavor="lb1-1-2", floating_ip={ "existing_floating_id": "c64e5db1-5f1f-43ec-a8d9-5090df85b82d", @@ -532,8 +530,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "max_retries_down": 3, "url_path": "/", }, - "listener_id": "listener_id", - "load_balancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", "members": [ { "address": "192.168.1.101", @@ -603,8 +599,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -615,8 +611,8 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -629,18 +625,18 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, logging={ "destination_region_id": 1, "enabled": True, @@ -656,9 +652,9 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -669,9 +665,9 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.with_streaming_response.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -686,31 +682,31 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.with_raw_response.update( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(AsyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, assigned_floating=True, - limit=0, + limit=1000, logging_enabled=True, - name="name", + name="lb_name", offset=0, - order_by="order_by", + order_by="name.asc", show_stats=True, - tag_key=["string"], + tag_key=["key1", "key2"], tag_key_value="tag_key_value", with_ddos=True, ) @@ -719,8 +715,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -731,8 +727,8 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -745,18 +741,18 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -767,9 +763,9 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.with_streaming_response.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -784,25 +780,25 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.with_raw_response.delete( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_failover(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @parametrize async def test_method_failover_with_all_params(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, force=True, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @@ -810,9 +806,9 @@ async def test_method_failover_with_all_params(self, async_client: AsyncGcore) - @parametrize async def test_raw_response_failover(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -823,9 +819,9 @@ async def test_raw_response_failover(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_failover(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.with_streaming_response.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -840,25 +836,25 @@ async def test_path_params_failover(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.with_raw_response.failover( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, show_stats=True, with_ddos=True, ) @@ -867,9 +863,9 @@ async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> Non @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -880,9 +876,9 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.with_streaming_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -897,16 +893,16 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.with_raw_response.get( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_resize(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, flavor="lb1-2-4", ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @@ -914,9 +910,9 @@ async def test_method_resize(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, flavor="lb1-2-4", ) @@ -928,9 +924,9 @@ async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.with_streaming_response.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, flavor="lb1-2-4", ) as response: assert not response.is_closed @@ -946,7 +942,7 @@ async def test_path_params_resize(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.with_raw_response.resize( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, flavor="lb1-2-4", ) diff --git a/tests/api_resources/cloud/test_placement_groups.py b/tests/api_resources/cloud/test_placement_groups.py index 84783508..7c8276c3 100644 --- a/tests/api_resources/cloud/test_placement_groups.py +++ b/tests/api_resources/cloud/test_placement_groups.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, PlacementGroup, PlacementGroupList +from gcore.types.cloud import TaskIDList, PlacementGroup, PlacementGroupListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -63,7 +63,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -75,7 +75,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" placement_group = response.parse() - assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -87,7 +87,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" placement_group = response.parse() - assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -235,7 +235,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -247,7 +247,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" placement_group = await response.parse() - assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -259,7 +259,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" placement_group = await response.parse() - assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index 41883f9e..6e6796b6 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -39,8 +39,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "description": "Some description", "security_group_rules": [ { - "description": "Some description", "direction": "ingress", + "description": "Some description", "ethertype": "IPv4", "port_range_max": 80, "port_range_min": 80, @@ -86,18 +86,18 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: security_group = client.cloud.security_groups.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: security_group = client.cloud.security_groups.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, changed_rules=[ { "action": "delete", @@ -120,9 +120,9 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_update(self, client: Gcore) -> None: response = client.cloud.security_groups.with_raw_response.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -133,9 +133,9 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: with client.cloud.security_groups.with_streaming_response.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -150,8 +150,8 @@ def test_path_params_update(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.cloud.security_groups.with_raw_response.update( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize @@ -203,18 +203,18 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: security_group = client.cloud.security_groups.delete( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert security_group is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.security_groups.with_raw_response.delete( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -225,9 +225,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.security_groups.with_streaming_response.delete( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -242,16 +242,16 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.cloud.security_groups.with_raw_response.delete( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_copy(self, client: Gcore) -> None: security_group = client.cloud.security_groups.copy( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, name="some_name", ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @@ -259,9 +259,9 @@ def test_method_copy(self, client: Gcore) -> None: @parametrize def test_raw_response_copy(self, client: Gcore) -> None: response = client.cloud.security_groups.with_raw_response.copy( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, name="some_name", ) @@ -273,9 +273,9 @@ def test_raw_response_copy(self, client: Gcore) -> None: @parametrize def test_streaming_response_copy(self, client: Gcore) -> None: with client.cloud.security_groups.with_streaming_response.copy( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, name="some_name", ) as response: assert not response.is_closed @@ -291,26 +291,26 @@ def test_path_params_copy(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.cloud.security_groups.with_raw_response.copy( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="some_name", ) @parametrize def test_method_get(self, client: Gcore) -> None: security_group = client.cloud.security_groups.get( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.security_groups.with_raw_response.get( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -321,9 +321,9 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.security_groups.with_streaming_response.get( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -338,25 +338,25 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.cloud.security_groups.with_raw_response.get( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_revert_to_default(self, client: Gcore) -> None: security_group = client.cloud.security_groups.revert_to_default( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_raw_response_revert_to_default(self, client: Gcore) -> None: response = client.cloud.security_groups.with_raw_response.revert_to_default( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -367,9 +367,9 @@ def test_raw_response_revert_to_default(self, client: Gcore) -> None: @parametrize def test_streaming_response_revert_to_default(self, client: Gcore) -> None: with client.cloud.security_groups.with_streaming_response.revert_to_default( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -384,8 +384,8 @@ def test_path_params_revert_to_default(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.cloud.security_groups.with_raw_response.revert_to_default( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @@ -413,8 +413,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "description": "Some description", "security_group_rules": [ { - "description": "Some description", "direction": "ingress", + "description": "Some description", "ethertype": "IPv4", "port_range_max": 80, "port_range_min": 80, @@ -460,18 +460,18 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, changed_rules=[ { "action": "delete", @@ -494,9 +494,9 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.with_raw_response.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -507,9 +507,9 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.with_streaming_response.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -524,8 +524,8 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.cloud.security_groups.with_raw_response.update( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize @@ -577,18 +577,18 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.delete( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert security_group is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.with_raw_response.delete( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -599,9 +599,9 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.with_streaming_response.delete( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -616,16 +616,16 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.cloud.security_groups.with_raw_response.delete( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_copy(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.copy( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, name="some_name", ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @@ -633,9 +633,9 @@ async def test_method_copy(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_copy(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.with_raw_response.copy( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, name="some_name", ) @@ -647,9 +647,9 @@ async def test_raw_response_copy(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_copy(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.with_streaming_response.copy( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, name="some_name", ) as response: assert not response.is_closed @@ -665,26 +665,26 @@ async def test_path_params_copy(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.cloud.security_groups.with_raw_response.copy( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="some_name", ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.get( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.with_raw_response.get( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -695,9 +695,9 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.with_streaming_response.get( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -712,25 +712,25 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.cloud.security_groups.with_raw_response.get( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_revert_to_default(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.revert_to_default( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_raw_response_revert_to_default(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.with_raw_response.revert_to_default( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -741,9 +741,9 @@ async def test_raw_response_revert_to_default(self, async_client: AsyncGcore) -> @parametrize async def test_streaming_response_revert_to_default(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.with_streaming_response.revert_to_default( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -758,6 +758,6 @@ async def test_path_params_revert_to_default(self, async_client: AsyncGcore) -> with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.cloud.security_groups.with_raw_response.revert_to_default( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) From 568d2d5b1e53ef9d35701c032a1758aa2a3d1823 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Jan 2026 10:14:03 +0000 Subject: [PATCH 508/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index d5976c8d..cf71f233 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-432dafc5e24ab4a5594e628f3ac9a35e906e1de7dd20eeecd27afaf143dec88f.yml openapi_spec_hash: 57bd58f035387ac1efdcbefa5abab427 -config_hash: cba67c225c37fe0e91ed7586f53169e4 +config_hash: 72dafc786d92b98aa097fd4ec34680ca From cd3e10e0ddfab452be702e9b772f6b7eb7042513 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 10:12:48 +0000 Subject: [PATCH 509/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/iam/users.py | 54 +++++------------------ src/gcore/types/iam/user_update_params.py | 45 ++++--------------- tests/api_resources/iam/test_users.py | 48 +++++++++----------- 4 files changed, 41 insertions(+), 110 deletions(-) diff --git a/.stats.yml b/.stats.yml index cf71f233..fb848d1e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-432dafc5e24ab4a5594e628f3ac9a35e906e1de7dd20eeecd27afaf143dec88f.yml -openapi_spec_hash: 57bd58f035387ac1efdcbefa5abab427 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ade61b5f8b94d9aaf24c2770f59a72e498afde0922d4967f51a5265d7848332a.yml +openapi_spec_hash: fd4ff75b24c8f9ddf0de165a37253859 config_hash: 72dafc786d92b98aa097fd4ec34680ca diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index 3cf6bbef..46d9a50c 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import List, Optional from typing_extensions import Literal import httpx @@ -52,13 +52,11 @@ def update( self, user_id: int, *, - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | Omit = omit, - company: str | Omit = omit, - email: str | Omit = omit, - groups: Iterable[user_update_params.Group] | Omit = omit, - lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, - name: Optional[str] | Omit = omit, - phone: Optional[str] | Omit = omit, + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]], + email: str, + lang: Literal["de", "en", "ru", "zh", "az"], + name: Optional[str], + phone: Optional[str], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -73,20 +71,8 @@ def update( List of auth types available for the account. - company: User's company. - email: User's email address. - groups: User's group in the current account. - - IAM supports 5 groups: - - - Users - - Administrators - - Engineers - - Purge and Prefetch only (API) - - Purge and Prefetch only (API+Web) - lang: User's language. Defines language of the control panel and email messages. @@ -108,9 +94,7 @@ def update( body=maybe_transform( { "auth_types": auth_types, - "company": company, "email": email, - "groups": groups, "lang": lang, "name": name, "phone": phone, @@ -325,13 +309,11 @@ async def update( self, user_id: int, *, - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | Omit = omit, - company: str | Omit = omit, - email: str | Omit = omit, - groups: Iterable[user_update_params.Group] | Omit = omit, - lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, - name: Optional[str] | Omit = omit, - phone: Optional[str] | Omit = omit, + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]], + email: str, + lang: Literal["de", "en", "ru", "zh", "az"], + name: Optional[str], + phone: Optional[str], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -346,20 +328,8 @@ async def update( List of auth types available for the account. - company: User's company. - email: User's email address. - groups: User's group in the current account. - - IAM supports 5 groups: - - - Users - - Administrators - - Engineers - - Purge and Prefetch only (API) - - Purge and Prefetch only (API+Web) - lang: User's language. Defines language of the control panel and email messages. @@ -381,9 +351,7 @@ async def update( body=await async_maybe_transform( { "auth_types": auth_types, - "company": company, "email": email, - "groups": groups, "lang": lang, "name": name, "phone": phone, diff --git a/src/gcore/types/iam/user_update_params.py b/src/gcore/types/iam/user_update_params.py index 80d93a28..2874ef20 100644 --- a/src/gcore/types/iam/user_update_params.py +++ b/src/gcore/types/iam/user_update_params.py @@ -2,56 +2,27 @@ from __future__ import annotations -from typing import List, Iterable, Optional -from typing_extensions import Literal, TypedDict +from typing import List, Optional +from typing_extensions import Literal, Required, TypedDict -__all__ = ["UserUpdateParams", "Group"] +__all__ = ["UserUpdateParams"] class UserUpdateParams(TypedDict, total=False): - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] + auth_types: Required[List[Literal["password", "sso", "github", "google-oauth2"]]] """System field. List of auth types available for the account.""" - company: str - """User's company.""" - - email: str + email: Required[str] """User's email address.""" - groups: Iterable[Group] - """User's group in the current account. - - IAM supports 5 groups: - - - Users - - Administrators - - Engineers - - Purge and Prefetch only (API) - - Purge and Prefetch only (API+Web) - """ - - lang: Literal["de", "en", "ru", "zh", "az"] + lang: Required[Literal["de", "en", "ru", "zh", "az"]] """User's language. Defines language of the control panel and email messages. """ - name: Optional[str] + name: Required[Optional[str]] """User's name.""" - phone: Optional[str] + phone: Required[Optional[str]] """User's phone.""" - - -class Group(TypedDict, total=False): - id: int - """Group's ID: Possible values are: - - - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only - (API+Web)* 3022 - Purge and Prefetch only (API) - """ - - name: Literal[ - "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" - ] - """Group's name.""" diff --git a/tests/api_resources/iam/test_users.py b/tests/api_resources/iam/test_users.py index 6c3635a9..72116b06 100644 --- a/tests/api_resources/iam/test_users.py +++ b/tests/api_resources/iam/test_users.py @@ -25,24 +25,10 @@ class TestUsers: @parametrize def test_method_update(self, client: Gcore) -> None: - user = client.iam.users.update( - user_id=0, - ) - assert_matches_type(UserUpdated, user, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Gcore) -> None: user = client.iam.users.update( user_id=0, auth_types=["password"], - company="company", email="dev@stainless.com", - groups=[ - { - "id": 1, - "name": "Administrators", - } - ], lang="de", name="name", phone="phone", @@ -53,6 +39,11 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: def test_raw_response_update(self, client: Gcore) -> None: response = client.iam.users.with_raw_response.update( user_id=0, + auth_types=["password"], + email="dev@stainless.com", + lang="de", + name="name", + phone="phone", ) assert response.is_closed is True @@ -64,6 +55,11 @@ def test_raw_response_update(self, client: Gcore) -> None: def test_streaming_response_update(self, client: Gcore) -> None: with client.iam.users.with_streaming_response.update( user_id=0, + auth_types=["password"], + email="dev@stainless.com", + lang="de", + name="name", + phone="phone", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -230,24 +226,10 @@ class TestAsyncUsers: @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - user = await async_client.iam.users.update( - user_id=0, - ) - assert_matches_type(UserUpdated, user, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: user = await async_client.iam.users.update( user_id=0, auth_types=["password"], - company="company", email="dev@stainless.com", - groups=[ - { - "id": 1, - "name": "Administrators", - } - ], lang="de", name="name", phone="phone", @@ -258,6 +240,11 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.iam.users.with_raw_response.update( user_id=0, + auth_types=["password"], + email="dev@stainless.com", + lang="de", + name="name", + phone="phone", ) assert response.is_closed is True @@ -269,6 +256,11 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.iam.users.with_streaming_response.update( user_id=0, + auth_types=["password"], + email="dev@stainless.com", + lang="de", + name="name", + phone="phone", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From 2e04eda9c319deef7836af59cc56e503bfbe9bd2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 12:17:15 +0000 Subject: [PATCH 510/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/cloud/audit_logs.py | 2 - .../cloud/security_groups/security_groups.py | 71 +++- src/gcore/resources/cloud/tasks.py | 20 +- src/gcore/types/cloud/audit_log_entry.py | 1 - .../types/cloud/audit_log_list_params.py | 1 - .../gpu_baremetal/gpu_baremetal_cluster.py | 4 +- .../cloud/gpu_virtual/gpu_virtual_cluster.py | 4 +- .../types/cloud/security_group_list_params.py | 3 + src/gcore/types/cloud/task.py | 3 + src/gcore/types/cloud/task_list_params.py | 10 +- .../cloud/test_security_groups.py | 378 ++++++++++-------- 12 files changed, 284 insertions(+), 217 deletions(-) diff --git a/.stats.yml b/.stats.yml index fb848d1e..4d118940 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ade61b5f8b94d9aaf24c2770f59a72e498afde0922d4967f51a5265d7848332a.yml -openapi_spec_hash: fd4ff75b24c8f9ddf0de165a37253859 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8d156dce8786b969c408f2d7fecc7b180388f3b0c16800b62a4af4f954cd343b.yml +openapi_spec_hash: 0f521c0d26f4dbcce241b9ed80c3c7bb config_hash: 72dafc786d92b98aa097fd4ec34680ca diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index f92e7daa..f47fa720 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -92,7 +92,6 @@ def list( api_group: List[ Literal[ "ai_cluster", - "backup_service", "caas_container", "caas_key", "caas_pull_secret", @@ -311,7 +310,6 @@ def list( api_group: List[ Literal[ "ai_cluster", - "backup_service", "caas_container", "caas_key", "caas_pull_secret", diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 27442cce..a287b6bf 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Iterable, Optional import httpx @@ -62,6 +63,7 @@ def with_streaming_response(self) -> SecurityGroupsResourceWithStreamingResponse """ return SecurityGroupsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def create( self, *, @@ -77,7 +79,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ - Create a new security group with the specified configuration. + **Deprecated** Use `/v2/security_groups//` instead. Args: project_id: Project ID @@ -115,6 +117,7 @@ def create( cast_to=SecurityGroup, ) + @typing_extensions.deprecated("deprecated") def update( self, group_id: str, @@ -132,7 +135,8 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ - Update the configuration of an existing security group. + **Deprecated** Use `/v2/security_groups///` + instead. Args: project_id: Project ID @@ -208,6 +212,7 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | Omit = omit, + name: str | Omit = omit, offset: int | Omit = omit, tag_key: SequenceNotStr[str] | Omit = omit, tag_key_value: str | Omit = omit, @@ -228,6 +233,8 @@ def list( limit: Limit of items on a single page + name: Optional. Filter by name. Must be specified a full name of the security group. + offset: Offset in results list tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 @@ -257,6 +264,7 @@ def list( query=maybe_transform( { "limit": limit, + "name": name, "offset": offset, "tag_key": tag_key, "tag_key_value": tag_key_value, @@ -477,6 +485,7 @@ def with_streaming_response(self) -> AsyncSecurityGroupsResourceWithStreamingRes """ return AsyncSecurityGroupsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def create( self, *, @@ -492,7 +501,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ - Create a new security group with the specified configuration. + **Deprecated** Use `/v2/security_groups//` instead. Args: project_id: Project ID @@ -530,6 +539,7 @@ async def create( cast_to=SecurityGroup, ) + @typing_extensions.deprecated("deprecated") async def update( self, group_id: str, @@ -547,7 +557,8 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ - Update the configuration of an existing security group. + **Deprecated** Use `/v2/security_groups///` + instead. Args: project_id: Project ID @@ -623,6 +634,7 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | Omit = omit, + name: str | Omit = omit, offset: int | Omit = omit, tag_key: SequenceNotStr[str] | Omit = omit, tag_key_value: str | Omit = omit, @@ -643,6 +655,8 @@ def list( limit: Limit of items on a single page + name: Optional. Filter by name. Must be specified a full name of the security group. + offset: Offset in results list tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 @@ -672,6 +686,7 @@ def list( query=maybe_transform( { "limit": limit, + "name": name, "offset": offset, "tag_key": tag_key, "tag_key_value": tag_key_value, @@ -872,11 +887,15 @@ class SecurityGroupsResourceWithRawResponse: def __init__(self, security_groups: SecurityGroupsResource) -> None: self._security_groups = security_groups - self.create = to_raw_response_wrapper( - security_groups.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + security_groups.create, # pyright: ignore[reportDeprecated], + ) ) - self.update = to_raw_response_wrapper( - security_groups.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + security_groups.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_raw_response_wrapper( security_groups.list, @@ -903,11 +922,15 @@ class AsyncSecurityGroupsResourceWithRawResponse: def __init__(self, security_groups: AsyncSecurityGroupsResource) -> None: self._security_groups = security_groups - self.create = async_to_raw_response_wrapper( - security_groups.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + security_groups.create, # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_raw_response_wrapper( - security_groups.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + security_groups.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_raw_response_wrapper( security_groups.list, @@ -934,11 +957,15 @@ class SecurityGroupsResourceWithStreamingResponse: def __init__(self, security_groups: SecurityGroupsResource) -> None: self._security_groups = security_groups - self.create = to_streamed_response_wrapper( - security_groups.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + security_groups.create, # pyright: ignore[reportDeprecated], + ) ) - self.update = to_streamed_response_wrapper( - security_groups.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + security_groups.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_streamed_response_wrapper( security_groups.list, @@ -965,11 +992,15 @@ class AsyncSecurityGroupsResourceWithStreamingResponse: def __init__(self, security_groups: AsyncSecurityGroupsResource) -> None: self._security_groups = security_groups - self.create = async_to_streamed_response_wrapper( - security_groups.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + security_groups.create, # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_streamed_response_wrapper( - security_groups.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + security_groups.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_streamed_response_wrapper( security_groups.list, diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 2a21b3d7..8d021db5 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -108,9 +108,9 @@ def list( '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', '`create_lbpool_health_monitor`', '`create_loadbalancer`', '`create_network`', '`create_reserved_fixed_ip`', '`create_router`', - '`create_secret`', '`create_servergroup`', '`create_sfs`', '`create_snapshot`', - '`create_subnet`', '`create_vm`', '`create_volume`', - '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', + '`create_secret`', '`create_security_group`', '`create_servergroup`', + '`create_sfs`', '`create_snapshot`', '`create_subnet`', '`create_vm`', + '`create_volume`', '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', '`delete_caas_container`', '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', @@ -140,8 +140,8 @@ def list( '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', '`update_inference_application`', '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_l7policy`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_sfs`', - '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', + '`update_port_allowed_address_pairs`', '`update_security_group`', + '`update_sfs`', '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or @@ -383,9 +383,9 @@ def list( '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', '`create_lbpool_health_monitor`', '`create_loadbalancer`', '`create_network`', '`create_reserved_fixed_ip`', '`create_router`', - '`create_secret`', '`create_servergroup`', '`create_sfs`', '`create_snapshot`', - '`create_subnet`', '`create_vm`', '`create_volume`', - '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', + '`create_secret`', '`create_security_group`', '`create_servergroup`', + '`create_sfs`', '`create_snapshot`', '`create_subnet`', '`create_vm`', + '`create_volume`', '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', '`delete_caas_container`', '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', @@ -415,8 +415,8 @@ def list( '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', '`update_inference_application`', '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_l7policy`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_sfs`', - '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', + '`update_port_allowed_address_pairs`', '`update_security_group`', + '`update_sfs`', '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or diff --git a/src/gcore/types/cloud/audit_log_entry.py b/src/gcore/types/cloud/audit_log_entry.py index f73e831e..80a077ae 100644 --- a/src/gcore/types/cloud/audit_log_entry.py +++ b/src/gcore/types/cloud/audit_log_entry.py @@ -161,7 +161,6 @@ class AuditLogEntry(BaseModel): api_group: Literal[ "ai_cluster", - "backup_service", "caas_container", "caas_key", "caas_pull_secret", diff --git a/src/gcore/types/cloud/audit_log_list_params.py b/src/gcore/types/cloud/audit_log_list_params.py index cec69e6a..87bcacce 100644 --- a/src/gcore/types/cloud/audit_log_list_params.py +++ b/src/gcore/types/cloud/audit_log_list_params.py @@ -57,7 +57,6 @@ class AuditLogListParams(TypedDict, total=False): api_group: List[ Literal[ "ai_cluster", - "backup_service", "caas_container", "caas_key", "caas_pull_secret", diff --git a/src/gcore/types/cloud/gpu_baremetal/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal/gpu_baremetal_cluster.py index 17cfcf4e..5eb7f5da 100644 --- a/src/gcore/types/cloud/gpu_baremetal/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal/gpu_baremetal_cluster.py @@ -148,7 +148,9 @@ class GPUBaremetalCluster(BaseModel): servers_settings: ServersSettings - status: Literal["active", "deleting", "error", "new", "resizing"] + status: Literal[ + "active", "creating", "degraded", "deleting", "error", "new", "rebooting", "rebuilding", "resizing", "shutoff" + ] """Cluster status""" tags: List[Tag] diff --git a/src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py b/src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py index 9b71eb5e..3561daea 100644 --- a/src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py +++ b/src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py @@ -176,7 +176,9 @@ class GPUVirtualCluster(BaseModel): servers_settings: ServersSettings - status: Literal["active", "deleting", "error", "new", "resizing"] + status: Literal[ + "active", "creating", "degraded", "deleting", "error", "new", "rebooting", "rebuilding", "resizing", "shutoff" + ] """Cluster status""" tags: List[Tag] diff --git a/src/gcore/types/cloud/security_group_list_params.py b/src/gcore/types/cloud/security_group_list_params.py index 22b3bd2c..0f13ddad 100644 --- a/src/gcore/types/cloud/security_group_list_params.py +++ b/src/gcore/types/cloud/security_group_list_params.py @@ -19,6 +19,9 @@ class SecurityGroupListParams(TypedDict, total=False): limit: int """Limit of items on a single page""" + name: str + """Optional. Filter by name. Must be specified a full name of the security group.""" + offset: int """Offset in results list""" diff --git a/src/gcore/types/cloud/task.py b/src/gcore/types/cloud/task.py index aaa2f782..7eae7f01 100644 --- a/src/gcore/types/cloud/task.py +++ b/src/gcore/types/cloud/task.py @@ -98,6 +98,9 @@ class CreatedResources(BaseModel): secrets: Optional[List[str]] = None """IDs of created secrets""" + security_groups: Optional[List[str]] = None + """IDs of created security groups""" + servergroups: Optional[List[str]] = None """IDs of created server groups""" diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index 0fc29cca..1af00005 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -71,9 +71,9 @@ class TaskListParams(TypedDict, total=False): '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', '`create_lbpool_health_monitor`', '`create_loadbalancer`', '`create_network`', '`create_reserved_fixed_ip`', '`create_router`', - '`create_secret`', '`create_servergroup`', '`create_sfs`', '`create_snapshot`', - '`create_subnet`', '`create_vm`', '`create_volume`', - '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', + '`create_secret`', '`create_security_group`', '`create_servergroup`', + '`create_sfs`', '`create_snapshot`', '`create_subnet`', '`create_vm`', + '`create_volume`', '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', '`delete_caas_container`', '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', @@ -103,8 +103,8 @@ class TaskListParams(TypedDict, total=False): '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', '`update_inference_application`', '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_l7policy`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_sfs`', - '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', + '`update_port_allowed_address_pairs`', '`update_security_group`', + '`update_sfs`', '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] """ diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index 6e6796b6..0b842fd6 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -14,6 +14,8 @@ SecurityGroup, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,46 +24,51 @@ class TestSecurityGroups: @parametrize def test_method_create(self, client: Gcore) -> None: - security_group = client.cloud.security_groups.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) + with pytest.warns(DeprecationWarning): + security_group = client.cloud.security_groups.create( + project_id=1, + region_id=1, + security_group={"name": "my_security_group"}, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - security_group = client.cloud.security_groups.create( - project_id=1, - region_id=1, - security_group={ - "name": "my_security_group", - "description": "Some description", - "security_group_rules": [ - { - "direction": "ingress", - "description": "Some description", - "ethertype": "IPv4", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "00000000-0000-4000-8000-000000000000", - "remote_ip_prefix": "10.0.0.0/8", - } - ], - "tags": {"my-tag": "my-tag-value"}, - }, - instances=["00000000-0000-4000-8000-000000000000"], - ) + with pytest.warns(DeprecationWarning): + security_group = client.cloud.security_groups.create( + project_id=1, + region_id=1, + security_group={ + "name": "my_security_group", + "description": "Some description", + "security_group_rules": [ + { + "direction": "ingress", + "description": "Some description", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + } + ], + "tags": {"my-tag": "my-tag-value"}, + }, + instances=["00000000-0000-4000-8000-000000000000"], + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.cloud.security_groups.with_raw_response.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.security_groups.with_raw_response.create( + project_id=1, + region_id=1, + security_group={"name": "my_security_group"}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -70,60 +77,66 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.cloud.security_groups.with_streaming_response.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.security_groups.with_streaming_response.create( + project_id=1, + region_id=1, + security_group={"name": "my_security_group"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_group = response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_update(self, client: Gcore) -> None: - security_group = client.cloud.security_groups.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + security_group = client.cloud.security_groups.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - security_group = client.cloud.security_groups.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - changed_rules=[ - { - "action": "delete", - "description": "Some description", - "direction": "egress", - "ethertype": "IPv4", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "00000000-0000-4000-8000-000000000000", - "remote_ip_prefix": "10.0.0.0/8", - "security_group_rule_id": "00000000-0000-4000-8000-000000000000", - } - ], - name="some_name", - tags={"foo": "my-tag-value"}, - ) + with pytest.warns(DeprecationWarning): + security_group = client.cloud.security_groups.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + changed_rules=[ + { + "action": "delete", + "description": "Some description", + "direction": "egress", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + "security_group_rule_id": "00000000-0000-4000-8000-000000000000", + } + ], + name="some_name", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.security_groups.with_raw_response.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.security_groups.with_raw_response.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -132,27 +145,29 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.security_groups.with_streaming_response.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.security_groups.with_streaming_response.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_group = response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): - client.cloud.security_groups.with_raw_response.update( - group_id="", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + client.cloud.security_groups.with_raw_response.update( + group_id="", + project_id=1, + region_id=1, + ) @parametrize def test_method_list(self, client: Gcore) -> None: @@ -168,6 +183,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, limit=10, + name="my_security_group", offset=0, tag_key=["key1", "key2"], tag_key_value="tag_key_value", @@ -396,46 +412,51 @@ class TestAsyncSecurityGroups: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - security_group = await async_client.cloud.security_groups.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) + with pytest.warns(DeprecationWarning): + security_group = await async_client.cloud.security_groups.create( + project_id=1, + region_id=1, + security_group={"name": "my_security_group"}, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - security_group = await async_client.cloud.security_groups.create( - project_id=1, - region_id=1, - security_group={ - "name": "my_security_group", - "description": "Some description", - "security_group_rules": [ - { - "direction": "ingress", - "description": "Some description", - "ethertype": "IPv4", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "00000000-0000-4000-8000-000000000000", - "remote_ip_prefix": "10.0.0.0/8", - } - ], - "tags": {"my-tag": "my-tag-value"}, - }, - instances=["00000000-0000-4000-8000-000000000000"], - ) + with pytest.warns(DeprecationWarning): + security_group = await async_client.cloud.security_groups.create( + project_id=1, + region_id=1, + security_group={ + "name": "my_security_group", + "description": "Some description", + "security_group_rules": [ + { + "direction": "ingress", + "description": "Some description", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + } + ], + "tags": {"my-tag": "my-tag-value"}, + }, + instances=["00000000-0000-4000-8000-000000000000"], + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.security_groups.with_raw_response.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.security_groups.with_raw_response.create( + project_id=1, + region_id=1, + security_group={"name": "my_security_group"}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -444,60 +465,66 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.security_groups.with_streaming_response.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.cloud.security_groups.with_streaming_response.create( + project_id=1, + region_id=1, + security_group={"name": "my_security_group"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_group = await response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = await response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - security_group = await async_client.cloud.security_groups.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + security_group = await async_client.cloud.security_groups.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - security_group = await async_client.cloud.security_groups.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - changed_rules=[ - { - "action": "delete", - "description": "Some description", - "direction": "egress", - "ethertype": "IPv4", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "00000000-0000-4000-8000-000000000000", - "remote_ip_prefix": "10.0.0.0/8", - "security_group_rule_id": "00000000-0000-4000-8000-000000000000", - } - ], - name="some_name", - tags={"foo": "my-tag-value"}, - ) + with pytest.warns(DeprecationWarning): + security_group = await async_client.cloud.security_groups.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + changed_rules=[ + { + "action": "delete", + "description": "Some description", + "direction": "egress", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + "security_group_rule_id": "00000000-0000-4000-8000-000000000000", + } + ], + name="some_name", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.security_groups.with_raw_response.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.security_groups.with_raw_response.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -506,27 +533,29 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.security_groups.with_streaming_response.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.cloud.security_groups.with_streaming_response.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_group = await response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = await response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): - await async_client.cloud.security_groups.with_raw_response.update( - group_id="", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + await async_client.cloud.security_groups.with_raw_response.update( + group_id="", + project_id=1, + region_id=1, + ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: @@ -542,6 +571,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No project_id=1, region_id=1, limit=10, + name="my_security_group", offset=0, tag_key=["key1", "key2"], tag_key_value="tag_key_value", From 87be5b2b7da8942336194cf36280567e7c058e98 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 15:57:54 +0000 Subject: [PATCH 511/592] fix(cloud)!: rename instance flavor model --- .stats.yml | 2 +- api.md | 4 +-- .../resources/cloud/instances/flavors.py | 10 ++++---- src/gcore/types/cloud/instances/__init__.py | 3 ++- ...esponse.py => instance_flavor_detailed.py} | 25 ++++++------------- .../cloud/instances/instance_flavor_list.py | 16 ++++++++++++ .../cloud/instances/test_flavors.py | 18 ++++++------- 7 files changed, 43 insertions(+), 35 deletions(-) rename src/gcore/types/cloud/instances/{flavor_list_response.py => instance_flavor_detailed.py} (71%) create mode 100644 src/gcore/types/cloud/instances/instance_flavor_list.py diff --git a/.stats.yml b/.stats.yml index 4d118940..a13e8168 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8d156dce8786b969c408f2d7fecc7b180388f3b0c16800b62a4af4f954cd343b.yml openapi_spec_hash: 0f521c0d26f4dbcce241b9ed80c3c7bb -config_hash: 72dafc786d92b98aa097fd4ec34680ca +config_hash: e81f299feec21ef63a02ee2de1ba99a3 diff --git a/api.md b/api.md index 644fa847..83c5cc04 100644 --- a/api.md +++ b/api.md @@ -977,12 +977,12 @@ Methods: Types: ```python -from gcore.types.cloud.instances import InstanceFlavor, InstanceFlavorList, FlavorListResponse +from gcore.types.cloud.instances import InstanceFlavorDetailed, InstanceFlavorList ``` Methods: -- client.cloud.instances.flavors.list(\*, project_id, region_id, \*\*params) -> FlavorListResponse +- client.cloud.instances.flavors.list(\*, project_id, region_id, \*\*params) -> InstanceFlavorList ### Interfaces diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 69f5eace..23ba0073 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -16,7 +16,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.instances import flavor_list_params -from ....types.cloud.instances.flavor_list_response import FlavorListResponse +from ....types.cloud.instances.instance_flavor_list import InstanceFlavorList __all__ = ["FlavorsResource", "AsyncFlavorsResource"] @@ -56,7 +56,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FlavorListResponse: + ) -> InstanceFlavorList: """Retrieve a list of available instance flavors in the project and region. When @@ -101,7 +101,7 @@ def list( flavor_list_params.FlavorListParams, ), ), - cast_to=FlavorListResponse, + cast_to=InstanceFlavorList, ) @@ -140,7 +140,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FlavorListResponse: + ) -> InstanceFlavorList: """Retrieve a list of available instance flavors in the project and region. When @@ -185,7 +185,7 @@ async def list( flavor_list_params.FlavorListParams, ), ), - cast_to=FlavorListResponse, + cast_to=InstanceFlavorList, ) diff --git a/src/gcore/types/cloud/instances/__init__.py b/src/gcore/types/cloud/instances/__init__.py index 5fc63c97..fb06e51e 100644 --- a/src/gcore/types/cloud/instances/__init__.py +++ b/src/gcore/types/cloud/instances/__init__.py @@ -10,7 +10,8 @@ from .metric_list_params import MetricListParams as MetricListParams from .image_update_params import ImageUpdateParams as ImageUpdateParams from .image_upload_params import ImageUploadParams as ImageUploadParams -from .flavor_list_response import FlavorListResponse as FlavorListResponse +from .instance_flavor_list import InstanceFlavorList as InstanceFlavorList from .interface_attach_params import InterfaceAttachParams as InterfaceAttachParams from .interface_detach_params import InterfaceDetachParams as InterfaceDetachParams +from .instance_flavor_detailed import InstanceFlavorDetailed as InstanceFlavorDetailed from .image_create_from_volume_params import ImageCreateFromVolumeParams as ImageCreateFromVolumeParams diff --git a/src/gcore/types/cloud/instances/flavor_list_response.py b/src/gcore/types/cloud/instances/instance_flavor_detailed.py similarity index 71% rename from src/gcore/types/cloud/instances/flavor_list_response.py rename to src/gcore/types/cloud/instances/instance_flavor_detailed.py index 7b51daf6..b1605b03 100644 --- a/src/gcore/types/cloud/instances/flavor_list_response.py +++ b/src/gcore/types/cloud/instances/instance_flavor_detailed.py @@ -1,19 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, Union, Optional from typing_extensions import Literal, TypeAlias from ...._models import BaseModel __all__ = [ - "FlavorListResponse", - "Result", - "ResultInstanceFlavorExtendedSerializerWithoutPrice", - "ResultInstanceFlavorExtendedSerializerWithPrice", + "InstanceFlavorDetailed", + "InstanceFlavorExtendedSerializerWithoutPrice", + "InstanceFlavorExtendedSerializerWithPrice", ] -class ResultInstanceFlavorExtendedSerializerWithoutPrice(BaseModel): +class InstanceFlavorExtendedSerializerWithoutPrice(BaseModel): """Instances flavor schema without price information""" architecture: str @@ -41,7 +40,7 @@ class ResultInstanceFlavorExtendedSerializerWithoutPrice(BaseModel): """Virtual CPU count""" -class ResultInstanceFlavorExtendedSerializerWithPrice(BaseModel): +class InstanceFlavorExtendedSerializerWithPrice(BaseModel): """Instances flavor schema with price information""" architecture: str @@ -81,14 +80,6 @@ class ResultInstanceFlavorExtendedSerializerWithPrice(BaseModel): """Virtual CPU count""" -Result: TypeAlias = Union[ - ResultInstanceFlavorExtendedSerializerWithoutPrice, ResultInstanceFlavorExtendedSerializerWithPrice +InstanceFlavorDetailed: TypeAlias = Union[ + InstanceFlavorExtendedSerializerWithoutPrice, InstanceFlavorExtendedSerializerWithPrice ] - - -class FlavorListResponse(BaseModel): - count: int - """Number of objects""" - - results: List[Result] - """Objects""" diff --git a/src/gcore/types/cloud/instances/instance_flavor_list.py b/src/gcore/types/cloud/instances/instance_flavor_list.py new file mode 100644 index 00000000..3977e00c --- /dev/null +++ b/src/gcore/types/cloud/instances/instance_flavor_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .instance_flavor_detailed import InstanceFlavorDetailed + +__all__ = ["InstanceFlavorList"] + + +class InstanceFlavorList(BaseModel): + count: int + """Number of objects""" + + results: List[InstanceFlavorDetailed] + """Objects""" diff --git a/tests/api_resources/cloud/instances/test_flavors.py b/tests/api_resources/cloud/instances/test_flavors.py index 1e0aecf5..51ff8119 100644 --- a/tests/api_resources/cloud/instances/test_flavors.py +++ b/tests/api_resources/cloud/instances/test_flavors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.instances import FlavorListResponse +from gcore.types.cloud.instances import InstanceFlavorList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -35,7 +35,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: exclude_windows=True, include_prices=True, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -47,7 +47,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -59,7 +59,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +75,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -87,7 +87,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No exclude_windows=True, include_prices=True, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -99,7 +99,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -111,6 +111,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True From 22c8180e32a07a04b74f4adef3d9a4e3e17c5aa3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 16:14:20 +0000 Subject: [PATCH 512/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- .../cloud/load_balancers/pools/test_members.py | 4 ++-- .../api_resources/cloud/load_balancers/test_pools.py | 12 ++++++------ tests/api_resources/cloud/test_load_balancers.py | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.stats.yml b/.stats.yml index a13e8168..d1ce08a0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8d156dce8786b969c408f2d7fecc7b180388f3b0c16800b62a4af4f954cd343b.yml -openapi_spec_hash: 0f521c0d26f4dbcce241b9ed80c3c7bb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-894b2183d1401f314175c07dee63488e7cab3df1890264ca13a4a3dbd1b4e9fa.yml +openapi_spec_hash: 3f6aa16cd53813a22b1648af69240cab config_hash: e81f299feec21ef63a02ee2de1ba99a3 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 3037fa30..57533ae8 100644 --- a/tests/api_resources/cloud/load_balancers/pools/test_members.py +++ b/tests/api_resources/cloud/load_balancers/pools/test_members.py @@ -40,7 +40,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: backup=True, instance_id="a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", monitor_address="monitor_address", - monitor_port=0, + monitor_port=1, subnet_id="32283b0b-b560-4690-810c-f672cbb2e28d", weight=1, ) @@ -176,7 +176,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> backup=True, instance_id="a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", monitor_address="monitor_address", - monitor_port=0, + monitor_port=1, subnet_id="32283b0b-b560-4690-810c-f672cbb2e28d", weight=1, ) diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py index 0b095c3d..3a381afc 100644 --- a/tests/api_resources/cloud/load_balancers/test_pools.py +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -58,7 +58,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "backup": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", - "monitor_port": 0, + "monitor_port": 1, "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", "weight": 2, }, @@ -69,7 +69,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "backup": True, "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", "monitor_address": "monitor_address", - "monitor_port": 0, + "monitor_port": 1, "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", "weight": 4, }, @@ -155,7 +155,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "backup": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", - "monitor_port": 0, + "monitor_port": 1, "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", "weight": 1, } @@ -396,7 +396,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "backup": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", - "monitor_port": 0, + "monitor_port": 1, "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", "weight": 2, }, @@ -407,7 +407,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "backup": True, "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", "monitor_address": "monitor_address", - "monitor_port": 0, + "monitor_port": 1, "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", "weight": 4, }, @@ -493,7 +493,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "backup": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", - "monitor_port": 0, + "monitor_port": 1, "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", "weight": 1, } diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index abd1f5ce..814fbc75 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -72,7 +72,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "backup": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", - "monitor_port": 0, + "monitor_port": 1, "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", "weight": 2, }, @@ -83,7 +83,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "backup": True, "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", "monitor_address": "monitor_address", - "monitor_port": 0, + "monitor_port": 1, "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", "weight": 4, }, @@ -538,7 +538,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "backup": True, "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9", "monitor_address": "monitor_address", - "monitor_port": 0, + "monitor_port": 1, "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", "weight": 2, }, @@ -549,7 +549,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "backup": True, "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd", "monitor_address": "monitor_address", - "monitor_port": 0, + "monitor_port": 1, "subnet_id": "32283b0b-b560-4690-810c-f672cbb2e28d", "weight": 4, }, From c185ff7f5e2ba10f594dd9e88b40fdc379638ab0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 18:36:00 +0000 Subject: [PATCH 513/592] feat(client): add support for binary request streaming --- src/gcore/_base_client.py | 145 ++++++++++++++++-- src/gcore/_models.py | 17 ++- src/gcore/_types.py | 9 ++ src/gcore/resources/fastedge/binaries.py | 22 ++- tests/test_client.py | 187 ++++++++++++++++++++++- 5 files changed, 361 insertions(+), 19 deletions(-) diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index 56aeddf3..e4303b57 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -9,6 +9,7 @@ import inspect import logging import platform +import warnings import email.utils from types import TracebackType from random import random @@ -51,9 +52,11 @@ ResponseT, AnyMapping, PostParser, + BinaryTypes, RequestFiles, HttpxSendArgs, RequestOptions, + AsyncBinaryTypes, HttpxRequestFiles, ModelBuilderProtocol, not_given, @@ -477,8 +480,19 @@ def _build_request( retries_taken: int = 0, ) -> httpx.Request: if log.isEnabledFor(logging.DEBUG): - log.debug("Request options: %s", model_dump(options, exclude_unset=True)) - + log.debug( + "Request options: %s", + model_dump( + options, + exclude_unset=True, + # Pydantic v1 can't dump every type we support in content, so we exclude it for now. + exclude={ + "content", + } + if PYDANTIC_V1 + else {}, + ), + ) kwargs: dict[str, Any] = {} json_data = options.json_data @@ -532,7 +546,13 @@ def _build_request( is_body_allowed = options.method.lower() != "get" if is_body_allowed: - if isinstance(json_data, bytes): + if options.content is not None and json_data is not None: + raise TypeError("Passing both `content` and `json_data` is not supported") + if options.content is not None and files is not None: + raise TypeError("Passing both `content` and `files` is not supported") + if options.content is not None: + kwargs["content"] = options.content + elif isinstance(json_data, bytes): kwargs["content"] = json_data else: kwargs["json"] = json_data if is_given(json_data) else None @@ -1194,6 +1214,7 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[False] = False, @@ -1206,6 +1227,7 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[True], @@ -1219,6 +1241,7 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: bool, @@ -1231,13 +1254,25 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: bool = False, stream_cls: type[_StreamT] | None = None, ) -> ResponseT | _StreamT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="post", url=path, json_data=body, files=to_httpx_files(files), **options + method="post", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) @@ -1247,11 +1282,23 @@ def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + method="patch", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return self.request(cast_to, opts) @@ -1261,11 +1308,23 @@ def put( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="put", url=path, json_data=body, files=to_httpx_files(files), **options + method="put", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return self.request(cast_to, opts) @@ -1275,9 +1334,19 @@ def delete( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options) return self.request(cast_to, opts) def get_api_list( @@ -1717,6 +1786,7 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[False] = False, @@ -1729,6 +1799,7 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[True], @@ -1742,6 +1813,7 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: bool, @@ -1754,13 +1826,25 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: bool = False, stream_cls: type[_AsyncStreamT] | None = None, ) -> ResponseT | _AsyncStreamT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="post", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="post", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) @@ -1770,11 +1854,28 @@ async def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="patch", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="patch", + url=path, + json_data=body, + content=content, + files=await async_to_httpx_files(files), + **options, ) return await self.request(cast_to, opts) @@ -1784,11 +1885,23 @@ async def put( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="put", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="put", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts) @@ -1798,9 +1911,19 @@ async def delete( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options) return await self.request(cast_to, opts) def get_api_list( diff --git a/src/gcore/_models.py b/src/gcore/_models.py index ca9500b2..29070e05 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -3,7 +3,20 @@ import os import inspect import weakref -from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast +from typing import ( + IO, + TYPE_CHECKING, + Any, + Type, + Union, + Generic, + TypeVar, + Callable, + Iterable, + Optional, + AsyncIterable, + cast, +) from datetime import date, datetime from typing_extensions import ( List, @@ -787,6 +800,7 @@ class FinalRequestOptionsInput(TypedDict, total=False): timeout: float | Timeout | None files: HttpxRequestFiles | None idempotency_key: str + content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] json_data: Body extra_json: AnyMapping follow_redirects: bool @@ -805,6 +819,7 @@ class FinalRequestOptions(pydantic.BaseModel): post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() follow_redirects: Union[bool, None] = None + content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] = None # It should be noted that we cannot use `json` here as that would override # a BaseModel method in an incompatible fashion. json_data: Union[Body, None] = None diff --git a/src/gcore/_types.py b/src/gcore/_types.py index 6877c20a..bbc3b7c8 100644 --- a/src/gcore/_types.py +++ b/src/gcore/_types.py @@ -13,9 +13,11 @@ Mapping, TypeVar, Callable, + Iterable, Iterator, Optional, Sequence, + AsyncIterable, ) from typing_extensions import ( Set, @@ -56,6 +58,13 @@ else: Base64FileInput = Union[IO[bytes], PathLike] FileContent = Union[IO[bytes], bytes, PathLike] # PathLike is not subscriptable in Python 3.8. + + +# Used for sending raw binary data / streaming data in request bodies +# e.g. for file uploads without multipart encoding +BinaryTypes = Union[bytes, bytearray, IO[bytes], Iterable[bytes]] +AsyncBinaryTypes = Union[bytes, bytearray, IO[bytes], AsyncIterable[bytes]] + FileTypes = Union[ # file (or bytes) FileContent, diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index c88f90da..1fe86c54 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -2,10 +2,22 @@ from __future__ import annotations +import os + import httpx from ..._files import read_file_content, async_read_file_content -from ..._types import Body, Query, Headers, NoneType, NotGiven, FileContent, not_given +from ..._types import ( + Body, + Query, + Headers, + NoneType, + NotGiven, + BinaryTypes, + FileContent, + AsyncBinaryTypes, + not_given, +) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -44,7 +56,7 @@ def with_streaming_response(self) -> BinariesResourceWithStreamingResponse: def create( self, - body: FileContent, + body: FileContent | BinaryTypes, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -68,7 +80,7 @@ def create( extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return self._post( "/fastedge/v1/binaries/raw", - body=read_file_content(body), + content=read_file_content(body) if isinstance(body, os.PathLike) else body, options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -180,7 +192,7 @@ def with_streaming_response(self) -> AsyncBinariesResourceWithStreamingResponse: async def create( self, - body: FileContent, + body: FileContent | AsyncBinaryTypes, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -204,7 +216,7 @@ async def create( extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return await self._post( "/fastedge/v1/binaries/raw", - body=await async_read_file_content(body), + content=await async_read_file_content(body) if isinstance(body, os.PathLike) else body, options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/tests/test_client.py b/tests/test_client.py index 65c6446b..67601f11 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -8,10 +8,11 @@ import json import asyncio import inspect +import dataclasses import tracemalloc -from typing import Any, Union, cast +from typing import Any, Union, TypeVar, Callable, Iterable, Iterator, Optional, Coroutine, cast from unittest import mock -from typing_extensions import Literal +from typing_extensions import Literal, AsyncIterator, override import httpx import pytest @@ -36,6 +37,7 @@ from .utils import update_env +T = TypeVar("T") base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") api_key = "My API Key" @@ -50,6 +52,57 @@ def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float: return 0.1 +def mirror_request_content(request: httpx.Request) -> httpx.Response: + return httpx.Response(200, content=request.content) + + +# note: we can't use the httpx.MockTransport class as it consumes the request +# body itself, which means we can't test that the body is read lazily +class MockTransport(httpx.BaseTransport, httpx.AsyncBaseTransport): + def __init__( + self, + handler: Callable[[httpx.Request], httpx.Response] + | Callable[[httpx.Request], Coroutine[Any, Any, httpx.Response]], + ) -> None: + self.handler = handler + + @override + def handle_request( + self, + request: httpx.Request, + ) -> httpx.Response: + assert not inspect.iscoroutinefunction(self.handler), "handler must not be a coroutine function" + assert inspect.isfunction(self.handler), "handler must be a function" + return self.handler(request) + + @override + async def handle_async_request( + self, + request: httpx.Request, + ) -> httpx.Response: + assert inspect.iscoroutinefunction(self.handler), "handler must be a coroutine function" + return await self.handler(request) + + +@dataclasses.dataclass +class Counter: + value: int = 0 + + +def _make_sync_iterator(iterable: Iterable[T], counter: Optional[Counter] = None) -> Iterator[T]: + for item in iterable: + if counter: + counter.value += 1 + yield item + + +async def _make_async_iterator(iterable: Iterable[T], counter: Optional[Counter] = None) -> AsyncIterator[T]: + for item in iterable: + if counter: + counter.value += 1 + yield item + + def _get_open_connections(client: Gcore | AsyncGcore) -> int: transport = client._client._transport assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) @@ -518,6 +571,70 @@ def test_multipart_repeating_array(self, client: Gcore) -> None: b"", ] + @pytest.mark.respx(base_url=base_url) + def test_binary_content_upload(self, respx_mock: MockRouter, client: Gcore) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + response = client.post( + "/upload", + content=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + + def test_binary_content_upload_with_iterator(self) -> None: + file_content = b"Hello, this is a test file." + counter = Counter() + iterator = _make_sync_iterator([file_content], counter=counter) + + def mock_handler(request: httpx.Request) -> httpx.Response: + assert counter.value == 0, "the request body should not have been read" + return httpx.Response(200, content=request.read()) + + with Gcore( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.Client(transport=MockTransport(handler=mock_handler)), + ) as client: + response = client.post( + "/upload", + content=iterator, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + assert counter.value == 1 + + @pytest.mark.respx(base_url=base_url) + def test_binary_content_upload_with_body_is_deprecated(self, respx_mock: MockRouter, client: Gcore) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + with pytest.deprecated_call( + match="Passing raw bytes as `body` is deprecated and will be removed in a future version. Please pass raw bytes via the `content` parameter instead." + ): + response = client.post( + "/upload", + body=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + @pytest.mark.respx(base_url=base_url) def test_basic_union_response(self, respx_mock: MockRouter, client: Gcore) -> None: class Model1(BaseModel): @@ -1357,6 +1474,72 @@ def test_multipart_repeating_array(self, async_client: AsyncGcore) -> None: b"", ] + @pytest.mark.respx(base_url=base_url) + async def test_binary_content_upload(self, respx_mock: MockRouter, async_client: AsyncGcore) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + response = await async_client.post( + "/upload", + content=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + + async def test_binary_content_upload_with_asynciterator(self) -> None: + file_content = b"Hello, this is a test file." + counter = Counter() + iterator = _make_async_iterator([file_content], counter=counter) + + async def mock_handler(request: httpx.Request) -> httpx.Response: + assert counter.value == 0, "the request body should not have been read" + return httpx.Response(200, content=await request.aread()) + + async with AsyncGcore( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.AsyncClient(transport=MockTransport(handler=mock_handler)), + ) as client: + response = await client.post( + "/upload", + content=iterator, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + assert counter.value == 1 + + @pytest.mark.respx(base_url=base_url) + async def test_binary_content_upload_with_body_is_deprecated( + self, respx_mock: MockRouter, async_client: AsyncGcore + ) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + with pytest.deprecated_call( + match="Passing raw bytes as `body` is deprecated and will be removed in a future version. Please pass raw bytes via the `content` parameter instead." + ): + response = await async_client.post( + "/upload", + body=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + @pytest.mark.respx(base_url=base_url) async def test_basic_union_response(self, respx_mock: MockRouter, async_client: AsyncGcore) -> None: class Model1(BaseModel): From e731369fb4cc06a3ddfac82ec17c7cf9a4609567 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 14 Jan 2026 09:38:15 +0000 Subject: [PATCH 514/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/iam/user.py | 46 ++++++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/.stats.yml b/.stats.yml index d1ce08a0..e1e84e33 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-894b2183d1401f314175c07dee63488e7cab3df1890264ca13a4a3dbd1b4e9fa.yml -openapi_spec_hash: 3f6aa16cd53813a22b1648af69240cab +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6ff85e022c3a07d4d1dddfb6fb263de4f7482ed0099d5d8e814ba7d2d1158f4e.yml +openapi_spec_hash: 44c0a0aa8c3959d840b1cd449a281ed9 config_hash: e81f299feec21ef63a02ee2de1ba99a3 diff --git a/src/gcore/types/iam/user.py b/src/gcore/types/iam/user.py index ba27f51d..0dcaa14b 100644 --- a/src/gcore/types/iam/user.py +++ b/src/gcore/types/iam/user.py @@ -5,7 +5,19 @@ from ..._models import BaseModel -__all__ = ["User", "Group"] +__all__ = ["User", "ClientAndRole", "Group"] + + +class ClientAndRole(BaseModel): + client_company_name: str + + client_id: int + + user_id: int + """User's ID.""" + + user_roles: List[str] + """User role in this client.""" class Group(BaseModel): @@ -25,32 +37,35 @@ class Group(BaseModel): class User(BaseModel): - id: Optional[int] = None + id: int """User's ID.""" - activated: Optional[bool] = None + activated: bool """Email confirmation: - `true` – user confirmed the email; - `false` – user did not confirm the email. """ - auth_types: Optional[List[Literal["password", "sso", "github", "google-oauth2"]]] = None + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] """System field. List of auth types available for the account.""" - client: Optional[float] = None + client: float """User's account ID.""" - company: Optional[str] = None + client_and_roles: List[ClientAndRole] + """List of user's clients. User can access to one or more clients.""" + + company: str """User's company.""" - deleted: Optional[bool] = None + deleted: bool """Deletion flag. If `true` then user was deleted.""" - email: Optional[str] = None + email: str """User's email address.""" - groups: Optional[List[Group]] = None + groups: List[Group] """User's group in the current account. IAM supports 5 groups: @@ -62,7 +77,10 @@ class User(BaseModel): - Purge and Prefetch only (API+Web) """ - lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None + is_active: bool + """User activity flag.""" + + lang: Literal["de", "en", "ru", "zh", "az"] """User's language. Defines language of the control panel and email messages. @@ -74,18 +92,18 @@ class User(BaseModel): phone: Optional[str] = None """User's phone.""" - reseller: Optional[int] = None + reseller: int """Services provider ID.""" - sso_auth: Optional[bool] = None + sso_auth: bool """SSO authentication flag. If `true` then user can login via SAML SSO.""" - two_fa: Optional[bool] = None + two_fa: bool """Two-step verification: - `true` – user enabled two-step verification; - `false` – user disabled two-step verification. """ - user_type: Optional[Literal["common"]] = None + user_type: Literal["common", "reseller", "seller"] """User's type.""" From 04e299643b8a360f915a2e72e9a422b26f5e7230 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 14 Jan 2026 12:16:12 +0000 Subject: [PATCH 515/592] feat(api): aggregated API specs update --- .stats.yml | 4 +-- src/gcore/resources/cloud/quotas/requests.py | 27 ++++++++++++++++++- .../types/cloud/quotas/request_list_params.py | 16 +++++++++-- .../cloud/quotas/test_requests.py | 7 +++++ 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index e1e84e33..f5f3fb73 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6ff85e022c3a07d4d1dddfb6fb263de4f7482ed0099d5d8e814ba7d2d1158f4e.yml -openapi_spec_hash: 44c0a0aa8c3959d840b1cd449a281ed9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6c0a6b2ebeb53f375b862c8cb43c0a1a2b6b63148df5e3d846da34baf63548f4.yml +openapi_spec_hash: 9a8fc579465b9222bd17c6e039e2ff5b config_hash: e81f299feec21ef63a02ee2de1ba99a3 diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 5d778e27..5a12175b 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing import List +from typing import List, Union, Iterable +from datetime import datetime from typing_extensions import Literal import httpx @@ -93,8 +94,11 @@ def create( def list( self, *, + created_from: Union[str, datetime] | Omit = omit, + created_to: Union[str, datetime] | Omit = omit, limit: int | Omit = omit, offset: int | Omit = omit, + request_ids: Iterable[int] | Omit = omit, status: List[Literal["done", "in progress", "rejected"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -107,11 +111,17 @@ def list( Get a list of sent requests to change current quotas and their statuses. Args: + created_from: Filter limit requests created at or after this datetime (inclusive) + + created_to: Filter limit requests created at or before this datetime (inclusive) + limit: Optional. Limit the number of returned items offset: Optional. Offset value is used to exclude the first set of records from the result + request_ids: List of limit request IDs for filtering + status: List of limit requests statuses for filtering extra_headers: Send extra headers @@ -132,8 +142,11 @@ def list( timeout=timeout, query=maybe_transform( { + "created_from": created_from, + "created_to": created_to, "limit": limit, "offset": offset, + "request_ids": request_ids, "status": status, }, request_list_params.RequestListParams, @@ -277,8 +290,11 @@ async def create( def list( self, *, + created_from: Union[str, datetime] | Omit = omit, + created_to: Union[str, datetime] | Omit = omit, limit: int | Omit = omit, offset: int | Omit = omit, + request_ids: Iterable[int] | Omit = omit, status: List[Literal["done", "in progress", "rejected"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -291,11 +307,17 @@ def list( Get a list of sent requests to change current quotas and their statuses. Args: + created_from: Filter limit requests created at or after this datetime (inclusive) + + created_to: Filter limit requests created at or before this datetime (inclusive) + limit: Optional. Limit the number of returned items offset: Optional. Offset value is used to exclude the first set of records from the result + request_ids: List of limit request IDs for filtering + status: List of limit requests statuses for filtering extra_headers: Send extra headers @@ -316,8 +338,11 @@ def list( timeout=timeout, query=maybe_transform( { + "created_from": created_from, + "created_to": created_to, "limit": limit, "offset": offset, + "request_ids": request_ids, "status": status, }, request_list_params.RequestListParams, diff --git a/src/gcore/types/cloud/quotas/request_list_params.py b/src/gcore/types/cloud/quotas/request_list_params.py index ede95106..56e39b19 100644 --- a/src/gcore/types/cloud/quotas/request_list_params.py +++ b/src/gcore/types/cloud/quotas/request_list_params.py @@ -2,13 +2,22 @@ from __future__ import annotations -from typing import List -from typing_extensions import Literal, TypedDict +from typing import List, Union, Iterable +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ...._utils import PropertyInfo __all__ = ["RequestListParams"] class RequestListParams(TypedDict, total=False): + created_from: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Filter limit requests created at or after this datetime (inclusive)""" + + created_to: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """Filter limit requests created at or before this datetime (inclusive)""" + limit: int """Optional. Limit the number of returned items""" @@ -18,5 +27,8 @@ class RequestListParams(TypedDict, total=False): Offset value is used to exclude the first set of records from the result """ + request_ids: Iterable[int] + """List of limit request IDs for filtering""" + status: List[Literal["done", "in progress", "rejected"]] """List of limit requests statuses for filtering""" diff --git a/tests/api_resources/cloud/quotas/test_requests.py b/tests/api_resources/cloud/quotas/test_requests.py index 3c7152a1..00d49bcd 100644 --- a/tests/api_resources/cloud/quotas/test_requests.py +++ b/tests/api_resources/cloud/quotas/test_requests.py @@ -9,6 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type +from gcore._utils import parse_datetime from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud.quotas import RequestGetResponse, RequestListResponse @@ -134,8 +135,11 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: request = client.cloud.quotas.requests.list( + created_from=parse_datetime("2024-01-01T00:00:00Z"), + created_to=parse_datetime("2024-12-31T23:59:59Z"), limit=1000, offset=0, + request_ids=[1, 2, 3], status=["done", "in progress"], ) assert_matches_type(SyncOffsetPage[RequestListResponse], request, path=["response"]) @@ -344,8 +348,11 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: request = await async_client.cloud.quotas.requests.list( + created_from=parse_datetime("2024-01-01T00:00:00Z"), + created_to=parse_datetime("2024-12-31T23:59:59Z"), limit=1000, offset=0, + request_ids=[1, 2, 3], status=["done", "in progress"], ) assert_matches_type(AsyncOffsetPage[RequestListResponse], request, path=["response"]) From 29f69b604fa24746ca89c222a2242265e9aa3738 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 Jan 2026 11:08:00 +0000 Subject: [PATCH 516/592] fix: use correct collection models --- .stats.yml | 2 +- api.md | 65 +++++++------------ .../resources/cloud/k8s/clusters/clusters.py | 20 +++--- .../cloud/k8s/clusters/pools/pools.py | 10 +-- src/gcore/resources/cloud/k8s/k8s.py | 10 +-- .../resources/cloud/load_balancers/flavors.py | 10 +-- .../resources/cloud/load_balancers/metrics.py | 10 +-- .../cloud/load_balancers/statuses.py | 10 +-- src/gcore/resources/cloud/placement_groups.py | 10 +-- .../reserved_fixed_ips/vip/candidate_ports.py | 10 +-- .../reserved_fixed_ips/vip/connected_ports.py | 28 ++++---- src/gcore/types/cloud/__init__.py | 7 +- src/gcore/types/cloud/k8s/__init__.py | 5 +- .../types/cloud/k8s/clusters/__init__.py | 2 +- ...t_response.py => k8s_cluster_pool_list.py} | 4 +- ...r_list_response.py => k8s_cluster_list.py} | 4 +- ...esponse.py => k8s_cluster_version_list.py} | 4 +- ...sponse.py => load_balancer_flavor_list.py} | 8 +-- ...ponse.py => load_balancer_metrics_list.py} | 8 +-- ...sponse.py => load_balancer_status_list.py} | 8 +-- .../types/cloud/load_balancers/__init__.py | 3 - src/gcore/types/cloud/networks/__init__.py | 1 + .../router_list.py} | 8 +-- ...st_response.py => placement_group_list.py} | 4 +- .../cloud/reserved_fixed_ips/vip/__init__.py | 6 +- ...ist_response.py => candidate_port_list.py} | 4 +- ...add_response.py => connected_port_list.py} | 4 +- .../vip/connected_port_list_response.py | 16 ----- .../vip/connected_port_replace_response.py | 16 ----- .../cloud/k8s/clusters/test_pools.py | 14 ++-- .../api_resources/cloud/k8s/test_clusters.py | 29 ++++----- .../cloud/load_balancers/test_flavors.py | 18 ++--- .../cloud/load_balancers/test_metrics.py | 14 ++-- .../cloud/load_balancers/test_statuses.py | 15 ++--- .../vip/test_candidate_ports.py | 14 ++-- .../vip/test_connected_ports.py | 48 +++++++------- tests/api_resources/cloud/test_k8s.py | 14 ++-- .../cloud/test_placement_groups.py | 14 ++-- 38 files changed, 207 insertions(+), 270 deletions(-) rename src/gcore/types/cloud/k8s/clusters/{pool_list_response.py => k8s_cluster_pool_list.py} (80%) rename src/gcore/types/cloud/k8s/{cluster_list_response.py => k8s_cluster_list.py} (79%) rename src/gcore/types/cloud/{k8s_list_versions_response.py => k8s_cluster_version_list.py} (78%) rename src/gcore/types/cloud/{load_balancers/flavor_list_response.py => load_balancer_flavor_list.py} (74%) rename src/gcore/types/cloud/{load_balancers/metric_list_response.py => load_balancer_metrics_list.py} (56%) rename src/gcore/types/cloud/{load_balancers/status_list_response.py => load_balancer_status_list.py} (56%) rename src/gcore/types/cloud/{k8s/cluster_list_versions_for_upgrade_response.py => networks/router_list.py} (51%) rename src/gcore/types/cloud/{placement_group_list_response.py => placement_group_list.py} (77%) rename src/gcore/types/cloud/reserved_fixed_ips/vip/{candidate_port_list_response.py => candidate_port_list.py} (77%) rename src/gcore/types/cloud/reserved_fixed_ips/vip/{connected_port_add_response.py => connected_port_list.py} (77%) delete mode 100644 src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list_response.py delete mode 100644 src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_response.py diff --git a/.stats.yml b/.stats.yml index f5f3fb73..d8f50384 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6c0a6b2ebeb53f375b862c8cb43c0a1a2b6b63148df5e3d846da34baf63548f4.yml openapi_spec_hash: 9a8fc579465b9222bd17c6e039e2ff5b -config_hash: e81f299feec21ef63a02ee2de1ba99a3 +config_hash: 7085751e6bd8f3fd13cfebe04bb99fed diff --git a/api.md b/api.md index 83c5cc04..a877e26b 100644 --- a/api.md +++ b/api.md @@ -187,6 +187,7 @@ from gcore.types.cloud import ( LbSessionPersistenceType, ListenerStatus, LoadBalancerFlavorDetail, + LoadBalancerFlavorList, LoadBalancerL7Policy, LoadBalancerL7PolicyList, LoadBalancerL7Rule, @@ -194,9 +195,11 @@ from gcore.types.cloud import ( LoadBalancerListenerDetail, LoadBalancerListenerList, LoadBalancerMetrics, + LoadBalancerMetricsList, LoadBalancerPool, LoadBalancerPoolList, LoadBalancerStatus, + LoadBalancerStatusList, Member, MemberStatus, PoolStatus, @@ -236,15 +239,9 @@ Methods: ### Flavors -Types: - -```python -from gcore.types.cloud.load_balancers import FlavorListResponse -``` - Methods: -- client.cloud.load_balancers.flavors.list(\*, project_id, region_id, \*\*params) -> FlavorListResponse +- client.cloud.load_balancers.flavors.list(\*, project_id, region_id, \*\*params) -> LoadBalancerFlavorList ### Listeners @@ -282,27 +279,15 @@ Methods: ### Metrics -Types: - -```python -from gcore.types.cloud.load_balancers import MetricListResponse -``` - Methods: -- client.cloud.load_balancers.metrics.list(load_balancer_id, \*, project_id, region_id, \*\*params) -> MetricListResponse +- client.cloud.load_balancers.metrics.list(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancerMetricsList ### Statuses -Types: - -```python -from gcore.types.cloud.load_balancers import StatusListResponse -``` - Methods: -- client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> StatusListResponse +- client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> LoadBalancerStatusList - client.cloud.load_balancers.statuses.get(load_balancer_id, \*, project_id, region_id) -> LoadBalancerStatus ## ReservedFixedIPs @@ -338,31 +323,26 @@ Methods: Types: ```python -from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePort, CandidatePortListResponse +from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePort, CandidatePortList ``` Methods: -- client.cloud.reserved_fixed_ips.vip.candidate_ports.list(port_id, \*, project_id, region_id) -> CandidatePortListResponse +- client.cloud.reserved_fixed_ips.vip.candidate_ports.list(port_id, \*, project_id, region_id) -> CandidatePortList #### ConnectedPorts Types: ```python -from gcore.types.cloud.reserved_fixed_ips.vip import ( - ConnectedPort, - ConnectedPortListResponse, - ConnectedPortAddResponse, - ConnectedPortReplaceResponse, -) +from gcore.types.cloud.reserved_fixed_ips.vip import ConnectedPort, ConnectedPortList ``` Methods: -- client.cloud.reserved_fixed_ips.vip.connected_ports.list(port_id, \*, project_id, region_id) -> ConnectedPortListResponse -- client.cloud.reserved_fixed_ips.vip.connected_ports.add(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortAddResponse -- client.cloud.reserved_fixed_ips.vip.connected_ports.replace(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortReplaceResponse +- client.cloud.reserved_fixed_ips.vip.connected_ports.list(port_id, \*, project_id, region_id) -> ConnectedPortList +- client.cloud.reserved_fixed_ips.vip.connected_ports.add(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList +- client.cloud.reserved_fixed_ips.vip.connected_ports.replace(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList ## Networks @@ -389,7 +369,7 @@ Methods: Types: ```python -from gcore.types.cloud.networks import Router, SubnetID +from gcore.types.cloud.networks import Router, RouterList, SubnetID ``` Methods: @@ -638,13 +618,13 @@ Methods: Types: ```python -from gcore.types.cloud import PlacementGroup, PlacementGroupListResponse +from gcore.types.cloud import PlacementGroup, PlacementGroupList ``` Methods: - client.cloud.placement_groups.create(\*, project_id, region_id, \*\*params) -> PlacementGroup -- client.cloud.placement_groups.list(\*, project_id, region_id) -> PlacementGroupListResponse +- client.cloud.placement_groups.list(\*, project_id, region_id) -> PlacementGroupList - client.cloud.placement_groups.delete(group_id, \*, project_id, region_id) -> TaskIDList - client.cloud.placement_groups.get(group_id, \*, project_id, region_id) -> PlacementGroup @@ -1020,12 +1000,12 @@ Methods: Types: ```python -from gcore.types.cloud import K8SClusterVersion, K8SListVersionsResponse +from gcore.types.cloud import K8SClusterVersion, K8SClusterVersionList ``` Methods: -- client.cloud.k8s.list_versions(\*, project_id, region_id) -> K8SListVersionsResponse +- client.cloud.k8s.list_versions(\*, project_id, region_id) -> K8SClusterVersionList ### Flavors @@ -1042,8 +1022,7 @@ from gcore.types.cloud.k8s import ( K8SCluster, K8SClusterCertificate, K8SClusterKubeconfig, - ClusterListResponse, - ClusterListVersionsForUpgradeResponse, + K8SClusterList, ) ``` @@ -1051,12 +1030,12 @@ Methods: - client.cloud.k8s.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.k8s.clusters.update(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.k8s.clusters.list(\*, project_id, region_id) -> ClusterListResponse +- client.cloud.k8s.clusters.list(\*, project_id, region_id) -> K8SClusterList - client.cloud.k8s.clusters.delete(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.k8s.clusters.get(cluster_name, \*, project_id, region_id) -> K8SCluster - client.cloud.k8s.clusters.get_certificate(cluster_name, \*, project_id, region_id) -> K8SClusterCertificate - client.cloud.k8s.clusters.get_kubeconfig(cluster_name, \*, project_id, region_id) -> K8SClusterKubeconfig -- client.cloud.k8s.clusters.list_versions_for_upgrade(cluster_name, \*, project_id, region_id) -> ClusterListVersionsForUpgradeResponse +- client.cloud.k8s.clusters.list_versions_for_upgrade(cluster_name, \*, project_id, region_id) -> K8SClusterVersionList - client.cloud.k8s.clusters.upgrade(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList #### Nodes @@ -1071,14 +1050,14 @@ Methods: Types: ```python -from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolQuota, PoolListResponse +from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolList, K8SClusterPoolQuota ``` Methods: - client.cloud.k8s.clusters.pools.create(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.k8s.clusters.pools.update(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> K8SClusterPool -- client.cloud.k8s.clusters.pools.list(cluster_name, \*, project_id, region_id) -> PoolListResponse +- client.cloud.k8s.clusters.pools.list(cluster_name, \*, project_id, region_id) -> K8SClusterPoolList - client.cloud.k8s.clusters.pools.delete(pool_name, \*, project_id, region_id, cluster_name) -> TaskIDList - client.cloud.k8s.clusters.pools.check_quota(\*, project_id, region_id, \*\*params) -> K8SClusterPoolQuota - client.cloud.k8s.clusters.pools.get(pool_name, \*, project_id, region_id, cluster_name) -> K8SClusterPool diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index 8b48757d..52ab2f78 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -41,10 +41,10 @@ ) from .....types.cloud.task_id_list import TaskIDList from .....types.cloud.k8s.k8s_cluster import K8SCluster -from .....types.cloud.k8s.cluster_list_response import ClusterListResponse +from .....types.cloud.k8s.k8s_cluster_list import K8SClusterList +from .....types.cloud.k8s_cluster_version_list import K8SClusterVersionList from .....types.cloud.k8s.k8s_cluster_kubeconfig import K8SClusterKubeconfig from .....types.cloud.k8s.k8s_cluster_certificate import K8SClusterCertificate -from .....types.cloud.k8s.cluster_list_versions_for_upgrade_response import ClusterListVersionsForUpgradeResponse __all__ = ["ClustersResource", "AsyncClustersResource"] @@ -381,7 +381,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ClusterListResponse: + ) -> K8SClusterList: """ List k8s clusters @@ -403,7 +403,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ClusterListResponse, + cast_to=K8SClusterList, ) def delete( @@ -581,7 +581,7 @@ def list_versions_for_upgrade( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ClusterListVersionsForUpgradeResponse: + ) -> K8SClusterVersionList: """ List available k8s cluster versions for upgrade @@ -605,7 +605,7 @@ def list_versions_for_upgrade( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ClusterListVersionsForUpgradeResponse, + cast_to=K8SClusterVersionList, ) def upgrade( @@ -984,7 +984,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ClusterListResponse: + ) -> K8SClusterList: """ List k8s clusters @@ -1006,7 +1006,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ClusterListResponse, + cast_to=K8SClusterList, ) async def delete( @@ -1184,7 +1184,7 @@ async def list_versions_for_upgrade( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ClusterListVersionsForUpgradeResponse: + ) -> K8SClusterVersionList: """ List available k8s cluster versions for upgrade @@ -1208,7 +1208,7 @@ async def list_versions_for_upgrade( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ClusterListVersionsForUpgradeResponse, + cast_to=K8SClusterVersionList, ) async def upgrade( diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 1dd0f32d..7de8cf65 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -34,7 +34,7 @@ ) from ......types.cloud.task_id_list import TaskIDList from ......types.cloud.k8s.clusters.k8s_cluster_pool import K8SClusterPool -from ......types.cloud.k8s.clusters.pool_list_response import PoolListResponse +from ......types.cloud.k8s.clusters.k8s_cluster_pool_list import K8SClusterPoolList from ......types.cloud.k8s.clusters.k8s_cluster_pool_quota import K8SClusterPoolQuota __all__ = ["PoolsResource", "AsyncPoolsResource"] @@ -244,7 +244,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PoolListResponse: + ) -> K8SClusterPoolList: """ List k8s cluster pools @@ -268,7 +268,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PoolListResponse, + cast_to=K8SClusterPoolList, ) def delete( @@ -683,7 +683,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PoolListResponse: + ) -> K8SClusterPoolList: """ List k8s cluster pools @@ -707,7 +707,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PoolListResponse, + cast_to=K8SClusterPoolList, ) async def delete( diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index da703ea5..e1dabed0 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -30,7 +30,7 @@ ClustersResourceWithStreamingResponse, AsyncClustersResourceWithStreamingResponse, ) -from ....types.cloud.k8s_list_versions_response import K8SListVersionsResponse +from ....types.cloud.k8s_cluster_version_list import K8SClusterVersionList __all__ = ["K8SResource", "AsyncK8SResource"] @@ -74,7 +74,7 @@ def list_versions( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SListVersionsResponse: + ) -> K8SClusterVersionList: """ List available k8s cluster versions for creation @@ -96,7 +96,7 @@ def list_versions( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SListVersionsResponse, + cast_to=K8SClusterVersionList, ) @@ -139,7 +139,7 @@ async def list_versions( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SListVersionsResponse: + ) -> K8SClusterVersionList: """ List available k8s cluster versions for creation @@ -161,7 +161,7 @@ async def list_versions( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SListVersionsResponse, + cast_to=K8SClusterVersionList, ) diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index c6c71f5c..df4739a5 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -16,7 +16,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.load_balancers import flavor_list_params -from ....types.cloud.load_balancers.flavor_list_response import FlavorListResponse +from ....types.cloud.load_balancer_flavor_list import LoadBalancerFlavorList __all__ = ["FlavorsResource", "AsyncFlavorsResource"] @@ -53,7 +53,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FlavorListResponse: + ) -> LoadBalancerFlavorList: """Retrieve a list of load balancer flavors. When the `include_prices` query @@ -88,7 +88,7 @@ def list( timeout=timeout, query=maybe_transform({"include_prices": include_prices}, flavor_list_params.FlavorListParams), ), - cast_to=FlavorListResponse, + cast_to=LoadBalancerFlavorList, ) @@ -124,7 +124,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FlavorListResponse: + ) -> LoadBalancerFlavorList: """Retrieve a list of load balancer flavors. When the `include_prices` query @@ -161,7 +161,7 @@ async def list( {"include_prices": include_prices}, flavor_list_params.FlavorListParams ), ), - cast_to=FlavorListResponse, + cast_to=LoadBalancerFlavorList, ) diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index 72ba10be..a66adc6e 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -18,7 +18,7 @@ from ...._base_client import make_request_options from ....types.cloud.load_balancers import metric_list_params from ....types.cloud.instance_metrics_time_unit import InstanceMetricsTimeUnit -from ....types.cloud.load_balancers.metric_list_response import MetricListResponse +from ....types.cloud.load_balancer_metrics_list import LoadBalancerMetricsList __all__ = ["MetricsResource", "AsyncMetricsResource"] @@ -57,7 +57,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> MetricListResponse: + ) -> LoadBalancerMetricsList: """ Get load balancer metrics, including cpu, memory and network @@ -98,7 +98,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=MetricListResponse, + cast_to=LoadBalancerMetricsList, ) @@ -136,7 +136,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> MetricListResponse: + ) -> LoadBalancerMetricsList: """ Get load balancer metrics, including cpu, memory and network @@ -177,7 +177,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=MetricListResponse, + cast_to=LoadBalancerMetricsList, ) diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 1805ddd4..c2711ddd 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -15,7 +15,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.load_balancer_status import LoadBalancerStatus -from ....types.cloud.load_balancers.status_list_response import StatusListResponse +from ....types.cloud.load_balancer_status_list import LoadBalancerStatusList __all__ = ["StatusesResource", "AsyncStatusesResource"] @@ -51,7 +51,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StatusListResponse: + ) -> LoadBalancerStatusList: """ List load balancers statuses @@ -77,7 +77,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StatusListResponse, + cast_to=LoadBalancerStatusList, ) def get( @@ -157,7 +157,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StatusListResponse: + ) -> LoadBalancerStatusList: """ List load balancers statuses @@ -183,7 +183,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=StatusListResponse, + cast_to=LoadBalancerStatusList, ) async def get( diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 4cd753f3..243dd294 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -20,7 +20,7 @@ from ..._base_client import make_request_options from ...types.cloud.task_id_list import TaskIDList from ...types.cloud.placement_group import PlacementGroup -from ...types.cloud.placement_group_list_response import PlacementGroupListResponse +from ...types.cloud.placement_group_list import PlacementGroupList __all__ = ["PlacementGroupsResource", "AsyncPlacementGroupsResource"] @@ -109,7 +109,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PlacementGroupListResponse: + ) -> PlacementGroupList: """ List placement groups @@ -131,7 +131,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PlacementGroupListResponse, + cast_to=PlacementGroupList, ) def delete( @@ -297,7 +297,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PlacementGroupListResponse: + ) -> PlacementGroupList: """ List placement groups @@ -319,7 +319,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PlacementGroupListResponse, + cast_to=PlacementGroupList, ) async def delete( diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py index 3c726b46..fdc29228 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py @@ -14,7 +14,7 @@ async_to_streamed_response_wrapper, ) from ....._base_client import make_request_options -from .....types.cloud.reserved_fixed_ips.vip.candidate_port_list_response import CandidatePortListResponse +from .....types.cloud.reserved_fixed_ips.vip.candidate_port_list import CandidatePortList __all__ = ["CandidatePortsResource", "AsyncCandidatePortsResource"] @@ -51,7 +51,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CandidatePortListResponse: + ) -> CandidatePortList: """ List all instance ports that are available for connecting to a VIP. @@ -75,7 +75,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CandidatePortListResponse, + cast_to=CandidatePortList, ) @@ -111,7 +111,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CandidatePortListResponse: + ) -> CandidatePortList: """ List all instance ports that are available for connecting to a VIP. @@ -135,7 +135,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CandidatePortListResponse, + cast_to=CandidatePortList, ) diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py index a78a8e6c..f98e4b8a 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py @@ -16,9 +16,7 @@ ) from ....._base_client import make_request_options from .....types.cloud.reserved_fixed_ips.vip import connected_port_add_params, connected_port_replace_params -from .....types.cloud.reserved_fixed_ips.vip.connected_port_add_response import ConnectedPortAddResponse -from .....types.cloud.reserved_fixed_ips.vip.connected_port_list_response import ConnectedPortListResponse -from .....types.cloud.reserved_fixed_ips.vip.connected_port_replace_response import ConnectedPortReplaceResponse +from .....types.cloud.reserved_fixed_ips.vip.connected_port_list import ConnectedPortList __all__ = ["ConnectedPortsResource", "AsyncConnectedPortsResource"] @@ -55,7 +53,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortListResponse: + ) -> ConnectedPortList: """ List all instance ports that share a VIP. @@ -79,7 +77,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortListResponse, + cast_to=ConnectedPortList, ) def add( @@ -95,7 +93,7 @@ def add( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortAddResponse: + ) -> ConnectedPortList: """ Add instance ports to share a VIP. @@ -122,7 +120,7 @@ def add( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortAddResponse, + cast_to=ConnectedPortList, ) def replace( @@ -138,7 +136,7 @@ def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortReplaceResponse: + ) -> ConnectedPortList: """ Replace the list of instance ports that share a VIP. @@ -165,7 +163,7 @@ def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortReplaceResponse, + cast_to=ConnectedPortList, ) @@ -201,7 +199,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortListResponse: + ) -> ConnectedPortList: """ List all instance ports that share a VIP. @@ -225,7 +223,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortListResponse, + cast_to=ConnectedPortList, ) async def add( @@ -241,7 +239,7 @@ async def add( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortAddResponse: + ) -> ConnectedPortList: """ Add instance ports to share a VIP. @@ -268,7 +266,7 @@ async def add( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortAddResponse, + cast_to=ConnectedPortList, ) async def replace( @@ -284,7 +282,7 @@ async def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortReplaceResponse: + ) -> ConnectedPortList: """ Replace the list of instance ports that share a VIP. @@ -313,7 +311,7 @@ async def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortReplaceResponse, + cast_to=ConnectedPortList, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 57125bdd..87ed7492 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -79,6 +79,7 @@ from .instance_list_params import InstanceListParams as InstanceListParams from .lb_listener_protocol import LbListenerProtocol as LbListenerProtocol from .load_balancer_status import LoadBalancerStatus as LoadBalancerStatus +from .placement_group_list import PlacementGroupList as PlacementGroupList from .tag_update_map_param import TagUpdateMapParam as TagUpdateMapParam from .volume_create_params import VolumeCreateParams as VolumeCreateParams from .volume_delete_params import VolumeDeleteParams as VolumeDeleteParams @@ -117,18 +118,21 @@ from .file_share_create_params import FileShareCreateParams as FileShareCreateParams from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams from .file_share_update_params import FileShareUpdateParams as FileShareUpdateParams +from .k8s_cluster_version_list import K8SClusterVersionList as K8SClusterVersionList from .load_balancer_get_params import LoadBalancerGetParams as LoadBalancerGetParams from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams from .floating_ip_update_params import FloatingIPUpdateParams as FloatingIPUpdateParams from .inference_region_capacity import InferenceRegionCapacity as InferenceRegionCapacity +from .load_balancer_flavor_list import LoadBalancerFlavorList as LoadBalancerFlavorList from .load_balancer_list_params import LoadBalancerListParams as LoadBalancerListParams +from .load_balancer_status_list import LoadBalancerStatusList as LoadBalancerStatusList from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit -from .k8s_list_versions_response import K8SListVersionsResponse as K8SListVersionsResponse from .load_balancer_l7_rule_list import LoadBalancerL7RuleList as LoadBalancerL7RuleList +from .load_balancer_metrics_list import LoadBalancerMetricsList as LoadBalancerMetricsList from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField @@ -150,7 +154,6 @@ from .load_balancer_failover_params import LoadBalancerFailoverParams as LoadBalancerFailoverParams from .load_balancer_listener_detail import LoadBalancerListenerDetail as LoadBalancerListenerDetail from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams -from .placement_group_list_response import PlacementGroupListResponse as PlacementGroupListResponse from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams from .volume_snapshot_create_params import VolumeSnapshotCreateParams as VolumeSnapshotCreateParams from .volume_snapshot_update_params import VolumeSnapshotUpdateParams as VolumeSnapshotUpdateParams diff --git a/src/gcore/types/cloud/k8s/__init__.py b/src/gcore/types/cloud/k8s/__init__.py index 735764a4..0eed39f3 100644 --- a/src/gcore/types/cloud/k8s/__init__.py +++ b/src/gcore/types/cloud/k8s/__init__.py @@ -3,14 +3,11 @@ from __future__ import annotations from .k8s_cluster import K8SCluster as K8SCluster +from .k8s_cluster_list import K8SClusterList as K8SClusterList from .flavor_list_params import FlavorListParams as FlavorListParams from .cluster_create_params import ClusterCreateParams as ClusterCreateParams from .cluster_delete_params import ClusterDeleteParams as ClusterDeleteParams -from .cluster_list_response import ClusterListResponse as ClusterListResponse from .cluster_update_params import ClusterUpdateParams as ClusterUpdateParams from .cluster_upgrade_params import ClusterUpgradeParams as ClusterUpgradeParams from .k8s_cluster_kubeconfig import K8SClusterKubeconfig as K8SClusterKubeconfig from .k8s_cluster_certificate import K8SClusterCertificate as K8SClusterCertificate -from .cluster_list_versions_for_upgrade_response import ( - ClusterListVersionsForUpgradeResponse as ClusterListVersionsForUpgradeResponse, -) diff --git a/src/gcore/types/cloud/k8s/clusters/__init__.py b/src/gcore/types/cloud/k8s/clusters/__init__.py index b96a1c38..c8c5c859 100644 --- a/src/gcore/types/cloud/k8s/clusters/__init__.py +++ b/src/gcore/types/cloud/k8s/clusters/__init__.py @@ -5,8 +5,8 @@ from .k8s_cluster_pool import K8SClusterPool as K8SClusterPool from .node_list_params import NodeListParams as NodeListParams from .pool_create_params import PoolCreateParams as PoolCreateParams -from .pool_list_response import PoolListResponse as PoolListResponse from .pool_resize_params import PoolResizeParams as PoolResizeParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams +from .k8s_cluster_pool_list import K8SClusterPoolList as K8SClusterPoolList from .k8s_cluster_pool_quota import K8SClusterPoolQuota as K8SClusterPoolQuota from .pool_check_quota_params import PoolCheckQuotaParams as PoolCheckQuotaParams diff --git a/src/gcore/types/cloud/k8s/clusters/pool_list_response.py b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py similarity index 80% rename from src/gcore/types/cloud/k8s/clusters/pool_list_response.py rename to src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py index 25d4e977..23f3943a 100644 --- a/src/gcore/types/cloud/k8s/clusters/pool_list_response.py +++ b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py @@ -5,10 +5,10 @@ from ....._models import BaseModel from .k8s_cluster_pool import K8SClusterPool -__all__ = ["PoolListResponse"] +__all__ = ["K8SClusterPoolList"] -class PoolListResponse(BaseModel): +class K8SClusterPoolList(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/k8s/cluster_list_response.py b/src/gcore/types/cloud/k8s/k8s_cluster_list.py similarity index 79% rename from src/gcore/types/cloud/k8s/cluster_list_response.py rename to src/gcore/types/cloud/k8s/k8s_cluster_list.py index 3e46fa0d..bc252f6b 100644 --- a/src/gcore/types/cloud/k8s/cluster_list_response.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster_list.py @@ -5,10 +5,10 @@ from ...._models import BaseModel from .k8s_cluster import K8SCluster -__all__ = ["ClusterListResponse"] +__all__ = ["K8SClusterList"] -class ClusterListResponse(BaseModel): +class K8SClusterList(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/k8s_list_versions_response.py b/src/gcore/types/cloud/k8s_cluster_version_list.py similarity index 78% rename from src/gcore/types/cloud/k8s_list_versions_response.py rename to src/gcore/types/cloud/k8s_cluster_version_list.py index 74ad65b1..2f66ffb7 100644 --- a/src/gcore/types/cloud/k8s_list_versions_response.py +++ b/src/gcore/types/cloud/k8s_cluster_version_list.py @@ -5,10 +5,10 @@ from ..._models import BaseModel from .k8s_cluster_version import K8SClusterVersion -__all__ = ["K8SListVersionsResponse"] +__all__ = ["K8SClusterVersionList"] -class K8SListVersionsResponse(BaseModel): +class K8SClusterVersionList(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/load_balancers/flavor_list_response.py b/src/gcore/types/cloud/load_balancer_flavor_list.py similarity index 74% rename from src/gcore/types/cloud/load_balancers/flavor_list_response.py rename to src/gcore/types/cloud/load_balancer_flavor_list.py index 202767ec..9a1d170c 100644 --- a/src/gcore/types/cloud/load_balancers/flavor_list_response.py +++ b/src/gcore/types/cloud/load_balancer_flavor_list.py @@ -3,10 +3,10 @@ from typing import List, Union from typing_extensions import TypeAlias -from ...._models import BaseModel -from ..load_balancer_flavor_detail import LoadBalancerFlavorDetail +from ..._models import BaseModel +from .load_balancer_flavor_detail import LoadBalancerFlavorDetail -__all__ = ["FlavorListResponse", "Result", "ResultLbFlavorSerializer"] +__all__ = ["LoadBalancerFlavorList", "Result", "ResultLbFlavorSerializer"] class ResultLbFlavorSerializer(BaseModel): @@ -26,7 +26,7 @@ class ResultLbFlavorSerializer(BaseModel): Result: TypeAlias = Union[ResultLbFlavorSerializer, LoadBalancerFlavorDetail] -class FlavorListResponse(BaseModel): +class LoadBalancerFlavorList(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/load_balancers/metric_list_response.py b/src/gcore/types/cloud/load_balancer_metrics_list.py similarity index 56% rename from src/gcore/types/cloud/load_balancers/metric_list_response.py rename to src/gcore/types/cloud/load_balancer_metrics_list.py index 05b87752..c270faf1 100644 --- a/src/gcore/types/cloud/load_balancers/metric_list_response.py +++ b/src/gcore/types/cloud/load_balancer_metrics_list.py @@ -2,13 +2,13 @@ from typing import List -from ...._models import BaseModel -from ..load_balancer_metrics import LoadBalancerMetrics +from ..._models import BaseModel +from .load_balancer_metrics import LoadBalancerMetrics -__all__ = ["MetricListResponse"] +__all__ = ["LoadBalancerMetricsList"] -class MetricListResponse(BaseModel): +class LoadBalancerMetricsList(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/load_balancers/status_list_response.py b/src/gcore/types/cloud/load_balancer_status_list.py similarity index 56% rename from src/gcore/types/cloud/load_balancers/status_list_response.py rename to src/gcore/types/cloud/load_balancer_status_list.py index 120dd86d..0432a12c 100644 --- a/src/gcore/types/cloud/load_balancers/status_list_response.py +++ b/src/gcore/types/cloud/load_balancer_status_list.py @@ -2,13 +2,13 @@ from typing import List -from ...._models import BaseModel -from ..load_balancer_status import LoadBalancerStatus +from ..._models import BaseModel +from .load_balancer_status import LoadBalancerStatus -__all__ = ["StatusListResponse"] +__all__ = ["LoadBalancerStatusList"] -class StatusListResponse(BaseModel): +class LoadBalancerStatusList(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index 4674ceb5..cfacdce7 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -8,10 +8,7 @@ from .pool_create_params import PoolCreateParams as PoolCreateParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .listener_get_params import ListenerGetParams as ListenerGetParams -from .flavor_list_response import FlavorListResponse as FlavorListResponse from .listener_list_params import ListenerListParams as ListenerListParams -from .metric_list_response import MetricListResponse as MetricListResponse -from .status_list_response import StatusListResponse as StatusListResponse from .listener_create_params import ListenerCreateParams as ListenerCreateParams from .listener_delete_params import ListenerDeleteParams as ListenerDeleteParams from .listener_update_params import ListenerUpdateParams as ListenerUpdateParams diff --git a/src/gcore/types/cloud/networks/__init__.py b/src/gcore/types/cloud/networks/__init__.py index 84c111f1..be19f7cf 100644 --- a/src/gcore/types/cloud/networks/__init__.py +++ b/src/gcore/types/cloud/networks/__init__.py @@ -3,6 +3,7 @@ from __future__ import annotations from .router import Router as Router +from .router_list import RouterList as RouterList from .router_list_params import RouterListParams as RouterListParams from .subnet_list_params import SubnetListParams as SubnetListParams from .router_create_params import RouterCreateParams as RouterCreateParams diff --git a/src/gcore/types/cloud/k8s/cluster_list_versions_for_upgrade_response.py b/src/gcore/types/cloud/networks/router_list.py similarity index 51% rename from src/gcore/types/cloud/k8s/cluster_list_versions_for_upgrade_response.py rename to src/gcore/types/cloud/networks/router_list.py index 7eae6ea0..23a83fc8 100644 --- a/src/gcore/types/cloud/k8s/cluster_list_versions_for_upgrade_response.py +++ b/src/gcore/types/cloud/networks/router_list.py @@ -2,15 +2,15 @@ from typing import List +from .router import Router from ...._models import BaseModel -from ..k8s_cluster_version import K8SClusterVersion -__all__ = ["ClusterListVersionsForUpgradeResponse"] +__all__ = ["RouterList"] -class ClusterListVersionsForUpgradeResponse(BaseModel): +class RouterList(BaseModel): count: int """Number of objects""" - results: List[K8SClusterVersion] + results: List[Router] """Objects""" diff --git a/src/gcore/types/cloud/placement_group_list_response.py b/src/gcore/types/cloud/placement_group_list.py similarity index 77% rename from src/gcore/types/cloud/placement_group_list_response.py rename to src/gcore/types/cloud/placement_group_list.py index 708a9720..92fbc1f9 100644 --- a/src/gcore/types/cloud/placement_group_list_response.py +++ b/src/gcore/types/cloud/placement_group_list.py @@ -5,10 +5,10 @@ from ..._models import BaseModel from .placement_group import PlacementGroup -__all__ = ["PlacementGroupListResponse"] +__all__ = ["PlacementGroupList"] -class PlacementGroupListResponse(BaseModel): +class PlacementGroupList(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py index 58c39149..0dd4eb7e 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py @@ -4,9 +4,7 @@ from .candidate_port import CandidatePort as CandidatePort from .connected_port import ConnectedPort as ConnectedPort +from .candidate_port_list import CandidatePortList as CandidatePortList +from .connected_port_list import ConnectedPortList as ConnectedPortList from .connected_port_add_params import ConnectedPortAddParams as ConnectedPortAddParams -from .connected_port_add_response import ConnectedPortAddResponse as ConnectedPortAddResponse -from .candidate_port_list_response import CandidatePortListResponse as CandidatePortListResponse -from .connected_port_list_response import ConnectedPortListResponse as ConnectedPortListResponse from .connected_port_replace_params import ConnectedPortReplaceParams as ConnectedPortReplaceParams -from .connected_port_replace_response import ConnectedPortReplaceResponse as ConnectedPortReplaceResponse diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list_response.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list.py similarity index 77% rename from src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list_response.py rename to src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list.py index cffbde8a..3c68db42 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list_response.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list.py @@ -5,10 +5,10 @@ from ....._models import BaseModel from .candidate_port import CandidatePort -__all__ = ["CandidatePortListResponse"] +__all__ = ["CandidatePortList"] -class CandidatePortListResponse(BaseModel): +class CandidatePortList(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_add_response.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list.py similarity index 77% rename from src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_add_response.py rename to src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list.py index 85c0ba11..6a0a2251 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_add_response.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list.py @@ -5,10 +5,10 @@ from ....._models import BaseModel from .connected_port import ConnectedPort -__all__ = ["ConnectedPortAddResponse"] +__all__ = ["ConnectedPortList"] -class ConnectedPortAddResponse(BaseModel): +class ConnectedPortList(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list_response.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list_response.py deleted file mode 100644 index 1bfa1883..00000000 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list_response.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ....._models import BaseModel -from .connected_port import ConnectedPort - -__all__ = ["ConnectedPortListResponse"] - - -class ConnectedPortListResponse(BaseModel): - count: int - """Number of objects""" - - results: List[ConnectedPort] - """Objects""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_response.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_response.py deleted file mode 100644 index ad469857..00000000 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_response.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ....._models import BaseModel -from .connected_port import ConnectedPort - -__all__ = ["ConnectedPortReplaceResponse"] - - -class ConnectedPortReplaceResponse(BaseModel): - count: int - """Number of objects""" - - results: List[ConnectedPort] - """Objects""" diff --git a/tests/api_resources/cloud/k8s/clusters/test_pools.py b/tests/api_resources/cloud/k8s/clusters/test_pools.py index f97df4e7..bc2d028a 100644 --- a/tests/api_resources/cloud/k8s/clusters/test_pools.py +++ b/tests/api_resources/cloud/k8s/clusters/test_pools.py @@ -12,7 +12,7 @@ from gcore.types.cloud import TaskIDList from gcore.types.cloud.k8s.clusters import ( K8SClusterPool, - PoolListResponse, + K8SClusterPoolList, K8SClusterPoolQuota, ) @@ -183,7 +183,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(K8SClusterPoolList, pool, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -196,7 +196,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(K8SClusterPoolList, pool, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -209,7 +209,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(K8SClusterPoolList, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -620,7 +620,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(K8SClusterPoolList, pool, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -633,7 +633,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(K8SClusterPoolList, pool, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -646,7 +646,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(PoolListResponse, pool, path=["response"]) + assert_matches_type(K8SClusterPoolList, pool, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/k8s/test_clusters.py b/tests/api_resources/cloud/k8s/test_clusters.py index 4ab9f3a4..d9296b23 100644 --- a/tests/api_resources/cloud/k8s/test_clusters.py +++ b/tests/api_resources/cloud/k8s/test_clusters.py @@ -9,13 +9,12 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList +from gcore.types.cloud import TaskIDList, K8SClusterVersionList from gcore.types.cloud.k8s import ( K8SCluster, - ClusterListResponse, + K8SClusterList, K8SClusterKubeconfig, K8SClusterCertificate, - ClusterListVersionsForUpgradeResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -291,7 +290,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ClusterListResponse, cluster, path=["response"]) + assert_matches_type(K8SClusterList, cluster, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -303,7 +302,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(ClusterListResponse, cluster, path=["response"]) + assert_matches_type(K8SClusterList, cluster, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -315,7 +314,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(ClusterListResponse, cluster, path=["response"]) + assert_matches_type(K8SClusterList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -520,7 +519,7 @@ def test_method_list_versions_for_upgrade(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) + assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) @parametrize def test_raw_response_list_versions_for_upgrade(self, client: Gcore) -> None: @@ -533,7 +532,7 @@ def test_raw_response_list_versions_for_upgrade(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) + assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) @parametrize def test_streaming_response_list_versions_for_upgrade(self, client: Gcore) -> None: @@ -546,7 +545,7 @@ def test_streaming_response_list_versions_for_upgrade(self, client: Gcore) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) + assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -882,7 +881,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ClusterListResponse, cluster, path=["response"]) + assert_matches_type(K8SClusterList, cluster, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -894,7 +893,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(ClusterListResponse, cluster, path=["response"]) + assert_matches_type(K8SClusterList, cluster, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -906,7 +905,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(ClusterListResponse, cluster, path=["response"]) + assert_matches_type(K8SClusterList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1111,7 +1110,7 @@ async def test_method_list_versions_for_upgrade(self, async_client: AsyncGcore) project_id=0, region_id=0, ) - assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) + assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) @parametrize async def test_raw_response_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: @@ -1124,7 +1123,7 @@ async def test_raw_response_list_versions_for_upgrade(self, async_client: AsyncG assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) + assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) @parametrize async def test_streaming_response_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: @@ -1137,7 +1136,7 @@ async def test_streaming_response_list_versions_for_upgrade(self, async_client: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) + assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_flavors.py b/tests/api_resources/cloud/load_balancers/test_flavors.py index 25029744..49f14df1 100644 --- a/tests/api_resources/cloud/load_balancers/test_flavors.py +++ b/tests/api_resources/cloud/load_balancers/test_flavors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.load_balancers import FlavorListResponse +from gcore.types.cloud import LoadBalancerFlavorList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=1, region_id=7, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -32,7 +32,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: region_id=7, include_prices=True, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -44,7 +44,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -56,7 +56,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +72,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=1, region_id=7, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -81,7 +81,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No region_id=7, include_prices=True, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -93,7 +93,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -105,6 +105,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_metrics.py b/tests/api_resources/cloud/load_balancers/test_metrics.py index ec17405c..3ab21ffd 100644 --- a/tests/api_resources/cloud/load_balancers/test_metrics.py +++ b/tests/api_resources/cloud/load_balancers/test_metrics.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.load_balancers import MetricListResponse +from gcore.types.cloud import LoadBalancerMetricsList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +26,7 @@ def test_method_list(self, client: Gcore) -> None: time_interval=6, time_unit="day", ) - assert_matches_type(MetricListResponse, metric, path=["response"]) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -41,7 +41,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = response.parse() - assert_matches_type(MetricListResponse, metric, path=["response"]) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -56,7 +56,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = response.parse() - assert_matches_type(MetricListResponse, metric, path=["response"]) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) assert cast(Any, response.is_closed) is True @@ -86,7 +86,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: time_interval=6, time_unit="day", ) - assert_matches_type(MetricListResponse, metric, path=["response"]) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -101,7 +101,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = await response.parse() - assert_matches_type(MetricListResponse, metric, path=["response"]) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -116,7 +116,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = await response.parse() - assert_matches_type(MetricListResponse, metric, path=["response"]) + assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_statuses.py b/tests/api_resources/cloud/load_balancers/test_statuses.py index 8e5d2536..9de4628c 100644 --- a/tests/api_resources/cloud/load_balancers/test_statuses.py +++ b/tests/api_resources/cloud/load_balancers/test_statuses.py @@ -9,8 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerStatus -from gcore.types.cloud.load_balancers import StatusListResponse +from gcore.types.cloud import LoadBalancerStatus, LoadBalancerStatusList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +23,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=1, region_id=7, ) - assert_matches_type(StatusListResponse, status, path=["response"]) + assert_matches_type(LoadBalancerStatusList, status, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -36,7 +35,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = response.parse() - assert_matches_type(StatusListResponse, status, path=["response"]) + assert_matches_type(LoadBalancerStatusList, status, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -48,7 +47,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = response.parse() - assert_matches_type(StatusListResponse, status, path=["response"]) + assert_matches_type(LoadBalancerStatusList, status, path=["response"]) assert cast(Any, response.is_closed) is True @@ -110,7 +109,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=1, region_id=7, ) - assert_matches_type(StatusListResponse, status, path=["response"]) + assert_matches_type(LoadBalancerStatusList, status, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -122,7 +121,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = await response.parse() - assert_matches_type(StatusListResponse, status, path=["response"]) + assert_matches_type(LoadBalancerStatusList, status, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -134,7 +133,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = await response.parse() - assert_matches_type(StatusListResponse, status, path=["response"]) + assert_matches_type(LoadBalancerStatusList, status, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py index 7b18df0d..cc679c0e 100644 --- a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py +++ b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePortListResponse +from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePortList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) + assert_matches_type(CandidatePortList, candidate_port, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -37,7 +37,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" candidate_port = response.parse() - assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) + assert_matches_type(CandidatePortList, candidate_port, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -50,7 +50,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" candidate_port = response.parse() - assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) + assert_matches_type(CandidatePortList, candidate_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -76,7 +76,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) + assert_matches_type(CandidatePortList, candidate_port, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -89,7 +89,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" candidate_port = await response.parse() - assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) + assert_matches_type(CandidatePortList, candidate_port, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -102,7 +102,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" candidate_port = await response.parse() - assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) + assert_matches_type(CandidatePortList, candidate_port, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py index 8fb5bc82..7c47c319 100644 --- a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py +++ b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py @@ -10,9 +10,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.cloud.reserved_fixed_ips.vip import ( - ConnectedPortAddResponse, - ConnectedPortListResponse, - ConnectedPortReplaceResponse, + ConnectedPortList, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +26,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -41,7 +39,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -54,7 +52,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -74,7 +72,7 @@ def test_method_add(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize def test_method_add_with_all_params(self, client: Gcore) -> None: @@ -84,7 +82,7 @@ def test_method_add_with_all_params(self, client: Gcore) -> None: region_id=0, port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], ) - assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize def test_raw_response_add(self, client: Gcore) -> None: @@ -97,7 +95,7 @@ def test_raw_response_add(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize def test_streaming_response_add(self, client: Gcore) -> None: @@ -110,7 +108,7 @@ def test_streaming_response_add(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -130,7 +128,7 @@ def test_method_replace(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: @@ -140,7 +138,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: region_id=0, port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], ) - assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize def test_raw_response_replace(self, client: Gcore) -> None: @@ -153,7 +151,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: @@ -166,7 +164,7 @@ def test_streaming_response_replace(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -192,7 +190,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -205,7 +203,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -218,7 +216,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -238,7 +236,7 @@ async def test_method_add(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> None: @@ -248,7 +246,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> Non region_id=0, port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], ) - assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize async def test_raw_response_add(self, async_client: AsyncGcore) -> None: @@ -261,7 +259,7 @@ async def test_raw_response_add(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize async def test_streaming_response_add(self, async_client: AsyncGcore) -> None: @@ -274,7 +272,7 @@ async def test_streaming_response_add(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -294,7 +292,7 @@ async def test_method_replace(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: @@ -304,7 +302,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> region_id=0, port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], ) - assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @@ -317,7 +315,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: @@ -330,7 +328,7 @@ async def test_streaming_response_replace(self, async_client: AsyncGcore) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) + assert_matches_type(ConnectedPortList, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_k8s.py b/tests/api_resources/cloud/test_k8s.py index 7500f600..98602a71 100644 --- a/tests/api_resources/cloud/test_k8s.py +++ b/tests/api_resources/cloud/test_k8s.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import K8SListVersionsResponse +from gcore.types.cloud import K8SClusterVersionList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list_versions(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) + assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) @parametrize def test_raw_response_list_versions(self, client: Gcore) -> None: @@ -35,7 +35,7 @@ def test_raw_response_list_versions(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" k8s = response.parse() - assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) + assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) @parametrize def test_streaming_response_list_versions(self, client: Gcore) -> None: @@ -47,7 +47,7 @@ def test_streaming_response_list_versions(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" k8s = response.parse() - assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) + assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) assert cast(Any, response.is_closed) is True @@ -63,7 +63,7 @@ async def test_method_list_versions(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) + assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) @parametrize async def test_raw_response_list_versions(self, async_client: AsyncGcore) -> None: @@ -75,7 +75,7 @@ async def test_raw_response_list_versions(self, async_client: AsyncGcore) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" k8s = await response.parse() - assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) + assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) @parametrize async def test_streaming_response_list_versions(self, async_client: AsyncGcore) -> None: @@ -87,6 +87,6 @@ async def test_streaming_response_list_versions(self, async_client: AsyncGcore) assert response.http_request.headers.get("X-Stainless-Lang") == "python" k8s = await response.parse() - assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) + assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_placement_groups.py b/tests/api_resources/cloud/test_placement_groups.py index 7c8276c3..84783508 100644 --- a/tests/api_resources/cloud/test_placement_groups.py +++ b/tests/api_resources/cloud/test_placement_groups.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, PlacementGroup, PlacementGroupListResponse +from gcore.types.cloud import TaskIDList, PlacementGroup, PlacementGroupList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -63,7 +63,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) + assert_matches_type(PlacementGroupList, placement_group, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -75,7 +75,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" placement_group = response.parse() - assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) + assert_matches_type(PlacementGroupList, placement_group, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -87,7 +87,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" placement_group = response.parse() - assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) + assert_matches_type(PlacementGroupList, placement_group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -235,7 +235,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) + assert_matches_type(PlacementGroupList, placement_group, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -247,7 +247,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" placement_group = await response.parse() - assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) + assert_matches_type(PlacementGroupList, placement_group, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -259,7 +259,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" placement_group = await response.parse() - assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) + assert_matches_type(PlacementGroupList, placement_group, path=["response"]) assert cast(Any, response.is_closed) is True From 1f9cc3a03bc7f21659e2129c64ad131e6078840f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 Jan 2026 12:16:48 +0000 Subject: [PATCH 517/592] feat(api): aggregated API specs update --- .stats.yml | 4 +-- .../cloud/load_balancers/listeners.py | 24 +++++++++++------ .../cloud/load_balancers/pools/pools.py | 12 ++++++--- src/gcore/types/cloud/__init__.py | 1 - .../cloud/flavor_hardware_description.py | 27 ------------------- .../cloud/load_balancer_create_params.py | 15 ++++++++--- .../cloud/load_balancer_flavor_detail.py | 12 +++------ .../load_balancers/listener_create_params.py | 10 +++++-- .../load_balancers/listener_update_params.py | 10 +++++-- .../load_balancers/pool_create_params.py | 5 +++- .../load_balancers/pool_update_params.py | 5 +++- 11 files changed, 65 insertions(+), 60 deletions(-) delete mode 100644 src/gcore/types/cloud/flavor_hardware_description.py diff --git a/.stats.yml b/.stats.yml index d8f50384..addf08d4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-6c0a6b2ebeb53f375b862c8cb43c0a1a2b6b63148df5e3d846da34baf63548f4.yml -openapi_spec_hash: 9a8fc579465b9222bd17c6e039e2ff5b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-db344a3a0f8f27b2c61954832c7eb9154a9c6bddfe6069650669e9f10c5376e1.yml +openapi_spec_hash: 2df030112c2f4014d375a6b737bfe62b config_hash: 7085751e6bd8f3fd13cfebe04bb99fed diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 5f82baad..0b620952 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -113,9 +113,11 @@ def create( timeout_client_data: Frontend client inactivity timeout in milliseconds - timeout_member_connect: Backend member connection timeout in milliseconds + timeout_member_connect: Backend member connection timeout in milliseconds. We are recommending to use + `pool.timeout_member_connect` instead. - timeout_member_data: Backend member inactivity timeout in milliseconds + timeout_member_data: Backend member inactivity timeout in milliseconds. We are recommending to use + `pool.timeout_member_data` instead. user_list: Load balancer listener list of username and encrypted password items @@ -205,9 +207,11 @@ def update( timeout_client_data: Frontend client inactivity timeout in milliseconds - timeout_member_connect: Backend member connection timeout in milliseconds + timeout_member_connect: Backend member connection timeout in milliseconds. We are recommending to use + `pool.timeout_member_connect` instead. - timeout_member_data: Backend member inactivity timeout in milliseconds + timeout_member_data: Backend member inactivity timeout in milliseconds. We are recommending to use + `pool.timeout_member_data` instead. user_list: Load balancer listener users list @@ -490,9 +494,11 @@ async def create( timeout_client_data: Frontend client inactivity timeout in milliseconds - timeout_member_connect: Backend member connection timeout in milliseconds + timeout_member_connect: Backend member connection timeout in milliseconds. We are recommending to use + `pool.timeout_member_connect` instead. - timeout_member_data: Backend member inactivity timeout in milliseconds + timeout_member_data: Backend member inactivity timeout in milliseconds. We are recommending to use + `pool.timeout_member_data` instead. user_list: Load balancer listener list of username and encrypted password items @@ -582,9 +588,11 @@ async def update( timeout_client_data: Frontend client inactivity timeout in milliseconds - timeout_member_connect: Backend member connection timeout in milliseconds + timeout_member_connect: Backend member connection timeout in milliseconds. We are recommending to use + `pool.timeout_member_connect` instead. - timeout_member_data: Backend member inactivity timeout in milliseconds + timeout_member_data: Backend member inactivity timeout in milliseconds. We are recommending to use + `pool.timeout_member_data` instead. user_list: Load balancer listener users list diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 80d91bf7..a20382b8 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -128,7 +128,8 @@ def create( session_persistence: Session persistence details - timeout_client_data: Frontend client inactivity timeout in milliseconds + timeout_client_data: Frontend client inactivity timeout in milliseconds. We are recommending to use + `listener.timeout_client_data` instead. timeout_member_connect: Backend member connection timeout in milliseconds @@ -244,7 +245,8 @@ def update( session_persistence: New session persistence settings - timeout_client_data: Frontend client inactivity timeout in milliseconds + timeout_client_data: Frontend client inactivity timeout in milliseconds. We are recommending to use + `listener.timeout_client_data` instead. timeout_member_connect: Backend member connection timeout in milliseconds @@ -524,7 +526,8 @@ async def create( session_persistence: Session persistence details - timeout_client_data: Frontend client inactivity timeout in milliseconds + timeout_client_data: Frontend client inactivity timeout in milliseconds. We are recommending to use + `listener.timeout_client_data` instead. timeout_member_connect: Backend member connection timeout in milliseconds @@ -640,7 +643,8 @@ async def update( session_persistence: New session persistence settings - timeout_client_data: Frontend client inactivity timeout in milliseconds + timeout_client_data: Frontend client inactivity timeout in milliseconds. We are recommending to use + `listener.timeout_client_data` instead. timeout_member_connect: Backend member connection timeout in milliseconds diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 87ed7492..450b32e1 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -136,7 +136,6 @@ from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField -from .flavor_hardware_description import FlavorHardwareDescription as FlavorHardwareDescription from .instance_get_console_params import InstanceGetConsoleParams as InstanceGetConsoleParams from .laas_index_retention_policy import LaasIndexRetentionPolicy as LaasIndexRetentionPolicy from .lb_session_persistence_type import LbSessionPersistenceType as LbSessionPersistenceType diff --git a/src/gcore/types/cloud/flavor_hardware_description.py b/src/gcore/types/cloud/flavor_hardware_description.py deleted file mode 100644 index c03f2150..00000000 --- a/src/gcore/types/cloud/flavor_hardware_description.py +++ /dev/null @@ -1,27 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["FlavorHardwareDescription"] - - -class FlavorHardwareDescription(BaseModel): - cpu: Optional[str] = None - """Human-readable CPU description""" - - disk: Optional[str] = None - """Human-readable disk description""" - - ephemeral: Optional[str] = None - """Human-readable ephemeral disk description""" - - gpu: Optional[str] = None - """Human-readable GPU description""" - - network: Optional[str] = None - """Human-readable NIC description""" - - ram: Optional[str] = None - """Human-readable RAM description""" diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index e52fd1c4..49939fac 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -290,7 +290,10 @@ class ListenerPool(TypedDict, total=False): """Session persistence details""" timeout_client_data: Optional[int] - """Frontend client inactivity timeout in milliseconds""" + """Frontend client inactivity timeout in milliseconds. + + We are recommending to use `listener.timeout_client_data` instead. + """ timeout_member_connect: Optional[int] """Backend member connection timeout in milliseconds""" @@ -351,10 +354,16 @@ class Listener(TypedDict, total=False): """Frontend client inactivity timeout in milliseconds""" timeout_member_connect: Optional[int] - """Backend member connection timeout in milliseconds""" + """Backend member connection timeout in milliseconds. + + We are recommending to use `pool.timeout_member_connect` instead. + """ timeout_member_data: Optional[int] - """Backend member inactivity timeout in milliseconds""" + """Backend member inactivity timeout in milliseconds. + + We are recommending to use `pool.timeout_member_data` instead. + """ user_list: Iterable[ListenerUserList] """Load balancer listener list of username and encrypted password items""" diff --git a/src/gcore/types/cloud/load_balancer_flavor_detail.py b/src/gcore/types/cloud/load_balancer_flavor_detail.py index 6088eff6..f4040178 100644 --- a/src/gcore/types/cloud/load_balancer_flavor_detail.py +++ b/src/gcore/types/cloud/load_balancer_flavor_detail.py @@ -1,14 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Union, Optional -from typing_extensions import Literal, TypeAlias +from typing import Optional +from typing_extensions import Literal from ..._models import BaseModel -from .flavor_hardware_description import FlavorHardwareDescription -__all__ = ["LoadBalancerFlavorDetail", "HardwareDescription"] - -HardwareDescription: TypeAlias = Union[FlavorHardwareDescription, Dict[str, object]] +__all__ = ["LoadBalancerFlavorDetail"] class LoadBalancerFlavorDetail(BaseModel): @@ -18,9 +15,6 @@ class LoadBalancerFlavorDetail(BaseModel): flavor_name: str """Flavor name""" - hardware_description: HardwareDescription - """Additional hardware description.""" - ram: int """RAM size in MiB""" diff --git a/src/gcore/types/cloud/load_balancers/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py index 8dc00324..c688d661 100644 --- a/src/gcore/types/cloud/load_balancers/listener_create_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -64,10 +64,16 @@ class ListenerCreateParams(TypedDict, total=False): """Frontend client inactivity timeout in milliseconds""" timeout_member_connect: Optional[int] - """Backend member connection timeout in milliseconds""" + """Backend member connection timeout in milliseconds. + + We are recommending to use `pool.timeout_member_connect` instead. + """ timeout_member_data: Optional[int] - """Backend member inactivity timeout in milliseconds""" + """Backend member inactivity timeout in milliseconds. + + We are recommending to use `pool.timeout_member_data` instead. + """ user_list: Iterable[UserList] """Load balancer listener list of username and encrypted password items""" diff --git a/src/gcore/types/cloud/load_balancers/listener_update_params.py b/src/gcore/types/cloud/load_balancers/listener_update_params.py index 42fa7e38..002bb912 100644 --- a/src/gcore/types/cloud/load_balancers/listener_update_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_update_params.py @@ -45,10 +45,16 @@ class ListenerUpdateParams(TypedDict, total=False): """Frontend client inactivity timeout in milliseconds""" timeout_member_connect: Optional[int] - """Backend member connection timeout in milliseconds""" + """Backend member connection timeout in milliseconds. + + We are recommending to use `pool.timeout_member_connect` instead. + """ timeout_member_data: Optional[int] - """Backend member inactivity timeout in milliseconds""" + """Backend member inactivity timeout in milliseconds. + + We are recommending to use `pool.timeout_member_data` instead. + """ user_list: Optional[Iterable[UserList]] """Load balancer listener users list""" 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 079e78ed..81987648 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -55,7 +55,10 @@ class PoolCreateParams(TypedDict, total=False): """Session persistence details""" timeout_client_data: Optional[int] - """Frontend client inactivity timeout in milliseconds""" + """Frontend client inactivity timeout in milliseconds. + + We are recommending to use `listener.timeout_client_data` instead. + """ timeout_member_connect: Optional[int] """Backend member connection timeout in milliseconds""" 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 381e4247..b5a32f86 100644 --- a/src/gcore/types/cloud/load_balancers/pool_update_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_update_params.py @@ -53,7 +53,10 @@ class PoolUpdateParams(TypedDict, total=False): """New session persistence settings""" timeout_client_data: Optional[int] - """Frontend client inactivity timeout in milliseconds""" + """Frontend client inactivity timeout in milliseconds. + + We are recommending to use `listener.timeout_client_data` instead. + """ timeout_member_connect: Optional[int] """Backend member connection timeout in milliseconds""" From fcf5a83072ea5f7de0ba2be2998ee193c09ea807 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 10:58:22 +0000 Subject: [PATCH 518/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index addf08d4..3326a8b3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-db344a3a0f8f27b2c61954832c7eb9154a9c6bddfe6069650669e9f10c5376e1.yml -openapi_spec_hash: 2df030112c2f4014d375a6b737bfe62b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-bec46ce28212cf90388fa9ba8094b471b922ae78b92e0f5fa80c083cd3017319.yml +openapi_spec_hash: bc1b58805168a142ca35aa5dfab5a03f config_hash: 7085751e6bd8f3fd13cfebe04bb99fed From 6255e86d39b27008bb420aa7e0df7df41514e391 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 18:33:02 +0000 Subject: [PATCH 519/592] chore(internal): update `actions/checkout` version --- .github/workflows/ci.yml | 6 +++--- .github/workflows/detect-breaking-changes.yml | 2 +- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd5753ba..21d8baf0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | @@ -44,7 +44,7 @@ jobs: id-token: write runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | @@ -81,7 +81,7 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/gcore-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | diff --git a/.github/workflows/detect-breaking-changes.yml b/.github/workflows/detect-breaking-changes.yml index 4640f451..ffca94cc 100644 --- a/.github/workflows/detect-breaking-changes.yml +++ b/.github/workflows/detect-breaking-changes.yml @@ -15,7 +15,7 @@ jobs: run: | echo "FETCH_DEPTH=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_ENV - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: # Ensure we can check out the pull request base in the script below. fetch-depth: ${{ env.FETCH_DEPTH }} diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 8c7b0787..3cebca63 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index a7b36139..927bb62a 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -12,7 +12,7 @@ jobs: if: github.repository == 'G-Core/gcore-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Check release environment run: | From 825882d07acc7b3a743629031d219ac26fdd91e3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 10:13:57 +0000 Subject: [PATCH 520/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3326a8b3..398bc962 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-bec46ce28212cf90388fa9ba8094b471b922ae78b92e0f5fa80c083cd3017319.yml -openapi_spec_hash: bc1b58805168a142ca35aa5dfab5a03f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ed59524e5c2a97fe0b95153f4b553c8f6bd4e9a91569d9832f22053b6b5901a0.yml +openapi_spec_hash: e0c7e1da7f0596e9ab8bac7c3447bc62 config_hash: 7085751e6bd8f3fd13cfebe04bb99fed From 0c567da169f786ceade3fd4df61a8161f1e788fd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 12:17:49 +0000 Subject: [PATCH 521/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/cloud/floating_ips.py | 121 ++++-- src/gcore/resources/cloud/networks/routers.py | 12 +- src/gcore/resources/cloud/tasks.py | 22 +- .../types/cloud/floating_ip_assign_params.py | 2 + src/gcore/types/cloud/task_list_params.py | 11 +- .../api_resources/cloud/test_floating_ips.py | 408 ++++++++++-------- 7 files changed, 347 insertions(+), 233 deletions(-) diff --git a/.stats.yml b/.stats.yml index 398bc962..70d5bc3d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ed59524e5c2a97fe0b95153f4b553c8f6bd4e9a91569d9832f22053b6b5901a0.yml -openapi_spec_hash: e0c7e1da7f0596e9ab8bac7c3447bc62 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3fc43b72b82321f8d4ceea9ea44d7ab14e75872dbe66e3e698e1f59ba300ec55.yml +openapi_spec_hash: 1b1043a0ef7bcf106abf14f9187f5755 config_hash: 7085751e6bd8f3fd13cfebe04bb99fed diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index bfccd253..96d3703f 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Dict, Optional import httpx @@ -123,6 +124,7 @@ def create( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") def update( self, floating_ip_id: str, @@ -138,7 +140,8 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ - Update floating IP + **Deprecated**: Use PATCH + /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead Args: project_id: Project ID @@ -313,6 +316,7 @@ def delete( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") def assign( self, floating_ip_id: str, @@ -331,7 +335,16 @@ def assign( """ Assign floating IP to instance or loadbalancer + **Deprecated**: Use PATCH + /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead + Args: + project_id: Project ID + + region_id: Region ID + + floating_ip_id: Floating IP ID + port_id: Port ID fixed_ip_address: Fixed IP address @@ -410,6 +423,7 @@ def get( cast_to=FloatingIP, ) + @typing_extensions.deprecated("deprecated") def unassign( self, floating_ip_id: str, @@ -424,9 +438,16 @@ def unassign( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ - Unassign floating IP + **Deprecated**: Use PATCH + /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead Args: + project_id: Project ID + + region_id: Region ID + + floating_ip_id: Floating IP ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -539,6 +560,7 @@ async def create( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") async def update( self, floating_ip_id: str, @@ -554,7 +576,8 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ - Update floating IP + **Deprecated**: Use PATCH + /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead Args: project_id: Project ID @@ -729,6 +752,7 @@ async def delete( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") async def assign( self, floating_ip_id: str, @@ -747,7 +771,16 @@ async def assign( """ Assign floating IP to instance or loadbalancer + **Deprecated**: Use PATCH + /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead + Args: + project_id: Project ID + + region_id: Region ID + + floating_ip_id: Floating IP ID + port_id: Port ID fixed_ip_address: Fixed IP address @@ -826,6 +859,7 @@ async def get( cast_to=FloatingIP, ) + @typing_extensions.deprecated("deprecated") async def unassign( self, floating_ip_id: str, @@ -840,9 +874,16 @@ async def unassign( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ - Unassign floating IP + **Deprecated**: Use PATCH + /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead Args: + project_id: Project ID + + region_id: Region ID + + floating_ip_id: Floating IP ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -873,8 +914,10 @@ def __init__(self, floating_ips: FloatingIPsResource) -> None: self.create = to_raw_response_wrapper( floating_ips.create, ) - self.update = to_raw_response_wrapper( - floating_ips.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + floating_ips.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_raw_response_wrapper( floating_ips.list, @@ -882,14 +925,18 @@ def __init__(self, floating_ips: FloatingIPsResource) -> None: self.delete = to_raw_response_wrapper( floating_ips.delete, ) - self.assign = to_raw_response_wrapper( - floating_ips.assign, + self.assign = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + floating_ips.assign, # pyright: ignore[reportDeprecated], + ) ) self.get = to_raw_response_wrapper( floating_ips.get, ) - self.unassign = to_raw_response_wrapper( - floating_ips.unassign, + self.unassign = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + floating_ips.unassign, # pyright: ignore[reportDeprecated], + ) ) @@ -900,8 +947,10 @@ def __init__(self, floating_ips: AsyncFloatingIPsResource) -> None: self.create = async_to_raw_response_wrapper( floating_ips.create, ) - self.update = async_to_raw_response_wrapper( - floating_ips.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + floating_ips.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_raw_response_wrapper( floating_ips.list, @@ -909,14 +958,18 @@ def __init__(self, floating_ips: AsyncFloatingIPsResource) -> None: self.delete = async_to_raw_response_wrapper( floating_ips.delete, ) - self.assign = async_to_raw_response_wrapper( - floating_ips.assign, + self.assign = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + floating_ips.assign, # pyright: ignore[reportDeprecated], + ) ) self.get = async_to_raw_response_wrapper( floating_ips.get, ) - self.unassign = async_to_raw_response_wrapper( - floating_ips.unassign, + self.unassign = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + floating_ips.unassign, # pyright: ignore[reportDeprecated], + ) ) @@ -927,8 +980,10 @@ def __init__(self, floating_ips: FloatingIPsResource) -> None: self.create = to_streamed_response_wrapper( floating_ips.create, ) - self.update = to_streamed_response_wrapper( - floating_ips.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + floating_ips.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_streamed_response_wrapper( floating_ips.list, @@ -936,14 +991,18 @@ def __init__(self, floating_ips: FloatingIPsResource) -> None: self.delete = to_streamed_response_wrapper( floating_ips.delete, ) - self.assign = to_streamed_response_wrapper( - floating_ips.assign, + self.assign = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + floating_ips.assign, # pyright: ignore[reportDeprecated], + ) ) self.get = to_streamed_response_wrapper( floating_ips.get, ) - self.unassign = to_streamed_response_wrapper( - floating_ips.unassign, + self.unassign = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + floating_ips.unassign, # pyright: ignore[reportDeprecated], + ) ) @@ -954,8 +1013,10 @@ def __init__(self, floating_ips: AsyncFloatingIPsResource) -> None: self.create = async_to_streamed_response_wrapper( floating_ips.create, ) - self.update = async_to_streamed_response_wrapper( - floating_ips.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + floating_ips.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_streamed_response_wrapper( floating_ips.list, @@ -963,12 +1024,16 @@ def __init__(self, floating_ips: AsyncFloatingIPsResource) -> None: self.delete = async_to_streamed_response_wrapper( floating_ips.delete, ) - self.assign = async_to_streamed_response_wrapper( - floating_ips.assign, + self.assign = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + floating_ips.assign, # pyright: ignore[reportDeprecated], + ) ) self.get = async_to_streamed_response_wrapper( floating_ips.get, ) - self.unassign = async_to_streamed_response_wrapper( - floating_ips.unassign, + self.unassign = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + floating_ips.unassign, # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 52cf6cf8..b9a03134 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -124,8 +124,10 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: - """ - Update the configuration of an existing router. + """Update the configuration of an existing router. + + **Deprecated**: Use PATCH + /v2/routers/{`project_id`}/{`region_id`}/{`router_id`} Args: external_gateway_info: New external gateway. @@ -491,8 +493,10 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: - """ - Update the configuration of an existing router. + """Update the configuration of an existing router. + + **Deprecated**: Use PATCH + /v2/routers/{`project_id`}/{`region_id`}/{`router_id`} Args: external_gateway_info: New external gateway. diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 8d021db5..c93d38bc 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -138,11 +138,12 @@ def list( '`start_gpu_virtual_server`', '`start_vm`', '`stop_gpu_baremetal_server`', '`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_l7policy`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_security_group`', - '`update_sfs`', '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', - '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] + '`update_floating_ip`', '`update_inference_application`', + '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_l7policy`', + '`update_lbmetadata`', '`update_port_allowed_address_pairs`', '`update_router`', + '`update_security_group`', '`update_sfs`', '`update_tags_gpu_virtual_cluster`', + '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', + '`upscale_gpu_virtual_cluster`'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` @@ -413,11 +414,12 @@ def list( '`start_gpu_virtual_server`', '`start_vm`', '`stop_gpu_baremetal_server`', '`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_l7policy`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_security_group`', - '`update_sfs`', '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', - '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] + '`update_floating_ip`', '`update_inference_application`', + '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_l7policy`', + '`update_lbmetadata`', '`update_port_allowed_address_pairs`', '`update_router`', + '`update_security_group`', '`update_sfs`', '`update_tags_gpu_virtual_cluster`', + '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', + '`upscale_gpu_virtual_cluster`'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` diff --git a/src/gcore/types/cloud/floating_ip_assign_params.py b/src/gcore/types/cloud/floating_ip_assign_params.py index e90fcfee..6e3cf613 100644 --- a/src/gcore/types/cloud/floating_ip_assign_params.py +++ b/src/gcore/types/cloud/floating_ip_assign_params.py @@ -10,8 +10,10 @@ class FloatingIPAssignParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" port_id: Required[str] """Port ID""" diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index 1af00005..440e4900 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -101,11 +101,12 @@ class TaskListParams(TypedDict, total=False): '`start_gpu_virtual_server`', '`start_vm`', '`stop_gpu_baremetal_server`', '`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_l7policy`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_security_group`', - '`update_sfs`', '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', - '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] + '`update_floating_ip`', '`update_inference_application`', + '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_l7policy`', + '`update_lbmetadata`', '`update_port_allowed_address_pairs`', '`update_router`', + '`update_security_group`', '`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], PropertyInfo(format="iso8601")] diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index 9768e23c..b2394861 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -16,6 +16,8 @@ FloatingIPDetailed, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -69,30 +71,35 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: - floating_ip = client.cloud.floating_ips.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + floating_ip = client.cloud.floating_ips.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - floating_ip = client.cloud.floating_ips.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - tags={"foo": "my-tag-value"}, - ) + with pytest.warns(DeprecationWarning): + floating_ip = client.cloud.floating_ips.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.floating_ips.with_raw_response.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.floating_ips.with_raw_response.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -101,27 +108,29 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.floating_ips.with_streaming_response.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.floating_ips.with_streaming_response.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - floating_ip = response.parse() - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + floating_ip = response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): - client.cloud.floating_ips.with_raw_response.update( - floating_ip_id="", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + client.cloud.floating_ips.with_raw_response.update( + floating_ip_id="", + project_id=1, + region_id=1, + ) @parametrize def test_method_list(self, client: Gcore) -> None: @@ -218,33 +227,38 @@ def test_path_params_delete(self, client: Gcore) -> None: @parametrize def test_method_assign(self, client: Gcore) -> None: - floating_ip = client.cloud.floating_ips.assign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - ) + with pytest.warns(DeprecationWarning): + floating_ip = client.cloud.floating_ips.assign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) @parametrize def test_method_assign_with_all_params(self, client: Gcore) -> None: - floating_ip = client.cloud.floating_ips.assign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - fixed_ip_address="192.168.10.15", - ) + with pytest.warns(DeprecationWarning): + floating_ip = client.cloud.floating_ips.assign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + fixed_ip_address="192.168.10.15", + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) @parametrize def test_raw_response_assign(self, client: Gcore) -> None: - response = client.cloud.floating_ips.with_raw_response.assign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.floating_ips.with_raw_response.assign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -253,29 +267,31 @@ def test_raw_response_assign(self, client: Gcore) -> None: @parametrize def test_streaming_response_assign(self, client: Gcore) -> None: - with client.cloud.floating_ips.with_streaming_response.assign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.floating_ips.with_streaming_response.assign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - floating_ip = response.parse() - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + floating_ip = response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_assign(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): - client.cloud.floating_ips.with_raw_response.assign( - floating_ip_id="", - project_id=0, - region_id=0, - port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + client.cloud.floating_ips.with_raw_response.assign( + floating_ip_id="", + project_id=1, + region_id=1, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) @parametrize def test_method_get(self, client: Gcore) -> None: @@ -325,20 +341,23 @@ def test_path_params_get(self, client: Gcore) -> None: @parametrize def test_method_unassign(self, client: Gcore) -> None: - floating_ip = client.cloud.floating_ips.unassign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + floating_ip = client.cloud.floating_ips.unassign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) @parametrize def test_raw_response_unassign(self, client: Gcore) -> None: - response = client.cloud.floating_ips.with_raw_response.unassign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.floating_ips.with_raw_response.unassign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -347,27 +366,29 @@ def test_raw_response_unassign(self, client: Gcore) -> None: @parametrize def test_streaming_response_unassign(self, client: Gcore) -> None: - with client.cloud.floating_ips.with_streaming_response.unassign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.floating_ips.with_streaming_response.unassign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - floating_ip = response.parse() - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + floating_ip = response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_unassign(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): - client.cloud.floating_ips.with_raw_response.unassign( - floating_ip_id="", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + client.cloud.floating_ips.with_raw_response.unassign( + floating_ip_id="", + project_id=1, + region_id=1, + ) class TestAsyncFloatingIPs: @@ -422,30 +443,35 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - floating_ip = await async_client.cloud.floating_ips.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + floating_ip = await async_client.cloud.floating_ips.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - floating_ip = await async_client.cloud.floating_ips.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - tags={"foo": "my-tag-value"}, - ) + with pytest.warns(DeprecationWarning): + floating_ip = await async_client.cloud.floating_ips.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.floating_ips.with_raw_response.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.floating_ips.with_raw_response.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -454,27 +480,29 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.floating_ips.with_streaming_response.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.cloud.floating_ips.with_streaming_response.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - floating_ip = await response.parse() - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + floating_ip = await response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): - await async_client.cloud.floating_ips.with_raw_response.update( - floating_ip_id="", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + await async_client.cloud.floating_ips.with_raw_response.update( + floating_ip_id="", + project_id=1, + region_id=1, + ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: @@ -571,33 +599,38 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_assign(self, async_client: AsyncGcore) -> None: - floating_ip = await async_client.cloud.floating_ips.assign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - ) + with pytest.warns(DeprecationWarning): + floating_ip = await async_client.cloud.floating_ips.assign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) @parametrize async def test_method_assign_with_all_params(self, async_client: AsyncGcore) -> None: - floating_ip = await async_client.cloud.floating_ips.assign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - fixed_ip_address="192.168.10.15", - ) + with pytest.warns(DeprecationWarning): + floating_ip = await async_client.cloud.floating_ips.assign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + fixed_ip_address="192.168.10.15", + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) @parametrize async def test_raw_response_assign(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.floating_ips.with_raw_response.assign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.floating_ips.with_raw_response.assign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -606,29 +639,31 @@ async def test_raw_response_assign(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_assign(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.floating_ips.with_streaming_response.assign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - ) 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.floating_ips.with_streaming_response.assign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - floating_ip = await response.parse() - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + floating_ip = await response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_assign(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): - await async_client.cloud.floating_ips.with_raw_response.assign( - floating_ip_id="", - project_id=0, - region_id=0, - port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + await async_client.cloud.floating_ips.with_raw_response.assign( + floating_ip_id="", + project_id=1, + region_id=1, + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: @@ -678,20 +713,23 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_unassign(self, async_client: AsyncGcore) -> None: - floating_ip = await async_client.cloud.floating_ips.unassign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + floating_ip = await async_client.cloud.floating_ips.unassign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) + assert_matches_type(FloatingIP, floating_ip, path=["response"]) @parametrize async def test_raw_response_unassign(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.floating_ips.with_raw_response.unassign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.floating_ips.with_raw_response.unassign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -700,24 +738,26 @@ async def test_raw_response_unassign(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_unassign(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.floating_ips.with_streaming_response.unassign( - floating_ip_id="floating_ip_id", - project_id=0, - region_id=0, - ) 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.floating_ips.with_streaming_response.unassign( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - floating_ip = await response.parse() - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + floating_ip = await response.parse() + assert_matches_type(FloatingIP, floating_ip, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_unassign(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): - await async_client.cloud.floating_ips.with_raw_response.unassign( - floating_ip_id="", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + await async_client.cloud.floating_ips.with_raw_response.unassign( + floating_ip_id="", + project_id=1, + region_id=1, + ) From 27c1b82e03949e8cefe13bd2d85bdb6184f026eb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 18:50:35 +0000 Subject: [PATCH 522/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8935e932..b8dda9bf 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.28.0" + ".": "0.29.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 361aba26..0da1bfa0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.28.0" +version = "0.29.0" description = "The official Python library for the gcore API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/gcore/_version.py b/src/gcore/_version.py index 6f1dd8f4..606d0626 100644 --- a/src/gcore/_version.py +++ b/src/gcore/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "gcore" -__version__ = "0.28.0" # x-release-please-version +__version__ = "0.29.0" # x-release-please-version From b418b740f626dc53d6975f48c9f52d9bec4d8cc5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Jan 2026 08:14:40 +0000 Subject: [PATCH 523/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 70d5bc3d..6569f324 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3fc43b72b82321f8d4ceea9ea44d7ab14e75872dbe66e3e698e1f59ba300ec55.yml -openapi_spec_hash: 1b1043a0ef7bcf106abf14f9187f5755 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-deca3f038598c9e7614c191a88510b5e50b6a1e482ddeb6e33ce3a226dc05c39.yml +openapi_spec_hash: 2ee17c1f251ec32cf95b91fb2e643657 config_hash: 7085751e6bd8f3fd13cfebe04bb99fed From a39f5c7f4ec043ab804ff7f1ec0bdd90f381b7b7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Jan 2026 11:23:33 +0000 Subject: [PATCH 524/592] feat(cloud)!: use v2 endpoint for floating IPs updates --- .stats.yml | 2 +- api.md | 2 +- src/gcore/resources/cloud/floating_ips.py | 164 ++++++++++++++---- .../types/cloud/floating_ip_update_params.py | 6 + .../api_resources/cloud/test_floating_ips.py | 154 ++++++++-------- 5 files changed, 212 insertions(+), 116 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6569f324..49462f50 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-deca3f038598c9e7614c191a88510b5e50b6a1e482ddeb6e33ce3a226dc05c39.yml openapi_spec_hash: 2ee17c1f251ec32cf95b91fb2e643657 -config_hash: 7085751e6bd8f3fd13cfebe04bb99fed +config_hash: da497b83ee3cacf93b7f67fc7d5b1164 diff --git a/api.md b/api.md index a877e26b..ed28093e 100644 --- a/api.md +++ b/api.md @@ -414,7 +414,7 @@ from gcore.types.cloud import FloatingIPDetailed Methods: - client.cloud.floating_ips.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.floating_ips.update(floating_ip_id, \*, project_id, region_id, \*\*params) -> FloatingIP +- client.cloud.floating_ips.update(floating_ip_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.floating_ips.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[FloatingIPDetailed] - client.cloud.floating_ips.delete(floating_ip_id, \*, project_id, region_id) -> TaskIDList - client.cloud.floating_ips.assign(floating_ip_id, \*, project_id, region_id, \*\*params) -> FloatingIP diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 96d3703f..84745adf 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -124,13 +124,14 @@ def create( cast_to=TaskIDList, ) - @typing_extensions.deprecated("deprecated") def update( self, floating_ip_id: str, *, project_id: int | None = None, region_id: int | None = None, + fixed_ip_address: Optional[str] | Omit = omit, + port_id: Optional[str] | Omit = omit, tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -138,10 +139,52 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FloatingIP: - """ - **Deprecated**: Use PATCH - /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead + ) -> TaskIDList: + """This endpoint updates the association and tags of an existing Floating IP. + + The + behavior depends on the current association state and the provided fields: + + Parameters: + + `port_id`: The unique identifier of the network interface (port) to which the + Floating IP should be assigned. This ID can be retrieved from the "Get instance" + or "List network interfaces" endpoints. + + `fixed_ip_address`: The private IP address assigned to the network interface. + This must be one of the IP addresses currently assigned to the specified port. + You can retrieve available fixed IP addresses from the "Get instance" or "List + network interfaces" endpoints. + + When the Floating IP has no port associated (`port_id` is null): + + - Patch with both `port_id` and `fixed_ip_address`: Assign the Floating IP to + the specified port and the provided `fixed_ip_address`, if that + `fixed_ip_address` exists on the port and is not yet used by another Floating + IP. + - Patch with `port_id` only (`fixed_ip_address` omitted): Assign the Floating IP + to the specified port using the first available IPv4 fixed IP of that port. + + When the Floating IP is already associated with a port: + + - Patch with both `port_id` and `fixed_ip_address`: Re-assign the Floating IP to + the specified port and address if all validations pass. + - Patch with `port_id` only (`fixed_ip_address` omitted): Re-assign the Floating + IP to the specified port using the first available IPv4 fixed IP of that port. + - Patch with `port_id` = null: Unassign the Floating IP from its current port. + + Tags: + + - You can update tags alongside association changes. Tags are provided as a list + of key-value pairs. + + Idempotency and task creation: + + - No worker task is created if the requested state is already actual, i.e., the + requested `port_id` equals the current `port_id` and/or the requested + `fixed_ip_address` equals the current `fixed_ip_address`, and the tags already + match the current tags. In such cases, the endpoint returns an empty tasks + list. Args: project_id: Project ID @@ -150,6 +193,10 @@ def update( floating_ip_id: Floating IP ID + fixed_ip_address: Fixed IP address + + port_id: Port ID + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and @@ -192,12 +239,19 @@ def update( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._patch( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", - body=maybe_transform({"tags": tags}, floating_ip_update_params.FloatingIPUpdateParams), + f"/cloud/v2/floatingips/{project_id}/{region_id}/{floating_ip_id}", + body=maybe_transform( + { + "fixed_ip_address": fixed_ip_address, + "port_id": port_id, + "tags": tags, + }, + floating_ip_update_params.FloatingIPUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FloatingIP, + cast_to=TaskIDList, ) def list( @@ -560,13 +614,14 @@ async def create( cast_to=TaskIDList, ) - @typing_extensions.deprecated("deprecated") async def update( self, floating_ip_id: str, *, project_id: int | None = None, region_id: int | None = None, + fixed_ip_address: Optional[str] | Omit = omit, + port_id: Optional[str] | Omit = omit, tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -574,10 +629,52 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FloatingIP: - """ - **Deprecated**: Use PATCH - /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead + ) -> TaskIDList: + """This endpoint updates the association and tags of an existing Floating IP. + + The + behavior depends on the current association state and the provided fields: + + Parameters: + + `port_id`: The unique identifier of the network interface (port) to which the + Floating IP should be assigned. This ID can be retrieved from the "Get instance" + or "List network interfaces" endpoints. + + `fixed_ip_address`: The private IP address assigned to the network interface. + This must be one of the IP addresses currently assigned to the specified port. + You can retrieve available fixed IP addresses from the "Get instance" or "List + network interfaces" endpoints. + + When the Floating IP has no port associated (`port_id` is null): + + - Patch with both `port_id` and `fixed_ip_address`: Assign the Floating IP to + the specified port and the provided `fixed_ip_address`, if that + `fixed_ip_address` exists on the port and is not yet used by another Floating + IP. + - Patch with `port_id` only (`fixed_ip_address` omitted): Assign the Floating IP + to the specified port using the first available IPv4 fixed IP of that port. + + When the Floating IP is already associated with a port: + + - Patch with both `port_id` and `fixed_ip_address`: Re-assign the Floating IP to + the specified port and address if all validations pass. + - Patch with `port_id` only (`fixed_ip_address` omitted): Re-assign the Floating + IP to the specified port using the first available IPv4 fixed IP of that port. + - Patch with `port_id` = null: Unassign the Floating IP from its current port. + + Tags: + + - You can update tags alongside association changes. Tags are provided as a list + of key-value pairs. + + Idempotency and task creation: + + - No worker task is created if the requested state is already actual, i.e., the + requested `port_id` equals the current `port_id` and/or the requested + `fixed_ip_address` equals the current `fixed_ip_address`, and the tags already + match the current tags. In such cases, the endpoint returns an empty tasks + list. Args: project_id: Project ID @@ -586,6 +683,10 @@ async def update( floating_ip_id: Floating IP ID + fixed_ip_address: Fixed IP address + + port_id: Port ID + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and @@ -628,12 +729,19 @@ async def update( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._patch( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", - body=await async_maybe_transform({"tags": tags}, floating_ip_update_params.FloatingIPUpdateParams), + f"/cloud/v2/floatingips/{project_id}/{region_id}/{floating_ip_id}", + body=await async_maybe_transform( + { + "fixed_ip_address": fixed_ip_address, + "port_id": port_id, + "tags": tags, + }, + floating_ip_update_params.FloatingIPUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FloatingIP, + cast_to=TaskIDList, ) def list( @@ -914,10 +1022,8 @@ def __init__(self, floating_ips: FloatingIPsResource) -> None: self.create = to_raw_response_wrapper( floating_ips.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - floating_ips.update, # pyright: ignore[reportDeprecated], - ) + self.update = to_raw_response_wrapper( + floating_ips.update, ) self.list = to_raw_response_wrapper( floating_ips.list, @@ -947,10 +1053,8 @@ def __init__(self, floating_ips: AsyncFloatingIPsResource) -> None: self.create = async_to_raw_response_wrapper( floating_ips.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - floating_ips.update, # pyright: ignore[reportDeprecated], - ) + self.update = async_to_raw_response_wrapper( + floating_ips.update, ) self.list = async_to_raw_response_wrapper( floating_ips.list, @@ -980,10 +1084,8 @@ def __init__(self, floating_ips: FloatingIPsResource) -> None: self.create = to_streamed_response_wrapper( floating_ips.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - floating_ips.update, # pyright: ignore[reportDeprecated], - ) + self.update = to_streamed_response_wrapper( + floating_ips.update, ) self.list = to_streamed_response_wrapper( floating_ips.list, @@ -1013,10 +1115,8 @@ def __init__(self, floating_ips: AsyncFloatingIPsResource) -> None: self.create = async_to_streamed_response_wrapper( floating_ips.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - floating_ips.update, # pyright: ignore[reportDeprecated], - ) + self.update = async_to_streamed_response_wrapper( + floating_ips.update, ) self.list = async_to_streamed_response_wrapper( floating_ips.list, diff --git a/src/gcore/types/cloud/floating_ip_update_params.py b/src/gcore/types/cloud/floating_ip_update_params.py index 13dfa1d0..65e87c02 100644 --- a/src/gcore/types/cloud/floating_ip_update_params.py +++ b/src/gcore/types/cloud/floating_ip_update_params.py @@ -17,6 +17,12 @@ class FloatingIPUpdateParams(TypedDict, total=False): region_id: int """Region ID""" + fixed_ip_address: Optional[str] + """Fixed IP address""" + + port_id: Optional[str] + """Port ID""" + tags: Optional[TagUpdateMapParam] """Update key-value tags using JSON Merge Patch semantics (RFC 7386). diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index b2394861..97ff5795 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -71,66 +71,61 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - floating_ip = client.cloud.floating_ips.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - ) - - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + floating_ip = client.cloud.floating_ips.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, floating_ip, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - floating_ip = client.cloud.floating_ips.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - tags={"foo": "my-tag-value"}, - ) - - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + floating_ip = client.cloud.floating_ips.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + fixed_ip_address="192.168.10.15", + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, floating_ip, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.cloud.floating_ips.with_raw_response.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - ) + response = client.cloud.floating_ips.with_raw_response.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" floating_ip = response.parse() - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + assert_matches_type(TaskIDList, floating_ip, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.cloud.floating_ips.with_streaming_response.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.cloud.floating_ips.with_streaming_response.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - floating_ip = response.parse() - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + floating_ip = response.parse() + assert_matches_type(TaskIDList, floating_ip, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): - client.cloud.floating_ips.with_raw_response.update( - floating_ip_id="", - project_id=1, - region_id=1, - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + client.cloud.floating_ips.with_raw_response.update( + floating_ip_id="", + project_id=1, + region_id=1, + ) @parametrize def test_method_list(self, client: Gcore) -> None: @@ -443,66 +438,61 @@ 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): - floating_ip = await async_client.cloud.floating_ips.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - ) - - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + floating_ip = await async_client.cloud.floating_ips.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, floating_ip, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - floating_ip = await async_client.cloud.floating_ips.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - tags={"foo": "my-tag-value"}, - ) - - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + floating_ip = await async_client.cloud.floating_ips.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + fixed_ip_address="192.168.10.15", + port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, floating_ip, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.cloud.floating_ips.with_raw_response.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - ) + response = await async_client.cloud.floating_ips.with_raw_response.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" floating_ip = await response.parse() - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + assert_matches_type(TaskIDList, floating_ip, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.cloud.floating_ips.with_streaming_response.update( - floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + async with async_client.cloud.floating_ips.with_streaming_response.update( + floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - floating_ip = await response.parse() - assert_matches_type(FloatingIP, floating_ip, path=["response"]) + floating_ip = await response.parse() + assert_matches_type(TaskIDList, floating_ip, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): - await async_client.cloud.floating_ips.with_raw_response.update( - floating_ip_id="", - project_id=1, - region_id=1, - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `floating_ip_id` but received ''"): + await async_client.cloud.floating_ips.with_raw_response.update( + floating_ip_id="", + project_id=1, + region_id=1, + ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: From ec88fd0457bd95088b7f3cfebfc6b671909d4217 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Jan 2026 11:24:16 +0000 Subject: [PATCH 525/592] feat(cloud)!: use create and update v2 endpoints for security groups --- .stats.yml | 2 +- api.md | 4 +- .../cloud/security_groups/security_groups.py | 210 ++++++---- .../cloud/security_group_create_params.py | 50 +-- .../cloud/security_group_update_params.py | 25 +- .../cloud/test_security_groups.py | 389 ++++++++---------- 6 files changed, 342 insertions(+), 338 deletions(-) diff --git a/.stats.yml b/.stats.yml index 49462f50..348a5951 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-deca3f038598c9e7614c191a88510b5e50b6a1e482ddeb6e33ce3a226dc05c39.yml openapi_spec_hash: 2ee17c1f251ec32cf95b91fb2e643657 -config_hash: da497b83ee3cacf93b7f67fc7d5b1164 +config_hash: e9e5b750687e9071d8b606963f0ffd6d diff --git a/api.md b/api.md index ed28093e..4184baed 100644 --- a/api.md +++ b/api.md @@ -431,8 +431,8 @@ from gcore.types.cloud import SecurityGroup, SecurityGroupRule Methods: -- client.cloud.security_groups.create(\*, project_id, region_id, \*\*params) -> SecurityGroup -- client.cloud.security_groups.update(group_id, \*, project_id, region_id, \*\*params) -> SecurityGroup +- client.cloud.security_groups.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.security_groups.update(group_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.security_groups.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[SecurityGroup] - client.cloud.security_groups.delete(group_id, \*, project_id, region_id) -> None - client.cloud.security_groups.copy(group_id, \*, project_id, region_id, \*\*params) -> SecurityGroup diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index a287b6bf..7c9bba4c 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -2,8 +2,7 @@ from __future__ import annotations -import typing_extensions -from typing import Iterable, Optional +from typing import Dict, Iterable, Optional import httpx @@ -33,6 +32,7 @@ security_group_update_params, ) from ...._base_client import AsyncPaginator, make_request_options +from ....types.cloud.task_id_list import TaskIDList from ....types.cloud.security_group import SecurityGroup from ....types.cloud.tag_update_map_param import TagUpdateMapParam @@ -63,32 +63,45 @@ def with_streaming_response(self) -> SecurityGroupsResourceWithStreamingResponse """ return SecurityGroupsResourceWithStreamingResponse(self) - @typing_extensions.deprecated("deprecated") def create( self, *, project_id: int | None = None, region_id: int | None = None, - security_group: security_group_create_params.SecurityGroup, - instances: SequenceNotStr[str] | Omit = omit, + name: str, + description: str | Omit = omit, + rules: Iterable[security_group_create_params.Rule] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SecurityGroup: - """ - **Deprecated** Use `/v2/security_groups//` instead. + ) -> TaskIDList: + """Creates a new security group with the specified configuration. + + If no egress + rules are provided, default set of egress rules will be applied If rules are + explicitly set to empty, no rules will be created. Args: project_id: Project ID region_id: Region ID - security_group: Security group + name: Security group name + + description: Security group description - instances: List of instances + rules: Security group rules + + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -103,29 +116,31 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v2/security_groups/{project_id}/{region_id}", body=maybe_transform( { - "security_group": security_group, - "instances": instances, + "name": name, + "description": description, + "rules": rules, + "tags": tags, }, security_group_create_params.SecurityGroupCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=SecurityGroup, + cast_to=TaskIDList, ) - @typing_extensions.deprecated("deprecated") def update( self, group_id: str, *, project_id: int | None = None, region_id: int | None = None, - changed_rules: Iterable[security_group_update_params.ChangedRule] | Omit = omit, + description: str | Omit = omit, name: str | Omit = omit, + rules: Iterable[security_group_update_params.Rule] | Omit = omit, tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -133,22 +148,41 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SecurityGroup: + ) -> TaskIDList: """ - **Deprecated** Use `/v2/security_groups///` - instead. + Updates the specified security group with the provided changes. + + **Behavior:** + + - Simple fields (name, description) will be updated if provided + - Undefined fields will remain unchanged + - If no change is detected for a specific field compared to the current security + group state, that field will be skipped + - If no changes are detected at all across all fields, no task will be created + and an empty task list will be returned + + **Important - Security Group Rules:** + + - Rules must be specified completely as the desired final state + - The system compares the provided rules against the current state + - Rules that exist in the request but not in the current state will be added + - Rules that exist in the current state but not in the request will be removed + - To keep existing rules, they must be included in the request alongside any new + rules Args: project_id: Project ID region_id: Region ID - group_id: Group ID + group_id: Security group ID - changed_rules: List of rules to create or delete + description: Security group description name: Name + rules: Security group rules + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and @@ -191,11 +225,12 @@ def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v2/security_groups/{project_id}/{region_id}/{group_id}", body=maybe_transform( { - "changed_rules": changed_rules, + "description": description, "name": name, + "rules": rules, "tags": tags, }, security_group_update_params.SecurityGroupUpdateParams, @@ -203,7 +238,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=SecurityGroup, + cast_to=TaskIDList, ) def list( @@ -485,32 +520,45 @@ def with_streaming_response(self) -> AsyncSecurityGroupsResourceWithStreamingRes """ return AsyncSecurityGroupsResourceWithStreamingResponse(self) - @typing_extensions.deprecated("deprecated") async def create( self, *, project_id: int | None = None, region_id: int | None = None, - security_group: security_group_create_params.SecurityGroup, - instances: SequenceNotStr[str] | Omit = omit, + name: str, + description: str | Omit = omit, + rules: Iterable[security_group_create_params.Rule] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SecurityGroup: - """ - **Deprecated** Use `/v2/security_groups//` instead. + ) -> TaskIDList: + """Creates a new security group with the specified configuration. + + If no egress + rules are provided, default set of egress rules will be applied If rules are + explicitly set to empty, no rules will be created. Args: project_id: Project ID region_id: Region ID - security_group: Security group + name: Security group name + + description: Security group description - instances: List of instances + rules: Security group rules + + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. extra_headers: Send extra headers @@ -525,29 +573,31 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v2/security_groups/{project_id}/{region_id}", body=await async_maybe_transform( { - "security_group": security_group, - "instances": instances, + "name": name, + "description": description, + "rules": rules, + "tags": tags, }, security_group_create_params.SecurityGroupCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=SecurityGroup, + cast_to=TaskIDList, ) - @typing_extensions.deprecated("deprecated") async def update( self, group_id: str, *, project_id: int | None = None, region_id: int | None = None, - changed_rules: Iterable[security_group_update_params.ChangedRule] | Omit = omit, + description: str | Omit = omit, name: str | Omit = omit, + rules: Iterable[security_group_update_params.Rule] | Omit = omit, tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -555,22 +605,41 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SecurityGroup: + ) -> TaskIDList: """ - **Deprecated** Use `/v2/security_groups///` - instead. + Updates the specified security group with the provided changes. + + **Behavior:** + + - Simple fields (name, description) will be updated if provided + - Undefined fields will remain unchanged + - If no change is detected for a specific field compared to the current security + group state, that field will be skipped + - If no changes are detected at all across all fields, no task will be created + and an empty task list will be returned + + **Important - Security Group Rules:** + + - Rules must be specified completely as the desired final state + - The system compares the provided rules against the current state + - Rules that exist in the request but not in the current state will be added + - Rules that exist in the current state but not in the request will be removed + - To keep existing rules, they must be included in the request alongside any new + rules Args: project_id: Project ID region_id: Region ID - group_id: Group ID + group_id: Security group ID - changed_rules: List of rules to create or delete + description: Security group description name: Name + rules: Security group rules + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and @@ -613,11 +682,12 @@ async def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v2/security_groups/{project_id}/{region_id}/{group_id}", body=await async_maybe_transform( { - "changed_rules": changed_rules, + "description": description, "name": name, + "rules": rules, "tags": tags, }, security_group_update_params.SecurityGroupUpdateParams, @@ -625,7 +695,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=SecurityGroup, + cast_to=TaskIDList, ) def list( @@ -887,15 +957,11 @@ class SecurityGroupsResourceWithRawResponse: def __init__(self, security_groups: SecurityGroupsResource) -> None: self._security_groups = security_groups - self.create = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - security_groups.create, # pyright: ignore[reportDeprecated], - ) + self.create = to_raw_response_wrapper( + security_groups.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - security_groups.update, # pyright: ignore[reportDeprecated], - ) + self.update = to_raw_response_wrapper( + security_groups.update, ) self.list = to_raw_response_wrapper( security_groups.list, @@ -922,15 +988,11 @@ class AsyncSecurityGroupsResourceWithRawResponse: def __init__(self, security_groups: AsyncSecurityGroupsResource) -> None: self._security_groups = security_groups - self.create = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - security_groups.create, # pyright: ignore[reportDeprecated], - ) + self.create = async_to_raw_response_wrapper( + security_groups.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - security_groups.update, # pyright: ignore[reportDeprecated], - ) + self.update = async_to_raw_response_wrapper( + security_groups.update, ) self.list = async_to_raw_response_wrapper( security_groups.list, @@ -957,15 +1019,11 @@ class SecurityGroupsResourceWithStreamingResponse: def __init__(self, security_groups: SecurityGroupsResource) -> None: self._security_groups = security_groups - self.create = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - security_groups.create, # pyright: ignore[reportDeprecated], - ) + self.create = to_streamed_response_wrapper( + security_groups.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - security_groups.update, # pyright: ignore[reportDeprecated], - ) + self.update = to_streamed_response_wrapper( + security_groups.update, ) self.list = to_streamed_response_wrapper( security_groups.list, @@ -992,15 +1050,11 @@ class AsyncSecurityGroupsResourceWithStreamingResponse: def __init__(self, security_groups: AsyncSecurityGroupsResource) -> None: self._security_groups = security_groups - self.create = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - security_groups.create, # pyright: ignore[reportDeprecated], - ) + self.create = async_to_streamed_response_wrapper( + security_groups.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - security_groups.update, # pyright: ignore[reportDeprecated], - ) + self.update = async_to_streamed_response_wrapper( + security_groups.update, ) self.list = async_to_streamed_response_wrapper( security_groups.list, diff --git a/src/gcore/types/cloud/security_group_create_params.py b/src/gcore/types/cloud/security_group_create_params.py index b932ad13..e660dee3 100644 --- a/src/gcore/types/cloud/security_group_create_params.py +++ b/src/gcore/types/cloud/security_group_create_params.py @@ -5,9 +5,7 @@ from typing import Dict, Iterable, Optional from typing_extensions import Literal, Required, TypedDict -from ..._types import SequenceNotStr - -__all__ = ["SecurityGroupCreateParams", "SecurityGroup", "SecurityGroupSecurityGroupRule"] +__all__ = ["SecurityGroupCreateParams", "Rule"] class SecurityGroupCreateParams(TypedDict, total=False): @@ -17,14 +15,27 @@ class SecurityGroupCreateParams(TypedDict, total=False): region_id: int """Region ID""" - security_group: Required[SecurityGroup] - """Security group""" + name: Required[str] + """Security group name""" + + description: str + """Security group description""" + + rules: Iterable[Rule] + """Security group rules""" + + tags: Dict[str, str] + """Key-value tags to associate with the resource. - instances: SequenceNotStr[str] - """List of instances""" + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. + """ -class SecurityGroupSecurityGroupRule(TypedDict, total=False): +class Rule(TypedDict, total=False): direction: Required[Literal["egress", "ingress"]] """ Ingress or egress, which is the direction in which the security group is applied @@ -75,26 +86,3 @@ class SecurityGroupSecurityGroupRule(TypedDict, total=False): remote_ip_prefix: Optional[str] """The remote IP prefix that is matched by this security group rule""" - - -class SecurityGroup(TypedDict, total=False): - """Security group""" - - name: Required[str] - """Security group name""" - - description: Optional[str] - """Security group description""" - - security_group_rules: Iterable[SecurityGroupSecurityGroupRule] - """Security group rules""" - - tags: Dict[str, str] - """Key-value tags to associate with the resource. - - A tag is a key-value pair that can be associated with a resource, enabling - efficient filtering and grouping for better organization and management. Both - tag keys and values have a maximum length of 255 characters. Some tags are - read-only and cannot be modified by the user. Tags are also integrated with cost - reports, allowing cost data to be filtered based on tag keys or values. - """ diff --git a/src/gcore/types/cloud/security_group_update_params.py b/src/gcore/types/cloud/security_group_update_params.py index 1ac56005..657e9807 100644 --- a/src/gcore/types/cloud/security_group_update_params.py +++ b/src/gcore/types/cloud/security_group_update_params.py @@ -3,11 +3,11 @@ from __future__ import annotations from typing import Iterable, Optional -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Literal, TypedDict from .tag_update_map_param import TagUpdateMapParam -__all__ = ["SecurityGroupUpdateParams", "ChangedRule"] +__all__ = ["SecurityGroupUpdateParams", "Rule"] class SecurityGroupUpdateParams(TypedDict, total=False): @@ -17,12 +17,15 @@ class SecurityGroupUpdateParams(TypedDict, total=False): region_id: int """Region ID""" - changed_rules: Iterable[ChangedRule] - """List of rules to create or delete""" + description: str + """Security group description""" name: str """Name""" + rules: Iterable[Rule] + """Security group rules""" + tags: Optional[TagUpdateMapParam] """Update key-value tags using JSON Merge Patch semantics (RFC 7386). @@ -54,10 +57,7 @@ class SecurityGroupUpdateParams(TypedDict, total=False): """ -class ChangedRule(TypedDict, total=False): - action: Required[Literal["create", "delete"]] - """Action for a rule""" - +class Rule(TypedDict, total=False): description: str """Security grpup rule description""" @@ -67,7 +67,7 @@ class ChangedRule(TypedDict, total=False): applied """ - ethertype: Optional[Literal["IPv4", "IPv6"]] + ethertype: Literal["IPv4", "IPv6"] """ Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules. @@ -107,11 +107,8 @@ class ChangedRule(TypedDict, total=False): ] """Protocol""" - remote_group_id: Optional[str] + remote_group_id: str """The remote group UUID to associate with this security group rule""" - remote_ip_prefix: Optional[str] + remote_ip_prefix: str """The remote IP prefix that is matched by this security group rule""" - - security_group_rule_id: Optional[str] - """UUID of rule to be deleted. Required for action 'delete' only""" diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index 0b842fd6..2bd9402b 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -11,11 +11,10 @@ from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud import ( + TaskIDList, SecurityGroup, ) -# pyright: reportDeprecated=false - base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,150 +23,133 @@ class TestSecurityGroups: @parametrize def test_method_create(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - security_group = client.cloud.security_groups.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) - - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = client.cloud.security_groups.create( + project_id=1, + region_id=1, + name="my_security_group", + ) + assert_matches_type(TaskIDList, security_group, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - security_group = client.cloud.security_groups.create( - project_id=1, - region_id=1, - security_group={ - "name": "my_security_group", + security_group = client.cloud.security_groups.create( + project_id=1, + region_id=1, + name="my_security_group", + description="My security group description", + rules=[ + { + "direction": "ingress", "description": "Some description", - "security_group_rules": [ - { - "direction": "ingress", - "description": "Some description", - "ethertype": "IPv4", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "00000000-0000-4000-8000-000000000000", - "remote_ip_prefix": "10.0.0.0/8", - } - ], - "tags": {"my-tag": "my-tag-value"}, - }, - instances=["00000000-0000-4000-8000-000000000000"], - ) - - assert_matches_type(SecurityGroup, security_group, path=["response"]) + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + } + ], + tags={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, security_group, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.cloud.security_groups.with_raw_response.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) + response = client.cloud.security_groups.with_raw_response.create( + project_id=1, + region_id=1, + name="my_security_group", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_group = response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + assert_matches_type(TaskIDList, security_group, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.cloud.security_groups.with_streaming_response.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.cloud.security_groups.with_streaming_response.create( + project_id=1, + region_id=1, + name="my_security_group", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_group = response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = response.parse() + assert_matches_type(TaskIDList, security_group, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - security_group = client.cloud.security_groups.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) - - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = client.cloud.security_groups.update( + group_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, security_group, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - security_group = client.cloud.security_groups.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - changed_rules=[ - { - "action": "delete", - "description": "Some description", - "direction": "egress", - "ethertype": "IPv4", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "00000000-0000-4000-8000-000000000000", - "remote_ip_prefix": "10.0.0.0/8", - "security_group_rule_id": "00000000-0000-4000-8000-000000000000", - } - ], - name="some_name", - tags={"foo": "my-tag-value"}, - ) - - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = client.cloud.security_groups.update( + group_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + description="Some description", + name="some_name", + rules=[ + { + "description": "Some description", + "direction": "egress", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + } + ], + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, security_group, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.cloud.security_groups.with_raw_response.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) + response = client.cloud.security_groups.with_raw_response.update( + group_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_group = response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + assert_matches_type(TaskIDList, security_group, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.cloud.security_groups.with_streaming_response.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.cloud.security_groups.with_streaming_response.update( + group_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_group = response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = response.parse() + assert_matches_type(TaskIDList, security_group, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): - client.cloud.security_groups.with_raw_response.update( - group_id="", - project_id=1, - region_id=1, - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + client.cloud.security_groups.with_raw_response.update( + group_id="", + project_id=1, + region_id=1, + ) @parametrize def test_method_list(self, client: Gcore) -> None: @@ -412,150 +394,133 @@ class TestAsyncSecurityGroups: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - security_group = await async_client.cloud.security_groups.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) - - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = await async_client.cloud.security_groups.create( + project_id=1, + region_id=1, + name="my_security_group", + ) + assert_matches_type(TaskIDList, security_group, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - security_group = await async_client.cloud.security_groups.create( - project_id=1, - region_id=1, - security_group={ - "name": "my_security_group", + security_group = await async_client.cloud.security_groups.create( + project_id=1, + region_id=1, + name="my_security_group", + description="My security group description", + rules=[ + { + "direction": "ingress", "description": "Some description", - "security_group_rules": [ - { - "direction": "ingress", - "description": "Some description", - "ethertype": "IPv4", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "00000000-0000-4000-8000-000000000000", - "remote_ip_prefix": "10.0.0.0/8", - } - ], - "tags": {"my-tag": "my-tag-value"}, - }, - instances=["00000000-0000-4000-8000-000000000000"], - ) - - assert_matches_type(SecurityGroup, security_group, path=["response"]) + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + } + ], + tags={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, security_group, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.cloud.security_groups.with_raw_response.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) + response = await async_client.cloud.security_groups.with_raw_response.create( + project_id=1, + region_id=1, + name="my_security_group", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_group = await response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + assert_matches_type(TaskIDList, security_group, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.cloud.security_groups.with_streaming_response.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + async with async_client.cloud.security_groups.with_streaming_response.create( + project_id=1, + region_id=1, + name="my_security_group", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_group = await response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = await response.parse() + assert_matches_type(TaskIDList, security_group, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - security_group = await async_client.cloud.security_groups.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) - - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = await async_client.cloud.security_groups.update( + group_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, security_group, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - security_group = await async_client.cloud.security_groups.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - changed_rules=[ - { - "action": "delete", - "description": "Some description", - "direction": "egress", - "ethertype": "IPv4", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "00000000-0000-4000-8000-000000000000", - "remote_ip_prefix": "10.0.0.0/8", - "security_group_rule_id": "00000000-0000-4000-8000-000000000000", - } - ], - name="some_name", - tags={"foo": "my-tag-value"}, - ) - - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = await async_client.cloud.security_groups.update( + group_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + description="Some description", + name="some_name", + rules=[ + { + "description": "Some description", + "direction": "egress", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + } + ], + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, security_group, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.cloud.security_groups.with_raw_response.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) + response = await async_client.cloud.security_groups.with_raw_response.update( + group_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" security_group = await response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + assert_matches_type(TaskIDList, security_group, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.cloud.security_groups.with_streaming_response.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + async with async_client.cloud.security_groups.with_streaming_response.update( + group_id="00000000-0000-4000-8000-000000000000", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_group = await response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = await response.parse() + assert_matches_type(TaskIDList, security_group, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): - await async_client.cloud.security_groups.with_raw_response.update( - group_id="", - project_id=1, - region_id=1, - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + await async_client.cloud.security_groups.with_raw_response.update( + group_id="", + project_id=1, + region_id=1, + ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: From 50e908feaf77eda4e7c2c455a4aaf81d8f4c58e7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Jan 2026 12:17:36 +0000 Subject: [PATCH 526/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cdn/resources/resources.py | 20 +- src/gcore/resources/cloud/audit_logs.py | 8 +- .../resources/cloud/baremetal/servers.py | 16 +- .../resources/cloud/billing_reservations.py | 4 +- src/gcore/resources/cloud/cost_reports.py | 4 +- .../cloud/file_shares/file_shares.py | 18 +- src/gcore/resources/cloud/floating_ips.py | 18 +- .../cloud/gpu_baremetal/clusters/clusters.py | 18 +- .../gpu_baremetal/clusters/interfaces.py | 8 +- .../cloud/gpu_virtual/clusters/clusters.py | 18 +- .../resources/cloud/instances/instances.py | 34 ++-- .../resources/cloud/instances/interfaces.py | 8 +- .../cloud/load_balancers/load_balancers.py | 18 +- .../resources/cloud/networks/networks.py | 18 +- src/gcore/resources/cloud/networks/subnets.py | 18 +- .../reserved_fixed_ips/reserved_fixed_ips.py | 12 +- .../cloud/security_groups/security_groups.py | 18 +- src/gcore/resources/cloud/tasks.py | 186 +++++++++--------- src/gcore/resources/cloud/volume_snapshots.py | 18 +- src/gcore/resources/cloud/volumes.py | 18 +- src/gcore/resources/streaming/ai_tasks.py | 22 +-- src/gcore/resources/streaming/directories.py | 4 +- src/gcore/resources/streaming/playlists.py | 8 +- src/gcore/resources/streaming/quality_sets.py | 8 +- src/gcore/resources/streaming/statistics.py | 24 +-- .../resources/streaming/streams/streams.py | 52 ++--- .../resources/streaming/videos/subtitles.py | 4 +- .../resources/streaming/videos/videos.py | 50 +++-- .../resources/waap/domains/advanced_rules.py | 24 +-- src/gcore/types/cdn/cdn_metrics.py | 2 +- src/gcore/types/cdn/cdn_resource.py | 10 +- .../types/cdn/origin_group_create_params.py | 8 +- .../types/cdn/origin_group_replace_params.py | 8 +- .../types/cdn/origin_group_update_params.py | 8 +- src/gcore/types/cdn/origin_groups.py | 8 +- src/gcore/types/cdn/resource_create_params.py | 10 +- src/gcore/types/cdn/resource_purge_params.py | 10 +- .../types/cdn/resource_replace_params.py | 10 +- src/gcore/types/cdn/resource_update_params.py | 10 +- .../types/cdn/resources/cdn_resource_rule.py | 10 +- .../types/cdn/resources/rule_create_params.py | 10 +- .../cdn/resources/rule_replace_params.py | 10 +- .../types/cdn/resources/rule_update_params.py | 10 +- src/gcore/types/cdn/rule_template.py | 10 +- .../types/cdn/rule_template_create_params.py | 10 +- .../types/cdn/rule_template_replace_params.py | 10 +- .../types/cdn/rule_template_update_params.py | 10 +- .../types/cloud/audit_log_list_params.py | 2 +- .../cloud/baremetal/server_create_params.py | 10 +- .../cloud/billing_reservation_list_params.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 +- src/gcore/types/cloud/ddos_profile_field.py | 4 +- .../types/cloud/file_share_update_params.py | 9 +- .../types/cloud/floating_ip_update_params.py | 9 +- .../gpu_baremetal/cluster_action_params.py | 9 +- .../gpu_baremetal/cluster_create_params.py | 2 +- .../clusters/interface_attach_params.py | 20 +- .../gpu_virtual/cluster_action_params.py | 9 +- .../gpu_virtual/cluster_create_params.py | 2 +- .../types/cloud/instance_create_params.py | 8 +- .../types/cloud/instance_update_params.py | 9 +- .../instances/interface_attach_params.py | 20 +- .../types/cloud/k8s/cluster_create_params.py | 4 +- .../types/cloud/k8s/cluster_update_params.py | 4 +- src/gcore/types/cloud/k8s/k8s_cluster.py | 4 +- .../cloud/load_balancer_update_params.py | 9 +- .../types/cloud/network_update_params.py | 9 +- .../cloud/networks/subnet_update_params.py | 9 +- src/gcore/types/cloud/region.py | 2 +- .../cloud/reserved_fixed_ip_create_params.py | 4 +- .../cloud/reserved_fixed_ip_list_params.py | 2 +- .../cloud/security_group_update_params.py | 9 +- src/gcore/types/cloud/task_list_params.py | 93 +++++---- .../types/cloud/usage_report_get_params.py | 2 +- .../cloud/volume_snapshot_update_params.py | 9 +- src/gcore/types/cloud/volume_update_params.py | 9 +- .../ai_contentmoderation_hardnudity.py | 2 +- .../ai_contentmoderation_softnudity.py | 2 +- src/gcore/types/streaming/ai_task.py | 2 +- .../types/streaming/ai_task_create_params.py | 2 +- .../types/streaming/ai_task_list_params.py | 3 +- src/gcore/types/streaming/clip.py | 4 +- .../types/streaming/create_video_param.py | 10 +- src/gcore/types/streaming/playlist.py | 2 +- .../types/streaming/playlist_create_params.py | 2 +- .../types/streaming/playlist_update_params.py | 2 +- src/gcore/types/streaming/playlist_video.py | 10 +- ...tatistic_get_live_unique_viewers_params.py | 4 +- ...tatistic_get_live_watch_time_cdn_params.py | 2 +- ...ic_get_live_watch_time_total_cdn_params.py | 2 +- ...statistic_get_vod_watch_time_cdn_params.py | 2 +- ...tic_get_vod_watch_time_total_cdn_params.py | 2 +- src/gcore/types/streaming/stream.py | 24 +-- .../streaming/stream_create_clip_params.py | 2 +- .../types/streaming/stream_create_params.py | 2 +- .../types/streaming/stream_update_params.py | 2 +- src/gcore/types/streaming/video.py | 14 +- .../types/streaming/video_list_params.py | 4 +- .../types/streaming/video_update_params.py | 10 +- .../domains/advanced_rule_create_params.py | 4 +- .../waap/domains/advanced_rule_list_params.py | 4 +- .../domains/advanced_rule_update_params.py | 4 +- .../types/waap/domains/waap_advanced_rule.py | 4 +- 106 files changed, 537 insertions(+), 724 deletions(-) diff --git a/.stats.yml b/.stats.yml index 348a5951..c9b17f00 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-deca3f038598c9e7614c191a88510b5e50b6a1e482ddeb6e33ce3a226dc05c39.yml -openapi_spec_hash: 2ee17c1f251ec32cf95b91fb2e643657 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c7e3eef675823dc3086f453b19b47767f397b5d35025dad732385af58fd40cf3.yml +openapi_spec_hash: 5bac6ca287a624aff4e02ff42ec6e1e8 config_hash: e9e5b750687e9071d8b606963f0ffd6d diff --git a/src/gcore/resources/cdn/resources/resources.py b/src/gcore/resources/cdn/resources/resources.py index 1757c8f3..2ceda584 100644 --- a/src/gcore/resources/cdn/resources/resources.py +++ b/src/gcore/resources/cdn/resources/resources.py @@ -684,14 +684,14 @@ def purge( the CDN cache, purge by URL will delete only the first slice (with bytes=0… .) 3. "ignoreQueryString" is used. Don’t specify parameters in the purge request. - 4. "`query_params_blacklist`" is used. Only files with the listed in the option + 4. "query_params_blacklist" is used. Only files with the listed in the option parameters will be cached as different objects. Files with other parameters will be cached as one object. In this case, specify the listed parameters in the Purge request. Don't specify other parameters. - 5. "`query_params_whitelist`" is used. Files with listed in the option - parameters will be cached as one object. Files with other parameters will be - cached as different objects. In this case, specify other parameters (if any) - besides the ones listed in the purge request. + 5. "query_params_whitelist" is used. Files with listed in the option parameters + will be cached as one object. Files with other parameters will be cached as + different objects. In this case, specify other parameters (if any) besides + the ones listed in the purge request. extra_headers: Send extra headers @@ -1594,14 +1594,14 @@ async def purge( the CDN cache, purge by URL will delete only the first slice (with bytes=0… .) 3. "ignoreQueryString" is used. Don’t specify parameters in the purge request. - 4. "`query_params_blacklist`" is used. Only files with the listed in the option + 4. "query_params_blacklist" is used. Only files with the listed in the option parameters will be cached as different objects. Files with other parameters will be cached as one object. In this case, specify the listed parameters in the Purge request. Don't specify other parameters. - 5. "`query_params_whitelist`" is used. Files with listed in the option - parameters will be cached as one object. Files with other parameters will be - cached as different objects. In this case, specify other parameters (if any) - besides the ones listed in the purge request. + 5. "query_params_whitelist" is used. Files with listed in the option parameters + will be cached as one object. Files with other parameters will be cached as + different objects. In this case, specify other parameters (if any) besides + the ones listed in the purge request. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index f47fa720..bca05f96 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -192,8 +192,8 @@ def list( search_field: Extra search field for common object properties such as name, IP address, or other, depending on the `resource_type` - sorting: (DEPRECATED Use '`order_by`' instead) Sorting by timestamp. Oldest first, or - most recent first + sorting: (DEPRECATED Use 'order_by' instead) Sorting by timestamp. Oldest first, or most + recent first source_user_ips: Originating IP address of the client making the request. Several options can be specified. @@ -410,8 +410,8 @@ def list( search_field: Extra search field for common object properties such as name, IP address, or other, depending on the `resource_type` - sorting: (DEPRECATED Use '`order_by`' instead) Sorting by timestamp. Oldest first, or - most recent first + sorting: (DEPRECATED Use 'order_by' instead) Sorting by timestamp. Oldest first, or most + recent first source_user_ips: Originating IP address of the client making the request. Several options can be specified. diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index f1dc32ed..d64bc50c 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -127,8 +127,8 @@ def create( When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the - '`user_data`' field to provide a script to create new users on Windows. The - password of the Admin user cannot be updated via '`user_data`'. + 'user_data' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via 'user_data'. ssh_key_name: Specifies the name of the SSH keypair, created via the [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). @@ -140,9 +140,9 @@ def create( user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when + user_data: String in base64 format. For Linux instances, 'user_data' is ignored when 'password' field is provided. For Windows instances, Admin user password is set - by 'password' field and cannot be updated via '`user_data`'. Examples of the + by 'password' field and cannot be updated via 'user_data'. Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html username: For Linux instances, 'username' and 'password' are used to create a new user. @@ -498,8 +498,8 @@ async def create( When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the - '`user_data`' field to provide a script to create new users on Windows. The - password of the Admin user cannot be updated via '`user_data`'. + 'user_data' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via 'user_data'. ssh_key_name: Specifies the name of the SSH keypair, created via the [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). @@ -511,9 +511,9 @@ async def create( user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when + user_data: String in base64 format. For Linux instances, 'user_data' is ignored when 'password' field is provided. For Windows instances, Admin user password is set - by 'password' field and cannot be updated via '`user_data`'. Examples of the + by 'password' field and cannot be updated via 'user_data'. Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html username: For Linux instances, 'username' and 'password' are used to create a new user. diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index 12ea8829..1ea0a26c 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -62,7 +62,7 @@ def list( configurations and associated pricing. Args: - metric_name: Metric name for the resource (e.g., 'bm1-hf-`medium_min`') + metric_name: Metric name for the resource (e.g., 'bm1-hf-medium_min') order_by: Order by field and direction. @@ -138,7 +138,7 @@ async def list( configurations and associated pricing. Args: - metric_name: Metric name for the resource (e.g., 'bm1-hf-`medium_min`') + metric_name: Metric name for the resource (e.g., 'bm1-hf-medium_min') order_by: Order by field and direction. diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 730f57bc..c0f2f84b 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -222,7 +222,7 @@ def get_aggregated_monthly( """ Retrieve a detailed cost report totals for a specified month, which includes both commit and pay-as-you-go (overcommit) prices. Additionally, it provides the - spent billing units (e.g., hours or GB) for resources. The "`time_to`" parameter + spent billing units (e.g., hours or GB) for resources. The "time_to" parameter represents all days in the specified month. Data from the past hour may not reflect the full set of statistics. For the most @@ -604,7 +604,7 @@ async def get_aggregated_monthly( """ Retrieve a detailed cost report totals for a specified month, which includes both commit and pay-as-you-go (overcommit) prices. Additionally, it provides the - spent billing units (e.g., hours or GB) for resources. The "`time_to`" parameter + spent billing units (e.g., hours or GB) for resources. The "time_to" parameter represents all days in the specified month. Data from the past hour may not reflect the full set of statistics. For the most diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 350398f9..e61969f0 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -269,20 +269,15 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -751,20 +746,15 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 84745adf..33c19798 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -207,20 +207,15 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -697,20 +692,15 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py b/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py index 87804b8a..5fea265a 100644 --- a/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py @@ -352,20 +352,15 @@ def action( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -912,20 +907,15 @@ async def action( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/gpu_baremetal/clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal/clusters/interfaces.py index 0b4d0768..dcd6f5f0 100644 --- a/src/gcore/resources/cloud/gpu_baremetal/clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal/clusters/interfaces.py @@ -214,7 +214,7 @@ def attach( security_groups: List of security group IDs - type: Must be '`any_subnet`' + type: Must be 'any_subnet' extra_headers: Send extra headers @@ -260,7 +260,7 @@ def attach( security_groups: List of security group IDs - type: Must be '`reserved_fixed_ip`'. Union tag + type: Must be 'reserved_fixed_ip'. Union tag extra_headers: Send extra headers @@ -572,7 +572,7 @@ async def attach( security_groups: List of security group IDs - type: Must be '`any_subnet`' + type: Must be 'any_subnet' extra_headers: Send extra headers @@ -618,7 +618,7 @@ async def attach( security_groups: List of security group IDs - type: Must be '`reserved_fixed_ip`'. Union tag + type: Must be 'reserved_fixed_ip'. Union tag extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py b/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py index a94d8752..486048b5 100644 --- a/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py @@ -564,20 +564,15 @@ def action( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -1214,20 +1209,15 @@ async def action( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 43e07b21..ca6b0339 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -190,8 +190,8 @@ def create( When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the - '`user_data`' field to provide a script to create new users on Windows. The - password of the Admin user cannot be updated via '`user_data`'. + 'user_data' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via 'user_data'. security_groups: Specifies security group UUIDs to be applied to all instance network interfaces. @@ -215,9 +215,9 @@ def create( user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when + user_data: String in base64 format. For Linux instances, 'user_data' is ignored when 'password' field is provided. For Windows instances, Admin user password is set - by 'password' field and cannot be updated via '`user_data`'. Examples of the + by 'password' field and cannot be updated via 'user_data'. Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html username: For Linux instances, 'username' and 'password' are used to create a new user. @@ -300,20 +300,15 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -1249,8 +1244,8 @@ async def create( When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the - '`user_data`' field to provide a script to create new users on Windows. The - password of the Admin user cannot be updated via '`user_data`'. + 'user_data' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via 'user_data'. security_groups: Specifies security group UUIDs to be applied to all instance network interfaces. @@ -1274,9 +1269,9 @@ async def create( user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. - user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when + user_data: String in base64 format. For Linux instances, 'user_data' is ignored when 'password' field is provided. For Windows instances, Admin user password is set - by 'password' field and cannot be updated via '`user_data`'. Examples of the + by 'password' field and cannot be updated via 'user_data'. Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html username: For Linux instances, 'username' and 'password' are used to create a new user. @@ -1359,20 +1354,15 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 261241ba..53d63c12 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -214,7 +214,7 @@ def attach( security_groups: List of security group IDs - type: Must be '`any_subnet`' + type: Must be 'any_subnet' extra_headers: Send extra headers @@ -260,7 +260,7 @@ def attach( security_groups: List of security group IDs - type: Must be '`reserved_fixed_ip`'. Union tag + type: Must be 'reserved_fixed_ip'. Union tag extra_headers: Send extra headers @@ -572,7 +572,7 @@ async def attach( security_groups: List of security group IDs - type: Must be '`any_subnet`' + type: Must be 'any_subnet' extra_headers: Send extra headers @@ -618,7 +618,7 @@ async def attach( security_groups: List of security group IDs - type: Must be '`reserved_fixed_ip`'. Union tag + type: Must be 'reserved_fixed_ip'. Union tag extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 6a097c65..20cb7409 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -285,20 +285,15 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -844,20 +839,15 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index fbbfeccf..b18a62af 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -177,20 +177,15 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -523,20 +518,15 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 4180bb0b..8bd0acb6 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -201,20 +201,15 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -604,20 +599,15 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py index 59ed0e06..3dd9e402 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py @@ -159,7 +159,7 @@ def create( Args: network_id: Reserved fixed IP will be allocated in a subnet of this network - type: Must be '`any_subnet`'. + type: Must be 'any_subnet'. ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. @@ -200,7 +200,7 @@ def create( network_id: Reserved fixed IP will be allocated in a subnet of this network - type: Must be '`ip_address`'. + type: Must be 'ip_address'. is_vip: If reserved fixed IP is a VIP @@ -383,7 +383,7 @@ def list( order_by: Ordering reserved fixed IP list result by name, status, `updated_at`, `created_at` or `fixed_ip_address` fields and directions (status.asc), default - is "`fixed_ip_address`.asc" + is "fixed_ip_address.asc" vip_only: Set to true if the response should only list VIPs @@ -623,7 +623,7 @@ async def create( Args: network_id: Reserved fixed IP will be allocated in a subnet of this network - type: Must be '`any_subnet`'. + type: Must be 'any_subnet'. ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. @@ -664,7 +664,7 @@ async def create( network_id: Reserved fixed IP will be allocated in a subnet of this network - type: Must be '`ip_address`'. + type: Must be 'ip_address'. is_vip: If reserved fixed IP is a VIP @@ -849,7 +849,7 @@ def list( order_by: Ordering reserved fixed IP list result by name, status, `updated_at`, `created_at` or `fixed_ip_address` fields and directions (status.asc), default - is "`fixed_ip_address`.asc" + is "fixed_ip_address.asc" vip_only: Set to true if the response should only list VIPs diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 7c9bba4c..2d4db35e 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -193,20 +193,15 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -650,20 +645,15 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index c93d38bc..6741bc40 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -90,60 +90,55 @@ def list( region_id: The region ID to filter the tasks by region. Supports multiple values of kind key=value1&key=value2 - sorting: (DEPRECATED Use '`order_by`' instead) Sorting by creation date. Oldest first, or + sorting: (DEPRECATED Use 'order_by' instead) Sorting by creation date. Oldest first, or most recent first state: Filter the tasks by state. Supports multiple values of kind key=value1&key=value2 - task_type: Filter the tasks by their type one of ['`activate_ddos_profile`', - '`attach_bm_to_reserved_fixed_ip`', '`attach_vm_interface`', - '`attach_vm_to_reserved_fixed_ip`', '`attach_volume`', - '`create_ai_cluster_gpu`', '`create_bm`', '`create_caas_container`', - '`create_dbaas_postgres_cluster`', '`create_ddos_profile`', - '`create_faas_function`', '`create_faas_namespace`', '`create_fip`', - '`create_gpu_virtual_cluster`', '`create_image`', - '`create_inference_application`', '`create_inference_instance`', - '`create_k8s_cluster_pool_v2`', '`create_k8s_cluster_v2`', '`create_l7policy`', - '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', - '`create_lbpool`', '`create_lbpool_health_monitor`', '`create_loadbalancer`', - '`create_network`', '`create_reserved_fixed_ip`', '`create_router`', - '`create_secret`', '`create_security_group`', '`create_servergroup`', - '`create_sfs`', '`create_snapshot`', '`create_subnet`', '`create_vm`', - '`create_volume`', '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', - '`delete_caas_container`', '`delete_dbaas_postgres_cluster`', - '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', - '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', - '`delete_image`', '`delete_inference_application`', - '`delete_inference_instance`', '`delete_k8s_cluster_pool_v2`', - '`delete_k8s_cluster_v2`', '`delete_l7policy`', '`delete_l7rule`', - '`delete_lblistener`', '`delete_lbmember`', '`delete_lbmetadata`', - '`delete_lbpool`', '`delete_loadbalancer`', '`delete_network`', - '`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_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`', - '`soft_reboot_gpu_virtual_server`', '`soft_reboot_vm`', - '`start_gpu_baremetal_server`', '`start_gpu_virtual_cluster`', - '`start_gpu_virtual_server`', '`start_vm`', '`stop_gpu_baremetal_server`', - '`stop_gpu_virtual_cluster`', '`stop_gpu_virtual_server`', '`stop_vm`', - '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', - '`update_floating_ip`', '`update_inference_application`', - '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_l7policy`', - '`update_lbmetadata`', '`update_port_allowed_address_pairs`', '`update_router`', - '`update_security_group`', '`update_sfs`', '`update_tags_gpu_virtual_cluster`', - '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', - '`upscale_gpu_virtual_cluster`'] + task_type: Filter the tasks by their type one of ['activate_ddos_profile', + 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', + 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', + 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', + 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', + 'create_fip', 'create_gpu_virtual_cluster', 'create_image', + 'create_inference_application', 'create_inference_instance', + 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', + 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', + 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', + 'create_reserved_fixed_ip', 'create_router', 'create_secret', + 'create_security_group', 'create_servergroup', 'create_sfs', 'create_snapshot', + 'create_subnet', 'create_vm', 'create_volume', 'deactivate_ddos_profile', + 'delete_ai_cluster_gpu', 'delete_caas_container', + 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', + 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', + 'delete_gpu_virtual_server', 'delete_image', 'delete_inference_application', + 'delete_inference_instance', 'delete_k8s_cluster_pool_v2', + 'delete_k8s_cluster_v2', 'delete_l7policy', 'delete_l7rule', + 'delete_lblistener', 'delete_lbmember', 'delete_lbmetadata', 'delete_lbpool', + 'delete_loadbalancer', 'delete_network', '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_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', 'soft_reboot_gpu_virtual_server', + 'soft_reboot_vm', 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', + 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', + 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', + 'sync_private_flavors', 'update_ddos_profile', 'update_floating_ip', + 'update_inference_application', 'update_inference_instance', + 'update_k8s_cluster_v2', 'update_l7policy', 'update_lbmetadata', + 'update_port_allowed_address_pairs', 'update_router', 'update_security_group', + 'update_sfs', 'update_tags_gpu_virtual_cluster', 'upgrade_k8s_cluster_v2', + 'upscale_ai_cluster_gpu', 'upscale_gpu_virtual_cluster'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` @@ -366,60 +361,55 @@ def list( region_id: The region ID to filter the tasks by region. Supports multiple values of kind key=value1&key=value2 - sorting: (DEPRECATED Use '`order_by`' instead) Sorting by creation date. Oldest first, or + sorting: (DEPRECATED Use 'order_by' instead) Sorting by creation date. Oldest first, or most recent first state: Filter the tasks by state. Supports multiple values of kind key=value1&key=value2 - task_type: Filter the tasks by their type one of ['`activate_ddos_profile`', - '`attach_bm_to_reserved_fixed_ip`', '`attach_vm_interface`', - '`attach_vm_to_reserved_fixed_ip`', '`attach_volume`', - '`create_ai_cluster_gpu`', '`create_bm`', '`create_caas_container`', - '`create_dbaas_postgres_cluster`', '`create_ddos_profile`', - '`create_faas_function`', '`create_faas_namespace`', '`create_fip`', - '`create_gpu_virtual_cluster`', '`create_image`', - '`create_inference_application`', '`create_inference_instance`', - '`create_k8s_cluster_pool_v2`', '`create_k8s_cluster_v2`', '`create_l7policy`', - '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', - '`create_lbpool`', '`create_lbpool_health_monitor`', '`create_loadbalancer`', - '`create_network`', '`create_reserved_fixed_ip`', '`create_router`', - '`create_secret`', '`create_security_group`', '`create_servergroup`', - '`create_sfs`', '`create_snapshot`', '`create_subnet`', '`create_vm`', - '`create_volume`', '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', - '`delete_caas_container`', '`delete_dbaas_postgres_cluster`', - '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', - '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', - '`delete_image`', '`delete_inference_application`', - '`delete_inference_instance`', '`delete_k8s_cluster_pool_v2`', - '`delete_k8s_cluster_v2`', '`delete_l7policy`', '`delete_l7rule`', - '`delete_lblistener`', '`delete_lbmember`', '`delete_lbmetadata`', - '`delete_lbpool`', '`delete_loadbalancer`', '`delete_network`', - '`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_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`', - '`soft_reboot_gpu_virtual_server`', '`soft_reboot_vm`', - '`start_gpu_baremetal_server`', '`start_gpu_virtual_cluster`', - '`start_gpu_virtual_server`', '`start_vm`', '`stop_gpu_baremetal_server`', - '`stop_gpu_virtual_cluster`', '`stop_gpu_virtual_server`', '`stop_vm`', - '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', - '`update_floating_ip`', '`update_inference_application`', - '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_l7policy`', - '`update_lbmetadata`', '`update_port_allowed_address_pairs`', '`update_router`', - '`update_security_group`', '`update_sfs`', '`update_tags_gpu_virtual_cluster`', - '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', - '`upscale_gpu_virtual_cluster`'] + task_type: Filter the tasks by their type one of ['activate_ddos_profile', + 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', + 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', + 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', + 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', + 'create_fip', 'create_gpu_virtual_cluster', 'create_image', + 'create_inference_application', 'create_inference_instance', + 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', + 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', + 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', + 'create_reserved_fixed_ip', 'create_router', 'create_secret', + 'create_security_group', 'create_servergroup', 'create_sfs', 'create_snapshot', + 'create_subnet', 'create_vm', 'create_volume', 'deactivate_ddos_profile', + 'delete_ai_cluster_gpu', 'delete_caas_container', + 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', + 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', + 'delete_gpu_virtual_server', 'delete_image', 'delete_inference_application', + 'delete_inference_instance', 'delete_k8s_cluster_pool_v2', + 'delete_k8s_cluster_v2', 'delete_l7policy', 'delete_l7rule', + 'delete_lblistener', 'delete_lbmember', 'delete_lbmetadata', 'delete_lbpool', + 'delete_loadbalancer', 'delete_network', '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_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', 'soft_reboot_gpu_virtual_server', + 'soft_reboot_vm', 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', + 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', + 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', + 'sync_private_flavors', 'update_ddos_profile', 'update_floating_ip', + 'update_inference_application', 'update_inference_instance', + 'update_k8s_cluster_v2', 'update_l7policy', 'update_lbmetadata', + 'update_port_allowed_address_pairs', 'update_router', 'update_security_group', + 'update_sfs', 'update_tags_gpu_virtual_cluster', 'upgrade_k8s_cluster_v2', + 'upscale_ai_cluster_gpu', 'upscale_gpu_virtual_cluster'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` diff --git a/src/gcore/resources/cloud/volume_snapshots.py b/src/gcore/resources/cloud/volume_snapshots.py index fefcddb8..a8b6850a 100644 --- a/src/gcore/resources/cloud/volume_snapshots.py +++ b/src/gcore/resources/cloud/volume_snapshots.py @@ -145,20 +145,15 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -402,20 +397,15 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 3ecbe665..49020290 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -350,20 +350,15 @@ def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. @@ -1165,20 +1160,15 @@ async def update( - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 6811e64c..bb85c829 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -331,7 +331,7 @@ def create( processing. subtitles_language: Indicates which language it is clearly necessary to translate into. If this is - not set, the original language will be used from attribute "`audio_language`". + not set, the original language will be used from attribute "audio_language". Please note that: @@ -402,8 +402,7 @@ def list( ordering: Which field to use when ordering the results: `task_id`, status, and `task_name`. Sorting is done in ascending (ASC) order. - If parameter is omitted then "`started_at` DESC" is used for ordering by - default. + If parameter is omitted then "started_at DESC" is used for ordering by default. page: Page to view from task list, starting from 1 @@ -588,8 +587,8 @@ def get_ai_settings( Parameter sections: - - "`language_support`" – AI Translation: check if a language pair is supported - or not for AI translation. + - "language_support" – AI Translation: check if a language pair is supported or + not for AI translation. - this list will expand as new AI methods are added. **`language_support`** @@ -597,7 +596,7 @@ def get_ai_settings( There are many languages available for transcription. But not all languages can be automatically translated to and from with good quality. In order to determine the availability of translation from the audio language to the desired subtitle - language, you can use this type of "`language_support`". + language, you can use this type of "language_support". AI models are constantly improving, so this method can be used for dynamic determination. @@ -963,7 +962,7 @@ async def create( processing. subtitles_language: Indicates which language it is clearly necessary to translate into. If this is - not set, the original language will be used from attribute "`audio_language`". + not set, the original language will be used from attribute "audio_language". Please note that: @@ -1034,8 +1033,7 @@ def list( ordering: Which field to use when ordering the results: `task_id`, status, and `task_name`. Sorting is done in ascending (ASC) order. - If parameter is omitted then "`started_at` DESC" is used for ordering by - default. + If parameter is omitted then "started_at DESC" is used for ordering by default. page: Page to view from task list, starting from 1 @@ -1220,8 +1218,8 @@ async def get_ai_settings( Parameter sections: - - "`language_support`" – AI Translation: check if a language pair is supported - or not for AI translation. + - "language_support" – AI Translation: check if a language pair is supported or + not for AI translation. - this list will expand as new AI methods are added. **`language_support`** @@ -1229,7 +1227,7 @@ async def get_ai_settings( There are many languages available for transcription. But not all languages can be automatically translated to and from with good quality. In order to determine the availability of translation from the audio language to the desired subtitle - language, you can use this type of "`language_support`". + language, you can use this type of "language_support". AI models are constantly improving, so this method can be used for dynamic determination. diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 3c45afb6..00a379cc 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -100,7 +100,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryBase: """ - Change a directory name or move to another "`parent_id`". + Change a directory name or move to another "parent_id". Args: name: Title of the directory. Omit this if you don't want to change. @@ -307,7 +307,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryBase: """ - Change a directory name or move to another "`parent_id`". + Change a directory name or move to another "parent_id". Args: name: Title of the directory. Omit this if you don't want to change. diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index 60629d9e..fe1f49db 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -159,7 +159,7 @@ def create( hls_cmaf_url: A URL to a master playlist HLS (master-cmaf.m3u8) with CMAF-based chunks. Chunks are in fMP4 container. - It is possible to use the same suffix-options as described in the "`hls_url`" + It is possible to use the same suffix-options as described in the "hls_url" attribute. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented @@ -294,7 +294,7 @@ def update( hls_cmaf_url: A URL to a master playlist HLS (master-cmaf.m3u8) with CMAF-based chunks. Chunks are in fMP4 container. - It is possible to use the same suffix-options as described in the "`hls_url`" + It is possible to use the same suffix-options as described in the "hls_url" attribute. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented @@ -648,7 +648,7 @@ async def create( hls_cmaf_url: A URL to a master playlist HLS (master-cmaf.m3u8) with CMAF-based chunks. Chunks are in fMP4 container. - It is possible to use the same suffix-options as described in the "`hls_url`" + It is possible to use the same suffix-options as described in the "hls_url" attribute. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented @@ -783,7 +783,7 @@ async def update( hls_cmaf_url: A URL to a master playlist HLS (master-cmaf.m3u8) with CMAF-based chunks. Chunks are in fMP4 container. - It is possible to use the same suffix-options as described in the "`hls_url`" + It is possible to use the same suffix-options as described in the "hls_url" attribute. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index a860d454..4aff7843 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -129,13 +129,13 @@ def set_default( Live transcoding management: - You can specify quality set explicitly in POST /streams method, look at - attribute "`quality_set_id`". + attribute "quality_set_id". - Otherwise these default values will be used by the system by default. VOD transcoding management: - You can specify quality set explicitly in POST /videos method, look at - attribute "`quality_set_id`". + attribute "quality_set_id". - Otherwise these default values will be used by the system by default. Args: @@ -271,13 +271,13 @@ async def set_default( Live transcoding management: - You can specify quality set explicitly in POST /streams method, look at - attribute "`quality_set_id`". + attribute "quality_set_id". - Otherwise these default values will be used by the system by default. VOD transcoding management: - You can specify quality set explicitly in POST /videos method, look at - attribute "`quality_set_id`". + attribute "quality_set_id". - Otherwise these default values will be used by the system by default. Args: diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 82b2a1f6..aa67b732 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -177,11 +177,11 @@ def get_live_unique_viewers( to: End of time frame. Format is date time in ISO 8601 - client_user_id: Filter by "`client_user_id`" + client_user_id: Filter by "client_user_id" granularity: Specifies the time interval for grouping data - stream_id: Filter by "`stream_id`" + stream_id: Filter by "stream_id" extra_headers: Send extra headers @@ -243,7 +243,7 @@ def get_live_watch_time_cdn( from_: Start of the time period for counting minutes of watching. Format is date time in ISO 8601. - client_user_id: Filter by field "`client_user_id`" + client_user_id: Filter by field "client_user_id" granularity: Data is grouped by the specified time interval @@ -304,7 +304,7 @@ def get_live_watch_time_total_cdn( player the views were made with. Args: - client_user_id: Filter by field "`client_user_id`" + client_user_id: Filter by field "client_user_id" from_: Start of the time period for counting minutes of watching. Format is date time in ISO 8601. If omitted, the earliest start time for viewing is taken @@ -1393,7 +1393,7 @@ def get_vod_watch_time_cdn( from_: Start of the time period for counting minutes of watching. Format is date time in ISO 8601. - client_user_id: Filter by field "`client_user_id`" + client_user_id: Filter by field "client_user_id" granularity: Data is grouped by the specified time interval @@ -1454,7 +1454,7 @@ def get_vod_watch_time_total_cdn( player the views were made with. Args: - client_user_id: Filter by field "`client_user_id`" + client_user_id: Filter by field "client_user_id" from_: Start of the time period for counting minutes of watching. Format is date time in ISO 8601. If omitted, the earliest start time for viewing is taken @@ -1604,11 +1604,11 @@ async def get_live_unique_viewers( to: End of time frame. Format is date time in ISO 8601 - client_user_id: Filter by "`client_user_id`" + client_user_id: Filter by "client_user_id" granularity: Specifies the time interval for grouping data - stream_id: Filter by "`stream_id`" + stream_id: Filter by "stream_id" extra_headers: Send extra headers @@ -1670,7 +1670,7 @@ async def get_live_watch_time_cdn( from_: Start of the time period for counting minutes of watching. Format is date time in ISO 8601. - client_user_id: Filter by field "`client_user_id`" + client_user_id: Filter by field "client_user_id" granularity: Data is grouped by the specified time interval @@ -1731,7 +1731,7 @@ async def get_live_watch_time_total_cdn( player the views were made with. Args: - client_user_id: Filter by field "`client_user_id`" + client_user_id: Filter by field "client_user_id" from_: Start of the time period for counting minutes of watching. Format is date time in ISO 8601. If omitted, the earliest start time for viewing is taken @@ -2820,7 +2820,7 @@ async def get_vod_watch_time_cdn( from_: Start of the time period for counting minutes of watching. Format is date time in ISO 8601. - client_user_id: Filter by field "`client_user_id`" + client_user_id: Filter by field "client_user_id" granularity: Data is grouped by the specified time interval @@ -2881,7 +2881,7 @@ async def get_vod_watch_time_total_cdn( player the views were made with. Args: - client_user_id: Filter by field "`client_user_id`" + client_user_id: Filter by field "client_user_id" from_: Start of the time period for counting minutes of watching. Format is date time in ISO 8601. If omitted, the earliest start time for viewing is taken diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 35a3bfca..5fc4b7c5 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -242,7 +242,7 @@ def create( requests and the stream is deactivated (the "active" field switches to "false"). Please, note that this field is for PULL only, so is not suitable for PUSH. Look - at fields "`push_url`" and "`push_url_srt`" from GET method. + at fields "push_url" and "push_url_srt" from GET method. extra_headers: Send extra headers @@ -384,8 +384,8 @@ def delete( is impossible to restore data and files after this. But if the live had recordings, they continue to remain independent Video - entities. The "`stream_id`" parameter will simply point to a stream that no - longer exists. + entities. The "stream_id" parameter will simply point to a stream that no longer + exists. Perhaps, instead of deleting, you may use the stream deactivation: @@ -503,7 +503,7 @@ def create_clip( **Cutting a clip from a source:** In order to use clips recording feature, DVR must be enabled for a stream: - "`dvr_enabled`: true". The DVR serves as a source for creating clips: + "dvr_enabled: true". The DVR serves as a source for creating clips: - By default live stream DVR is set to 1 hour (3600 seconds). You can create an instant clip using any segment of this time period by specifying the desired @@ -532,7 +532,7 @@ def create_clip( can be added to left and right. Duration of cutted segment cannot be greater than DVR duration for this stream. - Therefore, to change the maximum, use "`dvr_duration`" parameter of this stream. + Therefore, to change the maximum, use "dvr_duration" parameter of this stream. expiration: Expire time of the clip via a public link. @@ -635,7 +635,7 @@ def list_clips( Get list of non expired instant clips for a stream. You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs - from "`hls_master`" and "`mp4_master`". + from "hls_master" and "mp4_master". **How to download renditions of clips:** @@ -689,22 +689,22 @@ def start_recording( separate video VOD: - ID of the stream from which the recording was organized is added to - "`stream_id`" field. You can find the video by that value later. + "stream_id" field. You can find the video by that value later. - Title of the video is based on pattern "Stream Record: {`stream_title`}, {`recording_end_time_utc`}". - - Recording start time is stored in "`recording_started_at`" field. + - Recording start time is stored in "recording_started_at" field. - You can record the original stream or the transcoded one. Only the transcoded version will contain overlays. Set the appropriate recording method when creating the stream or before calling this recording method. Details in the - "`record_type`" parameter of the stream. + "record_type" parameter of the stream. - If you have access to the premium feature of saving the original stream (so not just transcoded renditions), then the link to the original file will be in - the "`origin_url`" field. Look at the description of the field how to use it. + the "origin_url" field. Look at the description of the field how to use it. Stream must be live for the recording to start, please check fields "live" - and/or "`backup_live`". After the recording starts, field "recording" will - switch to "true", and the recording duration in seconds will appear in the - "`recording_duration`" field. + and/or "backup_live". After the recording starts, field "recording" will switch + to "true", and the recording duration in seconds will appear in the + "recording_duration" field. Please, keep in mind that recording doesn't start instantly, it takes ±3-7 seconds to initialize the process after executing this method. @@ -980,7 +980,7 @@ async def create( requests and the stream is deactivated (the "active" field switches to "false"). Please, note that this field is for PULL only, so is not suitable for PUSH. Look - at fields "`push_url`" and "`push_url_srt`" from GET method. + at fields "push_url" and "push_url_srt" from GET method. extra_headers: Send extra headers @@ -1122,8 +1122,8 @@ async def delete( is impossible to restore data and files after this. But if the live had recordings, they continue to remain independent Video - entities. The "`stream_id`" parameter will simply point to a stream that no - longer exists. + entities. The "stream_id" parameter will simply point to a stream that no longer + exists. Perhaps, instead of deleting, you may use the stream deactivation: @@ -1241,7 +1241,7 @@ async def create_clip( **Cutting a clip from a source:** In order to use clips recording feature, DVR must be enabled for a stream: - "`dvr_enabled`: true". The DVR serves as a source for creating clips: + "dvr_enabled: true". The DVR serves as a source for creating clips: - By default live stream DVR is set to 1 hour (3600 seconds). You can create an instant clip using any segment of this time period by specifying the desired @@ -1270,7 +1270,7 @@ async def create_clip( can be added to left and right. Duration of cutted segment cannot be greater than DVR duration for this stream. - Therefore, to change the maximum, use "`dvr_duration`" parameter of this stream. + Therefore, to change the maximum, use "dvr_duration" parameter of this stream. expiration: Expire time of the clip via a public link. @@ -1373,7 +1373,7 @@ async def list_clips( Get list of non expired instant clips for a stream. You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs - from "`hls_master`" and "`mp4_master`". + from "hls_master" and "mp4_master". **How to download renditions of clips:** @@ -1427,22 +1427,22 @@ async def start_recording( separate video VOD: - ID of the stream from which the recording was organized is added to - "`stream_id`" field. You can find the video by that value later. + "stream_id" field. You can find the video by that value later. - Title of the video is based on pattern "Stream Record: {`stream_title`}, {`recording_end_time_utc`}". - - Recording start time is stored in "`recording_started_at`" field. + - Recording start time is stored in "recording_started_at" field. - You can record the original stream or the transcoded one. Only the transcoded version will contain overlays. Set the appropriate recording method when creating the stream or before calling this recording method. Details in the - "`record_type`" parameter of the stream. + "record_type" parameter of the stream. - If you have access to the premium feature of saving the original stream (so not just transcoded renditions), then the link to the original file will be in - the "`origin_url`" field. Look at the description of the field how to use it. + the "origin_url" field. Look at the description of the field how to use it. Stream must be live for the recording to start, please check fields "live" - and/or "`backup_live`". After the recording starts, field "recording" will - switch to "true", and the recording duration in seconds will appear in the - "`recording_duration`" field. + and/or "backup_live". After the recording starts, field "recording" will switch + to "true", and the recording duration in seconds will appear in the + "recording_duration" field. Please, keep in mind that recording doesn't start instantly, it takes ±3-7 seconds to initialize the process after executing this method. diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 5930fd58..c483d4b5 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -74,7 +74,7 @@ def create( Language is 3-letter language code according to ISO-639-2 (bibliographic code). Specify language you need, or just look at our list in the attribute - "`audio_language`" of section + "audio_language" of section ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). You can add multiple subtitles in the same language, language uniqueness is not @@ -351,7 +351,7 @@ async def create( Language is 3-letter language code according to ISO-639-2 (bibliographic code). Specify language you need, or just look at our list in the attribute - "`audio_language`" of section + "audio_language" of section ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). You can add multiple subtitles in the same language, language uniqueness is not diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index cc829118..60c435c3 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -93,7 +93,6 @@ def create( execution file will be uploaded and will be sent to transcoding automatically, you don't have to do anything else. Use extra field `origin_http_headers` if authorization is required on the external server. - - **Direct upload from a local device** – If you need to upload video directly from your local device or from a mobile app, then use this method. Keep `origin_url` empty and use TUS protocol ([tus.io](https://tus.io)) to upload @@ -202,7 +201,7 @@ def update( It's allowed to update only those public parameters that are described in POST method to create a new “video” entity. So it's not possible to change calculated - parameters like "id", "duration", "`hls_url`", etc. + parameters like "id", "duration", "hls_url", etc. Examples of changing: @@ -211,9 +210,9 @@ def update( Please note that some parameters are used on initial step (before transcoding) only, so after transcoding there is no use in changing their values. For - example, "`origin_url`" parameter is used for downloading an original file from - a source and never used after transcoding; or "priority" parameter is used to - set priority of processing and never used after transcoding. + example, "origin_url" parameter is used for downloading an original file from a + source and never used after transcoding; or "priority" parameter is used to set + priority of processing and never used after transcoding. Args: name: Video name @@ -294,16 +293,16 @@ def update( directory_id: ID of the directory where the video should be uploaded. (beta) origin_http_headers: Authorization HTTP request header. Will be used as credentials to authenticate a - request to download a file (specified in "`origin_url`" parameter) on an - external server. + request to download a file (specified in "origin_url" parameter) on an external + server. Syntax: `Authorization: ` Examples: - - "`origin_http_headers`": "Authorization: Basic ..." - - "`origin_http_headers`": "Authorization: Bearer ..." - - "`origin_http_headers`": "Authorization: APIKey ..." Example of usage when + - "origin_http_headers": "Authorization: Basic ..." + - "origin_http_headers": "Authorization: Bearer ..." + - "origin_http_headers": "Authorization: APIKey ..." Example of usage when downloading a file from Google Drive: ``` @@ -325,7 +324,7 @@ def update( After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own - image. Also use attribute "`screenshot_id`" to select poster as a default + image. Also use attribute "screenshot_id" to select poster as a default screnshot. Attribute accepts single image as base64-encoded string @@ -476,7 +475,7 @@ def list( id: IDs of the videos to find. You can specify one or more identifiers separated by commas. Example, ?id=1,101,1001 - client_user_id: Find videos where "`client_user_id`" meta field is equal to the search value + client_user_id: Find videos where "client_user_id" meta field is equal to the search value fields: Restriction to return only the specified attributes, instead of the entire dataset. Specify, if you need to get short response. The following fields are @@ -505,7 +504,7 @@ def list( - ready - error - stream_id: Find videos recorded from a specific stream, so for which "`stream_id`" field is + stream_id: Find videos recorded from a specific stream, so for which "stream_id" field is equal to the search value extra_headers: Send extra headers @@ -841,7 +840,6 @@ async def create( execution file will be uploaded and will be sent to transcoding automatically, you don't have to do anything else. Use extra field `origin_http_headers` if authorization is required on the external server. - - **Direct upload from a local device** – If you need to upload video directly from your local device or from a mobile app, then use this method. Keep `origin_url` empty and use TUS protocol ([tus.io](https://tus.io)) to upload @@ -950,7 +948,7 @@ async def update( It's allowed to update only those public parameters that are described in POST method to create a new “video” entity. So it's not possible to change calculated - parameters like "id", "duration", "`hls_url`", etc. + parameters like "id", "duration", "hls_url", etc. Examples of changing: @@ -959,9 +957,9 @@ async def update( Please note that some parameters are used on initial step (before transcoding) only, so after transcoding there is no use in changing their values. For - example, "`origin_url`" parameter is used for downloading an original file from - a source and never used after transcoding; or "priority" parameter is used to - set priority of processing and never used after transcoding. + example, "origin_url" parameter is used for downloading an original file from a + source and never used after transcoding; or "priority" parameter is used to set + priority of processing and never used after transcoding. Args: name: Video name @@ -1042,16 +1040,16 @@ async def update( directory_id: ID of the directory where the video should be uploaded. (beta) origin_http_headers: Authorization HTTP request header. Will be used as credentials to authenticate a - request to download a file (specified in "`origin_url`" parameter) on an - external server. + request to download a file (specified in "origin_url" parameter) on an external + server. Syntax: `Authorization: ` Examples: - - "`origin_http_headers`": "Authorization: Basic ..." - - "`origin_http_headers`": "Authorization: Bearer ..." - - "`origin_http_headers`": "Authorization: APIKey ..." Example of usage when + - "origin_http_headers": "Authorization: Basic ..." + - "origin_http_headers": "Authorization: Bearer ..." + - "origin_http_headers": "Authorization: APIKey ..." Example of usage when downloading a file from Google Drive: ``` @@ -1073,7 +1071,7 @@ async def update( After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own - image. Also use attribute "`screenshot_id`" to select poster as a default + image. Also use attribute "screenshot_id" to select poster as a default screnshot. Attribute accepts single image as base64-encoded string @@ -1224,7 +1222,7 @@ def list( id: IDs of the videos to find. You can specify one or more identifiers separated by commas. Example, ?id=1,101,1001 - client_user_id: Find videos where "`client_user_id`" meta field is equal to the search value + client_user_id: Find videos where "client_user_id" meta field is equal to the search value fields: Restriction to return only the specified attributes, instead of the entire dataset. Specify, if you need to get short response. The following fields are @@ -1253,7 +1251,7 @@ def list( - ready - error - stream_id: Find videos recorded from a specific stream, so for which "`stream_id`" field is + stream_id: Find videos recorded from a specific stream, so for which "stream_id" field is equal to the search value extra_headers: Send extra headers diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index f46e4f46..87e9e974 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -89,10 +89,10 @@ def create( The "access" phase is responsible for modifying the request before it is sent to the origin server. - The "`header_filter`" phase is responsible for modifying the HTTP headers of a + The "header_filter" phase is responsible for modifying the HTTP headers of a response before they are sent back to the client. - The "`body_filter`" phase is responsible for modifying the body of a response + The "body_filter" phase is responsible for modifying the body of a response before it is sent back to the client. extra_headers: Send extra headers @@ -161,10 +161,10 @@ def update( The "access" phase is responsible for modifying the request before it is sent to the origin server. - The "`header_filter`" phase is responsible for modifying the HTTP headers of a + The "header_filter" phase is responsible for modifying the HTTP headers of a response before they are sent back to the client. - The "`body_filter`" phase is responsible for modifying the body of a response + The "body_filter" phase is responsible for modifying the body of a response before it is sent back to the client. source: A CEL syntax expression that contains the rule's conditions. Allowed objects @@ -263,10 +263,10 @@ def list( The "access" phase is responsible for modifying the request before it is sent to the origin server. - The "`header_filter`" phase is responsible for modifying the HTTP headers of a + The "header_filter" phase is responsible for modifying the HTTP headers of a response before they are sent back to the client. - The "`body_filter`" phase is responsible for modifying the body of a response + The "body_filter" phase is responsible for modifying the body of a response before it is sent back to the client. extra_headers: Send extra headers @@ -482,10 +482,10 @@ async def create( The "access" phase is responsible for modifying the request before it is sent to the origin server. - The "`header_filter`" phase is responsible for modifying the HTTP headers of a + The "header_filter" phase is responsible for modifying the HTTP headers of a response before they are sent back to the client. - The "`body_filter`" phase is responsible for modifying the body of a response + The "body_filter" phase is responsible for modifying the body of a response before it is sent back to the client. extra_headers: Send extra headers @@ -554,10 +554,10 @@ async def update( The "access" phase is responsible for modifying the request before it is sent to the origin server. - The "`header_filter`" phase is responsible for modifying the HTTP headers of a + The "header_filter" phase is responsible for modifying the HTTP headers of a response before they are sent back to the client. - The "`body_filter`" phase is responsible for modifying the body of a response + The "body_filter" phase is responsible for modifying the body of a response before it is sent back to the client. source: A CEL syntax expression that contains the rule's conditions. Allowed objects @@ -656,10 +656,10 @@ def list( The "access" phase is responsible for modifying the request before it is sent to the origin server. - The "`header_filter`" phase is responsible for modifying the HTTP headers of a + The "header_filter" phase is responsible for modifying the HTTP headers of a response before they are sent back to the client. - The "`body_filter`" phase is responsible for modifying the body of a response + The "body_filter" phase is responsible for modifying the body of a response before it is sent back to the client. extra_headers: Send extra headers diff --git a/src/gcore/types/cdn/cdn_metrics.py b/src/gcore/types/cdn/cdn_metrics.py index 1922d524..de50e377 100644 --- a/src/gcore/types/cdn/cdn_metrics.py +++ b/src/gcore/types/cdn/cdn_metrics.py @@ -16,7 +16,7 @@ class CdnMetrics(BaseModel): data: Optional[Data] = None """ If no grouping was requested then "data" holds an array of metric values. If at - least one field is specified in "`group_by`" then "data" is an object whose + least one field is specified in "group_by" then "data" is an object whose properties are groups, which may include other groups; the last group will hold array of metrics values. """ diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py index 9f24e9f9..a1066729 100644 --- a/src/gcore/types/cdn/cdn_resource.py +++ b/src/gcore/types/cdn/cdn_resource.py @@ -225,11 +225,11 @@ class OptionsCors(BaseModel): - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain. `"value": ["*"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. `"value": ["domain.com", "second.dom.com"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" header in the response. `"value": ["$http_origin"]` @@ -821,9 +821,9 @@ class OptionsIPAddressACL(BaseModel): Possible values: - - **allow** - Allow access to all IPs except IPs specified in - "`excepted_values`" field. - - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + - **allow** - Allow access to all IPs except IPs specified in "excepted_values" + field. + - **deny** - Deny access to all IPs except IPs specified in "excepted_values" field. """ diff --git a/src/gcore/types/cdn/origin_group_create_params.py b/src/gcore/types/cdn/origin_group_create_params.py index 540730d7..2c77824a 100644 --- a/src/gcore/types/cdn/origin_group_create_params.py +++ b/src/gcore/types/cdn/origin_group_create_params.py @@ -157,8 +157,8 @@ class AwsSignatureV4Auth(TypedDict, total=False): - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and underscores. - - If "`s3_type`": amazon, length should be 40 characters. - - If "`s3_type`": other, length should be from 16 to 255 characters. + - If "s3_type": amazon, length should be 40 characters. + - If "s3_type": other, length should be from 16 to 255 characters. """ s3_type: Required[str] @@ -173,13 +173,13 @@ class AwsSignatureV4Auth(TypedDict, total=False): s3_region: str """S3 storage region. - The parameter is required, if "`s3_type`": amazon. + The parameter is required, if "s3_type": amazon. """ s3_storage_hostname: str """S3 storage hostname. - The parameter is required, if "`s3_type`": other. + The parameter is required, if "s3_type": other. """ diff --git a/src/gcore/types/cdn/origin_group_replace_params.py b/src/gcore/types/cdn/origin_group_replace_params.py index bfca4218..42086867 100644 --- a/src/gcore/types/cdn/origin_group_replace_params.py +++ b/src/gcore/types/cdn/origin_group_replace_params.py @@ -163,8 +163,8 @@ class AwsSignatureV4Auth(TypedDict, total=False): - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and underscores. - - If "`s3_type`": amazon, length should be 40 characters. - - If "`s3_type`": other, length should be from 16 to 255 characters. + - If "s3_type": amazon, length should be 40 characters. + - If "s3_type": other, length should be from 16 to 255 characters. """ s3_type: Required[str] @@ -179,13 +179,13 @@ class AwsSignatureV4Auth(TypedDict, total=False): s3_region: str """S3 storage region. - The parameter is required, if "`s3_type`": amazon. + The parameter is required, if "s3_type": amazon. """ s3_storage_hostname: str """S3 storage hostname. - The parameter is required, if "`s3_type`": other. + The parameter is required, if "s3_type": other. """ diff --git a/src/gcore/types/cdn/origin_group_update_params.py b/src/gcore/types/cdn/origin_group_update_params.py index 09fe43f1..1b4efd18 100644 --- a/src/gcore/types/cdn/origin_group_update_params.py +++ b/src/gcore/types/cdn/origin_group_update_params.py @@ -163,8 +163,8 @@ class AwsSignatureV4Auth(TypedDict, total=False): - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and underscores. - - If "`s3_type`": amazon, length should be 40 characters. - - If "`s3_type`": other, length should be from 16 to 255 characters. + - If "s3_type": amazon, length should be 40 characters. + - If "s3_type": other, length should be from 16 to 255 characters. """ s3_type: Required[str] @@ -179,13 +179,13 @@ class AwsSignatureV4Auth(TypedDict, total=False): s3_region: str """S3 storage region. - The parameter is required, if "`s3_type`": amazon. + The parameter is required, if "s3_type": amazon. """ s3_storage_hostname: str """S3 storage hostname. - The parameter is required, if "`s3_type`": other. + The parameter is required, if "s3_type": other. """ diff --git a/src/gcore/types/cdn/origin_groups.py b/src/gcore/types/cdn/origin_groups.py index fd41af74..863ea739 100644 --- a/src/gcore/types/cdn/origin_groups.py +++ b/src/gcore/types/cdn/origin_groups.py @@ -125,8 +125,8 @@ class AwsSignatureV4Auth(BaseModel): - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and underscores. - - If "`s3_type`": amazon, length should be 40 characters. - - If "`s3_type`": other, length should be from 16 to 255 characters. + - If "s3_type": amazon, length should be 40 characters. + - If "s3_type": other, length should be from 16 to 255 characters. """ s3_type: str @@ -141,13 +141,13 @@ class AwsSignatureV4Auth(BaseModel): s3_region: Optional[str] = None """S3 storage region. - The parameter is required, if "`s3_type`": amazon. + The parameter is required, if "s3_type": amazon. """ s3_storage_hostname: Optional[str] = None """S3 storage hostname. - The parameter is required, if "`s3_type`": other. + The parameter is required, if "s3_type": other. """ diff --git a/src/gcore/types/cdn/resource_create_params.py b/src/gcore/types/cdn/resource_create_params.py index 488f1f94..09c122d2 100644 --- a/src/gcore/types/cdn/resource_create_params.py +++ b/src/gcore/types/cdn/resource_create_params.py @@ -348,11 +348,11 @@ class OptionsCors(TypedDict, total=False): - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain. `"value": ["*"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. `"value": ["domain.com", "second.dom.com"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" header in the response. `"value": ["$http_origin"]` @@ -944,9 +944,9 @@ class OptionsIPAddressACL(TypedDict, total=False): Possible values: - - **allow** - Allow access to all IPs except IPs specified in - "`excepted_values`" field. - - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + - **allow** - Allow access to all IPs except IPs specified in "excepted_values" + field. + - **deny** - Deny access to all IPs except IPs specified in "excepted_values" field. """ diff --git a/src/gcore/types/cdn/resource_purge_params.py b/src/gcore/types/cdn/resource_purge_params.py index f55c4797..0a930c50 100644 --- a/src/gcore/types/cdn/resource_purge_params.py +++ b/src/gcore/types/cdn/resource_purge_params.py @@ -28,14 +28,14 @@ class PurgeByURL(TypedDict, total=False): the CDN cache, purge by URL will delete only the first slice (with bytes=0… .) 3. "ignoreQueryString" is used. Don’t specify parameters in the purge request. - 4. "`query_params_blacklist`" is used. Only files with the listed in the option + 4. "query_params_blacklist" is used. Only files with the listed in the option parameters will be cached as different objects. Files with other parameters will be cached as one object. In this case, specify the listed parameters in the Purge request. Don't specify other parameters. - 5. "`query_params_whitelist`" is used. Files with listed in the option - parameters will be cached as one object. Files with other parameters will be - cached as different objects. In this case, specify other parameters (if any) - besides the ones listed in the purge request. + 5. "query_params_whitelist" is used. Files with listed in the option parameters + will be cached as one object. Files with other parameters will be cached as + different objects. In this case, specify other parameters (if any) besides + the ones listed in the purge request. """ diff --git a/src/gcore/types/cdn/resource_replace_params.py b/src/gcore/types/cdn/resource_replace_params.py index cb423c40..e1ab08b8 100644 --- a/src/gcore/types/cdn/resource_replace_params.py +++ b/src/gcore/types/cdn/resource_replace_params.py @@ -326,11 +326,11 @@ class OptionsCors(TypedDict, total=False): - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain. `"value": ["*"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. `"value": ["domain.com", "second.dom.com"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" header in the response. `"value": ["$http_origin"]` @@ -922,9 +922,9 @@ class OptionsIPAddressACL(TypedDict, total=False): Possible values: - - **allow** - Allow access to all IPs except IPs specified in - "`excepted_values`" field. - - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + - **allow** - Allow access to all IPs except IPs specified in "excepted_values" + field. + - **deny** - Deny access to all IPs except IPs specified in "excepted_values" field. """ diff --git a/src/gcore/types/cdn/resource_update_params.py b/src/gcore/types/cdn/resource_update_params.py index f96093b8..c231f15d 100644 --- a/src/gcore/types/cdn/resource_update_params.py +++ b/src/gcore/types/cdn/resource_update_params.py @@ -317,11 +317,11 @@ class OptionsCors(TypedDict, total=False): - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain. `"value": ["*"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. `"value": ["domain.com", "second.dom.com"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" header in the response. `"value": ["$http_origin"]` @@ -913,9 +913,9 @@ class OptionsIPAddressACL(TypedDict, total=False): Possible values: - - **allow** - Allow access to all IPs except IPs specified in - "`excepted_values`" field. - - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + - **allow** - Allow access to all IPs except IPs specified in "excepted_values" + field. + - **deny** - Deny access to all IPs except IPs specified in "excepted_values" field. """ diff --git a/src/gcore/types/cdn/resources/cdn_resource_rule.py b/src/gcore/types/cdn/resources/cdn_resource_rule.py index 9118e322..2b61a6d2 100644 --- a/src/gcore/types/cdn/resources/cdn_resource_rule.py +++ b/src/gcore/types/cdn/resources/cdn_resource_rule.py @@ -220,11 +220,11 @@ class OptionsCors(BaseModel): - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain. `"value": ["*"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. `"value": ["domain.com", "second.dom.com"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" header in the response. `"value": ["$http_origin"]` @@ -793,9 +793,9 @@ class OptionsIPAddressACL(BaseModel): Possible values: - - **allow** - Allow access to all IPs except IPs specified in - "`excepted_values`" field. - - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + - **allow** - Allow access to all IPs except IPs specified in "excepted_values" + field. + - **deny** - Deny access to all IPs except IPs specified in "excepted_values" field. """ diff --git a/src/gcore/types/cdn/resources/rule_create_params.py b/src/gcore/types/cdn/resources/rule_create_params.py index 243c958e..9d48700f 100644 --- a/src/gcore/types/cdn/resources/rule_create_params.py +++ b/src/gcore/types/cdn/resources/rule_create_params.py @@ -296,11 +296,11 @@ class OptionsCors(TypedDict, total=False): - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain. `"value": ["*"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. `"value": ["domain.com", "second.dom.com"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" header in the response. `"value": ["$http_origin"]` @@ -869,9 +869,9 @@ class OptionsIPAddressACL(TypedDict, total=False): Possible values: - - **allow** - Allow access to all IPs except IPs specified in - "`excepted_values`" field. - - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + - **allow** - Allow access to all IPs except IPs specified in "excepted_values" + field. + - **deny** - Deny access to all IPs except IPs specified in "excepted_values" field. """ diff --git a/src/gcore/types/cdn/resources/rule_replace_params.py b/src/gcore/types/cdn/resources/rule_replace_params.py index 49d31ee5..44a3a9f7 100644 --- a/src/gcore/types/cdn/resources/rule_replace_params.py +++ b/src/gcore/types/cdn/resources/rule_replace_params.py @@ -298,11 +298,11 @@ class OptionsCors(TypedDict, total=False): - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain. `"value": ["*"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. `"value": ["domain.com", "second.dom.com"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" header in the response. `"value": ["$http_origin"]` @@ -871,9 +871,9 @@ class OptionsIPAddressACL(TypedDict, total=False): Possible values: - - **allow** - Allow access to all IPs except IPs specified in - "`excepted_values`" field. - - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + - **allow** - Allow access to all IPs except IPs specified in "excepted_values" + field. + - **deny** - Deny access to all IPs except IPs specified in "excepted_values" field. """ diff --git a/src/gcore/types/cdn/resources/rule_update_params.py b/src/gcore/types/cdn/resources/rule_update_params.py index f604e673..a689c70f 100644 --- a/src/gcore/types/cdn/resources/rule_update_params.py +++ b/src/gcore/types/cdn/resources/rule_update_params.py @@ -298,11 +298,11 @@ class OptionsCors(TypedDict, total=False): - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain. `"value": ["*"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. `"value": ["domain.com", "second.dom.com"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" header in the response. `"value": ["$http_origin"]` @@ -871,9 +871,9 @@ class OptionsIPAddressACL(TypedDict, total=False): Possible values: - - **allow** - Allow access to all IPs except IPs specified in - "`excepted_values`" field. - - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + - **allow** - Allow access to all IPs except IPs specified in "excepted_values" + field. + - **deny** - Deny access to all IPs except IPs specified in "excepted_values" field. """ diff --git a/src/gcore/types/cdn/rule_template.py b/src/gcore/types/cdn/rule_template.py index 17d5656b..12360cca 100644 --- a/src/gcore/types/cdn/rule_template.py +++ b/src/gcore/types/cdn/rule_template.py @@ -220,11 +220,11 @@ class OptionsCors(BaseModel): - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain. `"value": ["*"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. `"value": ["domain.com", "second.dom.com"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" header in the response. `"value": ["$http_origin"]` @@ -793,9 +793,9 @@ class OptionsIPAddressACL(BaseModel): Possible values: - - **allow** - Allow access to all IPs except IPs specified in - "`excepted_values`" field. - - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + - **allow** - Allow access to all IPs except IPs specified in "excepted_values" + field. + - **deny** - Deny access to all IPs except IPs specified in "excepted_values" field. """ diff --git a/src/gcore/types/cdn/rule_template_create_params.py b/src/gcore/types/cdn/rule_template_create_params.py index 4ed1a187..5a000d28 100644 --- a/src/gcore/types/cdn/rule_template_create_params.py +++ b/src/gcore/types/cdn/rule_template_create_params.py @@ -280,11 +280,11 @@ class OptionsCors(TypedDict, total=False): - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain. `"value": ["*"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. `"value": ["domain.com", "second.dom.com"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" header in the response. `"value": ["$http_origin"]` @@ -853,9 +853,9 @@ class OptionsIPAddressACL(TypedDict, total=False): Possible values: - - **allow** - Allow access to all IPs except IPs specified in - "`excepted_values`" field. - - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + - **allow** - Allow access to all IPs except IPs specified in "excepted_values" + field. + - **deny** - Deny access to all IPs except IPs specified in "excepted_values" field. """ diff --git a/src/gcore/types/cdn/rule_template_replace_params.py b/src/gcore/types/cdn/rule_template_replace_params.py index d2904e0a..4af0182e 100644 --- a/src/gcore/types/cdn/rule_template_replace_params.py +++ b/src/gcore/types/cdn/rule_template_replace_params.py @@ -280,11 +280,11 @@ class OptionsCors(TypedDict, total=False): - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain. `"value": ["*"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. `"value": ["domain.com", "second.dom.com"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" header in the response. `"value": ["$http_origin"]` @@ -853,9 +853,9 @@ class OptionsIPAddressACL(TypedDict, total=False): Possible values: - - **allow** - Allow access to all IPs except IPs specified in - "`excepted_values`" field. - - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + - **allow** - Allow access to all IPs except IPs specified in "excepted_values" + field. + - **deny** - Deny access to all IPs except IPs specified in "excepted_values" field. """ diff --git a/src/gcore/types/cdn/rule_template_update_params.py b/src/gcore/types/cdn/rule_template_update_params.py index d5034281..8d45b593 100644 --- a/src/gcore/types/cdn/rule_template_update_params.py +++ b/src/gcore/types/cdn/rule_template_update_params.py @@ -280,11 +280,11 @@ class OptionsCors(TypedDict, total=False): - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain. `"value": ["*"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value if the origin matches one of the listed domains** - Content will be uploaded only for requests from the domains specified in the field. `"value": ["domain.com", "second.dom.com"]` - - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + - **Adds "$http_origin" as the Access-Control-Allow-Origin header value** - Content will be uploaded for requests from any domain, and the domain from which the request was sent will be added to the "Access-Control-Allow-Origin" header in the response. `"value": ["$http_origin"]` @@ -853,9 +853,9 @@ class OptionsIPAddressACL(TypedDict, total=False): Possible values: - - **allow** - Allow access to all IPs except IPs specified in - "`excepted_values`" field. - - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + - **allow** - Allow access to all IPs except IPs specified in "excepted_values" + field. + - **deny** - Deny access to all IPs except IPs specified in "excepted_values" field. """ diff --git a/src/gcore/types/cloud/audit_log_list_params.py b/src/gcore/types/cloud/audit_log_list_params.py index 87bcacce..337403f6 100644 --- a/src/gcore/types/cloud/audit_log_list_params.py +++ b/src/gcore/types/cloud/audit_log_list_params.py @@ -146,7 +146,7 @@ class AuditLogListParams(TypedDict, total=False): """ sorting: Literal["asc", "desc"] - """(DEPRECATED Use '`order_by`' instead) Sorting by timestamp. + """(DEPRECATED Use 'order_by' instead) Sorting by timestamp. Oldest first, or most recent first """ diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index 5d889df8..6a0d6aa9 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -77,8 +77,8 @@ class ServerCreateParams(TypedDict, total=False): When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the - '`user_data`' field to provide a script to create new users on Windows. The - password of the Admin user cannot be updated via '`user_data`'. + 'user_data' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via 'user_data'. """ ssh_key_name: Optional[str] @@ -100,9 +100,9 @@ class ServerCreateParams(TypedDict, total=False): user_data: str """String in base64 format. - For Linux instances, '`user_data`' is ignored when 'password' field is provided. + For Linux instances, 'user_data' is ignored when 'password' field is provided. For Windows instances, Admin user password is set by 'password' field and cannot - be updated via '`user_data`'. Examples of the `user_data`: + be updated via 'user_data'. Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ @@ -362,7 +362,7 @@ class DDOSProfileField(TypedDict, total=False): field_value: object value: Optional[str] - """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class DDOSProfile(TypedDict, total=False): diff --git a/src/gcore/types/cloud/billing_reservation_list_params.py b/src/gcore/types/cloud/billing_reservation_list_params.py index 86c5fed6..3142e04f 100644 --- a/src/gcore/types/cloud/billing_reservation_list_params.py +++ b/src/gcore/types/cloud/billing_reservation_list_params.py @@ -9,7 +9,7 @@ class BillingReservationListParams(TypedDict, total=False): metric_name: str - """Metric name for the resource (e.g., 'bm1-hf-`medium_min`')""" + """Metric name for the resource (e.g., 'bm1-hf-medium_min')""" order_by: Literal["active_from.asc", "active_from.desc", "active_to.asc", "active_to.desc"] """Order by field and direction.""" 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 caddf10c..133a3cc6 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 @@ -380,7 +380,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer(TypedDict, total=F class TagsCondition(TypedDict, total=False): key: str - """The name of the tag to filter (e.g., '`os_version`').""" + """The name of the tag to filter (e.g., 'os_version').""" strict: bool """Determines how strictly the tag value must match the specified value. 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 47cbebd5..df4c1727 100644 --- a/src/gcore/types/cloud/cost_report_get_aggregated_params.py +++ b/src/gcore/types/cloud/cost_report_get_aggregated_params.py @@ -392,7 +392,7 @@ class SchemaFilterSchemaFilterDbaasPostgreSQLPoolerSerializer(TypedDict, total=F class TagsCondition(TypedDict, total=False): key: str - """The name of the tag to filter (e.g., '`os_version`').""" + """The name of the tag to filter (e.g., 'os_version').""" strict: bool """Determines how strictly the tag value must match the specified value. 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 7026096b..86361cf0 100644 --- a/src/gcore/types/cloud/cost_report_get_detailed_params.py +++ b/src/gcore/types/cloud/cost_report_get_detailed_params.py @@ -418,7 +418,7 @@ class Sorting(TypedDict, total=False): class TagsCondition(TypedDict, total=False): key: str - """The name of the tag to filter (e.g., '`os_version`').""" + """The name of the tag to filter (e.g., 'os_version').""" strict: bool """Determines how strictly the tag value must match the specified value. diff --git a/src/gcore/types/cloud/ddos_profile_field.py b/src/gcore/types/cloud/ddos_profile_field.py index f0d03515..0bcfbca1 100644 --- a/src/gcore/types/cloud/ddos_profile_field.py +++ b/src/gcore/types/cloud/ddos_profile_field.py @@ -27,7 +27,7 @@ class DDOSProfileField(BaseModel): """Data type classification of the field (e.g., string, integer, array)""" field_value: object - """Complex value. Only one of 'value' or '`field_value`' must be specified.""" + """Complex value. Only one of 'value' or 'field_value' must be specified.""" name: str """Human-readable name of the protection field""" @@ -41,4 +41,4 @@ class DDOSProfileField(BaseModel): """JSON schema defining validation rules and constraints for the field value""" value: Optional[str] = None - """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" diff --git a/src/gcore/types/cloud/file_share_update_params.py b/src/gcore/types/cloud/file_share_update_params.py index 2df15e25..11745736 100644 --- a/src/gcore/types/cloud/file_share_update_params.py +++ b/src/gcore/types/cloud/file_share_update_params.py @@ -35,20 +35,15 @@ class FileShareUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/floating_ip_update_params.py b/src/gcore/types/cloud/floating_ip_update_params.py index 65e87c02..26bbcd02 100644 --- a/src/gcore/types/cloud/floating_ip_update_params.py +++ b/src/gcore/types/cloud/floating_ip_update_params.py @@ -35,20 +35,15 @@ class FloatingIPUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/gpu_baremetal/cluster_action_params.py b/src/gcore/types/cloud/gpu_baremetal/cluster_action_params.py index 95167930..e3208874 100644 --- a/src/gcore/types/cloud/gpu_baremetal/cluster_action_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/cluster_action_params.py @@ -32,20 +32,15 @@ class ClusterActionParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/gpu_baremetal/cluster_create_params.py b/src/gcore/types/cloud/gpu_baremetal/cluster_create_params.py index 7e407d87..ed821b5d 100644 --- a/src/gcore/types/cloud/gpu_baremetal/cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/cluster_create_params.py @@ -121,7 +121,7 @@ class ServersSettingsCredentials(TypedDict, total=False): """Used to set the password for the specified 'username' on Linux instances. If 'username' is not provided, the password is applied to the default user of - the image. Mutually exclusive with '`user_data`' - only one can be specified. + the image. Mutually exclusive with 'user_data' - only one can be specified. """ ssh_key_name: str diff --git a/src/gcore/types/cloud/gpu_baremetal/clusters/interface_attach_params.py b/src/gcore/types/cloud/gpu_baremetal/clusters/interface_attach_params.py index 43ff9ee3..f3a3c26e 100644 --- a/src/gcore/types/cloud/gpu_baremetal/clusters/interface_attach_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/clusters/interface_attach_params.py @@ -58,10 +58,10 @@ class NewInterfaceExternalExtendSchemaWithDdosddosProfileField(TypedDict, total= """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or '`field_value`' must be specified.""" + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile(TypedDict, total=False): @@ -116,10 +116,10 @@ class NewInterfaceSpecificSubnetSchemaDDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or '`field_value`' must be specified.""" + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceSpecificSubnetSchemaDDOSProfile(TypedDict, total=False): @@ -166,7 +166,7 @@ class NewInterfaceAnySubnetSchema(TypedDict, total=False): """List of security group IDs""" type: str - """Must be '`any_subnet`'""" + """Must be 'any_subnet'""" class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): @@ -177,10 +177,10 @@ class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or '`field_value`' must be specified.""" + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceAnySubnetSchemaDDOSProfile(TypedDict, total=False): @@ -224,7 +224,7 @@ class NewInterfaceReservedFixedIPSchema(TypedDict, total=False): """List of security group IDs""" type: str - """Must be '`reserved_fixed_ip`'. Union tag""" + """Must be 'reserved_fixed_ip'. Union tag""" class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): @@ -235,10 +235,10 @@ class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or '`field_value`' must be specified.""" + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceReservedFixedIPSchemaDDOSProfile(TypedDict, total=False): diff --git a/src/gcore/types/cloud/gpu_virtual/cluster_action_params.py b/src/gcore/types/cloud/gpu_virtual/cluster_action_params.py index a1c0cd75..e620f9ee 100644 --- a/src/gcore/types/cloud/gpu_virtual/cluster_action_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_action_params.py @@ -84,20 +84,15 @@ class UpdateTagsGPUClusterSerializer(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/gpu_virtual/cluster_create_params.py b/src/gcore/types/cloud/gpu_virtual/cluster_create_params.py index f6235455..762e4879 100644 --- a/src/gcore/types/cloud/gpu_virtual/cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_create_params.py @@ -173,7 +173,7 @@ class ServersSettingsCredentials(TypedDict, total=False): """Used to set the password for the specified 'username' on Linux instances. If 'username' is not provided, the password is applied to the default user of - the image. Mutually exclusive with '`user_data`' - only one can be specified. + the image. Mutually exclusive with 'user_data' - only one can be specified. """ ssh_key_name: str diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index e25ccdb9..ee1ba080 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -87,8 +87,8 @@ class InstanceCreateParams(TypedDict, total=False): When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the - '`user_data`' field to provide a script to create new users on Windows. The - password of the Admin user cannot be updated via '`user_data`'. + 'user_data' field to provide a script to create new users on Windows. The + password of the Admin user cannot be updated via 'user_data'. """ security_groups: Iterable[SecurityGroup] @@ -127,9 +127,9 @@ class InstanceCreateParams(TypedDict, total=False): user_data: str """String in base64 format. - For Linux instances, '`user_data`' is ignored when 'password' field is provided. + For Linux instances, 'user_data' is ignored when 'password' field is provided. For Windows instances, Admin user password is set by 'password' field and cannot - be updated via '`user_data`'. Examples of the `user_data`: + be updated via 'user_data'. Examples of the `user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html """ diff --git a/src/gcore/types/cloud/instance_update_params.py b/src/gcore/types/cloud/instance_update_params.py index 78235205..d3c2c7ce 100644 --- a/src/gcore/types/cloud/instance_update_params.py +++ b/src/gcore/types/cloud/instance_update_params.py @@ -32,20 +32,15 @@ class InstanceUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/instances/interface_attach_params.py b/src/gcore/types/cloud/instances/interface_attach_params.py index 43ff9ee3..f3a3c26e 100644 --- a/src/gcore/types/cloud/instances/interface_attach_params.py +++ b/src/gcore/types/cloud/instances/interface_attach_params.py @@ -58,10 +58,10 @@ class NewInterfaceExternalExtendSchemaWithDdosddosProfileField(TypedDict, total= """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or '`field_value`' must be specified.""" + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile(TypedDict, total=False): @@ -116,10 +116,10 @@ class NewInterfaceSpecificSubnetSchemaDDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or '`field_value`' must be specified.""" + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceSpecificSubnetSchemaDDOSProfile(TypedDict, total=False): @@ -166,7 +166,7 @@ class NewInterfaceAnySubnetSchema(TypedDict, total=False): """List of security group IDs""" type: str - """Must be '`any_subnet`'""" + """Must be 'any_subnet'""" class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): @@ -177,10 +177,10 @@ class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or '`field_value`' must be specified.""" + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceAnySubnetSchemaDDOSProfile(TypedDict, total=False): @@ -224,7 +224,7 @@ class NewInterfaceReservedFixedIPSchema(TypedDict, total=False): """List of security group IDs""" type: str - """Must be '`reserved_fixed_ip`'. Union tag""" + """Must be 'reserved_fixed_ip'. Union tag""" class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): @@ -235,10 +235,10 @@ class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): """Name of DDoS profile field""" field_value: object - """Complex value. Only one of 'value' or '`field_value`' must be specified.""" + """Complex value. Only one of 'value' or 'field_value' must be specified.""" value: Optional[str] - """Basic type value. Only one of 'value' or '`field_value`' must be specified.""" + """Basic type value. Only one of 'value' or 'field_value' must be specified.""" class NewInterfaceReservedFixedIPSchemaDDOSProfile(TypedDict, total=False): diff --git a/src/gcore/types/cloud/k8s/cluster_create_params.py b/src/gcore/types/cloud/k8s/cluster_create_params.py index bda1ddee..8f97757c 100644 --- a/src/gcore/types/cloud/k8s/cluster_create_params.py +++ b/src/gcore/types/cloud/k8s/cluster_create_params.py @@ -323,10 +323,10 @@ class DDOSProfileField(TypedDict, total=False): base_field: Required[int] field_value: object - """Complex value. Only one of 'value' or '`field_value`' must be specified""" + """Complex value. Only one of 'value' or 'field_value' must be specified""" value: Optional[str] - """Basic value. Only one of 'value' or '`field_value`' must be specified""" + """Basic value. Only one of 'value' or 'field_value' must be specified""" class DDOSProfile(TypedDict, total=False): diff --git a/src/gcore/types/cloud/k8s/cluster_update_params.py b/src/gcore/types/cloud/k8s/cluster_update_params.py index 137cff46..4216b832 100644 --- a/src/gcore/types/cloud/k8s/cluster_update_params.py +++ b/src/gcore/types/cloud/k8s/cluster_update_params.py @@ -233,10 +233,10 @@ class DDOSProfileField(TypedDict, total=False): base_field: Required[int] field_value: object - """Complex value. Only one of 'value' or '`field_value`' must be specified""" + """Complex value. Only one of 'value' or 'field_value' must be specified""" value: Optional[str] - """Basic value. Only one of 'value' or '`field_value`' must be specified""" + """Basic value. Only one of 'value' or 'field_value' must be specified""" class DDOSProfile(TypedDict, total=False): diff --git a/src/gcore/types/cloud/k8s/k8s_cluster.py b/src/gcore/types/cloud/k8s/k8s_cluster.py index 6296a09b..c219d2fa 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster.py @@ -160,10 +160,10 @@ class DDOSProfileField(BaseModel): base_field: int field_value: Optional[object] = None - """Complex value. Only one of 'value' or '`field_value`' must be specified""" + """Complex value. Only one of 'value' or 'field_value' must be specified""" value: Optional[str] = None - """Basic value. Only one of 'value' or '`field_value`' must be specified""" + """Basic value. Only one of 'value' or 'field_value' must be specified""" class DDOSProfile(BaseModel): diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py index 0b6f23d8..6bd7a916 100644 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -43,20 +43,15 @@ class LoadBalancerUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/network_update_params.py b/src/gcore/types/cloud/network_update_params.py index 8f9f5b85..ab91fcf7 100644 --- a/src/gcore/types/cloud/network_update_params.py +++ b/src/gcore/types/cloud/network_update_params.py @@ -32,20 +32,15 @@ class NetworkUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index 267a9af7..d7a68399 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -50,20 +50,15 @@ class SubnetUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py index e7bde6fe..b2bf4ac8 100644 --- a/src/gcore/types/cloud/region.py +++ b/src/gcore/types/cloud/region.py @@ -25,7 +25,7 @@ class Region(BaseModel): """The access level of the region.""" available_volume_types: Optional[List[str]] = None - """List of available volume types, 'standard', '`ssd_hiiops`', 'cold'].""" + """List of available volume types, 'standard', 'ssd_hiiops', 'cold'].""" coordinates: Optional[Coordinates] = None """Coordinates of the region""" diff --git a/src/gcore/types/cloud/reserved_fixed_ip_create_params.py b/src/gcore/types/cloud/reserved_fixed_ip_create_params.py index 66f352c1..553101d5 100644 --- a/src/gcore/types/cloud/reserved_fixed_ip_create_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ip_create_params.py @@ -56,7 +56,7 @@ class NewReservedFixedIPAnySubnetSerializer(TypedDict, total=False): """Reserved fixed IP will be allocated in a subnet of this network""" type: Required[Literal["any_subnet"]] - """Must be '`any_subnet`'.""" + """Must be 'any_subnet'.""" ip_family: Optional[InterfaceIPFamily] """Which subnets should be selected: IPv4, IPv6 or use dual stack.""" @@ -77,7 +77,7 @@ class NewReservedFixedIPSpecificIPAddressSerializer(TypedDict, total=False): """Reserved fixed IP will be allocated in a subnet of this network""" type: Required[Literal["ip_address"]] - """Must be '`ip_address`'.""" + """Must be 'ip_address'.""" is_vip: bool """If reserved fixed IP is a VIP""" diff --git a/src/gcore/types/cloud/reserved_fixed_ip_list_params.py b/src/gcore/types/cloud/reserved_fixed_ip_list_params.py index 655ef02a..4678f7c5 100644 --- a/src/gcore/types/cloud/reserved_fixed_ip_list_params.py +++ b/src/gcore/types/cloud/reserved_fixed_ip_list_params.py @@ -40,7 +40,7 @@ class ReservedFixedIPListParams(TypedDict, total=False): """ Ordering reserved fixed IP list result by name, status, `updated_at`, `created_at` or `fixed_ip_address` fields and directions (status.asc), default - is "`fixed_ip_address`.asc" + is "fixed_ip_address.asc" """ vip_only: bool diff --git a/src/gcore/types/cloud/security_group_update_params.py b/src/gcore/types/cloud/security_group_update_params.py index 657e9807..a5e34df0 100644 --- a/src/gcore/types/cloud/security_group_update_params.py +++ b/src/gcore/types/cloud/security_group_update_params.py @@ -38,20 +38,15 @@ class SecurityGroupUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index 440e4900..23658f26 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -46,7 +46,7 @@ class TaskListParams(TypedDict, total=False): """ sorting: Literal["asc", "desc"] - """(DEPRECATED Use '`order_by`' instead) Sorting by creation date. + """(DEPRECATED Use 'order_by' instead) Sorting by creation date. Oldest first, or most recent first """ @@ -59,54 +59,49 @@ class TaskListParams(TypedDict, total=False): task_type: str """ - Filter the tasks by their type one of ['`activate_ddos_profile`', - '`attach_bm_to_reserved_fixed_ip`', '`attach_vm_interface`', - '`attach_vm_to_reserved_fixed_ip`', '`attach_volume`', - '`create_ai_cluster_gpu`', '`create_bm`', '`create_caas_container`', - '`create_dbaas_postgres_cluster`', '`create_ddos_profile`', - '`create_faas_function`', '`create_faas_namespace`', '`create_fip`', - '`create_gpu_virtual_cluster`', '`create_image`', - '`create_inference_application`', '`create_inference_instance`', - '`create_k8s_cluster_pool_v2`', '`create_k8s_cluster_v2`', '`create_l7policy`', - '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', - '`create_lbpool`', '`create_lbpool_health_monitor`', '`create_loadbalancer`', - '`create_network`', '`create_reserved_fixed_ip`', '`create_router`', - '`create_secret`', '`create_security_group`', '`create_servergroup`', - '`create_sfs`', '`create_snapshot`', '`create_subnet`', '`create_vm`', - '`create_volume`', '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', - '`delete_caas_container`', '`delete_dbaas_postgres_cluster`', - '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', - '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', - '`delete_image`', '`delete_inference_application`', - '`delete_inference_instance`', '`delete_k8s_cluster_pool_v2`', - '`delete_k8s_cluster_v2`', '`delete_l7policy`', '`delete_l7rule`', - '`delete_lblistener`', '`delete_lbmember`', '`delete_lbmetadata`', - '`delete_lbpool`', '`delete_loadbalancer`', '`delete_network`', - '`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_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`', - '`soft_reboot_gpu_virtual_server`', '`soft_reboot_vm`', - '`start_gpu_baremetal_server`', '`start_gpu_virtual_cluster`', - '`start_gpu_virtual_server`', '`start_vm`', '`stop_gpu_baremetal_server`', - '`stop_gpu_virtual_cluster`', '`stop_gpu_virtual_server`', '`stop_vm`', - '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', - '`update_floating_ip`', '`update_inference_application`', - '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_l7policy`', - '`update_lbmetadata`', '`update_port_allowed_address_pairs`', '`update_router`', - '`update_security_group`', '`update_sfs`', '`update_tags_gpu_virtual_cluster`', - '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', - '`upscale_gpu_virtual_cluster`'] + Filter the tasks by their type one of ['activate_ddos_profile', + 'attach_bm_to_reserved_fixed_ip', 'attach_vm_interface', + 'attach_vm_to_reserved_fixed_ip', 'attach_volume', 'create_ai_cluster_gpu', + 'create_bm', 'create_caas_container', 'create_dbaas_postgres_cluster', + 'create_ddos_profile', 'create_faas_function', 'create_faas_namespace', + 'create_fip', 'create_gpu_virtual_cluster', 'create_image', + 'create_inference_application', 'create_inference_instance', + 'create_k8s_cluster_pool_v2', 'create_k8s_cluster_v2', 'create_l7policy', + 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', + 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', + 'create_reserved_fixed_ip', 'create_router', 'create_secret', + 'create_security_group', 'create_servergroup', 'create_sfs', 'create_snapshot', + 'create_subnet', 'create_vm', 'create_volume', 'deactivate_ddos_profile', + 'delete_ai_cluster_gpu', 'delete_caas_container', + 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', + 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', + 'delete_gpu_virtual_server', 'delete_image', 'delete_inference_application', + 'delete_inference_instance', 'delete_k8s_cluster_pool_v2', + 'delete_k8s_cluster_v2', 'delete_l7policy', 'delete_l7rule', + 'delete_lblistener', 'delete_lbmember', 'delete_lbmetadata', 'delete_lbpool', + 'delete_loadbalancer', 'delete_network', '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_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', 'soft_reboot_gpu_virtual_server', + 'soft_reboot_vm', 'start_gpu_baremetal_server', 'start_gpu_virtual_cluster', + 'start_gpu_virtual_server', 'start_vm', 'stop_gpu_baremetal_server', + 'stop_gpu_virtual_cluster', 'stop_gpu_virtual_server', 'stop_vm', 'suspend_vm', + 'sync_private_flavors', 'update_ddos_profile', 'update_floating_ip', + 'update_inference_application', 'update_inference_instance', + 'update_k8s_cluster_v2', 'update_l7policy', 'update_lbmetadata', + 'update_port_allowed_address_pairs', 'update_router', 'update_security_group', + '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], PropertyInfo(format="iso8601")] diff --git a/src/gcore/types/cloud/usage_report_get_params.py b/src/gcore/types/cloud/usage_report_get_params.py index 7af78190..6f5b1af2 100644 --- a/src/gcore/types/cloud/usage_report_get_params.py +++ b/src/gcore/types/cloud/usage_report_get_params.py @@ -412,7 +412,7 @@ class Sorting(TypedDict, total=False): class TagsCondition(TypedDict, total=False): key: str - """The name of the tag to filter (e.g., '`os_version`').""" + """The name of the tag to filter (e.g., 'os_version').""" strict: bool """Determines how strictly the tag value must match the specified value. diff --git a/src/gcore/types/cloud/volume_snapshot_update_params.py b/src/gcore/types/cloud/volume_snapshot_update_params.py index 5e279e7e..7ac318f9 100644 --- a/src/gcore/types/cloud/volume_snapshot_update_params.py +++ b/src/gcore/types/cloud/volume_snapshot_update_params.py @@ -35,20 +35,15 @@ class VolumeSnapshotUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/cloud/volume_update_params.py b/src/gcore/types/cloud/volume_update_params.py index 09cf5e3f..a81d36f1 100644 --- a/src/gcore/types/cloud/volume_update_params.py +++ b/src/gcore/types/cloud/volume_update_params.py @@ -32,20 +32,15 @@ class VolumeUpdateParams(TypedDict, total=False): - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or updates existing ones. - - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. - - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only tags are preserved). - - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates specified tags. - - **Mixed operations:** `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` - adds/updates 'environment' and '`cost_center`' while removing - '`deprecated_tag`', preserving other existing tags. - + adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', + preserving other existing tags. - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ diff --git a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py index 11b0629a..500bc907 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py +++ b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py @@ -10,7 +10,7 @@ class AIContentmoderationHardnudity(BaseModel): category: Literal["hard_nudity", "sport", "nsfw", "soft_nudity"] - """AI content moderation with "`hard_nudity`" algorithm""" + """AI content moderation with "hard_nudity" algorithm""" task_name: Literal["content-moderation"] """Name of the task to be performed""" diff --git a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py index ebfb6a59..1fdd19b2 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py +++ b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py @@ -10,7 +10,7 @@ class AIContentmoderationSoftnudity(BaseModel): category: Literal["soft_nudity", "sport", "nsfw", "hard_nudity"] - """AI content moderation with "`soft_nudity`" algorithm""" + """AI content moderation with "soft_nudity" algorithm""" task_name: Literal["content-moderation"] """Name of the task to be performed""" diff --git a/src/gcore/types/streaming/ai_task.py b/src/gcore/types/streaming/ai_task.py index f5f3c6e7..7d677e33 100644 --- a/src/gcore/types/streaming/ai_task.py +++ b/src/gcore/types/streaming/ai_task.py @@ -163,7 +163,7 @@ class TaskDataAITranscribe(BaseModel): subtitles_language: Optional[str] = None """ Indicates which language it is clearly necessary to translate into. If this is - not set, the original language will be used from attribute "`audio_language`". + not set, the original language will be used from attribute "audio_language". Please note that: diff --git a/src/gcore/types/streaming/ai_task_create_params.py b/src/gcore/types/streaming/ai_task_create_params.py index cbf354f3..e336f45f 100644 --- a/src/gcore/types/streaming/ai_task_create_params.py +++ b/src/gcore/types/streaming/ai_task_create_params.py @@ -164,7 +164,7 @@ class AITaskCreateParams(TypedDict, total=False): subtitles_language: str """ Indicates which language it is clearly necessary to translate into. If this is - not set, the original language will be used from attribute "`audio_language`". + not set, the original language will be used from attribute "audio_language". Please note that: diff --git a/src/gcore/types/streaming/ai_task_list_params.py b/src/gcore/types/streaming/ai_task_list_params.py index 8fe3d727..f449705d 100644 --- a/src/gcore/types/streaming/ai_task_list_params.py +++ b/src/gcore/types/streaming/ai_task_list_params.py @@ -19,8 +19,7 @@ class AITaskListParams(TypedDict, total=False): Which field to use when ordering the results: `task_id`, status, and `task_name`. Sorting is done in ascending (ASC) order. - If parameter is omitted then "`started_at` DESC" is used for ordering by - default. + If parameter is omitted then "started_at DESC" is used for ordering by default. """ page: int diff --git a/src/gcore/types/streaming/clip.py b/src/gcore/types/streaming/clip.py index b29471a8..3cab9cc9 100644 --- a/src/gcore/types/streaming/clip.py +++ b/src/gcore/types/streaming/clip.py @@ -24,7 +24,7 @@ class Clip(BaseModel): can be added to left and right. Duration of cutted segment cannot be greater than DVR duration for this stream. - Therefore, to change the maximum, use "`dvr_duration`" parameter of this stream. + Therefore, to change the maximum, use "dvr_duration" parameter of this stream. """ created_at: Optional[str] = None @@ -56,7 +56,7 @@ class Clip(BaseModel): """Link to HLS .m3u8 with immediate clip. The link retains same adaptive bitrate as in the stream for end viewers. For - additional restrictions, see the description of parameter "`mp4_master`". + additional restrictions, see the description of parameter "mp4_master". """ mp4_master: Optional[str] = None diff --git a/src/gcore/types/streaming/create_video_param.py b/src/gcore/types/streaming/create_video_param.py index 111f0095..bb4b74bc 100644 --- a/src/gcore/types/streaming/create_video_param.py +++ b/src/gcore/types/streaming/create_video_param.py @@ -106,15 +106,15 @@ class CreateVideoParam(TypedDict, total=False): """Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file - (specified in "`origin_url`" parameter) on an external server. + (specified in "origin_url" parameter) on an external server. Syntax: `Authorization: ` Examples: - - "`origin_http_headers`": "Authorization: Basic ..." - - "`origin_http_headers`": "Authorization: Bearer ..." - - "`origin_http_headers`": "Authorization: APIKey ..." Example of usage when + - "origin_http_headers": "Authorization: Basic ..." + - "origin_http_headers": "Authorization: Bearer ..." + - "origin_http_headers": "Authorization: APIKey ..." Example of usage when downloading a file from Google Drive: ``` @@ -141,7 +141,7 @@ class CreateVideoParam(TypedDict, total=False): After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own - image. Also use attribute "`screenshot_id`" to select poster as a default + image. Also use attribute "screenshot_id" to select poster as a default screnshot. Attribute accepts single image as base64-encoded string diff --git a/src/gcore/types/streaming/playlist.py b/src/gcore/types/streaming/playlist.py index a6349c50..495c206d 100644 --- a/src/gcore/types/streaming/playlist.py +++ b/src/gcore/types/streaming/playlist.py @@ -33,7 +33,7 @@ class Playlist(BaseModel): Chunks are in fMP4 container. - It is possible to use the same suffix-options as described in the "`hls_url`" + It is possible to use the same suffix-options as described in the "hls_url" attribute. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented diff --git a/src/gcore/types/streaming/playlist_create_params.py b/src/gcore/types/streaming/playlist_create_params.py index c393d54f..f9102a3f 100644 --- a/src/gcore/types/streaming/playlist_create_params.py +++ b/src/gcore/types/streaming/playlist_create_params.py @@ -33,7 +33,7 @@ class PlaylistCreateParams(TypedDict, total=False): Chunks are in fMP4 container. - It is possible to use the same suffix-options as described in the "`hls_url`" + It is possible to use the same suffix-options as described in the "hls_url" attribute. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented diff --git a/src/gcore/types/streaming/playlist_update_params.py b/src/gcore/types/streaming/playlist_update_params.py index ec9e9fd2..10fe4362 100644 --- a/src/gcore/types/streaming/playlist_update_params.py +++ b/src/gcore/types/streaming/playlist_update_params.py @@ -33,7 +33,7 @@ class PlaylistUpdateParams(TypedDict, total=False): Chunks are in fMP4 container. - It is possible to use the same suffix-options as described in the "`hls_url`" + It is possible to use the same suffix-options as described in the "hls_url" attribute. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented diff --git a/src/gcore/types/streaming/playlist_video.py b/src/gcore/types/streaming/playlist_video.py index d271fb3b..e8762a5e 100644 --- a/src/gcore/types/streaming/playlist_video.py +++ b/src/gcore/types/streaming/playlist_video.py @@ -107,15 +107,15 @@ class PlaylistVideo(BaseModel): """Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file - (specified in "`origin_url`" parameter) on an external server. + (specified in "origin_url" parameter) on an external server. Syntax: `Authorization: ` Examples: - - "`origin_http_headers`": "Authorization: Basic ..." - - "`origin_http_headers`": "Authorization: Bearer ..." - - "`origin_http_headers`": "Authorization: APIKey ..." Example of usage when + - "origin_http_headers": "Authorization: Basic ..." + - "origin_http_headers": "Authorization: Bearer ..." + - "origin_http_headers": "Authorization: APIKey ..." Example of usage when downloading a file from Google Drive: ``` @@ -142,7 +142,7 @@ class PlaylistVideo(BaseModel): After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own - image. Also use attribute "`screenshot_id`" to select poster as a default + image. Also use attribute "screenshot_id" to select poster as a default screnshot. Attribute accepts single image as base64-encoded string diff --git a/src/gcore/types/streaming/statistic_get_live_unique_viewers_params.py b/src/gcore/types/streaming/statistic_get_live_unique_viewers_params.py index 7766326f..76f5fad1 100644 --- a/src/gcore/types/streaming/statistic_get_live_unique_viewers_params.py +++ b/src/gcore/types/streaming/statistic_get_live_unique_viewers_params.py @@ -17,10 +17,10 @@ class StatisticGetLiveUniqueViewersParams(TypedDict, total=False): """End of time frame. Format is date time in ISO 8601""" client_user_id: int - """Filter by "`client_user_id`" """ + """Filter by "client_user_id" """ granularity: Literal["1m", "5m", "15m", "1h", "1d"] """Specifies the time interval for grouping data""" stream_id: int - """Filter by "`stream_id`" """ + """Filter by "stream_id" """ diff --git a/src/gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py b/src/gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py index c7178616..74e37c52 100644 --- a/src/gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py +++ b/src/gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py @@ -17,7 +17,7 @@ class StatisticGetLiveWatchTimeCdnParams(TypedDict, total=False): """ client_user_id: int - """Filter by field "`client_user_id`" """ + """Filter by field "client_user_id" """ granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] """Data is grouped by the specified time interval""" diff --git a/src/gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py b/src/gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py index 8ba977d6..0711a555 100644 --- a/src/gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py +++ b/src/gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py @@ -11,7 +11,7 @@ class StatisticGetLiveWatchTimeTotalCdnParams(TypedDict, total=False): client_user_id: int - """Filter by field "`client_user_id`" """ + """Filter by field "client_user_id" """ from_: Annotated[str, PropertyInfo(alias="from")] """Start of the time period for counting minutes of watching. diff --git a/src/gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py b/src/gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py index 83869ae2..f7af2996 100644 --- a/src/gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py +++ b/src/gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py @@ -17,7 +17,7 @@ class StatisticGetVodWatchTimeCdnParams(TypedDict, total=False): """ client_user_id: int - """Filter by field "`client_user_id`" """ + """Filter by field "client_user_id" """ granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] """Data is grouped by the specified time interval""" diff --git a/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py b/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py index dc7271d3..2599d8bd 100644 --- a/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py +++ b/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py @@ -11,7 +11,7 @@ class StatisticGetVodWatchTimeTotalCdnParams(TypedDict, total=False): client_user_id: int - """Filter by field "`client_user_id`" """ + """Filter by field "client_user_id" """ from_: Annotated[str, PropertyInfo(alias="from")] """Start of the time period for counting minutes of watching. diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py index c467567c..e096496b 100644 --- a/src/gcore/types/streaming/stream.py +++ b/src/gcore/types/streaming/stream.py @@ -57,7 +57,7 @@ class Stream(BaseModel): backup_live: Optional[bool] = None """ State of receiving and transcoding master stream from source by backup server if - you pushing stream to "`backup_push_url`" or "`backup_push_url_srt`". + you pushing stream to "backup_push_url" or "backup_push_url_srt". Displays the backup server status of PUSH method only. For PULL a "live" field is always used, even when origin servers are switched using round robin @@ -191,8 +191,8 @@ class Stream(BaseModel): - and its possible to enable ±3 sec for LL-HLS, just ask our Support Team. It is also possible to use modifier-attributes, which are described in the - "`hls_mpegts_url`" field above. If you need to get MPEG-TS (.ts) chunks, look at - the attribute "`hls_mpegts_url`". + "hls_mpegts_url" field above. If you need to get MPEG-TS (.ts) chunks, look at + the attribute "hls_mpegts_url". Read more information in the article "How Low Latency streaming works" in the Knowledge Base. @@ -215,7 +215,7 @@ class Stream(BaseModel): Some legacy devices or software may require MPEG-TS (.ts) segments as a format for streaming, so we provide this options keeping backward compatibility with any of your existing workflows. For other cases it's better to use - "`hls_cmaf_url`" instead. + "hls_cmaf_url" instead. You can use this legacy HLSv6 format based on MPEG-TS segmenter in parallel with main HLS CMAF. Both formats are sharing same segments size, manifest length @@ -225,9 +225,9 @@ class Stream(BaseModel): - ?`get_duration_sec`=true – Adds the real segment duration in seconds to chunk requests. A chunk duration will be automatically added to a chunk request - string with the "`duration_sec`" attribute. The value is an integer for a - length multiple of whole seconds, or a fractional number separated by a dot - for chunks that are not multiples of seconds. This attribute allows you to + string with the "duration_sec" attribute. The value is an integer for a length + multiple of whole seconds, or a fractional number separated by a dot for + chunks that are not multiples of seconds. This attribute allows you to determine duration in seconds at the level of analyzing the logs of CDN requests and compare it with file size (so to use it in your analytics). @@ -264,8 +264,8 @@ class Stream(BaseModel): It can be inserted into an iframe on your website and the video will automatically play in all browsers. - Please, remember that transcoded streams from "`hls_cmaf_url`" with .m3u8 at the - end, and from "`dash_url`" with .mpd at the end are to be played inside video + Please, remember that transcoded streams from "hls_cmaf_url" with .m3u8 at the + end, and from "dash_url" with .mpd at the end are to be played inside video players only. For example: AVplayer on iOS, Exoplayer on Android, HTML web player in browser, etc. General bowsers like Chrome, Firefox, etc cannot play transcoded streams with .m3u8 and .mpd at the end. The only exception is Safari, @@ -339,9 +339,9 @@ class Stream(BaseModel): For advanced customers only: For your complexly distributed broadcast systems, it is also possible to additionally output an array of multi-regional ingestion points for manual selection from them. To activate this mode, contact your - manager or the Support Team to activate the "`multi_region_push_urls`" attibute. + manager or the Support Team to activate the "multi_region_push_urls" attibute. But if you clearly don’t understand why you need this, then it’s best to use the - default single URL in the "`push_url`" attribute. + default single URL in the "push_url" attribute. """ push_url_srt: Optional[str] = None @@ -527,7 +527,7 @@ class Stream(BaseModel): requests and the stream is deactivated (the "active" field switches to "false"). Please, note that this field is for PULL only, so is not suitable for PUSH. Look - at fields "`push_url`" and "`push_url_srt`" from GET method. + at fields "push_url" and "push_url_srt" from GET method. """ video_height: Optional[float] = None diff --git a/src/gcore/types/streaming/stream_create_clip_params.py b/src/gcore/types/streaming/stream_create_clip_params.py index 5440a13d..2a2f365a 100644 --- a/src/gcore/types/streaming/stream_create_clip_params.py +++ b/src/gcore/types/streaming/stream_create_clip_params.py @@ -21,7 +21,7 @@ class StreamCreateClipParams(TypedDict, total=False): can be added to left and right. Duration of cutted segment cannot be greater than DVR duration for this stream. - Therefore, to change the maximum, use "`dvr_duration`" parameter of this stream. + Therefore, to change the maximum, use "dvr_duration" parameter of this stream. """ expiration: int diff --git a/src/gcore/types/streaming/stream_create_params.py b/src/gcore/types/streaming/stream_create_params.py index 50513e7d..565c9dcb 100644 --- a/src/gcore/types/streaming/stream_create_params.py +++ b/src/gcore/types/streaming/stream_create_params.py @@ -164,5 +164,5 @@ class StreamCreateParams(TypedDict, total=False): requests and the stream is deactivated (the "active" field switches to "false"). Please, note that this field is for PULL only, so is not suitable for PUSH. Look - at fields "`push_url`" and "`push_url_srt`" from GET method. + at fields "push_url" and "push_url_srt" from GET method. """ diff --git a/src/gcore/types/streaming/stream_update_params.py b/src/gcore/types/streaming/stream_update_params.py index da6d8478..f880f872 100644 --- a/src/gcore/types/streaming/stream_update_params.py +++ b/src/gcore/types/streaming/stream_update_params.py @@ -168,5 +168,5 @@ class Stream(TypedDict, total=False): requests and the stream is deactivated (the "active" field switches to "false"). Please, note that this field is for PULL only, so is not suitable for PUSH. Look - at fields "`push_url`" and "`push_url_srt`" from GET method. + at fields "push_url" and "push_url_srt" from GET method. """ diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py index 23830bad..c12c6453 100644 --- a/src/gcore/types/streaming/video.py +++ b/src/gcore/types/streaming/video.py @@ -220,7 +220,7 @@ class Video(BaseModel): return just 1 video codec in a manifest. Read the Product Documentation for details. - Read more what is ABR soft-limiting in the "`hls_url`" field above. + Read more what is ABR soft-limiting in the "hls_url" field above. Caution. Solely master.mpd is officially documented and intended for your use. Any additional internal manifests, sub-manifests, parameters, chunk names, file @@ -235,9 +235,8 @@ class Video(BaseModel): duration: Optional[int] = None """Video duration in milliseconds. - May differ from "`origin_video_duration`" value if the video was uploaded with - clipping through the parameters "`clip_start_seconds`" and - "`clip_duration_seconds`" + May differ from "origin_video_duration" value if the video was uploaded with + clipping through the parameters "clip_start_seconds" and "clip_duration_seconds" """ error: Optional[str] = None @@ -249,7 +248,7 @@ class Video(BaseModel): Chunks are in fMP4 container. It's a code-agnostic container, which allows to use any like H264, H265, AV1, etc. - It is possible to use the same suffix-options as described in the "`hls_url`" + It is possible to use the same suffix-options as described in the "hls_url" attribute. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented @@ -366,7 +365,7 @@ class Video(BaseModel): URL to the original non-transcoded stream recording with original quality, saved in MP4 format. File is created immediately after the completion of the stream recording. The stream from which the recording was made is reflected in - "`stream_id`" field. + "stream_id" field. Can be used for internal operations when a recording needs to be received faster than the transcoded versions are ready. But this version is not intended for @@ -515,6 +514,5 @@ class Video(BaseModel): """ Number of video views through the built-in HTML video player of the Streaming Platform only. This attribute does not count views from other external players - and native OS players, so here may be less number of views than in - "`cdn_views`". + and native OS players, so here may be less number of views than in "cdn_views". """ diff --git a/src/gcore/types/streaming/video_list_params.py b/src/gcore/types/streaming/video_list_params.py index 91cc9504..3d39e7e9 100644 --- a/src/gcore/types/streaming/video_list_params.py +++ b/src/gcore/types/streaming/video_list_params.py @@ -16,7 +16,7 @@ class VideoListParams(TypedDict, total=False): """ client_user_id: int - """Find videos where "`client_user_id`" meta field is equal to the search value""" + """Find videos where "client_user_id" meta field is equal to the search value""" fields: str """ @@ -56,6 +56,6 @@ class VideoListParams(TypedDict, total=False): stream_id: int """ - Find videos recorded from a specific stream, so for which "`stream_id`" field is + Find videos recorded from a specific stream, so for which "stream_id" field is equal to the search value """ diff --git a/src/gcore/types/streaming/video_update_params.py b/src/gcore/types/streaming/video_update_params.py index d1ad1c8a..72244d21 100644 --- a/src/gcore/types/streaming/video_update_params.py +++ b/src/gcore/types/streaming/video_update_params.py @@ -106,15 +106,15 @@ class VideoUpdateParams(TypedDict, total=False): """Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file - (specified in "`origin_url`" parameter) on an external server. + (specified in "origin_url" parameter) on an external server. Syntax: `Authorization: ` Examples: - - "`origin_http_headers`": "Authorization: Basic ..." - - "`origin_http_headers`": "Authorization: Bearer ..." - - "`origin_http_headers`": "Authorization: APIKey ..." Example of usage when + - "origin_http_headers": "Authorization: Basic ..." + - "origin_http_headers": "Authorization: Bearer ..." + - "origin_http_headers": "Authorization: APIKey ..." Example of usage when downloading a file from Google Drive: ``` @@ -141,7 +141,7 @@ class VideoUpdateParams(TypedDict, total=False): After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own - image. Also use attribute "`screenshot_id`" to select poster as a default + image. Also use attribute "screenshot_id" to select poster as a default screnshot. Attribute accepts single image as base64-encoded string 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 7eb0bf01..5ce72816 100644 --- a/src/gcore/types/waap/domains/advanced_rule_create_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_create_params.py @@ -42,10 +42,10 @@ class AdvancedRuleCreateParams(TypedDict, total=False): The "access" phase is responsible for modifying the request before it is sent to the origin server. - The "`header_filter`" phase is responsible for modifying the HTTP headers of a + The "header_filter" phase is responsible for modifying the HTTP headers of a response before they are sent back to the client. - The "`body_filter`" phase is responsible for modifying the body of a response + The "body_filter" phase is responsible for modifying the body of a response before it is sent back to the client. """ diff --git a/src/gcore/types/waap/domains/advanced_rule_list_params.py b/src/gcore/types/waap/domains/advanced_rule_list_params.py index dfa975c3..301d3eb4 100644 --- a/src/gcore/types/waap/domains/advanced_rule_list_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_list_params.py @@ -51,9 +51,9 @@ class AdvancedRuleListParams(TypedDict, total=False): The "access" phase is responsible for modifying the request before it is sent to the origin server. - The "`header_filter`" phase is responsible for modifying the HTTP headers of a + The "header_filter" phase is responsible for modifying the HTTP headers of a response before they are sent back to the client. - The "`body_filter`" phase is responsible for modifying the body of a response + The "body_filter" phase is responsible for modifying the body of a response before it is sent back to the client. """ diff --git a/src/gcore/types/waap/domains/advanced_rule_update_params.py b/src/gcore/types/waap/domains/advanced_rule_update_params.py index 7c191c34..60d061bf 100644 --- a/src/gcore/types/waap/domains/advanced_rule_update_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_update_params.py @@ -32,10 +32,10 @@ class AdvancedRuleUpdateParams(TypedDict, total=False): The "access" phase is responsible for modifying the request before it is sent to the origin server. - The "`header_filter`" phase is responsible for modifying the HTTP headers of a + The "header_filter" phase is responsible for modifying the HTTP headers of a response before they are sent back to the client. - The "`body_filter`" phase is responsible for modifying the body of a response + The "body_filter" phase is responsible for modifying the body of a response before it is sent back to the client. """ diff --git a/src/gcore/types/waap/domains/waap_advanced_rule.py b/src/gcore/types/waap/domains/waap_advanced_rule.py index 22450b73..feb436a2 100644 --- a/src/gcore/types/waap/domains/waap_advanced_rule.py +++ b/src/gcore/types/waap/domains/waap_advanced_rule.py @@ -97,9 +97,9 @@ class WaapAdvancedRule(BaseModel): The "access" phase is responsible for modifying the request before it is sent to the origin server. - The "`header_filter`" phase is responsible for modifying the HTTP headers of a + The "header_filter" phase is responsible for modifying the HTTP headers of a response before they are sent back to the client. - The "`body_filter`" phase is responsible for modifying the body of a response + The "body_filter" phase is responsible for modifying the body of a response before it is sent back to the client. """ From aae885e99c59fac588fc49876137617a0a41b5d8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 21 Jan 2026 07:12:23 +0000 Subject: [PATCH 527/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index c9b17f00..3e1c7d76 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c7e3eef675823dc3086f453b19b47767f397b5d35025dad732385af58fd40cf3.yml openapi_spec_hash: 5bac6ca287a624aff4e02ff42ec6e1e8 -config_hash: e9e5b750687e9071d8b606963f0ffd6d +config_hash: 996ba8cc60f19c649295ad760fa65f4d From ade3bdaf06a55c189ac71968c91e42c530058393 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 21 Jan 2026 12:17:34 +0000 Subject: [PATCH 528/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3e1c7d76..72e2d60a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-c7e3eef675823dc3086f453b19b47767f397b5d35025dad732385af58fd40cf3.yml -openapi_spec_hash: 5bac6ca287a624aff4e02ff42ec6e1e8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0b43447006c25c6f1f8a22bcf432f45366c701a769a8823b3aebcecef033a456.yml +openapi_spec_hash: 16ee8caad4ee1fbb5bcbc29bb2cf93c3 config_hash: 996ba8cc60f19c649295ad760fa65f4d From 012b2fbbc9a290e5f6de67db8b0085977e8d81d8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 Jan 2026 06:15:04 +0000 Subject: [PATCH 529/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 72e2d60a..8115a657 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0b43447006c25c6f1f8a22bcf432f45366c701a769a8823b3aebcecef033a456.yml -openapi_spec_hash: 16ee8caad4ee1fbb5bcbc29bb2cf93c3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2d64161889a53046ca5e593a772328a5290246c3d74f8c07fed1037feae1bdbc.yml +openapi_spec_hash: 2360d25764d74e6972cf600fcd20fd4e config_hash: 996ba8cc60f19c649295ad760fa65f4d From b58f73a35c2dd0c4f6015e5be863b19e76cfbd55 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 Jan 2026 12:21:19 +0000 Subject: [PATCH 530/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 8115a657..f6bc2e9b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2d64161889a53046ca5e593a772328a5290246c3d74f8c07fed1037feae1bdbc.yml openapi_spec_hash: 2360d25764d74e6972cf600fcd20fd4e -config_hash: 996ba8cc60f19c649295ad760fa65f4d +config_hash: e9e5b750687e9071d8b606963f0ffd6d From 4f09827540adb923a4ae10ccf56dd5950f989a4c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 Jan 2026 15:38:37 +0000 Subject: [PATCH 531/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b8dda9bf..554e34bb 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.29.0" + ".": "0.30.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 0da1bfa0..281c75fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.29.0" +version = "0.30.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 606d0626..574d5dd3 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.29.0" # x-release-please-version +__version__ = "0.30.0" # x-release-please-version From d34fc9988dd026e1af8c8c0add8931477c5554d2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 23 Jan 2026 15:39:30 +0000 Subject: [PATCH 532/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f6bc2e9b..4d056b8b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2d64161889a53046ca5e593a772328a5290246c3d74f8c07fed1037feae1bdbc.yml -openapi_spec_hash: 2360d25764d74e6972cf600fcd20fd4e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-61da4ea9147efbd920bf7eb3e4c790787145f67e9e119a5269a358d48fa83d92.yml +openapi_spec_hash: 49f7e7bd1cde8953248eecea9ecc84df config_hash: e9e5b750687e9071d8b606963f0ffd6d From 8dee96c3724ea6584e22f35d44eb26dcdf3668bf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 23 Jan 2026 18:15:12 +0000 Subject: [PATCH 533/592] chore(ci): upgrade `actions/github-script` --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21d8baf0..30235252 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: - name: Get GitHub OIDC Token if: github.repository == 'stainless-sdks/gcore-python' id: github-oidc - uses: actions/github-script@v6 + uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); From 204feb88cce79e116c4d020058725cbeb4b5d4d1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 26 Jan 2026 08:15:06 +0000 Subject: [PATCH 534/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cdn/cdn_resource.py | 9 +++++++-- src/gcore/types/cdn/resource_create_params.py | 9 +++++++-- src/gcore/types/cdn/resource_replace_params.py | 9 +++++++-- src/gcore/types/cdn/resource_update_params.py | 9 +++++++-- src/gcore/types/cdn/resources/cdn_resource_rule.py | 9 +++++++-- src/gcore/types/cdn/resources/rule_create_params.py | 9 +++++++-- src/gcore/types/cdn/resources/rule_replace_params.py | 9 +++++++-- src/gcore/types/cdn/resources/rule_update_params.py | 9 +++++++-- src/gcore/types/cdn/rule_template.py | 9 +++++++-- src/gcore/types/cdn/rule_template_create_params.py | 9 +++++++-- src/gcore/types/cdn/rule_template_replace_params.py | 9 +++++++-- src/gcore/types/cdn/rule_template_update_params.py | 9 +++++++-- tests/api_resources/cdn/resources/test_rules.py | 12 ++++++------ tests/api_resources/cdn/test_resources.py | 12 ++++++------ tests/api_resources/cdn/test_rule_templates.py | 12 ++++++------ 16 files changed, 104 insertions(+), 44 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4d056b8b..cd2e413f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-61da4ea9147efbd920bf7eb3e4c790787145f67e9e119a5269a358d48fa83d92.yml -openapi_spec_hash: 49f7e7bd1cde8953248eecea9ecc84df +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-dc42eef367287a7e7bcd1a562a519594fd3ac1b50ee86cfd8c6337b334dfbf25.yml +openapi_spec_hash: e72c6e3d4a64c6fc34a6b73431e65fba config_hash: e9e5b750687e9071d8b606963f0ffd6d diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py index a1066729..760e9ee1 100644 --- a/src/gcore/types/cdn/cdn_resource.py +++ b/src/gcore/types/cdn/cdn_resource.py @@ -790,6 +790,7 @@ 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) """ @@ -1592,6 +1593,9 @@ class OptionsUserAgentACL(BaseModel): - **allow** - List of User-Agents for which access is prohibited. - **deny** - List of User-Agents for which access is allowed. + You can provide exact User-Agent strings or regular expressions. Regular + expressions must start with `~` (case-sensitive) or `~*` (case-insensitive). + Use an empty string `""` to allow/deny access when the User-Agent header is empty. """ @@ -1823,8 +1827,9 @@ class Options(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. + 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) """ diff --git a/src/gcore/types/cdn/resource_create_params.py b/src/gcore/types/cdn/resource_create_params.py index 09c122d2..743fba2a 100644 --- a/src/gcore/types/cdn/resource_create_params.py +++ b/src/gcore/types/cdn/resource_create_params.py @@ -913,6 +913,7 @@ 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) """ @@ -1713,6 +1714,9 @@ class OptionsUserAgentACL(TypedDict, total=False): - **allow** - List of User-Agents for which access is prohibited. - **deny** - List of User-Agents for which access is allowed. + You can provide exact User-Agent strings or regular expressions. Regular + expressions must start with `~` (case-sensitive) or `~*` (case-insensitive). + Use an empty string `""` to allow/deny access when the User-Agent header is empty. """ @@ -1944,8 +1948,9 @@ class Options(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. + 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) """ diff --git a/src/gcore/types/cdn/resource_replace_params.py b/src/gcore/types/cdn/resource_replace_params.py index e1ab08b8..fb57bb77 100644 --- a/src/gcore/types/cdn/resource_replace_params.py +++ b/src/gcore/types/cdn/resource_replace_params.py @@ -891,6 +891,7 @@ 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) """ @@ -1691,6 +1692,9 @@ class OptionsUserAgentACL(TypedDict, total=False): - **allow** - List of User-Agents for which access is prohibited. - **deny** - List of User-Agents for which access is allowed. + You can provide exact User-Agent strings or regular expressions. Regular + expressions must start with `~` (case-sensitive) or `~*` (case-insensitive). + Use an empty string `""` to allow/deny access when the User-Agent header is empty. """ @@ -1922,8 +1926,9 @@ class Options(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. + 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) """ diff --git a/src/gcore/types/cdn/resource_update_params.py b/src/gcore/types/cdn/resource_update_params.py index c231f15d..92251e5c 100644 --- a/src/gcore/types/cdn/resource_update_params.py +++ b/src/gcore/types/cdn/resource_update_params.py @@ -882,6 +882,7 @@ 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) """ @@ -1682,6 +1683,9 @@ class OptionsUserAgentACL(TypedDict, total=False): - **allow** - List of User-Agents for which access is prohibited. - **deny** - List of User-Agents for which access is allowed. + You can provide exact User-Agent strings or regular expressions. Regular + expressions must start with `~` (case-sensitive) or `~*` (case-insensitive). + Use an empty string `""` to allow/deny access when the User-Agent header is empty. """ @@ -1913,8 +1917,9 @@ class Options(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. + 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) """ diff --git a/src/gcore/types/cdn/resources/cdn_resource_rule.py b/src/gcore/types/cdn/resources/cdn_resource_rule.py index 2b61a6d2..c28f6e6a 100644 --- a/src/gcore/types/cdn/resources/cdn_resource_rule.py +++ b/src/gcore/types/cdn/resources/cdn_resource_rule.py @@ -762,6 +762,7 @@ 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) """ @@ -1474,6 +1475,9 @@ class OptionsUserAgentACL(BaseModel): - **allow** - List of User-Agents for which access is prohibited. - **deny** - List of User-Agents for which access is allowed. + You can provide exact User-Agent strings or regular expressions. Regular + expressions must start with `~` (case-sensitive) or `~*` (case-insensitive). + Use an empty string `""` to allow/deny access when the User-Agent header is empty. """ @@ -1699,8 +1703,9 @@ class Options(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. + 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) """ diff --git a/src/gcore/types/cdn/resources/rule_create_params.py b/src/gcore/types/cdn/resources/rule_create_params.py index 9d48700f..052803bb 100644 --- a/src/gcore/types/cdn/resources/rule_create_params.py +++ b/src/gcore/types/cdn/resources/rule_create_params.py @@ -838,6 +838,7 @@ 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) """ @@ -1548,6 +1549,9 @@ class OptionsUserAgentACL(TypedDict, total=False): - **allow** - List of User-Agents for which access is prohibited. - **deny** - List of User-Agents for which access is allowed. + You can provide exact User-Agent strings or regular expressions. Regular + expressions must start with `~` (case-sensitive) or `~*` (case-insensitive). + Use an empty string `""` to allow/deny access when the User-Agent header is empty. """ @@ -1773,8 +1777,9 @@ class Options(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. + 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) """ diff --git a/src/gcore/types/cdn/resources/rule_replace_params.py b/src/gcore/types/cdn/resources/rule_replace_params.py index 44a3a9f7..86fb2b30 100644 --- a/src/gcore/types/cdn/resources/rule_replace_params.py +++ b/src/gcore/types/cdn/resources/rule_replace_params.py @@ -840,6 +840,7 @@ 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) """ @@ -1550,6 +1551,9 @@ class OptionsUserAgentACL(TypedDict, total=False): - **allow** - List of User-Agents for which access is prohibited. - **deny** - List of User-Agents for which access is allowed. + You can provide exact User-Agent strings or regular expressions. Regular + expressions must start with `~` (case-sensitive) or `~*` (case-insensitive). + Use an empty string `""` to allow/deny access when the User-Agent header is empty. """ @@ -1775,8 +1779,9 @@ class Options(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. + 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) """ diff --git a/src/gcore/types/cdn/resources/rule_update_params.py b/src/gcore/types/cdn/resources/rule_update_params.py index a689c70f..c4ae3b10 100644 --- a/src/gcore/types/cdn/resources/rule_update_params.py +++ b/src/gcore/types/cdn/resources/rule_update_params.py @@ -840,6 +840,7 @@ 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) """ @@ -1550,6 +1551,9 @@ class OptionsUserAgentACL(TypedDict, total=False): - **allow** - List of User-Agents for which access is prohibited. - **deny** - List of User-Agents for which access is allowed. + You can provide exact User-Agent strings or regular expressions. Regular + expressions must start with `~` (case-sensitive) or `~*` (case-insensitive). + Use an empty string `""` to allow/deny access when the User-Agent header is empty. """ @@ -1775,8 +1779,9 @@ class Options(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. + 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) """ diff --git a/src/gcore/types/cdn/rule_template.py b/src/gcore/types/cdn/rule_template.py index 12360cca..e23d3805 100644 --- a/src/gcore/types/cdn/rule_template.py +++ b/src/gcore/types/cdn/rule_template.py @@ -762,6 +762,7 @@ 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) """ @@ -1474,6 +1475,9 @@ class OptionsUserAgentACL(BaseModel): - **allow** - List of User-Agents for which access is prohibited. - **deny** - List of User-Agents for which access is allowed. + You can provide exact User-Agent strings or regular expressions. Regular + expressions must start with `~` (case-sensitive) or `~*` (case-insensitive). + Use an empty string `""` to allow/deny access when the User-Agent header is empty. """ @@ -1699,8 +1703,9 @@ class Options(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. + 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) """ diff --git a/src/gcore/types/cdn/rule_template_create_params.py b/src/gcore/types/cdn/rule_template_create_params.py index 5a000d28..6d44873b 100644 --- a/src/gcore/types/cdn/rule_template_create_params.py +++ b/src/gcore/types/cdn/rule_template_create_params.py @@ -822,6 +822,7 @@ 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) """ @@ -1532,6 +1533,9 @@ class OptionsUserAgentACL(TypedDict, total=False): - **allow** - List of User-Agents for which access is prohibited. - **deny** - List of User-Agents for which access is allowed. + You can provide exact User-Agent strings or regular expressions. Regular + expressions must start with `~` (case-sensitive) or `~*` (case-insensitive). + Use an empty string `""` to allow/deny access when the User-Agent header is empty. """ @@ -1757,8 +1761,9 @@ class Options(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. + 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) """ diff --git a/src/gcore/types/cdn/rule_template_replace_params.py b/src/gcore/types/cdn/rule_template_replace_params.py index 4af0182e..7dba15b1 100644 --- a/src/gcore/types/cdn/rule_template_replace_params.py +++ b/src/gcore/types/cdn/rule_template_replace_params.py @@ -822,6 +822,7 @@ 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) """ @@ -1532,6 +1533,9 @@ class OptionsUserAgentACL(TypedDict, total=False): - **allow** - List of User-Agents for which access is prohibited. - **deny** - List of User-Agents for which access is allowed. + You can provide exact User-Agent strings or regular expressions. Regular + expressions must start with `~` (case-sensitive) or `~*` (case-insensitive). + Use an empty string `""` to allow/deny access when the User-Agent header is empty. """ @@ -1757,8 +1761,9 @@ class Options(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. + 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) """ diff --git a/src/gcore/types/cdn/rule_template_update_params.py b/src/gcore/types/cdn/rule_template_update_params.py index 8d45b593..37b2ec5b 100644 --- a/src/gcore/types/cdn/rule_template_update_params.py +++ b/src/gcore/types/cdn/rule_template_update_params.py @@ -822,6 +822,7 @@ 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) """ @@ -1532,6 +1533,9 @@ class OptionsUserAgentACL(TypedDict, total=False): - **allow** - List of User-Agents for which access is prohibited. - **deny** - List of User-Agents for which access is allowed. + You can provide exact User-Agent strings or regular expressions. Regular + expressions must start with `~` (case-sensitive) or `~*` (case-insensitive). + Use an empty string `""` to allow/deny access when the User-Agent header is empty. """ @@ -1757,8 +1761,9 @@ class Options(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. + 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) """ diff --git a/tests/api_resources/cdn/resources/test_rules.py b/tests/api_resources/cdn/resources/test_rules.py index 63940c96..351ea91b 100644 --- a/tests/api_resources/cdn/resources/test_rules.py +++ b/tests/api_resources/cdn/resources/test_rules.py @@ -291,7 +291,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -607,7 +607,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -1024,7 +1024,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -1349,7 +1349,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -1665,7 +1665,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -2082,7 +2082,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { diff --git a/tests/api_resources/cdn/test_resources.py b/tests/api_resources/cdn/test_resources.py index debacd03..a987d85b 100644 --- a/tests/api_resources/cdn/test_resources.py +++ b/tests/api_resources/cdn/test_resources.py @@ -311,7 +311,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -652,7 +652,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -1281,7 +1281,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -1627,7 +1627,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -1968,7 +1968,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -2597,7 +2597,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { diff --git a/tests/api_resources/cdn/test_rule_templates.py b/tests/api_resources/cdn/test_rule_templates.py index cf4af42c..e7d8cb23 100644 --- a/tests/api_resources/cdn/test_rule_templates.py +++ b/tests/api_resources/cdn/test_rule_templates.py @@ -287,7 +287,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -595,7 +595,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -994,7 +994,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -1312,7 +1312,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -1620,7 +1620,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { @@ -2019,7 +2019,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> }, "user_agent_acl": { "enabled": True, - "excepted_values": ["UserAgent Value", ""], + "excepted_values": ["UserAgent Value", "~*.*bot.*", ""], "policy_type": "allow", }, "waap": { From 7deadfa96d233fd8da7561da1e3a3b828b1ca54a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 27 Jan 2026 07:37:18 +0000 Subject: [PATCH 535/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index cd2e413f..d9ef3c3d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-dc42eef367287a7e7bcd1a562a519594fd3ac1b50ee86cfd8c6337b334dfbf25.yml openapi_spec_hash: e72c6e3d4a64c6fc34a6b73431e65fba -config_hash: e9e5b750687e9071d8b606963f0ffd6d +config_hash: 2f023b35fc459cc07b468f79c8c2864e From 14eff49f13866c554a074aa5346cd899b1bea28d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 27 Jan 2026 08:14:47 +0000 Subject: [PATCH 536/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index d9ef3c3d..e75e4409 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-dc42eef367287a7e7bcd1a562a519594fd3ac1b50ee86cfd8c6337b334dfbf25.yml -openapi_spec_hash: e72c6e3d4a64c6fc34a6b73431e65fba +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e7e725cbd4047b87dac16a599ceaca2a7f59cc34401e203328bc5b50f7582a59.yml +openapi_spec_hash: 3056511ca272b6b265efdd4bc8e8c437 config_hash: 2f023b35fc459cc07b468f79c8c2864e From 80547e57b3017ae0a8244f49d44bcfd00f56f855 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 27 Jan 2026 09:51:05 +0000 Subject: [PATCH 537/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index e75e4409..4e8e1e6c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e7e725cbd4047b87dac16a599ceaca2a7f59cc34401e203328bc5b50f7582a59.yml openapi_spec_hash: 3056511ca272b6b265efdd4bc8e8c437 -config_hash: 2f023b35fc459cc07b468f79c8c2864e +config_hash: 98f7a9b9463b6248408d48a4adbb14d3 From 1258022f27a6cc554196b7c69cac53ea709543b6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 28 Jan 2026 09:39:23 +0000 Subject: [PATCH 538/592] feat(api): manual upload of aggregated API specs --- .stats.yml | 4 +- src/gcore/resources/dns/metrics.py | 8 +- src/gcore/resources/dns/zones/rrsets.py | 240 +++++++----------- src/gcore/resources/streaming/playlists.py | 4 + src/gcore/types/streaming/playlist.py | 1 + .../types/streaming/playlist_create_params.py | 1 + .../types/streaming/playlist_update_params.py | 1 + src/gcore/types/streaming/video.py | 4 +- 8 files changed, 111 insertions(+), 152 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4e8e1e6c..839f1657 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e7e725cbd4047b87dac16a599ceaca2a7f59cc34401e203328bc5b50f7582a59.yml -openapi_spec_hash: 3056511ca272b6b265efdd4bc8e8c437 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f9e3248b7c9cc29017d94b17dd33fbc7b3eaa4eda92c1c7202b41b8cca84bc33.yml +openapi_spec_hash: cb53ad5e99f343ea9adc322d9f805b63 config_hash: 98f7a9b9463b6248408d48a4adbb14d3 diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index 3359b610..918583f4 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -58,8 +58,8 @@ def list( Example of success response: ``` - # HELP healthcheck_state The `healthcheck_state` metric reflects the state of a specific monitor after conducting a health check - # TYPE healthcheck_state gauge + HELP healthcheck_state The `healthcheck_state` metric reflects the state of a specific monitor after conducting a health check + TYPE healthcheck_state gauge healthcheck_state{client_id="1",monitor_id="431",monitor_locations="us-east-1,us-west-1",monitor_name="test-monitor-1",monitor_type="http",rrset_name="rrset-name1",rrset_type="rrset-type1",zone_name="zone-name1"} 0 healthcheck_state{client_id="1",monitor_id="4871",monitor_locations="fr-1,fr-2",monitor_name="test-monitor-2",monitor_type="tcp",rrset_name="rrset-name2",rrset_type="rrset-type2",zone_name="zone-name2"} 1 healthcheck_state{client_id="2",monitor_id="7123",monitor_locations="ua-1,ua-2",monitor_name="test-monitor-3",monitor_type="icmp",rrset_name="rrset-name3",rrset_type="rrset-type3",zone_name="zone-name3"} 0 @@ -136,8 +136,8 @@ async def list( Example of success response: ``` - # HELP healthcheck_state The `healthcheck_state` metric reflects the state of a specific monitor after conducting a health check - # TYPE healthcheck_state gauge + HELP healthcheck_state The `healthcheck_state` metric reflects the state of a specific monitor after conducting a health check + TYPE healthcheck_state gauge healthcheck_state{client_id="1",monitor_id="431",monitor_locations="us-east-1,us-west-1",monitor_name="test-monitor-1",monitor_type="http",rrset_name="rrset-name1",rrset_type="rrset-type1",zone_name="zone-name1"} 0 healthcheck_state{client_id="1",monitor_id="4871",monitor_locations="fr-1,fr-2",monitor_name="test-monitor-2",monitor_type="tcp",rrset_name="rrset-name2",rrset_type="rrset-type2",zone_name="zone-name2"} 1 healthcheck_state{client_id="2",monitor_id="7123",monitor_locations="ua-1,ua-2",monitor_name="test-monitor-3",monitor_type="icmp",rrset_name="rrset-name3",rrset_type="rrset-type3",zone_name="zone-name3"} 0 diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index b1ab12a5..736b590d 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -72,32 +72,27 @@ def create( Add the RRSet to the zone specified by zoneName, RRSets can be configured to be either dynamic or static. - ### Static RRsets - - Staticly configured RRSets provide DNS responses as is. - - ### Dynamic RRsets - - Dynamic RRSets have picker configuration defined thus it's possible to finely - customize DNS response. Picking rules are defined on the RRSet level as a list - of selectors, filters and mutators. Picker considers different resource records - metadata, requestor IP, and other event-feeds like monitoring. Picker - configuration is an ordered list defined by "pickers" attribute. Requestor IP is - determined by EDNS Client Subnet (ECS) if defined, otherwise - by - client/recursor IP. Selector pickers are used in the specified order until the - first match, in case of match - all next selectors are bypassed. Filters or - mutators are applied to the match according to the order they are specified. + Static RRsets Staticly configured RRSets provide DNS responses as is. + + Dynamic RRsets Dynamic RRSets have picker configuration defined thus it's + possible to finely customize DNS response. Picking rules are defined on the + RRSet level as a list of selectors, filters and mutators. Picker considers + different resource records metadata, requestor IP, and other event-feeds like + monitoring. Picker configuration is an ordered list defined by "pickers" + attribute. Requestor IP is determined by EDNS Client Subnet (ECS) if defined, + otherwise - by client/recursor IP. Selector pickers are used in the specified + order until the first match, in case of match - all next selectors are bypassed. + Filters or mutators are applied to the match according to the order they are + specified. For example, sort records by proximity to user, shuffle based on weights and return not more than 3: `"pickers": [ { "type": "geodistance" }, { "type": "weighted_shuffle" }, { "type": "first_n", "limit": 3 } ]` - #### geodns filter - - A resource record is included in the answer if resource record's metadata - matches requestor info. For each resource record in RRSet, the following - metadata is considered (in the order specified): + geodns filter A resource record is included in the answer if resource record's + metadata matches requestor info. For each resource record in RRSet, the + following metadata is considered (in the order specified): - `ip` - list of network addresses in CIDR format, e.g. `["192.168.15.150/25", "2003:de:2016::/48"]`; @@ -114,91 +109,71 @@ def create( Example: `"pickers": [ { "type": "geodns", "strict": true } ]` - ##### Strict parameter - - `strict: true` means that if no records percolate through the geodns filter it - returns no answers. `strict: false` means that if no records percolate through - the geodns filter, all records are passed over. + Strict parameter `strict: true` means that if no records percolate through the + geodns filter it returns no answers. `strict: false` means that if no records + percolate through the geodns filter, all records are passed over. - #### asn selector - - Resource records which ASN metadata matches ASN of the requestor are picked by - this selector, and passed to the next non-selector picker, if there is no - match - next configured picker starts with all records. + asn selector Resource records which ASN metadata matches ASN of the requestor + are picked by this selector, and passed to the next non-selector picker, if + there is no match - next configured picker starts with all records. Example: `"pickers": [ {"type": "asn"} ]` - #### country selector - - Resource records which country metadata matches country of the requestor are - picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. + country selector Resource records which country metadata matches country of the + requestor are picked by this selector, and passed to the next non-selector + picker, if there is no match - next configured picker starts with all records. Example: `"pickers": [ { "type": "country" } ]` - #### continent selector - - Resource records which continent metadata matches continent of the requestor are - picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. + continent selector Resource records which continent metadata matches continent + of the requestor are picked by this selector, and passed to the next + non-selector picker, if there is no match - next configured picker starts with + all records. Example: `"pickers": [ { "type": "continent" } ]` - #### region selector - - Resource records which region metadata matches region of the requestor are - picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. e.g. `fr-nor` for - France/Normandy. + region selector Resource records which region metadata matches region of the + requestor are picked by this selector, and passed to the next non-selector + picker, if there is no match - next configured picker starts with all records. + e.g. `fr-nor` for France/Normandy. Example: `"pickers": [ { "type": "region" } ]` - #### ip selector - - Resource records which IP metadata matches IP of the requestor are picked by - this selector, and passed to the next non-selector picker, if there is no - match - next configured picker starts with all records. Maximum 100 subnets are - allowed to specify in meta of RR. + ip selector Resource records which IP metadata matches IP of the requestor are + picked by this selector, and passed to the next non-selector picker, if there is + no match - next configured picker starts with all records. Maximum 100 subnets + are allowed to specify in meta of RR. Example: `"pickers": [ { "type": "ip" } ]` - #### default selector - - When enabled, records marked as default are selected: + default selector When enabled, records marked as default are selected: `"meta": {"default": true}`. Example: `"pickers": [ { "type": "geodns", "strict": false }, { "type": "default" }, { "type": "first_n", "limit": 2 } ]` - #### geodistance mutator - - The resource records are rearranged in ascending order based on the distance (in - meters) from requestor to the coordinates specified in latlong metadata. - Distance is calculated using Haversine formula. The "nearest" to the user's IP - RR goes first. The records without latlong metadata come last. e.g. for Berlin - `[52.520008, 13.404954]`.; + geodistance mutator The resource records are rearranged in ascending order based + on the distance (in meters) from requestor to the coordinates specified in + latlong metadata. Distance is calculated using Haversine formula. The "nearest" + to the user's IP RR goes first. The records without latlong metadata come last. + e.g. for Berlin `[52.520008, 13.404954]`.; In this configuration the only "nearest" to the requestor record to be returned: `"pickers": [ { "type": "geodistance" }, { "type": "first_n", "limit": 1 } ]` - #### `weighted_shuffle` mutator - - The resource records are rearranged in random order based on the `weight` - metadata. Default weight (if not specified) is 50. + `weighted_shuffle` mutator The resource records are rearranged in random order + based on the `weight` metadata. Default weight (if not specified) is 50. Example: `"pickers": [ { "type": "weighted_shuffle" } ]` - #### `first_n` filter - - Slices first N (N specified as a limit parameter value) resource records. + `first_n` filter Slices first N (N specified as a limit parameter value) + resource records. Example: `"pickers": [ { "type": "first_n", "limit": 1 } ]` returns only the first resource record. - ##### limit parameter - - Can be a positive value for a specific limit. Use zero or leave it blank to - indicate no limits. + limit parameter Can be a positive value for a specific limit. Use zero or leave + it blank to indicate no limits. Args: resource_records: List of resource record from rrset @@ -528,32 +503,27 @@ async def create( Add the RRSet to the zone specified by zoneName, RRSets can be configured to be either dynamic or static. - ### Static RRsets + Static RRsets Staticly configured RRSets provide DNS responses as is. - Staticly configured RRSets provide DNS responses as is. - - ### Dynamic RRsets - - Dynamic RRSets have picker configuration defined thus it's possible to finely - customize DNS response. Picking rules are defined on the RRSet level as a list - of selectors, filters and mutators. Picker considers different resource records - metadata, requestor IP, and other event-feeds like monitoring. Picker - configuration is an ordered list defined by "pickers" attribute. Requestor IP is - determined by EDNS Client Subnet (ECS) if defined, otherwise - by - client/recursor IP. Selector pickers are used in the specified order until the - first match, in case of match - all next selectors are bypassed. Filters or - mutators are applied to the match according to the order they are specified. + Dynamic RRsets Dynamic RRSets have picker configuration defined thus it's + possible to finely customize DNS response. Picking rules are defined on the + RRSet level as a list of selectors, filters and mutators. Picker considers + different resource records metadata, requestor IP, and other event-feeds like + monitoring. Picker configuration is an ordered list defined by "pickers" + attribute. Requestor IP is determined by EDNS Client Subnet (ECS) if defined, + otherwise - by client/recursor IP. Selector pickers are used in the specified + order until the first match, in case of match - all next selectors are bypassed. + Filters or mutators are applied to the match according to the order they are + specified. For example, sort records by proximity to user, shuffle based on weights and return not more than 3: `"pickers": [ { "type": "geodistance" }, { "type": "weighted_shuffle" }, { "type": "first_n", "limit": 3 } ]` - #### geodns filter - - A resource record is included in the answer if resource record's metadata - matches requestor info. For each resource record in RRSet, the following - metadata is considered (in the order specified): + geodns filter A resource record is included in the answer if resource record's + metadata matches requestor info. For each resource record in RRSet, the + following metadata is considered (in the order specified): - `ip` - list of network addresses in CIDR format, e.g. `["192.168.15.150/25", "2003:de:2016::/48"]`; @@ -570,91 +540,71 @@ async def create( Example: `"pickers": [ { "type": "geodns", "strict": true } ]` - ##### Strict parameter - - `strict: true` means that if no records percolate through the geodns filter it - returns no answers. `strict: false` means that if no records percolate through - the geodns filter, all records are passed over. - - #### asn selector + Strict parameter `strict: true` means that if no records percolate through the + geodns filter it returns no answers. `strict: false` means that if no records + percolate through the geodns filter, all records are passed over. - Resource records which ASN metadata matches ASN of the requestor are picked by - this selector, and passed to the next non-selector picker, if there is no - match - next configured picker starts with all records. + asn selector Resource records which ASN metadata matches ASN of the requestor + are picked by this selector, and passed to the next non-selector picker, if + there is no match - next configured picker starts with all records. Example: `"pickers": [ {"type": "asn"} ]` - #### country selector - - Resource records which country metadata matches country of the requestor are - picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. + country selector Resource records which country metadata matches country of the + requestor are picked by this selector, and passed to the next non-selector + picker, if there is no match - next configured picker starts with all records. Example: `"pickers": [ { "type": "country" } ]` - #### continent selector - - Resource records which continent metadata matches continent of the requestor are - picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. + continent selector Resource records which continent metadata matches continent + of the requestor are picked by this selector, and passed to the next + non-selector picker, if there is no match - next configured picker starts with + all records. Example: `"pickers": [ { "type": "continent" } ]` - #### region selector - - Resource records which region metadata matches region of the requestor are - picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. e.g. `fr-nor` for - France/Normandy. + region selector Resource records which region metadata matches region of the + requestor are picked by this selector, and passed to the next non-selector + picker, if there is no match - next configured picker starts with all records. + e.g. `fr-nor` for France/Normandy. Example: `"pickers": [ { "type": "region" } ]` - #### ip selector - - Resource records which IP metadata matches IP of the requestor are picked by - this selector, and passed to the next non-selector picker, if there is no - match - next configured picker starts with all records. Maximum 100 subnets are - allowed to specify in meta of RR. + ip selector Resource records which IP metadata matches IP of the requestor are + picked by this selector, and passed to the next non-selector picker, if there is + no match - next configured picker starts with all records. Maximum 100 subnets + are allowed to specify in meta of RR. Example: `"pickers": [ { "type": "ip" } ]` - #### default selector - - When enabled, records marked as default are selected: + default selector When enabled, records marked as default are selected: `"meta": {"default": true}`. Example: `"pickers": [ { "type": "geodns", "strict": false }, { "type": "default" }, { "type": "first_n", "limit": 2 } ]` - #### geodistance mutator - - The resource records are rearranged in ascending order based on the distance (in - meters) from requestor to the coordinates specified in latlong metadata. - Distance is calculated using Haversine formula. The "nearest" to the user's IP - RR goes first. The records without latlong metadata come last. e.g. for Berlin - `[52.520008, 13.404954]`.; + geodistance mutator The resource records are rearranged in ascending order based + on the distance (in meters) from requestor to the coordinates specified in + latlong metadata. Distance is calculated using Haversine formula. The "nearest" + to the user's IP RR goes first. The records without latlong metadata come last. + e.g. for Berlin `[52.520008, 13.404954]`.; In this configuration the only "nearest" to the requestor record to be returned: `"pickers": [ { "type": "geodistance" }, { "type": "first_n", "limit": 1 } ]` - #### `weighted_shuffle` mutator - - The resource records are rearranged in random order based on the `weight` - metadata. Default weight (if not specified) is 50. + `weighted_shuffle` mutator The resource records are rearranged in random order + based on the `weight` metadata. Default weight (if not specified) is 50. Example: `"pickers": [ { "type": "weighted_shuffle" } ]` - #### `first_n` filter - - Slices first N (N specified as a limit parameter value) resource records. + `first_n` filter Slices first N (N specified as a limit parameter value) + resource records. Example: `"pickers": [ { "type": "first_n", "limit": 1 } ]` returns only the first resource record. - ##### limit parameter - - Can be a positive value for a specific limit. Use zero or leave it blank to - indicate no limits. + limit parameter Can be a positive value for a specific limit. Use zero or leave + it blank to indicate no limits. Args: resource_records: List of resource record from rrset diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index fe1f49db..28f15c1a 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -173,6 +173,7 @@ def create( 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: + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. @@ -308,6 +309,7 @@ def update( 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: + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. @@ -662,6 +664,7 @@ async def create( 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: + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. @@ -797,6 +800,7 @@ async def update( 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: + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. diff --git a/src/gcore/types/streaming/playlist.py b/src/gcore/types/streaming/playlist.py index 495c206d..e0f94e66 100644 --- a/src/gcore/types/streaming/playlist.py +++ b/src/gcore/types/streaming/playlist.py @@ -49,6 +49,7 @@ class Playlist(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: + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. diff --git a/src/gcore/types/streaming/playlist_create_params.py b/src/gcore/types/streaming/playlist_create_params.py index f9102a3f..2eebe230 100644 --- a/src/gcore/types/streaming/playlist_create_params.py +++ b/src/gcore/types/streaming/playlist_create_params.py @@ -49,6 +49,7 @@ class PlaylistCreateParams(TypedDict, total=False): 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: + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. diff --git a/src/gcore/types/streaming/playlist_update_params.py b/src/gcore/types/streaming/playlist_update_params.py index 10fe4362..ce411690 100644 --- a/src/gcore/types/streaming/playlist_update_params.py +++ b/src/gcore/types/streaming/playlist_update_params.py @@ -49,6 +49,7 @@ class PlaylistUpdateParams(TypedDict, total=False): 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: + `/playlists/{client_id}_{playlist_id}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` Please see the details in `hls_url` attribute of /videos/{id} method. diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py index c12c6453..f6a405ee 100644 --- a/src/gcore/types/streaming/video.py +++ b/src/gcore/types/streaming/video.py @@ -85,7 +85,9 @@ class ConvertedVideo(BaseModel): **Default MP4 file name structure** Link to the file {filename} contains information about the encoding method using - format: `___.mp4` + format: + + `___.mp4` - `` – Internal quality identifier and file version. Please do not use it, can be changed at any time without any notice. From d5e610f61b895141b26f3e0edd761a71848189ad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 28 Jan 2026 14:17:20 +0000 Subject: [PATCH 539/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/waap/domains/statistics.py | 45 ++++-- .../statistic_get_events_aggregated_params.py | 2 +- .../waap/domains/test_statistics.py | 142 ++++++++++-------- 4 files changed, 112 insertions(+), 81 deletions(-) diff --git a/.stats.yml b/.stats.yml index 839f1657..b1d69914 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f9e3248b7c9cc29017d94b17dd33fbc7b3eaa4eda92c1c7202b41b8cca84bc33.yml -openapi_spec_hash: cb53ad5e99f343ea9adc322d9f805b63 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-265fa735ac3d620de0e726578c506cd13b38ca938cc853de65c5d65d8c831124.yml +openapi_spec_hash: 3641df0a7f7ebdb7dd55d0fa377251d8 config_hash: 98f7a9b9463b6248408d48a4adbb14d3 diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index 94514578..225b0f77 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal @@ -187,7 +188,7 @@ def get_events_aggregated( domain_id: int, *, start: str, - action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | Omit = omit, + action: Optional[List[Literal["allow", "block", "captcha", "handshake"]]] | Omit = omit, end: Optional[str] | Omit = omit, ip: Optional[SequenceNotStr[str]] | Omit = omit, reference_id: Optional[SequenceNotStr[str]] | Omit = omit, @@ -287,6 +288,7 @@ def get_request_details( cast_to=WaapRequestDetails, ) + @typing_extensions.deprecated("deprecated") def get_requests_series( self, domain_id: int, @@ -334,8 +336,11 @@ def get_requests_series( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapRequestSummary]: - """ - Retrieve a domain's requests data. + """Retrieve a domain's requests data. + + Deprecated. Use + [GET /v1/analytics/requests](/docs/api-reference/waap/analytics/get-request-log-data) + instead. Args: domain_id: The domain ID @@ -609,7 +614,7 @@ async def get_events_aggregated( domain_id: int, *, start: str, - action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | Omit = omit, + action: Optional[List[Literal["allow", "block", "captcha", "handshake"]]] | Omit = omit, end: Optional[str] | Omit = omit, ip: Optional[SequenceNotStr[str]] | Omit = omit, reference_id: Optional[SequenceNotStr[str]] | Omit = omit, @@ -709,6 +714,7 @@ async def get_request_details( cast_to=WaapRequestDetails, ) + @typing_extensions.deprecated("deprecated") def get_requests_series( self, domain_id: int, @@ -756,8 +762,11 @@ def get_requests_series( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapRequestSummary, AsyncOffsetPage[WaapRequestSummary]]: - """ - Retrieve a domain's requests data. + """Retrieve a domain's requests data. + + Deprecated. Use + [GET /v1/analytics/requests](/docs/api-reference/waap/analytics/get-request-log-data) + instead. Args: domain_id: The domain ID @@ -897,8 +906,10 @@ def __init__(self, statistics: StatisticsResource) -> None: self.get_request_details = to_raw_response_wrapper( statistics.get_request_details, ) - self.get_requests_series = to_raw_response_wrapper( - statistics.get_requests_series, + self.get_requests_series = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + statistics.get_requests_series, # pyright: ignore[reportDeprecated], + ) ) self.get_traffic_series = to_raw_response_wrapper( statistics.get_traffic_series, @@ -921,8 +932,10 @@ def __init__(self, statistics: AsyncStatisticsResource) -> None: self.get_request_details = async_to_raw_response_wrapper( statistics.get_request_details, ) - self.get_requests_series = async_to_raw_response_wrapper( - statistics.get_requests_series, + self.get_requests_series = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + statistics.get_requests_series, # pyright: ignore[reportDeprecated], + ) ) self.get_traffic_series = async_to_raw_response_wrapper( statistics.get_traffic_series, @@ -945,8 +958,10 @@ def __init__(self, statistics: StatisticsResource) -> None: self.get_request_details = to_streamed_response_wrapper( statistics.get_request_details, ) - self.get_requests_series = to_streamed_response_wrapper( - statistics.get_requests_series, + self.get_requests_series = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + statistics.get_requests_series, # pyright: ignore[reportDeprecated], + ) ) self.get_traffic_series = to_streamed_response_wrapper( statistics.get_traffic_series, @@ -969,8 +984,10 @@ def __init__(self, statistics: AsyncStatisticsResource) -> None: self.get_request_details = async_to_streamed_response_wrapper( statistics.get_request_details, ) - self.get_requests_series = async_to_streamed_response_wrapper( - statistics.get_requests_series, + self.get_requests_series = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + statistics.get_requests_series, # pyright: ignore[reportDeprecated], + ) ) self.get_traffic_series = async_to_streamed_response_wrapper( statistics.get_traffic_series, diff --git a/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py b/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py index ff19e38c..4cfc9bcd 100644 --- a/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py +++ b/src/gcore/types/waap/domains/statistic_get_events_aggregated_params.py @@ -14,7 +14,7 @@ class StatisticGetEventsAggregatedParams(TypedDict, total=False): start: Required[str] """Filter data items starting from a specified date in ISO 8601 format""" - action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] + action: Optional[List[Literal["allow", "block", "captcha", "handshake"]]] """A list of action names to filter on.""" end: Optional[str] diff --git a/tests/api_resources/waap/domains/test_statistics.py b/tests/api_resources/waap/domains/test_statistics.py index f46a30a2..c8a4bcb4 100644 --- a/tests/api_resources/waap/domains/test_statistics.py +++ b/tests/api_resources/waap/domains/test_statistics.py @@ -20,6 +20,8 @@ StatisticGetTrafficSeriesResponse, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -131,7 +133,7 @@ def test_method_get_events_aggregated_with_all_params(self, client: Gcore) -> No statistic = client.waap.domains.statistics.get_events_aggregated( domain_id=1, start="2024-04-13T00:00:00+01:00", - action=["block", "captcha"], + action=["allow", "block"], end="2024-04-14T12:00:00Z", ip=["string", "string"], reference_id=["string", "string"], @@ -209,37 +211,42 @@ def test_path_params_get_request_details(self, client: Gcore) -> None: @parametrize def test_method_get_requests_series(self, client: Gcore) -> None: - statistic = client.waap.domains.statistics.get_requests_series( - domain_id=1, - start="2024-04-13T00:00:00+01:00", - ) + with pytest.warns(DeprecationWarning): + statistic = client.waap.domains.statistics.get_requests_series( + domain_id=1, + start="2024-04-13T00:00:00+01:00", + ) + assert_matches_type(SyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) @parametrize def test_method_get_requests_series_with_all_params(self, client: Gcore) -> None: - statistic = client.waap.domains.statistics.get_requests_series( - domain_id=1, - start="2024-04-13T00:00:00+01:00", - actions=["allow"], - countries=["Mv"], - end="2024-04-14T12:00:00Z", - ip=".:", - limit=0, - offset=0, - ordering="ordering", - reference_id="ad07c06f19054e484974fa22e9fb6bb1", - security_rule_name="security_rule_name", - status_code=100, - traffic_types=["policy_allowed"], - ) + with pytest.warns(DeprecationWarning): + statistic = client.waap.domains.statistics.get_requests_series( + domain_id=1, + start="2024-04-13T00:00:00+01:00", + actions=["allow"], + countries=["Mv"], + end="2024-04-14T12:00:00Z", + ip=".:", + limit=0, + offset=0, + ordering="ordering", + reference_id="ad07c06f19054e484974fa22e9fb6bb1", + security_rule_name="security_rule_name", + status_code=100, + traffic_types=["policy_allowed"], + ) + assert_matches_type(SyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) @parametrize def test_raw_response_get_requests_series(self, client: Gcore) -> None: - response = client.waap.domains.statistics.with_raw_response.get_requests_series( - domain_id=1, - start="2024-04-13T00:00:00+01:00", - ) + with pytest.warns(DeprecationWarning): + response = client.waap.domains.statistics.with_raw_response.get_requests_series( + domain_id=1, + start="2024-04-13T00:00:00+01:00", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -248,15 +255,16 @@ def test_raw_response_get_requests_series(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_requests_series(self, client: Gcore) -> None: - with client.waap.domains.statistics.with_streaming_response.get_requests_series( - domain_id=1, - start="2024-04-13T00:00:00+01:00", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.waap.domains.statistics.with_streaming_response.get_requests_series( + domain_id=1, + start="2024-04-13T00:00:00+01:00", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - statistic = response.parse() - assert_matches_type(SyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) + statistic = response.parse() + assert_matches_type(SyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -418,7 +426,7 @@ async def test_method_get_events_aggregated_with_all_params(self, async_client: statistic = await async_client.waap.domains.statistics.get_events_aggregated( domain_id=1, start="2024-04-13T00:00:00+01:00", - action=["block", "captcha"], + action=["allow", "block"], end="2024-04-14T12:00:00Z", ip=["string", "string"], reference_id=["string", "string"], @@ -496,37 +504,42 @@ async def test_path_params_get_request_details(self, async_client: AsyncGcore) - @parametrize async def test_method_get_requests_series(self, async_client: AsyncGcore) -> None: - statistic = await async_client.waap.domains.statistics.get_requests_series( - domain_id=1, - start="2024-04-13T00:00:00+01:00", - ) + with pytest.warns(DeprecationWarning): + statistic = await async_client.waap.domains.statistics.get_requests_series( + domain_id=1, + start="2024-04-13T00:00:00+01:00", + ) + assert_matches_type(AsyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) @parametrize async def test_method_get_requests_series_with_all_params(self, async_client: AsyncGcore) -> None: - statistic = await async_client.waap.domains.statistics.get_requests_series( - domain_id=1, - start="2024-04-13T00:00:00+01:00", - actions=["allow"], - countries=["Mv"], - end="2024-04-14T12:00:00Z", - ip=".:", - limit=0, - offset=0, - ordering="ordering", - reference_id="ad07c06f19054e484974fa22e9fb6bb1", - security_rule_name="security_rule_name", - status_code=100, - traffic_types=["policy_allowed"], - ) + with pytest.warns(DeprecationWarning): + statistic = await async_client.waap.domains.statistics.get_requests_series( + domain_id=1, + start="2024-04-13T00:00:00+01:00", + actions=["allow"], + countries=["Mv"], + end="2024-04-14T12:00:00Z", + ip=".:", + limit=0, + offset=0, + ordering="ordering", + reference_id="ad07c06f19054e484974fa22e9fb6bb1", + security_rule_name="security_rule_name", + status_code=100, + traffic_types=["policy_allowed"], + ) + assert_matches_type(AsyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) @parametrize async def test_raw_response_get_requests_series(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.statistics.with_raw_response.get_requests_series( - domain_id=1, - start="2024-04-13T00:00:00+01:00", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.waap.domains.statistics.with_raw_response.get_requests_series( + domain_id=1, + start="2024-04-13T00:00:00+01:00", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -535,15 +548,16 @@ async def test_raw_response_get_requests_series(self, async_client: AsyncGcore) @parametrize async def test_streaming_response_get_requests_series(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.statistics.with_streaming_response.get_requests_series( - domain_id=1, - start="2024-04-13T00:00:00+01:00", - ) 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.waap.domains.statistics.with_streaming_response.get_requests_series( + domain_id=1, + start="2024-04-13T00:00:00+01:00", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - statistic = await response.parse() - assert_matches_type(AsyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) + statistic = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapRequestSummary], statistic, path=["response"]) assert cast(Any, response.is_closed) is True From c38d6fa2d3ca978253d975739e6cbd05d6dbaf2d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 Jan 2026 06:25:06 +0000 Subject: [PATCH 540/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index b1d69914..925a1464 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-265fa735ac3d620de0e726578c506cd13b38ca938cc853de65c5d65d8c831124.yml -openapi_spec_hash: 3641df0a7f7ebdb7dd55d0fa377251d8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8b9ce3f2908dfcd3dab77ef7d831b407620420d7caef9551932b6789ec589bcc.yml +openapi_spec_hash: 15f1c6c29ccbc7120648e0e7c6476556 config_hash: 98f7a9b9463b6248408d48a4adbb14d3 From 0db11de48535e10c1753a9dc9a5bac5f821bcafa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 Jan 2026 10:20:22 +0000 Subject: [PATCH 541/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 925a1464..74fb9b3e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8b9ce3f2908dfcd3dab77ef7d831b407620420d7caef9551932b6789ec589bcc.yml -openapi_spec_hash: 15f1c6c29ccbc7120648e0e7c6476556 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-58d9afa7f8342ead022bd8fa12bb8abbeb9c0fb1e16f052ee6c4a59fae373e27.yml +openapi_spec_hash: 2ae4db03cfc907be71d44288503838d7 config_hash: 98f7a9b9463b6248408d48a4adbb14d3 From f60cb571665ca84f8acc85810174d85b490eb109 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 Jan 2026 16:56:51 +0000 Subject: [PATCH 542/592] feat(client): add custom JSON encoder for extended type support --- src/gcore/_base_client.py | 7 +- src/gcore/_compat.py | 6 +- src/gcore/_utils/_json.py | 35 ++++++++++ tests/test_utils/test_json.py | 126 ++++++++++++++++++++++++++++++++++ 4 files changed, 169 insertions(+), 5 deletions(-) create mode 100644 src/gcore/_utils/_json.py create mode 100644 tests/test_utils/test_json.py diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index e4303b57..e797b152 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -86,6 +86,7 @@ APIConnectionError, APIResponseValidationError, ) +from ._utils._json import openapi_dumps log: logging.Logger = logging.getLogger(__name__) @@ -554,8 +555,10 @@ def _build_request( kwargs["content"] = options.content elif isinstance(json_data, bytes): kwargs["content"] = json_data - else: - kwargs["json"] = json_data if is_given(json_data) else None + elif not files: + # Don't set content when JSON is sent as multipart/form-data, + # since httpx's content param overrides other body arguments + kwargs["content"] = openapi_dumps(json_data) if is_given(json_data) and json_data is not None else None kwargs["files"] = files else: headers.pop("Content-Type", None) diff --git a/src/gcore/_compat.py b/src/gcore/_compat.py index bdef67f0..786ff42a 100644 --- a/src/gcore/_compat.py +++ b/src/gcore/_compat.py @@ -139,6 +139,7 @@ def model_dump( exclude_defaults: bool = False, warnings: bool = True, mode: Literal["json", "python"] = "python", + by_alias: bool | None = None, ) -> dict[str, Any]: if (not PYDANTIC_V1) or hasattr(model, "model_dump"): return model.model_dump( @@ -148,13 +149,12 @@ def model_dump( exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 warnings=True if PYDANTIC_V1 else warnings, + by_alias=by_alias, ) return cast( "dict[str, Any]", model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast] - exclude=exclude, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, + exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, by_alias=bool(by_alias) ), ) diff --git a/src/gcore/_utils/_json.py b/src/gcore/_utils/_json.py new file mode 100644 index 00000000..60584214 --- /dev/null +++ b/src/gcore/_utils/_json.py @@ -0,0 +1,35 @@ +import json +from typing import Any +from datetime import datetime +from typing_extensions import override + +import pydantic + +from .._compat import model_dump + + +def openapi_dumps(obj: Any) -> bytes: + """ + Serialize an object to UTF-8 encoded JSON bytes. + + Extends the standard json.dumps with support for additional types + commonly used in the SDK, such as `datetime`, `pydantic.BaseModel`, etc. + """ + return json.dumps( + obj, + cls=_CustomEncoder, + # Uses the same defaults as httpx's JSON serialization + ensure_ascii=False, + separators=(",", ":"), + allow_nan=False, + ).encode() + + +class _CustomEncoder(json.JSONEncoder): + @override + def default(self, o: Any) -> Any: + if isinstance(o, datetime): + return o.isoformat() + if isinstance(o, pydantic.BaseModel): + return model_dump(o, exclude_unset=True, mode="json", by_alias=True) + return super().default(o) diff --git a/tests/test_utils/test_json.py b/tests/test_utils/test_json.py new file mode 100644 index 00000000..9e4ec0e5 --- /dev/null +++ b/tests/test_utils/test_json.py @@ -0,0 +1,126 @@ +from __future__ import annotations + +import datetime +from typing import Union + +import pydantic + +from gcore import _compat +from gcore._utils._json import openapi_dumps + + +class TestOpenapiDumps: + def test_basic(self) -> None: + data = {"key": "value", "number": 42} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"key":"value","number":42}' + + def test_datetime_serialization(self) -> None: + dt = datetime.datetime(2023, 1, 1, 12, 0, 0) + data = {"datetime": dt} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"datetime":"2023-01-01T12:00:00"}' + + def test_pydantic_model_serialization(self) -> None: + class User(pydantic.BaseModel): + first_name: str + last_name: str + age: int + + model_instance = User(first_name="John", last_name="Kramer", age=83) + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"first_name":"John","last_name":"Kramer","age":83}}' + + def test_pydantic_model_with_default_values(self) -> None: + class User(pydantic.BaseModel): + name: str + role: str = "user" + active: bool = True + score: int = 0 + + model_instance = User(name="Alice") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Alice"}}' + + def test_pydantic_model_with_default_values_overridden(self) -> None: + class User(pydantic.BaseModel): + name: str + role: str = "user" + active: bool = True + + model_instance = User(name="Bob", role="admin", active=False) + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Bob","role":"admin","active":false}}' + + def test_pydantic_model_with_alias(self) -> None: + class User(pydantic.BaseModel): + first_name: str = pydantic.Field(alias="firstName") + last_name: str = pydantic.Field(alias="lastName") + + model_instance = User(firstName="John", lastName="Doe") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"firstName":"John","lastName":"Doe"}}' + + def test_pydantic_model_with_alias_and_default(self) -> None: + class User(pydantic.BaseModel): + user_name: str = pydantic.Field(alias="userName") + user_role: str = pydantic.Field(default="member", alias="userRole") + is_active: bool = pydantic.Field(default=True, alias="isActive") + + model_instance = User(userName="charlie") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"userName":"charlie"}}' + + model_with_overrides = User(userName="diana", userRole="admin", isActive=False) + data = {"model": model_with_overrides} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"userName":"diana","userRole":"admin","isActive":false}}' + + def test_pydantic_model_with_nested_models_and_defaults(self) -> None: + class Address(pydantic.BaseModel): + street: str + city: str = "Unknown" + + class User(pydantic.BaseModel): + name: str + address: Address + verified: bool = False + + if _compat.PYDANTIC_V1: + # to handle forward references in Pydantic v1 + User.update_forward_refs(**locals()) # type: ignore[reportDeprecated] + + address = Address(street="123 Main St") + user = User(name="Diana", address=address) + data = {"user": user} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"user":{"name":"Diana","address":{"street":"123 Main St"}}}' + + address_with_city = Address(street="456 Oak Ave", city="Boston") + user_verified = User(name="Eve", address=address_with_city, verified=True) + data = {"user": user_verified} + json_bytes = openapi_dumps(data) + assert ( + json_bytes == b'{"user":{"name":"Eve","address":{"street":"456 Oak Ave","city":"Boston"},"verified":true}}' + ) + + def test_pydantic_model_with_optional_fields(self) -> None: + class User(pydantic.BaseModel): + name: str + email: Union[str, None] + phone: Union[str, None] + + model_with_none = User(name="Eve", email=None, phone=None) + data = {"model": model_with_none} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Eve","email":null,"phone":null}}' + + model_with_values = User(name="Frank", email="frank@example.com", phone=None) + data = {"model": model_with_values} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Frank","email":"frank@example.com","phone":null}}' From 3910cf370c2458beb6962e7a1864f3a79762defe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 11:16:20 +0000 Subject: [PATCH 543/592] feat(api): refactor(cdn)!: change type casing from Cdn* to CDN* by pedrodeoliveira, via Studio Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> --- .stats.yml | 2 +- api.md | 64 ++++++------- src/gcore/_client.py | 38 ++++---- src/gcore/pagination.py | 24 ++--- src/gcore/resources/cdn/__init__.py | 24 ++--- src/gcore/resources/cdn/audit_logs.py | 22 ++--- src/gcore/resources/cdn/cdn.py | 94 +++++++++---------- src/gcore/resources/cdn/logs.py | 10 +- src/gcore/resources/cdn/metrics.py | 10 +- .../resources/cdn/resources/resources.py | 44 ++++----- src/gcore/resources/cdn/resources/rules.py | 34 +++---- src/gcore/resources/streaming/statistics.py | 44 ++++----- src/gcore/types/cdn/__init__.py | 26 ++--- src/gcore/types/cdn/cdn_account.py | 4 +- src/gcore/types/cdn/cdn_account_limits.py | 4 +- src/gcore/types/cdn/cdn_audit_log_entry.py | 4 +- src/gcore/types/cdn/cdn_available_features.py | 4 +- .../cdn/cdn_list_purge_statuses_params.py | 4 +- .../cdn/cdn_list_purge_statuses_response.py | 4 +- src/gcore/types/cdn/cdn_log_entry.py | 4 +- src/gcore/types/cdn/cdn_metrics.py | 10 +- src/gcore/types/cdn/cdn_metrics_groups.py | 8 +- src/gcore/types/cdn/cdn_metrics_values.py | 6 +- src/gcore/types/cdn/cdn_resource.py | 4 +- src/gcore/types/cdn/cdn_resource_list.py | 6 +- .../types/cdn/cdn_update_account_params.py | 4 +- src/gcore/types/cdn/resources/__init__.py | 2 +- .../types/cdn/resources/cdn_resource_rule.py | 4 +- .../types/cdn/resources/rule_list_response.py | 4 +- src/gcore/types/iam/account_overview.py | 18 ++-- src/gcore/types/streaming/__init__.py | 16 ++-- ...tatistic_get_live_watch_time_cdn_params.py | 4 +- ...ic_get_live_watch_time_total_cdn_params.py | 4 +- ...statistic_get_unique_viewers_cdn_params.py | 4 +- ...istic_get_vod_unique_viewers_cdn_params.py | 4 +- ...statistic_get_vod_watch_time_cdn_params.py | 4 +- ...tic_get_vod_watch_time_total_cdn_params.py | 4 +- ...c_get_vod_watch_time_total_cdn_response.py | 6 +- .../types/streaming/unique_viewers_cdn.py | 4 +- .../api_resources/cdn/resources/test_rules.py | 62 ++++++------ tests/api_resources/cdn/test_audit_logs.py | 30 +++--- tests/api_resources/cdn/test_logs.py | 18 ++-- tests/api_resources/cdn/test_metrics.py | 18 ++-- tests/api_resources/cdn/test_resources.py | 80 ++++++++-------- .../streaming/test_statistics.py | 36 +++---- tests/api_resources/test_cdn.py | 80 ++++++++-------- 46 files changed, 452 insertions(+), 452 deletions(-) diff --git a/.stats.yml b/.stats.yml index 74fb9b3e..5f7f256b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-58d9afa7f8342ead022bd8fa12bb8abbeb9c0fb1e16f052ee6c4a59fae373e27.yml openapi_spec_hash: 2ae4db03cfc907be71d44288503838d7 -config_hash: 98f7a9b9463b6248408d48a4adbb14d3 +config_hash: 9268939ae4d27baa6e68cb8b24eaf063 diff --git a/api.md b/api.md index 4184baed..92e65e1c 100644 --- a/api.md +++ b/api.md @@ -1919,7 +1919,7 @@ from gcore.types.streaming import ( StorageSeries, StreamSeries, UniqueViewers, - UniqueViewersCdn, + UniqueViewersCDN, Views, ViewsByBrowser, ViewsByCountry, @@ -1931,7 +1931,7 @@ from gcore.types.streaming import ( VodStatisticsSeries, VodTotalStreamDurationSeries, StatisticGetLiveUniqueViewersResponse, - StatisticGetVodWatchTimeTotalCdnResponse, + StatisticGetVodWatchTimeTotalCDNResponse, ) ``` @@ -1946,7 +1946,7 @@ Methods: - client.streaming.statistics.get_storage_series(\*\*params) -> StorageSeries - client.streaming.statistics.get_stream_series(\*\*params) -> StreamSeries - client.streaming.statistics.get_unique_viewers(\*\*params) -> UniqueViewers -- client.streaming.statistics.get_unique_viewers_cdn(\*\*params) -> UniqueViewersCdn +- client.streaming.statistics.get_unique_viewers_cdn(\*\*params) -> UniqueViewersCDN - client.streaming.statistics.get_views(\*\*params) -> Views - client.streaming.statistics.get_views_by_browsers(\*\*params) -> ViewsByBrowser - client.streaming.statistics.get_views_by_country(\*\*params) -> ViewsByCountry @@ -1959,7 +1959,7 @@ Methods: - client.streaming.statistics.get_vod_transcoding_duration(\*\*params) -> VodStatisticsSeries - client.streaming.statistics.get_vod_unique_viewers_cdn(\*\*params) -> VodStatisticsSeries - client.streaming.statistics.get_vod_watch_time_cdn(\*\*params) -> VodStatisticsSeries -- client.streaming.statistics.get_vod_watch_time_total_cdn(\*\*params) -> StatisticGetVodWatchTimeTotalCdnResponse +- client.streaming.statistics.get_vod_watch_time_total_cdn(\*\*params) -> StatisticGetVodWatchTimeTotalCDNResponse # Security @@ -2275,7 +2275,7 @@ Methods: - client.storage.buckets.policy.delete(bucket_name, \*, storage_id) -> None - client.storage.buckets.policy.get(bucket_name, \*, storage_id) -> PolicyGetResponse -# Cdn +# CDN Types: @@ -2283,43 +2283,43 @@ Types: from gcore.types.cdn import ( AlibabaRegions, AwsRegions, - CdnAccount, - CdnAccountLimits, - CdnAvailableFeatures, + CDNAccount, + CDNAccountLimits, + CDNAvailableFeatures, PurgeStatus, - CdnListPurgeStatusesResponse, + CDNListPurgeStatusesResponse, ) ``` Methods: -- client.cdn.get_account_limits() -> CdnAccountLimits -- client.cdn.get_account_overview() -> CdnAccount -- client.cdn.get_available_features() -> CdnAvailableFeatures +- client.cdn.get_account_limits() -> CDNAccountLimits +- client.cdn.get_account_overview() -> CDNAccount +- client.cdn.get_available_features() -> CDNAvailableFeatures - client.cdn.list_alibaba_regions() -> AlibabaRegions - client.cdn.list_aws_regions() -> AwsRegions -- client.cdn.list_purge_statuses(\*\*params) -> CdnListPurgeStatusesResponse -- client.cdn.update_account(\*\*params) -> CdnAccount +- client.cdn.list_purge_statuses(\*\*params) -> CDNListPurgeStatusesResponse +- client.cdn.update_account(\*\*params) -> CDNAccount ## Resources Types: ```python -from gcore.types.cdn import CdnResource, CdnResourceList +from gcore.types.cdn import CDNResource, CDNResourceList ``` Methods: -- client.cdn.resources.create(\*\*params) -> CdnResource -- client.cdn.resources.update(resource_id, \*\*params) -> CdnResource -- client.cdn.resources.list(\*\*params) -> CdnResourceList +- client.cdn.resources.create(\*\*params) -> CDNResource +- client.cdn.resources.update(resource_id, \*\*params) -> CDNResource +- client.cdn.resources.list(\*\*params) -> CDNResourceList - client.cdn.resources.delete(resource_id) -> None -- client.cdn.resources.get(resource_id) -> CdnResource +- client.cdn.resources.get(resource_id) -> CDNResource - client.cdn.resources.prefetch(resource_id, \*\*params) -> None - client.cdn.resources.prevalidate_ssl_le_certificate(resource_id) -> None - client.cdn.resources.purge(resource_id, \*\*params) -> None -- client.cdn.resources.replace(resource_id, \*\*params) -> CdnResource +- client.cdn.resources.replace(resource_id, \*\*params) -> CDNResource ### Shield @@ -2339,17 +2339,17 @@ Methods: Types: ```python -from gcore.types.cdn.resources import CdnResourceRule, RuleListResponse +from gcore.types.cdn.resources import CDNResourceRule, RuleListResponse ``` Methods: -- client.cdn.resources.rules.create(resource_id, \*\*params) -> CdnResourceRule -- client.cdn.resources.rules.update(rule_id, \*, resource_id, \*\*params) -> CdnResourceRule +- client.cdn.resources.rules.create(resource_id, \*\*params) -> CDNResourceRule +- client.cdn.resources.rules.update(rule_id, \*, resource_id, \*\*params) -> CDNResourceRule - client.cdn.resources.rules.list(resource_id) -> RuleListResponse - client.cdn.resources.rules.delete(rule_id, \*, resource_id) -> None -- client.cdn.resources.rules.get(rule_id, \*, resource_id) -> CdnResourceRule -- client.cdn.resources.rules.replace(rule_id, \*, resource_id, \*\*params) -> CdnResourceRule +- client.cdn.resources.rules.get(rule_id, \*, resource_id) -> CDNResourceRule +- client.cdn.resources.rules.replace(rule_id, \*, resource_id, \*\*params) -> CDNResourceRule ## Shields @@ -2437,25 +2437,25 @@ Methods: Types: ```python -from gcore.types.cdn import CdnAuditLogEntry +from gcore.types.cdn import CDNAuditLogEntry ``` Methods: -- client.cdn.audit_logs.list(\*\*params) -> SyncOffsetPage[CdnAuditLogEntry] -- client.cdn.audit_logs.get(log_id) -> CdnAuditLogEntry +- client.cdn.audit_logs.list(\*\*params) -> SyncOffsetPage[CDNAuditLogEntry] +- client.cdn.audit_logs.get(log_id) -> CDNAuditLogEntry ## Logs Types: ```python -from gcore.types.cdn import CdnLogEntry +from gcore.types.cdn import CDNLogEntry ``` Methods: -- client.cdn.logs.list(\*\*params) -> SyncOffsetPageCdnLogs[Data] +- client.cdn.logs.list(\*\*params) -> SyncOffsetPageCDNLogs[Data] - client.cdn.logs.download(\*\*params) -> BinaryAPIResponse ## LogsUploader @@ -2564,12 +2564,12 @@ Methods: Types: ```python -from gcore.types.cdn import CdnMetrics, CdnMetricsGroups, CdnMetricsValues +from gcore.types.cdn import CDNMetrics, CDNMetricsGroups, CDNMetricsValues ``` Methods: -- client.cdn.metrics.list(\*\*params) -> CdnMetrics +- client.cdn.metrics.list(\*\*params) -> CDNMetrics ## IPRanges diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 4bd616d2..d43fa1cb 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -32,7 +32,7 @@ if TYPE_CHECKING: from .resources import cdn, dns, iam, waap, cloud, storage, fastedge, security, streaming - from .resources.cdn.cdn import CdnResource, AsyncCdnResource + from .resources.cdn.cdn import CDNResource, AsyncCDNResource from .resources.dns.dns import DNSResource, AsyncDNSResource from .resources.iam.iam import IamResource, AsyncIamResource from .resources.waap.waap import WaapResource, AsyncWaapResource @@ -176,10 +176,10 @@ def storage(self) -> StorageResource: return StorageResource(self) @cached_property - def cdn(self) -> CdnResource: - from .resources.cdn import CdnResource + def cdn(self) -> CDNResource: + from .resources.cdn import CDNResource - return CdnResource(self) + return CDNResource(self) @cached_property def with_raw_response(self) -> GcoreWithRawResponse: @@ -451,10 +451,10 @@ def storage(self) -> AsyncStorageResource: return AsyncStorageResource(self) @cached_property - def cdn(self) -> AsyncCdnResource: - from .resources.cdn import AsyncCdnResource + def cdn(self) -> AsyncCDNResource: + from .resources.cdn import AsyncCDNResource - return AsyncCdnResource(self) + return AsyncCDNResource(self) @cached_property def with_raw_response(self) -> AsyncGcoreWithRawResponse: @@ -650,10 +650,10 @@ def storage(self) -> storage.StorageResourceWithRawResponse: return StorageResourceWithRawResponse(self._client.storage) @cached_property - def cdn(self) -> cdn.CdnResourceWithRawResponse: - from .resources.cdn import CdnResourceWithRawResponse + def cdn(self) -> cdn.CDNResourceWithRawResponse: + from .resources.cdn import CDNResourceWithRawResponse - return CdnResourceWithRawResponse(self._client.cdn) + return CDNResourceWithRawResponse(self._client.cdn) class AsyncGcoreWithRawResponse: @@ -711,10 +711,10 @@ def storage(self) -> storage.AsyncStorageResourceWithRawResponse: return AsyncStorageResourceWithRawResponse(self._client.storage) @cached_property - def cdn(self) -> cdn.AsyncCdnResourceWithRawResponse: - from .resources.cdn import AsyncCdnResourceWithRawResponse + def cdn(self) -> cdn.AsyncCDNResourceWithRawResponse: + from .resources.cdn import AsyncCDNResourceWithRawResponse - return AsyncCdnResourceWithRawResponse(self._client.cdn) + return AsyncCDNResourceWithRawResponse(self._client.cdn) class GcoreWithStreamedResponse: @@ -772,10 +772,10 @@ def storage(self) -> storage.StorageResourceWithStreamingResponse: return StorageResourceWithStreamingResponse(self._client.storage) @cached_property - def cdn(self) -> cdn.CdnResourceWithStreamingResponse: - from .resources.cdn import CdnResourceWithStreamingResponse + def cdn(self) -> cdn.CDNResourceWithStreamingResponse: + from .resources.cdn import CDNResourceWithStreamingResponse - return CdnResourceWithStreamingResponse(self._client.cdn) + return CDNResourceWithStreamingResponse(self._client.cdn) class AsyncGcoreWithStreamedResponse: @@ -833,10 +833,10 @@ def storage(self) -> storage.AsyncStorageResourceWithStreamingResponse: return AsyncStorageResourceWithStreamingResponse(self._client.storage) @cached_property - def cdn(self) -> cdn.AsyncCdnResourceWithStreamingResponse: - from .resources.cdn import AsyncCdnResourceWithStreamingResponse + def cdn(self) -> cdn.AsyncCDNResourceWithStreamingResponse: + from .resources.cdn import AsyncCDNResourceWithStreamingResponse - return AsyncCdnResourceWithStreamingResponse(self._client.cdn) + return AsyncCDNResourceWithStreamingResponse(self._client.cdn) Client = Gcore diff --git a/src/gcore/pagination.py b/src/gcore/pagination.py index 24edbc64..872117cd 100644 --- a/src/gcore/pagination.py +++ b/src/gcore/pagination.py @@ -22,11 +22,11 @@ "AsyncPageStreamingAI", "SyncPageStreaming", "AsyncPageStreaming", - "SyncOffsetPageCdn", - "AsyncOffsetPageCdn", - "OffsetPageCdnLogsMeta", - "SyncOffsetPageCdnLogs", - "AsyncOffsetPageCdnLogs", + "SyncOffsetPageCDN", + "AsyncOffsetPageCDN", + "OffsetPageCDNLogsMeta", + "SyncOffsetPageCDNLogs", + "AsyncOffsetPageCDNLogs", ] _BaseModelT = TypeVar("_BaseModelT", bound=BaseModel) @@ -364,7 +364,7 @@ def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseM ) -class SyncOffsetPageCdn(BaseSyncPage[_T], BasePage[_T], Generic[_T]): +class SyncOffsetPageCDN(BaseSyncPage[_T], BasePage[_T], Generic[_T]): items: List[_T] @override @@ -395,7 +395,7 @@ def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseM ) -class AsyncOffsetPageCdn(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): +class AsyncOffsetPageCDN(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): items: List[_T] @override @@ -426,13 +426,13 @@ def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseM ) -class OffsetPageCdnLogsMeta(BaseModel): +class OffsetPageCDNLogsMeta(BaseModel): count: Optional[int] = None -class SyncOffsetPageCdnLogs(BaseSyncPage[_T], BasePage[_T], Generic[_T]): +class SyncOffsetPageCDNLogs(BaseSyncPage[_T], BasePage[_T], Generic[_T]): data: List[_T] - meta: Optional[OffsetPageCdnLogsMeta] = None + meta: Optional[OffsetPageCDNLogsMeta] = None @override def _get_page_items(self) -> List[_T]: @@ -463,9 +463,9 @@ def next_page_info(self) -> Optional[PageInfo]: return None -class AsyncOffsetPageCdnLogs(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): +class AsyncOffsetPageCDNLogs(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): data: List[_T] - meta: Optional[OffsetPageCdnLogsMeta] = None + meta: Optional[OffsetPageCDNLogsMeta] = None @override def _get_page_items(self) -> List[_T]: diff --git a/src/gcore/resources/cdn/__init__.py b/src/gcore/resources/cdn/__init__.py index 6fcdaceb..c47bbc40 100644 --- a/src/gcore/resources/cdn/__init__.py +++ b/src/gcore/resources/cdn/__init__.py @@ -1,12 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .cdn import ( - CdnResource, - AsyncCdnResource, - CdnResourceWithRawResponse, - AsyncCdnResourceWithRawResponse, - CdnResourceWithStreamingResponse, - AsyncCdnResourceWithStreamingResponse, + CDNResource, + AsyncCDNResource, + CDNResourceWithRawResponse, + AsyncCDNResourceWithRawResponse, + CDNResourceWithStreamingResponse, + AsyncCDNResourceWithStreamingResponse, ) from .logs import ( LogsResource, @@ -192,10 +192,10 @@ "AsyncIPRangesResourceWithRawResponse", "IPRangesResourceWithStreamingResponse", "AsyncIPRangesResourceWithStreamingResponse", - "CdnResource", - "AsyncCdnResource", - "CdnResourceWithRawResponse", - "AsyncCdnResourceWithRawResponse", - "CdnResourceWithStreamingResponse", - "AsyncCdnResourceWithStreamingResponse", + "CDNResource", + "AsyncCDNResource", + "CDNResourceWithRawResponse", + "AsyncCDNResourceWithRawResponse", + "CDNResourceWithStreamingResponse", + "AsyncCDNResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/cdn/audit_logs.py b/src/gcore/resources/cdn/audit_logs.py index 910d3524..e77a7315 100644 --- a/src/gcore/resources/cdn/audit_logs.py +++ b/src/gcore/resources/cdn/audit_logs.py @@ -17,7 +17,7 @@ from ...types.cdn import audit_log_list_params from ...pagination import SyncOffsetPage, AsyncOffsetPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.cdn.cdn_audit_log_entry import CdnAuditLogEntry +from ...types.cdn.cdn_audit_log_entry import CDNAuditLogEntry __all__ = ["AuditLogsResource", "AsyncAuditLogsResource"] @@ -62,7 +62,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncOffsetPage[CdnAuditLogEntry]: + ) -> SyncOffsetPage[CDNAuditLogEntry]: """ Get information about all CDN activity logs records. @@ -126,7 +126,7 @@ def list( """ return self._get_api_list( "/cdn/activity_log/requests", - page=SyncOffsetPage[CdnAuditLogEntry], + page=SyncOffsetPage[CDNAuditLogEntry], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -149,7 +149,7 @@ def list( audit_log_list_params.AuditLogListParams, ), ), - model=CdnAuditLogEntry, + model=CDNAuditLogEntry, ) def get( @@ -162,7 +162,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnAuditLogEntry: + ) -> CDNAuditLogEntry: """ Get information about CDN activity logs record. @@ -182,7 +182,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnAuditLogEntry, + cast_to=CDNAuditLogEntry, ) @@ -226,7 +226,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[CdnAuditLogEntry, AsyncOffsetPage[CdnAuditLogEntry]]: + ) -> AsyncPaginator[CDNAuditLogEntry, AsyncOffsetPage[CDNAuditLogEntry]]: """ Get information about all CDN activity logs records. @@ -290,7 +290,7 @@ def list( """ return self._get_api_list( "/cdn/activity_log/requests", - page=AsyncOffsetPage[CdnAuditLogEntry], + page=AsyncOffsetPage[CDNAuditLogEntry], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -313,7 +313,7 @@ def list( audit_log_list_params.AuditLogListParams, ), ), - model=CdnAuditLogEntry, + model=CDNAuditLogEntry, ) async def get( @@ -326,7 +326,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnAuditLogEntry: + ) -> CDNAuditLogEntry: """ Get information about CDN activity logs record. @@ -346,7 +346,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnAuditLogEntry, + cast_to=CDNAuditLogEntry, ) diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py index 0fb78a73..975703ec 100644 --- a/src/gcore/resources/cdn/cdn.py +++ b/src/gcore/resources/cdn/cdn.py @@ -105,7 +105,7 @@ AsyncResourcesResourceWithStreamingResponse, ) from ...types.cdn.aws_regions import AwsRegions -from ...types.cdn.cdn_account import CdnAccount +from ...types.cdn.cdn_account import CDNAccount from .trusted_ca_certificates import ( TrustedCaCertificatesResource, AsyncTrustedCaCertificatesResource, @@ -123,14 +123,14 @@ LogsUploaderResourceWithStreamingResponse, AsyncLogsUploaderResourceWithStreamingResponse, ) -from ...types.cdn.cdn_account_limits import CdnAccountLimits -from ...types.cdn.cdn_available_features import CdnAvailableFeatures -from ...types.cdn.cdn_list_purge_statuses_response import CdnListPurgeStatusesResponse +from ...types.cdn.cdn_account_limits import CDNAccountLimits +from ...types.cdn.cdn_available_features import CDNAvailableFeatures +from ...types.cdn.cdn_list_purge_statuses_response import CDNListPurgeStatusesResponse -__all__ = ["CdnResource", "AsyncCdnResource"] +__all__ = ["CDNResource", "AsyncCDNResource"] -class CdnResource(SyncAPIResource): +class CDNResource(SyncAPIResource): @cached_property def resources(self) -> ResourcesResource: return ResourcesResource(self._client) @@ -184,23 +184,23 @@ def ip_ranges(self) -> IPRangesResource: return IPRangesResource(self._client) @cached_property - def with_raw_response(self) -> CdnResourceWithRawResponse: + def with_raw_response(self) -> CDNResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ - return CdnResourceWithRawResponse(self) + return CDNResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CdnResourceWithStreamingResponse: + def with_streaming_response(self) -> CDNResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ - return CdnResourceWithStreamingResponse(self) + return CDNResourceWithStreamingResponse(self) def get_account_limits( self, @@ -211,14 +211,14 @@ def get_account_limits( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnAccountLimits: + ) -> CDNAccountLimits: """Get information about CDN service limits.""" return self._get( "/cdn/clients/me/limits", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnAccountLimits, + cast_to=CDNAccountLimits, ) def get_account_overview( @@ -230,14 +230,14 @@ def get_account_overview( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnAccount: + ) -> CDNAccount: """Get information about CDN service.""" return self._get( "/cdn/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnAccount, + cast_to=CDNAccount, ) def get_available_features( @@ -249,14 +249,14 @@ def get_available_features( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnAvailableFeatures: + ) -> CDNAvailableFeatures: """Get information about available CDN features.""" return self._get( "/cdn/clients/me/features", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnAvailableFeatures, + cast_to=CDNAvailableFeatures, ) def list_alibaba_regions( @@ -313,7 +313,7 @@ def list_purge_statuses( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnListPurgeStatusesResponse: + ) -> CDNListPurgeStatusesResponse: """ Get purges history. @@ -386,10 +386,10 @@ def list_purge_statuses( "status": status, "to_created": to_created, }, - cdn_list_purge_statuses_params.CdnListPurgeStatusesParams, + cdn_list_purge_statuses_params.CDNListPurgeStatusesParams, ), ), - cast_to=CdnListPurgeStatusesResponse, + cast_to=CDNListPurgeStatusesResponse, ) def update_account( @@ -402,7 +402,7 @@ def update_account( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnAccount: + ) -> CDNAccount: """ Change information about CDN service. @@ -422,16 +422,16 @@ def update_account( return self._patch( "/cdn/clients/me", body=maybe_transform( - {"utilization_level": utilization_level}, cdn_update_account_params.CdnUpdateAccountParams + {"utilization_level": utilization_level}, cdn_update_account_params.CDNUpdateAccountParams ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnAccount, + cast_to=CDNAccount, ) -class AsyncCdnResource(AsyncAPIResource): +class AsyncCDNResource(AsyncAPIResource): @cached_property def resources(self) -> AsyncResourcesResource: return AsyncResourcesResource(self._client) @@ -485,23 +485,23 @@ def ip_ranges(self) -> AsyncIPRangesResource: return AsyncIPRangesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncCdnResourceWithRawResponse: + def with_raw_response(self) -> AsyncCDNResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ - return AsyncCdnResourceWithRawResponse(self) + return AsyncCDNResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCdnResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncCDNResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ - return AsyncCdnResourceWithStreamingResponse(self) + return AsyncCDNResourceWithStreamingResponse(self) async def get_account_limits( self, @@ -512,14 +512,14 @@ async def get_account_limits( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnAccountLimits: + ) -> CDNAccountLimits: """Get information about CDN service limits.""" return await self._get( "/cdn/clients/me/limits", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnAccountLimits, + cast_to=CDNAccountLimits, ) async def get_account_overview( @@ -531,14 +531,14 @@ async def get_account_overview( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnAccount: + ) -> CDNAccount: """Get information about CDN service.""" return await self._get( "/cdn/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnAccount, + cast_to=CDNAccount, ) async def get_available_features( @@ -550,14 +550,14 @@ async def get_available_features( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnAvailableFeatures: + ) -> CDNAvailableFeatures: """Get information about available CDN features.""" return await self._get( "/cdn/clients/me/features", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnAvailableFeatures, + cast_to=CDNAvailableFeatures, ) async def list_alibaba_regions( @@ -614,7 +614,7 @@ async def list_purge_statuses( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnListPurgeStatusesResponse: + ) -> CDNListPurgeStatusesResponse: """ Get purges history. @@ -687,10 +687,10 @@ async def list_purge_statuses( "status": status, "to_created": to_created, }, - cdn_list_purge_statuses_params.CdnListPurgeStatusesParams, + cdn_list_purge_statuses_params.CDNListPurgeStatusesParams, ), ), - cast_to=CdnListPurgeStatusesResponse, + cast_to=CDNListPurgeStatusesResponse, ) async def update_account( @@ -703,7 +703,7 @@ async def update_account( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnAccount: + ) -> CDNAccount: """ Change information about CDN service. @@ -723,17 +723,17 @@ async def update_account( return await self._patch( "/cdn/clients/me", body=await async_maybe_transform( - {"utilization_level": utilization_level}, cdn_update_account_params.CdnUpdateAccountParams + {"utilization_level": utilization_level}, cdn_update_account_params.CDNUpdateAccountParams ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnAccount, + cast_to=CDNAccount, ) -class CdnResourceWithRawResponse: - def __init__(self, cdn: CdnResource) -> None: +class CDNResourceWithRawResponse: + def __init__(self, cdn: CDNResource) -> None: self._cdn = cdn self.get_account_limits = to_raw_response_wrapper( @@ -811,8 +811,8 @@ def ip_ranges(self) -> IPRangesResourceWithRawResponse: return IPRangesResourceWithRawResponse(self._cdn.ip_ranges) -class AsyncCdnResourceWithRawResponse: - def __init__(self, cdn: AsyncCdnResource) -> None: +class AsyncCDNResourceWithRawResponse: + def __init__(self, cdn: AsyncCDNResource) -> None: self._cdn = cdn self.get_account_limits = async_to_raw_response_wrapper( @@ -890,8 +890,8 @@ def ip_ranges(self) -> AsyncIPRangesResourceWithRawResponse: return AsyncIPRangesResourceWithRawResponse(self._cdn.ip_ranges) -class CdnResourceWithStreamingResponse: - def __init__(self, cdn: CdnResource) -> None: +class CDNResourceWithStreamingResponse: + def __init__(self, cdn: CDNResource) -> None: self._cdn = cdn self.get_account_limits = to_streamed_response_wrapper( @@ -969,8 +969,8 @@ def ip_ranges(self) -> IPRangesResourceWithStreamingResponse: return IPRangesResourceWithStreamingResponse(self._cdn.ip_ranges) -class AsyncCdnResourceWithStreamingResponse: - def __init__(self, cdn: AsyncCdnResource) -> None: +class AsyncCDNResourceWithStreamingResponse: + def __init__(self, cdn: AsyncCDNResource) -> None: self._cdn = cdn self.get_account_limits = async_to_streamed_response_wrapper( diff --git a/src/gcore/resources/cdn/logs.py b/src/gcore/resources/cdn/logs.py index 7520c6dd..4791a254 100644 --- a/src/gcore/resources/cdn/logs.py +++ b/src/gcore/resources/cdn/logs.py @@ -23,7 +23,7 @@ async_to_custom_streamed_response_wrapper, ) from ...types.cdn import log_list_params, log_download_params -from ...pagination import SyncOffsetPageCdnLogs, AsyncOffsetPageCdnLogs +from ...pagination import SyncOffsetPageCDNLogs, AsyncOffsetPageCDNLogs from ..._base_client import AsyncPaginator, make_request_options from ...types.cdn.cdn_log_entry import Data @@ -110,7 +110,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncOffsetPageCdnLogs[Data]: + ) -> SyncOffsetPageCDNLogs[Data]: """ Get CDN logs for up to 3 days starting today. @@ -298,7 +298,7 @@ def list( """ return self._get_api_list( "/cdn/advanced/v1/logs", - page=SyncOffsetPageCdnLogs[Data], + page=SyncOffsetPageCDNLogs[Data], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -761,7 +761,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[Data, AsyncOffsetPageCdnLogs[Data]]: + ) -> AsyncPaginator[Data, AsyncOffsetPageCDNLogs[Data]]: """ Get CDN logs for up to 3 days starting today. @@ -949,7 +949,7 @@ def list( """ return self._get_api_list( "/cdn/advanced/v1/logs", - page=AsyncOffsetPageCdnLogs[Data], + page=AsyncOffsetPageCDNLogs[Data], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cdn/metrics.py b/src/gcore/resources/cdn/metrics.py index d1c551bd..1f2297a4 100644 --- a/src/gcore/resources/cdn/metrics.py +++ b/src/gcore/resources/cdn/metrics.py @@ -18,7 +18,7 @@ ) from ...types.cdn import metric_list_params from ..._base_client import make_request_options -from ...types.cdn.cdn_metrics import CdnMetrics +from ...types.cdn.cdn_metrics import CDNMetrics __all__ = ["MetricsResource", "AsyncMetricsResource"] @@ -58,7 +58,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnMetrics: + ) -> CDNMetrics: """ Get CDN metrics @@ -197,7 +197,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnMetrics, + cast_to=CDNMetrics, ) @@ -236,7 +236,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnMetrics: + ) -> CDNMetrics: """ Get CDN metrics @@ -375,7 +375,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnMetrics, + cast_to=CDNMetrics, ) diff --git a/src/gcore/resources/cdn/resources/resources.py b/src/gcore/resources/cdn/resources/resources.py index 2ceda584..d581bd95 100644 --- a/src/gcore/resources/cdn/resources/resources.py +++ b/src/gcore/resources/cdn/resources/resources.py @@ -42,8 +42,8 @@ resource_prefetch_params, ) from ...._base_client import make_request_options -from ....types.cdn.cdn_resource import CdnResource -from ....types.cdn.cdn_resource_list import CdnResourceList +from ....types.cdn.cdn_resource import CDNResource +from ....types.cdn.cdn_resource_list import CDNResourceList __all__ = ["ResourcesResource", "AsyncResourcesResource"] @@ -101,7 +101,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResource: + ) -> CDNResource: """ Create CDN resource @@ -225,7 +225,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResource, + cast_to=CDNResource, ) def update( @@ -250,7 +250,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResource: + ) -> CDNResource: """ Change CDN resource @@ -348,7 +348,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResource, + cast_to=CDNResource, ) def list( @@ -376,7 +376,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResourceList: + ) -> CDNResourceList: """ Get information about all CDN resources in your account. @@ -487,7 +487,7 @@ def list( resource_list_params.ResourceListParams, ), ), - cast_to=CdnResourceList, + cast_to=CDNResourceList, ) def delete( @@ -542,7 +542,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResource: + ) -> CDNResource: """ Get CDN resource details @@ -560,7 +560,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResource, + cast_to=CDNResource, ) def prefetch( @@ -848,7 +848,7 @@ def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResource: + ) -> CDNResource: """ Change CDN resource @@ -954,7 +954,7 @@ def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResource, + cast_to=CDNResource, ) @@ -1011,7 +1011,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResource: + ) -> CDNResource: """ Create CDN resource @@ -1135,7 +1135,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResource, + cast_to=CDNResource, ) async def update( @@ -1160,7 +1160,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResource: + ) -> CDNResource: """ Change CDN resource @@ -1258,7 +1258,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResource, + cast_to=CDNResource, ) async def list( @@ -1286,7 +1286,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResourceList: + ) -> CDNResourceList: """ Get information about all CDN resources in your account. @@ -1397,7 +1397,7 @@ async def list( resource_list_params.ResourceListParams, ), ), - cast_to=CdnResourceList, + cast_to=CDNResourceList, ) async def delete( @@ -1452,7 +1452,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResource: + ) -> CDNResource: """ Get CDN resource details @@ -1470,7 +1470,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResource, + cast_to=CDNResource, ) async def prefetch( @@ -1758,7 +1758,7 @@ async def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResource: + ) -> CDNResource: """ Change CDN resource @@ -1864,7 +1864,7 @@ async def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResource, + cast_to=CDNResource, ) diff --git a/src/gcore/resources/cdn/resources/rules.py b/src/gcore/resources/cdn/resources/rules.py index 88273cf0..4549dc4b 100644 --- a/src/gcore/resources/cdn/resources/rules.py +++ b/src/gcore/resources/cdn/resources/rules.py @@ -19,7 +19,7 @@ ) from ...._base_client import make_request_options from ....types.cdn.resources import rule_create_params, rule_update_params, rule_replace_params -from ....types.cdn.resources.cdn_resource_rule import CdnResourceRule +from ....types.cdn.resources.cdn_resource_rule import CDNResourceRule from ....types.cdn.resources.rule_list_response import RuleListResponse __all__ = ["RulesResource", "AsyncRulesResource"] @@ -63,7 +63,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResourceRule: + ) -> CDNResourceRule: """ Create rule @@ -147,7 +147,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResourceRule, + cast_to=CDNResourceRule, ) def update( @@ -169,7 +169,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResourceRule: + ) -> CDNResourceRule: """ Change rule @@ -253,7 +253,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResourceRule, + cast_to=CDNResourceRule, ) def list( @@ -338,7 +338,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResourceRule: + ) -> CDNResourceRule: """ Get rule details @@ -356,7 +356,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResourceRule, + cast_to=CDNResourceRule, ) def replace( @@ -378,7 +378,7 @@ def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResourceRule: + ) -> CDNResourceRule: """ Change rule @@ -462,7 +462,7 @@ def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResourceRule, + cast_to=CDNResourceRule, ) @@ -504,7 +504,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResourceRule: + ) -> CDNResourceRule: """ Create rule @@ -588,7 +588,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResourceRule, + cast_to=CDNResourceRule, ) async def update( @@ -610,7 +610,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResourceRule: + ) -> CDNResourceRule: """ Change rule @@ -694,7 +694,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResourceRule, + cast_to=CDNResourceRule, ) async def list( @@ -779,7 +779,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResourceRule: + ) -> CDNResourceRule: """ Get rule details @@ -797,7 +797,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResourceRule, + cast_to=CDNResourceRule, ) async def replace( @@ -819,7 +819,7 @@ async def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CdnResourceRule: + ) -> CDNResourceRule: """ Change rule @@ -903,7 +903,7 @@ async def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CdnResourceRule, + cast_to=CDNResourceRule, ) diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index aa67b732..234766df 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -56,12 +56,12 @@ from ...types.streaming.views_by_referer import ViewsByReferer from ...types.streaming.max_stream_series import MaxStreamSeries from ...types.streaming.views_by_hostname import ViewsByHostname -from ...types.streaming.unique_viewers_cdn import UniqueViewersCdn +from ...types.streaming.unique_viewers_cdn import UniqueViewersCDN from ...types.streaming.vod_statistics_series import VodStatisticsSeries from ...types.streaming.views_by_operating_system import ViewsByOperatingSystem from ...types.streaming.vod_total_stream_duration_series import VodTotalStreamDurationSeries from ...types.streaming.statistic_get_live_unique_viewers_response import StatisticGetLiveUniqueViewersResponse -from ...types.streaming.statistic_get_vod_watch_time_total_cdn_response import StatisticGetVodWatchTimeTotalCdnResponse +from ...types.streaming.statistic_get_vod_watch_time_total_cdn_response import StatisticGetVodWatchTimeTotalCDNResponse __all__ = ["StatisticsResource", "AsyncStatisticsResource"] @@ -275,7 +275,7 @@ def get_live_watch_time_cdn( "stream_id": stream_id, "to": to, }, - statistic_get_live_watch_time_cdn_params.StatisticGetLiveWatchTimeCdnParams, + statistic_get_live_watch_time_cdn_params.StatisticGetLiveWatchTimeCDNParams, ), ), cast_to=StreamSeries, @@ -336,7 +336,7 @@ def get_live_watch_time_total_cdn( "stream_id": stream_id, "to": to, }, - statistic_get_live_watch_time_total_cdn_params.StatisticGetLiveWatchTimeTotalCdnParams, + statistic_get_live_watch_time_total_cdn_params.StatisticGetLiveWatchTimeTotalCDNParams, ), ), cast_to=VodTotalStreamDurationSeries, @@ -645,7 +645,7 @@ def get_unique_viewers_cdn( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UniqueViewersCdn: + ) -> UniqueViewersCDN: """Сounts the number of unique viewers of a video entity over CDN. It doesn't @@ -726,10 +726,10 @@ def get_unique_viewers_cdn( "id": id, "type": type, }, - statistic_get_unique_viewers_cdn_params.StatisticGetUniqueViewersCdnParams, + statistic_get_unique_viewers_cdn_params.StatisticGetUniqueViewersCDNParams, ), ), - cast_to=UniqueViewersCdn, + cast_to=UniqueViewersCDN, ) def get_views( @@ -1356,7 +1356,7 @@ def get_vod_unique_viewers_cdn( "granularity": granularity, "slug": slug, }, - statistic_get_vod_unique_viewers_cdn_params.StatisticGetVodUniqueViewersCdnParams, + statistic_get_vod_unique_viewers_cdn_params.StatisticGetVodUniqueViewersCDNParams, ), ), cast_to=VodStatisticsSeries, @@ -1425,7 +1425,7 @@ def get_vod_watch_time_cdn( "slug": slug, "to": to, }, - statistic_get_vod_watch_time_cdn_params.StatisticGetVodWatchTimeCdnParams, + statistic_get_vod_watch_time_cdn_params.StatisticGetVodWatchTimeCDNParams, ), ), cast_to=VodStatisticsSeries, @@ -1444,7 +1444,7 @@ def get_vod_watch_time_total_cdn( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StatisticGetVodWatchTimeTotalCdnResponse: + ) -> StatisticGetVodWatchTimeTotalCDNResponse: """Calculates the total duration of video watching in minutes. Views of only those @@ -1486,10 +1486,10 @@ def get_vod_watch_time_total_cdn( "slug": slug, "to": to, }, - statistic_get_vod_watch_time_total_cdn_params.StatisticGetVodWatchTimeTotalCdnParams, + statistic_get_vod_watch_time_total_cdn_params.StatisticGetVodWatchTimeTotalCDNParams, ), ), - cast_to=StatisticGetVodWatchTimeTotalCdnResponse, + cast_to=StatisticGetVodWatchTimeTotalCDNResponse, ) @@ -1702,7 +1702,7 @@ async def get_live_watch_time_cdn( "stream_id": stream_id, "to": to, }, - statistic_get_live_watch_time_cdn_params.StatisticGetLiveWatchTimeCdnParams, + statistic_get_live_watch_time_cdn_params.StatisticGetLiveWatchTimeCDNParams, ), ), cast_to=StreamSeries, @@ -1763,7 +1763,7 @@ async def get_live_watch_time_total_cdn( "stream_id": stream_id, "to": to, }, - statistic_get_live_watch_time_total_cdn_params.StatisticGetLiveWatchTimeTotalCdnParams, + statistic_get_live_watch_time_total_cdn_params.StatisticGetLiveWatchTimeTotalCDNParams, ), ), cast_to=VodTotalStreamDurationSeries, @@ -2072,7 +2072,7 @@ async def get_unique_viewers_cdn( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UniqueViewersCdn: + ) -> UniqueViewersCDN: """Сounts the number of unique viewers of a video entity over CDN. It doesn't @@ -2153,10 +2153,10 @@ async def get_unique_viewers_cdn( "id": id, "type": type, }, - statistic_get_unique_viewers_cdn_params.StatisticGetUniqueViewersCdnParams, + statistic_get_unique_viewers_cdn_params.StatisticGetUniqueViewersCDNParams, ), ), - cast_to=UniqueViewersCdn, + cast_to=UniqueViewersCDN, ) async def get_views( @@ -2783,7 +2783,7 @@ async def get_vod_unique_viewers_cdn( "granularity": granularity, "slug": slug, }, - statistic_get_vod_unique_viewers_cdn_params.StatisticGetVodUniqueViewersCdnParams, + statistic_get_vod_unique_viewers_cdn_params.StatisticGetVodUniqueViewersCDNParams, ), ), cast_to=VodStatisticsSeries, @@ -2852,7 +2852,7 @@ async def get_vod_watch_time_cdn( "slug": slug, "to": to, }, - statistic_get_vod_watch_time_cdn_params.StatisticGetVodWatchTimeCdnParams, + statistic_get_vod_watch_time_cdn_params.StatisticGetVodWatchTimeCDNParams, ), ), cast_to=VodStatisticsSeries, @@ -2871,7 +2871,7 @@ async def get_vod_watch_time_total_cdn( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StatisticGetVodWatchTimeTotalCdnResponse: + ) -> StatisticGetVodWatchTimeTotalCDNResponse: """Calculates the total duration of video watching in minutes. Views of only those @@ -2913,10 +2913,10 @@ async def get_vod_watch_time_total_cdn( "slug": slug, "to": to, }, - statistic_get_vod_watch_time_total_cdn_params.StatisticGetVodWatchTimeTotalCdnParams, + statistic_get_vod_watch_time_total_cdn_params.StatisticGetVodWatchTimeTotalCDNParams, ), ), - cast_to=StatisticGetVodWatchTimeTotalCdnResponse, + cast_to=StatisticGetVodWatchTimeTotalCDNResponse, ) diff --git a/src/gcore/types/cdn/__init__.py b/src/gcore/types/cdn/__init__.py index 8cd6fefc..c421bf3c 100644 --- a/src/gcore/types/cdn/__init__.py +++ b/src/gcore/types/cdn/__init__.py @@ -4,11 +4,11 @@ from .ssl_detail import SslDetail as SslDetail from .aws_regions import AwsRegions as AwsRegions -from .cdn_account import CdnAccount as CdnAccount -from .cdn_metrics import CdnMetrics as CdnMetrics -from .cdn_resource import CdnResource as CdnResource +from .cdn_account import CDNAccount as CDNAccount +from .cdn_metrics import CDNMetrics as CDNMetrics +from .cdn_resource import CDNResource as CDNResource from .purge_status import PurgeStatus as PurgeStatus -from .cdn_log_entry import CdnLogEntry as CdnLogEntry +from .cdn_log_entry import CDNLogEntry as CDNLogEntry from .origin_groups import OriginGroups as OriginGroups from .rule_template import RuleTemplate as RuleTemplate from .ca_certificate import CaCertificate as CaCertificate @@ -17,17 +17,17 @@ from .log_list_params import LogListParams as LogListParams from .ssl_detail_list import SslDetailList as SslDetailList from .network_capacity import NetworkCapacity as NetworkCapacity -from .cdn_resource_list import CdnResourceList as CdnResourceList -from .cdn_account_limits import CdnAccountLimits as CdnAccountLimits -from .cdn_metrics_groups import CdnMetricsGroups as CdnMetricsGroups -from .cdn_metrics_values import CdnMetricsValues as CdnMetricsValues +from .cdn_resource_list import CDNResourceList as CDNResourceList +from .cdn_account_limits import CDNAccountLimits as CDNAccountLimits +from .cdn_metrics_groups import CDNMetricsGroups as CDNMetricsGroups +from .cdn_metrics_values import CDNMetricsValues as CDNMetricsValues from .metric_list_params import MetricListParams as MetricListParams from .origin_groups_list import OriginGroupsList as OriginGroupsList from .rule_template_list import RuleTemplateList as RuleTemplateList from .ssl_request_status import SslRequestStatus as SslRequestStatus from .usage_series_stats import UsageSeriesStats as UsageSeriesStats from .ca_certificate_list import CaCertificateList as CaCertificateList -from .cdn_audit_log_entry import CdnAuditLogEntry as CdnAuditLogEntry +from .cdn_audit_log_entry import CDNAuditLogEntry as CDNAuditLogEntry from .log_download_params import LogDownloadParams as LogDownloadParams from .public_network_list import PublicNetworkList as PublicNetworkList from .ip_range_list_params import IPRangeListParams as IPRangeListParams @@ -37,7 +37,7 @@ from .audit_log_list_params import AuditLogListParams as AuditLogListParams from .logs_aggregated_stats import LogsAggregatedStats as LogsAggregatedStats from .resource_purge_params import ResourcePurgeParams as ResourcePurgeParams -from .cdn_available_features import CdnAvailableFeatures as CdnAvailableFeatures +from .cdn_available_features import CDNAvailableFeatures as CDNAvailableFeatures from .resource_create_params import ResourceCreateParams as ResourceCreateParams from .resource_update_params import ResourceUpdateParams as ResourceUpdateParams from .certificate_list_params import CertificateListParams as CertificateListParams @@ -47,7 +47,7 @@ from .logs_uploader_validation import LogsUploaderValidation as LogsUploaderValidation from .origin_group_list_params import OriginGroupListParams as OriginGroupListParams from .resource_prefetch_params import ResourcePrefetchParams as ResourcePrefetchParams -from .cdn_update_account_params import CdnUpdateAccountParams as CdnUpdateAccountParams +from .cdn_update_account_params import CDNUpdateAccountParams as CDNUpdateAccountParams from .certificate_create_params import CertificateCreateParams as CertificateCreateParams from .resource_aggregated_stats import ResourceAggregatedStats as ResourceAggregatedStats from .certificate_replace_params import CertificateReplaceParams as CertificateReplaceParams @@ -58,8 +58,8 @@ from .rule_template_update_params import RuleTemplateUpdateParams as RuleTemplateUpdateParams from .rule_template_replace_params import RuleTemplateReplaceParams as RuleTemplateReplaceParams from .certificate_get_status_params import CertificateGetStatusParams as CertificateGetStatusParams -from .cdn_list_purge_statuses_params import CdnListPurgeStatusesParams as CdnListPurgeStatusesParams -from .cdn_list_purge_statuses_response import CdnListPurgeStatusesResponse as CdnListPurgeStatusesResponse +from .cdn_list_purge_statuses_params import CDNListPurgeStatusesParams as CDNListPurgeStatusesParams +from .cdn_list_purge_statuses_response import CDNListPurgeStatusesResponse as CDNListPurgeStatusesResponse from .trusted_ca_certificate_list_params import TrustedCaCertificateListParams as TrustedCaCertificateListParams from .trusted_ca_certificate_create_params import TrustedCaCertificateCreateParams as TrustedCaCertificateCreateParams from .trusted_ca_certificate_replace_params import ( diff --git a/src/gcore/types/cdn/cdn_account.py b/src/gcore/types/cdn/cdn_account.py index a1a34e7e..c9bccffb 100644 --- a/src/gcore/types/cdn/cdn_account.py +++ b/src/gcore/types/cdn/cdn_account.py @@ -4,7 +4,7 @@ from ..._models import BaseModel -__all__ = ["CdnAccount", "Service"] +__all__ = ["CDNAccount", "Service"] class Service(BaseModel): @@ -38,7 +38,7 @@ class Service(BaseModel): """Date of the last CDN service status update (ISO 8601/RFC 3339 format, UTC.)""" -class CdnAccount(BaseModel): +class CDNAccount(BaseModel): id: Optional[int] = None """Account ID.""" diff --git a/src/gcore/types/cdn/cdn_account_limits.py b/src/gcore/types/cdn/cdn_account_limits.py index efaf384d..cb398ffa 100644 --- a/src/gcore/types/cdn/cdn_account_limits.py +++ b/src/gcore/types/cdn/cdn_account_limits.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["CdnAccountLimits"] +__all__ = ["CDNAccountLimits"] -class CdnAccountLimits(BaseModel): +class CDNAccountLimits(BaseModel): id: Optional[int] = None """Account ID.""" diff --git a/src/gcore/types/cdn/cdn_audit_log_entry.py b/src/gcore/types/cdn/cdn_audit_log_entry.py index 28064cb6..ec56b787 100644 --- a/src/gcore/types/cdn/cdn_audit_log_entry.py +++ b/src/gcore/types/cdn/cdn_audit_log_entry.py @@ -4,7 +4,7 @@ from ..._models import BaseModel -__all__ = ["CdnAuditLogEntry", "Action"] +__all__ = ["CDNAuditLogEntry", "Action"] class Action(BaseModel): @@ -25,7 +25,7 @@ class Action(BaseModel): """JSON representation of object before the request.""" -class CdnAuditLogEntry(BaseModel): +class CDNAuditLogEntry(BaseModel): id: Optional[int] = None """Activity logs record ID.""" diff --git a/src/gcore/types/cdn/cdn_available_features.py b/src/gcore/types/cdn/cdn_available_features.py index dead1cdc..ffeaf299 100644 --- a/src/gcore/types/cdn/cdn_available_features.py +++ b/src/gcore/types/cdn/cdn_available_features.py @@ -4,7 +4,7 @@ from ..._models import BaseModel -__all__ = ["CdnAvailableFeatures", "FreeFeature", "PaidFeature"] +__all__ = ["CDNAvailableFeatures", "FreeFeature", "PaidFeature"] class FreeFeature(BaseModel): @@ -35,7 +35,7 @@ class PaidFeature(BaseModel): """Internal feature activation ID.""" -class CdnAvailableFeatures(BaseModel): +class CDNAvailableFeatures(BaseModel): id: Optional[int] = None """Account ID.""" diff --git a/src/gcore/types/cdn/cdn_list_purge_statuses_params.py b/src/gcore/types/cdn/cdn_list_purge_statuses_params.py index 3c725a88..a0c3227b 100644 --- a/src/gcore/types/cdn/cdn_list_purge_statuses_params.py +++ b/src/gcore/types/cdn/cdn_list_purge_statuses_params.py @@ -4,10 +4,10 @@ from typing_extensions import TypedDict -__all__ = ["CdnListPurgeStatusesParams"] +__all__ = ["CDNListPurgeStatusesParams"] -class CdnListPurgeStatusesParams(TypedDict, total=False): +class CDNListPurgeStatusesParams(TypedDict, total=False): cname: str """Purges associated with a specific resource CNAME. diff --git a/src/gcore/types/cdn/cdn_list_purge_statuses_response.py b/src/gcore/types/cdn/cdn_list_purge_statuses_response.py index 1dec8100..e0a38e7c 100644 --- a/src/gcore/types/cdn/cdn_list_purge_statuses_response.py +++ b/src/gcore/types/cdn/cdn_list_purge_statuses_response.py @@ -5,6 +5,6 @@ from .purge_status import PurgeStatus -__all__ = ["CdnListPurgeStatusesResponse"] +__all__ = ["CDNListPurgeStatusesResponse"] -CdnListPurgeStatusesResponse: TypeAlias = List[PurgeStatus] +CDNListPurgeStatusesResponse: TypeAlias = List[PurgeStatus] diff --git a/src/gcore/types/cdn/cdn_log_entry.py b/src/gcore/types/cdn/cdn_log_entry.py index 017462cd..b9d193f9 100644 --- a/src/gcore/types/cdn/cdn_log_entry.py +++ b/src/gcore/types/cdn/cdn_log_entry.py @@ -4,7 +4,7 @@ from ..._models import BaseModel -__all__ = ["CdnLogEntry", "Data", "Meta"] +__all__ = ["CDNLogEntry", "Data", "Meta"] class Data(BaseModel): @@ -64,7 +64,7 @@ class Meta(BaseModel): """Total number of records which match given parameters.""" -class CdnLogEntry(BaseModel): +class CDNLogEntry(BaseModel): data: Optional[List[Data]] = None """Contains requested logs.""" diff --git a/src/gcore/types/cdn/cdn_metrics.py b/src/gcore/types/cdn/cdn_metrics.py index de50e377..26537ff3 100644 --- a/src/gcore/types/cdn/cdn_metrics.py +++ b/src/gcore/types/cdn/cdn_metrics.py @@ -4,15 +4,15 @@ from typing_extensions import TypeAlias from ..._models import BaseModel -from .cdn_metrics_groups import CdnMetricsGroups -from .cdn_metrics_values import CdnMetricsValues +from .cdn_metrics_groups import CDNMetricsGroups +from .cdn_metrics_values import CDNMetricsValues -__all__ = ["CdnMetrics", "Data"] +__all__ = ["CDNMetrics", "Data"] -Data: TypeAlias = Union[CdnMetricsValues, CdnMetricsGroups] +Data: TypeAlias = Union[CDNMetricsValues, CDNMetricsGroups] -class CdnMetrics(BaseModel): +class CDNMetrics(BaseModel): data: Optional[Data] = None """ If no grouping was requested then "data" holds an array of metric values. If at diff --git a/src/gcore/types/cdn/cdn_metrics_groups.py b/src/gcore/types/cdn/cdn_metrics_groups.py index e808f0bd..a88712d6 100644 --- a/src/gcore/types/cdn/cdn_metrics_groups.py +++ b/src/gcore/types/cdn/cdn_metrics_groups.py @@ -3,11 +3,11 @@ from typing import Optional from ..._models import BaseModel -from .cdn_metrics_values import CdnMetricsValues +from .cdn_metrics_values import CDNMetricsValues -__all__ = ["CdnMetricsGroups"] +__all__ = ["CDNMetricsGroups"] -class CdnMetricsGroups(BaseModel): - group: Optional[CdnMetricsValues] = None +class CDNMetricsGroups(BaseModel): + group: Optional[CDNMetricsValues] = None """List of requested metrics sorted by timestamp in ascending order.""" diff --git a/src/gcore/types/cdn/cdn_metrics_values.py b/src/gcore/types/cdn/cdn_metrics_values.py index d436ae54..cd63a18c 100644 --- a/src/gcore/types/cdn/cdn_metrics_values.py +++ b/src/gcore/types/cdn/cdn_metrics_values.py @@ -5,10 +5,10 @@ from ..._models import BaseModel -__all__ = ["CdnMetricsValues", "CdnMetricsValueItem"] +__all__ = ["CDNMetricsValues", "CDNMetricsValueItem"] -class CdnMetricsValueItem(BaseModel): +class CDNMetricsValueItem(BaseModel): metric: Optional[float] = None """Metrics value.""" @@ -16,4 +16,4 @@ class CdnMetricsValueItem(BaseModel): """Start timestamp of interval.""" -CdnMetricsValues: TypeAlias = List[CdnMetricsValueItem] +CDNMetricsValues: TypeAlias = List[CDNMetricsValueItem] diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py index 760e9ee1..0bcef26f 100644 --- a/src/gcore/types/cdn/cdn_resource.py +++ b/src/gcore/types/cdn/cdn_resource.py @@ -8,7 +8,7 @@ from ..._models import BaseModel __all__ = [ - "CdnResource", + "CDNResource", "Options", "OptionsAllowedHTTPMethods", "OptionsBotProtection", @@ -2020,7 +2020,7 @@ class Options(BaseModel): """Enables or disables WebSockets connections to an origin server.""" -class CdnResource(BaseModel): +class CDNResource(BaseModel): id: Optional[int] = None """CDN resource ID.""" diff --git a/src/gcore/types/cdn/cdn_resource_list.py b/src/gcore/types/cdn/cdn_resource_list.py index cfbed20c..8146c2e7 100644 --- a/src/gcore/types/cdn/cdn_resource_list.py +++ b/src/gcore/types/cdn/cdn_resource_list.py @@ -3,8 +3,8 @@ from typing import List from typing_extensions import TypeAlias -from .cdn_resource import CdnResource +from .cdn_resource import CDNResource -__all__ = ["CdnResourceList"] +__all__ = ["CDNResourceList"] -CdnResourceList: TypeAlias = List[CdnResource] +CDNResourceList: TypeAlias = List[CDNResource] diff --git a/src/gcore/types/cdn/cdn_update_account_params.py b/src/gcore/types/cdn/cdn_update_account_params.py index cfeba9f7..a103687e 100644 --- a/src/gcore/types/cdn/cdn_update_account_params.py +++ b/src/gcore/types/cdn/cdn_update_account_params.py @@ -4,10 +4,10 @@ from typing_extensions import TypedDict -__all__ = ["CdnUpdateAccountParams"] +__all__ = ["CDNUpdateAccountParams"] -class CdnUpdateAccountParams(TypedDict, total=False): +class CDNUpdateAccountParams(TypedDict, total=False): utilization_level: int """CDN traffic usage limit in gigabytes. diff --git a/src/gcore/types/cdn/resources/__init__.py b/src/gcore/types/cdn/resources/__init__.py index f5876a8a..b004f9f1 100644 --- a/src/gcore/types/cdn/resources/__init__.py +++ b/src/gcore/types/cdn/resources/__init__.py @@ -3,7 +3,7 @@ from __future__ import annotations from .origin_shielding import OriginShielding as OriginShielding -from .cdn_resource_rule import CdnResourceRule as CdnResourceRule +from .cdn_resource_rule import CDNResourceRule as CDNResourceRule from .rule_create_params import RuleCreateParams as RuleCreateParams from .rule_list_response import RuleListResponse as RuleListResponse from .rule_update_params import RuleUpdateParams as RuleUpdateParams diff --git a/src/gcore/types/cdn/resources/cdn_resource_rule.py b/src/gcore/types/cdn/resources/cdn_resource_rule.py index c28f6e6a..682384fd 100644 --- a/src/gcore/types/cdn/resources/cdn_resource_rule.py +++ b/src/gcore/types/cdn/resources/cdn_resource_rule.py @@ -8,7 +8,7 @@ from ...._models import BaseModel __all__ = [ - "CdnResourceRule", + "CDNResourceRule", "Options", "OptionsAllowedHTTPMethods", "OptionsBotProtection", @@ -1868,7 +1868,7 @@ class Options(BaseModel): """Enables or disables WebSockets connections to an origin server.""" -class CdnResourceRule(BaseModel): +class CDNResourceRule(BaseModel): id: Optional[int] = None """Rule ID.""" diff --git a/src/gcore/types/cdn/resources/rule_list_response.py b/src/gcore/types/cdn/resources/rule_list_response.py index 06cbe617..333d426a 100644 --- a/src/gcore/types/cdn/resources/rule_list_response.py +++ b/src/gcore/types/cdn/resources/rule_list_response.py @@ -3,8 +3,8 @@ from typing import List from typing_extensions import TypeAlias -from .cdn_resource_rule import CdnResourceRule +from .cdn_resource_rule import CDNResourceRule __all__ = ["RuleListResponse"] -RuleListResponse: TypeAlias = List[CdnResourceRule] +RuleListResponse: TypeAlias = List[CDNResourceRule] diff --git a/src/gcore/types/iam/account_overview.py b/src/gcore/types/iam/account_overview.py index ab1b57b6..ad8a265e 100644 --- a/src/gcore/types/iam/account_overview.py +++ b/src/gcore/types/iam/account_overview.py @@ -10,21 +10,21 @@ __all__ = [ "AccountOverview", "FreeFeatures", - "FreeFeaturesCdn", + "FreeFeaturesCDN", "FreeFeaturesCloud", "FreeFeaturesDDOS", "FreeFeaturesDNS", "FreeFeaturesStorage", "FreeFeaturesStreaming", "PaidFeatures", - "PaidFeaturesCdn", + "PaidFeaturesCDN", "PaidFeaturesCloud", "PaidFeaturesDDOS", "PaidFeaturesDNS", "PaidFeaturesStorage", "PaidFeaturesStreaming", "ServiceStatuses", - "ServiceStatusesCdn", + "ServiceStatusesCDN", "ServiceStatusesCloud", "ServiceStatusesDDOS", "ServiceStatusesDNS", @@ -35,7 +35,7 @@ ] -class FreeFeaturesCdn(BaseModel): +class FreeFeaturesCDN(BaseModel): """Feature object.""" create_date: Optional[str] = None @@ -154,7 +154,7 @@ 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) + cdn: Optional[List[FreeFeaturesCDN]] = FieldInfo(alias="CDN", default=None) cloud: Optional[List[FreeFeaturesCloud]] = FieldInfo(alias="CLOUD", default=None) @@ -167,7 +167,7 @@ class FreeFeatures(BaseModel): streaming: Optional[List[FreeFeaturesStreaming]] = FieldInfo(alias="STREAMING", default=None) -class PaidFeaturesCdn(BaseModel): +class PaidFeaturesCDN(BaseModel): """Feature object.""" create_date: Optional[str] = None @@ -286,7 +286,7 @@ 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) + cdn: Optional[List[PaidFeaturesCDN]] = FieldInfo(alias="CDN", default=None) cloud: Optional[List[PaidFeaturesCloud]] = FieldInfo(alias="CLOUD", default=None) @@ -299,7 +299,7 @@ class PaidFeatures(BaseModel): streaming: Optional[List[PaidFeaturesStreaming]] = FieldInfo(alias="STREAMING", default=None) -class ServiceStatusesCdn(BaseModel): +class ServiceStatusesCDN(BaseModel): enabled: Optional[bool] = None """`true` - service is available in the Control Panel.""" @@ -352,7 +352,7 @@ 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) + cdn: Optional[ServiceStatusesCDN] = FieldInfo(alias="CDN", default=None) cloud: Optional[ServiceStatusesCloud] = FieldInfo(alias="CLOUD", default=None) diff --git a/src/gcore/types/streaming/__init__.py b/src/gcore/types/streaming/__init__.py index 1e0e445a..ab0d0c3c 100644 --- a/src/gcore/types/streaming/__init__.py +++ b/src/gcore/types/streaming/__init__.py @@ -37,7 +37,7 @@ from .create_video_param import CreateVideoParam as CreateVideoParam from .player_list_params import PlayerListParams as PlayerListParams from .stream_list_params import StreamListParams as StreamListParams -from .unique_viewers_cdn import UniqueViewersCdn as UniqueViewersCdn +from .unique_viewers_cdn import UniqueViewersCDN as UniqueViewersCDN from .ai_task_list_params import AITaskListParams as AITaskListParams from .subtitle_base_param import SubtitleBaseParam as SubtitleBaseParam from .video_create_params import VideoCreateParams as VideoCreateParams @@ -102,38 +102,38 @@ StatisticGetMaxStreamsSeriesParams as StatisticGetMaxStreamsSeriesParams, ) from .statistic_get_unique_viewers_cdn_params import ( - StatisticGetUniqueViewersCdnParams as StatisticGetUniqueViewersCdnParams, + StatisticGetUniqueViewersCDNParams as StatisticGetUniqueViewersCDNParams, ) from .statistic_get_vod_storage_volume_params import ( StatisticGetVodStorageVolumeParams as StatisticGetVodStorageVolumeParams, ) from .statistic_get_vod_watch_time_cdn_params import ( - StatisticGetVodWatchTimeCdnParams as StatisticGetVodWatchTimeCdnParams, + StatisticGetVodWatchTimeCDNParams as StatisticGetVodWatchTimeCDNParams, ) from .statistic_get_live_unique_viewers_params import ( StatisticGetLiveUniqueViewersParams as StatisticGetLiveUniqueViewersParams, ) from .statistic_get_live_watch_time_cdn_params import ( - StatisticGetLiveWatchTimeCdnParams as StatisticGetLiveWatchTimeCdnParams, + StatisticGetLiveWatchTimeCDNParams as StatisticGetLiveWatchTimeCDNParams, ) from .statistic_get_live_unique_viewers_response import ( StatisticGetLiveUniqueViewersResponse as StatisticGetLiveUniqueViewersResponse, ) from .statistic_get_vod_unique_viewers_cdn_params import ( - StatisticGetVodUniqueViewersCdnParams as StatisticGetVodUniqueViewersCdnParams, + StatisticGetVodUniqueViewersCDNParams as StatisticGetVodUniqueViewersCDNParams, ) from .statistic_get_vod_transcoding_duration_params import ( StatisticGetVodTranscodingDurationParams as StatisticGetVodTranscodingDurationParams, ) from .statistic_get_vod_watch_time_total_cdn_params import ( - StatisticGetVodWatchTimeTotalCdnParams as StatisticGetVodWatchTimeTotalCdnParams, + StatisticGetVodWatchTimeTotalCDNParams as StatisticGetVodWatchTimeTotalCDNParams, ) from .statistic_get_live_watch_time_total_cdn_params import ( - StatisticGetLiveWatchTimeTotalCdnParams as StatisticGetLiveWatchTimeTotalCdnParams, + StatisticGetLiveWatchTimeTotalCDNParams as StatisticGetLiveWatchTimeTotalCDNParams, ) from .statistic_get_views_by_operating_system_params import ( StatisticGetViewsByOperatingSystemParams as StatisticGetViewsByOperatingSystemParams, ) from .statistic_get_vod_watch_time_total_cdn_response import ( - StatisticGetVodWatchTimeTotalCdnResponse as StatisticGetVodWatchTimeTotalCdnResponse, + StatisticGetVodWatchTimeTotalCDNResponse as StatisticGetVodWatchTimeTotalCDNResponse, ) diff --git a/src/gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py b/src/gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py index 74e37c52..a1b6a767 100644 --- a/src/gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py +++ b/src/gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py @@ -6,10 +6,10 @@ from ..._utils import PropertyInfo -__all__ = ["StatisticGetLiveWatchTimeCdnParams"] +__all__ = ["StatisticGetLiveWatchTimeCDNParams"] -class StatisticGetLiveWatchTimeCdnParams(TypedDict, total=False): +class StatisticGetLiveWatchTimeCDNParams(TypedDict, total=False): from_: Required[Annotated[str, PropertyInfo(alias="from")]] """Start of the time period for counting minutes of watching. diff --git a/src/gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py b/src/gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py index 0711a555..1eedab5e 100644 --- a/src/gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py +++ b/src/gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py @@ -6,10 +6,10 @@ from ..._utils import PropertyInfo -__all__ = ["StatisticGetLiveWatchTimeTotalCdnParams"] +__all__ = ["StatisticGetLiveWatchTimeTotalCDNParams"] -class StatisticGetLiveWatchTimeTotalCdnParams(TypedDict, total=False): +class StatisticGetLiveWatchTimeTotalCDNParams(TypedDict, total=False): client_user_id: int """Filter by field "client_user_id" """ diff --git a/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py b/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py index b8da4126..4944d6da 100644 --- a/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py +++ b/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py @@ -4,10 +4,10 @@ from typing_extensions import Literal, Required, TypedDict -__all__ = ["StatisticGetUniqueViewersCdnParams"] +__all__ = ["StatisticGetUniqueViewersCDNParams"] -class StatisticGetUniqueViewersCdnParams(TypedDict, total=False): +class StatisticGetUniqueViewersCDNParams(TypedDict, total=False): date_from: Required[str] """Start of time frame. Format is date time in ISO 8601.""" diff --git a/src/gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py b/src/gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py index a0ed38cb..8ad50cc1 100644 --- a/src/gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py +++ b/src/gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py @@ -6,10 +6,10 @@ from ..._utils import PropertyInfo -__all__ = ["StatisticGetVodUniqueViewersCdnParams"] +__all__ = ["StatisticGetVodUniqueViewersCDNParams"] -class StatisticGetVodUniqueViewersCdnParams(TypedDict, total=False): +class StatisticGetVodUniqueViewersCDNParams(TypedDict, total=False): from_: Required[Annotated[str, PropertyInfo(alias="from")]] """Start of time frame. Format is date time in ISO 8601""" diff --git a/src/gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py b/src/gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py index f7af2996..7fde051e 100644 --- a/src/gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py +++ b/src/gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py @@ -6,10 +6,10 @@ from ..._utils import PropertyInfo -__all__ = ["StatisticGetVodWatchTimeCdnParams"] +__all__ = ["StatisticGetVodWatchTimeCDNParams"] -class StatisticGetVodWatchTimeCdnParams(TypedDict, total=False): +class StatisticGetVodWatchTimeCDNParams(TypedDict, total=False): from_: Required[Annotated[str, PropertyInfo(alias="from")]] """Start of the time period for counting minutes of watching. diff --git a/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py b/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py index 2599d8bd..009ea82e 100644 --- a/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py +++ b/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py @@ -6,10 +6,10 @@ from ..._utils import PropertyInfo -__all__ = ["StatisticGetVodWatchTimeTotalCdnParams"] +__all__ = ["StatisticGetVodWatchTimeTotalCDNParams"] -class StatisticGetVodWatchTimeTotalCdnParams(TypedDict, total=False): +class StatisticGetVodWatchTimeTotalCDNParams(TypedDict, total=False): client_user_id: int """Filter by field "client_user_id" """ diff --git a/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py b/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py index 6e5e61c6..026684ad 100644 --- a/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py +++ b/src/gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py @@ -5,10 +5,10 @@ from ..._models import BaseModel -__all__ = ["StatisticGetVodWatchTimeTotalCdnResponse", "StatisticGetVodWatchTimeTotalCdnResponseItem"] +__all__ = ["StatisticGetVodWatchTimeTotalCDNResponse", "StatisticGetVodWatchTimeTotalCDNResponseItem"] -class StatisticGetVodWatchTimeTotalCdnResponseItem(BaseModel): +class StatisticGetVodWatchTimeTotalCDNResponseItem(BaseModel): client: int duration: int @@ -19,4 +19,4 @@ class StatisticGetVodWatchTimeTotalCdnResponseItem(BaseModel): slug: Optional[str] = None -StatisticGetVodWatchTimeTotalCdnResponse: TypeAlias = List[StatisticGetVodWatchTimeTotalCdnResponseItem] +StatisticGetVodWatchTimeTotalCDNResponse: TypeAlias = List[StatisticGetVodWatchTimeTotalCDNResponseItem] diff --git a/src/gcore/types/streaming/unique_viewers_cdn.py b/src/gcore/types/streaming/unique_viewers_cdn.py index a7afa0fe..ab3f1f1e 100644 --- a/src/gcore/types/streaming/unique_viewers_cdn.py +++ b/src/gcore/types/streaming/unique_viewers_cdn.py @@ -4,7 +4,7 @@ from ..._models import BaseModel -__all__ = ["UniqueViewersCdn", "Data"] +__all__ = ["UniqueViewersCDN", "Data"] class Data(BaseModel): @@ -13,5 +13,5 @@ class Data(BaseModel): uniqs: int -class UniqueViewersCdn(BaseModel): +class UniqueViewersCDN(BaseModel): data: Optional[List[Data]] = None diff --git a/tests/api_resources/cdn/resources/test_rules.py b/tests/api_resources/cdn/resources/test_rules.py index 351ea91b..aa447a5f 100644 --- a/tests/api_resources/cdn/resources/test_rules.py +++ b/tests/api_resources/cdn/resources/test_rules.py @@ -10,7 +10,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.cdn.resources import ( - CdnResourceRule, + CDNResourceRule, RuleListResponse, ) @@ -28,7 +28,7 @@ def test_method_create(self, client: Gcore) -> None: rule="/folder/images/*.png", rule_type=0, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -307,7 +307,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: override_origin_protocol="HTTPS", weight=1, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -321,7 +321,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" rule = response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -335,7 +335,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -345,7 +345,7 @@ def test_method_update(self, client: Gcore) -> None: rule_id=0, resource_id=0, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: @@ -625,7 +625,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: rule_type=0, weight=1, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: @@ -637,7 +637,7 @@ def test_raw_response_update(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: @@ -649,7 +649,7 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -724,7 +724,7 @@ def test_method_get(self, client: Gcore) -> None: rule_id=0, resource_id=0, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -736,7 +736,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -748,7 +748,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -760,7 +760,7 @@ def test_method_replace(self, client: Gcore) -> None: rule="/folder/images/*.png", rule_type=0, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: @@ -1040,7 +1040,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: override_origin_protocol="HTTPS", weight=1, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize def test_raw_response_replace(self, client: Gcore) -> None: @@ -1054,7 +1054,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: @@ -1068,7 +1068,7 @@ def test_streaming_response_replace(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1086,7 +1086,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: rule="/folder/images/*.png", rule_type=0, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -1365,7 +1365,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> override_origin_protocol="HTTPS", weight=1, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -1379,7 +1379,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" rule = await response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -1393,7 +1393,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1403,7 +1403,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: rule_id=0, resource_id=0, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: @@ -1683,7 +1683,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> rule_type=0, weight=1, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @@ -1695,7 +1695,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: @@ -1707,7 +1707,7 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1782,7 +1782,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: rule_id=0, resource_id=0, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -1794,7 +1794,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -1806,7 +1806,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1818,7 +1818,7 @@ async def test_method_replace(self, async_client: AsyncGcore) -> None: rule="/folder/images/*.png", rule_type=0, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: @@ -2098,7 +2098,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> override_origin_protocol="HTTPS", weight=1, ) - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @@ -2112,7 +2112,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: @@ -2126,6 +2126,6 @@ async def test_streaming_response_replace(self, async_client: AsyncGcore) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(CdnResourceRule, rule, path=["response"]) + assert_matches_type(CDNResourceRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_audit_logs.py b/tests/api_resources/cdn/test_audit_logs.py index 3aace823..ae9cea06 100644 --- a/tests/api_resources/cdn/test_audit_logs.py +++ b/tests/api_resources/cdn/test_audit_logs.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cdn import CdnAuditLogEntry +from gcore.types.cdn import CDNAuditLogEntry from gcore.pagination import SyncOffsetPage, AsyncOffsetPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,7 +21,7 @@ class TestAuditLogs: @parametrize def test_method_list(self, client: Gcore) -> None: audit_log = client.cdn.audit_logs.list() - assert_matches_type(SyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + assert_matches_type(SyncOffsetPage[CDNAuditLogEntry], audit_log, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -38,7 +38,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: token_id=0, user_id=0, ) - assert_matches_type(SyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + assert_matches_type(SyncOffsetPage[CDNAuditLogEntry], audit_log, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -47,7 +47,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = response.parse() - assert_matches_type(SyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + assert_matches_type(SyncOffsetPage[CDNAuditLogEntry], audit_log, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -56,7 +56,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = response.parse() - assert_matches_type(SyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + assert_matches_type(SyncOffsetPage[CDNAuditLogEntry], audit_log, path=["response"]) assert cast(Any, response.is_closed) is True @@ -65,7 +65,7 @@ def test_method_get(self, client: Gcore) -> None: audit_log = client.cdn.audit_logs.get( 0, ) - assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + assert_matches_type(CDNAuditLogEntry, audit_log, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -76,7 +76,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = response.parse() - assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + assert_matches_type(CDNAuditLogEntry, audit_log, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -87,7 +87,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = response.parse() - assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + assert_matches_type(CDNAuditLogEntry, audit_log, path=["response"]) assert cast(Any, response.is_closed) is True @@ -100,7 +100,7 @@ class TestAsyncAuditLogs: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: audit_log = await async_client.cdn.audit_logs.list() - assert_matches_type(AsyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + assert_matches_type(AsyncOffsetPage[CDNAuditLogEntry], audit_log, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -117,7 +117,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No token_id=0, user_id=0, ) - assert_matches_type(AsyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + assert_matches_type(AsyncOffsetPage[CDNAuditLogEntry], audit_log, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -126,7 +126,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = await response.parse() - assert_matches_type(AsyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + assert_matches_type(AsyncOffsetPage[CDNAuditLogEntry], audit_log, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -135,7 +135,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = await response.parse() - assert_matches_type(AsyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + assert_matches_type(AsyncOffsetPage[CDNAuditLogEntry], audit_log, path=["response"]) assert cast(Any, response.is_closed) is True @@ -144,7 +144,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: audit_log = await async_client.cdn.audit_logs.get( 0, ) - assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + assert_matches_type(CDNAuditLogEntry, audit_log, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -155,7 +155,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = await response.parse() - assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + assert_matches_type(CDNAuditLogEntry, audit_log, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -166,6 +166,6 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" audit_log = await response.parse() - assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + assert_matches_type(CDNAuditLogEntry, audit_log, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_logs.py b/tests/api_resources/cdn/test_logs.py index c585876e..f72d4e71 100644 --- a/tests/api_resources/cdn/test_logs.py +++ b/tests/api_resources/cdn/test_logs.py @@ -17,7 +17,7 @@ StreamedBinaryAPIResponse, AsyncStreamedBinaryAPIResponse, ) -from gcore.pagination import SyncOffsetPageCdnLogs, AsyncOffsetPageCdnLogs +from gcore.pagination import SyncOffsetPageCDNLogs, AsyncOffsetPageCDNLogs from gcore.types.cdn.cdn_log_entry import Data base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -32,7 +32,7 @@ def test_method_list(self, client: Gcore) -> None: from_="from", to="to", ) - assert_matches_type(SyncOffsetPageCdnLogs[Data], log, path=["response"]) + assert_matches_type(SyncOffsetPageCDNLogs[Data], log, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -89,7 +89,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: status_ne=0, status_not_in="status__not_in", ) - assert_matches_type(SyncOffsetPageCdnLogs[Data], log, path=["response"]) + assert_matches_type(SyncOffsetPageCDNLogs[Data], log, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -101,7 +101,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" log = response.parse() - assert_matches_type(SyncOffsetPageCdnLogs[Data], log, path=["response"]) + assert_matches_type(SyncOffsetPageCDNLogs[Data], log, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -113,7 +113,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" log = response.parse() - assert_matches_type(SyncOffsetPageCdnLogs[Data], log, path=["response"]) + assert_matches_type(SyncOffsetPageCDNLogs[Data], log, path=["response"]) assert cast(Any, response.is_closed) is True @@ -240,7 +240,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: from_="from", to="to", ) - assert_matches_type(AsyncOffsetPageCdnLogs[Data], log, path=["response"]) + assert_matches_type(AsyncOffsetPageCDNLogs[Data], log, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -297,7 +297,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No status_ne=0, status_not_in="status__not_in", ) - assert_matches_type(AsyncOffsetPageCdnLogs[Data], log, path=["response"]) + assert_matches_type(AsyncOffsetPageCDNLogs[Data], log, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -309,7 +309,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" log = await response.parse() - assert_matches_type(AsyncOffsetPageCdnLogs[Data], log, path=["response"]) + assert_matches_type(AsyncOffsetPageCDNLogs[Data], log, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -321,7 +321,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" log = await response.parse() - assert_matches_type(AsyncOffsetPageCdnLogs[Data], log, path=["response"]) + assert_matches_type(AsyncOffsetPageCDNLogs[Data], log, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_metrics.py b/tests/api_resources/cdn/test_metrics.py index dcfd8767..40040587 100644 --- a/tests/api_resources/cdn/test_metrics.py +++ b/tests/api_resources/cdn/test_metrics.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cdn import CdnMetrics +from gcore.types.cdn import CDNMetrics base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Gcore) -> None: metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], to="2021-06-15T00:00:00Z", ) - assert_matches_type(CdnMetrics, metric, path=["response"]) + assert_matches_type(CDNMetrics, metric, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -42,7 +42,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: granularity="P1D", group_by=["cname"], ) - assert_matches_type(CdnMetrics, metric, path=["response"]) + assert_matches_type(CDNMetrics, metric, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -55,7 +55,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = response.parse() - assert_matches_type(CdnMetrics, metric, path=["response"]) + assert_matches_type(CDNMetrics, metric, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -68,7 +68,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = response.parse() - assert_matches_type(CdnMetrics, metric, path=["response"]) + assert_matches_type(CDNMetrics, metric, path=["response"]) assert cast(Any, response.is_closed) is True @@ -85,7 +85,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], to="2021-06-15T00:00:00Z", ) - assert_matches_type(CdnMetrics, metric, path=["response"]) + assert_matches_type(CDNMetrics, metric, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -103,7 +103,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No granularity="P1D", group_by=["cname"], ) - assert_matches_type(CdnMetrics, metric, path=["response"]) + assert_matches_type(CDNMetrics, metric, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -116,7 +116,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = await response.parse() - assert_matches_type(CdnMetrics, metric, path=["response"]) + assert_matches_type(CDNMetrics, metric, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -129,6 +129,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = await response.parse() - assert_matches_type(CdnMetrics, metric, path=["response"]) + assert_matches_type(CDNMetrics, metric, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_resources.py b/tests/api_resources/cdn/test_resources.py index a987d85b..a750ecc2 100644 --- a/tests/api_resources/cdn/test_resources.py +++ b/tests/api_resources/cdn/test_resources.py @@ -10,8 +10,8 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.cdn import ( - CdnResource, - CdnResourceList, + CDNResource, + CDNResourceList, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +27,7 @@ def test_method_create(self, client: Gcore) -> None: origin="example.com", origin_group=132, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -333,7 +333,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: ssl_enabled=False, waap_api_domain_enabled=True, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -346,7 +346,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" resource = response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -359,7 +359,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) assert cast(Any, response.is_closed) is True @@ -369,7 +369,7 @@ def test_method_update(self, client: Gcore) -> None: resource = client.cdn.resources.update( resource_id=0, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize @@ -673,7 +673,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: ssl_data=192, ssl_enabled=False, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize @@ -685,7 +685,7 @@ def test_raw_response_update(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize @@ -697,14 +697,14 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_list(self, client: Gcore) -> None: resource = client.cdn.resources.list() - assert_matches_type(CdnResourceList, resource, path=["response"]) + assert_matches_type(CDNResourceList, resource, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -726,7 +726,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: suspend=True, vp_enabled=True, ) - assert_matches_type(CdnResourceList, resource, path=["response"]) + assert_matches_type(CDNResourceList, resource, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -735,7 +735,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = response.parse() - assert_matches_type(CdnResourceList, resource, path=["response"]) + assert_matches_type(CDNResourceList, resource, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -744,7 +744,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = response.parse() - assert_matches_type(CdnResourceList, resource, path=["response"]) + assert_matches_type(CDNResourceList, resource, path=["response"]) assert cast(Any, response.is_closed) is True @@ -784,7 +784,7 @@ def test_method_get(self, client: Gcore) -> None: resource = client.cdn.resources.get( 0, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -795,7 +795,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -806,7 +806,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) assert cast(Any, response.is_closed) is True @@ -998,7 +998,7 @@ def test_method_replace(self, client: Gcore) -> None: resource_id=0, origin_group=132, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: @@ -1302,7 +1302,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: ssl_enabled=False, waap_api_domain_enabled=True, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize def test_raw_response_replace(self, client: Gcore) -> None: @@ -1314,7 +1314,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: @@ -1326,7 +1326,7 @@ def test_streaming_response_replace(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1343,7 +1343,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: origin="example.com", origin_group=132, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -1649,7 +1649,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> ssl_enabled=False, waap_api_domain_enabled=True, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -1662,7 +1662,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" resource = await response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -1675,7 +1675,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = await response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1685,7 +1685,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: resource = await async_client.cdn.resources.update( resource_id=0, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize @@ -1989,7 +1989,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> ssl_data=192, ssl_enabled=False, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize @@ -2001,7 +2001,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = await response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize @@ -2013,14 +2013,14 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = await response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: resource = await async_client.cdn.resources.list() - assert_matches_type(CdnResourceList, resource, path=["response"]) + assert_matches_type(CDNResourceList, resource, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -2042,7 +2042,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No suspend=True, vp_enabled=True, ) - assert_matches_type(CdnResourceList, resource, path=["response"]) + assert_matches_type(CDNResourceList, resource, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -2051,7 +2051,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = await response.parse() - assert_matches_type(CdnResourceList, resource, path=["response"]) + assert_matches_type(CDNResourceList, resource, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -2060,7 +2060,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = await response.parse() - assert_matches_type(CdnResourceList, resource, path=["response"]) + assert_matches_type(CDNResourceList, resource, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2100,7 +2100,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: resource = await async_client.cdn.resources.get( 0, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -2111,7 +2111,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = await response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -2122,7 +2122,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = await response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2314,7 +2314,7 @@ async def test_method_replace(self, async_client: AsyncGcore) -> None: resource_id=0, origin_group=132, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: @@ -2618,7 +2618,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> ssl_enabled=False, waap_api_domain_enabled=True, ) - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @@ -2630,7 +2630,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = await response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: @@ -2642,6 +2642,6 @@ async def test_streaming_response_replace(self, async_client: AsyncGcore) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" resource = await response.parse() - assert_matches_type(CdnResource, resource, path=["response"]) + assert_matches_type(CDNResource, resource, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_statistics.py b/tests/api_resources/streaming/test_statistics.py index bae1314e..35093360 100644 --- a/tests/api_resources/streaming/test_statistics.py +++ b/tests/api_resources/streaming/test_statistics.py @@ -23,12 +23,12 @@ ViewsByReferer, MaxStreamSeries, ViewsByHostname, - UniqueViewersCdn, + UniqueViewersCDN, VodStatisticsSeries, ViewsByOperatingSystem, VodTotalStreamDurationSeries, StatisticGetLiveUniqueViewersResponse, - StatisticGetVodWatchTimeTotalCdnResponse, + StatisticGetVodWatchTimeTotalCDNResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -424,7 +424,7 @@ def test_method_get_unique_viewers_cdn(self, client: Gcore) -> None: date_from="date_from", date_to="date_to", ) - assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + assert_matches_type(UniqueViewersCDN, statistic, path=["response"]) @parametrize def test_method_get_unique_viewers_cdn_with_all_params(self, client: Gcore) -> None: @@ -434,7 +434,7 @@ def test_method_get_unique_viewers_cdn_with_all_params(self, client: Gcore) -> N id="id", type="live", ) - assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + assert_matches_type(UniqueViewersCDN, statistic, path=["response"]) @parametrize def test_raw_response_get_unique_viewers_cdn(self, client: Gcore) -> None: @@ -446,7 +446,7 @@ def test_raw_response_get_unique_viewers_cdn(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = response.parse() - assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + assert_matches_type(UniqueViewersCDN, statistic, path=["response"]) @parametrize def test_streaming_response_get_unique_viewers_cdn(self, client: Gcore) -> None: @@ -458,7 +458,7 @@ def test_streaming_response_get_unique_viewers_cdn(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = response.parse() - assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + assert_matches_type(UniqueViewersCDN, statistic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -912,7 +912,7 @@ def test_streaming_response_get_vod_watch_time_cdn(self, client: Gcore) -> None: @parametrize def test_method_get_vod_watch_time_total_cdn(self, client: Gcore) -> None: statistic = client.streaming.statistics.get_vod_watch_time_total_cdn() - assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + assert_matches_type(StatisticGetVodWatchTimeTotalCDNResponse, statistic, path=["response"]) @parametrize def test_method_get_vod_watch_time_total_cdn_with_all_params(self, client: Gcore) -> None: @@ -922,7 +922,7 @@ def test_method_get_vod_watch_time_total_cdn_with_all_params(self, client: Gcore slug="slug", to="to", ) - assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + assert_matches_type(StatisticGetVodWatchTimeTotalCDNResponse, statistic, path=["response"]) @parametrize def test_raw_response_get_vod_watch_time_total_cdn(self, client: Gcore) -> None: @@ -931,7 +931,7 @@ def test_raw_response_get_vod_watch_time_total_cdn(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = response.parse() - assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + assert_matches_type(StatisticGetVodWatchTimeTotalCDNResponse, statistic, path=["response"]) @parametrize def test_streaming_response_get_vod_watch_time_total_cdn(self, client: Gcore) -> None: @@ -940,7 +940,7 @@ def test_streaming_response_get_vod_watch_time_total_cdn(self, client: Gcore) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = response.parse() - assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + assert_matches_type(StatisticGetVodWatchTimeTotalCDNResponse, statistic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1339,7 +1339,7 @@ async def test_method_get_unique_viewers_cdn(self, async_client: AsyncGcore) -> date_from="date_from", date_to="date_to", ) - assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + assert_matches_type(UniqueViewersCDN, statistic, path=["response"]) @parametrize async def test_method_get_unique_viewers_cdn_with_all_params(self, async_client: AsyncGcore) -> None: @@ -1349,7 +1349,7 @@ async def test_method_get_unique_viewers_cdn_with_all_params(self, async_client: id="id", type="live", ) - assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + assert_matches_type(UniqueViewersCDN, statistic, path=["response"]) @parametrize async def test_raw_response_get_unique_viewers_cdn(self, async_client: AsyncGcore) -> None: @@ -1361,7 +1361,7 @@ async def test_raw_response_get_unique_viewers_cdn(self, async_client: AsyncGcor assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = await response.parse() - assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + assert_matches_type(UniqueViewersCDN, statistic, path=["response"]) @parametrize async def test_streaming_response_get_unique_viewers_cdn(self, async_client: AsyncGcore) -> None: @@ -1373,7 +1373,7 @@ async def test_streaming_response_get_unique_viewers_cdn(self, async_client: Asy assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = await response.parse() - assert_matches_type(UniqueViewersCdn, statistic, path=["response"]) + assert_matches_type(UniqueViewersCDN, statistic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1827,7 +1827,7 @@ async def test_streaming_response_get_vod_watch_time_cdn(self, async_client: Asy @parametrize async def test_method_get_vod_watch_time_total_cdn(self, async_client: AsyncGcore) -> None: statistic = await async_client.streaming.statistics.get_vod_watch_time_total_cdn() - assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + assert_matches_type(StatisticGetVodWatchTimeTotalCDNResponse, statistic, path=["response"]) @parametrize async def test_method_get_vod_watch_time_total_cdn_with_all_params(self, async_client: AsyncGcore) -> None: @@ -1837,7 +1837,7 @@ async def test_method_get_vod_watch_time_total_cdn_with_all_params(self, async_c slug="slug", to="to", ) - assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + assert_matches_type(StatisticGetVodWatchTimeTotalCDNResponse, statistic, path=["response"]) @parametrize async def test_raw_response_get_vod_watch_time_total_cdn(self, async_client: AsyncGcore) -> None: @@ -1846,7 +1846,7 @@ async def test_raw_response_get_vod_watch_time_total_cdn(self, async_client: Asy assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = await response.parse() - assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + assert_matches_type(StatisticGetVodWatchTimeTotalCDNResponse, statistic, path=["response"]) @parametrize async def test_streaming_response_get_vod_watch_time_total_cdn(self, async_client: AsyncGcore) -> None: @@ -1855,6 +1855,6 @@ async def test_streaming_response_get_vod_watch_time_total_cdn(self, async_clien assert response.http_request.headers.get("X-Stainless-Lang") == "python" statistic = await response.parse() - assert_matches_type(StatisticGetVodWatchTimeTotalCdnResponse, statistic, path=["response"]) + assert_matches_type(StatisticGetVodWatchTimeTotalCDNResponse, statistic, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_cdn.py b/tests/api_resources/test_cdn.py index 97c7b598..153a1094 100644 --- a/tests/api_resources/test_cdn.py +++ b/tests/api_resources/test_cdn.py @@ -11,23 +11,23 @@ from tests.utils import assert_matches_type from gcore.types.cdn import ( AwsRegions, - CdnAccount, + CDNAccount, AlibabaRegions, - CdnAccountLimits, - CdnAvailableFeatures, - CdnListPurgeStatusesResponse, + CDNAccountLimits, + CDNAvailableFeatures, + CDNListPurgeStatusesResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestCdn: +class TestCDN: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_get_account_limits(self, client: Gcore) -> None: cdn = client.cdn.get_account_limits() - assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + assert_matches_type(CDNAccountLimits, cdn, path=["response"]) @parametrize def test_raw_response_get_account_limits(self, client: Gcore) -> None: @@ -36,7 +36,7 @@ def test_raw_response_get_account_limits(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = response.parse() - assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + assert_matches_type(CDNAccountLimits, cdn, path=["response"]) @parametrize def test_streaming_response_get_account_limits(self, client: Gcore) -> None: @@ -45,14 +45,14 @@ def test_streaming_response_get_account_limits(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = response.parse() - assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + assert_matches_type(CDNAccountLimits, cdn, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_get_account_overview(self, client: Gcore) -> None: cdn = client.cdn.get_account_overview() - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) @parametrize def test_raw_response_get_account_overview(self, client: Gcore) -> None: @@ -61,7 +61,7 @@ def test_raw_response_get_account_overview(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = response.parse() - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) @parametrize def test_streaming_response_get_account_overview(self, client: Gcore) -> None: @@ -70,14 +70,14 @@ def test_streaming_response_get_account_overview(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = response.parse() - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_get_available_features(self, client: Gcore) -> None: cdn = client.cdn.get_available_features() - assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + assert_matches_type(CDNAvailableFeatures, cdn, path=["response"]) @parametrize def test_raw_response_get_available_features(self, client: Gcore) -> None: @@ -86,7 +86,7 @@ def test_raw_response_get_available_features(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = response.parse() - assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + assert_matches_type(CDNAvailableFeatures, cdn, path=["response"]) @parametrize def test_streaming_response_get_available_features(self, client: Gcore) -> None: @@ -95,7 +95,7 @@ def test_streaming_response_get_available_features(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = response.parse() - assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + assert_matches_type(CDNAvailableFeatures, cdn, path=["response"]) assert cast(Any, response.is_closed) is True @@ -152,7 +152,7 @@ def test_streaming_response_list_aws_regions(self, client: Gcore) -> None: @parametrize def test_method_list_purge_statuses(self, client: Gcore) -> None: cdn = client.cdn.list_purge_statuses() - assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) + assert_matches_type(CDNListPurgeStatusesResponse, cdn, path=["response"]) @parametrize def test_method_list_purge_statuses_with_all_params(self, client: Gcore) -> None: @@ -165,7 +165,7 @@ def test_method_list_purge_statuses_with_all_params(self, client: Gcore) -> None status="status", to_created="to_created", ) - assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) + assert_matches_type(CDNListPurgeStatusesResponse, cdn, path=["response"]) @parametrize def test_raw_response_list_purge_statuses(self, client: Gcore) -> None: @@ -174,7 +174,7 @@ def test_raw_response_list_purge_statuses(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = response.parse() - assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) + assert_matches_type(CDNListPurgeStatusesResponse, cdn, path=["response"]) @parametrize def test_streaming_response_list_purge_statuses(self, client: Gcore) -> None: @@ -183,21 +183,21 @@ def test_streaming_response_list_purge_statuses(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = response.parse() - assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) + assert_matches_type(CDNListPurgeStatusesResponse, cdn, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_update_account(self, client: Gcore) -> None: cdn = client.cdn.update_account() - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) @parametrize def test_method_update_account_with_all_params(self, client: Gcore) -> None: cdn = client.cdn.update_account( utilization_level=1111, ) - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) @parametrize def test_raw_response_update_account(self, client: Gcore) -> None: @@ -206,7 +206,7 @@ def test_raw_response_update_account(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = response.parse() - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) @parametrize def test_streaming_response_update_account(self, client: Gcore) -> None: @@ -215,12 +215,12 @@ def test_streaming_response_update_account(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = response.parse() - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncCdn: +class TestAsyncCDN: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @@ -228,7 +228,7 @@ class TestAsyncCdn: @parametrize async def test_method_get_account_limits(self, async_client: AsyncGcore) -> None: cdn = await async_client.cdn.get_account_limits() - assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + assert_matches_type(CDNAccountLimits, cdn, path=["response"]) @parametrize async def test_raw_response_get_account_limits(self, async_client: AsyncGcore) -> None: @@ -237,7 +237,7 @@ async def test_raw_response_get_account_limits(self, async_client: AsyncGcore) - assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = await response.parse() - assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + assert_matches_type(CDNAccountLimits, cdn, path=["response"]) @parametrize async def test_streaming_response_get_account_limits(self, async_client: AsyncGcore) -> None: @@ -246,14 +246,14 @@ async def test_streaming_response_get_account_limits(self, async_client: AsyncGc assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = await response.parse() - assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + assert_matches_type(CDNAccountLimits, cdn, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_get_account_overview(self, async_client: AsyncGcore) -> None: cdn = await async_client.cdn.get_account_overview() - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) @parametrize async def test_raw_response_get_account_overview(self, async_client: AsyncGcore) -> None: @@ -262,7 +262,7 @@ async def test_raw_response_get_account_overview(self, async_client: AsyncGcore) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = await response.parse() - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) @parametrize async def test_streaming_response_get_account_overview(self, async_client: AsyncGcore) -> None: @@ -271,14 +271,14 @@ async def test_streaming_response_get_account_overview(self, async_client: Async assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = await response.parse() - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_get_available_features(self, async_client: AsyncGcore) -> None: cdn = await async_client.cdn.get_available_features() - assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + assert_matches_type(CDNAvailableFeatures, cdn, path=["response"]) @parametrize async def test_raw_response_get_available_features(self, async_client: AsyncGcore) -> None: @@ -287,7 +287,7 @@ async def test_raw_response_get_available_features(self, async_client: AsyncGcor assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = await response.parse() - assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + assert_matches_type(CDNAvailableFeatures, cdn, path=["response"]) @parametrize async def test_streaming_response_get_available_features(self, async_client: AsyncGcore) -> None: @@ -296,7 +296,7 @@ async def test_streaming_response_get_available_features(self, async_client: Asy assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = await response.parse() - assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + assert_matches_type(CDNAvailableFeatures, cdn, path=["response"]) assert cast(Any, response.is_closed) is True @@ -353,7 +353,7 @@ async def test_streaming_response_list_aws_regions(self, async_client: AsyncGcor @parametrize async def test_method_list_purge_statuses(self, async_client: AsyncGcore) -> None: cdn = await async_client.cdn.list_purge_statuses() - assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) + assert_matches_type(CDNListPurgeStatusesResponse, cdn, path=["response"]) @parametrize async def test_method_list_purge_statuses_with_all_params(self, async_client: AsyncGcore) -> None: @@ -366,7 +366,7 @@ async def test_method_list_purge_statuses_with_all_params(self, async_client: As status="status", to_created="to_created", ) - assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) + assert_matches_type(CDNListPurgeStatusesResponse, cdn, path=["response"]) @parametrize async def test_raw_response_list_purge_statuses(self, async_client: AsyncGcore) -> None: @@ -375,7 +375,7 @@ async def test_raw_response_list_purge_statuses(self, async_client: AsyncGcore) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = await response.parse() - assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) + assert_matches_type(CDNListPurgeStatusesResponse, cdn, path=["response"]) @parametrize async def test_streaming_response_list_purge_statuses(self, async_client: AsyncGcore) -> None: @@ -384,21 +384,21 @@ async def test_streaming_response_list_purge_statuses(self, async_client: AsyncG assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = await response.parse() - assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"]) + assert_matches_type(CDNListPurgeStatusesResponse, cdn, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_update_account(self, async_client: AsyncGcore) -> None: cdn = await async_client.cdn.update_account() - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) @parametrize async def test_method_update_account_with_all_params(self, async_client: AsyncGcore) -> None: cdn = await async_client.cdn.update_account( utilization_level=1111, ) - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) @parametrize async def test_raw_response_update_account(self, async_client: AsyncGcore) -> None: @@ -407,7 +407,7 @@ async def test_raw_response_update_account(self, async_client: AsyncGcore) -> No assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = await response.parse() - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) @parametrize async def test_streaming_response_update_account(self, async_client: AsyncGcore) -> None: @@ -416,6 +416,6 @@ async def test_streaming_response_update_account(self, async_client: AsyncGcore) assert response.http_request.headers.get("X-Stainless-Lang") == "python" cdn = await response.parse() - assert_matches_type(CdnAccount, cdn, path=["response"]) + assert_matches_type(CDNAccount, cdn, path=["response"]) assert cast(Any, response.is_closed) is True From 22a3a87436a2ba18ef954926bc6832b194e62abe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 16:35:23 +0000 Subject: [PATCH 544/592] refactor(cdn)!: rename resource to cdn_resource --- .stats.yml | 2 +- api.md | 40 +- src/gcore/resources/cdn/__init__.py | 28 +- src/gcore/resources/cdn/cdn.py | 40 +- .../{resources => cdn_resources}/__init__.py | 26 +- .../cdn_resources.py} | 182 ++++---- .../cdn/{resources => cdn_resources}/rules.py | 6 +- .../{resources => cdn_resources}/shield.py | 4 +- src/gcore/types/cdn/__init__.py | 12 +- ...arams.py => cdn_resource_create_params.py} | 4 +- ..._params.py => cdn_resource_list_params.py} | 4 +- ...ams.py => cdn_resource_prefetch_params.py} | 4 +- ...params.py => cdn_resource_purge_params.py} | 4 +- ...rams.py => cdn_resource_replace_params.py} | 4 +- ...arams.py => cdn_resource_update_params.py} | 4 +- .../{resources => cdn_resources}/__init__.py | 0 .../cdn_resource_rule.py | 0 .../origin_shielding.py | 0 .../rule_create_params.py | 0 .../rule_list_response.py | 0 .../rule_replace_params.py | 0 .../rule_update_params.py | 0 .../shield_replace_params.py | 0 .../{resources => cdn_resources}/__init__.py | 0 .../test_rules.py | 86 ++-- .../test_shield.py | 30 +- ...est_resources.py => test_cdn_resources.py} | 412 +++++++++--------- 27 files changed, 446 insertions(+), 446 deletions(-) rename src/gcore/resources/cdn/{resources => cdn_resources}/__init__.py (65%) rename src/gcore/resources/cdn/{resources/resources.py => cdn_resources/cdn_resources.py} (94%) rename src/gcore/resources/cdn/{resources => cdn_resources}/rules.py (99%) rename src/gcore/resources/cdn/{resources => cdn_resources}/shield.py (98%) rename src/gcore/types/cdn/{resource_create_params.py => cdn_resource_create_params.py} (99%) rename src/gcore/types/cdn/{resource_list_params.py => cdn_resource_list_params.py} (96%) rename src/gcore/types/cdn/{resource_prefetch_params.py => cdn_resource_prefetch_params.py} (80%) rename src/gcore/types/cdn/{resource_purge_params.py => cdn_resource_purge_params.py} (94%) rename src/gcore/types/cdn/{resource_replace_params.py => cdn_resource_replace_params.py} (99%) rename src/gcore/types/cdn/{resource_update_params.py => cdn_resource_update_params.py} (99%) rename src/gcore/types/cdn/{resources => cdn_resources}/__init__.py (100%) rename src/gcore/types/cdn/{resources => cdn_resources}/cdn_resource_rule.py (100%) rename src/gcore/types/cdn/{resources => cdn_resources}/origin_shielding.py (100%) rename src/gcore/types/cdn/{resources => cdn_resources}/rule_create_params.py (100%) rename src/gcore/types/cdn/{resources => cdn_resources}/rule_list_response.py (100%) rename src/gcore/types/cdn/{resources => cdn_resources}/rule_replace_params.py (100%) rename src/gcore/types/cdn/{resources => cdn_resources}/rule_update_params.py (100%) rename src/gcore/types/cdn/{resources => cdn_resources}/shield_replace_params.py (100%) rename tests/api_resources/cdn/{resources => cdn_resources}/__init__.py (100%) rename tests/api_resources/cdn/{resources => cdn_resources}/test_rules.py (96%) rename tests/api_resources/cdn/{resources => cdn_resources}/test_shield.py (82%) rename tests/api_resources/cdn/{test_resources.py => test_cdn_resources.py} (87%) diff --git a/.stats.yml b/.stats.yml index 5f7f256b..f736874a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-58d9afa7f8342ead022bd8fa12bb8abbeb9c0fb1e16f052ee6c4a59fae373e27.yml openapi_spec_hash: 2ae4db03cfc907be71d44288503838d7 -config_hash: 9268939ae4d27baa6e68cb8b24eaf063 +config_hash: 8d4711ed72633b7443249124a49781da diff --git a/api.md b/api.md index 92e65e1c..92044094 100644 --- a/api.md +++ b/api.md @@ -2301,7 +2301,7 @@ Methods: - client.cdn.list_purge_statuses(\*\*params) -> CDNListPurgeStatusesResponse - client.cdn.update_account(\*\*params) -> CDNAccount -## Resources +## CDNResources Types: @@ -2311,45 +2311,45 @@ from gcore.types.cdn import CDNResource, CDNResourceList Methods: -- client.cdn.resources.create(\*\*params) -> CDNResource -- client.cdn.resources.update(resource_id, \*\*params) -> CDNResource -- client.cdn.resources.list(\*\*params) -> CDNResourceList -- client.cdn.resources.delete(resource_id) -> None -- client.cdn.resources.get(resource_id) -> CDNResource -- client.cdn.resources.prefetch(resource_id, \*\*params) -> None -- client.cdn.resources.prevalidate_ssl_le_certificate(resource_id) -> None -- client.cdn.resources.purge(resource_id, \*\*params) -> None -- client.cdn.resources.replace(resource_id, \*\*params) -> CDNResource +- client.cdn.cdn_resources.create(\*\*params) -> CDNResource +- client.cdn.cdn_resources.update(resource_id, \*\*params) -> CDNResource +- client.cdn.cdn_resources.list(\*\*params) -> CDNResourceList +- client.cdn.cdn_resources.delete(resource_id) -> None +- client.cdn.cdn_resources.get(resource_id) -> CDNResource +- client.cdn.cdn_resources.prefetch(resource_id, \*\*params) -> None +- client.cdn.cdn_resources.prevalidate_ssl_le_certificate(resource_id) -> None +- client.cdn.cdn_resources.purge(resource_id, \*\*params) -> None +- client.cdn.cdn_resources.replace(resource_id, \*\*params) -> CDNResource ### Shield Types: ```python -from gcore.types.cdn.resources import OriginShielding, OriginShieldingReplaced +from gcore.types.cdn.cdn_resources import OriginShielding, OriginShieldingReplaced ``` Methods: -- client.cdn.resources.shield.get(resource_id) -> OriginShielding -- client.cdn.resources.shield.replace(resource_id, \*\*params) -> object +- client.cdn.cdn_resources.shield.get(resource_id) -> OriginShielding +- client.cdn.cdn_resources.shield.replace(resource_id, \*\*params) -> object ### Rules Types: ```python -from gcore.types.cdn.resources import CDNResourceRule, RuleListResponse +from gcore.types.cdn.cdn_resources import CDNResourceRule, RuleListResponse ``` Methods: -- client.cdn.resources.rules.create(resource_id, \*\*params) -> CDNResourceRule -- client.cdn.resources.rules.update(rule_id, \*, resource_id, \*\*params) -> CDNResourceRule -- client.cdn.resources.rules.list(resource_id) -> RuleListResponse -- client.cdn.resources.rules.delete(rule_id, \*, resource_id) -> None -- client.cdn.resources.rules.get(rule_id, \*, resource_id) -> CDNResourceRule -- client.cdn.resources.rules.replace(rule_id, \*, resource_id, \*\*params) -> CDNResourceRule +- client.cdn.cdn_resources.rules.create(resource_id, \*\*params) -> CDNResourceRule +- client.cdn.cdn_resources.rules.update(rule_id, \*, resource_id, \*\*params) -> CDNResourceRule +- client.cdn.cdn_resources.rules.list(resource_id) -> RuleListResponse +- client.cdn.cdn_resources.rules.delete(rule_id, \*, resource_id) -> None +- client.cdn.cdn_resources.rules.get(rule_id, \*, resource_id) -> CDNResourceRule +- client.cdn.cdn_resources.rules.replace(rule_id, \*, resource_id, \*\*params) -> CDNResourceRule ## Shields diff --git a/src/gcore/resources/cdn/__init__.py b/src/gcore/resources/cdn/__init__.py index c47bbc40..869fc050 100644 --- a/src/gcore/resources/cdn/__init__.py +++ b/src/gcore/resources/cdn/__init__.py @@ -40,14 +40,6 @@ IPRangesResourceWithStreamingResponse, AsyncIPRangesResourceWithStreamingResponse, ) -from .resources import ( - ResourcesResource, - AsyncResourcesResource, - ResourcesResourceWithRawResponse, - AsyncResourcesResourceWithRawResponse, - ResourcesResourceWithStreamingResponse, - AsyncResourcesResourceWithStreamingResponse, -) from .audit_logs import ( AuditLogsResource, AsyncAuditLogsResource, @@ -72,6 +64,14 @@ CertificatesResourceWithStreamingResponse, AsyncCertificatesResourceWithStreamingResponse, ) +from .cdn_resources import ( + CDNResourcesResource, + AsyncCDNResourcesResource, + CDNResourcesResourceWithRawResponse, + AsyncCDNResourcesResourceWithRawResponse, + CDNResourcesResourceWithStreamingResponse, + AsyncCDNResourcesResourceWithStreamingResponse, +) from .logs_uploader import ( LogsUploaderResource, AsyncLogsUploaderResource, @@ -114,12 +114,12 @@ ) __all__ = [ - "ResourcesResource", - "AsyncResourcesResource", - "ResourcesResourceWithRawResponse", - "AsyncResourcesResourceWithRawResponse", - "ResourcesResourceWithStreamingResponse", - "AsyncResourcesResourceWithStreamingResponse", + "CDNResourcesResource", + "AsyncCDNResourcesResource", + "CDNResourcesResourceWithRawResponse", + "AsyncCDNResourcesResourceWithRawResponse", + "CDNResourcesResourceWithStreamingResponse", + "AsyncCDNResourcesResourceWithStreamingResponse", "ShieldsResource", "AsyncShieldsResource", "ShieldsResourceWithRawResponse", diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py index 975703ec..771c3776 100644 --- a/src/gcore/resources/cdn/cdn.py +++ b/src/gcore/resources/cdn/cdn.py @@ -96,14 +96,6 @@ NetworkCapacityResourceWithStreamingResponse, AsyncNetworkCapacityResourceWithStreamingResponse, ) -from .resources.resources import ( - ResourcesResource, - AsyncResourcesResource, - ResourcesResourceWithRawResponse, - AsyncResourcesResourceWithRawResponse, - ResourcesResourceWithStreamingResponse, - AsyncResourcesResourceWithStreamingResponse, -) from ...types.cdn.aws_regions import AwsRegions from ...types.cdn.cdn_account import CDNAccount from .trusted_ca_certificates import ( @@ -115,6 +107,14 @@ AsyncTrustedCaCertificatesResourceWithStreamingResponse, ) from ...types.cdn.alibaba_regions import AlibabaRegions +from .cdn_resources.cdn_resources import ( + CDNResourcesResource, + AsyncCDNResourcesResource, + CDNResourcesResourceWithRawResponse, + AsyncCDNResourcesResourceWithRawResponse, + CDNResourcesResourceWithStreamingResponse, + AsyncCDNResourcesResourceWithStreamingResponse, +) from .logs_uploader.logs_uploader import ( LogsUploaderResource, AsyncLogsUploaderResource, @@ -132,8 +132,8 @@ class CDNResource(SyncAPIResource): @cached_property - def resources(self) -> ResourcesResource: - return ResourcesResource(self._client) + def cdn_resources(self) -> CDNResourcesResource: + return CDNResourcesResource(self._client) @cached_property def shields(self) -> ShieldsResource: @@ -433,8 +433,8 @@ def update_account( class AsyncCDNResource(AsyncAPIResource): @cached_property - def resources(self) -> AsyncResourcesResource: - return AsyncResourcesResource(self._client) + def cdn_resources(self) -> AsyncCDNResourcesResource: + return AsyncCDNResourcesResource(self._client) @cached_property def shields(self) -> AsyncShieldsResource: @@ -759,8 +759,8 @@ def __init__(self, cdn: CDNResource) -> None: ) @cached_property - def resources(self) -> ResourcesResourceWithRawResponse: - return ResourcesResourceWithRawResponse(self._cdn.resources) + def cdn_resources(self) -> CDNResourcesResourceWithRawResponse: + return CDNResourcesResourceWithRawResponse(self._cdn.cdn_resources) @cached_property def shields(self) -> ShieldsResourceWithRawResponse: @@ -838,8 +838,8 @@ def __init__(self, cdn: AsyncCDNResource) -> None: ) @cached_property - def resources(self) -> AsyncResourcesResourceWithRawResponse: - return AsyncResourcesResourceWithRawResponse(self._cdn.resources) + def cdn_resources(self) -> AsyncCDNResourcesResourceWithRawResponse: + return AsyncCDNResourcesResourceWithRawResponse(self._cdn.cdn_resources) @cached_property def shields(self) -> AsyncShieldsResourceWithRawResponse: @@ -917,8 +917,8 @@ def __init__(self, cdn: CDNResource) -> None: ) @cached_property - def resources(self) -> ResourcesResourceWithStreamingResponse: - return ResourcesResourceWithStreamingResponse(self._cdn.resources) + def cdn_resources(self) -> CDNResourcesResourceWithStreamingResponse: + return CDNResourcesResourceWithStreamingResponse(self._cdn.cdn_resources) @cached_property def shields(self) -> ShieldsResourceWithStreamingResponse: @@ -996,8 +996,8 @@ def __init__(self, cdn: AsyncCDNResource) -> None: ) @cached_property - def resources(self) -> AsyncResourcesResourceWithStreamingResponse: - return AsyncResourcesResourceWithStreamingResponse(self._cdn.resources) + def cdn_resources(self) -> AsyncCDNResourcesResourceWithStreamingResponse: + return AsyncCDNResourcesResourceWithStreamingResponse(self._cdn.cdn_resources) @cached_property def shields(self) -> AsyncShieldsResourceWithStreamingResponse: diff --git a/src/gcore/resources/cdn/resources/__init__.py b/src/gcore/resources/cdn/cdn_resources/__init__.py similarity index 65% rename from src/gcore/resources/cdn/resources/__init__.py rename to src/gcore/resources/cdn/cdn_resources/__init__.py index e72105aa..b8fee4c6 100644 --- a/src/gcore/resources/cdn/resources/__init__.py +++ b/src/gcore/resources/cdn/cdn_resources/__init__.py @@ -16,13 +16,13 @@ ShieldResourceWithStreamingResponse, AsyncShieldResourceWithStreamingResponse, ) -from .resources import ( - ResourcesResource, - AsyncResourcesResource, - ResourcesResourceWithRawResponse, - AsyncResourcesResourceWithRawResponse, - ResourcesResourceWithStreamingResponse, - AsyncResourcesResourceWithStreamingResponse, +from .cdn_resources import ( + CDNResourcesResource, + AsyncCDNResourcesResource, + CDNResourcesResourceWithRawResponse, + AsyncCDNResourcesResourceWithRawResponse, + CDNResourcesResourceWithStreamingResponse, + AsyncCDNResourcesResourceWithStreamingResponse, ) __all__ = [ @@ -38,10 +38,10 @@ "AsyncRulesResourceWithRawResponse", "RulesResourceWithStreamingResponse", "AsyncRulesResourceWithStreamingResponse", - "ResourcesResource", - "AsyncResourcesResource", - "ResourcesResourceWithRawResponse", - "AsyncResourcesResourceWithRawResponse", - "ResourcesResourceWithStreamingResponse", - "AsyncResourcesResourceWithStreamingResponse", + "CDNResourcesResource", + "AsyncCDNResourcesResource", + "CDNResourcesResourceWithRawResponse", + "AsyncCDNResourcesResourceWithRawResponse", + "CDNResourcesResourceWithStreamingResponse", + "AsyncCDNResourcesResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/cdn/resources/resources.py b/src/gcore/resources/cdn/cdn_resources/cdn_resources.py similarity index 94% rename from src/gcore/resources/cdn/resources/resources.py rename to src/gcore/resources/cdn/cdn_resources/cdn_resources.py index d581bd95..e92683c6 100644 --- a/src/gcore/resources/cdn/resources/resources.py +++ b/src/gcore/resources/cdn/cdn_resources/cdn_resources.py @@ -34,21 +34,21 @@ async_to_streamed_response_wrapper, ) from ....types.cdn import ( - resource_list_params, - resource_purge_params, - resource_create_params, - resource_update_params, - resource_replace_params, - resource_prefetch_params, + cdn_resource_list_params, + cdn_resource_purge_params, + cdn_resource_create_params, + cdn_resource_update_params, + cdn_resource_replace_params, + cdn_resource_prefetch_params, ) from ...._base_client import make_request_options from ....types.cdn.cdn_resource import CDNResource from ....types.cdn.cdn_resource_list import CDNResourceList -__all__ = ["ResourcesResource", "AsyncResourcesResource"] +__all__ = ["CDNResourcesResource", "AsyncCDNResourcesResource"] -class ResourcesResource(SyncAPIResource): +class CDNResourcesResource(SyncAPIResource): @cached_property def shield(self) -> ShieldResource: return ShieldResource(self._client) @@ -58,23 +58,23 @@ def rules(self) -> RulesResource: return RulesResource(self._client) @cached_property - def with_raw_response(self) -> ResourcesResourceWithRawResponse: + def with_raw_response(self) -> CDNResourcesResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ - return ResourcesResourceWithRawResponse(self) + return CDNResourcesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ResourcesResourceWithStreamingResponse: + def with_streaming_response(self) -> CDNResourcesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ - return ResourcesResourceWithStreamingResponse(self) + return CDNResourcesResourceWithStreamingResponse(self) def create( self, @@ -85,7 +85,7 @@ def create( active: bool | Omit = omit, description: str | Omit = omit, name: Optional[str] | Omit = omit, - options: resource_create_params.Options | Omit = omit, + options: cdn_resource_create_params.Options | Omit = omit, origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, primary_resource: Optional[int] | Omit = omit, proxy_ssl_ca: Optional[int] | Omit = omit, @@ -220,7 +220,7 @@ def create( "ssl_enabled": ssl_enabled, "waap_api_domain_enabled": waap_api_domain_enabled, }, - resource_create_params.ResourceCreateParams, + cdn_resource_create_params.CDNResourceCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -235,7 +235,7 @@ def update( active: bool | Omit = omit, description: str | Omit = omit, name: Optional[str] | Omit = omit, - options: resource_update_params.Options | Omit = omit, + options: cdn_resource_update_params.Options | Omit = omit, origin_group: int | Omit = omit, origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, proxy_ssl_ca: Optional[int] | Omit = omit, @@ -343,7 +343,7 @@ def update( "ssl_data": ssl_data, "ssl_enabled": ssl_enabled, }, - resource_update_params.ResourceUpdateParams, + cdn_resource_update_params.CDNResourceUpdateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -484,7 +484,7 @@ def list( "suspend": suspend, "vp_enabled": vp_enabled, }, - resource_list_params.ResourceListParams, + cdn_resource_list_params.CDNResourceListParams, ), ), cast_to=CDNResourceList, @@ -604,7 +604,7 @@ def prefetch( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( f"/cdn/resources/{resource_id}/prefetch", - body=maybe_transform({"paths": paths}, resource_prefetch_params.ResourcePrefetchParams), + body=maybe_transform({"paths": paths}, cdn_resource_prefetch_params.CDNResourcePrefetchParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -817,7 +817,7 @@ def purge( "urls": urls, "paths": paths, }, - resource_purge_params.ResourcePurgeParams, + cdn_resource_purge_params.CDNResourcePurgeParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -833,7 +833,7 @@ def replace( active: bool | Omit = omit, description: str | Omit = omit, name: Optional[str] | Omit = omit, - options: resource_replace_params.Options | Omit = omit, + options: cdn_resource_replace_params.Options | Omit = omit, origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, proxy_ssl_ca: Optional[int] | Omit = omit, proxy_ssl_data: Optional[int] | Omit = omit, @@ -949,7 +949,7 @@ def replace( "ssl_enabled": ssl_enabled, "waap_api_domain_enabled": waap_api_domain_enabled, }, - resource_replace_params.ResourceReplaceParams, + cdn_resource_replace_params.CDNResourceReplaceParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -958,7 +958,7 @@ def replace( ) -class AsyncResourcesResource(AsyncAPIResource): +class AsyncCDNResourcesResource(AsyncAPIResource): @cached_property def shield(self) -> AsyncShieldResource: return AsyncShieldResource(self._client) @@ -968,23 +968,23 @@ def rules(self) -> AsyncRulesResource: return AsyncRulesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncResourcesResourceWithRawResponse: + def with_raw_response(self) -> AsyncCDNResourcesResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ - return AsyncResourcesResourceWithRawResponse(self) + return AsyncCDNResourcesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncResourcesResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncCDNResourcesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ - return AsyncResourcesResourceWithStreamingResponse(self) + return AsyncCDNResourcesResourceWithStreamingResponse(self) async def create( self, @@ -995,7 +995,7 @@ async def create( active: bool | Omit = omit, description: str | Omit = omit, name: Optional[str] | Omit = omit, - options: resource_create_params.Options | Omit = omit, + options: cdn_resource_create_params.Options | Omit = omit, origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, primary_resource: Optional[int] | Omit = omit, proxy_ssl_ca: Optional[int] | Omit = omit, @@ -1130,7 +1130,7 @@ async def create( "ssl_enabled": ssl_enabled, "waap_api_domain_enabled": waap_api_domain_enabled, }, - resource_create_params.ResourceCreateParams, + cdn_resource_create_params.CDNResourceCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1145,7 +1145,7 @@ async def update( active: bool | Omit = omit, description: str | Omit = omit, name: Optional[str] | Omit = omit, - options: resource_update_params.Options | Omit = omit, + options: cdn_resource_update_params.Options | Omit = omit, origin_group: int | Omit = omit, origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, proxy_ssl_ca: Optional[int] | Omit = omit, @@ -1253,7 +1253,7 @@ async def update( "ssl_data": ssl_data, "ssl_enabled": ssl_enabled, }, - resource_update_params.ResourceUpdateParams, + cdn_resource_update_params.CDNResourceUpdateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1394,7 +1394,7 @@ async def list( "suspend": suspend, "vp_enabled": vp_enabled, }, - resource_list_params.ResourceListParams, + cdn_resource_list_params.CDNResourceListParams, ), ), cast_to=CDNResourceList, @@ -1514,7 +1514,7 @@ async def prefetch( extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( f"/cdn/resources/{resource_id}/prefetch", - body=await async_maybe_transform({"paths": paths}, resource_prefetch_params.ResourcePrefetchParams), + body=await async_maybe_transform({"paths": paths}, cdn_resource_prefetch_params.CDNResourcePrefetchParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1727,7 +1727,7 @@ async def purge( "urls": urls, "paths": paths, }, - resource_purge_params.ResourcePurgeParams, + cdn_resource_purge_params.CDNResourcePurgeParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1743,7 +1743,7 @@ async def replace( active: bool | Omit = omit, description: str | Omit = omit, name: Optional[str] | Omit = omit, - options: resource_replace_params.Options | Omit = omit, + options: cdn_resource_replace_params.Options | Omit = omit, origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, proxy_ssl_ca: Optional[int] | Omit = omit, proxy_ssl_data: Optional[int] | Omit = omit, @@ -1859,7 +1859,7 @@ async def replace( "ssl_enabled": ssl_enabled, "waap_api_domain_enabled": waap_api_domain_enabled, }, - resource_replace_params.ResourceReplaceParams, + cdn_resource_replace_params.CDNResourceReplaceParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1868,165 +1868,165 @@ async def replace( ) -class ResourcesResourceWithRawResponse: - def __init__(self, resources: ResourcesResource) -> None: - self._resources = resources +class CDNResourcesResourceWithRawResponse: + def __init__(self, cdn_resources: CDNResourcesResource) -> None: + self._cdn_resources = cdn_resources self.create = to_raw_response_wrapper( - resources.create, + cdn_resources.create, ) self.update = to_raw_response_wrapper( - resources.update, + cdn_resources.update, ) self.list = to_raw_response_wrapper( - resources.list, + cdn_resources.list, ) self.delete = to_raw_response_wrapper( - resources.delete, + cdn_resources.delete, ) self.get = to_raw_response_wrapper( - resources.get, + cdn_resources.get, ) self.prefetch = to_raw_response_wrapper( - resources.prefetch, + cdn_resources.prefetch, ) self.prevalidate_ssl_le_certificate = to_raw_response_wrapper( - resources.prevalidate_ssl_le_certificate, + cdn_resources.prevalidate_ssl_le_certificate, ) self.purge = to_raw_response_wrapper( - resources.purge, + cdn_resources.purge, ) self.replace = to_raw_response_wrapper( - resources.replace, + cdn_resources.replace, ) @cached_property def shield(self) -> ShieldResourceWithRawResponse: - return ShieldResourceWithRawResponse(self._resources.shield) + return ShieldResourceWithRawResponse(self._cdn_resources.shield) @cached_property def rules(self) -> RulesResourceWithRawResponse: - return RulesResourceWithRawResponse(self._resources.rules) + return RulesResourceWithRawResponse(self._cdn_resources.rules) -class AsyncResourcesResourceWithRawResponse: - def __init__(self, resources: AsyncResourcesResource) -> None: - self._resources = resources +class AsyncCDNResourcesResourceWithRawResponse: + def __init__(self, cdn_resources: AsyncCDNResourcesResource) -> None: + self._cdn_resources = cdn_resources self.create = async_to_raw_response_wrapper( - resources.create, + cdn_resources.create, ) self.update = async_to_raw_response_wrapper( - resources.update, + cdn_resources.update, ) self.list = async_to_raw_response_wrapper( - resources.list, + cdn_resources.list, ) self.delete = async_to_raw_response_wrapper( - resources.delete, + cdn_resources.delete, ) self.get = async_to_raw_response_wrapper( - resources.get, + cdn_resources.get, ) self.prefetch = async_to_raw_response_wrapper( - resources.prefetch, + cdn_resources.prefetch, ) self.prevalidate_ssl_le_certificate = async_to_raw_response_wrapper( - resources.prevalidate_ssl_le_certificate, + cdn_resources.prevalidate_ssl_le_certificate, ) self.purge = async_to_raw_response_wrapper( - resources.purge, + cdn_resources.purge, ) self.replace = async_to_raw_response_wrapper( - resources.replace, + cdn_resources.replace, ) @cached_property def shield(self) -> AsyncShieldResourceWithRawResponse: - return AsyncShieldResourceWithRawResponse(self._resources.shield) + return AsyncShieldResourceWithRawResponse(self._cdn_resources.shield) @cached_property def rules(self) -> AsyncRulesResourceWithRawResponse: - return AsyncRulesResourceWithRawResponse(self._resources.rules) + return AsyncRulesResourceWithRawResponse(self._cdn_resources.rules) -class ResourcesResourceWithStreamingResponse: - def __init__(self, resources: ResourcesResource) -> None: - self._resources = resources +class CDNResourcesResourceWithStreamingResponse: + def __init__(self, cdn_resources: CDNResourcesResource) -> None: + self._cdn_resources = cdn_resources self.create = to_streamed_response_wrapper( - resources.create, + cdn_resources.create, ) self.update = to_streamed_response_wrapper( - resources.update, + cdn_resources.update, ) self.list = to_streamed_response_wrapper( - resources.list, + cdn_resources.list, ) self.delete = to_streamed_response_wrapper( - resources.delete, + cdn_resources.delete, ) self.get = to_streamed_response_wrapper( - resources.get, + cdn_resources.get, ) self.prefetch = to_streamed_response_wrapper( - resources.prefetch, + cdn_resources.prefetch, ) self.prevalidate_ssl_le_certificate = to_streamed_response_wrapper( - resources.prevalidate_ssl_le_certificate, + cdn_resources.prevalidate_ssl_le_certificate, ) self.purge = to_streamed_response_wrapper( - resources.purge, + cdn_resources.purge, ) self.replace = to_streamed_response_wrapper( - resources.replace, + cdn_resources.replace, ) @cached_property def shield(self) -> ShieldResourceWithStreamingResponse: - return ShieldResourceWithStreamingResponse(self._resources.shield) + return ShieldResourceWithStreamingResponse(self._cdn_resources.shield) @cached_property def rules(self) -> RulesResourceWithStreamingResponse: - return RulesResourceWithStreamingResponse(self._resources.rules) + return RulesResourceWithStreamingResponse(self._cdn_resources.rules) -class AsyncResourcesResourceWithStreamingResponse: - def __init__(self, resources: AsyncResourcesResource) -> None: - self._resources = resources +class AsyncCDNResourcesResourceWithStreamingResponse: + def __init__(self, cdn_resources: AsyncCDNResourcesResource) -> None: + self._cdn_resources = cdn_resources self.create = async_to_streamed_response_wrapper( - resources.create, + cdn_resources.create, ) self.update = async_to_streamed_response_wrapper( - resources.update, + cdn_resources.update, ) self.list = async_to_streamed_response_wrapper( - resources.list, + cdn_resources.list, ) self.delete = async_to_streamed_response_wrapper( - resources.delete, + cdn_resources.delete, ) self.get = async_to_streamed_response_wrapper( - resources.get, + cdn_resources.get, ) self.prefetch = async_to_streamed_response_wrapper( - resources.prefetch, + cdn_resources.prefetch, ) self.prevalidate_ssl_le_certificate = async_to_streamed_response_wrapper( - resources.prevalidate_ssl_le_certificate, + cdn_resources.prevalidate_ssl_le_certificate, ) self.purge = async_to_streamed_response_wrapper( - resources.purge, + cdn_resources.purge, ) self.replace = async_to_streamed_response_wrapper( - resources.replace, + cdn_resources.replace, ) @cached_property def shield(self) -> AsyncShieldResourceWithStreamingResponse: - return AsyncShieldResourceWithStreamingResponse(self._resources.shield) + return AsyncShieldResourceWithStreamingResponse(self._cdn_resources.shield) @cached_property def rules(self) -> AsyncRulesResourceWithStreamingResponse: - return AsyncRulesResourceWithStreamingResponse(self._resources.rules) + return AsyncRulesResourceWithStreamingResponse(self._cdn_resources.rules) diff --git a/src/gcore/resources/cdn/resources/rules.py b/src/gcore/resources/cdn/cdn_resources/rules.py similarity index 99% rename from src/gcore/resources/cdn/resources/rules.py rename to src/gcore/resources/cdn/cdn_resources/rules.py index 4549dc4b..7c0424d5 100644 --- a/src/gcore/resources/cdn/resources/rules.py +++ b/src/gcore/resources/cdn/cdn_resources/rules.py @@ -18,9 +18,9 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.cdn.resources import rule_create_params, rule_update_params, rule_replace_params -from ....types.cdn.resources.cdn_resource_rule import CDNResourceRule -from ....types.cdn.resources.rule_list_response import RuleListResponse +from ....types.cdn.cdn_resources import rule_create_params, rule_update_params, rule_replace_params +from ....types.cdn.cdn_resources.cdn_resource_rule import CDNResourceRule +from ....types.cdn.cdn_resources.rule_list_response import RuleListResponse __all__ = ["RulesResource", "AsyncRulesResource"] diff --git a/src/gcore/resources/cdn/resources/shield.py b/src/gcore/resources/cdn/cdn_resources/shield.py similarity index 98% rename from src/gcore/resources/cdn/resources/shield.py rename to src/gcore/resources/cdn/cdn_resources/shield.py index cbb712d5..27c2bf2a 100644 --- a/src/gcore/resources/cdn/resources/shield.py +++ b/src/gcore/resources/cdn/cdn_resources/shield.py @@ -17,8 +17,8 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.cdn.resources import shield_replace_params -from ....types.cdn.resources.origin_shielding import OriginShielding +from ....types.cdn.cdn_resources import shield_replace_params +from ....types.cdn.cdn_resources.origin_shielding import OriginShielding __all__ = ["ShieldResource", "AsyncShieldResource"] diff --git a/src/gcore/types/cdn/__init__.py b/src/gcore/types/cdn/__init__.py index c421bf3c..92895e33 100644 --- a/src/gcore/types/cdn/__init__.py +++ b/src/gcore/types/cdn/__init__.py @@ -31,31 +31,31 @@ from .log_download_params import LogDownloadParams as LogDownloadParams from .public_network_list import PublicNetworkList as PublicNetworkList from .ip_range_list_params import IPRangeListParams as IPRangeListParams -from .resource_list_params import ResourceListParams as ResourceListParams from .resource_usage_stats import ResourceUsageStats as ResourceUsageStats from .shield_list_response import ShieldListResponse as ShieldListResponse from .audit_log_list_params import AuditLogListParams as AuditLogListParams from .logs_aggregated_stats import LogsAggregatedStats as LogsAggregatedStats -from .resource_purge_params import ResourcePurgeParams as ResourcePurgeParams from .cdn_available_features import CDNAvailableFeatures as CDNAvailableFeatures -from .resource_create_params import ResourceCreateParams as ResourceCreateParams -from .resource_update_params import ResourceUpdateParams as ResourceUpdateParams from .certificate_list_params import CertificateListParams as CertificateListParams -from .resource_replace_params import ResourceReplaceParams as ResourceReplaceParams from .shield_aggregated_stats import ShieldAggregatedStats as ShieldAggregatedStats +from .cdn_resource_list_params import CDNResourceListParams as CDNResourceListParams from .ip_range_list_ips_params import IPRangeListIPsParams as IPRangeListIPsParams from .logs_uploader_validation import LogsUploaderValidation as LogsUploaderValidation from .origin_group_list_params import OriginGroupListParams as OriginGroupListParams -from .resource_prefetch_params import ResourcePrefetchParams as ResourcePrefetchParams +from .cdn_resource_purge_params import CDNResourcePurgeParams as CDNResourcePurgeParams from .cdn_update_account_params import CDNUpdateAccountParams as CDNUpdateAccountParams from .certificate_create_params import CertificateCreateParams as CertificateCreateParams from .resource_aggregated_stats import ResourceAggregatedStats as ResourceAggregatedStats +from .cdn_resource_create_params import CDNResourceCreateParams as CDNResourceCreateParams +from .cdn_resource_update_params import CDNResourceUpdateParams as CDNResourceUpdateParams from .certificate_replace_params import CertificateReplaceParams as CertificateReplaceParams from .origin_group_create_params import OriginGroupCreateParams as OriginGroupCreateParams from .origin_group_update_params import OriginGroupUpdateParams as OriginGroupUpdateParams +from .cdn_resource_replace_params import CDNResourceReplaceParams as CDNResourceReplaceParams from .origin_group_replace_params import OriginGroupReplaceParams as OriginGroupReplaceParams from .rule_template_create_params import RuleTemplateCreateParams as RuleTemplateCreateParams from .rule_template_update_params import RuleTemplateUpdateParams as RuleTemplateUpdateParams +from .cdn_resource_prefetch_params import CDNResourcePrefetchParams as CDNResourcePrefetchParams from .rule_template_replace_params import RuleTemplateReplaceParams as RuleTemplateReplaceParams from .certificate_get_status_params import CertificateGetStatusParams as CertificateGetStatusParams from .cdn_list_purge_statuses_params import CDNListPurgeStatusesParams as CDNListPurgeStatusesParams diff --git a/src/gcore/types/cdn/resource_create_params.py b/src/gcore/types/cdn/cdn_resource_create_params.py similarity index 99% rename from src/gcore/types/cdn/resource_create_params.py rename to src/gcore/types/cdn/cdn_resource_create_params.py index 743fba2a..a7f775a8 100644 --- a/src/gcore/types/cdn/resource_create_params.py +++ b/src/gcore/types/cdn/cdn_resource_create_params.py @@ -9,7 +9,7 @@ from ..._utils import PropertyInfo __all__ = [ - "ResourceCreateParams", + "CDNResourceCreateParams", "Options", "OptionsAllowedHTTPMethods", "OptionsBotProtection", @@ -71,7 +71,7 @@ ] -class ResourceCreateParams(TypedDict, total=False): +class CDNResourceCreateParams(TypedDict, total=False): cname: Required[str] """Delivery domains that will be used for content delivery through a CDN. diff --git a/src/gcore/types/cdn/resource_list_params.py b/src/gcore/types/cdn/cdn_resource_list_params.py similarity index 96% rename from src/gcore/types/cdn/resource_list_params.py rename to src/gcore/types/cdn/cdn_resource_list_params.py index 24c26506..98c70e08 100644 --- a/src/gcore/types/cdn/resource_list_params.py +++ b/src/gcore/types/cdn/cdn_resource_list_params.py @@ -6,10 +6,10 @@ from ..._utils import PropertyInfo -__all__ = ["ResourceListParams"] +__all__ = ["CDNResourceListParams"] -class ResourceListParams(TypedDict, total=False): +class CDNResourceListParams(TypedDict, total=False): cname: str """Delivery domain (CNAME) of the CDN resource.""" diff --git a/src/gcore/types/cdn/resource_prefetch_params.py b/src/gcore/types/cdn/cdn_resource_prefetch_params.py similarity index 80% rename from src/gcore/types/cdn/resource_prefetch_params.py rename to src/gcore/types/cdn/cdn_resource_prefetch_params.py index 1fc88a63..1d3c0aa0 100644 --- a/src/gcore/types/cdn/resource_prefetch_params.py +++ b/src/gcore/types/cdn/cdn_resource_prefetch_params.py @@ -6,10 +6,10 @@ from ..._types import SequenceNotStr -__all__ = ["ResourcePrefetchParams"] +__all__ = ["CDNResourcePrefetchParams"] -class ResourcePrefetchParams(TypedDict, total=False): +class CDNResourcePrefetchParams(TypedDict, total=False): paths: Required[SequenceNotStr[str]] """Paths to files that should be pre-populated to the CDN. diff --git a/src/gcore/types/cdn/resource_purge_params.py b/src/gcore/types/cdn/cdn_resource_purge_params.py similarity index 94% rename from src/gcore/types/cdn/resource_purge_params.py rename to src/gcore/types/cdn/cdn_resource_purge_params.py index 0a930c50..aa885a05 100644 --- a/src/gcore/types/cdn/resource_purge_params.py +++ b/src/gcore/types/cdn/cdn_resource_purge_params.py @@ -7,7 +7,7 @@ from ..._types import SequenceNotStr -__all__ = ["ResourcePurgeParams", "PurgeByURL", "PurgeByPattern", "PurgeAllCache"] +__all__ = ["CDNResourcePurgeParams", "PurgeByURL", "PurgeByPattern", "PurgeAllCache"] class PurgeByURL(TypedDict, total=False): @@ -68,4 +68,4 @@ class PurgeAllCache(TypedDict, total=False): """ -ResourcePurgeParams: TypeAlias = Union[PurgeByURL, PurgeByPattern, PurgeAllCache] +CDNResourcePurgeParams: TypeAlias = Union[PurgeByURL, PurgeByPattern, PurgeAllCache] diff --git a/src/gcore/types/cdn/resource_replace_params.py b/src/gcore/types/cdn/cdn_resource_replace_params.py similarity index 99% rename from src/gcore/types/cdn/resource_replace_params.py rename to src/gcore/types/cdn/cdn_resource_replace_params.py index fb57bb77..0503cf07 100644 --- a/src/gcore/types/cdn/resource_replace_params.py +++ b/src/gcore/types/cdn/cdn_resource_replace_params.py @@ -9,7 +9,7 @@ from ..._utils import PropertyInfo __all__ = [ - "ResourceReplaceParams", + "CDNResourceReplaceParams", "Options", "OptionsAllowedHTTPMethods", "OptionsBotProtection", @@ -71,7 +71,7 @@ ] -class ResourceReplaceParams(TypedDict, total=False): +class CDNResourceReplaceParams(TypedDict, total=False): origin_group: Required[Annotated[int, PropertyInfo(alias="originGroup")]] """Origin group ID with which the CDN resource is associated. diff --git a/src/gcore/types/cdn/resource_update_params.py b/src/gcore/types/cdn/cdn_resource_update_params.py similarity index 99% rename from src/gcore/types/cdn/resource_update_params.py rename to src/gcore/types/cdn/cdn_resource_update_params.py index 92251e5c..9011c2e0 100644 --- a/src/gcore/types/cdn/resource_update_params.py +++ b/src/gcore/types/cdn/cdn_resource_update_params.py @@ -9,7 +9,7 @@ from ..._utils import PropertyInfo __all__ = [ - "ResourceUpdateParams", + "CDNResourceUpdateParams", "Options", "OptionsAllowedHTTPMethods", "OptionsBotProtection", @@ -71,7 +71,7 @@ ] -class ResourceUpdateParams(TypedDict, total=False): +class CDNResourceUpdateParams(TypedDict, total=False): active: bool """Enables or disables a CDN resource. diff --git a/src/gcore/types/cdn/resources/__init__.py b/src/gcore/types/cdn/cdn_resources/__init__.py similarity index 100% rename from src/gcore/types/cdn/resources/__init__.py rename to src/gcore/types/cdn/cdn_resources/__init__.py diff --git a/src/gcore/types/cdn/resources/cdn_resource_rule.py b/src/gcore/types/cdn/cdn_resources/cdn_resource_rule.py similarity index 100% rename from src/gcore/types/cdn/resources/cdn_resource_rule.py rename to src/gcore/types/cdn/cdn_resources/cdn_resource_rule.py diff --git a/src/gcore/types/cdn/resources/origin_shielding.py b/src/gcore/types/cdn/cdn_resources/origin_shielding.py similarity index 100% rename from src/gcore/types/cdn/resources/origin_shielding.py rename to src/gcore/types/cdn/cdn_resources/origin_shielding.py diff --git a/src/gcore/types/cdn/resources/rule_create_params.py b/src/gcore/types/cdn/cdn_resources/rule_create_params.py similarity index 100% rename from src/gcore/types/cdn/resources/rule_create_params.py rename to src/gcore/types/cdn/cdn_resources/rule_create_params.py diff --git a/src/gcore/types/cdn/resources/rule_list_response.py b/src/gcore/types/cdn/cdn_resources/rule_list_response.py similarity index 100% rename from src/gcore/types/cdn/resources/rule_list_response.py rename to src/gcore/types/cdn/cdn_resources/rule_list_response.py diff --git a/src/gcore/types/cdn/resources/rule_replace_params.py b/src/gcore/types/cdn/cdn_resources/rule_replace_params.py similarity index 100% rename from src/gcore/types/cdn/resources/rule_replace_params.py rename to src/gcore/types/cdn/cdn_resources/rule_replace_params.py diff --git a/src/gcore/types/cdn/resources/rule_update_params.py b/src/gcore/types/cdn/cdn_resources/rule_update_params.py similarity index 100% rename from src/gcore/types/cdn/resources/rule_update_params.py rename to src/gcore/types/cdn/cdn_resources/rule_update_params.py diff --git a/src/gcore/types/cdn/resources/shield_replace_params.py b/src/gcore/types/cdn/cdn_resources/shield_replace_params.py similarity index 100% rename from src/gcore/types/cdn/resources/shield_replace_params.py rename to src/gcore/types/cdn/cdn_resources/shield_replace_params.py diff --git a/tests/api_resources/cdn/resources/__init__.py b/tests/api_resources/cdn/cdn_resources/__init__.py similarity index 100% rename from tests/api_resources/cdn/resources/__init__.py rename to tests/api_resources/cdn/cdn_resources/__init__.py diff --git a/tests/api_resources/cdn/resources/test_rules.py b/tests/api_resources/cdn/cdn_resources/test_rules.py similarity index 96% rename from tests/api_resources/cdn/resources/test_rules.py rename to tests/api_resources/cdn/cdn_resources/test_rules.py index aa447a5f..5fd9a3d7 100644 --- a/tests/api_resources/cdn/resources/test_rules.py +++ b/tests/api_resources/cdn/cdn_resources/test_rules.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cdn.resources import ( +from gcore.types.cdn.cdn_resources import ( CDNResourceRule, RuleListResponse, ) @@ -22,7 +22,7 @@ class TestRules: @parametrize def test_method_create(self, client: Gcore) -> None: - rule = client.cdn.resources.rules.create( + rule = client.cdn.cdn_resources.rules.create( resource_id=0, name="My first rule", rule="/folder/images/*.png", @@ -32,7 +32,7 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - rule = client.cdn.resources.rules.create( + rule = client.cdn.cdn_resources.rules.create( resource_id=0, name="My first rule", rule="/folder/images/*.png", @@ -311,7 +311,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.cdn.resources.rules.with_raw_response.create( + response = client.cdn.cdn_resources.rules.with_raw_response.create( resource_id=0, name="My first rule", rule="/folder/images/*.png", @@ -325,7 +325,7 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.cdn.resources.rules.with_streaming_response.create( + with client.cdn.cdn_resources.rules.with_streaming_response.create( resource_id=0, name="My first rule", rule="/folder/images/*.png", @@ -341,7 +341,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: - rule = client.cdn.resources.rules.update( + rule = client.cdn.cdn_resources.rules.update( rule_id=0, resource_id=0, ) @@ -349,7 +349,7 @@ def test_method_update(self, client: Gcore) -> None: @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - rule = client.cdn.resources.rules.update( + rule = client.cdn.cdn_resources.rules.update( rule_id=0, resource_id=0, active=True, @@ -629,7 +629,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.cdn.resources.rules.with_raw_response.update( + response = client.cdn.cdn_resources.rules.with_raw_response.update( rule_id=0, resource_id=0, ) @@ -641,7 +641,7 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.cdn.resources.rules.with_streaming_response.update( + with client.cdn.cdn_resources.rules.with_streaming_response.update( rule_id=0, resource_id=0, ) as response: @@ -655,14 +655,14 @@ def test_streaming_response_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: - rule = client.cdn.resources.rules.list( + rule = client.cdn.cdn_resources.rules.list( 0, ) assert_matches_type(RuleListResponse, rule, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cdn.resources.rules.with_raw_response.list( + response = client.cdn.cdn_resources.rules.with_raw_response.list( 0, ) @@ -673,7 +673,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cdn.resources.rules.with_streaming_response.list( + with client.cdn.cdn_resources.rules.with_streaming_response.list( 0, ) as response: assert not response.is_closed @@ -686,7 +686,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: - rule = client.cdn.resources.rules.delete( + rule = client.cdn.cdn_resources.rules.delete( rule_id=0, resource_id=0, ) @@ -694,7 +694,7 @@ def test_method_delete(self, client: Gcore) -> None: @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cdn.resources.rules.with_raw_response.delete( + response = client.cdn.cdn_resources.rules.with_raw_response.delete( rule_id=0, resource_id=0, ) @@ -706,7 +706,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cdn.resources.rules.with_streaming_response.delete( + with client.cdn.cdn_resources.rules.with_streaming_response.delete( rule_id=0, resource_id=0, ) as response: @@ -720,7 +720,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: - rule = client.cdn.resources.rules.get( + rule = client.cdn.cdn_resources.rules.get( rule_id=0, resource_id=0, ) @@ -728,7 +728,7 @@ def test_method_get(self, client: Gcore) -> None: @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.cdn.resources.rules.with_raw_response.get( + response = client.cdn.cdn_resources.rules.with_raw_response.get( rule_id=0, resource_id=0, ) @@ -740,7 +740,7 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.cdn.resources.rules.with_streaming_response.get( + with client.cdn.cdn_resources.rules.with_streaming_response.get( rule_id=0, resource_id=0, ) as response: @@ -754,7 +754,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: @parametrize def test_method_replace(self, client: Gcore) -> None: - rule = client.cdn.resources.rules.replace( + rule = client.cdn.cdn_resources.rules.replace( rule_id=0, resource_id=0, rule="/folder/images/*.png", @@ -764,7 +764,7 @@ def test_method_replace(self, client: Gcore) -> None: @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: - rule = client.cdn.resources.rules.replace( + rule = client.cdn.cdn_resources.rules.replace( rule_id=0, resource_id=0, rule="/folder/images/*.png", @@ -1044,7 +1044,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_replace(self, client: Gcore) -> None: - response = client.cdn.resources.rules.with_raw_response.replace( + response = client.cdn.cdn_resources.rules.with_raw_response.replace( rule_id=0, resource_id=0, rule="/folder/images/*.png", @@ -1058,7 +1058,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: - with client.cdn.resources.rules.with_streaming_response.replace( + with client.cdn.cdn_resources.rules.with_streaming_response.replace( rule_id=0, resource_id=0, rule="/folder/images/*.png", @@ -1080,7 +1080,7 @@ class TestAsyncRules: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - rule = await async_client.cdn.resources.rules.create( + rule = await async_client.cdn.cdn_resources.rules.create( resource_id=0, name="My first rule", rule="/folder/images/*.png", @@ -1090,7 +1090,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - rule = await async_client.cdn.resources.rules.create( + rule = await async_client.cdn.cdn_resources.rules.create( resource_id=0, name="My first rule", rule="/folder/images/*.png", @@ -1369,7 +1369,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.rules.with_raw_response.create( + response = await async_client.cdn.cdn_resources.rules.with_raw_response.create( resource_id=0, name="My first rule", rule="/folder/images/*.png", @@ -1383,7 +1383,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.rules.with_streaming_response.create( + async with async_client.cdn.cdn_resources.rules.with_streaming_response.create( resource_id=0, name="My first rule", rule="/folder/images/*.png", @@ -1399,7 +1399,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - rule = await async_client.cdn.resources.rules.update( + rule = await async_client.cdn.cdn_resources.rules.update( rule_id=0, resource_id=0, ) @@ -1407,7 +1407,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - rule = await async_client.cdn.resources.rules.update( + rule = await async_client.cdn.cdn_resources.rules.update( rule_id=0, resource_id=0, active=True, @@ -1687,7 +1687,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.rules.with_raw_response.update( + response = await async_client.cdn.cdn_resources.rules.with_raw_response.update( rule_id=0, resource_id=0, ) @@ -1699,7 +1699,7 @@ 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.cdn.resources.rules.with_streaming_response.update( + async with async_client.cdn.cdn_resources.rules.with_streaming_response.update( rule_id=0, resource_id=0, ) as response: @@ -1713,14 +1713,14 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - rule = await async_client.cdn.resources.rules.list( + rule = await async_client.cdn.cdn_resources.rules.list( 0, ) assert_matches_type(RuleListResponse, rule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.rules.with_raw_response.list( + response = await async_client.cdn.cdn_resources.rules.with_raw_response.list( 0, ) @@ -1731,7 +1731,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.resources.rules.with_streaming_response.list( + async with async_client.cdn.cdn_resources.rules.with_streaming_response.list( 0, ) as response: assert not response.is_closed @@ -1744,7 +1744,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - rule = await async_client.cdn.resources.rules.delete( + rule = await async_client.cdn.cdn_resources.rules.delete( rule_id=0, resource_id=0, ) @@ -1752,7 +1752,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.rules.with_raw_response.delete( + response = await async_client.cdn.cdn_resources.rules.with_raw_response.delete( rule_id=0, resource_id=0, ) @@ -1764,7 +1764,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.cdn.resources.rules.with_streaming_response.delete( + async with async_client.cdn.cdn_resources.rules.with_streaming_response.delete( rule_id=0, resource_id=0, ) as response: @@ -1778,7 +1778,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - rule = await async_client.cdn.resources.rules.get( + rule = await async_client.cdn.cdn_resources.rules.get( rule_id=0, resource_id=0, ) @@ -1786,7 +1786,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.rules.with_raw_response.get( + response = await async_client.cdn.cdn_resources.rules.with_raw_response.get( rule_id=0, resource_id=0, ) @@ -1798,7 +1798,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.resources.rules.with_streaming_response.get( + async with async_client.cdn.cdn_resources.rules.with_streaming_response.get( rule_id=0, resource_id=0, ) as response: @@ -1812,7 +1812,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_replace(self, async_client: AsyncGcore) -> None: - rule = await async_client.cdn.resources.rules.replace( + rule = await async_client.cdn.cdn_resources.rules.replace( rule_id=0, resource_id=0, rule="/folder/images/*.png", @@ -1822,7 +1822,7 @@ async def test_method_replace(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: - rule = await async_client.cdn.resources.rules.replace( + rule = await async_client.cdn.cdn_resources.rules.replace( rule_id=0, resource_id=0, rule="/folder/images/*.png", @@ -2102,7 +2102,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.rules.with_raw_response.replace( + response = await async_client.cdn.cdn_resources.rules.with_raw_response.replace( rule_id=0, resource_id=0, rule="/folder/images/*.png", @@ -2116,7 +2116,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.rules.with_streaming_response.replace( + async with async_client.cdn.cdn_resources.rules.with_streaming_response.replace( rule_id=0, resource_id=0, rule="/folder/images/*.png", diff --git a/tests/api_resources/cdn/resources/test_shield.py b/tests/api_resources/cdn/cdn_resources/test_shield.py similarity index 82% rename from tests/api_resources/cdn/resources/test_shield.py rename to tests/api_resources/cdn/cdn_resources/test_shield.py index 40679e62..dcc9f67c 100644 --- a/tests/api_resources/cdn/resources/test_shield.py +++ b/tests/api_resources/cdn/cdn_resources/test_shield.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cdn.resources import OriginShielding +from gcore.types.cdn.cdn_resources import OriginShielding base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,14 +19,14 @@ class TestShield: @parametrize def test_method_get(self, client: Gcore) -> None: - shield = client.cdn.resources.shield.get( + shield = client.cdn.cdn_resources.shield.get( 0, ) assert_matches_type(OriginShielding, shield, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.cdn.resources.shield.with_raw_response.get( + response = client.cdn.cdn_resources.shield.with_raw_response.get( 0, ) @@ -37,7 +37,7 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.cdn.resources.shield.with_streaming_response.get( + with client.cdn.cdn_resources.shield.with_streaming_response.get( 0, ) as response: assert not response.is_closed @@ -50,14 +50,14 @@ def test_streaming_response_get(self, client: Gcore) -> None: @parametrize def test_method_replace(self, client: Gcore) -> None: - shield = client.cdn.resources.shield.replace( + shield = client.cdn.cdn_resources.shield.replace( resource_id=0, ) assert_matches_type(object, shield, path=["response"]) @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: - shield = client.cdn.resources.shield.replace( + shield = client.cdn.cdn_resources.shield.replace( resource_id=0, shielding_pop=4, ) @@ -65,7 +65,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_replace(self, client: Gcore) -> None: - response = client.cdn.resources.shield.with_raw_response.replace( + response = client.cdn.cdn_resources.shield.with_raw_response.replace( resource_id=0, ) @@ -76,7 +76,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: - with client.cdn.resources.shield.with_streaming_response.replace( + with client.cdn.cdn_resources.shield.with_streaming_response.replace( resource_id=0, ) as response: assert not response.is_closed @@ -95,14 +95,14 @@ class TestAsyncShield: @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - shield = await async_client.cdn.resources.shield.get( + shield = await async_client.cdn.cdn_resources.shield.get( 0, ) assert_matches_type(OriginShielding, shield, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.shield.with_raw_response.get( + response = await async_client.cdn.cdn_resources.shield.with_raw_response.get( 0, ) @@ -113,7 +113,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.resources.shield.with_streaming_response.get( + async with async_client.cdn.cdn_resources.shield.with_streaming_response.get( 0, ) as response: assert not response.is_closed @@ -126,14 +126,14 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_replace(self, async_client: AsyncGcore) -> None: - shield = await async_client.cdn.resources.shield.replace( + shield = await async_client.cdn.cdn_resources.shield.replace( resource_id=0, ) assert_matches_type(object, shield, path=["response"]) @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: - shield = await async_client.cdn.resources.shield.replace( + shield = await async_client.cdn.cdn_resources.shield.replace( resource_id=0, shielding_pop=4, ) @@ -141,7 +141,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.shield.with_raw_response.replace( + response = await async_client.cdn.cdn_resources.shield.with_raw_response.replace( resource_id=0, ) @@ -152,7 +152,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.shield.with_streaming_response.replace( + async with async_client.cdn.cdn_resources.shield.with_streaming_response.replace( resource_id=0, ) as response: assert not response.is_closed diff --git a/tests/api_resources/cdn/test_resources.py b/tests/api_resources/cdn/test_cdn_resources.py similarity index 87% rename from tests/api_resources/cdn/test_resources.py rename to tests/api_resources/cdn/test_cdn_resources.py index a750ecc2..79f8e5db 100644 --- a/tests/api_resources/cdn/test_resources.py +++ b/tests/api_resources/cdn/test_cdn_resources.py @@ -17,21 +17,21 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestResources: +class TestCDNResources: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_create(self, client: Gcore) -> None: - resource = client.cdn.resources.create( + cdn_resource = client.cdn.cdn_resources.create( cname="cdn.site.com", origin="example.com", origin_group=132, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - resource = client.cdn.resources.create( + cdn_resource = client.cdn.cdn_resources.create( cname="cdn.site.com", origin="example.com", origin_group=132, @@ -333,11 +333,11 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: ssl_enabled=False, waap_api_domain_enabled=True, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.cdn.resources.with_raw_response.create( + response = client.cdn.cdn_resources.with_raw_response.create( cname="cdn.site.com", origin="example.com", origin_group=132, @@ -345,12 +345,12 @@ def test_raw_response_create(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.cdn.resources.with_streaming_response.create( + with client.cdn.cdn_resources.with_streaming_response.create( cname="cdn.site.com", origin="example.com", origin_group=132, @@ -358,23 +358,23 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize def test_method_update(self, client: Gcore) -> None: - resource = client.cdn.resources.update( + cdn_resource = client.cdn.cdn_resources.update( resource_id=0, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - resource = client.cdn.resources.update( + cdn_resource = client.cdn.cdn_resources.update( resource_id=0, active=True, description="My resource", @@ -673,42 +673,42 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: ssl_data=192, ssl_enabled=False, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.cdn.resources.with_raw_response.update( + response = client.cdn.cdn_resources.with_raw_response.update( resource_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.cdn.resources.with_streaming_response.update( + with client.cdn.cdn_resources.with_streaming_response.update( resource_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_list(self, client: Gcore) -> None: - resource = client.cdn.resources.list() - assert_matches_type(CDNResourceList, resource, path=["response"]) + cdn_resource = client.cdn.cdn_resources.list() + assert_matches_type(CDNResourceList, cdn_resource, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - resource = client.cdn.resources.list( + cdn_resource = client.cdn.cdn_resources.list( cname="cname", deleted=True, enabled=True, @@ -726,283 +726,283 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: suspend=True, vp_enabled=True, ) - assert_matches_type(CDNResourceList, resource, path=["response"]) + assert_matches_type(CDNResourceList, cdn_resource, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cdn.resources.with_raw_response.list() + response = client.cdn.cdn_resources.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert_matches_type(CDNResourceList, resource, path=["response"]) + cdn_resource = response.parse() + assert_matches_type(CDNResourceList, cdn_resource, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cdn.resources.with_streaming_response.list() as response: + with client.cdn.cdn_resources.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert_matches_type(CDNResourceList, resource, path=["response"]) + cdn_resource = response.parse() + assert_matches_type(CDNResourceList, cdn_resource, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: Gcore) -> None: - resource = client.cdn.resources.delete( + cdn_resource = client.cdn.cdn_resources.delete( 0, ) - assert resource is None + assert cdn_resource is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cdn.resources.with_raw_response.delete( + response = client.cdn.cdn_resources.with_raw_response.delete( 0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert resource is None + cdn_resource = response.parse() + assert cdn_resource is None @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cdn.resources.with_streaming_response.delete( + with client.cdn.cdn_resources.with_streaming_response.delete( 0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert resource is None + cdn_resource = response.parse() + assert cdn_resource is None assert cast(Any, response.is_closed) is True @parametrize def test_method_get(self, client: Gcore) -> None: - resource = client.cdn.resources.get( + cdn_resource = client.cdn.cdn_resources.get( 0, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.cdn.resources.with_raw_response.get( + response = client.cdn.cdn_resources.with_raw_response.get( 0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.cdn.resources.with_streaming_response.get( + with client.cdn.cdn_resources.with_streaming_response.get( 0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_prefetch(self, client: Gcore) -> None: - resource = client.cdn.resources.prefetch( + cdn_resource = client.cdn.cdn_resources.prefetch( resource_id=0, paths=["/test.jpg", "test1.jpg"], ) - assert resource is None + assert cdn_resource is None @parametrize def test_raw_response_prefetch(self, client: Gcore) -> None: - response = client.cdn.resources.with_raw_response.prefetch( + response = client.cdn.cdn_resources.with_raw_response.prefetch( resource_id=0, paths=["/test.jpg", "test1.jpg"], ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert resource is None + cdn_resource = response.parse() + assert cdn_resource is None @parametrize def test_streaming_response_prefetch(self, client: Gcore) -> None: - with client.cdn.resources.with_streaming_response.prefetch( + with client.cdn.cdn_resources.with_streaming_response.prefetch( resource_id=0, paths=["/test.jpg", "test1.jpg"], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert resource is None + cdn_resource = response.parse() + assert cdn_resource is None assert cast(Any, response.is_closed) is True @parametrize def test_method_prevalidate_ssl_le_certificate(self, client: Gcore) -> None: - resource = client.cdn.resources.prevalidate_ssl_le_certificate( + cdn_resource = client.cdn.cdn_resources.prevalidate_ssl_le_certificate( 0, ) - assert resource is None + assert cdn_resource is None @parametrize def test_raw_response_prevalidate_ssl_le_certificate(self, client: Gcore) -> None: - response = client.cdn.resources.with_raw_response.prevalidate_ssl_le_certificate( + response = client.cdn.cdn_resources.with_raw_response.prevalidate_ssl_le_certificate( 0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert resource is None + cdn_resource = response.parse() + assert cdn_resource is None @parametrize def test_streaming_response_prevalidate_ssl_le_certificate(self, client: Gcore) -> None: - with client.cdn.resources.with_streaming_response.prevalidate_ssl_le_certificate( + with client.cdn.cdn_resources.with_streaming_response.prevalidate_ssl_le_certificate( 0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert resource is None + cdn_resource = response.parse() + assert cdn_resource is None assert cast(Any, response.is_closed) is True @parametrize def test_method_purge_overload_1(self, client: Gcore) -> None: - resource = client.cdn.resources.purge( + cdn_resource = client.cdn.cdn_resources.purge( resource_id=0, ) - assert resource is None + assert cdn_resource is None @parametrize def test_method_purge_with_all_params_overload_1(self, client: Gcore) -> None: - resource = client.cdn.resources.purge( + cdn_resource = client.cdn.cdn_resources.purge( resource_id=0, urls=["/some-url.jpg", "/img/example.jpg"], ) - assert resource is None + assert cdn_resource is None @parametrize def test_raw_response_purge_overload_1(self, client: Gcore) -> None: - response = client.cdn.resources.with_raw_response.purge( + response = client.cdn.cdn_resources.with_raw_response.purge( resource_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert resource is None + cdn_resource = response.parse() + assert cdn_resource is None @parametrize def test_streaming_response_purge_overload_1(self, client: Gcore) -> None: - with client.cdn.resources.with_streaming_response.purge( + with client.cdn.cdn_resources.with_streaming_response.purge( resource_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert resource is None + cdn_resource = response.parse() + assert cdn_resource is None assert cast(Any, response.is_closed) is True @parametrize def test_method_purge_overload_2(self, client: Gcore) -> None: - resource = client.cdn.resources.purge( + cdn_resource = client.cdn.cdn_resources.purge( resource_id=0, ) - assert resource is None + assert cdn_resource is None @parametrize def test_method_purge_with_all_params_overload_2(self, client: Gcore) -> None: - resource = client.cdn.resources.purge( + cdn_resource = client.cdn.cdn_resources.purge( resource_id=0, paths=["/images/*", "/videos/*"], ) - assert resource is None + assert cdn_resource is None @parametrize def test_raw_response_purge_overload_2(self, client: Gcore) -> None: - response = client.cdn.resources.with_raw_response.purge( + response = client.cdn.cdn_resources.with_raw_response.purge( resource_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert resource is None + cdn_resource = response.parse() + assert cdn_resource is None @parametrize def test_streaming_response_purge_overload_2(self, client: Gcore) -> None: - with client.cdn.resources.with_streaming_response.purge( + with client.cdn.cdn_resources.with_streaming_response.purge( resource_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert resource is None + cdn_resource = response.parse() + assert cdn_resource is None assert cast(Any, response.is_closed) is True @parametrize def test_method_purge_overload_3(self, client: Gcore) -> None: - resource = client.cdn.resources.purge( + cdn_resource = client.cdn.cdn_resources.purge( resource_id=0, ) - assert resource is None + assert cdn_resource is None @parametrize def test_method_purge_with_all_params_overload_3(self, client: Gcore) -> None: - resource = client.cdn.resources.purge( + cdn_resource = client.cdn.cdn_resources.purge( resource_id=0, paths=["string"], ) - assert resource is None + assert cdn_resource is None @parametrize def test_raw_response_purge_overload_3(self, client: Gcore) -> None: - response = client.cdn.resources.with_raw_response.purge( + response = client.cdn.cdn_resources.with_raw_response.purge( resource_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert resource is None + cdn_resource = response.parse() + assert cdn_resource is None @parametrize def test_streaming_response_purge_overload_3(self, client: Gcore) -> None: - with client.cdn.resources.with_streaming_response.purge( + with client.cdn.cdn_resources.with_streaming_response.purge( resource_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert resource is None + cdn_resource = response.parse() + assert cdn_resource is None assert cast(Any, response.is_closed) is True @parametrize def test_method_replace(self, client: Gcore) -> None: - resource = client.cdn.resources.replace( + cdn_resource = client.cdn.cdn_resources.replace( resource_id=0, origin_group=132, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: - resource = client.cdn.resources.replace( + cdn_resource = client.cdn.cdn_resources.replace( resource_id=0, origin_group=132, active=True, @@ -1302,52 +1302,52 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: ssl_enabled=False, waap_api_domain_enabled=True, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize def test_raw_response_replace(self, client: Gcore) -> None: - response = client.cdn.resources.with_raw_response.replace( + response = client.cdn.cdn_resources.with_raw_response.replace( resource_id=0, origin_group=132, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: - with client.cdn.resources.with_streaming_response.replace( + with client.cdn.cdn_resources.with_streaming_response.replace( resource_id=0, origin_group=132, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncResources: +class TestAsyncCDNResources: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.create( + cdn_resource = await async_client.cdn.cdn_resources.create( cname="cdn.site.com", origin="example.com", origin_group=132, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.create( + cdn_resource = await async_client.cdn.cdn_resources.create( cname="cdn.site.com", origin="example.com", origin_group=132, @@ -1649,11 +1649,11 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> ssl_enabled=False, waap_api_domain_enabled=True, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.with_raw_response.create( + response = await async_client.cdn.cdn_resources.with_raw_response.create( cname="cdn.site.com", origin="example.com", origin_group=132, @@ -1661,12 +1661,12 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = await response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.with_streaming_response.create( + async with async_client.cdn.cdn_resources.with_streaming_response.create( cname="cdn.site.com", origin="example.com", origin_group=132, @@ -1674,23 +1674,23 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = await response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.update( + cdn_resource = await async_client.cdn.cdn_resources.update( resource_id=0, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.update( + cdn_resource = await async_client.cdn.cdn_resources.update( resource_id=0, active=True, description="My resource", @@ -1989,42 +1989,42 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> ssl_data=192, ssl_enabled=False, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.with_raw_response.update( + response = await async_client.cdn.cdn_resources.with_raw_response.update( resource_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = await response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @pytest.mark.skip(reason="unexpected prism python test failures") @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.with_streaming_response.update( + async with async_client.cdn.cdn_resources.with_streaming_response.update( resource_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = await response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.list() - assert_matches_type(CDNResourceList, resource, path=["response"]) + cdn_resource = await async_client.cdn.cdn_resources.list() + assert_matches_type(CDNResourceList, cdn_resource, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.list( + cdn_resource = await async_client.cdn.cdn_resources.list( cname="cname", deleted=True, enabled=True, @@ -2042,283 +2042,283 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No suspend=True, vp_enabled=True, ) - assert_matches_type(CDNResourceList, resource, path=["response"]) + assert_matches_type(CDNResourceList, cdn_resource, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.with_raw_response.list() + response = await async_client.cdn.cdn_resources.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert_matches_type(CDNResourceList, resource, path=["response"]) + cdn_resource = await response.parse() + assert_matches_type(CDNResourceList, cdn_resource, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.with_streaming_response.list() as response: + async with async_client.cdn.cdn_resources.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert_matches_type(CDNResourceList, resource, path=["response"]) + cdn_resource = await response.parse() + assert_matches_type(CDNResourceList, cdn_resource, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.delete( + cdn_resource = await async_client.cdn.cdn_resources.delete( 0, ) - assert resource is None + assert cdn_resource is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.with_raw_response.delete( + response = await async_client.cdn.cdn_resources.with_raw_response.delete( 0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert resource is None + cdn_resource = await response.parse() + assert cdn_resource is None @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.with_streaming_response.delete( + async with async_client.cdn.cdn_resources.with_streaming_response.delete( 0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert resource is None + cdn_resource = await response.parse() + assert cdn_resource is None assert cast(Any, response.is_closed) is True @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.get( + cdn_resource = await async_client.cdn.cdn_resources.get( 0, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.with_raw_response.get( + response = await async_client.cdn.cdn_resources.with_raw_response.get( 0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = await response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.with_streaming_response.get( + async with async_client.cdn.cdn_resources.with_streaming_response.get( 0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = await response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_prefetch(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.prefetch( + cdn_resource = await async_client.cdn.cdn_resources.prefetch( resource_id=0, paths=["/test.jpg", "test1.jpg"], ) - assert resource is None + assert cdn_resource is None @parametrize async def test_raw_response_prefetch(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.with_raw_response.prefetch( + response = await async_client.cdn.cdn_resources.with_raw_response.prefetch( resource_id=0, paths=["/test.jpg", "test1.jpg"], ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert resource is None + cdn_resource = await response.parse() + assert cdn_resource is None @parametrize async def test_streaming_response_prefetch(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.with_streaming_response.prefetch( + async with async_client.cdn.cdn_resources.with_streaming_response.prefetch( resource_id=0, paths=["/test.jpg", "test1.jpg"], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert resource is None + cdn_resource = await response.parse() + assert cdn_resource is None assert cast(Any, response.is_closed) is True @parametrize async def test_method_prevalidate_ssl_le_certificate(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.prevalidate_ssl_le_certificate( + cdn_resource = await async_client.cdn.cdn_resources.prevalidate_ssl_le_certificate( 0, ) - assert resource is None + assert cdn_resource is None @parametrize async def test_raw_response_prevalidate_ssl_le_certificate(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.with_raw_response.prevalidate_ssl_le_certificate( + response = await async_client.cdn.cdn_resources.with_raw_response.prevalidate_ssl_le_certificate( 0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert resource is None + cdn_resource = await response.parse() + assert cdn_resource is None @parametrize async def test_streaming_response_prevalidate_ssl_le_certificate(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.with_streaming_response.prevalidate_ssl_le_certificate( + async with async_client.cdn.cdn_resources.with_streaming_response.prevalidate_ssl_le_certificate( 0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert resource is None + cdn_resource = await response.parse() + assert cdn_resource is None assert cast(Any, response.is_closed) is True @parametrize async def test_method_purge_overload_1(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.purge( + cdn_resource = await async_client.cdn.cdn_resources.purge( resource_id=0, ) - assert resource is None + assert cdn_resource is None @parametrize async def test_method_purge_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.purge( + cdn_resource = await async_client.cdn.cdn_resources.purge( resource_id=0, urls=["/some-url.jpg", "/img/example.jpg"], ) - assert resource is None + assert cdn_resource is None @parametrize async def test_raw_response_purge_overload_1(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.with_raw_response.purge( + response = await async_client.cdn.cdn_resources.with_raw_response.purge( resource_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert resource is None + cdn_resource = await response.parse() + assert cdn_resource is None @parametrize async def test_streaming_response_purge_overload_1(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.with_streaming_response.purge( + async with async_client.cdn.cdn_resources.with_streaming_response.purge( resource_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert resource is None + cdn_resource = await response.parse() + assert cdn_resource is None assert cast(Any, response.is_closed) is True @parametrize async def test_method_purge_overload_2(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.purge( + cdn_resource = await async_client.cdn.cdn_resources.purge( resource_id=0, ) - assert resource is None + assert cdn_resource is None @parametrize async def test_method_purge_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.purge( + cdn_resource = await async_client.cdn.cdn_resources.purge( resource_id=0, paths=["/images/*", "/videos/*"], ) - assert resource is None + assert cdn_resource is None @parametrize async def test_raw_response_purge_overload_2(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.with_raw_response.purge( + response = await async_client.cdn.cdn_resources.with_raw_response.purge( resource_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert resource is None + cdn_resource = await response.parse() + assert cdn_resource is None @parametrize async def test_streaming_response_purge_overload_2(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.with_streaming_response.purge( + async with async_client.cdn.cdn_resources.with_streaming_response.purge( resource_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert resource is None + cdn_resource = await response.parse() + assert cdn_resource is None assert cast(Any, response.is_closed) is True @parametrize async def test_method_purge_overload_3(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.purge( + cdn_resource = await async_client.cdn.cdn_resources.purge( resource_id=0, ) - assert resource is None + assert cdn_resource is None @parametrize async def test_method_purge_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.purge( + cdn_resource = await async_client.cdn.cdn_resources.purge( resource_id=0, paths=["string"], ) - assert resource is None + assert cdn_resource is None @parametrize async def test_raw_response_purge_overload_3(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.with_raw_response.purge( + response = await async_client.cdn.cdn_resources.with_raw_response.purge( resource_id=0, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert resource is None + cdn_resource = await response.parse() + assert cdn_resource is None @parametrize async def test_streaming_response_purge_overload_3(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.with_streaming_response.purge( + async with async_client.cdn.cdn_resources.with_streaming_response.purge( resource_id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert resource is None + cdn_resource = await response.parse() + assert cdn_resource is None assert cast(Any, response.is_closed) is True @parametrize async def test_method_replace(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.replace( + cdn_resource = await async_client.cdn.cdn_resources.replace( resource_id=0, origin_group=132, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: - resource = await async_client.cdn.resources.replace( + cdn_resource = await async_client.cdn.cdn_resources.replace( resource_id=0, origin_group=132, active=True, @@ -2618,30 +2618,30 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> ssl_enabled=False, waap_api_domain_enabled=True, ) - assert_matches_type(CDNResource, resource, path=["response"]) + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.resources.with_raw_response.replace( + response = await async_client.cdn.cdn_resources.with_raw_response.replace( resource_id=0, origin_group=132, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = await response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.resources.with_streaming_response.replace( + async with async_client.cdn.cdn_resources.with_streaming_response.replace( resource_id=0, origin_group=132, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - resource = await response.parse() - assert_matches_type(CDNResource, resource, path=["response"]) + cdn_resource = await response.parse() + assert_matches_type(CDNResource, cdn_resource, path=["response"]) assert cast(Any, response.is_closed) is True From 72f683017aaef4ba337a1071dd10b1eae64d02c7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 16:51:13 +0000 Subject: [PATCH 545/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 554e34bb..f81bf992 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.30.0" + ".": "0.31.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 281c75fc..02d5383a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.30.0" +version = "0.31.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 574d5dd3..d06a94b9 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.30.0" # x-release-please-version +__version__ = "0.31.0" # x-release-please-version From 7a3d9bccaa0ee0c12b9e64553d6c63493bbefc4b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 2 Feb 2026 10:25:05 +0000 Subject: [PATCH 546/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cloud/k8s/clusters/clusters.py | 100 +++++ .../resources/cloud/k8s/clusters/nodes.py | 28 ++ .../cloud/k8s/clusters/pools/nodes.py | 36 ++ .../cloud/k8s/clusters/pools/pools.py | 88 ++++ src/gcore/resources/cloud/k8s/flavors.py | 20 +- src/gcore/resources/cloud/k8s/k8s.py | 8 + .../cloud/load_balancers/listeners.py | 12 + .../load_balancers/pools/health_monitors.py | 12 + .../cloud/load_balancers/pools/members.py | 4 +- .../cloud/load_balancers/pools/pools.py | 12 + src/gcore/resources/cloud/tasks.py | 20 +- src/gcore/types/cloud/health_monitor.py | 3 +- .../types/cloud/k8s/cluster_create_params.py | 4 + .../types/cloud/k8s/cluster_delete_params.py | 2 + .../types/cloud/k8s/cluster_update_params.py | 4 + .../types/cloud/k8s/cluster_upgrade_params.py | 2 + .../cloud/k8s/clusters/node_list_params.py | 2 + .../cloud/k8s/clusters/pool_create_params.py | 2 + .../cloud/k8s/clusters/pool_resize_params.py | 3 + .../cloud/k8s/clusters/pool_update_params.py | 3 + .../k8s/clusters/pools/node_list_params.py | 3 + .../types/cloud/k8s/flavor_list_params.py | 7 +- src/gcore/types/cloud/k8s/k8s_cluster.py | 2 + .../types/cloud/k8s/k8s_cluster_kubeconfig.py | 11 +- src/gcore/types/cloud/load_balancer.py | 7 + .../cloud/load_balancer_create_params.py | 10 +- .../cloud/load_balancer_listener_detail.py | 7 + src/gcore/types/cloud/load_balancer_pool.py | 7 + .../types/cloud/load_balancer_pool_list.py | 7 + .../load_balancers/listener_update_params.py | 7 + .../load_balancers/pool_create_params.py | 10 +- .../load_balancers/pool_update_params.py | 17 +- .../pools/health_monitor_create_params.py | 7 + .../pools/member_create_params.py | 3 +- src/gcore/types/cloud/member.py | 3 +- src/gcore/types/cloud/task.py | 2 + src/gcore/types/cloud/task_list_params.py | 10 +- .../cloud/k8s/clusters/pools/test_nodes.py | 200 ++++----- .../cloud/k8s/clusters/test_nodes.py | 132 +++--- .../cloud/k8s/clusters/test_pools.py | 404 +++++++++--------- .../api_resources/cloud/k8s/test_clusters.py | 392 ++++++++--------- tests/api_resources/cloud/k8s/test_flavors.py | 42 +- .../pools/test_health_monitors.py | 2 + .../cloud/load_balancers/test_listeners.py | 2 + .../cloud/load_balancers/test_pools.py | 6 + tests/api_resources/cloud/test_k8s.py | 24 +- .../cloud/test_load_balancers.py | 2 + 48 files changed, 1062 insertions(+), 633 deletions(-) diff --git a/.stats.yml b/.stats.yml index f736874a..50d188ab 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-58d9afa7f8342ead022bd8fa12bb8abbeb9c0fb1e16f052ee6c4a59fae373e27.yml -openapi_spec_hash: 2ae4db03cfc907be71d44288503838d7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5947c2e29792fa00fc78ad6dacb85c520bdd85493213508f94f49034fcaaa1e2.yml +openapi_spec_hash: cf83d06fde270d3e532479a2be889cb9 config_hash: 8d4711ed72633b7443249124a49781da diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index 52ab2f78..ca2c3529 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -111,6 +111,10 @@ def create( Create k8s cluster Args: + project_id: Project ID + + region_id: Region ID + keypair: The keypair of the cluster name: The name of the cluster @@ -269,6 +273,12 @@ def update( Update k8s cluster Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + add_ons: Cluster add-ons configuration authentication: Authentication settings @@ -386,6 +396,10 @@ def list( List k8s clusters Args: + project_id: Project ID + + region_id: Region ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -424,6 +438,12 @@ def delete( Delete k8s cluster Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + volumes: Comma separated list of volume IDs to be deleted with the cluster extra_headers: Send extra headers @@ -469,6 +489,12 @@ def get( Get k8s cluster Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -508,6 +534,12 @@ def get_certificate( Get k8s cluster CA certificate Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -547,6 +579,12 @@ def get_kubeconfig( Get k8s cluster kubeconfig Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -586,6 +624,12 @@ def list_versions_for_upgrade( List available k8s cluster versions for upgrade Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -626,6 +670,12 @@ def upgrade( Upgrade k8s cluster Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + version: Target k8s cluster version extra_headers: Send extra headers @@ -714,6 +764,10 @@ async def create( Create k8s cluster Args: + project_id: Project ID + + region_id: Region ID + keypair: The keypair of the cluster name: The name of the cluster @@ -872,6 +926,12 @@ async def update( Update k8s cluster Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + add_ons: Cluster add-ons configuration authentication: Authentication settings @@ -989,6 +1049,10 @@ async def list( List k8s clusters Args: + project_id: Project ID + + region_id: Region ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1027,6 +1091,12 @@ async def delete( Delete k8s cluster Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + volumes: Comma separated list of volume IDs to be deleted with the cluster extra_headers: Send extra headers @@ -1072,6 +1142,12 @@ async def get( Get k8s cluster Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1111,6 +1187,12 @@ async def get_certificate( Get k8s cluster CA certificate Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1150,6 +1232,12 @@ async def get_kubeconfig( Get k8s cluster kubeconfig Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1189,6 +1277,12 @@ async def list_versions_for_upgrade( List available k8s cluster versions for upgrade Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1229,6 +1323,12 @@ async def upgrade( Upgrade k8s cluster Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + version: Target k8s cluster version extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/k8s/clusters/nodes.py b/src/gcore/resources/cloud/k8s/clusters/nodes.py index 4518d8b9..482ece84 100644 --- a/src/gcore/resources/cloud/k8s/clusters/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/nodes.py @@ -59,6 +59,12 @@ def list( List k8s cluster nodes Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + with_ddos: Include DDoS profile information if set to true. Default is false. extra_headers: Send extra headers @@ -106,6 +112,14 @@ def delete( pool size. Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + instance_id: Instance ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -170,6 +184,12 @@ async def list( List k8s cluster nodes Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + with_ddos: Include DDoS profile information if set to true. Default is false. extra_headers: Send extra headers @@ -217,6 +237,14 @@ async def delete( pool size. Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + instance_id: Instance ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py index 797c0e6e..5d360e78 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py @@ -60,6 +60,14 @@ def list( List k8s cluster pool nodes Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + pool_name: Pool name + with_ddos: Include DDoS profile information if set to true. Default is false. extra_headers: Send extra headers @@ -110,6 +118,16 @@ def delete( pool size. Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + pool_name: Pool name + + instance_id: Instance ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -177,6 +195,14 @@ async def list( List k8s cluster pool nodes Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + pool_name: Pool name + with_ddos: Include DDoS profile information if set to true. Default is false. extra_headers: Send extra headers @@ -227,6 +253,16 @@ async def delete( pool size. Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + pool_name: Pool name + + instance_id: Instance ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 7de8cf65..d23019c4 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -95,6 +95,12 @@ def create( Create k8s cluster pool Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + flavor_id: Flavor ID min_node_count: Minimum node count @@ -185,6 +191,14 @@ def update( Update k8s cluster pool Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + pool_name: Pool name + auto_healing_enabled: Enable/disable auto healing labels: Labels applied to the cluster pool @@ -249,6 +263,12 @@ def list( List k8s cluster pools Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -289,6 +309,14 @@ def delete( Delete k8s cluster pool Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + pool_name: Pool name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -408,6 +436,14 @@ def get( Get k8s cluster pool Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + pool_name: Pool name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -451,6 +487,14 @@ def resize( Resize k8s cluster pool Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + pool_name: Pool name + node_count: Target node count extra_headers: Send extra headers @@ -534,6 +578,12 @@ async def create( Create k8s cluster pool Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + flavor_id: Flavor ID min_node_count: Minimum node count @@ -624,6 +674,14 @@ async def update( Update k8s cluster pool Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + pool_name: Pool name + auto_healing_enabled: Enable/disable auto healing labels: Labels applied to the cluster pool @@ -688,6 +746,12 @@ async def list( List k8s cluster pools Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -728,6 +792,14 @@ async def delete( Delete k8s cluster pool Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + pool_name: Pool name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -847,6 +919,14 @@ async def get( Get k8s cluster pool Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + pool_name: Pool name + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -890,6 +970,14 @@ async def resize( Resize k8s cluster pool Args: + project_id: Project ID + + region_id: Region ID + + cluster_name: Cluster name + + pool_name: Pool name + node_count: Target node count extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/k8s/flavors.py b/src/gcore/resources/cloud/k8s/flavors.py index 0823633e..36f4fc54 100644 --- a/src/gcore/resources/cloud/k8s/flavors.py +++ b/src/gcore/resources/cloud/k8s/flavors.py @@ -47,6 +47,7 @@ def list( project_id: int | None = None, region_id: int | None = None, exclude_gpu: bool | Omit = omit, + include_capacity: bool | Omit = omit, include_prices: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -62,7 +63,13 @@ def list( price values as 0. If you get Pricing Error contact the support Args: - exclude_gpu: Set to false to include GPU flavors. Default is True. + project_id: Project ID + + region_id: Region ID + + exclude_gpu: Set to true to exclude GPU flavors. Default is false. + + include_capacity: Set to true to include flavor capacity. Default is False. include_prices: Set to true to include flavor prices. Default is False. @@ -88,6 +95,7 @@ def list( query=maybe_transform( { "exclude_gpu": exclude_gpu, + "include_capacity": include_capacity, "include_prices": include_prices, }, flavor_list_params.FlavorListParams, @@ -123,6 +131,7 @@ async def list( project_id: int | None = None, region_id: int | None = None, exclude_gpu: bool | Omit = omit, + include_capacity: bool | Omit = omit, include_prices: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -138,7 +147,13 @@ async def list( price values as 0. If you get Pricing Error contact the support Args: - exclude_gpu: Set to false to include GPU flavors. Default is True. + project_id: Project ID + + region_id: Region ID + + exclude_gpu: Set to true to exclude GPU flavors. Default is false. + + include_capacity: Set to true to include flavor capacity. Default is False. include_prices: Set to true to include flavor prices. Default is False. @@ -164,6 +179,7 @@ async def list( query=await async_maybe_transform( { "exclude_gpu": exclude_gpu, + "include_capacity": include_capacity, "include_prices": include_prices, }, flavor_list_params.FlavorListParams, diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index e1dabed0..7a31e244 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -79,6 +79,10 @@ def list_versions( List available k8s cluster versions for creation Args: + project_id: Project ID + + region_id: Region ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -144,6 +148,10 @@ async def list_versions( List available k8s cluster versions for creation Args: + project_id: Project ID + + region_id: Region ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 0b620952..491860bc 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -166,6 +166,7 @@ def update( *, project_id: int | None = None, region_id: int | None = None, + admin_state_up: bool | Omit = omit, allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, connection_limit: int | Omit = omit, name: str | Omit = omit, @@ -192,6 +193,10 @@ def update( listener_id: Listener ID + admin_state_up: Administrative state of the resource. When set to true, the resource is enabled + and operational. When set to false, the resource is disabled and will not + process traffic. Defaults to true. + allowed_cidrs: Network CIDRs from which service will be accessible connection_limit: Limit of simultaneous connections. If -1 is provided, it is translated to the @@ -233,6 +238,7 @@ def update( f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=maybe_transform( { + "admin_state_up": admin_state_up, "allowed_cidrs": allowed_cidrs, "connection_limit": connection_limit, "name": name, @@ -547,6 +553,7 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, + admin_state_up: bool | Omit = omit, allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, connection_limit: int | Omit = omit, name: str | Omit = omit, @@ -573,6 +580,10 @@ async def update( listener_id: Listener ID + admin_state_up: Administrative state of the resource. When set to true, the resource is enabled + and operational. When set to false, the resource is disabled and will not + process traffic. Defaults to true. + allowed_cidrs: Network CIDRs from which service will be accessible connection_limit: Limit of simultaneous connections. If -1 is provided, it is translated to the @@ -614,6 +625,7 @@ async def update( f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=await async_maybe_transform( { + "admin_state_up": admin_state_up, "allowed_cidrs": allowed_cidrs, "connection_limit": connection_limit, "name": name, diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index cc1baa93..33f56bcc 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -56,6 +56,7 @@ def create( max_retries: int, api_timeout: int, type: LbHealthMonitorType, + admin_state_up: bool | Omit = omit, expected_codes: Optional[str] | Omit = omit, http_method: Optional[HTTPMethod] | Omit = omit, max_retries_down: int | Omit = omit, @@ -88,6 +89,10 @@ def create( type: Health monitor type. Once health monitor is created, cannot be changed. + admin_state_up: Administrative state of the resource. When set to true, the resource is enabled + and operational. When set to false, the resource is disabled and will not + process traffic. Defaults to true. + expected_codes: Expected HTTP response codes. Can be a single code or a range of codes. Can only be used together with `HTTP` or `HTTPS` health monitor type. For example, 200,202,300-302,401,403,404,500-504. If not specified, the default is 200. @@ -122,6 +127,7 @@ def create( "max_retries": max_retries, "api_timeout": api_timeout, "type": type, + "admin_state_up": admin_state_up, "expected_codes": expected_codes, "http_method": http_method, "max_retries_down": max_retries_down, @@ -215,6 +221,7 @@ async def create( max_retries: int, api_timeout: int, type: LbHealthMonitorType, + admin_state_up: bool | Omit = omit, expected_codes: Optional[str] | Omit = omit, http_method: Optional[HTTPMethod] | Omit = omit, max_retries_down: int | Omit = omit, @@ -247,6 +254,10 @@ async def create( type: Health monitor type. Once health monitor is created, cannot be changed. + admin_state_up: Administrative state of the resource. When set to true, the resource is enabled + and operational. When set to false, the resource is disabled and will not + process traffic. Defaults to true. + expected_codes: Expected HTTP response codes. Can be a single code or a range of codes. Can only be used together with `HTTP` or `HTTPS` health monitor type. For example, 200,202,300-302,401,403,404,500-504. If not specified, the default is 200. @@ -281,6 +292,7 @@ async def create( "max_retries": max_retries, "api_timeout": api_timeout, "type": type, + "admin_state_up": admin_state_up, "expected_codes": expected_codes, "http_method": http_method, "max_retries_down": max_retries_down, diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 2e475708..d28d22ef 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -81,7 +81,7 @@ def create( admin_state_up: Administrative state of the resource. When set to true, the resource is enabled and operational. When set to false, the resource is disabled and will not - process traffic. When null is passed, the value is skipped and defaults to true. + process traffic. Defaults to true. backup: Set to true if the member is a backup member, to which traffic will be sent exclusively when all non-backup members will be unreachable. It allows to @@ -261,7 +261,7 @@ async def create( admin_state_up: Administrative state of the resource. When set to true, the resource is enabled and operational. When set to false, the resource is disabled and will not - process traffic. When null is passed, the value is skipped and defaults to true. + process traffic. Defaults to true. backup: Set to true if the member is a backup member, to which traffic will be sent exclusively when all non-backup members will be unreachable. It allows to diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index a20382b8..18af7de2 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -180,6 +180,7 @@ def update( *, project_id: int | None = None, region_id: int | None = None, + admin_state_up: bool | Omit = omit, ca_secret_id: Optional[str] | Omit = omit, crl_secret_id: Optional[str] | Omit = omit, healthmonitor: Optional[pool_update_params.Healthmonitor] | Omit = omit, @@ -226,6 +227,10 @@ def update( pool_id: Pool ID + admin_state_up: Administrative state of the resource. When set to true, the resource is enabled + and operational. When set to false, the resource is disabled and will not + process traffic. Defaults to true. + ca_secret_id: Secret ID of CA certificate bundle crl_secret_id: Secret ID of CA revocation list file @@ -270,6 +275,7 @@ def update( f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=maybe_transform( { + "admin_state_up": admin_state_up, "ca_secret_id": ca_secret_id, "crl_secret_id": crl_secret_id, "healthmonitor": healthmonitor, @@ -578,6 +584,7 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, + admin_state_up: bool | Omit = omit, ca_secret_id: Optional[str] | Omit = omit, crl_secret_id: Optional[str] | Omit = omit, healthmonitor: Optional[pool_update_params.Healthmonitor] | Omit = omit, @@ -624,6 +631,10 @@ async def update( pool_id: Pool ID + admin_state_up: Administrative state of the resource. When set to true, the resource is enabled + and operational. When set to false, the resource is disabled and will not + process traffic. Defaults to true. + ca_secret_id: Secret ID of CA certificate bundle crl_secret_id: Secret ID of CA revocation list file @@ -668,6 +679,7 @@ async def update( f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=await async_maybe_transform( { + "admin_state_up": admin_state_up, "ca_secret_id": ca_secret_id, "crl_secret_id": crl_secret_id, "healthmonitor": healthmonitor, diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 6741bc40..36292a9d 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -126,7 +126,8 @@ def list( '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_l7rule', - 'rebuild_bm', 'rebuild_gpu_baremetal_node', 'remove_from_server_group', + 'rebuild_bm', 'rebuild_gpu_baremetal_cluster', 'rebuild_gpu_baremetal_node', + 'rebuild_gpu_baremetal_server', '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', 'soft_reboot_gpu_virtual_server', @@ -136,9 +137,10 @@ def list( 'sync_private_flavors', 'update_ddos_profile', 'update_floating_ip', 'update_inference_application', 'update_inference_instance', 'update_k8s_cluster_v2', 'update_l7policy', 'update_lbmetadata', - 'update_port_allowed_address_pairs', 'update_router', 'update_security_group', - 'update_sfs', 'update_tags_gpu_virtual_cluster', 'upgrade_k8s_cluster_v2', - 'upscale_ai_cluster_gpu', 'upscale_gpu_virtual_cluster'] + 'update_loadbalancer', 'update_port_allowed_address_pairs', 'update_router', + 'update_security_group', 'update_sfs', 'update_tags_gpu_virtual_cluster', + 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu', + 'upscale_gpu_virtual_cluster'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` @@ -397,7 +399,8 @@ def list( '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_l7rule', - 'rebuild_bm', 'rebuild_gpu_baremetal_node', 'remove_from_server_group', + 'rebuild_bm', 'rebuild_gpu_baremetal_cluster', 'rebuild_gpu_baremetal_node', + 'rebuild_gpu_baremetal_server', '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', 'soft_reboot_gpu_virtual_server', @@ -407,9 +410,10 @@ def list( 'sync_private_flavors', 'update_ddos_profile', 'update_floating_ip', 'update_inference_application', 'update_inference_instance', 'update_k8s_cluster_v2', 'update_l7policy', 'update_lbmetadata', - 'update_port_allowed_address_pairs', 'update_router', 'update_security_group', - 'update_sfs', 'update_tags_gpu_virtual_cluster', 'upgrade_k8s_cluster_v2', - 'upscale_ai_cluster_gpu', 'upscale_gpu_virtual_cluster'] + 'update_loadbalancer', 'update_port_allowed_address_pairs', 'update_router', + 'update_security_group', 'update_sfs', 'update_tags_gpu_virtual_cluster', + 'upgrade_k8s_cluster_v2', 'upscale_ai_cluster_gpu', + 'upscale_gpu_virtual_cluster'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` diff --git a/src/gcore/types/cloud/health_monitor.py b/src/gcore/types/cloud/health_monitor.py index 501c3782..44b8ab67 100644 --- a/src/gcore/types/cloud/health_monitor.py +++ b/src/gcore/types/cloud/health_monitor.py @@ -19,8 +19,7 @@ class HealthMonitor(BaseModel): """Administrative state of the resource. When set to true, the resource is enabled and operational. When set to false, - the resource is disabled and will not process traffic. When null is passed, the - value is skipped and defaults to true. + the resource is disabled and will not process traffic. Defaults to true. """ delay: int diff --git a/src/gcore/types/cloud/k8s/cluster_create_params.py b/src/gcore/types/cloud/k8s/cluster_create_params.py index 8f97757c..6888e441 100644 --- a/src/gcore/types/cloud/k8s/cluster_create_params.py +++ b/src/gcore/types/cloud/k8s/cluster_create_params.py @@ -27,8 +27,10 @@ class ClusterCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" keypair: Required[str] """The keypair of the cluster""" @@ -211,6 +213,8 @@ class AddOnsSlurm(TypedDict, total=False): Each Slurm worker node will be backed by a Pod scheduled on one of cluster's GPU nodes. + + Note: Downscaling (reducing worker count) is not supported. """ diff --git a/src/gcore/types/cloud/k8s/cluster_delete_params.py b/src/gcore/types/cloud/k8s/cluster_delete_params.py index 49b5e580..e1b433ea 100644 --- a/src/gcore/types/cloud/k8s/cluster_delete_params.py +++ b/src/gcore/types/cloud/k8s/cluster_delete_params.py @@ -9,8 +9,10 @@ class ClusterDeleteParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" volumes: str """Comma separated list of volume IDs to be deleted with the cluster""" diff --git a/src/gcore/types/cloud/k8s/cluster_update_params.py b/src/gcore/types/cloud/k8s/cluster_update_params.py index 4216b832..911a71e8 100644 --- a/src/gcore/types/cloud/k8s/cluster_update_params.py +++ b/src/gcore/types/cloud/k8s/cluster_update_params.py @@ -26,8 +26,10 @@ class ClusterUpdateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" add_ons: AddOns """Cluster add-ons configuration""" @@ -131,6 +133,8 @@ class AddOnsSlurmK8SClusterSlurmAddonEnableV2Serializer(TypedDict, total=False): Each Slurm worker node will be backed by a Pod scheduled on one of cluster's GPU nodes. + + Note: Downscaling (reducing worker count) is not supported. """ diff --git a/src/gcore/types/cloud/k8s/cluster_upgrade_params.py b/src/gcore/types/cloud/k8s/cluster_upgrade_params.py index 5301fc15..dd92d0ac 100644 --- a/src/gcore/types/cloud/k8s/cluster_upgrade_params.py +++ b/src/gcore/types/cloud/k8s/cluster_upgrade_params.py @@ -9,8 +9,10 @@ class ClusterUpgradeParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" version: Required[str] """Target k8s cluster version""" diff --git a/src/gcore/types/cloud/k8s/clusters/node_list_params.py b/src/gcore/types/cloud/k8s/clusters/node_list_params.py index 027c6cf4..390c627e 100644 --- a/src/gcore/types/cloud/k8s/clusters/node_list_params.py +++ b/src/gcore/types/cloud/k8s/clusters/node_list_params.py @@ -9,8 +9,10 @@ class NodeListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" with_ddos: bool """Include DDoS profile information if set to true. Default is false.""" diff --git a/src/gcore/types/cloud/k8s/clusters/pool_create_params.py b/src/gcore/types/cloud/k8s/clusters/pool_create_params.py index f7b626a9..c7fa5d12 100644 --- a/src/gcore/types/cloud/k8s/clusters/pool_create_params.py +++ b/src/gcore/types/cloud/k8s/clusters/pool_create_params.py @@ -10,8 +10,10 @@ class PoolCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" flavor_id: Required[str] """Flavor ID""" diff --git a/src/gcore/types/cloud/k8s/clusters/pool_resize_params.py b/src/gcore/types/cloud/k8s/clusters/pool_resize_params.py index 60450f3e..356f779d 100644 --- a/src/gcore/types/cloud/k8s/clusters/pool_resize_params.py +++ b/src/gcore/types/cloud/k8s/clusters/pool_resize_params.py @@ -9,10 +9,13 @@ class PoolResizeParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" cluster_name: Required[str] + """Cluster name""" node_count: Required[int] """Target node count""" diff --git a/src/gcore/types/cloud/k8s/clusters/pool_update_params.py b/src/gcore/types/cloud/k8s/clusters/pool_update_params.py index 16a46ed7..eb7c4b71 100644 --- a/src/gcore/types/cloud/k8s/clusters/pool_update_params.py +++ b/src/gcore/types/cloud/k8s/clusters/pool_update_params.py @@ -10,10 +10,13 @@ class PoolUpdateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" cluster_name: Required[str] + """Cluster name""" auto_healing_enabled: Optional[bool] """Enable/disable auto healing""" diff --git a/src/gcore/types/cloud/k8s/clusters/pools/node_list_params.py b/src/gcore/types/cloud/k8s/clusters/pools/node_list_params.py index 9a31c51b..fd6f0bb2 100644 --- a/src/gcore/types/cloud/k8s/clusters/pools/node_list_params.py +++ b/src/gcore/types/cloud/k8s/clusters/pools/node_list_params.py @@ -9,10 +9,13 @@ class NodeListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" cluster_name: Required[str] + """Cluster name""" with_ddos: bool """Include DDoS profile information if set to true. Default is false.""" diff --git a/src/gcore/types/cloud/k8s/flavor_list_params.py b/src/gcore/types/cloud/k8s/flavor_list_params.py index 26890db9..10232583 100644 --- a/src/gcore/types/cloud/k8s/flavor_list_params.py +++ b/src/gcore/types/cloud/k8s/flavor_list_params.py @@ -9,11 +9,16 @@ class FlavorListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" exclude_gpu: bool - """Set to false to include GPU flavors. Default is True.""" + """Set to true to exclude GPU flavors. Default is false.""" + + include_capacity: bool + """Set to true to include flavor capacity. Default is False.""" include_prices: bool """Set to true to include flavor prices. Default is False.""" diff --git a/src/gcore/types/cloud/k8s/k8s_cluster.py b/src/gcore/types/cloud/k8s/k8s_cluster.py index c219d2fa..283626ba 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster.py @@ -48,6 +48,8 @@ class AddOnsSlurm(BaseModel): Each Slurm worker node is backed by a Pod scheduled on one of cluster's GPU nodes. + + Note: Downscaling (reducing worker count) is not supported. """ diff --git a/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py b/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py index 717dddc5..6ee2cccd 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional from datetime import datetime from ...._models import BaseModel @@ -21,11 +20,11 @@ class K8SClusterKubeconfig(BaseModel): config: str """Cluster kubeconfig""" - host: str - """Cluster host""" - - created_at: Optional[datetime] = None + created_at: datetime """Kubeconfig creation date""" - expires_at: Optional[datetime] = None + expires_at: datetime """Kubeconfig expiration date""" + + host: str + """Cluster host""" diff --git a/src/gcore/types/cloud/load_balancer.py b/src/gcore/types/cloud/load_balancer.py index 1763aa95..ebd56ccd 100644 --- a/src/gcore/types/cloud/load_balancer.py +++ b/src/gcore/types/cloud/load_balancer.py @@ -62,6 +62,13 @@ class LoadBalancer(BaseModel): id: str """Load balancer ID""" + admin_state_up: bool + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. Defaults to true. + """ + created_at: datetime """Datetime when the load balancer was created""" diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 49939fac..cf4eb547 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -154,6 +154,13 @@ class ListenerPoolHealthmonitor(TypedDict, total=False): type: Required[LbHealthMonitorType] """Health monitor type. Once health monitor is created, cannot be changed.""" + admin_state_up: bool + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. Defaults to true. + """ + expected_codes: Optional[str] """Expected HTTP response codes. @@ -190,8 +197,7 @@ class ListenerPoolMember(TypedDict, total=False): """Administrative state of the resource. When set to true, the resource is enabled and operational. When set to false, - the resource is disabled and will not process traffic. When null is passed, the - value is skipped and defaults to true. + the resource is disabled and will not process traffic. Defaults to true. """ backup: bool diff --git a/src/gcore/types/cloud/load_balancer_listener_detail.py b/src/gcore/types/cloud/load_balancer_listener_detail.py index c04b3d43..c54675d9 100644 --- a/src/gcore/types/cloud/load_balancer_listener_detail.py +++ b/src/gcore/types/cloud/load_balancer_listener_detail.py @@ -23,6 +23,13 @@ class LoadBalancerListenerDetail(BaseModel): id: str """Load balancer listener ID""" + admin_state_up: bool + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. Defaults to true. + """ + allowed_cidrs: Optional[List[str]] = None """Network CIDRs from which service will be accessible""" diff --git a/src/gcore/types/cloud/load_balancer_pool.py b/src/gcore/types/cloud/load_balancer_pool.py index 9b7267b2..3e67e0a0 100644 --- a/src/gcore/types/cloud/load_balancer_pool.py +++ b/src/gcore/types/cloud/load_balancer_pool.py @@ -28,6 +28,13 @@ class LoadBalancerPool(BaseModel): id: str """Pool ID""" + admin_state_up: bool + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. Defaults to true. + """ + ca_secret_id: Optional[str] = None """Secret ID of CA certificate bundle""" diff --git a/src/gcore/types/cloud/load_balancer_pool_list.py b/src/gcore/types/cloud/load_balancer_pool_list.py index d846c6ca..08f1422a 100644 --- a/src/gcore/types/cloud/load_balancer_pool_list.py +++ b/src/gcore/types/cloud/load_balancer_pool_list.py @@ -44,6 +44,13 @@ class Result(BaseModel): id: str """Pool ID""" + admin_state_up: bool + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. Defaults to true. + """ + ca_secret_id: Optional[str] = None """Secret ID of CA certificate bundle""" diff --git a/src/gcore/types/cloud/load_balancers/listener_update_params.py b/src/gcore/types/cloud/load_balancers/listener_update_params.py index 002bb912..e537da9b 100644 --- a/src/gcore/types/cloud/load_balancers/listener_update_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_update_params.py @@ -17,6 +17,13 @@ class ListenerUpdateParams(TypedDict, total=False): region_id: int """Region ID""" + admin_state_up: bool + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. Defaults to true. + """ + allowed_cidrs: Optional[SequenceNotStr[str]] """Network CIDRs from which service will be accessible""" 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 81987648..2feef950 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -82,6 +82,13 @@ class Healthmonitor(TypedDict, total=False): type: Required[LbHealthMonitorType] """Health monitor type. Once health monitor is created, cannot be changed.""" + admin_state_up: bool + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. Defaults to true. + """ + expected_codes: Optional[str] """Expected HTTP response codes. @@ -118,8 +125,7 @@ class Member(TypedDict, total=False): """Administrative state of the resource. When set to true, the resource is enabled and operational. When set to false, - the resource is disabled and will not process traffic. When null is passed, the - value is skipped and defaults to true. + the resource is disabled and will not process traffic. Defaults to true. """ backup: bool 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 b5a32f86..e18d418e 100644 --- a/src/gcore/types/cloud/load_balancers/pool_update_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_update_params.py @@ -21,6 +21,13 @@ class PoolUpdateParams(TypedDict, total=False): region_id: int """Region ID""" + admin_state_up: bool + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. Defaults to true. + """ + ca_secret_id: Optional[str] """Secret ID of CA certificate bundle""" @@ -77,6 +84,13 @@ class Healthmonitor(TypedDict, total=False): timeout: Required[int] """The maximum time to connect. Must be less than the delay value""" + admin_state_up: bool + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. Defaults to true. + """ + expected_codes: Optional[str] """Expected HTTP response codes. @@ -116,8 +130,7 @@ class Member(TypedDict, total=False): """Administrative state of the resource. When set to true, the resource is enabled and operational. When set to false, - the resource is disabled and will not process traffic. When null is passed, the - value is skipped and defaults to true. + the resource is disabled and will not process traffic. Defaults to true. """ backup: bool diff --git a/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py b/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py index d8de1a60..a1cabcbe 100644 --- a/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py @@ -31,6 +31,13 @@ class HealthMonitorCreateParams(TypedDict, total=False): type: Required[LbHealthMonitorType] """Health monitor type. Once health monitor is created, cannot be changed.""" + admin_state_up: bool + """Administrative state of the resource. + + When set to true, the resource is enabled and operational. When set to false, + the resource is disabled and will not process traffic. Defaults to true. + """ + expected_codes: Optional[str] """Expected HTTP response codes. diff --git a/src/gcore/types/cloud/load_balancers/pools/member_create_params.py b/src/gcore/types/cloud/load_balancers/pools/member_create_params.py index ceab4077..b05d79d6 100644 --- a/src/gcore/types/cloud/load_balancers/pools/member_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/member_create_params.py @@ -25,8 +25,7 @@ class MemberCreateParams(TypedDict, total=False): """Administrative state of the resource. When set to true, the resource is enabled and operational. When set to false, - the resource is disabled and will not process traffic. When null is passed, the - value is skipped and defaults to true. + the resource is disabled and will not process traffic. Defaults to true. """ backup: bool diff --git a/src/gcore/types/cloud/member.py b/src/gcore/types/cloud/member.py index 98acfa1e..c9e2fc0d 100644 --- a/src/gcore/types/cloud/member.py +++ b/src/gcore/types/cloud/member.py @@ -20,8 +20,7 @@ class Member(BaseModel): """Administrative state of the resource. When set to true, the resource is enabled and operational. When set to false, - the resource is disabled and will not process traffic. When null is passed, the - value is skipped and defaults to true. + the resource is disabled and will not process traffic. Defaults to true. """ backup: bool diff --git a/src/gcore/types/cloud/task.py b/src/gcore/types/cloud/task.py index 7eae7f01..3aea7a7a 100644 --- a/src/gcore/types/cloud/task.py +++ b/src/gcore/types/cloud/task.py @@ -148,8 +148,10 @@ class Task(BaseModel): detailed_state: Optional[ Literal[ "CLUSTER_CLEAN_UP", + "CLUSTER_REBUILD", "CLUSTER_RESIZE", "CLUSTER_RESUME", + "CLUSTER_SERVER_REBUILD", "CLUSTER_SUSPEND", "ERROR", "FINISHED", diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index 23658f26..9915c84e 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -89,7 +89,8 @@ class TaskListParams(TypedDict, total=False): '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_l7rule', - 'rebuild_bm', 'rebuild_gpu_baremetal_node', 'remove_from_server_group', + 'rebuild_bm', 'rebuild_gpu_baremetal_cluster', 'rebuild_gpu_baremetal_node', + 'rebuild_gpu_baremetal_server', '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', 'soft_reboot_gpu_virtual_server', @@ -99,9 +100,10 @@ class TaskListParams(TypedDict, total=False): 'sync_private_flavors', 'update_ddos_profile', 'update_floating_ip', 'update_inference_application', 'update_inference_instance', 'update_k8s_cluster_v2', 'update_l7policy', 'update_lbmetadata', - 'update_port_allowed_address_pairs', 'update_router', 'update_security_group', - 'update_sfs', 'update_tags_gpu_virtual_cluster', 'upgrade_k8s_cluster_v2', - 'upscale_ai_cluster_gpu', 'upscale_gpu_virtual_cluster'] + 'update_loadbalancer', 'update_port_allowed_address_pairs', 'update_router', + 'update_security_group', '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], PropertyInfo(format="iso8601")] diff --git a/tests/api_resources/cloud/k8s/clusters/pools/test_nodes.py b/tests/api_resources/cloud/k8s/clusters/pools/test_nodes.py index 1f283cc8..db1bce7d 100644 --- a/tests/api_resources/cloud/k8s/clusters/pools/test_nodes.py +++ b/tests/api_resources/cloud/k8s/clusters/pools/test_nodes.py @@ -20,31 +20,31 @@ class TestNodes: @parametrize def test_method_list(self, client: Gcore) -> None: node = client.cloud.k8s.clusters.pools.nodes.list( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert_matches_type(InstanceList, node, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: node = client.cloud.k8s.clusters.pools.nodes.list( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", - with_ddos=True, + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", + with_ddos=False, ) assert_matches_type(InstanceList, node, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.pools.nodes.with_raw_response.list( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert response.is_closed is True @@ -55,10 +55,10 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.k8s.clusters.pools.nodes.with_streaming_response.list( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -72,39 +72,39 @@ def test_streaming_response_list(self, client: Gcore) -> None: def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.pools.nodes.with_raw_response.list( - pool_name="pool_name", - project_id=0, - region_id=0, + pool_name="my-pool", + project_id=1, + region_id=7, cluster_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): client.cloud.k8s.clusters.pools.nodes.with_raw_response.list( pool_name="", - project_id=0, - region_id=0, - cluster_name="cluster_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) @parametrize def test_method_delete(self, client: Gcore) -> None: node = client.cloud.k8s.clusters.pools.nodes.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", - pool_name="pool_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", + pool_name="my-pool", ) assert node is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", - pool_name="pool_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", + pool_name="my-pool", ) assert response.is_closed is True @@ -115,11 +115,11 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.k8s.clusters.pools.nodes.with_streaming_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", - pool_name="pool_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", + pool_name="my-pool", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -133,29 +133,29 @@ def test_streaming_response_delete(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 `cluster_name` but received ''"): client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, cluster_name="", - pool_name="pool_name", + pool_name="my-pool", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", pool_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( instance_id="", - project_id=0, - region_id=0, - cluster_name="cluster_name", - pool_name="pool_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", + pool_name="my-pool", ) @@ -167,31 +167,31 @@ class TestAsyncNodes: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: node = await async_client.cloud.k8s.clusters.pools.nodes.list( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert_matches_type(InstanceList, node, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: node = await async_client.cloud.k8s.clusters.pools.nodes.list( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", - with_ddos=True, + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", + with_ddos=False, ) assert_matches_type(InstanceList, node, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.list( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert response.is_closed is True @@ -202,10 +202,10 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.pools.nodes.with_streaming_response.list( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -219,39 +219,39 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.list( - pool_name="pool_name", - project_id=0, - region_id=0, + pool_name="my-pool", + project_id=1, + region_id=7, cluster_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.list( pool_name="", - project_id=0, - region_id=0, - cluster_name="cluster_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: node = await async_client.cloud.k8s.clusters.pools.nodes.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", - pool_name="pool_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", + pool_name="my-pool", ) assert node is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", - pool_name="pool_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", + pool_name="my-pool", ) assert response.is_closed is True @@ -262,11 +262,11 @@ 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.k8s.clusters.pools.nodes.with_streaming_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", - pool_name="pool_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", + pool_name="my-pool", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -280,27 +280,27 @@ async def test_streaming_response_delete(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 `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, cluster_name="", - pool_name="pool_name", + pool_name="my-pool", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", pool_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): await async_client.cloud.k8s.clusters.pools.nodes.with_raw_response.delete( instance_id="", - project_id=0, - region_id=0, - cluster_name="cluster_name", - pool_name="pool_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", + pool_name="my-pool", ) diff --git a/tests/api_resources/cloud/k8s/clusters/test_nodes.py b/tests/api_resources/cloud/k8s/clusters/test_nodes.py index 624fdf56..7e5c41c3 100644 --- a/tests/api_resources/cloud/k8s/clusters/test_nodes.py +++ b/tests/api_resources/cloud/k8s/clusters/test_nodes.py @@ -20,28 +20,28 @@ class TestNodes: @parametrize def test_method_list(self, client: Gcore) -> None: node = client.cloud.k8s.clusters.nodes.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(InstanceList, node, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: node = client.cloud.k8s.clusters.nodes.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, - with_ddos=True, + cluster_name="my-cluster", + project_id=1, + region_id=7, + with_ddos=False, ) assert_matches_type(InstanceList, node, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.nodes.with_raw_response.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -52,9 +52,9 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.k8s.clusters.nodes.with_streaming_response.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -69,27 +69,27 @@ def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.nodes.with_raw_response.list( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_delete(self, client: Gcore) -> None: node = client.cloud.k8s.clusters.nodes.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert node is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.nodes.with_raw_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert response.is_closed is True @@ -100,10 +100,10 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.k8s.clusters.nodes.with_streaming_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -117,18 +117,18 @@ def test_streaming_response_delete(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 `cluster_name` but received ''"): client.cloud.k8s.clusters.nodes.with_raw_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, cluster_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): client.cloud.k8s.clusters.nodes.with_raw_response.delete( instance_id="", - project_id=0, - region_id=0, - cluster_name="cluster_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) @@ -140,28 +140,28 @@ class TestAsyncNodes: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: node = await async_client.cloud.k8s.clusters.nodes.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(InstanceList, node, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: node = await async_client.cloud.k8s.clusters.nodes.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, - with_ddos=True, + cluster_name="my-cluster", + project_id=1, + region_id=7, + with_ddos=False, ) assert_matches_type(InstanceList, node, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.nodes.with_raw_response.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -172,9 +172,9 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.nodes.with_streaming_response.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -189,27 +189,27 @@ async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.nodes.with_raw_response.list( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: node = await async_client.cloud.k8s.clusters.nodes.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert node is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.nodes.with_raw_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert response.is_closed is True @@ -220,10 +220,10 @@ 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.k8s.clusters.nodes.with_streaming_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, - cluster_name="cluster_name", + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -237,16 +237,16 @@ async def test_streaming_response_delete(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 `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.nodes.with_raw_response.delete( - instance_id="instance_id", - project_id=0, - region_id=0, + instance_id="550e8400-e29b-41d4-a716-446655440000", + project_id=1, + region_id=7, cluster_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): await async_client.cloud.k8s.clusters.nodes.with_raw_response.delete( instance_id="", - project_id=0, - region_id=0, - cluster_name="cluster_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) diff --git a/tests/api_resources/cloud/k8s/clusters/test_pools.py b/tests/api_resources/cloud/k8s/clusters/test_pools.py index bc2d028a..b928939a 100644 --- a/tests/api_resources/cloud/k8s/clusters/test_pools.py +++ b/tests/api_resources/cloud/k8s/clusters/test_pools.py @@ -25,9 +25,9 @@ class TestPools: @parametrize def test_method_create(self, client: Gcore) -> None: pool = client.cloud.k8s.clusters.pools.create( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, flavor_id="g1-standard-1-2", min_node_count=3, name="my-pool", @@ -37,9 +37,9 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: pool = client.cloud.k8s.clusters.pools.create( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, flavor_id="g1-standard-1-2", min_node_count=3, name="my-pool", @@ -59,9 +59,9 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.pools.with_raw_response.create( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, flavor_id="g1-standard-1-2", min_node_count=3, name="my-pool", @@ -75,9 +75,9 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.k8s.clusters.pools.with_streaming_response.create( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, flavor_id="g1-standard-1-2", min_node_count=3, name="my-pool", @@ -95,8 +95,8 @@ def test_path_params_create(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.pools.with_raw_response.create( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, flavor_id="g1-standard-1-2", min_node_count=3, name="my-pool", @@ -105,20 +105,20 @@ def test_path_params_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: pool = client.cloud.k8s.clusters.pools.update( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: pool = client.cloud.k8s.clusters.pools.update( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", auto_healing_enabled=True, labels={"my-label": "foo"}, max_node_count=3, @@ -131,10 +131,10 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_update(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.pools.with_raw_response.update( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert response.is_closed is True @@ -145,10 +145,10 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: with client.cloud.k8s.clusters.pools.with_streaming_response.update( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -162,35 +162,35 @@ def test_streaming_response_update(self, client: Gcore) -> None: def test_path_params_update(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.pools.with_raw_response.update( - pool_name="pool_name", - project_id=0, - region_id=0, + pool_name="my-pool", + project_id=1, + region_id=7, cluster_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): client.cloud.k8s.clusters.pools.with_raw_response.update( pool_name="", - project_id=0, - region_id=0, - cluster_name="cluster_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) @parametrize def test_method_list(self, client: Gcore) -> None: pool = client.cloud.k8s.clusters.pools.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(K8SClusterPoolList, pool, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.pools.with_raw_response.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -201,9 +201,9 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.k8s.clusters.pools.with_streaming_response.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -218,27 +218,27 @@ def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.pools.with_raw_response.list( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_delete(self, client: Gcore) -> None: pool = client.cloud.k8s.clusters.pools.delete( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert_matches_type(TaskIDList, pool, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.pools.with_raw_response.delete( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert response.is_closed is True @@ -249,10 +249,10 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.k8s.clusters.pools.with_streaming_response.delete( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -266,18 +266,18 @@ def test_streaming_response_delete(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 `cluster_name` but received ''"): client.cloud.k8s.clusters.pools.with_raw_response.delete( - pool_name="pool_name", - project_id=0, - region_id=0, + pool_name="my-pool", + project_id=1, + region_id=7, cluster_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): client.cloud.k8s.clusters.pools.with_raw_response.delete( pool_name="", - project_id=0, - region_id=0, - cluster_name="cluster_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) @parametrize @@ -335,20 +335,20 @@ def test_streaming_response_check_quota(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: pool = client.cloud.k8s.clusters.pools.get( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.pools.with_raw_response.get( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert response.is_closed is True @@ -359,10 +359,10 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.k8s.clusters.pools.with_streaming_response.get( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -376,27 +376,27 @@ def test_streaming_response_get(self, client: Gcore) -> None: def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.pools.with_raw_response.get( - pool_name="pool_name", - project_id=0, - region_id=0, + pool_name="my-pool", + project_id=1, + region_id=7, cluster_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): client.cloud.k8s.clusters.pools.with_raw_response.get( pool_name="", - project_id=0, - region_id=0, - cluster_name="cluster_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) @parametrize def test_method_resize(self, client: Gcore) -> None: pool = client.cloud.k8s.clusters.pools.resize( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", node_count=2, ) assert_matches_type(TaskIDList, pool, path=["response"]) @@ -404,10 +404,10 @@ def test_method_resize(self, client: Gcore) -> None: @parametrize def test_raw_response_resize(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.pools.with_raw_response.resize( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", node_count=2, ) @@ -419,10 +419,10 @@ def test_raw_response_resize(self, client: Gcore) -> None: @parametrize def test_streaming_response_resize(self, client: Gcore) -> None: with client.cloud.k8s.clusters.pools.with_streaming_response.resize( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", node_count=2, ) as response: assert not response.is_closed @@ -437,9 +437,9 @@ def test_streaming_response_resize(self, client: Gcore) -> None: def test_path_params_resize(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.pools.with_raw_response.resize( - pool_name="pool_name", - project_id=0, - region_id=0, + pool_name="my-pool", + project_id=1, + region_id=7, cluster_name="", node_count=2, ) @@ -447,9 +447,9 @@ def test_path_params_resize(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): client.cloud.k8s.clusters.pools.with_raw_response.resize( pool_name="", - project_id=0, - region_id=0, - cluster_name="cluster_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", node_count=2, ) @@ -462,9 +462,9 @@ class TestAsyncPools: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.k8s.clusters.pools.create( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, flavor_id="g1-standard-1-2", min_node_count=3, name="my-pool", @@ -474,9 +474,9 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.k8s.clusters.pools.create( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, flavor_id="g1-standard-1-2", min_node_count=3, name="my-pool", @@ -496,9 +496,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.pools.with_raw_response.create( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, flavor_id="g1-standard-1-2", min_node_count=3, name="my-pool", @@ -512,9 +512,9 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.pools.with_streaming_response.create( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, flavor_id="g1-standard-1-2", min_node_count=3, name="my-pool", @@ -532,8 +532,8 @@ async def test_path_params_create(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.pools.with_raw_response.create( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, flavor_id="g1-standard-1-2", min_node_count=3, name="my-pool", @@ -542,20 +542,20 @@ async def test_path_params_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.k8s.clusters.pools.update( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.k8s.clusters.pools.update( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", auto_healing_enabled=True, labels={"my-label": "foo"}, max_node_count=3, @@ -568,10 +568,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.pools.with_raw_response.update( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert response.is_closed is True @@ -582,10 +582,10 @@ 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.k8s.clusters.pools.with_streaming_response.update( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -599,35 +599,35 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None async def test_path_params_update(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.pools.with_raw_response.update( - pool_name="pool_name", - project_id=0, - region_id=0, + pool_name="my-pool", + project_id=1, + region_id=7, cluster_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): await async_client.cloud.k8s.clusters.pools.with_raw_response.update( pool_name="", - project_id=0, - region_id=0, - cluster_name="cluster_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.k8s.clusters.pools.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(K8SClusterPoolList, pool, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.pools.with_raw_response.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -638,9 +638,9 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.pools.with_streaming_response.list( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -655,27 +655,27 @@ async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.pools.with_raw_response.list( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.k8s.clusters.pools.delete( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert_matches_type(TaskIDList, pool, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.pools.with_raw_response.delete( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert response.is_closed is True @@ -686,10 +686,10 @@ 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.k8s.clusters.pools.with_streaming_response.delete( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -703,18 +703,18 @@ async def test_streaming_response_delete(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 `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.pools.with_raw_response.delete( - pool_name="pool_name", - project_id=0, - region_id=0, + pool_name="my-pool", + project_id=1, + region_id=7, cluster_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): await async_client.cloud.k8s.clusters.pools.with_raw_response.delete( pool_name="", - project_id=0, - region_id=0, - cluster_name="cluster_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) @parametrize @@ -772,20 +772,20 @@ async def test_streaming_response_check_quota(self, async_client: AsyncGcore) -> @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.k8s.clusters.pools.get( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert_matches_type(K8SClusterPool, pool, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.pools.with_raw_response.get( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) assert response.is_closed is True @@ -796,10 +796,10 @@ 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.k8s.clusters.pools.with_streaming_response.get( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -813,27 +813,27 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.pools.with_raw_response.get( - pool_name="pool_name", - project_id=0, - region_id=0, + pool_name="my-pool", + project_id=1, + region_id=7, cluster_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): await async_client.cloud.k8s.clusters.pools.with_raw_response.get( pool_name="", - project_id=0, - region_id=0, - cluster_name="cluster_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", ) @parametrize async def test_method_resize(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.k8s.clusters.pools.resize( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", node_count=2, ) assert_matches_type(TaskIDList, pool, path=["response"]) @@ -841,10 +841,10 @@ async def test_method_resize(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.pools.with_raw_response.resize( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", node_count=2, ) @@ -856,10 +856,10 @@ async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.pools.with_streaming_response.resize( - pool_name="pool_name", - project_id=0, - region_id=0, - cluster_name="cluster_name", + pool_name="my-pool", + project_id=1, + region_id=7, + cluster_name="my-cluster", node_count=2, ) as response: assert not response.is_closed @@ -874,9 +874,9 @@ async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None async def test_path_params_resize(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.pools.with_raw_response.resize( - pool_name="pool_name", - project_id=0, - region_id=0, + pool_name="my-pool", + project_id=1, + region_id=7, cluster_name="", node_count=2, ) @@ -884,8 +884,8 @@ async def test_path_params_resize(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_name` but received ''"): await async_client.cloud.k8s.clusters.pools.with_raw_response.resize( pool_name="", - project_id=0, - region_id=0, - cluster_name="cluster_name", + project_id=1, + region_id=7, + cluster_name="my-cluster", node_count=2, ) diff --git a/tests/api_resources/cloud/k8s/test_clusters.py b/tests/api_resources/cloud/k8s/test_clusters.py index d9296b23..1fd9c956 100644 --- a/tests/api_resources/cloud/k8s/test_clusters.py +++ b/tests/api_resources/cloud/k8s/test_clusters.py @@ -26,8 +26,8 @@ class TestClusters: @parametrize def test_method_create(self, client: Gcore) -> None: cluster = client.cloud.k8s.clusters.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, keypair="some_keypair", name="string", pools=[ @@ -44,8 +44,8 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: cluster = client.cloud.k8s.clusters.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, keypair="some_keypair", name="string", pools=[ @@ -133,8 +133,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, keypair="some_keypair", name="string", pools=[ @@ -155,8 +155,8 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.k8s.clusters.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, keypair="some_keypair", name="string", pools=[ @@ -179,18 +179,18 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: cluster = client.cloud.k8s.clusters.update( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: cluster = client.cloud.k8s.clusters.update( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, add_ons={ "slurm": { "enabled": True, @@ -250,9 +250,9 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_update(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.with_raw_response.update( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -263,9 +263,9 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: with client.cloud.k8s.clusters.with_streaming_response.update( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -280,23 +280,23 @@ def test_path_params_update(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.with_raw_response.update( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_list(self, client: Gcore) -> None: cluster = client.cloud.k8s.clusters.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(K8SClusterList, cluster, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -307,8 +307,8 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.k8s.clusters.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -321,28 +321,28 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: cluster = client.cloud.k8s.clusters.delete( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_method_delete_with_all_params(self, client: Gcore) -> None: cluster = client.cloud.k8s.clusters.delete( - cluster_name="cluster_name", - project_id=0, - region_id=0, - volumes="volumes", + cluster_name="my-cluster", + project_id=1, + region_id=7, + volumes="550e8400-e29b-41d4-a716-446655440000", ) assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.with_raw_response.delete( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -353,9 +353,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.k8s.clusters.with_streaming_response.delete( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -370,25 +370,25 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.with_raw_response.delete( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_get(self, client: Gcore) -> None: cluster = client.cloud.k8s.clusters.get( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(K8SCluster, cluster, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.with_raw_response.get( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -399,9 +399,9 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.k8s.clusters.with_streaming_response.get( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -416,25 +416,25 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.with_raw_response.get( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_get_certificate(self, client: Gcore) -> None: cluster = client.cloud.k8s.clusters.get_certificate( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(K8SClusterCertificate, cluster, path=["response"]) @parametrize def test_raw_response_get_certificate(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.with_raw_response.get_certificate( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -445,9 +445,9 @@ def test_raw_response_get_certificate(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_certificate(self, client: Gcore) -> None: with client.cloud.k8s.clusters.with_streaming_response.get_certificate( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -462,25 +462,25 @@ def test_path_params_get_certificate(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.with_raw_response.get_certificate( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_get_kubeconfig(self, client: Gcore) -> None: cluster = client.cloud.k8s.clusters.get_kubeconfig( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(K8SClusterKubeconfig, cluster, path=["response"]) @parametrize def test_raw_response_get_kubeconfig(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.with_raw_response.get_kubeconfig( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -491,9 +491,9 @@ def test_raw_response_get_kubeconfig(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_kubeconfig(self, client: Gcore) -> None: with client.cloud.k8s.clusters.with_streaming_response.get_kubeconfig( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -508,25 +508,25 @@ def test_path_params_get_kubeconfig(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.with_raw_response.get_kubeconfig( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_list_versions_for_upgrade(self, client: Gcore) -> None: cluster = client.cloud.k8s.clusters.list_versions_for_upgrade( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) @parametrize def test_raw_response_list_versions_for_upgrade(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.with_raw_response.list_versions_for_upgrade( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -537,9 +537,9 @@ def test_raw_response_list_versions_for_upgrade(self, client: Gcore) -> None: @parametrize def test_streaming_response_list_versions_for_upgrade(self, client: Gcore) -> None: with client.cloud.k8s.clusters.with_streaming_response.list_versions_for_upgrade( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -554,16 +554,16 @@ def test_path_params_list_versions_for_upgrade(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.with_raw_response.list_versions_for_upgrade( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_upgrade(self, client: Gcore) -> None: cluster = client.cloud.k8s.clusters.upgrade( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, version="v1.28.1", ) assert_matches_type(TaskIDList, cluster, path=["response"]) @@ -571,9 +571,9 @@ def test_method_upgrade(self, client: Gcore) -> None: @parametrize def test_raw_response_upgrade(self, client: Gcore) -> None: response = client.cloud.k8s.clusters.with_raw_response.upgrade( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, version="v1.28.1", ) @@ -585,9 +585,9 @@ def test_raw_response_upgrade(self, client: Gcore) -> None: @parametrize def test_streaming_response_upgrade(self, client: Gcore) -> None: with client.cloud.k8s.clusters.with_streaming_response.upgrade( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, version="v1.28.1", ) as response: assert not response.is_closed @@ -603,8 +603,8 @@ def test_path_params_upgrade(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): client.cloud.k8s.clusters.with_raw_response.upgrade( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, version="v1.28.1", ) @@ -617,8 +617,8 @@ class TestAsyncClusters: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: cluster = await async_client.cloud.k8s.clusters.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, keypair="some_keypair", name="string", pools=[ @@ -635,8 +635,8 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: cluster = await async_client.cloud.k8s.clusters.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, keypair="some_keypair", name="string", pools=[ @@ -724,8 +724,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, keypair="some_keypair", name="string", pools=[ @@ -746,8 +746,8 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, keypair="some_keypair", name="string", pools=[ @@ -770,18 +770,18 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: cluster = await async_client.cloud.k8s.clusters.update( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: cluster = await async_client.cloud.k8s.clusters.update( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, add_ons={ "slurm": { "enabled": True, @@ -841,9 +841,9 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.with_raw_response.update( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -854,9 +854,9 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.with_streaming_response.update( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -871,23 +871,23 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.with_raw_response.update( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: cluster = await async_client.cloud.k8s.clusters.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(K8SClusterList, cluster, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -898,8 +898,8 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -912,28 +912,28 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: cluster = await async_client.cloud.k8s.clusters.delete( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: cluster = await async_client.cloud.k8s.clusters.delete( - cluster_name="cluster_name", - project_id=0, - region_id=0, - volumes="volumes", + cluster_name="my-cluster", + project_id=1, + region_id=7, + volumes="550e8400-e29b-41d4-a716-446655440000", ) assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.with_raw_response.delete( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -944,9 +944,9 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.with_streaming_response.delete( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -961,25 +961,25 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.with_raw_response.delete( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: cluster = await async_client.cloud.k8s.clusters.get( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(K8SCluster, cluster, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.with_raw_response.get( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -990,9 +990,9 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.with_streaming_response.get( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1007,25 +1007,25 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.with_raw_response.get( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_get_certificate(self, async_client: AsyncGcore) -> None: cluster = await async_client.cloud.k8s.clusters.get_certificate( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(K8SClusterCertificate, cluster, path=["response"]) @parametrize async def test_raw_response_get_certificate(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.with_raw_response.get_certificate( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -1036,9 +1036,9 @@ async def test_raw_response_get_certificate(self, async_client: AsyncGcore) -> N @parametrize async def test_streaming_response_get_certificate(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.with_streaming_response.get_certificate( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1053,25 +1053,25 @@ async def test_path_params_get_certificate(self, async_client: AsyncGcore) -> No with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.with_raw_response.get_certificate( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_get_kubeconfig(self, async_client: AsyncGcore) -> None: cluster = await async_client.cloud.k8s.clusters.get_kubeconfig( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(K8SClusterKubeconfig, cluster, path=["response"]) @parametrize async def test_raw_response_get_kubeconfig(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.with_raw_response.get_kubeconfig( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -1082,9 +1082,9 @@ async def test_raw_response_get_kubeconfig(self, async_client: AsyncGcore) -> No @parametrize async def test_streaming_response_get_kubeconfig(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.with_streaming_response.get_kubeconfig( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1099,25 +1099,25 @@ async def test_path_params_get_kubeconfig(self, async_client: AsyncGcore) -> Non with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.with_raw_response.get_kubeconfig( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: cluster = await async_client.cloud.k8s.clusters.list_versions_for_upgrade( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) @parametrize async def test_raw_response_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.with_raw_response.list_versions_for_upgrade( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -1128,9 +1128,9 @@ async def test_raw_response_list_versions_for_upgrade(self, async_client: AsyncG @parametrize async def test_streaming_response_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.with_streaming_response.list_versions_for_upgrade( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1145,16 +1145,16 @@ async def test_path_params_list_versions_for_upgrade(self, async_client: AsyncGc with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.with_raw_response.list_versions_for_upgrade( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_upgrade(self, async_client: AsyncGcore) -> None: cluster = await async_client.cloud.k8s.clusters.upgrade( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, version="v1.28.1", ) assert_matches_type(TaskIDList, cluster, path=["response"]) @@ -1162,9 +1162,9 @@ async def test_method_upgrade(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_upgrade(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.clusters.with_raw_response.upgrade( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, version="v1.28.1", ) @@ -1176,9 +1176,9 @@ async def test_raw_response_upgrade(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_upgrade(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.clusters.with_streaming_response.upgrade( - cluster_name="cluster_name", - project_id=0, - region_id=0, + cluster_name="my-cluster", + project_id=1, + region_id=7, version="v1.28.1", ) as response: assert not response.is_closed @@ -1194,7 +1194,7 @@ async def test_path_params_upgrade(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_name` but received ''"): await async_client.cloud.k8s.clusters.with_raw_response.upgrade( cluster_name="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, version="v1.28.1", ) diff --git a/tests/api_resources/cloud/k8s/test_flavors.py b/tests/api_resources/cloud/k8s/test_flavors.py index 4aabd062..898e9a30 100644 --- a/tests/api_resources/cloud/k8s/test_flavors.py +++ b/tests/api_resources/cloud/k8s/test_flavors.py @@ -20,26 +20,27 @@ class TestFlavors: @parametrize def test_method_list(self, client: Gcore) -> None: flavor = client.cloud.k8s.flavors.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: flavor = client.cloud.k8s.flavors.list( - project_id=0, - region_id=0, - exclude_gpu=True, - include_prices=True, + project_id=1, + region_id=7, + exclude_gpu=False, + include_capacity=False, + include_prices=False, ) assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.k8s.flavors.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -50,8 +51,8 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.k8s.flavors.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -70,26 +71,27 @@ class TestAsyncFlavors: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: flavor = await async_client.cloud.k8s.flavors.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: flavor = await async_client.cloud.k8s.flavors.list( - project_id=0, - region_id=0, - exclude_gpu=True, - include_prices=True, + project_id=1, + region_id=7, + exclude_gpu=False, + include_capacity=False, + include_prices=False, ) assert_matches_type(BaremetalFlavorList, flavor, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.flavors.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -100,8 +102,8 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.flavors.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py b/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py index 0fecec7c..71eb353d 100644 --- a/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py +++ b/tests/api_resources/cloud/load_balancers/pools/test_health_monitors.py @@ -40,6 +40,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: max_retries=2, api_timeout=5, type="HTTP", + admin_state_up=True, expected_codes="200,301,302", http_method="CONNECT", max_retries_down=2, @@ -171,6 +172,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> max_retries=2, api_timeout=5, type="HTTP", + admin_state_up=True, expected_codes="200,301,302", http_method="CONNECT", max_retries_down=2, diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index 2e098f0f..98a2a658 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -105,6 +105,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: listener_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, + admin_state_up=True, allowed_cidrs=["10.0.0.0/8"], connection_limit=100000, name="new_listener_name", @@ -409,6 +410,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> listener_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, + admin_state_up=True, allowed_cidrs=["10.0.0.0/8"], connection_limit=100000, name="new_listener_name", diff --git a/tests/api_resources/cloud/load_balancers/test_pools.py b/tests/api_resources/cloud/load_balancers/test_pools.py index 3a381afc..7039089f 100644 --- a/tests/api_resources/cloud/load_balancers/test_pools.py +++ b/tests/api_resources/cloud/load_balancers/test_pools.py @@ -43,6 +43,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "max_retries": 3, "timeout": 5, "type": "HTTP", + "admin_state_up": True, "expected_codes": "200,301,302", "http_method": "GET", "max_retries_down": 3, @@ -134,12 +135,14 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: pool_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, + admin_state_up=True, ca_secret_id="ca_secret_id", crl_secret_id="crl_secret_id", healthmonitor={ "delay": 10, "max_retries": 2, "timeout": 5, + "admin_state_up": True, "expected_codes": "200,301,302", "http_method": "CONNECT", "max_retries_down": 2, @@ -381,6 +384,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "max_retries": 3, "timeout": 5, "type": "HTTP", + "admin_state_up": True, "expected_codes": "200,301,302", "http_method": "GET", "max_retries_down": 3, @@ -472,12 +476,14 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> pool_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, + admin_state_up=True, ca_secret_id="ca_secret_id", crl_secret_id="crl_secret_id", healthmonitor={ "delay": 10, "max_retries": 2, "timeout": 5, + "admin_state_up": True, "expected_codes": "200,301,302", "http_method": "CONNECT", "max_retries_down": 2, diff --git a/tests/api_resources/cloud/test_k8s.py b/tests/api_resources/cloud/test_k8s.py index 98602a71..43c912f3 100644 --- a/tests/api_resources/cloud/test_k8s.py +++ b/tests/api_resources/cloud/test_k8s.py @@ -20,16 +20,16 @@ class TestK8S: @parametrize def test_method_list_versions(self, client: Gcore) -> None: k8s = client.cloud.k8s.list_versions( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) @parametrize def test_raw_response_list_versions(self, client: Gcore) -> None: response = client.cloud.k8s.with_raw_response.list_versions( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -40,8 +40,8 @@ def test_raw_response_list_versions(self, client: Gcore) -> None: @parametrize def test_streaming_response_list_versions(self, client: Gcore) -> None: with client.cloud.k8s.with_streaming_response.list_versions( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -60,16 +60,16 @@ class TestAsyncK8S: @parametrize async def test_method_list_versions(self, async_client: AsyncGcore) -> None: k8s = await async_client.cloud.k8s.list_versions( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) @parametrize async def test_raw_response_list_versions(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.k8s.with_raw_response.list_versions( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -80,8 +80,8 @@ async def test_raw_response_list_versions(self, async_client: AsyncGcore) -> Non @parametrize async def test_streaming_response_list_versions(self, async_client: AsyncGcore) -> None: async with async_client.cloud.k8s.with_streaming_response.list_versions( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index 814fbc75..85bd2997 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -59,6 +59,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "max_retries": 3, "timeout": 5, "type": "HTTP", + "admin_state_up": True, "expected_codes": "200,301,302", "http_method": "GET", "max_retries_down": 3, @@ -525,6 +526,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "max_retries": 3, "timeout": 5, "type": "HTTP", + "admin_state_up": True, "expected_codes": "200,301,302", "http_method": "GET", "max_retries_down": 3, From 5c64bc7153916b81287495a8480bbce337705525 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 2 Feb 2026 14:23:12 +0000 Subject: [PATCH 547/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cdn/logs_uploader/logs_uploader_target.py | 2 ++ src/gcore/types/cdn/logs_uploader/target_create_params.py | 2 ++ src/gcore/types/cdn/logs_uploader/target_replace_params.py | 2 ++ src/gcore/types/cdn/logs_uploader/target_update_params.py | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 50d188ab..15c607aa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5947c2e29792fa00fc78ad6dacb85c520bdd85493213508f94f49034fcaaa1e2.yml -openapi_spec_hash: cf83d06fde270d3e532479a2be889cb9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-47204084ab6a5073f1e8d5c1823e2369c88e816b02a631e43ee1f5176ccd7837.yml +openapi_spec_hash: 640b147a6522c101166230a32f3c34be config_hash: 8d4711ed72633b7443249124a49781da 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 786af310..e5f040a9 100644 --- a/src/gcore/types/cdn/logs_uploader/logs_uploader_target.py +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_target.py @@ -59,6 +59,8 @@ class ConfigUnionMember2(BaseModel): directory: Optional[str] = None + endpoint: Optional[str] = None + region: Optional[str] = None diff --git a/src/gcore/types/cdn/logs_uploader/target_create_params.py b/src/gcore/types/cdn/logs_uploader/target_create_params.py index f8d8e8e9..d48e6374 100644 --- a/src/gcore/types/cdn/logs_uploader/target_create_params.py +++ b/src/gcore/types/cdn/logs_uploader/target_create_params.py @@ -78,6 +78,8 @@ class ConfigS3OssConfig(TypedDict, total=False): directory: Optional[str] + endpoint: Optional[str] + region: Optional[str] diff --git a/src/gcore/types/cdn/logs_uploader/target_replace_params.py b/src/gcore/types/cdn/logs_uploader/target_replace_params.py index 77281c94..2a97435c 100644 --- a/src/gcore/types/cdn/logs_uploader/target_replace_params.py +++ b/src/gcore/types/cdn/logs_uploader/target_replace_params.py @@ -78,6 +78,8 @@ class ConfigS3OssConfig(TypedDict, total=False): directory: Optional[str] + endpoint: Optional[str] + region: Optional[str] diff --git a/src/gcore/types/cdn/logs_uploader/target_update_params.py b/src/gcore/types/cdn/logs_uploader/target_update_params.py index e93ab4d9..34730db0 100644 --- a/src/gcore/types/cdn/logs_uploader/target_update_params.py +++ b/src/gcore/types/cdn/logs_uploader/target_update_params.py @@ -78,6 +78,8 @@ class ConfigS3OssConfig(TypedDict, total=False): directory: Optional[str] + endpoint: Optional[str] + region: Optional[str] From 6dcd759a7967365610a56efd9a66f74cb7097a09 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 07:06:35 +0000 Subject: [PATCH 548/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 15c607aa..b3871a44 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-47204084ab6a5073f1e8d5c1823e2369c88e816b02a631e43ee1f5176ccd7837.yml openapi_spec_hash: 640b147a6522c101166230a32f3c34be -config_hash: 8d4711ed72633b7443249124a49781da +config_hash: 8dbb16a29d92c3261d318b18543cf843 From 670ce509b3c5bad6aa7471c6d37ebf1461d1a3af Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 09:18:37 +0000 Subject: [PATCH 549/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index b3871a44..2372ea5b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-47204084ab6a5073f1e8d5c1823e2369c88e816b02a631e43ee1f5176ccd7837.yml -openapi_spec_hash: 640b147a6522c101166230a32f3c34be +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d6fb1da2d2b7b842a42bb0bb7d1feabfc44d0a2be32ee6dcd3a8b964e799748f.yml +openapi_spec_hash: 4cc2b5fbf445c3578abae59e61e284a7 config_hash: 8dbb16a29d92c3261d318b18543cf843 From 7038b191d4e8e5c89f44fca9ad9a697437164b93 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 19:02:23 +0000 Subject: [PATCH 550/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2372ea5b..db538af3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d6fb1da2d2b7b842a42bb0bb7d1feabfc44d0a2be32ee6dcd3a8b964e799748f.yml -openapi_spec_hash: 4cc2b5fbf445c3578abae59e61e284a7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8eb7ecc40c6f877877db9f74bc9e0838fbe7a95cbf4cf785ad94249f37cff798.yml +openapi_spec_hash: bbde489ef2bf0e85721ab713a3ea9773 config_hash: 8dbb16a29d92c3261d318b18543cf843 From 4e8bdc0e8329d79068e24d05fbb6e52b59ab5b41 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Feb 2026 08:20:38 +0000 Subject: [PATCH 551/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index db538af3..774f3f74 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8eb7ecc40c6f877877db9f74bc9e0838fbe7a95cbf4cf785ad94249f37cff798.yml -openapi_spec_hash: bbde489ef2bf0e85721ab713a3ea9773 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-bbc25e21631016282d98d3b27a1923e27ba5239bc36897b9d7bf04daf8702021.yml +openapi_spec_hash: 0fc41d5da20908358bb671c2b1aa5085 config_hash: 8dbb16a29d92c3261d318b18543cf843 From 1593384dbebf24d5503881f9d012e4d7166d1a5e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 09:04:09 +0000 Subject: [PATCH 552/592] fix(types): correctly define false enum --- src/gcore/resources/cloud/load_balancers/listeners.py | 5 +++-- src/gcore/types/cloud/load_balancer_create_params.py | 2 +- .../types/cloud/load_balancers/listener_create_params.py | 4 ++-- tests/api_resources/cloud/load_balancers/test_listeners.py | 4 ++-- tests/api_resources/cloud/test_load_balancers.py | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 491860bc..6dc71737 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import Iterable, Optional +from typing_extensions import Literal import httpx @@ -66,7 +67,7 @@ def create( connection_limit: int | Omit = omit, default_pool_id: str | Omit = omit, insert_x_forwarded: bool | Omit = omit, - secret_id: str | Omit = omit, + secret_id: Literal[""] | Omit = omit, sni_secret_id: SequenceNotStr[str] | Omit = omit, timeout_client_data: Optional[int] | Omit = omit, timeout_member_connect: Optional[int] | Omit = omit, @@ -453,7 +454,7 @@ async def create( connection_limit: int | Omit = omit, default_pool_id: str | Omit = omit, insert_x_forwarded: bool | Omit = omit, - secret_id: str | Omit = omit, + secret_id: Literal[""] | Omit = omit, sni_secret_id: SequenceNotStr[str] | Omit = omit, timeout_client_data: Optional[int] | Omit = omit, timeout_member_connect: Optional[int] | Omit = omit, diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index cf4eb547..8d56613c 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -344,7 +344,7 @@ class Listener(TypedDict, total=False): pools: Iterable[ListenerPool] """Member pools""" - secret_id: str + secret_id: Literal[""] """ ID of the secret where PKCS12 file is stored for `TERMINATED_HTTPS` or PROMETHEUS listener diff --git a/src/gcore/types/cloud/load_balancers/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py index c688d661..652ba39a 100644 --- a/src/gcore/types/cloud/load_balancers/listener_create_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Iterable, Optional -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict from ...._types import SequenceNotStr from ..lb_listener_protocol import LbListenerProtocol @@ -48,7 +48,7 @@ class ListenerCreateParams(TypedDict, total=False): Only used with HTTP or `TERMINATED_HTTPS` protocols. """ - secret_id: str + secret_id: Literal[""] """ ID of the secret where PKCS12 file is stored for `TERMINATED_HTTPS` or PROMETHEUS listener diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index 98a2a658..81c7a2b2 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -42,7 +42,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: connection_limit=100000, default_pool_id="00000000-0000-4000-8000-000000000000", insert_x_forwarded=False, - secret_id="f2e734d0-fa2b-42c2-ad33-4c6db5101e00", + secret_id="", sni_secret_id=["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], timeout_client_data=50000, timeout_member_connect=50000, @@ -347,7 +347,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> connection_limit=100000, default_pool_id="00000000-0000-4000-8000-000000000000", insert_x_forwarded=False, - secret_id="f2e734d0-fa2b-42c2-ad33-4c6db5101e00", + secret_id="", sni_secret_id=["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], timeout_client_data=50000, timeout_member_connect=50000, diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index 85bd2997..68c9489a 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -101,7 +101,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "timeout_member_data": 0, } ], - "secret_id": "f2e734d0-fa2b-42c2-ad33-4c6db5101e00", + "secret_id": "", "sni_secret_id": ["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], "timeout_client_data": 50000, "timeout_member_connect": 50000, @@ -568,7 +568,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "timeout_member_data": 0, } ], - "secret_id": "f2e734d0-fa2b-42c2-ad33-4c6db5101e00", + "secret_id": "", "sni_secret_id": ["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], "timeout_client_data": 50000, "timeout_member_connect": 50000, From ed94701ccea185edc58a7c2968bdfcb0b829d9b6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 12:22:14 +0000 Subject: [PATCH 553/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/resources/cloud/projects.py | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index 774f3f74..2e6d1b92 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-bbc25e21631016282d98d3b27a1923e27ba5239bc36897b9d7bf04daf8702021.yml -openapi_spec_hash: 0fc41d5da20908358bb671c2b1aa5085 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-dd45c6531c1939efa284df09174910c49e1fffdb513ebff067ab1513c800c8ce.yml +openapi_spec_hash: e4fa90e2edb243ff3400e896b9ea9996 config_hash: 8dbb16a29d92c3261d318b18543cf843 diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 721ad20b..f8c47c0c 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -255,8 +255,7 @@ 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: @@ -510,8 +509,7 @@ 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: From 7add77cdbb65f39be9e46cf070b1ec07f0ef0abd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:21:25 +0000 Subject: [PATCH 554/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 12 +-- src/gcore/resources/fastedge/apps/apps.py | 16 ++-- src/gcore/resources/fastedge/kv_stores.py | 76 ++++++++++++++----- src/gcore/types/fastedge/__init__.py | 3 +- src/gcore/types/fastedge/app.py | 19 ++++- src/gcore/types/fastedge/app_create_params.py | 13 +++- src/gcore/types/fastedge/app_param.py | 13 +++- src/gcore/types/fastedge/app_update_params.py | 13 +++- src/gcore/types/fastedge/client.py | 9 --- src/gcore/types/fastedge/duration_stats.py | 2 +- src/gcore/types/fastedge/kv_store.py | 14 +++- .../types/fastedge/kv_store_create_params.py | 3 + .../fastedge/kv_store_create_response.py | 12 +++ .../types/fastedge/kv_store_get_response.py | 10 --- .../types/fastedge/kv_store_list_params.py | 6 ++ .../types/fastedge/kv_store_list_response.py | 4 +- .../types/fastedge/kv_store_replace_params.py | 3 + src/gcore/types/fastedge/kv_store_short.py | 13 +++- src/gcore/types/fastedge/kv_store_stats.py | 28 ------- .../types/fastedge/template_parameter.py | 2 +- .../fastedge/template_parameter_param.py | 2 +- tests/api_resources/fastedge/test_apps.py | 30 ++------ .../api_resources/fastedge/test_kv_stores.py | 68 ++++++++++++----- 24 files changed, 220 insertions(+), 155 deletions(-) create mode 100644 src/gcore/types/fastedge/kv_store_create_response.py delete mode 100644 src/gcore/types/fastedge/kv_store_get_response.py delete mode 100644 src/gcore/types/fastedge/kv_store_stats.py diff --git a/.stats.yml b/.stats.yml index 2e6d1b92..f814f18c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-dd45c6531c1939efa284df09174910c49e1fffdb513ebff067ab1513c800c8ce.yml -openapi_spec_hash: e4fa90e2edb243ff3400e896b9ea9996 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-24b39742987350e54c3a309a2a9befa3fa5baa2d0eb2ed61511dab58c4ae9ed2.yml +openapi_spec_hash: b59285fd083fd6f39f9670071b09d035 config_hash: 8dbb16a29d92c3261d318b18543cf843 diff --git a/api.md b/api.md index 92044094..cbc93dbc 100644 --- a/api.md +++ b/api.md @@ -1658,21 +1658,15 @@ Methods: Types: ```python -from gcore.types.fastedge import ( - KvStore, - KvStoreShort, - KvStoreStats, - KvStoreListResponse, - KvStoreGetResponse, -) +from gcore.types.fastedge import KvStore, KvStoreShort, KvStoreCreateResponse, KvStoreListResponse ``` Methods: -- client.fastedge.kv_stores.create(\*\*params) -> KvStore +- client.fastedge.kv_stores.create(\*\*params) -> KvStoreCreateResponse - client.fastedge.kv_stores.list(\*\*params) -> KvStoreListResponse - client.fastedge.kv_stores.delete(id) -> None -- client.fastedge.kv_stores.get(id) -> KvStoreGetResponse +- client.fastedge.kv_stores.get(id) -> KvStore - client.fastedge.kv_stores.replace(id, \*\*params) -> KvStore # Streaming diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index 21e9fb4c..c415ced9 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -70,7 +70,7 @@ def create( rsp_headers: Dict[str, str] | Omit = omit, secrets: Dict[str, app_create_params.Secrets] | Omit = omit, status: int | Omit = omit, - stores: Dict[str, int] | Omit = omit, + stores: Dict[str, app_create_params.Stores] | Omit = omit, template: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -108,7 +108,7 @@ def create( 4 - daily call limit exceeded 5 - suspended - stores: KV stores for the app + stores: Application edge stores template: Template ID @@ -157,7 +157,7 @@ def update( rsp_headers: Dict[str, str] | Omit = omit, secrets: Dict[str, app_update_params.Secrets] | Omit = omit, status: int | Omit = omit, - stores: Dict[str, int] | Omit = omit, + stores: Dict[str, app_update_params.Stores] | Omit = omit, template: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -195,7 +195,7 @@ def update( 4 - daily call limit exceeded 5 - suspended - stores: KV stores for the app + stores: Application edge stores template: Template ID @@ -463,7 +463,7 @@ async def create( rsp_headers: Dict[str, str] | Omit = omit, secrets: Dict[str, app_create_params.Secrets] | Omit = omit, status: int | Omit = omit, - stores: Dict[str, int] | Omit = omit, + stores: Dict[str, app_create_params.Stores] | Omit = omit, template: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -501,7 +501,7 @@ async def create( 4 - daily call limit exceeded 5 - suspended - stores: KV stores for the app + stores: Application edge stores template: Template ID @@ -550,7 +550,7 @@ async def update( rsp_headers: Dict[str, str] | Omit = omit, secrets: Dict[str, app_update_params.Secrets] | Omit = omit, status: int | Omit = omit, - stores: Dict[str, int] | Omit = omit, + stores: Dict[str, app_update_params.Stores] | Omit = omit, template: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -588,7 +588,7 @@ async def update( 4 - daily call limit exceeded 5 - suspended - stores: KV stores for the app + stores: Application edge stores template: Template ID diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py index 42193e54..34e59741 100644 --- a/src/gcore/resources/fastedge/kv_stores.py +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -17,8 +17,8 @@ from ..._base_client import make_request_options from ...types.fastedge import kv_store_list_params, kv_store_create_params, kv_store_replace_params from ...types.fastedge.kv_store import KvStore -from ...types.fastedge.kv_store_get_response import KvStoreGetResponse from ...types.fastedge.kv_store_list_response import KvStoreListResponse +from ...types.fastedge.kv_store_create_response import KvStoreCreateResponse __all__ = ["KvStoresResource", "AsyncKvStoresResource"] @@ -46,6 +46,7 @@ def with_streaming_response(self) -> KvStoresResourceWithStreamingResponse: def create( self, *, + name: str, byod: kv_store_create_params.Byod | Omit = omit, comment: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -54,11 +55,13 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> KvStore: + ) -> KvStoreCreateResponse: """ - Add a new KV store + Add a new Edge store Args: + name: A name of the store + byod: BYOD (Bring Your Own Data) settings comment: A description of the store @@ -75,6 +78,7 @@ def create( "/fastedge/v1/kv", body=maybe_transform( { + "name": name, "byod": byod, "comment": comment, }, @@ -83,13 +87,15 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=KvStore, + cast_to=KvStoreCreateResponse, ) def list( self, *, app_id: int | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -98,11 +104,15 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStoreListResponse: """ - List available stores + List available edge stores Args: app_id: App ID + limit: Limit for pagination + + offset: Offset for pagination + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -118,7 +128,14 @@ def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform({"app_id": app_id}, kv_store_list_params.KvStoreListParams), + query=maybe_transform( + { + "app_id": app_id, + "limit": limit, + "offset": offset, + }, + kv_store_list_params.KvStoreListParams, + ), ), cast_to=KvStoreListResponse, ) @@ -165,9 +182,9 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> KvStoreGetResponse: + ) -> KvStore: """ - Get store by id + Get the edge store by id Args: extra_headers: Send extra headers @@ -183,13 +200,14 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=KvStoreGetResponse, + cast_to=KvStore, ) def replace( self, id: int, *, + name: str, byod: kv_store_replace_params.Byod | Omit = omit, comment: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -203,6 +221,8 @@ def replace( Update a store Args: + name: A name of the store + byod: BYOD (Bring Your Own Data) settings comment: A description of the store @@ -219,6 +239,7 @@ def replace( f"/fastedge/v1/kv/{id}", body=maybe_transform( { + "name": name, "byod": byod, "comment": comment, }, @@ -254,6 +275,7 @@ def with_streaming_response(self) -> AsyncKvStoresResourceWithStreamingResponse: async def create( self, *, + name: str, byod: kv_store_create_params.Byod | Omit = omit, comment: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -262,11 +284,13 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> KvStore: + ) -> KvStoreCreateResponse: """ - Add a new KV store + Add a new Edge store Args: + name: A name of the store + byod: BYOD (Bring Your Own Data) settings comment: A description of the store @@ -283,6 +307,7 @@ async def create( "/fastedge/v1/kv", body=await async_maybe_transform( { + "name": name, "byod": byod, "comment": comment, }, @@ -291,13 +316,15 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=KvStore, + cast_to=KvStoreCreateResponse, ) async def list( self, *, app_id: int | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -306,11 +333,15 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStoreListResponse: """ - List available stores + List available edge stores Args: app_id: App ID + limit: Limit for pagination + + offset: Offset for pagination + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -326,7 +357,14 @@ async def list( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform({"app_id": app_id}, kv_store_list_params.KvStoreListParams), + query=await async_maybe_transform( + { + "app_id": app_id, + "limit": limit, + "offset": offset, + }, + kv_store_list_params.KvStoreListParams, + ), ), cast_to=KvStoreListResponse, ) @@ -373,9 +411,9 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> KvStoreGetResponse: + ) -> KvStore: """ - Get store by id + Get the edge store by id Args: extra_headers: Send extra headers @@ -391,13 +429,14 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=KvStoreGetResponse, + cast_to=KvStore, ) async def replace( self, id: int, *, + name: str, byod: kv_store_replace_params.Byod | Omit = omit, comment: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -411,6 +450,8 @@ async def replace( Update a store Args: + name: A name of the store + byod: BYOD (Bring Your Own Data) settings comment: A description of the store @@ -427,6 +468,7 @@ async def replace( f"/fastedge/v1/kv/{id}", body=await async_maybe_transform( { + "name": name, "byod": byod, "comment": comment, }, diff --git a/src/gcore/types/fastedge/__init__.py b/src/gcore/types/fastedge/__init__.py index b09dc9e4..59553df9 100644 --- a/src/gcore/types/fastedge/__init__.py +++ b/src/gcore/types/fastedge/__init__.py @@ -15,7 +15,6 @@ from .secret_short import SecretShort as SecretShort from .duration_stats import DurationStats as DurationStats from .kv_store_short import KvStoreShort as KvStoreShort -from .kv_store_stats import KvStoreStats as KvStoreStats from .template_short import TemplateShort as TemplateShort from .app_list_params import AppListParams as AppListParams from .app_create_params import AppCreateParams as AppCreateParams @@ -31,7 +30,6 @@ from .secret_list_response import SecretListResponse as SecretListResponse from .secret_update_params import SecretUpdateParams as SecretUpdateParams from .template_list_params import TemplateListParams as TemplateListParams -from .kv_store_get_response import KvStoreGetResponse as KvStoreGetResponse from .secret_replace_params import SecretReplaceParams as SecretReplaceParams from .kv_store_create_params import KvStoreCreateParams as KvStoreCreateParams from .kv_store_list_response import KvStoreListResponse as KvStoreListResponse @@ -40,6 +38,7 @@ from .template_delete_params import TemplateDeleteParams as TemplateDeleteParams from .kv_store_replace_params import KvStoreReplaceParams as KvStoreReplaceParams from .template_replace_params import TemplateReplaceParams as TemplateReplaceParams +from .kv_store_create_response import KvStoreCreateResponse as KvStoreCreateResponse from .template_parameter_param import TemplateParameterParam as TemplateParameterParam from .statistic_get_call_series_params import StatisticGetCallSeriesParams as StatisticGetCallSeriesParams from .statistic_get_call_series_response import StatisticGetCallSeriesResponse as StatisticGetCallSeriesResponse diff --git a/src/gcore/types/fastedge/app.py b/src/gcore/types/fastedge/app.py index 8229b330..123f0a22 100644 --- a/src/gcore/types/fastedge/app.py +++ b/src/gcore/types/fastedge/app.py @@ -6,7 +6,7 @@ from ..._models import BaseModel -__all__ = ["App", "Secrets"] +__all__ = ["App", "Secrets", "Stores"] class Secrets(BaseModel): @@ -22,6 +22,19 @@ class Secrets(BaseModel): """The unique name of the secret.""" +class Stores(BaseModel): + """Application stores""" + + id: int + """The identifier of the store""" + + name: str + """The name of the store""" + + comment: Optional[str] = None + """A description of the store""" + + class App(BaseModel): api_type: Optional[str] = None """Wasm API type""" @@ -70,8 +83,8 @@ class App(BaseModel): 5 - suspended """ - stores: Optional[Dict[str, int]] = None - """KV stores for the app""" + stores: Optional[Dict[str, Stores]] = None + """Application edge stores""" template: Optional[int] = None """Template ID""" diff --git a/src/gcore/types/fastedge/app_create_params.py b/src/gcore/types/fastedge/app_create_params.py index be6ef061..fa8f8f0f 100644 --- a/src/gcore/types/fastedge/app_create_params.py +++ b/src/gcore/types/fastedge/app_create_params.py @@ -5,7 +5,7 @@ from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict -__all__ = ["AppCreateParams", "Secrets"] +__all__ = ["AppCreateParams", "Secrets", "Stores"] class AppCreateParams(TypedDict, total=False): @@ -44,8 +44,8 @@ class AppCreateParams(TypedDict, total=False): 5 - suspended """ - stores: Dict[str, int] - """KV stores for the app""" + stores: Dict[str, Stores] + """Application edge stores""" template: int """Template ID""" @@ -56,3 +56,10 @@ class Secrets(TypedDict, total=False): id: Required[int] """The unique identifier of the secret.""" + + +class Stores(TypedDict, total=False): + """Application stores""" + + id: Required[int] + """The identifier of the store""" diff --git a/src/gcore/types/fastedge/app_param.py b/src/gcore/types/fastedge/app_param.py index 21d6028f..c49448b8 100644 --- a/src/gcore/types/fastedge/app_param.py +++ b/src/gcore/types/fastedge/app_param.py @@ -5,7 +5,7 @@ from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict -__all__ = ["AppParam", "Secrets"] +__all__ = ["AppParam", "Secrets", "Stores"] class Secrets(TypedDict, total=False): @@ -15,6 +15,13 @@ class Secrets(TypedDict, total=False): """The unique identifier of the secret.""" +class Stores(TypedDict, total=False): + """Application stores""" + + id: Required[int] + """The identifier of the store""" + + class AppParam(TypedDict, total=False): binary: int """Binary ID""" @@ -51,8 +58,8 @@ class AppParam(TypedDict, total=False): 5 - suspended """ - stores: Dict[str, int] - """KV stores for the app""" + stores: Dict[str, Stores] + """Application edge stores""" template: int """Template ID""" diff --git a/src/gcore/types/fastedge/app_update_params.py b/src/gcore/types/fastedge/app_update_params.py index 39d58a22..af917ce8 100644 --- a/src/gcore/types/fastedge/app_update_params.py +++ b/src/gcore/types/fastedge/app_update_params.py @@ -5,7 +5,7 @@ from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict -__all__ = ["AppUpdateParams", "Secrets"] +__all__ = ["AppUpdateParams", "Secrets", "Stores"] class AppUpdateParams(TypedDict, total=False): @@ -44,8 +44,8 @@ class AppUpdateParams(TypedDict, total=False): 5 - suspended """ - stores: Dict[str, int] - """KV stores for the app""" + stores: Dict[str, Stores] + """Application edge stores""" template: int """Template ID""" @@ -56,3 +56,10 @@ class Secrets(TypedDict, total=False): id: Required[int] """The unique identifier of the secret.""" + + +class Stores(TypedDict, total=False): + """Application stores""" + + id: Required[int] + """The identifier of the store""" diff --git a/src/gcore/types/fastedge/client.py b/src/gcore/types/fastedge/client.py index eb4d402d..80cc2901 100644 --- a/src/gcore/types/fastedge/client.py +++ b/src/gcore/types/fastedge/client.py @@ -19,21 +19,12 @@ class Client(BaseModel): app_count: int """Actual allowed number of apps""" - app_limit: int - """Max allowed number of apps""" - daily_consumption: int """Actual number of calls for all apps during the current day (UTC)""" - daily_limit: int - """Max allowed calls for all apps during a day (UTC)""" - hourly_consumption: int """Actual number of calls for all apps during the current hour""" - hourly_limit: int - """Max allowed calls for all apps during an hour""" - monthly_consumption: int """Actual number of calls for all apps during the current calendar month (UTC)""" diff --git a/src/gcore/types/fastedge/duration_stats.py b/src/gcore/types/fastedge/duration_stats.py index 61025235..1c119e6e 100644 --- a/src/gcore/types/fastedge/duration_stats.py +++ b/src/gcore/types/fastedge/duration_stats.py @@ -29,4 +29,4 @@ class DurationStats(BaseModel): """90% percentile duration in usec""" time: datetime - """Beginning ot reporting slot""" + """Beginning of reporting slot""" diff --git a/src/gcore/types/fastedge/kv_store.py b/src/gcore/types/fastedge/kv_store.py index 4f4975f4..2b9a1d4c 100644 --- a/src/gcore/types/fastedge/kv_store.py +++ b/src/gcore/types/fastedge/kv_store.py @@ -19,8 +19,8 @@ class Byod(BaseModel): class KvStore(BaseModel): - id: Optional[int] = None - """The unique identifier of the store""" + name: str + """A name of the store""" app_count: Optional[int] = None """The number of applications that use this store""" @@ -31,5 +31,11 @@ class KvStore(BaseModel): comment: Optional[str] = None """A description of the store""" - updated: Optional[datetime] = None - """Last update time""" + revision: Optional[int] = None + """Current store revision (only for non-BYOD stores)""" + + size: Optional[int] = None + """Total store size in bytes (zero for BYOD stores)""" + + updated_at: Optional[datetime] = None + """Timestamp of last store revision (only for non-BYOD stores)""" diff --git a/src/gcore/types/fastedge/kv_store_create_params.py b/src/gcore/types/fastedge/kv_store_create_params.py index 82f25c63..abd3df61 100644 --- a/src/gcore/types/fastedge/kv_store_create_params.py +++ b/src/gcore/types/fastedge/kv_store_create_params.py @@ -8,6 +8,9 @@ class KvStoreCreateParams(TypedDict, total=False): + name: Required[str] + """A name of the store""" + byod: Byod """BYOD (Bring Your Own Data) settings""" diff --git a/src/gcore/types/fastedge/kv_store_create_response.py b/src/gcore/types/fastedge/kv_store_create_response.py new file mode 100644 index 00000000..cec6b49d --- /dev/null +++ b/src/gcore/types/fastedge/kv_store_create_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .kv_store import KvStore + +__all__ = ["KvStoreCreateResponse"] + + +class KvStoreCreateResponse(KvStore): + id: Optional[int] = None + """The unique identifier of the store.""" diff --git a/src/gcore/types/fastedge/kv_store_get_response.py b/src/gcore/types/fastedge/kv_store_get_response.py deleted file mode 100644 index c90559a7..00000000 --- a/src/gcore/types/fastedge/kv_store_get_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .kv_store import KvStore -from .kv_store_stats import KvStoreStats - -__all__ = ["KvStoreGetResponse"] - - -class KvStoreGetResponse(KvStore, KvStoreStats): - pass diff --git a/src/gcore/types/fastedge/kv_store_list_params.py b/src/gcore/types/fastedge/kv_store_list_params.py index 00faa0af..50bac08a 100644 --- a/src/gcore/types/fastedge/kv_store_list_params.py +++ b/src/gcore/types/fastedge/kv_store_list_params.py @@ -10,3 +10,9 @@ class KvStoreListParams(TypedDict, total=False): app_id: int """App ID""" + + limit: int + """Limit for pagination""" + + offset: int + """Offset for pagination""" diff --git a/src/gcore/types/fastedge/kv_store_list_response.py b/src/gcore/types/fastedge/kv_store_list_response.py index f0dcefe9..4ed41cb5 100644 --- a/src/gcore/types/fastedge/kv_store_list_response.py +++ b/src/gcore/types/fastedge/kv_store_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from ..._models import BaseModel from .kv_store_short import KvStoreShort @@ -12,4 +12,4 @@ class KvStoreListResponse(BaseModel): count: int """Total number of stores""" - stores: Optional[List[KvStoreShort]] = None + stores: List[KvStoreShort] diff --git a/src/gcore/types/fastedge/kv_store_replace_params.py b/src/gcore/types/fastedge/kv_store_replace_params.py index b58d2bae..25b2b5bb 100644 --- a/src/gcore/types/fastedge/kv_store_replace_params.py +++ b/src/gcore/types/fastedge/kv_store_replace_params.py @@ -8,6 +8,9 @@ class KvStoreReplaceParams(TypedDict, total=False): + name: Required[str] + """A name of the store""" + byod: Byod """BYOD (Bring Your Own Data) settings""" diff --git a/src/gcore/types/fastedge/kv_store_short.py b/src/gcore/types/fastedge/kv_store_short.py index 682ab377..7e3d0f55 100644 --- a/src/gcore/types/fastedge/kv_store_short.py +++ b/src/gcore/types/fastedge/kv_store_short.py @@ -1,7 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from datetime import datetime from ..._models import BaseModel @@ -9,11 +8,17 @@ class KvStoreShort(BaseModel): - id: Optional[int] = None + id: int """The unique identifier of the store""" + app_count: int + """The number of applications that use this store""" + + name: str + """A name of the store""" + comment: Optional[str] = None """A description of the store""" - updated: Optional[datetime] = None - """Last update time""" + size: Optional[int] = None + """Total store size in bytes""" diff --git a/src/gcore/types/fastedge/kv_store_stats.py b/src/gcore/types/fastedge/kv_store_stats.py deleted file mode 100644 index 4308d772..00000000 --- a/src/gcore/types/fastedge/kv_store_stats.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel - -__all__ = ["KvStoreStats", "Stats"] - - -class Stats(BaseModel): - """Store statistics""" - - cf_count: int - """Total number of Cuckoo filter entries""" - - kv_count: int - """Total number of KV entries""" - - size: int - """Total store size in bytes""" - - zset_count: int - """Total number of sorted set entries""" - - -class KvStoreStats(BaseModel): - stats: Optional[Stats] = None - """Store statistics""" diff --git a/src/gcore/types/fastedge/template_parameter.py b/src/gcore/types/fastedge/template_parameter.py index efb19b95..48249128 100644 --- a/src/gcore/types/fastedge/template_parameter.py +++ b/src/gcore/types/fastedge/template_parameter.py @@ -9,7 +9,7 @@ class TemplateParameter(BaseModel): - data_type: Literal["string", "number", "date", "time", "secret"] + data_type: Literal["string", "number", "date", "time", "secret", "store"] """Parameter type""" mandatory: bool diff --git a/src/gcore/types/fastedge/template_parameter_param.py b/src/gcore/types/fastedge/template_parameter_param.py index 6cd74dc9..ee5fb80f 100644 --- a/src/gcore/types/fastedge/template_parameter_param.py +++ b/src/gcore/types/fastedge/template_parameter_param.py @@ -8,7 +8,7 @@ class TemplateParameterParam(TypedDict, total=False): - data_type: Required[Literal["string", "number", "date", "time", "secret"]] + data_type: Required[Literal["string", "number", "date", "time", "secret", "store"]] """Parameter type""" mandatory: Required[bool] diff --git a/tests/api_resources/fastedge/test_apps.py b/tests/api_resources/fastedge/test_apps.py index 3cf5b982..b2e2949b 100644 --- a/tests/api_resources/fastedge/test_apps.py +++ b/tests/api_resources/fastedge/test_apps.py @@ -44,10 +44,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: }, secrets={"foo": {"id": 0}}, status=0, - stores={ - "country_allow": 1, - "ip_block": 2, - }, + stores={"foo": {"id": 0}}, template=0, ) assert_matches_type(AppShort, app, path=["response"]) @@ -98,10 +95,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: }, secrets={"foo": {"id": 0}}, status=0, - stores={ - "country_allow": 1, - "ip_block": 2, - }, + stores={"foo": {"id": 0}}, template=0, ) assert_matches_type(AppShort, app, path=["response"]) @@ -259,10 +253,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: }, "secrets": {"foo": {"id": 0}}, "status": 0, - "stores": { - "country_allow": 1, - "ip_block": 2, - }, + "stores": {"foo": {"id": 0}}, "template": 0, }, ) @@ -321,10 +312,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> }, secrets={"foo": {"id": 0}}, status=0, - stores={ - "country_allow": 1, - "ip_block": 2, - }, + stores={"foo": {"id": 0}}, template=0, ) assert_matches_type(AppShort, app, path=["response"]) @@ -375,10 +363,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> }, secrets={"foo": {"id": 0}}, status=0, - stores={ - "country_allow": 1, - "ip_block": 2, - }, + stores={"foo": {"id": 0}}, template=0, ) assert_matches_type(AppShort, app, path=["response"]) @@ -536,10 +521,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> }, "secrets": {"foo": {"id": 0}}, "status": 0, - "stores": { - "country_allow": 1, - "ip_block": 2, - }, + "stores": {"foo": {"id": 0}}, "template": 0, }, ) diff --git a/tests/api_resources/fastedge/test_kv_stores.py b/tests/api_resources/fastedge/test_kv_stores.py index 8923cf27..55851568 100644 --- a/tests/api_resources/fastedge/test_kv_stores.py +++ b/tests/api_resources/fastedge/test_kv_stores.py @@ -11,8 +11,8 @@ from tests.utils import assert_matches_type from gcore.types.fastedge import ( KvStore, - KvStoreGetResponse, KvStoreListResponse, + KvStoreCreateResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,37 +23,44 @@ class TestKvStores: @parametrize def test_method_create(self, client: Gcore) -> None: - kv_store = client.fastedge.kv_stores.create() - assert_matches_type(KvStore, kv_store, path=["response"]) + kv_store = client.fastedge.kv_stores.create( + name="name", + ) + assert_matches_type(KvStoreCreateResponse, kv_store, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: kv_store = client.fastedge.kv_stores.create( + name="name", byod={ "prefix": "prefix", "url": "url", }, comment="comment", ) - assert_matches_type(KvStore, kv_store, path=["response"]) + assert_matches_type(KvStoreCreateResponse, kv_store, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.fastedge.kv_stores.with_raw_response.create() + response = client.fastedge.kv_stores.with_raw_response.create( + name="name", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" kv_store = response.parse() - assert_matches_type(KvStore, kv_store, path=["response"]) + assert_matches_type(KvStoreCreateResponse, kv_store, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.fastedge.kv_stores.with_streaming_response.create() as response: + with client.fastedge.kv_stores.with_streaming_response.create( + name="name", + ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" kv_store = response.parse() - assert_matches_type(KvStore, kv_store, path=["response"]) + assert_matches_type(KvStoreCreateResponse, kv_store, path=["response"]) assert cast(Any, response.is_closed) is True @@ -66,6 +73,8 @@ def test_method_list(self, client: Gcore) -> None: def test_method_list_with_all_params(self, client: Gcore) -> None: kv_store = client.fastedge.kv_stores.list( app_id=0, + limit=0, + offset=0, ) assert_matches_type(KvStoreListResponse, kv_store, path=["response"]) @@ -125,7 +134,7 @@ def test_method_get(self, client: Gcore) -> None: kv_store = client.fastedge.kv_stores.get( 0, ) - assert_matches_type(KvStoreGetResponse, kv_store, path=["response"]) + assert_matches_type(KvStore, kv_store, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -136,7 +145,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" kv_store = response.parse() - assert_matches_type(KvStoreGetResponse, kv_store, path=["response"]) + assert_matches_type(KvStore, kv_store, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -147,7 +156,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" kv_store = response.parse() - assert_matches_type(KvStoreGetResponse, kv_store, path=["response"]) + assert_matches_type(KvStore, kv_store, path=["response"]) assert cast(Any, response.is_closed) is True @@ -155,6 +164,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: def test_method_replace(self, client: Gcore) -> None: kv_store = client.fastedge.kv_stores.replace( id=0, + name="name", ) assert_matches_type(KvStore, kv_store, path=["response"]) @@ -162,6 +172,7 @@ def test_method_replace(self, client: Gcore) -> None: def test_method_replace_with_all_params(self, client: Gcore) -> None: kv_store = client.fastedge.kv_stores.replace( id=0, + name="name", byod={ "prefix": "prefix", "url": "url", @@ -174,6 +185,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: def test_raw_response_replace(self, client: Gcore) -> None: response = client.fastedge.kv_stores.with_raw_response.replace( id=0, + name="name", ) assert response.is_closed is True @@ -185,6 +197,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: def test_streaming_response_replace(self, client: Gcore) -> None: with client.fastedge.kv_stores.with_streaming_response.replace( id=0, + name="name", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -202,37 +215,44 @@ class TestAsyncKvStores: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - kv_store = await async_client.fastedge.kv_stores.create() - assert_matches_type(KvStore, kv_store, path=["response"]) + kv_store = await async_client.fastedge.kv_stores.create( + name="name", + ) + assert_matches_type(KvStoreCreateResponse, kv_store, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: kv_store = await async_client.fastedge.kv_stores.create( + name="name", byod={ "prefix": "prefix", "url": "url", }, comment="comment", ) - assert_matches_type(KvStore, kv_store, path=["response"]) + assert_matches_type(KvStoreCreateResponse, kv_store, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.fastedge.kv_stores.with_raw_response.create() + response = await async_client.fastedge.kv_stores.with_raw_response.create( + name="name", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" kv_store = await response.parse() - assert_matches_type(KvStore, kv_store, path=["response"]) + assert_matches_type(KvStoreCreateResponse, kv_store, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.fastedge.kv_stores.with_streaming_response.create() as response: + async with async_client.fastedge.kv_stores.with_streaming_response.create( + name="name", + ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" kv_store = await response.parse() - assert_matches_type(KvStore, kv_store, path=["response"]) + assert_matches_type(KvStoreCreateResponse, kv_store, path=["response"]) assert cast(Any, response.is_closed) is True @@ -245,6 +265,8 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: kv_store = await async_client.fastedge.kv_stores.list( app_id=0, + limit=0, + offset=0, ) assert_matches_type(KvStoreListResponse, kv_store, path=["response"]) @@ -304,7 +326,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: kv_store = await async_client.fastedge.kv_stores.get( 0, ) - assert_matches_type(KvStoreGetResponse, kv_store, path=["response"]) + assert_matches_type(KvStore, kv_store, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -315,7 +337,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" kv_store = await response.parse() - assert_matches_type(KvStoreGetResponse, kv_store, path=["response"]) + assert_matches_type(KvStore, kv_store, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -326,7 +348,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" kv_store = await response.parse() - assert_matches_type(KvStoreGetResponse, kv_store, path=["response"]) + assert_matches_type(KvStore, kv_store, path=["response"]) assert cast(Any, response.is_closed) is True @@ -334,6 +356,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async def test_method_replace(self, async_client: AsyncGcore) -> None: kv_store = await async_client.fastedge.kv_stores.replace( id=0, + name="name", ) assert_matches_type(KvStore, kv_store, path=["response"]) @@ -341,6 +364,7 @@ async def test_method_replace(self, async_client: AsyncGcore) -> None: async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: kv_store = await async_client.fastedge.kv_stores.replace( id=0, + name="name", byod={ "prefix": "prefix", "url": "url", @@ -353,6 +377,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: response = await async_client.fastedge.kv_stores.with_raw_response.replace( id=0, + name="name", ) assert response.is_closed is True @@ -364,6 +389,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: async with async_client.fastedge.kv_stores.with_streaming_response.replace( id=0, + name="name", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From a79daed2e3ce001d15101cc12262d900a0dff773 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 14:36:43 +0000 Subject: [PATCH 555/592] chore(internal): bump dependencies --- requirements-dev.lock | 20 ++++++++++---------- requirements.lock | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 68cbfa4d..cbc55141 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,14 +12,14 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.13.2 +aiohttp==3.13.3 # via gcore # via httpx-aiohttp aiosignal==1.4.0 # via aiohttp annotated-types==0.7.0 # via pydantic -anyio==4.12.0 +anyio==4.12.1 # via gcore # via httpx argcomplete==3.6.3 @@ -31,7 +31,7 @@ attrs==25.4.0 # via nox backports-asyncio-runner==1.2.0 # via pytest-asyncio -certifi==2025.11.12 +certifi==2026.1.4 # via httpcore # via httpx colorama==0.4.6 @@ -64,7 +64,7 @@ httpx==0.28.1 # via gcore # via httpx-aiohttp # via respx -httpx-aiohttp==0.1.9 +httpx-aiohttp==0.1.12 # via gcore humanize==4.13.0 # via nox @@ -72,7 +72,7 @@ idna==3.11 # via anyio # via httpx # via yarl -importlib-metadata==8.7.0 +importlib-metadata==8.7.1 iniconfig==2.1.0 # via pytest markdown-it-py==3.0.0 @@ -85,14 +85,14 @@ multidict==6.7.0 mypy==1.17.0 mypy-extensions==1.1.0 # via mypy -nodeenv==1.9.1 +nodeenv==1.10.0 # via pyright nox==2025.11.12 packaging==25.0 # via dependency-groups # via nox # via pytest -pathspec==0.12.1 +pathspec==1.0.3 # via mypy platformdirs==4.4.0 # via virtualenv @@ -118,13 +118,13 @@ python-dateutil==2.9.0.post0 # via time-machine respx==0.22.0 rich==14.2.0 -ruff==0.14.7 +ruff==0.14.13 six==1.17.0 # via python-dateutil sniffio==1.3.1 # via gcore time-machine==2.19.0 -tomli==2.3.0 +tomli==2.4.0 # via dependency-groups # via mypy # via nox @@ -144,7 +144,7 @@ typing-extensions==4.15.0 # via virtualenv typing-inspection==0.4.2 # via pydantic -virtualenv==20.35.4 +virtualenv==20.36.1 # via nox yarl==1.22.0 # via aiohttp diff --git a/requirements.lock b/requirements.lock index 1e9ebf6f..8fa704e1 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,21 +12,21 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.13.2 +aiohttp==3.13.3 # via gcore # via httpx-aiohttp aiosignal==1.4.0 # via aiohttp annotated-types==0.7.0 # via pydantic -anyio==4.12.0 +anyio==4.12.1 # via gcore # via httpx async-timeout==5.0.1 # via aiohttp attrs==25.4.0 # via aiohttp -certifi==2025.11.12 +certifi==2026.1.4 # via httpcore # via httpx distro==1.9.0 @@ -43,7 +43,7 @@ httpcore==1.0.9 httpx==0.28.1 # via gcore # via httpx-aiohttp -httpx-aiohttp==0.1.9 +httpx-aiohttp==0.1.12 # via gcore idna==3.11 # via anyio From 69d66331a7e5a5e425b61aeaabdcb90b040b9ee7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 14:50:21 +0000 Subject: [PATCH 556/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f814f18c..29afc98d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-24b39742987350e54c3a309a2a9befa3fa5baa2d0eb2ed61511dab58c4ae9ed2.yml openapi_spec_hash: b59285fd083fd6f39f9670071b09d035 -config_hash: 8dbb16a29d92c3261d318b18543cf843 +config_hash: 59388520da4ff5c0c55372621be2a8bb From 21a86b8d17792985a9ebcb6ff9a88edf1157ad43 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 16:32:26 +0000 Subject: [PATCH 557/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/waap/domains/statistics.py | 44 ++++--- .../waap/domains/waap_request_details.py | 8 +- .../waap/domains/waap_request_summary.py | 9 ++ .../waap/domains/test_statistics.py | 112 ++++++++++-------- 5 files changed, 108 insertions(+), 69 deletions(-) diff --git a/.stats.yml b/.stats.yml index 29afc98d..9d82a903 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-24b39742987350e54c3a309a2a9befa3fa5baa2d0eb2ed61511dab58c4ae9ed2.yml -openapi_spec_hash: b59285fd083fd6f39f9670071b09d035 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ae604d09a1ce100f6fd1d87cbd55a2ec19894ed1cd3e69fa26a2dbe50d5ca363.yml +openapi_spec_hash: 8785c579d5c735be99ba4a6e56504c1d config_hash: 59388520da4ff5c0c55372621be2a8bb diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index 225b0f77..e990b52d 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -407,6 +407,7 @@ def get_requests_series( model=WaapRequestSummary, ) + @typing_extensions.deprecated("deprecated") def get_traffic_series( self, domain_id: int, @@ -421,10 +422,11 @@ def get_traffic_series( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetTrafficSeriesResponse: - """ - Retrieves a comprehensive report on a domain's traffic statistics based on - Clickhouse. The report includes details such as API requests, blocked events, - error counts, and many more traffic-related metrics. + """Deprecated. + + Use + [GET /v1/analytics/traffic](/docs/api-reference/waap/analytics/get-traffic-data) + instead. Args: domain_id: The domain ID @@ -833,6 +835,7 @@ def get_requests_series( model=WaapRequestSummary, ) + @typing_extensions.deprecated("deprecated") async def get_traffic_series( self, domain_id: int, @@ -847,10 +850,11 @@ async def get_traffic_series( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetTrafficSeriesResponse: - """ - Retrieves a comprehensive report on a domain's traffic statistics based on - Clickhouse. The report includes details such as API requests, blocked events, - error counts, and many more traffic-related metrics. + """Deprecated. + + Use + [GET /v1/analytics/traffic](/docs/api-reference/waap/analytics/get-traffic-data) + instead. Args: domain_id: The domain ID @@ -911,8 +915,10 @@ def __init__(self, statistics: StatisticsResource) -> None: statistics.get_requests_series, # pyright: ignore[reportDeprecated], ) ) - self.get_traffic_series = to_raw_response_wrapper( - statistics.get_traffic_series, + self.get_traffic_series = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + statistics.get_traffic_series, # pyright: ignore[reportDeprecated], + ) ) @@ -937,8 +943,10 @@ def __init__(self, statistics: AsyncStatisticsResource) -> None: statistics.get_requests_series, # pyright: ignore[reportDeprecated], ) ) - self.get_traffic_series = async_to_raw_response_wrapper( - statistics.get_traffic_series, + self.get_traffic_series = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + statistics.get_traffic_series, # pyright: ignore[reportDeprecated], + ) ) @@ -963,8 +971,10 @@ def __init__(self, statistics: StatisticsResource) -> None: statistics.get_requests_series, # pyright: ignore[reportDeprecated], ) ) - self.get_traffic_series = to_streamed_response_wrapper( - statistics.get_traffic_series, + self.get_traffic_series = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + statistics.get_traffic_series, # pyright: ignore[reportDeprecated], + ) ) @@ -989,6 +999,8 @@ def __init__(self, statistics: AsyncStatisticsResource) -> None: statistics.get_requests_series, # pyright: ignore[reportDeprecated], ) ) - self.get_traffic_series = async_to_streamed_response_wrapper( - statistics.get_traffic_series, + self.get_traffic_series = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + statistics.get_traffic_series, # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/gcore/types/waap/domains/waap_request_details.py b/src/gcore/types/waap/domains/waap_request_details.py index d4a67bad..6099d5de 100644 --- a/src/gcore/types/waap/domains/waap_request_details.py +++ b/src/gcore/types/waap/domains/waap_request_details.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import Literal @@ -196,3 +196,9 @@ class WaapRequestDetails(BaseModel): user_agent: UserAgent """User agent""" + + decision: Optional[Literal["passed", "allowed", "monitored", "blocked", ""]] = None + """The decision made for processing the request through the WAAP.""" + + optional_action: Optional[Literal["captcha", "challenge", ""]] = None + """An optional action that may be applied in addition to the primary decision.""" diff --git a/src/gcore/types/waap/domains/waap_request_summary.py b/src/gcore/types/waap/domains/waap_request_summary.py index dd114b2b..039a5f70 100644 --- a/src/gcore/types/waap/domains/waap_request_summary.py +++ b/src/gcore/types/waap/domains/waap_request_summary.py @@ -22,12 +22,21 @@ class WaapRequestSummary(BaseModel): country: str """Country code""" + decision: Literal["passed", "allowed", "monitored", "blocked", ""] + """The decision made for processing the request through the WAAP.""" + domain: str """Domain name""" + domain_id: int + """Domain ID""" + method: str """HTTP method""" + optional_action: Literal["captcha", "challenge", ""] + """An optional action that may be applied in addition to the primary decision.""" + organization: str """Organization""" diff --git a/tests/api_resources/waap/domains/test_statistics.py b/tests/api_resources/waap/domains/test_statistics.py index c8a4bcb4..da599e1c 100644 --- a/tests/api_resources/waap/domains/test_statistics.py +++ b/tests/api_resources/waap/domains/test_statistics.py @@ -270,30 +270,35 @@ def test_streaming_response_get_requests_series(self, client: Gcore) -> None: @parametrize def test_method_get_traffic_series(self, client: Gcore) -> None: - statistic = client.waap.domains.statistics.get_traffic_series( - domain_id=1, - resolution="daily", - start="2024-04-13T00:00:00+01:00", - ) + with pytest.warns(DeprecationWarning): + statistic = client.waap.domains.statistics.get_traffic_series( + domain_id=1, + resolution="daily", + start="2024-04-13T00:00:00+01:00", + ) + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) @parametrize def test_method_get_traffic_series_with_all_params(self, client: Gcore) -> None: - statistic = client.waap.domains.statistics.get_traffic_series( - domain_id=1, - resolution="daily", - start="2024-04-13T00:00:00+01:00", - end="2024-04-14T12:00:00Z", - ) + with pytest.warns(DeprecationWarning): + statistic = client.waap.domains.statistics.get_traffic_series( + domain_id=1, + resolution="daily", + start="2024-04-13T00:00:00+01:00", + end="2024-04-14T12:00:00Z", + ) + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) @parametrize def test_raw_response_get_traffic_series(self, client: Gcore) -> None: - response = client.waap.domains.statistics.with_raw_response.get_traffic_series( - domain_id=1, - resolution="daily", - start="2024-04-13T00:00:00+01:00", - ) + with pytest.warns(DeprecationWarning): + response = client.waap.domains.statistics.with_raw_response.get_traffic_series( + domain_id=1, + resolution="daily", + start="2024-04-13T00:00:00+01:00", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -302,16 +307,17 @@ def test_raw_response_get_traffic_series(self, client: Gcore) -> None: @parametrize def test_streaming_response_get_traffic_series(self, client: Gcore) -> None: - with client.waap.domains.statistics.with_streaming_response.get_traffic_series( - domain_id=1, - resolution="daily", - start="2024-04-13T00:00:00+01:00", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.waap.domains.statistics.with_streaming_response.get_traffic_series( + domain_id=1, + resolution="daily", + start="2024-04-13T00:00:00+01:00", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - statistic = response.parse() - assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) + statistic = response.parse() + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -563,30 +569,35 @@ async def test_streaming_response_get_requests_series(self, async_client: AsyncG @parametrize async def test_method_get_traffic_series(self, async_client: AsyncGcore) -> None: - statistic = await async_client.waap.domains.statistics.get_traffic_series( - domain_id=1, - resolution="daily", - start="2024-04-13T00:00:00+01:00", - ) + with pytest.warns(DeprecationWarning): + statistic = await async_client.waap.domains.statistics.get_traffic_series( + domain_id=1, + resolution="daily", + start="2024-04-13T00:00:00+01:00", + ) + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) @parametrize async def test_method_get_traffic_series_with_all_params(self, async_client: AsyncGcore) -> None: - statistic = await async_client.waap.domains.statistics.get_traffic_series( - domain_id=1, - resolution="daily", - start="2024-04-13T00:00:00+01:00", - end="2024-04-14T12:00:00Z", - ) + with pytest.warns(DeprecationWarning): + statistic = await async_client.waap.domains.statistics.get_traffic_series( + domain_id=1, + resolution="daily", + start="2024-04-13T00:00:00+01:00", + end="2024-04-14T12:00:00Z", + ) + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) @parametrize async def test_raw_response_get_traffic_series(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.statistics.with_raw_response.get_traffic_series( - domain_id=1, - resolution="daily", - start="2024-04-13T00:00:00+01:00", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.waap.domains.statistics.with_raw_response.get_traffic_series( + domain_id=1, + resolution="daily", + start="2024-04-13T00:00:00+01:00", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -595,15 +606,16 @@ async def test_raw_response_get_traffic_series(self, async_client: AsyncGcore) - @parametrize async def test_streaming_response_get_traffic_series(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.statistics.with_streaming_response.get_traffic_series( - domain_id=1, - resolution="daily", - start="2024-04-13T00:00:00+01:00", - ) 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.waap.domains.statistics.with_streaming_response.get_traffic_series( + domain_id=1, + resolution="daily", + start="2024-04-13T00:00:00+01:00", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - statistic = await response.parse() - assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) + statistic = await response.parse() + assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"]) assert cast(Any, response.is_closed) is True From 36db1235c404ae3e4163b48bdaa9258dc6b5bd48 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 23:37:23 +0000 Subject: [PATCH 558/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9d82a903..8436cbef 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ae604d09a1ce100f6fd1d87cbd55a2ec19894ed1cd3e69fa26a2dbe50d5ca363.yml -openapi_spec_hash: 8785c579d5c735be99ba4a6e56504c1d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-36fec914a660e4aed152e362142d2fe077581b95d0e58090482782a5c9ce8158.yml +openapi_spec_hash: e28d5be17096b3b9d6ac6bb9ce2f67b2 config_hash: 59388520da4ff5c0c55372621be2a8bb From 84c0935813a34d6ef8c62d9ff848395b53d88d74 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 02:54:20 +0000 Subject: [PATCH 559/592] chore(api): minor updates --- src/gcore/resources/waap/domains/api_discovery.py | 8 ++++---- src/gcore/resources/waap/domains/api_paths.py | 12 ++++++------ src/gcore/resources/waap/insights.py | 4 ++-- .../api_discovery_list_scan_results_params.py | 4 ++-- src/gcore/types/waap/domains/api_path_list_params.py | 6 +++--- src/gcore/types/waap/insight_list_types_params.py | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py index 426426f5..f83862da 100644 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -167,9 +167,9 @@ def list_scan_results( ordering: Sort the response by given field. - status: The different statuses a task result can have + status: Filter by the status of the scan - type: The different types of scans that can be performed + type: Filter by the path of the scan type extra_headers: Send extra headers @@ -485,9 +485,9 @@ def list_scan_results( ordering: Sort the response by given field. - status: The different statuses a task result can have + status: Filter by the status of the scan - type: The different types of scans that can be performed + type: Filter by the path of the scan type extra_headers: Send extra headers diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index ea3057ec..cdc33365 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -211,13 +211,13 @@ def list( api_version: Filter by the API version - http_scheme: The different HTTP schemes an API path can have + http_scheme: Filter by the HTTP version of the API path ids: Filter by the path ID limit: Number of items to return - method: The different methods an API path can have + method: Filter by the API RESTful method offset: Number of items to skip @@ -225,7 +225,7 @@ def list( path: Filter by the path. Supports '\\**' as a wildcard character - source: The different sources an API path can have + source: Filter by the source of the discovered API status: Filter by the status of the discovered API path @@ -529,13 +529,13 @@ def list( api_version: Filter by the API version - http_scheme: The different HTTP schemes an API path can have + http_scheme: Filter by the HTTP version of the API path ids: Filter by the path ID limit: Number of items to return - method: The different methods an API path can have + method: Filter by the API RESTful method offset: Number of items to skip @@ -543,7 +543,7 @@ def list( path: Filter by the path. Supports '\\**' as a wildcard character - source: The different sources an API path can have + source: Filter by the source of the discovered API status: Filter by the status of the discovered API path diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index 5de0a968..c9fc4370 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -76,7 +76,7 @@ def list_types( ordering: Sort the response by given field. - slug: The slug of the insight type + slug: Filter by the slug of the insight type extra_headers: Send extra headers @@ -161,7 +161,7 @@ def list_types( ordering: Sort the response by given field. - slug: The slug of the insight type + slug: Filter by the slug of the insight type extra_headers: Send extra headers diff --git a/src/gcore/types/waap/domains/api_discovery_list_scan_results_params.py b/src/gcore/types/waap/domains/api_discovery_list_scan_results_params.py index 51007c19..28b05065 100644 --- a/src/gcore/types/waap/domains/api_discovery_list_scan_results_params.py +++ b/src/gcore/types/waap/domains/api_discovery_list_scan_results_params.py @@ -35,7 +35,7 @@ class APIDiscoveryListScanResultsParams(TypedDict, total=False): """Sort the response by given field.""" status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] - """The different statuses a task result can have""" + """Filter by the status of the scan""" type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] - """The different types of scans that can be performed""" + """Filter by the path of the scan type""" diff --git a/src/gcore/types/waap/domains/api_path_list_params.py b/src/gcore/types/waap/domains/api_path_list_params.py index b819dc8b..34ef9fe5 100644 --- a/src/gcore/types/waap/domains/api_path_list_params.py +++ b/src/gcore/types/waap/domains/api_path_list_params.py @@ -18,7 +18,7 @@ class APIPathListParams(TypedDict, total=False): """Filter by the API version""" http_scheme: Optional[Literal["HTTP", "HTTPS"]] - """The different HTTP schemes an API path can have""" + """Filter by the HTTP version of the API path""" ids: Optional[SequenceNotStr[str]] """Filter by the path ID""" @@ -27,7 +27,7 @@ class APIPathListParams(TypedDict, total=False): """Number of items to return""" method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] - """The different methods an API path can have""" + """Filter by the API RESTful method""" offset: int """Number of items to skip""" @@ -58,7 +58,7 @@ class APIPathListParams(TypedDict, total=False): """Filter by the path. Supports '\\**' as a wildcard character""" source: Optional[Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"]] - """The different sources an API path can have""" + """Filter by the source of the discovered API""" status: Optional[List[Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"]]] """Filter by the status of the discovered API path""" diff --git a/src/gcore/types/waap/insight_list_types_params.py b/src/gcore/types/waap/insight_list_types_params.py index 6eae7ac3..534f2cc2 100644 --- a/src/gcore/types/waap/insight_list_types_params.py +++ b/src/gcore/types/waap/insight_list_types_params.py @@ -25,4 +25,4 @@ class InsightListTypesParams(TypedDict, total=False): """Sort the response by given field.""" slug: Optional[str] - """The slug of the insight type""" + """Filter by the slug of the insight type""" From 496b42979cdfcd11a926279fc4a4c64cd1c3a0e4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 10:25:53 +0000 Subject: [PATCH 560/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../cdn/cdn_resources/cdn_resources.py | 60 +++--- src/gcore/resources/cloud/floating_ips.py | 20 +- .../cloud/load_balancers/load_balancers.py | 33 +++- src/gcore/resources/cloud/networks/routers.py | 35 ++-- src/gcore/types/cdn/cdn_resource.py | 5 +- .../types/cdn/cdn_resource_create_params.py | 26 +-- .../types/cdn/cdn_resource_replace_params.py | 5 +- .../types/cdn/cdn_resource_update_params.py | 5 +- tests/api_resources/cdn/test_cdn_resources.py | 20 +- .../cloud/networks/test_routers.py | 184 ++++++++++-------- .../cloud/test_load_balancers.py | 172 ++++++++-------- 12 files changed, 303 insertions(+), 266 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8436cbef..e720753e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-36fec914a660e4aed152e362142d2fe077581b95d0e58090482782a5c9ce8158.yml -openapi_spec_hash: e28d5be17096b3b9d6ac6bb9ce2f67b2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e9a785e8a6bbd2cae2f832823f8e5928511002996aa1817d56b2e32f4650f53b.yml +openapi_spec_hash: faff7fa65733f0b1aebdfb75d63d398c config_hash: 59388520da4ff5c0c55372621be2a8bb diff --git a/src/gcore/resources/cdn/cdn_resources/cdn_resources.py b/src/gcore/resources/cdn/cdn_resources/cdn_resources.py index e92683c6..52c7821e 100644 --- a/src/gcore/resources/cdn/cdn_resources/cdn_resources.py +++ b/src/gcore/resources/cdn/cdn_resources/cdn_resources.py @@ -80,12 +80,12 @@ def create( self, *, cname: str, - origin: str, - origin_group: int, active: bool | Omit = omit, description: str | Omit = omit, name: Optional[str] | Omit = omit, options: cdn_resource_create_params.Options | Omit = omit, + origin: str | Omit = omit, + origin_group: int | Omit = omit, origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, primary_resource: Optional[int] | Omit = omit, proxy_ssl_ca: Optional[int] | Omit = omit, @@ -110,14 +110,6 @@ def create( Delivery domains should be added to your DNS settings. - origin: IP address or domain name of the origin and the port, if custom port is used. - - You can use either the `origin` or `originGroup` parameter in the request. - - origin_group: Origin group ID with which the CDN resource is associated. - - You can use either the `origin` or `originGroup` parameter in the request. - active: Enables or disables a CDN resource. Possible values: @@ -134,6 +126,16 @@ def create( In case of `null` value the option is not added to the CDN resource. Option may inherit its value from the global account settings. + origin: IP address or domain name of the origin and the port, if custom port is used. + + Exactly one of `origin` or `originGroup` must be provided during resource + creation. + + origin_group: Origin group ID with which the CDN resource is associated. + + Exactly one of `origin` or `originGroup` must be provided during resource + creation. + origin_protocol: Protocol used by CDN servers to request content from an origin source. Possible values: @@ -204,12 +206,12 @@ def create( body=maybe_transform( { "cname": cname, - "origin": origin, - "origin_group": origin_group, "active": active, "description": description, "name": name, "options": options, + "origin": origin, + "origin_group": origin_group, "origin_protocol": origin_protocol, "primary_resource": primary_resource, "proxy_ssl_ca": proxy_ssl_ca, @@ -273,8 +275,6 @@ def update( origin_group: Origin group ID with which the CDN resource is associated. - You can use either the `origin` or `originGroup` parameter in the request. - origin_protocol: Protocol used by CDN servers to request content from an origin source. Possible values: @@ -855,8 +855,6 @@ def replace( Args: origin_group: Origin group ID with which the CDN resource is associated. - You can use either the `origin` or `originGroup` parameter in the request. - active: Enables or disables a CDN resource. Possible values: @@ -990,12 +988,12 @@ async def create( self, *, cname: str, - origin: str, - origin_group: int, active: bool | Omit = omit, description: str | Omit = omit, name: Optional[str] | Omit = omit, options: cdn_resource_create_params.Options | Omit = omit, + origin: str | Omit = omit, + origin_group: int | Omit = omit, origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, primary_resource: Optional[int] | Omit = omit, proxy_ssl_ca: Optional[int] | Omit = omit, @@ -1020,14 +1018,6 @@ async def create( Delivery domains should be added to your DNS settings. - origin: IP address or domain name of the origin and the port, if custom port is used. - - You can use either the `origin` or `originGroup` parameter in the request. - - origin_group: Origin group ID with which the CDN resource is associated. - - You can use either the `origin` or `originGroup` parameter in the request. - active: Enables or disables a CDN resource. Possible values: @@ -1044,6 +1034,16 @@ async def create( In case of `null` value the option is not added to the CDN resource. Option may inherit its value from the global account settings. + origin: IP address or domain name of the origin and the port, if custom port is used. + + Exactly one of `origin` or `originGroup` must be provided during resource + creation. + + origin_group: Origin group ID with which the CDN resource is associated. + + Exactly one of `origin` or `originGroup` must be provided during resource + creation. + origin_protocol: Protocol used by CDN servers to request content from an origin source. Possible values: @@ -1114,12 +1114,12 @@ async def create( body=await async_maybe_transform( { "cname": cname, - "origin": origin, - "origin_group": origin_group, "active": active, "description": description, "name": name, "options": options, + "origin": origin, + "origin_group": origin_group, "origin_protocol": origin_protocol, "primary_resource": primary_resource, "proxy_ssl_ca": proxy_ssl_ca, @@ -1183,8 +1183,6 @@ async def update( origin_group: Origin group ID with which the CDN resource is associated. - You can use either the `origin` or `originGroup` parameter in the request. - origin_protocol: Protocol used by CDN servers to request content from an origin source. Possible values: @@ -1765,8 +1763,6 @@ async def replace( Args: origin_group: Origin group ID with which the CDN resource is associated. - You can use either the `origin` or `originGroup` parameter in the request. - active: Enables or disables a CDN resource. Possible values: diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 33c19798..6732cbb1 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -382,10 +382,10 @@ def assign( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ - Assign floating IP to instance or loadbalancer + Assign floating IP to instance or loadbalancer. - **Deprecated**: Use PATCH - /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead + **Deprecated**: Use + `PATCH /v2/floatingips/{project_id}/{region_id}/{floating_ip_id}` instead. Args: project_id: Project ID @@ -487,8 +487,8 @@ def unassign( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ - **Deprecated**: Use PATCH - /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead + **Deprecated**: Use + `PATCH /v2/floatingips/{project_id}/{region_id}/{floating_ip_id}` instead. Args: project_id: Project ID @@ -867,10 +867,10 @@ async def assign( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ - Assign floating IP to instance or loadbalancer + Assign floating IP to instance or loadbalancer. - **Deprecated**: Use PATCH - /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead + **Deprecated**: Use + `PATCH /v2/floatingips/{project_id}/{region_id}/{floating_ip_id}` instead. Args: project_id: Project ID @@ -972,8 +972,8 @@ async def unassign( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ - **Deprecated**: Use PATCH - /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead + **Deprecated**: Use + `PATCH /v2/floatingips/{project_id}/{region_id}/{floating_ip_id}` instead. Args: project_id: Project ID diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 20cb7409..c3672b4c 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Dict, Iterable, Optional from typing_extensions import Literal @@ -238,6 +239,7 @@ def create( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") def update( self, load_balancer_id: str, @@ -261,6 +263,9 @@ def update( that are provided in the request body. Any fields that are not included will remain unchanged. + Please use PATCH `/v2/loadbalancers/{project_id}/{region_id}/{load_balancer_id}` + instead + Args: project_id: Project ID @@ -792,6 +797,7 @@ async def create( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") async def update( self, load_balancer_id: str, @@ -815,6 +821,9 @@ async def update( that are provided in the request body. Any fields that are not included will remain unchanged. + Please use PATCH `/v2/loadbalancers/{project_id}/{region_id}/{load_balancer_id}` + instead + Args: project_id: Project ID @@ -1203,8 +1212,10 @@ def __init__(self, load_balancers: LoadBalancersResource) -> None: self.create = to_raw_response_wrapper( load_balancers.create, ) - self.update = to_raw_response_wrapper( - load_balancers.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + load_balancers.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_raw_response_wrapper( load_balancers.list, @@ -1254,8 +1265,10 @@ def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: self.create = async_to_raw_response_wrapper( load_balancers.create, ) - self.update = async_to_raw_response_wrapper( - load_balancers.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + load_balancers.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_raw_response_wrapper( load_balancers.list, @@ -1305,8 +1318,10 @@ def __init__(self, load_balancers: LoadBalancersResource) -> None: self.create = to_streamed_response_wrapper( load_balancers.create, ) - self.update = to_streamed_response_wrapper( - load_balancers.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + load_balancers.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_streamed_response_wrapper( load_balancers.list, @@ -1356,8 +1371,10 @@ def __init__(self, load_balancers: AsyncLoadBalancersResource) -> None: self.create = async_to_streamed_response_wrapper( load_balancers.create, ) - self.update = async_to_streamed_response_wrapper( - load_balancers.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + load_balancers.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_streamed_response_wrapper( load_balancers.list, diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index b9a03134..23ed228f 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Iterable, Optional import httpx @@ -108,6 +109,7 @@ def create( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") def update( self, router_id: str, @@ -126,8 +128,8 @@ def update( ) -> Router: """Update the configuration of an existing router. - **Deprecated**: Use PATCH - /v2/routers/{`project_id`}/{`region_id`}/{`router_id`} + **Deprecated**: Use + `PATCH /v2/routers/{project_id}/{region_id}/{router_id}` instead. Args: external_gateway_info: New external gateway. @@ -477,6 +479,7 @@ async def create( cast_to=TaskIDList, ) + @typing_extensions.deprecated("deprecated") async def update( self, router_id: str, @@ -495,8 +498,8 @@ async def update( ) -> Router: """Update the configuration of an existing router. - **Deprecated**: Use PATCH - /v2/routers/{`project_id`}/{`region_id`}/{`router_id`} + **Deprecated**: Use + `PATCH /v2/routers/{project_id}/{region_id}/{router_id}` instead. Args: external_gateway_info: New external gateway. @@ -778,8 +781,10 @@ def __init__(self, routers: RoutersResource) -> None: self.create = to_raw_response_wrapper( routers.create, ) - self.update = to_raw_response_wrapper( - routers.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + routers.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_raw_response_wrapper( routers.list, @@ -805,8 +810,10 @@ def __init__(self, routers: AsyncRoutersResource) -> None: self.create = async_to_raw_response_wrapper( routers.create, ) - self.update = async_to_raw_response_wrapper( - routers.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + routers.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_raw_response_wrapper( routers.list, @@ -832,8 +839,10 @@ def __init__(self, routers: RoutersResource) -> None: self.create = to_streamed_response_wrapper( routers.create, ) - self.update = to_streamed_response_wrapper( - routers.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + routers.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_streamed_response_wrapper( routers.list, @@ -859,8 +868,10 @@ def __init__(self, routers: AsyncRoutersResource) -> None: self.create = async_to_streamed_response_wrapper( routers.create, ) - self.update = async_to_streamed_response_wrapper( - routers.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + routers.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_streamed_response_wrapper( routers.list, diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py index 0bcef26f..12546952 100644 --- a/src/gcore/types/cdn/cdn_resource.py +++ b/src/gcore/types/cdn/cdn_resource.py @@ -2114,10 +2114,7 @@ class CDNResource(BaseModel): """ origin_group: Optional[int] = FieldInfo(alias="originGroup", default=None) - """Origin group ID with which the CDN resource is associated. - - You can use either the `origin` or `originGroup` parameter in the request. - """ + """Origin group ID with which the CDN resource is associated.""" origin_group_name: Optional[str] = FieldInfo(alias="originGroup_name", default=None) """Origin group name.""" diff --git a/src/gcore/types/cdn/cdn_resource_create_params.py b/src/gcore/types/cdn/cdn_resource_create_params.py index a7f775a8..97fa478b 100644 --- a/src/gcore/types/cdn/cdn_resource_create_params.py +++ b/src/gcore/types/cdn/cdn_resource_create_params.py @@ -78,18 +78,6 @@ class CDNResourceCreateParams(TypedDict, total=False): Delivery domains should be added to your DNS settings. """ - origin: Required[str] - """IP address or domain name of the origin and the port, if custom port is used. - - You can use either the `origin` or `originGroup` parameter in the request. - """ - - origin_group: Required[Annotated[int, PropertyInfo(alias="originGroup")]] - """Origin group ID with which the CDN resource is associated. - - You can use either the `origin` or `originGroup` parameter in the request. - """ - active: bool """Enables or disables a CDN resource. @@ -112,6 +100,20 @@ class CDNResourceCreateParams(TypedDict, total=False): inherit its value from the global account settings. """ + origin: str + """IP address or domain name of the origin and the port, if custom port is used. + + Exactly one of `origin` or `originGroup` must be provided during resource + creation. + """ + + origin_group: Annotated[int, PropertyInfo(alias="originGroup")] + """Origin group ID with which the CDN resource is associated. + + Exactly one of `origin` or `originGroup` must be provided during resource + creation. + """ + origin_protocol: Annotated[Literal["HTTP", "HTTPS", "MATCH"], PropertyInfo(alias="originProtocol")] """Protocol used by CDN servers to request content from an origin source. diff --git a/src/gcore/types/cdn/cdn_resource_replace_params.py b/src/gcore/types/cdn/cdn_resource_replace_params.py index 0503cf07..4a05cb60 100644 --- a/src/gcore/types/cdn/cdn_resource_replace_params.py +++ b/src/gcore/types/cdn/cdn_resource_replace_params.py @@ -73,10 +73,7 @@ class CDNResourceReplaceParams(TypedDict, total=False): origin_group: Required[Annotated[int, PropertyInfo(alias="originGroup")]] - """Origin group ID with which the CDN resource is associated. - - You can use either the `origin` or `originGroup` parameter in the request. - """ + """Origin group ID with which the CDN resource is associated.""" active: bool """Enables or disables a CDN resource. diff --git a/src/gcore/types/cdn/cdn_resource_update_params.py b/src/gcore/types/cdn/cdn_resource_update_params.py index 9011c2e0..60988336 100644 --- a/src/gcore/types/cdn/cdn_resource_update_params.py +++ b/src/gcore/types/cdn/cdn_resource_update_params.py @@ -95,10 +95,7 @@ class CDNResourceUpdateParams(TypedDict, total=False): """ origin_group: Annotated[int, PropertyInfo(alias="originGroup")] - """Origin group ID with which the CDN resource is associated. - - You can use either the `origin` or `originGroup` parameter in the request. - """ + """Origin group ID with which the CDN resource is associated.""" origin_protocol: Annotated[Literal["HTTP", "HTTPS", "MATCH"], PropertyInfo(alias="originProtocol")] """Protocol used by CDN servers to request content from an origin source. diff --git a/tests/api_resources/cdn/test_cdn_resources.py b/tests/api_resources/cdn/test_cdn_resources.py index 79f8e5db..097c60c0 100644 --- a/tests/api_resources/cdn/test_cdn_resources.py +++ b/tests/api_resources/cdn/test_cdn_resources.py @@ -24,8 +24,6 @@ class TestCDNResources: def test_method_create(self, client: Gcore) -> None: cdn_resource = client.cdn.cdn_resources.create( cname="cdn.site.com", - origin="example.com", - origin_group=132, ) assert_matches_type(CDNResource, cdn_resource, path=["response"]) @@ -33,8 +31,6 @@ def test_method_create(self, client: Gcore) -> None: def test_method_create_with_all_params(self, client: Gcore) -> None: cdn_resource = client.cdn.cdn_resources.create( cname="cdn.site.com", - origin="example.com", - origin_group=132, active=True, description="My resource", name="Resource for images", @@ -323,6 +319,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "value": True, }, }, + origin="example.com", + origin_group=132, origin_protocol="HTTPS", primary_resource=None, proxy_ssl_ca=None, @@ -339,8 +337,6 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: def test_raw_response_create(self, client: Gcore) -> None: response = client.cdn.cdn_resources.with_raw_response.create( cname="cdn.site.com", - origin="example.com", - origin_group=132, ) assert response.is_closed is True @@ -352,8 +348,6 @@ def test_raw_response_create(self, client: Gcore) -> None: def test_streaming_response_create(self, client: Gcore) -> None: with client.cdn.cdn_resources.with_streaming_response.create( cname="cdn.site.com", - origin="example.com", - origin_group=132, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1340,8 +1334,6 @@ class TestAsyncCDNResources: async def test_method_create(self, async_client: AsyncGcore) -> None: cdn_resource = await async_client.cdn.cdn_resources.create( cname="cdn.site.com", - origin="example.com", - origin_group=132, ) assert_matches_type(CDNResource, cdn_resource, path=["response"]) @@ -1349,8 +1341,6 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: cdn_resource = await async_client.cdn.cdn_resources.create( cname="cdn.site.com", - origin="example.com", - origin_group=132, active=True, description="My resource", name="Resource for images", @@ -1639,6 +1629,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "value": True, }, }, + origin="example.com", + origin_group=132, origin_protocol="HTTPS", primary_resource=None, proxy_ssl_ca=None, @@ -1655,8 +1647,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cdn.cdn_resources.with_raw_response.create( cname="cdn.site.com", - origin="example.com", - origin_group=132, ) assert response.is_closed is True @@ -1668,8 +1658,6 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cdn.cdn_resources.with_streaming_response.create( cname="cdn.site.com", - origin="example.com", - origin_group=132, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/cloud/networks/test_routers.py b/tests/api_resources/cloud/networks/test_routers.py index 9dfe1a80..968607af 100644 --- a/tests/api_resources/cloud/networks/test_routers.py +++ b/tests/api_resources/cloud/networks/test_routers.py @@ -15,6 +15,8 @@ Router, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -85,41 +87,46 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: - router = client.cloud.networks.routers.update( - router_id="router_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + router = client.cloud.networks.routers.update( + router_id="router_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Router, router, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - router = client.cloud.networks.routers.update( - router_id="router_id", - project_id=0, - region_id=0, - external_gateway_info={ - "network_id": "d7745dcf-b302-4795-9d61-6cc52487af48", - "enable_snat": False, - "type": "manual", - }, - name="my_renamed_router", - routes=[ - { - "destination": "10.0.3.0/24", - "nexthop": "10.0.0.13", - } - ], - ) + with pytest.warns(DeprecationWarning): + router = client.cloud.networks.routers.update( + router_id="router_id", + project_id=0, + region_id=0, + external_gateway_info={ + "network_id": "d7745dcf-b302-4795-9d61-6cc52487af48", + "enable_snat": False, + "type": "manual", + }, + name="my_renamed_router", + routes=[ + { + "destination": "10.0.3.0/24", + "nexthop": "10.0.0.13", + } + ], + ) + assert_matches_type(Router, router, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.networks.routers.with_raw_response.update( - router_id="router_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.networks.routers.with_raw_response.update( + router_id="router_id", + project_id=0, + region_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -128,27 +135,29 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.networks.routers.with_streaming_response.update( - router_id="router_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.networks.routers.with_streaming_response.update( + router_id="router_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - router = response.parse() - assert_matches_type(Router, router, path=["response"]) + router = response.parse() + assert_matches_type(Router, router, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): - client.cloud.networks.routers.with_raw_response.update( - router_id="", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): + client.cloud.networks.routers.with_raw_response.update( + router_id="", + project_id=0, + region_id=0, + ) @parametrize def test_method_list(self, client: Gcore) -> None: @@ -467,41 +476,46 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - router = await async_client.cloud.networks.routers.update( - router_id="router_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + router = await async_client.cloud.networks.routers.update( + router_id="router_id", + project_id=0, + region_id=0, + ) + assert_matches_type(Router, router, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - router = await async_client.cloud.networks.routers.update( - router_id="router_id", - project_id=0, - region_id=0, - external_gateway_info={ - "network_id": "d7745dcf-b302-4795-9d61-6cc52487af48", - "enable_snat": False, - "type": "manual", - }, - name="my_renamed_router", - routes=[ - { - "destination": "10.0.3.0/24", - "nexthop": "10.0.0.13", - } - ], - ) + with pytest.warns(DeprecationWarning): + router = await async_client.cloud.networks.routers.update( + router_id="router_id", + project_id=0, + region_id=0, + external_gateway_info={ + "network_id": "d7745dcf-b302-4795-9d61-6cc52487af48", + "enable_snat": False, + "type": "manual", + }, + name="my_renamed_router", + routes=[ + { + "destination": "10.0.3.0/24", + "nexthop": "10.0.0.13", + } + ], + ) + assert_matches_type(Router, router, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.networks.routers.with_raw_response.update( - router_id="router_id", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.networks.routers.with_raw_response.update( + router_id="router_id", + project_id=0, + region_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -510,27 +524,29 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.networks.routers.with_streaming_response.update( - router_id="router_id", - project_id=0, - region_id=0, - ) 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.networks.routers.with_streaming_response.update( + router_id="router_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - router = await response.parse() - assert_matches_type(Router, router, path=["response"]) + router = await response.parse() + assert_matches_type(Router, router, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): - await async_client.cloud.networks.routers.with_raw_response.update( - router_id="", - project_id=0, - region_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `router_id` but received ''"): + await async_client.cloud.networks.routers.with_raw_response.update( + router_id="", + project_id=0, + region_id=0, + ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index 68c9489a..5b30c022 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -15,6 +15,8 @@ LoadBalancer, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -159,38 +161,43 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.update( - load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", - project_id=1, - region_id=7, - ) + with pytest.warns(DeprecationWarning): + load_balancer = client.cloud.load_balancers.update( + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - load_balancer = client.cloud.load_balancers.update( - load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", - project_id=1, - region_id=7, - logging={ - "destination_region_id": 1, - "enabled": True, - "retention_policy": {"period": 45}, - "topic_name": "my-log-name", - }, - name="some_name", - preferred_connectivity="L2", - tags={"foo": "my-tag-value"}, - ) + with pytest.warns(DeprecationWarning): + load_balancer = client.cloud.load_balancers.update( + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + name="some_name", + preferred_connectivity="L2", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.load_balancers.with_raw_response.update( - load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", - project_id=1, - region_id=7, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.load_balancers.with_raw_response.update( + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -199,27 +206,29 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.load_balancers.with_streaming_response.update( - load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", - project_id=1, - region_id=7, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.load_balancers.with_streaming_response.update( + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + load_balancer = response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - client.cloud.load_balancers.with_raw_response.update( - load_balancer_id="", - project_id=1, - region_id=7, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + client.cloud.load_balancers.with_raw_response.update( + load_balancer_id="", + project_id=1, + region_id=7, + ) @parametrize def test_method_list(self, client: Gcore) -> None: @@ -626,38 +635,43 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.update( - load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", - project_id=1, - region_id=7, - ) + with pytest.warns(DeprecationWarning): + load_balancer = await async_client.cloud.load_balancers.update( + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - load_balancer = await async_client.cloud.load_balancers.update( - load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", - project_id=1, - region_id=7, - logging={ - "destination_region_id": 1, - "enabled": True, - "retention_policy": {"period": 45}, - "topic_name": "my-log-name", - }, - name="some_name", - preferred_connectivity="L2", - tags={"foo": "my-tag-value"}, - ) + with pytest.warns(DeprecationWarning): + load_balancer = await async_client.cloud.load_balancers.update( + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, + logging={ + "destination_region_id": 1, + "enabled": True, + "retention_policy": {"period": 45}, + "topic_name": "my-log-name", + }, + name="some_name", + preferred_connectivity="L2", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.with_raw_response.update( - load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", - project_id=1, - region_id=7, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.load_balancers.with_raw_response.update( + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -666,27 +680,29 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.with_streaming_response.update( - load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", - project_id=1, - region_id=7, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.cloud.load_balancers.with_streaming_response.update( + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - load_balancer = await response.parse() - assert_matches_type(LoadBalancer, load_balancer, path=["response"]) + load_balancer = await response.parse() + assert_matches_type(LoadBalancer, load_balancer, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): - await async_client.cloud.load_balancers.with_raw_response.update( - load_balancer_id="", - project_id=1, - region_id=7, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): + await async_client.cloud.load_balancers.with_raw_response.update( + load_balancer_id="", + project_id=1, + region_id=7, + ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: From fed75698befe529c7eee0d98f58316519b1e3c73 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:27:35 +0000 Subject: [PATCH 561/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/cdn/cdn_resource.py | 4 ++-- src/gcore/types/cdn/cdn_resource_create_params.py | 4 ++-- src/gcore/types/cdn/cdn_resource_replace_params.py | 4 ++-- src/gcore/types/cdn/cdn_resource_update_params.py | 4 ++-- src/gcore/types/cdn/cdn_resources/cdn_resource_rule.py | 4 ++-- src/gcore/types/cdn/cdn_resources/rule_create_params.py | 4 ++-- src/gcore/types/cdn/cdn_resources/rule_replace_params.py | 4 ++-- src/gcore/types/cdn/cdn_resources/rule_update_params.py | 4 ++-- src/gcore/types/cdn/rule_template.py | 4 ++-- src/gcore/types/cdn/rule_template_create_params.py | 4 ++-- src/gcore/types/cdn/rule_template_replace_params.py | 4 ++-- src/gcore/types/cdn/rule_template_update_params.py | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.stats.yml b/.stats.yml index e720753e..c7cc797c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e9a785e8a6bbd2cae2f832823f8e5928511002996aa1817d56b2e32f4650f53b.yml -openapi_spec_hash: faff7fa65733f0b1aebdfb75d63d398c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b863a34891380fa54c65538379c8ef13d6e87210af8fbcd5d70480090b867203.yml +openapi_spec_hash: 9c57a763b4c6b82b581defdcaf5f52df config_hash: 59388520da4ff5c0c55372621be2a8bb diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py index 12546952..7e143119 100644 --- a/src/gcore/types/cdn/cdn_resource.py +++ b/src/gcore/types/cdn/cdn_resource.py @@ -399,7 +399,7 @@ 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. + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request, **before cache**. """ app_id: str @@ -494,7 +494,7 @@ class OptionsFastedge(BaseModel): on_request_headers: Optional[OptionsFastedgeOnRequestHeaders] = None """ Allows to configure FastEdge application that will be called to handle request - headers as soon as CDN receives incoming HTTP request. + headers as soon as CDN receives incoming HTTP request, **before cache**. """ on_response_body: Optional[OptionsFastedgeOnResponseBody] = None diff --git a/src/gcore/types/cdn/cdn_resource_create_params.py b/src/gcore/types/cdn/cdn_resource_create_params.py index 97fa478b..58df5896 100644 --- a/src/gcore/types/cdn/cdn_resource_create_params.py +++ b/src/gcore/types/cdn/cdn_resource_create_params.py @@ -524,7 +524,7 @@ 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. + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request, **before cache**. """ app_id: Required[str] @@ -619,7 +619,7 @@ class OptionsFastedge(TypedDict, total=False): on_request_headers: OptionsFastedgeOnRequestHeaders """ Allows to configure FastEdge application that will be called to handle request - headers as soon as CDN receives incoming HTTP request. + headers as soon as CDN receives incoming HTTP request, **before cache**. """ on_response_body: OptionsFastedgeOnResponseBody diff --git a/src/gcore/types/cdn/cdn_resource_replace_params.py b/src/gcore/types/cdn/cdn_resource_replace_params.py index 4a05cb60..352ca804 100644 --- a/src/gcore/types/cdn/cdn_resource_replace_params.py +++ b/src/gcore/types/cdn/cdn_resource_replace_params.py @@ -497,7 +497,7 @@ 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. + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request, **before cache**. """ app_id: Required[str] @@ -592,7 +592,7 @@ class OptionsFastedge(TypedDict, total=False): on_request_headers: OptionsFastedgeOnRequestHeaders """ Allows to configure FastEdge application that will be called to handle request - headers as soon as CDN receives incoming HTTP request. + headers as soon as CDN receives incoming HTTP request, **before cache**. """ on_response_body: OptionsFastedgeOnResponseBody diff --git a/src/gcore/types/cdn/cdn_resource_update_params.py b/src/gcore/types/cdn/cdn_resource_update_params.py index 60988336..4a907f53 100644 --- a/src/gcore/types/cdn/cdn_resource_update_params.py +++ b/src/gcore/types/cdn/cdn_resource_update_params.py @@ -488,7 +488,7 @@ 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. + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request, **before cache**. """ app_id: Required[str] @@ -583,7 +583,7 @@ class OptionsFastedge(TypedDict, total=False): on_request_headers: OptionsFastedgeOnRequestHeaders """ Allows to configure FastEdge application that will be called to handle request - headers as soon as CDN receives incoming HTTP request. + headers as soon as CDN receives incoming HTTP request, **before cache**. """ on_response_body: OptionsFastedgeOnResponseBody diff --git a/src/gcore/types/cdn/cdn_resources/cdn_resource_rule.py b/src/gcore/types/cdn/cdn_resources/cdn_resource_rule.py index 682384fd..6c3b02bf 100644 --- a/src/gcore/types/cdn/cdn_resources/cdn_resource_rule.py +++ b/src/gcore/types/cdn/cdn_resources/cdn_resource_rule.py @@ -394,7 +394,7 @@ 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. + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request, **before cache**. """ app_id: str @@ -489,7 +489,7 @@ class OptionsFastedge(BaseModel): on_request_headers: Optional[OptionsFastedgeOnRequestHeaders] = None """ Allows to configure FastEdge application that will be called to handle request - headers as soon as CDN receives incoming HTTP request. + headers as soon as CDN receives incoming HTTP request, **before cache**. """ on_response_body: Optional[OptionsFastedgeOnResponseBody] = None diff --git a/src/gcore/types/cdn/cdn_resources/rule_create_params.py b/src/gcore/types/cdn/cdn_resources/rule_create_params.py index 052803bb..0426cd93 100644 --- a/src/gcore/types/cdn/cdn_resources/rule_create_params.py +++ b/src/gcore/types/cdn/cdn_resources/rule_create_params.py @@ -470,7 +470,7 @@ 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. + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request, **before cache**. """ app_id: Required[str] @@ -565,7 +565,7 @@ class OptionsFastedge(TypedDict, total=False): on_request_headers: OptionsFastedgeOnRequestHeaders """ Allows to configure FastEdge application that will be called to handle request - headers as soon as CDN receives incoming HTTP request. + headers as soon as CDN receives incoming HTTP request, **before cache**. """ on_response_body: OptionsFastedgeOnResponseBody diff --git a/src/gcore/types/cdn/cdn_resources/rule_replace_params.py b/src/gcore/types/cdn/cdn_resources/rule_replace_params.py index 86fb2b30..4cbdefaf 100644 --- a/src/gcore/types/cdn/cdn_resources/rule_replace_params.py +++ b/src/gcore/types/cdn/cdn_resources/rule_replace_params.py @@ -472,7 +472,7 @@ 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. + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request, **before cache**. """ app_id: Required[str] @@ -567,7 +567,7 @@ class OptionsFastedge(TypedDict, total=False): on_request_headers: OptionsFastedgeOnRequestHeaders """ Allows to configure FastEdge application that will be called to handle request - headers as soon as CDN receives incoming HTTP request. + headers as soon as CDN receives incoming HTTP request, **before cache**. """ on_response_body: OptionsFastedgeOnResponseBody diff --git a/src/gcore/types/cdn/cdn_resources/rule_update_params.py b/src/gcore/types/cdn/cdn_resources/rule_update_params.py index c4ae3b10..b98453ba 100644 --- a/src/gcore/types/cdn/cdn_resources/rule_update_params.py +++ b/src/gcore/types/cdn/cdn_resources/rule_update_params.py @@ -472,7 +472,7 @@ 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. + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request, **before cache**. """ app_id: Required[str] @@ -567,7 +567,7 @@ class OptionsFastedge(TypedDict, total=False): on_request_headers: OptionsFastedgeOnRequestHeaders """ Allows to configure FastEdge application that will be called to handle request - headers as soon as CDN receives incoming HTTP request. + headers as soon as CDN receives incoming HTTP request, **before cache**. """ on_response_body: OptionsFastedgeOnResponseBody diff --git a/src/gcore/types/cdn/rule_template.py b/src/gcore/types/cdn/rule_template.py index e23d3805..a2eb3725 100644 --- a/src/gcore/types/cdn/rule_template.py +++ b/src/gcore/types/cdn/rule_template.py @@ -394,7 +394,7 @@ 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. + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request, **before cache**. """ app_id: str @@ -489,7 +489,7 @@ class OptionsFastedge(BaseModel): on_request_headers: Optional[OptionsFastedgeOnRequestHeaders] = None """ Allows to configure FastEdge application that will be called to handle request - headers as soon as CDN receives incoming HTTP request. + headers as soon as CDN receives incoming HTTP request, **before cache**. """ on_response_body: Optional[OptionsFastedgeOnResponseBody] = None diff --git a/src/gcore/types/cdn/rule_template_create_params.py b/src/gcore/types/cdn/rule_template_create_params.py index 6d44873b..1a4d8a41 100644 --- a/src/gcore/types/cdn/rule_template_create_params.py +++ b/src/gcore/types/cdn/rule_template_create_params.py @@ -454,7 +454,7 @@ 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. + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request, **before cache**. """ app_id: Required[str] @@ -549,7 +549,7 @@ class OptionsFastedge(TypedDict, total=False): on_request_headers: OptionsFastedgeOnRequestHeaders """ Allows to configure FastEdge application that will be called to handle request - headers as soon as CDN receives incoming HTTP request. + headers as soon as CDN receives incoming HTTP request, **before cache**. """ on_response_body: OptionsFastedgeOnResponseBody diff --git a/src/gcore/types/cdn/rule_template_replace_params.py b/src/gcore/types/cdn/rule_template_replace_params.py index 7dba15b1..2fe52fdc 100644 --- a/src/gcore/types/cdn/rule_template_replace_params.py +++ b/src/gcore/types/cdn/rule_template_replace_params.py @@ -454,7 +454,7 @@ 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. + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request, **before cache**. """ app_id: Required[str] @@ -549,7 +549,7 @@ class OptionsFastedge(TypedDict, total=False): on_request_headers: OptionsFastedgeOnRequestHeaders """ Allows to configure FastEdge application that will be called to handle request - headers as soon as CDN receives incoming HTTP request. + headers as soon as CDN receives incoming HTTP request, **before cache**. """ on_response_body: OptionsFastedgeOnResponseBody diff --git a/src/gcore/types/cdn/rule_template_update_params.py b/src/gcore/types/cdn/rule_template_update_params.py index 37b2ec5b..cccc6bc0 100644 --- a/src/gcore/types/cdn/rule_template_update_params.py +++ b/src/gcore/types/cdn/rule_template_update_params.py @@ -454,7 +454,7 @@ 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. + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request, **before cache**. """ app_id: Required[str] @@ -549,7 +549,7 @@ class OptionsFastedge(TypedDict, total=False): on_request_headers: OptionsFastedgeOnRequestHeaders """ Allows to configure FastEdge application that will be called to handle request - headers as soon as CDN receives incoming HTTP request. + headers as soon as CDN receives incoming HTTP request, **before cache**. """ on_response_body: OptionsFastedgeOnResponseBody From 8119fdceb1c900e6aed684adb29c9a963359c26f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:36:45 +0000 Subject: [PATCH 562/592] fix(fastedge): remove readOnly name from app_store required fields --- .stats.yml | 4 ++-- src/gcore/types/fastedge/app.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index c7cc797c..e4e9b35f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b863a34891380fa54c65538379c8ef13d6e87210af8fbcd5d70480090b867203.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-afac9651736e871ab5942174b1c2b741d31f17c1f4ac61e78f0000f1b3fd8d09.yml openapi_spec_hash: 9c57a763b4c6b82b581defdcaf5f52df -config_hash: 59388520da4ff5c0c55372621be2a8bb +config_hash: 7552912a8ca7c67b43b97f51b67a5ae7 diff --git a/src/gcore/types/fastedge/app.py b/src/gcore/types/fastedge/app.py index 123f0a22..d8cb8b41 100644 --- a/src/gcore/types/fastedge/app.py +++ b/src/gcore/types/fastedge/app.py @@ -28,12 +28,12 @@ class Stores(BaseModel): id: int """The identifier of the store""" - name: str - """The name of the store""" - comment: Optional[str] = None """A description of the store""" + name: Optional[str] = None + """The name of the store""" + class App(BaseModel): api_type: Optional[str] = None From f7482f8cc49e2f04caf144e81e143c4b09331e73 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 14:26:18 +0000 Subject: [PATCH 563/592] chore(internal): fix lint error on Python 3.14 --- src/gcore/_utils/_compat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gcore/_utils/_compat.py b/src/gcore/_utils/_compat.py index dd703233..2c70b299 100644 --- a/src/gcore/_utils/_compat.py +++ b/src/gcore/_utils/_compat.py @@ -26,7 +26,7 @@ def is_union(tp: Optional[Type[Any]]) -> bool: else: import types - return tp is Union or tp is types.UnionType + return tp is Union or tp is types.UnionType # type: ignore[comparison-overlap] def is_typeddict(tp: Type[Any]) -> bool: From 4563cea5d4bedb70c4b9b7dd3ddb2487fbd6fc82 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 14:44:21 +0000 Subject: [PATCH 564/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f81bf992..f04d0896 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.31.0" + ".": "0.32.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 02d5383a..c1bfc40d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.31.0" +version = "0.32.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 d06a94b9..0211e7f4 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.31.0" # x-release-please-version +__version__ = "0.32.0" # x-release-please-version From 955fc6c1ea63ba2910865adbc7e7eef50ff387d8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 09:29:23 +0000 Subject: [PATCH 565/592] feat(cdn): add client_config subresource for terraform --- .stats.yml | 4 +- api.md | 14 + src/gcore/resources/cdn/__init__.py | 14 + src/gcore/resources/cdn/cdn.py | 32 ++ src/gcore/resources/cdn/client_config.py | 313 ++++++++++++++++++ src/gcore/types/cdn/__init__.py | 2 + .../types/cdn/client_config_replace_params.py | 15 + .../types/cdn/client_config_update_params.py | 15 + tests/api_resources/cdn/test_client_config.py | 202 +++++++++++ 9 files changed, 609 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cdn/client_config.py create mode 100644 src/gcore/types/cdn/client_config_replace_params.py create mode 100644 src/gcore/types/cdn/client_config_update_params.py create mode 100644 tests/api_resources/cdn/test_client_config.py diff --git a/.stats.yml b/.stats.yml index e4e9b35f..9ca9ec3c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 645 +configured_endpoints: 646 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-afac9651736e871ab5942174b1c2b741d31f17c1f4ac61e78f0000f1b3fd8d09.yml openapi_spec_hash: 9c57a763b4c6b82b581defdcaf5f52df -config_hash: 7552912a8ca7c67b43b97f51b67a5ae7 +config_hash: 33e6d5828b3af3964a67af53b2e1654a diff --git a/api.md b/api.md index cbc93dbc..8a2eaa8f 100644 --- a/api.md +++ b/api.md @@ -2577,3 +2577,17 @@ Methods: - client.cdn.ip_ranges.list(\*\*params) -> PublicNetworkList - client.cdn.ip_ranges.list_ips(\*\*params) -> PublicIPList + +## ClientConfig + +Types: + +```python +from gcore.types.cdn import CDNClientConfig +``` + +Methods: + +- client.cdn.client_config.update(\*\*params) -> CDNAccount +- client.cdn.client_config.get() -> CDNAccount +- client.cdn.client_config.replace(\*\*params) -> CDNAccount diff --git a/src/gcore/resources/cdn/__init__.py b/src/gcore/resources/cdn/__init__.py index 869fc050..91878ce3 100644 --- a/src/gcore/resources/cdn/__init__.py +++ b/src/gcore/resources/cdn/__init__.py @@ -72,6 +72,14 @@ CDNResourcesResourceWithStreamingResponse, AsyncCDNResourcesResourceWithStreamingResponse, ) +from .client_config import ( + ClientConfigResource, + AsyncClientConfigResource, + ClientConfigResourceWithRawResponse, + AsyncClientConfigResourceWithRawResponse, + ClientConfigResourceWithStreamingResponse, + AsyncClientConfigResourceWithStreamingResponse, +) from .logs_uploader import ( LogsUploaderResource, AsyncLogsUploaderResource, @@ -192,6 +200,12 @@ "AsyncIPRangesResourceWithRawResponse", "IPRangesResourceWithStreamingResponse", "AsyncIPRangesResourceWithStreamingResponse", + "ClientConfigResource", + "AsyncClientConfigResource", + "ClientConfigResourceWithRawResponse", + "AsyncClientConfigResourceWithRawResponse", + "ClientConfigResourceWithStreamingResponse", + "AsyncClientConfigResourceWithStreamingResponse", "CDNResource", "AsyncCDNResource", "CDNResourceWithRawResponse", diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py index 771c3776..4ab4a225 100644 --- a/src/gcore/resources/cdn/cdn.py +++ b/src/gcore/resources/cdn/cdn.py @@ -71,6 +71,14 @@ CertificatesResourceWithStreamingResponse, AsyncCertificatesResourceWithStreamingResponse, ) +from .client_config import ( + ClientConfigResource, + AsyncClientConfigResource, + ClientConfigResourceWithRawResponse, + AsyncClientConfigResourceWithRawResponse, + ClientConfigResourceWithStreamingResponse, + AsyncClientConfigResourceWithStreamingResponse, +) from .origin_groups import ( OriginGroupsResource, AsyncOriginGroupsResource, @@ -183,6 +191,10 @@ def metrics(self) -> MetricsResource: def ip_ranges(self) -> IPRangesResource: return IPRangesResource(self._client) + @cached_property + def client_config(self) -> ClientConfigResource: + return ClientConfigResource(self._client) + @cached_property def with_raw_response(self) -> CDNResourceWithRawResponse: """ @@ -484,6 +496,10 @@ def metrics(self) -> AsyncMetricsResource: def ip_ranges(self) -> AsyncIPRangesResource: return AsyncIPRangesResource(self._client) + @cached_property + def client_config(self) -> AsyncClientConfigResource: + return AsyncClientConfigResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCDNResourceWithRawResponse: """ @@ -810,6 +826,10 @@ def metrics(self) -> MetricsResourceWithRawResponse: def ip_ranges(self) -> IPRangesResourceWithRawResponse: return IPRangesResourceWithRawResponse(self._cdn.ip_ranges) + @cached_property + def client_config(self) -> ClientConfigResourceWithRawResponse: + return ClientConfigResourceWithRawResponse(self._cdn.client_config) + class AsyncCDNResourceWithRawResponse: def __init__(self, cdn: AsyncCDNResource) -> None: @@ -889,6 +909,10 @@ def metrics(self) -> AsyncMetricsResourceWithRawResponse: def ip_ranges(self) -> AsyncIPRangesResourceWithRawResponse: return AsyncIPRangesResourceWithRawResponse(self._cdn.ip_ranges) + @cached_property + def client_config(self) -> AsyncClientConfigResourceWithRawResponse: + return AsyncClientConfigResourceWithRawResponse(self._cdn.client_config) + class CDNResourceWithStreamingResponse: def __init__(self, cdn: CDNResource) -> None: @@ -968,6 +992,10 @@ def metrics(self) -> MetricsResourceWithStreamingResponse: def ip_ranges(self) -> IPRangesResourceWithStreamingResponse: return IPRangesResourceWithStreamingResponse(self._cdn.ip_ranges) + @cached_property + def client_config(self) -> ClientConfigResourceWithStreamingResponse: + return ClientConfigResourceWithStreamingResponse(self._cdn.client_config) + class AsyncCDNResourceWithStreamingResponse: def __init__(self, cdn: AsyncCDNResource) -> None: @@ -1046,3 +1074,7 @@ def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: @cached_property def ip_ranges(self) -> AsyncIPRangesResourceWithStreamingResponse: return AsyncIPRangesResourceWithStreamingResponse(self._cdn.ip_ranges) + + @cached_property + def client_config(self) -> AsyncClientConfigResourceWithStreamingResponse: + return AsyncClientConfigResourceWithStreamingResponse(self._cdn.client_config) diff --git a/src/gcore/resources/cdn/client_config.py b/src/gcore/resources/cdn/client_config.py new file mode 100644 index 00000000..c19b3124 --- /dev/null +++ b/src/gcore/resources/cdn/client_config.py @@ -0,0 +1,313 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import client_config_update_params, client_config_replace_params +from ..._base_client import make_request_options +from ...types.cdn.cdn_account import CDNAccount + +__all__ = ["ClientConfigResource", "AsyncClientConfigResource"] + + +class ClientConfigResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ClientConfigResourceWithRawResponse: + """ + 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 ClientConfigResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ClientConfigResourceWithStreamingResponse: + """ + 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 ClientConfigResourceWithStreamingResponse(self) + + def update( + self, + *, + utilization_level: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CDNAccount: + """ + Change information about CDN service. + + Args: + utilization_level: CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + "/cdn/clients/me", + body=maybe_transform( + {"utilization_level": utilization_level}, client_config_update_params.ClientConfigUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CDNAccount, + ) + + def get( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CDNAccount: + """Get information about CDN service.""" + return self._get( + "/cdn/clients/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CDNAccount, + ) + + def replace( + self, + *, + utilization_level: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CDNAccount: + """ + Change information about CDN service. + + Args: + utilization_level: CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + "/cdn/clients/me", + body=maybe_transform( + {"utilization_level": utilization_level}, client_config_replace_params.ClientConfigReplaceParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CDNAccount, + ) + + +class AsyncClientConfigResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncClientConfigResourceWithRawResponse: + """ + 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 AsyncClientConfigResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncClientConfigResourceWithStreamingResponse: + """ + 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 AsyncClientConfigResourceWithStreamingResponse(self) + + async def update( + self, + *, + utilization_level: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CDNAccount: + """ + Change information about CDN service. + + Args: + utilization_level: CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + "/cdn/clients/me", + body=await async_maybe_transform( + {"utilization_level": utilization_level}, client_config_update_params.ClientConfigUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CDNAccount, + ) + + async def get( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CDNAccount: + """Get information about CDN service.""" + return await self._get( + "/cdn/clients/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CDNAccount, + ) + + async def replace( + self, + *, + utilization_level: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CDNAccount: + """ + Change information about CDN service. + + Args: + utilization_level: CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + "/cdn/clients/me", + body=await async_maybe_transform( + {"utilization_level": utilization_level}, client_config_replace_params.ClientConfigReplaceParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CDNAccount, + ) + + +class ClientConfigResourceWithRawResponse: + def __init__(self, client_config: ClientConfigResource) -> None: + self._client_config = client_config + + self.update = to_raw_response_wrapper( + client_config.update, + ) + self.get = to_raw_response_wrapper( + client_config.get, + ) + self.replace = to_raw_response_wrapper( + client_config.replace, + ) + + +class AsyncClientConfigResourceWithRawResponse: + def __init__(self, client_config: AsyncClientConfigResource) -> None: + self._client_config = client_config + + self.update = async_to_raw_response_wrapper( + client_config.update, + ) + self.get = async_to_raw_response_wrapper( + client_config.get, + ) + self.replace = async_to_raw_response_wrapper( + client_config.replace, + ) + + +class ClientConfigResourceWithStreamingResponse: + def __init__(self, client_config: ClientConfigResource) -> None: + self._client_config = client_config + + self.update = to_streamed_response_wrapper( + client_config.update, + ) + self.get = to_streamed_response_wrapper( + client_config.get, + ) + self.replace = to_streamed_response_wrapper( + client_config.replace, + ) + + +class AsyncClientConfigResourceWithStreamingResponse: + def __init__(self, client_config: AsyncClientConfigResource) -> None: + self._client_config = client_config + + self.update = async_to_streamed_response_wrapper( + client_config.update, + ) + self.get = async_to_streamed_response_wrapper( + client_config.get, + ) + self.replace = async_to_streamed_response_wrapper( + client_config.replace, + ) diff --git a/src/gcore/types/cdn/__init__.py b/src/gcore/types/cdn/__init__.py index 92895e33..6b27c1f9 100644 --- a/src/gcore/types/cdn/__init__.py +++ b/src/gcore/types/cdn/__init__.py @@ -52,10 +52,12 @@ from .origin_group_create_params import OriginGroupCreateParams as OriginGroupCreateParams from .origin_group_update_params import OriginGroupUpdateParams as OriginGroupUpdateParams from .cdn_resource_replace_params import CDNResourceReplaceParams as CDNResourceReplaceParams +from .client_config_update_params import ClientConfigUpdateParams as ClientConfigUpdateParams from .origin_group_replace_params import OriginGroupReplaceParams as OriginGroupReplaceParams from .rule_template_create_params import RuleTemplateCreateParams as RuleTemplateCreateParams from .rule_template_update_params import RuleTemplateUpdateParams as RuleTemplateUpdateParams from .cdn_resource_prefetch_params import CDNResourcePrefetchParams as CDNResourcePrefetchParams +from .client_config_replace_params import ClientConfigReplaceParams as ClientConfigReplaceParams from .rule_template_replace_params import RuleTemplateReplaceParams as RuleTemplateReplaceParams from .certificate_get_status_params import CertificateGetStatusParams as CertificateGetStatusParams from .cdn_list_purge_statuses_params import CDNListPurgeStatusesParams as CDNListPurgeStatusesParams diff --git a/src/gcore/types/cdn/client_config_replace_params.py b/src/gcore/types/cdn/client_config_replace_params.py new file mode 100644 index 00000000..a604b93b --- /dev/null +++ b/src/gcore/types/cdn/client_config_replace_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ClientConfigReplaceParams"] + + +class ClientConfigReplaceParams(TypedDict, total=False): + utilization_level: int + """CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + """ diff --git a/src/gcore/types/cdn/client_config_update_params.py b/src/gcore/types/cdn/client_config_update_params.py new file mode 100644 index 00000000..8f9f22a1 --- /dev/null +++ b/src/gcore/types/cdn/client_config_update_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ClientConfigUpdateParams"] + + +class ClientConfigUpdateParams(TypedDict, total=False): + utilization_level: int + """CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + """ diff --git a/tests/api_resources/cdn/test_client_config.py b/tests/api_resources/cdn/test_client_config.py new file mode 100644 index 00000000..3c296833 --- /dev/null +++ b/tests/api_resources/cdn/test_client_config.py @@ -0,0 +1,202 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import CDNAccount + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestClientConfig: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Gcore) -> None: + client_config = client.cdn.client_config.update() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + client_config = client.cdn.client_config.update( + utilization_level=1111, + ) + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.client_config.with_raw_response.update() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client_config = response.parse() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.client_config.with_streaming_response.update() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client_config = response.parse() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + client_config = client.cdn.client_config.get() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.client_config.with_raw_response.get() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client_config = response.parse() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.client_config.with_streaming_response.get() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client_config = response.parse() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + client_config = client.cdn.client_config.replace() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + client_config = client.cdn.client_config.replace( + utilization_level=1111, + ) + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.client_config.with_raw_response.replace() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client_config = response.parse() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.client_config.with_streaming_response.replace() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client_config = response.parse() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncClientConfig: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + client_config = await async_client.cdn.client_config.update() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + client_config = await async_client.cdn.client_config.update( + utilization_level=1111, + ) + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.client_config.with_raw_response.update() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client_config = await response.parse() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.client_config.with_streaming_response.update() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client_config = await response.parse() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + client_config = await async_client.cdn.client_config.get() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.client_config.with_raw_response.get() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client_config = await response.parse() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.client_config.with_streaming_response.get() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client_config = await response.parse() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + client_config = await async_client.cdn.client_config.replace() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + client_config = await async_client.cdn.client_config.replace( + utilization_level=1111, + ) + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.client_config.with_raw_response.replace() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + client_config = await response.parse() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.client_config.with_streaming_response.replace() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + client_config = await response.parse() + assert_matches_type(CDNAccount, client_config, path=["response"]) + + assert cast(Any, response.is_closed) is True From ff12ec5d9e3073406237ef00d80b2f741ed646ec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 11:07:02 +0000 Subject: [PATCH 566/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9ca9ec3c..8aed1c31 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 646 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-afac9651736e871ab5942174b1c2b741d31f17c1f4ac61e78f0000f1b3fd8d09.yml -openapi_spec_hash: 9c57a763b4c6b82b581defdcaf5f52df +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-bab3396466ec5b697c339ea24bd4489c07ff40d08091f4d4d263d247ef2b00bd.yml +openapi_spec_hash: c7d1eedcfa472650c54e9ec569383949 config_hash: 33e6d5828b3af3964a67af53b2e1654a From 982914a39c3dee9ff11865042ad142ec96e76ccf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 13:15:27 +0000 Subject: [PATCH 567/592] feat(api): revert(cdn): remove client_config subresource (#207) Reverts the client_config addition from PR #206. The generated terraform provider fails to compile because it references CDN.ClientConfig from the Go SDK which is only on the `next` branch, not yet on `main`. --- .stats.yml | 4 +- api.md | 14 - src/gcore/resources/cdn/__init__.py | 14 - src/gcore/resources/cdn/cdn.py | 32 -- src/gcore/resources/cdn/client_config.py | 313 ------------------ src/gcore/types/cdn/__init__.py | 2 - .../types/cdn/client_config_replace_params.py | 15 - .../types/cdn/client_config_update_params.py | 15 - tests/api_resources/cdn/test_client_config.py | 202 ----------- 9 files changed, 2 insertions(+), 609 deletions(-) delete mode 100644 src/gcore/resources/cdn/client_config.py delete mode 100644 src/gcore/types/cdn/client_config_replace_params.py delete mode 100644 src/gcore/types/cdn/client_config_update_params.py delete mode 100644 tests/api_resources/cdn/test_client_config.py diff --git a/.stats.yml b/.stats.yml index 8aed1c31..f46ecaf2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 646 +configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-bab3396466ec5b697c339ea24bd4489c07ff40d08091f4d4d263d247ef2b00bd.yml openapi_spec_hash: c7d1eedcfa472650c54e9ec569383949 -config_hash: 33e6d5828b3af3964a67af53b2e1654a +config_hash: 841ecfe67afa779a3954fe8800ecb132 diff --git a/api.md b/api.md index 8a2eaa8f..cbc93dbc 100644 --- a/api.md +++ b/api.md @@ -2577,17 +2577,3 @@ Methods: - client.cdn.ip_ranges.list(\*\*params) -> PublicNetworkList - client.cdn.ip_ranges.list_ips(\*\*params) -> PublicIPList - -## ClientConfig - -Types: - -```python -from gcore.types.cdn import CDNClientConfig -``` - -Methods: - -- client.cdn.client_config.update(\*\*params) -> CDNAccount -- client.cdn.client_config.get() -> CDNAccount -- client.cdn.client_config.replace(\*\*params) -> CDNAccount diff --git a/src/gcore/resources/cdn/__init__.py b/src/gcore/resources/cdn/__init__.py index 91878ce3..869fc050 100644 --- a/src/gcore/resources/cdn/__init__.py +++ b/src/gcore/resources/cdn/__init__.py @@ -72,14 +72,6 @@ CDNResourcesResourceWithStreamingResponse, AsyncCDNResourcesResourceWithStreamingResponse, ) -from .client_config import ( - ClientConfigResource, - AsyncClientConfigResource, - ClientConfigResourceWithRawResponse, - AsyncClientConfigResourceWithRawResponse, - ClientConfigResourceWithStreamingResponse, - AsyncClientConfigResourceWithStreamingResponse, -) from .logs_uploader import ( LogsUploaderResource, AsyncLogsUploaderResource, @@ -200,12 +192,6 @@ "AsyncIPRangesResourceWithRawResponse", "IPRangesResourceWithStreamingResponse", "AsyncIPRangesResourceWithStreamingResponse", - "ClientConfigResource", - "AsyncClientConfigResource", - "ClientConfigResourceWithRawResponse", - "AsyncClientConfigResourceWithRawResponse", - "ClientConfigResourceWithStreamingResponse", - "AsyncClientConfigResourceWithStreamingResponse", "CDNResource", "AsyncCDNResource", "CDNResourceWithRawResponse", diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py index 4ab4a225..771c3776 100644 --- a/src/gcore/resources/cdn/cdn.py +++ b/src/gcore/resources/cdn/cdn.py @@ -71,14 +71,6 @@ CertificatesResourceWithStreamingResponse, AsyncCertificatesResourceWithStreamingResponse, ) -from .client_config import ( - ClientConfigResource, - AsyncClientConfigResource, - ClientConfigResourceWithRawResponse, - AsyncClientConfigResourceWithRawResponse, - ClientConfigResourceWithStreamingResponse, - AsyncClientConfigResourceWithStreamingResponse, -) from .origin_groups import ( OriginGroupsResource, AsyncOriginGroupsResource, @@ -191,10 +183,6 @@ def metrics(self) -> MetricsResource: def ip_ranges(self) -> IPRangesResource: return IPRangesResource(self._client) - @cached_property - def client_config(self) -> ClientConfigResource: - return ClientConfigResource(self._client) - @cached_property def with_raw_response(self) -> CDNResourceWithRawResponse: """ @@ -496,10 +484,6 @@ def metrics(self) -> AsyncMetricsResource: def ip_ranges(self) -> AsyncIPRangesResource: return AsyncIPRangesResource(self._client) - @cached_property - def client_config(self) -> AsyncClientConfigResource: - return AsyncClientConfigResource(self._client) - @cached_property def with_raw_response(self) -> AsyncCDNResourceWithRawResponse: """ @@ -826,10 +810,6 @@ def metrics(self) -> MetricsResourceWithRawResponse: def ip_ranges(self) -> IPRangesResourceWithRawResponse: return IPRangesResourceWithRawResponse(self._cdn.ip_ranges) - @cached_property - def client_config(self) -> ClientConfigResourceWithRawResponse: - return ClientConfigResourceWithRawResponse(self._cdn.client_config) - class AsyncCDNResourceWithRawResponse: def __init__(self, cdn: AsyncCDNResource) -> None: @@ -909,10 +889,6 @@ def metrics(self) -> AsyncMetricsResourceWithRawResponse: def ip_ranges(self) -> AsyncIPRangesResourceWithRawResponse: return AsyncIPRangesResourceWithRawResponse(self._cdn.ip_ranges) - @cached_property - def client_config(self) -> AsyncClientConfigResourceWithRawResponse: - return AsyncClientConfigResourceWithRawResponse(self._cdn.client_config) - class CDNResourceWithStreamingResponse: def __init__(self, cdn: CDNResource) -> None: @@ -992,10 +968,6 @@ def metrics(self) -> MetricsResourceWithStreamingResponse: def ip_ranges(self) -> IPRangesResourceWithStreamingResponse: return IPRangesResourceWithStreamingResponse(self._cdn.ip_ranges) - @cached_property - def client_config(self) -> ClientConfigResourceWithStreamingResponse: - return ClientConfigResourceWithStreamingResponse(self._cdn.client_config) - class AsyncCDNResourceWithStreamingResponse: def __init__(self, cdn: AsyncCDNResource) -> None: @@ -1074,7 +1046,3 @@ def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: @cached_property def ip_ranges(self) -> AsyncIPRangesResourceWithStreamingResponse: return AsyncIPRangesResourceWithStreamingResponse(self._cdn.ip_ranges) - - @cached_property - def client_config(self) -> AsyncClientConfigResourceWithStreamingResponse: - return AsyncClientConfigResourceWithStreamingResponse(self._cdn.client_config) diff --git a/src/gcore/resources/cdn/client_config.py b/src/gcore/resources/cdn/client_config.py deleted file mode 100644 index c19b3124..00000000 --- a/src/gcore/resources/cdn/client_config.py +++ /dev/null @@ -1,313 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...types.cdn import client_config_update_params, client_config_replace_params -from ..._base_client import make_request_options -from ...types.cdn.cdn_account import CDNAccount - -__all__ = ["ClientConfigResource", "AsyncClientConfigResource"] - - -class ClientConfigResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ClientConfigResourceWithRawResponse: - """ - 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 ClientConfigResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ClientConfigResourceWithStreamingResponse: - """ - 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 ClientConfigResourceWithStreamingResponse(self) - - def update( - self, - *, - utilization_level: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CDNAccount: - """ - Change information about CDN service. - - Args: - utilization_level: CDN traffic usage limit in gigabytes. - - When the limit is reached, we will send an email notification. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._patch( - "/cdn/clients/me", - body=maybe_transform( - {"utilization_level": utilization_level}, client_config_update_params.ClientConfigUpdateParams - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CDNAccount, - ) - - def get( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CDNAccount: - """Get information about CDN service.""" - return self._get( - "/cdn/clients/me", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CDNAccount, - ) - - def replace( - self, - *, - utilization_level: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CDNAccount: - """ - Change information about CDN service. - - Args: - utilization_level: CDN traffic usage limit in gigabytes. - - When the limit is reached, we will send an email notification. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._put( - "/cdn/clients/me", - body=maybe_transform( - {"utilization_level": utilization_level}, client_config_replace_params.ClientConfigReplaceParams - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CDNAccount, - ) - - -class AsyncClientConfigResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncClientConfigResourceWithRawResponse: - """ - 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 AsyncClientConfigResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncClientConfigResourceWithStreamingResponse: - """ - 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 AsyncClientConfigResourceWithStreamingResponse(self) - - async def update( - self, - *, - utilization_level: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CDNAccount: - """ - Change information about CDN service. - - Args: - utilization_level: CDN traffic usage limit in gigabytes. - - When the limit is reached, we will send an email notification. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._patch( - "/cdn/clients/me", - body=await async_maybe_transform( - {"utilization_level": utilization_level}, client_config_update_params.ClientConfigUpdateParams - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CDNAccount, - ) - - async def get( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CDNAccount: - """Get information about CDN service.""" - return await self._get( - "/cdn/clients/me", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CDNAccount, - ) - - async def replace( - self, - *, - utilization_level: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CDNAccount: - """ - Change information about CDN service. - - Args: - utilization_level: CDN traffic usage limit in gigabytes. - - When the limit is reached, we will send an email notification. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._put( - "/cdn/clients/me", - body=await async_maybe_transform( - {"utilization_level": utilization_level}, client_config_replace_params.ClientConfigReplaceParams - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CDNAccount, - ) - - -class ClientConfigResourceWithRawResponse: - def __init__(self, client_config: ClientConfigResource) -> None: - self._client_config = client_config - - self.update = to_raw_response_wrapper( - client_config.update, - ) - self.get = to_raw_response_wrapper( - client_config.get, - ) - self.replace = to_raw_response_wrapper( - client_config.replace, - ) - - -class AsyncClientConfigResourceWithRawResponse: - def __init__(self, client_config: AsyncClientConfigResource) -> None: - self._client_config = client_config - - self.update = async_to_raw_response_wrapper( - client_config.update, - ) - self.get = async_to_raw_response_wrapper( - client_config.get, - ) - self.replace = async_to_raw_response_wrapper( - client_config.replace, - ) - - -class ClientConfigResourceWithStreamingResponse: - def __init__(self, client_config: ClientConfigResource) -> None: - self._client_config = client_config - - self.update = to_streamed_response_wrapper( - client_config.update, - ) - self.get = to_streamed_response_wrapper( - client_config.get, - ) - self.replace = to_streamed_response_wrapper( - client_config.replace, - ) - - -class AsyncClientConfigResourceWithStreamingResponse: - def __init__(self, client_config: AsyncClientConfigResource) -> None: - self._client_config = client_config - - self.update = async_to_streamed_response_wrapper( - client_config.update, - ) - self.get = async_to_streamed_response_wrapper( - client_config.get, - ) - self.replace = async_to_streamed_response_wrapper( - client_config.replace, - ) diff --git a/src/gcore/types/cdn/__init__.py b/src/gcore/types/cdn/__init__.py index 6b27c1f9..92895e33 100644 --- a/src/gcore/types/cdn/__init__.py +++ b/src/gcore/types/cdn/__init__.py @@ -52,12 +52,10 @@ from .origin_group_create_params import OriginGroupCreateParams as OriginGroupCreateParams from .origin_group_update_params import OriginGroupUpdateParams as OriginGroupUpdateParams from .cdn_resource_replace_params import CDNResourceReplaceParams as CDNResourceReplaceParams -from .client_config_update_params import ClientConfigUpdateParams as ClientConfigUpdateParams from .origin_group_replace_params import OriginGroupReplaceParams as OriginGroupReplaceParams from .rule_template_create_params import RuleTemplateCreateParams as RuleTemplateCreateParams from .rule_template_update_params import RuleTemplateUpdateParams as RuleTemplateUpdateParams from .cdn_resource_prefetch_params import CDNResourcePrefetchParams as CDNResourcePrefetchParams -from .client_config_replace_params import ClientConfigReplaceParams as ClientConfigReplaceParams from .rule_template_replace_params import RuleTemplateReplaceParams as RuleTemplateReplaceParams from .certificate_get_status_params import CertificateGetStatusParams as CertificateGetStatusParams from .cdn_list_purge_statuses_params import CDNListPurgeStatusesParams as CDNListPurgeStatusesParams diff --git a/src/gcore/types/cdn/client_config_replace_params.py b/src/gcore/types/cdn/client_config_replace_params.py deleted file mode 100644 index a604b93b..00000000 --- a/src/gcore/types/cdn/client_config_replace_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["ClientConfigReplaceParams"] - - -class ClientConfigReplaceParams(TypedDict, total=False): - utilization_level: int - """CDN traffic usage limit in gigabytes. - - When the limit is reached, we will send an email notification. - """ diff --git a/src/gcore/types/cdn/client_config_update_params.py b/src/gcore/types/cdn/client_config_update_params.py deleted file mode 100644 index 8f9f22a1..00000000 --- a/src/gcore/types/cdn/client_config_update_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["ClientConfigUpdateParams"] - - -class ClientConfigUpdateParams(TypedDict, total=False): - utilization_level: int - """CDN traffic usage limit in gigabytes. - - When the limit is reached, we will send an email notification. - """ diff --git a/tests/api_resources/cdn/test_client_config.py b/tests/api_resources/cdn/test_client_config.py deleted file mode 100644 index 3c296833..00000000 --- a/tests/api_resources/cdn/test_client_config.py +++ /dev/null @@ -1,202 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from gcore import Gcore, AsyncGcore -from tests.utils import assert_matches_type -from gcore.types.cdn import CDNAccount - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestClientConfig: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_update(self, client: Gcore) -> None: - client_config = client.cdn.client_config.update() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Gcore) -> None: - client_config = client.cdn.client_config.update( - utilization_level=1111, - ) - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Gcore) -> None: - response = client.cdn.client_config.with_raw_response.update() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - client_config = response.parse() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Gcore) -> None: - with client.cdn.client_config.with_streaming_response.update() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - client_config = response.parse() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_get(self, client: Gcore) -> None: - client_config = client.cdn.client_config.get() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Gcore) -> None: - response = client.cdn.client_config.with_raw_response.get() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - client_config = response.parse() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Gcore) -> None: - with client.cdn.client_config.with_streaming_response.get() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - client_config = response.parse() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_replace(self, client: Gcore) -> None: - client_config = client.cdn.client_config.replace() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - def test_method_replace_with_all_params(self, client: Gcore) -> None: - client_config = client.cdn.client_config.replace( - utilization_level=1111, - ) - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - def test_raw_response_replace(self, client: Gcore) -> None: - response = client.cdn.client_config.with_raw_response.replace() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - client_config = response.parse() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - def test_streaming_response_replace(self, client: Gcore) -> None: - with client.cdn.client_config.with_streaming_response.replace() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - client_config = response.parse() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncClientConfig: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_update(self, async_client: AsyncGcore) -> None: - client_config = await async_client.cdn.client_config.update() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - client_config = await async_client.cdn.client_config.update( - utilization_level=1111, - ) - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.client_config.with_raw_response.update() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - client_config = await response.parse() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.client_config.with_streaming_response.update() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - client_config = await response.parse() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_get(self, async_client: AsyncGcore) -> None: - client_config = await async_client.cdn.client_config.get() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.client_config.with_raw_response.get() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - client_config = await response.parse() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.client_config.with_streaming_response.get() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - client_config = await response.parse() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_replace(self, async_client: AsyncGcore) -> None: - client_config = await async_client.cdn.client_config.replace() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: - client_config = await async_client.cdn.client_config.replace( - utilization_level=1111, - ) - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.client_config.with_raw_response.replace() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - client_config = await response.parse() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - @parametrize - async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.client_config.with_streaming_response.replace() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - client_config = await response.parse() - assert_matches_type(CDNAccount, client_config, path=["response"]) - - assert cast(Any, response.is_closed) is True From 2efc73e2535afb6193e0c34646f3ab28b6b764cd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 14:28:57 +0000 Subject: [PATCH 568/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f46ecaf2..90034d6b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-bab3396466ec5b697c339ea24bd4489c07ff40d08091f4d4d263d247ef2b00bd.yml -openapi_spec_hash: c7d1eedcfa472650c54e9ec569383949 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69213ba68b3c49b799026d4eff31f8fcee0516596349629e0085447b2ee08807.yml +openapi_spec_hash: 2893764d7ffe22852b35a30344a79c6a config_hash: 841ecfe67afa779a3954fe8800ecb132 From 2eefd7179bbce8178f0c5e663844d42b3f32e9f2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 14:52:49 +0000 Subject: [PATCH 569/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 90034d6b..0d8ddfe6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69213ba68b3c49b799026d4eff31f8fcee0516596349629e0085447b2ee08807.yml -openapi_spec_hash: 2893764d7ffe22852b35a30344a79c6a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8c31abd1135e0eac90290da5a160e341a0d09ca3ca62191a13f079a0f958c0e3.yml +openapi_spec_hash: 3506ce6ee4d6f2057e02e656557ada57 config_hash: 841ecfe67afa779a3954fe8800ecb132 From 37527a7209517477b0b417e6e55cd2652a0ff18a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 16:57:27 +0000 Subject: [PATCH 570/592] chore: format all `api.md` files --- api.md | 2580 +------------------------- pyproject.toml | 2 +- src/gcore/resources/cdn/api.md | 308 +++ src/gcore/resources/cloud/api.md | 1181 ++++++++++++ src/gcore/resources/dns/api.md | 159 ++ src/gcore/resources/fastedge/api.md | 122 ++ src/gcore/resources/iam/api.md | 42 + src/gcore/resources/security/api.md | 55 + src/gcore/resources/storage/api.md | 97 + src/gcore/resources/streaming/api.md | 285 +++ src/gcore/resources/waap/api.md | 322 ++++ 11 files changed, 2581 insertions(+), 2572 deletions(-) create mode 100644 src/gcore/resources/cdn/api.md create mode 100644 src/gcore/resources/cloud/api.md create mode 100644 src/gcore/resources/dns/api.md create mode 100644 src/gcore/resources/fastedge/api.md create mode 100644 src/gcore/resources/iam/api.md create mode 100644 src/gcore/resources/security/api.md create mode 100644 src/gcore/resources/storage/api.md create mode 100644 src/gcore/resources/streaming/api.md create mode 100644 src/gcore/resources/waap/api.md diff --git a/api.md b/api.md index cbc93dbc..9faa9ce7 100644 --- a/api.md +++ b/api.md @@ -1,2579 +1,17 @@ -# Cloud +# [Cloud](src/gcore/resources/cloud/api.md) -Types: +# [Waap](src/gcore/resources/waap/api.md) -```python -from gcore.types.cloud import ( - AllowedAddressPairs, - BaremetalFlavor, - BaremetalFlavorList, - BlackholePort, - Console, - DDOSProfile, - DDOSProfileField, - DDOSProfileOptionList, - DDOSProfileStatus, - DDOSProfileTemplate, - DDOSProfileTemplateField, - FixedAddress, - FixedAddressShort, - FlavorHardwareDescription, - FloatingAddress, - FloatingIP, - FloatingIPStatus, - GPUImage, - GPUImageList, - HTTPMethod, - Image, - ImageList, - Instance, - InstanceIsolation, - InstanceList, - InstanceMetricsTimeUnit, - InterfaceIPFamily, - IPAssignment, - IPVersion, - LaasIndexRetentionPolicy, - LoadBalancer, - LoadBalancerInstanceRole, - LoadBalancerMemberConnectivity, - LoadBalancerOperatingStatus, - LoadBalancerStatistics, - Logging, - Network, - NetworkAnySubnetFip, - NetworkDetails, - NetworkInterface, - NetworkInterfaceList, - NetworkSubnetFip, - ProvisioningStatus, - Route, - Subnet, - Tag, - TagList, - TagUpdateMap, - TaskIDList, -) -``` +# [Iam](src/gcore/resources/iam/api.md) -## Projects +# [Fastedge](src/gcore/resources/fastedge/api.md) -Types: +# [Streaming](src/gcore/resources/streaming/api.md) -```python -from gcore.types.cloud import Project -``` +# [Security](src/gcore/resources/security/api.md) -Methods: +# [DNS](src/gcore/resources/dns/api.md) -- client.cloud.projects.create(\*\*params) -> Project -- client.cloud.projects.update(\*, project_id, \*\*params) -> Project -- client.cloud.projects.list(\*\*params) -> SyncOffsetPage[Project] -- client.cloud.projects.delete(\*, project_id) -> TaskIDList -- client.cloud.projects.get(\*, project_id) -> Project +# [Storage](src/gcore/resources/storage/api.md) -## Tasks - -Types: - -```python -from gcore.types.cloud import Task -``` - -Methods: - -- client.cloud.tasks.list(\*\*params) -> SyncOffsetPage[Task] -- client.cloud.tasks.acknowledge_all(\*\*params) -> None -- client.cloud.tasks.acknowledge_one(task_id) -> Task -- client.cloud.tasks.get(task_id) -> Task - -## Regions - -Types: - -```python -from gcore.types.cloud import Region -``` - -Methods: - -- client.cloud.regions.list(\*\*params) -> SyncOffsetPage[Region] -- client.cloud.regions.get(\*, region_id, \*\*params) -> Region - -## Quotas - -Types: - -```python -from gcore.types.cloud import QuotaGetAllResponse, QuotaGetByRegionResponse, QuotaGetGlobalResponse -``` - -Methods: - -- client.cloud.quotas.get_all() -> QuotaGetAllResponse -- client.cloud.quotas.get_by_region(\*, client_id, region_id) -> QuotaGetByRegionResponse -- client.cloud.quotas.get_global(client_id) -> QuotaGetGlobalResponse - -### Requests - -Types: - -```python -from gcore.types.cloud.quotas import RequestListResponse, RequestGetResponse -``` - -Methods: - -- client.cloud.quotas.requests.create(\*\*params) -> None -- client.cloud.quotas.requests.list(\*\*params) -> SyncOffsetPage[RequestListResponse] -- client.cloud.quotas.requests.delete(request_id) -> None -- client.cloud.quotas.requests.get(request_id) -> RequestGetResponse - -## Secrets - -Types: - -```python -from gcore.types.cloud import Secret -``` - -Methods: - -- client.cloud.secrets.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Secret] -- client.cloud.secrets.delete(secret_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.secrets.get(secret_id, \*, project_id, region_id) -> Secret -- client.cloud.secrets.upload_tls_certificate(\*, project_id, region_id, \*\*params) -> TaskIDList - -## SSHKeys - -Types: - -```python -from gcore.types.cloud import SSHKey, SSHKeyCreated -``` - -Methods: - -- client.cloud.ssh_keys.create(\*, project_id, \*\*params) -> SSHKeyCreated -- 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 -- client.cloud.ssh_keys.get(ssh_key_id, \*, project_id) -> SSHKey - -## IPRanges - -Types: - -```python -from gcore.types.cloud import IPRanges -``` - -Methods: - -- client.cloud.ip_ranges.list() -> IPRanges - -## LoadBalancers - -Types: - -```python -from gcore.types.cloud import ( - HealthMonitor, - HealthMonitorStatus, - LbAlgorithm, - LbHealthMonitorType, - LbListenerProtocol, - LbPoolProtocol, - LbSessionPersistenceType, - ListenerStatus, - LoadBalancerFlavorDetail, - LoadBalancerFlavorList, - LoadBalancerL7Policy, - LoadBalancerL7PolicyList, - LoadBalancerL7Rule, - LoadBalancerL7RuleList, - LoadBalancerListenerDetail, - LoadBalancerListenerList, - LoadBalancerMetrics, - LoadBalancerMetricsList, - LoadBalancerPool, - LoadBalancerPoolList, - LoadBalancerStatus, - LoadBalancerStatusList, - Member, - MemberStatus, - PoolStatus, - SessionPersistence, -) -``` - -Methods: - -- client.cloud.load_balancers.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.update(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer -- client.cloud.load_balancers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[LoadBalancer] -- client.cloud.load_balancers.delete(load_balancer_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.load_balancers.failover(load_balancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.get(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer -- client.cloud.load_balancers.resize(load_balancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList - -### L7Policies - -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 - -#### Rules - -Methods: - -- client.cloud.load_balancers.l7_policies.rules.create(l7policy_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.l7_policies.rules.list(l7policy_id, \*, project_id, region_id) -> LoadBalancerL7RuleList -- client.cloud.load_balancers.l7_policies.rules.delete(l7rule_id, \*, project_id, region_id, l7policy_id) -> TaskIDList -- client.cloud.load_balancers.l7_policies.rules.get(l7rule_id, \*, project_id, region_id, l7policy_id) -> LoadBalancerL7Rule -- client.cloud.load_balancers.l7_policies.rules.replace(l7rule_id, \*, project_id, region_id, l7policy_id, \*\*params) -> TaskIDList - -### Flavors - -Methods: - -- client.cloud.load_balancers.flavors.list(\*, project_id, region_id, \*\*params) -> LoadBalancerFlavorList - -### Listeners - -Methods: - -- client.cloud.load_balancers.listeners.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.listeners.update(listener_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.listeners.list(\*, project_id, region_id, \*\*params) -> LoadBalancerListenerList -- client.cloud.load_balancers.listeners.delete(listener_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.listeners.get(listener_id, \*, project_id, region_id, \*\*params) -> LoadBalancerListenerDetail - -### Pools - -Methods: - -- client.cloud.load_balancers.pools.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.pools.update(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.pools.list(\*, project_id, region_id, \*\*params) -> LoadBalancerPoolList -- client.cloud.load_balancers.pools.delete(pool_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.load_balancers.pools.get(pool_id, \*, project_id, region_id) -> LoadBalancerPool - -#### HealthMonitors - -Methods: - -- client.cloud.load_balancers.pools.health_monitors.create(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.pools.health_monitors.delete(pool_id, \*, project_id, region_id) -> None - -#### Members - -Methods: - -- 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 - -Methods: - -- client.cloud.load_balancers.metrics.list(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancerMetricsList - -### Statuses - -Methods: - -- client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> LoadBalancerStatusList -- client.cloud.load_balancers.statuses.get(load_balancer_id, \*, project_id, region_id) -> LoadBalancerStatus - -## ReservedFixedIPs - -Types: - -```python -from gcore.types.cloud import ReservedFixedIP -``` - -Methods: - -- client.cloud.reserved_fixed_ips.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.reserved_fixed_ips.update(port_id, \*, project_id, region_id, \*\*params) -> ReservedFixedIP -- client.cloud.reserved_fixed_ips.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[ReservedFixedIP] -- client.cloud.reserved_fixed_ips.delete(port_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.reserved_fixed_ips.get(port_id, \*, project_id, region_id) -> ReservedFixedIP - -### Vip - -Types: - -```python -from gcore.types.cloud.reserved_fixed_ips import IPWithSubnet -``` - -Methods: - -- client.cloud.reserved_fixed_ips.vip.toggle(port_id, \*, project_id, region_id, \*\*params) -> ReservedFixedIP - -#### CandidatePorts - -Types: - -```python -from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePort, CandidatePortList -``` - -Methods: - -- client.cloud.reserved_fixed_ips.vip.candidate_ports.list(port_id, \*, project_id, region_id) -> CandidatePortList - -#### ConnectedPorts - -Types: - -```python -from gcore.types.cloud.reserved_fixed_ips.vip import ConnectedPort, ConnectedPortList -``` - -Methods: - -- client.cloud.reserved_fixed_ips.vip.connected_ports.list(port_id, \*, project_id, region_id) -> ConnectedPortList -- client.cloud.reserved_fixed_ips.vip.connected_ports.add(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList -- client.cloud.reserved_fixed_ips.vip.connected_ports.replace(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList - -## Networks - -Methods: - -- client.cloud.networks.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.networks.update(network_id, \*, project_id, region_id, \*\*params) -> Network -- client.cloud.networks.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Network] -- client.cloud.networks.delete(network_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.networks.get(network_id, \*, project_id, region_id) -> Network - -### Subnets - -Methods: - -- client.cloud.networks.subnets.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.networks.subnets.update(subnet_id, \*, project_id, region_id, \*\*params) -> Subnet -- client.cloud.networks.subnets.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Subnet] -- client.cloud.networks.subnets.delete(subnet_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.networks.subnets.get(subnet_id, \*, project_id, region_id) -> Subnet - -### Routers - -Types: - -```python -from gcore.types.cloud.networks import Router, RouterList, SubnetID -``` - -Methods: - -- client.cloud.networks.routers.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.networks.routers.update(router_id, \*, project_id, region_id, \*\*params) -> Router -- client.cloud.networks.routers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Router] -- client.cloud.networks.routers.delete(router_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.networks.routers.attach_subnet(router_id, \*, project_id, region_id, \*\*params) -> Router -- client.cloud.networks.routers.detach_subnet(router_id, \*, project_id, region_id, \*\*params) -> Router -- client.cloud.networks.routers.get(router_id, \*, project_id, region_id) -> Router - -## Volumes - -Types: - -```python -from gcore.types.cloud import Volume -``` - -Methods: - -- client.cloud.volumes.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.volumes.update(volume_id, \*, project_id, region_id, \*\*params) -> Volume -- client.cloud.volumes.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Volume] -- client.cloud.volumes.delete(volume_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.volumes.attach_to_instance(volume_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.volumes.change_type(volume_id, \*, project_id, region_id, \*\*params) -> Volume -- client.cloud.volumes.detach_from_instance(volume_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.volumes.get(volume_id, \*, project_id, region_id) -> Volume -- client.cloud.volumes.resize(volume_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.volumes.revert_to_last_snapshot(volume_id, \*, project_id, region_id) -> None - -## FloatingIPs - -Types: - -```python -from gcore.types.cloud import FloatingIPDetailed -``` - -Methods: - -- client.cloud.floating_ips.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.floating_ips.update(floating_ip_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.floating_ips.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[FloatingIPDetailed] -- client.cloud.floating_ips.delete(floating_ip_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.floating_ips.assign(floating_ip_id, \*, project_id, region_id, \*\*params) -> FloatingIP -- client.cloud.floating_ips.get(floating_ip_id, \*, project_id, region_id) -> FloatingIP -- client.cloud.floating_ips.unassign(floating_ip_id, \*, project_id, region_id) -> FloatingIP - -## SecurityGroups - -Types: - -```python -from gcore.types.cloud import SecurityGroup, SecurityGroupRule -``` - -Methods: - -- client.cloud.security_groups.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.security_groups.update(group_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.security_groups.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[SecurityGroup] -- client.cloud.security_groups.delete(group_id, \*, project_id, region_id) -> None -- client.cloud.security_groups.copy(group_id, \*, project_id, region_id, \*\*params) -> SecurityGroup -- client.cloud.security_groups.get(group_id, \*, project_id, region_id) -> SecurityGroup -- client.cloud.security_groups.revert_to_default(group_id, \*, project_id, region_id) -> SecurityGroup - -### Rules - -Methods: - -- client.cloud.security_groups.rules.create(group_id, \*, project_id, region_id, \*\*params) -> SecurityGroupRule -- client.cloud.security_groups.rules.delete(rule_id, \*, project_id, region_id) -> None -- client.cloud.security_groups.rules.replace(rule_id, \*, project_id, region_id, \*\*params) -> SecurityGroupRule - -## Users - -### RoleAssignments - -Types: - -```python -from gcore.types.cloud.users import RoleAssignment, RoleAssignmentUpdatedDeleted -``` - -Methods: - -- client.cloud.users.role_assignments.create(\*\*params) -> RoleAssignment -- client.cloud.users.role_assignments.update(assignment_id, \*\*params) -> RoleAssignmentUpdatedDeleted -- client.cloud.users.role_assignments.list(\*\*params) -> SyncOffsetPage[RoleAssignment] -- client.cloud.users.role_assignments.delete(assignment_id) -> RoleAssignmentUpdatedDeleted - -## Inference - -Types: - -```python -from gcore.types.cloud import InferenceRegionCapacity, InferenceRegionCapacityList -``` - -Methods: - -- client.cloud.inference.get_capacity_by_region() -> InferenceRegionCapacityList - -### Flavors - -Types: - -```python -from gcore.types.cloud.inference import InferenceFlavor -``` - -Methods: - -- client.cloud.inference.flavors.list(\*\*params) -> SyncOffsetPage[InferenceFlavor] -- client.cloud.inference.flavors.get(flavor_name) -> InferenceFlavor - -### Deployments - -Types: - -```python -from gcore.types.cloud.inference import ( - InferenceDeployment, - InferenceDeploymentAPIKey, - Probe, - ProbeConfig, - ProbeExec, - ProbeHTTPGet, - ProbeTcpSocket, -) -``` - -Methods: - -- client.cloud.inference.deployments.create(\*, project_id, \*\*params) -> TaskIDList -- client.cloud.inference.deployments.update(deployment_name, \*, project_id, \*\*params) -> TaskIDList -- client.cloud.inference.deployments.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceDeployment] -- client.cloud.inference.deployments.delete(deployment_name, \*, project_id) -> TaskIDList -- client.cloud.inference.deployments.get(deployment_name, \*, project_id) -> InferenceDeployment -- client.cloud.inference.deployments.get_api_key(deployment_name, \*, project_id) -> InferenceDeploymentAPIKey -- client.cloud.inference.deployments.start(deployment_name, \*, project_id) -> None -- client.cloud.inference.deployments.stop(deployment_name, \*, project_id) -> None - -#### Logs - -Types: - -```python -from gcore.types.cloud.inference.deployments import InferenceDeploymentLog -``` - -Methods: - -- client.cloud.inference.deployments.logs.list(deployment_name, \*, project_id, \*\*params) -> SyncOffsetPage[InferenceDeploymentLog] - -### RegistryCredentials - -Types: - -```python -from gcore.types.cloud.inference import InferenceRegistryCredentials -``` - -Methods: - -- client.cloud.inference.registry_credentials.create(\*, project_id, \*\*params) -> InferenceRegistryCredentials -- client.cloud.inference.registry_credentials.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceRegistryCredentials] -- client.cloud.inference.registry_credentials.delete(credential_name, \*, project_id) -> None -- client.cloud.inference.registry_credentials.get(credential_name, \*, project_id) -> InferenceRegistryCredentials -- client.cloud.inference.registry_credentials.replace(credential_name, \*, project_id, \*\*params) -> InferenceRegistryCredentials - -### Secrets - -Types: - -```python -from gcore.types.cloud.inference import InferenceSecret -``` - -Methods: - -- client.cloud.inference.secrets.create(\*, project_id, \*\*params) -> InferenceSecret -- client.cloud.inference.secrets.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceSecret] -- client.cloud.inference.secrets.delete(secret_name, \*, project_id) -> None -- client.cloud.inference.secrets.get(secret_name, \*, project_id) -> InferenceSecret -- client.cloud.inference.secrets.replace(secret_name, \*, project_id, \*\*params) -> InferenceSecret - -### APIKeys - -Types: - -```python -from gcore.types.cloud.inference import InferenceAPIKey, InferenceAPIKeyCreated -``` - -Methods: - -- client.cloud.inference.api_keys.create(\*, project_id, \*\*params) -> InferenceAPIKeyCreated -- client.cloud.inference.api_keys.update(api_key_name, \*, project_id, \*\*params) -> InferenceAPIKey -- client.cloud.inference.api_keys.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceAPIKey] -- client.cloud.inference.api_keys.delete(api_key_name, \*, project_id) -> None -- client.cloud.inference.api_keys.get(api_key_name, \*, project_id) -> InferenceAPIKey - -### Applications - -#### Deployments - -Types: - -```python -from gcore.types.cloud.inference.applications import ( - InferenceApplicationDeployment, - InferenceApplicationDeploymentList, -) -``` - -Methods: - -- client.cloud.inference.applications.deployments.create(\*, project_id, \*\*params) -> TaskIDList -- client.cloud.inference.applications.deployments.update(deployment_name, \*, project_id, \*\*params) -> TaskIDList -- client.cloud.inference.applications.deployments.list(\*, project_id) -> InferenceApplicationDeploymentList -- client.cloud.inference.applications.deployments.delete(deployment_name, \*, project_id) -> TaskIDList -- client.cloud.inference.applications.deployments.get(deployment_name, \*, project_id) -> InferenceApplicationDeployment - -#### Templates - -Types: - -```python -from gcore.types.cloud.inference.applications import ( - InferenceApplicationTemplate, - InferenceApplicationTemplateList, -) -``` - -Methods: - -- client.cloud.inference.applications.templates.list() -> InferenceApplicationTemplateList -- client.cloud.inference.applications.templates.get(application_name) -> InferenceApplicationTemplate - -## PlacementGroups - -Types: - -```python -from gcore.types.cloud import PlacementGroup, PlacementGroupList -``` - -Methods: - -- client.cloud.placement_groups.create(\*, project_id, region_id, \*\*params) -> PlacementGroup -- client.cloud.placement_groups.list(\*, project_id, region_id) -> PlacementGroupList -- client.cloud.placement_groups.delete(group_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.placement_groups.get(group_id, \*, project_id, region_id) -> PlacementGroup - -## Baremetal - -### Images - -Methods: - -- client.cloud.baremetal.images.list(\*, project_id, region_id, \*\*params) -> ImageList - -### Flavors - -Methods: - -- client.cloud.baremetal.flavors.list(\*, project_id, region_id, \*\*params) -> BaremetalFlavorList - -### Servers - -Types: - -```python -from gcore.types.cloud.baremetal import ( - BaremetalFixedAddress, - BaremetalFloatingAddress, - BaremetalServer, -) -``` - -Methods: - -- client.cloud.baremetal.servers.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.baremetal.servers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[BaremetalServer] -- client.cloud.baremetal.servers.rebuild(server_id, \*, project_id, region_id, \*\*params) -> TaskIDList - -## Registries - -Types: - -```python -from gcore.types.cloud import Registry, RegistryList, RegistryTag -``` - -Methods: - -- client.cloud.registries.create(\*, project_id, region_id, \*\*params) -> Registry -- client.cloud.registries.list(\*, project_id, region_id) -> RegistryList -- client.cloud.registries.delete(registry_id, \*, project_id, region_id) -> None -- client.cloud.registries.get(registry_id, \*, project_id, region_id) -> Registry -- client.cloud.registries.resize(registry_id, \*, project_id, region_id, \*\*params) -> Registry - -### Repositories - -Types: - -```python -from gcore.types.cloud.registries import RegistryRepository, RegistryRepositoryList -``` - -Methods: - -- client.cloud.registries.repositories.list(registry_id, \*, project_id, region_id) -> RegistryRepositoryList -- client.cloud.registries.repositories.delete(repository_name, \*, project_id, region_id, registry_id) -> None - -### Artifacts - -Types: - -```python -from gcore.types.cloud.registries import RegistryArtifact, RegistryArtifactList -``` - -Methods: - -- client.cloud.registries.artifacts.list(repository_name, \*, project_id, region_id, registry_id) -> RegistryArtifactList -- client.cloud.registries.artifacts.delete(digest, \*, project_id, region_id, registry_id, repository_name) -> None - -### Tags - -Methods: - -- client.cloud.registries.tags.delete(tag_name, \*, project_id, region_id, registry_id, repository_name, digest) -> None - -### Users - -Types: - -```python -from gcore.types.cloud.registries import ( - RegistryUser, - RegistryUserCreated, - RegistryUserList, - UserRefreshSecretResponse, -) -``` - -Methods: - -- client.cloud.registries.users.create(registry_id, \*, project_id, region_id, \*\*params) -> RegistryUserCreated -- 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.refresh_secret(user_id, \*, project_id, region_id, registry_id) -> UserRefreshSecretResponse - -## FileShares - -Types: - -```python -from gcore.types.cloud import FileShare -``` - -Methods: - -- client.cloud.file_shares.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.file_shares.update(file_share_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.file_shares.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[FileShare] -- client.cloud.file_shares.delete(file_share_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.file_shares.get(file_share_id, \*, project_id, region_id) -> FileShare -- client.cloud.file_shares.resize(file_share_id, \*, project_id, region_id, \*\*params) -> TaskIDList - -### AccessRules - -Types: - -```python -from gcore.types.cloud.file_shares import AccessRule, AccessRuleList -``` - -Methods: - -- client.cloud.file_shares.access_rules.create(file_share_id, \*, project_id, region_id, \*\*params) -> AccessRule -- client.cloud.file_shares.access_rules.list(file_share_id, \*, project_id, region_id) -> AccessRuleList -- client.cloud.file_shares.access_rules.delete(access_rule_id, \*, project_id, region_id, file_share_id) -> None - -## BillingReservations - -Types: - -```python -from gcore.types.cloud import BillingReservation, BillingReservations -``` - -Methods: - -- client.cloud.billing_reservations.list(\*\*params) -> BillingReservations - -## GPUBaremetal - -### Clusters - -Types: - -```python -from gcore.types.cloud.gpu_baremetal import GPUBaremetalCluster -``` - -Methods: - -- client.cloud.gpu_baremetal.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal.clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalCluster] -- client.cloud.gpu_baremetal.clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal.clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal.clusters.get(cluster_id, \*, project_id, region_id) -> GPUBaremetalCluster -- client.cloud.gpu_baremetal.clusters.powercycle_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List -- client.cloud.gpu_baremetal.clusters.reboot_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List -- client.cloud.gpu_baremetal.clusters.rebuild(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal.clusters.resize(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList - -#### Interfaces - -Methods: - -- client.cloud.gpu_baremetal.clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> NetworkInterfaceList -- client.cloud.gpu_baremetal.clusters.interfaces.attach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal.clusters.interfaces.detach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList - -#### Servers - -Types: - -```python -from gcore.types.cloud.gpu_baremetal.clusters import ( - GPUBaremetalClusterServer, - GPUBaremetalClusterServerV1, - GPUBaremetalClusterServerV1List, -) -``` - -Methods: - -- client.cloud.gpu_baremetal.clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalClusterServer] -- client.cloud.gpu_baremetal.clusters.servers.delete(instance_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal.clusters.servers.get_console(instance_id, \*, project_id, region_id) -> Console -- client.cloud.gpu_baremetal.clusters.servers.powercycle(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 -- client.cloud.gpu_baremetal.clusters.servers.reboot(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 - -#### Flavors - -Types: - -```python -from gcore.types.cloud.gpu_baremetal.clusters import GPUBaremetalFlavor, GPUBaremetalFlavorList -``` - -Methods: - -- client.cloud.gpu_baremetal.clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUBaremetalFlavorList - -#### Images - -Methods: - -- client.cloud.gpu_baremetal.clusters.images.list(\*, project_id, region_id) -> GPUImageList -- client.cloud.gpu_baremetal.clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.gpu_baremetal.clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage -- client.cloud.gpu_baremetal.clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList - -## GPUVirtual - -### Clusters - -Types: - -```python -from gcore.types.cloud.gpu_virtual import GPUVirtualCluster -``` - -Methods: - -- client.cloud.gpu_virtual.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_virtual.clusters.update(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualCluster -- client.cloud.gpu_virtual.clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUVirtualCluster] -- client.cloud.gpu_virtual.clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_virtual.clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_virtual.clusters.get(cluster_id, \*, project_id, region_id) -> GPUVirtualCluster - -#### Servers - -Types: - -```python -from gcore.types.cloud.gpu_virtual.clusters import ( - GPUVirtualClusterServer, - GPUVirtualClusterServerList, -) -``` - -Methods: - -- client.cloud.gpu_virtual.clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualClusterServerList -- client.cloud.gpu_virtual.clusters.servers.delete(server_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList - -#### Volumes - -Types: - -```python -from gcore.types.cloud.gpu_virtual.clusters import ( - GPUVirtualClusterVolume, - GPUVirtualClusterVolumeList, -) -``` - -Methods: - -- client.cloud.gpu_virtual.clusters.volumes.list(cluster_id, \*, project_id, region_id) -> GPUVirtualClusterVolumeList - -#### Interfaces - -Types: - -```python -from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualInterface, GPUVirtualInterfaceList -``` - -Methods: - -- client.cloud.gpu_virtual.clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> GPUVirtualInterfaceList - -#### Flavors - -Types: - -```python -from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualFlavor, GPUVirtualFlavorList -``` - -Methods: - -- client.cloud.gpu_virtual.clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUVirtualFlavorList - -#### Images - -Methods: - -- client.cloud.gpu_virtual.clusters.images.list(\*, project_id, region_id) -> GPUImageList -- client.cloud.gpu_virtual.clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.gpu_virtual.clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage -- client.cloud.gpu_virtual.clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList - -## Instances - -Types: - -```python -from gcore.types.cloud import InstanceInterface -``` - -Methods: - -- client.cloud.instances.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.instances.update(instance_id, \*, project_id, region_id, \*\*params) -> Instance -- client.cloud.instances.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Instance] -- client.cloud.instances.delete(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.instances.action(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.instances.add_to_placement_group(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.instances.assign_security_group(instance_id, \*, project_id, region_id, \*\*params) -> None -- client.cloud.instances.disable_port_security(port_id, \*, project_id, region_id) -> InstanceInterface -- client.cloud.instances.enable_port_security(port_id, \*, project_id, region_id) -> InstanceInterface -- client.cloud.instances.get(instance_id, \*, project_id, region_id) -> Instance -- client.cloud.instances.get_console(instance_id, \*, project_id, region_id, \*\*params) -> Console -- client.cloud.instances.remove_from_placement_group(instance_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.instances.resize(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.instances.unassign_security_group(instance_id, \*, project_id, region_id, \*\*params) -> None - -### Flavors - -Types: - -```python -from gcore.types.cloud.instances import InstanceFlavorDetailed, InstanceFlavorList -``` - -Methods: - -- client.cloud.instances.flavors.list(\*, project_id, region_id, \*\*params) -> InstanceFlavorList - -### Interfaces - -Methods: - -- client.cloud.instances.interfaces.list(instance_id, \*, project_id, region_id) -> NetworkInterfaceList -- client.cloud.instances.interfaces.attach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.instances.interfaces.detach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList - -### Images - -Methods: - -- client.cloud.instances.images.update(image_id, \*, project_id, region_id, \*\*params) -> Image -- client.cloud.instances.images.list(\*, project_id, region_id, \*\*params) -> ImageList -- client.cloud.instances.images.delete(image_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.instances.images.create_from_volume(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.instances.images.get(image_id, \*, project_id, region_id, \*\*params) -> Image -- client.cloud.instances.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList - -### Metrics - -Types: - -```python -from gcore.types.cloud.instances import Metrics, MetricsList -``` - -Methods: - -- client.cloud.instances.metrics.list(instance_id, \*, project_id, region_id, \*\*params) -> MetricsList - -## K8S - -Types: - -```python -from gcore.types.cloud import K8SClusterVersion, K8SClusterVersionList -``` - -Methods: - -- client.cloud.k8s.list_versions(\*, project_id, region_id) -> K8SClusterVersionList - -### Flavors - -Methods: - -- client.cloud.k8s.flavors.list(\*, project_id, region_id, \*\*params) -> BaremetalFlavorList - -### Clusters - -Types: - -```python -from gcore.types.cloud.k8s import ( - K8SCluster, - K8SClusterCertificate, - K8SClusterKubeconfig, - K8SClusterList, -) -``` - -Methods: - -- client.cloud.k8s.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.k8s.clusters.update(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.k8s.clusters.list(\*, project_id, region_id) -> K8SClusterList -- client.cloud.k8s.clusters.delete(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.k8s.clusters.get(cluster_name, \*, project_id, region_id) -> K8SCluster -- client.cloud.k8s.clusters.get_certificate(cluster_name, \*, project_id, region_id) -> K8SClusterCertificate -- client.cloud.k8s.clusters.get_kubeconfig(cluster_name, \*, project_id, region_id) -> K8SClusterKubeconfig -- client.cloud.k8s.clusters.list_versions_for_upgrade(cluster_name, \*, project_id, region_id) -> K8SClusterVersionList -- client.cloud.k8s.clusters.upgrade(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList - -#### Nodes - -Methods: - -- client.cloud.k8s.clusters.nodes.list(cluster_name, \*, project_id, region_id, \*\*params) -> InstanceList -- client.cloud.k8s.clusters.nodes.delete(instance_id, \*, project_id, region_id, cluster_name) -> None - -#### Pools - -Types: - -```python -from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolList, K8SClusterPoolQuota -``` - -Methods: - -- client.cloud.k8s.clusters.pools.create(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.k8s.clusters.pools.update(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> K8SClusterPool -- client.cloud.k8s.clusters.pools.list(cluster_name, \*, project_id, region_id) -> K8SClusterPoolList -- client.cloud.k8s.clusters.pools.delete(pool_name, \*, project_id, region_id, cluster_name) -> TaskIDList -- client.cloud.k8s.clusters.pools.check_quota(\*, project_id, region_id, \*\*params) -> K8SClusterPoolQuota -- client.cloud.k8s.clusters.pools.get(pool_name, \*, project_id, region_id, cluster_name) -> K8SClusterPool -- client.cloud.k8s.clusters.pools.resize(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> TaskIDList - -##### Nodes - -Methods: - -- client.cloud.k8s.clusters.pools.nodes.list(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> InstanceList -- client.cloud.k8s.clusters.pools.nodes.delete(instance_id, \*, project_id, region_id, cluster_name, pool_name) -> None - -## AuditLogs - -Types: - -```python -from gcore.types.cloud import AuditLogEntry -``` - -Methods: - -- client.cloud.audit_logs.list(\*\*params) -> SyncOffsetPage[AuditLogEntry] - -## CostReports - -Types: - -```python -from gcore.types.cloud import CostReportAggregated, CostReportAggregatedMonthly, CostReportDetailed -``` - -Methods: - -- client.cloud.cost_reports.get_aggregated(\*\*params) -> CostReportAggregated -- client.cloud.cost_reports.get_aggregated_monthly(\*\*params) -> CostReportAggregatedMonthly -- client.cloud.cost_reports.get_detailed(\*\*params) -> CostReportDetailed - -## UsageReports - -Types: - -```python -from gcore.types.cloud import UsageReport -``` - -Methods: - -- client.cloud.usage_reports.get(\*\*params) -> UsageReport - -## Databases - -### Postgres - -#### Clusters - -Types: - -```python -from gcore.types.cloud.databases.postgres import PostgresCluster, PostgresClusterShort -``` - -Methods: - -- client.cloud.databases.postgres.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.databases.postgres.clusters.update(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.databases.postgres.clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[PostgresClusterShort] -- client.cloud.databases.postgres.clusters.delete(cluster_name, \*, project_id, region_id) -> TaskIDList -- client.cloud.databases.postgres.clusters.get(cluster_name, \*, project_id, region_id) -> PostgresCluster - -##### UserCredentials - -Types: - -```python -from gcore.types.cloud.databases.postgres.clusters import PostgresUserCredentials -``` - -Methods: - -- client.cloud.databases.postgres.clusters.user_credentials.get(username, \*, project_id, region_id, cluster_name) -> PostgresUserCredentials -- client.cloud.databases.postgres.clusters.user_credentials.regenerate(username, \*, project_id, region_id, cluster_name) -> PostgresUserCredentials - -#### Configurations - -Types: - -```python -from gcore.types.cloud.databases.postgres import PostgresConfiguration -``` - -Methods: - -- client.cloud.databases.postgres.configurations.get(\*, project_id, region_id) -> PostgresConfiguration - -#### CustomConfigurations - -Types: - -```python -from gcore.types.cloud.databases.postgres import PgConfValidation -``` - -Methods: - -- client.cloud.databases.postgres.custom_configurations.validate(\*, project_id, region_id, \*\*params) -> PgConfValidation - -## VolumeSnapshots - -Types: - -```python -from gcore.types.cloud import Snapshot -``` - -Methods: - -- client.cloud.volume_snapshots.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.volume_snapshots.update(snapshot_id, \*, project_id, region_id, \*\*params) -> Snapshot -- client.cloud.volume_snapshots.delete(snapshot_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.volume_snapshots.get(snapshot_id, \*, project_id, region_id) -> Snapshot - -# Waap - -Types: - -```python -from gcore.types.waap import WaapGetAccountOverviewResponse -``` - -Methods: - -- client.waap.get_account_overview() -> WaapGetAccountOverviewResponse - -## Statistics - -Types: - -```python -from gcore.types.waap import WaapStatisticItem, WaapStatisticsSeries -``` - -Methods: - -- client.waap.statistics.get_usage_series(\*\*params) -> WaapStatisticsSeries - -## Domains - -Types: - -```python -from gcore.types.waap import ( - WaapDetailedDomain, - WaapDomainAPISettings, - WaapDomainDDOSSettings, - WaapDomainSettingsModel, - WaapPolicyMode, - WaapRuleSet, - WaapSummaryDomain, - DomainListRuleSetsResponse, -) -``` - -Methods: - -- client.waap.domains.update(domain_id, \*\*params) -> None -- client.waap.domains.list(\*\*params) -> SyncOffsetPage[WaapSummaryDomain] -- client.waap.domains.delete(domain_id) -> None -- client.waap.domains.get(domain_id) -> WaapDetailedDomain -- client.waap.domains.list_rule_sets(domain_id) -> DomainListRuleSetsResponse -- client.waap.domains.toggle_policy(policy_id, \*, domain_id) -> WaapPolicyMode - -### Settings - -Methods: - -- client.waap.domains.settings.update(domain_id, \*\*params) -> None -- client.waap.domains.settings.get(domain_id) -> WaapDomainSettingsModel - -### APIPaths - -Types: - -```python -from gcore.types.waap.domains import WaapAPIPath -``` - -Methods: - -- client.waap.domains.api_paths.create(domain_id, \*\*params) -> WaapAPIPath -- client.waap.domains.api_paths.update(path_id, \*, domain_id, \*\*params) -> None -- client.waap.domains.api_paths.list(domain_id, \*\*params) -> SyncOffsetPage[WaapAPIPath] -- client.waap.domains.api_paths.delete(path_id, \*, domain_id) -> None -- client.waap.domains.api_paths.get(path_id, \*, domain_id) -> WaapAPIPath - -### APIPathGroups - -Types: - -```python -from gcore.types.waap.domains import APIPathGroupList -``` - -Methods: - -- client.waap.domains.api_path_groups.list(domain_id) -> APIPathGroupList - -### APIDiscovery - -Types: - -```python -from gcore.types.waap.domains import WaapAPIDiscoverySettings, WaapAPIScanResult, WaapTaskID -``` - -Methods: - -- client.waap.domains.api_discovery.get_scan_result(scan_id, \*, domain_id) -> WaapAPIScanResult -- client.waap.domains.api_discovery.get_settings(domain_id) -> WaapAPIDiscoverySettings -- client.waap.domains.api_discovery.list_scan_results(domain_id, \*\*params) -> SyncOffsetPage[WaapAPIScanResult] -- client.waap.domains.api_discovery.scan_openapi(domain_id) -> WaapTaskID -- client.waap.domains.api_discovery.update_settings(domain_id, \*\*params) -> WaapAPIDiscoverySettings -- client.waap.domains.api_discovery.upload_openapi(domain_id, \*\*params) -> WaapTaskID - -### Insights - -Types: - -```python -from gcore.types.waap.domains import WaapInsight -``` - -Methods: - -- client.waap.domains.insights.list(domain_id, \*\*params) -> SyncOffsetPage[WaapInsight] -- client.waap.domains.insights.get(insight_id, \*, domain_id) -> WaapInsight -- client.waap.domains.insights.replace(insight_id, \*, domain_id, \*\*params) -> WaapInsight - -### InsightSilences - -Types: - -```python -from gcore.types.waap.domains import WaapInsightSilence -``` - -Methods: - -- client.waap.domains.insight_silences.create(domain_id, \*\*params) -> WaapInsightSilence -- client.waap.domains.insight_silences.update(silence_id, \*, domain_id, \*\*params) -> WaapInsightSilence -- client.waap.domains.insight_silences.list(domain_id, \*\*params) -> SyncOffsetPage[WaapInsightSilence] -- client.waap.domains.insight_silences.delete(silence_id, \*, domain_id) -> None -- client.waap.domains.insight_silences.get(silence_id, \*, domain_id) -> WaapInsightSilence - -### Statistics - -Types: - -```python -from gcore.types.waap.domains import ( - WaapBlockedStatistics, - WaapCountStatistics, - WaapDDOSAttack, - WaapDDOSInfo, - WaapEventStatistics, - WaapRequestDetails, - WaapRequestSummary, - WaapTrafficMetrics, - StatisticGetTrafficSeriesResponse, -) -``` - -Methods: - -- client.waap.domains.statistics.get_ddos_attacks(domain_id, \*\*params) -> SyncOffsetPage[WaapDDOSAttack] -- client.waap.domains.statistics.get_ddos_info(domain_id, \*\*params) -> SyncOffsetPage[WaapDDOSInfo] -- client.waap.domains.statistics.get_events_aggregated(domain_id, \*\*params) -> WaapEventStatistics -- client.waap.domains.statistics.get_request_details(request_id, \*, domain_id) -> WaapRequestDetails -- client.waap.domains.statistics.get_requests_series(domain_id, \*\*params) -> SyncOffsetPage[WaapRequestSummary] -- client.waap.domains.statistics.get_traffic_series(domain_id, \*\*params) -> StatisticGetTrafficSeriesResponse - -### CustomRules - -Types: - -```python -from gcore.types.waap.domains import WaapCustomRule -``` - -Methods: - -- client.waap.domains.custom_rules.create(domain_id, \*\*params) -> WaapCustomRule -- client.waap.domains.custom_rules.update(rule_id, \*, domain_id, \*\*params) -> None -- client.waap.domains.custom_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapCustomRule] -- client.waap.domains.custom_rules.delete(rule_id, \*, domain_id) -> None -- client.waap.domains.custom_rules.delete_multiple(domain_id, \*\*params) -> None -- client.waap.domains.custom_rules.get(rule_id, \*, domain_id) -> WaapCustomRule -- client.waap.domains.custom_rules.toggle(action, \*, domain_id, rule_id) -> None - -### FirewallRules - -Types: - -```python -from gcore.types.waap.domains import WaapFirewallRule -``` - -Methods: - -- client.waap.domains.firewall_rules.create(domain_id, \*\*params) -> WaapFirewallRule -- client.waap.domains.firewall_rules.update(rule_id, \*, domain_id, \*\*params) -> None -- client.waap.domains.firewall_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapFirewallRule] -- client.waap.domains.firewall_rules.delete(rule_id, \*, domain_id) -> None -- client.waap.domains.firewall_rules.delete_multiple(domain_id, \*\*params) -> None -- client.waap.domains.firewall_rules.get(rule_id, \*, domain_id) -> WaapFirewallRule -- client.waap.domains.firewall_rules.toggle(action, \*, domain_id, rule_id) -> None - -### AdvancedRules - -Types: - -```python -from gcore.types.waap.domains import WaapAdvancedRule -``` - -Methods: - -- client.waap.domains.advanced_rules.create(domain_id, \*\*params) -> WaapAdvancedRule -- client.waap.domains.advanced_rules.update(rule_id, \*, domain_id, \*\*params) -> None -- client.waap.domains.advanced_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapAdvancedRule] -- client.waap.domains.advanced_rules.delete(rule_id, \*, domain_id) -> None -- client.waap.domains.advanced_rules.get(rule_id, \*, domain_id) -> WaapAdvancedRule -- client.waap.domains.advanced_rules.toggle(action, \*, domain_id, rule_id) -> None - -## CustomPageSets - -Types: - -```python -from gcore.types.waap import WaapCustomPagePreview, WaapCustomPageSet -``` - -Methods: - -- client.waap.custom_page_sets.create(\*\*params) -> WaapCustomPageSet -- client.waap.custom_page_sets.update(set_id, \*\*params) -> None -- client.waap.custom_page_sets.list(\*\*params) -> SyncOffsetPage[WaapCustomPageSet] -- client.waap.custom_page_sets.delete(set_id) -> None -- client.waap.custom_page_sets.get(set_id) -> WaapCustomPageSet -- client.waap.custom_page_sets.preview(\*\*params) -> WaapCustomPagePreview - -## AdvancedRules - -Types: - -```python -from gcore.types.waap import WaapAdvancedRuleDescriptor, WaapAdvancedRuleDescriptorList -``` - -Methods: - -- client.waap.advanced_rules.list() -> WaapAdvancedRuleDescriptorList - -## Tags - -Types: - -```python -from gcore.types.waap import WaapTag -``` - -Methods: - -- client.waap.tags.list(\*\*params) -> SyncOffsetPage[WaapTag] - -## Organizations - -Types: - -```python -from gcore.types.waap import WaapOrganization -``` - -Methods: - -- client.waap.organizations.list(\*\*params) -> SyncOffsetPage[WaapOrganization] - -## Insights - -Types: - -```python -from gcore.types.waap import WaapInsightType -``` - -Methods: - -- client.waap.insights.list_types(\*\*params) -> SyncOffsetPage[WaapInsightType] - -## IPInfo - -Types: - -```python -from gcore.types.waap import ( - WaapIPCountryAttack, - WaapIPDDOSInfoModel, - WaapIPInfo, - WaapRuleBlockedRequests, - WaapTimeSeriesAttack, - WaapTopSession, - WaapTopURL, - WaapTopUserAgent, - IPInfoGetAttackTimeSeriesResponse, - IPInfoGetBlockedRequestsResponse, - IPInfoGetTopURLsResponse, - IPInfoGetTopUserAgentsResponse, - IPInfoGetTopUserSessionsResponse, - IPInfoListAttackedCountriesResponse, -) -``` - -Methods: - -- client.waap.ip_info.get_attack_time_series(\*\*params) -> IPInfoGetAttackTimeSeriesResponse -- client.waap.ip_info.get_blocked_requests(\*\*params) -> IPInfoGetBlockedRequestsResponse -- client.waap.ip_info.get_ddos_attack_series(\*\*params) -> WaapIPDDOSInfoModel -- client.waap.ip_info.get_ip_info(\*\*params) -> WaapIPInfo -- client.waap.ip_info.get_top_urls(\*\*params) -> IPInfoGetTopURLsResponse -- client.waap.ip_info.get_top_user_agents(\*\*params) -> IPInfoGetTopUserAgentsResponse -- client.waap.ip_info.get_top_user_sessions(\*\*params) -> IPInfoGetTopUserSessionsResponse -- client.waap.ip_info.list_attacked_countries(\*\*params) -> IPInfoListAttackedCountriesResponse - -### Metrics - -Types: - -```python -from gcore.types.waap.ip_info import WaapIPInfoCounts -``` - -Methods: - -- client.waap.ip_info.metrics.list(\*\*params) -> WaapIPInfoCounts - -# Iam - -Types: - -```python -from gcore.types.iam import AccountOverview -``` - -Methods: - -- client.iam.get_account_overview() -> AccountOverview - -## APITokens - -Types: - -```python -from gcore.types.iam import APIToken, APITokenCreated, APITokenList -``` - -Methods: - -- client.iam.api_tokens.create(client_id, \*\*params) -> APITokenCreated -- client.iam.api_tokens.list(client_id, \*\*params) -> APITokenList -- client.iam.api_tokens.delete(token_id, \*, client_id) -> None -- client.iam.api_tokens.get(token_id, \*, client_id) -> APIToken - -## Users - -Types: - -```python -from gcore.types.iam import User, UserDetailed, UserInvite, UserUpdated -``` - -Methods: - -- client.iam.users.update(user_id, \*\*params) -> UserUpdated -- client.iam.users.list(\*\*params) -> SyncOffsetPage[User] -- client.iam.users.delete(user_id, \*, client_id) -> None -- client.iam.users.get(user_id) -> UserDetailed -- client.iam.users.invite(\*\*params) -> UserInvite - -# Fastedge - -Types: - -```python -from gcore.types.fastedge import Client -``` - -Methods: - -- client.fastedge.get_account_overview() -> Client - -## Templates - -Types: - -```python -from gcore.types.fastedge import Template, TemplateParameter, TemplateShort -``` - -Methods: - -- client.fastedge.templates.create(\*\*params) -> TemplateShort -- client.fastedge.templates.list(\*\*params) -> SyncOffsetPageFastedgeTemplates[TemplateShort] -- client.fastedge.templates.delete(id, \*\*params) -> None -- client.fastedge.templates.get(id) -> Template -- client.fastedge.templates.replace(id, \*\*params) -> TemplateShort - -## Secrets - -Types: - -```python -from gcore.types.fastedge import Secret, SecretShort, SecretCreateResponse, SecretListResponse -``` - -Methods: - -- client.fastedge.secrets.create(\*\*params) -> SecretCreateResponse -- client.fastedge.secrets.update(id, \*\*params) -> Secret -- client.fastedge.secrets.list(\*\*params) -> SecretListResponse -- client.fastedge.secrets.delete(id, \*\*params) -> None -- client.fastedge.secrets.get(id) -> Secret -- client.fastedge.secrets.replace(id, \*\*params) -> Secret - -## Binaries - -Types: - -```python -from gcore.types.fastedge import Binary, BinaryShort, BinaryListResponse -``` - -Methods: - -- client.fastedge.binaries.create(body, \*\*params) -> BinaryShort -- client.fastedge.binaries.list() -> BinaryListResponse -- client.fastedge.binaries.delete(id) -> None -- client.fastedge.binaries.get(id) -> Binary - -## Statistics - -Types: - -```python -from gcore.types.fastedge import ( - CallStatus, - DurationStats, - StatisticGetCallSeriesResponse, - StatisticGetDurationSeriesResponse, -) -``` - -Methods: - -- client.fastedge.statistics.get_call_series(\*\*params) -> StatisticGetCallSeriesResponse -- client.fastedge.statistics.get_duration_series(\*\*params) -> StatisticGetDurationSeriesResponse - -## Apps - -Types: - -```python -from gcore.types.fastedge import App, AppShort -``` - -Methods: - -- client.fastedge.apps.create(\*\*params) -> AppShort -- client.fastedge.apps.update(id, \*\*params) -> AppShort -- client.fastedge.apps.list(\*\*params) -> SyncOffsetPageFastedgeApps[AppShort] -- client.fastedge.apps.delete(id) -> None -- client.fastedge.apps.get(id) -> App -- client.fastedge.apps.replace(id, \*\*params) -> AppShort - -### Logs - -Types: - -```python -from gcore.types.fastedge.apps import Log -``` - -Methods: - -- client.fastedge.apps.logs.list(id, \*\*params) -> SyncOffsetPageFastedgeAppLogs[Log] - -## KvStores - -Types: - -```python -from gcore.types.fastedge import KvStore, KvStoreShort, KvStoreCreateResponse, KvStoreListResponse -``` - -Methods: - -- client.fastedge.kv_stores.create(\*\*params) -> KvStoreCreateResponse -- client.fastedge.kv_stores.list(\*\*params) -> KvStoreListResponse -- client.fastedge.kv_stores.delete(id) -> None -- client.fastedge.kv_stores.get(id) -> KvStore -- client.fastedge.kv_stores.replace(id, \*\*params) -> KvStore - -# Streaming - -Types: - -```python -from gcore.types.streaming import CreateVideo, Video -``` - -## AITasks - -Types: - -```python -from gcore.types.streaming import ( - AIContentmoderationHardnudity, - AIContentmoderationNsfw, - AIContentmoderationSoftnudity, - AIContentmoderationSport, - AITask, - AITaskCreateResponse, - AITaskCancelResponse, - AITaskGetResponse, - AITaskGetAISettingsResponse, -) -``` - -Methods: - -- client.streaming.ai_tasks.create(\*\*params) -> AITaskCreateResponse -- client.streaming.ai_tasks.list(\*\*params) -> SyncPageStreamingAI[AITask] -- client.streaming.ai_tasks.cancel(task_id) -> AITaskCancelResponse -- client.streaming.ai_tasks.get(task_id) -> AITaskGetResponse -- client.streaming.ai_tasks.get_ai_settings(\*\*params) -> AITaskGetAISettingsResponse - -## Broadcasts - -Types: - -```python -from gcore.types.streaming import Broadcast, BroadcastSpectatorsCount -``` - -Methods: - -- client.streaming.broadcasts.create(\*\*params) -> None -- client.streaming.broadcasts.update(broadcast_id, \*\*params) -> Broadcast -- client.streaming.broadcasts.list(\*\*params) -> SyncPageStreaming[Broadcast] -- client.streaming.broadcasts.delete(broadcast_id) -> None -- client.streaming.broadcasts.get(broadcast_id) -> Broadcast -- client.streaming.broadcasts.get_spectators_count(broadcast_id) -> BroadcastSpectatorsCount - -## Directories - -Types: - -```python -from gcore.types.streaming import ( - DirectoriesTree, - DirectoryBase, - DirectoryItem, - DirectoryVideo, - DirectoryGetResponse, -) -``` - -Methods: - -- client.streaming.directories.create(\*\*params) -> DirectoryBase -- client.streaming.directories.update(directory_id, \*\*params) -> DirectoryBase -- client.streaming.directories.delete(directory_id) -> None -- client.streaming.directories.get(directory_id) -> DirectoryGetResponse -- client.streaming.directories.get_tree() -> DirectoriesTree - -## Players - -Types: - -```python -from gcore.types.streaming import Player -``` - -Methods: - -- client.streaming.players.create(\*\*params) -> None -- client.streaming.players.update(player_id, \*\*params) -> Player -- client.streaming.players.list(\*\*params) -> SyncPageStreaming[Player] -- client.streaming.players.delete(player_id) -> None -- client.streaming.players.get(player_id) -> Player -- client.streaming.players.preview(player_id) -> None - -## QualitySets - -Types: - -```python -from gcore.types.streaming import QualitySets -``` - -Methods: - -- client.streaming.quality_sets.list() -> QualitySets -- client.streaming.quality_sets.set_default(\*\*params) -> QualitySets - -## Playlists - -Types: - -```python -from gcore.types.streaming import ( - Playlist, - PlaylistCreated, - PlaylistVideo, - PlaylistListVideosResponse, -) -``` - -Methods: - -- client.streaming.playlists.create(\*\*params) -> PlaylistCreated -- client.streaming.playlists.update(playlist_id, \*\*params) -> Playlist -- client.streaming.playlists.list(\*\*params) -> SyncPageStreaming[Playlist] -- client.streaming.playlists.delete(playlist_id) -> None -- client.streaming.playlists.get(playlist_id) -> Playlist -- client.streaming.playlists.list_videos(playlist_id) -> PlaylistListVideosResponse - -## Videos - -Types: - -```python -from gcore.types.streaming import ( - DirectUploadParameters, - Subtitle, - SubtitleBase, - SubtitleBody, - SubtitleUpdated, - VideoCreateResponse, - VideoCreateMultipleResponse, -) -``` - -Methods: - -- client.streaming.videos.create(\*\*params) -> VideoCreateResponse -- client.streaming.videos.update(video_id, \*\*params) -> Video -- client.streaming.videos.list(\*\*params) -> SyncPageStreaming[Video] -- client.streaming.videos.delete(video_id) -> None -- client.streaming.videos.create_multiple(\*\*params) -> VideoCreateMultipleResponse -- client.streaming.videos.get(video_id) -> Video -- client.streaming.videos.get_parameters_for_direct_upload(video_id) -> DirectUploadParameters -- client.streaming.videos.list_names(\*\*params) -> None - -### Subtitles - -Types: - -```python -from gcore.types.streaming.videos import SubtitleListResponse -``` - -Methods: - -- client.streaming.videos.subtitles.create(video_id, \*\*params) -> Subtitle -- client.streaming.videos.subtitles.update(id, \*, video_id, \*\*params) -> SubtitleBase -- client.streaming.videos.subtitles.list(video_id) -> SubtitleListResponse -- client.streaming.videos.subtitles.delete(id, \*, video_id) -> None -- client.streaming.videos.subtitles.get(id, \*, video_id) -> Subtitle - -## Streams - -Types: - -```python -from gcore.types.streaming import ( - Clip, - Stream, - StreamListClipsResponse, - StreamStartRecordingResponse, -) -``` - -Methods: - -- client.streaming.streams.create(\*\*params) -> Stream -- client.streaming.streams.update(stream_id, \*\*params) -> Stream -- client.streaming.streams.list(\*\*params) -> SyncPageStreaming[Stream] -- client.streaming.streams.delete(stream_id) -> None -- client.streaming.streams.clear_dvr(stream_id) -> None -- client.streaming.streams.create_clip(stream_id, \*\*params) -> Clip -- client.streaming.streams.get(stream_id) -> Stream -- client.streaming.streams.list_clips(stream_id) -> StreamListClipsResponse -- client.streaming.streams.start_recording(stream_id) -> StreamStartRecordingResponse -- client.streaming.streams.stop_recording(stream_id) -> Video - -### Overlays - -Types: - -```python -from gcore.types.streaming.streams import ( - Overlay, - OverlayCreateResponse, - OverlayListResponse, - OverlayUpdateMultipleResponse, -) -``` - -Methods: - -- client.streaming.streams.overlays.create(stream_id, \*\*params) -> OverlayCreateResponse -- client.streaming.streams.overlays.update(overlay_id, \*, stream_id, \*\*params) -> Overlay -- client.streaming.streams.overlays.list(stream_id) -> OverlayListResponse -- client.streaming.streams.overlays.delete(overlay_id, \*, stream_id) -> None -- client.streaming.streams.overlays.get(overlay_id, \*, stream_id) -> Overlay -- client.streaming.streams.overlays.update_multiple(stream_id, \*\*params) -> OverlayUpdateMultipleResponse - -## Restreams - -Types: - -```python -from gcore.types.streaming import Restream -``` - -Methods: - -- client.streaming.restreams.create(\*\*params) -> None -- client.streaming.restreams.update(restream_id, \*\*params) -> Restream -- client.streaming.restreams.list(\*\*params) -> SyncPageStreaming[Restream] -- client.streaming.restreams.delete(restream_id) -> None -- client.streaming.restreams.get(restream_id) -> Restream - -## Statistics - -Types: - -```python -from gcore.types.streaming import ( - Ffprobes, - MaxStreamSeries, - PopularVideos, - StorageSeries, - StreamSeries, - UniqueViewers, - UniqueViewersCDN, - Views, - ViewsByBrowser, - ViewsByCountry, - ViewsByHostname, - ViewsByOperatingSystem, - ViewsByReferer, - ViewsByRegion, - ViewsHeatmap, - VodStatisticsSeries, - VodTotalStreamDurationSeries, - StatisticGetLiveUniqueViewersResponse, - StatisticGetVodWatchTimeTotalCDNResponse, -) -``` - -Methods: - -- client.streaming.statistics.get_ffprobes(\*\*params) -> Ffprobes -- client.streaming.statistics.get_live_unique_viewers(\*\*params) -> StatisticGetLiveUniqueViewersResponse -- client.streaming.statistics.get_live_watch_time_cdn(\*\*params) -> StreamSeries -- client.streaming.statistics.get_live_watch_time_total_cdn(\*\*params) -> VodTotalStreamDurationSeries -- client.streaming.statistics.get_max_streams_series(\*\*params) -> MaxStreamSeries -- client.streaming.statistics.get_popular_videos(\*\*params) -> PopularVideos -- client.streaming.statistics.get_storage_series(\*\*params) -> StorageSeries -- client.streaming.statistics.get_stream_series(\*\*params) -> StreamSeries -- client.streaming.statistics.get_unique_viewers(\*\*params) -> UniqueViewers -- client.streaming.statistics.get_unique_viewers_cdn(\*\*params) -> UniqueViewersCDN -- client.streaming.statistics.get_views(\*\*params) -> Views -- client.streaming.statistics.get_views_by_browsers(\*\*params) -> ViewsByBrowser -- client.streaming.statistics.get_views_by_country(\*\*params) -> ViewsByCountry -- client.streaming.statistics.get_views_by_hostname(\*\*params) -> ViewsByHostname -- client.streaming.statistics.get_views_by_operating_system(\*\*params) -> ViewsByOperatingSystem -- client.streaming.statistics.get_views_by_referer(\*\*params) -> ViewsByReferer -- client.streaming.statistics.get_views_by_region(\*\*params) -> ViewsByRegion -- client.streaming.statistics.get_views_heatmap(\*\*params) -> ViewsHeatmap -- client.streaming.statistics.get_vod_storage_volume(\*\*params) -> VodStatisticsSeries -- client.streaming.statistics.get_vod_transcoding_duration(\*\*params) -> VodStatisticsSeries -- client.streaming.statistics.get_vod_unique_viewers_cdn(\*\*params) -> VodStatisticsSeries -- client.streaming.statistics.get_vod_watch_time_cdn(\*\*params) -> VodStatisticsSeries -- client.streaming.statistics.get_vod_watch_time_total_cdn(\*\*params) -> StatisticGetVodWatchTimeTotalCDNResponse - -# Security - -## Events - -Types: - -```python -from gcore.types.security import ClientView -``` - -Methods: - -- client.security.events.list(\*\*params) -> SyncOffsetPage[ClientView] - -## BgpAnnounces - -Types: - -```python -from gcore.types.security import ClientAnnounce, BgpAnnounceListResponse -``` - -Methods: - -- client.security.bgp_announces.list(\*\*params) -> BgpAnnounceListResponse -- client.security.bgp_announces.toggle(\*\*params) -> object - -## ProfileTemplates - -Types: - -```python -from gcore.types.security import ClientProfileTemplate, ProfileTemplateListResponse -``` - -Methods: - -- client.security.profile_templates.list() -> ProfileTemplateListResponse - -## Profiles - -Types: - -```python -from gcore.types.security import ClientProfile, ProfileListResponse -``` - -Methods: - -- client.security.profiles.create(\*\*params) -> ClientProfile -- client.security.profiles.list(\*\*params) -> ProfileListResponse -- client.security.profiles.delete(id) -> None -- client.security.profiles.get(id) -> ClientProfile -- client.security.profiles.recreate(id, \*\*params) -> ClientProfile -- client.security.profiles.replace(id, \*\*params) -> ClientProfile - -# DNS - -Types: - -```python -from gcore.types.dns import DNSGetAccountOverviewResponse, DNSLookupResponse -``` - -Methods: - -- client.dns.get_account_overview() -> DNSGetAccountOverviewResponse -- client.dns.lookup(\*\*params) -> DNSLookupResponse - -## Locations - -Types: - -```python -from gcore.types.dns import ( - DNSLocationTranslations, - LocationListResponse, - LocationListContinentsResponse, - LocationListCountriesResponse, - LocationListRegionsResponse, -) -``` - -Methods: - -- client.dns.locations.list() -> LocationListResponse -- client.dns.locations.list_continents() -> LocationListContinentsResponse -- client.dns.locations.list_countries() -> LocationListCountriesResponse -- client.dns.locations.list_regions() -> LocationListRegionsResponse - -## Metrics - -Types: - -```python -from gcore.types.dns import MetricListResponse -``` - -Methods: - -- client.dns.metrics.list(\*\*params) -> str - -## Pickers - -Types: - -```python -from gcore.types.dns import DNSLabelName, PickerListResponse -``` - -Methods: - -- client.dns.pickers.list() -> PickerListResponse - -### Presets - -Types: - -```python -from gcore.types.dns.pickers import PresetListResponse -``` - -Methods: - -- client.dns.pickers.presets.list() -> PresetListResponse - -## Zones - -Types: - -```python -from gcore.types.dns import ( - DNSNameServer, - ZoneCreateResponse, - ZoneListResponse, - ZoneCheckDelegationStatusResponse, - ZoneExportResponse, - ZoneGetResponse, - ZoneGetStatisticsResponse, - ZoneImportResponse, -) -``` - -Methods: - -- client.dns.zones.create(\*\*params) -> ZoneCreateResponse -- client.dns.zones.list(\*\*params) -> ZoneListResponse -- client.dns.zones.delete(name) -> object -- client.dns.zones.check_delegation_status(name) -> ZoneCheckDelegationStatusResponse -- client.dns.zones.disable(name) -> object -- client.dns.zones.enable(name) -> object -- client.dns.zones.export(zone_name) -> ZoneExportResponse -- client.dns.zones.get(name) -> ZoneGetResponse -- client.dns.zones.get_statistics(name, \*\*params) -> ZoneGetStatisticsResponse -- client.dns.zones.import\_(zone_name, \*\*params) -> ZoneImportResponse -- client.dns.zones.replace(path_name, \*\*params) -> object - -### Dnssec - -Types: - -```python -from gcore.types.dns.zones import DnssecUpdateResponse, DnssecGetResponse -``` - -Methods: - -- client.dns.zones.dnssec.update(name, \*\*params) -> DnssecUpdateResponse -- client.dns.zones.dnssec.get(name) -> DnssecGetResponse - -### Rrsets - -Types: - -```python -from gcore.types.dns.zones import ( - DNSFailoverLog, - DNSOutputRrset, - RrsetListResponse, - RrsetGetFailoverLogsResponse, -) -``` - -Methods: - -- client.dns.zones.rrsets.create(rrset_type, \*, zone_name, rrset_name, \*\*params) -> DNSOutputRrset -- client.dns.zones.rrsets.list(zone_name, \*\*params) -> RrsetListResponse -- client.dns.zones.rrsets.delete(rrset_type, \*, zone_name, rrset_name) -> object -- client.dns.zones.rrsets.get(rrset_type, \*, zone_name, rrset_name) -> DNSOutputRrset -- 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(id, \*\*params) -> object - -# Storage - -Types: - -```python -from gcore.types.storage import Storage -``` - -Methods: - -- client.storage.create(\*\*params) -> Storage -- client.storage.update(storage_id, \*\*params) -> Storage -- client.storage.list(\*\*params) -> SyncOffsetPage[Storage] -- client.storage.delete(storage_id) -> None -- client.storage.get(storage_id) -> Storage -- client.storage.link_ssh_key(key_id, \*, storage_id) -> None -- client.storage.restore(storage_id, \*\*params) -> None -- client.storage.unlink_ssh_key(key_id, \*, storage_id) -> None - -## Locations - -Types: - -```python -from gcore.types.storage import Location -``` - -Methods: - -- client.storage.locations.list(\*\*params) -> SyncOffsetPage[Location] - -## Statistics - -Types: - -```python -from gcore.types.storage import UsageSeries, UsageTotal, StatisticGetUsageSeriesResponse -``` - -Methods: - -- client.storage.statistics.get_usage_aggregated(\*\*params) -> UsageTotal -- client.storage.statistics.get_usage_series(\*\*params) -> StatisticGetUsageSeriesResponse - -## Credentials - -Methods: - -- client.storage.credentials.recreate(storage_id, \*\*params) -> Storage - -## Buckets - -Types: - -```python -from gcore.types.storage import Bucket -``` - -Methods: - -- client.storage.buckets.create(bucket_name, \*, storage_id) -> None -- client.storage.buckets.list(storage_id, \*\*params) -> SyncOffsetPage[Bucket] -- client.storage.buckets.delete(bucket_name, \*, storage_id) -> None - -### Cors - -Types: - -```python -from gcore.types.storage.buckets import BucketCors -``` - -Methods: - -- client.storage.buckets.cors.create(bucket_name, \*, storage_id, \*\*params) -> None -- client.storage.buckets.cors.get(bucket_name, \*, storage_id) -> BucketCors - -### Lifecycle - -Methods: - -- client.storage.buckets.lifecycle.create(bucket_name, \*, storage_id, \*\*params) -> None -- client.storage.buckets.lifecycle.delete(bucket_name, \*, storage_id) -> None - -### Policy - -Types: - -```python -from gcore.types.storage.buckets import BucketPolicy, PolicyGetResponse -``` - -Methods: - -- client.storage.buckets.policy.create(bucket_name, \*, storage_id) -> None -- client.storage.buckets.policy.delete(bucket_name, \*, storage_id) -> None -- client.storage.buckets.policy.get(bucket_name, \*, storage_id) -> PolicyGetResponse - -# CDN - -Types: - -```python -from gcore.types.cdn import ( - AlibabaRegions, - AwsRegions, - CDNAccount, - CDNAccountLimits, - CDNAvailableFeatures, - PurgeStatus, - CDNListPurgeStatusesResponse, -) -``` - -Methods: - -- client.cdn.get_account_limits() -> CDNAccountLimits -- client.cdn.get_account_overview() -> CDNAccount -- client.cdn.get_available_features() -> CDNAvailableFeatures -- client.cdn.list_alibaba_regions() -> AlibabaRegions -- client.cdn.list_aws_regions() -> AwsRegions -- client.cdn.list_purge_statuses(\*\*params) -> CDNListPurgeStatusesResponse -- client.cdn.update_account(\*\*params) -> CDNAccount - -## CDNResources - -Types: - -```python -from gcore.types.cdn import CDNResource, CDNResourceList -``` - -Methods: - -- client.cdn.cdn_resources.create(\*\*params) -> CDNResource -- client.cdn.cdn_resources.update(resource_id, \*\*params) -> CDNResource -- client.cdn.cdn_resources.list(\*\*params) -> CDNResourceList -- client.cdn.cdn_resources.delete(resource_id) -> None -- client.cdn.cdn_resources.get(resource_id) -> CDNResource -- client.cdn.cdn_resources.prefetch(resource_id, \*\*params) -> None -- client.cdn.cdn_resources.prevalidate_ssl_le_certificate(resource_id) -> None -- client.cdn.cdn_resources.purge(resource_id, \*\*params) -> None -- client.cdn.cdn_resources.replace(resource_id, \*\*params) -> CDNResource - -### Shield - -Types: - -```python -from gcore.types.cdn.cdn_resources import OriginShielding, OriginShieldingReplaced -``` - -Methods: - -- client.cdn.cdn_resources.shield.get(resource_id) -> OriginShielding -- client.cdn.cdn_resources.shield.replace(resource_id, \*\*params) -> object - -### Rules - -Types: - -```python -from gcore.types.cdn.cdn_resources import CDNResourceRule, RuleListResponse -``` - -Methods: - -- client.cdn.cdn_resources.rules.create(resource_id, \*\*params) -> CDNResourceRule -- client.cdn.cdn_resources.rules.update(rule_id, \*, resource_id, \*\*params) -> CDNResourceRule -- client.cdn.cdn_resources.rules.list(resource_id) -> RuleListResponse -- client.cdn.cdn_resources.rules.delete(rule_id, \*, resource_id) -> None -- client.cdn.cdn_resources.rules.get(rule_id, \*, resource_id) -> CDNResourceRule -- client.cdn.cdn_resources.rules.replace(rule_id, \*, resource_id, \*\*params) -> CDNResourceRule - -## Shields - -Types: - -```python -from gcore.types.cdn import ShieldListResponse -``` - -Methods: - -- client.cdn.shields.list() -> ShieldListResponse - -## OriginGroups - -Types: - -```python -from gcore.types.cdn import OriginGroups, OriginGroupsList -``` - -Methods: - -- client.cdn.origin_groups.create(\*\*params) -> OriginGroups -- client.cdn.origin_groups.update(origin_group_id, \*\*params) -> OriginGroups -- client.cdn.origin_groups.list(\*\*params) -> OriginGroupsList -- client.cdn.origin_groups.delete(origin_group_id) -> None -- client.cdn.origin_groups.get(origin_group_id) -> OriginGroups -- client.cdn.origin_groups.replace(origin_group_id, \*\*params) -> OriginGroups - -## RuleTemplates - -Types: - -```python -from gcore.types.cdn import RuleTemplate, RuleTemplateList -``` - -Methods: - -- client.cdn.rule_templates.create(\*\*params) -> RuleTemplate -- client.cdn.rule_templates.update(rule_template_id, \*\*params) -> RuleTemplate -- client.cdn.rule_templates.list() -> RuleTemplateList -- client.cdn.rule_templates.delete(rule_template_id) -> None -- client.cdn.rule_templates.get(rule_template_id) -> RuleTemplate -- client.cdn.rule_templates.replace(rule_template_id, \*\*params) -> RuleTemplate - -## Certificates - -Types: - -```python -from gcore.types.cdn import SslDetail, SslDetailList, SslRequestStatus -``` - -Methods: - -- client.cdn.certificates.create(\*\*params) -> None -- client.cdn.certificates.list(\*\*params) -> SslDetailList -- client.cdn.certificates.delete(ssl_id) -> None -- client.cdn.certificates.force_retry(cert_id) -> None -- client.cdn.certificates.get(ssl_id) -> SslDetail -- client.cdn.certificates.get_status(cert_id, \*\*params) -> SslRequestStatus -- client.cdn.certificates.renew(cert_id) -> None -- client.cdn.certificates.replace(ssl_id, \*\*params) -> SslDetail - -## TrustedCaCertificates - -Types: - -```python -from gcore.types.cdn import CaCertificate, CaCertificateList -``` - -Methods: - -- client.cdn.trusted_ca_certificates.create(\*\*params) -> CaCertificate -- client.cdn.trusted_ca_certificates.list(\*\*params) -> CaCertificateList -- client.cdn.trusted_ca_certificates.delete(id) -> None -- client.cdn.trusted_ca_certificates.get(id) -> CaCertificate -- client.cdn.trusted_ca_certificates.replace(id, \*\*params) -> CaCertificate - -## AuditLogs - -Types: - -```python -from gcore.types.cdn import CDNAuditLogEntry -``` - -Methods: - -- client.cdn.audit_logs.list(\*\*params) -> SyncOffsetPage[CDNAuditLogEntry] -- client.cdn.audit_logs.get(log_id) -> CDNAuditLogEntry - -## Logs - -Types: - -```python -from gcore.types.cdn import CDNLogEntry -``` - -Methods: - -- client.cdn.logs.list(\*\*params) -> SyncOffsetPageCDNLogs[Data] -- client.cdn.logs.download(\*\*params) -> BinaryAPIResponse - -## LogsUploader - -Types: - -```python -from gcore.types.cdn import LogsUploaderValidation -``` - -### Policies - -Types: - -```python -from gcore.types.cdn.logs_uploader import ( - LogsUploaderPolicy, - LogsUploaderPolicyList, - PolicyListFieldsResponse, -) -``` - -Methods: - -- client.cdn.logs_uploader.policies.create(\*\*params) -> LogsUploaderPolicy -- client.cdn.logs_uploader.policies.update(id, \*\*params) -> LogsUploaderPolicy -- client.cdn.logs_uploader.policies.list(\*\*params) -> LogsUploaderPolicyList -- client.cdn.logs_uploader.policies.delete(id) -> None -- client.cdn.logs_uploader.policies.get(id) -> LogsUploaderPolicy -- client.cdn.logs_uploader.policies.list_fields() -> PolicyListFieldsResponse -- client.cdn.logs_uploader.policies.replace(id, \*\*params) -> LogsUploaderPolicy - -### Targets - -Types: - -```python -from gcore.types.cdn.logs_uploader import LogsUploaderTarget, LogsUploaderTargetList -``` - -Methods: - -- client.cdn.logs_uploader.targets.create(\*\*params) -> LogsUploaderTarget -- client.cdn.logs_uploader.targets.update(id, \*\*params) -> LogsUploaderTarget -- client.cdn.logs_uploader.targets.list(\*\*params) -> LogsUploaderTargetList -- client.cdn.logs_uploader.targets.delete(id) -> None -- client.cdn.logs_uploader.targets.get(id) -> LogsUploaderTarget -- client.cdn.logs_uploader.targets.replace(id, \*\*params) -> LogsUploaderTarget -- client.cdn.logs_uploader.targets.validate(id) -> LogsUploaderValidation - -### Configs - -Types: - -```python -from gcore.types.cdn.logs_uploader import LogsUploaderConfig, LogsUploaderConfigList -``` - -Methods: - -- client.cdn.logs_uploader.configs.create(\*\*params) -> LogsUploaderConfig -- client.cdn.logs_uploader.configs.update(id, \*\*params) -> LogsUploaderConfig -- client.cdn.logs_uploader.configs.list(\*\*params) -> LogsUploaderConfigList -- client.cdn.logs_uploader.configs.delete(id) -> None -- client.cdn.logs_uploader.configs.get(id) -> LogsUploaderConfig -- client.cdn.logs_uploader.configs.replace(id, \*\*params) -> LogsUploaderConfig -- client.cdn.logs_uploader.configs.validate(id) -> LogsUploaderValidation - -## Statistics - -Types: - -```python -from gcore.types.cdn import ( - LogsAggregatedStats, - ResourceAggregatedStats, - ResourceUsageStats, - ShieldAggregatedStats, - UsageSeriesStats, -) -``` - -Methods: - -- client.cdn.statistics.get_logs_usage_aggregated(\*\*params) -> LogsAggregatedStats -- client.cdn.statistics.get_logs_usage_series(\*\*params) -> UsageSeriesStats -- client.cdn.statistics.get_resource_usage_aggregated(\*\*params) -> ResourceAggregatedStats -- client.cdn.statistics.get_resource_usage_series(\*\*params) -> ResourceUsageStats -- client.cdn.statistics.get_shield_usage_aggregated(\*\*params) -> ShieldAggregatedStats -- client.cdn.statistics.get_shield_usage_series(\*\*params) -> UsageSeriesStats - -## NetworkCapacity - -Types: - -```python -from gcore.types.cdn import NetworkCapacity -``` - -Methods: - -- client.cdn.network_capacity.list() -> NetworkCapacity - -## Metrics - -Types: - -```python -from gcore.types.cdn import CDNMetrics, CDNMetricsGroups, CDNMetricsValues -``` - -Methods: - -- client.cdn.metrics.list(\*\*params) -> CDNMetrics - -## IPRanges - -Types: - -```python -from gcore.types.cdn import PublicIPList, PublicNetworkList -``` - -Methods: - -- client.cdn.ip_ranges.list(\*\*params) -> PublicNetworkList -- client.cdn.ip_ranges.list_ips(\*\*params) -> PublicIPList +# [CDN](src/gcore/resources/cdn/api.md) diff --git a/pyproject.toml b/pyproject.toml index c1bfc40d..5d1c7f7a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,7 +70,7 @@ format = { chain = [ # run formatting again to fix any inconsistencies when imports are stripped "format:ruff", ]} -"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md" +"format:docs" = "bash -c 'python scripts/utils/ruffen-docs.py README.md $(find . -type f -name api.md)'" "format:ruff" = "ruff format" "lint" = { chain = [ diff --git a/src/gcore/resources/cdn/api.md b/src/gcore/resources/cdn/api.md new file mode 100644 index 00000000..70919175 --- /dev/null +++ b/src/gcore/resources/cdn/api.md @@ -0,0 +1,308 @@ +# CDN + +Types: + +```python +from gcore.types.cdn import ( + AlibabaRegions, + AwsRegions, + CDNAccount, + CDNAccountLimits, + CDNAvailableFeatures, + PurgeStatus, + CDNListPurgeStatusesResponse, +) +``` + +Methods: + +- client.cdn.get_account_limits() -> CDNAccountLimits +- client.cdn.get_account_overview() -> CDNAccount +- client.cdn.get_available_features() -> CDNAvailableFeatures +- client.cdn.list_alibaba_regions() -> AlibabaRegions +- client.cdn.list_aws_regions() -> AwsRegions +- client.cdn.list_purge_statuses(\*\*params) -> CDNListPurgeStatusesResponse +- client.cdn.update_account(\*\*params) -> CDNAccount + +## CDNResources + +Types: + +```python +from gcore.types.cdn import CDNResource, CDNResourceList +``` + +Methods: + +- client.cdn.cdn_resources.create(\*\*params) -> CDNResource +- client.cdn.cdn_resources.update(resource_id, \*\*params) -> CDNResource +- client.cdn.cdn_resources.list(\*\*params) -> CDNResourceList +- client.cdn.cdn_resources.delete(resource_id) -> None +- client.cdn.cdn_resources.get(resource_id) -> CDNResource +- client.cdn.cdn_resources.prefetch(resource_id, \*\*params) -> None +- client.cdn.cdn_resources.prevalidate_ssl_le_certificate(resource_id) -> None +- client.cdn.cdn_resources.purge(resource_id, \*\*params) -> None +- client.cdn.cdn_resources.replace(resource_id, \*\*params) -> CDNResource + +### Shield + +Types: + +```python +from gcore.types.cdn.cdn_resources import OriginShielding, OriginShieldingReplaced +``` + +Methods: + +- client.cdn.cdn_resources.shield.get(resource_id) -> OriginShielding +- client.cdn.cdn_resources.shield.replace(resource_id, \*\*params) -> object + +### Rules + +Types: + +```python +from gcore.types.cdn.cdn_resources import CDNResourceRule, RuleListResponse +``` + +Methods: + +- client.cdn.cdn_resources.rules.create(resource_id, \*\*params) -> CDNResourceRule +- client.cdn.cdn_resources.rules.update(rule_id, \*, resource_id, \*\*params) -> CDNResourceRule +- client.cdn.cdn_resources.rules.list(resource_id) -> RuleListResponse +- client.cdn.cdn_resources.rules.delete(rule_id, \*, resource_id) -> None +- client.cdn.cdn_resources.rules.get(rule_id, \*, resource_id) -> CDNResourceRule +- client.cdn.cdn_resources.rules.replace(rule_id, \*, resource_id, \*\*params) -> CDNResourceRule + +## Shields + +Types: + +```python +from gcore.types.cdn import ShieldListResponse +``` + +Methods: + +- client.cdn.shields.list() -> ShieldListResponse + +## OriginGroups + +Types: + +```python +from gcore.types.cdn import OriginGroups, OriginGroupsList +``` + +Methods: + +- client.cdn.origin_groups.create(\*\*params) -> OriginGroups +- client.cdn.origin_groups.update(origin_group_id, \*\*params) -> OriginGroups +- client.cdn.origin_groups.list(\*\*params) -> OriginGroupsList +- client.cdn.origin_groups.delete(origin_group_id) -> None +- client.cdn.origin_groups.get(origin_group_id) -> OriginGroups +- client.cdn.origin_groups.replace(origin_group_id, \*\*params) -> OriginGroups + +## RuleTemplates + +Types: + +```python +from gcore.types.cdn import RuleTemplate, RuleTemplateList +``` + +Methods: + +- client.cdn.rule_templates.create(\*\*params) -> RuleTemplate +- client.cdn.rule_templates.update(rule_template_id, \*\*params) -> RuleTemplate +- client.cdn.rule_templates.list() -> RuleTemplateList +- client.cdn.rule_templates.delete(rule_template_id) -> None +- client.cdn.rule_templates.get(rule_template_id) -> RuleTemplate +- client.cdn.rule_templates.replace(rule_template_id, \*\*params) -> RuleTemplate + +## Certificates + +Types: + +```python +from gcore.types.cdn import SslDetail, SslDetailList, SslRequestStatus +``` + +Methods: + +- client.cdn.certificates.create(\*\*params) -> None +- client.cdn.certificates.list(\*\*params) -> SslDetailList +- client.cdn.certificates.delete(ssl_id) -> None +- client.cdn.certificates.force_retry(cert_id) -> None +- client.cdn.certificates.get(ssl_id) -> SslDetail +- client.cdn.certificates.get_status(cert_id, \*\*params) -> SslRequestStatus +- client.cdn.certificates.renew(cert_id) -> None +- client.cdn.certificates.replace(ssl_id, \*\*params) -> SslDetail + +## TrustedCaCertificates + +Types: + +```python +from gcore.types.cdn import CaCertificate, CaCertificateList +``` + +Methods: + +- client.cdn.trusted_ca_certificates.create(\*\*params) -> CaCertificate +- client.cdn.trusted_ca_certificates.list(\*\*params) -> CaCertificateList +- client.cdn.trusted_ca_certificates.delete(id) -> None +- client.cdn.trusted_ca_certificates.get(id) -> CaCertificate +- client.cdn.trusted_ca_certificates.replace(id, \*\*params) -> CaCertificate + +## AuditLogs + +Types: + +```python +from gcore.types.cdn import CDNAuditLogEntry +``` + +Methods: + +- client.cdn.audit_logs.list(\*\*params) -> SyncOffsetPage[CDNAuditLogEntry] +- client.cdn.audit_logs.get(log_id) -> CDNAuditLogEntry + +## Logs + +Types: + +```python +from gcore.types.cdn import CDNLogEntry +``` + +Methods: + +- client.cdn.logs.list(\*\*params) -> SyncOffsetPageCDNLogs[Data] +- client.cdn.logs.download(\*\*params) -> BinaryAPIResponse + +## LogsUploader + +Types: + +```python +from gcore.types.cdn import LogsUploaderValidation +``` + +### Policies + +Types: + +```python +from gcore.types.cdn.logs_uploader import ( + LogsUploaderPolicy, + LogsUploaderPolicyList, + PolicyListFieldsResponse, +) +``` + +Methods: + +- client.cdn.logs_uploader.policies.create(\*\*params) -> LogsUploaderPolicy +- client.cdn.logs_uploader.policies.update(id, \*\*params) -> LogsUploaderPolicy +- client.cdn.logs_uploader.policies.list(\*\*params) -> LogsUploaderPolicyList +- client.cdn.logs_uploader.policies.delete(id) -> None +- client.cdn.logs_uploader.policies.get(id) -> LogsUploaderPolicy +- client.cdn.logs_uploader.policies.list_fields() -> PolicyListFieldsResponse +- client.cdn.logs_uploader.policies.replace(id, \*\*params) -> LogsUploaderPolicy + +### Targets + +Types: + +```python +from gcore.types.cdn.logs_uploader import LogsUploaderTarget, LogsUploaderTargetList +``` + +Methods: + +- client.cdn.logs_uploader.targets.create(\*\*params) -> LogsUploaderTarget +- client.cdn.logs_uploader.targets.update(id, \*\*params) -> LogsUploaderTarget +- client.cdn.logs_uploader.targets.list(\*\*params) -> LogsUploaderTargetList +- client.cdn.logs_uploader.targets.delete(id) -> None +- client.cdn.logs_uploader.targets.get(id) -> LogsUploaderTarget +- client.cdn.logs_uploader.targets.replace(id, \*\*params) -> LogsUploaderTarget +- client.cdn.logs_uploader.targets.validate(id) -> LogsUploaderValidation + +### Configs + +Types: + +```python +from gcore.types.cdn.logs_uploader import LogsUploaderConfig, LogsUploaderConfigList +``` + +Methods: + +- client.cdn.logs_uploader.configs.create(\*\*params) -> LogsUploaderConfig +- client.cdn.logs_uploader.configs.update(id, \*\*params) -> LogsUploaderConfig +- client.cdn.logs_uploader.configs.list(\*\*params) -> LogsUploaderConfigList +- client.cdn.logs_uploader.configs.delete(id) -> None +- client.cdn.logs_uploader.configs.get(id) -> LogsUploaderConfig +- client.cdn.logs_uploader.configs.replace(id, \*\*params) -> LogsUploaderConfig +- client.cdn.logs_uploader.configs.validate(id) -> LogsUploaderValidation + +## Statistics + +Types: + +```python +from gcore.types.cdn import ( + LogsAggregatedStats, + ResourceAggregatedStats, + ResourceUsageStats, + ShieldAggregatedStats, + UsageSeriesStats, +) +``` + +Methods: + +- client.cdn.statistics.get_logs_usage_aggregated(\*\*params) -> LogsAggregatedStats +- client.cdn.statistics.get_logs_usage_series(\*\*params) -> UsageSeriesStats +- client.cdn.statistics.get_resource_usage_aggregated(\*\*params) -> ResourceAggregatedStats +- client.cdn.statistics.get_resource_usage_series(\*\*params) -> ResourceUsageStats +- client.cdn.statistics.get_shield_usage_aggregated(\*\*params) -> ShieldAggregatedStats +- client.cdn.statistics.get_shield_usage_series(\*\*params) -> UsageSeriesStats + +## NetworkCapacity + +Types: + +```python +from gcore.types.cdn import NetworkCapacity +``` + +Methods: + +- client.cdn.network_capacity.list() -> NetworkCapacity + +## Metrics + +Types: + +```python +from gcore.types.cdn import CDNMetrics, CDNMetricsGroups, CDNMetricsValues +``` + +Methods: + +- client.cdn.metrics.list(\*\*params) -> CDNMetrics + +## IPRanges + +Types: + +```python +from gcore.types.cdn import PublicIPList, PublicNetworkList +``` + +Methods: + +- client.cdn.ip_ranges.list(\*\*params) -> PublicNetworkList +- client.cdn.ip_ranges.list_ips(\*\*params) -> PublicIPList diff --git a/src/gcore/resources/cloud/api.md b/src/gcore/resources/cloud/api.md new file mode 100644 index 00000000..5e26e6a1 --- /dev/null +++ b/src/gcore/resources/cloud/api.md @@ -0,0 +1,1181 @@ +# Cloud + +Types: + +```python +from gcore.types.cloud import ( + AllowedAddressPairs, + BaremetalFlavor, + BaremetalFlavorList, + BlackholePort, + Console, + DDOSProfile, + DDOSProfileField, + DDOSProfileOptionList, + DDOSProfileStatus, + DDOSProfileTemplate, + DDOSProfileTemplateField, + FixedAddress, + FixedAddressShort, + FlavorHardwareDescription, + FloatingAddress, + FloatingIP, + FloatingIPStatus, + GPUImage, + GPUImageList, + HTTPMethod, + Image, + ImageList, + Instance, + InstanceIsolation, + InstanceList, + InstanceMetricsTimeUnit, + InterfaceIPFamily, + IPAssignment, + IPVersion, + LaasIndexRetentionPolicy, + LoadBalancer, + LoadBalancerInstanceRole, + LoadBalancerMemberConnectivity, + LoadBalancerOperatingStatus, + LoadBalancerStatistics, + Logging, + Network, + NetworkAnySubnetFip, + NetworkDetails, + NetworkInterface, + NetworkInterfaceList, + NetworkSubnetFip, + ProvisioningStatus, + Route, + Subnet, + Tag, + TagList, + TagUpdateMap, + TaskIDList, +) +``` + +## Projects + +Types: + +```python +from gcore.types.cloud import Project +``` + +Methods: + +- client.cloud.projects.create(\*\*params) -> Project +- client.cloud.projects.update(\*, project_id, \*\*params) -> Project +- client.cloud.projects.list(\*\*params) -> SyncOffsetPage[Project] +- client.cloud.projects.delete(\*, project_id) -> TaskIDList +- client.cloud.projects.get(\*, project_id) -> Project + +## Tasks + +Types: + +```python +from gcore.types.cloud import Task +``` + +Methods: + +- client.cloud.tasks.list(\*\*params) -> SyncOffsetPage[Task] +- client.cloud.tasks.acknowledge_all(\*\*params) -> None +- client.cloud.tasks.acknowledge_one(task_id) -> Task +- client.cloud.tasks.get(task_id) -> Task + +## Regions + +Types: + +```python +from gcore.types.cloud import Region +``` + +Methods: + +- client.cloud.regions.list(\*\*params) -> SyncOffsetPage[Region] +- client.cloud.regions.get(\*, region_id, \*\*params) -> Region + +## Quotas + +Types: + +```python +from gcore.types.cloud import QuotaGetAllResponse, QuotaGetByRegionResponse, QuotaGetGlobalResponse +``` + +Methods: + +- client.cloud.quotas.get_all() -> QuotaGetAllResponse +- client.cloud.quotas.get_by_region(\*, client_id, region_id) -> QuotaGetByRegionResponse +- client.cloud.quotas.get_global(client_id) -> QuotaGetGlobalResponse + +### Requests + +Types: + +```python +from gcore.types.cloud.quotas import RequestListResponse, RequestGetResponse +``` + +Methods: + +- client.cloud.quotas.requests.create(\*\*params) -> None +- client.cloud.quotas.requests.list(\*\*params) -> SyncOffsetPage[RequestListResponse] +- client.cloud.quotas.requests.delete(request_id) -> None +- client.cloud.quotas.requests.get(request_id) -> RequestGetResponse + +## Secrets + +Types: + +```python +from gcore.types.cloud import Secret +``` + +Methods: + +- client.cloud.secrets.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Secret] +- client.cloud.secrets.delete(secret_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.secrets.get(secret_id, \*, project_id, region_id) -> Secret +- client.cloud.secrets.upload_tls_certificate(\*, project_id, region_id, \*\*params) -> TaskIDList + +## SSHKeys + +Types: + +```python +from gcore.types.cloud import SSHKey, SSHKeyCreated +``` + +Methods: + +- client.cloud.ssh_keys.create(\*, project_id, \*\*params) -> SSHKeyCreated +- 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 +- client.cloud.ssh_keys.get(ssh_key_id, \*, project_id) -> SSHKey + +## IPRanges + +Types: + +```python +from gcore.types.cloud import IPRanges +``` + +Methods: + +- client.cloud.ip_ranges.list() -> IPRanges + +## LoadBalancers + +Types: + +```python +from gcore.types.cloud import ( + HealthMonitor, + HealthMonitorStatus, + LbAlgorithm, + LbHealthMonitorType, + LbListenerProtocol, + LbPoolProtocol, + LbSessionPersistenceType, + ListenerStatus, + LoadBalancerFlavorDetail, + LoadBalancerFlavorList, + LoadBalancerL7Policy, + LoadBalancerL7PolicyList, + LoadBalancerL7Rule, + LoadBalancerL7RuleList, + LoadBalancerListenerDetail, + LoadBalancerListenerList, + LoadBalancerMetrics, + LoadBalancerMetricsList, + LoadBalancerPool, + LoadBalancerPoolList, + LoadBalancerStatus, + LoadBalancerStatusList, + Member, + MemberStatus, + PoolStatus, + SessionPersistence, +) +``` + +Methods: + +- client.cloud.load_balancers.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.update(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer +- client.cloud.load_balancers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[LoadBalancer] +- client.cloud.load_balancers.delete(load_balancer_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.load_balancers.failover(load_balancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.get(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancer +- client.cloud.load_balancers.resize(load_balancer_id, \*, project_id, region_id, \*\*params) -> TaskIDList + +### L7Policies + +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 + +#### Rules + +Methods: + +- client.cloud.load_balancers.l7_policies.rules.create(l7policy_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.l7_policies.rules.list(l7policy_id, \*, project_id, region_id) -> LoadBalancerL7RuleList +- client.cloud.load_balancers.l7_policies.rules.delete(l7rule_id, \*, project_id, region_id, l7policy_id) -> TaskIDList +- client.cloud.load_balancers.l7_policies.rules.get(l7rule_id, \*, project_id, region_id, l7policy_id) -> LoadBalancerL7Rule +- client.cloud.load_balancers.l7_policies.rules.replace(l7rule_id, \*, project_id, region_id, l7policy_id, \*\*params) -> TaskIDList + +### Flavors + +Methods: + +- client.cloud.load_balancers.flavors.list(\*, project_id, region_id, \*\*params) -> LoadBalancerFlavorList + +### Listeners + +Methods: + +- client.cloud.load_balancers.listeners.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.listeners.update(listener_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.listeners.list(\*, project_id, region_id, \*\*params) -> LoadBalancerListenerList +- client.cloud.load_balancers.listeners.delete(listener_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.listeners.get(listener_id, \*, project_id, region_id, \*\*params) -> LoadBalancerListenerDetail + +### Pools + +Methods: + +- client.cloud.load_balancers.pools.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.pools.update(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.pools.list(\*, project_id, region_id, \*\*params) -> LoadBalancerPoolList +- client.cloud.load_balancers.pools.delete(pool_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.load_balancers.pools.get(pool_id, \*, project_id, region_id) -> LoadBalancerPool + +#### HealthMonitors + +Methods: + +- client.cloud.load_balancers.pools.health_monitors.create(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.pools.health_monitors.delete(pool_id, \*, project_id, region_id) -> None + +#### Members + +Methods: + +- 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 + +Methods: + +- client.cloud.load_balancers.metrics.list(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancerMetricsList + +### Statuses + +Methods: + +- client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> LoadBalancerStatusList +- client.cloud.load_balancers.statuses.get(load_balancer_id, \*, project_id, region_id) -> LoadBalancerStatus + +## ReservedFixedIPs + +Types: + +```python +from gcore.types.cloud import ReservedFixedIP +``` + +Methods: + +- client.cloud.reserved_fixed_ips.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.reserved_fixed_ips.update(port_id, \*, project_id, region_id, \*\*params) -> ReservedFixedIP +- client.cloud.reserved_fixed_ips.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[ReservedFixedIP] +- client.cloud.reserved_fixed_ips.delete(port_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.reserved_fixed_ips.get(port_id, \*, project_id, region_id) -> ReservedFixedIP + +### Vip + +Types: + +```python +from gcore.types.cloud.reserved_fixed_ips import IPWithSubnet +``` + +Methods: + +- client.cloud.reserved_fixed_ips.vip.toggle(port_id, \*, project_id, region_id, \*\*params) -> ReservedFixedIP + +#### CandidatePorts + +Types: + +```python +from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePort, CandidatePortList +``` + +Methods: + +- client.cloud.reserved_fixed_ips.vip.candidate_ports.list(port_id, \*, project_id, region_id) -> CandidatePortList + +#### ConnectedPorts + +Types: + +```python +from gcore.types.cloud.reserved_fixed_ips.vip import ConnectedPort, ConnectedPortList +``` + +Methods: + +- client.cloud.reserved_fixed_ips.vip.connected_ports.list(port_id, \*, project_id, region_id) -> ConnectedPortList +- client.cloud.reserved_fixed_ips.vip.connected_ports.add(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList +- client.cloud.reserved_fixed_ips.vip.connected_ports.replace(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList + +## Networks + +Methods: + +- client.cloud.networks.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.networks.update(network_id, \*, project_id, region_id, \*\*params) -> Network +- client.cloud.networks.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Network] +- client.cloud.networks.delete(network_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.networks.get(network_id, \*, project_id, region_id) -> Network + +### Subnets + +Methods: + +- client.cloud.networks.subnets.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.networks.subnets.update(subnet_id, \*, project_id, region_id, \*\*params) -> Subnet +- client.cloud.networks.subnets.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Subnet] +- client.cloud.networks.subnets.delete(subnet_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.networks.subnets.get(subnet_id, \*, project_id, region_id) -> Subnet + +### Routers + +Types: + +```python +from gcore.types.cloud.networks import Router, RouterList, SubnetID +``` + +Methods: + +- client.cloud.networks.routers.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.networks.routers.update(router_id, \*, project_id, region_id, \*\*params) -> Router +- client.cloud.networks.routers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Router] +- client.cloud.networks.routers.delete(router_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.networks.routers.attach_subnet(router_id, \*, project_id, region_id, \*\*params) -> Router +- client.cloud.networks.routers.detach_subnet(router_id, \*, project_id, region_id, \*\*params) -> Router +- client.cloud.networks.routers.get(router_id, \*, project_id, region_id) -> Router + +## Volumes + +Types: + +```python +from gcore.types.cloud import Volume +``` + +Methods: + +- client.cloud.volumes.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volumes.update(volume_id, \*, project_id, region_id, \*\*params) -> Volume +- client.cloud.volumes.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Volume] +- client.cloud.volumes.delete(volume_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volumes.attach_to_instance(volume_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volumes.change_type(volume_id, \*, project_id, region_id, \*\*params) -> Volume +- client.cloud.volumes.detach_from_instance(volume_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volumes.get(volume_id, \*, project_id, region_id) -> Volume +- client.cloud.volumes.resize(volume_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volumes.revert_to_last_snapshot(volume_id, \*, project_id, region_id) -> None + +## FloatingIPs + +Types: + +```python +from gcore.types.cloud import FloatingIPDetailed +``` + +Methods: + +- client.cloud.floating_ips.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.floating_ips.update(floating_ip_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.floating_ips.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[FloatingIPDetailed] +- client.cloud.floating_ips.delete(floating_ip_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.floating_ips.assign(floating_ip_id, \*, project_id, region_id, \*\*params) -> FloatingIP +- client.cloud.floating_ips.get(floating_ip_id, \*, project_id, region_id) -> FloatingIP +- client.cloud.floating_ips.unassign(floating_ip_id, \*, project_id, region_id) -> FloatingIP + +## SecurityGroups + +Types: + +```python +from gcore.types.cloud import SecurityGroup, SecurityGroupRule +``` + +Methods: + +- client.cloud.security_groups.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.security_groups.update(group_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.security_groups.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[SecurityGroup] +- client.cloud.security_groups.delete(group_id, \*, project_id, region_id) -> None +- client.cloud.security_groups.copy(group_id, \*, project_id, region_id, \*\*params) -> SecurityGroup +- client.cloud.security_groups.get(group_id, \*, project_id, region_id) -> SecurityGroup +- client.cloud.security_groups.revert_to_default(group_id, \*, project_id, region_id) -> SecurityGroup + +### Rules + +Methods: + +- client.cloud.security_groups.rules.create(group_id, \*, project_id, region_id, \*\*params) -> SecurityGroupRule +- client.cloud.security_groups.rules.delete(rule_id, \*, project_id, region_id) -> None +- client.cloud.security_groups.rules.replace(rule_id, \*, project_id, region_id, \*\*params) -> SecurityGroupRule + +## Users + +### RoleAssignments + +Types: + +```python +from gcore.types.cloud.users import RoleAssignment, RoleAssignmentUpdatedDeleted +``` + +Methods: + +- client.cloud.users.role_assignments.create(\*\*params) -> RoleAssignment +- client.cloud.users.role_assignments.update(assignment_id, \*\*params) -> RoleAssignmentUpdatedDeleted +- client.cloud.users.role_assignments.list(\*\*params) -> SyncOffsetPage[RoleAssignment] +- client.cloud.users.role_assignments.delete(assignment_id) -> RoleAssignmentUpdatedDeleted + +## Inference + +Types: + +```python +from gcore.types.cloud import InferenceRegionCapacity, InferenceRegionCapacityList +``` + +Methods: + +- client.cloud.inference.get_capacity_by_region() -> InferenceRegionCapacityList + +### Flavors + +Types: + +```python +from gcore.types.cloud.inference import InferenceFlavor +``` + +Methods: + +- client.cloud.inference.flavors.list(\*\*params) -> SyncOffsetPage[InferenceFlavor] +- client.cloud.inference.flavors.get(flavor_name) -> InferenceFlavor + +### Deployments + +Types: + +```python +from gcore.types.cloud.inference import ( + InferenceDeployment, + InferenceDeploymentAPIKey, + Probe, + ProbeConfig, + ProbeExec, + ProbeHTTPGet, + ProbeTcpSocket, +) +``` + +Methods: + +- client.cloud.inference.deployments.create(\*, project_id, \*\*params) -> TaskIDList +- client.cloud.inference.deployments.update(deployment_name, \*, project_id, \*\*params) -> TaskIDList +- client.cloud.inference.deployments.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceDeployment] +- client.cloud.inference.deployments.delete(deployment_name, \*, project_id) -> TaskIDList +- client.cloud.inference.deployments.get(deployment_name, \*, project_id) -> InferenceDeployment +- client.cloud.inference.deployments.get_api_key(deployment_name, \*, project_id) -> InferenceDeploymentAPIKey +- client.cloud.inference.deployments.start(deployment_name, \*, project_id) -> None +- client.cloud.inference.deployments.stop(deployment_name, \*, project_id) -> None + +#### Logs + +Types: + +```python +from gcore.types.cloud.inference.deployments import InferenceDeploymentLog +``` + +Methods: + +- client.cloud.inference.deployments.logs.list(deployment_name, \*, project_id, \*\*params) -> SyncOffsetPage[InferenceDeploymentLog] + +### RegistryCredentials + +Types: + +```python +from gcore.types.cloud.inference import InferenceRegistryCredentials +``` + +Methods: + +- client.cloud.inference.registry_credentials.create(\*, project_id, \*\*params) -> InferenceRegistryCredentials +- client.cloud.inference.registry_credentials.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceRegistryCredentials] +- client.cloud.inference.registry_credentials.delete(credential_name, \*, project_id) -> None +- client.cloud.inference.registry_credentials.get(credential_name, \*, project_id) -> InferenceRegistryCredentials +- client.cloud.inference.registry_credentials.replace(credential_name, \*, project_id, \*\*params) -> InferenceRegistryCredentials + +### Secrets + +Types: + +```python +from gcore.types.cloud.inference import InferenceSecret +``` + +Methods: + +- client.cloud.inference.secrets.create(\*, project_id, \*\*params) -> InferenceSecret +- client.cloud.inference.secrets.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceSecret] +- client.cloud.inference.secrets.delete(secret_name, \*, project_id) -> None +- client.cloud.inference.secrets.get(secret_name, \*, project_id) -> InferenceSecret +- client.cloud.inference.secrets.replace(secret_name, \*, project_id, \*\*params) -> InferenceSecret + +### APIKeys + +Types: + +```python +from gcore.types.cloud.inference import InferenceAPIKey, InferenceAPIKeyCreated +``` + +Methods: + +- client.cloud.inference.api_keys.create(\*, project_id, \*\*params) -> InferenceAPIKeyCreated +- client.cloud.inference.api_keys.update(api_key_name, \*, project_id, \*\*params) -> InferenceAPIKey +- client.cloud.inference.api_keys.list(\*, project_id, \*\*params) -> SyncOffsetPage[InferenceAPIKey] +- client.cloud.inference.api_keys.delete(api_key_name, \*, project_id) -> None +- client.cloud.inference.api_keys.get(api_key_name, \*, project_id) -> InferenceAPIKey + +### Applications + +#### Deployments + +Types: + +```python +from gcore.types.cloud.inference.applications import ( + InferenceApplicationDeployment, + InferenceApplicationDeploymentList, +) +``` + +Methods: + +- client.cloud.inference.applications.deployments.create(\*, project_id, \*\*params) -> TaskIDList +- client.cloud.inference.applications.deployments.update(deployment_name, \*, project_id, \*\*params) -> TaskIDList +- client.cloud.inference.applications.deployments.list(\*, project_id) -> InferenceApplicationDeploymentList +- client.cloud.inference.applications.deployments.delete(deployment_name, \*, project_id) -> TaskIDList +- client.cloud.inference.applications.deployments.get(deployment_name, \*, project_id) -> InferenceApplicationDeployment + +#### Templates + +Types: + +```python +from gcore.types.cloud.inference.applications import ( + InferenceApplicationTemplate, + InferenceApplicationTemplateList, +) +``` + +Methods: + +- client.cloud.inference.applications.templates.list() -> InferenceApplicationTemplateList +- client.cloud.inference.applications.templates.get(application_name) -> InferenceApplicationTemplate + +## PlacementGroups + +Types: + +```python +from gcore.types.cloud import PlacementGroup, PlacementGroupList +``` + +Methods: + +- client.cloud.placement_groups.create(\*, project_id, region_id, \*\*params) -> PlacementGroup +- client.cloud.placement_groups.list(\*, project_id, region_id) -> PlacementGroupList +- client.cloud.placement_groups.delete(group_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.placement_groups.get(group_id, \*, project_id, region_id) -> PlacementGroup + +## Baremetal + +### Images + +Methods: + +- client.cloud.baremetal.images.list(\*, project_id, region_id, \*\*params) -> ImageList + +### Flavors + +Methods: + +- client.cloud.baremetal.flavors.list(\*, project_id, region_id, \*\*params) -> BaremetalFlavorList + +### Servers + +Types: + +```python +from gcore.types.cloud.baremetal import ( + BaremetalFixedAddress, + BaremetalFloatingAddress, + BaremetalServer, +) +``` + +Methods: + +- client.cloud.baremetal.servers.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.baremetal.servers.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[BaremetalServer] +- client.cloud.baremetal.servers.rebuild(server_id, \*, project_id, region_id, \*\*params) -> TaskIDList + +## Registries + +Types: + +```python +from gcore.types.cloud import Registry, RegistryList, RegistryTag +``` + +Methods: + +- client.cloud.registries.create(\*, project_id, region_id, \*\*params) -> Registry +- client.cloud.registries.list(\*, project_id, region_id) -> RegistryList +- client.cloud.registries.delete(registry_id, \*, project_id, region_id) -> None +- client.cloud.registries.get(registry_id, \*, project_id, region_id) -> Registry +- client.cloud.registries.resize(registry_id, \*, project_id, region_id, \*\*params) -> Registry + +### Repositories + +Types: + +```python +from gcore.types.cloud.registries import RegistryRepository, RegistryRepositoryList +``` + +Methods: + +- client.cloud.registries.repositories.list(registry_id, \*, project_id, region_id) -> RegistryRepositoryList +- client.cloud.registries.repositories.delete(repository_name, \*, project_id, region_id, registry_id) -> None + +### Artifacts + +Types: + +```python +from gcore.types.cloud.registries import RegistryArtifact, RegistryArtifactList +``` + +Methods: + +- client.cloud.registries.artifacts.list(repository_name, \*, project_id, region_id, registry_id) -> RegistryArtifactList +- client.cloud.registries.artifacts.delete(digest, \*, project_id, region_id, registry_id, repository_name) -> None + +### Tags + +Methods: + +- client.cloud.registries.tags.delete(tag_name, \*, project_id, region_id, registry_id, repository_name, digest) -> None + +### Users + +Types: + +```python +from gcore.types.cloud.registries import ( + RegistryUser, + RegistryUserCreated, + RegistryUserList, + UserRefreshSecretResponse, +) +``` + +Methods: + +- client.cloud.registries.users.create(registry_id, \*, project_id, region_id, \*\*params) -> RegistryUserCreated +- 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.refresh_secret(user_id, \*, project_id, region_id, registry_id) -> UserRefreshSecretResponse + +## FileShares + +Types: + +```python +from gcore.types.cloud import FileShare +``` + +Methods: + +- client.cloud.file_shares.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.file_shares.update(file_share_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.file_shares.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[FileShare] +- client.cloud.file_shares.delete(file_share_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.file_shares.get(file_share_id, \*, project_id, region_id) -> FileShare +- client.cloud.file_shares.resize(file_share_id, \*, project_id, region_id, \*\*params) -> TaskIDList + +### AccessRules + +Types: + +```python +from gcore.types.cloud.file_shares import AccessRule, AccessRuleList +``` + +Methods: + +- client.cloud.file_shares.access_rules.create(file_share_id, \*, project_id, region_id, \*\*params) -> AccessRule +- client.cloud.file_shares.access_rules.list(file_share_id, \*, project_id, region_id) -> AccessRuleList +- client.cloud.file_shares.access_rules.delete(access_rule_id, \*, project_id, region_id, file_share_id) -> None + +## BillingReservations + +Types: + +```python +from gcore.types.cloud import BillingReservation, BillingReservations +``` + +Methods: + +- client.cloud.billing_reservations.list(\*\*params) -> BillingReservations + +## GPUBaremetal + +### Clusters + +Types: + +```python +from gcore.types.cloud.gpu_baremetal import GPUBaremetalCluster +``` + +Methods: + +- client.cloud.gpu_baremetal.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalCluster] +- client.cloud.gpu_baremetal.clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.get(cluster_id, \*, project_id, region_id) -> GPUBaremetalCluster +- client.cloud.gpu_baremetal.clusters.powercycle_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List +- client.cloud.gpu_baremetal.clusters.reboot_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List +- client.cloud.gpu_baremetal.clusters.rebuild(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.resize(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList + +#### Interfaces + +Methods: + +- client.cloud.gpu_baremetal.clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> NetworkInterfaceList +- client.cloud.gpu_baremetal.clusters.interfaces.attach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.interfaces.detach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList + +#### Servers + +Types: + +```python +from gcore.types.cloud.gpu_baremetal.clusters import ( + GPUBaremetalClusterServer, + GPUBaremetalClusterServerV1, + GPUBaremetalClusterServerV1List, +) +``` + +Methods: + +- client.cloud.gpu_baremetal.clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalClusterServer] +- client.cloud.gpu_baremetal.clusters.servers.delete(instance_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.servers.get_console(instance_id, \*, project_id, region_id) -> Console +- client.cloud.gpu_baremetal.clusters.servers.powercycle(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 +- client.cloud.gpu_baremetal.clusters.servers.reboot(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 + +#### Flavors + +Types: + +```python +from gcore.types.cloud.gpu_baremetal.clusters import GPUBaremetalFlavor, GPUBaremetalFlavorList +``` + +Methods: + +- client.cloud.gpu_baremetal.clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUBaremetalFlavorList + +#### Images + +Methods: + +- client.cloud.gpu_baremetal.clusters.images.list(\*, project_id, region_id) -> GPUImageList +- client.cloud.gpu_baremetal.clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.gpu_baremetal.clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage +- client.cloud.gpu_baremetal.clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList + +## GPUVirtual + +### Clusters + +Types: + +```python +from gcore.types.cloud.gpu_virtual import GPUVirtualCluster +``` + +Methods: + +- client.cloud.gpu_virtual.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.update(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualCluster +- client.cloud.gpu_virtual.clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUVirtualCluster] +- client.cloud.gpu_virtual.clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.get(cluster_id, \*, project_id, region_id) -> GPUVirtualCluster + +#### Servers + +Types: + +```python +from gcore.types.cloud.gpu_virtual.clusters import ( + GPUVirtualClusterServer, + GPUVirtualClusterServerList, +) +``` + +Methods: + +- client.cloud.gpu_virtual.clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualClusterServerList +- client.cloud.gpu_virtual.clusters.servers.delete(server_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList + +#### Volumes + +Types: + +```python +from gcore.types.cloud.gpu_virtual.clusters import ( + GPUVirtualClusterVolume, + GPUVirtualClusterVolumeList, +) +``` + +Methods: + +- client.cloud.gpu_virtual.clusters.volumes.list(cluster_id, \*, project_id, region_id) -> GPUVirtualClusterVolumeList + +#### Interfaces + +Types: + +```python +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualInterface, GPUVirtualInterfaceList +``` + +Methods: + +- client.cloud.gpu_virtual.clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> GPUVirtualInterfaceList + +#### Flavors + +Types: + +```python +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualFlavor, GPUVirtualFlavorList +``` + +Methods: + +- client.cloud.gpu_virtual.clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUVirtualFlavorList + +#### Images + +Methods: + +- client.cloud.gpu_virtual.clusters.images.list(\*, project_id, region_id) -> GPUImageList +- client.cloud.gpu_virtual.clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.gpu_virtual.clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage +- client.cloud.gpu_virtual.clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList + +## Instances + +Types: + +```python +from gcore.types.cloud import InstanceInterface +``` + +Methods: + +- client.cloud.instances.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.update(instance_id, \*, project_id, region_id, \*\*params) -> Instance +- client.cloud.instances.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[Instance] +- client.cloud.instances.delete(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.action(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.add_to_placement_group(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.assign_security_group(instance_id, \*, project_id, region_id, \*\*params) -> None +- client.cloud.instances.disable_port_security(port_id, \*, project_id, region_id) -> InstanceInterface +- client.cloud.instances.enable_port_security(port_id, \*, project_id, region_id) -> InstanceInterface +- client.cloud.instances.get(instance_id, \*, project_id, region_id) -> Instance +- client.cloud.instances.get_console(instance_id, \*, project_id, region_id, \*\*params) -> Console +- client.cloud.instances.remove_from_placement_group(instance_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.instances.resize(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.unassign_security_group(instance_id, \*, project_id, region_id, \*\*params) -> None + +### Flavors + +Types: + +```python +from gcore.types.cloud.instances import InstanceFlavorDetailed, InstanceFlavorList +``` + +Methods: + +- client.cloud.instances.flavors.list(\*, project_id, region_id, \*\*params) -> InstanceFlavorList + +### Interfaces + +Methods: + +- client.cloud.instances.interfaces.list(instance_id, \*, project_id, region_id) -> NetworkInterfaceList +- client.cloud.instances.interfaces.attach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.interfaces.detach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList + +### Images + +Methods: + +- client.cloud.instances.images.update(image_id, \*, project_id, region_id, \*\*params) -> Image +- client.cloud.instances.images.list(\*, project_id, region_id, \*\*params) -> ImageList +- client.cloud.instances.images.delete(image_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.instances.images.create_from_volume(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.instances.images.get(image_id, \*, project_id, region_id, \*\*params) -> Image +- client.cloud.instances.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList + +### Metrics + +Types: + +```python +from gcore.types.cloud.instances import Metrics, MetricsList +``` + +Methods: + +- client.cloud.instances.metrics.list(instance_id, \*, project_id, region_id, \*\*params) -> MetricsList + +## K8S + +Types: + +```python +from gcore.types.cloud import K8SClusterVersion, K8SClusterVersionList +``` + +Methods: + +- client.cloud.k8s.list_versions(\*, project_id, region_id) -> K8SClusterVersionList + +### Flavors + +Methods: + +- client.cloud.k8s.flavors.list(\*, project_id, region_id, \*\*params) -> BaremetalFlavorList + +### Clusters + +Types: + +```python +from gcore.types.cloud.k8s import ( + K8SCluster, + K8SClusterCertificate, + K8SClusterKubeconfig, + K8SClusterList, +) +``` + +Methods: + +- client.cloud.k8s.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.k8s.clusters.update(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.k8s.clusters.list(\*, project_id, region_id) -> K8SClusterList +- client.cloud.k8s.clusters.delete(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.k8s.clusters.get(cluster_name, \*, project_id, region_id) -> K8SCluster +- client.cloud.k8s.clusters.get_certificate(cluster_name, \*, project_id, region_id) -> K8SClusterCertificate +- client.cloud.k8s.clusters.get_kubeconfig(cluster_name, \*, project_id, region_id) -> K8SClusterKubeconfig +- client.cloud.k8s.clusters.list_versions_for_upgrade(cluster_name, \*, project_id, region_id) -> K8SClusterVersionList +- client.cloud.k8s.clusters.upgrade(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList + +#### Nodes + +Methods: + +- client.cloud.k8s.clusters.nodes.list(cluster_name, \*, project_id, region_id, \*\*params) -> InstanceList +- client.cloud.k8s.clusters.nodes.delete(instance_id, \*, project_id, region_id, cluster_name) -> None + +#### Pools + +Types: + +```python +from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolList, K8SClusterPoolQuota +``` + +Methods: + +- client.cloud.k8s.clusters.pools.create(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.k8s.clusters.pools.update(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> K8SClusterPool +- client.cloud.k8s.clusters.pools.list(cluster_name, \*, project_id, region_id) -> K8SClusterPoolList +- client.cloud.k8s.clusters.pools.delete(pool_name, \*, project_id, region_id, cluster_name) -> TaskIDList +- client.cloud.k8s.clusters.pools.check_quota(\*, project_id, region_id, \*\*params) -> K8SClusterPoolQuota +- client.cloud.k8s.clusters.pools.get(pool_name, \*, project_id, region_id, cluster_name) -> K8SClusterPool +- client.cloud.k8s.clusters.pools.resize(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> TaskIDList + +##### Nodes + +Methods: + +- client.cloud.k8s.clusters.pools.nodes.list(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> InstanceList +- client.cloud.k8s.clusters.pools.nodes.delete(instance_id, \*, project_id, region_id, cluster_name, pool_name) -> None + +## AuditLogs + +Types: + +```python +from gcore.types.cloud import AuditLogEntry +``` + +Methods: + +- client.cloud.audit_logs.list(\*\*params) -> SyncOffsetPage[AuditLogEntry] + +## CostReports + +Types: + +```python +from gcore.types.cloud import CostReportAggregated, CostReportAggregatedMonthly, CostReportDetailed +``` + +Methods: + +- client.cloud.cost_reports.get_aggregated(\*\*params) -> CostReportAggregated +- client.cloud.cost_reports.get_aggregated_monthly(\*\*params) -> CostReportAggregatedMonthly +- client.cloud.cost_reports.get_detailed(\*\*params) -> CostReportDetailed + +## UsageReports + +Types: + +```python +from gcore.types.cloud import UsageReport +``` + +Methods: + +- client.cloud.usage_reports.get(\*\*params) -> UsageReport + +## Databases + +### Postgres + +#### Clusters + +Types: + +```python +from gcore.types.cloud.databases.postgres import PostgresCluster, PostgresClusterShort +``` + +Methods: + +- client.cloud.databases.postgres.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.databases.postgres.clusters.update(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.databases.postgres.clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[PostgresClusterShort] +- client.cloud.databases.postgres.clusters.delete(cluster_name, \*, project_id, region_id) -> TaskIDList +- client.cloud.databases.postgres.clusters.get(cluster_name, \*, project_id, region_id) -> PostgresCluster + +##### UserCredentials + +Types: + +```python +from gcore.types.cloud.databases.postgres.clusters import PostgresUserCredentials +``` + +Methods: + +- client.cloud.databases.postgres.clusters.user_credentials.get(username, \*, project_id, region_id, cluster_name) -> PostgresUserCredentials +- client.cloud.databases.postgres.clusters.user_credentials.regenerate(username, \*, project_id, region_id, cluster_name) -> PostgresUserCredentials + +#### Configurations + +Types: + +```python +from gcore.types.cloud.databases.postgres import PostgresConfiguration +``` + +Methods: + +- client.cloud.databases.postgres.configurations.get(\*, project_id, region_id) -> PostgresConfiguration + +#### CustomConfigurations + +Types: + +```python +from gcore.types.cloud.databases.postgres import PgConfValidation +``` + +Methods: + +- client.cloud.databases.postgres.custom_configurations.validate(\*, project_id, region_id, \*\*params) -> PgConfValidation + +## VolumeSnapshots + +Types: + +```python +from gcore.types.cloud import Snapshot +``` + +Methods: + +- client.cloud.volume_snapshots.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volume_snapshots.update(snapshot_id, \*, project_id, region_id, \*\*params) -> Snapshot +- client.cloud.volume_snapshots.delete(snapshot_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.volume_snapshots.get(snapshot_id, \*, project_id, region_id) -> Snapshot diff --git a/src/gcore/resources/dns/api.md b/src/gcore/resources/dns/api.md new file mode 100644 index 00000000..ff89a8bc --- /dev/null +++ b/src/gcore/resources/dns/api.md @@ -0,0 +1,159 @@ +# DNS + +Types: + +```python +from gcore.types.dns import DNSGetAccountOverviewResponse, DNSLookupResponse +``` + +Methods: + +- client.dns.get_account_overview() -> DNSGetAccountOverviewResponse +- client.dns.lookup(\*\*params) -> DNSLookupResponse + +## Locations + +Types: + +```python +from gcore.types.dns import ( + DNSLocationTranslations, + LocationListResponse, + LocationListContinentsResponse, + LocationListCountriesResponse, + LocationListRegionsResponse, +) +``` + +Methods: + +- client.dns.locations.list() -> LocationListResponse +- client.dns.locations.list_continents() -> LocationListContinentsResponse +- client.dns.locations.list_countries() -> LocationListCountriesResponse +- client.dns.locations.list_regions() -> LocationListRegionsResponse + +## Metrics + +Types: + +```python +from gcore.types.dns import MetricListResponse +``` + +Methods: + +- client.dns.metrics.list(\*\*params) -> str + +## Pickers + +Types: + +```python +from gcore.types.dns import DNSLabelName, PickerListResponse +``` + +Methods: + +- client.dns.pickers.list() -> PickerListResponse + +### Presets + +Types: + +```python +from gcore.types.dns.pickers import PresetListResponse +``` + +Methods: + +- client.dns.pickers.presets.list() -> PresetListResponse + +## Zones + +Types: + +```python +from gcore.types.dns import ( + DNSNameServer, + ZoneCreateResponse, + ZoneListResponse, + ZoneCheckDelegationStatusResponse, + ZoneExportResponse, + ZoneGetResponse, + ZoneGetStatisticsResponse, + ZoneImportResponse, +) +``` + +Methods: + +- client.dns.zones.create(\*\*params) -> ZoneCreateResponse +- client.dns.zones.list(\*\*params) -> ZoneListResponse +- client.dns.zones.delete(name) -> object +- client.dns.zones.check_delegation_status(name) -> ZoneCheckDelegationStatusResponse +- client.dns.zones.disable(name) -> object +- client.dns.zones.enable(name) -> object +- client.dns.zones.export(zone_name) -> ZoneExportResponse +- client.dns.zones.get(name) -> ZoneGetResponse +- client.dns.zones.get_statistics(name, \*\*params) -> ZoneGetStatisticsResponse +- client.dns.zones.import\_(zone_name, \*\*params) -> ZoneImportResponse +- client.dns.zones.replace(path_name, \*\*params) -> object + +### Dnssec + +Types: + +```python +from gcore.types.dns.zones import DnssecUpdateResponse, DnssecGetResponse +``` + +Methods: + +- client.dns.zones.dnssec.update(name, \*\*params) -> DnssecUpdateResponse +- client.dns.zones.dnssec.get(name) -> DnssecGetResponse + +### Rrsets + +Types: + +```python +from gcore.types.dns.zones import ( + DNSFailoverLog, + DNSOutputRrset, + RrsetListResponse, + RrsetGetFailoverLogsResponse, +) +``` + +Methods: + +- client.dns.zones.rrsets.create(rrset_type, \*, zone_name, rrset_name, \*\*params) -> DNSOutputRrset +- client.dns.zones.rrsets.list(zone_name, \*\*params) -> RrsetListResponse +- client.dns.zones.rrsets.delete(rrset_type, \*, zone_name, rrset_name) -> object +- client.dns.zones.rrsets.get(rrset_type, \*, zone_name, rrset_name) -> DNSOutputRrset +- 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(id, \*\*params) -> object diff --git a/src/gcore/resources/fastedge/api.md b/src/gcore/resources/fastedge/api.md new file mode 100644 index 00000000..8d835d33 --- /dev/null +++ b/src/gcore/resources/fastedge/api.md @@ -0,0 +1,122 @@ +# Fastedge + +Types: + +```python +from gcore.types.fastedge import Client +``` + +Methods: + +- client.fastedge.get_account_overview() -> Client + +## Templates + +Types: + +```python +from gcore.types.fastedge import Template, TemplateParameter, TemplateShort +``` + +Methods: + +- client.fastedge.templates.create(\*\*params) -> TemplateShort +- client.fastedge.templates.list(\*\*params) -> SyncOffsetPageFastedgeTemplates[TemplateShort] +- client.fastedge.templates.delete(id, \*\*params) -> None +- client.fastedge.templates.get(id) -> Template +- client.fastedge.templates.replace(id, \*\*params) -> TemplateShort + +## Secrets + +Types: + +```python +from gcore.types.fastedge import Secret, SecretShort, SecretCreateResponse, SecretListResponse +``` + +Methods: + +- client.fastedge.secrets.create(\*\*params) -> SecretCreateResponse +- client.fastedge.secrets.update(id, \*\*params) -> Secret +- client.fastedge.secrets.list(\*\*params) -> SecretListResponse +- client.fastedge.secrets.delete(id, \*\*params) -> None +- client.fastedge.secrets.get(id) -> Secret +- client.fastedge.secrets.replace(id, \*\*params) -> Secret + +## Binaries + +Types: + +```python +from gcore.types.fastedge import Binary, BinaryShort, BinaryListResponse +``` + +Methods: + +- client.fastedge.binaries.create(body, \*\*params) -> BinaryShort +- client.fastedge.binaries.list() -> BinaryListResponse +- client.fastedge.binaries.delete(id) -> None +- client.fastedge.binaries.get(id) -> Binary + +## Statistics + +Types: + +```python +from gcore.types.fastedge import ( + CallStatus, + DurationStats, + StatisticGetCallSeriesResponse, + StatisticGetDurationSeriesResponse, +) +``` + +Methods: + +- client.fastedge.statistics.get_call_series(\*\*params) -> StatisticGetCallSeriesResponse +- client.fastedge.statistics.get_duration_series(\*\*params) -> StatisticGetDurationSeriesResponse + +## Apps + +Types: + +```python +from gcore.types.fastedge import App, AppShort +``` + +Methods: + +- client.fastedge.apps.create(\*\*params) -> AppShort +- client.fastedge.apps.update(id, \*\*params) -> AppShort +- client.fastedge.apps.list(\*\*params) -> SyncOffsetPageFastedgeApps[AppShort] +- client.fastedge.apps.delete(id) -> None +- client.fastedge.apps.get(id) -> App +- client.fastedge.apps.replace(id, \*\*params) -> AppShort + +### Logs + +Types: + +```python +from gcore.types.fastedge.apps import Log +``` + +Methods: + +- client.fastedge.apps.logs.list(id, \*\*params) -> SyncOffsetPageFastedgeAppLogs[Log] + +## KvStores + +Types: + +```python +from gcore.types.fastedge import KvStore, KvStoreShort, KvStoreCreateResponse, KvStoreListResponse +``` + +Methods: + +- client.fastedge.kv_stores.create(\*\*params) -> KvStoreCreateResponse +- client.fastedge.kv_stores.list(\*\*params) -> KvStoreListResponse +- client.fastedge.kv_stores.delete(id) -> None +- client.fastedge.kv_stores.get(id) -> KvStore +- client.fastedge.kv_stores.replace(id, \*\*params) -> KvStore diff --git a/src/gcore/resources/iam/api.md b/src/gcore/resources/iam/api.md new file mode 100644 index 00000000..b6411972 --- /dev/null +++ b/src/gcore/resources/iam/api.md @@ -0,0 +1,42 @@ +# Iam + +Types: + +```python +from gcore.types.iam import AccountOverview +``` + +Methods: + +- client.iam.get_account_overview() -> AccountOverview + +## APITokens + +Types: + +```python +from gcore.types.iam import APIToken, APITokenCreated, APITokenList +``` + +Methods: + +- client.iam.api_tokens.create(client_id, \*\*params) -> APITokenCreated +- client.iam.api_tokens.list(client_id, \*\*params) -> APITokenList +- client.iam.api_tokens.delete(token_id, \*, client_id) -> None +- client.iam.api_tokens.get(token_id, \*, client_id) -> APIToken + +## Users + +Types: + +```python +from gcore.types.iam import User, UserDetailed, UserInvite, UserUpdated +``` + +Methods: + +- client.iam.users.update(user_id, \*\*params) -> UserUpdated +- client.iam.users.list(\*\*params) -> SyncOffsetPage[User] +- client.iam.users.delete(user_id, \*, client_id) -> None +- client.iam.users.get(user_id) -> UserDetailed +- client.iam.users.invite(\*\*params) -> UserInvite diff --git a/src/gcore/resources/security/api.md b/src/gcore/resources/security/api.md new file mode 100644 index 00000000..228f9548 --- /dev/null +++ b/src/gcore/resources/security/api.md @@ -0,0 +1,55 @@ +# Security + +## Events + +Types: + +```python +from gcore.types.security import ClientView +``` + +Methods: + +- client.security.events.list(\*\*params) -> SyncOffsetPage[ClientView] + +## BgpAnnounces + +Types: + +```python +from gcore.types.security import ClientAnnounce, BgpAnnounceListResponse +``` + +Methods: + +- client.security.bgp_announces.list(\*\*params) -> BgpAnnounceListResponse +- client.security.bgp_announces.toggle(\*\*params) -> object + +## ProfileTemplates + +Types: + +```python +from gcore.types.security import ClientProfileTemplate, ProfileTemplateListResponse +``` + +Methods: + +- client.security.profile_templates.list() -> ProfileTemplateListResponse + +## Profiles + +Types: + +```python +from gcore.types.security import ClientProfile, ProfileListResponse +``` + +Methods: + +- client.security.profiles.create(\*\*params) -> ClientProfile +- client.security.profiles.list(\*\*params) -> ProfileListResponse +- client.security.profiles.delete(id) -> None +- client.security.profiles.get(id) -> ClientProfile +- client.security.profiles.recreate(id, \*\*params) -> ClientProfile +- client.security.profiles.replace(id, \*\*params) -> ClientProfile diff --git a/src/gcore/resources/storage/api.md b/src/gcore/resources/storage/api.md new file mode 100644 index 00000000..83eea9dc --- /dev/null +++ b/src/gcore/resources/storage/api.md @@ -0,0 +1,97 @@ +# Storage + +Types: + +```python +from gcore.types.storage import Storage +``` + +Methods: + +- client.storage.create(\*\*params) -> Storage +- client.storage.update(storage_id, \*\*params) -> Storage +- client.storage.list(\*\*params) -> SyncOffsetPage[Storage] +- client.storage.delete(storage_id) -> None +- client.storage.get(storage_id) -> Storage +- client.storage.link_ssh_key(key_id, \*, storage_id) -> None +- client.storage.restore(storage_id, \*\*params) -> None +- client.storage.unlink_ssh_key(key_id, \*, storage_id) -> None + +## Locations + +Types: + +```python +from gcore.types.storage import Location +``` + +Methods: + +- client.storage.locations.list(\*\*params) -> SyncOffsetPage[Location] + +## Statistics + +Types: + +```python +from gcore.types.storage import UsageSeries, UsageTotal, StatisticGetUsageSeriesResponse +``` + +Methods: + +- client.storage.statistics.get_usage_aggregated(\*\*params) -> UsageTotal +- client.storage.statistics.get_usage_series(\*\*params) -> StatisticGetUsageSeriesResponse + +## Credentials + +Methods: + +- client.storage.credentials.recreate(storage_id, \*\*params) -> Storage + +## Buckets + +Types: + +```python +from gcore.types.storage import Bucket +``` + +Methods: + +- client.storage.buckets.create(bucket_name, \*, storage_id) -> None +- client.storage.buckets.list(storage_id, \*\*params) -> SyncOffsetPage[Bucket] +- client.storage.buckets.delete(bucket_name, \*, storage_id) -> None + +### Cors + +Types: + +```python +from gcore.types.storage.buckets import BucketCors +``` + +Methods: + +- client.storage.buckets.cors.create(bucket_name, \*, storage_id, \*\*params) -> None +- client.storage.buckets.cors.get(bucket_name, \*, storage_id) -> BucketCors + +### Lifecycle + +Methods: + +- client.storage.buckets.lifecycle.create(bucket_name, \*, storage_id, \*\*params) -> None +- client.storage.buckets.lifecycle.delete(bucket_name, \*, storage_id) -> None + +### Policy + +Types: + +```python +from gcore.types.storage.buckets import BucketPolicy, PolicyGetResponse +``` + +Methods: + +- client.storage.buckets.policy.create(bucket_name, \*, storage_id) -> None +- client.storage.buckets.policy.delete(bucket_name, \*, storage_id) -> None +- client.storage.buckets.policy.get(bucket_name, \*, storage_id) -> PolicyGetResponse diff --git a/src/gcore/resources/streaming/api.md b/src/gcore/resources/streaming/api.md new file mode 100644 index 00000000..1e868475 --- /dev/null +++ b/src/gcore/resources/streaming/api.md @@ -0,0 +1,285 @@ +# Streaming + +Types: + +```python +from gcore.types.streaming import CreateVideo, Video +``` + +## AITasks + +Types: + +```python +from gcore.types.streaming import ( + AIContentmoderationHardnudity, + AIContentmoderationNsfw, + AIContentmoderationSoftnudity, + AIContentmoderationSport, + AITask, + AITaskCreateResponse, + AITaskCancelResponse, + AITaskGetResponse, + AITaskGetAISettingsResponse, +) +``` + +Methods: + +- client.streaming.ai_tasks.create(\*\*params) -> AITaskCreateResponse +- client.streaming.ai_tasks.list(\*\*params) -> SyncPageStreamingAI[AITask] +- client.streaming.ai_tasks.cancel(task_id) -> AITaskCancelResponse +- client.streaming.ai_tasks.get(task_id) -> AITaskGetResponse +- client.streaming.ai_tasks.get_ai_settings(\*\*params) -> AITaskGetAISettingsResponse + +## Broadcasts + +Types: + +```python +from gcore.types.streaming import Broadcast, BroadcastSpectatorsCount +``` + +Methods: + +- client.streaming.broadcasts.create(\*\*params) -> None +- client.streaming.broadcasts.update(broadcast_id, \*\*params) -> Broadcast +- client.streaming.broadcasts.list(\*\*params) -> SyncPageStreaming[Broadcast] +- client.streaming.broadcasts.delete(broadcast_id) -> None +- client.streaming.broadcasts.get(broadcast_id) -> Broadcast +- client.streaming.broadcasts.get_spectators_count(broadcast_id) -> BroadcastSpectatorsCount + +## Directories + +Types: + +```python +from gcore.types.streaming import ( + DirectoriesTree, + DirectoryBase, + DirectoryItem, + DirectoryVideo, + DirectoryGetResponse, +) +``` + +Methods: + +- client.streaming.directories.create(\*\*params) -> DirectoryBase +- client.streaming.directories.update(directory_id, \*\*params) -> DirectoryBase +- client.streaming.directories.delete(directory_id) -> None +- client.streaming.directories.get(directory_id) -> DirectoryGetResponse +- client.streaming.directories.get_tree() -> DirectoriesTree + +## Players + +Types: + +```python +from gcore.types.streaming import Player +``` + +Methods: + +- client.streaming.players.create(\*\*params) -> None +- client.streaming.players.update(player_id, \*\*params) -> Player +- client.streaming.players.list(\*\*params) -> SyncPageStreaming[Player] +- client.streaming.players.delete(player_id) -> None +- client.streaming.players.get(player_id) -> Player +- client.streaming.players.preview(player_id) -> None + +## QualitySets + +Types: + +```python +from gcore.types.streaming import QualitySets +``` + +Methods: + +- client.streaming.quality_sets.list() -> QualitySets +- client.streaming.quality_sets.set_default(\*\*params) -> QualitySets + +## Playlists + +Types: + +```python +from gcore.types.streaming import ( + Playlist, + PlaylistCreated, + PlaylistVideo, + PlaylistListVideosResponse, +) +``` + +Methods: + +- client.streaming.playlists.create(\*\*params) -> PlaylistCreated +- client.streaming.playlists.update(playlist_id, \*\*params) -> Playlist +- client.streaming.playlists.list(\*\*params) -> SyncPageStreaming[Playlist] +- client.streaming.playlists.delete(playlist_id) -> None +- client.streaming.playlists.get(playlist_id) -> Playlist +- client.streaming.playlists.list_videos(playlist_id) -> PlaylistListVideosResponse + +## Videos + +Types: + +```python +from gcore.types.streaming import ( + DirectUploadParameters, + Subtitle, + SubtitleBase, + SubtitleBody, + SubtitleUpdated, + VideoCreateResponse, + VideoCreateMultipleResponse, +) +``` + +Methods: + +- client.streaming.videos.create(\*\*params) -> VideoCreateResponse +- client.streaming.videos.update(video_id, \*\*params) -> Video +- client.streaming.videos.list(\*\*params) -> SyncPageStreaming[Video] +- client.streaming.videos.delete(video_id) -> None +- client.streaming.videos.create_multiple(\*\*params) -> VideoCreateMultipleResponse +- client.streaming.videos.get(video_id) -> Video +- client.streaming.videos.get_parameters_for_direct_upload(video_id) -> DirectUploadParameters +- client.streaming.videos.list_names(\*\*params) -> None + +### Subtitles + +Types: + +```python +from gcore.types.streaming.videos import SubtitleListResponse +``` + +Methods: + +- client.streaming.videos.subtitles.create(video_id, \*\*params) -> Subtitle +- client.streaming.videos.subtitles.update(id, \*, video_id, \*\*params) -> SubtitleBase +- client.streaming.videos.subtitles.list(video_id) -> SubtitleListResponse +- client.streaming.videos.subtitles.delete(id, \*, video_id) -> None +- client.streaming.videos.subtitles.get(id, \*, video_id) -> Subtitle + +## Streams + +Types: + +```python +from gcore.types.streaming import ( + Clip, + Stream, + StreamListClipsResponse, + StreamStartRecordingResponse, +) +``` + +Methods: + +- client.streaming.streams.create(\*\*params) -> Stream +- client.streaming.streams.update(stream_id, \*\*params) -> Stream +- client.streaming.streams.list(\*\*params) -> SyncPageStreaming[Stream] +- client.streaming.streams.delete(stream_id) -> None +- client.streaming.streams.clear_dvr(stream_id) -> None +- client.streaming.streams.create_clip(stream_id, \*\*params) -> Clip +- client.streaming.streams.get(stream_id) -> Stream +- client.streaming.streams.list_clips(stream_id) -> StreamListClipsResponse +- client.streaming.streams.start_recording(stream_id) -> StreamStartRecordingResponse +- client.streaming.streams.stop_recording(stream_id) -> Video + +### Overlays + +Types: + +```python +from gcore.types.streaming.streams import ( + Overlay, + OverlayCreateResponse, + OverlayListResponse, + OverlayUpdateMultipleResponse, +) +``` + +Methods: + +- client.streaming.streams.overlays.create(stream_id, \*\*params) -> OverlayCreateResponse +- client.streaming.streams.overlays.update(overlay_id, \*, stream_id, \*\*params) -> Overlay +- client.streaming.streams.overlays.list(stream_id) -> OverlayListResponse +- client.streaming.streams.overlays.delete(overlay_id, \*, stream_id) -> None +- client.streaming.streams.overlays.get(overlay_id, \*, stream_id) -> Overlay +- client.streaming.streams.overlays.update_multiple(stream_id, \*\*params) -> OverlayUpdateMultipleResponse + +## Restreams + +Types: + +```python +from gcore.types.streaming import Restream +``` + +Methods: + +- client.streaming.restreams.create(\*\*params) -> None +- client.streaming.restreams.update(restream_id, \*\*params) -> Restream +- client.streaming.restreams.list(\*\*params) -> SyncPageStreaming[Restream] +- client.streaming.restreams.delete(restream_id) -> None +- client.streaming.restreams.get(restream_id) -> Restream + +## Statistics + +Types: + +```python +from gcore.types.streaming import ( + Ffprobes, + MaxStreamSeries, + PopularVideos, + StorageSeries, + StreamSeries, + UniqueViewers, + UniqueViewersCDN, + Views, + ViewsByBrowser, + ViewsByCountry, + ViewsByHostname, + ViewsByOperatingSystem, + ViewsByReferer, + ViewsByRegion, + ViewsHeatmap, + VodStatisticsSeries, + VodTotalStreamDurationSeries, + StatisticGetLiveUniqueViewersResponse, + StatisticGetVodWatchTimeTotalCDNResponse, +) +``` + +Methods: + +- client.streaming.statistics.get_ffprobes(\*\*params) -> Ffprobes +- client.streaming.statistics.get_live_unique_viewers(\*\*params) -> StatisticGetLiveUniqueViewersResponse +- client.streaming.statistics.get_live_watch_time_cdn(\*\*params) -> StreamSeries +- client.streaming.statistics.get_live_watch_time_total_cdn(\*\*params) -> VodTotalStreamDurationSeries +- client.streaming.statistics.get_max_streams_series(\*\*params) -> MaxStreamSeries +- client.streaming.statistics.get_popular_videos(\*\*params) -> PopularVideos +- client.streaming.statistics.get_storage_series(\*\*params) -> StorageSeries +- client.streaming.statistics.get_stream_series(\*\*params) -> StreamSeries +- client.streaming.statistics.get_unique_viewers(\*\*params) -> UniqueViewers +- client.streaming.statistics.get_unique_viewers_cdn(\*\*params) -> UniqueViewersCDN +- client.streaming.statistics.get_views(\*\*params) -> Views +- client.streaming.statistics.get_views_by_browsers(\*\*params) -> ViewsByBrowser +- client.streaming.statistics.get_views_by_country(\*\*params) -> ViewsByCountry +- client.streaming.statistics.get_views_by_hostname(\*\*params) -> ViewsByHostname +- client.streaming.statistics.get_views_by_operating_system(\*\*params) -> ViewsByOperatingSystem +- client.streaming.statistics.get_views_by_referer(\*\*params) -> ViewsByReferer +- client.streaming.statistics.get_views_by_region(\*\*params) -> ViewsByRegion +- client.streaming.statistics.get_views_heatmap(\*\*params) -> ViewsHeatmap +- client.streaming.statistics.get_vod_storage_volume(\*\*params) -> VodStatisticsSeries +- client.streaming.statistics.get_vod_transcoding_duration(\*\*params) -> VodStatisticsSeries +- client.streaming.statistics.get_vod_unique_viewers_cdn(\*\*params) -> VodStatisticsSeries +- client.streaming.statistics.get_vod_watch_time_cdn(\*\*params) -> VodStatisticsSeries +- client.streaming.statistics.get_vod_watch_time_total_cdn(\*\*params) -> StatisticGetVodWatchTimeTotalCDNResponse diff --git a/src/gcore/resources/waap/api.md b/src/gcore/resources/waap/api.md new file mode 100644 index 00000000..52a55dc6 --- /dev/null +++ b/src/gcore/resources/waap/api.md @@ -0,0 +1,322 @@ +# Waap + +Types: + +```python +from gcore.types.waap import WaapGetAccountOverviewResponse +``` + +Methods: + +- client.waap.get_account_overview() -> WaapGetAccountOverviewResponse + +## Statistics + +Types: + +```python +from gcore.types.waap import WaapStatisticItem, WaapStatisticsSeries +``` + +Methods: + +- client.waap.statistics.get_usage_series(\*\*params) -> WaapStatisticsSeries + +## Domains + +Types: + +```python +from gcore.types.waap import ( + WaapDetailedDomain, + WaapDomainAPISettings, + WaapDomainDDOSSettings, + WaapDomainSettingsModel, + WaapPolicyMode, + WaapRuleSet, + WaapSummaryDomain, + DomainListRuleSetsResponse, +) +``` + +Methods: + +- client.waap.domains.update(domain_id, \*\*params) -> None +- client.waap.domains.list(\*\*params) -> SyncOffsetPage[WaapSummaryDomain] +- client.waap.domains.delete(domain_id) -> None +- client.waap.domains.get(domain_id) -> WaapDetailedDomain +- client.waap.domains.list_rule_sets(domain_id) -> DomainListRuleSetsResponse +- client.waap.domains.toggle_policy(policy_id, \*, domain_id) -> WaapPolicyMode + +### Settings + +Methods: + +- client.waap.domains.settings.update(domain_id, \*\*params) -> None +- client.waap.domains.settings.get(domain_id) -> WaapDomainSettingsModel + +### APIPaths + +Types: + +```python +from gcore.types.waap.domains import WaapAPIPath +``` + +Methods: + +- client.waap.domains.api_paths.create(domain_id, \*\*params) -> WaapAPIPath +- client.waap.domains.api_paths.update(path_id, \*, domain_id, \*\*params) -> None +- client.waap.domains.api_paths.list(domain_id, \*\*params) -> SyncOffsetPage[WaapAPIPath] +- client.waap.domains.api_paths.delete(path_id, \*, domain_id) -> None +- client.waap.domains.api_paths.get(path_id, \*, domain_id) -> WaapAPIPath + +### APIPathGroups + +Types: + +```python +from gcore.types.waap.domains import APIPathGroupList +``` + +Methods: + +- client.waap.domains.api_path_groups.list(domain_id) -> APIPathGroupList + +### APIDiscovery + +Types: + +```python +from gcore.types.waap.domains import WaapAPIDiscoverySettings, WaapAPIScanResult, WaapTaskID +``` + +Methods: + +- client.waap.domains.api_discovery.get_scan_result(scan_id, \*, domain_id) -> WaapAPIScanResult +- client.waap.domains.api_discovery.get_settings(domain_id) -> WaapAPIDiscoverySettings +- client.waap.domains.api_discovery.list_scan_results(domain_id, \*\*params) -> SyncOffsetPage[WaapAPIScanResult] +- client.waap.domains.api_discovery.scan_openapi(domain_id) -> WaapTaskID +- client.waap.domains.api_discovery.update_settings(domain_id, \*\*params) -> WaapAPIDiscoverySettings +- client.waap.domains.api_discovery.upload_openapi(domain_id, \*\*params) -> WaapTaskID + +### Insights + +Types: + +```python +from gcore.types.waap.domains import WaapInsight +``` + +Methods: + +- client.waap.domains.insights.list(domain_id, \*\*params) -> SyncOffsetPage[WaapInsight] +- client.waap.domains.insights.get(insight_id, \*, domain_id) -> WaapInsight +- client.waap.domains.insights.replace(insight_id, \*, domain_id, \*\*params) -> WaapInsight + +### InsightSilences + +Types: + +```python +from gcore.types.waap.domains import WaapInsightSilence +``` + +Methods: + +- client.waap.domains.insight_silences.create(domain_id, \*\*params) -> WaapInsightSilence +- client.waap.domains.insight_silences.update(silence_id, \*, domain_id, \*\*params) -> WaapInsightSilence +- client.waap.domains.insight_silences.list(domain_id, \*\*params) -> SyncOffsetPage[WaapInsightSilence] +- client.waap.domains.insight_silences.delete(silence_id, \*, domain_id) -> None +- client.waap.domains.insight_silences.get(silence_id, \*, domain_id) -> WaapInsightSilence + +### Statistics + +Types: + +```python +from gcore.types.waap.domains import ( + WaapBlockedStatistics, + WaapCountStatistics, + WaapDDOSAttack, + WaapDDOSInfo, + WaapEventStatistics, + WaapRequestDetails, + WaapRequestSummary, + WaapTrafficMetrics, + StatisticGetTrafficSeriesResponse, +) +``` + +Methods: + +- client.waap.domains.statistics.get_ddos_attacks(domain_id, \*\*params) -> SyncOffsetPage[WaapDDOSAttack] +- client.waap.domains.statistics.get_ddos_info(domain_id, \*\*params) -> SyncOffsetPage[WaapDDOSInfo] +- client.waap.domains.statistics.get_events_aggregated(domain_id, \*\*params) -> WaapEventStatistics +- client.waap.domains.statistics.get_request_details(request_id, \*, domain_id) -> WaapRequestDetails +- client.waap.domains.statistics.get_requests_series(domain_id, \*\*params) -> SyncOffsetPage[WaapRequestSummary] +- client.waap.domains.statistics.get_traffic_series(domain_id, \*\*params) -> StatisticGetTrafficSeriesResponse + +### CustomRules + +Types: + +```python +from gcore.types.waap.domains import WaapCustomRule +``` + +Methods: + +- client.waap.domains.custom_rules.create(domain_id, \*\*params) -> WaapCustomRule +- client.waap.domains.custom_rules.update(rule_id, \*, domain_id, \*\*params) -> None +- client.waap.domains.custom_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapCustomRule] +- client.waap.domains.custom_rules.delete(rule_id, \*, domain_id) -> None +- client.waap.domains.custom_rules.delete_multiple(domain_id, \*\*params) -> None +- client.waap.domains.custom_rules.get(rule_id, \*, domain_id) -> WaapCustomRule +- client.waap.domains.custom_rules.toggle(action, \*, domain_id, rule_id) -> None + +### FirewallRules + +Types: + +```python +from gcore.types.waap.domains import WaapFirewallRule +``` + +Methods: + +- client.waap.domains.firewall_rules.create(domain_id, \*\*params) -> WaapFirewallRule +- client.waap.domains.firewall_rules.update(rule_id, \*, domain_id, \*\*params) -> None +- client.waap.domains.firewall_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapFirewallRule] +- client.waap.domains.firewall_rules.delete(rule_id, \*, domain_id) -> None +- client.waap.domains.firewall_rules.delete_multiple(domain_id, \*\*params) -> None +- client.waap.domains.firewall_rules.get(rule_id, \*, domain_id) -> WaapFirewallRule +- client.waap.domains.firewall_rules.toggle(action, \*, domain_id, rule_id) -> None + +### AdvancedRules + +Types: + +```python +from gcore.types.waap.domains import WaapAdvancedRule +``` + +Methods: + +- client.waap.domains.advanced_rules.create(domain_id, \*\*params) -> WaapAdvancedRule +- client.waap.domains.advanced_rules.update(rule_id, \*, domain_id, \*\*params) -> None +- client.waap.domains.advanced_rules.list(domain_id, \*\*params) -> SyncOffsetPage[WaapAdvancedRule] +- client.waap.domains.advanced_rules.delete(rule_id, \*, domain_id) -> None +- client.waap.domains.advanced_rules.get(rule_id, \*, domain_id) -> WaapAdvancedRule +- client.waap.domains.advanced_rules.toggle(action, \*, domain_id, rule_id) -> None + +## CustomPageSets + +Types: + +```python +from gcore.types.waap import WaapCustomPagePreview, WaapCustomPageSet +``` + +Methods: + +- client.waap.custom_page_sets.create(\*\*params) -> WaapCustomPageSet +- client.waap.custom_page_sets.update(set_id, \*\*params) -> None +- client.waap.custom_page_sets.list(\*\*params) -> SyncOffsetPage[WaapCustomPageSet] +- client.waap.custom_page_sets.delete(set_id) -> None +- client.waap.custom_page_sets.get(set_id) -> WaapCustomPageSet +- client.waap.custom_page_sets.preview(\*\*params) -> WaapCustomPagePreview + +## AdvancedRules + +Types: + +```python +from gcore.types.waap import WaapAdvancedRuleDescriptor, WaapAdvancedRuleDescriptorList +``` + +Methods: + +- client.waap.advanced_rules.list() -> WaapAdvancedRuleDescriptorList + +## Tags + +Types: + +```python +from gcore.types.waap import WaapTag +``` + +Methods: + +- client.waap.tags.list(\*\*params) -> SyncOffsetPage[WaapTag] + +## Organizations + +Types: + +```python +from gcore.types.waap import WaapOrganization +``` + +Methods: + +- client.waap.organizations.list(\*\*params) -> SyncOffsetPage[WaapOrganization] + +## Insights + +Types: + +```python +from gcore.types.waap import WaapInsightType +``` + +Methods: + +- client.waap.insights.list_types(\*\*params) -> SyncOffsetPage[WaapInsightType] + +## IPInfo + +Types: + +```python +from gcore.types.waap import ( + WaapIPCountryAttack, + WaapIPDDOSInfoModel, + WaapIPInfo, + WaapRuleBlockedRequests, + WaapTimeSeriesAttack, + WaapTopSession, + WaapTopURL, + WaapTopUserAgent, + IPInfoGetAttackTimeSeriesResponse, + IPInfoGetBlockedRequestsResponse, + IPInfoGetTopURLsResponse, + IPInfoGetTopUserAgentsResponse, + IPInfoGetTopUserSessionsResponse, + IPInfoListAttackedCountriesResponse, +) +``` + +Methods: + +- client.waap.ip_info.get_attack_time_series(\*\*params) -> IPInfoGetAttackTimeSeriesResponse +- client.waap.ip_info.get_blocked_requests(\*\*params) -> IPInfoGetBlockedRequestsResponse +- client.waap.ip_info.get_ddos_attack_series(\*\*params) -> WaapIPDDOSInfoModel +- client.waap.ip_info.get_ip_info(\*\*params) -> WaapIPInfo +- client.waap.ip_info.get_top_urls(\*\*params) -> IPInfoGetTopURLsResponse +- client.waap.ip_info.get_top_user_agents(\*\*params) -> IPInfoGetTopUserAgentsResponse +- client.waap.ip_info.get_top_user_sessions(\*\*params) -> IPInfoGetTopUserSessionsResponse +- client.waap.ip_info.list_attacked_countries(\*\*params) -> IPInfoListAttackedCountriesResponse + +### Metrics + +Types: + +```python +from gcore.types.waap.ip_info import WaapIPInfoCounts +``` + +Methods: + +- client.waap.ip_info.metrics.list(\*\*params) -> WaapIPInfoCounts From 8c31310a9793b1a13275b7a71c14f28f920f5a50 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Feb 2026 07:49:04 +0000 Subject: [PATCH 571/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 0d8ddfe6..6cbd581b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8c31abd1135e0eac90290da5a160e341a0d09ca3ca62191a13f079a0f958c0e3.yml openapi_spec_hash: 3506ce6ee4d6f2057e02e656557ada57 -config_hash: 841ecfe67afa779a3954fe8800ecb132 +config_hash: bc578a7de14c42e33b7d4bd4502218f2 From feababec22b575b2c9790362bcbe0d3c715f84ed Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Feb 2026 10:22:21 +0000 Subject: [PATCH 572/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cdn/logs_uploader/policies.py | 60 +++++++++++++++++++ .../cdn/logs_uploader/logs_uploader_policy.py | 11 ++++ .../cdn/logs_uploader/policy_create_params.py | 11 ++++ .../logs_uploader/policy_replace_params.py | 11 ++++ .../cdn/logs_uploader/policy_update_params.py | 11 ++++ .../cdn/logs_uploader/test_policies.py | 6 ++ 7 files changed, 112 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6cbd581b..fae1a1cb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8c31abd1135e0eac90290da5a160e341a0d09ca3ca62191a13f079a0f958c0e3.yml -openapi_spec_hash: 3506ce6ee4d6f2057e02e656557ada57 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9259165aabf370bac0e114d6934e471a5ac10c13bbd4bb8e3a868ab3ac04c1b0.yml +openapi_spec_hash: ae218d74dd0778c09d4ea5f932519e56 config_hash: bc578a7de14c42e33b7d4bd4502218f2 diff --git a/src/gcore/resources/cdn/logs_uploader/policies.py b/src/gcore/resources/cdn/logs_uploader/policies.py index a6d933fb..e4d15912 100644 --- a/src/gcore/resources/cdn/logs_uploader/policies.py +++ b/src/gcore/resources/cdn/logs_uploader/policies.py @@ -64,6 +64,7 @@ def create( format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, + log_sample_rate: float | Omit = omit, name: str | Omit = omit, retry_interval_minutes: int | Omit = omit, rotate_interval_minutes: int | Omit = omit, @@ -116,6 +117,14 @@ def create( include_shield_logs: Include logs from origin shielding in the upload. + log_sample_rate: Sampling rate for logs. A value between 0 and 1 that determines the fraction of + log entries to collect. + + - **1** - collect all logs (default). + - **0.5** - collect approximately 50% of logs. + - **0** - collect no logs (effectively disables logging without removing the + policy). + name: Name of the policy. retry_interval_minutes: Interval in minutes to retry failed uploads. @@ -152,6 +161,7 @@ def create( "format_type": format_type, "include_empty_logs": include_empty_logs, "include_shield_logs": include_shield_logs, + "log_sample_rate": log_sample_rate, "name": name, "retry_interval_minutes": retry_interval_minutes, "rotate_interval_minutes": rotate_interval_minutes, @@ -181,6 +191,7 @@ def update( format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, + log_sample_rate: float | Omit = omit, name: str | Omit = omit, retry_interval_minutes: int | Omit = omit, rotate_interval_minutes: int | Omit = omit, @@ -233,6 +244,14 @@ def update( include_shield_logs: Include logs from origin shielding in the upload. + log_sample_rate: Sampling rate for logs. A value between 0 and 1 that determines the fraction of + log entries to collect. + + - **1** - collect all logs (default). + - **0.5** - collect approximately 50% of logs. + - **0** - collect no logs (effectively disables logging without removing the + policy). + name: Name of the policy. retry_interval_minutes: Interval in minutes to retry failed uploads. @@ -269,6 +288,7 @@ def update( "format_type": format_type, "include_empty_logs": include_empty_logs, "include_shield_logs": include_shield_logs, + "log_sample_rate": log_sample_rate, "name": name, "retry_interval_minutes": retry_interval_minutes, "rotate_interval_minutes": rotate_interval_minutes, @@ -431,6 +451,7 @@ def replace( format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, + log_sample_rate: float | Omit = omit, name: str | Omit = omit, retry_interval_minutes: int | Omit = omit, rotate_interval_minutes: int | Omit = omit, @@ -483,6 +504,14 @@ def replace( include_shield_logs: Include logs from origin shielding in the upload. + log_sample_rate: Sampling rate for logs. A value between 0 and 1 that determines the fraction of + log entries to collect. + + - **1** - collect all logs (default). + - **0.5** - collect approximately 50% of logs. + - **0** - collect no logs (effectively disables logging without removing the + policy). + name: Name of the policy. retry_interval_minutes: Interval in minutes to retry failed uploads. @@ -519,6 +548,7 @@ def replace( "format_type": format_type, "include_empty_logs": include_empty_logs, "include_shield_logs": include_shield_logs, + "log_sample_rate": log_sample_rate, "name": name, "retry_interval_minutes": retry_interval_minutes, "rotate_interval_minutes": rotate_interval_minutes, @@ -568,6 +598,7 @@ async def create( format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, + log_sample_rate: float | Omit = omit, name: str | Omit = omit, retry_interval_minutes: int | Omit = omit, rotate_interval_minutes: int | Omit = omit, @@ -620,6 +651,14 @@ async def create( include_shield_logs: Include logs from origin shielding in the upload. + log_sample_rate: Sampling rate for logs. A value between 0 and 1 that determines the fraction of + log entries to collect. + + - **1** - collect all logs (default). + - **0.5** - collect approximately 50% of logs. + - **0** - collect no logs (effectively disables logging without removing the + policy). + name: Name of the policy. retry_interval_minutes: Interval in minutes to retry failed uploads. @@ -656,6 +695,7 @@ async def create( "format_type": format_type, "include_empty_logs": include_empty_logs, "include_shield_logs": include_shield_logs, + "log_sample_rate": log_sample_rate, "name": name, "retry_interval_minutes": retry_interval_minutes, "rotate_interval_minutes": rotate_interval_minutes, @@ -685,6 +725,7 @@ async def update( format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, + log_sample_rate: float | Omit = omit, name: str | Omit = omit, retry_interval_minutes: int | Omit = omit, rotate_interval_minutes: int | Omit = omit, @@ -737,6 +778,14 @@ async def update( include_shield_logs: Include logs from origin shielding in the upload. + log_sample_rate: Sampling rate for logs. A value between 0 and 1 that determines the fraction of + log entries to collect. + + - **1** - collect all logs (default). + - **0.5** - collect approximately 50% of logs. + - **0** - collect no logs (effectively disables logging without removing the + policy). + name: Name of the policy. retry_interval_minutes: Interval in minutes to retry failed uploads. @@ -773,6 +822,7 @@ async def update( "format_type": format_type, "include_empty_logs": include_empty_logs, "include_shield_logs": include_shield_logs, + "log_sample_rate": log_sample_rate, "name": name, "retry_interval_minutes": retry_interval_minutes, "rotate_interval_minutes": rotate_interval_minutes, @@ -935,6 +985,7 @@ async def replace( format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, + log_sample_rate: float | Omit = omit, name: str | Omit = omit, retry_interval_minutes: int | Omit = omit, rotate_interval_minutes: int | Omit = omit, @@ -987,6 +1038,14 @@ async def replace( include_shield_logs: Include logs from origin shielding in the upload. + log_sample_rate: Sampling rate for logs. A value between 0 and 1 that determines the fraction of + log entries to collect. + + - **1** - collect all logs (default). + - **0.5** - collect approximately 50% of logs. + - **0** - collect no logs (effectively disables logging without removing the + policy). + name: Name of the policy. retry_interval_minutes: Interval in minutes to retry failed uploads. @@ -1023,6 +1082,7 @@ async def replace( "format_type": format_type, "include_empty_logs": include_empty_logs, "include_shield_logs": include_shield_logs, + "log_sample_rate": log_sample_rate, "name": name, "retry_interval_minutes": retry_interval_minutes, "rotate_interval_minutes": rotate_interval_minutes, diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py index dd6cfc5a..b71e8375 100644 --- a/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py @@ -66,6 +66,17 @@ class LogsUploaderPolicy(BaseModel): include_shield_logs: Optional[bool] = None """Include logs from origin shielding in the upload.""" + log_sample_rate: Optional[float] = None + """Sampling rate for logs. + + A value between 0 and 1 that determines the fraction of log entries to collect. + + - **1** - collect all logs (default). + - **0.5** - collect approximately 50% of logs. + - **0** - collect no logs (effectively disables logging without removing the + policy). + """ + name: Optional[str] = None """Name of the policy.""" diff --git a/src/gcore/types/cdn/logs_uploader/policy_create_params.py b/src/gcore/types/cdn/logs_uploader/policy_create_params.py index 7179d9d1..4d25b99a 100644 --- a/src/gcore/types/cdn/logs_uploader/policy_create_params.py +++ b/src/gcore/types/cdn/logs_uploader/policy_create_params.py @@ -59,6 +59,17 @@ class PolicyCreateParams(TypedDict, total=False): include_shield_logs: bool """Include logs from origin shielding in the upload.""" + log_sample_rate: float + """Sampling rate for logs. + + A value between 0 and 1 that determines the fraction of log entries to collect. + + - **1** - collect all logs (default). + - **0.5** - collect approximately 50% of logs. + - **0** - collect no logs (effectively disables logging without removing the + policy). + """ + name: str """Name of the policy.""" diff --git a/src/gcore/types/cdn/logs_uploader/policy_replace_params.py b/src/gcore/types/cdn/logs_uploader/policy_replace_params.py index cc779079..1087c1f7 100644 --- a/src/gcore/types/cdn/logs_uploader/policy_replace_params.py +++ b/src/gcore/types/cdn/logs_uploader/policy_replace_params.py @@ -59,6 +59,17 @@ class PolicyReplaceParams(TypedDict, total=False): include_shield_logs: bool """Include logs from origin shielding in the upload.""" + log_sample_rate: float + """Sampling rate for logs. + + A value between 0 and 1 that determines the fraction of log entries to collect. + + - **1** - collect all logs (default). + - **0.5** - collect approximately 50% of logs. + - **0** - collect no logs (effectively disables logging without removing the + policy). + """ + name: str """Name of the policy.""" diff --git a/src/gcore/types/cdn/logs_uploader/policy_update_params.py b/src/gcore/types/cdn/logs_uploader/policy_update_params.py index 0e8ce99d..43ad9e99 100644 --- a/src/gcore/types/cdn/logs_uploader/policy_update_params.py +++ b/src/gcore/types/cdn/logs_uploader/policy_update_params.py @@ -59,6 +59,17 @@ class PolicyUpdateParams(TypedDict, total=False): include_shield_logs: bool """Include logs from origin shielding in the upload.""" + log_sample_rate: float + """Sampling rate for logs. + + A value between 0 and 1 that determines the fraction of log entries to collect. + + - **1** - collect all logs (default). + - **0.5** - collect approximately 50% of logs. + - **0** - collect no logs (effectively disables logging without removing the + policy). + """ + name: str """Name of the policy.""" diff --git a/tests/api_resources/cdn/logs_uploader/test_policies.py b/tests/api_resources/cdn/logs_uploader/test_policies.py index e197ed4c..249b03cc 100644 --- a/tests/api_resources/cdn/logs_uploader/test_policies.py +++ b/tests/api_resources/cdn/logs_uploader/test_policies.py @@ -39,6 +39,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: format_type="json", include_empty_logs=True, include_shield_logs=True, + log_sample_rate=1, name="Policy", retry_interval_minutes=32, rotate_interval_minutes=32, @@ -89,6 +90,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: format_type="json", include_empty_logs=True, include_shield_logs=True, + log_sample_rate=0.5, name="Policy", retry_interval_minutes=32, rotate_interval_minutes=32, @@ -263,6 +265,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: format_type="json", include_empty_logs=True, include_shield_logs=True, + log_sample_rate=1, name="Policy", retry_interval_minutes=32, rotate_interval_minutes=32, @@ -320,6 +323,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> format_type="json", include_empty_logs=True, include_shield_logs=True, + log_sample_rate=1, name="Policy", retry_interval_minutes=32, rotate_interval_minutes=32, @@ -370,6 +374,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> format_type="json", include_empty_logs=True, include_shield_logs=True, + log_sample_rate=0.5, name="Policy", retry_interval_minutes=32, rotate_interval_minutes=32, @@ -544,6 +549,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> format_type="json", include_empty_logs=True, include_shield_logs=True, + log_sample_rate=1, name="Policy", retry_interval_minutes=32, rotate_interval_minutes=32, From 7f9ff6d49d8cf301c3a1e58364d3368f31b10494 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Feb 2026 10:27:31 +0000 Subject: [PATCH 573/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/types/waap/domains/waap_request_details.py | 3 +++ src/gcore/types/waap/domains/waap_request_summary.py | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index fae1a1cb..f8b8cc3f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9259165aabf370bac0e114d6934e471a5ac10c13bbd4bb8e3a868ab3ac04c1b0.yml -openapi_spec_hash: ae218d74dd0778c09d4ea5f932519e56 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-360f2c0906cd2297fb19f17aad80b3b71098ee5e2fb99577c9c6120e852adb45.yml +openapi_spec_hash: 9d967fad18c5396d1b6e91c1d57fa446 config_hash: bc578a7de14c42e33b7d4bd4502218f2 diff --git a/src/gcore/types/waap/domains/waap_request_details.py b/src/gcore/types/waap/domains/waap_request_details.py index 6099d5de..0eae8cfc 100644 --- a/src/gcore/types/waap/domains/waap_request_details.py +++ b/src/gcore/types/waap/domains/waap_request_details.py @@ -188,6 +188,9 @@ class WaapRequestDetails(BaseModel): scheme: str """The HTTP scheme of the request that generated an event""" + session_id: str + """The session ID associated with the request.""" + session_request_count: str """The number requests in session""" diff --git a/src/gcore/types/waap/domains/waap_request_summary.py b/src/gcore/types/waap/domains/waap_request_summary.py index 039a5f70..68be1c90 100644 --- a/src/gcore/types/waap/domains/waap_request_summary.py +++ b/src/gcore/types/waap/domains/waap_request_summary.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from typing_extensions import Literal from ...._models import BaseModel @@ -68,3 +69,6 @@ class WaapRequestSummary(BaseModel): user_agent_client: str """Client from parsed User agent header""" + + session_id: Optional[str] = None + """The session ID associated with the request.""" From 5cc2712a1f478b824a58cfbf6108545286649c8c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Feb 2026 12:24:01 +0000 Subject: [PATCH 574/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cloud/security_groups/rules.py | 103 +++- src/gcore/resources/cloud/tasks.py | 50 +- src/gcore/types/cloud/baremetal_flavor.py | 3 + .../clusters/gpu_baremetal_flavor.py | 14 +- src/gcore/types/cloud/task.py | 3 + src/gcore/types/cloud/task_list_params.py | 25 +- .../domains/advanced_rule_create_params.py | 18 +- .../domains/advanced_rule_update_params.py | 18 +- .../waap/domains/custom_rule_create_params.py | 18 +- .../waap/domains/custom_rule_update_params.py | 18 +- .../domains/firewall_rule_create_params.py | 6 +- .../domains/firewall_rule_update_params.py | 6 +- .../types/waap/domains/waap_advanced_rule.py | 18 +- .../types/waap/domains/waap_custom_rule.py | 18 +- .../types/waap/domains/waap_firewall_rule.py | 6 +- .../cloud/security_groups/test_rules.py | 496 ++++++++++-------- .../waap/domains/test_advanced_rules.py | 32 +- .../waap/domains/test_custom_rules.py | 32 +- .../waap/domains/test_firewall_rules.py | 8 +- 20 files changed, 503 insertions(+), 393 deletions(-) diff --git a/.stats.yml b/.stats.yml index f8b8cc3f..53251022 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-360f2c0906cd2297fb19f17aad80b3b71098ee5e2fb99577c9c6120e852adb45.yml -openapi_spec_hash: 9d967fad18c5396d1b6e91c1d57fa446 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e97b86d831754f75465ed3ea12af5e37ae40a288fe695dd38f4d29fb95742856.yml +openapi_spec_hash: ca2f07740c2e54d4dab2934a25829a7e config_hash: bc578a7de14c42e33b7d4bd4502218f2 diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index dc4cdfa2..31a01883 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Optional from typing_extensions import Literal @@ -44,6 +45,7 @@ def with_streaming_response(self) -> RulesResourceWithStreamingResponse: """ return RulesResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def create( self, group_id: str, @@ -94,6 +96,9 @@ def create( """ Add a new rule to an existing security group. + **Deprecated** Use + `/v2/security_groups////rules` instead. + Args: project_id: Project ID @@ -152,6 +157,7 @@ def create( cast_to=SecurityGroupRule, ) + @typing_extensions.deprecated("deprecated") def delete( self, rule_id: str, @@ -168,6 +174,10 @@ def delete( """ Delete a specific rule from a security group. + **Deprecated** Use + `/v2/security_groups////rules/` + instead. + Args: project_id: Project ID @@ -198,6 +208,7 @@ def delete( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") def replace( self, rule_id: str, @@ -249,6 +260,11 @@ def replace( """ Update the configuration of an existing security group rule. + **Deprecated** Use + `/v2/security_groups////rules/` to + delete and `/v2/security_groups////rules` to + create a new rule. + Args: project_id: Project ID @@ -333,6 +349,7 @@ def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: """ return AsyncRulesResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def create( self, group_id: str, @@ -383,6 +400,9 @@ async def create( """ Add a new rule to an existing security group. + **Deprecated** Use + `/v2/security_groups////rules` instead. + Args: project_id: Project ID @@ -441,6 +461,7 @@ async def create( cast_to=SecurityGroupRule, ) + @typing_extensions.deprecated("deprecated") async def delete( self, rule_id: str, @@ -457,6 +478,10 @@ async def delete( """ Delete a specific rule from a security group. + **Deprecated** Use + `/v2/security_groups////rules/` + instead. + Args: project_id: Project ID @@ -487,6 +512,7 @@ async def delete( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") async def replace( self, rule_id: str, @@ -538,6 +564,11 @@ async def replace( """ Update the configuration of an existing security group rule. + **Deprecated** Use + `/v2/security_groups////rules/` to + delete and `/v2/security_groups////rules` to + create a new rule. + Args: project_id: Project ID @@ -606,14 +637,20 @@ class RulesResourceWithRawResponse: def __init__(self, rules: RulesResource) -> None: self._rules = rules - self.create = to_raw_response_wrapper( - rules.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rules.create, # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_raw_response_wrapper( - rules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rules.delete, # pyright: ignore[reportDeprecated], + ) ) - self.replace = to_raw_response_wrapper( - rules.replace, + self.replace = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rules.replace, # pyright: ignore[reportDeprecated], + ) ) @@ -621,14 +658,20 @@ class AsyncRulesResourceWithRawResponse: def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules - self.create = async_to_raw_response_wrapper( - rules.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rules.create, # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_raw_response_wrapper( - rules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rules.delete, # pyright: ignore[reportDeprecated], + ) ) - self.replace = async_to_raw_response_wrapper( - rules.replace, + self.replace = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rules.replace, # pyright: ignore[reportDeprecated], + ) ) @@ -636,14 +679,20 @@ class RulesResourceWithStreamingResponse: def __init__(self, rules: RulesResource) -> None: self._rules = rules - self.create = to_streamed_response_wrapper( - rules.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rules.create, # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_streamed_response_wrapper( - rules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rules.delete, # pyright: ignore[reportDeprecated], + ) ) - self.replace = to_streamed_response_wrapper( - rules.replace, + self.replace = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rules.replace, # pyright: ignore[reportDeprecated], + ) ) @@ -651,12 +700,18 @@ class AsyncRulesResourceWithStreamingResponse: def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules - self.create = async_to_streamed_response_wrapper( - rules.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rules.create, # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_streamed_response_wrapper( - rules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rules.delete, # pyright: ignore[reportDeprecated], + ) ) - self.replace = async_to_streamed_response_wrapper( - rules.replace, + self.replace = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rules.replace, # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 36292a9d..298ff821 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -107,9 +107,9 @@ def list( 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', 'create_reserved_fixed_ip', 'create_router', 'create_secret', - 'create_security_group', 'create_servergroup', 'create_sfs', 'create_snapshot', - 'create_subnet', 'create_vm', 'create_volume', 'deactivate_ddos_profile', - 'delete_ai_cluster_gpu', 'delete_caas_container', + 'create_security_group', 'create_security_group_rule', 'create_servergroup', + 'create_sfs', 'create_snapshot', 'create_subnet', 'create_vm', 'create_volume', + 'deactivate_ddos_profile', 'delete_ai_cluster_gpu', 'delete_caas_container', 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', 'delete_gpu_virtual_server', 'delete_image', 'delete_inference_application', @@ -118,15 +118,16 @@ def list( 'delete_lblistener', 'delete_lbmember', 'delete_lbmetadata', 'delete_lbpool', 'delete_loadbalancer', 'delete_network', '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_l7rule', - 'rebuild_bm', 'rebuild_gpu_baremetal_cluster', 'rebuild_gpu_baremetal_node', + 'delete_security_group_rule', '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_l7rule', 'rebuild_bm', + 'rebuild_gpu_baremetal_cluster', 'rebuild_gpu_baremetal_node', 'rebuild_gpu_baremetal_server', 'remove_from_server_group', 'replace_lbmetadata', 'resize_k8s_cluster_v2', 'resize_loadbalancer', 'resize_vm', 'resume_vm', 'revert_volume', 'soft_reboot_gpu_baremetal_server', @@ -380,9 +381,9 @@ def list( 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', 'create_reserved_fixed_ip', 'create_router', 'create_secret', - 'create_security_group', 'create_servergroup', 'create_sfs', 'create_snapshot', - 'create_subnet', 'create_vm', 'create_volume', 'deactivate_ddos_profile', - 'delete_ai_cluster_gpu', 'delete_caas_container', + 'create_security_group', 'create_security_group_rule', 'create_servergroup', + 'create_sfs', 'create_snapshot', 'create_subnet', 'create_vm', 'create_volume', + 'deactivate_ddos_profile', 'delete_ai_cluster_gpu', 'delete_caas_container', 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', 'delete_gpu_virtual_server', 'delete_image', 'delete_inference_application', @@ -391,15 +392,16 @@ def list( 'delete_lblistener', 'delete_lbmember', 'delete_lbmetadata', 'delete_lbpool', 'delete_loadbalancer', 'delete_network', '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_l7rule', - 'rebuild_bm', 'rebuild_gpu_baremetal_cluster', 'rebuild_gpu_baremetal_node', + 'delete_security_group_rule', '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_l7rule', 'rebuild_bm', + 'rebuild_gpu_baremetal_cluster', 'rebuild_gpu_baremetal_node', 'rebuild_gpu_baremetal_server', 'remove_from_server_group', 'replace_lbmetadata', 'resize_k8s_cluster_v2', 'resize_loadbalancer', 'resize_vm', 'resume_vm', 'revert_volume', 'soft_reboot_gpu_baremetal_server', diff --git a/src/gcore/types/cloud/baremetal_flavor.py b/src/gcore/types/cloud/baremetal_flavor.py index 5cd8867f..7a1152f9 100644 --- a/src/gcore/types/cloud/baremetal_flavor.py +++ b/src/gcore/types/cloud/baremetal_flavor.py @@ -52,3 +52,6 @@ class BaremetalFlavor(BaseModel): price_status: Optional[Literal["error", "hide", "show"]] = None """Price status for the UI""" + + reserved_capacity: Optional[int] = None + """Number of available instances of given flavor from reservations""" 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 be48dcf7..44757b06 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 @@ -68,7 +68,7 @@ class GPUBaremetalFlavorSerializerWithoutPrice(BaseModel): """Flavor architecture type""" capacity: int - """Number of available instances of given flavor""" + """Number of available instances of given flavor for the client""" disabled: bool """If the flavor is disabled, new resources cannot be created using this flavor.""" @@ -82,12 +82,15 @@ class GPUBaremetalFlavorSerializerWithoutPrice(BaseModel): name: str """Flavor name""" + reserved_capacity: int + """Number of available instances of given flavor from reservations""" + supported_features: GPUBaremetalFlavorSerializerWithoutPriceSupportedFeatures """Set of enabled features based on the flavor's type and configuration""" class GPUBaremetalFlavorSerializerWithPricesHardwareDescription(BaseModel): - """Additional virtual hardware description""" + """Additional bare metal hardware description""" cpu: str """Human-readable CPU description""" @@ -151,13 +154,13 @@ class GPUBaremetalFlavorSerializerWithPrices(BaseModel): """Flavor architecture type""" capacity: int - """Number of available instances of given flavor""" + """Number of available instances of given flavor for the client""" disabled: bool """If the flavor is disabled, new resources cannot be created using this flavor.""" hardware_description: GPUBaremetalFlavorSerializerWithPricesHardwareDescription - """Additional virtual hardware description""" + """Additional bare metal hardware description""" hardware_properties: GPUBaremetalFlavorSerializerWithPricesHardwareProperties """Additional bare metal hardware properties""" @@ -168,6 +171,9 @@ class GPUBaremetalFlavorSerializerWithPrices(BaseModel): price: GPUBaremetalFlavorSerializerWithPricesPrice """Flavor price""" + reserved_capacity: int + """Number of available instances of given flavor from reservations""" + supported_features: GPUBaremetalFlavorSerializerWithPricesSupportedFeatures """Set of enabled features based on the flavor's type and configuration""" diff --git a/src/gcore/types/cloud/task.py b/src/gcore/types/cloud/task.py index 3aea7a7a..c028eb40 100644 --- a/src/gcore/types/cloud/task.py +++ b/src/gcore/types/cloud/task.py @@ -98,6 +98,9 @@ class CreatedResources(BaseModel): secrets: Optional[List[str]] = None """IDs of created secrets""" + security_group_rules: Optional[List[str]] = None + """IDs of created security group rules""" + security_groups: Optional[List[str]] = None """IDs of created security groups""" diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index 9915c84e..f7337af9 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -70,9 +70,9 @@ class TaskListParams(TypedDict, total=False): 'create_l7rule', 'create_lblistener', 'create_lbmember', 'create_lbpool', 'create_lbpool_health_monitor', 'create_loadbalancer', 'create_network', 'create_reserved_fixed_ip', 'create_router', 'create_secret', - 'create_security_group', 'create_servergroup', 'create_sfs', 'create_snapshot', - 'create_subnet', 'create_vm', 'create_volume', 'deactivate_ddos_profile', - 'delete_ai_cluster_gpu', 'delete_caas_container', + 'create_security_group', 'create_security_group_rule', 'create_servergroup', + 'create_sfs', 'create_snapshot', 'create_subnet', 'create_vm', 'create_volume', + 'deactivate_ddos_profile', 'delete_ai_cluster_gpu', 'delete_caas_container', 'delete_dbaas_postgres_cluster', 'delete_ddos_profile', 'delete_faas_function', 'delete_faas_namespace', 'delete_fip', 'delete_gpu_virtual_cluster', 'delete_gpu_virtual_server', 'delete_image', 'delete_inference_application', @@ -81,15 +81,16 @@ class TaskListParams(TypedDict, total=False): 'delete_lblistener', 'delete_lbmember', 'delete_lbmetadata', 'delete_lbpool', 'delete_loadbalancer', 'delete_network', '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_l7rule', - 'rebuild_bm', 'rebuild_gpu_baremetal_cluster', 'rebuild_gpu_baremetal_node', + 'delete_security_group_rule', '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_l7rule', 'rebuild_bm', + 'rebuild_gpu_baremetal_cluster', 'rebuild_gpu_baremetal_node', 'rebuild_gpu_baremetal_server', 'remove_from_server_group', 'replace_lbmetadata', 'resize_k8s_cluster_v2', 'resize_loadbalancer', 'resize_vm', 'resume_vm', 'revert_volume', 'soft_reboot_gpu_baremetal_server', 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 5ce72816..cabe49cb 100644 --- a/src/gcore/types/waap/domains/advanced_rule_create_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict from ...._types import SequenceNotStr @@ -80,8 +80,8 @@ class Action(TypedDict, total=False): Only one action can be set per rule. """ - allow: object - """The WAAP allowed the request""" + allow: Dict[str, object] + """The WAAP allows the request""" block: ActionBlock """ @@ -89,14 +89,14 @@ class Action(TypedDict, total=False): action duration. """ - captcha: object - """The WAAP presented the user with a captcha""" + captcha: Dict[str, object] + """The WAAP presents the user with a captcha""" - handshake: object - """The WAAP performed automatic browser validation""" + handshake: Dict[str, object] + """The WAAP performs automatic browser validation""" - monitor: object - """The WAAP monitored the request but took no action""" + monitor: Dict[str, object] + """The WAAP monitors the request but takes no action""" tag: ActionTag """WAAP tag action gets a list of tags to tag the request scope with""" diff --git a/src/gcore/types/waap/domains/advanced_rule_update_params.py b/src/gcore/types/waap/domains/advanced_rule_update_params.py index 60d061bf..9ba318f0 100644 --- a/src/gcore/types/waap/domains/advanced_rule_update_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict from ...._types import SequenceNotStr @@ -77,8 +77,8 @@ class ActionTag(TypedDict, total=False): class Action(TypedDict, total=False): """The action that a WAAP rule takes when triggered.""" - allow: object - """The WAAP allowed the request""" + allow: Dict[str, object] + """The WAAP allows the request""" block: ActionBlock """ @@ -86,14 +86,14 @@ class Action(TypedDict, total=False): action duration. """ - captcha: object - """The WAAP presented the user with a captcha""" + captcha: Dict[str, object] + """The WAAP presents the user with a captcha""" - handshake: object - """The WAAP performed automatic browser validation""" + handshake: Dict[str, object] + """The WAAP performs automatic browser validation""" - monitor: object - """The WAAP monitored the request but took no action""" + monitor: Dict[str, object] + """The WAAP monitors the request but takes no action""" tag: ActionTag """WAAP tag action gets a list of tags to tag the request scope with""" 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 85559fd3..38d1fcaf 100644 --- a/src/gcore/types/waap/domains/custom_rule_create_params.py +++ b/src/gcore/types/waap/domains/custom_rule_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable +from typing import Dict, List, Iterable from typing_extensions import Literal, Required, TypedDict from ...._types import SequenceNotStr @@ -88,8 +88,8 @@ class Action(TypedDict, total=False): Only one action can be set per rule. """ - allow: object - """The WAAP allowed the request""" + allow: Dict[str, object] + """The WAAP allows the request""" block: ActionBlock """ @@ -97,14 +97,14 @@ class Action(TypedDict, total=False): action duration. """ - captcha: object - """The WAAP presented the user with a captcha""" + captcha: Dict[str, object] + """The WAAP presents the user with a captcha""" - handshake: object - """The WAAP performed automatic browser validation""" + handshake: Dict[str, object] + """The WAAP performs automatic browser validation""" - monitor: object - """The WAAP monitored the request but took no action""" + monitor: Dict[str, object] + """The WAAP monitors the request but takes no action""" tag: ActionTag """WAAP tag action gets a list of tags to tag the request scope with""" 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 a5d74346..36c8e2c6 100644 --- a/src/gcore/types/waap/domains/custom_rule_update_params.py +++ b/src/gcore/types/waap/domains/custom_rule_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Dict, List, Iterable, Optional from typing_extensions import Literal, Required, TypedDict from ...._types import SequenceNotStr @@ -85,8 +85,8 @@ class ActionTag(TypedDict, total=False): class Action(TypedDict, total=False): """The action that a WAAP rule takes when triggered.""" - allow: object - """The WAAP allowed the request""" + allow: Dict[str, object] + """The WAAP allows the request""" block: ActionBlock """ @@ -94,14 +94,14 @@ class Action(TypedDict, total=False): action duration. """ - captcha: object - """The WAAP presented the user with a captcha""" + captcha: Dict[str, object] + """The WAAP presents the user with a captcha""" - handshake: object - """The WAAP performed automatic browser validation""" + handshake: Dict[str, object] + """The WAAP performs automatic browser validation""" - monitor: object - """The WAAP monitored the request but took no action""" + monitor: Dict[str, object] + """The WAAP monitors the request but takes no action""" tag: ActionTag """WAAP tag action gets a list of tags to tag the request scope with""" 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 00a84336..73e76cdc 100644 --- a/src/gcore/types/waap/domains/firewall_rule_create_params.py +++ b/src/gcore/types/waap/domains/firewall_rule_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["FirewallRuleCreateParams", "Action", "ActionBlock", "Condition", "ConditionIP", "ConditionIPRange"] @@ -45,8 +45,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""" + allow: Optional[Dict[str, object]] + """The WAAP allows the request""" block: Optional[ActionBlock] """ 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 48a2addf..e6378ef6 100644 --- a/src/gcore/types/waap/domains/firewall_rule_update_params.py +++ b/src/gcore/types/waap/domains/firewall_rule_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["FirewallRuleUpdateParams", "Action", "ActionBlock", "Condition", "ConditionIP", "ConditionIPRange"] @@ -48,8 +48,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""" + allow: Optional[Dict[str, object]] + """The WAAP allows the request""" block: Optional[ActionBlock] """ diff --git a/src/gcore/types/waap/domains/waap_advanced_rule.py b/src/gcore/types/waap/domains/waap_advanced_rule.py index feb436a2..c0f735e1 100644 --- a/src/gcore/types/waap/domains/waap_advanced_rule.py +++ b/src/gcore/types/waap/domains/waap_advanced_rule.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from typing_extensions import Literal from ...._models import BaseModel @@ -38,8 +38,8 @@ class Action(BaseModel): Only one action can be set per rule. """ - allow: Optional[object] = None - """The WAAP allowed the request""" + allow: Optional[Dict[str, object]] = None + """The WAAP allows the request""" block: Optional[ActionBlock] = None """ @@ -47,14 +47,14 @@ class Action(BaseModel): action duration. """ - captcha: Optional[object] = None - """The WAAP presented the user with a captcha""" + captcha: Optional[Dict[str, object]] = None + """The WAAP presents the user with a captcha""" - handshake: Optional[object] = None - """The WAAP performed automatic browser validation""" + handshake: Optional[Dict[str, object]] = None + """The WAAP performs automatic browser validation""" - monitor: Optional[object] = None - """The WAAP monitored the request but took no action""" + monitor: Optional[Dict[str, object]] = None + """The WAAP monitors the request but takes no action""" tag: Optional[ActionTag] = None """WAAP tag action gets a list of tags to tag the request scope with""" diff --git a/src/gcore/types/waap/domains/waap_custom_rule.py b/src/gcore/types/waap/domains/waap_custom_rule.py index 89408a30..db35a837 100644 --- a/src/gcore/types/waap/domains/waap_custom_rule.py +++ b/src/gcore/types/waap/domains/waap_custom_rule.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from typing_extensions import Literal from ...._models import BaseModel @@ -62,8 +62,8 @@ class Action(BaseModel): Only one action can be set per rule. """ - allow: Optional[object] = None - """The WAAP allowed the request""" + allow: Optional[Dict[str, object]] = None + """The WAAP allows the request""" block: Optional[ActionBlock] = None """ @@ -71,14 +71,14 @@ class Action(BaseModel): action duration. """ - captcha: Optional[object] = None - """The WAAP presented the user with a captcha""" + captcha: Optional[Dict[str, object]] = None + """The WAAP presents the user with a captcha""" - handshake: Optional[object] = None - """The WAAP performed automatic browser validation""" + handshake: Optional[Dict[str, object]] = None + """The WAAP performs automatic browser validation""" - monitor: Optional[object] = None - """The WAAP monitored the request but took no action""" + monitor: Optional[Dict[str, object]] = None + """The WAAP monitors the request but takes no action""" tag: Optional[ActionTag] = None """WAAP tag action gets a list of tags to tag the request scope with""" diff --git a/src/gcore/types/waap/domains/waap_firewall_rule.py b/src/gcore/types/waap/domains/waap_firewall_rule.py index 2686de74..9bad341c 100644 --- a/src/gcore/types/waap/domains/waap_firewall_rule.py +++ b/src/gcore/types/waap/domains/waap_firewall_rule.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from typing_extensions import Literal from ...._models import BaseModel @@ -28,8 +28,8 @@ class ActionBlock(BaseModel): class Action(BaseModel): """The action that the rule takes when triggered""" - allow: Optional[object] = None - """The WAAP allowed the request""" + allow: Optional[Dict[str, object]] = None + """The WAAP allows the request""" block: Optional[ActionBlock] = None """ diff --git a/tests/api_resources/cloud/security_groups/test_rules.py b/tests/api_resources/cloud/security_groups/test_rules.py index b3e9f95f..ddd3a5d9 100644 --- a/tests/api_resources/cloud/security_groups/test_rules.py +++ b/tests/api_resources/cloud/security_groups/test_rules.py @@ -11,6 +11,8 @@ from tests.utils import assert_matches_type from gcore.types.cloud import SecurityGroupRule +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,39 +21,44 @@ class TestRules: @parametrize def test_method_create(self, client: Gcore) -> None: - rule = client.cloud.security_groups.rules.create( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - ) + with pytest.warns(DeprecationWarning): + rule = client.cloud.security_groups.rules.create( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - rule = client.cloud.security_groups.rules.create( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - description="Some description", - ethertype="IPv4", - port_range_max=80, - port_range_min=80, - protocol="tcp", - remote_group_id="00000000-0000-4000-8000-000000000000", - remote_ip_prefix="10.0.0.0/8", - ) + with pytest.warns(DeprecationWarning): + rule = client.cloud.security_groups.rules.create( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + description="Some description", + ethertype="IPv4", + port_range_max=80, + port_range_min=80, + protocol="tcp", + remote_group_id="00000000-0000-4000-8000-000000000000", + remote_ip_prefix="10.0.0.0/8", + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.cloud.security_groups.rules.with_raw_response.create( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.security_groups.rules.with_raw_response.create( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -60,46 +67,51 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.cloud.security_groups.rules.with_streaming_response.create( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = response.parse() - assert_matches_type(SecurityGroupRule, rule, path=["response"]) + with pytest.warns(DeprecationWarning): + with client.cloud.security_groups.rules.with_streaming_response.create( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(SecurityGroupRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_create(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): - client.cloud.security_groups.rules.with_raw_response.create( - group_id="", + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + client.cloud.security_groups.rules.with_raw_response.create( + group_id="", + project_id=1, + region_id=1, + direction="ingress", + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + with pytest.warns(DeprecationWarning): + rule = client.cloud.security_groups.rules.delete( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", project_id=1, region_id=1, - direction="ingress", ) - @parametrize - def test_method_delete(self, client: Gcore) -> None: - rule = client.cloud.security_groups.rules.delete( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) assert rule is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.security_groups.rules.with_raw_response.delete( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.security_groups.rules.with_raw_response.delete( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -108,66 +120,73 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.security_groups.rules.with_streaming_response.delete( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.security_groups.rules.with_streaming_response.delete( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert rule is None + rule = response.parse() + assert rule is None assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - client.cloud.security_groups.rules.with_raw_response.delete( - rule_id="", + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.cloud.security_groups.rules.with_raw_response.delete( + rule_id="", + project_id=1, + region_id=1, + ) + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + with pytest.warns(DeprecationWarning): + rule = client.cloud.security_groups.rules.replace( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", project_id=1, region_id=1, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", ) - @parametrize - def test_method_replace(self, client: Gcore) -> None: - rule = client.cloud.security_groups.rules.replace( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - security_group_id="00000000-0000-4000-8000-000000000000", - ) assert_matches_type(SecurityGroupRule, rule, path=["response"]) @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: - rule = client.cloud.security_groups.rules.replace( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - security_group_id="00000000-0000-4000-8000-000000000000", - description="Some description", - ethertype="IPv4", - port_range_max=80, - port_range_min=80, - protocol="tcp", - remote_group_id="00000000-0000-4000-8000-000000000000", - remote_ip_prefix="10.0.0.0/8", - ) + with pytest.warns(DeprecationWarning): + rule = client.cloud.security_groups.rules.replace( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + description="Some description", + ethertype="IPv4", + port_range_max=80, + port_range_min=80, + protocol="tcp", + remote_group_id="00000000-0000-4000-8000-000000000000", + remote_ip_prefix="10.0.0.0/8", + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) @parametrize def test_raw_response_replace(self, client: Gcore) -> None: - response = client.cloud.security_groups.rules.with_raw_response.replace( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - security_group_id="00000000-0000-4000-8000-000000000000", - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.security_groups.rules.with_raw_response.replace( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -176,31 +195,33 @@ def test_raw_response_replace(self, client: Gcore) -> None: @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: - with client.cloud.security_groups.rules.with_streaming_response.replace( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - security_group_id="00000000-0000-4000-8000-000000000000", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = response.parse() - assert_matches_type(SecurityGroupRule, rule, path=["response"]) + with pytest.warns(DeprecationWarning): + with client.cloud.security_groups.rules.with_streaming_response.replace( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(SecurityGroupRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_replace(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - client.cloud.security_groups.rules.with_raw_response.replace( - rule_id="", - project_id=1, - region_id=1, - direction="ingress", - security_group_id="00000000-0000-4000-8000-000000000000", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.cloud.security_groups.rules.with_raw_response.replace( + rule_id="", + project_id=1, + region_id=1, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) class TestAsyncRules: @@ -210,39 +231,44 @@ class TestAsyncRules: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - rule = await async_client.cloud.security_groups.rules.create( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - ) + with pytest.warns(DeprecationWarning): + rule = await async_client.cloud.security_groups.rules.create( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - rule = await async_client.cloud.security_groups.rules.create( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - description="Some description", - ethertype="IPv4", - port_range_max=80, - port_range_min=80, - protocol="tcp", - remote_group_id="00000000-0000-4000-8000-000000000000", - remote_ip_prefix="10.0.0.0/8", - ) + with pytest.warns(DeprecationWarning): + rule = await async_client.cloud.security_groups.rules.create( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + description="Some description", + ethertype="IPv4", + port_range_max=80, + port_range_min=80, + protocol="tcp", + remote_group_id="00000000-0000-4000-8000-000000000000", + remote_ip_prefix="10.0.0.0/8", + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.security_groups.rules.with_raw_response.create( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.security_groups.rules.with_raw_response.create( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -251,46 +277,51 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.security_groups.rules.with_streaming_response.create( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = await response.parse() - assert_matches_type(SecurityGroupRule, rule, path=["response"]) + with pytest.warns(DeprecationWarning): + async with async_client.cloud.security_groups.rules.with_streaming_response.create( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(SecurityGroupRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_create(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): - await async_client.cloud.security_groups.rules.with_raw_response.create( - group_id="", + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + await async_client.cloud.security_groups.rules.with_raw_response.create( + group_id="", + project_id=1, + region_id=1, + direction="ingress", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + with pytest.warns(DeprecationWarning): + rule = await async_client.cloud.security_groups.rules.delete( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", project_id=1, region_id=1, - direction="ingress", ) - @parametrize - async def test_method_delete(self, async_client: AsyncGcore) -> None: - rule = await async_client.cloud.security_groups.rules.delete( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) assert rule is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.security_groups.rules.with_raw_response.delete( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.security_groups.rules.with_raw_response.delete( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -299,66 +330,73 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.security_groups.rules.with_streaming_response.delete( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.cloud.security_groups.rules.with_streaming_response.delete( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = await response.parse() - assert rule is None + rule = await response.parse() + assert rule is None assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - await async_client.cloud.security_groups.rules.with_raw_response.delete( - rule_id="", + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.cloud.security_groups.rules.with_raw_response.delete( + rule_id="", + project_id=1, + region_id=1, + ) + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + with pytest.warns(DeprecationWarning): + rule = await async_client.cloud.security_groups.rules.replace( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", project_id=1, region_id=1, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", ) - @parametrize - async def test_method_replace(self, async_client: AsyncGcore) -> None: - rule = await async_client.cloud.security_groups.rules.replace( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - security_group_id="00000000-0000-4000-8000-000000000000", - ) assert_matches_type(SecurityGroupRule, rule, path=["response"]) @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: - rule = await async_client.cloud.security_groups.rules.replace( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - security_group_id="00000000-0000-4000-8000-000000000000", - description="Some description", - ethertype="IPv4", - port_range_max=80, - port_range_min=80, - protocol="tcp", - remote_group_id="00000000-0000-4000-8000-000000000000", - remote_ip_prefix="10.0.0.0/8", - ) + with pytest.warns(DeprecationWarning): + rule = await async_client.cloud.security_groups.rules.replace( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + description="Some description", + ethertype="IPv4", + port_range_max=80, + port_range_min=80, + protocol="tcp", + remote_group_id="00000000-0000-4000-8000-000000000000", + remote_ip_prefix="10.0.0.0/8", + ) + assert_matches_type(SecurityGroupRule, rule, path=["response"]) @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.security_groups.rules.with_raw_response.replace( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - security_group_id="00000000-0000-4000-8000-000000000000", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.security_groups.rules.with_raw_response.replace( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -367,28 +405,30 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.security_groups.rules.with_streaming_response.replace( - rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - direction="ingress", - security_group_id="00000000-0000-4000-8000-000000000000", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - rule = await response.parse() - assert_matches_type(SecurityGroupRule, rule, path=["response"]) + with pytest.warns(DeprecationWarning): + async with async_client.cloud.security_groups.rules.with_streaming_response.replace( + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(SecurityGroupRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_replace(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): - await async_client.cloud.security_groups.rules.with_raw_response.replace( - rule_id="", - project_id=1, - region_id=1, - direction="ingress", - security_group_id="00000000-0000-4000-8000-000000000000", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.cloud.security_groups.rules.with_raw_response.replace( + rule_id="", + project_id=1, + region_id=1, + direction="ingress", + security_group_id="00000000-0000-4000-8000-000000000000", + ) diff --git a/tests/api_resources/waap/domains/test_advanced_rules.py b/tests/api_resources/waap/domains/test_advanced_rules.py index fe8f806f..a049a35b 100644 --- a/tests/api_resources/waap/domains/test_advanced_rules.py +++ b/tests/api_resources/waap/domains/test_advanced_rules.py @@ -36,14 +36,14 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: advanced_rule = client.waap.domains.advanced_rules.create( domain_id=1, action={ - "allow": {}, + "allow": {"foo": "bar"}, "block": { "action_duration": "12h", "status_code": 403, }, - "captcha": {}, - "handshake": {}, - "monitor": {}, + "captcha": {"foo": "bar"}, + "handshake": {"foo": "bar"}, + "monitor": {"foo": "bar"}, "tag": {"tags": ["string"]}, }, enabled=True, @@ -100,14 +100,14 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: rule_id=0, domain_id=1, action={ - "allow": {}, + "allow": {"foo": "bar"}, "block": { "action_duration": "12h", "status_code": 403, }, - "captcha": {}, - "handshake": {}, - "monitor": {}, + "captcha": {"foo": "bar"}, + "handshake": {"foo": "bar"}, + "monitor": {"foo": "bar"}, "tag": {"tags": ["string"]}, }, description="description", @@ -317,14 +317,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> advanced_rule = await async_client.waap.domains.advanced_rules.create( domain_id=1, action={ - "allow": {}, + "allow": {"foo": "bar"}, "block": { "action_duration": "12h", "status_code": 403, }, - "captcha": {}, - "handshake": {}, - "monitor": {}, + "captcha": {"foo": "bar"}, + "handshake": {"foo": "bar"}, + "monitor": {"foo": "bar"}, "tag": {"tags": ["string"]}, }, enabled=True, @@ -381,14 +381,14 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> rule_id=0, domain_id=1, action={ - "allow": {}, + "allow": {"foo": "bar"}, "block": { "action_duration": "12h", "status_code": 403, }, - "captcha": {}, - "handshake": {}, - "monitor": {}, + "captcha": {"foo": "bar"}, + "handshake": {"foo": "bar"}, + "monitor": {"foo": "bar"}, "tag": {"tags": ["string"]}, }, description="description", diff --git a/tests/api_resources/waap/domains/test_custom_rules.py b/tests/api_resources/waap/domains/test_custom_rules.py index 36a7e89f..8a2ab6d1 100644 --- a/tests/api_resources/waap/domains/test_custom_rules.py +++ b/tests/api_resources/waap/domains/test_custom_rules.py @@ -36,14 +36,14 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: custom_rule = client.waap.domains.custom_rules.create( domain_id=1, action={ - "allow": {}, + "allow": {"foo": "bar"}, "block": { "action_duration": "12h", "status_code": 403, }, - "captcha": {}, - "handshake": {}, - "monitor": {}, + "captcha": {"foo": "bar"}, + "handshake": {"foo": "bar"}, + "monitor": {"foo": "bar"}, "tag": {"tags": ["string"]}, }, conditions=[ @@ -185,14 +185,14 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: rule_id=0, domain_id=1, action={ - "allow": {}, + "allow": {"foo": "bar"}, "block": { "action_duration": "12h", "status_code": 403, }, - "captcha": {}, - "handshake": {}, - "monitor": {}, + "captcha": {"foo": "bar"}, + "handshake": {"foo": "bar"}, + "monitor": {"foo": "bar"}, "tag": {"tags": ["string"]}, }, conditions=[ @@ -520,14 +520,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> custom_rule = await async_client.waap.domains.custom_rules.create( domain_id=1, action={ - "allow": {}, + "allow": {"foo": "bar"}, "block": { "action_duration": "12h", "status_code": 403, }, - "captcha": {}, - "handshake": {}, - "monitor": {}, + "captcha": {"foo": "bar"}, + "handshake": {"foo": "bar"}, + "monitor": {"foo": "bar"}, "tag": {"tags": ["string"]}, }, conditions=[ @@ -669,14 +669,14 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> rule_id=0, domain_id=1, action={ - "allow": {}, + "allow": {"foo": "bar"}, "block": { "action_duration": "12h", "status_code": 403, }, - "captcha": {}, - "handshake": {}, - "monitor": {}, + "captcha": {"foo": "bar"}, + "handshake": {"foo": "bar"}, + "monitor": {"foo": "bar"}, "tag": {"tags": ["string"]}, }, conditions=[ diff --git a/tests/api_resources/waap/domains/test_firewall_rules.py b/tests/api_resources/waap/domains/test_firewall_rules.py index 560b4128..10b6fa28 100644 --- a/tests/api_resources/waap/domains/test_firewall_rules.py +++ b/tests/api_resources/waap/domains/test_firewall_rules.py @@ -36,7 +36,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: firewall_rule = client.waap.domains.firewall_rules.create( domain_id=1, action={ - "allow": {}, + "allow": {"foo": "bar"}, "block": { "action_duration": "12h", "status_code": 403, @@ -107,7 +107,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: rule_id=0, domain_id=1, action={ - "allow": {}, + "allow": {"foo": "bar"}, "block": { "action_duration": "12h", "status_code": 403, @@ -364,7 +364,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> firewall_rule = await async_client.waap.domains.firewall_rules.create( domain_id=1, action={ - "allow": {}, + "allow": {"foo": "bar"}, "block": { "action_duration": "12h", "status_code": 403, @@ -435,7 +435,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> rule_id=0, domain_id=1, action={ - "allow": {}, + "allow": {"foo": "bar"}, "block": { "action_duration": "12h", "status_code": 403, From 4af6000df154dea6a96ea441749e945223f25dde Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Feb 2026 16:22:07 +0000 Subject: [PATCH 575/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 53251022..e9e01167 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e97b86d831754f75465ed3ea12af5e37ae40a288fe695dd38f4d29fb95742856.yml -openapi_spec_hash: ca2f07740c2e54d4dab2934a25829a7e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-06555b1b7559c234823e37c3970ba3ea9f11ed14270b872b22761f6be8692e74.yml +openapi_spec_hash: 619bca59fafad89221a4b35f797f14f1 config_hash: bc578a7de14c42e33b7d4bd4502218f2 From e523e2aafabd9a18e87da70659ec2c087cada0cc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Feb 2026 18:20:20 +0000 Subject: [PATCH 576/592] chore(internal): version bump --- .release-please-manifest.json | 2 +- pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f04d0896..57dc0c3d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.32.0" + ".": "0.33.0" } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 5d1c7f7a..cfdfa971 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.32.0" +version = "0.33.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 0211e7f4..f2c32ca0 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.32.0" # x-release-please-version +__version__ = "0.33.0" # x-release-please-version From a11b50944a57bb16197e2ecdc5fc28f620d5ea90 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Feb 2026 12:22:58 +0000 Subject: [PATCH 577/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index e9e01167..d86c632a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-06555b1b7559c234823e37c3970ba3ea9f11ed14270b872b22761f6be8692e74.yml -openapi_spec_hash: 619bca59fafad89221a4b35f797f14f1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1cde63e41e6a58c6a1f86f9175df845d5e9894294483e6f7e23f50507951a872.yml +openapi_spec_hash: d65dff21548c2c34f0a6077ee2eb0af1 config_hash: bc578a7de14c42e33b7d4bd4502218f2 From 5684d8e7d3d124f7c85cf1663d161335722faa9c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Feb 2026 14:27:11 +0000 Subject: [PATCH 578/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- src/gcore/resources/cloud/baremetal/servers.py | 4 ++-- .../resources/cloud/file_shares/file_shares.py | 14 +++++++------- src/gcore/resources/cloud/floating_ips.py | 6 +++--- .../cloud/gpu_baremetal/clusters/clusters.py | 6 +++--- .../cloud/gpu_baremetal/clusters/images.py | 6 +++--- .../cloud/gpu_virtual/clusters/clusters.py | 6 +++--- .../cloud/gpu_virtual/clusters/images.py | 6 +++--- src/gcore/resources/cloud/instances/images.py | 10 +++++----- src/gcore/resources/cloud/instances/instances.py | 4 ++-- .../cloud/load_balancers/load_balancers.py | 6 +++--- src/gcore/resources/cloud/networks/networks.py | 6 +++--- src/gcore/resources/cloud/networks/subnets.py | 6 +++--- .../cloud/security_groups/security_groups.py | 6 +++--- src/gcore/resources/cloud/volume_snapshots.py | 6 +++--- .../cloud/baremetal/server_create_params.py | 2 +- .../types/cloud/file_share_create_params.py | 6 +++--- .../types/cloud/floating_ip_create_params.py | 4 ++-- .../cloud/gpu_baremetal/cluster_create_params.py | 4 ++-- .../clusters/image_upload_params.py | 4 ++-- .../cloud/gpu_virtual/cluster_create_params.py | 2 +- .../gpu_virtual/clusters/image_upload_params.py | 4 ++-- src/gcore/types/cloud/instance_create_params.py | 12 ++++++------ .../instances/image_create_from_volume_params.py | 4 ++-- .../types/cloud/instances/image_upload_params.py | 4 ++-- .../types/cloud/load_balancer_create_params.py | 4 ++-- src/gcore/types/cloud/network_create_params.py | 3 +-- .../types/cloud/networks/subnet_create_params.py | 4 ++-- .../types/cloud/security_group_create_params.py | 4 ++-- src/gcore/types/cloud/tag.py | 12 ++++++++++-- src/gcore/types/cloud/tag_update_map_param.py | 3 +-- .../types/cloud/volume_snapshot_create_params.py | 3 +-- .../cloud/gpu_baremetal/test_clusters.py | 16 ++++++++-------- .../cloud/gpu_virtual/test_clusters.py | 16 ++++++++-------- .../api_resources/cloud/instances/test_images.py | 4 ++-- .../api_resources/cloud/networks/test_subnets.py | 4 ++-- tests/api_resources/cloud/test_file_shares.py | 4 ++-- tests/api_resources/cloud/test_floating_ips.py | 4 ++-- tests/api_resources/cloud/test_instances.py | 4 ++-- tests/api_resources/cloud/test_load_balancers.py | 4 ++-- tests/api_resources/cloud/test_networks.py | 4 ++-- .../api_resources/cloud/test_security_groups.py | 4 ++-- .../api_resources/cloud/test_volume_snapshots.py | 4 ++-- tests/api_resources/cloud/test_volumes.py | 16 ++++++++-------- 44 files changed, 132 insertions(+), 127 deletions(-) diff --git a/.stats.yml b/.stats.yml index d86c632a..54d04e2d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1cde63e41e6a58c6a1f86f9175df845d5e9894294483e6f7e23f50507951a872.yml -openapi_spec_hash: d65dff21548c2c34f0a6077ee2eb0af1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-30f92b095e6f90731f4e7652affc69f27c57849dccf30119b79c26314aa2ae00.yml +openapi_spec_hash: 2348a329bec98d05bf5e4c109d300382 config_hash: bc578a7de14c42e33b7d4bd4502218f2 diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index d64bc50c..f14cb7c9 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -62,7 +62,7 @@ def create( name_template: str | Omit = omit, password: str | Omit = omit, ssh_key_name: Optional[str] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, user_data: str | Omit = omit, username: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -433,7 +433,7 @@ async def create( name_template: str | Omit = omit, password: str | Omit = omit, ssh_key_name: Optional[str] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, user_data: str | Omit = omit, username: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index e61969f0..4e50acc9 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Literal, overload import httpx @@ -75,7 +75,7 @@ def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, type_name: Literal["standard"] | Omit = omit, volume_type: Literal["default_share_type"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -134,7 +134,7 @@ def create( protocol: Literal["NFS"], size: int, share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, type_name: Literal["vast"] | Omit = omit, volume_type: Literal["vast_share_type"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -192,7 +192,7 @@ def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, type_name: Literal["standard"] | Literal["vast"] | Omit = omit, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | Omit = omit, share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, @@ -552,7 +552,7 @@ async def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, type_name: Literal["standard"] | Omit = omit, volume_type: Literal["default_share_type"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -611,7 +611,7 @@ async def create( protocol: Literal["NFS"], size: int, share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, type_name: Literal["vast"] | Omit = omit, volume_type: Literal["vast_share_type"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -669,7 +669,7 @@ async def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, type_name: Literal["standard"] | Literal["vast"] | Omit = omit, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | Omit = omit, share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 6732cbb1..fe753423 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -3,7 +3,7 @@ from __future__ import annotations import typing_extensions -from typing import Dict, Optional +from typing import Optional import httpx @@ -67,7 +67,7 @@ def create( region_id: int | None = None, fixed_ip_address: Optional[str] | Omit = omit, port_id: Optional[str] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -552,7 +552,7 @@ async def create( region_id: int | None = None, fixed_ip_address: Optional[str] | Omit = omit, port_id: Optional[str] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py b/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py index 5fea265a..6de2b3c8 100644 --- a/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Optional +from typing import List, Optional from typing_extensions import Literal import httpx @@ -113,7 +113,7 @@ def create( name: str, servers_count: int, servers_settings: cluster_create_params.ServersSettings, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -668,7 +668,7 @@ async def create( name: str, servers_count: int, servers_settings: cluster_create_params.ServersSettings, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/gpu_baremetal/clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal/clusters/images.py index c30ce40a..bd5f8291 100644 --- a/src/gcore/resources/cloud/gpu_baremetal/clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal/clusters/images.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal import httpx @@ -190,7 +190,7 @@ def upload( os_type: Optional[Literal["linux", "windows"]] | Omit = omit, os_version: Optional[str] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -432,7 +432,7 @@ async def upload( os_type: Optional[Literal["linux", "windows"]] | Omit = omit, os_version: Optional[str] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py b/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py index 486048b5..8fe0de91 100644 --- a/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal, overload import httpx @@ -122,7 +122,7 @@ def create( name: str, servers_count: int, servers_settings: cluster_create_params.ServersSettings, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -767,7 +767,7 @@ async def create( name: str, servers_count: int, servers_settings: cluster_create_params.ServersSettings, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/gpu_virtual/clusters/images.py b/src/gcore/resources/cloud/gpu_virtual/clusters/images.py index 9c7d1472..d83f68fa 100644 --- a/src/gcore/resources/cloud/gpu_virtual/clusters/images.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/images.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal import httpx @@ -190,7 +190,7 @@ def upload( os_type: Optional[Literal["linux", "windows"]] | Omit = omit, os_version: Optional[str] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -432,7 +432,7 @@ async def upload( os_type: Optional[Literal["linux", "windows"]] | Omit = omit, os_version: Optional[str] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index 7691ba3e..23e3ba1c 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal import httpx @@ -252,7 +252,7 @@ def create_from_volume( os_type: Literal["linux", "windows"] | Omit = omit, source: Literal["volume"] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -388,7 +388,7 @@ def upload( os_type: Literal["linux", "windows"] | Omit = omit, os_version: Optional[str] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -689,7 +689,7 @@ async def create_from_volume( os_type: Literal["linux", "windows"] | Omit = omit, source: Literal["volume"] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -825,7 +825,7 @@ async def upload( os_type: Literal["linux", "windows"] | Omit = omit, os_version: Optional[str] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index ca6b0339..c2e445aa 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -125,7 +125,7 @@ def create( security_groups: Iterable[instance_create_params.SecurityGroup] | Omit = omit, servergroup_id: str | Omit = omit, ssh_key_name: Optional[str] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, user_data: str | Omit = omit, username: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1179,7 +1179,7 @@ async def create( security_groups: Iterable[instance_create_params.SecurityGroup] | Omit = omit, servergroup_id: str | Omit = omit, ssh_key_name: Optional[str] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, user_data: str | Omit = omit, username: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index c3672b4c..5e59a265 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -3,7 +3,7 @@ from __future__ import annotations import typing_extensions -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Literal import httpx @@ -143,7 +143,7 @@ def create( name: str | Omit = omit, name_template: str | Omit = omit, preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, vip_ip_family: InterfaceIPFamily | Omit = omit, vip_network_id: str | Omit = omit, vip_port_id: str | Omit = omit, @@ -701,7 +701,7 @@ async def create( name: str | Omit = omit, name_template: str | Omit = omit, preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, vip_ip_family: InterfaceIPFamily | Omit = omit, vip_network_id: str | Omit = omit, vip_port_id: str | Omit = omit, diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index b18a62af..dc7e9f8a 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal import httpx @@ -78,7 +78,7 @@ def create( region_id: int | None = None, name: str, create_router: bool | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, type: Literal["vlan", "vxlan"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -419,7 +419,7 @@ async def create( region_id: int | None = None, name: str, create_router: bool | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, type: Literal["vlan", "vxlan"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 8bd0acb6..b2861e1f 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Literal import httpx @@ -64,7 +64,7 @@ def create( host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | Omit = omit, ip_version: IPVersion | Omit = omit, router_id_to_connect: Optional[str] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -462,7 +462,7 @@ async def create( host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | Omit = omit, ip_version: IPVersion | Omit = omit, router_id_to_connect: Optional[str] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 2d4db35e..909cd448 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional import httpx @@ -71,7 +71,7 @@ def create( name: str, description: str | Omit = omit, rules: Iterable[security_group_create_params.Rule] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -523,7 +523,7 @@ async def create( name: str, description: str | Omit = omit, rules: Iterable[security_group_create_params.Rule] | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/volume_snapshots.py b/src/gcore/resources/cloud/volume_snapshots.py index a8b6850a..52dc4971 100644 --- a/src/gcore/resources/cloud/volume_snapshots.py +++ b/src/gcore/resources/cloud/volume_snapshots.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional import httpx @@ -53,7 +53,7 @@ def create( name: str, volume_id: str, description: str | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -305,7 +305,7 @@ async def create( name: str, volume_id: str, description: str | Omit = omit, - tags: Dict[str, str] | Omit = omit, + tags: object | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index 6a0d6aa9..08280551 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -87,7 +87,7 @@ class ServerCreateParams(TypedDict, total=False): [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). """ - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index dc69d0d0..5dca72de 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ @@ -37,7 +37,7 @@ class CreateStandardFileShareSerializer(TypedDict, total=False): access: Iterable[CreateStandardFileShareSerializerAccess] """Access Rules""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -94,7 +94,7 @@ class CreateVastFileShareSerializer(TypedDict, total=False): share_settings: CreateVastFileShareSerializerShareSettings """Configuration settings for the share""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/floating_ip_create_params.py b/src/gcore/types/cloud/floating_ip_create_params.py index 48cddda9..ee28a9e9 100644 --- a/src/gcore/types/cloud/floating_ip_create_params.py +++ b/src/gcore/types/cloud/floating_ip_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import TypedDict __all__ = ["FloatingIPCreateParams"] @@ -27,7 +27,7 @@ class FloatingIPCreateParams(TypedDict, total=False): If provided, the floating IP will be immediately attached to the specified port. """ - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling 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 ed821b5d..d2b5284b 100644 --- a/src/gcore/types/cloud/gpu_baremetal/cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/cluster_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ @@ -42,7 +42,7 @@ class ClusterCreateParams(TypedDict, total=False): servers_settings: Required[ServersSettings] """Configuration settings for the servers in the cluster""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/gpu_baremetal/clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_baremetal/clusters/image_upload_params.py index 4cae77be..269dfd76 100644 --- a/src/gcore/types/cloud/gpu_baremetal/clusters/image_upload_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/clusters/image_upload_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ImageUploadParams"] @@ -45,7 +45,7 @@ class ImageUploadParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Permission to use a ssh key in instances""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling 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 762e4879..a6b6e0b1 100644 --- a/src/gcore/types/cloud/gpu_virtual/cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_create_params.py @@ -42,7 +42,7 @@ class ClusterCreateParams(TypedDict, total=False): servers_settings: Required[ServersSettings] """Configuration settings for the servers in the cluster""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/gpu_virtual/clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_virtual/clusters/image_upload_params.py index 4cae77be..269dfd76 100644 --- a/src/gcore/types/cloud/gpu_virtual/clusters/image_upload_params.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/image_upload_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ImageUploadParams"] @@ -45,7 +45,7 @@ class ImageUploadParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Permission to use a ssh key in instances""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index ee1ba080..bed6de52 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -114,7 +114,7 @@ class InstanceCreateParams(TypedDict, total=False): [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). """ - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -398,7 +398,7 @@ class VolumeCreateInstanceCreateNewVolumeSerializer(TypedDict, total=False): If not specified, a name will be generated automatically. """ - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -459,7 +459,7 @@ class VolumeCreateInstanceCreateVolumeFromImageSerializer(TypedDict, total=False - For basic VMs: the size is set automatically based on the flavor. """ - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -513,7 +513,7 @@ class VolumeCreateInstanceCreateVolumeFromSnapshotSerializer(TypedDict, total=Fa If not specified, a name will be generated automatically. """ - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -559,7 +559,7 @@ class VolumeCreateInstanceCreateVolumeFromApptemplateSerializer(TypedDict, total size: int """Volume size in GiB.""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -604,7 +604,7 @@ class VolumeCreateInstanceExistingVolumeSerializer(TypedDict, total=False): delete_on_termination: bool """Set to `true` to automatically delete the volume when the instance is deleted.""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instances/image_create_from_volume_params.py b/src/gcore/types/cloud/instances/image_create_from_volume_params.py index d98e34ae..52928edb 100644 --- a/src/gcore/types/cloud/instances/image_create_from_volume_params.py +++ b/src/gcore/types/cloud/instances/image_create_from_volume_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ImageCreateFromVolumeParams"] @@ -40,7 +40,7 @@ class ImageCreateFromVolumeParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Whether the image supports SSH key or not""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instances/image_upload_params.py b/src/gcore/types/cloud/instances/image_upload_params.py index 4085ea54..a10d83fe 100644 --- a/src/gcore/types/cloud/instances/image_upload_params.py +++ b/src/gcore/types/cloud/instances/image_upload_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ImageUploadParams"] @@ -49,7 +49,7 @@ class ImageUploadParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Whether the image supports SSH key or not""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 8d56613c..db1d053d 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable, Optional +from typing import Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr @@ -71,7 +71,7 @@ class LoadBalancerCreateParams(TypedDict, total=False): specification. """ - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/network_create_params.py b/src/gcore/types/cloud/network_create_params.py index b4cb5e77..935f9bc0 100644 --- a/src/gcore/types/cloud/network_create_params.py +++ b/src/gcore/types/cloud/network_create_params.py @@ -2,7 +2,6 @@ from __future__ import annotations -from typing import Dict from typing_extensions import Literal, Required, TypedDict __all__ = ["NetworkCreateParams"] @@ -21,7 +20,7 @@ class NetworkCreateParams(TypedDict, total=False): create_router: bool """Defaults to True""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index 5a6b365f..41274927 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict from ...._types import SequenceNotStr @@ -60,7 +60,7 @@ class SubnetCreateParams(TypedDict, total=False): find a router created during network creation. """ - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/security_group_create_params.py b/src/gcore/types/cloud/security_group_create_params.py index e660dee3..d4904c5d 100644 --- a/src/gcore/types/cloud/security_group_create_params.py +++ b/src/gcore/types/cloud/security_group_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["SecurityGroupCreateParams", "Rule"] @@ -24,7 +24,7 @@ class SecurityGroupCreateParams(TypedDict, total=False): rules: Iterable[Rule] """Security group rules""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/tag.py b/src/gcore/types/cloud/tag.py index 56ac9aa0..9ee9fdba 100644 --- a/src/gcore/types/cloud/tag.py +++ b/src/gcore/types/cloud/tag.py @@ -14,10 +14,18 @@ class Tag(BaseModel): """ key: str - """Tag key. The maximum size for a key is 255 characters.""" + """Tag key. + + Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or + '=' character. + """ read_only: bool """If true, the tag is read-only and cannot be modified by the user""" value: str - """Tag value. The maximum size for a value is 255 characters.""" + """Tag value. + + Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or + '=' character. + """ diff --git a/src/gcore/types/cloud/tag_update_map_param.py b/src/gcore/types/cloud/tag_update_map_param.py index 6726649c..9a70575e 100644 --- a/src/gcore/types/cloud/tag_update_map_param.py +++ b/src/gcore/types/cloud/tag_update_map_param.py @@ -2,9 +2,8 @@ from __future__ import annotations -from typing import Dict, Optional from typing_extensions import TypeAlias __all__ = ["TagUpdateMapParam"] -TagUpdateMapParam: TypeAlias = Dict[str, Optional[str]] +TagUpdateMapParam: TypeAlias = object diff --git a/src/gcore/types/cloud/volume_snapshot_create_params.py b/src/gcore/types/cloud/volume_snapshot_create_params.py index b832806b..8d77c011 100644 --- a/src/gcore/types/cloud/volume_snapshot_create_params.py +++ b/src/gcore/types/cloud/volume_snapshot_create_params.py @@ -2,7 +2,6 @@ from __future__ import annotations -from typing import Dict from typing_extensions import Required, TypedDict __all__ = ["VolumeSnapshotCreateParams"] @@ -22,7 +21,7 @@ class VolumeSnapshotCreateParams(TypedDict, total=False): description: str """Snapshot description""" - tags: Dict[str, str] + tags: object """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/tests/api_resources/cloud/gpu_baremetal/test_clusters.py b/tests/api_resources/cloud/gpu_baremetal/test_clusters.py index cd68c18a..3a47eba9 100644 --- a/tests/api_resources/cloud/gpu_baremetal/test_clusters.py +++ b/tests/api_resources/cloud/gpu_baremetal/test_clusters.py @@ -217,7 +217,7 @@ def test_method_action(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(TaskIDList, cluster, path=["response"]) @@ -228,7 +228,7 @@ def test_raw_response_action(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) assert response.is_closed is True @@ -243,7 +243,7 @@ def test_streaming_response_action(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -261,7 +261,7 @@ def test_path_params_action(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) @parametrize @@ -715,7 +715,7 @@ async def test_method_action(self, async_client: AsyncGcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(TaskIDList, cluster, path=["response"]) @@ -726,7 +726,7 @@ async def test_raw_response_action(self, async_client: AsyncGcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) assert response.is_closed is True @@ -741,7 +741,7 @@ async def test_streaming_response_action(self, async_client: AsyncGcore) -> None project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -759,7 +759,7 @@ async def test_path_params_action(self, async_client: AsyncGcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) @parametrize diff --git a/tests/api_resources/cloud/gpu_virtual/test_clusters.py b/tests/api_resources/cloud/gpu_virtual/test_clusters.py index 91d2ae2d..0487f803 100644 --- a/tests/api_resources/cloud/gpu_virtual/test_clusters.py +++ b/tests/api_resources/cloud/gpu_virtual/test_clusters.py @@ -507,7 +507,7 @@ def test_method_action_overload_5(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(TaskIDList, cluster, path=["response"]) @@ -518,7 +518,7 @@ def test_raw_response_action_overload_5(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) assert response.is_closed is True @@ -533,7 +533,7 @@ def test_streaming_response_action_overload_5(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -551,7 +551,7 @@ def test_path_params_action_overload_5(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) @parametrize @@ -1146,7 +1146,7 @@ async def test_method_action_overload_5(self, async_client: AsyncGcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(TaskIDList, cluster, path=["response"]) @@ -1157,7 +1157,7 @@ async def test_raw_response_action_overload_5(self, async_client: AsyncGcore) -> project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) assert response.is_closed is True @@ -1172,7 +1172,7 @@ async def test_streaming_response_action_overload_5(self, async_client: AsyncGco project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1190,7 +1190,7 @@ async def test_path_params_action_overload_5(self, async_client: AsyncGcore) -> project_id=1, region_id=7, action="update_tags", - tags={"foo": "my-tag-value"}, + tags={}, ) @parametrize diff --git a/tests/api_resources/cloud/instances/test_images.py b/tests/api_resources/cloud/instances/test_images.py index c30fde90..b97decb0 100644 --- a/tests/api_resources/cloud/instances/test_images.py +++ b/tests/api_resources/cloud/instances/test_images.py @@ -38,7 +38,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: name="my-image", os_type="linux", ssh_key="allow", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(Image, image, path=["response"]) @@ -373,7 +373,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> name="my-image", os_type="linux", ssh_key="allow", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(Image, image, path=["response"]) diff --git a/tests/api_resources/cloud/networks/test_subnets.py b/tests/api_resources/cloud/networks/test_subnets.py index 8ba4ff6f..dc315c0a 100644 --- a/tests/api_resources/cloud/networks/test_subnets.py +++ b/tests/api_resources/cloud/networks/test_subnets.py @@ -110,7 +110,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: } ], name="some_name", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(Subnet, subnet, path=["response"]) @@ -389,7 +389,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> } ], name="some_name", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(Subnet, subnet, path=["response"]) diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index 055e05d6..74d9a584 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -174,7 +174,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "path_length": "LCD", "root_squash": True, }, - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -562,7 +562,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "path_length": "LCD", "root_squash": True, }, - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(TaskIDList, file_share, path=["response"]) diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index 97ff5795..fda155b2 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -86,7 +86,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: region_id=1, fixed_ip_address="192.168.10.15", port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) @@ -453,7 +453,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> region_id=1, fixed_ip_address="192.168.10.15", port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) diff --git a/tests/api_resources/cloud/test_instances.py b/tests/api_resources/cloud/test_instances.py index 7b908015..d5c24486 100644 --- a/tests/api_resources/cloud/test_instances.py +++ b/tests/api_resources/cloud/test_instances.py @@ -137,7 +137,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: project_id=0, region_id=0, name="instance_name", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(Instance, instance, path=["response"]) @@ -1007,7 +1007,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> project_id=0, region_id=0, name="instance_name", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(Instance, instance, path=["response"]) diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index 5b30c022..75c7a421 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -185,7 +185,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: }, name="some_name", preferred_connectivity="L2", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @@ -659,7 +659,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> }, name="some_name", preferred_connectivity="L2", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) diff --git a/tests/api_resources/cloud/test_networks.py b/tests/api_resources/cloud/test_networks.py index dbd1f4d0..273791bd 100644 --- a/tests/api_resources/cloud/test_networks.py +++ b/tests/api_resources/cloud/test_networks.py @@ -86,7 +86,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, name="some_name", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(Network, network, path=["response"]) @@ -338,7 +338,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> project_id=1, region_id=1, name="some_name", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(Network, network, path=["response"]) diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index 2bd9402b..6050ff4c 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -110,7 +110,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "remote_ip_prefix": "10.0.0.0/8", } ], - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(TaskIDList, security_group, path=["response"]) @@ -481,7 +481,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "remote_ip_prefix": "10.0.0.0/8", } ], - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(TaskIDList, security_group, path=["response"]) diff --git a/tests/api_resources/cloud/test_volume_snapshots.py b/tests/api_resources/cloud/test_volume_snapshots.py index 4b2d7bfd..f4da5ed7 100644 --- a/tests/api_resources/cloud/test_volume_snapshots.py +++ b/tests/api_resources/cloud/test_volume_snapshots.py @@ -88,7 +88,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, name="my-backup-snapshot", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(Snapshot, volume_snapshot, path=["response"]) @@ -295,7 +295,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> project_id=1, region_id=1, name="my-backup-snapshot", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(Snapshot, volume_snapshot, path=["response"]) diff --git a/tests/api_resources/cloud/test_volumes.py b/tests/api_resources/cloud/test_volumes.py index 95d43b9f..67bd0e60 100644 --- a/tests/api_resources/cloud/test_volumes.py +++ b/tests/api_resources/cloud/test_volumes.py @@ -45,7 +45,7 @@ def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - tags={"foo": "my-tag-value"}, + tags={}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -107,7 +107,7 @@ def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], size=10, - tags={"foo": "my-tag-value"}, + tags={}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -166,7 +166,7 @@ def test_method_create_with_all_params_overload_3(self, client: Gcore) -> None: attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - tags={"foo": "my-tag-value"}, + tags={}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -219,7 +219,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, name="some_name", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(Volume, volume, path=["response"]) @@ -701,7 +701,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - tags={"foo": "my-tag-value"}, + tags={}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -763,7 +763,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], size=10, - tags={"foo": "my-tag-value"}, + tags={}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -822,7 +822,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - tags={"foo": "my-tag-value"}, + tags={}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -875,7 +875,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> project_id=1, region_id=1, name="some_name", - tags={"foo": "my-tag-value"}, + tags={}, ) assert_matches_type(Volume, volume, path=["response"]) From 7f792f6f644a6d1c834863f85c7a28d96513ba88 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 10:24:34 +0000 Subject: [PATCH 579/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cloud/baremetal/servers.py | 4 +- .../cloud/file_shares/file_shares.py | 14 +- src/gcore/resources/cloud/floating_ips.py | 6 +- .../cloud/gpu_baremetal/clusters/clusters.py | 6 +- .../cloud/gpu_baremetal/clusters/images.py | 6 +- .../cloud/gpu_virtual/clusters/clusters.py | 6 +- .../cloud/gpu_virtual/clusters/images.py | 6 +- src/gcore/resources/cloud/instances/images.py | 10 +- .../resources/cloud/instances/instances.py | 4 +- .../cloud/load_balancers/load_balancers.py | 6 +- .../resources/cloud/networks/networks.py | 6 +- src/gcore/resources/cloud/networks/subnets.py | 6 +- .../cloud/security_groups/security_groups.py | 6 +- src/gcore/resources/cloud/volume_snapshots.py | 6 +- .../resources/storage/buckets/buckets.py | 100 ++++- src/gcore/resources/storage/buckets/cors.py | 70 ++- .../resources/storage/buckets/lifecycle.py | 70 ++- src/gcore/resources/storage/buckets/policy.py | 104 ++++- src/gcore/resources/storage/credentials.py | 38 +- src/gcore/resources/storage/locations.py | 34 +- src/gcore/resources/storage/storage.py | 185 ++++++-- .../cloud/baremetal/server_create_params.py | 2 +- .../types/cloud/file_share_create_params.py | 6 +- .../types/cloud/floating_ip_create_params.py | 4 +- .../gpu_baremetal/cluster_create_params.py | 4 +- .../clusters/image_upload_params.py | 4 +- .../gpu_virtual/cluster_create_params.py | 2 +- .../clusters/image_upload_params.py | 4 +- .../types/cloud/instance_create_params.py | 12 +- .../image_create_from_volume_params.py | 4 +- .../cloud/instances/image_upload_params.py | 4 +- .../cloud/load_balancer_create_params.py | 4 +- .../types/cloud/network_create_params.py | 3 +- .../cloud/networks/subnet_create_params.py | 4 +- .../cloud/security_group_create_params.py | 4 +- src/gcore/types/cloud/tag.py | 12 +- src/gcore/types/cloud/tag_update_map_param.py | 3 +- .../cloud/volume_snapshot_create_params.py | 3 +- src/gcore/types/storage/location.py | 2 +- src/gcore/types/storage/storage.py | 2 +- .../types/storage/storage_create_params.py | 6 +- .../types/storage/storage_list_params.py | 2 +- .../cloud/gpu_baremetal/test_clusters.py | 16 +- .../cloud/gpu_virtual/test_clusters.py | 16 +- .../cloud/instances/test_images.py | 4 +- .../cloud/networks/test_subnets.py | 4 +- tests/api_resources/cloud/test_file_shares.py | 4 +- .../api_resources/cloud/test_floating_ips.py | 4 +- tests/api_resources/cloud/test_instances.py | 4 +- .../cloud/test_load_balancers.py | 4 +- tests/api_resources/cloud/test_networks.py | 4 +- .../cloud/test_security_groups.py | 4 +- .../cloud/test_volume_snapshots.py | 4 +- tests/api_resources/cloud/test_volumes.py | 16 +- .../storage/buckets/test_cors.py | 214 +++++---- .../storage/buckets/test_lifecycle.py | 214 +++++---- .../storage/buckets/test_policy.py | 284 ++++++------ tests/api_resources/storage/test_buckets.py | 274 +++++++----- .../api_resources/storage/test_credentials.py | 100 +++-- tests/api_resources/storage/test_locations.py | 58 ++- tests/api_resources/test_storage.py | 416 ++++++++++-------- 62 files changed, 1466 insertions(+), 966 deletions(-) diff --git a/.stats.yml b/.stats.yml index 54d04e2d..a290a331 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-30f92b095e6f90731f4e7652affc69f27c57849dccf30119b79c26314aa2ae00.yml -openapi_spec_hash: 2348a329bec98d05bf5e4c109d300382 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-247700eb0839f11fe995398e8b8160e264107a22a6d8a783628f070ef9888cee.yml +openapi_spec_hash: 05ee580780bc68d0c339faad61915b9b config_hash: bc578a7de14c42e33b7d4bd4502218f2 diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index f14cb7c9..d64bc50c 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -62,7 +62,7 @@ def create( name_template: str | Omit = omit, password: str | Omit = omit, ssh_key_name: Optional[str] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, user_data: str | Omit = omit, username: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -433,7 +433,7 @@ async def create( name_template: str | Omit = omit, password: str | Omit = omit, ssh_key_name: Optional[str] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, user_data: str | Omit = omit, username: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 4e50acc9..e61969f0 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Literal, overload import httpx @@ -75,7 +75,7 @@ def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, type_name: Literal["standard"] | Omit = omit, volume_type: Literal["default_share_type"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -134,7 +134,7 @@ def create( protocol: Literal["NFS"], size: int, share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, type_name: Literal["vast"] | Omit = omit, volume_type: Literal["vast_share_type"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -192,7 +192,7 @@ def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, type_name: Literal["standard"] | Literal["vast"] | Omit = omit, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | Omit = omit, share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, @@ -552,7 +552,7 @@ async def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, type_name: Literal["standard"] | Omit = omit, volume_type: Literal["default_share_type"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -611,7 +611,7 @@ async def create( protocol: Literal["NFS"], size: int, share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, type_name: Literal["vast"] | Omit = omit, volume_type: Literal["vast_share_type"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -669,7 +669,7 @@ async def create( protocol: Literal["NFS"], size: int, access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, type_name: Literal["standard"] | Literal["vast"] | Omit = omit, volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | Omit = omit, share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index fe753423..6732cbb1 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -3,7 +3,7 @@ from __future__ import annotations import typing_extensions -from typing import Optional +from typing import Dict, Optional import httpx @@ -67,7 +67,7 @@ def create( region_id: int | None = None, fixed_ip_address: Optional[str] | Omit = omit, port_id: Optional[str] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -552,7 +552,7 @@ async def create( region_id: int | None = None, fixed_ip_address: Optional[str] | Omit = omit, port_id: Optional[str] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py b/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py index 6de2b3c8..5fea265a 100644 --- a/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py +++ b/src/gcore/resources/cloud/gpu_baremetal/clusters/clusters.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Optional +from typing import Dict, List, Optional from typing_extensions import Literal import httpx @@ -113,7 +113,7 @@ def create( name: str, servers_count: int, servers_settings: cluster_create_params.ServersSettings, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -668,7 +668,7 @@ async def create( name: str, servers_count: int, servers_settings: cluster_create_params.ServersSettings, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/gpu_baremetal/clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal/clusters/images.py index bd5f8291..c30ce40a 100644 --- a/src/gcore/resources/cloud/gpu_baremetal/clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal/clusters/images.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal import httpx @@ -190,7 +190,7 @@ def upload( os_type: Optional[Literal["linux", "windows"]] | Omit = omit, os_version: Optional[str] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -432,7 +432,7 @@ async def upload( os_type: Optional[Literal["linux", "windows"]] | Omit = omit, os_version: Optional[str] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py b/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py index 8fe0de91..486048b5 100644 --- a/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, overload import httpx @@ -122,7 +122,7 @@ def create( name: str, servers_count: int, servers_settings: cluster_create_params.ServersSettings, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -767,7 +767,7 @@ async def create( name: str, servers_count: int, servers_settings: cluster_create_params.ServersSettings, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/gpu_virtual/clusters/images.py b/src/gcore/resources/cloud/gpu_virtual/clusters/images.py index d83f68fa..9c7d1472 100644 --- a/src/gcore/resources/cloud/gpu_virtual/clusters/images.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/images.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal import httpx @@ -190,7 +190,7 @@ def upload( os_type: Optional[Literal["linux", "windows"]] | Omit = omit, os_version: Optional[str] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -432,7 +432,7 @@ async def upload( os_type: Optional[Literal["linux", "windows"]] | Omit = omit, os_version: Optional[str] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index 23e3ba1c..7691ba3e 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal import httpx @@ -252,7 +252,7 @@ def create_from_volume( os_type: Literal["linux", "windows"] | Omit = omit, source: Literal["volume"] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -388,7 +388,7 @@ def upload( os_type: Literal["linux", "windows"] | Omit = omit, os_version: Optional[str] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -689,7 +689,7 @@ async def create_from_volume( os_type: Literal["linux", "windows"] | Omit = omit, source: Literal["volume"] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -825,7 +825,7 @@ async def upload( os_type: Literal["linux", "windows"] | Omit = omit, os_version: Optional[str] | Omit = omit, ssh_key: Literal["allow", "deny", "required"] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index c2e445aa..ca6b0339 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -125,7 +125,7 @@ def create( security_groups: Iterable[instance_create_params.SecurityGroup] | Omit = omit, servergroup_id: str | Omit = omit, ssh_key_name: Optional[str] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, user_data: str | Omit = omit, username: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1179,7 +1179,7 @@ async def create( security_groups: Iterable[instance_create_params.SecurityGroup] | Omit = omit, servergroup_id: str | Omit = omit, ssh_key_name: Optional[str] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, user_data: str | Omit = omit, username: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 5e59a265..c3672b4c 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -3,7 +3,7 @@ from __future__ import annotations import typing_extensions -from typing import Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Literal import httpx @@ -143,7 +143,7 @@ def create( name: str | Omit = omit, name_template: str | Omit = omit, preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, vip_ip_family: InterfaceIPFamily | Omit = omit, vip_network_id: str | Omit = omit, vip_port_id: str | Omit = omit, @@ -701,7 +701,7 @@ async def create( name: str | Omit = omit, name_template: str | Omit = omit, preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, vip_ip_family: InterfaceIPFamily | Omit = omit, vip_network_id: str | Omit = omit, vip_port_id: str | Omit = omit, diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index dc7e9f8a..b18a62af 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal import httpx @@ -78,7 +78,7 @@ def create( region_id: int | None = None, name: str, create_router: bool | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, type: Literal["vlan", "vxlan"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -419,7 +419,7 @@ async def create( region_id: int | None = None, name: str, create_router: bool | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, type: Literal["vlan", "vxlan"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index b2861e1f..8bd0acb6 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Literal import httpx @@ -64,7 +64,7 @@ def create( host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | Omit = omit, ip_version: IPVersion | Omit = omit, router_id_to_connect: Optional[str] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -462,7 +462,7 @@ async def create( host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | Omit = omit, ip_version: IPVersion | Omit = omit, router_id_to_connect: Optional[str] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 909cd448..2d4db35e 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Dict, Iterable, Optional import httpx @@ -71,7 +71,7 @@ def create( name: str, description: str | Omit = omit, rules: Iterable[security_group_create_params.Rule] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -523,7 +523,7 @@ async def create( name: str, description: str | Omit = omit, rules: Iterable[security_group_create_params.Rule] | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/cloud/volume_snapshots.py b/src/gcore/resources/cloud/volume_snapshots.py index 52dc4971..a8b6850a 100644 --- a/src/gcore/resources/cloud/volume_snapshots.py +++ b/src/gcore/resources/cloud/volume_snapshots.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional import httpx @@ -53,7 +53,7 @@ def create( name: str, volume_id: str, description: str | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -305,7 +305,7 @@ async def create( name: str, volume_id: str, description: str | Omit = omit, - tags: object | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index e6c589fa..5f89b36d 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -2,6 +2,8 @@ from __future__ import annotations +import typing_extensions + import httpx from .cors import ( @@ -78,6 +80,7 @@ def with_streaming_response(self) -> BucketsResourceWithStreamingResponse: """ return BucketsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def create( self, bucket_name: str, @@ -95,6 +98,9 @@ def create( Only applicable to S3-compatible storages. + Deprecated: Use POST /provisioning/v3/storages/{`storage_id`}/buckets with + {"name": "bucket-name"} instead. + Args: extra_headers: Send extra headers @@ -115,6 +121,7 @@ def create( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") def list( self, storage_id: int, @@ -134,6 +141,10 @@ def list( Response format: count: total number of buckets (independent of pagination) results: current page of buckets according to limit/offset + Deprecated: Use GET + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} for individual + bucket details instead. + Args: limit: Max number of records in response @@ -166,6 +177,7 @@ def list( model=Bucket, ) + @typing_extensions.deprecated("deprecated") def delete( self, bucket_name: str, @@ -183,6 +195,9 @@ def delete( All objects in the bucket will be automatically deleted before the bucket is removed. + Deprecated: Use DELETE + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} instead. + Args: extra_headers: Send extra headers @@ -236,6 +251,7 @@ def with_streaming_response(self) -> AsyncBucketsResourceWithStreamingResponse: """ return AsyncBucketsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def create( self, bucket_name: str, @@ -253,6 +269,9 @@ async def create( Only applicable to S3-compatible storages. + Deprecated: Use POST /provisioning/v3/storages/{`storage_id`}/buckets with + {"name": "bucket-name"} instead. + Args: extra_headers: Send extra headers @@ -273,6 +292,7 @@ async def create( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") def list( self, storage_id: int, @@ -292,6 +312,10 @@ def list( Response format: count: total number of buckets (independent of pagination) results: current page of buckets according to limit/offset + Deprecated: Use GET + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} for individual + bucket details instead. + Args: limit: Max number of records in response @@ -324,6 +348,7 @@ def list( model=Bucket, ) + @typing_extensions.deprecated("deprecated") async def delete( self, bucket_name: str, @@ -341,6 +366,9 @@ async def delete( All objects in the bucket will be automatically deleted before the bucket is removed. + Deprecated: Use DELETE + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} instead. + Args: extra_headers: Send extra headers @@ -366,14 +394,20 @@ class BucketsResourceWithRawResponse: def __init__(self, buckets: BucketsResource) -> None: self._buckets = buckets - self.create = to_raw_response_wrapper( - buckets.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + buckets.create, # pyright: ignore[reportDeprecated], + ) ) - self.list = to_raw_response_wrapper( - buckets.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + buckets.list, # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_raw_response_wrapper( - buckets.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + buckets.delete, # pyright: ignore[reportDeprecated], + ) ) @cached_property @@ -393,14 +427,20 @@ class AsyncBucketsResourceWithRawResponse: def __init__(self, buckets: AsyncBucketsResource) -> None: self._buckets = buckets - self.create = async_to_raw_response_wrapper( - buckets.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + buckets.create, # pyright: ignore[reportDeprecated], + ) ) - self.list = async_to_raw_response_wrapper( - buckets.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + buckets.list, # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_raw_response_wrapper( - buckets.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + buckets.delete, # pyright: ignore[reportDeprecated], + ) ) @cached_property @@ -420,14 +460,20 @@ class BucketsResourceWithStreamingResponse: def __init__(self, buckets: BucketsResource) -> None: self._buckets = buckets - self.create = to_streamed_response_wrapper( - buckets.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + buckets.create, # pyright: ignore[reportDeprecated], + ) ) - self.list = to_streamed_response_wrapper( - buckets.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + buckets.list, # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_streamed_response_wrapper( - buckets.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + buckets.delete, # pyright: ignore[reportDeprecated], + ) ) @cached_property @@ -447,14 +493,20 @@ class AsyncBucketsResourceWithStreamingResponse: def __init__(self, buckets: AsyncBucketsResource) -> None: self._buckets = buckets - self.create = async_to_streamed_response_wrapper( - buckets.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + buckets.create, # pyright: ignore[reportDeprecated], + ) ) - self.list = async_to_streamed_response_wrapper( - buckets.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + buckets.list, # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_streamed_response_wrapper( - buckets.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + buckets.delete, # pyright: ignore[reportDeprecated], + ) ) @cached_property diff --git a/src/gcore/resources/storage/buckets/cors.py b/src/gcore/resources/storage/buckets/cors.py index 77a3e045..d1983698 100644 --- a/src/gcore/resources/storage/buckets/cors.py +++ b/src/gcore/resources/storage/buckets/cors.py @@ -2,6 +2,8 @@ from __future__ import annotations +import typing_extensions + import httpx from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given @@ -41,6 +43,7 @@ def with_streaming_response(self) -> CorsResourceWithStreamingResponse: """ return CorsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def create( self, bucket_name: str, @@ -59,6 +62,10 @@ def create( web applications from specified domains to access bucket resources directly from browsers. + Deprecated: Use PATCH + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} with {"cors": + {"allowed_origins": [...]}} instead. + Args: allowed_origins: List of allowed origins for CORS requests @@ -82,6 +89,7 @@ def create( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") def get( self, bucket_name: str, @@ -99,6 +107,10 @@ def get( S3 bucket, showing which domains are allowed to access the bucket from web browsers. + Deprecated: Use GET + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} instead, which + returns CORS along with policy and lifecycle configuration. + Args: extra_headers: Send extra headers @@ -139,6 +151,7 @@ def with_streaming_response(self) -> AsyncCorsResourceWithStreamingResponse: """ return AsyncCorsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def create( self, bucket_name: str, @@ -157,6 +170,10 @@ async def create( web applications from specified domains to access bucket resources directly from browsers. + Deprecated: Use PATCH + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} with {"cors": + {"allowed_origins": [...]}} instead. + Args: allowed_origins: List of allowed origins for CORS requests @@ -180,6 +197,7 @@ async def create( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") async def get( self, bucket_name: str, @@ -197,6 +215,10 @@ async def get( S3 bucket, showing which domains are allowed to access the bucket from web browsers. + Deprecated: Use GET + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} instead, which + returns CORS along with policy and lifecycle configuration. + Args: extra_headers: Send extra headers @@ -221,11 +243,15 @@ class CorsResourceWithRawResponse: def __init__(self, cors: CorsResource) -> None: self._cors = cors - self.create = to_raw_response_wrapper( - cors.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + cors.create, # pyright: ignore[reportDeprecated], + ) ) - self.get = to_raw_response_wrapper( - cors.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + cors.get, # pyright: ignore[reportDeprecated], + ) ) @@ -233,11 +259,15 @@ class AsyncCorsResourceWithRawResponse: def __init__(self, cors: AsyncCorsResource) -> None: self._cors = cors - self.create = async_to_raw_response_wrapper( - cors.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + cors.create, # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_raw_response_wrapper( - cors.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + cors.get, # pyright: ignore[reportDeprecated], + ) ) @@ -245,11 +275,15 @@ class CorsResourceWithStreamingResponse: def __init__(self, cors: CorsResource) -> None: self._cors = cors - self.create = to_streamed_response_wrapper( - cors.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + cors.create, # pyright: ignore[reportDeprecated], + ) ) - self.get = to_streamed_response_wrapper( - cors.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + cors.get, # pyright: ignore[reportDeprecated], + ) ) @@ -257,9 +291,13 @@ class AsyncCorsResourceWithStreamingResponse: def __init__(self, cors: AsyncCorsResource) -> None: self._cors = cors - self.create = async_to_streamed_response_wrapper( - cors.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + cors.create, # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_streamed_response_wrapper( - cors.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + cors.get, # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/gcore/resources/storage/buckets/lifecycle.py b/src/gcore/resources/storage/buckets/lifecycle.py index b80dffaf..af2c7aec 100644 --- a/src/gcore/resources/storage/buckets/lifecycle.py +++ b/src/gcore/resources/storage/buckets/lifecycle.py @@ -2,6 +2,8 @@ from __future__ import annotations +import typing_extensions + import httpx from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given @@ -40,6 +42,7 @@ def with_streaming_response(self) -> LifecycleResourceWithStreamingResponse: """ return LifecycleResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def create( self, bucket_name: str, @@ -61,6 +64,10 @@ def create( rule to the entire bucket - all existing and future objects will be subject to the expiration policy. + Deprecated: Use PATCH + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} with + {"lifecycle": {"expiration_days": N}} instead. + Args: expiration_days: Number of days after which objects will be automatically deleted from the bucket. Must be a positive integer. Common values: 30 for monthly cleanup, 365 @@ -86,6 +93,7 @@ def create( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") def delete( self, bucket_name: str, @@ -102,6 +110,10 @@ def delete( Removes all lifecycle rules from an S3 bucket, disabling automatic object expiration. Objects will no longer be automatically deleted based on age. + Deprecated: Use PATCH + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} with + {"lifecycle": {"expiration_days": null}} instead. + Args: extra_headers: Send extra headers @@ -143,6 +155,7 @@ def with_streaming_response(self) -> AsyncLifecycleResourceWithStreamingResponse """ return AsyncLifecycleResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def create( self, bucket_name: str, @@ -164,6 +177,10 @@ async def create( rule to the entire bucket - all existing and future objects will be subject to the expiration policy. + Deprecated: Use PATCH + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} with + {"lifecycle": {"expiration_days": N}} instead. + Args: expiration_days: Number of days after which objects will be automatically deleted from the bucket. Must be a positive integer. Common values: 30 for monthly cleanup, 365 @@ -191,6 +208,7 @@ async def create( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") async def delete( self, bucket_name: str, @@ -207,6 +225,10 @@ async def delete( Removes all lifecycle rules from an S3 bucket, disabling automatic object expiration. Objects will no longer be automatically deleted based on age. + Deprecated: Use PATCH + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} with + {"lifecycle": {"expiration_days": null}} instead. + Args: extra_headers: Send extra headers @@ -232,11 +254,15 @@ class LifecycleResourceWithRawResponse: def __init__(self, lifecycle: LifecycleResource) -> None: self._lifecycle = lifecycle - self.create = to_raw_response_wrapper( - lifecycle.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + lifecycle.create, # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_raw_response_wrapper( - lifecycle.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + lifecycle.delete, # pyright: ignore[reportDeprecated], + ) ) @@ -244,11 +270,15 @@ class AsyncLifecycleResourceWithRawResponse: def __init__(self, lifecycle: AsyncLifecycleResource) -> None: self._lifecycle = lifecycle - self.create = async_to_raw_response_wrapper( - lifecycle.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + lifecycle.create, # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_raw_response_wrapper( - lifecycle.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + lifecycle.delete, # pyright: ignore[reportDeprecated], + ) ) @@ -256,11 +286,15 @@ class LifecycleResourceWithStreamingResponse: def __init__(self, lifecycle: LifecycleResource) -> None: self._lifecycle = lifecycle - self.create = to_streamed_response_wrapper( - lifecycle.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + lifecycle.create, # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_streamed_response_wrapper( - lifecycle.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + lifecycle.delete, # pyright: ignore[reportDeprecated], + ) ) @@ -268,9 +302,13 @@ class AsyncLifecycleResourceWithStreamingResponse: def __init__(self, lifecycle: AsyncLifecycleResource) -> None: self._lifecycle = lifecycle - self.create = async_to_streamed_response_wrapper( - lifecycle.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + lifecycle.create, # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_streamed_response_wrapper( - lifecycle.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + lifecycle.delete, # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/gcore/resources/storage/buckets/policy.py b/src/gcore/resources/storage/buckets/policy.py index cca549f9..d44b173c 100644 --- a/src/gcore/resources/storage/buckets/policy.py +++ b/src/gcore/resources/storage/buckets/policy.py @@ -2,6 +2,8 @@ from __future__ import annotations +import typing_extensions + import httpx from ...._types import Body, Query, Headers, NoneType, NotGiven, not_given @@ -39,6 +41,7 @@ def with_streaming_response(self) -> PolicyResourceWithStreamingResponse: """ return PolicyResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def create( self, bucket_name: str, @@ -58,6 +61,10 @@ def create( integration. Only grants read access - users cannot upload, modify, or delete objects without proper authentication. + Deprecated: Use PATCH + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} with {"policy": + {"public": true}} instead. + Args: extra_headers: Send extra headers @@ -78,6 +85,7 @@ def create( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") def delete( self, bucket_name: str, @@ -96,6 +104,10 @@ def delete( anonymous users will no longer be able to access bucket contents via HTTP requests. + Deprecated: Use PATCH + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} with {"policy": + {"public": false}} instead. + Args: extra_headers: Send extra headers @@ -116,6 +128,7 @@ def delete( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") def get( self, bucket_name: str, @@ -132,6 +145,10 @@ def get( Returns whether the S3 bucket is currently configured for public read access. Shows if anonymous users can download objects from the bucket via HTTP requests. + Deprecated: Use GET + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} instead, which + returns policy status along with CORS and lifecycle configuration. + Args: extra_headers: Send extra headers @@ -172,6 +189,7 @@ def with_streaming_response(self) -> AsyncPolicyResourceWithStreamingResponse: """ return AsyncPolicyResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def create( self, bucket_name: str, @@ -191,6 +209,10 @@ async def create( integration. Only grants read access - users cannot upload, modify, or delete objects without proper authentication. + Deprecated: Use PATCH + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} with {"policy": + {"public": true}} instead. + Args: extra_headers: Send extra headers @@ -211,6 +233,7 @@ async def create( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") async def delete( self, bucket_name: str, @@ -229,6 +252,10 @@ async def delete( anonymous users will no longer be able to access bucket contents via HTTP requests. + Deprecated: Use PATCH + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} with {"policy": + {"public": false}} instead. + Args: extra_headers: Send extra headers @@ -249,6 +276,7 @@ async def delete( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") async def get( self, bucket_name: str, @@ -265,6 +293,10 @@ async def get( Returns whether the S3 bucket is currently configured for public read access. Shows if anonymous users can download objects from the bucket via HTTP requests. + Deprecated: Use GET + /provisioning/v3/storages/{`storage_id`}/buckets/{`bucket_name`} instead, which + returns policy status along with CORS and lifecycle configuration. + Args: extra_headers: Send extra headers @@ -289,14 +321,20 @@ class PolicyResourceWithRawResponse: def __init__(self, policy: PolicyResource) -> None: self._policy = policy - self.create = to_raw_response_wrapper( - policy.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + policy.create, # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_raw_response_wrapper( - policy.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + policy.delete, # pyright: ignore[reportDeprecated], + ) ) - self.get = to_raw_response_wrapper( - policy.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + policy.get, # pyright: ignore[reportDeprecated], + ) ) @@ -304,14 +342,20 @@ class AsyncPolicyResourceWithRawResponse: def __init__(self, policy: AsyncPolicyResource) -> None: self._policy = policy - self.create = async_to_raw_response_wrapper( - policy.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + policy.create, # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_raw_response_wrapper( - policy.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + policy.delete, # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_raw_response_wrapper( - policy.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + policy.get, # pyright: ignore[reportDeprecated], + ) ) @@ -319,14 +363,20 @@ class PolicyResourceWithStreamingResponse: def __init__(self, policy: PolicyResource) -> None: self._policy = policy - self.create = to_streamed_response_wrapper( - policy.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + policy.create, # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_streamed_response_wrapper( - policy.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + policy.delete, # pyright: ignore[reportDeprecated], + ) ) - self.get = to_streamed_response_wrapper( - policy.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + policy.get, # pyright: ignore[reportDeprecated], + ) ) @@ -334,12 +384,18 @@ class AsyncPolicyResourceWithStreamingResponse: def __init__(self, policy: AsyncPolicyResource) -> None: self._policy = policy - self.create = async_to_streamed_response_wrapper( - policy.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + policy.create, # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_streamed_response_wrapper( - policy.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + policy.delete, # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_streamed_response_wrapper( - policy.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + policy.get, # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index 616afdb8..2b317f6f 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -2,6 +2,8 @@ from __future__ import annotations +import typing_extensions + import httpx from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given @@ -41,6 +43,7 @@ def with_streaming_response(self) -> CredentialsResourceWithStreamingResponse: """ return CredentialsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def recreate( self, storage_id: int, @@ -61,6 +64,11 @@ def recreate( Generates new access credentials for the storage (S3 keys for S3 storage, SFTP password for SFTP storage). + Deprecated: Use POST + /provisioning/v3/storages/`s3_compatible`/{`storage_id`}/credentials/reset for + S3 storage or PATCH /provisioning/v3/storages/sftp/{`storage_id`}/credentials + for SFTP storage instead. + Args: extra_headers: Send extra headers @@ -109,6 +117,7 @@ def with_streaming_response(self) -> AsyncCredentialsResourceWithStreamingRespon """ return AsyncCredentialsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def recreate( self, storage_id: int, @@ -129,6 +138,11 @@ async def recreate( Generates new access credentials for the storage (S3 keys for S3 storage, SFTP password for SFTP storage). + Deprecated: Use POST + /provisioning/v3/storages/`s3_compatible`/{`storage_id`}/credentials/reset for + S3 storage or PATCH /provisioning/v3/storages/sftp/{`storage_id`}/credentials + for SFTP storage instead. + Args: extra_headers: Send extra headers @@ -161,8 +175,10 @@ class CredentialsResourceWithRawResponse: def __init__(self, credentials: CredentialsResource) -> None: self._credentials = credentials - self.recreate = to_raw_response_wrapper( - credentials.recreate, + self.recreate = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + credentials.recreate, # pyright: ignore[reportDeprecated], + ) ) @@ -170,8 +186,10 @@ class AsyncCredentialsResourceWithRawResponse: def __init__(self, credentials: AsyncCredentialsResource) -> None: self._credentials = credentials - self.recreate = async_to_raw_response_wrapper( - credentials.recreate, + self.recreate = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + credentials.recreate, # pyright: ignore[reportDeprecated], + ) ) @@ -179,8 +197,10 @@ class CredentialsResourceWithStreamingResponse: def __init__(self, credentials: CredentialsResource) -> None: self._credentials = credentials - self.recreate = to_streamed_response_wrapper( - credentials.recreate, + self.recreate = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + credentials.recreate, # pyright: ignore[reportDeprecated], + ) ) @@ -188,6 +208,8 @@ class AsyncCredentialsResourceWithStreamingResponse: def __init__(self, credentials: AsyncCredentialsResource) -> None: self._credentials = credentials - self.recreate = async_to_streamed_response_wrapper( - credentials.recreate, + self.recreate = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + credentials.recreate, # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/gcore/resources/storage/locations.py b/src/gcore/resources/storage/locations.py index bce1aa37..10cee722 100644 --- a/src/gcore/resources/storage/locations.py +++ b/src/gcore/resources/storage/locations.py @@ -2,6 +2,8 @@ from __future__ import annotations +import typing_extensions + import httpx from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given @@ -42,6 +44,7 @@ def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: """ return LocationsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def list( self, *, @@ -57,7 +60,8 @@ def list( """Returns available storage locations where you can create storages. Each location - represents a geographic region with specific data center facilities. + represents a geographic region with specific data center facilities. Deprecated, + use GET /provisioning/v3/locations instead. Args: extra_headers: Send extra headers @@ -108,6 +112,7 @@ def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse """ return AsyncLocationsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def list( self, *, @@ -123,7 +128,8 @@ def list( """Returns available storage locations where you can create storages. Each location - represents a geographic region with specific data center facilities. + represents a geographic region with specific data center facilities. Deprecated, + use GET /provisioning/v3/locations instead. Args: extra_headers: Send extra headers @@ -158,8 +164,10 @@ class LocationsResourceWithRawResponse: def __init__(self, locations: LocationsResource) -> None: self._locations = locations - self.list = to_raw_response_wrapper( - locations.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + locations.list, # pyright: ignore[reportDeprecated], + ) ) @@ -167,8 +175,10 @@ class AsyncLocationsResourceWithRawResponse: def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations - self.list = async_to_raw_response_wrapper( - locations.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + locations.list, # pyright: ignore[reportDeprecated], + ) ) @@ -176,8 +186,10 @@ class LocationsResourceWithStreamingResponse: def __init__(self, locations: LocationsResource) -> None: self._locations = locations - self.list = to_streamed_response_wrapper( - locations.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + locations.list, # pyright: ignore[reportDeprecated], + ) ) @@ -185,6 +197,8 @@ class AsyncLocationsResourceWithStreamingResponse: def __init__(self, locations: AsyncLocationsResource) -> None: self._locations = locations - self.list = async_to_streamed_response_wrapper( - locations.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + locations.list, # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index afc3922f..41b6edb5 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing_extensions import Literal import httpx @@ -92,12 +93,13 @@ def with_streaming_response(self) -> StorageResourceWithStreamingResponse: """ return StorageResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def create( self, *, location: str, name: str, - type: Literal["sftp", "s3"], + type: Literal["sftp", "s3_compatible"], generate_sftp_password: bool | Omit = omit, sftp_password: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -111,6 +113,9 @@ def create( Creates a new storage instance (S3 or SFTP) in the specified location and returns the storage details including credentials. + Deprecated: Use POST /provisioning/v3/storages/`s3_compatible` for S3 storage or + POST /provisioning/v3/storages/sftp for SFTP storage instead. + Args: location: Geographic location where the storage will be provisioned. Each location represents a specific data center region. @@ -118,8 +123,8 @@ def create( name: Unique storage name identifier. Must contain only letters, numbers, dashes, and underscores. Cannot be empty and must be less than 256 characters. - type: Storage protocol type. Choose 's3' for S3-compatible object storage with API - access, or `sftp` for SFTP file transfer protocol. + type: Storage protocol type. Choose 's3_compatible' for S3-compatible object storage + with API access, or `sftp` for SFTP file transfer protocol. generate_sftp_password: Automatically generate a secure password for SFTP storage access. Only applicable when type is `sftp`. When `true`, a random password will be generated @@ -155,6 +160,7 @@ def create( cast_to=Storage, ) + @typing_extensions.deprecated("deprecated") def update( self, storage_id: int, @@ -173,6 +179,9 @@ def update( Used for SFTP storages. + Deprecated: Use PATCH /provisioning/v3/storages/sftp/{`storage_id`} for SFTP + storage updates instead. + Args: expires: Duration when the storage should expire in format like "1 years 6 months 2 weeks 3 days 5 hours 10 minutes 15 seconds". Set empty to remove expiration. @@ -214,7 +223,7 @@ def list( order_direction: Literal["asc", "desc"] | Omit = omit, show_deleted: bool | Omit = omit, status: Literal["active", "suspended", "deleted", "pending"] | Omit = omit, - type: Literal["s3", "sftp"] | Omit = omit, + type: Literal["s3_compatible", "sftp"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -286,6 +295,7 @@ def list( model=Storage, ) + @typing_extensions.deprecated("deprecated") def delete( self, storage_id: int, @@ -301,6 +311,9 @@ def delete( This action cannot be undone. + Deprecated: Use DELETE /provisioning/v3/storages/`s3_compatible`/{`storage_id`} + or DELETE /provisioning/v3/storages/sftp/{`storage_id`} instead. + Args: extra_headers: Send extra headers @@ -351,6 +364,7 @@ def get( cast_to=Storage, ) + @typing_extensions.deprecated("deprecated") def link_ssh_key( self, key_id: int, @@ -368,6 +382,11 @@ def link_ssh_key( authentication. Only works with SFTP storage types - not applicable to S3-compatible storage. + Deprecated: Use PATCH /provisioning/v3/storages/sftp/{`storage_id`} with + `ssh_key_ids` array or PATCH + /provisioning/v3/storages/sftp/{`storage_id`}/credentials with `ssh_key_ids` + array instead. + Args: extra_headers: Send extra headers @@ -424,6 +443,7 @@ def restore( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") def unlink_ssh_key( self, key_id: int, @@ -441,6 +461,11 @@ def unlink_ssh_key( authentication for that key. The key itself remains available for other storages. + Deprecated: Use PATCH /provisioning/v3/storages/sftp/{`storage_id`} with + `ssh_key_ids` array or PATCH + /provisioning/v3/storages/sftp/{`storage_id`}/credentials with `ssh_key_ids` + array instead. + Args: extra_headers: Send extra headers @@ -496,12 +521,13 @@ def with_streaming_response(self) -> AsyncStorageResourceWithStreamingResponse: """ return AsyncStorageResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def create( self, *, location: str, name: str, - type: Literal["sftp", "s3"], + type: Literal["sftp", "s3_compatible"], generate_sftp_password: bool | Omit = omit, sftp_password: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -515,6 +541,9 @@ async def create( Creates a new storage instance (S3 or SFTP) in the specified location and returns the storage details including credentials. + Deprecated: Use POST /provisioning/v3/storages/`s3_compatible` for S3 storage or + POST /provisioning/v3/storages/sftp for SFTP storage instead. + Args: location: Geographic location where the storage will be provisioned. Each location represents a specific data center region. @@ -522,8 +551,8 @@ async def create( name: Unique storage name identifier. Must contain only letters, numbers, dashes, and underscores. Cannot be empty and must be less than 256 characters. - type: Storage protocol type. Choose 's3' for S3-compatible object storage with API - access, or `sftp` for SFTP file transfer protocol. + type: Storage protocol type. Choose 's3_compatible' for S3-compatible object storage + with API access, or `sftp` for SFTP file transfer protocol. generate_sftp_password: Automatically generate a secure password for SFTP storage access. Only applicable when type is `sftp`. When `true`, a random password will be generated @@ -559,6 +588,7 @@ async def create( cast_to=Storage, ) + @typing_extensions.deprecated("deprecated") async def update( self, storage_id: int, @@ -577,6 +607,9 @@ async def update( Used for SFTP storages. + Deprecated: Use PATCH /provisioning/v3/storages/sftp/{`storage_id`} for SFTP + storage updates instead. + Args: expires: Duration when the storage should expire in format like "1 years 6 months 2 weeks 3 days 5 hours 10 minutes 15 seconds". Set empty to remove expiration. @@ -618,7 +651,7 @@ def list( order_direction: Literal["asc", "desc"] | Omit = omit, show_deleted: bool | Omit = omit, status: Literal["active", "suspended", "deleted", "pending"] | Omit = omit, - type: Literal["s3", "sftp"] | Omit = omit, + type: Literal["s3_compatible", "sftp"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -690,6 +723,7 @@ def list( model=Storage, ) + @typing_extensions.deprecated("deprecated") async def delete( self, storage_id: int, @@ -705,6 +739,9 @@ async def delete( This action cannot be undone. + Deprecated: Use DELETE /provisioning/v3/storages/`s3_compatible`/{`storage_id`} + or DELETE /provisioning/v3/storages/sftp/{`storage_id`} instead. + Args: extra_headers: Send extra headers @@ -755,6 +792,7 @@ async def get( cast_to=Storage, ) + @typing_extensions.deprecated("deprecated") async def link_ssh_key( self, key_id: int, @@ -772,6 +810,11 @@ async def link_ssh_key( authentication. Only works with SFTP storage types - not applicable to S3-compatible storage. + Deprecated: Use PATCH /provisioning/v3/storages/sftp/{`storage_id`} with + `ssh_key_ids` array or PATCH + /provisioning/v3/storages/sftp/{`storage_id`}/credentials with `ssh_key_ids` + array instead. + Args: extra_headers: Send extra headers @@ -830,6 +873,7 @@ async def restore( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") async def unlink_ssh_key( self, key_id: int, @@ -847,6 +891,11 @@ async def unlink_ssh_key( authentication for that key. The key itself remains available for other storages. + Deprecated: Use PATCH /provisioning/v3/storages/sftp/{`storage_id`} with + `ssh_key_ids` array or PATCH + /provisioning/v3/storages/sftp/{`storage_id`}/credentials with `ssh_key_ids` + array instead. + Args: extra_headers: Send extra headers @@ -870,29 +919,39 @@ class StorageResourceWithRawResponse: def __init__(self, storage: StorageResource) -> None: self._storage = storage - self.create = to_raw_response_wrapper( - storage.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + storage.create, # pyright: ignore[reportDeprecated], + ) ) - self.update = to_raw_response_wrapper( - storage.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + storage.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_raw_response_wrapper( storage.list, ) - self.delete = to_raw_response_wrapper( - storage.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + storage.delete, # pyright: ignore[reportDeprecated], + ) ) self.get = to_raw_response_wrapper( storage.get, ) - self.link_ssh_key = to_raw_response_wrapper( - storage.link_ssh_key, + self.link_ssh_key = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + storage.link_ssh_key, # pyright: ignore[reportDeprecated], + ) ) self.restore = to_raw_response_wrapper( storage.restore, ) - self.unlink_ssh_key = to_raw_response_wrapper( - storage.unlink_ssh_key, + self.unlink_ssh_key = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + storage.unlink_ssh_key, # pyright: ignore[reportDeprecated], + ) ) @cached_property @@ -916,29 +975,39 @@ class AsyncStorageResourceWithRawResponse: def __init__(self, storage: AsyncStorageResource) -> None: self._storage = storage - self.create = async_to_raw_response_wrapper( - storage.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + storage.create, # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_raw_response_wrapper( - storage.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + storage.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_raw_response_wrapper( storage.list, ) - self.delete = async_to_raw_response_wrapper( - storage.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + storage.delete, # pyright: ignore[reportDeprecated], + ) ) self.get = async_to_raw_response_wrapper( storage.get, ) - self.link_ssh_key = async_to_raw_response_wrapper( - storage.link_ssh_key, + self.link_ssh_key = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + storage.link_ssh_key, # pyright: ignore[reportDeprecated], + ) ) self.restore = async_to_raw_response_wrapper( storage.restore, ) - self.unlink_ssh_key = async_to_raw_response_wrapper( - storage.unlink_ssh_key, + self.unlink_ssh_key = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + storage.unlink_ssh_key, # pyright: ignore[reportDeprecated], + ) ) @cached_property @@ -962,29 +1031,39 @@ class StorageResourceWithStreamingResponse: def __init__(self, storage: StorageResource) -> None: self._storage = storage - self.create = to_streamed_response_wrapper( - storage.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + storage.create, # pyright: ignore[reportDeprecated], + ) ) - self.update = to_streamed_response_wrapper( - storage.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + storage.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_streamed_response_wrapper( storage.list, ) - self.delete = to_streamed_response_wrapper( - storage.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + storage.delete, # pyright: ignore[reportDeprecated], + ) ) self.get = to_streamed_response_wrapper( storage.get, ) - self.link_ssh_key = to_streamed_response_wrapper( - storage.link_ssh_key, + self.link_ssh_key = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + storage.link_ssh_key, # pyright: ignore[reportDeprecated], + ) ) self.restore = to_streamed_response_wrapper( storage.restore, ) - self.unlink_ssh_key = to_streamed_response_wrapper( - storage.unlink_ssh_key, + self.unlink_ssh_key = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + storage.unlink_ssh_key, # pyright: ignore[reportDeprecated], + ) ) @cached_property @@ -1008,29 +1087,39 @@ class AsyncStorageResourceWithStreamingResponse: def __init__(self, storage: AsyncStorageResource) -> None: self._storage = storage - self.create = async_to_streamed_response_wrapper( - storage.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + storage.create, # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_streamed_response_wrapper( - storage.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + storage.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_streamed_response_wrapper( storage.list, ) - self.delete = async_to_streamed_response_wrapper( - storage.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + storage.delete, # pyright: ignore[reportDeprecated], + ) ) self.get = async_to_streamed_response_wrapper( storage.get, ) - self.link_ssh_key = async_to_streamed_response_wrapper( - storage.link_ssh_key, + self.link_ssh_key = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + storage.link_ssh_key, # pyright: ignore[reportDeprecated], + ) ) self.restore = async_to_streamed_response_wrapper( storage.restore, ) - self.unlink_ssh_key = async_to_streamed_response_wrapper( - storage.unlink_ssh_key, + self.unlink_ssh_key = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + storage.unlink_ssh_key, # pyright: ignore[reportDeprecated], + ) ) @cached_property diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index 08280551..6a0d6aa9 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -87,7 +87,7 @@ class ServerCreateParams(TypedDict, total=False): [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). """ - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index 5dca72de..dc69d0d0 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Iterable +from typing import Dict, Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ @@ -37,7 +37,7 @@ class CreateStandardFileShareSerializer(TypedDict, total=False): access: Iterable[CreateStandardFileShareSerializerAccess] """Access Rules""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -94,7 +94,7 @@ class CreateVastFileShareSerializer(TypedDict, total=False): share_settings: CreateVastFileShareSerializerShareSettings """Configuration settings for the share""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/floating_ip_create_params.py b/src/gcore/types/cloud/floating_ip_create_params.py index ee28a9e9..48cddda9 100644 --- a/src/gcore/types/cloud/floating_ip_create_params.py +++ b/src/gcore/types/cloud/floating_ip_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import TypedDict __all__ = ["FloatingIPCreateParams"] @@ -27,7 +27,7 @@ class FloatingIPCreateParams(TypedDict, total=False): If provided, the floating IP will be immediately attached to the specified port. """ - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling 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 d2b5284b..ed821b5d 100644 --- a/src/gcore/types/cloud/gpu_baremetal/cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/cluster_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Iterable +from typing import Dict, Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ @@ -42,7 +42,7 @@ class ClusterCreateParams(TypedDict, total=False): servers_settings: Required[ServersSettings] """Configuration settings for the servers in the cluster""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/gpu_baremetal/clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_baremetal/clusters/image_upload_params.py index 269dfd76..4cae77be 100644 --- a/src/gcore/types/cloud/gpu_baremetal/clusters/image_upload_params.py +++ b/src/gcore/types/cloud/gpu_baremetal/clusters/image_upload_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ImageUploadParams"] @@ -45,7 +45,7 @@ class ImageUploadParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Permission to use a ssh key in instances""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling 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 a6b6e0b1..762e4879 100644 --- a/src/gcore/types/cloud/gpu_virtual/cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_create_params.py @@ -42,7 +42,7 @@ class ClusterCreateParams(TypedDict, total=False): servers_settings: Required[ServersSettings] """Configuration settings for the servers in the cluster""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/gpu_virtual/clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_virtual/clusters/image_upload_params.py index 269dfd76..4cae77be 100644 --- a/src/gcore/types/cloud/gpu_virtual/clusters/image_upload_params.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/image_upload_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ImageUploadParams"] @@ -45,7 +45,7 @@ class ImageUploadParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Permission to use a ssh key in instances""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index bed6de52..ee1ba080 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -114,7 +114,7 @@ class InstanceCreateParams(TypedDict, total=False): [/v1/`ssh_keys` endpoint](/docs/api-reference/cloud/ssh-keys/add-or-generate-ssh-key). """ - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -398,7 +398,7 @@ class VolumeCreateInstanceCreateNewVolumeSerializer(TypedDict, total=False): If not specified, a name will be generated automatically. """ - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -459,7 +459,7 @@ class VolumeCreateInstanceCreateVolumeFromImageSerializer(TypedDict, total=False - For basic VMs: the size is set automatically based on the flavor. """ - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -513,7 +513,7 @@ class VolumeCreateInstanceCreateVolumeFromSnapshotSerializer(TypedDict, total=Fa If not specified, a name will be generated automatically. """ - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -559,7 +559,7 @@ class VolumeCreateInstanceCreateVolumeFromApptemplateSerializer(TypedDict, total size: int """Volume size in GiB.""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling @@ -604,7 +604,7 @@ class VolumeCreateInstanceExistingVolumeSerializer(TypedDict, total=False): delete_on_termination: bool """Set to `true` to automatically delete the volume when the instance is deleted.""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instances/image_create_from_volume_params.py b/src/gcore/types/cloud/instances/image_create_from_volume_params.py index 52928edb..d98e34ae 100644 --- a/src/gcore/types/cloud/instances/image_create_from_volume_params.py +++ b/src/gcore/types/cloud/instances/image_create_from_volume_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ImageCreateFromVolumeParams"] @@ -40,7 +40,7 @@ class ImageCreateFromVolumeParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Whether the image supports SSH key or not""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/instances/image_upload_params.py b/src/gcore/types/cloud/instances/image_upload_params.py index a10d83fe..4085ea54 100644 --- a/src/gcore/types/cloud/instances/image_upload_params.py +++ b/src/gcore/types/cloud/instances/image_upload_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ImageUploadParams"] @@ -49,7 +49,7 @@ class ImageUploadParams(TypedDict, total=False): ssh_key: Literal["allow", "deny", "required"] """Whether the image supports SSH key or not""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index db1d053d..8d56613c 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr @@ -71,7 +71,7 @@ class LoadBalancerCreateParams(TypedDict, total=False): specification. """ - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/network_create_params.py b/src/gcore/types/cloud/network_create_params.py index 935f9bc0..b4cb5e77 100644 --- a/src/gcore/types/cloud/network_create_params.py +++ b/src/gcore/types/cloud/network_create_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Dict from typing_extensions import Literal, Required, TypedDict __all__ = ["NetworkCreateParams"] @@ -20,7 +21,7 @@ class NetworkCreateParams(TypedDict, total=False): create_router: bool """Defaults to True""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/networks/subnet_create_params.py b/src/gcore/types/cloud/networks/subnet_create_params.py index 41274927..5a6b365f 100644 --- a/src/gcore/types/cloud/networks/subnet_create_params.py +++ b/src/gcore/types/cloud/networks/subnet_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Required, TypedDict from ...._types import SequenceNotStr @@ -60,7 +60,7 @@ class SubnetCreateParams(TypedDict, total=False): find a router created during network creation. """ - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/security_group_create_params.py b/src/gcore/types/cloud/security_group_create_params.py index d4904c5d..e660dee3 100644 --- a/src/gcore/types/cloud/security_group_create_params.py +++ b/src/gcore/types/cloud/security_group_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["SecurityGroupCreateParams", "Rule"] @@ -24,7 +24,7 @@ class SecurityGroupCreateParams(TypedDict, total=False): rules: Iterable[Rule] """Security group rules""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/cloud/tag.py b/src/gcore/types/cloud/tag.py index 9ee9fdba..56ac9aa0 100644 --- a/src/gcore/types/cloud/tag.py +++ b/src/gcore/types/cloud/tag.py @@ -14,18 +14,10 @@ class Tag(BaseModel): """ key: str - """Tag key. - - Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or - '=' character. - """ + """Tag key. The maximum size for a key is 255 characters.""" read_only: bool """If true, the tag is read-only and cannot be modified by the user""" value: str - """Tag value. - - Maximum 255 characters. Cannot contain spaces, tabs, newlines, empty string or - '=' character. - """ + """Tag value. The maximum size for a value is 255 characters.""" diff --git a/src/gcore/types/cloud/tag_update_map_param.py b/src/gcore/types/cloud/tag_update_map_param.py index 9a70575e..6726649c 100644 --- a/src/gcore/types/cloud/tag_update_map_param.py +++ b/src/gcore/types/cloud/tag_update_map_param.py @@ -2,8 +2,9 @@ from __future__ import annotations +from typing import Dict, Optional from typing_extensions import TypeAlias __all__ = ["TagUpdateMapParam"] -TagUpdateMapParam: TypeAlias = object +TagUpdateMapParam: TypeAlias = Dict[str, Optional[str]] diff --git a/src/gcore/types/cloud/volume_snapshot_create_params.py b/src/gcore/types/cloud/volume_snapshot_create_params.py index 8d77c011..b832806b 100644 --- a/src/gcore/types/cloud/volume_snapshot_create_params.py +++ b/src/gcore/types/cloud/volume_snapshot_create_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Dict from typing_extensions import Required, TypedDict __all__ = ["VolumeSnapshotCreateParams"] @@ -21,7 +22,7 @@ class VolumeSnapshotCreateParams(TypedDict, total=False): description: str """Snapshot description""" - tags: object + tags: Dict[str, str] """Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling diff --git a/src/gcore/types/storage/location.py b/src/gcore/types/storage/location.py index 5fff1680..3cd9cf45 100644 --- a/src/gcore/types/storage/location.py +++ b/src/gcore/types/storage/location.py @@ -22,5 +22,5 @@ class Location(BaseModel): title: str """Human-readable title for the location""" - type: Literal["s3", "sftp"] + type: Literal["s3_compatible", "sftp"] """Storage protocol type supported in this location""" diff --git a/src/gcore/types/storage/storage.py b/src/gcore/types/storage/storage.py index 126b5a7d..f158afa8 100644 --- a/src/gcore/types/storage/storage.py +++ b/src/gcore/types/storage/storage.py @@ -65,7 +65,7 @@ class Storage(BaseModel): reseller_id: int """Reseller technical client ID associated with the client""" - type: Literal["sftp", "s3"] + type: Literal["sftp", "s3_compatible"] """ Storage protocol type - either S3-compatible object storage or SFTP file transfer diff --git a/src/gcore/types/storage/storage_create_params.py b/src/gcore/types/storage/storage_create_params.py index e5582029..348df44c 100644 --- a/src/gcore/types/storage/storage_create_params.py +++ b/src/gcore/types/storage/storage_create_params.py @@ -21,11 +21,11 @@ class StorageCreateParams(TypedDict, total=False): must be less than 256 characters. """ - type: Required[Literal["sftp", "s3"]] + type: Required[Literal["sftp", "s3_compatible"]] """Storage protocol type. - Choose 's3' for S3-compatible object storage with API access, or `sftp` for SFTP - file transfer protocol. + Choose 's3_compatible' for S3-compatible object storage with API access, or + `sftp` for SFTP file transfer protocol. """ generate_sftp_password: bool diff --git a/src/gcore/types/storage/storage_list_params.py b/src/gcore/types/storage/storage_list_params.py index 830c81c9..5028a2e4 100644 --- a/src/gcore/types/storage/storage_list_params.py +++ b/src/gcore/types/storage/storage_list_params.py @@ -35,5 +35,5 @@ class StorageListParams(TypedDict, total=False): status: Literal["active", "suspended", "deleted", "pending"] """Filter by storage status""" - type: Literal["s3", "sftp"] + type: Literal["s3_compatible", "sftp"] """Filter by storage type""" diff --git a/tests/api_resources/cloud/gpu_baremetal/test_clusters.py b/tests/api_resources/cloud/gpu_baremetal/test_clusters.py index 3a47eba9..cd68c18a 100644 --- a/tests/api_resources/cloud/gpu_baremetal/test_clusters.py +++ b/tests/api_resources/cloud/gpu_baremetal/test_clusters.py @@ -217,7 +217,7 @@ def test_method_action(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, cluster, path=["response"]) @@ -228,7 +228,7 @@ def test_raw_response_action(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) assert response.is_closed is True @@ -243,7 +243,7 @@ def test_streaming_response_action(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -261,7 +261,7 @@ def test_path_params_action(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) @parametrize @@ -715,7 +715,7 @@ async def test_method_action(self, async_client: AsyncGcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, cluster, path=["response"]) @@ -726,7 +726,7 @@ async def test_raw_response_action(self, async_client: AsyncGcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) assert response.is_closed is True @@ -741,7 +741,7 @@ async def test_streaming_response_action(self, async_client: AsyncGcore) -> None project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -759,7 +759,7 @@ async def test_path_params_action(self, async_client: AsyncGcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) @parametrize diff --git a/tests/api_resources/cloud/gpu_virtual/test_clusters.py b/tests/api_resources/cloud/gpu_virtual/test_clusters.py index 0487f803..91d2ae2d 100644 --- a/tests/api_resources/cloud/gpu_virtual/test_clusters.py +++ b/tests/api_resources/cloud/gpu_virtual/test_clusters.py @@ -507,7 +507,7 @@ def test_method_action_overload_5(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, cluster, path=["response"]) @@ -518,7 +518,7 @@ def test_raw_response_action_overload_5(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) assert response.is_closed is True @@ -533,7 +533,7 @@ def test_streaming_response_action_overload_5(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -551,7 +551,7 @@ def test_path_params_action_overload_5(self, client: Gcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) @parametrize @@ -1146,7 +1146,7 @@ async def test_method_action_overload_5(self, async_client: AsyncGcore) -> None: project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, cluster, path=["response"]) @@ -1157,7 +1157,7 @@ async def test_raw_response_action_overload_5(self, async_client: AsyncGcore) -> project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) assert response.is_closed is True @@ -1172,7 +1172,7 @@ async def test_streaming_response_action_overload_5(self, async_client: AsyncGco project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1190,7 +1190,7 @@ async def test_path_params_action_overload_5(self, async_client: AsyncGcore) -> project_id=1, region_id=7, action="update_tags", - tags={}, + tags={"foo": "my-tag-value"}, ) @parametrize diff --git a/tests/api_resources/cloud/instances/test_images.py b/tests/api_resources/cloud/instances/test_images.py index b97decb0..c30fde90 100644 --- a/tests/api_resources/cloud/instances/test_images.py +++ b/tests/api_resources/cloud/instances/test_images.py @@ -38,7 +38,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: name="my-image", os_type="linux", ssh_key="allow", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Image, image, path=["response"]) @@ -373,7 +373,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> name="my-image", os_type="linux", ssh_key="allow", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Image, image, path=["response"]) diff --git a/tests/api_resources/cloud/networks/test_subnets.py b/tests/api_resources/cloud/networks/test_subnets.py index dc315c0a..8ba4ff6f 100644 --- a/tests/api_resources/cloud/networks/test_subnets.py +++ b/tests/api_resources/cloud/networks/test_subnets.py @@ -110,7 +110,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: } ], name="some_name", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Subnet, subnet, path=["response"]) @@ -389,7 +389,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> } ], name="some_name", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Subnet, subnet, path=["response"]) diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index 74d9a584..055e05d6 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -174,7 +174,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "path_length": "LCD", "root_squash": True, }, - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, file_share, path=["response"]) @@ -562,7 +562,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "path_length": "LCD", "root_squash": True, }, - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, file_share, path=["response"]) diff --git a/tests/api_resources/cloud/test_floating_ips.py b/tests/api_resources/cloud/test_floating_ips.py index fda155b2..97ff5795 100644 --- a/tests/api_resources/cloud/test_floating_ips.py +++ b/tests/api_resources/cloud/test_floating_ips.py @@ -86,7 +86,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: region_id=1, fixed_ip_address="192.168.10.15", port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) @@ -453,7 +453,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> region_id=1, fixed_ip_address="192.168.10.15", port_id="ee2402d0-f0cd-4503-9b75-69be1d11c5f1", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, floating_ip, path=["response"]) diff --git a/tests/api_resources/cloud/test_instances.py b/tests/api_resources/cloud/test_instances.py index d5c24486..7b908015 100644 --- a/tests/api_resources/cloud/test_instances.py +++ b/tests/api_resources/cloud/test_instances.py @@ -137,7 +137,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: project_id=0, region_id=0, name="instance_name", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Instance, instance, path=["response"]) @@ -1007,7 +1007,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> project_id=0, region_id=0, name="instance_name", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Instance, instance, path=["response"]) diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index 75c7a421..5b30c022 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -185,7 +185,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: }, name="some_name", preferred_connectivity="L2", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @@ -659,7 +659,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> }, name="some_name", preferred_connectivity="L2", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) diff --git a/tests/api_resources/cloud/test_networks.py b/tests/api_resources/cloud/test_networks.py index 273791bd..dbd1f4d0 100644 --- a/tests/api_resources/cloud/test_networks.py +++ b/tests/api_resources/cloud/test_networks.py @@ -86,7 +86,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, name="some_name", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Network, network, path=["response"]) @@ -338,7 +338,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> project_id=1, region_id=1, name="some_name", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Network, network, path=["response"]) diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index 6050ff4c..2bd9402b 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -110,7 +110,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "remote_ip_prefix": "10.0.0.0/8", } ], - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, security_group, path=["response"]) @@ -481,7 +481,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "remote_ip_prefix": "10.0.0.0/8", } ], - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(TaskIDList, security_group, path=["response"]) diff --git a/tests/api_resources/cloud/test_volume_snapshots.py b/tests/api_resources/cloud/test_volume_snapshots.py index f4da5ed7..4b2d7bfd 100644 --- a/tests/api_resources/cloud/test_volume_snapshots.py +++ b/tests/api_resources/cloud/test_volume_snapshots.py @@ -88,7 +88,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, name="my-backup-snapshot", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Snapshot, volume_snapshot, path=["response"]) @@ -295,7 +295,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> project_id=1, region_id=1, name="my-backup-snapshot", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Snapshot, volume_snapshot, path=["response"]) diff --git a/tests/api_resources/cloud/test_volumes.py b/tests/api_resources/cloud/test_volumes.py index 67bd0e60..95d43b9f 100644 --- a/tests/api_resources/cloud/test_volumes.py +++ b/tests/api_resources/cloud/test_volumes.py @@ -45,7 +45,7 @@ def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - tags={}, + tags={"foo": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -107,7 +107,7 @@ def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], size=10, - tags={}, + tags={"foo": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -166,7 +166,7 @@ def test_method_create_with_all_params_overload_3(self, client: Gcore) -> None: attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - tags={}, + tags={"foo": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -219,7 +219,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, name="some_name", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Volume, volume, path=["response"]) @@ -701,7 +701,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - tags={}, + tags={"foo": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -763,7 +763,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], size=10, - tags={}, + tags={"foo": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -822,7 +822,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn attachment_tag="device-tag", instance_id_to_attach_to="88f3e0bd-ca86-4cf7-be8b-dd2988e23c2d", lifecycle_policy_ids=[1, 2], - tags={}, + tags={"foo": "my-tag-value"}, type_name="standard", ) assert_matches_type(TaskIDList, volume, path=["response"]) @@ -875,7 +875,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> project_id=1, region_id=1, name="some_name", - tags={}, + tags={"foo": "my-tag-value"}, ) assert_matches_type(Volume, volume, path=["response"]) diff --git a/tests/api_resources/storage/buckets/test_cors.py b/tests/api_resources/storage/buckets/test_cors.py index d9bc87a6..acf58e4d 100644 --- a/tests/api_resources/storage/buckets/test_cors.py +++ b/tests/api_resources/storage/buckets/test_cors.py @@ -11,6 +11,8 @@ from tests.utils import assert_matches_type from gcore.types.storage.buckets import BucketCors +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,27 +21,32 @@ class TestCors: @parametrize def test_method_create(self, client: Gcore) -> None: - cor = client.storage.buckets.cors.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + cor = client.storage.buckets.cors.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert cor is None @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - cor = client.storage.buckets.cors.create( - bucket_name="bucket_name", - storage_id=0, - allowed_origins=["https://example.com", "https://app.example.com", "*"], - ) + with pytest.warns(DeprecationWarning): + cor = client.storage.buckets.cors.create( + bucket_name="bucket_name", + storage_id=0, + allowed_origins=["https://example.com", "https://app.example.com", "*"], + ) + assert cor is None @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.storage.buckets.cors.with_raw_response.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.buckets.cors.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -48,40 +55,45 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.storage.buckets.cors.with_streaming_response.create( - bucket_name="bucket_name", - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.buckets.cors.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cor = response.parse() - assert cor is None + cor = response.parse() + assert cor is None assert cast(Any, response.is_closed) is True @parametrize def test_path_params_create(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - client.storage.buckets.cors.with_raw_response.create( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.cors.with_raw_response.create( + bucket_name="", + storage_id=0, + ) @parametrize def test_method_get(self, client: Gcore) -> None: - cor = client.storage.buckets.cors.get( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + cor = client.storage.buckets.cors.get( + bucket_name="bucket_name", + storage_id=0, + ) + assert_matches_type(BucketCors, cor, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.storage.buckets.cors.with_raw_response.get( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.buckets.cors.with_raw_response.get( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -90,25 +102,27 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.storage.buckets.cors.with_streaming_response.get( - bucket_name="bucket_name", - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.buckets.cors.with_streaming_response.get( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cor = response.parse() - assert_matches_type(BucketCors, cor, path=["response"]) + cor = response.parse() + assert_matches_type(BucketCors, cor, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - client.storage.buckets.cors.with_raw_response.get( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.cors.with_raw_response.get( + bucket_name="", + storage_id=0, + ) class TestAsyncCors: @@ -118,27 +132,32 @@ class TestAsyncCors: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - cor = await async_client.storage.buckets.cors.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + cor = await async_client.storage.buckets.cors.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert cor is None @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - cor = await async_client.storage.buckets.cors.create( - bucket_name="bucket_name", - storage_id=0, - allowed_origins=["https://example.com", "https://app.example.com", "*"], - ) + with pytest.warns(DeprecationWarning): + cor = await async_client.storage.buckets.cors.create( + bucket_name="bucket_name", + storage_id=0, + allowed_origins=["https://example.com", "https://app.example.com", "*"], + ) + assert cor is None @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.buckets.cors.with_raw_response.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.buckets.cors.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -147,40 +166,45 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.storage.buckets.cors.with_streaming_response.create( - bucket_name="bucket_name", - storage_id=0, - ) 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.storage.buckets.cors.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cor = await response.parse() - assert cor is None + cor = await response.parse() + assert cor is None assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_create(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - await async_client.storage.buckets.cors.with_raw_response.create( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.cors.with_raw_response.create( + bucket_name="", + storage_id=0, + ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - cor = await async_client.storage.buckets.cors.get( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + cor = await async_client.storage.buckets.cors.get( + bucket_name="bucket_name", + storage_id=0, + ) + assert_matches_type(BucketCors, cor, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.buckets.cors.with_raw_response.get( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.buckets.cors.with_raw_response.get( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -189,22 +213,24 @@ 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.storage.buckets.cors.with_streaming_response.get( - bucket_name="bucket_name", - storage_id=0, - ) 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.storage.buckets.cors.with_streaming_response.get( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cor = await response.parse() - assert_matches_type(BucketCors, cor, path=["response"]) + cor = await response.parse() + assert_matches_type(BucketCors, cor, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - await async_client.storage.buckets.cors.with_raw_response.get( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.cors.with_raw_response.get( + bucket_name="", + storage_id=0, + ) diff --git a/tests/api_resources/storage/buckets/test_lifecycle.py b/tests/api_resources/storage/buckets/test_lifecycle.py index 52e01c12..41747114 100644 --- a/tests/api_resources/storage/buckets/test_lifecycle.py +++ b/tests/api_resources/storage/buckets/test_lifecycle.py @@ -9,6 +9,8 @@ from gcore import Gcore, AsyncGcore +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -17,27 +19,32 @@ class TestLifecycle: @parametrize def test_method_create(self, client: Gcore) -> None: - lifecycle = client.storage.buckets.lifecycle.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + lifecycle = client.storage.buckets.lifecycle.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert lifecycle is None @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - lifecycle = client.storage.buckets.lifecycle.create( - bucket_name="bucket_name", - storage_id=0, - expiration_days=30, - ) + with pytest.warns(DeprecationWarning): + lifecycle = client.storage.buckets.lifecycle.create( + bucket_name="bucket_name", + storage_id=0, + expiration_days=30, + ) + assert lifecycle is None @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.storage.buckets.lifecycle.with_raw_response.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.buckets.lifecycle.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -46,40 +53,45 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.storage.buckets.lifecycle.with_streaming_response.create( - bucket_name="bucket_name", - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.buckets.lifecycle.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - lifecycle = response.parse() - assert lifecycle is None + lifecycle = response.parse() + assert lifecycle is None assert cast(Any, response.is_closed) is True @parametrize def test_path_params_create(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - client.storage.buckets.lifecycle.with_raw_response.create( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.lifecycle.with_raw_response.create( + bucket_name="", + storage_id=0, + ) @parametrize def test_method_delete(self, client: Gcore) -> None: - lifecycle = client.storage.buckets.lifecycle.delete( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + lifecycle = client.storage.buckets.lifecycle.delete( + bucket_name="bucket_name", + storage_id=0, + ) + assert lifecycle is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.storage.buckets.lifecycle.with_raw_response.delete( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.buckets.lifecycle.with_raw_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -88,25 +100,27 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.storage.buckets.lifecycle.with_streaming_response.delete( - bucket_name="bucket_name", - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.buckets.lifecycle.with_streaming_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - lifecycle = response.parse() - assert lifecycle is None + lifecycle = response.parse() + assert lifecycle is None assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - client.storage.buckets.lifecycle.with_raw_response.delete( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.lifecycle.with_raw_response.delete( + bucket_name="", + storage_id=0, + ) class TestAsyncLifecycle: @@ -116,27 +130,32 @@ class TestAsyncLifecycle: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - lifecycle = await async_client.storage.buckets.lifecycle.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + lifecycle = await async_client.storage.buckets.lifecycle.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert lifecycle is None @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - lifecycle = await async_client.storage.buckets.lifecycle.create( - bucket_name="bucket_name", - storage_id=0, - expiration_days=30, - ) + with pytest.warns(DeprecationWarning): + lifecycle = await async_client.storage.buckets.lifecycle.create( + bucket_name="bucket_name", + storage_id=0, + expiration_days=30, + ) + assert lifecycle is None @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.buckets.lifecycle.with_raw_response.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.buckets.lifecycle.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -145,40 +164,45 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.storage.buckets.lifecycle.with_streaming_response.create( - bucket_name="bucket_name", - storage_id=0, - ) 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.storage.buckets.lifecycle.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - lifecycle = await response.parse() - assert lifecycle is None + lifecycle = await response.parse() + assert lifecycle is None assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_create(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - await async_client.storage.buckets.lifecycle.with_raw_response.create( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.lifecycle.with_raw_response.create( + bucket_name="", + storage_id=0, + ) @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - lifecycle = await async_client.storage.buckets.lifecycle.delete( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + lifecycle = await async_client.storage.buckets.lifecycle.delete( + bucket_name="bucket_name", + storage_id=0, + ) + assert lifecycle is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.buckets.lifecycle.with_raw_response.delete( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.buckets.lifecycle.with_raw_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -187,22 +211,24 @@ 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.storage.buckets.lifecycle.with_streaming_response.delete( - bucket_name="bucket_name", - storage_id=0, - ) 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.storage.buckets.lifecycle.with_streaming_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - lifecycle = await response.parse() - assert lifecycle is None + lifecycle = await response.parse() + assert lifecycle is None assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - await async_client.storage.buckets.lifecycle.with_raw_response.delete( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.lifecycle.with_raw_response.delete( + bucket_name="", + storage_id=0, + ) diff --git a/tests/api_resources/storage/buckets/test_policy.py b/tests/api_resources/storage/buckets/test_policy.py index fd0a5c06..c95a5f68 100644 --- a/tests/api_resources/storage/buckets/test_policy.py +++ b/tests/api_resources/storage/buckets/test_policy.py @@ -11,6 +11,8 @@ from tests.utils import assert_matches_type from gcore.types.storage.buckets import PolicyGetResponse +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,18 +21,21 @@ class TestPolicy: @parametrize def test_method_create(self, client: Gcore) -> None: - policy = client.storage.buckets.policy.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + policy = client.storage.buckets.policy.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert policy is None @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.storage.buckets.policy.with_raw_response.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.buckets.policy.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -39,40 +44,45 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.storage.buckets.policy.with_streaming_response.create( - bucket_name="bucket_name", - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.buckets.policy.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = response.parse() - assert policy is None + policy = response.parse() + assert policy is None assert cast(Any, response.is_closed) is True @parametrize def test_path_params_create(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - client.storage.buckets.policy.with_raw_response.create( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.policy.with_raw_response.create( + bucket_name="", + storage_id=0, + ) @parametrize def test_method_delete(self, client: Gcore) -> None: - policy = client.storage.buckets.policy.delete( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + policy = client.storage.buckets.policy.delete( + bucket_name="bucket_name", + storage_id=0, + ) + assert policy is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.storage.buckets.policy.with_raw_response.delete( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.buckets.policy.with_raw_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -81,40 +91,45 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.storage.buckets.policy.with_streaming_response.delete( - bucket_name="bucket_name", - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.buckets.policy.with_streaming_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = response.parse() - assert policy is None + policy = response.parse() + assert policy is None assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - client.storage.buckets.policy.with_raw_response.delete( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.policy.with_raw_response.delete( + bucket_name="", + storage_id=0, + ) @parametrize def test_method_get(self, client: Gcore) -> None: - policy = client.storage.buckets.policy.get( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + policy = client.storage.buckets.policy.get( + bucket_name="bucket_name", + storage_id=0, + ) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.storage.buckets.policy.with_raw_response.get( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.buckets.policy.with_raw_response.get( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -123,25 +138,27 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.storage.buckets.policy.with_streaming_response.get( - bucket_name="bucket_name", - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.buckets.policy.with_streaming_response.get( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = response.parse() - assert_matches_type(PolicyGetResponse, policy, path=["response"]) + policy = response.parse() + assert_matches_type(PolicyGetResponse, policy, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - client.storage.buckets.policy.with_raw_response.get( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.policy.with_raw_response.get( + bucket_name="", + storage_id=0, + ) class TestAsyncPolicy: @@ -151,18 +168,21 @@ class TestAsyncPolicy: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - policy = await async_client.storage.buckets.policy.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + policy = await async_client.storage.buckets.policy.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert policy is None @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.buckets.policy.with_raw_response.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.buckets.policy.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -171,40 +191,45 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.storage.buckets.policy.with_streaming_response.create( - bucket_name="bucket_name", - storage_id=0, - ) 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.storage.buckets.policy.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = await response.parse() - assert policy is None + policy = await response.parse() + assert policy is None assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_create(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - await async_client.storage.buckets.policy.with_raw_response.create( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.policy.with_raw_response.create( + bucket_name="", + storage_id=0, + ) @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - policy = await async_client.storage.buckets.policy.delete( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + policy = await async_client.storage.buckets.policy.delete( + bucket_name="bucket_name", + storage_id=0, + ) + assert policy is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.buckets.policy.with_raw_response.delete( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.buckets.policy.with_raw_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -213,40 +238,45 @@ 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.storage.buckets.policy.with_streaming_response.delete( - bucket_name="bucket_name", - storage_id=0, - ) 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.storage.buckets.policy.with_streaming_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = await response.parse() - assert policy is None + policy = await response.parse() + assert policy is None assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - await async_client.storage.buckets.policy.with_raw_response.delete( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.policy.with_raw_response.delete( + bucket_name="", + storage_id=0, + ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - policy = await async_client.storage.buckets.policy.get( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + policy = await async_client.storage.buckets.policy.get( + bucket_name="bucket_name", + storage_id=0, + ) + assert_matches_type(PolicyGetResponse, policy, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.buckets.policy.with_raw_response.get( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.buckets.policy.with_raw_response.get( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -255,22 +285,24 @@ 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.storage.buckets.policy.with_streaming_response.get( - bucket_name="bucket_name", - storage_id=0, - ) 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.storage.buckets.policy.with_streaming_response.get( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - policy = await response.parse() - assert_matches_type(PolicyGetResponse, policy, path=["response"]) + policy = await response.parse() + assert_matches_type(PolicyGetResponse, policy, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - await async_client.storage.buckets.policy.with_raw_response.get( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.policy.with_raw_response.get( + bucket_name="", + storage_id=0, + ) diff --git a/tests/api_resources/storage/test_buckets.py b/tests/api_resources/storage/test_buckets.py index eabe5253..2a68140d 100644 --- a/tests/api_resources/storage/test_buckets.py +++ b/tests/api_resources/storage/test_buckets.py @@ -12,6 +12,8 @@ from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.storage import Bucket +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,18 +22,21 @@ class TestBuckets: @parametrize def test_method_create(self, client: Gcore) -> None: - bucket = client.storage.buckets.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + bucket = client.storage.buckets.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert bucket is None @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.storage.buckets.with_raw_response.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.buckets.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -40,47 +45,54 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.storage.buckets.with_streaming_response.create( - bucket_name="bucket_name", - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.buckets.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bucket = response.parse() - assert bucket is None + bucket = response.parse() + assert bucket is None assert cast(Any, response.is_closed) is True @parametrize def test_path_params_create(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - client.storage.buckets.with_raw_response.create( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.with_raw_response.create( + bucket_name="", + storage_id=0, + ) @parametrize def test_method_list(self, client: Gcore) -> None: - bucket = client.storage.buckets.list( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + bucket = client.storage.buckets.list( + storage_id=0, + ) + assert_matches_type(SyncOffsetPage[Bucket], bucket, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - bucket = client.storage.buckets.list( - storage_id=0, - limit=1, - offset=0, - ) + with pytest.warns(DeprecationWarning): + bucket = client.storage.buckets.list( + storage_id=0, + limit=1, + offset=0, + ) + assert_matches_type(SyncOffsetPage[Bucket], bucket, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.storage.buckets.with_raw_response.list( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.buckets.with_raw_response.list( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -89,31 +101,35 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.storage.buckets.with_streaming_response.list( - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.buckets.with_streaming_response.list( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bucket = response.parse() - assert_matches_type(SyncOffsetPage[Bucket], bucket, path=["response"]) + bucket = response.parse() + assert_matches_type(SyncOffsetPage[Bucket], bucket, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: Gcore) -> None: - bucket = client.storage.buckets.delete( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + bucket = client.storage.buckets.delete( + bucket_name="bucket_name", + storage_id=0, + ) + assert bucket is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.storage.buckets.with_raw_response.delete( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.buckets.with_raw_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -122,25 +138,27 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.storage.buckets.with_streaming_response.delete( - bucket_name="bucket_name", - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.buckets.with_streaming_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bucket = response.parse() - assert bucket is None + bucket = response.parse() + assert bucket is None assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - client.storage.buckets.with_raw_response.delete( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + client.storage.buckets.with_raw_response.delete( + bucket_name="", + storage_id=0, + ) class TestAsyncBuckets: @@ -150,18 +168,21 @@ class TestAsyncBuckets: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - bucket = await async_client.storage.buckets.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + bucket = await async_client.storage.buckets.create( + bucket_name="bucket_name", + storage_id=0, + ) + assert bucket is None @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.buckets.with_raw_response.create( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.buckets.with_raw_response.create( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -170,47 +191,54 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.storage.buckets.with_streaming_response.create( - bucket_name="bucket_name", - storage_id=0, - ) 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.storage.buckets.with_streaming_response.create( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bucket = await response.parse() - assert bucket is None + bucket = await response.parse() + assert bucket is None assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_create(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - await async_client.storage.buckets.with_raw_response.create( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.with_raw_response.create( + bucket_name="", + storage_id=0, + ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - bucket = await async_client.storage.buckets.list( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + bucket = await async_client.storage.buckets.list( + storage_id=0, + ) + assert_matches_type(AsyncOffsetPage[Bucket], bucket, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - bucket = await async_client.storage.buckets.list( - storage_id=0, - limit=1, - offset=0, - ) + with pytest.warns(DeprecationWarning): + bucket = await async_client.storage.buckets.list( + storage_id=0, + limit=1, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[Bucket], bucket, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.buckets.with_raw_response.list( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.buckets.with_raw_response.list( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -219,31 +247,35 @@ 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.storage.buckets.with_streaming_response.list( - storage_id=0, - ) 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.storage.buckets.with_streaming_response.list( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bucket = await response.parse() - assert_matches_type(AsyncOffsetPage[Bucket], bucket, path=["response"]) + bucket = await response.parse() + assert_matches_type(AsyncOffsetPage[Bucket], bucket, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - bucket = await async_client.storage.buckets.delete( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + bucket = await async_client.storage.buckets.delete( + bucket_name="bucket_name", + storage_id=0, + ) + assert bucket is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.buckets.with_raw_response.delete( - bucket_name="bucket_name", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.buckets.with_raw_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -252,22 +284,24 @@ 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.storage.buckets.with_streaming_response.delete( - bucket_name="bucket_name", - storage_id=0, - ) 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.storage.buckets.with_streaming_response.delete( + bucket_name="bucket_name", + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bucket = await response.parse() - assert bucket is None + bucket = await response.parse() + assert bucket is None assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): - await async_client.storage.buckets.with_raw_response.delete( - bucket_name="", - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bucket_name` but received ''"): + await async_client.storage.buckets.with_raw_response.delete( + bucket_name="", + storage_id=0, + ) diff --git a/tests/api_resources/storage/test_credentials.py b/tests/api_resources/storage/test_credentials.py index 8f02e9d0..e6737ee5 100644 --- a/tests/api_resources/storage/test_credentials.py +++ b/tests/api_resources/storage/test_credentials.py @@ -11,6 +11,8 @@ from tests.utils import assert_matches_type from gcore.types.storage import Storage +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,28 +21,33 @@ class TestCredentials: @parametrize def test_method_recreate(self, client: Gcore) -> None: - credential = client.storage.credentials.recreate( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + credential = client.storage.credentials.recreate( + storage_id=0, + ) + assert_matches_type(Storage, credential, path=["response"]) @parametrize def test_method_recreate_with_all_params(self, client: Gcore) -> None: - credential = client.storage.credentials.recreate( - storage_id=0, - delete_sftp_password=True, - generate_s3_keys=True, - generate_sftp_password=True, - reset_sftp_keys=True, - sftp_password="sftp_password", - ) + with pytest.warns(DeprecationWarning): + credential = client.storage.credentials.recreate( + storage_id=0, + delete_sftp_password=True, + generate_s3_keys=True, + generate_sftp_password=True, + reset_sftp_keys=True, + sftp_password="sftp_password", + ) + assert_matches_type(Storage, credential, path=["response"]) @parametrize def test_raw_response_recreate(self, client: Gcore) -> None: - response = client.storage.credentials.with_raw_response.recreate( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.credentials.with_raw_response.recreate( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -49,14 +56,15 @@ def test_raw_response_recreate(self, client: Gcore) -> None: @parametrize def test_streaming_response_recreate(self, client: Gcore) -> None: - with client.storage.credentials.with_streaming_response.recreate( - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.credentials.with_streaming_response.recreate( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - credential = response.parse() - assert_matches_type(Storage, credential, path=["response"]) + credential = response.parse() + assert_matches_type(Storage, credential, path=["response"]) assert cast(Any, response.is_closed) is True @@ -68,28 +76,33 @@ class TestAsyncCredentials: @parametrize async def test_method_recreate(self, async_client: AsyncGcore) -> None: - credential = await async_client.storage.credentials.recreate( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + credential = await async_client.storage.credentials.recreate( + storage_id=0, + ) + assert_matches_type(Storage, credential, path=["response"]) @parametrize async def test_method_recreate_with_all_params(self, async_client: AsyncGcore) -> None: - credential = await async_client.storage.credentials.recreate( - storage_id=0, - delete_sftp_password=True, - generate_s3_keys=True, - generate_sftp_password=True, - reset_sftp_keys=True, - sftp_password="sftp_password", - ) + with pytest.warns(DeprecationWarning): + credential = await async_client.storage.credentials.recreate( + storage_id=0, + delete_sftp_password=True, + generate_s3_keys=True, + generate_sftp_password=True, + reset_sftp_keys=True, + sftp_password="sftp_password", + ) + assert_matches_type(Storage, credential, path=["response"]) @parametrize async def test_raw_response_recreate(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.credentials.with_raw_response.recreate( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.credentials.with_raw_response.recreate( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -98,13 +111,14 @@ async def test_raw_response_recreate(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_recreate(self, async_client: AsyncGcore) -> None: - async with async_client.storage.credentials.with_streaming_response.recreate( - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - credential = await response.parse() - assert_matches_type(Storage, credential, path=["response"]) + with pytest.warns(DeprecationWarning): + async with async_client.storage.credentials.with_streaming_response.recreate( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + credential = await response.parse() + assert_matches_type(Storage, credential, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/storage/test_locations.py b/tests/api_resources/storage/test_locations.py index f076ff9b..8c1e2407 100644 --- a/tests/api_resources/storage/test_locations.py +++ b/tests/api_resources/storage/test_locations.py @@ -12,6 +12,8 @@ from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.storage import Location +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,20 +22,25 @@ class TestLocations: @parametrize def test_method_list(self, client: Gcore) -> None: - location = client.storage.locations.list() + with pytest.warns(DeprecationWarning): + location = client.storage.locations.list() + assert_matches_type(SyncOffsetPage[Location], location, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - location = client.storage.locations.list( - limit=1, - offset=0, - ) + with pytest.warns(DeprecationWarning): + location = client.storage.locations.list( + limit=1, + offset=0, + ) + assert_matches_type(SyncOffsetPage[Location], location, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.storage.locations.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = client.storage.locations.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -42,12 +49,13 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.storage.locations.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.locations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - location = response.parse() - assert_matches_type(SyncOffsetPage[Location], location, path=["response"]) + location = response.parse() + assert_matches_type(SyncOffsetPage[Location], location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -59,20 +67,25 @@ class TestAsyncLocations: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - location = await async_client.storage.locations.list() + with pytest.warns(DeprecationWarning): + location = await async_client.storage.locations.list() + assert_matches_type(AsyncOffsetPage[Location], location, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - location = await async_client.storage.locations.list( - limit=1, - offset=0, - ) + with pytest.warns(DeprecationWarning): + location = await async_client.storage.locations.list( + limit=1, + offset=0, + ) + assert_matches_type(AsyncOffsetPage[Location], location, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.locations.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = await async_client.storage.locations.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -81,11 +94,12 @@ 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.storage.locations.with_streaming_response.list() 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.storage.locations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - location = await response.parse() - assert_matches_type(AsyncOffsetPage[Location], location, path=["response"]) + location = await response.parse() + assert_matches_type(AsyncOffsetPage[Location], location, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_storage.py b/tests/api_resources/test_storage.py index 00988587..8261bb66 100644 --- a/tests/api_resources/test_storage.py +++ b/tests/api_resources/test_storage.py @@ -14,6 +14,8 @@ Storage, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,31 +24,36 @@ class TestStorage: @parametrize def test_method_create(self, client: Gcore) -> None: - storage = client.storage.create( - location="s-region-1", - name="my-storage-prod", - type="s3", - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.create( + location="s-region-1", + name="my-storage-prod", + type="s3_compatible", + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - storage = client.storage.create( - location="s-region-1", - name="my-storage-prod", - type="s3", - generate_sftp_password=True, - sftp_password="sftp_password", - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.create( + location="s-region-1", + name="my-storage-prod", + type="s3_compatible", + generate_sftp_password=True, + sftp_password="sftp_password", + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.storage.with_raw_response.create( - location="s-region-1", - name="my-storage-prod", - type="s3", - ) + with pytest.warns(DeprecationWarning): + response = client.storage.with_raw_response.create( + location="s-region-1", + name="my-storage-prod", + type="s3_compatible", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -55,40 +62,46 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.storage.with_streaming_response.create( - location="s-region-1", - name="my-storage-prod", - type="s3", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - storage = response.parse() - assert_matches_type(Storage, storage, path=["response"]) + with pytest.warns(DeprecationWarning): + with client.storage.with_streaming_response.create( + location="s-region-1", + name="my-storage-prod", + type="s3_compatible", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = response.parse() + assert_matches_type(Storage, storage, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_update(self, client: Gcore) -> None: - storage = client.storage.update( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.update( + storage_id=0, + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - storage = client.storage.update( - storage_id=0, - expires="1 years 6 months", - server_alias="my-storage.company.com", - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.update( + storage_id=0, + expires="1 years 6 months", + server_alias="my-storage.company.com", + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.storage.with_raw_response.update( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.with_raw_response.update( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -97,14 +110,15 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.storage.with_streaming_response.update( - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.with_streaming_response.update( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = response.parse() - assert_matches_type(Storage, storage, path=["response"]) + storage = response.parse() + assert_matches_type(Storage, storage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -125,7 +139,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: order_direction="asc", show_deleted=True, status="active", - type="s3", + type="s3_compatible", ) assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) @@ -151,16 +165,19 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: - storage = client.storage.delete( - 0, - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.delete( + 0, + ) + assert storage is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.storage.with_raw_response.delete( - 0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.with_raw_response.delete( + 0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -169,14 +186,15 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.storage.with_streaming_response.delete( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = response.parse() - assert storage is None + storage = response.parse() + assert storage is None assert cast(Any, response.is_closed) is True @@ -213,18 +231,21 @@ def test_streaming_response_get(self, client: Gcore) -> None: @parametrize def test_method_link_ssh_key(self, client: Gcore) -> None: - storage = client.storage.link_ssh_key( - key_id=0, - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.link_ssh_key( + key_id=0, + storage_id=0, + ) + assert storage is None @parametrize def test_raw_response_link_ssh_key(self, client: Gcore) -> None: - response = client.storage.with_raw_response.link_ssh_key( - key_id=0, - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.with_raw_response.link_ssh_key( + key_id=0, + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -233,15 +254,16 @@ def test_raw_response_link_ssh_key(self, client: Gcore) -> None: @parametrize def test_streaming_response_link_ssh_key(self, client: Gcore) -> None: - with client.storage.with_streaming_response.link_ssh_key( - key_id=0, - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.with_streaming_response.link_ssh_key( + key_id=0, + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = response.parse() - assert storage is None + storage = response.parse() + assert storage is None assert cast(Any, response.is_closed) is True @@ -286,18 +308,21 @@ def test_streaming_response_restore(self, client: Gcore) -> None: @parametrize def test_method_unlink_ssh_key(self, client: Gcore) -> None: - storage = client.storage.unlink_ssh_key( - key_id=0, - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.unlink_ssh_key( + key_id=0, + storage_id=0, + ) + assert storage is None @parametrize def test_raw_response_unlink_ssh_key(self, client: Gcore) -> None: - response = client.storage.with_raw_response.unlink_ssh_key( - key_id=0, - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.with_raw_response.unlink_ssh_key( + key_id=0, + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -306,15 +331,16 @@ def test_raw_response_unlink_ssh_key(self, client: Gcore) -> None: @parametrize def test_streaming_response_unlink_ssh_key(self, client: Gcore) -> None: - with client.storage.with_streaming_response.unlink_ssh_key( - key_id=0, - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.with_streaming_response.unlink_ssh_key( + key_id=0, + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = response.parse() - assert storage is None + storage = response.parse() + assert storage is None assert cast(Any, response.is_closed) is True @@ -326,31 +352,36 @@ class TestAsyncStorage: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.create( - location="s-region-1", - name="my-storage-prod", - type="s3", - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.create( + location="s-region-1", + name="my-storage-prod", + type="s3_compatible", + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.create( - location="s-region-1", - name="my-storage-prod", - type="s3", - generate_sftp_password=True, - sftp_password="sftp_password", - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.create( + location="s-region-1", + name="my-storage-prod", + type="s3_compatible", + generate_sftp_password=True, + sftp_password="sftp_password", + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.with_raw_response.create( - location="s-region-1", - name="my-storage-prod", - type="s3", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.with_raw_response.create( + location="s-region-1", + name="my-storage-prod", + type="s3_compatible", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -359,40 +390,46 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.storage.with_streaming_response.create( - location="s-region-1", - name="my-storage-prod", - type="s3", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - storage = await response.parse() - assert_matches_type(Storage, storage, path=["response"]) + with pytest.warns(DeprecationWarning): + async with async_client.storage.with_streaming_response.create( + location="s-region-1", + name="my-storage-prod", + type="s3_compatible", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert_matches_type(Storage, storage, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.update( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.update( + storage_id=0, + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.update( - storage_id=0, - expires="1 years 6 months", - server_alias="my-storage.company.com", - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.update( + storage_id=0, + expires="1 years 6 months", + server_alias="my-storage.company.com", + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.with_raw_response.update( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.with_raw_response.update( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -401,14 +438,15 @@ 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.storage.with_streaming_response.update( - storage_id=0, - ) 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.storage.with_streaming_response.update( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = await response.parse() - assert_matches_type(Storage, storage, path=["response"]) + storage = await response.parse() + assert_matches_type(Storage, storage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -429,7 +467,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No order_direction="asc", show_deleted=True, status="active", - type="s3", + type="s3_compatible", ) assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) @@ -455,16 +493,19 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.delete( - 0, - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.delete( + 0, + ) + assert storage is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.with_raw_response.delete( - 0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.with_raw_response.delete( + 0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -473,14 +514,15 @@ 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.storage.with_streaming_response.delete( - 0, - ) 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.storage.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = await response.parse() - assert storage is None + storage = await response.parse() + assert storage is None assert cast(Any, response.is_closed) is True @@ -517,18 +559,21 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_link_ssh_key(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.link_ssh_key( - key_id=0, - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.link_ssh_key( + key_id=0, + storage_id=0, + ) + assert storage is None @parametrize async def test_raw_response_link_ssh_key(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.with_raw_response.link_ssh_key( - key_id=0, - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.with_raw_response.link_ssh_key( + key_id=0, + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -537,15 +582,16 @@ async def test_raw_response_link_ssh_key(self, async_client: AsyncGcore) -> None @parametrize async def test_streaming_response_link_ssh_key(self, async_client: AsyncGcore) -> None: - async with async_client.storage.with_streaming_response.link_ssh_key( - key_id=0, - storage_id=0, - ) 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.storage.with_streaming_response.link_ssh_key( + key_id=0, + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = await response.parse() - assert storage is None + storage = await response.parse() + assert storage is None assert cast(Any, response.is_closed) is True @@ -590,18 +636,21 @@ async def test_streaming_response_restore(self, async_client: AsyncGcore) -> Non @parametrize async def test_method_unlink_ssh_key(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.unlink_ssh_key( - key_id=0, - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.unlink_ssh_key( + key_id=0, + storage_id=0, + ) + assert storage is None @parametrize async def test_raw_response_unlink_ssh_key(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.with_raw_response.unlink_ssh_key( - key_id=0, - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.with_raw_response.unlink_ssh_key( + key_id=0, + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -610,14 +659,15 @@ async def test_raw_response_unlink_ssh_key(self, async_client: AsyncGcore) -> No @parametrize async def test_streaming_response_unlink_ssh_key(self, async_client: AsyncGcore) -> None: - async with async_client.storage.with_streaming_response.unlink_ssh_key( - key_id=0, - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - storage = await response.parse() - assert storage is None + with pytest.warns(DeprecationWarning): + async with async_client.storage.with_streaming_response.unlink_ssh_key( + key_id=0, + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert storage is None assert cast(Any, response.is_closed) is True From ce4cbf017177bcf84e71f230c10e707e2779b5c1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 12:21:23 +0000 Subject: [PATCH 580/592] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- tests/api_resources/iam/test_api_tokens.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index a290a331..f8b5ee01 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-247700eb0839f11fe995398e8b8160e264107a22a6d8a783628f070ef9888cee.yml -openapi_spec_hash: 05ee580780bc68d0c339faad61915b9b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-691d7fc7d687ca367474bc78eb880f6f964454dc82259cdbb75fb90bd92c67ec.yml +openapi_spec_hash: 97a4cbc8d7b05b1dc58319331717e8e7 config_hash: bc578a7de14c42e33b7d4bd4502218f2 diff --git a/tests/api_resources/iam/test_api_tokens.py b/tests/api_resources/iam/test_api_tokens.py index a524f1db..314e9993 100644 --- a/tests/api_resources/iam/test_api_tokens.py +++ b/tests/api_resources/iam/test_api_tokens.py @@ -22,7 +22,7 @@ def test_method_create(self, client: Gcore) -> None: api_token = client.iam.api_tokens.create( client_id=0, client_user={}, - exp_date="2021-01-01 12:00:00+00:00", + exp_date="2021-01-01T12:00:00.000000Z", name="My token", ) assert_matches_type(APITokenCreated, api_token, path=["response"]) @@ -37,7 +37,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "name": "Administrators", } }, - exp_date="2021-01-01 12:00:00+00:00", + exp_date="2021-01-01T12:00:00.000000Z", name="My token", description="It's my token", ) @@ -48,7 +48,7 @@ def test_raw_response_create(self, client: Gcore) -> None: response = client.iam.api_tokens.with_raw_response.create( client_id=0, client_user={}, - exp_date="2021-01-01 12:00:00+00:00", + exp_date="2021-01-01T12:00:00.000000Z", name="My token", ) @@ -62,7 +62,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: with client.iam.api_tokens.with_streaming_response.create( client_id=0, client_user={}, - exp_date="2021-01-01 12:00:00+00:00", + exp_date="2021-01-01T12:00:00.000000Z", name="My token", ) as response: assert not response.is_closed @@ -194,7 +194,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: api_token = await async_client.iam.api_tokens.create( client_id=0, client_user={}, - exp_date="2021-01-01 12:00:00+00:00", + exp_date="2021-01-01T12:00:00.000000Z", name="My token", ) assert_matches_type(APITokenCreated, api_token, path=["response"]) @@ -209,7 +209,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "name": "Administrators", } }, - exp_date="2021-01-01 12:00:00+00:00", + exp_date="2021-01-01T12:00:00.000000Z", name="My token", description="It's my token", ) @@ -220,7 +220,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.iam.api_tokens.with_raw_response.create( client_id=0, client_user={}, - exp_date="2021-01-01 12:00:00+00:00", + exp_date="2021-01-01T12:00:00.000000Z", name="My token", ) @@ -234,7 +234,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None async with async_client.iam.api_tokens.with_streaming_response.create( client_id=0, client_user={}, - exp_date="2021-01-01 12:00:00+00:00", + exp_date="2021-01-01T12:00:00.000000Z", name="My token", ) as response: assert not response.is_closed From 3a14fd8d37e136a4f122e5042fa635daa6734f91 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:54:00 +0000 Subject: [PATCH 581/592] refactor(cdn)!: move ip_ranges.list_ips to ips.list --- .stats.yml | 2 +- src/gcore/resources/cdn/__init__.py | 14 ++ src/gcore/resources/cdn/api.md | 15 +- src/gcore/resources/cdn/cdn.py | 32 +++ src/gcore/resources/cdn/ip_ranges.py | 115 +--------- src/gcore/resources/cdn/ips.py | 201 ++++++++++++++++++ src/gcore/types/cdn/__init__.py | 2 +- ...e_list_ips_params.py => ip_list_params.py} | 4 +- tests/api_resources/cdn/test_ip_ranges.py | 68 +----- tests/api_resources/cdn/test_ips.py | 90 ++++++++ 10 files changed, 356 insertions(+), 187 deletions(-) create mode 100644 src/gcore/resources/cdn/ips.py rename src/gcore/types/cdn/{ip_range_list_ips_params.py => ip_list_params.py} (84%) create mode 100644 tests/api_resources/cdn/test_ips.py diff --git a/.stats.yml b/.stats.yml index f8b5ee01..d13fc721 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-691d7fc7d687ca367474bc78eb880f6f964454dc82259cdbb75fb90bd92c67ec.yml openapi_spec_hash: 97a4cbc8d7b05b1dc58319331717e8e7 -config_hash: bc578a7de14c42e33b7d4bd4502218f2 +config_hash: e29bc1c2ddc012af347f59f3ff70a81c diff --git a/src/gcore/resources/cdn/__init__.py b/src/gcore/resources/cdn/__init__.py index 869fc050..4347554b 100644 --- a/src/gcore/resources/cdn/__init__.py +++ b/src/gcore/resources/cdn/__init__.py @@ -8,6 +8,14 @@ CDNResourceWithStreamingResponse, AsyncCDNResourceWithStreamingResponse, ) +from .ips import ( + IPsResource, + AsyncIPsResource, + IPsResourceWithRawResponse, + AsyncIPsResourceWithRawResponse, + IPsResourceWithStreamingResponse, + AsyncIPsResourceWithStreamingResponse, +) from .logs import ( LogsResource, AsyncLogsResource, @@ -192,6 +200,12 @@ "AsyncIPRangesResourceWithRawResponse", "IPRangesResourceWithStreamingResponse", "AsyncIPRangesResourceWithStreamingResponse", + "IPsResource", + "AsyncIPsResource", + "IPsResourceWithRawResponse", + "AsyncIPsResourceWithRawResponse", + "IPsResourceWithStreamingResponse", + "AsyncIPsResourceWithStreamingResponse", "CDNResource", "AsyncCDNResource", "CDNResourceWithRawResponse", diff --git a/src/gcore/resources/cdn/api.md b/src/gcore/resources/cdn/api.md index 70919175..56e75645 100644 --- a/src/gcore/resources/cdn/api.md +++ b/src/gcore/resources/cdn/api.md @@ -299,10 +299,21 @@ Methods: Types: ```python -from gcore.types.cdn import PublicIPList, PublicNetworkList +from gcore.types.cdn import PublicNetworkList ``` Methods: - client.cdn.ip_ranges.list(\*\*params) -> PublicNetworkList -- client.cdn.ip_ranges.list_ips(\*\*params) -> PublicIPList + +## IPs + +Types: + +```python +from gcore.types.cdn import PublicIPList +``` + +Methods: + +- client.cdn.ips.list(\*\*params) -> PublicIPList diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py index 771c3776..892b17b5 100644 --- a/src/gcore/resources/cdn/cdn.py +++ b/src/gcore/resources/cdn/cdn.py @@ -4,6 +4,14 @@ import httpx +from .ips import ( + IPsResource, + AsyncIPsResource, + IPsResourceWithRawResponse, + AsyncIPsResourceWithRawResponse, + IPsResourceWithStreamingResponse, + AsyncIPsResourceWithStreamingResponse, +) from .logs import ( LogsResource, AsyncLogsResource, @@ -183,6 +191,10 @@ def metrics(self) -> MetricsResource: def ip_ranges(self) -> IPRangesResource: return IPRangesResource(self._client) + @cached_property + def ips(self) -> IPsResource: + return IPsResource(self._client) + @cached_property def with_raw_response(self) -> CDNResourceWithRawResponse: """ @@ -484,6 +496,10 @@ def metrics(self) -> AsyncMetricsResource: def ip_ranges(self) -> AsyncIPRangesResource: return AsyncIPRangesResource(self._client) + @cached_property + def ips(self) -> AsyncIPsResource: + return AsyncIPsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCDNResourceWithRawResponse: """ @@ -810,6 +826,10 @@ def metrics(self) -> MetricsResourceWithRawResponse: def ip_ranges(self) -> IPRangesResourceWithRawResponse: return IPRangesResourceWithRawResponse(self._cdn.ip_ranges) + @cached_property + def ips(self) -> IPsResourceWithRawResponse: + return IPsResourceWithRawResponse(self._cdn.ips) + class AsyncCDNResourceWithRawResponse: def __init__(self, cdn: AsyncCDNResource) -> None: @@ -889,6 +909,10 @@ def metrics(self) -> AsyncMetricsResourceWithRawResponse: def ip_ranges(self) -> AsyncIPRangesResourceWithRawResponse: return AsyncIPRangesResourceWithRawResponse(self._cdn.ip_ranges) + @cached_property + def ips(self) -> AsyncIPsResourceWithRawResponse: + return AsyncIPsResourceWithRawResponse(self._cdn.ips) + class CDNResourceWithStreamingResponse: def __init__(self, cdn: CDNResource) -> None: @@ -968,6 +992,10 @@ def metrics(self) -> MetricsResourceWithStreamingResponse: def ip_ranges(self) -> IPRangesResourceWithStreamingResponse: return IPRangesResourceWithStreamingResponse(self._cdn.ip_ranges) + @cached_property + def ips(self) -> IPsResourceWithStreamingResponse: + return IPsResourceWithStreamingResponse(self._cdn.ips) + class AsyncCDNResourceWithStreamingResponse: def __init__(self, cdn: AsyncCDNResource) -> None: @@ -1046,3 +1074,7 @@ def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: @cached_property def ip_ranges(self) -> AsyncIPRangesResourceWithStreamingResponse: return AsyncIPRangesResourceWithStreamingResponse(self._cdn.ip_ranges) + + @cached_property + def ips(self) -> AsyncIPsResourceWithStreamingResponse: + return AsyncIPsResourceWithStreamingResponse(self._cdn.ips) diff --git a/src/gcore/resources/cdn/ip_ranges.py b/src/gcore/resources/cdn/ip_ranges.py index ee39f4a9..7f001ef6 100644 --- a/src/gcore/resources/cdn/ip_ranges.py +++ b/src/gcore/resources/cdn/ip_ranges.py @@ -16,9 +16,8 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...types.cdn import ip_range_list_params, ip_range_list_ips_params +from ...types.cdn import ip_range_list_params from ..._base_client import make_request_options -from ...types.cdn.public_ip_list import PublicIPList from ...types.cdn.public_network_list import PublicNetworkList __all__ = ["IPRangesResource", "AsyncIPRangesResource"] @@ -93,56 +92,6 @@ def list( cast_to=PublicNetworkList, ) - def list_ips( - self, - *, - format: Literal["json", "plain"] | Omit = omit, - accept: Literal["application/json", "text/plain"] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PublicIPList: - """ - Get all IP addresses of CDN servers that can be used to pull content from your - origin. - - This list is updated periodically. If you want to use IP from this list to - configure IP ACL in your origin, you need to independently monitor its - relevance. We recommend using a script to automatically update IP ACL. - - This request does not require authorization. - - Args: - format: Optional format override. When set, this takes precedence over the `Accept` - header. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = { - **strip_not_given({"Accept": str(accept) if is_given(accept) else not_given}), - **(extra_headers or {}), - } - return self._get( - "/cdn/public-ip-list", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"format": format}, ip_range_list_ips_params.IPRangeListIPsParams), - ), - cast_to=PublicIPList, - ) - class AsyncIPRangesResource(AsyncAPIResource): @cached_property @@ -213,56 +162,6 @@ async def list( cast_to=PublicNetworkList, ) - async def list_ips( - self, - *, - format: Literal["json", "plain"] | Omit = omit, - accept: Literal["application/json", "text/plain"] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PublicIPList: - """ - Get all IP addresses of CDN servers that can be used to pull content from your - origin. - - This list is updated periodically. If you want to use IP from this list to - configure IP ACL in your origin, you need to independently monitor its - relevance. We recommend using a script to automatically update IP ACL. - - This request does not require authorization. - - Args: - format: Optional format override. When set, this takes precedence over the `Accept` - header. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = { - **strip_not_given({"Accept": str(accept) if is_given(accept) else not_given}), - **(extra_headers or {}), - } - return await self._get( - "/cdn/public-ip-list", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"format": format}, ip_range_list_ips_params.IPRangeListIPsParams), - ), - cast_to=PublicIPList, - ) - class IPRangesResourceWithRawResponse: def __init__(self, ip_ranges: IPRangesResource) -> None: @@ -271,9 +170,6 @@ def __init__(self, ip_ranges: IPRangesResource) -> None: self.list = to_raw_response_wrapper( ip_ranges.list, ) - self.list_ips = to_raw_response_wrapper( - ip_ranges.list_ips, - ) class AsyncIPRangesResourceWithRawResponse: @@ -283,9 +179,6 @@ def __init__(self, ip_ranges: AsyncIPRangesResource) -> None: self.list = async_to_raw_response_wrapper( ip_ranges.list, ) - self.list_ips = async_to_raw_response_wrapper( - ip_ranges.list_ips, - ) class IPRangesResourceWithStreamingResponse: @@ -295,9 +188,6 @@ def __init__(self, ip_ranges: IPRangesResource) -> None: self.list = to_streamed_response_wrapper( ip_ranges.list, ) - self.list_ips = to_streamed_response_wrapper( - ip_ranges.list_ips, - ) class AsyncIPRangesResourceWithStreamingResponse: @@ -307,6 +197,3 @@ def __init__(self, ip_ranges: AsyncIPRangesResource) -> None: self.list = async_to_streamed_response_wrapper( ip_ranges.list, ) - self.list_ips = async_to_streamed_response_wrapper( - ip_ranges.list_ips, - ) diff --git a/src/gcore/resources/cdn/ips.py b/src/gcore/resources/cdn/ips.py new file mode 100644 index 00000000..5574a7bb --- /dev/null +++ b/src/gcore/resources/cdn/ips.py @@ -0,0 +1,201 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import is_given, maybe_transform, strip_not_given, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import ip_list_params +from ..._base_client import make_request_options +from ...types.cdn.public_ip_list import PublicIPList + +__all__ = ["IPsResource", "AsyncIPsResource"] + + +class IPsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> IPsResourceWithRawResponse: + """ + 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 IPsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> IPsResourceWithStreamingResponse: + """ + 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 IPsResourceWithStreamingResponse(self) + + def list( + self, + *, + format: Literal["json", "plain"] | Omit = omit, + accept: Literal["application/json", "text/plain"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PublicIPList: + """ + Get all IP addresses of CDN servers that can be used to pull content from your + origin. + + This list is updated periodically. If you want to use IP from this list to + configure IP ACL in your origin, you need to independently monitor its + relevance. We recommend using a script to automatically update IP ACL. + + This request does not require authorization. + + Args: + format: Optional format override. When set, this takes precedence over the `Accept` + header. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = { + **strip_not_given({"Accept": str(accept) if is_given(accept) else not_given}), + **(extra_headers or {}), + } + return self._get( + "/cdn/public-ip-list", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"format": format}, ip_list_params.IPListParams), + ), + cast_to=PublicIPList, + ) + + +class AsyncIPsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncIPsResourceWithRawResponse: + """ + 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 AsyncIPsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncIPsResourceWithStreamingResponse: + """ + 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 AsyncIPsResourceWithStreamingResponse(self) + + async def list( + self, + *, + format: Literal["json", "plain"] | Omit = omit, + accept: Literal["application/json", "text/plain"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> PublicIPList: + """ + Get all IP addresses of CDN servers that can be used to pull content from your + origin. + + This list is updated periodically. If you want to use IP from this list to + configure IP ACL in your origin, you need to independently monitor its + relevance. We recommend using a script to automatically update IP ACL. + + This request does not require authorization. + + Args: + format: Optional format override. When set, this takes precedence over the `Accept` + header. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = { + **strip_not_given({"Accept": str(accept) if is_given(accept) else not_given}), + **(extra_headers or {}), + } + return await self._get( + "/cdn/public-ip-list", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"format": format}, ip_list_params.IPListParams), + ), + cast_to=PublicIPList, + ) + + +class IPsResourceWithRawResponse: + def __init__(self, ips: IPsResource) -> None: + self._ips = ips + + self.list = to_raw_response_wrapper( + ips.list, + ) + + +class AsyncIPsResourceWithRawResponse: + def __init__(self, ips: AsyncIPsResource) -> None: + self._ips = ips + + self.list = async_to_raw_response_wrapper( + ips.list, + ) + + +class IPsResourceWithStreamingResponse: + def __init__(self, ips: IPsResource) -> None: + self._ips = ips + + self.list = to_streamed_response_wrapper( + ips.list, + ) + + +class AsyncIPsResourceWithStreamingResponse: + def __init__(self, ips: AsyncIPsResource) -> None: + self._ips = ips + + self.list = async_to_streamed_response_wrapper( + ips.list, + ) diff --git a/src/gcore/types/cdn/__init__.py b/src/gcore/types/cdn/__init__.py index 92895e33..5b706659 100644 --- a/src/gcore/types/cdn/__init__.py +++ b/src/gcore/types/cdn/__init__.py @@ -12,6 +12,7 @@ from .origin_groups import OriginGroups as OriginGroups from .rule_template import RuleTemplate as RuleTemplate from .ca_certificate import CaCertificate as CaCertificate +from .ip_list_params import IPListParams as IPListParams from .public_ip_list import PublicIPList as PublicIPList from .alibaba_regions import AlibabaRegions as AlibabaRegions from .log_list_params import LogListParams as LogListParams @@ -39,7 +40,6 @@ from .certificate_list_params import CertificateListParams as CertificateListParams from .shield_aggregated_stats import ShieldAggregatedStats as ShieldAggregatedStats from .cdn_resource_list_params import CDNResourceListParams as CDNResourceListParams -from .ip_range_list_ips_params import IPRangeListIPsParams as IPRangeListIPsParams from .logs_uploader_validation import LogsUploaderValidation as LogsUploaderValidation from .origin_group_list_params import OriginGroupListParams as OriginGroupListParams from .cdn_resource_purge_params import CDNResourcePurgeParams as CDNResourcePurgeParams diff --git a/src/gcore/types/cdn/ip_range_list_ips_params.py b/src/gcore/types/cdn/ip_list_params.py similarity index 84% rename from src/gcore/types/cdn/ip_range_list_ips_params.py rename to src/gcore/types/cdn/ip_list_params.py index f10f642c..88fac54e 100644 --- a/src/gcore/types/cdn/ip_range_list_ips_params.py +++ b/src/gcore/types/cdn/ip_list_params.py @@ -6,10 +6,10 @@ from ..._utils import PropertyInfo -__all__ = ["IPRangeListIPsParams"] +__all__ = ["IPListParams"] -class IPRangeListIPsParams(TypedDict, total=False): +class IPListParams(TypedDict, total=False): format: Literal["json", "plain"] """ Optional format override. When set, this takes precedence over the `Accept` diff --git a/tests/api_resources/cdn/test_ip_ranges.py b/tests/api_resources/cdn/test_ip_ranges.py index b4967cd6..e801f362 100644 --- a/tests/api_resources/cdn/test_ip_ranges.py +++ b/tests/api_resources/cdn/test_ip_ranges.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cdn import PublicIPList, PublicNetworkList +from gcore.types.cdn import PublicNetworkList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -50,39 +50,6 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_list_ips(self, client: Gcore) -> None: - ip_range = client.cdn.ip_ranges.list_ips() - assert_matches_type(PublicIPList, ip_range, path=["response"]) - - @parametrize - def test_method_list_ips_with_all_params(self, client: Gcore) -> None: - ip_range = client.cdn.ip_ranges.list_ips( - format="json", - accept="application/json", - ) - assert_matches_type(PublicIPList, ip_range, path=["response"]) - - @parametrize - def test_raw_response_list_ips(self, client: Gcore) -> None: - response = client.cdn.ip_ranges.with_raw_response.list_ips() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ip_range = response.parse() - assert_matches_type(PublicIPList, ip_range, path=["response"]) - - @parametrize - def test_streaming_response_list_ips(self, client: Gcore) -> None: - with client.cdn.ip_ranges.with_streaming_response.list_ips() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ip_range = response.parse() - assert_matches_type(PublicIPList, ip_range, path=["response"]) - - assert cast(Any, response.is_closed) is True - class TestAsyncIPRanges: parametrize = pytest.mark.parametrize( @@ -121,36 +88,3 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert_matches_type(PublicNetworkList, ip_range, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_list_ips(self, async_client: AsyncGcore) -> None: - ip_range = await async_client.cdn.ip_ranges.list_ips() - assert_matches_type(PublicIPList, ip_range, path=["response"]) - - @parametrize - async def test_method_list_ips_with_all_params(self, async_client: AsyncGcore) -> None: - ip_range = await async_client.cdn.ip_ranges.list_ips( - format="json", - accept="application/json", - ) - assert_matches_type(PublicIPList, ip_range, path=["response"]) - - @parametrize - async def test_raw_response_list_ips(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.ip_ranges.with_raw_response.list_ips() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ip_range = await response.parse() - assert_matches_type(PublicIPList, ip_range, path=["response"]) - - @parametrize - async def test_streaming_response_list_ips(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.ip_ranges.with_streaming_response.list_ips() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - ip_range = await response.parse() - assert_matches_type(PublicIPList, ip_range, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_ips.py b/tests/api_resources/cdn/test_ips.py new file mode 100644 index 00000000..c94c2ac8 --- /dev/null +++ b/tests/api_resources/cdn/test_ips.py @@ -0,0 +1,90 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import PublicIPList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestIPs: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + ip = client.cdn.ips.list() + assert_matches_type(PublicIPList, ip, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + ip = client.cdn.ips.list( + format="json", + accept="application/json", + ) + assert_matches_type(PublicIPList, ip, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.ips.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip = response.parse() + assert_matches_type(PublicIPList, ip, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.ips.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip = response.parse() + assert_matches_type(PublicIPList, ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncIPs: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + ip = await async_client.cdn.ips.list() + assert_matches_type(PublicIPList, ip, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + ip = await async_client.cdn.ips.list( + format="json", + accept="application/json", + ) + assert_matches_type(PublicIPList, ip, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.ips.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip = await response.parse() + assert_matches_type(PublicIPList, ip, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.ips.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip = await response.parse() + assert_matches_type(PublicIPList, ip, path=["response"]) + + assert cast(Any, response.is_closed) is True From 48e424dfea9b80f14661c6c514ddca6cac3a7aa7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:55:17 +0000 Subject: [PATCH 582/592] refactor(streaming)!: move playlists.list_videos to playlists.videos.list --- .stats.yml | 2 +- src/gcore/resources/streaming/api.md | 30 ++-- .../resources/streaming/playlists/__init__.py | 33 ++++ .../streaming/{ => playlists}/playlists.py | 127 +++++--------- .../resources/streaming/playlists/videos.py | 159 ++++++++++++++++++ src/gcore/resources/streaming/streaming.py | 16 +- src/gcore/types/streaming/__init__.py | 1 - .../types/streaming/playlists/__init__.py | 5 + .../video_list_response.py} | 6 +- .../streaming/playlists/__init__.py | 1 + .../streaming/playlists/test_videos.py | 86 ++++++++++ .../api_resources/streaming/test_playlists.py | 63 ------- 12 files changed, 356 insertions(+), 173 deletions(-) create mode 100644 src/gcore/resources/streaming/playlists/__init__.py rename src/gcore/resources/streaming/{ => playlists}/playlists.py (92%) create mode 100644 src/gcore/resources/streaming/playlists/videos.py create mode 100644 src/gcore/types/streaming/playlists/__init__.py rename src/gcore/types/streaming/{playlist_list_videos_response.py => playlists/video_list_response.py} (51%) create mode 100644 tests/api_resources/streaming/playlists/__init__.py create mode 100644 tests/api_resources/streaming/playlists/test_videos.py diff --git a/.stats.yml b/.stats.yml index d13fc721..5fcfa385 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-691d7fc7d687ca367474bc78eb880f6f964454dc82259cdbb75fb90bd92c67ec.yml openapi_spec_hash: 97a4cbc8d7b05b1dc58319331717e8e7 -config_hash: e29bc1c2ddc012af347f59f3ff70a81c +config_hash: 3e264ee16128fcb92256ca2b068decbb diff --git a/src/gcore/resources/streaming/api.md b/src/gcore/resources/streaming/api.md index 1e868475..a16cba9a 100644 --- a/src/gcore/resources/streaming/api.md +++ b/src/gcore/resources/streaming/api.md @@ -106,22 +106,28 @@ Methods: Types: ```python -from gcore.types.streaming import ( - Playlist, - PlaylistCreated, - PlaylistVideo, - PlaylistListVideosResponse, -) +from gcore.types.streaming import Playlist, PlaylistCreated, PlaylistVideo +``` + +Methods: + +- client.streaming.playlists.create(\*\*params) -> PlaylistCreated +- client.streaming.playlists.update(playlist_id, \*\*params) -> Playlist +- client.streaming.playlists.list(\*\*params) -> SyncPageStreaming[Playlist] +- client.streaming.playlists.delete(playlist_id) -> None +- client.streaming.playlists.get(playlist_id) -> Playlist + +### Videos + +Types: + +```python +from gcore.types.streaming.playlists import VideoListResponse ``` Methods: -- client.streaming.playlists.create(\*\*params) -> PlaylistCreated -- client.streaming.playlists.update(playlist_id, \*\*params) -> Playlist -- client.streaming.playlists.list(\*\*params) -> SyncPageStreaming[Playlist] -- client.streaming.playlists.delete(playlist_id) -> None -- client.streaming.playlists.get(playlist_id) -> Playlist -- client.streaming.playlists.list_videos(playlist_id) -> PlaylistListVideosResponse +- client.streaming.playlists.videos.list(playlist_id) -> VideoListResponse ## Videos diff --git a/src/gcore/resources/streaming/playlists/__init__.py b/src/gcore/resources/streaming/playlists/__init__.py new file mode 100644 index 00000000..32b0eee0 --- /dev/null +++ b/src/gcore/resources/streaming/playlists/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .videos import ( + VideosResource, + AsyncVideosResource, + VideosResourceWithRawResponse, + AsyncVideosResourceWithRawResponse, + VideosResourceWithStreamingResponse, + AsyncVideosResourceWithStreamingResponse, +) +from .playlists import ( + PlaylistsResource, + AsyncPlaylistsResource, + PlaylistsResourceWithRawResponse, + AsyncPlaylistsResourceWithRawResponse, + PlaylistsResourceWithStreamingResponse, + AsyncPlaylistsResourceWithStreamingResponse, +) + +__all__ = [ + "VideosResource", + "AsyncVideosResource", + "VideosResourceWithRawResponse", + "AsyncVideosResourceWithRawResponse", + "VideosResourceWithStreamingResponse", + "AsyncVideosResourceWithStreamingResponse", + "PlaylistsResource", + "AsyncPlaylistsResource", + "PlaylistsResourceWithRawResponse", + "AsyncPlaylistsResourceWithRawResponse", + "PlaylistsResourceWithStreamingResponse", + "AsyncPlaylistsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists/playlists.py similarity index 92% rename from src/gcore/resources/streaming/playlists.py rename to src/gcore/resources/streaming/playlists/playlists.py index 28f15c1a..23bcdad7 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists/playlists.py @@ -7,27 +7,38 @@ import httpx -from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( +from .videos import ( + VideosResource, + AsyncVideosResource, + VideosResourceWithRawResponse, + AsyncVideosResourceWithRawResponse, + VideosResourceWithStreamingResponse, + AsyncVideosResourceWithStreamingResponse, +) +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...pagination import SyncPageStreaming, AsyncPageStreaming -from ..._base_client import AsyncPaginator, make_request_options -from ...types.streaming import playlist_list_params, playlist_create_params, playlist_update_params -from ...types.streaming.playlist import Playlist -from ...types.streaming.playlist_created import PlaylistCreated -from ...types.streaming.playlist_list_videos_response import PlaylistListVideosResponse +from ....pagination import SyncPageStreaming, AsyncPageStreaming +from ...._base_client import AsyncPaginator, make_request_options +from ....types.streaming import playlist_list_params, playlist_create_params, playlist_update_params +from ....types.streaming.playlist import Playlist +from ....types.streaming.playlist_created import PlaylistCreated __all__ = ["PlaylistsResource", "AsyncPlaylistsResource"] class PlaylistsResource(SyncAPIResource): + @cached_property + def videos(self) -> VideosResource: + return VideosResource(self._client) + @cached_property def with_raw_response(self) -> PlaylistsResourceWithRawResponse: """ @@ -486,39 +497,12 @@ def get( cast_to=Playlist, ) - def list_videos( - self, - playlist_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, - ) -> PlaylistListVideosResponse: - """ - Shows ordered array of playlist videos - - 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"/streaming/playlists/{playlist_id}/videos", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=PlaylistListVideosResponse, - ) - class AsyncPlaylistsResource(AsyncAPIResource): + @cached_property + def videos(self) -> AsyncVideosResource: + return AsyncVideosResource(self._client) + @cached_property def with_raw_response(self) -> AsyncPlaylistsResourceWithRawResponse: """ @@ -977,37 +961,6 @@ async def get( cast_to=Playlist, ) - async def list_videos( - self, - playlist_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, - ) -> PlaylistListVideosResponse: - """ - Shows ordered array of playlist videos - - 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"/streaming/playlists/{playlist_id}/videos", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=PlaylistListVideosResponse, - ) - class PlaylistsResourceWithRawResponse: def __init__(self, playlists: PlaylistsResource) -> None: @@ -1028,9 +981,10 @@ def __init__(self, playlists: PlaylistsResource) -> None: self.get = to_raw_response_wrapper( playlists.get, ) - self.list_videos = to_raw_response_wrapper( - playlists.list_videos, - ) + + @cached_property + def videos(self) -> VideosResourceWithRawResponse: + return VideosResourceWithRawResponse(self._playlists.videos) class AsyncPlaylistsResourceWithRawResponse: @@ -1052,9 +1006,10 @@ def __init__(self, playlists: AsyncPlaylistsResource) -> None: self.get = async_to_raw_response_wrapper( playlists.get, ) - self.list_videos = async_to_raw_response_wrapper( - playlists.list_videos, - ) + + @cached_property + def videos(self) -> AsyncVideosResourceWithRawResponse: + return AsyncVideosResourceWithRawResponse(self._playlists.videos) class PlaylistsResourceWithStreamingResponse: @@ -1076,9 +1031,10 @@ def __init__(self, playlists: PlaylistsResource) -> None: self.get = to_streamed_response_wrapper( playlists.get, ) - self.list_videos = to_streamed_response_wrapper( - playlists.list_videos, - ) + + @cached_property + def videos(self) -> VideosResourceWithStreamingResponse: + return VideosResourceWithStreamingResponse(self._playlists.videos) class AsyncPlaylistsResourceWithStreamingResponse: @@ -1100,6 +1056,7 @@ def __init__(self, playlists: AsyncPlaylistsResource) -> None: self.get = async_to_streamed_response_wrapper( playlists.get, ) - self.list_videos = async_to_streamed_response_wrapper( - playlists.list_videos, - ) + + @cached_property + def videos(self) -> AsyncVideosResourceWithStreamingResponse: + return AsyncVideosResourceWithStreamingResponse(self._playlists.videos) diff --git a/src/gcore/resources/streaming/playlists/videos.py b/src/gcore/resources/streaming/playlists/videos.py new file mode 100644 index 00000000..b5478e10 --- /dev/null +++ b/src/gcore/resources/streaming/playlists/videos.py @@ -0,0 +1,159 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.streaming.playlists.video_list_response import VideoListResponse + +__all__ = ["VideosResource", "AsyncVideosResource"] + + +class VideosResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> VideosResourceWithRawResponse: + """ + 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 VideosResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VideosResourceWithStreamingResponse: + """ + 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 VideosResourceWithStreamingResponse(self) + + def list( + self, + playlist_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, + ) -> VideoListResponse: + """ + Shows ordered array of playlist videos + + 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"/streaming/playlists/{playlist_id}/videos", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VideoListResponse, + ) + + +class AsyncVideosResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncVideosResourceWithRawResponse: + """ + 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 AsyncVideosResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVideosResourceWithStreamingResponse: + """ + 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 AsyncVideosResourceWithStreamingResponse(self) + + async def list( + self, + playlist_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, + ) -> VideoListResponse: + """ + Shows ordered array of playlist videos + + 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"/streaming/playlists/{playlist_id}/videos", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VideoListResponse, + ) + + +class VideosResourceWithRawResponse: + def __init__(self, videos: VideosResource) -> None: + self._videos = videos + + self.list = to_raw_response_wrapper( + videos.list, + ) + + +class AsyncVideosResourceWithRawResponse: + def __init__(self, videos: AsyncVideosResource) -> None: + self._videos = videos + + self.list = async_to_raw_response_wrapper( + videos.list, + ) + + +class VideosResourceWithStreamingResponse: + def __init__(self, videos: VideosResource) -> None: + self._videos = videos + + self.list = to_streamed_response_wrapper( + videos.list, + ) + + +class AsyncVideosResourceWithStreamingResponse: + def __init__(self, videos: AsyncVideosResource) -> None: + self._videos = videos + + self.list = async_to_streamed_response_wrapper( + videos.list, + ) diff --git a/src/gcore/resources/streaming/streaming.py b/src/gcore/resources/streaming/streaming.py index 11e18d2b..1048cdef 100644 --- a/src/gcore/resources/streaming/streaming.py +++ b/src/gcore/resources/streaming/streaming.py @@ -19,14 +19,6 @@ AsyncAITasksResourceWithStreamingResponse, ) from ..._compat import cached_property -from .playlists import ( - PlaylistsResource, - AsyncPlaylistsResource, - PlaylistsResourceWithRawResponse, - AsyncPlaylistsResourceWithRawResponse, - PlaylistsResourceWithStreamingResponse, - AsyncPlaylistsResourceWithStreamingResponse, -) from .restreams import ( RestreamsResource, AsyncRestreamsResource, @@ -84,6 +76,14 @@ StreamsResourceWithStreamingResponse, AsyncStreamsResourceWithStreamingResponse, ) +from .playlists.playlists import ( + PlaylistsResource, + AsyncPlaylistsResource, + PlaylistsResourceWithRawResponse, + AsyncPlaylistsResourceWithRawResponse, + PlaylistsResourceWithStreamingResponse, + AsyncPlaylistsResourceWithStreamingResponse, +) __all__ = ["StreamingResource", "AsyncStreamingResource"] diff --git a/src/gcore/types/streaming/__init__.py b/src/gcore/types/streaming/__init__.py index ab0d0c3c..f850f3ac 100644 --- a/src/gcore/types/streaming/__init__.py +++ b/src/gcore/types/streaming/__init__.py @@ -74,7 +74,6 @@ from .statistic_get_views_params import StatisticGetViewsParams as StatisticGetViewsParams from .stream_list_clips_response import StreamListClipsResponse as StreamListClipsResponse from .video_create_multiple_params import VideoCreateMultipleParams as VideoCreateMultipleParams -from .playlist_list_videos_response import PlaylistListVideosResponse as PlaylistListVideosResponse from .statistic_get_ffprobes_params import StatisticGetFfprobesParams as StatisticGetFfprobesParams from .ai_task_get_ai_settings_params import AITaskGetAISettingsParams as AITaskGetAISettingsParams from .quality_set_set_default_params import QualitySetSetDefaultParams as QualitySetSetDefaultParams diff --git a/src/gcore/types/streaming/playlists/__init__.py b/src/gcore/types/streaming/playlists/__init__.py new file mode 100644 index 00000000..45af0b59 --- /dev/null +++ b/src/gcore/types/streaming/playlists/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .video_list_response import VideoListResponse as VideoListResponse diff --git a/src/gcore/types/streaming/playlist_list_videos_response.py b/src/gcore/types/streaming/playlists/video_list_response.py similarity index 51% rename from src/gcore/types/streaming/playlist_list_videos_response.py rename to src/gcore/types/streaming/playlists/video_list_response.py index d8b5bf93..ca66bd37 100644 --- a/src/gcore/types/streaming/playlist_list_videos_response.py +++ b/src/gcore/types/streaming/playlists/video_list_response.py @@ -3,8 +3,8 @@ from typing import List from typing_extensions import TypeAlias -from .playlist_video import PlaylistVideo +from ..playlist_video import PlaylistVideo -__all__ = ["PlaylistListVideosResponse"] +__all__ = ["VideoListResponse"] -PlaylistListVideosResponse: TypeAlias = List[PlaylistVideo] +VideoListResponse: TypeAlias = List[PlaylistVideo] diff --git a/tests/api_resources/streaming/playlists/__init__.py b/tests/api_resources/streaming/playlists/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/streaming/playlists/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/streaming/playlists/test_videos.py b/tests/api_resources/streaming/playlists/test_videos.py new file mode 100644 index 00000000..fd1ab763 --- /dev/null +++ b/tests/api_resources/streaming/playlists/test_videos.py @@ -0,0 +1,86 @@ +# 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.streaming.playlists import VideoListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestVideos: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + video = client.streaming.playlists.videos.list( + 0, + ) + assert_matches_type(VideoListResponse, video, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.streaming.playlists.videos.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = response.parse() + assert_matches_type(VideoListResponse, video, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.streaming.playlists.videos.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = response.parse() + assert_matches_type(VideoListResponse, video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncVideos: + 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: + video = await async_client.streaming.playlists.videos.list( + 0, + ) + assert_matches_type(VideoListResponse, video, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.playlists.videos.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video = await response.parse() + assert_matches_type(VideoListResponse, video, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.playlists.videos.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video = await response.parse() + assert_matches_type(VideoListResponse, video, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_playlists.py b/tests/api_resources/streaming/test_playlists.py index 753dd073..c9e49cc2 100644 --- a/tests/api_resources/streaming/test_playlists.py +++ b/tests/api_resources/streaming/test_playlists.py @@ -13,7 +13,6 @@ from gcore.types.streaming import ( Playlist, PlaylistCreated, - PlaylistListVideosResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -213,37 +212,6 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_list_videos(self, client: Gcore) -> None: - playlist = client.streaming.playlists.list_videos( - 0, - ) - assert_matches_type(PlaylistListVideosResponse, playlist, path=["response"]) - - @parametrize - def test_raw_response_list_videos(self, client: Gcore) -> None: - response = client.streaming.playlists.with_raw_response.list_videos( - 0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - playlist = response.parse() - assert_matches_type(PlaylistListVideosResponse, playlist, path=["response"]) - - @parametrize - def test_streaming_response_list_videos(self, client: Gcore) -> None: - with client.streaming.playlists.with_streaming_response.list_videos( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - playlist = response.parse() - assert_matches_type(PlaylistListVideosResponse, playlist, path=["response"]) - - assert cast(Any, response.is_closed) is True - class TestAsyncPlaylists: parametrize = pytest.mark.parametrize( @@ -440,34 +408,3 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert_matches_type(Playlist, playlist, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_list_videos(self, async_client: AsyncGcore) -> None: - playlist = await async_client.streaming.playlists.list_videos( - 0, - ) - assert_matches_type(PlaylistListVideosResponse, playlist, path=["response"]) - - @parametrize - async def test_raw_response_list_videos(self, async_client: AsyncGcore) -> None: - response = await async_client.streaming.playlists.with_raw_response.list_videos( - 0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - playlist = await response.parse() - assert_matches_type(PlaylistListVideosResponse, playlist, path=["response"]) - - @parametrize - async def test_streaming_response_list_videos(self, async_client: AsyncGcore) -> None: - async with async_client.streaming.playlists.with_streaming_response.list_videos( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - playlist = await response.parse() - assert_matches_type(PlaylistListVideosResponse, playlist, path=["response"]) - - assert cast(Any, response.is_closed) is True From 27485ae20110cc61696704a2d8acb71798b07cd1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:56:41 +0000 Subject: [PATCH 583/592] refactor(streaming)!: move streams clip methods to streams.clips --- .stats.yml | 2 +- src/gcore/resources/streaming/api.md | 22 +- .../resources/streaming/streams/__init__.py | 14 + .../resources/streaming/streams/clips.py | 500 ++++++++++++++++++ .../resources/streaming/streams/streams.py | 453 ++-------------- src/gcore/types/streaming/__init__.py | 3 - src/gcore/types/streaming/streams/__init__.py | 3 + .../types/streaming/{ => streams}/clip.py | 2 +- .../clip_create_params.py} | 4 +- .../clip_list_response.py} | 4 +- .../streaming/streams/test_clips.py | 176 ++++++ tests/api_resources/streaming/test_streams.py | 154 ------ 12 files changed, 746 insertions(+), 591 deletions(-) create mode 100644 src/gcore/resources/streaming/streams/clips.py rename src/gcore/types/streaming/{ => streams}/clip.py (98%) rename src/gcore/types/streaming/{stream_create_clip_params.py => streams/clip_create_params.py} (96%) rename src/gcore/types/streaming/{stream_list_clips_response.py => streams/clip_list_response.py} (67%) create mode 100644 tests/api_resources/streaming/streams/test_clips.py diff --git a/.stats.yml b/.stats.yml index 5fcfa385..a58aaa95 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-691d7fc7d687ca367474bc78eb880f6f964454dc82259cdbb75fb90bd92c67ec.yml openapi_spec_hash: 97a4cbc8d7b05b1dc58319331717e8e7 -config_hash: 3e264ee16128fcb92256ca2b068decbb +config_hash: b07ea4587f9078d7da7d498163b001b5 diff --git a/src/gcore/resources/streaming/api.md b/src/gcore/resources/streaming/api.md index a16cba9a..00101c67 100644 --- a/src/gcore/resources/streaming/api.md +++ b/src/gcore/resources/streaming/api.md @@ -177,12 +177,7 @@ Methods: Types: ```python -from gcore.types.streaming import ( - Clip, - Stream, - StreamListClipsResponse, - StreamStartRecordingResponse, -) +from gcore.types.streaming import Stream, StreamStartRecordingResponse ``` Methods: @@ -192,12 +187,23 @@ Methods: - client.streaming.streams.list(\*\*params) -> SyncPageStreaming[Stream] - client.streaming.streams.delete(stream_id) -> None - client.streaming.streams.clear_dvr(stream_id) -> None -- client.streaming.streams.create_clip(stream_id, \*\*params) -> Clip - client.streaming.streams.get(stream_id) -> Stream -- client.streaming.streams.list_clips(stream_id) -> StreamListClipsResponse - client.streaming.streams.start_recording(stream_id) -> StreamStartRecordingResponse - client.streaming.streams.stop_recording(stream_id) -> Video +### Clips + +Types: + +```python +from gcore.types.streaming.streams import Clip, ClipListResponse +``` + +Methods: + +- client.streaming.streams.clips.create(stream_id, \*\*params) -> Clip +- client.streaming.streams.clips.list(stream_id) -> ClipListResponse + ### Overlays Types: diff --git a/src/gcore/resources/streaming/streams/__init__.py b/src/gcore/resources/streaming/streams/__init__.py index 49461963..10994775 100644 --- a/src/gcore/resources/streaming/streams/__init__.py +++ b/src/gcore/resources/streaming/streams/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .clips import ( + ClipsResource, + AsyncClipsResource, + ClipsResourceWithRawResponse, + AsyncClipsResourceWithRawResponse, + ClipsResourceWithStreamingResponse, + AsyncClipsResourceWithStreamingResponse, +) from .streams import ( StreamsResource, AsyncStreamsResource, @@ -18,6 +26,12 @@ ) __all__ = [ + "ClipsResource", + "AsyncClipsResource", + "ClipsResourceWithRawResponse", + "AsyncClipsResourceWithRawResponse", + "ClipsResourceWithStreamingResponse", + "AsyncClipsResourceWithStreamingResponse", "OverlaysResource", "AsyncOverlaysResource", "OverlaysResourceWithRawResponse", diff --git a/src/gcore/resources/streaming/streams/clips.py b/src/gcore/resources/streaming/streams/clips.py new file mode 100644 index 00000000..9641f759 --- /dev/null +++ b/src/gcore/resources/streaming/streams/clips.py @@ -0,0 +1,500 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.streaming.streams import clip_create_params +from ....types.streaming.streams.clip import Clip +from ....types.streaming.streams.clip_list_response import ClipListResponse + +__all__ = ["ClipsResource", "AsyncClipsResource"] + + +class ClipsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ClipsResourceWithRawResponse: + """ + 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 ClipsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ClipsResourceWithStreamingResponse: + """ + 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 ClipsResourceWithStreamingResponse(self) + + def create( + self, + stream_id: int, + *, + duration: int, + expiration: int | Omit = omit, + start: int | Omit = omit, + vod_required: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Clip: + """ + Create an instant clip from on-going live stream. + + Instant clips are applicable in cases where there is no time to wait for the + broadcast to be completed and recorded. For example, for quickly cutting + highlights in sport events, or cutting an important moment in the news or live + performance. + + 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, + - MP4, + - VOD in video hosting with a permanent link to watch video. + + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) + + **Clip lifetime:** + + Instant clips are a copy of the stream, created from a live stream. They are + stored in memory for a limited time, after which the clip ceases to exist and + you will receive a 404 on the link. + + Limits that you should keep in mind: + + - The clip's lifespan is controlled by `expiration` parameter. + - The default expiration value is 1 hour. The value can be set from 1 minute to + 4 hours. + - If you want a video for longer or permanent viewing, then create a regular VOD + based on the clip. This way you can use the clip's link for the first time, + and immediately after the transcoded version is ready, you can change by + yourself it to a permanent link of VOD. + - The clip becomes available only after it is completely copied from the live + stream. So the clip will be available after `start + duration` exact time. If + you try to request it before this time, the response will be error code 425 + "Too Early". + + **Cutting a clip from a source:** + + In order to use clips recording feature, DVR must be enabled for a stream: + "dvr_enabled: true". The DVR serves as a source for creating clips: + + - By default live stream DVR is set to 1 hour (3600 seconds). You can create an + instant clip using any segment of this time period by specifying the desired + start time and duration. + - If you create a clip, but the DVR expires, the clip will still exist for the + specified time as a copy of the stream. + + **Getting permanent VOD:** + + To get permanent VOD version of a live clip use this parameter when making a + request to create a clip: `vod_required: true`. + + Later, when the clip is ready, grab `video_id` value from the response and query + the video by regular GET /video/{id} method. + + Args: + duration: Requested segment duration in seconds to be cut. + + Please, note that cutting is based on the idea of instantly creating a clip, + instead of precise timing. So final segment may be: + + - Less than the specified value if there is less data in the DVR than the + requested segment. + - Greater than the specified value, because segment is aligned to the first and + last key frames of already stored fragment in DVR, this way -1 and +1 chunks + can be added to left and right. + + Duration of cutted segment cannot be greater than DVR duration for this stream. + Therefore, to change the maximum, use "dvr_duration" parameter of this stream. + + expiration: Expire time of the clip via a public link. + + Unix timestamp in seconds, absolute value. + + This is the time how long the instant clip will be stored in the server memory + and can be accessed via public HLS/MP4 links. Download and/or use the instant + clip before this time expires. + + After the time has expired, the clip is deleted from memory and is no longer + available via the link. You need to create a new segment, or use + `vod_required: true` attribute. + + If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the + end of the clip (i.e. `unix timestamp = + + 3600`). + + Allowed range: 1m <= expiration <= 4h. + + Example: + `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` + + start: Starting point of the segment to cut. + + Unix timestamp in seconds, absolute value. Example: + `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` + + If a value from the past is specified, it is used as the starting point for the + segment to cut. If the value is omitted, then clip will start from now. + + vod_required: Indicates if video needs to be stored also as permanent VOD + + 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"/streaming/streams/{stream_id}/clip_recording", + body=maybe_transform( + { + "duration": duration, + "expiration": expiration, + "start": start, + "vod_required": vod_required, + }, + clip_create_params.ClipCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Clip, + ) + + def list( + self, + stream_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, + ) -> ClipListResponse: + """ + Get list of non expired instant clips for a stream. + + You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs + from "hls_master" and "mp4_master". + + **How to download renditions of clips:** + + URLs contain "master" alias by default, which means maximum available quality + from ABR set (based on height metadata). There is also possibility to access + individual bitrates from ABR ladder. That works for both HLS and MP4. You can + replace manually "master" to a value from renditions list in order to get exact + bitrate/quality from the set. Example: + + - HLS 720p: + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.m3u8` + - HLS 720p: + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_media_1_360.m3u8` + - MP4 360p: + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.mp4` + - MP4 360p: + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_media_1_360.mp4` + + 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"/streaming/streams/{stream_id}/clip_recording", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClipListResponse, + ) + + +class AsyncClipsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncClipsResourceWithRawResponse: + """ + 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 AsyncClipsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncClipsResourceWithStreamingResponse: + """ + 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 AsyncClipsResourceWithStreamingResponse(self) + + async def create( + self, + stream_id: int, + *, + duration: int, + expiration: int | Omit = omit, + start: int | Omit = omit, + vod_required: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Clip: + """ + Create an instant clip from on-going live stream. + + Instant clips are applicable in cases where there is no time to wait for the + broadcast to be completed and recorded. For example, for quickly cutting + highlights in sport events, or cutting an important moment in the news or live + performance. + + 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, + - MP4, + - VOD in video hosting with a permanent link to watch video. + + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) + + **Clip lifetime:** + + Instant clips are a copy of the stream, created from a live stream. They are + stored in memory for a limited time, after which the clip ceases to exist and + you will receive a 404 on the link. + + Limits that you should keep in mind: + + - The clip's lifespan is controlled by `expiration` parameter. + - The default expiration value is 1 hour. The value can be set from 1 minute to + 4 hours. + - If you want a video for longer or permanent viewing, then create a regular VOD + based on the clip. This way you can use the clip's link for the first time, + and immediately after the transcoded version is ready, you can change by + yourself it to a permanent link of VOD. + - The clip becomes available only after it is completely copied from the live + stream. So the clip will be available after `start + duration` exact time. If + you try to request it before this time, the response will be error code 425 + "Too Early". + + **Cutting a clip from a source:** + + In order to use clips recording feature, DVR must be enabled for a stream: + "dvr_enabled: true". The DVR serves as a source for creating clips: + + - By default live stream DVR is set to 1 hour (3600 seconds). You can create an + instant clip using any segment of this time period by specifying the desired + start time and duration. + - If you create a clip, but the DVR expires, the clip will still exist for the + specified time as a copy of the stream. + + **Getting permanent VOD:** + + To get permanent VOD version of a live clip use this parameter when making a + request to create a clip: `vod_required: true`. + + Later, when the clip is ready, grab `video_id` value from the response and query + the video by regular GET /video/{id} method. + + Args: + duration: Requested segment duration in seconds to be cut. + + Please, note that cutting is based on the idea of instantly creating a clip, + instead of precise timing. So final segment may be: + + - Less than the specified value if there is less data in the DVR than the + requested segment. + - Greater than the specified value, because segment is aligned to the first and + last key frames of already stored fragment in DVR, this way -1 and +1 chunks + can be added to left and right. + + Duration of cutted segment cannot be greater than DVR duration for this stream. + Therefore, to change the maximum, use "dvr_duration" parameter of this stream. + + expiration: Expire time of the clip via a public link. + + Unix timestamp in seconds, absolute value. + + This is the time how long the instant clip will be stored in the server memory + and can be accessed via public HLS/MP4 links. Download and/or use the instant + clip before this time expires. + + After the time has expired, the clip is deleted from memory and is no longer + available via the link. You need to create a new segment, or use + `vod_required: true` attribute. + + If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the + end of the clip (i.e. `unix timestamp = + + 3600`). + + Allowed range: 1m <= expiration <= 4h. + + Example: + `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` + + start: Starting point of the segment to cut. + + Unix timestamp in seconds, absolute value. Example: + `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` + + If a value from the past is specified, it is used as the starting point for the + segment to cut. If the value is omitted, then clip will start from now. + + vod_required: Indicates if video needs to be stored also as permanent VOD + + 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"/streaming/streams/{stream_id}/clip_recording", + body=await async_maybe_transform( + { + "duration": duration, + "expiration": expiration, + "start": start, + "vod_required": vod_required, + }, + clip_create_params.ClipCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Clip, + ) + + async def list( + self, + stream_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, + ) -> ClipListResponse: + """ + Get list of non expired instant clips for a stream. + + You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs + from "hls_master" and "mp4_master". + + **How to download renditions of clips:** + + URLs contain "master" alias by default, which means maximum available quality + from ABR set (based on height metadata). There is also possibility to access + individual bitrates from ABR ladder. That works for both HLS and MP4. You can + replace manually "master" to a value from renditions list in order to get exact + bitrate/quality from the set. Example: + + - HLS 720p: + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.m3u8` + - HLS 720p: + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_media_1_360.m3u8` + - MP4 360p: + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.mp4` + - MP4 360p: + `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_media_1_360.mp4` + + 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"/streaming/streams/{stream_id}/clip_recording", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ClipListResponse, + ) + + +class ClipsResourceWithRawResponse: + def __init__(self, clips: ClipsResource) -> None: + self._clips = clips + + self.create = to_raw_response_wrapper( + clips.create, + ) + self.list = to_raw_response_wrapper( + clips.list, + ) + + +class AsyncClipsResourceWithRawResponse: + def __init__(self, clips: AsyncClipsResource) -> None: + self._clips = clips + + self.create = async_to_raw_response_wrapper( + clips.create, + ) + self.list = async_to_raw_response_wrapper( + clips.list, + ) + + +class ClipsResourceWithStreamingResponse: + def __init__(self, clips: ClipsResource) -> None: + self._clips = clips + + self.create = to_streamed_response_wrapper( + clips.create, + ) + self.list = to_streamed_response_wrapper( + clips.list, + ) + + +class AsyncClipsResourceWithStreamingResponse: + def __init__(self, clips: AsyncClipsResource) -> None: + self._clips = clips + + self.create = async_to_streamed_response_wrapper( + clips.create, + ) + self.list = async_to_streamed_response_wrapper( + clips.list, + ) diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 5fc4b7c5..e6d64810 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -7,6 +7,14 @@ import httpx +from .clips import ( + ClipsResource, + AsyncClipsResource, + ClipsResourceWithRawResponse, + AsyncClipsResourceWithRawResponse, + ClipsResourceWithStreamingResponse, + AsyncClipsResourceWithStreamingResponse, +) from .overlays import ( OverlaysResource, AsyncOverlaysResource, @@ -27,22 +35,19 @@ ) from ....pagination import SyncPageStreaming, AsyncPageStreaming from ...._base_client import AsyncPaginator, make_request_options -from ....types.streaming import ( - stream_list_params, - stream_create_params, - stream_update_params, - stream_create_clip_params, -) -from ....types.streaming.clip import Clip +from ....types.streaming import stream_list_params, stream_create_params, stream_update_params from ....types.streaming.video import Video from ....types.streaming.stream import Stream -from ....types.streaming.stream_list_clips_response import StreamListClipsResponse from ....types.streaming.stream_start_recording_response import StreamStartRecordingResponse __all__ = ["StreamsResource", "AsyncStreamsResource"] class StreamsResource(SyncAPIResource): + @cached_property + def clips(self) -> ClipsResource: + return ClipsResource(self._client) + @cached_property def overlays(self) -> OverlaysResource: return OverlaysResource(self._client) @@ -446,149 +451,6 @@ def clear_dvr( cast_to=NoneType, ) - def create_clip( - self, - stream_id: int, - *, - duration: int, - expiration: int | Omit = omit, - start: int | Omit = omit, - vod_required: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Clip: - """ - Create an instant clip from on-going live stream. - - Instant clips are applicable in cases where there is no time to wait for the - broadcast to be completed and recorded. For example, for quickly cutting - highlights in sport events, or cutting an important moment in the news or live - performance. - - 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, - - MP4, - - VOD in video hosting with a permanent link to watch video. - - ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) - - **Clip lifetime:** - - Instant clips are a copy of the stream, created from a live stream. They are - stored in memory for a limited time, after which the clip ceases to exist and - you will receive a 404 on the link. - - Limits that you should keep in mind: - - - The clip's lifespan is controlled by `expiration` parameter. - - The default expiration value is 1 hour. The value can be set from 1 minute to - 4 hours. - - If you want a video for longer or permanent viewing, then create a regular VOD - based on the clip. This way you can use the clip's link for the first time, - and immediately after the transcoded version is ready, you can change by - yourself it to a permanent link of VOD. - - The clip becomes available only after it is completely copied from the live - stream. So the clip will be available after `start + duration` exact time. If - you try to request it before this time, the response will be error code 425 - "Too Early". - - **Cutting a clip from a source:** - - In order to use clips recording feature, DVR must be enabled for a stream: - "dvr_enabled: true". The DVR serves as a source for creating clips: - - - By default live stream DVR is set to 1 hour (3600 seconds). You can create an - instant clip using any segment of this time period by specifying the desired - start time and duration. - - If you create a clip, but the DVR expires, the clip will still exist for the - specified time as a copy of the stream. - - **Getting permanent VOD:** - - To get permanent VOD version of a live clip use this parameter when making a - request to create a clip: `vod_required: true`. - - Later, when the clip is ready, grab `video_id` value from the response and query - the video by regular GET /video/{id} method. - - Args: - duration: Requested segment duration in seconds to be cut. - - Please, note that cutting is based on the idea of instantly creating a clip, - instead of precise timing. So final segment may be: - - - Less than the specified value if there is less data in the DVR than the - requested segment. - - Greater than the specified value, because segment is aligned to the first and - last key frames of already stored fragment in DVR, this way -1 and +1 chunks - can be added to left and right. - - Duration of cutted segment cannot be greater than DVR duration for this stream. - Therefore, to change the maximum, use "dvr_duration" parameter of this stream. - - expiration: Expire time of the clip via a public link. - - Unix timestamp in seconds, absolute value. - - This is the time how long the instant clip will be stored in the server memory - and can be accessed via public HLS/MP4 links. Download and/or use the instant - clip before this time expires. - - After the time has expired, the clip is deleted from memory and is no longer - available via the link. You need to create a new segment, or use - `vod_required: true` attribute. - - If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the - end of the clip (i.e. `unix timestamp = + + 3600`). - - Allowed range: 1m <= expiration <= 4h. - - Example: - `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` - - start: Starting point of the segment to cut. - - Unix timestamp in seconds, absolute value. Example: - `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` - - If a value from the past is specified, it is used as the starting point for the - segment to cut. If the value is omitted, then clip will start from now. - - vod_required: Indicates if video needs to be stored also as permanent VOD - - 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"/streaming/streams/{stream_id}/clip_recording", - body=maybe_transform( - { - "duration": duration, - "expiration": expiration, - "start": start, - "vod_required": vod_required, - }, - stream_create_clip_params.StreamCreateClipParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Clip, - ) - def get( self, stream_id: int, @@ -620,57 +482,6 @@ def get( cast_to=Stream, ) - def list_clips( - self, - stream_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, - ) -> StreamListClipsResponse: - """ - Get list of non expired instant clips for a stream. - - You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs - from "hls_master" and "mp4_master". - - **How to download renditions of clips:** - - URLs contain "master" alias by default, which means maximum available quality - from ABR set (based on height metadata). There is also possibility to access - individual bitrates from ABR ladder. That works for both HLS and MP4. You can - replace manually "master" to a value from renditions list in order to get exact - bitrate/quality from the set. Example: - - - HLS 720p: - `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.m3u8` - - HLS 720p: - `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_media_1_360.m3u8` - - MP4 360p: - `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.mp4` - - MP4 360p: - `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_media_1_360.mp4` - - 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"/streaming/streams/{stream_id}/clip_recording", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=StreamListClipsResponse, - ) - def start_recording( self, stream_id: int, @@ -781,6 +592,10 @@ def stop_recording( class AsyncStreamsResource(AsyncAPIResource): + @cached_property + def clips(self) -> AsyncClipsResource: + return AsyncClipsResource(self._client) + @cached_property def overlays(self) -> AsyncOverlaysResource: return AsyncOverlaysResource(self._client) @@ -1184,149 +999,6 @@ async def clear_dvr( cast_to=NoneType, ) - async def create_clip( - self, - stream_id: int, - *, - duration: int, - expiration: int | Omit = omit, - start: int | Omit = omit, - vod_required: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Clip: - """ - Create an instant clip from on-going live stream. - - Instant clips are applicable in cases where there is no time to wait for the - broadcast to be completed and recorded. For example, for quickly cutting - highlights in sport events, or cutting an important moment in the news or live - performance. - - 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, - - MP4, - - VOD in video hosting with a permanent link to watch video. - - ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) - - **Clip lifetime:** - - Instant clips are a copy of the stream, created from a live stream. They are - stored in memory for a limited time, after which the clip ceases to exist and - you will receive a 404 on the link. - - Limits that you should keep in mind: - - - The clip's lifespan is controlled by `expiration` parameter. - - The default expiration value is 1 hour. The value can be set from 1 minute to - 4 hours. - - If you want a video for longer or permanent viewing, then create a regular VOD - based on the clip. This way you can use the clip's link for the first time, - and immediately after the transcoded version is ready, you can change by - yourself it to a permanent link of VOD. - - The clip becomes available only after it is completely copied from the live - stream. So the clip will be available after `start + duration` exact time. If - you try to request it before this time, the response will be error code 425 - "Too Early". - - **Cutting a clip from a source:** - - In order to use clips recording feature, DVR must be enabled for a stream: - "dvr_enabled: true". The DVR serves as a source for creating clips: - - - By default live stream DVR is set to 1 hour (3600 seconds). You can create an - instant clip using any segment of this time period by specifying the desired - start time and duration. - - If you create a clip, but the DVR expires, the clip will still exist for the - specified time as a copy of the stream. - - **Getting permanent VOD:** - - To get permanent VOD version of a live clip use this parameter when making a - request to create a clip: `vod_required: true`. - - Later, when the clip is ready, grab `video_id` value from the response and query - the video by regular GET /video/{id} method. - - Args: - duration: Requested segment duration in seconds to be cut. - - Please, note that cutting is based on the idea of instantly creating a clip, - instead of precise timing. So final segment may be: - - - Less than the specified value if there is less data in the DVR than the - requested segment. - - Greater than the specified value, because segment is aligned to the first and - last key frames of already stored fragment in DVR, this way -1 and +1 chunks - can be added to left and right. - - Duration of cutted segment cannot be greater than DVR duration for this stream. - Therefore, to change the maximum, use "dvr_duration" parameter of this stream. - - expiration: Expire time of the clip via a public link. - - Unix timestamp in seconds, absolute value. - - This is the time how long the instant clip will be stored in the server memory - and can be accessed via public HLS/MP4 links. Download and/or use the instant - clip before this time expires. - - After the time has expired, the clip is deleted from memory and is no longer - available via the link. You need to create a new segment, or use - `vod_required: true` attribute. - - If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the - end of the clip (i.e. `unix timestamp = + + 3600`). - - Allowed range: 1m <= expiration <= 4h. - - Example: - `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` - - start: Starting point of the segment to cut. - - Unix timestamp in seconds, absolute value. Example: - `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` - - If a value from the past is specified, it is used as the starting point for the - segment to cut. If the value is omitted, then clip will start from now. - - vod_required: Indicates if video needs to be stored also as permanent VOD - - 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"/streaming/streams/{stream_id}/clip_recording", - body=await async_maybe_transform( - { - "duration": duration, - "expiration": expiration, - "start": start, - "vod_required": vod_required, - }, - stream_create_clip_params.StreamCreateClipParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Clip, - ) - async def get( self, stream_id: int, @@ -1358,57 +1030,6 @@ async def get( cast_to=Stream, ) - async def list_clips( - self, - stream_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, - ) -> StreamListClipsResponse: - """ - Get list of non expired instant clips for a stream. - - You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs - from "hls_master" and "mp4_master". - - **How to download renditions of clips:** - - URLs contain "master" alias by default, which means maximum available quality - from ABR set (based on height metadata). There is also possibility to access - individual bitrates from ABR ladder. That works for both HLS and MP4. You can - replace manually "master" to a value from renditions list in order to get exact - bitrate/quality from the set. Example: - - - HLS 720p: - `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.m3u8` - - HLS 720p: - `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_media_1_360.m3u8` - - MP4 360p: - `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.mp4` - - MP4 360p: - `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_media_1_360.mp4` - - 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"/streaming/streams/{stream_id}/clip_recording", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=StreamListClipsResponse, - ) - async def start_recording( self, stream_id: int, @@ -1537,15 +1158,9 @@ def __init__(self, streams: StreamsResource) -> None: self.clear_dvr = to_raw_response_wrapper( streams.clear_dvr, ) - self.create_clip = to_raw_response_wrapper( - streams.create_clip, - ) self.get = to_raw_response_wrapper( streams.get, ) - self.list_clips = to_raw_response_wrapper( - streams.list_clips, - ) self.start_recording = to_raw_response_wrapper( streams.start_recording, ) @@ -1553,6 +1168,10 @@ def __init__(self, streams: StreamsResource) -> None: streams.stop_recording, ) + @cached_property + def clips(self) -> ClipsResourceWithRawResponse: + return ClipsResourceWithRawResponse(self._streams.clips) + @cached_property def overlays(self) -> OverlaysResourceWithRawResponse: return OverlaysResourceWithRawResponse(self._streams.overlays) @@ -1577,15 +1196,9 @@ def __init__(self, streams: AsyncStreamsResource) -> None: self.clear_dvr = async_to_raw_response_wrapper( streams.clear_dvr, ) - self.create_clip = async_to_raw_response_wrapper( - streams.create_clip, - ) self.get = async_to_raw_response_wrapper( streams.get, ) - self.list_clips = async_to_raw_response_wrapper( - streams.list_clips, - ) self.start_recording = async_to_raw_response_wrapper( streams.start_recording, ) @@ -1593,6 +1206,10 @@ def __init__(self, streams: AsyncStreamsResource) -> None: streams.stop_recording, ) + @cached_property + def clips(self) -> AsyncClipsResourceWithRawResponse: + return AsyncClipsResourceWithRawResponse(self._streams.clips) + @cached_property def overlays(self) -> AsyncOverlaysResourceWithRawResponse: return AsyncOverlaysResourceWithRawResponse(self._streams.overlays) @@ -1617,15 +1234,9 @@ def __init__(self, streams: StreamsResource) -> None: self.clear_dvr = to_streamed_response_wrapper( streams.clear_dvr, ) - self.create_clip = to_streamed_response_wrapper( - streams.create_clip, - ) self.get = to_streamed_response_wrapper( streams.get, ) - self.list_clips = to_streamed_response_wrapper( - streams.list_clips, - ) self.start_recording = to_streamed_response_wrapper( streams.start_recording, ) @@ -1633,6 +1244,10 @@ def __init__(self, streams: StreamsResource) -> None: streams.stop_recording, ) + @cached_property + def clips(self) -> ClipsResourceWithStreamingResponse: + return ClipsResourceWithStreamingResponse(self._streams.clips) + @cached_property def overlays(self) -> OverlaysResourceWithStreamingResponse: return OverlaysResourceWithStreamingResponse(self._streams.overlays) @@ -1657,15 +1272,9 @@ def __init__(self, streams: AsyncStreamsResource) -> None: self.clear_dvr = async_to_streamed_response_wrapper( streams.clear_dvr, ) - self.create_clip = async_to_streamed_response_wrapper( - streams.create_clip, - ) self.get = async_to_streamed_response_wrapper( streams.get, ) - self.list_clips = async_to_streamed_response_wrapper( - streams.list_clips, - ) self.start_recording = async_to_streamed_response_wrapper( streams.start_recording, ) @@ -1673,6 +1282,10 @@ def __init__(self, streams: AsyncStreamsResource) -> None: streams.stop_recording, ) + @cached_property + def clips(self) -> AsyncClipsResourceWithStreamingResponse: + return AsyncClipsResourceWithStreamingResponse(self._streams.clips) + @cached_property def overlays(self) -> AsyncOverlaysResourceWithStreamingResponse: return AsyncOverlaysResourceWithStreamingResponse(self._streams.overlays) diff --git a/src/gcore/types/streaming/__init__.py b/src/gcore/types/streaming/__init__.py index f850f3ac..188bcd30 100644 --- a/src/gcore/types/streaming/__init__.py +++ b/src/gcore/types/streaming/__init__.py @@ -2,7 +2,6 @@ from __future__ import annotations -from .clip import Clip as Clip from .video import Video as Video from .views import Views as Views from .player import Player as Player @@ -67,12 +66,10 @@ from .video_list_names_params import VideoListNamesParams as VideoListNamesParams from .direct_upload_parameters import DirectUploadParameters as DirectUploadParameters from .ai_contentmoderation_nsfw import AIContentmoderationNsfw as AIContentmoderationNsfw -from .stream_create_clip_params import StreamCreateClipParams as StreamCreateClipParams from .views_by_operating_system import ViewsByOperatingSystem as ViewsByOperatingSystem from .ai_contentmoderation_sport import AIContentmoderationSport as AIContentmoderationSport from .broadcast_spectators_count import BroadcastSpectatorsCount as BroadcastSpectatorsCount from .statistic_get_views_params import StatisticGetViewsParams as StatisticGetViewsParams -from .stream_list_clips_response import StreamListClipsResponse as StreamListClipsResponse from .video_create_multiple_params import VideoCreateMultipleParams as VideoCreateMultipleParams from .statistic_get_ffprobes_params import StatisticGetFfprobesParams as StatisticGetFfprobesParams from .ai_task_get_ai_settings_params import AITaskGetAISettingsParams as AITaskGetAISettingsParams diff --git a/src/gcore/types/streaming/streams/__init__.py b/src/gcore/types/streaming/streams/__init__.py index e5f7a9b0..040c6172 100644 --- a/src/gcore/types/streaming/streams/__init__.py +++ b/src/gcore/types/streaming/streams/__init__.py @@ -2,7 +2,10 @@ from __future__ import annotations +from .clip import Clip as Clip from .overlay import Overlay as Overlay +from .clip_create_params import ClipCreateParams as ClipCreateParams +from .clip_list_response import ClipListResponse as ClipListResponse from .overlay_create_params import OverlayCreateParams as OverlayCreateParams from .overlay_list_response import OverlayListResponse as OverlayListResponse from .overlay_update_params import OverlayUpdateParams as OverlayUpdateParams diff --git a/src/gcore/types/streaming/clip.py b/src/gcore/types/streaming/streams/clip.py similarity index 98% rename from src/gcore/types/streaming/clip.py rename to src/gcore/types/streaming/streams/clip.py index 3cab9cc9..d08894dc 100644 --- a/src/gcore/types/streaming/clip.py +++ b/src/gcore/types/streaming/streams/clip.py @@ -2,7 +2,7 @@ from typing import List, Optional -from ..._models import BaseModel +from ...._models import BaseModel __all__ = ["Clip"] diff --git a/src/gcore/types/streaming/stream_create_clip_params.py b/src/gcore/types/streaming/streams/clip_create_params.py similarity index 96% rename from src/gcore/types/streaming/stream_create_clip_params.py rename to src/gcore/types/streaming/streams/clip_create_params.py index 2a2f365a..2da2631a 100644 --- a/src/gcore/types/streaming/stream_create_clip_params.py +++ b/src/gcore/types/streaming/streams/clip_create_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["StreamCreateClipParams"] +__all__ = ["ClipCreateParams"] -class StreamCreateClipParams(TypedDict, total=False): +class ClipCreateParams(TypedDict, total=False): duration: Required[int] """Requested segment duration in seconds to be cut. diff --git a/src/gcore/types/streaming/stream_list_clips_response.py b/src/gcore/types/streaming/streams/clip_list_response.py similarity index 67% rename from src/gcore/types/streaming/stream_list_clips_response.py rename to src/gcore/types/streaming/streams/clip_list_response.py index 851546a7..24705b2a 100644 --- a/src/gcore/types/streaming/stream_list_clips_response.py +++ b/src/gcore/types/streaming/streams/clip_list_response.py @@ -5,6 +5,6 @@ from .clip import Clip -__all__ = ["StreamListClipsResponse"] +__all__ = ["ClipListResponse"] -StreamListClipsResponse: TypeAlias = List[Clip] +ClipListResponse: TypeAlias = List[Clip] diff --git a/tests/api_resources/streaming/streams/test_clips.py b/tests/api_resources/streaming/streams/test_clips.py new file mode 100644 index 00000000..8b98e4cb --- /dev/null +++ b/tests/api_resources/streaming/streams/test_clips.py @@ -0,0 +1,176 @@ +# 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.streaming.streams import Clip, ClipListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestClips: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + clip = client.streaming.streams.clips.create( + stream_id=0, + duration=0, + ) + assert_matches_type(Clip, clip, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + clip = client.streaming.streams.clips.create( + stream_id=0, + duration=0, + expiration=0, + start=0, + vod_required=True, + ) + assert_matches_type(Clip, clip, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.streaming.streams.clips.with_raw_response.create( + stream_id=0, + duration=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + clip = response.parse() + assert_matches_type(Clip, clip, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.streaming.streams.clips.with_streaming_response.create( + stream_id=0, + duration=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + clip = response.parse() + assert_matches_type(Clip, clip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + clip = client.streaming.streams.clips.list( + 0, + ) + assert_matches_type(ClipListResponse, clip, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.streaming.streams.clips.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + clip = response.parse() + assert_matches_type(ClipListResponse, clip, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.streaming.streams.clips.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + clip = response.parse() + assert_matches_type(ClipListResponse, clip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncClips: + 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: + clip = await async_client.streaming.streams.clips.create( + stream_id=0, + duration=0, + ) + assert_matches_type(Clip, clip, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + clip = await async_client.streaming.streams.clips.create( + stream_id=0, + duration=0, + expiration=0, + start=0, + vod_required=True, + ) + assert_matches_type(Clip, clip, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.clips.with_raw_response.create( + stream_id=0, + duration=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + clip = await response.parse() + assert_matches_type(Clip, clip, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.clips.with_streaming_response.create( + stream_id=0, + duration=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + clip = await response.parse() + assert_matches_type(Clip, clip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + clip = await async_client.streaming.streams.clips.list( + 0, + ) + assert_matches_type(ClipListResponse, clip, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.streaming.streams.clips.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + clip = await response.parse() + assert_matches_type(ClipListResponse, clip, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.streaming.streams.clips.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + clip = await response.parse() + assert_matches_type(ClipListResponse, clip, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/streaming/test_streams.py b/tests/api_resources/streaming/test_streams.py index dfe61205..826f44bb 100644 --- a/tests/api_resources/streaming/test_streams.py +++ b/tests/api_resources/streaming/test_streams.py @@ -11,10 +11,8 @@ from tests.utils import assert_matches_type from gcore.pagination import SyncPageStreaming, AsyncPageStreaming from gcore.types.streaming import ( - Clip, Video, Stream, - StreamListClipsResponse, StreamStartRecordingResponse, ) @@ -228,51 +226,6 @@ def test_streaming_response_clear_dvr(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_create_clip(self, client: Gcore) -> None: - stream = client.streaming.streams.create_clip( - stream_id=0, - duration=0, - ) - assert_matches_type(Clip, stream, path=["response"]) - - @parametrize - def test_method_create_clip_with_all_params(self, client: Gcore) -> None: - stream = client.streaming.streams.create_clip( - stream_id=0, - duration=0, - expiration=0, - start=0, - vod_required=True, - ) - assert_matches_type(Clip, stream, path=["response"]) - - @parametrize - def test_raw_response_create_clip(self, client: Gcore) -> None: - response = client.streaming.streams.with_raw_response.create_clip( - stream_id=0, - duration=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - stream = response.parse() - assert_matches_type(Clip, stream, path=["response"]) - - @parametrize - def test_streaming_response_create_clip(self, client: Gcore) -> None: - with client.streaming.streams.with_streaming_response.create_clip( - stream_id=0, - duration=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - stream = response.parse() - assert_matches_type(Clip, stream, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize def test_method_get(self, client: Gcore) -> None: stream = client.streaming.streams.get( @@ -304,37 +257,6 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_list_clips(self, client: Gcore) -> None: - stream = client.streaming.streams.list_clips( - 0, - ) - assert_matches_type(StreamListClipsResponse, stream, path=["response"]) - - @parametrize - def test_raw_response_list_clips(self, client: Gcore) -> None: - response = client.streaming.streams.with_raw_response.list_clips( - 0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - stream = response.parse() - assert_matches_type(StreamListClipsResponse, stream, path=["response"]) - - @parametrize - def test_streaming_response_list_clips(self, client: Gcore) -> None: - with client.streaming.streams.with_streaming_response.list_clips( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - stream = response.parse() - assert_matches_type(StreamListClipsResponse, stream, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize def test_method_start_recording(self, client: Gcore) -> None: stream = client.streaming.streams.start_recording( @@ -607,51 +529,6 @@ async def test_streaming_response_clear_dvr(self, async_client: AsyncGcore) -> N assert cast(Any, response.is_closed) is True - @parametrize - async def test_method_create_clip(self, async_client: AsyncGcore) -> None: - stream = await async_client.streaming.streams.create_clip( - stream_id=0, - duration=0, - ) - assert_matches_type(Clip, stream, path=["response"]) - - @parametrize - async def test_method_create_clip_with_all_params(self, async_client: AsyncGcore) -> None: - stream = await async_client.streaming.streams.create_clip( - stream_id=0, - duration=0, - expiration=0, - start=0, - vod_required=True, - ) - assert_matches_type(Clip, stream, path=["response"]) - - @parametrize - async def test_raw_response_create_clip(self, async_client: AsyncGcore) -> None: - response = await async_client.streaming.streams.with_raw_response.create_clip( - stream_id=0, - duration=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - stream = await response.parse() - assert_matches_type(Clip, stream, path=["response"]) - - @parametrize - async def test_streaming_response_create_clip(self, async_client: AsyncGcore) -> None: - async with async_client.streaming.streams.with_streaming_response.create_clip( - stream_id=0, - duration=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - stream = await response.parse() - assert_matches_type(Clip, stream, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: stream = await async_client.streaming.streams.get( @@ -683,37 +560,6 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - async def test_method_list_clips(self, async_client: AsyncGcore) -> None: - stream = await async_client.streaming.streams.list_clips( - 0, - ) - assert_matches_type(StreamListClipsResponse, stream, path=["response"]) - - @parametrize - async def test_raw_response_list_clips(self, async_client: AsyncGcore) -> None: - response = await async_client.streaming.streams.with_raw_response.list_clips( - 0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - stream = await response.parse() - assert_matches_type(StreamListClipsResponse, stream, path=["response"]) - - @parametrize - async def test_streaming_response_list_clips(self, async_client: AsyncGcore) -> None: - async with async_client.streaming.streams.with_streaming_response.list_clips( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - stream = await response.parse() - assert_matches_type(StreamListClipsResponse, stream, path=["response"]) - - assert cast(Any, response.is_closed) is True - @parametrize async def test_method_start_recording(self, async_client: AsyncGcore) -> None: stream = await async_client.streaming.streams.start_recording( From ec4aa2f3be9e9c716c83ab99d64806a5ac3b7e7e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:58:02 +0000 Subject: [PATCH 584/592] fix(waap)!: split api_discovery methods into scan_results, openapi, and settings subresources --- .stats.yml | 2 +- src/gcore/resources/waap/api.md | 38 +- .../resources/waap/domains/api_discovery.py | 763 ------------------ .../waap/domains/api_discovery/__init__.py | 61 ++ .../domains/api_discovery/api_discovery.py | 166 ++++ .../waap/domains/api_discovery/openapi.py | 283 +++++++ .../domains/api_discovery/scan_results.py | 351 ++++++++ .../waap/domains/api_discovery/settings.py | 299 +++++++ src/gcore/resources/waap/domains/domains.py | 16 +- src/gcore/types/waap/domains/__init__.py | 8 - .../waap/domains/api_discovery/__init__.py | 10 + .../openapi_upload_params.py} | 4 +- .../scan_result_list_params.py} | 4 +- .../setting_update_params.py} | 6 +- .../waap_api_discovery_settings.py | 2 +- .../waap_api_scan_result.py | 2 +- .../{ => api_discovery}/waap_task_id.py | 2 +- .../waap/domains/api_discovery/__init__.py | 1 + .../domains/api_discovery/test_openapi.py | 160 ++++ .../api_discovery/test_scan_results.py | 197 +++++ .../domains/api_discovery/test_settings.py | 172 ++++ .../waap/domains/test_api_discovery.py | 485 ----------- 22 files changed, 1750 insertions(+), 1282 deletions(-) delete mode 100644 src/gcore/resources/waap/domains/api_discovery.py create mode 100644 src/gcore/resources/waap/domains/api_discovery/__init__.py create mode 100644 src/gcore/resources/waap/domains/api_discovery/api_discovery.py create mode 100644 src/gcore/resources/waap/domains/api_discovery/openapi.py create mode 100644 src/gcore/resources/waap/domains/api_discovery/scan_results.py create mode 100644 src/gcore/resources/waap/domains/api_discovery/settings.py create mode 100644 src/gcore/types/waap/domains/api_discovery/__init__.py rename src/gcore/types/waap/domains/{api_discovery_upload_openapi_params.py => api_discovery/openapi_upload_params.py} (79%) rename src/gcore/types/waap/domains/{api_discovery_list_scan_results_params.py => api_discovery/scan_result_list_params.py} (89%) rename src/gcore/types/waap/domains/{api_discovery_update_settings_params.py => api_discovery/setting_update_params.py} (89%) rename src/gcore/types/waap/domains/{ => api_discovery}/waap_api_discovery_settings.py (97%) rename src/gcore/types/waap/domains/{ => api_discovery}/waap_api_scan_result.py (95%) rename src/gcore/types/waap/domains/{ => api_discovery}/waap_task_id.py (86%) create mode 100644 tests/api_resources/waap/domains/api_discovery/__init__.py create mode 100644 tests/api_resources/waap/domains/api_discovery/test_openapi.py create mode 100644 tests/api_resources/waap/domains/api_discovery/test_scan_results.py create mode 100644 tests/api_resources/waap/domains/api_discovery/test_settings.py delete mode 100644 tests/api_resources/waap/domains/test_api_discovery.py diff --git a/.stats.yml b/.stats.yml index a58aaa95..a273f540 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-691d7fc7d687ca367474bc78eb880f6f964454dc82259cdbb75fb90bd92c67ec.yml openapi_spec_hash: 97a4cbc8d7b05b1dc58319331717e8e7 -config_hash: b07ea4587f9078d7da7d498163b001b5 +config_hash: a5fc65645e723807b401a8e277b7f9a7 diff --git a/src/gcore/resources/waap/api.md b/src/gcore/resources/waap/api.md index 52a55dc6..b357ca54 100644 --- a/src/gcore/resources/waap/api.md +++ b/src/gcore/resources/waap/api.md @@ -85,20 +85,44 @@ Methods: ### APIDiscovery +#### ScanResults + +Types: + +```python +from gcore.types.waap.domains.api_discovery import WaapAPIScanResult +``` + +Methods: + +- client.waap.domains.api_discovery.scan_results.list(domain_id, \*\*params) -> SyncOffsetPage[WaapAPIScanResult] +- client.waap.domains.api_discovery.scan_results.get(scan_id, \*, domain_id) -> WaapAPIScanResult + +#### OpenAPI + +Types: + +```python +from gcore.types.waap.domains.api_discovery import WaapTaskID +``` + +Methods: + +- client.waap.domains.api_discovery.openapi.scan(domain_id) -> WaapTaskID +- client.waap.domains.api_discovery.openapi.upload(domain_id, \*\*params) -> WaapTaskID + +#### Settings + Types: ```python -from gcore.types.waap.domains import WaapAPIDiscoverySettings, WaapAPIScanResult, WaapTaskID +from gcore.types.waap.domains.api_discovery import WaapAPIDiscoverySettings ``` Methods: -- client.waap.domains.api_discovery.get_scan_result(scan_id, \*, domain_id) -> WaapAPIScanResult -- client.waap.domains.api_discovery.get_settings(domain_id) -> WaapAPIDiscoverySettings -- client.waap.domains.api_discovery.list_scan_results(domain_id, \*\*params) -> SyncOffsetPage[WaapAPIScanResult] -- client.waap.domains.api_discovery.scan_openapi(domain_id) -> WaapTaskID -- client.waap.domains.api_discovery.update_settings(domain_id, \*\*params) -> WaapAPIDiscoverySettings -- client.waap.domains.api_discovery.upload_openapi(domain_id, \*\*params) -> WaapTaskID +- client.waap.domains.api_discovery.settings.update(domain_id, \*\*params) -> WaapAPIDiscoverySettings +- client.waap.domains.api_discovery.settings.get(domain_id) -> WaapAPIDiscoverySettings ### Insights diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py deleted file mode 100644 index f83862da..00000000 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ /dev/null @@ -1,763 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Literal - -import httpx - -from ...._types import Body, Omit, Query, Headers, 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 ....pagination import SyncOffsetPage, AsyncOffsetPage -from ...._base_client import AsyncPaginator, make_request_options -from ....types.waap.domains import ( - api_discovery_upload_openapi_params, - api_discovery_update_settings_params, - api_discovery_list_scan_results_params, -) -from ....types.waap.domains.waap_task_id import WaapTaskID -from ....types.waap.domains.waap_api_scan_result import WaapAPIScanResult -from ....types.waap.domains.waap_api_discovery_settings import WaapAPIDiscoverySettings - -__all__ = ["APIDiscoveryResource", "AsyncAPIDiscoveryResource"] - - -class APIDiscoveryResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> APIDiscoveryResourceWithRawResponse: - """ - 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 APIDiscoveryResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> APIDiscoveryResourceWithStreamingResponse: - """ - 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 APIDiscoveryResourceWithStreamingResponse(self) - - def get_scan_result( - self, - scan_id: str, - *, - domain_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, - ) -> WaapAPIScanResult: - """ - Get Scan Result - - Args: - domain_id: The domain ID - - scan_id: The scan ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not scan_id: - raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") - return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapAPIScanResult, - ) - - def get_settings( - self, - domain_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, - ) -> WaapAPIDiscoverySettings: - """ - Retrieve the API discovery settings for a domain - - Args: - domain_id: The domain ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapAPIDiscoverySettings, - ) - - def list_scan_results( - self, - domain_id: int, - *, - limit: int | Omit = omit, - message: Optional[str] | Omit = omit, - offset: int | Omit = omit, - ordering: Literal[ - "id", - "type", - "start_time", - "end_time", - "status", - "message", - "-id", - "-type", - "-start_time", - "-end_time", - "-status", - "-message", - ] - | Omit = omit, - status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | Omit = omit, - type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncOffsetPage[WaapAPIScanResult]: - """ - Get Scan Results - - Args: - domain_id: The domain ID - - limit: Number of items to return - - message: Filter by the message of the scan. Supports '\\**' as a wildcard character - - offset: Number of items to skip - - ordering: Sort the response by given field. - - status: Filter by the status of the scan - - type: Filter by the path of the scan type - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", - page=SyncOffsetPage[WaapAPIScanResult], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "limit": limit, - "message": message, - "offset": offset, - "ordering": ordering, - "status": status, - "type": type, - }, - api_discovery_list_scan_results_params.APIDiscoveryListScanResultsParams, - ), - ), - model=WaapAPIScanResult, - ) - - def scan_openapi( - self, - domain_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, - ) -> WaapTaskID: - """Scan an API description file hosted online. - - The file must be in YAML or JSON - format and adhere to the OpenAPI specification. The location of the API - description file should be specified in the API discovery settings. - - Args: - domain_id: The domain ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapTaskID, - ) - - def update_settings( - self, - domain_id: int, - *, - description_file_location: Optional[str] | Omit = omit, - description_file_scan_enabled: Optional[bool] | Omit = omit, - description_file_scan_interval_hours: Optional[int] | Omit = omit, - traffic_scan_enabled: Optional[bool] | Omit = omit, - traffic_scan_interval_hours: Optional[int] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WaapAPIDiscoverySettings: - """ - Update the API discovery settings for a domain - - Args: - domain_id: The domain ID - - description_file_location: The URL of the API description file. This will be periodically scanned if - `descriptionFileScanEnabled` is enabled. Supported formats are YAML and JSON, - and it must adhere to OpenAPI versions 2, 3, or 3.1. - - description_file_scan_enabled: Indicates if periodic scan of the description file is enabled - - description_file_scan_interval_hours: The interval in hours for scanning the description file - - traffic_scan_enabled: Indicates if traffic scan is enabled - - traffic_scan_interval_hours: The interval in hours for scanning the traffic - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", - body=maybe_transform( - { - "description_file_location": description_file_location, - "description_file_scan_enabled": description_file_scan_enabled, - "description_file_scan_interval_hours": description_file_scan_interval_hours, - "traffic_scan_enabled": traffic_scan_enabled, - "traffic_scan_interval_hours": traffic_scan_interval_hours, - }, - api_discovery_update_settings_params.APIDiscoveryUpdateSettingsParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapAPIDiscoverySettings, - ) - - def upload_openapi( - self, - domain_id: int, - *, - file_data: str, - file_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, - ) -> WaapTaskID: - """ - An API description file must adhere to the OpenAPI specification and be written - in YAML or JSON format. The file name should be provided as the value for the - `file_name` parameter. The contents of the file must be base64 encoded and - supplied as the value for the `file_data` parameter. - - Args: - domain_id: The domain ID - - file_data: Base64 representation of the description file. Supported formats are YAML and - JSON, and it must adhere to OpenAPI versions 2, 3, or 3.1. - - file_name: The name of the file - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload", - body=maybe_transform( - { - "file_data": file_data, - "file_name": file_name, - }, - api_discovery_upload_openapi_params.APIDiscoveryUploadOpenAPIParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapTaskID, - ) - - -class AsyncAPIDiscoveryResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAPIDiscoveryResourceWithRawResponse: - """ - 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 AsyncAPIDiscoveryResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAPIDiscoveryResourceWithStreamingResponse: - """ - 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 AsyncAPIDiscoveryResourceWithStreamingResponse(self) - - async def get_scan_result( - self, - scan_id: str, - *, - domain_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, - ) -> WaapAPIScanResult: - """ - Get Scan Result - - Args: - domain_id: The domain ID - - scan_id: The scan ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not scan_id: - raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") - return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapAPIScanResult, - ) - - async def get_settings( - self, - domain_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, - ) -> WaapAPIDiscoverySettings: - """ - Retrieve the API discovery settings for a domain - - Args: - domain_id: The domain ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapAPIDiscoverySettings, - ) - - def list_scan_results( - self, - domain_id: int, - *, - limit: int | Omit = omit, - message: Optional[str] | Omit = omit, - offset: int | Omit = omit, - ordering: Literal[ - "id", - "type", - "start_time", - "end_time", - "status", - "message", - "-id", - "-type", - "-start_time", - "-end_time", - "-status", - "-message", - ] - | Omit = omit, - status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | Omit = omit, - type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[WaapAPIScanResult, AsyncOffsetPage[WaapAPIScanResult]]: - """ - Get Scan Results - - Args: - domain_id: The domain ID - - limit: Number of items to return - - message: Filter by the message of the scan. Supports '\\**' as a wildcard character - - offset: Number of items to skip - - ordering: Sort the response by given field. - - status: Filter by the status of the scan - - type: Filter by the path of the scan type - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", - page=AsyncOffsetPage[WaapAPIScanResult], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "limit": limit, - "message": message, - "offset": offset, - "ordering": ordering, - "status": status, - "type": type, - }, - api_discovery_list_scan_results_params.APIDiscoveryListScanResultsParams, - ), - ), - model=WaapAPIScanResult, - ) - - async def scan_openapi( - self, - domain_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, - ) -> WaapTaskID: - """Scan an API description file hosted online. - - The file must be in YAML or JSON - format and adhere to the OpenAPI specification. The location of the API - description file should be specified in the API discovery settings. - - Args: - domain_id: The domain ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapTaskID, - ) - - async def update_settings( - self, - domain_id: int, - *, - description_file_location: Optional[str] | Omit = omit, - description_file_scan_enabled: Optional[bool] | Omit = omit, - description_file_scan_interval_hours: Optional[int] | Omit = omit, - traffic_scan_enabled: Optional[bool] | Omit = omit, - traffic_scan_interval_hours: Optional[int] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WaapAPIDiscoverySettings: - """ - Update the API discovery settings for a domain - - Args: - domain_id: The domain ID - - description_file_location: The URL of the API description file. This will be periodically scanned if - `descriptionFileScanEnabled` is enabled. Supported formats are YAML and JSON, - and it must adhere to OpenAPI versions 2, 3, or 3.1. - - description_file_scan_enabled: Indicates if periodic scan of the description file is enabled - - description_file_scan_interval_hours: The interval in hours for scanning the description file - - traffic_scan_enabled: Indicates if traffic scan is enabled - - traffic_scan_interval_hours: The interval in hours for scanning the traffic - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", - body=await async_maybe_transform( - { - "description_file_location": description_file_location, - "description_file_scan_enabled": description_file_scan_enabled, - "description_file_scan_interval_hours": description_file_scan_interval_hours, - "traffic_scan_enabled": traffic_scan_enabled, - "traffic_scan_interval_hours": traffic_scan_interval_hours, - }, - api_discovery_update_settings_params.APIDiscoveryUpdateSettingsParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapAPIDiscoverySettings, - ) - - async def upload_openapi( - self, - domain_id: int, - *, - file_data: str, - file_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, - ) -> WaapTaskID: - """ - An API description file must adhere to the OpenAPI specification and be written - in YAML or JSON format. The file name should be provided as the value for the - `file_name` parameter. The contents of the file must be base64 encoded and - supplied as the value for the `file_data` parameter. - - Args: - domain_id: The domain ID - - file_data: Base64 representation of the description file. Supported formats are YAML and - JSON, and it must adhere to OpenAPI versions 2, 3, or 3.1. - - file_name: The name of the file - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload", - body=await async_maybe_transform( - { - "file_data": file_data, - "file_name": file_name, - }, - api_discovery_upload_openapi_params.APIDiscoveryUploadOpenAPIParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapTaskID, - ) - - -class APIDiscoveryResourceWithRawResponse: - def __init__(self, api_discovery: APIDiscoveryResource) -> None: - self._api_discovery = api_discovery - - self.get_scan_result = to_raw_response_wrapper( - api_discovery.get_scan_result, - ) - self.get_settings = to_raw_response_wrapper( - api_discovery.get_settings, - ) - self.list_scan_results = to_raw_response_wrapper( - api_discovery.list_scan_results, - ) - self.scan_openapi = to_raw_response_wrapper( - api_discovery.scan_openapi, - ) - self.update_settings = to_raw_response_wrapper( - api_discovery.update_settings, - ) - self.upload_openapi = to_raw_response_wrapper( - api_discovery.upload_openapi, - ) - - -class AsyncAPIDiscoveryResourceWithRawResponse: - def __init__(self, api_discovery: AsyncAPIDiscoveryResource) -> None: - self._api_discovery = api_discovery - - self.get_scan_result = async_to_raw_response_wrapper( - api_discovery.get_scan_result, - ) - self.get_settings = async_to_raw_response_wrapper( - api_discovery.get_settings, - ) - self.list_scan_results = async_to_raw_response_wrapper( - api_discovery.list_scan_results, - ) - self.scan_openapi = async_to_raw_response_wrapper( - api_discovery.scan_openapi, - ) - self.update_settings = async_to_raw_response_wrapper( - api_discovery.update_settings, - ) - self.upload_openapi = async_to_raw_response_wrapper( - api_discovery.upload_openapi, - ) - - -class APIDiscoveryResourceWithStreamingResponse: - def __init__(self, api_discovery: APIDiscoveryResource) -> None: - self._api_discovery = api_discovery - - self.get_scan_result = to_streamed_response_wrapper( - api_discovery.get_scan_result, - ) - self.get_settings = to_streamed_response_wrapper( - api_discovery.get_settings, - ) - self.list_scan_results = to_streamed_response_wrapper( - api_discovery.list_scan_results, - ) - self.scan_openapi = to_streamed_response_wrapper( - api_discovery.scan_openapi, - ) - self.update_settings = to_streamed_response_wrapper( - api_discovery.update_settings, - ) - self.upload_openapi = to_streamed_response_wrapper( - api_discovery.upload_openapi, - ) - - -class AsyncAPIDiscoveryResourceWithStreamingResponse: - def __init__(self, api_discovery: AsyncAPIDiscoveryResource) -> None: - self._api_discovery = api_discovery - - self.get_scan_result = async_to_streamed_response_wrapper( - api_discovery.get_scan_result, - ) - self.get_settings = async_to_streamed_response_wrapper( - api_discovery.get_settings, - ) - self.list_scan_results = async_to_streamed_response_wrapper( - api_discovery.list_scan_results, - ) - self.scan_openapi = async_to_streamed_response_wrapper( - api_discovery.scan_openapi, - ) - self.update_settings = async_to_streamed_response_wrapper( - api_discovery.update_settings, - ) - self.upload_openapi = async_to_streamed_response_wrapper( - api_discovery.upload_openapi, - ) diff --git a/src/gcore/resources/waap/domains/api_discovery/__init__.py b/src/gcore/resources/waap/domains/api_discovery/__init__.py new file mode 100644 index 00000000..1c78d928 --- /dev/null +++ b/src/gcore/resources/waap/domains/api_discovery/__init__.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .openapi import ( + OpenAPIResource, + AsyncOpenAPIResource, + OpenAPIResourceWithRawResponse, + AsyncOpenAPIResourceWithRawResponse, + OpenAPIResourceWithStreamingResponse, + AsyncOpenAPIResourceWithStreamingResponse, +) +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) +from .scan_results import ( + ScanResultsResource, + AsyncScanResultsResource, + ScanResultsResourceWithRawResponse, + AsyncScanResultsResourceWithRawResponse, + ScanResultsResourceWithStreamingResponse, + AsyncScanResultsResourceWithStreamingResponse, +) +from .api_discovery import ( + APIDiscoveryResource, + AsyncAPIDiscoveryResource, + APIDiscoveryResourceWithRawResponse, + AsyncAPIDiscoveryResourceWithRawResponse, + APIDiscoveryResourceWithStreamingResponse, + AsyncAPIDiscoveryResourceWithStreamingResponse, +) + +__all__ = [ + "ScanResultsResource", + "AsyncScanResultsResource", + "ScanResultsResourceWithRawResponse", + "AsyncScanResultsResourceWithRawResponse", + "ScanResultsResourceWithStreamingResponse", + "AsyncScanResultsResourceWithStreamingResponse", + "OpenAPIResource", + "AsyncOpenAPIResource", + "OpenAPIResourceWithRawResponse", + "AsyncOpenAPIResourceWithRawResponse", + "OpenAPIResourceWithStreamingResponse", + "AsyncOpenAPIResourceWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "APIDiscoveryResource", + "AsyncAPIDiscoveryResource", + "APIDiscoveryResourceWithRawResponse", + "AsyncAPIDiscoveryResourceWithRawResponse", + "APIDiscoveryResourceWithStreamingResponse", + "AsyncAPIDiscoveryResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/waap/domains/api_discovery/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery/api_discovery.py new file mode 100644 index 00000000..e9303956 --- /dev/null +++ b/src/gcore/resources/waap/domains/api_discovery/api_discovery.py @@ -0,0 +1,166 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .openapi import ( + OpenAPIResource, + AsyncOpenAPIResource, + OpenAPIResourceWithRawResponse, + AsyncOpenAPIResourceWithRawResponse, + OpenAPIResourceWithStreamingResponse, + AsyncOpenAPIResourceWithStreamingResponse, +) +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) +from ....._compat import cached_property +from .scan_results import ( + ScanResultsResource, + AsyncScanResultsResource, + ScanResultsResourceWithRawResponse, + AsyncScanResultsResourceWithRawResponse, + ScanResultsResourceWithStreamingResponse, + AsyncScanResultsResourceWithStreamingResponse, +) +from ....._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["APIDiscoveryResource", "AsyncAPIDiscoveryResource"] + + +class APIDiscoveryResource(SyncAPIResource): + @cached_property + def scan_results(self) -> ScanResultsResource: + return ScanResultsResource(self._client) + + @cached_property + def openapi(self) -> OpenAPIResource: + return OpenAPIResource(self._client) + + @cached_property + def settings(self) -> SettingsResource: + return SettingsResource(self._client) + + @cached_property + def with_raw_response(self) -> APIDiscoveryResourceWithRawResponse: + """ + 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 APIDiscoveryResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> APIDiscoveryResourceWithStreamingResponse: + """ + 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 APIDiscoveryResourceWithStreamingResponse(self) + + +class AsyncAPIDiscoveryResource(AsyncAPIResource): + @cached_property + def scan_results(self) -> AsyncScanResultsResource: + return AsyncScanResultsResource(self._client) + + @cached_property + def openapi(self) -> AsyncOpenAPIResource: + return AsyncOpenAPIResource(self._client) + + @cached_property + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncAPIDiscoveryResourceWithRawResponse: + """ + 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 AsyncAPIDiscoveryResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAPIDiscoveryResourceWithStreamingResponse: + """ + 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 AsyncAPIDiscoveryResourceWithStreamingResponse(self) + + +class APIDiscoveryResourceWithRawResponse: + def __init__(self, api_discovery: APIDiscoveryResource) -> None: + self._api_discovery = api_discovery + + @cached_property + def scan_results(self) -> ScanResultsResourceWithRawResponse: + return ScanResultsResourceWithRawResponse(self._api_discovery.scan_results) + + @cached_property + def openapi(self) -> OpenAPIResourceWithRawResponse: + return OpenAPIResourceWithRawResponse(self._api_discovery.openapi) + + @cached_property + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._api_discovery.settings) + + +class AsyncAPIDiscoveryResourceWithRawResponse: + def __init__(self, api_discovery: AsyncAPIDiscoveryResource) -> None: + self._api_discovery = api_discovery + + @cached_property + def scan_results(self) -> AsyncScanResultsResourceWithRawResponse: + return AsyncScanResultsResourceWithRawResponse(self._api_discovery.scan_results) + + @cached_property + def openapi(self) -> AsyncOpenAPIResourceWithRawResponse: + return AsyncOpenAPIResourceWithRawResponse(self._api_discovery.openapi) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._api_discovery.settings) + + +class APIDiscoveryResourceWithStreamingResponse: + def __init__(self, api_discovery: APIDiscoveryResource) -> None: + self._api_discovery = api_discovery + + @cached_property + def scan_results(self) -> ScanResultsResourceWithStreamingResponse: + return ScanResultsResourceWithStreamingResponse(self._api_discovery.scan_results) + + @cached_property + def openapi(self) -> OpenAPIResourceWithStreamingResponse: + return OpenAPIResourceWithStreamingResponse(self._api_discovery.openapi) + + @cached_property + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._api_discovery.settings) + + +class AsyncAPIDiscoveryResourceWithStreamingResponse: + def __init__(self, api_discovery: AsyncAPIDiscoveryResource) -> None: + self._api_discovery = api_discovery + + @cached_property + def scan_results(self) -> AsyncScanResultsResourceWithStreamingResponse: + return AsyncScanResultsResourceWithStreamingResponse(self._api_discovery.scan_results) + + @cached_property + def openapi(self) -> AsyncOpenAPIResourceWithStreamingResponse: + return AsyncOpenAPIResourceWithStreamingResponse(self._api_discovery.openapi) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._api_discovery.settings) diff --git a/src/gcore/resources/waap/domains/api_discovery/openapi.py b/src/gcore/resources/waap/domains/api_discovery/openapi.py new file mode 100644 index 00000000..1bc07a1b --- /dev/null +++ b/src/gcore/resources/waap/domains/api_discovery/openapi.py @@ -0,0 +1,283 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ....._types import Body, Query, Headers, NotGiven, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.waap.domains.api_discovery import openapi_upload_params +from .....types.waap.domains.api_discovery.waap_task_id import WaapTaskID + +__all__ = ["OpenAPIResource", "AsyncOpenAPIResource"] + + +class OpenAPIResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> OpenAPIResourceWithRawResponse: + """ + 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 OpenAPIResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> OpenAPIResourceWithStreamingResponse: + """ + 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 OpenAPIResourceWithStreamingResponse(self) + + def scan( + self, + domain_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, + ) -> WaapTaskID: + """Scan an API description file hosted online. + + The file must be in YAML or JSON + format and adhere to the OpenAPI specification. The location of the API + description file should be specified in the API discovery settings. + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/waap/v1/domains/{domain_id}/api-discovery/scan", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapTaskID, + ) + + def upload( + self, + domain_id: int, + *, + file_data: str, + file_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, + ) -> WaapTaskID: + """ + An API description file must adhere to the OpenAPI specification and be written + in YAML or JSON format. The file name should be provided as the value for the + `file_name` parameter. The contents of the file must be base64 encoded and + supplied as the value for the `file_data` parameter. + + Args: + domain_id: The domain ID + + file_data: Base64 representation of the description file. Supported formats are YAML and + JSON, and it must adhere to OpenAPI versions 2, 3, or 3.1. + + file_name: The name of the file + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + f"/waap/v1/domains/{domain_id}/api-discovery/upload", + body=maybe_transform( + { + "file_data": file_data, + "file_name": file_name, + }, + openapi_upload_params.OpenAPIUploadParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapTaskID, + ) + + +class AsyncOpenAPIResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncOpenAPIResourceWithRawResponse: + """ + 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 AsyncOpenAPIResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncOpenAPIResourceWithStreamingResponse: + """ + 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 AsyncOpenAPIResourceWithStreamingResponse(self) + + async def scan( + self, + domain_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, + ) -> WaapTaskID: + """Scan an API description file hosted online. + + The file must be in YAML or JSON + format and adhere to the OpenAPI specification. The location of the API + description file should be specified in the API discovery settings. + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/waap/v1/domains/{domain_id}/api-discovery/scan", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapTaskID, + ) + + async def upload( + self, + domain_id: int, + *, + file_data: str, + file_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, + ) -> WaapTaskID: + """ + An API description file must adhere to the OpenAPI specification and be written + in YAML or JSON format. The file name should be provided as the value for the + `file_name` parameter. The contents of the file must be base64 encoded and + supplied as the value for the `file_data` parameter. + + Args: + domain_id: The domain ID + + file_data: Base64 representation of the description file. Supported formats are YAML and + JSON, and it must adhere to OpenAPI versions 2, 3, or 3.1. + + file_name: The name of the file + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + f"/waap/v1/domains/{domain_id}/api-discovery/upload", + body=await async_maybe_transform( + { + "file_data": file_data, + "file_name": file_name, + }, + openapi_upload_params.OpenAPIUploadParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapTaskID, + ) + + +class OpenAPIResourceWithRawResponse: + def __init__(self, openapi: OpenAPIResource) -> None: + self._openapi = openapi + + self.scan = to_raw_response_wrapper( + openapi.scan, + ) + self.upload = to_raw_response_wrapper( + openapi.upload, + ) + + +class AsyncOpenAPIResourceWithRawResponse: + def __init__(self, openapi: AsyncOpenAPIResource) -> None: + self._openapi = openapi + + self.scan = async_to_raw_response_wrapper( + openapi.scan, + ) + self.upload = async_to_raw_response_wrapper( + openapi.upload, + ) + + +class OpenAPIResourceWithStreamingResponse: + def __init__(self, openapi: OpenAPIResource) -> None: + self._openapi = openapi + + self.scan = to_streamed_response_wrapper( + openapi.scan, + ) + self.upload = to_streamed_response_wrapper( + openapi.upload, + ) + + +class AsyncOpenAPIResourceWithStreamingResponse: + def __init__(self, openapi: AsyncOpenAPIResource) -> None: + self._openapi = openapi + + self.scan = async_to_streamed_response_wrapper( + openapi.scan, + ) + self.upload = async_to_streamed_response_wrapper( + openapi.upload, + ) diff --git a/src/gcore/resources/waap/domains/api_discovery/scan_results.py b/src/gcore/resources/waap/domains/api_discovery/scan_results.py new file mode 100644 index 00000000..31193f33 --- /dev/null +++ b/src/gcore/resources/waap/domains/api_discovery/scan_results.py @@ -0,0 +1,351 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ....._utils import maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .....pagination import SyncOffsetPage, AsyncOffsetPage +from ....._base_client import AsyncPaginator, make_request_options +from .....types.waap.domains.api_discovery import scan_result_list_params +from .....types.waap.domains.api_discovery.waap_api_scan_result import WaapAPIScanResult + +__all__ = ["ScanResultsResource", "AsyncScanResultsResource"] + + +class ScanResultsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ScanResultsResourceWithRawResponse: + """ + 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 ScanResultsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ScanResultsResourceWithStreamingResponse: + """ + 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 ScanResultsResourceWithStreamingResponse(self) + + def list( + self, + domain_id: int, + *, + limit: int | Omit = omit, + message: Optional[str] | Omit = omit, + offset: int | Omit = omit, + ordering: Literal[ + "id", + "type", + "start_time", + "end_time", + "status", + "message", + "-id", + "-type", + "-start_time", + "-end_time", + "-status", + "-message", + ] + | Omit = omit, + status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | Omit = omit, + type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncOffsetPage[WaapAPIScanResult]: + """ + Get Scan Results + + Args: + domain_id: The domain ID + + limit: Number of items to return + + message: Filter by the message of the scan. Supports '\\**' as a wildcard character + + offset: Number of items to skip + + ordering: Sort the response by given field. + + status: Filter by the status of the scan + + type: Filter by the path of the scan type + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + page=SyncOffsetPage[WaapAPIScanResult], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "message": message, + "offset": offset, + "ordering": ordering, + "status": status, + "type": type, + }, + scan_result_list_params.ScanResultListParams, + ), + ), + model=WaapAPIScanResult, + ) + + def get( + self, + scan_id: str, + *, + domain_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, + ) -> WaapAPIScanResult: + """ + Get Scan Result + + Args: + domain_id: The domain ID + + scan_id: The scan ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not scan_id: + raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") + return self._get( + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapAPIScanResult, + ) + + +class AsyncScanResultsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncScanResultsResourceWithRawResponse: + """ + 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 AsyncScanResultsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncScanResultsResourceWithStreamingResponse: + """ + 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 AsyncScanResultsResourceWithStreamingResponse(self) + + def list( + self, + domain_id: int, + *, + limit: int | Omit = omit, + message: Optional[str] | Omit = omit, + offset: int | Omit = omit, + ordering: Literal[ + "id", + "type", + "start_time", + "end_time", + "status", + "message", + "-id", + "-type", + "-start_time", + "-end_time", + "-status", + "-message", + ] + | Omit = omit, + status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | Omit = omit, + type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[WaapAPIScanResult, AsyncOffsetPage[WaapAPIScanResult]]: + """ + Get Scan Results + + Args: + domain_id: The domain ID + + limit: Number of items to return + + message: Filter by the message of the scan. Supports '\\**' as a wildcard character + + offset: Number of items to skip + + ordering: Sort the response by given field. + + status: Filter by the status of the scan + + type: Filter by the path of the scan type + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + page=AsyncOffsetPage[WaapAPIScanResult], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "message": message, + "offset": offset, + "ordering": ordering, + "status": status, + "type": type, + }, + scan_result_list_params.ScanResultListParams, + ), + ), + model=WaapAPIScanResult, + ) + + async def get( + self, + scan_id: str, + *, + domain_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, + ) -> WaapAPIScanResult: + """ + Get Scan Result + + Args: + domain_id: The domain ID + + scan_id: The scan ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not scan_id: + raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") + return await self._get( + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapAPIScanResult, + ) + + +class ScanResultsResourceWithRawResponse: + def __init__(self, scan_results: ScanResultsResource) -> None: + self._scan_results = scan_results + + self.list = to_raw_response_wrapper( + scan_results.list, + ) + self.get = to_raw_response_wrapper( + scan_results.get, + ) + + +class AsyncScanResultsResourceWithRawResponse: + def __init__(self, scan_results: AsyncScanResultsResource) -> None: + self._scan_results = scan_results + + self.list = async_to_raw_response_wrapper( + scan_results.list, + ) + self.get = async_to_raw_response_wrapper( + scan_results.get, + ) + + +class ScanResultsResourceWithStreamingResponse: + def __init__(self, scan_results: ScanResultsResource) -> None: + self._scan_results = scan_results + + self.list = to_streamed_response_wrapper( + scan_results.list, + ) + self.get = to_streamed_response_wrapper( + scan_results.get, + ) + + +class AsyncScanResultsResourceWithStreamingResponse: + def __init__(self, scan_results: AsyncScanResultsResource) -> None: + self._scan_results = scan_results + + self.list = async_to_streamed_response_wrapper( + scan_results.list, + ) + self.get = async_to_streamed_response_wrapper( + scan_results.get, + ) diff --git a/src/gcore/resources/waap/domains/api_discovery/settings.py b/src/gcore/resources/waap/domains/api_discovery/settings.py new file mode 100644 index 00000000..1b4b35eb --- /dev/null +++ b/src/gcore/resources/waap/domains/api_discovery/settings.py @@ -0,0 +1,299 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._base_client import make_request_options +from .....types.waap.domains.api_discovery import setting_update_params +from .....types.waap.domains.api_discovery.waap_api_discovery_settings import WaapAPIDiscoverySettings + +__all__ = ["SettingsResource", "AsyncSettingsResource"] + + +class SettingsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SettingsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return SettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return SettingsResourceWithStreamingResponse(self) + + def update( + self, + domain_id: int, + *, + description_file_location: Optional[str] | Omit = omit, + description_file_scan_enabled: Optional[bool] | Omit = omit, + description_file_scan_interval_hours: Optional[int] | Omit = omit, + traffic_scan_enabled: Optional[bool] | Omit = omit, + traffic_scan_interval_hours: Optional[int] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> WaapAPIDiscoverySettings: + """ + Update the API discovery settings for a domain + + Args: + domain_id: The domain ID + + description_file_location: The URL of the API description file. This will be periodically scanned if + `descriptionFileScanEnabled` is enabled. Supported formats are YAML and JSON, + and it must adhere to OpenAPI versions 2, 3, or 3.1. + + description_file_scan_enabled: Indicates if periodic scan of the description file is enabled + + description_file_scan_interval_hours: The interval in hours for scanning the description file + + traffic_scan_enabled: Indicates if traffic scan is enabled + + traffic_scan_interval_hours: The interval in hours for scanning the traffic + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._patch( + f"/waap/v1/domains/{domain_id}/api-discovery/settings", + body=maybe_transform( + { + "description_file_location": description_file_location, + "description_file_scan_enabled": description_file_scan_enabled, + "description_file_scan_interval_hours": description_file_scan_interval_hours, + "traffic_scan_enabled": traffic_scan_enabled, + "traffic_scan_interval_hours": traffic_scan_interval_hours, + }, + setting_update_params.SettingUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapAPIDiscoverySettings, + ) + + def get( + self, + domain_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, + ) -> WaapAPIDiscoverySettings: + """ + Retrieve the API discovery settings for a domain + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + f"/waap/v1/domains/{domain_id}/api-discovery/settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapAPIDiscoverySettings, + ) + + +class AsyncSettingsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncSettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncSettingsResourceWithStreamingResponse(self) + + async def update( + self, + domain_id: int, + *, + description_file_location: Optional[str] | Omit = omit, + description_file_scan_enabled: Optional[bool] | Omit = omit, + description_file_scan_interval_hours: Optional[int] | Omit = omit, + traffic_scan_enabled: Optional[bool] | Omit = omit, + traffic_scan_interval_hours: Optional[int] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> WaapAPIDiscoverySettings: + """ + Update the API discovery settings for a domain + + Args: + domain_id: The domain ID + + description_file_location: The URL of the API description file. This will be periodically scanned if + `descriptionFileScanEnabled` is enabled. Supported formats are YAML and JSON, + and it must adhere to OpenAPI versions 2, 3, or 3.1. + + description_file_scan_enabled: Indicates if periodic scan of the description file is enabled + + description_file_scan_interval_hours: The interval in hours for scanning the description file + + traffic_scan_enabled: Indicates if traffic scan is enabled + + traffic_scan_interval_hours: The interval in hours for scanning the traffic + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._patch( + f"/waap/v1/domains/{domain_id}/api-discovery/settings", + body=await async_maybe_transform( + { + "description_file_location": description_file_location, + "description_file_scan_enabled": description_file_scan_enabled, + "description_file_scan_interval_hours": description_file_scan_interval_hours, + "traffic_scan_enabled": traffic_scan_enabled, + "traffic_scan_interval_hours": traffic_scan_interval_hours, + }, + setting_update_params.SettingUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapAPIDiscoverySettings, + ) + + async def get( + self, + domain_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, + ) -> WaapAPIDiscoverySettings: + """ + Retrieve the API discovery settings for a domain + + Args: + domain_id: The domain ID + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + f"/waap/v1/domains/{domain_id}/api-discovery/settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapAPIDiscoverySettings, + ) + + +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings + + self.update = to_raw_response_wrapper( + settings.update, + ) + self.get = to_raw_response_wrapper( + settings.get, + ) + + +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings + + self.update = async_to_raw_response_wrapper( + settings.update, + ) + self.get = async_to_raw_response_wrapper( + settings.get, + ) + + +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings + + self.update = to_streamed_response_wrapper( + settings.update, + ) + self.get = to_streamed_response_wrapper( + settings.get, + ) + + +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings + + self.update = async_to_streamed_response_wrapper( + settings.update, + ) + self.get = async_to_streamed_response_wrapper( + settings.get, + ) diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index 644191c1..d8be440c 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -59,14 +59,6 @@ ) from ....pagination import SyncOffsetPage, AsyncOffsetPage from ....types.waap import domain_list_params, domain_update_params -from .api_discovery import ( - APIDiscoveryResource, - AsyncAPIDiscoveryResource, - APIDiscoveryResourceWithRawResponse, - AsyncAPIDiscoveryResourceWithRawResponse, - APIDiscoveryResourceWithStreamingResponse, - AsyncAPIDiscoveryResourceWithStreamingResponse, -) from .advanced_rules import ( AdvancedRulesResource, AsyncAdvancedRulesResource, @@ -100,6 +92,14 @@ InsightSilencesResourceWithStreamingResponse, AsyncInsightSilencesResourceWithStreamingResponse, ) +from .api_discovery.api_discovery import ( + APIDiscoveryResource, + AsyncAPIDiscoveryResource, + APIDiscoveryResourceWithRawResponse, + AsyncAPIDiscoveryResourceWithRawResponse, + APIDiscoveryResourceWithStreamingResponse, + AsyncAPIDiscoveryResourceWithStreamingResponse, +) from ....types.waap.waap_policy_mode import WaapPolicyMode from ....types.waap.waap_summary_domain import WaapSummaryDomain from ....types.waap.waap_detailed_domain import WaapDetailedDomain diff --git a/src/gcore/types/waap/domains/__init__.py b/src/gcore/types/waap/domains/__init__.py index 905ada2a..709597b3 100644 --- a/src/gcore/types/waap/domains/__init__.py +++ b/src/gcore/types/waap/domains/__init__.py @@ -3,7 +3,6 @@ from __future__ import annotations from .waap_insight import WaapInsight as WaapInsight -from .waap_task_id import WaapTaskID as WaapTaskID from .waap_api_path import WaapAPIPath as WaapAPIPath from .waap_ddos_info import WaapDDOSInfo as WaapDDOSInfo from .waap_custom_rule import WaapCustomRule as WaapCustomRule @@ -13,7 +12,6 @@ from .api_path_group_list import APIPathGroupList as APIPathGroupList from .insight_list_params import InsightListParams as InsightListParams from .api_path_list_params import APIPathListParams as APIPathListParams -from .waap_api_scan_result import WaapAPIScanResult as WaapAPIScanResult from .waap_insight_silence import WaapInsightSilence as WaapInsightSilence from .waap_request_details import WaapRequestDetails as WaapRequestDetails from .waap_request_summary import WaapRequestSummary as WaapRequestSummary @@ -35,23 +33,17 @@ from .firewall_rule_create_params import FirewallRuleCreateParams as FirewallRuleCreateParams from .firewall_rule_update_params import FirewallRuleUpdateParams as FirewallRuleUpdateParams from .insight_silence_list_params import InsightSilenceListParams as InsightSilenceListParams -from .waap_api_discovery_settings import WaapAPIDiscoverySettings as WaapAPIDiscoverySettings from .insight_silence_create_params import InsightSilenceCreateParams as InsightSilenceCreateParams from .insight_silence_update_params import InsightSilenceUpdateParams as InsightSilenceUpdateParams from .statistic_get_ddos_info_params import StatisticGetDDOSInfoParams as StatisticGetDDOSInfoParams from .statistic_get_ddos_attacks_params import StatisticGetDDOSAttacksParams as StatisticGetDDOSAttacksParams from .custom_rule_delete_multiple_params import CustomRuleDeleteMultipleParams as CustomRuleDeleteMultipleParams -from .api_discovery_upload_openapi_params import APIDiscoveryUploadOpenAPIParams as APIDiscoveryUploadOpenAPIParams from .statistic_get_traffic_series_params import StatisticGetTrafficSeriesParams as StatisticGetTrafficSeriesParams -from .api_discovery_update_settings_params import APIDiscoveryUpdateSettingsParams as APIDiscoveryUpdateSettingsParams from .firewall_rule_delete_multiple_params import FirewallRuleDeleteMultipleParams as FirewallRuleDeleteMultipleParams from .statistic_get_requests_series_params import StatisticGetRequestsSeriesParams as StatisticGetRequestsSeriesParams from .statistic_get_traffic_series_response import ( StatisticGetTrafficSeriesResponse as StatisticGetTrafficSeriesResponse, ) -from .api_discovery_list_scan_results_params import ( - APIDiscoveryListScanResultsParams as APIDiscoveryListScanResultsParams, -) from .statistic_get_events_aggregated_params import ( StatisticGetEventsAggregatedParams as StatisticGetEventsAggregatedParams, ) diff --git a/src/gcore/types/waap/domains/api_discovery/__init__.py b/src/gcore/types/waap/domains/api_discovery/__init__.py new file mode 100644 index 00000000..bdcc757d --- /dev/null +++ b/src/gcore/types/waap/domains/api_discovery/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .waap_task_id import WaapTaskID as WaapTaskID +from .waap_api_scan_result import WaapAPIScanResult as WaapAPIScanResult +from .openapi_upload_params import OpenAPIUploadParams as OpenAPIUploadParams +from .setting_update_params import SettingUpdateParams as SettingUpdateParams +from .scan_result_list_params import ScanResultListParams as ScanResultListParams +from .waap_api_discovery_settings import WaapAPIDiscoverySettings as WaapAPIDiscoverySettings diff --git a/src/gcore/types/waap/domains/api_discovery_upload_openapi_params.py b/src/gcore/types/waap/domains/api_discovery/openapi_upload_params.py similarity index 79% rename from src/gcore/types/waap/domains/api_discovery_upload_openapi_params.py rename to src/gcore/types/waap/domains/api_discovery/openapi_upload_params.py index 0bf87add..825e62e2 100644 --- a/src/gcore/types/waap/domains/api_discovery_upload_openapi_params.py +++ b/src/gcore/types/waap/domains/api_discovery/openapi_upload_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["APIDiscoveryUploadOpenAPIParams"] +__all__ = ["OpenAPIUploadParams"] -class APIDiscoveryUploadOpenAPIParams(TypedDict, total=False): +class OpenAPIUploadParams(TypedDict, total=False): file_data: Required[str] """Base64 representation of the description file. diff --git a/src/gcore/types/waap/domains/api_discovery_list_scan_results_params.py b/src/gcore/types/waap/domains/api_discovery/scan_result_list_params.py similarity index 89% rename from src/gcore/types/waap/domains/api_discovery_list_scan_results_params.py rename to src/gcore/types/waap/domains/api_discovery/scan_result_list_params.py index 28b05065..af3397b2 100644 --- a/src/gcore/types/waap/domains/api_discovery_list_scan_results_params.py +++ b/src/gcore/types/waap/domains/api_discovery/scan_result_list_params.py @@ -5,10 +5,10 @@ from typing import Optional from typing_extensions import Literal, TypedDict -__all__ = ["APIDiscoveryListScanResultsParams"] +__all__ = ["ScanResultListParams"] -class APIDiscoveryListScanResultsParams(TypedDict, total=False): +class ScanResultListParams(TypedDict, total=False): limit: int """Number of items to return""" diff --git a/src/gcore/types/waap/domains/api_discovery_update_settings_params.py b/src/gcore/types/waap/domains/api_discovery/setting_update_params.py similarity index 89% rename from src/gcore/types/waap/domains/api_discovery_update_settings_params.py rename to src/gcore/types/waap/domains/api_discovery/setting_update_params.py index 3274d926..768a69f1 100644 --- a/src/gcore/types/waap/domains/api_discovery_update_settings_params.py +++ b/src/gcore/types/waap/domains/api_discovery/setting_update_params.py @@ -5,12 +5,12 @@ from typing import Optional from typing_extensions import Annotated, TypedDict -from ...._utils import PropertyInfo +from ....._utils import PropertyInfo -__all__ = ["APIDiscoveryUpdateSettingsParams"] +__all__ = ["SettingUpdateParams"] -class APIDiscoveryUpdateSettingsParams(TypedDict, total=False): +class SettingUpdateParams(TypedDict, total=False): description_file_location: Annotated[Optional[str], PropertyInfo(alias="descriptionFileLocation")] """The URL of the API description file. diff --git a/src/gcore/types/waap/domains/waap_api_discovery_settings.py b/src/gcore/types/waap/domains/api_discovery/waap_api_discovery_settings.py similarity index 97% rename from src/gcore/types/waap/domains/waap_api_discovery_settings.py rename to src/gcore/types/waap/domains/api_discovery/waap_api_discovery_settings.py index 3b6339d8..6b63295d 100644 --- a/src/gcore/types/waap/domains/waap_api_discovery_settings.py +++ b/src/gcore/types/waap/domains/api_discovery/waap_api_discovery_settings.py @@ -4,7 +4,7 @@ from pydantic import Field as FieldInfo -from ...._models import BaseModel +from ....._models import BaseModel __all__ = ["WaapAPIDiscoverySettings"] diff --git a/src/gcore/types/waap/domains/waap_api_scan_result.py b/src/gcore/types/waap/domains/api_discovery/waap_api_scan_result.py similarity index 95% rename from src/gcore/types/waap/domains/waap_api_scan_result.py rename to src/gcore/types/waap/domains/api_discovery/waap_api_scan_result.py index c2bb18fa..2befca0e 100644 --- a/src/gcore/types/waap/domains/waap_api_scan_result.py +++ b/src/gcore/types/waap/domains/api_discovery/waap_api_scan_result.py @@ -4,7 +4,7 @@ from datetime import datetime from typing_extensions import Literal -from ...._models import BaseModel +from ....._models import BaseModel __all__ = ["WaapAPIScanResult"] diff --git a/src/gcore/types/waap/domains/waap_task_id.py b/src/gcore/types/waap/domains/api_discovery/waap_task_id.py similarity index 86% rename from src/gcore/types/waap/domains/waap_task_id.py rename to src/gcore/types/waap/domains/api_discovery/waap_task_id.py index 22f383c7..2fe0b65a 100644 --- a/src/gcore/types/waap/domains/waap_task_id.py +++ b/src/gcore/types/waap/domains/api_discovery/waap_task_id.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from ...._models import BaseModel +from ....._models import BaseModel __all__ = ["WaapTaskID"] diff --git a/tests/api_resources/waap/domains/api_discovery/__init__.py b/tests/api_resources/waap/domains/api_discovery/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/waap/domains/api_discovery/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/waap/domains/api_discovery/test_openapi.py b/tests/api_resources/waap/domains/api_discovery/test_openapi.py new file mode 100644 index 00000000..ff9d5b84 --- /dev/null +++ b/tests/api_resources/waap/domains/api_discovery/test_openapi.py @@ -0,0 +1,160 @@ +# 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.waap.domains.api_discovery import WaapTaskID + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestOpenAPI: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_scan(self, client: Gcore) -> None: + openapi = client.waap.domains.api_discovery.openapi.scan( + 1, + ) + assert_matches_type(WaapTaskID, openapi, path=["response"]) + + @parametrize + def test_raw_response_scan(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.openapi.with_raw_response.scan( + 1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + openapi = response.parse() + assert_matches_type(WaapTaskID, openapi, path=["response"]) + + @parametrize + def test_streaming_response_scan(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.openapi.with_streaming_response.scan( + 1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + openapi = response.parse() + assert_matches_type(WaapTaskID, openapi, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_upload(self, client: Gcore) -> None: + openapi = client.waap.domains.api_discovery.openapi.upload( + domain_id=1, + file_data="file_data", + file_name="file_name", + ) + assert_matches_type(WaapTaskID, openapi, path=["response"]) + + @parametrize + def test_raw_response_upload(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.openapi.with_raw_response.upload( + domain_id=1, + file_data="file_data", + file_name="file_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + openapi = response.parse() + assert_matches_type(WaapTaskID, openapi, path=["response"]) + + @parametrize + def test_streaming_response_upload(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.openapi.with_streaming_response.upload( + domain_id=1, + file_data="file_data", + file_name="file_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + openapi = response.parse() + assert_matches_type(WaapTaskID, openapi, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncOpenAPI: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_scan(self, async_client: AsyncGcore) -> None: + openapi = await async_client.waap.domains.api_discovery.openapi.scan( + 1, + ) + assert_matches_type(WaapTaskID, openapi, path=["response"]) + + @parametrize + async def test_raw_response_scan(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.openapi.with_raw_response.scan( + 1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + openapi = await response.parse() + assert_matches_type(WaapTaskID, openapi, path=["response"]) + + @parametrize + async def test_streaming_response_scan(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.openapi.with_streaming_response.scan( + 1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + openapi = await response.parse() + assert_matches_type(WaapTaskID, openapi, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_upload(self, async_client: AsyncGcore) -> None: + openapi = await async_client.waap.domains.api_discovery.openapi.upload( + domain_id=1, + file_data="file_data", + file_name="file_name", + ) + assert_matches_type(WaapTaskID, openapi, path=["response"]) + + @parametrize + async def test_raw_response_upload(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.openapi.with_raw_response.upload( + domain_id=1, + file_data="file_data", + file_name="file_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + openapi = await response.parse() + assert_matches_type(WaapTaskID, openapi, path=["response"]) + + @parametrize + async def test_streaming_response_upload(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.openapi.with_streaming_response.upload( + domain_id=1, + file_data="file_data", + file_name="file_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + openapi = await response.parse() + assert_matches_type(WaapTaskID, openapi, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/api_discovery/test_scan_results.py b/tests/api_resources/waap/domains/api_discovery/test_scan_results.py new file mode 100644 index 00000000..efc354b4 --- /dev/null +++ b/tests/api_resources/waap/domains/api_discovery/test_scan_results.py @@ -0,0 +1,197 @@ +# 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.pagination import SyncOffsetPage, AsyncOffsetPage +from gcore.types.waap.domains.api_discovery import WaapAPIScanResult + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestScanResults: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + scan_result = client.waap.domains.api_discovery.scan_results.list( + domain_id=1, + ) + assert_matches_type(SyncOffsetPage[WaapAPIScanResult], scan_result, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + scan_result = client.waap.domains.api_discovery.scan_results.list( + domain_id=1, + limit=0, + message="message", + offset=0, + ordering="id", + status="SUCCESS", + type="TRAFFIC_SCAN", + ) + assert_matches_type(SyncOffsetPage[WaapAPIScanResult], scan_result, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.scan_results.with_raw_response.list( + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + scan_result = response.parse() + assert_matches_type(SyncOffsetPage[WaapAPIScanResult], scan_result, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.scan_results.with_streaming_response.list( + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + scan_result = response.parse() + assert_matches_type(SyncOffsetPage[WaapAPIScanResult], scan_result, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + scan_result = client.waap.domains.api_discovery.scan_results.get( + scan_id="scan_id", + domain_id=1, + ) + assert_matches_type(WaapAPIScanResult, scan_result, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.scan_results.with_raw_response.get( + scan_id="scan_id", + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + scan_result = response.parse() + assert_matches_type(WaapAPIScanResult, scan_result, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.scan_results.with_streaming_response.get( + scan_id="scan_id", + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + scan_result = response.parse() + assert_matches_type(WaapAPIScanResult, scan_result, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): + client.waap.domains.api_discovery.scan_results.with_raw_response.get( + scan_id="", + domain_id=1, + ) + + +class TestAsyncScanResults: + 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: + scan_result = await async_client.waap.domains.api_discovery.scan_results.list( + domain_id=1, + ) + assert_matches_type(AsyncOffsetPage[WaapAPIScanResult], scan_result, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + scan_result = await async_client.waap.domains.api_discovery.scan_results.list( + domain_id=1, + limit=0, + message="message", + offset=0, + ordering="id", + status="SUCCESS", + type="TRAFFIC_SCAN", + ) + assert_matches_type(AsyncOffsetPage[WaapAPIScanResult], scan_result, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.scan_results.with_raw_response.list( + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + scan_result = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapAPIScanResult], scan_result, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.scan_results.with_streaming_response.list( + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + scan_result = await response.parse() + assert_matches_type(AsyncOffsetPage[WaapAPIScanResult], scan_result, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + scan_result = await async_client.waap.domains.api_discovery.scan_results.get( + scan_id="scan_id", + domain_id=1, + ) + assert_matches_type(WaapAPIScanResult, scan_result, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.scan_results.with_raw_response.get( + scan_id="scan_id", + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + scan_result = await response.parse() + assert_matches_type(WaapAPIScanResult, scan_result, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.scan_results.with_streaming_response.get( + scan_id="scan_id", + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + scan_result = await response.parse() + assert_matches_type(WaapAPIScanResult, scan_result, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): + await async_client.waap.domains.api_discovery.scan_results.with_raw_response.get( + scan_id="", + domain_id=1, + ) diff --git a/tests/api_resources/waap/domains/api_discovery/test_settings.py b/tests/api_resources/waap/domains/api_discovery/test_settings.py new file mode 100644 index 00000000..afd2fa3e --- /dev/null +++ b/tests/api_resources/waap/domains/api_discovery/test_settings.py @@ -0,0 +1,172 @@ +# 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.waap.domains.api_discovery import WaapAPIDiscoverySettings + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSettings: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Gcore) -> None: + setting = client.waap.domains.api_discovery.settings.update( + domain_id=1, + ) + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + setting = client.waap.domains.api_discovery.settings.update( + domain_id=1, + description_file_location="descriptionFileLocation", + description_file_scan_enabled=True, + description_file_scan_interval_hours=1, + traffic_scan_enabled=True, + traffic_scan_interval_hours=1, + ) + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.settings.with_raw_response.update( + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.settings.with_streaming_response.update( + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + setting = client.waap.domains.api_discovery.settings.get( + 1, + ) + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.waap.domains.api_discovery.settings.with_raw_response.get( + 1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.waap.domains.api_discovery.settings.with_streaming_response.get( + 1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncSettings: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + setting = await async_client.waap.domains.api_discovery.settings.update( + domain_id=1, + ) + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + setting = await async_client.waap.domains.api_discovery.settings.update( + domain_id=1, + description_file_location="descriptionFileLocation", + description_file_scan_enabled=True, + description_file_scan_interval_hours=1, + traffic_scan_enabled=True, + traffic_scan_interval_hours=1, + ) + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.settings.with_raw_response.update( + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.settings.with_streaming_response.update( + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + setting = await async_client.waap.domains.api_discovery.settings.get( + 1, + ) + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.api_discovery.settings.with_raw_response.get( + 1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.api_discovery.settings.with_streaming_response.get( + 1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert_matches_type(WaapAPIDiscoverySettings, setting, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waap/domains/test_api_discovery.py b/tests/api_resources/waap/domains/test_api_discovery.py deleted file mode 100644 index 7fd4e461..00000000 --- a/tests/api_resources/waap/domains/test_api_discovery.py +++ /dev/null @@ -1,485 +0,0 @@ -# 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.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.waap.domains import ( - WaapTaskID, - WaapAPIScanResult, - WaapAPIDiscoverySettings, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAPIDiscovery: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_get_scan_result(self, client: Gcore) -> None: - api_discovery = client.waap.domains.api_discovery.get_scan_result( - scan_id="scan_id", - domain_id=1, - ) - assert_matches_type(WaapAPIScanResult, api_discovery, path=["response"]) - - @parametrize - def test_raw_response_get_scan_result(self, client: Gcore) -> None: - response = client.waap.domains.api_discovery.with_raw_response.get_scan_result( - scan_id="scan_id", - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_discovery = response.parse() - assert_matches_type(WaapAPIScanResult, api_discovery, path=["response"]) - - @parametrize - def test_streaming_response_get_scan_result(self, client: Gcore) -> None: - with client.waap.domains.api_discovery.with_streaming_response.get_scan_result( - scan_id="scan_id", - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_discovery = response.parse() - assert_matches_type(WaapAPIScanResult, api_discovery, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get_scan_result(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): - client.waap.domains.api_discovery.with_raw_response.get_scan_result( - scan_id="", - domain_id=1, - ) - - @parametrize - def test_method_get_settings(self, client: Gcore) -> None: - api_discovery = client.waap.domains.api_discovery.get_settings( - 1, - ) - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - @parametrize - def test_raw_response_get_settings(self, client: Gcore) -> None: - response = client.waap.domains.api_discovery.with_raw_response.get_settings( - 1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_discovery = response.parse() - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - @parametrize - def test_streaming_response_get_settings(self, client: Gcore) -> None: - with client.waap.domains.api_discovery.with_streaming_response.get_settings( - 1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_discovery = response.parse() - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_list_scan_results(self, client: Gcore) -> None: - api_discovery = client.waap.domains.api_discovery.list_scan_results( - domain_id=1, - ) - assert_matches_type(SyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) - - @parametrize - def test_method_list_scan_results_with_all_params(self, client: Gcore) -> None: - api_discovery = client.waap.domains.api_discovery.list_scan_results( - domain_id=1, - limit=0, - message="message", - offset=0, - ordering="id", - status="SUCCESS", - type="TRAFFIC_SCAN", - ) - assert_matches_type(SyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) - - @parametrize - def test_raw_response_list_scan_results(self, client: Gcore) -> None: - response = client.waap.domains.api_discovery.with_raw_response.list_scan_results( - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_discovery = response.parse() - assert_matches_type(SyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) - - @parametrize - def test_streaming_response_list_scan_results(self, client: Gcore) -> None: - with client.waap.domains.api_discovery.with_streaming_response.list_scan_results( - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_discovery = response.parse() - assert_matches_type(SyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_scan_openapi(self, client: Gcore) -> None: - api_discovery = client.waap.domains.api_discovery.scan_openapi( - 1, - ) - assert_matches_type(WaapTaskID, api_discovery, path=["response"]) - - @parametrize - def test_raw_response_scan_openapi(self, client: Gcore) -> None: - response = client.waap.domains.api_discovery.with_raw_response.scan_openapi( - 1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_discovery = response.parse() - assert_matches_type(WaapTaskID, api_discovery, path=["response"]) - - @parametrize - def test_streaming_response_scan_openapi(self, client: Gcore) -> None: - with client.waap.domains.api_discovery.with_streaming_response.scan_openapi( - 1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_discovery = response.parse() - assert_matches_type(WaapTaskID, api_discovery, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_update_settings(self, client: Gcore) -> None: - api_discovery = client.waap.domains.api_discovery.update_settings( - domain_id=1, - ) - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - @parametrize - def test_method_update_settings_with_all_params(self, client: Gcore) -> None: - api_discovery = client.waap.domains.api_discovery.update_settings( - domain_id=1, - description_file_location="descriptionFileLocation", - description_file_scan_enabled=True, - description_file_scan_interval_hours=1, - traffic_scan_enabled=True, - traffic_scan_interval_hours=1, - ) - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - @parametrize - def test_raw_response_update_settings(self, client: Gcore) -> None: - response = client.waap.domains.api_discovery.with_raw_response.update_settings( - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_discovery = response.parse() - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - @parametrize - def test_streaming_response_update_settings(self, client: Gcore) -> None: - with client.waap.domains.api_discovery.with_streaming_response.update_settings( - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_discovery = response.parse() - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_upload_openapi(self, client: Gcore) -> None: - api_discovery = client.waap.domains.api_discovery.upload_openapi( - domain_id=1, - file_data="file_data", - file_name="file_name", - ) - assert_matches_type(WaapTaskID, api_discovery, path=["response"]) - - @parametrize - def test_raw_response_upload_openapi(self, client: Gcore) -> None: - response = client.waap.domains.api_discovery.with_raw_response.upload_openapi( - domain_id=1, - file_data="file_data", - file_name="file_name", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_discovery = response.parse() - assert_matches_type(WaapTaskID, api_discovery, path=["response"]) - - @parametrize - def test_streaming_response_upload_openapi(self, client: Gcore) -> None: - with client.waap.domains.api_discovery.with_streaming_response.upload_openapi( - domain_id=1, - file_data="file_data", - file_name="file_name", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_discovery = response.parse() - assert_matches_type(WaapTaskID, api_discovery, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncAPIDiscovery: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_get_scan_result(self, async_client: AsyncGcore) -> None: - api_discovery = await async_client.waap.domains.api_discovery.get_scan_result( - scan_id="scan_id", - domain_id=1, - ) - assert_matches_type(WaapAPIScanResult, api_discovery, path=["response"]) - - @parametrize - async def test_raw_response_get_scan_result(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.api_discovery.with_raw_response.get_scan_result( - scan_id="scan_id", - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_discovery = await response.parse() - assert_matches_type(WaapAPIScanResult, api_discovery, path=["response"]) - - @parametrize - async def test_streaming_response_get_scan_result(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.api_discovery.with_streaming_response.get_scan_result( - scan_id="scan_id", - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_discovery = await response.parse() - assert_matches_type(WaapAPIScanResult, api_discovery, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get_scan_result(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `scan_id` but received ''"): - await async_client.waap.domains.api_discovery.with_raw_response.get_scan_result( - scan_id="", - domain_id=1, - ) - - @parametrize - async def test_method_get_settings(self, async_client: AsyncGcore) -> None: - api_discovery = await async_client.waap.domains.api_discovery.get_settings( - 1, - ) - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - @parametrize - async def test_raw_response_get_settings(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.api_discovery.with_raw_response.get_settings( - 1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_discovery = await response.parse() - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - @parametrize - async def test_streaming_response_get_settings(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.api_discovery.with_streaming_response.get_settings( - 1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_discovery = await response.parse() - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_list_scan_results(self, async_client: AsyncGcore) -> None: - api_discovery = await async_client.waap.domains.api_discovery.list_scan_results( - domain_id=1, - ) - assert_matches_type(AsyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) - - @parametrize - async def test_method_list_scan_results_with_all_params(self, async_client: AsyncGcore) -> None: - api_discovery = await async_client.waap.domains.api_discovery.list_scan_results( - domain_id=1, - limit=0, - message="message", - offset=0, - ordering="id", - status="SUCCESS", - type="TRAFFIC_SCAN", - ) - assert_matches_type(AsyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) - - @parametrize - async def test_raw_response_list_scan_results(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.api_discovery.with_raw_response.list_scan_results( - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_discovery = await response.parse() - assert_matches_type(AsyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) - - @parametrize - async def test_streaming_response_list_scan_results(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.api_discovery.with_streaming_response.list_scan_results( - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_discovery = await response.parse() - assert_matches_type(AsyncOffsetPage[WaapAPIScanResult], api_discovery, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_scan_openapi(self, async_client: AsyncGcore) -> None: - api_discovery = await async_client.waap.domains.api_discovery.scan_openapi( - 1, - ) - assert_matches_type(WaapTaskID, api_discovery, path=["response"]) - - @parametrize - async def test_raw_response_scan_openapi(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.api_discovery.with_raw_response.scan_openapi( - 1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_discovery = await response.parse() - assert_matches_type(WaapTaskID, api_discovery, path=["response"]) - - @parametrize - async def test_streaming_response_scan_openapi(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.api_discovery.with_streaming_response.scan_openapi( - 1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_discovery = await response.parse() - assert_matches_type(WaapTaskID, api_discovery, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_update_settings(self, async_client: AsyncGcore) -> None: - api_discovery = await async_client.waap.domains.api_discovery.update_settings( - domain_id=1, - ) - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - @parametrize - async def test_method_update_settings_with_all_params(self, async_client: AsyncGcore) -> None: - api_discovery = await async_client.waap.domains.api_discovery.update_settings( - domain_id=1, - description_file_location="descriptionFileLocation", - description_file_scan_enabled=True, - description_file_scan_interval_hours=1, - traffic_scan_enabled=True, - traffic_scan_interval_hours=1, - ) - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - @parametrize - async def test_raw_response_update_settings(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.api_discovery.with_raw_response.update_settings( - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_discovery = await response.parse() - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - @parametrize - async def test_streaming_response_update_settings(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.api_discovery.with_streaming_response.update_settings( - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_discovery = await response.parse() - assert_matches_type(WaapAPIDiscoverySettings, api_discovery, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_upload_openapi(self, async_client: AsyncGcore) -> None: - api_discovery = await async_client.waap.domains.api_discovery.upload_openapi( - domain_id=1, - file_data="file_data", - file_name="file_name", - ) - assert_matches_type(WaapTaskID, api_discovery, path=["response"]) - - @parametrize - async def test_raw_response_upload_openapi(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.api_discovery.with_raw_response.upload_openapi( - domain_id=1, - file_data="file_data", - file_name="file_name", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_discovery = await response.parse() - assert_matches_type(WaapTaskID, api_discovery, path=["response"]) - - @parametrize - async def test_streaming_response_upload_openapi(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.api_discovery.with_streaming_response.upload_openapi( - domain_id=1, - file_data="file_data", - file_name="file_name", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_discovery = await response.parse() - assert_matches_type(WaapTaskID, api_discovery, path=["response"]) - - assert cast(Any, response.is_closed) is True From 97bba006c7b87b804843bf42bc213645f2045174 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 14:59:26 +0000 Subject: [PATCH 585/592] refactor(waap)!: move domains.toggle_policy to domains.policies.toggle --- .stats.yml | 2 +- src/gcore/resources/waap/api.md | 14 +- src/gcore/resources/waap/domains/__init__.py | 14 ++ src/gcore/resources/waap/domains/domains.py | 121 ++++-------- src/gcore/resources/waap/domains/policies.py | 173 ++++++++++++++++++ src/gcore/types/waap/__init__.py | 1 - src/gcore/types/waap/domains/__init__.py | 1 + .../waap/{ => domains}/waap_policy_mode.py | 2 +- .../waap/domains/test_policies.py | 108 +++++++++++ tests/api_resources/waap/test_domains.py | 85 --------- 10 files changed, 342 insertions(+), 179 deletions(-) create mode 100644 src/gcore/resources/waap/domains/policies.py rename src/gcore/types/waap/{ => domains}/waap_policy_mode.py (88%) create mode 100644 tests/api_resources/waap/domains/test_policies.py diff --git a/.stats.yml b/.stats.yml index a273f540..c64069a9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-691d7fc7d687ca367474bc78eb880f6f964454dc82259cdbb75fb90bd92c67ec.yml openapi_spec_hash: 97a4cbc8d7b05b1dc58319331717e8e7 -config_hash: a5fc65645e723807b401a8e277b7f9a7 +config_hash: cb5d9734170464c1bc79afaeb951cc24 diff --git a/src/gcore/resources/waap/api.md b/src/gcore/resources/waap/api.md index b357ca54..883cd8b2 100644 --- a/src/gcore/resources/waap/api.md +++ b/src/gcore/resources/waap/api.md @@ -32,7 +32,6 @@ from gcore.types.waap import ( WaapDomainAPISettings, WaapDomainDDOSSettings, WaapDomainSettingsModel, - WaapPolicyMode, WaapRuleSet, WaapSummaryDomain, DomainListRuleSetsResponse, @@ -46,7 +45,18 @@ Methods: - client.waap.domains.delete(domain_id) -> None - client.waap.domains.get(domain_id) -> WaapDetailedDomain - client.waap.domains.list_rule_sets(domain_id) -> DomainListRuleSetsResponse -- client.waap.domains.toggle_policy(policy_id, \*, domain_id) -> WaapPolicyMode + +### Policies + +Types: + +```python +from gcore.types.waap.domains import WaapPolicyMode +``` + +Methods: + +- client.waap.domains.policies.toggle(policy_id, \*, domain_id) -> WaapPolicyMode ### Settings diff --git a/src/gcore/resources/waap/domains/__init__.py b/src/gcore/resources/waap/domains/__init__.py index 33cc8323..2f91d228 100644 --- a/src/gcore/resources/waap/domains/__init__.py +++ b/src/gcore/resources/waap/domains/__init__.py @@ -16,6 +16,14 @@ InsightsResourceWithStreamingResponse, AsyncInsightsResourceWithStreamingResponse, ) +from .policies import ( + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, +) from .settings import ( SettingsResource, AsyncSettingsResource, @@ -90,6 +98,12 @@ ) __all__ = [ + "PoliciesResource", + "AsyncPoliciesResource", + "PoliciesResourceWithRawResponse", + "AsyncPoliciesResourceWithRawResponse", + "PoliciesResourceWithStreamingResponse", + "AsyncPoliciesResourceWithStreamingResponse", "SettingsResource", "AsyncSettingsResource", "SettingsResourceWithRawResponse", diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index d8be440c..c366f47e 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -15,6 +15,14 @@ InsightsResourceWithStreamingResponse, AsyncInsightsResourceWithStreamingResponse, ) +from .policies import ( + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, +) from .settings import ( SettingsResource, AsyncSettingsResource, @@ -100,7 +108,6 @@ APIDiscoveryResourceWithStreamingResponse, AsyncAPIDiscoveryResourceWithStreamingResponse, ) -from ....types.waap.waap_policy_mode import WaapPolicyMode from ....types.waap.waap_summary_domain import WaapSummaryDomain from ....types.waap.waap_detailed_domain import WaapDetailedDomain from ....types.waap.domain_list_rule_sets_response import DomainListRuleSetsResponse @@ -109,6 +116,10 @@ class DomainsResource(SyncAPIResource): + @cached_property + def policies(self) -> PoliciesResource: + return PoliciesResource(self._client) + @cached_property def settings(self) -> SettingsResource: return SettingsResource(self._client) @@ -371,46 +382,12 @@ def list_rule_sets( cast_to=DomainListRuleSetsResponse, ) - def toggle_policy( - self, - policy_id: str, - *, - domain_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, - ) -> WaapPolicyMode: - """ - Modify the activation state of a policy associated with a domain - - Args: - domain_id: The domain ID - - policy_id: The ID of the policy to toggle - - 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 policy_id: - raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") - return self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapPolicyMode, - ) - class AsyncDomainsResource(AsyncAPIResource): + @cached_property + def policies(self) -> AsyncPoliciesResource: + return AsyncPoliciesResource(self._client) + @cached_property def settings(self) -> AsyncSettingsResource: return AsyncSettingsResource(self._client) @@ -673,44 +650,6 @@ async def list_rule_sets( cast_to=DomainListRuleSetsResponse, ) - async def toggle_policy( - self, - policy_id: str, - *, - domain_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, - ) -> WaapPolicyMode: - """ - Modify the activation state of a policy associated with a domain - - Args: - domain_id: The domain ID - - policy_id: The ID of the policy to toggle - - 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 policy_id: - raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") - return await self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WaapPolicyMode, - ) - class DomainsResourceWithRawResponse: def __init__(self, domains: DomainsResource) -> None: @@ -731,9 +670,10 @@ def __init__(self, domains: DomainsResource) -> None: self.list_rule_sets = to_raw_response_wrapper( domains.list_rule_sets, ) - self.toggle_policy = to_raw_response_wrapper( - domains.toggle_policy, - ) + + @cached_property + def policies(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self._domains.policies) @cached_property def settings(self) -> SettingsResourceWithRawResponse: @@ -795,9 +735,10 @@ def __init__(self, domains: AsyncDomainsResource) -> None: self.list_rule_sets = async_to_raw_response_wrapper( domains.list_rule_sets, ) - self.toggle_policy = async_to_raw_response_wrapper( - domains.toggle_policy, - ) + + @cached_property + def policies(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self._domains.policies) @cached_property def settings(self) -> AsyncSettingsResourceWithRawResponse: @@ -859,9 +800,10 @@ def __init__(self, domains: DomainsResource) -> None: self.list_rule_sets = to_streamed_response_wrapper( domains.list_rule_sets, ) - self.toggle_policy = to_streamed_response_wrapper( - domains.toggle_policy, - ) + + @cached_property + def policies(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self._domains.policies) @cached_property def settings(self) -> SettingsResourceWithStreamingResponse: @@ -923,9 +865,10 @@ def __init__(self, domains: AsyncDomainsResource) -> None: self.list_rule_sets = async_to_streamed_response_wrapper( domains.list_rule_sets, ) - self.toggle_policy = async_to_streamed_response_wrapper( - domains.toggle_policy, - ) + + @cached_property + def policies(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self._domains.policies) @cached_property def settings(self) -> AsyncSettingsResourceWithStreamingResponse: diff --git a/src/gcore/resources/waap/domains/policies.py b/src/gcore/resources/waap/domains/policies.py new file mode 100644 index 00000000..c4af1f74 --- /dev/null +++ b/src/gcore/resources/waap/domains/policies.py @@ -0,0 +1,173 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.waap.domains.waap_policy_mode import WaapPolicyMode + +__all__ = ["PoliciesResource", "AsyncPoliciesResource"] + + +class PoliciesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PoliciesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return PoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return PoliciesResourceWithStreamingResponse(self) + + def toggle( + self, + policy_id: str, + *, + domain_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, + ) -> WaapPolicyMode: + """ + Modify the activation state of a policy associated with a domain + + Args: + domain_id: The domain ID + + policy_id: The ID of the policy to toggle + + 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 policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") + return self._patch( + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapPolicyMode, + ) + + +class AsyncPoliciesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncPoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncPoliciesResourceWithStreamingResponse(self) + + async def toggle( + self, + policy_id: str, + *, + domain_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, + ) -> WaapPolicyMode: + """ + Modify the activation state of a policy associated with a domain + + Args: + domain_id: The domain ID + + policy_id: The ID of the policy to toggle + + 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 policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") + return await self._patch( + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=WaapPolicyMode, + ) + + +class PoliciesResourceWithRawResponse: + def __init__(self, policies: PoliciesResource) -> None: + self._policies = policies + + self.toggle = to_raw_response_wrapper( + policies.toggle, + ) + + +class AsyncPoliciesResourceWithRawResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: + self._policies = policies + + self.toggle = async_to_raw_response_wrapper( + policies.toggle, + ) + + +class PoliciesResourceWithStreamingResponse: + def __init__(self, policies: PoliciesResource) -> None: + self._policies = policies + + self.toggle = to_streamed_response_wrapper( + policies.toggle, + ) + + +class AsyncPoliciesResourceWithStreamingResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: + self._policies = policies + + self.toggle = async_to_streamed_response_wrapper( + policies.toggle, + ) diff --git a/src/gcore/types/waap/__init__.py b/src/gcore/types/waap/__init__.py index b90f2d8b..09c8023e 100644 --- a/src/gcore/types/waap/__init__.py +++ b/src/gcore/types/waap/__init__.py @@ -7,7 +7,6 @@ from .waap_top_url import WaapTopURL as WaapTopURL from .waap_rule_set import WaapRuleSet as WaapRuleSet from .tag_list_params import TagListParams as TagListParams -from .waap_policy_mode import WaapPolicyMode as WaapPolicyMode from .waap_top_session import WaapTopSession as WaapTopSession from .waap_insight_type import WaapInsightType as WaapInsightType from .waap_organization import WaapOrganization as WaapOrganization diff --git a/src/gcore/types/waap/domains/__init__.py b/src/gcore/types/waap/domains/__init__.py index 709597b3..c2e3dc86 100644 --- a/src/gcore/types/waap/domains/__init__.py +++ b/src/gcore/types/waap/domains/__init__.py @@ -7,6 +7,7 @@ from .waap_ddos_info import WaapDDOSInfo as WaapDDOSInfo from .waap_custom_rule import WaapCustomRule as WaapCustomRule from .waap_ddos_attack import WaapDDOSAttack as WaapDDOSAttack +from .waap_policy_mode import WaapPolicyMode as WaapPolicyMode from .waap_advanced_rule import WaapAdvancedRule as WaapAdvancedRule from .waap_firewall_rule import WaapFirewallRule as WaapFirewallRule from .api_path_group_list import APIPathGroupList as APIPathGroupList diff --git a/src/gcore/types/waap/waap_policy_mode.py b/src/gcore/types/waap/domains/waap_policy_mode.py similarity index 88% rename from src/gcore/types/waap/waap_policy_mode.py rename to src/gcore/types/waap/domains/waap_policy_mode.py index 14faca49..ed78f2d0 100644 --- a/src/gcore/types/waap/waap_policy_mode.py +++ b/src/gcore/types/waap/domains/waap_policy_mode.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from ..._models import BaseModel +from ...._models import BaseModel __all__ = ["WaapPolicyMode"] diff --git a/tests/api_resources/waap/domains/test_policies.py b/tests/api_resources/waap/domains/test_policies.py new file mode 100644 index 00000000..10d7e384 --- /dev/null +++ b/tests/api_resources/waap/domains/test_policies.py @@ -0,0 +1,108 @@ +# 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.waap.domains import WaapPolicyMode + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPolicies: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_toggle(self, client: Gcore) -> None: + policy = client.waap.domains.policies.toggle( + policy_id="policy_id", + domain_id=1, + ) + assert_matches_type(WaapPolicyMode, policy, path=["response"]) + + @parametrize + def test_raw_response_toggle(self, client: Gcore) -> None: + response = client.waap.domains.policies.with_raw_response.toggle( + policy_id="policy_id", + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(WaapPolicyMode, policy, path=["response"]) + + @parametrize + def test_streaming_response_toggle(self, client: Gcore) -> None: + with client.waap.domains.policies.with_streaming_response.toggle( + policy_id="policy_id", + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(WaapPolicyMode, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_toggle(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): + client.waap.domains.policies.with_raw_response.toggle( + policy_id="", + domain_id=1, + ) + + +class TestAsyncPolicies: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_toggle(self, async_client: AsyncGcore) -> None: + policy = await async_client.waap.domains.policies.toggle( + policy_id="policy_id", + domain_id=1, + ) + assert_matches_type(WaapPolicyMode, policy, path=["response"]) + + @parametrize + async def test_raw_response_toggle(self, async_client: AsyncGcore) -> None: + response = await async_client.waap.domains.policies.with_raw_response.toggle( + policy_id="policy_id", + domain_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(WaapPolicyMode, policy, path=["response"]) + + @parametrize + async def test_streaming_response_toggle(self, async_client: AsyncGcore) -> None: + async with async_client.waap.domains.policies.with_streaming_response.toggle( + policy_id="policy_id", + domain_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(WaapPolicyMode, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_toggle(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): + await async_client.waap.domains.policies.with_raw_response.toggle( + policy_id="", + domain_id=1, + ) diff --git a/tests/api_resources/waap/test_domains.py b/tests/api_resources/waap/test_domains.py index 9c3d9c26..58702fcb 100644 --- a/tests/api_resources/waap/test_domains.py +++ b/tests/api_resources/waap/test_domains.py @@ -11,7 +11,6 @@ from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.waap import ( - WaapPolicyMode, WaapSummaryDomain, WaapDetailedDomain, DomainListRuleSetsResponse, @@ -187,48 +186,6 @@ def test_streaming_response_list_rule_sets(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_toggle_policy(self, client: Gcore) -> None: - domain = client.waap.domains.toggle_policy( - policy_id="policy_id", - domain_id=1, - ) - assert_matches_type(WaapPolicyMode, domain, path=["response"]) - - @parametrize - def test_raw_response_toggle_policy(self, client: Gcore) -> None: - response = client.waap.domains.with_raw_response.toggle_policy( - policy_id="policy_id", - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - domain = response.parse() - assert_matches_type(WaapPolicyMode, domain, path=["response"]) - - @parametrize - def test_streaming_response_toggle_policy(self, client: Gcore) -> None: - with client.waap.domains.with_streaming_response.toggle_policy( - policy_id="policy_id", - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - domain = response.parse() - assert_matches_type(WaapPolicyMode, domain, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_toggle_policy(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): - client.waap.domains.with_raw_response.toggle_policy( - policy_id="", - domain_id=1, - ) - class TestAsyncDomains: parametrize = pytest.mark.parametrize( @@ -398,45 +355,3 @@ async def test_streaming_response_list_rule_sets(self, async_client: AsyncGcore) assert_matches_type(DomainListRuleSetsResponse, domain, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_toggle_policy(self, async_client: AsyncGcore) -> None: - domain = await async_client.waap.domains.toggle_policy( - policy_id="policy_id", - domain_id=1, - ) - assert_matches_type(WaapPolicyMode, domain, path=["response"]) - - @parametrize - async def test_raw_response_toggle_policy(self, async_client: AsyncGcore) -> None: - response = await async_client.waap.domains.with_raw_response.toggle_policy( - policy_id="policy_id", - domain_id=1, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - domain = await response.parse() - assert_matches_type(WaapPolicyMode, domain, path=["response"]) - - @parametrize - async def test_streaming_response_toggle_policy(self, async_client: AsyncGcore) -> None: - async with async_client.waap.domains.with_streaming_response.toggle_policy( - policy_id="policy_id", - domain_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - domain = await response.parse() - assert_matches_type(WaapPolicyMode, domain, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_toggle_policy(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): - await async_client.waap.domains.with_raw_response.toggle_policy( - policy_id="", - domain_id=1, - ) From e701596e2e20b557ba437242168671c2b5d82418 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 22:16:31 +0000 Subject: [PATCH 586/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/storage/credentials.py | 34 +-- src/gcore/resources/storage/storage.py | 96 ++++++--- tests/api_resources/test_storage.py | 230 ++++++++++++--------- 4 files changed, 225 insertions(+), 139 deletions(-) diff --git a/.stats.yml b/.stats.yml index c64069a9..f5ac0e56 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-691d7fc7d687ca367474bc78eb880f6f964454dc82259cdbb75fb90bd92c67ec.yml -openapi_spec_hash: 97a4cbc8d7b05b1dc58319331717e8e7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-df9e1d982f36387efaf9b6f966b951964fff45860b3cd728fbaf2d82e6318a7f.yml +openapi_spec_hash: 2bc2689b7084fda0ff82c8e0d255aab7 config_hash: cb5d9734170464c1bc79afaeb951cc24 diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index 2b317f6f..7ec32469 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -60,14 +60,17 @@ def recreate( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: - """ - Generates new access credentials for the storage (S3 keys for S3 storage, SFTP - password for SFTP storage). + """Resets ALL access credentials for the storage. + + For S3 storage this replaces all + existing access keys with a single new key pair. For SFTP storage this resets + the password. - Deprecated: Use POST - /provisioning/v3/storages/`s3_compatible`/{`storage_id`}/credentials/reset for - S3 storage or PATCH /provisioning/v3/storages/sftp/{`storage_id`}/credentials - for SFTP storage instead. + Deprecated: Use POST /v4/`object_storages`/{`storage_id`}/`access_keys` to + create individual access keys, DELETE + /v4/`object_storages`/{`storage_id`}/`access_keys`/{`access_key`} to remove + specific keys, or PATCH /v4/`sftp_storages`/{`storage_id`}/credentials for SFTP + storage instead. Args: extra_headers: Send extra headers @@ -134,14 +137,17 @@ async def recreate( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: - """ - Generates new access credentials for the storage (S3 keys for S3 storage, SFTP - password for SFTP storage). + """Resets ALL access credentials for the storage. + + For S3 storage this replaces all + existing access keys with a single new key pair. For SFTP storage this resets + the password. - Deprecated: Use POST - /provisioning/v3/storages/`s3_compatible`/{`storage_id`}/credentials/reset for - S3 storage or PATCH /provisioning/v3/storages/sftp/{`storage_id`}/credentials - for SFTP storage instead. + Deprecated: Use POST /v4/`object_storages`/{`storage_id`}/`access_keys` to + create individual access keys, DELETE + /v4/`object_storages`/{`storage_id`}/`access_keys`/{`access_key`} to remove + specific keys, or PATCH /v4/`sftp_storages`/{`storage_id`}/credentials for SFTP + storage instead. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index 41b6edb5..0999e354 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -211,6 +211,7 @@ def update( cast_to=Storage, ) + @typing_extensions.deprecated("deprecated") def list( self, *, @@ -239,6 +240,9 @@ def list( (independent of pagination) results: the current page of storages according to limit/offset + Deprecated: Use GET /v4/`object_storages` for S3 storages or GET + /v4/`sftp_storages` for SFTP storages instead. + Args: id: Filter by storage ID @@ -332,6 +336,7 @@ def delete( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") def get( self, storage_id: int, @@ -347,6 +352,9 @@ def get( Retrieves detailed information about a specific storage including its configuration, credentials, and current status. + Deprecated: Use GET /v4/`object_storages`/{`storage_id`} for S3 storages or GET + /v4/`sftp_storages`/{`storage_id`} for SFTP storages instead. + Args: extra_headers: Send extra headers @@ -405,6 +413,7 @@ def link_ssh_key( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") def restore( self, storage_id: int, @@ -421,6 +430,9 @@ def restore( Restores a previously deleted S3 storage if it was deleted within the last 2 weeks. SFTP storages cannot be restored. + Deprecated: Use POST + /provisioning/v3/storages/`s3_compatible`/{`storage_id`}/restore instead. + Args: extra_headers: Send extra headers @@ -639,6 +651,7 @@ async def update( cast_to=Storage, ) + @typing_extensions.deprecated("deprecated") def list( self, *, @@ -667,6 +680,9 @@ def list( (independent of pagination) results: the current page of storages according to limit/offset + Deprecated: Use GET /v4/`object_storages` for S3 storages or GET + /v4/`sftp_storages` for SFTP storages instead. + Args: id: Filter by storage ID @@ -760,6 +776,7 @@ async def delete( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") async def get( self, storage_id: int, @@ -775,6 +792,9 @@ async def get( Retrieves detailed information about a specific storage including its configuration, credentials, and current status. + Deprecated: Use GET /v4/`object_storages`/{`storage_id`} for S3 storages or GET + /v4/`sftp_storages`/{`storage_id`} for SFTP storages instead. + Args: extra_headers: Send extra headers @@ -833,6 +853,7 @@ async def link_ssh_key( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") async def restore( self, storage_id: int, @@ -849,6 +870,9 @@ async def restore( Restores a previously deleted S3 storage if it was deleted within the last 2 weeks. SFTP storages cannot be restored. + Deprecated: Use POST + /provisioning/v3/storages/`s3_compatible`/{`storage_id`}/restore instead. + Args: extra_headers: Send extra headers @@ -929,24 +953,30 @@ def __init__(self, storage: StorageResource) -> None: storage.update, # pyright: ignore[reportDeprecated], ) ) - self.list = to_raw_response_wrapper( - storage.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + storage.list, # pyright: ignore[reportDeprecated], + ) ) self.delete = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( storage.delete, # pyright: ignore[reportDeprecated], ) ) - self.get = to_raw_response_wrapper( - storage.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + storage.get, # pyright: ignore[reportDeprecated], + ) ) self.link_ssh_key = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( storage.link_ssh_key, # pyright: ignore[reportDeprecated], ) ) - self.restore = to_raw_response_wrapper( - storage.restore, + self.restore = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + storage.restore, # pyright: ignore[reportDeprecated], + ) ) self.unlink_ssh_key = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( @@ -985,24 +1015,30 @@ def __init__(self, storage: AsyncStorageResource) -> None: storage.update, # pyright: ignore[reportDeprecated], ) ) - self.list = async_to_raw_response_wrapper( - storage.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + storage.list, # pyright: ignore[reportDeprecated], + ) ) self.delete = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( storage.delete, # pyright: ignore[reportDeprecated], ) ) - self.get = async_to_raw_response_wrapper( - storage.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + storage.get, # pyright: ignore[reportDeprecated], + ) ) self.link_ssh_key = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( storage.link_ssh_key, # pyright: ignore[reportDeprecated], ) ) - self.restore = async_to_raw_response_wrapper( - storage.restore, + self.restore = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + storage.restore, # pyright: ignore[reportDeprecated], + ) ) self.unlink_ssh_key = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( @@ -1041,24 +1077,30 @@ def __init__(self, storage: StorageResource) -> None: storage.update, # pyright: ignore[reportDeprecated], ) ) - self.list = to_streamed_response_wrapper( - storage.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + storage.list, # pyright: ignore[reportDeprecated], + ) ) self.delete = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( storage.delete, # pyright: ignore[reportDeprecated], ) ) - self.get = to_streamed_response_wrapper( - storage.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + storage.get, # pyright: ignore[reportDeprecated], + ) ) self.link_ssh_key = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( storage.link_ssh_key, # pyright: ignore[reportDeprecated], ) ) - self.restore = to_streamed_response_wrapper( - storage.restore, + self.restore = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + storage.restore, # pyright: ignore[reportDeprecated], + ) ) self.unlink_ssh_key = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( @@ -1097,24 +1139,30 @@ def __init__(self, storage: AsyncStorageResource) -> None: storage.update, # pyright: ignore[reportDeprecated], ) ) - self.list = async_to_streamed_response_wrapper( - storage.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + storage.list, # pyright: ignore[reportDeprecated], + ) ) self.delete = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( storage.delete, # pyright: ignore[reportDeprecated], ) ) - self.get = async_to_streamed_response_wrapper( - storage.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + storage.get, # pyright: ignore[reportDeprecated], + ) ) self.link_ssh_key = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( storage.link_ssh_key, # pyright: ignore[reportDeprecated], ) ) - self.restore = async_to_streamed_response_wrapper( - storage.restore, + self.restore = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + storage.restore, # pyright: ignore[reportDeprecated], + ) ) self.unlink_ssh_key = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( diff --git a/tests/api_resources/test_storage.py b/tests/api_resources/test_storage.py index 8261bb66..90e1d446 100644 --- a/tests/api_resources/test_storage.py +++ b/tests/api_resources/test_storage.py @@ -124,28 +124,33 @@ def test_streaming_response_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: - storage = client.storage.list() + with pytest.warns(DeprecationWarning): + storage = client.storage.list() + assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - storage = client.storage.list( - id="id", - limit=1, - location="location", - name="name", - offset=0, - order_by="order_by", - order_direction="asc", - show_deleted=True, - status="active", - type="s3_compatible", - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.list( + id="id", + limit=1, + location="location", + name="name", + offset=0, + order_by="order_by", + order_direction="asc", + show_deleted=True, + status="active", + type="s3_compatible", + ) + assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.storage.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = client.storage.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -154,12 +159,13 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.storage.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = response.parse() - assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) + storage = response.parse() + assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -200,16 +206,19 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: - storage = client.storage.get( - 0, - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.get( + 0, + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.storage.with_raw_response.get( - 0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.with_raw_response.get( + 0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -218,14 +227,15 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.storage.with_streaming_response.get( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = response.parse() - assert_matches_type(Storage, storage, path=["response"]) + storage = response.parse() + assert_matches_type(Storage, storage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -269,24 +279,29 @@ def test_streaming_response_link_ssh_key(self, client: Gcore) -> None: @parametrize def test_method_restore(self, client: Gcore) -> None: - storage = client.storage.restore( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.restore( + storage_id=0, + ) + assert storage is None @parametrize def test_method_restore_with_all_params(self, client: Gcore) -> None: - storage = client.storage.restore( - storage_id=0, - client_id=0, - ) + with pytest.warns(DeprecationWarning): + storage = client.storage.restore( + storage_id=0, + client_id=0, + ) + assert storage is None @parametrize def test_raw_response_restore(self, client: Gcore) -> None: - response = client.storage.with_raw_response.restore( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = client.storage.with_raw_response.restore( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -295,14 +310,15 @@ def test_raw_response_restore(self, client: Gcore) -> None: @parametrize def test_streaming_response_restore(self, client: Gcore) -> None: - with client.storage.with_streaming_response.restore( - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.storage.with_streaming_response.restore( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = response.parse() - assert storage is None + storage = response.parse() + assert storage is None assert cast(Any, response.is_closed) is True @@ -452,28 +468,33 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.list() + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.list() + assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.list( - id="id", - limit=1, - location="location", - name="name", - offset=0, - order_by="order_by", - order_direction="asc", - show_deleted=True, - status="active", - type="s3_compatible", - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.list( + id="id", + limit=1, + location="location", + name="name", + offset=0, + order_by="order_by", + order_direction="asc", + show_deleted=True, + status="active", + type="s3_compatible", + ) + assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = await async_client.storage.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -482,12 +503,13 @@ 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.storage.with_streaming_response.list() 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.storage.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = await response.parse() - assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) + storage = await response.parse() + assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -528,16 +550,19 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.get( - 0, - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.get( + 0, + ) + assert_matches_type(Storage, storage, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.with_raw_response.get( - 0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.with_raw_response.get( + 0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -546,14 +571,15 @@ 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.storage.with_streaming_response.get( - 0, - ) 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.storage.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = await response.parse() - assert_matches_type(Storage, storage, path=["response"]) + storage = await response.parse() + assert_matches_type(Storage, storage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -597,24 +623,29 @@ async def test_streaming_response_link_ssh_key(self, async_client: AsyncGcore) - @parametrize async def test_method_restore(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.restore( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.restore( + storage_id=0, + ) + assert storage is None @parametrize async def test_method_restore_with_all_params(self, async_client: AsyncGcore) -> None: - storage = await async_client.storage.restore( - storage_id=0, - client_id=0, - ) + with pytest.warns(DeprecationWarning): + storage = await async_client.storage.restore( + storage_id=0, + client_id=0, + ) + assert storage is None @parametrize async def test_raw_response_restore(self, async_client: AsyncGcore) -> None: - response = await async_client.storage.with_raw_response.restore( - storage_id=0, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.storage.with_raw_response.restore( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -623,14 +654,15 @@ async def test_raw_response_restore(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_restore(self, async_client: AsyncGcore) -> None: - async with async_client.storage.with_streaming_response.restore( - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - storage = await response.parse() - assert storage is None + with pytest.warns(DeprecationWarning): + async with async_client.storage.with_streaming_response.restore( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert storage is None assert cast(Any, response.is_closed) is True From 07bbb6cfd9e5cf385834df6161042fb3e17eaacf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:23:02 +0000 Subject: [PATCH 587/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f5ac0e56..432f7762 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-df9e1d982f36387efaf9b6f966b951964fff45860b3cd728fbaf2d82e6318a7f.yml openapi_spec_hash: 2bc2689b7084fda0ff82c8e0d255aab7 -config_hash: cb5d9734170464c1bc79afaeb951cc24 +config_hash: cc382eb85fa2dd3a0927e3016e40fea6 From 5ae739066bcdeca42a1e2b009065cc9893bd2c3a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:51:16 +0000 Subject: [PATCH 588/592] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 432f7762..28ae2359 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-df9e1d982f36387efaf9b6f966b951964fff45860b3cd728fbaf2d82e6318a7f.yml openapi_spec_hash: 2bc2689b7084fda0ff82c8e0d255aab7 -config_hash: cc382eb85fa2dd3a0927e3016e40fea6 +config_hash: a46b2d2b717254b28bd515e402527a0a From f625ec3d896fd8b6494fbea1fb8deb39dd63c4b1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 10:22:46 +0000 Subject: [PATCH 589/592] refactor(iam)!: rename models and update examples --- .stats.yml | 2 +- src/gcore/resources/iam/api.md | 12 +- src/gcore/resources/iam/users.py | 50 ++++---- src/gcore/types/iam/__init__.py | 9 +- src/gcore/types/iam/account_overview.py | 24 +--- .../types/iam/api_token_create_params.py | 22 +--- src/gcore/types/iam/api_token_created.py | 75 +----------- src/gcore/types/iam/api_token_list.py | 81 +------------ src/gcore/types/iam/auth_type.py | 7 ++ src/gcore/types/iam/user.py | 31 ++--- src/gcore/types/iam/user_detailed.py | 109 ------------------ src/gcore/types/iam/user_group.py | 24 ++++ src/gcore/types/iam/user_group_param.py | 21 ++++ src/gcore/types/iam/user_invite_params.py | 25 ++-- .../iam/{user_invite.py => user_invited.py} | 4 +- src/gcore/types/iam/user_language.py | 7 ++ src/gcore/types/iam/user_type.py | 7 ++ src/gcore/types/iam/user_update_params.py | 9 +- src/gcore/types/iam/user_updated.py | 109 ------------------ tests/api_resources/iam/test_users.py | 44 ++++--- 20 files changed, 167 insertions(+), 505 deletions(-) create mode 100644 src/gcore/types/iam/auth_type.py delete mode 100644 src/gcore/types/iam/user_detailed.py create mode 100644 src/gcore/types/iam/user_group.py create mode 100644 src/gcore/types/iam/user_group_param.py rename src/gcore/types/iam/{user_invite.py => user_invited.py} (79%) create mode 100644 src/gcore/types/iam/user_language.py create mode 100644 src/gcore/types/iam/user_type.py delete mode 100644 src/gcore/types/iam/user_updated.py diff --git a/.stats.yml b/.stats.yml index 28ae2359..2f352e42 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-df9e1d982f36387efaf9b6f966b951964fff45860b3cd728fbaf2d82e6318a7f.yml openapi_spec_hash: 2bc2689b7084fda0ff82c8e0d255aab7 -config_hash: a46b2d2b717254b28bd515e402527a0a +config_hash: bb393d75841ee0866eef7b1defa5a953 diff --git a/src/gcore/resources/iam/api.md b/src/gcore/resources/iam/api.md index b6411972..1efd49a5 100644 --- a/src/gcore/resources/iam/api.md +++ b/src/gcore/resources/iam/api.md @@ -3,7 +3,7 @@ Types: ```python -from gcore.types.iam import AccountOverview +from gcore.types.iam import AccountOverview, AuthType, UserGroup, UserLanguage ``` Methods: @@ -15,7 +15,7 @@ Methods: Types: ```python -from gcore.types.iam import APIToken, APITokenCreated, APITokenList +from gcore.types.iam import APIToken, APITokenClientUser, APITokenCreated, APITokenList ``` Methods: @@ -30,13 +30,13 @@ Methods: Types: ```python -from gcore.types.iam import User, UserDetailed, UserInvite, UserUpdated +from gcore.types.iam import User, UserInvited, UserType ``` Methods: -- client.iam.users.update(user_id, \*\*params) -> UserUpdated +- client.iam.users.update(user_id, \*\*params) -> User - client.iam.users.list(\*\*params) -> SyncOffsetPage[User] - client.iam.users.delete(user_id, \*, client_id) -> None -- client.iam.users.get(user_id) -> UserDetailed -- client.iam.users.invite(\*\*params) -> UserInvite +- client.iam.users.get(user_id) -> User +- client.iam.users.invite(\*\*params) -> UserInvited diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index 46d9a50c..a991e150 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -3,7 +3,6 @@ from __future__ import annotations from typing import List, Optional -from typing_extensions import Literal import httpx @@ -17,13 +16,14 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...types.iam import user_list_params, user_invite_params, user_update_params +from ...types.iam import UserLanguage, user_list_params, user_invite_params, user_update_params from ...pagination import SyncOffsetPage, AsyncOffsetPage from ..._base_client import AsyncPaginator, make_request_options from ...types.iam.user import User -from ...types.iam.user_invite import UserInvite -from ...types.iam.user_updated import UserUpdated -from ...types.iam.user_detailed import UserDetailed +from ...types.iam.auth_type import AuthType +from ...types.iam.user_invited import UserInvited +from ...types.iam.user_language import UserLanguage +from ...types.iam.user_group_param import UserGroupParam __all__ = ["UsersResource", "AsyncUsersResource"] @@ -52,9 +52,9 @@ def update( self, user_id: int, *, - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]], + auth_types: List[AuthType], email: str, - lang: Literal["de", "en", "ru", "zh", "az"], + lang: UserLanguage, name: Optional[str], phone: Optional[str], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -63,7 +63,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserUpdated: + ) -> User: """This method updates user's details. Args: @@ -104,7 +104,7 @@ def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=UserUpdated, + cast_to=User, ) def list( @@ -203,7 +203,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserDetailed: + ) -> User: """ Get user's details @@ -221,7 +221,7 @@ def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=UserDetailed, + cast_to=User, ) def invite( @@ -229,8 +229,8 @@ def invite( *, client_id: int, email: str, - user_role: user_invite_params.UserRole, - lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, + user_role: UserGroupParam, + lang: UserLanguage | 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. @@ -238,7 +238,7 @@ def invite( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserInvite: + ) -> UserInvited: """Invite a user to the account. User will receive an email. @@ -281,7 +281,7 @@ def invite( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=UserInvite, + cast_to=UserInvited, ) @@ -309,9 +309,9 @@ async def update( self, user_id: int, *, - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]], + auth_types: List[AuthType], email: str, - lang: Literal["de", "en", "ru", "zh", "az"], + lang: UserLanguage, name: Optional[str], phone: Optional[str], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -320,7 +320,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserUpdated: + ) -> User: """This method updates user's details. Args: @@ -361,7 +361,7 @@ async def update( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=UserUpdated, + cast_to=User, ) def list( @@ -460,7 +460,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserDetailed: + ) -> User: """ Get user's details @@ -478,7 +478,7 @@ async def get( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=UserDetailed, + cast_to=User, ) async def invite( @@ -486,8 +486,8 @@ async def invite( *, client_id: int, email: str, - user_role: user_invite_params.UserRole, - lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, + user_role: UserGroupParam, + lang: UserLanguage | 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. @@ -495,7 +495,7 @@ async def invite( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> UserInvite: + ) -> UserInvited: """Invite a user to the account. User will receive an email. @@ -538,7 +538,7 @@ async def invite( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=UserInvite, + cast_to=UserInvited, ) diff --git a/src/gcore/types/iam/__init__.py b/src/gcore/types/iam/__init__.py index 849d7323..09b4b8ce 100644 --- a/src/gcore/types/iam/__init__.py +++ b/src/gcore/types/iam/__init__.py @@ -4,11 +4,14 @@ from .user import User as User from .api_token import APIToken as APIToken -from .user_invite import UserInvite as UserInvite -from .user_updated import UserUpdated as UserUpdated -from .user_detailed import UserDetailed as UserDetailed +from .auth_type import AuthType as AuthType +from .user_type import UserType as UserType +from .user_group import UserGroup as UserGroup +from .user_invited import UserInvited as UserInvited +from .user_language import UserLanguage as UserLanguage from .api_token_list import APITokenList as APITokenList from .account_overview import AccountOverview as AccountOverview +from .user_group_param import UserGroupParam as UserGroupParam from .user_list_params import UserListParams as UserListParams from .api_token_created import APITokenCreated as APITokenCreated from .user_invite_params import UserInviteParams as UserInviteParams diff --git a/src/gcore/types/iam/account_overview.py b/src/gcore/types/iam/account_overview.py index ad8a265e..2f1fdb77 100644 --- a/src/gcore/types/iam/account_overview.py +++ b/src/gcore/types/iam/account_overview.py @@ -6,6 +6,9 @@ from pydantic import Field as FieldInfo from ..._models import BaseModel +from .auth_type import AuthType +from .user_group import UserGroup +from .user_language import UserLanguage __all__ = [ "AccountOverview", @@ -31,7 +34,6 @@ "ServiceStatusesStorage", "ServiceStatusesStreaming", "User", - "UserGroup", ] @@ -365,22 +367,6 @@ class ServiceStatuses(BaseModel): streaming: Optional[ServiceStatusesStreaming] = FieldInfo(alias="STREAMING", default=None) -class UserGroup(BaseModel): - id: Optional[int] = None - """Group's ID: Possible values are: - - - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only - (API+Web)* 3022 - Purge and Prefetch only (API) - """ - - name: Optional[ - Literal[ - "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" - ] - ] = None - """Group's name.""" - - class User(BaseModel): id: Optional[int] = None """User's ID.""" @@ -392,7 +378,7 @@ class User(BaseModel): - `false` – user did not confirm the email. """ - auth_types: Optional[List[Literal["password", "sso", "github", "google-oauth2"]]] = None + auth_types: Optional[List[AuthType]] = None """System field. List of auth types available for the account.""" client: Optional[float] = None @@ -419,7 +405,7 @@ class User(BaseModel): - Purge and Prefetch only (API+Web) """ - lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None + lang: Optional[UserLanguage] = None """User's language. Defines language of the control panel and email messages. diff --git a/src/gcore/types/iam/api_token_create_params.py b/src/gcore/types/iam/api_token_create_params.py index c8ba1f0e..52a19113 100644 --- a/src/gcore/types/iam/api_token_create_params.py +++ b/src/gcore/types/iam/api_token_create_params.py @@ -3,9 +3,11 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["APITokenCreateParams", "ClientUser", "ClientUserRole"] +from .user_group_param import UserGroupParam + +__all__ = ["APITokenCreateParams", "ClientUser"] class APITokenCreateParams(TypedDict, total=False): @@ -25,21 +27,7 @@ class APITokenCreateParams(TypedDict, total=False): """API token description.""" -class ClientUserRole(TypedDict, total=False): - id: int - """Group's ID: Possible values are: - - - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only - (API+Web)* 3022 - Purge and Prefetch only (API) - """ - - name: Literal[ - "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" - ] - """Group's name.""" - - class ClientUser(TypedDict, total=False): """API token role.""" - role: ClientUserRole + role: UserGroupParam diff --git a/src/gcore/types/iam/api_token_created.py b/src/gcore/types/iam/api_token_created.py index be3c3ff3..c227c690 100644 --- a/src/gcore/types/iam/api_token_created.py +++ b/src/gcore/types/iam/api_token_created.py @@ -1,84 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal -from ..._models import BaseModel +from .api_token import APIToken -__all__ = ["APITokenCreated", "ClientUser", "ClientUserRole"] +__all__ = ["APITokenCreated"] -class ClientUserRole(BaseModel): - id: Optional[int] = None - """Group's ID: Possible values are: - - - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only - (API+Web)* 3022 - Purge and Prefetch only (API) - """ - - name: Optional[ - Literal[ - "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" - ] - ] = None - """Group's name.""" - - -class ClientUser(BaseModel): - client_id: int - """Account's ID.""" - - deleted: bool - """Deletion flag. If true, then the API token was deleted.""" - - role: ClientUserRole - - user_email: str - """User's email who issued the API token.""" - - user_id: int - """User's ID who issued the API token.""" - - user_name: str - """User's name who issued the API token.""" - - -class APITokenCreated(BaseModel): - id: int - """API token ID.""" - - client_user: ClientUser - - created: str - """Date when the API token was issued (ISO 8086/RFC 3339 format), UTC.""" - - deleted: bool - """Deletion flag. If true, then the API token was deleted.""" - - exp_date: Optional[str] = None - """ - Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If - null, then the API token will never expire. - """ - - expired: bool - """Expiration flag. - - If true, then the API token has expired. When an API token expires it will be - automatically deleted. - """ - - last_usage: str - """Date when the API token was last used (ISO 8086/RFC 3339 format), UTC.""" - - name: str - """API token name.""" - +class APITokenCreated(APIToken): token: Optional[str] = None """ API token. Copy it, because you will not be able to get it again. We do not store tokens. All responsibility for token storage and usage is on the issuer. """ - - description: Optional[str] = None - """API token description.""" diff --git a/src/gcore/types/iam/api_token_list.py b/src/gcore/types/iam/api_token_list.py index 2bf046b6..417db767 100644 --- a/src/gcore/types/iam/api_token_list.py +++ b/src/gcore/types/iam/api_token_list.py @@ -1,81 +1,10 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from typing_extensions import Literal, TypeAlias +from typing import List +from typing_extensions import TypeAlias -from ..._models import BaseModel +from .api_token import APIToken -__all__ = ["APITokenList", "APITokenListItem", "APITokenListItemClientUser", "APITokenListItemClientUserRole"] +__all__ = ["APITokenList"] - -class APITokenListItemClientUserRole(BaseModel): - id: Optional[int] = None - """Group's ID: Possible values are: - - - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only - (API+Web)* 3022 - Purge and Prefetch only (API) - """ - - name: Optional[ - Literal[ - "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" - ] - ] = None - """Group's name.""" - - -class APITokenListItemClientUser(BaseModel): - client_id: int - """Account's ID.""" - - deleted: bool - """Deletion flag. If true, then the API token was deleted.""" - - role: APITokenListItemClientUserRole - - user_email: str - """User's email who issued the API token.""" - - user_id: int - """User's ID who issued the API token.""" - - user_name: str - """User's name who issued the API token.""" - - -class APITokenListItem(BaseModel): - id: int - """API token ID.""" - - client_user: APITokenListItemClientUser - - created: str - """Date when the API token was issued (ISO 8086/RFC 3339 format), UTC.""" - - deleted: bool - """Deletion flag. If true, then the API token was deleted.""" - - exp_date: Optional[str] = None - """ - Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If - null, then the API token will never expire. - """ - - expired: bool - """Expiration flag. - - If true, then the API token has expired. When an API token expires it will be - automatically deleted. - """ - - last_usage: str - """Date when the API token was last used (ISO 8086/RFC 3339 format), UTC.""" - - name: str - """API token name.""" - - description: Optional[str] = None - """API token description.""" - - -APITokenList: TypeAlias = List[APITokenListItem] +APITokenList: TypeAlias = List[APIToken] diff --git a/src/gcore/types/iam/auth_type.py b/src/gcore/types/iam/auth_type.py new file mode 100644 index 00000000..380a0cf9 --- /dev/null +++ b/src/gcore/types/iam/auth_type.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["AuthType"] + +AuthType: TypeAlias = Literal["password", "sso", "github", "google-oauth2"] diff --git a/src/gcore/types/iam/user.py b/src/gcore/types/iam/user.py index 0dcaa14b..d8d52eb6 100644 --- a/src/gcore/types/iam/user.py +++ b/src/gcore/types/iam/user.py @@ -1,11 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Optional -from typing_extensions import Literal from ..._models import BaseModel +from .auth_type import AuthType +from .user_type import UserType +from .user_group import UserGroup +from .user_language import UserLanguage -__all__ = ["User", "ClientAndRole", "Group"] +__all__ = ["User", "ClientAndRole"] class ClientAndRole(BaseModel): @@ -20,22 +23,6 @@ class ClientAndRole(BaseModel): """User role in this client.""" -class Group(BaseModel): - id: Optional[int] = None - """Group's ID: Possible values are: - - - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only - (API+Web)* 3022 - Purge and Prefetch only (API) - """ - - name: Optional[ - Literal[ - "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" - ] - ] = None - """Group's name.""" - - class User(BaseModel): id: int """User's ID.""" @@ -47,7 +34,7 @@ class User(BaseModel): - `false` – user did not confirm the email. """ - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] + auth_types: List[AuthType] """System field. List of auth types available for the account.""" client: float @@ -65,7 +52,7 @@ class User(BaseModel): email: str """User's email address.""" - groups: List[Group] + groups: List[UserGroup] """User's group in the current account. IAM supports 5 groups: @@ -80,7 +67,7 @@ class User(BaseModel): is_active: bool """User activity flag.""" - lang: Literal["de", "en", "ru", "zh", "az"] + lang: UserLanguage """User's language. Defines language of the control panel and email messages. @@ -105,5 +92,5 @@ class User(BaseModel): - `false` – user disabled two-step verification. """ - user_type: Literal["common", "reseller", "seller"] + user_type: UserType """User's type.""" diff --git a/src/gcore/types/iam/user_detailed.py b/src/gcore/types/iam/user_detailed.py deleted file mode 100644 index 976262c5..00000000 --- a/src/gcore/types/iam/user_detailed.py +++ /dev/null @@ -1,109 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["UserDetailed", "ClientAndRole", "Group"] - - -class ClientAndRole(BaseModel): - client_company_name: str - - client_id: int - - user_id: int - """User's ID.""" - - user_roles: List[str] - """User role in this client.""" - - -class Group(BaseModel): - id: Optional[int] = None - """Group's ID: Possible values are: - - - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only - (API+Web)* 3022 - Purge and Prefetch only (API) - """ - - name: Optional[ - Literal[ - "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" - ] - ] = None - """Group's name.""" - - -class UserDetailed(BaseModel): - id: int - """User's ID.""" - - activated: bool - """Email confirmation: - - - `true` – user confirmed the email; - - `false` – user did not confirm the email. - """ - - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] - """System field. List of auth types available for the account.""" - - client: float - """User's account ID.""" - - client_and_roles: List[ClientAndRole] - """List of user's clients. User can access to one or more clients.""" - - company: str - """User's company.""" - - deleted: bool - """Deletion flag. If `true` then user was deleted.""" - - email: str - """User's email address.""" - - groups: List[Group] - """User's group in the current account. - - IAM supports 5 groups: - - - Users - - Administrators - - Engineers - - Purge and Prefetch only (API) - - Purge and Prefetch only (API+Web) - """ - - is_active: bool - """User activity flag.""" - - lang: Literal["de", "en", "ru", "zh", "az"] - """User's language. - - Defines language of the control panel and email messages. - """ - - name: Optional[str] = None - """User's name.""" - - phone: Optional[str] = None - """User's phone.""" - - reseller: int - """Services provider ID.""" - - sso_auth: bool - """SSO authentication flag. If `true` then user can login via SAML SSO.""" - - two_fa: bool - """Two-step verification: - - - `true` – user enabled two-step verification; - - `false` – user disabled two-step verification. - """ - - user_type: Literal["common", "reseller", "seller"] - """User's type.""" diff --git a/src/gcore/types/iam/user_group.py b/src/gcore/types/iam/user_group.py new file mode 100644 index 00000000..4902b150 --- /dev/null +++ b/src/gcore/types/iam/user_group.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["UserGroup"] + + +class UserGroup(BaseModel): + id: Optional[int] = None + """Group's ID: Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + """ + + name: Optional[ + Literal[ + "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" + ] + ] = None + """Group's name.""" diff --git a/src/gcore/types/iam/user_group_param.py b/src/gcore/types/iam/user_group_param.py new file mode 100644 index 00000000..83d6536b --- /dev/null +++ b/src/gcore/types/iam/user_group_param.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__ = ["UserGroupParam"] + + +class UserGroupParam(TypedDict, total=False): + id: int + """Group's ID: Possible values are: + + - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only + (API+Web)* 3022 - Purge and Prefetch only (API) + """ + + name: Literal[ + "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" + ] + """Group's name.""" diff --git a/src/gcore/types/iam/user_invite_params.py b/src/gcore/types/iam/user_invite_params.py index 47c0baac..d0b17b53 100644 --- a/src/gcore/types/iam/user_invite_params.py +++ b/src/gcore/types/iam/user_invite_params.py @@ -2,9 +2,12 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["UserInviteParams", "UserRole"] +from .user_language import UserLanguage +from .user_group_param import UserGroupParam + +__all__ = ["UserInviteParams"] class UserInviteParams(TypedDict, total=False): @@ -14,9 +17,9 @@ class UserInviteParams(TypedDict, total=False): email: Required[str] """User email.""" - user_role: Required[UserRole] + user_role: Required[UserGroupParam] - lang: Literal["de", "en", "ru", "zh", "az"] + lang: UserLanguage """User's language. Defines language of the control panel and email messages. @@ -24,17 +27,3 @@ class UserInviteParams(TypedDict, total=False): name: str """User name.""" - - -class UserRole(TypedDict, total=False): - id: int - """Group's ID: Possible values are: - - - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only - (API+Web)* 3022 - Purge and Prefetch only (API) - """ - - name: Literal[ - "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" - ] - """Group's name.""" diff --git a/src/gcore/types/iam/user_invite.py b/src/gcore/types/iam/user_invited.py similarity index 79% rename from src/gcore/types/iam/user_invite.py rename to src/gcore/types/iam/user_invited.py index 2579f935..3d27c7e7 100644 --- a/src/gcore/types/iam/user_invite.py +++ b/src/gcore/types/iam/user_invited.py @@ -2,10 +2,10 @@ from ..._models import BaseModel -__all__ = ["UserInvite"] +__all__ = ["UserInvited"] -class UserInvite(BaseModel): +class UserInvited(BaseModel): status: str """Status of the invitation.""" diff --git a/src/gcore/types/iam/user_language.py b/src/gcore/types/iam/user_language.py new file mode 100644 index 00000000..c1f383e5 --- /dev/null +++ b/src/gcore/types/iam/user_language.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["UserLanguage"] + +UserLanguage: TypeAlias = Literal["de", "en", "ru", "zh", "az"] diff --git a/src/gcore/types/iam/user_type.py b/src/gcore/types/iam/user_type.py new file mode 100644 index 00000000..d74d34b1 --- /dev/null +++ b/src/gcore/types/iam/user_type.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["UserType"] + +UserType: TypeAlias = Literal["common", "reseller", "seller"] diff --git a/src/gcore/types/iam/user_update_params.py b/src/gcore/types/iam/user_update_params.py index 2874ef20..751444f5 100644 --- a/src/gcore/types/iam/user_update_params.py +++ b/src/gcore/types/iam/user_update_params.py @@ -3,19 +3,22 @@ from __future__ import annotations from typing import List, Optional -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict + +from .auth_type import AuthType +from .user_language import UserLanguage __all__ = ["UserUpdateParams"] class UserUpdateParams(TypedDict, total=False): - auth_types: Required[List[Literal["password", "sso", "github", "google-oauth2"]]] + auth_types: Required[List[AuthType]] """System field. List of auth types available for the account.""" email: Required[str] """User's email address.""" - lang: Required[Literal["de", "en", "ru", "zh", "az"]] + lang: Required[UserLanguage] """User's language. Defines language of the control panel and email messages. diff --git a/src/gcore/types/iam/user_updated.py b/src/gcore/types/iam/user_updated.py deleted file mode 100644 index d3e5c38c..00000000 --- a/src/gcore/types/iam/user_updated.py +++ /dev/null @@ -1,109 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["UserUpdated", "ClientAndRole", "Group"] - - -class ClientAndRole(BaseModel): - client_company_name: str - - client_id: int - - user_id: int - """User's ID.""" - - user_roles: List[str] - """User role in this client.""" - - -class Group(BaseModel): - id: Optional[int] = None - """Group's ID: Possible values are: - - - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only - (API+Web)* 3022 - Purge and Prefetch only (API) - """ - - name: Optional[ - Literal[ - "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" - ] - ] = None - """Group's name.""" - - -class UserUpdated(BaseModel): - id: int - """User's ID.""" - - activated: bool - """Email confirmation: - - - `true` – user confirmed the email; - - `false` – user did not confirm the email. - """ - - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] - """System field. List of auth types available for the account.""" - - client: float - """User's account ID.""" - - client_and_roles: List[ClientAndRole] - """List of user's clients. User can access to one or more clients.""" - - company: str - """User's company.""" - - deleted: bool - """Deletion flag. If `true` then user was deleted.""" - - email: str - """User's email address.""" - - groups: List[Group] - """User's group in the current account. - - IAM supports 5 groups: - - - Users - - Administrators - - Engineers - - Purge and Prefetch only (API) - - Purge and Prefetch only (API+Web) - """ - - is_active: bool - """User activity flag.""" - - lang: Literal["de", "en", "ru", "zh", "az"] - """User's language. - - Defines language of the control panel and email messages. - """ - - name: Optional[str] = None - """User's name.""" - - phone: Optional[str] = None - """User's phone.""" - - reseller: int - """Services provider ID.""" - - sso_auth: bool - """SSO authentication flag. If `true` then user can login via SAML SSO.""" - - two_fa: bool - """Two-step verification: - - - `true` – user enabled two-step verification; - - `false` – user disabled two-step verification. - """ - - user_type: Literal["common", "reseller", "seller"] - """User's type.""" diff --git a/tests/api_resources/iam/test_users.py b/tests/api_resources/iam/test_users.py index 72116b06..c8c15d5a 100644 --- a/tests/api_resources/iam/test_users.py +++ b/tests/api_resources/iam/test_users.py @@ -11,9 +11,7 @@ from tests.utils import assert_matches_type from gcore.types.iam import ( User, - UserInvite, - UserUpdated, - UserDetailed, + UserInvited, ) from gcore.pagination import SyncOffsetPage, AsyncOffsetPage @@ -33,7 +31,7 @@ def test_method_update(self, client: Gcore) -> None: name="name", phone="phone", ) - assert_matches_type(UserUpdated, user, path=["response"]) + assert_matches_type(User, user, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: @@ -49,7 +47,7 @@ def test_raw_response_update(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserUpdated, user, path=["response"]) + assert_matches_type(User, user, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: @@ -65,7 +63,7 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserUpdated, user, path=["response"]) + assert_matches_type(User, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -141,7 +139,7 @@ def test_method_get(self, client: Gcore) -> None: user = client.iam.users.get( 0, ) - assert_matches_type(UserDetailed, user, path=["response"]) + assert_matches_type(User, user, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: @@ -152,7 +150,7 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserDetailed, user, path=["response"]) + assert_matches_type(User, user, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: @@ -163,7 +161,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserDetailed, user, path=["response"]) + assert_matches_type(User, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -174,7 +172,7 @@ def test_method_invite(self, client: Gcore) -> None: email="dev@stainless.com", user_role={}, ) - assert_matches_type(UserInvite, user, path=["response"]) + assert_matches_type(UserInvited, user, path=["response"]) @parametrize def test_method_invite_with_all_params(self, client: Gcore) -> None: @@ -188,7 +186,7 @@ def test_method_invite_with_all_params(self, client: Gcore) -> None: lang="de", name="name", ) - assert_matches_type(UserInvite, user, path=["response"]) + assert_matches_type(UserInvited, user, path=["response"]) @parametrize def test_raw_response_invite(self, client: Gcore) -> None: @@ -201,7 +199,7 @@ def test_raw_response_invite(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(UserInvite, user, path=["response"]) + assert_matches_type(UserInvited, user, path=["response"]) @parametrize def test_streaming_response_invite(self, client: Gcore) -> None: @@ -214,7 +212,7 @@ def test_streaming_response_invite(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserInvite, user, path=["response"]) + assert_matches_type(UserInvited, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -234,7 +232,7 @@ async def test_method_update(self, async_client: AsyncGcore) -> None: name="name", phone="phone", ) - assert_matches_type(UserUpdated, user, path=["response"]) + assert_matches_type(User, user, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @@ -250,7 +248,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserUpdated, user, path=["response"]) + assert_matches_type(User, user, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: @@ -266,7 +264,7 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserUpdated, user, path=["response"]) + assert_matches_type(User, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -342,7 +340,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: user = await async_client.iam.users.get( 0, ) - assert_matches_type(UserDetailed, user, path=["response"]) + assert_matches_type(User, user, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @@ -353,7 +351,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserDetailed, user, path=["response"]) + assert_matches_type(User, user, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @@ -364,7 +362,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserDetailed, user, path=["response"]) + assert_matches_type(User, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -375,7 +373,7 @@ async def test_method_invite(self, async_client: AsyncGcore) -> None: email="dev@stainless.com", user_role={}, ) - assert_matches_type(UserInvite, user, path=["response"]) + assert_matches_type(UserInvited, user, path=["response"]) @parametrize async def test_method_invite_with_all_params(self, async_client: AsyncGcore) -> None: @@ -389,7 +387,7 @@ async def test_method_invite_with_all_params(self, async_client: AsyncGcore) -> lang="de", name="name", ) - assert_matches_type(UserInvite, user, path=["response"]) + assert_matches_type(UserInvited, user, path=["response"]) @parametrize async def test_raw_response_invite(self, async_client: AsyncGcore) -> None: @@ -402,7 +400,7 @@ async def test_raw_response_invite(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(UserInvite, user, path=["response"]) + assert_matches_type(UserInvited, user, path=["response"]) @parametrize async def test_streaming_response_invite(self, async_client: AsyncGcore) -> None: @@ -415,6 +413,6 @@ async def test_streaming_response_invite(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserInvite, user, path=["response"]) + assert_matches_type(UserInvited, user, path=["response"]) assert cast(Any, response.is_closed) is True From 559caf24960f137f479e7bd0c3950fe5e7e5ab1e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 10:23:30 +0000 Subject: [PATCH 590/592] refactor(iam)!: rename models and update examples From 79d561bd711747ecb3eb21e8a05b495845e89bc5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 10:24:17 +0000 Subject: [PATCH 591/592] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/storage/credentials.py | 34 ++- src/gcore/resources/storage/storage.py | 96 +++------ tests/api_resources/test_storage.py | 230 +++++++++------------ 4 files changed, 139 insertions(+), 225 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2f352e42..c2d96e20 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-df9e1d982f36387efaf9b6f966b951964fff45860b3cd728fbaf2d82e6318a7f.yml -openapi_spec_hash: 2bc2689b7084fda0ff82c8e0d255aab7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f0d2dade6af13e1da5b65d77c0201bfb046ec74dcc01a0d81966672a3623bf39.yml +openapi_spec_hash: ea2bf017f2430f46e006c31e0d3be4a6 config_hash: bb393d75841ee0866eef7b1defa5a953 diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index 7ec32469..2b317f6f 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -60,17 +60,14 @@ def recreate( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: - """Resets ALL access credentials for the storage. - - For S3 storage this replaces all - existing access keys with a single new key pair. For SFTP storage this resets - the password. + """ + Generates new access credentials for the storage (S3 keys for S3 storage, SFTP + password for SFTP storage). - Deprecated: Use POST /v4/`object_storages`/{`storage_id`}/`access_keys` to - create individual access keys, DELETE - /v4/`object_storages`/{`storage_id`}/`access_keys`/{`access_key`} to remove - specific keys, or PATCH /v4/`sftp_storages`/{`storage_id`}/credentials for SFTP - storage instead. + Deprecated: Use POST + /provisioning/v3/storages/`s3_compatible`/{`storage_id`}/credentials/reset for + S3 storage or PATCH /provisioning/v3/storages/sftp/{`storage_id`}/credentials + for SFTP storage instead. Args: extra_headers: Send extra headers @@ -137,17 +134,14 @@ async def recreate( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: - """Resets ALL access credentials for the storage. - - For S3 storage this replaces all - existing access keys with a single new key pair. For SFTP storage this resets - the password. + """ + Generates new access credentials for the storage (S3 keys for S3 storage, SFTP + password for SFTP storage). - Deprecated: Use POST /v4/`object_storages`/{`storage_id`}/`access_keys` to - create individual access keys, DELETE - /v4/`object_storages`/{`storage_id`}/`access_keys`/{`access_key`} to remove - specific keys, or PATCH /v4/`sftp_storages`/{`storage_id`}/credentials for SFTP - storage instead. + Deprecated: Use POST + /provisioning/v3/storages/`s3_compatible`/{`storage_id`}/credentials/reset for + S3 storage or PATCH /provisioning/v3/storages/sftp/{`storage_id`}/credentials + for SFTP storage instead. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index 0999e354..41b6edb5 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -211,7 +211,6 @@ def update( cast_to=Storage, ) - @typing_extensions.deprecated("deprecated") def list( self, *, @@ -240,9 +239,6 @@ def list( (independent of pagination) results: the current page of storages according to limit/offset - Deprecated: Use GET /v4/`object_storages` for S3 storages or GET - /v4/`sftp_storages` for SFTP storages instead. - Args: id: Filter by storage ID @@ -336,7 +332,6 @@ def delete( cast_to=NoneType, ) - @typing_extensions.deprecated("deprecated") def get( self, storage_id: int, @@ -352,9 +347,6 @@ def get( Retrieves detailed information about a specific storage including its configuration, credentials, and current status. - Deprecated: Use GET /v4/`object_storages`/{`storage_id`} for S3 storages or GET - /v4/`sftp_storages`/{`storage_id`} for SFTP storages instead. - Args: extra_headers: Send extra headers @@ -413,7 +405,6 @@ def link_ssh_key( cast_to=NoneType, ) - @typing_extensions.deprecated("deprecated") def restore( self, storage_id: int, @@ -430,9 +421,6 @@ def restore( Restores a previously deleted S3 storage if it was deleted within the last 2 weeks. SFTP storages cannot be restored. - Deprecated: Use POST - /provisioning/v3/storages/`s3_compatible`/{`storage_id`}/restore instead. - Args: extra_headers: Send extra headers @@ -651,7 +639,6 @@ async def update( cast_to=Storage, ) - @typing_extensions.deprecated("deprecated") def list( self, *, @@ -680,9 +667,6 @@ def list( (independent of pagination) results: the current page of storages according to limit/offset - Deprecated: Use GET /v4/`object_storages` for S3 storages or GET - /v4/`sftp_storages` for SFTP storages instead. - Args: id: Filter by storage ID @@ -776,7 +760,6 @@ async def delete( cast_to=NoneType, ) - @typing_extensions.deprecated("deprecated") async def get( self, storage_id: int, @@ -792,9 +775,6 @@ async def get( Retrieves detailed information about a specific storage including its configuration, credentials, and current status. - Deprecated: Use GET /v4/`object_storages`/{`storage_id`} for S3 storages or GET - /v4/`sftp_storages`/{`storage_id`} for SFTP storages instead. - Args: extra_headers: Send extra headers @@ -853,7 +833,6 @@ async def link_ssh_key( cast_to=NoneType, ) - @typing_extensions.deprecated("deprecated") async def restore( self, storage_id: int, @@ -870,9 +849,6 @@ async def restore( Restores a previously deleted S3 storage if it was deleted within the last 2 weeks. SFTP storages cannot be restored. - Deprecated: Use POST - /provisioning/v3/storages/`s3_compatible`/{`storage_id`}/restore instead. - Args: extra_headers: Send extra headers @@ -953,30 +929,24 @@ def __init__(self, storage: StorageResource) -> None: storage.update, # pyright: ignore[reportDeprecated], ) ) - self.list = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - storage.list, # pyright: ignore[reportDeprecated], - ) + self.list = to_raw_response_wrapper( + storage.list, ) self.delete = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( storage.delete, # pyright: ignore[reportDeprecated], ) ) - self.get = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - storage.get, # pyright: ignore[reportDeprecated], - ) + self.get = to_raw_response_wrapper( + storage.get, ) self.link_ssh_key = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( storage.link_ssh_key, # pyright: ignore[reportDeprecated], ) ) - self.restore = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - storage.restore, # pyright: ignore[reportDeprecated], - ) + self.restore = to_raw_response_wrapper( + storage.restore, ) self.unlink_ssh_key = ( # pyright: ignore[reportDeprecated] to_raw_response_wrapper( @@ -1015,30 +985,24 @@ def __init__(self, storage: AsyncStorageResource) -> None: storage.update, # pyright: ignore[reportDeprecated], ) ) - self.list = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - storage.list, # pyright: ignore[reportDeprecated], - ) + self.list = async_to_raw_response_wrapper( + storage.list, ) self.delete = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( storage.delete, # pyright: ignore[reportDeprecated], ) ) - self.get = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - storage.get, # pyright: ignore[reportDeprecated], - ) + self.get = async_to_raw_response_wrapper( + storage.get, ) self.link_ssh_key = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( storage.link_ssh_key, # pyright: ignore[reportDeprecated], ) ) - self.restore = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - storage.restore, # pyright: ignore[reportDeprecated], - ) + self.restore = async_to_raw_response_wrapper( + storage.restore, ) self.unlink_ssh_key = ( # pyright: ignore[reportDeprecated] async_to_raw_response_wrapper( @@ -1077,30 +1041,24 @@ def __init__(self, storage: StorageResource) -> None: storage.update, # pyright: ignore[reportDeprecated], ) ) - self.list = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - storage.list, # pyright: ignore[reportDeprecated], - ) + self.list = to_streamed_response_wrapper( + storage.list, ) self.delete = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( storage.delete, # pyright: ignore[reportDeprecated], ) ) - self.get = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - storage.get, # pyright: ignore[reportDeprecated], - ) + self.get = to_streamed_response_wrapper( + storage.get, ) self.link_ssh_key = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( storage.link_ssh_key, # pyright: ignore[reportDeprecated], ) ) - self.restore = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - storage.restore, # pyright: ignore[reportDeprecated], - ) + self.restore = to_streamed_response_wrapper( + storage.restore, ) self.unlink_ssh_key = ( # pyright: ignore[reportDeprecated] to_streamed_response_wrapper( @@ -1139,30 +1097,24 @@ def __init__(self, storage: AsyncStorageResource) -> None: storage.update, # pyright: ignore[reportDeprecated], ) ) - self.list = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - storage.list, # pyright: ignore[reportDeprecated], - ) + self.list = async_to_streamed_response_wrapper( + storage.list, ) self.delete = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( storage.delete, # pyright: ignore[reportDeprecated], ) ) - self.get = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - storage.get, # pyright: ignore[reportDeprecated], - ) + self.get = async_to_streamed_response_wrapper( + storage.get, ) self.link_ssh_key = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( storage.link_ssh_key, # pyright: ignore[reportDeprecated], ) ) - self.restore = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - storage.restore, # pyright: ignore[reportDeprecated], - ) + self.restore = async_to_streamed_response_wrapper( + storage.restore, ) self.unlink_ssh_key = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( diff --git a/tests/api_resources/test_storage.py b/tests/api_resources/test_storage.py index 90e1d446..8261bb66 100644 --- a/tests/api_resources/test_storage.py +++ b/tests/api_resources/test_storage.py @@ -124,33 +124,28 @@ def test_streaming_response_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - storage = client.storage.list() - + storage = client.storage.list() assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - storage = client.storage.list( - id="id", - limit=1, - location="location", - name="name", - offset=0, - order_by="order_by", - order_direction="asc", - show_deleted=True, - status="active", - type="s3_compatible", - ) - + storage = client.storage.list( + id="id", + limit=1, + location="location", + name="name", + offset=0, + order_by="order_by", + order_direction="asc", + show_deleted=True, + status="active", + type="s3_compatible", + ) assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.storage.with_raw_response.list() + response = client.storage.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -159,13 +154,12 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.storage.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.storage.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = response.parse() - assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) + storage = response.parse() + assert_matches_type(SyncOffsetPage[Storage], storage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -206,19 +200,16 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - storage = client.storage.get( - 0, - ) - + storage = client.storage.get( + 0, + ) assert_matches_type(Storage, storage, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.storage.with_raw_response.get( - 0, - ) + response = client.storage.with_raw_response.get( + 0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -227,15 +218,14 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.storage.with_streaming_response.get( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.storage.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = response.parse() - assert_matches_type(Storage, storage, path=["response"]) + storage = response.parse() + assert_matches_type(Storage, storage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -279,29 +269,24 @@ def test_streaming_response_link_ssh_key(self, client: Gcore) -> None: @parametrize def test_method_restore(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - storage = client.storage.restore( - storage_id=0, - ) - + storage = client.storage.restore( + storage_id=0, + ) assert storage is None @parametrize def test_method_restore_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - storage = client.storage.restore( - storage_id=0, - client_id=0, - ) - + storage = client.storage.restore( + storage_id=0, + client_id=0, + ) assert storage is None @parametrize def test_raw_response_restore(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.storage.with_raw_response.restore( - storage_id=0, - ) + response = client.storage.with_raw_response.restore( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -310,15 +295,14 @@ def test_raw_response_restore(self, client: Gcore) -> None: @parametrize def test_streaming_response_restore(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.storage.with_streaming_response.restore( - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.storage.with_streaming_response.restore( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = response.parse() - assert storage is None + storage = response.parse() + assert storage is None assert cast(Any, response.is_closed) is True @@ -468,33 +452,28 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - storage = await async_client.storage.list() - + storage = await async_client.storage.list() assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - storage = await async_client.storage.list( - id="id", - limit=1, - location="location", - name="name", - offset=0, - order_by="order_by", - order_direction="asc", - show_deleted=True, - status="active", - type="s3_compatible", - ) - + storage = await async_client.storage.list( + id="id", + limit=1, + location="location", + name="name", + offset=0, + order_by="order_by", + order_direction="asc", + show_deleted=True, + status="active", + type="s3_compatible", + ) assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.storage.with_raw_response.list() + response = await async_client.storage.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -503,13 +482,12 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.storage.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + async with async_client.storage.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = await response.parse() - assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) + storage = await response.parse() + assert_matches_type(AsyncOffsetPage[Storage], storage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -550,19 +528,16 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - storage = await async_client.storage.get( - 0, - ) - + storage = await async_client.storage.get( + 0, + ) assert_matches_type(Storage, storage, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.storage.with_raw_response.get( - 0, - ) + response = await async_client.storage.with_raw_response.get( + 0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -571,15 +546,14 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.storage.with_streaming_response.get( - 0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + async with async_client.storage.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - storage = await response.parse() - assert_matches_type(Storage, storage, path=["response"]) + storage = await response.parse() + assert_matches_type(Storage, storage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -623,29 +597,24 @@ async def test_streaming_response_link_ssh_key(self, async_client: AsyncGcore) - @parametrize async def test_method_restore(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - storage = await async_client.storage.restore( - storage_id=0, - ) - + storage = await async_client.storage.restore( + storage_id=0, + ) assert storage is None @parametrize async def test_method_restore_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - storage = await async_client.storage.restore( - storage_id=0, - client_id=0, - ) - + storage = await async_client.storage.restore( + storage_id=0, + client_id=0, + ) assert storage is None @parametrize async def test_raw_response_restore(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.storage.with_raw_response.restore( - storage_id=0, - ) + response = await async_client.storage.with_raw_response.restore( + storage_id=0, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -654,15 +623,14 @@ async def test_raw_response_restore(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_restore(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.storage.with_streaming_response.restore( - storage_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - storage = await response.parse() - assert storage is None + async with async_client.storage.with_streaming_response.restore( + storage_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + storage = await response.parse() + assert storage is None assert cast(Any, response.is_closed) is True From b63adf7e55129ccf84b78af96206c61e231ac64e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 12:24:10 +0000 Subject: [PATCH 592/592] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c2d96e20..5ddb9180 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f0d2dade6af13e1da5b65d77c0201bfb046ec74dcc01a0d81966672a3623bf39.yml -openapi_spec_hash: ea2bf017f2430f46e006c31e0d3be4a6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1ea9d2f6af0a36b491f9e40fc50106b444cdc8a962c1193e6c311cd25f9e0b93.yml +openapi_spec_hash: a7695fe7d7676f6cb4e9a73094de1276 config_hash: bb393d75841ee0866eef7b1defa5a953